From 02f9a73579ec9d5117ef0b055aaacc34092cc514 Mon Sep 17 00:00:00 2001 From: support Date: Mon, 28 Mar 2022 09:06:36 +0000 Subject: [PATCH] Built motion from commit 77825efd.|2.6.7 --- 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/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/import/cm/csvUpdates.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/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/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperAdditionalPhone.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/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/loggers.js | 2 +- server/utils/mask-sensitive-data.js | 2 +- server/utils/safe-template.js | 2 +- 1189 files changed, 1189 insertions(+), 1189 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 912f85c..e3fa8df 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-03-28T08:42:51.354Z", + "time": "2022-03-28T08:58:35.336Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a999245..9f4942c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-28T08:42:51.354Z", + "time": "2022-03-28T08:58:35.336Z", "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 523826b..3a4d16e 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 _0xfaf1=['urlForward[headers],\x20browser[wsindowHeight]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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]'];(function(_0x5f4b36,_0x18cb34){var _0x4765ec=function(_0x2a6c85){while(--_0x2a6c85){_0x5f4b36['push'](_0x5f4b36['shift']());}};_0x4765ec(++_0x18cb34);}(_0xfaf1,0xd3));var _0x1faf=function(_0x388626,_0x1e69e3){_0x388626=_0x388626-0x0;var _0x1fe3f8=_0xfaf1[_0x388626];return _0x1fe3f8;};'use strict';var Sequelize=require(_0x1faf('0x0'));module[_0x1faf('0x1')]={'name':{'type':Sequelize[_0x1faf('0x2')],'get':function(_0x3bfcb2){return this[_0x1faf('0x3')](_0x1faf('0x4'));}},'action':{'type':Sequelize[_0x1faf('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration','motionbar',_0x1faf('0x6'),_0x1faf('0x7'),'browser','bot',_0x1faf('0x8')]],'msg':_0x1faf('0x9')}},'comment':_0x1faf('0x9')},'data1':{'type':Sequelize[_0x1faf('0x5')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x1faf('0x5')](0x1000),'comment':_0x1faf('0xa')},'data3':{'type':Sequelize[_0x1faf('0x5')](0x1000),'comment':_0x1faf('0xb')},'data4':{'type':Sequelize[_0x1faf('0x5')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x1faf('0x5')](0x1000),'comments':_0x1faf('0xc')},'data6':{'type':Sequelize['STRING'],'comments':_0x1faf('0xd')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x8d0f=['contactManager','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action'];(function(_0x4f164c,_0x342f73){var _0x2129aa=function(_0x2b34be){while(--_0x2b34be){_0x4f164c['push'](_0x4f164c['shift']());}};_0x2129aa(++_0x342f73);}(_0x8d0f,0x100));var _0xf8d0=function(_0x42a2e8,_0x1bbcbb){_0x42a2e8=_0x42a2e8-0x0;var _0x2769c4=_0x8d0f[_0x42a2e8];return _0x2769c4;};'use strict';var Sequelize=require(_0xf8d0('0x0'));module[_0xf8d0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2c8ac3){return this[_0xf8d0('0x2')](_0xf8d0('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xf8d0('0x4'),'integration',_0xf8d0('0x5'),_0xf8d0('0x6'),_0xf8d0('0x7'),_0xf8d0('0x8'),'bot',_0xf8d0('0x9')]],'msg':_0xf8d0('0xa')}},'comment':_0xf8d0('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xf8d0('0xb')},'data2':{'type':Sequelize[_0xf8d0('0xc')](0x1000),'comment':_0xf8d0('0xd')},'data3':{'type':Sequelize[_0xf8d0('0xc')](0x1000),'comment':_0xf8d0('0xe')},'data4':{'type':Sequelize[_0xf8d0('0xc')](0x1000),'comments':_0xf8d0('0xf')},'data5':{'type':Sequelize[_0xf8d0('0xc')](0x1000),'comments':_0xf8d0('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0xf8d0('0x11')},'data7':{'type':Sequelize[_0xf8d0('0x12')],'comments':_0xf8d0('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 98ff0b0..19da28c 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 _0x2eb9=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','error','name','send','find','params','body','destroy','Action','eml-format'];(function(_0x39736f,_0x1436a6){var _0x407836=function(_0x5599d8){while(--_0x5599d8){_0x39736f['push'](_0x39736f['shift']());}};_0x407836(++_0x1436a6);}(_0x2eb9,0x1ee));var _0x92eb=function(_0xd814dd,_0x58756e){_0xd814dd=_0xd814dd-0x0;var _0x1cef79=_0x2eb9[_0xd814dd];return _0x1cef79;};'use strict';var emlformat=require(_0x92eb('0x0'));var rimraf=require(_0x92eb('0x1'));var zipdir=require(_0x92eb('0x2'));var jsonpatch=require(_0x92eb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92eb('0x4'));var Mustache=require(_0x92eb('0x5'));var util=require(_0x92eb('0x6'));var path=require(_0x92eb('0x7'));var sox=require('sox');var csv=require(_0x92eb('0x8'));var ejs=require(_0x92eb('0x9'));var fs=require('fs');var fs_extra=require(_0x92eb('0xa'));var _=require(_0x92eb('0xb'));var squel=require(_0x92eb('0xc'));var crypto=require(_0x92eb('0xd'));var jsforce=require(_0x92eb('0xe'));var deskjs=require(_0x92eb('0xf'));var toCsv=require(_0x92eb('0x8'));var querystring=require(_0x92eb('0x10'));var Papa=require(_0x92eb('0x11'));var Redis=require(_0x92eb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x92eb('0x13'));var hardwareService=require(_0x92eb('0x14'));var logger=require(_0x92eb('0x15'))(_0x92eb('0x16'));var utils=require(_0x92eb('0x17'));var config=require(_0x92eb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x92eb('0x19'))['db'];function respondWithStatusCode(_0x6c4c23,_0x2aaedc){_0x2aaedc=_0x2aaedc||0xcc;return function(_0x5cfafb){if(_0x5cfafb){return _0x6c4c23[_0x92eb('0x1a')](_0x2aaedc);}return _0x6c4c23[_0x92eb('0x1b')](_0x2aaedc)[_0x92eb('0x1c')]();};}function respondWithResult(_0x31eaff,_0x97c676){_0x97c676=_0x97c676||0xc8;return function(_0x2d5c0c){if(_0x2d5c0c){return _0x31eaff['status'](_0x97c676)['json'](_0x2d5c0c);}};}function respondWithFilteredResult(_0x3e324e,_0x197ebd){return function(_0x10e07b){if(_0x10e07b){var _0x4b7ed4=typeof _0x197ebd[_0x92eb('0x1d')]===_0x92eb('0x1e')&&typeof _0x197ebd[_0x92eb('0x1f')]==='undefined';var _0x120586=_0x10e07b[_0x92eb('0x20')];var _0x4d5360=_0x4b7ed4?0x0:_0x197ebd[_0x92eb('0x1d')];var _0x418c42=_0x4b7ed4?_0x10e07b[_0x92eb('0x20')]:_0x197ebd['offset']+_0x197ebd['limit'];var _0xaa9d26;if(_0x418c42>=_0x120586){_0x418c42=_0x120586;_0xaa9d26=0xc8;}else{_0xaa9d26=0xce;}_0x3e324e['status'](_0xaa9d26);return _0x3e324e[_0x92eb('0x21')]('Content-Range',_0x4d5360+'-'+_0x418c42+'/'+_0x120586)[_0x92eb('0x22')](_0x10e07b);}return null;};}function patchUpdates(_0x189608){return function(_0x496cef){try{jsonpatch['apply'](_0x496cef,_0x189608,!![]);}catch(_0x206bec){return BPromise['reject'](_0x206bec);}return _0x496cef['save']();};}function saveUpdates(_0x4aeac6,_0x4607e7){return function(_0x2774af){if(_0x2774af){return _0x2774af[_0x92eb('0x23')](_0x4aeac6)[_0x92eb('0x24')](function(_0x35a0b6){return _0x35a0b6;});}return null;};}function removeEntity(_0xa0bb6f,_0x2d8044){return function(_0x59998c){if(_0x59998c){return _0x59998c['destroy']()[_0x92eb('0x24')](function(){_0xa0bb6f[_0x92eb('0x1b')](0xcc)[_0x92eb('0x1c')]();});}};}function handleEntityNotFound(_0x73635,_0x51efb0){return function(_0x5512b7){if(!_0x5512b7){_0x73635[_0x92eb('0x1a')](0x194);}return _0x5512b7;};}function handleError(_0xe17baa,_0x5d52ca){_0x5d52ca=_0x5d52ca||0x1f4;return function(_0x2f2488){logger[_0x92eb('0x25')](_0x2f2488['stack']);if(_0x2f2488[_0x92eb('0x26')]){delete _0x2f2488[_0x92eb('0x26')];}_0xe17baa['status'](_0x5d52ca)[_0x92eb('0x27')](_0x2f2488);};}exports[_0x92eb('0x23')]=function(_0x4234e8,_0x5da088){if(_0x4234e8['body']['id']){delete _0x4234e8['body']['id'];}return db['Action'][_0x92eb('0x28')]({'where':{'id':_0x4234e8[_0x92eb('0x29')]['id']}})[_0x92eb('0x24')](handleEntityNotFound(_0x5da088,null))[_0x92eb('0x24')](saveUpdates(_0x4234e8[_0x92eb('0x2a')],null))[_0x92eb('0x24')](respondWithResult(_0x5da088,null))['catch'](handleError(_0x5da088,null));};exports[_0x92eb('0x2b')]=function(_0x1f315c,_0x181b81){return db[_0x92eb('0x2c')][_0x92eb('0x28')]({'where':{'id':_0x1f315c['params']['id']}})['then'](handleEntityNotFound(_0x181b81,null))[_0x92eb('0x24')](removeEntity(_0x181b81,null))['catch'](handleError(_0x181b81,null));}; \ No newline at end of file +var _0x2e09=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','error','stack','name','body','find','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x2e09,0x147));var _0x92e0=function(_0x4afa83,_0x40a63c){_0x4afa83=_0x4afa83-0x0;var _0x92e8e9=_0x2e09[_0x4afa83];return _0x92e8e9;};'use strict';var emlformat=require(_0x92e0('0x0'));var rimraf=require(_0x92e0('0x1'));var zipdir=require(_0x92e0('0x2'));var jsonpatch=require(_0x92e0('0x3'));var rp=require(_0x92e0('0x4'));var moment=require(_0x92e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x92e0('0x6'));var util=require(_0x92e0('0x7'));var path=require(_0x92e0('0x8'));var sox=require(_0x92e0('0x9'));var csv=require(_0x92e0('0xa'));var ejs=require(_0x92e0('0xb'));var fs=require('fs');var fs_extra=require(_0x92e0('0xc'));var _=require(_0x92e0('0xd'));var squel=require(_0x92e0('0xe'));var crypto=require(_0x92e0('0xf'));var jsforce=require(_0x92e0('0x10'));var deskjs=require(_0x92e0('0x11'));var toCsv=require('to-csv');var querystring=require(_0x92e0('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x92e0('0x13'));var as=require(_0x92e0('0x14'));var hardwareService=require(_0x92e0('0x15'));var logger=require(_0x92e0('0x16'))(_0x92e0('0x17'));var utils=require(_0x92e0('0x18'));var config=require(_0x92e0('0x19'));var licenseUtil=require(_0x92e0('0x1a'));var db=require(_0x92e0('0x1b'))['db'];function respondWithStatusCode(_0x2937bf,_0x1ed437){_0x1ed437=_0x1ed437||0xcc;return function(_0x296b19){if(_0x296b19){return _0x2937bf[_0x92e0('0x1c')](_0x1ed437);}return _0x2937bf['status'](_0x1ed437)['end']();};}function respondWithResult(_0xe296dc,_0x55df5b){_0x55df5b=_0x55df5b||0xc8;return function(_0x185471){if(_0x185471){return _0xe296dc[_0x92e0('0x1d')](_0x55df5b)[_0x92e0('0x1e')](_0x185471);}};}function respondWithFilteredResult(_0x15a8f5,_0x1bf580){return function(_0xf97df9){if(_0xf97df9){var _0x3be913=typeof _0x1bf580['offset']===_0x92e0('0x1f')&&typeof _0x1bf580[_0x92e0('0x20')]===_0x92e0('0x1f');var _0x12dc25=_0xf97df9[_0x92e0('0x21')];var _0x21c8d2=_0x3be913?0x0:_0x1bf580[_0x92e0('0x22')];var _0x28a835=_0x3be913?_0xf97df9[_0x92e0('0x21')]:_0x1bf580[_0x92e0('0x22')]+_0x1bf580[_0x92e0('0x20')];var _0x2231b3;if(_0x28a835>=_0x12dc25){_0x28a835=_0x12dc25;_0x2231b3=0xc8;}else{_0x2231b3=0xce;}_0x15a8f5[_0x92e0('0x1d')](_0x2231b3);return _0x15a8f5[_0x92e0('0x23')]('Content-Range',_0x21c8d2+'-'+_0x28a835+'/'+_0x12dc25)[_0x92e0('0x1e')](_0xf97df9);}return null;};}function patchUpdates(_0x10b6df){return function(_0x3e6986){try{jsonpatch[_0x92e0('0x24')](_0x3e6986,_0x10b6df,!![]);}catch(_0xbb7673){return BPromise['reject'](_0xbb7673);}return _0x3e6986[_0x92e0('0x25')]();};}function saveUpdates(_0x440068,_0x57203e){return function(_0x2cba47){if(_0x2cba47){return _0x2cba47[_0x92e0('0x26')](_0x440068)[_0x92e0('0x27')](function(_0x48b2fc){return _0x48b2fc;});}return null;};}function removeEntity(_0x4be01d,_0x267d86){return function(_0x4aeaa8){if(_0x4aeaa8){return _0x4aeaa8[_0x92e0('0x28')]()[_0x92e0('0x27')](function(){_0x4be01d[_0x92e0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43def0,_0x2bab67){return function(_0x13947b){if(!_0x13947b){_0x43def0[_0x92e0('0x1c')](0x194);}return _0x13947b;};}function handleError(_0x340cd9,_0x4ffb32){_0x4ffb32=_0x4ffb32||0x1f4;return function(_0x2fad3e){logger[_0x92e0('0x29')](_0x2fad3e[_0x92e0('0x2a')]);if(_0x2fad3e[_0x92e0('0x2b')]){delete _0x2fad3e[_0x92e0('0x2b')];}_0x340cd9[_0x92e0('0x1d')](_0x4ffb32)['send'](_0x2fad3e);};}exports[_0x92e0('0x26')]=function(_0x39bf7c,_0x55be74){if(_0x39bf7c[_0x92e0('0x2c')]['id']){delete _0x39bf7c['body']['id'];}return db['Action'][_0x92e0('0x2d')]({'where':{'id':_0x39bf7c['params']['id']}})['then'](handleEntityNotFound(_0x55be74,null))[_0x92e0('0x27')](saveUpdates(_0x39bf7c[_0x92e0('0x2c')],null))[_0x92e0('0x27')](respondWithResult(_0x55be74,null))[_0x92e0('0x2e')](handleError(_0x55be74,null));};exports[_0x92e0('0x28')]=function(_0x1a437d,_0x4e853a){return db[_0x92e0('0x2f')][_0x92e0('0x2d')]({'where':{'id':_0x1a437d['params']['id']}})['then'](handleEntityNotFound(_0x4e853a,null))['then'](removeEntity(_0x4e853a,null))['catch'](handleError(_0x4e853a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ff13eb2..7f61b2e 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 _0x27bd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Action','tools_actions','lodash','../../config/logger'];(function(_0x3711d9,_0x32a172){var _0x41e327=function(_0x2bb81d){while(--_0x2bb81d){_0x3711d9['push'](_0x3711d9['shift']());}};_0x41e327(++_0x32a172);}(_0x27bd,0x136));var _0xd27b=function(_0x453b35,_0x16983d){_0x453b35=_0x453b35-0x0;var _0xeda436=_0x27bd[_0x453b35];return _0xeda436;};'use strict';var _=require(_0xd27b('0x0'));var util=require('util');var logger=require(_0xd27b('0x1'))(_0xd27b('0x2'));var moment=require(_0xd27b('0x3'));var BPromise=require(_0xd27b('0x4'));var rp=require(_0xd27b('0x5'));var fs=require('fs');var path=require(_0xd27b('0x6'));var rimraf=require(_0xd27b('0x7'));var config=require(_0xd27b('0x8'));var attributes=require('./action.attributes');module[_0xd27b('0x9')]=function(_0x5acb86,_0x1ffd89){return _0x5acb86[_0xd27b('0xa')](_0xd27b('0xb'),attributes,{'tableName':_0xd27b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eef=['../../config/logger','api','moment','request-promise','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x8eef,0xb2));var _0xf8ee=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8eef[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xf8ee('0x0'));var util=require(_0xf8ee('0x1'));var logger=require(_0xf8ee('0x2'))(_0xf8ee('0x3'));var moment=require(_0xf8ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xf8ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8ee('0x6'));var config=require('../../config/environment');var attributes=require(_0xf8ee('0x7'));module[_0xf8ee('0x8')]=function(_0x5cb281,_0x3c8258){return _0x5cb281[_0xf8ee('0x9')](_0xf8ee('0xa'),attributes,{'tableName':_0xf8ee('0xb'),'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 643a918..8adc76d 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(_0x5c5f3b,_0x5b9190){var _0x8a59e4=function(_0x50637c){while(--_0x50637c){_0x5c5f3b['push'](_0x5c5f3b['shift']());}};_0x8a59e4(++_0x5b9190);}(_0x5fab,0x177));var _0xb5fa=function(_0x157298,_0x2f1dd2){_0x157298=_0x157298-0x0;var _0x43368c=_0x5fab[_0x157298];return _0x43368c;};'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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ba0e6,_0x39799f){var _0x13f8f8=function(_0x45e298){while(--_0x45e298){_0x1ba0e6['push'](_0x1ba0e6['shift']());}};_0x13f8f8(++_0x39799f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5cc655,_0x4b6145){_0x5cc655=_0x5cc655-0x0;var _0x244379=_0x7fbe[_0x5cc655];return _0x244379;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6e6f3e9..376ac3d 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 _0x1b90=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','path'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x1b90,0xd1));var _0x01b9=function(_0xa47778,_0x3cd87d){_0xa47778=_0xa47778-0x0;var _0x3a8693=_0x1b90[_0xa47778];return _0x3a8693;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x01b9('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b9('0x1')]();var fs_extra=require(_0x01b9('0x2'));var auth=require(_0x01b9('0x3'));var interaction=require(_0x01b9('0x4'));var config=require(_0x01b9('0x5'));var controller=require(_0x01b9('0x6'));router[_0x01b9('0x7')](_0x01b9('0x8'),auth[_0x01b9('0x9')](),controller[_0x01b9('0xa')]);router[_0x01b9('0xb')](_0x01b9('0x8'),auth[_0x01b9('0x9')](),controller[_0x01b9('0xc')]);module[_0x01b9('0xd')]=router; \ No newline at end of file +var _0xbf3a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x2c9e5d,_0x2539b2){var _0x51395d=function(_0x3640db){while(--_0x3640db){_0x2c9e5d['push'](_0x2c9e5d['shift']());}};_0x51395d(++_0x2539b2);}(_0xbf3a,0x185));var _0xabf3=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0xbf3a[_0x2aefb6];return _0x202772;};'use strict';var multer=require(_0xabf3('0x0'));var util=require(_0xabf3('0x1'));var path=require(_0xabf3('0x2'));var timeout=require(_0xabf3('0x3'));var express=require(_0xabf3('0x4'));var router=express[_0xabf3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xabf3('0x6'));var interaction=require(_0xabf3('0x7'));var config=require(_0xabf3('0x8'));var controller=require('./action.controller');router[_0xabf3('0x9')]('/:id',auth[_0xabf3('0xa')](),controller[_0xabf3('0xb')]);router[_0xabf3('0xc')]('/:id',auth[_0xabf3('0xa')](),controller[_0xabf3('0xd')]);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 3376944..b40f17f 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 _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x5a4e2e,_0x35b229){var _0x536d94=function(_0x55596b){while(--_0x55596b){_0x5a4e2e['push'](_0x5a4e2e['shift']());}};_0x536d94(++_0x35b229);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0x5fc3[_0x1a014b];return _0x462258;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x5e053e,_0x4345f3){var _0x3f51d3=function(_0x32b6d5){while(--_0x32b6d5){_0x5e053e['push'](_0x5e053e['shift']());}};_0x3f51d3(++_0x4345f3);}(_0xac9d,0x14d));var _0xdac9=function(_0x18959e,_0x24e830){_0x18959e=_0x18959e-0x0;var _0x308aba=_0xac9d[_0x18959e];return _0x308aba;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 43658db..a0fa29f 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 _0x5529=['toString','sequelize','QueryTypes','SELECT','SUM(%s)','MAX(%s)','MIN(%s)','HOUR(%s)','ROUND(%s)','ValidationErrorItem','AnalyticMetric','keyBy','alias','clone','output','web','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','debug','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','squel','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','CustomReports','UserProfileResource','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','order','DESC','joins','parse','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions'];(function(_0x4c79ef,_0x551e3a){var _0x54ed44=function(_0x37567f){while(--_0x37567f){_0x4c79ef['push'](_0x4c79ef['shift']());}};_0x54ed44(++_0x551e3a);}(_0x5529,0xc8));var _0x9552=function(_0x57e165,_0x39ab8e){_0x57e165=_0x57e165-0x0;var _0x88459c=_0x5529[_0x57e165];return _0x88459c;};'use strict';var emlformat=require(_0x9552('0x0'));var rimraf=require(_0x9552('0x1'));var zipdir=require(_0x9552('0x2'));var jsonpatch=require(_0x9552('0x3'));var rp=require('request-promise');var moment=require(_0x9552('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9552('0x5'));var path=require(_0x9552('0x6'));var sox=require(_0x9552('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9552('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9552('0x9'));var querystring=require('querystring');var Papa=require(_0x9552('0xa'));var Redis=require(_0x9552('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x9552('0xc'));var as=require(_0x9552('0xd'));var hardwareService=require(_0x9552('0xe'));var logger=require(_0x9552('0xf'))(_0x9552('0x10'));var utils=require(_0x9552('0x11'));var config=require(_0x9552('0x12'));var licenseUtil=require(_0x9552('0x13'));var db=require(_0x9552('0x14'))['db'];var dbH=require(_0x9552('0x14'))[_0x9552('0x15')];function respondWithStatusCode(_0x11597f,_0x510c7f){_0x510c7f=_0x510c7f||0xcc;return function(_0x3a597d){if(_0x3a597d){return _0x11597f[_0x9552('0x16')](_0x510c7f);}return _0x11597f['status'](_0x510c7f)[_0x9552('0x17')]();};}function respondWithResult(_0x24f67f,_0x543f7e){_0x543f7e=_0x543f7e||0xc8;return function(_0x487547){if(_0x487547){return _0x24f67f[_0x9552('0x18')](_0x543f7e)[_0x9552('0x19')](_0x487547);}};}function respondWithFilteredResult(_0x96f44b,_0x29806c){return function(_0x2ed55d){if(_0x2ed55d){var _0x24ff1b=typeof _0x29806c[_0x9552('0x1a')]==='undefined'&&typeof _0x29806c[_0x9552('0x1b')]===_0x9552('0x1c');var _0x3dfdc6=_0x2ed55d[_0x9552('0x1d')];var _0x3e0a00=_0x24ff1b?0x0:_0x29806c['offset'];var _0x110e24=_0x24ff1b?_0x2ed55d[_0x9552('0x1d')]:_0x29806c[_0x9552('0x1a')]+_0x29806c[_0x9552('0x1b')];var _0x3aa93c;if(_0x110e24>=_0x3dfdc6){_0x110e24=_0x3dfdc6;_0x3aa93c=0xc8;}else{_0x3aa93c=0xce;}_0x96f44b['status'](_0x3aa93c);return _0x96f44b[_0x9552('0x1e')](_0x9552('0x1f'),_0x3e0a00+'-'+_0x110e24+'/'+_0x3dfdc6)['json'](_0x2ed55d);}return null;};}function patchUpdates(_0x487a19){return function(_0x2addc9){try{jsonpatch[_0x9552('0x20')](_0x2addc9,_0x487a19,!![]);}catch(_0x2612e7){return BPromise[_0x9552('0x21')](_0x2612e7);}return _0x2addc9[_0x9552('0x22')]();};}function saveUpdates(_0x32921b,_0x1f0f21){return function(_0x213301){if(_0x213301){return _0x213301['update'](_0x32921b)['then'](function(_0x428116){return _0x428116;});}return null;};}function removeEntity(_0x35fa6f,_0x336b04){return function(_0xbdcf90){if(_0xbdcf90){return _0xbdcf90[_0x9552('0x23')]()[_0x9552('0x24')](function(){var _0x16ab09=_0xbdcf90[_0x9552('0x25')]({'plain':!![]});var _0x584146=_0x9552('0x26');return db[_0x9552('0x27')][_0x9552('0x23')]({'where':{'type':_0x584146,'resourceId':_0x16ab09['id']}})[_0x9552('0x24')](function(){return _0xbdcf90;});})['then'](function(){_0x35fa6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6ac0,_0xc29a04){return function(_0x5469fa){if(!_0x5469fa){_0x2a6ac0[_0x9552('0x16')](0x194);}return _0x5469fa;};}function handleError(_0x3a7f35,_0x355195){_0x355195=_0x355195||0x1f4;return function(_0x2047cf){logger['error'](_0x2047cf[_0x9552('0x28')]);if(_0x2047cf[_0x9552('0x29')]){delete _0x2047cf[_0x9552('0x29')];}_0x3a7f35[_0x9552('0x18')](_0x355195)[_0x9552('0x2a')](_0x2047cf);};}exports[_0x9552('0x2b')]=function(_0x52a0c0,_0x442d1d){var _0x26511a={},_0x5b8969={},_0x33810b={'count':0x0,'rows':[]};var _0x291e36=_[_0x9552('0x2c')](db[_0x9552('0x2d')]['rawAttributes'],function(_0x56dfd1){return{'name':_0x56dfd1[_0x9552('0x2e')],'type':_0x56dfd1[_0x9552('0x2f')][_0x9552('0x30')]};});_0x5b8969[_0x9552('0x31')]=_[_0x9552('0x2c')](_0x291e36,_0x9552('0x29'));_0x5b8969[_0x9552('0x32')]=_[_0x9552('0x33')](_0x52a0c0[_0x9552('0x32')]);_0x5b8969[_0x9552('0x34')]=_['intersection'](_0x5b8969[_0x9552('0x31')],_0x5b8969[_0x9552('0x32')]);_0x26511a[_0x9552('0x35')]=_[_0x9552('0x36')](_0x5b8969[_0x9552('0x31')],qs[_0x9552('0x37')](_0x52a0c0[_0x9552('0x32')]['fields']));_0x26511a['attributes']=_0x26511a[_0x9552('0x35')][_0x9552('0x38')]?_0x26511a['attributes']:_0x5b8969[_0x9552('0x31')];if(!_0x52a0c0[_0x9552('0x32')]['hasOwnProperty'](_0x9552('0x39'))){_0x26511a[_0x9552('0x1b')]=qs[_0x9552('0x1b')](_0x52a0c0[_0x9552('0x32')][_0x9552('0x1b')]);_0x26511a[_0x9552('0x1a')]=qs[_0x9552('0x1a')](_0x52a0c0[_0x9552('0x32')][_0x9552('0x1a')]);}_0x26511a['order']=qs[_0x9552('0x3a')](_0x52a0c0[_0x9552('0x32')][_0x9552('0x3a')]);_0x26511a[_0x9552('0x3b')]=qs[_0x9552('0x34')](_[_0x9552('0x3c')](_0x52a0c0[_0x9552('0x32')],_0x5b8969['filters']),_0x291e36);if(_0x52a0c0[_0x9552('0x32')][_0x9552('0x3d')]){_0x26511a[_0x9552('0x3b')]=_[_0x9552('0x3e')](_0x26511a[_0x9552('0x3b')],{'$or':_[_0x9552('0x2c')](_0x291e36,function(_0x20aa80){if(_0x20aa80['type']!=='VIRTUAL'){var _0x47c3d2={};_0x47c3d2[_0x20aa80[_0x9552('0x29')]]={'$like':'%'+_0x52a0c0[_0x9552('0x32')]['filter']+'%'};return _0x47c3d2;}})});}_0x26511a=_[_0x9552('0x3e')]({},_0x26511a,_0x52a0c0[_0x9552('0x3f')]);var _0x6cad36={'where':_0x26511a[_0x9552('0x3b')]};return db['AnalyticCustomReport'][_0x9552('0x1d')](_0x6cad36)[_0x9552('0x24')](function(_0xdb7b3e){_0x33810b[_0x9552('0x1d')]=_0xdb7b3e;if(_0x52a0c0['query'][_0x9552('0x40')]){_0x26511a[_0x9552('0x41')]=[{'all':!![]}];}return db[_0x9552('0x2d')][_0x9552('0x42')](_0x26511a);})[_0x9552('0x24')](function(_0x4c9a33){_0x33810b['rows']=_0x4c9a33;return _0x33810b;})['then'](respondWithFilteredResult(_0x442d1d,_0x26511a))['catch'](handleError(_0x442d1d,null));};exports['show']=function(_0x315b91,_0x1274d8){var _0x382040={'raw':![],'where':{'id':_0x315b91[_0x9552('0x43')]['id']}},_0x4df463={};_0x4df463[_0x9552('0x31')]=_['keys'](db[_0x9552('0x2d')][_0x9552('0x44')]);_0x4df463[_0x9552('0x32')]=_[_0x9552('0x33')](_0x315b91['query']);_0x4df463[_0x9552('0x34')]=_['intersection'](_0x4df463[_0x9552('0x31')],_0x4df463[_0x9552('0x32')]);_0x382040['attributes']=_['intersection'](_0x4df463['model'],qs[_0x9552('0x37')](_0x315b91[_0x9552('0x32')][_0x9552('0x37')]));_0x382040[_0x9552('0x35')]=_0x382040[_0x9552('0x35')][_0x9552('0x38')]?_0x382040[_0x9552('0x35')]:_0x4df463[_0x9552('0x31')];if(_0x315b91[_0x9552('0x32')]['includeAll']){_0x382040[_0x9552('0x41')]=[{'all':!![]}];}_0x382040=_[_0x9552('0x3e')]({},_0x382040,_0x315b91['options']);return db['AnalyticCustomReport'][_0x9552('0x45')](_0x382040)[_0x9552('0x24')](handleEntityNotFound(_0x1274d8,null))['then'](respondWithResult(_0x1274d8,null))[_0x9552('0x46')](handleError(_0x1274d8,null));};exports['create']=function(_0x132258,_0x58f6aa){return db[_0x9552('0x2d')][_0x9552('0x47')](_0x132258['body'],{})[_0x9552('0x24')](function(_0x21b2d1){var _0x1f9620=_0x132258['user'][_0x9552('0x25')]({'plain':!![]});if(!_0x1f9620)throw new Error(_0x9552('0x48'));if(_0x1f9620[_0x9552('0x49')]==='user'){var _0x4d63c0=_0x21b2d1[_0x9552('0x25')]({'plain':!![]});var _0x7750d0=_0x9552('0x4a');return db[_0x9552('0x4b')][_0x9552('0x45')]({'where':{'name':_0x7750d0,'userProfileId':_0x1f9620[_0x9552('0x4c')]},'raw':!![]})[_0x9552('0x24')](function(_0x1a7a23){if(_0x1a7a23&&_0x1a7a23[_0x9552('0x4d')]===0x0){return db['UserProfileResource'][_0x9552('0x47')]({'name':_0x4d63c0[_0x9552('0x29')],'resourceId':_0x4d63c0['id'],'type':'CustomReports','sectionId':_0x1a7a23['id']},{})[_0x9552('0x24')](function(){return _0x21b2d1;});}else{return _0x21b2d1;}})[_0x9552('0x46')](function(_0x4ba4d7){logger[_0x9552('0x4e')](_0x9552('0x4f'),_0x4ba4d7);throw _0x4ba4d7;});}return _0x21b2d1;})[_0x9552('0x24')](respondWithResult(_0x58f6aa,0xc9))[_0x9552('0x46')](handleError(_0x58f6aa,null));};exports['update']=function(_0x5f247c,_0x40e38a){if(_0x5f247c[_0x9552('0x50')]['id']){delete _0x5f247c[_0x9552('0x50')]['id'];}return db[_0x9552('0x2d')][_0x9552('0x45')]({'where':{'id':_0x5f247c['params']['id']}})[_0x9552('0x24')](handleEntityNotFound(_0x40e38a,null))['then'](saveUpdates(_0x5f247c['body'],null))['then'](respondWithResult(_0x40e38a,null))[_0x9552('0x46')](handleError(_0x40e38a,null));};exports[_0x9552('0x23')]=function(_0x4011c5,_0x171870){return db[_0x9552('0x2d')][_0x9552('0x45')]({'where':{'id':_0x4011c5[_0x9552('0x43')]['id']}})[_0x9552('0x24')](handleEntityNotFound(_0x171870,null))[_0x9552('0x24')](removeEntity(_0x171870,null))[_0x9552('0x46')](handleError(_0x171870,null));};exports[_0x9552('0x51')]=function(_0x351bc9,_0x279dfe){var _0x1c145f=0xa;var _0x1389f5=[_0x9552('0x52'),_0x9552('0x53'),_0x9552('0x54'),_0x9552('0x55')];var _0x51ea68={'SUM':'SUM(%s)','COUNT':_0x9552('0x56'),'COUNT DISTINCT':_0x9552('0x57'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x9552('0x58'),'GROUP_CONCAT':_0x9552('0x59'),'GROUP_CONCAT ASC':_0x9552('0x5a'),'GROUP_CONCAT DESC':_0x9552('0x5b')};var _0x272056={'SEC_TO_TIME':_0x9552('0x5c'),'DATE':_0x9552('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9552('0x5e')};var _0x43f8f2=function(_0xb0992a){return!_['includes']([_0x9552('0x5f'),_0x9552('0x60'),_0x9552('0x61'),_0x9552('0x62')],_0xb0992a);};var _0x2e0d56=function(_0x4b18c1){if(!_0x4b18c1||!_0x4b18c1[_0x9552('0x63')][_0x9552('0x38')]){return'';}for(var _0x409b80='(',_0x54bd1a=0x0;_0x54bd1a<_0x4b18c1[_0x9552('0x63')]['length'];_0x54bd1a+=0x1){_0x54bd1a>0x0&&(_0x409b80+='\x20'+_0x4b18c1[_0x9552('0x64')]+'\x20');_0x409b80+=_0x4b18c1[_0x9552('0x63')][_0x54bd1a][_0x9552('0x65')]?_0x2e0d56(_0x4b18c1[_0x9552('0x63')][_0x54bd1a][_0x9552('0x65')]):_0x4b18c1['rules'][_0x54bd1a]['field']+'\x20'+_0x4b18c1[_0x9552('0x63')][_0x54bd1a][_0x9552('0x66')]+(_0x43f8f2(_0x4b18c1[_0x9552('0x63')][_0x54bd1a][_0x9552('0x66')])?'\x20'+_0x4b18c1[_0x9552('0x63')][_0x54bd1a][_0x9552('0x67')]:'');}return _0x409b80+')';};var _0xeeb0a6={'where':{'id':_0x351bc9[_0x9552('0x43')]['id']}},_0x5c98cf,_0x35c277,_0x27f0fe,_0x3b4d0b,_0xe14780;_0xeeb0a6=_[_0x9552('0x3e')]({},_0xeeb0a6,_0x351bc9[_0x9552('0x3f')]);return db[_0x9552('0x2d')][_0x9552('0x45')](_0xeeb0a6)[_0x9552('0x24')](function(_0x28cc27){if(_0x28cc27){_0x5c98cf=_0x28cc27;return _0x28cc27[_0x9552('0x68')]();}return null;})[_0x9552('0x24')](function(_0x9aa049){if(_0x9aa049){if(!_0x9aa049[_0x9552('0x38')]){throw new db[(_0x9552('0x69'))]['ValidationErrorItem'](_0x9552('0x6a'),0x193);}_0x35c277=_0x9aa049;return db['AnalyticMetric'][_0x9552('0x42')]({'raw':!![]});}return null;})[_0x9552('0x24')](function(_0x420285){if(_0x420285){_0x27f0fe=_['keyBy'](_0x420285,'id');var _0xb636ea;var _0x59b201=squel[_0x9552('0x6b')]();_0x59b201[_0x9552('0x6c')](_0x5c98cf[_0x9552('0x6d')]);for(var _0x34412b=0x0;_0x34412b<_0x35c277[_0x9552('0x38')];_0x34412b+=0x1){_0xb636ea=_0x35c277[_0x34412b][_0x9552('0x6e')]?_0x27f0fe[_0x35c277[_0x34412b][_0x9552('0x6e')]][_0x9552('0x6f')]:_0x35c277[_0x34412b][_0x9552('0x70')];_0xb636ea=_0x35c277[_0x34412b][_0x9552('0x71')]?_['replace'](_0x51ea68[_0x35c277[_0x34412b][_0x9552('0x71')]],'%s',_0xb636ea):_0xb636ea;_0xb636ea=_0x35c277[_0x34412b]['format']?_[_0x9552('0x72')](_0x272056[_0x35c277[_0x34412b][_0x9552('0x73')]],'%s',_0xb636ea):_0xb636ea;if(_0x35c277[_0x34412b][_0x9552('0x74')]){_0x59b201['group'](_0xb636ea);}_0x35c277[_0x34412b][_0x9552('0x75')]&&_0x59b201[_0x9552('0x76')](_0xb636ea,_0x35c277[_0x34412b]['orderBy']===_0x9552('0x77')?![]:!![]);_0x59b201['field'](_0xb636ea,_0x35c277[_0x34412b]['alias']||_0xb636ea);}if(_0x5c98cf[_0x9552('0x78')]){_0x5c98cf['joins']=JSON[_0x9552('0x79')](_0x5c98cf[_0x9552('0x78')]);for(var _0x2364b0=0x0;_0x2364b0<_0x5c98cf[_0x9552('0x78')][_0x9552('0x38')];_0x2364b0+=0x1){if(_0x5c98cf['joins'][_0x2364b0][_0x9552('0x2f')]&&_[_0x9552('0x7a')](_0x1389f5,_0x5c98cf[_0x9552('0x78')][_0x2364b0][_0x9552('0x2f')])&&_0x5c98cf['joins'][_0x2364b0][_0x9552('0x7b')]&&_0x5c98cf['joins'][_0x2364b0]['foreignTable']&&_0x5c98cf['joins'][_0x2364b0][_0x9552('0x7c')]){_0x59b201[_0x5c98cf[_0x9552('0x78')][_0x2364b0][_0x9552('0x2f')]](_0x5c98cf[_0x9552('0x78')][_0x2364b0][_0x9552('0x7d')],null,util[_0x9552('0x73')](_0x9552('0x7e'),_0x5c98cf[_0x9552('0x6d')],_0x5c98cf[_0x9552('0x78')][_0x2364b0][_0x9552('0x7b')],_0x5c98cf[_0x9552('0x78')][_0x2364b0][_0x9552('0x7d')],_0x5c98cf[_0x9552('0x78')][_0x2364b0][_0x9552('0x7c')]));}}}if(_0x5c98cf[_0x9552('0x7f')]){_0x5c98cf[_0x9552('0x7f')]=JSON[_0x9552('0x79')](_0x5c98cf['conditions']);_0x59b201[_0x9552('0x3b')](_0x2e0d56(_0x5c98cf[_0x9552('0x7f')]['group']));}_0xe14780=_0x59b201['clone']();_0x59b201['limit'](_0x1c145f);_0x59b201[_0x9552('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x59b201[_0x9552('0x80')]());return dbH[_0x9552('0x81')][_0x9552('0x32')](_0x59b201[_0x9552('0x80')](),{'type':dbH['sequelize'][_0x9552('0x82')][_0x9552('0x83')]});}})[_0x9552('0x24')](respondWithResult(_0x279dfe,null))[_0x9552('0x46')](handleError(_0x279dfe,null));};function runReport(_0x1532b5,_0x3432cb,_0x2cdaba){var _0x39fc35=_0x3432cb[_0x9552('0x29')];var _0x2e5e59=0xa;var _0x595de7=[_0x9552('0x52'),_0x9552('0x53'),_0x9552('0x54'),'cross_join'];var _0x41eadf={'SUM':_0x9552('0x84'),'COUNT':_0x9552('0x56'),'COUNT DISTINCT':_0x9552('0x57'),'MAX':_0x9552('0x85'),'MIN':_0x9552('0x86'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9552('0x59'),'GROUP_CONCAT ASC':_0x9552('0x5a'),'GROUP_CONCAT DESC':_0x9552('0x5b')};var _0x54d973={'SEC_TO_TIME':_0x9552('0x5c'),'DATE':_0x9552('0x5d'),'HOUR':_0x9552('0x87'),'ROUND':_0x9552('0x88'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1371ec=function(_0xbe057c){return!_[_0x9552('0x7a')]([_0x9552('0x5f'),_0x9552('0x60'),'IS\x20EMPTY',_0x9552('0x62')],_0xbe057c);};var _0x525082=function(_0x41ec2d){if(!_0x41ec2d||!_0x41ec2d['rules'][_0x9552('0x38')]){return'';}for(var _0x424b35='(',_0x26d1f5=0x0;_0x26d1f5<_0x41ec2d[_0x9552('0x63')]['length'];_0x26d1f5+=0x1){_0x26d1f5>0x0&&(_0x424b35+='\x20'+_0x41ec2d['operator']+'\x20');_0x424b35+=_0x41ec2d[_0x9552('0x63')][_0x26d1f5][_0x9552('0x65')]?_0x525082(_0x41ec2d[_0x9552('0x63')][_0x26d1f5][_0x9552('0x65')]):_0x41ec2d[_0x9552('0x63')][_0x26d1f5][_0x9552('0x70')]+'\x20'+_0x41ec2d[_0x9552('0x63')][_0x26d1f5]['condition']+(_0x1371ec(_0x41ec2d['rules'][_0x26d1f5][_0x9552('0x66')])?'\x20'+_0x41ec2d[_0x9552('0x63')][_0x26d1f5]['value']:'');}return _0x424b35+')';};var _0x167e9f={'where':{'id':_0x1532b5['id']}},_0x26896b,_0xff7bd,_0x253c03,_0x9eea52,_0x159acb;_0x167e9f=_['merge']({},_0x167e9f,_0x2cdaba);return db[_0x9552('0x2d')][_0x9552('0x45')](_0x167e9f)[_0x9552('0x24')](function(_0x103a4c){if(_0x103a4c){_0x26896b=_0x103a4c;return _0x103a4c[_0x9552('0x68')]();}return null;})['then'](function(_0xdabc95){if(_0xdabc95){if(!_0xdabc95[_0x9552('0x38')]){throw new db[(_0x9552('0x69'))][(_0x9552('0x89'))](_0x9552('0x6a'),0x193);}_0xff7bd=_0xdabc95;return db[_0x9552('0x8a')][_0x9552('0x42')]({'raw':!![]});}return null;})[_0x9552('0x24')](function(_0x26693c){if(_0x26693c){_0x253c03=_[_0x9552('0x8b')](_0x26693c,'id');var _0x358d12;var _0x56c182=squel['select']();_0x56c182['from'](_0x26896b[_0x9552('0x6d')]);for(var _0x34373a=0x0;_0x34373a<_0xff7bd['length'];_0x34373a+=0x1){_0x358d12=_0xff7bd[_0x34373a][_0x9552('0x6e')]?_0x253c03[_0xff7bd[_0x34373a][_0x9552('0x6e')]]['metric']:_0xff7bd[_0x34373a][_0x9552('0x70')];_0x358d12=_0xff7bd[_0x34373a][_0x9552('0x71')]?_[_0x9552('0x72')](_0x41eadf[_0xff7bd[_0x34373a][_0x9552('0x71')]],'%s',_0x358d12):_0x358d12;_0x358d12=_0xff7bd[_0x34373a][_0x9552('0x73')]?_[_0x9552('0x72')](_0x54d973[_0xff7bd[_0x34373a][_0x9552('0x73')]],'%s',_0x358d12):_0x358d12;if(_0xff7bd[_0x34373a][_0x9552('0x74')]){_0x56c182[_0x9552('0x65')](_0x358d12);}_0xff7bd[_0x34373a]['orderBy']&&_0x56c182[_0x9552('0x76')](_0x358d12,_0xff7bd[_0x34373a][_0x9552('0x75')]==='DESC'?![]:!![]);_0x56c182[_0x9552('0x70')](_0x358d12,_0xff7bd[_0x34373a][_0x9552('0x8c')]||_0x358d12);}if(_0x26896b['joins']){_0x26896b[_0x9552('0x78')]=JSON[_0x9552('0x79')](_0x26896b['joins']);for(var _0x5177ef=0x0;_0x5177ef<_0x26896b[_0x9552('0x78')][_0x9552('0x38')];_0x5177ef+=0x1){if(_0x26896b[_0x9552('0x78')][_0x5177ef][_0x9552('0x2f')]&&_['includes'](_0x595de7,_0x26896b[_0x9552('0x78')][_0x5177ef][_0x9552('0x2f')])&&_0x26896b[_0x9552('0x78')][_0x5177ef][_0x9552('0x7b')]&&_0x26896b['joins'][_0x5177ef][_0x9552('0x7d')]&&_0x26896b[_0x9552('0x78')][_0x5177ef][_0x9552('0x7c')]){_0x56c182[_0x26896b[_0x9552('0x78')][_0x5177ef][_0x9552('0x2f')]](_0x26896b['joins'][_0x5177ef][_0x9552('0x7d')],null,util[_0x9552('0x73')](_0x9552('0x7e'),_0x26896b[_0x9552('0x6d')],_0x26896b['joins'][_0x5177ef]['parentKey'],_0x26896b['joins'][_0x5177ef][_0x9552('0x7d')],_0x26896b[_0x9552('0x78')][_0x5177ef][_0x9552('0x7c')]));}}}if(_0x26896b['conditions']){_0x26896b[_0x9552('0x7f')]=JSON[_0x9552('0x79')](_0x26896b['conditions']);_0x56c182['where'](_0x525082(_0x26896b[_0x9552('0x7f')][_0x9552('0x65')]));}_0x159acb=_0x56c182[_0x9552('0x8d')]();_0x56c182[_0x9552('0x1b')](_0x2e5e59);_0x56c182[_0x9552('0x1a')](0x0);return;}})['then'](function(){if(_0x3432cb[_0x9552('0x8e')]===_0x9552('0x8f')){return null;}var _0x2a6880=_['merge'](_0x3432cb,{'name':_0x3432cb['fullPath']||_0x3432cb[_0x9552('0x29')]||_0x26896b['name'],'basename':_0x39fc35,'savename':util[_0x9552('0x73')](_0x9552('0x90'),_0x3432cb[_0x9552('0x29')]||_0x26896b[_0x9552('0x29')],require(_0x9552('0x91'))['generate'](0x4),_0x3432cb[_0x9552('0x8e')]||'csv'),'reportId':_0x26896b['id'],'reportType':_0x9552('0x92')});return db[_0x9552('0x93')]['create'](_0x2a6880,{'raw':!![]});})[_0x9552('0x24')](function(_0x4cebe2){if(_0x26896b[_0x9552('0x6d')]===_0x9552('0x94')){_0x159acb[_0x9552('0x3b')](_0x26896b[_0x9552('0x6d')]+_0x9552('0x95'),_0x3432cb['startDate'],_0x3432cb[_0x9552('0x96')]);}else{_0x159acb[_0x9552('0x3b')](_0x26896b[_0x9552('0x6d')]+_0x9552('0x97'),_0x3432cb[_0x9552('0x98')],_0x3432cb[_0x9552('0x96')]);}if(_0x4cebe2){logger[_0x9552('0x99')](_0x9552('0x9a'),_0x159acb['toString']());require(_0x9552('0x9b'))[_0x9552('0x9c')](path[_0x9552('0x52')](__dirname,_0x9552('0x9d'),_0x4cebe2[_0x9552('0x8e')]),[_0x4cebe2['id'],_0x159acb[_0x9552('0x80')](),path[_0x9552('0x52')](__dirname,'../../files/reports',_0x4cebe2[_0x9552('0x9e')]),_0x39fc35]);return _0x4cebe2;}else{var _0x3d26aa=squel[_0x9552('0x6b')]();_0x3d26aa[_0x9552('0x6c')]('('+_0x159acb[_0x9552('0x80')]()+')',_0x9552('0x9f'));_0x3d26aa[_0x9552('0x70')](_0x9552('0xa0'),_0x9552('0x1d'));_0x159acb[_0x9552('0x1b')](_0x3432cb[_0x9552('0x1b')]||_0x2e5e59);_0x159acb[_0x9552('0x1a')](_0x3432cb['offset']||0x0);return dbH[_0x9552('0x81')][_0x9552('0x32')](_0x3d26aa[_0x9552('0x80')](),{'type':dbH['sequelize'][_0x9552('0x82')][_0x9552('0x83')]})[_0x9552('0x24')](function(_0x27f880){if(!_0x27f880[_0x9552('0x38')]){_0x9eea52=0x0;}else{_0x9eea52=_0x27f880[0x0]['count']||0x0;}return dbH['sequelize'][_0x9552('0x32')](_0x159acb[_0x9552('0x80')](),{'type':dbH[_0x9552('0x81')][_0x9552('0x82')]['SELECT']});})[_0x9552('0x24')](function(_0x3e9972){return{'rows':_0x3e9972||[],'count':_0x9eea52};});}});}exports['run']=function(_0x5720ad,_0xa20cce){return runReport(_0x5720ad[_0x9552('0x43')],_0x5720ad[_0x9552('0x32')],_0x5720ad[_0x9552('0x3f')])[_0x9552('0x24')](respondWithResult(_0xa20cce,null))[_0x9552('0x46')](handleError(_0xa20cce,null));};exports[_0x9552('0xa1')]=runReport;exports[_0x9552('0x32')]=function(_0x5b511b,_0x30b5a1){var _0x9b558=0xa;var _0x24f3ba=['join',_0x9552('0x53'),_0x9552('0x54'),_0x9552('0x55')];var _0x5b6dce={'SUM':_0x9552('0x84'),'COUNT':_0x9552('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9552('0x85'),'MIN':_0x9552('0x86'),'AVG':_0x9552('0x58'),'GROUP_CONCAT':_0x9552('0x59'),'GROUP_CONCAT ASC':_0x9552('0x5a'),'GROUP_CONCAT DESC':_0x9552('0x5b')};var _0x2b9f11={'SEC_TO_TIME':_0x9552('0x5c'),'DATE':_0x9552('0x5d'),'HOUR':_0x9552('0x87'),'ROUND':_0x9552('0x88'),'UNIX_TIMESTAMP':_0x9552('0x5e')};var _0x482a40=function(_0x1b7048){return!_[_0x9552('0x7a')]([_0x9552('0x5f'),_0x9552('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1b7048);};var _0x2c1548=function(_0x232b53){if(!_0x232b53||!_0x232b53[_0x9552('0x63')][_0x9552('0x38')]){return'';}for(var _0x3b8d99='(',_0x5edc4b=0x0;_0x5edc4b<_0x232b53[_0x9552('0x63')][_0x9552('0x38')];_0x5edc4b+=0x1){_0x5edc4b>0x0&&(_0x3b8d99+='\x20'+_0x232b53[_0x9552('0x64')]+'\x20');_0x3b8d99+=_0x232b53[_0x9552('0x63')][_0x5edc4b][_0x9552('0x65')]?_0x2c1548(_0x232b53[_0x9552('0x63')][_0x5edc4b]['group']):_0x232b53[_0x9552('0x63')][_0x5edc4b]['field']+'\x20'+_0x232b53[_0x9552('0x63')][_0x5edc4b][_0x9552('0x66')]+(_0x482a40(_0x232b53[_0x9552('0x63')][_0x5edc4b][_0x9552('0x66')])?'\x20'+_0x232b53['rules'][_0x5edc4b][_0x9552('0x67')]:'');}return _0x3b8d99+')';};var _0x197e40={'where':{'id':_0x5b511b[_0x9552('0x43')]['id']}},_0x184fe4,_0x257b0c,_0x4194b9,_0x53d766,_0xeca105;_0x197e40=_['merge']({},_0x197e40,_0x5b511b[_0x9552('0x3f')]);return db[_0x9552('0x2d')]['find'](_0x197e40)[_0x9552('0x24')](function(_0x2102b1){if(_0x2102b1){_0x184fe4=_0x2102b1;return _0x2102b1[_0x9552('0x68')]();}return null;})[_0x9552('0x24')](function(_0x2e4ab0){if(_0x2e4ab0){if(!_0x2e4ab0[_0x9552('0x38')]){throw new db[(_0x9552('0x69'))][(_0x9552('0x89'))](_0x9552('0x6a'),0x193);}_0x257b0c=_0x2e4ab0;return db[_0x9552('0x8a')][_0x9552('0x42')]({'raw':!![]});}return null;})[_0x9552('0x24')](function(_0x217945){if(_0x217945){_0x4194b9=_[_0x9552('0x8b')](_0x217945,'id');var _0xb3fe38;var _0x127538=squel[_0x9552('0x6b')]();_0x127538[_0x9552('0x6c')](_0x184fe4[_0x9552('0x6d')]);for(var _0x446b5b=0x0;_0x446b5b<_0x257b0c[_0x9552('0x38')];_0x446b5b+=0x1){_0xb3fe38=_0x257b0c[_0x446b5b]['MetricId']?_0x4194b9[_0x257b0c[_0x446b5b]['MetricId']][_0x9552('0x6f')]:_0x257b0c[_0x446b5b][_0x9552('0x70')];_0xb3fe38=_0x257b0c[_0x446b5b][_0x9552('0x71')]?_['replace'](_0x5b6dce[_0x257b0c[_0x446b5b][_0x9552('0x71')]],'%s',_0xb3fe38):_0xb3fe38;_0xb3fe38=_0x257b0c[_0x446b5b][_0x9552('0x73')]?_[_0x9552('0x72')](_0x2b9f11[_0x257b0c[_0x446b5b][_0x9552('0x73')]],'%s',_0xb3fe38):_0xb3fe38;if(_0x257b0c[_0x446b5b]['groupBy']){_0x127538[_0x9552('0x65')](_0xb3fe38);}_0x257b0c[_0x446b5b][_0x9552('0x75')]&&_0x127538['order'](_0xb3fe38,_0x257b0c[_0x446b5b][_0x9552('0x75')]===_0x9552('0x77')?![]:!![]);_0x127538[_0x9552('0x70')](_0xb3fe38,_0x257b0c[_0x446b5b][_0x9552('0x8c')]||_0xb3fe38);}if(_0x184fe4[_0x9552('0x78')]){_0x184fe4[_0x9552('0x78')]=JSON[_0x9552('0x79')](_0x184fe4['joins']);for(var _0x3a76e7=0x0;_0x3a76e7<_0x184fe4[_0x9552('0x78')][_0x9552('0x38')];_0x3a76e7+=0x1){if(_0x184fe4['joins'][_0x3a76e7][_0x9552('0x2f')]&&_[_0x9552('0x7a')](_0x24f3ba,_0x184fe4[_0x9552('0x78')][_0x3a76e7][_0x9552('0x2f')])&&_0x184fe4[_0x9552('0x78')][_0x3a76e7][_0x9552('0x7b')]&&_0x184fe4[_0x9552('0x78')][_0x3a76e7][_0x9552('0x7d')]&&_0x184fe4['joins'][_0x3a76e7][_0x9552('0x7c')]){_0x127538[_0x184fe4[_0x9552('0x78')][_0x3a76e7][_0x9552('0x2f')]](_0x184fe4['joins'][_0x3a76e7][_0x9552('0x7d')],null,util[_0x9552('0x73')]('%s.%s\x20=\x20%s.%s',_0x184fe4[_0x9552('0x6d')],_0x184fe4[_0x9552('0x78')][_0x3a76e7][_0x9552('0x7b')],_0x184fe4[_0x9552('0x78')][_0x3a76e7][_0x9552('0x7d')],_0x184fe4[_0x9552('0x78')][_0x3a76e7][_0x9552('0x7c')]));}}}if(_0x184fe4[_0x9552('0x7f')]){_0x184fe4[_0x9552('0x7f')]=JSON[_0x9552('0x79')](_0x184fe4[_0x9552('0x7f')]);_0x127538[_0x9552('0x3b')](_0x2c1548(_0x184fe4[_0x9552('0x7f')][_0x9552('0x65')]));}_0xeca105=_0x127538[_0x9552('0x8d')]();_0x127538['limit'](_0x9b558);_0x127538[_0x9552('0x1a')](0x0);logger[_0x9552('0xa2')](_0x9552('0xa3'),_0x127538[_0x9552('0x80')]());return dbH['sequelize'][_0x9552('0x32')](_0x127538['toString'](),{'type':dbH[_0x9552('0x81')][_0x9552('0x82')]['SELECT']});}})['then'](function(){return{'sql':_0xeca105[_0x9552('0x80')]()};})[_0x9552('0x24')](respondWithResult(_0x30b5a1,null))[_0x9552('0x46')](handleError(_0x30b5a1,null));}; \ No newline at end of file +var _0x7130=['show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','order','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','right_join','cross_join','UNIX_TIMESTAMP(%s)','includes','orderBy','output','web','fullPath','randomstring','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','get','CustomReports','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','AnalyticCustomReport','includeAll','rows','catch'];(function(_0x2d7b5f,_0x163787){var _0x13c94a=function(_0x4af143){while(--_0x4af143){_0x2d7b5f['push'](_0x2d7b5f['shift']());}};_0x13c94a(++_0x163787);}(_0x7130,0x1a7));var _0x0713=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x7130[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require(_0x0713('0x0'));var rimraf=require(_0x0713('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0713('0x2'));var rp=require(_0x0713('0x3'));var moment=require(_0x0713('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0713('0x5'));var util=require(_0x0713('0x6'));var path=require(_0x0713('0x7'));var sox=require(_0x0713('0x8'));var csv=require(_0x0713('0x9'));var ejs=require(_0x0713('0xa'));var fs=require('fs');var fs_extra=require(_0x0713('0xb'));var _=require('lodash');var squel=require(_0x0713('0xc'));var crypto=require(_0x0713('0xd'));var jsforce=require(_0x0713('0xe'));var deskjs=require(_0x0713('0xf'));var toCsv=require(_0x0713('0x9'));var querystring=require(_0x0713('0x10'));var Papa=require(_0x0713('0x11'));var Redis=require('ioredis');var authService=require(_0x0713('0x12'));var qs=require(_0x0713('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0713('0x14'));var utils=require(_0x0713('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0713('0x16'));var db=require(_0x0713('0x17'))['db'];var dbH=require(_0x0713('0x17'))[_0x0713('0x18')];function respondWithStatusCode(_0x230e97,_0x2ffc09){_0x2ffc09=_0x2ffc09||0xcc;return function(_0xb81bec){if(_0xb81bec){return _0x230e97[_0x0713('0x19')](_0x2ffc09);}return _0x230e97[_0x0713('0x1a')](_0x2ffc09)[_0x0713('0x1b')]();};}function respondWithResult(_0x5a42d1,_0xbfc7ad){_0xbfc7ad=_0xbfc7ad||0xc8;return function(_0xed03ba){if(_0xed03ba){return _0x5a42d1[_0x0713('0x1a')](_0xbfc7ad)[_0x0713('0x1c')](_0xed03ba);}};}function respondWithFilteredResult(_0x5180a2,_0x4812e5){return function(_0xce85f0){if(_0xce85f0){var _0x34e286=typeof _0x4812e5[_0x0713('0x1d')]===_0x0713('0x1e')&&typeof _0x4812e5['limit']===_0x0713('0x1e');var _0x58ac91=_0xce85f0['count'];var _0xd1ea4b=_0x34e286?0x0:_0x4812e5[_0x0713('0x1d')];var _0x95e602=_0x34e286?_0xce85f0[_0x0713('0x1f')]:_0x4812e5[_0x0713('0x1d')]+_0x4812e5['limit'];var _0x25f014;if(_0x95e602>=_0x58ac91){_0x95e602=_0x58ac91;_0x25f014=0xc8;}else{_0x25f014=0xce;}_0x5180a2[_0x0713('0x1a')](_0x25f014);return _0x5180a2[_0x0713('0x20')](_0x0713('0x21'),_0xd1ea4b+'-'+_0x95e602+'/'+_0x58ac91)[_0x0713('0x1c')](_0xce85f0);}return null;};}function patchUpdates(_0x540db5){return function(_0x123926){try{jsonpatch['apply'](_0x123926,_0x540db5,!![]);}catch(_0x321824){return BPromise[_0x0713('0x22')](_0x321824);}return _0x123926[_0x0713('0x23')]();};}function saveUpdates(_0x5037e9,_0x5517ad){return function(_0xbf1cd5){if(_0xbf1cd5){return _0xbf1cd5['update'](_0x5037e9)[_0x0713('0x24')](function(_0x6d8fc8){return _0x6d8fc8;});}return null;};}function removeEntity(_0x111ce9,_0x177831){return function(_0x1fa856){if(_0x1fa856){return _0x1fa856['destroy']()['then'](function(){var _0x49b3f9=_0x1fa856[_0x0713('0x25')]({'plain':!![]});var _0x267fe2=_0x0713('0x26');return db[_0x0713('0x27')]['destroy']({'where':{'type':_0x267fe2,'resourceId':_0x49b3f9['id']}})[_0x0713('0x24')](function(){return _0x1fa856;});})[_0x0713('0x24')](function(){_0x111ce9[_0x0713('0x1a')](0xcc)[_0x0713('0x1b')]();});}};}function handleEntityNotFound(_0x4a83e9,_0x1de9ea){return function(_0x3f6059){if(!_0x3f6059){_0x4a83e9[_0x0713('0x19')](0x194);}return _0x3f6059;};}function handleError(_0x3212c0,_0x517c97){_0x517c97=_0x517c97||0x1f4;return function(_0x4f8201){logger[_0x0713('0x28')](_0x4f8201['stack']);if(_0x4f8201[_0x0713('0x29')]){delete _0x4f8201['name'];}_0x3212c0[_0x0713('0x1a')](_0x517c97)[_0x0713('0x2a')](_0x4f8201);};}exports[_0x0713('0x2b')]=function(_0x101956,_0x21c12a){var _0x3085db={},_0x1e4c0a={},_0x9c26c6={'count':0x0,'rows':[]};var _0x33731a=_['map'](db['AnalyticCustomReport'][_0x0713('0x2c')],function(_0x2d030d){return{'name':_0x2d030d[_0x0713('0x2d')],'type':_0x2d030d[_0x0713('0x2e')][_0x0713('0x2f')]};});_0x1e4c0a[_0x0713('0x30')]=_[_0x0713('0x31')](_0x33731a,'name');_0x1e4c0a['query']=_['keys'](_0x101956['query']);_0x1e4c0a[_0x0713('0x32')]=_[_0x0713('0x33')](_0x1e4c0a[_0x0713('0x30')],_0x1e4c0a[_0x0713('0x34')]);_0x3085db[_0x0713('0x35')]=_[_0x0713('0x33')](_0x1e4c0a[_0x0713('0x30')],qs[_0x0713('0x36')](_0x101956[_0x0713('0x34')][_0x0713('0x36')]));_0x3085db[_0x0713('0x35')]=_0x3085db['attributes'][_0x0713('0x37')]?_0x3085db[_0x0713('0x35')]:_0x1e4c0a['model'];if(!_0x101956[_0x0713('0x34')][_0x0713('0x38')](_0x0713('0x39'))){_0x3085db[_0x0713('0x3a')]=qs[_0x0713('0x3a')](_0x101956[_0x0713('0x34')][_0x0713('0x3a')]);_0x3085db[_0x0713('0x1d')]=qs[_0x0713('0x1d')](_0x101956['query'][_0x0713('0x1d')]);}_0x3085db['order']=qs[_0x0713('0x3b')](_0x101956[_0x0713('0x34')]['sort']);_0x3085db[_0x0713('0x3c')]=qs[_0x0713('0x32')](_[_0x0713('0x3d')](_0x101956[_0x0713('0x34')],_0x1e4c0a[_0x0713('0x32')]),_0x33731a);if(_0x101956[_0x0713('0x34')][_0x0713('0x3e')]){_0x3085db[_0x0713('0x3c')]=_[_0x0713('0x3f')](_0x3085db['where'],{'$or':_[_0x0713('0x31')](_0x33731a,function(_0x532274){if(_0x532274[_0x0713('0x2e')]!==_0x0713('0x40')){var _0x475436={};_0x475436[_0x532274['name']]={'$like':'%'+_0x101956['query'][_0x0713('0x3e')]+'%'};return _0x475436;}})});}_0x3085db=_[_0x0713('0x3f')]({},_0x3085db,_0x101956['options']);var _0x5ca9f2={'where':_0x3085db[_0x0713('0x3c')]};return db[_0x0713('0x41')][_0x0713('0x1f')](_0x5ca9f2)[_0x0713('0x24')](function(_0x46360e){_0x9c26c6[_0x0713('0x1f')]=_0x46360e;if(_0x101956[_0x0713('0x34')][_0x0713('0x42')]){_0x3085db['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x3085db);})[_0x0713('0x24')](function(_0x3f3f5c){_0x9c26c6[_0x0713('0x43')]=_0x3f3f5c;return _0x9c26c6;})[_0x0713('0x24')](respondWithFilteredResult(_0x21c12a,_0x3085db))[_0x0713('0x44')](handleError(_0x21c12a,null));};exports[_0x0713('0x45')]=function(_0x230143,_0x2f8447){var _0x5b4705={'raw':![],'where':{'id':_0x230143['params']['id']}},_0x39f6fb={};_0x39f6fb['model']=_[_0x0713('0x46')](db[_0x0713('0x41')][_0x0713('0x2c')]);_0x39f6fb[_0x0713('0x34')]=_[_0x0713('0x46')](_0x230143[_0x0713('0x34')]);_0x39f6fb[_0x0713('0x32')]=_[_0x0713('0x33')](_0x39f6fb[_0x0713('0x30')],_0x39f6fb['query']);_0x5b4705[_0x0713('0x35')]=_[_0x0713('0x33')](_0x39f6fb[_0x0713('0x30')],qs[_0x0713('0x36')](_0x230143['query'][_0x0713('0x36')]));_0x5b4705['attributes']=_0x5b4705[_0x0713('0x35')][_0x0713('0x37')]?_0x5b4705['attributes']:_0x39f6fb[_0x0713('0x30')];if(_0x230143['query'][_0x0713('0x42')]){_0x5b4705['include']=[{'all':!![]}];}_0x5b4705=_['merge']({},_0x5b4705,_0x230143[_0x0713('0x47')]);return db[_0x0713('0x41')][_0x0713('0x48')](_0x5b4705)[_0x0713('0x24')](handleEntityNotFound(_0x2f8447,null))['then'](respondWithResult(_0x2f8447,null))[_0x0713('0x44')](handleError(_0x2f8447,null));};exports[_0x0713('0x49')]=function(_0x27a5a4,_0x4d6c7c){return db['AnalyticCustomReport']['create'](_0x27a5a4[_0x0713('0x4a')],{})[_0x0713('0x24')](function(_0x3bc0b8){var _0x249bf1=_0x27a5a4[_0x0713('0x4b')][_0x0713('0x25')]({'plain':!![]});if(!_0x249bf1)throw new Error(_0x0713('0x4c'));if(_0x249bf1['role']==='user'){var _0x35a6ca=_0x3bc0b8[_0x0713('0x25')]({'plain':!![]});var _0x35f418=_0x0713('0x4d');return db[_0x0713('0x4e')][_0x0713('0x48')]({'where':{'name':_0x35f418,'userProfileId':_0x249bf1[_0x0713('0x4f')]},'raw':!![]})[_0x0713('0x24')](function(_0x26aa90){if(_0x26aa90&&_0x26aa90[_0x0713('0x50')]===0x0){return db[_0x0713('0x27')][_0x0713('0x49')]({'name':_0x35a6ca[_0x0713('0x29')],'resourceId':_0x35a6ca['id'],'type':'CustomReports','sectionId':_0x26aa90['id']},{})[_0x0713('0x24')](function(){return _0x3bc0b8;});}else{return _0x3bc0b8;}})['catch'](function(_0x57bdbd){logger['error'](_0x0713('0x51'),_0x57bdbd);throw _0x57bdbd;});}return _0x3bc0b8;})[_0x0713('0x24')](respondWithResult(_0x4d6c7c,0xc9))[_0x0713('0x44')](handleError(_0x4d6c7c,null));};exports[_0x0713('0x52')]=function(_0x1f7ee7,_0x31af54){if(_0x1f7ee7['body']['id']){delete _0x1f7ee7[_0x0713('0x4a')]['id'];}return db[_0x0713('0x41')][_0x0713('0x48')]({'where':{'id':_0x1f7ee7[_0x0713('0x53')]['id']}})[_0x0713('0x24')](handleEntityNotFound(_0x31af54,null))[_0x0713('0x24')](saveUpdates(_0x1f7ee7[_0x0713('0x4a')],null))[_0x0713('0x24')](respondWithResult(_0x31af54,null))[_0x0713('0x44')](handleError(_0x31af54,null));};exports[_0x0713('0x54')]=function(_0x183deb,_0x1fe889){return db[_0x0713('0x41')]['find']({'where':{'id':_0x183deb[_0x0713('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fe889,null))[_0x0713('0x24')](removeEntity(_0x1fe889,null))['catch'](handleError(_0x1fe889,null));};exports['preview']=function(_0x32ec20,_0x4f1d7a){var _0x450b06=0xa;var _0x2ffdba=[_0x0713('0x55'),'left_join','right_join','cross_join'];var _0x315017={'SUM':_0x0713('0x56'),'COUNT':_0x0713('0x57'),'COUNT DISTINCT':_0x0713('0x58'),'MAX':_0x0713('0x59'),'MIN':_0x0713('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0713('0x5b'),'GROUP_CONCAT ASC':_0x0713('0x5c'),'GROUP_CONCAT DESC':_0x0713('0x5d')};var _0xae5b9b={'SEC_TO_TIME':_0x0713('0x5e'),'DATE':_0x0713('0x5f'),'HOUR':_0x0713('0x60'),'ROUND':_0x0713('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x52b222=function(_0x529360){return!_['includes']([_0x0713('0x62'),_0x0713('0x63'),_0x0713('0x64'),_0x0713('0x65')],_0x529360);};var _0x5e6180=function(_0x4ccfaa){if(!_0x4ccfaa||!_0x4ccfaa['rules'][_0x0713('0x37')]){return'';}for(var _0x57fbd2='(',_0x5e9ce5=0x0;_0x5e9ce5<_0x4ccfaa[_0x0713('0x66')][_0x0713('0x37')];_0x5e9ce5+=0x1){_0x5e9ce5>0x0&&(_0x57fbd2+='\x20'+_0x4ccfaa[_0x0713('0x67')]+'\x20');_0x57fbd2+=_0x4ccfaa[_0x0713('0x66')][_0x5e9ce5][_0x0713('0x68')]?_0x5e6180(_0x4ccfaa['rules'][_0x5e9ce5][_0x0713('0x68')]):_0x4ccfaa[_0x0713('0x66')][_0x5e9ce5][_0x0713('0x69')]+'\x20'+_0x4ccfaa['rules'][_0x5e9ce5][_0x0713('0x6a')]+(_0x52b222(_0x4ccfaa[_0x0713('0x66')][_0x5e9ce5]['condition'])?'\x20'+_0x4ccfaa[_0x0713('0x66')][_0x5e9ce5][_0x0713('0x6b')]:'');}return _0x57fbd2+')';};var _0x5a522f={'where':{'id':_0x32ec20['params']['id']}},_0xca6ead,_0xc73c90,_0x358eac,_0x4d9523,_0x559a85;_0x5a522f=_[_0x0713('0x3f')]({},_0x5a522f,_0x32ec20[_0x0713('0x47')]);return db[_0x0713('0x41')]['find'](_0x5a522f)[_0x0713('0x24')](function(_0x4c2ead){if(_0x4c2ead){_0xca6ead=_0x4c2ead;return _0x4c2ead[_0x0713('0x6c')]();}return null;})[_0x0713('0x24')](function(_0x3471e1){if(_0x3471e1){if(!_0x3471e1[_0x0713('0x37')]){throw new db[(_0x0713('0x6d'))][(_0x0713('0x6e'))](_0x0713('0x6f'),0x193);}_0xc73c90=_0x3471e1;return db[_0x0713('0x70')][_0x0713('0x71')]({'raw':!![]});}return null;})[_0x0713('0x24')](function(_0x4ae6fe){if(_0x4ae6fe){_0x358eac=_[_0x0713('0x72')](_0x4ae6fe,'id');var _0x10e07b;var _0x2102f9=squel[_0x0713('0x73')]();_0x2102f9[_0x0713('0x74')](_0xca6ead[_0x0713('0x75')]);for(var _0xb5f966=0x0;_0xb5f966<_0xc73c90[_0x0713('0x37')];_0xb5f966+=0x1){_0x10e07b=_0xc73c90[_0xb5f966][_0x0713('0x76')]?_0x358eac[_0xc73c90[_0xb5f966][_0x0713('0x76')]][_0x0713('0x77')]:_0xc73c90[_0xb5f966][_0x0713('0x69')];_0x10e07b=_0xc73c90[_0xb5f966][_0x0713('0x78')]?_[_0x0713('0x79')](_0x315017[_0xc73c90[_0xb5f966]['function']],'%s',_0x10e07b):_0x10e07b;_0x10e07b=_0xc73c90[_0xb5f966]['format']?_[_0x0713('0x79')](_0xae5b9b[_0xc73c90[_0xb5f966][_0x0713('0x7a')]],'%s',_0x10e07b):_0x10e07b;if(_0xc73c90[_0xb5f966][_0x0713('0x7b')]){_0x2102f9[_0x0713('0x68')](_0x10e07b);}_0xc73c90[_0xb5f966]['orderBy']&&_0x2102f9[_0x0713('0x7c')](_0x10e07b,_0xc73c90[_0xb5f966]['orderBy']===_0x0713('0x7d')?![]:!![]);_0x2102f9[_0x0713('0x69')](_0x10e07b,_0xc73c90[_0xb5f966][_0x0713('0x7e')]||_0x10e07b);}if(_0xca6ead['joins']){_0xca6ead[_0x0713('0x7f')]=JSON[_0x0713('0x80')](_0xca6ead[_0x0713('0x7f')]);for(var _0x4bd87f=0x0;_0x4bd87f<_0xca6ead[_0x0713('0x7f')][_0x0713('0x37')];_0x4bd87f+=0x1){if(_0xca6ead[_0x0713('0x7f')][_0x4bd87f][_0x0713('0x2e')]&&_['includes'](_0x2ffdba,_0xca6ead[_0x0713('0x7f')][_0x4bd87f]['type'])&&_0xca6ead[_0x0713('0x7f')][_0x4bd87f][_0x0713('0x81')]&&_0xca6ead[_0x0713('0x7f')][_0x4bd87f]['foreignTable']&&_0xca6ead[_0x0713('0x7f')][_0x4bd87f][_0x0713('0x82')]){_0x2102f9[_0xca6ead['joins'][_0x4bd87f][_0x0713('0x2e')]](_0xca6ead[_0x0713('0x7f')][_0x4bd87f][_0x0713('0x83')],null,util[_0x0713('0x7a')](_0x0713('0x84'),_0xca6ead[_0x0713('0x75')],_0xca6ead[_0x0713('0x7f')][_0x4bd87f][_0x0713('0x81')],_0xca6ead['joins'][_0x4bd87f][_0x0713('0x83')],_0xca6ead['joins'][_0x4bd87f][_0x0713('0x82')]));}}}if(_0xca6ead['conditions']){_0xca6ead['conditions']=JSON[_0x0713('0x80')](_0xca6ead[_0x0713('0x85')]);_0x2102f9[_0x0713('0x3c')](_0x5e6180(_0xca6ead[_0x0713('0x85')][_0x0713('0x68')]));}_0x559a85=_0x2102f9[_0x0713('0x86')]();_0x2102f9[_0x0713('0x3a')](_0x450b06);_0x2102f9['offset'](0x0);logger['debug'](_0x0713('0x87'),_0x2102f9['toString']());return dbH[_0x0713('0x88')][_0x0713('0x34')](_0x2102f9[_0x0713('0x89')](),{'type':dbH[_0x0713('0x88')][_0x0713('0x8a')][_0x0713('0x8b')]});}})[_0x0713('0x24')](respondWithResult(_0x4f1d7a,null))[_0x0713('0x44')](handleError(_0x4f1d7a,null));};function runReport(_0x2efa1e,_0x4488ca,_0xcdee7a){var _0x1807d6=_0x4488ca['name'];var _0xd52590=0xa;var _0x473bdd=[_0x0713('0x55'),_0x0713('0x8c'),_0x0713('0x8d'),_0x0713('0x8e')];var _0x10e188={'SUM':_0x0713('0x56'),'COUNT':_0x0713('0x57'),'COUNT DISTINCT':_0x0713('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0713('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x390959={'SEC_TO_TIME':_0x0713('0x5e'),'DATE':_0x0713('0x5f'),'HOUR':_0x0713('0x60'),'ROUND':_0x0713('0x61'),'UNIX_TIMESTAMP':_0x0713('0x8f')};var _0x18c0cb=function(_0x525927){return!_[_0x0713('0x90')]([_0x0713('0x62'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x0713('0x65')],_0x525927);};var _0xf73a9e=function(_0xb734b3){if(!_0xb734b3||!_0xb734b3[_0x0713('0x66')][_0x0713('0x37')]){return'';}for(var _0x34ad71='(',_0x466325=0x0;_0x466325<_0xb734b3[_0x0713('0x66')][_0x0713('0x37')];_0x466325+=0x1){_0x466325>0x0&&(_0x34ad71+='\x20'+_0xb734b3['operator']+'\x20');_0x34ad71+=_0xb734b3[_0x0713('0x66')][_0x466325][_0x0713('0x68')]?_0xf73a9e(_0xb734b3[_0x0713('0x66')][_0x466325]['group']):_0xb734b3[_0x0713('0x66')][_0x466325][_0x0713('0x69')]+'\x20'+_0xb734b3['rules'][_0x466325]['condition']+(_0x18c0cb(_0xb734b3[_0x0713('0x66')][_0x466325]['condition'])?'\x20'+_0xb734b3[_0x0713('0x66')][_0x466325][_0x0713('0x6b')]:'');}return _0x34ad71+')';};var _0x19623c={'where':{'id':_0x2efa1e['id']}},_0x5ec4b4,_0x22cf94,_0x416b49,_0x1ec96c,_0x10c6c4;_0x19623c=_[_0x0713('0x3f')]({},_0x19623c,_0xcdee7a);return db[_0x0713('0x41')]['find'](_0x19623c)[_0x0713('0x24')](function(_0x1fe694){if(_0x1fe694){_0x5ec4b4=_0x1fe694;return _0x1fe694[_0x0713('0x6c')]();}return null;})[_0x0713('0x24')](function(_0x2766a6){if(_0x2766a6){if(!_0x2766a6['length']){throw new db[(_0x0713('0x6d'))][(_0x0713('0x6e'))](_0x0713('0x6f'),0x193);}_0x22cf94=_0x2766a6;return db[_0x0713('0x70')]['findAll']({'raw':!![]});}return null;})[_0x0713('0x24')](function(_0x3fc4d8){if(_0x3fc4d8){_0x416b49=_[_0x0713('0x72')](_0x3fc4d8,'id');var _0x3e5e5a;var _0x3a893a=squel[_0x0713('0x73')]();_0x3a893a['from'](_0x5ec4b4[_0x0713('0x75')]);for(var _0x26f186=0x0;_0x26f186<_0x22cf94[_0x0713('0x37')];_0x26f186+=0x1){_0x3e5e5a=_0x22cf94[_0x26f186][_0x0713('0x76')]?_0x416b49[_0x22cf94[_0x26f186][_0x0713('0x76')]]['metric']:_0x22cf94[_0x26f186][_0x0713('0x69')];_0x3e5e5a=_0x22cf94[_0x26f186][_0x0713('0x78')]?_['replace'](_0x10e188[_0x22cf94[_0x26f186][_0x0713('0x78')]],'%s',_0x3e5e5a):_0x3e5e5a;_0x3e5e5a=_0x22cf94[_0x26f186][_0x0713('0x7a')]?_[_0x0713('0x79')](_0x390959[_0x22cf94[_0x26f186]['format']],'%s',_0x3e5e5a):_0x3e5e5a;if(_0x22cf94[_0x26f186]['groupBy']){_0x3a893a[_0x0713('0x68')](_0x3e5e5a);}_0x22cf94[_0x26f186][_0x0713('0x91')]&&_0x3a893a[_0x0713('0x7c')](_0x3e5e5a,_0x22cf94[_0x26f186]['orderBy']===_0x0713('0x7d')?![]:!![]);_0x3a893a[_0x0713('0x69')](_0x3e5e5a,_0x22cf94[_0x26f186][_0x0713('0x7e')]||_0x3e5e5a);}if(_0x5ec4b4[_0x0713('0x7f')]){_0x5ec4b4[_0x0713('0x7f')]=JSON[_0x0713('0x80')](_0x5ec4b4[_0x0713('0x7f')]);for(var _0x428cac=0x0;_0x428cac<_0x5ec4b4[_0x0713('0x7f')][_0x0713('0x37')];_0x428cac+=0x1){if(_0x5ec4b4[_0x0713('0x7f')][_0x428cac][_0x0713('0x2e')]&&_['includes'](_0x473bdd,_0x5ec4b4[_0x0713('0x7f')][_0x428cac][_0x0713('0x2e')])&&_0x5ec4b4[_0x0713('0x7f')][_0x428cac][_0x0713('0x81')]&&_0x5ec4b4[_0x0713('0x7f')][_0x428cac]['foreignTable']&&_0x5ec4b4[_0x0713('0x7f')][_0x428cac][_0x0713('0x82')]){_0x3a893a[_0x5ec4b4[_0x0713('0x7f')][_0x428cac]['type']](_0x5ec4b4[_0x0713('0x7f')][_0x428cac][_0x0713('0x83')],null,util[_0x0713('0x7a')](_0x0713('0x84'),_0x5ec4b4[_0x0713('0x75')],_0x5ec4b4['joins'][_0x428cac][_0x0713('0x81')],_0x5ec4b4[_0x0713('0x7f')][_0x428cac]['foreignTable'],_0x5ec4b4[_0x0713('0x7f')][_0x428cac]['foreignKey']));}}}if(_0x5ec4b4[_0x0713('0x85')]){_0x5ec4b4[_0x0713('0x85')]=JSON[_0x0713('0x80')](_0x5ec4b4['conditions']);_0x3a893a['where'](_0xf73a9e(_0x5ec4b4[_0x0713('0x85')]['group']));}_0x10c6c4=_0x3a893a[_0x0713('0x86')]();_0x3a893a[_0x0713('0x3a')](_0xd52590);_0x3a893a[_0x0713('0x1d')](0x0);return;}})[_0x0713('0x24')](function(){if(_0x4488ca[_0x0713('0x92')]===_0x0713('0x93')){return null;}var _0x5963d0=_[_0x0713('0x3f')](_0x4488ca,{'name':_0x4488ca[_0x0713('0x94')]||_0x4488ca[_0x0713('0x29')]||_0x5ec4b4['name'],'basename':_0x1807d6,'savename':util[_0x0713('0x7a')]('%s-%s.%s',_0x4488ca['name']||_0x5ec4b4[_0x0713('0x29')],require(_0x0713('0x95'))['generate'](0x4),_0x4488ca[_0x0713('0x92')]||'csv'),'reportId':_0x5ec4b4['id'],'reportType':'custom'});return db[_0x0713('0x96')][_0x0713('0x49')](_0x5963d0,{'raw':!![]});})[_0x0713('0x24')](function(_0x275437){if(_0x5ec4b4[_0x0713('0x75')]===_0x0713('0x97')){_0x10c6c4[_0x0713('0x3c')](_0x5ec4b4['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4488ca[_0x0713('0x98')],_0x4488ca[_0x0713('0x99')]);}else{_0x10c6c4[_0x0713('0x3c')](_0x5ec4b4[_0x0713('0x75')]+_0x0713('0x9a'),_0x4488ca[_0x0713('0x98')],_0x4488ca[_0x0713('0x99')]);}if(_0x275437){logger[_0x0713('0x9b')](_0x0713('0x9c'),_0x10c6c4[_0x0713('0x89')]());require(_0x0713('0x9d'))[_0x0713('0x9e')](path['join'](__dirname,_0x0713('0x9f'),_0x275437[_0x0713('0x92')]),[_0x275437['id'],_0x10c6c4['toString'](),path[_0x0713('0x55')](__dirname,'../../files/reports',_0x275437['savename']),_0x1807d6]);return _0x275437;}else{var _0x5a2971=squel[_0x0713('0x73')]();_0x5a2971[_0x0713('0x74')]('('+_0x10c6c4[_0x0713('0x89')]()+')',_0x0713('0xa0'));_0x5a2971[_0x0713('0x69')](_0x0713('0xa1'),_0x0713('0x1f'));_0x10c6c4[_0x0713('0x3a')](_0x4488ca[_0x0713('0x3a')]||_0xd52590);_0x10c6c4[_0x0713('0x1d')](_0x4488ca[_0x0713('0x1d')]||0x0);return dbH[_0x0713('0x88')][_0x0713('0x34')](_0x5a2971[_0x0713('0x89')](),{'type':dbH[_0x0713('0x88')][_0x0713('0x8a')][_0x0713('0x8b')]})[_0x0713('0x24')](function(_0x52dd33){if(!_0x52dd33['length']){_0x1ec96c=0x0;}else{_0x1ec96c=_0x52dd33[0x0]['count']||0x0;}return dbH['sequelize'][_0x0713('0x34')](_0x10c6c4[_0x0713('0x89')](),{'type':dbH[_0x0713('0x88')]['QueryTypes'][_0x0713('0x8b')]});})[_0x0713('0x24')](function(_0x3d5c34){return{'rows':_0x3d5c34||[],'count':_0x1ec96c};});}});}exports['run']=function(_0x5cb5ab,_0x425bfd){return runReport(_0x5cb5ab[_0x0713('0x53')],_0x5cb5ab['query'],_0x5cb5ab[_0x0713('0x47')])[_0x0713('0x24')](respondWithResult(_0x425bfd,null))[_0x0713('0x44')](handleError(_0x425bfd,null));};exports[_0x0713('0xa2')]=runReport;exports[_0x0713('0x34')]=function(_0x3f91ae,_0xedf3b4){var _0x337575=0xa;var _0xf21b93=[_0x0713('0x55'),_0x0713('0x8c'),_0x0713('0x8d'),_0x0713('0x8e')];var _0x37c874={'SUM':_0x0713('0x56'),'COUNT':_0x0713('0x57'),'COUNT DISTINCT':_0x0713('0x58'),'MAX':_0x0713('0x59'),'MIN':_0x0713('0x5a'),'AVG':_0x0713('0xa3'),'GROUP_CONCAT':_0x0713('0x5b'),'GROUP_CONCAT ASC':_0x0713('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2860b1={'SEC_TO_TIME':_0x0713('0x5e'),'DATE':_0x0713('0x5f'),'HOUR':_0x0713('0x60'),'ROUND':_0x0713('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4becb9=function(_0x1cbb21){return!_[_0x0713('0x90')]([_0x0713('0x62'),_0x0713('0x63'),_0x0713('0x64'),_0x0713('0x65')],_0x1cbb21);};var _0x24c650=function(_0x381c31){if(!_0x381c31||!_0x381c31['rules'][_0x0713('0x37')]){return'';}for(var _0x218065='(',_0x23dc50=0x0;_0x23dc50<_0x381c31['rules'][_0x0713('0x37')];_0x23dc50+=0x1){_0x23dc50>0x0&&(_0x218065+='\x20'+_0x381c31['operator']+'\x20');_0x218065+=_0x381c31[_0x0713('0x66')][_0x23dc50]['group']?_0x24c650(_0x381c31[_0x0713('0x66')][_0x23dc50]['group']):_0x381c31[_0x0713('0x66')][_0x23dc50]['field']+'\x20'+_0x381c31['rules'][_0x23dc50][_0x0713('0x6a')]+(_0x4becb9(_0x381c31['rules'][_0x23dc50][_0x0713('0x6a')])?'\x20'+_0x381c31[_0x0713('0x66')][_0x23dc50]['value']:'');}return _0x218065+')';};var _0x34e348={'where':{'id':_0x3f91ae[_0x0713('0x53')]['id']}},_0x29ebbe,_0x4491b9,_0x401b17,_0x1a5212,_0x23e270;_0x34e348=_[_0x0713('0x3f')]({},_0x34e348,_0x3f91ae[_0x0713('0x47')]);return db[_0x0713('0x41')][_0x0713('0x48')](_0x34e348)[_0x0713('0x24')](function(_0x2d286c){if(_0x2d286c){_0x29ebbe=_0x2d286c;return _0x2d286c[_0x0713('0x6c')]();}return null;})['then'](function(_0x4cb547){if(_0x4cb547){if(!_0x4cb547[_0x0713('0x37')]){throw new db[(_0x0713('0x6d'))][(_0x0713('0x6e'))](_0x0713('0x6f'),0x193);}_0x4491b9=_0x4cb547;return db[_0x0713('0x70')][_0x0713('0x71')]({'raw':!![]});}return null;})[_0x0713('0x24')](function(_0x245db3){if(_0x245db3){_0x401b17=_[_0x0713('0x72')](_0x245db3,'id');var _0x514d1c;var _0xf09650=squel[_0x0713('0x73')]();_0xf09650['from'](_0x29ebbe[_0x0713('0x75')]);for(var _0x244187=0x0;_0x244187<_0x4491b9['length'];_0x244187+=0x1){_0x514d1c=_0x4491b9[_0x244187][_0x0713('0x76')]?_0x401b17[_0x4491b9[_0x244187][_0x0713('0x76')]]['metric']:_0x4491b9[_0x244187][_0x0713('0x69')];_0x514d1c=_0x4491b9[_0x244187][_0x0713('0x78')]?_[_0x0713('0x79')](_0x37c874[_0x4491b9[_0x244187][_0x0713('0x78')]],'%s',_0x514d1c):_0x514d1c;_0x514d1c=_0x4491b9[_0x244187][_0x0713('0x7a')]?_[_0x0713('0x79')](_0x2860b1[_0x4491b9[_0x244187][_0x0713('0x7a')]],'%s',_0x514d1c):_0x514d1c;if(_0x4491b9[_0x244187][_0x0713('0x7b')]){_0xf09650[_0x0713('0x68')](_0x514d1c);}_0x4491b9[_0x244187][_0x0713('0x91')]&&_0xf09650[_0x0713('0x7c')](_0x514d1c,_0x4491b9[_0x244187]['orderBy']===_0x0713('0x7d')?![]:!![]);_0xf09650[_0x0713('0x69')](_0x514d1c,_0x4491b9[_0x244187][_0x0713('0x7e')]||_0x514d1c);}if(_0x29ebbe[_0x0713('0x7f')]){_0x29ebbe[_0x0713('0x7f')]=JSON[_0x0713('0x80')](_0x29ebbe[_0x0713('0x7f')]);for(var _0x388285=0x0;_0x388285<_0x29ebbe[_0x0713('0x7f')]['length'];_0x388285+=0x1){if(_0x29ebbe[_0x0713('0x7f')][_0x388285]['type']&&_[_0x0713('0x90')](_0xf21b93,_0x29ebbe[_0x0713('0x7f')][_0x388285][_0x0713('0x2e')])&&_0x29ebbe['joins'][_0x388285][_0x0713('0x81')]&&_0x29ebbe[_0x0713('0x7f')][_0x388285][_0x0713('0x83')]&&_0x29ebbe['joins'][_0x388285]['foreignKey']){_0xf09650[_0x29ebbe[_0x0713('0x7f')][_0x388285][_0x0713('0x2e')]](_0x29ebbe[_0x0713('0x7f')][_0x388285][_0x0713('0x83')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x29ebbe[_0x0713('0x75')],_0x29ebbe[_0x0713('0x7f')][_0x388285]['parentKey'],_0x29ebbe[_0x0713('0x7f')][_0x388285][_0x0713('0x83')],_0x29ebbe[_0x0713('0x7f')][_0x388285][_0x0713('0x82')]));}}}if(_0x29ebbe[_0x0713('0x85')]){_0x29ebbe[_0x0713('0x85')]=JSON[_0x0713('0x80')](_0x29ebbe[_0x0713('0x85')]);_0xf09650[_0x0713('0x3c')](_0x24c650(_0x29ebbe[_0x0713('0x85')][_0x0713('0x68')]));}_0x23e270=_0xf09650['clone']();_0xf09650[_0x0713('0x3a')](_0x337575);_0xf09650[_0x0713('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0xf09650['toString']());return dbH[_0x0713('0x88')]['query'](_0xf09650[_0x0713('0x89')](),{'type':dbH[_0x0713('0x88')]['QueryTypes'][_0x0713('0x8b')]});}})['then'](function(){return{'sql':_0x23e270[_0x0713('0x89')]()};})[_0x0713('0x24')](respondWithResult(_0xedf3b4,null))['catch'](handleError(_0xedf3b4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9eb59b3..35437e7 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 _0xc0f8=['api','moment','bluebird','request-promise','path','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xc0f8,0x142));var _0x8c0f=function(_0x44bdf1,_0x5891d3){_0x44bdf1=_0x44bdf1-0x0;var _0x5e30a5=_0xc0f8[_0x44bdf1];return _0x5e30a5;};'use strict';var _=require('lodash');var util=require(_0x8c0f('0x0'));var logger=require(_0x8c0f('0x1'))(_0x8c0f('0x2'));var moment=require(_0x8c0f('0x3'));var BPromise=require(_0x8c0f('0x4'));var rp=require(_0x8c0f('0x5'));var fs=require('fs');var path=require(_0x8c0f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8c0f('0x7'));module[_0x8c0f('0x8')]=function(_0x1d9ad3,_0x43f004){return _0x1d9ad3[_0x8c0f('0x9')](_0x8c0f('0xa'),attributes,{'tableName':_0x8c0f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e02=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','util'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x4e02,0x143));var _0x24e0=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x4e02[_0x1fc84d];return _0x2658fa;};'use strict';var _=require('lodash');var util=require(_0x24e0('0x0'));var logger=require('../../config/logger')(_0x24e0('0x1'));var moment=require(_0x24e0('0x2'));var BPromise=require('bluebird');var rp=require(_0x24e0('0x3'));var fs=require('fs');var path=require(_0x24e0('0x4'));var rimraf=require(_0x24e0('0x5'));var config=require(_0x24e0('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0x24e0('0x7')]=function(_0x1737ba,_0xeea850){return _0x1737ba[_0x24e0('0x8')]('AnalyticCustomReport',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 f282441..0655593 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 _0x7880=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','../../mysqldb'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x7880,0x14d));var _0x0788=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x7880[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x0788('0x0'));var util=require(_0x0788('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0788('0x2'))['db'];var utils=require(_0x0788('0x3'));var logger=require(_0x0788('0x4'))('rpc');var config=require(_0x0788('0x5'));var jayson=require(_0x0788('0x6'));var client=jayson['client'][_0x0788('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f653,_0x41d609,_0x284453){return new BPromise(function(_0x41369a,_0x1d899a){return client[_0x0788('0x8')](_0x21f653,_0x284453)[_0x0788('0x9')](function(_0x1793fa){logger[_0x0788('0xa')](_0x0788('0xb'),_0x41d609,_0x0788('0xc'));logger[_0x0788('0xd')](_0x0788('0xe'),_0x41d609,_0x0788('0xc'),JSON[_0x0788('0xf')](_0x1793fa));if(_0x1793fa[_0x0788('0x10')]){if(_0x1793fa[_0x0788('0x10')][_0x0788('0x11')]===0x1f4){logger[_0x0788('0x10')](_0x0788('0xb'),_0x41d609,_0x1793fa['error'][_0x0788('0x12')]);return _0x1d899a(_0x1793fa[_0x0788('0x10')][_0x0788('0x12')]);}logger[_0x0788('0x10')](_0x0788('0xb'),_0x41d609,_0x1793fa[_0x0788('0x10')][_0x0788('0x12')]);return _0x41369a(_0x1793fa['error'][_0x0788('0x12')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x41d609,'request\x20sent');_0x41369a(_0x1793fa[_0x0788('0x13')][_0x0788('0x12')]);}})[_0x0788('0x14')](function(_0x1f9f67){logger[_0x0788('0x10')](_0x0788('0xb'),_0x41d609,_0x1f9f67);_0x1d899a(_0x1f9f67);});});} \ No newline at end of file +var _0x5839=['../../config/environment','jayson/promise','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x372047,_0x7f5c2b){var _0x44f282=function(_0x5a3d1c){while(--_0x5a3d1c){_0x372047['push'](_0x372047['shift']());}};_0x44f282(++_0x7f5c2b);}(_0x5839,0x195));var _0x9583=function(_0xc563f7,_0x32b082){_0xc563f7=_0xc563f7-0x0;var _0x35b44b=_0x5839[_0xc563f7];return _0x35b44b;};'use strict';var _=require(_0x9583('0x0'));var util=require(_0x9583('0x1'));var moment=require('moment');var BPromise=require(_0x9583('0x2'));var rs=require(_0x9583('0x3'));var fs=require('fs');var Redis=require(_0x9583('0x4'));var db=require(_0x9583('0x5'))['db'];var utils=require(_0x9583('0x6'));var logger=require(_0x9583('0x7'))(_0x9583('0x8'));var config=require(_0x9583('0x9'));var jayson=require(_0x9583('0xa'));var client=jayson['client'][_0x9583('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x94f752,_0x3aacb0,_0x3a6f05){return new BPromise(function(_0x1cd1e4,_0x8b76f){return client['request'](_0x94f752,_0x3a6f05)[_0x9583('0xc')](function(_0x59e061){logger[_0x9583('0xd')](_0x9583('0xe'),_0x3aacb0,_0x9583('0xf'));logger[_0x9583('0x10')](_0x9583('0x11'),_0x3aacb0,'request\x20sent',JSON['stringify'](_0x59e061));if(_0x59e061[_0x9583('0x12')]){if(_0x59e061['error'][_0x9583('0x13')]===0x1f4){logger[_0x9583('0x12')](_0x9583('0xe'),_0x3aacb0,_0x59e061['error'][_0x9583('0x14')]);return _0x8b76f(_0x59e061[_0x9583('0x12')][_0x9583('0x14')]);}logger['error'](_0x9583('0xe'),_0x3aacb0,_0x59e061[_0x9583('0x12')][_0x9583('0x14')]);return _0x1cd1e4(_0x59e061[_0x9583('0x12')][_0x9583('0x14')]);}else{logger[_0x9583('0xd')](_0x9583('0xe'),_0x3aacb0,_0x9583('0xf'));_0x1cd1e4(_0x59e061[_0x9583('0x15')][_0x9583('0x14')]);}})[_0x9583('0x16')](function(_0x4d2c7b){logger[_0x9583('0x12')](_0x9583('0xe'),_0x3aacb0,_0x4d2c7b);_0x8b76f(_0x4d2c7b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index de21d6e..7c4cf28 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 _0x546a=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','run','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x546a,0xd0));var _0xa546=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x546a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa546('0x0'));var util=require(_0xa546('0x1'));var path=require(_0xa546('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa546('0x3')]();var fs_extra=require(_0xa546('0x4'));var auth=require(_0xa546('0x5'));var interaction=require(_0xa546('0x6'));var config=require('../../config/environment');var controller=require(_0xa546('0x7'));router[_0xa546('0x8')]('/',auth[_0xa546('0x9')](),controller[_0xa546('0xa')]);router[_0xa546('0x8')]('/:id',auth[_0xa546('0x9')](),controller['show']);router[_0xa546('0x8')](_0xa546('0xb'),auth[_0xa546('0x9')](),controller[_0xa546('0xc')]);router[_0xa546('0x8')]('/:id/run',auth[_0xa546('0x9')](),controller[_0xa546('0xd')]);router[_0xa546('0x8')]('/:id/query',auth[_0xa546('0x9')](),controller['query']);router[_0xa546('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa546('0xf')](_0xa546('0x10'),auth[_0xa546('0x9')](),controller[_0xa546('0x11')]);router[_0xa546('0x12')](_0xa546('0x10'),auth[_0xa546('0x9')](),controller[_0xa546('0x13')]);module[_0xa546('0x14')]=router; \ No newline at end of file +var _0x6f65=['get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/query','query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f65,0x17f));var _0x56f6=function(_0x448020,_0x1dbead){_0x448020=_0x448020-0x0;var _0x1b32b6=_0x6f65[_0x448020];return _0x1b32b6;};'use strict';var multer=require('multer');var util=require(_0x56f6('0x0'));var path=require(_0x56f6('0x1'));var timeout=require(_0x56f6('0x2'));var express=require(_0x56f6('0x3'));var router=express[_0x56f6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x56f6('0x5'));var config=require(_0x56f6('0x6'));var controller=require(_0x56f6('0x7'));router[_0x56f6('0x8')]('/',auth[_0x56f6('0x9')](),controller[_0x56f6('0xa')]);router[_0x56f6('0x8')](_0x56f6('0xb'),auth[_0x56f6('0x9')](),controller['show']);router[_0x56f6('0x8')](_0x56f6('0xc'),auth['isAuthenticated'](),controller[_0x56f6('0xd')]);router[_0x56f6('0x8')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x56f6('0x8')](_0x56f6('0xe'),auth[_0x56f6('0x9')](),controller[_0x56f6('0xf')]);router[_0x56f6('0x10')]('/',auth['isAuthenticated'](),controller[_0x56f6('0x11')]);router[_0x56f6('0x12')](_0x56f6('0xb'),auth[_0x56f6('0x9')](),controller[_0x56f6('0x13')]);router[_0x56f6('0x14')](_0x56f6('0xb'),auth[_0x56f6('0x9')](),controller[_0x56f6('0x15')]);module[_0x56f6('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 08aeb10..074b166 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 _0x6f47=['TEXT','exports','STRING'];(function(_0xa03b81,_0x254d6d){var _0x4aa983=function(_0x5e7cb5){while(--_0x5e7cb5){_0xa03b81['push'](_0xa03b81['shift']());}};_0x4aa983(++_0x254d6d);}(_0x6f47,0xc7));var _0x76f4=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x6f47[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x3e6647,_0x2c0d09){var _0x46bddd=function(_0xad96c0){while(--_0xad96c0){_0x3e6647['push'](_0x3e6647['shift']());}};_0x46bddd(++_0x2c0d09);}(_0x6aa7,0x178));var _0x76aa=function(_0x46d93f,_0x5c3c2f){_0x46d93f=_0x46d93f-0x0;var _0x253751=_0x6aa7[_0x46d93f];return _0x253751;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0c5462f..639f1a0 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 _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x54fd7c,_0x28dbac){var _0x4d0cd6=function(_0x44fb7e){while(--_0x44fb7e){_0x54fd7c['push'](_0x54fd7c['shift']());}};_0x4d0cd6(++_0x28dbac);}(_0xda19,0xd5));var _0x9da1=function(_0xc660de,_0x4488ee){_0xc660de=_0xc660de-0x0;var _0x405b05=_0xda19[_0xc660de];return _0x405b05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file +var _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x1c270e,_0x54b49e){var _0x3e0e2f=function(_0x20dd4a){while(--_0x20dd4a){_0x1c270e['push'](_0x1c270e['shift']());}};_0x3e0e2f(++_0x54b49e);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3cef4d,_0x3f3516){_0x3cef4d=_0x3cef4d-0x0;var _0x8c5437=_0x3f8a[_0x3cef4d];return _0x8c5437;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 525c03a..2298d85 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 _0xdf63=['api','moment','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xdf63,0x1d6));var _0x3df6=function(_0x5707d2,_0x280c70){_0x5707d2=_0x5707d2-0x0;var _0x4e358d=_0xdf63[_0x5707d2];return _0x4e358d;};'use strict';var _=require(_0x3df6('0x0'));var util=require(_0x3df6('0x1'));var logger=require(_0x3df6('0x2'))(_0x3df6('0x3'));var moment=require(_0x3df6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3df6('0x5'));var rimraf=require('rimraf');var config=require(_0x3df6('0x6'));var attributes=require(_0x3df6('0x7'));module['exports']=function(_0x55af39,_0x58a89a){return _0x55af39[_0x3df6('0x8')](_0x3df6('0x9'),attributes,{'tableName':_0x3df6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4d3=['./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x16dc9c,_0x4ce4b7){var _0x30afa3=function(_0x343534){while(--_0x343534){_0x16dc9c['push'](_0x16dc9c['shift']());}};_0x30afa3(++_0x4ce4b7);}(_0xd4d3,0x12d));var _0x3d4d=function(_0x3b7596,_0x2e1cd9){_0x3b7596=_0x3b7596-0x0;var _0x3146ea=_0xd4d3[_0x3b7596];return _0x3146ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d4d('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3d4d('0x1'));var rp=require(_0x3d4d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d4d('0x3'));var config=require(_0x3d4d('0x4'));var attributes=require(_0x3d4d('0x5'));module['exports']=function(_0x461093,_0x1d0152){return _0x461093[_0x3d4d('0x6')](_0x3d4d('0x7'),attributes,{'tableName':_0x3d4d('0x8'),'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 a228205..f58bd4b 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 _0x4e85=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x3e9b99,_0x5de362){var _0x8d8c6e=function(_0x330c82){while(--_0x330c82){_0x3e9b99['push'](_0x3e9b99['shift']());}};_0x8d8c6e(++_0x5de362);}(_0x4e85,0xf2));var _0x54e8=function(_0x3b3996,_0x430361){_0x3b3996=_0x3b3996-0x0;var _0x425a24=_0x4e85[_0x3b3996];return _0x425a24;};'use strict';var _=require('lodash');var util=require(_0x54e8('0x0'));var moment=require(_0x54e8('0x1'));var BPromise=require('bluebird');var rs=require(_0x54e8('0x2'));var fs=require('fs');var Redis=require(_0x54e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x54e8('0x4'));var logger=require('../../config/logger')(_0x54e8('0x5'));var config=require(_0x54e8('0x6'));var jayson=require(_0x54e8('0x7'));var client=jayson[_0x54e8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x508d5c,_0x35a969,_0x496548){return new BPromise(function(_0xcf4dc6,_0x6727c4){return client['request'](_0x508d5c,_0x496548)[_0x54e8('0x9')](function(_0x1d63a1){logger[_0x54e8('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x35a969,_0x54e8('0xb'));logger[_0x54e8('0xc')](_0x54e8('0xd'),_0x35a969,_0x54e8('0xb'),JSON['stringify'](_0x1d63a1));if(_0x1d63a1[_0x54e8('0xe')]){if(_0x1d63a1['error'][_0x54e8('0xf')]===0x1f4){logger['error'](_0x54e8('0x10'),_0x35a969,_0x1d63a1[_0x54e8('0xe')][_0x54e8('0x11')]);return _0x6727c4(_0x1d63a1[_0x54e8('0xe')]['message']);}logger[_0x54e8('0xe')](_0x54e8('0x10'),_0x35a969,_0x1d63a1['error'][_0x54e8('0x11')]);return _0xcf4dc6(_0x1d63a1[_0x54e8('0xe')]['message']);}else{logger['info'](_0x54e8('0x10'),_0x35a969,_0x54e8('0xb'));_0xcf4dc6(_0x1d63a1[_0x54e8('0x12')]['message']);}})['catch'](function(_0xad3ec3){logger[_0x54e8('0xe')](_0x54e8('0x10'),_0x35a969,_0xad3ec3);_0x6727c4(_0xad3ec3);});});} \ No newline at end of file +var _0xd9f1=['rpc','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e6f59,_0x181996){var _0x271957=function(_0x3c991a){while(--_0x3c991a){_0x4e6f59['push'](_0x4e6f59['shift']());}};_0x271957(++_0x181996);}(_0xd9f1,0xc7));var _0x1d9f=function(_0x4c52e6,_0x461b06){_0x4c52e6=_0x4c52e6-0x0;var _0x5ab16b=_0xd9f1[_0x4c52e6];return _0x5ab16b;};'use strict';var _=require(_0x1d9f('0x0'));var util=require(_0x1d9f('0x1'));var moment=require('moment');var BPromise=require(_0x1d9f('0x2'));var rs=require(_0x1d9f('0x3'));var fs=require('fs');var Redis=require(_0x1d9f('0x4'));var db=require(_0x1d9f('0x5'))['db'];var utils=require(_0x1d9f('0x6'));var logger=require(_0x1d9f('0x7'))(_0x1d9f('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d9f('0x9'));var client=jayson[_0x1d9f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387b08,_0x1deb63,_0x47e897){return new BPromise(function(_0x47c1eb,_0x5dea54){return client[_0x1d9f('0xb')](_0x387b08,_0x47e897)[_0x1d9f('0xc')](function(_0x3399c1){logger[_0x1d9f('0xd')](_0x1d9f('0xe'),_0x1deb63,_0x1d9f('0xf'));logger[_0x1d9f('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1deb63,'request\x20sent',JSON[_0x1d9f('0x11')](_0x3399c1));if(_0x3399c1['error']){if(_0x3399c1[_0x1d9f('0x12')][_0x1d9f('0x13')]===0x1f4){logger[_0x1d9f('0x12')](_0x1d9f('0xe'),_0x1deb63,_0x3399c1[_0x1d9f('0x12')][_0x1d9f('0x14')]);return _0x5dea54(_0x3399c1['error'][_0x1d9f('0x14')]);}logger[_0x1d9f('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1deb63,_0x3399c1[_0x1d9f('0x12')][_0x1d9f('0x14')]);return _0x47c1eb(_0x3399c1[_0x1d9f('0x12')][_0x1d9f('0x14')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1deb63,_0x1d9f('0xf'));_0x47c1eb(_0x3399c1[_0x1d9f('0x15')][_0x1d9f('0x14')]);}})[_0x1d9f('0x16')](function(_0x38afd5){logger[_0x1d9f('0x12')](_0x1d9f('0xe'),_0x1deb63,_0x38afd5);_0x5dea54(_0x38afd5);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9ceeaf3..01a5f2a 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 _0xc009=['connect-timeout','Router','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','run','/:id/query','query','post','create','update','destroy','exports','multer','util'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc009,0x8a));var _0x9c00=function(_0x2b4809,_0x27bdf3){_0x2b4809=_0x2b4809-0x0;var _0x531d96=_0xc009[_0x2b4809];return _0x531d96;};'use strict';var multer=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var path=require('path');var timeout=require(_0x9c00('0x2'));var express=require('express');var router=express[_0x9c00('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9c00('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c00('0x5'));router[_0x9c00('0x6')]('/',auth[_0x9c00('0x7')](),controller[_0x9c00('0x8')]);router[_0x9c00('0x6')]('/:id',auth[_0x9c00('0x7')](),controller[_0x9c00('0x9')]);router['get'](_0x9c00('0xa'),auth['isAuthenticated'](),controller[_0x9c00('0xb')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x9c00('0xc')]);router[_0x9c00('0x6')](_0x9c00('0xd'),auth['isAuthenticated'](),controller[_0x9c00('0xe')]);router[_0x9c00('0xf')]('/',auth['isAuthenticated'](),controller[_0x9c00('0x10')]);router['put']('/:id',auth[_0x9c00('0x7')](),controller[_0x9c00('0x11')]);router['delete']('/:id',auth[_0x9c00('0x7')](),controller[_0x9c00('0x12')]);module[_0x9c00('0x13')]=router; \ No newline at end of file +var _0xe34d=['destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','preview','/:id/run','run','/:id/query','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe34d,0xd0));var _0xde34=function(_0x4deece,_0x20b244){_0x4deece=_0x4deece-0x0;var _0x4a6fae=_0xe34d[_0x4deece];return _0x4a6fae;};'use strict';var multer=require(_0xde34('0x0'));var util=require(_0xde34('0x1'));var path=require('path');var timeout=require(_0xde34('0x2'));var express=require('express');var router=express[_0xde34('0x3')]();var fs_extra=require(_0xde34('0x4'));var auth=require(_0xde34('0x5'));var interaction=require(_0xde34('0x6'));var config=require(_0xde34('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xde34('0x8')]);router[_0xde34('0x9')](_0xde34('0xa'),auth[_0xde34('0xb')](),controller[_0xde34('0xc')]);router[_0xde34('0x9')]('/:id/preview',auth[_0xde34('0xb')](),controller[_0xde34('0xd')]);router['get'](_0xde34('0xe'),auth[_0xde34('0xb')](),controller[_0xde34('0xf')]);router[_0xde34('0x9')](_0xde34('0x10'),auth[_0xde34('0xb')](),controller['query']);router[_0xde34('0x11')]('/',auth[_0xde34('0xb')](),controller[_0xde34('0x12')]);router[_0xde34('0x13')](_0xde34('0xa'),auth[_0xde34('0xb')](),controller[_0xde34('0x14')]);router[_0xde34('0x15')](_0xde34('0xa'),auth[_0xde34('0xb')](),controller[_0xde34('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 84c1953..a5296a5 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 _0xcb6b=['pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x28ca80,_0x2fcad7){var _0x50b7b8=function(_0x47ffd5){while(--_0x47ffd5){_0x28ca80['push'](_0x28ca80['shift']());}};_0x50b7b8(++_0x2fcad7);}(_0xcb6b,0x180));var _0xbcb6=function(_0x3e1ac2,_0x3e3517){_0x3e1ac2=_0x3e1ac2-0x0;var _0x56c6fa=_0xcb6b[_0x3e1ac2];return _0x56c6fa;};'use strict';var Sequelize=require(_0xbcb6('0x0'));var moment=require(_0xbcb6('0x1'));module[_0xbcb6('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xbcb6('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xbcb6('0x4')](_0xbcb6('0x5'),_0xbcb6('0x6'),_0xbcb6('0x7')),'allowNull':![],'defaultValue':_0xbcb6('0x5')},'savename':{'type':Sequelize[_0xbcb6('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xbcb6('0x8')]},'endDate':{'type':Sequelize[_0xbcb6('0x8')]},'status':{'type':Sequelize[_0xbcb6('0x3')],'defaultValue':_0xbcb6('0x9')},'type':{'type':Sequelize[_0xbcb6('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xbcb6('0xa')},'reportId':{'type':Sequelize[_0xbcb6('0xb')](0xb)[_0xbcb6('0xc')]},'reportType':{'type':Sequelize[_0xbcb6('0x3')]}}; \ No newline at end of file +var _0xcb5f=['manual','scheduled','INTEGER','sequelize','moment','STRING','pdf','xlsx','csv','DATE','Loading','ENUM'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0xcb5f,0x18f));var _0xfcb5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcb5f[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xfcb5('0x0'));var moment=require(_0xfcb5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xfcb5('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xfcb5('0x3'),_0xfcb5('0x4')),'allowNull':![],'defaultValue':_0xfcb5('0x5')},'savename':{'type':Sequelize[_0xfcb5('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xfcb5('0x6')]},'endDate':{'type':Sequelize[_0xfcb5('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xfcb5('0x7')},'type':{'type':Sequelize[_0xfcb5('0x8')](_0xfcb5('0x9'),_0xfcb5('0xa')),'allowNull':![],'defaultValue':_0xfcb5('0x9')},'reportId':{'type':Sequelize[_0xfcb5('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xfcb5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7244650..7418eae 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 _0xc996=['where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','user','role','UserProfileSection','find','userProfileId','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x56fc4b,_0x35fca3){var _0x229fe2=function(_0x190009){while(--_0x190009){_0x56fc4b['push'](_0x56fc4b['shift']());}};_0x229fe2(++_0x35fca3);}(_0xc996,0x1b2));var _0x6c99=function(_0x301dc8,_0x80494e){_0x301dc8=_0x301dc8-0x0;var _0x40bbc1=_0xc996[_0x301dc8];return _0x40bbc1;};'use strict';var emlformat=require(_0x6c99('0x0'));var rimraf=require(_0x6c99('0x1'));var zipdir=require(_0x6c99('0x2'));var jsonpatch=require(_0x6c99('0x3'));var rp=require('request-promise');var moment=require(_0x6c99('0x4'));var BPromise=require(_0x6c99('0x5'));var Mustache=require(_0x6c99('0x6'));var util=require(_0x6c99('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6c99('0x8'));var fs=require('fs');var fs_extra=require(_0x6c99('0x9'));var _=require(_0x6c99('0xa'));var squel=require('squel');var crypto=require(_0x6c99('0xb'));var jsforce=require(_0x6c99('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c99('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c99('0xe'))('api');var utils=require(_0x6c99('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x6c99('0x10'));var db=require(_0x6c99('0x11'))['db'];function respondWithStatusCode(_0x5bab18,_0x2e21bd){_0x2e21bd=_0x2e21bd||0xcc;return function(_0x1525af){if(_0x1525af){return _0x5bab18[_0x6c99('0x12')](_0x2e21bd);}return _0x5bab18[_0x6c99('0x13')](_0x2e21bd)[_0x6c99('0x14')]();};}function respondWithResult(_0x3ae607,_0x31f5df){_0x31f5df=_0x31f5df||0xc8;return function(_0x1e9728){if(_0x1e9728){return _0x3ae607[_0x6c99('0x13')](_0x31f5df)[_0x6c99('0x15')](_0x1e9728);}};}function respondWithFilteredResult(_0x42ae73,_0x222cd0){return function(_0xcad532){if(_0xcad532){var _0x38cb62=typeof _0x222cd0[_0x6c99('0x16')]===_0x6c99('0x17')&&typeof _0x222cd0['limit']==='undefined';var _0x287399=_0xcad532[_0x6c99('0x18')];var _0x1bcff0=_0x38cb62?0x0:_0x222cd0['offset'];var _0x14ee85=_0x38cb62?_0xcad532[_0x6c99('0x18')]:_0x222cd0['offset']+_0x222cd0[_0x6c99('0x19')];var _0x391ff8;if(_0x14ee85>=_0x287399){_0x14ee85=_0x287399;_0x391ff8=0xc8;}else{_0x391ff8=0xce;}_0x42ae73[_0x6c99('0x13')](_0x391ff8);return _0x42ae73['set'](_0x6c99('0x1a'),_0x1bcff0+'-'+_0x14ee85+'/'+_0x287399)[_0x6c99('0x15')](_0xcad532);}return null;};}function patchUpdates(_0x573b9b){return function(_0x4eaeb1){try{jsonpatch['apply'](_0x4eaeb1,_0x573b9b,!![]);}catch(_0x3df0ec){return BPromise[_0x6c99('0x1b')](_0x3df0ec);}return _0x4eaeb1['save']();};}function saveUpdates(_0x209b1a,_0x3a12fb){return function(_0x1b3d69){if(_0x1b3d69){return _0x1b3d69['update'](_0x209b1a)[_0x6c99('0x1c')](function(_0x387214){return _0x387214;});}return null;};}function removeEntity(_0xb53350,_0x187e3b){return function(_0x5b53aa){if(_0x5b53aa){return _0x5b53aa[_0x6c99('0x1d')]()[_0x6c99('0x1c')](function(){var _0x3c05d5=_0x5b53aa[_0x6c99('0x1e')]({'plain':!![]});var _0x5eb5b6='ExtractedReports';return db[_0x6c99('0x1f')][_0x6c99('0x1d')]({'where':{'type':_0x5eb5b6,'resourceId':_0x3c05d5['id']}})[_0x6c99('0x1c')](function(){return _0x5b53aa;});})['then'](function(){_0xb53350[_0x6c99('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e9f7,_0x646dac){return function(_0x360200){if(!_0x360200){_0x19e9f7[_0x6c99('0x12')](0x194);}return _0x360200;};}function handleError(_0x5af918,_0x311af7){_0x311af7=_0x311af7||0x1f4;return function(_0x5b6308){logger[_0x6c99('0x20')](_0x5b6308[_0x6c99('0x21')]);if(_0x5b6308[_0x6c99('0x22')]){delete _0x5b6308[_0x6c99('0x22')];}_0x5af918[_0x6c99('0x13')](_0x311af7)[_0x6c99('0x23')](_0x5b6308);};}exports[_0x6c99('0x24')]=function(_0x38d052,_0x55dac1){var _0x7fbdc7={},_0x360d39={},_0x576d8f={'count':0x0,'rows':[]};var _0x43ef15=_[_0x6c99('0x25')](db[_0x6c99('0x26')]['rawAttributes'],function(_0x2cd182){return{'name':_0x2cd182[_0x6c99('0x27')],'type':_0x2cd182[_0x6c99('0x28')][_0x6c99('0x29')]};});_0x360d39[_0x6c99('0x2a')]=_[_0x6c99('0x25')](_0x43ef15,_0x6c99('0x22'));_0x360d39[_0x6c99('0x2b')]=_[_0x6c99('0x2c')](_0x38d052[_0x6c99('0x2b')]);_0x360d39[_0x6c99('0x2d')]=_[_0x6c99('0x2e')](_0x360d39[_0x6c99('0x2a')],_0x360d39[_0x6c99('0x2b')]);_0x7fbdc7[_0x6c99('0x2f')]=_[_0x6c99('0x2e')](_0x360d39['model'],qs[_0x6c99('0x30')](_0x38d052['query'][_0x6c99('0x30')]));_0x7fbdc7[_0x6c99('0x2f')]=_0x7fbdc7[_0x6c99('0x2f')][_0x6c99('0x31')]?_0x7fbdc7[_0x6c99('0x2f')]:_0x360d39[_0x6c99('0x2a')];if(!_0x38d052[_0x6c99('0x2b')][_0x6c99('0x32')]('nolimit')){_0x7fbdc7[_0x6c99('0x19')]=qs[_0x6c99('0x19')](_0x38d052[_0x6c99('0x2b')][_0x6c99('0x19')]);_0x7fbdc7[_0x6c99('0x16')]=qs['offset'](_0x38d052['query'][_0x6c99('0x16')]);}_0x7fbdc7[_0x6c99('0x33')]=qs['sort'](_0x38d052[_0x6c99('0x2b')]['sort']);_0x7fbdc7[_0x6c99('0x34')]=qs[_0x6c99('0x2d')](_['pick'](_0x38d052[_0x6c99('0x2b')],_0x360d39[_0x6c99('0x2d')]),_0x43ef15);if(_0x38d052['query'][_0x6c99('0x35')]){_0x7fbdc7[_0x6c99('0x34')]=_[_0x6c99('0x36')](_0x7fbdc7[_0x6c99('0x34')],{'$or':_['map'](_0x43ef15,function(_0x41eda1){if(_0x41eda1[_0x6c99('0x28')]!==_0x6c99('0x37')){var _0xb83336={};_0xb83336[_0x41eda1[_0x6c99('0x22')]]={'$like':'%'+_0x38d052[_0x6c99('0x2b')][_0x6c99('0x35')]+'%'};return _0xb83336;}})});}_0x7fbdc7=_[_0x6c99('0x36')]({},_0x7fbdc7,_0x38d052[_0x6c99('0x38')]);var _0x52fc64={'where':_0x7fbdc7[_0x6c99('0x34')]};return db[_0x6c99('0x26')]['count'](_0x52fc64)[_0x6c99('0x1c')](function(_0x12cf51){_0x576d8f[_0x6c99('0x18')]=_0x12cf51;if(_0x38d052[_0x6c99('0x2b')][_0x6c99('0x39')]){_0x7fbdc7['include']=[{'all':!![]}];}return db[_0x6c99('0x26')]['findAll'](_0x7fbdc7);})[_0x6c99('0x1c')](function(_0xfafba7){_0x576d8f[_0x6c99('0x3a')]=_0xfafba7;return _0x576d8f;})[_0x6c99('0x1c')](respondWithFilteredResult(_0x55dac1,_0x7fbdc7))[_0x6c99('0x3b')](handleError(_0x55dac1,null));};exports[_0x6c99('0x3c')]=function(_0x246311,_0x23067a){var _0x53b9f2={'raw':!![],'where':{'id':_0x246311[_0x6c99('0x3d')]['id']}},_0x195c49={};_0x195c49[_0x6c99('0x2a')]=_[_0x6c99('0x2c')](db['AnalyticExtractedReport']['rawAttributes']);_0x195c49[_0x6c99('0x2b')]=_[_0x6c99('0x2c')](_0x246311[_0x6c99('0x2b')]);_0x195c49[_0x6c99('0x2d')]=_[_0x6c99('0x2e')](_0x195c49['model'],_0x195c49['query']);_0x53b9f2[_0x6c99('0x2f')]=_[_0x6c99('0x2e')](_0x195c49[_0x6c99('0x2a')],qs[_0x6c99('0x30')](_0x246311[_0x6c99('0x2b')]['fields']));_0x53b9f2['attributes']=_0x53b9f2[_0x6c99('0x2f')][_0x6c99('0x31')]?_0x53b9f2[_0x6c99('0x2f')]:_0x195c49[_0x6c99('0x2a')];if(_0x246311[_0x6c99('0x2b')][_0x6c99('0x39')]){_0x53b9f2[_0x6c99('0x3e')]=[{'all':!![]}];}_0x53b9f2=_[_0x6c99('0x36')]({},_0x53b9f2,_0x246311['options']);return db[_0x6c99('0x26')]['find'](_0x53b9f2)[_0x6c99('0x1c')](handleEntityNotFound(_0x23067a,null))[_0x6c99('0x1c')](respondWithResult(_0x23067a,null))[_0x6c99('0x3b')](handleError(_0x23067a,null));};exports[_0x6c99('0x3f')]=function(_0x49a153,_0x1732f5){return db[_0x6c99('0x26')][_0x6c99('0x3f')](_0x49a153[_0x6c99('0x40')],{})[_0x6c99('0x1c')](function(_0x308e88){var _0xf20bc8=_0x49a153[_0x6c99('0x41')][_0x6c99('0x1e')]({'plain':!![]});if(!_0xf20bc8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf20bc8[_0x6c99('0x42')]===_0x6c99('0x41')){var _0x276fa3=_0x308e88[_0x6c99('0x1e')]({'plain':!![]});var _0x12c81f='ExtractedReports';return db[_0x6c99('0x43')][_0x6c99('0x44')]({'where':{'name':_0x12c81f,'userProfileId':_0xf20bc8[_0x6c99('0x45')]},'raw':!![]})[_0x6c99('0x1c')](function(_0x4290d4){if(_0x4290d4&&_0x4290d4['autoAssociation']===0x0){return db[_0x6c99('0x1f')][_0x6c99('0x3f')]({'name':_0x276fa3[_0x6c99('0x22')],'resourceId':_0x276fa3['id'],'type':_0x4290d4[_0x6c99('0x22')],'sectionId':_0x4290d4['id']},{})[_0x6c99('0x1c')](function(){return _0x308e88;});}else{return _0x308e88;}})['catch'](function(_0xc47a9e){logger[_0x6c99('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc47a9e);throw _0xc47a9e;});}return _0x308e88;})['then'](respondWithResult(_0x1732f5,0xc9))['catch'](handleError(_0x1732f5,null));};exports['update']=function(_0x5d94fb,_0x4b199d){if(_0x5d94fb[_0x6c99('0x40')]['id']){delete _0x5d94fb[_0x6c99('0x40')]['id'];}return db[_0x6c99('0x26')]['find']({'where':{'id':_0x5d94fb['params']['id']}})[_0x6c99('0x1c')](handleEntityNotFound(_0x4b199d,null))[_0x6c99('0x1c')](saveUpdates(_0x5d94fb['body'],null))['then'](respondWithResult(_0x4b199d,null))['catch'](handleError(_0x4b199d,null));};exports[_0x6c99('0x1d')]=function(_0x1a17f7,_0x78a972){return db[_0x6c99('0x26')][_0x6c99('0x44')]({'where':{'id':_0x1a17f7['params']['id']}})['then'](handleEntityNotFound(_0x78a972,null))[_0x6c99('0x1c')](removeEntity(_0x78a972,null))[_0x6c99('0x3b')](handleError(_0x78a972,null));};exports[_0x6c99('0x46')]=function(_0x6fe4b,_0x523112,_0x2f3a06){return db[_0x6c99('0x26')]['find']({'where':{'id':_0x6fe4b[_0x6c99('0x3d')]['id']},'attributes':[_0x6c99('0x22'),_0x6c99('0x47'),_0x6c99('0x48'),_0x6c99('0x49')],'raw':!![]})[_0x6c99('0x1c')](handleEntityNotFound(_0x523112,null))['then'](function(_0x5c4ed6){if(_0x5c4ed6){if(!fs[_0x6c99('0x4a')](path[_0x6c99('0x4b')](config['root'],_0x6c99('0x4c'),_0x5c4ed6['savename']))){throw new db[(_0x6c99('0x4d'))][(_0x6c99('0x4e'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x6fe4b[_0x6c99('0x2b')]['exists']){return _0x523112[_0x6c99('0x12')](0xc8);}return _0x523112[_0x6c99('0x46')](path[_0x6c99('0x4b')](config['root'],_0x6c99('0x4c'),_0x5c4ed6[_0x6c99('0x48')]),util[_0x6c99('0x4f')](_0x6c99('0x50'),_0x5c4ed6['basename']||_0x5c4ed6[_0x6c99('0x22')],_0x5c4ed6['output']['toLowerCase']()));}})[_0x6c99('0x3b')](handleError(_0x523112,null));}; \ No newline at end of file +var _0x6dac=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticExtractedReport','rawAttributes','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3c3546,_0x1219af){var _0x96b330=function(_0x41b7c2){while(--_0x41b7c2){_0x3c3546['push'](_0x3c3546['shift']());}};_0x96b330(++_0x1219af);}(_0x6dac,0x10d));var _0xc6da=function(_0x3b3e86,_0xb9538b){_0x3b3e86=_0x3b3e86-0x0;var _0x5c0055=_0x6dac[_0x3b3e86];return _0x5c0055;};'use strict';var emlformat=require(_0xc6da('0x0'));var rimraf=require(_0xc6da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6da('0x2'));var rp=require(_0xc6da('0x3'));var moment=require(_0xc6da('0x4'));var BPromise=require(_0xc6da('0x5'));var Mustache=require(_0xc6da('0x6'));var util=require(_0xc6da('0x7'));var path=require(_0xc6da('0x8'));var sox=require(_0xc6da('0x9'));var csv=require(_0xc6da('0xa'));var ejs=require(_0xc6da('0xb'));var fs=require('fs');var fs_extra=require(_0xc6da('0xc'));var _=require(_0xc6da('0xd'));var squel=require(_0xc6da('0xe'));var crypto=require(_0xc6da('0xf'));var jsforce=require(_0xc6da('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6da('0x11'));var qs=require(_0xc6da('0x12'));var as=require(_0xc6da('0x13'));var hardwareService=require(_0xc6da('0x14'));var logger=require(_0xc6da('0x15'))('api');var utils=require(_0xc6da('0x16'));var config=require(_0xc6da('0x17'));var licenseUtil=require(_0xc6da('0x18'));var db=require(_0xc6da('0x19'))['db'];function respondWithStatusCode(_0x2f1b91,_0x604453){_0x604453=_0x604453||0xcc;return function(_0x5511b7){if(_0x5511b7){return _0x2f1b91['sendStatus'](_0x604453);}return _0x2f1b91[_0xc6da('0x1a')](_0x604453)['end']();};}function respondWithResult(_0x488056,_0x45d66d){_0x45d66d=_0x45d66d||0xc8;return function(_0x3478b7){if(_0x3478b7){return _0x488056['status'](_0x45d66d)[_0xc6da('0x1b')](_0x3478b7);}};}function respondWithFilteredResult(_0x23b325,_0x7adf2){return function(_0x54d62e){if(_0x54d62e){var _0x6a5969=typeof _0x7adf2[_0xc6da('0x1c')]===_0xc6da('0x1d')&&typeof _0x7adf2[_0xc6da('0x1e')]===_0xc6da('0x1d');var _0x3da8f6=_0x54d62e[_0xc6da('0x1f')];var _0x539dd5=_0x6a5969?0x0:_0x7adf2[_0xc6da('0x1c')];var _0x9f1a62=_0x6a5969?_0x54d62e[_0xc6da('0x1f')]:_0x7adf2[_0xc6da('0x1c')]+_0x7adf2['limit'];var _0x2279fb;if(_0x9f1a62>=_0x3da8f6){_0x9f1a62=_0x3da8f6;_0x2279fb=0xc8;}else{_0x2279fb=0xce;}_0x23b325[_0xc6da('0x1a')](_0x2279fb);return _0x23b325['set'](_0xc6da('0x20'),_0x539dd5+'-'+_0x9f1a62+'/'+_0x3da8f6)['json'](_0x54d62e);}return null;};}function patchUpdates(_0xaba4c9){return function(_0x2aa8bb){try{jsonpatch[_0xc6da('0x21')](_0x2aa8bb,_0xaba4c9,!![]);}catch(_0x4bfa34){return BPromise[_0xc6da('0x22')](_0x4bfa34);}return _0x2aa8bb[_0xc6da('0x23')]();};}function saveUpdates(_0x5b7324,_0x44a894){return function(_0x23d74f){if(_0x23d74f){return _0x23d74f[_0xc6da('0x24')](_0x5b7324)[_0xc6da('0x25')](function(_0x241cd0){return _0x241cd0;});}return null;};}function removeEntity(_0xa7039b,_0x1c6616){return function(_0x53ddeb){if(_0x53ddeb){return _0x53ddeb[_0xc6da('0x26')]()[_0xc6da('0x25')](function(){var _0x567dde=_0x53ddeb['get']({'plain':!![]});var _0x4e8b9b=_0xc6da('0x27');return db[_0xc6da('0x28')][_0xc6da('0x26')]({'where':{'type':_0x4e8b9b,'resourceId':_0x567dde['id']}})[_0xc6da('0x25')](function(){return _0x53ddeb;});})[_0xc6da('0x25')](function(){_0xa7039b[_0xc6da('0x1a')](0xcc)[_0xc6da('0x29')]();});}};}function handleEntityNotFound(_0x10cac7,_0xef3cc4){return function(_0x349e07){if(!_0x349e07){_0x10cac7[_0xc6da('0x2a')](0x194);}return _0x349e07;};}function handleError(_0x242dc0,_0x1195d1){_0x1195d1=_0x1195d1||0x1f4;return function(_0x455c1a){logger[_0xc6da('0x2b')](_0x455c1a[_0xc6da('0x2c')]);if(_0x455c1a[_0xc6da('0x2d')]){delete _0x455c1a[_0xc6da('0x2d')];}_0x242dc0[_0xc6da('0x1a')](_0x1195d1)[_0xc6da('0x2e')](_0x455c1a);};}exports['index']=function(_0x261ac7,_0x38c66c){var _0x36870c={},_0xafbb77={},_0x2b6190={'count':0x0,'rows':[]};var _0x5cf68b=_['map'](db[_0xc6da('0x2f')][_0xc6da('0x30')],function(_0x2ef7b8){return{'name':_0x2ef7b8['fieldName'],'type':_0x2ef7b8['type'][_0xc6da('0x31')]};});_0xafbb77[_0xc6da('0x32')]=_[_0xc6da('0x33')](_0x5cf68b,_0xc6da('0x2d'));_0xafbb77['query']=_[_0xc6da('0x34')](_0x261ac7[_0xc6da('0x35')]);_0xafbb77['filters']=_[_0xc6da('0x36')](_0xafbb77[_0xc6da('0x32')],_0xafbb77[_0xc6da('0x35')]);_0x36870c['attributes']=_[_0xc6da('0x36')](_0xafbb77[_0xc6da('0x32')],qs['fields'](_0x261ac7[_0xc6da('0x35')][_0xc6da('0x37')]));_0x36870c[_0xc6da('0x38')]=_0x36870c[_0xc6da('0x38')][_0xc6da('0x39')]?_0x36870c[_0xc6da('0x38')]:_0xafbb77[_0xc6da('0x32')];if(!_0x261ac7['query'][_0xc6da('0x3a')](_0xc6da('0x3b'))){_0x36870c[_0xc6da('0x1e')]=qs['limit'](_0x261ac7['query'][_0xc6da('0x1e')]);_0x36870c[_0xc6da('0x1c')]=qs[_0xc6da('0x1c')](_0x261ac7[_0xc6da('0x35')]['offset']);}_0x36870c[_0xc6da('0x3c')]=qs[_0xc6da('0x3d')](_0x261ac7[_0xc6da('0x35')][_0xc6da('0x3d')]);_0x36870c[_0xc6da('0x3e')]=qs[_0xc6da('0x3f')](_[_0xc6da('0x40')](_0x261ac7['query'],_0xafbb77[_0xc6da('0x3f')]),_0x5cf68b);if(_0x261ac7[_0xc6da('0x35')][_0xc6da('0x41')]){_0x36870c['where']=_[_0xc6da('0x42')](_0x36870c[_0xc6da('0x3e')],{'$or':_['map'](_0x5cf68b,function(_0x1eaf40){if(_0x1eaf40['type']!==_0xc6da('0x43')){var _0x1f5e9c={};_0x1f5e9c[_0x1eaf40[_0xc6da('0x2d')]]={'$like':'%'+_0x261ac7['query'][_0xc6da('0x41')]+'%'};return _0x1f5e9c;}})});}_0x36870c=_[_0xc6da('0x42')]({},_0x36870c,_0x261ac7[_0xc6da('0x44')]);var _0x17b108={'where':_0x36870c[_0xc6da('0x3e')]};return db['AnalyticExtractedReport']['count'](_0x17b108)[_0xc6da('0x25')](function(_0x4fa403){_0x2b6190[_0xc6da('0x1f')]=_0x4fa403;if(_0x261ac7[_0xc6da('0x35')][_0xc6da('0x45')]){_0x36870c[_0xc6da('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xc6da('0x47')](_0x36870c);})['then'](function(_0x35a941){_0x2b6190['rows']=_0x35a941;return _0x2b6190;})[_0xc6da('0x25')](respondWithFilteredResult(_0x38c66c,_0x36870c))[_0xc6da('0x48')](handleError(_0x38c66c,null));};exports[_0xc6da('0x49')]=function(_0x38d0f2,_0x260a10){var _0x215560={'raw':!![],'where':{'id':_0x38d0f2[_0xc6da('0x4a')]['id']}},_0x527d49={};_0x527d49['model']=_[_0xc6da('0x34')](db['AnalyticExtractedReport'][_0xc6da('0x30')]);_0x527d49[_0xc6da('0x35')]=_['keys'](_0x38d0f2['query']);_0x527d49[_0xc6da('0x3f')]=_[_0xc6da('0x36')](_0x527d49[_0xc6da('0x32')],_0x527d49[_0xc6da('0x35')]);_0x215560[_0xc6da('0x38')]=_['intersection'](_0x527d49[_0xc6da('0x32')],qs[_0xc6da('0x37')](_0x38d0f2[_0xc6da('0x35')][_0xc6da('0x37')]));_0x215560[_0xc6da('0x38')]=_0x215560[_0xc6da('0x38')]['length']?_0x215560['attributes']:_0x527d49[_0xc6da('0x32')];if(_0x38d0f2[_0xc6da('0x35')][_0xc6da('0x45')]){_0x215560[_0xc6da('0x46')]=[{'all':!![]}];}_0x215560=_[_0xc6da('0x42')]({},_0x215560,_0x38d0f2[_0xc6da('0x44')]);return db['AnalyticExtractedReport'][_0xc6da('0x4b')](_0x215560)[_0xc6da('0x25')](handleEntityNotFound(_0x260a10,null))[_0xc6da('0x25')](respondWithResult(_0x260a10,null))[_0xc6da('0x48')](handleError(_0x260a10,null));};exports[_0xc6da('0x4c')]=function(_0xa384f7,_0x5c7bac){return db[_0xc6da('0x2f')][_0xc6da('0x4c')](_0xa384f7[_0xc6da('0x4d')],{})['then'](function(_0x464c77){var _0x2958db=_0xa384f7[_0xc6da('0x4e')][_0xc6da('0x4f')]({'plain':!![]});if(!_0x2958db)throw new Error(_0xc6da('0x50'));if(_0x2958db[_0xc6da('0x51')]==='user'){var _0x4e9fd0=_0x464c77['get']({'plain':!![]});var _0x25a6f4='ExtractedReports';return db[_0xc6da('0x52')]['find']({'where':{'name':_0x25a6f4,'userProfileId':_0x2958db[_0xc6da('0x53')]},'raw':!![]})['then'](function(_0x58f35d){if(_0x58f35d&&_0x58f35d[_0xc6da('0x54')]===0x0){return db[_0xc6da('0x28')][_0xc6da('0x4c')]({'name':_0x4e9fd0[_0xc6da('0x2d')],'resourceId':_0x4e9fd0['id'],'type':_0x58f35d[_0xc6da('0x2d')],'sectionId':_0x58f35d['id']},{})[_0xc6da('0x25')](function(){return _0x464c77;});}else{return _0x464c77;}})[_0xc6da('0x48')](function(_0x447f85){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x447f85);throw _0x447f85;});}return _0x464c77;})['then'](respondWithResult(_0x5c7bac,0xc9))[_0xc6da('0x48')](handleError(_0x5c7bac,null));};exports['update']=function(_0x1079aa,_0x3412d9){if(_0x1079aa[_0xc6da('0x4d')]['id']){delete _0x1079aa[_0xc6da('0x4d')]['id'];}return db[_0xc6da('0x2f')]['find']({'where':{'id':_0x1079aa[_0xc6da('0x4a')]['id']}})[_0xc6da('0x25')](handleEntityNotFound(_0x3412d9,null))[_0xc6da('0x25')](saveUpdates(_0x1079aa['body'],null))[_0xc6da('0x25')](respondWithResult(_0x3412d9,null))[_0xc6da('0x48')](handleError(_0x3412d9,null));};exports[_0xc6da('0x26')]=function(_0x4501c1,_0x50802b){return db[_0xc6da('0x2f')][_0xc6da('0x4b')]({'where':{'id':_0x4501c1[_0xc6da('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50802b,null))['then'](removeEntity(_0x50802b,null))[_0xc6da('0x48')](handleError(_0x50802b,null));};exports[_0xc6da('0x55')]=function(_0x10bd97,_0x433f69,_0x530b6d){return db[_0xc6da('0x2f')]['find']({'where':{'id':_0x10bd97['params']['id']},'attributes':[_0xc6da('0x2d'),_0xc6da('0x56'),_0xc6da('0x57'),_0xc6da('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x433f69,null))['then'](function(_0x3d2d80){if(_0x3d2d80){if(!fs['existsSync'](path[_0xc6da('0x59')](config[_0xc6da('0x5a')],_0xc6da('0x5b'),_0x3d2d80[_0xc6da('0x57')]))){throw new db[(_0xc6da('0x5c'))][(_0xc6da('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x10bd97['query'][_0xc6da('0x5e')]){return _0x433f69['sendStatus'](0xc8);}return _0x433f69[_0xc6da('0x55')](path['join'](config[_0xc6da('0x5a')],_0xc6da('0x5b'),_0x3d2d80[_0xc6da('0x57')]),util[_0xc6da('0x5f')](_0xc6da('0x60'),_0x3d2d80[_0xc6da('0x56')]||_0x3d2d80[_0xc6da('0x2d')],_0x3d2d80['output']['toLowerCase']()));}})['catch'](handleError(_0x433f69,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e5b49fb..71020e8 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 _0x6e64=['rimraf','../../config/environment','./analyticExtractedReport.attributes','analytics_extracted_reports','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2fd8cb,_0x41ee54){var _0x26df40=function(_0xf2b192){while(--_0xf2b192){_0x2fd8cb['push'](_0x2fd8cb['shift']());}};_0x26df40(++_0x41ee54);}(_0x6e64,0x8b));var _0x46e6=function(_0x413a29,_0x7afab9){_0x413a29=_0x413a29-0x0;var _0x1c75b9=_0x6e64[_0x413a29];return _0x1c75b9;};'use strict';var _=require(_0x46e6('0x0'));var util=require('util');var logger=require(_0x46e6('0x1'))(_0x46e6('0x2'));var moment=require(_0x46e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x46e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46e6('0x5'));var config=require(_0x46e6('0x6'));var attributes=require(_0x46e6('0x7'));module['exports']=function(_0x45eace,_0x159b5a){return _0x45eace['define']('AnalyticExtractedReport',attributes,{'tableName':_0x46e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf327=['./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf327,0x1e9));var _0x7f32=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf327[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f32('0x0'));var util=require(_0x7f32('0x1'));var logger=require(_0x7f32('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7f32('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f32('0x4'));var rimraf=require('rimraf');var config=require(_0x7f32('0x5'));var attributes=require(_0x7f32('0x6'));module['exports']=function(_0x40c3cd,_0x1c11f6){return _0x40c3cd['define'](_0x7f32('0x7'),attributes,{'tableName':_0x7f32('0x8'),'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 804b0d9..e656746 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 _0x1a81=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3b96de,_0x210cc3){var _0x478e1d=function(_0x49505e){while(--_0x49505e){_0x3b96de['push'](_0x3b96de['shift']());}};_0x478e1d(++_0x210cc3);}(_0x1a81,0x19b));var _0x11a8=function(_0x30e881,_0x59a836){_0x30e881=_0x30e881-0x0;var _0x33a1fb=_0x1a81[_0x30e881];return _0x33a1fb;};'use strict';var _=require(_0x11a8('0x0'));var util=require(_0x11a8('0x1'));var moment=require(_0x11a8('0x2'));var BPromise=require(_0x11a8('0x3'));var rs=require(_0x11a8('0x4'));var fs=require('fs');var Redis=require(_0x11a8('0x5'));var db=require(_0x11a8('0x6'))['db'];var utils=require(_0x11a8('0x7'));var logger=require(_0x11a8('0x8'))(_0x11a8('0x9'));var config=require(_0x11a8('0xa'));var jayson=require(_0x11a8('0xb'));var client=jayson[_0x11a8('0xc')][_0x11a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x444939,_0x279c94,_0x4e1cdf){return new BPromise(function(_0x142aa8,_0x5be146){return client[_0x11a8('0xe')](_0x444939,_0x4e1cdf)[_0x11a8('0xf')](function(_0x2ccb4f){logger['info'](_0x11a8('0x10'),_0x279c94,_0x11a8('0x11'));logger[_0x11a8('0x12')](_0x11a8('0x13'),_0x279c94,_0x11a8('0x11'),JSON[_0x11a8('0x14')](_0x2ccb4f));if(_0x2ccb4f[_0x11a8('0x15')]){if(_0x2ccb4f[_0x11a8('0x15')]['code']===0x1f4){logger[_0x11a8('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x279c94,_0x2ccb4f[_0x11a8('0x15')][_0x11a8('0x16')]);return _0x5be146(_0x2ccb4f[_0x11a8('0x15')][_0x11a8('0x16')]);}logger[_0x11a8('0x15')](_0x11a8('0x10'),_0x279c94,_0x2ccb4f[_0x11a8('0x15')][_0x11a8('0x16')]);return _0x142aa8(_0x2ccb4f['error'][_0x11a8('0x16')]);}else{logger[_0x11a8('0x17')](_0x11a8('0x10'),_0x279c94,_0x11a8('0x11'));_0x142aa8(_0x2ccb4f[_0x11a8('0x18')][_0x11a8('0x16')]);}})[_0x11a8('0x19')](function(_0x53f8ac){logger[_0x11a8('0x15')](_0x11a8('0x10'),_0x279c94,_0x53f8ac);_0x5be146(_0x53f8ac);});});} \ No newline at end of file +var _0xd4bb=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1713ad,_0x37548a){var _0xc79a4f=function(_0x3faada){while(--_0x3faada){_0x1713ad['push'](_0x1713ad['shift']());}};_0xc79a4f(++_0x37548a);}(_0xd4bb,0x144));var _0xbd4b=function(_0x34751e,_0x31fe0a){_0x34751e=_0x34751e-0x0;var _0x25dcf9=_0xd4bb[_0x34751e];return _0x25dcf9;};'use strict';var _=require(_0xbd4b('0x0'));var util=require(_0xbd4b('0x1'));var moment=require(_0xbd4b('0x2'));var BPromise=require(_0xbd4b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd4b('0x4'));var db=require(_0xbd4b('0x5'))['db'];var utils=require(_0xbd4b('0x6'));var logger=require(_0xbd4b('0x7'))(_0xbd4b('0x8'));var config=require('../../config/environment');var jayson=require(_0xbd4b('0x9'));var client=jayson[_0xbd4b('0xa')][_0xbd4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24373c,_0x236716,_0x130118){return new BPromise(function(_0x1ddf03,_0xbccb08){return client[_0xbd4b('0xc')](_0x24373c,_0x130118)[_0xbd4b('0xd')](function(_0x58a874){logger['info'](_0xbd4b('0xe'),_0x236716,_0xbd4b('0xf'));logger[_0xbd4b('0x10')](_0xbd4b('0x11'),_0x236716,_0xbd4b('0xf'),JSON[_0xbd4b('0x12')](_0x58a874));if(_0x58a874[_0xbd4b('0x13')]){if(_0x58a874['error'][_0xbd4b('0x14')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x236716,_0x58a874[_0xbd4b('0x13')][_0xbd4b('0x15')]);return _0xbccb08(_0x58a874['error'][_0xbd4b('0x15')]);}logger[_0xbd4b('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x236716,_0x58a874[_0xbd4b('0x13')][_0xbd4b('0x15')]);return _0x1ddf03(_0x58a874[_0xbd4b('0x13')]['message']);}else{logger[_0xbd4b('0x16')](_0xbd4b('0xe'),_0x236716,_0xbd4b('0xf'));_0x1ddf03(_0x58a874[_0xbd4b('0x17')][_0xbd4b('0x15')]);}})[_0xbd4b('0x18')](function(_0x4c7eff){logger[_0xbd4b('0x13')](_0xbd4b('0xe'),_0x236716,_0x4c7eff);_0xbccb08(_0x4c7eff);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 059d285..be46337 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 _0xc2fc=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','delete'];(function(_0x2df601,_0xf0897c){var _0x34d056=function(_0x3cb656){while(--_0x3cb656){_0x2df601['push'](_0x2df601['shift']());}};_0x34d056(++_0xf0897c);}(_0xc2fc,0xf4));var _0xcc2f=function(_0x23808c,_0x30bc30){_0x23808c=_0x23808c-0x0;var _0x2c04c2=_0xc2fc[_0x23808c];return _0x2c04c2;};'use strict';var multer=require('multer');var util=require(_0xcc2f('0x0'));var path=require(_0xcc2f('0x1'));var timeout=require(_0xcc2f('0x2'));var express=require(_0xcc2f('0x3'));var router=express[_0xcc2f('0x4')]();var fs_extra=require(_0xcc2f('0x5'));var auth=require(_0xcc2f('0x6'));var interaction=require(_0xcc2f('0x7'));var config=require(_0xcc2f('0x8'));var controller=require(_0xcc2f('0x9'));router['get']('/',auth[_0xcc2f('0xa')](),controller[_0xcc2f('0xb')]);router[_0xcc2f('0xc')](_0xcc2f('0xd'),auth[_0xcc2f('0xa')](),controller[_0xcc2f('0xe')]);router[_0xcc2f('0xc')](_0xcc2f('0xf'),auth[_0xcc2f('0xa')](),controller[_0xcc2f('0x10')]);router[_0xcc2f('0x11')]('/',auth[_0xcc2f('0xa')](),controller[_0xcc2f('0x12')]);router['put'](_0xcc2f('0xd'),auth[_0xcc2f('0xa')](),controller['update']);router[_0xcc2f('0x13')]('/:id',auth[_0xcc2f('0xa')](),controller[_0xcc2f('0x14')]);module[_0xcc2f('0x15')]=router; \ No newline at end of file +var _0x0ab7=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','download','post','create','put','delete','exports','multer'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x0ab7,0x1a3));var _0x70ab=function(_0x182862,_0x5ef7e3){_0x182862=_0x182862-0x0;var _0x319634=_0x0ab7[_0x182862];return _0x319634;};'use strict';var multer=require(_0x70ab('0x0'));var util=require(_0x70ab('0x1'));var path=require(_0x70ab('0x2'));var timeout=require(_0x70ab('0x3'));var express=require('express');var router=express[_0x70ab('0x4')]();var fs_extra=require(_0x70ab('0x5'));var auth=require(_0x70ab('0x6'));var interaction=require(_0x70ab('0x7'));var config=require(_0x70ab('0x8'));var controller=require(_0x70ab('0x9'));router['get']('/',auth[_0x70ab('0xa')](),controller[_0x70ab('0xb')]);router[_0x70ab('0xc')](_0x70ab('0xd'),auth[_0x70ab('0xa')](),controller['show']);router['get'](_0x70ab('0xe'),auth[_0x70ab('0xa')](),controller[_0x70ab('0xf')]);router[_0x70ab('0x10')]('/',auth[_0x70ab('0xa')](),controller[_0x70ab('0x11')]);router[_0x70ab('0x12')](_0x70ab('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x70ab('0x13')]('/:id',auth[_0x70ab('0xa')](),controller['destroy']);module[_0x70ab('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ee9a961..f8e3bcd 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 _0x40c1=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x40c1,0x18b));var _0x140c=function(_0x4ebdf3,_0x3ae1ef){_0x4ebdf3=_0x4ebdf3-0x0;var _0xea5a86=_0x40c1[_0x4ebdf3];return _0xea5a86;};'use strict';var Sequelize=require(_0x140c('0x0'));module['exports']={'field':{'type':Sequelize[_0x140c('0x1')]},'alias':{'type':Sequelize[_0x140c('0x2')]},'function':{'type':Sequelize[_0x140c('0x2')]},'format':{'type':Sequelize[_0x140c('0x2')]},'groupBy':{'type':Sequelize[_0x140c('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x140c('0x2')]},'custom':{'type':Sequelize[_0x140c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa2ac=['TEXT','STRING','BOOLEAN','exports'];(function(_0x15ef9c,_0x4b8146){var _0x2f03a1=function(_0x5d2874){while(--_0x5d2874){_0x15ef9c['push'](_0x15ef9c['shift']());}};_0x2f03a1(++_0x4b8146);}(_0xa2ac,0x1bf));var _0xca2a=function(_0x795b59,_0x4514f2){_0x795b59=_0x795b59-0x0;var _0x3e53f3=_0xa2ac[_0x795b59];return _0x3e53f3;};'use strict';var Sequelize=require('sequelize');module[_0xca2a('0x0')]={'field':{'type':Sequelize[_0xca2a('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xca2a('0x2')]},'format':{'type':Sequelize[_0xca2a('0x2')]},'groupBy':{'type':Sequelize[_0xca2a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xca2a('0x2')]},'custom':{'type':Sequelize[_0xca2a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2b54335..42c4f81 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 _0xebdc=['json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','sequelize','CustomReportId','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x133ac0,_0x1e4a5c){var _0xd08a12=function(_0x39ad39){while(--_0x39ad39){_0x133ac0['push'](_0x133ac0['shift']());}};_0xd08a12(++_0x1e4a5c);}(_0xebdc,0x166));var _0xcebd=function(_0x575448,_0x5e954f){_0x575448=_0x575448-0x0;var _0x49c394=_0xebdc[_0x575448];return _0x49c394;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcebd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcebd('0x1'));var rp=require(_0xcebd('0x2'));var moment=require(_0xcebd('0x3'));var BPromise=require(_0xcebd('0x4'));var Mustache=require('mustache');var util=require(_0xcebd('0x5'));var path=require('path');var sox=require(_0xcebd('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcebd('0x7'));var _=require('lodash');var squel=require(_0xcebd('0x8'));var crypto=require('crypto');var jsforce=require(_0xcebd('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xcebd('0xa'));var querystring=require('querystring');var Papa=require(_0xcebd('0xb'));var Redis=require(_0xcebd('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcebd('0xd'));var hardwareService=require(_0xcebd('0xe'));var logger=require(_0xcebd('0xf'))('api');var utils=require(_0xcebd('0x10'));var config=require(_0xcebd('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xcebd('0x12'))['db'];function respondWithStatusCode(_0x40353b,_0xa56c92){_0xa56c92=_0xa56c92||0xcc;return function(_0x20f5bd){if(_0x20f5bd){return _0x40353b[_0xcebd('0x13')](_0xa56c92);}return _0x40353b[_0xcebd('0x14')](_0xa56c92)[_0xcebd('0x15')]();};}function respondWithResult(_0x1d1e60,_0x59a4c3){_0x59a4c3=_0x59a4c3||0xc8;return function(_0x372a96){if(_0x372a96){return _0x1d1e60['status'](_0x59a4c3)[_0xcebd('0x16')](_0x372a96);}};}function respondWithFilteredResult(_0x9d5f85,_0x4ecc0d){return function(_0x8c2acc){if(_0x8c2acc){var _0x59eaac=typeof _0x4ecc0d[_0xcebd('0x17')]==='undefined'&&typeof _0x4ecc0d[_0xcebd('0x18')]===_0xcebd('0x19');var _0x577986=_0x8c2acc[_0xcebd('0x1a')];var _0x583e06=_0x59eaac?0x0:_0x4ecc0d['offset'];var _0x2c4387=_0x59eaac?_0x8c2acc['count']:_0x4ecc0d['offset']+_0x4ecc0d[_0xcebd('0x18')];var _0x11eb82;if(_0x2c4387>=_0x577986){_0x2c4387=_0x577986;_0x11eb82=0xc8;}else{_0x11eb82=0xce;}_0x9d5f85[_0xcebd('0x14')](_0x11eb82);return _0x9d5f85['set'](_0xcebd('0x1b'),_0x583e06+'-'+_0x2c4387+'/'+_0x577986)[_0xcebd('0x16')](_0x8c2acc);}return null;};}function patchUpdates(_0x5846e6){return function(_0x438cba){try{jsonpatch[_0xcebd('0x1c')](_0x438cba,_0x5846e6,!![]);}catch(_0x349476){return BPromise[_0xcebd('0x1d')](_0x349476);}return _0x438cba[_0xcebd('0x1e')]();};}function saveUpdates(_0x5f3a96,_0x5a04d2){return function(_0x490843){if(_0x490843){return _0x490843[_0xcebd('0x1f')](_0x5f3a96)[_0xcebd('0x20')](function(_0x50d8e1){return _0x50d8e1;});}return null;};}function removeEntity(_0x384ed7,_0x48122){return function(_0x55ad21){if(_0x55ad21){return _0x55ad21[_0xcebd('0x21')]()[_0xcebd('0x20')](function(){_0x384ed7[_0xcebd('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5643cf,_0x7be1af){return function(_0x17b85b){if(!_0x17b85b){_0x5643cf[_0xcebd('0x13')](0x194);}return _0x17b85b;};}function handleError(_0x17a1d9,_0xcf7366){_0xcf7366=_0xcf7366||0x1f4;return function(_0x307322){logger[_0xcebd('0x22')](_0x307322[_0xcebd('0x23')]);if(_0x307322[_0xcebd('0x24')]){delete _0x307322[_0xcebd('0x24')];}_0x17a1d9['status'](_0xcf7366)[_0xcebd('0x25')](_0x307322);};}exports[_0xcebd('0x26')]=function(_0x32bb07,_0x52239c){var _0x3aafef={},_0x57e491={},_0x33835b={'count':0x0,'rows':[]};var _0x5b3328=_[_0xcebd('0x27')](db[_0xcebd('0x28')]['rawAttributes'],function(_0x2f67a4){return{'name':_0x2f67a4['fieldName'],'type':_0x2f67a4[_0xcebd('0x29')][_0xcebd('0x2a')]};});_0x57e491['model']=_[_0xcebd('0x27')](_0x5b3328,_0xcebd('0x24'));_0x57e491[_0xcebd('0x2b')]=_[_0xcebd('0x2c')](_0x32bb07[_0xcebd('0x2b')]);_0x57e491[_0xcebd('0x2d')]=_[_0xcebd('0x2e')](_0x57e491[_0xcebd('0x2f')],_0x57e491['query']);_0x3aafef['attributes']=_[_0xcebd('0x2e')](_0x57e491[_0xcebd('0x2f')],qs[_0xcebd('0x30')](_0x32bb07['query'][_0xcebd('0x30')]));_0x3aafef[_0xcebd('0x31')]=_0x3aafef[_0xcebd('0x31')][_0xcebd('0x32')]?_0x3aafef[_0xcebd('0x31')]:_0x57e491[_0xcebd('0x2f')];if(!_0x32bb07[_0xcebd('0x2b')][_0xcebd('0x33')](_0xcebd('0x34'))){_0x3aafef[_0xcebd('0x18')]=qs[_0xcebd('0x18')](_0x32bb07[_0xcebd('0x2b')][_0xcebd('0x18')]);_0x3aafef[_0xcebd('0x17')]=qs['offset'](_0x32bb07[_0xcebd('0x2b')]['offset']);}_0x3aafef['order']=qs[_0xcebd('0x35')](_0x32bb07[_0xcebd('0x2b')][_0xcebd('0x35')]);_0x3aafef[_0xcebd('0x36')]=qs['filters'](_[_0xcebd('0x37')](_0x32bb07['query'],_0x57e491[_0xcebd('0x2d')]),_0x5b3328);if(_0x32bb07[_0xcebd('0x2b')][_0xcebd('0x38')]){_0x3aafef[_0xcebd('0x36')]=_[_0xcebd('0x39')](_0x3aafef[_0xcebd('0x36')],{'$or':_[_0xcebd('0x27')](_0x5b3328,function(_0x2d9522){if(_0x2d9522[_0xcebd('0x29')]!=='VIRTUAL'){var _0x2f1684={};_0x2f1684[_0x2d9522[_0xcebd('0x24')]]={'$like':'%'+_0x32bb07[_0xcebd('0x2b')]['filter']+'%'};return _0x2f1684;}})});}_0x3aafef=_[_0xcebd('0x39')]({},_0x3aafef,_0x32bb07[_0xcebd('0x3a')]);var _0x54eac7={'where':_0x3aafef[_0xcebd('0x36')]};return db[_0xcebd('0x28')][_0xcebd('0x1a')](_0x54eac7)[_0xcebd('0x20')](function(_0x214035){_0x33835b[_0xcebd('0x1a')]=_0x214035;if(_0x32bb07[_0xcebd('0x2b')]['includeAll']){_0x3aafef['include']=[{'all':!![]}];}return db[_0xcebd('0x28')][_0xcebd('0x3b')](_0x3aafef);})['then'](function(_0x45d08f){_0x33835b[_0xcebd('0x3c')]=_0x45d08f;return _0x33835b;})[_0xcebd('0x20')](respondWithFilteredResult(_0x52239c,_0x3aafef))['catch'](handleError(_0x52239c,null));};exports[_0xcebd('0x3d')]=function(_0x159b3d,_0x516598){var _0x1c2f5b={'raw':![],'where':{'id':_0x159b3d[_0xcebd('0x3e')]['id']}},_0x8f735d={};_0x8f735d['model']=_[_0xcebd('0x2c')](db[_0xcebd('0x28')][_0xcebd('0x3f')]);_0x8f735d[_0xcebd('0x2b')]=_['keys'](_0x159b3d[_0xcebd('0x2b')]);_0x8f735d[_0xcebd('0x2d')]=_['intersection'](_0x8f735d['model'],_0x8f735d[_0xcebd('0x2b')]);_0x1c2f5b[_0xcebd('0x31')]=_[_0xcebd('0x2e')](_0x8f735d[_0xcebd('0x2f')],qs[_0xcebd('0x30')](_0x159b3d[_0xcebd('0x2b')][_0xcebd('0x30')]));_0x1c2f5b[_0xcebd('0x31')]=_0x1c2f5b['attributes'][_0xcebd('0x32')]?_0x1c2f5b['attributes']:_0x8f735d[_0xcebd('0x2f')];if(_0x159b3d['query'][_0xcebd('0x40')]){_0x1c2f5b[_0xcebd('0x41')]=[{'all':!![]}];}_0x1c2f5b=_[_0xcebd('0x39')]({},_0x1c2f5b,_0x159b3d['options']);return db[_0xcebd('0x28')][_0xcebd('0x42')](_0x1c2f5b)['then'](handleEntityNotFound(_0x516598,null))[_0xcebd('0x20')](respondWithResult(_0x516598,null))[_0xcebd('0x43')](handleError(_0x516598,null));};exports[_0xcebd('0x44')]=function(_0x42f1e3,_0x437c51){return db[_0xcebd('0x28')]['create'](_0x42f1e3[_0xcebd('0x45')],{})['then'](respondWithResult(_0x437c51,0xc9))['catch'](handleError(_0x437c51,null));};exports[_0xcebd('0x46')]=function(_0x44b668,_0x3f6eed){return db[_0xcebd('0x28')]['bulkCreate'](_0x44b668[_0xcebd('0x45')],{'raw':![],'individualHooks':!![]})[_0xcebd('0x20')](respondWithResult(_0x3f6eed,0xc9))[_0xcebd('0x43')](handleError(_0x3f6eed,null));};exports[_0xcebd('0x1f')]=function(_0x28a150,_0xd11b88){if(_0x28a150[_0xcebd('0x45')]['id']){delete _0x28a150[_0xcebd('0x45')]['id'];}return db[_0xcebd('0x28')]['find']({'where':{'id':_0x28a150[_0xcebd('0x3e')]['id']}})[_0xcebd('0x20')](handleEntityNotFound(_0xd11b88,null))['then'](saveUpdates(_0x28a150[_0xcebd('0x45')],null))[_0xcebd('0x20')](respondWithResult(_0xd11b88,null))[_0xcebd('0x43')](handleError(_0xd11b88,null));};exports[_0xcebd('0x21')]=function(_0x5496c2,_0x1e065d){return db['AnalyticFieldReport'][_0xcebd('0x42')]({'where':{'id':_0x5496c2['params']['id']}})[_0xcebd('0x20')](handleEntityNotFound(_0x1e065d,null))[_0xcebd('0x20')](removeEntity(_0x1e065d,null))[_0xcebd('0x43')](handleError(_0x1e065d,null));};exports[_0xcebd('0x47')]=function(_0xa918b0,_0x5ad363){return db[_0xcebd('0x28')][_0xcebd('0x21')]({'where':{'id':_0xa918b0[_0xcebd('0x2b')][_0xcebd('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xcebd('0x20')](respondWithResult(_0x5ad363,0xcc))[_0xcebd('0x43')](handleError(_0x5ad363,null));};exports[_0xcebd('0x49')]=function(_0x37815b,_0x5e887d,_0x1d084e){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x37815b[_0xcebd('0x3e')]['id']}})[_0xcebd('0x20')](handleEntityNotFound(_0x5e887d,null))[_0xcebd('0x20')](function(_0xa820f6){if(_0xa820f6){return db[_0xcebd('0x4a')]['transaction'](function(_0xc6124b){return db[_0xcebd('0x28')][_0xcebd('0x21')]({'where':{'CustomReportId':_0x37815b[_0xcebd('0x3e')]['id']},'transaction':_0xc6124b})[_0xcebd('0x20')](function(_0x162278){var _0x146f92=_[_0xcebd('0x27')](_0x37815b[_0xcebd('0x45')],function(_0x5d34d2){delete _0x5d34d2['id'];_0x5d34d2[_0xcebd('0x4b')]=_0x37815b['params']['id'];return _0x5d34d2;});return db[_0xcebd('0x28')][_0xcebd('0x46')](_0x146f92,{'transaction':_0xc6124b});});})[_0xcebd('0x20')](function(){return db[_0xcebd('0x28')][_0xcebd('0x3b')]({'where':{'CustomReportId':_0x37815b[_0xcebd('0x3e')]['id']}});});}})[_0xcebd('0x20')](respondWithResult(_0x5e887d,null))['catch'](handleError(_0x5e887d,null));}; \ No newline at end of file +var _0x87ef=['sendStatus','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','include','AnalyticFieldReport','findAll','show','fields','includeAll','options','find','catch','create','body','bulkCreate','params','bulkDestroy','ids','addFields','findOne','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','offset','undefined','count','limit','set','update','then','destroy'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x87ef,0x75));var _0xf87e=function(_0x5266e7,_0x97b16b){_0x5266e7=_0x5266e7-0x0;var _0x5470f1=_0x87ef[_0x5266e7];return _0x5470f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf87e('0x0'));var zipdir=require(_0xf87e('0x1'));var jsonpatch=require(_0xf87e('0x2'));var rp=require(_0xf87e('0x3'));var moment=require(_0xf87e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf87e('0x5'));var util=require(_0xf87e('0x6'));var path=require(_0xf87e('0x7'));var sox=require(_0xf87e('0x8'));var csv=require(_0xf87e('0x9'));var ejs=require(_0xf87e('0xa'));var fs=require('fs');var fs_extra=require(_0xf87e('0xb'));var _=require(_0xf87e('0xc'));var squel=require('squel');var crypto=require(_0xf87e('0xd'));var jsforce=require(_0xf87e('0xe'));var deskjs=require(_0xf87e('0xf'));var toCsv=require(_0xf87e('0x9'));var querystring=require(_0xf87e('0x10'));var Papa=require('papaparse');var Redis=require(_0xf87e('0x11'));var authService=require(_0xf87e('0x12'));var qs=require(_0xf87e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf87e('0x14'));var logger=require(_0xf87e('0x15'))('api');var utils=require(_0xf87e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf87e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35123e,_0x137475){_0x137475=_0x137475||0xcc;return function(_0x1bd897){if(_0x1bd897){return _0x35123e['sendStatus'](_0x137475);}return _0x35123e['status'](_0x137475)[_0xf87e('0x18')]();};}function respondWithResult(_0x3977ff,_0x49c26e){_0x49c26e=_0x49c26e||0xc8;return function(_0x46c629){if(_0x46c629){return _0x3977ff[_0xf87e('0x19')](_0x49c26e)[_0xf87e('0x1a')](_0x46c629);}};}function respondWithFilteredResult(_0x1d7bf8,_0x344aa1){return function(_0xe8d669){if(_0xe8d669){var _0x18fe6f=typeof _0x344aa1[_0xf87e('0x1b')]==='undefined'&&typeof _0x344aa1['limit']===_0xf87e('0x1c');var _0x649a11=_0xe8d669[_0xf87e('0x1d')];var _0x27803e=_0x18fe6f?0x0:_0x344aa1['offset'];var _0x5ee847=_0x18fe6f?_0xe8d669[_0xf87e('0x1d')]:_0x344aa1[_0xf87e('0x1b')]+_0x344aa1[_0xf87e('0x1e')];var _0x2d58ca;if(_0x5ee847>=_0x649a11){_0x5ee847=_0x649a11;_0x2d58ca=0xc8;}else{_0x2d58ca=0xce;}_0x1d7bf8['status'](_0x2d58ca);return _0x1d7bf8[_0xf87e('0x1f')]('Content-Range',_0x27803e+'-'+_0x5ee847+'/'+_0x649a11)[_0xf87e('0x1a')](_0xe8d669);}return null;};}function patchUpdates(_0x3dec50){return function(_0x32deee){try{jsonpatch['apply'](_0x32deee,_0x3dec50,!![]);}catch(_0x4a07d2){return BPromise['reject'](_0x4a07d2);}return _0x32deee['save']();};}function saveUpdates(_0x434773,_0x49e0c2){return function(_0x268908){if(_0x268908){return _0x268908[_0xf87e('0x20')](_0x434773)[_0xf87e('0x21')](function(_0x42bb01){return _0x42bb01;});}return null;};}function removeEntity(_0x3f883f,_0x13f5ce){return function(_0x1ac02f){if(_0x1ac02f){return _0x1ac02f[_0xf87e('0x22')]()[_0xf87e('0x21')](function(){_0x3f883f[_0xf87e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5985ac,_0x43631d){return function(_0x352a58){if(!_0x352a58){_0x5985ac[_0xf87e('0x23')](0x194);}return _0x352a58;};}function handleError(_0x9ce46a,_0x7ee99c){_0x7ee99c=_0x7ee99c||0x1f4;return function(_0xff0477){logger['error'](_0xff0477[_0xf87e('0x24')]);if(_0xff0477['name']){delete _0xff0477[_0xf87e('0x25')];}_0x9ce46a[_0xf87e('0x19')](_0x7ee99c)[_0xf87e('0x26')](_0xff0477);};}exports[_0xf87e('0x27')]=function(_0x44d4da,_0x18d93){var _0x586be4={},_0x539a94={},_0x2de56a={'count':0x0,'rows':[]};var _0x13df7f=_[_0xf87e('0x28')](db['AnalyticFieldReport']['rawAttributes'],function(_0xc66656){return{'name':_0xc66656[_0xf87e('0x29')],'type':_0xc66656[_0xf87e('0x2a')]['key']};});_0x539a94[_0xf87e('0x2b')]=_['map'](_0x13df7f,_0xf87e('0x25'));_0x539a94[_0xf87e('0x2c')]=_[_0xf87e('0x2d')](_0x44d4da[_0xf87e('0x2c')]);_0x539a94['filters']=_[_0xf87e('0x2e')](_0x539a94['model'],_0x539a94[_0xf87e('0x2c')]);_0x586be4['attributes']=_[_0xf87e('0x2e')](_0x539a94[_0xf87e('0x2b')],qs['fields'](_0x44d4da[_0xf87e('0x2c')]['fields']));_0x586be4['attributes']=_0x586be4[_0xf87e('0x2f')][_0xf87e('0x30')]?_0x586be4['attributes']:_0x539a94[_0xf87e('0x2b')];if(!_0x44d4da[_0xf87e('0x2c')][_0xf87e('0x31')]('nolimit')){_0x586be4[_0xf87e('0x1e')]=qs['limit'](_0x44d4da['query'][_0xf87e('0x1e')]);_0x586be4[_0xf87e('0x1b')]=qs['offset'](_0x44d4da[_0xf87e('0x2c')][_0xf87e('0x1b')]);}_0x586be4[_0xf87e('0x32')]=qs[_0xf87e('0x33')](_0x44d4da[_0xf87e('0x2c')]['sort']);_0x586be4[_0xf87e('0x34')]=qs[_0xf87e('0x35')](_['pick'](_0x44d4da[_0xf87e('0x2c')],_0x539a94[_0xf87e('0x35')]),_0x13df7f);if(_0x44d4da[_0xf87e('0x2c')][_0xf87e('0x36')]){_0x586be4[_0xf87e('0x34')]=_[_0xf87e('0x37')](_0x586be4[_0xf87e('0x34')],{'$or':_[_0xf87e('0x28')](_0x13df7f,function(_0x340f27){if(_0x340f27[_0xf87e('0x2a')]!==_0xf87e('0x38')){var _0x226498={};_0x226498[_0x340f27[_0xf87e('0x25')]]={'$like':'%'+_0x44d4da['query'][_0xf87e('0x36')]+'%'};return _0x226498;}})});}_0x586be4=_[_0xf87e('0x37')]({},_0x586be4,_0x44d4da['options']);var _0x3dd25e={'where':_0x586be4[_0xf87e('0x34')]};return db['AnalyticFieldReport'][_0xf87e('0x1d')](_0x3dd25e)[_0xf87e('0x21')](function(_0x411ccf){_0x2de56a[_0xf87e('0x1d')]=_0x411ccf;if(_0x44d4da[_0xf87e('0x2c')]['includeAll']){_0x586be4[_0xf87e('0x39')]=[{'all':!![]}];}return db[_0xf87e('0x3a')][_0xf87e('0x3b')](_0x586be4);})[_0xf87e('0x21')](function(_0x234014){_0x2de56a['rows']=_0x234014;return _0x2de56a;})[_0xf87e('0x21')](respondWithFilteredResult(_0x18d93,_0x586be4))['catch'](handleError(_0x18d93,null));};exports[_0xf87e('0x3c')]=function(_0x46c436,_0x49a030){var _0x56e2d0={'raw':![],'where':{'id':_0x46c436['params']['id']}},_0x5079e0={};_0x5079e0[_0xf87e('0x2b')]=_[_0xf87e('0x2d')](db['AnalyticFieldReport']['rawAttributes']);_0x5079e0['query']=_['keys'](_0x46c436[_0xf87e('0x2c')]);_0x5079e0['filters']=_[_0xf87e('0x2e')](_0x5079e0[_0xf87e('0x2b')],_0x5079e0[_0xf87e('0x2c')]);_0x56e2d0['attributes']=_[_0xf87e('0x2e')](_0x5079e0[_0xf87e('0x2b')],qs['fields'](_0x46c436['query'][_0xf87e('0x3d')]));_0x56e2d0[_0xf87e('0x2f')]=_0x56e2d0[_0xf87e('0x2f')]['length']?_0x56e2d0[_0xf87e('0x2f')]:_0x5079e0[_0xf87e('0x2b')];if(_0x46c436[_0xf87e('0x2c')][_0xf87e('0x3e')]){_0x56e2d0['include']=[{'all':!![]}];}_0x56e2d0=_['merge']({},_0x56e2d0,_0x46c436[_0xf87e('0x3f')]);return db[_0xf87e('0x3a')][_0xf87e('0x40')](_0x56e2d0)[_0xf87e('0x21')](handleEntityNotFound(_0x49a030,null))[_0xf87e('0x21')](respondWithResult(_0x49a030,null))[_0xf87e('0x41')](handleError(_0x49a030,null));};exports['create']=function(_0x1c8bc3,_0x57fb07){return db['AnalyticFieldReport'][_0xf87e('0x42')](_0x1c8bc3[_0xf87e('0x43')],{})[_0xf87e('0x21')](respondWithResult(_0x57fb07,0xc9))[_0xf87e('0x41')](handleError(_0x57fb07,null));};exports[_0xf87e('0x44')]=function(_0x620c24,_0x4cc889){return db[_0xf87e('0x3a')][_0xf87e('0x44')](_0x620c24['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4cc889,0xc9))['catch'](handleError(_0x4cc889,null));};exports[_0xf87e('0x20')]=function(_0x104bad,_0x5965a7){if(_0x104bad[_0xf87e('0x43')]['id']){delete _0x104bad[_0xf87e('0x43')]['id'];}return db[_0xf87e('0x3a')]['find']({'where':{'id':_0x104bad[_0xf87e('0x45')]['id']}})[_0xf87e('0x21')](handleEntityNotFound(_0x5965a7,null))[_0xf87e('0x21')](saveUpdates(_0x104bad[_0xf87e('0x43')],null))[_0xf87e('0x21')](respondWithResult(_0x5965a7,null))[_0xf87e('0x41')](handleError(_0x5965a7,null));};exports[_0xf87e('0x22')]=function(_0x323863,_0x11bef3){return db[_0xf87e('0x3a')][_0xf87e('0x40')]({'where':{'id':_0x323863[_0xf87e('0x45')]['id']}})['then'](handleEntityNotFound(_0x11bef3,null))[_0xf87e('0x21')](removeEntity(_0x11bef3,null))['catch'](handleError(_0x11bef3,null));};exports[_0xf87e('0x46')]=function(_0x2573ec,_0x908821){return db[_0xf87e('0x3a')][_0xf87e('0x22')]({'where':{'id':_0x2573ec['query'][_0xf87e('0x47')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x908821,0xcc))[_0xf87e('0x41')](handleError(_0x908821,null));};exports[_0xf87e('0x48')]=function(_0x5c4f92,_0x219ed0,_0x5a37e2){return db['AnalyticCustomReport'][_0xf87e('0x49')]({'where':{'id':_0x5c4f92[_0xf87e('0x45')]['id']}})[_0xf87e('0x21')](handleEntityNotFound(_0x219ed0,null))['then'](function(_0x5c6d1e){if(_0x5c6d1e){return db['sequelize'][_0xf87e('0x4a')](function(_0x57ec6f){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x5c4f92['params']['id']},'transaction':_0x57ec6f})[_0xf87e('0x21')](function(_0x82333b){var _0x40a729=_[_0xf87e('0x28')](_0x5c4f92[_0xf87e('0x43')],function(_0x49fb9d){delete _0x49fb9d['id'];_0x49fb9d[_0xf87e('0x4b')]=_0x5c4f92[_0xf87e('0x45')]['id'];return _0x49fb9d;});return db[_0xf87e('0x3a')]['bulkCreate'](_0x40a729,{'transaction':_0x57ec6f});});})['then'](function(){return db[_0xf87e('0x3a')][_0xf87e('0x3b')]({'where':{'CustomReportId':_0x5c4f92[_0xf87e('0x45')]['id']}});});}})[_0xf87e('0x21')](respondWithResult(_0x219ed0,null))[_0xf87e('0x41')](handleError(_0x219ed0,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 037ee0c..202cae9 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 _0xe467=['bluebird','path','rimraf','../../config/environment','exports','AnalyticFieldReport','util','../../config/logger','api'];(function(_0x425aff,_0x3ba514){var _0x5a6883=function(_0x4d8d17){while(--_0x4d8d17){_0x425aff['push'](_0x425aff['shift']());}};_0x5a6883(++_0x3ba514);}(_0xe467,0x189));var _0x7e46=function(_0x340214,_0x117887){_0x340214=_0x340214-0x0;var _0x5269ea=_0xe467[_0x340214];return _0x5269ea;};'use strict';var _=require('lodash');var util=require(_0x7e46('0x0'));var logger=require(_0x7e46('0x1'))(_0x7e46('0x2'));var moment=require('moment');var BPromise=require(_0x7e46('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e46('0x4'));var rimraf=require(_0x7e46('0x5'));var config=require(_0x7e46('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x7e46('0x7')]=function(_0x1443c2,_0x1b7136){return _0x1443c2['define'](_0x7e46('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2186=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','util'];(function(_0x4889b0,_0x4d2629){var _0x580eae=function(_0x5cf525){while(--_0x5cf525){_0x4889b0['push'](_0x4889b0['shift']());}};_0x580eae(++_0x4d2629);}(_0x2186,0x107));var _0x6218=function(_0x1c8433,_0x1eee99){_0x1c8433=_0x1c8433-0x0;var _0x5ed18e=_0x2186[_0x1c8433];return _0x5ed18e;};'use strict';var _=require('lodash');var util=require(_0x6218('0x0'));var logger=require(_0x6218('0x1'))(_0x6218('0x2'));var moment=require(_0x6218('0x3'));var BPromise=require('bluebird');var rp=require(_0x6218('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6218('0x5'));var config=require(_0x6218('0x6'));var attributes=require(_0x6218('0x7'));module[_0x6218('0x8')]=function(_0x2a4d62,_0x46d951){return _0x2a4d62[_0x6218('0x9')](_0x6218('0xa'),attributes,{'tableName':'analytics_report_fields','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 96570f5..03fd0b8 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 _0xcfe3=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x4ef719,_0x3ef7d6){var _0x1f469a=function(_0x4623e6){while(--_0x4623e6){_0x4ef719['push'](_0x4ef719['shift']());}};_0x1f469a(++_0x3ef7d6);}(_0xcfe3,0x66));var _0x3cfe=function(_0x235fc9,_0x4ab8f4){_0x235fc9=_0x235fc9-0x0;var _0x13b475=_0xcfe3[_0x235fc9];return _0x13b475;};'use strict';var _=require(_0x3cfe('0x0'));var util=require('util');var moment=require(_0x3cfe('0x1'));var BPromise=require('bluebird');var rs=require(_0x3cfe('0x2'));var fs=require('fs');var Redis=require(_0x3cfe('0x3'));var db=require(_0x3cfe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3cfe('0x5'))('rpc');var config=require(_0x3cfe('0x6'));var jayson=require(_0x3cfe('0x7'));var client=jayson[_0x3cfe('0x8')][_0x3cfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b1fb7,_0x143efc,_0x3f32ea){return new BPromise(function(_0x43323a,_0x4d5289){return client[_0x3cfe('0xa')](_0x5b1fb7,_0x3f32ea)[_0x3cfe('0xb')](function(_0x433a75){logger[_0x3cfe('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x143efc,_0x3cfe('0xd'));logger[_0x3cfe('0xe')](_0x3cfe('0xf'),_0x143efc,_0x3cfe('0xd'),JSON['stringify'](_0x433a75));if(_0x433a75[_0x3cfe('0x10')]){if(_0x433a75[_0x3cfe('0x10')]['code']===0x1f4){logger[_0x3cfe('0x10')](_0x3cfe('0x11'),_0x143efc,_0x433a75[_0x3cfe('0x10')][_0x3cfe('0x12')]);return _0x4d5289(_0x433a75[_0x3cfe('0x10')][_0x3cfe('0x12')]);}logger[_0x3cfe('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x143efc,_0x433a75[_0x3cfe('0x10')]['message']);return _0x43323a(_0x433a75[_0x3cfe('0x10')][_0x3cfe('0x12')]);}else{logger[_0x3cfe('0xc')](_0x3cfe('0x11'),_0x143efc,_0x3cfe('0xd'));_0x43323a(_0x433a75[_0x3cfe('0x13')]['message']);}})['catch'](function(_0x3964ee){logger[_0x3cfe('0x10')](_0x3cfe('0x11'),_0x143efc,_0x3964ee);_0x4d5289(_0x3964ee);});});} \ No newline at end of file +var _0x81a3=['message','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0xb93e37,_0x3643bf){var _0x275cad=function(_0xb50af4){while(--_0xb50af4){_0xb93e37['push'](_0xb93e37['shift']());}};_0x275cad(++_0x3643bf);}(_0x81a3,0x7f));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x381a('0x0'));var rs=require(_0x381a('0x1'));var fs=require('fs');var Redis=require(_0x381a('0x2'));var db=require(_0x381a('0x3'))['db'];var utils=require(_0x381a('0x4'));var logger=require('../../config/logger')(_0x381a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x381a('0x6')][_0x381a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39763d,_0x4ac545,_0x197973){return new BPromise(function(_0x567142,_0x4c5f16){return client[_0x381a('0x8')](_0x39763d,_0x197973)[_0x381a('0x9')](function(_0x325d12){logger[_0x381a('0xa')](_0x381a('0xb'),_0x4ac545,'request\x20sent');logger[_0x381a('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4ac545,_0x381a('0xd'),JSON[_0x381a('0xe')](_0x325d12));if(_0x325d12['error']){if(_0x325d12[_0x381a('0xf')][_0x381a('0x10')]===0x1f4){logger[_0x381a('0xf')](_0x381a('0xb'),_0x4ac545,_0x325d12[_0x381a('0xf')][_0x381a('0x11')]);return _0x4c5f16(_0x325d12[_0x381a('0xf')][_0x381a('0x11')]);}logger[_0x381a('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ac545,_0x325d12[_0x381a('0xf')]['message']);return _0x567142(_0x325d12[_0x381a('0xf')][_0x381a('0x11')]);}else{logger[_0x381a('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ac545,_0x381a('0xd'));_0x567142(_0x325d12['result'][_0x381a('0x11')]);}})['catch'](function(_0x18a5a4){logger[_0x381a('0xf')](_0x381a('0xb'),_0x4ac545,_0x18a5a4);_0x4c5f16(_0x18a5a4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 99a745b..9df19a2 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(_0x4ecfc7,_0x1ced04){var _0x52744b=function(_0x48db04){while(--_0x48db04){_0x4ecfc7['push'](_0x4ecfc7['shift']());}};_0x52744b(++_0x1ced04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0xc889a7,_0x4ead7c){var _0x54d11b=function(_0x308940){while(--_0x308940){_0xc889a7['push'](_0xc889a7['shift']());}};_0x54d11b(++_0x4ead7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 3503688..058db94 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 _0x2f38=['name','STRING','TEXT','exports'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x2f38,0x1a7));var _0x82f3=function(_0x28e832,_0x247be3){_0x28e832=_0x28e832-0x0;var _0x254d00=_0x2f38[_0x28e832];return _0x254d00;};'use strict';var Sequelize=require('sequelize');module[_0x82f3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x82f3('0x1')},'table':{'type':Sequelize[_0x82f3('0x2')]},'metric':{'type':Sequelize[_0x82f3('0x3')]},'description':{'type':Sequelize[_0x82f3('0x2')]}}; \ No newline at end of file +var _0xd404=['exports','name','STRING','sequelize'];(function(_0xe0a071,_0xfc7a0b){var _0x5257b6=function(_0x5eb5e0){while(--_0x5eb5e0){_0xe0a071['push'](_0xe0a071['shift']());}};_0x5257b6(++_0xfc7a0b);}(_0xd404,0x15b));var _0x4d40=function(_0x2ecd8f,_0x32463){_0x2ecd8f=_0x2ecd8f-0x0;var _0x541bab=_0xd404[_0x2ecd8f];return _0x541bab;};'use strict';var Sequelize=require(_0x4d40('0x0'));module[_0x4d40('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d40('0x2')},'table':{'type':Sequelize[_0x4d40('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x4d40('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 75a32fe..cf09d04 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 _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','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','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x3dc7ae,_0x4f4543){var _0x5005ac=function(_0x388c9a){while(--_0x388c9a){_0x3dc7ae['push'](_0x3dc7ae['shift']());}};_0x5005ac(++_0x4f4543);}(_0x425d,0x1e0));var _0xd425=function(_0x4cc630,_0x46f9ef){_0x4cc630=_0x4cc630-0x0;var _0x1a26e9=_0x425d[_0x4cc630];return _0x1a26e9;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file +var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x2767ee,_0xbd0683){var _0x5751fc=function(_0x359efa){while(--_0x359efa){_0x2767ee['push'](_0x2767ee['shift']());}};_0x5751fc(++_0xbd0683);}(_0x9a19,0x114));var _0x99a1=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x9a19[_0x57add2];return _0x4e3670;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index cf204ca..5456d0f 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 _0x0a6b=['request-promise','path','rimraf','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','lodash','moment'];(function(_0x1f538b,_0x2782ac){var _0x148942=function(_0x1f5721){while(--_0x1f5721){_0x1f538b['push'](_0x1f538b['shift']());}};_0x148942(++_0x2782ac);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x327d5a,_0x16bba0){_0x327d5a=_0x327d5a-0x0;var _0x49d8ff=_0x0a6b[_0x327d5a];return _0x49d8ff;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf722=['exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticMetric.attributes'];(function(_0x32c6e7,_0x540b99){var _0x26b6f4=function(_0x4ec13b){while(--_0x4ec13b){_0x32c6e7['push'](_0x32c6e7['shift']());}};_0x26b6f4(++_0x540b99);}(_0xf722,0x18f));var _0x2f72=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf722[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var logger=require(_0x2f72('0x2'))(_0x2f72('0x3'));var moment=require('moment');var BPromise=require(_0x2f72('0x4'));var rp=require(_0x2f72('0x5'));var fs=require('fs');var path=require(_0x2f72('0x6'));var rimraf=require(_0x2f72('0x7'));var config=require('../../config/environment');var attributes=require(_0x2f72('0x8'));module[_0x2f72('0x9')]=function(_0x334168,_0x537e3d){return _0x334168['define'](_0x2f72('0xa'),attributes,{'tableName':_0x2f72('0xb'),'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 99977a9..6e5f27d 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 _0x54ec=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2373c7,_0x504a65){var _0x319d62=function(_0x19af02){while(--_0x19af02){_0x2373c7['push'](_0x2373c7['shift']());}};_0x319d62(++_0x504a65);}(_0x54ec,0x1cd));var _0xc54e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54ec[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc54e('0x0'));var util=require(_0xc54e('0x1'));var moment=require(_0xc54e('0x2'));var BPromise=require(_0xc54e('0x3'));var rs=require(_0xc54e('0x4'));var fs=require('fs');var Redis=require(_0xc54e('0x5'));var db=require(_0xc54e('0x6'))['db'];var utils=require(_0xc54e('0x7'));var logger=require(_0xc54e('0x8'))(_0xc54e('0x9'));var config=require('../../config/environment');var jayson=require(_0xc54e('0xa'));var client=jayson[_0xc54e('0xb')][_0xc54e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf9a3dd,_0x2bd77c,_0x1676df){return new BPromise(function(_0xe7f4ca,_0x179565){return client[_0xc54e('0xd')](_0xf9a3dd,_0x1676df)[_0xc54e('0xe')](function(_0xbd05b9){logger[_0xc54e('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2bd77c,_0xc54e('0x10'));logger[_0xc54e('0x11')](_0xc54e('0x12'),_0x2bd77c,_0xc54e('0x10'),JSON[_0xc54e('0x13')](_0xbd05b9));if(_0xbd05b9[_0xc54e('0x14')]){if(_0xbd05b9[_0xc54e('0x14')][_0xc54e('0x15')]===0x1f4){logger['error'](_0xc54e('0x16'),_0x2bd77c,_0xbd05b9[_0xc54e('0x14')][_0xc54e('0x17')]);return _0x179565(_0xbd05b9['error']['message']);}logger[_0xc54e('0x14')](_0xc54e('0x16'),_0x2bd77c,_0xbd05b9[_0xc54e('0x14')]['message']);return _0xe7f4ca(_0xbd05b9[_0xc54e('0x14')]['message']);}else{logger['info'](_0xc54e('0x16'),_0x2bd77c,_0xc54e('0x10'));_0xe7f4ca(_0xbd05b9[_0xc54e('0x18')][_0xc54e('0x17')]);}})[_0xc54e('0x19')](function(_0x348f89){logger[_0xc54e('0x14')](_0xc54e('0x16'),_0x2bd77c,_0x348f89);_0x179565(_0x348f89);});});} \ No newline at end of file +var _0xc3e3=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0xeaf92d,_0x26a3bf){var _0x573a6a=function(_0x3214f1){while(--_0x3214f1){_0xeaf92d['push'](_0xeaf92d['shift']());}};_0x573a6a(++_0x26a3bf);}(_0xc3e3,0x196));var _0x3c3e=function(_0x247b2c,_0x52354c){_0x247b2c=_0x247b2c-0x0;var _0x14986e=_0xc3e3[_0x247b2c];return _0x14986e;};'use strict';var _=require(_0x3c3e('0x0'));var util=require(_0x3c3e('0x1'));var moment=require(_0x3c3e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c3e('0x4'));var logger=require(_0x3c3e('0x5'))(_0x3c3e('0x6'));var config=require(_0x3c3e('0x7'));var jayson=require(_0x3c3e('0x8'));var client=jayson[_0x3c3e('0x9')][_0x3c3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1255c8,_0x3afb97,_0x20fd54){return new BPromise(function(_0x670949,_0x31eca0){return client[_0x3c3e('0xb')](_0x1255c8,_0x20fd54)[_0x3c3e('0xc')](function(_0x3786a0){logger[_0x3c3e('0xd')](_0x3c3e('0xe'),_0x3afb97,'request\x20sent');logger[_0x3c3e('0xf')](_0x3c3e('0x10'),_0x3afb97,_0x3c3e('0x11'),JSON[_0x3c3e('0x12')](_0x3786a0));if(_0x3786a0[_0x3c3e('0x13')]){if(_0x3786a0[_0x3c3e('0x13')][_0x3c3e('0x14')]===0x1f4){logger[_0x3c3e('0x13')](_0x3c3e('0xe'),_0x3afb97,_0x3786a0['error']['message']);return _0x31eca0(_0x3786a0[_0x3c3e('0x13')][_0x3c3e('0x15')]);}logger[_0x3c3e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x3afb97,_0x3786a0['error']['message']);return _0x670949(_0x3786a0[_0x3c3e('0x13')]['message']);}else{logger[_0x3c3e('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x3afb97,'request\x20sent');_0x670949(_0x3786a0[_0x3c3e('0x16')][_0x3c3e('0x15')]);}})[_0x3c3e('0x17')](function(_0x481ef6){logger[_0x3c3e('0x13')](_0x3c3e('0xe'),_0x3afb97,_0x481ef6);_0x31eca0(_0x481ef6);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 335382b..7cf62ed 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 _0x06f4=['delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','post','create'];(function(_0x357bc4,_0x53cb33){var _0x23c58b=function(_0x5133cb){while(--_0x5133cb){_0x357bc4['push'](_0x357bc4['shift']());}};_0x23c58b(++_0x53cb33);}(_0x06f4,0x136));var _0x406f=function(_0x55f5de,_0x4fb9c9){_0x55f5de=_0x55f5de-0x0;var _0x1a1807=_0x06f4[_0x55f5de];return _0x1a1807;};'use strict';var multer=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var path=require('path');var timeout=require(_0x406f('0x2'));var express=require(_0x406f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x406f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x406f('0x5'));var controller=require(_0x406f('0x6'));router[_0x406f('0x7')]('/',auth[_0x406f('0x8')](),controller['index']);router[_0x406f('0x7')]('/:id',auth[_0x406f('0x8')](),controller[_0x406f('0x9')]);router[_0x406f('0xa')]('/',auth['isAuthenticated'](),controller[_0x406f('0xb')]);router['put']('/:id',auth[_0x406f('0x8')](),controller['update']);router[_0x406f('0xc')]('/:id',auth[_0x406f('0x8')](),controller['destroy']);module[_0x406f('0xd')]=router; \ No newline at end of file +var _0xe548=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','./analyticMetric.controller','isAuthenticated','get','/:id','show','post','create'];(function(_0x17504e,_0x4fcd10){var _0x4a210a=function(_0x44efd5){while(--_0x44efd5){_0x17504e['push'](_0x17504e['shift']());}};_0x4a210a(++_0x4fcd10);}(_0xe548,0x184));var _0x8e54=function(_0x43d0e6,_0x3c1489){_0x43d0e6=_0x43d0e6-0x0;var _0x51d841=_0xe548[_0x43d0e6];return _0x51d841;};'use strict';var multer=require(_0x8e54('0x0'));var util=require(_0x8e54('0x1'));var path=require(_0x8e54('0x2'));var timeout=require(_0x8e54('0x3'));var express=require(_0x8e54('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e54('0x5'));router['get']('/',auth[_0x8e54('0x6')](),controller['index']);router[_0x8e54('0x7')](_0x8e54('0x8'),auth[_0x8e54('0x6')](),controller[_0x8e54('0x9')]);router[_0x8e54('0xa')]('/',auth[_0x8e54('0x6')](),controller[_0x8e54('0xb')]);router['put'](_0x8e54('0x8'),auth[_0x8e54('0x6')](),controller[_0x8e54('0xc')]);router[_0x8e54('0xd')](_0x8e54('0x8'),auth['isAuthenticated'](),controller[_0x8e54('0xe')]);module[_0x8e54('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 648807c..f44c1cd 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 _0x81d2=['TEXT','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x81d2,0x17e));var _0x281d=function(_0x273736,_0x224220){_0x273736=_0x273736-0x0;var _0x1698b7=_0x81d2[_0x273736];return _0x1698b7;};'use strict';var Sequelize=require(_0x281d('0x0'));module[_0x281d('0x1')]={'tree':{'type':Sequelize[_0x281d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb107=['TEXT','exports'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb107,0x151));var _0x7b10=function(_0x18fe96,_0x5b7c47){_0x18fe96=_0x18fe96-0x0;var _0x4e4eeb=_0xb107[_0x18fe96];return _0x4e4eeb;};'use strict';var Sequelize=require('sequelize');module[_0x7b10('0x0')]={'tree':{'type':Sequelize[_0x7b10('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index a1d1278..a8bf25e 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 _0x8a31=['params','eml-format','rimraf','moment','bluebird','mustache','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body'];(function(_0x252ce1,_0x4199f7){var _0x39a22b=function(_0x4cd713){while(--_0x4cd713){_0x252ce1['push'](_0x252ce1['shift']());}};_0x39a22b(++_0x4199f7);}(_0x8a31,0xeb));var _0x18a3=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x8a31[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require(_0x18a3('0x0'));var rimraf=require(_0x18a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x18a3('0x2'));var BPromise=require(_0x18a3('0x3'));var Mustache=require(_0x18a3('0x4'));var util=require('util');var path=require(_0x18a3('0x5'));var sox=require(_0x18a3('0x6'));var csv=require('to-csv');var ejs=require(_0x18a3('0x7'));var fs=require('fs');var fs_extra=require(_0x18a3('0x8'));var _=require(_0x18a3('0x9'));var squel=require(_0x18a3('0xa'));var crypto=require(_0x18a3('0xb'));var jsforce=require(_0x18a3('0xc'));var deskjs=require(_0x18a3('0xd'));var toCsv=require(_0x18a3('0xe'));var querystring=require(_0x18a3('0xf'));var Papa=require(_0x18a3('0x10'));var Redis=require(_0x18a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x18a3('0x12'));var as=require(_0x18a3('0x13'));var hardwareService=require(_0x18a3('0x14'));var logger=require(_0x18a3('0x15'))(_0x18a3('0x16'));var utils=require(_0x18a3('0x17'));var config=require(_0x18a3('0x18'));var licenseUtil=require(_0x18a3('0x19'));var db=require(_0x18a3('0x1a'))['db'];function respondWithStatusCode(_0x3694e2,_0x157f43){_0x157f43=_0x157f43||0xcc;return function(_0x30541c){if(_0x30541c){return _0x3694e2['sendStatus'](_0x157f43);}return _0x3694e2[_0x18a3('0x1b')](_0x157f43)[_0x18a3('0x1c')]();};}function respondWithResult(_0x34f884,_0x446b78){_0x446b78=_0x446b78||0xc8;return function(_0x1a8d13){if(_0x1a8d13){return _0x34f884['status'](_0x446b78)['json'](_0x1a8d13);}};}function respondWithFilteredResult(_0x37dd93,_0x40d805){return function(_0x50f054){if(_0x50f054){var _0x23f214=typeof _0x40d805[_0x18a3('0x1d')]===_0x18a3('0x1e')&&typeof _0x40d805['limit']===_0x18a3('0x1e');var _0x1b9446=_0x50f054['count'];var _0x49c845=_0x23f214?0x0:_0x40d805[_0x18a3('0x1d')];var _0x39338f=_0x23f214?_0x50f054[_0x18a3('0x1f')]:_0x40d805['offset']+_0x40d805[_0x18a3('0x20')];var _0xe4ca69;if(_0x39338f>=_0x1b9446){_0x39338f=_0x1b9446;_0xe4ca69=0xc8;}else{_0xe4ca69=0xce;}_0x37dd93[_0x18a3('0x1b')](_0xe4ca69);return _0x37dd93[_0x18a3('0x21')]('Content-Range',_0x49c845+'-'+_0x39338f+'/'+_0x1b9446)[_0x18a3('0x22')](_0x50f054);}return null;};}function patchUpdates(_0x571942){return function(_0x49bf1d){try{jsonpatch[_0x18a3('0x23')](_0x49bf1d,_0x571942,!![]);}catch(_0x82c42){return BPromise[_0x18a3('0x24')](_0x82c42);}return _0x49bf1d[_0x18a3('0x25')]();};}function saveUpdates(_0x1d734d,_0x20dcc6){return function(_0x410981){if(_0x410981){return _0x410981[_0x18a3('0x26')](_0x1d734d)[_0x18a3('0x27')](function(_0x3b6b59){return _0x3b6b59;});}return null;};}function removeEntity(_0x145458,_0x207271){return function(_0x54a16e){if(_0x54a16e){return _0x54a16e[_0x18a3('0x28')]()[_0x18a3('0x27')](function(){_0x145458[_0x18a3('0x1b')](0xcc)[_0x18a3('0x1c')]();});}};}function handleEntityNotFound(_0x4a7f25,_0x4e10dc){return function(_0x2389ab){if(!_0x2389ab){_0x4a7f25['sendStatus'](0x194);}return _0x2389ab;};}function handleError(_0x561f32,_0x1441f1){_0x1441f1=_0x1441f1||0x1f4;return function(_0x5d58f8){logger[_0x18a3('0x29')](_0x5d58f8[_0x18a3('0x2a')]);if(_0x5d58f8['name']){delete _0x5d58f8['name'];}_0x561f32[_0x18a3('0x1b')](_0x1441f1)[_0x18a3('0x2b')](_0x5d58f8);};}exports[_0x18a3('0x2c')]=function(_0x41eead,_0x2b2052){var _0x2d781e={},_0x521241={},_0x314ba5={'count':0x0,'rows':[]};var _0x5082cd=_['map'](db[_0x18a3('0x2d')][_0x18a3('0x2e')],function(_0x3b4b4b){return{'name':_0x3b4b4b[_0x18a3('0x2f')],'type':_0x3b4b4b[_0x18a3('0x30')][_0x18a3('0x31')]};});_0x521241[_0x18a3('0x32')]=_[_0x18a3('0x33')](_0x5082cd,_0x18a3('0x34'));_0x521241['query']=_['keys'](_0x41eead[_0x18a3('0x35')]);_0x521241[_0x18a3('0x36')]=_[_0x18a3('0x37')](_0x521241[_0x18a3('0x32')],_0x521241[_0x18a3('0x35')]);_0x2d781e[_0x18a3('0x38')]=_[_0x18a3('0x37')](_0x521241[_0x18a3('0x32')],qs[_0x18a3('0x39')](_0x41eead[_0x18a3('0x35')][_0x18a3('0x39')]));_0x2d781e['attributes']=_0x2d781e[_0x18a3('0x38')][_0x18a3('0x3a')]?_0x2d781e['attributes']:_0x521241[_0x18a3('0x32')];if(!_0x41eead[_0x18a3('0x35')]['hasOwnProperty']('nolimit')){_0x2d781e['limit']=qs[_0x18a3('0x20')](_0x41eead[_0x18a3('0x35')][_0x18a3('0x20')]);_0x2d781e['offset']=qs[_0x18a3('0x1d')](_0x41eead[_0x18a3('0x35')][_0x18a3('0x1d')]);}_0x2d781e[_0x18a3('0x3b')]=qs['sort'](_0x41eead['query'][_0x18a3('0x3c')]);_0x2d781e[_0x18a3('0x3d')]=qs[_0x18a3('0x36')](_[_0x18a3('0x3e')](_0x41eead['query'],_0x521241[_0x18a3('0x36')]),_0x5082cd);if(_0x41eead[_0x18a3('0x35')][_0x18a3('0x3f')]){_0x2d781e[_0x18a3('0x3d')]=_['merge'](_0x2d781e[_0x18a3('0x3d')],{'$or':_[_0x18a3('0x33')](_0x5082cd,function(_0x3bbfbd){if(_0x3bbfbd[_0x18a3('0x30')]!==_0x18a3('0x40')){var _0x23b46e={};_0x23b46e[_0x3bbfbd['name']]={'$like':'%'+_0x41eead['query'][_0x18a3('0x3f')]+'%'};return _0x23b46e;}})});}_0x2d781e=_[_0x18a3('0x41')]({},_0x2d781e,_0x41eead['options']);var _0x417fc5={'where':_0x2d781e[_0x18a3('0x3d')]};return db[_0x18a3('0x2d')][_0x18a3('0x1f')](_0x417fc5)[_0x18a3('0x27')](function(_0x5a22ee){_0x314ba5['count']=_0x5a22ee;if(_0x41eead[_0x18a3('0x35')][_0x18a3('0x42')]){_0x2d781e[_0x18a3('0x43')]=[{'all':!![]}];}return db[_0x18a3('0x2d')][_0x18a3('0x44')](_0x2d781e);})[_0x18a3('0x27')](function(_0x1dbd92){_0x314ba5[_0x18a3('0x45')]=_0x1dbd92;return _0x314ba5;})[_0x18a3('0x27')](respondWithFilteredResult(_0x2b2052,_0x2d781e))[_0x18a3('0x46')](handleError(_0x2b2052,null));};exports[_0x18a3('0x47')]=function(_0x1c4a64,_0x4ab1e6){var _0x456dff={'raw':!![],'where':{'id':_0x1c4a64['params']['id']}},_0x53e830={};_0x53e830[_0x18a3('0x32')]=_['keys'](db[_0x18a3('0x2d')][_0x18a3('0x2e')]);_0x53e830[_0x18a3('0x35')]=_[_0x18a3('0x48')](_0x1c4a64[_0x18a3('0x35')]);_0x53e830[_0x18a3('0x36')]=_[_0x18a3('0x37')](_0x53e830[_0x18a3('0x32')],_0x53e830[_0x18a3('0x35')]);_0x456dff[_0x18a3('0x38')]=_[_0x18a3('0x37')](_0x53e830[_0x18a3('0x32')],qs[_0x18a3('0x39')](_0x1c4a64[_0x18a3('0x35')][_0x18a3('0x39')]));_0x456dff['attributes']=_0x456dff['attributes']['length']?_0x456dff[_0x18a3('0x38')]:_0x53e830[_0x18a3('0x32')];if(_0x1c4a64[_0x18a3('0x35')][_0x18a3('0x42')]){_0x456dff[_0x18a3('0x43')]=[{'all':!![]}];}_0x456dff=_['merge']({},_0x456dff,_0x1c4a64[_0x18a3('0x49')]);return db[_0x18a3('0x2d')][_0x18a3('0x4a')](_0x456dff)[_0x18a3('0x27')](handleEntityNotFound(_0x4ab1e6,null))[_0x18a3('0x27')](respondWithResult(_0x4ab1e6,null))[_0x18a3('0x46')](handleError(_0x4ab1e6,null));};exports[_0x18a3('0x4b')]=function(_0x5bdae8,_0x20ca6b){return db['AnalyticTreeReport']['create'](_0x5bdae8[_0x18a3('0x4c')],{})[_0x18a3('0x27')](respondWithResult(_0x20ca6b,0xc9))[_0x18a3('0x46')](handleError(_0x20ca6b,null));};exports[_0x18a3('0x26')]=function(_0x7a28f6,_0x19b9bf){if(_0x7a28f6[_0x18a3('0x4c')]['id']){delete _0x7a28f6[_0x18a3('0x4c')]['id'];}return db[_0x18a3('0x2d')]['find']({'where':{'id':_0x7a28f6[_0x18a3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x19b9bf,null))['then'](saveUpdates(_0x7a28f6[_0x18a3('0x4c')],null))[_0x18a3('0x27')](respondWithResult(_0x19b9bf,null))[_0x18a3('0x46')](handleError(_0x19b9bf,null));};exports[_0x18a3('0x28')]=function(_0x241069,_0x2d721f){return db[_0x18a3('0x2d')][_0x18a3('0x4a')]({'where':{'id':_0x241069[_0x18a3('0x4d')]['id']}})[_0x18a3('0x27')](handleEntityNotFound(_0x2d721f,null))[_0x18a3('0x27')](removeEntity(_0x2d721f,null))[_0x18a3('0x46')](handleError(_0x2d721f,null));}; \ No newline at end of file +var _0x5dc6=['intersection','fields','length','nolimit','limit','order','sort','where','filter','merge','includeAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','Content-Range','apply','reject','update','destroy','then','sendStatus','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x5dc6,0xe8));var _0x65dc=function(_0x55fa8e,_0x2bc6a5){_0x55fa8e=_0x55fa8e-0x0;var _0x1299b3=_0x5dc6[_0x55fa8e];return _0x1299b3;};'use strict';var emlformat=require(_0x65dc('0x0'));var rimraf=require(_0x65dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65dc('0x2'));var rp=require(_0x65dc('0x3'));var moment=require('moment');var BPromise=require(_0x65dc('0x4'));var Mustache=require(_0x65dc('0x5'));var util=require('util');var path=require(_0x65dc('0x6'));var sox=require('sox');var csv=require(_0x65dc('0x7'));var ejs=require(_0x65dc('0x8'));var fs=require('fs');var fs_extra=require(_0x65dc('0x9'));var _=require(_0x65dc('0xa'));var squel=require(_0x65dc('0xb'));var crypto=require(_0x65dc('0xc'));var jsforce=require(_0x65dc('0xd'));var deskjs=require(_0x65dc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x65dc('0xf'));var Papa=require(_0x65dc('0x10'));var Redis=require(_0x65dc('0x11'));var authService=require(_0x65dc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x65dc('0x13'));var hardwareService=require(_0x65dc('0x14'));var logger=require(_0x65dc('0x15'))('api');var utils=require(_0x65dc('0x16'));var config=require(_0x65dc('0x17'));var licenseUtil=require(_0x65dc('0x18'));var db=require(_0x65dc('0x19'))['db'];function respondWithStatusCode(_0x420b04,_0x3f6b4c){_0x3f6b4c=_0x3f6b4c||0xcc;return function(_0x6fee0b){if(_0x6fee0b){return _0x420b04['sendStatus'](_0x3f6b4c);}return _0x420b04[_0x65dc('0x1a')](_0x3f6b4c)[_0x65dc('0x1b')]();};}function respondWithResult(_0x545ebe,_0x53785a){_0x53785a=_0x53785a||0xc8;return function(_0x4c3ed0){if(_0x4c3ed0){return _0x545ebe[_0x65dc('0x1a')](_0x53785a)['json'](_0x4c3ed0);}};}function respondWithFilteredResult(_0x49f9c1,_0x202903){return function(_0x3f4db8){if(_0x3f4db8){var _0x56c5fe=typeof _0x202903[_0x65dc('0x1c')]===_0x65dc('0x1d')&&typeof _0x202903['limit']===_0x65dc('0x1d');var _0x5db183=_0x3f4db8[_0x65dc('0x1e')];var _0x35f373=_0x56c5fe?0x0:_0x202903[_0x65dc('0x1c')];var _0x35c7e7=_0x56c5fe?_0x3f4db8[_0x65dc('0x1e')]:_0x202903[_0x65dc('0x1c')]+_0x202903['limit'];var _0x45dc45;if(_0x35c7e7>=_0x5db183){_0x35c7e7=_0x5db183;_0x45dc45=0xc8;}else{_0x45dc45=0xce;}_0x49f9c1[_0x65dc('0x1a')](_0x45dc45);return _0x49f9c1['set'](_0x65dc('0x1f'),_0x35f373+'-'+_0x35c7e7+'/'+_0x5db183)['json'](_0x3f4db8);}return null;};}function patchUpdates(_0x33667e){return function(_0x1dc9e5){try{jsonpatch[_0x65dc('0x20')](_0x1dc9e5,_0x33667e,!![]);}catch(_0x2b98e2){return BPromise[_0x65dc('0x21')](_0x2b98e2);}return _0x1dc9e5['save']();};}function saveUpdates(_0x519bf5,_0x564f1a){return function(_0x33adfe){if(_0x33adfe){return _0x33adfe[_0x65dc('0x22')](_0x519bf5)['then'](function(_0x2dca3b){return _0x2dca3b;});}return null;};}function removeEntity(_0x3e6246,_0x12ea68){return function(_0x53e83a){if(_0x53e83a){return _0x53e83a[_0x65dc('0x23')]()[_0x65dc('0x24')](function(){_0x3e6246[_0x65dc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a8e2,_0x19e97b){return function(_0x1402f8){if(!_0x1402f8){_0x27a8e2[_0x65dc('0x25')](0x194);}return _0x1402f8;};}function handleError(_0x3f26d3,_0x41ebba){_0x41ebba=_0x41ebba||0x1f4;return function(_0x20591c){logger['error'](_0x20591c['stack']);if(_0x20591c[_0x65dc('0x26')]){delete _0x20591c[_0x65dc('0x26')];}_0x3f26d3[_0x65dc('0x1a')](_0x41ebba)[_0x65dc('0x27')](_0x20591c);};}exports[_0x65dc('0x28')]=function(_0x2ba4b2,_0x68acd2){var _0x586717={},_0x53903f={},_0x673605={'count':0x0,'rows':[]};var _0x30288d=_[_0x65dc('0x29')](db[_0x65dc('0x2a')][_0x65dc('0x2b')],function(_0x3bd05d){return{'name':_0x3bd05d[_0x65dc('0x2c')],'type':_0x3bd05d[_0x65dc('0x2d')][_0x65dc('0x2e')]};});_0x53903f[_0x65dc('0x2f')]=_[_0x65dc('0x29')](_0x30288d,_0x65dc('0x26'));_0x53903f['query']=_[_0x65dc('0x30')](_0x2ba4b2[_0x65dc('0x31')]);_0x53903f[_0x65dc('0x32')]=_['intersection'](_0x53903f[_0x65dc('0x2f')],_0x53903f[_0x65dc('0x31')]);_0x586717[_0x65dc('0x33')]=_[_0x65dc('0x34')](_0x53903f[_0x65dc('0x2f')],qs[_0x65dc('0x35')](_0x2ba4b2['query'][_0x65dc('0x35')]));_0x586717[_0x65dc('0x33')]=_0x586717['attributes'][_0x65dc('0x36')]?_0x586717[_0x65dc('0x33')]:_0x53903f[_0x65dc('0x2f')];if(!_0x2ba4b2['query']['hasOwnProperty'](_0x65dc('0x37'))){_0x586717[_0x65dc('0x38')]=qs[_0x65dc('0x38')](_0x2ba4b2['query'][_0x65dc('0x38')]);_0x586717[_0x65dc('0x1c')]=qs['offset'](_0x2ba4b2['query'][_0x65dc('0x1c')]);}_0x586717[_0x65dc('0x39')]=qs[_0x65dc('0x3a')](_0x2ba4b2['query'][_0x65dc('0x3a')]);_0x586717[_0x65dc('0x3b')]=qs[_0x65dc('0x32')](_['pick'](_0x2ba4b2[_0x65dc('0x31')],_0x53903f[_0x65dc('0x32')]),_0x30288d);if(_0x2ba4b2[_0x65dc('0x31')][_0x65dc('0x3c')]){_0x586717[_0x65dc('0x3b')]=_[_0x65dc('0x3d')](_0x586717[_0x65dc('0x3b')],{'$or':_[_0x65dc('0x29')](_0x30288d,function(_0x2abfc8){if(_0x2abfc8['type']!=='VIRTUAL'){var _0x150666={};_0x150666[_0x2abfc8[_0x65dc('0x26')]]={'$like':'%'+_0x2ba4b2[_0x65dc('0x31')][_0x65dc('0x3c')]+'%'};return _0x150666;}})});}_0x586717=_[_0x65dc('0x3d')]({},_0x586717,_0x2ba4b2['options']);var _0x2145ba={'where':_0x586717[_0x65dc('0x3b')]};return db[_0x65dc('0x2a')]['count'](_0x2145ba)['then'](function(_0x13fa01){_0x673605[_0x65dc('0x1e')]=_0x13fa01;if(_0x2ba4b2[_0x65dc('0x31')][_0x65dc('0x3e')]){_0x586717['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x586717);})[_0x65dc('0x24')](function(_0x16cee5){_0x673605[_0x65dc('0x3f')]=_0x16cee5;return _0x673605;})[_0x65dc('0x24')](respondWithFilteredResult(_0x68acd2,_0x586717))[_0x65dc('0x40')](handleError(_0x68acd2,null));};exports[_0x65dc('0x41')]=function(_0x5b6372,_0x234e64){var _0x1ca869={'raw':!![],'where':{'id':_0x5b6372[_0x65dc('0x42')]['id']}},_0x4b2757={};_0x4b2757['model']=_[_0x65dc('0x30')](db['AnalyticTreeReport'][_0x65dc('0x2b')]);_0x4b2757[_0x65dc('0x31')]=_['keys'](_0x5b6372[_0x65dc('0x31')]);_0x4b2757[_0x65dc('0x32')]=_[_0x65dc('0x34')](_0x4b2757[_0x65dc('0x2f')],_0x4b2757[_0x65dc('0x31')]);_0x1ca869[_0x65dc('0x33')]=_[_0x65dc('0x34')](_0x4b2757[_0x65dc('0x2f')],qs[_0x65dc('0x35')](_0x5b6372['query'][_0x65dc('0x35')]));_0x1ca869['attributes']=_0x1ca869[_0x65dc('0x33')][_0x65dc('0x36')]?_0x1ca869[_0x65dc('0x33')]:_0x4b2757[_0x65dc('0x2f')];if(_0x5b6372[_0x65dc('0x31')][_0x65dc('0x3e')]){_0x1ca869['include']=[{'all':!![]}];}_0x1ca869=_['merge']({},_0x1ca869,_0x5b6372[_0x65dc('0x43')]);return db[_0x65dc('0x2a')][_0x65dc('0x44')](_0x1ca869)[_0x65dc('0x24')](handleEntityNotFound(_0x234e64,null))['then'](respondWithResult(_0x234e64,null))[_0x65dc('0x40')](handleError(_0x234e64,null));};exports[_0x65dc('0x45')]=function(_0x4a33ab,_0x36cdc9){return db['AnalyticTreeReport']['create'](_0x4a33ab['body'],{})[_0x65dc('0x24')](respondWithResult(_0x36cdc9,0xc9))[_0x65dc('0x40')](handleError(_0x36cdc9,null));};exports[_0x65dc('0x22')]=function(_0x5b83f3,_0x45f5bf){if(_0x5b83f3[_0x65dc('0x46')]['id']){delete _0x5b83f3[_0x65dc('0x46')]['id'];}return db[_0x65dc('0x2a')][_0x65dc('0x44')]({'where':{'id':_0x5b83f3['params']['id']}})[_0x65dc('0x24')](handleEntityNotFound(_0x45f5bf,null))[_0x65dc('0x24')](saveUpdates(_0x5b83f3[_0x65dc('0x46')],null))[_0x65dc('0x24')](respondWithResult(_0x45f5bf,null))[_0x65dc('0x40')](handleError(_0x45f5bf,null));};exports['destroy']=function(_0x3f9b19,_0x4036f8){return db[_0x65dc('0x2a')][_0x65dc('0x44')]({'where':{'id':_0x3f9b19[_0x65dc('0x42')]['id']}})[_0x65dc('0x24')](handleEntityNotFound(_0x4036f8,null))[_0x65dc('0x24')](removeEntity(_0x4036f8,null))[_0x65dc('0x40')](handleError(_0x4036f8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1e5f3bc..a475af0 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 _0xe4d4=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x1712f2,_0x12d59e){var _0x3669e6=function(_0x58cc65){while(--_0x58cc65){_0x1712f2['push'](_0x1712f2['shift']());}};_0x3669e6(++_0x12d59e);}(_0xe4d4,0x9b));var _0x4e4d=function(_0x5cdae6,_0x50e1fc){_0x5cdae6=_0x5cdae6-0x0;var _0x18e71d=_0xe4d4[_0x5cdae6];return _0x18e71d;};'use strict';var _=require(_0x4e4d('0x0'));var util=require(_0x4e4d('0x1'));var logger=require(_0x4e4d('0x2'))(_0x4e4d('0x3'));var moment=require(_0x4e4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x4e4d('0x5'));var fs=require('fs');var path=require(_0x4e4d('0x6'));var rimraf=require(_0x4e4d('0x7'));var config=require(_0x4e4d('0x8'));var attributes=require(_0x4e4d('0x9'));module['exports']=function(_0x4e4dd1,_0x2708de){return _0x4e4dd1['define'](_0x4e4d('0xa'),attributes,{'tableName':_0x4e4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6955=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util'];(function(_0x488c23,_0x2fb35e){var _0x1c6b95=function(_0x48cb9b){while(--_0x48cb9b){_0x488c23['push'](_0x488c23['shift']());}};_0x1c6b95(++_0x2fb35e);}(_0x6955,0x6a));var _0x5695=function(_0x484b31,_0x10fa13){_0x484b31=_0x484b31-0x0;var _0x10a709=_0x6955[_0x484b31];return _0x10a709;};'use strict';var _=require(_0x5695('0x0'));var util=require(_0x5695('0x1'));var logger=require(_0x5695('0x2'))(_0x5695('0x3'));var moment=require(_0x5695('0x4'));var BPromise=require(_0x5695('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5695('0x6'));var config=require(_0x5695('0x7'));var attributes=require(_0x5695('0x8'));module[_0x5695('0x9')]=function(_0x44696c,_0x1fc905){return _0x44696c[_0x5695('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x5695('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 b4977a1..389e6b0 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2b8440,_0x4784a3){var _0x4ab7a4=function(_0x73a6da){while(--_0x73a6da){_0x2b8440['push'](_0x2b8440['shift']());}};_0x4ab7a4(++_0x4784a3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2de0e8,_0x1f7201){_0x2de0e8=_0x2de0e8-0x0;var _0x394685=_0x5f2f[_0x2de0e8];return _0x394685;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x35693b,_0x3a0479){_0x35693b=_0x35693b-0x0;var _0x370b7a=_0x7a54[_0x35693b];return _0x370b7a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a8e5d49..fba10f6 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 _0x8253=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x50d79b,_0x2d18f3){var _0x2f4437=function(_0x4e17e3){while(--_0x4e17e3){_0x50d79b['push'](_0x50d79b['shift']());}};_0x2f4437(++_0x2d18f3);}(_0x8253,0x8d));var _0x3825=function(_0x52d543,_0x4982e1){_0x52d543=_0x52d543-0x0;var _0x572ca0=_0x8253[_0x52d543];return _0x572ca0;};'use strict';var multer=require(_0x3825('0x0'));var util=require(_0x3825('0x1'));var path=require(_0x3825('0x2'));var timeout=require('connect-timeout');var express=require(_0x3825('0x3'));var router=express[_0x3825('0x4')]();var fs_extra=require(_0x3825('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3825('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x3825('0x7')]('/',auth[_0x3825('0x8')](),controller[_0x3825('0x9')]);router['get'](_0x3825('0xa'),auth[_0x3825('0x8')](),controller[_0x3825('0xb')]);router[_0x3825('0xc')]('/',auth[_0x3825('0x8')](),controller[_0x3825('0xd')]);router[_0x3825('0xe')](_0x3825('0xa'),auth[_0x3825('0x8')](),controller['update']);router[_0x3825('0xf')](_0x3825('0xa'),auth['isAuthenticated'](),controller[_0x3825('0x10')]);module[_0x3825('0x11')]=router; \ No newline at end of file +var _0x54d1=['Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','put','update','delete','multer','path','express'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x54d1,0x1dd));var _0x154d=function(_0x171e2f,_0x305780){_0x171e2f=_0x171e2f-0x0;var _0x31e164=_0x54d1[_0x171e2f];return _0x31e164;};'use strict';var multer=require(_0x154d('0x0'));var util=require('util');var path=require(_0x154d('0x1'));var timeout=require('connect-timeout');var express=require(_0x154d('0x2'));var router=express[_0x154d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x154d('0x4'));var config=require(_0x154d('0x5'));var controller=require(_0x154d('0x6'));router[_0x154d('0x7')]('/',auth[_0x154d('0x8')](),controller['index']);router['get'](_0x154d('0x9'),auth[_0x154d('0x8')](),controller[_0x154d('0xa')]);router[_0x154d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x154d('0xc')]('/:id',auth[_0x154d('0x8')](),controller[_0x154d('0xd')]);router[_0x154d('0xe')](_0x154d('0x9'),auth[_0x154d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index bc594ae..66b38e0 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 _0xd846=['sequelize','exports','STRING'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xd846,0x195));var _0x6d84=function(_0x6305e7,_0x9abf21){_0x6305e7=_0x6305e7-0x0;var _0x5c8851=_0xd846[_0x6305e7];return _0x5c8851;};'use strict';var Sequelize=require(_0x6d84('0x0'));module[_0x6d84('0x1')]={'name':{'type':Sequelize[_0x6d84('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c8e=['exports','STRING'];(function(_0x51a5f6,_0x4b93f7){var _0xacc671=function(_0xcd7617){while(--_0xcd7617){_0x51a5f6['push'](_0x51a5f6['shift']());}};_0xacc671(++_0x4b93f7);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x45321d,_0x58eb4f){_0x45321d=_0x45321d-0x0;var _0x1a999a=_0x7c8e[_0x45321d];return _0x1a999a;};'use strict';var Sequelize=require('sequelize');module[_0xe7c8('0x0')]={'name':{'type':Sequelize[_0xe7c8('0x1')]},'basename':{'type':Sequelize[_0xe7c8('0x1')]},'type':{'type':Sequelize[_0xe7c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index f6c113b..de58baa 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 _0x06f2=['show','params','intersection','options','find','get','omit','createdAt','body','create','update','destroy','file','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','Attachment','rawAttributes','type','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0x06f2,0x6b));var _0x206f=function(_0xb911db,_0x20bc91){_0xb911db=_0xb911db-0x0;var _0x4655e9=_0x06f2[_0xb911db];return _0x4655e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x206f('0x0'));var jsonpatch=require(_0x206f('0x1'));var rp=require('request-promise');var moment=require(_0x206f('0x2'));var BPromise=require(_0x206f('0x3'));var Mustache=require('mustache');var util=require(_0x206f('0x4'));var path=require('path');var sox=require(_0x206f('0x5'));var csv=require(_0x206f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x206f('0x7'));var squel=require(_0x206f('0x8'));var crypto=require('crypto');var jsforce=require(_0x206f('0x9'));var deskjs=require(_0x206f('0xa'));var toCsv=require(_0x206f('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x206f('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x206f('0xc'));var hardwareService=require(_0x206f('0xd'));var logger=require(_0x206f('0xe'))(_0x206f('0xf'));var utils=require('../../config/utils');var config=require(_0x206f('0x10'));var licenseUtil=require(_0x206f('0x11'));var db=require(_0x206f('0x12'))['db'];function respondWithStatusCode(_0x203d59,_0x211120){_0x211120=_0x211120||0xcc;return function(_0x581cb3){if(_0x581cb3){return _0x203d59[_0x206f('0x13')](_0x211120);}return _0x203d59[_0x206f('0x14')](_0x211120)[_0x206f('0x15')]();};}function respondWithResult(_0x1e9196,_0x1c5600){_0x1c5600=_0x1c5600||0xc8;return function(_0x404133){if(_0x404133){return _0x1e9196[_0x206f('0x14')](_0x1c5600)[_0x206f('0x16')](_0x404133);}};}function respondWithFilteredResult(_0x101d81,_0x45348f){return function(_0x5be4b2){if(_0x5be4b2){var _0x4d0ae4=typeof _0x45348f['offset']===_0x206f('0x17')&&typeof _0x45348f['limit']===_0x206f('0x17');var _0x3e6767=_0x5be4b2[_0x206f('0x18')];var _0x330347=_0x4d0ae4?0x0:_0x45348f['offset'];var _0x388049=_0x4d0ae4?_0x5be4b2['count']:_0x45348f[_0x206f('0x19')]+_0x45348f[_0x206f('0x1a')];var _0x4c21d3;if(_0x388049>=_0x3e6767){_0x388049=_0x3e6767;_0x4c21d3=0xc8;}else{_0x4c21d3=0xce;}_0x101d81[_0x206f('0x14')](_0x4c21d3);return _0x101d81[_0x206f('0x1b')](_0x206f('0x1c'),_0x330347+'-'+_0x388049+'/'+_0x3e6767)[_0x206f('0x16')](_0x5be4b2);}return null;};}function patchUpdates(_0xe7350c){return function(_0x1f7136){try{jsonpatch[_0x206f('0x1d')](_0x1f7136,_0xe7350c,!![]);}catch(_0x5ae236){return BPromise[_0x206f('0x1e')](_0x5ae236);}return _0x1f7136['save']();};}function saveUpdates(_0x2192ab,_0x18d4cc){return function(_0x1b918b){if(_0x1b918b){return _0x1b918b['update'](_0x2192ab)['then'](function(_0x317b5d){return _0x317b5d;});}return null;};}function removeEntity(_0x59d6e5,_0x43251d){return function(_0x262466){if(_0x262466){return _0x262466['destroy']()[_0x206f('0x1f')](function(){_0x59d6e5[_0x206f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a8ca1,_0x20fd3){return function(_0x7c226a){if(!_0x7c226a){_0x4a8ca1[_0x206f('0x13')](0x194);}return _0x7c226a;};}function handleError(_0xd97c7f,_0xdf012d){_0xdf012d=_0xdf012d||0x1f4;return function(_0xd81d21){logger[_0x206f('0x20')](_0xd81d21[_0x206f('0x21')]);if(_0xd81d21[_0x206f('0x22')]){delete _0xd81d21[_0x206f('0x22')];}_0xd97c7f[_0x206f('0x14')](_0xdf012d)[_0x206f('0x23')](_0xd81d21);};}exports[_0x206f('0x24')]=function(_0x42594d,_0x447ae1){var _0x491dc0={},_0x426800={},_0x48c31e={'count':0x0,'rows':[]};var _0x2faa53=_[_0x206f('0x25')](db[_0x206f('0x26')][_0x206f('0x27')],function(_0xab17b8){return{'name':_0xab17b8['fieldName'],'type':_0xab17b8[_0x206f('0x28')]['key']};});_0x426800[_0x206f('0x29')]=_['map'](_0x2faa53,_0x206f('0x22'));_0x426800['query']=_[_0x206f('0x2a')](_0x42594d[_0x206f('0x2b')]);_0x426800['filters']=_['intersection'](_0x426800[_0x206f('0x29')],_0x426800[_0x206f('0x2b')]);_0x491dc0[_0x206f('0x2c')]=_['intersection'](_0x426800[_0x206f('0x29')],qs[_0x206f('0x2d')](_0x42594d[_0x206f('0x2b')][_0x206f('0x2d')]));_0x491dc0[_0x206f('0x2c')]=_0x491dc0[_0x206f('0x2c')][_0x206f('0x2e')]?_0x491dc0[_0x206f('0x2c')]:_0x426800[_0x206f('0x29')];if(!_0x42594d[_0x206f('0x2b')][_0x206f('0x2f')](_0x206f('0x30'))){_0x491dc0['limit']=qs[_0x206f('0x1a')](_0x42594d[_0x206f('0x2b')][_0x206f('0x1a')]);_0x491dc0[_0x206f('0x19')]=qs[_0x206f('0x19')](_0x42594d['query'][_0x206f('0x19')]);}_0x491dc0[_0x206f('0x31')]=qs['sort'](_0x42594d[_0x206f('0x2b')]['sort']);_0x491dc0[_0x206f('0x32')]=qs[_0x206f('0x33')](_[_0x206f('0x34')](_0x42594d[_0x206f('0x2b')],_0x426800[_0x206f('0x33')]),_0x2faa53);if(_0x42594d[_0x206f('0x2b')][_0x206f('0x35')]){_0x491dc0[_0x206f('0x32')]=_['merge'](_0x491dc0[_0x206f('0x32')],{'$or':_[_0x206f('0x25')](_0x2faa53,function(_0x2a4826){if(_0x2a4826[_0x206f('0x28')]!==_0x206f('0x36')){var _0x162cd5={};_0x162cd5[_0x2a4826[_0x206f('0x22')]]={'$like':'%'+_0x42594d[_0x206f('0x2b')]['filter']+'%'};return _0x162cd5;}})});}_0x491dc0=_[_0x206f('0x37')]({},_0x491dc0,_0x42594d['options']);var _0x5052a4={'where':_0x491dc0[_0x206f('0x32')]};return db['Attachment'][_0x206f('0x18')](_0x5052a4)[_0x206f('0x1f')](function(_0x543c43){_0x48c31e[_0x206f('0x18')]=_0x543c43;if(_0x42594d['query'][_0x206f('0x38')]){_0x491dc0[_0x206f('0x39')]=[{'all':!![]}];}return db[_0x206f('0x26')][_0x206f('0x3a')](_0x491dc0);})['then'](function(_0x1b9711){_0x48c31e[_0x206f('0x3b')]=_0x1b9711;return _0x48c31e;})[_0x206f('0x1f')](respondWithFilteredResult(_0x447ae1,_0x491dc0))[_0x206f('0x3c')](handleError(_0x447ae1,null));};exports[_0x206f('0x3d')]=function(_0x5a1fb1,_0x52d03e){var _0x3e656d={'raw':!![],'where':{'id':_0x5a1fb1[_0x206f('0x3e')]['id']}},_0x5e3daa={};_0x5e3daa['model']=_['keys'](db['Attachment'][_0x206f('0x27')]);_0x5e3daa['query']=_[_0x206f('0x2a')](_0x5a1fb1[_0x206f('0x2b')]);_0x5e3daa[_0x206f('0x33')]=_[_0x206f('0x3f')](_0x5e3daa[_0x206f('0x29')],_0x5e3daa[_0x206f('0x2b')]);_0x3e656d['attributes']=_[_0x206f('0x3f')](_0x5e3daa['model'],qs['fields'](_0x5a1fb1[_0x206f('0x2b')][_0x206f('0x2d')]));_0x3e656d['attributes']=_0x3e656d[_0x206f('0x2c')][_0x206f('0x2e')]?_0x3e656d[_0x206f('0x2c')]:_0x5e3daa[_0x206f('0x29')];if(_0x5a1fb1[_0x206f('0x2b')][_0x206f('0x38')]){_0x3e656d[_0x206f('0x39')]=[{'all':!![]}];}_0x3e656d=_[_0x206f('0x37')]({},_0x3e656d,_0x5a1fb1[_0x206f('0x40')]);return db[_0x206f('0x26')][_0x206f('0x41')](_0x3e656d)[_0x206f('0x1f')](handleEntityNotFound(_0x52d03e,null))[_0x206f('0x1f')](respondWithResult(_0x52d03e,null))['catch'](handleError(_0x52d03e,null));};exports['clone']=function(_0x16ac33,_0x54ac26){var _0x2e0aa2={'where':{'id':_0x16ac33[_0x206f('0x3e')]['id']}},_0x53b249={};_0x53b249[_0x206f('0x29')]=_['keys'](db[_0x206f('0x26')][_0x206f('0x27')]);_0x2e0aa2['attributes']=_[_0x206f('0x3f')](_0x53b249[_0x206f('0x29')],qs[_0x206f('0x2d')](_0x16ac33[_0x206f('0x2b')][_0x206f('0x2d')]));_0x2e0aa2[_0x206f('0x2c')]=_0x2e0aa2[_0x206f('0x2c')][_0x206f('0x2e')]?_0x2e0aa2[_0x206f('0x2c')]:_0x53b249[_0x206f('0x29')];if(_0x16ac33[_0x206f('0x2b')][_0x206f('0x38')]){_0x2e0aa2[_0x206f('0x39')]=[{'all':!![]}];}_0x2e0aa2=_[_0x206f('0x37')]({},_0x2e0aa2,_0x16ac33[_0x206f('0x40')]);return db[_0x206f('0x26')]['find'](_0x2e0aa2)[_0x206f('0x1f')](handleEntityNotFound(_0x54ac26,null))[_0x206f('0x1f')](function(_0x3053fe){if(_0x3053fe){var _0x4b8f7=_0x3053fe[_0x206f('0x42')]({'plain':!![]});_0x4b8f7=qs[_0x206f('0x43')](_0x4b8f7,['id',_0x206f('0x44'),'updatedAt']);_0x16ac33[_0x206f('0x45')]=_[_0x206f('0x43')](_0x16ac33[_0x206f('0x45')],['id','createdAt','updatedAt']);return db[_0x206f('0x26')][_0x206f('0x46')](_[_0x206f('0x37')](_0x4b8f7,_0x16ac33[_0x206f('0x45')]),{'include':_0x16ac33[_0x206f('0x2b')][_0x206f('0x38')]?[{'all':!![]}]:undefined});}})[_0x206f('0x1f')](respondWithResult(_0x54ac26,0xc9))['catch'](handleError(_0x54ac26,null));};exports[_0x206f('0x47')]=function(_0x235827,_0x55fe2f){if(_0x235827['body']['id']){delete _0x235827[_0x206f('0x45')]['id'];}return db[_0x206f('0x26')][_0x206f('0x41')]({'where':{'id':_0x235827[_0x206f('0x3e')]['id']}})[_0x206f('0x1f')](handleEntityNotFound(_0x55fe2f,null))['then'](saveUpdates(_0x235827[_0x206f('0x45')],null))[_0x206f('0x1f')](respondWithResult(_0x55fe2f,null))[_0x206f('0x3c')](handleError(_0x55fe2f,null));};exports[_0x206f('0x48')]=function(_0x4ff12f,_0x58fa38){return db['Attachment'][_0x206f('0x41')]({'where':{'id':_0x4ff12f['params']['id']}})[_0x206f('0x1f')](handleEntityNotFound(_0x58fa38,null))['then'](removeEntity(_0x58fa38,null))[_0x206f('0x3c')](handleError(_0x58fa38,null));};exports[_0x206f('0x46')]=function(_0xed330a,_0x388063,_0x8cfe0e){_0xed330a[_0x206f('0x45')][_0x206f('0x22')]=_0xed330a[_0x206f('0x49')]['originalname'];_0xed330a[_0x206f('0x45')][_0x206f('0x4a')]=_0xed330a[_0x206f('0x49')][_0x206f('0x4b')];_0xed330a[_0x206f('0x45')]['type']=_0xed330a[_0x206f('0x49')][_0x206f('0x4c')];return db[_0x206f('0x26')]['create'](_0xed330a[_0x206f('0x45')])['then'](respondWithResult(_0x388063,0xc9))[_0x206f('0x3c')](handleError(_0x388063,null));};exports['download']=function(_0x3ccb40,_0x124fe0,_0x42e817){return db[_0x206f('0x26')][_0x206f('0x4d')]({'where':{'id':_0x3ccb40[_0x206f('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x124fe0,null))[_0x206f('0x1f')](function(_0x572379){if(_0x572379){var _0x438774=_0x572379[_0x206f('0x4e')]!==null;var _0x97d31d=path[_0x206f('0x4f')](config[_0x206f('0x50')],_0x206f('0x51'));if(_0x438774){_0x97d31d=path[_0x206f('0x4f')](_0x97d31d,_0x206f('0x52'));}var _0x3058bc=path[_0x206f('0x4f')](_0x97d31d,_0x572379[_0x206f('0x4a')]);return _0x124fe0[_0x206f('0x53')](_0x3058bc);}})[_0x206f('0x3c')](handleError(_0x124fe0,null));}; \ No newline at end of file +var _0x7438=['include','rows','catch','params','options','find','clone','length','includeAll','get','omit','body','updatedAt','create','destroy','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','Attachment','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','type','VIRTUAL'];(function(_0x282405,_0x921438){var _0x3c0120=function(_0x31eaf3){while(--_0x31eaf3){_0x282405['push'](_0x282405['shift']());}};_0x3c0120(++_0x921438);}(_0x7438,0x72));var _0x8743=function(_0x418b87,_0x55013f){_0x418b87=_0x418b87-0x0;var _0x2a62a9=_0x7438[_0x418b87];return _0x2a62a9;};'use strict';var emlformat=require(_0x8743('0x0'));var rimraf=require(_0x8743('0x1'));var zipdir=require(_0x8743('0x2'));var jsonpatch=require(_0x8743('0x3'));var rp=require(_0x8743('0x4'));var moment=require(_0x8743('0x5'));var BPromise=require(_0x8743('0x6'));var Mustache=require(_0x8743('0x7'));var util=require('util');var path=require(_0x8743('0x8'));var sox=require(_0x8743('0x9'));var csv=require(_0x8743('0xa'));var ejs=require(_0x8743('0xb'));var fs=require('fs');var fs_extra=require(_0x8743('0xc'));var _=require(_0x8743('0xd'));var squel=require(_0x8743('0xe'));var crypto=require(_0x8743('0xf'));var jsforce=require(_0x8743('0x10'));var deskjs=require(_0x8743('0x11'));var toCsv=require(_0x8743('0xa'));var querystring=require(_0x8743('0x12'));var Papa=require(_0x8743('0x13'));var Redis=require('ioredis');var authService=require(_0x8743('0x14'));var qs=require(_0x8743('0x15'));var as=require(_0x8743('0x16'));var hardwareService=require(_0x8743('0x17'));var logger=require(_0x8743('0x18'))(_0x8743('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57d2be,_0x39a892){_0x39a892=_0x39a892||0xcc;return function(_0x567bed){if(_0x567bed){return _0x57d2be[_0x8743('0x1a')](_0x39a892);}return _0x57d2be[_0x8743('0x1b')](_0x39a892)['end']();};}function respondWithResult(_0x5f4a7c,_0x16f400){_0x16f400=_0x16f400||0xc8;return function(_0x24e961){if(_0x24e961){return _0x5f4a7c[_0x8743('0x1b')](_0x16f400)[_0x8743('0x1c')](_0x24e961);}};}function respondWithFilteredResult(_0x54634c,_0x3c5742){return function(_0x3954f5){if(_0x3954f5){var _0x2f7173=typeof _0x3c5742[_0x8743('0x1d')]===_0x8743('0x1e')&&typeof _0x3c5742[_0x8743('0x1f')]===_0x8743('0x1e');var _0x3a5c65=_0x3954f5[_0x8743('0x20')];var _0x52aad4=_0x2f7173?0x0:_0x3c5742[_0x8743('0x1d')];var _0xe46c05=_0x2f7173?_0x3954f5['count']:_0x3c5742[_0x8743('0x1d')]+_0x3c5742[_0x8743('0x1f')];var _0x2a7c14;if(_0xe46c05>=_0x3a5c65){_0xe46c05=_0x3a5c65;_0x2a7c14=0xc8;}else{_0x2a7c14=0xce;}_0x54634c['status'](_0x2a7c14);return _0x54634c[_0x8743('0x21')]('Content-Range',_0x52aad4+'-'+_0xe46c05+'/'+_0x3a5c65)[_0x8743('0x1c')](_0x3954f5);}return null;};}function patchUpdates(_0x2d892f){return function(_0x21656e){try{jsonpatch[_0x8743('0x22')](_0x21656e,_0x2d892f,!![]);}catch(_0xf5c7e2){return BPromise[_0x8743('0x23')](_0xf5c7e2);}return _0x21656e[_0x8743('0x24')]();};}function saveUpdates(_0x4f623e,_0x45f36e){return function(_0xac0c06){if(_0xac0c06){return _0xac0c06[_0x8743('0x25')](_0x4f623e)[_0x8743('0x26')](function(_0x1a5395){return _0x1a5395;});}return null;};}function removeEntity(_0x75dab2,_0x4f1703){return function(_0x5a01ba){if(_0x5a01ba){return _0x5a01ba['destroy']()[_0x8743('0x26')](function(){_0x75dab2[_0x8743('0x1b')](0xcc)[_0x8743('0x27')]();});}};}function handleEntityNotFound(_0x372990,_0x58396f){return function(_0x22f163){if(!_0x22f163){_0x372990[_0x8743('0x1a')](0x194);}return _0x22f163;};}function handleError(_0x451678,_0x60b44e){_0x60b44e=_0x60b44e||0x1f4;return function(_0x12e08b){logger[_0x8743('0x28')](_0x12e08b[_0x8743('0x29')]);if(_0x12e08b[_0x8743('0x2a')]){delete _0x12e08b[_0x8743('0x2a')];}_0x451678['status'](_0x60b44e)[_0x8743('0x2b')](_0x12e08b);};}exports['index']=function(_0x5a3524,_0x19467b){var _0x4883b7={},_0x5eeedf={},_0x217318={'count':0x0,'rows':[]};var _0x715f15=_['map'](db[_0x8743('0x2c')][_0x8743('0x2d')],function(_0x965111){return{'name':_0x965111[_0x8743('0x2e')],'type':_0x965111['type'][_0x8743('0x2f')]};});_0x5eeedf[_0x8743('0x30')]=_[_0x8743('0x31')](_0x715f15,_0x8743('0x2a'));_0x5eeedf[_0x8743('0x32')]=_[_0x8743('0x33')](_0x5a3524['query']);_0x5eeedf[_0x8743('0x34')]=_[_0x8743('0x35')](_0x5eeedf['model'],_0x5eeedf[_0x8743('0x32')]);_0x4883b7[_0x8743('0x36')]=_[_0x8743('0x35')](_0x5eeedf[_0x8743('0x30')],qs[_0x8743('0x37')](_0x5a3524['query'][_0x8743('0x37')]));_0x4883b7['attributes']=_0x4883b7['attributes']['length']?_0x4883b7['attributes']:_0x5eeedf['model'];if(!_0x5a3524['query']['hasOwnProperty'](_0x8743('0x38'))){_0x4883b7['limit']=qs['limit'](_0x5a3524['query'][_0x8743('0x1f')]);_0x4883b7[_0x8743('0x1d')]=qs[_0x8743('0x1d')](_0x5a3524[_0x8743('0x32')][_0x8743('0x1d')]);}_0x4883b7[_0x8743('0x39')]=qs['sort'](_0x5a3524[_0x8743('0x32')]['sort']);_0x4883b7[_0x8743('0x3a')]=qs['filters'](_[_0x8743('0x3b')](_0x5a3524['query'],_0x5eeedf[_0x8743('0x34')]),_0x715f15);if(_0x5a3524[_0x8743('0x32')][_0x8743('0x3c')]){_0x4883b7['where']=_[_0x8743('0x3d')](_0x4883b7[_0x8743('0x3a')],{'$or':_['map'](_0x715f15,function(_0x2a5553){if(_0x2a5553[_0x8743('0x3e')]!==_0x8743('0x3f')){var _0x4d0216={};_0x4d0216[_0x2a5553['name']]={'$like':'%'+_0x5a3524[_0x8743('0x32')][_0x8743('0x3c')]+'%'};return _0x4d0216;}})});}_0x4883b7=_[_0x8743('0x3d')]({},_0x4883b7,_0x5a3524['options']);var _0x43809b={'where':_0x4883b7[_0x8743('0x3a')]};return db[_0x8743('0x2c')][_0x8743('0x20')](_0x43809b)[_0x8743('0x26')](function(_0x2e5e23){_0x217318[_0x8743('0x20')]=_0x2e5e23;if(_0x5a3524[_0x8743('0x32')]['includeAll']){_0x4883b7[_0x8743('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x4883b7);})[_0x8743('0x26')](function(_0xcecfe7){_0x217318[_0x8743('0x41')]=_0xcecfe7;return _0x217318;})[_0x8743('0x26')](respondWithFilteredResult(_0x19467b,_0x4883b7))[_0x8743('0x42')](handleError(_0x19467b,null));};exports['show']=function(_0x3cbd90,_0x6d959b){var _0x24a3ce={'raw':!![],'where':{'id':_0x3cbd90[_0x8743('0x43')]['id']}},_0x16ee94={};_0x16ee94[_0x8743('0x30')]=_[_0x8743('0x33')](db[_0x8743('0x2c')][_0x8743('0x2d')]);_0x16ee94['query']=_[_0x8743('0x33')](_0x3cbd90['query']);_0x16ee94['filters']=_[_0x8743('0x35')](_0x16ee94['model'],_0x16ee94['query']);_0x24a3ce[_0x8743('0x36')]=_[_0x8743('0x35')](_0x16ee94['model'],qs[_0x8743('0x37')](_0x3cbd90[_0x8743('0x32')][_0x8743('0x37')]));_0x24a3ce[_0x8743('0x36')]=_0x24a3ce[_0x8743('0x36')]['length']?_0x24a3ce[_0x8743('0x36')]:_0x16ee94[_0x8743('0x30')];if(_0x3cbd90[_0x8743('0x32')]['includeAll']){_0x24a3ce[_0x8743('0x40')]=[{'all':!![]}];}_0x24a3ce=_[_0x8743('0x3d')]({},_0x24a3ce,_0x3cbd90[_0x8743('0x44')]);return db[_0x8743('0x2c')][_0x8743('0x45')](_0x24a3ce)[_0x8743('0x26')](handleEntityNotFound(_0x6d959b,null))['then'](respondWithResult(_0x6d959b,null))[_0x8743('0x42')](handleError(_0x6d959b,null));};exports[_0x8743('0x46')]=function(_0x5a7477,_0x5d67c2){var _0x21921={'where':{'id':_0x5a7477['params']['id']}},_0x50be2e={};_0x50be2e[_0x8743('0x30')]=_[_0x8743('0x33')](db[_0x8743('0x2c')]['rawAttributes']);_0x21921[_0x8743('0x36')]=_['intersection'](_0x50be2e[_0x8743('0x30')],qs[_0x8743('0x37')](_0x5a7477[_0x8743('0x32')]['fields']));_0x21921['attributes']=_0x21921['attributes'][_0x8743('0x47')]?_0x21921[_0x8743('0x36')]:_0x50be2e[_0x8743('0x30')];if(_0x5a7477[_0x8743('0x32')][_0x8743('0x48')]){_0x21921[_0x8743('0x40')]=[{'all':!![]}];}_0x21921=_[_0x8743('0x3d')]({},_0x21921,_0x5a7477['options']);return db[_0x8743('0x2c')][_0x8743('0x45')](_0x21921)[_0x8743('0x26')](handleEntityNotFound(_0x5d67c2,null))[_0x8743('0x26')](function(_0x599f8b){if(_0x599f8b){var _0x1f949b=_0x599f8b[_0x8743('0x49')]({'plain':!![]});_0x1f949b=qs[_0x8743('0x4a')](_0x1f949b,['id','createdAt','updatedAt']);_0x5a7477['body']=_[_0x8743('0x4a')](_0x5a7477[_0x8743('0x4b')],['id','createdAt',_0x8743('0x4c')]);return db[_0x8743('0x2c')][_0x8743('0x4d')](_[_0x8743('0x3d')](_0x1f949b,_0x5a7477[_0x8743('0x4b')]),{'include':_0x5a7477[_0x8743('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x8743('0x26')](respondWithResult(_0x5d67c2,0xc9))['catch'](handleError(_0x5d67c2,null));};exports['update']=function(_0x4d22aa,_0x7a8316){if(_0x4d22aa['body']['id']){delete _0x4d22aa[_0x8743('0x4b')]['id'];}return db[_0x8743('0x2c')][_0x8743('0x45')]({'where':{'id':_0x4d22aa[_0x8743('0x43')]['id']}})[_0x8743('0x26')](handleEntityNotFound(_0x7a8316,null))[_0x8743('0x26')](saveUpdates(_0x4d22aa[_0x8743('0x4b')],null))[_0x8743('0x26')](respondWithResult(_0x7a8316,null))[_0x8743('0x42')](handleError(_0x7a8316,null));};exports[_0x8743('0x4e')]=function(_0x5ad0dd,_0x311c12){return db['Attachment'][_0x8743('0x45')]({'where':{'id':_0x5ad0dd['params']['id']}})[_0x8743('0x26')](handleEntityNotFound(_0x311c12,null))[_0x8743('0x26')](removeEntity(_0x311c12,null))[_0x8743('0x42')](handleError(_0x311c12,null));};exports['create']=function(_0x276ef4,_0x7749fa,_0x11bcae){_0x276ef4['body'][_0x8743('0x2a')]=_0x276ef4[_0x8743('0x4f')]['originalname'];_0x276ef4['body']['basename']=_0x276ef4[_0x8743('0x4f')][_0x8743('0x50')];_0x276ef4[_0x8743('0x4b')][_0x8743('0x3e')]=_0x276ef4[_0x8743('0x4f')][_0x8743('0x51')];return db[_0x8743('0x2c')][_0x8743('0x4d')](_0x276ef4[_0x8743('0x4b')])[_0x8743('0x26')](respondWithResult(_0x7749fa,0xc9))[_0x8743('0x42')](handleError(_0x7749fa,null));};exports[_0x8743('0x52')]=function(_0x5b568a,_0x4816f2,_0x54e55b){return db[_0x8743('0x2c')][_0x8743('0x53')]({'where':{'id':_0x5b568a[_0x8743('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4816f2,null))[_0x8743('0x26')](function(_0x192885){if(_0x192885){var _0x1baa59=_0x192885[_0x8743('0x54')]!==null;var _0x511da2=path[_0x8743('0x55')](config[_0x8743('0x56')],_0x8743('0x57'));if(_0x1baa59){_0x511da2=path[_0x8743('0x55')](_0x511da2,_0x8743('0x58'));}var _0x74b421=path[_0x8743('0x55')](_0x511da2,_0x192885['basename']);return _0x4816f2['download'](_0x74b421);}})[_0x8743('0x42')](handleError(_0x4816f2,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5e134d5..90ba4b2 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 _0xfbef=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','Attachment'];(function(_0x33f228,_0x39ddf8){var _0xd51c9a=function(_0x33013e){while(--_0x33013e){_0x33f228['push'](_0x33f228['shift']());}};_0xd51c9a(++_0x39ddf8);}(_0xfbef,0x156));var _0xffbe=function(_0x493451,_0x13a642){_0x493451=_0x493451-0x0;var _0x1f8215=_0xfbef[_0x493451];return _0x1f8215;};'use strict';var _=require(_0xffbe('0x0'));var util=require(_0xffbe('0x1'));var logger=require('../../config/logger')(_0xffbe('0x2'));var moment=require(_0xffbe('0x3'));var BPromise=require(_0xffbe('0x4'));var rp=require(_0xffbe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffbe('0x6'));var config=require(_0xffbe('0x7'));var attributes=require('./attachment.attributes');module['exports']=function(_0x27bbdc,_0x30a12d){return _0x27bbdc['define'](_0xffbe('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x129e=['util','../../config/logger','api','request-promise','exports','define','attachments','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x129e,0x67));var _0xe129=function(_0x471460,_0x4fb880){_0x471460=_0x471460-0x0;var _0x4f3747=_0x129e[_0x471460];return _0x4f3747;};'use strict';var _=require(_0xe129('0x0'));var util=require(_0xe129('0x1'));var logger=require(_0xe129('0x2'))(_0xe129('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe129('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0xe129('0x5')]=function(_0x470b77,_0x33e272){return _0x470b77[_0xe129('0x6')]('Attachment',attributes,{'tableName':_0xe129('0x7'),'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 5a647d3..7868c5a 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 _0x130d=['debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateAttachment','Attachment','options','raw','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s'];(function(_0x1bcb5e,_0x8cd468){var _0x5aec45=function(_0x4cde1f){while(--_0x4cde1f){_0x1bcb5e['push'](_0x1bcb5e['shift']());}};_0x5aec45(++_0x8cd468);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var moment=require(_0xd130('0x1'));var BPromise=require('bluebird');var rs=require(_0xd130('0x2'));var fs=require('fs');var Redis=require(_0xd130('0x3'));var db=require(_0xd130('0x4'))['db'];var utils=require(_0xd130('0x5'));var logger=require(_0xd130('0x6'))(_0xd130('0x7'));var config=require(_0xd130('0x8'));var jayson=require(_0xd130('0x9'));var client=jayson[_0xd130('0xa')][_0xd130('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c215,_0x168ee7,_0x3f77e1){return new BPromise(function(_0x1b9875,_0x4a3818){return client[_0xd130('0xc')](_0x44c215,_0x3f77e1)['then'](function(_0x1cec3b){logger[_0xd130('0xd')](_0xd130('0xe'),_0x168ee7,'request\x20sent');logger[_0xd130('0xf')](_0xd130('0x10'),_0x168ee7,'request\x20sent',JSON['stringify'](_0x1cec3b));if(_0x1cec3b[_0xd130('0x11')]){if(_0x1cec3b['error'][_0xd130('0x12')]===0x1f4){logger[_0xd130('0x11')]('Attachment,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x4a3818(_0x1cec3b[_0xd130('0x11')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x1b9875(_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);}else{logger[_0xd130('0xd')]('Attachment,\x20%s,\x20%s',_0x168ee7,_0xd130('0x14'));_0x1b9875(_0x1cec3b[_0xd130('0x15')][_0xd130('0x13')]);}})[_0xd130('0x16')](function(_0x57930b){logger[_0xd130('0x11')](_0xd130('0xe'),_0x168ee7,_0x57930b);_0x4a3818(_0x57930b);});});}exports[_0xd130('0x17')]=function(_0xce6d93){var _0x342eb2=this;return new Promise(function(_0xc1c504,_0x43ed26){return db[_0xd130('0x18')]['create'](_0xce6d93['body'],{'raw':_0xce6d93[_0xd130('0x19')]?_0xce6d93[_0xd130('0x19')][_0xd130('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2420fd){logger[_0xd130('0xd')](_0xd130('0x17'),_0xce6d93);logger[_0xd130('0xf')](_0xd130('0x17'),_0xce6d93,JSON[_0xd130('0x1b')](_0x2420fd));_0xc1c504(_0x2420fd);})['catch'](function(_0x311c3a){logger[_0xd130('0x11')](_0xd130('0x17'),_0x311c3a[_0xd130('0x13')],_0xce6d93);_0x43ed26(_0x342eb2[_0xd130('0x11')](0x1f4,_0x311c3a[_0xd130('0x13')]));});});}; \ No newline at end of file +var _0x55e0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','body','options','raw','stringify','lodash','util','moment','bluebird'];(function(_0x8d344d,_0x888a56){var _0x4ce27b=function(_0x36f125){while(--_0x36f125){_0x8d344d['push'](_0x8d344d['shift']());}};_0x4ce27b(++_0x888a56);}(_0x55e0,0xdc));var _0x055e=function(_0x1712f0,_0x343837){_0x1712f0=_0x1712f0-0x0;var _0x5b4468=_0x55e0[_0x1712f0];return _0x5b4468;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});}exports[_0x055e('0x16')]=function(_0x4c85dd){var _0x36ef10=this;return new Promise(function(_0x2cf3de,_0x2f4a06){return db[_0x055e('0x17')]['create'](_0x4c85dd[_0x055e('0x18')],{'raw':_0x4c85dd[_0x055e('0x19')]?_0x4c85dd['options'][_0x055e('0x1a')]===undefined?!![]:![]:!![]})[_0x055e('0xb')](function(_0x10258f){logger[_0x055e('0xc')](_0x055e('0x16'),_0x4c85dd);logger[_0x055e('0xf')]('CreateAttachment',_0x4c85dd,JSON[_0x055e('0x1b')](_0x10258f));_0x2cf3de(_0x10258f);})[_0x055e('0x15')](function(_0x211594){logger['error'](_0x055e('0x16'),_0x211594[_0x055e('0x13')],_0x4c85dd);_0x2f4a06(_0x36ef10[_0x055e('0x11')](0x1f4,_0x211594[_0x055e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9ada51c..3a746e6 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x4900b8,_0x13e9bf){var _0xd42c68=function(_0x1172a3){while(--_0x1172a3){_0x4900b8['push'](_0x4900b8['shift']());}};_0xd42c68(++_0x13e9bf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29524c,_0x6c596d){_0x29524c=_0x29524c-0x0;var _0x38d6a9=_0x5f2f[_0x29524c];return _0x38d6a9;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x539346,_0xb52a73){var _0x306ac8=function(_0x1882a4){while(--_0x1882a4){_0x539346['push'](_0x539346['shift']());}};_0x306ac8(++_0xb52a73);}(_0x5f2f,0x73));var _0xf5f2=function(_0x459db3,_0x1567da){_0x459db3=_0x459db3-0x0;var _0x5caf07=_0x5f2f[_0x459db3];return _0x5caf07;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index f6962c3..f0469f2 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 _0x7f1b=['ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','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','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','role','blocked','online','admin','agent','blockDuration','blockedAt','minutes','clearBlockUser','getLicense','catch','send','login'];(function(_0x135ddd,_0x3f04f3){var _0x5d3238=function(_0x12b9aa){while(--_0x12b9aa){_0x135ddd['push'](_0x135ddd['shift']());}};_0x5d3238(++_0x3f04f3);}(_0x7f1b,0x125));var _0xb7f1=function(_0x27214f,_0x63324a){_0x27214f=_0x27214f-0x0;var _0x38663c=_0x7f1b[_0x27214f];return _0x38663c;};'use strict';var passport=require(_0xb7f1('0x0'));var LocalStrategy=require(_0xb7f1('0x1'))[_0xb7f1('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xb7f1('0x3'));var utils=require(_0xb7f1('0x4'));var config=require('../../config/environment');var logger=require(_0xb7f1('0x5'))(_0xb7f1('0x6'));function isActiveDirectoryConfigured(_0x362c6b){var _0x3a189f=![];if(typeof _0x362c6b[_0xb7f1('0x7')]!=='undefined'){_0x3a189f=_0x362c6b[_0xb7f1('0x7')][_0xb7f1('0x8')]&&_0x362c6b['activedirectory'][_0xb7f1('0x9')]&&_0x362c6b[_0xb7f1('0x7')][_0xb7f1('0xa')];}return _0x3a189f;}function adAuthenticate(_0x42077e,_0x5c6498,_0x37eedf){return new BPromise(function(_0x209fd2,_0x294e75){try{var _0x3aec78=new ActiveDirectory(_0x42077e);_0x3aec78[_0xb7f1('0xb')](_0x5c6498,_0x37eedf,function(_0x198d28,_0xa6acaf){if(_0x198d28){logger[_0xb7f1('0xc')](_0xb7f1('0xd'),_0x5c6498,util['inspect'](_0x198d28,{'showHidden':![],'depth':null}));_0x294e75(_0xb7f1('0xe'));}else if(!_0xa6acaf){logger['error'](_0xb7f1('0xf'),_0x5c6498);_0x294e75(_0xb7f1('0xe'));}else{_0x209fd2(_0xa6acaf);}});}catch(_0x1ea1ef){_0x294e75(_0x1ea1ef);}});}function ActiveDirectoryAuthenticate(_0x578e1a,_0x44b8e0,_0x5964f7,_0x5796c7){var _0x397af0,_0x19ede9;if(!isActiveDirectoryConfigured(config)){logger[_0xb7f1('0xc')](_0xb7f1('0x10'),_0x44b8e0);return _0x5796c7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0xb7f1('0x11')]({'where':{'id':0x1},'attributes':[_0xb7f1('0x12'),'blockDuration'],'raw':!![]})[_0xb7f1('0x13')](function(_0x74e2d1){_0x397af0=_0x74e2d1;if(!_0x397af0[_0xb7f1('0x12')]){logger[_0xb7f1('0xc')](_0xb7f1('0x14'),_0x44b8e0);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x578e1a[_0xb7f1('0x11')]({'attributes':['id',_0xb7f1('0x15'),'password','salt',_0xb7f1('0x16'),'disabled',_0xb7f1('0x17'),'blockedAt',_0xb7f1('0x18')],'where':{'name':_0x44b8e0,'role':{'$or':[_0xb7f1('0x19'),'user',_0xb7f1('0x1a')]},'adSsoEnabled':!![]}});})[_0xb7f1('0x13')](function(_0x5efacd){if(!_0x5efacd||_0x5efacd&&_0x5efacd[_0xb7f1('0x15')]!==_0x44b8e0){throw new Error(_0xb7f1('0xe'));}_0x19ede9=_0x5efacd;var _0x4c7624=_0x19ede9[_0xb7f1('0x15')]+'@'+config['activedirectory'][_0xb7f1('0xa')];return adAuthenticate(config[_0xb7f1('0x7')],_0x4c7624,_0x5964f7);})[_0xb7f1('0x13')](function(_0x700de){if(_0x19ede9['disabled']){throw new Error(_0xb7f1('0xe'));}if(_0x397af0[_0xb7f1('0x1b')]>0x0){if(_0x19ede9[_0xb7f1('0x17')]){if(moment(_0x19ede9[_0xb7f1('0x1c')])['add'](_0x397af0[_0xb7f1('0x1b')],_0xb7f1('0x1d'))>moment()){throw new Error(_0xb7f1('0xe'));}return utils[_0xb7f1('0x1e')](_0x19ede9,0x0,![],null)[_0xb7f1('0x13')](function(){return utils[_0xb7f1('0x1f')](_0x19ede9);})[_0xb7f1('0x13')](function(){return _0x5796c7(null,_0x19ede9);});}else{return utils[_0xb7f1('0x1f')](_0x19ede9)[_0xb7f1('0x13')](function(){return _0x5796c7(null,_0x19ede9);});}}else{return utils[_0xb7f1('0x1f')](_0x19ede9)[_0xb7f1('0x13')](function(){return _0x5796c7(null,_0x19ede9);});}})[_0xb7f1('0x20')](function(_0x41db81){return _0x5796c7(null,![],_0x41db81);});}function handleError(_0x7fe162,_0x4f31a0,_0x4bdb63){return _0x7fe162['status'](_0x4f31a0||0x1f4)[_0xb7f1('0x21')]({'message':_0x4bdb63?_0x4bdb63['message']||_0x4bdb63:''});}exports[_0xb7f1('0x22')]=function(_0x538361,_0xf4db3a,_0x947e30){passport[_0xb7f1('0xb')](_0xb7f1('0x23'),function(_0x514c25,_0x606b88,_0x4fff7c){var _0x542f67=_0x514c25||_0x4fff7c;if(_0x542f67){return handleError(_0xf4db3a,0x191,_0x542f67);}if(!_0x606b88){return handleError(_0xf4db3a,0x194,{'message':_0xb7f1('0x24')});}else{var _0x5be9af={'payload':{'id':_0x606b88['id'],'role':_0x606b88[_0xb7f1('0x16')]},'options':{'expiresIn':0x15180}};return authService[_0xb7f1('0x25')](_0x5be9af)[_0xb7f1('0x13')](function(_0x237a2c){_0xf4db3a[_0xb7f1('0x26')]({'id':_0x606b88['id'],'token':_0x237a2c,'statusCall':'','isAlreadyLogged':_0x606b88[_0xb7f1('0x18')]});});}})(_0x538361,_0xf4db3a,_0x947e30);};passport[_0xb7f1('0x27')](_0xb7f1('0x23'),new LocalStrategy({'usernameField':_0xb7f1('0x15'),'passwordField':'password'},function(_0xad29a9,_0x75cfeb,_0x5f526d){return ActiveDirectoryAuthenticate(db[_0xb7f1('0x28')],_0xad29a9,_0x75cfeb,_0x5f526d);})); \ No newline at end of file +var _0xe0a6=['undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blockedAt','admin','user','agent','then','name','blockDuration','blocked','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','User','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/environment','../../config/logger','api','activedirectory'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe0a6,0x1ea));var _0x6e0a=function(_0xe3b290,_0x3ccdc1){_0xe3b290=_0xe3b290-0x0;var _0x14288e=_0xe0a6[_0xe3b290];return _0x14288e;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0x6e0a('0x0')];var moment=require(_0x6e0a('0x1'));var ActiveDirectory=require(_0x6e0a('0x2'));var BPromise=require(_0x6e0a('0x3'));var util=require(_0x6e0a('0x4'));var db=require(_0x6e0a('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0x6e0a('0x6'));var logger=require(_0x6e0a('0x7'))(_0x6e0a('0x8'));function isActiveDirectoryConfigured(_0xb093df){var _0x385624=![];if(typeof _0xb093df[_0x6e0a('0x9')]!==_0x6e0a('0xa')){_0x385624=_0xb093df[_0x6e0a('0x9')]['baseDN']&&_0xb093df[_0x6e0a('0x9')][_0x6e0a('0xb')]&&_0xb093df[_0x6e0a('0x9')][_0x6e0a('0xc')];}return _0x385624;}function adAuthenticate(_0x5d40f7,_0x3b585d,_0x452682){return new BPromise(function(_0x4d7c60,_0x33e83e){try{var _0x3f8798=new ActiveDirectory(_0x5d40f7);_0x3f8798[_0x6e0a('0xd')](_0x3b585d,_0x452682,function(_0x1ad372,_0x3f8740){if(_0x1ad372){logger[_0x6e0a('0xe')](_0x6e0a('0xf'),_0x3b585d,util['inspect'](_0x1ad372,{'showHidden':![],'depth':null}));_0x33e83e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3f8740){logger[_0x6e0a('0xe')](_0x6e0a('0x10'),_0x3b585d);_0x33e83e(_0x6e0a('0x11'));}else{_0x4d7c60(_0x3f8740);}});}catch(_0x153d87){_0x33e83e(_0x153d87);}});}function ActiveDirectoryAuthenticate(_0x2df828,_0x2b2778,_0x25c36a,_0x15e064){var _0x51b330,_0x5f476b;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x6e0a('0x12'),_0x2b2778);return _0x15e064(null,![],{'message':_0x6e0a('0x11')});}return db[_0x6e0a('0x13')][_0x6e0a('0x14')]({'where':{'id':0x1},'attributes':[_0x6e0a('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x450525){_0x51b330=_0x450525;if(!_0x51b330[_0x6e0a('0x15')]){logger[_0x6e0a('0xe')](_0x6e0a('0x16'),_0x2b2778);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x2df828[_0x6e0a('0x14')]({'attributes':['id','name',_0x6e0a('0x17'),_0x6e0a('0x18'),_0x6e0a('0x19'),_0x6e0a('0x1a'),'blocked',_0x6e0a('0x1b'),'online'],'where':{'name':_0x2b2778,'role':{'$or':[_0x6e0a('0x1c'),_0x6e0a('0x1d'),_0x6e0a('0x1e')]},'adSsoEnabled':!![]}});})[_0x6e0a('0x1f')](function(_0x382bb0){if(!_0x382bb0||_0x382bb0&&_0x382bb0[_0x6e0a('0x20')]!==_0x2b2778){throw new Error(_0x6e0a('0x11'));}_0x5f476b=_0x382bb0;var _0x33867f=_0x5f476b[_0x6e0a('0x20')]+'@'+config[_0x6e0a('0x9')]['domain'];return adAuthenticate(config[_0x6e0a('0x9')],_0x33867f,_0x25c36a);})[_0x6e0a('0x1f')](function(_0x5cf555){if(_0x5f476b[_0x6e0a('0x1a')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x51b330[_0x6e0a('0x21')]>0x0){if(_0x5f476b[_0x6e0a('0x22')]){if(moment(_0x5f476b[_0x6e0a('0x1b')])['add'](_0x51b330[_0x6e0a('0x21')],_0x6e0a('0x23'))>moment()){throw new Error(_0x6e0a('0x11'));}return utils[_0x6e0a('0x24')](_0x5f476b,0x0,![],null)[_0x6e0a('0x1f')](function(){return utils[_0x6e0a('0x25')](_0x5f476b);})['then'](function(){return _0x15e064(null,_0x5f476b);});}else{return utils[_0x6e0a('0x25')](_0x5f476b)[_0x6e0a('0x1f')](function(){return _0x15e064(null,_0x5f476b);});}}else{return utils[_0x6e0a('0x25')](_0x5f476b)['then'](function(){return _0x15e064(null,_0x5f476b);});}})[_0x6e0a('0x26')](function(_0x2e6f10){return _0x15e064(null,![],_0x2e6f10);});}function handleError(_0x48724d,_0x1ae9e8,_0x3d3e39){return _0x48724d[_0x6e0a('0x27')](_0x1ae9e8||0x1f4)[_0x6e0a('0x28')]({'message':_0x3d3e39?_0x3d3e39[_0x6e0a('0x29')]||_0x3d3e39:''});}exports[_0x6e0a('0x2a')]=function(_0x307c1d,_0x50a02f,_0x2758a9){passport['authenticate'](_0x6e0a('0x2b'),function(_0x214711,_0x4562be,_0xe276a9){var _0x592009=_0x214711||_0xe276a9;if(_0x592009){return handleError(_0x50a02f,0x191,_0x592009);}if(!_0x4562be){return handleError(_0x50a02f,0x194,{'message':_0x6e0a('0x2c')});}else{var _0x19636a={'payload':{'id':_0x4562be['id'],'role':_0x4562be[_0x6e0a('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0x6e0a('0x2d')](_0x19636a)[_0x6e0a('0x1f')](function(_0x56782f){_0x50a02f[_0x6e0a('0x2e')]({'id':_0x4562be['id'],'token':_0x56782f,'statusCall':'','isAlreadyLogged':_0x4562be[_0x6e0a('0x2f')]});});}})(_0x307c1d,_0x50a02f,_0x2758a9);};passport[_0x6e0a('0x30')](_0x6e0a('0x2b'),new LocalStrategy({'usernameField':_0x6e0a('0x20'),'passwordField':_0x6e0a('0x17')},function(_0x360b46,_0x22b4ae,_0x3c3052){return ActiveDirectoryAuthenticate(db[_0x6e0a('0x31')],_0x360b46,_0x22b4ae,_0x3c3052);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index d68622b..9256526 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 _0xd7f5=['./authActiveDirectory.controller','post','express'];(function(_0x1740bf,_0x2b4e0c){var _0x2ab239=function(_0x396223){while(--_0x396223){_0x1740bf['push'](_0x1740bf['shift']());}};_0x2ab239(++_0x2b4e0c);}(_0xd7f5,0x14c));var _0x5d7f=function(_0x9c1f48,_0x25da55){_0x9c1f48=_0x9c1f48-0x0;var _0x52ecd4=_0xd7f5[_0x9c1f48];return _0x52ecd4;};'use strict';var express=require(_0x5d7f('0x0'));var router=express['Router']();var controller=require(_0x5d7f('0x1'));router[_0x5d7f('0x2')]('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0x19d7=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x2a6855,_0x300a43){var _0x181e3c=function(_0x150c18){while(--_0x150c18){_0x2a6855['push'](_0x2a6855['shift']());}};_0x181e3c(++_0x300a43);}(_0x19d7,0x1d7));var _0x719d=function(_0x1b2826,_0x37e876){_0x1b2826=_0x1b2826-0x0;var _0x14f577=_0x19d7[_0x1b2826];return _0x14f577;};'use strict';var express=require(_0x719d('0x0'));var router=express[_0x719d('0x1')]();var controller=require(_0x719d('0x2'));router[_0x719d('0x3')]('/',controller[_0x719d('0x4')]);module[_0x719d('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5e6ce4a..06ac3e9 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x7a54,0x106));var _0x47a5=function(_0x15b0d8,_0x18f538){_0x15b0d8=_0x15b0d8-0x0;var _0x4f7f16=_0x7a54[_0x15b0d8];return _0x4f7f16;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x7a54,0x106));var _0x47a5=function(_0x4ff9f4,_0x888970){_0x4ff9f4=_0x4ff9f4-0x0;var _0x396e67=_0x7a54[_0x4ff9f4];return _0x396e67;};'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 570fc0f..e97668a 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 _0x6316=['callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x5a4a88,_0x576c2e){var _0x41af68=function(_0xe8e61b){while(--_0xe8e61b){_0x5a4a88['push'](_0x5a4a88['shift']());}};_0x41af68(++_0x576c2e);}(_0x6316,0x170));var _0x6631=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6316[_0x432682];return _0x463d05;};'use strict';var express=require(_0x6631('0x0'));var passport=require(_0x6631('0x1'));var router=express[_0x6631('0x2')]();var controller=require(_0x6631('0x3'));var userController=require(_0x6631('0x4'));var authService=require(_0x6631('0x5'));router[_0x6631('0x6')]('/',controller[_0x6631('0x7')]);router[_0x6631('0x6')](_0x6631('0x8'),controller[_0x6631('0x9')],authService[_0x6631('0xa')],userController['login'],authService[_0x6631('0xb')]);module[_0x6631('0xc')]=router; \ No newline at end of file +var _0xd4f0=['../user/user.controller.js','../../components/auth/service','get','express','Router'];(function(_0xc74fc7,_0x59265c){var _0x4df941=function(_0x3b3dcc){while(--_0x3b3dcc){_0xc74fc7['push'](_0xc74fc7['shift']());}};_0x4df941(++_0x59265c);}(_0xd4f0,0xa8));var _0x0d4f=function(_0x11309c,_0xe18a74){_0x11309c=_0x11309c-0x0;var _0x3fea9c=_0xd4f0[_0x11309c];return _0x3fea9c;};'use strict';var express=require(_0x0d4f('0x0'));var passport=require('passport');var router=express[_0x0d4f('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x0d4f('0x2'));var authService=require(_0x0d4f('0x3'));router[_0x0d4f('0x4')]('/',controller['login']);router[_0x0d4f('0x4')]('/callback',controller['callback'],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 064bd9e..bfad8f3 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 _0xe79e=['getSmtpOptions','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','catch','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','blockDuration','then','findOne','name','password','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!'];(function(_0x1ab901,_0x328d58){var _0x126752=function(_0x36485e){while(--_0x36485e){_0x1ab901['push'](_0x1ab901['shift']());}};_0x126752(++_0x328d58);}(_0xe79e,0x13b));var _0xee79=function(_0x5953e3,_0x476e52){_0x5953e3=_0x5953e3-0x0;var _0x10e910=_0xe79e[_0x5953e3];return _0x10e910;};'use strict';var util=require(_0xee79('0x0'));var passport=require(_0xee79('0x1'));var LocalStrategy=require(_0xee79('0x2'))[_0xee79('0x3')];var jayson=require(_0xee79('0x4'));var _=require(_0xee79('0x5'));var rs=require('randomstring');var moment=require(_0xee79('0x6'));var db=require(_0xee79('0x7'))['db'];var authService=require(_0xee79('0x8'));var utils=require(_0xee79('0x9'));var client=jayson[_0xee79('0xa')][_0xee79('0xb')]({'port':0x232b});function localAuthenticate(_0x2be6be,_0x439d4d,_0x55e2b2,_0x2c2aa9){var _0x239813,_0xdd50fc;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xee79('0xc'),_0xee79('0xd')],'raw':!![]})[_0xee79('0xe')](function(_0x40b7aa){_0x239813=_0x40b7aa;return _0x2be6be[_0xee79('0xf')]({'attributes':['id',_0xee79('0x10'),_0xee79('0x11'),'salt',_0xee79('0x12'),_0xee79('0x13'),'blocked',_0xee79('0x14'),_0xee79('0x15')],'where':{'name':_0x439d4d,'role':{'$or':[_0xee79('0x16'),_0xee79('0x17'),_0xee79('0x18')]}}});})[_0xee79('0xe')](function(_0x10f01c){if(!_0x10f01c||_0x10f01c&&_0x10f01c[_0xee79('0x10')]!==_0x439d4d){throw new Error(_0xee79('0x19'));}else{_0xdd50fc=_0x10f01c;return _0xdd50fc;}})[_0xee79('0xe')](function(){_0xdd50fc[_0xee79('0x1a')](_0x55e2b2,function(_0x110ec0,_0xbe8bde){var _0x129f4f=_0xdd50fc[_0xee79('0x15')]+0x1;if(_0x110ec0){return _0x2c2aa9(_0x110ec0);}else if(!_0xbe8bde){if(_0xdd50fc['disabled']){return _0x2c2aa9(null,![],{'message':_0xee79('0x19')});}else if(_0x239813[_0xee79('0xc')]>0x0){if(_0xdd50fc[_0xee79('0x1b')]){if(_0x239813[_0xee79('0xd')]>0x0){if(moment(_0xdd50fc[_0xee79('0x14')])[_0xee79('0x1c')](_0x239813[_0xee79('0xd')],_0xee79('0x1d'))>moment()){return _0x2c2aa9(null,![],{'message':_0xee79('0x19')});}else{return utils['clearBlockUser'](_0xdd50fc,_0x129f4f,![],null)[_0xee79('0xe')](function(){return _0x2c2aa9(null,![],{'message':_0xee79('0x19')});});}}else{return _0x2c2aa9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x129f4f>=_0x239813[_0xee79('0xc')]){return utils[_0xee79('0x1e')](_0xdd50fc,0x0,!![],moment())[_0xee79('0xe')](function(){return _0x2c2aa9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xee79('0x1e')](_0xdd50fc,_0x129f4f,![],null)[_0xee79('0xe')](function(){return _0x2c2aa9(null,![],{'message':_0xee79('0x19')});});}}}else{return _0x2c2aa9(null,![],{'message':_0xee79('0x19')});}}else{if(_0xdd50fc[_0xee79('0x13')]){return _0x2c2aa9(null,![],{'message':_0xee79('0x19')});}else if(_0x239813[_0xee79('0xc')]>0x0){if(_0xdd50fc['blocked']){if(_0x239813[_0xee79('0xd')]>0x0){if(moment(_0xdd50fc[_0xee79('0x14')])['add'](_0x239813[_0xee79('0xd')],'minutes')>moment()){return _0x2c2aa9(null,![],{'message':_0xee79('0x19')});}else{return utils['clearBlockUser'](_0xdd50fc,0x0,![],null)['then'](function(){return utils[_0xee79('0x1f')](_0xdd50fc);})['then'](function(){return _0x2c2aa9(null,_0xdd50fc);});}}else{return _0x2c2aa9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xee79('0x1e')](_0xdd50fc,0x0,![],null)[_0xee79('0xe')](function(){return utils[_0xee79('0x1f')](_0xdd50fc);})[_0xee79('0xe')](function(){return _0x2c2aa9(null,_0xdd50fc);})['catch'](function(_0x4896ce){return _0x2c2aa9(null,![],_0x4896ce);});}}else{if(_0xdd50fc[_0xee79('0x1b')]){return _0x2c2aa9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0xdd50fc)['then'](function(){return _0x2c2aa9(null,_0xdd50fc);});}}}});})['catch'](function(_0x16fd88){return _0x2c2aa9(null,![],_0x16fd88);});}function sendServiceMail(_0x5f0cf9){return db['MailAccount'][_0xee79('0x20')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xee79('0x21')],'as':_0xee79('0x22'),'include':[{'model':db[_0xee79('0x23')],'as':_0xee79('0x23')}]}]})[_0xee79('0xe')](function(_0x18a9f8){if(!_0x18a9f8){throw new Error(_0xee79('0x24'));}var _0x33995d=_0x18a9f8[_0xee79('0x25')]();var _0x45d7e4={'account':_0x33995d,'message':_['merge']({'from':util[_0xee79('0x26')](_0xee79('0x27'),_0x18a9f8[_0xee79('0x10')],_0x18a9f8[_0xee79('0x28')]||_0x18a9f8[_0xee79('0x22')]['user'])},_0x5f0cf9)};return client[_0xee79('0x29')](_0xee79('0x2a'),_0x45d7e4);})['then'](function(_0x5f5930){if(_0x5f5930[_0xee79('0x2b')]){throw new Error(util['format'](_0xee79('0x2c'),_0x5f5930[_0xee79('0x2b')][_0xee79('0x2d')]||JSON[_0xee79('0x2e')](_0x5f5930[_0xee79('0x2b')])));}return!![];});}function handleError(_0x484f95,_0x2ba219,_0x5cef50){return _0x484f95[_0xee79('0x2f')](_0x2ba219||0x1f4)['send']({'message':_0x5cef50?_0x5cef50[_0xee79('0x2d')]||_0x5cef50:''});}exports[_0xee79('0x30')]=function(_0x2cbdba,_0x1873de,_0x4bb8a6){passport[_0xee79('0x1a')](_0xee79('0x31'),function(_0x54dc71,_0x72a806,_0x3fbbaa){var _0xc6a77b=_0x54dc71||_0x3fbbaa;if(_0xc6a77b){return handleError(_0x1873de,0x191,_0xc6a77b);}if(!_0x72a806){return handleError(_0x1873de,0x194,{'message':_0xee79('0x32')});}else{var _0x42e0af={'payload':{'id':_0x72a806['id'],'role':_0x72a806[_0xee79('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xee79('0x33')](_0x42e0af)[_0xee79('0xe')](function(_0x75beae){_0x1873de[_0xee79('0x34')]({'id':_0x72a806['id'],'token':_0x75beae,'statusCall':'','isAlreadyLogged':_0x72a806[_0xee79('0x35')]});});}})(_0x2cbdba,_0x1873de,_0x4bb8a6);};exports['forgot']=function(_0x45cc6b,_0x27320d){if(!_0x45cc6b[_0xee79('0x36')][_0xee79('0x28')]){return handleError(_0x27320d,0x1f4,{'message':_0xee79('0x37')});}var _0x398975=rs[_0xee79('0x38')]();_0x45cc6b[_0xee79('0x36')]['email']=_0x45cc6b[_0xee79('0x36')][_0xee79('0x28')][_0xee79('0x39')]()[_0xee79('0x3a')]();var _0x1c5095;return db[_0xee79('0x3b')]['findOne']({'where':{'id':0x1},'attributes':[_0xee79('0xc'),'blockDuration'],'raw':!![]})[_0xee79('0xe')](function(_0x1c6a1f){_0x1c5095=_0x1c6a1f;return db[_0xee79('0x3c')][_0xee79('0x20')]({'where':{'email':_0x45cc6b[_0xee79('0x36')][_0xee79('0x28')]}});})[_0xee79('0xe')](function(_0x1e1e71){if(!_0x1e1e71){throw new Error(_0xee79('0x3d'));}if(_0x1e1e71[_0xee79('0x13')]){throw new Error(_0xee79('0x3e'));}if(_0x1e1e71[_0xee79('0x1b')]){if(moment(_0x1e1e71[_0xee79('0x14')])['add'](_0x1c5095['blockDuration'],_0xee79('0x1d'))>moment()){throw new Error(_0xee79('0x3f'));}else{_0x1e1e71[_0xee79('0x1b')]=![];_0x1e1e71[_0xee79('0x14')]=null;}}_0x1e1e71[_0xee79('0x40')]=_0x398975;_0x1e1e71[_0xee79('0x41')]=Date[_0xee79('0x42')]()+0x36ee80;return _0x1e1e71[_0xee79('0x43')]();})[_0xee79('0xe')](function(){return sendServiceMail({'to':_0x45cc6b[_0xee79('0x36')]['email'],'subject':_0xee79('0x44'),'text':_0xee79('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xee79('0x46')+_0x45cc6b[_0xee79('0x47')][_0xee79('0x48')]+_0xee79('0x49')+_0x398975+'\x0a\x0a'+_0xee79('0x4a')});})[_0xee79('0xe')](function(){_0x27320d[_0xee79('0x2f')](0xc8)[_0xee79('0x4b')]({'message':_0xee79('0x4c')});})[_0xee79('0x4d')](function(_0x159ac6){return handleError(_0x27320d,0x1f4,_0x159ac6);});};exports[_0xee79('0x4e')]=function(_0xe6c8ed,_0x42de1b){return db[_0xee79('0x3c')]['find']({'where':{'resetPasswordToken':_0xe6c8ed['params'][_0xee79('0x4f')],'resetPasswordExpires':{'$gt':Date[_0xee79('0x42')]()}}})[_0xee79('0xe')](function(_0x59c1b5){if(!_0x59c1b5){throw new Error(_0xee79('0x50'));}return db['Setting'][_0xee79('0xf')]({'attributes':['id','securePassword',_0xee79('0x51'),_0xee79('0x52')]})[_0xee79('0xe')](function(_0x2d555f){if(_0x2d555f[_0xee79('0x53')])authService[_0xee79('0x54')](_0xe6c8ed[_0xee79('0x36')]['password']);if(!_0x2d555f[_0xee79('0x51')]||!_0x59c1b5[_0xee79('0x55')])return _0x59c1b5;authService[_0xee79('0x56')](_0xe6c8ed[_0xee79('0x36')]['password'],_0x59c1b5['previousPasswords'],_0x2d555f[_0xee79('0x52')]);return _0x59c1b5;})['then'](function(){_0x59c1b5[_0xee79('0x11')]=_0xe6c8ed[_0xee79('0x36')]['password'];_0x59c1b5[_0xee79('0x40')]=null;_0x59c1b5[_0xee79('0x41')]=null;return _0x59c1b5[_0xee79('0x43')]();});})[_0xee79('0xe')](function(){_0x42de1b['status'](0xc8)[_0xee79('0x4b')]({'message':_0xee79('0x57')});})[_0xee79('0x4d')](function(_0x3e7c84){return handleError(_0x42de1b,0x1f4,_0x3e7c84);});};passport['use'](_0xee79('0x31'),new LocalStrategy({'usernameField':_0xee79('0x10'),'passwordField':'password'},function(_0x2d2d7d,_0x5d421e,_0x33d80b){return localAuthenticate(db[_0xee79('0x3c')],_0x2d2d7d,_0x5d421e,_0x33d80b);})); \ No newline at end of file +var _0x5217=['body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','securePassword','enforcePasswordHistory','validatePasswordPattern','password','previousPasswords','save','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','../../components/auth/service','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','user','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','local-login','signToken','json','online','generate'];(function(_0x1efc9d,_0x3d5a57){var _0x14337a=function(_0x2d0d29){while(--_0x2d0d29){_0x1efc9d['push'](_0x1efc9d['shift']());}};_0x14337a(++_0x3d5a57);}(_0x5217,0xbb));var _0x7521=function(_0x36840b,_0x1814d8){_0x36840b=_0x36840b-0x0;var _0x3911aa=_0x5217[_0x36840b];return _0x3911aa;};'use strict';var util=require(_0x7521('0x0'));var passport=require('passport');var LocalStrategy=require(_0x7521('0x1'))['Strategy'];var jayson=require(_0x7521('0x2'));var _=require(_0x7521('0x3'));var rs=require(_0x7521('0x4'));var moment=require(_0x7521('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x7521('0x6'));var utils=require('../../config/utils');var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x1616b7,_0x258e3f,_0x5cce0c,_0x31f052){var _0x1c5215,_0x529fc3;return db[_0x7521('0x7')][_0x7521('0x8')]({'where':{'id':0x1},'attributes':[_0x7521('0x9'),_0x7521('0xa')],'raw':!![]})[_0x7521('0xb')](function(_0x3f967c){_0x1c5215=_0x3f967c;return _0x1616b7['findOne']({'attributes':['id',_0x7521('0xc'),'password',_0x7521('0xd'),_0x7521('0xe'),'disabled',_0x7521('0xf'),_0x7521('0x10'),_0x7521('0x11')],'where':{'name':_0x258e3f,'role':{'$or':[_0x7521('0x12'),'user',_0x7521('0x13')]}}});})[_0x7521('0xb')](function(_0x37e225){if(!_0x37e225||_0x37e225&&_0x37e225[_0x7521('0xc')]!==_0x258e3f){throw new Error(_0x7521('0x14'));}else{_0x529fc3=_0x37e225;return _0x529fc3;}})[_0x7521('0xb')](function(){_0x529fc3[_0x7521('0x15')](_0x5cce0c,function(_0x3890f5,_0x3a49fd){var _0x35af3c=_0x529fc3['loginAttempts']+0x1;if(_0x3890f5){return _0x31f052(_0x3890f5);}else if(!_0x3a49fd){if(_0x529fc3[_0x7521('0x16')]){return _0x31f052(null,![],{'message':_0x7521('0x14')});}else if(_0x1c5215['allowedLoginAttempts']>0x0){if(_0x529fc3[_0x7521('0xf')]){if(_0x1c5215['blockDuration']>0x0){if(moment(_0x529fc3[_0x7521('0x10')])['add'](_0x1c5215[_0x7521('0xa')],_0x7521('0x17'))>moment()){return _0x31f052(null,![],{'message':_0x7521('0x14')});}else{return utils[_0x7521('0x18')](_0x529fc3,_0x35af3c,![],null)[_0x7521('0xb')](function(){return _0x31f052(null,![],{'message':_0x7521('0x14')});});}}else{return _0x31f052(null,![],{'message':_0x7521('0x14')});}}else{if(_0x35af3c>=_0x1c5215[_0x7521('0x9')]){return utils['clearBlockUser'](_0x529fc3,0x0,!![],moment())[_0x7521('0xb')](function(){return _0x31f052(null,![],{'message':_0x7521('0x14')});});}else{return utils['clearBlockUser'](_0x529fc3,_0x35af3c,![],null)[_0x7521('0xb')](function(){return _0x31f052(null,![],{'message':_0x7521('0x14')});});}}}else{return _0x31f052(null,![],{'message':_0x7521('0x14')});}}else{if(_0x529fc3[_0x7521('0x16')]){return _0x31f052(null,![],{'message':_0x7521('0x14')});}else if(_0x1c5215[_0x7521('0x9')]>0x0){if(_0x529fc3[_0x7521('0xf')]){if(_0x1c5215[_0x7521('0xa')]>0x0){if(moment(_0x529fc3[_0x7521('0x10')])[_0x7521('0x19')](_0x1c5215[_0x7521('0xa')],'minutes')>moment()){return _0x31f052(null,![],{'message':_0x7521('0x14')});}else{return utils[_0x7521('0x18')](_0x529fc3,0x0,![],null)[_0x7521('0xb')](function(){return utils[_0x7521('0x1a')](_0x529fc3);})[_0x7521('0xb')](function(){return _0x31f052(null,_0x529fc3);});}}else{return _0x31f052(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x529fc3,0x0,![],null)[_0x7521('0xb')](function(){return utils[_0x7521('0x1a')](_0x529fc3);})[_0x7521('0xb')](function(){return _0x31f052(null,_0x529fc3);})[_0x7521('0x1b')](function(_0x27d856){return _0x31f052(null,![],_0x27d856);});}}else{if(_0x529fc3[_0x7521('0xf')]){return _0x31f052(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7521('0x1a')](_0x529fc3)['then'](function(){return _0x31f052(null,_0x529fc3);});}}}});})[_0x7521('0x1b')](function(_0x2229e3){return _0x31f052(null,![],_0x2229e3);});}function sendServiceMail(_0x1bf2aa){return db[_0x7521('0x1c')][_0x7521('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x7521('0xc'),_0x7521('0x1e')],'include':[{'model':db[_0x7521('0x1f')],'as':_0x7521('0x20'),'include':[{'model':db[_0x7521('0x21')],'as':_0x7521('0x21')}]}]})[_0x7521('0xb')](function(_0x1c9604){if(!_0x1c9604){throw new Error(_0x7521('0x22'));}var _0x30362c=_0x1c9604[_0x7521('0x23')]();var _0x394020={'account':_0x30362c,'message':_[_0x7521('0x24')]({'from':util['format'](_0x7521('0x25'),_0x1c9604[_0x7521('0xc')],_0x1c9604[_0x7521('0x1e')]||_0x1c9604[_0x7521('0x20')][_0x7521('0x26')])},_0x1bf2aa)};return client['request'](_0x7521('0x27'),_0x394020);})[_0x7521('0xb')](function(_0x4e128e){if(_0x4e128e[_0x7521('0x28')]){throw new Error(util['format'](_0x7521('0x29'),_0x4e128e[_0x7521('0x28')][_0x7521('0x2a')]||JSON[_0x7521('0x2b')](_0x4e128e[_0x7521('0x28')])));}return!![];});}function handleError(_0x123128,_0xc4072a,_0x5efb60){return _0x123128[_0x7521('0x2c')](_0xc4072a||0x1f4)['send']({'message':_0x5efb60?_0x5efb60[_0x7521('0x2a')]||_0x5efb60:''});}exports['login']=function(_0x2a9c4d,_0x594370,_0x2e8c6f){passport[_0x7521('0x15')](_0x7521('0x2d'),function(_0x2bcccc,_0x11a995,_0x40cc2f){var _0x4b5a75=_0x2bcccc||_0x40cc2f;if(_0x4b5a75){return handleError(_0x594370,0x191,_0x4b5a75);}if(!_0x11a995){return handleError(_0x594370,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x6aea57={'payload':{'id':_0x11a995['id'],'role':_0x11a995['role']},'options':{'expiresIn':0x15180}};return authService[_0x7521('0x2e')](_0x6aea57)['then'](function(_0x230513){_0x594370[_0x7521('0x2f')]({'id':_0x11a995['id'],'token':_0x230513,'statusCall':'','isAlreadyLogged':_0x11a995[_0x7521('0x30')]});});}})(_0x2a9c4d,_0x594370,_0x2e8c6f);};exports['forgot']=function(_0x2c7f77,_0x18d020){if(!_0x2c7f77['body'][_0x7521('0x1e')]){return handleError(_0x18d020,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4748de=rs[_0x7521('0x31')]();_0x2c7f77[_0x7521('0x32')][_0x7521('0x1e')]=_0x2c7f77['body'][_0x7521('0x1e')][_0x7521('0x33')]()[_0x7521('0x34')]();var _0x48d176;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x7521('0x9'),_0x7521('0xa')],'raw':!![]})['then'](function(_0x2ceb91){_0x48d176=_0x2ceb91;return db[_0x7521('0x35')][_0x7521('0x1d')]({'where':{'email':_0x2c7f77[_0x7521('0x32')][_0x7521('0x1e')]}});})[_0x7521('0xb')](function(_0x5332d0){if(!_0x5332d0){throw new Error(_0x7521('0x36'));}if(_0x5332d0[_0x7521('0x16')]){throw new Error(_0x7521('0x37'));}if(_0x5332d0['blocked']){if(moment(_0x5332d0[_0x7521('0x10')])[_0x7521('0x19')](_0x48d176['blockDuration'],_0x7521('0x17'))>moment()){throw new Error(_0x7521('0x38'));}else{_0x5332d0[_0x7521('0xf')]=![];_0x5332d0[_0x7521('0x10')]=null;}}_0x5332d0['resetPasswordToken']=_0x4748de;_0x5332d0[_0x7521('0x39')]=Date[_0x7521('0x3a')]()+0x36ee80;return _0x5332d0['save']();})['then'](function(){return sendServiceMail({'to':_0x2c7f77[_0x7521('0x32')]['email'],'subject':_0x7521('0x3b'),'text':_0x7521('0x3c')+_0x7521('0x3d')+_0x7521('0x3e')+_0x2c7f77[_0x7521('0x3f')][_0x7521('0x40')]+_0x7521('0x41')+_0x4748de+'\x0a\x0a'+_0x7521('0x42')});})[_0x7521('0xb')](function(){_0x18d020[_0x7521('0x2c')](0xc8)[_0x7521('0x43')]({'message':_0x7521('0x44')});})['catch'](function(_0x2cf684){return handleError(_0x18d020,0x1f4,_0x2cf684);});};exports[_0x7521('0x45')]=function(_0x4db0b5,_0x5ab5ab){return db[_0x7521('0x35')][_0x7521('0x1d')]({'where':{'resetPasswordToken':_0x4db0b5[_0x7521('0x46')]['token'],'resetPasswordExpires':{'$gt':Date[_0x7521('0x3a')]()}}})[_0x7521('0xb')](function(_0x3d7827){if(!_0x3d7827){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x7521('0x7')][_0x7521('0x8')]({'attributes':['id',_0x7521('0x47'),_0x7521('0x48'),'passwordHistoryLimit']})[_0x7521('0xb')](function(_0x57d371){if(_0x57d371[_0x7521('0x47')])authService[_0x7521('0x49')](_0x4db0b5[_0x7521('0x32')][_0x7521('0x4a')]);if(!_0x57d371[_0x7521('0x48')]||!_0x3d7827[_0x7521('0x4b')])return _0x3d7827;authService['validatePasswordHistory'](_0x4db0b5['body'][_0x7521('0x4a')],_0x3d7827[_0x7521('0x4b')],_0x57d371['passwordHistoryLimit']);return _0x3d7827;})['then'](function(){_0x3d7827[_0x7521('0x4a')]=_0x4db0b5[_0x7521('0x32')][_0x7521('0x4a')];_0x3d7827['resetPasswordToken']=null;_0x3d7827['resetPasswordExpires']=null;return _0x3d7827[_0x7521('0x4c')]();});})[_0x7521('0xb')](function(){_0x5ab5ab[_0x7521('0x2c')](0xc8)['send']({'message':_0x7521('0x4d')});})[_0x7521('0x1b')](function(_0x22bac1){return handleError(_0x5ab5ab,0x1f4,_0x22bac1);});};passport[_0x7521('0x4e')](_0x7521('0x2d'),new LocalStrategy({'usernameField':_0x7521('0xc'),'passwordField':_0x7521('0x4a')},function(_0x3e51c9,_0x469826,_0x1f8003){return localAuthenticate(db['User'],_0x3e51c9,_0x469826,_0x1f8003);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ed1d696..34320d3 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 _0x9809=['reset','exports','express','Router','post','/forgot','forgot','/reset/:token'];(function(_0x164ad5,_0x5850cf){var _0x4d2497=function(_0x1574a3){while(--_0x1574a3){_0x164ad5['push'](_0x164ad5['shift']());}};_0x4d2497(++_0x5850cf);}(_0x9809,0x13a));var _0x9980=function(_0x463cf3,_0x54b452){_0x463cf3=_0x463cf3-0x0;var _0x3a3b16=_0x9809[_0x463cf3];return _0x3a3b16;};'use strict';var express=require(_0x9980('0x0'));var router=express[_0x9980('0x1')]();var controller=require('./authLocal.controller');router[_0x9980('0x2')]('/',controller['login']);router['post'](_0x9980('0x3'),controller[_0x9980('0x4')]);router[_0x9980('0x2')](_0x9980('0x5'),controller[_0x9980('0x6')]);module[_0x9980('0x7')]=router; \ No newline at end of file +var _0xaa22=['reset','exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0x51e70e,_0x349d51){var _0x1f7a49=function(_0x58db08){while(--_0x58db08){_0x51e70e['push'](_0x51e70e['shift']());}};_0x1f7a49(++_0x349d51);}(_0xaa22,0xde));var _0x2aa2=function(_0x1589f4,_0x453bfd){_0x1589f4=_0x1589f4-0x0;var _0x4ba8da=_0xaa22[_0x1589f4];return _0x4ba8da;};'use strict';var express=require(_0x2aa2('0x0'));var router=express[_0x2aa2('0x1')]();var controller=require(_0x2aa2('0x2'));router[_0x2aa2('0x3')]('/',controller[_0x2aa2('0x4')]);router[_0x2aa2('0x3')](_0x2aa2('0x5'),controller[_0x2aa2('0x6')]);router[_0x2aa2('0x3')](_0x2aa2('0x7'),controller[_0x2aa2('0x8')]);module[_0x2aa2('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ea5c2cb..80b7140 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 _0x66b8=['INTEGER','exports','STRING'];(function(_0x31e11b,_0x22bd4e){var _0x1b415a=function(_0x340bde){while(--_0x340bde){_0x31e11b['push'](_0x31e11b['shift']());}};_0x1b415a(++_0x22bd4e);}(_0x66b8,0x82));var _0x866b=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x66b8[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');module[_0x866b('0x0')]={'name':{'type':Sequelize[_0x866b('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x866b('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x866b('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1eb4=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x349b6a,_0x496705){var _0x21097c=function(_0x2aaded){while(--_0x2aaded){_0x349b6a['push'](_0x349b6a['shift']());}};_0x21097c(++_0x496705);}(_0x1eb4,0x1e0));var _0x41eb=function(_0x3ba9fc,_0x378b63){_0x3ba9fc=_0x3ba9fc-0x0;var _0x42a43b=_0x1eb4[_0x3ba9fc];return _0x42a43b;};'use strict';var Sequelize=require('sequelize');module[_0x41eb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x41eb('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x41eb('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x41eb('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index ec6d90b..5829380 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 _0x62a4=['stack','name','send','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','Automation','create','body','find','params','addConditions','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x3e4566,_0x1e02e2){var _0x2eb60f=function(_0x202454){while(--_0x202454){_0x3e4566['push'](_0x3e4566['shift']());}};_0x2eb60f(++_0x1e02e2);}(_0x62a4,0x12a));var _0x462a=function(_0x3aa657,_0x14a170){_0x3aa657=_0x3aa657-0x0;var _0x2802c7=_0x62a4[_0x3aa657];return _0x2802c7;};'use strict';var emlformat=require(_0x462a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x462a('0x1'));var rp=require('request-promise');var moment=require(_0x462a('0x2'));var BPromise=require(_0x462a('0x3'));var Mustache=require(_0x462a('0x4'));var util=require('util');var path=require(_0x462a('0x5'));var sox=require(_0x462a('0x6'));var csv=require(_0x462a('0x7'));var ejs=require(_0x462a('0x8'));var fs=require('fs');var fs_extra=require(_0x462a('0x9'));var _=require(_0x462a('0xa'));var squel=require(_0x462a('0xb'));var crypto=require(_0x462a('0xc'));var jsforce=require(_0x462a('0xd'));var deskjs=require(_0x462a('0xe'));var toCsv=require(_0x462a('0x7'));var querystring=require('querystring');var Papa=require(_0x462a('0xf'));var Redis=require(_0x462a('0x10'));var authService=require(_0x462a('0x11'));var qs=require(_0x462a('0x12'));var as=require(_0x462a('0x13'));var hardwareService=require(_0x462a('0x14'));var logger=require(_0x462a('0x15'))('api');var utils=require(_0x462a('0x16'));var config=require(_0x462a('0x17'));var licenseUtil=require(_0x462a('0x18'));var db=require(_0x462a('0x19'))['db'];function respondWithStatusCode(_0xa1274c,_0x546900){_0x546900=_0x546900||0xcc;return function(_0x59b2a0){if(_0x59b2a0){return _0xa1274c['sendStatus'](_0x546900);}return _0xa1274c[_0x462a('0x1a')](_0x546900)[_0x462a('0x1b')]();};}function respondWithResult(_0xf5be0a,_0xe03461){_0xe03461=_0xe03461||0xc8;return function(_0x30fb49){if(_0x30fb49){return _0xf5be0a['status'](_0xe03461)[_0x462a('0x1c')](_0x30fb49);}};}function respondWithFilteredResult(_0xb47446,_0x4640d9){return function(_0x36a62e){if(_0x36a62e){var _0x1faeac=typeof _0x4640d9[_0x462a('0x1d')]===_0x462a('0x1e')&&typeof _0x4640d9[_0x462a('0x1f')]==='undefined';var _0x1dabe4=_0x36a62e['count'];var _0x93723=_0x1faeac?0x0:_0x4640d9[_0x462a('0x1d')];var _0x3ed282=_0x1faeac?_0x36a62e[_0x462a('0x20')]:_0x4640d9[_0x462a('0x1d')]+_0x4640d9['limit'];var _0x404f4f;if(_0x3ed282>=_0x1dabe4){_0x3ed282=_0x1dabe4;_0x404f4f=0xc8;}else{_0x404f4f=0xce;}_0xb47446[_0x462a('0x1a')](_0x404f4f);return _0xb47446[_0x462a('0x21')]('Content-Range',_0x93723+'-'+_0x3ed282+'/'+_0x1dabe4)['json'](_0x36a62e);}return null;};}function patchUpdates(_0x4ca2c0){return function(_0x3ea68e){try{jsonpatch[_0x462a('0x22')](_0x3ea68e,_0x4ca2c0,!![]);}catch(_0x196480){return BPromise[_0x462a('0x23')](_0x196480);}return _0x3ea68e[_0x462a('0x24')]();};}function saveUpdates(_0x3ef76e,_0x36df62){return function(_0x23ce6a){if(_0x23ce6a){return _0x23ce6a[_0x462a('0x25')](_0x3ef76e)[_0x462a('0x26')](function(_0x39db6c){return _0x39db6c;});}return null;};}function removeEntity(_0x104ee9,_0x3216ab){return function(_0x3595e1){if(_0x3595e1){return _0x3595e1[_0x462a('0x27')]()[_0x462a('0x26')](function(){_0x104ee9[_0x462a('0x1a')](0xcc)[_0x462a('0x1b')]();});}};}function handleEntityNotFound(_0x4c6dec,_0x1180af){return function(_0x5ca358){if(!_0x5ca358){_0x4c6dec[_0x462a('0x28')](0x194);}return _0x5ca358;};}function handleError(_0x2cb301,_0x4b40a3){_0x4b40a3=_0x4b40a3||0x1f4;return function(_0x1bcf0f){logger[_0x462a('0x29')](_0x1bcf0f[_0x462a('0x2a')]);if(_0x1bcf0f[_0x462a('0x2b')]){delete _0x1bcf0f['name'];}_0x2cb301[_0x462a('0x1a')](_0x4b40a3)[_0x462a('0x2c')](_0x1bcf0f);};}exports['index']=function(_0x38181f,_0xca9bd7){var _0x1feb7a={},_0x57c4d4={},_0x2904a4={'count':0x0,'rows':[]};var _0x4a9625=_['map'](db['Automation'][_0x462a('0x2d')],function(_0x1560be){return{'name':_0x1560be['fieldName'],'type':_0x1560be[_0x462a('0x2e')][_0x462a('0x2f')]};});_0x57c4d4['model']=_[_0x462a('0x30')](_0x4a9625,_0x462a('0x2b'));_0x57c4d4[_0x462a('0x31')]=_['keys'](_0x38181f[_0x462a('0x31')]);_0x57c4d4[_0x462a('0x32')]=_['intersection'](_0x57c4d4[_0x462a('0x33')],_0x57c4d4[_0x462a('0x31')]);_0x1feb7a[_0x462a('0x34')]=_[_0x462a('0x35')](_0x57c4d4[_0x462a('0x33')],qs[_0x462a('0x36')](_0x38181f[_0x462a('0x31')][_0x462a('0x36')]));_0x1feb7a[_0x462a('0x34')]=_0x1feb7a[_0x462a('0x34')][_0x462a('0x37')]?_0x1feb7a[_0x462a('0x34')]:_0x57c4d4[_0x462a('0x33')];if(!_0x38181f[_0x462a('0x31')][_0x462a('0x38')](_0x462a('0x39'))){_0x1feb7a['limit']=qs['limit'](_0x38181f[_0x462a('0x31')][_0x462a('0x1f')]);_0x1feb7a['offset']=qs[_0x462a('0x1d')](_0x38181f['query'][_0x462a('0x1d')]);}_0x1feb7a[_0x462a('0x3a')]=qs[_0x462a('0x3b')](_0x38181f[_0x462a('0x31')][_0x462a('0x3b')]);_0x1feb7a['where']=qs[_0x462a('0x32')](_[_0x462a('0x3c')](_0x38181f['query'],_0x57c4d4[_0x462a('0x32')]),_0x4a9625);if(_0x38181f[_0x462a('0x31')][_0x462a('0x3d')]){_0x1feb7a['where']=_[_0x462a('0x3e')](_0x1feb7a[_0x462a('0x3f')],{'$or':_['map'](_0x4a9625,function(_0x3971cd){if(_0x3971cd['type']!==_0x462a('0x40')){var _0x406eb6={};_0x406eb6[_0x3971cd[_0x462a('0x2b')]]={'$like':'%'+_0x38181f['query'][_0x462a('0x3d')]+'%'};return _0x406eb6;}})});}_0x1feb7a=_[_0x462a('0x3e')]({},_0x1feb7a,_0x38181f[_0x462a('0x41')]);var _0x56a173={'where':_0x1feb7a[_0x462a('0x3f')]};return db['Automation'][_0x462a('0x20')](_0x56a173)[_0x462a('0x26')](function(_0x158885){_0x2904a4[_0x462a('0x20')]=_0x158885;if(_0x38181f[_0x462a('0x31')][_0x462a('0x42')]){_0x1feb7a[_0x462a('0x43')]=[{'all':!![]}];}return db['Automation'][_0x462a('0x44')](_0x1feb7a);})[_0x462a('0x26')](function(_0x1ea4dc){_0x2904a4[_0x462a('0x45')]=_0x1ea4dc;return _0x2904a4;})[_0x462a('0x26')](respondWithFilteredResult(_0xca9bd7,_0x1feb7a))[_0x462a('0x46')](handleError(_0xca9bd7,null));};exports['show']=function(_0x2926d2,_0x29346f){var _0x2acef6={'raw':![],'where':{'id':_0x2926d2['params']['id']}},_0x1a3f21={};_0x1a3f21[_0x462a('0x33')]=_[_0x462a('0x47')](db[_0x462a('0x48')][_0x462a('0x2d')]);_0x1a3f21[_0x462a('0x31')]=_[_0x462a('0x47')](_0x2926d2[_0x462a('0x31')]);_0x1a3f21[_0x462a('0x32')]=_[_0x462a('0x35')](_0x1a3f21[_0x462a('0x33')],_0x1a3f21[_0x462a('0x31')]);_0x2acef6[_0x462a('0x34')]=_[_0x462a('0x35')](_0x1a3f21[_0x462a('0x33')],qs[_0x462a('0x36')](_0x2926d2[_0x462a('0x31')]['fields']));_0x2acef6[_0x462a('0x34')]=_0x2acef6['attributes'][_0x462a('0x37')]?_0x2acef6[_0x462a('0x34')]:_0x1a3f21[_0x462a('0x33')];if(_0x2926d2[_0x462a('0x31')]['includeAll']){_0x2acef6[_0x462a('0x43')]=[{'all':!![]}];}_0x2acef6=_[_0x462a('0x3e')]({},_0x2acef6,_0x2926d2['options']);return db[_0x462a('0x48')]['find'](_0x2acef6)[_0x462a('0x26')](handleEntityNotFound(_0x29346f,null))[_0x462a('0x26')](respondWithResult(_0x29346f,null))[_0x462a('0x46')](handleError(_0x29346f,null));};exports[_0x462a('0x49')]=function(_0x5051a4,_0x5ce168){return db['Automation']['create'](_0x5051a4[_0x462a('0x4a')],{})[_0x462a('0x26')](respondWithResult(_0x5ce168,0xc9))[_0x462a('0x46')](handleError(_0x5ce168,null));};exports[_0x462a('0x25')]=function(_0x5029f9,_0x1acbc6){if(_0x5029f9['body']['id']){delete _0x5029f9[_0x462a('0x4a')]['id'];}return db[_0x462a('0x48')][_0x462a('0x4b')]({'where':{'id':_0x5029f9[_0x462a('0x4c')]['id']}})[_0x462a('0x26')](handleEntityNotFound(_0x1acbc6,null))['then'](saveUpdates(_0x5029f9[_0x462a('0x4a')],null))[_0x462a('0x26')](respondWithResult(_0x1acbc6,null))[_0x462a('0x46')](handleError(_0x1acbc6,null));};exports[_0x462a('0x27')]=function(_0x5196d5,_0xca4f97){return db[_0x462a('0x48')][_0x462a('0x4b')]({'where':{'id':_0x5196d5[_0x462a('0x4c')]['id']}})[_0x462a('0x26')](handleEntityNotFound(_0xca4f97,null))['then'](removeEntity(_0xca4f97,null))['catch'](handleError(_0xca4f97,null));};exports['addConditions']=function(_0x17c557,_0x317fb6,_0x368dd4){return db['Condition']['find']({'where':{'id':_0x17c557[_0x462a('0x4c')]['id']}})[_0x462a('0x26')](handleEntityNotFound(_0x317fb6,null))[_0x462a('0x26')](function(_0x32909e){if(_0x32909e){return _0x32909e[_0x462a('0x4d')](_0x17c557['body'][_0x462a('0x4e')],_[_0x462a('0x4f')](_0x17c557[_0x462a('0x4a')],[_0x462a('0x4e'),'id'])||{});}})[_0x462a('0x26')](respondWithResult(_0x317fb6,null))[_0x462a('0x46')](handleError(_0x317fb6,null));};exports[_0x462a('0x50')]=function(_0x2aa8fc,_0x3bb9de,_0x921c6f){var _0x34958c={};var _0x412d37={};var _0x1b0e71;var _0x4a92f4;return db[_0x462a('0x48')][_0x462a('0x51')]({'where':{'id':_0x2aa8fc[_0x462a('0x4c')]['id']}})[_0x462a('0x26')](handleEntityNotFound(_0x3bb9de,null))[_0x462a('0x26')](function(_0x1ae0dc){if(_0x1ae0dc){_0x1b0e71=_0x1ae0dc;_0x412d37[_0x462a('0x33')]=_[_0x462a('0x47')](db['Condition'][_0x462a('0x2d')]);_0x412d37[_0x462a('0x31')]=_[_0x462a('0x47')](_0x2aa8fc[_0x462a('0x31')]);_0x412d37[_0x462a('0x32')]=_[_0x462a('0x35')](_0x412d37[_0x462a('0x33')],_0x412d37[_0x462a('0x31')]);_0x34958c[_0x462a('0x34')]=_[_0x462a('0x35')](_0x412d37['model'],qs[_0x462a('0x36')](_0x2aa8fc[_0x462a('0x31')][_0x462a('0x36')]));_0x34958c[_0x462a('0x34')]=_0x34958c[_0x462a('0x34')]['length']?_0x34958c[_0x462a('0x34')]:_0x412d37[_0x462a('0x33')];_0x34958c[_0x462a('0x3a')]=qs[_0x462a('0x3b')](_0x2aa8fc[_0x462a('0x31')][_0x462a('0x3b')]);_0x34958c[_0x462a('0x3f')]=qs[_0x462a('0x32')](_[_0x462a('0x3c')](_0x2aa8fc['query'],_0x412d37['filters']));if(_0x2aa8fc['query'][_0x462a('0x3d')]){_0x34958c[_0x462a('0x3f')]=_[_0x462a('0x3e')](_0x34958c[_0x462a('0x3f')],{'$or':_[_0x462a('0x30')](_0x34958c[_0x462a('0x34')],function(_0x57cf22){var _0x472b9c={};_0x472b9c[_0x57cf22]={'$like':'%'+_0x2aa8fc['query'][_0x462a('0x3d')]+'%'};return _0x472b9c;})});}_0x34958c=_[_0x462a('0x3e')]({},_0x34958c,_0x2aa8fc[_0x462a('0x41')]);return _0x1b0e71['getConditions'](_0x34958c);}})[_0x462a('0x26')](function(_0x48684e){if(_0x48684e){_0x4a92f4=_0x48684e[_0x462a('0x37')];if(!_0x2aa8fc[_0x462a('0x31')][_0x462a('0x38')](_0x462a('0x39'))){_0x34958c[_0x462a('0x1f')]=qs['limit'](_0x2aa8fc[_0x462a('0x31')][_0x462a('0x1f')]);_0x34958c[_0x462a('0x1d')]=qs[_0x462a('0x1d')](_0x2aa8fc['query']['offset']);}return _0x1b0e71[_0x462a('0x50')](_0x34958c);}})['then'](function(_0x185ef6){if(_0x185ef6){return _0x185ef6?{'count':_0x4a92f4,'rows':_0x185ef6}:null;}})[_0x462a('0x26')](respondWithResult(_0x3bb9de,null))[_0x462a('0x46')](handleError(_0x3bb9de,null));};exports[_0x462a('0x52')]=function(_0x23ee03,_0x2ae3ce,_0x4d8ae5){return db[_0x462a('0x53')][_0x462a('0x4b')]({'where':{'id':_0x23ee03['params']['id']}})[_0x462a('0x26')](handleEntityNotFound(_0x2ae3ce,null))[_0x462a('0x26')](function(_0x32bdfc){if(_0x32bdfc){return _0x32bdfc[_0x462a('0x52')](_0x23ee03[_0x462a('0x4a')][_0x462a('0x4e')],_[_0x462a('0x4f')](_0x23ee03['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2ae3ce,null))['catch'](handleError(_0x2ae3ce,null));};exports[_0x462a('0x54')]=function(_0xf96703,_0x15387b,_0x345b00){var _0x3af218={};var _0x4aa69a={};var _0x43bfad;var _0x2cbe70;return db[_0x462a('0x48')][_0x462a('0x51')]({'where':{'id':_0xf96703[_0x462a('0x4c')]['id']}})[_0x462a('0x26')](handleEntityNotFound(_0x15387b,null))[_0x462a('0x26')](function(_0x44c57c){if(_0x44c57c){_0x43bfad=_0x44c57c;_0x4aa69a[_0x462a('0x33')]=_[_0x462a('0x47')](db['Action'][_0x462a('0x2d')]);_0x4aa69a['query']=_[_0x462a('0x47')](_0xf96703[_0x462a('0x31')]);_0x4aa69a[_0x462a('0x32')]=_[_0x462a('0x35')](_0x4aa69a['model'],_0x4aa69a[_0x462a('0x31')]);_0x3af218['attributes']=_['intersection'](_0x4aa69a['model'],qs[_0x462a('0x36')](_0xf96703[_0x462a('0x31')]['fields']));_0x3af218[_0x462a('0x34')]=_0x3af218[_0x462a('0x34')][_0x462a('0x37')]?_0x3af218[_0x462a('0x34')]:_0x4aa69a[_0x462a('0x33')];_0x3af218['order']=qs[_0x462a('0x3b')](_0xf96703[_0x462a('0x31')][_0x462a('0x3b')]);_0x3af218['where']=qs['filters'](_['pick'](_0xf96703[_0x462a('0x31')],_0x4aa69a[_0x462a('0x32')]));if(_0xf96703[_0x462a('0x31')]['filter']){_0x3af218['where']=_[_0x462a('0x3e')](_0x3af218[_0x462a('0x3f')],{'$or':_['map'](_0x3af218[_0x462a('0x34')],function(_0x449d72){var _0x7ceeeb={};_0x7ceeeb[_0x449d72]={'$like':'%'+_0xf96703[_0x462a('0x31')]['filter']+'%'};return _0x7ceeeb;})});}_0x3af218=_[_0x462a('0x3e')]({},_0x3af218,_0xf96703[_0x462a('0x41')]);return _0x43bfad['getActions'](_0x3af218);}})['then'](function(_0x22e337){if(_0x22e337){_0x2cbe70=_0x22e337['length'];if(!_0xf96703[_0x462a('0x31')][_0x462a('0x38')](_0x462a('0x39'))){_0x3af218[_0x462a('0x1f')]=qs[_0x462a('0x1f')](_0xf96703[_0x462a('0x31')][_0x462a('0x1f')]);_0x3af218['offset']=qs['offset'](_0xf96703[_0x462a('0x31')][_0x462a('0x1d')]);}return _0x43bfad[_0x462a('0x54')](_0x3af218);}})[_0x462a('0x26')](function(_0x3a5951){if(_0x3a5951){return _0x3a5951?{'count':_0x2cbe70,'rows':_0x3a5951}:null;}})[_0x462a('0x26')](respondWithResult(_0x15387b,null))[_0x462a('0x46')](handleError(_0x15387b,null));}; \ No newline at end of file +var _0xf4fc=['ids','getConditions','rawAttributes','addActions','Action','findOne','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','apply','reject','save','update','then','destroy','error','name','send','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','show','params','length','include','find','catch','create','body','Condition','addConditions'];(function(_0x46629b,_0x4d989f){var _0x2afd8c=function(_0x4167f8){while(--_0x4167f8){_0x46629b['push'](_0x46629b['shift']());}};_0x2afd8c(++_0x4d989f);}(_0xf4fc,0x1a6));var _0xcf4f=function(_0x2b5d38,_0x28dc7d){_0x2b5d38=_0x2b5d38-0x0;var _0x24a8e2=_0xf4fc[_0x2b5d38];return _0x24a8e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcf4f('0x0'));var jsonpatch=require(_0xcf4f('0x1'));var rp=require(_0xcf4f('0x2'));var moment=require(_0xcf4f('0x3'));var BPromise=require(_0xcf4f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcf4f('0x5'));var sox=require(_0xcf4f('0x6'));var csv=require('to-csv');var ejs=require(_0xcf4f('0x7'));var fs=require('fs');var fs_extra=require(_0xcf4f('0x8'));var _=require(_0xcf4f('0x9'));var squel=require(_0xcf4f('0xa'));var crypto=require(_0xcf4f('0xb'));var jsforce=require(_0xcf4f('0xc'));var deskjs=require(_0xcf4f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcf4f('0xe'));var Papa=require(_0xcf4f('0xf'));var Redis=require(_0xcf4f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf4f('0x11'));var hardwareService=require(_0xcf4f('0x12'));var logger=require(_0xcf4f('0x13'))('api');var utils=require(_0xcf4f('0x14'));var config=require(_0xcf4f('0x15'));var licenseUtil=require(_0xcf4f('0x16'));var db=require(_0xcf4f('0x17'))['db'];function respondWithStatusCode(_0x49f034,_0xc370a5){_0xc370a5=_0xc370a5||0xcc;return function(_0x17398b){if(_0x17398b){return _0x49f034[_0xcf4f('0x18')](_0xc370a5);}return _0x49f034['status'](_0xc370a5)[_0xcf4f('0x19')]();};}function respondWithResult(_0x23b451,_0x42a272){_0x42a272=_0x42a272||0xc8;return function(_0x2d993c){if(_0x2d993c){return _0x23b451['status'](_0x42a272)[_0xcf4f('0x1a')](_0x2d993c);}};}function respondWithFilteredResult(_0x35179f,_0x3fd8fe){return function(_0xac86){if(_0xac86){var _0x15bd16=typeof _0x3fd8fe['offset']===_0xcf4f('0x1b')&&typeof _0x3fd8fe[_0xcf4f('0x1c')]==='undefined';var _0x143084=_0xac86['count'];var _0x4e888e=_0x15bd16?0x0:_0x3fd8fe[_0xcf4f('0x1d')];var _0x3904c=_0x15bd16?_0xac86[_0xcf4f('0x1e')]:_0x3fd8fe[_0xcf4f('0x1d')]+_0x3fd8fe[_0xcf4f('0x1c')];var _0x287b9d;if(_0x3904c>=_0x143084){_0x3904c=_0x143084;_0x287b9d=0xc8;}else{_0x287b9d=0xce;}_0x35179f[_0xcf4f('0x1f')](_0x287b9d);return _0x35179f[_0xcf4f('0x20')]('Content-Range',_0x4e888e+'-'+_0x3904c+'/'+_0x143084)[_0xcf4f('0x1a')](_0xac86);}return null;};}function patchUpdates(_0x180b11){return function(_0x4d1a00){try{jsonpatch[_0xcf4f('0x21')](_0x4d1a00,_0x180b11,!![]);}catch(_0xdb3f28){return BPromise[_0xcf4f('0x22')](_0xdb3f28);}return _0x4d1a00[_0xcf4f('0x23')]();};}function saveUpdates(_0x1c577b,_0x5e29a3){return function(_0x257d68){if(_0x257d68){return _0x257d68[_0xcf4f('0x24')](_0x1c577b)[_0xcf4f('0x25')](function(_0x1af569){return _0x1af569;});}return null;};}function removeEntity(_0x482679,_0x1fa053){return function(_0x52db00){if(_0x52db00){return _0x52db00[_0xcf4f('0x26')]()[_0xcf4f('0x25')](function(){_0x482679[_0xcf4f('0x1f')](0xcc)[_0xcf4f('0x19')]();});}};}function handleEntityNotFound(_0x4e9519,_0x37dbb3){return function(_0x16ff36){if(!_0x16ff36){_0x4e9519[_0xcf4f('0x18')](0x194);}return _0x16ff36;};}function handleError(_0x348a94,_0x2fa788){_0x2fa788=_0x2fa788||0x1f4;return function(_0x1a91ab){logger[_0xcf4f('0x27')](_0x1a91ab['stack']);if(_0x1a91ab[_0xcf4f('0x28')]){delete _0x1a91ab[_0xcf4f('0x28')];}_0x348a94[_0xcf4f('0x1f')](_0x2fa788)[_0xcf4f('0x29')](_0x1a91ab);};}exports[_0xcf4f('0x2a')]=function(_0x2fa59e,_0x16bb2a){var _0x48596a={},_0x4f46a0={},_0x2e64de={'count':0x0,'rows':[]};var _0x1d3feb=_[_0xcf4f('0x2b')](db[_0xcf4f('0x2c')]['rawAttributes'],function(_0x358759){return{'name':_0x358759[_0xcf4f('0x2d')],'type':_0x358759[_0xcf4f('0x2e')][_0xcf4f('0x2f')]};});_0x4f46a0[_0xcf4f('0x30')]=_['map'](_0x1d3feb,_0xcf4f('0x28'));_0x4f46a0[_0xcf4f('0x31')]=_[_0xcf4f('0x32')](_0x2fa59e[_0xcf4f('0x31')]);_0x4f46a0[_0xcf4f('0x33')]=_[_0xcf4f('0x34')](_0x4f46a0[_0xcf4f('0x30')],_0x4f46a0[_0xcf4f('0x31')]);_0x48596a[_0xcf4f('0x35')]=_[_0xcf4f('0x34')](_0x4f46a0[_0xcf4f('0x30')],qs[_0xcf4f('0x36')](_0x2fa59e[_0xcf4f('0x31')]['fields']));_0x48596a[_0xcf4f('0x35')]=_0x48596a[_0xcf4f('0x35')]['length']?_0x48596a[_0xcf4f('0x35')]:_0x4f46a0[_0xcf4f('0x30')];if(!_0x2fa59e[_0xcf4f('0x31')][_0xcf4f('0x37')](_0xcf4f('0x38'))){_0x48596a['limit']=qs[_0xcf4f('0x1c')](_0x2fa59e['query'][_0xcf4f('0x1c')]);_0x48596a[_0xcf4f('0x1d')]=qs['offset'](_0x2fa59e[_0xcf4f('0x31')][_0xcf4f('0x1d')]);}_0x48596a[_0xcf4f('0x39')]=qs['sort'](_0x2fa59e[_0xcf4f('0x31')][_0xcf4f('0x3a')]);_0x48596a['where']=qs[_0xcf4f('0x33')](_[_0xcf4f('0x3b')](_0x2fa59e['query'],_0x4f46a0[_0xcf4f('0x33')]),_0x1d3feb);if(_0x2fa59e[_0xcf4f('0x31')][_0xcf4f('0x3c')]){_0x48596a[_0xcf4f('0x3d')]=_[_0xcf4f('0x3e')](_0x48596a[_0xcf4f('0x3d')],{'$or':_[_0xcf4f('0x2b')](_0x1d3feb,function(_0x4243e1){if(_0x4243e1['type']!=='VIRTUAL'){var _0x3ad3a1={};_0x3ad3a1[_0x4243e1['name']]={'$like':'%'+_0x2fa59e['query'][_0xcf4f('0x3c')]+'%'};return _0x3ad3a1;}})});}_0x48596a=_[_0xcf4f('0x3e')]({},_0x48596a,_0x2fa59e[_0xcf4f('0x3f')]);var _0x357f1c={'where':_0x48596a[_0xcf4f('0x3d')]};return db['Automation'][_0xcf4f('0x1e')](_0x357f1c)['then'](function(_0x5a8e7c){_0x2e64de[_0xcf4f('0x1e')]=_0x5a8e7c;if(_0x2fa59e[_0xcf4f('0x31')][_0xcf4f('0x40')]){_0x48596a['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x48596a);})['then'](function(_0x527403){_0x2e64de[_0xcf4f('0x41')]=_0x527403;return _0x2e64de;})[_0xcf4f('0x25')](respondWithFilteredResult(_0x16bb2a,_0x48596a))['catch'](handleError(_0x16bb2a,null));};exports[_0xcf4f('0x42')]=function(_0x27f90e,_0x50eb75){var _0xba0d57={'raw':![],'where':{'id':_0x27f90e[_0xcf4f('0x43')]['id']}},_0x1a1b37={};_0x1a1b37[_0xcf4f('0x30')]=_[_0xcf4f('0x32')](db['Automation']['rawAttributes']);_0x1a1b37[_0xcf4f('0x31')]=_[_0xcf4f('0x32')](_0x27f90e[_0xcf4f('0x31')]);_0x1a1b37[_0xcf4f('0x33')]=_['intersection'](_0x1a1b37[_0xcf4f('0x30')],_0x1a1b37[_0xcf4f('0x31')]);_0xba0d57[_0xcf4f('0x35')]=_[_0xcf4f('0x34')](_0x1a1b37[_0xcf4f('0x30')],qs[_0xcf4f('0x36')](_0x27f90e[_0xcf4f('0x31')][_0xcf4f('0x36')]));_0xba0d57['attributes']=_0xba0d57[_0xcf4f('0x35')][_0xcf4f('0x44')]?_0xba0d57[_0xcf4f('0x35')]:_0x1a1b37[_0xcf4f('0x30')];if(_0x27f90e[_0xcf4f('0x31')][_0xcf4f('0x40')]){_0xba0d57[_0xcf4f('0x45')]=[{'all':!![]}];}_0xba0d57=_[_0xcf4f('0x3e')]({},_0xba0d57,_0x27f90e[_0xcf4f('0x3f')]);return db['Automation'][_0xcf4f('0x46')](_0xba0d57)['then'](handleEntityNotFound(_0x50eb75,null))['then'](respondWithResult(_0x50eb75,null))[_0xcf4f('0x47')](handleError(_0x50eb75,null));};exports[_0xcf4f('0x48')]=function(_0x525beb,_0xbfa4eb){return db[_0xcf4f('0x2c')][_0xcf4f('0x48')](_0x525beb['body'],{})[_0xcf4f('0x25')](respondWithResult(_0xbfa4eb,0xc9))[_0xcf4f('0x47')](handleError(_0xbfa4eb,null));};exports[_0xcf4f('0x24')]=function(_0xadf4a3,_0x508c86){if(_0xadf4a3[_0xcf4f('0x49')]['id']){delete _0xadf4a3['body']['id'];}return db['Automation'][_0xcf4f('0x46')]({'where':{'id':_0xadf4a3['params']['id']}})['then'](handleEntityNotFound(_0x508c86,null))['then'](saveUpdates(_0xadf4a3[_0xcf4f('0x49')],null))['then'](respondWithResult(_0x508c86,null))[_0xcf4f('0x47')](handleError(_0x508c86,null));};exports[_0xcf4f('0x26')]=function(_0x2f2936,_0x370fc7){return db[_0xcf4f('0x2c')]['find']({'where':{'id':_0x2f2936[_0xcf4f('0x43')]['id']}})[_0xcf4f('0x25')](handleEntityNotFound(_0x370fc7,null))[_0xcf4f('0x25')](removeEntity(_0x370fc7,null))[_0xcf4f('0x47')](handleError(_0x370fc7,null));};exports['addConditions']=function(_0x3d9d3c,_0x5abdc4,_0x2a1d5c){return db[_0xcf4f('0x4a')]['find']({'where':{'id':_0x3d9d3c[_0xcf4f('0x43')]['id']}})[_0xcf4f('0x25')](handleEntityNotFound(_0x5abdc4,null))[_0xcf4f('0x25')](function(_0x517256){if(_0x517256){return _0x517256[_0xcf4f('0x4b')](_0x3d9d3c[_0xcf4f('0x49')][_0xcf4f('0x4c')],_['omit'](_0x3d9d3c[_0xcf4f('0x49')],['ids','id'])||{});}})[_0xcf4f('0x25')](respondWithResult(_0x5abdc4,null))[_0xcf4f('0x47')](handleError(_0x5abdc4,null));};exports[_0xcf4f('0x4d')]=function(_0x487c2c,_0x2e5bdb,_0x50e3dc){var _0x554dbd={};var _0x5cd7b9={};var _0x46c6e0;var _0x1eb09a;return db[_0xcf4f('0x2c')]['findOne']({'where':{'id':_0x487c2c['params']['id']}})[_0xcf4f('0x25')](handleEntityNotFound(_0x2e5bdb,null))[_0xcf4f('0x25')](function(_0x565cca){if(_0x565cca){_0x46c6e0=_0x565cca;_0x5cd7b9['model']=_[_0xcf4f('0x32')](db[_0xcf4f('0x4a')][_0xcf4f('0x4e')]);_0x5cd7b9[_0xcf4f('0x31')]=_['keys'](_0x487c2c[_0xcf4f('0x31')]);_0x5cd7b9[_0xcf4f('0x33')]=_[_0xcf4f('0x34')](_0x5cd7b9[_0xcf4f('0x30')],_0x5cd7b9[_0xcf4f('0x31')]);_0x554dbd['attributes']=_[_0xcf4f('0x34')](_0x5cd7b9[_0xcf4f('0x30')],qs[_0xcf4f('0x36')](_0x487c2c[_0xcf4f('0x31')][_0xcf4f('0x36')]));_0x554dbd[_0xcf4f('0x35')]=_0x554dbd[_0xcf4f('0x35')][_0xcf4f('0x44')]?_0x554dbd[_0xcf4f('0x35')]:_0x5cd7b9['model'];_0x554dbd[_0xcf4f('0x39')]=qs['sort'](_0x487c2c[_0xcf4f('0x31')]['sort']);_0x554dbd[_0xcf4f('0x3d')]=qs[_0xcf4f('0x33')](_['pick'](_0x487c2c[_0xcf4f('0x31')],_0x5cd7b9[_0xcf4f('0x33')]));if(_0x487c2c[_0xcf4f('0x31')][_0xcf4f('0x3c')]){_0x554dbd[_0xcf4f('0x3d')]=_[_0xcf4f('0x3e')](_0x554dbd['where'],{'$or':_['map'](_0x554dbd['attributes'],function(_0x3f535d){var _0x13664c={};_0x13664c[_0x3f535d]={'$like':'%'+_0x487c2c[_0xcf4f('0x31')][_0xcf4f('0x3c')]+'%'};return _0x13664c;})});}_0x554dbd=_[_0xcf4f('0x3e')]({},_0x554dbd,_0x487c2c[_0xcf4f('0x3f')]);return _0x46c6e0['getConditions'](_0x554dbd);}})[_0xcf4f('0x25')](function(_0x5cf6b0){if(_0x5cf6b0){_0x1eb09a=_0x5cf6b0[_0xcf4f('0x44')];if(!_0x487c2c[_0xcf4f('0x31')][_0xcf4f('0x37')]('nolimit')){_0x554dbd[_0xcf4f('0x1c')]=qs[_0xcf4f('0x1c')](_0x487c2c[_0xcf4f('0x31')][_0xcf4f('0x1c')]);_0x554dbd['offset']=qs[_0xcf4f('0x1d')](_0x487c2c['query'][_0xcf4f('0x1d')]);}return _0x46c6e0['getConditions'](_0x554dbd);}})[_0xcf4f('0x25')](function(_0x20f54f){if(_0x20f54f){return _0x20f54f?{'count':_0x1eb09a,'rows':_0x20f54f}:null;}})[_0xcf4f('0x25')](respondWithResult(_0x2e5bdb,null))[_0xcf4f('0x47')](handleError(_0x2e5bdb,null));};exports[_0xcf4f('0x4f')]=function(_0x21fea6,_0x24982f,_0x1b7a94){return db[_0xcf4f('0x50')]['find']({'where':{'id':_0x21fea6[_0xcf4f('0x43')]['id']}})[_0xcf4f('0x25')](handleEntityNotFound(_0x24982f,null))[_0xcf4f('0x25')](function(_0x4c9e7e){if(_0x4c9e7e){return _0x4c9e7e[_0xcf4f('0x4f')](_0x21fea6['body']['ids'],_['omit'](_0x21fea6[_0xcf4f('0x49')],[_0xcf4f('0x4c'),'id'])||{});}})[_0xcf4f('0x25')](respondWithResult(_0x24982f,null))['catch'](handleError(_0x24982f,null));};exports['getActions']=function(_0x54240c,_0x58e4c6,_0x561d74){var _0x246185={};var _0x322dcf={};var _0x3d5423;var _0xeb1afb;return db[_0xcf4f('0x2c')][_0xcf4f('0x51')]({'where':{'id':_0x54240c[_0xcf4f('0x43')]['id']}})['then'](handleEntityNotFound(_0x58e4c6,null))[_0xcf4f('0x25')](function(_0x30cf48){if(_0x30cf48){_0x3d5423=_0x30cf48;_0x322dcf[_0xcf4f('0x30')]=_[_0xcf4f('0x32')](db[_0xcf4f('0x50')][_0xcf4f('0x4e')]);_0x322dcf[_0xcf4f('0x31')]=_[_0xcf4f('0x32')](_0x54240c[_0xcf4f('0x31')]);_0x322dcf['filters']=_['intersection'](_0x322dcf[_0xcf4f('0x30')],_0x322dcf['query']);_0x246185[_0xcf4f('0x35')]=_[_0xcf4f('0x34')](_0x322dcf[_0xcf4f('0x30')],qs['fields'](_0x54240c[_0xcf4f('0x31')][_0xcf4f('0x36')]));_0x246185[_0xcf4f('0x35')]=_0x246185[_0xcf4f('0x35')][_0xcf4f('0x44')]?_0x246185[_0xcf4f('0x35')]:_0x322dcf[_0xcf4f('0x30')];_0x246185['order']=qs['sort'](_0x54240c[_0xcf4f('0x31')][_0xcf4f('0x3a')]);_0x246185[_0xcf4f('0x3d')]=qs[_0xcf4f('0x33')](_[_0xcf4f('0x3b')](_0x54240c[_0xcf4f('0x31')],_0x322dcf[_0xcf4f('0x33')]));if(_0x54240c[_0xcf4f('0x31')][_0xcf4f('0x3c')]){_0x246185['where']=_['merge'](_0x246185[_0xcf4f('0x3d')],{'$or':_[_0xcf4f('0x2b')](_0x246185['attributes'],function(_0x263aef){var _0x3f89b8={};_0x3f89b8[_0x263aef]={'$like':'%'+_0x54240c['query'][_0xcf4f('0x3c')]+'%'};return _0x3f89b8;})});}_0x246185=_[_0xcf4f('0x3e')]({},_0x246185,_0x54240c[_0xcf4f('0x3f')]);return _0x3d5423[_0xcf4f('0x52')](_0x246185);}})['then'](function(_0x11063a){if(_0x11063a){_0xeb1afb=_0x11063a[_0xcf4f('0x44')];if(!_0x54240c['query'][_0xcf4f('0x37')](_0xcf4f('0x38'))){_0x246185[_0xcf4f('0x1c')]=qs['limit'](_0x54240c[_0xcf4f('0x31')][_0xcf4f('0x1c')]);_0x246185[_0xcf4f('0x1d')]=qs[_0xcf4f('0x1d')](_0x54240c[_0xcf4f('0x31')][_0xcf4f('0x1d')]);}return _0x3d5423[_0xcf4f('0x52')](_0x246185);}})[_0xcf4f('0x25')](function(_0x370d41){if(_0x370d41){return _0x370d41?{'count':_0xeb1afb,'rows':_0x370d41}:null;}})[_0xcf4f('0x25')](respondWithResult(_0x58e4c6,null))['catch'](handleError(_0x58e4c6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c0d264d..b4be085 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 _0x169e=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0x169e,0x1ac));var _0xe169=function(_0x96c0ff,_0x28108f){_0x96c0ff=_0x96c0ff-0x0;var _0x44f1ae=_0x169e[_0x96c0ff];return _0x44f1ae;};'use strict';var _=require(_0xe169('0x0'));var util=require(_0xe169('0x1'));var logger=require(_0xe169('0x2'))(_0xe169('0x3'));var moment=require(_0xe169('0x4'));var BPromise=require(_0xe169('0x5'));var rp=require(_0xe169('0x6'));var fs=require('fs');var path=require(_0xe169('0x7'));var rimraf=require('rimraf');var config=require(_0xe169('0x8'));var attributes=require(_0xe169('0x9'));module['exports']=function(_0x43626a,_0xaad0b){return _0x43626a[_0xe169('0xa')](_0xe169('0xb'),attributes,{'tableName':_0xe169('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eed=['bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations','moment'];(function(_0x27a55b,_0x14515b){var _0x2858b1=function(_0x42cf4b){while(--_0x42cf4b){_0x27a55b['push'](_0x27a55b['shift']());}};_0x2858b1(++_0x14515b);}(_0x4eed,0x185));var _0xd4ee=function(_0x457a40,_0x4f8a35){_0x457a40=_0x457a40-0x0;var _0x5c2a71=_0x4eed[_0x457a40];return _0x5c2a71;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd4ee('0x0'));var BPromise=require(_0xd4ee('0x1'));var rp=require(_0xd4ee('0x2'));var fs=require('fs');var path=require(_0xd4ee('0x3'));var rimraf=require(_0xd4ee('0x4'));var config=require(_0xd4ee('0x5'));var attributes=require(_0xd4ee('0x6'));module['exports']=function(_0x492f16,_0x4c95e){return _0x492f16[_0xd4ee('0x7')](_0xd4ee('0x8'),attributes,{'tableName':_0xd4ee('0x9'),'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 c65bb60..b83c4fd 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 _0xf4f4=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x4a0505,_0xb18f02){var _0x1744ed=function(_0x397a54){while(--_0x397a54){_0x4a0505['push'](_0x4a0505['shift']());}};_0x1744ed(++_0xb18f02);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x68fd87,_0x17f037){_0x68fd87=_0x68fd87-0x0;var _0x559470=_0xf4f4[_0x68fd87];return _0x559470;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('Automation,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});} \ No newline at end of file +var _0x32d5=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x154ee8,_0x6a112d){var _0x161bd7=function(_0x4dbe6a){while(--_0x4dbe6a){_0x154ee8['push'](_0x154ee8['shift']());}};_0x161bd7(++_0x6a112d);}(_0x32d5,0x1aa));var _0x532d=function(_0x282b10,_0x5b4899){_0x282b10=_0x282b10-0x0;var _0x58a463=_0x32d5[_0x282b10];return _0x58a463;};'use strict';var _=require(_0x532d('0x0'));var util=require(_0x532d('0x1'));var moment=require(_0x532d('0x2'));var BPromise=require(_0x532d('0x3'));var rs=require(_0x532d('0x4'));var fs=require('fs');var Redis=require(_0x532d('0x5'));var db=require(_0x532d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x532d('0x7'))(_0x532d('0x8'));var config=require('../../config/environment');var jayson=require(_0x532d('0x9'));var client=jayson[_0x532d('0xa')][_0x532d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20104e,_0x387c88,_0x5d9535){return new BPromise(function(_0x4f3d4e,_0x445220){return client['request'](_0x20104e,_0x5d9535)[_0x532d('0xc')](function(_0x23ee37){logger[_0x532d('0xd')](_0x532d('0xe'),_0x387c88,_0x532d('0xf'));logger[_0x532d('0x10')](_0x532d('0x11'),_0x387c88,_0x532d('0xf'),JSON[_0x532d('0x12')](_0x23ee37));if(_0x23ee37[_0x532d('0x13')]){if(_0x23ee37[_0x532d('0x13')][_0x532d('0x14')]===0x1f4){logger['error'](_0x532d('0xe'),_0x387c88,_0x23ee37[_0x532d('0x13')][_0x532d('0x15')]);return _0x445220(_0x23ee37[_0x532d('0x13')][_0x532d('0x15')]);}logger['error'](_0x532d('0xe'),_0x387c88,_0x23ee37['error'][_0x532d('0x15')]);return _0x4f3d4e(_0x23ee37[_0x532d('0x13')][_0x532d('0x15')]);}else{logger[_0x532d('0xd')](_0x532d('0xe'),_0x387c88,_0x532d('0xf'));_0x4f3d4e(_0x23ee37[_0x532d('0x16')][_0x532d('0x15')]);}})[_0x532d('0x17')](function(_0x562638){logger[_0x532d('0x13')](_0x532d('0xe'),_0x387c88,_0x562638);_0x445220(_0x562638);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index beb8fe5..6874bfc 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 _0x0624=['addConditions','addActions','put','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','getConditions','/:id/actions','getActions','post','create','/:id/conditions'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x0624,0x132));var _0x4062=function(_0x3b7952,_0x43dffa){_0x3b7952=_0x3b7952-0x0;var _0x271a1b=_0x0624[_0x3b7952];return _0x271a1b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4062('0x0'));var router=express[_0x4062('0x1')]();var fs_extra=require(_0x4062('0x2'));var auth=require(_0x4062('0x3'));var interaction=require(_0x4062('0x4'));var config=require(_0x4062('0x5'));var controller=require('./automation.controller');router['get']('/',auth[_0x4062('0x6')](),controller[_0x4062('0x7')]);router[_0x4062('0x8')](_0x4062('0x9'),auth[_0x4062('0x6')](),controller['show']);router[_0x4062('0x8')]('/:id/conditions',auth[_0x4062('0x6')](),controller[_0x4062('0xa')]);router[_0x4062('0x8')](_0x4062('0xb'),auth[_0x4062('0x6')](),controller[_0x4062('0xc')]);router[_0x4062('0xd')]('/',auth['isAuthenticated'](),controller[_0x4062('0xe')]);router['post'](_0x4062('0xf'),auth[_0x4062('0x6')](),controller[_0x4062('0x10')]);router[_0x4062('0xd')](_0x4062('0xb'),auth['isAuthenticated'](),controller[_0x4062('0x11')]);router[_0x4062('0x12')]('/:id',auth[_0x4062('0x6')](),controller[_0x4062('0x13')]);router[_0x4062('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4062('0x15')]);module[_0x4062('0x16')]=router; \ No newline at end of file +var _0x689c=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x5464e0,_0x19ec7f){var _0x4416e7=function(_0x3d500d){while(--_0x3d500d){_0x5464e0['push'](_0x5464e0['shift']());}};_0x4416e7(++_0x19ec7f);}(_0x689c,0x9e));var _0xc689=function(_0x5edbc5,_0x4d2066){_0x5edbc5=_0x5edbc5-0x0;var _0xb16247=_0x689c[_0x5edbc5];return _0xb16247;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc689('0x0'));var timeout=require(_0xc689('0x1'));var express=require(_0xc689('0x2'));var router=express[_0xc689('0x3')]();var fs_extra=require(_0xc689('0x4'));var auth=require(_0xc689('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc689('0x6'));var controller=require('./automation.controller');router['get']('/',auth[_0xc689('0x7')](),controller[_0xc689('0x8')]);router[_0xc689('0x9')](_0xc689('0xa'),auth[_0xc689('0x7')](),controller['show']);router[_0xc689('0x9')](_0xc689('0xb'),auth[_0xc689('0x7')](),controller['getConditions']);router[_0xc689('0x9')](_0xc689('0xc'),auth[_0xc689('0x7')](),controller[_0xc689('0xd')]);router[_0xc689('0xe')]('/',auth[_0xc689('0x7')](),controller[_0xc689('0xf')]);router[_0xc689('0xe')](_0xc689('0xb'),auth[_0xc689('0x7')](),controller[_0xc689('0x10')]);router['post'](_0xc689('0xc'),auth['isAuthenticated'](),controller[_0xc689('0x11')]);router[_0xc689('0x12')](_0xc689('0xa'),auth['isAuthenticated'](),controller[_0xc689('0x13')]);router[_0xc689('0x14')]('/:id',auth[_0xc689('0x7')](),controller[_0xc689('0x15')]);module[_0xc689('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 111376d..b0cd64a 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 _0xfdc6=['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)','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','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)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x57684e,_0x3cb202){var _0x4c3d80=function(_0x556ba3){while(--_0x556ba3){_0x57684e['push'](_0x57684e['shift']());}};_0x4c3d80(++_0x3cb202);}(_0xfdc6,0xf3));var _0x6fdc=function(_0x5124d2,_0x3400cb){_0x5124d2=_0x5124d2-0x0;var _0x361478=_0xfdc6[_0x5124d2];return _0x361478;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6fdc('0x0')],'unique':_0x6fdc('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6fdc('0x2')),'allowNull':![],'defaultValue':_0x6fdc('0x2')},'description':{'type':Sequelize[_0x6fdc('0x0')]},'active':{'type':Sequelize[_0x6fdc('0x3')],'defaultValue':0x0,'comment':_0x6fdc('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x6fdc('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x6fdc('0x6')](0x3)[_0x6fdc('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6fdc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6fdc('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x6fdc('0x6')](0x3)[_0x6fdc('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6fdc('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6fdc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x6fdc('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6fdc('0xd')},'dialTimezone':{'type':Sequelize[_0x6fdc('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x6fdc('0xe')]('always','never',_0x6fdc('0xf')),'defaultValue':_0x6fdc('0x10')},'dialAMDActive':{'type':Sequelize[_0x6fdc('0x3')],'defaultValue':0x0,'comment':_0x6fdc('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x6fdc('0x6')](0x9)[_0x6fdc('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x6fdc('0x6')](0x9)[_0x6fdc('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6fdc('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6fdc('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6fdc('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x6fdc('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6fdc('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x6fdc('0x6')](0x9)[_0x6fdc('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6fdc('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6fdc('0x6')](0x9)[_0x6fdc('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6fdc('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6fdc('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6fdc('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6fdc('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6fdc('0x6')](0x9)[_0x6fdc('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6fdc('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6fdc('0xe')](_0x6fdc('0x1a'),_0x6fdc('0x1b')),'defaultValue':_0x6fdc('0x1a')},'dialPrefix':{'type':Sequelize[_0x6fdc('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6fdc('0x6')](0x3)[_0x6fdc('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6fdc('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x6fdc('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6fdc('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6fdc('0x6')](0x3)[_0x6fdc('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6fdc('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6fdc('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6fdc('0x6')](0x3)[_0x6fdc('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6fdc('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x6fdc('0x6')](0x3)[_0x6fdc('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6fdc('0x6')](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6fdc('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6fdc('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6fdc('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6fdc('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6fdc('0x27')}}; \ No newline at end of file +var _0xffe1=['exports','STRING','name','ENUM','ivr','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)','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,*,*,*','never','onlyIfOpen','always','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x3a47aa,_0x19d90e){var _0x146448=function(_0x534a7e){while(--_0x534a7e){_0x3a47aa['push'](_0x3a47aa['shift']());}};_0x146448(++_0x19d90e);}(_0xffe1,0xcc));var _0x1ffe=function(_0x4aadef,_0x4e1aad){_0x4aadef=_0x4aadef-0x0;var _0x5cd779=_0xffe1[_0x4aadef];return _0x5cd779;};'use strict';var Sequelize=require(_0x1ffe('0x0'));module[_0x1ffe('0x1')]={'name':{'type':Sequelize[_0x1ffe('0x2')],'unique':_0x1ffe('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1ffe('0x4')](_0x1ffe('0x5')),'allowNull':![],'defaultValue':_0x1ffe('0x5')},'description':{'type':Sequelize[_0x1ffe('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1ffe('0x6')},'limitCalls':{'type':Sequelize[_0x1ffe('0x7')](0x4)[_0x1ffe('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1ffe('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1ffe('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ffe('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ffe('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1ffe('0x7')](0x5)[_0x1ffe('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ffe('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ffe('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1ffe('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ffe('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'defaultValue':0x3,'comment':_0x1ffe('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1ffe('0x7')](0x5)[_0x1ffe('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1ffe('0x10')},'dialTimezone':{'type':Sequelize[_0x1ffe('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1ffe('0x2')],'defaultValue':_0x1ffe('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x1ffe('0x4')]('always',_0x1ffe('0x12'),_0x1ffe('0x13')),'defaultValue':_0x1ffe('0x14')},'dialAMDActive':{'type':Sequelize[_0x1ffe('0x15')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1ffe('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1ffe('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x1ffe('0x7')](0x9)[_0x1ffe('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1ffe('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1ffe('0x7')](0x9)[_0x1ffe('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1ffe('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1ffe('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ffe('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x1ffe('0x7')](0x9)[_0x1ffe('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1ffe('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1ffe('0x7')](0x9)[_0x1ffe('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1ffe('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1ffe('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1ffe('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1ffe('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1ffe('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ffe('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1ffe('0x4')]('DESC',_0x1ffe('0x1f')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1ffe('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ffe('0x20')},'dialCutDigit':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ffe('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1ffe('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ffe('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ffe('0x23')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x1ffe('0x7')](0x5)[_0x1ffe('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1ffe('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ffe('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1ffe('0x7')](0x5)[_0x1ffe('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ffe('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ffe('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1ffe('0x7')](0x5)[_0x1ffe('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ffe('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1ffe('0x7')](0x3)[_0x1ffe('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1ffe('0x7')](0x5)[_0x1ffe('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ffe('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7326818..78ce7c5 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 _0x9532=['fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','error','stack','name','map','Campaign','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','merge','options','find','catch','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','getHoppers','findOne','CampaignId','CmHopper','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','fromQuery','ContactId','NOW()','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','h.id','ci.item','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0x9532,0x8c));var _0x2953=function(_0x5dbc38,_0xabff8a){_0x5dbc38=_0x5dbc38-0x0;var _0x327c30=_0x9532[_0x5dbc38];return _0x327c30;};'use strict';var emlformat=require(_0x2953('0x0'));var rimraf=require(_0x2953('0x1'));var zipdir=require(_0x2953('0x2'));var jsonpatch=require(_0x2953('0x3'));var rp=require(_0x2953('0x4'));var moment=require(_0x2953('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2953('0x6'));var util=require(_0x2953('0x7'));var path=require('path');var sox=require(_0x2953('0x8'));var csv=require('to-csv');var ejs=require(_0x2953('0x9'));var fs=require('fs');var fs_extra=require(_0x2953('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2953('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2953('0xc'));var querystring=require('querystring');var Papa=require(_0x2953('0xd'));var Redis=require(_0x2953('0xe'));var authService=require(_0x2953('0xf'));var qs=require(_0x2953('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2953('0x11'));var logger=require(_0x2953('0x12'))(_0x2953('0x13'));var utils=require(_0x2953('0x14'));var config=require(_0x2953('0x15'));var licenseUtil=require(_0x2953('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x480cae,_0x41f2be){_0x41f2be=_0x41f2be||0xcc;return function(_0x13c8a8){if(_0x13c8a8){return _0x480cae['sendStatus'](_0x41f2be);}return _0x480cae[_0x2953('0x17')](_0x41f2be)['end']();};}function respondWithResult(_0x4f15fc,_0x58f5ca){_0x58f5ca=_0x58f5ca||0xc8;return function(_0x4e1e86){if(_0x4e1e86){return _0x4f15fc[_0x2953('0x17')](_0x58f5ca)[_0x2953('0x18')](_0x4e1e86);}};}function respondWithFilteredResult(_0x2ca196,_0x16dbf5){return function(_0x1305c8){if(_0x1305c8){var _0x4b9da7=typeof _0x16dbf5[_0x2953('0x19')]===_0x2953('0x1a')&&typeof _0x16dbf5[_0x2953('0x1b')]===_0x2953('0x1a');var _0x25dad2=_0x1305c8[_0x2953('0x1c')];var _0x359e81=_0x4b9da7?0x0:_0x16dbf5[_0x2953('0x19')];var _0x52e292=_0x4b9da7?_0x1305c8[_0x2953('0x1c')]:_0x16dbf5[_0x2953('0x19')]+_0x16dbf5[_0x2953('0x1b')];var _0x288d6c;if(_0x52e292>=_0x25dad2){_0x52e292=_0x25dad2;_0x288d6c=0xc8;}else{_0x288d6c=0xce;}_0x2ca196[_0x2953('0x17')](_0x288d6c);return _0x2ca196[_0x2953('0x1d')](_0x2953('0x1e'),_0x359e81+'-'+_0x52e292+'/'+_0x25dad2)[_0x2953('0x18')](_0x1305c8);}return null;};}function patchUpdates(_0x435d94){return function(_0x68d656){try{jsonpatch[_0x2953('0x1f')](_0x68d656,_0x435d94,!![]);}catch(_0x236a10){return BPromise[_0x2953('0x20')](_0x236a10);}return _0x68d656[_0x2953('0x21')]();};}function saveUpdates(_0x142beb,_0x563d81){return function(_0x1a1240){if(_0x1a1240){return _0x1a1240[_0x2953('0x22')](_0x142beb)['then'](function(_0x4f3118){return _0x4f3118;});}return null;};}function removeEntity(_0x301c35,_0x236694){return function(_0x25857e){if(_0x25857e){return _0x25857e[_0x2953('0x23')]()[_0x2953('0x24')](function(){var _0x1ef000=_0x25857e[_0x2953('0x25')]({'plain':!![]});var _0x3a7ae5=_0x2953('0x26');return db[_0x2953('0x27')]['destroy']({'where':{'type':_0x3a7ae5,'resourceId':_0x1ef000['id']}})[_0x2953('0x24')](function(){return _0x25857e;});})['then'](function(){_0x301c35[_0x2953('0x17')](0xcc)[_0x2953('0x28')]();});}};}function handleEntityNotFound(_0x4721af,_0x763403){return function(_0x5100c3){if(!_0x5100c3){_0x4721af['sendStatus'](0x194);}return _0x5100c3;};}function handleError(_0x20e1c6,_0x1cf7f8){_0x1cf7f8=_0x1cf7f8||0x1f4;return function(_0x2309c6){logger[_0x2953('0x29')](_0x2309c6[_0x2953('0x2a')]);if(_0x2309c6[_0x2953('0x2b')]){delete _0x2309c6[_0x2953('0x2b')];}_0x20e1c6['status'](_0x1cf7f8)['send'](_0x2309c6);};}exports['index']=function(_0x5e3cc7,_0x2bfce7){var _0xbc04e4={},_0x2839ea={},_0x522fd8={'count':0x0,'rows':[]};var _0x33c0a6=_[_0x2953('0x2c')](db[_0x2953('0x2d')][_0x2953('0x2e')],function(_0x4c808b){return{'name':_0x4c808b[_0x2953('0x2f')],'type':_0x4c808b[_0x2953('0x30')][_0x2953('0x31')]};});_0x2839ea[_0x2953('0x32')]=_[_0x2953('0x2c')](_0x33c0a6,_0x2953('0x2b'));_0x2839ea['query']=_[_0x2953('0x33')](_0x5e3cc7[_0x2953('0x34')]);_0x2839ea[_0x2953('0x35')]=_[_0x2953('0x36')](_0x2839ea[_0x2953('0x32')],_0x2839ea[_0x2953('0x34')]);_0xbc04e4[_0x2953('0x37')]=_[_0x2953('0x36')](_0x2839ea[_0x2953('0x32')],qs['fields'](_0x5e3cc7[_0x2953('0x34')][_0x2953('0x38')]));_0xbc04e4['attributes']=_0xbc04e4[_0x2953('0x37')][_0x2953('0x39')]?_0xbc04e4[_0x2953('0x37')]:_0x2839ea['model'];if(!_0x5e3cc7[_0x2953('0x34')][_0x2953('0x3a')](_0x2953('0x3b'))){_0xbc04e4[_0x2953('0x1b')]=qs['limit'](_0x5e3cc7[_0x2953('0x34')][_0x2953('0x1b')]);_0xbc04e4[_0x2953('0x19')]=qs[_0x2953('0x19')](_0x5e3cc7[_0x2953('0x34')][_0x2953('0x19')]);}_0xbc04e4[_0x2953('0x3c')]=qs[_0x2953('0x3d')](_0x5e3cc7[_0x2953('0x34')][_0x2953('0x3d')]);_0xbc04e4[_0x2953('0x3e')]=qs['filters'](_[_0x2953('0x3f')](_0x5e3cc7[_0x2953('0x34')],_0x2839ea[_0x2953('0x35')]),_0x33c0a6);if(_0x5e3cc7[_0x2953('0x34')][_0x2953('0x40')]){_0xbc04e4[_0x2953('0x3e')]=_['merge'](_0xbc04e4[_0x2953('0x3e')],{'$or':_[_0x2953('0x2c')](_0x33c0a6,function(_0x123f3c){if(_0x123f3c['type']!==_0x2953('0x41')){var _0x52f039={};_0x52f039[_0x123f3c[_0x2953('0x2b')]]={'$like':'%'+_0x5e3cc7[_0x2953('0x34')][_0x2953('0x40')]+'%'};return _0x52f039;}})});}_0xbc04e4=_['merge']({},_0xbc04e4,_0x5e3cc7['options']);var _0x23dc3c={'where':_0xbc04e4[_0x2953('0x3e')]};return db[_0x2953('0x2d')][_0x2953('0x1c')](_0x23dc3c)[_0x2953('0x24')](function(_0x5cd3c8){_0x522fd8[_0x2953('0x1c')]=_0x5cd3c8;if(_0x5e3cc7[_0x2953('0x34')][_0x2953('0x42')]){_0xbc04e4[_0x2953('0x43')]=[{'all':!![]}];}return db[_0x2953('0x2d')][_0x2953('0x44')](_0xbc04e4);})[_0x2953('0x24')](function(_0x574564){_0x522fd8[_0x2953('0x45')]=_0x574564;return _0x522fd8;})[_0x2953('0x24')](respondWithFilteredResult(_0x2bfce7,_0xbc04e4))['catch'](handleError(_0x2bfce7,null));};exports[_0x2953('0x46')]=function(_0x5cda60,_0x3e3efa){var _0xddbbb9={'raw':![],'where':{'id':_0x5cda60[_0x2953('0x47')]['id']}},_0x4a0193={};_0x4a0193[_0x2953('0x32')]=_[_0x2953('0x33')](db[_0x2953('0x2d')][_0x2953('0x2e')]);_0x4a0193[_0x2953('0x34')]=_[_0x2953('0x33')](_0x5cda60[_0x2953('0x34')]);_0x4a0193[_0x2953('0x35')]=_[_0x2953('0x36')](_0x4a0193['model'],_0x4a0193[_0x2953('0x34')]);_0xddbbb9['attributes']=_['intersection'](_0x4a0193[_0x2953('0x32')],qs['fields'](_0x5cda60[_0x2953('0x34')][_0x2953('0x38')]));_0xddbbb9[_0x2953('0x37')]=_0xddbbb9[_0x2953('0x37')][_0x2953('0x39')]?_0xddbbb9[_0x2953('0x37')]:_0x4a0193[_0x2953('0x32')];if(_0x5cda60['query'][_0x2953('0x42')]){_0xddbbb9[_0x2953('0x43')]=[{'all':!![]}];}_0xddbbb9=_[_0x2953('0x48')]({},_0xddbbb9,_0x5cda60[_0x2953('0x49')]);return db[_0x2953('0x2d')][_0x2953('0x4a')](_0xddbbb9)[_0x2953('0x24')](handleEntityNotFound(_0x3e3efa,null))[_0x2953('0x24')](respondWithResult(_0x3e3efa,null))[_0x2953('0x4b')](handleError(_0x3e3efa,null));};exports[_0x2953('0x4c')]=function(_0x2995b1,_0x151b32){return db['Campaign']['create'](_0x2995b1[_0x2953('0x4d')],{})[_0x2953('0x24')](function(_0x42e29e){var _0x299792=_0x2995b1['user']['get']({'plain':!![]});if(!_0x299792)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x299792['role']===_0x2953('0x4e')){var _0x3e8b37=_0x42e29e['get']({'plain':!![]});var _0x332c22=_0x2953('0x26');return db[_0x2953('0x4f')]['find']({'where':{'name':_0x332c22,'userProfileId':_0x299792['userProfileId']},'raw':!![]})[_0x2953('0x24')](function(_0x3052c7){if(_0x3052c7&&_0x3052c7[_0x2953('0x50')]===0x0){return db[_0x2953('0x27')][_0x2953('0x4c')]({'name':_0x3e8b37[_0x2953('0x2b')],'resourceId':_0x3e8b37['id'],'type':_0x3052c7[_0x2953('0x2b')],'sectionId':_0x3052c7['id']},{})[_0x2953('0x24')](function(){return _0x42e29e;});}else{return _0x42e29e;}})[_0x2953('0x4b')](function(_0x254fe3){logger[_0x2953('0x29')](_0x2953('0x51'),_0x254fe3);throw _0x254fe3;});}return _0x42e29e;})['then'](respondWithResult(_0x151b32,0xc9))['catch'](handleError(_0x151b32,null));};exports[_0x2953('0x52')]=function(_0x5db7a8,_0x5834eb){var _0x5bf5ce={'where':{'id':_0x5db7a8[_0x2953('0x47')]['id']}},_0x5eb010={};_0x5eb010[_0x2953('0x32')]=_['keys'](db[_0x2953('0x2d')][_0x2953('0x2e')]);_0x5bf5ce[_0x2953('0x37')]=_[_0x2953('0x36')](_0x5eb010[_0x2953('0x32')],qs[_0x2953('0x38')](_0x5db7a8[_0x2953('0x34')]['fields']));_0x5bf5ce[_0x2953('0x37')]=_0x5bf5ce['attributes'][_0x2953('0x39')]?_0x5bf5ce[_0x2953('0x37')]:_0x5eb010['model'];if(_0x5db7a8[_0x2953('0x34')][_0x2953('0x42')]){_0x5bf5ce[_0x2953('0x43')]=[{'all':!![]}];}_0x5bf5ce=_[_0x2953('0x48')]({},_0x5bf5ce,_0x5db7a8[_0x2953('0x49')]);return db[_0x2953('0x2d')][_0x2953('0x4a')](_0x5bf5ce)[_0x2953('0x24')](handleEntityNotFound(_0x5834eb,null))[_0x2953('0x24')](function(_0x43816e){if(_0x43816e){var _0x2aca85=_0x43816e[_0x2953('0x25')]({'plain':!![]});_0x2aca85=qs[_0x2953('0x53')](_0x2aca85,['id',_0x2953('0x54'),'updatedAt']);_0x5db7a8[_0x2953('0x4d')]=_[_0x2953('0x53')](_0x5db7a8[_0x2953('0x4d')],['id',_0x2953('0x54'),_0x2953('0x55')]);return db[_0x2953('0x2d')][_0x2953('0x4c')](_['merge'](_0x2aca85,_0x5db7a8[_0x2953('0x4d')]),{'include':_0x5db7a8[_0x2953('0x34')][_0x2953('0x42')]?[{'all':!![]}]:undefined})[_0x2953('0x24')](function(_0xcbc5c5){var _0x101ed0=_0x5db7a8[_0x2953('0x4e')][_0x2953('0x25')]({'plain':!![]});if(!_0x101ed0)throw new Error(_0x2953('0x56'));if(_0x101ed0[_0x2953('0x57')]==='user'){var _0x4fe644=_0xcbc5c5[_0x2953('0x25')]({'plain':!![]});var _0x5d98dc=_0x2953('0x26');return db[_0x2953('0x4f')][_0x2953('0x4a')]({'where':{'name':_0x5d98dc,'userProfileId':_0x101ed0[_0x2953('0x58')]},'raw':!![]})[_0x2953('0x24')](function(_0x2e5f6d){if(_0x2e5f6d&&_0x2e5f6d[_0x2953('0x50')]===0x0){return db[_0x2953('0x27')]['create']({'name':_0x4fe644['name'],'resourceId':_0x4fe644['id'],'type':_0x2e5f6d[_0x2953('0x2b')],'sectionId':_0x2e5f6d['id']},{})['then'](function(){return _0xcbc5c5;});}else{return _0xcbc5c5;}})[_0x2953('0x4b')](function(_0x4a34d3){logger[_0x2953('0x29')](_0x2953('0x51'),_0x4a34d3);throw _0x4a34d3;});}return _0xcbc5c5;});}})[_0x2953('0x24')](respondWithResult(_0x5834eb,0xc9))[_0x2953('0x4b')](handleError(_0x5834eb,null));};exports['update']=function(_0x33293a,_0x5d8b57){if(_0x33293a[_0x2953('0x4d')]['id']){delete _0x33293a[_0x2953('0x4d')]['id'];}return db['Campaign'][_0x2953('0x4a')]({'where':{'id':_0x33293a[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x5d8b57,null))['then'](saveUpdates(_0x33293a[_0x2953('0x4d')],null))['then'](respondWithResult(_0x5d8b57,null))[_0x2953('0x4b')](handleError(_0x5d8b57,null));};exports[_0x2953('0x23')]=function(_0xd6399e,_0x313520){return db[_0x2953('0x2d')][_0x2953('0x4a')]({'where':{'id':_0xd6399e[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x313520,null))[_0x2953('0x24')](removeEntity(_0x313520,null))['catch'](handleError(_0x313520,null));};exports[_0x2953('0x59')]=function(_0x26cf4d,_0x1bce48,_0x28c463){var _0x229080={'raw':!![],'where':{}};var _0x5561a6={};var _0x2c15e3={'count':0x0,'rows':[]};return db[_0x2953('0x2d')][_0x2953('0x5a')]({'where':{'id':_0x26cf4d[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x1bce48,null))[_0x2953('0x24')](function(_0x3dd004){if(_0x3dd004){_0x5561a6[_0x2953('0x32')]=_[_0x2953('0x33')](db['CmHopper'][_0x2953('0x2e')]);_0x5561a6[_0x2953('0x34')]=_[_0x2953('0x33')](_0x26cf4d[_0x2953('0x34')]);_0x5561a6[_0x2953('0x35')]=_['intersection'](_0x5561a6['model'],_0x5561a6[_0x2953('0x34')]);_0x229080[_0x2953('0x37')]=_[_0x2953('0x36')](_0x5561a6[_0x2953('0x32')],qs[_0x2953('0x38')](_0x26cf4d[_0x2953('0x34')][_0x2953('0x38')]));_0x229080['attributes']=_0x229080[_0x2953('0x37')]['length']?_0x229080[_0x2953('0x37')]:_0x5561a6[_0x2953('0x32')];if(!_0x26cf4d[_0x2953('0x34')][_0x2953('0x3a')](_0x2953('0x3b'))){_0x229080[_0x2953('0x1b')]=qs['limit'](_0x26cf4d[_0x2953('0x34')][_0x2953('0x1b')]);_0x229080['offset']=qs[_0x2953('0x19')](_0x26cf4d[_0x2953('0x34')][_0x2953('0x19')]);}_0x229080[_0x2953('0x3c')]=qs['sort'](_0x26cf4d[_0x2953('0x34')][_0x2953('0x3d')]);_0x229080['where']=qs[_0x2953('0x35')](_[_0x2953('0x3f')](_0x26cf4d[_0x2953('0x34')],_0x5561a6[_0x2953('0x35')]));_0x229080['where'][_0x2953('0x5b')]=_0x3dd004['id'];if(_0x26cf4d[_0x2953('0x34')][_0x2953('0x40')]){_0x229080[_0x2953('0x3e')]=_['merge'](_0x229080['where'],{'$or':_[_0x2953('0x2c')](_0x229080[_0x2953('0x37')],function(_0x39417a){var _0xaf9050={};_0xaf9050[_0x39417a]={'$like':'%'+_0x26cf4d['query'][_0x2953('0x40')]+'%'};return _0xaf9050;})});}_0x229080=_['merge']({},_0x229080,_0x26cf4d[_0x2953('0x49')]);return db[_0x2953('0x5c')][_0x2953('0x1c')]({'where':_0x229080[_0x2953('0x3e')]})[_0x2953('0x24')](function(_0x1ae655){_0x2c15e3[_0x2953('0x1c')]=_0x1ae655;if(_0x26cf4d[_0x2953('0x34')][_0x2953('0x42')]){_0x229080[_0x2953('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0x2953('0x44')](_0x229080);})[_0x2953('0x24')](function(_0x5f1609){_0x2c15e3[_0x2953('0x45')]=_0x5f1609;return _0x2c15e3;});}})[_0x2953('0x24')](respondWithFilteredResult(_0x1bce48,_0x229080))['catch'](handleError(_0x1bce48,null));};exports['getHopperHistories']=function(_0x49bcd1,_0x3bc3ee,_0x1be2a4){var _0x4e4ef9={'raw':!![],'where':{}};var _0x2cad89={};var _0x4bfb8c={'count':0x0,'rows':[]};return db[_0x2953('0x2d')][_0x2953('0x5a')]({'where':{'id':_0x49bcd1[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x3bc3ee,null))[_0x2953('0x24')](function(_0x407c9e){if(_0x407c9e){_0x2cad89[_0x2953('0x32')]=_[_0x2953('0x33')](db[_0x2953('0x5d')][_0x2953('0x2e')]);_0x2cad89['query']=_[_0x2953('0x33')](_0x49bcd1[_0x2953('0x34')]);_0x2cad89[_0x2953('0x35')]=_[_0x2953('0x36')](_0x2cad89[_0x2953('0x32')],_0x2cad89[_0x2953('0x34')]);_0x4e4ef9[_0x2953('0x37')]=_[_0x2953('0x36')](_0x2cad89[_0x2953('0x32')],qs[_0x2953('0x38')](_0x49bcd1[_0x2953('0x34')]['fields']));_0x4e4ef9[_0x2953('0x37')]=_0x4e4ef9['attributes']['length']?_0x4e4ef9[_0x2953('0x37')]:_0x2cad89['model'];if(!_0x49bcd1[_0x2953('0x34')][_0x2953('0x3a')](_0x2953('0x3b'))){_0x4e4ef9[_0x2953('0x1b')]=qs[_0x2953('0x1b')](_0x49bcd1[_0x2953('0x34')][_0x2953('0x1b')]);_0x4e4ef9[_0x2953('0x19')]=qs[_0x2953('0x19')](_0x49bcd1['query']['offset']);}_0x4e4ef9[_0x2953('0x3c')]=qs[_0x2953('0x3d')](_0x49bcd1[_0x2953('0x34')][_0x2953('0x3d')]);_0x4e4ef9['where']=qs[_0x2953('0x35')](_['pick'](_0x49bcd1[_0x2953('0x34')],_0x2cad89[_0x2953('0x35')]));_0x4e4ef9[_0x2953('0x3e')][_0x2953('0x5b')]=_0x407c9e['id'];if(_0x49bcd1[_0x2953('0x34')]['filter']){_0x4e4ef9['where']=_[_0x2953('0x48')](_0x4e4ef9['where'],{'$or':_[_0x2953('0x2c')](_0x4e4ef9['attributes'],function(_0x49aa91){var _0x476c34={};_0x476c34[_0x49aa91]={'$like':'%'+_0x49bcd1[_0x2953('0x34')][_0x2953('0x40')]+'%'};return _0x476c34;})});}_0x4e4ef9=_[_0x2953('0x48')]({},_0x4e4ef9,_0x49bcd1[_0x2953('0x49')]);return db['CmHopperHistory']['count']({'where':_0x4e4ef9[_0x2953('0x3e')]})[_0x2953('0x24')](function(_0x1e45aa){_0x4bfb8c['count']=_0x1e45aa;if(_0x49bcd1['query']['includeAll']){_0x4e4ef9[_0x2953('0x43')]=[{'all':!![]}];}return db[_0x2953('0x5d')]['findAll'](_0x4e4ef9);})[_0x2953('0x24')](function(_0x11073c){_0x4bfb8c[_0x2953('0x45')]=_0x11073c;return _0x4bfb8c;});}})[_0x2953('0x24')](respondWithFilteredResult(_0x3bc3ee,_0x4e4ef9))[_0x2953('0x4b')](handleError(_0x3bc3ee,null));};exports[_0x2953('0x5e')]=function(_0x4932a9,_0x1433d7,_0xcf52f9){var _0x4b03d0={'raw':!![],'where':{}};var _0x238c0f={};var _0x7578af={'count':0x0,'rows':[]};return db[_0x2953('0x2d')][_0x2953('0x5a')]({'where':{'id':_0x4932a9['params']['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x1433d7,null))['then'](function(_0xc32d90){if(_0xc32d90){_0x238c0f[_0x2953('0x32')]=_['keys'](db[_0x2953('0x5f')][_0x2953('0x2e')]);_0x238c0f[_0x2953('0x34')]=_['keys'](_0x4932a9['query']);_0x238c0f[_0x2953('0x35')]=_[_0x2953('0x36')](_0x238c0f[_0x2953('0x32')],_0x238c0f[_0x2953('0x34')]);_0x4b03d0[_0x2953('0x37')]=_['intersection'](_0x238c0f[_0x2953('0x32')],qs[_0x2953('0x38')](_0x4932a9[_0x2953('0x34')][_0x2953('0x38')]));_0x4b03d0['attributes']=_0x4b03d0[_0x2953('0x37')]['length']?_0x4b03d0['attributes']:_0x238c0f[_0x2953('0x32')];if(!_0x4932a9[_0x2953('0x34')]['hasOwnProperty']('nolimit')){_0x4b03d0[_0x2953('0x1b')]=qs[_0x2953('0x1b')](_0x4932a9[_0x2953('0x34')][_0x2953('0x1b')]);_0x4b03d0[_0x2953('0x19')]=qs['offset'](_0x4932a9[_0x2953('0x34')][_0x2953('0x19')]);}_0x4b03d0[_0x2953('0x3c')]=qs[_0x2953('0x3d')](_0x4932a9[_0x2953('0x34')]['sort']);_0x4b03d0['where']=qs[_0x2953('0x35')](_[_0x2953('0x3f')](_0x4932a9['query'],_0x238c0f[_0x2953('0x35')]));_0x4b03d0[_0x2953('0x3e')][_0x2953('0x5b')]=_0xc32d90['id'];if(_0x4932a9[_0x2953('0x34')]['filter']){_0x4b03d0[_0x2953('0x3e')]=_['merge'](_0x4b03d0[_0x2953('0x3e')],{'$or':_['map'](_0x4b03d0[_0x2953('0x37')],function(_0x4e73a4){var _0x3e285e={};_0x3e285e[_0x4e73a4]={'$like':'%'+_0x4932a9[_0x2953('0x34')][_0x2953('0x40')]+'%'};return _0x3e285e;})});}_0x4b03d0=_[_0x2953('0x48')]({},_0x4b03d0,_0x4932a9[_0x2953('0x49')]);return db['CmHopperFinal'][_0x2953('0x1c')]({'where':_0x4b03d0['where']})['then'](function(_0x34e029){_0x7578af[_0x2953('0x1c')]=_0x34e029;if(_0x4932a9['query'][_0x2953('0x42')]){_0x4b03d0['include']=[{'all':!![]}];}return db[_0x2953('0x5f')][_0x2953('0x44')](_0x4b03d0);})[_0x2953('0x24')](function(_0x574790){_0x7578af['rows']=_0x574790;return _0x7578af;});}})[_0x2953('0x24')](respondWithFilteredResult(_0x1433d7,_0x4b03d0))['catch'](handleError(_0x1433d7,null));};exports[_0x2953('0x60')]=function(_0x4c9d00,_0x46e9b9,_0x325407){var _0x2ee69b={'raw':!![],'where':{}};var _0x3df3d4={};var _0x2500a1={'count':0x0,'rows':[]};return db[_0x2953('0x2d')][_0x2953('0x5a')]({'where':{'id':_0x4c9d00[_0x2953('0x47')]['id']}})['then'](handleEntityNotFound(_0x46e9b9,null))[_0x2953('0x24')](function(_0x28a19b){if(_0x28a19b){_0x3df3d4[_0x2953('0x32')]=_['keys'](db[_0x2953('0x61')]['rawAttributes']);_0x3df3d4[_0x2953('0x34')]=_['keys'](_0x4c9d00[_0x2953('0x34')]);_0x3df3d4[_0x2953('0x35')]=_[_0x2953('0x36')](_0x3df3d4[_0x2953('0x32')],_0x3df3d4[_0x2953('0x34')]);_0x2ee69b[_0x2953('0x37')]=_['intersection'](_0x3df3d4[_0x2953('0x32')],qs[_0x2953('0x38')](_0x4c9d00[_0x2953('0x34')]['fields']));_0x2ee69b['attributes']=_0x2ee69b[_0x2953('0x37')][_0x2953('0x39')]?_0x2ee69b['attributes']:_0x3df3d4[_0x2953('0x32')];if(!_0x4c9d00['query'][_0x2953('0x3a')](_0x2953('0x3b'))){_0x2ee69b[_0x2953('0x1b')]=qs[_0x2953('0x1b')](_0x4c9d00[_0x2953('0x34')]['limit']);_0x2ee69b['offset']=qs[_0x2953('0x19')](_0x4c9d00['query'][_0x2953('0x19')]);}_0x2ee69b[_0x2953('0x3c')]=qs[_0x2953('0x3d')](_0x4c9d00[_0x2953('0x34')][_0x2953('0x3d')]);_0x2ee69b[_0x2953('0x3e')]=qs[_0x2953('0x35')](_[_0x2953('0x3f')](_0x4c9d00['query'],_0x3df3d4[_0x2953('0x35')]));_0x2ee69b[_0x2953('0x3e')][_0x2953('0x5b')]=_0x28a19b['id'];if(_0x4c9d00[_0x2953('0x34')][_0x2953('0x40')]){_0x2ee69b[_0x2953('0x3e')]=_['merge'](_0x2ee69b[_0x2953('0x3e')],{'$or':_[_0x2953('0x2c')](_0x2ee69b[_0x2953('0x37')],function(_0x3876b3){var _0x28629c={};_0x28629c[_0x3876b3]={'$like':'%'+_0x4c9d00[_0x2953('0x34')][_0x2953('0x40')]+'%'};return _0x28629c;})});}_0x2ee69b=_['merge']({},_0x2ee69b,_0x4c9d00[_0x2953('0x49')]);return db[_0x2953('0x61')][_0x2953('0x1c')]({'where':_0x2ee69b['where']})[_0x2953('0x24')](function(_0x5d52cf){_0x2500a1[_0x2953('0x1c')]=_0x5d52cf;if(_0x4c9d00['query'][_0x2953('0x42')]){_0x2ee69b['include']=[{'all':!![]}];}return db[_0x2953('0x61')][_0x2953('0x44')](_0x2ee69b);})['then'](function(_0x428374){_0x2500a1[_0x2953('0x45')]=_0x428374;return _0x2500a1;});}})[_0x2953('0x24')](respondWithFilteredResult(_0x46e9b9,_0x2ee69b))['catch'](handleError(_0x46e9b9,null));};exports['getLists']=function(_0x3562ab,_0x3b0d28,_0x57f613){var _0x23c4af={};var _0x9b74a8={};var _0x101034;var _0xb22c64;return db['Campaign'][_0x2953('0x5a')]({'where':{'id':_0x3562ab[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x3b0d28,null))[_0x2953('0x24')](function(_0x4b8dba){if(_0x4b8dba){_0x101034=_0x4b8dba;_0x9b74a8[_0x2953('0x32')]=_[_0x2953('0x33')](db[_0x2953('0x62')]['rawAttributes']);_0x9b74a8['query']=_[_0x2953('0x33')](_0x3562ab[_0x2953('0x34')]);_0x9b74a8[_0x2953('0x35')]=_['intersection'](_0x9b74a8['model'],_0x9b74a8['query']);_0x23c4af[_0x2953('0x37')]=_['intersection'](_0x9b74a8[_0x2953('0x32')],qs[_0x2953('0x38')](_0x3562ab[_0x2953('0x34')][_0x2953('0x38')]));_0x23c4af[_0x2953('0x37')]=_0x23c4af[_0x2953('0x37')][_0x2953('0x39')]?_0x23c4af[_0x2953('0x37')]:_0x9b74a8[_0x2953('0x32')];_0x23c4af[_0x2953('0x3c')]=qs[_0x2953('0x3d')](_0x3562ab[_0x2953('0x34')]['sort']);_0x23c4af[_0x2953('0x3e')]=qs[_0x2953('0x35')](_[_0x2953('0x3f')](_0x3562ab[_0x2953('0x34')],_0x9b74a8[_0x2953('0x35')]));if(_0x3562ab[_0x2953('0x34')][_0x2953('0x40')]){_0x23c4af[_0x2953('0x3e')]=_[_0x2953('0x48')](_0x23c4af[_0x2953('0x3e')],{'$or':_['map'](_0x23c4af[_0x2953('0x37')],function(_0x1a3ac5){var _0x6162f3={};_0x6162f3[_0x1a3ac5]={'$like':'%'+_0x3562ab['query'][_0x2953('0x40')]+'%'};return _0x6162f3;})});}_0x23c4af=_[_0x2953('0x48')]({},_0x23c4af,_0x3562ab[_0x2953('0x49')]);return _0x101034['getLists'](_0x23c4af);}})['then'](function(_0x35564f){if(_0x35564f){_0xb22c64=_0x35564f[_0x2953('0x39')];if(!_0x3562ab[_0x2953('0x34')][_0x2953('0x3a')]('nolimit')){_0x23c4af[_0x2953('0x1b')]=qs['limit'](_0x3562ab['query'][_0x2953('0x1b')]);_0x23c4af[_0x2953('0x19')]=qs[_0x2953('0x19')](_0x3562ab[_0x2953('0x34')][_0x2953('0x19')]);}return _0x101034[_0x2953('0x63')](_0x23c4af);}})[_0x2953('0x24')](function(_0x3dcfbc){if(_0x3dcfbc){return _0x3dcfbc?{'count':_0xb22c64,'rows':_0x3dcfbc}:null;}})[_0x2953('0x24')](respondWithResult(_0x3b0d28,null))['catch'](handleError(_0x3b0d28,null));};exports[_0x2953('0x64')]=function(_0x1a28e8,_0x3b7bba,_0x2f7bb1){var _0x2fc225,_0x466d9d;var _0x40f751=[];var _0x1853ae=moment()['format'](_0x2953('0x65'));return db[_0x2953('0x2d')][_0x2953('0x4a')]({'where':{'id':_0x1a28e8[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x3b7bba,null))['then'](function(_0x219b02){if(_0x219b02){_0x466d9d=_0x219b02;return _0x219b02[_0x2953('0x64')](_0x1a28e8[_0x2953('0x4d')][_0x2953('0x66')],_[_0x2953('0x53')](_0x1a28e8[_0x2953('0x4d')],['ids','id'])||{});}return null;})[_0x2953('0x67')](function(_0x187607){var _0x497d47;var _0x49a443;_0x2fc225=_0x187607||[];var _0x3e785e=[];if(_0x187607){for(var _0x543abf=0x0;_0x543abf<_0x187607['length'];_0x543abf+=0x1){var _0x31ad6e=_0x187607[_0x543abf]['get']({'plain':!![]});_0x466d9d[_0x2953('0x68')]=_0x1a28e8[_0x2953('0x4d')][_0x2953('0x68')]?_0x1a28e8[_0x2953('0x4d')][_0x2953('0x68')]:_0x466d9d[_0x2953('0x68')];switch(_0x466d9d[_0x2953('0x68')]){case'always':_0x497d47=squel[_0x2953('0x69')]()[_0x2953('0x6a')](_0x2953('0x6b'))['fromQuery']([_0x2953('0x6c'),_0x2953('0x6d'),'ContactId',_0x2953('0x6e'),'CampaignId',_0x2953('0x54'),_0x2953('0x55')],squel[_0x2953('0x6f')]()['field'](_0x2953('0x6c'),'phone')[_0x2953('0x70')]('NOW()',_0x2953('0x6d'))[_0x2953('0x70')]('id','ContactId')[_0x2953('0x70')](_0x31ad6e[_0x2953('0x71')][_0x2953('0x72')](),_0x2953('0x6e'))[_0x2953('0x70')](_0x1a28e8['params']['id']['toString'](),_0x2953('0x5b'))[_0x2953('0x70')]('\x27'+_0x1853ae+'\x27',_0x2953('0x54'))[_0x2953('0x70')]('\x27'+_0x1853ae+'\x27',_0x2953('0x55'))[_0x2953('0x73')](_0x2953('0x74'))[_0x2953('0x3e')](_0x2953('0x75'))['where']('ListId\x20=\x20?',_0x31ad6e[_0x2953('0x71')]['toString']())[_0x2953('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x2953('0x3e')](_0x2953('0x76'),squel[_0x2953('0x6f')]()[_0x2953('0x70')](_0x2953('0x77'))['from'](_0x2953('0x78'))['where'](_0x2953('0x79'),_0x1a28e8[_0x2953('0x47')]['id'][_0x2953('0x72')]()))[_0x2953('0x3e')](_0x2953('0x76'),squel[_0x2953('0x6f')]()[_0x2953('0x70')]('COALESCE(phone,\x27\x27)')['from'](_0x2953('0x6b'))[_0x2953('0x3e')](_0x2953('0x79'),_0x1a28e8['params']['id'][_0x2953('0x72')]())))[_0x2953('0x72')]();break;case'onlyIfOpen':_0x497d47=squel['insert']()[_0x2953('0x6a')](_0x2953('0x6b'))[_0x2953('0x7a')]([_0x2953('0x6c'),_0x2953('0x6d'),_0x2953('0x7b'),'ListId',_0x2953('0x5b'),_0x2953('0x54'),'updatedAt'],squel['select']()[_0x2953('0x70')]('phone',_0x2953('0x6c'))[_0x2953('0x70')](_0x2953('0x7c'),'scheduledAt')[_0x2953('0x70')]('id','ContactId')[_0x2953('0x70')](_0x31ad6e[_0x2953('0x71')][_0x2953('0x72')](),_0x2953('0x6e'))['field'](_0x1a28e8[_0x2953('0x47')]['id'][_0x2953('0x72')](),_0x2953('0x5b'))[_0x2953('0x70')]('\x27'+_0x1853ae+'\x27',_0x2953('0x54'))[_0x2953('0x70')]('\x27'+_0x1853ae+'\x27',_0x2953('0x55'))['from'](_0x2953('0x74'))[_0x2953('0x3e')]('deletedAt\x20IS\x20NULL')[_0x2953('0x3e')](_0x2953('0x7d'),_0x31ad6e[_0x2953('0x71')][_0x2953('0x72')]())[_0x2953('0x3e')](_0x2953('0x7e'))[_0x2953('0x3e')](_0x2953('0x76'),squel['select']()['field'](_0x2953('0x7f'))['from'](_0x2953('0x6b'))[_0x2953('0x3e')](_0x2953('0x79'),_0x1a28e8[_0x2953('0x47')]['id']['toString']())))[_0x2953('0x72')]();break;default:_0x497d47=squel[_0x2953('0x69')]()['into'](_0x2953('0x6b'))[_0x2953('0x7a')]([_0x2953('0x6c'),_0x2953('0x6d'),_0x2953('0x7b'),_0x2953('0x6e'),_0x2953('0x5b'),_0x2953('0x54'),_0x2953('0x55')],squel[_0x2953('0x6f')]()[_0x2953('0x70')](_0x2953('0x6c'),_0x2953('0x6c'))[_0x2953('0x70')](_0x2953('0x7c'),_0x2953('0x6d'))[_0x2953('0x70')]('id',_0x2953('0x7b'))['field'](_0x31ad6e[_0x2953('0x71')][_0x2953('0x72')](),_0x2953('0x6e'))['field'](_0x1a28e8[_0x2953('0x47')]['id']['toString'](),_0x2953('0x5b'))[_0x2953('0x70')]('\x27'+_0x1853ae+'\x27',_0x2953('0x54'))[_0x2953('0x70')]('\x27'+_0x1853ae+'\x27',_0x2953('0x55'))['from'](_0x2953('0x74'))[_0x2953('0x3e')](_0x2953('0x75'))[_0x2953('0x3e')](_0x2953('0x7d'),_0x31ad6e[_0x2953('0x71')][_0x2953('0x72')]())['where'](_0x2953('0x7e')))[_0x2953('0x72')]();}_0x49a443=squel[_0x2953('0x69')]()[_0x2953('0x6a')]('cm_hopper_additional_phones')[_0x2953('0x7a')](['cmHopperId',_0x2953('0x6d'),_0x2953('0x6c'),'OrderBy',_0x2953('0x54'),'updatedAt'],squel[_0x2953('0x6f')]()[_0x2953('0x70')](_0x2953('0x80'),'id')[_0x2953('0x70')](_0x2953('0x7c'),'scheduledAt')['field'](_0x2953('0x81'),_0x2953('0x6c'))[_0x2953('0x70')]('ci.OrderBY',_0x2953('0x82'))['field']('\x27'+_0x1853ae+'\x27',_0x2953('0x54'))[_0x2953('0x70')]('\x27'+_0x1853ae+'\x27',_0x2953('0x55'))[_0x2953('0x73')](_0x2953('0x83'),'ci')['join']('cm_hopper','h',_0x2953('0x84'))['where'](_0x2953('0x85'),_0x31ad6e['CmListId'][_0x2953('0x72')]())[_0x2953('0x3e')]('h.CampaignId=?',_0x1a28e8[_0x2953('0x47')]['id'][_0x2953('0x72')]())[_0x2953('0x3e')](_0x2953('0x86'),_0x1853ae))[_0x2953('0x72')]();_0x3e785e[_0x2953('0x87')](db['sequelize'][_0x2953('0x34')](_0x497d47));_0x40f751['push'](db[_0x2953('0x88')][_0x2953('0x34')](_0x49a443));}return BPromise[_0x2953('0x89')](_0x3e785e);}})[_0x2953('0x24')](function(){return BPromise[_0x2953('0x89')](_0x40f751);})[_0x2953('0x24')](function(){return _0x2fc225;})[_0x2953('0x24')](respondWithResult(_0x3b7bba,null))['catch'](handleError(_0x3b7bba,null));};exports[_0x2953('0x8a')]=function(_0x514f89,_0xf71e53,_0x13ecda){return db[_0x2953('0x2d')][_0x2953('0x4a')]({'where':{'id':_0x514f89['params']['id']}})[_0x2953('0x24')](handleEntityNotFound(_0xf71e53,null))['then'](function(_0x593ac6){if(_0x593ac6){return _0x593ac6[_0x2953('0x8a')](_0x514f89[_0x2953('0x34')]['ids']);}})[_0x2953('0x24')](function(_0x21be6b){if(_0x21be6b){return db[_0x2953('0x5c')][_0x2953('0x23')]({'where':{'ListId':_0x514f89['query'][_0x2953('0x66')],'CampaignId':_0x514f89[_0x2953('0x47')]['id']}})[_0x2953('0x24')](function(){return _0x21be6b;});}})[_0x2953('0x24')](respondWithStatusCode(_0xf71e53,null))['catch'](handleError(_0xf71e53,null));};exports['getBlackLists']=function(_0x3f0c46,_0x34d583,_0x207a15){var _0x177747={};var _0x25dc02={};var _0x1eb9fd;var _0x5c6ca1;return db[_0x2953('0x2d')][_0x2953('0x5a')]({'where':{'id':_0x3f0c46['params']['id']}})['then'](handleEntityNotFound(_0x34d583,null))['then'](function(_0x5988b4){if(_0x5988b4){_0x1eb9fd=_0x5988b4;_0x25dc02[_0x2953('0x32')]=_['keys'](db[_0x2953('0x62')][_0x2953('0x2e')]);_0x25dc02[_0x2953('0x34')]=_[_0x2953('0x33')](_0x3f0c46[_0x2953('0x34')]);_0x25dc02[_0x2953('0x35')]=_[_0x2953('0x36')](_0x25dc02[_0x2953('0x32')],_0x25dc02['query']);_0x177747[_0x2953('0x37')]=_[_0x2953('0x36')](_0x25dc02['model'],qs[_0x2953('0x38')](_0x3f0c46['query'][_0x2953('0x38')]));_0x177747[_0x2953('0x37')]=_0x177747['attributes'][_0x2953('0x39')]?_0x177747['attributes']:_0x25dc02[_0x2953('0x32')];_0x177747['order']=qs['sort'](_0x3f0c46[_0x2953('0x34')][_0x2953('0x3d')]);_0x177747[_0x2953('0x3e')]=qs[_0x2953('0x35')](_['pick'](_0x3f0c46['query'],_0x25dc02['filters']));if(_0x3f0c46[_0x2953('0x34')][_0x2953('0x40')]){_0x177747[_0x2953('0x3e')]=_[_0x2953('0x48')](_0x177747[_0x2953('0x3e')],{'$or':_[_0x2953('0x2c')](_0x177747[_0x2953('0x37')],function(_0x5c25f3){var _0x5c75f2={};_0x5c75f2[_0x5c25f3]={'$like':'%'+_0x3f0c46[_0x2953('0x34')][_0x2953('0x40')]+'%'};return _0x5c75f2;})});}_0x177747=_[_0x2953('0x48')]({},_0x177747,_0x3f0c46['options']);return _0x1eb9fd[_0x2953('0x8b')](_0x177747);}})[_0x2953('0x24')](function(_0x328521){if(_0x328521){_0x5c6ca1=_0x328521[_0x2953('0x39')];if(!_0x3f0c46[_0x2953('0x34')][_0x2953('0x3a')](_0x2953('0x3b'))){_0x177747[_0x2953('0x1b')]=qs[_0x2953('0x1b')](_0x3f0c46[_0x2953('0x34')][_0x2953('0x1b')]);_0x177747[_0x2953('0x19')]=qs[_0x2953('0x19')](_0x3f0c46[_0x2953('0x34')][_0x2953('0x19')]);}return _0x1eb9fd[_0x2953('0x8b')](_0x177747);}})[_0x2953('0x24')](function(_0x383702){if(_0x383702){return _0x383702?{'count':_0x5c6ca1,'rows':_0x383702}:null;}})[_0x2953('0x24')](respondWithResult(_0x34d583,null))[_0x2953('0x4b')](handleError(_0x34d583,null));};exports[_0x2953('0x8c')]=function(_0x4a0733,_0x548c81,_0x5b19fd){var _0x2a444d,_0x3f281d;var _0x221494=[];var _0xe3dba8=moment()['format'](_0x2953('0x65'));return db[_0x2953('0x2d')][_0x2953('0x4a')]({'where':{'id':_0x4a0733[_0x2953('0x47')]['id']}})['then'](handleEntityNotFound(_0x548c81,null))[_0x2953('0x24')](function(_0x28ac9b){if(_0x28ac9b){_0x3f281d=_0x28ac9b;return _0x28ac9b['addBlackLists'](_0x4a0733['body'][_0x2953('0x66')],_['omit'](_0x4a0733[_0x2953('0x4d')],[_0x2953('0x66'),'id'])||{});}return null;})['spread'](function(_0x529913){var _0x5cd164;var _0x207cf5;_0x2a444d=_0x529913||[];var _0x59b66f=[];if(_0x529913){for(var _0x3e6a33=0x0;_0x3e6a33<_0x529913[_0x2953('0x39')];_0x3e6a33+=0x1){var _0x5bc42f=_0x529913[_0x3e6a33][_0x2953('0x25')]({'plain':!![]});_0x5cd164=squel[_0x2953('0x69')]()['into'](_0x2953('0x8d'))['fromQuery']([_0x2953('0x6c'),_0x2953('0x7b'),'ListId','CampaignId',_0x2953('0x54'),_0x2953('0x55')],squel['select']()[_0x2953('0x70')]('phone','phone')[_0x2953('0x70')]('id',_0x2953('0x7b'))[_0x2953('0x70')](_0x5bc42f[_0x2953('0x71')][_0x2953('0x72')](),'ListId')['field'](_0x4a0733[_0x2953('0x47')]['id'][_0x2953('0x72')](),'CampaignId')[_0x2953('0x70')](_0x2953('0x7c'),'createdAt')[_0x2953('0x70')](_0x2953('0x7c'),_0x2953('0x55'))[_0x2953('0x73')](_0x2953('0x74'))['where'](_0x2953('0x75'))[_0x2953('0x3e')](_0x2953('0x7d'),_0x5bc42f[_0x2953('0x71')][_0x2953('0x72')]())[_0x2953('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x2953('0x72')]();_0x59b66f['push'](db['sequelize'][_0x2953('0x34')](_0x5cd164));}return BPromise[_0x2953('0x89')](_0x59b66f);}})[_0x2953('0x24')](function(){return _0x2a444d;})[_0x2953('0x24')](respondWithResult(_0x548c81,null))[_0x2953('0x4b')](handleError(_0x548c81,null));};exports[_0x2953('0x8e')]=function(_0x474818,_0x3f6caf,_0x1e4f02){return db[_0x2953('0x2d')][_0x2953('0x4a')]({'where':{'id':_0x474818[_0x2953('0x47')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x3f6caf,null))[_0x2953('0x24')](function(_0x5c9b9b){if(_0x5c9b9b){return _0x5c9b9b[_0x2953('0x8e')](_0x474818[_0x2953('0x34')][_0x2953('0x66')]);}})[_0x2953('0x24')](function(_0x3d1092){if(_0x3d1092){return db[_0x2953('0x61')][_0x2953('0x23')]({'where':{'ListId':_0x474818['query'][_0x2953('0x66')],'CampaignId':_0x474818['params']['id']}})[_0x2953('0x24')](function(){return _0x3d1092;});}})[_0x2953('0x24')](respondWithStatusCode(_0x3f6caf,null))[_0x2953('0x4b')](handleError(_0x3f6caf,null));}; \ No newline at end of file +var _0xdb06=['json','apply','reject','save','then','get','IvrCampaigns','UserProfileResource','stack','name','index','Campaign','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','update','getHoppers','CmHopper','pick','getHopperHistories','findOne','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','scheduledAt','ContactId','ListId','phone','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','cm_hopper','insert','fromQuery','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','push','sequelize','all','removeLists','destroy','format','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','cm_hopper_black','removeBlackLists','CmHopperBlack','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set'];(function(_0xc3c936,_0x49577a){var _0x5b5a89=function(_0x515c9b){while(--_0x515c9b){_0xc3c936['push'](_0xc3c936['shift']());}};_0x5b5a89(++_0x49577a);}(_0xdb06,0x194));var _0x6db0=function(_0x258ff5,_0x26ecd9){_0x258ff5=_0x258ff5-0x0;var _0x49b903=_0xdb06[_0x258ff5];return _0x49b903;};'use strict';var emlformat=require(_0x6db0('0x0'));var rimraf=require(_0x6db0('0x1'));var zipdir=require(_0x6db0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db0('0x3'));var moment=require(_0x6db0('0x4'));var BPromise=require(_0x6db0('0x5'));var Mustache=require(_0x6db0('0x6'));var util=require('util');var path=require(_0x6db0('0x7'));var sox=require(_0x6db0('0x8'));var csv=require('to-csv');var ejs=require(_0x6db0('0x9'));var fs=require('fs');var fs_extra=require(_0x6db0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6db0('0xb'));var jsforce=require(_0x6db0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6db0('0xd'));var querystring=require(_0x6db0('0xe'));var Papa=require(_0x6db0('0xf'));var Redis=require(_0x6db0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6db0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6db0('0x12'));var logger=require(_0x6db0('0x13'))('api');var utils=require(_0x6db0('0x14'));var config=require(_0x6db0('0x15'));var licenseUtil=require(_0x6db0('0x16'));var db=require(_0x6db0('0x17'))['db'];function respondWithStatusCode(_0x31f582,_0x5806d0){_0x5806d0=_0x5806d0||0xcc;return function(_0x445d1f){if(_0x445d1f){return _0x31f582[_0x6db0('0x18')](_0x5806d0);}return _0x31f582[_0x6db0('0x19')](_0x5806d0)['end']();};}function respondWithResult(_0x18fcc2,_0x181421){_0x181421=_0x181421||0xc8;return function(_0x1f12dd){if(_0x1f12dd){return _0x18fcc2[_0x6db0('0x19')](_0x181421)['json'](_0x1f12dd);}};}function respondWithFilteredResult(_0x439616,_0x41deee){return function(_0x5ce005){if(_0x5ce005){var _0x234e37=typeof _0x41deee[_0x6db0('0x1a')]===_0x6db0('0x1b')&&typeof _0x41deee[_0x6db0('0x1c')]===_0x6db0('0x1b');var _0x587718=_0x5ce005[_0x6db0('0x1d')];var _0x4a245a=_0x234e37?0x0:_0x41deee[_0x6db0('0x1a')];var _0x530230=_0x234e37?_0x5ce005[_0x6db0('0x1d')]:_0x41deee[_0x6db0('0x1a')]+_0x41deee[_0x6db0('0x1c')];var _0x3723e7;if(_0x530230>=_0x587718){_0x530230=_0x587718;_0x3723e7=0xc8;}else{_0x3723e7=0xce;}_0x439616[_0x6db0('0x19')](_0x3723e7);return _0x439616[_0x6db0('0x1e')]('Content-Range',_0x4a245a+'-'+_0x530230+'/'+_0x587718)[_0x6db0('0x1f')](_0x5ce005);}return null;};}function patchUpdates(_0x1cfb9d){return function(_0x1fd268){try{jsonpatch[_0x6db0('0x20')](_0x1fd268,_0x1cfb9d,!![]);}catch(_0x5a8a25){return BPromise[_0x6db0('0x21')](_0x5a8a25);}return _0x1fd268[_0x6db0('0x22')]();};}function saveUpdates(_0x139a07,_0x5c81e7){return function(_0x4c45ad){if(_0x4c45ad){return _0x4c45ad['update'](_0x139a07)[_0x6db0('0x23')](function(_0x573450){return _0x573450;});}return null;};}function removeEntity(_0x21d907,_0x4d4162){return function(_0x2671d0){if(_0x2671d0){return _0x2671d0['destroy']()[_0x6db0('0x23')](function(){var _0x368eb6=_0x2671d0[_0x6db0('0x24')]({'plain':!![]});var _0x2ea92a=_0x6db0('0x25');return db[_0x6db0('0x26')]['destroy']({'where':{'type':_0x2ea92a,'resourceId':_0x368eb6['id']}})[_0x6db0('0x23')](function(){return _0x2671d0;});})[_0x6db0('0x23')](function(){_0x21d907[_0x6db0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318c42,_0x22c659){return function(_0x18a791){if(!_0x18a791){_0x318c42[_0x6db0('0x18')](0x194);}return _0x18a791;};}function handleError(_0x4e2023,_0x256da8){_0x256da8=_0x256da8||0x1f4;return function(_0x327470){logger['error'](_0x327470[_0x6db0('0x27')]);if(_0x327470[_0x6db0('0x28')]){delete _0x327470[_0x6db0('0x28')];}_0x4e2023[_0x6db0('0x19')](_0x256da8)['send'](_0x327470);};}exports[_0x6db0('0x29')]=function(_0x18fb21,_0x344a8b){var _0x4c31f4={},_0x38083f={},_0x1a1b29={'count':0x0,'rows':[]};var _0x454c66=_['map'](db[_0x6db0('0x2a')]['rawAttributes'],function(_0x26ac71){return{'name':_0x26ac71[_0x6db0('0x2b')],'type':_0x26ac71['type'][_0x6db0('0x2c')]};});_0x38083f[_0x6db0('0x2d')]=_[_0x6db0('0x2e')](_0x454c66,_0x6db0('0x28'));_0x38083f[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x18fb21[_0x6db0('0x2f')]);_0x38083f['filters']=_[_0x6db0('0x31')](_0x38083f[_0x6db0('0x2d')],_0x38083f[_0x6db0('0x2f')]);_0x4c31f4[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x38083f[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x4c31f4[_0x6db0('0x32')]=_0x4c31f4['attributes'][_0x6db0('0x34')]?_0x4c31f4['attributes']:_0x38083f[_0x6db0('0x2d')];if(!_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x35')](_0x6db0('0x36'))){_0x4c31f4[_0x6db0('0x1c')]=qs['limit'](_0x18fb21['query'][_0x6db0('0x1c')]);_0x4c31f4[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x4c31f4[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x38')]);_0x4c31f4[_0x6db0('0x39')]=qs['filters'](_['pick'](_0x18fb21[_0x6db0('0x2f')],_0x38083f[_0x6db0('0x3a')]),_0x454c66);if(_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x4c31f4[_0x6db0('0x39')]=_[_0x6db0('0x3c')](_0x4c31f4[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x454c66,function(_0x5ddcf7){if(_0x5ddcf7[_0x6db0('0x3d')]!==_0x6db0('0x3e')){var _0x25c45a={};_0x25c45a[_0x5ddcf7['name']]={'$like':'%'+_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x3b')]+'%'};return _0x25c45a;}})});}_0x4c31f4=_[_0x6db0('0x3c')]({},_0x4c31f4,_0x18fb21[_0x6db0('0x3f')]);var _0x6cde2a={'where':_0x4c31f4[_0x6db0('0x39')]};return db[_0x6db0('0x2a')][_0x6db0('0x1d')](_0x6cde2a)['then'](function(_0x3047c8){_0x1a1b29[_0x6db0('0x1d')]=_0x3047c8;if(_0x18fb21[_0x6db0('0x2f')]['includeAll']){_0x4c31f4[_0x6db0('0x40')]=[{'all':!![]}];}return db[_0x6db0('0x2a')][_0x6db0('0x41')](_0x4c31f4);})[_0x6db0('0x23')](function(_0x14e2c7){_0x1a1b29[_0x6db0('0x42')]=_0x14e2c7;return _0x1a1b29;})[_0x6db0('0x23')](respondWithFilteredResult(_0x344a8b,_0x4c31f4))[_0x6db0('0x43')](handleError(_0x344a8b,null));};exports[_0x6db0('0x44')]=function(_0x3f4359,_0x208470){var _0x6b0799={'raw':![],'where':{'id':_0x3f4359[_0x6db0('0x45')]['id']}},_0xb7a0d0={};_0xb7a0d0[_0x6db0('0x2d')]=_[_0x6db0('0x30')](db[_0x6db0('0x2a')]['rawAttributes']);_0xb7a0d0[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x3f4359[_0x6db0('0x2f')]);_0xb7a0d0[_0x6db0('0x3a')]=_['intersection'](_0xb7a0d0[_0x6db0('0x2d')],_0xb7a0d0[_0x6db0('0x2f')]);_0x6b0799[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0xb7a0d0[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x3f4359[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x6b0799[_0x6db0('0x32')]=_0x6b0799['attributes']['length']?_0x6b0799[_0x6db0('0x32')]:_0xb7a0d0[_0x6db0('0x2d')];if(_0x3f4359[_0x6db0('0x2f')][_0x6db0('0x46')]){_0x6b0799[_0x6db0('0x40')]=[{'all':!![]}];}_0x6b0799=_['merge']({},_0x6b0799,_0x3f4359[_0x6db0('0x3f')]);return db[_0x6db0('0x2a')][_0x6db0('0x47')](_0x6b0799)[_0x6db0('0x23')](handleEntityNotFound(_0x208470,null))[_0x6db0('0x23')](respondWithResult(_0x208470,null))[_0x6db0('0x43')](handleError(_0x208470,null));};exports[_0x6db0('0x48')]=function(_0x4570ca,_0x2304a9){return db[_0x6db0('0x2a')][_0x6db0('0x48')](_0x4570ca['body'],{})[_0x6db0('0x23')](function(_0x2baed6){var _0x12de8e=_0x4570ca[_0x6db0('0x49')][_0x6db0('0x24')]({'plain':!![]});if(!_0x12de8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12de8e['role']===_0x6db0('0x49')){var _0x406502=_0x2baed6[_0x6db0('0x24')]({'plain':!![]});var _0x560794='IvrCampaigns';return db[_0x6db0('0x4a')]['find']({'where':{'name':_0x560794,'userProfileId':_0x12de8e['userProfileId']},'raw':!![]})[_0x6db0('0x23')](function(_0x420534){if(_0x420534&&_0x420534[_0x6db0('0x4b')]===0x0){return db['UserProfileResource'][_0x6db0('0x48')]({'name':_0x406502[_0x6db0('0x28')],'resourceId':_0x406502['id'],'type':_0x420534['name'],'sectionId':_0x420534['id']},{})[_0x6db0('0x23')](function(){return _0x2baed6;});}else{return _0x2baed6;}})[_0x6db0('0x43')](function(_0x49cf10){logger[_0x6db0('0x4c')](_0x6db0('0x4d'),_0x49cf10);throw _0x49cf10;});}return _0x2baed6;})['then'](respondWithResult(_0x2304a9,0xc9))[_0x6db0('0x43')](handleError(_0x2304a9,null));};exports['clone']=function(_0x2bb7a3,_0x4f1b43){var _0xdf53bd={'where':{'id':_0x2bb7a3[_0x6db0('0x45')]['id']}},_0x21be7a={};_0x21be7a['model']=_[_0x6db0('0x30')](db[_0x6db0('0x2a')][_0x6db0('0x4e')]);_0xdf53bd[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x21be7a[_0x6db0('0x2d')],qs['fields'](_0x2bb7a3['query']['fields']));_0xdf53bd[_0x6db0('0x32')]=_0xdf53bd['attributes'][_0x6db0('0x34')]?_0xdf53bd[_0x6db0('0x32')]:_0x21be7a[_0x6db0('0x2d')];if(_0x2bb7a3[_0x6db0('0x2f')][_0x6db0('0x46')]){_0xdf53bd[_0x6db0('0x40')]=[{'all':!![]}];}_0xdf53bd=_[_0x6db0('0x3c')]({},_0xdf53bd,_0x2bb7a3[_0x6db0('0x3f')]);return db[_0x6db0('0x2a')][_0x6db0('0x47')](_0xdf53bd)[_0x6db0('0x23')](handleEntityNotFound(_0x4f1b43,null))[_0x6db0('0x23')](function(_0x3632dc){if(_0x3632dc){var _0x5a8545=_0x3632dc[_0x6db0('0x24')]({'plain':!![]});_0x5a8545=qs['omit'](_0x5a8545,['id',_0x6db0('0x4f'),_0x6db0('0x50')]);_0x2bb7a3[_0x6db0('0x51')]=_[_0x6db0('0x52')](_0x2bb7a3['body'],['id',_0x6db0('0x4f'),'updatedAt']);return db[_0x6db0('0x2a')][_0x6db0('0x48')](_[_0x6db0('0x3c')](_0x5a8545,_0x2bb7a3[_0x6db0('0x51')]),{'include':_0x2bb7a3[_0x6db0('0x2f')][_0x6db0('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x41086a){var _0x366713=_0x2bb7a3[_0x6db0('0x49')][_0x6db0('0x24')]({'plain':!![]});if(!_0x366713)throw new Error(_0x6db0('0x53'));if(_0x366713[_0x6db0('0x54')]===_0x6db0('0x49')){var _0xe4e5eb=_0x41086a[_0x6db0('0x24')]({'plain':!![]});var _0x5c5554=_0x6db0('0x25');return db[_0x6db0('0x4a')][_0x6db0('0x47')]({'where':{'name':_0x5c5554,'userProfileId':_0x366713['userProfileId']},'raw':!![]})[_0x6db0('0x23')](function(_0xe853b0){if(_0xe853b0&&_0xe853b0[_0x6db0('0x4b')]===0x0){return db[_0x6db0('0x26')][_0x6db0('0x48')]({'name':_0xe4e5eb[_0x6db0('0x28')],'resourceId':_0xe4e5eb['id'],'type':_0xe853b0[_0x6db0('0x28')],'sectionId':_0xe853b0['id']},{})[_0x6db0('0x23')](function(){return _0x41086a;});}else{return _0x41086a;}})[_0x6db0('0x43')](function(_0x13f610){logger[_0x6db0('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13f610);throw _0x13f610;});}return _0x41086a;});}})[_0x6db0('0x23')](respondWithResult(_0x4f1b43,0xc9))[_0x6db0('0x43')](handleError(_0x4f1b43,null));};exports[_0x6db0('0x55')]=function(_0x2378c2,_0x48b539){if(_0x2378c2[_0x6db0('0x51')]['id']){delete _0x2378c2[_0x6db0('0x51')]['id'];}return db[_0x6db0('0x2a')][_0x6db0('0x47')]({'where':{'id':_0x2378c2[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x48b539,null))['then'](saveUpdates(_0x2378c2[_0x6db0('0x51')],null))[_0x6db0('0x23')](respondWithResult(_0x48b539,null))[_0x6db0('0x43')](handleError(_0x48b539,null));};exports['destroy']=function(_0x29ac84,_0x199b55){return db[_0x6db0('0x2a')]['find']({'where':{'id':_0x29ac84[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x199b55,null))[_0x6db0('0x23')](removeEntity(_0x199b55,null))[_0x6db0('0x43')](handleError(_0x199b55,null));};exports[_0x6db0('0x56')]=function(_0x3cd8ba,_0x49362d,_0x4f6c6d){var _0x5455a3={'raw':!![],'where':{}};var _0x5031ee={};var _0x2ffba5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3cd8ba[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x49362d,null))['then'](function(_0x43842c){if(_0x43842c){_0x5031ee[_0x6db0('0x2d')]=_['keys'](db[_0x6db0('0x57')][_0x6db0('0x4e')]);_0x5031ee[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x3cd8ba[_0x6db0('0x2f')]);_0x5031ee[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x5031ee['model'],_0x5031ee[_0x6db0('0x2f')]);_0x5455a3[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x5031ee[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x3cd8ba[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x5455a3[_0x6db0('0x32')]=_0x5455a3[_0x6db0('0x32')][_0x6db0('0x34')]?_0x5455a3[_0x6db0('0x32')]:_0x5031ee['model'];if(!_0x3cd8ba['query']['hasOwnProperty'](_0x6db0('0x36'))){_0x5455a3[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x3cd8ba[_0x6db0('0x2f')][_0x6db0('0x1c')]);_0x5455a3[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x3cd8ba[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x5455a3[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x3cd8ba[_0x6db0('0x2f')]['sort']);_0x5455a3[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x3cd8ba[_0x6db0('0x2f')],_0x5031ee[_0x6db0('0x3a')]));_0x5455a3[_0x6db0('0x39')]['CampaignId']=_0x43842c['id'];if(_0x3cd8ba[_0x6db0('0x2f')]['filter']){_0x5455a3['where']=_[_0x6db0('0x3c')](_0x5455a3['where'],{'$or':_['map'](_0x5455a3['attributes'],function(_0x540142){var _0x2d5e22={};_0x2d5e22[_0x540142]={'$like':'%'+_0x3cd8ba[_0x6db0('0x2f')]['filter']+'%'};return _0x2d5e22;})});}_0x5455a3=_[_0x6db0('0x3c')]({},_0x5455a3,_0x3cd8ba[_0x6db0('0x3f')]);return db[_0x6db0('0x57')][_0x6db0('0x1d')]({'where':_0x5455a3[_0x6db0('0x39')]})[_0x6db0('0x23')](function(_0x376005){_0x2ffba5[_0x6db0('0x1d')]=_0x376005;if(_0x3cd8ba['query']['includeAll']){_0x5455a3['include']=[{'all':!![]}];}return db['CmHopper'][_0x6db0('0x41')](_0x5455a3);})[_0x6db0('0x23')](function(_0xc62d6c){_0x2ffba5[_0x6db0('0x42')]=_0xc62d6c;return _0x2ffba5;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x49362d,_0x5455a3))['catch'](handleError(_0x49362d,null));};exports[_0x6db0('0x59')]=function(_0x3eadd9,_0x25426b,_0x2e22fa){var _0x7a4542={'raw':!![],'where':{}};var _0x10b703={};var _0x24e038={'count':0x0,'rows':[]};return db['Campaign'][_0x6db0('0x5a')]({'where':{'id':_0x3eadd9['params']['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x25426b,null))['then'](function(_0x1295f2){if(_0x1295f2){_0x10b703[_0x6db0('0x2d')]=_['keys'](db['CmHopperHistory'][_0x6db0('0x4e')]);_0x10b703[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x3eadd9[_0x6db0('0x2f')]);_0x10b703[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x10b703['model'],_0x10b703[_0x6db0('0x2f')]);_0x7a4542[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x10b703[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x7a4542[_0x6db0('0x32')]=_0x7a4542[_0x6db0('0x32')][_0x6db0('0x34')]?_0x7a4542['attributes']:_0x10b703[_0x6db0('0x2d')];if(!_0x3eadd9['query']['hasOwnProperty'](_0x6db0('0x36'))){_0x7a4542[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x3eadd9[_0x6db0('0x2f')]['limit']);_0x7a4542['offset']=qs[_0x6db0('0x1a')](_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x7a4542[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x38')]);_0x7a4542[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x3eadd9[_0x6db0('0x2f')],_0x10b703[_0x6db0('0x3a')]));_0x7a4542['where'][_0x6db0('0x5b')]=_0x1295f2['id'];if(_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x7a4542['where']=_['merge'](_0x7a4542['where'],{'$or':_[_0x6db0('0x2e')](_0x7a4542[_0x6db0('0x32')],function(_0x813f4e){var _0x12e193={};_0x12e193[_0x813f4e]={'$like':'%'+_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x3b')]+'%'};return _0x12e193;})});}_0x7a4542=_['merge']({},_0x7a4542,_0x3eadd9['options']);return db['CmHopperHistory'][_0x6db0('0x1d')]({'where':_0x7a4542[_0x6db0('0x39')]})[_0x6db0('0x23')](function(_0x4039c8){_0x24e038[_0x6db0('0x1d')]=_0x4039c8;if(_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x46')]){_0x7a4542[_0x6db0('0x40')]=[{'all':!![]}];}return db[_0x6db0('0x5c')][_0x6db0('0x41')](_0x7a4542);})[_0x6db0('0x23')](function(_0xfd713c){_0x24e038['rows']=_0xfd713c;return _0x24e038;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x25426b,_0x7a4542))['catch'](handleError(_0x25426b,null));};exports[_0x6db0('0x5d')]=function(_0x40b303,_0x3ea2d7,_0x8a8de7){var _0x1f66c3={'raw':!![],'where':{}};var _0x4be3b7={};var _0x3d353d={'count':0x0,'rows':[]};return db[_0x6db0('0x2a')][_0x6db0('0x5a')]({'where':{'id':_0x40b303[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x3ea2d7,null))[_0x6db0('0x23')](function(_0xdb6c59){if(_0xdb6c59){_0x4be3b7[_0x6db0('0x2d')]=_['keys'](db[_0x6db0('0x5e')][_0x6db0('0x4e')]);_0x4be3b7['query']=_['keys'](_0x40b303[_0x6db0('0x2f')]);_0x4be3b7[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x4be3b7['model'],_0x4be3b7[_0x6db0('0x2f')]);_0x1f66c3[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x4be3b7['model'],qs[_0x6db0('0x33')](_0x40b303[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x1f66c3[_0x6db0('0x32')]=_0x1f66c3[_0x6db0('0x32')][_0x6db0('0x34')]?_0x1f66c3['attributes']:_0x4be3b7[_0x6db0('0x2d')];if(!_0x40b303[_0x6db0('0x2f')][_0x6db0('0x35')](_0x6db0('0x36'))){_0x1f66c3['limit']=qs[_0x6db0('0x1c')](_0x40b303['query']['limit']);_0x1f66c3[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x40b303[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x1f66c3[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x40b303['query'][_0x6db0('0x38')]);_0x1f66c3[_0x6db0('0x39')]=qs['filters'](_['pick'](_0x40b303[_0x6db0('0x2f')],_0x4be3b7[_0x6db0('0x3a')]));_0x1f66c3[_0x6db0('0x39')][_0x6db0('0x5b')]=_0xdb6c59['id'];if(_0x40b303[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x1f66c3[_0x6db0('0x39')]=_['merge'](_0x1f66c3[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x1f66c3[_0x6db0('0x32')],function(_0x581cad){var _0x4e38bf={};_0x4e38bf[_0x581cad]={'$like':'%'+_0x40b303[_0x6db0('0x2f')]['filter']+'%'};return _0x4e38bf;})});}_0x1f66c3=_['merge']({},_0x1f66c3,_0x40b303[_0x6db0('0x3f')]);return db['CmHopperFinal'][_0x6db0('0x1d')]({'where':_0x1f66c3['where']})[_0x6db0('0x23')](function(_0x2056a0){_0x3d353d[_0x6db0('0x1d')]=_0x2056a0;if(_0x40b303['query']['includeAll']){_0x1f66c3['include']=[{'all':!![]}];}return db[_0x6db0('0x5e')][_0x6db0('0x41')](_0x1f66c3);})['then'](function(_0x32d968){_0x3d353d['rows']=_0x32d968;return _0x3d353d;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x3ea2d7,_0x1f66c3))['catch'](handleError(_0x3ea2d7,null));};exports[_0x6db0('0x5f')]=function(_0x15cecf,_0x601120,_0x2c6174){var _0x566728={'raw':!![],'where':{}};var _0x398ad5={};var _0x2943cd={'count':0x0,'rows':[]};return db[_0x6db0('0x2a')]['findOne']({'where':{'id':_0x15cecf['params']['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x601120,null))['then'](function(_0x3e0fb6){if(_0x3e0fb6){_0x398ad5['model']=_[_0x6db0('0x30')](db['CmHopperBlack'][_0x6db0('0x4e')]);_0x398ad5['query']=_['keys'](_0x15cecf[_0x6db0('0x2f')]);_0x398ad5[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x398ad5['model'],_0x398ad5[_0x6db0('0x2f')]);_0x566728[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x398ad5[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x566728['attributes']=_0x566728[_0x6db0('0x32')][_0x6db0('0x34')]?_0x566728[_0x6db0('0x32')]:_0x398ad5[_0x6db0('0x2d')];if(!_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x35')](_0x6db0('0x36'))){_0x566728[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x15cecf['query'][_0x6db0('0x1c')]);_0x566728[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x566728[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x15cecf[_0x6db0('0x2f')]['sort']);_0x566728[_0x6db0('0x39')]=qs['filters'](_[_0x6db0('0x58')](_0x15cecf['query'],_0x398ad5['filters']));_0x566728[_0x6db0('0x39')][_0x6db0('0x5b')]=_0x3e0fb6['id'];if(_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x566728[_0x6db0('0x39')]=_[_0x6db0('0x3c')](_0x566728[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x566728[_0x6db0('0x32')],function(_0x2043b1){var _0x39219a={};_0x39219a[_0x2043b1]={'$like':'%'+_0x15cecf['query'][_0x6db0('0x3b')]+'%'};return _0x39219a;})});}_0x566728=_[_0x6db0('0x3c')]({},_0x566728,_0x15cecf[_0x6db0('0x3f')]);return db['CmHopperBlack'][_0x6db0('0x1d')]({'where':_0x566728[_0x6db0('0x39')]})['then'](function(_0x4ecfdd){_0x2943cd[_0x6db0('0x1d')]=_0x4ecfdd;if(_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x46')]){_0x566728[_0x6db0('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6db0('0x41')](_0x566728);})[_0x6db0('0x23')](function(_0x2874c8){_0x2943cd[_0x6db0('0x42')]=_0x2874c8;return _0x2943cd;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x601120,_0x566728))['catch'](handleError(_0x601120,null));};exports[_0x6db0('0x60')]=function(_0x74beeb,_0x39a485,_0xcf4ea0){var _0x228fab={};var _0x1bfa52={};var _0x216843;var _0x4e3776;return db[_0x6db0('0x2a')]['findOne']({'where':{'id':_0x74beeb[_0x6db0('0x45')]['id']}})['then'](handleEntityNotFound(_0x39a485,null))[_0x6db0('0x23')](function(_0x2f2bf5){if(_0x2f2bf5){_0x216843=_0x2f2bf5;_0x1bfa52[_0x6db0('0x2d')]=_[_0x6db0('0x30')](db[_0x6db0('0x61')]['rawAttributes']);_0x1bfa52[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x74beeb[_0x6db0('0x2f')]);_0x1bfa52[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x1bfa52[_0x6db0('0x2d')],_0x1bfa52[_0x6db0('0x2f')]);_0x228fab[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x1bfa52['model'],qs[_0x6db0('0x33')](_0x74beeb[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x228fab['attributes']=_0x228fab[_0x6db0('0x32')]['length']?_0x228fab[_0x6db0('0x32')]:_0x1bfa52[_0x6db0('0x2d')];_0x228fab[_0x6db0('0x37')]=qs['sort'](_0x74beeb[_0x6db0('0x2f')]['sort']);_0x228fab[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x74beeb[_0x6db0('0x2f')],_0x1bfa52[_0x6db0('0x3a')]));if(_0x74beeb[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x228fab[_0x6db0('0x39')]=_[_0x6db0('0x3c')](_0x228fab[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x228fab[_0x6db0('0x32')],function(_0x527118){var _0x4b31d3={};_0x4b31d3[_0x527118]={'$like':'%'+_0x74beeb['query'][_0x6db0('0x3b')]+'%'};return _0x4b31d3;})});}_0x228fab=_['merge']({},_0x228fab,_0x74beeb[_0x6db0('0x3f')]);return _0x216843[_0x6db0('0x60')](_0x228fab);}})['then'](function(_0x1e8c7b){if(_0x1e8c7b){_0x4e3776=_0x1e8c7b[_0x6db0('0x34')];if(!_0x74beeb['query'][_0x6db0('0x35')](_0x6db0('0x36'))){_0x228fab['limit']=qs['limit'](_0x74beeb['query'][_0x6db0('0x1c')]);_0x228fab['offset']=qs['offset'](_0x74beeb['query'][_0x6db0('0x1a')]);}return _0x216843[_0x6db0('0x60')](_0x228fab);}})[_0x6db0('0x23')](function(_0x37e15e){if(_0x37e15e){return _0x37e15e?{'count':_0x4e3776,'rows':_0x37e15e}:null;}})['then'](respondWithResult(_0x39a485,null))[_0x6db0('0x43')](handleError(_0x39a485,null));};exports[_0x6db0('0x62')]=function(_0x12463b,_0x501aeb,_0x4e12e9){var _0x5d5226,_0x23afda;var _0x3634e9=[];var _0x5ec701=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6db0('0x2a')][_0x6db0('0x47')]({'where':{'id':_0x12463b[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x501aeb,null))['then'](function(_0x15a671){if(_0x15a671){_0x23afda=_0x15a671;return _0x15a671[_0x6db0('0x62')](_0x12463b['body'][_0x6db0('0x63')],_[_0x6db0('0x52')](_0x12463b['body'],[_0x6db0('0x63'),'id'])||{});}return null;})[_0x6db0('0x64')](function(_0x2ede39){var _0x589907;var _0x1a1290;_0x5d5226=_0x2ede39||[];var _0x544bbe=[];if(_0x2ede39){for(var _0x3b0e1f=0x0;_0x3b0e1f<_0x2ede39[_0x6db0('0x34')];_0x3b0e1f+=0x1){var _0x51c8e9=_0x2ede39[_0x3b0e1f][_0x6db0('0x24')]({'plain':!![]});_0x23afda[_0x6db0('0x65')]=_0x12463b[_0x6db0('0x51')][_0x6db0('0x65')]?_0x12463b['body'][_0x6db0('0x65')]:_0x23afda['dialCheckDuplicateType'];switch(_0x23afda['dialCheckDuplicateType']){case _0x6db0('0x66'):_0x589907=squel['insert']()[_0x6db0('0x67')]('cm_hopper')['fromQuery'](['phone',_0x6db0('0x68'),_0x6db0('0x69'),_0x6db0('0x6a'),_0x6db0('0x5b'),_0x6db0('0x4f'),_0x6db0('0x50')],squel['select']()['field'](_0x6db0('0x6b'),_0x6db0('0x6b'))[_0x6db0('0x6c')](_0x6db0('0x6d'),'scheduledAt')[_0x6db0('0x6c')]('id','ContactId')[_0x6db0('0x6c')](_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))[_0x6db0('0x6c')](_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),'CampaignId')['field']('\x27'+_0x5ec701+'\x27',_0x6db0('0x4f'))[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x50'))[_0x6db0('0x70')](_0x6db0('0x71'))[_0x6db0('0x39')]('deletedAt\x20IS\x20NULL')[_0x6db0('0x39')](_0x6db0('0x72'),_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6db0('0x39')](_0x6db0('0x73'),squel['select']()[_0x6db0('0x6c')](_0x6db0('0x74'))[_0x6db0('0x70')](_0x6db0('0x75'))[_0x6db0('0x39')](_0x6db0('0x76'),_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')]()))[_0x6db0('0x39')](_0x6db0('0x73'),squel[_0x6db0('0x77')]()[_0x6db0('0x6c')](_0x6db0('0x78'))[_0x6db0('0x70')](_0x6db0('0x79'))[_0x6db0('0x39')](_0x6db0('0x76'),_0x12463b[_0x6db0('0x45')]['id']['toString']())))[_0x6db0('0x6f')]();break;case'onlyIfOpen':_0x589907=squel[_0x6db0('0x7a')]()[_0x6db0('0x67')](_0x6db0('0x79'))[_0x6db0('0x7b')](['phone','scheduledAt',_0x6db0('0x69'),_0x6db0('0x6a'),'CampaignId',_0x6db0('0x4f'),_0x6db0('0x50')],squel[_0x6db0('0x77')]()[_0x6db0('0x6c')]('phone',_0x6db0('0x6b'))['field']('NOW()',_0x6db0('0x68'))[_0x6db0('0x6c')]('id','ContactId')[_0x6db0('0x6c')](_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))[_0x6db0('0x6c')](_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),_0x6db0('0x5b'))['field']('\x27'+_0x5ec701+'\x27','createdAt')[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x50'))[_0x6db0('0x70')](_0x6db0('0x71'))['where'](_0x6db0('0x7c'))[_0x6db0('0x39')]('ListId\x20=\x20?',_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')]())[_0x6db0('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x6db0('0x39')](_0x6db0('0x73'),squel['select']()['field'](_0x6db0('0x78'))[_0x6db0('0x70')](_0x6db0('0x79'))[_0x6db0('0x39')](_0x6db0('0x76'),_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')]())))[_0x6db0('0x6f')]();break;default:_0x589907=squel[_0x6db0('0x7a')]()[_0x6db0('0x67')](_0x6db0('0x79'))[_0x6db0('0x7b')]([_0x6db0('0x6b'),'scheduledAt',_0x6db0('0x69'),_0x6db0('0x6a'),'CampaignId',_0x6db0('0x4f'),_0x6db0('0x50')],squel['select']()[_0x6db0('0x6c')](_0x6db0('0x6b'),'phone')[_0x6db0('0x6c')](_0x6db0('0x6d'),_0x6db0('0x68'))[_0x6db0('0x6c')]('id',_0x6db0('0x69'))[_0x6db0('0x6c')](_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))[_0x6db0('0x6c')](_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),_0x6db0('0x5b'))['field']('\x27'+_0x5ec701+'\x27','createdAt')[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x50'))[_0x6db0('0x70')](_0x6db0('0x71'))[_0x6db0('0x39')]('deletedAt\x20IS\x20NULL')[_0x6db0('0x39')]('ListId\x20=\x20?',_0x51c8e9['CmListId'][_0x6db0('0x6f')]())[_0x6db0('0x39')](_0x6db0('0x7d')))[_0x6db0('0x6f')]();}_0x1a1290=squel['insert']()[_0x6db0('0x67')](_0x6db0('0x7e'))[_0x6db0('0x7b')]([_0x6db0('0x7f'),_0x6db0('0x68'),_0x6db0('0x6b'),_0x6db0('0x80'),_0x6db0('0x4f'),'updatedAt'],squel['select']()[_0x6db0('0x6c')](_0x6db0('0x81'),'id')[_0x6db0('0x6c')](_0x6db0('0x6d'),_0x6db0('0x68'))[_0x6db0('0x6c')]('ci.item',_0x6db0('0x6b'))[_0x6db0('0x6c')](_0x6db0('0x82'),_0x6db0('0x80'))[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x4f'))[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27','updatedAt')[_0x6db0('0x70')](_0x6db0('0x83'),'ci')[_0x6db0('0x84')](_0x6db0('0x79'),'h',_0x6db0('0x85'))['where']('h.ListId\x20=\x20?',_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')]())['where']('h.CampaignId=?',_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')]())[_0x6db0('0x39')]('h.createdAt\x20=\x20?',_0x5ec701))['toString']();_0x544bbe[_0x6db0('0x86')](db[_0x6db0('0x87')][_0x6db0('0x2f')](_0x589907));_0x3634e9[_0x6db0('0x86')](db[_0x6db0('0x87')]['query'](_0x1a1290));}return BPromise[_0x6db0('0x88')](_0x544bbe);}})[_0x6db0('0x23')](function(){return BPromise[_0x6db0('0x88')](_0x3634e9);})[_0x6db0('0x23')](function(){return _0x5d5226;})[_0x6db0('0x23')](respondWithResult(_0x501aeb,null))[_0x6db0('0x43')](handleError(_0x501aeb,null));};exports[_0x6db0('0x89')]=function(_0x49b04e,_0x56e35e,_0x503b22){return db['Campaign']['find']({'where':{'id':_0x49b04e[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x56e35e,null))['then'](function(_0x58dbb1){if(_0x58dbb1){return _0x58dbb1[_0x6db0('0x89')](_0x49b04e[_0x6db0('0x2f')][_0x6db0('0x63')]);}})[_0x6db0('0x23')](function(_0x8a3fa6){if(_0x8a3fa6){return db[_0x6db0('0x57')][_0x6db0('0x8a')]({'where':{'ListId':_0x49b04e[_0x6db0('0x2f')][_0x6db0('0x63')],'CampaignId':_0x49b04e[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](function(){return _0x8a3fa6;});}})[_0x6db0('0x23')](respondWithStatusCode(_0x56e35e,null))[_0x6db0('0x43')](handleError(_0x56e35e,null));};exports['getBlackLists']=function(_0x53aae4,_0x548717,_0x47955b){var _0x124431={};var _0x10fdda={};var _0x1d2b0d;var _0x1069e8;return db[_0x6db0('0x2a')][_0x6db0('0x5a')]({'where':{'id':_0x53aae4[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x548717,null))[_0x6db0('0x23')](function(_0x1e852c){if(_0x1e852c){_0x1d2b0d=_0x1e852c;_0x10fdda[_0x6db0('0x2d')]=_[_0x6db0('0x30')](db[_0x6db0('0x61')][_0x6db0('0x4e')]);_0x10fdda[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x53aae4[_0x6db0('0x2f')]);_0x10fdda[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x10fdda[_0x6db0('0x2d')],_0x10fdda[_0x6db0('0x2f')]);_0x124431[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x10fdda[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x53aae4['query'][_0x6db0('0x33')]));_0x124431['attributes']=_0x124431['attributes']['length']?_0x124431[_0x6db0('0x32')]:_0x10fdda['model'];_0x124431['order']=qs[_0x6db0('0x38')](_0x53aae4[_0x6db0('0x2f')][_0x6db0('0x38')]);_0x124431[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x53aae4[_0x6db0('0x2f')],_0x10fdda['filters']));if(_0x53aae4['query'][_0x6db0('0x3b')]){_0x124431[_0x6db0('0x39')]=_['merge'](_0x124431[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x124431[_0x6db0('0x32')],function(_0xa2da21){var _0xdd9418={};_0xdd9418[_0xa2da21]={'$like':'%'+_0x53aae4[_0x6db0('0x2f')][_0x6db0('0x3b')]+'%'};return _0xdd9418;})});}_0x124431=_[_0x6db0('0x3c')]({},_0x124431,_0x53aae4[_0x6db0('0x3f')]);return _0x1d2b0d['getBlackLists'](_0x124431);}})[_0x6db0('0x23')](function(_0x452f93){if(_0x452f93){_0x1069e8=_0x452f93[_0x6db0('0x34')];if(!_0x53aae4[_0x6db0('0x2f')][_0x6db0('0x35')]('nolimit')){_0x124431[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x53aae4['query']['limit']);_0x124431[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x53aae4[_0x6db0('0x2f')]['offset']);}return _0x1d2b0d['getBlackLists'](_0x124431);}})[_0x6db0('0x23')](function(_0x376c05){if(_0x376c05){return _0x376c05?{'count':_0x1069e8,'rows':_0x376c05}:null;}})[_0x6db0('0x23')](respondWithResult(_0x548717,null))['catch'](handleError(_0x548717,null));};exports['addBlackLists']=function(_0x37750c,_0x4cd23a,_0x2ec422){var _0x1cd566,_0x5830ad;var _0x30e548=[];var _0x5e1b92=moment()[_0x6db0('0x8b')](_0x6db0('0x8c'));return db[_0x6db0('0x2a')][_0x6db0('0x47')]({'where':{'id':_0x37750c[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x4cd23a,null))[_0x6db0('0x23')](function(_0x1c2edb){if(_0x1c2edb){_0x5830ad=_0x1c2edb;return _0x1c2edb[_0x6db0('0x8d')](_0x37750c[_0x6db0('0x51')][_0x6db0('0x63')],_['omit'](_0x37750c[_0x6db0('0x51')],['ids','id'])||{});}return null;})[_0x6db0('0x64')](function(_0x2c3ec0){var _0x13401b;var _0x316380;_0x1cd566=_0x2c3ec0||[];var _0x1c7dbc=[];if(_0x2c3ec0){for(var _0x319d9e=0x0;_0x319d9e<_0x2c3ec0['length'];_0x319d9e+=0x1){var _0x104007=_0x2c3ec0[_0x319d9e]['get']({'plain':!![]});_0x13401b=squel[_0x6db0('0x7a')]()[_0x6db0('0x67')](_0x6db0('0x8e'))[_0x6db0('0x7b')](['phone','ContactId',_0x6db0('0x6a'),_0x6db0('0x5b'),_0x6db0('0x4f'),_0x6db0('0x50')],squel[_0x6db0('0x77')]()[_0x6db0('0x6c')](_0x6db0('0x6b'),_0x6db0('0x6b'))['field']('id',_0x6db0('0x69'))[_0x6db0('0x6c')](_0x104007[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))['field'](_0x37750c[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),_0x6db0('0x5b'))[_0x6db0('0x6c')](_0x6db0('0x6d'),_0x6db0('0x4f'))[_0x6db0('0x6c')](_0x6db0('0x6d'),'updatedAt')['from'](_0x6db0('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0x6db0('0x39')](_0x6db0('0x72'),_0x104007[_0x6db0('0x6e')][_0x6db0('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6db0('0x6f')]();_0x1c7dbc[_0x6db0('0x86')](db['sequelize'][_0x6db0('0x2f')](_0x13401b));}return BPromise[_0x6db0('0x88')](_0x1c7dbc);}})[_0x6db0('0x23')](function(){return _0x1cd566;})['then'](respondWithResult(_0x4cd23a,null))['catch'](handleError(_0x4cd23a,null));};exports[_0x6db0('0x8f')]=function(_0x3979ff,_0x268996,_0x430f57){return db['Campaign'][_0x6db0('0x47')]({'where':{'id':_0x3979ff[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x268996,null))['then'](function(_0x3dd3a0){if(_0x3dd3a0){return _0x3dd3a0['removeBlackLists'](_0x3979ff[_0x6db0('0x2f')][_0x6db0('0x63')]);}})[_0x6db0('0x23')](function(_0xef6ba0){if(_0xef6ba0){return db[_0x6db0('0x90')][_0x6db0('0x8a')]({'where':{'ListId':_0x3979ff['query']['ids'],'CampaignId':_0x3979ff['params']['id']}})['then'](function(){return _0xef6ba0;});}})[_0x6db0('0x23')](respondWithStatusCode(_0x268996,null))[_0x6db0('0x43')](handleError(_0x268996,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 808aefd..2a875de 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x369bae,_0xaed164){var _0x585cb8=function(_0x5947fd){while(--_0x5947fd){_0x369bae['push'](_0x369bae['shift']());}};_0x585cb8(++_0xaed164);}(_0x7a54,0x106));var _0x47a5=function(_0x54c7d4,_0x598f6a){_0x54c7d4=_0x54c7d4-0x0;var _0x300b9e=_0x7a54[_0x54c7d4];return _0x300b9e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8e4f89d..aadf2fe 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 _0xd691=['result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd691,0xe6));var _0x1d69=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0xd691[_0x137d1d];return _0x485108;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var moment=require(_0x1d69('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d69('0x3'));var fs=require('fs');var Redis=require(_0x1d69('0x4'));var db=require(_0x1d69('0x5'))['db'];var utils=require(_0x1d69('0x6'));var logger=require(_0x1d69('0x7'))(_0x1d69('0x8'));var config=require(_0x1d69('0x9'));var jayson=require(_0x1d69('0xa'));var client=jayson[_0x1d69('0xb')][_0x1d69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b0c,_0x520acb,_0x267da3){return new BPromise(function(_0x49f008,_0x369d44){return client[_0x1d69('0xd')](_0x5a5b0c,_0x267da3)[_0x1d69('0xe')](function(_0x364061){logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));logger[_0x1d69('0x11')](_0x1d69('0x12'),_0x520acb,_0x1d69('0x10'),JSON['stringify'](_0x364061));if(_0x364061['error']){if(_0x364061[_0x1d69('0x13')][_0x1d69('0x14')]===0x1f4){logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x369d44(_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);}logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x49f008(_0x364061[_0x1d69('0x13')]['message']);}else{logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));_0x49f008(_0x364061[_0x1d69('0x16')][_0x1d69('0x15')]);}})[_0x1d69('0x17')](function(_0x383771){logger['error'](_0x1d69('0xf'),_0x520acb,_0x383771);_0x369d44(_0x383771);});});}exports[_0x1d69('0x18')]=function(_0x34f6d4){var _0x53915f=this;return new Promise(function(_0x4cebea,_0x258249){return db[_0x1d69('0x19')][_0x1d69('0x1a')]({'raw':_0x34f6d4['options']?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1c')]===undefined?!![]:![]:!![],'where':_0x34f6d4[_0x1d69('0x1b')]?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1d')]||null:null,'attributes':_0x34f6d4[_0x1d69('0x1b')]?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1e')]||null:null,'limit':_0x34f6d4['options']?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1f')]||null:null,'include':_0x34f6d4[_0x1d69('0x1b')]?_0x34f6d4[_0x1d69('0x1b')]['include']?_[_0x1d69('0x20')](_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x21')],function(_0x54783d){return{'model':db[_0x54783d['model']],'as':_0x54783d['as'],'attributes':_0x54783d['attributes'],'include':_0x54783d[_0x1d69('0x21')]?_[_0x1d69('0x20')](_0x54783d[_0x1d69('0x21')],function(_0x1c91bf){return{'model':db[_0x1c91bf['model']],'as':_0x1c91bf['as'],'attributes':_0x1c91bf[_0x1d69('0x1e')],'include':_0x1c91bf[_0x1d69('0x21')]?_['map'](_0x1c91bf[_0x1d69('0x21')],function(_0x2dc73f){return{'model':db[_0x2dc73f[_0x1d69('0x22')]],'as':_0x2dc73f['as'],'attributes':_0x2dc73f[_0x1d69('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1d69('0xe')](function(_0x247130){logger['info'](_0x1d69('0x18'),_0x34f6d4);logger[_0x1d69('0x11')](_0x1d69('0x18'),_0x34f6d4,JSON[_0x1d69('0x23')](_0x247130));_0x4cebea(_0x247130);})[_0x1d69('0x17')](function(_0x1e5818){logger[_0x1d69('0x13')](_0x1d69('0x18'),_0x1e5818[_0x1d69('0x15')],_0x34f6d4);_0x258249(_0x53915f[_0x1d69('0x13')](0x1f4,_0x1e5818[_0x1d69('0x15')]));});});}; \ No newline at end of file +var _0x342e=['result','catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x364b65,_0x38738e){var _0x33ba39=function(_0x371ef2){while(--_0x371ef2){_0x364b65['push'](_0x364b65['shift']());}};_0x33ba39(++_0x38738e);}(_0x342e,0xde));var _0xe342=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x342e[_0x22431e];return _0xd978e9;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var moment=require(_0xe342('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe342('0x3'));var db=require(_0xe342('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe342('0x5'));var config=require(_0xe342('0x6'));var jayson=require(_0xe342('0x7'));var client=jayson[_0xe342('0x8')][_0xe342('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e643a,_0x57895b,_0x3457ac){return new BPromise(function(_0x36bb18,_0x54868d){return client['request'](_0x5e643a,_0x3457ac)[_0xe342('0xa')](function(_0x2b2e82){logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));logger[_0xe342('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x57895b,_0xe342('0xd'),JSON[_0xe342('0xf')](_0x2b2e82));if(_0x2b2e82[_0xe342('0x10')]){if(_0x2b2e82[_0xe342('0x10')]['code']===0x1f4){logger[_0xe342('0x10')]('Campaign,\x20%s,\x20%s',_0x57895b,_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);return _0x54868d(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}logger['error'](_0xe342('0xc'),_0x57895b,_0x2b2e82[_0xe342('0x10')]['message']);return _0x36bb18(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}else{logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));_0x36bb18(_0x2b2e82[_0xe342('0x12')][_0xe342('0x11')]);}})[_0xe342('0x13')](function(_0x190a90){logger[_0xe342('0x10')](_0xe342('0xc'),_0x57895b,_0x190a90);_0x54868d(_0x190a90);});});}exports['GetCampaign']=function(_0xf70e61){var _0x51eb22=this;return new Promise(function(_0x5df492,_0x394062){return db[_0xe342('0x14')][_0xe342('0x15')]({'raw':_0xf70e61[_0xe342('0x16')]?_0xf70e61[_0xe342('0x16')][_0xe342('0x17')]===undefined?!![]:![]:!![],'where':_0xf70e61[_0xe342('0x16')]?_0xf70e61[_0xe342('0x16')][_0xe342('0x18')]||null:null,'attributes':_0xf70e61['options']?_0xf70e61[_0xe342('0x16')][_0xe342('0x19')]||null:null,'limit':_0xf70e61['options']?_0xf70e61[_0xe342('0x16')]['limit']||null:null,'include':_0xf70e61[_0xe342('0x16')]?_0xf70e61[_0xe342('0x16')][_0xe342('0x1a')]?_[_0xe342('0x1b')](_0xf70e61['options'][_0xe342('0x1a')],function(_0x415aaf){return{'model':db[_0x415aaf[_0xe342('0x1c')]],'as':_0x415aaf['as'],'attributes':_0x415aaf['attributes'],'include':_0x415aaf['include']?_[_0xe342('0x1b')](_0x415aaf[_0xe342('0x1a')],function(_0x5e6e3f){return{'model':db[_0x5e6e3f[_0xe342('0x1c')]],'as':_0x5e6e3f['as'],'attributes':_0x5e6e3f[_0xe342('0x19')],'include':_0x5e6e3f[_0xe342('0x1a')]?_[_0xe342('0x1b')](_0x5e6e3f[_0xe342('0x1a')],function(_0x20f9cc){return{'model':db[_0x20f9cc['model']],'as':_0x20f9cc['as'],'attributes':_0x20f9cc[_0xe342('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2625a7){logger[_0xe342('0xb')]('GetCampaign',_0xf70e61);logger['debug'](_0xe342('0x1d'),_0xf70e61,JSON[_0xe342('0xf')](_0x2625a7));_0x5df492(_0x2625a7);})[_0xe342('0x13')](function(_0x2e4df6){logger[_0xe342('0x10')](_0xe342('0x1d'),_0x2e4df6[_0xe342('0x11')],_0xf70e61);_0x394062(_0x51eb22[_0xe342('0x10')](0x1f4,_0x2e4df6[_0xe342('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9975aad..f77ec96 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 _0x6eeb=['get','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','addLists','addBlackLists','put','update','delete','destroy','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller'];(function(_0x4e3d1f,_0x5a84c2){var _0x84644c=function(_0x14492d){while(--_0x14492d){_0x4e3d1f['push'](_0x4e3d1f['shift']());}};_0x84644c(++_0x5a84c2);}(_0x6eeb,0x1a9));var _0xb6ee=function(_0x5104ec,_0x11722d){_0x5104ec=_0x5104ec-0x0;var _0x22b805=_0x6eeb[_0x5104ec];return _0x22b805;};'use strict';var multer=require('multer');var util=require(_0xb6ee('0x0'));var path=require(_0xb6ee('0x1'));var timeout=require(_0xb6ee('0x2'));var express=require(_0xb6ee('0x3'));var router=express[_0xb6ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6ee('0x5'));var interaction=require(_0xb6ee('0x6'));var config=require(_0xb6ee('0x7'));var controller=require(_0xb6ee('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb6ee('0x9')](_0xb6ee('0xa'),auth[_0xb6ee('0xb')](),controller['show']);router[_0xb6ee('0x9')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xb6ee('0xc')]);router[_0xb6ee('0x9')](_0xb6ee('0xd'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0xe')]);router[_0xb6ee('0x9')](_0xb6ee('0xf'),auth['isAuthenticated'](),controller[_0xb6ee('0x10')]);router['get'](_0xb6ee('0x11'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x12')]);router[_0xb6ee('0x9')](_0xb6ee('0x13'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x14')]);router[_0xb6ee('0x9')](_0xb6ee('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xb6ee('0x16')]('/',auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x17')]);router['post']('/:id/clone',auth[_0xb6ee('0xb')](),controller['clone']);router[_0xb6ee('0x16')]('/:id/lists',auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x18')]);router[_0xb6ee('0x16')](_0xb6ee('0x15'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x19')]);router[_0xb6ee('0x1a')]('/:id',auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x1b')]);router[_0xb6ee('0x1c')](_0xb6ee('0xa'),auth['isAuthenticated'](),controller[_0xb6ee('0x1d')]);router[_0xb6ee('0x1c')](_0xb6ee('0x13'),auth['isAuthenticated'](),controller['removeLists']);router[_0xb6ee('0x1c')]('/:id/blacklists',auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x923f=['update','delete','removeBlackLists','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/blacklists','getBlackLists','post','/:id/clone','clone','/:id/lists','addLists'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x923f,0x7b));var _0xf923=function(_0x4b1ebf,_0x3c9fcb){_0x4b1ebf=_0x4b1ebf-0x0;var _0x416975=_0x923f[_0x4b1ebf];return _0x416975;};'use strict';var multer=require(_0xf923('0x0'));var util=require(_0xf923('0x1'));var path=require(_0xf923('0x2'));var timeout=require(_0xf923('0x3'));var express=require(_0xf923('0x4'));var router=express['Router']();var fs_extra=require(_0xf923('0x5'));var auth=require(_0xf923('0x6'));var interaction=require(_0xf923('0x7'));var config=require('../../config/environment');var controller=require(_0xf923('0x8'));router['get']('/',auth[_0xf923('0x9')](),controller['index']);router[_0xf923('0xa')](_0xf923('0xb'),auth[_0xf923('0x9')](),controller[_0xf923('0xc')]);router[_0xf923('0xa')](_0xf923('0xd'),auth['isAuthenticated'](),controller[_0xf923('0xe')]);router['get'](_0xf923('0xf'),auth['isAuthenticated'](),controller[_0xf923('0x10')]);router[_0xf923('0xa')](_0xf923('0x11'),auth[_0xf923('0x9')](),controller[_0xf923('0x12')]);router['get'](_0xf923('0x13'),auth[_0xf923('0x9')](),controller['getHopperBlacks']);router[_0xf923('0xa')]('/:id/lists',auth[_0xf923('0x9')](),controller['getLists']);router[_0xf923('0xa')](_0xf923('0x14'),auth[_0xf923('0x9')](),controller[_0xf923('0x15')]);router[_0xf923('0x16')]('/',auth[_0xf923('0x9')](),controller['create']);router[_0xf923('0x16')](_0xf923('0x17'),auth[_0xf923('0x9')](),controller[_0xf923('0x18')]);router[_0xf923('0x16')](_0xf923('0x19'),auth[_0xf923('0x9')](),controller[_0xf923('0x1a')]);router[_0xf923('0x16')](_0xf923('0x14'),auth[_0xf923('0x9')](),controller['addBlackLists']);router['put'](_0xf923('0xb'),auth['isAuthenticated'](),controller[_0xf923('0x1b')]);router[_0xf923('0x1c')](_0xf923('0xb'),auth[_0xf923('0x9')](),controller['destroy']);router[_0xf923('0x1c')](_0xf923('0x19'),auth[_0xf923('0x9')](),controller['removeLists']);router['delete']('/:id/blacklists',auth[_0xf923('0x9')](),controller[_0xf923('0x1d')]);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 933723c..1b91232 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 _0x0491=['VIRTUAL','getDataValue','sequelize','exports','STRING'];(function(_0x3072e2,_0x648a09){var _0x42c45b=function(_0x2ddff5){while(--_0x2ddff5){_0x3072e2['push'](_0x3072e2['shift']());}};_0x42c45b(++_0x648a09);}(_0x0491,0x101));var _0x1049=function(_0x538829,_0x3075d1){_0x538829=_0x538829-0x0;var _0x34a6fd=_0x0491[_0x538829];return _0x34a6fd;};'use strict';var Sequelize=require(_0x1049('0x0'));module[_0x1049('0x1')]={'key':{'type':Sequelize[_0x1049('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x1049('0x2')]},'name':{'type':Sequelize[_0x1049('0x3')],'get':function(){return this[_0x1049('0x4')]('key');}}}; \ No newline at end of file +var _0x8032=['STRING','TEXT'];(function(_0x39bdce,_0x563440){var _0x4bf712=function(_0x11c0bf){while(--_0x11c0bf){_0x39bdce['push'](_0x39bdce['shift']());}};_0x4bf712(++_0x563440);}(_0x8032,0x81));var _0x2803=function(_0x482c95,_0x504190){_0x482c95=_0x482c95-0x0;var _0x38c2e8=_0x8032[_0x482c95];return _0x38c2e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x2803('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x2803('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6bf2b4f..caf2608 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 _0x5ad6=['query','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','include','rows','catch','params','includeAll','find','body','create','MailAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','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/environment','../../config/license/util','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','CannedAnswers','UserProfileResource','destroy','end','sendStatus','error','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','keys','filters','intersection'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x5ad6,0x183));var _0x65ad=function(_0x2d2d37,_0x5778a6){_0x2d2d37=_0x2d2d37-0x0;var _0x55bbce=_0x5ad6[_0x2d2d37];return _0x55bbce;};'use strict';var emlformat=require(_0x65ad('0x0'));var rimraf=require(_0x65ad('0x1'));var zipdir=require(_0x65ad('0x2'));var jsonpatch=require(_0x65ad('0x3'));var rp=require(_0x65ad('0x4'));var moment=require(_0x65ad('0x5'));var BPromise=require(_0x65ad('0x6'));var Mustache=require('mustache');var util=require(_0x65ad('0x7'));var path=require(_0x65ad('0x8'));var sox=require(_0x65ad('0x9'));var csv=require('to-csv');var ejs=require(_0x65ad('0xa'));var fs=require('fs');var fs_extra=require(_0x65ad('0xb'));var _=require(_0x65ad('0xc'));var squel=require('squel');var crypto=require(_0x65ad('0xd'));var jsforce=require(_0x65ad('0xe'));var deskjs=require(_0x65ad('0xf'));var toCsv=require('to-csv');var querystring=require(_0x65ad('0x10'));var Papa=require(_0x65ad('0x11'));var Redis=require(_0x65ad('0x12'));var authService=require(_0x65ad('0x13'));var qs=require(_0x65ad('0x14'));var as=require(_0x65ad('0x15'));var hardwareService=require(_0x65ad('0x16'));var logger=require(_0x65ad('0x17'))(_0x65ad('0x18'));var utils=require(_0x65ad('0x19'));var config=require(_0x65ad('0x1a'));var licenseUtil=require(_0x65ad('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f478f,_0x274881){_0x274881=_0x274881||0xcc;return function(_0x5cd9e5){if(_0x5cd9e5){return _0x3f478f['sendStatus'](_0x274881);}return _0x3f478f[_0x65ad('0x1c')](_0x274881)['end']();};}function respondWithResult(_0x49e99b,_0x1271fa){_0x1271fa=_0x1271fa||0xc8;return function(_0x1c71b6){if(_0x1c71b6){return _0x49e99b[_0x65ad('0x1c')](_0x1271fa)[_0x65ad('0x1d')](_0x1c71b6);}};}function respondWithFilteredResult(_0x344b93,_0x1ee983){return function(_0x38abd1){if(_0x38abd1){var _0x48402f=typeof _0x1ee983['offset']===_0x65ad('0x1e')&&typeof _0x1ee983['limit']===_0x65ad('0x1e');var _0x5166d1=_0x38abd1[_0x65ad('0x1f')];var _0x24cc8a=_0x48402f?0x0:_0x1ee983['offset'];var _0x1075db=_0x48402f?_0x38abd1[_0x65ad('0x1f')]:_0x1ee983[_0x65ad('0x20')]+_0x1ee983[_0x65ad('0x21')];var _0xf5bf42;if(_0x1075db>=_0x5166d1){_0x1075db=_0x5166d1;_0xf5bf42=0xc8;}else{_0xf5bf42=0xce;}_0x344b93[_0x65ad('0x1c')](_0xf5bf42);return _0x344b93[_0x65ad('0x22')](_0x65ad('0x23'),_0x24cc8a+'-'+_0x1075db+'/'+_0x5166d1)[_0x65ad('0x1d')](_0x38abd1);}return null;};}function patchUpdates(_0x21b90d){return function(_0x53da32){try{jsonpatch[_0x65ad('0x24')](_0x53da32,_0x21b90d,!![]);}catch(_0x1c6cc2){return BPromise[_0x65ad('0x25')](_0x1c6cc2);}return _0x53da32[_0x65ad('0x26')]();};}function saveUpdates(_0x1390a4,_0x4cb4b9){return function(_0x3a58ed){if(_0x3a58ed){return _0x3a58ed['update'](_0x1390a4)[_0x65ad('0x27')](function(_0x2e8042){return _0x2e8042;});}return null;};}function removeEntity(_0x169f92,_0x30ab5a){return function(_0x56dd55){if(_0x56dd55){return _0x56dd55['destroy']()[_0x65ad('0x27')](function(){var _0x1b3fb5=_0x56dd55['get']({'plain':!![]});var _0x25b250=_0x65ad('0x28');return db[_0x65ad('0x29')][_0x65ad('0x2a')]({'where':{'type':_0x25b250,'resourceId':_0x1b3fb5['id']}})[_0x65ad('0x27')](function(){return _0x56dd55;});})['then'](function(){_0x169f92[_0x65ad('0x1c')](0xcc)[_0x65ad('0x2b')]();});}};}function handleEntityNotFound(_0x345371,_0x38b5e8){return function(_0x236474){if(!_0x236474){_0x345371[_0x65ad('0x2c')](0x194);}return _0x236474;};}function handleError(_0x57b887,_0x3d29cf){_0x3d29cf=_0x3d29cf||0x1f4;return function(_0x2ff2d0){logger[_0x65ad('0x2d')](_0x2ff2d0['stack']);if(_0x2ff2d0[_0x65ad('0x2e')]){delete _0x2ff2d0[_0x65ad('0x2e')];}_0x57b887[_0x65ad('0x1c')](_0x3d29cf)[_0x65ad('0x2f')](_0x2ff2d0);};}exports[_0x65ad('0x30')]=function(_0x2fdb35,_0x5eddaa){var _0x5629cf={},_0x2fcca6={},_0x5d8f2b={'count':0x0,'rows':[]};var _0x522716=_[_0x65ad('0x31')](db[_0x65ad('0x32')][_0x65ad('0x33')],function(_0x41f735){return{'name':_0x41f735['fieldName'],'type':_0x41f735[_0x65ad('0x34')][_0x65ad('0x35')]};});_0x2fcca6[_0x65ad('0x36')]=_[_0x65ad('0x31')](_0x522716,'name');_0x2fcca6['query']=_[_0x65ad('0x37')](_0x2fdb35['query']);_0x2fcca6[_0x65ad('0x38')]=_[_0x65ad('0x39')](_0x2fcca6[_0x65ad('0x36')],_0x2fcca6[_0x65ad('0x3a')]);_0x5629cf['attributes']=_['intersection'](_0x2fcca6[_0x65ad('0x36')],qs[_0x65ad('0x3b')](_0x2fdb35['query'][_0x65ad('0x3b')]));_0x5629cf[_0x65ad('0x3c')]=_0x5629cf[_0x65ad('0x3c')][_0x65ad('0x3d')]?_0x5629cf['attributes']:_0x2fcca6[_0x65ad('0x36')];if(!_0x2fdb35[_0x65ad('0x3a')]['hasOwnProperty'](_0x65ad('0x3e'))){_0x5629cf[_0x65ad('0x21')]=qs['limit'](_0x2fdb35[_0x65ad('0x3a')][_0x65ad('0x21')]);_0x5629cf[_0x65ad('0x20')]=qs[_0x65ad('0x20')](_0x2fdb35[_0x65ad('0x3a')][_0x65ad('0x20')]);}_0x5629cf[_0x65ad('0x3f')]=qs['sort'](_0x2fdb35['query'][_0x65ad('0x40')]);_0x5629cf[_0x65ad('0x41')]=qs['filters'](_['pick'](_0x2fdb35['query'],_0x2fcca6[_0x65ad('0x38')]),_0x522716);if(_0x2fdb35[_0x65ad('0x3a')]['filter']){_0x5629cf['where']=_['merge'](_0x5629cf['where'],{'$or':[{'key':{'$like':'%'+_0x2fdb35[_0x65ad('0x3a')][_0x65ad('0x42')]+'%'}},{'value':{'$like':'%'+_0x2fdb35[_0x65ad('0x3a')][_0x65ad('0x42')]+'%'}}]});}_0x5629cf=_[_0x65ad('0x43')]({},_0x5629cf,_0x2fdb35[_0x65ad('0x44')]);var _0x2a557c={'where':_0x5629cf[_0x65ad('0x41')]};return db['CannedAnswer'][_0x65ad('0x1f')](_0x2a557c)[_0x65ad('0x27')](function(_0x311397){_0x5d8f2b['count']=_0x311397;if(_0x2fdb35[_0x65ad('0x3a')]['includeAll']){_0x5629cf[_0x65ad('0x45')]=[{'all':!![]}];}return db[_0x65ad('0x32')]['findAll'](_0x5629cf);})[_0x65ad('0x27')](function(_0x283a41){_0x5d8f2b[_0x65ad('0x46')]=_0x283a41;return _0x5d8f2b;})[_0x65ad('0x27')](respondWithFilteredResult(_0x5eddaa,_0x5629cf))[_0x65ad('0x47')](handleError(_0x5eddaa,null));};exports['show']=function(_0x175904,_0x442165){var _0x41fff9={'raw':!![],'where':{'id':_0x175904[_0x65ad('0x48')]['id']}},_0x3cf750={};_0x3cf750[_0x65ad('0x36')]=_[_0x65ad('0x37')](db[_0x65ad('0x32')]['rawAttributes']);_0x3cf750[_0x65ad('0x3a')]=_[_0x65ad('0x37')](_0x175904[_0x65ad('0x3a')]);_0x3cf750[_0x65ad('0x38')]=_[_0x65ad('0x39')](_0x3cf750[_0x65ad('0x36')],_0x3cf750[_0x65ad('0x3a')]);_0x41fff9[_0x65ad('0x3c')]=_[_0x65ad('0x39')](_0x3cf750[_0x65ad('0x36')],qs[_0x65ad('0x3b')](_0x175904[_0x65ad('0x3a')]['fields']));_0x41fff9['attributes']=_0x41fff9[_0x65ad('0x3c')]['length']?_0x41fff9[_0x65ad('0x3c')]:_0x3cf750['model'];if(_0x175904[_0x65ad('0x3a')][_0x65ad('0x49')]){_0x41fff9[_0x65ad('0x45')]=[{'all':!![]}];}_0x41fff9=_[_0x65ad('0x43')]({},_0x41fff9,_0x175904[_0x65ad('0x44')]);return db[_0x65ad('0x32')][_0x65ad('0x4a')](_0x41fff9)['then'](handleEntityNotFound(_0x442165,null))[_0x65ad('0x27')](respondWithResult(_0x442165,null))['catch'](handleError(_0x442165,null));};exports['update']=function(_0x5b592d,_0x3fd77c){if(_0x5b592d[_0x65ad('0x4b')]['id']){delete _0x5b592d[_0x65ad('0x4b')]['id'];}return db[_0x65ad('0x32')]['find']({'where':{'id':_0x5b592d[_0x65ad('0x48')]['id']}})[_0x65ad('0x27')](handleEntityNotFound(_0x3fd77c,null))['then'](saveUpdates(_0x5b592d[_0x65ad('0x4b')],null))['then'](respondWithResult(_0x3fd77c,null))['catch'](handleError(_0x3fd77c,null));};exports[_0x65ad('0x2a')]=function(_0x2e119f,_0x9698d1){return db[_0x65ad('0x32')][_0x65ad('0x4a')]({'where':{'id':_0x2e119f[_0x65ad('0x48')]['id']}})[_0x65ad('0x27')](handleEntityNotFound(_0x9698d1,null))[_0x65ad('0x27')](removeEntity(_0x9698d1,null))[_0x65ad('0x47')](handleError(_0x9698d1,null));};exports[_0x65ad('0x4c')]=function(_0x4dffc9,_0x132135){var _0x139b6a={'key':_0x4dffc9[_0x65ad('0x4b')][_0x65ad('0x35')]};if(_0x4dffc9['body'][_0x65ad('0x4d')]){_0x139b6a[_0x65ad('0x4d')]=_0x4dffc9[_0x65ad('0x4b')][_0x65ad('0x4d')];}else if(_0x4dffc9[_0x65ad('0x4b')]['SmsAccountId']){_0x139b6a['SmsAccountId']=_0x4dffc9['body']['SmsAccountId'];}else if(_0x4dffc9[_0x65ad('0x4b')][_0x65ad('0x4e')]){_0x139b6a['OpenchannelAccountId']=_0x4dffc9['body'][_0x65ad('0x4e')];}else if(_0x4dffc9[_0x65ad('0x4b')]['ChatWebsiteId']){_0x139b6a[_0x65ad('0x4f')]=_0x4dffc9[_0x65ad('0x4b')][_0x65ad('0x4f')];}return db[_0x65ad('0x32')][_0x65ad('0x4a')]({'where':_0x139b6a})[_0x65ad('0x27')](function(_0x2fbf30){if(_0x2fbf30){throw new db[(_0x65ad('0x50'))][(_0x65ad('0x51'))](_0x65ad('0x52'));}return db[_0x65ad('0x32')][_0x65ad('0x4c')](_0x4dffc9[_0x65ad('0x4b')]);})[_0x65ad('0x27')](function(_0x109fe7){var _0x2f0142=_0x4dffc9[_0x65ad('0x53')][_0x65ad('0x54')]({'plain':!![]});if(!_0x2f0142)throw new Error(_0x65ad('0x55'));if(_0x2f0142[_0x65ad('0x56')]===_0x65ad('0x53')){var _0x49f345=_0x109fe7['get']({'plain':!![]});return db['UserProfileSection'][_0x65ad('0x4a')]({'where':{'name':_0x65ad('0x28'),'userProfileId':_0x2f0142[_0x65ad('0x57')]},'raw':!![]})[_0x65ad('0x27')](function(_0x7d2421){if(_0x7d2421&&_0x7d2421['autoAssociation']===0x0){return db[_0x65ad('0x29')][_0x65ad('0x4c')]({'name':_0x49f345[_0x65ad('0x2e')],'resourceId':_0x49f345['id'],'type':_0x7d2421['name'],'sectionId':_0x7d2421['id']},{})['then'](function(){return _0x109fe7;});}else{return _0x109fe7;}})['catch'](function(_0x417611){logger[_0x65ad('0x2d')](_0x65ad('0x58'),_0x417611);throw _0x417611;});}return _0x109fe7;})['then'](respondWithResult(_0x132135,0xc9))[_0x65ad('0x47')](handleError(_0x132135,null));}; \ No newline at end of file +var _0xae3a=['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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','reject','save','then','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','CannedAnswer','count','includeAll','include','rows','catch','length','update','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs'];(function(_0x1ea2a7,_0x14c846){var _0x36fdec=function(_0x19d7f9){while(--_0x19d7f9){_0x1ea2a7['push'](_0x1ea2a7['shift']());}};_0x36fdec(++_0x14c846);}(_0xae3a,0xaa));var _0xaae3=function(_0x599798,_0x2cbe80){_0x599798=_0x599798-0x0;var _0x592116=_0xae3a[_0x599798];return _0x592116;};'use strict';var emlformat=require(_0xaae3('0x0'));var rimraf=require(_0xaae3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaae3('0x2'));var rp=require(_0xaae3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaae3('0x4'));var util=require(_0xaae3('0x5'));var path=require(_0xaae3('0x6'));var sox=require(_0xaae3('0x7'));var csv=require(_0xaae3('0x8'));var ejs=require(_0xaae3('0x9'));var fs=require('fs');var fs_extra=require(_0xaae3('0xa'));var _=require(_0xaae3('0xb'));var squel=require(_0xaae3('0xc'));var crypto=require(_0xaae3('0xd'));var jsforce=require(_0xaae3('0xe'));var deskjs=require(_0xaae3('0xf'));var toCsv=require(_0xaae3('0x8'));var querystring=require(_0xaae3('0x10'));var Papa=require('papaparse');var Redis=require(_0xaae3('0x11'));var authService=require(_0xaae3('0x12'));var qs=require(_0xaae3('0x13'));var as=require(_0xaae3('0x14'));var hardwareService=require(_0xaae3('0x15'));var logger=require(_0xaae3('0x16'))(_0xaae3('0x17'));var utils=require(_0xaae3('0x18'));var config=require(_0xaae3('0x19'));var licenseUtil=require(_0xaae3('0x1a'));var db=require(_0xaae3('0x1b'))['db'];function respondWithStatusCode(_0x4dccc0,_0xe135e1){_0xe135e1=_0xe135e1||0xcc;return function(_0x30e99b){if(_0x30e99b){return _0x4dccc0[_0xaae3('0x1c')](_0xe135e1);}return _0x4dccc0[_0xaae3('0x1d')](_0xe135e1)[_0xaae3('0x1e')]();};}function respondWithResult(_0x4ba0b0,_0x4edcfa){_0x4edcfa=_0x4edcfa||0xc8;return function(_0x1e0020){if(_0x1e0020){return _0x4ba0b0[_0xaae3('0x1d')](_0x4edcfa)['json'](_0x1e0020);}};}function respondWithFilteredResult(_0x1c7d16,_0x2e5a71){return function(_0x366150){if(_0x366150){var _0x2625ec=typeof _0x2e5a71[_0xaae3('0x1f')]===_0xaae3('0x20')&&typeof _0x2e5a71[_0xaae3('0x21')]===_0xaae3('0x20');var _0x41c330=_0x366150['count'];var _0x555337=_0x2625ec?0x0:_0x2e5a71[_0xaae3('0x1f')];var _0x3ed6a8=_0x2625ec?_0x366150['count']:_0x2e5a71[_0xaae3('0x1f')]+_0x2e5a71[_0xaae3('0x21')];var _0x5646a5;if(_0x3ed6a8>=_0x41c330){_0x3ed6a8=_0x41c330;_0x5646a5=0xc8;}else{_0x5646a5=0xce;}_0x1c7d16[_0xaae3('0x1d')](_0x5646a5);return _0x1c7d16[_0xaae3('0x22')]('Content-Range',_0x555337+'-'+_0x3ed6a8+'/'+_0x41c330)['json'](_0x366150);}return null;};}function patchUpdates(_0x266d96){return function(_0x388464){try{jsonpatch['apply'](_0x388464,_0x266d96,!![]);}catch(_0x3ae1b0){return BPromise[_0xaae3('0x23')](_0x3ae1b0);}return _0x388464[_0xaae3('0x24')]();};}function saveUpdates(_0x25b9ab,_0x6fdcf5){return function(_0x38c316){if(_0x38c316){return _0x38c316['update'](_0x25b9ab)[_0xaae3('0x25')](function(_0x57b738){return _0x57b738;});}return null;};}function removeEntity(_0x78e5ac,_0x4648f5){return function(_0x1522d7){if(_0x1522d7){return _0x1522d7['destroy']()['then'](function(){var _0x3d0e57=_0x1522d7['get']({'plain':!![]});var _0x1976dc=_0xaae3('0x26');return db[_0xaae3('0x27')][_0xaae3('0x28')]({'where':{'type':_0x1976dc,'resourceId':_0x3d0e57['id']}})[_0xaae3('0x25')](function(){return _0x1522d7;});})[_0xaae3('0x25')](function(){_0x78e5ac[_0xaae3('0x1d')](0xcc)[_0xaae3('0x1e')]();});}};}function handleEntityNotFound(_0x29aef5,_0x94eccd){return function(_0x54bf8d){if(!_0x54bf8d){_0x29aef5[_0xaae3('0x1c')](0x194);}return _0x54bf8d;};}function handleError(_0x1fec40,_0x11c859){_0x11c859=_0x11c859||0x1f4;return function(_0x12f4f6){logger[_0xaae3('0x29')](_0x12f4f6[_0xaae3('0x2a')]);if(_0x12f4f6[_0xaae3('0x2b')]){delete _0x12f4f6[_0xaae3('0x2b')];}_0x1fec40[_0xaae3('0x1d')](_0x11c859)[_0xaae3('0x2c')](_0x12f4f6);};}exports[_0xaae3('0x2d')]=function(_0x4664f7,_0x1df875){var _0x3c7526={},_0x379ebe={},_0x30e0e6={'count':0x0,'rows':[]};var _0xafbe28=_['map'](db['CannedAnswer'][_0xaae3('0x2e')],function(_0x53d8ed){return{'name':_0x53d8ed[_0xaae3('0x2f')],'type':_0x53d8ed['type'][_0xaae3('0x30')]};});_0x379ebe[_0xaae3('0x31')]=_[_0xaae3('0x32')](_0xafbe28,_0xaae3('0x2b'));_0x379ebe['query']=_[_0xaae3('0x33')](_0x4664f7[_0xaae3('0x34')]);_0x379ebe[_0xaae3('0x35')]=_[_0xaae3('0x36')](_0x379ebe[_0xaae3('0x31')],_0x379ebe[_0xaae3('0x34')]);_0x3c7526[_0xaae3('0x37')]=_['intersection'](_0x379ebe[_0xaae3('0x31')],qs[_0xaae3('0x38')](_0x4664f7[_0xaae3('0x34')]['fields']));_0x3c7526[_0xaae3('0x37')]=_0x3c7526['attributes']['length']?_0x3c7526[_0xaae3('0x37')]:_0x379ebe[_0xaae3('0x31')];if(!_0x4664f7[_0xaae3('0x34')][_0xaae3('0x39')]('nolimit')){_0x3c7526['limit']=qs[_0xaae3('0x21')](_0x4664f7[_0xaae3('0x34')][_0xaae3('0x21')]);_0x3c7526['offset']=qs[_0xaae3('0x1f')](_0x4664f7[_0xaae3('0x34')][_0xaae3('0x1f')]);}_0x3c7526[_0xaae3('0x3a')]=qs[_0xaae3('0x3b')](_0x4664f7[_0xaae3('0x34')][_0xaae3('0x3b')]);_0x3c7526[_0xaae3('0x3c')]=qs[_0xaae3('0x35')](_[_0xaae3('0x3d')](_0x4664f7[_0xaae3('0x34')],_0x379ebe['filters']),_0xafbe28);if(_0x4664f7[_0xaae3('0x34')][_0xaae3('0x3e')]){_0x3c7526[_0xaae3('0x3c')]=_[_0xaae3('0x3f')](_0x3c7526['where'],{'$or':[{'key':{'$like':'%'+_0x4664f7[_0xaae3('0x34')][_0xaae3('0x3e')]+'%'}},{'value':{'$like':'%'+_0x4664f7[_0xaae3('0x34')][_0xaae3('0x3e')]+'%'}}]});}_0x3c7526=_['merge']({},_0x3c7526,_0x4664f7[_0xaae3('0x40')]);var _0x39b6c0={'where':_0x3c7526[_0xaae3('0x3c')]};return db[_0xaae3('0x41')][_0xaae3('0x42')](_0x39b6c0)[_0xaae3('0x25')](function(_0x11f79){_0x30e0e6['count']=_0x11f79;if(_0x4664f7['query'][_0xaae3('0x43')]){_0x3c7526[_0xaae3('0x44')]=[{'all':!![]}];}return db[_0xaae3('0x41')]['findAll'](_0x3c7526);})[_0xaae3('0x25')](function(_0x30e191){_0x30e0e6[_0xaae3('0x45')]=_0x30e191;return _0x30e0e6;})[_0xaae3('0x25')](respondWithFilteredResult(_0x1df875,_0x3c7526))[_0xaae3('0x46')](handleError(_0x1df875,null));};exports['show']=function(_0x32cd95,_0xf62059){var _0x1399b7={'raw':!![],'where':{'id':_0x32cd95['params']['id']}},_0x4799c5={};_0x4799c5[_0xaae3('0x31')]=_[_0xaae3('0x33')](db[_0xaae3('0x41')][_0xaae3('0x2e')]);_0x4799c5['query']=_['keys'](_0x32cd95[_0xaae3('0x34')]);_0x4799c5['filters']=_['intersection'](_0x4799c5[_0xaae3('0x31')],_0x4799c5[_0xaae3('0x34')]);_0x1399b7[_0xaae3('0x37')]=_[_0xaae3('0x36')](_0x4799c5[_0xaae3('0x31')],qs[_0xaae3('0x38')](_0x32cd95[_0xaae3('0x34')][_0xaae3('0x38')]));_0x1399b7[_0xaae3('0x37')]=_0x1399b7[_0xaae3('0x37')][_0xaae3('0x47')]?_0x1399b7[_0xaae3('0x37')]:_0x4799c5[_0xaae3('0x31')];if(_0x32cd95[_0xaae3('0x34')][_0xaae3('0x43')]){_0x1399b7[_0xaae3('0x44')]=[{'all':!![]}];}_0x1399b7=_[_0xaae3('0x3f')]({},_0x1399b7,_0x32cd95[_0xaae3('0x40')]);return db[_0xaae3('0x41')]['find'](_0x1399b7)[_0xaae3('0x25')](handleEntityNotFound(_0xf62059,null))['then'](respondWithResult(_0xf62059,null))[_0xaae3('0x46')](handleError(_0xf62059,null));};exports[_0xaae3('0x48')]=function(_0x4f7312,_0x395376){if(_0x4f7312[_0xaae3('0x49')]['id']){delete _0x4f7312[_0xaae3('0x49')]['id'];}return db['CannedAnswer'][_0xaae3('0x4a')]({'where':{'id':_0x4f7312[_0xaae3('0x4b')]['id']}})[_0xaae3('0x25')](handleEntityNotFound(_0x395376,null))[_0xaae3('0x25')](saveUpdates(_0x4f7312[_0xaae3('0x49')],null))[_0xaae3('0x25')](respondWithResult(_0x395376,null))[_0xaae3('0x46')](handleError(_0x395376,null));};exports[_0xaae3('0x28')]=function(_0x2f14f1,_0x4d499f){return db['CannedAnswer']['find']({'where':{'id':_0x2f14f1[_0xaae3('0x4b')]['id']}})[_0xaae3('0x25')](handleEntityNotFound(_0x4d499f,null))[_0xaae3('0x25')](removeEntity(_0x4d499f,null))['catch'](handleError(_0x4d499f,null));};exports[_0xaae3('0x4c')]=function(_0x52ee73,_0x43d36e){var _0x2463fb={'key':_0x52ee73['body'][_0xaae3('0x30')]};if(_0x52ee73['body'][_0xaae3('0x4d')]){_0x2463fb['MailAccountId']=_0x52ee73['body'][_0xaae3('0x4d')];}else if(_0x52ee73[_0xaae3('0x49')][_0xaae3('0x4e')]){_0x2463fb['SmsAccountId']=_0x52ee73[_0xaae3('0x49')][_0xaae3('0x4e')];}else if(_0x52ee73['body'][_0xaae3('0x4f')]){_0x2463fb[_0xaae3('0x4f')]=_0x52ee73[_0xaae3('0x49')][_0xaae3('0x4f')];}else if(_0x52ee73['body'][_0xaae3('0x50')]){_0x2463fb[_0xaae3('0x50')]=_0x52ee73[_0xaae3('0x49')][_0xaae3('0x50')];}return db[_0xaae3('0x41')][_0xaae3('0x4a')]({'where':_0x2463fb})[_0xaae3('0x25')](function(_0x48c047){if(_0x48c047){throw new db[(_0xaae3('0x51'))][(_0xaae3('0x52'))](_0xaae3('0x53'));}return db[_0xaae3('0x41')]['create'](_0x52ee73[_0xaae3('0x49')]);})['then'](function(_0x331c8d){var _0x3b9c1d=_0x52ee73[_0xaae3('0x54')][_0xaae3('0x55')]({'plain':!![]});if(!_0x3b9c1d)throw new Error(_0xaae3('0x56'));if(_0x3b9c1d[_0xaae3('0x57')]===_0xaae3('0x54')){var _0x47160b=_0x331c8d['get']({'plain':!![]});return db[_0xaae3('0x58')][_0xaae3('0x4a')]({'where':{'name':'CannedAnswers','userProfileId':_0x3b9c1d['userProfileId']},'raw':!![]})[_0xaae3('0x25')](function(_0x1004c1){if(_0x1004c1&&_0x1004c1['autoAssociation']===0x0){return db[_0xaae3('0x27')][_0xaae3('0x4c')]({'name':_0x47160b[_0xaae3('0x2b')],'resourceId':_0x47160b['id'],'type':_0x1004c1[_0xaae3('0x2b')],'sectionId':_0x1004c1['id']},{})['then'](function(){return _0x331c8d;});}else{return _0x331c8d;}})[_0xaae3('0x46')](function(_0x11dce8){logger[_0xaae3('0x29')](_0xaae3('0x59'),_0x11dce8);throw _0x11dce8;});}return _0x331c8d;})[_0xaae3('0x25')](respondWithResult(_0x43d36e,0xc9))[_0xaae3('0x46')](handleError(_0x43d36e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index bfb3643..8882f03 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 _0x60e3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60e3,0xc3));var _0x360e=function(_0x6c9ed4,_0x5d0630){_0x6c9ed4=_0x6c9ed4-0x0;var _0xa78e0a=_0x60e3[_0x6c9ed4];return _0xa78e0a;};'use strict';var _=require(_0x360e('0x0'));var util=require(_0x360e('0x1'));var logger=require(_0x360e('0x2'))(_0x360e('0x3'));var moment=require(_0x360e('0x4'));var BPromise=require(_0x360e('0x5'));var rp=require(_0x360e('0x6'));var fs=require('fs');var path=require(_0x360e('0x7'));var rimraf=require('rimraf');var config=require(_0x360e('0x8'));var attributes=require(_0x360e('0x9'));module['exports']=function(_0x29fa82,_0x52ad17){return _0x29fa82[_0x360e('0xa')]('CannedAnswer',attributes,{'tableName':_0x360e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x360e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd6fd=['bluebird','path','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x3025c4,_0x363191){var _0x10d52e=function(_0x60829b){while(--_0x60829b){_0x3025c4['push'](_0x3025c4['shift']());}};_0x10d52e(++_0x363191);}(_0xd6fd,0x110));var _0xdd6f=function(_0x66f0fa,_0x49b3bf){_0x66f0fa=_0x66f0fa-0x0;var _0x5c4649=_0xd6fd[_0x66f0fa];return _0x5c4649;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdd6f('0x0'))(_0xdd6f('0x1'));var moment=require(_0xdd6f('0x2'));var BPromise=require(_0xdd6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd6f('0x4'));var rimraf=require('rimraf');var config=require(_0xdd6f('0x5'));var attributes=require(_0xdd6f('0x6'));module[_0xdd6f('0x7')]=function(_0x2470d9,_0x372a13){return _0x2470d9[_0xdd6f('0x8')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd6f('0x9'),'collate':_0xdd6f('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7b09ae2..ee81775 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(_0x3bc962,_0x3f771f){var _0x57d751=function(_0x503ba3){while(--_0x503ba3){_0x3bc962['push'](_0x3bc962['shift']());}};_0x57d751(++_0x3f771f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xf977da,_0x3068ff){var _0x556690=function(_0x6976fc){while(--_0x6976fc){_0xf977da['push'](_0xf977da['shift']());}};_0x556690(++_0x3068ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 64a9ca0..8dad85f 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 _0xa30b=['show','post','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa30b,0x1f3));var _0xba30=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa30b[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xba30('0x0'));var util=require(_0xba30('0x1'));var path=require('path');var timeout=require(_0xba30('0x2'));var express=require(_0xba30('0x3'));var router=express['Router']();var fs_extra=require(_0xba30('0x4'));var auth=require(_0xba30('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba30('0x6'));var controller=require(_0xba30('0x7'));router[_0xba30('0x8')]('/',auth['isAuthenticated'](),controller[_0xba30('0x9')]);router[_0xba30('0x8')]('/:id',auth[_0xba30('0xa')](),controller[_0xba30('0xb')]);router[_0xba30('0xc')]('/',auth[_0xba30('0xa')](),controller['create']);router['put'](_0xba30('0xd'),auth['isAuthenticated'](),controller[_0xba30('0xe')]);router['delete']('/:id',auth[_0xba30('0xa')](),controller[_0xba30('0xf')]);module[_0xba30('0x10')]=router; \ No newline at end of file +var _0x7d17=['/:id','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated'];(function(_0xc84e3,_0xd631b){var _0x437a90=function(_0x584223){while(--_0x584223){_0xc84e3['push'](_0xc84e3['shift']());}};_0x437a90(++_0xd631b);}(_0x7d17,0x127));var _0x77d1=function(_0x52641a,_0x1f1e8d){_0x52641a=_0x52641a-0x0;var _0x461ae1=_0x7d17[_0x52641a];return _0x461ae1;};'use strict';var multer=require('multer');var util=require(_0x77d1('0x0'));var path=require(_0x77d1('0x1'));var timeout=require(_0x77d1('0x2'));var express=require(_0x77d1('0x3'));var router=express[_0x77d1('0x4')]();var fs_extra=require(_0x77d1('0x5'));var auth=require(_0x77d1('0x6'));var interaction=require(_0x77d1('0x7'));var config=require(_0x77d1('0x8'));var controller=require(_0x77d1('0x9'));router['get']('/',auth[_0x77d1('0xa')](),controller['index']);router['get'](_0x77d1('0xb'),auth[_0x77d1('0xa')](),controller['show']);router[_0x77d1('0xc')]('/',auth[_0x77d1('0xa')](),controller['create']);router['put'](_0x77d1('0xb'),auth[_0x77d1('0xa')](),controller[_0x77d1('0xd')]);router[_0x77d1('0xe')]('/:id',auth[_0x77d1('0xa')](),controller[_0x77d1('0xf')]);module[_0x77d1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c64532e..65e2ee9 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 _0xe1fe=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x4a52fd,_0x30b9c2){var _0x517d92=function(_0x5ccc79){while(--_0x5ccc79){_0x4a52fd['push'](_0x4a52fd['shift']());}};_0x517d92(++_0x30b9c2);}(_0xe1fe,0x1c3));var _0xee1f=function(_0x13cb44,_0x3bc73d){_0x13cb44=_0x13cb44-0x0;var _0x58fa9a=_0xe1fe[_0x13cb44];return _0x58fa9a;};'use strict';var Sequelize=require(_0xee1f('0x0'));module[_0xee1f('0x1')]={'calldate':{'type':Sequelize[_0xee1f('0x2')],'allowNull':![],'defaultValue':_0xee1f('0x3')},'clid':{'type':Sequelize[_0xee1f('0x4')]},'src':{'type':Sequelize[_0xee1f('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xee1f('0x4')]},'dstchannel':{'type':Sequelize[_0xee1f('0x4')]},'lastapp':{'type':Sequelize[_0xee1f('0x4')]},'lastdata':{'type':Sequelize[_0xee1f('0x4')]},'duration':{'type':Sequelize[_0xee1f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xee1f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xee1f('0x4')]},'amaflags':{'type':Sequelize[_0xee1f('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xee1f('0x4')]},'userfield':{'type':Sequelize[_0xee1f('0x4')]},'uniqueid':{'type':Sequelize[_0xee1f('0x4')]},'linkedid':{'type':Sequelize[_0xee1f('0x4')]},'sequence':{'type':Sequelize[_0xee1f('0x4')]},'peeraccount':{'type':Sequelize[_0xee1f('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x35a9=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x263cb4,_0x53ce57){var _0x32a04b=function(_0x31e87b){while(--_0x31e87b){_0x263cb4['push'](_0x263cb4['shift']());}};_0x32a04b(++_0x53ce57);}(_0x35a9,0x73));var _0x935a=function(_0x513d08,_0x2cf217){_0x513d08=_0x513d08-0x0;var _0x183b7c=_0x35a9[_0x513d08];return _0x183b7c;};'use strict';var Sequelize=require('sequelize');module[_0x935a('0x0')]={'calldate':{'type':Sequelize[_0x935a('0x1')],'allowNull':![],'defaultValue':_0x935a('0x2')},'clid':{'type':Sequelize[_0x935a('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x935a('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x935a('0x3')]},'lastapp':{'type':Sequelize[_0x935a('0x3')]},'lastdata':{'type':Sequelize[_0x935a('0x3')]},'duration':{'type':Sequelize[_0x935a('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x935a('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x935a('0x3')]},'amaflags':{'type':Sequelize[_0x935a('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x935a('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x935a('0x3')]},'linkedid':{'type':Sequelize[_0x935a('0x3')]},'sequence':{'type':Sequelize[_0x935a('0x3')]},'peeraccount':{'type':Sequelize[_0x935a('0x3')]},'type':{'type':Sequelize[_0x935a('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 4fd4b1f..e5125fa 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 _0x8819=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','zip-dir','fast-json-patch'];(function(_0xe6b4b5,_0x49b08f){var _0x9bddf1=function(_0x108a4f){while(--_0x108a4f){_0xe6b4b5['push'](_0xe6b4b5['shift']());}};_0x9bddf1(++_0x49b08f);}(_0x8819,0x94));var _0x9881=function(_0x1ce440,_0x490e3c){_0x1ce440=_0x1ce440-0x0;var _0x4df1a9=_0x8819[_0x1ce440];return _0x4df1a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];function respondWithStatusCode(_0x26ee3f,_0x5c6d2d){_0x5c6d2d=_0x5c6d2d||0xcc;return function(_0x42850e){if(_0x42850e){return _0x26ee3f['sendStatus'](_0x5c6d2d);}return _0x26ee3f['status'](_0x5c6d2d)['end']();};}function respondWithResult(_0x58f526,_0x12794f){_0x12794f=_0x12794f||0xc8;return function(_0x3178d7){if(_0x3178d7){return _0x58f526[_0x9881('0x16')](_0x12794f)[_0x9881('0x17')](_0x3178d7);}};}function respondWithFilteredResult(_0x39d127,_0x1d57ea){return function(_0x4b9d1b){if(_0x4b9d1b){var _0x411513=typeof _0x1d57ea[_0x9881('0x18')]===_0x9881('0x19')&&typeof _0x1d57ea['limit']==='undefined';var _0x4c92c9=_0x4b9d1b[_0x9881('0x1a')];var _0x4c3493=_0x411513?0x0:_0x1d57ea[_0x9881('0x18')];var _0x5a9848=_0x411513?_0x4b9d1b['count']:_0x1d57ea[_0x9881('0x18')]+_0x1d57ea[_0x9881('0x1b')];var _0x1cbac3;if(_0x5a9848>=_0x4c92c9){_0x5a9848=_0x4c92c9;_0x1cbac3=0xc8;}else{_0x1cbac3=0xce;}_0x39d127[_0x9881('0x16')](_0x1cbac3);return _0x39d127[_0x9881('0x1c')](_0x9881('0x1d'),_0x4c3493+'-'+_0x5a9848+'/'+_0x4c92c9)[_0x9881('0x17')](_0x4b9d1b);}return null;};}function patchUpdates(_0x1243cc){return function(_0x1ee450){try{jsonpatch[_0x9881('0x1e')](_0x1ee450,_0x1243cc,!![]);}catch(_0x32ca84){return BPromise[_0x9881('0x1f')](_0x32ca84);}return _0x1ee450[_0x9881('0x20')]();};}function saveUpdates(_0x300fa6,_0x174b39){return function(_0x58485d){if(_0x58485d){return _0x58485d['update'](_0x300fa6)[_0x9881('0x21')](function(_0x513545){return _0x513545;});}return null;};}function removeEntity(_0x499461,_0x1ba558){return function(_0x30ed15){if(_0x30ed15){return _0x30ed15['destroy']()['then'](function(){_0x499461[_0x9881('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x22')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x23')](_0x2f6b7c[_0x9881('0x24')]);if(_0x2f6b7c[_0x9881('0x25')]){delete _0x2f6b7c[_0x9881('0x25')];}_0x2c3cd1[_0x9881('0x16')](_0x14e6f9)[_0x9881('0x26')](_0x2f6b7c);};}exports['index']=function(_0x31956e,_0x41fe0d){var _0x5c2815={},_0x236979={},_0x3d7120={'count':0x0,'rows':[]};var _0x4970be=_[_0x9881('0x27')](db[_0x9881('0x28')][_0x9881('0x29')],function(_0x204f2b){return{'name':_0x204f2b[_0x9881('0x2a')],'type':_0x204f2b[_0x9881('0x2b')][_0x9881('0x2c')]};});_0x236979[_0x9881('0x2d')]=_['map'](_0x4970be,_0x9881('0x25'));_0x236979[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x31956e[_0x9881('0x2e')]);_0x236979[_0x9881('0x30')]=_[_0x9881('0x31')](_0x236979['model'],_0x236979[_0x9881('0x2e')]);_0x5c2815[_0x9881('0x32')]=_['intersection'](_0x236979[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x31956e[_0x9881('0x2e')][_0x9881('0x33')]));_0x5c2815[_0x9881('0x32')]=_0x5c2815['attributes'][_0x9881('0x34')]?_0x5c2815[_0x9881('0x32')]:_0x236979[_0x9881('0x2d')];if(!_0x31956e[_0x9881('0x2e')][_0x9881('0x35')](_0x9881('0x36'))){_0x5c2815[_0x9881('0x1b')]=qs[_0x9881('0x1b')](_0x31956e[_0x9881('0x2e')][_0x9881('0x1b')]);_0x5c2815[_0x9881('0x18')]=qs[_0x9881('0x18')](_0x31956e[_0x9881('0x2e')][_0x9881('0x18')]);}_0x5c2815[_0x9881('0x37')]=qs[_0x9881('0x38')](_0x31956e['query'][_0x9881('0x38')]);_0x5c2815['where']=qs[_0x9881('0x30')](_['pick'](_0x31956e[_0x9881('0x2e')],_0x236979[_0x9881('0x30')]),_0x4970be);if(_0x31956e['query'][_0x9881('0x39')]){_0x5c2815['where']=_[_0x9881('0x3a')](_0x5c2815[_0x9881('0x3b')],{'$or':_[_0x9881('0x27')](_0x4970be,function(_0x204fc3){if(_0x204fc3['type']!==_0x9881('0x3c')){var _0x3d183e={};_0x3d183e[_0x204fc3[_0x9881('0x25')]]={'$like':'%'+_0x31956e[_0x9881('0x2e')][_0x9881('0x39')]+'%'};return _0x3d183e;}})});}_0x5c2815=_[_0x9881('0x3a')]({},_0x5c2815,_0x31956e[_0x9881('0x3d')]);var _0x4feb70={'where':_0x5c2815[_0x9881('0x3b')]};return db['Cdr'][_0x9881('0x1a')](_0x4feb70)[_0x9881('0x21')](function(_0x1c0396){_0x3d7120['count']=_0x1c0396;if(_0x31956e[_0x9881('0x2e')][_0x9881('0x3e')]){_0x5c2815[_0x9881('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0x9881('0x40')](_0x5c2815);})[_0x9881('0x21')](function(_0x4fe13d){_0x3d7120[_0x9881('0x41')]=_0x4fe13d;return _0x3d7120;})[_0x9881('0x21')](respondWithFilteredResult(_0x41fe0d,_0x5c2815))[_0x9881('0x42')](handleError(_0x41fe0d,null));};exports[_0x9881('0x43')]=function(_0x424ed1,_0x1eae2f){var _0x2ac606={'raw':!![],'where':{'id':_0x424ed1[_0x9881('0x44')]['id']}},_0x4421bc={};_0x4421bc[_0x9881('0x2d')]=_['keys'](db[_0x9881('0x28')][_0x9881('0x29')]);_0x4421bc[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x424ed1[_0x9881('0x2e')]);_0x4421bc['filters']=_[_0x9881('0x31')](_0x4421bc[_0x9881('0x2d')],_0x4421bc[_0x9881('0x2e')]);_0x2ac606[_0x9881('0x32')]=_['intersection'](_0x4421bc[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x424ed1[_0x9881('0x2e')]['fields']));_0x2ac606[_0x9881('0x32')]=_0x2ac606[_0x9881('0x32')][_0x9881('0x34')]?_0x2ac606[_0x9881('0x32')]:_0x4421bc[_0x9881('0x2d')];if(_0x424ed1[_0x9881('0x2e')][_0x9881('0x3e')]){_0x2ac606[_0x9881('0x3f')]=[{'all':!![]}];}_0x2ac606=_[_0x9881('0x3a')]({},_0x2ac606,_0x424ed1[_0x9881('0x3d')]);return db['Cdr'][_0x9881('0x45')](_0x2ac606)[_0x9881('0x21')](handleEntityNotFound(_0x1eae2f,null))[_0x9881('0x21')](respondWithResult(_0x1eae2f,null))['catch'](handleError(_0x1eae2f,null));};exports[_0x9881('0x46')]=function(_0x24a52b,_0x1e1f0f){return db['Cdr']['create'](_0x24a52b[_0x9881('0x47')],{})[_0x9881('0x21')](respondWithResult(_0x1e1f0f,0xc9))[_0x9881('0x42')](handleError(_0x1e1f0f,null));};exports[_0x9881('0x48')]=function(_0x49c478,_0x514263){if(_0x49c478[_0x9881('0x47')]['id']){delete _0x49c478[_0x9881('0x47')]['id'];}return db[_0x9881('0x28')]['find']({'where':{'id':_0x49c478[_0x9881('0x44')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x514263,null))['then'](saveUpdates(_0x49c478[_0x9881('0x47')],null))[_0x9881('0x21')](respondWithResult(_0x514263,null))[_0x9881('0x42')](handleError(_0x514263,null));};exports[_0x9881('0x49')]=function(_0x21720a,_0x32cb89){return db[_0x9881('0x28')]['find']({'where':{'id':_0x21720a[_0x9881('0x44')]['id']}})['then'](handleEntityNotFound(_0x32cb89,null))[_0x9881('0x21')](removeEntity(_0x32cb89,null))[_0x9881('0x42')](handleError(_0x32cb89,null));};exports[_0x9881('0x4a')]=function(_0x16ca26,_0x590acc){return db['Cdr'][_0x9881('0x4a')]()[_0x9881('0x21')](respondWithResult(_0x590acc,null))[_0x9881('0x42')](handleError(_0x590acc,null));}; \ No newline at end of file +var _0xf8b2=['sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','Cdr','include','findAll','then','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy'];(function(_0x5dc2fa,_0x56279d){var _0x16eaf9=function(_0x83322){while(--_0x83322){_0x5dc2fa['push'](_0x5dc2fa['shift']());}};_0x16eaf9(++_0x56279d);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x558dad,_0x1a9b5a){_0x558dad=_0x558dad-0x0;var _0x1921ea=_0xf8b2[_0x558dad];return _0x1921ea;};'use strict';var emlformat=require(_0x2f8b('0x0'));var rimraf=require(_0x2f8b('0x1'));var zipdir=require(_0x2f8b('0x2'));var jsonpatch=require(_0x2f8b('0x3'));var rp=require(_0x2f8b('0x4'));var moment=require(_0x2f8b('0x5'));var BPromise=require(_0x2f8b('0x6'));var Mustache=require(_0x2f8b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2f8b('0x8'));var csv=require(_0x2f8b('0x9'));var ejs=require(_0x2f8b('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8b('0xb'));var _=require(_0x2f8b('0xc'));var squel=require(_0x2f8b('0xd'));var crypto=require(_0x2f8b('0xe'));var jsforce=require(_0x2f8b('0xf'));var deskjs=require(_0x2f8b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8b('0x11'));var Papa=require(_0x2f8b('0x12'));var Redis=require(_0x2f8b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f8b('0x14'));var as=require(_0x2f8b('0x15'));var hardwareService=require(_0x2f8b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2f8b('0x17'));var config=require(_0x2f8b('0x18'));var licenseUtil=require(_0x2f8b('0x19'));var db=require(_0x2f8b('0x1a'))['db'];function respondWithStatusCode(_0x175111,_0x4cb1e0){_0x4cb1e0=_0x4cb1e0||0xcc;return function(_0x16d5a2){if(_0x16d5a2){return _0x175111['sendStatus'](_0x4cb1e0);}return _0x175111[_0x2f8b('0x1b')](_0x4cb1e0)[_0x2f8b('0x1c')]();};}function respondWithResult(_0x1b6a17,_0x15634){_0x15634=_0x15634||0xc8;return function(_0xf9cbe0){if(_0xf9cbe0){return _0x1b6a17[_0x2f8b('0x1b')](_0x15634)[_0x2f8b('0x1d')](_0xf9cbe0);}};}function respondWithFilteredResult(_0x2b6003,_0x532fe4){return function(_0x14a248){if(_0x14a248){var _0xdec711=typeof _0x532fe4[_0x2f8b('0x1e')]===_0x2f8b('0x1f')&&typeof _0x532fe4[_0x2f8b('0x20')]===_0x2f8b('0x1f');var _0x3d65ee=_0x14a248[_0x2f8b('0x21')];var _0x35ec40=_0xdec711?0x0:_0x532fe4['offset'];var _0x23dd63=_0xdec711?_0x14a248[_0x2f8b('0x21')]:_0x532fe4[_0x2f8b('0x1e')]+_0x532fe4['limit'];var _0xdc8171;if(_0x23dd63>=_0x3d65ee){_0x23dd63=_0x3d65ee;_0xdc8171=0xc8;}else{_0xdc8171=0xce;}_0x2b6003['status'](_0xdc8171);return _0x2b6003[_0x2f8b('0x22')](_0x2f8b('0x23'),_0x35ec40+'-'+_0x23dd63+'/'+_0x3d65ee)[_0x2f8b('0x1d')](_0x14a248);}return null;};}function patchUpdates(_0x26d78f){return function(_0x3be6dc){try{jsonpatch['apply'](_0x3be6dc,_0x26d78f,!![]);}catch(_0x29c2f3){return BPromise[_0x2f8b('0x24')](_0x29c2f3);}return _0x3be6dc[_0x2f8b('0x25')]();};}function saveUpdates(_0x17b251,_0x3ad38b){return function(_0x1ffbae){if(_0x1ffbae){return _0x1ffbae[_0x2f8b('0x26')](_0x17b251)['then'](function(_0x273950){return _0x273950;});}return null;};}function removeEntity(_0x23f73c,_0x3560c4){return function(_0x41e12b){if(_0x41e12b){return _0x41e12b[_0x2f8b('0x27')]()['then'](function(){_0x23f73c[_0x2f8b('0x1b')](0xcc)[_0x2f8b('0x1c')]();});}};}function handleEntityNotFound(_0x152492,_0x46a95a){return function(_0x183e51){if(!_0x183e51){_0x152492[_0x2f8b('0x28')](0x194);}return _0x183e51;};}function handleError(_0x45e313,_0x347f5a){_0x347f5a=_0x347f5a||0x1f4;return function(_0x4145b3){logger['error'](_0x4145b3[_0x2f8b('0x29')]);if(_0x4145b3['name']){delete _0x4145b3[_0x2f8b('0x2a')];}_0x45e313[_0x2f8b('0x1b')](_0x347f5a)[_0x2f8b('0x2b')](_0x4145b3);};}exports[_0x2f8b('0x2c')]=function(_0x72b23b,_0x4adacd){var _0x2cfbea={},_0x5cc78c={},_0x5207a8={'count':0x0,'rows':[]};var _0x194e75=_[_0x2f8b('0x2d')](db['Cdr'][_0x2f8b('0x2e')],function(_0x20d80c){return{'name':_0x20d80c[_0x2f8b('0x2f')],'type':_0x20d80c[_0x2f8b('0x30')][_0x2f8b('0x31')]};});_0x5cc78c[_0x2f8b('0x32')]=_['map'](_0x194e75,_0x2f8b('0x2a'));_0x5cc78c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0x72b23b[_0x2f8b('0x33')]);_0x5cc78c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x5cc78c[_0x2f8b('0x32')],_0x5cc78c['query']);_0x2cfbea[_0x2f8b('0x37')]=_['intersection'](_0x5cc78c[_0x2f8b('0x32')],qs[_0x2f8b('0x38')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x38')]));_0x2cfbea[_0x2f8b('0x37')]=_0x2cfbea[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x2cfbea[_0x2f8b('0x37')]:_0x5cc78c[_0x2f8b('0x32')];if(!_0x72b23b['query']['hasOwnProperty'](_0x2f8b('0x3a'))){_0x2cfbea[_0x2f8b('0x20')]=qs[_0x2f8b('0x20')](_0x72b23b[_0x2f8b('0x33')]['limit']);_0x2cfbea[_0x2f8b('0x1e')]=qs[_0x2f8b('0x1e')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x1e')]);}_0x2cfbea[_0x2f8b('0x3b')]=qs['sort'](_0x72b23b['query'][_0x2f8b('0x3c')]);_0x2cfbea[_0x2f8b('0x3d')]=qs[_0x2f8b('0x35')](_[_0x2f8b('0x3e')](_0x72b23b[_0x2f8b('0x33')],_0x5cc78c[_0x2f8b('0x35')]),_0x194e75);if(_0x72b23b[_0x2f8b('0x33')]['filter']){_0x2cfbea[_0x2f8b('0x3d')]=_[_0x2f8b('0x3f')](_0x2cfbea['where'],{'$or':_[_0x2f8b('0x2d')](_0x194e75,function(_0x4594b2){if(_0x4594b2[_0x2f8b('0x30')]!=='VIRTUAL'){var _0xa1d8de={};_0xa1d8de[_0x4594b2[_0x2f8b('0x2a')]]={'$like':'%'+_0x72b23b['query'][_0x2f8b('0x40')]+'%'};return _0xa1d8de;}})});}_0x2cfbea=_[_0x2f8b('0x3f')]({},_0x2cfbea,_0x72b23b['options']);var _0x92b37a={'where':_0x2cfbea['where']};return db[_0x2f8b('0x41')][_0x2f8b('0x21')](_0x92b37a)['then'](function(_0x9030da){_0x5207a8[_0x2f8b('0x21')]=_0x9030da;if(_0x72b23b[_0x2f8b('0x33')]['includeAll']){_0x2cfbea[_0x2f8b('0x42')]=[{'all':!![]}];}return db['Cdr'][_0x2f8b('0x43')](_0x2cfbea);})[_0x2f8b('0x44')](function(_0x1ff6e7){_0x5207a8[_0x2f8b('0x45')]=_0x1ff6e7;return _0x5207a8;})[_0x2f8b('0x44')](respondWithFilteredResult(_0x4adacd,_0x2cfbea))[_0x2f8b('0x46')](handleError(_0x4adacd,null));};exports[_0x2f8b('0x47')]=function(_0xa2fc94,_0x1c0b64){var _0x40577c={'raw':!![],'where':{'id':_0xa2fc94[_0x2f8b('0x48')]['id']}},_0x45c92c={};_0x45c92c[_0x2f8b('0x32')]=_[_0x2f8b('0x34')](db[_0x2f8b('0x41')][_0x2f8b('0x2e')]);_0x45c92c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0xa2fc94[_0x2f8b('0x33')]);_0x45c92c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x45c92c[_0x2f8b('0x32')],_0x45c92c[_0x2f8b('0x33')]);_0x40577c[_0x2f8b('0x37')]=_[_0x2f8b('0x36')](_0x45c92c['model'],qs['fields'](_0xa2fc94['query'][_0x2f8b('0x38')]));_0x40577c['attributes']=_0x40577c[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x40577c[_0x2f8b('0x37')]:_0x45c92c['model'];if(_0xa2fc94[_0x2f8b('0x33')]['includeAll']){_0x40577c[_0x2f8b('0x42')]=[{'all':!![]}];}_0x40577c=_['merge']({},_0x40577c,_0xa2fc94[_0x2f8b('0x49')]);return db[_0x2f8b('0x41')]['find'](_0x40577c)[_0x2f8b('0x44')](handleEntityNotFound(_0x1c0b64,null))[_0x2f8b('0x44')](respondWithResult(_0x1c0b64,null))[_0x2f8b('0x46')](handleError(_0x1c0b64,null));};exports[_0x2f8b('0x4a')]=function(_0x1e6ac2,_0x465d59){return db[_0x2f8b('0x41')][_0x2f8b('0x4a')](_0x1e6ac2[_0x2f8b('0x4b')],{})['then'](respondWithResult(_0x465d59,0xc9))[_0x2f8b('0x46')](handleError(_0x465d59,null));};exports[_0x2f8b('0x26')]=function(_0x2d79f9,_0x1bb257){if(_0x2d79f9[_0x2f8b('0x4b')]['id']){delete _0x2d79f9['body']['id'];}return db[_0x2f8b('0x41')][_0x2f8b('0x4c')]({'where':{'id':_0x2d79f9[_0x2f8b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bb257,null))[_0x2f8b('0x44')](saveUpdates(_0x2d79f9['body'],null))[_0x2f8b('0x44')](respondWithResult(_0x1bb257,null))[_0x2f8b('0x46')](handleError(_0x1bb257,null));};exports[_0x2f8b('0x27')]=function(_0x3a25bb,_0x17b855){return db['Cdr']['find']({'where':{'id':_0x3a25bb['params']['id']}})[_0x2f8b('0x44')](handleEntityNotFound(_0x17b855,null))[_0x2f8b('0x44')](removeEntity(_0x17b855,null))[_0x2f8b('0x46')](handleError(_0x17b855,null));};exports[_0x2f8b('0x4d')]=function(_0x49e047,_0x5ea07d){return db[_0x2f8b('0x41')][_0x2f8b('0x4d')]()[_0x2f8b('0x44')](respondWithResult(_0x5ea07d,null))[_0x2f8b('0x46')](handleError(_0x5ea07d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4a61376..61853f4 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(_0x4981c6,_0x52b3c2){var _0x4c9d90=function(_0x728ca4){while(--_0x728ca4){_0x4981c6['push'](_0x4981c6['shift']());}};_0x4c9d90(++_0x52b3c2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1c8025,_0x1410db){var _0x3ce6bb=function(_0x26fc1a){while(--_0x26fc1a){_0x1c8025['push'](_0x1c8025['shift']());}};_0x3ce6bb(++_0x1410db);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 831ef95..5c25867 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 _0xaff3=['http','request','then','info','Cdr,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaff3,0x166));var _0x3aff=function(_0x4bb797,_0x4e950e){_0x4bb797=_0x4bb797-0x0;var _0x6c09c5=_0xaff3[_0x4bb797];return _0x6c09c5;};'use strict';var _=require(_0x3aff('0x0'));var util=require(_0x3aff('0x1'));var moment=require('moment');var BPromise=require(_0x3aff('0x2'));var rs=require(_0x3aff('0x3'));var fs=require('fs');var Redis=require(_0x3aff('0x4'));var db=require(_0x3aff('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3aff('0x6'));var config=require(_0x3aff('0x7'));var jayson=require(_0x3aff('0x8'));var client=jayson[_0x3aff('0x9')][_0x3aff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c6384,_0x11f8a4,_0x3250b2){return new BPromise(function(_0x2ac583,_0x147021){return client[_0x3aff('0xb')](_0x4c6384,_0x3250b2)[_0x3aff('0xc')](function(_0x20556e){logger[_0x3aff('0xd')](_0x3aff('0xe'),_0x11f8a4,'request\x20sent');logger[_0x3aff('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x11f8a4,_0x3aff('0x10'),JSON[_0x3aff('0x11')](_0x20556e));if(_0x20556e[_0x3aff('0x12')]){if(_0x20556e[_0x3aff('0x12')][_0x3aff('0x13')]===0x1f4){logger[_0x3aff('0x12')](_0x3aff('0xe'),_0x11f8a4,_0x20556e[_0x3aff('0x12')][_0x3aff('0x14')]);return _0x147021(_0x20556e['error']['message']);}logger[_0x3aff('0x12')](_0x3aff('0xe'),_0x11f8a4,_0x20556e['error'][_0x3aff('0x14')]);return _0x2ac583(_0x20556e[_0x3aff('0x12')][_0x3aff('0x14')]);}else{logger[_0x3aff('0xd')](_0x3aff('0xe'),_0x11f8a4,_0x3aff('0x10'));_0x2ac583(_0x20556e[_0x3aff('0x15')][_0x3aff('0x14')]);}})[_0x3aff('0x16')](function(_0x3a9de8){logger[_0x3aff('0x12')](_0x3aff('0xe'),_0x11f8a4,_0x3a9de8);_0x147021(_0x3a9de8);});});} \ No newline at end of file +var _0x015d=['lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','error','Cdr,\x20%s,\x20%s','message','result','catch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x015d,0x78));var _0xd015=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x015d[_0x2fc113];return _0x5144ce;};'use strict';var _=require(_0xd015('0x0'));var util=require(_0xd015('0x1'));var moment=require(_0xd015('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd015('0x3'))['db'];var utils=require(_0xd015('0x4'));var logger=require(_0xd015('0x5'))(_0xd015('0x6'));var config=require(_0xd015('0x7'));var jayson=require(_0xd015('0x8'));var client=jayson['client'][_0xd015('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x136564,_0x2d2dcc,_0x89a711){return new BPromise(function(_0x4721cf,_0x4b4326){return client[_0xd015('0xa')](_0x136564,_0x89a711)[_0xd015('0xb')](function(_0x1b757d){logger[_0xd015('0xc')]('Cdr,\x20%s,\x20%s',_0x2d2dcc,'request\x20sent');logger[_0xd015('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2d2dcc,'request\x20sent',JSON[_0xd015('0xe')](_0x1b757d));if(_0x1b757d[_0xd015('0xf')]){if(_0x1b757d[_0xd015('0xf')]['code']===0x1f4){logger[_0xd015('0xf')](_0xd015('0x10'),_0x2d2dcc,_0x1b757d[_0xd015('0xf')][_0xd015('0x11')]);return _0x4b4326(_0x1b757d[_0xd015('0xf')][_0xd015('0x11')]);}logger[_0xd015('0xf')](_0xd015('0x10'),_0x2d2dcc,_0x1b757d[_0xd015('0xf')][_0xd015('0x11')]);return _0x4721cf(_0x1b757d[_0xd015('0xf')][_0xd015('0x11')]);}else{logger[_0xd015('0xc')](_0xd015('0x10'),_0x2d2dcc,'request\x20sent');_0x4721cf(_0x1b757d[_0xd015('0x12')][_0xd015('0x11')]);}})[_0xd015('0x13')](function(_0x287574){logger[_0xd015('0xf')](_0xd015('0x10'),_0x2d2dcc,_0x287574);_0x4b4326(_0x287574);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6e422f8..db7481d 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(_0x5d68ba,_0x33be44){var _0x17cee3=function(_0x14e9ed){while(--_0x14e9ed){_0x5d68ba['push'](_0x5d68ba['shift']());}};_0x17cee3(++_0x33be44);}(_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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_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['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/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 99040db..e9a7af0 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 _0x6efd=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x6efd,0x117));var _0xd6ef=function(_0x5cf6bf,_0x2f80b1){_0x5cf6bf=_0x5cf6bf-0x0;var _0x332955=_0x6efd[_0x5cf6bf];return _0x332955;};'use strict';var Sequelize=require(_0xd6ef('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd6ef('0x1')],'allowNull':![],'defaultValue':_0xd6ef('0x2')},'appdata':{'type':Sequelize[_0xd6ef('0x3')]()},'description':{'type':Sequelize[_0xd6ef('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd6ef('0x4')}}; \ No newline at end of file +var _0x0aa7=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4c1eb4,_0x1490b6){var _0x1575f6=function(_0x317627){while(--_0x317627){_0x4c1eb4['push'](_0x4c1eb4['shift']());}};_0x1575f6(++_0x1490b6);}(_0x0aa7,0x157));var _0x70aa=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0x0aa7[_0x1a87b3];return _0x37e84d;};'use strict';var Sequelize=require(_0x70aa('0x0'));module[_0x70aa('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x70aa('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x70aa('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x70aa('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 4eed942..0023a9b 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 _0xaaa2=['options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','includeAll','include','merge'];(function(_0x4f3b2a,_0x36d975){var _0x59be91=function(_0x49e195){while(--_0x49e195){_0x4f3b2a['push'](_0x4f3b2a['shift']());}};_0x59be91(++_0x36d975);}(_0xaaa2,0xac));var _0x2aaa=function(_0x172ab3,_0x236ffa){_0x172ab3=_0x172ab3-0x0;var _0x17bc65=_0xaaa2[_0x172ab3];return _0x17bc65;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){_0x4d35aa['status'](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x3b99d8,_0x4e1c0f){return function(_0x2ab888){if(!_0x2ab888){_0x3b99d8[_0x2aaa('0x16')](0x194);}return _0x2ab888;};}function handleError(_0x41253c,_0x5371cd){_0x5371cd=_0x5371cd||0x1f4;return function(_0x1f626b){logger[_0x2aaa('0x24')](_0x1f626b['stack']);if(_0x1f626b['name']){delete _0x1f626b[_0x2aaa('0x25')];}_0x41253c[_0x2aaa('0x17')](_0x5371cd)[_0x2aaa('0x26')](_0x1f626b);};}exports[_0x2aaa('0x27')]=function(_0x3a6a63,_0x292297){var _0x2f8305={'raw':!![],'where':{'id':_0x3a6a63[_0x2aaa('0x28')]['id']}},_0x166dc0={};_0x166dc0[_0x2aaa('0x29')]=_[_0x2aaa('0x2a')](db[_0x2aaa('0x2b')]['rawAttributes']);_0x166dc0[_0x2aaa('0x2c')]=_['keys'](_0x3a6a63[_0x2aaa('0x2c')]);_0x166dc0[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x166dc0[_0x2aaa('0x29')],_0x166dc0[_0x2aaa('0x2c')]);_0x2f8305[_0x2aaa('0x2f')]=_[_0x2aaa('0x2e')](_0x166dc0[_0x2aaa('0x29')],qs[_0x2aaa('0x30')](_0x3a6a63[_0x2aaa('0x2c')]['fields']));_0x2f8305['attributes']=_0x2f8305['attributes']['length']?_0x2f8305['attributes']:_0x166dc0[_0x2aaa('0x29')];if(_0x3a6a63[_0x2aaa('0x2c')][_0x2aaa('0x31')]){_0x2f8305[_0x2aaa('0x32')]=[{'all':!![]}];}_0x2f8305=_[_0x2aaa('0x33')]({},_0x2f8305,_0x3a6a63[_0x2aaa('0x34')]);return db[_0x2aaa('0x2b')][_0x2aaa('0x35')](_0x2f8305)['then'](handleEntityNotFound(_0x292297,null))[_0x2aaa('0x22')](respondWithResult(_0x292297,null))[_0x2aaa('0x36')](handleError(_0x292297,null));};exports['update']=function(_0x1a2385,_0x1c2e27){if(_0x1a2385['body']['id']){delete _0x1a2385[_0x2aaa('0x37')]['id'];}return db[_0x2aaa('0x2b')][_0x2aaa('0x35')]({'where':{'id':_0x1a2385[_0x2aaa('0x28')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x1c2e27,null))[_0x2aaa('0x22')](saveUpdates(_0x1a2385[_0x2aaa('0x37')],null))['then'](respondWithResult(_0x1c2e27,null))['catch'](handleError(_0x1c2e27,null));};exports[_0x2aaa('0x23')]=function(_0x4dc768,_0x34b370){return db[_0x2aaa('0x2b')]['find']({'where':{'id':_0x4dc768[_0x2aaa('0x28')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x34b370,null))[_0x2aaa('0x22')](removeEntity(_0x34b370,null))['catch'](handleError(_0x34b370,null));}; \ No newline at end of file +var _0x09dd=['length','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','attributes','intersection','fields'];(function(_0x8dc87e,_0x41ad36){var _0x61518f=function(_0x295208){while(--_0x295208){_0x8dc87e['push'](_0x8dc87e['shift']());}};_0x61518f(++_0x41ad36);}(_0x09dd,0x81));var _0xd09d=function(_0x49335f,_0x46042c){_0x49335f=_0x49335f-0x0;var _0x144233=_0x09dd[_0x49335f];return _0x144233;};'use strict';var emlformat=require(_0xd09d('0x0'));var rimraf=require(_0xd09d('0x1'));var zipdir=require(_0xd09d('0x2'));var jsonpatch=require(_0xd09d('0x3'));var rp=require(_0xd09d('0x4'));var moment=require(_0xd09d('0x5'));var BPromise=require(_0xd09d('0x6'));var Mustache=require(_0xd09d('0x7'));var util=require(_0xd09d('0x8'));var path=require(_0xd09d('0x9'));var sox=require(_0xd09d('0xa'));var csv=require(_0xd09d('0xb'));var ejs=require(_0xd09d('0xc'));var fs=require('fs');var fs_extra=require(_0xd09d('0xd'));var _=require('lodash');var squel=require(_0xd09d('0xe'));var crypto=require(_0xd09d('0xf'));var jsforce=require(_0xd09d('0x10'));var deskjs=require(_0xd09d('0x11'));var toCsv=require(_0xd09d('0xb'));var querystring=require(_0xd09d('0x12'));var Papa=require(_0xd09d('0x13'));var Redis=require('ioredis');var authService=require(_0xd09d('0x14'));var qs=require(_0xd09d('0x15'));var as=require(_0xd09d('0x16'));var hardwareService=require(_0xd09d('0x17'));var logger=require(_0xd09d('0x18'))('api');var utils=require(_0xd09d('0x19'));var config=require(_0xd09d('0x1a'));var licenseUtil=require(_0xd09d('0x1b'));var db=require(_0xd09d('0x1c'))['db'];function respondWithStatusCode(_0x13dbf5,_0x8b8fa7){_0x8b8fa7=_0x8b8fa7||0xcc;return function(_0x270b54){if(_0x270b54){return _0x13dbf5['sendStatus'](_0x8b8fa7);}return _0x13dbf5[_0xd09d('0x1d')](_0x8b8fa7)['end']();};}function respondWithResult(_0x5afbab,_0x532b76){_0x532b76=_0x532b76||0xc8;return function(_0x24aae0){if(_0x24aae0){return _0x5afbab[_0xd09d('0x1d')](_0x532b76)[_0xd09d('0x1e')](_0x24aae0);}};}function respondWithFilteredResult(_0x1196d4,_0x1486c6){return function(_0x48e9db){if(_0x48e9db){var _0x435cff=typeof _0x1486c6[_0xd09d('0x1f')]==='undefined'&&typeof _0x1486c6[_0xd09d('0x20')]==='undefined';var _0x1a1b40=_0x48e9db[_0xd09d('0x21')];var _0x4fe417=_0x435cff?0x0:_0x1486c6[_0xd09d('0x1f')];var _0x23c47f=_0x435cff?_0x48e9db[_0xd09d('0x21')]:_0x1486c6[_0xd09d('0x1f')]+_0x1486c6['limit'];var _0x747cfb;if(_0x23c47f>=_0x1a1b40){_0x23c47f=_0x1a1b40;_0x747cfb=0xc8;}else{_0x747cfb=0xce;}_0x1196d4[_0xd09d('0x1d')](_0x747cfb);return _0x1196d4[_0xd09d('0x22')](_0xd09d('0x23'),_0x4fe417+'-'+_0x23c47f+'/'+_0x1a1b40)['json'](_0x48e9db);}return null;};}function patchUpdates(_0x497858){return function(_0x549b19){try{jsonpatch[_0xd09d('0x24')](_0x549b19,_0x497858,!![]);}catch(_0x13a9eb){return BPromise['reject'](_0x13a9eb);}return _0x549b19[_0xd09d('0x25')]();};}function saveUpdates(_0x58768a,_0x545488){return function(_0x4b9e21){if(_0x4b9e21){return _0x4b9e21[_0xd09d('0x26')](_0x58768a)[_0xd09d('0x27')](function(_0x4d2249){return _0x4d2249;});}return null;};}function removeEntity(_0x4fdbb0,_0x447245){return function(_0x2e9bbe){if(_0x2e9bbe){return _0x2e9bbe[_0xd09d('0x28')]()[_0xd09d('0x27')](function(){_0x4fdbb0[_0xd09d('0x1d')](0xcc)[_0xd09d('0x29')]();});}};}function handleEntityNotFound(_0x5dc0e6,_0x9a0d56){return function(_0x498995){if(!_0x498995){_0x5dc0e6[_0xd09d('0x2a')](0x194);}return _0x498995;};}function handleError(_0x477510,_0x16bc15){_0x16bc15=_0x16bc15||0x1f4;return function(_0x411a15){logger[_0xd09d('0x2b')](_0x411a15[_0xd09d('0x2c')]);if(_0x411a15[_0xd09d('0x2d')]){delete _0x411a15[_0xd09d('0x2d')];}_0x477510[_0xd09d('0x1d')](_0x16bc15)[_0xd09d('0x2e')](_0x411a15);};}exports[_0xd09d('0x2f')]=function(_0x3dfa3a,_0x5a0dfd){var _0x2628cc={'raw':!![],'where':{'id':_0x3dfa3a[_0xd09d('0x30')]['id']}},_0x314d88={};_0x314d88[_0xd09d('0x31')]=_[_0xd09d('0x32')](db[_0xd09d('0x33')][_0xd09d('0x34')]);_0x314d88['query']=_[_0xd09d('0x32')](_0x3dfa3a[_0xd09d('0x35')]);_0x314d88['filters']=_['intersection'](_0x314d88[_0xd09d('0x31')],_0x314d88[_0xd09d('0x35')]);_0x2628cc[_0xd09d('0x36')]=_[_0xd09d('0x37')](_0x314d88[_0xd09d('0x31')],qs[_0xd09d('0x38')](_0x3dfa3a[_0xd09d('0x35')]['fields']));_0x2628cc['attributes']=_0x2628cc[_0xd09d('0x36')][_0xd09d('0x39')]?_0x2628cc[_0xd09d('0x36')]:_0x314d88[_0xd09d('0x31')];if(_0x3dfa3a[_0xd09d('0x35')]['includeAll']){_0x2628cc['include']=[{'all':!![]}];}_0x2628cc=_['merge']({},_0x2628cc,_0x3dfa3a[_0xd09d('0x3a')]);return db['ChatApplication']['find'](_0x2628cc)[_0xd09d('0x27')](handleEntityNotFound(_0x5a0dfd,null))[_0xd09d('0x27')](respondWithResult(_0x5a0dfd,null))[_0xd09d('0x3b')](handleError(_0x5a0dfd,null));};exports[_0xd09d('0x26')]=function(_0x7580f7,_0x3d7543){if(_0x7580f7['body']['id']){delete _0x7580f7[_0xd09d('0x3c')]['id'];}return db[_0xd09d('0x33')][_0xd09d('0x3d')]({'where':{'id':_0x7580f7[_0xd09d('0x30')]['id']}})['then'](handleEntityNotFound(_0x3d7543,null))[_0xd09d('0x27')](saveUpdates(_0x7580f7[_0xd09d('0x3c')],null))[_0xd09d('0x27')](respondWithResult(_0x3d7543,null))[_0xd09d('0x3b')](handleError(_0x3d7543,null));};exports[_0xd09d('0x28')]=function(_0x15bbd5,_0x3d07ee){return db['ChatApplication'][_0xd09d('0x3d')]({'where':{'id':_0x15bbd5[_0xd09d('0x30')]['id']}})[_0xd09d('0x27')](handleEntityNotFound(_0x3d07ee,null))[_0xd09d('0x27')](removeEntity(_0x3d07ee,null))[_0xd09d('0x3b')](handleError(_0x3d07ee,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 759a4a7..4a145bc 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 _0xbfa4=['../../config/logger','api','moment','bluebird','request-promise','./chatApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x19d5d1,_0x994efc){var _0x1f132c=function(_0x3f4212){while(--_0x3f4212){_0x19d5d1['push'](_0x19d5d1['shift']());}};_0x1f132c(++_0x994efc);}(_0xbfa4,0x76));var _0x4bfa=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xbfa4[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x4bfa('0x0'));var util=require(_0x4bfa('0x1'));var logger=require(_0x4bfa('0x2'))(_0x4bfa('0x3'));var moment=require(_0x4bfa('0x4'));var BPromise=require(_0x4bfa('0x5'));var rp=require(_0x4bfa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4bfa('0x7'));module[_0x4bfa('0x8')]=function(_0x37815b,_0x54b47b){return _0x37815b[_0x4bfa('0x9')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4bfa('0xa'),'collate':_0x4bfa('0xb')});}; \ No newline at end of file +var _0x0192=['exports','ChatApplication','utf8mb4','lodash','api','moment','request-promise','path','../../config/environment'];(function(_0xe17f73,_0x270de8){var _0x585156=function(_0x255610){while(--_0x255610){_0xe17f73['push'](_0xe17f73['shift']());}};_0x585156(++_0x270de8);}(_0x0192,0x1c5));var _0x2019=function(_0x174f50,_0x47c276){_0x174f50=_0x174f50-0x0;var _0x2d8d5d=_0x0192[_0x174f50];return _0x2d8d5d;};'use strict';var _=require(_0x2019('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2019('0x1'));var moment=require(_0x2019('0x2'));var BPromise=require('bluebird');var rp=require(_0x2019('0x3'));var fs=require('fs');var path=require(_0x2019('0x4'));var rimraf=require('rimraf');var config=require(_0x2019('0x5'));var attributes=require('./chatApplication.attributes');module[_0x2019('0x6')]=function(_0x2f8c9a,_0xc5f35d){return _0x2f8c9a['define'](_0x2019('0x7'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2019('0x8'),'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 2fe99b8..ff8a3ba 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 _0xa47a=['ChatApplication,\x20%s,\x20%s','info','result','catch','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa47a,0x16c));var _0xaa47=function(_0x4b9378,_0x4fb4fe){_0x4b9378=_0x4b9378-0x0;var _0x52f25d=_0xa47a[_0x4b9378];return _0x52f25d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa47('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa47('0x1'))['db'];var utils=require(_0xaa47('0x2'));var logger=require(_0xaa47('0x3'))('rpc');var config=require(_0xaa47('0x4'));var jayson=require(_0xaa47('0x5'));var client=jayson[_0xaa47('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59f5d9,_0x1be18a,_0x3c88b5){return new BPromise(function(_0x42b5e7,_0x14c566){return client[_0xaa47('0x7')](_0x59f5d9,_0x3c88b5)[_0xaa47('0x8')](function(_0x3b642f){logger['info']('ChatApplication,\x20%s,\x20%s',_0x1be18a,_0xaa47('0x9'));logger[_0xaa47('0xa')](_0xaa47('0xb'),_0x1be18a,_0xaa47('0x9'),JSON[_0xaa47('0xc')](_0x3b642f));if(_0x3b642f[_0xaa47('0xd')]){if(_0x3b642f[_0xaa47('0xd')][_0xaa47('0xe')]===0x1f4){logger[_0xaa47('0xd')]('ChatApplication,\x20%s,\x20%s',_0x1be18a,_0x3b642f[_0xaa47('0xd')][_0xaa47('0xf')]);return _0x14c566(_0x3b642f[_0xaa47('0xd')][_0xaa47('0xf')]);}logger[_0xaa47('0xd')](_0xaa47('0x10'),_0x1be18a,_0x3b642f[_0xaa47('0xd')][_0xaa47('0xf')]);return _0x42b5e7(_0x3b642f[_0xaa47('0xd')]['message']);}else{logger[_0xaa47('0x11')](_0xaa47('0x10'),_0x1be18a,'request\x20sent');_0x42b5e7(_0x3b642f[_0xaa47('0x12')][_0xaa47('0xf')]);}})[_0xaa47('0x13')](function(_0xc2ff7){logger[_0xaa47('0xd')](_0xaa47('0x10'),_0x1be18a,_0xc2ff7);_0x14c566(_0xc2ff7);});});} \ No newline at end of file +var _0x25a7=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','util'];(function(_0x32ffb5,_0x3866b5){var _0x3cbd7a=function(_0x42315b){while(--_0x42315b){_0x32ffb5['push'](_0x32ffb5['shift']());}};_0x3cbd7a(++_0x3866b5);}(_0x25a7,0x153));var _0x725a=function(_0x28a44e,_0x3340f2){_0x28a44e=_0x28a44e-0x0;var _0x25b246=_0x25a7[_0x28a44e];return _0x25b246;};'use strict';var _=require('lodash');var util=require(_0x725a('0x0'));var moment=require(_0x725a('0x1'));var BPromise=require(_0x725a('0x2'));var rs=require(_0x725a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x725a('0x4'));var logger=require(_0x725a('0x5'))(_0x725a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b3ab3,_0x49de19,_0x1f48ef){return new BPromise(function(_0x2b3e74,_0x4cebb8){return client[_0x725a('0x8')](_0x3b3ab3,_0x1f48ef)[_0x725a('0x9')](function(_0x36fde8){logger[_0x725a('0xa')]('ChatApplication,\x20%s,\x20%s',_0x49de19,_0x725a('0xb'));logger[_0x725a('0xc')](_0x725a('0xd'),_0x49de19,_0x725a('0xb'),JSON[_0x725a('0xe')](_0x36fde8));if(_0x36fde8[_0x725a('0xf')]){if(_0x36fde8['error'][_0x725a('0x10')]===0x1f4){logger[_0x725a('0xf')](_0x725a('0x11'),_0x49de19,_0x36fde8['error'][_0x725a('0x12')]);return _0x4cebb8(_0x36fde8[_0x725a('0xf')][_0x725a('0x12')]);}logger[_0x725a('0xf')]('ChatApplication,\x20%s,\x20%s',_0x49de19,_0x36fde8[_0x725a('0xf')]['message']);return _0x2b3e74(_0x36fde8[_0x725a('0xf')][_0x725a('0x12')]);}else{logger[_0x725a('0xa')]('ChatApplication,\x20%s,\x20%s',_0x49de19,_0x725a('0xb'));_0x2b3e74(_0x36fde8[_0x725a('0x13')][_0x725a('0x12')]);}})['catch'](function(_0x108b21){logger['error']('ChatApplication,\x20%s,\x20%s',_0x49de19,_0x108b21);_0x4cebb8(_0x108b21);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a027b91..c3b245d 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 _0x9a12=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path'];(function(_0x3e9683,_0x2f3113){var _0x54837c=function(_0x503e80){while(--_0x503e80){_0x3e9683['push'](_0x3e9683['shift']());}};_0x54837c(++_0x2f3113);}(_0x9a12,0x9d));var _0x29a1=function(_0x26e542,_0x4c0c8e){_0x26e542=_0x26e542-0x0;var _0x42d1d9=_0x9a12[_0x26e542];return _0x42d1d9;};'use strict';var multer=require(_0x29a1('0x0'));var util=require(_0x29a1('0x1'));var path=require(_0x29a1('0x2'));var timeout=require(_0x29a1('0x3'));var express=require(_0x29a1('0x4'));var router=express['Router']();var fs_extra=require(_0x29a1('0x5'));var auth=require(_0x29a1('0x6'));var interaction=require(_0x29a1('0x7'));var config=require(_0x29a1('0x8'));var controller=require('./chatApplication.controller');router['get'](_0x29a1('0x9'),auth[_0x29a1('0xa')](),controller[_0x29a1('0xb')]);router[_0x29a1('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x29a1('0xd')](_0x29a1('0x9'),auth[_0x29a1('0xa')](),controller[_0x29a1('0xe')]);module[_0x29a1('0xf')]=router; \ No newline at end of file +var _0xebab=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1dde3b,_0x45002e){var _0x50ff8a=function(_0x1366c2){while(--_0x1366c2){_0x1dde3b['push'](_0x1dde3b['shift']());}};_0x50ff8a(++_0x45002e);}(_0xebab,0xfb));var _0xbeba=function(_0x13ba41,_0x2f9d72){_0x13ba41=_0x13ba41-0x0;var _0x31db5b=_0xebab[_0x13ba41];return _0x31db5b;};'use strict';var multer=require(_0xbeba('0x0'));var util=require(_0xbeba('0x1'));var path=require(_0xbeba('0x2'));var timeout=require(_0xbeba('0x3'));var express=require(_0xbeba('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbeba('0x5'));var interaction=require(_0xbeba('0x6'));var config=require(_0xbeba('0x7'));var controller=require(_0xbeba('0x8'));router[_0xbeba('0x9')](_0xbeba('0xa'),auth[_0xbeba('0xb')](),controller[_0xbeba('0xc')]);router['put'](_0xbeba('0xa'),auth[_0xbeba('0xb')](),controller[_0xbeba('0xd')]);router[_0xbeba('0xe')](_0xbeba('0xa'),auth[_0xbeba('0xb')](),controller[_0xbeba('0xf')]);module[_0xbeba('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index bb1b259..732b47c 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 _0x6642=['sequelize','STRING','BOOLEAN'];(function(_0x20d84d,_0x548b62){var _0x332698=function(_0x3a1ed7){while(--_0x3a1ed7){_0x20d84d['push'](_0x20d84d['shift']());}};_0x332698(++_0x548b62);}(_0x6642,0x81));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2664('0x0'));module['exports']={'name':{'type':Sequelize[_0x2664('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2664('0x1')]},'write':{'type':Sequelize[_0x2664('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x95eb=['sequelize','exports','STRING','BOOLEAN'];(function(_0x19d734,_0x2f57d4){var _0x448c36=function(_0x4e514a){while(--_0x4e514a){_0x19d734['push'](_0x19d734['shift']());}};_0x448c36(++_0x2f57d4);}(_0x95eb,0x1cc));var _0xb95e=function(_0x21f870,_0x2d127e){_0x21f870=_0x21f870-0x0;var _0x45c989=_0x95eb[_0x21f870];return _0x45c989;};'use strict';var Sequelize=require(_0xb95e('0x0'));module[_0xb95e('0x1')]={'name':{'type':Sequelize[_0xb95e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb95e('0x2')]},'write':{'type':Sequelize[_0xb95e('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 62cfa8c..51bc88c 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 _0x6462=['VIRTUAL','options','ChatGroup','includeAll','rows','show','params','rawAttributes','keys','fields','include','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','order','nolimit','removeMembers','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','merge'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x6462,0x189));var _0x2646=function(_0x3227c2,_0x22390f){_0x3227c2=_0x3227c2-0x0;var _0x1dc977=_0x6462[_0x3227c2];return _0x1dc977;};'use strict';var emlformat=require(_0x2646('0x0'));var rimraf=require(_0x2646('0x1'));var zipdir=require(_0x2646('0x2'));var jsonpatch=require(_0x2646('0x3'));var rp=require(_0x2646('0x4'));var moment=require('moment');var BPromise=require(_0x2646('0x5'));var Mustache=require(_0x2646('0x6'));var util=require('util');var path=require(_0x2646('0x7'));var sox=require(_0x2646('0x8'));var csv=require(_0x2646('0x9'));var ejs=require(_0x2646('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2646('0xb'));var crypto=require(_0x2646('0xc'));var jsforce=require(_0x2646('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2646('0xe'));var Papa=require(_0x2646('0xf'));var Redis=require(_0x2646('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2646('0x11'));var logger=require('../../config/logger')(_0x2646('0x12'));var utils=require(_0x2646('0x13'));var config=require(_0x2646('0x14'));var licenseUtil=require(_0x2646('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x2646('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2646('0x16')]));require(_0x2646('0x17'))[_0x2646('0x18')](socket);function respondWithStatusCode(_0x8146f9,_0x4065df){_0x4065df=_0x4065df||0xcc;return function(_0x530772){if(_0x530772){return _0x8146f9['sendStatus'](_0x4065df);}return _0x8146f9[_0x2646('0x19')](_0x4065df)[_0x2646('0x1a')]();};}function respondWithResult(_0x4f31d9,_0x2e2f19){_0x2e2f19=_0x2e2f19||0xc8;return function(_0x143152){if(_0x143152){return _0x4f31d9[_0x2646('0x19')](_0x2e2f19)[_0x2646('0x1b')](_0x143152);}};}function respondWithFilteredResult(_0x41eb6b,_0x29b1f8){return function(_0x6431f6){if(_0x6431f6){var _0x29ba8f=typeof _0x29b1f8[_0x2646('0x1c')]===_0x2646('0x1d')&&typeof _0x29b1f8[_0x2646('0x1e')]==='undefined';var _0x38d86c=_0x6431f6[_0x2646('0x1f')];var _0x6d8bd1=_0x29ba8f?0x0:_0x29b1f8[_0x2646('0x1c')];var _0x51e401=_0x29ba8f?_0x6431f6['count']:_0x29b1f8['offset']+_0x29b1f8[_0x2646('0x1e')];var _0x56a5c2;if(_0x51e401>=_0x38d86c){_0x51e401=_0x38d86c;_0x56a5c2=0xc8;}else{_0x56a5c2=0xce;}_0x41eb6b['status'](_0x56a5c2);return _0x41eb6b[_0x2646('0x20')](_0x2646('0x21'),_0x6d8bd1+'-'+_0x51e401+'/'+_0x38d86c)['json'](_0x6431f6);}return null;};}function patchUpdates(_0x362321){return function(_0x1cb307){try{jsonpatch['apply'](_0x1cb307,_0x362321,!![]);}catch(_0x50142b){return BPromise['reject'](_0x50142b);}return _0x1cb307['save']();};}function saveUpdates(_0x1c847c,_0x3f552f){return function(_0x503a76){if(_0x503a76){return _0x503a76[_0x2646('0x22')](_0x1c847c)[_0x2646('0x23')](function(_0x405c77){return _0x405c77;});}return null;};}function removeEntity(_0x5f9bd4,_0x4339f0){return function(_0x43b19d){if(_0x43b19d){return _0x43b19d[_0x2646('0x24')]()[_0x2646('0x23')](function(){_0x5f9bd4[_0x2646('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1099b7,_0x11a3e7){return function(_0x5dabd1){if(!_0x5dabd1){_0x1099b7['sendStatus'](0x194);}return _0x5dabd1;};}function handleError(_0x461e2e,_0x6546b0){_0x6546b0=_0x6546b0||0x1f4;return function(_0x3828e4){logger[_0x2646('0x25')](_0x3828e4[_0x2646('0x26')]);if(_0x3828e4['name']){delete _0x3828e4[_0x2646('0x27')];}_0x461e2e[_0x2646('0x19')](_0x6546b0)[_0x2646('0x28')](_0x3828e4);};}exports[_0x2646('0x29')]=function(_0x5c84f3,_0x4ccf67){var _0x40ddca={},_0x311ce3={},_0x1f3eec={'count':0x0,'rows':[]};var _0x3faaac=_[_0x2646('0x2a')](db['ChatGroup']['rawAttributes'],function(_0x50c9e7){return{'name':_0x50c9e7['fieldName'],'type':_0x50c9e7[_0x2646('0x2b')][_0x2646('0x2c')]};});_0x311ce3[_0x2646('0x2d')]=_[_0x2646('0x2a')](_0x3faaac,_0x2646('0x27'));_0x311ce3[_0x2646('0x2e')]=_['keys'](_0x5c84f3[_0x2646('0x2e')]);_0x311ce3[_0x2646('0x2f')]=_[_0x2646('0x30')](_0x311ce3['model'],_0x311ce3[_0x2646('0x2e')]);_0x40ddca[_0x2646('0x31')]=_[_0x2646('0x30')](_0x311ce3[_0x2646('0x2d')],qs['fields'](_0x5c84f3['query']['fields']));_0x40ddca[_0x2646('0x31')]=_0x40ddca['attributes'][_0x2646('0x32')]?_0x40ddca[_0x2646('0x31')]:_0x311ce3[_0x2646('0x2d')];if(!_0x5c84f3[_0x2646('0x2e')][_0x2646('0x33')]('nolimit')){_0x40ddca['limit']=qs[_0x2646('0x1e')](_0x5c84f3[_0x2646('0x2e')]['limit']);_0x40ddca[_0x2646('0x1c')]=qs[_0x2646('0x1c')](_0x5c84f3[_0x2646('0x2e')][_0x2646('0x1c')]);}_0x40ddca['order']=qs[_0x2646('0x34')](_0x5c84f3[_0x2646('0x2e')][_0x2646('0x34')]);_0x40ddca['where']=qs[_0x2646('0x2f')](_[_0x2646('0x35')](_0x5c84f3['query'],_0x311ce3[_0x2646('0x2f')]),_0x3faaac);if(_0x5c84f3[_0x2646('0x2e')][_0x2646('0x36')]){_0x40ddca[_0x2646('0x37')]=_[_0x2646('0x38')](_0x40ddca[_0x2646('0x37')],{'$or':_[_0x2646('0x2a')](_0x3faaac,function(_0x172df9){if(_0x172df9[_0x2646('0x2b')]!==_0x2646('0x39')){var _0x181c27={};_0x181c27[_0x172df9[_0x2646('0x27')]]={'$like':'%'+_0x5c84f3[_0x2646('0x2e')][_0x2646('0x36')]+'%'};return _0x181c27;}})});}_0x40ddca=_[_0x2646('0x38')]({},_0x40ddca,_0x5c84f3[_0x2646('0x3a')]);var _0x2b2c60={'where':_0x40ddca[_0x2646('0x37')]};return db[_0x2646('0x3b')]['count'](_0x2b2c60)[_0x2646('0x23')](function(_0x4ca5a2){_0x1f3eec[_0x2646('0x1f')]=_0x4ca5a2;if(_0x5c84f3[_0x2646('0x2e')][_0x2646('0x3c')]){_0x40ddca['include']=[{'all':!![]}];}return db[_0x2646('0x3b')]['findAll'](_0x40ddca);})[_0x2646('0x23')](function(_0x2916f7){_0x1f3eec[_0x2646('0x3d')]=_0x2916f7;return _0x1f3eec;})[_0x2646('0x23')](respondWithFilteredResult(_0x4ccf67,_0x40ddca))['catch'](handleError(_0x4ccf67,null));};exports[_0x2646('0x3e')]=function(_0x3546da,_0x4030f6){var _0x47c1d6={'raw':!![],'where':{'id':_0x3546da[_0x2646('0x3f')]['id']}},_0x50e7ee={};_0x50e7ee[_0x2646('0x2d')]=_['keys'](db[_0x2646('0x3b')][_0x2646('0x40')]);_0x50e7ee['query']=_[_0x2646('0x41')](_0x3546da[_0x2646('0x2e')]);_0x50e7ee[_0x2646('0x2f')]=_[_0x2646('0x30')](_0x50e7ee[_0x2646('0x2d')],_0x50e7ee[_0x2646('0x2e')]);_0x47c1d6[_0x2646('0x31')]=_[_0x2646('0x30')](_0x50e7ee['model'],qs[_0x2646('0x42')](_0x3546da['query']['fields']));_0x47c1d6[_0x2646('0x31')]=_0x47c1d6[_0x2646('0x31')]['length']?_0x47c1d6[_0x2646('0x31')]:_0x50e7ee[_0x2646('0x2d')];if(_0x3546da['query'][_0x2646('0x3c')]){_0x47c1d6[_0x2646('0x43')]=[{'all':!![]}];}_0x47c1d6=_[_0x2646('0x38')]({},_0x47c1d6,_0x3546da[_0x2646('0x3a')]);return db[_0x2646('0x3b')][_0x2646('0x44')](_0x47c1d6)[_0x2646('0x23')](handleEntityNotFound(_0x4030f6,null))[_0x2646('0x23')](respondWithResult(_0x4030f6,null))[_0x2646('0x45')](handleError(_0x4030f6,null));};exports['create']=function(_0x1bde35,_0x2d8924){return db[_0x2646('0x3b')][_0x2646('0x46')](_0x1bde35[_0x2646('0x47')],{})[_0x2646('0x23')](respondWithResult(_0x2d8924,0xc9))[_0x2646('0x45')](handleError(_0x2d8924,null));};exports[_0x2646('0x22')]=function(_0x1e7b5a,_0x33044d){if(_0x1e7b5a[_0x2646('0x47')]['id']){delete _0x1e7b5a[_0x2646('0x47')]['id'];}return db['ChatGroup'][_0x2646('0x44')]({'where':{'id':_0x1e7b5a[_0x2646('0x3f')]['id']}})[_0x2646('0x23')](handleEntityNotFound(_0x33044d,null))['then'](saveUpdates(_0x1e7b5a[_0x2646('0x47')],null))['then'](respondWithResult(_0x33044d,null))[_0x2646('0x45')](handleError(_0x33044d,null));};exports[_0x2646('0x24')]=function(_0x3ec1b9,_0x4641fc){return db[_0x2646('0x3b')][_0x2646('0x44')]({'where':{'id':_0x3ec1b9[_0x2646('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4641fc,null))[_0x2646('0x23')](removeEntity(_0x4641fc,null))[_0x2646('0x45')](handleError(_0x4641fc,null));};exports[_0x2646('0x48')]=function(_0x162e67,_0x489608){return db[_0x2646('0x3b')][_0x2646('0x48')]()[_0x2646('0x23')](respondWithResult(_0x489608,null))[_0x2646('0x45')](handleError(_0x489608,null));};exports[_0x2646('0x49')]=function(_0x265522,_0x3035da,_0x40d49a){return db[_0x2646('0x4a')][_0x2646('0x1f')]({'where':{'ChatGroupId':_0x265522['params']['id'],'ToId':_0x265522[_0x2646('0x4b')]['id'],'read':![]}})['then'](function(_0x7f5ee0){return{'id':_[_0x2646('0x4c')](_0x265522[_0x2646('0x3f')]['id']),'count':_0x7f5ee0};})[_0x2646('0x23')](respondWithResult(_0x3035da,null))[_0x2646('0x45')](handleError(_0x3035da,null));};exports[_0x2646('0x4d')]=function(_0xc6c633,_0x35a617,_0x52a956){return db[_0x2646('0x3b')][_0x2646('0x44')]({'where':{'id':_0xc6c633['params']['id']}})['then'](handleEntityNotFound(_0x35a617,null))['then'](function(_0x3830f2){if(_0x3830f2){return _0x3830f2['addMembers'](_0xc6c633[_0x2646('0x47')][_0x2646('0x4e')],_['omit'](_0xc6c633[_0x2646('0x47')],[_0x2646('0x4e'),'id'])||{});}})[_0x2646('0x23')](respondWithResult(_0x35a617,null))[_0x2646('0x45')](handleError(_0x35a617,null));};exports[_0x2646('0x4f')]=function(_0x396fc9,_0x56cf9d,_0x48730f){var _0x6d5d23={};var _0x599778={};var _0xe68bc2;var _0x36879f;return db[_0x2646('0x3b')][_0x2646('0x50')]({'where':{'id':_0x396fc9['params']['id']}})[_0x2646('0x23')](handleEntityNotFound(_0x56cf9d,null))[_0x2646('0x23')](function(_0x6d5364){if(_0x6d5364){_0xe68bc2=_0x6d5364;_0x599778['model']=_[_0x2646('0x41')](db[_0x2646('0x51')][_0x2646('0x40')]);_0x599778[_0x2646('0x2e')]=_['keys'](_0x396fc9['query']);_0x599778[_0x2646('0x2f')]=_[_0x2646('0x30')](_0x599778[_0x2646('0x2d')],_0x599778[_0x2646('0x2e')]);_0x6d5d23[_0x2646('0x31')]=_[_0x2646('0x30')](_0x599778[_0x2646('0x2d')],qs[_0x2646('0x42')](_0x396fc9['query'][_0x2646('0x42')]));_0x6d5d23[_0x2646('0x31')]=_0x6d5d23['attributes']['length']?_0x6d5d23['attributes']:_0x599778[_0x2646('0x2d')];_0x6d5d23[_0x2646('0x52')]=qs[_0x2646('0x34')](_0x396fc9[_0x2646('0x2e')][_0x2646('0x34')]);_0x6d5d23['where']=qs['filters'](_['pick'](_0x396fc9[_0x2646('0x2e')],_0x599778[_0x2646('0x2f')]));if(_0x396fc9[_0x2646('0x2e')][_0x2646('0x36')]){_0x6d5d23['where']=_['merge'](_0x6d5d23['where'],{'$or':_[_0x2646('0x2a')](_0x6d5d23[_0x2646('0x31')],function(_0x427b30){var _0x1a6d5f={};_0x1a6d5f[_0x427b30]={'$like':'%'+_0x396fc9['query'][_0x2646('0x36')]+'%'};return _0x1a6d5f;})});}_0x6d5d23=_[_0x2646('0x38')]({},_0x6d5d23,_0x396fc9['options']);return _0xe68bc2[_0x2646('0x4f')](_0x6d5d23);}})[_0x2646('0x23')](function(_0x2d6a60){if(_0x2d6a60){_0x36879f=_0x2d6a60[_0x2646('0x32')];if(!_0x396fc9[_0x2646('0x2e')][_0x2646('0x33')](_0x2646('0x53'))){_0x6d5d23['limit']=qs[_0x2646('0x1e')](_0x396fc9[_0x2646('0x2e')]['limit']);_0x6d5d23[_0x2646('0x1c')]=qs[_0x2646('0x1c')](_0x396fc9[_0x2646('0x2e')][_0x2646('0x1c')]);}return _0xe68bc2[_0x2646('0x4f')](_0x6d5d23);}})['then'](function(_0x5e6441){if(_0x5e6441){return _0x5e6441?{'count':_0x36879f,'rows':_0x5e6441}:null;}})[_0x2646('0x23')](respondWithResult(_0x56cf9d,null))['catch'](handleError(_0x56cf9d,null));};exports[_0x2646('0x54')]=function(_0x3dabc3,_0x21d4cb,_0x32f948){return db['ChatGroup'][_0x2646('0x44')]({'where':{'id':_0x3dabc3[_0x2646('0x3f')]['id']}})[_0x2646('0x23')](handleEntityNotFound(_0x21d4cb,null))[_0x2646('0x23')](function(_0x58f6bf){if(_0x58f6bf){return _0x58f6bf[_0x2646('0x54')](_0x3dabc3[_0x2646('0x2e')][_0x2646('0x4e')]);}})[_0x2646('0x23')](respondWithStatusCode(_0x21d4cb,null))[_0x2646('0x45')](handleError(_0x21d4cb,null));};exports['addMessage']=function(_0x57c80b,_0x43fdc1,_0x27d783){if(_0x57c80b[_0x2646('0x47')]['id']){delete _0x57c80b[_0x2646('0x47')]['id'];}return db[_0x2646('0x3b')][_0x2646('0x44')]({'where':{'id':_0x57c80b['params']['id']}})[_0x2646('0x23')](handleEntityNotFound(_0x43fdc1,null))[_0x2646('0x23')](function(_0x2fcc04){if(_0x2fcc04){_0x57c80b['body'][_0x2646('0x55')]=_0x2fcc04['id'];return db['ChatInternalMessage'][_0x2646('0x46')](_0x57c80b[_0x2646('0x47')]);}})[_0x2646('0x23')](respondWithResult(_0x43fdc1,null))[_0x2646('0x45')](handleError(_0x43fdc1,null));};exports[_0x2646('0x56')]=function(_0x322733,_0x1707d1,_0x385418){var _0x31bbe7={};var _0x193779={};var _0x545d66;var _0x41a729;return db[_0x2646('0x3b')][_0x2646('0x50')]({'where':{'id':_0x322733['params']['id']}})[_0x2646('0x23')](handleEntityNotFound(_0x1707d1,null))[_0x2646('0x23')](function(_0x35447e){if(_0x35447e){_0x545d66=_0x35447e;_0x193779[_0x2646('0x2d')]=_[_0x2646('0x41')](db[_0x2646('0x4a')][_0x2646('0x40')]);_0x193779[_0x2646('0x2e')]=_[_0x2646('0x41')](_0x322733[_0x2646('0x2e')]);_0x193779[_0x2646('0x2f')]=_['intersection'](_0x193779[_0x2646('0x2d')],_0x193779[_0x2646('0x2e')]);_0x31bbe7[_0x2646('0x31')]=_[_0x2646('0x30')](_0x193779[_0x2646('0x2d')],qs['fields'](_0x322733[_0x2646('0x2e')]['fields']));_0x31bbe7[_0x2646('0x31')]=_0x31bbe7['attributes'][_0x2646('0x32')]?_0x31bbe7[_0x2646('0x31')]:_0x193779[_0x2646('0x2d')];_0x31bbe7[_0x2646('0x52')]=qs[_0x2646('0x34')](_0x322733[_0x2646('0x2e')]['sort']);_0x31bbe7[_0x2646('0x37')]=qs[_0x2646('0x2f')](_[_0x2646('0x35')](_0x322733['query'],_0x193779[_0x2646('0x2f')]));if(_0x322733[_0x2646('0x2e')][_0x2646('0x36')]){_0x31bbe7[_0x2646('0x37')]=_[_0x2646('0x38')](_0x31bbe7[_0x2646('0x37')],{'$or':_['map'](_0x31bbe7[_0x2646('0x31')],function(_0x527ba4){var _0x46ca22={};_0x46ca22[_0x527ba4]={'$like':'%'+_0x322733['query'][_0x2646('0x36')]+'%'};return _0x46ca22;})});}if(_0x322733[_0x2646('0x2e')][_0x2646('0x57')]){var _0x223ee1=_0x322733['query']['$gte']['split'](',');var _0x1668f3={};_0x1668f3[_0x223ee1[0x0]]={'$gte':moment(_0x223ee1[0x1])[_0x2646('0x58')](_0x2646('0x59'))};_0x31bbe7[_0x2646('0x37')]=_[_0x2646('0x38')](_0x31bbe7[_0x2646('0x37')],_0x1668f3);}_0x31bbe7=_[_0x2646('0x38')]({},_0x31bbe7,_0x322733['options']);return _0x545d66[_0x2646('0x56')](_0x31bbe7);}})[_0x2646('0x23')](function(_0x3b3823){if(_0x3b3823){_0x41a729=_0x3b3823[_0x2646('0x32')];if(!_0x322733['query'][_0x2646('0x33')]('nolimit')){_0x31bbe7['limit']=qs['limit'](_0x322733[_0x2646('0x2e')]['limit']);_0x31bbe7[_0x2646('0x1c')]=qs[_0x2646('0x1c')](_0x322733['query']['offset']);}return _0x545d66[_0x2646('0x56')](_0x31bbe7);}})['then'](function(_0x223334){if(_0x223334){return _0x223334?{'count':_0x41a729,'rows':_0x223334}:null;}})[_0x2646('0x23')](respondWithResult(_0x1707d1,null))['catch'](handleError(_0x1707d1,null));}; \ No newline at end of file +var _0x6424=['keys','filters','attributes','intersection','fields','length','limit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','omit','ids','getMembers','findOne','User','order','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','map','ChatGroup','fieldName','type','model','query'];(function(_0x1a4cac,_0x116f47){var _0x142f2f=function(_0x4a1e47){while(--_0x4a1e47){_0x1a4cac['push'](_0x1a4cac['shift']());}};_0x142f2f(++_0x116f47);}(_0x6424,0x1a5));var _0x4642=function(_0x2dbd51,_0x31b742){_0x2dbd51=_0x2dbd51-0x0;var _0x28ada1=_0x6424[_0x2dbd51];return _0x28ada1;};'use strict';var emlformat=require(_0x4642('0x0'));var rimraf=require(_0x4642('0x1'));var zipdir=require(_0x4642('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4642('0x3'));var moment=require('moment');var BPromise=require(_0x4642('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4642('0x5'));var csv=require('to-csv');var ejs=require(_0x4642('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4642('0x7'));var squel=require(_0x4642('0x8'));var crypto=require(_0x4642('0x9'));var jsforce=require(_0x4642('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4642('0xb'));var querystring=require(_0x4642('0xc'));var Papa=require(_0x4642('0xd'));var Redis=require(_0x4642('0xe'));var authService=require(_0x4642('0xf'));var qs=require(_0x4642('0x10'));var as=require(_0x4642('0x11'));var hardwareService=require(_0x4642('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4642('0x13'));var config=require(_0x4642('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4642('0x15'))['db'];config['redis']=_[_0x4642('0x16')](config['redis'],{'host':_0x4642('0x17'),'port':0x18eb});var socket=require(_0x4642('0x18'))(new Redis(config[_0x4642('0x19')]));require('./chatGroup.socket')[_0x4642('0x1a')](socket);function respondWithStatusCode(_0x42fadb,_0x1774ff){_0x1774ff=_0x1774ff||0xcc;return function(_0x38b027){if(_0x38b027){return _0x42fadb[_0x4642('0x1b')](_0x1774ff);}return _0x42fadb[_0x4642('0x1c')](_0x1774ff)[_0x4642('0x1d')]();};}function respondWithResult(_0x3a5fc3,_0x125c8f){_0x125c8f=_0x125c8f||0xc8;return function(_0x28c56b){if(_0x28c56b){return _0x3a5fc3['status'](_0x125c8f)[_0x4642('0x1e')](_0x28c56b);}};}function respondWithFilteredResult(_0x5d832d,_0xc7ad0){return function(_0x132231){if(_0x132231){var _0x1efb49=typeof _0xc7ad0[_0x4642('0x1f')]===_0x4642('0x20')&&typeof _0xc7ad0['limit']===_0x4642('0x20');var _0xf129b7=_0x132231[_0x4642('0x21')];var _0x5b4aa2=_0x1efb49?0x0:_0xc7ad0[_0x4642('0x1f')];var _0x3d76e8=_0x1efb49?_0x132231['count']:_0xc7ad0['offset']+_0xc7ad0['limit'];var _0x1394d3;if(_0x3d76e8>=_0xf129b7){_0x3d76e8=_0xf129b7;_0x1394d3=0xc8;}else{_0x1394d3=0xce;}_0x5d832d[_0x4642('0x1c')](_0x1394d3);return _0x5d832d[_0x4642('0x22')](_0x4642('0x23'),_0x5b4aa2+'-'+_0x3d76e8+'/'+_0xf129b7)[_0x4642('0x1e')](_0x132231);}return null;};}function patchUpdates(_0x33e3c9){return function(_0x26e017){try{jsonpatch['apply'](_0x26e017,_0x33e3c9,!![]);}catch(_0x167f88){return BPromise[_0x4642('0x24')](_0x167f88);}return _0x26e017[_0x4642('0x25')]();};}function saveUpdates(_0x3eec2f,_0x282db2){return function(_0x2fa785){if(_0x2fa785){return _0x2fa785['update'](_0x3eec2f)[_0x4642('0x26')](function(_0x1a7ad6){return _0x1a7ad6;});}return null;};}function removeEntity(_0x381218,_0x251039){return function(_0x4b4e97){if(_0x4b4e97){return _0x4b4e97[_0x4642('0x27')]()[_0x4642('0x26')](function(){_0x381218[_0x4642('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f73d8,_0x488bed){return function(_0x59cbdc){if(!_0x59cbdc){_0x3f73d8[_0x4642('0x1b')](0x194);}return _0x59cbdc;};}function handleError(_0x47ad32,_0x510d80){_0x510d80=_0x510d80||0x1f4;return function(_0x2136c8){logger[_0x4642('0x28')](_0x2136c8[_0x4642('0x29')]);if(_0x2136c8[_0x4642('0x2a')]){delete _0x2136c8[_0x4642('0x2a')];}_0x47ad32[_0x4642('0x1c')](_0x510d80)['send'](_0x2136c8);};}exports['index']=function(_0x50d11e,_0xa09e7){var _0x39eebe={},_0x40eb08={},_0x23b00f={'count':0x0,'rows':[]};var _0x4f4a3c=_[_0x4642('0x2b')](db[_0x4642('0x2c')]['rawAttributes'],function(_0x192784){return{'name':_0x192784[_0x4642('0x2d')],'type':_0x192784[_0x4642('0x2e')]['key']};});_0x40eb08[_0x4642('0x2f')]=_[_0x4642('0x2b')](_0x4f4a3c,_0x4642('0x2a'));_0x40eb08[_0x4642('0x30')]=_[_0x4642('0x31')](_0x50d11e[_0x4642('0x30')]);_0x40eb08[_0x4642('0x32')]=_['intersection'](_0x40eb08[_0x4642('0x2f')],_0x40eb08[_0x4642('0x30')]);_0x39eebe[_0x4642('0x33')]=_[_0x4642('0x34')](_0x40eb08[_0x4642('0x2f')],qs[_0x4642('0x35')](_0x50d11e[_0x4642('0x30')][_0x4642('0x35')]));_0x39eebe[_0x4642('0x33')]=_0x39eebe['attributes'][_0x4642('0x36')]?_0x39eebe[_0x4642('0x33')]:_0x40eb08[_0x4642('0x2f')];if(!_0x50d11e[_0x4642('0x30')]['hasOwnProperty']('nolimit')){_0x39eebe[_0x4642('0x37')]=qs['limit'](_0x50d11e[_0x4642('0x30')][_0x4642('0x37')]);_0x39eebe[_0x4642('0x1f')]=qs[_0x4642('0x1f')](_0x50d11e[_0x4642('0x30')][_0x4642('0x1f')]);}_0x39eebe['order']=qs['sort'](_0x50d11e['query'][_0x4642('0x38')]);_0x39eebe[_0x4642('0x39')]=qs[_0x4642('0x32')](_[_0x4642('0x3a')](_0x50d11e[_0x4642('0x30')],_0x40eb08['filters']),_0x4f4a3c);if(_0x50d11e[_0x4642('0x30')][_0x4642('0x3b')]){_0x39eebe[_0x4642('0x39')]=_['merge'](_0x39eebe[_0x4642('0x39')],{'$or':_[_0x4642('0x2b')](_0x4f4a3c,function(_0xbedcc5){if(_0xbedcc5['type']!==_0x4642('0x3c')){var _0x3ff7bb={};_0x3ff7bb[_0xbedcc5[_0x4642('0x2a')]]={'$like':'%'+_0x50d11e[_0x4642('0x30')]['filter']+'%'};return _0x3ff7bb;}})});}_0x39eebe=_[_0x4642('0x3d')]({},_0x39eebe,_0x50d11e[_0x4642('0x3e')]);var _0x5556ec={'where':_0x39eebe['where']};return db['ChatGroup']['count'](_0x5556ec)['then'](function(_0x12fc8a){_0x23b00f[_0x4642('0x21')]=_0x12fc8a;if(_0x50d11e[_0x4642('0x30')]['includeAll']){_0x39eebe[_0x4642('0x3f')]=[{'all':!![]}];}return db['ChatGroup'][_0x4642('0x40')](_0x39eebe);})['then'](function(_0x5897f9){_0x23b00f['rows']=_0x5897f9;return _0x23b00f;})['then'](respondWithFilteredResult(_0xa09e7,_0x39eebe))[_0x4642('0x41')](handleError(_0xa09e7,null));};exports[_0x4642('0x42')]=function(_0x47ed48,_0x37ceeb){var _0x26585a={'raw':!![],'where':{'id':_0x47ed48[_0x4642('0x43')]['id']}},_0x222b50={};_0x222b50[_0x4642('0x2f')]=_[_0x4642('0x31')](db['ChatGroup'][_0x4642('0x44')]);_0x222b50['query']=_[_0x4642('0x31')](_0x47ed48[_0x4642('0x30')]);_0x222b50[_0x4642('0x32')]=_['intersection'](_0x222b50[_0x4642('0x2f')],_0x222b50['query']);_0x26585a['attributes']=_[_0x4642('0x34')](_0x222b50['model'],qs[_0x4642('0x35')](_0x47ed48[_0x4642('0x30')][_0x4642('0x35')]));_0x26585a[_0x4642('0x33')]=_0x26585a[_0x4642('0x33')][_0x4642('0x36')]?_0x26585a['attributes']:_0x222b50[_0x4642('0x2f')];if(_0x47ed48[_0x4642('0x30')][_0x4642('0x45')]){_0x26585a[_0x4642('0x3f')]=[{'all':!![]}];}_0x26585a=_['merge']({},_0x26585a,_0x47ed48[_0x4642('0x3e')]);return db['ChatGroup'][_0x4642('0x46')](_0x26585a)[_0x4642('0x26')](handleEntityNotFound(_0x37ceeb,null))['then'](respondWithResult(_0x37ceeb,null))[_0x4642('0x41')](handleError(_0x37ceeb,null));};exports[_0x4642('0x47')]=function(_0x16c94f,_0x3eddb9){return db['ChatGroup']['create'](_0x16c94f[_0x4642('0x48')],{})[_0x4642('0x26')](respondWithResult(_0x3eddb9,0xc9))[_0x4642('0x41')](handleError(_0x3eddb9,null));};exports[_0x4642('0x49')]=function(_0x4987f6,_0x36a0d8){if(_0x4987f6[_0x4642('0x48')]['id']){delete _0x4987f6[_0x4642('0x48')]['id'];}return db[_0x4642('0x2c')]['find']({'where':{'id':_0x4987f6['params']['id']}})[_0x4642('0x26')](handleEntityNotFound(_0x36a0d8,null))[_0x4642('0x26')](saveUpdates(_0x4987f6[_0x4642('0x48')],null))['then'](respondWithResult(_0x36a0d8,null))[_0x4642('0x41')](handleError(_0x36a0d8,null));};exports['destroy']=function(_0xc6c1c8,_0x9f725c){return db['ChatGroup'][_0x4642('0x46')]({'where':{'id':_0xc6c1c8[_0x4642('0x43')]['id']}})[_0x4642('0x26')](handleEntityNotFound(_0x9f725c,null))[_0x4642('0x26')](removeEntity(_0x9f725c,null))[_0x4642('0x41')](handleError(_0x9f725c,null));};exports[_0x4642('0x4a')]=function(_0x318929,_0x1b13b0){return db[_0x4642('0x2c')]['describe']()[_0x4642('0x26')](respondWithResult(_0x1b13b0,null))['catch'](handleError(_0x1b13b0,null));};exports[_0x4642('0x4b')]=function(_0x3c8ba9,_0x5547f7,_0x28d84d){return db[_0x4642('0x4c')][_0x4642('0x21')]({'where':{'ChatGroupId':_0x3c8ba9[_0x4642('0x43')]['id'],'ToId':_0x3c8ba9[_0x4642('0x4d')]['id'],'read':![]}})[_0x4642('0x26')](function(_0x2778da){return{'id':_['toInteger'](_0x3c8ba9[_0x4642('0x43')]['id']),'count':_0x2778da};})['then'](respondWithResult(_0x5547f7,null))[_0x4642('0x41')](handleError(_0x5547f7,null));};exports[_0x4642('0x4e')]=function(_0xb49a9d,_0x6751b,_0x2560c8){return db[_0x4642('0x2c')][_0x4642('0x46')]({'where':{'id':_0xb49a9d[_0x4642('0x43')]['id']}})['then'](handleEntityNotFound(_0x6751b,null))[_0x4642('0x26')](function(_0x180bfa){if(_0x180bfa){return _0x180bfa[_0x4642('0x4e')](_0xb49a9d[_0x4642('0x48')]['ids'],_[_0x4642('0x4f')](_0xb49a9d['body'],[_0x4642('0x50'),'id'])||{});}})[_0x4642('0x26')](respondWithResult(_0x6751b,null))['catch'](handleError(_0x6751b,null));};exports[_0x4642('0x51')]=function(_0x16919e,_0x11069e,_0x54cf98){var _0x4785ff={};var _0x18e87e={};var _0x4fcbf3;var _0x477d06;return db[_0x4642('0x2c')][_0x4642('0x52')]({'where':{'id':_0x16919e['params']['id']}})[_0x4642('0x26')](handleEntityNotFound(_0x11069e,null))[_0x4642('0x26')](function(_0x28d2c7){if(_0x28d2c7){_0x4fcbf3=_0x28d2c7;_0x18e87e['model']=_['keys'](db[_0x4642('0x53')][_0x4642('0x44')]);_0x18e87e['query']=_[_0x4642('0x31')](_0x16919e[_0x4642('0x30')]);_0x18e87e['filters']=_[_0x4642('0x34')](_0x18e87e[_0x4642('0x2f')],_0x18e87e[_0x4642('0x30')]);_0x4785ff[_0x4642('0x33')]=_[_0x4642('0x34')](_0x18e87e[_0x4642('0x2f')],qs[_0x4642('0x35')](_0x16919e['query'][_0x4642('0x35')]));_0x4785ff['attributes']=_0x4785ff[_0x4642('0x33')][_0x4642('0x36')]?_0x4785ff[_0x4642('0x33')]:_0x18e87e[_0x4642('0x2f')];_0x4785ff[_0x4642('0x54')]=qs[_0x4642('0x38')](_0x16919e['query'][_0x4642('0x38')]);_0x4785ff[_0x4642('0x39')]=qs[_0x4642('0x32')](_['pick'](_0x16919e[_0x4642('0x30')],_0x18e87e[_0x4642('0x32')]));if(_0x16919e[_0x4642('0x30')]['filter']){_0x4785ff[_0x4642('0x39')]=_[_0x4642('0x3d')](_0x4785ff['where'],{'$or':_[_0x4642('0x2b')](_0x4785ff['attributes'],function(_0x463c36){var _0x337462={};_0x337462[_0x463c36]={'$like':'%'+_0x16919e[_0x4642('0x30')]['filter']+'%'};return _0x337462;})});}_0x4785ff=_[_0x4642('0x3d')]({},_0x4785ff,_0x16919e[_0x4642('0x3e')]);return _0x4fcbf3[_0x4642('0x51')](_0x4785ff);}})[_0x4642('0x26')](function(_0x20c635){if(_0x20c635){_0x477d06=_0x20c635['length'];if(!_0x16919e['query'][_0x4642('0x55')](_0x4642('0x56'))){_0x4785ff[_0x4642('0x37')]=qs['limit'](_0x16919e['query'][_0x4642('0x37')]);_0x4785ff[_0x4642('0x1f')]=qs[_0x4642('0x1f')](_0x16919e[_0x4642('0x30')][_0x4642('0x1f')]);}return _0x4fcbf3[_0x4642('0x51')](_0x4785ff);}})['then'](function(_0x278c0b){if(_0x278c0b){return _0x278c0b?{'count':_0x477d06,'rows':_0x278c0b}:null;}})[_0x4642('0x26')](respondWithResult(_0x11069e,null))[_0x4642('0x41')](handleError(_0x11069e,null));};exports['removeMembers']=function(_0x2c5853,_0x85c24,_0x59122d){return db['ChatGroup']['find']({'where':{'id':_0x2c5853['params']['id']}})[_0x4642('0x26')](handleEntityNotFound(_0x85c24,null))[_0x4642('0x26')](function(_0x149e17){if(_0x149e17){return _0x149e17[_0x4642('0x57')](_0x2c5853['query'][_0x4642('0x50')]);}})[_0x4642('0x26')](respondWithStatusCode(_0x85c24,null))[_0x4642('0x41')](handleError(_0x85c24,null));};exports[_0x4642('0x58')]=function(_0x1ae414,_0x481b89,_0x946778){if(_0x1ae414[_0x4642('0x48')]['id']){delete _0x1ae414[_0x4642('0x48')]['id'];}return db[_0x4642('0x2c')][_0x4642('0x46')]({'where':{'id':_0x1ae414['params']['id']}})[_0x4642('0x26')](handleEntityNotFound(_0x481b89,null))['then'](function(_0x528bfa){if(_0x528bfa){_0x1ae414[_0x4642('0x48')][_0x4642('0x59')]=_0x528bfa['id'];return db[_0x4642('0x4c')][_0x4642('0x47')](_0x1ae414[_0x4642('0x48')]);}})['then'](respondWithResult(_0x481b89,null))['catch'](handleError(_0x481b89,null));};exports[_0x4642('0x5a')]=function(_0x54310e,_0x4280f8,_0x251336){var _0x5564cc={};var _0x364839={};var _0x4ee648;var _0x2eeda6;return db['ChatGroup']['findOne']({'where':{'id':_0x54310e[_0x4642('0x43')]['id']}})[_0x4642('0x26')](handleEntityNotFound(_0x4280f8,null))['then'](function(_0x1dc638){if(_0x1dc638){_0x4ee648=_0x1dc638;_0x364839['model']=_[_0x4642('0x31')](db[_0x4642('0x4c')][_0x4642('0x44')]);_0x364839[_0x4642('0x30')]=_['keys'](_0x54310e[_0x4642('0x30')]);_0x364839[_0x4642('0x32')]=_[_0x4642('0x34')](_0x364839[_0x4642('0x2f')],_0x364839['query']);_0x5564cc[_0x4642('0x33')]=_['intersection'](_0x364839[_0x4642('0x2f')],qs[_0x4642('0x35')](_0x54310e[_0x4642('0x30')][_0x4642('0x35')]));_0x5564cc[_0x4642('0x33')]=_0x5564cc[_0x4642('0x33')][_0x4642('0x36')]?_0x5564cc[_0x4642('0x33')]:_0x364839[_0x4642('0x2f')];_0x5564cc[_0x4642('0x54')]=qs['sort'](_0x54310e[_0x4642('0x30')][_0x4642('0x38')]);_0x5564cc[_0x4642('0x39')]=qs[_0x4642('0x32')](_[_0x4642('0x3a')](_0x54310e[_0x4642('0x30')],_0x364839[_0x4642('0x32')]));if(_0x54310e[_0x4642('0x30')][_0x4642('0x3b')]){_0x5564cc[_0x4642('0x39')]=_[_0x4642('0x3d')](_0x5564cc['where'],{'$or':_[_0x4642('0x2b')](_0x5564cc['attributes'],function(_0xb88a93){var _0x2d456d={};_0x2d456d[_0xb88a93]={'$like':'%'+_0x54310e[_0x4642('0x30')][_0x4642('0x3b')]+'%'};return _0x2d456d;})});}if(_0x54310e['query'][_0x4642('0x5b')]){var _0x40a243=_0x54310e[_0x4642('0x30')]['$gte'][_0x4642('0x5c')](',');var _0x139a4c={};_0x139a4c[_0x40a243[0x0]]={'$gte':moment(_0x40a243[0x1])[_0x4642('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5564cc['where']=_[_0x4642('0x3d')](_0x5564cc[_0x4642('0x39')],_0x139a4c);}_0x5564cc=_['merge']({},_0x5564cc,_0x54310e['options']);return _0x4ee648[_0x4642('0x5a')](_0x5564cc);}})[_0x4642('0x26')](function(_0x40d9d0){if(_0x40d9d0){_0x2eeda6=_0x40d9d0[_0x4642('0x36')];if(!_0x54310e[_0x4642('0x30')]['hasOwnProperty'](_0x4642('0x56'))){_0x5564cc['limit']=qs['limit'](_0x54310e[_0x4642('0x30')][_0x4642('0x37')]);_0x5564cc[_0x4642('0x1f')]=qs[_0x4642('0x1f')](_0x54310e['query'][_0x4642('0x1f')]);}return _0x4ee648['getMessages'](_0x5564cc);}})[_0x4642('0x26')](function(_0xae3ec2){if(_0xae3ec2){return _0xae3ec2?{'count':_0x2eeda6,'rows':_0xae3ec2}:null;}})['then'](respondWithResult(_0x4280f8,null))[_0x4642('0x41')](handleError(_0x4280f8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1d375e1..0953cf8 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 _0x2a92=['hook','exports','events','../../mysqldb','ChatGroup','emit','hasOwnProperty'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x2a92,0x9c));var _0x22a9=function(_0x276ab9,_0x13fc29){_0x276ab9=_0x276ab9-0x0;var _0x58317d=_0x2a92[_0x276ab9];return _0x58317d;};'use strict';var EventEmitter=require(_0x22a9('0x0'));var ChatGroup=require(_0x22a9('0x1'))['db'][_0x22a9('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49bb9f){return function(_0x1f0012,_0x81486f,_0x3e4630){ChatGroupEvents[_0x22a9('0x3')](_0x49bb9f+':'+_0x1f0012['id'],_0x1f0012);ChatGroupEvents[_0x22a9('0x3')](_0x49bb9f,_0x1f0012);_0x3e4630(null);};}for(var e in events){if(events[_0x22a9('0x4')](e)){var event=events[e];ChatGroup[_0x22a9('0x5')](e,emitEvent(event));}}module[_0x22a9('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x7e5b=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x275d7b,_0x115828){var _0x1a2e39=function(_0x2ddc65){while(--_0x2ddc65){_0x275d7b['push'](_0x275d7b['shift']());}};_0x1a2e39(++_0x115828);}(_0x7e5b,0x9f));var _0xb7e5=function(_0x5dc4b9,_0xac22d4){_0x5dc4b9=_0x5dc4b9-0x0;var _0x3ce689=_0x7e5b[_0x5dc4b9];return _0x3ce689;};'use strict';var EventEmitter=require(_0xb7e5('0x0'));var ChatGroup=require(_0xb7e5('0x1'))['db'][_0xb7e5('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xb7e5('0x3')](0x0);var events={'afterCreate':_0xb7e5('0x4'),'afterUpdate':_0xb7e5('0x5'),'afterDestroy':_0xb7e5('0x6')};function emitEvent(_0x3a1842){return function(_0x45d5c6,_0x5a5f75,_0x5e6c7d){ChatGroupEvents[_0xb7e5('0x7')](_0x3a1842+':'+_0x45d5c6['id'],_0x45d5c6);ChatGroupEvents[_0xb7e5('0x7')](_0x3a1842,_0x45d5c6);_0x5e6c7d(null);};}for(var e in events){if(events[_0xb7e5('0x8')](e)){var event=events[e];ChatGroup[_0xb7e5('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f18314e..5508cc6 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 _0x5154=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0xca78f1,_0x2c90c8){var _0xda435e=function(_0x375d7a){while(--_0x375d7a){_0xca78f1['push'](_0xca78f1['shift']());}};_0xda435e(++_0x2c90c8);}(_0x5154,0x102));var _0x4515=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5154[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4515('0x0'));var util=require(_0x4515('0x1'));var logger=require(_0x4515('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4515('0x3'));var rp=require(_0x4515('0x4'));var fs=require('fs');var path=require(_0x4515('0x5'));var rimraf=require(_0x4515('0x6'));var config=require(_0x4515('0x7'));var attributes=require(_0x4515('0x8'));module[_0x4515('0x9')]=function(_0x167a8d,_0x505f25){return _0x167a8d[_0x4515('0xa')](_0x4515('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd33=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0xb14376,_0x5b0bf2){var _0x232f52=function(_0x29342e){while(--_0x29342e){_0xb14376['push'](_0xb14376['shift']());}};_0x232f52(++_0x5b0bf2);}(_0xbd33,0xb5));var _0x3bd3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd33[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3bd3('0x0'));var util=require(_0x3bd3('0x1'));var logger=require(_0x3bd3('0x2'))(_0x3bd3('0x3'));var moment=require(_0x3bd3('0x4'));var BPromise=require('bluebird');var rp=require(_0x3bd3('0x5'));var fs=require('fs');var path=require(_0x3bd3('0x6'));var rimraf=require(_0x3bd3('0x7'));var config=require(_0x3bd3('0x8'));var attributes=require(_0x3bd3('0x9'));module[_0x3bd3('0xa')]=function(_0x4be3d0,_0x3bfdd8){return _0x4be3d0[_0x3bd3('0xb')](_0x3bd3('0xc'),attributes,{'tableName':_0x3bd3('0xd'),'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 d4fabac..ac240a7 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 _0x04f1=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x04f1,0x92));var _0x104f=function(_0x312fb3,_0x109785){_0x312fb3=_0x312fb3-0x0;var _0x3d8890=_0x04f1[_0x312fb3];return _0x3d8890;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var moment=require(_0x104f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x104f('0x3'));var db=require(_0x104f('0x4'))['db'];var utils=require(_0x104f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x104f('0x6')]({'port':0x232a});config[_0x104f('0x7')]=_[_0x104f('0x8')](config[_0x104f('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x104f('0x9'))(new Redis(config[_0x104f('0x7')]));require(_0x104f('0xa'))[_0x104f('0xb')](socket);function respondWithRpcPromise(_0x4f3c6b,_0x5d11f3,_0x424526){return new BPromise(function(_0x2635d6,_0x1e5996){return client[_0x104f('0xc')](_0x4f3c6b,_0x424526)[_0x104f('0xd')](function(_0x2dcd68){logger[_0x104f('0xe')](_0x104f('0xf'),_0x5d11f3,_0x104f('0x10'));logger[_0x104f('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5d11f3,_0x104f('0x10'),JSON[_0x104f('0x12')](_0x2dcd68));if(_0x2dcd68[_0x104f('0x13')]){if(_0x2dcd68[_0x104f('0x13')][_0x104f('0x14')]===0x1f4){logger[_0x104f('0x13')](_0x104f('0xf'),_0x5d11f3,_0x2dcd68[_0x104f('0x13')][_0x104f('0x15')]);return _0x1e5996(_0x2dcd68[_0x104f('0x13')][_0x104f('0x15')]);}logger[_0x104f('0x13')](_0x104f('0xf'),_0x5d11f3,_0x2dcd68[_0x104f('0x13')]['message']);return _0x2635d6(_0x2dcd68[_0x104f('0x13')][_0x104f('0x15')]);}else{logger[_0x104f('0xe')](_0x104f('0xf'),_0x5d11f3,'request\x20sent');_0x2635d6(_0x2dcd68[_0x104f('0x16')][_0x104f('0x15')]);}})['catch'](function(_0x3c54a0){logger[_0x104f('0x13')]('ChatGroup,\x20%s,\x20%s',_0x5d11f3,_0x3c54a0);_0x1e5996(_0x3c54a0);});});} \ No newline at end of file +var _0xe5d5=['ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x57a845,_0x590342){var _0x42474d=function(_0x33b4ac){while(--_0x33b4ac){_0x57a845['push'](_0x57a845['shift']());}};_0x42474d(++_0x590342);}(_0xe5d5,0x156));var _0x5e5d=function(_0x2e8a43,_0x4d0910){_0x2e8a43=_0x2e8a43-0x0;var _0x4c4ea3=_0xe5d5[_0x2e8a43];return _0x4c4ea3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e5d('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e5d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e5d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e5d('0x3'))(_0x5e5d('0x4'));var config=require(_0x5e5d('0x5'));var jayson=require(_0x5e5d('0x6'));var client=jayson[_0x5e5d('0x7')][_0x5e5d('0x8')]({'port':0x232a});config[_0x5e5d('0x9')]=_[_0x5e5d('0xa')](config[_0x5e5d('0x9')],{'host':_0x5e5d('0xb'),'port':0x18eb});var socket=require(_0x5e5d('0xc'))(new Redis(config[_0x5e5d('0x9')]));require(_0x5e5d('0xd'))[_0x5e5d('0xe')](socket);function respondWithRpcPromise(_0x59917b,_0x32d041,_0x596a2c){return new BPromise(function(_0x3a5693,_0x17aa36){return client['request'](_0x59917b,_0x596a2c)[_0x5e5d('0xf')](function(_0x29ef35){logger[_0x5e5d('0x10')](_0x5e5d('0x11'),_0x32d041,'request\x20sent');logger['debug'](_0x5e5d('0x12'),_0x32d041,_0x5e5d('0x13'),JSON['stringify'](_0x29ef35));if(_0x29ef35[_0x5e5d('0x14')]){if(_0x29ef35[_0x5e5d('0x14')]['code']===0x1f4){logger[_0x5e5d('0x14')](_0x5e5d('0x11'),_0x32d041,_0x29ef35['error']['message']);return _0x17aa36(_0x29ef35['error'][_0x5e5d('0x15')]);}logger[_0x5e5d('0x14')](_0x5e5d('0x11'),_0x32d041,_0x29ef35[_0x5e5d('0x14')]['message']);return _0x3a5693(_0x29ef35[_0x5e5d('0x14')][_0x5e5d('0x15')]);}else{logger[_0x5e5d('0x10')](_0x5e5d('0x11'),_0x32d041,_0x5e5d('0x13'));_0x3a5693(_0x29ef35[_0x5e5d('0x16')][_0x5e5d('0x15')]);}})[_0x5e5d('0x17')](function(_0x4ae3f3){logger[_0x5e5d('0x14')](_0x5e5d('0x11'),_0x32d041,_0x4ae3f3);_0x17aa36(_0x4ae3f3);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2409d71..3bdd6cf 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 _0x694d=['./chatGroup.events','save','remove','emit','register','length','chatGroup:'];(function(_0x5e531f,_0x1ac0e3){var _0x233505=function(_0x9238){while(--_0x9238){_0x5e531f['push'](_0x5e531f['shift']());}};_0x233505(++_0x1ac0e3);}(_0x694d,0x19d));var _0xd694=function(_0x189acb,_0x46d34e){_0x189acb=_0x189acb-0x0;var _0x2a2100=_0x694d[_0x189acb];return _0x2a2100;};'use strict';var ChatGroupEvents=require(_0xd694('0x0'));var events=[_0xd694('0x1'),_0xd694('0x2'),'update'];function createListener(_0x26260c,_0x20f256){return function(_0x436189){_0x20f256[_0xd694('0x3')](_0x26260c,_0x436189);};}function removeListener(_0x310d8f,_0x255e14){return function(){ChatGroupEvents['removeListener'](_0x310d8f,_0x255e14);};}exports[_0xd694('0x4')]=function(_0x4b2f2a){for(var _0x2e1833=0x0,_0x47a1ae=events[_0xd694('0x5')];_0x2e1833<_0x47a1ae;_0x2e1833++){var _0x1c97d3=events[_0x2e1833];var _0x4ae0c9=createListener(_0xd694('0x6')+_0x1c97d3,_0x4b2f2a);ChatGroupEvents['on'](_0x1c97d3,_0x4ae0c9);}}; \ No newline at end of file +var _0x2846=['removeListener','length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x378ec7,_0x5137d3){var _0x10dc21=function(_0x4f965e){while(--_0x4f965e){_0x378ec7['push'](_0x378ec7['shift']());}};_0x10dc21(++_0x5137d3);}(_0x2846,0x1d8));var _0x6284=function(_0x6837a4,_0x5efd2b){_0x6837a4=_0x6837a4-0x0;var _0x3b1120=_0x2846[_0x6837a4];return _0x3b1120;};'use strict';var ChatGroupEvents=require(_0x6284('0x0'));var events=['save',_0x6284('0x1'),_0x6284('0x2')];function createListener(_0x4f64fe,_0x5027dc){return function(_0x53cb25){_0x5027dc[_0x6284('0x3')](_0x4f64fe,_0x53cb25);};}function removeListener(_0x27e134,_0x2e15d8){return function(){ChatGroupEvents[_0x6284('0x4')](_0x27e134,_0x2e15d8);};}exports['register']=function(_0x22ea51){for(var _0x4ba566=0x0,_0x3a3ad9=events[_0x6284('0x5')];_0x4ba566<_0x3a3ad9;_0x4ba566++){var _0x272f4=events[_0x4ba566];var _0xf2f8ca=createListener(_0x6284('0x6')+_0x272f4,_0x22ea51);ChatGroupEvents['on'](_0x272f4,_0xf2f8ca);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d6d6bf0..ba109ef 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 _0x3138=['../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','getMessages','post','/:id/members','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x9e12f6,_0x49e4c7){var _0x1906fb=function(_0x4a4aa1){while(--_0x4a4aa1){_0x9e12f6['push'](_0x9e12f6['shift']());}};_0x1906fb(++_0x49e4c7);}(_0x3138,0xa9));var _0x8313=function(_0x6b679,_0x340f42){_0x6b679=_0x6b679-0x0;var _0x2a8994=_0x3138[_0x6b679];return _0x2a8994;};'use strict';var multer=require(_0x8313('0x0'));var util=require(_0x8313('0x1'));var path=require(_0x8313('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8313('0x3')]();var fs_extra=require(_0x8313('0x4'));var auth=require(_0x8313('0x5'));var interaction=require(_0x8313('0x6'));var config=require(_0x8313('0x7'));var controller=require(_0x8313('0x8'));router[_0x8313('0x9')]('/',auth[_0x8313('0xa')](),controller[_0x8313('0xb')]);router['get'](_0x8313('0xc'),auth['isAuthenticated'](),controller[_0x8313('0xd')]);router[_0x8313('0x9')](_0x8313('0xe'),auth[_0x8313('0xa')](),controller[_0x8313('0xf')]);router[_0x8313('0x9')]('/:id/unread',auth[_0x8313('0xa')](),controller[_0x8313('0x10')]);router[_0x8313('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/messages',auth[_0x8313('0xa')](),controller[_0x8313('0x11')]);router['post']('/',auth[_0x8313('0xa')](),controller['create']);router[_0x8313('0x12')](_0x8313('0x13'),auth[_0x8313('0xa')](),controller['addMembers']);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8313('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8313('0x15')]);router[_0x8313('0x16')](_0x8313('0xe'),auth[_0x8313('0xa')](),controller[_0x8313('0x17')]);router[_0x8313('0x16')](_0x8313('0x13'),auth[_0x8313('0xa')](),controller['removeMembers']);module[_0x8313('0x18')]=router; \ No newline at end of file +var _0x6583=['post','create','addMembers','addMessage','put','update','delete','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/messages','getMessages'];(function(_0x24724b,_0x134d50){var _0x481080=function(_0x42e4ba){while(--_0x42e4ba){_0x24724b['push'](_0x24724b['shift']());}};_0x481080(++_0x134d50);}(_0x6583,0x167));var _0x3658=function(_0x3f4bc1,_0x15ace5){_0x3f4bc1=_0x3f4bc1-0x0;var _0x46fcf6=_0x6583[_0x3f4bc1];return _0x46fcf6;};'use strict';var multer=require(_0x3658('0x0'));var util=require(_0x3658('0x1'));var path=require(_0x3658('0x2'));var timeout=require(_0x3658('0x3'));var express=require(_0x3658('0x4'));var router=express[_0x3658('0x5')]();var fs_extra=require(_0x3658('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3658('0x7'));var config=require(_0x3658('0x8'));var controller=require(_0x3658('0x9'));router[_0x3658('0xa')]('/',auth[_0x3658('0xb')](),controller[_0x3658('0xc')]);router[_0x3658('0xa')](_0x3658('0xd'),auth[_0x3658('0xb')](),controller['describe']);router[_0x3658('0xa')](_0x3658('0xe'),auth[_0x3658('0xb')](),controller[_0x3658('0xf')]);router['get']('/:id/unread',auth[_0x3658('0xb')](),controller['getUnread']);router[_0x3658('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x3658('0x10')]);router[_0x3658('0xa')](_0x3658('0x11'),auth[_0x3658('0xb')](),controller[_0x3658('0x12')]);router[_0x3658('0x13')]('/',auth[_0x3658('0xb')](),controller[_0x3658('0x14')]);router['post']('/:id/members',auth['isAuthenticated'](),controller[_0x3658('0x15')]);router[_0x3658('0x13')](_0x3658('0x11'),auth[_0x3658('0xb')](),controller[_0x3658('0x16')]);router[_0x3658('0x17')](_0x3658('0xe'),auth[_0x3658('0xb')](),controller[_0x3658('0x18')]);router[_0x3658('0x19')](_0x3658('0xe'),auth[_0x3658('0xb')](),controller['destroy']);router[_0x3658('0x19')]('/:id/members',auth[_0x3658('0xb')](),controller[_0x3658('0x1a')]);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 fc736f2..a4e37f8 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 _0xd757=['STRING','DATE','long','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','thumb','star','TEXT'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xd757,0x1e5));var _0x7d75=function(_0x218646,_0x449eed){_0x218646=_0x218646-0x0;var _0x4ae622=_0xd757[_0x218646];return _0x4ae622;};'use strict';var Sequelize=require(_0x7d75('0x0'));module[_0x7d75('0x1')]={'closed':{'type':Sequelize[_0x7d75('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7d75('0x3')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x7d75('0x4')),'defaultValue':_0x7d75('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x7d75('0x6')]},'mailTranscript':{'type':Sequelize[_0x7d75('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7d75('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7d75('0x7')]},'note':{'type':Sequelize[_0x7d75('0x7')]},'browserName':{'type':Sequelize[_0x7d75('0x7')]},'browserVersion':{'type':Sequelize[_0x7d75('0x7')]},'osName':{'type':Sequelize[_0x7d75('0x7')]},'osVersion':{'type':Sequelize[_0x7d75('0x7')]},'deviceModel':{'type':Sequelize[_0x7d75('0x7')]},'deviceVendor':{'type':Sequelize[_0x7d75('0x7')]},'deviceType':{'type':Sequelize[_0x7d75('0x7')]},'referer':{'type':Sequelize[_0x7d75('0x6')]},'customerIp':{'type':Sequelize[_0x7d75('0x7')]},'formData':{'type':Sequelize[_0x7d75('0x6')](_0x7d75('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7d75('0xa')]('in',_0x7d75('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7d75('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7d75('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x7d75('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x63c6=['ENUM','star','thumb','TEXT','STRING','DATE','long','sequelize','exports'];(function(_0x2c08ec,_0x432d3f){var _0x205726=function(_0x3cd3b2){while(--_0x3cd3b2){_0x2c08ec['push'](_0x2c08ec['shift']());}};_0x205726(++_0x432d3f);}(_0x63c6,0xbb));var _0x663c=function(_0x123824,_0x52a5c7){_0x123824=_0x123824-0x0;var _0x1421eb=_0x63c6[_0x123824];return _0x1421eb;};'use strict';var Sequelize=require(_0x663c('0x0'));module[_0x663c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x663c('0x2')](_0x663c('0x3'),_0x663c('0x4')),'defaultValue':_0x663c('0x3')},'ratingMessage':{'type':Sequelize[_0x663c('0x5')]},'pathTranscript':{'type':Sequelize[_0x663c('0x5')]},'mailTranscript':{'type':Sequelize[_0x663c('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x663c('0x7')]},'disposition':{'type':Sequelize[_0x663c('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x663c('0x6')]},'note':{'type':Sequelize[_0x663c('0x6')]},'browserName':{'type':Sequelize[_0x663c('0x6')]},'browserVersion':{'type':Sequelize[_0x663c('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x663c('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x663c('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x663c('0x5')]},'customerIp':{'type':Sequelize[_0x663c('0x6')]},'formData':{'type':Sequelize[_0x663c('0x5')](_0x663c('0x8'))},'read1stAt':{'type':Sequelize[_0x663c('0x7')]},'lastMsgAt':{'type':Sequelize[_0x663c('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x663c('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x663c('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x663c('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 930f686..d7df2d3 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 _0xd2ea=['Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','ChatInteractionId','filter','$gte','findAll','getMyMessages','include','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','server','tmp','files','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','client','http','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','count','limit','set','update','then','destroy','name','send','render','merge','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','unmanaged','total','closed','UserId','disposition','abandoned','answered','index','ChatInteraction','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','c.email','Contact.phone','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','rawAttributes','intersection','options','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut'];(function(_0x30be1f,_0x593715){var _0x221382=function(_0xbbf260){while(--_0xbbf260){_0x30be1f['push'](_0x30be1f['shift']());}};_0x221382(++_0x593715);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2f5daf,_0x8a2193){_0x2f5daf=_0x2f5daf-0x0;var _0xd1193f=_0xd2ea[_0x2f5daf];return _0xd1193f;};'use strict';var rimraf=require(_0xad2e('0x0'));var zipdir=require(_0xad2e('0x1'));var rp=require(_0xad2e('0x2'));var moment=require(_0xad2e('0x3'));var BPromise=require(_0xad2e('0x4'));var Mustache=require('mustache');var util=require(_0xad2e('0x5'));var path=require(_0xad2e('0x6'));var ejs=require(_0xad2e('0x7'));var fs=require('fs');var _=require(_0xad2e('0x8'));var squel=require(_0xad2e('0x9'));var Redis=require(_0xad2e('0xa'));var qs=require(_0xad2e('0xb'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xad2e('0xc'));var logger=require(_0xad2e('0xd'))(_0xad2e('0xe'));var config=require('../../config/environment');var db=require(_0xad2e('0xf'))['db'];config[_0xad2e('0x10')]=_['defaults'](config[_0xad2e('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0x11'))(new Redis(config[_0xad2e('0x10')]));require(_0xad2e('0x12'))[_0xad2e('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0xad2e('0x14')]['http']({'port':0x232b});var client9004=jayson[_0xad2e('0x14')][_0xad2e('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x433696,_0x42e2f2,_0x59a342,_0x27fb5a){return new BPromise(function(_0x59201f,_0x1a91ce){var _0x5772f0=_0x27fb5a||client;return _0x5772f0['request'](_0x433696,_0x59a342)['then'](function(_0x5c96a7){logger[_0xad2e('0x16')](_0xad2e('0x17'),_0x42e2f2,_0xad2e('0x18'));logger[_0xad2e('0x19')](_0xad2e('0x1a'),_0x42e2f2,_0xad2e('0x18'),JSON[_0xad2e('0x1b')](_0x5c96a7));if(_0x5c96a7[_0xad2e('0x1c')]){if(_0x5c96a7[_0xad2e('0x1c')][_0xad2e('0x1d')]===0x1f4){logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x5c96a7[_0xad2e('0x1c')][_0xad2e('0x1e')]);return _0x1a91ce(_0x5c96a7[_0xad2e('0x1c')]['message']);}logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x5c96a7['error']['message']);return _0x59201f(_0x5c96a7['error']['message']);}else{logger[_0xad2e('0x16')](_0xad2e('0x17'),_0x42e2f2,_0xad2e('0x18'));_0x59201f(_0x5c96a7[_0xad2e('0x1f')][_0xad2e('0x1e')]);}})[_0xad2e('0x20')](function(_0x29dc4f){logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x29dc4f);_0x1a91ce(_0x29dc4f);});});}function respondWithStatusCode(_0x154d54,_0x40e1e4){_0x40e1e4=_0x40e1e4||0xcc;return function(_0x142631){if(_0x142631){return _0x154d54[_0xad2e('0x21')](_0x40e1e4);}return _0x154d54[_0xad2e('0x22')](_0x40e1e4)[_0xad2e('0x23')]();};}function respondWithResult(_0x2e1c95,_0x59630b){_0x59630b=_0x59630b||0xc8;return function(_0x2e727c){if(_0x2e727c){return _0x2e1c95[_0xad2e('0x22')](_0x59630b)[_0xad2e('0x24')](_0x2e727c);}};}function respondWithFilteredResult(_0x350c66,_0x2f9370){return function(_0x58acc8){if(_0x58acc8){var _0x1161d5=typeof _0x2f9370[_0xad2e('0x25')]===_0xad2e('0x26')&&typeof _0x2f9370['limit']===_0xad2e('0x26');var _0x5d675f=_0x58acc8[_0xad2e('0x27')];var _0x28ef72=_0x1161d5?0x0:_0x2f9370[_0xad2e('0x25')];var _0x11bfa9=_0x1161d5?_0x58acc8[_0xad2e('0x27')]:_0x2f9370[_0xad2e('0x25')]+_0x2f9370[_0xad2e('0x28')];var _0x454c04;if(_0x11bfa9>=_0x5d675f){_0x11bfa9=_0x5d675f;_0x454c04=0xc8;}else{_0x454c04=0xce;}_0x350c66[_0xad2e('0x22')](_0x454c04);return _0x350c66[_0xad2e('0x29')]('Content-Range',_0x28ef72+'-'+_0x11bfa9+'/'+_0x5d675f)[_0xad2e('0x24')](_0x58acc8);}return null;};}function saveUpdates(_0xfd2087){return function(_0x2a0dc7){if(_0x2a0dc7){return _0x2a0dc7[_0xad2e('0x2a')](_0xfd2087)[_0xad2e('0x2b')](function(_0x9b4a23){return _0x9b4a23;});}return null;};}function removeEntity(_0x409f58){return function(_0x3e3d86){if(_0x3e3d86){return _0x3e3d86[_0xad2e('0x2c')]()[_0xad2e('0x2b')](function(){_0x409f58[_0xad2e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3099fd){return function(_0x55e1dc){if(!_0x55e1dc){_0x3099fd[_0xad2e('0x21')](0x194);}return _0x55e1dc;};}function handleError(_0x3a6419,_0x5ac436){_0x5ac436=_0x5ac436||0x1f4;return function(_0x19d0fa){logger[_0xad2e('0x1c')](_0x19d0fa['stack']);if(_0x19d0fa[_0xad2e('0x2d')]){delete _0x19d0fa[_0xad2e('0x2d')];}_0x3a6419['status'](_0x5ac436)[_0xad2e('0x2e')](_0x19d0fa);};}function getMustacheRender(_0x100b35,_0x569b9c){return Mustache[_0xad2e('0x2f')](_0x100b35,_[_0xad2e('0x30')](_0x569b9c[_0xad2e('0x31')],{'contact':_0x569b9c[_0xad2e('0x32')],'message':_0x569b9c[_0xad2e('0x1e')],'agent':_0x569b9c[_0xad2e('0x33')],'interaction':_0x569b9c[_0xad2e('0x34')],'account':_0x569b9c['account']}))||'';}function getInteractionUsers(_0x41a022,_0x5b4386){return new BPromise(function(_0x49db79,_0x161402){try{if(_0x5b4386[_0x41a022['id']]){_0x41a022[_0xad2e('0x35')]=_[_0xad2e('0x36')](_0x5b4386[_0x41a022['id']],function(_0x14d8d6){return{'id':_0x14d8d6['id'],'fullname':_0x14d8d6[_0xad2e('0x37')]};});}}catch(_0xf4ae70){_0x161402(_0xf4ae70);}_0x49db79(_0x41a022);});}function getInteractionTags(_0x4fe4f6,_0x5d6ac1){return new BPromise(function(_0x924f10,_0x4b53d6){try{if(_0x4fe4f6[_0xad2e('0x38')]){_0x4fe4f6[_0xad2e('0x39')]=[];_0x4fe4f6[_0xad2e('0x38')][_0xad2e('0x3a')](',')[_0xad2e('0x3b')](function(_0x5d55f9){_0x4fe4f6[_0xad2e('0x39')][_0xad2e('0x3c')](_0x5d6ac1[_0x5d55f9]);});}delete _0x4fe4f6['TagIds'];}catch(_0x596eee){_0x4b53d6(_0x596eee);}_0x924f10(_0x4fe4f6);});}function updateChatInteraction(_0x5ba338,_0x274fd8,_0x54dac3){return new BPromise(function(_0x5f29a5,_0x2d0018){return getInteractionUsers(_0x5ba338,_0x54dac3)[_0xad2e('0x2b')](function(_0x271a49){return getInteractionTags(_0x271a49,_0x274fd8);})[_0xad2e('0x2b')](function(_0x6f4fbc){return getStateInteraction(_0x6f4fbc);})[_0xad2e('0x2b')](function(_0x382665){_0x5f29a5(_0x382665);})['catch'](function(_0xec9e1a){_0x2d0018(_0xec9e1a);});});}function getStateInteraction(_0x341f51){return new BPromise(function(_0x46684d){_0x341f51[_0xad2e('0x3d')]=0x0;_0x341f51[_0xad2e('0x3e')]=0x0;_0x341f51['answered']=0x0;_0x341f51[_0xad2e('0x3f')]=0x0;_0x341f51['abandoned']=0x0;_0x341f51[_0xad2e('0x40')]=0x0;if(!_0x341f51[_0xad2e('0x41')]&&!_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x3d')]+=0x1;}if(!_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x3e')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51[_0xad2e('0x3d')]-=0x1;}}if(_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x43')]===_0xad2e('0x44')){_0x341f51[_0xad2e('0x44')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51[_0xad2e('0x3d')]-=0x1;}}else if(_0x341f51[_0xad2e('0x41')]&&!_0x341f51[_0xad2e('0x42')]&&_0x341f51[_0xad2e('0x43')]){_0x341f51[_0xad2e('0x3f')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51['waiting']-=0x1;}}else if(_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x45')]+=0x1;if(_0x341f51[_0xad2e('0x3e')]){_0x341f51[_0xad2e('0x3e')]-=0x1;}}_0x341f51[_0xad2e('0x40')]+=0x1;_0x46684d(_0x341f51);});}exports[_0xad2e('0x46')]=function(_0x4c99ec,_0x15e253){var _0x579a26={},_0x1f2f49={},_0x2ad66e={'count':0x0,'rows':[]};var _0x36b103=_[_0xad2e('0x36')](db[_0xad2e('0x47')]['rawAttributes'],function(_0xf80dd8){return{'name':_0xf80dd8[_0xad2e('0x48')],'type':_0xf80dd8[_0xad2e('0x49')][_0xad2e('0x4a')]};});_0x1f2f49[_0xad2e('0x4b')]=_['map'](_0x36b103,_0xad2e('0x2d'));_0x1f2f49[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x4c99ec[_0xad2e('0x4c')]);_0x1f2f49['filters']=_['intersection'](_0x1f2f49[_0xad2e('0x4b')],_0x1f2f49[_0xad2e('0x4c')]);_0x579a26['attributes']=_['intersection'](_0x1f2f49[_0xad2e('0x4b')],qs['fields'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x4e')]));_0x579a26['attributes']=_0x579a26[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x579a26[_0xad2e('0x4f')]:_0x1f2f49[_0xad2e('0x4b')];if(!_0x4c99ec['query']['hasOwnProperty'](_0xad2e('0x51'))){_0x579a26[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x28')]);_0x579a26[_0xad2e('0x25')]=qs[_0xad2e('0x25')](_0x4c99ec[_0xad2e('0x4c')]['offset']);}_0x579a26[_0xad2e('0x52')]=qs['sort'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x53')]);_0x579a26[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x4c99ec[_0xad2e('0x4c')],_0x1f2f49[_0xad2e('0x55')]),_0x36b103);var _0x4aeb4a=[];var _0x411956=squel['select']()[_0xad2e('0x57')]('id')[_0xad2e('0x57')](_0xad2e('0x2d'))[_0xad2e('0x57')]('color')[_0xad2e('0x58')](_0xad2e('0x59'));var _0x56e633=squel[_0xad2e('0x5a')]()['field'](_0xad2e('0x5b'))[_0xad2e('0x57')](_0xad2e('0x5c'))[_0xad2e('0x57')](_0xad2e('0x5d'))[_0xad2e('0x58')](_0xad2e('0x5e'),'ui')[_0xad2e('0x5f')](_0xad2e('0x60'),'u','u.id\x20=\x20ui.UserId');var _0xe2d4ac=squel[_0xad2e('0x5a')]()[_0xad2e('0x58')](_0xad2e('0x61'),'i')['left_join']('cm_contacts','c',_0xad2e('0x62'))[_0xad2e('0x5f')](_0xad2e('0x60'),'o',_0xad2e('0x63'))[_0xad2e('0x5f')](_0xad2e('0x64'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xad2e('0x5f')](_0xad2e('0x65'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xad2e('0x5f')](_0xad2e('0x66'),'it',_0xad2e('0x67'))[_0xad2e('0x5f')](_0xad2e('0x59'),'t',_0xad2e('0x68'));var _0x1ce266=squel[_0xad2e('0x69')]();var _0x745c47=[];var _0x124eaf=squel['expr']();var _0x583c12;if(_0x4c99ec[_0xad2e('0x4c')]['search']){_0x583c12=as['parseSearch'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x6a')]);var _0x3bfa74=_0x583c12['sqlOperator'];for(var _0x114ed5=0x0;_0x114ed5<_0x583c12[_0xad2e('0x6b')][_0xad2e('0x50')];_0x114ed5++){var _0x470bda=_0x583c12[_0xad2e('0x6b')][_0x114ed5];var _0x5d538c='i';var _0x22554f=_['find'](_0x36b103,['name',_0x470bda['field']]);if(!_0x22554f){switch(_0x470bda['field']){case _0xad2e('0x6c'):if(_0x470bda[_0xad2e('0x6d')]==0x1){_0xe2d4ac[_0xad2e('0x6e')]('`'+_0x470bda[_0xad2e('0x57')]+_0xad2e('0x6f'));}else{_0xe2d4ac[_0xad2e('0x6e')]('`'+_0x470bda[_0xad2e('0x57')]+_0xad2e('0x70'));}break;case _0xad2e('0x71'):if(_0x470bda[_0xad2e('0x72')]===_0xad2e('0x73')){if(_0x470bda['value'][_0xad2e('0x3a')]('\x20')[_0xad2e('0x50')]>0x1){_0x1ce266[_0x3bfa74]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x470bda[_0xad2e('0x6d')]),null);}else{var _0x49a7d9='%'+_0x470bda[_0xad2e('0x6d')]+'%';_0x1ce266[_0x3bfa74](_0xad2e('0x74'),_0x49a7d9,_0x49a7d9,_0x49a7d9);}}else{_0x22554f=_[_0xad2e('0x75')](_0x36b103,[_0xad2e('0x2d'),_0xad2e('0x76')]);_0x470bda[_0xad2e('0x57')]=_0xad2e('0x76');_0x46bf5e=as[_0xad2e('0x77')](_0x5d538c,_0x22554f['type'],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e['value']['start'],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}break;case'Tag':var _0x33846a=_0x470bda[_0xad2e('0x6d')][_0xad2e('0x3a')](',')['map'](function(_0x1e5f05){return Number(_0x1e5f05);});_0x33846a['forEach'](function(_0x1469a2){_0x124eaf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1469a2+',%');});_0x745c47=_[_0xad2e('0x79')](_0x745c47,_0x33846a);break;case _0xad2e('0x7a'):if(_0x470bda[_0xad2e('0x72')]===_0xad2e('0x73')){_0x1ce266[_0x3bfa74](_0xad2e('0x7b'),'%'+_0x470bda[_0xad2e('0x6d')]+'%',null);}else{_0x22554f=_['find'](_0x36b103,['name',_0xad2e('0x42')]);_0x470bda[_0xad2e('0x57')]=_0xad2e('0x42');_0x46bf5e=as[_0xad2e('0x77')](_0x5d538c,_0x22554f['type'],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x7c')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}break;case _0xad2e('0x31'):_0x46bf5e=as[_0xad2e('0x77')]('me',null,_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')]['start'],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);break;}}else{var _0x46bf5e=as['buildExpression'](_0x5d538c,_0x22554f[_0xad2e('0x49')],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x7c')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}}}else{var _0x4cf84e=_(_0x4c99ec['query'])['keys']()['map'](function(_0xa426c8){return _[_0xad2e('0x7d')](_0x36b103,['name',_0xa426c8])?_0xa426c8:undefined;})[_0xad2e('0x7e')]()[_0xad2e('0x6d')]();if(!_[_0xad2e('0x7f')](_0x4cf84e)){_0x4cf84e[_0xad2e('0x3b')](function(_0x13491c){if(_0x13491c===_0xad2e('0x80')){_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x81'),[]['concat'](_0x4c99ec['query'][_0x13491c]));}else if(_0x13491c==='createdAt'){var _0x4eb716=JSON['parse'](_0x4c99ec[_0xad2e('0x4c')][_0x13491c])['$gte'];var _0x3bdc76=JSON[_0xad2e('0x82')](_0x4c99ec[_0xad2e('0x4c')][_0x13491c])['$lte'];_0xe2d4ac['where'](_0xad2e('0x83'),_0x4eb716,_0x3bdc76);}else{if(_0x4c99ec['query'][_0x13491c]==='null'){_0xe2d4ac[_0xad2e('0x54')]('i.'+_0x13491c+_0xad2e('0x84'));}else{_0xe2d4ac[_0xad2e('0x54')]('i.'+_0x13491c+_0xad2e('0x85'),_0x4c99ec[_0xad2e('0x4c')][_0x13491c]);}}});}if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x86')]){if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x86')]==0x1){_0xe2d4ac[_0xad2e('0x6e')]('`unreadMessages`\x20=\x200');}else{_0xe2d4ac['having'](_0xad2e('0x87'));}}if(_0x4c99ec[_0xad2e('0x4c')]['tag']){_0x745c47=_[_0xad2e('0x88')](_0x4c99ec[_0xad2e('0x4c')]['tag'])?_0x4c99ec['query'][_0xad2e('0x89')]:new Array(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x89')]);_0x745c47[_0xad2e('0x3b')](function(_0x11421f){_0x124eaf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x11421f+',%');});}if(_0x4c99ec[_0xad2e('0x4c')]['filter']){var _0x76b71a=_0x4c99ec[_0xad2e('0x4c')]['filter'][_0xad2e('0x8a')]('\x5c','\x5c\x5c')[_0xad2e('0x8a')](/'/g,'\x27\x27');if(qs[_0xad2e('0x8b')](_0x76b71a)){_0x1ce266['or']('i.id\x20LIKE\x20?',_0x76b71a+'%');}else{_0x1ce266['or'](_0xad2e('0x8c'),qs[_0xad2e('0x8d')](_0x76b71a))['or'](_0xad2e('0x8e'),_0x76b71a+'%');}}}_0xe2d4ac[_0xad2e('0x54')](_0x1ce266);_0xe2d4ac[_0xad2e('0x8f')]('i.id');var _0x2ea2d8={'type':db['Sequelize'][_0xad2e('0x90')][_0xad2e('0x91')],'raw':!![]};var _0x10672d=_0xe2d4ac[_0xad2e('0x92')]();_0x10672d[_0xad2e('0x57')](_0xad2e('0x93'));_0x10672d[_0xad2e('0x57')](_0xad2e('0x94'),_0xad2e('0x6c'));if(_0x579a26[_0xad2e('0x52')]){_0x579a26[_0xad2e('0x52')][_0xad2e('0x3b')](function(_0x4a7a2e){var _0x1f2c13=_0x4a7a2e[0x0]===_0xad2e('0x95')?_0x4a7a2e[0x0]:'i.'+_0x4a7a2e[0x0];_0xe2d4ac[_0xad2e('0x52')](_0x1f2c13,_0x4a7a2e[0x1]===_0xad2e('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x745c47)){_0xe2d4ac[_0xad2e('0x6e')](_0x124eaf);_0x10672d[_0xad2e('0x54')](_0xad2e('0x97'),_0x745c47);}BPromise[_0xad2e('0x98')]()['then'](function(){if(!_0x583c12){if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x80')])return;_0x10672d[_0xad2e('0x54')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x99'));return;}if(_0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9b')]!=='agent')return;return _0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9c')]({'attributes':['id'],'raw':!![]})[_0xad2e('0x2b')](function(_0xc55f6a){if(_[_0xad2e('0x7f')](_0xc55f6a)){_0x10672d[_0xad2e('0x54')](_0xad2e('0x9d'));_0xe2d4ac[_0xad2e('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x10672d[_0xad2e('0x54')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0xc55f6a,'id'));_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x81'),_[_0xad2e('0x36')](_0xc55f6a,'id'));}});})[_0xad2e('0x2b')](function(){if(_0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9b')]===_0xad2e('0x33')&&!_0x583c12&&!_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x80')])return[];return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x10672d[_0xad2e('0x9f')](),_0x2ea2d8);})['then'](function(_0x2f029b){_0x2ad66e[_0xad2e('0x27')]=_0x2f029b[_0xad2e('0x50')];if(_0x2ad66e[_0xad2e('0x27')]===0x0)return[];return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x411956[_0xad2e('0x9f')](),_0x2ea2d8)[_0xad2e('0x2b')](function(_0x35d060){_0x4aeb4a=_[_0xad2e('0xa0')](_0x35d060,'id');_0x2ea2d8=_['merge'](_0x2ea2d8,{'model':db[_0xad2e('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x4e')]){_0x579a26[_0xad2e('0x4f')]['forEach'](function(_0x3c95ac){_0xe2d4ac['field']('i.'+_0x3c95ac);});}else{_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0x94'),_0xad2e('0x6c'));_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa1'),_0xad2e('0xa2'));_0xe2d4ac[_0xad2e('0x57')]('a.mandatoryDisposition',_0xad2e('0xa3'));_0xe2d4ac[_0xad2e('0x57')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xe2d4ac[_0xad2e('0x57')]('i.*');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa4'),'Contact.firstName');_0xe2d4ac['field'](_0xad2e('0xa5'),'Contact.lastName');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa6'),'Contact.email');_0xe2d4ac[_0xad2e('0x57')]('c.phone',_0xad2e('0xa7'));_0xe2d4ac[_0xad2e('0x57')]('c.mobile','Contact.mobile');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa8'),'Contact.fax');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa9'),'Owner.fullname');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xaa'),_0xad2e('0xab'));_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xac'),'TagIds');}if(_0x579a26[_0xad2e('0x28')])_0xe2d4ac[_0xad2e('0x28')](_0x579a26[_0xad2e('0x28')]);if(_0x579a26[_0xad2e('0x25')])_0xe2d4ac['offset'](_0x579a26[_0xad2e('0x25')]);return db['sequelize'][_0xad2e('0x4c')](_0xe2d4ac['toString'](),_0x2ea2d8);})[_0xad2e('0x2b')](function(_0x3692ec){if(_0x3692ec[_0xad2e('0x50')]>0x0)_0x56e633[_0xad2e('0x54')]('ui.ChatInteractionId\x20IN\x20?',_[_0xad2e('0x36')](_0x3692ec,'id'));return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x56e633[_0xad2e('0x9f')](),_0x2ea2d8)['then'](function(_0x6a83f7){var _0x23f261=_[_0xad2e('0xad')](_0x6a83f7,'ChatInteractionId');var _0x45c0f6=[];_0x3692ec[_0xad2e('0x3b')](function(_0x10337a){_0x45c0f6['push'](updateChatInteraction(_0x10337a,_0x4aeb4a,_0x23f261));});return BPromise[_0xad2e('0xae')](_0x45c0f6);});});})[_0xad2e('0x2b')](function(_0x44708f){_0x2ad66e[_0xad2e('0xaf')]=_0x44708f;return _0x2ad66e;})[_0xad2e('0x2b')](respondWithFilteredResult(_0x15e253,_0x579a26))[_0xad2e('0x20')](handleError(_0x15e253,null));};exports['show']=function(_0x519618,_0x3f6971){var _0x114ff1={'raw':![],'where':{'id':_0x519618['params']['id']}},_0x495392={};_0x495392[_0xad2e('0x4b')]=_[_0xad2e('0x4d')](db[_0xad2e('0x47')][_0xad2e('0xb0')]);_0x495392[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x519618['query']);_0x495392['filters']=_[_0xad2e('0xb1')](_0x495392[_0xad2e('0x4b')],_0x495392[_0xad2e('0x4c')]);_0x114ff1['attributes']=_[_0xad2e('0xb1')](_0x495392[_0xad2e('0x4b')],qs[_0xad2e('0x4e')](_0x519618['query'][_0xad2e('0x4e')]));_0x114ff1['attributes']=_0x114ff1[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x114ff1[_0xad2e('0x4f')]:_0x495392[_0xad2e('0x4b')];if(_0x519618[_0xad2e('0x4c')]['includeAll']){_0x114ff1['include']=[{'all':!![]}];}_0x114ff1=_['merge']({},_0x114ff1,_0x519618[_0xad2e('0xb2')]);return db[_0xad2e('0x47')][_0xad2e('0x75')](_0x114ff1)[_0xad2e('0x2b')](handleEntityNotFound(_0x3f6971,null))['then'](respondWithResult(_0x3f6971,null))[_0xad2e('0x20')](handleError(_0x3f6971,null));};exports[_0xad2e('0xb3')]=function(_0x413235,_0x4c5051){return db[_0xad2e('0x47')]['create'](_0x413235[_0xad2e('0x31')],{})[_0xad2e('0x2b')](respondWithResult(_0x4c5051,0xc9))[_0xad2e('0x20')](handleError(_0x4c5051,null));};exports[_0xad2e('0x2a')]=function(_0x284cd4,_0x1f49ee){if(_0x284cd4[_0xad2e('0x31')]['id']){delete _0x284cd4[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x284cd4[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x1f49ee,null))[_0xad2e('0x2b')](saveUpdates(_0x284cd4[_0xad2e('0x31')],null))[_0xad2e('0x2b')](respondWithResult(_0x1f49ee,null))[_0xad2e('0x20')](handleError(_0x1f49ee,null));};exports['destroy']=function(_0x2d358a,_0x39f3d7){return db['ChatInteraction'][_0xad2e('0x75')]({'where':{'id':_0x2d358a['params']['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x39f3d7,null))[_0xad2e('0x2b')](removeEntity(_0x39f3d7,null))[_0xad2e('0x20')](handleError(_0x39f3d7,null));};exports['describe']=function(_0x5345fe,_0x40dd77){return db['ChatInteraction'][_0xad2e('0xb5')]()[_0xad2e('0x2b')](respondWithResult(_0x40dd77,null))['catch'](handleError(_0x40dd77,null));};exports[_0xad2e('0xb6')]=function(_0x271306,_0x34685b){var _0x3a447a=_0x271306['params']['id'];var _0x574f67;var _0x4ef473;var _0x843547;return db[_0xad2e('0x47')][_0xad2e('0xb7')]({'where':{'id':_0x3a447a}})[_0xad2e('0x2b')](function(_0x3a70de){_0x574f67=_0x3a70de;return db[_0xad2e('0xb8')]['findOne']({'where':{'id':_0x3a70de[_0xad2e('0x80')]},'attributes':['id','vidaooApiKey',_0xad2e('0xb9'),_0xad2e('0xba'),_0xad2e('0xbb'),_0xad2e('0xbc')],'raw':!![]});})[_0xad2e('0x2b')](function(_0x2fe953){if(_0x2fe953&&_0x2fe953[_0xad2e('0xbd')]&&_0x2fe953[_0xad2e('0xb9')]){_0x4ef473=_0x2fe953;var _0x4a14de={'interaction':{'id':_0x3a447a},'agent':{'id':_0x271306['user']['id'],'name':_0x271306[_0xad2e('0x9a')][_0xad2e('0x2d')],'fullname':_0x271306['user'][_0xad2e('0x37')],'email':_0x271306[_0xad2e('0x9a')][_0xad2e('0xbe')]},'contact':_0x271306[_0xad2e('0x31')][_0xad2e('0x32')],'account':_0x271306[_0xad2e('0x31')]['account']};var _0x528e42={'rejectUnauthorized':![],'method':_0xad2e('0xbf'),'url':_0xad2e('0xc0'),'headers':{'X-APIKEY':_0x2fe953[_0xad2e('0xbd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x271306['user']['email']],'buttons':null,'topic':_0x4ef473[_0xad2e('0xba')],'note':_[_0xad2e('0xc1')](_0x4ef473[_0xad2e('0xbb')])?null:getMustacheRender(_0x4ef473[_0xad2e('0xbb')],_0x4a14de),'metadata':null},'redirect':_0xad2e('0xc2'),'json':!![]};try{if(!_[_0xad2e('0xc1')](_0x4ef473[_0xad2e('0xbc')])){var _0xf710d=getMustacheRender(_0x4ef473[_0xad2e('0xbc')],_0x4a14de);var _0x2a59af=JSON['parse'](_0xf710d);_0x528e42['body'][_0xad2e('0xc3')]=_0x2a59af;}}catch(_0x447f04){throw new db[(_0xad2e('0xc4'))][(_0xad2e('0xc5'))](_0xad2e('0xc6'));}return rp(_0x528e42);}else{throw new db['Sequelize'][(_0xad2e('0xc5'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x529069){_0x843547=_0x529069;if(_0x843547['id']){var _0x209d06={'body':_0x843547[_0xad2e('0xc7')],'ChatWebsiteId':_0x4ef473['id'],'ChatInteractionId':_0x574f67['id'],'direction':'out','UserId':_0x271306['user']['id']};return db[_0xad2e('0xc8')][_0xad2e('0xb3')](_0x209d06,{});}else{throw new db['Sequelize'][(_0xad2e('0xc5'))](_0xad2e('0xc9'));}})[_0xad2e('0x2b')](function(){return _0x574f67[_0xad2e('0xca')]({'vidaooSessionId':_0x843547['id']});})[_0xad2e('0x2b')](respondWithResult(_0x34685b,null))['catch'](handleError(_0x34685b,null));};exports[_0xad2e('0xcb')]=function(_0x3b2c9a,_0x1f7222){if(_0x3b2c9a[_0xad2e('0x31')]['id']){delete _0x3b2c9a[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')]['find']({'where':{'id':_0x3b2c9a[_0xad2e('0xb4')]['id']},'include':[{'model':db[_0xad2e('0xcc')],'as':'Contact'}]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1f7222,null))['then'](saveUpdates(_0x3b2c9a[_0xad2e('0x31')],null))[_0xad2e('0x2b')](respondWithResult(_0x1f7222,null))[_0xad2e('0x20')](handleError(_0x1f7222,null));};exports[_0xad2e('0xcd')]=function(_0x5888fb,_0x1c4530){if(_0x5888fb[_0xad2e('0x31')]['id']){delete _0x5888fb[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x5888fb[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](function(_0x1afe03){if(!_0x1afe03){logger[_0xad2e('0x1c')](_0xad2e('0xce'),_0xad2e('0xcd'),0x194,_0xad2e('0xcf'));_0x1c4530[_0xad2e('0x21')](0x194);}else{if(_0x1afe03[_0xad2e('0x42')]){throw new db[(_0xad2e('0xc4'))][(_0xad2e('0xc5'))](_0xad2e('0xd0'));}}return _0x1afe03;})[_0xad2e('0x2b')](function(_0x5f1aaf){if(_0x5f1aaf){return _0x5f1aaf[_0xad2e('0x2a')]({'closed':_0x5888fb[_0xad2e('0x31')][_0xad2e('0x41')],'disposition':_0x5888fb['body']['disposition']})[_0xad2e('0x2b')](function(_0x55b7de){return _0x55b7de;});}})[_0xad2e('0x2b')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x5888fb[_0xad2e('0x31')],client9004);})[_0xad2e('0x2b')](respondWithResult(_0x1c4530,null))[_0xad2e('0x20')](handleError(_0x1c4530,null));};exports[_0xad2e('0xd1')]=function(_0x394518,_0xa25ed2){_0x394518['body']['name']=_0x394518[_0xad2e('0xd2')][_0xad2e('0xd3')];_0x394518[_0xad2e('0x31')]['basename']=_0x394518['file'][_0xad2e('0xd4')];_0x394518[_0xad2e('0x31')]['type']=_0x394518[_0xad2e('0xd2')]['mimetype'];return db[_0xad2e('0xd5')][_0xad2e('0xb3')](_0x394518[_0xad2e('0x31')])[_0xad2e('0x2b')](respondWithResult(_0xa25ed2,0xc9))[_0xad2e('0x20')](handleError(_0xa25ed2,null));};exports[_0xad2e('0xd6')]=function(_0x57ed5c,_0x1e9ade){return db[_0xad2e('0x47')]['findOne']({'where':{'id':_0x57ed5c[_0xad2e('0xb4')]['id']},'raw':!![]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1e9ade,null))[_0xad2e('0x2b')](function(_0x360d04){if(_0x360d04){if(_0x360d04[_0xad2e('0x41')]){return _0x1e9ade[_0xad2e('0x22')](0x193)[_0xad2e('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0xad2e('0xd5')]['findOne']({'where':{'id':_0x57ed5c[_0xad2e('0x4c')][_0xad2e('0xd7')]},'raw':!![]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1e9ade,null));}})[_0xad2e('0x2b')](function(_0x1466fd){if(_0x1466fd){var _0x9b10b=_0x1466fd[_0xad2e('0xd8')]!==null;var _0x4f546b=path['join'](config[_0xad2e('0xd9')],_0xad2e('0xda'));if(_0x9b10b){_0x4f546b=path[_0xad2e('0xdb')](_0x4f546b,_0xad2e('0xdc'));}var _0x255aa0=path[_0xad2e('0xdb')](_0x4f546b,_0x1466fd[_0xad2e('0xdd')]);return _0x1e9ade[_0xad2e('0xde')](_0x255aa0);}})['catch'](handleError(_0x1e9ade,null));};exports['close']=function(_0xa94b3f,_0x203105){var _0x4d18b4=null;var _0x15a98d=null;var _0x2c5621=null;if(_0xa94b3f[_0xad2e('0x31')]['id']){delete _0xa94b3f[_0xad2e('0x31')]['id'];}if(_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xdf')]){_0x2c5621=path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0xe0'),util[_0xad2e('0xe1')]('transcript-%s.txt',Date[_0xad2e('0xe2')]()));_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xe3')]=_0x2c5621;}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0xa94b3f[_0xad2e('0xb4')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0xad2e('0x7a')}]}]})[_0xad2e('0x2b')](handleEntityNotFound(_0x203105,null))['then'](saveUpdates(_0xa94b3f['body'],null))['then'](function(_0x36fa66){if(_0x36fa66){_0x4d18b4=_0x36fa66;return db['ChatWebsite'][_0xad2e('0x75')]({'where':{'id':_0x4d18b4[_0xad2e('0x80')]}});}})['then'](function(_0x3a7e1f){if(_0x3a7e1f){_0x15a98d=_0x3a7e1f;return db[_0xad2e('0xcc')][_0xad2e('0x75')]({'where':{'id':_0x4d18b4[_0xad2e('0x76')]}});}})[_0xad2e('0x2b')](function(_0x2a9579){if(_0x2a9579){if(_0x2c5621){var _0x423e41=null;for(var _0x56aa85=0x1;_0x56aa85<_0x4d18b4['Messages'][_0xad2e('0x50')];++_0x56aa85){_0x423e41=_0x4d18b4[_0xad2e('0xe4')][_0x56aa85];var _0x3efa33=_0x423e41['UserId']?util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0x15a98d[_0xad2e('0xe6')],_0x423e41[_0xad2e('0x42')]):'System';var _0x31250b=_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xe7')]||util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0xad2e('0xe8'),_0x423e41[_0xad2e('0x76')]);switch(_0x15a98d[_0xad2e('0xe9')]){case _0xad2e('0xea'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0x15a98d[_0xad2e('0xe6')],_0x423e41['UserId']):_0xad2e('0xeb');break;case _0xad2e('0xec'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?_0x423e41[_0xad2e('0x7a')][_0xad2e('0xed')]||_0x423e41['User'][_0xad2e('0x37')]:_0xad2e('0xeb');break;case _0xad2e('0xee'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?_0x423e41['User'][_0xad2e('0x37')]:_0xad2e('0xeb');break;default:_0x3efa33=_0x423e41[_0xad2e('0x42')]?util[_0xad2e('0xe1')]('%s%d',_0x15a98d['agentAlias'],_0x423e41[_0xad2e('0x42')]):_0xad2e('0xeb');}var _0x2a1fd3=util['format'](_0xad2e('0xef'),moment(_0x423e41[_0xad2e('0xf0')])[_0xad2e('0xe1')](_0xad2e('0xf1')),_0x423e41[_0xad2e('0xf2')]==='in'?_0x31250b:_0x3efa33,_0x423e41[_0xad2e('0x31')]);if(!_0x423e41[_0xad2e('0xf3')]){fs[_0xad2e('0xf4')](_0x2c5621,_0x2a1fd3);}}return db[_0xad2e('0xf5')][_0xad2e('0xb7')]({'where':{'service':!![]},'include':[{'model':db[_0xad2e('0xf6')],'as':_0xad2e('0xf7'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xad2e('0xf8'),'raw':!![]}]}]});}}})[_0xad2e('0x2b')](function(_0x7ab79a){if(!_0x7ab79a||!_0x7ab79a[_0xad2e('0xf7')]||!_0xa94b3f[_0xad2e('0x31')])return _0x4d18b4;var _0x19dde7=_0x7ab79a['getSmtpOptions']();return respondWithRpcPromise(_0xad2e('0xf9'),_0xad2e('0xfa'),{'account':_0x19dde7,'message':{'from':util[_0xad2e('0xe1')](_0xad2e('0xfb'),_0x7ab79a[_0xad2e('0x2d')],_0x7ab79a[_0xad2e('0xbe')]||_0x7ab79a[_0xad2e('0xf7')][_0xad2e('0x9a')]),'to':_0xa94b3f[_0xad2e('0x31')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xad2e('0xe1')](_0xad2e('0xfc'),_0xa94b3f['body'][_0xad2e('0xdf')]),'attachments':[{'path':_0x2c5621}]}})['then'](function(){return _0x4d18b4;})[_0xad2e('0x20')](function(_0x33de0b){logger['error'](_0x33de0b);});})['then'](respondWithStatusCode(_0x203105,0xc8))['catch'](handleError(_0x203105,null));};exports[_0xad2e('0xfd')]=function(_0x55947c,_0x1392f0){return db[_0xad2e('0xc8')][_0xad2e('0x75')]({'where':{'id':_0x55947c['params']['id']}})['then'](handleEntityNotFound(_0x1392f0,null))['then'](function(_0x167f32){if(_0x167f32){return _0x167f32['addMessage'](_0x55947c[_0xad2e('0x31')][_0xad2e('0xfe')],_[_0xad2e('0xff')](_0x55947c['body'],[_0xad2e('0xfe'),'id'])||{});}})[_0xad2e('0x2b')](respondWithResult(_0x1392f0,null))['catch'](handleError(_0x1392f0,null));};exports[_0xad2e('0x100')]=function(_0x14ed73,_0x54391f){var _0x52584a={'raw':![],'where':{}};var _0x4ce397={};var _0x2e5acc={'count':0x0,'rows':[]};return db[_0xad2e('0x47')][_0xad2e('0xb7')]({'where':{'id':_0x14ed73[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x54391f,null))[_0xad2e('0x2b')](function(_0x2f59fd){if(_0x2f59fd){_0x4ce397[_0xad2e('0x4b')]=_[_0xad2e('0x4d')](db[_0xad2e('0xc8')][_0xad2e('0xb0')]);_0x4ce397[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x14ed73['query']);_0x4ce397[_0xad2e('0x55')]=_[_0xad2e('0xb1')](_0x4ce397['model'],_0x4ce397[_0xad2e('0x4c')]);_0x52584a[_0xad2e('0x4f')]=_[_0xad2e('0xb1')](_0x4ce397['model'],qs[_0xad2e('0x4e')](_0x14ed73['query'][_0xad2e('0x4e')]));_0x52584a[_0xad2e('0x4f')]=_0x52584a[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x52584a[_0xad2e('0x4f')]:_0x4ce397[_0xad2e('0x4b')];if(!_0x14ed73['query'][_0xad2e('0x101')](_0xad2e('0x51'))){_0x52584a[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x14ed73['query']['limit']);_0x52584a['offset']=qs['offset'](_0x14ed73[_0xad2e('0x4c')]['offset']);}_0x52584a[_0xad2e('0x52')]=qs[_0xad2e('0x53')](_0x14ed73['query'][_0xad2e('0x53')]);_0x52584a[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x14ed73[_0xad2e('0x4c')],_0x4ce397[_0xad2e('0x55')]));_0x52584a[_0xad2e('0x54')][_0xad2e('0x102')]=_0x2f59fd['id'];if(_0x14ed73['query']['filter']){_0x52584a[_0xad2e('0x54')]=_[_0xad2e('0x30')](_0x52584a[_0xad2e('0x54')],{'$or':_[_0xad2e('0x36')](_0x52584a[_0xad2e('0x4f')],function(_0x5b9636){var _0x5c9dc0={};_0x5c9dc0[_0x5b9636]={'$like':'%'+_0x14ed73[_0xad2e('0x4c')][_0xad2e('0x103')]+'%'};return _0x5c9dc0;})});}if(_0x14ed73['query'][_0xad2e('0x104')]){var _0x4c70b8=_0x14ed73[_0xad2e('0x4c')][_0xad2e('0x104')][_0xad2e('0x3a')](',');var _0x180166={};_0x180166[_0x4c70b8[0x0]]={'$gte':moment(_0x4c70b8[0x1])[_0xad2e('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x52584a[_0xad2e('0x54')]=_['merge'](_0x52584a['where'],_0x180166);}_0x52584a=_[_0xad2e('0x30')]({},_0x52584a,_0x14ed73[_0xad2e('0xb2')]);return db[_0xad2e('0xc8')][_0xad2e('0x27')]({'where':_0x52584a[_0xad2e('0x54')]})[_0xad2e('0x2b')](function(_0x14b851){_0x2e5acc['count']=_0x14b851;if(_0x14ed73[_0xad2e('0x4c')]['includeAll']){_0x52584a['include']=[{'all':!![]}];}return db['ChatMessage'][_0xad2e('0x105')](_0x52584a);})[_0xad2e('0x2b')](function(_0x4f28e2){_0x2e5acc['rows']=_0x4f28e2;return _0x2e5acc;});}})[_0xad2e('0x2b')](respondWithFilteredResult(_0x54391f,_0x52584a))[_0xad2e('0x20')](handleError(_0x54391f,null));};exports[_0xad2e('0x106')]=function(_0x59df92,_0x34bbc6){var _0x54feb5={'where':{}},_0x4a6fa3={},_0x4d4a27={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xad2e('0xb7')]({'where':{'id':_0x59df92['params']['id']}})['then'](handleEntityNotFound(_0x34bbc6,null))[_0xad2e('0x2b')](function(_0x2dcb83){if(_0x2dcb83){_0x4a6fa3[_0xad2e('0x4b')]=_['keys'](db['ChatMessage'][_0xad2e('0xb0')]);_0x4a6fa3[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x59df92['query']);_0x4a6fa3[_0xad2e('0x55')]=_[_0xad2e('0xb1')](_0x4a6fa3['model'],_0x4a6fa3[_0xad2e('0x4c')]);_0x54feb5[_0xad2e('0x4f')]=_[_0xad2e('0xb1')](_0x4a6fa3[_0xad2e('0x4b')],qs[_0xad2e('0x4e')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x4e')]));_0x54feb5[_0xad2e('0x4f')]=_0x54feb5['attributes'][_0xad2e('0x50')]?_0x54feb5['attributes']:_0x4a6fa3[_0xad2e('0x4b')];if(!_0x59df92[_0xad2e('0x4c')]['hasOwnProperty']('nolimit')){_0x54feb5[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x28')]);_0x54feb5['offset']=qs[_0xad2e('0x25')](_0x59df92['query'][_0xad2e('0x25')]);}_0x54feb5[_0xad2e('0x52')]=qs[_0xad2e('0x53')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x53')]);_0x54feb5[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x59df92[_0xad2e('0x4c')],_0x4a6fa3[_0xad2e('0x55')]));_0x54feb5[_0xad2e('0x54')][_0xad2e('0x102')]=_0x2dcb83['id'];if(_0x59df92['query'][_0xad2e('0x103')]){_0x54feb5[_0xad2e('0x54')]=_['merge'](_0x54feb5[_0xad2e('0x54')],{'$or':_[_0xad2e('0x36')](_0x54feb5[_0xad2e('0x4f')],function(_0x5a85a4){var _0x20bca3={};_0x20bca3[_0x5a85a4]={'$like':'%'+_0x59df92[_0xad2e('0x4c')]['filter']+'%'};return _0x20bca3;})});}_0x54feb5[_0xad2e('0x54')][_0xad2e('0xf3')]=![];if(_0x59df92[_0xad2e('0x4c')]['id']){_0x54feb5[_0xad2e('0x54')]['id']={'$gt':_0x59df92[_0xad2e('0x4c')]['id']};}_0x54feb5=_[_0xad2e('0x30')]({},_0x54feb5,_0x59df92[_0xad2e('0xb2')]);return db['ChatMessage']['count']({'where':_0x54feb5['where']})[_0xad2e('0x2b')](function(_0x1cfdda){_0x4d4a27[_0xad2e('0x27')]=_0x1cfdda;_0x54feb5[_0xad2e('0x107')]=[];if(_0x59df92['query']['includeAgent']){_0x54feb5[_0xad2e('0x107')][_0xad2e('0x3c')]({'model':db['User'],'as':_0xad2e('0x7a'),'attributes':['id',_0xad2e('0x37'),'alias']});}if(_0x59df92[_0xad2e('0x4c')]['includeAll']){_0x54feb5[_0xad2e('0x107')]=[{'all':!![]}];}return db[_0xad2e('0xc8')]['findAll'](_0x54feb5);})[_0xad2e('0x2b')](function(_0x2cf359){_0x4d4a27['rows']=_0x2cf359;return _0x4d4a27;});}})['then'](respondWithFilteredResult(_0x34bbc6,_0x54feb5))[_0xad2e('0x20')](handleError(_0x34bbc6,null));};exports[_0xad2e('0x108')]=function(_0x492b7e,_0xad9fab){return db['ChatInteraction'][_0xad2e('0x75')]({'where':{'id':_0x492b7e[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0xad9fab,null))[_0xad2e('0x2b')](function(_0x2331f1){if(_0x2331f1){return _0x2331f1['setTags'](_0x492b7e['body'][_0xad2e('0xfe')],_[_0xad2e('0xff')](_0x492b7e[_0xad2e('0x31')],['ids','id'])||{})[_0xad2e('0x109')](function(){return db[_0xad2e('0x10a')][_0xad2e('0x105')]({'attributes':['id',_0xad2e('0x2d'),_0xad2e('0x10b')],'where':{'id':_0x492b7e[_0xad2e('0x31')][_0xad2e('0xfe')]}});})[_0xad2e('0x2b')](function(_0x21964b){socket[_0xad2e('0x10c')](_0xad2e('0x10d'),{'id':Number(_0x492b7e['params']['id']),'tags':_0x21964b||[]});return{'id':Number(_0x492b7e[_0xad2e('0xb4')]['id']),'tags':_0x21964b||[]};});}})[_0xad2e('0x2b')](respondWithResult(_0xad9fab,null))['catch'](handleError(_0xad9fab,null));};exports[_0xad2e('0x10e')]=function(_0x8bb3c4,_0x453fa7){return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x8bb3c4['params']['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x453fa7,null))[_0xad2e('0x2b')](function(_0x27ad41){if(_0x27ad41){return _0x27ad41[_0xad2e('0x10e')](_0x8bb3c4[_0xad2e('0x4c')][_0xad2e('0xfe')]);}})[_0xad2e('0x2b')](respondWithStatusCode(_0x453fa7,null))[_0xad2e('0x20')](handleError(_0x453fa7,null));};exports[_0xad2e('0xde')]=function(_0x40e752,_0x4c7c51){var _0x12a370=moment()['unix']()[_0xad2e('0x9f')]();var _0x853563=path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0x10f'),'files',_0xad2e('0x110'));var _0x10eb76=path[_0xad2e('0xdb')](config['root'],_0xad2e('0x10f'),_0xad2e('0x111'),_0xad2e('0x112'));var _0x2dbfbd=path['join'](_0x853563,_0x12a370);var _0x56ac2d=util[_0xad2e('0xe1')]('transcript-%d-%s.zip',_0x40e752[_0xad2e('0xb4')]['id'],_0x12a370);var _0xf892e9=path[_0xad2e('0xdb')](_0x853563,_0x56ac2d);var _0x414763=[];_0x414763[_0xad2e('0x3c')]({'model':db[_0xad2e('0x7a')],'as':_0xad2e('0x7a'),'attributes':['id',_0xad2e('0x37')],'raw':!![]});_0x414763[_0xad2e('0x3c')]({'model':db[_0xad2e('0xcc')],'as':'Contact','attributes':['id',_0xad2e('0x113'),_0xad2e('0x114')],'raw':!![]});if(_0x40e752[_0xad2e('0x4c')][_0xad2e('0x112')]){_0x414763['push']({'model':db[_0xad2e('0xd5')],'as':_0xad2e('0xd5'),'raw':!![]});}var _0x366ebe=[{'model':db['ChatMessage'],'as':_0xad2e('0xe4'),'attributes':['id',_0xad2e('0x31'),'createdAt',_0xad2e('0xf2'),_0xad2e('0xf3'),_0xad2e('0x86')],'include':_0x414763}];_0x366ebe[_0xad2e('0x3c')]({'model':db[_0xad2e('0xb8')],'as':_0xad2e('0x115'),'attributes':['id','name']});_0x366ebe[_0xad2e('0x3c')]({'model':db[_0xad2e('0x7a')],'as':_0xad2e('0x116'),'attributes':['id',_0xad2e('0x37')]});return db[_0xad2e('0x47')]['find']({'where':{'id':_0x40e752[_0xad2e('0xb4')]['id']},'include':_0x366ebe})[_0xad2e('0x2b')](handleEntityNotFound(_0x4c7c51,null))[_0xad2e('0x2b')](function(_0x6d6ab1){if(_0x6d6ab1){var _0x2e8154=_0x6d6ab1[_0xad2e('0x117')]({'plain':!![]});fs[_0xad2e('0x118')](_0x2dbfbd);var _0x1d7adc={'channel':_0xad2e('0x119'),'account':_0x2e8154['Account'][_0xad2e('0x2d')],'agent':_0x2e8154[_0xad2e('0x116')]?_0x2e8154[_0xad2e('0x116')][_0xad2e('0x37')]:_0xad2e('0x11a'),'createdAt':moment(_0x2e8154[_0xad2e('0xf0')])['format'](_0xad2e('0x11b'))[_0xad2e('0x9f')](),'closedAt':_0x2e8154[_0xad2e('0x41')]?moment(_0x2e8154[_0xad2e('0x11c')])[_0xad2e('0xe1')](_0xad2e('0x11b'))[_0xad2e('0x9f')]():'','disposition':_0x2e8154[_0xad2e('0x43')],'chatInfo':{'browser':_0x2e8154[_0xad2e('0x11d')],'os':_0x2e8154[_0xad2e('0x11e')],'referer':_0x2e8154[_0xad2e('0x11f')],'customerIp':_0x2e8154[_0xad2e('0x120')],'customerPort':_0x2e8154[_0xad2e('0x121')]?_0x2e8154[_0xad2e('0x121')]:'N.A.'},'messages':_(_0x2e8154[_0xad2e('0xe4')])[_0xad2e('0x122')]()[_0xad2e('0x103')]({'secret':![]})['map'](function(_0x4fbe64){if(_0x4fbe64[_0xad2e('0xd5')]){var _0x424b02=path[_0xad2e('0xdb')](_0x10eb76,_0x4fbe64['Attachment'][_0xad2e('0xdd')]);if(fs['existsSync'](_0x424b02)){fs['createReadStream'](_0x424b02)[_0xad2e('0x123')](fs[_0xad2e('0x124')](path[_0xad2e('0xdb')](_0x2dbfbd,_0x4fbe64[_0xad2e('0xd5')][_0xad2e('0xdd')])));}}return{'date':moment(_0x4fbe64[_0xad2e('0xf0')])['format'](_0xad2e('0x11b'))[_0xad2e('0x9f')](),'sender':_0x4fbe64['direction']===_0xad2e('0x125')?_0x4fbe64[_0xad2e('0x7a')]?_0x4fbe64[_0xad2e('0x7a')][_0xad2e('0x37')]:'System':_0x4fbe64[_0xad2e('0x71')][_0xad2e('0x113')]+(_0x4fbe64['Contact'][_0xad2e('0x114')]?'\x20'+_0x4fbe64['Contact']['lastName']:''),'body':_0x4fbe64[_0xad2e('0xd5')]?_0x4fbe64[_0xad2e('0xd5')][_0xad2e('0xdd')]:_0x4fbe64[_0xad2e('0x31')],'direction':_0x4fbe64[_0xad2e('0xf2')]===_0xad2e('0x125')?'A':'C','secret':_0x4fbe64[_0xad2e('0xf3')],'read':_0x4fbe64[_0xad2e('0x86')],'attachment':_0x4fbe64['Attachment']};})[_0xad2e('0x6d')]()};return ejs[_0xad2e('0x126')](path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0x10f'),_0xad2e('0x127'),_0xad2e('0x128')),{'interaction':_0x1d7adc})[_0xad2e('0x2b')](function(_0x25057b){var _0x30ac7f=path['join'](_0x2dbfbd,'transcript-'+_0x2e8154['id']+'-'+_0x12a370+'.pdf');var _0x5839ae={'path':_0x30ac7f,'channel':'Chat','interactionId':_0x2e8154['id']};return pdf[_0xad2e('0x129')](_0x25057b,_0x5839ae);})[_0xad2e('0x2b')](function(){return new Promise(function(_0x4db1d3,_0x50c6a0){zipdir(_0x2dbfbd,{'saveTo':_0xf892e9},function(_0x300d87,_0x1afd35){if(_0x300d87)return _0x50c6a0(_0x300d87);return _0x4db1d3(_0x1afd35);});})[_0xad2e('0x2b')](function(){return new BPromise(function(_0x231853,_0x1a60d6){rimraf(_0x2dbfbd,function(_0x2812f9){if(_0x2812f9)_0x1a60d6(_0x2812f9);return _0x231853();});});})['then'](function(){return _0x4c7c51[_0xad2e('0xde')](_0xf892e9,_0x56ac2d,function(_0x3ff14a){if(_0x3ff14a){logger[_0xad2e('0x1c')]('err',_0x3ff14a);}else{fs[_0xad2e('0x12a')](_0xf892e9);}});});});}else{return _0x4c7c51[_0xad2e('0x21')](0xc8);}})[_0xad2e('0x20')](handleError(_0x4c7c51,null));}; \ No newline at end of file +var _0xa9e0=['createPdfFromHTML','err','rimraf','zip-dir','request-promise','mustache','path','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','body','contact','agent','account','Users','fullname','Tags','TagIds','split','forEach','push','catch','waiting','answered','unmanaged','abandoned','closed','UserId','talking','disposition','total','index','map','ChatInteraction','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','select','field','from','u.fullname','user_has_chat_interactions','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','keys','compact','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','group','i.id','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','options','create','describe','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','attachmentUpload','file','originalname','filename','Attachment','Unauthorized','findOne','attachId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','hasOwnProperty','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','color','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x43c355,_0x469b9a){var _0xbf9e1c=function(_0x200617){while(--_0x200617){_0x43c355['push'](_0x43c355['shift']());}};_0xbf9e1c(++_0x469b9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var rimraf=require(_0x0a9e('0x0'));var zipdir=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x3'));var util=require('util');var path=require(_0x0a9e('0x4'));var ejs=require(_0x0a9e('0x5'));var fs=require('fs');var _=require(_0x0a9e('0x6'));var squel=require(_0x0a9e('0x7'));var Redis=require(_0x0a9e('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0x0a9e('0x9'));var pdf=require(_0x0a9e('0xa'));var logger=require(_0x0a9e('0xb'))('api');var config=require('../../config/environment');var db=require(_0x0a9e('0xc'))['db'];config['redis']=_['defaults'](config[_0x0a9e('0xd')],{'host':_0x0a9e('0xe'),'port':0x18eb});var socket=require(_0x0a9e('0xf'))(new Redis(config[_0x0a9e('0xd')]));require(_0x0a9e('0x10'))[_0x0a9e('0x11')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson['client'][_0x0a9e('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x36471c,_0xd5b662,_0x26d672,_0x32d742){return new BPromise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_0x32d742||client;return _0x4283ce[_0x0a9e('0x13')](_0x36471c,_0x26d672)[_0x0a9e('0x14')](function(_0x281129){logger[_0x0a9e('0x15')](_0x0a9e('0x16'),_0xd5b662,'request\x20sent');logger[_0x0a9e('0x17')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xd5b662,_0x0a9e('0x18'),JSON['stringify'](_0x281129));if(_0x281129[_0x0a9e('0x19')]){if(_0x281129[_0x0a9e('0x19')]['code']===0x1f4){logger[_0x0a9e('0x19')]('ChatInteraction,\x20%s,\x20%s',_0xd5b662,_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x5db4b0(_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}logger[_0x0a9e('0x19')](_0x0a9e('0x16'),_0xd5b662,_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x69aeb7(_0x281129[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}else{logger[_0x0a9e('0x15')](_0x0a9e('0x16'),_0xd5b662,'request\x20sent');_0x69aeb7(_0x281129[_0x0a9e('0x1b')][_0x0a9e('0x1a')]);}})['catch'](function(_0x20f109){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xd5b662,_0x20f109);_0x5db4b0(_0x20f109);});});}function respondWithStatusCode(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0xcc;return function(_0x38e7c4){if(_0x38e7c4){return _0x3a02e1[_0x0a9e('0x1c')](_0x432e56);}return _0x3a02e1['status'](_0x432e56)[_0x0a9e('0x1d')]();};}function respondWithResult(_0x2fb0e4,_0x3b45bc){_0x3b45bc=_0x3b45bc||0xc8;return function(_0x4d00e6){if(_0x4d00e6){return _0x2fb0e4[_0x0a9e('0x1e')](_0x3b45bc)[_0x0a9e('0x1f')](_0x4d00e6);}};}function respondWithFilteredResult(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(_0x59181e){var _0x197ec0=typeof _0x5ea472[_0x0a9e('0x20')]===_0x0a9e('0x21')&&typeof _0x5ea472[_0x0a9e('0x22')]==='undefined';var _0x384319=_0x59181e['count'];var _0x45a1e7=_0x197ec0?0x0:_0x5ea472['offset'];var _0x1dc186=_0x197ec0?_0x59181e[_0x0a9e('0x23')]:_0x5ea472[_0x0a9e('0x20')]+_0x5ea472[_0x0a9e('0x22')];var _0x140511;if(_0x1dc186>=_0x384319){_0x1dc186=_0x384319;_0x140511=0xc8;}else{_0x140511=0xce;}_0x16b1ca[_0x0a9e('0x1e')](_0x140511);return _0x16b1ca[_0x0a9e('0x24')](_0x0a9e('0x25'),_0x45a1e7+'-'+_0x1dc186+'/'+_0x384319)['json'](_0x59181e);}return null;};}function saveUpdates(_0x3652a7){return function(_0x468813){if(_0x468813){return _0x468813[_0x0a9e('0x26')](_0x3652a7)[_0x0a9e('0x14')](function(_0x5c877d){return _0x5c877d;});}return null;};}function removeEntity(_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x27')]()[_0x0a9e('0x14')](function(){_0x15b200[_0x0a9e('0x1e')](0xcc)[_0x0a9e('0x1d')]();});}};}function handleEntityNotFound(_0x296f41){return function(_0x2e8759){if(!_0x2e8759){_0x296f41[_0x0a9e('0x1c')](0x194);}return _0x2e8759;};}function handleError(_0x540530,_0x426950){_0x426950=_0x426950||0x1f4;return function(_0x5d1e0e){logger[_0x0a9e('0x19')](_0x5d1e0e[_0x0a9e('0x28')]);if(_0x5d1e0e[_0x0a9e('0x29')]){delete _0x5d1e0e[_0x0a9e('0x29')];}_0x540530[_0x0a9e('0x1e')](_0x426950)['send'](_0x5d1e0e);};}function getMustacheRender(_0x66c1d2,_0x46f0a5){return Mustache[_0x0a9e('0x2a')](_0x66c1d2,_[_0x0a9e('0x2b')](_0x46f0a5[_0x0a9e('0x2c')],{'contact':_0x46f0a5[_0x0a9e('0x2d')],'message':_0x46f0a5[_0x0a9e('0x1a')],'agent':_0x46f0a5[_0x0a9e('0x2e')],'interaction':_0x46f0a5['interaction'],'account':_0x46f0a5[_0x0a9e('0x2f')]}))||'';}function getInteractionUsers(_0x5e7238,_0x2cc7a0){return new BPromise(function(_0x14b13f,_0x2b7e7f){try{if(_0x2cc7a0[_0x5e7238['id']]){_0x5e7238[_0x0a9e('0x30')]=_['map'](_0x2cc7a0[_0x5e7238['id']],function(_0x191e91){return{'id':_0x191e91['id'],'fullname':_0x191e91[_0x0a9e('0x31')]};});}}catch(_0x1fa90d){_0x2b7e7f(_0x1fa90d);}_0x14b13f(_0x5e7238);});}function getInteractionTags(_0x15de0e,_0x4853b1){return new BPromise(function(_0x54135e,_0x1e8694){try{if(_0x15de0e['TagIds']){_0x15de0e[_0x0a9e('0x32')]=[];_0x15de0e[_0x0a9e('0x33')][_0x0a9e('0x34')](',')[_0x0a9e('0x35')](function(_0x4f41ae){_0x15de0e[_0x0a9e('0x32')][_0x0a9e('0x36')](_0x4853b1[_0x4f41ae]);});}delete _0x15de0e[_0x0a9e('0x33')];}catch(_0x533942){_0x1e8694(_0x533942);}_0x54135e(_0x15de0e);});}function updateChatInteraction(_0x1dbf74,_0x1a180b,_0x289467){return new BPromise(function(_0x4c1c0e,_0x546ef8){return getInteractionUsers(_0x1dbf74,_0x289467)[_0x0a9e('0x14')](function(_0x40d766){return getInteractionTags(_0x40d766,_0x1a180b);})['then'](function(_0x2b814e){return getStateInteraction(_0x2b814e);})[_0x0a9e('0x14')](function(_0x2e1b3a){_0x4c1c0e(_0x2e1b3a);})[_0x0a9e('0x37')](function(_0x4b38d9){_0x546ef8(_0x4b38d9);});});}function getStateInteraction(_0x5a594b){return new BPromise(function(_0x15e37d){_0x5a594b[_0x0a9e('0x38')]=0x0;_0x5a594b['talking']=0x0;_0x5a594b[_0x0a9e('0x39')]=0x0;_0x5a594b[_0x0a9e('0x3a')]=0x0;_0x5a594b[_0x0a9e('0x3b')]=0x0;_0x5a594b['total']=0x0;if(!_0x5a594b[_0x0a9e('0x3c')]&&!_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x38')]+=0x1;}if(!_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x3e')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}if(_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3f')]===_0x0a9e('0x3b')){_0x5a594b[_0x0a9e('0x3b')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}else if(_0x5a594b[_0x0a9e('0x3c')]&&!_0x5a594b['UserId']&&_0x5a594b['disposition']){_0x5a594b[_0x0a9e('0x3a')]+=0x1;if(_0x5a594b[_0x0a9e('0x38')]){_0x5a594b[_0x0a9e('0x38')]-=0x1;}}else if(_0x5a594b[_0x0a9e('0x3c')]&&_0x5a594b[_0x0a9e('0x3d')]){_0x5a594b[_0x0a9e('0x39')]+=0x1;if(_0x5a594b[_0x0a9e('0x3e')]){_0x5a594b[_0x0a9e('0x3e')]-=0x1;}}_0x5a594b[_0x0a9e('0x40')]+=0x1;_0x15e37d(_0x5a594b);});}exports[_0x0a9e('0x41')]=function(_0x2c2cb0,_0x35ed4a){var _0x5026aa={},_0x117c99={},_0x138b8b={'count':0x0,'rows':[]};var _0xdd268f=_[_0x0a9e('0x42')](db[_0x0a9e('0x43')][_0x0a9e('0x44')],function(_0x21eb86){return{'name':_0x21eb86[_0x0a9e('0x45')],'type':_0x21eb86['type'][_0x0a9e('0x46')]};});_0x117c99['model']=_[_0x0a9e('0x42')](_0xdd268f,_0x0a9e('0x29'));_0x117c99[_0x0a9e('0x47')]=_['keys'](_0x2c2cb0[_0x0a9e('0x47')]);_0x117c99[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x117c99[_0x0a9e('0x4a')],_0x117c99[_0x0a9e('0x47')]);_0x5026aa[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x117c99['model'],qs[_0x0a9e('0x4c')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x5026aa[_0x0a9e('0x4b')]=_0x5026aa[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x5026aa[_0x0a9e('0x4b')]:_0x117c99[_0x0a9e('0x4a')];if(!_0x2c2cb0[_0x0a9e('0x47')]['hasOwnProperty'](_0x0a9e('0x4e'))){_0x5026aa[_0x0a9e('0x22')]=qs['limit'](_0x2c2cb0['query']['limit']);_0x5026aa[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x20')]);}_0x5026aa[_0x0a9e('0x4f')]=qs[_0x0a9e('0x50')](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x5026aa['where']=qs['filters'](_['pick'](_0x2c2cb0[_0x0a9e('0x47')],_0x117c99[_0x0a9e('0x48')]),_0xdd268f);var _0x14d602=[];var _0x5bb3ed=squel[_0x0a9e('0x51')]()[_0x0a9e('0x52')]('id')['field']('name')[_0x0a9e('0x52')]('color')[_0x0a9e('0x53')]('tools_tags');var _0x2e5e62=squel[_0x0a9e('0x51')]()[_0x0a9e('0x52')]('u.id')[_0x0a9e('0x52')](_0x0a9e('0x54'))['field']('ui.ChatInteractionId')[_0x0a9e('0x53')](_0x0a9e('0x55'),'ui')['left_join'](_0x0a9e('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x211ef9=squel['select']()[_0x0a9e('0x53')]('chat_interactions','i')['left_join']('cm_contacts','c',_0x0a9e('0x57'))['left_join'](_0x0a9e('0x56'),'o',_0x0a9e('0x58'))[_0x0a9e('0x59')](_0x0a9e('0x5a'),'a',_0x0a9e('0x5b'))[_0x0a9e('0x59')](_0x0a9e('0x5c'),'me',_0x0a9e('0x5d'))['left_join'](_0x0a9e('0x5e'),'it',_0x0a9e('0x5f'))[_0x0a9e('0x59')](_0x0a9e('0x60'),'t',_0x0a9e('0x61'));var _0x156662=squel['expr']();var _0x956fbe=[];var _0x26bc80=squel['expr']();var _0x3649cc;if(_0x2c2cb0['query'][_0x0a9e('0x62')]){_0x3649cc=as['parseSearch'](_0x2c2cb0['query']['search']);var _0x273cb5=_0x3649cc['sqlOperator'];for(var _0x2244d6=0x0;_0x2244d6<_0x3649cc[_0x0a9e('0x63')][_0x0a9e('0x4d')];_0x2244d6++){var _0x7be420=_0x3649cc[_0x0a9e('0x63')][_0x2244d6];var _0x26d7db='i';var _0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name',_0x7be420[_0x0a9e('0x52')]]);if(!_0x49eed0){switch(_0x7be420[_0x0a9e('0x52')]){case _0x0a9e('0x65'):if(_0x7be420['value']==0x1){_0x211ef9[_0x0a9e('0x66')]('`'+_0x7be420[_0x0a9e('0x52')]+_0x0a9e('0x67'));}else{_0x211ef9[_0x0a9e('0x66')]('`'+_0x7be420['field']+_0x0a9e('0x68'));}break;case _0x0a9e('0x69'):if(_0x7be420['operator']===_0x0a9e('0x6a')){if(_0x7be420[_0x0a9e('0x6b')][_0x0a9e('0x34')]('\x20')[_0x0a9e('0x4d')]>0x1){_0x156662[_0x273cb5](_0x0a9e('0x6c'),qs['getFullTextValue'](_0x7be420[_0x0a9e('0x6b')]),null);}else{var _0x2937e0='%'+_0x7be420[_0x0a9e('0x6b')]+'%';_0x156662[_0x273cb5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2937e0,_0x2937e0,_0x2937e0);}}else{_0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name','ContactId']);_0x7be420[_0x0a9e('0x52')]=_0x0a9e('0x6d');_0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f[_0x0a9e('0x70')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x71')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}break;case _0x0a9e('0x72'):var _0x2e89b7=_0x7be420[_0x0a9e('0x6b')][_0x0a9e('0x34')](',')[_0x0a9e('0x42')](function(_0x320898){return Number(_0x320898);});_0x2e89b7[_0x0a9e('0x35')](function(_0x2a28c0){_0x26bc80['or'](_0x0a9e('0x73'),'%,'+_0x2a28c0+',%');});_0x956fbe=_['union'](_0x956fbe,_0x2e89b7);break;case _0x0a9e('0x74'):if(_0x7be420[_0x0a9e('0x75')]===_0x0a9e('0x6a')){_0x156662[_0x273cb5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x7be420[_0x0a9e('0x6b')]+'%',null);}else{_0x49eed0=_[_0x0a9e('0x64')](_0xdd268f,['name',_0x0a9e('0x3d')]);_0x7be420[_0x0a9e('0x52')]=_0x0a9e('0x3d');_0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f['text'],_0x235f8f['value']['start'],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}break;case _0x0a9e('0x2c'):_0x235f8f=as[_0x0a9e('0x6e')]('me',null,_0x7be420);_0x156662[_0x273cb5](_0x235f8f[_0x0a9e('0x70')],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x71')],_0x235f8f[_0x0a9e('0x6b')]['end']);break;}}else{var _0x235f8f=as[_0x0a9e('0x6e')](_0x26d7db,_0x49eed0[_0x0a9e('0x6f')],_0x7be420);_0x156662[_0x273cb5](_0x235f8f['text'],_0x235f8f[_0x0a9e('0x6b')]['start'],_0x235f8f[_0x0a9e('0x6b')][_0x0a9e('0x1d')]);}}}else{var _0x4c46c1=_(_0x2c2cb0[_0x0a9e('0x47')])[_0x0a9e('0x76')]()[_0x0a9e('0x42')](function(_0x317c0c){return _['some'](_0xdd268f,[_0x0a9e('0x29'),_0x317c0c])?_0x317c0c:undefined;})[_0x0a9e('0x77')]()[_0x0a9e('0x6b')]();if(!_[_0x0a9e('0x78')](_0x4c46c1)){_0x4c46c1['forEach'](function(_0x109ccb){if(_0x109ccb===_0x0a9e('0x79')){_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x7b'),[]['concat'](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb]));}else if(_0x109ccb===_0x0a9e('0x7c')){var _0x30a4c7=JSON[_0x0a9e('0x7d')](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb])[_0x0a9e('0x7e')];var _0x40fc56=JSON[_0x0a9e('0x7d')](_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb])[_0x0a9e('0x7f')];_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x80'),_0x30a4c7,_0x40fc56);}else{if(_0x2c2cb0[_0x0a9e('0x47')][_0x109ccb]===_0x0a9e('0x81')){_0x211ef9['where']('i.'+_0x109ccb+_0x0a9e('0x82'));}else{_0x211ef9[_0x0a9e('0x7a')]('i.'+_0x109ccb+_0x0a9e('0x83'),_0x2c2cb0['query'][_0x109ccb]);}}});}if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x84')]){if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x84')]==0x1){_0x211ef9['having']('`unreadMessages`\x20=\x200');}else{_0x211ef9[_0x0a9e('0x66')](_0x0a9e('0x85'));}}if(_0x2c2cb0['query'][_0x0a9e('0x86')]){_0x956fbe=_['isArray'](_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x86')])?_0x2c2cb0['query'][_0x0a9e('0x86')]:new Array(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x86')]);_0x956fbe[_0x0a9e('0x35')](function(_0x3755fe){_0x26bc80['or'](_0x0a9e('0x73'),'%,'+_0x3755fe+',%');});}if(_0x2c2cb0[_0x0a9e('0x47')]['filter']){var _0x2973d3=_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x87')][_0x0a9e('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0a9e('0x89')](_0x2973d3)){_0x156662['or'](_0x0a9e('0x8a'),_0x2973d3+'%');}else{_0x156662['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x8b')](_0x2973d3))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2973d3+'%');}}}_0x211ef9[_0x0a9e('0x7a')](_0x156662);_0x211ef9[_0x0a9e('0x8c')](_0x0a9e('0x8d'));var _0x385d52={'type':db['Sequelize']['QueryTypes'][_0x0a9e('0x8e')],'raw':!![]};var _0x2b9c01=_0x211ef9[_0x0a9e('0x8f')]();_0x2b9c01['field'](_0x0a9e('0x8d'));_0x2b9c01[_0x0a9e('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5026aa[_0x0a9e('0x4f')]){_0x5026aa['order']['forEach'](function(_0x4dc6b3){var _0x81d748=_0x4dc6b3[0x0]===_0x0a9e('0x90')?_0x4dc6b3[0x0]:'i.'+_0x4dc6b3[0x0];_0x211ef9[_0x0a9e('0x4f')](_0x81d748,_0x4dc6b3[0x1]===_0x0a9e('0x91')?![]:!![]);});}if(!_[_0x0a9e('0x78')](_0x956fbe)){_0x211ef9[_0x0a9e('0x66')](_0x26bc80);_0x2b9c01['where'](_0x0a9e('0x92'),_0x956fbe);}BPromise['resolve']()[_0x0a9e('0x14')](function(){if(!_0x3649cc){if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x79')])return;_0x2b9c01[_0x0a9e('0x7a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x93'));return;}if(_0x2c2cb0[_0x0a9e('0x94')]['role']!==_0x0a9e('0x2e'))return;return _0x2c2cb0[_0x0a9e('0x94')][_0x0a9e('0x95')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x14')](function(_0x255e49){if(_[_0x0a9e('0x78')](_0x255e49)){_0x2b9c01[_0x0a9e('0x7a')](_0x0a9e('0x96'));_0x211ef9['where'](_0x0a9e('0x96'));}else{_0x2b9c01[_0x0a9e('0x7a')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0a9e('0x42')](_0x255e49,'id'));_0x211ef9[_0x0a9e('0x7a')](_0x0a9e('0x7b'),_['map'](_0x255e49,'id'));}});})[_0x0a9e('0x14')](function(){if(_0x2c2cb0['user'][_0x0a9e('0x97')]===_0x0a9e('0x2e')&&!_0x3649cc&&!_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x79')])return[];return db[_0x0a9e('0x98')][_0x0a9e('0x47')](_0x2b9c01[_0x0a9e('0x99')](),_0x385d52);})[_0x0a9e('0x14')](function(_0x501050){_0x138b8b[_0x0a9e('0x23')]=_0x501050[_0x0a9e('0x4d')];if(_0x138b8b[_0x0a9e('0x23')]===0x0)return[];return db[_0x0a9e('0x98')][_0x0a9e('0x47')](_0x5bb3ed[_0x0a9e('0x99')](),_0x385d52)[_0x0a9e('0x14')](function(_0x33f0c9){_0x14d602=_[_0x0a9e('0x9a')](_0x33f0c9,'id');_0x385d52=_[_0x0a9e('0x2b')](_0x385d52,{'model':db[_0x0a9e('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2c2cb0[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5026aa['attributes'][_0x0a9e('0x35')](function(_0x23e2bd){_0x211ef9[_0x0a9e('0x52')]('i.'+_0x23e2bd);});}else{_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9b'),'unreadMessages');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9c'),'Account.key');_0x211ef9[_0x0a9e('0x52')]('a.mandatoryDisposition',_0x0a9e('0x9d'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0x9e'),_0x0a9e('0x90'));_0x211ef9['field'](_0x0a9e('0x9f'));_0x211ef9['field'](_0x0a9e('0xa0'),_0x0a9e('0xa1'));_0x211ef9['field'](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x211ef9[_0x0a9e('0x52')]('c.email','Contact.email');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x211ef9['field'](_0x0a9e('0xaa'),'Owner.fullname');_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xab'),_0x0a9e('0xac'));_0x211ef9[_0x0a9e('0x52')](_0x0a9e('0xad'),'TagIds');}if(_0x5026aa[_0x0a9e('0x22')])_0x211ef9[_0x0a9e('0x22')](_0x5026aa[_0x0a9e('0x22')]);if(_0x5026aa[_0x0a9e('0x20')])_0x211ef9[_0x0a9e('0x20')](_0x5026aa['offset']);return db['sequelize'][_0x0a9e('0x47')](_0x211ef9['toString'](),_0x385d52);})[_0x0a9e('0x14')](function(_0x4658df){if(_0x4658df[_0x0a9e('0x4d')]>0x0)_0x2e5e62[_0x0a9e('0x7a')](_0x0a9e('0xae'),_[_0x0a9e('0x42')](_0x4658df,'id'));return db['sequelize']['query'](_0x2e5e62[_0x0a9e('0x99')](),_0x385d52)['then'](function(_0x2469d1){var _0x5c689c=_[_0x0a9e('0xaf')](_0x2469d1,'ChatInteractionId');var _0x558d60=[];_0x4658df[_0x0a9e('0x35')](function(_0xb8db59){_0x558d60['push'](updateChatInteraction(_0xb8db59,_0x14d602,_0x5c689c));});return BPromise[_0x0a9e('0xb0')](_0x558d60);});});})[_0x0a9e('0x14')](function(_0x15c6b9){_0x138b8b[_0x0a9e('0xb1')]=_0x15c6b9;return _0x138b8b;})[_0x0a9e('0x14')](respondWithFilteredResult(_0x35ed4a,_0x5026aa))['catch'](handleError(_0x35ed4a,null));};exports['show']=function(_0x16449b,_0x22286c){var _0x41c8cd={'raw':![],'where':{'id':_0x16449b[_0x0a9e('0xb2')]['id']}},_0x24beb6={};_0x24beb6['model']=_[_0x0a9e('0x76')](db[_0x0a9e('0x43')]['rawAttributes']);_0x24beb6[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x16449b[_0x0a9e('0x47')]);_0x24beb6[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x24beb6[_0x0a9e('0x4a')],_0x24beb6[_0x0a9e('0x47')]);_0x41c8cd[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x24beb6[_0x0a9e('0x4a')],qs['fields'](_0x16449b[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x41c8cd[_0x0a9e('0x4b')]=_0x41c8cd[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x41c8cd['attributes']:_0x24beb6['model'];if(_0x16449b[_0x0a9e('0x47')][_0x0a9e('0xb3')]){_0x41c8cd[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x41c8cd=_[_0x0a9e('0x2b')]({},_0x41c8cd,_0x16449b[_0x0a9e('0xb5')]);return db['ChatInteraction'][_0x0a9e('0x64')](_0x41c8cd)[_0x0a9e('0x14')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x14')](respondWithResult(_0x22286c,null))['catch'](handleError(_0x22286c,null));};exports[_0x0a9e('0xb6')]=function(_0x59aa7b,_0x2144ca){return db['ChatInteraction'][_0x0a9e('0xb6')](_0x59aa7b[_0x0a9e('0x2c')],{})[_0x0a9e('0x14')](respondWithResult(_0x2144ca,0xc9))['catch'](handleError(_0x2144ca,null));};exports[_0x0a9e('0x26')]=function(_0x5ed560,_0x4383da){if(_0x5ed560[_0x0a9e('0x2c')]['id']){delete _0x5ed560[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x5ed560[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x14')](saveUpdates(_0x5ed560[_0x0a9e('0x2c')],null))[_0x0a9e('0x14')](respondWithResult(_0x4383da,null))[_0x0a9e('0x37')](handleError(_0x4383da,null));};exports[_0x0a9e('0x27')]=function(_0x2415fe,_0x399def){return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x2415fe['params']['id']}})['then'](handleEntityNotFound(_0x399def,null))[_0x0a9e('0x14')](removeEntity(_0x399def,null))['catch'](handleError(_0x399def,null));};exports[_0x0a9e('0xb7')]=function(_0x3428c9,_0x5d6b69){return db[_0x0a9e('0x43')][_0x0a9e('0xb7')]()[_0x0a9e('0x14')](respondWithResult(_0x5d6b69,null))[_0x0a9e('0x37')](handleError(_0x5d6b69,null));};exports['createVidaooSession']=function(_0x148fd9,_0x26cb76){var _0x374f0b=_0x148fd9[_0x0a9e('0xb2')]['id'];var _0x5d0e1f;var _0x19e9ed;var _0x1a0b08;return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x374f0b}})[_0x0a9e('0x14')](function(_0x270df8){_0x5d0e1f=_0x270df8;return db[_0x0a9e('0xb8')]['findOne']({'where':{'id':_0x270df8[_0x0a9e('0x79')]},'attributes':['id',_0x0a9e('0xb9'),_0x0a9e('0xba'),_0x0a9e('0xbb'),_0x0a9e('0xbc'),'vidaooMetadata'],'raw':!![]});})[_0x0a9e('0x14')](function(_0x289e65){if(_0x289e65&&_0x289e65['vidaooApiKey']&&_0x289e65[_0x0a9e('0xba')]){_0x19e9ed=_0x289e65;var _0x1fcfe6={'interaction':{'id':_0x374f0b},'agent':{'id':_0x148fd9[_0x0a9e('0x94')]['id'],'name':_0x148fd9['user']['name'],'fullname':_0x148fd9['user'][_0x0a9e('0x31')],'email':_0x148fd9[_0x0a9e('0x94')]['email']},'contact':_0x148fd9[_0x0a9e('0x2c')][_0x0a9e('0x2d')],'account':_0x148fd9[_0x0a9e('0x2c')]['account']};var _0x9fc93e={'rejectUnauthorized':![],'method':_0x0a9e('0xbd'),'url':_0x0a9e('0xbe'),'headers':{'X-APIKEY':_0x289e65[_0x0a9e('0xb9')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x148fd9[_0x0a9e('0x94')][_0x0a9e('0xbf')]],'buttons':null,'topic':_0x19e9ed[_0x0a9e('0xbb')],'note':_[_0x0a9e('0xc0')](_0x19e9ed[_0x0a9e('0xbc')])?null:getMustacheRender(_0x19e9ed['vidaooNote'],_0x1fcfe6),'metadata':null},'redirect':_0x0a9e('0xc1'),'json':!![]};try{if(!_['isNull'](_0x19e9ed[_0x0a9e('0xc2')])){var _0x4093e6=getMustacheRender(_0x19e9ed[_0x0a9e('0xc2')],_0x1fcfe6);var _0x3cf222=JSON[_0x0a9e('0x7d')](_0x4093e6);_0x9fc93e[_0x0a9e('0x2c')]['metadata']=_0x3cf222;}}catch(_0x1a0314){throw new db[(_0x0a9e('0xc3'))][(_0x0a9e('0xc4'))](_0x0a9e('0xc5'));}return rp(_0x9fc93e);}else{throw new db['Sequelize'][(_0x0a9e('0xc4'))](_0x0a9e('0xc6'));}})[_0x0a9e('0x14')](function(_0x1c9539){_0x1a0b08=_0x1c9539;if(_0x1a0b08['id']){var _0xc2e7b={'body':_0x1a0b08[_0x0a9e('0xc7')],'ChatWebsiteId':_0x19e9ed['id'],'ChatInteractionId':_0x5d0e1f['id'],'direction':_0x0a9e('0xc8'),'UserId':_0x148fd9[_0x0a9e('0x94')]['id']};return db[_0x0a9e('0xc9')][_0x0a9e('0xb6')](_0xc2e7b,{});}else{throw new db['Sequelize'][(_0x0a9e('0xc4'))](_0x0a9e('0xca'));}})[_0x0a9e('0x14')](function(){return _0x5d0e1f[_0x0a9e('0xcb')]({'vidaooSessionId':_0x1a0b08['id']});})[_0x0a9e('0x14')](respondWithResult(_0x26cb76,null))[_0x0a9e('0x37')](handleError(_0x26cb76,null));};exports[_0x0a9e('0xcc')]=function(_0x20ae21,_0x566b90){if(_0x20ae21[_0x0a9e('0x2c')]['id']){delete _0x20ae21[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x20ae21[_0x0a9e('0xb2')]['id']},'include':[{'model':db[_0x0a9e('0xcd')],'as':_0x0a9e('0x69')}]})[_0x0a9e('0x14')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x14')](saveUpdates(_0x20ae21[_0x0a9e('0x2c')],null))[_0x0a9e('0x14')](respondWithResult(_0x566b90,null))[_0x0a9e('0x37')](handleError(_0x566b90,null));};exports[_0x0a9e('0xce')]=function(_0x451010,_0x5a7dad){if(_0x451010[_0x0a9e('0x2c')]['id']){delete _0x451010[_0x0a9e('0x2c')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x451010[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](function(_0x5cb48d){if(!_0x5cb48d){logger[_0x0a9e('0x19')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x5a7dad[_0x0a9e('0x1c')](0x194);}else{if(_0x5cb48d[_0x0a9e('0x3d')]){throw new db[(_0x0a9e('0xc3'))][(_0x0a9e('0xc4'))]('Interaction\x20already\x20assigned');}}return _0x5cb48d;})[_0x0a9e('0x14')](function(_0x309fa9){if(_0x309fa9){return _0x309fa9[_0x0a9e('0x26')]({'closed':_0x451010[_0x0a9e('0x2c')][_0x0a9e('0x3c')],'disposition':_0x451010['body']['disposition']})[_0x0a9e('0x14')](function(_0x33bcb2){return _0x33bcb2;});}})[_0x0a9e('0x14')](function(){return respondWithRpcPromise('AbandonInteraction',_0x0a9e('0xce'),_0x451010[_0x0a9e('0x2c')],client9004);})[_0x0a9e('0x14')](respondWithResult(_0x5a7dad,null))['catch'](handleError(_0x5a7dad,null));};exports[_0x0a9e('0xcf')]=function(_0x2bf85d,_0x15ba6b){_0x2bf85d['body'][_0x0a9e('0x29')]=_0x2bf85d[_0x0a9e('0xd0')][_0x0a9e('0xd1')];_0x2bf85d['body']['basename']=_0x2bf85d['file'][_0x0a9e('0xd2')];_0x2bf85d[_0x0a9e('0x2c')][_0x0a9e('0x6f')]=_0x2bf85d[_0x0a9e('0xd0')]['mimetype'];return db[_0x0a9e('0xd3')]['create'](_0x2bf85d[_0x0a9e('0x2c')])[_0x0a9e('0x14')](respondWithResult(_0x15ba6b,0xc9))[_0x0a9e('0x37')](handleError(_0x15ba6b,null));};exports['attachmentDownload']=function(_0x33b4b3,_0x33a26c){return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x33b4b3[_0x0a9e('0xb2')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x33a26c,null))[_0x0a9e('0x14')](function(_0x5c57e1){if(_0x5c57e1){if(_0x5c57e1[_0x0a9e('0x3c')]){return _0x33a26c['status'](0x193)[_0x0a9e('0x1f')]({'status':0x193,'message':_0x0a9e('0xd4')});}return db[_0x0a9e('0xd3')][_0x0a9e('0xd5')]({'where':{'id':_0x33b4b3[_0x0a9e('0x47')][_0x0a9e('0xd6')]},'raw':!![]})[_0x0a9e('0x14')](handleEntityNotFound(_0x33a26c,null));}})['then'](function(_0x35ace3){if(_0x35ace3){var _0x1c9ea2=_0x35ace3['ChatOfflineMessageId']!==null;var _0xf4fb77=path[_0x0a9e('0xd7')](config['root'],_0x0a9e('0xd8'));if(_0x1c9ea2){_0xf4fb77=path[_0x0a9e('0xd7')](_0xf4fb77,_0x0a9e('0xd9'));}var _0x569528=path[_0x0a9e('0xd7')](_0xf4fb77,_0x35ace3[_0x0a9e('0xda')]);return _0x33a26c[_0x0a9e('0xdb')](_0x569528);}})[_0x0a9e('0x37')](handleError(_0x33a26c,null));};exports[_0x0a9e('0xdc')]=function(_0x29fdfe,_0x3ba897){var _0x74d9b8=null;var _0x22767f=null;var _0x426c3c=null;if(_0x29fdfe['body']['id']){delete _0x29fdfe[_0x0a9e('0x2c')]['id'];}if(_0x29fdfe['body'][_0x0a9e('0xdd')]){_0x426c3c=path[_0x0a9e('0xd7')](config[_0x0a9e('0xde')],_0x0a9e('0xdf'),util[_0x0a9e('0xe0')](_0x0a9e('0xe1'),Date['now']()));_0x29fdfe[_0x0a9e('0x2c')][_0x0a9e('0xe2')]=_0x426c3c;}return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x29fdfe[_0x0a9e('0xb2')]['id']},'include':[{'model':db[_0x0a9e('0xc9')],'as':_0x0a9e('0xe3'),'include':[{'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74')}]}]})[_0x0a9e('0x14')](handleEntityNotFound(_0x3ba897,null))[_0x0a9e('0x14')](saveUpdates(_0x29fdfe['body'],null))[_0x0a9e('0x14')](function(_0x228c10){if(_0x228c10){_0x74d9b8=_0x228c10;return db[_0x0a9e('0xb8')][_0x0a9e('0x64')]({'where':{'id':_0x74d9b8[_0x0a9e('0x79')]}});}})[_0x0a9e('0x14')](function(_0x8120e){if(_0x8120e){_0x22767f=_0x8120e;return db['CmContact']['find']({'where':{'id':_0x74d9b8[_0x0a9e('0x6d')]}});}})[_0x0a9e('0x14')](function(_0x1f4929){if(_0x1f4929){if(_0x426c3c){var _0x1bf692=null;for(var _0x40e2da=0x1;_0x40e2da<_0x74d9b8[_0x0a9e('0xe3')][_0x0a9e('0x4d')];++_0x40e2da){_0x1bf692=_0x74d9b8['Messages'][_0x40e2da];var _0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?util[_0x0a9e('0xe0')](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692[_0x0a9e('0x3d')]):_0x0a9e('0xe6');var _0x54f0b8=_0x29fdfe[_0x0a9e('0x2c')][_0x0a9e('0xe7')]||util[_0x0a9e('0xe0')]('%s%d',_0x0a9e('0xe8'),_0x1bf692[_0x0a9e('0x6d')]);switch(_0x22767f[_0x0a9e('0xe9')]){case _0x0a9e('0xea'):_0x39ea62=_0x1bf692['UserId']?util[_0x0a9e('0xe0')](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692[_0x0a9e('0x3d')]):_0x0a9e('0xe6');break;case _0x0a9e('0xeb'):_0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?_0x1bf692[_0x0a9e('0x74')]['alias']||_0x1bf692[_0x0a9e('0x74')][_0x0a9e('0x31')]:_0x0a9e('0xe6');break;case _0x0a9e('0xec'):_0x39ea62=_0x1bf692['UserId']?_0x1bf692['User'][_0x0a9e('0x31')]:_0x0a9e('0xe6');break;default:_0x39ea62=_0x1bf692[_0x0a9e('0x3d')]?util['format'](_0x0a9e('0xe4'),_0x22767f[_0x0a9e('0xe5')],_0x1bf692['UserId']):_0x0a9e('0xe6');}var _0x5d19b1=util[_0x0a9e('0xe0')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1bf692['createdAt'])['format'](_0x0a9e('0xed')),_0x1bf692[_0x0a9e('0xee')]==='in'?_0x54f0b8:_0x39ea62,_0x1bf692[_0x0a9e('0x2c')]);if(!_0x1bf692[_0x0a9e('0xef')]){fs[_0x0a9e('0xf0')](_0x426c3c,_0x5d19b1);}}return db[_0x0a9e('0xf1')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x0a9e('0xf2')],'as':_0x0a9e('0xf3'),'raw':!![],'include':[{'model':db[_0x0a9e('0xf4')],'as':_0x0a9e('0xf4'),'raw':!![]}]}]});}}})[_0x0a9e('0x14')](function(_0x18dccf){if(!_0x18dccf||!_0x18dccf[_0x0a9e('0xf3')]||!_0x29fdfe['body'])return _0x74d9b8;var _0x49baaa=_0x18dccf[_0x0a9e('0xf5')]();return respondWithRpcPromise('SendMail',_0x0a9e('0xf6'),{'account':_0x49baaa,'message':{'from':util[_0x0a9e('0xe0')](_0x0a9e('0xf7'),_0x18dccf[_0x0a9e('0x29')],_0x18dccf[_0x0a9e('0xbf')]||_0x18dccf[_0x0a9e('0xf3')]['user']),'to':_0x29fdfe[_0x0a9e('0x2c')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x0a9e('0xe0')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x29fdfe[_0x0a9e('0x2c')]['mailTranscript']),'attachments':[{'path':_0x426c3c}]}})['then'](function(){return _0x74d9b8;})[_0x0a9e('0x37')](function(_0x4a7a3c){logger[_0x0a9e('0x19')](_0x4a7a3c);});})[_0x0a9e('0x14')](respondWithStatusCode(_0x3ba897,0xc8))[_0x0a9e('0x37')](handleError(_0x3ba897,null));};exports['addMessage']=function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0xc9')]['find']({'where':{'id':_0x4152cd['params']['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x1209c4,null))[_0x0a9e('0x14')](function(_0x89d2cb){if(_0x89d2cb){return _0x89d2cb[_0x0a9e('0xf8')](_0x4152cd[_0x0a9e('0x2c')][_0x0a9e('0xf9')],_[_0x0a9e('0xfa')](_0x4152cd[_0x0a9e('0x2c')],[_0x0a9e('0xf9'),'id'])||{});}})[_0x0a9e('0x14')](respondWithResult(_0x1209c4,null))['catch'](handleError(_0x1209c4,null));};exports['getMessages']=function(_0x558171,_0x5975fa){var _0x19dcc2={'raw':![],'where':{}};var _0x2ce30f={};var _0x2d21c7={'count':0x0,'rows':[]};return db[_0x0a9e('0x43')][_0x0a9e('0xd5')]({'where':{'id':_0x558171[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x5975fa,null))['then'](function(_0x5c3ecf){if(_0x5c3ecf){_0x2ce30f[_0x0a9e('0x4a')]=_[_0x0a9e('0x76')](db['ChatMessage'][_0x0a9e('0x44')]);_0x2ce30f[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x558171[_0x0a9e('0x47')]);_0x2ce30f[_0x0a9e('0x48')]=_[_0x0a9e('0x49')](_0x2ce30f[_0x0a9e('0x4a')],_0x2ce30f[_0x0a9e('0x47')]);_0x19dcc2[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0x2ce30f[_0x0a9e('0x4a')],qs[_0x0a9e('0x4c')](_0x558171['query'][_0x0a9e('0x4c')]));_0x19dcc2[_0x0a9e('0x4b')]=_0x19dcc2[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x19dcc2[_0x0a9e('0x4b')]:_0x2ce30f[_0x0a9e('0x4a')];if(!_0x558171[_0x0a9e('0x47')][_0x0a9e('0xfb')](_0x0a9e('0x4e'))){_0x19dcc2[_0x0a9e('0x22')]=qs[_0x0a9e('0x22')](_0x558171[_0x0a9e('0x47')]['limit']);_0x19dcc2['offset']=qs[_0x0a9e('0x20')](_0x558171[_0x0a9e('0x47')][_0x0a9e('0x20')]);}_0x19dcc2[_0x0a9e('0x4f')]=qs[_0x0a9e('0x50')](_0x558171[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x19dcc2['where']=qs[_0x0a9e('0x48')](_['pick'](_0x558171[_0x0a9e('0x47')],_0x2ce30f[_0x0a9e('0x48')]));_0x19dcc2[_0x0a9e('0x7a')][_0x0a9e('0xfc')]=_0x5c3ecf['id'];if(_0x558171[_0x0a9e('0x47')][_0x0a9e('0x87')]){_0x19dcc2[_0x0a9e('0x7a')]=_[_0x0a9e('0x2b')](_0x19dcc2[_0x0a9e('0x7a')],{'$or':_[_0x0a9e('0x42')](_0x19dcc2[_0x0a9e('0x4b')],function(_0x8231e5){var _0x43111e={};_0x43111e[_0x8231e5]={'$like':'%'+_0x558171[_0x0a9e('0x47')][_0x0a9e('0x87')]+'%'};return _0x43111e;})});}if(_0x558171[_0x0a9e('0x47')]['$gte']){var _0x54cf62=_0x558171[_0x0a9e('0x47')][_0x0a9e('0x7e')]['split'](',');var _0x5500de={};_0x5500de[_0x54cf62[0x0]]={'$gte':moment(_0x54cf62[0x1])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))};_0x19dcc2[_0x0a9e('0x7a')]=_['merge'](_0x19dcc2[_0x0a9e('0x7a')],_0x5500de);}_0x19dcc2=_['merge']({},_0x19dcc2,_0x558171[_0x0a9e('0xb5')]);return db['ChatMessage'][_0x0a9e('0x23')]({'where':_0x19dcc2['where']})[_0x0a9e('0x14')](function(_0x21e210){_0x2d21c7[_0x0a9e('0x23')]=_0x21e210;if(_0x558171['query'][_0x0a9e('0xb3')]){_0x19dcc2['include']=[{'all':!![]}];}return db['ChatMessage'][_0x0a9e('0xfe')](_0x19dcc2);})[_0x0a9e('0x14')](function(_0x3c691f){_0x2d21c7[_0x0a9e('0xb1')]=_0x3c691f;return _0x2d21c7;});}})[_0x0a9e('0x14')](respondWithFilteredResult(_0x5975fa,_0x19dcc2))[_0x0a9e('0x37')](handleError(_0x5975fa,null));};exports[_0x0a9e('0xff')]=function(_0x82504f,_0x1a3143){var _0x151f16={'where':{}},_0xd6938={},_0x98bf26={'count':0x0,'rows':[]};return db[_0x0a9e('0x43')][_0x0a9e('0xd5')]({'where':{'id':_0x82504f[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x1a3143,null))[_0x0a9e('0x14')](function(_0x643f66){if(_0x643f66){_0xd6938[_0x0a9e('0x4a')]=_['keys'](db[_0x0a9e('0xc9')][_0x0a9e('0x44')]);_0xd6938[_0x0a9e('0x47')]=_[_0x0a9e('0x76')](_0x82504f['query']);_0xd6938['filters']=_['intersection'](_0xd6938[_0x0a9e('0x4a')],_0xd6938['query']);_0x151f16[_0x0a9e('0x4b')]=_[_0x0a9e('0x49')](_0xd6938[_0x0a9e('0x4a')],qs[_0x0a9e('0x4c')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x4c')]));_0x151f16[_0x0a9e('0x4b')]=_0x151f16[_0x0a9e('0x4b')][_0x0a9e('0x4d')]?_0x151f16[_0x0a9e('0x4b')]:_0xd6938['model'];if(!_0x82504f[_0x0a9e('0x47')]['hasOwnProperty'](_0x0a9e('0x4e'))){_0x151f16['limit']=qs[_0x0a9e('0x22')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x22')]);_0x151f16['offset']=qs[_0x0a9e('0x20')](_0x82504f[_0x0a9e('0x47')]['offset']);}_0x151f16['order']=qs[_0x0a9e('0x50')](_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x50')]);_0x151f16['where']=qs['filters'](_['pick'](_0x82504f[_0x0a9e('0x47')],_0xd6938[_0x0a9e('0x48')]));_0x151f16[_0x0a9e('0x7a')][_0x0a9e('0xfc')]=_0x643f66['id'];if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x87')]){_0x151f16[_0x0a9e('0x7a')]=_[_0x0a9e('0x2b')](_0x151f16[_0x0a9e('0x7a')],{'$or':_[_0x0a9e('0x42')](_0x151f16[_0x0a9e('0x4b')],function(_0x2f4de1){var _0x13215c={};_0x13215c[_0x2f4de1]={'$like':'%'+_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x87')]+'%'};return _0x13215c;})});}_0x151f16[_0x0a9e('0x7a')][_0x0a9e('0xef')]=![];if(_0x82504f[_0x0a9e('0x47')]['id']){_0x151f16['where']['id']={'$gt':_0x82504f[_0x0a9e('0x47')]['id']};}_0x151f16=_[_0x0a9e('0x2b')]({},_0x151f16,_0x82504f[_0x0a9e('0xb5')]);return db[_0x0a9e('0xc9')][_0x0a9e('0x23')]({'where':_0x151f16[_0x0a9e('0x7a')]})['then'](function(_0x4739ed){_0x98bf26[_0x0a9e('0x23')]=_0x4739ed;_0x151f16[_0x0a9e('0xb4')]=[];if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0x100')]){_0x151f16[_0x0a9e('0xb4')][_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74'),'attributes':['id','fullname','alias']});}if(_0x82504f[_0x0a9e('0x47')][_0x0a9e('0xb3')]){_0x151f16['include']=[{'all':!![]}];}return db[_0x0a9e('0xc9')][_0x0a9e('0xfe')](_0x151f16);})['then'](function(_0x1ca7c8){_0x98bf26['rows']=_0x1ca7c8;return _0x98bf26;});}})[_0x0a9e('0x14')](respondWithFilteredResult(_0x1a3143,_0x151f16))[_0x0a9e('0x37')](handleError(_0x1a3143,null));};exports['addTags']=function(_0x27a41c,_0x31ab12){return db['ChatInteraction'][_0x0a9e('0x64')]({'where':{'id':_0x27a41c[_0x0a9e('0xb2')]['id']}})['then'](handleEntityNotFound(_0x31ab12,null))[_0x0a9e('0x14')](function(_0x237994){if(_0x237994){return _0x237994[_0x0a9e('0x101')](_0x27a41c[_0x0a9e('0x2c')][_0x0a9e('0xf9')],_[_0x0a9e('0xfa')](_0x27a41c['body'],[_0x0a9e('0xf9'),'id'])||{})[_0x0a9e('0x102')](function(){return db['Tag'][_0x0a9e('0xfe')]({'attributes':['id',_0x0a9e('0x29'),_0x0a9e('0x103')],'where':{'id':_0x27a41c[_0x0a9e('0x2c')][_0x0a9e('0xf9')]}});})[_0x0a9e('0x14')](function(_0x368a12){socket['emit']('chatInteractionTags:save',{'id':Number(_0x27a41c['params']['id']),'tags':_0x368a12||[]});return{'id':Number(_0x27a41c['params']['id']),'tags':_0x368a12||[]};});}})['then'](respondWithResult(_0x31ab12,null))[_0x0a9e('0x37')](handleError(_0x31ab12,null));};exports[_0x0a9e('0x104')]=function(_0x556344,_0x5c23aa){return db[_0x0a9e('0x43')]['find']({'where':{'id':_0x556344[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x14')](handleEntityNotFound(_0x5c23aa,null))[_0x0a9e('0x14')](function(_0x175c97){if(_0x175c97){return _0x175c97[_0x0a9e('0x104')](_0x556344[_0x0a9e('0x47')]['ids']);}})[_0x0a9e('0x14')](respondWithStatusCode(_0x5c23aa,null))[_0x0a9e('0x37')](handleError(_0x5c23aa,null));};exports['download']=function(_0x44cdb8,_0x1c0d54){var _0x2e0e9b=moment()[_0x0a9e('0x105')]()[_0x0a9e('0x99')]();var _0x2f1cc0=path[_0x0a9e('0xd7')](config['root'],_0x0a9e('0x106'),'files',_0x0a9e('0x107'));var _0xd456e6=path['join'](config[_0x0a9e('0xde')],_0x0a9e('0x106'),'files',_0x0a9e('0x108'));var _0x4e03f5=path[_0x0a9e('0xd7')](_0x2f1cc0,_0x2e0e9b);var _0x9c686f=util['format'](_0x0a9e('0x109'),_0x44cdb8['params']['id'],_0x2e0e9b);var _0x1d046c=path[_0x0a9e('0xd7')](_0x2f1cc0,_0x9c686f);var _0x732141=[];_0x732141[_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':_0x0a9e('0x74'),'attributes':['id',_0x0a9e('0x31')],'raw':!![]});_0x732141['push']({'model':db[_0x0a9e('0xcd')],'as':_0x0a9e('0x69'),'attributes':['id',_0x0a9e('0x10a'),_0x0a9e('0x10b')],'raw':!![]});if(_0x44cdb8[_0x0a9e('0x47')]['attachments']){_0x732141[_0x0a9e('0x36')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3a459c=[{'model':db['ChatMessage'],'as':_0x0a9e('0xe3'),'attributes':['id',_0x0a9e('0x2c'),'createdAt',_0x0a9e('0xee'),_0x0a9e('0xef'),_0x0a9e('0x84')],'include':_0x732141}];_0x3a459c[_0x0a9e('0x36')]({'model':db[_0x0a9e('0xb8')],'as':_0x0a9e('0x10c'),'attributes':['id',_0x0a9e('0x29')]});_0x3a459c[_0x0a9e('0x36')]({'model':db[_0x0a9e('0x74')],'as':'Owner','attributes':['id',_0x0a9e('0x31')]});return db[_0x0a9e('0x43')][_0x0a9e('0x64')]({'where':{'id':_0x44cdb8[_0x0a9e('0xb2')]['id']},'include':_0x3a459c})['then'](handleEntityNotFound(_0x1c0d54,null))[_0x0a9e('0x14')](function(_0x439f25){if(_0x439f25){var _0x333d3c=_0x439f25['get']({'plain':!![]});fs[_0x0a9e('0x10d')](_0x4e03f5);var _0x2191c6={'channel':_0x0a9e('0x10e'),'account':_0x333d3c['Account'][_0x0a9e('0x29')],'agent':_0x333d3c['Owner']?_0x333d3c[_0x0a9e('0x10f')][_0x0a9e('0x31')]:_0x0a9e('0x110'),'createdAt':moment(_0x333d3c[_0x0a9e('0x7c')])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')](),'closedAt':_0x333d3c['closed']?moment(_0x333d3c[_0x0a9e('0x111')])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')]():'','disposition':_0x333d3c[_0x0a9e('0x3f')],'chatInfo':{'browser':_0x333d3c[_0x0a9e('0x112')],'os':_0x333d3c[_0x0a9e('0x113')],'referer':_0x333d3c[_0x0a9e('0x114')],'customerIp':_0x333d3c[_0x0a9e('0x115')],'customerPort':_0x333d3c[_0x0a9e('0x116')]?_0x333d3c[_0x0a9e('0x116')]:_0x0a9e('0x110')},'messages':_(_0x333d3c[_0x0a9e('0xe3')])[_0x0a9e('0x117')]()[_0x0a9e('0x87')]({'secret':![]})[_0x0a9e('0x42')](function(_0x1008a1){if(_0x1008a1[_0x0a9e('0xd3')]){var _0x6276a4=path[_0x0a9e('0xd7')](_0xd456e6,_0x1008a1[_0x0a9e('0xd3')][_0x0a9e('0xda')]);if(fs[_0x0a9e('0x118')](_0x6276a4)){fs['createReadStream'](_0x6276a4)[_0x0a9e('0x119')](fs[_0x0a9e('0x11a')](path[_0x0a9e('0xd7')](_0x4e03f5,_0x1008a1['Attachment'][_0x0a9e('0xda')])));}}return{'date':moment(_0x1008a1['createdAt'])[_0x0a9e('0xe0')](_0x0a9e('0xfd'))[_0x0a9e('0x99')](),'sender':_0x1008a1[_0x0a9e('0xee')]===_0x0a9e('0xc8')?_0x1008a1[_0x0a9e('0x74')]?_0x1008a1[_0x0a9e('0x74')][_0x0a9e('0x31')]:'System':_0x1008a1[_0x0a9e('0x69')][_0x0a9e('0x10a')]+(_0x1008a1['Contact'][_0x0a9e('0x10b')]?'\x20'+_0x1008a1[_0x0a9e('0x69')][_0x0a9e('0x10b')]:''),'body':_0x1008a1['Attachment']?_0x1008a1[_0x0a9e('0xd3')][_0x0a9e('0xda')]:_0x1008a1[_0x0a9e('0x2c')],'direction':_0x1008a1[_0x0a9e('0xee')]==='out'?'A':'C','secret':_0x1008a1[_0x0a9e('0xef')],'read':_0x1008a1[_0x0a9e('0x84')],'attachment':_0x1008a1[_0x0a9e('0xd3')]};})[_0x0a9e('0x6b')]()};return ejs[_0x0a9e('0x11b')](path['join'](config[_0x0a9e('0xde')],_0x0a9e('0x106'),'views',_0x0a9e('0x11c')),{'interaction':_0x2191c6})[_0x0a9e('0x14')](function(_0x38284a){var _0x54246a=path['join'](_0x4e03f5,_0x0a9e('0x11d')+_0x333d3c['id']+'-'+_0x2e0e9b+_0x0a9e('0x11e'));var _0x271485={'path':_0x54246a,'channel':_0x0a9e('0x10e'),'interactionId':_0x333d3c['id']};return pdf[_0x0a9e('0x11f')](_0x38284a,_0x271485);})[_0x0a9e('0x14')](function(){return new Promise(function(_0x312e02,_0x221274){zipdir(_0x4e03f5,{'saveTo':_0x1d046c},function(_0x54c9d6,_0x5cc8cb){if(_0x54c9d6)return _0x221274(_0x54c9d6);return _0x312e02(_0x5cc8cb);});})[_0x0a9e('0x14')](function(){return new BPromise(function(_0x5330c2,_0x803bc){rimraf(_0x4e03f5,function(_0xef29b6){if(_0xef29b6)_0x803bc(_0xef29b6);return _0x5330c2();});});})[_0x0a9e('0x14')](function(){return _0x1c0d54[_0x0a9e('0xdb')](_0x1d046c,_0x9c686f,function(_0x57b11b){if(_0x57b11b){logger[_0x0a9e('0x19')](_0x0a9e('0x120'),_0x57b11b);}else{fs['unlinkSync'](_0x1d046c);}});});});}else{return _0x1c0d54[_0x0a9e('0x1c')](0xc8);}})['catch'](handleError(_0x1c0d54,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 6abc940..005418e 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 _0xbd5d=['findAll','then','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove','Users','map'];(function(_0x2c5ae8,_0x37a995){var _0x509aed=function(_0x930d5c){while(--_0x930d5c){_0x2c5ae8['push'](_0x2c5ae8['shift']());}};_0x509aed(++_0x37a995);}(_0xbd5d,0x155));var _0xdbd5=function(_0x53ec20,_0xe31414){_0x53ec20=_0x53ec20-0x0;var _0x1bda27=_0xbd5d[_0x53ec20];return _0x1bda27;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xdbd5('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xdbd5('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdbd5('0x1')](0x0);var events={'afterCreate':_0xdbd5('0x2'),'afterUpdate':_0xdbd5('0x3'),'afterDestroy':_0xdbd5('0x4')};function emitEvent(_0xd32a05){return function(_0x27a166,_0x57360c,_0x3b7dc3){_0x27a166['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x103d11){_0x27a166['setDataValue'](_0xdbd5('0x5'),_0x103d11[_0xdbd5('0x6')](function(_0x26228c){return{'id':_0x26228c['id']};}));return ChatMessage[_0xdbd5('0x7')]({'where':{'ChatInteractionId':_0x27a166['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdbd5('0x8')](function(_0x5525c9){_0x27a166['setDataValue']('unreadMessages',_0x5525c9['length']);ChatInteractionEvents['emit'](_0xd32a05+':'+_0x27a166['id'],_0x27a166);ChatInteractionEvents[_0xdbd5('0x9')](_0xd32a05,_0x27a166);_0x3b7dc3(null);})['catch'](_0x3b7dc3(null));};}for(var e in events){if(events[_0xdbd5('0xa')](e)){var event=events[e];ChatInteraction[_0xdbd5('0xb')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xd168=['remove','getUsers','setDataValue','Users','map','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update'];(function(_0x2ead1f,_0x38e9d2){var _0x270818=function(_0x2a3953){while(--_0x2a3953){_0x2ead1f['push'](_0x2ead1f['shift']());}};_0x270818(++_0x38e9d2);}(_0xd168,0x188));var _0x8d16=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xd168[_0x2b7764];return _0x848dcb;};'use strict';var EventEmitter=require(_0x8d16('0x0'));var ChatInteraction=require(_0x8d16('0x1'))['db'][_0x8d16('0x2')];var ChatMessage=require(_0x8d16('0x1'))['db'][_0x8d16('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8d16('0x4')](0x0);var events={'afterCreate':_0x8d16('0x5'),'afterUpdate':_0x8d16('0x6'),'afterDestroy':_0x8d16('0x7')};function emitEvent(_0x431a62){return function(_0xf65615,_0xfc4385,_0x2c0c66){_0xf65615[_0x8d16('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x523893){_0xf65615[_0x8d16('0x9')](_0x8d16('0xa'),_0x523893[_0x8d16('0xb')](function(_0xb59dc){return{'id':_0xb59dc['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xf65615['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8d16('0xc')](function(_0x29f91e){_0xf65615[_0x8d16('0x9')]('unreadMessages',_0x29f91e[_0x8d16('0xd')]);ChatInteractionEvents[_0x8d16('0xe')](_0x431a62+':'+_0xf65615['id'],_0xf65615);ChatInteractionEvents[_0x8d16('0xe')](_0x431a62,_0xf65615);_0x2c0c66(null);})[_0x8d16('0xf')](_0x2c0c66(null));};}for(var e in events){if(events[_0x8d16('0x10')](e)){var event=events[e];ChatInteraction[_0x8d16('0x11')](e,emitEvent(event));}}module[_0x8d16('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b36df20..575375c 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 _0x1b32=['utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x1b32,0x1a5));var _0x21b3=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x1b32[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x21b3('0x0'));var util=require('util');var logger=require(_0x21b3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21b3('0x4'));var config=require(_0x21b3('0x5'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x305fcd,_0xb0a5c9){return _0x305fcd[_0x21b3('0x6')](_0x21b3('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e05e1,_0x31f2ef,_0x4f9ec7){if(_0x3e05e1[_0x21b3('0x8')](_0x21b3('0x9'))){_0x3e05e1[_0x21b3('0xa')]=moment()['format'](_0x21b3('0xb'));}_0x4f9ec7(null,_0x3e05e1);}},'charset':_0x21b3('0xc'),'collate':_0x21b3('0xd')});}; \ No newline at end of file +var _0x8432=['api','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','utf8mb4_unicode_ci','util'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0x8432,0xb3));var _0x2843=function(_0x55e839,_0x3b5345){_0x55e839=_0x55e839-0x0;var _0x39c61a=_0x8432[_0x55e839];return _0x39c61a;};'use strict';var _=require('lodash');var util=require(_0x2843('0x0'));var logger=require('../../config/logger')(_0x2843('0x1'));var moment=require('moment');var BPromise=require(_0x2843('0x2'));var rp=require(_0x2843('0x3'));var fs=require('fs');var path=require(_0x2843('0x4'));var rimraf=require('rimraf');var config=require(_0x2843('0x5'));var attributes=require(_0x2843('0x6'));module[_0x2843('0x7')]=function(_0x36911a,_0x256435){return _0x36911a[_0x2843('0x8')]('ChatInteraction',attributes,{'tableName':_0x2843('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56363f,_0x1c8109,_0x4fe58f){if(_0x56363f[_0x2843('0xa')](_0x2843('0xb'))){_0x56363f[_0x2843('0xc')]=moment()[_0x2843('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4fe58f(null,_0x56363f);}},'charset':'utf8mb4','collate':_0x2843('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 8f7ccad..1d1faff 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 _0x0546=['then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','update','options','where','limit','UpdateChatInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x1b28f4,_0x39829b){var _0x169593=function(_0xf552e1){while(--_0xf552e1){_0x1b28f4['push'](_0x1b28f4['shift']());}};_0x169593(++_0x39829b);}(_0x0546,0x151));var _0x6054=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0x0546[_0x11ba83];return _0x3f3925;};'use strict';var _=require(_0x6054('0x0'));var util=require(_0x6054('0x1'));var moment=require(_0x6054('0x2'));var BPromise=require(_0x6054('0x3'));var rs=require(_0x6054('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6054('0x5'))['db'];var utils=require(_0x6054('0x6'));var logger=require('../../config/logger')(_0x6054('0x7'));var config=require(_0x6054('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6054('0x9')](config[_0x6054('0xa')],{'host':_0x6054('0xb'),'port':0x18eb});var socket=require(_0x6054('0xc'))(new Redis(config[_0x6054('0xa')]));require(_0x6054('0xd'))['register'](socket);function respondWithRpcPromise(_0x447d8a,_0x20ac41,_0x43722a){return new BPromise(function(_0x4ce797,_0x33e19d){return client['request'](_0x447d8a,_0x43722a)[_0x6054('0xe')](function(_0x4c2d4a){logger[_0x6054('0xf')](_0x6054('0x10'),_0x20ac41,_0x6054('0x11'));logger[_0x6054('0x12')](_0x6054('0x13'),_0x20ac41,_0x6054('0x11'),JSON[_0x6054('0x14')](_0x4c2d4a));if(_0x4c2d4a[_0x6054('0x15')]){if(_0x4c2d4a[_0x6054('0x15')][_0x6054('0x16')]===0x1f4){logger[_0x6054('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x20ac41,_0x4c2d4a[_0x6054('0x15')][_0x6054('0x17')]);return _0x33e19d(_0x4c2d4a[_0x6054('0x15')][_0x6054('0x17')]);}logger[_0x6054('0x15')](_0x6054('0x10'),_0x20ac41,_0x4c2d4a[_0x6054('0x15')][_0x6054('0x17')]);return _0x4ce797(_0x4c2d4a[_0x6054('0x15')][_0x6054('0x17')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x20ac41,_0x6054('0x11'));_0x4ce797(_0x4c2d4a[_0x6054('0x18')][_0x6054('0x17')]);}})[_0x6054('0x19')](function(_0x5122f8){logger[_0x6054('0x15')](_0x6054('0x10'),_0x20ac41,_0x5122f8);_0x33e19d(_0x5122f8);});});}exports['UpdateChatInteraction']=function(_0x43344d){var _0x2c3768=this;return new Promise(function(_0xf42e45,_0x152a2e){return db[_0x6054('0x1a')][_0x6054('0x1b')](_0x43344d['body'],{'raw':_0x43344d[_0x6054('0x1c')]?_0x43344d[_0x6054('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43344d[_0x6054('0x1c')]?_0x43344d['options'][_0x6054('0x1d')]||null:null,'attributes':_0x43344d[_0x6054('0x1c')]?_0x43344d[_0x6054('0x1c')]['attributes']||null:null,'limit':_0x43344d[_0x6054('0x1c')]?_0x43344d[_0x6054('0x1c')][_0x6054('0x1e')]||null:null})[_0x6054('0xe')](function(_0x5cc7e8){logger[_0x6054('0xf')](_0x6054('0x1f'),_0x43344d);logger[_0x6054('0x12')]('UpdateChatInteraction',_0x43344d,JSON[_0x6054('0x14')](_0x5cc7e8));_0xf42e45(_0x5cc7e8);})[_0x6054('0x19')](function(_0x4ef7d6){logger[_0x6054('0x15')](_0x6054('0x1f'),_0x4ef7d6[_0x6054('0x17')],_0x43344d);_0x152a2e(_0x2c3768[_0x6054('0x15')](0x1f4,_0x4ef7d6[_0x6054('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x2ef5da){return new Promise(function(_0x58e333,_0x1d77a6){return db[_0x6054('0x1a')][_0x6054('0x20')]({'where':_0x2ef5da[_0x6054('0x1c')]?_0x2ef5da['options'][_0x6054('0x1d')]||null:null})['then'](function(_0x91b609){if(_0x91b609){return _0x91b609[_0x6054('0x21')](_0x2ef5da[_0x6054('0x22')][_0x6054('0x23')],_[_0x6054('0x24')](_0x2ef5da[_0x6054('0x22')],['ids','id'])||{});}})[_0x6054('0x25')](function(_0x1bbcc9){logger[_0x6054('0xf')](_0x6054('0x26'),_0x2ef5da);logger['debug'](_0x6054('0x26'),_0x2ef5da,JSON[_0x6054('0x14')](_0x1bbcc9));_0x58e333(_0x1bbcc9);})[_0x6054('0x19')](function(_0x17687a){logger['error'](_0x6054('0x26'),_0x17687a['message'],_0x2ef5da);_0x1d77a6(_this[_0x6054('0x15')](0x1f4,_0x17687a[_0x6054('0x17')]));});});}; \ No newline at end of file +var _0x8480=['request\x20sent','stringify','error','code','message','result','catch','ChatInteraction','body','options','where','limit','debug','UpdateChatInteraction','AddTagsToChatInteraction','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8480,0xd0));var _0x0848=function(_0x175966,_0x403f3a){_0x175966=_0x175966-0x0;var _0x577f27=_0x8480[_0x175966];return _0x577f27;};'use strict';var _=require(_0x0848('0x0'));var util=require('util');var moment=require(_0x0848('0x1'));var BPromise=require(_0x0848('0x2'));var rs=require(_0x0848('0x3'));var fs=require('fs');var Redis=require(_0x0848('0x4'));var db=require(_0x0848('0x5'))['db'];var utils=require(_0x0848('0x6'));var logger=require(_0x0848('0x7'))(_0x0848('0x8'));var config=require('../../config/environment');var jayson=require(_0x0848('0x9'));var client=jayson[_0x0848('0xa')][_0x0848('0xb')]({'port':0x232a});config[_0x0848('0xc')]=_[_0x0848('0xd')](config['redis'],{'host':_0x0848('0xe'),'port':0x18eb});var socket=require(_0x0848('0xf'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5d2b98,_0x479653,_0x4e10f0){return new BPromise(function(_0x257656,_0x158a3b){return client[_0x0848('0x10')](_0x5d2b98,_0x4e10f0)[_0x0848('0x11')](function(_0x493f55){logger[_0x0848('0x12')](_0x0848('0x13'),_0x479653,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x479653,_0x0848('0x14'),JSON[_0x0848('0x15')](_0x493f55));if(_0x493f55['error']){if(_0x493f55[_0x0848('0x16')][_0x0848('0x17')]===0x1f4){logger[_0x0848('0x16')](_0x0848('0x13'),_0x479653,_0x493f55[_0x0848('0x16')][_0x0848('0x18')]);return _0x158a3b(_0x493f55[_0x0848('0x16')][_0x0848('0x18')]);}logger[_0x0848('0x16')](_0x0848('0x13'),_0x479653,_0x493f55[_0x0848('0x16')][_0x0848('0x18')]);return _0x257656(_0x493f55['error'][_0x0848('0x18')]);}else{logger[_0x0848('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x479653,_0x0848('0x14'));_0x257656(_0x493f55[_0x0848('0x19')]['message']);}})[_0x0848('0x1a')](function(_0x330f48){logger[_0x0848('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x479653,_0x330f48);_0x158a3b(_0x330f48);});});}exports['UpdateChatInteraction']=function(_0x6db22c){var _0x47e465=this;return new Promise(function(_0x2867f7,_0x457a7d){return db[_0x0848('0x1b')]['update'](_0x6db22c[_0x0848('0x1c')],{'raw':_0x6db22c[_0x0848('0x1d')]?_0x6db22c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6db22c[_0x0848('0x1d')]?_0x6db22c['options'][_0x0848('0x1e')]||null:null,'attributes':_0x6db22c[_0x0848('0x1d')]?_0x6db22c[_0x0848('0x1d')]['attributes']||null:null,'limit':_0x6db22c['options']?_0x6db22c[_0x0848('0x1d')][_0x0848('0x1f')]||null:null})[_0x0848('0x11')](function(_0x347be0){logger[_0x0848('0x12')]('UpdateChatInteraction',_0x6db22c);logger[_0x0848('0x20')](_0x0848('0x21'),_0x6db22c,JSON[_0x0848('0x15')](_0x347be0));_0x2867f7(_0x347be0);})[_0x0848('0x1a')](function(_0x57ab4f){logger[_0x0848('0x16')](_0x0848('0x21'),_0x57ab4f[_0x0848('0x18')],_0x6db22c);_0x457a7d(_0x47e465[_0x0848('0x16')](0x1f4,_0x57ab4f[_0x0848('0x18')]));});});};exports[_0x0848('0x22')]=function(_0x49b9d8){return new Promise(function(_0x436ca3,_0x4c8b19){return db[_0x0848('0x1b')]['find']({'where':_0x49b9d8[_0x0848('0x1d')]?_0x49b9d8[_0x0848('0x1d')][_0x0848('0x1e')]||null:null})[_0x0848('0x11')](function(_0x10d611){if(_0x10d611){return _0x10d611['addTags'](_0x49b9d8[_0x0848('0x1c')][_0x0848('0x23')],_[_0x0848('0x24')](_0x49b9d8[_0x0848('0x1c')],[_0x0848('0x23'),'id'])||{});}})['spread'](function(_0x43a0a0){logger[_0x0848('0x12')](_0x0848('0x25'),_0x49b9d8);logger['debug']('AddTags',_0x49b9d8,JSON[_0x0848('0x15')](_0x43a0a0));_0x436ca3(_0x43a0a0);})[_0x0848('0x1a')](function(_0x118374){logger[_0x0848('0x16')]('AddTags',_0x118374['message'],_0x49b9d8);_0x4c8b19(_this[_0x0848('0x16')](0x1f4,_0x118374[_0x0848('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0f19bbe..f6048c1 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 _0x5b89=['save','update','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x443517,_0x22e72e){var _0x49cfce=function(_0x4f8a2){while(--_0x4f8a2){_0x443517['push'](_0x443517['shift']());}};_0x49cfce(++_0x22e72e);}(_0x5b89,0xdd));var _0x95b8=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x5b89[_0x29df9a];return _0x3a8e96;};'use strict';var ChatInteractionEvents=require(_0x95b8('0x0'));var events=[_0x95b8('0x1'),'remove',_0x95b8('0x2')];function createListener(_0x5b6e93,_0x5b3fc0){return function(_0x568b69){_0x5b3fc0['emit'](_0x5b6e93,_0x568b69);};}function removeListener(_0x5615b5,_0x3aba85){return function(){ChatInteractionEvents[_0x95b8('0x3')](_0x5615b5,_0x3aba85);};}exports['register']=function(_0x569c09){for(var _0x5b50f8=0x0,_0x579727=events[_0x95b8('0x4')];_0x5b50f8<_0x579727;_0x5b50f8++){var _0x4d1d01=events[_0x5b50f8];var _0x34ee14=createListener(_0x95b8('0x5')+_0x4d1d01,_0x569c09);ChatInteractionEvents['on'](_0x4d1d01,_0x34ee14);}}; \ No newline at end of file +var _0x193c=['remove','update','removeListener','register','length','./chatInteraction.events','save'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0x193c,0x1d3));var _0xc193=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x193c[_0x3bf83f];return _0x22c4a9;};'use strict';var ChatInteractionEvents=require(_0xc193('0x0'));var events=[_0xc193('0x1'),_0xc193('0x2'),_0xc193('0x3')];function createListener(_0x442f7e,_0x562397){return function(_0x54ba13){_0x562397['emit'](_0x442f7e,_0x54ba13);};}function removeListener(_0x49bc59,_0x466508){return function(){ChatInteractionEvents[_0xc193('0x4')](_0x49bc59,_0x466508);};}exports[_0xc193('0x5')]=function(_0x91faef){for(var _0x2f101e=0x0,_0x31cbc0=events[_0xc193('0x6')];_0x2f101e<_0x31cbc0;_0x2f101e++){var _0x139766=events[_0x2f101e];var _0x4bece9=createListener('chatInteraction:'+_0x139766,_0x91faef);ChatInteractionEvents['on'](_0x139766,_0x4bece9);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3031db9..bf8c85b 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 _0x9a46=['update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/my_messages','download','post','/:id/vidaoo','diskStorage','server/files/attachments/','format','%s-%s','now','originalname','replace','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update'];(function(_0x573f91,_0x411c67){var _0xbca4e4=function(_0x540b7d){while(--_0x540b7d){_0x573f91['push'](_0x573f91['shift']());}};_0xbca4e4(++_0x411c67);}(_0x9a46,0x161));var _0x69a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9a46[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x69a4('0x0'));var util=require(_0x69a4('0x1'));var path=require(_0x69a4('0x2'));var timeout=require(_0x69a4('0x3'));var express=require('express');var router=express[_0x69a4('0x4')]();var fs_extra=require(_0x69a4('0x5'));var auth=require(_0x69a4('0x6'));var interaction=require(_0x69a4('0x7'));var config=require('../../config/environment');var controller=require(_0x69a4('0x8'));router[_0x69a4('0x9')]('/',auth[_0x69a4('0xa')](),controller[_0x69a4('0xb')]);router[_0x69a4('0x9')](_0x69a4('0xc'),auth[_0x69a4('0xa')](),controller[_0x69a4('0xd')]);router[_0x69a4('0x9')]('/:id',auth[_0x69a4('0xe')](),controller[_0x69a4('0xf')]);router[_0x69a4('0x9')](_0x69a4('0x10'),auth[_0x69a4('0xe')](),controller['attachmentDownload']);router[_0x69a4('0x9')]('/:id/messages',auth[_0x69a4('0xa')](),controller['getMessages']);router[_0x69a4('0x9')](_0x69a4('0x11'),auth[_0x69a4('0xe')](),controller['getMyMessages']);router[_0x69a4('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x69a4('0x12')]);router[_0x69a4('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x69a4('0x13')](_0x69a4('0x14'),auth[_0x69a4('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x69a4('0x15')]({'destination':function(_0x167ce6,_0x52761e,_0x47a0ac){_0x47a0ac(null,path['join'](config['root'],_0x69a4('0x16')));},'filename':function(_0x3e05dd,_0x1ea953,_0x3738b0){_0x3738b0(null,util[_0x69a4('0x17')](_0x69a4('0x18'),Date[_0x69a4('0x19')](),_0x1ea953[_0x69a4('0x1a')][_0x69a4('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x69a4('0x13')]('/:id/attachment_upload',upload['single'](_0x69a4('0x1c')),controller[_0x69a4('0x1d')]);router['post'](_0x69a4('0x1e'),auth[_0x69a4('0xe')](),controller[_0x69a4('0x1f')]);router[_0x69a4('0x13')](_0x69a4('0x20'),auth[_0x69a4('0xa')](),interaction[_0x69a4('0x21')](_0x69a4('0x22'),'chatinteraction:addtags'),controller[_0x69a4('0x23')]);router[_0x69a4('0x24')](_0x69a4('0x25'),auth[_0x69a4('0xa')](),interaction[_0x69a4('0x21')](_0x69a4('0x22'),_0x69a4('0x26')),controller[_0x69a4('0x27')]);router['put'](_0x69a4('0x28'),controller[_0x69a4('0x29')]);router[_0x69a4('0x24')]('/:id/abandon',auth[_0x69a4('0xe')](),controller[_0x69a4('0x2a')]);router[_0x69a4('0x24')](_0x69a4('0x2b'),controller[_0x69a4('0x2c')]);router[_0x69a4('0x2d')](_0x69a4('0x25'),auth[_0x69a4('0xa')](),interaction['tracked']('chat',_0x69a4('0x2e')),controller['destroy']);router[_0x69a4('0x2d')](_0x69a4('0x20'),auth['isAuthenticated'](),controller[_0x69a4('0x2f')]);module[_0x69a4('0x30')]=router; \ No newline at end of file +var _0x21f0=['/:id/close','close','delete','destroy','/:id/tags','removeTags','path','Router','../../components/interaction/service','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','format','%s-%s','now','/:id/attachment_upload','single','file','addMessage','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x21f0,0xc6));var _0x021f=function(_0x3befe4,_0x14ef5d){_0x3befe4=_0x3befe4-0x0;var _0x3a9bec=_0x21f0[_0x3befe4];return _0x3a9bec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x021f('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x021f('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x021f('0x2'));var config=require('../../config/environment');var controller=require(_0x021f('0x3'));router[_0x021f('0x4')]('/',auth['isAuthenticated'](),controller[_0x021f('0x5')]);router[_0x021f('0x4')](_0x021f('0x6'),auth[_0x021f('0x7')](),controller[_0x021f('0x8')]);router['get'](_0x021f('0x9'),auth[_0x021f('0xa')](),controller[_0x021f('0xb')]);router[_0x021f('0x4')](_0x021f('0xc'),auth[_0x021f('0xa')](),controller[_0x021f('0xd')]);router[_0x021f('0x4')](_0x021f('0xe'),auth[_0x021f('0x7')](),controller[_0x021f('0xf')]);router[_0x021f('0x4')](_0x021f('0x10'),auth[_0x021f('0xa')](),controller[_0x021f('0x11')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x021f('0x12')]);router[_0x021f('0x13')]('/',auth[_0x021f('0x7')](),controller[_0x021f('0x14')]);router[_0x021f('0x13')](_0x021f('0x15'),auth[_0x021f('0x7')](),controller[_0x021f('0x16')]);var upload=multer({'storage':multer[_0x021f('0x17')]({'destination':function(_0x37256d,_0x203898,_0x33dbcf){_0x33dbcf(null,path['join'](config[_0x021f('0x18')],'server/files/attachments/'));},'filename':function(_0x1a6241,_0x2ba8cc,_0x5dbf50){_0x5dbf50(null,util[_0x021f('0x19')](_0x021f('0x1a'),Date[_0x021f('0x1b')](),_0x2ba8cc['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x021f('0x13')](_0x021f('0x1c'),upload[_0x021f('0x1d')](_0x021f('0x1e')),controller['attachmentUpload']);router['post'](_0x021f('0xe'),auth[_0x021f('0xa')](),controller[_0x021f('0x1f')]);router['post']('/:id/tags',auth[_0x021f('0x7')](),interaction[_0x021f('0x20')](_0x021f('0x21'),_0x021f('0x22')),controller[_0x021f('0x23')]);router['put'](_0x021f('0x9'),auth[_0x021f('0x7')](),interaction['tracked'](_0x021f('0x21'),_0x021f('0x24')),controller[_0x021f('0x25')]);router[_0x021f('0x26')]('/:id/custom_update',controller[_0x021f('0x27')]);router['put'](_0x021f('0x28'),auth[_0x021f('0xa')](),controller[_0x021f('0x29')]);router[_0x021f('0x26')](_0x021f('0x2a'),controller[_0x021f('0x2b')]);router[_0x021f('0x2c')](_0x021f('0x9'),auth[_0x021f('0x7')](),interaction['tracked'](_0x021f('0x21'),'chatinteraction:destroy'),controller[_0x021f('0x2d')]);router[_0x021f('0x2c')](_0x021f('0x2e'),auth[_0x021f('0x7')](),controller[_0x021f('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 37c8343..6ce76ed 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 _0x7108=['sequelize','exports','TEXT','medium','INTEGER'];(function(_0x1d16fc,_0xe56c15){var _0x2c84bc=function(_0x2f2168){while(--_0x2f2168){_0x1d16fc['push'](_0x1d16fc['shift']());}};_0x2c84bc(++_0xe56c15);}(_0x7108,0x64));var _0x8710=function(_0x2161bf,_0x59acd9){_0x2161bf=_0x2161bf-0x0;var _0x11e3bb=_0x7108[_0x2161bf];return _0x11e3bb;};'use strict';var Sequelize=require(_0x8710('0x0'));module[_0x8710('0x1')]={'body':{'type':Sequelize[_0x8710('0x2')](_0x8710('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8710('0x4')]}}; \ No newline at end of file +var _0xff36=['sequelize','exports','TEXT','medium','INTEGER'];(function(_0xd93277,_0xacc500){var _0x2cf9d1=function(_0x17830){while(--_0x17830){_0xd93277['push'](_0xd93277['shift']());}};_0x2cf9d1(++_0xacc500);}(_0xff36,0x104));var _0x6ff3=function(_0x3d356a,_0x2bddd6){_0x3d356a=_0x3d356a-0x0;var _0x2968c3=_0xff36[_0x3d356a];return _0x2968c3;};'use strict';var Sequelize=require(_0x6ff3('0x0'));module[_0x6ff3('0x1')]={'body':{'type':Sequelize[_0x6ff3('0x2')](_0x6ff3('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6ff3('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e83d75f..459331a 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 _0xcc24=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','then','destroy','end','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','get','messages','lastMessageAt','format','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','ToId','read','all','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring'];(function(_0x333a6c,_0x5d4ccd){var _0x5f0592=function(_0x26d4c6){while(--_0x26d4c6){_0x333a6c['push'](_0x333a6c['shift']());}};_0x5f0592(++_0x5d4ccd);}(_0xcc24,0x19b));var _0x4cc2=function(_0x4119a6,_0x548d9c){_0x4119a6=_0x4119a6-0x0;var _0x44c928=_0xcc24[_0x4119a6];return _0x44c928;};'use strict';var emlformat=require(_0x4cc2('0x0'));var rimraf=require(_0x4cc2('0x1'));var zipdir=require(_0x4cc2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4cc2('0x3'));var BPromise=require(_0x4cc2('0x4'));var Mustache=require(_0x4cc2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4cc2('0x6'));var csv=require(_0x4cc2('0x7'));var ejs=require(_0x4cc2('0x8'));var fs=require('fs');var fs_extra=require(_0x4cc2('0x9'));var _=require(_0x4cc2('0xa'));var squel=require('squel');var crypto=require(_0x4cc2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4cc2('0x7'));var querystring=require(_0x4cc2('0xc'));var Papa=require(_0x4cc2('0xd'));var Redis=require('ioredis');var authService=require(_0x4cc2('0xe'));var qs=require(_0x4cc2('0xf'));var as=require(_0x4cc2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4cc2('0x11'))(_0x4cc2('0x12'));var utils=require(_0x4cc2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4cc2('0x14'));var db=require(_0x4cc2('0x15'))['db'];config['redis']=_[_0x4cc2('0x16')](config[_0x4cc2('0x17')],{'host':_0x4cc2('0x18'),'port':0x18eb});var socket=require(_0x4cc2('0x19'))(new Redis(config[_0x4cc2('0x17')]));require(_0x4cc2('0x1a'))[_0x4cc2('0x1b')](socket);function respondWithStatusCode(_0x26373c,_0x3681f2){_0x3681f2=_0x3681f2||0xcc;return function(_0x36768f){if(_0x36768f){return _0x26373c[_0x4cc2('0x1c')](_0x3681f2);}return _0x26373c[_0x4cc2('0x1d')](_0x3681f2)['end']();};}function respondWithResult(_0x2a4e82,_0x2ef37b){_0x2ef37b=_0x2ef37b||0xc8;return function(_0x4157ce){if(_0x4157ce){return _0x2a4e82[_0x4cc2('0x1d')](_0x2ef37b)[_0x4cc2('0x1e')](_0x4157ce);}};}function respondWithFilteredResult(_0x1cf35f,_0x928ac6){return function(_0x40936a){if(_0x40936a){var _0x3a1d8f=typeof _0x928ac6[_0x4cc2('0x1f')]===_0x4cc2('0x20')&&typeof _0x928ac6['limit']===_0x4cc2('0x20');var _0x38ec5d=_0x40936a['count'];var _0x55af6a=_0x3a1d8f?0x0:_0x928ac6[_0x4cc2('0x1f')];var _0x4a6137=_0x3a1d8f?_0x40936a[_0x4cc2('0x21')]:_0x928ac6['offset']+_0x928ac6['limit'];var _0x7480af;if(_0x4a6137>=_0x38ec5d){_0x4a6137=_0x38ec5d;_0x7480af=0xc8;}else{_0x7480af=0xce;}_0x1cf35f[_0x4cc2('0x1d')](_0x7480af);return _0x1cf35f[_0x4cc2('0x22')](_0x4cc2('0x23'),_0x55af6a+'-'+_0x4a6137+'/'+_0x38ec5d)['json'](_0x40936a);}return null;};}function patchUpdates(_0x300954){return function(_0x4607f7){try{jsonpatch['apply'](_0x4607f7,_0x300954,!![]);}catch(_0x466212){return BPromise[_0x4cc2('0x24')](_0x466212);}return _0x4607f7['save']();};}function saveUpdates(_0x1a0a98,_0x1a1f0c){return function(_0x414a25){if(_0x414a25){return _0x414a25['update'](_0x1a0a98)[_0x4cc2('0x25')](function(_0x366491){return _0x366491;});}return null;};}function removeEntity(_0x41e8f4,_0x843de){return function(_0x43a71f){if(_0x43a71f){return _0x43a71f[_0x4cc2('0x26')]()['then'](function(){_0x41e8f4['status'](0xcc)[_0x4cc2('0x27')]();});}};}function handleEntityNotFound(_0x53fe2e,_0x535130){return function(_0x286364){if(!_0x286364){_0x53fe2e[_0x4cc2('0x1c')](0x194);}return _0x286364;};}function handleError(_0x39c212,_0x469b7d){_0x469b7d=_0x469b7d||0x1f4;return function(_0x5469d9){logger[_0x4cc2('0x28')](_0x5469d9[_0x4cc2('0x29')]);if(_0x5469d9[_0x4cc2('0x2a')]){delete _0x5469d9[_0x4cc2('0x2a')];}_0x39c212[_0x4cc2('0x1d')](_0x469b7d)[_0x4cc2('0x2b')](_0x5469d9);};}exports['index']=function(_0xa72bad,_0x55e622){var _0x4ea48d={},_0x434f81={},_0x4a8ef5={'count':0x0,'rows':[]};var _0x2abe92=_[_0x4cc2('0x2c')](db[_0x4cc2('0x2d')][_0x4cc2('0x2e')],function(_0x2c6a8e){return{'name':_0x2c6a8e[_0x4cc2('0x2f')],'type':_0x2c6a8e[_0x4cc2('0x30')][_0x4cc2('0x31')]};});_0x434f81[_0x4cc2('0x32')]=_['map'](_0x2abe92,_0x4cc2('0x2a'));_0x434f81[_0x4cc2('0x33')]=_[_0x4cc2('0x34')](_0xa72bad[_0x4cc2('0x33')]);_0x434f81['filters']=_['intersection'](_0x434f81['model'],_0x434f81['query']);_0x4ea48d['attributes']=_[_0x4cc2('0x35')](_0x434f81['model'],qs[_0x4cc2('0x36')](_0xa72bad[_0x4cc2('0x33')][_0x4cc2('0x36')]));_0x4ea48d[_0x4cc2('0x37')]=_0x4ea48d[_0x4cc2('0x37')][_0x4cc2('0x38')]?_0x4ea48d['attributes']:_0x434f81['model'];if(!_0xa72bad[_0x4cc2('0x33')]['hasOwnProperty'](_0x4cc2('0x39'))){_0x4ea48d['limit']=qs[_0x4cc2('0x3a')](_0xa72bad[_0x4cc2('0x33')][_0x4cc2('0x3a')]);_0x4ea48d[_0x4cc2('0x1f')]=qs[_0x4cc2('0x1f')](_0xa72bad[_0x4cc2('0x33')][_0x4cc2('0x1f')]);}_0x4ea48d['order']=qs['sort'](_0xa72bad[_0x4cc2('0x33')][_0x4cc2('0x3b')]);_0x4ea48d[_0x4cc2('0x3c')]=qs[_0x4cc2('0x3d')](_[_0x4cc2('0x3e')](_0xa72bad[_0x4cc2('0x33')],_0x434f81[_0x4cc2('0x3d')]),_0x2abe92);if(_0xa72bad[_0x4cc2('0x33')][_0x4cc2('0x3f')]){_0x4ea48d[_0x4cc2('0x3c')]=_['merge'](_0x4ea48d['where'],{'$or':_['map'](_0x2abe92,function(_0x116868){if(_0x116868['type']!==_0x4cc2('0x40')){var _0x100ef3={};_0x100ef3[_0x116868[_0x4cc2('0x2a')]]={'$like':'%'+_0xa72bad[_0x4cc2('0x33')][_0x4cc2('0x3f')]+'%'};return _0x100ef3;}})});}_0x4ea48d=_['merge']({},_0x4ea48d,_0xa72bad[_0x4cc2('0x41')]);var _0x21fe45={'where':_0x4ea48d['where']};return db[_0x4cc2('0x2d')][_0x4cc2('0x21')](_0x21fe45)[_0x4cc2('0x25')](function(_0x5f3470){_0x4a8ef5[_0x4cc2('0x21')]=_0x5f3470;if(_0xa72bad['query'][_0x4cc2('0x42')]){_0x4ea48d[_0x4cc2('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x4cc2('0x44')](_0x4ea48d);})[_0x4cc2('0x25')](function(_0x43cde8){_0x4a8ef5[_0x4cc2('0x45')]=_0x43cde8;return _0x4a8ef5;})[_0x4cc2('0x25')](respondWithFilteredResult(_0x55e622,_0x4ea48d))[_0x4cc2('0x46')](handleError(_0x55e622,null));};exports['show']=function(_0xa83f89,_0x10213d){var _0x220945={'raw':!![],'where':{'id':_0xa83f89[_0x4cc2('0x47')]['id']}},_0x944967={};_0x944967['model']=_[_0x4cc2('0x34')](db[_0x4cc2('0x2d')][_0x4cc2('0x2e')]);_0x944967[_0x4cc2('0x33')]=_[_0x4cc2('0x34')](_0xa83f89[_0x4cc2('0x33')]);_0x944967[_0x4cc2('0x3d')]=_[_0x4cc2('0x35')](_0x944967[_0x4cc2('0x32')],_0x944967[_0x4cc2('0x33')]);_0x220945[_0x4cc2('0x37')]=_[_0x4cc2('0x35')](_0x944967['model'],qs[_0x4cc2('0x36')](_0xa83f89[_0x4cc2('0x33')][_0x4cc2('0x36')]));_0x220945[_0x4cc2('0x37')]=_0x220945['attributes']['length']?_0x220945[_0x4cc2('0x37')]:_0x944967[_0x4cc2('0x32')];if(_0xa83f89[_0x4cc2('0x33')][_0x4cc2('0x42')]){_0x220945[_0x4cc2('0x43')]=[{'all':!![]}];}_0x220945=_['merge']({},_0x220945,_0xa83f89[_0x4cc2('0x41')]);return db[_0x4cc2('0x2d')][_0x4cc2('0x48')](_0x220945)[_0x4cc2('0x25')](handleEntityNotFound(_0x10213d,null))[_0x4cc2('0x25')](respondWithResult(_0x10213d,null))['catch'](handleError(_0x10213d,null));};exports[_0x4cc2('0x49')]=function(_0x26a91c,_0x49b158){return db[_0x4cc2('0x2d')][_0x4cc2('0x49')](_0x26a91c[_0x4cc2('0x4a')],{})['then'](respondWithResult(_0x49b158,0xc9))[_0x4cc2('0x46')](handleError(_0x49b158,null));};exports[_0x4cc2('0x4b')]=function(_0x489620,_0x31735c){if(_0x489620[_0x4cc2('0x4a')]['id']){delete _0x489620['body']['id'];}return db[_0x4cc2('0x2d')][_0x4cc2('0x48')]({'where':{'id':_0x489620['params']['id']}})[_0x4cc2('0x25')](handleEntityNotFound(_0x31735c,null))[_0x4cc2('0x25')](saveUpdates(_0x489620[_0x4cc2('0x4a')],null))[_0x4cc2('0x25')](respondWithResult(_0x31735c,null))['catch'](handleError(_0x31735c,null));};exports[_0x4cc2('0x26')]=function(_0x26e166,_0xf8fe63){return db[_0x4cc2('0x2d')]['find']({'where':{'id':_0x26e166['params']['id']}})[_0x4cc2('0x25')](handleEntityNotFound(_0xf8fe63,null))[_0x4cc2('0x25')](removeEntity(_0xf8fe63,null))[_0x4cc2('0x46')](handleError(_0xf8fe63,null));};exports[_0x4cc2('0x4c')]=function(_0x1c2a80,_0x3658d0){return db[_0x4cc2('0x2d')][_0x4cc2('0x4c')]()[_0x4cc2('0x25')](respondWithResult(_0x3658d0,null))[_0x4cc2('0x46')](handleError(_0x3658d0,null));};function wrapUser(_0x256c36){return function(_0x5e962c){var _0x52231c=_0x256c36[_0x4cc2('0x4d')]({'plain':!![]});_0x52231c[_0x4cc2('0x4e')]=[];if(_0x5e962c){_0x52231c[_0x4cc2('0x4f')]=_0x5e962c['createdAt'];_0x52231c['lastMessage']=_0x5e962c;}else{_0x52231c['lastMessageAt']=moment(0x0)[_0x4cc2('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x52231c[_0x4cc2('0x51')]={};}return _0x52231c;};}exports[_0x4cc2('0x52')]=function(_0x456b86,_0x435284,_0x5f0a33){var _0x2df5ba=[];return db[_0x4cc2('0x53')]['findAll']({'where':{'role':[_0x4cc2('0x54'),_0x4cc2('0x55'),_0x4cc2('0x56')]},'attributes':['id',_0x4cc2('0x57'),_0x4cc2('0x2a'),_0x4cc2('0x58'),_0x4cc2('0x59'),_0x4cc2('0x5a'),_0x4cc2('0x5b'),_0x4cc2('0x5c'),_0x4cc2('0x5d'),'showWebBar'],'order':qs['sort'](_0x4cc2('0x5e')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x4cc2('0x2a'),'type'],'through':{'attributes':[]}}]})[_0x4cc2('0x25')](function(_0x4cc8c4){if(_0x4cc8c4){var _0xd9f17b=_0x456b86['user'][_0x4cc2('0x4d')]({'plain':!![]});if(!_0xd9f17b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd9f17b[_0x4cc2('0x58')]===_0x4cc2('0x56')){return db[_0x4cc2('0x5f')][_0x4cc2('0x48')]({'where':{'name':'Agents','userProfileId':_0xd9f17b[_0x4cc2('0x60')]},'raw':!![]})['then'](function(_0x102033){if(_0x102033){if(_0x102033[_0x4cc2('0x61')]===0x0){return db[_0x4cc2('0x62')][_0x4cc2('0x44')]({'where':{'sectionId':_0x102033['id']},'raw':!![]})[_0x4cc2('0x25')](function(_0x4ee449){var _0x60127c=[];if(_[_0x4cc2('0x63')](_0x4ee449)){_0x60127c=_[_0x4cc2('0x3f')](_0x4cc8c4,function(_0x42d0d7){if(_0x42d0d7[_0x4cc2('0x58')]!==_0x4cc2('0x54')){return _0x42d0d7;}});return _0x60127c;}else{for(var _0xda6c1a=0x0;_0xda6c1a<_0x4cc8c4[_0x4cc2('0x38')];_0xda6c1a++){var _0x2c407a=_0x4cc8c4[_0xda6c1a];if(_0x2c407a[_0x4cc2('0x58')]===_0x4cc2('0x54')){var _0x59a362=_[_0x4cc2('0x48')](_0x4ee449,function(_0x407dbc){return _0x407dbc[_0x4cc2('0x64')]===_0x2c407a['id'];});if(_0x59a362)_0x60127c['push'](_0x2c407a);}else{_0x60127c[_0x4cc2('0x65')](_0x2c407a);}}return _0x60127c;}});}else{return _0x4cc8c4;}}else{var _0x589ced=_['filter'](_0x4cc8c4,function(_0x537a1c){if(_0x537a1c['role']!==_0x4cc2('0x54')){return _0x537a1c;}});return _0x589ced;}});}else{return _0x4cc8c4;}}})['then'](function(_0x436db9){var _0x11812d=[];if(_0x436db9){_0x2df5ba=_0x436db9;for(var _0x2e9075=0x0;_0x2e9075<_0x436db9['length'];_0x2e9075+=0x1){_0x2df5ba[_0x2e9075][_0x4cc2('0x4e')]=[];_0x11812d[_0x4cc2('0x65')](db[_0x4cc2('0x2d')][_0x4cc2('0x48')]({'where':{'FromId':[_0x456b86[_0x4cc2('0x56')]['id'],_0x436db9[_0x2e9075]['id']],'ToId':[_0x456b86[_0x4cc2('0x56')]['id'],_0x436db9[_0x2e9075]['id']],'ChatGroupId':null},'attributes':['id',_0x4cc2('0x66'),'FromId',_0x4cc2('0x67'),_0x4cc2('0x68'),_0x4cc2('0x4a')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4cc2('0x25')](wrapUser(_0x436db9[_0x2e9075])));}return BPromise[_0x4cc2('0x69')](_0x11812d);}return[];})[_0x4cc2('0x25')](function(_0x58bf36){return{'rows':_0x58bf36,'count':_0x58bf36['length']};})['then'](respondWithResult(_0x435284,null))[_0x4cc2('0x46')](handleError(_0x435284,null));}; \ No newline at end of file +var _0x92cf=['VIRTUAL','include','findAll','rows','catch','params','includeAll','options','create','body','find','describe','get','lastMessageAt','createdAt','lastMessage','format','getUsers','agent','admin','user','fullname','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','resourceId','push','messages','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map'];(function(_0x48472c,_0x49367f){var _0x1912d6=function(_0x52a893){while(--_0x52a893){_0x48472c['push'](_0x48472c['shift']());}};_0x1912d6(++_0x49367f);}(_0x92cf,0x179));var _0xf92c=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x92cf[_0x164af1];return _0x5d81a2;};'use strict';var emlformat=require(_0xf92c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf92c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf92c('0x2'));var moment=require(_0xf92c('0x3'));var BPromise=require(_0xf92c('0x4'));var Mustache=require(_0xf92c('0x5'));var util=require(_0xf92c('0x6'));var path=require(_0xf92c('0x7'));var sox=require(_0xf92c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf92c('0x9'));var _=require(_0xf92c('0xa'));var squel=require(_0xf92c('0xb'));var crypto=require(_0xf92c('0xc'));var jsforce=require(_0xf92c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf92c('0xe'));var querystring=require(_0xf92c('0xf'));var Papa=require(_0xf92c('0x10'));var Redis=require(_0xf92c('0x11'));var authService=require(_0xf92c('0x12'));var qs=require(_0xf92c('0x13'));var as=require(_0xf92c('0x14'));var hardwareService=require(_0xf92c('0x15'));var logger=require(_0xf92c('0x16'))(_0xf92c('0x17'));var utils=require(_0xf92c('0x18'));var config=require(_0xf92c('0x19'));var licenseUtil=require(_0xf92c('0x1a'));var db=require('../../mysqldb')['db'];config[_0xf92c('0x1b')]=_[_0xf92c('0x1c')](config[_0xf92c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf92c('0x1d'))(new Redis(config[_0xf92c('0x1b')]));require(_0xf92c('0x1e'))[_0xf92c('0x1f')](socket);function respondWithStatusCode(_0x5b611c,_0x177762){_0x177762=_0x177762||0xcc;return function(_0x17735f){if(_0x17735f){return _0x5b611c['sendStatus'](_0x177762);}return _0x5b611c['status'](_0x177762)['end']();};}function respondWithResult(_0x3f09b2,_0x24cc9a){_0x24cc9a=_0x24cc9a||0xc8;return function(_0x43ff1a){if(_0x43ff1a){return _0x3f09b2[_0xf92c('0x20')](_0x24cc9a)[_0xf92c('0x21')](_0x43ff1a);}};}function respondWithFilteredResult(_0x1505a4,_0x4edd07){return function(_0x553112){if(_0x553112){var _0x4b7cd8=typeof _0x4edd07[_0xf92c('0x22')]===_0xf92c('0x23')&&typeof _0x4edd07[_0xf92c('0x24')]==='undefined';var _0xf12475=_0x553112[_0xf92c('0x25')];var _0x3f40bb=_0x4b7cd8?0x0:_0x4edd07[_0xf92c('0x22')];var _0x4d8ee7=_0x4b7cd8?_0x553112[_0xf92c('0x25')]:_0x4edd07[_0xf92c('0x22')]+_0x4edd07['limit'];var _0x3f6528;if(_0x4d8ee7>=_0xf12475){_0x4d8ee7=_0xf12475;_0x3f6528=0xc8;}else{_0x3f6528=0xce;}_0x1505a4['status'](_0x3f6528);return _0x1505a4['set'](_0xf92c('0x26'),_0x3f40bb+'-'+_0x4d8ee7+'/'+_0xf12475)[_0xf92c('0x21')](_0x553112);}return null;};}function patchUpdates(_0x52cfaf){return function(_0x2f4f05){try{jsonpatch['apply'](_0x2f4f05,_0x52cfaf,!![]);}catch(_0x812447){return BPromise[_0xf92c('0x27')](_0x812447);}return _0x2f4f05[_0xf92c('0x28')]();};}function saveUpdates(_0x4fda2a,_0x4e0dd1){return function(_0x167fa3){if(_0x167fa3){return _0x167fa3['update'](_0x4fda2a)[_0xf92c('0x29')](function(_0x56fac7){return _0x56fac7;});}return null;};}function removeEntity(_0x344271,_0x3adaf0){return function(_0x2cb71d){if(_0x2cb71d){return _0x2cb71d[_0xf92c('0x2a')]()[_0xf92c('0x29')](function(){_0x344271[_0xf92c('0x20')](0xcc)[_0xf92c('0x2b')]();});}};}function handleEntityNotFound(_0x2921ec,_0x22f4f7){return function(_0x4802bc){if(!_0x4802bc){_0x2921ec['sendStatus'](0x194);}return _0x4802bc;};}function handleError(_0x3c26fd,_0x154464){_0x154464=_0x154464||0x1f4;return function(_0x167016){logger[_0xf92c('0x2c')](_0x167016[_0xf92c('0x2d')]);if(_0x167016['name']){delete _0x167016[_0xf92c('0x2e')];}_0x3c26fd[_0xf92c('0x20')](_0x154464)[_0xf92c('0x2f')](_0x167016);};}exports[_0xf92c('0x30')]=function(_0x3dc5e6,_0x391937){var _0x2bf6cb={},_0x50b70b={},_0x1fb5db={'count':0x0,'rows':[]};var _0x41e927=_['map'](db[_0xf92c('0x31')][_0xf92c('0x32')],function(_0x30069e){return{'name':_0x30069e[_0xf92c('0x33')],'type':_0x30069e[_0xf92c('0x34')][_0xf92c('0x35')]};});_0x50b70b[_0xf92c('0x36')]=_['map'](_0x41e927,_0xf92c('0x2e'));_0x50b70b[_0xf92c('0x37')]=_[_0xf92c('0x38')](_0x3dc5e6[_0xf92c('0x37')]);_0x50b70b[_0xf92c('0x39')]=_[_0xf92c('0x3a')](_0x50b70b['model'],_0x50b70b[_0xf92c('0x37')]);_0x2bf6cb[_0xf92c('0x3b')]=_[_0xf92c('0x3a')](_0x50b70b[_0xf92c('0x36')],qs[_0xf92c('0x3c')](_0x3dc5e6['query'][_0xf92c('0x3c')]));_0x2bf6cb[_0xf92c('0x3b')]=_0x2bf6cb['attributes'][_0xf92c('0x3d')]?_0x2bf6cb['attributes']:_0x50b70b['model'];if(!_0x3dc5e6[_0xf92c('0x37')][_0xf92c('0x3e')](_0xf92c('0x3f'))){_0x2bf6cb['limit']=qs[_0xf92c('0x24')](_0x3dc5e6[_0xf92c('0x37')]['limit']);_0x2bf6cb[_0xf92c('0x22')]=qs['offset'](_0x3dc5e6['query'][_0xf92c('0x22')]);}_0x2bf6cb[_0xf92c('0x40')]=qs['sort'](_0x3dc5e6[_0xf92c('0x37')][_0xf92c('0x41')]);_0x2bf6cb[_0xf92c('0x42')]=qs['filters'](_[_0xf92c('0x43')](_0x3dc5e6[_0xf92c('0x37')],_0x50b70b[_0xf92c('0x39')]),_0x41e927);if(_0x3dc5e6[_0xf92c('0x37')][_0xf92c('0x44')]){_0x2bf6cb[_0xf92c('0x42')]=_[_0xf92c('0x45')](_0x2bf6cb[_0xf92c('0x42')],{'$or':_[_0xf92c('0x46')](_0x41e927,function(_0x5873b9){if(_0x5873b9['type']!==_0xf92c('0x47')){var _0x54f659={};_0x54f659[_0x5873b9[_0xf92c('0x2e')]]={'$like':'%'+_0x3dc5e6[_0xf92c('0x37')][_0xf92c('0x44')]+'%'};return _0x54f659;}})});}_0x2bf6cb=_['merge']({},_0x2bf6cb,_0x3dc5e6['options']);var _0x176e46={'where':_0x2bf6cb[_0xf92c('0x42')]};return db[_0xf92c('0x31')][_0xf92c('0x25')](_0x176e46)[_0xf92c('0x29')](function(_0x1af9ce){_0x1fb5db[_0xf92c('0x25')]=_0x1af9ce;if(_0x3dc5e6[_0xf92c('0x37')]['includeAll']){_0x2bf6cb[_0xf92c('0x48')]=[{'all':!![]}];}return db[_0xf92c('0x31')][_0xf92c('0x49')](_0x2bf6cb);})['then'](function(_0x43ad13){_0x1fb5db[_0xf92c('0x4a')]=_0x43ad13;return _0x1fb5db;})[_0xf92c('0x29')](respondWithFilteredResult(_0x391937,_0x2bf6cb))[_0xf92c('0x4b')](handleError(_0x391937,null));};exports['show']=function(_0x3ed2a4,_0x20b957){var _0x16228e={'raw':!![],'where':{'id':_0x3ed2a4[_0xf92c('0x4c')]['id']}},_0x11f573={};_0x11f573[_0xf92c('0x36')]=_[_0xf92c('0x38')](db[_0xf92c('0x31')]['rawAttributes']);_0x11f573[_0xf92c('0x37')]=_[_0xf92c('0x38')](_0x3ed2a4[_0xf92c('0x37')]);_0x11f573[_0xf92c('0x39')]=_[_0xf92c('0x3a')](_0x11f573[_0xf92c('0x36')],_0x11f573[_0xf92c('0x37')]);_0x16228e[_0xf92c('0x3b')]=_['intersection'](_0x11f573['model'],qs['fields'](_0x3ed2a4[_0xf92c('0x37')][_0xf92c('0x3c')]));_0x16228e['attributes']=_0x16228e[_0xf92c('0x3b')][_0xf92c('0x3d')]?_0x16228e[_0xf92c('0x3b')]:_0x11f573[_0xf92c('0x36')];if(_0x3ed2a4[_0xf92c('0x37')][_0xf92c('0x4d')]){_0x16228e[_0xf92c('0x48')]=[{'all':!![]}];}_0x16228e=_['merge']({},_0x16228e,_0x3ed2a4[_0xf92c('0x4e')]);return db[_0xf92c('0x31')]['find'](_0x16228e)[_0xf92c('0x29')](handleEntityNotFound(_0x20b957,null))['then'](respondWithResult(_0x20b957,null))[_0xf92c('0x4b')](handleError(_0x20b957,null));};exports[_0xf92c('0x4f')]=function(_0x4e9840,_0x3e9a85){return db[_0xf92c('0x31')][_0xf92c('0x4f')](_0x4e9840[_0xf92c('0x50')],{})['then'](respondWithResult(_0x3e9a85,0xc9))[_0xf92c('0x4b')](handleError(_0x3e9a85,null));};exports['update']=function(_0xf52d1b,_0xa12f01){if(_0xf52d1b[_0xf92c('0x50')]['id']){delete _0xf52d1b[_0xf92c('0x50')]['id'];}return db[_0xf92c('0x31')][_0xf92c('0x51')]({'where':{'id':_0xf52d1b['params']['id']}})[_0xf92c('0x29')](handleEntityNotFound(_0xa12f01,null))[_0xf92c('0x29')](saveUpdates(_0xf52d1b[_0xf92c('0x50')],null))[_0xf92c('0x29')](respondWithResult(_0xa12f01,null))['catch'](handleError(_0xa12f01,null));};exports['destroy']=function(_0x5e9e3a,_0x4e485e){return db['ChatInternalMessage'][_0xf92c('0x51')]({'where':{'id':_0x5e9e3a[_0xf92c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e485e,null))['then'](removeEntity(_0x4e485e,null))[_0xf92c('0x4b')](handleError(_0x4e485e,null));};exports[_0xf92c('0x52')]=function(_0x20c777,_0x153aad){return db[_0xf92c('0x31')]['describe']()[_0xf92c('0x29')](respondWithResult(_0x153aad,null))[_0xf92c('0x4b')](handleError(_0x153aad,null));};function wrapUser(_0x3bbdd4){return function(_0x24dbde){var _0x172bf1=_0x3bbdd4[_0xf92c('0x53')]({'plain':!![]});_0x172bf1['messages']=[];if(_0x24dbde){_0x172bf1[_0xf92c('0x54')]=_0x24dbde[_0xf92c('0x55')];_0x172bf1[_0xf92c('0x56')]=_0x24dbde;}else{_0x172bf1['lastMessageAt']=moment(0x0)[_0xf92c('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x172bf1['lastMessage']={};}return _0x172bf1;};}exports[_0xf92c('0x58')]=function(_0xbb8a67,_0x378971,_0x2ea7df){var _0x41f7f8=[];return db['User'][_0xf92c('0x49')]({'where':{'role':[_0xf92c('0x59'),_0xf92c('0x5a'),_0xf92c('0x5b')]},'attributes':['id',_0xf92c('0x5c'),'name','role','userpic',_0xf92c('0x5d'),_0xf92c('0x5e'),_0xf92c('0x5f'),_0xf92c('0x60'),_0xf92c('0x61')],'order':qs['sort']('-online'),'include':[{'model':db[_0xf92c('0x62')],'as':_0xf92c('0x63'),'attributes':['id',_0xf92c('0x2e'),_0xf92c('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x20e75f){if(_0x20e75f){var _0x3b16ba=_0xbb8a67['user'][_0xf92c('0x53')]({'plain':!![]});if(!_0x3b16ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b16ba[_0xf92c('0x64')]===_0xf92c('0x5b')){return db[_0xf92c('0x65')]['find']({'where':{'name':_0xf92c('0x66'),'userProfileId':_0x3b16ba[_0xf92c('0x67')]},'raw':!![]})['then'](function(_0x53fb0a){if(_0x53fb0a){if(_0x53fb0a['autoAssociation']===0x0){return db['UserProfileResource'][_0xf92c('0x49')]({'where':{'sectionId':_0x53fb0a['id']},'raw':!![]})[_0xf92c('0x29')](function(_0x1179e3){var _0x27b133=[];if(_['isEmpty'](_0x1179e3)){_0x27b133=_['filter'](_0x20e75f,function(_0x1e8865){if(_0x1e8865[_0xf92c('0x64')]!==_0xf92c('0x59')){return _0x1e8865;}});return _0x27b133;}else{for(var _0x4b9997=0x0;_0x4b9997<_0x20e75f['length'];_0x4b9997++){var _0x24486b=_0x20e75f[_0x4b9997];if(_0x24486b[_0xf92c('0x64')]===_0xf92c('0x59')){var _0x19cdac=_[_0xf92c('0x51')](_0x1179e3,function(_0x34cda7){return _0x34cda7[_0xf92c('0x68')]===_0x24486b['id'];});if(_0x19cdac)_0x27b133[_0xf92c('0x69')](_0x24486b);}else{_0x27b133[_0xf92c('0x69')](_0x24486b);}}return _0x27b133;}});}else{return _0x20e75f;}}else{var _0x44960e=_[_0xf92c('0x44')](_0x20e75f,function(_0x54533f){if(_0x54533f[_0xf92c('0x64')]!==_0xf92c('0x59')){return _0x54533f;}});return _0x44960e;}});}else{return _0x20e75f;}}})[_0xf92c('0x29')](function(_0x4db726){var _0x44df4d=[];if(_0x4db726){_0x41f7f8=_0x4db726;for(var _0x53c1d9=0x0;_0x53c1d9<_0x4db726[_0xf92c('0x3d')];_0x53c1d9+=0x1){_0x41f7f8[_0x53c1d9][_0xf92c('0x6a')]=[];_0x44df4d[_0xf92c('0x69')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0xbb8a67[_0xf92c('0x5b')]['id'],_0x4db726[_0x53c1d9]['id']],'ToId':[_0xbb8a67[_0xf92c('0x5b')]['id'],_0x4db726[_0x53c1d9]['id']],'ChatGroupId':null},'attributes':['id',_0xf92c('0x55'),_0xf92c('0x6b'),_0xf92c('0x6c'),_0xf92c('0x6d'),'body'],'order':qs['sort'](_0xf92c('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf92c('0x29')](wrapUser(_0x4db726[_0x53c1d9])));}return BPromise[_0xf92c('0x6f')](_0x44df4d);}return[];})[_0xf92c('0x29')](function(_0x512f28){return{'rows':_0x512f28,'count':_0x512f28[_0xf92c('0x3d')]};})[_0xf92c('0x29')](respondWithResult(_0x378971,null))[_0xf92c('0x4b')](handleError(_0x378971,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 5866922..fd80198 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 _0x610a=['events','../../mysqldb','ChatInternalMessage','save','remove','emit','hook','exports'];(function(_0xf67a90,_0x2eb2f3){var _0x648b2=function(_0x298232){while(--_0x298232){_0xf67a90['push'](_0xf67a90['shift']());}};_0x648b2(++_0x2eb2f3);}(_0x610a,0x98));var _0xa610=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x610a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa610('0x0'));var ChatInternalMessage=require(_0xa610('0x1'))['db'][_0xa610('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa610('0x3'),'afterUpdate':'update','afterDestroy':_0xa610('0x4')};function emitEvent(_0x536655){return function(_0x365c4b,_0x25d4a7,_0x58666b){ChatInternalMessageEvents[_0xa610('0x5')](_0x536655+':'+_0x365c4b['id'],_0x365c4b);ChatInternalMessageEvents['emit'](_0x536655,_0x365c4b);_0x58666b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xa610('0x6')](e,emitEvent(event));}}module[_0xa610('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xaf60=['update','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xaf60,0x82));var _0x0af6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xaf60[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x0af6('0x0'));var ChatInternalMessage=require(_0x0af6('0x1'))['db'][_0x0af6('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0af6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4e62b7){return function(_0xbb4bdd,_0x3e1023,_0x427a4c){ChatInternalMessageEvents[_0x0af6('0x4')](_0x4e62b7+':'+_0xbb4bdd['id'],_0xbb4bdd);ChatInternalMessageEvents[_0x0af6('0x4')](_0x4e62b7,_0xbb4bdd);_0x427a4c(null);};}for(var e in events){if(events[_0x0af6('0x5')](e)){var event=events[e];ChatInternalMessage[_0x0af6('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3308373..d536e34 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 _0xfa88=['exports','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x8c985c,_0x561bc1){var _0x973cc5=function(_0x2a385b){while(--_0x2a385b){_0x8c985c['push'](_0x8c985c['shift']());}};_0x973cc5(++_0x561bc1);}(_0xfa88,0x1a7));var _0x8fa8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfa88[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x8fa8('0x0'));var util=require(_0x8fa8('0x1'));var logger=require('../../config/logger')(_0x8fa8('0x2'));var moment=require(_0x8fa8('0x3'));var BPromise=require(_0x8fa8('0x4'));var rp=require(_0x8fa8('0x5'));var fs=require('fs');var path=require(_0x8fa8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x8fa8('0x7')]=function(_0x293ff2,_0x5ed3f3){return _0x293ff2['define']('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8fa8('0x8'),'collate':_0x8fa8('0x9')});}; \ No newline at end of file +var _0xc346=['../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x334a38,_0x109120){var _0x14ad9f=function(_0x2761fc){while(--_0x2761fc){_0x334a38['push'](_0x334a38['shift']());}};_0x14ad9f(++_0x109120);}(_0xc346,0x7d));var _0x6c34=function(_0x5da3e1,_0x325c02){_0x5da3e1=_0x5da3e1-0x0;var _0x4da237=_0xc346[_0x5da3e1];return _0x4da237;};'use strict';var _=require(_0x6c34('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6c34('0x1'));var moment=require(_0x6c34('0x2'));var BPromise=require(_0x6c34('0x3'));var rp=require(_0x6c34('0x4'));var fs=require('fs');var path=require(_0x6c34('0x5'));var rimraf=require(_0x6c34('0x6'));var config=require(_0x6c34('0x7'));var attributes=require(_0x6c34('0x8'));module['exports']=function(_0x41905a,_0x125ba7){return _0x41905a[_0x6c34('0x9')](_0x6c34('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6c34('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ef8c7e2..92a2c1f 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 _0x7abb=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug'];(function(_0x421666,_0x51e737){var _0x244375=function(_0x1df4c6){while(--_0x1df4c6){_0x421666['push'](_0x421666['shift']());}};_0x244375(++_0x51e737);}(_0x7abb,0xea));var _0xb7ab=function(_0x1be076,_0x1f7be3){_0x1be076=_0x1be076-0x0;var _0x544859=_0x7abb[_0x1be076];return _0x544859;};'use strict';var _=require(_0xb7ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb7ab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7ab('0x2'))['db'];var utils=require(_0xb7ab('0x3'));var logger=require(_0xb7ab('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb7ab('0x5')]['http']({'port':0x232a});config[_0xb7ab('0x6')]=_[_0xb7ab('0x7')](config[_0xb7ab('0x6')],{'host':_0xb7ab('0x8'),'port':0x18eb});var socket=require(_0xb7ab('0x9'))(new Redis(config[_0xb7ab('0x6')]));require(_0xb7ab('0xa'))[_0xb7ab('0xb')](socket);function respondWithRpcPromise(_0x50c50c,_0x4a4c6f,_0x5bcb12){return new BPromise(function(_0x5dc5e9,_0xd9895f){return client[_0xb7ab('0xc')](_0x50c50c,_0x5bcb12)[_0xb7ab('0xd')](function(_0x55bd7a){logger[_0xb7ab('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x4a4c6f,'request\x20sent');logger[_0xb7ab('0xf')](_0xb7ab('0x10'),_0x4a4c6f,_0xb7ab('0x11'),JSON[_0xb7ab('0x12')](_0x55bd7a));if(_0x55bd7a['error']){if(_0x55bd7a[_0xb7ab('0x13')][_0xb7ab('0x14')]===0x1f4){logger[_0xb7ab('0x13')](_0xb7ab('0x15'),_0x4a4c6f,_0x55bd7a[_0xb7ab('0x13')]['message']);return _0xd9895f(_0x55bd7a[_0xb7ab('0x13')][_0xb7ab('0x16')]);}logger[_0xb7ab('0x13')](_0xb7ab('0x15'),_0x4a4c6f,_0x55bd7a['error'][_0xb7ab('0x16')]);return _0x5dc5e9(_0x55bd7a[_0xb7ab('0x13')]['message']);}else{logger[_0xb7ab('0xe')](_0xb7ab('0x15'),_0x4a4c6f,_0xb7ab('0x11'));_0x5dc5e9(_0x55bd7a[_0xb7ab('0x17')]['message']);}})[_0xb7ab('0x18')](function(_0x7145dd){logger[_0xb7ab('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x4a4c6f,_0x7145dd);_0xd9895f(_0x7145dd);});});} \ No newline at end of file +var _0x35cb=['then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request'];(function(_0x262c94,_0x52e618){var _0x7ee23c=function(_0x44a913){while(--_0x44a913){_0x262c94['push'](_0x262c94['shift']());}};_0x7ee23c(++_0x52e618);}(_0x35cb,0xb8));var _0xb35c=function(_0x4197ff,_0x532667){_0x4197ff=_0x4197ff-0x0;var _0x50d9c5=_0x35cb[_0x4197ff];return _0x50d9c5;};'use strict';var _=require(_0xb35c('0x0'));var util=require(_0xb35c('0x1'));var moment=require(_0xb35c('0x2'));var BPromise=require(_0xb35c('0x3'));var rs=require(_0xb35c('0x4'));var fs=require('fs');var Redis=require(_0xb35c('0x5'));var db=require(_0xb35c('0x6'))['db'];var utils=require(_0xb35c('0x7'));var logger=require(_0xb35c('0x8'))('rpc');var config=require(_0xb35c('0x9'));var jayson=require(_0xb35c('0xa'));var client=jayson[_0xb35c('0xb')][_0xb35c('0xc')]({'port':0x232a});config[_0xb35c('0xd')]=_[_0xb35c('0xe')](config[_0xb35c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb35c('0xf'))(new Redis(config[_0xb35c('0xd')]));require(_0xb35c('0x10'))[_0xb35c('0x11')](socket);function respondWithRpcPromise(_0x35e244,_0x5b9367,_0x3d1886){return new BPromise(function(_0x180e8d,_0x3d2045){return client[_0xb35c('0x12')](_0x35e244,_0x3d1886)[_0xb35c('0x13')](function(_0x3562d7){logger[_0xb35c('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x5b9367,'request\x20sent');logger['debug'](_0xb35c('0x15'),_0x5b9367,_0xb35c('0x16'),JSON[_0xb35c('0x17')](_0x3562d7));if(_0x3562d7[_0xb35c('0x18')]){if(_0x3562d7[_0xb35c('0x18')][_0xb35c('0x19')]===0x1f4){logger[_0xb35c('0x18')](_0xb35c('0x1a'),_0x5b9367,_0x3562d7[_0xb35c('0x18')][_0xb35c('0x1b')]);return _0x3d2045(_0x3562d7[_0xb35c('0x18')][_0xb35c('0x1b')]);}logger[_0xb35c('0x18')](_0xb35c('0x1a'),_0x5b9367,_0x3562d7[_0xb35c('0x18')]['message']);return _0x180e8d(_0x3562d7['error'][_0xb35c('0x1b')]);}else{logger[_0xb35c('0x14')](_0xb35c('0x1a'),_0x5b9367,'request\x20sent');_0x180e8d(_0x3562d7['result'][_0xb35c('0x1b')]);}})[_0xb35c('0x1c')](function(_0x58ba6e){logger[_0xb35c('0x18')](_0xb35c('0x1a'),_0x5b9367,_0x58ba6e);_0x3d2045(_0x58ba6e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e7d98d4..3954fd2 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 _0x227c=['remove','update','emit','removeListener','register','length','save'];(function(_0x51eb57,_0x10d544){var _0x2fe3ea=function(_0x361692){while(--_0x361692){_0x51eb57['push'](_0x51eb57['shift']());}};_0x2fe3ea(++_0x10d544);}(_0x227c,0xf4));var _0xc227=function(_0x94030f,_0x476ed2){_0x94030f=_0x94030f-0x0;var _0x9f7747=_0x227c[_0x94030f];return _0x9f7747;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xc227('0x0'),_0xc227('0x1'),_0xc227('0x2')];function createListener(_0x3ba6f3,_0x3709b3){return function(_0xb35cbb){_0x3709b3[_0xc227('0x3')](_0x3ba6f3,_0xb35cbb);};}function removeListener(_0x59c742,_0x1baefd){return function(){ChatInternalMessageEvents[_0xc227('0x4')](_0x59c742,_0x1baefd);};}exports[_0xc227('0x5')]=function(_0x497204){for(var _0xc11538=0x0,_0x41aed9=events[_0xc227('0x6')];_0xc11538<_0x41aed9;_0xc11538++){var _0x4202b4=events[_0xc11538];var _0x55c5ab=createListener('chatInternalMessage:'+_0x4202b4,_0x497204);ChatInternalMessageEvents['on'](_0x4202b4,_0x55c5ab);}}; \ No newline at end of file +var _0xa2ca=['./chatInternalMessage.events','save','emit','length'];(function(_0x57608a,_0x4d62ee){var _0x2d4910=function(_0x2411a9){while(--_0x2411a9){_0x57608a['push'](_0x57608a['shift']());}};_0x2d4910(++_0x4d62ee);}(_0xa2ca,0x154));var _0xaa2c=function(_0x58a183,_0x4fbc2b){_0x58a183=_0x58a183-0x0;var _0x322e63=_0xa2ca[_0x58a183];return _0x322e63;};'use strict';var ChatInternalMessageEvents=require(_0xaa2c('0x0'));var events=[_0xaa2c('0x1'),'remove','update'];function createListener(_0x50e18e,_0xf94722){return function(_0x1ed1b3){_0xf94722[_0xaa2c('0x2')](_0x50e18e,_0x1ed1b3);};}function removeListener(_0x156140,_0x367187){return function(){ChatInternalMessageEvents['removeListener'](_0x156140,_0x367187);};}exports['register']=function(_0xed6206){for(var _0x8d33bf=0x0,_0x33cda3=events[_0xaa2c('0x3')];_0x8d33bf<_0x33cda3;_0x8d33bf++){var _0x1ab824=events[_0x8d33bf];var _0x433d3a=createListener('chatInternalMessage:'+_0x1ab824,_0xed6206);ChatInternalMessageEvents['on'](_0x1ab824,_0x433d3a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0647768..e28f295 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 _0x3d1d=['/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','getUsers','show','put'];(function(_0x5af90d,_0x408a6d){var _0x190d09=function(_0x3b039a){while(--_0x3b039a){_0x5af90d['push'](_0x5af90d['shift']());}};_0x190d09(++_0x408a6d);}(_0x3d1d,0x194));var _0xd3d1=function(_0x19508e,_0x9dd9a7){_0x19508e=_0x19508e-0x0;var _0x44eca5=_0x3d1d[_0x19508e];return _0x44eca5;};'use strict';var multer=require(_0xd3d1('0x0'));var util=require(_0xd3d1('0x1'));var path=require('path');var timeout=require(_0xd3d1('0x2'));var express=require(_0xd3d1('0x3'));var router=express[_0xd3d1('0x4')]();var fs_extra=require(_0xd3d1('0x5'));var auth=require(_0xd3d1('0x6'));var interaction=require(_0xd3d1('0x7'));var config=require('../../config/environment');var controller=require(_0xd3d1('0x8'));router[_0xd3d1('0x9')]('/',auth[_0xd3d1('0xa')](),controller[_0xd3d1('0xb')]);router[_0xd3d1('0x9')](_0xd3d1('0xc'),auth[_0xd3d1('0xa')](),controller['describe']);router[_0xd3d1('0x9')]('/users',auth[_0xd3d1('0xa')](),controller[_0xd3d1('0xd')]);router['get']('/:id',auth[_0xd3d1('0xa')](),controller[_0xd3d1('0xe')]);router['post']('/',auth[_0xd3d1('0xa')](),controller['create']);router[_0xd3d1('0xf')](_0xd3d1('0x10'),controller[_0xd3d1('0x11')]);router['delete'](_0xd3d1('0x10'),auth['isAuthenticated'](),controller[_0xd3d1('0x12')]);module[_0xd3d1('0x13')]=router; \ No newline at end of file +var _0xd197=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','/:id','show','post','create'];(function(_0x32c7e9,_0x3ba7f3){var _0x18f0cc=function(_0x18d1f2){while(--_0x18d1f2){_0x32c7e9['push'](_0x32c7e9['shift']());}};_0x18f0cc(++_0x3ba7f3);}(_0xd197,0x18b));var _0x7d19=function(_0x54fa40,_0x2d2d5c){_0x54fa40=_0x54fa40-0x0;var _0x58acf2=_0xd197[_0x54fa40];return _0x58acf2;};'use strict';var multer=require(_0x7d19('0x0'));var util=require(_0x7d19('0x1'));var path=require(_0x7d19('0x2'));var timeout=require(_0x7d19('0x3'));var express=require(_0x7d19('0x4'));var router=express[_0x7d19('0x5')]();var fs_extra=require(_0x7d19('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7d19('0x7'));var config=require(_0x7d19('0x8'));var controller=require(_0x7d19('0x9'));router[_0x7d19('0xa')]('/',auth[_0x7d19('0xb')](),controller[_0x7d19('0xc')]);router[_0x7d19('0xa')]('/describe',auth[_0x7d19('0xb')](),controller[_0x7d19('0xd')]);router[_0x7d19('0xa')](_0x7d19('0xe'),auth[_0x7d19('0xb')](),controller['getUsers']);router[_0x7d19('0xa')](_0x7d19('0xf'),auth[_0x7d19('0xb')](),controller[_0x7d19('0x10')]);router[_0x7d19('0x11')]('/',auth[_0x7d19('0xb')](),controller[_0x7d19('0x12')]);router[_0x7d19('0x13')](_0x7d19('0xf'),controller[_0x7d19('0x14')]);router[_0x7d19('0x15')](_0x7d19('0xf'),auth[_0x7d19('0xb')](),controller['destroy']);module[_0x7d19('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 099500e..a25f9b1 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 _0x574d=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x574d,0xc0));var _0xd574=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x574d[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0xd574('0x0'));module[_0xd574('0x1')]={'body':{'type':Sequelize[_0xd574('0x2')](_0xd574('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd574('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd574('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd574('0x5')]('in','out'),'defaultValue':_0xd574('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd574('0x7')]},'providerName':{'type':Sequelize[_0xd574('0x8')]},'providerResponse':{'type':Sequelize[_0xd574('0x2')]}}; \ No newline at end of file +var _0x6d0c=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x4f3366,_0x5caed7){_0x4f3366=_0x4f3366-0x0;var _0xe01c9f=_0x6d0c[_0x4f3366];return _0xe01c9f;};'use strict';var Sequelize=require(_0xc6d0('0x0'));module[_0xc6d0('0x1')]={'body':{'type':Sequelize[_0xc6d0('0x2')](_0xc6d0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc6d0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc6d0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc6d0('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc6d0('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e2c23f8..178c6e7 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 _0x34e7=['path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','client','http','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','set','apply','reject','save','then','destroy','stack','name','map','ChatMessage','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','filters','pick','filter','merge','type','options','includeAll','rows','show','params','length','include','create','update','body','find','describe','chat-interactions','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','role','interaction','ContactId','Sequelize','QueryTypes','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','interface','rimraf','zip-dir','fast-json-patch','moment','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34e7,0x175));var _0x734e=function(_0x4154c1,_0x58277d){_0x4154c1=_0x4154c1-0x0;var _0x5c6a89=_0x34e7[_0x4154c1];return _0x5c6a89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x734e('0x0'));var zipdir=require(_0x734e('0x1'));var jsonpatch=require(_0x734e('0x2'));var rp=require('request-promise');var moment=require(_0x734e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x734e('0x4'));var path=require(_0x734e('0x5'));var sox=require(_0x734e('0x6'));var csv=require('to-csv');var ejs=require(_0x734e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x734e('0x8'));var squel=require('squel');var crypto=require(_0x734e('0x9'));var jsforce=require(_0x734e('0xa'));var deskjs=require(_0x734e('0xb'));var toCsv=require(_0x734e('0xc'));var querystring=require(_0x734e('0xd'));var Papa=require(_0x734e('0xe'));var Redis=require(_0x734e('0xf'));var authService=require(_0x734e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x734e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x734e('0x12'))(_0x734e('0x13'));var utils=require('../../config/utils');var config=require(_0x734e('0x14'));var licenseUtil=require(_0x734e('0x15'));var db=require(_0x734e('0x16'))['db'];config[_0x734e('0x17')]=_[_0x734e('0x18')](config[_0x734e('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x734e('0x19'))(new Redis(config[_0x734e('0x17')]));require(_0x734e('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x734e('0x1b')][_0x734e('0x1c')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340dc9,_0x115a7c,_0x400878,_0x155df4){return new BPromise(function(_0x10b683,_0x513ff7){var _0x2a23e1=_0x155df4||client;return _0x2a23e1[_0x734e('0x1d')](_0x340dc9,_0x400878)['then'](function(_0x27bc1f){logger[_0x734e('0x1e')](_0x734e('0x1f'),_0x115a7c,'request\x20sent');logger[_0x734e('0x20')](_0x734e('0x21'),_0x115a7c,_0x734e('0x22'),JSON[_0x734e('0x23')](_0x27bc1f));if(_0x27bc1f[_0x734e('0x24')]){if(_0x27bc1f[_0x734e('0x24')][_0x734e('0x25')]===0x1f4){logger[_0x734e('0x24')](_0x734e('0x1f'),_0x115a7c,_0x27bc1f[_0x734e('0x24')][_0x734e('0x26')]);return _0x513ff7(_0x27bc1f['error']['message']);}logger[_0x734e('0x24')](_0x734e('0x1f'),_0x115a7c,_0x27bc1f[_0x734e('0x24')][_0x734e('0x26')]);return _0x10b683(_0x27bc1f[_0x734e('0x24')][_0x734e('0x26')]);}else{logger[_0x734e('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x115a7c,_0x734e('0x22'));_0x10b683(_0x27bc1f[_0x734e('0x27')][_0x734e('0x26')]);}})[_0x734e('0x28')](function(_0x33cbac){logger[_0x734e('0x24')](_0x734e('0x1f'),_0x115a7c,_0x33cbac);_0x513ff7(_0x33cbac);});});}function respondWithStatusCode(_0x142f5c,_0xaf0768){_0xaf0768=_0xaf0768||0xcc;return function(_0x3f5140){if(_0x3f5140){return _0x142f5c[_0x734e('0x29')](_0xaf0768);}return _0x142f5c[_0x734e('0x2a')](_0xaf0768)[_0x734e('0x2b')]();};}function respondWithResult(_0x3c65bc,_0x323b22){_0x323b22=_0x323b22||0xc8;return function(_0x295cae){if(_0x295cae){return _0x3c65bc['status'](_0x323b22)[_0x734e('0x2c')](_0x295cae);}};}function respondWithFilteredResult(_0x17bf1a,_0x5b7ed8){return function(_0x16c4fa){if(_0x16c4fa){var _0x162327=typeof _0x5b7ed8['offset']===_0x734e('0x2d')&&typeof _0x5b7ed8['limit']===_0x734e('0x2d');var _0x40ae0a=_0x16c4fa[_0x734e('0x2e')];var _0x19a92b=_0x162327?0x0:_0x5b7ed8['offset'];var _0xe85b79=_0x162327?_0x16c4fa[_0x734e('0x2e')]:_0x5b7ed8['offset']+_0x5b7ed8['limit'];var _0x2634b8;if(_0xe85b79>=_0x40ae0a){_0xe85b79=_0x40ae0a;_0x2634b8=0xc8;}else{_0x2634b8=0xce;}_0x17bf1a[_0x734e('0x2a')](_0x2634b8);return _0x17bf1a[_0x734e('0x2f')]('Content-Range',_0x19a92b+'-'+_0xe85b79+'/'+_0x40ae0a)[_0x734e('0x2c')](_0x16c4fa);}return null;};}function patchUpdates(_0x26f900){return function(_0x58a45b){try{jsonpatch[_0x734e('0x30')](_0x58a45b,_0x26f900,!![]);}catch(_0x12108f){return BPromise[_0x734e('0x31')](_0x12108f);}return _0x58a45b[_0x734e('0x32')]();};}function saveUpdates(_0x51a109,_0x1debdd){return function(_0x275fec){if(_0x275fec){return _0x275fec['update'](_0x51a109)[_0x734e('0x33')](function(_0x371c2f){return _0x371c2f;});}return null;};}function removeEntity(_0x4dd4b8,_0x1a180d){return function(_0x5bf8ab){if(_0x5bf8ab){return _0x5bf8ab[_0x734e('0x34')]()[_0x734e('0x33')](function(){_0x4dd4b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2780fb,_0x54d6a3){return function(_0x176470){if(!_0x176470){_0x2780fb[_0x734e('0x29')](0x194);}return _0x176470;};}function handleError(_0x111657,_0x4ab2b7){_0x4ab2b7=_0x4ab2b7||0x1f4;return function(_0x428f6f){logger[_0x734e('0x24')](_0x428f6f[_0x734e('0x35')]);if(_0x428f6f[_0x734e('0x36')]){delete _0x428f6f[_0x734e('0x36')];}_0x111657[_0x734e('0x2a')](_0x4ab2b7)['send'](_0x428f6f);};}exports['index']=function(_0x50d43d,_0x2d2194){var _0x5886e2={},_0x53b003={},_0x442b01={'count':0x0,'rows':[]};var _0x1df9b1=_[_0x734e('0x37')](db[_0x734e('0x38')]['rawAttributes'],function(_0x1b90d5){return{'name':_0x1b90d5['fieldName'],'type':_0x1b90d5['type'][_0x734e('0x39')]};});_0x53b003[_0x734e('0x3a')]=_[_0x734e('0x37')](_0x1df9b1,_0x734e('0x36'));_0x53b003[_0x734e('0x3b')]=_[_0x734e('0x3c')](_0x50d43d[_0x734e('0x3b')]);_0x53b003['filters']=_[_0x734e('0x3d')](_0x53b003[_0x734e('0x3a')],_0x53b003[_0x734e('0x3b')]);_0x5886e2[_0x734e('0x3e')]=_[_0x734e('0x3d')](_0x53b003[_0x734e('0x3a')],qs[_0x734e('0x3f')](_0x50d43d[_0x734e('0x3b')][_0x734e('0x3f')]));_0x5886e2[_0x734e('0x3e')]=_0x5886e2[_0x734e('0x3e')]['length']?_0x5886e2[_0x734e('0x3e')]:_0x53b003[_0x734e('0x3a')];if(!_0x50d43d[_0x734e('0x3b')][_0x734e('0x40')]('nolimit')){_0x5886e2[_0x734e('0x41')]=qs[_0x734e('0x41')](_0x50d43d['query']['limit']);_0x5886e2[_0x734e('0x42')]=qs[_0x734e('0x42')](_0x50d43d[_0x734e('0x3b')]['offset']);}_0x5886e2[_0x734e('0x43')]=qs[_0x734e('0x44')](_0x50d43d[_0x734e('0x3b')][_0x734e('0x44')]);_0x5886e2[_0x734e('0x45')]=qs[_0x734e('0x46')](_[_0x734e('0x47')](_0x50d43d[_0x734e('0x3b')],_0x53b003['filters']),_0x1df9b1);if(_0x50d43d[_0x734e('0x3b')][_0x734e('0x48')]){_0x5886e2[_0x734e('0x45')]=_[_0x734e('0x49')](_0x5886e2[_0x734e('0x45')],{'$or':_[_0x734e('0x37')](_0x1df9b1,function(_0x3f1d4e){if(_0x3f1d4e[_0x734e('0x4a')]!=='VIRTUAL'){var _0x4aa2fe={};_0x4aa2fe[_0x3f1d4e[_0x734e('0x36')]]={'$like':'%'+_0x50d43d[_0x734e('0x3b')]['filter']+'%'};return _0x4aa2fe;}})});}_0x5886e2=_[_0x734e('0x49')]({},_0x5886e2,_0x50d43d[_0x734e('0x4b')]);var _0x1829b7={'where':_0x5886e2[_0x734e('0x45')]};return db['ChatMessage']['count'](_0x1829b7)[_0x734e('0x33')](function(_0x46165b){_0x442b01[_0x734e('0x2e')]=_0x46165b;if(_0x50d43d[_0x734e('0x3b')][_0x734e('0x4c')]){_0x5886e2['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x5886e2);})[_0x734e('0x33')](function(_0x33472a){_0x442b01[_0x734e('0x4d')]=_0x33472a;return _0x442b01;})['then'](respondWithFilteredResult(_0x2d2194,_0x5886e2))['catch'](handleError(_0x2d2194,null));};exports[_0x734e('0x4e')]=function(_0x40a432,_0x3eaf54){var _0x49d8a1={'raw':!![],'where':{'id':_0x40a432[_0x734e('0x4f')]['id']}},_0x581144={};_0x581144[_0x734e('0x3a')]=_[_0x734e('0x3c')](db[_0x734e('0x38')]['rawAttributes']);_0x581144[_0x734e('0x3b')]=_['keys'](_0x40a432['query']);_0x581144[_0x734e('0x46')]=_[_0x734e('0x3d')](_0x581144[_0x734e('0x3a')],_0x581144[_0x734e('0x3b')]);_0x49d8a1[_0x734e('0x3e')]=_[_0x734e('0x3d')](_0x581144['model'],qs[_0x734e('0x3f')](_0x40a432[_0x734e('0x3b')][_0x734e('0x3f')]));_0x49d8a1[_0x734e('0x3e')]=_0x49d8a1['attributes'][_0x734e('0x50')]?_0x49d8a1[_0x734e('0x3e')]:_0x581144[_0x734e('0x3a')];if(_0x40a432[_0x734e('0x3b')][_0x734e('0x4c')]){_0x49d8a1[_0x734e('0x51')]=[{'all':!![]}];}_0x49d8a1=_[_0x734e('0x49')]({},_0x49d8a1,_0x40a432[_0x734e('0x4b')]);return db[_0x734e('0x38')]['find'](_0x49d8a1)[_0x734e('0x33')](handleEntityNotFound(_0x3eaf54,null))[_0x734e('0x33')](respondWithResult(_0x3eaf54,null))['catch'](handleError(_0x3eaf54,null));};exports[_0x734e('0x52')]=function(_0x11706d,_0x76cf5f){return db[_0x734e('0x38')]['create'](_0x11706d['body'],{})['then'](respondWithResult(_0x76cf5f,0xc9))[_0x734e('0x28')](handleError(_0x76cf5f,null));};exports[_0x734e('0x53')]=function(_0x34939b,_0x238fbe){if(_0x34939b[_0x734e('0x54')]['id']){delete _0x34939b['body']['id'];}return db[_0x734e('0x38')][_0x734e('0x55')]({'where':{'id':_0x34939b[_0x734e('0x4f')]['id']}})[_0x734e('0x33')](handleEntityNotFound(_0x238fbe,null))['then'](saveUpdates(_0x34939b[_0x734e('0x54')],null))['then'](respondWithResult(_0x238fbe,null))[_0x734e('0x28')](handleError(_0x238fbe,null));};exports['destroy']=function(_0x15d879,_0x1bc0d8){return db[_0x734e('0x38')][_0x734e('0x55')]({'where':{'id':_0x15d879[_0x734e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1bc0d8,null))[_0x734e('0x33')](removeEntity(_0x1bc0d8,null))['catch'](handleError(_0x1bc0d8,null));};exports[_0x734e('0x56')]=function(_0x3bd655,_0xc00a73){return db[_0x734e('0x38')]['describe']()['then'](respondWithResult(_0xc00a73,null))[_0x734e('0x28')](handleError(_0xc00a73,null));};var interaction_log=require(_0x734e('0x12'))(_0x734e('0x57'));exports[_0x734e('0x58')]=function(_0xc747b8,_0x2c7261,_0x35aaaa){var _0x327a3b={'agent':{},'channel':_0x734e('0x59')};if(_0xc747b8[_0x734e('0x54')]['id']){delete _0xc747b8[_0x734e('0x54')]['id'];}_0xc747b8['body']['read']=!![];_0xc747b8[_0x734e('0x54')]['readAt']=moment()[_0x734e('0x5a')](_0x734e('0x5b'));_0xc747b8[_0x734e('0x54')]['UserId']=_0xc747b8['body'][_0x734e('0x5c')]||_0xc747b8[_0x734e('0x5d')]['id'];_0x327a3b[_0x734e('0x5e')]['id']=_0xc747b8[_0x734e('0x54')][_0x734e('0x5c')];return db['ChatMessage'][_0x734e('0x55')]({'where':{'id':_0xc747b8[_0x734e('0x4f')]['id'],'UserId':null}})[_0x734e('0x33')](handleEntityNotFound(_0x2c7261,null))[_0x734e('0x33')](saveUpdates(_0xc747b8[_0x734e('0x54')],null))[_0x734e('0x33')](function(_0x569881){if(_0x569881){_0x327a3b['message']=_0x569881[_0x734e('0x5f')]({'plain':!![]});return db['ChatInteraction'][_0x734e('0x55')]({'where':{'id':_0x569881[_0x734e('0x60')]}});}return null;})[_0x734e('0x33')](handleEntityNotFound(_0x2c7261,null))[_0x734e('0x33')](function(_0x1edb08){if(_0x1edb08){return _0x1edb08[_0x734e('0x53')]({'UserId':_0xc747b8[_0x734e('0x54')][_0x734e('0x5c')],'read1stAt':_[_0x734e('0x61')](_0x1edb08[_0x734e('0x62')])?moment()['format'](_0x734e('0x5b')):undefined});}return null;})[_0x734e('0x33')](function(_0x4f984f){if(_0x4f984f){_0x327a3b['interaction']=_0x4f984f[_0x734e('0x5f')]({'plain':!![]});interaction_log[_0x734e('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc747b8[_0x734e('0x5d')]['id'],_0xc747b8[_0x734e('0x5d')][_0x734e('0x36')],_0xc747b8[_0x734e('0x5d')][_0x734e('0x63')],_0x327a3b[_0x734e('0x64')]['id'],_0xc747b8[_0x734e('0x54')]?JSON['stringify'](_0xc747b8[_0x734e('0x54')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x327a3b);}return null;})[_0x734e('0x33')](function(_0x52e216){var _0xb1e042='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52e216[_0x734e('0x26')][_0x734e('0x65')];return db['sequelize'][_0x734e('0x3b')](_0xb1e042,{'type':db[_0x734e('0x66')][_0x734e('0x67')]['SELECT'],'raw':!![]})[_0x734e('0x33')](function(_0x10adc0){return _0x10adc0;});})[_0x734e('0x33')](function(_0x3e0b18){if(_0x3e0b18){_0x327a3b[_0x734e('0x26')]['contact']=_0x3e0b18[0x0];if(!_0xc747b8[_0x734e('0x54')][_0x734e('0x5c')])return;return db[_0x734e('0x68')][_0x734e('0x55')]({'where':{'id':_0xc747b8[_0x734e('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0x734e('0x36'),_0x734e('0x69'),_0x734e('0x6a'),_0x734e('0x6b')],'raw':!![]});}return null;})[_0x734e('0x33')](function(_0x481751){if(!_0x481751)return null;_0x327a3b[_0x734e('0x26')][_0x734e('0x5e')]=_0x481751;return _0x327a3b;})[_0x734e('0x33')](function(_0x4539f5){if(_0x4539f5){if(_0xc747b8[_0x734e('0x54')][_0x734e('0x6c')]){_0x327a3b[_0x734e('0x26')]['interface']=util[_0x734e('0x5a')](_0x734e('0x6d'),_0xc747b8[_0x734e('0x5d')][_0x734e('0x36')]);_0x327a3b[_0x734e('0x26')][_0x734e('0x6e')]=_0x327a3b[_0x734e('0x6e')];_0x327a3b[_0x734e('0x26')][_0x734e('0x6f')]=_0x327a3b[_0x734e('0x6e')];_0x327a3b[_0x734e('0x26')][_0x734e('0x70')]=_0x734e('0x58');return respondWithRpcPromise(_0x734e('0x71'),_0x734e('0x71'),{'event':_0x734e('0x72'),'message':_[_0x734e('0x49')](_0x327a3b[_0x734e('0x26')],JSON[_0x734e('0x73')](_0x327a3b[_0x734e('0x64')][_0x734e('0x74')]))},client9002)[_0x734e('0x33')](function(){return _0x327a3b;});}return _0x327a3b;}return null;})[_0x734e('0x33')](respondWithResult(_0x2c7261,null))['catch'](handleError(_0x2c7261,null));};var interaction_log=require(_0x734e('0x12'))(_0x734e('0x57'));exports[_0x734e('0x31')]=function(_0x1499d5,_0x45263d,_0x4be21c){var _0x5f06c6={'agent':{},'channel':_0x734e('0x59')};if(_0x1499d5[_0x734e('0x54')]['id']){delete _0x1499d5[_0x734e('0x54')]['id'];}_0x1499d5[_0x734e('0x54')][_0x734e('0x5c')]=_0x1499d5[_0x734e('0x54')][_0x734e('0x5c')]||_0x1499d5[_0x734e('0x5d')]['id'];_0x5f06c6[_0x734e('0x5e')]['id']=_0x1499d5[_0x734e('0x54')][_0x734e('0x5c')];return db['ChatMessage'][_0x734e('0x55')]({'where':{'id':_0x1499d5[_0x734e('0x4f')]['id'],'UserId':null}})[_0x734e('0x33')](handleEntityNotFound(_0x45263d,null))['then'](function(_0x53faab){if(_0x53faab){_0x5f06c6[_0x734e('0x26')]=_0x53faab[_0x734e('0x5f')]({'plain':!![]});return db[_0x734e('0x75')][_0x734e('0x55')]({'where':{'id':_0x53faab[_0x734e('0x60')]}});}return null;})[_0x734e('0x33')](handleEntityNotFound(_0x45263d,null))[_0x734e('0x33')](function(_0x47428e){if(_0x47428e){_0x5f06c6[_0x734e('0x64')]=_0x47428e['get']({'plain':!![]});interaction_log['info'](_0x734e('0x76'),_0x1499d5['user']['id'],_0x1499d5[_0x734e('0x5d')][_0x734e('0x36')],_0x1499d5[_0x734e('0x5d')][_0x734e('0x63')],_0x5f06c6[_0x734e('0x64')]['id'],_0x1499d5['body']?JSON['stringify'](_0x1499d5[_0x734e('0x54')]):'null');return respondWithRpcPromise(_0x734e('0x77'),_0x734e('0x78'),_0x5f06c6);}return null;})[_0x734e('0x33')](function(_0x38239a){var _0x4dd2b6=_0x734e('0x79')+_0x38239a[_0x734e('0x26')][_0x734e('0x65')];return db[_0x734e('0x7a')][_0x734e('0x3b')](_0x4dd2b6,{'type':db[_0x734e('0x66')][_0x734e('0x67')][_0x734e('0x7b')],'raw':!![]})['then'](function(_0x2fb5ce){return _0x2fb5ce;});})[_0x734e('0x33')](function(_0x2d284e){if(_0x2d284e){_0x5f06c6[_0x734e('0x26')][_0x734e('0x7c')]=_0x2d284e[0x0];if(!_0x1499d5['body'][_0x734e('0x5c')])return;return db[_0x734e('0x68')][_0x734e('0x55')]({'where':{'id':_0x1499d5['body'][_0x734e('0x5c')],'role':_0x734e('0x5e')},'attributes':['id','name',_0x734e('0x69'),'email',_0x734e('0x6b')],'raw':!![]});}return null;})[_0x734e('0x33')](function(_0x5bf3f4){if(!_0x5bf3f4)return null;_0x5f06c6['message']['agent']=_0x5bf3f4;return _0x5f06c6;})['then'](function(_0x570e4d){if(_0x570e4d){_0x570e4d['message'][_0x734e('0x7d')]=util[_0x734e('0x5a')](_0x734e('0x6d'),_0x1499d5[_0x734e('0x5d')][_0x734e('0x36')]);_0x570e4d[_0x734e('0x26')][_0x734e('0x6e')]=_0x5f06c6[_0x734e('0x6e')];_0x570e4d['message']['motionChannel']=_0x5f06c6[_0x734e('0x6e')];_0x570e4d[_0x734e('0x26')][_0x734e('0x70')]=_0x734e('0x31');respondWithRpcPromise(_0x734e('0x71'),_0x734e('0x71'),{'event':'rejectmessage','message':_[_0x734e('0x49')](_0x5f06c6[_0x734e('0x26')],JSON[_0x734e('0x73')](_0x5f06c6[_0x734e('0x64')][_0x734e('0x74')]))},client9002);return _0x5f06c6;}return null;})['then'](respondWithResult(_0x45263d,null))[_0x734e('0x28')](handleError(_0x45263d,null));}; \ No newline at end of file +var _0x41c8=['fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','create','body','find','describe','chat-interactions','accept','read','readAt','format','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','UserId','User','email','internal','manual','channel','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','fullname','interface','SIP/%s','motionChannel','event','rejectmessage','rimraf','zip-dir'];(function(_0x416ce0,_0x329e10){var _0x27d062=function(_0x40a0e5){while(--_0x40a0e5){_0x416ce0['push'](_0x416ce0['shift']());}};_0x27d062(++_0x329e10);}(_0x41c8,0x104));var _0x841c=function(_0x5c4829,_0x25a990){_0x5c4829=_0x5c4829-0x0;var _0x3e869f=_0x41c8[_0x5c4829];return _0x3e869f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x841c('0x0'));var zipdir=require(_0x841c('0x1'));var jsonpatch=require(_0x841c('0x2'));var rp=require('request-promise');var moment=require(_0x841c('0x3'));var BPromise=require(_0x841c('0x4'));var Mustache=require('mustache');var util=require(_0x841c('0x5'));var path=require(_0x841c('0x6'));var sox=require(_0x841c('0x7'));var csv=require(_0x841c('0x8'));var ejs=require(_0x841c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x841c('0xa'));var squel=require('squel');var crypto=require(_0x841c('0xb'));var jsforce=require(_0x841c('0xc'));var deskjs=require(_0x841c('0xd'));var toCsv=require(_0x841c('0x8'));var querystring=require(_0x841c('0xe'));var Papa=require(_0x841c('0xf'));var Redis=require(_0x841c('0x10'));var authService=require(_0x841c('0x11'));var qs=require(_0x841c('0x12'));var as=require(_0x841c('0x13'));var hardwareService=require(_0x841c('0x14'));var logger=require(_0x841c('0x15'))('api');var utils=require(_0x841c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x841c('0x17'))['db'];config[_0x841c('0x18')]=_[_0x841c('0x19')](config[_0x841c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x841c('0x1a'))(new Redis(config[_0x841c('0x18')]));require('./chatMessage.socket')[_0x841c('0x1b')](socket);var jayson=require(_0x841c('0x1c'));var client=jayson[_0x841c('0x1d')][_0x841c('0x1e')]({'port':0x232c});var client9002=jayson[_0x841c('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25aa60,_0x194187,_0x2c18b8,_0x32cbf2){return new BPromise(function(_0x4c75b3,_0x1802f0){var _0x50c27e=_0x32cbf2||client;return _0x50c27e[_0x841c('0x1f')](_0x25aa60,_0x2c18b8)[_0x841c('0x20')](function(_0x1c5433){logger[_0x841c('0x21')](_0x841c('0x22'),_0x194187,_0x841c('0x23'));logger['debug'](_0x841c('0x24'),_0x194187,_0x841c('0x23'),JSON[_0x841c('0x25')](_0x1c5433));if(_0x1c5433[_0x841c('0x26')]){if(_0x1c5433[_0x841c('0x26')]['code']===0x1f4){logger[_0x841c('0x26')](_0x841c('0x22'),_0x194187,_0x1c5433[_0x841c('0x26')][_0x841c('0x27')]);return _0x1802f0(_0x1c5433[_0x841c('0x26')][_0x841c('0x27')]);}logger['error'](_0x841c('0x22'),_0x194187,_0x1c5433['error'][_0x841c('0x27')]);return _0x4c75b3(_0x1c5433[_0x841c('0x26')][_0x841c('0x27')]);}else{logger[_0x841c('0x21')](_0x841c('0x22'),_0x194187,'request\x20sent');_0x4c75b3(_0x1c5433[_0x841c('0x28')][_0x841c('0x27')]);}})[_0x841c('0x29')](function(_0xc07c67){logger[_0x841c('0x26')]('ChatMessage,\x20%s,\x20%s',_0x194187,_0xc07c67);_0x1802f0(_0xc07c67);});});}function respondWithStatusCode(_0x2d8faf,_0xf7a8b0){_0xf7a8b0=_0xf7a8b0||0xcc;return function(_0x583687){if(_0x583687){return _0x2d8faf[_0x841c('0x2a')](_0xf7a8b0);}return _0x2d8faf[_0x841c('0x2b')](_0xf7a8b0)[_0x841c('0x2c')]();};}function respondWithResult(_0x52cd6b,_0xf61e76){_0xf61e76=_0xf61e76||0xc8;return function(_0x4cfd29){if(_0x4cfd29){return _0x52cd6b[_0x841c('0x2b')](_0xf61e76)[_0x841c('0x2d')](_0x4cfd29);}};}function respondWithFilteredResult(_0x10b45b,_0x35f2f3){return function(_0x2a910a){if(_0x2a910a){var _0x12acab=typeof _0x35f2f3[_0x841c('0x2e')]===_0x841c('0x2f')&&typeof _0x35f2f3['limit']===_0x841c('0x2f');var _0x3f30df=_0x2a910a[_0x841c('0x30')];var _0x38fbbc=_0x12acab?0x0:_0x35f2f3[_0x841c('0x2e')];var _0x3f6f9a=_0x12acab?_0x2a910a[_0x841c('0x30')]:_0x35f2f3[_0x841c('0x2e')]+_0x35f2f3['limit'];var _0x2e3f94;if(_0x3f6f9a>=_0x3f30df){_0x3f6f9a=_0x3f30df;_0x2e3f94=0xc8;}else{_0x2e3f94=0xce;}_0x10b45b[_0x841c('0x2b')](_0x2e3f94);return _0x10b45b[_0x841c('0x31')]('Content-Range',_0x38fbbc+'-'+_0x3f6f9a+'/'+_0x3f30df)[_0x841c('0x2d')](_0x2a910a);}return null;};}function patchUpdates(_0x40135f){return function(_0x2c76fb){try{jsonpatch[_0x841c('0x32')](_0x2c76fb,_0x40135f,!![]);}catch(_0x5575ef){return BPromise[_0x841c('0x33')](_0x5575ef);}return _0x2c76fb[_0x841c('0x34')]();};}function saveUpdates(_0x23b75c,_0x9dfd49){return function(_0xcf5853){if(_0xcf5853){return _0xcf5853[_0x841c('0x35')](_0x23b75c)[_0x841c('0x20')](function(_0x1a7492){return _0x1a7492;});}return null;};}function removeEntity(_0x257326,_0x330e7b){return function(_0x14dc2f){if(_0x14dc2f){return _0x14dc2f[_0x841c('0x36')]()[_0x841c('0x20')](function(){_0x257326[_0x841c('0x2b')](0xcc)[_0x841c('0x2c')]();});}};}function handleEntityNotFound(_0x3aae2f,_0x432143){return function(_0x11701c){if(!_0x11701c){_0x3aae2f['sendStatus'](0x194);}return _0x11701c;};}function handleError(_0x52cdf9,_0x1b25d8){_0x1b25d8=_0x1b25d8||0x1f4;return function(_0x408ce3){logger[_0x841c('0x26')](_0x408ce3['stack']);if(_0x408ce3[_0x841c('0x37')]){delete _0x408ce3[_0x841c('0x37')];}_0x52cdf9[_0x841c('0x2b')](_0x1b25d8)[_0x841c('0x38')](_0x408ce3);};}exports[_0x841c('0x39')]=function(_0x15f315,_0x3fd9e8){var _0x247d2e={},_0x251a72={},_0x166d40={'count':0x0,'rows':[]};var _0x28f764=_[_0x841c('0x3a')](db[_0x841c('0x3b')][_0x841c('0x3c')],function(_0x229e2d){return{'name':_0x229e2d[_0x841c('0x3d')],'type':_0x229e2d[_0x841c('0x3e')][_0x841c('0x3f')]};});_0x251a72[_0x841c('0x40')]=_[_0x841c('0x3a')](_0x28f764,_0x841c('0x37'));_0x251a72['query']=_[_0x841c('0x41')](_0x15f315[_0x841c('0x42')]);_0x251a72[_0x841c('0x43')]=_[_0x841c('0x44')](_0x251a72[_0x841c('0x40')],_0x251a72['query']);_0x247d2e[_0x841c('0x45')]=_[_0x841c('0x44')](_0x251a72['model'],qs[_0x841c('0x46')](_0x15f315[_0x841c('0x42')][_0x841c('0x46')]));_0x247d2e[_0x841c('0x45')]=_0x247d2e[_0x841c('0x45')]['length']?_0x247d2e[_0x841c('0x45')]:_0x251a72['model'];if(!_0x15f315['query']['hasOwnProperty']('nolimit')){_0x247d2e['limit']=qs[_0x841c('0x47')](_0x15f315[_0x841c('0x42')][_0x841c('0x47')]);_0x247d2e[_0x841c('0x2e')]=qs[_0x841c('0x2e')](_0x15f315[_0x841c('0x42')][_0x841c('0x2e')]);}_0x247d2e[_0x841c('0x48')]=qs[_0x841c('0x49')](_0x15f315[_0x841c('0x42')][_0x841c('0x49')]);_0x247d2e[_0x841c('0x4a')]=qs[_0x841c('0x43')](_[_0x841c('0x4b')](_0x15f315['query'],_0x251a72[_0x841c('0x43')]),_0x28f764);if(_0x15f315['query'][_0x841c('0x4c')]){_0x247d2e[_0x841c('0x4a')]=_[_0x841c('0x4d')](_0x247d2e[_0x841c('0x4a')],{'$or':_[_0x841c('0x3a')](_0x28f764,function(_0x10ebc8){if(_0x10ebc8['type']!==_0x841c('0x4e')){var _0x451529={};_0x451529[_0x10ebc8['name']]={'$like':'%'+_0x15f315[_0x841c('0x42')][_0x841c('0x4c')]+'%'};return _0x451529;}})});}_0x247d2e=_['merge']({},_0x247d2e,_0x15f315[_0x841c('0x4f')]);var _0xbe4335={'where':_0x247d2e['where']};return db[_0x841c('0x3b')]['count'](_0xbe4335)[_0x841c('0x20')](function(_0x597eb9){_0x166d40[_0x841c('0x30')]=_0x597eb9;if(_0x15f315[_0x841c('0x42')][_0x841c('0x50')]){_0x247d2e['include']=[{'all':!![]}];}return db[_0x841c('0x3b')][_0x841c('0x51')](_0x247d2e);})[_0x841c('0x20')](function(_0x5e110a){_0x166d40[_0x841c('0x52')]=_0x5e110a;return _0x166d40;})[_0x841c('0x20')](respondWithFilteredResult(_0x3fd9e8,_0x247d2e))[_0x841c('0x29')](handleError(_0x3fd9e8,null));};exports[_0x841c('0x53')]=function(_0x5bea98,_0x4142c2){var _0x5a51bc={'raw':!![],'where':{'id':_0x5bea98[_0x841c('0x54')]['id']}},_0x175a5c={};_0x175a5c['model']=_[_0x841c('0x41')](db['ChatMessage'][_0x841c('0x3c')]);_0x175a5c['query']=_[_0x841c('0x41')](_0x5bea98[_0x841c('0x42')]);_0x175a5c[_0x841c('0x43')]=_['intersection'](_0x175a5c[_0x841c('0x40')],_0x175a5c[_0x841c('0x42')]);_0x5a51bc[_0x841c('0x45')]=_[_0x841c('0x44')](_0x175a5c['model'],qs[_0x841c('0x46')](_0x5bea98['query']['fields']));_0x5a51bc['attributes']=_0x5a51bc['attributes']['length']?_0x5a51bc[_0x841c('0x45')]:_0x175a5c['model'];if(_0x5bea98[_0x841c('0x42')][_0x841c('0x50')]){_0x5a51bc[_0x841c('0x55')]=[{'all':!![]}];}_0x5a51bc=_[_0x841c('0x4d')]({},_0x5a51bc,_0x5bea98['options']);return db['ChatMessage']['find'](_0x5a51bc)['then'](handleEntityNotFound(_0x4142c2,null))[_0x841c('0x20')](respondWithResult(_0x4142c2,null))[_0x841c('0x29')](handleError(_0x4142c2,null));};exports[_0x841c('0x56')]=function(_0x509177,_0xc61222){return db['ChatMessage'][_0x841c('0x56')](_0x509177[_0x841c('0x57')],{})[_0x841c('0x20')](respondWithResult(_0xc61222,0xc9))['catch'](handleError(_0xc61222,null));};exports[_0x841c('0x35')]=function(_0x387b6f,_0x302b12){if(_0x387b6f[_0x841c('0x57')]['id']){delete _0x387b6f[_0x841c('0x57')]['id'];}return db['ChatMessage'][_0x841c('0x58')]({'where':{'id':_0x387b6f['params']['id']}})['then'](handleEntityNotFound(_0x302b12,null))[_0x841c('0x20')](saveUpdates(_0x387b6f[_0x841c('0x57')],null))[_0x841c('0x20')](respondWithResult(_0x302b12,null))[_0x841c('0x29')](handleError(_0x302b12,null));};exports[_0x841c('0x36')]=function(_0x587338,_0x26048c){return db[_0x841c('0x3b')][_0x841c('0x58')]({'where':{'id':_0x587338[_0x841c('0x54')]['id']}})['then'](handleEntityNotFound(_0x26048c,null))[_0x841c('0x20')](removeEntity(_0x26048c,null))['catch'](handleError(_0x26048c,null));};exports[_0x841c('0x59')]=function(_0x4af3de,_0x51319a){return db['ChatMessage'][_0x841c('0x59')]()[_0x841c('0x20')](respondWithResult(_0x51319a,null))[_0x841c('0x29')](handleError(_0x51319a,null));};var interaction_log=require(_0x841c('0x15'))(_0x841c('0x5a'));exports[_0x841c('0x5b')]=function(_0x448f5d,_0x1e490d,_0xa203fa){var _0x382af2={'agent':{},'channel':'chat'};if(_0x448f5d[_0x841c('0x57')]['id']){delete _0x448f5d[_0x841c('0x57')]['id'];}_0x448f5d[_0x841c('0x57')][_0x841c('0x5c')]=!![];_0x448f5d['body'][_0x841c('0x5d')]=moment()[_0x841c('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x448f5d[_0x841c('0x57')]['UserId']=_0x448f5d[_0x841c('0x57')]['UserId']||_0x448f5d['user']['id'];_0x382af2[_0x841c('0x5f')]['id']=_0x448f5d[_0x841c('0x57')]['UserId'];return db[_0x841c('0x3b')][_0x841c('0x58')]({'where':{'id':_0x448f5d[_0x841c('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e490d,null))[_0x841c('0x20')](saveUpdates(_0x448f5d['body'],null))[_0x841c('0x20')](function(_0x543f99){if(_0x543f99){_0x382af2[_0x841c('0x27')]=_0x543f99[_0x841c('0x60')]({'plain':!![]});return db[_0x841c('0x61')]['find']({'where':{'id':_0x543f99[_0x841c('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1e490d,null))[_0x841c('0x20')](function(_0x48dc7f){if(_0x48dc7f){return _0x48dc7f[_0x841c('0x35')]({'UserId':_0x448f5d['body']['UserId'],'read1stAt':_[_0x841c('0x63')](_0x48dc7f['read1stAt'])?moment()[_0x841c('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x841c('0x20')](function(_0x48c92a){if(_0x48c92a){_0x382af2[_0x841c('0x64')]=_0x48c92a[_0x841c('0x60')]({'plain':!![]});interaction_log[_0x841c('0x21')](_0x841c('0x65'),_0x448f5d[_0x841c('0x66')]['id'],_0x448f5d[_0x841c('0x66')][_0x841c('0x37')],_0x448f5d['user'][_0x841c('0x67')],_0x382af2[_0x841c('0x64')]['id'],_0x448f5d[_0x841c('0x57')]?JSON[_0x841c('0x25')](_0x448f5d[_0x841c('0x57')]):_0x841c('0x68'));return respondWithRpcPromise(_0x841c('0x69'),'acceptMessage',_0x382af2);}return null;})[_0x841c('0x20')](function(_0x39fb5c){var _0x5eecc4=_0x841c('0x6a')+_0x39fb5c[_0x841c('0x27')][_0x841c('0x6b')];return db[_0x841c('0x6c')][_0x841c('0x42')](_0x5eecc4,{'type':db[_0x841c('0x6d')][_0x841c('0x6e')][_0x841c('0x6f')],'raw':!![]})[_0x841c('0x20')](function(_0xa433d1){return _0xa433d1;});})[_0x841c('0x20')](function(_0x5063b3){if(_0x5063b3){_0x382af2['message']['contact']=_0x5063b3[0x0];if(!_0x448f5d[_0x841c('0x57')][_0x841c('0x70')])return;return db[_0x841c('0x71')]['find']({'where':{'id':_0x448f5d['body']['UserId'],'role':_0x841c('0x5f')},'attributes':['id',_0x841c('0x37'),'fullname',_0x841c('0x72'),_0x841c('0x73')],'raw':!![]});}return null;})['then'](function(_0x37dc09){if(!_0x37dc09)return null;_0x382af2[_0x841c('0x27')][_0x841c('0x5f')]=_0x37dc09;return _0x382af2;})[_0x841c('0x20')](function(_0x519de2){if(_0x519de2){if(_0x448f5d[_0x841c('0x57')][_0x841c('0x74')]){_0x382af2[_0x841c('0x27')]['interface']=util[_0x841c('0x5e')]('SIP/%s',_0x448f5d['user'][_0x841c('0x37')]);_0x382af2[_0x841c('0x27')][_0x841c('0x75')]=_0x382af2['channel'];_0x382af2['message']['motionChannel']=_0x382af2[_0x841c('0x75')];_0x382af2[_0x841c('0x27')]['event']=_0x841c('0x5b');return respondWithRpcPromise(_0x841c('0x76'),_0x841c('0x76'),{'event':_0x841c('0x77'),'message':_[_0x841c('0x4d')](_0x382af2[_0x841c('0x27')],JSON[_0x841c('0x78')](_0x382af2[_0x841c('0x64')]['formData']))},client9002)[_0x841c('0x20')](function(){return _0x382af2;});}return _0x382af2;}return null;})['then'](respondWithResult(_0x1e490d,null))[_0x841c('0x29')](handleError(_0x1e490d,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x841c('0x33')]=function(_0x403ecd,_0x593c71,_0x1d3867){var _0x3a15c2={'agent':{},'channel':'chat'};if(_0x403ecd[_0x841c('0x57')]['id']){delete _0x403ecd[_0x841c('0x57')]['id'];}_0x403ecd[_0x841c('0x57')][_0x841c('0x70')]=_0x403ecd['body'][_0x841c('0x70')]||_0x403ecd[_0x841c('0x66')]['id'];_0x3a15c2[_0x841c('0x5f')]['id']=_0x403ecd[_0x841c('0x57')][_0x841c('0x70')];return db[_0x841c('0x3b')][_0x841c('0x58')]({'where':{'id':_0x403ecd[_0x841c('0x54')]['id'],'UserId':null}})[_0x841c('0x20')](handleEntityNotFound(_0x593c71,null))[_0x841c('0x20')](function(_0x2cc161){if(_0x2cc161){_0x3a15c2[_0x841c('0x27')]=_0x2cc161['get']({'plain':!![]});return db[_0x841c('0x61')][_0x841c('0x58')]({'where':{'id':_0x2cc161[_0x841c('0x62')]}});}return null;})[_0x841c('0x20')](handleEntityNotFound(_0x593c71,null))['then'](function(_0x5f3b59){if(_0x5f3b59){_0x3a15c2['interaction']=_0x5f3b59['get']({'plain':!![]});interaction_log[_0x841c('0x21')](_0x841c('0x79'),_0x403ecd[_0x841c('0x66')]['id'],_0x403ecd['user']['name'],_0x403ecd[_0x841c('0x66')][_0x841c('0x67')],_0x3a15c2[_0x841c('0x64')]['id'],_0x403ecd[_0x841c('0x57')]?JSON[_0x841c('0x25')](_0x403ecd['body']):_0x841c('0x68'));return respondWithRpcPromise(_0x841c('0x7a'),_0x841c('0x7b'),_0x3a15c2);}return null;})[_0x841c('0x20')](function(_0x25237b){var _0x54b6cc=_0x841c('0x6a')+_0x25237b['message'][_0x841c('0x6b')];return db[_0x841c('0x6c')][_0x841c('0x42')](_0x54b6cc,{'type':db['Sequelize'][_0x841c('0x6e')][_0x841c('0x6f')],'raw':!![]})['then'](function(_0x5d7fd8){return _0x5d7fd8;});})[_0x841c('0x20')](function(_0x552cb4){if(_0x552cb4){_0x3a15c2[_0x841c('0x27')][_0x841c('0x7c')]=_0x552cb4[0x0];if(!_0x403ecd[_0x841c('0x57')][_0x841c('0x70')])return;return db[_0x841c('0x71')][_0x841c('0x58')]({'where':{'id':_0x403ecd[_0x841c('0x57')][_0x841c('0x70')],'role':'agent'},'attributes':['id',_0x841c('0x37'),_0x841c('0x7d'),_0x841c('0x72'),_0x841c('0x73')],'raw':!![]});}return null;})[_0x841c('0x20')](function(_0xb662e8){if(!_0xb662e8)return null;_0x3a15c2[_0x841c('0x27')][_0x841c('0x5f')]=_0xb662e8;return _0x3a15c2;})[_0x841c('0x20')](function(_0x4a7517){if(_0x4a7517){_0x4a7517[_0x841c('0x27')][_0x841c('0x7e')]=util[_0x841c('0x5e')](_0x841c('0x7f'),_0x403ecd[_0x841c('0x66')][_0x841c('0x37')]);_0x4a7517['message'][_0x841c('0x75')]=_0x3a15c2[_0x841c('0x75')];_0x4a7517[_0x841c('0x27')][_0x841c('0x80')]=_0x3a15c2[_0x841c('0x75')];_0x4a7517['message'][_0x841c('0x81')]=_0x841c('0x33');respondWithRpcPromise(_0x841c('0x76'),_0x841c('0x76'),{'event':_0x841c('0x82'),'message':_[_0x841c('0x4d')](_0x3a15c2[_0x841c('0x27')],JSON[_0x841c('0x78')](_0x3a15c2[_0x841c('0x64')]['formData']))},client9002);return _0x3a15c2;}return null;})[_0x841c('0x20')](respondWithResult(_0x593c71,null))[_0x841c('0x29')](handleError(_0x593c71,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 26636a4..794893a 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 _0xc453=['hasOwnProperty','hook','exports','events','setMaxListeners','remove','emit'];(function(_0x572e4d,_0x463f4c){var _0x4090e0=function(_0x5d585b){while(--_0x5d585b){_0x572e4d['push'](_0x572e4d['shift']());}};_0x4090e0(++_0x463f4c);}(_0xc453,0x1ed));var _0x3c45=function(_0x29de86,_0x1427d5){_0x29de86=_0x29de86-0x0;var _0x25d145=_0xc453[_0x29de86];return _0x25d145;};'use strict';var EventEmitter=require(_0x3c45('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3c45('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3c45('0x2')};function emitEvent(_0x135a84){return function(_0x2f3937,_0x39266e,_0x5459d5){ChatMessageEvents['emit'](_0x135a84+':'+_0x2f3937['id'],_0x2f3937);ChatMessageEvents[_0x3c45('0x3')](_0x135a84,_0x2f3937);_0x5459d5(null);};}for(var e in events){if(events[_0x3c45('0x4')](e)){var event=events[e];ChatMessage[_0x3c45('0x5')](e,emitEvent(event));}}module[_0x3c45('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0xa2e9=['update','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x566d8b,_0x50739a){var _0x2891f0=function(_0x4f69c6){while(--_0x4f69c6){_0x566d8b['push'](_0x566d8b['shift']());}};_0x2891f0(++_0x50739a);}(_0xa2e9,0x177));var _0x9a2e=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xa2e9[_0x1b5aea];return _0x51cae9;};'use strict';var EventEmitter=require(_0x9a2e('0x0'));var ChatMessage=require(_0x9a2e('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9a2e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a2e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b77e3){return function(_0x1c5df5,_0x2f7e06,_0x3bc729){ChatMessageEvents['emit'](_0x3b77e3+':'+_0x1c5df5['id'],_0x1c5df5);ChatMessageEvents[_0x9a2e('0x4')](_0x3b77e3,_0x1c5df5);_0x3bc729(null);};}for(var e in events){if(events[_0x9a2e('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 2c67b08..75ede06 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 _0x5279=['then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId'];(function(_0x39ebc4,_0x53388e){var _0x557004=function(_0x1f2d7e){while(--_0x1f2d7e){_0x39ebc4['push'](_0x39ebc4['shift']());}};_0x557004(++_0x53388e);}(_0x5279,0xa1));var _0x9527=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x5279[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var logger=require(_0x9527('0x2'))(_0x9527('0x3'));var moment=require(_0x9527('0x4'));var BPromise=require('bluebird');var rp=require(_0x9527('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9527('0x6'));var config=require(_0x9527('0x7'));var attributes=require(_0x9527('0x8'));module[_0x9527('0x9')]=function(_0x19bfa9,_0xbaac4f){return _0x19bfa9[_0x9527('0xa')]('ChatMessage',attributes,{'tableName':_0x9527('0xb'),'paranoid':![],'indexes':[{'name':_0x9527('0xc'),'fields':[_0x9527('0xd')],'type':_0x9527('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1622dc,_0x592757,_0x216427){var _0x1d826d=_0x19bfa9[_0x9527('0xf')];var _0x39be91=_0x1622dc[_0x9527('0x10')]({'plain':!![]});if(_0x39be91[_0x9527('0x11')]['toLowerCase']()==='in'||_0x39be91[_0x9527('0x11')][_0x9527('0x12')]()===_0x9527('0x13')&&!_0x39be91[_0x9527('0x14')]&&!_[_0x9527('0x15')](_0x39be91[_0x9527('0x16')])){_0x1d826d[_0x9527('0x17')]['findOne']({'where':{'id':_0x39be91[_0x9527('0x18')]}})[_0x9527('0x19')](function(_0x52ab91){if(_0x52ab91){_0x52ab91[_0x9527('0x1a')]({'lastMsgAt':_0x39be91[_0x9527('0x1b')],'lastMsgDirection':_0x39be91[_0x9527('0x11')][_0x9527('0x12')]()});}})[_0x9527('0x1c')](function(_0x167666){console[_0x9527('0x1d')](_0x167666);});}_0x216427();}},'charset':_0x9527('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2e3d=['moment','bluebird','request-promise','../../config/environment','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x2e3d,0x1be));var _0xd2e3=function(_0xb98b0f,_0x23aa8c){_0xb98b0f=_0xb98b0f-0x0;var _0x495f62=_0x2e3d[_0xb98b0f];return _0x495f62;};'use strict';var _=require(_0xd2e3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd2e3('0x1'));var moment=require(_0xd2e3('0x2'));var BPromise=require(_0xd2e3('0x3'));var rp=require(_0xd2e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd2e3('0x5'));var attributes=require('./chatMessage.attributes');module[_0xd2e3('0x6')]=function(_0x2ba133,_0x3beebf){return _0x2ba133[_0xd2e3('0x7')](_0xd2e3('0x8'),attributes,{'tableName':_0xd2e3('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xd2e3('0xa')],'type':_0xd2e3('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fa29b,_0x4122ea,_0x28c613){var _0x3a2f44=_0x2ba133[_0xd2e3('0xc')];var _0x59777d=_0x1fa29b[_0xd2e3('0xd')]({'plain':!![]});if(_0x59777d['direction'][_0xd2e3('0xe')]()==='in'||_0x59777d[_0xd2e3('0xf')]['toLowerCase']()===_0xd2e3('0x10')&&!_0x59777d[_0xd2e3('0x11')]&&!_[_0xd2e3('0x12')](_0x59777d[_0xd2e3('0x13')])){_0x3a2f44[_0xd2e3('0x14')][_0xd2e3('0x15')]({'where':{'id':_0x59777d['ChatInteractionId']}})[_0xd2e3('0x16')](function(_0x5674ee){if(_0x5674ee){_0x5674ee[_0xd2e3('0x17')]({'lastMsgAt':_0x59777d[_0xd2e3('0x18')],'lastMsgDirection':_0x59777d['direction'][_0xd2e3('0xe')]()});}})['catch'](function(_0x519a1f){console[_0xd2e3('0x19')](_0x519a1f);});}_0x28c613();}},'charset':_0xd2e3('0x1a'),'collate':_0xd2e3('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 40e96fa..20ea6d6 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 _0x6240=['rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatMessage','create','body','options','raw','CreateChatMessage','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x488b74,_0x1d3896){var _0x1c5d63=function(_0x3fc05f){while(--_0x3fc05f){_0x488b74['push'](_0x488b74['shift']());}};_0x1c5d63(++_0x1d3896);}(_0x6240,0xb3));var _0x0624=function(_0x3e9918,_0x40b3fe){_0x3e9918=_0x3e9918-0x0;var _0xf7da76=_0x6240[_0x3e9918];return _0xf7da76;};'use strict';var _=require(_0x0624('0x0'));var util=require(_0x0624('0x1'));var moment=require(_0x0624('0x2'));var BPromise=require('bluebird');var rs=require(_0x0624('0x3'));var fs=require('fs');var Redis=require(_0x0624('0x4'));var db=require(_0x0624('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0624('0x6'))(_0x0624('0x7'));var config=require(_0x0624('0x8'));var jayson=require(_0x0624('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0624('0xa')]=_['defaults'](config[_0x0624('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0624('0xb'))(new Redis(config[_0x0624('0xa')]));require(_0x0624('0xc'))[_0x0624('0xd')](socket);function respondWithRpcPromise(_0x739bac,_0x2b3002,_0x586bf9){return new BPromise(function(_0x183041,_0x149f97){return client[_0x0624('0xe')](_0x739bac,_0x586bf9)['then'](function(_0x177636){logger[_0x0624('0xf')](_0x0624('0x10'),_0x2b3002,_0x0624('0x11'));logger[_0x0624('0x12')](_0x0624('0x13'),_0x2b3002,_0x0624('0x11'),JSON[_0x0624('0x14')](_0x177636));if(_0x177636[_0x0624('0x15')]){if(_0x177636[_0x0624('0x15')]['code']===0x1f4){logger[_0x0624('0x15')]('ChatMessage,\x20%s,\x20%s',_0x2b3002,_0x177636['error'][_0x0624('0x16')]);return _0x149f97(_0x177636[_0x0624('0x15')]['message']);}logger[_0x0624('0x15')](_0x0624('0x10'),_0x2b3002,_0x177636[_0x0624('0x15')][_0x0624('0x16')]);return _0x183041(_0x177636[_0x0624('0x15')][_0x0624('0x16')]);}else{logger[_0x0624('0xf')](_0x0624('0x10'),_0x2b3002,_0x0624('0x11'));_0x183041(_0x177636[_0x0624('0x17')][_0x0624('0x16')]);}})['catch'](function(_0x524207){logger['error'](_0x0624('0x10'),_0x2b3002,_0x524207);_0x149f97(_0x524207);});});}exports['CreateChatMessage']=function(_0x1aedc7){var _0x2583fc=this;return new Promise(function(_0x507d87,_0x5b885e){return db[_0x0624('0x18')][_0x0624('0x19')](_0x1aedc7[_0x0624('0x1a')],{'raw':_0x1aedc7['options']?_0x1aedc7[_0x0624('0x1b')][_0x0624('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x32a0e4){logger[_0x0624('0xf')](_0x0624('0x1d'),_0x1aedc7);logger[_0x0624('0x12')]('CreateChatMessage',_0x1aedc7,JSON[_0x0624('0x14')](_0x32a0e4));_0x507d87(_0x32a0e4);})[_0x0624('0x1e')](function(_0x54eec9){logger[_0x0624('0x15')]('CreateChatMessage',_0x54eec9[_0x0624('0x16')],_0x1aedc7);_0x5b885e(_0x2583fc[_0x0624('0x15')](0x1f4,_0x54eec9['message']));});});}; \ No newline at end of file +var _0x89a1=['catch','create','body','options','raw','CreateChatMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x31f29d,_0x2113c9){var _0x4bbc32=function(_0x2dfaa3){while(--_0x2dfaa3){_0x31f29d['push'](_0x31f29d['shift']());}};_0x4bbc32(++_0x2113c9);}(_0x89a1,0x1db));var _0x189a=function(_0x513c6f,_0x5f368d){_0x513c6f=_0x513c6f-0x0;var _0x344fa7=_0x89a1[_0x513c6f];return _0x344fa7;};'use strict';var _=require(_0x189a('0x0'));var util=require(_0x189a('0x1'));var moment=require(_0x189a('0x2'));var BPromise=require(_0x189a('0x3'));var rs=require(_0x189a('0x4'));var fs=require('fs');var Redis=require(_0x189a('0x5'));var db=require(_0x189a('0x6'))['db'];var utils=require(_0x189a('0x7'));var logger=require(_0x189a('0x8'))(_0x189a('0x9'));var config=require(_0x189a('0xa'));var jayson=require(_0x189a('0xb'));var client=jayson[_0x189a('0xc')][_0x189a('0xd')]({'port':0x232a});config[_0x189a('0xe')]=_[_0x189a('0xf')](config[_0x189a('0xe')],{'host':_0x189a('0x10'),'port':0x18eb});var socket=require(_0x189a('0x11'))(new Redis(config[_0x189a('0xe')]));require('./chatMessage.socket')[_0x189a('0x12')](socket);function respondWithRpcPromise(_0x1659a7,_0x436987,_0x11fc6c){return new BPromise(function(_0x5bdced,_0x1c5811){return client[_0x189a('0x13')](_0x1659a7,_0x11fc6c)[_0x189a('0x14')](function(_0x27f7a9){logger[_0x189a('0x15')](_0x189a('0x16'),_0x436987,_0x189a('0x17'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x436987,'request\x20sent',JSON[_0x189a('0x18')](_0x27f7a9));if(_0x27f7a9[_0x189a('0x19')]){if(_0x27f7a9[_0x189a('0x19')][_0x189a('0x1a')]===0x1f4){logger[_0x189a('0x19')]('ChatMessage,\x20%s,\x20%s',_0x436987,_0x27f7a9[_0x189a('0x19')][_0x189a('0x1b')]);return _0x1c5811(_0x27f7a9[_0x189a('0x19')][_0x189a('0x1b')]);}logger[_0x189a('0x19')]('ChatMessage,\x20%s,\x20%s',_0x436987,_0x27f7a9[_0x189a('0x19')][_0x189a('0x1b')]);return _0x5bdced(_0x27f7a9[_0x189a('0x19')]['message']);}else{logger[_0x189a('0x15')](_0x189a('0x16'),_0x436987,_0x189a('0x17'));_0x5bdced(_0x27f7a9[_0x189a('0x1c')][_0x189a('0x1b')]);}})[_0x189a('0x1d')](function(_0x655f2e){logger[_0x189a('0x19')](_0x189a('0x16'),_0x436987,_0x655f2e);_0x1c5811(_0x655f2e);});});}exports['CreateChatMessage']=function(_0x1956e2){var _0xaf0300=this;return new Promise(function(_0x105a94,_0x1e1ae7){return db['ChatMessage'][_0x189a('0x1e')](_0x1956e2[_0x189a('0x1f')],{'raw':_0x1956e2['options']?_0x1956e2[_0x189a('0x20')][_0x189a('0x21')]===undefined?!![]:![]:!![]})[_0x189a('0x14')](function(_0x3fffaa){logger[_0x189a('0x15')](_0x189a('0x22'),_0x1956e2);logger[_0x189a('0x23')]('CreateChatMessage',_0x1956e2,JSON[_0x189a('0x18')](_0x3fffaa));_0x105a94(_0x3fffaa);})[_0x189a('0x1d')](function(_0x23333b){logger[_0x189a('0x19')](_0x189a('0x22'),_0x23333b['message'],_0x1956e2);_0x1e1ae7(_0xaf0300[_0x189a('0x19')](0x1f4,_0x23333b[_0x189a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e5d2273..9928c41 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 _0xf987=['length','chatMessage:','remove','update','emit','removeListener','register'];(function(_0x43eebe,_0x35d1ad){var _0x5cd9e0=function(_0x55ddfe){while(--_0x55ddfe){_0x43eebe['push'](_0x43eebe['shift']());}};_0x5cd9e0(++_0x35d1ad);}(_0xf987,0x18a));var _0x7f98=function(_0x326302,_0x357e30){_0x326302=_0x326302-0x0;var _0x45cbe2=_0xf987[_0x326302];return _0x45cbe2;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x7f98('0x0'),_0x7f98('0x1')];function createListener(_0x4d17d6,_0x46c60f){return function(_0x13b552){_0x46c60f[_0x7f98('0x2')](_0x4d17d6,_0x13b552);};}function removeListener(_0x1229f9,_0x1e6caa){return function(){ChatMessageEvents[_0x7f98('0x3')](_0x1229f9,_0x1e6caa);};}exports[_0x7f98('0x4')]=function(_0x3b5abb){for(var _0x3fb8e2=0x0,_0x25001e=events[_0x7f98('0x5')];_0x3fb8e2<_0x25001e;_0x3fb8e2++){var _0x290763=events[_0x3fb8e2];var _0x5bb41e=createListener(_0x7f98('0x6')+_0x290763,_0x3b5abb);ChatMessageEvents['on'](_0x290763,_0x5bb41e);}}; \ No newline at end of file +var _0x99c9=['removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x33c054,_0x3a2f59){var _0x3eeb43=function(_0x3e05d6){while(--_0x3e05d6){_0x33c054['push'](_0x33c054['shift']());}};_0x3eeb43(++_0x3a2f59);}(_0x99c9,0x13c));var _0x999c=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x99c9[_0x7e2eb0];return _0xd92de4;};'use strict';var ChatMessageEvents=require(_0x999c('0x0'));var events=[_0x999c('0x1'),_0x999c('0x2'),_0x999c('0x3')];function createListener(_0x2bb83d,_0x16a7a3){return function(_0x31e9b1){_0x16a7a3['emit'](_0x2bb83d,_0x31e9b1);};}function removeListener(_0x2a4e06,_0x140cd5){return function(){ChatMessageEvents[_0x999c('0x4')](_0x2a4e06,_0x140cd5);};}exports[_0x999c('0x5')]=function(_0x2bdd73){for(var _0x14df32=0x0,_0x34f100=events[_0x999c('0x6')];_0x14df32<_0x34f100;_0x14df32++){var _0xc8a6b5=events[_0x14df32];var _0xb88ec1=createListener(_0x999c('0x7')+_0xc8a6b5,_0x2bdd73);ChatMessageEvents['on'](_0xc8a6b5,_0xb88ec1);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index af56926..9862155 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 _0xd037=['isAuthenticated','index','get','describe','/:id','show','post','tracked','chat','update','put','/:id/accept','reject','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xd037,0x195));var _0x7d03=function(_0x33bff8,_0x49109b){_0x33bff8=_0x33bff8-0x0;var _0x14797b=_0xd037[_0x33bff8];return _0x14797b;};'use strict';var multer=require(_0x7d03('0x0'));var util=require(_0x7d03('0x1'));var path=require(_0x7d03('0x2'));var timeout=require(_0x7d03('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7d03('0x4'));var auth=require(_0x7d03('0x5'));var interaction=require(_0x7d03('0x6'));var config=require(_0x7d03('0x7'));var controller=require(_0x7d03('0x8'));router['get']('/',auth[_0x7d03('0x9')](),controller[_0x7d03('0xa')]);router[_0x7d03('0xb')]('/describe',auth[_0x7d03('0x9')](),controller[_0x7d03('0xc')]);router['get'](_0x7d03('0xd'),auth[_0x7d03('0x9')](),controller[_0x7d03('0xe')]);router[_0x7d03('0xf')]('/',auth[_0x7d03('0x9')](),interaction[_0x7d03('0x10')](_0x7d03('0x11'),'chatmessage:create'),controller['create']);router['put'](_0x7d03('0xd'),controller[_0x7d03('0x12')]);router[_0x7d03('0x13')](_0x7d03('0x14'),auth[_0x7d03('0x9')](),controller['accept']);router[_0x7d03('0x13')]('/:id/reject',auth[_0x7d03('0x9')](),controller[_0x7d03('0x15')]);router[_0x7d03('0x16')]('/:id',auth[_0x7d03('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5d00=['post','tracked','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','multer','connect-timeout','../../components/interaction/service','../../config/environment','get','describe','/:id','isAuthenticated','show'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x5d00,0x160));var _0x05d0=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x5d00[_0x48e1ec];return _0x3b33eb;};'use strict';var multer=require(_0x05d0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x05d0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x05d0('0x2'));var config=require(_0x05d0('0x3'));var controller=require('./chatMessage.controller');router[_0x05d0('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x05d0('0x5')]);router[_0x05d0('0x4')](_0x05d0('0x6'),auth[_0x05d0('0x7')](),controller[_0x05d0('0x8')]);router[_0x05d0('0x9')]('/',auth[_0x05d0('0x7')](),interaction[_0x05d0('0xa')]('chat',_0x05d0('0xb')),controller[_0x05d0('0xc')]);router[_0x05d0('0xd')](_0x05d0('0x6'),controller[_0x05d0('0xe')]);router[_0x05d0('0xd')](_0x05d0('0xf'),auth[_0x05d0('0x7')](),controller[_0x05d0('0x10')]);router['put'](_0x05d0('0x11'),auth[_0x05d0('0x7')](),controller['reject']);router['delete'](_0x05d0('0x6'),auth[_0x05d0('0x7')](),controller[_0x05d0('0x12')]);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 9a6439e..751290a 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 _0xadb5=['medium','TEXT','exports'];(function(_0x4ec923,_0x25bdbe){var _0x5d76fa=function(_0x3a6149){while(--_0x3a6149){_0x4ec923['push'](_0x4ec923['shift']());}};_0x5d76fa(++_0x25bdbe);}(_0xadb5,0xad));var _0x5adb=function(_0x46f65d,_0x45465e){_0x46f65d=_0x46f65d-0x0;var _0x34d768=_0xadb5[_0x46f65d];return _0x34d768;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x0b0e[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index dc8f0af..2c148f9 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(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x7a54,0x106));var _0x47a5=function(_0x29700a,_0x42a940){_0x29700a=_0x29700a-0x0;var _0x3efe26=_0x7a54[_0x29700a];return _0x3efe26;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7a54,0x106));var _0x47a5=function(_0x58b6e9,_0x5a5150){_0x58b6e9=_0x58b6e9-0x0;var _0x5cc2af=_0x7a54[_0x58b6e9];return _0x5cc2af;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index ac4d578..9ad0da5 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 _0xea78=['hook','exports','events','../../mysqldb','ChatOfflineMessage','update','remove','emit'];(function(_0x280f85,_0x54d1d0){var _0x44eb0e=function(_0x4b74e7){while(--_0x4b74e7){_0x280f85['push'](_0x280f85['shift']());}};_0x44eb0e(++_0x54d1d0);}(_0xea78,0x162));var _0x8ea7=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xea78[_0x506d2f];return _0x101255;};'use strict';var EventEmitter=require(_0x8ea7('0x0'));var ChatOfflineMessage=require(_0x8ea7('0x1'))['db'][_0x8ea7('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ea7('0x3'),'afterDestroy':_0x8ea7('0x4')};function emitEvent(_0x23bd7d){return function(_0x5ee490,_0x18aabf,_0x2eaa9f){ChatOfflineMessageEvents['emit'](_0x23bd7d+':'+_0x5ee490['id'],_0x5ee490);ChatOfflineMessageEvents[_0x8ea7('0x5')](_0x23bd7d,_0x5ee490);_0x2eaa9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x8ea7('0x6')](e,emitEvent(event));}}module[_0x8ea7('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x8a83=['hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x8a83,0x1b0));var _0x38a8=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x8a83[_0x4d674b];return _0x535a1f;};'use strict';var EventEmitter=require(_0x38a8('0x0'));var ChatOfflineMessage=require(_0x38a8('0x1'))['db'][_0x38a8('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x38a8('0x3')](0x0);var events={'afterCreate':_0x38a8('0x4'),'afterUpdate':_0x38a8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a3bff){return function(_0x2904b4,_0x222847,_0x35d279){ChatOfflineMessageEvents[_0x38a8('0x6')](_0x2a3bff+':'+_0x2904b4['id'],_0x2904b4);ChatOfflineMessageEvents[_0x38a8('0x6')](_0x2a3bff,_0x2904b4);_0x35d279(null);};}for(var e in events){if(events[_0x38a8('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x38a8('0x8')](e,emitEvent(event));}}module[_0x38a8('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 41cdcd9..4933915 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 _0xbbf1=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','chat_offline_messages','utf8mb4'];(function(_0x292a0b,_0x3b2a29){var _0x2f3ccc=function(_0x337cff){while(--_0x337cff){_0x292a0b['push'](_0x292a0b['shift']());}};_0x2f3ccc(++_0x3b2a29);}(_0xbbf1,0x185));var _0x1bbf=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xbbf1[_0x5b27da];return _0x3254f4;};'use strict';var attributes=require(_0x1bbf('0x0'));module['exports']=function(_0x424d3e){return _0x424d3e['define']('ChatOfflineMessage',attributes,{'tableName':_0x1bbf('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1bbf('0x2'),'collate':_0x1bbf('0x3')});}; \ No newline at end of file +var _0xb017=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define'];(function(_0x5da116,_0x408dd0){var _0x1af4c3=function(_0x54f2f2){while(--_0x54f2f2){_0x5da116['push'](_0x5da116['shift']());}};_0x1af4c3(++_0x408dd0);}(_0xb017,0x10c));var _0x7b01=function(_0x1dd931,_0x178908){_0x1dd931=_0x1dd931-0x0;var _0x49fa0c=_0xb017[_0x1dd931];return _0x49fa0c;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x7b01('0x0')]=function(_0x2bb14d){return _0x2bb14d[_0x7b01('0x1')](_0x7b01('0x2'),attributes,{'tableName':_0x7b01('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b01('0x4'),'collate':_0x7b01('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 46014eb..a3556b5 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 _0x93eb=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','info'];(function(_0x200196,_0x323717){var _0x38c937=function(_0x446f90){while(--_0x446f90){_0x200196['push'](_0x200196['shift']());}};_0x38c937(++_0x323717);}(_0x93eb,0x10c));var _0xb93e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x93eb[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xb93e('0x0'));var util=require(_0xb93e('0x1'));var moment=require(_0xb93e('0x2'));var BPromise=require(_0xb93e('0x3'));var rs=require(_0xb93e('0x4'));var fs=require('fs');var Redis=require(_0xb93e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb93e('0x6'));var logger=require(_0xb93e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb93e('0x8'));var client=jayson[_0xb93e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x458521,_0x5acc43,_0x5724a2){return new BPromise(function(_0xfd389a,_0x54f722){return client[_0xb93e('0xa')](_0x458521,_0x5724a2)['then'](function(_0x5b1c59){logger[_0xb93e('0xb')](_0xb93e('0xc'),_0x5acc43,_0xb93e('0xd'));logger['debug'](_0xb93e('0xe'),_0x5acc43,_0xb93e('0xd'),JSON[_0xb93e('0xf')](_0x5b1c59));if(_0x5b1c59[_0xb93e('0x10')]){if(_0x5b1c59[_0xb93e('0x10')]['code']===0x1f4){logger[_0xb93e('0x10')](_0xb93e('0xc'),_0x5acc43,_0x5b1c59['error'][_0xb93e('0x11')]);return _0x54f722(_0x5b1c59['error'][_0xb93e('0x11')]);}logger[_0xb93e('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5acc43,_0x5b1c59[_0xb93e('0x10')]['message']);return _0xfd389a(_0x5b1c59[_0xb93e('0x10')][_0xb93e('0x11')]);}else{logger[_0xb93e('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5acc43,_0xb93e('0xd'));_0xfd389a(_0x5b1c59[_0xb93e('0x12')][_0xb93e('0x11')]);}})[_0xb93e('0x13')](function(_0x2a102e){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x5acc43,_0x2a102e);_0x54f722(_0x2a102e);});});} \ No newline at end of file +var _0x14e4=['request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0xeb2741,_0x57b5a4){var _0x2ba0f9=function(_0x5e1d60){while(--_0x5e1d60){_0xeb2741['push'](_0xeb2741['shift']());}};_0x2ba0f9(++_0x57b5a4);}(_0x14e4,0x8c));var _0x414e=function(_0xd3abe6,_0xc385b2){_0xd3abe6=_0xd3abe6-0x0;var _0x3defcf=_0x14e4[_0xd3abe6];return _0x3defcf;};'use strict';var _=require('lodash');var util=require(_0x414e('0x0'));var moment=require(_0x414e('0x1'));var BPromise=require(_0x414e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x414e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x414e('0x4'))(_0x414e('0x5'));var config=require('../../config/environment');var jayson=require(_0x414e('0x6'));var client=jayson['client'][_0x414e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ce093,_0x1edf84,_0x356511){return new BPromise(function(_0x4c0174,_0x52f29d){return client[_0x414e('0x8')](_0x2ce093,_0x356511)[_0x414e('0x9')](function(_0x4a47ae){logger[_0x414e('0xa')](_0x414e('0xb'),_0x1edf84,_0x414e('0xc'));logger[_0x414e('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1edf84,_0x414e('0xc'),JSON[_0x414e('0xe')](_0x4a47ae));if(_0x4a47ae[_0x414e('0xf')]){if(_0x4a47ae[_0x414e('0xf')]['code']===0x1f4){logger[_0x414e('0xf')](_0x414e('0xb'),_0x1edf84,_0x4a47ae['error'][_0x414e('0x10')]);return _0x52f29d(_0x4a47ae[_0x414e('0xf')]['message']);}logger[_0x414e('0xf')](_0x414e('0xb'),_0x1edf84,_0x4a47ae[_0x414e('0xf')][_0x414e('0x10')]);return _0x4c0174(_0x4a47ae[_0x414e('0xf')][_0x414e('0x10')]);}else{logger[_0x414e('0xa')](_0x414e('0xb'),_0x1edf84,_0x414e('0xc'));_0x4c0174(_0x4a47ae[_0x414e('0x11')]['message']);}})[_0x414e('0x12')](function(_0x547cba){logger[_0x414e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1edf84,_0x547cba);_0x52f29d(_0x547cba);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 967b0bc..cc22d12 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 _0x2b10=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','create','update','delete','destroy'];(function(_0x441fae,_0x3ab2ee){var _0x189025=function(_0x4914e1){while(--_0x4914e1){_0x441fae['push'](_0x441fae['shift']());}};_0x189025(++_0x3ab2ee);}(_0x2b10,0x1ef));var _0x02b1=function(_0x19c073,_0x176ee7){_0x19c073=_0x19c073-0x0;var _0x267ce1=_0x2b10[_0x19c073];return _0x267ce1;};'use strict';var multer=require(_0x02b1('0x0'));var util=require(_0x02b1('0x1'));var path=require('path');var timeout=require(_0x02b1('0x2'));var express=require('express');var router=express[_0x02b1('0x3')]();var fs_extra=require(_0x02b1('0x4'));var auth=require(_0x02b1('0x5'));var interaction=require(_0x02b1('0x6'));var config=require('../../config/environment');var controller=require(_0x02b1('0x7'));router['get']('/',auth[_0x02b1('0x8')](),controller[_0x02b1('0x9')]);router[_0x02b1('0xa')](_0x02b1('0xb'),auth[_0x02b1('0x8')](),controller[_0x02b1('0xc')]);router[_0x02b1('0xa')](_0x02b1('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x02b1('0x8')](),controller[_0x02b1('0xe')]);router['put'](_0x02b1('0xd'),auth[_0x02b1('0x8')](),controller[_0x02b1('0xf')]);router[_0x02b1('0x10')](_0x02b1('0xd'),auth[_0x02b1('0x8')](),controller[_0x02b1('0x11')]);module[_0x02b1('0x12')]=router; \ No newline at end of file +var _0x4fe6=['create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xd2e497,_0x35c776){var _0x55175c=function(_0x1c95db){while(--_0x1c95db){_0xd2e497['push'](_0xd2e497['shift']());}};_0x55175c(++_0x35c776);}(_0x4fe6,0x194));var _0x64fe=function(_0x6977e6,_0x307a79){_0x6977e6=_0x6977e6-0x0;var _0x18ab67=_0x4fe6[_0x6977e6];return _0x18ab67;};'use strict';var multer=require(_0x64fe('0x0'));var util=require(_0x64fe('0x1'));var path=require(_0x64fe('0x2'));var timeout=require(_0x64fe('0x3'));var express=require(_0x64fe('0x4'));var router=express[_0x64fe('0x5')]();var fs_extra=require(_0x64fe('0x6'));var auth=require(_0x64fe('0x7'));var interaction=require(_0x64fe('0x8'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x64fe('0x9')]('/',auth[_0x64fe('0xa')](),controller[_0x64fe('0xb')]);router[_0x64fe('0x9')](_0x64fe('0xc'),auth[_0x64fe('0xa')](),controller[_0x64fe('0xd')]);router[_0x64fe('0x9')](_0x64fe('0xe'),auth['isAuthenticated'](),controller[_0x64fe('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x64fe('0x10')]);router['put'](_0x64fe('0xe'),auth['isAuthenticated'](),controller[_0x64fe('0x11')]);router['delete'](_0x64fe('0xe'),auth[_0x64fe('0xa')](),controller[_0x64fe('0x12')]);module[_0x64fe('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7a0d2e7..da428cd 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 _0xe550=['exports','ENUM','mouseOver','INTEGER'];(function(_0x19601b,_0x157b58){var _0x57fc00=function(_0x25dccf){while(--_0x25dccf){_0x19601b['push'](_0x19601b['shift']());}};_0x57fc00(++_0x157b58);}(_0xe550,0x64));var _0x0e55=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe550[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x0e55('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0e55('0x1')]('mouseOver','timeout'),'defaultValue':_0x0e55('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0e55('0x3')]}}; \ No newline at end of file +var _0x45ed=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x45ed,0x140));var _0xd45e=function(_0x34951f,_0x277327){_0x34951f=_0x34951f-0x0;var _0x487db1=_0x45ed[_0x34951f];return _0x487db1;};'use strict';var Sequelize=require(_0xd45e('0x0'));module[_0xd45e('0x1')]={'name':{'type':Sequelize[_0xd45e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd45e('0x3')](_0xd45e('0x4'),_0xd45e('0x5')),'defaultValue':_0xd45e('0x4')},'selector':{'type':Sequelize[_0xd45e('0x2')]},'timeout':{'type':Sequelize[_0xd45e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index db3841e..1894f6a 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 _0x1666=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','params','model','keys','ChatProactiveAction','filters','intersection','query','attributes','fields','length','merge','options','find','create','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0x1666,0x75));var _0x6166=function(_0x4c61cf,_0x782f8a){_0x4c61cf=_0x4c61cf-0x0;var _0x58fef8=_0x1666[_0x4c61cf];return _0x58fef8;};'use strict';var emlformat=require(_0x6166('0x0'));var rimraf=require(_0x6166('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6166('0x2'));var rp=require(_0x6166('0x3'));var moment=require(_0x6166('0x4'));var BPromise=require(_0x6166('0x5'));var Mustache=require(_0x6166('0x6'));var util=require(_0x6166('0x7'));var path=require(_0x6166('0x8'));var sox=require(_0x6166('0x9'));var csv=require('to-csv');var ejs=require(_0x6166('0xa'));var fs=require('fs');var fs_extra=require(_0x6166('0xb'));var _=require(_0x6166('0xc'));var squel=require(_0x6166('0xd'));var crypto=require(_0x6166('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6166('0xf'));var Papa=require('papaparse');var Redis=require(_0x6166('0x10'));var authService=require(_0x6166('0x11'));var qs=require(_0x6166('0x12'));var as=require(_0x6166('0x13'));var hardwareService=require(_0x6166('0x14'));var logger=require(_0x6166('0x15'))(_0x6166('0x16'));var utils=require('../../config/utils');var config=require(_0x6166('0x17'));var licenseUtil=require(_0x6166('0x18'));var db=require(_0x6166('0x19'))['db'];function respondWithStatusCode(_0x5b2335,_0x320728){_0x320728=_0x320728||0xcc;return function(_0x2ce997){if(_0x2ce997){return _0x5b2335[_0x6166('0x1a')](_0x320728);}return _0x5b2335[_0x6166('0x1b')](_0x320728)['end']();};}function respondWithResult(_0x1316f2,_0x33789f){_0x33789f=_0x33789f||0xc8;return function(_0x42abca){if(_0x42abca){return _0x1316f2[_0x6166('0x1b')](_0x33789f)[_0x6166('0x1c')](_0x42abca);}};}function respondWithFilteredResult(_0x147874,_0x56520c){return function(_0x3d2f83){if(_0x3d2f83){var _0x12f0a5=typeof _0x56520c[_0x6166('0x1d')]===_0x6166('0x1e')&&typeof _0x56520c[_0x6166('0x1f')]===_0x6166('0x1e');var _0x15f2e3=_0x3d2f83['count'];var _0x29764d=_0x12f0a5?0x0:_0x56520c[_0x6166('0x1d')];var _0x171795=_0x12f0a5?_0x3d2f83[_0x6166('0x20')]:_0x56520c[_0x6166('0x1d')]+_0x56520c['limit'];var _0x1c823b;if(_0x171795>=_0x15f2e3){_0x171795=_0x15f2e3;_0x1c823b=0xc8;}else{_0x1c823b=0xce;}_0x147874[_0x6166('0x1b')](_0x1c823b);return _0x147874[_0x6166('0x21')](_0x6166('0x22'),_0x29764d+'-'+_0x171795+'/'+_0x15f2e3)[_0x6166('0x1c')](_0x3d2f83);}return null;};}function patchUpdates(_0x28d90c){return function(_0x2411de){try{jsonpatch[_0x6166('0x23')](_0x2411de,_0x28d90c,!![]);}catch(_0x3b5a7e){return BPromise[_0x6166('0x24')](_0x3b5a7e);}return _0x2411de[_0x6166('0x25')]();};}function saveUpdates(_0x49c474,_0x1646ff){return function(_0x438ed3){if(_0x438ed3){return _0x438ed3[_0x6166('0x26')](_0x49c474)[_0x6166('0x27')](function(_0x33bc9b){return _0x33bc9b;});}return null;};}function removeEntity(_0x1d23c3,_0x3ffd46){return function(_0x26d926){if(_0x26d926){return _0x26d926['destroy']()[_0x6166('0x27')](function(){_0x1d23c3['status'](0xcc)[_0x6166('0x28')]();});}};}function handleEntityNotFound(_0x10a23e,_0x489b88){return function(_0x3b7452){if(!_0x3b7452){_0x10a23e[_0x6166('0x1a')](0x194);}return _0x3b7452;};}function handleError(_0x3b6107,_0x38fdb1){_0x38fdb1=_0x38fdb1||0x1f4;return function(_0x494838){logger[_0x6166('0x29')](_0x494838[_0x6166('0x2a')]);if(_0x494838[_0x6166('0x2b')]){delete _0x494838[_0x6166('0x2b')];}_0x3b6107[_0x6166('0x1b')](_0x38fdb1)[_0x6166('0x2c')](_0x494838);};}exports['show']=function(_0x54213b,_0x2c1167){var _0x2c1e5f={'raw':!![],'where':{'id':_0x54213b[_0x6166('0x2d')]['id']}},_0x357525={};_0x357525[_0x6166('0x2e')]=_[_0x6166('0x2f')](db[_0x6166('0x30')]['rawAttributes']);_0x357525['query']=_[_0x6166('0x2f')](_0x54213b['query']);_0x357525[_0x6166('0x31')]=_[_0x6166('0x32')](_0x357525[_0x6166('0x2e')],_0x357525[_0x6166('0x33')]);_0x2c1e5f[_0x6166('0x34')]=_['intersection'](_0x357525[_0x6166('0x2e')],qs[_0x6166('0x35')](_0x54213b[_0x6166('0x33')][_0x6166('0x35')]));_0x2c1e5f[_0x6166('0x34')]=_0x2c1e5f[_0x6166('0x34')][_0x6166('0x36')]?_0x2c1e5f['attributes']:_0x357525[_0x6166('0x2e')];if(_0x54213b[_0x6166('0x33')]['includeAll']){_0x2c1e5f['include']=[{'all':!![]}];}_0x2c1e5f=_[_0x6166('0x37')]({},_0x2c1e5f,_0x54213b[_0x6166('0x38')]);return db['ChatProactiveAction'][_0x6166('0x39')](_0x2c1e5f)[_0x6166('0x27')](handleEntityNotFound(_0x2c1167,null))[_0x6166('0x27')](respondWithResult(_0x2c1167,null))['catch'](handleError(_0x2c1167,null));};exports[_0x6166('0x3a')]=function(_0x45d518,_0x228790){return db['ChatProactiveAction']['create'](_0x45d518['body'],{})[_0x6166('0x27')](respondWithResult(_0x228790,0xc9))[_0x6166('0x3b')](handleError(_0x228790,null));};exports[_0x6166('0x26')]=function(_0x443a20,_0x38bb21){if(_0x443a20['body']['id']){delete _0x443a20[_0x6166('0x3c')]['id'];}return db[_0x6166('0x30')][_0x6166('0x39')]({'where':{'id':_0x443a20[_0x6166('0x2d')]['id']}})['then'](handleEntityNotFound(_0x38bb21,null))[_0x6166('0x27')](saveUpdates(_0x443a20[_0x6166('0x3c')],null))[_0x6166('0x27')](respondWithResult(_0x38bb21,null))[_0x6166('0x3b')](handleError(_0x38bb21,null));};exports['destroy']=function(_0x3a9917,_0x111d3b){return db[_0x6166('0x30')][_0x6166('0x39')]({'where':{'id':_0x3a9917[_0x6166('0x2d')]['id']}})[_0x6166('0x27')](handleEntityNotFound(_0x111d3b,null))['then'](removeEntity(_0x111d3b,null))[_0x6166('0x3b')](handleError(_0x111d3b,null));}; \ No newline at end of file +var _0x4016=['then','destroy','error','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','rimraf','zip-dir','bluebird','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x4016,0x131));var _0x6401=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4016[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6401('0x0'));var zipdir=require(_0x6401('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6401('0x2'));var Mustache=require('mustache');var util=require(_0x6401('0x3'));var path=require(_0x6401('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6401('0x5'));var fs=require('fs');var fs_extra=require(_0x6401('0x6'));var _=require('lodash');var squel=require(_0x6401('0x7'));var crypto=require('crypto');var jsforce=require(_0x6401('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6401('0x9'));var querystring=require(_0x6401('0xa'));var Papa=require(_0x6401('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6401('0xc'));var as=require(_0x6401('0xd'));var hardwareService=require(_0x6401('0xe'));var logger=require('../../config/logger')(_0x6401('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6401('0x10'));var db=require(_0x6401('0x11'))['db'];function respondWithStatusCode(_0x26ec93,_0x45e88a){_0x45e88a=_0x45e88a||0xcc;return function(_0xf7fc5){if(_0xf7fc5){return _0x26ec93[_0x6401('0x12')](_0x45e88a);}return _0x26ec93[_0x6401('0x13')](_0x45e88a)[_0x6401('0x14')]();};}function respondWithResult(_0x381c17,_0x1f6edf){_0x1f6edf=_0x1f6edf||0xc8;return function(_0x45fcea){if(_0x45fcea){return _0x381c17[_0x6401('0x13')](_0x1f6edf)[_0x6401('0x15')](_0x45fcea);}};}function respondWithFilteredResult(_0x29fedc,_0x4c740a){return function(_0x1b510e){if(_0x1b510e){var _0x1fd3b8=typeof _0x4c740a[_0x6401('0x16')]===_0x6401('0x17')&&typeof _0x4c740a[_0x6401('0x18')]===_0x6401('0x17');var _0x4521b6=_0x1b510e['count'];var _0x55ca87=_0x1fd3b8?0x0:_0x4c740a[_0x6401('0x16')];var _0x50eda7=_0x1fd3b8?_0x1b510e[_0x6401('0x19')]:_0x4c740a[_0x6401('0x16')]+_0x4c740a[_0x6401('0x18')];var _0x3c3a6c;if(_0x50eda7>=_0x4521b6){_0x50eda7=_0x4521b6;_0x3c3a6c=0xc8;}else{_0x3c3a6c=0xce;}_0x29fedc[_0x6401('0x13')](_0x3c3a6c);return _0x29fedc[_0x6401('0x1a')](_0x6401('0x1b'),_0x55ca87+'-'+_0x50eda7+'/'+_0x4521b6)['json'](_0x1b510e);}return null;};}function patchUpdates(_0x10fd3c){return function(_0x44525b){try{jsonpatch[_0x6401('0x1c')](_0x44525b,_0x10fd3c,!![]);}catch(_0x1757ab){return BPromise['reject'](_0x1757ab);}return _0x44525b[_0x6401('0x1d')]();};}function saveUpdates(_0x343d25,_0x4ed76d){return function(_0x20b445){if(_0x20b445){return _0x20b445[_0x6401('0x1e')](_0x343d25)[_0x6401('0x1f')](function(_0xdea921){return _0xdea921;});}return null;};}function removeEntity(_0x19d6a0,_0x39bca3){return function(_0xed5d29){if(_0xed5d29){return _0xed5d29[_0x6401('0x20')]()[_0x6401('0x1f')](function(){_0x19d6a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55818a,_0xee5737){return function(_0x12f19a){if(!_0x12f19a){_0x55818a[_0x6401('0x12')](0x194);}return _0x12f19a;};}function handleError(_0x4e6d9f,_0x3b1d99){_0x3b1d99=_0x3b1d99||0x1f4;return function(_0x102f69){logger[_0x6401('0x21')](_0x102f69[_0x6401('0x22')]);if(_0x102f69['name']){delete _0x102f69['name'];}_0x4e6d9f[_0x6401('0x13')](_0x3b1d99)[_0x6401('0x23')](_0x102f69);};}exports[_0x6401('0x24')]=function(_0x466a35,_0x549b8c){var _0x7f6e88={'raw':!![],'where':{'id':_0x466a35[_0x6401('0x25')]['id']}},_0x43e089={};_0x43e089[_0x6401('0x26')]=_[_0x6401('0x27')](db[_0x6401('0x28')][_0x6401('0x29')]);_0x43e089[_0x6401('0x2a')]=_['keys'](_0x466a35[_0x6401('0x2a')]);_0x43e089[_0x6401('0x2b')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],_0x43e089['query']);_0x7f6e88[_0x6401('0x2d')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],qs['fields'](_0x466a35['query'][_0x6401('0x2e')]));_0x7f6e88['attributes']=_0x7f6e88[_0x6401('0x2d')][_0x6401('0x2f')]?_0x7f6e88[_0x6401('0x2d')]:_0x43e089[_0x6401('0x26')];if(_0x466a35[_0x6401('0x2a')][_0x6401('0x30')]){_0x7f6e88[_0x6401('0x31')]=[{'all':!![]}];}_0x7f6e88=_[_0x6401('0x32')]({},_0x7f6e88,_0x466a35[_0x6401('0x33')]);return db['ChatProactiveAction'][_0x6401('0x34')](_0x7f6e88)[_0x6401('0x1f')](handleEntityNotFound(_0x549b8c,null))[_0x6401('0x1f')](respondWithResult(_0x549b8c,null))[_0x6401('0x35')](handleError(_0x549b8c,null));};exports[_0x6401('0x36')]=function(_0x556354,_0xd7a00f){return db[_0x6401('0x28')]['create'](_0x556354[_0x6401('0x37')],{})['then'](respondWithResult(_0xd7a00f,0xc9))[_0x6401('0x35')](handleError(_0xd7a00f,null));};exports[_0x6401('0x1e')]=function(_0x5317f8,_0x444339){if(_0x5317f8[_0x6401('0x37')]['id']){delete _0x5317f8[_0x6401('0x37')]['id'];}return db[_0x6401('0x28')]['find']({'where':{'id':_0x5317f8[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x444339,null))[_0x6401('0x1f')](saveUpdates(_0x5317f8['body'],null))[_0x6401('0x1f')](respondWithResult(_0x444339,null))[_0x6401('0x35')](handleError(_0x444339,null));};exports['destroy']=function(_0x79d73f,_0x337d1c){return db[_0x6401('0x28')][_0x6401('0x34')]({'where':{'id':_0x79d73f[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x337d1c,null))[_0x6401('0x1f')](removeEntity(_0x337d1c,null))[_0x6401('0x35')](handleError(_0x337d1c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 03d3af8..1f642c9 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 _0x2049=['../../config/environment','define','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19faf8,_0x2bc510){var _0x56319f=function(_0x226978){while(--_0x226978){_0x19faf8['push'](_0x19faf8['shift']());}};_0x56319f(++_0x2bc510);}(_0x2049,0x16e));var _0x9204=function(_0x33cd52,_0x4265b7){_0x33cd52=_0x33cd52-0x0;var _0x590be8=_0x2049[_0x33cd52];return _0x590be8;};'use strict';var _=require(_0x9204('0x0'));var util=require(_0x9204('0x1'));var logger=require('../../config/logger')(_0x9204('0x2'));var moment=require(_0x9204('0x3'));var BPromise=require(_0x9204('0x4'));var rp=require(_0x9204('0x5'));var fs=require('fs');var path=require(_0x9204('0x6'));var rimraf=require(_0x9204('0x7'));var config=require(_0x9204('0x8'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x5343f1,_0xc994c7){return _0x5343f1[_0x9204('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x9204('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0de9=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x4b1247,_0x490d88){var _0x4139ef=function(_0x597fc9){while(--_0x597fc9){_0x4b1247['push'](_0x4b1247['shift']());}};_0x4139ef(++_0x490d88);}(_0x0de9,0x187));var _0x90de=function(_0x29dbb5,_0x204721){_0x29dbb5=_0x29dbb5-0x0;var _0x137fc6=_0x0de9[_0x29dbb5];return _0x137fc6;};'use strict';var _=require(_0x90de('0x0'));var util=require(_0x90de('0x1'));var logger=require(_0x90de('0x2'))(_0x90de('0x3'));var moment=require(_0x90de('0x4'));var BPromise=require(_0x90de('0x5'));var rp=require(_0x90de('0x6'));var fs=require('fs');var path=require(_0x90de('0x7'));var rimraf=require(_0x90de('0x8'));var config=require(_0x90de('0x9'));var attributes=require(_0x90de('0xa'));module[_0x90de('0xb')]=function(_0x342e9f,_0x4d5863){return _0x342e9f[_0x90de('0xc')](_0x90de('0xd'),attributes,{'tableName':_0x90de('0xe'),'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 928f3eb..d0c9f78 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 _0x10ac=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','http','then','info'];(function(_0x20a877,_0x46be41){var _0x5db413=function(_0x3d2a2b){while(--_0x3d2a2b){_0x20a877['push'](_0x20a877['shift']());}};_0x5db413(++_0x46be41);}(_0x10ac,0xb4));var _0xc10a=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x10ac[_0x2bbc07];return _0x6879e4;};'use strict';var _=require(_0xc10a('0x0'));var util=require(_0xc10a('0x1'));var moment=require(_0xc10a('0x2'));var BPromise=require(_0xc10a('0x3'));var rs=require(_0xc10a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc10a('0x5'));var config=require(_0xc10a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc10a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35e015,_0x1ce334,_0x108bb2){return new BPromise(function(_0xe9cfd7,_0x1d9e3e){return client['request'](_0x35e015,_0x108bb2)[_0xc10a('0x8')](function(_0x24411d){logger[_0xc10a('0x9')](_0xc10a('0xa'),_0x1ce334,_0xc10a('0xb'));logger[_0xc10a('0xc')](_0xc10a('0xd'),_0x1ce334,'request\x20sent',JSON[_0xc10a('0xe')](_0x24411d));if(_0x24411d[_0xc10a('0xf')]){if(_0x24411d[_0xc10a('0xf')]['code']===0x1f4){logger['error'](_0xc10a('0xa'),_0x1ce334,_0x24411d[_0xc10a('0xf')][_0xc10a('0x10')]);return _0x1d9e3e(_0x24411d['error']['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1ce334,_0x24411d['error'][_0xc10a('0x10')]);return _0xe9cfd7(_0x24411d[_0xc10a('0xf')]['message']);}else{logger[_0xc10a('0x9')](_0xc10a('0xa'),_0x1ce334,_0xc10a('0xb'));_0xe9cfd7(_0x24411d[_0xc10a('0x11')]['message']);}})[_0xc10a('0x12')](function(_0x179ef9){logger[_0xc10a('0xf')](_0xc10a('0xa'),_0x1ce334,_0x179ef9);_0x1d9e3e(_0x179ef9);});});} \ No newline at end of file +var _0x89c4=['request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x89c4,0x1c1));var _0x489c=function(_0x10b7c9,_0x6b9f87){_0x10b7c9=_0x10b7c9-0x0;var _0xc39503=_0x89c4[_0x10b7c9];return _0xc39503;};'use strict';var _=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var moment=require(_0x489c('0x2'));var BPromise=require(_0x489c('0x3'));var rs=require(_0x489c('0x4'));var fs=require('fs');var Redis=require(_0x489c('0x5'));var db=require(_0x489c('0x6'))['db'];var utils=require(_0x489c('0x7'));var logger=require(_0x489c('0x8'))(_0x489c('0x9'));var config=require('../../config/environment');var jayson=require(_0x489c('0xa'));var client=jayson[_0x489c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bf92a,_0x482ee1,_0x529047){return new BPromise(function(_0x2e77fd,_0x3d7534){return client['request'](_0x1bf92a,_0x529047)['then'](function(_0x22aa61){logger[_0x489c('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x482ee1,_0x489c('0xd'));logger['debug'](_0x489c('0xe'),_0x482ee1,_0x489c('0xd'),JSON[_0x489c('0xf')](_0x22aa61));if(_0x22aa61['error']){if(_0x22aa61[_0x489c('0x10')][_0x489c('0x11')]===0x1f4){logger[_0x489c('0x10')](_0x489c('0x12'),_0x482ee1,_0x22aa61[_0x489c('0x10')]['message']);return _0x3d7534(_0x22aa61[_0x489c('0x10')]['message']);}logger[_0x489c('0x10')](_0x489c('0x12'),_0x482ee1,_0x22aa61['error'][_0x489c('0x13')]);return _0x2e77fd(_0x22aa61[_0x489c('0x10')][_0x489c('0x13')]);}else{logger['info'](_0x489c('0x12'),_0x482ee1,_0x489c('0xd'));_0x2e77fd(_0x22aa61[_0x489c('0x14')][_0x489c('0x13')]);}})['catch'](function(_0x1c04f9){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x482ee1,_0x1c04f9);_0x3d7534(_0x1c04f9);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8550f7a..64154aa 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 _0xbd51=['show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','./chatProactiveAction.controller','get','/:id'];(function(_0x4371db,_0x54d1e9){var _0x4b1010=function(_0x3caf52){while(--_0x3caf52){_0x4371db['push'](_0x4371db['shift']());}};_0x4b1010(++_0x54d1e9);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x486692,_0x3caee8){_0x486692=_0x486692-0x0;var _0x3e38fa=_0xbd51[_0x486692];return _0x3e38fa;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('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(_0x1bd5('0x5'));router[_0x1bd5('0x6')](_0x1bd5('0x7'),auth['isAuthenticated'](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xb')]);router[_0x1bd5('0xc')]('/:id',auth[_0x1bd5('0xa')](),controller['update']);router[_0x1bd5('0xd')](_0x1bd5('0x7'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x575f4a,_0x5e2740){var _0x5edec2=function(_0x582b63){while(--_0x582b63){_0x575f4a['push'](_0x575f4a['shift']());}};_0x5edec2(++_0x5e2740);}(_0xd8fb,0x99));var _0xbd8f=function(_0x39e6d6,_0x1f35c7){_0x39e6d6=_0x39e6d6-0x0;var _0x4a8829=_0xd8fb[_0x39e6d6];return _0x4a8829;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index df0afc9..297e932 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 _0xee6e=['name','INTEGER','ENUM','beepall','roundrobin','STRING'];(function(_0x1028fc,_0x302fae){var _0x296d76=function(_0xba46d6){while(--_0xba46d6){_0x1028fc['push'](_0x1028fc['shift']());}};_0x296d76(++_0x302fae);}(_0xee6e,0x161));var _0xeee6=function(_0x15ecd9,_0x1ef433){_0x15ecd9=_0x15ecd9-0x0;var _0xea5e2c=_0xee6e[_0x15ecd9];return _0xea5e2c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeee6('0x0')],'unique':_0xeee6('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeee6('0x0')]},'timeout':{'type':Sequelize[_0xeee6('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeee6('0x3')]('rrmemory',_0xeee6('0x4'),_0xeee6('0x5'))}}; \ No newline at end of file +var _0x533f=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x876c3b,_0x87b300){var _0x1e5533=function(_0x528f94){while(--_0x528f94){_0x876c3b['push'](_0x876c3b['shift']());}};_0x1e5533(++_0x87b300);}(_0x533f,0x152));var _0xf533=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x533f[_0x21b706];return _0x13b94a;};'use strict';var Sequelize=require(_0xf533('0x0'));module['exports']={'name':{'type':Sequelize[_0xf533('0x1')],'unique':_0xf533('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf533('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf533('0x4')](_0xf533('0x5'),_0xf533('0x6'),_0xf533('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index fba6a78..f28c28d 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 _0x437c=['fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','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/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatQueue,\x20%s,\x20%s','result','catch','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','get','ChatQueues','UserProfileResource','end','sendStatus','stack','name','index','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','UserChatQueue','sort','User','findAndCountAll','agent','createdAt','format','%s/%s','chatPause','findOne','getTeams','addTeams','ids','Agents','online','voicePause','transaction','each','forEach','emit','Team','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','SELECT','every','TeamId','includes','all','union','compact','removeTeams','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','isArray','getAgents','rimraf','zip-dir'];(function(_0x441dd6,_0x28a81c){var _0x406ce3=function(_0xd2d470){while(--_0xd2d470){_0x441dd6['push'](_0x441dd6['shift']());}};_0x406ce3(++_0x28a81c);}(_0x437c,0x1c3));var _0xc437=function(_0x1322cf,_0x405316){_0x1322cf=_0x1322cf-0x0;var _0x29f6ff=_0x437c[_0x1322cf];return _0x29f6ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc437('0x0'));var zipdir=require(_0xc437('0x1'));var jsonpatch=require(_0xc437('0x2'));var rp=require(_0xc437('0x3'));var moment=require(_0xc437('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc437('0x5'));var util=require(_0xc437('0x6'));var path=require(_0xc437('0x7'));var sox=require('sox');var csv=require(_0xc437('0x8'));var ejs=require(_0xc437('0x9'));var fs=require('fs');var fs_extra=require(_0xc437('0xa'));var _=require(_0xc437('0xb'));var squel=require('squel');var crypto=require(_0xc437('0xc'));var jsforce=require(_0xc437('0xd'));var deskjs=require(_0xc437('0xe'));var toCsv=require(_0xc437('0x8'));var querystring=require(_0xc437('0xf'));var Papa=require(_0xc437('0x10'));var Redis=require(_0xc437('0x11'));var authService=require(_0xc437('0x12'));var qs=require(_0xc437('0x13'));var as=require(_0xc437('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc437('0x15'))(_0xc437('0x16'));var utils=require(_0xc437('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc437('0x18'));var db=require(_0xc437('0x19'))['db'];config[_0xc437('0x1a')]=_[_0xc437('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc437('0x1c'))(new Redis(config[_0xc437('0x1a')]));require(_0xc437('0x1d'))[_0xc437('0x1e')](socket);var jayson=require(_0xc437('0x1f'));var client=jayson[_0xc437('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x313fb0,_0x36e4ad,_0x5d10a6,_0x237ab3){return new BPromise(function(_0x22bb7a,_0x212f88){var _0x548c7d=_0x237ab3||client;return _0x548c7d[_0xc437('0x21')](_0x313fb0,_0x5d10a6)[_0xc437('0x22')](function(_0xd4a49){logger[_0xc437('0x23')]('ChatQueue,\x20%s,\x20%s',_0x36e4ad,_0xc437('0x24'));logger[_0xc437('0x25')](_0xc437('0x26'),_0x36e4ad,_0xc437('0x24'),JSON[_0xc437('0x27')](_0xd4a49));if(_0xd4a49[_0xc437('0x28')]){if(_0xd4a49[_0xc437('0x28')]['code']===0x1f4){logger[_0xc437('0x28')]('ChatQueue,\x20%s,\x20%s',_0x36e4ad,_0xd4a49[_0xc437('0x28')][_0xc437('0x29')]);return _0x212f88(_0xd4a49['error'][_0xc437('0x29')]);}logger[_0xc437('0x28')]('ChatQueue,\x20%s,\x20%s',_0x36e4ad,_0xd4a49[_0xc437('0x28')][_0xc437('0x29')]);return _0x22bb7a(_0xd4a49[_0xc437('0x28')][_0xc437('0x29')]);}else{logger[_0xc437('0x23')](_0xc437('0x2a'),_0x36e4ad,'request\x20sent');_0x22bb7a(_0xd4a49[_0xc437('0x2b')][_0xc437('0x29')]);}})[_0xc437('0x2c')](function(_0x94f17e){logger[_0xc437('0x28')](_0xc437('0x2a'),_0x36e4ad,_0x94f17e);_0x212f88(_0x94f17e);});});}function respondWithStatusCode(_0x8be5d0,_0x37a464){_0x37a464=_0x37a464||0xcc;return function(_0x418e64){if(_0x418e64){return _0x8be5d0['sendStatus'](_0x37a464);}return _0x8be5d0['status'](_0x37a464)['end']();};}function respondWithResult(_0x5541b3,_0x2693a8){_0x2693a8=_0x2693a8||0xc8;return function(_0x218b1a){if(_0x218b1a){return _0x5541b3[_0xc437('0x2d')](_0x2693a8)['json'](_0x218b1a);}};}function respondWithFilteredResult(_0x2c7496,_0x1afb6f){return function(_0x2a0e79){if(_0x2a0e79){var _0x38c603=typeof _0x1afb6f[_0xc437('0x2e')]==='undefined'&&typeof _0x1afb6f[_0xc437('0x2f')]===_0xc437('0x30');var _0x4d4e76=_0x2a0e79[_0xc437('0x31')];var _0x4ad707=_0x38c603?0x0:_0x1afb6f[_0xc437('0x2e')];var _0x39906d=_0x38c603?_0x2a0e79[_0xc437('0x31')]:_0x1afb6f['offset']+_0x1afb6f[_0xc437('0x2f')];var _0x479396;if(_0x39906d>=_0x4d4e76){_0x39906d=_0x4d4e76;_0x479396=0xc8;}else{_0x479396=0xce;}_0x2c7496['status'](_0x479396);return _0x2c7496[_0xc437('0x32')](_0xc437('0x33'),_0x4ad707+'-'+_0x39906d+'/'+_0x4d4e76)[_0xc437('0x34')](_0x2a0e79);}return null;};}function patchUpdates(_0x241be2){return function(_0xb95716){try{jsonpatch[_0xc437('0x35')](_0xb95716,_0x241be2,!![]);}catch(_0x115745){return BPromise['reject'](_0x115745);}return _0xb95716[_0xc437('0x36')]();};}function saveUpdates(_0x43b1f5,_0x33d6d5){return function(_0x9caebc){if(_0x9caebc){return _0x9caebc[_0xc437('0x37')](_0x43b1f5)[_0xc437('0x22')](function(_0x336f17){return _0x336f17;});}return null;};}function removeEntity(_0xf745e6,_0x376608){return function(_0x20db6c){if(_0x20db6c){return _0x20db6c[_0xc437('0x38')]()[_0xc437('0x22')](function(){var _0x58edf8=_0x20db6c[_0xc437('0x39')]({'plain':!![]});var _0x3dae1a=_0xc437('0x3a');return db[_0xc437('0x3b')][_0xc437('0x38')]({'where':{'type':_0x3dae1a,'resourceId':_0x58edf8['id']}})[_0xc437('0x22')](function(){return _0x20db6c;});})[_0xc437('0x22')](function(){_0xf745e6['status'](0xcc)[_0xc437('0x3c')]();});}};}function handleEntityNotFound(_0x3881ab,_0x555f46){return function(_0x22e97c){if(!_0x22e97c){_0x3881ab[_0xc437('0x3d')](0x194);}return _0x22e97c;};}function handleError(_0x1ce453,_0x5611f3){_0x5611f3=_0x5611f3||0x1f4;return function(_0x1231c9){logger['error'](_0x1231c9[_0xc437('0x3e')]);if(_0x1231c9[_0xc437('0x3f')]){delete _0x1231c9[_0xc437('0x3f')];}_0x1ce453[_0xc437('0x2d')](_0x5611f3)['send'](_0x1231c9);};}exports[_0xc437('0x40')]=function(_0x4a7ecf,_0x6e5ff0){var _0x15371e={},_0x2c72da={},_0x43d747={'count':0x0,'rows':[]};var _0x30c98f=_['map'](db[_0xc437('0x41')][_0xc437('0x42')],function(_0x50562b){return{'name':_0x50562b[_0xc437('0x43')],'type':_0x50562b[_0xc437('0x44')][_0xc437('0x45')]};});_0x2c72da[_0xc437('0x46')]=_[_0xc437('0x47')](_0x30c98f,_0xc437('0x3f'));_0x2c72da[_0xc437('0x48')]=_[_0xc437('0x49')](_0x4a7ecf[_0xc437('0x48')]);_0x2c72da[_0xc437('0x4a')]=_[_0xc437('0x4b')](_0x2c72da[_0xc437('0x46')],_0x2c72da[_0xc437('0x48')]);_0x15371e[_0xc437('0x4c')]=_[_0xc437('0x4b')](_0x2c72da[_0xc437('0x46')],qs[_0xc437('0x4d')](_0x4a7ecf[_0xc437('0x48')]['fields']));_0x15371e[_0xc437('0x4c')]=_0x15371e[_0xc437('0x4c')][_0xc437('0x4e')]?_0x15371e[_0xc437('0x4c')]:_0x2c72da['model'];if(!_0x4a7ecf[_0xc437('0x48')][_0xc437('0x4f')](_0xc437('0x50'))){_0x15371e[_0xc437('0x2f')]=qs[_0xc437('0x2f')](_0x4a7ecf['query'][_0xc437('0x2f')]);_0x15371e[_0xc437('0x2e')]=qs['offset'](_0x4a7ecf[_0xc437('0x48')][_0xc437('0x2e')]);}_0x15371e[_0xc437('0x51')]=qs['sort'](_0x4a7ecf[_0xc437('0x48')]['sort']);_0x15371e[_0xc437('0x52')]=qs[_0xc437('0x4a')](_[_0xc437('0x53')](_0x4a7ecf['query'],_0x2c72da[_0xc437('0x4a')]),_0x30c98f);if(_0x4a7ecf[_0xc437('0x48')]['filter']){_0x15371e[_0xc437('0x52')]=_[_0xc437('0x54')](_0x15371e[_0xc437('0x52')],{'$or':_[_0xc437('0x47')](_0x30c98f,function(_0x276a36){if(_0x276a36[_0xc437('0x44')]!==_0xc437('0x55')){var _0x28f524={};_0x28f524[_0x276a36[_0xc437('0x3f')]]={'$like':'%'+_0x4a7ecf[_0xc437('0x48')][_0xc437('0x56')]+'%'};return _0x28f524;}})});}_0x15371e=_['merge']({},_0x15371e,_0x4a7ecf['options']);var _0x9acaa0={'where':_0x15371e[_0xc437('0x52')]};return db['ChatQueue'][_0xc437('0x31')](_0x9acaa0)[_0xc437('0x22')](function(_0x22d472){_0x43d747[_0xc437('0x31')]=_0x22d472;if(_0x4a7ecf[_0xc437('0x48')][_0xc437('0x57')]){_0x15371e['include']=[{'all':!![]}];}return db[_0xc437('0x41')][_0xc437('0x58')](_0x15371e);})[_0xc437('0x22')](function(_0x3f354b){_0x43d747[_0xc437('0x59')]=_0x3f354b;return _0x43d747;})['then'](respondWithFilteredResult(_0x6e5ff0,_0x15371e))['catch'](handleError(_0x6e5ff0,null));};exports[_0xc437('0x5a')]=function(_0x123101,_0x5b0ce7){var _0xc7846d={'raw':!![],'where':{'id':_0x123101[_0xc437('0x5b')]['id']}},_0x39c3f5={};_0x39c3f5['model']=_[_0xc437('0x49')](db['ChatQueue']['rawAttributes']);_0x39c3f5[_0xc437('0x48')]=_[_0xc437('0x49')](_0x123101[_0xc437('0x48')]);_0x39c3f5[_0xc437('0x4a')]=_[_0xc437('0x4b')](_0x39c3f5[_0xc437('0x46')],_0x39c3f5['query']);_0xc7846d[_0xc437('0x4c')]=_[_0xc437('0x4b')](_0x39c3f5[_0xc437('0x46')],qs[_0xc437('0x4d')](_0x123101[_0xc437('0x48')]['fields']));_0xc7846d[_0xc437('0x4c')]=_0xc7846d[_0xc437('0x4c')][_0xc437('0x4e')]?_0xc7846d[_0xc437('0x4c')]:_0x39c3f5[_0xc437('0x46')];if(_0x123101[_0xc437('0x48')][_0xc437('0x57')]){_0xc7846d[_0xc437('0x5c')]=[{'all':!![]}];}_0xc7846d=_[_0xc437('0x54')]({},_0xc7846d,_0x123101[_0xc437('0x5d')]);return db[_0xc437('0x41')][_0xc437('0x5e')](_0xc7846d)[_0xc437('0x22')](handleEntityNotFound(_0x5b0ce7,null))[_0xc437('0x22')](respondWithResult(_0x5b0ce7,null))[_0xc437('0x2c')](handleError(_0x5b0ce7,null));};exports['create']=function(_0x29e566,_0x546d6){return db[_0xc437('0x41')][_0xc437('0x5f')](_0x29e566['body'],{})[_0xc437('0x22')](function(_0x30491e){var _0x3f3244=_0x29e566[_0xc437('0x60')][_0xc437('0x39')]({'plain':!![]});if(!_0x3f3244)throw new Error(_0xc437('0x61'));if(_0x3f3244['role']===_0xc437('0x60')){var _0x399380=_0x30491e[_0xc437('0x39')]({'plain':!![]});var _0xbeb995=_0xc437('0x3a');return db[_0xc437('0x62')][_0xc437('0x5e')]({'where':{'name':_0xbeb995,'userProfileId':_0x3f3244[_0xc437('0x63')]},'raw':!![]})[_0xc437('0x22')](function(_0x582aa2){if(_0x582aa2&&_0x582aa2[_0xc437('0x64')]===0x0){return db[_0xc437('0x3b')][_0xc437('0x5f')]({'name':_0x399380[_0xc437('0x3f')],'resourceId':_0x399380['id'],'type':_0x582aa2[_0xc437('0x3f')],'sectionId':_0x582aa2['id']},{})[_0xc437('0x22')](function(){return _0x30491e;});}else{return _0x30491e;}})['catch'](function(_0x3268d9){logger[_0xc437('0x28')](_0xc437('0x65'),_0x3268d9);throw _0x3268d9;});}return _0x30491e;})[_0xc437('0x22')](respondWithResult(_0x546d6,0xc9))[_0xc437('0x2c')](handleError(_0x546d6,null));};exports[_0xc437('0x37')]=function(_0x20c5bb,_0x46e1fb){if(_0x20c5bb[_0xc437('0x66')]['id']){delete _0x20c5bb[_0xc437('0x66')]['id'];}return db[_0xc437('0x41')]['find']({'where':{'id':_0x20c5bb[_0xc437('0x5b')]['id']}})[_0xc437('0x22')](handleEntityNotFound(_0x46e1fb,null))[_0xc437('0x22')](saveUpdates(_0x20c5bb[_0xc437('0x66')],null))['then'](respondWithResult(_0x46e1fb,null))[_0xc437('0x2c')](handleError(_0x46e1fb,null));};exports[_0xc437('0x38')]=function(_0x235255,_0x53e934){return db[_0xc437('0x41')][_0xc437('0x5e')]({'where':{'id':_0x235255[_0xc437('0x5b')]['id']}})[_0xc437('0x22')](handleEntityNotFound(_0x53e934,null))[_0xc437('0x22')](removeEntity(_0x53e934,null))[_0xc437('0x2c')](handleError(_0x53e934,null));};exports['describe']=function(_0xc4f17c,_0x5a9e2d){return db[_0xc437('0x41')]['describe']()[_0xc437('0x22')](respondWithResult(_0x5a9e2d,null))['catch'](handleError(_0x5a9e2d,null));};exports[_0xc437('0x67')]=function(_0x100db1,_0x3945a9,_0x10eb53){var _0x1f9d64={'raw':!![],'where':{}},_0x293b8e={},_0x42d676;return db[_0xc437('0x41')]['findOne']({'where':{'id':_0x100db1[_0xc437('0x5b')]['id']}})[_0xc437('0x22')](handleEntityNotFound(_0x3945a9,null))[_0xc437('0x22')](function(_0x3a4228){if(_0x3a4228){_0x42d676=_0x3a4228[_0xc437('0x39')]({'plain':!![]});_0x293b8e[_0xc437('0x46')]=_['keys'](db[_0xc437('0x68')][_0xc437('0x42')]);_0x293b8e[_0xc437('0x48')]=_['keys'](_0x100db1[_0xc437('0x48')]);_0x293b8e[_0xc437('0x4a')]=_['intersection'](_0x293b8e['model'],_0x293b8e[_0xc437('0x48')]);_0x1f9d64[_0xc437('0x4c')]=_[_0xc437('0x4b')](_0x293b8e[_0xc437('0x46')],qs[_0xc437('0x4d')](_0x100db1[_0xc437('0x48')][_0xc437('0x4d')]));_0x1f9d64[_0xc437('0x4c')]=_0x1f9d64[_0xc437('0x4c')][_0xc437('0x4e')]?_0x1f9d64[_0xc437('0x4c')]:_0x293b8e[_0xc437('0x46')];if(!_0x100db1[_0xc437('0x48')][_0xc437('0x4f')](_0xc437('0x50'))){_0x1f9d64[_0xc437('0x2f')]=qs[_0xc437('0x2f')](_0x100db1[_0xc437('0x48')][_0xc437('0x2f')]);_0x1f9d64[_0xc437('0x2e')]=qs[_0xc437('0x2e')](_0x100db1[_0xc437('0x48')][_0xc437('0x2e')]);}_0x1f9d64[_0xc437('0x51')]=qs[_0xc437('0x69')](_0x100db1[_0xc437('0x48')][_0xc437('0x69')]);_0x1f9d64[_0xc437('0x52')]=qs[_0xc437('0x4a')](_[_0xc437('0x53')](_0x100db1['query'],_0x293b8e[_0xc437('0x4a')]));_0x1f9d64[_0xc437('0x52')]['ChatQueueId']=_0x3a4228['id'];if(_0x100db1['query']['filter']){_0x1f9d64[_0xc437('0x52')]=_[_0xc437('0x54')](_0x1f9d64[_0xc437('0x52')],{'$or':_[_0xc437('0x47')](_0x1f9d64['attributes'],function(_0x448ba0){var _0x276a17={};_0x276a17[_0x448ba0]={'$like':'%'+_0x100db1['query'][_0xc437('0x56')]+'%'};return _0x276a17;})});}_0x1f9d64=_[_0xc437('0x54')]({},_0x1f9d64,_0x100db1['options']);return db['UserChatQueue'][_0xc437('0x58')](_0x1f9d64);}})[_0xc437('0x22')](function(_0x4cf501){if(_0x4cf501){return db[_0xc437('0x6a')][_0xc437('0x6b')]({'where':{'id':_[_0xc437('0x47')](_0x4cf501,'UserId'),'role':_0xc437('0x6c')},'attributes':['id','name','chatPause','updatedAt',_0xc437('0x6d')]});}})['then'](function(_0x5d50fa){if(_0x5d50fa){return{'count':_0x5d50fa['count'],'rows':_[_0xc437('0x47')](_0x5d50fa[_0xc437('0x59')],function(_0x1497a6){return{'membername':_0x1497a6['name'],'UserId':_0x1497a6['id'],'queue_name':_0x42d676['name'],'ChatQueueId':_0x42d676['id'],'interface':util[_0xc437('0x6e')](_0xc437('0x6f'),'SIP',_0x1497a6['name']),'penalty':0x0,'paused':_0x1497a6[_0xc437('0x70')],'createdAt':_0x1497a6['createdAt'],'updatedAt':_0x1497a6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc437('0x22')](respondWithFilteredResult(_0x3945a9,_0x1f9d64))[_0xc437('0x2c')](handleError(_0x3945a9,null));};exports['getTeams']=function(_0x4d284b,_0x53bfa4,_0x447d06){var _0x1f270a={};var _0x49489a={};var _0xa8fa9c;var _0x10827d;return db[_0xc437('0x41')][_0xc437('0x71')]({'where':{'id':_0x4d284b['params']['id']}})[_0xc437('0x22')](handleEntityNotFound(_0x53bfa4,null))[_0xc437('0x22')](function(_0x5f2d00){if(_0x5f2d00){_0xa8fa9c=_0x5f2d00;_0x49489a[_0xc437('0x46')]=_[_0xc437('0x49')](db['Team']['rawAttributes']);_0x49489a['query']=_[_0xc437('0x49')](_0x4d284b['query']);_0x49489a['filters']=_[_0xc437('0x4b')](_0x49489a[_0xc437('0x46')],_0x49489a[_0xc437('0x48')]);_0x1f270a['attributes']=_[_0xc437('0x4b')](_0x49489a[_0xc437('0x46')],qs['fields'](_0x4d284b[_0xc437('0x48')][_0xc437('0x4d')]));_0x1f270a['attributes']=_0x1f270a[_0xc437('0x4c')][_0xc437('0x4e')]?_0x1f270a[_0xc437('0x4c')]:_0x49489a[_0xc437('0x46')];_0x1f270a[_0xc437('0x51')]=qs[_0xc437('0x69')](_0x4d284b[_0xc437('0x48')][_0xc437('0x69')]);_0x1f270a[_0xc437('0x52')]=qs[_0xc437('0x4a')](_['pick'](_0x4d284b['query'],_0x49489a['filters']));if(_0x4d284b[_0xc437('0x48')][_0xc437('0x56')]){_0x1f270a[_0xc437('0x52')]=_['merge'](_0x1f270a['where'],{'$or':_[_0xc437('0x47')](_0x1f270a[_0xc437('0x4c')],function(_0x6da6de){var _0x23da91={};_0x23da91[_0x6da6de]={'$like':'%'+_0x4d284b['query']['filter']+'%'};return _0x23da91;})});}_0x1f270a=_[_0xc437('0x54')]({},_0x1f270a,_0x4d284b[_0xc437('0x5d')]);return _0xa8fa9c['getTeams'](_0x1f270a);}})['then'](function(_0x333003){if(_0x333003){_0x10827d=_0x333003['length'];if(!_0x4d284b[_0xc437('0x48')][_0xc437('0x4f')](_0xc437('0x50'))){_0x1f270a[_0xc437('0x2f')]=qs[_0xc437('0x2f')](_0x4d284b[_0xc437('0x48')][_0xc437('0x2f')]);_0x1f270a['offset']=qs[_0xc437('0x2e')](_0x4d284b['query']['offset']);}return _0xa8fa9c[_0xc437('0x72')](_0x1f270a);}})[_0xc437('0x22')](function(_0x157556){if(_0x157556){return _0x157556?{'count':_0x10827d,'rows':_0x157556}:null;}})[_0xc437('0x22')](respondWithResult(_0x53bfa4,null))[_0xc437('0x2c')](handleError(_0x53bfa4,null));};exports[_0xc437('0x73')]=function(_0x3f5ebd,_0x3fdf8a,_0x29b43d){var _0x53d0f3=_0x3f5ebd[_0xc437('0x66')][_0xc437('0x74')];return db['Team'][_0xc437('0x58')]({'where':{'id':_0x53d0f3},'attributes':['id'],'include':[{'model':db[_0xc437('0x6a')],'as':_0xc437('0x75'),'attributes':['id',_0xc437('0x3f'),_0xc437('0x76'),_0xc437('0x77'),'interface'],'raw':!![]}]})['then'](function(_0x5b196f){if(_0x5b196f){var _0x1967dc=_['flatMap'](_0x5b196f,function(_0x2f2c33){var _0x2df4de=_0x2f2c33['get']({'plain':!![]});return _0x2df4de['Agents'];});return db[_0xc437('0x41')][_0xc437('0x5e')]({'where':{'id':_0x3f5ebd[_0xc437('0x5b')]['id']}})['then'](function(_0x3d5a30){return db['sequelize'][_0xc437('0x78')](function(_0x4ac86a){return _0x3d5a30[_0xc437('0x73')](_0x53d0f3,{'transaction':_0x4ac86a})[_0xc437('0x22')](function(){return BPromise[_0xc437('0x79')](_0x1967dc,function(_0x594b9a){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x594b9a['id'],'ChatQueueId':_0x3f5ebd['params']['id']},'transaction':_0x4ac86a});});})['then'](function(){_0x1967dc[_0xc437('0x7a')](function(_0xc0374e){socket[_0xc437('0x7b')]('userChatQueue:save',{'UserId':_0xc0374e['id'],'ChatQueueId':_0x3d5a30['id']});});});});});}})[_0xc437('0x22')](respondWithStatusCode(_0x3fdf8a,null))[_0xc437('0x2c')](handleError(_0x3fdf8a,null));};exports['removeTeams']=function(_0x21b6b2,_0x4a6722,_0x2f2657){return db[_0xc437('0x7c')][_0xc437('0x58')]({'where':{'id':_0x21b6b2[_0xc437('0x48')][_0xc437('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc437('0x6a')],'as':_0xc437('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4a6722,null))[_0xc437('0x22')](function(_0x3aafed){var _0x195c98=_[_0xc437('0x47')](_0x3aafed,'id');var _0x3f6e85=[];var _0x5bd51e=[];var _0x3dbcbe=squel['select']();_0x3dbcbe[_0xc437('0x7d')]('tq.TeamId')[_0xc437('0x7e')](_0xc437('0x7f'),'tq')[_0xc437('0x80')](_0xc437('0x81'),'ut',_0xc437('0x82'))['where'](_0xc437('0x83'),_0x21b6b2[_0xc437('0x5b')]['id']);for(var _0x36a539=0x0;_0x36a539<_0x3aafed[_0xc437('0x4e')];_0x36a539+=0x1){let _0xa2afe3=_0x3aafed[_0x36a539];for(var _0x1ba28b=0x0;_0x1ba28b<_0xa2afe3['Agents'][_0xc437('0x4e')];_0x1ba28b+=0x1){let _0x47ea5f=_0xa2afe3[_0xc437('0x75')][_0x1ba28b];var _0x1f821c=_0x3dbcbe[_0xc437('0x84')]();_0x1f821c[_0xc437('0x52')](_0xc437('0x85'),_0x47ea5f['id']);_0x5bd51e['push'](db[_0xc437('0x86')]['query'](_0x1f821c['toString'](),{'type':db[_0xc437('0x86')]['QueryTypes'][_0xc437('0x87')]})[_0xc437('0x22')](function(_0x2499c3){if(_0x2499c3[_0xc437('0x4e')]===0x1){return _0x47ea5f['id'];}else{var _0x5e8642=_[_0xc437('0x88')](_[_0xc437('0x47')](_0x2499c3,_0xc437('0x89')),function(_0x5f2bfd){return _[_0xc437('0x8a')](_0x195c98,_0x5f2bfd);});if(_0x5e8642){return _0x47ea5f['id'];}}}));}}return BPromise[_0xc437('0x8b')](_0x5bd51e)[_0xc437('0x22')](function(_0x9f1300){_0x3f6e85=_(_0x3f6e85)[_0xc437('0x8c')](_0x9f1300)[_0xc437('0x8d')]()['value']();return db[_0xc437('0x41')]['find']({'where':{'id':_0x21b6b2['params']['id']}})['then'](function(_0x39ab51){return db[_0xc437('0x86')][_0xc437('0x78')](function(_0x229b6b){return _0x39ab51[_0xc437('0x8e')](_0x21b6b2[_0xc437('0x48')][_0xc437('0x74')],{'transaction':_0x229b6b})[_0xc437('0x22')](function(){if(!_['isEmpty'](_0x3f6e85)){return _0x39ab51['removeAgents'](_0x3f6e85,{'transaction':_0x229b6b});}})[_0xc437('0x22')](function(){_0x3f6e85[_0xc437('0x7a')](function(_0x58529e){socket[_0xc437('0x7b')](_0xc437('0x8f'),{'UserId':_0x58529e,'ChatQueueId':_0x39ab51['id']});});});});});});})[_0xc437('0x22')](respondWithStatusCode(_0x4a6722,null))[_0xc437('0x2c')](handleError(_0x4a6722,null));};exports[_0xc437('0x90')]=function(_0x261ba5,_0x3bde42,_0x168bc0){return db[_0xc437('0x41')][_0xc437('0x5e')]({'where':{'id':_0x261ba5[_0xc437('0x5b')]['id']}})[_0xc437('0x22')](handleEntityNotFound(_0x3bde42,null))[_0xc437('0x22')](function(_0x11f82a){if(_0x11f82a){return _0x11f82a[_0xc437('0x90')](_0x261ba5['body']['ids'],_[_0xc437('0x91')](_0x261ba5[_0xc437('0x66')],['ids','id'])||{})[_0xc437('0x92')](function(_0x40dded){for(var _0x32e83e=0x0;_0x32e83e<_0x261ba5[_0xc437('0x66')][_0xc437('0x74')]['length'];_0x32e83e+=0x1){socket[_0xc437('0x7b')](_0xc437('0x93'),{'UserId':Number(_0x261ba5[_0xc437('0x66')][_0xc437('0x74')][_0x32e83e]),'ChatQueueId':Number(_0x261ba5[_0xc437('0x5b')]['id'])});}return _0x40dded;});}})[_0xc437('0x22')](respondWithResult(_0x3bde42,null))[_0xc437('0x2c')](handleError(_0x3bde42,null));};exports[_0xc437('0x94')]=function(_0x29cdf8,_0xd09d57,_0x2d93f3){return db[_0xc437('0x41')]['find']({'where':{'id':_0x29cdf8[_0xc437('0x5b')]['id']}})['then'](handleEntityNotFound(_0xd09d57,null))['then'](function(_0x51165c){if(_0x51165c){return _0x51165c['removeAgents'](_0x29cdf8['query'][_0xc437('0x74')])[_0xc437('0x22')](function(){if(_[_0xc437('0x95')](_0x29cdf8[_0xc437('0x48')]['ids'])){for(var _0x3836c3=0x0;_0x3836c3<_0x29cdf8[_0xc437('0x48')][_0xc437('0x74')][_0xc437('0x4e')];_0x3836c3+=0x1){socket[_0xc437('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x29cdf8[_0xc437('0x48')][_0xc437('0x74')][_0x3836c3]),'ChatQueueId':Number(_0x29cdf8['params']['id'])});}}else{socket[_0xc437('0x7b')](_0xc437('0x8f'),{'UserId':Number(_0x29cdf8[_0xc437('0x48')]['ids']),'ChatQueueId':Number(_0x29cdf8[_0xc437('0x5b')]['id'])});}});}})[_0xc437('0x22')](respondWithStatusCode(_0xd09d57,null))[_0xc437('0x2c')](handleError(_0xd09d57,null));};exports[_0xc437('0x96')]=function(_0x95f031,_0x232e10,_0x25da00){var _0x411815={};var _0x91d956={};var _0x4c0f81;var _0x2bcf45;return db['ChatQueue'][_0xc437('0x71')]({'where':{'id':_0x95f031[_0xc437('0x5b')]['id']}})[_0xc437('0x22')](handleEntityNotFound(_0x232e10,null))[_0xc437('0x22')](function(_0x32842d){if(_0x32842d){_0x4c0f81=_0x32842d;_0x91d956['model']=_[_0xc437('0x49')](db[_0xc437('0x6a')][_0xc437('0x42')]);_0x91d956[_0xc437('0x48')]=_[_0xc437('0x49')](_0x95f031['query']);_0x91d956[_0xc437('0x4a')]=_[_0xc437('0x4b')](_0x91d956[_0xc437('0x46')],_0x91d956[_0xc437('0x48')]);_0x411815[_0xc437('0x4c')]=_[_0xc437('0x4b')](_0x91d956[_0xc437('0x46')],qs[_0xc437('0x4d')](_0x95f031['query'][_0xc437('0x4d')]));_0x411815['attributes']=_0x411815[_0xc437('0x4c')]['length']?_0x411815[_0xc437('0x4c')]:_0x91d956['model'];_0x411815[_0xc437('0x51')]=qs[_0xc437('0x69')](_0x95f031['query']['sort']);_0x411815[_0xc437('0x52')]=qs[_0xc437('0x4a')](_[_0xc437('0x53')](_0x95f031[_0xc437('0x48')],_0x91d956[_0xc437('0x4a')]));if(_0x95f031[_0xc437('0x48')]['filter']){_0x411815[_0xc437('0x52')]=_[_0xc437('0x54')](_0x411815[_0xc437('0x52')],{'$or':_[_0xc437('0x47')](_0x411815[_0xc437('0x4c')],function(_0x59b733){var _0x104277={};_0x104277[_0x59b733]={'$like':'%'+_0x95f031[_0xc437('0x48')]['filter']+'%'};return _0x104277;})});}_0x411815=_[_0xc437('0x54')]({},_0x411815,_0x95f031[_0xc437('0x5d')]);return _0x4c0f81[_0xc437('0x96')](_0x411815);}})[_0xc437('0x22')](function(_0x2d3d20){if(_0x2d3d20){_0x2bcf45=_0x2d3d20[_0xc437('0x4e')];if(!_0x95f031[_0xc437('0x48')][_0xc437('0x4f')](_0xc437('0x50'))){_0x411815[_0xc437('0x2f')]=qs[_0xc437('0x2f')](_0x95f031[_0xc437('0x48')][_0xc437('0x2f')]);_0x411815['offset']=qs[_0xc437('0x2e')](_0x95f031[_0xc437('0x48')][_0xc437('0x2e')]);}return _0x4c0f81[_0xc437('0x96')](_0x411815);}})[_0xc437('0x22')](function(_0x7560f4){if(_0x7560f4){return _0x7560f4?{'count':_0x2bcf45,'rows':_0x7560f4}:null;}})[_0xc437('0x22')](respondWithResult(_0x232e10,null))[_0xc437('0x2c')](handleError(_0x232e10,null));}; \ No newline at end of file +var _0x3a2b=['end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','ids','online','voicePause','interface','Agents','find','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','addAgents','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','register','jayson/promise','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status'];(function(_0x52127d,_0x22ef4b){var _0x433b16=function(_0x48891d){while(--_0x48891d){_0x52127d['push'](_0x52127d['shift']());}};_0x433b16(++_0x22ef4b);}(_0x3a2b,0x71));var _0xb3a2=function(_0x5dec0e,_0x3fbe7f){_0x5dec0e=_0x5dec0e-0x0;var _0x54a2cf=_0x3a2b[_0x5dec0e];return _0x54a2cf;};'use strict';var emlformat=require(_0xb3a2('0x0'));var rimraf=require(_0xb3a2('0x1'));var zipdir=require(_0xb3a2('0x2'));var jsonpatch=require(_0xb3a2('0x3'));var rp=require(_0xb3a2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb3a2('0x5'));var util=require(_0xb3a2('0x6'));var path=require(_0xb3a2('0x7'));var sox=require(_0xb3a2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3a2('0x9'));var _=require(_0xb3a2('0xa'));var squel=require(_0xb3a2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb3a2('0xc'));var toCsv=require(_0xb3a2('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb3a2('0xe'));var authService=require(_0xb3a2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb3a2('0x10'));var hardwareService=require(_0xb3a2('0x11'));var logger=require(_0xb3a2('0x12'))(_0xb3a2('0x13'));var utils=require('../../config/utils');var config=require(_0xb3a2('0x14'));var licenseUtil=require(_0xb3a2('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb3a2('0x16')](config['redis'],{'host':_0xb3a2('0x17'),'port':0x18eb});var socket=require(_0xb3a2('0x18'))(new Redis(config[_0xb3a2('0x19')]));require(_0xb3a2('0x1a'))[_0xb3a2('0x1b')](socket);var jayson=require(_0xb3a2('0x1c'));var client=jayson['client'][_0xb3a2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3e5077,_0x587f16,_0x2134e0,_0x4aac84){return new BPromise(function(_0x14e833,_0x4720c0){var _0x46164a=_0x4aac84||client;return _0x46164a[_0xb3a2('0x1e')](_0x3e5077,_0x2134e0)['then'](function(_0x186a6a){logger[_0xb3a2('0x1f')](_0xb3a2('0x20'),_0x587f16,_0xb3a2('0x21'));logger[_0xb3a2('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x587f16,'request\x20sent',JSON[_0xb3a2('0x23')](_0x186a6a));if(_0x186a6a['error']){if(_0x186a6a[_0xb3a2('0x24')][_0xb3a2('0x25')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x587f16,_0x186a6a[_0xb3a2('0x24')][_0xb3a2('0x26')]);return _0x4720c0(_0x186a6a['error'][_0xb3a2('0x26')]);}logger[_0xb3a2('0x24')]('ChatQueue,\x20%s,\x20%s',_0x587f16,_0x186a6a[_0xb3a2('0x24')]['message']);return _0x14e833(_0x186a6a[_0xb3a2('0x24')][_0xb3a2('0x26')]);}else{logger[_0xb3a2('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x587f16,'request\x20sent');_0x14e833(_0x186a6a['result'][_0xb3a2('0x26')]);}})['catch'](function(_0x40ea58){logger[_0xb3a2('0x24')]('ChatQueue,\x20%s,\x20%s',_0x587f16,_0x40ea58);_0x4720c0(_0x40ea58);});});}function respondWithStatusCode(_0x543eb9,_0x8b97af){_0x8b97af=_0x8b97af||0xcc;return function(_0x53ca3f){if(_0x53ca3f){return _0x543eb9[_0xb3a2('0x27')](_0x8b97af);}return _0x543eb9[_0xb3a2('0x28')](_0x8b97af)[_0xb3a2('0x29')]();};}function respondWithResult(_0x269258,_0x71f09e){_0x71f09e=_0x71f09e||0xc8;return function(_0x16fa7b){if(_0x16fa7b){return _0x269258['status'](_0x71f09e)[_0xb3a2('0x2a')](_0x16fa7b);}};}function respondWithFilteredResult(_0x3d2211,_0x23587b){return function(_0x1f6e74){if(_0x1f6e74){var _0x4b2827=typeof _0x23587b[_0xb3a2('0x2b')]===_0xb3a2('0x2c')&&typeof _0x23587b[_0xb3a2('0x2d')]===_0xb3a2('0x2c');var _0x12fa99=_0x1f6e74[_0xb3a2('0x2e')];var _0x224739=_0x4b2827?0x0:_0x23587b[_0xb3a2('0x2b')];var _0x2e0c62=_0x4b2827?_0x1f6e74[_0xb3a2('0x2e')]:_0x23587b[_0xb3a2('0x2b')]+_0x23587b[_0xb3a2('0x2d')];var _0x199359;if(_0x2e0c62>=_0x12fa99){_0x2e0c62=_0x12fa99;_0x199359=0xc8;}else{_0x199359=0xce;}_0x3d2211[_0xb3a2('0x28')](_0x199359);return _0x3d2211[_0xb3a2('0x2f')](_0xb3a2('0x30'),_0x224739+'-'+_0x2e0c62+'/'+_0x12fa99)[_0xb3a2('0x2a')](_0x1f6e74);}return null;};}function patchUpdates(_0xfd2272){return function(_0x409cf0){try{jsonpatch['apply'](_0x409cf0,_0xfd2272,!![]);}catch(_0x4e070b){return BPromise[_0xb3a2('0x31')](_0x4e070b);}return _0x409cf0['save']();};}function saveUpdates(_0x2f3edf,_0x31d26f){return function(_0x394052){if(_0x394052){return _0x394052[_0xb3a2('0x32')](_0x2f3edf)[_0xb3a2('0x33')](function(_0xc6ed35){return _0xc6ed35;});}return null;};}function removeEntity(_0x18bcbf,_0x34fa1c){return function(_0x2fbdf3){if(_0x2fbdf3){return _0x2fbdf3[_0xb3a2('0x34')]()[_0xb3a2('0x33')](function(){var _0x1e30fa=_0x2fbdf3[_0xb3a2('0x35')]({'plain':!![]});var _0x513beb='ChatQueues';return db[_0xb3a2('0x36')][_0xb3a2('0x34')]({'where':{'type':_0x513beb,'resourceId':_0x1e30fa['id']}})[_0xb3a2('0x33')](function(){return _0x2fbdf3;});})[_0xb3a2('0x33')](function(){_0x18bcbf[_0xb3a2('0x28')](0xcc)[_0xb3a2('0x29')]();});}};}function handleEntityNotFound(_0x90c0d1,_0x4a882d){return function(_0x15552d){if(!_0x15552d){_0x90c0d1['sendStatus'](0x194);}return _0x15552d;};}function handleError(_0x416c10,_0x5f2dfe){_0x5f2dfe=_0x5f2dfe||0x1f4;return function(_0x1f63be){logger[_0xb3a2('0x24')](_0x1f63be[_0xb3a2('0x37')]);if(_0x1f63be['name']){delete _0x1f63be['name'];}_0x416c10['status'](_0x5f2dfe)[_0xb3a2('0x38')](_0x1f63be);};}exports[_0xb3a2('0x39')]=function(_0x36d5b6,_0x215eee){var _0x186be9={},_0x2090b={},_0x181429={'count':0x0,'rows':[]};var _0xe63661=_[_0xb3a2('0x3a')](db[_0xb3a2('0x3b')][_0xb3a2('0x3c')],function(_0x2b2083){return{'name':_0x2b2083[_0xb3a2('0x3d')],'type':_0x2b2083[_0xb3a2('0x3e')]['key']};});_0x2090b['model']=_['map'](_0xe63661,_0xb3a2('0x3f'));_0x2090b[_0xb3a2('0x40')]=_[_0xb3a2('0x41')](_0x36d5b6[_0xb3a2('0x40')]);_0x2090b[_0xb3a2('0x42')]=_[_0xb3a2('0x43')](_0x2090b['model'],_0x2090b['query']);_0x186be9[_0xb3a2('0x44')]=_['intersection'](_0x2090b[_0xb3a2('0x45')],qs[_0xb3a2('0x46')](_0x36d5b6[_0xb3a2('0x40')]['fields']));_0x186be9[_0xb3a2('0x44')]=_0x186be9[_0xb3a2('0x44')][_0xb3a2('0x47')]?_0x186be9[_0xb3a2('0x44')]:_0x2090b[_0xb3a2('0x45')];if(!_0x36d5b6[_0xb3a2('0x40')][_0xb3a2('0x48')](_0xb3a2('0x49'))){_0x186be9[_0xb3a2('0x2d')]=qs[_0xb3a2('0x2d')](_0x36d5b6[_0xb3a2('0x40')]['limit']);_0x186be9[_0xb3a2('0x2b')]=qs[_0xb3a2('0x2b')](_0x36d5b6[_0xb3a2('0x40')][_0xb3a2('0x2b')]);}_0x186be9['order']=qs['sort'](_0x36d5b6['query'][_0xb3a2('0x4a')]);_0x186be9[_0xb3a2('0x4b')]=qs['filters'](_[_0xb3a2('0x4c')](_0x36d5b6[_0xb3a2('0x40')],_0x2090b['filters']),_0xe63661);if(_0x36d5b6['query'][_0xb3a2('0x4d')]){_0x186be9['where']=_[_0xb3a2('0x4e')](_0x186be9[_0xb3a2('0x4b')],{'$or':_[_0xb3a2('0x3a')](_0xe63661,function(_0x4a753f){if(_0x4a753f['type']!==_0xb3a2('0x4f')){var _0x485e5b={};_0x485e5b[_0x4a753f['name']]={'$like':'%'+_0x36d5b6[_0xb3a2('0x40')][_0xb3a2('0x4d')]+'%'};return _0x485e5b;}})});}_0x186be9=_['merge']({},_0x186be9,_0x36d5b6[_0xb3a2('0x50')]);var _0x142e96={'where':_0x186be9['where']};return db[_0xb3a2('0x3b')]['count'](_0x142e96)[_0xb3a2('0x33')](function(_0x38d744){_0x181429[_0xb3a2('0x2e')]=_0x38d744;if(_0x36d5b6[_0xb3a2('0x40')][_0xb3a2('0x51')]){_0x186be9[_0xb3a2('0x52')]=[{'all':!![]}];}return db[_0xb3a2('0x3b')][_0xb3a2('0x53')](_0x186be9);})[_0xb3a2('0x33')](function(_0x54d301){_0x181429[_0xb3a2('0x54')]=_0x54d301;return _0x181429;})[_0xb3a2('0x33')](respondWithFilteredResult(_0x215eee,_0x186be9))['catch'](handleError(_0x215eee,null));};exports['show']=function(_0x36cade,_0x4e466b){var _0x3c09ce={'raw':!![],'where':{'id':_0x36cade[_0xb3a2('0x55')]['id']}},_0x4a7193={};_0x4a7193[_0xb3a2('0x45')]=_[_0xb3a2('0x41')](db[_0xb3a2('0x3b')]['rawAttributes']);_0x4a7193[_0xb3a2('0x40')]=_[_0xb3a2('0x41')](_0x36cade[_0xb3a2('0x40')]);_0x4a7193[_0xb3a2('0x42')]=_[_0xb3a2('0x43')](_0x4a7193[_0xb3a2('0x45')],_0x4a7193[_0xb3a2('0x40')]);_0x3c09ce[_0xb3a2('0x44')]=_[_0xb3a2('0x43')](_0x4a7193[_0xb3a2('0x45')],qs['fields'](_0x36cade['query'][_0xb3a2('0x46')]));_0x3c09ce[_0xb3a2('0x44')]=_0x3c09ce[_0xb3a2('0x44')]['length']?_0x3c09ce[_0xb3a2('0x44')]:_0x4a7193[_0xb3a2('0x45')];if(_0x36cade[_0xb3a2('0x40')][_0xb3a2('0x51')]){_0x3c09ce[_0xb3a2('0x52')]=[{'all':!![]}];}_0x3c09ce=_['merge']({},_0x3c09ce,_0x36cade[_0xb3a2('0x50')]);return db['ChatQueue']['find'](_0x3c09ce)[_0xb3a2('0x33')](handleEntityNotFound(_0x4e466b,null))[_0xb3a2('0x33')](respondWithResult(_0x4e466b,null))[_0xb3a2('0x56')](handleError(_0x4e466b,null));};exports[_0xb3a2('0x57')]=function(_0x417229,_0x4bbd77){return db[_0xb3a2('0x3b')]['create'](_0x417229['body'],{})['then'](function(_0x1c27e3){var _0x15bb4f=_0x417229[_0xb3a2('0x58')][_0xb3a2('0x35')]({'plain':!![]});if(!_0x15bb4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15bb4f[_0xb3a2('0x59')]===_0xb3a2('0x58')){var _0x3d2f87=_0x1c27e3[_0xb3a2('0x35')]({'plain':!![]});var _0x24eed3='ChatQueues';return db[_0xb3a2('0x5a')]['find']({'where':{'name':_0x24eed3,'userProfileId':_0x15bb4f[_0xb3a2('0x5b')]},'raw':!![]})[_0xb3a2('0x33')](function(_0x590e4f){if(_0x590e4f&&_0x590e4f['autoAssociation']===0x0){return db[_0xb3a2('0x36')][_0xb3a2('0x57')]({'name':_0x3d2f87[_0xb3a2('0x3f')],'resourceId':_0x3d2f87['id'],'type':_0x590e4f[_0xb3a2('0x3f')],'sectionId':_0x590e4f['id']},{})[_0xb3a2('0x33')](function(){return _0x1c27e3;});}else{return _0x1c27e3;}})['catch'](function(_0x3e5f8c){logger[_0xb3a2('0x24')](_0xb3a2('0x5c'),_0x3e5f8c);throw _0x3e5f8c;});}return _0x1c27e3;})[_0xb3a2('0x33')](respondWithResult(_0x4bbd77,0xc9))['catch'](handleError(_0x4bbd77,null));};exports['update']=function(_0xc8d000,_0x4654b4){if(_0xc8d000[_0xb3a2('0x5d')]['id']){delete _0xc8d000['body']['id'];}return db[_0xb3a2('0x3b')]['find']({'where':{'id':_0xc8d000[_0xb3a2('0x55')]['id']}})[_0xb3a2('0x33')](handleEntityNotFound(_0x4654b4,null))[_0xb3a2('0x33')](saveUpdates(_0xc8d000['body'],null))[_0xb3a2('0x33')](respondWithResult(_0x4654b4,null))[_0xb3a2('0x56')](handleError(_0x4654b4,null));};exports[_0xb3a2('0x34')]=function(_0x3d78e6,_0x489270){return db['ChatQueue']['find']({'where':{'id':_0x3d78e6[_0xb3a2('0x55')]['id']}})[_0xb3a2('0x33')](handleEntityNotFound(_0x489270,null))[_0xb3a2('0x33')](removeEntity(_0x489270,null))[_0xb3a2('0x56')](handleError(_0x489270,null));};exports[_0xb3a2('0x5e')]=function(_0x544cf6,_0x2d3497){return db[_0xb3a2('0x3b')][_0xb3a2('0x5e')]()[_0xb3a2('0x33')](respondWithResult(_0x2d3497,null))[_0xb3a2('0x56')](handleError(_0x2d3497,null));};exports[_0xb3a2('0x5f')]=function(_0x144370,_0xceb36e,_0x1b8b6a){var _0x1d67ef={'raw':!![],'where':{}},_0x5301a4={},_0x11ce03;return db[_0xb3a2('0x3b')][_0xb3a2('0x60')]({'where':{'id':_0x144370['params']['id']}})[_0xb3a2('0x33')](handleEntityNotFound(_0xceb36e,null))[_0xb3a2('0x33')](function(_0x47ba83){if(_0x47ba83){_0x11ce03=_0x47ba83[_0xb3a2('0x35')]({'plain':!![]});_0x5301a4[_0xb3a2('0x45')]=_[_0xb3a2('0x41')](db[_0xb3a2('0x61')]['rawAttributes']);_0x5301a4[_0xb3a2('0x40')]=_['keys'](_0x144370[_0xb3a2('0x40')]);_0x5301a4['filters']=_['intersection'](_0x5301a4['model'],_0x5301a4[_0xb3a2('0x40')]);_0x1d67ef[_0xb3a2('0x44')]=_[_0xb3a2('0x43')](_0x5301a4[_0xb3a2('0x45')],qs['fields'](_0x144370[_0xb3a2('0x40')]['fields']));_0x1d67ef[_0xb3a2('0x44')]=_0x1d67ef[_0xb3a2('0x44')]['length']?_0x1d67ef[_0xb3a2('0x44')]:_0x5301a4['model'];if(!_0x144370[_0xb3a2('0x40')][_0xb3a2('0x48')](_0xb3a2('0x49'))){_0x1d67ef['limit']=qs[_0xb3a2('0x2d')](_0x144370['query'][_0xb3a2('0x2d')]);_0x1d67ef[_0xb3a2('0x2b')]=qs['offset'](_0x144370[_0xb3a2('0x40')][_0xb3a2('0x2b')]);}_0x1d67ef[_0xb3a2('0x62')]=qs[_0xb3a2('0x4a')](_0x144370['query']['sort']);_0x1d67ef[_0xb3a2('0x4b')]=qs[_0xb3a2('0x42')](_[_0xb3a2('0x4c')](_0x144370[_0xb3a2('0x40')],_0x5301a4[_0xb3a2('0x42')]));_0x1d67ef[_0xb3a2('0x4b')][_0xb3a2('0x63')]=_0x47ba83['id'];if(_0x144370[_0xb3a2('0x40')]['filter']){_0x1d67ef[_0xb3a2('0x4b')]=_[_0xb3a2('0x4e')](_0x1d67ef[_0xb3a2('0x4b')],{'$or':_[_0xb3a2('0x3a')](_0x1d67ef[_0xb3a2('0x44')],function(_0x104815){var _0x18c6ac={};_0x18c6ac[_0x104815]={'$like':'%'+_0x144370[_0xb3a2('0x40')]['filter']+'%'};return _0x18c6ac;})});}_0x1d67ef=_[_0xb3a2('0x4e')]({},_0x1d67ef,_0x144370[_0xb3a2('0x50')]);return db[_0xb3a2('0x61')][_0xb3a2('0x53')](_0x1d67ef);}})[_0xb3a2('0x33')](function(_0x3b1b2f){if(_0x3b1b2f){return db[_0xb3a2('0x64')][_0xb3a2('0x65')]({'where':{'id':_[_0xb3a2('0x3a')](_0x3b1b2f,_0xb3a2('0x66')),'role':_0xb3a2('0x67')},'attributes':['id',_0xb3a2('0x3f'),_0xb3a2('0x68'),_0xb3a2('0x69'),'createdAt']});}})[_0xb3a2('0x33')](function(_0x82538){if(_0x82538){return{'count':_0x82538[_0xb3a2('0x2e')],'rows':_[_0xb3a2('0x3a')](_0x82538[_0xb3a2('0x54')],function(_0x6c822){return{'membername':_0x6c822[_0xb3a2('0x3f')],'UserId':_0x6c822['id'],'queue_name':_0x11ce03['name'],'ChatQueueId':_0x11ce03['id'],'interface':util[_0xb3a2('0x6a')](_0xb3a2('0x6b'),_0xb3a2('0x6c'),_0x6c822[_0xb3a2('0x3f')]),'penalty':0x0,'paused':_0x6c822[_0xb3a2('0x68')],'createdAt':_0x6c822[_0xb3a2('0x6d')],'updatedAt':_0x6c822[_0xb3a2('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb3a2('0x33')](respondWithFilteredResult(_0xceb36e,_0x1d67ef))['catch'](handleError(_0xceb36e,null));};exports['getTeams']=function(_0x584016,_0x1e8766,_0x31f3b4){var _0x52330b={};var _0x11c1e8={};var _0x573334;var _0x1db2d7;return db['ChatQueue']['findOne']({'where':{'id':_0x584016['params']['id']}})[_0xb3a2('0x33')](handleEntityNotFound(_0x1e8766,null))[_0xb3a2('0x33')](function(_0x150c4a){if(_0x150c4a){_0x573334=_0x150c4a;_0x11c1e8['model']=_[_0xb3a2('0x41')](db['Team'][_0xb3a2('0x3c')]);_0x11c1e8[_0xb3a2('0x40')]=_['keys'](_0x584016[_0xb3a2('0x40')]);_0x11c1e8[_0xb3a2('0x42')]=_[_0xb3a2('0x43')](_0x11c1e8[_0xb3a2('0x45')],_0x11c1e8[_0xb3a2('0x40')]);_0x52330b[_0xb3a2('0x44')]=_[_0xb3a2('0x43')](_0x11c1e8[_0xb3a2('0x45')],qs[_0xb3a2('0x46')](_0x584016[_0xb3a2('0x40')][_0xb3a2('0x46')]));_0x52330b['attributes']=_0x52330b['attributes']['length']?_0x52330b[_0xb3a2('0x44')]:_0x11c1e8[_0xb3a2('0x45')];_0x52330b[_0xb3a2('0x62')]=qs[_0xb3a2('0x4a')](_0x584016[_0xb3a2('0x40')]['sort']);_0x52330b[_0xb3a2('0x4b')]=qs[_0xb3a2('0x42')](_[_0xb3a2('0x4c')](_0x584016['query'],_0x11c1e8[_0xb3a2('0x42')]));if(_0x584016[_0xb3a2('0x40')][_0xb3a2('0x4d')]){_0x52330b[_0xb3a2('0x4b')]=_['merge'](_0x52330b[_0xb3a2('0x4b')],{'$or':_[_0xb3a2('0x3a')](_0x52330b[_0xb3a2('0x44')],function(_0x27289c){var _0x10129b={};_0x10129b[_0x27289c]={'$like':'%'+_0x584016[_0xb3a2('0x40')][_0xb3a2('0x4d')]+'%'};return _0x10129b;})});}_0x52330b=_[_0xb3a2('0x4e')]({},_0x52330b,_0x584016['options']);return _0x573334[_0xb3a2('0x6e')](_0x52330b);}})[_0xb3a2('0x33')](function(_0x495572){if(_0x495572){_0x1db2d7=_0x495572[_0xb3a2('0x47')];if(!_0x584016[_0xb3a2('0x40')][_0xb3a2('0x48')](_0xb3a2('0x49'))){_0x52330b[_0xb3a2('0x2d')]=qs[_0xb3a2('0x2d')](_0x584016['query']['limit']);_0x52330b[_0xb3a2('0x2b')]=qs['offset'](_0x584016[_0xb3a2('0x40')][_0xb3a2('0x2b')]);}return _0x573334['getTeams'](_0x52330b);}})[_0xb3a2('0x33')](function(_0x11a95a){if(_0x11a95a){return _0x11a95a?{'count':_0x1db2d7,'rows':_0x11a95a}:null;}})['then'](respondWithResult(_0x1e8766,null))['catch'](handleError(_0x1e8766,null));};exports['addTeams']=function(_0x1826ad,_0x4c4334,_0x419fa8){var _0x3dd459=_0x1826ad[_0xb3a2('0x5d')][_0xb3a2('0x6f')];return db['Team']['findAll']({'where':{'id':_0x3dd459},'attributes':['id'],'include':[{'model':db[_0xb3a2('0x64')],'as':'Agents','attributes':['id',_0xb3a2('0x3f'),_0xb3a2('0x70'),_0xb3a2('0x71'),_0xb3a2('0x72')],'raw':!![]}]})[_0xb3a2('0x33')](function(_0x16dbed){if(_0x16dbed){var _0x547622=_['flatMap'](_0x16dbed,function(_0x42c9be){var _0x80d6b2=_0x42c9be[_0xb3a2('0x35')]({'plain':!![]});return _0x80d6b2[_0xb3a2('0x73')];});return db[_0xb3a2('0x3b')][_0xb3a2('0x74')]({'where':{'id':_0x1826ad['params']['id']}})[_0xb3a2('0x33')](function(_0x51d3d6){return db[_0xb3a2('0x75')]['transaction'](function(_0x23ea78){return _0x51d3d6[_0xb3a2('0x76')](_0x3dd459,{'transaction':_0x23ea78})[_0xb3a2('0x33')](function(){return BPromise[_0xb3a2('0x77')](_0x547622,function(_0x249f4e){return db[_0xb3a2('0x61')][_0xb3a2('0x78')]({'where':{'UserId':_0x249f4e['id'],'ChatQueueId':_0x1826ad[_0xb3a2('0x55')]['id']},'transaction':_0x23ea78});});})['then'](function(){_0x547622[_0xb3a2('0x79')](function(_0x4d4f89){socket[_0xb3a2('0x7a')](_0xb3a2('0x7b'),{'UserId':_0x4d4f89['id'],'ChatQueueId':_0x51d3d6['id']});});});});});}})[_0xb3a2('0x33')](respondWithStatusCode(_0x4c4334,null))[_0xb3a2('0x56')](handleError(_0x4c4334,null));};exports[_0xb3a2('0x7c')]=function(_0x2cd5a6,_0x51b28f,_0x91c35e){return db[_0xb3a2('0x7d')][_0xb3a2('0x53')]({'where':{'id':_0x2cd5a6['query'][_0xb3a2('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xb3a2('0x64')],'as':_0xb3a2('0x73'),'attributes':['id'],'raw':!![]}]})[_0xb3a2('0x33')](handleEntityNotFound(_0x51b28f,null))['then'](function(_0x2f8d36){var _0x1df663=_[_0xb3a2('0x3a')](_0x2f8d36,'id');var _0x531062=[];var _0x301bff=[];var _0x2540f8=squel[_0xb3a2('0x7e')]();_0x2540f8[_0xb3a2('0x7f')](_0xb3a2('0x80'))['from'](_0xb3a2('0x81'),'tq')[_0xb3a2('0x82')](_0xb3a2('0x83'),'ut',_0xb3a2('0x84'))[_0xb3a2('0x4b')](_0xb3a2('0x85'),_0x2cd5a6[_0xb3a2('0x55')]['id']);for(var _0x334cc6=0x0;_0x334cc6<_0x2f8d36[_0xb3a2('0x47')];_0x334cc6+=0x1){let _0x2dc13c=_0x2f8d36[_0x334cc6];for(var _0x7de943=0x0;_0x7de943<_0x2dc13c[_0xb3a2('0x73')]['length'];_0x7de943+=0x1){let _0x3c3238=_0x2dc13c[_0xb3a2('0x73')][_0x7de943];var _0x13572c=_0x2540f8[_0xb3a2('0x86')]();_0x13572c['where'](_0xb3a2('0x87'),_0x3c3238['id']);_0x301bff[_0xb3a2('0x88')](db[_0xb3a2('0x75')][_0xb3a2('0x40')](_0x13572c[_0xb3a2('0x89')](),{'type':db[_0xb3a2('0x75')][_0xb3a2('0x8a')][_0xb3a2('0x8b')]})['then'](function(_0x564eb2){if(_0x564eb2['length']===0x1){return _0x3c3238['id'];}else{var _0x194b83=_[_0xb3a2('0x8c')](_['map'](_0x564eb2,_0xb3a2('0x8d')),function(_0x33a22b){return _[_0xb3a2('0x8e')](_0x1df663,_0x33a22b);});if(_0x194b83){return _0x3c3238['id'];}}}));}}return BPromise[_0xb3a2('0x8f')](_0x301bff)['then'](function(_0x426726){_0x531062=_(_0x531062)[_0xb3a2('0x90')](_0x426726)[_0xb3a2('0x91')]()['value']();return db[_0xb3a2('0x3b')][_0xb3a2('0x74')]({'where':{'id':_0x2cd5a6[_0xb3a2('0x55')]['id']}})[_0xb3a2('0x33')](function(_0x5f3d89){return db[_0xb3a2('0x75')][_0xb3a2('0x92')](function(_0x9e2640){return _0x5f3d89[_0xb3a2('0x7c')](_0x2cd5a6[_0xb3a2('0x40')][_0xb3a2('0x6f')],{'transaction':_0x9e2640})['then'](function(){if(!_[_0xb3a2('0x93')](_0x531062)){return _0x5f3d89[_0xb3a2('0x94')](_0x531062,{'transaction':_0x9e2640});}})[_0xb3a2('0x33')](function(){_0x531062[_0xb3a2('0x79')](function(_0x2d9548){socket[_0xb3a2('0x7a')]('userChatQueue:remove',{'UserId':_0x2d9548,'ChatQueueId':_0x5f3d89['id']});});});});});});})[_0xb3a2('0x33')](respondWithStatusCode(_0x51b28f,null))[_0xb3a2('0x56')](handleError(_0x51b28f,null));};exports['addAgents']=function(_0x582d63,_0x3a6640,_0x1bd08c){return db['ChatQueue'][_0xb3a2('0x74')]({'where':{'id':_0x582d63[_0xb3a2('0x55')]['id']}})[_0xb3a2('0x33')](handleEntityNotFound(_0x3a6640,null))['then'](function(_0x2d1ba9){if(_0x2d1ba9){return _0x2d1ba9[_0xb3a2('0x95')](_0x582d63[_0xb3a2('0x5d')][_0xb3a2('0x6f')],_['omit'](_0x582d63[_0xb3a2('0x5d')],[_0xb3a2('0x6f'),'id'])||{})[_0xb3a2('0x96')](function(_0xd77032){for(var _0x86a3e=0x0;_0x86a3e<_0x582d63[_0xb3a2('0x5d')][_0xb3a2('0x6f')][_0xb3a2('0x47')];_0x86a3e+=0x1){socket[_0xb3a2('0x7a')](_0xb3a2('0x7b'),{'UserId':Number(_0x582d63[_0xb3a2('0x5d')]['ids'][_0x86a3e]),'ChatQueueId':Number(_0x582d63[_0xb3a2('0x55')]['id'])});}return _0xd77032;});}})[_0xb3a2('0x33')](respondWithResult(_0x3a6640,null))[_0xb3a2('0x56')](handleError(_0x3a6640,null));};exports['removeAgents']=function(_0xddb216,_0x45d586,_0xde679f){return db[_0xb3a2('0x3b')]['find']({'where':{'id':_0xddb216[_0xb3a2('0x55')]['id']}})[_0xb3a2('0x33')](handleEntityNotFound(_0x45d586,null))['then'](function(_0x29c123){if(_0x29c123){return _0x29c123[_0xb3a2('0x94')](_0xddb216['query'][_0xb3a2('0x6f')])[_0xb3a2('0x33')](function(){if(_[_0xb3a2('0x97')](_0xddb216[_0xb3a2('0x40')][_0xb3a2('0x6f')])){for(var _0x321950=0x0;_0x321950<_0xddb216['query'][_0xb3a2('0x6f')][_0xb3a2('0x47')];_0x321950+=0x1){socket[_0xb3a2('0x7a')]('userChatQueue:remove',{'UserId':Number(_0xddb216[_0xb3a2('0x40')]['ids'][_0x321950]),'ChatQueueId':Number(_0xddb216['params']['id'])});}}else{socket[_0xb3a2('0x7a')](_0xb3a2('0x98'),{'UserId':Number(_0xddb216[_0xb3a2('0x40')][_0xb3a2('0x6f')]),'ChatQueueId':Number(_0xddb216[_0xb3a2('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x45d586,null))[_0xb3a2('0x56')](handleError(_0x45d586,null));};exports['getAgents']=function(_0x418438,_0x1a4b38,_0x31884a){var _0x5cfca8={};var _0x1920bb={};var _0xb1ea01;var _0x5b166d;return db['ChatQueue']['findOne']({'where':{'id':_0x418438[_0xb3a2('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a4b38,null))[_0xb3a2('0x33')](function(_0x54bcc8){if(_0x54bcc8){_0xb1ea01=_0x54bcc8;_0x1920bb[_0xb3a2('0x45')]=_['keys'](db[_0xb3a2('0x64')][_0xb3a2('0x3c')]);_0x1920bb[_0xb3a2('0x40')]=_[_0xb3a2('0x41')](_0x418438[_0xb3a2('0x40')]);_0x1920bb[_0xb3a2('0x42')]=_[_0xb3a2('0x43')](_0x1920bb[_0xb3a2('0x45')],_0x1920bb[_0xb3a2('0x40')]);_0x5cfca8[_0xb3a2('0x44')]=_[_0xb3a2('0x43')](_0x1920bb[_0xb3a2('0x45')],qs[_0xb3a2('0x46')](_0x418438[_0xb3a2('0x40')][_0xb3a2('0x46')]));_0x5cfca8[_0xb3a2('0x44')]=_0x5cfca8['attributes'][_0xb3a2('0x47')]?_0x5cfca8[_0xb3a2('0x44')]:_0x1920bb[_0xb3a2('0x45')];_0x5cfca8[_0xb3a2('0x62')]=qs[_0xb3a2('0x4a')](_0x418438[_0xb3a2('0x40')][_0xb3a2('0x4a')]);_0x5cfca8[_0xb3a2('0x4b')]=qs[_0xb3a2('0x42')](_['pick'](_0x418438[_0xb3a2('0x40')],_0x1920bb[_0xb3a2('0x42')]));if(_0x418438['query'][_0xb3a2('0x4d')]){_0x5cfca8[_0xb3a2('0x4b')]=_[_0xb3a2('0x4e')](_0x5cfca8[_0xb3a2('0x4b')],{'$or':_[_0xb3a2('0x3a')](_0x5cfca8['attributes'],function(_0x5886a3){var _0x42646c={};_0x42646c[_0x5886a3]={'$like':'%'+_0x418438['query'][_0xb3a2('0x4d')]+'%'};return _0x42646c;})});}_0x5cfca8=_['merge']({},_0x5cfca8,_0x418438[_0xb3a2('0x50')]);return _0xb1ea01[_0xb3a2('0x99')](_0x5cfca8);}})[_0xb3a2('0x33')](function(_0x58c5a1){if(_0x58c5a1){_0x5b166d=_0x58c5a1[_0xb3a2('0x47')];if(!_0x418438[_0xb3a2('0x40')][_0xb3a2('0x48')](_0xb3a2('0x49'))){_0x5cfca8[_0xb3a2('0x2d')]=qs[_0xb3a2('0x2d')](_0x418438['query'][_0xb3a2('0x2d')]);_0x5cfca8[_0xb3a2('0x2b')]=qs[_0xb3a2('0x2b')](_0x418438['query'][_0xb3a2('0x2b')]);}return _0xb1ea01[_0xb3a2('0x99')](_0x5cfca8);}})['then'](function(_0xe98f71){if(_0xe98f71){return _0xe98f71?{'count':_0x5b166d,'rows':_0xe98f71}:null;}})[_0xb3a2('0x33')](respondWithResult(_0x1a4b38,null))[_0xb3a2('0x56')](handleError(_0x1a4b38,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e836631..d86ffba 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 _0x2751=['hook','events','../../mysqldb','ChatQueue','update','remove','emit'];(function(_0x36fd51,_0x2cc468){var _0x3da0de=function(_0x2be093){while(--_0x2be093){_0x36fd51['push'](_0x36fd51['shift']());}};_0x3da0de(++_0x2cc468);}(_0x2751,0xbe));var _0x1275=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2751[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x1275('0x0'));var ChatQueue=require(_0x1275('0x1'))['db'][_0x1275('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1275('0x3'),'afterDestroy':_0x1275('0x4')};function emitEvent(_0x54f70d){return function(_0x2221fe,_0x730dac,_0x1b71b1){ChatQueueEvents[_0x1275('0x5')](_0x54f70d+':'+_0x2221fe['id'],_0x2221fe);ChatQueueEvents[_0x1275('0x5')](_0x54f70d,_0x2221fe);_0x1b71b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x1275('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xfc3a=['hook','events','ChatQueue','setMaxListeners','save','emit'];(function(_0x4ef0b0,_0xfedc57){var _0x1fe44f=function(_0x3e7059){while(--_0x3e7059){_0x4ef0b0['push'](_0x4ef0b0['shift']());}};_0x1fe44f(++_0xfedc57);}(_0xfc3a,0x175));var _0xafc3=function(_0x5d8150,_0x4e1ee6){_0x5d8150=_0x5d8150-0x0;var _0x334bf1=_0xfc3a[_0x5d8150];return _0x334bf1;};'use strict';var EventEmitter=require(_0xafc3('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xafc3('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xafc3('0x2')](0x0);var events={'afterCreate':_0xafc3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ac04d){return function(_0x15df57,_0x47585d,_0x383dbb){ChatQueueEvents[_0xafc3('0x4')](_0x5ac04d+':'+_0x15df57['id'],_0x15df57);ChatQueueEvents[_0xafc3('0x4')](_0x5ac04d,_0x15df57);_0x383dbb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xafc3('0x5')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 298e151..24dc592 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 _0x10ab=['ChatQueue','chat_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x163b50,_0x35de44){var _0x57e93d=function(_0x3b3044){while(--_0x3b3044){_0x163b50['push'](_0x163b50['shift']());}};_0x57e93d(++_0x35de44);}(_0x10ab,0x13a));var _0xb10a=function(_0x39c684,_0x1e0093){_0x39c684=_0x39c684-0x0;var _0x3da800=_0x10ab[_0x39c684];return _0x3da800;};'use strict';var _=require(_0xb10a('0x0'));var util=require(_0xb10a('0x1'));var logger=require(_0xb10a('0x2'))('api');var moment=require(_0xb10a('0x3'));var BPromise=require(_0xb10a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb10a('0x5'));var rimraf=require(_0xb10a('0x6'));var config=require(_0xb10a('0x7'));var attributes=require(_0xb10a('0x8'));module[_0xb10a('0x9')]=function(_0x12b538,_0x3bfe5e){return _0x12b538[_0xb10a('0xa')](_0xb10a('0xb'),attributes,{'tableName':_0xb10a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a51=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x0a51,0x108));var _0x10a5=function(_0x13ada4,_0x3d26cc){_0x13ada4=_0x13ada4-0x0;var _0x2264c8=_0x0a51[_0x13ada4];return _0x2264c8;};'use strict';var _=require(_0x10a5('0x0'));var util=require(_0x10a5('0x1'));var logger=require(_0x10a5('0x2'))(_0x10a5('0x3'));var moment=require(_0x10a5('0x4'));var BPromise=require(_0x10a5('0x5'));var rp=require(_0x10a5('0x6'));var fs=require('fs');var path=require(_0x10a5('0x7'));var rimraf=require(_0x10a5('0x8'));var config=require(_0x10a5('0x9'));var attributes=require(_0x10a5('0xa'));module[_0x10a5('0xb')]=function(_0x313823,_0x379637){return _0x313823[_0x10a5('0xc')](_0x10a5('0xd'),attributes,{'tableName':'chat_queues','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 8c1c061..8def175 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 _0x37c7=['limit','include','map','model','attributes','ShowChatQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','where'];(function(_0x151361,_0x3b3753){var _0x4d7d5f=function(_0x236b61){while(--_0x236b61){_0x151361['push'](_0x151361['shift']());}};_0x4d7d5f(++_0x3b3753);}(_0x37c7,0xda));var _0x737c=function(_0x9658dc,_0x4b1905){_0x9658dc=_0x9658dc-0x0;var _0x2ad48e=_0x37c7[_0x9658dc];return _0x2ad48e;};'use strict';var _=require(_0x737c('0x0'));var util=require('util');var moment=require(_0x737c('0x1'));var BPromise=require(_0x737c('0x2'));var rs=require(_0x737c('0x3'));var fs=require('fs');var Redis=require(_0x737c('0x4'));var db=require(_0x737c('0x5'))['db'];var utils=require(_0x737c('0x6'));var logger=require(_0x737c('0x7'))(_0x737c('0x8'));var config=require(_0x737c('0x9'));var jayson=require(_0x737c('0xa'));var client=jayson[_0x737c('0xb')][_0x737c('0xc')]({'port':0x232a});config[_0x737c('0xd')]=_[_0x737c('0xe')](config[_0x737c('0xd')],{'host':_0x737c('0xf'),'port':0x18eb});var socket=require(_0x737c('0x10'))(new Redis(config['redis']));require(_0x737c('0x11'))['register'](socket);function respondWithRpcPromise(_0x21b21b,_0x5dec7c,_0x42fe8a){return new BPromise(function(_0x51dc6a,_0x2f4a05){return client[_0x737c('0x12')](_0x21b21b,_0x42fe8a)[_0x737c('0x13')](function(_0x1e5eae){logger[_0x737c('0x14')]('ChatQueue,\x20%s,\x20%s',_0x5dec7c,_0x737c('0x15'));logger[_0x737c('0x16')](_0x737c('0x17'),_0x5dec7c,_0x737c('0x15'),JSON[_0x737c('0x18')](_0x1e5eae));if(_0x1e5eae['error']){if(_0x1e5eae[_0x737c('0x19')]['code']===0x1f4){logger[_0x737c('0x19')](_0x737c('0x1a'),_0x5dec7c,_0x1e5eae['error']['message']);return _0x2f4a05(_0x1e5eae[_0x737c('0x19')][_0x737c('0x1b')]);}logger[_0x737c('0x19')]('ChatQueue,\x20%s,\x20%s',_0x5dec7c,_0x1e5eae[_0x737c('0x19')][_0x737c('0x1b')]);return _0x51dc6a(_0x1e5eae['error'][_0x737c('0x1b')]);}else{logger[_0x737c('0x14')](_0x737c('0x1a'),_0x5dec7c,_0x737c('0x15'));_0x51dc6a(_0x1e5eae[_0x737c('0x1c')]['message']);}})[_0x737c('0x1d')](function(_0x23945c){logger[_0x737c('0x19')](_0x737c('0x1a'),_0x5dec7c,_0x23945c);_0x2f4a05(_0x23945c);});});}exports[_0x737c('0x1e')]=function(_0x819c62){var _0x1480e4=this;return new Promise(function(_0x2e2a44,_0x14d451){return db[_0x737c('0x1f')]['findAll']({'raw':_0x819c62[_0x737c('0x20')]?_0x819c62[_0x737c('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x819c62[_0x737c('0x20')]?_0x819c62[_0x737c('0x20')][_0x737c('0x21')]||null:null,'attributes':_0x819c62[_0x737c('0x20')]?_0x819c62[_0x737c('0x20')]['attributes']||null:null,'limit':_0x819c62['options']?_0x819c62[_0x737c('0x20')][_0x737c('0x22')]||null:null,'include':_0x819c62[_0x737c('0x20')]?_0x819c62['options'][_0x737c('0x23')]?_[_0x737c('0x24')](_0x819c62['options'][_0x737c('0x23')],function(_0x48af3e){return{'model':db[_0x48af3e[_0x737c('0x25')]],'as':_0x48af3e['as'],'attributes':_0x48af3e[_0x737c('0x26')],'include':_0x48af3e[_0x737c('0x23')]?_[_0x737c('0x24')](_0x48af3e[_0x737c('0x23')],function(_0x23493b){return{'model':db[_0x23493b[_0x737c('0x25')]],'as':_0x23493b['as'],'attributes':_0x23493b[_0x737c('0x26')],'include':_0x23493b['include']?_['map'](_0x23493b['include'],function(_0x45d9d4){return{'model':db[_0x45d9d4['model']],'as':_0x45d9d4['as'],'attributes':_0x45d9d4[_0x737c('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b20a4){logger['info'](_0x737c('0x1e'),_0x819c62);logger[_0x737c('0x16')](_0x737c('0x1e'),_0x819c62,JSON[_0x737c('0x18')](_0x3b20a4));_0x2e2a44(_0x3b20a4);})[_0x737c('0x1d')](function(_0x25c93f){logger['error'](_0x737c('0x1e'),_0x25c93f[_0x737c('0x1b')],_0x819c62);_0x14d451(_0x1480e4[_0x737c('0x19')](0x1f4,_0x25c93f[_0x737c('0x1b')]));});});};exports[_0x737c('0x27')]=function(_0x29d6cb){var _0x3a0168=this;return new Promise(function(_0x164ef0,_0x5be881){return db['ChatQueue'][_0x737c('0x28')]({'raw':_0x29d6cb['options']?_0x29d6cb['options'][_0x737c('0x29')]===undefined?!![]:![]:!![],'where':_0x29d6cb['options']?_0x29d6cb[_0x737c('0x20')][_0x737c('0x21')]||null:null,'attributes':_0x29d6cb[_0x737c('0x20')]?_0x29d6cb['options'][_0x737c('0x26')]||null:null,'include':_0x29d6cb[_0x737c('0x20')]?_0x29d6cb[_0x737c('0x20')][_0x737c('0x23')]?_['map'](_0x29d6cb['options'][_0x737c('0x23')],function(_0x62d7eb){return{'model':db[_0x62d7eb[_0x737c('0x25')]],'as':_0x62d7eb['as'],'attributes':_0x62d7eb[_0x737c('0x26')],'include':_0x62d7eb['include']?_[_0x737c('0x24')](_0x62d7eb['include'],function(_0x4bbac1){return{'model':db[_0x4bbac1[_0x737c('0x25')]],'as':_0x4bbac1['as'],'attributes':_0x4bbac1['attributes'],'include':_0x4bbac1[_0x737c('0x23')]?_[_0x737c('0x24')](_0x4bbac1[_0x737c('0x23')],function(_0x3d2bda){return{'model':db[_0x3d2bda[_0x737c('0x25')]],'as':_0x3d2bda['as'],'attributes':_0x3d2bda[_0x737c('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52195c){logger['info'](_0x737c('0x27'),_0x29d6cb);logger[_0x737c('0x16')](_0x737c('0x27'),_0x29d6cb,JSON[_0x737c('0x18')](_0x52195c));_0x164ef0(_0x52195c);})['catch'](function(_0x212cfd){logger['error']('ShowChatQueue',_0x212cfd['message'],_0x29d6cb);_0x5be881(_0x3a0168[_0x737c('0x19')](0x1f4,_0x212cfd[_0x737c('0x1b')]));});});}; \ No newline at end of file +var _0x0b63=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatQueue.socket','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','model','map','attributes','stringify','ShowChatQueue','find','lodash','bluebird','randomstring'];(function(_0x2d71f5,_0x5e352e){var _0x9473ea=function(_0x464584){while(--_0x464584){_0x2d71f5['push'](_0x2d71f5['shift']());}};_0x9473ea(++_0x5e352e);}(_0x0b63,0xe7));var _0x30b6=function(_0x494223,_0x17a6fa){_0x494223=_0x494223-0x0;var _0x3cd857=_0x0b63[_0x494223];return _0x3cd857;};'use strict';var _=require(_0x30b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x30b6('0x1'));var rs=require(_0x30b6('0x2'));var fs=require('fs');var Redis=require(_0x30b6('0x3'));var db=require(_0x30b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30b6('0x5'))(_0x30b6('0x6'));var config=require(_0x30b6('0x7'));var jayson=require(_0x30b6('0x8'));var client=jayson[_0x30b6('0x9')][_0x30b6('0xa')]({'port':0x232a});config['redis']=_[_0x30b6('0xb')](config['redis'],{'host':_0x30b6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30b6('0xd')]));require(_0x30b6('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f8faa,_0x1ab626,_0x5b0567){return new BPromise(function(_0x299f08,_0x32295b){return client[_0x30b6('0xf')](_0x3f8faa,_0x5b0567)[_0x30b6('0x10')](function(_0x1acd7f){logger[_0x30b6('0x11')]('ChatQueue,\x20%s,\x20%s',_0x1ab626,_0x30b6('0x12'));logger[_0x30b6('0x13')](_0x30b6('0x14'),_0x1ab626,_0x30b6('0x12'),JSON['stringify'](_0x1acd7f));if(_0x1acd7f[_0x30b6('0x15')]){if(_0x1acd7f['error']['code']===0x1f4){logger[_0x30b6('0x15')](_0x30b6('0x16'),_0x1ab626,_0x1acd7f[_0x30b6('0x15')]['message']);return _0x32295b(_0x1acd7f['error'][_0x30b6('0x17')]);}logger[_0x30b6('0x15')]('ChatQueue,\x20%s,\x20%s',_0x1ab626,_0x1acd7f[_0x30b6('0x15')]['message']);return _0x299f08(_0x1acd7f[_0x30b6('0x15')][_0x30b6('0x17')]);}else{logger[_0x30b6('0x11')](_0x30b6('0x16'),_0x1ab626,_0x30b6('0x12'));_0x299f08(_0x1acd7f['result'][_0x30b6('0x17')]);}})[_0x30b6('0x18')](function(_0x3cec44){logger[_0x30b6('0x15')](_0x30b6('0x16'),_0x1ab626,_0x3cec44);_0x32295b(_0x3cec44);});});}exports[_0x30b6('0x19')]=function(_0x2a0f9e){var _0x53417f=this;return new Promise(function(_0x46d6bb,_0x388e18){return db[_0x30b6('0x1a')][_0x30b6('0x1b')]({'raw':_0x2a0f9e['options']?_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a0f9e['options']?_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x1e')]||null:null,'attributes':_0x2a0f9e[_0x30b6('0x1c')]?_0x2a0f9e[_0x30b6('0x1c')]['attributes']||null:null,'limit':_0x2a0f9e[_0x30b6('0x1c')]?_0x2a0f9e['options'][_0x30b6('0x1f')]||null:null,'include':_0x2a0f9e[_0x30b6('0x1c')]?_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x20')]?_['map'](_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x20')],function(_0x5a7bdd){return{'model':db[_0x5a7bdd[_0x30b6('0x21')]],'as':_0x5a7bdd['as'],'attributes':_0x5a7bdd['attributes'],'include':_0x5a7bdd[_0x30b6('0x20')]?_[_0x30b6('0x22')](_0x5a7bdd[_0x30b6('0x20')],function(_0x590a28){return{'model':db[_0x590a28[_0x30b6('0x21')]],'as':_0x590a28['as'],'attributes':_0x590a28[_0x30b6('0x23')],'include':_0x590a28[_0x30b6('0x20')]?_[_0x30b6('0x22')](_0x590a28[_0x30b6('0x20')],function(_0x2bf84d){return{'model':db[_0x2bf84d[_0x30b6('0x21')]],'as':_0x2bf84d['as'],'attributes':_0x2bf84d[_0x30b6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x30b6('0x10')](function(_0x50adb4){logger[_0x30b6('0x11')]('GetChatQueue',_0x2a0f9e);logger['debug']('GetChatQueue',_0x2a0f9e,JSON[_0x30b6('0x24')](_0x50adb4));_0x46d6bb(_0x50adb4);})['catch'](function(_0x336eac){logger[_0x30b6('0x15')](_0x30b6('0x19'),_0x336eac[_0x30b6('0x17')],_0x2a0f9e);_0x388e18(_0x53417f[_0x30b6('0x15')](0x1f4,_0x336eac[_0x30b6('0x17')]));});});};exports[_0x30b6('0x25')]=function(_0x68115a){var _0x166a95=this;return new Promise(function(_0x2c117b,_0xe85ade){return db['ChatQueue'][_0x30b6('0x26')]({'raw':_0x68115a[_0x30b6('0x1c')]?_0x68115a['options']['raw']===undefined?!![]:![]:!![],'where':_0x68115a['options']?_0x68115a['options'][_0x30b6('0x1e')]||null:null,'attributes':_0x68115a[_0x30b6('0x1c')]?_0x68115a[_0x30b6('0x1c')]['attributes']||null:null,'include':_0x68115a[_0x30b6('0x1c')]?_0x68115a['options']['include']?_[_0x30b6('0x22')](_0x68115a[_0x30b6('0x1c')]['include'],function(_0x57d478){return{'model':db[_0x57d478[_0x30b6('0x21')]],'as':_0x57d478['as'],'attributes':_0x57d478['attributes'],'include':_0x57d478['include']?_['map'](_0x57d478[_0x30b6('0x20')],function(_0x54cb75){return{'model':db[_0x54cb75['model']],'as':_0x54cb75['as'],'attributes':_0x54cb75[_0x30b6('0x23')],'include':_0x54cb75[_0x30b6('0x20')]?_[_0x30b6('0x22')](_0x54cb75[_0x30b6('0x20')],function(_0x171019){return{'model':db[_0x171019['model']],'as':_0x171019['as'],'attributes':_0x171019[_0x30b6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x30b6('0x10')](function(_0x206e09){logger[_0x30b6('0x11')](_0x30b6('0x25'),_0x68115a);logger['debug'](_0x30b6('0x25'),_0x68115a,JSON['stringify'](_0x206e09));_0x2c117b(_0x206e09);})[_0x30b6('0x18')](function(_0x54556f){logger[_0x30b6('0x15')](_0x30b6('0x25'),_0x54556f[_0x30b6('0x17')],_0x68115a);_0xe85ade(_0x166a95['error'](0x1f4,_0x54556f[_0x30b6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b19690c..a4649f7 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 _0x0e85=['update','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x22cd40,_0x552308){var _0x4d1903=function(_0x330d61){while(--_0x330d61){_0x22cd40['push'](_0x22cd40['shift']());}};_0x4d1903(++_0x552308);}(_0x0e85,0x7c));var _0x50e8=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0e85[_0x3e44fa];return _0x2a0aba;};'use strict';var ChatQueueEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){ChatQueueEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);ChatQueueEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file +var _0x5636=['save','emit','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x365a28,_0x24c0d5){var _0xce6354=function(_0x515799){while(--_0x515799){_0x365a28['push'](_0x365a28['shift']());}};_0xce6354(++_0x24c0d5);}(_0x5636,0x102));var _0x6563=function(_0x2d56a0,_0x11064b){_0x2d56a0=_0x2d56a0-0x0;var _0x4521ed=_0x5636[_0x2d56a0];return _0x4521ed;};'use strict';var ChatQueueEvents=require(_0x6563('0x0'));var events=[_0x6563('0x1'),'remove','update'];function createListener(_0x579d5c,_0x44872c){return function(_0x3a95f7){_0x44872c[_0x6563('0x2')](_0x579d5c,_0x3a95f7);};}function removeListener(_0x4ac653,_0x166a58){return function(){ChatQueueEvents[_0x6563('0x3')](_0x4ac653,_0x166a58);};}exports[_0x6563('0x4')]=function(_0x39792f){for(var _0x29f687=0x0,_0x193942=events[_0x6563('0x5')];_0x29f687<_0x193942;_0x29f687++){var _0x2d57d5=events[_0x29f687];var _0x2d0d5b=createListener(_0x6563('0x6')+_0x2d57d5,_0x39792f);ChatQueueEvents['on'](_0x2d57d5,_0x2d0d5b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 185914a..c3ab587 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x47c836,_0x2b88a2){var _0x382b13=function(_0x29ab0f){while(--_0x29ab0f){_0x47c836['push'](_0x47c836['shift']());}};_0x382b13(++_0x2b88a2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x5fc3[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 283e24a..3ddcc31 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 _0x1352=['exports','STRING','DATE','moment','sequelize'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x1352,0x17a));var _0x2135=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x1352[_0x3c4737];return _0x2bb926;};'use strict';var moment=require(_0x2135('0x0'));var Sequelize=require(_0x2135('0x1'));module[_0x2135('0x2')]={'uniqueid':{'type':Sequelize[_0x2135('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2135('0x3')]},'joinAt':{'type':Sequelize[_0x2135('0x4')]},'leaveAt':{'type':Sequelize[_0x2135('0x4')]},'acceptAt':{'type':Sequelize[_0x2135('0x4')]},'exitAt':{'type':Sequelize[_0x2135('0x4')]},'reason':{'type':Sequelize[_0x2135('0x3')]}}; \ No newline at end of file +var _0x2ad6=['DATE','moment','exports','STRING'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0x2ad6,0x1a1));var _0x62ad=function(_0x4d53e6,_0x2aaa84){_0x4d53e6=_0x4d53e6-0x0;var _0x4a16f4=_0x2ad6[_0x4d53e6];return _0x4a16f4;};'use strict';var moment=require(_0x62ad('0x0'));var Sequelize=require('sequelize');module[_0x62ad('0x1')]={'uniqueid':{'type':Sequelize[_0x62ad('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x62ad('0x2')]},'joinAt':{'type':Sequelize[_0x62ad('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x62ad('0x3')]},'exitAt':{'type':Sequelize[_0x62ad('0x3')]},'reason':{'type':Sequelize[_0x62ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index aee1462..411b802 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 _0xbd9e=['undefined','limit','count','set','apply','save','update','then','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','findAll','rows','catch','length','includeAll','include','find','create','body','params','destroy','describe','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0xbd9e,0x108));var _0xebd9=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xbd9e[_0x4bfac3];return _0x15f0f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebd9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebd9('0x1'));var moment=require(_0xebd9('0x2'));var BPromise=require(_0xebd9('0x3'));var Mustache=require(_0xebd9('0x4'));var util=require(_0xebd9('0x5'));var path=require('path');var sox=require(_0xebd9('0x6'));var csv=require('to-csv');var ejs=require(_0xebd9('0x7'));var fs=require('fs');var fs_extra=require(_0xebd9('0x8'));var _=require(_0xebd9('0x9'));var squel=require(_0xebd9('0xa'));var crypto=require(_0xebd9('0xb'));var jsforce=require(_0xebd9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xebd9('0xd'));var querystring=require(_0xebd9('0xe'));var Papa=require(_0xebd9('0xf'));var Redis=require(_0xebd9('0x10'));var authService=require(_0xebd9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebd9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebd9('0x13'))('api');var utils=require(_0xebd9('0x14'));var config=require(_0xebd9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xebd9('0x16'))['db'];function respondWithStatusCode(_0x11b8ed,_0x4b1c92){_0x4b1c92=_0x4b1c92||0xcc;return function(_0xd5a048){if(_0xd5a048){return _0x11b8ed[_0xebd9('0x17')](_0x4b1c92);}return _0x11b8ed[_0xebd9('0x18')](_0x4b1c92)[_0xebd9('0x19')]();};}function respondWithResult(_0x5cf3f7,_0x324363){_0x324363=_0x324363||0xc8;return function(_0xdfe08e){if(_0xdfe08e){return _0x5cf3f7[_0xebd9('0x18')](_0x324363)[_0xebd9('0x1a')](_0xdfe08e);}};}function respondWithFilteredResult(_0x1f5dd1,_0x237d00){return function(_0x29fde8){if(_0x29fde8){var _0x35095e=typeof _0x237d00[_0xebd9('0x1b')]===_0xebd9('0x1c')&&typeof _0x237d00[_0xebd9('0x1d')]===_0xebd9('0x1c');var _0x296341=_0x29fde8[_0xebd9('0x1e')];var _0x4d04cb=_0x35095e?0x0:_0x237d00[_0xebd9('0x1b')];var _0x8310f2=_0x35095e?_0x29fde8[_0xebd9('0x1e')]:_0x237d00['offset']+_0x237d00[_0xebd9('0x1d')];var _0x58086a;if(_0x8310f2>=_0x296341){_0x8310f2=_0x296341;_0x58086a=0xc8;}else{_0x58086a=0xce;}_0x1f5dd1[_0xebd9('0x18')](_0x58086a);return _0x1f5dd1[_0xebd9('0x1f')]('Content-Range',_0x4d04cb+'-'+_0x8310f2+'/'+_0x296341)['json'](_0x29fde8);}return null;};}function patchUpdates(_0x5701cd){return function(_0x23b478){try{jsonpatch[_0xebd9('0x20')](_0x23b478,_0x5701cd,!![]);}catch(_0x36bc37){return BPromise['reject'](_0x36bc37);}return _0x23b478[_0xebd9('0x21')]();};}function saveUpdates(_0x44fa41,_0x3fb488){return function(_0x2c17c8){if(_0x2c17c8){return _0x2c17c8[_0xebd9('0x22')](_0x44fa41)[_0xebd9('0x23')](function(_0x5ec121){return _0x5ec121;});}return null;};}function removeEntity(_0x1a3895,_0x259d17){return function(_0x588091){if(_0x588091){return _0x588091['destroy']()[_0xebd9('0x23')](function(){_0x1a3895[_0xebd9('0x18')](0xcc)[_0xebd9('0x19')]();});}};}function handleEntityNotFound(_0x1f2bbb,_0x4b54d7){return function(_0x1ac789){if(!_0x1ac789){_0x1f2bbb[_0xebd9('0x17')](0x194);}return _0x1ac789;};}function handleError(_0x2ef023,_0x1d2330){_0x1d2330=_0x1d2330||0x1f4;return function(_0x5548ae){logger[_0xebd9('0x24')](_0x5548ae['stack']);if(_0x5548ae['name']){delete _0x5548ae[_0xebd9('0x25')];}_0x2ef023[_0xebd9('0x18')](_0x1d2330)[_0xebd9('0x26')](_0x5548ae);};}exports[_0xebd9('0x27')]=function(_0x472601,_0x576834){var _0x5310a8={},_0x4e12bf={},_0x222d94={'count':0x0,'rows':[]};var _0x278edb=_[_0xebd9('0x28')](db[_0xebd9('0x29')][_0xebd9('0x2a')],function(_0xf17a69){return{'name':_0xf17a69[_0xebd9('0x2b')],'type':_0xf17a69[_0xebd9('0x2c')][_0xebd9('0x2d')]};});_0x4e12bf[_0xebd9('0x2e')]=_[_0xebd9('0x28')](_0x278edb,_0xebd9('0x25'));_0x4e12bf['query']=_[_0xebd9('0x2f')](_0x472601['query']);_0x4e12bf[_0xebd9('0x30')]=_[_0xebd9('0x31')](_0x4e12bf['model'],_0x4e12bf['query']);_0x5310a8[_0xebd9('0x32')]=_[_0xebd9('0x31')](_0x4e12bf[_0xebd9('0x2e')],qs[_0xebd9('0x33')](_0x472601[_0xebd9('0x34')][_0xebd9('0x33')]));_0x5310a8[_0xebd9('0x32')]=_0x5310a8[_0xebd9('0x32')]['length']?_0x5310a8[_0xebd9('0x32')]:_0x4e12bf[_0xebd9('0x2e')];if(!_0x472601[_0xebd9('0x34')][_0xebd9('0x35')](_0xebd9('0x36'))){_0x5310a8[_0xebd9('0x1d')]=qs[_0xebd9('0x1d')](_0x472601[_0xebd9('0x34')][_0xebd9('0x1d')]);_0x5310a8['offset']=qs[_0xebd9('0x1b')](_0x472601['query'][_0xebd9('0x1b')]);}_0x5310a8[_0xebd9('0x37')]=qs[_0xebd9('0x38')](_0x472601[_0xebd9('0x34')]['sort']);_0x5310a8[_0xebd9('0x39')]=qs[_0xebd9('0x30')](_['pick'](_0x472601[_0xebd9('0x34')],_0x4e12bf[_0xebd9('0x30')]),_0x278edb);if(_0x472601[_0xebd9('0x34')]['filter']){_0x5310a8[_0xebd9('0x39')]=_['merge'](_0x5310a8[_0xebd9('0x39')],{'$or':_[_0xebd9('0x28')](_0x278edb,function(_0x4f0eb0){if(_0x4f0eb0[_0xebd9('0x2c')]!==_0xebd9('0x3a')){var _0x115e7c={};_0x115e7c[_0x4f0eb0['name']]={'$like':'%'+_0x472601[_0xebd9('0x34')]['filter']+'%'};return _0x115e7c;}})});}_0x5310a8=_[_0xebd9('0x3b')]({},_0x5310a8,_0x472601[_0xebd9('0x3c')]);var _0x2c4f60={'where':_0x5310a8[_0xebd9('0x39')]};return db[_0xebd9('0x29')][_0xebd9('0x1e')](_0x2c4f60)[_0xebd9('0x23')](function(_0x57d0a0){_0x222d94[_0xebd9('0x1e')]=_0x57d0a0;if(_0x472601[_0xebd9('0x34')]['includeAll']){_0x5310a8['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xebd9('0x3d')](_0x5310a8);})[_0xebd9('0x23')](function(_0x1be720){_0x222d94[_0xebd9('0x3e')]=_0x1be720;return _0x222d94;})[_0xebd9('0x23')](respondWithFilteredResult(_0x576834,_0x5310a8))[_0xebd9('0x3f')](handleError(_0x576834,null));};exports['show']=function(_0x3f9f3d,_0x56ba3b){var _0x33ef42={'raw':!![],'where':{'id':_0x3f9f3d['params']['id']}},_0x1f0fcc={};_0x1f0fcc['model']=_['keys'](db[_0xebd9('0x29')][_0xebd9('0x2a')]);_0x1f0fcc[_0xebd9('0x34')]=_[_0xebd9('0x2f')](_0x3f9f3d[_0xebd9('0x34')]);_0x1f0fcc[_0xebd9('0x30')]=_[_0xebd9('0x31')](_0x1f0fcc[_0xebd9('0x2e')],_0x1f0fcc['query']);_0x33ef42[_0xebd9('0x32')]=_['intersection'](_0x1f0fcc[_0xebd9('0x2e')],qs[_0xebd9('0x33')](_0x3f9f3d[_0xebd9('0x34')]['fields']));_0x33ef42[_0xebd9('0x32')]=_0x33ef42[_0xebd9('0x32')][_0xebd9('0x40')]?_0x33ef42['attributes']:_0x1f0fcc[_0xebd9('0x2e')];if(_0x3f9f3d[_0xebd9('0x34')][_0xebd9('0x41')]){_0x33ef42[_0xebd9('0x42')]=[{'all':!![]}];}_0x33ef42=_[_0xebd9('0x3b')]({},_0x33ef42,_0x3f9f3d[_0xebd9('0x3c')]);return db[_0xebd9('0x29')][_0xebd9('0x43')](_0x33ef42)['then'](handleEntityNotFound(_0x56ba3b,null))[_0xebd9('0x23')](respondWithResult(_0x56ba3b,null))['catch'](handleError(_0x56ba3b,null));};exports[_0xebd9('0x44')]=function(_0x4bcc0d,_0xdcae7c){return db[_0xebd9('0x29')][_0xebd9('0x44')](_0x4bcc0d[_0xebd9('0x45')],{})[_0xebd9('0x23')](respondWithResult(_0xdcae7c,0xc9))[_0xebd9('0x3f')](handleError(_0xdcae7c,null));};exports['update']=function(_0x1d2fed,_0x59df76){if(_0x1d2fed[_0xebd9('0x45')]['id']){delete _0x1d2fed[_0xebd9('0x45')]['id'];}return db[_0xebd9('0x29')][_0xebd9('0x43')]({'where':{'id':_0x1d2fed[_0xebd9('0x46')]['id']}})[_0xebd9('0x23')](handleEntityNotFound(_0x59df76,null))[_0xebd9('0x23')](saveUpdates(_0x1d2fed[_0xebd9('0x45')],null))[_0xebd9('0x23')](respondWithResult(_0x59df76,null))[_0xebd9('0x3f')](handleError(_0x59df76,null));};exports[_0xebd9('0x47')]=function(_0x13ade2,_0xe6821f){return db[_0xebd9('0x29')]['find']({'where':{'id':_0x13ade2['params']['id']}})[_0xebd9('0x23')](handleEntityNotFound(_0xe6821f,null))['then'](removeEntity(_0xe6821f,null))[_0xebd9('0x3f')](handleError(_0xe6821f,null));};exports[_0xebd9('0x48')]=function(_0x3fd2ce,_0x104085){return db[_0xebd9('0x29')][_0xebd9('0x48')]()[_0xebd9('0x23')](respondWithResult(_0x104085,null))['catch'](handleError(_0x104085,null));}; \ No newline at end of file +var _0x8f6b=['save','update','then','destroy','stack','name','send','index','ChatQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x8f6b,0x146));var _0xb8f6=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x8f6b[_0x5317b5];return _0x3b7ce2;};'use strict';var emlformat=require(_0xb8f6('0x0'));var rimraf=require(_0xb8f6('0x1'));var zipdir=require(_0xb8f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8f6('0x3'));var moment=require(_0xb8f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb8f6('0x5'));var util=require(_0xb8f6('0x6'));var path=require('path');var sox=require(_0xb8f6('0x7'));var csv=require('to-csv');var ejs=require(_0xb8f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8f6('0x9'));var squel=require('squel');var crypto=require(_0xb8f6('0xa'));var jsforce=require(_0xb8f6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8f6('0xc'));var Papa=require(_0xb8f6('0xd'));var Redis=require(_0xb8f6('0xe'));var authService=require(_0xb8f6('0xf'));var qs=require(_0xb8f6('0x10'));var as=require(_0xb8f6('0x11'));var hardwareService=require(_0xb8f6('0x12'));var logger=require(_0xb8f6('0x13'))(_0xb8f6('0x14'));var utils=require(_0xb8f6('0x15'));var config=require(_0xb8f6('0x16'));var licenseUtil=require(_0xb8f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x885b9f,_0x31e406){_0x31e406=_0x31e406||0xcc;return function(_0x54c4a8){if(_0x54c4a8){return _0x885b9f[_0xb8f6('0x18')](_0x31e406);}return _0x885b9f[_0xb8f6('0x19')](_0x31e406)[_0xb8f6('0x1a')]();};}function respondWithResult(_0x4c4963,_0x306072){_0x306072=_0x306072||0xc8;return function(_0x50d3a1){if(_0x50d3a1){return _0x4c4963[_0xb8f6('0x19')](_0x306072)[_0xb8f6('0x1b')](_0x50d3a1);}};}function respondWithFilteredResult(_0x505607,_0x48b20b){return function(_0x1fa122){if(_0x1fa122){var _0x28c214=typeof _0x48b20b[_0xb8f6('0x1c')]===_0xb8f6('0x1d')&&typeof _0x48b20b[_0xb8f6('0x1e')]===_0xb8f6('0x1d');var _0x2e998b=_0x1fa122[_0xb8f6('0x1f')];var _0x3592a5=_0x28c214?0x0:_0x48b20b['offset'];var _0x5c36ec=_0x28c214?_0x1fa122[_0xb8f6('0x1f')]:_0x48b20b[_0xb8f6('0x1c')]+_0x48b20b[_0xb8f6('0x1e')];var _0x335e9c;if(_0x5c36ec>=_0x2e998b){_0x5c36ec=_0x2e998b;_0x335e9c=0xc8;}else{_0x335e9c=0xce;}_0x505607[_0xb8f6('0x19')](_0x335e9c);return _0x505607['set'](_0xb8f6('0x20'),_0x3592a5+'-'+_0x5c36ec+'/'+_0x2e998b)[_0xb8f6('0x1b')](_0x1fa122);}return null;};}function patchUpdates(_0x44e6a8){return function(_0x1fb378){try{jsonpatch['apply'](_0x1fb378,_0x44e6a8,!![]);}catch(_0x38c93e){return BPromise[_0xb8f6('0x21')](_0x38c93e);}return _0x1fb378[_0xb8f6('0x22')]();};}function saveUpdates(_0x155ad4,_0xe87a0){return function(_0x59c5f1){if(_0x59c5f1){return _0x59c5f1[_0xb8f6('0x23')](_0x155ad4)[_0xb8f6('0x24')](function(_0x4e62c0){return _0x4e62c0;});}return null;};}function removeEntity(_0x252212,_0x16c880){return function(_0x3a4fd2){if(_0x3a4fd2){return _0x3a4fd2[_0xb8f6('0x25')]()['then'](function(){_0x252212[_0xb8f6('0x19')](0xcc)[_0xb8f6('0x1a')]();});}};}function handleEntityNotFound(_0x4fea2e,_0x3e9b2b){return function(_0x4ee750){if(!_0x4ee750){_0x4fea2e[_0xb8f6('0x18')](0x194);}return _0x4ee750;};}function handleError(_0xeedd5,_0x253904){_0x253904=_0x253904||0x1f4;return function(_0x1b0f80){logger['error'](_0x1b0f80[_0xb8f6('0x26')]);if(_0x1b0f80[_0xb8f6('0x27')]){delete _0x1b0f80[_0xb8f6('0x27')];}_0xeedd5['status'](_0x253904)[_0xb8f6('0x28')](_0x1b0f80);};}exports[_0xb8f6('0x29')]=function(_0x2c47e7,_0x24cd83){var _0x3b1ecc={},_0x47ffb2={},_0x5d2895={'count':0x0,'rows':[]};var _0x132727=_['map'](db[_0xb8f6('0x2a')]['rawAttributes'],function(_0x37de1c){return{'name':_0x37de1c[_0xb8f6('0x2b')],'type':_0x37de1c[_0xb8f6('0x2c')][_0xb8f6('0x2d')]};});_0x47ffb2[_0xb8f6('0x2e')]=_[_0xb8f6('0x2f')](_0x132727,_0xb8f6('0x27'));_0x47ffb2[_0xb8f6('0x30')]=_[_0xb8f6('0x31')](_0x2c47e7['query']);_0x47ffb2[_0xb8f6('0x32')]=_[_0xb8f6('0x33')](_0x47ffb2[_0xb8f6('0x2e')],_0x47ffb2[_0xb8f6('0x30')]);_0x3b1ecc['attributes']=_[_0xb8f6('0x33')](_0x47ffb2['model'],qs[_0xb8f6('0x34')](_0x2c47e7[_0xb8f6('0x30')][_0xb8f6('0x34')]));_0x3b1ecc[_0xb8f6('0x35')]=_0x3b1ecc['attributes'][_0xb8f6('0x36')]?_0x3b1ecc['attributes']:_0x47ffb2[_0xb8f6('0x2e')];if(!_0x2c47e7['query'][_0xb8f6('0x37')]('nolimit')){_0x3b1ecc[_0xb8f6('0x1e')]=qs[_0xb8f6('0x1e')](_0x2c47e7[_0xb8f6('0x30')]['limit']);_0x3b1ecc[_0xb8f6('0x1c')]=qs['offset'](_0x2c47e7[_0xb8f6('0x30')][_0xb8f6('0x1c')]);}_0x3b1ecc['order']=qs[_0xb8f6('0x38')](_0x2c47e7[_0xb8f6('0x30')]['sort']);_0x3b1ecc[_0xb8f6('0x39')]=qs[_0xb8f6('0x32')](_['pick'](_0x2c47e7['query'],_0x47ffb2[_0xb8f6('0x32')]),_0x132727);if(_0x2c47e7[_0xb8f6('0x30')][_0xb8f6('0x3a')]){_0x3b1ecc[_0xb8f6('0x39')]=_[_0xb8f6('0x3b')](_0x3b1ecc[_0xb8f6('0x39')],{'$or':_['map'](_0x132727,function(_0x372a05){if(_0x372a05[_0xb8f6('0x2c')]!==_0xb8f6('0x3c')){var _0x25f4ee={};_0x25f4ee[_0x372a05[_0xb8f6('0x27')]]={'$like':'%'+_0x2c47e7[_0xb8f6('0x30')]['filter']+'%'};return _0x25f4ee;}})});}_0x3b1ecc=_[_0xb8f6('0x3b')]({},_0x3b1ecc,_0x2c47e7[_0xb8f6('0x3d')]);var _0x597bde={'where':_0x3b1ecc[_0xb8f6('0x39')]};return db[_0xb8f6('0x2a')][_0xb8f6('0x1f')](_0x597bde)[_0xb8f6('0x24')](function(_0x483ca1){_0x5d2895['count']=_0x483ca1;if(_0x2c47e7['query'][_0xb8f6('0x3e')]){_0x3b1ecc['include']=[{'all':!![]}];}return db[_0xb8f6('0x2a')][_0xb8f6('0x3f')](_0x3b1ecc);})[_0xb8f6('0x24')](function(_0x4b2265){_0x5d2895[_0xb8f6('0x40')]=_0x4b2265;return _0x5d2895;})[_0xb8f6('0x24')](respondWithFilteredResult(_0x24cd83,_0x3b1ecc))[_0xb8f6('0x41')](handleError(_0x24cd83,null));};exports[_0xb8f6('0x42')]=function(_0xcbe6f7,_0x45ea35){var _0x49c548={'raw':!![],'where':{'id':_0xcbe6f7[_0xb8f6('0x43')]['id']}},_0x3a1b81={};_0x3a1b81[_0xb8f6('0x2e')]=_[_0xb8f6('0x31')](db[_0xb8f6('0x2a')][_0xb8f6('0x44')]);_0x3a1b81[_0xb8f6('0x30')]=_['keys'](_0xcbe6f7[_0xb8f6('0x30')]);_0x3a1b81[_0xb8f6('0x32')]=_[_0xb8f6('0x33')](_0x3a1b81[_0xb8f6('0x2e')],_0x3a1b81[_0xb8f6('0x30')]);_0x49c548[_0xb8f6('0x35')]=_[_0xb8f6('0x33')](_0x3a1b81['model'],qs[_0xb8f6('0x34')](_0xcbe6f7[_0xb8f6('0x30')][_0xb8f6('0x34')]));_0x49c548[_0xb8f6('0x35')]=_0x49c548[_0xb8f6('0x35')][_0xb8f6('0x36')]?_0x49c548['attributes']:_0x3a1b81[_0xb8f6('0x2e')];if(_0xcbe6f7['query'][_0xb8f6('0x3e')]){_0x49c548[_0xb8f6('0x45')]=[{'all':!![]}];}_0x49c548=_[_0xb8f6('0x3b')]({},_0x49c548,_0xcbe6f7[_0xb8f6('0x3d')]);return db[_0xb8f6('0x2a')][_0xb8f6('0x46')](_0x49c548)['then'](handleEntityNotFound(_0x45ea35,null))[_0xb8f6('0x24')](respondWithResult(_0x45ea35,null))[_0xb8f6('0x41')](handleError(_0x45ea35,null));};exports['create']=function(_0x1995fc,_0x52f8a0){return db['ChatQueueReport']['create'](_0x1995fc[_0xb8f6('0x47')],{})[_0xb8f6('0x24')](respondWithResult(_0x52f8a0,0xc9))[_0xb8f6('0x41')](handleError(_0x52f8a0,null));};exports[_0xb8f6('0x23')]=function(_0x55fb97,_0x1a65a9){if(_0x55fb97[_0xb8f6('0x47')]['id']){delete _0x55fb97[_0xb8f6('0x47')]['id'];}return db[_0xb8f6('0x2a')][_0xb8f6('0x46')]({'where':{'id':_0x55fb97[_0xb8f6('0x43')]['id']}})[_0xb8f6('0x24')](handleEntityNotFound(_0x1a65a9,null))['then'](saveUpdates(_0x55fb97['body'],null))[_0xb8f6('0x24')](respondWithResult(_0x1a65a9,null))[_0xb8f6('0x41')](handleError(_0x1a65a9,null));};exports[_0xb8f6('0x25')]=function(_0x20fa4c,_0x23fea2){return db[_0xb8f6('0x2a')][_0xb8f6('0x46')]({'where':{'id':_0x20fa4c[_0xb8f6('0x43')]['id']}})[_0xb8f6('0x24')](handleEntityNotFound(_0x23fea2,null))[_0xb8f6('0x24')](removeEntity(_0x23fea2,null))[_0xb8f6('0x41')](handleError(_0x23fea2,null));};exports['describe']=function(_0x2a15ef,_0x5678fb){return db[_0xb8f6('0x2a')]['describe']()[_0xb8f6('0x24')](respondWithResult(_0x5678fb,null))['catch'](handleError(_0x5678fb,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 434c73d..de52f09 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x27b9d5,_0x29eabb){var _0x35baa8=function(_0x4b4603){while(--_0x4b4603){_0x27b9d5['push'](_0x27b9d5['shift']());}};_0x35baa8(++_0x29eabb);}(_0x757a,0xde));var _0xa757=function(_0x5ea73b,_0x40f1c1){_0x5ea73b=_0x5ea73b-0x0;var _0x3172a6=_0x757a[_0x5ea73b];return _0x3172a6;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x11f28e,_0x2d781b){var _0x5aa85a=function(_0x2b9593){while(--_0x2b9593){_0x11f28e['push'](_0x11f28e['shift']());}};_0x5aa85a(++_0x2d781b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7cf9b97..a8ea580 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 _0x59ea=['client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateChatQueueReport','ChatQueueReport','create','body','options','stringify','catch','UpdateChatQueueReport','update','raw','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x1aa826,_0xeb6ec5){var _0x4037bd=function(_0x59d411){while(--_0x59d411){_0x1aa826['push'](_0x1aa826['shift']());}};_0x4037bd(++_0xeb6ec5);}(_0x59ea,0x19d));var _0xa59e=function(_0x921b5f,_0x2834bc){_0x921b5f=_0x921b5f-0x0;var _0xc8d4=_0x59ea[_0x921b5f];return _0xc8d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa59e('0x0'));var BPromise=require(_0xa59e('0x1'));var rs=require(_0xa59e('0x2'));var fs=require('fs');var Redis=require(_0xa59e('0x3'));var db=require(_0xa59e('0x4'))['db'];var utils=require(_0xa59e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa59e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa59e('0x7')][_0xa59e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f2478,_0x598186,_0x2e7744){return new BPromise(function(_0x17797b,_0x193b6b){return client['request'](_0x3f2478,_0x2e7744)[_0xa59e('0x9')](function(_0x2cf3be){logger[_0xa59e('0xa')](_0xa59e('0xb'),_0x598186,_0xa59e('0xc'));logger[_0xa59e('0xd')](_0xa59e('0xe'),_0x598186,_0xa59e('0xc'),JSON['stringify'](_0x2cf3be));if(_0x2cf3be['error']){if(_0x2cf3be[_0xa59e('0xf')][_0xa59e('0x10')]===0x1f4){logger[_0xa59e('0xf')](_0xa59e('0xb'),_0x598186,_0x2cf3be['error'][_0xa59e('0x11')]);return _0x193b6b(_0x2cf3be['error']['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x598186,_0x2cf3be[_0xa59e('0xf')][_0xa59e('0x11')]);return _0x17797b(_0x2cf3be['error'][_0xa59e('0x11')]);}else{logger[_0xa59e('0xa')](_0xa59e('0xb'),_0x598186,_0xa59e('0xc'));_0x17797b(_0x2cf3be['result']['message']);}})['catch'](function(_0x1020d6){logger[_0xa59e('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x598186,_0x1020d6);_0x193b6b(_0x1020d6);});});}exports[_0xa59e('0x12')]=function(_0x277aee){var _0x2f31fa=this;return new Promise(function(_0x38104c,_0x4ded2a){return db[_0xa59e('0x13')][_0xa59e('0x14')](_0x277aee[_0xa59e('0x15')],{'raw':_0x277aee[_0xa59e('0x16')]?_0x277aee[_0xa59e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xa59e('0x9')](function(_0x2e1d5d){logger['info'](_0xa59e('0x12'),_0x277aee);logger[_0xa59e('0xd')](_0xa59e('0x12'),_0x277aee,JSON[_0xa59e('0x17')](_0x2e1d5d));_0x38104c(_0x2e1d5d);})[_0xa59e('0x18')](function(_0x2a583a){logger['error'](_0xa59e('0x12'),_0x2a583a['message'],_0x277aee);_0x4ded2a(_0x2f31fa[_0xa59e('0xf')](0x1f4,_0x2a583a['message']));});});};exports[_0xa59e('0x19')]=function(_0x5ea0cb){var _0x21c52e=this;return new Promise(function(_0x5e2d8f,_0x34c7ab){return db[_0xa59e('0x13')][_0xa59e('0x1a')](_0x5ea0cb[_0xa59e('0x15')],{'raw':_0x5ea0cb['options']?_0x5ea0cb[_0xa59e('0x16')][_0xa59e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ea0cb['options']?_0x5ea0cb[_0xa59e('0x16')]['where']||null:null,'attributes':_0x5ea0cb['options']?_0x5ea0cb[_0xa59e('0x16')][_0xa59e('0x1c')]||null:null,'limit':_0x5ea0cb['options']?_0x5ea0cb[_0xa59e('0x16')][_0xa59e('0x1d')]||null:null})['then'](function(_0x1175da){logger[_0xa59e('0xa')]('UpdateChatQueueReport',_0x5ea0cb);logger[_0xa59e('0xd')](_0xa59e('0x19'),_0x5ea0cb,JSON[_0xa59e('0x17')](_0x1175da));_0x5e2d8f(_0x1175da);})[_0xa59e('0x18')](function(_0x5b06ae){logger[_0xa59e('0xf')](_0xa59e('0x19'),_0x5b06ae[_0xa59e('0x11')],_0x5ea0cb);_0x34c7ab(_0x21c52e['error'](0x1f4,_0x5b06ae[_0xa59e('0x11')]));});});}; \ No newline at end of file +var _0xbb9e=['info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x19493e,_0x45f547){var _0x2af77e=function(_0x12f8bc){while(--_0x12f8bc){_0x19493e['push'](_0x19493e['shift']());}};_0x2af77e(++_0x45f547);}(_0xbb9e,0x11e));var _0xebb9=function(_0x40b7d6,_0x2a01c4){_0x40b7d6=_0x40b7d6-0x0;var _0x4a725d=_0xbb9e[_0x40b7d6];return _0x4a725d;};'use strict';var _=require(_0xebb9('0x0'));var util=require(_0xebb9('0x1'));var moment=require(_0xebb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xebb9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xebb9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xebb9('0x6'));var client=jayson[_0xebb9('0x7')][_0xebb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59a7ad,_0x15c9bc,_0x12c341){return new BPromise(function(_0x47b6ce,_0x3b1d58){return client[_0xebb9('0x9')](_0x59a7ad,_0x12c341)[_0xebb9('0xa')](function(_0x62a37e){logger[_0xebb9('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x15c9bc,_0xebb9('0xc'));logger['debug'](_0xebb9('0xd'),_0x15c9bc,_0xebb9('0xc'),JSON[_0xebb9('0xe')](_0x62a37e));if(_0x62a37e['error']){if(_0x62a37e['error'][_0xebb9('0xf')]===0x1f4){logger[_0xebb9('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x15c9bc,_0x62a37e[_0xebb9('0x10')][_0xebb9('0x11')]);return _0x3b1d58(_0x62a37e['error']['message']);}logger[_0xebb9('0x10')](_0xebb9('0x12'),_0x15c9bc,_0x62a37e['error'][_0xebb9('0x11')]);return _0x47b6ce(_0x62a37e[_0xebb9('0x10')][_0xebb9('0x11')]);}else{logger[_0xebb9('0xb')](_0xebb9('0x12'),_0x15c9bc,'request\x20sent');_0x47b6ce(_0x62a37e[_0xebb9('0x13')]['message']);}})[_0xebb9('0x14')](function(_0x493c3a){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x15c9bc,_0x493c3a);_0x3b1d58(_0x493c3a);});});}exports[_0xebb9('0x15')]=function(_0x39e90f){var _0x130020=this;return new Promise(function(_0x11ed8,_0x408a2b){return db[_0xebb9('0x16')][_0xebb9('0x17')](_0x39e90f[_0xebb9('0x18')],{'raw':_0x39e90f[_0xebb9('0x19')]?_0x39e90f['options'][_0xebb9('0x1a')]===undefined?!![]:![]:!![]})[_0xebb9('0xa')](function(_0x35434c){logger['info'](_0xebb9('0x15'),_0x39e90f);logger['debug']('CreateChatQueueReport',_0x39e90f,JSON[_0xebb9('0xe')](_0x35434c));_0x11ed8(_0x35434c);})[_0xebb9('0x14')](function(_0x324252){logger['error'](_0xebb9('0x15'),_0x324252[_0xebb9('0x11')],_0x39e90f);_0x408a2b(_0x130020['error'](0x1f4,_0x324252[_0xebb9('0x11')]));});});};exports[_0xebb9('0x1b')]=function(_0x4a1a6a){var _0x4a14b9=this;return new Promise(function(_0x4b190d,_0x5d695c){return db['ChatQueueReport'][_0xebb9('0x1c')](_0x4a1a6a[_0xebb9('0x18')],{'raw':_0x4a1a6a[_0xebb9('0x19')]?_0x4a1a6a['options'][_0xebb9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a1a6a['options']?_0x4a1a6a[_0xebb9('0x19')][_0xebb9('0x1d')]||null:null,'attributes':_0x4a1a6a[_0xebb9('0x19')]?_0x4a1a6a[_0xebb9('0x19')][_0xebb9('0x1e')]||null:null,'limit':_0x4a1a6a[_0xebb9('0x19')]?_0x4a1a6a[_0xebb9('0x19')][_0xebb9('0x1f')]||null:null})['then'](function(_0x2d7c85){logger[_0xebb9('0xb')](_0xebb9('0x1b'),_0x4a1a6a);logger[_0xebb9('0x20')]('UpdateChatQueueReport',_0x4a1a6a,JSON['stringify'](_0x2d7c85));_0x4b190d(_0x2d7c85);})[_0xebb9('0x14')](function(_0x1037fb){logger['error'](_0xebb9('0x1b'),_0x1037fb[_0xebb9('0x11')],_0x4a1a6a);_0x5d695c(_0x4a14b9[_0xebb9('0x10')](0x1f4,_0x1037fb[_0xebb9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8ea201d..26722f2 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 _0xf9b3=['/describe','isAuthenticated','describe','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x2bd93b,_0x344493){var _0x430536=function(_0x3f723e){while(--_0x3f723e){_0x2bd93b['push'](_0x2bd93b['shift']());}};_0x430536(++_0x344493);}(_0xf9b3,0xb4));var _0x3f9b=function(_0x2e6796,_0x15a7c5){_0x2e6796=_0x2e6796-0x0;var _0x5a2088=_0xf9b3[_0x2e6796];return _0x5a2088;};'use strict';var multer=require(_0x3f9b('0x0'));var util=require(_0x3f9b('0x1'));var path=require(_0x3f9b('0x2'));var timeout=require(_0x3f9b('0x3'));var express=require(_0x3f9b('0x4'));var router=express['Router']();var fs_extra=require(_0x3f9b('0x5'));var auth=require(_0x3f9b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3f9b('0x7'));var controller=require('./chatQueueReport.controller');router[_0x3f9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x3f9b('0x9')]);router['get'](_0x3f9b('0xa'),auth[_0x3f9b('0xb')](),controller[_0x3f9b('0xc')]);router['get'](_0x3f9b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3f9b('0xe')]('/',auth[_0x3f9b('0xb')](),controller[_0x3f9b('0xf')]);router[_0x3f9b('0x10')]('/:id',auth[_0x3f9b('0xb')](),controller['update']);router[_0x3f9b('0x11')]('/:id',auth[_0x3f9b('0xb')](),controller['destroy']);module[_0x3f9b('0x12')]=router; \ No newline at end of file +var _0xa0a0=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','delete','exports','path','connect-timeout'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa0a0,0xb2));var _0x0a0a=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xa0a0[_0x33bc64];return _0x3fdd34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a0a('0x0'));var timeout=require(_0x0a0a('0x1'));var express=require(_0x0a0a('0x2'));var router=express[_0x0a0a('0x3')]();var fs_extra=require(_0x0a0a('0x4'));var auth=require(_0x0a0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a0a('0x6'));var controller=require(_0x0a0a('0x7'));router['get']('/',auth[_0x0a0a('0x8')](),controller[_0x0a0a('0x9')]);router['get'](_0x0a0a('0xa'),auth[_0x0a0a('0x8')](),controller[_0x0a0a('0xb')]);router[_0x0a0a('0xc')](_0x0a0a('0xd'),auth[_0x0a0a('0x8')](),controller['show']);router[_0x0a0a('0xe')]('/',auth[_0x0a0a('0x8')](),controller[_0x0a0a('0xf')]);router['put'](_0x0a0a('0xd'),auth[_0x0a0a('0x8')](),controller['update']);router[_0x0a0a('0x10')](_0x0a0a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0a0a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index caa3949..4ae3407 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xc99ae6,_0x144a10){var _0x29e387=function(_0x21abf2){while(--_0x21abf2){_0xc99ae6['push'](_0xc99ae6['shift']());}};_0x29e387(++_0x144a10);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2e0e23,_0x30ec18){_0x2e0e23=_0x2e0e23-0x0;var _0x1085e8=_0xf4eb[_0x2e0e23];return _0x1085e8;};'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(_0x392df6,_0x5b712c){var _0x1cef17=function(_0x278365){while(--_0x278365){_0x392df6['push'](_0x392df6['shift']());}};_0x1cef17(++_0x5b712c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x172043,_0x34e966){_0x172043=_0x172043-0x0;var _0x56fba8=_0xf4eb[_0x172043];return _0x56fba8;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index afe2acc..6c16a66 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 _0x6bb5=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','end','error','name','send','index','map','ChatTransferReport','rawAttributes','key','model','query','intersection','attributes'];(function(_0xd6b84a,_0x47c79d){var _0x4e5edf=function(_0x4f5a9e){while(--_0x4f5a9e){_0xd6b84a['push'](_0xd6b84a['shift']());}};_0x4e5edf(++_0x47c79d);}(_0x6bb5,0x1da));var _0x56bb=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x6bb5[_0x3a2a3c];return _0x50ac9a;};'use strict';var emlformat=require(_0x56bb('0x0'));var rimraf=require(_0x56bb('0x1'));var zipdir=require(_0x56bb('0x2'));var jsonpatch=require(_0x56bb('0x3'));var rp=require(_0x56bb('0x4'));var moment=require(_0x56bb('0x5'));var BPromise=require(_0x56bb('0x6'));var Mustache=require(_0x56bb('0x7'));var util=require(_0x56bb('0x8'));var path=require(_0x56bb('0x9'));var sox=require(_0x56bb('0xa'));var csv=require(_0x56bb('0xb'));var ejs=require(_0x56bb('0xc'));var fs=require('fs');var fs_extra=require(_0x56bb('0xd'));var _=require('lodash');var squel=require(_0x56bb('0xe'));var crypto=require(_0x56bb('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x56bb('0xb'));var querystring=require(_0x56bb('0x10'));var Papa=require(_0x56bb('0x11'));var Redis=require(_0x56bb('0x12'));var authService=require(_0x56bb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x56bb('0x14'));var hardwareService=require(_0x56bb('0x15'));var logger=require(_0x56bb('0x16'))(_0x56bb('0x17'));var utils=require('../../config/utils');var config=require(_0x56bb('0x18'));var licenseUtil=require(_0x56bb('0x19'));var db=require(_0x56bb('0x1a'))['db'];function respondWithStatusCode(_0xf93b0e,_0x1b49e5){_0x1b49e5=_0x1b49e5||0xcc;return function(_0x4ac529){if(_0x4ac529){return _0xf93b0e[_0x56bb('0x1b')](_0x1b49e5);}return _0xf93b0e[_0x56bb('0x1c')](_0x1b49e5)['end']();};}function respondWithResult(_0x87827,_0x35b2d3){_0x35b2d3=_0x35b2d3||0xc8;return function(_0x56bc02){if(_0x56bc02){return _0x87827['status'](_0x35b2d3)[_0x56bb('0x1d')](_0x56bc02);}};}function respondWithFilteredResult(_0x3472ca,_0x5d2f30){return function(_0x4e8e98){if(_0x4e8e98){var _0x4b8a0b=typeof _0x5d2f30[_0x56bb('0x1e')]===_0x56bb('0x1f')&&typeof _0x5d2f30[_0x56bb('0x20')]==='undefined';var _0x574474=_0x4e8e98['count'];var _0x36de83=_0x4b8a0b?0x0:_0x5d2f30[_0x56bb('0x1e')];var _0x23f458=_0x4b8a0b?_0x4e8e98[_0x56bb('0x21')]:_0x5d2f30[_0x56bb('0x1e')]+_0x5d2f30[_0x56bb('0x20')];var _0x4c0961;if(_0x23f458>=_0x574474){_0x23f458=_0x574474;_0x4c0961=0xc8;}else{_0x4c0961=0xce;}_0x3472ca['status'](_0x4c0961);return _0x3472ca[_0x56bb('0x22')]('Content-Range',_0x36de83+'-'+_0x23f458+'/'+_0x574474)['json'](_0x4e8e98);}return null;};}function patchUpdates(_0x10384e){return function(_0x2dec37){try{jsonpatch['apply'](_0x2dec37,_0x10384e,!![]);}catch(_0x84aa66){return BPromise['reject'](_0x84aa66);}return _0x2dec37['save']();};}function saveUpdates(_0x4da5a3,_0x36e79b){return function(_0x4500ff){if(_0x4500ff){return _0x4500ff[_0x56bb('0x23')](_0x4da5a3)['then'](function(_0x1729de){return _0x1729de;});}return null;};}function removeEntity(_0xb812b8,_0x4801ef){return function(_0x3a086e){if(_0x3a086e){return _0x3a086e[_0x56bb('0x24')]()[_0x56bb('0x25')](function(){_0xb812b8[_0x56bb('0x1c')](0xcc)[_0x56bb('0x26')]();});}};}function handleEntityNotFound(_0x6319d4,_0x49cbe3){return function(_0x3e4d66){if(!_0x3e4d66){_0x6319d4[_0x56bb('0x1b')](0x194);}return _0x3e4d66;};}function handleError(_0x16c96d,_0x519a09){_0x519a09=_0x519a09||0x1f4;return function(_0x517cb8){logger[_0x56bb('0x27')](_0x517cb8['stack']);if(_0x517cb8[_0x56bb('0x28')]){delete _0x517cb8[_0x56bb('0x28')];}_0x16c96d[_0x56bb('0x1c')](_0x519a09)[_0x56bb('0x29')](_0x517cb8);};}exports[_0x56bb('0x2a')]=function(_0xe1f1eb,_0x3076d2){var _0x368ea4={},_0x22b874={},_0x1d3a91={'count':0x0,'rows':[]};var _0x5a62d4=_[_0x56bb('0x2b')](db[_0x56bb('0x2c')][_0x56bb('0x2d')],function(_0x2d8e6c){return{'name':_0x2d8e6c['fieldName'],'type':_0x2d8e6c['type'][_0x56bb('0x2e')]};});_0x22b874[_0x56bb('0x2f')]=_['map'](_0x5a62d4,_0x56bb('0x28'));_0x22b874['query']=_['keys'](_0xe1f1eb[_0x56bb('0x30')]);_0x22b874['filters']=_[_0x56bb('0x31')](_0x22b874['model'],_0x22b874[_0x56bb('0x30')]);_0x368ea4[_0x56bb('0x32')]=_[_0x56bb('0x31')](_0x22b874['model'],qs[_0x56bb('0x33')](_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x33')]));_0x368ea4['attributes']=_0x368ea4['attributes'][_0x56bb('0x34')]?_0x368ea4['attributes']:_0x22b874['model'];if(!_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x35')](_0x56bb('0x36'))){_0x368ea4[_0x56bb('0x20')]=qs['limit'](_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x20')]);_0x368ea4[_0x56bb('0x1e')]=qs[_0x56bb('0x1e')](_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x1e')]);}_0x368ea4[_0x56bb('0x37')]=qs[_0x56bb('0x38')](_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x38')]);_0x368ea4[_0x56bb('0x39')]=qs['filters'](_['pick'](_0xe1f1eb['query'],_0x22b874[_0x56bb('0x3a')]),_0x5a62d4);if(_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x3b')]){_0x368ea4[_0x56bb('0x39')]=_[_0x56bb('0x3c')](_0x368ea4[_0x56bb('0x39')],{'$or':_['map'](_0x5a62d4,function(_0x116751){if(_0x116751[_0x56bb('0x3d')]!==_0x56bb('0x3e')){var _0x374a8c={};_0x374a8c[_0x116751[_0x56bb('0x28')]]={'$like':'%'+_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x3b')]+'%'};return _0x374a8c;}})});}_0x368ea4=_[_0x56bb('0x3c')]({},_0x368ea4,_0xe1f1eb['options']);var _0x477f9e={'where':_0x368ea4[_0x56bb('0x39')]};return db['ChatTransferReport'][_0x56bb('0x21')](_0x477f9e)['then'](function(_0x2338d3){_0x1d3a91[_0x56bb('0x21')]=_0x2338d3;if(_0xe1f1eb[_0x56bb('0x30')][_0x56bb('0x3f')]){_0x368ea4[_0x56bb('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x56bb('0x41')](_0x368ea4);})[_0x56bb('0x25')](function(_0x3544fc){_0x1d3a91[_0x56bb('0x42')]=_0x3544fc;return _0x1d3a91;})['then'](respondWithFilteredResult(_0x3076d2,_0x368ea4))[_0x56bb('0x43')](handleError(_0x3076d2,null));};exports['show']=function(_0x19735b,_0x3c197e){var _0x193079={'raw':!![],'where':{'id':_0x19735b[_0x56bb('0x44')]['id']}},_0xe7bd82={};_0xe7bd82[_0x56bb('0x2f')]=_[_0x56bb('0x45')](db[_0x56bb('0x2c')][_0x56bb('0x2d')]);_0xe7bd82[_0x56bb('0x30')]=_[_0x56bb('0x45')](_0x19735b[_0x56bb('0x30')]);_0xe7bd82['filters']=_['intersection'](_0xe7bd82[_0x56bb('0x2f')],_0xe7bd82['query']);_0x193079[_0x56bb('0x32')]=_['intersection'](_0xe7bd82[_0x56bb('0x2f')],qs[_0x56bb('0x33')](_0x19735b[_0x56bb('0x30')]['fields']));_0x193079['attributes']=_0x193079['attributes'][_0x56bb('0x34')]?_0x193079[_0x56bb('0x32')]:_0xe7bd82['model'];if(_0x19735b[_0x56bb('0x30')][_0x56bb('0x3f')]){_0x193079[_0x56bb('0x40')]=[{'all':!![]}];}_0x193079=_['merge']({},_0x193079,_0x19735b[_0x56bb('0x46')]);return db[_0x56bb('0x2c')][_0x56bb('0x47')](_0x193079)[_0x56bb('0x25')](handleEntityNotFound(_0x3c197e,null))[_0x56bb('0x25')](respondWithResult(_0x3c197e,null))[_0x56bb('0x43')](handleError(_0x3c197e,null));};exports['create']=function(_0x5bb371,_0x2debe3){return db['ChatTransferReport'][_0x56bb('0x48')](_0x5bb371['body'],{})[_0x56bb('0x25')](respondWithResult(_0x2debe3,0xc9))[_0x56bb('0x43')](handleError(_0x2debe3,null));};exports[_0x56bb('0x23')]=function(_0x4d07c8,_0x442ae1){if(_0x4d07c8[_0x56bb('0x49')]['id']){delete _0x4d07c8['body']['id'];}return db['ChatTransferReport'][_0x56bb('0x47')]({'where':{'id':_0x4d07c8[_0x56bb('0x44')]['id']}})[_0x56bb('0x25')](handleEntityNotFound(_0x442ae1,null))[_0x56bb('0x25')](saveUpdates(_0x4d07c8[_0x56bb('0x49')],null))[_0x56bb('0x25')](respondWithResult(_0x442ae1,null))[_0x56bb('0x43')](handleError(_0x442ae1,null));};exports[_0x56bb('0x24')]=function(_0x4f8851,_0x2da20e){return db['ChatTransferReport'][_0x56bb('0x47')]({'where':{'id':_0x4f8851[_0x56bb('0x44')]['id']}})['then'](handleEntityNotFound(_0x2da20e,null))[_0x56bb('0x25')](removeEntity(_0x2da20e,null))[_0x56bb('0x43')](handleError(_0x2da20e,null));};exports['describe']=function(_0x2b33b7,_0x5a4a24){return db['ChatTransferReport'][_0x56bb('0x4a')]()[_0x56bb('0x25')](respondWithResult(_0x5a4a24,null))['catch'](handleError(_0x5a4a24,null));}; \ No newline at end of file +var _0x98fc=['includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','ChatTransferReport'];(function(_0x418f0e,_0xe46481){var _0x1b464e=function(_0xb7af48){while(--_0xb7af48){_0x418f0e['push'](_0x418f0e['shift']());}};_0x1b464e(++_0xe46481);}(_0x98fc,0xa5));var _0xc98f=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x98fc[_0x49d19d];return _0x4ebef1;};'use strict';var emlformat=require(_0xc98f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc98f('0x1'));var jsonpatch=require(_0xc98f('0x2'));var rp=require(_0xc98f('0x3'));var moment=require('moment');var BPromise=require(_0xc98f('0x4'));var Mustache=require(_0xc98f('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc98f('0x6'));var ejs=require(_0xc98f('0x7'));var fs=require('fs');var fs_extra=require(_0xc98f('0x8'));var _=require(_0xc98f('0x9'));var squel=require(_0xc98f('0xa'));var crypto=require(_0xc98f('0xb'));var jsforce=require(_0xc98f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc98f('0x6'));var querystring=require(_0xc98f('0xd'));var Papa=require(_0xc98f('0xe'));var Redis=require(_0xc98f('0xf'));var authService=require(_0xc98f('0x10'));var qs=require(_0xc98f('0x11'));var as=require(_0xc98f('0x12'));var hardwareService=require(_0xc98f('0x13'));var logger=require(_0xc98f('0x14'))(_0xc98f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc98f('0x16'));var db=require(_0xc98f('0x17'))['db'];function respondWithStatusCode(_0x113e84,_0x1fb531){_0x1fb531=_0x1fb531||0xcc;return function(_0x4e3830){if(_0x4e3830){return _0x113e84['sendStatus'](_0x1fb531);}return _0x113e84[_0xc98f('0x18')](_0x1fb531)[_0xc98f('0x19')]();};}function respondWithResult(_0x12d044,_0x13e040){_0x13e040=_0x13e040||0xc8;return function(_0x3f7df6){if(_0x3f7df6){return _0x12d044[_0xc98f('0x18')](_0x13e040)[_0xc98f('0x1a')](_0x3f7df6);}};}function respondWithFilteredResult(_0x2fa0ec,_0x29a2c6){return function(_0x13ff23){if(_0x13ff23){var _0x34518c=typeof _0x29a2c6['offset']===_0xc98f('0x1b')&&typeof _0x29a2c6['limit']===_0xc98f('0x1b');var _0x3486ee=_0x13ff23[_0xc98f('0x1c')];var _0x1594f4=_0x34518c?0x0:_0x29a2c6[_0xc98f('0x1d')];var _0xf2441b=_0x34518c?_0x13ff23[_0xc98f('0x1c')]:_0x29a2c6[_0xc98f('0x1d')]+_0x29a2c6[_0xc98f('0x1e')];var _0x24c004;if(_0xf2441b>=_0x3486ee){_0xf2441b=_0x3486ee;_0x24c004=0xc8;}else{_0x24c004=0xce;}_0x2fa0ec['status'](_0x24c004);return _0x2fa0ec[_0xc98f('0x1f')](_0xc98f('0x20'),_0x1594f4+'-'+_0xf2441b+'/'+_0x3486ee)[_0xc98f('0x1a')](_0x13ff23);}return null;};}function patchUpdates(_0x464606){return function(_0xb5f153){try{jsonpatch[_0xc98f('0x21')](_0xb5f153,_0x464606,!![]);}catch(_0x92333d){return BPromise[_0xc98f('0x22')](_0x92333d);}return _0xb5f153[_0xc98f('0x23')]();};}function saveUpdates(_0x261c0a,_0x338d97){return function(_0xf2edb3){if(_0xf2edb3){return _0xf2edb3[_0xc98f('0x24')](_0x261c0a)[_0xc98f('0x25')](function(_0x1a0f7c){return _0x1a0f7c;});}return null;};}function removeEntity(_0x1c3e1b,_0x14c768){return function(_0x2dd62f){if(_0x2dd62f){return _0x2dd62f[_0xc98f('0x26')]()[_0xc98f('0x25')](function(){_0x1c3e1b[_0xc98f('0x18')](0xcc)[_0xc98f('0x19')]();});}};}function handleEntityNotFound(_0x27f87b,_0x28b444){return function(_0x281d39){if(!_0x281d39){_0x27f87b[_0xc98f('0x27')](0x194);}return _0x281d39;};}function handleError(_0x663317,_0x4d7b54){_0x4d7b54=_0x4d7b54||0x1f4;return function(_0x5d2b03){logger[_0xc98f('0x28')](_0x5d2b03[_0xc98f('0x29')]);if(_0x5d2b03[_0xc98f('0x2a')]){delete _0x5d2b03[_0xc98f('0x2a')];}_0x663317[_0xc98f('0x18')](_0x4d7b54)[_0xc98f('0x2b')](_0x5d2b03);};}exports[_0xc98f('0x2c')]=function(_0x5e1014,_0x4404a9){var _0x2d93e2={},_0x497d0b={},_0x2a1cac={'count':0x0,'rows':[]};var _0x59d425=_[_0xc98f('0x2d')](db['ChatTransferReport'][_0xc98f('0x2e')],function(_0x5b1fcf){return{'name':_0x5b1fcf[_0xc98f('0x2f')],'type':_0x5b1fcf['type']['key']};});_0x497d0b[_0xc98f('0x30')]=_['map'](_0x59d425,_0xc98f('0x2a'));_0x497d0b[_0xc98f('0x31')]=_[_0xc98f('0x32')](_0x5e1014[_0xc98f('0x31')]);_0x497d0b[_0xc98f('0x33')]=_['intersection'](_0x497d0b[_0xc98f('0x30')],_0x497d0b[_0xc98f('0x31')]);_0x2d93e2[_0xc98f('0x34')]=_[_0xc98f('0x35')](_0x497d0b[_0xc98f('0x30')],qs['fields'](_0x5e1014[_0xc98f('0x31')][_0xc98f('0x36')]));_0x2d93e2['attributes']=_0x2d93e2['attributes'][_0xc98f('0x37')]?_0x2d93e2[_0xc98f('0x34')]:_0x497d0b[_0xc98f('0x30')];if(!_0x5e1014[_0xc98f('0x31')][_0xc98f('0x38')](_0xc98f('0x39'))){_0x2d93e2[_0xc98f('0x1e')]=qs['limit'](_0x5e1014['query'][_0xc98f('0x1e')]);_0x2d93e2[_0xc98f('0x1d')]=qs[_0xc98f('0x1d')](_0x5e1014[_0xc98f('0x31')][_0xc98f('0x1d')]);}_0x2d93e2[_0xc98f('0x3a')]=qs[_0xc98f('0x3b')](_0x5e1014[_0xc98f('0x31')][_0xc98f('0x3b')]);_0x2d93e2[_0xc98f('0x3c')]=qs['filters'](_[_0xc98f('0x3d')](_0x5e1014['query'],_0x497d0b[_0xc98f('0x33')]),_0x59d425);if(_0x5e1014['query'][_0xc98f('0x3e')]){_0x2d93e2[_0xc98f('0x3c')]=_[_0xc98f('0x3f')](_0x2d93e2[_0xc98f('0x3c')],{'$or':_[_0xc98f('0x2d')](_0x59d425,function(_0x9f8f3){if(_0x9f8f3[_0xc98f('0x40')]!=='VIRTUAL'){var _0xd9b5de={};_0xd9b5de[_0x9f8f3[_0xc98f('0x2a')]]={'$like':'%'+_0x5e1014[_0xc98f('0x31')][_0xc98f('0x3e')]+'%'};return _0xd9b5de;}})});}_0x2d93e2=_[_0xc98f('0x3f')]({},_0x2d93e2,_0x5e1014['options']);var _0x4b6960={'where':_0x2d93e2[_0xc98f('0x3c')]};return db[_0xc98f('0x41')][_0xc98f('0x1c')](_0x4b6960)[_0xc98f('0x25')](function(_0x4c1df7){_0x2a1cac['count']=_0x4c1df7;if(_0x5e1014[_0xc98f('0x31')][_0xc98f('0x42')]){_0x2d93e2[_0xc98f('0x43')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xc98f('0x44')](_0x2d93e2);})[_0xc98f('0x25')](function(_0xb8130f){_0x2a1cac[_0xc98f('0x45')]=_0xb8130f;return _0x2a1cac;})[_0xc98f('0x25')](respondWithFilteredResult(_0x4404a9,_0x2d93e2))[_0xc98f('0x46')](handleError(_0x4404a9,null));};exports['show']=function(_0x55ab40,_0x56e3a5){var _0x4eb836={'raw':!![],'where':{'id':_0x55ab40[_0xc98f('0x47')]['id']}},_0x4d6151={};_0x4d6151[_0xc98f('0x30')]=_[_0xc98f('0x32')](db['ChatTransferReport'][_0xc98f('0x2e')]);_0x4d6151[_0xc98f('0x31')]=_[_0xc98f('0x32')](_0x55ab40[_0xc98f('0x31')]);_0x4d6151['filters']=_[_0xc98f('0x35')](_0x4d6151[_0xc98f('0x30')],_0x4d6151[_0xc98f('0x31')]);_0x4eb836['attributes']=_[_0xc98f('0x35')](_0x4d6151['model'],qs[_0xc98f('0x36')](_0x55ab40[_0xc98f('0x31')][_0xc98f('0x36')]));_0x4eb836['attributes']=_0x4eb836['attributes'][_0xc98f('0x37')]?_0x4eb836[_0xc98f('0x34')]:_0x4d6151['model'];if(_0x55ab40['query'][_0xc98f('0x42')]){_0x4eb836[_0xc98f('0x43')]=[{'all':!![]}];}_0x4eb836=_[_0xc98f('0x3f')]({},_0x4eb836,_0x55ab40[_0xc98f('0x48')]);return db['ChatTransferReport'][_0xc98f('0x49')](_0x4eb836)[_0xc98f('0x25')](handleEntityNotFound(_0x56e3a5,null))[_0xc98f('0x25')](respondWithResult(_0x56e3a5,null))['catch'](handleError(_0x56e3a5,null));};exports['create']=function(_0x4c9d4d,_0x49d9fd){return db[_0xc98f('0x41')][_0xc98f('0x4a')](_0x4c9d4d[_0xc98f('0x4b')],{})[_0xc98f('0x25')](respondWithResult(_0x49d9fd,0xc9))[_0xc98f('0x46')](handleError(_0x49d9fd,null));};exports[_0xc98f('0x24')]=function(_0x79cc5b,_0x361829){if(_0x79cc5b[_0xc98f('0x4b')]['id']){delete _0x79cc5b[_0xc98f('0x4b')]['id'];}return db[_0xc98f('0x41')][_0xc98f('0x49')]({'where':{'id':_0x79cc5b[_0xc98f('0x47')]['id']}})[_0xc98f('0x25')](handleEntityNotFound(_0x361829,null))[_0xc98f('0x25')](saveUpdates(_0x79cc5b['body'],null))['then'](respondWithResult(_0x361829,null))[_0xc98f('0x46')](handleError(_0x361829,null));};exports[_0xc98f('0x26')]=function(_0x2f034c,_0x1826c3){return db['ChatTransferReport']['find']({'where':{'id':_0x2f034c[_0xc98f('0x47')]['id']}})['then'](handleEntityNotFound(_0x1826c3,null))['then'](removeEntity(_0x1826c3,null))[_0xc98f('0x46')](handleError(_0x1826c3,null));};exports['describe']=function(_0x2145fa,_0x3a357e){return db[_0xc98f('0x41')][_0xc98f('0x4c')]()[_0xc98f('0x25')](respondWithResult(_0x3a357e,null))['catch'](handleError(_0x3a357e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f779d97..7ea8f4c 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 _0xb88c=['../../config/logger','api','moment','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util'];(function(_0x4d77d0,_0x2f91a0){var _0x2f4699=function(_0x4dcc6c){while(--_0x4dcc6c){_0x4d77d0['push'](_0x4d77d0['shift']());}};_0x2f4699(++_0x2f91a0);}(_0xb88c,0x184));var _0xcb88=function(_0x4cc79a,_0xf85adc){_0x4cc79a=_0x4cc79a-0x0;var _0x176af9=_0xb88c[_0x4cc79a];return _0x176af9;};'use strict';var _=require(_0xcb88('0x0'));var util=require(_0xcb88('0x1'));var logger=require(_0xcb88('0x2'))(_0xcb88('0x3'));var moment=require(_0xcb88('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb88('0x5'));var rimraf=require(_0xcb88('0x6'));var config=require(_0xcb88('0x7'));var attributes=require(_0xcb88('0x8'));module[_0xcb88('0x9')]=function(_0x4cbc29,_0x7d1911){return _0x4cbc29[_0xcb88('0xa')]('ChatTransferReport',attributes,{'tableName':_0xcb88('0xb'),'paranoid':![],'indexes':[{'name':_0xcb88('0xc'),'fields':[_0xcb88('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb4d=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x1d5f05,_0x123c33){var _0x3c61e6=function(_0x4d07ac){while(--_0x4d07ac){_0x1d5f05['push'](_0x1d5f05['shift']());}};_0x3c61e6(++_0x123c33);}(_0xfb4d,0x12e));var _0xdfb4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xfb4d[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xdfb4('0x0'));var util=require(_0xdfb4('0x1'));var logger=require(_0xdfb4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdfb4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdfb4('0x4'));var attributes=require(_0xdfb4('0x5'));module[_0xdfb4('0x6')]=function(_0xf65513,_0x110da1){return _0xf65513[_0xdfb4('0x7')]('ChatTransferReport',attributes,{'tableName':_0xdfb4('0x8'),'paranoid':![],'indexes':[{'name':_0xdfb4('0x9'),'fields':[_0xdfb4('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index eca21d7..706bd4a 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 _0x16c7=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x16c7,0x113));var _0x716c=function(_0x5dfd07,_0xcf57d6){_0x5dfd07=_0x5dfd07-0x0;var _0x484fb0=_0x16c7[_0x5dfd07];return _0x484fb0;};'use strict';var _=require(_0x716c('0x0'));var util=require(_0x716c('0x1'));var moment=require(_0x716c('0x2'));var BPromise=require(_0x716c('0x3'));var rs=require(_0x716c('0x4'));var fs=require('fs');var Redis=require(_0x716c('0x5'));var db=require(_0x716c('0x6'))['db'];var utils=require(_0x716c('0x7'));var logger=require(_0x716c('0x8'))('rpc');var config=require(_0x716c('0x9'));var jayson=require(_0x716c('0xa'));var client=jayson[_0x716c('0xb')][_0x716c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55eeef,_0x2adb92,_0x22901a){return new BPromise(function(_0xb50ced,_0x39b4a8){return client[_0x716c('0xd')](_0x55eeef,_0x22901a)['then'](function(_0x294a5d){logger[_0x716c('0xe')](_0x716c('0xf'),_0x2adb92,_0x716c('0x10'));logger[_0x716c('0x11')](_0x716c('0x12'),_0x2adb92,_0x716c('0x10'),JSON[_0x716c('0x13')](_0x294a5d));if(_0x294a5d[_0x716c('0x14')]){if(_0x294a5d['error'][_0x716c('0x15')]===0x1f4){logger[_0x716c('0x14')](_0x716c('0xf'),_0x2adb92,_0x294a5d[_0x716c('0x14')]['message']);return _0x39b4a8(_0x294a5d[_0x716c('0x14')][_0x716c('0x16')]);}logger[_0x716c('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x2adb92,_0x294a5d[_0x716c('0x14')][_0x716c('0x16')]);return _0xb50ced(_0x294a5d[_0x716c('0x14')]['message']);}else{logger[_0x716c('0xe')](_0x716c('0xf'),_0x2adb92,_0x716c('0x10'));_0xb50ced(_0x294a5d[_0x716c('0x17')]['message']);}})[_0x716c('0x18')](function(_0xe0bb4f){logger[_0x716c('0x14')](_0x716c('0xf'),_0x2adb92,_0xe0bb4f);_0x39b4a8(_0xe0bb4f);});});} \ No newline at end of file +var _0xec73=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring'];(function(_0x1da281,_0x2f0276){var _0x281637=function(_0x120088){while(--_0x120088){_0x1da281['push'](_0x1da281['shift']());}};_0x281637(++_0x2f0276);}(_0xec73,0x1e0));var _0x3ec7=function(_0x27d474,_0x5cf3fe){_0x27d474=_0x27d474-0x0;var _0x514e1a=_0xec73[_0x27d474];return _0x514e1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ec7('0x0'));var BPromise=require(_0x3ec7('0x1'));var rs=require(_0x3ec7('0x2'));var fs=require('fs');var Redis=require(_0x3ec7('0x3'));var db=require(_0x3ec7('0x4'))['db'];var utils=require(_0x3ec7('0x5'));var logger=require(_0x3ec7('0x6'))('rpc');var config=require(_0x3ec7('0x7'));var jayson=require(_0x3ec7('0x8'));var client=jayson[_0x3ec7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9835,_0x351382,_0x3e78bb){return new BPromise(function(_0x533bef,_0x1ef425){return client[_0x3ec7('0xa')](_0x2c9835,_0x3e78bb)['then'](function(_0x19bee6){logger[_0x3ec7('0xb')](_0x3ec7('0xc'),_0x351382,'request\x20sent');logger[_0x3ec7('0xd')](_0x3ec7('0xe'),_0x351382,_0x3ec7('0xf'),JSON[_0x3ec7('0x10')](_0x19bee6));if(_0x19bee6['error']){if(_0x19bee6[_0x3ec7('0x11')][_0x3ec7('0x12')]===0x1f4){logger[_0x3ec7('0x11')](_0x3ec7('0xc'),_0x351382,_0x19bee6[_0x3ec7('0x11')][_0x3ec7('0x13')]);return _0x1ef425(_0x19bee6['error'][_0x3ec7('0x13')]);}logger[_0x3ec7('0x11')](_0x3ec7('0xc'),_0x351382,_0x19bee6[_0x3ec7('0x11')][_0x3ec7('0x13')]);return _0x533bef(_0x19bee6[_0x3ec7('0x11')]['message']);}else{logger[_0x3ec7('0xb')](_0x3ec7('0xc'),_0x351382,_0x3ec7('0xf'));_0x533bef(_0x19bee6[_0x3ec7('0x14')][_0x3ec7('0x13')]);}})['catch'](function(_0x4d341c){logger['error'](_0x3ec7('0xc'),_0x351382,_0x4d341c);_0x1ef425(_0x4d341c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 950ba9e..df96637 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 _0xfc3f=['post','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','describe','/:id','isAuthenticated'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xfc3f,0x93));var _0xffc3=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xfc3f[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require(_0xffc3('0x0'));var util=require(_0xffc3('0x1'));var path=require(_0xffc3('0x2'));var timeout=require(_0xffc3('0x3'));var express=require(_0xffc3('0x4'));var router=express[_0xffc3('0x5')]();var fs_extra=require(_0xffc3('0x6'));var auth=require(_0xffc3('0x7'));var interaction=require(_0xffc3('0x8'));var config=require(_0xffc3('0x9'));var controller=require(_0xffc3('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xffc3('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xffc3('0xc')]);router['get'](_0xffc3('0xd'),auth[_0xffc3('0xe')](),controller['show']);router[_0xffc3('0xf')]('/',auth[_0xffc3('0xe')](),controller['create']);router['put'](_0xffc3('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xffc3('0xd'),auth['isAuthenticated'](),controller[_0xffc3('0x10')]);module[_0xffc3('0x11')]=router; \ No newline at end of file +var _0xd2de=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x271462,_0x31e262){var _0x2b4415=function(_0xe72fa5){while(--_0xe72fa5){_0x271462['push'](_0x271462['shift']());}};_0x2b4415(++_0x31e262);}(_0xd2de,0x1bd));var _0xed2d=function(_0x31f436,_0x1caade){_0x31f436=_0x31f436-0x0;var _0x3bc870=_0xd2de[_0x31f436];return _0x3bc870;};'use strict';var multer=require(_0xed2d('0x0'));var util=require('util');var path=require(_0xed2d('0x1'));var timeout=require(_0xed2d('0x2'));var express=require(_0xed2d('0x3'));var router=express[_0xed2d('0x4')]();var fs_extra=require(_0xed2d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed2d('0x6'));var config=require(_0xed2d('0x7'));var controller=require('./chatTransferReport.controller');router[_0xed2d('0x8')]('/',auth[_0xed2d('0x9')](),controller['index']);router['get']('/describe',auth[_0xed2d('0x9')](),controller['describe']);router[_0xed2d('0x8')](_0xed2d('0xa'),auth[_0xed2d('0x9')](),controller[_0xed2d('0xb')]);router[_0xed2d('0xc')]('/',auth['isAuthenticated'](),controller[_0xed2d('0xd')]);router['put'](_0xed2d('0xa'),auth[_0xed2d('0x9')](),controller['update']);router[_0xed2d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xed2d('0xf')]);module[_0xed2d('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a1283d2..3d0e6ca 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 _0x4522=['mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','email','Agent','#011F6A','#ffffff','rounded','squared','We\x20are\x20here!','Chat','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Send','Feedback','ENUM','star','INTEGER','input','name','text','getDataValue','onlineForm','parse','stringify','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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.','website_alias','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4522,0x1a0));var _0x2452=function(_0x7582e6,_0x11c49b){_0x7582e6=_0x7582e6-0x0;var _0x2edfc3=_0x4522[_0x7582e6];return _0x2edfc3;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x2452('0x0')]={'name':{'type':Sequelize[_0x2452('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x2452('0x1')]},'mapKey':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x2')},'mapKeyOffline':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x2')},'key':{'type':Sequelize[_0x2452('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x3')},'customerAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2452('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x2452('0x6'),_0x2452('0x7')),'defaultValue':_0x2452('0x6')},'header_online':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x8')},'start_chat_button':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x9')},'offline_chat_button':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2452('0xb')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0xc')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0xd')},'formSubmitFailureMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0xe')},'noteTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0xf')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x10')},'skipMessageButton':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x11')},'ratingType':{'type':Sequelize[_0x2452('0x12')](_0x2452('0x13'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x2452('0x14')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2452('0x15'),'variable':null,'config':{'placeholder':_0x2452('0x16'),'type':_0x2452('0x17'),'required':!![]},'props':{'title':_0x2452('0x16'),'helpText':''}},{'type':_0x2452('0x15'),'props':{'title':_0x2452('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x2452('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2452('0x18')](_0x2452('0x19'))?JSON[_0x2452('0x1a')](this[_0x2452('0x18')](_0x2452('0x19'))):{};},'set':function(_0x516fcf){return this['setDataValue'](_0x2452('0x19'),JSON[_0x2452('0x1b')](_0x516fcf));}},'offlineForm':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return JSON[_0x2452('0x1b')]({'items':[{'type':_0x2452('0x15'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2452('0x2'),'type':_0x2452('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x2452('0x1c'),'helpText':_0x2452('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0x2452('0x18')](_0x2452('0x1e'))?JSON[_0x2452('0x1a')](this[_0x2452('0x18')]('offlineForm')):{};},'set':function(_0x5da9aa){return this[_0x2452('0x1f')](_0x2452('0x1e'),JSON[_0x2452('0x1b')](_0x5da9aa));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2452('0x20')]();}},'autoclose':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2452('0x1')]},'forwardOffline':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2452('0x1')]},'waitingTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x21')},'waitingMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x23')},'offlineMessageBody':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0x25')},'skipUnmanaged':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2452('0x1')]},'notificationTemplate':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x27')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x28')},'defaultTitle':{'type':Sequelize[_0x2452('0x1')]},'customerAvatar':{'type':Sequelize[_0x2452('0xb')]},'showCustomerAvatar':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x2452('0xb')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2452('0x14')],'comment':_0x2452('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![],'comment':_0x2452('0x2a'),'set':function(_0x112849){if(!_0x112849)this[_0x2452('0x1f')](_0x2452('0x2b'),null);this['setDataValue'](_0x2452('0x2c'),_0x112849);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2452('0x1')]},'vidaooTopic':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x2452('0x1')],'defaultValue':function(){return _0x2452('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x2452('0xb')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2452('0xb')]}}; \ No newline at end of file +var _0xb43b=['setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','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:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','TEXT','input','name','getDataValue','onlineForm'];(function(_0x577788,_0x42e5c9){var _0x30296d=function(_0x5b5b25){while(--_0x5b5b25){_0x577788['push'](_0x577788['shift']());}};_0x30296d(++_0x42e5c9);}(_0xb43b,0x1b2));var _0xbb43=function(_0x598bb8,_0x4b2536){_0x598bb8=_0x598bb8-0x0;var _0x9d36d8=_0xb43b[_0x598bb8];return _0x9d36d8;};'use strict';var Sequelize=require(_0xbb43('0x0'));var rs=require(_0xbb43('0x1'));module['exports']={'name':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![],'unique':_0xbb43('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x4')},'mapKeyOffline':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbb43('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![],'defaultValue':_0xbb43('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![],'defaultValue':_0xbb43('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![],'defaultValue':_0xbb43('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbb43('0x2')]},'animation':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbb43('0x9')](_0xbb43('0xa'),_0xbb43('0xb')),'defaultValue':_0xbb43('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xbb43('0xc')},'start_chat_button':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbb43('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xbb43('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbb43('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x11')},'closingMessage':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x13')},'ratingType':{'type':Sequelize['ENUM'](_0xbb43('0x14'),'thumb'),'defaultValue':_0xbb43('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbb43('0x15')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xbb43('0x16'),'variable':null,'config':{'placeholder':_0xbb43('0x17'),'type':'text','required':!![]},'props':{'title':_0xbb43('0x17'),'helpText':''}},{'type':'input','props':{'title':_0xbb43('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb43('0x4'),'type':_0xbb43('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this[_0xbb43('0x18')](_0xbb43('0x19'))):{};},'set':function(_0x5d8310){return this[_0xbb43('0x1a')](_0xbb43('0x19'),JSON[_0xbb43('0x1b')](_0x5d8310));}},'offlineForm':{'type':Sequelize[_0xbb43('0x15')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xbb43('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb43('0x4'),'type':_0xbb43('0x4')},'variable':null},{'type':_0xbb43('0x1c'),'config':{'placeholder':_0xbb43('0x1d')},'props':{'title':_0xbb43('0x1d'),'helpText':_0xbb43('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xbb43('0x18')]('offlineForm')?JSON[_0xbb43('0x1f')](this['getDataValue'](_0xbb43('0x20'))):{};},'set':function(_0x436fd5){return this[_0xbb43('0x1a')](_0xbb43('0x20'),JSON['stringify'](_0x436fd5));}},'token':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbb43('0x2')]},'waitingTitle':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x22')},'offlineMessageBody':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x12')},'sendUnmanaged':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbb43('0x15')]},'showAgentAvatar':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbb43('0x2')]},'notificationTemplate':{'type':Sequelize[_0xbb43('0x15')],'defaultValue':function(){return _0xbb43('0x24');}},'notificationSound':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x25')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x26')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x27')},'messagesAlignment':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbb43('0x28')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb43('0x28')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbb43('0x28')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xbb43('0x15')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb43('0x28')],'comment':_0xbb43('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xbb43('0x8')],'defaultValue':![],'comment':_0xbb43('0x2a'),'set':function(_0x531d96){if(!_0x531d96)this[_0xbb43('0x1a')]('mandatoryDispositionPauseId',null);this[_0xbb43('0x1a')](_0xbb43('0x2b'),_0x531d96);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbb43('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbb43('0x2c')},'vidaooNote':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':function(){return _0xbb43('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0xbb43('0x15')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xbb43('0x15')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 97a1dc7..8fc1152 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 _0xbc72=['json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','intersection','include','create','body','user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','map','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','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','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','Start','startRouting','EventManager','offline','files','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','defaults','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','basename','openNewInteraction','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','Smtp','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','server','attachments','offline-chat','remove','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','increment','chatLicenseExceeded','Intervals','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','priority','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','onlineForm','items','getOfflineMessages','Contact','Attachment','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','lodash','querystring','ioredis','../../config/logger','api','redis','localhost','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xbc72,0x107));var _0x2bc7=function(_0x52eba1,_0x1c5ebe){_0x52eba1=_0x52eba1-0x0;var _0x243049=_0xbc72[_0x52eba1];return _0x243049;};'use strict';var BPromise=require(_0x2bc7('0x0'));var Mustache=require('mustache');var util=require(_0x2bc7('0x1'));var path=require(_0x2bc7('0x2'));var ejs=require(_0x2bc7('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2bc7('0x4'));var querystring=require(_0x2bc7('0x5'));var Redis=require(_0x2bc7('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x2bc7('0x7'))(_0x2bc7('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2bc7('0x9')]=_['defaults'](config['redis'],{'host':_0x2bc7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bc7('0x9')]));require(_0x2bc7('0xb'))[_0x2bc7('0xc')](socket);var htmlToText=require(_0x2bc7('0xd'));var jayson=require(_0x2bc7('0xe'));var client=jayson[_0x2bc7('0xf')][_0x2bc7('0x10')]({'port':0x232c});var client9002=jayson[_0x2bc7('0xf')][_0x2bc7('0x10')]({'port':0x232a});var client9003=jayson['client'][_0x2bc7('0x10')]({'port':0x232b});var client9001=jayson[_0x2bc7('0xf')]['http']({'port':0x2329});function respondWithRpcPromise(_0x31855a,_0x29ab3f,_0x24f718,_0x445db4){return new BPromise(function(_0x52a107,_0x538ffd){var _0x5bf209=_0x445db4||client;return _0x5bf209['request'](_0x31855a,_0x24f718)[_0x2bc7('0x11')](function(_0x2ffe0c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x29ab3f,_0x2bc7('0x12'));logger[_0x2bc7('0x13')](_0x2bc7('0x14'),_0x29ab3f,_0x2bc7('0x12'),JSON[_0x2bc7('0x15')](_0x2ffe0c));if(_0x2ffe0c[_0x2bc7('0x16')]){if(_0x2ffe0c[_0x2bc7('0x16')][_0x2bc7('0x17')]===0x1f4){logger[_0x2bc7('0x16')](_0x2bc7('0x18'),_0x29ab3f,_0x2ffe0c[_0x2bc7('0x16')][_0x2bc7('0x19')]);return _0x538ffd(_0x2ffe0c['error']['message']);}logger[_0x2bc7('0x16')](_0x2bc7('0x18'),_0x29ab3f,_0x2ffe0c['error'][_0x2bc7('0x19')]);return _0x52a107(_0x2ffe0c['error'][_0x2bc7('0x19')]);}else{logger['info'](_0x2bc7('0x18'),_0x29ab3f,_0x2bc7('0x12'));_0x52a107(_0x2ffe0c[_0x2bc7('0x1a')][_0x2bc7('0x19')]);}})[_0x2bc7('0x1b')](function(_0x1aaf9e){logger[_0x2bc7('0x16')](_0x2bc7('0x18'),_0x29ab3f,_0x1aaf9e);_0x538ffd(_0x1aaf9e);});});}function respondWithStatusCode(_0xd7cd74,_0x513688){_0x513688=_0x513688||0xcc;return function(_0x49c5c8){if(_0x49c5c8){return _0xd7cd74[_0x2bc7('0x1c')](_0x513688);}return _0xd7cd74[_0x2bc7('0x1d')](_0x513688)[_0x2bc7('0x1e')]();};}function respondWithResult(_0x3e4055,_0xecb48e){_0xecb48e=_0xecb48e||0xc8;return function(_0x351e27){if(_0x351e27){return _0x3e4055[_0x2bc7('0x1d')](_0xecb48e)[_0x2bc7('0x1f')](_0x351e27);}};}function respondWithFilteredResult(_0x1f99d3,_0x732e33){return function(_0x3b5448){if(_0x3b5448){var _0x5c71d3=typeof _0x732e33[_0x2bc7('0x20')]===_0x2bc7('0x21')&&typeof _0x732e33[_0x2bc7('0x22')]===_0x2bc7('0x21');var _0x14f081=_0x3b5448[_0x2bc7('0x23')];var _0x20278b=_0x5c71d3?0x0:_0x732e33[_0x2bc7('0x20')];var _0x13100a=_0x5c71d3?_0x3b5448[_0x2bc7('0x23')]:_0x732e33[_0x2bc7('0x20')]+_0x732e33[_0x2bc7('0x22')];var _0xf96f90;if(_0x13100a>=_0x14f081){_0x13100a=_0x14f081;_0xf96f90=0xc8;}else{_0xf96f90=0xce;}_0x1f99d3[_0x2bc7('0x1d')](_0xf96f90);return _0x1f99d3[_0x2bc7('0x24')](_0x2bc7('0x25'),_0x20278b+'-'+_0x13100a+'/'+_0x14f081)[_0x2bc7('0x1f')](_0x3b5448);}return null;};}function saveUpdates(_0x15eb30){return function(_0x1b3305){if(_0x1b3305){return _0x1b3305[_0x2bc7('0x26')](_0x15eb30)[_0x2bc7('0x11')](function(_0xcb557a){return _0xcb557a;});}return null;};}function removeEntity(_0x13de58){return function(_0x1a52e5){if(_0x1a52e5){return _0x1a52e5[_0x2bc7('0x27')]()[_0x2bc7('0x11')](function(){var _0x3f0e7f=_0x1a52e5[_0x2bc7('0x28')]({'plain':!![]});var _0x2c8c34=_0x2bc7('0x29');return db[_0x2bc7('0x2a')][_0x2bc7('0x27')]({'where':{'type':_0x2c8c34,'resourceId':_0x3f0e7f['id']}})[_0x2bc7('0x11')](function(){return _0x1a52e5;});})[_0x2bc7('0x11')](function(){_0x13de58[_0x2bc7('0x1d')](0xcc)[_0x2bc7('0x1e')]();});}};}function handleEntityNotFound(_0x5d4c1a){return function(_0x45fb5d){if(!_0x45fb5d){_0x5d4c1a['sendStatus'](0x194);}return _0x45fb5d;};}function handleError(_0x215bdf,_0x43ab41){_0x43ab41=_0x43ab41||0x1f4;return function(_0x324890){logger[_0x2bc7('0x16')](_0x324890[_0x2bc7('0x2b')]);if(_0x324890['name']){delete _0x324890[_0x2bc7('0x2c')];}_0x215bdf[_0x2bc7('0x1d')](_0x43ab41)[_0x2bc7('0x2d')](_0x324890);};}exports['index']=function(_0xaf7adf,_0x43be55){var _0x34d556={'include':[{'model':db[_0x2bc7('0x2e')],'as':_0x2bc7('0x2f')}]},_0x546752={},_0x2a9cea={'count':0x0,'rows':[]};var _0x2d03f3=_['map'](db[_0x2bc7('0x30')][_0x2bc7('0x31')],function(_0x12d19e){return{'name':_0x12d19e[_0x2bc7('0x32')],'type':_0x12d19e[_0x2bc7('0x33')][_0x2bc7('0x34')]};});_0x546752[_0x2bc7('0x35')]=_['map'](_0x2d03f3,_0x2bc7('0x2c'));_0x546752[_0x2bc7('0x36')]=_['keys'](_0xaf7adf[_0x2bc7('0x36')]);_0x546752['filters']=_['intersection'](_0x546752[_0x2bc7('0x35')],_0x546752[_0x2bc7('0x36')]);_0x34d556[_0x2bc7('0x37')]=_['intersection'](_0x546752[_0x2bc7('0x35')],qs['fields'](_0xaf7adf[_0x2bc7('0x36')][_0x2bc7('0x38')]));_0x34d556[_0x2bc7('0x37')]=_0x34d556[_0x2bc7('0x37')][_0x2bc7('0x39')]?_0x34d556[_0x2bc7('0x37')]:_0x546752['model'];if(!_0xaf7adf[_0x2bc7('0x36')][_0x2bc7('0x3a')](_0x2bc7('0x3b'))){_0x34d556[_0x2bc7('0x22')]=qs[_0x2bc7('0x22')](_0xaf7adf[_0x2bc7('0x36')][_0x2bc7('0x22')]);_0x34d556[_0x2bc7('0x20')]=qs['offset'](_0xaf7adf[_0x2bc7('0x36')][_0x2bc7('0x20')]);}_0x34d556[_0x2bc7('0x3c')]=qs[_0x2bc7('0x3d')](_0xaf7adf[_0x2bc7('0x36')][_0x2bc7('0x3d')]);_0x34d556[_0x2bc7('0x3e')]=qs[_0x2bc7('0x3f')](_[_0x2bc7('0x40')](_0xaf7adf[_0x2bc7('0x36')],_0x546752[_0x2bc7('0x3f')]),_0x2d03f3);if(_0xaf7adf[_0x2bc7('0x36')][_0x2bc7('0x41')]){_0x34d556['where']=_[_0x2bc7('0x42')](_0x34d556[_0x2bc7('0x3e')],{'$or':_['map'](_0x2d03f3,function(_0x3b45e7){if(_0x3b45e7[_0x2bc7('0x33')]!==_0x2bc7('0x43')){var _0xc9b923={};_0xc9b923[_0x3b45e7[_0x2bc7('0x2c')]]={'$like':'%'+_0xaf7adf['query'][_0x2bc7('0x41')]+'%'};return _0xc9b923;}})});}_0x34d556=_[_0x2bc7('0x42')]({},_0x34d556,_0xaf7adf[_0x2bc7('0x44')]);var _0x39d8ee={'where':_0x34d556[_0x2bc7('0x3e')]};return db[_0x2bc7('0x30')][_0x2bc7('0x23')](_0x39d8ee)[_0x2bc7('0x11')](function(_0x7fc6e2){_0x2a9cea[_0x2bc7('0x23')]=_0x7fc6e2;if(_0xaf7adf[_0x2bc7('0x36')][_0x2bc7('0x45')]){_0x34d556['include']=[{'all':!![]}];}return db[_0x2bc7('0x30')][_0x2bc7('0x46')](_0x34d556);})[_0x2bc7('0x11')](function(_0xbffa00){_0x2a9cea[_0x2bc7('0x47')]=_0xbffa00;return _0x2a9cea;})[_0x2bc7('0x11')](respondWithFilteredResult(_0x43be55,_0x34d556))['catch'](handleError(_0x43be55,null));};exports['show']=function(_0x180a31,_0x112d05){var _0x543519={'raw':![],'where':{'id':_0x180a31[_0x2bc7('0x48')]['id']},'include':[{'model':db[_0x2bc7('0x2e')],'as':_0x2bc7('0x2f')}]},_0x3a217c={};_0x3a217c[_0x2bc7('0x35')]=_[_0x2bc7('0x49')](db[_0x2bc7('0x30')][_0x2bc7('0x31')]);_0x3a217c[_0x2bc7('0x36')]=_['keys'](_0x180a31[_0x2bc7('0x36')]);_0x3a217c[_0x2bc7('0x3f')]=_['intersection'](_0x3a217c['model'],_0x3a217c['query']);_0x543519[_0x2bc7('0x37')]=_[_0x2bc7('0x4a')](_0x3a217c[_0x2bc7('0x35')],qs['fields'](_0x180a31['query'][_0x2bc7('0x38')]));_0x543519[_0x2bc7('0x37')]=_0x543519[_0x2bc7('0x37')][_0x2bc7('0x39')]?_0x543519[_0x2bc7('0x37')]:_0x3a217c[_0x2bc7('0x35')];if(_0x180a31[_0x2bc7('0x36')][_0x2bc7('0x45')]){_0x543519[_0x2bc7('0x4b')]=[{'all':!![]}];}_0x543519=_[_0x2bc7('0x42')]({},_0x543519,_0x180a31[_0x2bc7('0x44')]);return db[_0x2bc7('0x30')]['find'](_0x543519)['then'](handleEntityNotFound(_0x112d05,null))[_0x2bc7('0x11')](respondWithResult(_0x112d05,null))[_0x2bc7('0x1b')](handleError(_0x112d05,null));};exports[_0x2bc7('0x4c')]=function(_0x398f20,_0x351fad){return db['ChatWebsite'][_0x2bc7('0x4c')](_0x398f20[_0x2bc7('0x4d')],{})[_0x2bc7('0x11')](function(_0x436ec2){var _0x5291e1=_0x398f20[_0x2bc7('0x4e')][_0x2bc7('0x28')]({'plain':!![]});if(!_0x5291e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5291e1[_0x2bc7('0x4f')]===_0x2bc7('0x4e')){var _0x1853c0=_0x436ec2['get']({'plain':!![]});var _0x55f7ad='ChatWebsites';return db[_0x2bc7('0x50')][_0x2bc7('0x51')]({'where':{'name':_0x55f7ad,'userProfileId':_0x5291e1['userProfileId']},'raw':!![]})[_0x2bc7('0x11')](function(_0x302663){if(_0x302663&&_0x302663['autoAssociation']===0x0){return db['UserProfileResource'][_0x2bc7('0x4c')]({'name':_0x1853c0[_0x2bc7('0x2c')],'resourceId':_0x1853c0['id'],'type':_0x302663[_0x2bc7('0x2c')],'sectionId':_0x302663['id']},{})['then'](function(){return _0x436ec2;});}else{return _0x436ec2;}})[_0x2bc7('0x1b')](function(_0x1ad36e){logger[_0x2bc7('0x16')](_0x2bc7('0x52'),_0x1ad36e);throw _0x1ad36e;});}return _0x436ec2;})['then'](respondWithResult(_0x351fad,0xc9))[_0x2bc7('0x1b')](handleError(_0x351fad,null));};exports[_0x2bc7('0x26')]=function(_0x446c91,_0x2b1ddd){if(_0x446c91[_0x2bc7('0x4d')]['id']){delete _0x446c91['body']['id'];}return db['ChatWebsite'][_0x2bc7('0x51')]({'where':{'id':_0x446c91[_0x2bc7('0x48')]['id']},'include':[{'model':db[_0x2bc7('0x2e')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2b1ddd,null))[_0x2bc7('0x11')](saveUpdates(_0x446c91[_0x2bc7('0x4d')],null))[_0x2bc7('0x11')](respondWithResult(_0x2b1ddd,null))[_0x2bc7('0x1b')](handleError(_0x2b1ddd,null));};exports[_0x2bc7('0x27')]=function(_0x401bba,_0x52bdec){return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x401bba[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x52bdec,null))[_0x2bc7('0x11')](removeEntity(_0x52bdec,null))[_0x2bc7('0x1b')](handleError(_0x52bdec,null));};exports[_0x2bc7('0x53')]=function(_0x1102c5,_0x563fc0){return db['ChatWebsite']['describe']()[_0x2bc7('0x11')](respondWithResult(_0x563fc0,null))['catch'](handleError(_0x563fc0,null));};exports[_0x2bc7('0x54')]=function(_0x3dc770,_0x4dcb3d){if(_0x3dc770[_0x2bc7('0x4d')]['id']){delete _0x3dc770[_0x2bc7('0x4d')]['id'];}return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x3dc770['params']['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x4dcb3d,null))[_0x2bc7('0x11')](function(_0x1e95a0){if(_0x1e95a0){_0x3dc770[_0x2bc7('0x4d')][_0x2bc7('0x55')]=_0x1e95a0['id'];return db[_0x2bc7('0x56')]['create'](_0x3dc770[_0x2bc7('0x4d')]);}})[_0x2bc7('0x11')](respondWithResult(_0x4dcb3d,null))['catch'](handleError(_0x4dcb3d,null));};exports['getDispositions']=function(_0x36f1e2,_0x4120ea){var _0x330d38={'raw':![],'where':{}};var _0x154708={};var _0x935c88={'count':0x0,'rows':[]};return db[_0x2bc7('0x30')][_0x2bc7('0x57')]({'where':{'id':_0x36f1e2[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x4120ea,null))[_0x2bc7('0x11')](function(_0x34c3e4){if(_0x34c3e4){_0x154708[_0x2bc7('0x35')]=_[_0x2bc7('0x49')](db[_0x2bc7('0x56')][_0x2bc7('0x31')]);_0x154708[_0x2bc7('0x36')]=_['keys'](_0x36f1e2[_0x2bc7('0x36')]);_0x154708[_0x2bc7('0x3f')]=_[_0x2bc7('0x4a')](_0x154708[_0x2bc7('0x35')],_0x154708['query']);_0x330d38[_0x2bc7('0x37')]=_[_0x2bc7('0x4a')](_0x154708[_0x2bc7('0x35')],qs[_0x2bc7('0x38')](_0x36f1e2['query'][_0x2bc7('0x38')]));_0x330d38['attributes']=_0x330d38['attributes'][_0x2bc7('0x39')]?_0x330d38[_0x2bc7('0x37')]:_0x154708[_0x2bc7('0x35')];if(!_0x36f1e2['query'][_0x2bc7('0x3a')](_0x2bc7('0x3b'))){_0x330d38[_0x2bc7('0x22')]=qs[_0x2bc7('0x22')](_0x36f1e2['query'][_0x2bc7('0x22')]);_0x330d38[_0x2bc7('0x20')]=qs[_0x2bc7('0x20')](_0x36f1e2[_0x2bc7('0x36')][_0x2bc7('0x20')]);}_0x330d38[_0x2bc7('0x3c')]=qs[_0x2bc7('0x3d')](_0x36f1e2[_0x2bc7('0x36')][_0x2bc7('0x3d')]);_0x330d38[_0x2bc7('0x3e')]=qs[_0x2bc7('0x3f')](_[_0x2bc7('0x40')](_0x36f1e2[_0x2bc7('0x36')],_0x154708[_0x2bc7('0x3f')]));_0x330d38[_0x2bc7('0x3e')][_0x2bc7('0x55')]=_0x34c3e4['id'];if(_0x36f1e2[_0x2bc7('0x36')][_0x2bc7('0x41')]){_0x330d38[_0x2bc7('0x3e')]=_['merge'](_0x330d38['where'],{'$or':_[_0x2bc7('0x58')](_0x330d38[_0x2bc7('0x37')],function(_0x1b5c7c){var _0x10788f={};_0x10788f[_0x1b5c7c]={'$like':'%'+_0x36f1e2[_0x2bc7('0x36')][_0x2bc7('0x41')]+'%'};return _0x10788f;})});}_0x330d38=_['merge']({},_0x330d38,_0x36f1e2[_0x2bc7('0x44')]);return db[_0x2bc7('0x56')][_0x2bc7('0x23')]({'where':_0x330d38[_0x2bc7('0x3e')]})[_0x2bc7('0x11')](function(_0x397c71){_0x935c88[_0x2bc7('0x23')]=_0x397c71;if(_0x36f1e2[_0x2bc7('0x36')]['includeAll']){_0x330d38[_0x2bc7('0x4b')]=[{'all':!![]}];}return db[_0x2bc7('0x56')][_0x2bc7('0x46')](_0x330d38);})['then'](function(_0x9fb4b8){_0x935c88[_0x2bc7('0x47')]=_0x9fb4b8;return _0x935c88;});}})[_0x2bc7('0x11')](respondWithFilteredResult(_0x4120ea,_0x330d38))[_0x2bc7('0x1b')](handleError(_0x4120ea,null));};exports[_0x2bc7('0x59')]=function(_0x25dfb0,_0x2ddb6d){return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x25dfb0[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x2ddb6d,null))[_0x2bc7('0x11')](function(_0x3fa3ba){if(_0x3fa3ba){return _0x3fa3ba[_0x2bc7('0x59')](_0x25dfb0['query'][_0x2bc7('0x5a')]);}})[_0x2bc7('0x11')](respondWithStatusCode(_0x2ddb6d,null))[_0x2bc7('0x1b')](handleError(_0x2ddb6d,null));};exports['addAnswer']=function(_0x35f8a6,_0xa53711){if(_0x35f8a6[_0x2bc7('0x4d')]['id']){delete _0x35f8a6[_0x2bc7('0x4d')]['id'];}return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x35f8a6[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0xa53711,null))[_0x2bc7('0x11')](function(_0x5c03b9){if(_0x5c03b9){_0x35f8a6[_0x2bc7('0x4d')][_0x2bc7('0x55')]=_0x5c03b9['id'];return db[_0x2bc7('0x5b')][_0x2bc7('0x4c')](_0x35f8a6[_0x2bc7('0x4d')]);}})[_0x2bc7('0x11')](respondWithResult(_0xa53711,null))['catch'](handleError(_0xa53711,null));};exports[_0x2bc7('0x5c')]=function(_0x1685ee,_0x560043){var _0x14fe18={'raw':![],'where':{}};var _0x163dbb={};var _0x486b71={'count':0x0,'rows':[]};return db[_0x2bc7('0x30')]['findOne']({'where':{'id':_0x1685ee[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x560043,null))[_0x2bc7('0x11')](function(_0x3da399){if(_0x3da399){_0x163dbb['model']=_[_0x2bc7('0x49')](db[_0x2bc7('0x5b')][_0x2bc7('0x31')]);_0x163dbb[_0x2bc7('0x36')]=_['keys'](_0x1685ee[_0x2bc7('0x36')]);_0x163dbb[_0x2bc7('0x3f')]=_[_0x2bc7('0x4a')](_0x163dbb[_0x2bc7('0x35')],_0x163dbb[_0x2bc7('0x36')]);_0x14fe18[_0x2bc7('0x37')]=_[_0x2bc7('0x4a')](_0x163dbb[_0x2bc7('0x35')],qs[_0x2bc7('0x38')](_0x1685ee['query'][_0x2bc7('0x38')]));_0x14fe18[_0x2bc7('0x37')]=_0x14fe18[_0x2bc7('0x37')][_0x2bc7('0x39')]?_0x14fe18[_0x2bc7('0x37')]:_0x163dbb[_0x2bc7('0x35')];if(!_0x1685ee['query'][_0x2bc7('0x3a')](_0x2bc7('0x3b'))){_0x14fe18[_0x2bc7('0x22')]=qs[_0x2bc7('0x22')](_0x1685ee[_0x2bc7('0x36')][_0x2bc7('0x22')]);_0x14fe18[_0x2bc7('0x20')]=qs[_0x2bc7('0x20')](_0x1685ee[_0x2bc7('0x36')][_0x2bc7('0x20')]);}_0x14fe18['order']=qs['sort'](_0x1685ee[_0x2bc7('0x36')]['sort']);_0x14fe18[_0x2bc7('0x3e')]=qs['filters'](_['pick'](_0x1685ee[_0x2bc7('0x36')],_0x163dbb['filters']));_0x14fe18[_0x2bc7('0x3e')][_0x2bc7('0x55')]=_0x3da399['id'];if(_0x1685ee[_0x2bc7('0x36')]['filter']){_0x14fe18['where']=_[_0x2bc7('0x42')](_0x14fe18[_0x2bc7('0x3e')],{'$or':_[_0x2bc7('0x58')](_0x14fe18[_0x2bc7('0x37')],function(_0x483288){var _0x4223e2={};_0x4223e2[_0x483288]={'$like':'%'+_0x1685ee[_0x2bc7('0x36')][_0x2bc7('0x41')]+'%'};return _0x4223e2;})});}_0x14fe18=_[_0x2bc7('0x42')]({},_0x14fe18,_0x1685ee[_0x2bc7('0x44')]);return db[_0x2bc7('0x5b')]['count']({'where':_0x14fe18['where']})['then'](function(_0x526d0f){_0x486b71[_0x2bc7('0x23')]=_0x526d0f;if(_0x1685ee['query'][_0x2bc7('0x45')]){_0x14fe18[_0x2bc7('0x4b')]=[{'all':!![]}];}return db[_0x2bc7('0x5b')][_0x2bc7('0x46')](_0x14fe18);})['then'](function(_0x20290a){_0x486b71[_0x2bc7('0x47')]=_0x20290a;return _0x486b71;});}})['then'](respondWithFilteredResult(_0x560043,_0x14fe18))[_0x2bc7('0x1b')](handleError(_0x560043,null));};exports[_0x2bc7('0x5d')]=function(_0x18ecaf,_0x5a14ef){return db['ChatWebsite'][_0x2bc7('0x51')]({'where':{'id':_0x18ecaf[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x5a14ef,null))[_0x2bc7('0x11')](function(_0x4ab0ea){if(_0x4ab0ea){return _0x4ab0ea[_0x2bc7('0x5d')](_0x18ecaf[_0x2bc7('0x36')][_0x2bc7('0x5a')]);}})[_0x2bc7('0x11')](respondWithStatusCode(_0x5a14ef,null))['catch'](handleError(_0x5a14ef,null));};exports[_0x2bc7('0x5e')]=function(_0x2dfcb9,_0x5495ba){_0x2dfcb9['body'][_0x2bc7('0x5f')]=_0x2dfcb9[_0x2bc7('0x60')][_0x2bc7('0x61')];return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x2dfcb9[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x5495ba,null))[_0x2bc7('0x11')](saveUpdates(_0x2dfcb9[_0x2bc7('0x4d')],null))['then'](respondWithResult(_0x5495ba,null))[_0x2bc7('0x1b')](handleError(_0x5495ba,null));};exports['addAvatar']=function(_0x21837b,_0xebbef6){_0x21837b['body']['agentAvatar']=_0x21837b['file'][_0x2bc7('0x61')];return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x21837b[_0x2bc7('0x48')]['id']}})['then'](handleEntityNotFound(_0xebbef6,null))[_0x2bc7('0x11')](saveUpdates(_0x21837b[_0x2bc7('0x4d')],null))[_0x2bc7('0x11')](respondWithResult(_0xebbef6,null))[_0x2bc7('0x1b')](handleError(_0xebbef6,null));};exports[_0x2bc7('0x62')]=function(_0x2045a9,_0xc3d6cf){_0x2045a9[_0x2bc7('0x4d')][_0x2bc7('0x63')]=_0x2045a9[_0x2bc7('0x60')][_0x2bc7('0x61')];return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x2045a9[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0xc3d6cf,null))['then'](saveUpdates(_0x2045a9[_0x2bc7('0x4d')],null))['then'](respondWithResult(_0xc3d6cf,null))[_0x2bc7('0x1b')](handleError(_0xc3d6cf,null));};exports[_0x2bc7('0x64')]=function(_0x2c98e9,_0x210867){_0x2c98e9['body'][_0x2bc7('0x65')]=_0x2c98e9[_0x2bc7('0x60')][_0x2bc7('0x61')];return db['ChatWebsite'][_0x2bc7('0x51')]({'where':{'id':_0x2c98e9[_0x2bc7('0x48')]['id']}})['then'](handleEntityNotFound(_0x210867,null))[_0x2bc7('0x11')](saveUpdates(_0x2c98e9[_0x2bc7('0x4d')],null))[_0x2bc7('0x11')](respondWithResult(_0x210867,null))['catch'](handleError(_0x210867,null));};exports['getLogo']=function(_0x52b987,_0x3c07aa){var _0x2b026d=path[_0x2bc7('0x66')](config['root'],'server/files/images/logos/default_logo.svg');var _0xc0f801={'where':{'id':_0x52b987[_0x2bc7('0x48')]['id']},'attributes':['id',_0x2bc7('0x5f')],'raw':!![]};var _0x164e2b=![];return require(_0x2bc7('0x67'))[_0x2bc7('0x68')]()['then'](function(_0x339763){if(_0x339763){_0x164e2b=_0x339763[_0x2bc7('0x69')];}})['then'](function(){return db['ChatWebsite'][_0x2bc7('0x51')](_0xc0f801);})[_0x2bc7('0x11')](handleEntityNotFound(_0x3c07aa,null))['then'](function(_0x5c7265){if(_0x5c7265){if(!_[_0x2bc7('0x6a')](_0x5c7265[_0x2bc7('0x5f')])){if(fs[_0x2bc7('0x6b')](path[_0x2bc7('0x66')](config[_0x2bc7('0x6c')],_0x2bc7('0x6d'),_0x5c7265[_0x2bc7('0x5f')]))&&_0x164e2b){_0x2b026d=path[_0x2bc7('0x66')](config[_0x2bc7('0x6c')],'server/files/images/logos/',_0x5c7265[_0x2bc7('0x5f')]);}}return _0x3c07aa['download'](_0x2b026d);}})[_0x2bc7('0x1b')](handleError(_0x3c07aa,null));};exports['getAvatar']=function(_0x3be79b,_0x5797d6){var _0x149398=path[_0x2bc7('0x66')](config[_0x2bc7('0x6c')],_0x2bc7('0x6e'));var _0x19733b={'where':{'id':_0x3be79b[_0x2bc7('0x48')]['id']},'attributes':['id',_0x2bc7('0x6f')],'raw':!![]};return db['ChatWebsite'][_0x2bc7('0x51')](_0x19733b)['then'](handleEntityNotFound(_0x5797d6,null))[_0x2bc7('0x11')](function(_0x6cb94a){if(_0x6cb94a){if(!_['isNil'](_0x6cb94a[_0x2bc7('0x6f')])){if(fs[_0x2bc7('0x6b')](path[_0x2bc7('0x66')](config[_0x2bc7('0x6c')],'server/files/images/avatars/',_0x6cb94a[_0x2bc7('0x6f')]))){_0x149398=path[_0x2bc7('0x66')](config['root'],_0x2bc7('0x70'),_0x6cb94a[_0x2bc7('0x6f')]);}}return _0x5797d6[_0x2bc7('0x71')](_0x149398);}})['catch'](handleError(_0x5797d6,null));};exports[_0x2bc7('0x72')]=function(_0x3070be,_0x388bc1){var _0x3c75d2=path[_0x2bc7('0x66')](config[_0x2bc7('0x6c')],_0x2bc7('0x73'));var _0x36a5a1={'where':{'id':_0x3070be['params']['id']},'attributes':['id',_0x2bc7('0x63'),'showCustomerAvatar'],'raw':!![]};return db[_0x2bc7('0x30')][_0x2bc7('0x51')](_0x36a5a1)['then'](handleEntityNotFound(_0x388bc1,null))[_0x2bc7('0x11')](function(_0x2d8d4a){if(_0x2d8d4a){if(!_[_0x2bc7('0x6a')](_0x2d8d4a[_0x2bc7('0x63')])){if(fs[_0x2bc7('0x6b')](path['join'](config['root'],_0x2bc7('0x70'),_0x2d8d4a[_0x2bc7('0x63')]))&&_0x2d8d4a[_0x2bc7('0x74')]){_0x3c75d2=path['join'](config['root'],_0x2bc7('0x70'),_0x2d8d4a[_0x2bc7('0x63')]);}}return _0x388bc1[_0x2bc7('0x71')](_0x3c75d2);}})[_0x2bc7('0x1b')](handleError(_0x388bc1,null));};exports['getSystemAvatar']=function(_0x3af0fd,_0x350bcd){var _0x27d73f=path[_0x2bc7('0x66')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x4e9d1d={'where':{'id':_0x3af0fd['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x2bc7('0x51')](_0x4e9d1d)[_0x2bc7('0x11')](handleEntityNotFound(_0x350bcd,null))[_0x2bc7('0x11')](function(_0x16b2a9){if(_0x16b2a9){if(!_['isNil'](_0x16b2a9[_0x2bc7('0x65')])){if(fs[_0x2bc7('0x6b')](path[_0x2bc7('0x66')](config['root'],_0x2bc7('0x70'),_0x16b2a9[_0x2bc7('0x65')]))){_0x27d73f=path[_0x2bc7('0x66')](config[_0x2bc7('0x6c')],_0x2bc7('0x70'),_0x16b2a9[_0x2bc7('0x65')]);}}return _0x350bcd[_0x2bc7('0x71')](_0x27d73f);}})['catch'](handleError(_0x350bcd,null));};exports[_0x2bc7('0x75')]=function(_0x4ad6ce,_0x1ec532){var _0x55a464=require(_0x2bc7('0x76'));var _0x424f9c=new _0x55a464();var _0x4c36e8=_0x424f9c[_0x2bc7('0x77')](_0x4ad6ce[_0x2bc7('0x78')][_0x2bc7('0x79')])[_0x2bc7('0x7a')]();var _0x2f4aac={'body':_0x4ad6ce[_0x2bc7('0x4d')],'channel':_0x2bc7('0x7b')};var _0x54ed56=[];var _0x48673d=[];var _0x6646c3={};var _0x50ede3=![];return db[_0x2bc7('0x7c')]['describe']()[_0x2bc7('0x11')](function(_0x57e7b9){if(!_0x57e7b9){throw new db[(_0x2bc7('0x7d'))]['ValidationError']('no\x20available\x20attributes');}_0x54ed56=_[_0x2bc7('0x7e')](_[_0x2bc7('0x49')](_0x57e7b9),[_0x2bc7('0x7f'),_0x2bc7('0x80')]);_0x48673d=_[_0x2bc7('0x7e')](_[_0x2bc7('0x49')](_0x57e7b9),[_0x2bc7('0x7f'),'updatedAt',_0x2bc7('0x81'),_0x2bc7('0x82')]);if(_0x4ad6ce[_0x2bc7('0x4d')]['id']){delete _0x4ad6ce[_0x2bc7('0x4d')]['id'];}if(_['isNil'](_0x4ad6ce['body'][_0x2bc7('0x83')])){throw new db['Sequelize'][(_0x2bc7('0x84'))](_0x2bc7('0x85'));}if(_['isNil'](_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0x4d')])||_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0x4d')]===''){throw new db[(_0x2bc7('0x7d'))][(_0x2bc7('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2bc7('0x6a')](_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0x86')])){throw new db[(_0x2bc7('0x7d'))][(_0x2bc7('0x84'))](_0x2bc7('0x87')+_0x48673d);}if(!_[_0x2bc7('0x88')](_0x48673d,_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0x86')])){throw new db[(_0x2bc7('0x7d'))][(_0x2bc7('0x84'))](_0x2bc7('0x89')+_0x48673d);}_0x6646c3[_0x4ad6ce[_0x2bc7('0x4d')]['mapKey']]=_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0x83')];})['then'](function(){return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x4ad6ce[_0x2bc7('0x48')]['id']},'include':[{'model':db[_0x2bc7('0x8a')],'as':_0x2bc7('0x8b'),'include':[{'model':db[_0x2bc7('0x7c')],'as':_0x2bc7('0x8c'),'where':_0x6646c3,'limit':0x1,'order':[['updatedAt',_0x2bc7('0x8d')]]}]},{'model':db[_0x2bc7('0x8e')],'as':_0x2bc7('0x8f')}]});})[_0x2bc7('0x11')](handleEntityNotFound(_0x1ec532,null))['then'](function(_0x29421b){if(_0x29421b&&_0x29421b[_0x2bc7('0x8b')]){_0x2f4aac[_0x2bc7('0x90')]=_0x29421b;_0x2f4aac[_0x2bc7('0x91')]=_0x29421b['Applications'];_0x2f4aac[_0x2bc7('0x92')]=_0x29421b[_0x2bc7('0x8b')];_0x2f4aac['applications']=_[_0x2bc7('0x93')](_0x2f4aac[_0x2bc7('0x91')],['priority'],[_0x2bc7('0x94')]);if(_0x2f4aac[_0x2bc7('0x90')]['Applications']){delete _0x2f4aac[_0x2bc7('0x90')][_0x2bc7('0x8f')];}if(_0x2f4aac[_0x2bc7('0x90')][_0x2bc7('0x8b')]&&_0x2f4aac[_0x2bc7('0x90')]['List'][_0x2bc7('0x8c')][_0x2bc7('0x39')]){return _0x2f4aac[_0x2bc7('0x90')]['List'][_0x2bc7('0x8c')][0x0];}var _0x260cb8=_['defaults'](_0x4ad6ce['body'],{'firstName':_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0x83')],'ListId':_0x29421b[_0x2bc7('0x82')]});_0x260cb8[_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0x86')]]=_0x4ad6ce['body'][_0x2bc7('0x83')];return db['CmContact']['create'](_0x260cb8,{'fields':_0x54ed56,'raw':!![]});}})[_0x2bc7('0x11')](handleEntityNotFound(_0x1ec532,null))[_0x2bc7('0x11')](function(_0xd5148b){_0x2f4aac[_0x2bc7('0x95')]=_0xd5148b;var _0x299db5=_0x4ad6ce['body'][_0x2bc7('0x96')];if(_0x4ad6ce[_0x2bc7('0x78')][_0x2bc7('0x97')]){_0x299db5=_0x4ad6ce[_0x2bc7('0x78')][_0x2bc7('0x97')];}else if(_0x4ad6ce['headers'][_0x2bc7('0x98')]){_0x299db5=_[_0x2bc7('0x99')](_0x4ad6ce['headers']['x-forwarded-for'][_0x2bc7('0x9a')](','));}if(_0xd5148b){var _0x49fb63={'ContactId':_0xd5148b['id'],'ChatWebsiteId':_0x4ad6ce['params']['id'],'from':(_0xd5148b[_0x2bc7('0x9b')]||'')+'\x20'+(_0xd5148b['lastName']||''),'customerIp':_0x299db5,'customerPort':_0x4ad6ce[_0x2bc7('0x78')][_0x2bc7('0x9c')]?_0x4ad6ce['headers'][_0x2bc7('0x9c')]:null,'referer':_0x4ad6ce['body'][_0x2bc7('0x9d')],'browserName':_0x4c36e8['browser'][_0x2bc7('0x2c')]&&_0x4c36e8[_0x2bc7('0x9e')][_0x2bc7('0x9f')]?util[_0x2bc7('0xa0')]('%s\x20%s',_0x4c36e8[_0x2bc7('0x9e')][_0x2bc7('0x2c')],_0x4c36e8[_0x2bc7('0x9e')][_0x2bc7('0x9f')]):'unknown','browserVersion':_0x4c36e8[_0x2bc7('0x9e')][_0x2bc7('0x9f')]||_0x2bc7('0xa1'),'osName':util['format'](_0x2bc7('0xa2'),_0x4c36e8['os']['name'],_0x4c36e8['os'][_0x2bc7('0x9f')]),'osVersion':_0x4c36e8['os'][_0x2bc7('0x9f')],'deviceModel':_0x4c36e8['device']['model']&&_0x4c36e8[_0x2bc7('0xa3')][_0x2bc7('0xa4')]?util[_0x2bc7('0xa0')](_0x2bc7('0xa5'),_0x4c36e8[_0x2bc7('0xa3')][_0x2bc7('0x35')],_0x4c36e8[_0x2bc7('0xa3')]['vendor'],_0x4c36e8[_0x2bc7('0xa3')][_0x2bc7('0x33')]):null,'deviceVendor':_0x4c36e8[_0x2bc7('0xa3')][_0x2bc7('0xa4')],'deviceType':_0x4c36e8['device'][_0x2bc7('0x33')],'formData':JSON['stringify'](_0x4ad6ce[_0x2bc7('0x4d')])};var _0x6deda1={'ChatWebsiteId':_0x4ad6ce[_0x2bc7('0x48')]['id'],'closed':![]};if(_0x4ad6ce['body']['threadId']){_0x6deda1[_0x2bc7('0xa6')]=_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xa6')];return db[_0x2bc7('0xa7')][_0x2bc7('0x51')]({'where':_0x6deda1})[_0x2bc7('0x11')](function(_0x178f7f){if(_0x178f7f){return[_0x178f7f,![]];}_0x49fb63[_0x2bc7('0xa6')]=_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xa6')];_0x49fb63[_0x2bc7('0xa8')]=_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xa8')];return db[_0x2bc7('0xa7')][_0x2bc7('0x4c')](_0x49fb63)[_0x2bc7('0x11')](function(_0x86484){return[_0x86484,!![]];});});}_0x6deda1[_0x2bc7('0xa9')]=_0xd5148b['id'];if(_0x4ad6ce['body']['interaction']&&_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xaa')]['id']){_0x6deda1['id']=_0x4ad6ce[_0x2bc7('0x4d')]['interaction']['id'];return db[_0x2bc7('0xa7')]['find']({'where':_0x6deda1})[_0x2bc7('0x11')](function(_0xff4b39){if(_0xff4b39){return[_0xff4b39,![]];}return db[_0x2bc7('0xa7')][_0x2bc7('0x4c')](_0x49fb63)['then'](function(_0x582ac4){return[_0x582ac4,!![]];});});}return db[_0x2bc7('0xa7')][_0x2bc7('0x4c')](_0x49fb63)[_0x2bc7('0x11')](function(_0x70c6db){return[_0x70c6db,!![]];});}})['spread'](function(_0x2909db,_0x783e){if(_0x2909db){_0x50ede3=_0x783e;if(!_0x783e){var _0x3dd587={'from':(_0x2f4aac['contact'][_0x2bc7('0x9b')]||'')+'\x20'+(_0x2f4aac[_0x2bc7('0x95')][_0x2bc7('0xab')]||'')};if(_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xa6')]&&_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xac')]&&_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xa6')]!=_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xac')]){_0x3dd587[_0x2bc7('0xa6')]=_0x4ad6ce[_0x2bc7('0x4d')][_0x2bc7('0xac')];}return _0x2909db[_0x2bc7('0x26')](_0x3dd587);}else{return _0x2909db;}}})[_0x2bc7('0x11')](function(_0x37e5f2){_0x2f4aac['interaction']=_0x37e5f2[_0x2bc7('0x28')]({'plain':!![]});_0x2f4aac[_0x2bc7('0xaa')][_0x2bc7('0xad')]=_0x50ede3;if(_0x2f4aac[_0x2bc7('0xaa')][_0x2bc7('0xad')]){if(_0x2f4aac['account']['autoclose']){_0x2f4aac[_0x2bc7('0x91')][_0x2bc7('0xae')]({'id':0x0,'priority':_0x2f4aac[_0x2bc7('0x91')][_0x2bc7('0x39')]+0x1,'app':_0x2bc7('0xaf'),'appdata':_0x2bc7('0xb0'),'interval':_0x2bc7('0xb1')});}}return db[_0x2bc7('0xb2')][_0x2bc7('0x4c')]({'body':_0x4ad6ce['body'][_0x2bc7('0x4d')],'ChatWebsiteId':_0x4ad6ce['params']['id'],'ChatInteractionId':_0x37e5f2['id'],'direction':'in','ContactId':_0x2f4aac[_0x2bc7('0x95')]['id'],'AttachmentId':_0x4ad6ce['body'][_0x2bc7('0xb3')]});})['then'](function(_0x44a01e){_0x2f4aac[_0x2bc7('0x19')]=_0x44a01e;if(_0x2f4aac['interaction']['UserId']){return db[_0x2bc7('0xb4')][_0x2bc7('0x51')]({'attributes':['id',_0x2bc7('0x2c')],'where':{'id':_0x2f4aac['interaction'][_0x2bc7('0xb5')]}})['then'](function(_0x5ed8b5){if(_0x5ed8b5){_0x2f4aac[_0x2bc7('0x91')][_0x2bc7('0xb6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5ed8b5[_0x2bc7('0x2c')]+','+(_0x2f4aac[_0x2bc7('0x90')]['waitForTheAssignedAgent']||0xa),'interval':_0x2bc7('0xb1')});_0x2f4aac['forcedOwnership']=!![];}return respondWithRpcPromise(_0x2bc7('0xb7'),_0x2bc7('0xb8'),_0x2f4aac);});}return respondWithRpcPromise(_0x2bc7('0xb7'),_0x2bc7('0xb8'),_0x2f4aac);})['then'](function(_0x28792f){respondWithRpcPromise('EventManager',_0x2bc7('0xb9'),{'event':_0x2bc7('0x75'),'message':_0x28792f},client9002);return _0x28792f;})[_0x2bc7('0x11')](respondWithResult(_0x1ec532,null))[_0x2bc7('0x1b')](handleError(_0x1ec532,null));};exports[_0x2bc7('0xba')]=function(_0x3bc381,_0x42960c){var _0x17ed0f,_0x4eec24,_0x1fa934;var _0x16a060=[];var _0x89ce28={};var _0xb35b9f=_0x3bc381[_0x2bc7('0xbb')]||[];var _0x2ef15e=[];var _0x5d0228;return db[_0x2bc7('0x7c')][_0x2bc7('0x53')]()[_0x2bc7('0x11')](function(_0x490509){if(!_0x490509){throw new db[(_0x2bc7('0x7d'))][(_0x2bc7('0x84'))](_0x2bc7('0xbc'));}_0x16a060=_[_0x2bc7('0x7e')](_[_0x2bc7('0x49')](_0x490509),[_0x2bc7('0x7f'),_0x2bc7('0x80'),_0x2bc7('0x81'),_0x2bc7('0x82')]);if(_0x3bc381['body']['id']){delete _0x3bc381[_0x2bc7('0x4d')]['id'];}if(_[_0x2bc7('0x6a')](_0x3bc381['body'][_0x2bc7('0x83')])){throw _0x42960c[_0x2bc7('0x1d')](0x1f4)[_0x2bc7('0x2d')](new db[(_0x2bc7('0x7d'))][(_0x2bc7('0x84'))](_0x2bc7('0x85')));}if(_[_0x2bc7('0x6a')](_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0x4d')])||_0x3bc381[_0x2bc7('0x4d')]['body']===''){throw _0x42960c[_0x2bc7('0x1d')](0x1f4)[_0x2bc7('0x2d')](new db[(_0x2bc7('0x7d'))][(_0x2bc7('0x84'))](_0x2bc7('0xbd')));}if(_[_0x2bc7('0x6a')](_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0xbe')])){throw _0x42960c[_0x2bc7('0x1d')](0x1f4)[_0x2bc7('0x2d')](new db[(_0x2bc7('0x7d'))]['ValidationError'](_0x2bc7('0xbf')+_0x16a060));}if(!_[_0x2bc7('0x88')](_0x16a060,_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0xbe')])){throw _0x42960c[_0x2bc7('0x1d')](0x1f4)[_0x2bc7('0x2d')](new db[(_0x2bc7('0x7d'))][(_0x2bc7('0x84'))](_0x2bc7('0xc0')+_0x16a060));}_0x89ce28[_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0xbe')]]=_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0x83')];})[_0x2bc7('0x11')](function(){return db[_0x2bc7('0x30')]['find']({'where':{'id':_0x3bc381[_0x2bc7('0x48')]['id']},'include':[{'model':db[_0x2bc7('0x8a')],'as':_0x2bc7('0x8b')},{'model':db[_0x2bc7('0xc1')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x42960c,null))[_0x2bc7('0x11')](function(_0x2f81b8){if(_0x2f81b8&&_0x2f81b8[_0x2bc7('0x8b')]){_0x4eec24=_0x2f81b8;var _0x5b80d9=_[_0x2bc7('0xc2')](_0x3bc381[_0x2bc7('0x4d')],{'firstName':_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0x83')],'phone':_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0x83')],'ListId':_0x2f81b8[_0x2bc7('0x82')]});_0x5b80d9[_0x3bc381['body'][_0x2bc7('0xbe')]]=_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0x83')];return db[_0x2bc7('0x7c')][_0x2bc7('0xc3')]({'where':_0x89ce28,'defaults':_0x5b80d9});}})['spread'](function(_0x58ab3d){if(_0x58ab3d){_0x1fa934=_0x58ab3d;var _0x1680e5=fs[_0x2bc7('0xc4')](path[_0x2bc7('0x66')](config[_0x2bc7('0x6c')],_0x2bc7('0xc5')),_0x2bc7('0xc6'));var _0x42a9fa=ejs[_0x2bc7('0xc7')](_0x1680e5,{'body':_[_0x2bc7('0xc8')](_0x3bc381[_0x2bc7('0x4d')][_0x2bc7('0x4d')]),'bodyTitle':_0x4eec24[_0x2bc7('0xc9')]});return db[_0x2bc7('0xca')][_0x2bc7('0x4c')]({'body':_0x42a9fa,'plainBody':htmlToText[_0x2bc7('0xcb')](_0x42a9fa),'ContactId':_0x58ab3d['id'],'ChatWebsiteId':_0x4eec24['id']});}})[_0x2bc7('0x11')](function(_0x2adcd6){_0x5d0228=_0x2adcd6;if(_0xb35b9f[_0x2bc7('0x39')]){var _0x3232df=_0xb35b9f[_0x2bc7('0x58')](function(_0x209b39){return{'name':_0x209b39[_0x2bc7('0xcc')],'basename':_0x209b39[_0x2bc7('0x61')],'type':_0x209b39[_0x2bc7('0xcd')],'ChatOfflineMessageId':_0x2adcd6['id']};});_0x2ef15e=_0x3232df['map'](_0x158bf7=>{var _0x54b176={'filename':_0x158bf7['name'],'path':path[_0x2bc7('0x66')](config['root'],'server',_0x2bc7('0xbb'),'attachments','offline-chat',_0x158bf7[_0x2bc7('0xce')])};return _0x54b176;});if(!_0x4eec24[_0x2bc7('0xcf')]){return db['sequelize']['transaction'](function(_0x3ddfaa){return db['Attachment']['bulkCreate'](_0x3232df,{'transaction':_0x3ddfaa});});}}})[_0x2bc7('0x11')](function(){if(_0x5d0228){_0x17ed0f=_0x5d0228;return db['MailAccount'][_0x2bc7('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0x2bc7('0xd0')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2bc7('0xd1')],'as':_0x2bc7('0xd1'),'raw':!![]}]}]});}})['then'](function(_0x1ff8ef){if(_0x1ff8ef&&_0x1ff8ef['Smtp']&&_0x4eec24[_0x2bc7('0xd2')]&&_0x4eec24[_0x2bc7('0xd3')]){var _0x47ab2b=_0x1ff8ef[_0x2bc7('0xd4')]();return respondWithRpcPromise(_0x2bc7('0xd5'),_0x2bc7('0xd6'),{'account':_0x47ab2b,'message':{'from':util[_0x2bc7('0xa0')]('\x22%s\x22\x20<%s>',_0x1ff8ef[_0x2bc7('0x2c')],_0x1ff8ef[_0x2bc7('0xd7')]||_0x1ff8ef[_0x2bc7('0xd8')][_0x2bc7('0x4e')]),'to':_0x4eec24['forwardOfflineAddress'],'subject':_0x4eec24[_0x2bc7('0xd9')],'html':_0x17ed0f[_0x2bc7('0x4d')],'attachments':_0x2ef15e}},client9003)['then'](function(){return _0x17ed0f;})[_0x2bc7('0x1b')](function(_0x20dcd4){logger[_0x2bc7('0x16')](_0x20dcd4);});}})[_0x2bc7('0x11')](function(){if(_0x4eec24&&_0x4eec24[_0x2bc7('0xcf')]&&_0x4eec24['MailAccountId']){var _0x16ce2f=[];if(_0xb35b9f[_0x2bc7('0x39')]){_0x16ce2f=_0xb35b9f[_0x2bc7('0x58')](function(_0x162ddc){return{'name':_0x162ddc[_0x2bc7('0xcc')],'basename':_0x162ddc[_0x2bc7('0x61')],'type':_0x162ddc[_0x2bc7('0xcd')],'ChatOfflineMessageId':_0x5d0228['id']};});}var _0x36c77f;if(!_['isNil'](_0x4eec24[_0x2bc7('0xda')])){var _0x577f9e=_['map'](_0x3bc381[_0x2bc7('0x4d')],function(_0x5ce997){return _0x5ce997;});var _0x174d03=_[_0x2bc7('0xdb')](_0x577f9e)[0x0];var _0x3dc447=_[_0x2bc7('0xdc')](_0x174d03,function(_0x21244b){return _0x21244b;});_0x36c77f=_0x3dc447[0x1][_0x4eec24[_0x2bc7('0xda')]];}var _0x24d275={'from':_0x1fa934[_0x2bc7('0xd7')],'firstName':_0x1fa934[_0x2bc7('0x9b')],'lastName':_0x1fa934[_0x2bc7('0xab')],'mapKey':_0x2bc7('0xd7'),'message':{'from':_0x1fa934['email'],'to':_0x4eec24['MailAccount']['email'],'cc':'','subject':_[_0x2bc7('0x6a')](_0x36c77f)?_0x4eec24[_0x2bc7('0xd9')]:_0x36c77f,'messageId':'','sentAt':new Date(),'attach':_0x16ce2f['length'],'attachments':_0x16ce2f,'originChannel':_0x2bc7('0xdd'),'ChatWebsiteId':_0x4eec24['id'],'ChatOfflineMessageId':_0x17ed0f['id'],'originTo':_0x4eec24[_0x2bc7('0xc1')][_0x2bc7('0xd7')]},'body':_0x17ed0f['body']};var _0x2a9922={'account':{'id':_0x4eec24[_0x2bc7('0xde')]},'body':_0x24d275,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x2bc7('0xdf'),_0x2bc7('0xe0'),_0x2a9922,client9001)[_0x2bc7('0x11')](function(){return _0x17ed0f;})[_0x2bc7('0x1b')](function(_0xcd4de3){logger[_0x2bc7('0x16')](_0xcd4de3);});}return;})[_0x2bc7('0x11')](function(){if(_0x17ed0f){return _0x17ed0f;}})['then'](respondWithResult(_0x42960c,null))[_0x2bc7('0x1b')](function(_0x49a13f){logger['error']('catch',_0x49a13f);for(var _0xd11afc of _0xb35b9f){var _0x141050=path['join'](config[_0x2bc7('0x6c')],_0x2bc7('0xe1'),'files',_0x2bc7('0xe2'),_0x2bc7('0xe3'),_0xd11afc['filename']);fs_extra[_0x2bc7('0xe4')](_0x141050)[_0x2bc7('0x1b')](function(_0x59f2bf){logger[_0x2bc7('0x16')]('Could\x20not\x20remove\x20attachment\x20file',_0x141050,_0x59f2bf);});}});};exports['addInteraction']=function(_0x54320a,_0x272b64){return db[_0x2bc7('0xa7')]['find']({'where':{'id':_0x54320a[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x272b64,null))[_0x2bc7('0x11')](function(_0x48dea1){if(_0x48dea1){return _0x48dea1['addInteraction'](_0x54320a['body'][_0x2bc7('0x5a')],_[_0x2bc7('0xe5')](_0x54320a[_0x2bc7('0x4d')],[_0x2bc7('0x5a'),'id'])||{});}})[_0x2bc7('0x11')](respondWithResult(_0x272b64,null))[_0x2bc7('0x1b')](handleError(_0x272b64,null));};exports[_0x2bc7('0xe6')]=function(_0x4b0273,_0x4c8472){var _0x5dfc3d={'raw':![],'where':{}};var _0x2e45aa={};var _0x3fe6eb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2bc7('0x57')]({'where':{'id':_0x4b0273[_0x2bc7('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c8472,null))[_0x2bc7('0x11')](function(_0x18caf0){if(_0x18caf0){_0x2e45aa[_0x2bc7('0x35')]=_[_0x2bc7('0x49')](db[_0x2bc7('0xa7')]['rawAttributes']);_0x2e45aa['query']=_[_0x2bc7('0x49')](_0x4b0273[_0x2bc7('0x36')]);_0x2e45aa[_0x2bc7('0x3f')]=_[_0x2bc7('0x4a')](_0x2e45aa['model'],_0x2e45aa[_0x2bc7('0x36')]);_0x5dfc3d['attributes']=_['intersection'](_0x2e45aa[_0x2bc7('0x35')],qs[_0x2bc7('0x38')](_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0x38')]));_0x5dfc3d[_0x2bc7('0x37')]=_0x5dfc3d[_0x2bc7('0x37')][_0x2bc7('0x39')]?_0x5dfc3d[_0x2bc7('0x37')]:_0x2e45aa[_0x2bc7('0x35')];if(!_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0x3a')](_0x2bc7('0x3b'))){_0x5dfc3d['limit']=qs[_0x2bc7('0x22')](_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0x22')]);_0x5dfc3d[_0x2bc7('0x20')]=qs[_0x2bc7('0x20')](_0x4b0273['query'][_0x2bc7('0x20')]);}_0x5dfc3d[_0x2bc7('0x3c')]=qs[_0x2bc7('0x3d')](_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0x3d')]);_0x5dfc3d[_0x2bc7('0x3e')]=qs[_0x2bc7('0x3f')](_[_0x2bc7('0x40')](_0x4b0273[_0x2bc7('0x36')],_0x2e45aa[_0x2bc7('0x3f')]));_0x5dfc3d[_0x2bc7('0x3e')][_0x2bc7('0x55')]=_0x18caf0['id'];if(_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0x41')]){_0x5dfc3d[_0x2bc7('0x3e')]=_[_0x2bc7('0x42')](_0x5dfc3d[_0x2bc7('0x3e')],{'$or':_[_0x2bc7('0x58')](_0x5dfc3d[_0x2bc7('0x37')],function(_0x42dcc1){var _0x115a69={};_0x115a69[_0x42dcc1]={'$like':'%'+_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0x41')]+'%'};return _0x115a69;})});}_0x5dfc3d=_['merge']({},_0x5dfc3d,_0x4b0273[_0x2bc7('0x44')]);return db[_0x2bc7('0xa7')][_0x2bc7('0x23')]({'where':_0x5dfc3d[_0x2bc7('0x3e')]})[_0x2bc7('0x11')](function(_0x353c00){_0x3fe6eb['count']=_0x353c00;if(_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0x45')]){_0x5dfc3d[_0x2bc7('0x4b')]=[{'model':db[_0x2bc7('0x7c')],'as':'Contact','required':![]},{'model':db[_0x2bc7('0xb4')],'as':_0x2bc7('0xe7'),'attributes':[_0x2bc7('0x2c'),_0x2bc7('0xe8'),_0x2bc7('0xe9')],'required':![]},{'model':db[_0x2bc7('0xea')],'as':_0x2bc7('0xeb'),'attributes':['id',_0x2bc7('0x2c'),_0x2bc7('0xec')],'where':_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0xed')]?{'id':_0x4b0273['query'][_0x2bc7('0xed')]}:undefined,'required':_0x4b0273[_0x2bc7('0x36')][_0x2bc7('0xed')]?!![]:![]}];}return db[_0x2bc7('0xa7')]['findAll'](_0x5dfc3d);})[_0x2bc7('0x11')](function(_0x2b39e9){_0x3fe6eb[_0x2bc7('0x47')]=_0x2b39e9;return _0x3fe6eb;});}})[_0x2bc7('0x11')](respondWithFilteredResult(_0x4c8472,_0x5dfc3d))['catch'](handleError(_0x4c8472,null));};function iftimePromise(_0x2adcdd,_0x16c054){return respondWithRpcPromise(_0x2bc7('0xee'),_0x2bc7('0xef'),{'command':_0x16c054[_0x2bc7('0xf0')]?util[_0x2bc7('0xa0')](_0x2bc7('0xf1'),_0x2adcdd[_0x2bc7('0xf2')],_0x16c054[_0x2bc7('0xf0')]):util[_0x2bc7('0xa0')]('iftime\x20%s',_0x2adcdd[_0x2bc7('0xf2')])},client9002)[_0x2bc7('0x11')](function(_0x3fe0c6){var _0x5ecbd1=_0x3fe0c6&&_0x3fe0c6[_0x2bc7('0xf3')](_0x2bc7('0xf4'))>=0x0?!![]:![];logger[_0x2bc7('0xf5')](_0x2bc7('0xf6'),_0x16c054['id'],_0x2adcdd['id'],_0x2adcdd[_0x2bc7('0xf2')],_0x5ecbd1?_0x2bc7('0xf7'):'OFFLINE',_0x16c054['timezone']?_0x16c054[_0x2bc7('0xf0')]:_0x2bc7('0xf8'));return _0x5ecbd1;})[_0x2bc7('0x1b')](function(_0x2eda0f){logger[_0x2bc7('0x16')](_0x2bc7('0xf6'),_0x16c054['id'],_0x2adcdd['id'],_0x2adcdd['interval'],util[_0x2bc7('0xf9')](_0x2eda0f,{'showHidden':![],'depth':null}),_0x16c054[_0x2bc7('0xf0')]?_0x16c054[_0x2bc7('0xf0')]:_0x2bc7('0xf8'));return![];});}exports[_0x2bc7('0xef')]=function(_0x91e5a4,_0x54f71f){var _0x3b7114=0x0;var _0x161678=0x0;var _0x56eb24=![];var _0x38cb34;var _0x3175ab;return db[_0x2bc7('0x30')]['find']({'where':{'id':_0x91e5a4['params']['id']},'include':[{'model':db[_0x2bc7('0xfa')],'as':_0x2bc7('0xfa'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x2bc7('0xf2')],'raw':!![]}]}]})[_0x2bc7('0x11')](handleEntityNotFound(_0x54f71f,null))[_0x2bc7('0x11')](function(_0x381dce){if(_0x381dce){_0x38cb34=_0x381dce;return _0x381dce[_0x2bc7('0xfb')]({'raw':!![]});}})[_0x2bc7('0x11')](function(_0xb98c17){if(_0x38cb34){if(_0xb98c17){_0x3175ab=_0xb98c17;}}return require('../../config/license/util')[_0x2bc7('0x68')]();})['then'](function(_0x3f3b3e){if(_0x3f3b3e){_0x161678=_0x3f3b3e[_0x2bc7('0xfc')];_0x56eb24=_0x3f3b3e[_0x2bc7('0x69')];}})['then'](function(){return db['ChatInteraction'][_0x2bc7('0x23')]({'where':{'closed':![]}});})['then'](function(_0x562935){_0x3b7114=_0x562935;if(_0x161678&&_0x562935>_0x161678){return db['License'][_0x2bc7('0x57')]({'where':{'id':0x1}})[_0x2bc7('0x11')](function(_0x15b8a1){if(_0x15b8a1){_0x15b8a1[_0x2bc7('0xfd')](_0x2bc7('0xfe'));}});}})[_0x2bc7('0x11')](function(){if(_0x38cb34[_0x2bc7('0xfa')]&&_0x38cb34[_0x2bc7('0xfa')][_0x2bc7('0xff')]){var _0x107efb=[];for(var _0x416a78=0x0;_0x416a78<_0x38cb34[_0x2bc7('0xfa')][_0x2bc7('0xff')][_0x2bc7('0x39')];_0x416a78++){var _0x245e60=_0x38cb34['Interval'][_0x2bc7('0xff')][_0x416a78][_0x2bc7('0x28')]({'plain':!![]});_0x107efb['push'](iftimePromise(_0x245e60,_0x38cb34));}return BPromise['all'](_0x107efb)[_0x2bc7('0x11')](function(_0x58e85a){return _['some'](_0x58e85a);});}else{return!![];}})['then'](function(_0x3a7629){var _0x360fb1=fs['readFileSync'](path[_0x2bc7('0x66')](config['root'],_0x2bc7('0x100')),_0x2bc7('0xc6'));var _0x2daaa3={'remote':_0x38cb34[_0x2bc7('0x101')],'query':querystring['stringify'](_['merge'](_0x38cb34[_0x2bc7('0x28')]({'plain':!![]}),{'customerIp':_0x91e5a4[_0x2bc7('0x78')][_0x2bc7('0x98')]||_0x91e5a4[_0x2bc7('0x78')][_0x2bc7('0x102')]||_0x91e5a4['connection'][_0x2bc7('0x103')]||_0x91e5a4['ip'],'referer':_0x91e5a4[_0x2bc7('0x78')][_0x2bc7('0x9d')],'openedInteractions':_0x3b7114,'maxInteractions':_0x161678,'virtual':_0x56eb24[_0x2bc7('0xfc')],'online':_0x3a7629,'custom':_0x56eb24}))[_0x2bc7('0x104')](/'/g,'\x5c\x27')};_0x54f71f[_0x2bc7('0x2d')](ejs[_0x2bc7('0xc7')](Mustache[_0x2bc7('0xc7')](_0x360fb1,_0x2daaa3),{'proactiveActions':_0x3175ab,'alignment':_0x38cb34[_0x2bc7('0x105')],'verticalAlignment':_0x38cb34[_0x2bc7('0x106')],'div_color':_0x38cb34[_0x2bc7('0xec')],'labelText':_0x38cb34[_0x2bc7('0x107')],'text_color':_0x38cb34[_0x2bc7('0x108')],'text_button_color':_0x38cb34[_0x2bc7('0x109')],'button_color':_0x38cb34[_0x2bc7('0x10a')],'background_color':_0x38cb34[_0x2bc7('0x10b')],'hideWhenOffline':_0x38cb34['hideWhenOffline'],'interval':_0x38cb34[_0x2bc7('0x10c')]}));})[_0x2bc7('0x1b')](handleError(_0x54f71f,null));};exports[_0x2bc7('0x10d')]=function(_0x35eefc,_0xccf6f5){var _0x47db04=_0x35eefc[_0x2bc7('0x48')]['id'];var _0x4b99c1=_0x35eefc[_0x2bc7('0x4d')];var _0x17dd31=0xc8;var _0x2e5151=null;return db[_0x2bc7('0x10e')]['transaction']({'isolationLevel':db[_0x2bc7('0x10e')][_0x2bc7('0x10f')][_0x2bc7('0x110')]['READ_COMMITTED']},function(_0x2dae67){return db[_0x2bc7('0x30')][_0x2bc7('0x57')]({'where':{'id':_0x47db04},'transaction':_0x2dae67})['then'](function(_0x360636){if(_0x360636){return db[_0x2bc7('0x8e')][_0x2bc7('0x27')]({'where':{'ChatWebsiteId':_0x47db04},'transaction':_0x2dae67})[_0x2bc7('0x11')](function(){var _0x5b0a56=_[_0x2bc7('0x58')](_0x4b99c1,function(_0x277175){_0x277175['ChatWebsiteId']=_0x47db04;return _0x277175;});return db[_0x2bc7('0x8e')]['bulkCreate'](_0x5b0a56,{'transaction':_0x2dae67});});}else{_0x17dd31=0x194;_0x2e5151=[];}});})[_0x2bc7('0x11')](function(){if(_0x17dd31!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x47db04},'order':_0x2bc7('0x111')})[_0x2bc7('0x11')](function(_0x2cdbc6){_0x2e5151=_0x2cdbc6;});}})['catch'](function(_0x33e270){_0x17dd31=0x1f4;logger[_0x2bc7('0x16')](_0x33e270['stack']);if(_0x33e270[_0x2bc7('0x2c')]){delete _0x33e270['name'];}_0x2e5151=_0x33e270;})['finally'](function(){if(_0x2e5151===null){_0xccf6f5[_0x2bc7('0x1c')](_0x17dd31);}else{if(_0x17dd31===0x1f4){_0xccf6f5[_0x2bc7('0x1d')](_0x17dd31)[_0x2bc7('0x2d')](_0x2e5151);}else{_0xccf6f5[_0x2bc7('0x1d')](_0x17dd31)[_0x2bc7('0x1f')](_0x2e5151);}}});};exports[_0x2bc7('0x112')]=function(_0x2a36b7,_0x1306ce){var _0x148dce={};var _0x4839e5={};var _0x4baadf;var _0x3c67bf;return db[_0x2bc7('0x30')][_0x2bc7('0x57')]({'where':{'id':_0x2a36b7[_0x2bc7('0x48')]['id']}})['then'](handleEntityNotFound(_0x1306ce,null))[_0x2bc7('0x11')](function(_0x356d03){if(_0x356d03){_0x4baadf=_0x356d03;_0x4839e5['model']=_['keys'](db[_0x2bc7('0x8e')][_0x2bc7('0x31')]);_0x4839e5[_0x2bc7('0x36')]=_['keys'](_0x2a36b7['query']);_0x4839e5['filters']=_['intersection'](_0x4839e5[_0x2bc7('0x35')],_0x4839e5[_0x2bc7('0x36')]);_0x148dce['attributes']=_['intersection'](_0x4839e5[_0x2bc7('0x35')],qs[_0x2bc7('0x38')](_0x2a36b7[_0x2bc7('0x36')]['fields']));_0x148dce[_0x2bc7('0x37')]=_0x148dce['attributes'][_0x2bc7('0x39')]?_0x148dce['attributes']:_0x4839e5[_0x2bc7('0x35')];_0x148dce[_0x2bc7('0x3c')]=qs[_0x2bc7('0x3d')](_0x2a36b7[_0x2bc7('0x36')]['sort']);_0x148dce[_0x2bc7('0x3e')]=qs['filters'](_['pick'](_0x2a36b7['query'],_0x4839e5['filters']));if(_0x2a36b7[_0x2bc7('0x36')][_0x2bc7('0x41')]){_0x148dce[_0x2bc7('0x3e')]=_[_0x2bc7('0x42')](_0x148dce[_0x2bc7('0x3e')],{'$or':_[_0x2bc7('0x58')](_0x148dce['attributes'],function(_0x5a272b){var _0x423819={};_0x423819[_0x5a272b]={'$like':'%'+_0x2a36b7[_0x2bc7('0x36')][_0x2bc7('0x41')]+'%'};return _0x423819;})});}_0x148dce=_[_0x2bc7('0x42')]({},_0x148dce,_0x2a36b7[_0x2bc7('0x44')]);return _0x4baadf[_0x2bc7('0x112')](_0x148dce);}})['then'](function(_0x30a18d){if(_0x30a18d){_0x3c67bf=_0x30a18d[_0x2bc7('0x39')];if(!_0x2a36b7[_0x2bc7('0x36')][_0x2bc7('0x3a')]('nolimit')){_0x148dce[_0x2bc7('0x22')]=qs[_0x2bc7('0x22')](_0x2a36b7['query'][_0x2bc7('0x22')]);_0x148dce[_0x2bc7('0x20')]=qs['offset'](_0x2a36b7['query'][_0x2bc7('0x20')]);}return _0x4baadf[_0x2bc7('0x112')](_0x148dce);}})['then'](function(_0x27dbb5){if(_0x27dbb5){return _0x27dbb5?{'count':_0x3c67bf,'rows':_0x27dbb5}:null;}})[_0x2bc7('0x11')](respondWithResult(_0x1306ce,null))[_0x2bc7('0x1b')](handleError(_0x1306ce,null));};exports['addProactiveActions']=function(_0x987e13,_0x45cbfc){return db[_0x2bc7('0x113')][_0x2bc7('0x51')]({'where':{'id':_0x987e13[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x45cbfc,null))['then'](function(_0x181cef){if(_0x181cef){return _0x181cef[_0x2bc7('0x114')](_0x987e13[_0x2bc7('0x4d')][_0x2bc7('0x5a')],_[_0x2bc7('0xe5')](_0x987e13[_0x2bc7('0x4d')],['ids','id'])||{});}})[_0x2bc7('0x11')](respondWithResult(_0x45cbfc,null))[_0x2bc7('0x1b')](handleError(_0x45cbfc,null));};exports[_0x2bc7('0xfb')]=function(_0x38324a,_0x3cbebc){var _0x16ee28={};var _0xc4b3cf={};var _0x24e626;var _0x386cd6;return db[_0x2bc7('0x30')][_0x2bc7('0x57')]({'where':{'id':_0x38324a[_0x2bc7('0x48')]['id']}})['then'](handleEntityNotFound(_0x3cbebc,null))[_0x2bc7('0x11')](function(_0x2cc967){if(_0x2cc967){_0x24e626=_0x2cc967;_0xc4b3cf[_0x2bc7('0x35')]=_['keys'](db[_0x2bc7('0x115')][_0x2bc7('0x31')]);_0xc4b3cf[_0x2bc7('0x36')]=_[_0x2bc7('0x49')](_0x38324a[_0x2bc7('0x36')]);_0xc4b3cf[_0x2bc7('0x3f')]=_[_0x2bc7('0x4a')](_0xc4b3cf[_0x2bc7('0x35')],_0xc4b3cf[_0x2bc7('0x36')]);_0x16ee28[_0x2bc7('0x37')]=_[_0x2bc7('0x4a')](_0xc4b3cf[_0x2bc7('0x35')],qs[_0x2bc7('0x38')](_0x38324a[_0x2bc7('0x36')][_0x2bc7('0x38')]));_0x16ee28[_0x2bc7('0x37')]=_0x16ee28[_0x2bc7('0x37')][_0x2bc7('0x39')]?_0x16ee28['attributes']:_0xc4b3cf['model'];_0x16ee28[_0x2bc7('0x3c')]=qs[_0x2bc7('0x3d')](_0x38324a[_0x2bc7('0x36')][_0x2bc7('0x3d')]);_0x16ee28[_0x2bc7('0x3e')]=qs['filters'](_[_0x2bc7('0x40')](_0x38324a['query'],_0xc4b3cf[_0x2bc7('0x3f')]));if(_0x38324a['query'][_0x2bc7('0x41')]){_0x16ee28[_0x2bc7('0x3e')]=_[_0x2bc7('0x42')](_0x16ee28[_0x2bc7('0x3e')],{'$or':_['map'](_0x16ee28[_0x2bc7('0x37')],function(_0x306cac){var _0x4164a7={};_0x4164a7[_0x306cac]={'$like':'%'+_0x38324a[_0x2bc7('0x36')][_0x2bc7('0x41')]+'%'};return _0x4164a7;})});}_0x16ee28=_[_0x2bc7('0x42')]({},_0x16ee28,_0x38324a[_0x2bc7('0x44')]);return _0x24e626[_0x2bc7('0xfb')](_0x16ee28);}})[_0x2bc7('0x11')](function(_0x56fcc5){if(_0x56fcc5){_0x386cd6=_0x56fcc5[_0x2bc7('0x39')];if(!_0x38324a[_0x2bc7('0x36')][_0x2bc7('0x3a')](_0x2bc7('0x3b'))){_0x16ee28['limit']=qs['limit'](_0x38324a[_0x2bc7('0x36')]['limit']);_0x16ee28[_0x2bc7('0x20')]=qs[_0x2bc7('0x20')](_0x38324a[_0x2bc7('0x36')][_0x2bc7('0x20')]);}return _0x24e626['getProactiveActions'](_0x16ee28);}})[_0x2bc7('0x11')](function(_0x72cba2){if(_0x72cba2){return _0x72cba2?{'count':_0x386cd6,'rows':_0x72cba2}:null;}})['then'](respondWithResult(_0x3cbebc,null))['catch'](handleError(_0x3cbebc,null));};exports[_0x2bc7('0x116')]=function(_0x1b0606,_0x3bd6e6){var _0x8b97a5=_0x1b0606[_0x2bc7('0x36')][_0x2bc7('0x117')]==='false'?'offlineForm':_0x2bc7('0x118');return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'attributes':['id',_0x8b97a5],'where':{'id':_0x1b0606['params']['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x3bd6e6,null))[_0x2bc7('0x11')](function(_0x2f49ff){if(_0x2f49ff){var _0x4830f7=_0x2f49ff[_0x8b97a5];var _0x5272c=_0x4830f7&&_0x4830f7[_0x2bc7('0x119')]?_0x4830f7[_0x2bc7('0x119')]:[];_0x3bd6e6[_0x2bc7('0x2d')]({'fromKey':_[_0x2bc7('0x6a')](_0x4830f7['fromKey'])?undefined:_0x4830f7['fromKey'],'count':_0x5272c[_0x2bc7('0x39')],'rows':_0x5272c});}})[_0x2bc7('0x1b')](handleError(_0x3bd6e6,null));};exports[_0x2bc7('0x11a')]=function(_0x49c0b5,_0x1118c9){var _0x2abb62={'raw':![],'where':{}};var _0x185372={};var _0x8dfa80={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x49c0b5[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x1118c9,null))[_0x2bc7('0x11')](function(_0x8de7f8){if(_0x8de7f8){_0x185372[_0x2bc7('0x35')]=_[_0x2bc7('0x49')](db[_0x2bc7('0xca')][_0x2bc7('0x31')]);_0x185372[_0x2bc7('0x36')]=_[_0x2bc7('0x49')](_0x49c0b5[_0x2bc7('0x36')]);_0x185372[_0x2bc7('0x3f')]=_['intersection'](_0x185372['model'],_0x185372[_0x2bc7('0x36')]);_0x2abb62[_0x2bc7('0x37')]=_['intersection'](_0x185372['model'],qs['fields'](_0x49c0b5['query'][_0x2bc7('0x38')]));_0x2abb62[_0x2bc7('0x37')]=_0x2abb62['attributes'][_0x2bc7('0x39')]?_0x2abb62[_0x2bc7('0x37')]:_0x185372[_0x2bc7('0x35')];if(!_0x49c0b5['query']['hasOwnProperty'](_0x2bc7('0x3b'))){_0x2abb62[_0x2bc7('0x22')]=qs['limit'](_0x49c0b5[_0x2bc7('0x36')]['limit']);_0x2abb62['offset']=qs['offset'](_0x49c0b5['query'][_0x2bc7('0x20')]);}_0x2abb62[_0x2bc7('0x3c')]=qs[_0x2bc7('0x3d')](_0x49c0b5['query']['sort']);_0x2abb62[_0x2bc7('0x3e')]=qs['filters'](_['pick'](_0x49c0b5[_0x2bc7('0x36')],_0x185372[_0x2bc7('0x3f')]));_0x2abb62[_0x2bc7('0x3e')][_0x2bc7('0x55')]=_0x8de7f8['id'];if(_0x49c0b5[_0x2bc7('0x36')]['filter']){_0x2abb62[_0x2bc7('0x3e')]=_[_0x2bc7('0x42')](_0x2abb62[_0x2bc7('0x3e')],{'$or':_[_0x2bc7('0x58')](_0x2abb62[_0x2bc7('0x37')],function(_0x2487c8){var _0x50c58d={};_0x50c58d[_0x2487c8]={'$like':'%'+_0x49c0b5[_0x2bc7('0x36')][_0x2bc7('0x41')]+'%'};return _0x50c58d;})});}_0x2abb62=_[_0x2bc7('0x42')]({},_0x2abb62,_0x49c0b5[_0x2bc7('0x44')]);return db['ChatOfflineMessage'][_0x2bc7('0x23')]({'where':_0x2abb62[_0x2bc7('0x3e')]})[_0x2bc7('0x11')](function(_0x3996e){_0x8dfa80[_0x2bc7('0x23')]=_0x3996e;if(_0x49c0b5[_0x2bc7('0x36')][_0x2bc7('0x45')]){_0x2abb62[_0x2bc7('0x4b')]=[{'all':!![]}];}else{_0x2abb62['include']=[{'model':db['CmContact'],'as':_0x2bc7('0x11b'),'required':![]},{'model':db[_0x2bc7('0x11c')],'as':_0x2bc7('0x11d'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x2abb62);})[_0x2bc7('0x11')](function(_0x21cf49){_0x8dfa80[_0x2bc7('0x47')]=_0x21cf49;return _0x8dfa80;});}})[_0x2bc7('0x11')](respondWithFilteredResult(_0x1118c9,_0x2abb62))['catch'](handleError(_0x1118c9,null));};exports[_0x2bc7('0x11e')]=function(_0x3db414,_0x516144){return db[_0x2bc7('0x30')][_0x2bc7('0x51')]({'where':{'id':_0x3db414[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x516144,null))[_0x2bc7('0x11')](function(_0x1a93ca){if(_0x1a93ca){return _0x1a93ca[_0x2bc7('0x11e')](_0x3db414[_0x2bc7('0x4d')][_0x2bc7('0x5a')],_[_0x2bc7('0xe5')](_0x3db414[_0x2bc7('0x4d')],[_0x2bc7('0x5a'),'id'])||{})[_0x2bc7('0x11f')](function(_0x223b84){for(var _0x75189f=0x0;_0x75189f<_0x3db414[_0x2bc7('0x4d')][_0x2bc7('0x5a')][_0x2bc7('0x39')];_0x75189f+=0x1){socket[_0x2bc7('0x120')](_0x2bc7('0x121'),{'UserId':Number(_0x3db414[_0x2bc7('0x4d')][_0x2bc7('0x5a')][_0x75189f]),'ChatWebsiteId':Number(_0x3db414[_0x2bc7('0x48')]['id'])});}return _0x223b84;});}})['then'](respondWithResult(_0x516144,null))['catch'](handleError(_0x516144,null));};exports[_0x2bc7('0x122')]=function(_0x2ae2f0,_0xb9c35e){return db[_0x2bc7('0x30')]['find']({'where':{'id':_0x2ae2f0[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0xb9c35e,null))['then'](function(_0x263d63){if(_0x263d63){return _0x263d63['removeAgents'](_0x2ae2f0[_0x2bc7('0x36')][_0x2bc7('0x5a')])[_0x2bc7('0x11')](function(){if(_[_0x2bc7('0x123')](_0x2ae2f0[_0x2bc7('0x36')][_0x2bc7('0x5a')])){for(var _0xf8415b=0x0;_0xf8415b<_0x2ae2f0['query'][_0x2bc7('0x5a')][_0x2bc7('0x39')];_0xf8415b+=0x1){socket[_0x2bc7('0x120')](_0x2bc7('0x124'),{'UserId':Number(_0x2ae2f0[_0x2bc7('0x36')][_0x2bc7('0x5a')][_0xf8415b]),'ChatWebsiteId':Number(_0x2ae2f0[_0x2bc7('0x48')]['id'])});}}else{socket[_0x2bc7('0x120')](_0x2bc7('0x124'),{'UserId':Number(_0x2ae2f0[_0x2bc7('0x36')]['ids']),'ChatWebsiteId':Number(_0x2ae2f0['params']['id'])});}});}})[_0x2bc7('0x11')](respondWithStatusCode(_0xb9c35e,null))['catch'](handleError(_0xb9c35e,null));};exports[_0x2bc7('0x125')]=function(_0x5b1573,_0x157896){var _0xe89a5a={};var _0x3d2866={};var _0x50c729;var _0x5c6838;return db['ChatWebsite'][_0x2bc7('0x57')]({'where':{'id':_0x5b1573[_0x2bc7('0x48')]['id']}})[_0x2bc7('0x11')](handleEntityNotFound(_0x157896,null))[_0x2bc7('0x11')](function(_0x22521b){if(_0x22521b){_0x50c729=_0x22521b;_0x3d2866['model']=_[_0x2bc7('0x49')](db[_0x2bc7('0xb4')][_0x2bc7('0x31')]);_0x3d2866['query']=_[_0x2bc7('0x49')](_0x5b1573[_0x2bc7('0x36')]);_0x3d2866[_0x2bc7('0x3f')]=_['intersection'](_0x3d2866['model'],_0x3d2866[_0x2bc7('0x36')]);_0xe89a5a[_0x2bc7('0x37')]=_['intersection'](_0x3d2866[_0x2bc7('0x35')],qs[_0x2bc7('0x38')](_0x5b1573[_0x2bc7('0x36')][_0x2bc7('0x38')]));_0xe89a5a[_0x2bc7('0x37')]=_0xe89a5a[_0x2bc7('0x37')][_0x2bc7('0x39')]?_0xe89a5a[_0x2bc7('0x37')]:_0x3d2866[_0x2bc7('0x35')];_0xe89a5a['order']=qs[_0x2bc7('0x3d')](_0x5b1573[_0x2bc7('0x36')][_0x2bc7('0x3d')]);_0xe89a5a['where']=qs[_0x2bc7('0x3f')](_[_0x2bc7('0x40')](_0x5b1573[_0x2bc7('0x36')],_0x3d2866[_0x2bc7('0x3f')]));if(_0x5b1573[_0x2bc7('0x36')]['filter']){_0xe89a5a[_0x2bc7('0x3e')]=_[_0x2bc7('0x42')](_0xe89a5a['where'],{'$or':_[_0x2bc7('0x58')](_0xe89a5a[_0x2bc7('0x37')],function(_0x20ced0){var _0x174b61={};_0x174b61[_0x20ced0]={'$like':'%'+_0x5b1573[_0x2bc7('0x36')][_0x2bc7('0x41')]+'%'};return _0x174b61;})});}_0xe89a5a=_[_0x2bc7('0x42')]({},_0xe89a5a,_0x5b1573[_0x2bc7('0x44')]);return _0x50c729[_0x2bc7('0x125')](_0xe89a5a);}})[_0x2bc7('0x11')](function(_0x3e45da){if(_0x3e45da){_0x5c6838=_0x3e45da[_0x2bc7('0x39')];if(!_0x5b1573['query'][_0x2bc7('0x3a')]('nolimit')){_0xe89a5a[_0x2bc7('0x22')]=qs['limit'](_0x5b1573[_0x2bc7('0x36')]['limit']);_0xe89a5a[_0x2bc7('0x20')]=qs['offset'](_0x5b1573[_0x2bc7('0x36')][_0x2bc7('0x20')]);}return _0x50c729['getAgents'](_0xe89a5a);}})[_0x2bc7('0x11')](function(_0x20ab15){if(_0x20ab15){return _0x20ab15?{'count':_0x5c6838,'rows':_0x20ab15}:null;}})[_0x2bc7('0x11')](respondWithResult(_0x157896,null))[_0x2bc7('0x1b')](handleError(_0x157896,null));}; \ No newline at end of file +var _0xac1c=['fromString','originalname','mimetype','server','basename','openNewInteraction','sequelize','Attachment','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','MailAccount','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','getLicense','virtual','License','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','lodash','querystring','ioredis','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','count','update','then','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','pick','filter','where','VIRTUAL','include','rows','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','describe','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','nolimit','order','merge','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addLogo','sitepic','filename','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','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','agentAvatar','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','close','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac1c,0x64));var _0xcac1=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0xac1c[_0x27530d];return _0x59e561;};'use strict';var BPromise=require(_0xcac1('0x0'));var Mustache=require(_0xcac1('0x1'));var util=require(_0xcac1('0x2'));var path=require('path');var ejs=require(_0xcac1('0x3'));var fs=require('fs');var fs_extra=require(_0xcac1('0x4'));var _=require(_0xcac1('0x5'));var querystring=require(_0xcac1('0x6'));var Redis=require(_0xcac1('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xcac1('0x8'));var db=require(_0xcac1('0x9'))['db'];config[_0xcac1('0xa')]=_[_0xcac1('0xb')](config[_0xcac1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcac1('0xc'))(new Redis(config[_0xcac1('0xa')]));require(_0xcac1('0xd'))[_0xcac1('0xe')](socket);var htmlToText=require(_0xcac1('0xf'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xcac1('0x10')][_0xcac1('0x11')]({'port':0x232a});var client9003=jayson[_0xcac1('0x10')]['http']({'port':0x232b});var client9001=jayson['client'][_0xcac1('0x11')]({'port':0x2329});function respondWithRpcPromise(_0xf8d4ed,_0x13914d,_0x31eeed,_0x2bb5ee){return new BPromise(function(_0x50ca8d,_0x630551){var _0x173702=_0x2bb5ee||client;return _0x173702[_0xcac1('0x12')](_0xf8d4ed,_0x31eeed)['then'](function(_0x312338){logger[_0xcac1('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x13914d,_0xcac1('0x14'));logger[_0xcac1('0x15')](_0xcac1('0x16'),_0x13914d,_0xcac1('0x14'),JSON[_0xcac1('0x17')](_0x312338));if(_0x312338[_0xcac1('0x18')]){if(_0x312338[_0xcac1('0x18')]['code']===0x1f4){logger['error'](_0xcac1('0x19'),_0x13914d,_0x312338['error'][_0xcac1('0x1a')]);return _0x630551(_0x312338[_0xcac1('0x18')][_0xcac1('0x1a')]);}logger[_0xcac1('0x18')](_0xcac1('0x19'),_0x13914d,_0x312338[_0xcac1('0x18')][_0xcac1('0x1a')]);return _0x50ca8d(_0x312338[_0xcac1('0x18')]['message']);}else{logger['info'](_0xcac1('0x19'),_0x13914d,_0xcac1('0x14'));_0x50ca8d(_0x312338['result'][_0xcac1('0x1a')]);}})[_0xcac1('0x1b')](function(_0x597108){logger['error'](_0xcac1('0x19'),_0x13914d,_0x597108);_0x630551(_0x597108);});});}function respondWithStatusCode(_0x20280e,_0x272efc){_0x272efc=_0x272efc||0xcc;return function(_0x7067e5){if(_0x7067e5){return _0x20280e[_0xcac1('0x1c')](_0x272efc);}return _0x20280e[_0xcac1('0x1d')](_0x272efc)[_0xcac1('0x1e')]();};}function respondWithResult(_0x4a7bff,_0x6d1a93){_0x6d1a93=_0x6d1a93||0xc8;return function(_0x15c4ae){if(_0x15c4ae){return _0x4a7bff[_0xcac1('0x1d')](_0x6d1a93)[_0xcac1('0x1f')](_0x15c4ae);}};}function respondWithFilteredResult(_0x283403,_0x4526b7){return function(_0x5b94a5){if(_0x5b94a5){var _0x26f05e=typeof _0x4526b7[_0xcac1('0x20')]==='undefined'&&typeof _0x4526b7[_0xcac1('0x21')]==='undefined';var _0x1f3e7c=_0x5b94a5[_0xcac1('0x22')];var _0x451526=_0x26f05e?0x0:_0x4526b7[_0xcac1('0x20')];var _0x4f9789=_0x26f05e?_0x5b94a5[_0xcac1('0x22')]:_0x4526b7['offset']+_0x4526b7[_0xcac1('0x21')];var _0xc053e8;if(_0x4f9789>=_0x1f3e7c){_0x4f9789=_0x1f3e7c;_0xc053e8=0xc8;}else{_0xc053e8=0xce;}_0x283403[_0xcac1('0x1d')](_0xc053e8);return _0x283403['set']('Content-Range',_0x451526+'-'+_0x4f9789+'/'+_0x1f3e7c)[_0xcac1('0x1f')](_0x5b94a5);}return null;};}function saveUpdates(_0x34806e){return function(_0x515505){if(_0x515505){return _0x515505[_0xcac1('0x23')](_0x34806e)[_0xcac1('0x24')](function(_0x3e8e3f){return _0x3e8e3f;});}return null;};}function removeEntity(_0x1306f6){return function(_0xb96bc7){if(_0xb96bc7){return _0xb96bc7[_0xcac1('0x25')]()[_0xcac1('0x24')](function(){var _0x39af9b=_0xb96bc7[_0xcac1('0x26')]({'plain':!![]});var _0x560a3d='ChatWebsites';return db[_0xcac1('0x27')][_0xcac1('0x25')]({'where':{'type':_0x560a3d,'resourceId':_0x39af9b['id']}})['then'](function(){return _0xb96bc7;});})['then'](function(){_0x1306f6['status'](0xcc)[_0xcac1('0x1e')]();});}};}function handleEntityNotFound(_0x6f7ef2){return function(_0x270ca3){if(!_0x270ca3){_0x6f7ef2[_0xcac1('0x1c')](0x194);}return _0x270ca3;};}function handleError(_0x1f5af2,_0x11a7e1){_0x11a7e1=_0x11a7e1||0x1f4;return function(_0x4d8cfa){logger[_0xcac1('0x18')](_0x4d8cfa['stack']);if(_0x4d8cfa['name']){delete _0x4d8cfa[_0xcac1('0x28')];}_0x1f5af2[_0xcac1('0x1d')](_0x11a7e1)[_0xcac1('0x29')](_0x4d8cfa);};}exports[_0xcac1('0x2a')]=function(_0x5a2a25,_0x3e8976){var _0x58f8ee={'include':[{'model':db[_0xcac1('0x2b')],'as':_0xcac1('0x2c')}]},_0x57cfbd={},_0x5ed28a={'count':0x0,'rows':[]};var _0x347cb5=_[_0xcac1('0x2d')](db[_0xcac1('0x2e')][_0xcac1('0x2f')],function(_0x20561d){return{'name':_0x20561d['fieldName'],'type':_0x20561d[_0xcac1('0x30')][_0xcac1('0x31')]};});_0x57cfbd['model']=_['map'](_0x347cb5,'name');_0x57cfbd[_0xcac1('0x32')]=_[_0xcac1('0x33')](_0x5a2a25[_0xcac1('0x32')]);_0x57cfbd[_0xcac1('0x34')]=_[_0xcac1('0x35')](_0x57cfbd[_0xcac1('0x36')],_0x57cfbd[_0xcac1('0x32')]);_0x58f8ee[_0xcac1('0x37')]=_[_0xcac1('0x35')](_0x57cfbd['model'],qs[_0xcac1('0x38')](_0x5a2a25[_0xcac1('0x32')][_0xcac1('0x38')]));_0x58f8ee[_0xcac1('0x37')]=_0x58f8ee[_0xcac1('0x37')][_0xcac1('0x39')]?_0x58f8ee['attributes']:_0x57cfbd['model'];if(!_0x5a2a25[_0xcac1('0x32')]['hasOwnProperty']('nolimit')){_0x58f8ee[_0xcac1('0x21')]=qs[_0xcac1('0x21')](_0x5a2a25[_0xcac1('0x32')][_0xcac1('0x21')]);_0x58f8ee[_0xcac1('0x20')]=qs[_0xcac1('0x20')](_0x5a2a25[_0xcac1('0x32')][_0xcac1('0x20')]);}_0x58f8ee['order']=qs[_0xcac1('0x3a')](_0x5a2a25['query'][_0xcac1('0x3a')]);_0x58f8ee['where']=qs['filters'](_[_0xcac1('0x3b')](_0x5a2a25['query'],_0x57cfbd[_0xcac1('0x34')]),_0x347cb5);if(_0x5a2a25[_0xcac1('0x32')][_0xcac1('0x3c')]){_0x58f8ee['where']=_['merge'](_0x58f8ee[_0xcac1('0x3d')],{'$or':_[_0xcac1('0x2d')](_0x347cb5,function(_0x513bf1){if(_0x513bf1['type']!==_0xcac1('0x3e')){var _0x580bff={};_0x580bff[_0x513bf1['name']]={'$like':'%'+_0x5a2a25['query'][_0xcac1('0x3c')]+'%'};return _0x580bff;}})});}_0x58f8ee=_['merge']({},_0x58f8ee,_0x5a2a25['options']);var _0x3e1aa2={'where':_0x58f8ee[_0xcac1('0x3d')]};return db[_0xcac1('0x2e')][_0xcac1('0x22')](_0x3e1aa2)[_0xcac1('0x24')](function(_0x22ac85){_0x5ed28a[_0xcac1('0x22')]=_0x22ac85;if(_0x5a2a25[_0xcac1('0x32')]['includeAll']){_0x58f8ee[_0xcac1('0x3f')]=[{'all':!![]}];}return db[_0xcac1('0x2e')]['findAll'](_0x58f8ee);})[_0xcac1('0x24')](function(_0x12da98){_0x5ed28a[_0xcac1('0x40')]=_0x12da98;return _0x5ed28a;})[_0xcac1('0x24')](respondWithFilteredResult(_0x3e8976,_0x58f8ee))[_0xcac1('0x1b')](handleError(_0x3e8976,null));};exports['show']=function(_0x2b2ba1,_0x40e9a9){var _0x297df8={'raw':![],'where':{'id':_0x2b2ba1[_0xcac1('0x41')]['id']},'include':[{'model':db[_0xcac1('0x2b')],'as':_0xcac1('0x2c')}]},_0x4f9950={};_0x4f9950[_0xcac1('0x36')]=_['keys'](db['ChatWebsite'][_0xcac1('0x2f')]);_0x4f9950['query']=_['keys'](_0x2b2ba1[_0xcac1('0x32')]);_0x4f9950[_0xcac1('0x34')]=_[_0xcac1('0x35')](_0x4f9950['model'],_0x4f9950['query']);_0x297df8[_0xcac1('0x37')]=_[_0xcac1('0x35')](_0x4f9950['model'],qs[_0xcac1('0x38')](_0x2b2ba1['query'][_0xcac1('0x38')]));_0x297df8[_0xcac1('0x37')]=_0x297df8[_0xcac1('0x37')]['length']?_0x297df8['attributes']:_0x4f9950[_0xcac1('0x36')];if(_0x2b2ba1[_0xcac1('0x32')][_0xcac1('0x42')]){_0x297df8['include']=[{'all':!![]}];}_0x297df8=_['merge']({},_0x297df8,_0x2b2ba1[_0xcac1('0x43')]);return db[_0xcac1('0x2e')][_0xcac1('0x44')](_0x297df8)[_0xcac1('0x24')](handleEntityNotFound(_0x40e9a9,null))[_0xcac1('0x24')](respondWithResult(_0x40e9a9,null))[_0xcac1('0x1b')](handleError(_0x40e9a9,null));};exports[_0xcac1('0x45')]=function(_0x53c753,_0x19c46e){return db[_0xcac1('0x2e')]['create'](_0x53c753[_0xcac1('0x46')],{})[_0xcac1('0x24')](function(_0x1df035){var _0x5ccf79=_0x53c753[_0xcac1('0x47')][_0xcac1('0x26')]({'plain':!![]});if(!_0x5ccf79)throw new Error(_0xcac1('0x48'));if(_0x5ccf79[_0xcac1('0x49')]==='user'){var _0x8b5df1=_0x1df035[_0xcac1('0x26')]({'plain':!![]});var _0x277ab4='ChatWebsites';return db[_0xcac1('0x4a')]['find']({'where':{'name':_0x277ab4,'userProfileId':_0x5ccf79['userProfileId']},'raw':!![]})['then'](function(_0x357695){if(_0x357695&&_0x357695['autoAssociation']===0x0){return db[_0xcac1('0x27')][_0xcac1('0x45')]({'name':_0x8b5df1[_0xcac1('0x28')],'resourceId':_0x8b5df1['id'],'type':_0x357695[_0xcac1('0x28')],'sectionId':_0x357695['id']},{})[_0xcac1('0x24')](function(){return _0x1df035;});}else{return _0x1df035;}})['catch'](function(_0x4232c1){logger[_0xcac1('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4232c1);throw _0x4232c1;});}return _0x1df035;})[_0xcac1('0x24')](respondWithResult(_0x19c46e,0xc9))[_0xcac1('0x1b')](handleError(_0x19c46e,null));};exports[_0xcac1('0x23')]=function(_0x2d5b22,_0x1d9737){if(_0x2d5b22[_0xcac1('0x46')]['id']){delete _0x2d5b22['body']['id'];}return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x2d5b22[_0xcac1('0x41')]['id']},'include':[{'model':db['Pause'],'as':_0xcac1('0x2c')}]})[_0xcac1('0x24')](handleEntityNotFound(_0x1d9737,null))[_0xcac1('0x24')](saveUpdates(_0x2d5b22[_0xcac1('0x46')],null))[_0xcac1('0x24')](respondWithResult(_0x1d9737,null))['catch'](handleError(_0x1d9737,null));};exports['destroy']=function(_0x3a0b5b,_0x38288a){return db['ChatWebsite'][_0xcac1('0x44')]({'where':{'id':_0x3a0b5b['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x38288a,null))[_0xcac1('0x24')](removeEntity(_0x38288a,null))[_0xcac1('0x1b')](handleError(_0x38288a,null));};exports['describe']=function(_0x2c9ab8,_0x483756){return db[_0xcac1('0x2e')][_0xcac1('0x4b')]()[_0xcac1('0x24')](respondWithResult(_0x483756,null))[_0xcac1('0x1b')](handleError(_0x483756,null));};exports['addDisposition']=function(_0x1ca950,_0x23ee46){if(_0x1ca950[_0xcac1('0x46')]['id']){delete _0x1ca950[_0xcac1('0x46')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1ca950[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x23ee46,null))[_0xcac1('0x24')](function(_0x3cda0b){if(_0x3cda0b){_0x1ca950['body'][_0xcac1('0x4c')]=_0x3cda0b['id'];return db[_0xcac1('0x4d')][_0xcac1('0x45')](_0x1ca950[_0xcac1('0x46')]);}})[_0xcac1('0x24')](respondWithResult(_0x23ee46,null))[_0xcac1('0x1b')](handleError(_0x23ee46,null));};exports[_0xcac1('0x4e')]=function(_0x608a67,_0xdf5f7a){var _0x335b4d={'raw':![],'where':{}};var _0x39c2ae={};var _0x43ff79={'count':0x0,'rows':[]};return db[_0xcac1('0x2e')]['findOne']({'where':{'id':_0x608a67[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0xdf5f7a,null))[_0xcac1('0x24')](function(_0x1fe63b){if(_0x1fe63b){_0x39c2ae[_0xcac1('0x36')]=_[_0xcac1('0x33')](db[_0xcac1('0x4d')][_0xcac1('0x2f')]);_0x39c2ae['query']=_[_0xcac1('0x33')](_0x608a67['query']);_0x39c2ae[_0xcac1('0x34')]=_[_0xcac1('0x35')](_0x39c2ae[_0xcac1('0x36')],_0x39c2ae[_0xcac1('0x32')]);_0x335b4d[_0xcac1('0x37')]=_[_0xcac1('0x35')](_0x39c2ae[_0xcac1('0x36')],qs[_0xcac1('0x38')](_0x608a67['query'][_0xcac1('0x38')]));_0x335b4d[_0xcac1('0x37')]=_0x335b4d[_0xcac1('0x37')][_0xcac1('0x39')]?_0x335b4d['attributes']:_0x39c2ae[_0xcac1('0x36')];if(!_0x608a67['query'][_0xcac1('0x4f')](_0xcac1('0x50'))){_0x335b4d[_0xcac1('0x21')]=qs[_0xcac1('0x21')](_0x608a67[_0xcac1('0x32')][_0xcac1('0x21')]);_0x335b4d[_0xcac1('0x20')]=qs['offset'](_0x608a67[_0xcac1('0x32')][_0xcac1('0x20')]);}_0x335b4d[_0xcac1('0x51')]=qs[_0xcac1('0x3a')](_0x608a67['query'][_0xcac1('0x3a')]);_0x335b4d['where']=qs[_0xcac1('0x34')](_['pick'](_0x608a67[_0xcac1('0x32')],_0x39c2ae[_0xcac1('0x34')]));_0x335b4d[_0xcac1('0x3d')]['ChatWebsiteId']=_0x1fe63b['id'];if(_0x608a67['query']['filter']){_0x335b4d[_0xcac1('0x3d')]=_[_0xcac1('0x52')](_0x335b4d[_0xcac1('0x3d')],{'$or':_[_0xcac1('0x2d')](_0x335b4d['attributes'],function(_0x35a5be){var _0x377f5b={};_0x377f5b[_0x35a5be]={'$like':'%'+_0x608a67['query'][_0xcac1('0x3c')]+'%'};return _0x377f5b;})});}_0x335b4d=_[_0xcac1('0x52')]({},_0x335b4d,_0x608a67[_0xcac1('0x43')]);return db[_0xcac1('0x4d')][_0xcac1('0x22')]({'where':_0x335b4d[_0xcac1('0x3d')]})['then'](function(_0x1e084e){_0x43ff79[_0xcac1('0x22')]=_0x1e084e;if(_0x608a67[_0xcac1('0x32')][_0xcac1('0x42')]){_0x335b4d['include']=[{'all':!![]}];}return db[_0xcac1('0x4d')][_0xcac1('0x53')](_0x335b4d);})[_0xcac1('0x24')](function(_0x6f8739){_0x43ff79['rows']=_0x6f8739;return _0x43ff79;});}})['then'](respondWithFilteredResult(_0xdf5f7a,_0x335b4d))[_0xcac1('0x1b')](handleError(_0xdf5f7a,null));};exports[_0xcac1('0x54')]=function(_0x3c889d,_0x3727c5){return db[_0xcac1('0x2e')]['find']({'where':{'id':_0x3c889d[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x3727c5,null))['then'](function(_0x365804){if(_0x365804){return _0x365804[_0xcac1('0x54')](_0x3c889d[_0xcac1('0x32')]['ids']);}})[_0xcac1('0x24')](respondWithStatusCode(_0x3727c5,null))['catch'](handleError(_0x3727c5,null));};exports[_0xcac1('0x55')]=function(_0x13d294,_0x247b19){if(_0x13d294[_0xcac1('0x46')]['id']){delete _0x13d294[_0xcac1('0x46')]['id'];}return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x13d294['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x247b19,null))['then'](function(_0x3dd4d7){if(_0x3dd4d7){_0x13d294['body'][_0xcac1('0x4c')]=_0x3dd4d7['id'];return db[_0xcac1('0x56')][_0xcac1('0x45')](_0x13d294['body']);}})[_0xcac1('0x24')](respondWithResult(_0x247b19,null))[_0xcac1('0x1b')](handleError(_0x247b19,null));};exports[_0xcac1('0x57')]=function(_0x23f3e1,_0x5d6011){var _0x344f83={'raw':![],'where':{}};var _0x195dbd={};var _0x12b66b={'count':0x0,'rows':[]};return db[_0xcac1('0x2e')][_0xcac1('0x58')]({'where':{'id':_0x23f3e1['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x5d6011,null))[_0xcac1('0x24')](function(_0x575d6b){if(_0x575d6b){_0x195dbd['model']=_[_0xcac1('0x33')](db[_0xcac1('0x56')][_0xcac1('0x2f')]);_0x195dbd[_0xcac1('0x32')]=_[_0xcac1('0x33')](_0x23f3e1[_0xcac1('0x32')]);_0x195dbd[_0xcac1('0x34')]=_['intersection'](_0x195dbd[_0xcac1('0x36')],_0x195dbd[_0xcac1('0x32')]);_0x344f83[_0xcac1('0x37')]=_['intersection'](_0x195dbd[_0xcac1('0x36')],qs[_0xcac1('0x38')](_0x23f3e1[_0xcac1('0x32')][_0xcac1('0x38')]));_0x344f83[_0xcac1('0x37')]=_0x344f83[_0xcac1('0x37')]['length']?_0x344f83[_0xcac1('0x37')]:_0x195dbd[_0xcac1('0x36')];if(!_0x23f3e1['query'][_0xcac1('0x4f')](_0xcac1('0x50'))){_0x344f83[_0xcac1('0x21')]=qs[_0xcac1('0x21')](_0x23f3e1[_0xcac1('0x32')]['limit']);_0x344f83[_0xcac1('0x20')]=qs[_0xcac1('0x20')](_0x23f3e1[_0xcac1('0x32')][_0xcac1('0x20')]);}_0x344f83['order']=qs['sort'](_0x23f3e1[_0xcac1('0x32')][_0xcac1('0x3a')]);_0x344f83[_0xcac1('0x3d')]=qs[_0xcac1('0x34')](_[_0xcac1('0x3b')](_0x23f3e1['query'],_0x195dbd[_0xcac1('0x34')]));_0x344f83[_0xcac1('0x3d')][_0xcac1('0x4c')]=_0x575d6b['id'];if(_0x23f3e1[_0xcac1('0x32')][_0xcac1('0x3c')]){_0x344f83[_0xcac1('0x3d')]=_[_0xcac1('0x52')](_0x344f83['where'],{'$or':_[_0xcac1('0x2d')](_0x344f83[_0xcac1('0x37')],function(_0x597677){var _0x1edfd8={};_0x1edfd8[_0x597677]={'$like':'%'+_0x23f3e1['query'][_0xcac1('0x3c')]+'%'};return _0x1edfd8;})});}_0x344f83=_[_0xcac1('0x52')]({},_0x344f83,_0x23f3e1[_0xcac1('0x43')]);return db[_0xcac1('0x56')][_0xcac1('0x22')]({'where':_0x344f83[_0xcac1('0x3d')]})[_0xcac1('0x24')](function(_0x1a829f){_0x12b66b['count']=_0x1a829f;if(_0x23f3e1['query']['includeAll']){_0x344f83[_0xcac1('0x3f')]=[{'all':!![]}];}return db[_0xcac1('0x56')][_0xcac1('0x53')](_0x344f83);})[_0xcac1('0x24')](function(_0x43103f){_0x12b66b['rows']=_0x43103f;return _0x12b66b;});}})[_0xcac1('0x24')](respondWithFilteredResult(_0x5d6011,_0x344f83))['catch'](handleError(_0x5d6011,null));};exports[_0xcac1('0x59')]=function(_0x1239dc,_0x52e008){return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x1239dc[_0xcac1('0x41')]['id']}})['then'](handleEntityNotFound(_0x52e008,null))[_0xcac1('0x24')](function(_0x44b13f){if(_0x44b13f){return _0x44b13f['removeAnswers'](_0x1239dc[_0xcac1('0x32')][_0xcac1('0x5a')]);}})[_0xcac1('0x24')](respondWithStatusCode(_0x52e008,null))['catch'](handleError(_0x52e008,null));};exports[_0xcac1('0x5b')]=function(_0x29712b,_0x5ab2b){_0x29712b[_0xcac1('0x46')][_0xcac1('0x5c')]=_0x29712b['file'][_0xcac1('0x5d')];return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x29712b[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x5ab2b,null))[_0xcac1('0x24')](saveUpdates(_0x29712b[_0xcac1('0x46')],null))[_0xcac1('0x24')](respondWithResult(_0x5ab2b,null))[_0xcac1('0x1b')](handleError(_0x5ab2b,null));};exports['addAvatar']=function(_0x4a2a36,_0x35a91f){_0x4a2a36[_0xcac1('0x46')]['agentAvatar']=_0x4a2a36[_0xcac1('0x5e')][_0xcac1('0x5d')];return db[_0xcac1('0x2e')]['find']({'where':{'id':_0x4a2a36[_0xcac1('0x41')]['id']}})['then'](handleEntityNotFound(_0x35a91f,null))[_0xcac1('0x24')](saveUpdates(_0x4a2a36[_0xcac1('0x46')],null))['then'](respondWithResult(_0x35a91f,null))[_0xcac1('0x1b')](handleError(_0x35a91f,null));};exports[_0xcac1('0x5f')]=function(_0x4f490a,_0x1ef4d8){_0x4f490a[_0xcac1('0x46')][_0xcac1('0x60')]=_0x4f490a[_0xcac1('0x5e')][_0xcac1('0x5d')];return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x4f490a['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x1ef4d8,null))[_0xcac1('0x24')](saveUpdates(_0x4f490a[_0xcac1('0x46')],null))[_0xcac1('0x24')](respondWithResult(_0x1ef4d8,null))[_0xcac1('0x1b')](handleError(_0x1ef4d8,null));};exports[_0xcac1('0x61')]=function(_0x276d83,_0x31a1c7){_0x276d83[_0xcac1('0x46')][_0xcac1('0x62')]=_0x276d83[_0xcac1('0x5e')]['filename'];return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x276d83['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x31a1c7,null))[_0xcac1('0x24')](saveUpdates(_0x276d83[_0xcac1('0x46')],null))['then'](respondWithResult(_0x31a1c7,null))[_0xcac1('0x1b')](handleError(_0x31a1c7,null));};exports[_0xcac1('0x63')]=function(_0x34f4a2,_0x39d13e){var _0x11f278=path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x66'));var _0x569bf3={'where':{'id':_0x34f4a2[_0xcac1('0x41')]['id']},'attributes':['id',_0xcac1('0x5c')],'raw':!![]};var _0x15eb92=![];return require(_0xcac1('0x67'))['getLicense']()[_0xcac1('0x24')](function(_0xba5ea7){if(_0xba5ea7){_0x15eb92=_0xba5ea7[_0xcac1('0x68')];}})[_0xcac1('0x24')](function(){return db[_0xcac1('0x2e')][_0xcac1('0x44')](_0x569bf3);})[_0xcac1('0x24')](handleEntityNotFound(_0x39d13e,null))[_0xcac1('0x24')](function(_0x108229){if(_0x108229){if(!_['isNil'](_0x108229[_0xcac1('0x5c')])){if(fs[_0xcac1('0x69')](path['join'](config[_0xcac1('0x65')],_0xcac1('0x6a'),_0x108229['sitepic']))&&_0x15eb92){_0x11f278=path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x6a'),_0x108229[_0xcac1('0x5c')]);}}return _0x39d13e[_0xcac1('0x6b')](_0x11f278);}})[_0xcac1('0x1b')](handleError(_0x39d13e,null));};exports[_0xcac1('0x6c')]=function(_0x203e04,_0x36d05d){var _0x4ff1a0=path[_0xcac1('0x64')](config['root'],_0xcac1('0x6d'));var _0x282ffe={'where':{'id':_0x203e04[_0xcac1('0x41')]['id']},'attributes':['id',_0xcac1('0x6e')],'raw':!![]};return db['ChatWebsite']['find'](_0x282ffe)[_0xcac1('0x24')](handleEntityNotFound(_0x36d05d,null))['then'](function(_0x269d63){if(_0x269d63){if(!_[_0xcac1('0x6f')](_0x269d63[_0xcac1('0x6e')])){if(fs[_0xcac1('0x69')](path['join'](config[_0xcac1('0x65')],_0xcac1('0x70'),_0x269d63['agentAvatar']))){_0x4ff1a0=path['join'](config[_0xcac1('0x65')],'server/files/images/avatars/',_0x269d63[_0xcac1('0x6e')]);}}return _0x36d05d[_0xcac1('0x6b')](_0x4ff1a0);}})[_0xcac1('0x1b')](handleError(_0x36d05d,null));};exports[_0xcac1('0x71')]=function(_0x2fa994,_0x1a440f){var _0x391346=path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x72'));var _0x457b1a={'where':{'id':_0x2fa994['params']['id']},'attributes':['id',_0xcac1('0x60'),'showCustomerAvatar'],'raw':!![]};return db[_0xcac1('0x2e')][_0xcac1('0x44')](_0x457b1a)[_0xcac1('0x24')](handleEntityNotFound(_0x1a440f,null))[_0xcac1('0x24')](function(_0x3e3318){if(_0x3e3318){if(!_[_0xcac1('0x6f')](_0x3e3318[_0xcac1('0x60')])){if(fs[_0xcac1('0x69')](path[_0xcac1('0x64')](config['root'],'server/files/images/avatars/',_0x3e3318[_0xcac1('0x60')]))&&_0x3e3318['showCustomerAvatar']){_0x391346=path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x70'),_0x3e3318[_0xcac1('0x60')]);}}return _0x1a440f[_0xcac1('0x6b')](_0x391346);}})['catch'](handleError(_0x1a440f,null));};exports[_0xcac1('0x73')]=function(_0x2b83b5,_0x1fecfd){var _0x6f3c95=path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x74'));var _0x585b2d={'where':{'id':_0x2b83b5['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xcac1('0x2e')][_0xcac1('0x44')](_0x585b2d)[_0xcac1('0x24')](handleEntityNotFound(_0x1fecfd,null))[_0xcac1('0x24')](function(_0x278202){if(_0x278202){if(!_['isNil'](_0x278202[_0xcac1('0x62')])){if(fs[_0xcac1('0x69')](path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x70'),_0x278202['systemAvatar']))){_0x6f3c95=path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x70'),_0x278202[_0xcac1('0x62')]);}}return _0x1fecfd['download'](_0x6f3c95);}})[_0xcac1('0x1b')](handleError(_0x1fecfd,null));};exports['notify']=function(_0x32d1ac,_0x4a565a){var _0x5a936d=require('user-agent-parser');var _0x284011=new _0x5a936d();var _0x53b0d7=_0x284011[_0xcac1('0x75')](_0x32d1ac[_0xcac1('0x76')][_0xcac1('0x77')])[_0xcac1('0x78')]();var _0x3f3401={'body':_0x32d1ac[_0xcac1('0x46')],'channel':_0xcac1('0x79')};var _0x4ab41f=[];var _0x40377f=[];var _0x4caee7={};var _0x1bba50=![];return db[_0xcac1('0x7a')][_0xcac1('0x4b')]()[_0xcac1('0x24')](function(_0x22d815){if(!_0x22d815){throw new db[(_0xcac1('0x7b'))]['ValidationError'](_0xcac1('0x7c'));}_0x4ab41f=_[_0xcac1('0x7d')](_[_0xcac1('0x33')](_0x22d815),[_0xcac1('0x7e'),_0xcac1('0x7f')]);_0x40377f=_[_0xcac1('0x7d')](_[_0xcac1('0x33')](_0x22d815),[_0xcac1('0x7e'),_0xcac1('0x7f'),_0xcac1('0x80'),'ListId']);if(_0x32d1ac[_0xcac1('0x46')]['id']){delete _0x32d1ac['body']['id'];}if(_[_0xcac1('0x6f')](_0x32d1ac[_0xcac1('0x46')][_0xcac1('0x81')])){throw new db[(_0xcac1('0x7b'))][(_0xcac1('0x82'))](_0xcac1('0x83'));}if(_[_0xcac1('0x6f')](_0x32d1ac[_0xcac1('0x46')][_0xcac1('0x46')])||_0x32d1ac['body']['body']===''){throw new db[(_0xcac1('0x7b'))][(_0xcac1('0x82'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x32d1ac[_0xcac1('0x46')][_0xcac1('0x84')])){throw new db[(_0xcac1('0x7b'))][(_0xcac1('0x82'))](_0xcac1('0x85')+_0x40377f);}if(!_[_0xcac1('0x86')](_0x40377f,_0x32d1ac['body'][_0xcac1('0x84')])){throw new db[(_0xcac1('0x7b'))][(_0xcac1('0x82'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x40377f);}_0x4caee7[_0x32d1ac[_0xcac1('0x46')][_0xcac1('0x84')]]=_0x32d1ac[_0xcac1('0x46')][_0xcac1('0x81')];})[_0xcac1('0x24')](function(){return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x32d1ac[_0xcac1('0x41')]['id']},'include':[{'model':db[_0xcac1('0x87')],'as':_0xcac1('0x88'),'include':[{'model':db[_0xcac1('0x7a')],'as':'Contacts','where':_0x4caee7,'limit':0x1,'order':[[_0xcac1('0x7f'),_0xcac1('0x89')]]}]},{'model':db[_0xcac1('0x8a')],'as':_0xcac1('0x8b')}]});})[_0xcac1('0x24')](handleEntityNotFound(_0x4a565a,null))[_0xcac1('0x24')](function(_0x58b2f2){if(_0x58b2f2&&_0x58b2f2[_0xcac1('0x88')]){_0x3f3401[_0xcac1('0x8c')]=_0x58b2f2;_0x3f3401[_0xcac1('0x8d')]=_0x58b2f2[_0xcac1('0x8b')];_0x3f3401[_0xcac1('0x8e')]=_0x58b2f2[_0xcac1('0x88')];_0x3f3401['applications']=_[_0xcac1('0x8f')](_0x3f3401[_0xcac1('0x8d')],[_0xcac1('0x90')],['asc']);if(_0x3f3401['account'][_0xcac1('0x8b')]){delete _0x3f3401['account'][_0xcac1('0x8b')];}if(_0x3f3401[_0xcac1('0x8c')]['List']&&_0x3f3401[_0xcac1('0x8c')][_0xcac1('0x88')]['Contacts'][_0xcac1('0x39')]){return _0x3f3401[_0xcac1('0x8c')][_0xcac1('0x88')]['Contacts'][0x0];}var _0x141fec=_[_0xcac1('0xb')](_0x32d1ac[_0xcac1('0x46')],{'firstName':_0x32d1ac[_0xcac1('0x46')]['from'],'ListId':_0x58b2f2[_0xcac1('0x91')]});_0x141fec[_0x32d1ac['body']['mapKey']]=_0x32d1ac[_0xcac1('0x46')]['from'];return db[_0xcac1('0x7a')][_0xcac1('0x45')](_0x141fec,{'fields':_0x4ab41f,'raw':!![]});}})['then'](handleEntityNotFound(_0x4a565a,null))['then'](function(_0x4555b7){_0x3f3401[_0xcac1('0x92')]=_0x4555b7;var _0x8df7d9=_0x32d1ac['body'][_0xcac1('0x93')];if(_0x32d1ac[_0xcac1('0x76')][_0xcac1('0x94')]){_0x8df7d9=_0x32d1ac[_0xcac1('0x76')][_0xcac1('0x94')];}else if(_0x32d1ac[_0xcac1('0x76')]['x-forwarded-for']){_0x8df7d9=_['first'](_0x32d1ac[_0xcac1('0x76')][_0xcac1('0x95')][_0xcac1('0x96')](','));}if(_0x4555b7){var _0x29c1c5={'ContactId':_0x4555b7['id'],'ChatWebsiteId':_0x32d1ac['params']['id'],'from':(_0x4555b7[_0xcac1('0x97')]||'')+'\x20'+(_0x4555b7[_0xcac1('0x98')]||''),'customerIp':_0x8df7d9,'customerPort':_0x32d1ac[_0xcac1('0x76')]['x-real-port']?_0x32d1ac[_0xcac1('0x76')][_0xcac1('0x99')]:null,'referer':_0x32d1ac[_0xcac1('0x46')][_0xcac1('0x9a')],'browserName':_0x53b0d7[_0xcac1('0x9b')]['name']&&_0x53b0d7[_0xcac1('0x9b')][_0xcac1('0x9c')]?util[_0xcac1('0x9d')](_0xcac1('0x9e'),_0x53b0d7['browser'][_0xcac1('0x28')],_0x53b0d7[_0xcac1('0x9b')][_0xcac1('0x9c')]):_0xcac1('0x9f'),'browserVersion':_0x53b0d7[_0xcac1('0x9b')][_0xcac1('0x9c')]||_0xcac1('0x9f'),'osName':util[_0xcac1('0x9d')](_0xcac1('0x9e'),_0x53b0d7['os']['name'],_0x53b0d7['os']['version']),'osVersion':_0x53b0d7['os']['version'],'deviceModel':_0x53b0d7[_0xcac1('0xa0')]['model']&&_0x53b0d7['device'][_0xcac1('0xa1')]?util['format'](_0xcac1('0xa2'),_0x53b0d7[_0xcac1('0xa0')][_0xcac1('0x36')],_0x53b0d7[_0xcac1('0xa0')][_0xcac1('0xa1')],_0x53b0d7[_0xcac1('0xa0')][_0xcac1('0x30')]):null,'deviceVendor':_0x53b0d7[_0xcac1('0xa0')][_0xcac1('0xa1')],'deviceType':_0x53b0d7['device'][_0xcac1('0x30')],'formData':JSON[_0xcac1('0x17')](_0x32d1ac[_0xcac1('0x46')])};var _0x521b2c={'ChatWebsiteId':_0x32d1ac[_0xcac1('0x41')]['id'],'closed':![]};if(_0x32d1ac[_0xcac1('0x46')][_0xcac1('0xa3')]){_0x521b2c[_0xcac1('0xa3')]=_0x32d1ac[_0xcac1('0x46')][_0xcac1('0xa3')];return db['ChatInteraction'][_0xcac1('0x44')]({'where':_0x521b2c})[_0xcac1('0x24')](function(_0x5a504f){if(_0x5a504f){return[_0x5a504f,![]];}_0x29c1c5[_0xcac1('0xa3')]=_0x32d1ac[_0xcac1('0x46')]['threadId'];_0x29c1c5[_0xcac1('0xa4')]=_0x32d1ac[_0xcac1('0x46')][_0xcac1('0xa4')];return db[_0xcac1('0xa5')][_0xcac1('0x45')](_0x29c1c5)[_0xcac1('0x24')](function(_0x3206c9){return[_0x3206c9,!![]];});});}_0x521b2c[_0xcac1('0xa6')]=_0x4555b7['id'];if(_0x32d1ac[_0xcac1('0x46')]['interaction']&&_0x32d1ac[_0xcac1('0x46')][_0xcac1('0xa7')]['id']){_0x521b2c['id']=_0x32d1ac['body'][_0xcac1('0xa7')]['id'];return db[_0xcac1('0xa5')][_0xcac1('0x44')]({'where':_0x521b2c})[_0xcac1('0x24')](function(_0x31664c){if(_0x31664c){return[_0x31664c,![]];}return db[_0xcac1('0xa5')][_0xcac1('0x45')](_0x29c1c5)['then'](function(_0x5f096a){return[_0x5f096a,!![]];});});}return db[_0xcac1('0xa5')]['create'](_0x29c1c5)['then'](function(_0x3c110e){return[_0x3c110e,!![]];});}})[_0xcac1('0xa8')](function(_0xf42d5,_0x3b5936){if(_0xf42d5){_0x1bba50=_0x3b5936;if(!_0x3b5936){var _0x17b9bd={'from':(_0x3f3401[_0xcac1('0x92')][_0xcac1('0x97')]||'')+'\x20'+(_0x3f3401[_0xcac1('0x92')][_0xcac1('0x98')]||'')};if(_0x32d1ac[_0xcac1('0x46')][_0xcac1('0xa3')]&&_0x32d1ac['body'][_0xcac1('0xa9')]&&_0x32d1ac['body'][_0xcac1('0xa3')]!=_0x32d1ac['body'][_0xcac1('0xa9')]){_0x17b9bd['threadId']=_0x32d1ac['body'][_0xcac1('0xa9')];}return _0xf42d5[_0xcac1('0x23')](_0x17b9bd);}else{return _0xf42d5;}}})[_0xcac1('0x24')](function(_0x345c8a){_0x3f3401[_0xcac1('0xa7')]=_0x345c8a[_0xcac1('0x26')]({'plain':!![]});_0x3f3401[_0xcac1('0xa7')][_0xcac1('0xaa')]=_0x1bba50;if(_0x3f3401[_0xcac1('0xa7')][_0xcac1('0xaa')]){if(_0x3f3401[_0xcac1('0x8c')][_0xcac1('0xab')]){_0x3f3401['applications'][_0xcac1('0xac')]({'id':0x0,'priority':_0x3f3401[_0xcac1('0x8d')]['length']+0x1,'app':_0xcac1('0xad'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xcac1('0xae')][_0xcac1('0x45')]({'body':_0x32d1ac[_0xcac1('0x46')][_0xcac1('0x46')],'ChatWebsiteId':_0x32d1ac['params']['id'],'ChatInteractionId':_0x345c8a['id'],'direction':'in','ContactId':_0x3f3401[_0xcac1('0x92')]['id'],'AttachmentId':_0x32d1ac[_0xcac1('0x46')][_0xcac1('0xaf')]});})[_0xcac1('0x24')](function(_0x2b194e){_0x3f3401[_0xcac1('0x1a')]=_0x2b194e;if(_0x3f3401[_0xcac1('0xa7')][_0xcac1('0xb0')]){return db[_0xcac1('0xb1')][_0xcac1('0x44')]({'attributes':['id',_0xcac1('0x28')],'where':{'id':_0x3f3401[_0xcac1('0xa7')][_0xcac1('0xb0')]}})['then'](function(_0x14f2b3){if(_0x14f2b3){_0x3f3401[_0xcac1('0x8d')][_0xcac1('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x14f2b3[_0xcac1('0x28')]+','+(_0x3f3401[_0xcac1('0x8c')][_0xcac1('0xb3')]||0xa),'interval':_0xcac1('0xb4')});_0x3f3401[_0xcac1('0xb5')]=!![];}return respondWithRpcPromise(_0xcac1('0xb6'),_0xcac1('0xb7'),_0x3f3401);});}return respondWithRpcPromise(_0xcac1('0xb6'),'startRouting',_0x3f3401);})[_0xcac1('0x24')](function(_0x36032e){respondWithRpcPromise(_0xcac1('0xb8'),'EventManager',{'event':_0xcac1('0xb9'),'message':_0x36032e},client9002);return _0x36032e;})[_0xcac1('0x24')](respondWithResult(_0x4a565a,null))['catch'](handleError(_0x4a565a,null));};exports[_0xcac1('0xba')]=function(_0xa7e9a5,_0x490d58){var _0x45b0e7,_0xcf67e,_0x342f2c;var _0x59690e=[];var _0x5a876e={};var _0x2a8b12=_0xa7e9a5[_0xcac1('0xbb')]||[];var _0x4e32ec=[];var _0x475092;return db['CmContact'][_0xcac1('0x4b')]()[_0xcac1('0x24')](function(_0x3ef001){if(!_0x3ef001){throw new db[(_0xcac1('0x7b'))][(_0xcac1('0x82'))](_0xcac1('0x7c'));}_0x59690e=_[_0xcac1('0x7d')](_[_0xcac1('0x33')](_0x3ef001),['createdAt',_0xcac1('0x7f'),'CompanyId',_0xcac1('0x91')]);if(_0xa7e9a5[_0xcac1('0x46')]['id']){delete _0xa7e9a5[_0xcac1('0x46')]['id'];}if(_[_0xcac1('0x6f')](_0xa7e9a5[_0xcac1('0x46')]['from'])){throw _0x490d58['status'](0x1f4)[_0xcac1('0x29')](new db[(_0xcac1('0x7b'))]['ValidationError'](_0xcac1('0x83')));}if(_[_0xcac1('0x6f')](_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0x46')])||_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0x46')]===''){throw _0x490d58['status'](0x1f4)[_0xcac1('0x29')](new db[(_0xcac1('0x7b'))][(_0xcac1('0x82'))](_0xcac1('0xbc')));}if(_[_0xcac1('0x6f')](_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0xbd')])){throw _0x490d58[_0xcac1('0x1d')](0x1f4)[_0xcac1('0x29')](new db[(_0xcac1('0x7b'))]['ValidationError'](_0xcac1('0xbe')+_0x59690e));}if(!_['includes'](_0x59690e,_0xa7e9a5[_0xcac1('0x46')]['mapKeyOffline'])){throw _0x490d58['status'](0x1f4)['send'](new db[(_0xcac1('0x7b'))][(_0xcac1('0x82'))](_0xcac1('0xbf')+_0x59690e));}_0x5a876e[_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0xbd')]]=_0xa7e9a5[_0xcac1('0x46')]['from'];})[_0xcac1('0x24')](function(){return db['ChatWebsite']['find']({'where':{'id':_0xa7e9a5[_0xcac1('0x41')]['id']},'include':[{'model':db[_0xcac1('0x87')],'as':_0xcac1('0x88')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xcac1('0x24')](handleEntityNotFound(_0x490d58,null))[_0xcac1('0x24')](function(_0x386a8c){if(_0x386a8c&&_0x386a8c[_0xcac1('0x88')]){_0xcf67e=_0x386a8c;var _0x28eded=_[_0xcac1('0xb')](_0xa7e9a5[_0xcac1('0x46')],{'firstName':_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0x81')],'phone':_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0x81')],'ListId':_0x386a8c[_0xcac1('0x91')]});_0x28eded[_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0xbd')]]=_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0x81')];return db[_0xcac1('0x7a')]['findOrCreate']({'where':_0x5a876e,'defaults':_0x28eded});}})['spread'](function(_0x53af1d){if(_0x53af1d){_0x342f2c=_0x53af1d;var _0x85292=fs[_0xcac1('0xc0')](path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0xc1')),_0xcac1('0xc2'));var _0x5001b3=ejs[_0xcac1('0xc3')](_0x85292,{'body':_[_0xcac1('0xc4')](_0xa7e9a5[_0xcac1('0x46')][_0xcac1('0x46')]),'bodyTitle':_0xcf67e[_0xcac1('0xc5')]});return db[_0xcac1('0xc6')][_0xcac1('0x45')]({'body':_0x5001b3,'plainBody':htmlToText[_0xcac1('0xc7')](_0x5001b3),'ContactId':_0x53af1d['id'],'ChatWebsiteId':_0xcf67e['id']});}})[_0xcac1('0x24')](function(_0x39adf6){_0x475092=_0x39adf6;if(_0x2a8b12[_0xcac1('0x39')]){var _0x4b52f3=_0x2a8b12[_0xcac1('0x2d')](function(_0x2b8a99){return{'name':_0x2b8a99[_0xcac1('0xc8')],'basename':_0x2b8a99[_0xcac1('0x5d')],'type':_0x2b8a99[_0xcac1('0xc9')],'ChatOfflineMessageId':_0x39adf6['id']};});_0x4e32ec=_0x4b52f3[_0xcac1('0x2d')](_0x11aa8a=>{var _0x1006c1={'filename':_0x11aa8a[_0xcac1('0x28')],'path':path['join'](config[_0xcac1('0x65')],_0xcac1('0xca'),_0xcac1('0xbb'),'attachments','offline-chat',_0x11aa8a[_0xcac1('0xcb')])};return _0x1006c1;});if(!_0xcf67e[_0xcac1('0xcc')]){return db[_0xcac1('0xcd')]['transaction'](function(_0x251041){return db[_0xcac1('0xce')]['bulkCreate'](_0x4b52f3,{'transaction':_0x251041});});}}})[_0xcac1('0x24')](function(){if(_0x475092){_0x45b0e7=_0x475092;return db['MailAccount'][_0xcac1('0x58')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xcac1('0xcf'),'raw':!![],'include':[{'model':db[_0xcac1('0xd0')],'as':_0xcac1('0xd0'),'raw':!![]}]}]});}})[_0xcac1('0x24')](function(_0x43c1a4){if(_0x43c1a4&&_0x43c1a4[_0xcac1('0xcf')]&&_0xcf67e[_0xcac1('0xd1')]&&_0xcf67e[_0xcac1('0xd2')]){var _0x1a9e22=_0x43c1a4[_0xcac1('0xd3')]();return respondWithRpcPromise(_0xcac1('0xd4'),_0xcac1('0xd5'),{'account':_0x1a9e22,'message':{'from':util['format'](_0xcac1('0xd6'),_0x43c1a4[_0xcac1('0x28')],_0x43c1a4[_0xcac1('0xd7')]||_0x43c1a4[_0xcac1('0xcf')][_0xcac1('0x47')]),'to':_0xcf67e['forwardOfflineAddress'],'subject':_0xcf67e['offlineMessageSubject'],'html':_0x45b0e7[_0xcac1('0x46')],'attachments':_0x4e32ec}},client9003)[_0xcac1('0x24')](function(){return _0x45b0e7;})['catch'](function(_0x5e2ccb){logger[_0xcac1('0x18')](_0x5e2ccb);});}})[_0xcac1('0x24')](function(){if(_0xcf67e&&_0xcf67e[_0xcac1('0xcc')]&&_0xcf67e[_0xcac1('0xd8')]){var _0x22a1ef=[];if(_0x2a8b12[_0xcac1('0x39')]){_0x22a1ef=_0x2a8b12['map'](function(_0x249611){return{'name':_0x249611['originalname'],'basename':_0x249611[_0xcac1('0x5d')],'type':_0x249611[_0xcac1('0xc9')],'ChatOfflineMessageId':_0x475092['id']};});}var _0x41c17a;if(!_[_0xcac1('0x6f')](_0xcf67e[_0xcac1('0xd9')])){var _0x89289=_['map'](_0xa7e9a5[_0xcac1('0x46')],function(_0x59c9e8){return _0x59c9e8;});var _0x296974=_[_0xcac1('0xda')](_0x89289)[0x0];var _0x36ea23=_[_0xcac1('0xdb')](_0x296974,function(_0x1fec0c){return _0x1fec0c;});_0x41c17a=_0x36ea23[0x1][_0xcf67e[_0xcac1('0xd9')]];}var _0x156471={'from':_0x342f2c[_0xcac1('0xd7')],'firstName':_0x342f2c[_0xcac1('0x97')],'lastName':_0x342f2c[_0xcac1('0x98')],'mapKey':_0xcac1('0xd7'),'message':{'from':_0x342f2c[_0xcac1('0xd7')],'to':_0xcf67e[_0xcac1('0xdc')]['email'],'cc':'','subject':_[_0xcac1('0x6f')](_0x41c17a)?_0xcf67e[_0xcac1('0xdd')]:_0x41c17a,'messageId':'','sentAt':new Date(),'attach':_0x22a1ef[_0xcac1('0x39')],'attachments':_0x22a1ef,'originChannel':_0xcac1('0xde'),'ChatWebsiteId':_0xcf67e['id'],'ChatOfflineMessageId':_0x45b0e7['id'],'originTo':_0xcf67e['MailAccount'][_0xcac1('0xd7')]},'body':_0x45b0e7[_0xcac1('0x46')]};var _0x2bde7a={'account':{'id':_0xcf67e[_0xcac1('0xd8')]},'body':_0x156471,'log':_0xcac1('0xdf')};return respondWithRpcPromise('NotifyMailAccount',_0xcac1('0xe0'),_0x2bde7a,client9001)[_0xcac1('0x24')](function(){return _0x45b0e7;})[_0xcac1('0x1b')](function(_0x1bebb3){logger[_0xcac1('0x18')](_0x1bebb3);});}return;})[_0xcac1('0x24')](function(){if(_0x45b0e7){return _0x45b0e7;}})[_0xcac1('0x24')](respondWithResult(_0x490d58,null))[_0xcac1('0x1b')](function(_0x4874ec){logger[_0xcac1('0x18')]('catch',_0x4874ec);for(var _0x2275cf of _0x2a8b12){var _0x332fd9=path['join'](config['root'],_0xcac1('0xca'),_0xcac1('0xbb'),_0xcac1('0xe1'),_0xcac1('0xe2'),_0x2275cf[_0xcac1('0x5d')]);fs_extra[_0xcac1('0xe3')](_0x332fd9)['catch'](function(_0x43344b){logger[_0xcac1('0x18')](_0xcac1('0xe4'),_0x332fd9,_0x43344b);});}});};exports[_0xcac1('0xe5')]=function(_0x3ed91c,_0x4bc432){return db[_0xcac1('0xa5')][_0xcac1('0x44')]({'where':{'id':_0x3ed91c[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x4bc432,null))['then'](function(_0x5d047a){if(_0x5d047a){return _0x5d047a['addInteraction'](_0x3ed91c[_0xcac1('0x46')]['ids'],_[_0xcac1('0xe6')](_0x3ed91c[_0xcac1('0x46')],[_0xcac1('0x5a'),'id'])||{});}})[_0xcac1('0x24')](respondWithResult(_0x4bc432,null))['catch'](handleError(_0x4bc432,null));};exports[_0xcac1('0xe7')]=function(_0x234dde,_0x4f7e02){var _0x39d617={'raw':![],'where':{}};var _0x3c2d35={};var _0x210d43={'count':0x0,'rows':[]};return db[_0xcac1('0x2e')]['findOne']({'where':{'id':_0x234dde[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x4f7e02,null))[_0xcac1('0x24')](function(_0x3010f8){if(_0x3010f8){_0x3c2d35['model']=_[_0xcac1('0x33')](db[_0xcac1('0xa5')][_0xcac1('0x2f')]);_0x3c2d35[_0xcac1('0x32')]=_['keys'](_0x234dde[_0xcac1('0x32')]);_0x3c2d35['filters']=_[_0xcac1('0x35')](_0x3c2d35['model'],_0x3c2d35['query']);_0x39d617[_0xcac1('0x37')]=_[_0xcac1('0x35')](_0x3c2d35[_0xcac1('0x36')],qs[_0xcac1('0x38')](_0x234dde[_0xcac1('0x32')]['fields']));_0x39d617[_0xcac1('0x37')]=_0x39d617[_0xcac1('0x37')][_0xcac1('0x39')]?_0x39d617[_0xcac1('0x37')]:_0x3c2d35[_0xcac1('0x36')];if(!_0x234dde['query'][_0xcac1('0x4f')]('nolimit')){_0x39d617['limit']=qs[_0xcac1('0x21')](_0x234dde[_0xcac1('0x32')]['limit']);_0x39d617[_0xcac1('0x20')]=qs['offset'](_0x234dde[_0xcac1('0x32')][_0xcac1('0x20')]);}_0x39d617[_0xcac1('0x51')]=qs[_0xcac1('0x3a')](_0x234dde[_0xcac1('0x32')]['sort']);_0x39d617['where']=qs['filters'](_['pick'](_0x234dde[_0xcac1('0x32')],_0x3c2d35[_0xcac1('0x34')]));_0x39d617['where']['ChatWebsiteId']=_0x3010f8['id'];if(_0x234dde[_0xcac1('0x32')][_0xcac1('0x3c')]){_0x39d617['where']=_['merge'](_0x39d617[_0xcac1('0x3d')],{'$or':_[_0xcac1('0x2d')](_0x39d617[_0xcac1('0x37')],function(_0x1f65db){var _0x4e98d3={};_0x4e98d3[_0x1f65db]={'$like':'%'+_0x234dde['query']['filter']+'%'};return _0x4e98d3;})});}_0x39d617=_['merge']({},_0x39d617,_0x234dde[_0xcac1('0x43')]);return db[_0xcac1('0xa5')]['count']({'where':_0x39d617[_0xcac1('0x3d')]})[_0xcac1('0x24')](function(_0x147335){_0x210d43['count']=_0x147335;if(_0x234dde[_0xcac1('0x32')][_0xcac1('0x42')]){_0x39d617[_0xcac1('0x3f')]=[{'model':db[_0xcac1('0x7a')],'as':_0xcac1('0xe8'),'required':![]},{'model':db[_0xcac1('0xb1')],'as':_0xcac1('0xe9'),'attributes':[_0xcac1('0x28'),_0xcac1('0xea'),_0xcac1('0xeb')],'required':![]},{'model':db['Tag'],'as':_0xcac1('0xec'),'attributes':['id',_0xcac1('0x28'),_0xcac1('0xed')],'where':_0x234dde[_0xcac1('0x32')][_0xcac1('0xee')]?{'id':_0x234dde['query'][_0xcac1('0xee')]}:undefined,'required':_0x234dde[_0xcac1('0x32')]['tag']?!![]:![]}];}return db[_0xcac1('0xa5')][_0xcac1('0x53')](_0x39d617);})[_0xcac1('0x24')](function(_0x2564ac){_0x210d43[_0xcac1('0x40')]=_0x2564ac;return _0x210d43;});}})['then'](respondWithFilteredResult(_0x4f7e02,_0x39d617))[_0xcac1('0x1b')](handleError(_0x4f7e02,null));};function iftimePromise(_0x8a577a,_0x8cf5da){return respondWithRpcPromise(_0xcac1('0xef'),_0xcac1('0xf0'),{'command':_0x8cf5da[_0xcac1('0xf1')]?util[_0xcac1('0x9d')](_0xcac1('0xf2'),_0x8a577a[_0xcac1('0xf3')],_0x8cf5da[_0xcac1('0xf1')]):util['format'](_0xcac1('0xf4'),_0x8a577a[_0xcac1('0xf3')])},client9002)[_0xcac1('0x24')](function(_0x12d22a){var _0x21e89a=_0x12d22a&&_0x12d22a[_0xcac1('0xf5')](_0xcac1('0xf6'))>=0x0?!![]:![];logger[_0xcac1('0x13')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x8cf5da['id'],_0x8a577a['id'],_0x8a577a[_0xcac1('0xf3')],_0x21e89a?_0xcac1('0xf7'):_0xcac1('0xf8'),_0x8cf5da[_0xcac1('0xf1')]?_0x8cf5da[_0xcac1('0xf1')]:'No\x20timezone');return _0x21e89a;})[_0xcac1('0x1b')](function(_0x502601){logger[_0xcac1('0x18')](_0xcac1('0xf9'),_0x8cf5da['id'],_0x8a577a['id'],_0x8a577a[_0xcac1('0xf3')],util[_0xcac1('0xfa')](_0x502601,{'showHidden':![],'depth':null}),_0x8cf5da['timezone']?_0x8cf5da[_0xcac1('0xf1')]:_0xcac1('0xfb'));return![];});}exports[_0xcac1('0xf0')]=function(_0x20e1ed,_0x61d316){var _0x54bdf4=0x0;var _0x11c829=0x0;var _0x537ddd=![];var _0x5eccee;var _0x9a0738;return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x20e1ed[_0xcac1('0x41')]['id']},'include':[{'model':db['Interval'],'as':_0xcac1('0xfc'),'include':[{'model':db['Interval'],'as':_0xcac1('0xfd'),'attributes':['id',_0xcac1('0xf3')],'raw':!![]}]}]})[_0xcac1('0x24')](handleEntityNotFound(_0x61d316,null))[_0xcac1('0x24')](function(_0x4c7c27){if(_0x4c7c27){_0x5eccee=_0x4c7c27;return _0x4c7c27[_0xcac1('0xfe')]({'raw':!![]});}})[_0xcac1('0x24')](function(_0x2f33e3){if(_0x5eccee){if(_0x2f33e3){_0x9a0738=_0x2f33e3;}}return require(_0xcac1('0x67'))[_0xcac1('0xff')]();})['then'](function(_0x42c435){if(_0x42c435){_0x11c829=_0x42c435[_0xcac1('0x100')];_0x537ddd=_0x42c435[_0xcac1('0x68')];}})[_0xcac1('0x24')](function(){return db['ChatInteraction'][_0xcac1('0x22')]({'where':{'closed':![]}});})[_0xcac1('0x24')](function(_0x716457){_0x54bdf4=_0x716457;if(_0x11c829&&_0x716457>_0x11c829){return db[_0xcac1('0x101')]['findOne']({'where':{'id':0x1}})[_0xcac1('0x24')](function(_0x18310a){if(_0x18310a){_0x18310a['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x5eccee[_0xcac1('0xfc')]&&_0x5eccee[_0xcac1('0xfc')][_0xcac1('0xfd')]){var _0x3a5649=[];for(var _0x480838=0x0;_0x480838<_0x5eccee[_0xcac1('0xfc')][_0xcac1('0xfd')]['length'];_0x480838++){var _0x688dc3=_0x5eccee[_0xcac1('0xfc')][_0xcac1('0xfd')][_0x480838][_0xcac1('0x26')]({'plain':!![]});_0x3a5649[_0xcac1('0xac')](iftimePromise(_0x688dc3,_0x5eccee));}return BPromise[_0xcac1('0x102')](_0x3a5649)[_0xcac1('0x24')](function(_0x3f7e9e){return _['some'](_0x3f7e9e);});}else{return!![];}})['then'](function(_0x58d8f5){var _0x41ec4e=fs[_0xcac1('0xc0')](path[_0xcac1('0x64')](config[_0xcac1('0x65')],_0xcac1('0x103')),_0xcac1('0xc2'));var _0x336968={'remote':_0x5eccee[_0xcac1('0x104')],'query':querystring[_0xcac1('0x17')](_[_0xcac1('0x52')](_0x5eccee[_0xcac1('0x26')]({'plain':!![]}),{'customerIp':_0x20e1ed[_0xcac1('0x76')][_0xcac1('0x95')]||_0x20e1ed['headers'][_0xcac1('0x105')]||_0x20e1ed[_0xcac1('0x106')][_0xcac1('0x107')]||_0x20e1ed['ip'],'referer':_0x20e1ed['headers'][_0xcac1('0x9a')],'openedInteractions':_0x54bdf4,'maxInteractions':_0x11c829,'virtual':_0x537ddd[_0xcac1('0x100')],'online':_0x58d8f5,'custom':_0x537ddd}))[_0xcac1('0x108')](/'/g,'\x5c\x27')};_0x61d316[_0xcac1('0x29')](ejs[_0xcac1('0xc3')](Mustache[_0xcac1('0xc3')](_0x41ec4e,_0x336968),{'proactiveActions':_0x9a0738,'alignment':_0x5eccee[_0xcac1('0x109')],'verticalAlignment':_0x5eccee[_0xcac1('0x10a')],'div_color':_0x5eccee[_0xcac1('0xed')],'labelText':_0x5eccee[_0xcac1('0x10b')],'text_color':_0x5eccee[_0xcac1('0x10c')],'text_button_color':_0x5eccee[_0xcac1('0x10d')],'button_color':_0x5eccee['color_button'],'background_color':_0x5eccee[_0xcac1('0x10e')],'hideWhenOffline':_0x5eccee[_0xcac1('0x10f')],'interval':_0x5eccee[_0xcac1('0x110')]}));})['catch'](handleError(_0x61d316,null));};exports['addApplications']=function(_0x13acac,_0x1119b1){var _0x5b1aac=_0x13acac[_0xcac1('0x41')]['id'];var _0x5b5e17=_0x13acac[_0xcac1('0x46')];var _0xb2a95e=0xc8;var _0x1e2314=null;return db['sequelize'][_0xcac1('0x111')]({'isolationLevel':db[_0xcac1('0xcd')][_0xcac1('0x112')][_0xcac1('0x113')][_0xcac1('0x114')]},function(_0x209578){return db[_0xcac1('0x2e')][_0xcac1('0x58')]({'where':{'id':_0x5b1aac},'transaction':_0x209578})['then'](function(_0xae4f32){if(_0xae4f32){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x5b1aac},'transaction':_0x209578})[_0xcac1('0x24')](function(){var _0x54fcae=_['map'](_0x5b5e17,function(_0x392802){_0x392802[_0xcac1('0x4c')]=_0x5b1aac;return _0x392802;});return db[_0xcac1('0x8a')][_0xcac1('0x115')](_0x54fcae,{'transaction':_0x209578});});}else{_0xb2a95e=0x194;_0x1e2314=[];}});})[_0xcac1('0x24')](function(){if(_0xb2a95e!==0x194){return db[_0xcac1('0x8a')][_0xcac1('0x116')]({'where':{'ChatWebsiteId':_0x5b1aac},'order':_0xcac1('0x90')})['then'](function(_0x570999){_0x1e2314=_0x570999;});}})[_0xcac1('0x1b')](function(_0x1905d9){_0xb2a95e=0x1f4;logger[_0xcac1('0x18')](_0x1905d9[_0xcac1('0x117')]);if(_0x1905d9[_0xcac1('0x28')]){delete _0x1905d9[_0xcac1('0x28')];}_0x1e2314=_0x1905d9;})['finally'](function(){if(_0x1e2314===null){_0x1119b1[_0xcac1('0x1c')](_0xb2a95e);}else{if(_0xb2a95e===0x1f4){_0x1119b1[_0xcac1('0x1d')](_0xb2a95e)['send'](_0x1e2314);}else{_0x1119b1[_0xcac1('0x1d')](_0xb2a95e)[_0xcac1('0x1f')](_0x1e2314);}}});};exports[_0xcac1('0x118')]=function(_0xf104c8,_0x463188){var _0x5f3bf8={};var _0xdc7f2={};var _0x13c221;var _0x4a785c;return db[_0xcac1('0x2e')][_0xcac1('0x58')]({'where':{'id':_0xf104c8[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x463188,null))[_0xcac1('0x24')](function(_0x3af23a){if(_0x3af23a){_0x13c221=_0x3af23a;_0xdc7f2[_0xcac1('0x36')]=_[_0xcac1('0x33')](db[_0xcac1('0x8a')]['rawAttributes']);_0xdc7f2['query']=_[_0xcac1('0x33')](_0xf104c8[_0xcac1('0x32')]);_0xdc7f2[_0xcac1('0x34')]=_[_0xcac1('0x35')](_0xdc7f2[_0xcac1('0x36')],_0xdc7f2['query']);_0x5f3bf8['attributes']=_[_0xcac1('0x35')](_0xdc7f2[_0xcac1('0x36')],qs[_0xcac1('0x38')](_0xf104c8['query']['fields']));_0x5f3bf8['attributes']=_0x5f3bf8[_0xcac1('0x37')][_0xcac1('0x39')]?_0x5f3bf8[_0xcac1('0x37')]:_0xdc7f2[_0xcac1('0x36')];_0x5f3bf8[_0xcac1('0x51')]=qs[_0xcac1('0x3a')](_0xf104c8[_0xcac1('0x32')][_0xcac1('0x3a')]);_0x5f3bf8['where']=qs[_0xcac1('0x34')](_['pick'](_0xf104c8[_0xcac1('0x32')],_0xdc7f2['filters']));if(_0xf104c8[_0xcac1('0x32')][_0xcac1('0x3c')]){_0x5f3bf8[_0xcac1('0x3d')]=_[_0xcac1('0x52')](_0x5f3bf8[_0xcac1('0x3d')],{'$or':_[_0xcac1('0x2d')](_0x5f3bf8[_0xcac1('0x37')],function(_0x4d4844){var _0x2d5475={};_0x2d5475[_0x4d4844]={'$like':'%'+_0xf104c8[_0xcac1('0x32')][_0xcac1('0x3c')]+'%'};return _0x2d5475;})});}_0x5f3bf8=_['merge']({},_0x5f3bf8,_0xf104c8[_0xcac1('0x43')]);return _0x13c221['getApplications'](_0x5f3bf8);}})['then'](function(_0x1e9d03){if(_0x1e9d03){_0x4a785c=_0x1e9d03[_0xcac1('0x39')];if(!_0xf104c8['query']['hasOwnProperty']('nolimit')){_0x5f3bf8[_0xcac1('0x21')]=qs[_0xcac1('0x21')](_0xf104c8[_0xcac1('0x32')][_0xcac1('0x21')]);_0x5f3bf8[_0xcac1('0x20')]=qs[_0xcac1('0x20')](_0xf104c8[_0xcac1('0x32')][_0xcac1('0x20')]);}return _0x13c221[_0xcac1('0x118')](_0x5f3bf8);}})[_0xcac1('0x24')](function(_0x117785){if(_0x117785){return _0x117785?{'count':_0x4a785c,'rows':_0x117785}:null;}})['then'](respondWithResult(_0x463188,null))['catch'](handleError(_0x463188,null));};exports[_0xcac1('0x119')]=function(_0x50e55c,_0x4c4b09){return db[_0xcac1('0x11a')][_0xcac1('0x44')]({'where':{'id':_0x50e55c['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x4c4b09,null))['then'](function(_0x3f4709){if(_0x3f4709){return _0x3f4709[_0xcac1('0x119')](_0x50e55c[_0xcac1('0x46')][_0xcac1('0x5a')],_[_0xcac1('0xe6')](_0x50e55c[_0xcac1('0x46')],['ids','id'])||{});}})[_0xcac1('0x24')](respondWithResult(_0x4c4b09,null))[_0xcac1('0x1b')](handleError(_0x4c4b09,null));};exports[_0xcac1('0xfe')]=function(_0x1aa7ca,_0x3a01a9){var _0x1085c9={};var _0x2c6e1c={};var _0x503801;var _0x48a255;return db[_0xcac1('0x2e')][_0xcac1('0x58')]({'where':{'id':_0x1aa7ca['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x3a01a9,null))[_0xcac1('0x24')](function(_0x2ab502){if(_0x2ab502){_0x503801=_0x2ab502;_0x2c6e1c[_0xcac1('0x36')]=_[_0xcac1('0x33')](db[_0xcac1('0x11b')]['rawAttributes']);_0x2c6e1c[_0xcac1('0x32')]=_[_0xcac1('0x33')](_0x1aa7ca['query']);_0x2c6e1c[_0xcac1('0x34')]=_[_0xcac1('0x35')](_0x2c6e1c['model'],_0x2c6e1c[_0xcac1('0x32')]);_0x1085c9[_0xcac1('0x37')]=_[_0xcac1('0x35')](_0x2c6e1c[_0xcac1('0x36')],qs[_0xcac1('0x38')](_0x1aa7ca[_0xcac1('0x32')][_0xcac1('0x38')]));_0x1085c9['attributes']=_0x1085c9[_0xcac1('0x37')][_0xcac1('0x39')]?_0x1085c9['attributes']:_0x2c6e1c[_0xcac1('0x36')];_0x1085c9[_0xcac1('0x51')]=qs['sort'](_0x1aa7ca[_0xcac1('0x32')][_0xcac1('0x3a')]);_0x1085c9[_0xcac1('0x3d')]=qs[_0xcac1('0x34')](_[_0xcac1('0x3b')](_0x1aa7ca[_0xcac1('0x32')],_0x2c6e1c['filters']));if(_0x1aa7ca[_0xcac1('0x32')][_0xcac1('0x3c')]){_0x1085c9[_0xcac1('0x3d')]=_[_0xcac1('0x52')](_0x1085c9[_0xcac1('0x3d')],{'$or':_['map'](_0x1085c9['attributes'],function(_0x24c567){var _0x1051e7={};_0x1051e7[_0x24c567]={'$like':'%'+_0x1aa7ca[_0xcac1('0x32')][_0xcac1('0x3c')]+'%'};return _0x1051e7;})});}_0x1085c9=_[_0xcac1('0x52')]({},_0x1085c9,_0x1aa7ca['options']);return _0x503801[_0xcac1('0xfe')](_0x1085c9);}})[_0xcac1('0x24')](function(_0x1b8bca){if(_0x1b8bca){_0x48a255=_0x1b8bca[_0xcac1('0x39')];if(!_0x1aa7ca['query'][_0xcac1('0x4f')](_0xcac1('0x50'))){_0x1085c9[_0xcac1('0x21')]=qs[_0xcac1('0x21')](_0x1aa7ca['query'][_0xcac1('0x21')]);_0x1085c9[_0xcac1('0x20')]=qs['offset'](_0x1aa7ca[_0xcac1('0x32')]['offset']);}return _0x503801['getProactiveActions'](_0x1085c9);}})[_0xcac1('0x24')](function(_0x2baec6){if(_0x2baec6){return _0x2baec6?{'count':_0x48a255,'rows':_0x2baec6}:null;}})[_0xcac1('0x24')](respondWithResult(_0x3a01a9,null))[_0xcac1('0x1b')](handleError(_0x3a01a9,null));};exports['getFields']=function(_0x5d8ac2,_0x3f2538){var _0x35a413=_0x5d8ac2[_0xcac1('0x32')][_0xcac1('0x11c')]===_0xcac1('0x11d')?_0xcac1('0x11e'):_0xcac1('0x11f');return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'attributes':['id',_0x35a413],'where':{'id':_0x5d8ac2['params']['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x3f2538,null))['then'](function(_0x59f613){if(_0x59f613){var _0x3a433f=_0x59f613[_0x35a413];var _0x227d4b=_0x3a433f&&_0x3a433f[_0xcac1('0x120')]?_0x3a433f[_0xcac1('0x120')]:[];_0x3f2538[_0xcac1('0x29')]({'fromKey':_[_0xcac1('0x6f')](_0x3a433f[_0xcac1('0x121')])?undefined:_0x3a433f[_0xcac1('0x121')],'count':_0x227d4b[_0xcac1('0x39')],'rows':_0x227d4b});}})[_0xcac1('0x1b')](handleError(_0x3f2538,null));};exports[_0xcac1('0x122')]=function(_0x2c883a,_0x13a2f5){var _0x52fc4f={'raw':![],'where':{}};var _0x865f4b={};var _0x11d807={'count':0x0,'rows':[]};return db[_0xcac1('0x2e')][_0xcac1('0x58')]({'where':{'id':_0x2c883a[_0xcac1('0x41')]['id']}})['then'](handleEntityNotFound(_0x13a2f5,null))[_0xcac1('0x24')](function(_0x129e42){if(_0x129e42){_0x865f4b[_0xcac1('0x36')]=_['keys'](db['ChatOfflineMessage'][_0xcac1('0x2f')]);_0x865f4b[_0xcac1('0x32')]=_['keys'](_0x2c883a[_0xcac1('0x32')]);_0x865f4b[_0xcac1('0x34')]=_['intersection'](_0x865f4b[_0xcac1('0x36')],_0x865f4b[_0xcac1('0x32')]);_0x52fc4f[_0xcac1('0x37')]=_[_0xcac1('0x35')](_0x865f4b[_0xcac1('0x36')],qs[_0xcac1('0x38')](_0x2c883a['query'][_0xcac1('0x38')]));_0x52fc4f[_0xcac1('0x37')]=_0x52fc4f['attributes']['length']?_0x52fc4f['attributes']:_0x865f4b[_0xcac1('0x36')];if(!_0x2c883a[_0xcac1('0x32')][_0xcac1('0x4f')](_0xcac1('0x50'))){_0x52fc4f[_0xcac1('0x21')]=qs[_0xcac1('0x21')](_0x2c883a[_0xcac1('0x32')][_0xcac1('0x21')]);_0x52fc4f[_0xcac1('0x20')]=qs[_0xcac1('0x20')](_0x2c883a[_0xcac1('0x32')][_0xcac1('0x20')]);}_0x52fc4f[_0xcac1('0x51')]=qs[_0xcac1('0x3a')](_0x2c883a[_0xcac1('0x32')][_0xcac1('0x3a')]);_0x52fc4f['where']=qs[_0xcac1('0x34')](_['pick'](_0x2c883a[_0xcac1('0x32')],_0x865f4b['filters']));_0x52fc4f[_0xcac1('0x3d')][_0xcac1('0x4c')]=_0x129e42['id'];if(_0x2c883a[_0xcac1('0x32')]['filter']){_0x52fc4f[_0xcac1('0x3d')]=_['merge'](_0x52fc4f['where'],{'$or':_[_0xcac1('0x2d')](_0x52fc4f[_0xcac1('0x37')],function(_0x33d548){var _0x44c674={};_0x44c674[_0x33d548]={'$like':'%'+_0x2c883a[_0xcac1('0x32')][_0xcac1('0x3c')]+'%'};return _0x44c674;})});}_0x52fc4f=_['merge']({},_0x52fc4f,_0x2c883a['options']);return db[_0xcac1('0xc6')]['count']({'where':_0x52fc4f[_0xcac1('0x3d')]})[_0xcac1('0x24')](function(_0x1f1c47){_0x11d807['count']=_0x1f1c47;if(_0x2c883a['query'][_0xcac1('0x42')]){_0x52fc4f[_0xcac1('0x3f')]=[{'all':!![]}];}else{_0x52fc4f['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xcac1('0xce')],'as':_0xcac1('0x123'),'required':![]}];}return db[_0xcac1('0xc6')][_0xcac1('0x53')](_0x52fc4f);})[_0xcac1('0x24')](function(_0x273c76){_0x11d807['rows']=_0x273c76;return _0x11d807;});}})[_0xcac1('0x24')](respondWithFilteredResult(_0x13a2f5,_0x52fc4f))[_0xcac1('0x1b')](handleError(_0x13a2f5,null));};exports['addAgents']=function(_0x37f82d,_0x82bf75){return db[_0xcac1('0x2e')][_0xcac1('0x44')]({'where':{'id':_0x37f82d[_0xcac1('0x41')]['id']}})['then'](handleEntityNotFound(_0x82bf75,null))['then'](function(_0x62ae9){if(_0x62ae9){return _0x62ae9[_0xcac1('0x124')](_0x37f82d[_0xcac1('0x46')][_0xcac1('0x5a')],_[_0xcac1('0xe6')](_0x37f82d[_0xcac1('0x46')],[_0xcac1('0x5a'),'id'])||{})['spread'](function(_0x4407fd){for(var _0xdc3098=0x0;_0xdc3098<_0x37f82d['body'][_0xcac1('0x5a')][_0xcac1('0x39')];_0xdc3098+=0x1){socket['emit'](_0xcac1('0x125'),{'UserId':Number(_0x37f82d[_0xcac1('0x46')][_0xcac1('0x5a')][_0xdc3098]),'ChatWebsiteId':Number(_0x37f82d['params']['id'])});}return _0x4407fd;});}})[_0xcac1('0x24')](respondWithResult(_0x82bf75,null))[_0xcac1('0x1b')](handleError(_0x82bf75,null));};exports[_0xcac1('0x126')]=function(_0x6b1314,_0x3fec79){return db['ChatWebsite'][_0xcac1('0x44')]({'where':{'id':_0x6b1314[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x3fec79,null))[_0xcac1('0x24')](function(_0x553da8){if(_0x553da8){return _0x553da8[_0xcac1('0x126')](_0x6b1314[_0xcac1('0x32')][_0xcac1('0x5a')])[_0xcac1('0x24')](function(){if(_[_0xcac1('0x127')](_0x6b1314[_0xcac1('0x32')]['ids'])){for(var _0x5cd647=0x0;_0x5cd647<_0x6b1314[_0xcac1('0x32')][_0xcac1('0x5a')][_0xcac1('0x39')];_0x5cd647+=0x1){socket[_0xcac1('0x128')](_0xcac1('0x129'),{'UserId':Number(_0x6b1314[_0xcac1('0x32')][_0xcac1('0x5a')][_0x5cd647]),'ChatWebsiteId':Number(_0x6b1314[_0xcac1('0x41')]['id'])});}}else{socket['emit'](_0xcac1('0x129'),{'UserId':Number(_0x6b1314[_0xcac1('0x32')][_0xcac1('0x5a')]),'ChatWebsiteId':Number(_0x6b1314[_0xcac1('0x41')]['id'])});}});}})[_0xcac1('0x24')](respondWithStatusCode(_0x3fec79,null))[_0xcac1('0x1b')](handleError(_0x3fec79,null));};exports[_0xcac1('0x12a')]=function(_0x552251,_0x48565f){var _0x35eb5e={};var _0x45d541={};var _0x1841aa;var _0x51a0e7;return db['ChatWebsite'][_0xcac1('0x58')]({'where':{'id':_0x552251[_0xcac1('0x41')]['id']}})[_0xcac1('0x24')](handleEntityNotFound(_0x48565f,null))[_0xcac1('0x24')](function(_0x2b86df){if(_0x2b86df){_0x1841aa=_0x2b86df;_0x45d541[_0xcac1('0x36')]=_[_0xcac1('0x33')](db[_0xcac1('0xb1')][_0xcac1('0x2f')]);_0x45d541['query']=_[_0xcac1('0x33')](_0x552251['query']);_0x45d541[_0xcac1('0x34')]=_[_0xcac1('0x35')](_0x45d541[_0xcac1('0x36')],_0x45d541[_0xcac1('0x32')]);_0x35eb5e['attributes']=_[_0xcac1('0x35')](_0x45d541[_0xcac1('0x36')],qs[_0xcac1('0x38')](_0x552251[_0xcac1('0x32')][_0xcac1('0x38')]));_0x35eb5e[_0xcac1('0x37')]=_0x35eb5e[_0xcac1('0x37')][_0xcac1('0x39')]?_0x35eb5e[_0xcac1('0x37')]:_0x45d541['model'];_0x35eb5e['order']=qs[_0xcac1('0x3a')](_0x552251[_0xcac1('0x32')]['sort']);_0x35eb5e[_0xcac1('0x3d')]=qs[_0xcac1('0x34')](_['pick'](_0x552251['query'],_0x45d541['filters']));if(_0x552251['query']['filter']){_0x35eb5e[_0xcac1('0x3d')]=_['merge'](_0x35eb5e[_0xcac1('0x3d')],{'$or':_[_0xcac1('0x2d')](_0x35eb5e[_0xcac1('0x37')],function(_0x425532){var _0x4d1b72={};_0x4d1b72[_0x425532]={'$like':'%'+_0x552251[_0xcac1('0x32')]['filter']+'%'};return _0x4d1b72;})});}_0x35eb5e=_['merge']({},_0x35eb5e,_0x552251[_0xcac1('0x43')]);return _0x1841aa[_0xcac1('0x12a')](_0x35eb5e);}})[_0xcac1('0x24')](function(_0x9fa5a4){if(_0x9fa5a4){_0x51a0e7=_0x9fa5a4[_0xcac1('0x39')];if(!_0x552251['query'][_0xcac1('0x4f')](_0xcac1('0x50'))){_0x35eb5e[_0xcac1('0x21')]=qs['limit'](_0x552251[_0xcac1('0x32')][_0xcac1('0x21')]);_0x35eb5e[_0xcac1('0x20')]=qs[_0xcac1('0x20')](_0x552251['query'][_0xcac1('0x20')]);}return _0x1841aa[_0xcac1('0x12a')](_0x35eb5e);}})[_0xcac1('0x24')](function(_0x3dfded){if(_0x3dfded){return _0x3dfded?{'count':_0x51a0e7,'rows':_0x3dfded}:null;}})[_0xcac1('0x24')](respondWithResult(_0x48565f,null))['catch'](handleError(_0x48565f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d313315..c964468 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 _0xf021=['emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf021,0x18f));var _0x1f02=function(_0x1559a0,_0x9b8fd7){_0x1559a0=_0x1559a0-0x0;var _0x37e36f=_0xf021[_0x1559a0];return _0x37e36f;};'use strict';var EventEmitter=require(_0x1f02('0x0'));var ChatWebsite=require(_0x1f02('0x1'))['db'][_0x1f02('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1f02('0x3')](0x0);var events={'afterCreate':_0x1f02('0x4'),'afterUpdate':'update','afterDestroy':_0x1f02('0x5')};function emitEvent(_0x54cd44){return function(_0x2e8594,_0x3164f0,_0x51eff6){ChatWebsiteEvents['emit'](_0x54cd44+':'+_0x2e8594['id'],_0x2e8594);ChatWebsiteEvents[_0x1f02('0x6')](_0x54cd44,_0x2e8594);_0x51eff6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x1f02('0x7')](e,emitEvent(event));}}module[_0x1f02('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xee24=['save','update','remove','emit','hook','exports','../../mysqldb','ChatWebsite'];(function(_0x4a2297,_0x3180c9){var _0x315f99=function(_0x4b08b6){while(--_0x4b08b6){_0x4a2297['push'](_0x4a2297['shift']());}};_0x315f99(++_0x3180c9);}(_0xee24,0x1a6));var _0x4ee2=function(_0x210b24,_0x11eea6){_0x210b24=_0x210b24-0x0;var _0x267fad=_0xee24[_0x210b24];return _0x267fad;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x4ee2('0x0'))['db'][_0x4ee2('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ee2('0x2'),'afterUpdate':_0x4ee2('0x3'),'afterDestroy':_0x4ee2('0x4')};function emitEvent(_0x34b373){return function(_0x5546e1,_0x1aee89,_0x179bfa){ChatWebsiteEvents[_0x4ee2('0x5')](_0x34b373+':'+_0x5546e1['id'],_0x5546e1);ChatWebsiteEvents[_0x4ee2('0x5')](_0x34b373,_0x5546e1);_0x179bfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x4ee2('0x6')](e,emitEvent(event));}}module[_0x4ee2('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index eed84ab..d35c52a 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 _0xa99e=['define','chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x16b77e,_0x4a56a3){var _0x3ae284=function(_0x5d2481){while(--_0x5d2481){_0x16b77e['push'](_0x16b77e['shift']());}};_0x3ae284(++_0x4a56a3);}(_0xa99e,0xc5));var _0xea99=function(_0x5f109d,_0x1294f7){_0x5f109d=_0x5f109d-0x0;var _0xef93f8=_0xa99e[_0x5f109d];return _0xef93f8;};'use strict';var _=require(_0xea99('0x0'));var util=require(_0xea99('0x1'));var logger=require(_0xea99('0x2'))(_0xea99('0x3'));var moment=require('moment');var BPromise=require(_0xea99('0x4'));var rp=require(_0xea99('0x5'));var fs=require('fs');var path=require(_0xea99('0x6'));var rimraf=require(_0xea99('0x7'));var config=require(_0xea99('0x8'));var attributes=require(_0xea99('0x9'));module[_0xea99('0xa')]=function(_0x202197,_0x2530e7){return _0x202197[_0xea99('0xb')]('ChatWebsite',attributes,{'tableName':_0xea99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1cc=['ChatWebsite','chat_websites','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0xcfe035,_0x3ae817){var _0x593d26=function(_0x32b4e8){while(--_0x32b4e8){_0xcfe035['push'](_0xcfe035['shift']());}};_0x593d26(++_0x3ae817);}(_0xe1cc,0x1af));var _0xce1c=function(_0x3b4bbd,_0x319981){_0x3b4bbd=_0x3b4bbd-0x0;var _0x3ae888=_0xe1cc[_0x3b4bbd];return _0x3ae888;};'use strict';var _=require(_0xce1c('0x0'));var util=require(_0xce1c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xce1c('0x2'));var BPromise=require(_0xce1c('0x3'));var rp=require(_0xce1c('0x4'));var fs=require('fs');var path=require(_0xce1c('0x5'));var rimraf=require(_0xce1c('0x6'));var config=require(_0xce1c('0x7'));var attributes=require(_0xce1c('0x8'));module[_0xce1c('0x9')]=function(_0x4813cf,_0x5ac797){return _0x4813cf[_0xce1c('0xa')](_0xce1c('0xb'),attributes,{'tableName':_0xce1c('0xc'),'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 add998a..5a8e56e 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 _0x39fc=['rpc','../../config/environment','client','http','redis','register','request','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b8882,_0x2018c8){var _0x2ec7b3=function(_0x5d5d00){while(--_0x5d5d00){_0x4b8882['push'](_0x4b8882['shift']());}};_0x2ec7b3(++_0x2018c8);}(_0x39fc,0x160));var _0xc39f=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x39fc[_0x2af160];return _0x439d67;};'use strict';var _=require('lodash');var util=require(_0xc39f('0x0'));var moment=require(_0xc39f('0x1'));var BPromise=require(_0xc39f('0x2'));var rs=require(_0xc39f('0x3'));var fs=require('fs');var Redis=require(_0xc39f('0x4'));var db=require(_0xc39f('0x5'))['db'];var utils=require(_0xc39f('0x6'));var logger=require(_0xc39f('0x7'))(_0xc39f('0x8'));var config=require(_0xc39f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc39f('0xa')][_0xc39f('0xb')]({'port':0x232a});config[_0xc39f('0xc')]=_['defaults'](config[_0xc39f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc39f('0xc')]));require('./chatWebsite.socket')[_0xc39f('0xd')](socket);function respondWithRpcPromise(_0x160a0c,_0xac06d4,_0x522dc9){return new BPromise(function(_0x579ffa,_0x358d0c){return client[_0xc39f('0xe')](_0x160a0c,_0x522dc9)['then'](function(_0x539bf4){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xac06d4,_0xc39f('0xf'));logger['debug'](_0xc39f('0x10'),_0xac06d4,_0xc39f('0xf'),JSON[_0xc39f('0x11')](_0x539bf4));if(_0x539bf4[_0xc39f('0x12')]){if(_0x539bf4[_0xc39f('0x12')][_0xc39f('0x13')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0xac06d4,_0x539bf4[_0xc39f('0x12')][_0xc39f('0x14')]);return _0x358d0c(_0x539bf4[_0xc39f('0x12')][_0xc39f('0x14')]);}logger[_0xc39f('0x12')](_0xc39f('0x15'),_0xac06d4,_0x539bf4[_0xc39f('0x12')][_0xc39f('0x14')]);return _0x579ffa(_0x539bf4['error'][_0xc39f('0x14')]);}else{logger[_0xc39f('0x16')](_0xc39f('0x15'),_0xac06d4,'request\x20sent');_0x579ffa(_0x539bf4['result'][_0xc39f('0x14')]);}})[_0xc39f('0x17')](function(_0x5d1069){logger['error'](_0xc39f('0x15'),_0xac06d4,_0x5d1069);_0x358d0c(_0x5d1069);});});} \ No newline at end of file +var _0xf7dc=['info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','localhost','redis','./chatWebsite.socket','register','request'];(function(_0x4a2e9,_0x2cdd28){var _0x45426b=function(_0x123765){while(--_0x123765){_0x4a2e9['push'](_0x4a2e9['shift']());}};_0x45426b(++_0x2cdd28);}(_0xf7dc,0x135));var _0xcf7d=function(_0x884469,_0x22470a){_0x884469=_0x884469-0x0;var _0x415a2e=_0xf7dc[_0x884469];return _0x415a2e;};'use strict';var _=require(_0xcf7d('0x0'));var util=require('util');var moment=require(_0xcf7d('0x1'));var BPromise=require(_0xcf7d('0x2'));var rs=require(_0xcf7d('0x3'));var fs=require('fs');var Redis=require(_0xcf7d('0x4'));var db=require(_0xcf7d('0x5'))['db'];var utils=require(_0xcf7d('0x6'));var logger=require(_0xcf7d('0x7'))(_0xcf7d('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf7d('0x9'));var client=jayson[_0xcf7d('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xcf7d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf7d('0xc')]));require(_0xcf7d('0xd'))[_0xcf7d('0xe')](socket);function respondWithRpcPromise(_0x31dccd,_0x60b675,_0x41808b){return new BPromise(function(_0x4f5b3d,_0x53b12a){return client[_0xcf7d('0xf')](_0x31dccd,_0x41808b)['then'](function(_0x667dfe){logger[_0xcf7d('0x10')](_0xcf7d('0x11'),_0x60b675,'request\x20sent');logger[_0xcf7d('0x12')](_0xcf7d('0x13'),_0x60b675,_0xcf7d('0x14'),JSON[_0xcf7d('0x15')](_0x667dfe));if(_0x667dfe[_0xcf7d('0x16')]){if(_0x667dfe[_0xcf7d('0x16')]['code']===0x1f4){logger[_0xcf7d('0x16')](_0xcf7d('0x11'),_0x60b675,_0x667dfe[_0xcf7d('0x16')][_0xcf7d('0x17')]);return _0x53b12a(_0x667dfe[_0xcf7d('0x16')][_0xcf7d('0x17')]);}logger[_0xcf7d('0x16')](_0xcf7d('0x11'),_0x60b675,_0x667dfe[_0xcf7d('0x16')][_0xcf7d('0x17')]);return _0x4f5b3d(_0x667dfe[_0xcf7d('0x16')][_0xcf7d('0x17')]);}else{logger['info'](_0xcf7d('0x11'),_0x60b675,_0xcf7d('0x14'));_0x4f5b3d(_0x667dfe[_0xcf7d('0x18')][_0xcf7d('0x17')]);}})['catch'](function(_0xaf3d11){logger[_0xcf7d('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x60b675,_0xaf3d11);_0x53b12a(_0xaf3d11);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f051bde..d018c1c 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 _0x9ede=['removeListener','register','length','chatWebsite:','save','update'];(function(_0x3983c7,_0x1950db){var _0x50c42d=function(_0x230c8d){while(--_0x230c8d){_0x3983c7['push'](_0x3983c7['shift']());}};_0x50c42d(++_0x1950db);}(_0x9ede,0x64));var _0xe9ed=function(_0x4ee08b,_0x28241b){_0x4ee08b=_0x4ee08b-0x0;var _0x4361c1=_0x9ede[_0x4ee08b];return _0x4361c1;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xe9ed('0x0'),'remove',_0xe9ed('0x1')];function createListener(_0x4f3593,_0xf7bcef){return function(_0x58863c){_0xf7bcef['emit'](_0x4f3593,_0x58863c);};}function removeListener(_0xf3dde8,_0x352b11){return function(){ChatWebsiteEvents[_0xe9ed('0x2')](_0xf3dde8,_0x352b11);};}exports[_0xe9ed('0x3')]=function(_0x27a992){for(var _0x1c10f5=0x0,_0x192207=events[_0xe9ed('0x4')];_0x1c10f5<_0x192207;_0x1c10f5++){var _0x5f7471=events[_0x1c10f5];var _0x15e7d4=createListener(_0xe9ed('0x5')+_0x5f7471,_0x27a992);ChatWebsiteEvents['on'](_0x5f7471,_0x15e7d4);}}; \ No newline at end of file +var _0xecca=['remove','update','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xecca,0xa0));var _0xaecc=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xecca[_0x263a74];return _0x2aa86c;};'use strict';var ChatWebsiteEvents=require(_0xaecc('0x0'));var events=[_0xaecc('0x1'),_0xaecc('0x2'),_0xaecc('0x3')];function createListener(_0x5510ac,_0x454fb6){return function(_0x3a8528){_0x454fb6['emit'](_0x5510ac,_0x3a8528);};}function removeListener(_0x5b59f6,_0x51e678){return function(){ChatWebsiteEvents['removeListener'](_0x5b59f6,_0x51e678);};}exports['register']=function(_0x238452){for(var _0x1a2540=0x0,_0x4ee19c=events[_0xaecc('0x4')];_0x1a2540<_0x4ee19c;_0x1a2540++){var _0x299ee3=events[_0x1a2540];var _0x41f2be=createListener(_0xaecc('0x5')+_0x299ee3,_0x238452);ChatWebsiteEvents['on'](_0x299ee3,_0x41f2be);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 1b1520e..048def9 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 _0x4223=['/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','originalname','server/files/images/avatars/','addCustomerAvatar','/:id/system_avatar','/:id/notify','notify','server/files','attachments','offline-chat','offline','addApplications','addProactiveActions','/:id/users','addAgents','put','/:id','destroy','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet'];(function(_0x3a841d,_0x151ba7){var _0x55ef7d=function(_0x4c95e0){while(--_0x4c95e0){_0x3a841d['push'](_0x3a841d['shift']());}};_0x55ef7d(++_0x151ba7);}(_0x4223,0xff));var _0x3422=function(_0x229f5b,_0x23dba4){_0x229f5b=_0x229f5b-0x0;var _0x120bf2=_0x4223[_0x229f5b];return _0x120bf2;};'use strict';var multer=require('multer');var util=require(_0x3422('0x0'));var path=require(_0x3422('0x1'));var timeout=require(_0x3422('0x2'));var express=require(_0x3422('0x3'));var router=express[_0x3422('0x4')]();var fs_extra=require(_0x3422('0x5'));var auth=require(_0x3422('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3422('0x7'));var controller=require(_0x3422('0x8'));router['get']('/',auth[_0x3422('0x9')](),controller[_0x3422('0xa')]);router[_0x3422('0xb')](_0x3422('0xc'),auth[_0x3422('0x9')](),controller[_0x3422('0xd')]);router['get']('/:id',auth[_0x3422('0x9')](),controller[_0x3422('0xe')]);router[_0x3422('0xb')](_0x3422('0xf'),auth['isAuthenticated'](),controller[_0x3422('0x10')]);router['get'](_0x3422('0x11'),auth['isAuthenticated'](),controller[_0x3422('0x12')]);router[_0x3422('0xb')](_0x3422('0x13'),controller[_0x3422('0x14')]);router[_0x3422('0xb')](_0x3422('0x15'),controller[_0x3422('0x16')]);router[_0x3422('0xb')](_0x3422('0x17'),controller[_0x3422('0x18')]);router[_0x3422('0xb')]('/:id/system_avatar',controller[_0x3422('0x19')]);router[_0x3422('0xb')](_0x3422('0x1a'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x3422('0xb')](_0x3422('0x1b'),controller[_0x3422('0x1c')]);router[_0x3422('0xb')](_0x3422('0x1d'),auth['isAuthenticated'](),controller[_0x3422('0x1e')]);router[_0x3422('0xb')](_0x3422('0x1f'),auth[_0x3422('0x9')](),controller[_0x3422('0x20')]);router['get'](_0x3422('0x21'),controller[_0x3422('0x22')]);router[_0x3422('0xb')](_0x3422('0x23'),auth[_0x3422('0x9')](),controller['getOfflineMessages']);router[_0x3422('0xb')]('/:id/users',auth[_0x3422('0x9')](),controller[_0x3422('0x24')]);router[_0x3422('0x25')]('/',auth[_0x3422('0x9')](),controller[_0x3422('0x26')]);router[_0x3422('0x25')]('/:id/dispositions',auth[_0x3422('0x9')](),controller['addDisposition']);router[_0x3422('0x25')](_0x3422('0x11'),auth[_0x3422('0x9')](),controller[_0x3422('0x27')]);var upload=multer({'storage':multer[_0x3422('0x28')]({'destination':function(_0x4a7e2d,_0x55c57b,_0x5223d0){_0x5223d0(null,path[_0x3422('0x29')](config[_0x3422('0x2a')],_0x3422('0x2b')));},'filename':function(_0x357d0e,_0x22d835,_0x2805b5){_0x2805b5(null,util[_0x3422('0x2c')](_0x3422('0x2d'),Date[_0x3422('0x2e')](),_0x22d835['originalname']));}})});router[_0x3422('0x25')]('/:id/logo',upload[_0x3422('0x2f')](_0x3422('0x30')),controller[_0x3422('0x31')]);var upload=multer({'storage':multer[_0x3422('0x28')]({'destination':function(_0x332249,_0x249df0,_0xd1c844){_0xd1c844(null,path['join'](config[_0x3422('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x4467d7,_0x4318a4,_0x5aa11a){_0x5aa11a(null,util['format'](_0x3422('0x2d'),Date['now'](),_0x4318a4[_0x3422('0x32')]));}})});router[_0x3422('0x25')](_0x3422('0x15'),upload[_0x3422('0x2f')](_0x3422('0x30')),controller['addAvatar']);var upload=multer({'storage':multer[_0x3422('0x28')]({'destination':function(_0x17a1e9,_0xf5f50,_0x2845e9){_0x2845e9(null,path[_0x3422('0x29')](config[_0x3422('0x2a')],_0x3422('0x33')));},'filename':function(_0x30369a,_0xfefd63,_0x5f4f27){_0x5f4f27(null,util['format']('%s-%s',Date['now'](),_0xfefd63[_0x3422('0x32')]));}})});router[_0x3422('0x25')](_0x3422('0x17'),upload[_0x3422('0x2f')]('file'),controller[_0x3422('0x34')]);var upload=multer({'storage':multer[_0x3422('0x28')]({'destination':function(_0x38619f,_0x3efa8b,_0x392071){_0x392071(null,path[_0x3422('0x29')](config[_0x3422('0x2a')],_0x3422('0x33')));},'filename':function(_0x5e9c12,_0x215039,_0x479854){_0x479854(null,util[_0x3422('0x2c')](_0x3422('0x2d'),Date[_0x3422('0x2e')](),_0x215039[_0x3422('0x32')]));}})});router['post'](_0x3422('0x35'),upload['single']('file'),controller['addSystemAvatar']);router[_0x3422('0x25')](_0x3422('0x36'),controller[_0x3422('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x3422('0x28')]({'destination':function(_0x1b67fa,_0x4898d2,_0x7a3f48){const _0x1288cb=path[_0x3422('0x29')](config[_0x3422('0x2a')],_0x3422('0x38'),_0x3422('0x39'),_0x3422('0x3a'));fs_extra['ensureDir'](_0x1288cb,function(){_0x7a3f48(null,_0x1288cb);});},'filename':function(_0x57b8b6,_0x8fbae4,_0x3be487){const _0x354a99=_0x8fbae4[_0x3422('0x32')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4bebe6=path['extname'](_0x354a99);const _0x54b8a7=Date['now']()+'-'+_0x354a99['replace'](_0x4bebe6,'')+_0x4bebe6;_0x3be487(null,_0x54b8a7);}})});router[_0x3422('0x25')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x3422('0x3b')]);router[_0x3422('0x25')](_0x3422('0x1a'),auth[_0x3422('0x9')](),controller['addInteraction']);router[_0x3422('0x25')](_0x3422('0x1d'),auth['isAuthenticated'](),controller[_0x3422('0x3c')]);router['post'](_0x3422('0x1f'),auth[_0x3422('0x9')](),controller[_0x3422('0x3d')]);router['post'](_0x3422('0x3e'),auth[_0x3422('0x9')](),controller[_0x3422('0x3f')]);router[_0x3422('0x40')](_0x3422('0x41'),auth[_0x3422('0x9')](),controller['update']);router['delete'](_0x3422('0x41'),auth['isAuthenticated'](),controller[_0x3422('0x42')]);router[_0x3422('0x43')](_0x3422('0xf'),auth['isAuthenticated'](),controller[_0x3422('0x44')]);router['delete'](_0x3422('0x11'),auth[_0x3422('0x9')](),controller['removeAnswers']);router['delete'](_0x3422('0x3e'),auth[_0x3422('0x9')](),controller[_0x3422('0x45')]);module[_0x3422('0x46')]=router; \ No newline at end of file +var _0x1522=['getSnippet','/:id/applications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','originalname','/:id/logo','single','file','addLogo','root','server/files/images/avatars/','format','now','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','ensureDir','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','/:id/dispositions','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x1522,0x1c8));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2152('0x0'));var path=require(_0x2152('0x1'));var timeout=require(_0x2152('0x2'));var express=require('express');var router=express[_0x2152('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2152('0x4'));var config=require(_0x2152('0x5'));var controller=require('./chatWebsite.controller');router[_0x2152('0x6')]('/',auth[_0x2152('0x7')](),controller['index']);router[_0x2152('0x6')](_0x2152('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x2152('0x6')]('/:id',auth[_0x2152('0x7')](),controller[_0x2152('0x9')]);router[_0x2152('0x6')]('/:id/dispositions',auth[_0x2152('0x7')](),controller[_0x2152('0xa')]);router[_0x2152('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2152('0xb')]);router[_0x2152('0x6')]('/:id/logo',controller[_0x2152('0xc')]);router[_0x2152('0x6')](_0x2152('0xd'),controller[_0x2152('0xe')]);router[_0x2152('0x6')]('/:id/customer_avatar',controller[_0x2152('0xf')]);router['get']('/:id/system_avatar',controller[_0x2152('0x10')]);router[_0x2152('0x6')](_0x2152('0x11'),auth[_0x2152('0x7')](),controller[_0x2152('0x12')]);router[_0x2152('0x6')](_0x2152('0x13'),controller[_0x2152('0x14')]);router['get'](_0x2152('0x15'),auth[_0x2152('0x7')](),controller['getApplications']);router[_0x2152('0x6')](_0x2152('0x16'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x2152('0x6')]('/:id/fields',controller[_0x2152('0x17')]);router[_0x2152('0x6')](_0x2152('0x18'),auth['isAuthenticated'](),controller[_0x2152('0x19')]);router[_0x2152('0x6')](_0x2152('0x1a'),auth[_0x2152('0x7')](),controller[_0x2152('0x1b')]);router[_0x2152('0x1c')]('/',auth[_0x2152('0x7')](),controller[_0x2152('0x1d')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2152('0x1e')]);router[_0x2152('0x1c')](_0x2152('0x1f'),auth[_0x2152('0x7')](),controller[_0x2152('0x20')]);var upload=multer({'storage':multer[_0x2152('0x21')]({'destination':function(_0xe803bb,_0x5b877f,_0xe70ccb){_0xe70ccb(null,path[_0x2152('0x22')](config['root'],_0x2152('0x23')));},'filename':function(_0x506697,_0xdb4922,_0x47dfbe){_0x47dfbe(null,util['format'](_0x2152('0x24'),Date['now'](),_0xdb4922[_0x2152('0x25')]));}})});router[_0x2152('0x1c')](_0x2152('0x26'),upload[_0x2152('0x27')](_0x2152('0x28')),controller[_0x2152('0x29')]);var upload=multer({'storage':multer[_0x2152('0x21')]({'destination':function(_0x176452,_0x33aff7,_0x46725d){_0x46725d(null,path['join'](config[_0x2152('0x2a')],_0x2152('0x2b')));},'filename':function(_0x51e5a3,_0x2bcc96,_0x1565d2){_0x1565d2(null,util[_0x2152('0x2c')](_0x2152('0x24'),Date[_0x2152('0x2d')](),_0x2bcc96['originalname']));}})});router[_0x2152('0x1c')](_0x2152('0xd'),upload[_0x2152('0x27')](_0x2152('0x28')),controller[_0x2152('0x2e')]);var upload=multer({'storage':multer[_0x2152('0x21')]({'destination':function(_0x27d9e5,_0x375d18,_0x45e848){_0x45e848(null,path[_0x2152('0x22')](config[_0x2152('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x52fdbb,_0x5716c9,_0x21b736){_0x21b736(null,util[_0x2152('0x2c')]('%s-%s',Date[_0x2152('0x2d')](),_0x5716c9[_0x2152('0x25')]));}})});router[_0x2152('0x1c')](_0x2152('0x2f'),upload[_0x2152('0x27')](_0x2152('0x28')),controller[_0x2152('0x30')]);var upload=multer({'storage':multer[_0x2152('0x21')]({'destination':function(_0x369b07,_0x450bef,_0x584776){_0x584776(null,path[_0x2152('0x22')](config[_0x2152('0x2a')],_0x2152('0x2b')));},'filename':function(_0x3de9e1,_0x89b9d9,_0x56f9ce){_0x56f9ce(null,util[_0x2152('0x2c')]('%s-%s',Date[_0x2152('0x2d')](),_0x89b9d9[_0x2152('0x25')]));}})});router[_0x2152('0x1c')](_0x2152('0x31'),upload[_0x2152('0x27')](_0x2152('0x28')),controller[_0x2152('0x32')]);router[_0x2152('0x1c')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x2152('0x21')]({'destination':function(_0x2b90b9,_0x5035b7,_0x2dd6cf){const _0x287d9c=path[_0x2152('0x22')](config[_0x2152('0x2a')],'server/files','attachments','offline-chat');fs_extra[_0x2152('0x33')](_0x287d9c,function(){_0x2dd6cf(null,_0x287d9c);});},'filename':function(_0x313192,_0x27a528,_0x1c2f70){const _0x16ecea=_0x27a528[_0x2152('0x25')][_0x2152('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x377b2d=path[_0x2152('0x35')](_0x16ecea);const _0x5e2626=Date[_0x2152('0x2d')]()+'-'+_0x16ecea[_0x2152('0x34')](_0x377b2d,'')+_0x377b2d;_0x1c2f70(null,_0x5e2626);}})});router[_0x2152('0x1c')]('/:id/offline',offlineUploadMulter[_0x2152('0x36')](),controller[_0x2152('0x37')]);router['post'](_0x2152('0x11'),auth['isAuthenticated'](),controller[_0x2152('0x38')]);router[_0x2152('0x1c')](_0x2152('0x15'),auth[_0x2152('0x7')](),controller[_0x2152('0x39')]);router[_0x2152('0x1c')](_0x2152('0x16'),auth[_0x2152('0x7')](),controller[_0x2152('0x3a')]);router[_0x2152('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0x2152('0x3b')]);router[_0x2152('0x3c')](_0x2152('0x3d'),auth[_0x2152('0x7')](),controller[_0x2152('0x3e')]);router[_0x2152('0x3f')]('/:id',auth[_0x2152('0x7')](),controller['destroy']);router[_0x2152('0x3f')](_0x2152('0x40'),auth[_0x2152('0x7')](),controller[_0x2152('0x41')]);router[_0x2152('0x3f')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x2152('0x3f')](_0x2152('0x1a'),auth['isAuthenticated'](),controller[_0x2152('0x42')]);module[_0x2152('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index e9a9b84..ad530d2 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 _0x5c88=['env','production','app','get','client-side-logger','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router'];(function(_0x58f384,_0x5a2022){var _0x37ab31=function(_0x34ba03){while(--_0x34ba03){_0x58f384['push'](_0x58f384['shift']());}};_0x37ab31(++_0x5a2022);}(_0x5c88,0x159));var _0x85c8=function(_0x2360ac,_0x5ae061){_0x2360ac=_0x2360ac-0x0;var _0x189e1a=_0x5c88[_0x2360ac];return _0x189e1a;};var beaverLogger=require(_0x85c8('0x0'));var express=require(_0x85c8('0x1'));var auth=require(_0x85c8('0x2'));var config=require(_0x85c8('0x3'));var router=express[_0x85c8('0x4')]();var isProduction=config[_0x85c8('0x5')]===_0x85c8('0x6')||![];function clientSideLogs(_0x5179cd,_0x24f1d8,_0x5efd85){var _0x4c3bce=_0x5179cd[_0x85c8('0x7')][_0x85c8('0x8')](_0x85c8('0x9'));if(!_0x4c3bce){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x85c8('0xa')]({'uri':_0x85c8('0xb'),'logger':_0x4c3bce,'enableCors':!isProduction})(_0x5179cd,_0x24f1d8,_0x5efd85);}router['use'](auth[_0x85c8('0xc')](),clientSideLogs);module[_0x85c8('0xd')]=router; \ No newline at end of file +var _0xec9d=['../components/auth/service','../config/environment','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express'];(function(_0x4d394d,_0x40e7b3){var _0x4f0003=function(_0x56d25d){while(--_0x56d25d){_0x4d394d['push'](_0x4d394d['shift']());}};_0x4f0003(++_0x40e7b3);}(_0xec9d,0x1c0));var _0xdec9=function(_0x2d05ba,_0x442e6c){_0x2d05ba=_0x2d05ba-0x0;var _0x20ab68=_0xec9d[_0x2d05ba];return _0x20ab68;};var beaverLogger=require(_0xdec9('0x0'));var express=require(_0xdec9('0x1'));var auth=require(_0xdec9('0x2'));var config=require(_0xdec9('0x3'));var router=express['Router']();var isProduction=config[_0xdec9('0x4')]===_0xdec9('0x5')||![];function clientSideLogs(_0x10c08c,_0x34bfa3,_0xa58125){var _0x177335=_0x10c08c[_0xdec9('0x6')][_0xdec9('0x7')](_0xdec9('0x8'));if(!_0x177335){throw new Error(_0xdec9('0x9'));}return beaverLogger[_0xdec9('0xa')]({'uri':_0xdec9('0xb'),'logger':_0x177335,'enableCors':!isProduction})(_0x10c08c,_0x34bfa3,_0xa58125);}router[_0xdec9('0xc')](auth[_0xdec9('0xd')](),clientSideLogs);module[_0xdec9('0xe')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 441bd06..67ee2e7 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 _0xf570=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365'];(function(_0x44e478,_0x52fe62){var _0x59c0fa=function(_0xf59823){while(--_0xf59823){_0x44e478['push'](_0x44e478['shift']());}};_0x59c0fa(++_0x52fe62);}(_0xf570,0x17a));var _0x0f57=function(_0xf4ecee,_0x3f80c9){_0xf4ecee=_0xf4ecee-0x0;var _0x22b5c2=_0xf570[_0xf4ecee];return _0x22b5c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0f57('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0f57('0x1')](_0x0f57('0x2'),_0x0f57('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0f57('0x1')](_0x0f57('0x4'),_0x0f57('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x0f57('0x6')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x0f57('0x0')],'comment':_0x0f57('0x7')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x0f57('0x8')],'comment':_0x0f57('0x9')},'data6':{'type':Sequelize[_0x0f57('0x8')],'comment':_0x0f57('0xa')},'data7':{'type':Sequelize[_0x0f57('0x8')],'comment':_0x0f57('0xb')}}; \ No newline at end of file +var _0x88d1=['sequelize','exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x88d1,0xdd));var _0x188d=function(_0x337216,_0x4184e2){_0x337216=_0x337216-0x0;var _0x113fdb=_0x88d1[_0x337216];return _0x113fdb;};'use strict';var Sequelize=require(_0x188d('0x0'));module[_0x188d('0x1')]={'name':{'type':Sequelize[_0x188d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x188d('0x3')]('AmazonAWS',_0x188d('0x4'),_0x188d('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x188d('0x3')](_0x188d('0x6'),_0x188d('0x7'))},'data1':{'type':Sequelize[_0x188d('0x2')],'comment':_0x188d('0x8')},'data2':{'type':Sequelize[_0x188d('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x188d('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x188d('0x9')},'data6':{'type':Sequelize[_0x188d('0xa')],'comment':_0x188d('0xb')},'data7':{'type':Sequelize[_0x188d('0xa')],'comment':_0x188d('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e8df737..6a4ed79 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 _0x42ad=['from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','update','then','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','keys','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','state','parse'];(function(_0x2dcaf0,_0x489907){var _0x4cb6d9=function(_0x5631a5){while(--_0x5631a5){_0x2dcaf0['push'](_0x2dcaf0['shift']());}};_0x4cb6d9(++_0x489907);}(_0x42ad,0xd0));var _0xd42a=function(_0x3a734a,_0x456a86){_0x3a734a=_0x3a734a-0x0;var _0x284d97=_0x42ad[_0x3a734a];return _0x284d97;};'use strict';var _=require(_0xd42a('0x0'));var Redis=require(_0xd42a('0x1'));var qs=require(_0xd42a('0x2'));var encryptor=require(_0xd42a('0x3'));var config=require(_0xd42a('0x4'));var logger=require(_0xd42a('0x5'))('api');var db=require(_0xd42a('0x6'))['db'];var oauth=require(_0xd42a('0x7'));config[_0xd42a('0x8')]=_[_0xd42a('0x9')](config[_0xd42a('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd42a('0x8')]));var redis=new Redis(config[_0xd42a('0x8')]);function respondWithStatusCode(_0x50b01d,_0x3ab2fc){_0x3ab2fc=_0x3ab2fc||0xcc;return function(_0x3e5951){if(_0x3e5951){return _0x50b01d[_0xd42a('0xa')](_0x3ab2fc);}return _0x50b01d[_0xd42a('0xb')](_0x3ab2fc)[_0xd42a('0xc')]();};}function respondWithResult(_0x43bbce,_0x43f4ed){_0x43f4ed=_0x43f4ed||0xc8;return function(_0x104a3c){if(_0x104a3c){return _0x43bbce['status'](_0x43f4ed)['json'](_0x104a3c);}};}function respondWithFilteredResult(_0x108f3c,_0x33f4fd){return function(_0x2ef809){if(_0x2ef809){var _0x2e8d47=typeof _0x33f4fd[_0xd42a('0xd')]===_0xd42a('0xe')&&typeof _0x33f4fd['limit']===_0xd42a('0xe');var _0x157497=_0x2ef809[_0xd42a('0xf')];var _0x581b27=_0x2e8d47?0x0:_0x33f4fd['offset'];var _0x2ca0ec=_0x2e8d47?_0x2ef809[_0xd42a('0xf')]:_0x33f4fd[_0xd42a('0xd')]+_0x33f4fd[_0xd42a('0x10')];var _0x5bd5fb;if(_0x2ca0ec>=_0x157497){_0x2ca0ec=_0x157497;_0x5bd5fb=0xc8;}else{_0x5bd5fb=0xce;}_0x108f3c[_0xd42a('0xb')](_0x5bd5fb);return _0x108f3c['set'](_0xd42a('0x11'),_0x581b27+'-'+_0x2ca0ec+'/'+_0x157497)[_0xd42a('0x12')](_0x2ef809);}return null;};}function saveUpdates(_0x1ea1a8){return function(_0xb5e289){if(_0xb5e289){return _0xb5e289[_0xd42a('0x13')](_0x1ea1a8)[_0xd42a('0x14')](function(_0x2c935d){return _0x2c935d;});}return null;};}function removeEntity(_0x4b8f09){return function(_0x530a2d){if(_0x530a2d){return _0x530a2d['destroy']()['then'](function(){_0x4b8f09[_0xd42a('0xb')](0xcc)[_0xd42a('0xc')]();});}};}function handleEntityNotFound(_0x2b589a){return function(_0x54eb5b){if(!_0x54eb5b){_0x2b589a['sendStatus'](0x194);}return _0x54eb5b;};}function handleError(_0x5a0989,_0x1490d4){_0x1490d4=_0x1490d4||0x1f4;return function(_0x5c27a5){logger['error'](_0x5c27a5[_0xd42a('0x15')]);if(_0x5c27a5[_0xd42a('0x16')]){delete _0x5c27a5[_0xd42a('0x16')];}_0x5a0989[_0xd42a('0xb')](_0x1490d4)[_0xd42a('0x17')](_0x5c27a5);};}function maskClientSecret(_0xb8d6d4){return _[_0xd42a('0x18')](_0xb8d6d4['slice'](0x0,0x3),0x14,'*');}exports[_0xd42a('0x19')]=function(_0x1fe58a,_0x18fed9){var _0x5ca8fe={},_0x2c24cd={},_0x1897cf={'count':0x0,'rows':[]};var _0x599196=_[_0xd42a('0x1a')](db[_0xd42a('0x1b')][_0xd42a('0x1c')],function(_0x251a04){return{'name':_0x251a04[_0xd42a('0x1d')],'type':_0x251a04[_0xd42a('0x1e')]['key']};});_0x2c24cd[_0xd42a('0x1f')]=_[_0xd42a('0x1a')](_0x599196,'name');_0x2c24cd[_0xd42a('0x20')]=_['keys'](_0x1fe58a['query']);_0x2c24cd[_0xd42a('0x21')]=_[_0xd42a('0x22')](_0x2c24cd[_0xd42a('0x1f')],_0x2c24cd[_0xd42a('0x20')]);_0x5ca8fe[_0xd42a('0x23')]=_[_0xd42a('0x22')](_0x2c24cd[_0xd42a('0x1f')],qs['fields'](_0x1fe58a[_0xd42a('0x20')][_0xd42a('0x24')]));_0x5ca8fe[_0xd42a('0x23')]=_0x5ca8fe['attributes'][_0xd42a('0x25')]?_0x5ca8fe[_0xd42a('0x23')]:_0x2c24cd['model'];if(!_0x1fe58a[_0xd42a('0x20')][_0xd42a('0x26')]('nolimit')){_0x5ca8fe[_0xd42a('0x10')]=qs[_0xd42a('0x10')](_0x1fe58a[_0xd42a('0x20')][_0xd42a('0x10')]);_0x5ca8fe[_0xd42a('0xd')]=qs[_0xd42a('0xd')](_0x1fe58a[_0xd42a('0x20')][_0xd42a('0xd')]);}_0x5ca8fe[_0xd42a('0x27')]=qs[_0xd42a('0x28')](_0x1fe58a[_0xd42a('0x20')]['sort']);_0x5ca8fe[_0xd42a('0x29')]=qs[_0xd42a('0x21')](_[_0xd42a('0x2a')](_0x1fe58a['query'],_0x2c24cd[_0xd42a('0x21')]),_0x599196);if(_0x1fe58a[_0xd42a('0x20')][_0xd42a('0x2b')]){_0x5ca8fe['where']=_[_0xd42a('0x2c')](_0x5ca8fe[_0xd42a('0x29')],{'$or':_[_0xd42a('0x1a')](_0x599196,function(_0x148cb1){if(_0x148cb1[_0xd42a('0x1e')]!==_0xd42a('0x2d')){var _0x2275ca={};_0x2275ca[_0x148cb1[_0xd42a('0x16')]]={'$like':'%'+_0x1fe58a[_0xd42a('0x20')][_0xd42a('0x2b')]+'%'};return _0x2275ca;}})});}_0x5ca8fe=_['merge']({},_0x5ca8fe,_0x1fe58a[_0xd42a('0x2e')]);var _0x5799c3={'where':_0x5ca8fe['where']};return db[_0xd42a('0x1b')][_0xd42a('0xf')](_0x5799c3)[_0xd42a('0x14')](function(_0x581f17){_0x1897cf['count']=_0x581f17;if(_0x1fe58a[_0xd42a('0x20')][_0xd42a('0x2f')]){_0x5ca8fe[_0xd42a('0x30')]=[{'all':!![]}];}return db[_0xd42a('0x1b')][_0xd42a('0x31')](_0x5ca8fe);})[_0xd42a('0x14')](function(_0x696524){_0x1897cf[_0xd42a('0x32')]=_[_0xd42a('0x1a')](_0x696524,function(_0x221c5d){if(_0x221c5d[_0xd42a('0x33')]===_0xd42a('0x34')){var _0x49ad9e=encryptor[_0xd42a('0x35')](_0x221c5d[_0xd42a('0x36')]);_0x221c5d[_0xd42a('0x36')]=maskClientSecret(_0x49ad9e);}return _0x221c5d;});return _0x1897cf;})[_0xd42a('0x14')](respondWithFilteredResult(_0x18fed9,_0x5ca8fe))[_0xd42a('0x37')](handleError(_0x18fed9,null));};exports[_0xd42a('0x38')]=function(_0x26db4c,_0x3907df){var _0x6df27b={'raw':!![],'where':{'id':_0x26db4c['params']['id']}},_0x4a9c11={};_0x4a9c11['model']=_['keys'](db[_0xd42a('0x1b')][_0xd42a('0x1c')]);_0x4a9c11['query']=_[_0xd42a('0x39')](_0x26db4c['query']);_0x4a9c11['filters']=_[_0xd42a('0x22')](_0x4a9c11[_0xd42a('0x1f')],_0x4a9c11[_0xd42a('0x20')]);_0x6df27b[_0xd42a('0x23')]=_[_0xd42a('0x22')](_0x4a9c11[_0xd42a('0x1f')],qs[_0xd42a('0x24')](_0x26db4c['query'][_0xd42a('0x24')]));_0x6df27b['attributes']=_0x6df27b[_0xd42a('0x23')][_0xd42a('0x25')]?_0x6df27b[_0xd42a('0x23')]:_0x4a9c11[_0xd42a('0x1f')];if(_0x26db4c[_0xd42a('0x20')][_0xd42a('0x2f')]){_0x6df27b[_0xd42a('0x30')]=[{'all':!![]}];}_0x6df27b=_['merge']({},_0x6df27b,_0x26db4c[_0xd42a('0x2e')]);return db[_0xd42a('0x1b')][_0xd42a('0x3a')](_0x6df27b)[_0xd42a('0x14')](handleEntityNotFound(_0x3907df,null))[_0xd42a('0x14')](function(_0x175c13){if(_0x175c13[_0xd42a('0x33')]===_0xd42a('0x34')){var _0x893680=encryptor['decryptString'](_0x175c13[_0xd42a('0x36')]);_0x175c13[_0xd42a('0x36')]=maskClientSecret(_0x893680);}return _0x175c13;})[_0xd42a('0x14')](respondWithResult(_0x3907df,null))[_0xd42a('0x37')](handleError(_0x3907df,null));};exports[_0xd42a('0x3b')]=function(_0x24467b,_0x19de9d){if(!_0x24467b[_0xd42a('0x3c')]['name'])throw new Error(_0xd42a('0x3d'));if(!_0x24467b[_0xd42a('0x3c')]['service'])throw new Error(_0xd42a('0x3e'));var _0x5eed17=db[_0xd42a('0x1b')]['rawAttributes'][_0xd42a('0x33')]['values'];if(!_0x5eed17[_0xd42a('0x3f')](_0x24467b[_0xd42a('0x3c')][_0xd42a('0x33')]))throw new Error(_0xd42a('0x40')+_0x5eed17[_0xd42a('0x41')](',\x20'));if(_0x24467b[_0xd42a('0x3c')][_0xd42a('0x33')]==='MicrosoftAzure'&&_0x24467b[_0xd42a('0x3c')][_0xd42a('0x36')]){_0x24467b[_0xd42a('0x3c')][_0xd42a('0x36')]=encryptor[_0xd42a('0x42')](_0x24467b[_0xd42a('0x3c')][_0xd42a('0x36')]);}return db[_0xd42a('0x1b')]['create'](_0x24467b['body'],{})['then'](respondWithResult(_0x19de9d,0xc9))['catch'](handleError(_0x19de9d,null));};exports[_0xd42a('0x13')]=function(_0x517528,_0x354e01){if(_0x517528[_0xd42a('0x3c')]['id']){delete _0x517528[_0xd42a('0x3c')]['id'];}return db['CloudProvider'][_0xd42a('0x3a')]({'where':{'id':_0x517528['params']['id']}})[_0xd42a('0x14')](handleEntityNotFound(_0x354e01,null))[_0xd42a('0x14')](function(_0x3e4a68){if(_0x3e4a68[_0xd42a('0x33')]==='MicrosoftAzure'&&_0x517528['body'][_0xd42a('0x36')]){_0x517528[_0xd42a('0x3c')][_0xd42a('0x36')]=encryptor['encryptString'](_0x517528[_0xd42a('0x3c')]['data3']);}return _0x3e4a68;})[_0xd42a('0x14')](saveUpdates(_0x517528[_0xd42a('0x3c')],null))[_0xd42a('0x14')](respondWithResult(_0x354e01,null))[_0xd42a('0x37')](handleError(_0x354e01,null));};exports[_0xd42a('0x43')]=function(_0x31eaf5,_0x8d52ae){return db[_0xd42a('0x1b')][_0xd42a('0x3a')]({'where':{'id':_0x31eaf5[_0xd42a('0x44')]['id']}})[_0xd42a('0x14')](handleEntityNotFound(_0x8d52ae,null))[_0xd42a('0x14')](removeEntity(_0x8d52ae,null))[_0xd42a('0x37')](handleError(_0x8d52ae,null));};exports[_0xd42a('0x45')]=function(_0x3a9d40,_0x55357f){return db[_0xd42a('0x1b')][_0xd42a('0x46')]({'where':{'id':_0x3a9d40[_0xd42a('0x44')]['id']},'raw':!![]})[_0xd42a('0x14')](function(_0x19bdf2){if(!_0x19bdf2)return _0x55357f[_0xd42a('0xa')](0x194);return{'url':oauth[_0xd42a('0x47')](_0x19bdf2,_0x3a9d40[_0xd42a('0x48')]['id'])};})[_0xd42a('0x14')](respondWithResult(_0x55357f,null))[_0xd42a('0x37')](handleError(_0x55357f,null));};exports[_0xd42a('0x49')]=function(_0x4e9985,_0x45349a){var _0x740725=_0x4e9985[_0xd42a('0x3c')];var _0x3c903a;var _0x3b2b56;if(_0x740725[_0xd42a('0x4a')])throw _0x740725;redis['get'](_0x740725[_0xd42a('0x4b')])[_0xd42a('0x14')](function(_0x27ec99){if(!_0x27ec99)throw new Error('Invalid\x20state\x20parameter');_0x3c903a=JSON[_0xd42a('0x4c')](_0x27ec99);var _0x35d142=Buffer[_0xd42a('0x4d')](_0x740725[_0xd42a('0x4b')],_0xd42a('0x4e'))['toString'](_0xd42a('0x4f'));_0x3b2b56=JSON[_0xd42a('0x4c')](_0x35d142);if(!oauth[_0xd42a('0x50')](_0x740725[_0xd42a('0x51')],_0x3c903a[_0xd42a('0x52')]))throw new Error(_0xd42a('0x53'));redis[_0xd42a('0x54')](_0x740725[_0xd42a('0x4b')]);return oauth[_0xd42a('0x55')](_0x740725['code'],_0x3c903a);})[_0xd42a('0x14')](function(_0x24d15e){_0x3c903a[_0xd42a('0x56')]=_0x24d15e[_0xd42a('0x57')];_0x3c903a['data6']=_0x24d15e[_0xd42a('0x58')];return db[_0xd42a('0x1b')]['update']({'data5':_0x3c903a[_0xd42a('0x56')],'data6':_0x3c903a['data6']},{'where':{'id':_0x3c903a['id']}});})[_0xd42a('0x14')](function(){oauth[_0xd42a('0x59')](_0x3c903a);socket['emit']('microsoftAuthorization:success',{'id':_0x3b2b56['id']});return;})[_0xd42a('0x14')](respondWithStatusCode(_0x45349a,null))[_0xd42a('0x37')](function(_0x1cc900){if(_0x3b2b56){socket[_0xd42a('0x5a')](_0xd42a('0x5b'),{'id':_0x3b2b56['id']});}if(!_0x3c903a){logger[_0xd42a('0x4a')](_0xd42a('0x5c'),_0x1cc900);return _0x45349a['status'](0x1f4)[_0xd42a('0x17')](_0x1cc900[_0xd42a('0x5d')]);}logger[_0xd42a('0x4a')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x3c903a['id'],JSON[_0xd42a('0x5e')](_0x1cc900));});}; \ No newline at end of file +var _0xcb2c=['params','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','catch','findOne','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','padEnd','slice','map','CloudProvider','key','model','name','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','filter','options','includeAll','include','service','MicrosoftAzure','decryptString','data3','show'];(function(_0x47bfba,_0x2a65ab){var _0x55651b=function(_0x457e2d){while(--_0x457e2d){_0x47bfba['push'](_0x47bfba['shift']());}};_0x55651b(++_0x2a65ab);}(_0xcb2c,0x131));var _0xccb2=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xcb2c[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xccb2('0x0'));var Redis=require(_0xccb2('0x1'));var qs=require(_0xccb2('0x2'));var encryptor=require(_0xccb2('0x3'));var config=require(_0xccb2('0x4'));var logger=require(_0xccb2('0x5'))(_0xccb2('0x6'));var db=require(_0xccb2('0x7'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xccb2('0x8')]=_['defaults'](config[_0xccb2('0x8')],{'host':_0xccb2('0x9'),'port':0x18eb});var socket=require(_0xccb2('0xa'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1d4252,_0x290271){_0x290271=_0x290271||0xcc;return function(_0x11523c){if(_0x11523c){return _0x1d4252[_0xccb2('0xb')](_0x290271);}return _0x1d4252[_0xccb2('0xc')](_0x290271)[_0xccb2('0xd')]();};}function respondWithResult(_0x54d571,_0x10f336){_0x10f336=_0x10f336||0xc8;return function(_0x4e57df){if(_0x4e57df){return _0x54d571[_0xccb2('0xc')](_0x10f336)[_0xccb2('0xe')](_0x4e57df);}};}function respondWithFilteredResult(_0x3a08f8,_0x53a7f7){return function(_0x212bdb){if(_0x212bdb){var _0x592328=typeof _0x53a7f7[_0xccb2('0xf')]===_0xccb2('0x10')&&typeof _0x53a7f7[_0xccb2('0x11')]===_0xccb2('0x10');var _0x4f568d=_0x212bdb[_0xccb2('0x12')];var _0x5c7aa4=_0x592328?0x0:_0x53a7f7[_0xccb2('0xf')];var _0x31062c=_0x592328?_0x212bdb[_0xccb2('0x12')]:_0x53a7f7[_0xccb2('0xf')]+_0x53a7f7['limit'];var _0x6267b8;if(_0x31062c>=_0x4f568d){_0x31062c=_0x4f568d;_0x6267b8=0xc8;}else{_0x6267b8=0xce;}_0x3a08f8[_0xccb2('0xc')](_0x6267b8);return _0x3a08f8[_0xccb2('0x13')](_0xccb2('0x14'),_0x5c7aa4+'-'+_0x31062c+'/'+_0x4f568d)[_0xccb2('0xe')](_0x212bdb);}return null;};}function saveUpdates(_0x2bbf19){return function(_0x1fe572){if(_0x1fe572){return _0x1fe572[_0xccb2('0x15')](_0x2bbf19)[_0xccb2('0x16')](function(_0x4574ec){return _0x4574ec;});}return null;};}function removeEntity(_0x325847){return function(_0x1aecec){if(_0x1aecec){return _0x1aecec[_0xccb2('0x17')]()[_0xccb2('0x16')](function(){_0x325847['status'](0xcc)[_0xccb2('0xd')]();});}};}function handleEntityNotFound(_0x5e11f5){return function(_0x260bb9){if(!_0x260bb9){_0x5e11f5[_0xccb2('0xb')](0x194);}return _0x260bb9;};}function handleError(_0x43a56a,_0x24e0ba){_0x24e0ba=_0x24e0ba||0x1f4;return function(_0x194b5c){logger[_0xccb2('0x18')](_0x194b5c['stack']);if(_0x194b5c['name']){delete _0x194b5c['name'];}_0x43a56a['status'](_0x24e0ba)['send'](_0x194b5c);};}function maskClientSecret(_0x240c20){return _[_0xccb2('0x19')](_0x240c20[_0xccb2('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x45c41e,_0x3d5215){var _0x2f54f5={},_0x13cacb={},_0x5a4243={'count':0x0,'rows':[]};var _0x408727=_[_0xccb2('0x1b')](db[_0xccb2('0x1c')]['rawAttributes'],function(_0x50db78){return{'name':_0x50db78['fieldName'],'type':_0x50db78['type'][_0xccb2('0x1d')]};});_0x13cacb[_0xccb2('0x1e')]=_[_0xccb2('0x1b')](_0x408727,_0xccb2('0x1f'));_0x13cacb[_0xccb2('0x20')]=_[_0xccb2('0x21')](_0x45c41e[_0xccb2('0x20')]);_0x13cacb[_0xccb2('0x22')]=_[_0xccb2('0x23')](_0x13cacb['model'],_0x13cacb[_0xccb2('0x20')]);_0x2f54f5[_0xccb2('0x24')]=_[_0xccb2('0x23')](_0x13cacb[_0xccb2('0x1e')],qs[_0xccb2('0x25')](_0x45c41e[_0xccb2('0x20')]['fields']));_0x2f54f5[_0xccb2('0x24')]=_0x2f54f5[_0xccb2('0x24')]['length']?_0x2f54f5[_0xccb2('0x24')]:_0x13cacb[_0xccb2('0x1e')];if(!_0x45c41e[_0xccb2('0x20')]['hasOwnProperty']('nolimit')){_0x2f54f5[_0xccb2('0x11')]=qs[_0xccb2('0x11')](_0x45c41e[_0xccb2('0x20')][_0xccb2('0x11')]);_0x2f54f5[_0xccb2('0xf')]=qs[_0xccb2('0xf')](_0x45c41e[_0xccb2('0x20')][_0xccb2('0xf')]);}_0x2f54f5[_0xccb2('0x26')]=qs[_0xccb2('0x27')](_0x45c41e['query']['sort']);_0x2f54f5[_0xccb2('0x28')]=qs[_0xccb2('0x22')](_['pick'](_0x45c41e[_0xccb2('0x20')],_0x13cacb[_0xccb2('0x22')]),_0x408727);if(_0x45c41e[_0xccb2('0x20')]['filter']){_0x2f54f5[_0xccb2('0x28')]=_[_0xccb2('0x29')](_0x2f54f5[_0xccb2('0x28')],{'$or':_[_0xccb2('0x1b')](_0x408727,function(_0x39c9a1){if(_0x39c9a1['type']!=='VIRTUAL'){var _0x54aabd={};_0x54aabd[_0x39c9a1[_0xccb2('0x1f')]]={'$like':'%'+_0x45c41e[_0xccb2('0x20')][_0xccb2('0x2a')]+'%'};return _0x54aabd;}})});}_0x2f54f5=_[_0xccb2('0x29')]({},_0x2f54f5,_0x45c41e[_0xccb2('0x2b')]);var _0x3472ff={'where':_0x2f54f5[_0xccb2('0x28')]};return db[_0xccb2('0x1c')][_0xccb2('0x12')](_0x3472ff)[_0xccb2('0x16')](function(_0x38734e){_0x5a4243[_0xccb2('0x12')]=_0x38734e;if(_0x45c41e['query'][_0xccb2('0x2c')]){_0x2f54f5[_0xccb2('0x2d')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x2f54f5);})[_0xccb2('0x16')](function(_0x14aa49){_0x5a4243['rows']=_[_0xccb2('0x1b')](_0x14aa49,function(_0x3fc192){if(_0x3fc192[_0xccb2('0x2e')]===_0xccb2('0x2f')){var _0x7dad75=encryptor[_0xccb2('0x30')](_0x3fc192['data3']);_0x3fc192[_0xccb2('0x31')]=maskClientSecret(_0x7dad75);}return _0x3fc192;});return _0x5a4243;})['then'](respondWithFilteredResult(_0x3d5215,_0x2f54f5))['catch'](handleError(_0x3d5215,null));};exports[_0xccb2('0x32')]=function(_0x505503,_0x2e66ed){var _0x3266f3={'raw':!![],'where':{'id':_0x505503[_0xccb2('0x33')]['id']}},_0x1fda4f={};_0x1fda4f[_0xccb2('0x1e')]=_[_0xccb2('0x21')](db[_0xccb2('0x1c')]['rawAttributes']);_0x1fda4f[_0xccb2('0x20')]=_['keys'](_0x505503[_0xccb2('0x20')]);_0x1fda4f[_0xccb2('0x22')]=_['intersection'](_0x1fda4f[_0xccb2('0x1e')],_0x1fda4f[_0xccb2('0x20')]);_0x3266f3[_0xccb2('0x24')]=_[_0xccb2('0x23')](_0x1fda4f['model'],qs['fields'](_0x505503[_0xccb2('0x20')][_0xccb2('0x25')]));_0x3266f3['attributes']=_0x3266f3[_0xccb2('0x24')]['length']?_0x3266f3['attributes']:_0x1fda4f[_0xccb2('0x1e')];if(_0x505503['query'][_0xccb2('0x2c')]){_0x3266f3['include']=[{'all':!![]}];}_0x3266f3=_[_0xccb2('0x29')]({},_0x3266f3,_0x505503[_0xccb2('0x2b')]);return db[_0xccb2('0x1c')][_0xccb2('0x34')](_0x3266f3)[_0xccb2('0x16')](handleEntityNotFound(_0x2e66ed,null))[_0xccb2('0x16')](function(_0x53956f){if(_0x53956f['service']===_0xccb2('0x2f')){var _0x160f44=encryptor[_0xccb2('0x30')](_0x53956f[_0xccb2('0x31')]);_0x53956f['data3']=maskClientSecret(_0x160f44);}return _0x53956f;})[_0xccb2('0x16')](respondWithResult(_0x2e66ed,null))['catch'](handleError(_0x2e66ed,null));};exports['create']=function(_0x5cce3e,_0x15bce2){if(!_0x5cce3e[_0xccb2('0x35')][_0xccb2('0x1f')])throw new Error(_0xccb2('0x36'));if(!_0x5cce3e[_0xccb2('0x35')]['service'])throw new Error(_0xccb2('0x37'));var _0x5c032a=db[_0xccb2('0x1c')]['rawAttributes']['service'][_0xccb2('0x38')];if(!_0x5c032a[_0xccb2('0x39')](_0x5cce3e[_0xccb2('0x35')][_0xccb2('0x2e')]))throw new Error(_0xccb2('0x3a')+_0x5c032a[_0xccb2('0x3b')](',\x20'));if(_0x5cce3e[_0xccb2('0x35')][_0xccb2('0x2e')]===_0xccb2('0x2f')&&_0x5cce3e[_0xccb2('0x35')]['data3']){_0x5cce3e[_0xccb2('0x35')][_0xccb2('0x31')]=encryptor[_0xccb2('0x3c')](_0x5cce3e[_0xccb2('0x35')][_0xccb2('0x31')]);}return db['CloudProvider'][_0xccb2('0x3d')](_0x5cce3e[_0xccb2('0x35')],{})[_0xccb2('0x16')](respondWithResult(_0x15bce2,0xc9))[_0xccb2('0x3e')](handleError(_0x15bce2,null));};exports['update']=function(_0x3354c2,_0x2f5b64){if(_0x3354c2[_0xccb2('0x35')]['id']){delete _0x3354c2[_0xccb2('0x35')]['id'];}return db[_0xccb2('0x1c')][_0xccb2('0x34')]({'where':{'id':_0x3354c2[_0xccb2('0x33')]['id']}})[_0xccb2('0x16')](handleEntityNotFound(_0x2f5b64,null))[_0xccb2('0x16')](function(_0x451603){if(_0x451603[_0xccb2('0x2e')]===_0xccb2('0x2f')&&_0x3354c2[_0xccb2('0x35')]['data3']){_0x3354c2[_0xccb2('0x35')][_0xccb2('0x31')]=encryptor[_0xccb2('0x3c')](_0x3354c2['body'][_0xccb2('0x31')]);}return _0x451603;})[_0xccb2('0x16')](saveUpdates(_0x3354c2[_0xccb2('0x35')],null))[_0xccb2('0x16')](respondWithResult(_0x2f5b64,null))[_0xccb2('0x3e')](handleError(_0x2f5b64,null));};exports[_0xccb2('0x17')]=function(_0x4db1e2,_0x1d0bc4){return db[_0xccb2('0x1c')]['find']({'where':{'id':_0x4db1e2['params']['id']}})[_0xccb2('0x16')](handleEntityNotFound(_0x1d0bc4,null))[_0xccb2('0x16')](removeEntity(_0x1d0bc4,null))[_0xccb2('0x3e')](handleError(_0x1d0bc4,null));};exports['oauth2MicrosoftAuthorize']=function(_0xb1f783,_0x2eca42){return db[_0xccb2('0x1c')][_0xccb2('0x3f')]({'where':{'id':_0xb1f783[_0xccb2('0x33')]['id']},'raw':!![]})[_0xccb2('0x16')](function(_0x1bf0c1){if(!_0x1bf0c1)return _0x2eca42[_0xccb2('0xb')](0x194);return{'url':oauth[_0xccb2('0x40')](_0x1bf0c1,_0xb1f783[_0xccb2('0x41')]['id'])};})[_0xccb2('0x16')](respondWithResult(_0x2eca42,null))['catch'](handleError(_0x2eca42,null));};exports['oauth2MicrosoftCallback']=function(_0x5edfbb,_0xdbc3e1){var _0x27b7c3=_0x5edfbb[_0xccb2('0x35')];var _0x365d39;var _0x598e38;if(_0x27b7c3['error'])throw _0x27b7c3;redis[_0xccb2('0x42')](_0x27b7c3['state'])[_0xccb2('0x16')](function(_0x2c0e0f){if(!_0x2c0e0f)throw new Error(_0xccb2('0x43'));_0x365d39=JSON[_0xccb2('0x44')](_0x2c0e0f);var _0x5e8e66=Buffer[_0xccb2('0x45')](_0x27b7c3[_0xccb2('0x46')],_0xccb2('0x47'))[_0xccb2('0x48')](_0xccb2('0x49'));_0x598e38=JSON['parse'](_0x5e8e66);if(!oauth[_0xccb2('0x4a')](_0x27b7c3[_0xccb2('0x4b')],_0x365d39['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xccb2('0x4c')](_0x27b7c3[_0xccb2('0x46')]);return oauth[_0xccb2('0x4d')](_0x27b7c3[_0xccb2('0x4e')],_0x365d39);})[_0xccb2('0x16')](function(_0x548020){_0x365d39[_0xccb2('0x4f')]=_0x548020[_0xccb2('0x50')];_0x365d39[_0xccb2('0x51')]=_0x548020[_0xccb2('0x52')];return db[_0xccb2('0x1c')]['update']({'data5':_0x365d39[_0xccb2('0x4f')],'data6':_0x365d39[_0xccb2('0x51')]},{'where':{'id':_0x365d39['id']}});})[_0xccb2('0x16')](function(){oauth['startRefreshInterval'](_0x365d39);socket[_0xccb2('0x53')](_0xccb2('0x54'),{'id':_0x598e38['id']});return;})[_0xccb2('0x16')](respondWithStatusCode(_0xdbc3e1,null))['catch'](function(_0x5bcd8c){if(_0x598e38){socket[_0xccb2('0x53')]('microsoftAuthorization:error',{'id':_0x598e38['id']});}if(!_0x365d39){logger[_0xccb2('0x18')](_0xccb2('0x55'),_0x5bcd8c);return _0xdbc3e1[_0xccb2('0xc')](0x1f4)[_0xccb2('0x56')](_0x5bcd8c[_0xccb2('0x57')]);}logger[_0xccb2('0x18')](_0xccb2('0x58'),_0x365d39['id'],JSON['stringify'](_0x5bcd8c));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f907b22..85addc6 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 _0xbb22=['CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4f5de4,_0x286cb4){var _0x57b780=function(_0x489554){while(--_0x489554){_0x4f5de4['push'](_0x4f5de4['shift']());}};_0x57b780(++_0x286cb4);}(_0xbb22,0x152));var _0x2bb2=function(_0x6d40a0,_0x583de2){_0x6d40a0=_0x6d40a0-0x0;var _0x3fd18b=_0xbb22[_0x6d40a0];return _0x3fd18b;};'use strict';var _=require('lodash');var util=require(_0x2bb2('0x0'));var logger=require(_0x2bb2('0x1'))(_0x2bb2('0x2'));var moment=require(_0x2bb2('0x3'));var BPromise=require(_0x2bb2('0x4'));var rp=require(_0x2bb2('0x5'));var fs=require('fs');var path=require(_0x2bb2('0x6'));var rimraf=require('rimraf');var config=require(_0x2bb2('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x2bb2('0x8')]=function(_0x29b11f,_0x14233f){return _0x29b11f[_0x2bb2('0x9')](_0x2bb2('0xa'),attributes,{'tableName':_0x2bb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c1e=['path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2e5ee6,_0x250cda){var _0x3e41c7=function(_0x2f6ce2){while(--_0x2f6ce2){_0x2e5ee6['push'](_0x2e5ee6['shift']());}};_0x3e41c7(++_0x250cda);}(_0x5c1e,0x14c));var _0xe5c1=function(_0x5e6d37,_0x1eef31){_0x5e6d37=_0x5e6d37-0x0;var _0x21a7dd=_0x5c1e[_0x5e6d37];return _0x21a7dd;};'use strict';var _=require(_0xe5c1('0x0'));var util=require(_0xe5c1('0x1'));var logger=require(_0xe5c1('0x2'))(_0xe5c1('0x3'));var moment=require(_0xe5c1('0x4'));var BPromise=require('bluebird');var rp=require(_0xe5c1('0x5'));var fs=require('fs');var path=require(_0xe5c1('0x6'));var rimraf=require('rimraf');var config=require(_0xe5c1('0x7'));var attributes=require(_0xe5c1('0x8'));module[_0xe5c1('0x9')]=function(_0x1a6a19,_0xd0faa6){return _0x1a6a19[_0xe5c1('0xa')](_0xe5c1('0xb'),attributes,{'tableName':_0xe5c1('0xc'),'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 bbff547..67b5aa6 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 _0x7127=['moment','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','type','data7','/.default','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','Dynamics365','replace','{TENANT_ID}','code','id_token','from','stringify','toString','base64','hex','client_id','response_type','join','redirect_uri','data4','response_mode','form_post','state','prompt','login','map','key','oauth2Claims','data1','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','data3','findOne','then','refresh_token','data6','decryptString','POST','data2','access_token','catch','intervals','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken'];(function(_0x3f01be,_0x4a1191){var _0x317d2b=function(_0xfcbceb){while(--_0xfcbceb){_0x3f01be['push'](_0x3f01be['shift']());}};_0x317d2b(++_0x4a1191);}(_0x7127,0xde));var _0x7712=function(_0x5595d2,_0x47e58c){_0x5595d2=_0x5595d2-0x0;var _0x405156=_0x7127[_0x5595d2];return _0x405156;};'use strict';var _=require(_0x7712('0x0'));var crypto=require(_0x7712('0x1'));var jwt=require(_0x7712('0x2'));var moment=require(_0x7712('0x3'));var Redis=require('ioredis');var rp=require(_0x7712('0x4'));var util=require(_0x7712('0x5'));var encryptor=require(_0x7712('0x6'));var config=require('../../config/environment');var logger=require(_0x7712('0x7'))(_0x7712('0x8'));var schedule=require(_0x7712('0x9'));var db=require(_0x7712('0xa'))['db'];config[_0x7712('0xb')]=_[_0x7712('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x7712('0xb')]);var MICROSOFT_AUTH_URL=_0x7712('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x7712('0xe'),'email',_0x7712('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x7712('0x10'),_0x7712('0x11')],'Dynamics365':[_0x7712('0x12'),_0x7712('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xa1812d){var _0x5b3367=_['map'](AZURE_AUTH_SCOPES[_0xa1812d[_0x7712('0x13')]]);if(_0xa1812d[_0x7712('0x13')]==='Dynamics365')_0x5b3367['push'](_0xa1812d[_0x7712('0x14')]+_0x7712('0x15'));return _0x5b3367['join']('\x20');}function getAccessTokenScope(_0x1edb55){if(_0x1edb55[_0x7712('0x13')]===_0x7712('0x16'))return _0x7712('0x17');if(_0x1edb55[_0x7712('0x13')]===_0x7712('0x18'))return _0x1edb55[_0x7712('0x14')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x99cd01,_0x48c5b9){var _0x7b99ca=MICROSOFT_AUTH_URL[_0x7712('0x19')](_0x7712('0x1a'),_0x99cd01['data2']);var _0x56184b=[_0x7712('0x1b'),_0x7712('0x1c')];var _0x46b7d0=Buffer[_0x7712('0x1d')](JSON[_0x7712('0x1e')]({'id':_0x48c5b9}))[_0x7712('0x1f')](_0x7712('0x20'));var _0x2ed37c=crypto['randomBytes'](0x10)['toString'](_0x7712('0x21'));var _0x17de86=getAuthorizationScopes(_0x99cd01);var _0x904638=[{'key':_0x7712('0x22'),'value':_0x99cd01['data1']},{'key':_0x7712('0x23'),'value':encodeURIComponent(_0x56184b[_0x7712('0x24')]('\x20'))},{'key':_0x7712('0x25'),'value':_0x99cd01[_0x7712('0x26')]},{'key':_0x7712('0x27'),'value':_0x7712('0x28')},{'key':'scope','value':encodeURIComponent(_0x17de86)},{'key':_0x7712('0x29'),'value':_0x46b7d0},{'key':'nonce','value':_0x2ed37c},{'key':_0x7712('0x2a'),'value':_0x7712('0x2b')}];var _0x5c0449=_0x7b99ca+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7712('0x2c')](_0x904638,function(_0x39ff53){return _0x39ff53[_0x7712('0x2d')]+'='+_0x39ff53['value'];})[_0x7712('0x24')]('&');_0x99cd01[_0x7712('0x2e')]={'issuer':_0x7b99ca[_0x7712('0x19')]('oauth2/',''),'audience':_0x99cd01[_0x7712('0x2f')],'state':_0x46b7d0,'nonce':_0x2ed37c};redis['set'](_0x46b7d0,JSON[_0x7712('0x1e')](_0x99cd01));return _0x5c0449;}function isValidIdToken(_0x398f3b,_0x3089ba){try{var _0x187136=jwt['decode'](_0x398f3b,{'complete':!![]});var _0x3b42b4=_0x187136[_0x7712('0x30')];if(_0x3b42b4[_0x7712('0x31')]!==_0x3089ba[_0x7712('0x32')])return![];if(_0x3b42b4[_0x7712('0x33')]!==_0x3089ba[_0x7712('0x34')])return![];if(_0x3b42b4['nonce']!==_0x3089ba[_0x7712('0x35')])return![];if(moment()[_0x7712('0x36')](moment[_0x7712('0x37')](_0x3b42b4[_0x7712('0x38')])))return![];return!![];}catch(_0x32b95e){throw _0x32b95e;}}function refreshOauth2MicrosoftAccessToken(_0x5a477f){return Promise[_0x7712('0x39')]()['then'](function(){if(_0x5a477f[_0x7712('0x3a')])return _0x5a477f;return db['CloudProvider'][_0x7712('0x3b')]({'where':{'id':_0x5a477f['id']},'raw':!![]});})[_0x7712('0x3c')](function(_0xf98d46){var _0x3536aa={'grant_type':_0x7712('0x3d'),'refresh_token':_0xf98d46[_0x7712('0x3e')],'scope':getAccessTokenScope(_0xf98d46),'redirect_uri':_0xf98d46[_0x7712('0x26')],'client_id':_0xf98d46['data1'],'client_secret':encryptor[_0x7712('0x3f')](_0xf98d46[_0x7712('0x3a')])};var _0x5665bb={'method':_0x7712('0x40'),'uri':MICROSOFT_AUTH_URL[_0x7712('0x19')]('{TENANT_ID}',_0xf98d46[_0x7712('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3536aa,'json':!![]};return rp(_0x5665bb);})[_0x7712('0x3c')](function(_0x2b3732){_0x5a477f['data5']=_0x2b3732[_0x7712('0x42')];_0x5a477f[_0x7712('0x3e')]=_0x2b3732[_0x7712('0x3d')];return db['CloudProvider']['update']({'data5':_0x5a477f['data5'],'data6':_0x5a477f[_0x7712('0x3e')]},{'where':{'id':_0x5a477f['id']}});})[_0x7712('0x3c')](function(){return _0x5a477f;})[_0x7712('0x43')](function(_0xbeb38a){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5a477f['id'],_0xbeb38a);});}function getOauth2MicrosoftAccessToken(_0x49f87a,_0x5bf705){var _0x5e6c2e={'grant_type':'authorization_code','code':_0x49f87a,'scope':getAccessTokenScope(_0x5bf705),'redirect_uri':_0x5bf705['data4'],'client_id':_0x5bf705[_0x7712('0x2f')],'client_secret':encryptor[_0x7712('0x3f')](_0x5bf705[_0x7712('0x3a')])};var _0x36aa65={'method':_0x7712('0x40'),'uri':MICROSOFT_AUTH_URL[_0x7712('0x19')]('{TENANT_ID}',_0x5bf705['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5e6c2e,'json':!![]};return rp(_0x36aa65);}function startRefreshInterval(_0x55e71f){var _0x93c865=schedule[_0x7712('0x44')];if(_0x93c865[_0x55e71f['id']])clearInterval(_0x93c865[_0x55e71f['id']]);_0x93c865[_0x55e71f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7712('0x45')](this,{'id':_0x55e71f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7712('0x44')]=_0x93c865;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x7712('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7712('0x3c')](function(_0x5e61f4){var _0xa7be38=_0x5e61f4['map'](function(_0x1dd64a){return refreshOauth2MicrosoftAccessToken(_0x1dd64a)[_0x7712('0x3c')](function(_0x189b8b){startRefreshInterval(_0x189b8b);});});return Promise['all'](_0xa7be38);})[_0x7712('0x43')](function(_0x26a4fb){var _0x5a4f33=_0x26a4fb?util[_0x7712('0x47')](_0x26a4fb,{'showHidden':![],'depth':null}):'';logger[_0x7712('0x48')](_0x7712('0x49'),_0x5a4f33);});}module[_0x7712('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x893a=['replace','{TENANT_ID}','data2','code','id_token','base64','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','prompt','login','key','value','oauth2Claims','set','stringify','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','then','CloudProvider','refresh_token','decryptString','POST','data5','access_token','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data3','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365'];(function(_0x150be0,_0x404f4f){var _0x5c3f4e=function(_0x7b8922){while(--_0x7b8922){_0x150be0['push'](_0x150be0['shift']());}};_0x5c3f4e(++_0x404f4f);}(_0x893a,0x83));var _0xa893=function(_0x5c7040,_0x5697ed){_0x5c7040=_0x5c7040-0x0;var _0x202a91=_0x893a[_0x5c7040];return _0x202a91;};'use strict';var _=require(_0xa893('0x0'));var crypto=require(_0xa893('0x1'));var jwt=require(_0xa893('0x2'));var moment=require(_0xa893('0x3'));var Redis=require(_0xa893('0x4'));var rp=require(_0xa893('0x5'));var util=require(_0xa893('0x6'));var encryptor=require(_0xa893('0x7'));var config=require(_0xa893('0x8'));var logger=require(_0xa893('0x9'))(_0xa893('0xa'));var schedule=require(_0xa893('0xb'));var db=require(_0xa893('0xc'))['db'];config[_0xa893('0xd')]=_[_0xa893('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xa893('0xd')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xa893('0xf'),_0xa893('0x10'),_0xa893('0x11'),_0xa893('0x12'),_0xa893('0x13'),'https://outlook.office.com/POP.AccessAsUser.All',_0xa893('0x14')],'Dynamics365':[_0xa893('0xf'),_0xa893('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0xa893('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0xa893('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xc02d74){var _0x555336=_[_0xa893('0x17')](AZURE_AUTH_SCOPES[_0xc02d74[_0xa893('0x18')]]);if(_0xc02d74['type']===_0xa893('0x19'))_0x555336[_0xa893('0x1a')](_0xc02d74[_0xa893('0x1b')]+_0xa893('0x1c'));return _0x555336[_0xa893('0x1d')]('\x20');}function getAccessTokenScope(_0x153bf5){if(_0x153bf5[_0xa893('0x18')]===_0xa893('0x1e'))return _0xa893('0x13');if(_0x153bf5[_0xa893('0x18')]==='Dynamics365')return _0x153bf5[_0xa893('0x1b')]+_0xa893('0x1c');}function generateMicrosoftAuthorizationUrl(_0x10aab6,_0x2fa34c){var _0x213749=MICROSOFT_AUTH_URL[_0xa893('0x1f')](_0xa893('0x20'),_0x10aab6[_0xa893('0x21')]);var _0x285f4e=[_0xa893('0x22'),_0xa893('0x23')];var _0x498a54=Buffer['from'](JSON['stringify']({'id':_0x2fa34c}))['toString'](_0xa893('0x24'));var _0x38365f=crypto['randomBytes'](0x10)['toString'](_0xa893('0x25'));var _0x44f454=getAuthorizationScopes(_0x10aab6);var _0x9b0030=[{'key':_0xa893('0x26'),'value':_0x10aab6[_0xa893('0x27')]},{'key':_0xa893('0x28'),'value':encodeURIComponent(_0x285f4e[_0xa893('0x1d')]('\x20'))},{'key':_0xa893('0x29'),'value':_0x10aab6['data4']},{'key':_0xa893('0x2a'),'value':_0xa893('0x2b')},{'key':_0xa893('0x2c'),'value':encodeURIComponent(_0x44f454)},{'key':_0xa893('0x2d'),'value':_0x498a54},{'key':'nonce','value':_0x38365f},{'key':_0xa893('0x2e'),'value':_0xa893('0x2f')}];var _0x39d825=_0x213749+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa893('0x17')](_0x9b0030,function(_0x30ef96){return _0x30ef96[_0xa893('0x30')]+'='+_0x30ef96[_0xa893('0x31')];})[_0xa893('0x1d')]('&');_0x10aab6[_0xa893('0x32')]={'issuer':_0x213749[_0xa893('0x1f')]('oauth2/',''),'audience':_0x10aab6[_0xa893('0x27')],'state':_0x498a54,'nonce':_0x38365f};redis[_0xa893('0x33')](_0x498a54,JSON[_0xa893('0x34')](_0x10aab6));return _0x39d825;}function isValidIdToken(_0x35138d,_0x5b2d7b){try{var _0x29908=jwt['decode'](_0x35138d,{'complete':!![]});var _0x65e7b7=_0x29908[_0xa893('0x35')];if(_0x65e7b7[_0xa893('0x36')]!==_0x5b2d7b[_0xa893('0x37')])return![];if(_0x65e7b7[_0xa893('0x38')]!==_0x5b2d7b[_0xa893('0x39')])return![];if(_0x65e7b7[_0xa893('0x3a')]!==_0x5b2d7b['nonce'])return![];if(moment()[_0xa893('0x3b')](moment[_0xa893('0x3c')](_0x65e7b7[_0xa893('0x3d')])))return![];return!![];}catch(_0x51c032){throw _0x51c032;}}function refreshOauth2MicrosoftAccessToken(_0x40db00){return Promise[_0xa893('0x3e')]()[_0xa893('0x3f')](function(){if(_0x40db00['data3'])return _0x40db00;return db[_0xa893('0x40')]['findOne']({'where':{'id':_0x40db00['id']},'raw':!![]});})[_0xa893('0x3f')](function(_0xa13dc1){var _0x126ff1={'grant_type':_0xa893('0x41'),'refresh_token':_0xa13dc1['data6'],'scope':getAccessTokenScope(_0xa13dc1),'redirect_uri':_0xa13dc1['data4'],'client_id':_0xa13dc1[_0xa893('0x27')],'client_secret':encryptor[_0xa893('0x42')](_0xa13dc1['data3'])};var _0x2e2211={'method':_0xa893('0x43'),'uri':MICROSOFT_AUTH_URL[_0xa893('0x1f')](_0xa893('0x20'),_0xa13dc1[_0xa893('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x126ff1,'json':!![]};return rp(_0x2e2211);})[_0xa893('0x3f')](function(_0x48f17b){_0x40db00[_0xa893('0x44')]=_0x48f17b[_0xa893('0x45')];_0x40db00[_0xa893('0x46')]=_0x48f17b[_0xa893('0x41')];return db[_0xa893('0x40')][_0xa893('0x47')]({'data5':_0x40db00[_0xa893('0x44')],'data6':_0x40db00[_0xa893('0x46')]},{'where':{'id':_0x40db00['id']}});})[_0xa893('0x3f')](function(){return _0x40db00;})[_0xa893('0x48')](function(_0x59d6de){logger[_0xa893('0x49')](_0xa893('0x4a'),_0x40db00['id'],_0x59d6de);});}function getOauth2MicrosoftAccessToken(_0x4d8a66,_0x30e362){var _0x13e905={'grant_type':'authorization_code','code':_0x4d8a66,'scope':getAccessTokenScope(_0x30e362),'redirect_uri':_0x30e362['data4'],'client_id':_0x30e362[_0xa893('0x27')],'client_secret':encryptor[_0xa893('0x42')](_0x30e362[_0xa893('0x4b')])};var _0x2eb431={'method':_0xa893('0x43'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x30e362['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x13e905,'json':!![]};return rp(_0x2eb431);}function startRefreshInterval(_0x3efef7){var _0x5e02d9=schedule['intervals'];if(_0x5e02d9[_0x3efef7['id']])clearInterval(_0x5e02d9[_0x3efef7['id']]);_0x5e02d9[_0x3efef7['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3efef7['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa893('0x4c')]=_0x5e02d9;}function startAllRefreshIntervals(){return db[_0xa893('0x40')][_0xa893('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa893('0x3f')](function(_0x1b90cb){var _0x2d39c4=_0x1b90cb[_0xa893('0x17')](function(_0x2f089f){return refreshOauth2MicrosoftAccessToken(_0x2f089f)[_0xa893('0x3f')](function(_0x43d4a7){startRefreshInterval(_0x43d4a7);});});return Promise[_0xa893('0x4e')](_0x2d39c4);})[_0xa893('0x48')](function(_0x1846d8){var _0x289c8c=_0x1846d8?util[_0xa893('0x4f')](_0x1846d8,{'showHidden':![],'depth':null}):'';logger[_0xa893('0x49')](_0xa893('0x50'),_0x289c8c);});}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 b863121..c554013 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 _0x4808=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4808,0x160));var _0x8480=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x4808[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require('bluebird');var rs=require(_0x8480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8480('0x4'))['db'];var utils=require(_0x8480('0x5'));var logger=require(_0x8480('0x6'))('rpc');var config=require(_0x8480('0x7'));var jayson=require(_0x8480('0x8'));var client=jayson['client'][_0x8480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5060aa,_0x364f22,_0x4b9f45){return new BPromise(function(_0x3480e7,_0x2b1ffb){return client[_0x8480('0xa')](_0x5060aa,_0x4b9f45)[_0x8480('0xb')](function(_0x337d1e){logger['info'](_0x8480('0xc'),_0x364f22,_0x8480('0xd'));logger[_0x8480('0xe')](_0x8480('0xf'),_0x364f22,_0x8480('0xd'),JSON[_0x8480('0x10')](_0x337d1e));if(_0x337d1e[_0x8480('0x11')]){if(_0x337d1e[_0x8480('0x11')][_0x8480('0x12')]===0x1f4){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x2b1ffb(_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);}logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x3480e7(_0x337d1e['error'][_0x8480('0x13')]);}else{logger[_0x8480('0x14')](_0x8480('0xc'),_0x364f22,'request\x20sent');_0x3480e7(_0x337d1e[_0x8480('0x15')][_0x8480('0x13')]);}})[_0x8480('0x16')](function(_0x35dd6a){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x35dd6a);_0x2b1ffb(_0x35dd6a);});});} \ No newline at end of file +var _0x6582=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6582,0x108));var _0x2658=function(_0x32fc14,_0x20cd7b){_0x32fc14=_0x32fc14-0x0;var _0x434767=_0x6582[_0x32fc14];return _0x434767;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb94f,_0x3f53e7,_0x443df){return new BPromise(function(_0x412a9f,_0x52ef38){return client[_0x2658('0xa')](_0x2cb94f,_0x443df)[_0x2658('0xb')](function(_0x426744){logger[_0x2658('0xc')](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));logger[_0x2658('0xf')](_0x2658('0x10'),_0x3f53e7,_0x2658('0xe'),JSON['stringify'](_0x426744));if(_0x426744[_0x2658('0x11')]){if(_0x426744['error'][_0x2658('0x12')]===0x1f4){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x52ef38(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}logger['error'](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x412a9f(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}else{logger['info'](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));_0x412a9f(_0x426744[_0x2658('0x14')]['message']);}})[_0x2658('0x15')](function(_0x44c6d2){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x44c6d2);_0x52ef38(_0x44c6d2);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b3174b9..ecee86a 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0x3fdf5c,_0x598a60){_0x3fdf5c=_0x3fdf5c-0x0;var _0x4effd8=_0x7a54[_0x3fdf5c];return _0x4effd8;};'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 +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x1261,0x144));var _0x1126=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0x1261[_0x549928];return _0x941e27;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 3be6668..b285e5f 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 _0x8d92=['STRING','sequelize','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x8d92,0x124));var _0x28d9=function(_0x47a940,_0x50c7bc){_0x47a940=_0x47a940-0x0;var _0x408cc8=_0x8d92[_0x47a940];return _0x408cc8;};'use strict';var Sequelize=require(_0x28d9('0x0'));module[_0x28d9('0x1')]={'name':{'type':Sequelize[_0x28d9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x28d9('0x2')]},'companyId':{'type':Sequelize[_0x28d9('0x2')]},'website':{'type':Sequelize[_0x28d9('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x28d9('0x2')]},'street':{'type':Sequelize[_0x28d9('0x2')]},'postalCode':{'type':Sequelize[_0x28d9('0x2')]},'city':{'type':Sequelize[_0x28d9('0x2')]},'country':{'type':Sequelize[_0x28d9('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x28d9('0x2')]},'sPostalCode':{'type':Sequelize[_0x28d9('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x28d9('0x2')]},'description':{'type':Sequelize[_0x28d9('0x2')]}}; \ No newline at end of file +var _0xeec6=['STRING','name','sequelize','exports'];(function(_0x58dd8c,_0x400291){var _0x55acee=function(_0x516ac9){while(--_0x516ac9){_0x58dd8c['push'](_0x58dd8c['shift']());}};_0x55acee(++_0x400291);}(_0xeec6,0x1c2));var _0x6eec=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xeec6[_0x36bfe3];return _0x9b0436;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'unique':_0x6eec('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x6eec('0x2')]},'website':{'type':Sequelize[_0x6eec('0x2')]},'phone':{'type':Sequelize[_0x6eec('0x2')]},'fax':{'type':Sequelize[_0x6eec('0x2')]},'type':{'type':Sequelize[_0x6eec('0x2')]},'street':{'type':Sequelize[_0x6eec('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6eec('0x2')]},'country':{'type':Sequelize[_0x6eec('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6eec('0x2')]},'sStreet':{'type':Sequelize[_0x6eec('0x2')]},'sPostalCode':{'type':Sequelize[_0x6eec('0x2')]},'sCity':{'type':Sequelize[_0x6eec('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6eec('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7690649..cdcb3fc 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 _0x4488=['reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','findAll','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','CmContact','ids','omit','getContacts','findOne','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply'];(function(_0x583e98,_0x5534f5){var _0x84cc30=function(_0x4201ed){while(--_0x4201ed){_0x583e98['push'](_0x583e98['shift']());}};_0x84cc30(++_0x5534f5);}(_0x4488,0x143));var _0x8448=function(_0x4efdff,_0x279bfc){_0x4efdff=_0x4efdff-0x0;var _0x2449fa=_0x4488[_0x4efdff];return _0x2449fa;};'use strict';var emlformat=require(_0x8448('0x0'));var rimraf=require(_0x8448('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8448('0x2'));var rp=require(_0x8448('0x3'));var moment=require(_0x8448('0x4'));var BPromise=require(_0x8448('0x5'));var Mustache=require(_0x8448('0x6'));var util=require(_0x8448('0x7'));var path=require(_0x8448('0x8'));var sox=require(_0x8448('0x9'));var csv=require(_0x8448('0xa'));var ejs=require(_0x8448('0xb'));var fs=require('fs');var fs_extra=require(_0x8448('0xc'));var _=require(_0x8448('0xd'));var squel=require(_0x8448('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8448('0xf'));var toCsv=require(_0x8448('0xa'));var querystring=require(_0x8448('0x10'));var Papa=require('papaparse');var Redis=require(_0x8448('0x11'));var authService=require(_0x8448('0x12'));var qs=require(_0x8448('0x13'));var as=require(_0x8448('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8448('0x15'))(_0x8448('0x16'));var utils=require(_0x8448('0x17'));var config=require(_0x8448('0x18'));var licenseUtil=require(_0x8448('0x19'));var db=require(_0x8448('0x1a'))['db'];function respondWithStatusCode(_0x5dc12c,_0x23f03a){_0x23f03a=_0x23f03a||0xcc;return function(_0x5741e2){if(_0x5741e2){return _0x5dc12c[_0x8448('0x1b')](_0x23f03a);}return _0x5dc12c[_0x8448('0x1c')](_0x23f03a)[_0x8448('0x1d')]();};}function respondWithResult(_0x5411ad,_0x194fbd){_0x194fbd=_0x194fbd||0xc8;return function(_0x5a0e76){if(_0x5a0e76){return _0x5411ad['status'](_0x194fbd)[_0x8448('0x1e')](_0x5a0e76);}};}function respondWithFilteredResult(_0x167864,_0x3fd042){return function(_0x46297b){if(_0x46297b){var _0x19bb7e=typeof _0x3fd042[_0x8448('0x1f')]==='undefined'&&typeof _0x3fd042[_0x8448('0x20')]===_0x8448('0x21');var _0x120b9b=_0x46297b['count'];var _0x586058=_0x19bb7e?0x0:_0x3fd042[_0x8448('0x1f')];var _0x13ce09=_0x19bb7e?_0x46297b[_0x8448('0x22')]:_0x3fd042[_0x8448('0x1f')]+_0x3fd042[_0x8448('0x20')];var _0x1a2f9b;if(_0x13ce09>=_0x120b9b){_0x13ce09=_0x120b9b;_0x1a2f9b=0xc8;}else{_0x1a2f9b=0xce;}_0x167864[_0x8448('0x1c')](_0x1a2f9b);return _0x167864['set'](_0x8448('0x23'),_0x586058+'-'+_0x13ce09+'/'+_0x120b9b)[_0x8448('0x1e')](_0x46297b);}return null;};}function patchUpdates(_0x12ac99){return function(_0x2f6f61){try{jsonpatch[_0x8448('0x24')](_0x2f6f61,_0x12ac99,!![]);}catch(_0x3fe614){return BPromise[_0x8448('0x25')](_0x3fe614);}return _0x2f6f61[_0x8448('0x26')]();};}function saveUpdates(_0x88cfd0,_0x3d1801){return function(_0x64a468){if(_0x64a468){return _0x64a468[_0x8448('0x27')](_0x88cfd0)[_0x8448('0x28')](function(_0x340fb6){return _0x340fb6;});}return null;};}function removeEntity(_0x2f9d10,_0x2bdbe5){return function(_0x1476f4){if(_0x1476f4){return _0x1476f4[_0x8448('0x29')]()[_0x8448('0x28')](function(){var _0x3309bb=_0x1476f4[_0x8448('0x2a')]({'plain':!![]});var _0x617d00=_0x8448('0x2b');return db[_0x8448('0x2c')][_0x8448('0x29')]({'where':{'type':_0x617d00,'resourceId':_0x3309bb['id']}})['then'](function(){return _0x1476f4;});})[_0x8448('0x28')](function(){_0x2f9d10[_0x8448('0x1c')](0xcc)[_0x8448('0x1d')]();});}};}function handleEntityNotFound(_0x4291ca,_0x3c9b2a){return function(_0x32a5a1){if(!_0x32a5a1){_0x4291ca[_0x8448('0x1b')](0x194);}return _0x32a5a1;};}function handleError(_0x32e183,_0x1e7f29){_0x1e7f29=_0x1e7f29||0x1f4;return function(_0x1ee260){logger[_0x8448('0x2d')](_0x1ee260[_0x8448('0x2e')]);if(_0x1ee260[_0x8448('0x2f')]){delete _0x1ee260[_0x8448('0x2f')];}_0x32e183[_0x8448('0x1c')](_0x1e7f29)[_0x8448('0x30')](_0x1ee260);};}exports[_0x8448('0x31')]=function(_0xe38a95,_0x2e220b){var _0x45ad07={},_0x58bea1={},_0x419f77={'count':0x0,'rows':[]};return db[_0x8448('0x32')]['describe']()[_0x8448('0x28')](function(_0x4444c5){_0x58bea1[_0x8448('0x33')]=_['keys'](_0x4444c5);_0x58bea1['query']=_[_0x8448('0x34')](_0xe38a95[_0x8448('0x35')]);_0x58bea1['filters']=_[_0x8448('0x36')](_0x58bea1[_0x8448('0x33')],_0x58bea1['query']);_0x45ad07[_0x8448('0x37')]=_[_0x8448('0x36')](_0x58bea1[_0x8448('0x33')],qs['fields'](_0xe38a95['query'][_0x8448('0x38')]));_0x45ad07[_0x8448('0x37')]=_0x45ad07[_0x8448('0x37')][_0x8448('0x39')]?_0x45ad07[_0x8448('0x37')]:_0x58bea1[_0x8448('0x33')];if(!_0xe38a95['query'][_0x8448('0x3a')](_0x8448('0x3b'))){_0x45ad07[_0x8448('0x20')]=qs[_0x8448('0x20')](_0xe38a95[_0x8448('0x35')][_0x8448('0x20')]);_0x45ad07[_0x8448('0x1f')]=qs['offset'](_0xe38a95[_0x8448('0x35')][_0x8448('0x1f')]);}_0x45ad07[_0x8448('0x3c')]=qs[_0x8448('0x3d')](_0xe38a95[_0x8448('0x35')]['sort']);_0x45ad07['where']=qs[_0x8448('0x3e')](_[_0x8448('0x3f')](_0xe38a95[_0x8448('0x35')],_0x58bea1['filters']),_0x4444c5);if(_0xe38a95['query'][_0x8448('0x40')]){_0x45ad07[_0x8448('0x41')]=_['merge'](_0x45ad07['where'],{'$or':_['map'](_0x45ad07['attributes'],function(_0x3414f8){var _0x21b24c={};_0x21b24c[_0x3414f8]={'$like':'%'+_0xe38a95[_0x8448('0x35')][_0x8448('0x40')]+'%'};return _0x21b24c;})});}_0x45ad07=_[_0x8448('0x42')]({},_0x45ad07,_0xe38a95['options']);var _0x5f4a35={'where':_0x45ad07[_0x8448('0x41')]};return db[_0x8448('0x32')][_0x8448('0x22')](_0x5f4a35)[_0x8448('0x28')](function(_0x3c6897){_0x419f77['count']=_0x3c6897;if(_0xe38a95[_0x8448('0x35')]['includeAll']){_0x45ad07['include']=[{'all':!![]}];}return db[_0x8448('0x32')][_0x8448('0x43')](_0x45ad07);})[_0x8448('0x28')](function(_0x1629f1){_0x419f77['rows']=_0x1629f1;return _0x419f77;})['then'](respondWithFilteredResult(_0x2e220b,_0x45ad07))[_0x8448('0x44')](handleError(_0x2e220b,null));})[_0x8448('0x44')](handleError(_0x2e220b,null));};exports[_0x8448('0x45')]=function(_0x4a34d5,_0x4b2dad){var _0x381638={'raw':![],'where':{'id':_0x4a34d5[_0x8448('0x46')]['id']}},_0x58078b={};_0x58078b[_0x8448('0x33')]=_[_0x8448('0x34')](db[_0x8448('0x32')][_0x8448('0x47')]);_0x58078b[_0x8448('0x35')]=_[_0x8448('0x34')](_0x4a34d5[_0x8448('0x35')]);_0x58078b[_0x8448('0x3e')]=_[_0x8448('0x36')](_0x58078b[_0x8448('0x33')],_0x58078b[_0x8448('0x35')]);_0x381638[_0x8448('0x37')]=_[_0x8448('0x36')](_0x58078b['model'],qs[_0x8448('0x38')](_0x4a34d5['query'][_0x8448('0x38')]));_0x381638[_0x8448('0x37')]=_0x381638['attributes']['length']?_0x381638[_0x8448('0x37')]:_0x58078b['model'];if(_0x4a34d5[_0x8448('0x35')][_0x8448('0x48')]){_0x381638[_0x8448('0x49')]=[{'all':!![]}];}_0x381638=_[_0x8448('0x42')]({},_0x381638,_0x4a34d5[_0x8448('0x4a')]);return db[_0x8448('0x32')][_0x8448('0x4b')](_0x381638)[_0x8448('0x28')](handleEntityNotFound(_0x4b2dad,null))[_0x8448('0x28')](respondWithResult(_0x4b2dad,null))[_0x8448('0x44')](handleError(_0x4b2dad,null));};exports[_0x8448('0x4c')]=function(_0x439650,_0x544959){return db['CmCompany'][_0x8448('0x4c')](_0x439650[_0x8448('0x4d')],{})['then'](function(_0x366409){var _0x20e929=_0x439650[_0x8448('0x4e')][_0x8448('0x2a')]({'plain':!![]});if(!_0x20e929)throw new Error(_0x8448('0x4f'));if(_0x20e929['role']===_0x8448('0x4e')){var _0x575565=_0x366409['get']({'plain':!![]});var _0x223e9c=_0x8448('0x2b');return db['UserProfileSection'][_0x8448('0x4b')]({'where':{'name':_0x223e9c,'userProfileId':_0x20e929[_0x8448('0x50')]},'raw':!![]})['then'](function(_0x40a28a){if(_0x40a28a&&_0x40a28a[_0x8448('0x51')]===0x0){return db[_0x8448('0x2c')][_0x8448('0x4c')]({'name':_0x575565[_0x8448('0x2f')],'resourceId':_0x575565['id'],'type':_0x40a28a[_0x8448('0x2f')],'sectionId':_0x40a28a['id']},{})['then'](function(){return _0x366409;});}else{return _0x366409;}})[_0x8448('0x44')](function(_0x4b90c4){logger['error'](_0x8448('0x52'),_0x4b90c4);throw _0x4b90c4;});}return _0x366409;})[_0x8448('0x28')](respondWithResult(_0x544959,0xc9))['catch'](handleError(_0x544959,null));};exports[_0x8448('0x27')]=function(_0x2e124a,_0x5582a2){if(_0x2e124a['body']['id']){delete _0x2e124a[_0x8448('0x4d')]['id'];}return db[_0x8448('0x32')][_0x8448('0x4b')]({'where':{'id':_0x2e124a['params']['id']}})[_0x8448('0x28')](handleEntityNotFound(_0x5582a2,null))[_0x8448('0x28')](saveUpdates(_0x2e124a[_0x8448('0x4d')],null))['then'](respondWithResult(_0x5582a2,null))[_0x8448('0x44')](handleError(_0x5582a2,null));};exports[_0x8448('0x29')]=function(_0x4d3414,_0x51ba1a){return db[_0x8448('0x32')]['find']({'where':{'id':_0x4d3414['params']['id']}})[_0x8448('0x28')](handleEntityNotFound(_0x51ba1a,null))[_0x8448('0x28')](removeEntity(_0x51ba1a,null))[_0x8448('0x44')](handleError(_0x51ba1a,null));};exports[_0x8448('0x53')]=function(_0x1546fd,_0x24ee5f){return db[_0x8448('0x32')][_0x8448('0x53')]()[_0x8448('0x28')](respondWithResult(_0x24ee5f,null))['catch'](handleError(_0x24ee5f,null));};exports['addContacts']=function(_0x332f03,_0x1afedc,_0x13932f){return db[_0x8448('0x54')][_0x8448('0x4b')]({'where':{'id':_0x332f03[_0x8448('0x46')]['id']}})[_0x8448('0x28')](handleEntityNotFound(_0x1afedc,null))[_0x8448('0x28')](function(_0x184d42){if(_0x184d42){return _0x184d42['addContacts'](_0x332f03[_0x8448('0x4d')][_0x8448('0x55')],_[_0x8448('0x56')](_0x332f03[_0x8448('0x4d')],[_0x8448('0x55'),'id'])||{});}})[_0x8448('0x28')](respondWithResult(_0x1afedc,null))[_0x8448('0x44')](handleError(_0x1afedc,null));};exports[_0x8448('0x57')]=function(_0x20cb81,_0x11279c,_0x58d027){var _0x1f8f30={};var _0x2d3f9f={};var _0x422c48;var _0x436dc3;return db['CmCompany'][_0x8448('0x58')]({'where':{'id':_0x20cb81['params']['id']}})[_0x8448('0x28')](handleEntityNotFound(_0x11279c,null))[_0x8448('0x28')](function(_0x527bc8){if(_0x527bc8){_0x422c48=_0x527bc8;_0x2d3f9f['model']=_['keys'](db[_0x8448('0x54')][_0x8448('0x47')]);_0x2d3f9f[_0x8448('0x35')]=_[_0x8448('0x34')](_0x20cb81[_0x8448('0x35')]);_0x2d3f9f['filters']=_[_0x8448('0x36')](_0x2d3f9f['model'],_0x2d3f9f['query']);_0x1f8f30[_0x8448('0x37')]=_[_0x8448('0x36')](_0x2d3f9f['model'],qs[_0x8448('0x38')](_0x20cb81[_0x8448('0x35')][_0x8448('0x38')]));_0x1f8f30[_0x8448('0x37')]=_0x1f8f30[_0x8448('0x37')]['length']?_0x1f8f30[_0x8448('0x37')]:_0x2d3f9f[_0x8448('0x33')];_0x1f8f30[_0x8448('0x3c')]=qs[_0x8448('0x3d')](_0x20cb81['query'][_0x8448('0x3d')]);_0x1f8f30[_0x8448('0x41')]=qs[_0x8448('0x3e')](_['pick'](_0x20cb81['query'],_0x2d3f9f['filters']));if(_0x20cb81[_0x8448('0x35')][_0x8448('0x40')]){_0x1f8f30['where']=_[_0x8448('0x42')](_0x1f8f30['where'],{'$or':_[_0x8448('0x59')](_0x1f8f30[_0x8448('0x37')],function(_0x3cf612){var _0x1af178={};_0x1af178[_0x3cf612]={'$like':'%'+_0x20cb81[_0x8448('0x35')][_0x8448('0x40')]+'%'};return _0x1af178;})});}_0x1f8f30=_[_0x8448('0x42')]({},_0x1f8f30,_0x20cb81[_0x8448('0x4a')]);return _0x422c48['getContacts'](_0x1f8f30);}})[_0x8448('0x28')](function(_0x1f710f){if(_0x1f710f){_0x436dc3=_0x1f710f[_0x8448('0x39')];if(!_0x20cb81[_0x8448('0x35')][_0x8448('0x3a')](_0x8448('0x3b'))){_0x1f8f30[_0x8448('0x20')]=qs[_0x8448('0x20')](_0x20cb81[_0x8448('0x35')][_0x8448('0x20')]);_0x1f8f30[_0x8448('0x1f')]=qs[_0x8448('0x1f')](_0x20cb81[_0x8448('0x35')][_0x8448('0x1f')]);}return _0x422c48[_0x8448('0x57')](_0x1f8f30);}})[_0x8448('0x28')](function(_0x38efc1){if(_0x38efc1){return _0x38efc1?{'count':_0x436dc3,'rows':_0x38efc1}:null;}})[_0x8448('0x28')](respondWithResult(_0x11279c,null))[_0x8448('0x44')](handleError(_0x11279c,null));}; \ No newline at end of file +var _0x4989=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','get','Companies','UserProfileResource','sendStatus','stack','send','index','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','options','CmCompany','findAll','rows','catch','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','ids','CmContact','order','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3955ef,_0x1910e0){var _0x48a385=function(_0x2c9bf5){while(--_0x2c9bf5){_0x3955ef['push'](_0x3955ef['shift']());}};_0x48a385(++_0x1910e0);}(_0x4989,0x142));var _0x9498=function(_0x83d08e,_0x228942){_0x83d08e=_0x83d08e-0x0;var _0x404d4f=_0x4989[_0x83d08e];return _0x404d4f;};'use strict';var emlformat=require(_0x9498('0x0'));var rimraf=require(_0x9498('0x1'));var zipdir=require(_0x9498('0x2'));var jsonpatch=require(_0x9498('0x3'));var rp=require('request-promise');var moment=require(_0x9498('0x4'));var BPromise=require(_0x9498('0x5'));var Mustache=require(_0x9498('0x6'));var util=require(_0x9498('0x7'));var path=require(_0x9498('0x8'));var sox=require(_0x9498('0x9'));var csv=require('to-csv');var ejs=require(_0x9498('0xa'));var fs=require('fs');var fs_extra=require(_0x9498('0xb'));var _=require(_0x9498('0xc'));var squel=require(_0x9498('0xd'));var crypto=require(_0x9498('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9498('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9498('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9498('0x11'));var qs=require(_0x9498('0x12'));var as=require(_0x9498('0x13'));var hardwareService=require(_0x9498('0x14'));var logger=require(_0x9498('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9498('0x16'));var licenseUtil=require(_0x9498('0x17'));var db=require(_0x9498('0x18'))['db'];function respondWithStatusCode(_0x338396,_0x4f86c4){_0x4f86c4=_0x4f86c4||0xcc;return function(_0x21fa14){if(_0x21fa14){return _0x338396['sendStatus'](_0x4f86c4);}return _0x338396[_0x9498('0x19')](_0x4f86c4)[_0x9498('0x1a')]();};}function respondWithResult(_0x1dfed4,_0x207ac9){_0x207ac9=_0x207ac9||0xc8;return function(_0x2f4012){if(_0x2f4012){return _0x1dfed4['status'](_0x207ac9)[_0x9498('0x1b')](_0x2f4012);}};}function respondWithFilteredResult(_0x3aa9f7,_0x287c5a){return function(_0x1c78b6){if(_0x1c78b6){var _0x283e80=typeof _0x287c5a['offset']===_0x9498('0x1c')&&typeof _0x287c5a[_0x9498('0x1d')]===_0x9498('0x1c');var _0x4a9660=_0x1c78b6[_0x9498('0x1e')];var _0x50d94e=_0x283e80?0x0:_0x287c5a[_0x9498('0x1f')];var _0x52ecd4=_0x283e80?_0x1c78b6[_0x9498('0x1e')]:_0x287c5a[_0x9498('0x1f')]+_0x287c5a[_0x9498('0x1d')];var _0x24a8dd;if(_0x52ecd4>=_0x4a9660){_0x52ecd4=_0x4a9660;_0x24a8dd=0xc8;}else{_0x24a8dd=0xce;}_0x3aa9f7['status'](_0x24a8dd);return _0x3aa9f7[_0x9498('0x20')]('Content-Range',_0x50d94e+'-'+_0x52ecd4+'/'+_0x4a9660)[_0x9498('0x1b')](_0x1c78b6);}return null;};}function patchUpdates(_0x17676c){return function(_0x17ef43){try{jsonpatch[_0x9498('0x21')](_0x17ef43,_0x17676c,!![]);}catch(_0x29afc9){return BPromise[_0x9498('0x22')](_0x29afc9);}return _0x17ef43[_0x9498('0x23')]();};}function saveUpdates(_0x3c5148,_0x5aea9f){return function(_0x1d82ad){if(_0x1d82ad){return _0x1d82ad['update'](_0x3c5148)[_0x9498('0x24')](function(_0x461bd6){return _0x461bd6;});}return null;};}function removeEntity(_0x54ff6a,_0x223d0b){return function(_0x108533){if(_0x108533){return _0x108533[_0x9498('0x25')]()[_0x9498('0x24')](function(){var _0x372b1f=_0x108533[_0x9498('0x26')]({'plain':!![]});var _0x3f5958=_0x9498('0x27');return db[_0x9498('0x28')][_0x9498('0x25')]({'where':{'type':_0x3f5958,'resourceId':_0x372b1f['id']}})[_0x9498('0x24')](function(){return _0x108533;});})['then'](function(){_0x54ff6a[_0x9498('0x19')](0xcc)[_0x9498('0x1a')]();});}};}function handleEntityNotFound(_0x2c6e02,_0x5e2636){return function(_0x1dff47){if(!_0x1dff47){_0x2c6e02[_0x9498('0x29')](0x194);}return _0x1dff47;};}function handleError(_0x77aa41,_0x5c680c){_0x5c680c=_0x5c680c||0x1f4;return function(_0x431919){logger['error'](_0x431919[_0x9498('0x2a')]);if(_0x431919['name']){delete _0x431919['name'];}_0x77aa41[_0x9498('0x19')](_0x5c680c)[_0x9498('0x2b')](_0x431919);};}exports[_0x9498('0x2c')]=function(_0x19ba41,_0x1ef0e9){var _0x361af5={},_0x3cac06={},_0x4f6c2f={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x9498('0x24')](function(_0xee42b6){_0x3cac06[_0x9498('0x2d')]=_['keys'](_0xee42b6);_0x3cac06[_0x9498('0x2e')]=_[_0x9498('0x2f')](_0x19ba41['query']);_0x3cac06[_0x9498('0x30')]=_[_0x9498('0x31')](_0x3cac06['model'],_0x3cac06[_0x9498('0x2e')]);_0x361af5[_0x9498('0x32')]=_[_0x9498('0x31')](_0x3cac06[_0x9498('0x2d')],qs['fields'](_0x19ba41[_0x9498('0x2e')][_0x9498('0x33')]));_0x361af5[_0x9498('0x32')]=_0x361af5['attributes'][_0x9498('0x34')]?_0x361af5[_0x9498('0x32')]:_0x3cac06[_0x9498('0x2d')];if(!_0x19ba41['query'][_0x9498('0x35')]('nolimit')){_0x361af5[_0x9498('0x1d')]=qs[_0x9498('0x1d')](_0x19ba41[_0x9498('0x2e')][_0x9498('0x1d')]);_0x361af5['offset']=qs[_0x9498('0x1f')](_0x19ba41[_0x9498('0x2e')][_0x9498('0x1f')]);}_0x361af5['order']=qs[_0x9498('0x36')](_0x19ba41[_0x9498('0x2e')][_0x9498('0x36')]);_0x361af5[_0x9498('0x37')]=qs[_0x9498('0x30')](_[_0x9498('0x38')](_0x19ba41['query'],_0x3cac06['filters']),_0xee42b6);if(_0x19ba41['query'][_0x9498('0x39')]){_0x361af5[_0x9498('0x37')]=_[_0x9498('0x3a')](_0x361af5['where'],{'$or':_[_0x9498('0x3b')](_0x361af5['attributes'],function(_0x340cc1){var _0x507d11={};_0x507d11[_0x340cc1]={'$like':'%'+_0x19ba41[_0x9498('0x2e')][_0x9498('0x39')]+'%'};return _0x507d11;})});}_0x361af5=_['merge']({},_0x361af5,_0x19ba41[_0x9498('0x3c')]);var _0x2c686a={'where':_0x361af5['where']};return db[_0x9498('0x3d')]['count'](_0x2c686a)[_0x9498('0x24')](function(_0x5e3a0d){_0x4f6c2f[_0x9498('0x1e')]=_0x5e3a0d;if(_0x19ba41[_0x9498('0x2e')]['includeAll']){_0x361af5['include']=[{'all':!![]}];}return db['CmCompany'][_0x9498('0x3e')](_0x361af5);})[_0x9498('0x24')](function(_0x37bded){_0x4f6c2f[_0x9498('0x3f')]=_0x37bded;return _0x4f6c2f;})[_0x9498('0x24')](respondWithFilteredResult(_0x1ef0e9,_0x361af5))[_0x9498('0x40')](handleError(_0x1ef0e9,null));})[_0x9498('0x40')](handleError(_0x1ef0e9,null));};exports['show']=function(_0x30bdac,_0x491a8b){var _0xe6a06b={'raw':![],'where':{'id':_0x30bdac[_0x9498('0x41')]['id']}},_0x43ba57={};_0x43ba57[_0x9498('0x2d')]=_['keys'](db[_0x9498('0x3d')][_0x9498('0x42')]);_0x43ba57[_0x9498('0x2e')]=_['keys'](_0x30bdac[_0x9498('0x2e')]);_0x43ba57[_0x9498('0x30')]=_[_0x9498('0x31')](_0x43ba57[_0x9498('0x2d')],_0x43ba57['query']);_0xe6a06b[_0x9498('0x32')]=_['intersection'](_0x43ba57['model'],qs['fields'](_0x30bdac[_0x9498('0x2e')][_0x9498('0x33')]));_0xe6a06b[_0x9498('0x32')]=_0xe6a06b[_0x9498('0x32')][_0x9498('0x34')]?_0xe6a06b[_0x9498('0x32')]:_0x43ba57[_0x9498('0x2d')];if(_0x30bdac[_0x9498('0x2e')][_0x9498('0x43')]){_0xe6a06b[_0x9498('0x44')]=[{'all':!![]}];}_0xe6a06b=_[_0x9498('0x3a')]({},_0xe6a06b,_0x30bdac[_0x9498('0x3c')]);return db[_0x9498('0x3d')][_0x9498('0x45')](_0xe6a06b)['then'](handleEntityNotFound(_0x491a8b,null))[_0x9498('0x24')](respondWithResult(_0x491a8b,null))[_0x9498('0x40')](handleError(_0x491a8b,null));};exports['create']=function(_0x562790,_0x4a3c66){return db[_0x9498('0x3d')][_0x9498('0x46')](_0x562790[_0x9498('0x47')],{})[_0x9498('0x24')](function(_0x26aa63){var _0x200cdd=_0x562790[_0x9498('0x48')][_0x9498('0x26')]({'plain':!![]});if(!_0x200cdd)throw new Error(_0x9498('0x49'));if(_0x200cdd[_0x9498('0x4a')]===_0x9498('0x48')){var _0x2ef1bb=_0x26aa63['get']({'plain':!![]});var _0x371b78='Companies';return db[_0x9498('0x4b')]['find']({'where':{'name':_0x371b78,'userProfileId':_0x200cdd['userProfileId']},'raw':!![]})[_0x9498('0x24')](function(_0x2bf821){if(_0x2bf821&&_0x2bf821['autoAssociation']===0x0){return db['UserProfileResource'][_0x9498('0x46')]({'name':_0x2ef1bb[_0x9498('0x4c')],'resourceId':_0x2ef1bb['id'],'type':_0x2bf821[_0x9498('0x4c')],'sectionId':_0x2bf821['id']},{})[_0x9498('0x24')](function(){return _0x26aa63;});}else{return _0x26aa63;}})[_0x9498('0x40')](function(_0x16d2eb){logger[_0x9498('0x4d')](_0x9498('0x4e'),_0x16d2eb);throw _0x16d2eb;});}return _0x26aa63;})['then'](respondWithResult(_0x4a3c66,0xc9))[_0x9498('0x40')](handleError(_0x4a3c66,null));};exports[_0x9498('0x4f')]=function(_0xf88877,_0x471e4f){if(_0xf88877[_0x9498('0x47')]['id']){delete _0xf88877['body']['id'];}return db[_0x9498('0x3d')][_0x9498('0x45')]({'where':{'id':_0xf88877[_0x9498('0x41')]['id']}})[_0x9498('0x24')](handleEntityNotFound(_0x471e4f,null))['then'](saveUpdates(_0xf88877[_0x9498('0x47')],null))[_0x9498('0x24')](respondWithResult(_0x471e4f,null))['catch'](handleError(_0x471e4f,null));};exports['destroy']=function(_0x589ce3,_0x45a18a){return db['CmCompany']['find']({'where':{'id':_0x589ce3[_0x9498('0x41')]['id']}})[_0x9498('0x24')](handleEntityNotFound(_0x45a18a,null))['then'](removeEntity(_0x45a18a,null))['catch'](handleError(_0x45a18a,null));};exports[_0x9498('0x50')]=function(_0x2982ea,_0x47d337){return db[_0x9498('0x3d')][_0x9498('0x50')]()['then'](respondWithResult(_0x47d337,null))['catch'](handleError(_0x47d337,null));};exports[_0x9498('0x51')]=function(_0x2fca35,_0x7689fc,_0x5dc4fe){return db['CmContact'][_0x9498('0x45')]({'where':{'id':_0x2fca35[_0x9498('0x41')]['id']}})['then'](handleEntityNotFound(_0x7689fc,null))['then'](function(_0x364ede){if(_0x364ede){return _0x364ede[_0x9498('0x51')](_0x2fca35[_0x9498('0x47')][_0x9498('0x52')],_['omit'](_0x2fca35[_0x9498('0x47')],['ids','id'])||{});}})[_0x9498('0x24')](respondWithResult(_0x7689fc,null))['catch'](handleError(_0x7689fc,null));};exports['getContacts']=function(_0x4865fa,_0x162d0d,_0x2ce42b){var _0x3fdd4d={};var _0x1ce68e={};var _0x18bf52;var _0x2d5d6b;return db[_0x9498('0x3d')]['findOne']({'where':{'id':_0x4865fa[_0x9498('0x41')]['id']}})[_0x9498('0x24')](handleEntityNotFound(_0x162d0d,null))['then'](function(_0x742090){if(_0x742090){_0x18bf52=_0x742090;_0x1ce68e['model']=_['keys'](db[_0x9498('0x53')][_0x9498('0x42')]);_0x1ce68e[_0x9498('0x2e')]=_['keys'](_0x4865fa[_0x9498('0x2e')]);_0x1ce68e[_0x9498('0x30')]=_[_0x9498('0x31')](_0x1ce68e[_0x9498('0x2d')],_0x1ce68e['query']);_0x3fdd4d[_0x9498('0x32')]=_['intersection'](_0x1ce68e['model'],qs['fields'](_0x4865fa['query']['fields']));_0x3fdd4d['attributes']=_0x3fdd4d[_0x9498('0x32')]['length']?_0x3fdd4d[_0x9498('0x32')]:_0x1ce68e[_0x9498('0x2d')];_0x3fdd4d[_0x9498('0x54')]=qs[_0x9498('0x36')](_0x4865fa[_0x9498('0x2e')]['sort']);_0x3fdd4d['where']=qs['filters'](_[_0x9498('0x38')](_0x4865fa[_0x9498('0x2e')],_0x1ce68e[_0x9498('0x30')]));if(_0x4865fa[_0x9498('0x2e')][_0x9498('0x39')]){_0x3fdd4d[_0x9498('0x37')]=_[_0x9498('0x3a')](_0x3fdd4d[_0x9498('0x37')],{'$or':_[_0x9498('0x3b')](_0x3fdd4d[_0x9498('0x32')],function(_0x1a1c02){var _0x1798c5={};_0x1798c5[_0x1a1c02]={'$like':'%'+_0x4865fa[_0x9498('0x2e')]['filter']+'%'};return _0x1798c5;})});}_0x3fdd4d=_[_0x9498('0x3a')]({},_0x3fdd4d,_0x4865fa[_0x9498('0x3c')]);return _0x18bf52['getContacts'](_0x3fdd4d);}})['then'](function(_0x249cbd){if(_0x249cbd){_0x2d5d6b=_0x249cbd[_0x9498('0x34')];if(!_0x4865fa[_0x9498('0x2e')][_0x9498('0x35')](_0x9498('0x55'))){_0x3fdd4d[_0x9498('0x1d')]=qs['limit'](_0x4865fa[_0x9498('0x2e')]['limit']);_0x3fdd4d[_0x9498('0x1f')]=qs[_0x9498('0x1f')](_0x4865fa['query']['offset']);}return _0x18bf52['getContacts'](_0x3fdd4d);}})['then'](function(_0x11b012){if(_0x11b012){return _0x11b012?{'count':_0x2d5d6b,'rows':_0x11b012}:null;}})[_0x9498('0x24')](respondWithResult(_0x162d0d,null))['catch'](handleError(_0x162d0d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9eba3df..a3c4925 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 _0x5d44=['moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x5d44,0x1aa));var _0x45d4=function(_0x183156,_0x800d59){_0x183156=_0x183156-0x0;var _0x2e2f74=_0x5d44[_0x183156];return _0x2e2f74;};'use strict';var _=require(_0x45d4('0x0'));var util=require(_0x45d4('0x1'));var logger=require('../../config/logger')(_0x45d4('0x2'));var moment=require(_0x45d4('0x3'));var BPromise=require(_0x45d4('0x4'));var rp=require(_0x45d4('0x5'));var fs=require('fs');var path=require(_0x45d4('0x6'));var rimraf=require(_0x45d4('0x7'));var config=require('../../config/environment');var attributes=require(_0x45d4('0x8'));module[_0x45d4('0x9')]=function(_0x1d1d01,_0x5e0a76){return _0x1d1d01[_0x45d4('0xa')](_0x45d4('0xb'),attributes,{'tableName':_0x45d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5858=['bluebird','path','rimraf','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x2242a1,_0x38f44d){var _0x2c298b=function(_0x4f4246){while(--_0x4f4246){_0x2242a1['push'](_0x2242a1['shift']());}};_0x2c298b(++_0x38f44d);}(_0x5858,0xf9));var _0x8585=function(_0x28538c,_0x5d10ae){_0x28538c=_0x28538c-0x0;var _0x8418a6=_0x5858[_0x28538c];return _0x8418a6;};'use strict';var _=require(_0x8585('0x0'));var util=require(_0x8585('0x1'));var logger=require(_0x8585('0x2'))(_0x8585('0x3'));var moment=require('moment');var BPromise=require(_0x8585('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8585('0x5'));var rimraf=require(_0x8585('0x6'));var config=require('../../config/environment');var attributes=require(_0x8585('0x7'));module['exports']=function(_0x219595,_0xd3ff06){return _0x219595[_0x8585('0x8')](_0x8585('0x9'),attributes,{'tableName':_0x8585('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index f518e2a..cbed981 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 _0x97c1=['http','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x8226f7,_0x2a5275){var _0x4356ff=function(_0x3c206f){while(--_0x3c206f){_0x8226f7['push'](_0x8226f7['shift']());}};_0x4356ff(++_0x2a5275);}(_0x97c1,0xa6));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require(_0x197c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x197c('0x3'));var db=require(_0x197c('0x4'))['db'];var utils=require(_0x197c('0x5'));var logger=require(_0x197c('0x6'))(_0x197c('0x7'));var config=require(_0x197c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x197c('0x9')][_0x197c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d99b2,_0x453847,_0x246774){return new BPromise(function(_0x3f6e21,_0x1df44d){return client['request'](_0x3d99b2,_0x246774)[_0x197c('0xb')](function(_0x3f8cdd){logger['info'](_0x197c('0xc'),_0x453847,_0x197c('0xd'));logger[_0x197c('0xe')](_0x197c('0xf'),_0x453847,_0x197c('0xd'),JSON[_0x197c('0x10')](_0x3f8cdd));if(_0x3f8cdd[_0x197c('0x11')]){if(_0x3f8cdd[_0x197c('0x11')]['code']===0x1f4){logger[_0x197c('0x11')]('CmCompany,\x20%s,\x20%s',_0x453847,_0x3f8cdd[_0x197c('0x11')]['message']);return _0x1df44d(_0x3f8cdd[_0x197c('0x11')][_0x197c('0x12')]);}logger[_0x197c('0x11')](_0x197c('0xc'),_0x453847,_0x3f8cdd['error'][_0x197c('0x12')]);return _0x3f6e21(_0x3f8cdd['error'][_0x197c('0x12')]);}else{logger[_0x197c('0x13')](_0x197c('0xc'),_0x453847,_0x197c('0xd'));_0x3f6e21(_0x3f8cdd[_0x197c('0x14')][_0x197c('0x12')]);}})[_0x197c('0x15')](function(_0x1cfa82){logger[_0x197c('0x11')](_0x197c('0xc'),_0x453847,_0x1cfa82);_0x1df44d(_0x1cfa82);});});} \ No newline at end of file +var _0xf64e=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a82b,_0x30254e){var _0x5a2cdf=function(_0x47ac63){while(--_0x47ac63){_0x4a82b['push'](_0x4a82b['shift']());}};_0x5a2cdf(++_0x30254e);}(_0xf64e,0xa6));var _0xef64=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf64e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef64('0x0'));var BPromise=require(_0xef64('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef64('0x2'));var db=require(_0xef64('0x3'))['db'];var utils=require(_0xef64('0x4'));var logger=require(_0xef64('0x5'))('rpc');var config=require(_0xef64('0x6'));var jayson=require(_0xef64('0x7'));var client=jayson[_0xef64('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x224f69,_0x246c49,_0x2a3770){return new BPromise(function(_0x37a5d0,_0x3f2bad){return client[_0xef64('0x9')](_0x224f69,_0x2a3770)[_0xef64('0xa')](function(_0x4635ad){logger[_0xef64('0xb')](_0xef64('0xc'),_0x246c49,_0xef64('0xd'));logger[_0xef64('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x246c49,_0xef64('0xd'),JSON['stringify'](_0x4635ad));if(_0x4635ad[_0xef64('0xf')]){if(_0x4635ad[_0xef64('0xf')][_0xef64('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x246c49,_0x4635ad[_0xef64('0xf')][_0xef64('0x11')]);return _0x3f2bad(_0x4635ad[_0xef64('0xf')][_0xef64('0x11')]);}logger[_0xef64('0xf')](_0xef64('0xc'),_0x246c49,_0x4635ad[_0xef64('0xf')]['message']);return _0x37a5d0(_0x4635ad['error'][_0xef64('0x11')]);}else{logger[_0xef64('0xb')](_0xef64('0xc'),_0x246c49,_0xef64('0xd'));_0x37a5d0(_0x4635ad['result'][_0xef64('0x11')]);}})[_0xef64('0x12')](function(_0x5dfdb2){logger[_0xef64('0xf')](_0xef64('0xc'),_0x246c49,_0x5dfdb2);_0x3f2bad(_0x5dfdb2);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9f25eb7..4bebc5b 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 _0x3226=['./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3226,0x18f));var _0x6322=function(_0x4500e8,_0x3350b3){_0x4500e8=_0x4500e8-0x0;var _0x4de12a=_0x3226[_0x4500e8];return _0x4de12a;};'use strict';var multer=require(_0x6322('0x0'));var util=require(_0x6322('0x1'));var path=require(_0x6322('0x2'));var timeout=require(_0x6322('0x3'));var express=require(_0x6322('0x4'));var router=express[_0x6322('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6322('0x6'));var interaction=require(_0x6322('0x7'));var config=require(_0x6322('0x8'));var controller=require(_0x6322('0x9'));router[_0x6322('0xa')]('/',auth[_0x6322('0xb')](),controller[_0x6322('0xc')]);router[_0x6322('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x6322('0xd')]);router[_0x6322('0xa')](_0x6322('0xe'),auth[_0x6322('0xb')](),controller[_0x6322('0xf')]);router[_0x6322('0xa')]('/:id/contacts',auth[_0x6322('0xb')](),controller[_0x6322('0x10')]);router[_0x6322('0x11')]('/',auth[_0x6322('0xb')](),controller[_0x6322('0x12')]);router[_0x6322('0x11')](_0x6322('0x13'),auth['isAuthenticated'](),controller[_0x6322('0x14')]);router[_0x6322('0x15')](_0x6322('0xe'),auth[_0x6322('0xb')](),controller['update']);router[_0x6322('0x16')](_0x6322('0xe'),auth[_0x6322('0xb')](),controller['destroy']);module[_0x6322('0x17')]=router; \ No newline at end of file +var _0xadd8=['fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','show','/:id/contacts','getContacts','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4005fe,_0x1fc3c1){var _0x50022d=function(_0x2ce718){while(--_0x2ce718){_0x4005fe['push'](_0x4005fe['shift']());}};_0x50022d(++_0x1fc3c1);}(_0xadd8,0x6e));var _0x8add=function(_0x37c611,_0x46b14d){_0x37c611=_0x37c611-0x0;var _0x47d593=_0xadd8[_0x37c611];return _0x47d593;};'use strict';var multer=require(_0x8add('0x0'));var util=require(_0x8add('0x1'));var path=require(_0x8add('0x2'));var timeout=require('connect-timeout');var express=require(_0x8add('0x3'));var router=express[_0x8add('0x4')]();var fs_extra=require(_0x8add('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8add('0x6'));var config=require(_0x8add('0x7'));var controller=require(_0x8add('0x8'));router[_0x8add('0x9')]('/',auth[_0x8add('0xa')](),controller[_0x8add('0xb')]);router[_0x8add('0x9')]('/describe',auth[_0x8add('0xa')](),controller['describe']);router[_0x8add('0x9')]('/:id',auth[_0x8add('0xa')](),controller[_0x8add('0xc')]);router['get'](_0x8add('0xd'),auth[_0x8add('0xa')](),controller[_0x8add('0xe')]);router[_0x8add('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8add('0xf')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x8add('0x10')]);router[_0x8add('0x11')](_0x8add('0x12'),auth[_0x8add('0xa')](),controller[_0x8add('0x13')]);router[_0x8add('0x14')](_0x8add('0x12'),auth[_0x8add('0xa')](),controller[_0x8add('0x15')]);module[_0x8add('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 3bb876c..bdec144 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 _0x2191=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2191,0x1a6));var _0x1219=function(_0x5d4b4b,_0xf154cb){_0x5d4b4b=_0x5d4b4b-0x0;var _0x2337b8=_0x2191[_0x5d4b4b];return _0x2337b8;};'use strict';var _=require(_0x1219('0x0'));var Sequelize=require(_0x1219('0x1'));module[_0x1219('0x2')]={'firstName':{'type':Sequelize[_0x1219('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1219('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1219('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1219('0x3')]},'dateOfBirth':{'type':Sequelize[_0x1219('0x3')]},'description':{'type':Sequelize[_0x1219('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1219('0x3')]},'fax':{'type':Sequelize[_0x1219('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x1219('0x3')]},'facebook':{'type':Sequelize[_0x1219('0x3')]},'fb_data':{'type':Sequelize[_0x1219('0x3')]},'twitter':{'type':Sequelize[_0x1219('0x3')]},'skype':{'type':Sequelize[_0x1219('0x3')]},'teams':{'type':Sequelize[_0x1219('0x3')]},'viber':{'type':Sequelize[_0x1219('0x3')]},'line':{'type':Sequelize[_0x1219('0x3')]},'wechat':{'type':Sequelize[_0x1219('0x3')]},'telegram':{'type':Sequelize[_0x1219('0x3')]},'UserId':{'type':Sequelize[_0x1219('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x1219('0x3')]},'priority':{'type':Sequelize[_0x1219('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1219('0x6')],'defaultValue':Sequelize[_0x1219('0x7')]},'dialTimezone':{'type':Sequelize[_0x1219('0x3')]},'utcOffset':{'type':Sequelize[_0x1219('0x5')]}}; \ No newline at end of file +var _0xbd16=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','exports'];(function(_0x26f3e8,_0x4d6606){var _0xbc9247=function(_0x4e9480){while(--_0x4e9480){_0x26f3e8['push'](_0x26f3e8['shift']());}};_0xbc9247(++_0x4d6606);}(_0xbd16,0xa6));var _0x6bd1=function(_0x429e9b,_0x3bade6){_0x429e9b=_0x429e9b-0x0;var _0x968603=_0xbd16[_0x429e9b];return _0x968603;};'use strict';var _=require(_0x6bd1('0x0'));var Sequelize=require('sequelize');module[_0x6bd1('0x1')]={'firstName':{'type':Sequelize[_0x6bd1('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6bd1('0x2')]},'street':{'type':Sequelize[_0x6bd1('0x2')]},'postalCode':{'type':Sequelize[_0x6bd1('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6bd1('0x2')]},'dateOfBirth':{'type':Sequelize[_0x6bd1('0x2')]},'description':{'type':Sequelize[_0x6bd1('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6bd1('0x2')]},'fax':{'type':Sequelize[_0x6bd1('0x2')]},'email':{'type':Sequelize[_0x6bd1('0x2')]},'url':{'type':Sequelize[_0x6bd1('0x2')]},'facebook':{'type':Sequelize[_0x6bd1('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x6bd1('0x2')]},'skype':{'type':Sequelize[_0x6bd1('0x2')]},'teams':{'type':Sequelize[_0x6bd1('0x2')]},'viber':{'type':Sequelize[_0x6bd1('0x2')]},'line':{'type':Sequelize[_0x6bd1('0x2')]},'wechat':{'type':Sequelize[_0x6bd1('0x2')]},'telegram':{'type':Sequelize[_0x6bd1('0x2')]},'UserId':{'type':Sequelize[_0x6bd1('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x6bd1('0x2')]},'priority':{'type':Sequelize[_0x6bd1('0x4')](0x2)[_0x6bd1('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6bd1('0x6')],'defaultValue':Sequelize[_0x6bd1('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x6bd1('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e36aeef..9de5477 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 _0x4b37=['t.id\x20=\x20ct.TagId','expr','search','parseSearch','conditions','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','value','dateOfBirth','datetime','castTo','DATE','buildExpression','start','filter','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','c.id','DESC','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','find','describe','tags','columnName','displayName','analytics','findAll','alias','custom','values','body','get','mergeWith','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','destroy','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappMessage','WhatsappQueueReport','join','dialTimezone','isNil','timezones','additionalPhones','bulkCreate','duplicates','findOrCreate','spread','all','params','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','format','cf_%d','utcOffset','pickBy','setFields','toParam','text','phone','getTags','rawAttributes','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','PHONE','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','toContactId','hopperId','getHoppers','options','includeAll','ContactId','include','getHopperFinals','CmHopperFinal','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','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','exit','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','starttime','endtime','duration','note','userDisposition','userThirdDisposition','fullname','createdAt','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Account','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','externalUrl','findAndCountAll','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/advancedSearch','api','../../config/environment/shared','../../mysqldb','redis','localhost','register','offset','undefined','limit','count','status','set','Content-Range','json','update','then','end','sendStatus','stack','name','send','index','CmContact','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id'];(function(_0x202cf2,_0x4094f5){var _0x53d344=function(_0x143f40){while(--_0x143f40){_0x202cf2['push'](_0x202cf2['shift']());}};_0x53d344(++_0x4094f5);}(_0x4b37,0xfc));var _0x74b3=function(_0x267a80,_0x16ea3c){_0x267a80=_0x267a80-0x0;var _0x217866=_0x4b37[_0x267a80];return _0x217866;};'use strict';var moment=require(_0x74b3('0x0'));var BPromise=require(_0x74b3('0x1'));var util=require(_0x74b3('0x2'));var path=require(_0x74b3('0x3'));var fs=require('fs');var _=require(_0x74b3('0x4'));var squel=require(_0x74b3('0x5'));var Papa=require(_0x74b3('0x6'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x74b3('0x7'));var logger=require('../../config/logger')(_0x74b3('0x8'));var config=require('../../config/environment');var shared=require(_0x74b3('0x9'));var db=require(_0x74b3('0xa'))['db'];config[_0x74b3('0xb')]=_['defaults'](config[_0x74b3('0xb')],{'host':_0x74b3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74b3('0xb')]));require('./cmContact.socket')[_0x74b3('0xd')](socket);function respondWithResult(_0x374609,_0x3a75c4){_0x3a75c4=_0x3a75c4||0xc8;return function(_0x2eb16c){if(_0x2eb16c){return _0x374609['status'](_0x3a75c4)['json'](_0x2eb16c);}};}function respondWithFilteredResult(_0x4b1016,_0x316820){return function(_0x58a156){if(_0x58a156){var _0x6fea9c=typeof _0x316820[_0x74b3('0xe')]===_0x74b3('0xf')&&typeof _0x316820[_0x74b3('0x10')]===_0x74b3('0xf');var _0x230de9=_0x58a156[_0x74b3('0x11')];var _0x3c6018=_0x6fea9c?0x0:_0x316820[_0x74b3('0xe')];var _0x2d9944=_0x6fea9c?_0x58a156[_0x74b3('0x11')]:_0x316820[_0x74b3('0xe')]+_0x316820[_0x74b3('0x10')];var _0x5249dd;if(_0x2d9944>=_0x230de9){_0x2d9944=_0x230de9;_0x5249dd=0xc8;}else{_0x5249dd=0xce;}_0x4b1016[_0x74b3('0x12')](_0x5249dd);return _0x4b1016[_0x74b3('0x13')](_0x74b3('0x14'),_0x3c6018+'-'+_0x2d9944+'/'+_0x230de9)[_0x74b3('0x15')](_0x58a156);}return null;};}function saveUpdates(_0x4968c9){return function(_0x3eb2e4){if(_0x3eb2e4){return _0x3eb2e4[_0x74b3('0x16')](_0x4968c9)[_0x74b3('0x17')](function(_0x3d66c1){return _0x3d66c1;});}return null;};}function removeEntity(_0x13b15f){return function(_0x55fbd4){if(_0x55fbd4){return _0x55fbd4['destroy']()[_0x74b3('0x17')](function(){_0x13b15f['status'](0xcc)[_0x74b3('0x18')]();});}};}function handleEntityNotFound(_0x359195){return function(_0x5436e6){if(!_0x5436e6){_0x359195[_0x74b3('0x19')](0x194);}return _0x5436e6;};}function handleError(_0x415277,_0x19d13b){_0x19d13b=_0x19d13b||0x1f4;return function(_0x3865a5){logger['error'](_0x3865a5[_0x74b3('0x1a')]);if(_0x3865a5[_0x74b3('0x1b')]){delete _0x3865a5[_0x74b3('0x1b')];}_0x415277['status'](_0x19d13b)[_0x74b3('0x1c')](_0x3865a5);};}exports[_0x74b3('0x1d')]=function(_0x485ac8,_0x56e157){var _0x4e8faf={},_0x5d9fe9={},_0x387dd8={'count':0x0,'rows':[]};return db[_0x74b3('0x1e')]['describe']()[_0x74b3('0x17')](function(_0xbc6c2a){var _0x1aee87=[];for(var _0x18d1a8=0x0;_0x18d1a80x1){_0x51d427['or'](_0x74b3('0x5e'),qs['getFullTextValue'](_0x4a2214),null);}else{if(qs[_0x74b3('0x5f')](_0x4a2214)){_0x51d427['or'](_0x74b3('0x60'),_0x4a2214+'%');_0x51d427['or']('c.phone\x20LIKE\x20?',_0x4a2214+'%');_0x51d427['or']('c.mobile\x20LIKE\x20?',_0x4a2214+'%');_0x51d427['or'](_0x74b3('0x61'),_0x4a2214+'%');}else if(qs[_0x74b3('0x62')](_0x4a2214)){_0x51d427['or'](_0x74b3('0x63'),_0x4a2214+'%');}else{_0x51d427['or']('c.firstName\x20LIKE\x20?','%'+_0x4a2214+'%');_0x51d427['or'](_0x74b3('0x64'),'%'+_0x4a2214+'%');_0x51d427['or'](_0x74b3('0x63'),'%'+_0x4a2214+'%');}}}}_0x1b88d7['where'](_0x51d427);_0x1b88d7[_0x74b3('0x65')]('c.id');var _0x5ebceb={'type':db[_0x74b3('0x66')][_0x74b3('0x67')][_0x74b3('0x68')],'raw':!![]};var _0x2aea67=_0x1b88d7[_0x74b3('0x69')]()[_0x74b3('0x35')](_0x74b3('0x6a'));if(_0x4e8faf[_0x74b3('0x30')]){_0x4e8faf[_0x74b3('0x30')][_0x74b3('0x47')](function(_0x25cd4c){_0x1b88d7[_0x74b3('0x30')]('c.'+_0x25cd4c[0x0],_0x25cd4c[0x1]===_0x74b3('0x6b')?![]:!![]);});}if(!_[_0x74b3('0x55')](_0x213dae)){_0x1b88d7['having'](_0x5d9c33);_0x2aea67[_0x74b3('0x32')]('t.id\x20IN\x20?',_0x213dae);}BPromise[_0x74b3('0x6c')]()['then'](function(){if(!_0x5e065b)return;if(_0x485ac8[_0x74b3('0x6d')][_0x74b3('0x6e')]!==_0x74b3('0x6f'))return;if(!_[_0x74b3('0x70')](_0x5e065b['conditions'],[_0x74b3('0x35'),_0x74b3('0x4a')])){return _0x485ac8[_0x74b3('0x6d')][_0x74b3('0x71')]({'attributes':['id'],'raw':!![]})[_0x74b3('0x17')](function(_0x402871){if(_['isEmpty'](_0x402871)){_0x2aea67['where'](_0x74b3('0x72'));_0x1b88d7[_0x74b3('0x32')](_0x74b3('0x72'));}else{_0x2aea67['where'](_0x74b3('0x57'),_[_0x74b3('0x46')](_0x402871,'id'));_0x1b88d7['where'](_0x74b3('0x57'),_['map'](_0x402871,'id'));}});}})['then'](function(){if(_0x485ac8[_0x74b3('0x6d')][_0x74b3('0x6e')]===_0x74b3('0x6f')&&!_0x5e065b&&!_0x485ac8[_0x74b3('0x2a')]['ListId'])return[];return db[_0x74b3('0x73')]['query'](_0x2aea67[_0x74b3('0x74')](),_0x5ebceb);})[_0x74b3('0x17')](function(_0x5a7339){_0x387dd8[_0x74b3('0x11')]=_0x5a7339[_0x74b3('0x20')];if(_0x387dd8['count']===0x0)return[];return db[_0x74b3('0x73')][_0x74b3('0x2a')](_0x2e5c93[_0x74b3('0x74')](),_0x5ebceb)['then'](function(_0x13bebf){_0x29ed44=_[_0x74b3('0x75')](_0x13bebf,'id');_0x5ebceb=_[_0x74b3('0x76')](_0x5ebceb,{'model':db[_0x74b3('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x485ac8[_0x74b3('0x2a')][_0x74b3('0x2e')]){_0x4e8faf['attributes'][_0x74b3('0x47')](function(_0x28c0b5){_0x1b88d7[_0x74b3('0x35')]('c.'+_0x28c0b5);});}else{_0x1b88d7[_0x74b3('0x35')](_0x74b3('0x6a'));_0x1b88d7[_0x74b3('0x35')](_0x74b3('0x77'));_0x1b88d7['field'](_0x74b3('0x78'));_0x1b88d7[_0x74b3('0x35')](_0x74b3('0x79'));_0x1b88d7[_0x74b3('0x35')](_0x74b3('0x7a'));_0x1b88d7[_0x74b3('0x35')]('c.fax');_0x1b88d7[_0x74b3('0x35')](_0x74b3('0x7b'));_0x1b88d7[_0x74b3('0x35')](_0x74b3('0x7c'));_0x1b88d7['field']('c.createdAt');_0x1b88d7['field'](_0x74b3('0x7d'));_0x1b88d7[_0x74b3('0x35')](_0x74b3('0x7e'));_0x1b88d7['field'](_0x74b3('0x7f'),'TagIds');}if(_0x4e8faf['limit'])_0x1b88d7[_0x74b3('0x10')](_0x4e8faf[_0x74b3('0x10')]);if(_0x4e8faf['offset'])_0x1b88d7['offset'](_0x4e8faf[_0x74b3('0xe')]);return db['sequelize'][_0x74b3('0x2a')](_0x1b88d7[_0x74b3('0x74')](),_0x5ebceb);});})[_0x74b3('0x17')](function(_0x3685c0){_0x3685c0[_0x74b3('0x47')](function(_0x4df1b1){if(_0x4df1b1[_0x74b3('0x80')]){_0x4df1b1[_0x74b3('0x81')]=[];_0x4df1b1[_0x74b3('0x80')][_0x74b3('0x45')](',')[_0x74b3('0x47')](function(_0xbd63f7){_0x4df1b1[_0x74b3('0x81')][_0x74b3('0x22')](_0x29ed44[_0xbd63f7]);});}delete _0x4df1b1[_0x74b3('0x80')];});_0x387dd8[_0x74b3('0x82')]=_0x3685c0;return _0x387dd8;})['then'](respondWithFilteredResult(_0x56e157,_0x4e8faf));})[_0x74b3('0x83')](handleError(_0x56e157,null));};exports['destroy']=function(_0x2a4047,_0x34ff6d){return db[_0x74b3('0x1e')][_0x74b3('0x84')]({'where':{'id':_0x2a4047['params']['id']}})[_0x74b3('0x17')](handleEntityNotFound(_0x34ff6d,null))[_0x74b3('0x17')](removeEntity(_0x34ff6d,null))[_0x74b3('0x83')](handleError(_0x34ff6d,null));};exports[_0x74b3('0x85')]=function(_0x310c57,_0x5b1eb5){return db[_0x74b3('0x1e')][_0x74b3('0x85')]()[_0x74b3('0x17')](function(_0x948e87){delete _0x948e87[_0x74b3('0x86')];for(var _0x4d6336=0x0;_0x4d63360x0){return new Promise(function(_0x226ee9,_0x4fd0fe){var _0x548d56=[];for(var _0x1cea67=0x0;_0x1cea67<_0xc7a712[_0x74b3('0x20')];_0x1cea67++){_0x548d56[_0x74b3('0x22')](insertAdditionalPhones(_0xc7a712[_0x1cea67]['contact'],_0xc7a712[_0x1cea67]['additionalPhones']));}Promise[_0x74b3('0xb6')](_0x548d56)['then'](function(){_0x226ee9(0x1);});})[_0x74b3('0x17')](function(){return{'success':_0x3e7170,'failure':_0x3e956b,'duplicates':_0x2512e5};});}else{return{'success':_0x3e7170,'failure':_0x3e956b,'duplicates':_0x2512e5};}}})[_0x74b3('0x17')](respondWithResult(_0x43d38b,0xc9))[_0x74b3('0x83')](handleError(_0x43d38b,null));};exports['show']=function(_0x3e4fbe,_0x3451d1){var _0x52af37;return db[_0x74b3('0x1e')]['describe']()[_0x74b3('0x17')](function(_0x2999cb){return db[_0x74b3('0x1e')]['find']({'where':{'id':_0x3e4fbe[_0x74b3('0xb7')]['id']},'include':[{'model':db['Tag'],'as':_0x74b3('0x81'),'attributes':['id','name',_0x74b3('0x36')],'required':_0x3e4fbe[_0x74b3('0x2a')][_0x74b3('0x5b')]?!![]:![]},{'model':db[_0x74b3('0xa3')],'as':_0x74b3('0xb8'),'where':{'CmContactId':_0x3e4fbe['params']['id']},'required':![],'include':[{'model':db[_0x74b3('0xb9')],'as':_0x74b3('0xba')}]}],'order':[db[_0x74b3('0x73')][_0x74b3('0xbb')](_0x74b3('0xbc'))],'attributes':_['keys'](_0x2999cb)});})[_0x74b3('0x17')](function(_0xf49fae){if(!_['isNil'](_0xf49fae)){_0x52af37=_0xf49fae[_0x74b3('0x8f')]({'plain':!![]});var _0x23a649={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf49fae&&_0xf49fae[_0x74b3('0x56')]){if(_0xf49fae[_0x74b3('0x56')]){_0x23a649['where'][_0x74b3('0xbd')][_0x74b3('0x22')]({'ListId':{'$ne':_0xf49fae[_0x74b3('0x56')]}});}}return db[_0x74b3('0x23')][_0x74b3('0x8a')](_0x23a649);}})[_0x74b3('0x17')](function(_0x332b2e){if(!_[_0x74b3('0xaf')](_0x332b2e)){return _[_0x74b3('0xbe')](_0x52af37,_[_0x74b3('0x46')](_0x332b2e,function(_0x573119){return util[_0x74b3('0xbf')](_0x74b3('0xc0'),_0x573119['id']);}));}})['then'](handleEntityNotFound(_0x3451d1,null))['then'](respondWithResult(_0x3451d1,null))[_0x74b3('0x83')](handleError(_0x3451d1,null));};exports[_0x74b3('0x16')]=function(_0x19b873,_0x25f9c6){var _0x34f9af;if(_0x19b873[_0x74b3('0x8e')]['id']){delete _0x19b873[_0x74b3('0x8e')]['id'];}if(!_['isNil'](_0x19b873['body'][_0x74b3('0xae')])){var _0xc87a94=_0x19b873[_0x74b3('0x8e')][_0x74b3('0xae')];if(!_[_0x74b3('0xaf')](shared[_0x74b3('0xb0')][_0xc87a94]))_0x19b873['body'][_0x74b3('0xc1')]=shared['timezones'][_0xc87a94][_0x74b3('0xc1')];}return db[_0x74b3('0x1e')]['find']({'where':{'id':_0x19b873[_0x74b3('0xb7')]['id']}})[_0x74b3('0x17')](handleEntityNotFound(_0x25f9c6,null))['then'](saveUpdates(_0x19b873[_0x74b3('0x8e')],null))[_0x74b3('0x17')](function(_0x50403f){_0x34f9af=_0x50403f;var _0x1ac5d3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x50403f&&_0x50403f[_0x74b3('0x56')]){if(_0x50403f[_0x74b3('0x56')]){_0x1ac5d3[_0x74b3('0x32')]['$and'][_0x74b3('0x22')]({'ListId':{'$ne':_0x50403f[_0x74b3('0x56')]}});}}return db['CmCustomField']['findAll'](_0x1ac5d3);})[_0x74b3('0x17')](function(_0x9b76e1){if(_0x9b76e1){return _[_0x74b3('0xbe')](_[_0x74b3('0xc2')](_0x19b873['body'],function(_0x36436a,_0x3ff643){return _[_0x74b3('0x21')](_0x3ff643,_0x74b3('0x26'));}),_['map'](_0x9b76e1,function(_0x28984d){return util[_0x74b3('0xbf')]('cf_%d',_0x28984d['id']);}));}})['then'](function(_0x45bba2){if(_0x45bba2&&!_[_0x74b3('0x55')](_0x45bba2)){var _0xf300a7=squel[_0x74b3('0x16')]()['table']('cm_contacts')[_0x74b3('0xc3')](_0x45bba2)[_0x74b3('0x32')]('id\x20=\x20?',_0x19b873[_0x74b3('0xb7')]['id'])[_0x74b3('0xc4')]();return db[_0x74b3('0x73')][_0x74b3('0x2a')](_0xf300a7[_0x74b3('0xc5')],{'replacements':_0xf300a7[_0x74b3('0x8d')]});}})['then'](function(){if(_0x19b873['body'][_0x74b3('0xc6')]&&_0x34f9af){return db[_0x74b3('0x92')]['update']({'phone':_0x19b873[_0x74b3('0x8e')][_0x74b3('0xc6')],'OrderBy':0x0},{'where':{'ContactId':_0x34f9af['id']}});}})[_0x74b3('0x17')](function(){return _0x34f9af;})['then'](respondWithResult(_0x25f9c6,null))[_0x74b3('0x83')](handleError(_0x25f9c6,null));};exports[_0x74b3('0xc7')]=function(_0x2ae387,_0xb430ef){var _0x271632={};var _0x34779d={};var _0x421d2f;var _0x18b532;return db[_0x74b3('0x1e')]['findOne']({'where':{'id':_0x2ae387['params']['id']}})[_0x74b3('0x17')](handleEntityNotFound(_0xb430ef,null))[_0x74b3('0x17')](function(_0x36a1b5){if(_0x36a1b5){_0x421d2f=_0x36a1b5;_0x34779d[_0x74b3('0x29')]=_[_0x74b3('0x1f')](db[_0x74b3('0x44')][_0x74b3('0xc8')]);_0x34779d['query']=_['keys'](_0x2ae387[_0x74b3('0x2a')]);_0x34779d['filters']=_[_0x74b3('0x2c')](_0x34779d[_0x74b3('0x29')],_0x34779d['query']);_0x271632[_0x74b3('0x2d')]=_[_0x74b3('0x2c')](_0x34779d[_0x74b3('0x29')],qs[_0x74b3('0x2e')](_0x2ae387[_0x74b3('0x2a')][_0x74b3('0x2e')]));_0x271632[_0x74b3('0x2d')]=_0x271632[_0x74b3('0x2d')]['length']?_0x271632[_0x74b3('0x2d')]:_0x34779d['model'];_0x271632['order']=qs['sort'](_0x2ae387[_0x74b3('0x2a')]['sort']);_0x271632[_0x74b3('0x32')]=qs[_0x74b3('0x2b')](_['pick'](_0x2ae387[_0x74b3('0x2a')],_0x34779d[_0x74b3('0x2b')]));if(_0x2ae387[_0x74b3('0x2a')][_0x74b3('0x53')]){_0x271632[_0x74b3('0x32')]=_[_0x74b3('0x76')](_0x271632[_0x74b3('0x32')],{'$or':_[_0x74b3('0x46')](_0x271632['attributes'],function(_0x2b0f01){var _0x24ea3e={};_0x24ea3e[_0x2b0f01]={'$like':'%'+_0x2ae387[_0x74b3('0x2a')][_0x74b3('0x53')]+'%'};return _0x24ea3e;})});}_0x271632=_['merge']({},_0x271632,_0x2ae387['options']);return _0x421d2f[_0x74b3('0xc7')](_0x271632);}})[_0x74b3('0x17')](function(_0x27128a){if(_0x27128a){_0x18b532=_0x27128a[_0x74b3('0x20')];if(!_0x2ae387[_0x74b3('0x2a')][_0x74b3('0x2f')](_0x74b3('0xc9'))){_0x271632['limit']=qs['limit'](_0x2ae387[_0x74b3('0x2a')][_0x74b3('0x10')]);_0x271632[_0x74b3('0xe')]=qs[_0x74b3('0xe')](_0x2ae387['query'][_0x74b3('0xe')]);}return _0x421d2f[_0x74b3('0xc7')](_0x271632);}})[_0x74b3('0x17')](function(_0x24defd){if(_0x24defd){return _0x24defd?{'count':_0x18b532,'rows':_0x24defd}:null;}})[_0x74b3('0x17')](respondWithResult(_0xb430ef,null))[_0x74b3('0x83')](handleError(_0xb430ef,null));};exports[_0x74b3('0xca')]=function(_0x1c116e,_0x1a409a){if(_0x1c116e['body']['id']){delete _0x1c116e['body']['id'];}return db[_0x74b3('0x1e')][_0x74b3('0x24')]({'where':{'id':_0x1c116e[_0x74b3('0xb7')]['id']}})[_0x74b3('0x17')](handleEntityNotFound(_0x1a409a,null))[_0x74b3('0x17')](function(_0x463f00){if(_0x463f00){return _0x463f00['setTags'](_0x1c116e['body'][_0x74b3('0xcb')]||[]);}return null;})['then'](respondWithResult(_0x1a409a,null))['catch'](handleError(_0x1a409a,null));};exports[_0x74b3('0xcc')]=function(_0x145297,_0x921dd0){var _0x23ea7d=[];_0x23ea7d[_0x74b3('0x22')](addAdditionalPhones(_0x145297[_0x74b3('0x8e')]));Promise[_0x74b3('0xb6')](_0x23ea7d)[_0x74b3('0x17')](function(){_0x23ea7d=[];_0x23ea7d[_0x74b3('0x22')](deleteCmHopperPhones(_0x145297[_0x74b3('0x8e')]['id']));_0x23ea7d[_0x74b3('0x22')](addCmHopperPhones(_0x145297['body']['id']));Promise[_0x74b3('0xb6')](_0x23ea7d)['then'](function(){return[0x1];})[_0x74b3('0x17')](respondWithResult(_0x921dd0,null));});};function addAdditionalPhones(_0x2af152){var _0x5814f0;return new Promise(function(_0x147064,_0x5f56f1){return db[_0x74b3('0xa3')][_0x74b3('0x96')]({'where':{'CmContactId':_0x2af152['id']}})[_0x74b3('0x17')](function(){db[_0x74b3('0xb9')][_0x74b3('0x8a')]({'raw':!![],'attributes':['id',_0x74b3('0xcd')]})['then'](function(_0x108576){var _0x573650=[];for(var _0x22972d=0x0;_0x22972d<_0x2af152[_0x74b3('0xce')][_0x74b3('0x20')];_0x22972d++){var _0x56fdc4=_0x2af152[_0x74b3('0xcf')]?_['isNil'](_0x2af152[_0x74b3('0xcf')][_0x22972d])?'':_0x2af152[_0x74b3('0xcf')][_0x22972d]:_0x2af152[_0x74b3('0xce')][_0x22972d][_0x74b3('0xd0')]?_0x2af152[_0x74b3('0xce')][_0x22972d][_0x74b3('0xd0')]:'';var _0x18c7af=_[_0x74b3('0xaf')](_0x2af152['items'][_0x22972d][_0x74b3('0xd1')])?'':_0x2af152[_0x74b3('0xce')][_0x22972d][_0x74b3('0xd1')];var _0x118a88=_0x56fdc4+':'+_0x2af152[_0x74b3('0xce')][_0x22972d][_0x74b3('0xc6')]+'§'+_0x18c7af;if(_[_0x74b3('0xaf')](_0x5814f0))_0x5814f0=_0x118a88;else _0x5814f0+=';'+_0x118a88;var _0x369382=null;if(_0x2af152[_0x74b3('0xcf')]){if(!_['isNil'](_0x2af152['item_types'][_0x22972d])){var _0x33193c=_[_0x74b3('0x84')](_0x108576,function(_0x4a437e){return _0x4a437e['id']===_0x2af152[_0x74b3('0xcf')][_0x22972d];});if(!_[_0x74b3('0xaf')](_0x33193c)){_0x369382=_0x33193c[_0x74b3('0xcd')];}}}else{if(!_[_0x74b3('0xaf')](_0x2af152[_0x74b3('0xce')][_0x22972d])){var _0x33193c=_[_0x74b3('0x84')](_0x108576,function(_0x19f8c5){return _0x19f8c5['id']===_0x2af152['items'][_0x22972d][_0x74b3('0xd0')];});if(!_[_0x74b3('0xaf')](_0x33193c)){_0x369382=_0x22972d;}}}if(_[_0x74b3('0xaf')](_0x369382)){_0x369382=0x64;}_0x573650[_0x74b3('0x22')](addAdditionalPhone(_0x2af152['id'],_0x2af152['items'][_0x22972d][_0x74b3('0xc6')],_0x2af152[_0x74b3('0xcf')]?_[_0x74b3('0xaf')](_0x2af152[_0x74b3('0xcf')][_0x22972d])?null:_0x2af152['item_types'][_0x22972d]:_0x2af152['items'][_0x22972d][_0x74b3('0xd0')]?_0x2af152['items'][_0x22972d][_0x74b3('0xd0')]:null,_0x369382,_0x18c7af));}Promise[_0x74b3('0xb6')](_0x573650)[_0x74b3('0x17')](function(){db['CmContact'][_0x74b3('0x16')]({'AdditionalPhones':_0x5814f0},{'where':{'id':_0x2af152['id']}})['then'](function(){_0x147064(0x1);});});});});});}function addAdditionalPhone(_0x505244,_0x49c98d,_0x4660a0,_0x18be0e,_0x2b4203){return db[_0x74b3('0xa3')][_0x74b3('0x84')]({'where':{'CmContactId':_0x505244,'item':_0x49c98d}})['then'](function(_0x141c0e){if(_0x141c0e)logger[_0x74b3('0x93')](_0x74b3('0xd2'),_0x141c0e);else{db[_0x74b3('0xa3')]['create']({'CmContactId':_0x505244,'item':_0x49c98d,'ItemTypeId':_0x4660a0,'OrderBy':_0x18be0e,'ItemClass':'PHONE','description':_0x2b4203});}});}function deletePhones(_0x51a908){return db[_0x74b3('0xa3')][_0x74b3('0x96')]({'where':{'CmContactId':_0x51a908}});}function deleteCmHopperPhones(_0x1b3519){return new Promise(function(_0x46e428,_0x1beb95){return db[_0x74b3('0x92')][_0x74b3('0x8a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1b3519}})[_0x74b3('0x17')](function(_0x392467){db[_0x74b3('0xd3')][_0x74b3('0x96')]({'where':{'CmHopperId':{'$in':_['map'](_0x392467,'id')}}});})[_0x74b3('0x17')](function(){_0x46e428(0x1);});});}function addCmHopperPhones(_0xff5050){return new Promise(function(_0x3a2ce3,_0x1283e7){return db[_0x74b3('0x92')][_0x74b3('0x8a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xff5050}})[_0x74b3('0x17')](function(_0x4ab595){var _0x3725f6=[];_['map'](_0x4ab595,function(_0x5abe55){_0x3725f6[_0x74b3('0x22')](createCmHopperPhone(_0xff5050,_0x5abe55['id']));});Promise[_0x74b3('0xb6')](_0x3725f6)['then'](function(){_0x3a2ce3(0x1);});});});}function createCmHopperPhone(_0x48aca8,_0x5859a1){return new Promise(function(_0x529fc2,_0x2d2866){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':['item',_0x74b3('0xcd')],'where':{'CmContactId':_0x48aca8,'ItemClass':_0x74b3('0xd4')},'include':[{'model':db[_0x74b3('0xb9')],'attributes':[_0x74b3('0xcd')],'as':_0x74b3('0xba')}],'order':[_0x74b3('0xcd'),db['sequelize'][_0x74b3('0xbb')](_0x74b3('0xd5'))]})['then'](function(_0x4b2a7c){var _0x5b3409=0x1;var _0x4509b2=_[_0x74b3('0x46')](_0x4b2a7c,function(_0x1c8fa8){_0x1c8fa8[_0x74b3('0xd6')]=_0x5859a1;_0x1c8fa8[_0x74b3('0xc6')]=_0x1c8fa8[_0x74b3('0xd7')];_0x1c8fa8[_0x74b3('0xcd')]=_0x5b3409;delete _0x1c8fa8[_0x74b3('0xd8')];_0x5b3409=_0x5b3409+0x1;return _0x1c8fa8;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x4509b2,{});})['then'](function(){_0x529fc2(0x1);});});}function insertAdditionalPhones(_0x338995,_0x518796){return new Promise(function(_0x40d28c,_0x30de3d){var _0x17d3c4=[];for(var _0x320b51=0x0;_0x320b51<_0x518796[_0x74b3('0x20')];_0x320b51++){var _0xab534=_0x518796[_0x320b51];_0x17d3c4[_0x74b3('0x22')](parseContactItemType(_0xab534));}Promise[_0x74b3('0xb6')](_0x17d3c4)[_0x74b3('0x17')](function(){var _0x2b9d1c={'id':_0x338995['id'],'items':_0x518796};return addAdditionalPhones(_0x2b9d1c)[_0x74b3('0x17')](function(_0x5a612e){return addCmHopperPhones(_0x338995['id']);});})[_0x74b3('0x17')](function(){_0x40d28c(_0x338995);});});}function parseContactItemType(_0xc8aa96){return new Promise(function(_0x47e155,_0x1e84d7){if(_0xc8aa96[_0x74b3('0x2f')](_0x74b3('0xd0'))){_0x47e155(_0xc8aa96);}else{return db[_0x74b3('0xb9')][_0x74b3('0x84')]({'where':{'name':_0xc8aa96[_0x74b3('0xba')]}})[_0x74b3('0x17')](function(_0x5d8b0b){if(_[_0x74b3('0xaf')](_0x5d8b0b))_0xc8aa96['ItemTypeId']=null;else _0xc8aa96[_0x74b3('0xd0')]=_0x5d8b0b['id'];_0x47e155(_0xc8aa96);});}});}exports[_0x74b3('0xd9')]=function(_0x399b54,_0x43d131){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x399b54[_0x74b3('0xb7')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0x74b3('0xba')}],'order':[['OrderBy'],[db[_0x74b3('0x73')]['literal']('`ItemType`.OrderBy')]]})[_0x74b3('0x17')](function(_0x5c7d3d){return _0x5c7d3d;})['then'](respondWithResult(_0x43d131,null))[_0x74b3('0x83')](handleError(_0x43d131,null));};exports[_0x74b3('0xda')]=function(_0x17be5d,_0x130038){return db[_0x74b3('0xa3')]['findAll']({'raw':!![],'where':{'CmContactId':_0x17be5d['body']['fromContactId']}})[_0x74b3('0x17')](function(_0x30821c){var _0x346946=_['map'](_0x30821c,function(_0x199e71){_0x199e71['CmContactId']=_0x17be5d[_0x74b3('0x8e')][_0x74b3('0xdb')];return _0x199e71;});return db['CmContactHasItem']['bulkCreate'](_0x346946,{});})[_0x74b3('0x17')](function(_0x319b90){return addCmHopperPhones(_0x17be5d['body']['toContactId']);})['then'](function(_0x3837d2){return['ok'];})[_0x74b3('0x17')](respondWithResult(_0x130038,null))[_0x74b3('0x83')](handleError(_0x130038,null));};exports['rescheduleAdditionalPhones']=function(_0x23048f,_0x2b81ad){var _0x15c3a3=[];_0x15c3a3[_0x74b3('0x22')](createCmHopperPhone(_0x23048f[_0x74b3('0x8e')]['id'],_0x23048f['body'][_0x74b3('0xdc')]));Promise[_0x74b3('0xb6')](_0x15c3a3)[_0x74b3('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x2b81ad,null));};exports[_0x74b3('0xdd')]=function(_0x149089,_0x5ce0ed){var _0xc09226={'raw':![],'where':{}};var _0x4d7c2e={};var _0x276ebb={'count':0x0,'rows':[]};return db['CmContact'][_0x74b3('0x24')]({'where':{'id':_0x149089[_0x74b3('0xb7')]['id']}})[_0x74b3('0x17')](handleEntityNotFound(_0x5ce0ed,null))['then'](function(_0xfe15e6){if(_0xfe15e6){_0x4d7c2e[_0x74b3('0x29')]=_[_0x74b3('0x1f')](db[_0x74b3('0x92')]['rawAttributes']);_0x4d7c2e['query']=_[_0x74b3('0x1f')](_0x149089[_0x74b3('0x2a')]);_0x4d7c2e['filters']=_[_0x74b3('0x2c')](_0x4d7c2e[_0x74b3('0x29')],_0x4d7c2e['query']);_0xc09226[_0x74b3('0x2d')]=_[_0x74b3('0x2c')](_0x4d7c2e[_0x74b3('0x29')],qs[_0x74b3('0x2e')](_0x149089[_0x74b3('0x2a')][_0x74b3('0x2e')]));_0xc09226[_0x74b3('0x2d')]=_0xc09226['attributes'][_0x74b3('0x20')]?_0xc09226[_0x74b3('0x2d')]:_0x4d7c2e[_0x74b3('0x29')];if(!_0x149089['query'][_0x74b3('0x2f')](_0x74b3('0xc9'))){_0xc09226[_0x74b3('0x10')]=qs[_0x74b3('0x10')](_0x149089[_0x74b3('0x2a')][_0x74b3('0x10')]);_0xc09226[_0x74b3('0xe')]=qs[_0x74b3('0xe')](_0x149089[_0x74b3('0x2a')][_0x74b3('0xe')]);}_0xc09226[_0x74b3('0x30')]=qs[_0x74b3('0x31')](_0x149089[_0x74b3('0x2a')][_0x74b3('0x31')]);_0xc09226[_0x74b3('0x32')]=qs['filters'](_[_0x74b3('0x33')](_0x149089[_0x74b3('0x2a')],_0x4d7c2e[_0x74b3('0x2b')]));_0xc09226[_0x74b3('0x32')]['ContactId']=_0xfe15e6['id'];if(_0x149089['query'][_0x74b3('0x53')]){_0xc09226['where']=_['merge'](_0xc09226[_0x74b3('0x32')],{'$or':_['map'](_0xc09226[_0x74b3('0x2d')],function(_0x229c09){var _0x4a80f6={};_0x4a80f6[_0x229c09]={'$like':'%'+_0x149089[_0x74b3('0x2a')]['filter']+'%'};return _0x4a80f6;})});}_0xc09226=_[_0x74b3('0x76')]({},_0xc09226,_0x149089[_0x74b3('0xde')]);return db[_0x74b3('0x92')]['count']({'where':_0xc09226[_0x74b3('0x32')]})[_0x74b3('0x17')](function(_0x1a066b){_0x276ebb['count']=_0x1a066b;if(_0x149089[_0x74b3('0x2a')][_0x74b3('0xdf')]){_0xc09226['include']=[{'all':!![]}];}return db['CmHopper'][_0x74b3('0x8a')](_0xc09226);})[_0x74b3('0x17')](function(_0x4fae6b){_0x276ebb[_0x74b3('0x82')]=_0x4fae6b;return _0x276ebb;});}})['then'](respondWithFilteredResult(_0x5ce0ed,_0xc09226))[_0x74b3('0x83')](handleError(_0x5ce0ed,null));};exports['getHopperHistories']=function(_0x455737,_0x43200f){var _0x1da6d9={'raw':!![],'where':{}};var _0x4945b7={};var _0x5c2b98={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x455737[_0x74b3('0xb7')]['id']}})[_0x74b3('0x17')](handleEntityNotFound(_0x43200f,null))[_0x74b3('0x17')](function(_0x46449f){if(_0x46449f){_0x4945b7[_0x74b3('0x29')]=_[_0x74b3('0x1f')](db[_0x74b3('0xa4')][_0x74b3('0xc8')]);_0x4945b7['query']=_['keys'](_0x455737[_0x74b3('0x2a')]);_0x4945b7[_0x74b3('0x2b')]=_[_0x74b3('0x2c')](_0x4945b7[_0x74b3('0x29')],_0x4945b7['query']);_0x1da6d9[_0x74b3('0x2d')]=_[_0x74b3('0x2c')](_0x4945b7[_0x74b3('0x29')],qs['fields'](_0x455737[_0x74b3('0x2a')][_0x74b3('0x2e')]));_0x1da6d9[_0x74b3('0x2d')]=_0x1da6d9[_0x74b3('0x2d')]['length']?_0x1da6d9['attributes']:_0x4945b7['model'];if(!_0x455737[_0x74b3('0x2a')][_0x74b3('0x2f')]('nolimit')){_0x1da6d9[_0x74b3('0x10')]=qs['limit'](_0x455737[_0x74b3('0x2a')]['limit']);_0x1da6d9[_0x74b3('0xe')]=qs['offset'](_0x455737[_0x74b3('0x2a')][_0x74b3('0xe')]);}_0x1da6d9['order']=qs[_0x74b3('0x31')](_0x455737[_0x74b3('0x2a')]['sort']);_0x1da6d9[_0x74b3('0x32')]=qs['filters'](_[_0x74b3('0x33')](_0x455737['query'],_0x4945b7['filters']));_0x1da6d9[_0x74b3('0x32')][_0x74b3('0xe0')]=_0x46449f['id'];if(_0x455737['query'][_0x74b3('0x53')]){_0x1da6d9[_0x74b3('0x32')]=_[_0x74b3('0x76')](_0x1da6d9[_0x74b3('0x32')],{'$or':_[_0x74b3('0x46')](_0x1da6d9[_0x74b3('0x2d')],function(_0x37c3ed){var _0xbc49c0={};_0xbc49c0[_0x37c3ed]={'$like':'%'+_0x455737['query'][_0x74b3('0x53')]+'%'};return _0xbc49c0;})});}_0x1da6d9=_[_0x74b3('0x76')]({},_0x1da6d9,_0x455737['options']);return db[_0x74b3('0xa4')]['count']({'where':_0x1da6d9[_0x74b3('0x32')]})[_0x74b3('0x17')](function(_0x5324ae){_0x5c2b98[_0x74b3('0x11')]=_0x5324ae;if(_0x455737[_0x74b3('0x2a')][_0x74b3('0xdf')]){_0x1da6d9[_0x74b3('0xe1')]=[{'all':!![]}];}return db[_0x74b3('0xa4')][_0x74b3('0x8a')](_0x1da6d9);})[_0x74b3('0x17')](function(_0x32d4d0){_0x5c2b98[_0x74b3('0x82')]=_0x32d4d0;return _0x5c2b98;});}})[_0x74b3('0x17')](respondWithFilteredResult(_0x43200f,_0x1da6d9))['catch'](handleError(_0x43200f,null));};exports[_0x74b3('0xe2')]=function(_0x3e162b,_0x49e438){var _0x24d3ae={'raw':!![],'where':{}};var _0x32086a={};var _0xaabee4={'count':0x0,'rows':[]};return db[_0x74b3('0x1e')][_0x74b3('0x24')]({'where':{'id':_0x3e162b[_0x74b3('0xb7')]['id']}})['then'](handleEntityNotFound(_0x49e438,null))[_0x74b3('0x17')](function(_0x150687){if(_0x150687){_0x32086a['model']=_[_0x74b3('0x1f')](db[_0x74b3('0xe3')][_0x74b3('0xc8')]);_0x32086a[_0x74b3('0x2a')]=_['keys'](_0x3e162b[_0x74b3('0x2a')]);_0x32086a[_0x74b3('0x2b')]=_['intersection'](_0x32086a[_0x74b3('0x29')],_0x32086a['query']);_0x24d3ae[_0x74b3('0x2d')]=_['intersection'](_0x32086a[_0x74b3('0x29')],qs[_0x74b3('0x2e')](_0x3e162b['query'][_0x74b3('0x2e')]));_0x24d3ae[_0x74b3('0x2d')]=_0x24d3ae[_0x74b3('0x2d')]['length']?_0x24d3ae[_0x74b3('0x2d')]:_0x32086a[_0x74b3('0x29')];if(!_0x3e162b['query']['hasOwnProperty'](_0x74b3('0xc9'))){_0x24d3ae[_0x74b3('0x10')]=qs[_0x74b3('0x10')](_0x3e162b['query'][_0x74b3('0x10')]);_0x24d3ae[_0x74b3('0xe')]=qs[_0x74b3('0xe')](_0x3e162b[_0x74b3('0x2a')][_0x74b3('0xe')]);}_0x24d3ae[_0x74b3('0x30')]=qs[_0x74b3('0x31')](_0x3e162b['query'][_0x74b3('0x31')]);_0x24d3ae[_0x74b3('0x32')]=qs[_0x74b3('0x2b')](_[_0x74b3('0x33')](_0x3e162b[_0x74b3('0x2a')],_0x32086a[_0x74b3('0x2b')]));_0x24d3ae[_0x74b3('0x32')]['ContactId']=_0x150687['id'];if(_0x3e162b[_0x74b3('0x2a')][_0x74b3('0x53')]){_0x24d3ae['where']=_['merge'](_0x24d3ae[_0x74b3('0x32')],{'$or':_[_0x74b3('0x46')](_0x24d3ae['attributes'],function(_0x30b4b9){var _0x5ab67f={};_0x5ab67f[_0x30b4b9]={'$like':'%'+_0x3e162b[_0x74b3('0x2a')]['filter']+'%'};return _0x5ab67f;})});}_0x24d3ae=_[_0x74b3('0x76')]({},_0x24d3ae,_0x3e162b[_0x74b3('0xde')]);return db[_0x74b3('0xe3')]['count']({'where':_0x24d3ae['where']})['then'](function(_0xc13860){_0xaabee4[_0x74b3('0x11')]=_0xc13860;if(_0x3e162b[_0x74b3('0x2a')]['includeAll']){_0x24d3ae[_0x74b3('0xe1')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x24d3ae);})['then'](function(_0x2178ec){_0xaabee4['rows']=_0x2178ec;return _0xaabee4;});}})[_0x74b3('0x17')](respondWithFilteredResult(_0x49e438,_0x24d3ae))[_0x74b3('0x83')](handleError(_0x49e438,null));};exports[_0x74b3('0xe4')]=function(_0x4e7e09,_0x43ebb8){var _0x5cce1f={'raw':!![],'where':{}};var _0x3a53e7={};var _0x4322e6={'count':0x0,'rows':[]};return db[_0x74b3('0x1e')][_0x74b3('0x24')]({'where':{'id':_0x4e7e09[_0x74b3('0xb7')]['id']}})['then'](handleEntityNotFound(_0x43ebb8,null))[_0x74b3('0x17')](function(_0x15d99f){if(_0x15d99f){_0x3a53e7[_0x74b3('0x29')]=_[_0x74b3('0x1f')](db[_0x74b3('0xe5')][_0x74b3('0xc8')]);_0x3a53e7['query']=_[_0x74b3('0x1f')](_0x4e7e09[_0x74b3('0x2a')]);_0x3a53e7['filters']=_[_0x74b3('0x2c')](_0x3a53e7[_0x74b3('0x29')],_0x3a53e7[_0x74b3('0x2a')]);_0x5cce1f['attributes']=_['intersection'](_0x3a53e7['model'],qs['fields'](_0x4e7e09['query'][_0x74b3('0x2e')]));_0x5cce1f[_0x74b3('0x2d')]=_0x5cce1f['attributes'][_0x74b3('0x20')]?_0x5cce1f['attributes']:_0x3a53e7['model'];if(!_0x4e7e09[_0x74b3('0x2a')]['hasOwnProperty'](_0x74b3('0xc9'))){_0x5cce1f[_0x74b3('0x10')]=qs[_0x74b3('0x10')](_0x4e7e09['query'][_0x74b3('0x10')]);_0x5cce1f['offset']=qs[_0x74b3('0xe')](_0x4e7e09[_0x74b3('0x2a')][_0x74b3('0xe')]);}_0x5cce1f[_0x74b3('0x30')]=qs[_0x74b3('0x31')](_0x4e7e09[_0x74b3('0x2a')][_0x74b3('0x31')]);_0x5cce1f['where']=qs[_0x74b3('0x2b')](_['pick'](_0x4e7e09[_0x74b3('0x2a')],_0x3a53e7[_0x74b3('0x2b')]));_0x5cce1f[_0x74b3('0x32')][_0x74b3('0xe0')]=_0x15d99f['id'];if(_0x4e7e09[_0x74b3('0x2a')][_0x74b3('0x53')]){_0x5cce1f[_0x74b3('0x32')]=_['merge'](_0x5cce1f[_0x74b3('0x32')],{'$or':_[_0x74b3('0x46')](_0x5cce1f[_0x74b3('0x2d')],function(_0x3a58f7){var _0x2306fe={};_0x2306fe[_0x3a58f7]={'$like':'%'+_0x4e7e09['query'][_0x74b3('0x53')]+'%'};return _0x2306fe;})});}_0x5cce1f=_[_0x74b3('0x76')]({},_0x5cce1f,_0x4e7e09[_0x74b3('0xde')]);return db[_0x74b3('0xe5')]['count']({'where':_0x5cce1f[_0x74b3('0x32')]})[_0x74b3('0x17')](function(_0x3f5bf0){_0x4322e6[_0x74b3('0x11')]=_0x3f5bf0;if(_0x4e7e09[_0x74b3('0x2a')]['includeAll']){_0x5cce1f[_0x74b3('0xe1')]=[{'all':!![]}];}return db[_0x74b3('0xe5')][_0x74b3('0x8a')](_0x5cce1f);})[_0x74b3('0x17')](function(_0x3fad0c){_0x4322e6['rows']=_0x3fad0c;return _0x4322e6;});}})['then'](respondWithFilteredResult(_0x43ebb8,_0x5cce1f))['catch'](handleError(_0x43ebb8,null));};exports[_0x74b3('0xe6')]=function(_0xb93352,_0x3e5d93){try{if(!_0xb93352[_0x74b3('0x8e')][_0x74b3('0x56')]){throw new Error(_0x74b3('0xe7'));}if(!_0xb93352[_0x74b3('0x8e')][_0x74b3('0xe8')]){throw new Error(_0x74b3('0xe9'));}if(!_0xb93352[_0x74b3('0x8e')][_0x74b3('0xea')]){throw new Error(_0x74b3('0xeb'));}if(!_0xb93352['body'][_0x74b3('0xec')]){throw new Error(_0x74b3('0xed'));}var _0x26f1a4=_0xb93352[_0x74b3('0x8e')][_0x74b3('0xe8')][_0x74b3('0x45')](',');var _0x39e4b6=_0xb93352[_0x74b3('0x8e')][_0x74b3('0xea')][_0x74b3('0x45')](',');if(!_0x26f1a4[_0x74b3('0x20')]||!_0x39e4b6['length']||_0x26f1a4[_0x74b3('0x20')]!==_0x39e4b6[_0x74b3('0x20')]){throw new Error(_0x74b3('0xee'));}_0xb93352[_0x74b3('0x8e')][_0x74b3('0x2e')]=_[_0x74b3('0xef')](_0x26f1a4,_0x39e4b6);if(!_0xb93352['body'][_0x74b3('0x2e')][_0x74b3('0xc6')]){throw new Error(_0x74b3('0xf0'));}if(!_0xb93352[_0x74b3('0x8e')]['fields'][_0x74b3('0xf1')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x4f0c13=path[_0x74b3('0xad')](config[_0x74b3('0xf2')],_0x74b3('0xf3'),_0xb93352[_0x74b3('0xf4')][_0x74b3('0xf5')]);fs[_0x74b3('0xf6')](_0x4f0c13,parseInt(_0x74b3('0xf7'),0x8));var _0x47078f=require(_0x74b3('0xf8'))[_0x74b3('0xf9')](path['join'](__dirname,_0x74b3('0xfa')),[_0x4f0c13,_0xb93352['body']['binding_keys'],_0xb93352[_0x74b3('0x8e')][_0x74b3('0xea')],_0xb93352[_0x74b3('0x8e')][_0x74b3('0x56')],_0xb93352[_0x74b3('0x8e')]['CompanyId'],_0xb93352['body']['duplicates'],_0xb93352[_0x74b3('0x8e')][_0x74b3('0xec')]]);return _0x3e5d93[_0x74b3('0x12')](0xc8)[_0x74b3('0x15')]({'message':_0x74b3('0xfb'),'pid':_0x47078f['pid']});}catch(_0x7499fb){return _0x3e5d93[_0x74b3('0x12')](0x1f4)[_0x74b3('0x1c')](_0x7499fb);}};exports['upload']=function(_0x5d69ea,_0xb70e0a){var _0x5431a9=fs['createReadStream'](_0x5d69ea[_0x74b3('0xf4')][_0x74b3('0x3')]);Papa['parse'](_0x5431a9,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x61276d){return _0xb70e0a[_0x74b3('0x12')](0xc8)[_0x74b3('0x15')]({'file':_0x5d69ea['file'],'fields':_0x61276d['meta']['fields']});}});};exports['import']=function(_0x395b71,_0x2775aa){return db[_0x74b3('0x4a')][_0x74b3('0x8a')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x74b3('0x17')](function(_0x4022ca){var _0x27e66b=![];if(!_0x395b71[_0x74b3('0x8e')][_0x74b3('0x56')]){throw new Error(_0x74b3('0xe7'));}if(!_0x395b71['body'][_0x74b3('0xfc')][_0x74b3('0xc6')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x395b71[_0x74b3('0x8e')][_0x74b3('0xfc')][_0x74b3('0xf1')]){throw new Error(_0x74b3('0xfd'));}if(!_0x395b71[_0x74b3('0x8e')]['socket_timestamp']){throw new Error(_0x74b3('0xed'));}var _0x3ba07f=require(_0x74b3('0xf8'))['fork'](path[_0x74b3('0xad')](__dirname,_0x74b3('0xfe')),[_0x395b71[_0x74b3('0xb7')]['id'],JSON[_0x74b3('0xff')](_0x395b71['body']),JSON[_0x74b3('0xff')](_0x4022ca)]);_0x3ba07f['on'](_0x74b3('0x100'),function(){_0x27e66b=!![];return _0x2775aa[_0x74b3('0x12')](0xc8)[_0x74b3('0x15')]({'message':_0x74b3('0x101'),'pid':_0x3ba07f[_0x74b3('0x102')]});});_0x3ba07f['on']('exit',function(_0x15f463){if(_0x15f463&&!_0x27e66b){return _0x2775aa[_0x74b3('0x12')](0x1f4)['json']({'message':_0x74b3('0x103'),'pid':_0x3ba07f[_0x74b3('0x102')]});}});})[_0x74b3('0x83')](handleError(_0x2775aa,null));};exports['importUpdates']=function(_0x3632b9,_0x52e899,_0x50d1a5){return db[_0x74b3('0x4a')][_0x74b3('0x8a')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x74b3('0x17')](function(_0x16191){var _0x139227=![];if(!_0x3632b9[_0x74b3('0x8e')][_0x74b3('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3632b9[_0x74b3('0x8e')]['binding'][_0x74b3('0xc6')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x3632b9[_0x74b3('0x8e')][_0x74b3('0xfc')][_0x74b3('0xf1')]){throw new Error(_0x74b3('0xfd'));}if(!_0x3632b9['body'][_0x74b3('0xec')]){throw new Error(_0x74b3('0xed'));}var _0x5c8b1c=require(_0x74b3('0xf8'))[_0x74b3('0xf9')](path[_0x74b3('0xad')](__dirname,'../../components/import/cm/csvUpdates'),[_0x3632b9['params']['id'],JSON['stringify'](_0x3632b9[_0x74b3('0x8e')]),JSON['stringify'](_0x16191)]);_0x5c8b1c['on'](_0x74b3('0x100'),function(_0x29c1df){_0x139227=!![];return _0x52e899[_0x74b3('0x12')](0xc8)[_0x74b3('0x15')]({'message':_0x74b3('0x101'),'pid':_0x5c8b1c[_0x74b3('0x102')]});});_0x5c8b1c['on'](_0x74b3('0x104'),function(_0x2d68e7){if(_0x2d68e7&&!_0x139227){return _0x52e899[_0x74b3('0x12')](0x1f4)['json']({'message':_0x74b3('0x103'),'pid':_0x5c8b1c[_0x74b3('0x102')]});}});})[_0x74b3('0x83')](handleError(_0x52e899,null));};exports['getJourney']=function(_0x2d5c55,_0x592e4f){var _0x4c2773=['mail',_0x74b3('0x105'),_0x74b3('0x106'),_0x74b3('0x107'),_0x74b3('0x108'),_0x74b3('0x109'),_0x74b3('0x10a')];var _0x13888d={'offset':0x0,'order':qs[_0x74b3('0x31')](_0x74b3('0x10b'))},_0x47bead={'count':0x0,'rows':[]};Promise[_0x74b3('0x6c')]()[_0x74b3('0x17')](function(){if(_0x2d5c55['query']['channel']){if(!_[_0x74b3('0x10c')](_0x4c2773,_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0x10d')][_0x74b3('0x10e')]())){throw new Error(_0x74b3('0x10f'));}_0x4c2773=[_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0x10d')][_0x74b3('0x10e')]()];}if(_0x2d5c55[_0x74b3('0x2a')]['range']){try{var _0x112273=JSON[_0x74b3('0x110')](_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0x111')]);if(!moment(_0x112273[_0x74b3('0x37')])[_0x74b3('0x112')]()){throw new Error(_0x74b3('0x113'));}if(!moment(_0x112273['to'])[_0x74b3('0x112')]()){throw new Error(_0x74b3('0x114'));}}catch(_0x7415c0){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0x2f')]('nolimit')){_0x13888d[_0x74b3('0x10')]=qs['limit'](_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0x10')]||0xa);_0x13888d[_0x74b3('0xe')]=qs[_0x74b3('0xe')](_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0xe')]);}var _0x40e478=_0x4c2773['map'](function(_0xa360bf){if(_0xa360bf===_0x74b3('0x10a')){var _0x2cba2f={'attributes':['id',_0x74b3('0x115'),'type',_0x74b3('0x116'),'destination',_0x74b3('0x117'),_0x74b3('0x118'),_0x74b3('0x119'),_0x74b3('0x11a'),_0x74b3('0x11b'),'createdAt',_0x74b3('0x11c'),'userSecondDisposition',_0x74b3('0x11d'),'UserId'],'where':{'ContactId':_0x2d5c55[_0x74b3('0xb7')]['id']},'include':[{'model':db['User'],'as':_0x74b3('0x4a'),'attributes':['id',_0x74b3('0x1b'),_0x74b3('0x11e'),_0x74b3('0x8b')]}],'order':[['createdAt',_0x74b3('0x6b')]]};if(_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0x111')]){_0x2cba2f[_0x74b3('0x32')][_0x74b3('0x11f')]={'$gte':_0x112273['from'],'$lte':_0x112273['to']};}return db[_0x74b3('0xa6')]['findAndCountAll'](_0x2cba2f)[_0x74b3('0x17')](function(_0x54c8bc){_0x47bead['count']+=_0x54c8bc['count'];return _[_0x74b3('0x46')](_0x54c8bc[_0x74b3('0x82')],function(_0x1ab25a){var _0x3b6f7f=_0x1ab25a['get']({'plain':!![]});_0x3b6f7f[_0x74b3('0x10d')]=_0xa360bf;if(_0x3b6f7f['User']){_0x3b6f7f[_0x74b3('0x4a')]={'id':_0x3b6f7f[_0x74b3('0x4a')]['id'],'name':_0x3b6f7f[_0x74b3('0x4a')]['name'],'fullname':_0x3b6f7f[_0x74b3('0x4a')][_0x74b3('0x11e')],'alias':_0x3b6f7f[_0x74b3('0x4a')][_0x74b3('0x8b')]};}return _0x3b6f7f;});});}else{var _0x552caa=_[_0x74b3('0x120')](_0xa360bf)+(_0xa360bf===_0x74b3('0x105')?_0x74b3('0x121'):'Account');var _0x429bf7={'attributes':['id',_0x74b3('0x122'),_0x74b3('0x123'),_0x74b3('0x11f'),_0x74b3('0x11b'),_0x74b3('0x124'),_0x74b3('0x125'),_0x74b3('0x126'),_0x74b3('0x127'),_0x552caa+'Id'],'where':{'ContactId':_0x2d5c55[_0x74b3('0xb7')]['id']},'include':[{'model':db[_0x552caa],'as':_0x74b3('0x128'),'attributes':['id',_0x74b3('0x1b'),'key']},{'model':db[_0x74b3('0x4a')],'as':_0x74b3('0x129'),'attributes':['id','name',_0x74b3('0x11e')]},{'model':db['Tag'],'as':_0x74b3('0x81'),'attributes':['id',_0x74b3('0x1b'),_0x74b3('0x36')],'through':{'attributes':[]}}],'order':[[_0x74b3('0x11f'),_0x74b3('0x6b')]]};if(_0x2d5c55[_0x74b3('0x2a')][_0x74b3('0x111')]){_0x429bf7['where'][_0x74b3('0x11f')]={'$gte':_0x112273[_0x74b3('0x37')],'$lte':_0x112273['to']};}switch(_0xa360bf){case _0x74b3('0x105'):_0x429bf7[_0x74b3('0x2d')]['push']('browserName',_0x74b3('0x12a'),_0x74b3('0x12b'),_0x74b3('0x12c'),_0x74b3('0x12d'),_0x74b3('0x12e'),_0x74b3('0x12f'),_0x74b3('0x130'),_0x74b3('0x131'));break;case _0x74b3('0x132'):_0x429bf7[_0x74b3('0x2d')][_0x74b3('0x22')](_0x74b3('0x133'),_0x74b3('0x134'));break;case _0x74b3('0x107'):_0x429bf7[_0x74b3('0x2d')][_0x74b3('0x22')](_0x74b3('0x135'),'threadId');break;}return db[_[_0x74b3('0x120')](_0xa360bf)+'Interaction'][_0x74b3('0x136')](_0x429bf7)[_0x74b3('0x17')](function(_0x2f022c){_0x47bead[_0x74b3('0x11')]+=_0x2f022c[_0x74b3('0x11')];return _[_0x74b3('0x46')](_0x2f022c['rows'],function(_0x547198){var _0x6117c5=_0x547198[_0x74b3('0x8f')]({'plain':!![]});_0x6117c5[_0x74b3('0x10d')]=_0xa360bf;if(_0x6117c5[_0x74b3('0x129')]){_0x6117c5[_0x74b3('0x129')]={'id':_0x6117c5[_0x74b3('0x129')]['id'],'name':_0x6117c5[_0x74b3('0x129')][_0x74b3('0x1b')],'fullname':_0x6117c5[_0x74b3('0x129')][_0x74b3('0x11e')]};}return _0x6117c5;});});}});return Promise['all'](_0x40e478);})['then'](function(_0xd6f20b){return _(_0xd6f20b)[_0x74b3('0x137')]()[_0x74b3('0x138')]('createdAt')[_0x74b3('0x139')]()[_0x74b3('0x4c')]();})[_0x74b3('0x17')](function(_0x43d46e){_0x47bead['rows']=_0x13888d[_0x74b3('0x10')]?_0x43d46e[_0x74b3('0x13a')](_0x13888d[_0x74b3('0xe')],_0x13888d[_0x74b3('0xe')]+_0x13888d['limit']):_0x43d46e;return _0x47bead;})[_0x74b3('0x17')](respondWithFilteredResult(_0x592e4f,_0x13888d))['catch'](handleError(_0x592e4f,null));}; \ No newline at end of file +var _0xf74f=['Phones.OrderBy','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','values','phone','rawAttributes','pick','options','getTags','setTags','ids','CmContactHasItem','ContactItemType','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','CmHopperId','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','getHoppers','ContactId','include','getHopperHistories','CmHopperHistory','includeAll','rows','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','json','File\x20uploaded\x20correctly!','pid','upload','parse','import','binding','firstName','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','chat','openchannel','fax','voice','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','closed','note','disposition','secondDisposition','thirdDisposition','key','Owner','deviceModel','osName','ratingMessage','referer','subject','substatus','externalUrl','threadId','Interaction','reverse','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/environment/shared','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','offset','limit','undefined','count','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','CmContact','describe','length','keys','startsWith','cf_','push','findOne','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','select','field','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','sqlOperator','conditions','find','Tag','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','text','filter','isNil','Contact','isEmpty','forEach','c.ListId\x20IN\x20?','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','t.id\x20IN\x20?','resolve','agent','some','user','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.mobile','c.fax','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','params','tags','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','body','get','mergeWith','isArray','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','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','OpenchannelInteraction','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','join','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','ListId','findOrCreate','contact','show','color','Phones','ItemType','literal'];(function(_0x4bc55a,_0x318192){var _0x15d855=function(_0x1f7ad6){while(--_0x1f7ad6){_0x4bc55a['push'](_0x4bc55a['shift']());}};_0x15d855(++_0x318192);}(_0xf74f,0x1a8));var _0xff74=function(_0x58194e,_0x2bded9){_0x58194e=_0x58194e-0x0;var _0x5d2d50=_0xf74f[_0x58194e];return _0x5d2d50;};'use strict';var moment=require(_0xff74('0x0'));var BPromise=require('bluebird');var util=require(_0xff74('0x1'));var path=require(_0xff74('0x2'));var fs=require('fs');var _=require(_0xff74('0x3'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xff74('0x4'));var qs=require(_0xff74('0x5'));var as=require(_0xff74('0x6'));var logger=require('../../config/logger')(_0xff74('0x7'));var config=require(_0xff74('0x8'));var shared=require(_0xff74('0x9'));var db=require('../../mysqldb')['db'];config[_0xff74('0xa')]=_[_0xff74('0xb')](config[_0xff74('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xff74('0xc'))(new Redis(config['redis']));require(_0xff74('0xd'))[_0xff74('0xe')](socket);function respondWithResult(_0x2a4e31,_0x114ed1){_0x114ed1=_0x114ed1||0xc8;return function(_0x16af8f){if(_0x16af8f){return _0x2a4e31[_0xff74('0xf')](_0x114ed1)['json'](_0x16af8f);}};}function respondWithFilteredResult(_0x24dbb4,_0x1e3cff){return function(_0x50a9f8){if(_0x50a9f8){var _0x5c63de=typeof _0x1e3cff[_0xff74('0x10')]==='undefined'&&typeof _0x1e3cff[_0xff74('0x11')]===_0xff74('0x12');var _0x12f7fd=_0x50a9f8[_0xff74('0x13')];var _0x3908a4=_0x5c63de?0x0:_0x1e3cff[_0xff74('0x10')];var _0x287993=_0x5c63de?_0x50a9f8[_0xff74('0x13')]:_0x1e3cff['offset']+_0x1e3cff[_0xff74('0x11')];var _0x5a8c6b;if(_0x287993>=_0x12f7fd){_0x287993=_0x12f7fd;_0x5a8c6b=0xc8;}else{_0x5a8c6b=0xce;}_0x24dbb4[_0xff74('0xf')](_0x5a8c6b);return _0x24dbb4['set'](_0xff74('0x14'),_0x3908a4+'-'+_0x287993+'/'+_0x12f7fd)['json'](_0x50a9f8);}return null;};}function saveUpdates(_0x35be84){return function(_0x46ca67){if(_0x46ca67){return _0x46ca67[_0xff74('0x15')](_0x35be84)[_0xff74('0x16')](function(_0x340cef){return _0x340cef;});}return null;};}function removeEntity(_0x2421fd){return function(_0x12998e){if(_0x12998e){return _0x12998e[_0xff74('0x17')]()[_0xff74('0x16')](function(){_0x2421fd[_0xff74('0xf')](0xcc)[_0xff74('0x18')]();});}};}function handleEntityNotFound(_0x2db52f){return function(_0x1b65e8){if(!_0x1b65e8){_0x2db52f[_0xff74('0x19')](0x194);}return _0x1b65e8;};}function handleError(_0x37cab1,_0x4459e6){_0x4459e6=_0x4459e6||0x1f4;return function(_0x45dbb9){logger[_0xff74('0x1a')](_0x45dbb9['stack']);if(_0x45dbb9['name']){delete _0x45dbb9[_0xff74('0x1b')];}_0x37cab1[_0xff74('0xf')](_0x4459e6)[_0xff74('0x1c')](_0x45dbb9);};}exports[_0xff74('0x1d')]=function(_0x53e1d8,_0xf6ab92){var _0x4751f4={},_0x3300f6={},_0x3f2890={'count':0x0,'rows':[]};return db[_0xff74('0x1e')][_0xff74('0x1f')]()[_0xff74('0x16')](function(_0x141b15){var _0x472d50=[];for(var _0x4fb90e=0x0;_0x4fb90e0x1){_0x303e23['or'](_0xff74('0x5b'),qs['getFullTextValue'](_0x580662),null);}else{if(qs['isNumeric'](_0x580662)){_0x303e23['or'](_0xff74('0x5c'),_0x580662+'%');_0x303e23['or']('c.phone\x20LIKE\x20?',_0x580662+'%');_0x303e23['or'](_0xff74('0x5d'),_0x580662+'%');_0x303e23['or'](_0xff74('0x5e'),_0x580662+'%');}else if(qs[_0xff74('0x5f')](_0x580662)){_0x303e23['or'](_0xff74('0x60'),_0x580662+'%');}else{_0x303e23['or'](_0xff74('0x61'),'%'+_0x580662+'%');_0x303e23['or']('c.lastName\x20LIKE\x20?','%'+_0x580662+'%');_0x303e23['or'](_0xff74('0x60'),'%'+_0x580662+'%');}}}}_0xb9a7d0[_0xff74('0x32')](_0x303e23);_0xb9a7d0['group'](_0xff74('0x62'));var _0x1c2e55={'type':db[_0xff74('0x63')][_0xff74('0x64')][_0xff74('0x65')],'raw':!![]};var _0x44cf33=_0xb9a7d0[_0xff74('0x66')]()['field'](_0xff74('0x62'));if(_0x4751f4['order']){_0x4751f4[_0xff74('0x67')][_0xff74('0x56')](function(_0x28056b){_0xb9a7d0['order']('c.'+_0x28056b[0x0],_0x28056b[0x1]===_0xff74('0x68')?![]:!![]);});}if(!_[_0xff74('0x55')](_0x9ca333)){_0xb9a7d0[_0xff74('0x69')](_0x5a5173);_0x44cf33[_0xff74('0x32')](_0xff74('0x6a'),_0x9ca333);}BPromise[_0xff74('0x6b')]()[_0xff74('0x16')](function(){if(!_0x263999)return;if(_0x53e1d8['user']['role']!==_0xff74('0x6c'))return;if(!_[_0xff74('0x6d')](_0x263999['conditions'],[_0xff74('0x34'),_0xff74('0x48')])){return _0x53e1d8[_0xff74('0x6e')][_0xff74('0x6f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x546a15){if(_[_0xff74('0x55')](_0x546a15)){_0x44cf33[_0xff74('0x32')](_0xff74('0x70'));_0xb9a7d0[_0xff74('0x32')](_0xff74('0x70'));}else{_0x44cf33[_0xff74('0x32')](_0xff74('0x57'),_[_0xff74('0x45')](_0x546a15,'id'));_0xb9a7d0[_0xff74('0x32')]('c.ListId\x20IN\x20?',_[_0xff74('0x45')](_0x546a15,'id'));}});}})['then'](function(){if(_0x53e1d8[_0xff74('0x6e')][_0xff74('0x71')]===_0xff74('0x6c')&&!_0x263999&&!_0x53e1d8[_0xff74('0x2a')]['ListId'])return[];return db[_0xff74('0x72')][_0xff74('0x2a')](_0x44cf33[_0xff74('0x73')](),_0x1c2e55);})[_0xff74('0x16')](function(_0x2f429){_0x3f2890['count']=_0x2f429[_0xff74('0x20')];if(_0x3f2890['count']===0x0)return[];return db[_0xff74('0x72')][_0xff74('0x2a')](_0x10ca46['toString'](),_0x1c2e55)[_0xff74('0x16')](function(_0xbf5e94){_0x18f6c2=_[_0xff74('0x74')](_0xbf5e94,'id');_0x1c2e55=_[_0xff74('0x75')](_0x1c2e55,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53e1d8[_0xff74('0x2a')][_0xff74('0x2e')]){_0x4751f4[_0xff74('0x2d')][_0xff74('0x56')](function(_0x5b382c){_0xb9a7d0['field']('c.'+_0x5b382c);});}else{_0xb9a7d0[_0xff74('0x34')](_0xff74('0x62'));_0xb9a7d0[_0xff74('0x34')](_0xff74('0x76'));_0xb9a7d0[_0xff74('0x34')]('c.lastName');_0xb9a7d0['field'](_0xff74('0x77'));_0xb9a7d0[_0xff74('0x34')](_0xff74('0x78'));_0xb9a7d0['field'](_0xff74('0x79'));_0xb9a7d0[_0xff74('0x34')]('c.email');_0xb9a7d0[_0xff74('0x34')]('c.ListId');_0xb9a7d0[_0xff74('0x34')](_0xff74('0x7a'));_0xb9a7d0['field']('c.deletedAt');_0xb9a7d0[_0xff74('0x34')](_0xff74('0x7b'));_0xb9a7d0[_0xff74('0x34')](_0xff74('0x7c'),_0xff74('0x7d'));}if(_0x4751f4[_0xff74('0x11')])_0xb9a7d0[_0xff74('0x11')](_0x4751f4[_0xff74('0x11')]);if(_0x4751f4['offset'])_0xb9a7d0['offset'](_0x4751f4[_0xff74('0x10')]);return db[_0xff74('0x72')][_0xff74('0x2a')](_0xb9a7d0[_0xff74('0x73')](),_0x1c2e55);});})['then'](function(_0x39c36e){_0x39c36e[_0xff74('0x56')](function(_0x190cec){if(_0x190cec[_0xff74('0x7d')]){_0x190cec[_0xff74('0x7e')]=[];_0x190cec['TagIds'][_0xff74('0x44')](',')['forEach'](function(_0x4c3a21){_0x190cec[_0xff74('0x7e')]['push'](_0x18f6c2[_0x4c3a21]);});}delete _0x190cec['TagIds'];});_0x3f2890['rows']=_0x39c36e;return _0x3f2890;})[_0xff74('0x16')](respondWithFilteredResult(_0xf6ab92,_0x4751f4));})[_0xff74('0x7f')](handleError(_0xf6ab92,null));};exports[_0xff74('0x17')]=function(_0x55cafe,_0x15389a){return db[_0xff74('0x1e')][_0xff74('0x42')]({'where':{'id':_0x55cafe[_0xff74('0x80')]['id']}})[_0xff74('0x16')](handleEntityNotFound(_0x15389a,null))['then'](removeEntity(_0x15389a,null))[_0xff74('0x7f')](handleError(_0x15389a,null));};exports[_0xff74('0x1f')]=function(_0x34c2c7,_0x58da22){return db[_0xff74('0x1e')][_0xff74('0x1f')]()[_0xff74('0x16')](function(_0x596a8a){delete _0x596a8a[_0xff74('0x81')];for(var _0x10d98b=0x0;_0x10d98b0x0){return new Promise(function(_0x4c6551,_0x1009a7){var _0x5294fb=[];for(var _0x22ab6e=0x0;_0x22ab6e<_0xf3da8a[_0xff74('0x20')];_0x22ab6e++){_0x5294fb[_0xff74('0x24')](insertAdditionalPhones(_0xf3da8a[_0x22ab6e][_0xff74('0xac')],_0xf3da8a[_0x22ab6e][_0xff74('0xa6')]));}Promise[_0xff74('0x26')](_0x5294fb)['then'](function(){_0x4c6551(0x1);});})[_0xff74('0x16')](function(){return{'success':_0x4ab914,'failure':_0x429031,'duplicates':_0x571bf3};});}else{return{'success':_0x4ab914,'failure':_0x429031,'duplicates':_0x571bf3};}}})['then'](respondWithResult(_0x527be4,0xc9))['catch'](handleError(_0x527be4,null));};exports[_0xff74('0xad')]=function(_0x406e24,_0xa4966f){var _0x26f49f;return db[_0xff74('0x1e')][_0xff74('0x1f')]()[_0xff74('0x16')](function(_0x31a434){return db[_0xff74('0x1e')][_0xff74('0x42')]({'where':{'id':_0x406e24[_0xff74('0x80')]['id']},'include':[{'model':db[_0xff74('0x43')],'as':'Tags','attributes':['id',_0xff74('0x1b'),_0xff74('0xae')],'required':_0x406e24['query'][_0xff74('0x59')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xff74('0xaf'),'where':{'CmContactId':_0x406e24['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xff74('0xb0')}]}],'order':[db[_0xff74('0x72')][_0xff74('0xb1')](_0xff74('0xb2'))],'attributes':_['keys'](_0x31a434)});})[_0xff74('0x16')](function(_0x560bba){if(!_['isNil'](_0x560bba)){_0x26f49f=_0x560bba[_0xff74('0x8a')]({'plain':!![]});var _0x1a698a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x560bba&&_0x560bba[_0xff74('0xaa')]){if(_0x560bba[_0xff74('0xaa')]){_0x1a698a[_0xff74('0x32')][_0xff74('0xb3')][_0xff74('0x24')]({'ListId':{'$ne':_0x560bba[_0xff74('0xaa')]}});}}return db[_0xff74('0x85')]['findAll'](_0x1a698a);}})[_0xff74('0x16')](function(_0x3d36b0){if(!_[_0xff74('0x53')](_0x3d36b0)){return _[_0xff74('0xb4')](_0x26f49f,_['map'](_0x3d36b0,function(_0x1ff39b){return util[_0xff74('0xb5')](_0xff74('0xb6'),_0x1ff39b['id']);}));}})[_0xff74('0x16')](handleEntityNotFound(_0xa4966f,null))[_0xff74('0x16')](respondWithResult(_0xa4966f,null))['catch'](handleError(_0xa4966f,null));};exports[_0xff74('0x15')]=function(_0x33427e,_0x41b485){var _0x1f745e;if(_0x33427e[_0xff74('0x89')]['id']){delete _0x33427e[_0xff74('0x89')]['id'];}if(!_['isNil'](_0x33427e[_0xff74('0x89')]['dialTimezone'])){var _0x4e7be8=_0x33427e[_0xff74('0x89')][_0xff74('0xa3')];if(!_['isNil'](shared[_0xff74('0xa4')][_0x4e7be8]))_0x33427e[_0xff74('0x89')][_0xff74('0xa5')]=shared[_0xff74('0xa4')][_0x4e7be8][_0xff74('0xa5')];}return db[_0xff74('0x1e')][_0xff74('0x42')]({'where':{'id':_0x33427e['params']['id']}})[_0xff74('0x16')](handleEntityNotFound(_0x41b485,null))[_0xff74('0x16')](saveUpdates(_0x33427e['body'],null))[_0xff74('0x16')](function(_0x523b6e){_0x1f745e=_0x523b6e;var _0x574517={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x523b6e&&_0x523b6e[_0xff74('0xaa')]){if(_0x523b6e['ListId']){_0x574517[_0xff74('0x32')]['$and'][_0xff74('0x24')]({'ListId':{'$ne':_0x523b6e[_0xff74('0xaa')]}});}}return db['CmCustomField'][_0xff74('0x86')](_0x574517);})['then'](function(_0x32a47b){if(_0x32a47b){return _[_0xff74('0xb4')](_[_0xff74('0xb7')](_0x33427e[_0xff74('0x89')],function(_0x581198,_0x28d4b9){return _[_0xff74('0x22')](_0x28d4b9,_0xff74('0x23'));}),_['map'](_0x32a47b,function(_0x3a19b5){return util[_0xff74('0xb5')](_0xff74('0xb6'),_0x3a19b5['id']);}));}})['then'](function(_0x582d9f){if(_0x582d9f&&!_[_0xff74('0x55')](_0x582d9f)){var _0x1b3ae6=squel[_0xff74('0x15')]()[_0xff74('0xb8')](_0xff74('0x37'))['setFields'](_0x582d9f)['where'](_0xff74('0xb9'),_0x33427e[_0xff74('0x80')]['id'])[_0xff74('0xba')]();return db[_0xff74('0x72')][_0xff74('0x2a')](_0x1b3ae6[_0xff74('0x51')],{'replacements':_0x1b3ae6[_0xff74('0xbb')]});}})[_0xff74('0x16')](function(){if(_0x33427e[_0xff74('0x89')]['phone']&&_0x1f745e){return db[_0xff74('0x8f')][_0xff74('0x15')]({'phone':_0x33427e[_0xff74('0x89')][_0xff74('0xbc')],'OrderBy':0x0},{'where':{'ContactId':_0x1f745e['id']}});}})['then'](function(){return _0x1f745e;})['then'](respondWithResult(_0x41b485,null))['catch'](handleError(_0x41b485,null));};exports['getTags']=function(_0x15428c,_0x168652){var _0x31e25d={};var _0x3fda01={};var _0x2cab08;var _0x307b3e;return db[_0xff74('0x1e')]['findOne']({'where':{'id':_0x15428c['params']['id']}})['then'](handleEntityNotFound(_0x168652,null))[_0xff74('0x16')](function(_0x5aad70){if(_0x5aad70){_0x2cab08=_0x5aad70;_0x3fda01[_0xff74('0x29')]=_['keys'](db[_0xff74('0x43')][_0xff74('0xbd')]);_0x3fda01[_0xff74('0x2a')]=_['keys'](_0x15428c[_0xff74('0x2a')]);_0x3fda01['filters']=_[_0xff74('0x2c')](_0x3fda01[_0xff74('0x29')],_0x3fda01[_0xff74('0x2a')]);_0x31e25d['attributes']=_[_0xff74('0x2c')](_0x3fda01[_0xff74('0x29')],qs[_0xff74('0x2e')](_0x15428c['query'][_0xff74('0x2e')]));_0x31e25d['attributes']=_0x31e25d[_0xff74('0x2d')]['length']?_0x31e25d['attributes']:_0x3fda01['model'];_0x31e25d[_0xff74('0x67')]=qs[_0xff74('0x31')](_0x15428c[_0xff74('0x2a')][_0xff74('0x31')]);_0x31e25d['where']=qs[_0xff74('0x2b')](_[_0xff74('0xbe')](_0x15428c['query'],_0x3fda01[_0xff74('0x2b')]));if(_0x15428c[_0xff74('0x2a')][_0xff74('0x52')]){_0x31e25d['where']=_[_0xff74('0x75')](_0x31e25d[_0xff74('0x32')],{'$or':_['map'](_0x31e25d['attributes'],function(_0x17e066){var _0x5ecc7a={};_0x5ecc7a[_0x17e066]={'$like':'%'+_0x15428c['query'][_0xff74('0x52')]+'%'};return _0x5ecc7a;})});}_0x31e25d=_[_0xff74('0x75')]({},_0x31e25d,_0x15428c[_0xff74('0xbf')]);return _0x2cab08[_0xff74('0xc0')](_0x31e25d);}})[_0xff74('0x16')](function(_0x35e511){if(_0x35e511){_0x307b3e=_0x35e511['length'];if(!_0x15428c['query'][_0xff74('0x2f')](_0xff74('0x30'))){_0x31e25d['limit']=qs[_0xff74('0x11')](_0x15428c['query'][_0xff74('0x11')]);_0x31e25d[_0xff74('0x10')]=qs[_0xff74('0x10')](_0x15428c[_0xff74('0x2a')][_0xff74('0x10')]);}return _0x2cab08[_0xff74('0xc0')](_0x31e25d);}})[_0xff74('0x16')](function(_0x14fb55){if(_0x14fb55){return _0x14fb55?{'count':_0x307b3e,'rows':_0x14fb55}:null;}})['then'](respondWithResult(_0x168652,null))[_0xff74('0x7f')](handleError(_0x168652,null));};exports[_0xff74('0xc1')]=function(_0x165a11,_0x504708){if(_0x165a11[_0xff74('0x89')]['id']){delete _0x165a11[_0xff74('0x89')]['id'];}return db[_0xff74('0x1e')][_0xff74('0x25')]({'where':{'id':_0x165a11[_0xff74('0x80')]['id']}})[_0xff74('0x16')](handleEntityNotFound(_0x504708,null))[_0xff74('0x16')](function(_0x280b07){if(_0x280b07){return _0x280b07[_0xff74('0xc1')](_0x165a11[_0xff74('0x89')][_0xff74('0xc2')]||[]);}return null;})[_0xff74('0x16')](respondWithResult(_0x504708,null))[_0xff74('0x7f')](handleError(_0x504708,null));};exports['setAdditionalPhones']=function(_0x30ef2f,_0xc5e44a){var _0x444c50=[];_0x444c50[_0xff74('0x24')](addAdditionalPhones(_0x30ef2f['body']));Promise[_0xff74('0x26')](_0x444c50)[_0xff74('0x16')](function(){_0x444c50=[];_0x444c50['push'](deleteCmHopperPhones(_0x30ef2f[_0xff74('0x89')]['id']));_0x444c50[_0xff74('0x24')](addCmHopperPhones(_0x30ef2f[_0xff74('0x89')]['id']));Promise[_0xff74('0x26')](_0x444c50)[_0xff74('0x16')](function(){return[0x1];})[_0xff74('0x16')](respondWithResult(_0xc5e44a,null));});};function addAdditionalPhones(_0x34e71f){var _0x4dd2d8;return new Promise(function(_0x36685c,_0x4de1dd){return db[_0xff74('0xc3')][_0xff74('0x17')]({'where':{'CmContactId':_0x34e71f['id']}})[_0xff74('0x16')](function(){db[_0xff74('0xc4')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0xff74('0x16')](function(_0x245ab0){var _0x230654=[];for(var _0x22cdc1=0x0;_0x22cdc1<_0x34e71f[_0xff74('0xc5')][_0xff74('0x20')];_0x22cdc1++){var _0x406580=_0x34e71f[_0xff74('0xc6')]?_[_0xff74('0x53')](_0x34e71f[_0xff74('0xc6')][_0x22cdc1])?'':_0x34e71f[_0xff74('0xc6')][_0x22cdc1]:_0x34e71f[_0xff74('0xc5')][_0x22cdc1][_0xff74('0xc7')]?_0x34e71f[_0xff74('0xc5')][_0x22cdc1]['ItemTypeId']:'';var _0x4053c5=_[_0xff74('0x53')](_0x34e71f[_0xff74('0xc5')][_0x22cdc1]['description'])?'':_0x34e71f[_0xff74('0xc5')][_0x22cdc1][_0xff74('0xc8')];var _0xd9768d=_0x406580+':'+_0x34e71f[_0xff74('0xc5')][_0x22cdc1][_0xff74('0xbc')]+'§'+_0x4053c5;if(_[_0xff74('0x53')](_0x4dd2d8))_0x4dd2d8=_0xd9768d;else _0x4dd2d8+=';'+_0xd9768d;var _0x2d2cc9=null;if(_0x34e71f[_0xff74('0xc6')]){if(!_['isNil'](_0x34e71f[_0xff74('0xc6')][_0x22cdc1])){var _0x3f500d=_[_0xff74('0x42')](_0x245ab0,function(_0x1c64b4){return _0x1c64b4['id']===_0x34e71f[_0xff74('0xc6')][_0x22cdc1];});if(!_[_0xff74('0x53')](_0x3f500d)){_0x2d2cc9=_0x3f500d['OrderBy'];}}}else{if(!_[_0xff74('0x53')](_0x34e71f[_0xff74('0xc5')][_0x22cdc1])){var _0x3f500d=_['find'](_0x245ab0,function(_0x2610fb){return _0x2610fb['id']===_0x34e71f[_0xff74('0xc5')][_0x22cdc1][_0xff74('0xc7')];});if(!_['isNil'](_0x3f500d)){_0x2d2cc9=_0x22cdc1;}}}if(_[_0xff74('0x53')](_0x2d2cc9)){_0x2d2cc9=0x64;}_0x230654['push'](addAdditionalPhone(_0x34e71f['id'],_0x34e71f['items'][_0x22cdc1][_0xff74('0xbc')],_0x34e71f[_0xff74('0xc6')]?_[_0xff74('0x53')](_0x34e71f[_0xff74('0xc6')][_0x22cdc1])?null:_0x34e71f['item_types'][_0x22cdc1]:_0x34e71f[_0xff74('0xc5')][_0x22cdc1][_0xff74('0xc7')]?_0x34e71f[_0xff74('0xc5')][_0x22cdc1]['ItemTypeId']:null,_0x2d2cc9,_0x4053c5));}Promise[_0xff74('0x26')](_0x230654)[_0xff74('0x16')](function(){db[_0xff74('0x1e')][_0xff74('0x15')]({'AdditionalPhones':_0x4dd2d8},{'where':{'id':_0x34e71f['id']}})['then'](function(){_0x36685c(0x1);});});});});});}function addAdditionalPhone(_0x171b66,_0x159e33,_0x55a517,_0x2c645f,_0x139208){return db['CmContactHasItem'][_0xff74('0x42')]({'where':{'CmContactId':_0x171b66,'item':_0x159e33}})[_0xff74('0x16')](function(_0x101d14){if(_0x101d14)logger[_0xff74('0x8d')](_0xff74('0xc9'),_0x101d14);else{db['CmContactHasItem']['create']({'CmContactId':_0x171b66,'item':_0x159e33,'ItemTypeId':_0x55a517,'OrderBy':_0x2c645f,'ItemClass':_0xff74('0xca'),'description':_0x139208});}});}function deletePhones(_0x482c07){return db[_0xff74('0xc3')][_0xff74('0x17')]({'where':{'CmContactId':_0x482c07}});}function deleteCmHopperPhones(_0x27e206){return new Promise(function(_0x350a79,_0x1438cc){return db[_0xff74('0x8f')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x27e206}})[_0xff74('0x16')](function(_0x4a7e96){db[_0xff74('0xcb')][_0xff74('0x17')]({'where':{'CmHopperId':{'$in':_['map'](_0x4a7e96,'id')}}});})[_0xff74('0x16')](function(){_0x350a79(0x1);});});}function addCmHopperPhones(_0x8b14ea){return new Promise(function(_0x2a6c46,_0x2e21b2){return db['CmHopper'][_0xff74('0x86')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x8b14ea}})[_0xff74('0x16')](function(_0x36ea1c){var _0x17bb15=[];_[_0xff74('0x45')](_0x36ea1c,function(_0x1f8f44){_0x17bb15[_0xff74('0x24')](createCmHopperPhone(_0x8b14ea,_0x1f8f44['id']));});Promise[_0xff74('0x26')](_0x17bb15)['then'](function(){_0x2a6c46(0x1);});});});}function createCmHopperPhone(_0x16547b,_0x5a0ee7){return new Promise(function(_0x150380,_0x30995c){db[_0xff74('0xc3')]['findAll']({'raw':!![],'attributes':[_0xff74('0xcc'),_0xff74('0xcd')],'where':{'CmContactId':_0x16547b,'ItemClass':_0xff74('0xca')},'include':[{'model':db[_0xff74('0xc4')],'attributes':[_0xff74('0xcd')],'as':_0xff74('0xb0')}],'order':['OrderBy',db['sequelize'][_0xff74('0xb1')](_0xff74('0xce'))]})['then'](function(_0x5f43a1){var _0x216231=0x1;var _0x225498=_[_0xff74('0x45')](_0x5f43a1,function(_0x48dbab){_0x48dbab[_0xff74('0xcf')]=_0x5a0ee7;_0x48dbab[_0xff74('0xbc')]=_0x48dbab[_0xff74('0xcc')];_0x48dbab['OrderBy']=_0x216231;delete _0x48dbab['ItemType.OrderBy'];_0x216231=_0x216231+0x1;return _0x48dbab;});return db[_0xff74('0xcb')][_0xff74('0xa7')](_0x225498,{});})[_0xff74('0x16')](function(){_0x150380(0x1);});});}function insertAdditionalPhones(_0x2ec16f,_0x1a7a83){return new Promise(function(_0x36c1d5,_0x31d389){var _0x9b72f2=[];for(var _0x26d58e=0x0;_0x26d58e<_0x1a7a83['length'];_0x26d58e++){var _0x3a75d5=_0x1a7a83[_0x26d58e];_0x9b72f2[_0xff74('0x24')](parseContactItemType(_0x3a75d5));}Promise['all'](_0x9b72f2)[_0xff74('0x16')](function(){var _0x799b7f={'id':_0x2ec16f['id'],'items':_0x1a7a83};return addAdditionalPhones(_0x799b7f)[_0xff74('0x16')](function(_0x3b0d06){return addCmHopperPhones(_0x2ec16f['id']);});})['then'](function(){_0x36c1d5(_0x2ec16f);});});}function parseContactItemType(_0x76dd49){return new Promise(function(_0x3a30f0,_0x415e31){if(_0x76dd49['hasOwnProperty'](_0xff74('0xc7'))){_0x3a30f0(_0x76dd49);}else{return db['ContactItemType'][_0xff74('0x42')]({'where':{'name':_0x76dd49[_0xff74('0xb0')]}})[_0xff74('0x16')](function(_0x1d38b2){if(_[_0xff74('0x53')](_0x1d38b2))_0x76dd49[_0xff74('0xc7')]=null;else _0x76dd49['ItemTypeId']=_0x1d38b2['id'];_0x3a30f0(_0x76dd49);});}});}exports['getAdditionalPhones']=function(_0x1338cd,_0x38232b){return db['CmContactHasItem'][_0xff74('0x86')]({'raw':!![],'where':{'CmContactId':_0x1338cd[_0xff74('0x80')]['id'],'ItemClass':_0xff74('0xca')},'include':[{'model':db[_0xff74('0xc4')],'as':_0xff74('0xb0')}],'order':[[_0xff74('0xcd')],[db[_0xff74('0x72')][_0xff74('0xb1')](_0xff74('0xce'))]]})['then'](function(_0x27e088){return _0x27e088;})[_0xff74('0x16')](respondWithResult(_0x38232b,null))['catch'](handleError(_0x38232b,null));};exports[_0xff74('0xd0')]=function(_0xdb16b8,_0x327071){return db[_0xff74('0xc3')]['findAll']({'raw':!![],'where':{'CmContactId':_0xdb16b8['body'][_0xff74('0xd1')]}})[_0xff74('0x16')](function(_0x51e3f0){var _0x39bb9b=_[_0xff74('0x45')](_0x51e3f0,function(_0x7e816d){_0x7e816d[_0xff74('0xd2')]=_0xdb16b8[_0xff74('0x89')][_0xff74('0xd3')];return _0x7e816d;});return db[_0xff74('0xc3')][_0xff74('0xa7')](_0x39bb9b,{});})['then'](function(_0xa3c7d4){return addCmHopperPhones(_0xdb16b8['body'][_0xff74('0xd3')]);})[_0xff74('0x16')](function(_0x2984d6){return['ok'];})['then'](respondWithResult(_0x327071,null))[_0xff74('0x7f')](handleError(_0x327071,null));};exports['rescheduleAdditionalPhones']=function(_0x310fb3,_0x4b81ed){var _0x1bf08d=[];_0x1bf08d[_0xff74('0x24')](createCmHopperPhone(_0x310fb3[_0xff74('0x89')]['id'],_0x310fb3[_0xff74('0x89')]['hopperId']));Promise['all'](_0x1bf08d)[_0xff74('0x16')](function(){return[0x1];})[_0xff74('0x16')](respondWithResult(_0x4b81ed,null));};exports[_0xff74('0xd4')]=function(_0x5c9012,_0xebd139){var _0x518244={'raw':![],'where':{}};var _0x5ca662={};var _0x24d8e4={'count':0x0,'rows':[]};return db[_0xff74('0x1e')][_0xff74('0x25')]({'where':{'id':_0x5c9012[_0xff74('0x80')]['id']}})[_0xff74('0x16')](handleEntityNotFound(_0xebd139,null))['then'](function(_0x32104f){if(_0x32104f){_0x5ca662['model']=_[_0xff74('0x21')](db[_0xff74('0x8f')][_0xff74('0xbd')]);_0x5ca662[_0xff74('0x2a')]=_[_0xff74('0x21')](_0x5c9012['query']);_0x5ca662['filters']=_[_0xff74('0x2c')](_0x5ca662[_0xff74('0x29')],_0x5ca662['query']);_0x518244[_0xff74('0x2d')]=_[_0xff74('0x2c')](_0x5ca662[_0xff74('0x29')],qs[_0xff74('0x2e')](_0x5c9012[_0xff74('0x2a')]['fields']));_0x518244[_0xff74('0x2d')]=_0x518244[_0xff74('0x2d')][_0xff74('0x20')]?_0x518244['attributes']:_0x5ca662[_0xff74('0x29')];if(!_0x5c9012[_0xff74('0x2a')][_0xff74('0x2f')](_0xff74('0x30'))){_0x518244['limit']=qs[_0xff74('0x11')](_0x5c9012['query'][_0xff74('0x11')]);_0x518244[_0xff74('0x10')]=qs['offset'](_0x5c9012['query'][_0xff74('0x10')]);}_0x518244[_0xff74('0x67')]=qs[_0xff74('0x31')](_0x5c9012[_0xff74('0x2a')]['sort']);_0x518244[_0xff74('0x32')]=qs['filters'](_[_0xff74('0xbe')](_0x5c9012[_0xff74('0x2a')],_0x5ca662[_0xff74('0x2b')]));_0x518244['where'][_0xff74('0xd5')]=_0x32104f['id'];if(_0x5c9012['query'][_0xff74('0x52')]){_0x518244['where']=_[_0xff74('0x75')](_0x518244[_0xff74('0x32')],{'$or':_['map'](_0x518244['attributes'],function(_0x2f3cf2){var _0x17f61c={};_0x17f61c[_0x2f3cf2]={'$like':'%'+_0x5c9012['query'][_0xff74('0x52')]+'%'};return _0x17f61c;})});}_0x518244=_[_0xff74('0x75')]({},_0x518244,_0x5c9012[_0xff74('0xbf')]);return db['CmHopper'][_0xff74('0x13')]({'where':_0x518244[_0xff74('0x32')]})[_0xff74('0x16')](function(_0x203d07){_0x24d8e4[_0xff74('0x13')]=_0x203d07;if(_0x5c9012[_0xff74('0x2a')]['includeAll']){_0x518244[_0xff74('0xd6')]=[{'all':!![]}];}return db[_0xff74('0x8f')]['findAll'](_0x518244);})[_0xff74('0x16')](function(_0x10bdd7){_0x24d8e4['rows']=_0x10bdd7;return _0x24d8e4;});}})[_0xff74('0x16')](respondWithFilteredResult(_0xebd139,_0x518244))[_0xff74('0x7f')](handleError(_0xebd139,null));};exports[_0xff74('0xd7')]=function(_0x4dbe5b,_0x1d3968){var _0x41cf2d={'raw':!![],'where':{}};var _0x3ee8ff={};var _0x38ee8a={'count':0x0,'rows':[]};return db['CmContact'][_0xff74('0x25')]({'where':{'id':_0x4dbe5b[_0xff74('0x80')]['id']}})[_0xff74('0x16')](handleEntityNotFound(_0x1d3968,null))[_0xff74('0x16')](function(_0x54f79d){if(_0x54f79d){_0x3ee8ff[_0xff74('0x29')]=_[_0xff74('0x21')](db[_0xff74('0xd8')][_0xff74('0xbd')]);_0x3ee8ff[_0xff74('0x2a')]=_['keys'](_0x4dbe5b['query']);_0x3ee8ff[_0xff74('0x2b')]=_['intersection'](_0x3ee8ff[_0xff74('0x29')],_0x3ee8ff['query']);_0x41cf2d[_0xff74('0x2d')]=_['intersection'](_0x3ee8ff['model'],qs[_0xff74('0x2e')](_0x4dbe5b['query'][_0xff74('0x2e')]));_0x41cf2d[_0xff74('0x2d')]=_0x41cf2d['attributes']['length']?_0x41cf2d['attributes']:_0x3ee8ff[_0xff74('0x29')];if(!_0x4dbe5b[_0xff74('0x2a')][_0xff74('0x2f')](_0xff74('0x30'))){_0x41cf2d['limit']=qs[_0xff74('0x11')](_0x4dbe5b[_0xff74('0x2a')][_0xff74('0x11')]);_0x41cf2d[_0xff74('0x10')]=qs[_0xff74('0x10')](_0x4dbe5b['query'][_0xff74('0x10')]);}_0x41cf2d[_0xff74('0x67')]=qs['sort'](_0x4dbe5b['query']['sort']);_0x41cf2d['where']=qs[_0xff74('0x2b')](_[_0xff74('0xbe')](_0x4dbe5b[_0xff74('0x2a')],_0x3ee8ff[_0xff74('0x2b')]));_0x41cf2d[_0xff74('0x32')][_0xff74('0xd5')]=_0x54f79d['id'];if(_0x4dbe5b[_0xff74('0x2a')][_0xff74('0x52')]){_0x41cf2d[_0xff74('0x32')]=_[_0xff74('0x75')](_0x41cf2d[_0xff74('0x32')],{'$or':_[_0xff74('0x45')](_0x41cf2d['attributes'],function(_0x1435bd){var _0x1e154e={};_0x1e154e[_0x1435bd]={'$like':'%'+_0x4dbe5b['query'][_0xff74('0x52')]+'%'};return _0x1e154e;})});}_0x41cf2d=_[_0xff74('0x75')]({},_0x41cf2d,_0x4dbe5b[_0xff74('0xbf')]);return db[_0xff74('0xd8')][_0xff74('0x13')]({'where':_0x41cf2d[_0xff74('0x32')]})[_0xff74('0x16')](function(_0x46e02f){_0x38ee8a[_0xff74('0x13')]=_0x46e02f;if(_0x4dbe5b['query'][_0xff74('0xd9')]){_0x41cf2d['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x41cf2d);})[_0xff74('0x16')](function(_0x4a8c9c){_0x38ee8a[_0xff74('0xda')]=_0x4a8c9c;return _0x38ee8a;});}})['then'](respondWithFilteredResult(_0x1d3968,_0x41cf2d))[_0xff74('0x7f')](handleError(_0x1d3968,null));};exports[_0xff74('0xdb')]=function(_0x49758b,_0x175ac3){var _0x78ddd8={'raw':!![],'where':{}};var _0x122445={};var _0x23e81e={'count':0x0,'rows':[]};return db[_0xff74('0x1e')][_0xff74('0x25')]({'where':{'id':_0x49758b[_0xff74('0x80')]['id']}})[_0xff74('0x16')](handleEntityNotFound(_0x175ac3,null))['then'](function(_0x1b21c6){if(_0x1b21c6){_0x122445[_0xff74('0x29')]=_[_0xff74('0x21')](db[_0xff74('0x9b')]['rawAttributes']);_0x122445[_0xff74('0x2a')]=_[_0xff74('0x21')](_0x49758b[_0xff74('0x2a')]);_0x122445[_0xff74('0x2b')]=_[_0xff74('0x2c')](_0x122445[_0xff74('0x29')],_0x122445[_0xff74('0x2a')]);_0x78ddd8[_0xff74('0x2d')]=_['intersection'](_0x122445[_0xff74('0x29')],qs['fields'](_0x49758b['query']['fields']));_0x78ddd8[_0xff74('0x2d')]=_0x78ddd8[_0xff74('0x2d')][_0xff74('0x20')]?_0x78ddd8['attributes']:_0x122445[_0xff74('0x29')];if(!_0x49758b[_0xff74('0x2a')][_0xff74('0x2f')](_0xff74('0x30'))){_0x78ddd8[_0xff74('0x11')]=qs[_0xff74('0x11')](_0x49758b['query'][_0xff74('0x11')]);_0x78ddd8[_0xff74('0x10')]=qs[_0xff74('0x10')](_0x49758b['query']['offset']);}_0x78ddd8[_0xff74('0x67')]=qs[_0xff74('0x31')](_0x49758b[_0xff74('0x2a')]['sort']);_0x78ddd8[_0xff74('0x32')]=qs[_0xff74('0x2b')](_['pick'](_0x49758b[_0xff74('0x2a')],_0x122445[_0xff74('0x2b')]));_0x78ddd8['where'][_0xff74('0xd5')]=_0x1b21c6['id'];if(_0x49758b[_0xff74('0x2a')][_0xff74('0x52')]){_0x78ddd8[_0xff74('0x32')]=_[_0xff74('0x75')](_0x78ddd8[_0xff74('0x32')],{'$or':_[_0xff74('0x45')](_0x78ddd8[_0xff74('0x2d')],function(_0x3a7cbc){var _0x2b8299={};_0x2b8299[_0x3a7cbc]={'$like':'%'+_0x49758b[_0xff74('0x2a')][_0xff74('0x52')]+'%'};return _0x2b8299;})});}_0x78ddd8=_[_0xff74('0x75')]({},_0x78ddd8,_0x49758b[_0xff74('0xbf')]);return db[_0xff74('0x9b')][_0xff74('0x13')]({'where':_0x78ddd8['where']})[_0xff74('0x16')](function(_0x4dc2e2){_0x23e81e[_0xff74('0x13')]=_0x4dc2e2;if(_0x49758b['query'][_0xff74('0xd9')]){_0x78ddd8['include']=[{'all':!![]}];}return db[_0xff74('0x9b')][_0xff74('0x86')](_0x78ddd8);})[_0xff74('0x16')](function(_0x379666){_0x23e81e[_0xff74('0xda')]=_0x379666;return _0x23e81e;});}})[_0xff74('0x16')](respondWithFilteredResult(_0x175ac3,_0x78ddd8))['catch'](handleError(_0x175ac3,null));};exports['getJscriptySessions']=function(_0x4ad008,_0x249efd){var _0x59a204={'raw':!![],'where':{}};var _0x26a6ad={};var _0xb28352={'count':0x0,'rows':[]};return db[_0xff74('0x1e')][_0xff74('0x25')]({'where':{'id':_0x4ad008[_0xff74('0x80')]['id']}})[_0xff74('0x16')](handleEntityNotFound(_0x249efd,null))[_0xff74('0x16')](function(_0xb5222d){if(_0xb5222d){_0x26a6ad[_0xff74('0x29')]=_[_0xff74('0x21')](db[_0xff74('0xdc')][_0xff74('0xbd')]);_0x26a6ad[_0xff74('0x2a')]=_[_0xff74('0x21')](_0x4ad008[_0xff74('0x2a')]);_0x26a6ad[_0xff74('0x2b')]=_['intersection'](_0x26a6ad[_0xff74('0x29')],_0x26a6ad['query']);_0x59a204[_0xff74('0x2d')]=_[_0xff74('0x2c')](_0x26a6ad['model'],qs['fields'](_0x4ad008[_0xff74('0x2a')][_0xff74('0x2e')]));_0x59a204[_0xff74('0x2d')]=_0x59a204[_0xff74('0x2d')][_0xff74('0x20')]?_0x59a204[_0xff74('0x2d')]:_0x26a6ad[_0xff74('0x29')];if(!_0x4ad008[_0xff74('0x2a')]['hasOwnProperty'](_0xff74('0x30'))){_0x59a204[_0xff74('0x11')]=qs['limit'](_0x4ad008[_0xff74('0x2a')][_0xff74('0x11')]);_0x59a204[_0xff74('0x10')]=qs['offset'](_0x4ad008['query'][_0xff74('0x10')]);}_0x59a204['order']=qs['sort'](_0x4ad008['query'][_0xff74('0x31')]);_0x59a204[_0xff74('0x32')]=qs[_0xff74('0x2b')](_['pick'](_0x4ad008[_0xff74('0x2a')],_0x26a6ad[_0xff74('0x2b')]));_0x59a204[_0xff74('0x32')][_0xff74('0xd5')]=_0xb5222d['id'];if(_0x4ad008[_0xff74('0x2a')][_0xff74('0x52')]){_0x59a204[_0xff74('0x32')]=_[_0xff74('0x75')](_0x59a204['where'],{'$or':_[_0xff74('0x45')](_0x59a204[_0xff74('0x2d')],function(_0xa5e4f1){var _0x26400d={};_0x26400d[_0xa5e4f1]={'$like':'%'+_0x4ad008[_0xff74('0x2a')][_0xff74('0x52')]+'%'};return _0x26400d;})});}_0x59a204=_['merge']({},_0x59a204,_0x4ad008[_0xff74('0xbf')]);return db[_0xff74('0xdc')]['count']({'where':_0x59a204['where']})[_0xff74('0x16')](function(_0x1d4227){_0xb28352[_0xff74('0x13')]=_0x1d4227;if(_0x4ad008[_0xff74('0x2a')][_0xff74('0xd9')]){_0x59a204[_0xff74('0xd6')]=[{'all':!![]}];}return db[_0xff74('0xdc')][_0xff74('0x86')](_0x59a204);})[_0xff74('0x16')](function(_0x1426b7){_0xb28352[_0xff74('0xda')]=_0x1426b7;return _0xb28352;});}})[_0xff74('0x16')](respondWithFilteredResult(_0x249efd,_0x59a204))['catch'](handleError(_0x249efd,null));};exports[_0xff74('0xdd')]=function(_0x27ad38,_0x10d0e9){try{if(!_0x27ad38[_0xff74('0x89')][_0xff74('0xaa')]){throw new Error(_0xff74('0xde'));}if(!_0x27ad38[_0xff74('0x89')][_0xff74('0xdf')]){throw new Error(_0xff74('0xe0'));}if(!_0x27ad38[_0xff74('0x89')][_0xff74('0xe1')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x27ad38[_0xff74('0x89')][_0xff74('0xe2')]){throw new Error(_0xff74('0xe3'));}var _0x3165eb=_0x27ad38[_0xff74('0x89')][_0xff74('0xdf')][_0xff74('0x44')](',');var _0x5b5150=_0x27ad38['body'][_0xff74('0xe1')][_0xff74('0x44')](',');if(!_0x3165eb['length']||!_0x5b5150[_0xff74('0x20')]||_0x3165eb[_0xff74('0x20')]!==_0x5b5150[_0xff74('0x20')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x27ad38[_0xff74('0x89')][_0xff74('0x2e')]=_[_0xff74('0xe4')](_0x3165eb,_0x5b5150);if(!_0x27ad38['body'][_0xff74('0x2e')][_0xff74('0xbc')]){throw new Error(_0xff74('0xe5'));}if(!_0x27ad38['body']['fields']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x192093=path[_0xff74('0xa2')](config[_0xff74('0xe6')],'server/files/tmp',_0x27ad38[_0xff74('0xe7')][_0xff74('0xe8')]);fs[_0xff74('0xe9')](_0x192093,parseInt(_0xff74('0xea'),0x8));var _0x65d9b9=require(_0xff74('0xeb'))[_0xff74('0xec')](path[_0xff74('0xa2')](__dirname,_0xff74('0xed')),[_0x192093,_0x27ad38[_0xff74('0x89')][_0xff74('0xdf')],_0x27ad38[_0xff74('0x89')][_0xff74('0xe1')],_0x27ad38['body']['ListId'],_0x27ad38[_0xff74('0x89')]['CompanyId'],_0x27ad38[_0xff74('0x89')]['duplicates'],_0x27ad38['body'][_0xff74('0xe2')]]);return _0x10d0e9[_0xff74('0xf')](0xc8)[_0xff74('0xee')]({'message':_0xff74('0xef'),'pid':_0x65d9b9[_0xff74('0xf0')]});}catch(_0x370b38){return _0x10d0e9['status'](0x1f4)[_0xff74('0x1c')](_0x370b38);}};exports[_0xff74('0xf1')]=function(_0x4f411b,_0x153949){var _0x57d2b2=fs['createReadStream'](_0x4f411b[_0xff74('0xe7')][_0xff74('0x2')]);Papa[_0xff74('0xf2')](_0x57d2b2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x547136){return _0x153949[_0xff74('0xf')](0xc8)['json']({'file':_0x4f411b[_0xff74('0xe7')],'fields':_0x547136['meta']['fields']});}});};exports[_0xff74('0xf3')]=function(_0xc24121,_0x4eddab){return db[_0xff74('0x48')][_0xff74('0x86')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x5621f9){var _0x104bd1=![];if(!_0xc24121['body'][_0xff74('0xaa')]){throw new Error(_0xff74('0xde'));}if(!_0xc24121[_0xff74('0x89')][_0xff74('0xf4')][_0xff74('0xbc')]){throw new Error(_0xff74('0xe5'));}if(!_0xc24121[_0xff74('0x89')][_0xff74('0xf4')][_0xff74('0xf5')]){throw new Error(_0xff74('0xf6'));}if(!_0xc24121[_0xff74('0x89')]['socket_timestamp']){throw new Error(_0xff74('0xe3'));}var _0x1d955e=require(_0xff74('0xeb'))['fork'](path[_0xff74('0xa2')](__dirname,_0xff74('0xf7')),[_0xc24121[_0xff74('0x80')]['id'],JSON[_0xff74('0xf8')](_0xc24121[_0xff74('0x89')]),JSON[_0xff74('0xf8')](_0x5621f9)]);_0x1d955e['on'](_0xff74('0xf9'),function(){_0x104bd1=!![];return _0x4eddab[_0xff74('0xf')](0xc8)['json']({'message':_0xff74('0xfa'),'pid':_0x1d955e[_0xff74('0xf0')]});});_0x1d955e['on'](_0xff74('0xfb'),function(_0x358d7b){if(_0x358d7b&&!_0x104bd1){return _0x4eddab['status'](0x1f4)[_0xff74('0xee')]({'message':_0xff74('0xfc'),'pid':_0x1d955e['pid']});}});})['catch'](handleError(_0x4eddab,null));};exports[_0xff74('0xfd')]=function(_0x4a8559,_0x3fa3e9,_0x20ff27){return db['User'][_0xff74('0x86')]({'raw':!![],'attributes':['id'],'where':{'role':_0xff74('0x6c')}})[_0xff74('0x16')](function(_0x568c4e){var _0x408264=![];if(!_0x4a8559[_0xff74('0x89')][_0xff74('0xaa')]){throw new Error(_0xff74('0xde'));}if(!_0x4a8559[_0xff74('0x89')]['binding'][_0xff74('0xbc')]){throw new Error(_0xff74('0xe5'));}if(!_0x4a8559['body'][_0xff74('0xf4')][_0xff74('0xf5')]){throw new Error(_0xff74('0xf6'));}if(!_0x4a8559['body'][_0xff74('0xe2')]){throw new Error(_0xff74('0xe3'));}var _0x17abb4=require(_0xff74('0xeb'))[_0xff74('0xec')](path[_0xff74('0xa2')](__dirname,'../../components/import/cm/csvUpdates'),[_0x4a8559[_0xff74('0x80')]['id'],JSON[_0xff74('0xf8')](_0x4a8559['body']),JSON[_0xff74('0xf8')](_0x568c4e)]);_0x17abb4['on'](_0xff74('0xf9'),function(_0x2a0d7c){_0x408264=!![];return _0x3fa3e9['status'](0xc8)[_0xff74('0xee')]({'message':_0xff74('0xfa'),'pid':_0x17abb4['pid']});});_0x17abb4['on'](_0xff74('0xfb'),function(_0x254029){if(_0x254029&&!_0x408264){return _0x3fa3e9[_0xff74('0xf')](0x1f4)[_0xff74('0xee')]({'message':_0xff74('0xfc'),'pid':_0x17abb4[_0xff74('0xf0')]});}});})['catch'](handleError(_0x3fa3e9,null));};exports[_0xff74('0xfe')]=function(_0x39fd47,_0x32ba4f){var _0x386c32=[_0xff74('0xff'),_0xff74('0x100'),'sms',_0xff74('0x101'),_0xff74('0x102'),'whatsapp',_0xff74('0x103')];var _0x2133bc={'offset':0x0,'order':qs[_0xff74('0x31')]('-createdAt')},_0x372c02={'count':0x0,'rows':[]};Promise[_0xff74('0x6b')]()[_0xff74('0x16')](function(){if(_0x39fd47[_0xff74('0x2a')][_0xff74('0x104')]){if(!_[_0xff74('0x105')](_0x386c32,_0x39fd47['query'][_0xff74('0x104')]['toLowerCase']())){throw new Error(_0xff74('0x106'));}_0x386c32=[_0x39fd47[_0xff74('0x2a')]['channel'][_0xff74('0x107')]()];}if(_0x39fd47[_0xff74('0x2a')][_0xff74('0x108')]){try{var _0x49f41c=JSON['parse'](_0x39fd47[_0xff74('0x2a')][_0xff74('0x108')]);if(!moment(_0x49f41c[_0xff74('0x35')])[_0xff74('0x109')]()){throw new Error(_0xff74('0x10a'));}if(!moment(_0x49f41c['to'])['isValid']()){throw new Error(_0xff74('0x10b'));}}catch(_0x19f431){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x39fd47[_0xff74('0x2a')][_0xff74('0x2f')](_0xff74('0x30'))){_0x2133bc[_0xff74('0x11')]=qs[_0xff74('0x11')](_0x39fd47[_0xff74('0x2a')][_0xff74('0x11')]||0xa);_0x2133bc[_0xff74('0x10')]=qs[_0xff74('0x10')](_0x39fd47[_0xff74('0x2a')][_0xff74('0x10')]);}var _0x5f5a72=_0x386c32[_0xff74('0x45')](function(_0x2016ed){if(_0x2016ed===_0xff74('0x103')){var _0x355ef6={'attributes':['id',_0xff74('0x10c'),'type','source',_0xff74('0x10d'),_0xff74('0x10e'),_0xff74('0x10f'),_0xff74('0x110'),_0xff74('0x111'),'note',_0xff74('0x112'),_0xff74('0x113'),_0xff74('0x114'),_0xff74('0x115'),_0xff74('0x116')],'where':{'ContactId':_0x39fd47[_0xff74('0x80')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id','name',_0xff74('0x117'),_0xff74('0x87')]}],'order':[[_0xff74('0x112'),_0xff74('0x68')]]};if(_0x39fd47[_0xff74('0x2a')][_0xff74('0x108')]){_0x355ef6['where']['createdAt']={'$gte':_0x49f41c[_0xff74('0x35')],'$lte':_0x49f41c['to']};}return db[_0xff74('0x9d')][_0xff74('0x118')](_0x355ef6)[_0xff74('0x16')](function(_0x2708c7){_0x372c02[_0xff74('0x13')]+=_0x2708c7[_0xff74('0x13')];return _[_0xff74('0x45')](_0x2708c7[_0xff74('0xda')],function(_0x58079a){var _0x28e4f4=_0x58079a[_0xff74('0x8a')]({'plain':!![]});_0x28e4f4['channel']=_0x2016ed;if(_0x28e4f4['User']){_0x28e4f4[_0xff74('0x48')]={'id':_0x28e4f4['User']['id'],'name':_0x28e4f4[_0xff74('0x48')][_0xff74('0x1b')],'fullname':_0x28e4f4[_0xff74('0x48')][_0xff74('0x117')],'alias':_0x28e4f4[_0xff74('0x48')][_0xff74('0x87')]};}return _0x28e4f4;});});}else{var _0x5ac97e=_[_0xff74('0x119')](_0x2016ed)+(_0x2016ed===_0xff74('0x100')?_0xff74('0x11a'):_0xff74('0x11b'));var _0x5823da={'attributes':['id',_0xff74('0x11c'),'closedAt','createdAt',_0xff74('0x11d'),_0xff74('0x11e'),_0xff74('0x11f'),_0xff74('0x120'),_0xff74('0x116'),_0x5ac97e+'Id'],'where':{'ContactId':_0x39fd47['params']['id']},'include':[{'model':db[_0x5ac97e],'as':_0xff74('0x11b'),'attributes':['id','name',_0xff74('0x121')]},{'model':db[_0xff74('0x48')],'as':_0xff74('0x122'),'attributes':['id',_0xff74('0x1b'),_0xff74('0x117')]},{'model':db['Tag'],'as':_0xff74('0x7e'),'attributes':['id',_0xff74('0x1b'),_0xff74('0xae')],'through':{'attributes':[]}}],'order':[[_0xff74('0x112'),_0xff74('0x68')]]};if(_0x39fd47['query'][_0xff74('0x108')]){_0x5823da['where'][_0xff74('0x112')]={'$gte':_0x49f41c['from'],'$lte':_0x49f41c['to']};}switch(_0x2016ed){case _0xff74('0x100'):_0x5823da[_0xff74('0x2d')][_0xff74('0x24')]('browserName','customerIp','customerPort',_0xff74('0x123'),_0xff74('0x124'),_0xff74('0x125'),'ratingType','ratingValue',_0xff74('0x126'));break;case _0xff74('0xff'):_0x5823da[_0xff74('0x2d')][_0xff74('0x24')](_0xff74('0x127'),_0xff74('0x128'));break;case _0xff74('0x101'):_0x5823da[_0xff74('0x2d')][_0xff74('0x24')](_0xff74('0x129'),_0xff74('0x12a'));break;}return db[_[_0xff74('0x119')](_0x2016ed)+_0xff74('0x12b')][_0xff74('0x118')](_0x5823da)[_0xff74('0x16')](function(_0x12b2b8){_0x372c02[_0xff74('0x13')]+=_0x12b2b8[_0xff74('0x13')];return _[_0xff74('0x45')](_0x12b2b8[_0xff74('0xda')],function(_0x3e6224){var _0x42490d=_0x3e6224['get']({'plain':!![]});_0x42490d[_0xff74('0x104')]=_0x2016ed;if(_0x42490d[_0xff74('0x122')]){_0x42490d[_0xff74('0x122')]={'id':_0x42490d[_0xff74('0x122')]['id'],'name':_0x42490d['Owner'][_0xff74('0x1b')],'fullname':_0x42490d['Owner'][_0xff74('0x117')]};}return _0x42490d;});});}});return Promise['all'](_0x5f5a72);})[_0xff74('0x16')](function(_0x577130){return _(_0x577130)['flatten']()['sortBy'](_0xff74('0x112'))[_0xff74('0x12c')]()[_0xff74('0x4b')]();})['then'](function(_0x2b57b1){_0x372c02[_0xff74('0xda')]=_0x2133bc[_0xff74('0x11')]?_0x2b57b1['slice'](_0x2133bc[_0xff74('0x10')],_0x2133bc['offset']+_0x2133bc['limit']):_0x2b57b1;return _0x372c02;})[_0xff74('0x16')](respondWithFilteredResult(_0x32ba4f,_0x2133bc))[_0xff74('0x7f')](handleError(_0x32ba4f,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index f3800a2..b9f918d 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 _0x428b=['hasOwnProperty','hook','../../mysqldb','CmContact','setMaxListeners','update','remove','emit'];(function(_0xe7e447,_0xd89d0b){var _0x20dd8b=function(_0x5b26d9){while(--_0x5b26d9){_0xe7e447['push'](_0xe7e447['shift']());}};_0x20dd8b(++_0xd89d0b);}(_0x428b,0xb2));var _0xb428=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x428b[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xb428('0x0'))['db'][_0xb428('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb428('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb428('0x3'),'afterDestroy':_0xb428('0x4')};function emitEvent(_0xba37a7){return function(_0x40d647,_0x255c26,_0x1e5862){CmContactEvents[_0xb428('0x5')](_0xba37a7+':'+_0x40d647['id'],_0x40d647);CmContactEvents[_0xb428('0x5')](_0xba37a7,_0x40d647);_0x1e5862(null);};}for(var e in events){if(events[_0xb428('0x6')](e)){var event=events[e];CmContact[_0xb428('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x6a42=['hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0x6a42,0xcb));var _0x26a4=function(_0x297f87,_0x1841d4){_0x297f87=_0x297f87-0x0;var _0x35b009=_0x6a42[_0x297f87];return _0x35b009;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x26a4('0x0'))['db'][_0x26a4('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x26a4('0x2')](0x0);var events={'afterCreate':_0x26a4('0x3'),'afterUpdate':_0x26a4('0x4'),'afterDestroy':_0x26a4('0x5')};function emitEvent(_0x478d71){return function(_0x586321,_0x17a5fa,_0x19a344){CmContactEvents[_0x26a4('0x6')](_0x478d71+':'+_0x586321['id'],_0x586321);CmContactEvents['emit'](_0x478d71,_0x586321);_0x19a344(null);};}for(var e in events){if(events[_0x26a4('0x7')](e)){var event=events[e];CmContact[_0x26a4('0x8')](e,emitEvent(event));}}module[_0x26a4('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 2654ae6..55cd7ec 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 _0xb1be=['message','CmHopperBlack','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','info','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','phone','firstName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','isNil','timezones','dialTimezone','utcOffset','add','minutes','then','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','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','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','ret','BlackLists','cmContact,\x20%s,\x20%s'];(function(_0x51ed3c,_0x550bfe){var _0x30f0b1=function(_0x5ea2b2){while(--_0x5ea2b2){_0x51ed3c['push'](_0x51ed3c['shift']());}};_0x30f0b1(++_0x550bfe);}(_0xb1be,0x16d));var _0xeb1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1be[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeb1b('0x0'));var util=require(_0xeb1b('0x1'));var logger=require('../../config/logger')(_0xeb1b('0x2'));var moment=require(_0xeb1b('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb1b('0x4'));var fs=require('fs');var path=require(_0xeb1b('0x5'));var rimraf=require(_0xeb1b('0x6'));var config=require(_0xeb1b('0x7'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0xeb1b('0x8')]=function(_0x5201fd,_0x46fa87){return _0x5201fd[_0xeb1b('0x9')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xeb1b('0xa'),'fields':[_0xeb1b('0xa')]},{'name':'fti_cm_contacts','fields':[_0xeb1b('0xb'),'lastName',_0xeb1b('0xa'),_0xeb1b('0xc'),'fax',_0xeb1b('0xd')],'type':_0xeb1b('0xe')}],'timestamps':!![],'charset':_0xeb1b('0xf'),'collate':_0xeb1b('0x10'),'hooks':{'afterCreate':function(_0x511e63,_0x27b60e,_0x114a96){var _0x25a529=_0x5201fd['models'];var _0x36f5aa=_0x511e63[_0xeb1b('0x11')]({'plain':!![]});function _0x4765bc(){return function(_0x1329ec){logger['error'](_0xeb1b('0x12'),_0xeb1b('0x13'),util['inspect'](_0x1329ec,{'showHidden':![],'depth':null}));};}function _0x17011e(_0x28b862,_0x5231f1){var _0x1578d1=_0x5231f1[_0xeb1b('0x14')]?_0x5231f1[_0xeb1b('0x14')]:moment()[_0xeb1b('0x15')](_0xeb1b('0x16'));return new BPromise(function(_0x57128b,_0x542a72){if(_['isNil'](_0x5231f1['dialTimezone'])){_0x57128b({'ret':_0x1578d1});}else{_0x25a529[_0xeb1b('0x17')]['findOne']({'where':{'id':_0x28b862['id']}})['then'](function(_0x4b6921){if(!_[_0xeb1b('0x18')](_0x4b6921)){var _0x5e6ce5=_0x4b6921['dialTimezone'];if(!_[_0xeb1b('0x18')](_0x5e6ce5)){var _0x19a793=shared[_0xeb1b('0x19')];var _0x57356b=_0x19a793[_0x5e6ce5];var _0x572c3a=_0x19a793[_0x5231f1[_0xeb1b('0x1a')]];if(!_['isNil'](_0x57356b)&&!_[_0xeb1b('0x18')](_0x572c3a)){var _0x125b3=_0x57356b[_0xeb1b('0x1b')]-_0x572c3a['utcOffset'];_0x1578d1=_0x5231f1[_0xeb1b('0x14')]?_0x5231f1[_0xeb1b('0x14')]:moment();var _0x2e68ac=moment(_0x1578d1)[_0xeb1b('0x1c')](_0x125b3,_0xeb1b('0x1d'));_0x57128b({'ret':_0x2e68ac[_0xeb1b('0x15')](_0xeb1b('0x16'))});}else _0x57128b({'ret':_0x1578d1});}else _0x57128b({'ret':_0x1578d1});}else{_0x57128b({'ret':_0x1578d1});}});}});return 0xa;}var _0x28f153=function(_0x15b6cc){return new BPromise(function(_0x280d83,_0x31bd50){_0x17011e(_0x15b6cc,_0x36f5aa)[_0xeb1b('0x1e')](function(_0xed6d1b){_0x36f5aa[_0xeb1b('0x14')]=_0xed6d1b['ret'];_0x25a529[_0xeb1b('0x1f')][_0xeb1b('0x20')]({'where':{'phone':_0x36f5aa['phone'],'VoiceQueueId':_0x15b6cc['id']}})[_0xeb1b('0x1e')](function(_0x470785){if(!_[_0xeb1b('0x18')](_0x470785)){throw new Error(_0xeb1b('0x21')+_0x36f5aa['phone']+_0xeb1b('0x22')+_0x15b6cc['id']);}return _0x25a529[_0xeb1b('0x1f')][_0xeb1b('0x23')]({'phone':_0x36f5aa[_0xeb1b('0xa')],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa[_0xeb1b('0x24')],'priority':_0x36f5aa[_0xeb1b('0x25')]?_0x36f5aa[_0xeb1b('0x25')]:0x2,'scheduledat':_0x36f5aa['scheduledat']?_0x36f5aa[_0xeb1b('0x14')]:moment()[_0xeb1b('0x15')](_0xeb1b('0x16')),'callback':_0x36f5aa[_0xeb1b('0x26')]?!![]:![],'callbackuniqueid':_0x36f5aa[_0xeb1b('0x26')]?_0x36f5aa['callbackUniqueid']:undefined,'callbackat':_0x36f5aa['callbackUniqueid']?moment()[_0xeb1b('0x15')](_0xeb1b('0x16')):undefined,'VoiceQueueId':_0x15b6cc['id']});})[_0xeb1b('0x27')](function(_0x54cc7b){_0x31bd50(_0x54cc7b);});});});};var _0x173570=function(_0x4c7b38){return new BPromise(function(_0x1533ef,_0x453317){_0x17011e(_0x4c7b38,_0x36f5aa)[_0xeb1b('0x1e')](function(_0x437f5c){_0x36f5aa['scheduledat']=_0x437f5c['ret'];_0x25a529[_0xeb1b('0x1f')]['findOne']({'where':{'phone':_0x36f5aa[_0xeb1b('0xa')],'VoiceQueueId':_0x4c7b38['id']}})['then'](function(_0x41e75a){if(!_[_0xeb1b('0x18')](_0x41e75a)){throw new Error(_0xeb1b('0x21')+_0x36f5aa['phone']+_0xeb1b('0x28')+_0x4c7b38['id']);}return _0x25a529[_0xeb1b('0x29')][_0xeb1b('0x20')]({'where':{'calleridnum':_0x36f5aa[_0xeb1b('0xa')],'VoiceQueueId':_0x4c7b38['id']}});})[_0xeb1b('0x1e')](function(_0x2eb633){if(!_[_0xeb1b('0x18')](_0x2eb633)){throw new Error(_0xeb1b('0x2a')+_0x36f5aa['phone']+_0xeb1b('0x2b')+_0x4c7b38['id']);}return _0x25a529[_0xeb1b('0x1f')]['create']({'phone':_0x36f5aa[_0xeb1b('0xa')],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa[_0xeb1b('0x24')],'priority':_0x36f5aa['priority']?_0x36f5aa[_0xeb1b('0x25')]:0x2,'scheduledat':_0x36f5aa[_0xeb1b('0x14')]?_0x36f5aa[_0xeb1b('0x14')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x36f5aa[_0xeb1b('0x26')]?!![]:![],'callbackuniqueid':_0x36f5aa['callbackUniqueid']?_0x36f5aa[_0xeb1b('0x26')]:undefined,'callbackat':_0x36f5aa[_0xeb1b('0x26')]?moment()[_0xeb1b('0x15')](_0xeb1b('0x16')):undefined,'VoiceQueueId':_0x4c7b38['id']});})[_0xeb1b('0x27')](function(_0x88d6ce){_0x453317(_0x88d6ce);});});});};function _0x1611e4(){return function(_0x23300f){logger[_0xeb1b('0x2c')](_0xeb1b('0x12'),_0xeb1b('0x13'),util[_0xeb1b('0x2d')](_0x23300f,{'showHidden':![],'depth':null}));};}function _0x1cbf7d(_0x5cd302,_0x28a1d4){var _0x33ceb3=_0x28a1d4['scheduledat']?_0x28a1d4[_0xeb1b('0x14')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x79e3b5,_0x507474){if(_[_0xeb1b('0x18')](_0x28a1d4[_0xeb1b('0x1a')])){_0x79e3b5({'ret':_0x33ceb3});}else{_0x25a529[_0xeb1b('0x2e')]['findOne']({'where':{'id':_0x5cd302['id']}})[_0xeb1b('0x1e')](function(_0x29b041){if(!_[_0xeb1b('0x18')](_0x29b041)){var _0x2ae0cb=_0x29b041[_0xeb1b('0x1a')];if(!_['isNil'](_0x2ae0cb)){var _0x102beb=shared[_0xeb1b('0x19')];var _0x1bd867=_0x102beb[_0x2ae0cb];var _0x1186f9=_0x102beb[_0x28a1d4[_0xeb1b('0x1a')]];if(!_[_0xeb1b('0x18')](_0x1bd867)&&!_[_0xeb1b('0x18')](_0x1186f9)){var _0x48797d=_0x1bd867[_0xeb1b('0x1b')]-_0x1186f9[_0xeb1b('0x1b')];_0x33ceb3=_0x28a1d4['scheduledat']?_0x28a1d4['scheduledat']:moment();var _0x225f11=moment(_0x33ceb3)[_0xeb1b('0x1c')](_0x48797d,'minutes');_0x79e3b5({'ret':_0x225f11['format'](_0xeb1b('0x16'))});}else _0x79e3b5({'ret':_0x33ceb3});}else _0x79e3b5({'ret':_0x33ceb3});}else{_0x79e3b5({'ret':_0x33ceb3});}});}});return 0xa;}var _0x2566fc=function(_0x3777cd){return new BPromise(function(_0x3e1f5b,_0x4db1d1){_0x1cbf7d(_0x3777cd,_0x36f5aa)[_0xeb1b('0x1e')](function(_0x15609b){_0x36f5aa['scheduledat']=_0x15609b['ret'];_0x25a529[_0xeb1b('0x1f')]['findOne']({'where':{'phone':_0x36f5aa[_0xeb1b('0xa')],'CampaignId':_0x3777cd['id']}})[_0xeb1b('0x1e')](function(_0x407b2b){if(!_[_0xeb1b('0x18')](_0x407b2b)){throw new Error(_0xeb1b('0x21')+_0x36f5aa[_0xeb1b('0xa')]+_0xeb1b('0x2f')+_0x3777cd['id']);}return _0x25a529[_0xeb1b('0x1f')][_0xeb1b('0x23')]({'phone':_0x36f5aa[_0xeb1b('0xa')],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa[_0xeb1b('0x24')],'priority':_0x36f5aa[_0xeb1b('0x25')]?_0x36f5aa[_0xeb1b('0x25')]:0x2,'scheduledat':_0x36f5aa['scheduledat']?_0x36f5aa[_0xeb1b('0x14')]:moment()[_0xeb1b('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x36f5aa['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x36f5aa[_0xeb1b('0x26')]?_0x36f5aa[_0xeb1b('0x26')]:undefined,'callbackat':_0x36f5aa[_0xeb1b('0x26')]?moment()[_0xeb1b('0x15')](_0xeb1b('0x16')):undefined,'CampaignId':_0x3777cd['id']});})[_0xeb1b('0x27')](function(_0xa864ef){_0x4db1d1(_0xa864ef);});});});};var _0x4d18c5=function(_0x3f0315){return new BPromise(function(_0x4e08dd,_0x1efa64){_0x1cbf7d(_0x3f0315,_0x36f5aa)[_0xeb1b('0x1e')](function(_0x1d7a3e){_0x36f5aa[_0xeb1b('0x14')]=_0x1d7a3e['ret'];_0x25a529[_0xeb1b('0x1f')]['findOne']({'where':{'phone':_0x36f5aa[_0xeb1b('0xa')],'CampaignId':_0x3f0315['id']}})[_0xeb1b('0x1e')](function(_0x47138f){if(!_[_0xeb1b('0x18')](_0x47138f)){throw new Error(_0xeb1b('0x21')+_0x36f5aa[_0xeb1b('0xa')]+_0xeb1b('0x30')+_0x3f0315['id']);}return _0x25a529[_0xeb1b('0x29')][_0xeb1b('0x20')]({'where':{'calleridnum':_0x36f5aa[_0xeb1b('0xa')],'CampaignId':_0x3f0315['id']}});})[_0xeb1b('0x1e')](function(_0x2aeba1){if(!_[_0xeb1b('0x18')](_0x2aeba1)){throw new Error(_0xeb1b('0x2a')+_0x36f5aa[_0xeb1b('0xa')]+_0xeb1b('0x31')+_0x3f0315['id']);}return _0x25a529['CmHopper'][_0xeb1b('0x23')]({'phone':_0x36f5aa[_0xeb1b('0xa')],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa[_0xeb1b('0x24')],'priority':_0x36f5aa[_0xeb1b('0x25')]?_0x36f5aa[_0xeb1b('0x25')]:0x2,'scheduledat':_0x36f5aa['scheduledat']?_0x36f5aa[_0xeb1b('0x14')]:moment()[_0xeb1b('0x15')](_0xeb1b('0x16')),'callback':_0x36f5aa[_0xeb1b('0x26')]?!![]:![],'callbackuniqueid':_0x36f5aa[_0xeb1b('0x26')]?_0x36f5aa[_0xeb1b('0x26')]:undefined,'callbackat':_0x36f5aa[_0xeb1b('0x26')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3f0315['id']});})[_0xeb1b('0x27')](function(_0xf3a010){_0x1efa64(_0xf3a010);});});});};if(_0x36f5aa[_0xeb1b('0x24')]){_0x25a529[_0xeb1b('0x17')][_0xeb1b('0x32')]({'where':{'type':_0xeb1b('0x33')},'attributes':['id',_0xeb1b('0x34'),_0xeb1b('0x1a')],'include':[{'model':_0x25a529[_0xeb1b('0x35')],'as':_0xeb1b('0x36'),'where':{'id':_0x36f5aa[_0xeb1b('0x24')]}}]})[_0xeb1b('0x1e')](function(_0x39596c){if(_0x39596c){var _0x160104=[];for(var _0x29ee0e=0x0,_0x179863;_0x29ee0e<_0x39596c[_0xeb1b('0x37')];_0x29ee0e+=0x1){_0x179863=_0x39596c[_0x29ee0e]['get']({'plain':!![]});switch(_0x179863[_0xeb1b('0x34')]){case _0xeb1b('0x38'):_0x173570(_0x179863)[_0xeb1b('0x27')](_0x4765bc());break;case _0xeb1b('0x39'):_0x28f153(_0x179863)[_0xeb1b('0x27')](_0x4765bc());break;default:_0x1cbf7d(_0x179863,_0x36f5aa)[_0xeb1b('0x1e')](function(_0x1bda2b){_0x36f5aa['scheduledat']=_0x1bda2b[_0xeb1b('0x3a')];_0x25a529['CmHopper'][_0xeb1b('0x23')]({'phone':_0x36f5aa['phone'],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa[_0xeb1b('0x24')],'scheduledat':_0x36f5aa[_0xeb1b('0x14')]?_0x36f5aa[_0xeb1b('0x14')]:moment()['format'](_0xeb1b('0x16')),'priority':_0x36f5aa[_0xeb1b('0x25')]?_0x36f5aa['priority']:0x2,'callback':_0x36f5aa[_0xeb1b('0x26')]?!![]:![],'callbackuniqueid':_0x36f5aa[_0xeb1b('0x26')]?_0x36f5aa[_0xeb1b('0x26')]:undefined,'callbackat':_0x36f5aa[_0xeb1b('0x26')]?moment()[_0xeb1b('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x179863['id']})['catch'](_0x4765bc());});}}}})[_0xeb1b('0x1e')](function(){return _0x25a529[_0xeb1b('0x17')][_0xeb1b('0x32')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x25a529[_0xeb1b('0x35')],'as':_0xeb1b('0x3b'),'where':{'id':_0x36f5aa['ListId']}}]})[_0xeb1b('0x1e')](function(_0x46c4e7){if(_0x46c4e7){var _0x17373e=[];for(var _0x11d2e5=0x0,_0x2b424c;_0x11d2e5<_0x46c4e7[_0xeb1b('0x37')];_0x11d2e5+=0x1){_0x2b424c=_0x46c4e7[_0x11d2e5][_0xeb1b('0x11')]({'plain':!![]});_0x25a529['CmHopperBlack'][_0xeb1b('0x23')]({'phone':_0x36f5aa[_0xeb1b('0xa')],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa['ListId'],'VoiceQueueId':_0x2b424c['id']})[_0xeb1b('0x27')](function(_0x494de0){logger['error'](_0xeb1b('0x3c'),'afterCreate',_0x494de0[_0xeb1b('0x3d')]);});}}});})[_0xeb1b('0x1e')](function(){return _0x25a529[_0xeb1b('0x2e')][_0xeb1b('0x32')]({'attributes':['id','dialCheckDuplicateType',_0xeb1b('0x1a')],'include':[{'model':_0x25a529[_0xeb1b('0x35')],'as':_0xeb1b('0x36'),'where':{'id':_0x36f5aa['ListId']}}]})['then'](function(_0x350498){if(_0x350498){var _0xd069bb=[];for(var _0x1b3d96=0x0,_0x54332a;_0x1b3d96<_0x350498[_0xeb1b('0x37')];_0x1b3d96+=0x1){_0x54332a=_0x350498[_0x1b3d96][_0xeb1b('0x11')]({'plain':!![]});switch(_0x54332a[_0xeb1b('0x34')]){case _0xeb1b('0x38'):_0x4d18c5(_0x54332a)[_0xeb1b('0x27')](_0x1611e4());break;case _0xeb1b('0x39'):_0x2566fc(_0x54332a)[_0xeb1b('0x27')](_0x1611e4());break;default:_0x25a529['CmHopper']['create']({'phone':_0x36f5aa[_0xeb1b('0xa')],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa[_0xeb1b('0x24')],'scheduledat':_0x36f5aa[_0xeb1b('0x14')]?_0x36f5aa[_0xeb1b('0x14')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x36f5aa['priority']?_0x36f5aa['priority']:0x2,'callback':_0x36f5aa[_0xeb1b('0x26')]?!![]:![],'callbackuniqueid':_0x36f5aa[_0xeb1b('0x26')]?_0x36f5aa[_0xeb1b('0x26')]:undefined,'callbackat':_0x36f5aa['callbackUniqueid']?moment()[_0xeb1b('0x15')](_0xeb1b('0x16')):undefined,'CampaignId':_0x54332a['id']})[_0xeb1b('0x27')](_0x1611e4());}}}});})[_0xeb1b('0x1e')](function(){return _0x25a529[_0xeb1b('0x2e')][_0xeb1b('0x32')]({'attributes':['id'],'include':[{'model':_0x25a529[_0xeb1b('0x35')],'as':_0xeb1b('0x3b'),'where':{'id':_0x36f5aa[_0xeb1b('0x24')]}}]})[_0xeb1b('0x1e')](function(_0x236f14){if(_0x236f14){var _0x2697d0=[];for(var _0x137f4e=0x0,_0x4c96f6;_0x137f4e<_0x236f14['length'];_0x137f4e+=0x1){_0x4c96f6=_0x236f14[_0x137f4e][_0xeb1b('0x11')]({'plain':!![]});_0x25a529[_0xeb1b('0x3e')][_0xeb1b('0x23')]({'phone':_0x36f5aa['phone'],'ContactId':_0x36f5aa['id'],'ListId':_0x36f5aa['ListId'],'CampaignId':_0x4c96f6['id']})[_0xeb1b('0x27')](function(_0x2eb803){logger[_0xeb1b('0x2c')](_0xeb1b('0x3c'),_0xeb1b('0x13'),_0x2eb803[_0xeb1b('0x3d')]);});}}});})[_0xeb1b('0x1e')](function(){_0x114a96();})[_0xeb1b('0x27')](function(_0x26ecd1){logger['error'](_0xeb1b('0x3c'),_0xeb1b('0x13'),_0x26ecd1['message']);_0x114a96(_0x26ecd1);});}else{_0x114a96(new Error(_0xeb1b('0x3f')));}},'afterDestroy':function(_0x14a112,_0x1d02c7,_0xe0dc8b){var _0x356deb=_0x5201fd['models'];var _0x1715f4=_0x14a112['get']({'plain':!![]});return _0x356deb[_0xeb1b('0x1f')][_0xeb1b('0x32')]({'raw':!![],'where':{'ListId':_0x1715f4['ListId'],'ContactId':_0x1715f4['id']}})[_0xeb1b('0x1e')](function(_0x446775){if(!_[_0xeb1b('0x40')](_0x446775)){var _0x15e6e1=[];for(var _0x5a879f=0x0;_0x5a879f<_0x446775['length'];_0x5a879f+=0x1){var _0x48d4a6=_0x356deb['CmHopper'][_0xeb1b('0x41')]({'where':{'ListId':_0x446775[_0x5a879f][_0xeb1b('0x24')],'ContactId':_0x446775[_0x5a879f]['ContactId'],'VoiceQueueId':_0x446775[_0x5a879f][_0xeb1b('0x42')],'CampaignId':_0x446775[_0x5a879f][_0xeb1b('0x43')]}});_0x15e6e1[_0xeb1b('0x44')](_0x48d4a6);}return BPromise[_0xeb1b('0x45')](_0x15e6e1);}})[_0xeb1b('0x1e')](function(_0x51c685){logger[_0xeb1b('0x46')]('[CmContact][afterDestroy][Succesfull]',util[_0xeb1b('0x2d')](_0x51c685,{'showHidden':![],'depth':null}));_0xe0dc8b();})[_0xeb1b('0x27')](function(_0xff3479){logger['error']('[CmContact][afterDestroy][Error]',util[_0xeb1b('0x2d')](_0xff3479,{'showHidden':![],'depth':null}));_0xe0dc8b(_0xff3479);});}}});}; \ No newline at end of file +var _0x27eb=['cmContact,\x20%s,\x20%s','isEmpty','VoiceQueueId','CampaignId','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','Campaign','minutes','\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','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','onlyIfOpen','CmHopperBlack','message','length','BlackLists'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x27eb,0x1cf));var _0xb27e=function(_0x366762,_0x4d20c7){_0x366762=_0x366762-0x0;var _0x469d3e=_0x27eb[_0x366762];return _0x469d3e;};'use strict';var _=require(_0xb27e('0x0'));var util=require(_0xb27e('0x1'));var logger=require(_0xb27e('0x2'))(_0xb27e('0x3'));var moment=require(_0xb27e('0x4'));var BPromise=require(_0xb27e('0x5'));var rp=require(_0xb27e('0x6'));var fs=require('fs');var path=require(_0xb27e('0x7'));var rimraf=require(_0xb27e('0x8'));var config=require(_0xb27e('0x9'));var shared=require('../../config/environment/shared');var attributes=require(_0xb27e('0xa'));module[_0xb27e('0xb')]=function(_0x596c4b,_0xc9dfb1){return _0x596c4b[_0xb27e('0xc')](_0xb27e('0xd'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xb27e('0xe'),'fields':[_0xb27e('0xe')]},{'name':_0xb27e('0xf'),'fields':[_0xb27e('0x10'),_0xb27e('0x11'),_0xb27e('0xe'),_0xb27e('0x12'),_0xb27e('0x13'),_0xb27e('0x14')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xb27e('0x15'),'collate':_0xb27e('0x16'),'hooks':{'afterCreate':function(_0x1fe55d,_0x181ae6,_0x17dabf){var _0x509dc4=_0x596c4b[_0xb27e('0x17')];var _0x4ec8d1=_0x1fe55d['get']({'plain':!![]});function _0x2e5617(){return function(_0x2e4176){logger[_0xb27e('0x18')](_0xb27e('0x19'),_0xb27e('0x1a'),util[_0xb27e('0x1b')](_0x2e4176,{'showHidden':![],'depth':null}));};}function _0x4151c(_0x29ee4e,_0x2ff5e4){var _0x33cf59=_0x2ff5e4[_0xb27e('0x1c')]?_0x2ff5e4[_0xb27e('0x1c')]:moment()[_0xb27e('0x1d')](_0xb27e('0x1e'));return new BPromise(function(_0x37ec69,_0xc66866){if(_[_0xb27e('0x1f')](_0x2ff5e4[_0xb27e('0x20')])){_0x37ec69({'ret':_0x33cf59});}else{_0x509dc4[_0xb27e('0x21')][_0xb27e('0x22')]({'where':{'id':_0x29ee4e['id']}})[_0xb27e('0x23')](function(_0x4220d3){if(!_['isNil'](_0x4220d3)){var _0x113c85=_0x4220d3[_0xb27e('0x20')];if(!_['isNil'](_0x113c85)){var _0x4a8734=shared[_0xb27e('0x24')];var _0x5a71e5=_0x4a8734[_0x113c85];var _0x515cad=_0x4a8734[_0x2ff5e4[_0xb27e('0x20')]];if(!_['isNil'](_0x5a71e5)&&!_[_0xb27e('0x1f')](_0x515cad)){var _0x532e4f=_0x5a71e5[_0xb27e('0x25')]-_0x515cad[_0xb27e('0x25')];_0x33cf59=_0x2ff5e4[_0xb27e('0x1c')]?_0x2ff5e4[_0xb27e('0x1c')]:moment();var _0x21c404=moment(_0x33cf59)[_0xb27e('0x26')](_0x532e4f,'minutes');_0x37ec69({'ret':_0x21c404[_0xb27e('0x1d')](_0xb27e('0x1e'))});}else _0x37ec69({'ret':_0x33cf59});}else _0x37ec69({'ret':_0x33cf59});}else{_0x37ec69({'ret':_0x33cf59});}});}});return 0xa;}var _0xef9d08=function(_0x1dd48c){return new BPromise(function(_0x19569b,_0x47e5ec){_0x4151c(_0x1dd48c,_0x4ec8d1)[_0xb27e('0x23')](function(_0x309baf){_0x4ec8d1[_0xb27e('0x1c')]=_0x309baf['ret'];_0x509dc4[_0xb27e('0x27')][_0xb27e('0x22')]({'where':{'phone':_0x4ec8d1[_0xb27e('0xe')],'VoiceQueueId':_0x1dd48c['id']}})[_0xb27e('0x23')](function(_0x54d8dd){if(!_[_0xb27e('0x1f')](_0x54d8dd)){throw new Error(_0xb27e('0x28')+_0x4ec8d1[_0xb27e('0xe')]+_0xb27e('0x29')+_0x1dd48c['id']);}return _0x509dc4['CmHopper'][_0xb27e('0x2a')]({'phone':_0x4ec8d1[_0xb27e('0xe')],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1['ListId'],'priority':_0x4ec8d1[_0xb27e('0x2b')]?_0x4ec8d1[_0xb27e('0x2b')]:0x2,'scheduledat':_0x4ec8d1['scheduledat']?_0x4ec8d1[_0xb27e('0x1c')]:moment()[_0xb27e('0x1d')](_0xb27e('0x1e')),'callback':_0x4ec8d1[_0xb27e('0x2c')]?!![]:![],'callbackuniqueid':_0x4ec8d1['callbackUniqueid']?_0x4ec8d1[_0xb27e('0x2c')]:undefined,'callbackat':_0x4ec8d1[_0xb27e('0x2c')]?moment()['format'](_0xb27e('0x1e')):undefined,'VoiceQueueId':_0x1dd48c['id']});})[_0xb27e('0x2d')](function(_0x389406){_0x47e5ec(_0x389406);});});});};var _0x5c7342=function(_0x5b35d9){return new BPromise(function(_0x4d08e3,_0x55ce66){_0x4151c(_0x5b35d9,_0x4ec8d1)[_0xb27e('0x23')](function(_0x196fee){_0x4ec8d1[_0xb27e('0x1c')]=_0x196fee[_0xb27e('0x2e')];_0x509dc4[_0xb27e('0x27')][_0xb27e('0x22')]({'where':{'phone':_0x4ec8d1[_0xb27e('0xe')],'VoiceQueueId':_0x5b35d9['id']}})[_0xb27e('0x23')](function(_0x288093){if(!_[_0xb27e('0x1f')](_0x288093)){throw new Error(_0xb27e('0x28')+_0x4ec8d1[_0xb27e('0xe')]+_0xb27e('0x2f')+_0x5b35d9['id']);}return _0x509dc4[_0xb27e('0x30')]['findOne']({'where':{'calleridnum':_0x4ec8d1['phone'],'VoiceQueueId':_0x5b35d9['id']}});})['then'](function(_0x1a90ce){if(!_[_0xb27e('0x1f')](_0x1a90ce)){throw new Error(_0xb27e('0x31')+_0x4ec8d1[_0xb27e('0xe')]+_0xb27e('0x32')+_0x5b35d9['id']);}return _0x509dc4['CmHopper']['create']({'phone':_0x4ec8d1[_0xb27e('0xe')],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1[_0xb27e('0x33')],'priority':_0x4ec8d1[_0xb27e('0x2b')]?_0x4ec8d1[_0xb27e('0x2b')]:0x2,'scheduledat':_0x4ec8d1['scheduledat']?_0x4ec8d1['scheduledat']:moment()[_0xb27e('0x1d')](_0xb27e('0x1e')),'callback':_0x4ec8d1[_0xb27e('0x2c')]?!![]:![],'callbackuniqueid':_0x4ec8d1[_0xb27e('0x2c')]?_0x4ec8d1[_0xb27e('0x2c')]:undefined,'callbackat':_0x4ec8d1[_0xb27e('0x2c')]?moment()[_0xb27e('0x1d')](_0xb27e('0x1e')):undefined,'VoiceQueueId':_0x5b35d9['id']});})[_0xb27e('0x2d')](function(_0x5df028){_0x55ce66(_0x5df028);});});});};function _0x42d6c8(){return function(_0x23669f){logger[_0xb27e('0x18')](_0xb27e('0x19'),_0xb27e('0x1a'),util[_0xb27e('0x1b')](_0x23669f,{'showHidden':![],'depth':null}));};}function _0x572e40(_0x1a3197,_0x6f6e6d){var _0x251355=_0x6f6e6d['scheduledat']?_0x6f6e6d[_0xb27e('0x1c')]:moment()['format'](_0xb27e('0x1e'));return new BPromise(function(_0x4763b7,_0x48a30c){if(_[_0xb27e('0x1f')](_0x6f6e6d[_0xb27e('0x20')])){_0x4763b7({'ret':_0x251355});}else{_0x509dc4[_0xb27e('0x34')]['findOne']({'where':{'id':_0x1a3197['id']}})['then'](function(_0x40e430){if(!_[_0xb27e('0x1f')](_0x40e430)){var _0x43262d=_0x40e430['dialTimezone'];if(!_['isNil'](_0x43262d)){var _0x2c01a9=shared[_0xb27e('0x24')];var _0x5a6af5=_0x2c01a9[_0x43262d];var _0x4b7ddd=_0x2c01a9[_0x6f6e6d[_0xb27e('0x20')]];if(!_['isNil'](_0x5a6af5)&&!_['isNil'](_0x4b7ddd)){var _0x2c507d=_0x5a6af5[_0xb27e('0x25')]-_0x4b7ddd[_0xb27e('0x25')];_0x251355=_0x6f6e6d['scheduledat']?_0x6f6e6d[_0xb27e('0x1c')]:moment();var _0x5d2025=moment(_0x251355)[_0xb27e('0x26')](_0x2c507d,_0xb27e('0x35'));_0x4763b7({'ret':_0x5d2025[_0xb27e('0x1d')](_0xb27e('0x1e'))});}else _0x4763b7({'ret':_0x251355});}else _0x4763b7({'ret':_0x251355});}else{_0x4763b7({'ret':_0x251355});}});}});return 0xa;}var _0x3fa0d1=function(_0x73a31){return new BPromise(function(_0x77e417,_0x462757){_0x572e40(_0x73a31,_0x4ec8d1)['then'](function(_0x3c95eb){_0x4ec8d1[_0xb27e('0x1c')]=_0x3c95eb[_0xb27e('0x2e')];_0x509dc4[_0xb27e('0x27')][_0xb27e('0x22')]({'where':{'phone':_0x4ec8d1[_0xb27e('0xe')],'CampaignId':_0x73a31['id']}})['then'](function(_0x8ef393){if(!_[_0xb27e('0x1f')](_0x8ef393)){throw new Error(_0xb27e('0x28')+_0x4ec8d1[_0xb27e('0xe')]+_0xb27e('0x36')+_0x73a31['id']);}return _0x509dc4[_0xb27e('0x27')][_0xb27e('0x2a')]({'phone':_0x4ec8d1[_0xb27e('0xe')],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1[_0xb27e('0x33')],'priority':_0x4ec8d1[_0xb27e('0x2b')]?_0x4ec8d1[_0xb27e('0x2b')]:0x2,'scheduledat':_0x4ec8d1['scheduledat']?_0x4ec8d1[_0xb27e('0x1c')]:moment()[_0xb27e('0x1d')](_0xb27e('0x1e')),'callback':_0x4ec8d1[_0xb27e('0x2c')]?!![]:![],'callbackuniqueid':_0x4ec8d1[_0xb27e('0x2c')]?_0x4ec8d1['callbackUniqueid']:undefined,'callbackat':_0x4ec8d1[_0xb27e('0x2c')]?moment()[_0xb27e('0x1d')](_0xb27e('0x1e')):undefined,'CampaignId':_0x73a31['id']});})[_0xb27e('0x2d')](function(_0x4665eb){_0x462757(_0x4665eb);});});});};var _0x5db81c=function(_0x5e0400){return new BPromise(function(_0x286a61,_0x5c332a){_0x572e40(_0x5e0400,_0x4ec8d1)[_0xb27e('0x23')](function(_0x224f30){_0x4ec8d1['scheduledat']=_0x224f30[_0xb27e('0x2e')];_0x509dc4[_0xb27e('0x27')]['findOne']({'where':{'phone':_0x4ec8d1[_0xb27e('0xe')],'CampaignId':_0x5e0400['id']}})[_0xb27e('0x23')](function(_0x5c0098){if(!_[_0xb27e('0x1f')](_0x5c0098)){throw new Error(_0xb27e('0x28')+_0x4ec8d1['phone']+_0xb27e('0x37')+_0x5e0400['id']);}return _0x509dc4[_0xb27e('0x30')][_0xb27e('0x22')]({'where':{'calleridnum':_0x4ec8d1[_0xb27e('0xe')],'CampaignId':_0x5e0400['id']}});})[_0xb27e('0x23')](function(_0x5c2047){if(!_[_0xb27e('0x1f')](_0x5c2047)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4ec8d1[_0xb27e('0xe')]+_0xb27e('0x38')+_0x5e0400['id']);}return _0x509dc4[_0xb27e('0x27')][_0xb27e('0x2a')]({'phone':_0x4ec8d1[_0xb27e('0xe')],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1[_0xb27e('0x33')],'priority':_0x4ec8d1[_0xb27e('0x2b')]?_0x4ec8d1[_0xb27e('0x2b')]:0x2,'scheduledat':_0x4ec8d1['scheduledat']?_0x4ec8d1['scheduledat']:moment()[_0xb27e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4ec8d1[_0xb27e('0x2c')]?!![]:![],'callbackuniqueid':_0x4ec8d1['callbackUniqueid']?_0x4ec8d1[_0xb27e('0x2c')]:undefined,'callbackat':_0x4ec8d1['callbackUniqueid']?moment()[_0xb27e('0x1d')](_0xb27e('0x1e')):undefined,'CampaignId':_0x5e0400['id']});})[_0xb27e('0x2d')](function(_0x23ad1f){_0x5c332a(_0x23ad1f);});});});};if(_0x4ec8d1[_0xb27e('0x33')]){_0x509dc4[_0xb27e('0x21')][_0xb27e('0x39')]({'where':{'type':_0xb27e('0x3a')},'attributes':['id',_0xb27e('0x3b'),_0xb27e('0x20')],'include':[{'model':_0x509dc4[_0xb27e('0x3c')],'as':_0xb27e('0x3d'),'where':{'id':_0x4ec8d1[_0xb27e('0x33')]}}]})['then'](function(_0xf34ea2){if(_0xf34ea2){var _0x3a28ec=[];for(var _0x910089=0x0,_0x4c913b;_0x910089<_0xf34ea2['length'];_0x910089+=0x1){_0x4c913b=_0xf34ea2[_0x910089][_0xb27e('0x3e')]({'plain':!![]});switch(_0x4c913b[_0xb27e('0x3b')]){case _0xb27e('0x3f'):_0x5c7342(_0x4c913b)[_0xb27e('0x2d')](_0x2e5617());break;case _0xb27e('0x40'):_0xef9d08(_0x4c913b)['catch'](_0x2e5617());break;default:_0x572e40(_0x4c913b,_0x4ec8d1)[_0xb27e('0x23')](function(_0x26192f){_0x4ec8d1[_0xb27e('0x1c')]=_0x26192f[_0xb27e('0x2e')];_0x509dc4['CmHopper'][_0xb27e('0x2a')]({'phone':_0x4ec8d1[_0xb27e('0xe')],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1[_0xb27e('0x33')],'scheduledat':_0x4ec8d1['scheduledat']?_0x4ec8d1[_0xb27e('0x1c')]:moment()[_0xb27e('0x1d')](_0xb27e('0x1e')),'priority':_0x4ec8d1[_0xb27e('0x2b')]?_0x4ec8d1[_0xb27e('0x2b')]:0x2,'callback':_0x4ec8d1[_0xb27e('0x2c')]?!![]:![],'callbackuniqueid':_0x4ec8d1[_0xb27e('0x2c')]?_0x4ec8d1[_0xb27e('0x2c')]:undefined,'callbackat':_0x4ec8d1[_0xb27e('0x2c')]?moment()[_0xb27e('0x1d')](_0xb27e('0x1e')):undefined,'VoiceQueueId':_0x4c913b['id']})[_0xb27e('0x2d')](_0x2e5617());});}}}})[_0xb27e('0x23')](function(){return _0x509dc4[_0xb27e('0x21')]['findAll']({'where':{'type':_0xb27e('0x3a')},'attributes':['id'],'include':[{'model':_0x509dc4[_0xb27e('0x3c')],'as':'BlackLists','where':{'id':_0x4ec8d1[_0xb27e('0x33')]}}]})[_0xb27e('0x23')](function(_0x136a83){if(_0x136a83){var _0x300a68=[];for(var _0x29b418=0x0,_0x1c3150;_0x29b418<_0x136a83['length'];_0x29b418+=0x1){_0x1c3150=_0x136a83[_0x29b418]['get']({'plain':!![]});_0x509dc4[_0xb27e('0x41')]['create']({'phone':_0x4ec8d1[_0xb27e('0xe')],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1[_0xb27e('0x33')],'VoiceQueueId':_0x1c3150['id']})[_0xb27e('0x2d')](function(_0x43b1df){logger[_0xb27e('0x18')]('cmContact,\x20%s,\x20%s',_0xb27e('0x1a'),_0x43b1df[_0xb27e('0x42')]);});}}});})['then'](function(){return _0x509dc4[_0xb27e('0x34')][_0xb27e('0x39')]({'attributes':['id','dialCheckDuplicateType',_0xb27e('0x20')],'include':[{'model':_0x509dc4['CmList'],'as':_0xb27e('0x3d'),'where':{'id':_0x4ec8d1[_0xb27e('0x33')]}}]})['then'](function(_0x10cd40){if(_0x10cd40){var _0x5ab1e4=[];for(var _0x47e217=0x0,_0x315388;_0x47e217<_0x10cd40[_0xb27e('0x43')];_0x47e217+=0x1){_0x315388=_0x10cd40[_0x47e217][_0xb27e('0x3e')]({'plain':!![]});switch(_0x315388[_0xb27e('0x3b')]){case'always':_0x5db81c(_0x315388)[_0xb27e('0x2d')](_0x42d6c8());break;case _0xb27e('0x40'):_0x3fa0d1(_0x315388)[_0xb27e('0x2d')](_0x42d6c8());break;default:_0x509dc4[_0xb27e('0x27')]['create']({'phone':_0x4ec8d1[_0xb27e('0xe')],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1[_0xb27e('0x33')],'scheduledat':_0x4ec8d1['scheduledat']?_0x4ec8d1['scheduledat']:moment()[_0xb27e('0x1d')](_0xb27e('0x1e')),'priority':_0x4ec8d1[_0xb27e('0x2b')]?_0x4ec8d1[_0xb27e('0x2b')]:0x2,'callback':_0x4ec8d1[_0xb27e('0x2c')]?!![]:![],'callbackuniqueid':_0x4ec8d1[_0xb27e('0x2c')]?_0x4ec8d1[_0xb27e('0x2c')]:undefined,'callbackat':_0x4ec8d1[_0xb27e('0x2c')]?moment()[_0xb27e('0x1d')](_0xb27e('0x1e')):undefined,'CampaignId':_0x315388['id']})['catch'](_0x42d6c8());}}}});})[_0xb27e('0x23')](function(){return _0x509dc4[_0xb27e('0x34')][_0xb27e('0x39')]({'attributes':['id'],'include':[{'model':_0x509dc4['CmList'],'as':_0xb27e('0x44'),'where':{'id':_0x4ec8d1[_0xb27e('0x33')]}}]})['then'](function(_0x1a185f){if(_0x1a185f){var _0x560608=[];for(var _0x30e0fe=0x0,_0x2c9fa4;_0x30e0fe<_0x1a185f[_0xb27e('0x43')];_0x30e0fe+=0x1){_0x2c9fa4=_0x1a185f[_0x30e0fe]['get']({'plain':!![]});_0x509dc4[_0xb27e('0x41')][_0xb27e('0x2a')]({'phone':_0x4ec8d1['phone'],'ContactId':_0x4ec8d1['id'],'ListId':_0x4ec8d1[_0xb27e('0x33')],'CampaignId':_0x2c9fa4['id']})[_0xb27e('0x2d')](function(_0x22208a){logger['error'](_0xb27e('0x45'),_0xb27e('0x1a'),_0x22208a[_0xb27e('0x42')]);});}}});})[_0xb27e('0x23')](function(){_0x17dabf();})[_0xb27e('0x2d')](function(_0x39a65a){logger[_0xb27e('0x18')](_0xb27e('0x45'),'afterCreate',_0x39a65a[_0xb27e('0x42')]);_0x17dabf(_0x39a65a);});}else{_0x17dabf(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x46fc35,_0x179dd9,_0x18ab9a){var _0x1d4976=_0x596c4b[_0xb27e('0x17')];var _0x2b08a5=_0x46fc35['get']({'plain':!![]});return _0x1d4976['CmHopper'][_0xb27e('0x39')]({'raw':!![],'where':{'ListId':_0x2b08a5[_0xb27e('0x33')],'ContactId':_0x2b08a5['id']}})[_0xb27e('0x23')](function(_0x2111cc){if(!_[_0xb27e('0x46')](_0x2111cc)){var _0x26c1c3=[];for(var _0x4bb7dc=0x0;_0x4bb7dc<_0x2111cc[_0xb27e('0x43')];_0x4bb7dc+=0x1){var _0x16ae1f=_0x1d4976[_0xb27e('0x27')]['destroy']({'where':{'ListId':_0x2111cc[_0x4bb7dc][_0xb27e('0x33')],'ContactId':_0x2111cc[_0x4bb7dc]['ContactId'],'VoiceQueueId':_0x2111cc[_0x4bb7dc][_0xb27e('0x47')],'CampaignId':_0x2111cc[_0x4bb7dc][_0xb27e('0x48')]}});_0x26c1c3['push'](_0x16ae1f);}return BPromise[_0xb27e('0x49')](_0x26c1c3);}})[_0xb27e('0x23')](function(_0x86bb17){logger['info'](_0xb27e('0x4a'),util[_0xb27e('0x1b')](_0x86bb17,{'showHidden':![],'depth':null}));_0x18ab9a();})[_0xb27e('0x2d')](function(_0x5b4d01){logger['error'](_0xb27e('0x4b'),util[_0xb27e('0x1b')](_0x5b4d01,{'showHidden':![],'depth':null}));_0x18ab9a(_0x5b4d01);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 29253a1..37ced10 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x3499c9,_0xc2ad65){var _0x3b6393=function(_0x16c436){while(--_0x16c436){_0x3499c9['push'](_0x3499c9['shift']());}};_0x3b6393(++_0xc2ad65);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x3db518,_0x3c614a){var _0x386f79=function(_0x30d0b7){while(--_0x30d0b7){_0x3db518['push'](_0x3db518['shift']());}};_0x386f79(++_0x3c614a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 b2f60a3..a9da79f 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 _0x136c=['PHONE','sequelize','exports','STRING','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x136c,0x1d2));var _0xc136=function(_0x240aaf,_0x2b8d86){_0x240aaf=_0x240aaf-0x0;var _0x280f83=_0x136c[_0x240aaf];return _0x280f83;};'use strict';var Sequelize=require(_0xc136('0x0'));module[_0xc136('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xc136('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc136('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc136('0x2')],'defaultValue':_0xc136('0x4')},'OrderBy':{'type':Sequelize[_0xc136('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xc136('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x559a=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0xd8d33f,_0x582115){var _0x888f89=function(_0x5a5e43){while(--_0x5a5e43){_0xd8d33f['push'](_0xd8d33f['shift']());}};_0x888f89(++_0x582115);}(_0x559a,0xb3));var _0xa559=function(_0x2a451d,_0x13044e){_0x2a451d=_0x2a451d-0x0;var _0x51069e=_0x559a[_0x2a451d];return _0x51069e;};'use strict';var Sequelize=require(_0xa559('0x0'));module[_0xa559('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa559('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa559('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa559('0x2')],'defaultValue':_0xa559('0x4')},'OrderBy':{'type':Sequelize[_0xa559('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xa559('0x2')],'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 3487e79..c96d508 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 _0xc82b=['user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','catch','show','params','merge','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0xc82b,0x154));var _0xbc82=function(_0x4d79de,_0x2316df){_0x4d79de=_0x4d79de-0x0;var _0x535b0b=_0xc82b[_0x4d79de];return _0x535b0b;};'use strict';var emlformat=require(_0xbc82('0x0'));var rimraf=require(_0xbc82('0x1'));var zipdir=require(_0xbc82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc82('0x3'));var moment=require(_0xbc82('0x4'));var BPromise=require(_0xbc82('0x5'));var Mustache=require('mustache');var util=require(_0xbc82('0x6'));var path=require(_0xbc82('0x7'));var sox=require(_0xbc82('0x8'));var csv=require(_0xbc82('0x9'));var ejs=require(_0xbc82('0xa'));var fs=require('fs');var fs_extra=require(_0xbc82('0xb'));var _=require(_0xbc82('0xc'));var squel=require(_0xbc82('0xd'));var crypto=require(_0xbc82('0xe'));var jsforce=require(_0xbc82('0xf'));var deskjs=require(_0xbc82('0x10'));var toCsv=require(_0xbc82('0x9'));var querystring=require(_0xbc82('0x11'));var Papa=require(_0xbc82('0x12'));var Redis=require(_0xbc82('0x13'));var authService=require(_0xbc82('0x14'));var qs=require(_0xbc82('0x15'));var as=require(_0xbc82('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbc82('0x17'));var utils=require(_0xbc82('0x18'));var config=require(_0xbc82('0x19'));var licenseUtil=require(_0xbc82('0x1a'));var db=require(_0xbc82('0x1b'))['db'];function respondWithStatusCode(_0x35929d,_0x316963){_0x316963=_0x316963||0xcc;return function(_0x46207d){if(_0x46207d){return _0x35929d[_0xbc82('0x1c')](_0x316963);}return _0x35929d[_0xbc82('0x1d')](_0x316963)[_0xbc82('0x1e')]();};}function respondWithResult(_0x546ee4,_0x244c1f){_0x244c1f=_0x244c1f||0xc8;return function(_0x4ea97c){if(_0x4ea97c){return _0x546ee4[_0xbc82('0x1d')](_0x244c1f)[_0xbc82('0x1f')](_0x4ea97c);}};}function respondWithFilteredResult(_0x22c46a,_0x2bb086){return function(_0x9800db){if(_0x9800db){var _0x116419=typeof _0x2bb086[_0xbc82('0x20')]==='undefined'&&typeof _0x2bb086[_0xbc82('0x21')]===_0xbc82('0x22');var _0x58a94d=_0x9800db[_0xbc82('0x23')];var _0x40821c=_0x116419?0x0:_0x2bb086[_0xbc82('0x20')];var _0x3e21bc=_0x116419?_0x9800db[_0xbc82('0x23')]:_0x2bb086[_0xbc82('0x20')]+_0x2bb086['limit'];var _0x62a765;if(_0x3e21bc>=_0x58a94d){_0x3e21bc=_0x58a94d;_0x62a765=0xc8;}else{_0x62a765=0xce;}_0x22c46a[_0xbc82('0x1d')](_0x62a765);return _0x22c46a[_0xbc82('0x24')]('Content-Range',_0x40821c+'-'+_0x3e21bc+'/'+_0x58a94d)[_0xbc82('0x1f')](_0x9800db);}return null;};}function patchUpdates(_0xfcc2b){return function(_0x4c57b7){try{jsonpatch[_0xbc82('0x25')](_0x4c57b7,_0xfcc2b,!![]);}catch(_0x246066){return BPromise['reject'](_0x246066);}return _0x4c57b7['save']();};}function saveUpdates(_0x1e07fe,_0x450811){return function(_0x170ee8){if(_0x170ee8){return _0x170ee8[_0xbc82('0x26')](_0x1e07fe)[_0xbc82('0x27')](function(_0x396d2f){return _0x396d2f;});}return null;};}function removeEntity(_0x438a64,_0x32a9f7){return function(_0x2f58bc){if(_0x2f58bc){return _0x2f58bc[_0xbc82('0x28')]()[_0xbc82('0x27')](function(){var _0x4c4ca5=_0x2f58bc['get']({'plain':!![]});var _0x39761a=_0xbc82('0x29');return db[_0xbc82('0x2a')][_0xbc82('0x28')]({'where':{'type':_0x39761a,'resourceId':_0x4c4ca5['id']}})['then'](function(){return _0x2f58bc;});})[_0xbc82('0x27')](function(){_0x438a64[_0xbc82('0x1d')](0xcc)[_0xbc82('0x1e')]();});}};}function handleEntityNotFound(_0x895075,_0x53e237){return function(_0x3796c1){if(!_0x3796c1){_0x895075[_0xbc82('0x1c')](0x194);}return _0x3796c1;};}function handleError(_0x4b2f53,_0x53b461){_0x53b461=_0x53b461||0x1f4;return function(_0x25c574){logger[_0xbc82('0x2b')](_0x25c574[_0xbc82('0x2c')]);if(_0x25c574[_0xbc82('0x2d')]){delete _0x25c574[_0xbc82('0x2d')];}_0x4b2f53[_0xbc82('0x1d')](_0x53b461)[_0xbc82('0x2e')](_0x25c574);};}exports[_0xbc82('0x2f')]=function(_0xeb8cc5,_0xc3f8e6){var _0x548f47={},_0x3a973d={},_0x18edbd={'count':0x0,'rows':[]};var _0x2dd401=_[_0xbc82('0x30')](db[_0xbc82('0x31')][_0xbc82('0x32')],function(_0x19d400){return{'name':_0x19d400['fieldName'],'type':_0x19d400[_0xbc82('0x33')][_0xbc82('0x34')]};});_0x3a973d['model']=_[_0xbc82('0x30')](_0x2dd401,_0xbc82('0x2d'));_0x3a973d[_0xbc82('0x35')]=_[_0xbc82('0x36')](_0xeb8cc5[_0xbc82('0x35')]);_0x3a973d['filters']=_[_0xbc82('0x37')](_0x3a973d[_0xbc82('0x38')],_0x3a973d[_0xbc82('0x35')]);_0x548f47['attributes']=_[_0xbc82('0x37')](_0x3a973d[_0xbc82('0x38')],qs[_0xbc82('0x39')](_0xeb8cc5[_0xbc82('0x35')][_0xbc82('0x39')]));_0x548f47[_0xbc82('0x3a')]=_0x548f47[_0xbc82('0x3a')][_0xbc82('0x3b')]?_0x548f47[_0xbc82('0x3a')]:_0x3a973d['model'];if(!_0xeb8cc5['query'][_0xbc82('0x3c')](_0xbc82('0x3d'))){_0x548f47[_0xbc82('0x21')]=qs['limit'](_0xeb8cc5[_0xbc82('0x35')][_0xbc82('0x21')]);_0x548f47['offset']=qs[_0xbc82('0x20')](_0xeb8cc5[_0xbc82('0x35')][_0xbc82('0x20')]);}_0x548f47['order']=qs[_0xbc82('0x3e')](_0xeb8cc5['query']['sort']);_0x548f47[_0xbc82('0x3f')]=qs[_0xbc82('0x40')](_[_0xbc82('0x41')](_0xeb8cc5[_0xbc82('0x35')],_0x3a973d[_0xbc82('0x40')]),_0x2dd401);if(_0xeb8cc5[_0xbc82('0x35')][_0xbc82('0x42')]){_0x548f47['where']=_['merge'](_0x548f47[_0xbc82('0x3f')],{'$or':_[_0xbc82('0x30')](_0x2dd401,function(_0x2ec2bf){if(_0x2ec2bf[_0xbc82('0x33')]!==_0xbc82('0x43')){var _0x349818={};_0x349818[_0x2ec2bf['name']]={'$like':'%'+_0xeb8cc5[_0xbc82('0x35')][_0xbc82('0x42')]+'%'};return _0x349818;}})});}_0x548f47=_['merge']({},_0x548f47,_0xeb8cc5['options']);var _0x45abc1={'where':_0x548f47['where']};return db['CmContactHasItem'][_0xbc82('0x23')](_0x45abc1)[_0xbc82('0x27')](function(_0x4410b8){_0x18edbd['count']=_0x4410b8;if(_0xeb8cc5['query'][_0xbc82('0x44')]){_0x548f47[_0xbc82('0x45')]=[{'all':!![]}];}return db[_0xbc82('0x31')][_0xbc82('0x46')](_0x548f47);})[_0xbc82('0x27')](function(_0x59a9a8){_0x18edbd['rows']=_0x59a9a8;return _0x18edbd;})[_0xbc82('0x27')](respondWithFilteredResult(_0xc3f8e6,_0x548f47))[_0xbc82('0x47')](handleError(_0xc3f8e6,null));};exports[_0xbc82('0x48')]=function(_0x2a3f0e,_0x436583){var _0x2a94ee={'raw':!![],'where':{'id':_0x2a3f0e[_0xbc82('0x49')]['id']}},_0x35d3b7={};_0x35d3b7[_0xbc82('0x38')]=_[_0xbc82('0x36')](db[_0xbc82('0x31')][_0xbc82('0x32')]);_0x35d3b7['query']=_[_0xbc82('0x36')](_0x2a3f0e[_0xbc82('0x35')]);_0x35d3b7['filters']=_['intersection'](_0x35d3b7[_0xbc82('0x38')],_0x35d3b7['query']);_0x2a94ee[_0xbc82('0x3a')]=_[_0xbc82('0x37')](_0x35d3b7[_0xbc82('0x38')],qs[_0xbc82('0x39')](_0x2a3f0e[_0xbc82('0x35')]['fields']));_0x2a94ee[_0xbc82('0x3a')]=_0x2a94ee['attributes']['length']?_0x2a94ee['attributes']:_0x35d3b7[_0xbc82('0x38')];if(_0x2a3f0e[_0xbc82('0x35')][_0xbc82('0x44')]){_0x2a94ee[_0xbc82('0x45')]=[{'all':!![]}];}_0x2a94ee=_[_0xbc82('0x4a')]({},_0x2a94ee,_0x2a3f0e['options']);return db[_0xbc82('0x31')]['find'](_0x2a94ee)[_0xbc82('0x27')](handleEntityNotFound(_0x436583,null))[_0xbc82('0x27')](respondWithResult(_0x436583,null))[_0xbc82('0x47')](handleError(_0x436583,null));};exports['create']=function(_0xb658c8,_0x37c2fb){return db[_0xbc82('0x31')][_0xbc82('0x4b')](_0xb658c8[_0xbc82('0x4c')],{})['then'](function(_0x50beac){var _0xe60fc0=_0xb658c8['user'][_0xbc82('0x4d')]({'plain':!![]});if(!_0xe60fc0)throw new Error(_0xbc82('0x4e'));if(_0xe60fc0[_0xbc82('0x4f')]===_0xbc82('0x50')){var _0x2d5bf9=_0x50beac[_0xbc82('0x4d')]({'plain':!![]});var _0x1cf55e=_0xbc82('0x29');return db['UserProfileSection'][_0xbc82('0x51')]({'where':{'name':_0x1cf55e,'userProfileId':_0xe60fc0[_0xbc82('0x52')]},'raw':!![]})['then'](function(_0x1253f2){if(_0x1253f2&&_0x1253f2['autoAssociation']===0x0){return db[_0xbc82('0x2a')][_0xbc82('0x4b')]({'name':_0x2d5bf9[_0xbc82('0x2d')],'resourceId':_0x2d5bf9['id'],'type':_0x1253f2[_0xbc82('0x2d')],'sectionId':_0x1253f2['id']},{})['then'](function(){return _0x50beac;});}else{return _0x50beac;}})['catch'](function(_0x53e02f){logger[_0xbc82('0x2b')](_0xbc82('0x53'),_0x53e02f);throw _0x53e02f;});}return _0x50beac;})[_0xbc82('0x27')](respondWithResult(_0x37c2fb,0xc9))[_0xbc82('0x47')](handleError(_0x37c2fb,null));};exports[_0xbc82('0x26')]=function(_0x22b7a8,_0x15ddc1){if(_0x22b7a8[_0xbc82('0x4c')]['id']){delete _0x22b7a8['body']['id'];}return db[_0xbc82('0x31')][_0xbc82('0x51')]({'where':{'id':_0x22b7a8[_0xbc82('0x49')]['id']}})[_0xbc82('0x27')](handleEntityNotFound(_0x15ddc1,null))[_0xbc82('0x27')](saveUpdates(_0x22b7a8[_0xbc82('0x4c')],null))[_0xbc82('0x27')](respondWithResult(_0x15ddc1,null))[_0xbc82('0x47')](handleError(_0x15ddc1,null));};exports[_0xbc82('0x28')]=function(_0x395102,_0x54a75f){return db[_0xbc82('0x31')][_0xbc82('0x51')]({'where':{'id':_0x395102[_0xbc82('0x49')]['id']}})['then'](handleEntityNotFound(_0x54a75f,null))[_0xbc82('0x27')](removeEntity(_0x54a75f,null))[_0xbc82('0x47')](handleError(_0x54a75f,null));}; \ No newline at end of file +var _0x9eeb=['hasOwnProperty','nolimit','where','filters','merge','type','name','filter','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','error','stack','send','index','CmContactHasItem','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9eeb,0x1a4));var _0xb9ee=function(_0x2338fc,_0x436a20){_0x2338fc=_0x2338fc-0x0;var _0x5bf77d=_0x9eeb[_0x2338fc];return _0x5bf77d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9ee('0x0'));var zipdir=require(_0xb9ee('0x1'));var jsonpatch=require(_0xb9ee('0x2'));var rp=require('request-promise');var moment=require(_0xb9ee('0x3'));var BPromise=require(_0xb9ee('0x4'));var Mustache=require(_0xb9ee('0x5'));var util=require('util');var path=require(_0xb9ee('0x6'));var sox=require(_0xb9ee('0x7'));var csv=require(_0xb9ee('0x8'));var ejs=require(_0xb9ee('0x9'));var fs=require('fs');var fs_extra=require(_0xb9ee('0xa'));var _=require(_0xb9ee('0xb'));var squel=require(_0xb9ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9ee('0xd'));var deskjs=require(_0xb9ee('0xe'));var toCsv=require(_0xb9ee('0x8'));var querystring=require(_0xb9ee('0xf'));var Papa=require('papaparse');var Redis=require(_0xb9ee('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb9ee('0x11'));var hardwareService=require(_0xb9ee('0x12'));var logger=require(_0xb9ee('0x13'))(_0xb9ee('0x14'));var utils=require('../../config/utils');var config=require(_0xb9ee('0x15'));var licenseUtil=require(_0xb9ee('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x654803,_0x31778e){_0x31778e=_0x31778e||0xcc;return function(_0x12aa35){if(_0x12aa35){return _0x654803[_0xb9ee('0x17')](_0x31778e);}return _0x654803[_0xb9ee('0x18')](_0x31778e)['end']();};}function respondWithResult(_0x5b8b3c,_0x50884b){_0x50884b=_0x50884b||0xc8;return function(_0x4983a0){if(_0x4983a0){return _0x5b8b3c['status'](_0x50884b)[_0xb9ee('0x19')](_0x4983a0);}};}function respondWithFilteredResult(_0x1b41d7,_0x1e4ea0){return function(_0x3ad853){if(_0x3ad853){var _0x2a5b13=typeof _0x1e4ea0[_0xb9ee('0x1a')]===_0xb9ee('0x1b')&&typeof _0x1e4ea0['limit']===_0xb9ee('0x1b');var _0x530a2e=_0x3ad853[_0xb9ee('0x1c')];var _0x32137f=_0x2a5b13?0x0:_0x1e4ea0[_0xb9ee('0x1a')];var _0x789c38=_0x2a5b13?_0x3ad853[_0xb9ee('0x1c')]:_0x1e4ea0[_0xb9ee('0x1a')]+_0x1e4ea0[_0xb9ee('0x1d')];var _0x978681;if(_0x789c38>=_0x530a2e){_0x789c38=_0x530a2e;_0x978681=0xc8;}else{_0x978681=0xce;}_0x1b41d7[_0xb9ee('0x18')](_0x978681);return _0x1b41d7[_0xb9ee('0x1e')](_0xb9ee('0x1f'),_0x32137f+'-'+_0x789c38+'/'+_0x530a2e)['json'](_0x3ad853);}return null;};}function patchUpdates(_0x126547){return function(_0x6515f0){try{jsonpatch[_0xb9ee('0x20')](_0x6515f0,_0x126547,!![]);}catch(_0x205c71){return BPromise[_0xb9ee('0x21')](_0x205c71);}return _0x6515f0[_0xb9ee('0x22')]();};}function saveUpdates(_0x56cbee,_0x29837d){return function(_0x5eba6a){if(_0x5eba6a){return _0x5eba6a[_0xb9ee('0x23')](_0x56cbee)[_0xb9ee('0x24')](function(_0x52056a){return _0x52056a;});}return null;};}function removeEntity(_0x11a0c2,_0x49bded){return function(_0xf1b795){if(_0xf1b795){return _0xf1b795[_0xb9ee('0x25')]()[_0xb9ee('0x24')](function(){var _0x4e3281=_0xf1b795['get']({'plain':!![]});var _0x11adf7=_0xb9ee('0x26');return db['UserProfileResource'][_0xb9ee('0x25')]({'where':{'type':_0x11adf7,'resourceId':_0x4e3281['id']}})[_0xb9ee('0x24')](function(){return _0xf1b795;});})[_0xb9ee('0x24')](function(){_0x11a0c2[_0xb9ee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8130,_0x49bee5){return function(_0x3ebe3d){if(!_0x3ebe3d){_0x1d8130[_0xb9ee('0x17')](0x194);}return _0x3ebe3d;};}function handleError(_0x5a9f1b,_0x1dc465){_0x1dc465=_0x1dc465||0x1f4;return function(_0x43d497){logger[_0xb9ee('0x27')](_0x43d497[_0xb9ee('0x28')]);if(_0x43d497['name']){delete _0x43d497['name'];}_0x5a9f1b[_0xb9ee('0x18')](_0x1dc465)[_0xb9ee('0x29')](_0x43d497);};}exports[_0xb9ee('0x2a')]=function(_0x1060fd,_0x4df701){var _0x2f8492={},_0x2061cc={},_0x398a3c={'count':0x0,'rows':[]};var _0x208430=_['map'](db[_0xb9ee('0x2b')][_0xb9ee('0x2c')],function(_0x2b0ccd){return{'name':_0x2b0ccd['fieldName'],'type':_0x2b0ccd['type'][_0xb9ee('0x2d')]};});_0x2061cc[_0xb9ee('0x2e')]=_[_0xb9ee('0x2f')](_0x208430,'name');_0x2061cc[_0xb9ee('0x30')]=_[_0xb9ee('0x31')](_0x1060fd[_0xb9ee('0x30')]);_0x2061cc['filters']=_[_0xb9ee('0x32')](_0x2061cc[_0xb9ee('0x2e')],_0x2061cc[_0xb9ee('0x30')]);_0x2f8492[_0xb9ee('0x33')]=_['intersection'](_0x2061cc[_0xb9ee('0x2e')],qs[_0xb9ee('0x34')](_0x1060fd[_0xb9ee('0x30')][_0xb9ee('0x34')]));_0x2f8492[_0xb9ee('0x33')]=_0x2f8492[_0xb9ee('0x33')][_0xb9ee('0x35')]?_0x2f8492[_0xb9ee('0x33')]:_0x2061cc[_0xb9ee('0x2e')];if(!_0x1060fd[_0xb9ee('0x30')][_0xb9ee('0x36')](_0xb9ee('0x37'))){_0x2f8492[_0xb9ee('0x1d')]=qs[_0xb9ee('0x1d')](_0x1060fd[_0xb9ee('0x30')]['limit']);_0x2f8492[_0xb9ee('0x1a')]=qs['offset'](_0x1060fd[_0xb9ee('0x30')]['offset']);}_0x2f8492['order']=qs['sort'](_0x1060fd[_0xb9ee('0x30')]['sort']);_0x2f8492[_0xb9ee('0x38')]=qs[_0xb9ee('0x39')](_['pick'](_0x1060fd[_0xb9ee('0x30')],_0x2061cc[_0xb9ee('0x39')]),_0x208430);if(_0x1060fd[_0xb9ee('0x30')]['filter']){_0x2f8492[_0xb9ee('0x38')]=_[_0xb9ee('0x3a')](_0x2f8492['where'],{'$or':_[_0xb9ee('0x2f')](_0x208430,function(_0x5f009a){if(_0x5f009a[_0xb9ee('0x3b')]!=='VIRTUAL'){var _0x1d867c={};_0x1d867c[_0x5f009a[_0xb9ee('0x3c')]]={'$like':'%'+_0x1060fd[_0xb9ee('0x30')][_0xb9ee('0x3d')]+'%'};return _0x1d867c;}})});}_0x2f8492=_[_0xb9ee('0x3a')]({},_0x2f8492,_0x1060fd['options']);var _0x1c4d56={'where':_0x2f8492[_0xb9ee('0x38')]};return db['CmContactHasItem']['count'](_0x1c4d56)[_0xb9ee('0x24')](function(_0x32c7f9){_0x398a3c[_0xb9ee('0x1c')]=_0x32c7f9;if(_0x1060fd[_0xb9ee('0x30')][_0xb9ee('0x3e')]){_0x2f8492[_0xb9ee('0x3f')]=[{'all':!![]}];}return db[_0xb9ee('0x2b')][_0xb9ee('0x40')](_0x2f8492);})[_0xb9ee('0x24')](function(_0x364a01){_0x398a3c[_0xb9ee('0x41')]=_0x364a01;return _0x398a3c;})[_0xb9ee('0x24')](respondWithFilteredResult(_0x4df701,_0x2f8492))['catch'](handleError(_0x4df701,null));};exports[_0xb9ee('0x42')]=function(_0x447e6a,_0x5a7262){var _0x206f90={'raw':!![],'where':{'id':_0x447e6a[_0xb9ee('0x43')]['id']}},_0x3cae33={};_0x3cae33[_0xb9ee('0x2e')]=_[_0xb9ee('0x31')](db[_0xb9ee('0x2b')]['rawAttributes']);_0x3cae33[_0xb9ee('0x30')]=_[_0xb9ee('0x31')](_0x447e6a[_0xb9ee('0x30')]);_0x3cae33[_0xb9ee('0x39')]=_['intersection'](_0x3cae33[_0xb9ee('0x2e')],_0x3cae33[_0xb9ee('0x30')]);_0x206f90[_0xb9ee('0x33')]=_[_0xb9ee('0x32')](_0x3cae33[_0xb9ee('0x2e')],qs[_0xb9ee('0x34')](_0x447e6a['query']['fields']));_0x206f90['attributes']=_0x206f90[_0xb9ee('0x33')]['length']?_0x206f90[_0xb9ee('0x33')]:_0x3cae33[_0xb9ee('0x2e')];if(_0x447e6a[_0xb9ee('0x30')][_0xb9ee('0x3e')]){_0x206f90['include']=[{'all':!![]}];}_0x206f90=_['merge']({},_0x206f90,_0x447e6a['options']);return db[_0xb9ee('0x2b')][_0xb9ee('0x44')](_0x206f90)[_0xb9ee('0x24')](handleEntityNotFound(_0x5a7262,null))[_0xb9ee('0x24')](respondWithResult(_0x5a7262,null))[_0xb9ee('0x45')](handleError(_0x5a7262,null));};exports[_0xb9ee('0x46')]=function(_0x41a66e,_0x2080de){return db[_0xb9ee('0x2b')][_0xb9ee('0x46')](_0x41a66e[_0xb9ee('0x47')],{})['then'](function(_0x1e3901){var _0x499da1=_0x41a66e[_0xb9ee('0x48')]['get']({'plain':!![]});if(!_0x499da1)throw new Error(_0xb9ee('0x49'));if(_0x499da1['role']===_0xb9ee('0x48')){var _0x254a62=_0x1e3901[_0xb9ee('0x4a')]({'plain':!![]});var _0x66f729='CmContactHasItems';return db[_0xb9ee('0x4b')][_0xb9ee('0x44')]({'where':{'name':_0x66f729,'userProfileId':_0x499da1[_0xb9ee('0x4c')]},'raw':!![]})[_0xb9ee('0x24')](function(_0x461cec){if(_0x461cec&&_0x461cec[_0xb9ee('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x254a62['name'],'resourceId':_0x254a62['id'],'type':_0x461cec[_0xb9ee('0x3c')],'sectionId':_0x461cec['id']},{})['then'](function(){return _0x1e3901;});}else{return _0x1e3901;}})[_0xb9ee('0x45')](function(_0x51057d){logger[_0xb9ee('0x27')](_0xb9ee('0x4e'),_0x51057d);throw _0x51057d;});}return _0x1e3901;})[_0xb9ee('0x24')](respondWithResult(_0x2080de,0xc9))['catch'](handleError(_0x2080de,null));};exports[_0xb9ee('0x23')]=function(_0x3c83cc,_0x4b42e7){if(_0x3c83cc[_0xb9ee('0x47')]['id']){delete _0x3c83cc[_0xb9ee('0x47')]['id'];}return db['CmContactHasItem'][_0xb9ee('0x44')]({'where':{'id':_0x3c83cc['params']['id']}})[_0xb9ee('0x24')](handleEntityNotFound(_0x4b42e7,null))[_0xb9ee('0x24')](saveUpdates(_0x3c83cc[_0xb9ee('0x47')],null))[_0xb9ee('0x24')](respondWithResult(_0x4b42e7,null))[_0xb9ee('0x45')](handleError(_0x4b42e7,null));};exports['destroy']=function(_0x2313b8,_0x403005){return db[_0xb9ee('0x2b')][_0xb9ee('0x44')]({'where':{'id':_0x2313b8[_0xb9ee('0x43')]['id']}})[_0xb9ee('0x24')](handleEntityNotFound(_0x403005,null))['then'](removeEntity(_0x403005,null))[_0xb9ee('0x45')](handleError(_0x403005,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5145899..abc0b9b 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 _0xb356=['bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','../../config/logger','moment'];(function(_0x51834b,_0x184ddc){var _0x225db1=function(_0x1a9521){while(--_0x1a9521){_0x51834b['push'](_0x51834b['shift']());}};_0x225db1(++_0x184ddc);}(_0xb356,0x15d));var _0x6b35=function(_0x2e1441,_0x2f42fd){_0x2e1441=_0x2e1441-0x0;var _0x3be328=_0xb356[_0x2e1441];return _0x3be328;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6b35('0x0'))('api');var moment=require(_0x6b35('0x1'));var BPromise=require(_0x6b35('0x2'));var rp=require(_0x6b35('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b35('0x4'));var config=require(_0x6b35('0x5'));var attributes=require(_0x6b35('0x6'));module[_0x6b35('0x7')]=function(_0x464e61,_0x47c880){return _0x464e61['define'](_0x6b35('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2948=['request-promise','path','rimraf','./cmContactHasItem.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x347427,_0x1ec380){var _0x23bf81=function(_0x1b2ff4){while(--_0x1b2ff4){_0x347427['push'](_0x347427['shift']());}};_0x23bf81(++_0x1ec380);}(_0x2948,0xcb));var _0x8294=function(_0x21f984,_0x5b42d2){_0x21f984=_0x21f984-0x0;var _0xd85f08=_0x2948[_0x21f984];return _0xd85f08;};'use strict';var _=require(_0x8294('0x0'));var util=require(_0x8294('0x1'));var logger=require(_0x8294('0x2'))(_0x8294('0x3'));var moment=require(_0x8294('0x4'));var BPromise=require(_0x8294('0x5'));var rp=require(_0x8294('0x6'));var fs=require('fs');var path=require(_0x8294('0x7'));var rimraf=require(_0x8294('0x8'));var config=require('../../config/environment');var attributes=require(_0x8294('0x9'));module['exports']=function(_0x11c415,_0x26128c){return _0x11c415[_0x8294('0xa')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','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 73286c3..6e7f04a 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 _0xbb89=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20f1e1,_0x466702){var _0x1973db=function(_0x1e35d2){while(--_0x1e35d2){_0x20f1e1['push'](_0x20f1e1['shift']());}};_0x1973db(++_0x466702);}(_0xbb89,0x192));var _0x9bb8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbb89[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x9bb8('0x0'));var util=require(_0x9bb8('0x1'));var moment=require(_0x9bb8('0x2'));var BPromise=require(_0x9bb8('0x3'));var rs=require(_0x9bb8('0x4'));var fs=require('fs');var Redis=require(_0x9bb8('0x5'));var db=require(_0x9bb8('0x6'))['db'];var utils=require(_0x9bb8('0x7'));var logger=require(_0x9bb8('0x8'))(_0x9bb8('0x9'));var config=require(_0x9bb8('0xa'));var jayson=require(_0x9bb8('0xb'));var client=jayson[_0x9bb8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22bc4f,_0x26d45b,_0x1de166){return new BPromise(function(_0x5191a5,_0x429c88){return client[_0x9bb8('0xd')](_0x22bc4f,_0x1de166)[_0x9bb8('0xe')](function(_0x3d201a){logger[_0x9bb8('0xf')](_0x9bb8('0x10'),_0x26d45b,_0x9bb8('0x11'));logger[_0x9bb8('0x12')](_0x9bb8('0x13'),_0x26d45b,_0x9bb8('0x11'),JSON[_0x9bb8('0x14')](_0x3d201a));if(_0x3d201a['error']){if(_0x3d201a[_0x9bb8('0x15')][_0x9bb8('0x16')]===0x1f4){logger[_0x9bb8('0x15')](_0x9bb8('0x10'),_0x26d45b,_0x3d201a[_0x9bb8('0x15')][_0x9bb8('0x17')]);return _0x429c88(_0x3d201a[_0x9bb8('0x15')]['message']);}logger[_0x9bb8('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x26d45b,_0x3d201a[_0x9bb8('0x15')][_0x9bb8('0x17')]);return _0x5191a5(_0x3d201a[_0x9bb8('0x15')][_0x9bb8('0x17')]);}else{logger[_0x9bb8('0xf')](_0x9bb8('0x10'),_0x26d45b,_0x9bb8('0x11'));_0x5191a5(_0x3d201a['result'][_0x9bb8('0x17')]);}})[_0x9bb8('0x18')](function(_0x5bbec3){logger['error'](_0x9bb8('0x10'),_0x26d45b,_0x5bbec3);_0x429c88(_0x5bbec3);});});} \ No newline at end of file +var _0x61c3=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x1e09a1,_0x1c14f9){var _0x24ac77=function(_0x272fa1){while(--_0x272fa1){_0x1e09a1['push'](_0x1e09a1['shift']());}};_0x24ac77(++_0x1c14f9);}(_0x61c3,0xa6));var _0x361c=function(_0x3c1614,_0x413521){_0x3c1614=_0x3c1614-0x0;var _0x5d235f=_0x61c3[_0x3c1614];return _0x5d235f;};'use strict';var _=require(_0x361c('0x0'));var util=require(_0x361c('0x1'));var moment=require('moment');var BPromise=require(_0x361c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x361c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x361c('0x4'))('rpc');var config=require(_0x361c('0x5'));var jayson=require(_0x361c('0x6'));var client=jayson[_0x361c('0x7')][_0x361c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cc094,_0x34f2a7,_0x2ed62f){return new BPromise(function(_0x5b3d14,_0x597ba3){return client['request'](_0x5cc094,_0x2ed62f)['then'](function(_0xf46d93){logger[_0x361c('0x9')](_0x361c('0xa'),_0x34f2a7,_0x361c('0xb'));logger[_0x361c('0xc')](_0x361c('0xd'),_0x34f2a7,'request\x20sent',JSON[_0x361c('0xe')](_0xf46d93));if(_0xf46d93[_0x361c('0xf')]){if(_0xf46d93[_0x361c('0xf')][_0x361c('0x10')]===0x1f4){logger['error'](_0x361c('0xa'),_0x34f2a7,_0xf46d93[_0x361c('0xf')][_0x361c('0x11')]);return _0x597ba3(_0xf46d93[_0x361c('0xf')][_0x361c('0x11')]);}logger[_0x361c('0xf')](_0x361c('0xa'),_0x34f2a7,_0xf46d93['error']['message']);return _0x5b3d14(_0xf46d93['error'][_0x361c('0x11')]);}else{logger['info'](_0x361c('0xa'),_0x34f2a7,_0x361c('0xb'));_0x5b3d14(_0xf46d93[_0x361c('0x12')][_0x361c('0x11')]);}})[_0x361c('0x13')](function(_0x50cbad){logger['error'](_0x361c('0xa'),_0x34f2a7,_0x50cbad);_0x597ba3(_0x50cbad);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d71034e..55ce583 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 _0x7d13=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x48fff1,_0x50c537){var _0x127a1d=function(_0x2abe66){while(--_0x2abe66){_0x48fff1['push'](_0x48fff1['shift']());}};_0x127a1d(++_0x50c537);}(_0x7d13,0x6c));var _0x37d1=function(_0x362c9d,_0x3b8c08){_0x362c9d=_0x362c9d-0x0;var _0x2b3545=_0x7d13[_0x362c9d];return _0x2b3545;};'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('./cmContactHasItem.controller');router[_0x37d1('0x7')]('/',auth[_0x37d1('0x8')](),controller[_0x37d1('0x9')]);router[_0x37d1('0x7')]('/:id',auth[_0x37d1('0x8')](),controller[_0x37d1('0xa')]);router[_0x37d1('0xb')]('/',auth[_0x37d1('0x8')](),controller[_0x37d1('0xc')]);router[_0x37d1('0xd')](_0x37d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x37d1('0xf')](_0x37d1('0xe'),auth['isAuthenticated'](),controller[_0x37d1('0x10')]);module[_0x37d1('0x11')]=router; \ No newline at end of file +var _0xd63a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x437187,_0x2a9157){var _0x106ec8=function(_0x269d00){while(--_0x269d00){_0x437187['push'](_0x437187['shift']());}};_0x106ec8(++_0x2a9157);}(_0xd63a,0xed));var _0xad63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd63a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xad63('0x0'));var path=require(_0xad63('0x1'));var timeout=require(_0xad63('0x2'));var express=require(_0xad63('0x3'));var router=express[_0xad63('0x4')]();var fs_extra=require(_0xad63('0x5'));var auth=require(_0xad63('0x6'));var interaction=require(_0xad63('0x7'));var config=require('../../config/environment');var controller=require(_0xad63('0x8'));router[_0xad63('0x9')]('/',auth[_0xad63('0xa')](),controller[_0xad63('0xb')]);router[_0xad63('0x9')](_0xad63('0xc'),auth['isAuthenticated'](),controller[_0xad63('0xd')]);router[_0xad63('0xe')]('/',auth[_0xad63('0xa')](),controller[_0xad63('0xf')]);router[_0xad63('0x10')]('/:id',auth[_0xad63('0xa')](),controller[_0xad63('0x11')]);router[_0xad63('0x12')](_0xad63('0xc'),auth['isAuthenticated'](),controller[_0xad63('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index d09fb2a..aa53efe 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 _0x020b=['STRING','TEXT','long','type','select','parse','getDataValue','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','setDataValue','name'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x020b,0x125));var _0xb020=function(_0x2bc0ba,_0x520fef){_0x2bc0ba=_0x2bc0ba-0x0;var _0x2320df=_0x020b[_0x2bc0ba];return _0x2320df;};'use strict';var Sequelize=require(_0xb020('0x0'));var _=require(_0xb020('0x1'));module[_0xb020('0x2')]={'name':{'type':Sequelize[_0xb020('0x3')],'get':function(_0x1abc6e){return this['getDataValue'](_0xb020('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1c24b7){this[_0xb020('0x5')](_0xb020('0x4'),_0x1c24b7?_0x1c24b7:this['getDataValue'](_0xb020('0x6')));}},'type':{'type':Sequelize[_0xb020('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0xb020('0x8')](_0xb020('0x9')),'get':function(){if(this['getDataValue'](_0xb020('0xa'))===_0xb020('0xb')){return JSON[_0xb020('0xc')](this[_0xb020('0xd')](_0xb020('0xe')));}else{return this[_0xb020('0xd')](_0xb020('0xe'));}},'set':function(_0x3c7f06){if(Array[_0xb020('0xf')](_0x3c7f06)){this[_0xb020('0x5')](_0xb020('0xe'),JSON[_0xb020('0x10')](_0x3c7f06));}else{this[_0xb020('0x5')]('values',_0x3c7f06);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xb020('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xb020('0x12')](_0xb020('0x13'))}}; \ No newline at end of file +var _0x7b46=['values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','getDataValue','alias','setDataValue','TEXT','long','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b46,0x102));var _0x67b4=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x7b46[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require('sequelize');var _=require(_0x67b4('0x0'));module[_0x67b4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1d555b){return this[_0x67b4('0x2')](_0x67b4('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x148805){this[_0x67b4('0x4')](_0x67b4('0x3'),_0x148805?_0x148805:this[_0x67b4('0x2')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x67b4('0x5')](_0x67b4('0x6')),'get':function(){if(this[_0x67b4('0x2')](_0x67b4('0x7'))==='select'){return JSON['parse'](this[_0x67b4('0x2')](_0x67b4('0x8')));}else{return this[_0x67b4('0x2')](_0x67b4('0x8'));}},'set':function(_0x19c971){if(Array[_0x67b4('0x9')](_0x19c971)){this['setDataValue'](_0x67b4('0x8'),JSON[_0x67b4('0xa')](_0x19c971));}else{this['setDataValue'](_0x67b4('0x8'),_0x19c971);}}},'required':{'type':Sequelize[_0x67b4('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x67b4('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x67b4('0xc')](_0x67b4('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c95f45c..b614d9b 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 _0x4a99=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','name','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','rows','catch','show','params','include','options','find','update','body','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x519e5b,_0x4b0f3a){var _0xb320dd=function(_0xb793b5){while(--_0xb793b5){_0x519e5b['push'](_0x519e5b['shift']());}};_0xb320dd(++_0x4b0f3a);}(_0x4a99,0x9e));var _0x94a9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4a99[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x94a9('0x0'));var rimraf=require(_0x94a9('0x1'));var zipdir=require(_0x94a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94a9('0x3'));var BPromise=require(_0x94a9('0x4'));var Mustache=require(_0x94a9('0x5'));var util=require(_0x94a9('0x6'));var path=require('path');var sox=require(_0x94a9('0x7'));var csv=require(_0x94a9('0x8'));var ejs=require(_0x94a9('0x9'));var fs=require('fs');var fs_extra=require(_0x94a9('0xa'));var _=require(_0x94a9('0xb'));var squel=require(_0x94a9('0xc'));var crypto=require(_0x94a9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x94a9('0x8'));var querystring=require(_0x94a9('0xe'));var Papa=require(_0x94a9('0xf'));var Redis=require(_0x94a9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x94a9('0x11'));var as=require(_0x94a9('0x12'));var hardwareService=require(_0x94a9('0x13'));var logger=require(_0x94a9('0x14'))(_0x94a9('0x15'));var utils=require(_0x94a9('0x16'));var config=require(_0x94a9('0x17'));var licenseUtil=require(_0x94a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527663,_0x32ba5a){_0x32ba5a=_0x32ba5a||0xcc;return function(_0x2b6d78){if(_0x2b6d78){return _0x527663[_0x94a9('0x19')](_0x32ba5a);}return _0x527663[_0x94a9('0x1a')](_0x32ba5a)['end']();};}function respondWithResult(_0xc65951,_0x271593){_0x271593=_0x271593||0xc8;return function(_0x260603){if(_0x260603){return _0xc65951[_0x94a9('0x1a')](_0x271593)[_0x94a9('0x1b')](_0x260603);}};}function respondWithFilteredResult(_0x3ad6ed,_0x73a887){return function(_0x4cb7bd){if(_0x4cb7bd){var _0x4fcf8a=typeof _0x73a887[_0x94a9('0x1c')]===_0x94a9('0x1d')&&typeof _0x73a887[_0x94a9('0x1e')]===_0x94a9('0x1d');var _0x1ffa8d=_0x4cb7bd[_0x94a9('0x1f')];var _0x3f4e5c=_0x4fcf8a?0x0:_0x73a887['offset'];var _0xf3f2be=_0x4fcf8a?_0x4cb7bd[_0x94a9('0x1f')]:_0x73a887[_0x94a9('0x1c')]+_0x73a887[_0x94a9('0x1e')];var _0x1c7769;if(_0xf3f2be>=_0x1ffa8d){_0xf3f2be=_0x1ffa8d;_0x1c7769=0xc8;}else{_0x1c7769=0xce;}_0x3ad6ed['status'](_0x1c7769);return _0x3ad6ed[_0x94a9('0x20')](_0x94a9('0x21'),_0x3f4e5c+'-'+_0xf3f2be+'/'+_0x1ffa8d)[_0x94a9('0x1b')](_0x4cb7bd);}return null;};}function patchUpdates(_0x11d8c2){return function(_0x5ee43d){try{jsonpatch[_0x94a9('0x22')](_0x5ee43d,_0x11d8c2,!![]);}catch(_0x3c5343){return BPromise[_0x94a9('0x23')](_0x3c5343);}return _0x5ee43d[_0x94a9('0x24')]();};}function saveUpdates(_0x462382,_0x1670eb){return function(_0xcadd5b){if(_0xcadd5b){return _0xcadd5b['update'](_0x462382)[_0x94a9('0x25')](function(_0x8c905f){return _0x8c905f;});}return null;};}function removeEntity(_0x22aab1,_0x25fa2f){return function(_0xb90cdb){if(_0xb90cdb){return _0xb90cdb['destroy']()[_0x94a9('0x25')](function(){_0x22aab1[_0x94a9('0x1a')](0xcc)[_0x94a9('0x26')]();});}};}function handleEntityNotFound(_0x2a136c,_0x5a4d8e){return function(_0x42feca){if(!_0x42feca){_0x2a136c[_0x94a9('0x19')](0x194);}return _0x42feca;};}function handleError(_0x2a23cf,_0x1481ee){_0x1481ee=_0x1481ee||0x1f4;return function(_0x2dab7d){logger[_0x94a9('0x27')](_0x2dab7d['stack']);if(_0x2dab7d[_0x94a9('0x28')]){delete _0x2dab7d[_0x94a9('0x28')];}_0x2a23cf['status'](_0x1481ee)['send'](_0x2dab7d);};}exports[_0x94a9('0x29')]=function(_0x4fa1ee,_0x2eea0d){var _0xbe89f4={},_0x5a1e5f={},_0x3611db={'count':0x0,'rows':[]};var _0x20efef=_['map'](db[_0x94a9('0x2a')][_0x94a9('0x2b')],function(_0xfb20c0){return{'name':_0xfb20c0[_0x94a9('0x2c')],'type':_0xfb20c0[_0x94a9('0x2d')][_0x94a9('0x2e')]};});_0x5a1e5f[_0x94a9('0x2f')]=_[_0x94a9('0x30')](_['map'](_0x20efef,'name'),['name']);_0x5a1e5f[_0x94a9('0x31')]=_[_0x94a9('0x32')](_0x4fa1ee['query']);_0x5a1e5f[_0x94a9('0x33')]=_[_0x94a9('0x34')](_0x5a1e5f[_0x94a9('0x2f')],_0x5a1e5f[_0x94a9('0x31')]);_0xbe89f4['attributes']=_['intersection'](_0x5a1e5f[_0x94a9('0x2f')],qs[_0x94a9('0x35')](_0x4fa1ee[_0x94a9('0x31')][_0x94a9('0x35')]));_0xbe89f4[_0x94a9('0x36')]=_0xbe89f4[_0x94a9('0x36')][_0x94a9('0x37')]?_0xbe89f4[_0x94a9('0x36')]:_0x5a1e5f[_0x94a9('0x2f')];if(!_0x4fa1ee[_0x94a9('0x31')][_0x94a9('0x38')](_0x94a9('0x39'))){_0xbe89f4[_0x94a9('0x1e')]=qs[_0x94a9('0x1e')](_0x4fa1ee['query']['limit']);_0xbe89f4[_0x94a9('0x1c')]=qs[_0x94a9('0x1c')](_0x4fa1ee[_0x94a9('0x31')][_0x94a9('0x1c')]);}_0xbe89f4[_0x94a9('0x3a')]=qs['sort'](_0x4fa1ee[_0x94a9('0x31')][_0x94a9('0x3b')]);_0xbe89f4['where']=qs[_0x94a9('0x33')](_[_0x94a9('0x3c')](_0x4fa1ee[_0x94a9('0x31')],_0x5a1e5f['filters']),_0x20efef);if(_0x4fa1ee[_0x94a9('0x31')][_0x94a9('0x3d')]){_0xbe89f4[_0x94a9('0x3e')]=_[_0x94a9('0x3f')](_0xbe89f4['where'],{'$or':_[_0x94a9('0x40')](_0x20efef,function(_0x5d0262){if(_0x5d0262[_0x94a9('0x2d')]!==_0x94a9('0x41')){var _0x2c5f71={};_0x2c5f71[_0x5d0262[_0x94a9('0x28')]]={'$like':'%'+_0x4fa1ee[_0x94a9('0x31')]['filter']+'%'};return _0x2c5f71;}})});}_0xbe89f4=_['merge']({},_0xbe89f4,_0x4fa1ee['options']);var _0x30680f={'where':_0xbe89f4[_0x94a9('0x3e')]};return db[_0x94a9('0x2a')][_0x94a9('0x1f')](_0x30680f)[_0x94a9('0x25')](function(_0x58d559){_0x3611db[_0x94a9('0x1f')]=_0x58d559;if(_0x4fa1ee['query']['includeAll']){_0xbe89f4['include']=[{'all':!![]}];}return db[_0x94a9('0x2a')]['findAll'](_0xbe89f4);})[_0x94a9('0x25')](function(_0xab7a9e){_0x3611db[_0x94a9('0x42')]=_0xab7a9e;return _0x3611db;})[_0x94a9('0x25')](respondWithFilteredResult(_0x2eea0d,_0xbe89f4))[_0x94a9('0x43')](handleError(_0x2eea0d,null));};exports[_0x94a9('0x44')]=function(_0x5a1efd,_0x30589b){var _0x2127bc={'raw':!![],'where':{'id':_0x5a1efd[_0x94a9('0x45')]['id']}},_0x4fa2f9={};_0x4fa2f9['model']=_['keys'](db[_0x94a9('0x2a')][_0x94a9('0x2b')]);_0x4fa2f9[_0x94a9('0x31')]=_[_0x94a9('0x32')](_0x5a1efd[_0x94a9('0x31')]);_0x4fa2f9[_0x94a9('0x33')]=_[_0x94a9('0x34')](_0x4fa2f9[_0x94a9('0x2f')],_0x4fa2f9[_0x94a9('0x31')]);_0x2127bc['attributes']=_[_0x94a9('0x34')](_0x4fa2f9[_0x94a9('0x2f')],qs[_0x94a9('0x35')](_0x5a1efd[_0x94a9('0x31')][_0x94a9('0x35')]));_0x2127bc[_0x94a9('0x36')]=_0x2127bc[_0x94a9('0x36')]['length']?_0x2127bc[_0x94a9('0x36')]:_0x4fa2f9[_0x94a9('0x2f')];if(_0x5a1efd[_0x94a9('0x31')]['includeAll']){_0x2127bc[_0x94a9('0x46')]=[{'all':!![]}];}_0x2127bc=_[_0x94a9('0x3f')]({},_0x2127bc,_0x5a1efd[_0x94a9('0x47')]);return db[_0x94a9('0x2a')][_0x94a9('0x48')](_0x2127bc)['then'](handleEntityNotFound(_0x30589b,null))['then'](respondWithResult(_0x30589b,null))['catch'](handleError(_0x30589b,null));};exports[_0x94a9('0x49')]=function(_0x50d08c,_0x5ab94c){if(_0x50d08c['body']['id']){delete _0x50d08c[_0x94a9('0x4a')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x50d08c['params']['id']}})[_0x94a9('0x25')](handleEntityNotFound(_0x5ab94c,null))['then'](saveUpdates(_0x50d08c['body'],null))[_0x94a9('0x25')](respondWithResult(_0x5ab94c,null))[_0x94a9('0x43')](handleError(_0x5ab94c,null));};exports['destroy']=function(_0x47a50b,_0x3a6b19){return db[_0x94a9('0x2a')][_0x94a9('0x48')]({'where':{'id':_0x47a50b[_0x94a9('0x45')]['id']}})[_0x94a9('0x25')](handleEntityNotFound(_0x3a6b19,null))['then'](removeEntity(_0x3a6b19,null))[_0x94a9('0x43')](handleError(_0x3a6b19,null));};exports['create']=function(_0x5ed9ca,_0x94593f){var _0x47ec1e;return db[_0x94a9('0x4b')][_0x94a9('0x4c')](function(_0x5a32f9){return db[_0x94a9('0x2a')][_0x94a9('0x4d')](_0x5ed9ca[_0x94a9('0x4a')],{'transaction':_0x5a32f9})[_0x94a9('0x25')](function(_0x1c0a25){_0x47ec1e=_0x1c0a25;var _0x2299a5={'type':db[_0x94a9('0x4e')][_0x94a9('0x4f')],'transaction':_0x5a32f9};switch(_0x5ed9ca[_0x94a9('0x4a')][_0x94a9('0x2d')]){case _0x94a9('0x50'):_0x2299a5[_0x94a9('0x2d')]=db[_0x94a9('0x4e')]['TEXT'];break;case _0x94a9('0x51'):_0x2299a5[_0x94a9('0x2d')]=db['Sequelize'][_0x94a9('0x52')];break;case _0x94a9('0x53'):_0x2299a5[_0x94a9('0x2d')]=db[_0x94a9('0x4e')][_0x94a9('0x54')];_0x2299a5['defaultValue']=![];break;default:}return db[_0x94a9('0x4b')][_0x94a9('0x55')][_0x94a9('0x56')]('cm_contacts',util[_0x94a9('0x57')](_0x94a9('0x58'),_0x47ec1e['id']),_0x2299a5);})[_0x94a9('0x25')](function(){return _0x47ec1e;});})[_0x94a9('0x25')](respondWithResult(_0x94593f,0xc9))[_0x94a9('0x43')](handleError(_0x94593f,null));}; \ No newline at end of file +var _0x2f68=['find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','BOOLEAN','queryInterface','addColumn','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','stack','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys'];(function(_0x3fa0d6,_0x420e11){var _0x20a7f0=function(_0x41c96a){while(--_0x41c96a){_0x3fa0d6['push'](_0x3fa0d6['shift']());}};_0x20a7f0(++_0x420e11);}(_0x2f68,0x15a));var _0x82f6=function(_0x4ed944,_0xc55d17){_0x4ed944=_0x4ed944-0x0;var _0x2612b8=_0x2f68[_0x4ed944];return _0x2612b8;};'use strict';var emlformat=require(_0x82f6('0x0'));var rimraf=require(_0x82f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82f6('0x2'));var rp=require(_0x82f6('0x3'));var moment=require(_0x82f6('0x4'));var BPromise=require(_0x82f6('0x5'));var Mustache=require(_0x82f6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x82f6('0x7'));var csv=require(_0x82f6('0x8'));var ejs=require(_0x82f6('0x9'));var fs=require('fs');var fs_extra=require(_0x82f6('0xa'));var _=require(_0x82f6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x82f6('0xc'));var deskjs=require(_0x82f6('0xd'));var toCsv=require(_0x82f6('0x8'));var querystring=require('querystring');var Papa=require(_0x82f6('0xe'));var Redis=require(_0x82f6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x82f6('0x10'));var as=require(_0x82f6('0x11'));var hardwareService=require(_0x82f6('0x12'));var logger=require(_0x82f6('0x13'))('api');var utils=require(_0x82f6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x82f6('0x15'));var db=require(_0x82f6('0x16'))['db'];function respondWithStatusCode(_0x2a4a37,_0x3c9480){_0x3c9480=_0x3c9480||0xcc;return function(_0x300d9f){if(_0x300d9f){return _0x2a4a37[_0x82f6('0x17')](_0x3c9480);}return _0x2a4a37[_0x82f6('0x18')](_0x3c9480)['end']();};}function respondWithResult(_0x56b47b,_0x3eb56d){_0x3eb56d=_0x3eb56d||0xc8;return function(_0x3a2e2f){if(_0x3a2e2f){return _0x56b47b[_0x82f6('0x18')](_0x3eb56d)[_0x82f6('0x19')](_0x3a2e2f);}};}function respondWithFilteredResult(_0x11f25f,_0x342c92){return function(_0x4c6bda){if(_0x4c6bda){var _0x58ca7f=typeof _0x342c92['offset']===_0x82f6('0x1a')&&typeof _0x342c92[_0x82f6('0x1b')]==='undefined';var _0x41b312=_0x4c6bda[_0x82f6('0x1c')];var _0x1b09ec=_0x58ca7f?0x0:_0x342c92[_0x82f6('0x1d')];var _0x34363c=_0x58ca7f?_0x4c6bda[_0x82f6('0x1c')]:_0x342c92[_0x82f6('0x1d')]+_0x342c92[_0x82f6('0x1b')];var _0x30f9c3;if(_0x34363c>=_0x41b312){_0x34363c=_0x41b312;_0x30f9c3=0xc8;}else{_0x30f9c3=0xce;}_0x11f25f['status'](_0x30f9c3);return _0x11f25f[_0x82f6('0x1e')](_0x82f6('0x1f'),_0x1b09ec+'-'+_0x34363c+'/'+_0x41b312)['json'](_0x4c6bda);}return null;};}function patchUpdates(_0x4c7c58){return function(_0x452815){try{jsonpatch[_0x82f6('0x20')](_0x452815,_0x4c7c58,!![]);}catch(_0x3a14f6){return BPromise[_0x82f6('0x21')](_0x3a14f6);}return _0x452815[_0x82f6('0x22')]();};}function saveUpdates(_0x173595,_0x8ec2b6){return function(_0x2f6e1e){if(_0x2f6e1e){return _0x2f6e1e['update'](_0x173595)[_0x82f6('0x23')](function(_0x550b80){return _0x550b80;});}return null;};}function removeEntity(_0x3ad601,_0x472e41){return function(_0x74ce69){if(_0x74ce69){return _0x74ce69['destroy']()[_0x82f6('0x23')](function(){_0x3ad601[_0x82f6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x418e2c,_0x58087d){return function(_0xa6078d){if(!_0xa6078d){_0x418e2c[_0x82f6('0x17')](0x194);}return _0xa6078d;};}function handleError(_0x517484,_0x5294b6){_0x5294b6=_0x5294b6||0x1f4;return function(_0x2ce843){logger['error'](_0x2ce843[_0x82f6('0x24')]);if(_0x2ce843['name']){delete _0x2ce843['name'];}_0x517484[_0x82f6('0x18')](_0x5294b6)[_0x82f6('0x25')](_0x2ce843);};}exports['index']=function(_0x1655b1,_0x2a3244){var _0xc8078={},_0x5dd4a4={},_0x11a9fb={'count':0x0,'rows':[]};var _0xee7144=_[_0x82f6('0x26')](db[_0x82f6('0x27')][_0x82f6('0x28')],function(_0x5f06d5){return{'name':_0x5f06d5[_0x82f6('0x29')],'type':_0x5f06d5[_0x82f6('0x2a')][_0x82f6('0x2b')]};});_0x5dd4a4[_0x82f6('0x2c')]=_[_0x82f6('0x2d')](_['map'](_0xee7144,_0x82f6('0x2e')),['name']);_0x5dd4a4[_0x82f6('0x2f')]=_['keys'](_0x1655b1[_0x82f6('0x2f')]);_0x5dd4a4[_0x82f6('0x30')]=_['intersection'](_0x5dd4a4[_0x82f6('0x2c')],_0x5dd4a4['query']);_0xc8078[_0x82f6('0x31')]=_[_0x82f6('0x32')](_0x5dd4a4[_0x82f6('0x2c')],qs['fields'](_0x1655b1['query'][_0x82f6('0x33')]));_0xc8078[_0x82f6('0x31')]=_0xc8078[_0x82f6('0x31')][_0x82f6('0x34')]?_0xc8078['attributes']:_0x5dd4a4[_0x82f6('0x2c')];if(!_0x1655b1[_0x82f6('0x2f')][_0x82f6('0x35')](_0x82f6('0x36'))){_0xc8078[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x1655b1[_0x82f6('0x2f')]['limit']);_0xc8078['offset']=qs[_0x82f6('0x1d')](_0x1655b1[_0x82f6('0x2f')][_0x82f6('0x1d')]);}_0xc8078[_0x82f6('0x37')]=qs[_0x82f6('0x38')](_0x1655b1['query']['sort']);_0xc8078[_0x82f6('0x39')]=qs[_0x82f6('0x30')](_[_0x82f6('0x3a')](_0x1655b1[_0x82f6('0x2f')],_0x5dd4a4[_0x82f6('0x30')]),_0xee7144);if(_0x1655b1[_0x82f6('0x2f')][_0x82f6('0x3b')]){_0xc8078[_0x82f6('0x39')]=_[_0x82f6('0x3c')](_0xc8078[_0x82f6('0x39')],{'$or':_[_0x82f6('0x26')](_0xee7144,function(_0x2171f4){if(_0x2171f4[_0x82f6('0x2a')]!==_0x82f6('0x3d')){var _0x2f2894={};_0x2f2894[_0x2171f4[_0x82f6('0x2e')]]={'$like':'%'+_0x1655b1[_0x82f6('0x2f')][_0x82f6('0x3b')]+'%'};return _0x2f2894;}})});}_0xc8078=_[_0x82f6('0x3c')]({},_0xc8078,_0x1655b1[_0x82f6('0x3e')]);var _0x5e37bf={'where':_0xc8078[_0x82f6('0x39')]};return db[_0x82f6('0x27')][_0x82f6('0x1c')](_0x5e37bf)['then'](function(_0x4ea4cb){_0x11a9fb[_0x82f6('0x1c')]=_0x4ea4cb;if(_0x1655b1[_0x82f6('0x2f')][_0x82f6('0x3f')]){_0xc8078[_0x82f6('0x40')]=[{'all':!![]}];}return db[_0x82f6('0x27')]['findAll'](_0xc8078);})[_0x82f6('0x23')](function(_0x298f31){_0x11a9fb['rows']=_0x298f31;return _0x11a9fb;})[_0x82f6('0x23')](respondWithFilteredResult(_0x2a3244,_0xc8078))[_0x82f6('0x41')](handleError(_0x2a3244,null));};exports[_0x82f6('0x42')]=function(_0x206361,_0x1e9a1b){var _0x24e6f7={'raw':!![],'where':{'id':_0x206361[_0x82f6('0x43')]['id']}},_0x187ba0={};_0x187ba0[_0x82f6('0x2c')]=_[_0x82f6('0x44')](db['CmCustomField'][_0x82f6('0x28')]);_0x187ba0[_0x82f6('0x2f')]=_['keys'](_0x206361[_0x82f6('0x2f')]);_0x187ba0[_0x82f6('0x30')]=_[_0x82f6('0x32')](_0x187ba0[_0x82f6('0x2c')],_0x187ba0[_0x82f6('0x2f')]);_0x24e6f7['attributes']=_[_0x82f6('0x32')](_0x187ba0[_0x82f6('0x2c')],qs['fields'](_0x206361[_0x82f6('0x2f')][_0x82f6('0x33')]));_0x24e6f7[_0x82f6('0x31')]=_0x24e6f7[_0x82f6('0x31')][_0x82f6('0x34')]?_0x24e6f7[_0x82f6('0x31')]:_0x187ba0[_0x82f6('0x2c')];if(_0x206361['query'][_0x82f6('0x3f')]){_0x24e6f7[_0x82f6('0x40')]=[{'all':!![]}];}_0x24e6f7=_['merge']({},_0x24e6f7,_0x206361['options']);return db[_0x82f6('0x27')][_0x82f6('0x45')](_0x24e6f7)[_0x82f6('0x23')](handleEntityNotFound(_0x1e9a1b,null))[_0x82f6('0x23')](respondWithResult(_0x1e9a1b,null))[_0x82f6('0x41')](handleError(_0x1e9a1b,null));};exports['update']=function(_0x43f173,_0x398cf0){if(_0x43f173[_0x82f6('0x46')]['id']){delete _0x43f173[_0x82f6('0x46')]['id'];}return db[_0x82f6('0x27')]['find']({'where':{'id':_0x43f173['params']['id']}})[_0x82f6('0x23')](handleEntityNotFound(_0x398cf0,null))[_0x82f6('0x23')](saveUpdates(_0x43f173[_0x82f6('0x46')],null))['then'](respondWithResult(_0x398cf0,null))[_0x82f6('0x41')](handleError(_0x398cf0,null));};exports[_0x82f6('0x47')]=function(_0x452e79,_0x56d3e6){return db[_0x82f6('0x27')][_0x82f6('0x45')]({'where':{'id':_0x452e79[_0x82f6('0x43')]['id']}})[_0x82f6('0x23')](handleEntityNotFound(_0x56d3e6,null))[_0x82f6('0x23')](removeEntity(_0x56d3e6,null))['catch'](handleError(_0x56d3e6,null));};exports[_0x82f6('0x48')]=function(_0x2404c3,_0x4c40b8){var _0x1a49e1;return db[_0x82f6('0x49')][_0x82f6('0x4a')](function(_0x38bff2){return db[_0x82f6('0x27')]['create'](_0x2404c3['body'],{'transaction':_0x38bff2})[_0x82f6('0x23')](function(_0x1e9595){_0x1a49e1=_0x1e9595;var _0x12f1aa={'type':db[_0x82f6('0x4b')][_0x82f6('0x4c')],'transaction':_0x38bff2};switch(_0x2404c3[_0x82f6('0x46')][_0x82f6('0x2a')]){case _0x82f6('0x4d'):_0x12f1aa[_0x82f6('0x2a')]=db[_0x82f6('0x4b')]['TEXT'];break;case _0x82f6('0x4e'):_0x12f1aa[_0x82f6('0x2a')]=db['Sequelize']['INTEGER'];break;case'switch':_0x12f1aa['type']=db[_0x82f6('0x4b')][_0x82f6('0x4f')];_0x12f1aa['defaultValue']=![];break;default:}return db[_0x82f6('0x49')][_0x82f6('0x50')][_0x82f6('0x51')]('cm_contacts',util['format'](_0x82f6('0x52'),_0x1a49e1['id']),_0x12f1aa);})[_0x82f6('0x23')](function(){return _0x1a49e1;});})[_0x82f6('0x23')](respondWithResult(_0x4c40b8,0xc9))[_0x82f6('0x41')](handleError(_0x4c40b8,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 0e4e969..c8b310e 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 _0x658e=['path','../../config/environment','define','cm_custom_fields','lodash','util','api','moment','bluebird','request-promise'];(function(_0x35c4b6,_0x3f462e){var _0x444f74=function(_0xee09cb){while(--_0xee09cb){_0x35c4b6['push'](_0x35c4b6['shift']());}};_0x444f74(++_0x3f462e);}(_0x658e,0x86));var _0xe658=function(_0x481c49,_0x27f8db){_0x481c49=_0x481c49-0x0;var _0x4c95c3=_0x658e[_0x481c49];return _0x4c95c3;};'use strict';var _=require(_0xe658('0x0'));var util=require(_0xe658('0x1'));var logger=require('../../config/logger')(_0xe658('0x2'));var moment=require(_0xe658('0x3'));var BPromise=require(_0xe658('0x4'));var rp=require(_0xe658('0x5'));var fs=require('fs');var path=require(_0xe658('0x6'));var rimraf=require('rimraf');var config=require(_0xe658('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x4a97c6,_0xf3fc2f){return _0x4a97c6[_0xe658('0x8')]('CmCustomField',attributes,{'tableName':_0xe658('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2619=['exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2619,0x82));var _0x9261=function(_0x68ceee,_0x4232a0){_0x68ceee=_0x68ceee-0x0;var _0x4b3e4b=_0x2619[_0x68ceee];return _0x4b3e4b;};'use strict';var _=require(_0x9261('0x0'));var util=require('util');var logger=require(_0x9261('0x1'))(_0x9261('0x2'));var moment=require(_0x9261('0x3'));var BPromise=require(_0x9261('0x4'));var rp=require(_0x9261('0x5'));var fs=require('fs');var path=require(_0x9261('0x6'));var rimraf=require(_0x9261('0x7'));var config=require(_0x9261('0x8'));var attributes=require(_0x9261('0x9'));module[_0x9261('0xa')]=function(_0x216a49,_0x48e16f){return _0x216a49[_0x9261('0xb')](_0x9261('0xc'),attributes,{'tableName':_0x9261('0xd'),'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 abe550f..8700cf7 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 _0x25e8=['info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x245fc1,_0x59b91c){var _0x2660f5=function(_0x1976e1){while(--_0x1976e1){_0x245fc1['push'](_0x245fc1['shift']());}};_0x2660f5(++_0x59b91c);}(_0x25e8,0x1d8));var _0x825e=function(_0x1eb37d,_0x108903){_0x1eb37d=_0x1eb37d-0x0;var _0xd4010=_0x25e8[_0x1eb37d];return _0xd4010;};'use strict';var _=require(_0x825e('0x0'));var util=require(_0x825e('0x1'));var moment=require(_0x825e('0x2'));var BPromise=require(_0x825e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x825e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x825e('0x5'))(_0x825e('0x6'));var config=require('../../config/environment');var jayson=require(_0x825e('0x7'));var client=jayson[_0x825e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335ad0,_0x4f0d30,_0x153c26){return new BPromise(function(_0x1765b4,_0xcf620e){return client[_0x825e('0x9')](_0x335ad0,_0x153c26)[_0x825e('0xa')](function(_0xce7c10){logger[_0x825e('0xb')]('CmCustomField,\x20%s,\x20%s',_0x4f0d30,_0x825e('0xc'));logger[_0x825e('0xd')](_0x825e('0xe'),_0x4f0d30,'request\x20sent',JSON[_0x825e('0xf')](_0xce7c10));if(_0xce7c10[_0x825e('0x10')]){if(_0xce7c10['error']['code']===0x1f4){logger[_0x825e('0x10')](_0x825e('0x11'),_0x4f0d30,_0xce7c10['error'][_0x825e('0x12')]);return _0xcf620e(_0xce7c10[_0x825e('0x10')][_0x825e('0x12')]);}logger[_0x825e('0x10')](_0x825e('0x11'),_0x4f0d30,_0xce7c10[_0x825e('0x10')]['message']);return _0x1765b4(_0xce7c10['error']['message']);}else{logger['info'](_0x825e('0x11'),_0x4f0d30,'request\x20sent');_0x1765b4(_0xce7c10[_0x825e('0x13')][_0x825e('0x12')]);}})[_0x825e('0x14')](function(_0x5a90ce){logger[_0x825e('0x10')](_0x825e('0x11'),_0x4f0d30,_0x5a90ce);_0xcf620e(_0x5a90ce);});});} \ No newline at end of file +var _0x9ebb=['request','then','info','CmCustomField,\x20%s,\x20%s','debug','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x28f895,_0x189a37){var _0x73a928=function(_0x30943b){while(--_0x30943b){_0x28f895['push'](_0x28f895['shift']());}};_0x73a928(++_0x189a37);}(_0x9ebb,0x11a));var _0xb9eb=function(_0x2d1f3d,_0x25a1dd){_0x2d1f3d=_0x2d1f3d-0x0;var _0x51b0e9=_0x9ebb[_0x2d1f3d];return _0x51b0e9;};'use strict';var _=require(_0xb9eb('0x0'));var util=require('util');var moment=require(_0xb9eb('0x1'));var BPromise=require(_0xb9eb('0x2'));var rs=require(_0xb9eb('0x3'));var fs=require('fs');var Redis=require(_0xb9eb('0x4'));var db=require(_0xb9eb('0x5'))['db'];var utils=require(_0xb9eb('0x6'));var logger=require(_0xb9eb('0x7'))(_0xb9eb('0x8'));var config=require('../../config/environment');var jayson=require(_0xb9eb('0x9'));var client=jayson[_0xb9eb('0xa')][_0xb9eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x532f09,_0x19f931,_0x357d2f){return new BPromise(function(_0x5d37e3,_0x29b1df){return client[_0xb9eb('0xc')](_0x532f09,_0x357d2f)[_0xb9eb('0xd')](function(_0x4e3e1f){logger[_0xb9eb('0xe')](_0xb9eb('0xf'),_0x19f931,'request\x20sent');logger[_0xb9eb('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x19f931,'request\x20sent',JSON[_0xb9eb('0x11')](_0x4e3e1f));if(_0x4e3e1f[_0xb9eb('0x12')]){if(_0x4e3e1f['error'][_0xb9eb('0x13')]===0x1f4){logger[_0xb9eb('0x12')](_0xb9eb('0xf'),_0x19f931,_0x4e3e1f[_0xb9eb('0x12')]['message']);return _0x29b1df(_0x4e3e1f[_0xb9eb('0x12')][_0xb9eb('0x14')]);}logger[_0xb9eb('0x12')]('CmCustomField,\x20%s,\x20%s',_0x19f931,_0x4e3e1f[_0xb9eb('0x12')][_0xb9eb('0x14')]);return _0x5d37e3(_0x4e3e1f[_0xb9eb('0x12')]['message']);}else{logger[_0xb9eb('0xe')](_0xb9eb('0xf'),_0x19f931,'request\x20sent');_0x5d37e3(_0x4e3e1f['result'][_0xb9eb('0x14')]);}})['catch'](function(_0xa21f27){logger[_0xb9eb('0x12')](_0xb9eb('0xf'),_0x19f931,_0xa21f27);_0x29b1df(_0xa21f27);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bf253c7..b507041 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 _0x046b=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x18bb4b,_0x538bc3){var _0x18ed56=function(_0x473e49){while(--_0x473e49){_0x18bb4b['push'](_0x18bb4b['shift']());}};_0x18ed56(++_0x538bc3);}(_0x046b,0x147));var _0xb046=function(_0x1e9e5c,_0x13fb10){_0x1e9e5c=_0x1e9e5c-0x0;var _0x191cb9=_0x046b[_0x1e9e5c];return _0x191cb9;};'use strict';var multer=require('multer');var util=require(_0xb046('0x0'));var path=require(_0xb046('0x1'));var timeout=require(_0xb046('0x2'));var express=require(_0xb046('0x3'));var router=express[_0xb046('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb046('0x5'));var interaction=require(_0xb046('0x6'));var config=require(_0xb046('0x7'));var controller=require(_0xb046('0x8'));router[_0xb046('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb046('0x9')](_0xb046('0xa'),auth[_0xb046('0xb')](),controller[_0xb046('0xc')]);router[_0xb046('0xd')]('/',auth[_0xb046('0xb')](),controller[_0xb046('0xe')]);router[_0xb046('0xf')]('/:id',auth[_0xb046('0xb')](),controller['update']);router[_0xb046('0x10')](_0xb046('0xa'),auth[_0xb046('0xb')](),controller[_0xb046('0x11')]);module[_0xb046('0x12')]=router; \ No newline at end of file +var _0x51a8=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c5312,_0x2470bb){var _0x36f59b=function(_0x9782f){while(--_0x9782f){_0x3c5312['push'](_0x3c5312['shift']());}};_0x36f59b(++_0x2470bb);}(_0x51a8,0x186));var _0x851a=function(_0xfea85d,_0x3f3350){_0xfea85d=_0xfea85d-0x0;var _0xbf6912=_0x51a8[_0xfea85d];return _0xbf6912;};'use strict';var multer=require(_0x851a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x851a('0x1'));var express=require(_0x851a('0x2'));var router=express[_0x851a('0x3')]();var fs_extra=require(_0x851a('0x4'));var auth=require(_0x851a('0x5'));var interaction=require(_0x851a('0x6'));var config=require(_0x851a('0x7'));var controller=require(_0x851a('0x8'));router[_0x851a('0x9')]('/',auth[_0x851a('0xa')](),controller['index']);router['get'](_0x851a('0xb'),auth[_0x851a('0xa')](),controller[_0x851a('0xc')]);router['post']('/',auth[_0x851a('0xa')](),controller[_0x851a('0xd')]);router['put']('/:id',auth[_0x851a('0xa')](),controller[_0x851a('0xe')]);router[_0x851a('0xf')](_0x851a('0xb'),auth[_0x851a('0xa')](),controller[_0x851a('0x10')]);module[_0x851a('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2e02ccf..a6d765e 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 _0xa48a=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','STRING'];(function(_0x370023,_0x1d4cd){var _0xf3d3fa=function(_0x4e2371){while(--_0x4e2371){_0x370023['push'](_0x370023['shift']());}};_0xf3d3fa(++_0x1d4cd);}(_0xa48a,0x146));var _0xaa48=function(_0x7222eb,_0x9a7371){_0x7222eb=_0x7222eb-0x0;var _0x18ec43=_0xa48a[_0x7222eb];return _0x18ec43;};'use strict';var moment=require(_0xaa48('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xaa48('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xaa48('0x2')],'defaultValue':moment()['format'](_0xaa48('0x3'))},'countbusyretry':{'type':Sequelize[_0xaa48('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaa48('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaa48('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xaa48('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaa48('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaa48('0x2')]},'priority':{'type':Sequelize[_0xaa48('0x4')](0x2)[_0xaa48('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xaa48('0x4')],'unique':_0xaa48('0x7')},'ListId':{'type':Sequelize[_0xaa48('0x4')],'unique':_0xaa48('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xaa48('0x7')},'CampaignId':{'type':Sequelize[_0xaa48('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaa48('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xaa48('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaa48('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaa48('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xaa48('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x2dc7=['BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','sequelize','exports','STRING'];(function(_0x3797e9,_0x4c63f6){var _0x4d0901=function(_0x23a95b){while(--_0x23a95b){_0x3797e9['push'](_0x3797e9['shift']());}};_0x4d0901(++_0x4c63f6);}(_0x2dc7,0xba));var _0x72dc=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x2dc7[_0x3be7ff];return _0x186721;};'use strict';var moment=require('moment');var Sequelize=require(_0x72dc('0x0'));module[_0x72dc('0x1')]={'phone':{'type':Sequelize[_0x72dc('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x72dc('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x72dc('0x4'))},'countbusyretry':{'type':Sequelize[_0x72dc('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x72dc('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x72dc('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x72dc('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x72dc('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x72dc('0x6')]},'priority':{'type':Sequelize[_0x72dc('0x5')](0x2)[_0x72dc('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x72dc('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x72dc('0x5')],'unique':_0x72dc('0x8')},'ListId':{'type':Sequelize[_0x72dc('0x5')],'unique':_0x72dc('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x72dc('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x72dc('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x72dc('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72dc('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x72dc('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x72dc('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x72dc('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x72dc('0x6')],'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 1a7c4e6..a88d3ac 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 _0xb66c=['$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','find','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','keys','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','update','then','name','send','map','CmHopper','rawAttributes','model','query','filters','intersection','concat','$and','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$notIn','$like','$notLike'];(function(_0x414f09,_0x15ef7a){var _0x382df4=function(_0x12fab0){while(--_0x12fab0){_0x414f09['push'](_0x414f09['shift']());}};_0x382df4(++_0x15ef7a);}(_0xb66c,0x175));var _0xcb66=function(_0xbc3106,_0x2c9131){_0xbc3106=_0xbc3106-0x0;var _0x2a9807=_0xb66c[_0xbc3106];return _0x2a9807;};'use strict';var moment=require(_0xcb66('0x0'));var _=require('lodash');var qs=require(_0xcb66('0x1'));var logger=require('../../config/logger')(_0xcb66('0x2'));var shared=require(_0xcb66('0x3'));var db=require(_0xcb66('0x4'))['db'];function respondWithResult(_0x5f487c,_0x35d439){_0x35d439=_0x35d439||0xc8;return function(_0x386241){if(_0x386241){return _0x5f487c[_0xcb66('0x5')](_0x35d439)[_0xcb66('0x6')](_0x386241);}};}function respondWithFilteredResult(_0x5d766d,_0x518163){return function(_0x19adf5){if(_0x19adf5){var _0x1b6852=typeof _0x518163[_0xcb66('0x7')]===_0xcb66('0x8')&&typeof _0x518163[_0xcb66('0x9')]==='undefined';var _0x2c62ad=_0x19adf5[_0xcb66('0xa')];var _0x174969=_0x1b6852?0x0:_0x518163[_0xcb66('0x7')];var _0x3c4ce1=_0x1b6852?_0x19adf5['count']:_0x518163[_0xcb66('0x7')]+_0x518163[_0xcb66('0x9')];var _0xf12828;if(_0x3c4ce1>=_0x2c62ad){_0x3c4ce1=_0x2c62ad;_0xf12828=0xc8;}else{_0xf12828=0xce;}_0x5d766d[_0xcb66('0x5')](_0xf12828);return _0x5d766d['set'](_0xcb66('0xb'),_0x174969+'-'+_0x3c4ce1+'/'+_0x2c62ad)[_0xcb66('0x6')](_0x19adf5);}return null;};}function saveUpdates(_0x4105d2,_0x2339bb){return function(_0x582523){if(_0x582523){return _0x582523[_0xcb66('0xc')](_0x4105d2)[_0xcb66('0xd')](function(_0x36c846){return _0x36c846;});}return null;};}function handleEntityNotFound(_0x401bc9,_0x58fb9e){return function(_0x19072b){if(!_0x19072b){_0x401bc9['sendStatus'](0x194);}return _0x19072b;};}function handleError(_0x6af5b5,_0x52b058){_0x52b058=_0x52b058||0x1f4;return function(_0x27442d){logger['error'](_0x27442d['stack']);if(_0x27442d[_0xcb66('0xe')]){delete _0x27442d[_0xcb66('0xe')];}_0x6af5b5[_0xcb66('0x5')](_0x52b058)[_0xcb66('0xf')](_0x27442d);};}exports['index']=function(_0x3a6e26,_0x42ad03){var _0x8a0f3f={},_0x58bca0={},_0x2e4126={'count':0x0,'rows':[]};var _0x496d12=_[_0xcb66('0x10')](db[_0xcb66('0x11')][_0xcb66('0x12')],function(_0x1ccb71){return{'name':_0x1ccb71['fieldName'],'type':_0x1ccb71['type']['key']};});_0x58bca0[_0xcb66('0x13')]=_['map'](_0x496d12,'name');_0x58bca0[_0xcb66('0x14')]=_['keys'](_0x3a6e26[_0xcb66('0x14')]);_0x58bca0[_0xcb66('0x15')]=_[_0xcb66('0x16')](_0x58bca0[_0xcb66('0x13')],_0x58bca0[_0xcb66('0x14')]);_0x58bca0[_0xcb66('0x15')]=_[_0xcb66('0x17')](_0x58bca0['filters'],[_0xcb66('0x18'),'$or','$gt',_0xcb66('0x19'),_0xcb66('0x1a'),_0xcb66('0x1b'),'$ne',_0xcb66('0x1c'),_0xcb66('0x1d'),_0xcb66('0x1e'),_0xcb66('0x1f'),'$in',_0xcb66('0x20'),_0xcb66('0x21'),_0xcb66('0x22'),_0xcb66('0x23'),_0xcb66('0x24'),_0xcb66('0x21'),_0xcb66('0x25'),_0xcb66('0x26'),_0xcb66('0x27'),_0xcb66('0x28')]);_0x8a0f3f['attributes']=_[_0xcb66('0x16')](_0x58bca0['model'],qs['fields'](_0x3a6e26['query'][_0xcb66('0x29')]));_0x8a0f3f['attributes']=_0x8a0f3f[_0xcb66('0x2a')][_0xcb66('0x2b')]?_0x8a0f3f[_0xcb66('0x2a')]:_0x58bca0['model'];if(!_0x3a6e26[_0xcb66('0x14')][_0xcb66('0x2c')](_0xcb66('0x2d'))){_0x8a0f3f[_0xcb66('0x9')]=qs[_0xcb66('0x9')](_0x3a6e26[_0xcb66('0x14')][_0xcb66('0x9')]);_0x8a0f3f[_0xcb66('0x7')]=qs[_0xcb66('0x7')](_0x3a6e26[_0xcb66('0x14')]['offset']);}_0x8a0f3f[_0xcb66('0x2e')]=qs[_0xcb66('0x2f')](_0x3a6e26[_0xcb66('0x14')][_0xcb66('0x2f')]);_0x8a0f3f[_0xcb66('0x30')]=qs[_0xcb66('0x15')](_[_0xcb66('0x31')](_0x3a6e26['query'],_0x58bca0[_0xcb66('0x15')]),_0x496d12);if(_0x3a6e26[_0xcb66('0x14')][_0xcb66('0x32')]){_0x8a0f3f[_0xcb66('0x30')]=_['merge'](_0x8a0f3f[_0xcb66('0x30')],{'$or':_[_0xcb66('0x10')](_0x496d12,function(_0x907fff){if(_0x907fff[_0xcb66('0x33')]!==_0xcb66('0x34')){var _0x1d9957={};_0x1d9957[_0x907fff[_0xcb66('0xe')]]={'$like':'%'+_0x3a6e26[_0xcb66('0x14')][_0xcb66('0x32')]+'%'};return _0x1d9957;}})});}_0x8a0f3f=_[_0xcb66('0x35')]({},_0x8a0f3f,_0x3a6e26[_0xcb66('0x36')]);var _0x17b087={'where':_0x8a0f3f['where']};return db['CmHopper']['count'](_0x17b087)[_0xcb66('0xd')](function(_0x4182f9){_0x2e4126[_0xcb66('0xa')]=_0x4182f9;if(_0x3a6e26[_0xcb66('0x14')][_0xcb66('0x37')]){_0x8a0f3f[_0xcb66('0x38')]=[{'all':!![]}];}return db['CmHopper'][_0xcb66('0x39')](_0x8a0f3f);})['then'](function(_0x4b25f0){_0x2e4126['rows']=_0x4b25f0;return _0x2e4126;})[_0xcb66('0xd')](respondWithFilteredResult(_0x42ad03,_0x8a0f3f))[_0xcb66('0x3a')](handleError(_0x42ad03,null));};exports[_0xcb66('0x3b')]=function(_0x9db922,_0x11d2ac){var _0x3e71a7={'raw':!![],'where':{'id':_0x9db922[_0xcb66('0x3c')]['id']}},_0x3422b6={};_0x3422b6[_0xcb66('0x13')]=_['keys'](db[_0xcb66('0x11')][_0xcb66('0x12')]);_0x3422b6[_0xcb66('0x14')]=_['keys'](_0x9db922[_0xcb66('0x14')]);_0x3422b6[_0xcb66('0x15')]=_['intersection'](_0x3422b6['model'],_0x3422b6[_0xcb66('0x14')]);_0x3e71a7['attributes']=_['intersection'](_0x3422b6[_0xcb66('0x13')],qs[_0xcb66('0x29')](_0x9db922[_0xcb66('0x14')][_0xcb66('0x29')]));_0x3e71a7[_0xcb66('0x2a')]=_0x3e71a7[_0xcb66('0x2a')][_0xcb66('0x2b')]?_0x3e71a7[_0xcb66('0x2a')]:_0x3422b6[_0xcb66('0x13')];if(_0x9db922['query']['includeAll']){_0x3e71a7['include']=[{'all':!![]}];}_0x3e71a7=_[_0xcb66('0x35')]({},_0x3e71a7,_0x9db922['options']);return db[_0xcb66('0x11')]['find'](_0x3e71a7)[_0xcb66('0xd')](handleEntityNotFound(_0x11d2ac,null))[_0xcb66('0xd')](respondWithResult(_0x11d2ac,null))[_0xcb66('0x3a')](handleError(_0x11d2ac,null));};exports[_0xcb66('0x3d')]=function(_0x3115e2,_0xbc92e){return db['CmHopper']['create'](_0x3115e2[_0xcb66('0x3e')],{})[_0xcb66('0xd')](respondWithResult(_0xbc92e,0xc9))[_0xcb66('0x3a')](handleError(_0xbc92e,null));};exports[_0xcb66('0xc')]=function(_0xf2c532,_0x1c149b){if(_0xf2c532[_0xcb66('0x3e')]['id']){delete _0xf2c532[_0xcb66('0x3e')]['id'];}return db[_0xcb66('0x11')]['find']({'where':{'id':_0xf2c532[_0xcb66('0x3c')]['id']}})[_0xcb66('0xd')](handleEntityNotFound(_0x1c149b,null))[_0xcb66('0xd')](saveUpdates(_0xf2c532[_0xcb66('0x3e')],null))['then'](respondWithResult(_0x1c149b,null))[_0xcb66('0x3a')](handleError(_0x1c149b,null));};exports[_0xcb66('0x3f')]=function(_0x1aab4e,_0x5a1083){return db[_0xcb66('0x11')][_0xcb66('0x3f')]()[_0xcb66('0xd')](respondWithResult(_0x5a1083,null))[_0xcb66('0x3a')](handleError(_0x5a1083,null));};exports['destroy']=function(_0x43e0e0,_0xb0854f){var _0x3b839b;var _0x4b1d46=_0x43e0e0['params']['id'];return db[_0xcb66('0x11')]['find']({'where':{'id':_0x43e0e0[_0xcb66('0x3c')]['id']}})['then'](handleEntityNotFound(_0xb0854f,null))[_0xcb66('0xd')](function(_0x416448){if(_0x416448){return _0x416448[_0xcb66('0x40')]()['then'](function(_0x2071d5){return _0x2071d5;});}})['then'](function(_0x228504){_0x3b839b=_0x228504;if(_0x228504){if(_0x228504[_0xcb66('0x41')]||_0x228504[_0xcb66('0x42')]){return db[_0x228504[_0xcb66('0x41')]?_0xcb66('0x43'):'Campaign'][_0xcb66('0x44')]({'where':{'id':_0x228504['VoiceQueueId']?_0x228504[_0xcb66('0x41')]:_0x228504[_0xcb66('0x42')]},'attributes':['id',_0xcb66('0xe')],'raw':!![]});}}})['then'](function(_0x48d7a3){var _0x52ff91={};if(_0x48d7a3){_[_0xcb66('0x35')](_0x52ff91,_[_0xcb66('0x45')](_0x3b839b[_0xcb66('0x46')],[_0xcb66('0x47'),_0xcb66('0x48'),'id']));_0x52ff91[_0xcb66('0x49')]=0x15;_0x52ff91[_0xcb66('0x4a')]=_0xcb66('0x4b');_0x52ff91[_0xcb66('0x4c')]=_0x48d7a3[_0xcb66('0xe')];_0x52ff91['membername']=_0x43e0e0[_0xcb66('0x4d')][_0xcb66('0xe')];_0x52ff91[_0xcb66('0x4e')]=_0x43e0e0[_0xcb66('0x4d')]['id'];_0x52ff91['deleted']=!![];_0x52ff91['deletedat']=moment()[_0xcb66('0x4f')](_0xcb66('0x50'));_0x52ff91[_0xcb66('0x51')]=_0x3b839b[_0xcb66('0x52')];_0x52ff91[_0xcb66('0x53')]=_0x3b839b[_0xcb66('0x41')]?'queue':_0xcb66('0x54');return db[_0xcb66('0x55')][_0xcb66('0x44')]({'where':{'id':_0x52ff91[_0xcb66('0x56')]},'attributes':['firstName',_0xcb66('0x57')]})['then'](function(_0xd37bbd){if(!_['isNil'](_0xb0854f)&&!_[_0xcb66('0x58')](_0xd37bbd[_0xcb66('0x59')])){_0x52ff91[_0xcb66('0x5a')]=_0xd37bbd['firstName'];if(!_['isNil'](_0xd37bbd[_0xcb66('0x57')])){_0x52ff91[_0xcb66('0x5a')]+='\x20'+_0xd37bbd['lastName'];}}})['finally'](function(){return db[_0xcb66('0x5b')]['create'](_0x52ff91);});}})[_0xcb66('0xd')](function(_0x56e524){return db[_0xcb66('0x5c')][_0xcb66('0x40')]({'where':{'CmHopperId':_0x4b1d46}});})[_0xcb66('0xd')](function(){return _0xb0854f['status'](0xcc)[_0xcb66('0x5d')]();})[_0xcb66('0x3a')](handleError(_0xb0854f,null));};exports['getPreview']=function(_0x244003,_0x27e83c){var _0x417c7e=[];return db[_0xcb66('0x55')][_0xcb66('0x3f')]()[_0xcb66('0xd')](function(_0x5352aa){_0x417c7e=_[_0xcb66('0x5e')](_0x5352aa);return _0x244003[_0xcb66('0x4d')][_0xcb66('0x5f')]({'where':{'type':_0xcb66('0x60'),'dialActive':!![],'dialMethod':_0xcb66('0x61')},'attributes':['id',_0xcb66('0x62'),_0xcb66('0x63')],'raw':!![]});})[_0xcb66('0xd')](function(_0x1e2287){if(_0x1e2287&&_0x1e2287['length']){return db[_0xcb66('0x64')][_0xcb66('0x65')](function(_0x25e648){var _0x3ab8b3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcb66('0x4f')](_0xcb66('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x1e2287,'id')},'$or':[{'UserId':null},{'UserId':_0x244003[_0xcb66('0x4d')]['id']}]};var _0x40d4f3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1e2287)['filter']([_0xcb66('0x63'),0x0])[_0xcb66('0x10')]('id')[_0xcb66('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x244003[_0xcb66('0x4d')]['id']}]};var _0x5b6e1f={'$or':[_0x3ab8b3,_0x40d4f3]};var _0x3dbc42=[];if(_0x244003[_0xcb66('0x3e')][_0xcb66('0x67')]&&_0x244003[_0xcb66('0x3e')][_0xcb66('0x67')]===_0xcb66('0x68')){if(!_[_0xcb66('0x69')](_0x244003[_0xcb66('0x3e')][_0xcb66('0x6a')])){_0x5b6e1f['id']={'$in':_0x244003[_0xcb66('0x3e')]['hopperIds']};}_0x3dbc42=[[_0xcb66('0x6b'),_0xcb66('0x6c')],[_0xcb66('0x6d'),_0x1e2287[0x0][_0xcb66('0x62')]==='ASC'?_0xcb66('0x6e'):_0xcb66('0x6c')],db[_0xcb66('0x64')][_0xcb66('0x6f')](_0xcb66('0x70')),['id',_0xcb66('0x6e')]];}else{if(!_[_0xcb66('0x69')](_0x244003['body']['hopperIds'])){_0x5b6e1f['id']={'$notIn':_0x244003[_0xcb66('0x3e')][_0xcb66('0x6a')]};}_0x3dbc42=[[_0xcb66('0x6b'),_0xcb66('0x6e')],[_0xcb66('0x6d'),_0x1e2287[0x0][_0xcb66('0x62')]],db['sequelize'][_0xcb66('0x6f')](_0xcb66('0x71')),['id',_0xcb66('0x6c')]];}return db[_0xcb66('0x11')][_0xcb66('0x72')]({'attributes':['id',_0xcb66('0x73'),'phone',_0xcb66('0x74')],'where':_0x5b6e1f,'order':_0x3dbc42,'transaction':_0x25e648,'lock':_0x25e648[_0xcb66('0x75')][_0xcb66('0x76')],'include':[{'model':db[_0xcb66('0x55')],'as':_0xcb66('0x77'),'attributes':_0x417c7e,'include':[{'model':db[_0xcb66('0x78')],'as':_0xcb66('0x79'),'attributes':['id',_0xcb66('0xe')]}]},{'model':db[_0xcb66('0x7a')],'as':_0xcb66('0x7b'),'attributes':['id',_0xcb66('0xe')]},{'model':db[_0xcb66('0x43')],'as':_0xcb66('0x7c'),'attributes':['id',_0xcb66('0xe'),_0xcb66('0x7d')]}]})[_0xcb66('0xd')](function(_0x3b0f10){if(_0x3b0f10){return _0x3b0f10[_0xcb66('0xc')]({'UserId':_0x244003[_0xcb66('0x4d')]['id']},{'transaction':_0x25e648});}});});}})['then'](handleEntityNotFound(_0x27e83c,null))[_0xcb66('0xd')](respondWithResult(_0x27e83c,null))['catch'](handleError(_0x27e83c,null));};exports[_0xcb66('0x7e')]=function(_0x51311b,_0x279264,_0x2912c9){var _0x42a71a=[];var _0x1a4cdb=_0x51311b[_0xcb66('0x3c')]['id'];var _0x283600=_0x51311b[_0xcb66('0x4d')]['id'];return db[_0xcb66('0x55')][_0xcb66('0x3f')]()[_0xcb66('0xd')](function(_0xf7c710){_0x42a71a=_[_0xcb66('0x5e')](_0xf7c710);return db[_0xcb66('0x64')]['transaction'](function(_0x91725a){const _0x45b25e={'id':_0x1a4cdb};return db[_0xcb66('0x11')]['findOne']({'attributes':['id',_0xcb66('0x73'),_0xcb66('0x74')],'where':_0x45b25e,'transaction':_0x91725a,'lock':_0x91725a[_0xcb66('0x75')]['UPDATE'],'include':[{'model':db[_0xcb66('0x55')],'as':_0xcb66('0x77'),'attributes':_0x42a71a,'include':[{'model':db[_0xcb66('0x78')],'as':_0xcb66('0x79'),'attributes':['id',_0xcb66('0xe')]}]},{'model':db[_0xcb66('0x7a')],'as':'List','attributes':['id',_0xcb66('0xe')]},{'model':db['VoiceQueue'],'as':_0xcb66('0x7c'),'attributes':['id','name',_0xcb66('0x7d')]}]})['then'](function(_0x3b4c30){if(_0x3b4c30){return _0x3b4c30[_0xcb66('0xc')]({'UserId':_0x283600},{'transaction':_0x91725a});}});});})[_0xcb66('0xd')](handleEntityNotFound(_0x279264,null))['then'](respondWithResult(_0x279264,null))[_0xcb66('0x3a')](handleError(_0x279264,null));};exports['getOpenContacts']=function(_0x112f25,_0x21d871){return _0x112f25[_0xcb66('0x4d')][_0xcb66('0x5f')]({'where':{'type':_0xcb66('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xcb66('0xd')](function(_0xfa72ee){if(_0xfa72ee&&_0xfa72ee[_0xcb66('0x2b')]){return db[_0xcb66('0x11')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcb66('0x4f')](_0xcb66('0x50'))},'VoiceQueueId':{'$in':_['map'](_0xfa72ee,'id')},'$or':[{'UserId':null},{'UserId':_0x112f25[_0xcb66('0x4d')]['id']}]}});}return 0x0;})[_0xcb66('0xd')](function(_0x16f9a3){if(!_[_0xcb66('0x58')](_0x16f9a3)&&_['isNumber'](_0x16f9a3)){return _0x21d871[_0xcb66('0x5')](0xc8)[_0xcb66('0x6')]({'contacts':_0x16f9a3});}else{logger[_0xcb66('0x7f')](_0xcb66('0x80'),_0xcb66('0x81'),0x194,'entity\x20not\x20found');_0x21d871[_0xcb66('0x82')](0x194);}})[_0xcb66('0x3a')](handleError(_0x21d871,null));};exports[_0xcb66('0x83')]=function(_0x1105d5,_0xb3a1e){var _0xf7b62b=shared[_0xcb66('0x84')];var _0x5b0db8=[];_['map'](_0xf7b62b,function(_0x56b8d5){_0x5b0db8[_0xcb66('0x85')]({'id':_0x56b8d5[_0xcb66('0xe')],'name':_0x56b8d5['name'],'utcOffset':_0x56b8d5[_0xcb66('0x86')]});});return _0xb3a1e['status'](0xc8)[_0xcb66('0x6')]({'tz':_0x5b0db8});};exports[_0xcb66('0x87')]=function(_0x220fea,_0x28987a){var _0x4d45b2=shared[_0xcb66('0x84')];var _0x2c08fc={};if(!_[_0xcb66('0x58')](_0x4d45b2[_0x220fea[_0xcb66('0x3e')]['id']]))_0x2c08fc=_0x4d45b2[_0x220fea[_0xcb66('0x3e')]['id']];return _0x28987a['status'](0xc8)['json'](_0x2c08fc);}; \ No newline at end of file +var _0xed1f=['$lte','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','findOne','CmList','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','then','error','name','send','CmHopper','rawAttributes','fieldName','type','model','map','query','intersection','concat','$and','$or','$gt','$gte','$lt'];(function(_0x2d78ad,_0x3ba17f){var _0x5d2884=function(_0x1e821c){while(--_0x1e821c){_0x2d78ad['push'](_0x2d78ad['shift']());}};_0x5d2884(++_0x3ba17f);}(_0xed1f,0x6a));var _0xfed1=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xed1f[_0x486f4a];return _0x135d99;};'use strict';var moment=require(_0xfed1('0x0'));var _=require(_0xfed1('0x1'));var qs=require(_0xfed1('0x2'));var logger=require(_0xfed1('0x3'))(_0xfed1('0x4'));var shared=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];function respondWithResult(_0xa68587,_0x2209b3){_0x2209b3=_0x2209b3||0xc8;return function(_0x45c3c1){if(_0x45c3c1){return _0xa68587[_0xfed1('0x7')](_0x2209b3)[_0xfed1('0x8')](_0x45c3c1);}};}function respondWithFilteredResult(_0x3d6706,_0x42751d){return function(_0x380e18){if(_0x380e18){var _0x612b38=typeof _0x42751d[_0xfed1('0x9')]===_0xfed1('0xa')&&typeof _0x42751d['limit']===_0xfed1('0xa');var _0x305d19=_0x380e18['count'];var _0x1414be=_0x612b38?0x0:_0x42751d[_0xfed1('0x9')];var _0x4a564e=_0x612b38?_0x380e18[_0xfed1('0xb')]:_0x42751d['offset']+_0x42751d[_0xfed1('0xc')];var _0x234f4e;if(_0x4a564e>=_0x305d19){_0x4a564e=_0x305d19;_0x234f4e=0xc8;}else{_0x234f4e=0xce;}_0x3d6706['status'](_0x234f4e);return _0x3d6706['set'](_0xfed1('0xd'),_0x1414be+'-'+_0x4a564e+'/'+_0x305d19)[_0xfed1('0x8')](_0x380e18);}return null;};}function saveUpdates(_0x569a6e,_0x17f4fe){return function(_0x5a3469){if(_0x5a3469){return _0x5a3469['update'](_0x569a6e)[_0xfed1('0xe')](function(_0x397af9){return _0x397af9;});}return null;};}function handleEntityNotFound(_0x532537,_0x2dde3a){return function(_0x5b9455){if(!_0x5b9455){_0x532537['sendStatus'](0x194);}return _0x5b9455;};}function handleError(_0xde25db,_0x39aa0c){_0x39aa0c=_0x39aa0c||0x1f4;return function(_0x1fbb7a){logger[_0xfed1('0xf')](_0x1fbb7a['stack']);if(_0x1fbb7a[_0xfed1('0x10')]){delete _0x1fbb7a['name'];}_0xde25db[_0xfed1('0x7')](_0x39aa0c)[_0xfed1('0x11')](_0x1fbb7a);};}exports['index']=function(_0x3d0517,_0xa72a20){var _0x5c0d9f={},_0x59509b={},_0x586ea6={'count':0x0,'rows':[]};var _0x1e5afb=_['map'](db[_0xfed1('0x12')][_0xfed1('0x13')],function(_0x51a860){return{'name':_0x51a860[_0xfed1('0x14')],'type':_0x51a860[_0xfed1('0x15')]['key']};});_0x59509b[_0xfed1('0x16')]=_[_0xfed1('0x17')](_0x1e5afb,_0xfed1('0x10'));_0x59509b[_0xfed1('0x18')]=_['keys'](_0x3d0517[_0xfed1('0x18')]);_0x59509b['filters']=_[_0xfed1('0x19')](_0x59509b[_0xfed1('0x16')],_0x59509b[_0xfed1('0x18')]);_0x59509b['filters']=_[_0xfed1('0x1a')](_0x59509b['filters'],[_0xfed1('0x1b'),_0xfed1('0x1c'),_0xfed1('0x1d'),_0xfed1('0x1e'),_0xfed1('0x1f'),_0xfed1('0x20'),'$ne',_0xfed1('0x21'),_0xfed1('0x22'),'$between',_0xfed1('0x23'),_0xfed1('0x24'),_0xfed1('0x25'),_0xfed1('0x26'),_0xfed1('0x27'),_0xfed1('0x28'),'$notILike',_0xfed1('0x26'),'$overlap',_0xfed1('0x29'),'$contained','$any']);_0x5c0d9f[_0xfed1('0x2a')]=_[_0xfed1('0x19')](_0x59509b[_0xfed1('0x16')],qs['fields'](_0x3d0517[_0xfed1('0x18')][_0xfed1('0x2b')]));_0x5c0d9f[_0xfed1('0x2a')]=_0x5c0d9f[_0xfed1('0x2a')][_0xfed1('0x2c')]?_0x5c0d9f[_0xfed1('0x2a')]:_0x59509b['model'];if(!_0x3d0517[_0xfed1('0x18')][_0xfed1('0x2d')]('nolimit')){_0x5c0d9f['limit']=qs[_0xfed1('0xc')](_0x3d0517[_0xfed1('0x18')][_0xfed1('0xc')]);_0x5c0d9f[_0xfed1('0x9')]=qs[_0xfed1('0x9')](_0x3d0517['query'][_0xfed1('0x9')]);}_0x5c0d9f[_0xfed1('0x2e')]=qs[_0xfed1('0x2f')](_0x3d0517[_0xfed1('0x18')][_0xfed1('0x2f')]);_0x5c0d9f['where']=qs[_0xfed1('0x30')](_['pick'](_0x3d0517[_0xfed1('0x18')],_0x59509b[_0xfed1('0x30')]),_0x1e5afb);if(_0x3d0517[_0xfed1('0x18')][_0xfed1('0x31')]){_0x5c0d9f[_0xfed1('0x32')]=_[_0xfed1('0x33')](_0x5c0d9f[_0xfed1('0x32')],{'$or':_[_0xfed1('0x17')](_0x1e5afb,function(_0x4d6aa3){if(_0x4d6aa3[_0xfed1('0x15')]!==_0xfed1('0x34')){var _0x45f106={};_0x45f106[_0x4d6aa3[_0xfed1('0x10')]]={'$like':'%'+_0x3d0517['query']['filter']+'%'};return _0x45f106;}})});}_0x5c0d9f=_[_0xfed1('0x33')]({},_0x5c0d9f,_0x3d0517[_0xfed1('0x35')]);var _0x1d06af={'where':_0x5c0d9f[_0xfed1('0x32')]};return db[_0xfed1('0x12')][_0xfed1('0xb')](_0x1d06af)[_0xfed1('0xe')](function(_0x2f183c){_0x586ea6['count']=_0x2f183c;if(_0x3d0517['query'][_0xfed1('0x36')]){_0x5c0d9f[_0xfed1('0x37')]=[{'all':!![]}];}return db['CmHopper'][_0xfed1('0x38')](_0x5c0d9f);})[_0xfed1('0xe')](function(_0x3b0973){_0x586ea6[_0xfed1('0x39')]=_0x3b0973;return _0x586ea6;})[_0xfed1('0xe')](respondWithFilteredResult(_0xa72a20,_0x5c0d9f))[_0xfed1('0x3a')](handleError(_0xa72a20,null));};exports[_0xfed1('0x3b')]=function(_0x4118d4,_0x3c27de){var _0x5f3e1f={'raw':!![],'where':{'id':_0x4118d4['params']['id']}},_0x4eec55={};_0x4eec55[_0xfed1('0x16')]=_[_0xfed1('0x3c')](db[_0xfed1('0x12')]['rawAttributes']);_0x4eec55[_0xfed1('0x18')]=_['keys'](_0x4118d4[_0xfed1('0x18')]);_0x4eec55[_0xfed1('0x30')]=_[_0xfed1('0x19')](_0x4eec55['model'],_0x4eec55[_0xfed1('0x18')]);_0x5f3e1f[_0xfed1('0x2a')]=_[_0xfed1('0x19')](_0x4eec55['model'],qs[_0xfed1('0x2b')](_0x4118d4['query'][_0xfed1('0x2b')]));_0x5f3e1f[_0xfed1('0x2a')]=_0x5f3e1f[_0xfed1('0x2a')][_0xfed1('0x2c')]?_0x5f3e1f[_0xfed1('0x2a')]:_0x4eec55[_0xfed1('0x16')];if(_0x4118d4[_0xfed1('0x18')][_0xfed1('0x36')]){_0x5f3e1f[_0xfed1('0x37')]=[{'all':!![]}];}_0x5f3e1f=_['merge']({},_0x5f3e1f,_0x4118d4[_0xfed1('0x35')]);return db[_0xfed1('0x12')][_0xfed1('0x3d')](_0x5f3e1f)['then'](handleEntityNotFound(_0x3c27de,null))['then'](respondWithResult(_0x3c27de,null))[_0xfed1('0x3a')](handleError(_0x3c27de,null));};exports[_0xfed1('0x3e')]=function(_0x46f9d3,_0xf39b8c){return db[_0xfed1('0x12')][_0xfed1('0x3e')](_0x46f9d3[_0xfed1('0x3f')],{})[_0xfed1('0xe')](respondWithResult(_0xf39b8c,0xc9))[_0xfed1('0x3a')](handleError(_0xf39b8c,null));};exports[_0xfed1('0x40')]=function(_0x61f65b,_0x1db6dc){if(_0x61f65b['body']['id']){delete _0x61f65b[_0xfed1('0x3f')]['id'];}return db[_0xfed1('0x12')][_0xfed1('0x3d')]({'where':{'id':_0x61f65b[_0xfed1('0x41')]['id']}})[_0xfed1('0xe')](handleEntityNotFound(_0x1db6dc,null))[_0xfed1('0xe')](saveUpdates(_0x61f65b['body'],null))[_0xfed1('0xe')](respondWithResult(_0x1db6dc,null))[_0xfed1('0x3a')](handleError(_0x1db6dc,null));};exports[_0xfed1('0x42')]=function(_0x4afcc1,_0x22874a){return db[_0xfed1('0x12')][_0xfed1('0x42')]()[_0xfed1('0xe')](respondWithResult(_0x22874a,null))['catch'](handleError(_0x22874a,null));};exports[_0xfed1('0x43')]=function(_0x2a346e,_0x2c32af){var _0x42761f;var _0x14745e=_0x2a346e[_0xfed1('0x41')]['id'];return db[_0xfed1('0x12')][_0xfed1('0x3d')]({'where':{'id':_0x2a346e[_0xfed1('0x41')]['id']}})[_0xfed1('0xe')](handleEntityNotFound(_0x2c32af,null))[_0xfed1('0xe')](function(_0xb3a534){if(_0xb3a534){return _0xb3a534[_0xfed1('0x43')]()[_0xfed1('0xe')](function(_0x33c77a){return _0x33c77a;});}})[_0xfed1('0xe')](function(_0xd1f984){_0x42761f=_0xd1f984;if(_0xd1f984){if(_0xd1f984[_0xfed1('0x44')]||_0xd1f984['CampaignId']){return db[_0xd1f984['VoiceQueueId']?_0xfed1('0x45'):_0xfed1('0x46')][_0xfed1('0x3d')]({'where':{'id':_0xd1f984[_0xfed1('0x44')]?_0xd1f984['VoiceQueueId']:_0xd1f984[_0xfed1('0x47')]},'attributes':['id',_0xfed1('0x10')],'raw':!![]});}}})['then'](function(_0x4f393c){var _0x49f696={};if(_0x4f393c){_[_0xfed1('0x33')](_0x49f696,_[_0xfed1('0x48')](_0x42761f[_0xfed1('0x49')],[_0xfed1('0x4a'),_0xfed1('0x4b'),'id']));_0x49f696[_0xfed1('0x4c')]=0x15;_0x49f696[_0xfed1('0x4d')]=_0xfed1('0x4e');_0x49f696[_0xfed1('0x4f')]=_0x4f393c[_0xfed1('0x10')];_0x49f696['membername']=_0x2a346e['user'][_0xfed1('0x10')];_0x49f696[_0xfed1('0x50')]=_0x2a346e[_0xfed1('0x51')]['id'];_0x49f696[_0xfed1('0x4e')]=!![];_0x49f696[_0xfed1('0x52')]=moment()[_0xfed1('0x53')](_0xfed1('0x54'));_0x49f696[_0xfed1('0x55')]=_0x42761f[_0xfed1('0x56')];_0x49f696[_0xfed1('0x57')]=_0x42761f[_0xfed1('0x44')]?_0xfed1('0x58'):_0xfed1('0x59');return db[_0xfed1('0x5a')][_0xfed1('0x3d')]({'where':{'id':_0x49f696[_0xfed1('0x5b')]},'attributes':[_0xfed1('0x5c'),'lastName']})['then'](function(_0x2fe019){if(!_[_0xfed1('0x5d')](_0x2c32af)&&!_[_0xfed1('0x5d')](_0x2fe019[_0xfed1('0x5c')])){_0x49f696[_0xfed1('0x5e')]=_0x2fe019[_0xfed1('0x5c')];if(!_[_0xfed1('0x5d')](_0x2fe019[_0xfed1('0x5f')])){_0x49f696[_0xfed1('0x5e')]+='\x20'+_0x2fe019[_0xfed1('0x5f')];}}})[_0xfed1('0x60')](function(){return db[_0xfed1('0x61')][_0xfed1('0x3e')](_0x49f696);});}})[_0xfed1('0xe')](function(_0x59ecc4){return db[_0xfed1('0x62')]['destroy']({'where':{'CmHopperId':_0x14745e}});})['then'](function(){return _0x2c32af[_0xfed1('0x7')](0xcc)['end']();})[_0xfed1('0x3a')](handleError(_0x2c32af,null));};exports['getPreview']=function(_0x390fc0,_0x8e29d1){var _0x53f0ab=[];return db[_0xfed1('0x5a')][_0xfed1('0x42')]()['then'](function(_0x29b51e){_0x53f0ab=_[_0xfed1('0x3c')](_0x29b51e);return _0x390fc0[_0xfed1('0x51')][_0xfed1('0x63')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xfed1('0x64')},'attributes':['id',_0xfed1('0x65'),_0xfed1('0x66')],'raw':!![]});})[_0xfed1('0xe')](function(_0x23347a){if(_0x23347a&&_0x23347a[_0xfed1('0x2c')]){return db[_0xfed1('0x67')][_0xfed1('0x68')](function(_0x5c043d){var _0x2d66ec={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfed1('0x53')](_0xfed1('0x54'))},'VoiceQueueId':{'$in':_[_0xfed1('0x17')](_0x23347a,'id')},'$or':[{'UserId':null},{'UserId':_0x390fc0[_0xfed1('0x51')]['id']}]};var _0x3d7be2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x23347a)['filter'](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0xfed1('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x390fc0[_0xfed1('0x51')]['id']}]};var _0x3aea22={'$or':[_0x2d66ec,_0x3d7be2]};var _0x2fb9b2=[];if(_0x390fc0['body'][_0xfed1('0x6a')]&&_0x390fc0['body'][_0xfed1('0x6a')]===_0xfed1('0x6b')){if(!_[_0xfed1('0x6c')](_0x390fc0[_0xfed1('0x3f')][_0xfed1('0x6d')])){_0x3aea22['id']={'$in':_0x390fc0['body'][_0xfed1('0x6d')]};}_0x2fb9b2=[[_0xfed1('0x6e'),_0xfed1('0x6f')],['scheduledAt',_0x23347a[0x0][_0xfed1('0x65')]===_0xfed1('0x6f')?_0xfed1('0x70'):_0xfed1('0x6f')],db['sequelize'][_0xfed1('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xfed1('0x70')]];}else{if(!_[_0xfed1('0x6c')](_0x390fc0['body']['hopperIds'])){_0x3aea22['id']={'$notIn':_0x390fc0[_0xfed1('0x3f')][_0xfed1('0x6d')]};}_0x2fb9b2=[[_0xfed1('0x6e'),_0xfed1('0x70')],['scheduledAt',_0x23347a[0x0][_0xfed1('0x65')]],db[_0xfed1('0x67')][_0xfed1('0x71')](_0xfed1('0x72')),['id',_0xfed1('0x6f')]];}return db[_0xfed1('0x12')]['findOne']({'attributes':['id',_0xfed1('0x73'),_0xfed1('0x56'),'recallme'],'where':_0x3aea22,'order':_0x2fb9b2,'transaction':_0x5c043d,'lock':_0x5c043d[_0xfed1('0x74')][_0xfed1('0x75')],'include':[{'model':db[_0xfed1('0x5a')],'as':_0xfed1('0x76'),'attributes':_0x53f0ab,'include':[{'model':db[_0xfed1('0x77')],'as':_0xfed1('0x78'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xfed1('0x79'),'attributes':['id','name']},{'model':db[_0xfed1('0x45')],'as':_0xfed1('0x7a'),'attributes':['id',_0xfed1('0x10'),_0xfed1('0x7b')]}]})[_0xfed1('0xe')](function(_0x179f85){if(_0x179f85){return _0x179f85[_0xfed1('0x40')]({'UserId':_0x390fc0[_0xfed1('0x51')]['id']},{'transaction':_0x5c043d});}});});}})[_0xfed1('0xe')](handleEntityNotFound(_0x8e29d1,null))[_0xfed1('0xe')](respondWithResult(_0x8e29d1,null))['catch'](handleError(_0x8e29d1,null));};exports[_0xfed1('0x7c')]=function(_0xef7276,_0x56421e,_0x544605){var _0x2d6692=[];var _0x51994d=_0xef7276[_0xfed1('0x41')]['id'];var _0x1497fb=_0xef7276[_0xfed1('0x51')]['id'];return db['CmContact'][_0xfed1('0x42')]()[_0xfed1('0xe')](function(_0x368dd9){_0x2d6692=_[_0xfed1('0x3c')](_0x368dd9);return db[_0xfed1('0x67')]['transaction'](function(_0x287b63){const _0x34f590={'id':_0x51994d};return db[_0xfed1('0x12')][_0xfed1('0x7d')]({'attributes':['id',_0xfed1('0x73'),'recallme'],'where':_0x34f590,'transaction':_0x287b63,'lock':_0x287b63[_0xfed1('0x74')][_0xfed1('0x75')],'include':[{'model':db[_0xfed1('0x5a')],'as':_0xfed1('0x76'),'attributes':_0x2d6692,'include':[{'model':db[_0xfed1('0x77')],'as':_0xfed1('0x78'),'attributes':['id',_0xfed1('0x10')]}]},{'model':db[_0xfed1('0x7e')],'as':_0xfed1('0x79'),'attributes':['id',_0xfed1('0x10')]},{'model':db['VoiceQueue'],'as':_0xfed1('0x7a'),'attributes':['id',_0xfed1('0x10'),_0xfed1('0x7b')]}]})[_0xfed1('0xe')](function(_0x194f42){if(_0x194f42){return _0x194f42['update']({'UserId':_0x1497fb},{'transaction':_0x287b63});}});});})[_0xfed1('0xe')](handleEntityNotFound(_0x56421e,null))[_0xfed1('0xe')](respondWithResult(_0x56421e,null))[_0xfed1('0x3a')](handleError(_0x56421e,null));};exports[_0xfed1('0x7f')]=function(_0x221ed8,_0xb76860){return _0x221ed8[_0xfed1('0x51')][_0xfed1('0x63')]({'where':{'type':_0xfed1('0x80'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0xc3b72a){if(_0xc3b72a&&_0xc3b72a['length']){return db[_0xfed1('0x12')][_0xfed1('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfed1('0x53')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0xc3b72a,'id')},'$or':[{'UserId':null},{'UserId':_0x221ed8[_0xfed1('0x51')]['id']}]}});}return 0x0;})['then'](function(_0x173790){if(!_['isNil'](_0x173790)&&_[_0xfed1('0x81')](_0x173790)){return _0xb76860[_0xfed1('0x7')](0xc8)[_0xfed1('0x8')]({'contacts':_0x173790});}else{logger[_0xfed1('0xf')](_0xfed1('0x82'),'getOpenContacts',0x194,_0xfed1('0x83'));_0xb76860[_0xfed1('0x84')](0x194);}})['catch'](handleError(_0xb76860,null));};exports[_0xfed1('0x85')]=function(_0x130b1f,_0x4f879d){var _0x12ce90=shared[_0xfed1('0x86')];var _0x3668c2=[];_['map'](_0x12ce90,function(_0x473d4a){_0x3668c2[_0xfed1('0x87')]({'id':_0x473d4a['name'],'name':_0x473d4a[_0xfed1('0x10')],'utcOffset':_0x473d4a[_0xfed1('0x88')]});});return _0x4f879d[_0xfed1('0x7')](0xc8)['json']({'tz':_0x3668c2});};exports[_0xfed1('0x89')]=function(_0x36d7de,_0x49f600){var _0x48172c=shared[_0xfed1('0x86')];var _0x33755c={};if(!_[_0xfed1('0x5d')](_0x48172c[_0x36d7de[_0xfed1('0x3f')]['id']]))_0x33755c=_0x48172c[_0x36d7de[_0xfed1('0x3f')]['id']];return _0x49f600[_0xfed1('0x7')](0xc8)[_0xfed1('0x8')](_0x33755c);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 895ece0..4a38c9d 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x3b8eca,_0x53dc40){var _0xa6e244=function(_0x58b276){while(--_0x58b276){_0x3b8eca['push'](_0x3b8eca['shift']());}};_0xa6e244(++_0x53dc40);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0xb9f2c1,_0x89514b){var _0x53ddea=function(_0x1b346e){while(--_0x1b346e){_0xb9f2c1['push'](_0xb9f2c1['shift']());}};_0x53ddea(++_0x89514b);}(_0x7c09,0x102));var _0x97c0=function(_0x44943a,_0x573e75){_0x44943a=_0x44943a-0x0;var _0x463252=_0x7c09[_0x44943a];return _0x463252;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('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 acd23ca..7925f53 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 _0x8228=['phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','\x20MINUTE','NOW()','CmList','lodash','../../mysqldb','../../config/logger','rpc','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','GetCmHopper','catch','ShowCmHopper','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetContactByPhone','findOne'];(function(_0x4cc788,_0x25deab){var _0x523ee1=function(_0x533ab4){while(--_0x533ab4){_0x4cc788['push'](_0x4cc788['shift']());}};_0x523ee1(++_0x25deab);}(_0x8228,0xae));var _0x8822=function(_0x38ad91,_0xf3df69){_0x38ad91=_0x38ad91-0x0;var _0x432384=_0x8228[_0x38ad91];return _0x432384;};'use strict';var _=require(_0x8822('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var db=require(_0x8822('0x1'))['db'];var logger=require(_0x8822('0x2'))(_0x8822('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x8822('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1244a3,_0x14f109,_0x45f662){return new BPromise(function(_0x20def9,_0x15734e){return client[_0x8822('0x5')](_0x1244a3,_0x45f662)[_0x8822('0x6')](function(_0x4ac6d3){logger[_0x8822('0x7')](_0x8822('0x8'),_0x14f109,'request\x20sent');logger[_0x8822('0x9')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x14f109,_0x8822('0xa'),JSON[_0x8822('0xb')](_0x4ac6d3));if(_0x4ac6d3[_0x8822('0xc')]){if(_0x4ac6d3['error'][_0x8822('0xd')]===0x1f4){logger[_0x8822('0xc')](_0x8822('0x8'),_0x14f109,_0x4ac6d3[_0x8822('0xc')][_0x8822('0xe')]);return _0x15734e(_0x4ac6d3[_0x8822('0xc')][_0x8822('0xe')]);}logger[_0x8822('0xc')](_0x8822('0x8'),_0x14f109,_0x4ac6d3[_0x8822('0xc')][_0x8822('0xe')]);return _0x20def9(_0x4ac6d3[_0x8822('0xc')][_0x8822('0xe')]);}else{logger[_0x8822('0x7')](_0x8822('0x8'),_0x14f109,_0x8822('0xa'));_0x20def9(_0x4ac6d3[_0x8822('0xf')]['message']);}})['catch'](function(_0x25994e){logger[_0x8822('0xc')](_0x8822('0x8'),_0x14f109,_0x25994e);_0x15734e(_0x25994e);});});}exports['GetCmHopper']=function(_0xadf7a2){var _0x41be81=this;return new Promise(function(_0x341c79,_0x23027a){return db[_0x8822('0x10')][_0x8822('0x11')]({'raw':_0xadf7a2['options']?_0xadf7a2[_0x8822('0x12')][_0x8822('0x13')]===undefined?!![]:![]:!![],'where':_0xadf7a2[_0x8822('0x12')]?_0xadf7a2['options'][_0x8822('0x14')]||null:null,'attributes':_0xadf7a2[_0x8822('0x12')]?_0xadf7a2[_0x8822('0x12')][_0x8822('0x15')]||null:null,'limit':_0xadf7a2['options']?_0xadf7a2[_0x8822('0x12')][_0x8822('0x16')]||null:null,'include':_0xadf7a2[_0x8822('0x12')]?_0xadf7a2[_0x8822('0x12')][_0x8822('0x17')]?_['map'](_0xadf7a2[_0x8822('0x12')][_0x8822('0x17')],function(_0x1c16da){return{'model':db[_0x1c16da[_0x8822('0x18')]],'as':_0x1c16da['as'],'attributes':_0x1c16da[_0x8822('0x15')],'include':_0x1c16da['include']?_[_0x8822('0x19')](_0x1c16da[_0x8822('0x17')],function(_0x2440ea){return{'model':db[_0x2440ea[_0x8822('0x18')]],'as':_0x2440ea['as'],'attributes':_0x2440ea[_0x8822('0x15')],'include':_0x2440ea[_0x8822('0x17')]?_[_0x8822('0x19')](_0x2440ea['include'],function(_0x206f40){return{'model':db[_0x206f40['model']],'as':_0x206f40['as'],'attributes':_0x206f40[_0x8822('0x15')]};}):[]};}):[]};}):[]:[]})[_0x8822('0x6')](function(_0x4c9c8f){logger[_0x8822('0x7')]('GetCmHopper',_0xadf7a2);logger[_0x8822('0x9')](_0x8822('0x1a'),_0xadf7a2,JSON[_0x8822('0xb')](_0x4c9c8f));_0x341c79(_0x4c9c8f);})[_0x8822('0x1b')](function(_0x33d503){logger[_0x8822('0xc')](_0x8822('0x1a'),_0x33d503[_0x8822('0xe')],_0xadf7a2);_0x23027a(_0x41be81[_0x8822('0xc')](0x1f4,_0x33d503[_0x8822('0xe')]));});});};exports['ShowCmHopper']=function(_0x4fe33c){var _0x2e6e0a=this;return new Promise(function(_0x8b26f9,_0x72c03b){return db[_0x8822('0x10')]['find']({'raw':_0x4fe33c['options']?_0x4fe33c['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fe33c['options']?_0x4fe33c[_0x8822('0x12')][_0x8822('0x14')]||null:null,'attributes':_0x4fe33c[_0x8822('0x12')]?_0x4fe33c[_0x8822('0x12')]['attributes']||null:null,'include':_0x4fe33c[_0x8822('0x12')]?_0x4fe33c[_0x8822('0x12')][_0x8822('0x17')]?_['map'](_0x4fe33c[_0x8822('0x12')][_0x8822('0x17')],function(_0x4d016a){return{'model':db[_0x4d016a[_0x8822('0x18')]],'as':_0x4d016a['as'],'attributes':_0x4d016a[_0x8822('0x15')],'include':_0x4d016a[_0x8822('0x17')]?_['map'](_0x4d016a[_0x8822('0x17')],function(_0x98c00e){return{'model':db[_0x98c00e[_0x8822('0x18')]],'as':_0x98c00e['as'],'attributes':_0x98c00e[_0x8822('0x15')],'include':_0x98c00e[_0x8822('0x17')]?_[_0x8822('0x19')](_0x98c00e[_0x8822('0x17')],function(_0x597a84){return{'model':db[_0x597a84[_0x8822('0x18')]],'as':_0x597a84['as'],'attributes':_0x597a84['attributes']};}):[]};}):[]};}):[]:[]})[_0x8822('0x6')](function(_0x2f00be){logger[_0x8822('0x7')](_0x8822('0x1c'),_0x4fe33c);logger['debug'](_0x8822('0x1c'),_0x4fe33c,JSON['stringify'](_0x2f00be));_0x8b26f9(_0x2f00be);})[_0x8822('0x1b')](function(_0x45877f){logger[_0x8822('0xc')](_0x8822('0x1c'),_0x45877f[_0x8822('0xe')],_0x4fe33c);_0x72c03b(_0x2e6e0a['error'](0x1f4,_0x45877f[_0x8822('0xe')]));});});};exports[_0x8822('0x1d')]=function(_0x2b8893){var _0x443e48=this;return new Promise(function(_0x155777,_0x73affd){return db['CmHopper']['create'](_0x2b8893['body'],{'raw':_0x2b8893[_0x8822('0x12')]?_0x2b8893[_0x8822('0x12')][_0x8822('0x13')]===undefined?!![]:![]:!![]})[_0x8822('0x6')](function(_0xc63c51){logger[_0x8822('0x7')]('CreateCmHopper',_0x2b8893);logger[_0x8822('0x9')](_0x8822('0x1d'),_0x2b8893,JSON['stringify'](_0xc63c51));_0x155777(_0xc63c51);})[_0x8822('0x1b')](function(_0x23307b){logger[_0x8822('0xc')](_0x8822('0x1d'),_0x23307b[_0x8822('0xe')],_0x2b8893);_0x73affd(_0x443e48[_0x8822('0xc')](0x1f4,_0x23307b[_0x8822('0xe')]));});});};exports[_0x8822('0x1e')]=function(_0x11d986){var _0x3dc9e1=this;return new Promise(function(_0xfe5580,_0x47789d){return db[_0x8822('0x10')][_0x8822('0x1f')](_0x11d986['body'],{'raw':_0x11d986['options']?_0x11d986['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d986['options']?_0x11d986[_0x8822('0x12')][_0x8822('0x14')]||null:null,'attributes':_0x11d986[_0x8822('0x12')]?_0x11d986[_0x8822('0x12')][_0x8822('0x15')]||null:null,'limit':_0x11d986[_0x8822('0x12')]?_0x11d986[_0x8822('0x12')]['limit']||null:null})[_0x8822('0x6')](function(_0x4902c8){logger[_0x8822('0x7')](_0x8822('0x1e'),_0x11d986);logger['info'](_0x8822('0x20'),JSON[_0x8822('0xb')](_0x11d986[_0x8822('0x12')][_0x8822('0x14')]),_0x11d986[_0x8822('0x21')][_0x8822('0x22')]);logger['debug'](_0x8822('0x1e'),_0x11d986,JSON[_0x8822('0xb')](_0x4902c8));_0xfe5580(_0x4902c8);})['catch'](function(_0xa14701){logger['error'](_0x8822('0x1e'),_0xa14701[_0x8822('0xe')],_0x11d986);_0x47789d(_0x3dc9e1[_0x8822('0xc')](0x1f4,_0xa14701['message']));});});};exports[_0x8822('0x23')]=function(_0xf897e2){var _0x15bf6f=this;return new Promise(function(_0x2c480c,_0x4afbff){return db[_0x8822('0x10')][_0x8822('0x24')]({'where':_0xf897e2['options']?_0xf897e2[_0x8822('0x12')][_0x8822('0x14')]||null:null})[_0x8822('0x6')](function(_0xe47104){logger[_0x8822('0x7')](_0x8822('0x23'),_0xf897e2);logger[_0x8822('0x9')](_0x8822('0x23'),_0xf897e2,JSON[_0x8822('0xb')](_0xe47104));_0x2c480c(_0xe47104);})[_0x8822('0x1b')](function(_0x340be4){logger[_0x8822('0xc')](_0x8822('0x23'),_0x340be4['message'],_0xf897e2);_0x4afbff(_0x15bf6f['error'](0x1f4,_0x340be4['message']));});});};exports['GetContactDialer']=function(_0xec9bab){var _0x217e2b=this;return new Promise(function(_0x35b271,_0x65bf95){return db[_0x8822('0x25')][_0x8822('0x26')]()[_0x8822('0x6')](function(_0x460d12){return db[_0x8822('0x27')]['transaction'](function(_0x17c8f9){return db[_0x8822('0x10')][_0x8822('0x11')]({'where':_0xec9bab[_0x8822('0x12')]?_0xec9bab[_0x8822('0x12')][_0x8822('0x14')]||null:null,'attributes':_0xec9bab[_0x8822('0x12')]?_0xec9bab['options'][_0x8822('0x15')]||null:null,'limit':_0xec9bab['options']?_0xec9bab[_0x8822('0x12')][_0x8822('0x16')]||null:null,'order':_0xec9bab[_0x8822('0x12')]?_0xec9bab['options'][_0x8822('0x28')]||null:null,'transaction':_0x17c8f9,'lock':_0x17c8f9[_0x8822('0x29')][_0x8822('0x2a')],'include':[{'model':db[_0x8822('0x25')],'as':_0x8822('0x2b'),'attributes':_[_0x8822('0x2c')](_0x460d12)},{'model':db[_0x8822('0x2d')],'as':_0x8822('0x2e'),'attributes':['id',_0x8822('0x2f'),_0x8822('0x30')]}]})['then'](function(_0x16fc7b){var _0x140a7f=[];var _0x3e8b28=[];for(var _0x57a941=0x0;_0x57a941<_0x16fc7b[_0x8822('0x31')];_0x57a941+=0x1){var _0x5befc5=_0x16fc7b[_0x57a941]['UserId'];if(_0x5befc5===null){_0x140a7f[_0x8822('0x32')](_0x16fc7b[_0x57a941][_0x8822('0x1f')](_0xec9bab[_0x8822('0x21')],{'transaction':_0x17c8f9}));}else if(!_0x3e8b28[_0x8822('0x33')](_0x5befc5)){_0x3e8b28[_0x8822('0x32')](_0x5befc5);_0x140a7f[_0x8822('0x32')](_0x16fc7b[_0x57a941][_0x8822('0x1f')](_0xec9bab['body'],{'transaction':_0x17c8f9}));}}return BPromise[_0x8822('0x34')](_0x140a7f);});})[_0x8822('0x6')](function(_0x2593eb){logger[_0x8822('0x7')](_0x8822('0x35'),_0xec9bab);if(_0x2593eb[_0x8822('0x31')]>0x0){logger[_0x8822('0x7')](_0x8822('0x36'),_0x2593eb[0x0][_0x8822('0x37')]['id'],_0x2593eb[0x0][_0x8822('0x37')]['ContactId'],_0x2593eb[0x0]['dataValues']['active']);}logger['debug'](_0x8822('0x35'),_0xec9bab,JSON[_0x8822('0xb')](_0x2593eb));_0x35b271(_0x2593eb);})[_0x8822('0x1b')](function(_0x244b0e){logger['error']('GetContactDialer',_0x244b0e['message'],_0xec9bab);_0x65bf95(_0x217e2b['error'](0x1f4,_0x244b0e['message']));});});});};exports[_0x8822('0x38')]=function(_0x46714f){var _0x213af5=this;return new Promise(function(_0x3ba3c1,_0x7c4fc4){return db[_0x8822('0x27')][_0x8822('0x39')](function(_0x1c8f6e){return db[_0x8822('0x3a')]['create'](_0x46714f[_0x8822('0x21')],{'raw':_0x46714f[_0x8822('0x12')]?_0x46714f[_0x8822('0x12')][_0x8822('0x13')]===undefined?!![]:![]:!![],'transaction':_0x1c8f6e})[_0x8822('0x6')](function(){logger[_0x8822('0x7')](_0x8822('0x3b'),JSON[_0x8822('0xb')](_0x46714f['options'][_0x8822('0x14')]),_0x46714f[_0x8822('0x12')][_0x8822('0x14')][_0x8822('0x22')]);return db[_0x8822('0x10')][_0x8822('0x24')]({'where':_0x46714f[_0x8822('0x12')]?_0x46714f[_0x8822('0x12')][_0x8822('0x14')]||null:null,'transaction':_0x1c8f6e});});})[_0x8822('0x6')](function(_0x41d528){logger['info'](_0x8822('0x38'),_0x46714f);logger[_0x8822('0x9')](_0x8822('0x38'),_0x46714f,JSON[_0x8822('0xb')](_0x41d528));_0x3ba3c1(_0x41d528);})[_0x8822('0x1b')](function(_0xdff5b){logger['error'](_0x8822('0x38'),_0xdff5b['message'],_0x46714f);_0x7c4fc4(_0x213af5[_0x8822('0xc')](0x1f4,_0xdff5b[_0x8822('0xe')]));});});};exports[_0x8822('0x3c')]=function(_0x46c379){var _0x14eb11=this;return new Promise(function(_0x556dec,_0x392276){return db[_0x8822('0x10')][_0x8822('0x11')]({'raw':_0x46c379[_0x8822('0x12')]?_0x46c379[_0x8822('0x12')][_0x8822('0x13')]===undefined?!![]:![]:!![],'where':_0x46c379[_0x8822('0x12')]?_0x46c379[_0x8822('0x12')]['where']||null:null,'attributes':[[db[_0x8822('0x27')]['fn'](_0x8822('0x3d'),db[_0x8822('0x27')]['fn']('IF',db['sequelize'][_0x8822('0x3e')](_0x8822('0x3f')+util[_0x8822('0x40')](_0x8822('0x41'),moment()[_0x8822('0x40')](_0x8822('0x42')))+_0x8822('0x43')))),_0x8822('0x44')]]})[_0x8822('0x6')](function(_0x3244b2){logger[_0x8822('0x7')](_0x8822('0x3c'),_0x46c379);logger[_0x8822('0x9')](_0x8822('0x3c'),_0x46c379,JSON[_0x8822('0xb')](_0x3244b2));_0x556dec(_0x3244b2);})['catch'](function(_0x491399){logger[_0x8822('0xc')](_0x8822('0x3c'),_0x491399['message'],_0x46c379);_0x392276(_0x14eb11[_0x8822('0xc')](0x1f4,_0x491399[_0x8822('0xe')]));});});};exports[_0x8822('0x45')]=function(_0x3e3b8a){var _0x4bfa86=this;return new Promise(function(_0x2c1881,_0x3d4d81){return db[_0x8822('0x25')][_0x8822('0x26')]()['then'](function(_0x58cd42){return db['sequelize']['transaction'](function(_0x44417a){return db[_0x8822('0x10')][_0x8822('0x11')]({'where':_0x3e3b8a['options']?_0x3e3b8a[_0x8822('0x12')][_0x8822('0x14')]||null:null,'attributes':_0x3e3b8a[_0x8822('0x12')]?_0x3e3b8a['options'][_0x8822('0x15')]||null:null,'limit':0x1,'order':_0x3e3b8a['options']?_0x3e3b8a['options'][_0x8822('0x28')]||null:null,'group':db[_0x8822('0x10')]['UserId'],'transaction':_0x44417a,'lock':_0x44417a['LOCK']['UPDATE'],'include':_0x3e3b8a[_0x8822('0x12')]?_0x3e3b8a[_0x8822('0x12')][_0x8822('0x17')]?_[_0x8822('0x19')](_0x3e3b8a[_0x8822('0x12')][_0x8822('0x17')],function(_0x27be0d){return{'model':db[_0x27be0d[_0x8822('0x18')]],'as':_0x27be0d['as'],'attributes':_0x27be0d[_0x8822('0x15')],'include':_0x27be0d[_0x8822('0x17')]?_[_0x8822('0x19')](_0x27be0d[_0x8822('0x17')],function(_0x2318f7){return{'model':db[_0x2318f7[_0x8822('0x18')]],'as':_0x2318f7['as'],'attributes':_0x2318f7[_0x8822('0x15')],'include':_0x2318f7[_0x8822('0x17')]?_['map'](_0x2318f7[_0x8822('0x17')],function(_0x14f531){return{'model':db[_0x14f531[_0x8822('0x18')]],'as':_0x14f531['as'],'attributes':_0x14f531['attributes']};}):[]};}):[]};}):[]:[]})[_0x8822('0x6')](function(_0x3eb222){var _0x3ade72=[];for(var _0x10a986=0x0;_0x10a986<_0x3eb222[_0x8822('0x31')];_0x10a986+=0x1){_0x3ade72[_0x8822('0x32')](_0x3eb222[_0x10a986][_0x8822('0x1f')](_0x3e3b8a['body'],{'transaction':_0x44417a}));}return BPromise[_0x8822('0x34')](_0x3ade72);});})['then'](function(_0x4f28b9){logger['info'](_0x8822('0x45'),_0x3e3b8a);logger[_0x8822('0x9')](_0x8822('0x45'),_0x3e3b8a,JSON['stringify'](_0x4f28b9));_0x2c1881(_0x4f28b9);})[_0x8822('0x1b')](function(_0x7ad0f8){logger['error']('GetContactRecallMe',_0x7ad0f8[_0x8822('0xe')],_0x3e3b8a);_0x3d4d81(_0x4bfa86[_0x8822('0xc')](0x1f4,_0x7ad0f8['message']));});});});};exports['GetCmHopperPreview']=function(_0x1833ec){var _0xf68dc7=this;return new Promise(function(_0x2ecce0,_0x3607bf){db['CmContact'][_0x8822('0x26')]()[_0x8822('0x6')](function(_0x3c18c8){return db[_0x8822('0x10')][_0x8822('0x11')]({'raw':_0x1833ec[_0x8822('0x12')]?_0x1833ec[_0x8822('0x12')][_0x8822('0x13')]===undefined?!![]:![]:!![],'where':_0x1833ec[_0x8822('0x12')]?_0x1833ec['options']['where']||null:null,'attributes':_0x1833ec[_0x8822('0x12')]?_0x1833ec[_0x8822('0x12')]['attributes']||null:null,'limit':_0x1833ec['options']?_0x1833ec['options'][_0x8822('0x16')]||null:null,'include':_0x1833ec['options']?_0x1833ec[_0x8822('0x12')]['include']?_[_0x8822('0x19')](_0x1833ec[_0x8822('0x12')][_0x8822('0x17')],function(_0x160876){return{'model':db[_0x160876[_0x8822('0x18')]],'as':_0x160876['as'],'attributes':_0x160876['as']===_0x8822('0x2b')?_[_0x8822('0x2c')](_0x3c18c8):_0x160876[_0x8822('0x15')],'include':_0x160876[_0x8822('0x17')]?_[_0x8822('0x19')](_0x160876[_0x8822('0x17')],function(_0x1c157b){return{'model':db[_0x1c157b[_0x8822('0x18')]],'as':_0x1c157b['as'],'attributes':_0x1c157b['attributes'],'include':_0x1c157b[_0x8822('0x17')]?_[_0x8822('0x19')](_0x1c157b[_0x8822('0x17')],function(_0x3fe31c){return{'model':db[_0x3fe31c['model']],'as':_0x3fe31c['as'],'attributes':_0x3fe31c[_0x8822('0x15')]};}):[]};}):[]};}):[]:[]})[_0x8822('0x6')](function(_0x2962a9){logger[_0x8822('0x7')](_0x8822('0x1a'),_0x1833ec);logger[_0x8822('0x9')](_0x8822('0x1a'),_0x1833ec,JSON[_0x8822('0xb')](_0x2962a9));_0x2ecce0(_0x2962a9);})[_0x8822('0x1b')](function(_0x4bb606){logger[_0x8822('0xc')]('GetCmHopper',_0x4bb606['message'],_0x1833ec);_0x3607bf(_0xf68dc7[_0x8822('0xc')](0x1f4,_0x4bb606[_0x8822('0xe')]));});});});};exports[_0x8822('0x46')]=function(_0x170d9e){var _0x491898=this;return new Promise(function(_0x22e22c,_0x2c264c){return db[_0x8822('0x25')][_0x8822('0x47')]({'raw':!![],'where':{'phone':_0x170d9e[_0x8822('0x12')][_0x8822('0x14')][_0x8822('0x48')]},'attributes':['id',_0x8822('0x49')],'order':[['id','DESC']]})[_0x8822('0x6')](function(_0x4b5521){logger['info']('getContactByPhone',_0x170d9e);logger['debug'](_0x8822('0x4a'),_0x170d9e,JSON['stringify'](_0x4b5521));_0x22e22c(_0x4b5521);})['catch'](function(_0x15df87){logger[_0x8822('0xc')]('getContactByPhone',_0x15df87[_0x8822('0xe')],_0x170d9e);_0x2c264c(_0x491898[_0x8822('0xc')](0x1f4,_0x15df87[_0x8822('0xe')]));});});};exports[_0x8822('0x4b')]=function(_0x2fb14d){var _0x471ef0=this;return new Promise(function(_0x50eb98,_0x4007a0){return db[_0x8822('0x27')]['transaction'](function(_0x7edb9a){return db[_0x8822('0x10')][_0x8822('0x1f')]({'active':![]},{'where':{},'transaction':_0x7edb9a})[_0x8822('0x6')](function(_0x456134){logger[_0x8822('0x7')]('ResetActiveCalls',_0x2fb14d);logger['debug'](_0x8822('0x4b'),_0x2fb14d,JSON[_0x8822('0xb')](_0x456134));_0x50eb98(_0x456134);})[_0x8822('0x1b')](function(_0x13eead){logger['error'](_0x8822('0x4b'),_0x13eead['message'],_0x2fb14d);_0x4007a0(_0x471ef0[_0x8822('0xc')](0x1f4,_0x13eead['message']));});});});};exports[_0x8822('0x4c')]=function(_0x2b49fe){var _0x32af21=this;var _0x4fe335=_0x2b49fe[_0x8822('0x21')][_0x8822('0x14')]['voiceQueueIds'];var _0x6f7066=_0x2b49fe[_0x8822('0x21')][_0x8822('0x14')][_0x8822('0x4d')];var _0xdc0238=_0x2b49fe[_0x8822('0x21')][_0x8822('0x14')][_0x8822('0x4e')];return new Promise(function(_0x4f5f4b,_0x3ce391){return db[_0x8822('0x10')]['findAll']({'where':{'voiceQueueId':{'$in':_0x4fe335},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x8822('0x27')][_0x8822('0x3e')]('NOW()\x20+\x20INTERVAL\x20'+_0x6f7066+_0x8822('0x4f')),'$gt':db['sequelize'][_0x8822('0x3e')](_0x8822('0x50'))}},'UserId':{'$in':_0xdc0238}},'include':[{'model':db[_0x8822('0x25')],'as':_0x8822('0x2b')},{'model':db[_0x8822('0x2d')],'as':_0x8822('0x2e'),'attributes':['id',_0x8822('0x2f'),_0x8822('0x30')]},{'model':db[_0x8822('0x51')],'as':'List'}]})[_0x8822('0x6')](function(_0xf96f10){if(_0xf96f10[_0x8822('0x31')]>0x0){return db[_0x8822('0x27')][_0x8822('0x39')](function(_0x5a7da8){return db[_0x8822('0x10')][_0x8822('0x1f')]({'recallmeNotifiedDate':db[_0x8822('0x27')][_0x8822('0x3e')](_0x8822('0x50'))},{'where':{'id':{'$in':_[_0x8822('0x19')](_0xf96f10,'id')}},'transaction':_0x5a7da8})['then'](function(){_0x4f5f4b(_0xf96f10);})['catch'](function(_0x24b854){logger['error'](_0x8822('0x4c'),_0x24b854[_0x8822('0xe')],_0x2b49fe);_0x3ce391(_0x32af21['error'](0x1f4,_0x24b854[_0x8822('0xe')]));});})[_0x8822('0x1b')](function(_0x2d5836){logger[_0x8822('0xc')]('CmHopperHandlePreviewRecallNotifications',_0x2d5836['message'],_0x2b49fe);_0x3ce391(_0x32af21[_0x8822('0xc')](0x1f4,_0x2d5836[_0x8822('0xe')]));});}else{_0x4f5f4b(_0xf96f10);}});});}; \ No newline at end of file +var _0xda2d=['util','moment','bluebird','../../mysqldb','../../config/logger','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopper,\x20%s,\x20%s','message','catch','CmHopper','findAll','options','raw','where','attributes','include','model','map','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','name','List'];(function(_0x4f9ff3,_0x108236){var _0x1a6c55=function(_0x2e675f){while(--_0x2e675f){_0x4f9ff3['push'](_0x4f9ff3['shift']());}};_0x1a6c55(++_0x108236);}(_0xda2d,0x102));var _0xdda2=function(_0x5c3a18,_0x47804f){_0x5c3a18=_0x5c3a18-0x0;var _0x960de0=_0xda2d[_0x5c3a18];return _0x960de0;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var db=require(_0xdda2('0x3'))['db'];var logger=require(_0xdda2('0x4'))('rpc');var jayson=require('jayson/promise');var client=jayson['client'][_0xdda2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x319129,_0x2965a5,_0x39f6c9){return new BPromise(function(_0xc256bc,_0xf38e58){return client[_0xdda2('0x6')](_0x319129,_0x39f6c9)[_0xdda2('0x7')](function(_0x2e2523){logger[_0xdda2('0x8')]('CmHopper,\x20%s,\x20%s',_0x2965a5,_0xdda2('0x9'));logger[_0xdda2('0xa')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2965a5,_0xdda2('0x9'),JSON[_0xdda2('0xb')](_0x2e2523));if(_0x2e2523[_0xdda2('0xc')]){if(_0x2e2523[_0xdda2('0xc')][_0xdda2('0xd')]===0x1f4){logger[_0xdda2('0xc')](_0xdda2('0xe'),_0x2965a5,_0x2e2523[_0xdda2('0xc')]['message']);return _0xf38e58(_0x2e2523['error']['message']);}logger[_0xdda2('0xc')](_0xdda2('0xe'),_0x2965a5,_0x2e2523[_0xdda2('0xc')][_0xdda2('0xf')]);return _0xc256bc(_0x2e2523[_0xdda2('0xc')][_0xdda2('0xf')]);}else{logger[_0xdda2('0x8')]('CmHopper,\x20%s,\x20%s',_0x2965a5,_0xdda2('0x9'));_0xc256bc(_0x2e2523['result'][_0xdda2('0xf')]);}})[_0xdda2('0x10')](function(_0x3553d5){logger[_0xdda2('0xc')](_0xdda2('0xe'),_0x2965a5,_0x3553d5);_0xf38e58(_0x3553d5);});});}exports['GetCmHopper']=function(_0x55d674){var _0x43f67b=this;return new Promise(function(_0x518c6d,_0x1a5192){return db[_0xdda2('0x11')][_0xdda2('0x12')]({'raw':_0x55d674[_0xdda2('0x13')]?_0x55d674[_0xdda2('0x13')][_0xdda2('0x14')]===undefined?!![]:![]:!![],'where':_0x55d674[_0xdda2('0x13')]?_0x55d674[_0xdda2('0x13')][_0xdda2('0x15')]||null:null,'attributes':_0x55d674[_0xdda2('0x13')]?_0x55d674[_0xdda2('0x13')][_0xdda2('0x16')]||null:null,'limit':_0x55d674['options']?_0x55d674[_0xdda2('0x13')]['limit']||null:null,'include':_0x55d674[_0xdda2('0x13')]?_0x55d674[_0xdda2('0x13')][_0xdda2('0x17')]?_['map'](_0x55d674[_0xdda2('0x13')]['include'],function(_0x425489){return{'model':db[_0x425489[_0xdda2('0x18')]],'as':_0x425489['as'],'attributes':_0x425489['attributes'],'include':_0x425489[_0xdda2('0x17')]?_[_0xdda2('0x19')](_0x425489[_0xdda2('0x17')],function(_0x13b0f3){return{'model':db[_0x13b0f3[_0xdda2('0x18')]],'as':_0x13b0f3['as'],'attributes':_0x13b0f3['attributes'],'include':_0x13b0f3[_0xdda2('0x17')]?_[_0xdda2('0x19')](_0x13b0f3[_0xdda2('0x17')],function(_0x31d48b){return{'model':db[_0x31d48b['model']],'as':_0x31d48b['as'],'attributes':_0x31d48b['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0x7')](function(_0x4567e7){logger[_0xdda2('0x8')]('GetCmHopper',_0x55d674);logger[_0xdda2('0xa')](_0xdda2('0x1a'),_0x55d674,JSON[_0xdda2('0xb')](_0x4567e7));_0x518c6d(_0x4567e7);})[_0xdda2('0x10')](function(_0xe16ec7){logger[_0xdda2('0xc')]('GetCmHopper',_0xe16ec7[_0xdda2('0xf')],_0x55d674);_0x1a5192(_0x43f67b[_0xdda2('0xc')](0x1f4,_0xe16ec7['message']));});});};exports[_0xdda2('0x1b')]=function(_0x2cfaca){var _0x3b18b8=this;return new Promise(function(_0x15e511,_0x5540e5){return db[_0xdda2('0x11')][_0xdda2('0x1c')]({'raw':_0x2cfaca['options']?_0x2cfaca[_0xdda2('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2cfaca[_0xdda2('0x13')]?_0x2cfaca['options']['where']||null:null,'attributes':_0x2cfaca['options']?_0x2cfaca[_0xdda2('0x13')]['attributes']||null:null,'include':_0x2cfaca[_0xdda2('0x13')]?_0x2cfaca['options']['include']?_['map'](_0x2cfaca[_0xdda2('0x13')][_0xdda2('0x17')],function(_0xca6046){return{'model':db[_0xca6046[_0xdda2('0x18')]],'as':_0xca6046['as'],'attributes':_0xca6046[_0xdda2('0x16')],'include':_0xca6046[_0xdda2('0x17')]?_[_0xdda2('0x19')](_0xca6046[_0xdda2('0x17')],function(_0x3cddbd){return{'model':db[_0x3cddbd[_0xdda2('0x18')]],'as':_0x3cddbd['as'],'attributes':_0x3cddbd['attributes'],'include':_0x3cddbd[_0xdda2('0x17')]?_[_0xdda2('0x19')](_0x3cddbd[_0xdda2('0x17')],function(_0x3d510c){return{'model':db[_0x3d510c[_0xdda2('0x18')]],'as':_0x3d510c['as'],'attributes':_0x3d510c[_0xdda2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0x7')](function(_0x5835cd){logger['info'](_0xdda2('0x1b'),_0x2cfaca);logger[_0xdda2('0xa')](_0xdda2('0x1b'),_0x2cfaca,JSON['stringify'](_0x5835cd));_0x15e511(_0x5835cd);})['catch'](function(_0x871054){logger[_0xdda2('0xc')](_0xdda2('0x1b'),_0x871054[_0xdda2('0xf')],_0x2cfaca);_0x5540e5(_0x3b18b8[_0xdda2('0xc')](0x1f4,_0x871054['message']));});});};exports[_0xdda2('0x1d')]=function(_0x21fc6d){var _0x497302=this;return new Promise(function(_0x5bcf99,_0x98bf47){return db[_0xdda2('0x11')][_0xdda2('0x1e')](_0x21fc6d[_0xdda2('0x1f')],{'raw':_0x21fc6d[_0xdda2('0x13')]?_0x21fc6d['options'][_0xdda2('0x14')]===undefined?!![]:![]:!![]})[_0xdda2('0x7')](function(_0x7dac2c){logger[_0xdda2('0x8')]('CreateCmHopper',_0x21fc6d);logger['debug'](_0xdda2('0x1d'),_0x21fc6d,JSON[_0xdda2('0xb')](_0x7dac2c));_0x5bcf99(_0x7dac2c);})[_0xdda2('0x10')](function(_0x5a92e9){logger[_0xdda2('0xc')]('CreateCmHopper',_0x5a92e9[_0xdda2('0xf')],_0x21fc6d);_0x98bf47(_0x497302['error'](0x1f4,_0x5a92e9[_0xdda2('0xf')]));});});};exports[_0xdda2('0x20')]=function(_0x1db762){var _0x2eec64=this;return new Promise(function(_0x57bd0e,_0x1c5195){return db['CmHopper'][_0xdda2('0x21')](_0x1db762['body'],{'raw':_0x1db762[_0xdda2('0x13')]?_0x1db762[_0xdda2('0x13')][_0xdda2('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1db762[_0xdda2('0x13')]?_0x1db762[_0xdda2('0x13')]['where']||null:null,'attributes':_0x1db762[_0xdda2('0x13')]?_0x1db762[_0xdda2('0x13')]['attributes']||null:null,'limit':_0x1db762[_0xdda2('0x13')]?_0x1db762['options'][_0xdda2('0x22')]||null:null})[_0xdda2('0x7')](function(_0x1741a0){logger[_0xdda2('0x8')](_0xdda2('0x20'),_0x1db762);logger[_0xdda2('0x8')](_0xdda2('0x23'),JSON[_0xdda2('0xb')](_0x1db762[_0xdda2('0x13')][_0xdda2('0x15')]),_0x1db762[_0xdda2('0x1f')][_0xdda2('0x24')]);logger[_0xdda2('0xa')]('UpdateCmHopper',_0x1db762,JSON['stringify'](_0x1741a0));_0x57bd0e(_0x1741a0);})['catch'](function(_0x36573e){logger[_0xdda2('0xc')]('UpdateCmHopper',_0x36573e[_0xdda2('0xf')],_0x1db762);_0x1c5195(_0x2eec64[_0xdda2('0xc')](0x1f4,_0x36573e[_0xdda2('0xf')]));});});};exports['DestroyCmHopper']=function(_0x3b44e4){var _0x1fa4d0=this;return new Promise(function(_0x4eada0,_0x5f0aa8){return db[_0xdda2('0x11')]['destroy']({'where':_0x3b44e4[_0xdda2('0x13')]?_0x3b44e4['options'][_0xdda2('0x15')]||null:null})[_0xdda2('0x7')](function(_0x50bd88){logger['info'](_0xdda2('0x25'),_0x3b44e4);logger[_0xdda2('0xa')](_0xdda2('0x25'),_0x3b44e4,JSON[_0xdda2('0xb')](_0x50bd88));_0x4eada0(_0x50bd88);})['catch'](function(_0x1edbc6){logger[_0xdda2('0xc')](_0xdda2('0x25'),_0x1edbc6[_0xdda2('0xf')],_0x3b44e4);_0x5f0aa8(_0x1fa4d0[_0xdda2('0xc')](0x1f4,_0x1edbc6['message']));});});};exports[_0xdda2('0x26')]=function(_0x40b610){var _0x51f2b6=this;return new Promise(function(_0x3eb3c1,_0x123c2d){return db[_0xdda2('0x27')][_0xdda2('0x28')]()[_0xdda2('0x7')](function(_0x265169){return db['sequelize'][_0xdda2('0x29')](function(_0x4a9814){return db[_0xdda2('0x11')]['findAll']({'where':_0x40b610[_0xdda2('0x13')]?_0x40b610['options'][_0xdda2('0x15')]||null:null,'attributes':_0x40b610[_0xdda2('0x13')]?_0x40b610[_0xdda2('0x13')][_0xdda2('0x16')]||null:null,'limit':_0x40b610[_0xdda2('0x13')]?_0x40b610[_0xdda2('0x13')][_0xdda2('0x22')]||null:null,'order':_0x40b610[_0xdda2('0x13')]?_0x40b610['options'][_0xdda2('0x2a')]||null:null,'transaction':_0x4a9814,'lock':_0x4a9814[_0xdda2('0x2b')][_0xdda2('0x2c')],'include':[{'model':db['CmContact'],'as':_0xdda2('0x2d'),'attributes':_[_0xdda2('0x2e')](_0x265169)},{'model':db['User'],'as':_0xdda2('0x2f'),'attributes':['id','name',_0xdda2('0x30')]}]})[_0xdda2('0x7')](function(_0x378704){var _0xbfab73=[];var _0xb9c8e7=[];for(var _0x4fd561=0x0;_0x4fd561<_0x378704['length'];_0x4fd561+=0x1){var _0x5c2cb2=_0x378704[_0x4fd561][_0xdda2('0x31')];if(_0x5c2cb2===null){_0xbfab73[_0xdda2('0x32')](_0x378704[_0x4fd561]['update'](_0x40b610[_0xdda2('0x1f')],{'transaction':_0x4a9814}));}else if(!_0xb9c8e7[_0xdda2('0x33')](_0x5c2cb2)){_0xb9c8e7[_0xdda2('0x32')](_0x5c2cb2);_0xbfab73['push'](_0x378704[_0x4fd561][_0xdda2('0x21')](_0x40b610[_0xdda2('0x1f')],{'transaction':_0x4a9814}));}}return BPromise[_0xdda2('0x34')](_0xbfab73);});})['then'](function(_0x2b2c1d){logger[_0xdda2('0x8')](_0xdda2('0x26'),_0x40b610);if(_0x2b2c1d[_0xdda2('0x35')]>0x0){logger['info'](_0xdda2('0x36'),_0x2b2c1d[0x0]['dataValues']['id'],_0x2b2c1d[0x0]['dataValues']['ContactId'],_0x2b2c1d[0x0][_0xdda2('0x37')][_0xdda2('0x24')]);}logger[_0xdda2('0xa')](_0xdda2('0x26'),_0x40b610,JSON[_0xdda2('0xb')](_0x2b2c1d));_0x3eb3c1(_0x2b2c1d);})[_0xdda2('0x10')](function(_0x29a739){logger[_0xdda2('0xc')](_0xdda2('0x26'),_0x29a739[_0xdda2('0xf')],_0x40b610);_0x123c2d(_0x51f2b6[_0xdda2('0xc')](0x1f4,_0x29a739['message']));});});});};exports[_0xdda2('0x38')]=function(_0x173022){var _0x266ec0=this;return new Promise(function(_0xd8c180,_0x90bb5c){return db[_0xdda2('0x39')][_0xdda2('0x29')](function(_0x57fb41){return db[_0xdda2('0x3a')][_0xdda2('0x1e')](_0x173022[_0xdda2('0x1f')],{'raw':_0x173022[_0xdda2('0x13')]?_0x173022[_0xdda2('0x13')]['raw']===undefined?!![]:![]:!![],'transaction':_0x57fb41})[_0xdda2('0x7')](function(){logger[_0xdda2('0x8')](_0xdda2('0x3b'),JSON[_0xdda2('0xb')](_0x173022[_0xdda2('0x13')]['where']),_0x173022[_0xdda2('0x13')][_0xdda2('0x15')][_0xdda2('0x24')]);return db[_0xdda2('0x11')][_0xdda2('0x3c')]({'where':_0x173022['options']?_0x173022[_0xdda2('0x13')][_0xdda2('0x15')]||null:null,'transaction':_0x57fb41});});})[_0xdda2('0x7')](function(_0x54ac4b){logger[_0xdda2('0x8')]('MoveContactManagedDialer',_0x173022);logger[_0xdda2('0xa')](_0xdda2('0x38'),_0x173022,JSON[_0xdda2('0xb')](_0x54ac4b));_0xd8c180(_0x54ac4b);})['catch'](function(_0x28ee2b){logger[_0xdda2('0xc')]('MoveContactManagedDialer',_0x28ee2b[_0xdda2('0xf')],_0x173022);_0x90bb5c(_0x266ec0['error'](0x1f4,_0x28ee2b[_0xdda2('0xf')]));});});};exports[_0xdda2('0x3d')]=function(_0x354fb9){var _0x29cf1a=this;return new Promise(function(_0x10d1de,_0x4a061a){return db['CmHopper'][_0xdda2('0x12')]({'raw':_0x354fb9[_0xdda2('0x13')]?_0x354fb9['options']['raw']===undefined?!![]:![]:!![],'where':_0x354fb9[_0xdda2('0x13')]?_0x354fb9['options'][_0xdda2('0x15')]||null:null,'attributes':[[db[_0xdda2('0x39')]['fn']('COUNT',db[_0xdda2('0x39')]['fn']('IF',db[_0xdda2('0x39')][_0xdda2('0x3e')](_0xdda2('0x3f')+util[_0xdda2('0x40')](_0xdda2('0x41'),moment()['format'](_0xdda2('0x42')))+_0xdda2('0x43')))),_0xdda2('0x44')]]})['then'](function(_0x27780e){logger[_0xdda2('0x8')]('CountReScheduled',_0x354fb9);logger['debug'](_0xdda2('0x3d'),_0x354fb9,JSON[_0xdda2('0xb')](_0x27780e));_0x10d1de(_0x27780e);})[_0xdda2('0x10')](function(_0x5b8382){logger['error'](_0xdda2('0x3d'),_0x5b8382['message'],_0x354fb9);_0x4a061a(_0x29cf1a[_0xdda2('0xc')](0x1f4,_0x5b8382[_0xdda2('0xf')]));});});};exports[_0xdda2('0x45')]=function(_0x12fd67){var _0x597b09=this;return new Promise(function(_0x29006f,_0x58d1ad){return db['CmContact'][_0xdda2('0x28')]()['then'](function(_0x2de01c){return db[_0xdda2('0x39')][_0xdda2('0x29')](function(_0x19d210){return db[_0xdda2('0x11')][_0xdda2('0x12')]({'where':_0x12fd67[_0xdda2('0x13')]?_0x12fd67[_0xdda2('0x13')][_0xdda2('0x15')]||null:null,'attributes':_0x12fd67['options']?_0x12fd67[_0xdda2('0x13')][_0xdda2('0x16')]||null:null,'limit':0x1,'order':_0x12fd67[_0xdda2('0x13')]?_0x12fd67[_0xdda2('0x13')]['order']||null:null,'group':db[_0xdda2('0x11')][_0xdda2('0x31')],'transaction':_0x19d210,'lock':_0x19d210[_0xdda2('0x2b')][_0xdda2('0x2c')],'include':_0x12fd67['options']?_0x12fd67['options'][_0xdda2('0x17')]?_[_0xdda2('0x19')](_0x12fd67[_0xdda2('0x13')][_0xdda2('0x17')],function(_0x58f233){return{'model':db[_0x58f233[_0xdda2('0x18')]],'as':_0x58f233['as'],'attributes':_0x58f233[_0xdda2('0x16')],'include':_0x58f233[_0xdda2('0x17')]?_[_0xdda2('0x19')](_0x58f233[_0xdda2('0x17')],function(_0x1f77bd){return{'model':db[_0x1f77bd[_0xdda2('0x18')]],'as':_0x1f77bd['as'],'attributes':_0x1f77bd[_0xdda2('0x16')],'include':_0x1f77bd[_0xdda2('0x17')]?_[_0xdda2('0x19')](_0x1f77bd[_0xdda2('0x17')],function(_0x23a80a){return{'model':db[_0x23a80a[_0xdda2('0x18')]],'as':_0x23a80a['as'],'attributes':_0x23a80a[_0xdda2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0x7')](function(_0x4b9481){var _0x221f72=[];for(var _0x20969b=0x0;_0x20969b<_0x4b9481['length'];_0x20969b+=0x1){_0x221f72['push'](_0x4b9481[_0x20969b][_0xdda2('0x21')](_0x12fd67[_0xdda2('0x1f')],{'transaction':_0x19d210}));}return BPromise[_0xdda2('0x34')](_0x221f72);});})[_0xdda2('0x7')](function(_0x1bd480){logger[_0xdda2('0x8')]('GetContactRecallMe',_0x12fd67);logger[_0xdda2('0xa')](_0xdda2('0x45'),_0x12fd67,JSON[_0xdda2('0xb')](_0x1bd480));_0x29006f(_0x1bd480);})[_0xdda2('0x10')](function(_0x563be8){logger[_0xdda2('0xc')]('GetContactRecallMe',_0x563be8[_0xdda2('0xf')],_0x12fd67);_0x58d1ad(_0x597b09[_0xdda2('0xc')](0x1f4,_0x563be8['message']));});});});};exports[_0xdda2('0x46')]=function(_0x3d50fc){var _0x1dcc02=this;return new Promise(function(_0x1dfe6d,_0x222099){db[_0xdda2('0x27')][_0xdda2('0x28')]()[_0xdda2('0x7')](function(_0x3a375d){return db[_0xdda2('0x11')][_0xdda2('0x12')]({'raw':_0x3d50fc['options']?_0x3d50fc[_0xdda2('0x13')][_0xdda2('0x14')]===undefined?!![]:![]:!![],'where':_0x3d50fc[_0xdda2('0x13')]?_0x3d50fc[_0xdda2('0x13')][_0xdda2('0x15')]||null:null,'attributes':_0x3d50fc['options']?_0x3d50fc[_0xdda2('0x13')][_0xdda2('0x16')]||null:null,'limit':_0x3d50fc['options']?_0x3d50fc[_0xdda2('0x13')][_0xdda2('0x22')]||null:null,'include':_0x3d50fc['options']?_0x3d50fc['options'][_0xdda2('0x17')]?_[_0xdda2('0x19')](_0x3d50fc[_0xdda2('0x13')][_0xdda2('0x17')],function(_0x14d8fa){return{'model':db[_0x14d8fa[_0xdda2('0x18')]],'as':_0x14d8fa['as'],'attributes':_0x14d8fa['as']==='Contact'?_[_0xdda2('0x2e')](_0x3a375d):_0x14d8fa[_0xdda2('0x16')],'include':_0x14d8fa['include']?_[_0xdda2('0x19')](_0x14d8fa[_0xdda2('0x17')],function(_0x4b57df){return{'model':db[_0x4b57df[_0xdda2('0x18')]],'as':_0x4b57df['as'],'attributes':_0x4b57df[_0xdda2('0x16')],'include':_0x4b57df[_0xdda2('0x17')]?_['map'](_0x4b57df[_0xdda2('0x17')],function(_0x4a34ee){return{'model':db[_0x4a34ee[_0xdda2('0x18')]],'as':_0x4a34ee['as'],'attributes':_0x4a34ee[_0xdda2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0x7')](function(_0x17852d){logger['info']('GetCmHopper',_0x3d50fc);logger[_0xdda2('0xa')](_0xdda2('0x1a'),_0x3d50fc,JSON['stringify'](_0x17852d));_0x1dfe6d(_0x17852d);})[_0xdda2('0x10')](function(_0x19267b){logger[_0xdda2('0xc')](_0xdda2('0x1a'),_0x19267b[_0xdda2('0xf')],_0x3d50fc);_0x222099(_0x1dcc02[_0xdda2('0xc')](0x1f4,_0x19267b[_0xdda2('0xf')]));});});});};exports[_0xdda2('0x47')]=function(_0x3046c1){var _0x26e599=this;return new Promise(function(_0x37f066,_0x1527e0){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x3046c1['options'][_0xdda2('0x15')]['phone']},'attributes':['id',_0xdda2('0x48')],'order':[['id',_0xdda2('0x49')]]})[_0xdda2('0x7')](function(_0xe797aa){logger['info'](_0xdda2('0x4a'),_0x3046c1);logger[_0xdda2('0xa')](_0xdda2('0x4a'),_0x3046c1,JSON['stringify'](_0xe797aa));_0x37f066(_0xe797aa);})[_0xdda2('0x10')](function(_0x86235b){logger[_0xdda2('0xc')]('getContactByPhone',_0x86235b['message'],_0x3046c1);_0x1527e0(_0x26e599[_0xdda2('0xc')](0x1f4,_0x86235b[_0xdda2('0xf')]));});});};exports[_0xdda2('0x4b')]=function(_0x5e3718){var _0x29a037=this;return new Promise(function(_0x32a2e9,_0xdb1841){return db[_0xdda2('0x39')][_0xdda2('0x29')](function(_0x10ebab){return db[_0xdda2('0x11')]['update']({'active':![]},{'where':{},'transaction':_0x10ebab})[_0xdda2('0x7')](function(_0x385249){logger[_0xdda2('0x8')](_0xdda2('0x4b'),_0x5e3718);logger['debug'](_0xdda2('0x4b'),_0x5e3718,JSON[_0xdda2('0xb')](_0x385249));_0x32a2e9(_0x385249);})[_0xdda2('0x10')](function(_0x270c46){logger['error']('ResetActiveCalls',_0x270c46['message'],_0x5e3718);_0xdb1841(_0x29a037[_0xdda2('0xc')](0x1f4,_0x270c46[_0xdda2('0xf')]));});});});};exports[_0xdda2('0x4c')]=function(_0x429f24){var _0x1cc1f4=this;var _0x3cdef1=_0x429f24['body'][_0xdda2('0x15')][_0xdda2('0x4d')];var _0xed5a58=_0x429f24[_0xdda2('0x1f')][_0xdda2('0x15')][_0xdda2('0x4e')];var _0xcbf57f=_0x429f24[_0xdda2('0x1f')]['where'][_0xdda2('0x4f')];return new Promise(function(_0x517b60,_0x161043){return db['CmHopper'][_0xdda2('0x12')]({'where':{'voiceQueueId':{'$in':_0x3cdef1},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xdda2('0x3e')](_0xdda2('0x50')+_0xed5a58+_0xdda2('0x51')),'$gt':db[_0xdda2('0x39')][_0xdda2('0x3e')](_0xdda2('0x52'))}},'UserId':{'$in':_0xcbf57f}},'include':[{'model':db[_0xdda2('0x27')],'as':_0xdda2('0x2d')},{'model':db[_0xdda2('0x53')],'as':'Agent','attributes':['id',_0xdda2('0x54'),_0xdda2('0x30')]},{'model':db['CmList'],'as':_0xdda2('0x55')}]})[_0xdda2('0x7')](function(_0x2f3807){if(_0x2f3807['length']>0x0){return db[_0xdda2('0x39')][_0xdda2('0x29')](function(_0x251408){return db[_0xdda2('0x11')][_0xdda2('0x21')]({'recallmeNotifiedDate':db[_0xdda2('0x39')][_0xdda2('0x3e')](_0xdda2('0x52'))},{'where':{'id':{'$in':_[_0xdda2('0x19')](_0x2f3807,'id')}},'transaction':_0x251408})[_0xdda2('0x7')](function(){_0x517b60(_0x2f3807);})['catch'](function(_0x30aaac){logger[_0xdda2('0xc')](_0xdda2('0x4c'),_0x30aaac[_0xdda2('0xf')],_0x429f24);_0x161043(_0x1cc1f4[_0xdda2('0xc')](0x1f4,_0x30aaac['message']));});})[_0xdda2('0x10')](function(_0xc7e1e3){logger[_0xdda2('0xc')]('CmHopperHandlePreviewRecallNotifications',_0xc7e1e3[_0xdda2('0xf')],_0x429f24);_0x161043(_0x1cc1f4[_0xdda2('0xc')](0x1f4,_0xc7e1e3[_0xdda2('0xf')]));});}else{_0x517b60(_0x2f3807);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0e6366f..2d7903f 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 _0x8467=['/:id/previewrecall','getPreviewRecall','post','getPreview','/timezone','delete','destroy','exports','express','../../components/auth/service','isAuthenticated','index','get','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x47d1ae,_0x41e056){var _0x47328a=function(_0x35adb5){while(--_0x35adb5){_0x47d1ae['push'](_0x47d1ae['shift']());}};_0x47328a(++_0x41e056);}(_0x8467,0x170));var _0x7846=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x8467[_0x37a79c];return _0x561d89;};'use strict';var express=require(_0x7846('0x0'));var router=express['Router']();var auth=require(_0x7846('0x1'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x7846('0x2')](),controller[_0x7846('0x3')]);router[_0x7846('0x4')]('/describe',auth[_0x7846('0x2')](),controller['describe']);router[_0x7846('0x4')](_0x7846('0x5'),auth[_0x7846('0x2')](),controller[_0x7846('0x6')]);router[_0x7846('0x4')](_0x7846('0x7'),auth[_0x7846('0x2')](),controller[_0x7846('0x8')]);router[_0x7846('0x4')](_0x7846('0x9'),auth[_0x7846('0x2')](),controller['show']);router[_0x7846('0x4')](_0x7846('0xa'),auth['isAuthenticated'](),controller[_0x7846('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7846('0xc')]('/preview',auth['isAuthenticated'](),controller[_0x7846('0xd')]);router[_0x7846('0xc')](_0x7846('0xe'),auth[_0x7846('0x2')](),controller['getTimezone']);router['put'](_0x7846('0x9'),auth[_0x7846('0x2')](),controller['update']);router[_0x7846('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7846('0x10')]);module[_0x7846('0x11')]=router; \ No newline at end of file +var _0x2b13=['show','/:id/previewrecall','post','/preview','getTimezone','put','update','express','Router','./cmHopper.controller','/describe','describe','get','/opencontacts','isAuthenticated','getOpenContacts','/timezones','/:id'];(function(_0x34ad4f,_0x3b9428){var _0x1a868f=function(_0x1c8194){while(--_0x1c8194){_0x34ad4f['push'](_0x34ad4f['shift']());}};_0x1a868f(++_0x3b9428);}(_0x2b13,0x1ed));var _0x32b1=function(_0x3dd1b4,_0x14907f){_0x3dd1b4=_0x3dd1b4-0x0;var _0x16efb8=_0x2b13[_0x3dd1b4];return _0x16efb8;};'use strict';var express=require(_0x32b1('0x0'));var router=express[_0x32b1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x32b1('0x2'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x32b1('0x3'),auth['isAuthenticated'](),controller[_0x32b1('0x4')]);router[_0x32b1('0x5')](_0x32b1('0x6'),auth[_0x32b1('0x7')](),controller[_0x32b1('0x8')]);router[_0x32b1('0x5')](_0x32b1('0x9'),auth[_0x32b1('0x7')](),controller['getTimezones']);router['get'](_0x32b1('0xa'),auth[_0x32b1('0x7')](),controller[_0x32b1('0xb')]);router[_0x32b1('0x5')](_0x32b1('0xc'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x32b1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32b1('0xd')](_0x32b1('0xe'),auth[_0x32b1('0x7')](),controller['getPreview']);router[_0x32b1('0xd')]('/timezone',auth[_0x32b1('0x7')](),controller[_0x32b1('0xf')]);router[_0x32b1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x32b1('0x11')]);router['delete'](_0x32b1('0xa'),auth[_0x32b1('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 8327e8e..8cb6d16 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 _0x07af=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER'];(function(_0x464bdc,_0xb0a019){var _0x1b1f84=function(_0x394495){while(--_0x394495){_0x464bdc['push'](_0x464bdc['shift']());}};_0x1b1f84(++_0xb0a019);}(_0x07af,0x13e));var _0xf07a=function(_0x1a752e,_0x13fd54){_0x1a752e=_0x1a752e-0x0;var _0x19d5f8=_0x07af[_0x1a752e];return _0x19d5f8;};'use strict';var moment=require(_0xf07a('0x0'));var Sequelize=require(_0xf07a('0x1'));module[_0xf07a('0x2')]={'CmHopperId':{'type':Sequelize[_0xf07a('0x3')]},'phone':{'type':Sequelize[_0xf07a('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf07a('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xf07a('0x5')](_0xf07a('0x6'))},'countbusyretry':{'type':Sequelize[_0xf07a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf07a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf07a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf07a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf07a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf07a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9dc9=['exports','STRING','format','INTEGER'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x9dc9,0x1b8));var _0x99dc=function(_0x584d08,_0x5c3686){_0x584d08=_0x584d08-0x0;var _0x1d0ccb=_0x9dc9[_0x584d08];return _0x1d0ccb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x99dc('0x0')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x99dc('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x99dc('0x2')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x99dc('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x99dc('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x99dc('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x99dc('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x99dc('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x99dc('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x99dc('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x99dc('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 13b7107..61539a9 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 _0x3b27=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','findAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto'];(function(_0x27c399,_0x39d39a){var _0x4d7f7f=function(_0x4d088c){while(--_0x4d088c){_0x27c399['push'](_0x27c399['shift']());}};_0x4d7f7f(++_0x39d39a);}(_0x3b27,0x1d5));var _0x73b2=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x3b27[_0x45f951];return _0x24756c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x73b2('0x0'));var zipdir=require(_0x73b2('0x1'));var jsonpatch=require(_0x73b2('0x2'));var rp=require(_0x73b2('0x3'));var moment=require('moment');var BPromise=require(_0x73b2('0x4'));var Mustache=require(_0x73b2('0x5'));var util=require('util');var path=require(_0x73b2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x73b2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x73b2('0x8'));var squel=require(_0x73b2('0x9'));var crypto=require(_0x73b2('0xa'));var jsforce=require(_0x73b2('0xb'));var deskjs=require(_0x73b2('0xc'));var toCsv=require(_0x73b2('0xd'));var querystring=require('querystring');var Papa=require(_0x73b2('0xe'));var Redis=require(_0x73b2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x73b2('0x10'));var as=require(_0x73b2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73b2('0x12'))('api');var utils=require(_0x73b2('0x13'));var config=require(_0x73b2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x73b2('0x15'))['db'];function respondWithStatusCode(_0x5930b7,_0x457bc1){_0x457bc1=_0x457bc1||0xcc;return function(_0x33a1f4){if(_0x33a1f4){return _0x5930b7[_0x73b2('0x16')](_0x457bc1);}return _0x5930b7['status'](_0x457bc1)[_0x73b2('0x17')]();};}function respondWithResult(_0x4d9c81,_0x12eef6){_0x12eef6=_0x12eef6||0xc8;return function(_0x517faa){if(_0x517faa){return _0x4d9c81['status'](_0x12eef6)[_0x73b2('0x18')](_0x517faa);}};}function respondWithFilteredResult(_0x259833,_0x3f1c46){return function(_0x3d91da){if(_0x3d91da){var _0x1b16df=typeof _0x3f1c46[_0x73b2('0x19')]===_0x73b2('0x1a')&&typeof _0x3f1c46[_0x73b2('0x1b')]===_0x73b2('0x1a');var _0x350f42=_0x3d91da[_0x73b2('0x1c')];var _0x13b1df=_0x1b16df?0x0:_0x3f1c46[_0x73b2('0x19')];var _0xdb3c86=_0x1b16df?_0x3d91da[_0x73b2('0x1c')]:_0x3f1c46[_0x73b2('0x19')]+_0x3f1c46[_0x73b2('0x1b')];var _0xa387ea;if(_0xdb3c86>=_0x350f42){_0xdb3c86=_0x350f42;_0xa387ea=0xc8;}else{_0xa387ea=0xce;}_0x259833[_0x73b2('0x1d')](_0xa387ea);return _0x259833[_0x73b2('0x1e')](_0x73b2('0x1f'),_0x13b1df+'-'+_0xdb3c86+'/'+_0x350f42)['json'](_0x3d91da);}return null;};}function patchUpdates(_0xc6723f){return function(_0x16c7d8){try{jsonpatch[_0x73b2('0x20')](_0x16c7d8,_0xc6723f,!![]);}catch(_0x5367c9){return BPromise[_0x73b2('0x21')](_0x5367c9);}return _0x16c7d8[_0x73b2('0x22')]();};}function saveUpdates(_0x53e68b,_0x14541f){return function(_0x31d2b5){if(_0x31d2b5){return _0x31d2b5[_0x73b2('0x23')](_0x53e68b)[_0x73b2('0x24')](function(_0x516813){return _0x516813;});}return null;};}function removeEntity(_0x4434e6,_0x229191){return function(_0x2ef2e4){if(_0x2ef2e4){return _0x2ef2e4[_0x73b2('0x25')]()['then'](function(){var _0x744e4d=_0x2ef2e4[_0x73b2('0x26')]({'plain':!![]});var _0x58b8c1=_0x73b2('0x27');return db['UserProfileResource'][_0x73b2('0x25')]({'where':{'type':_0x58b8c1,'resourceId':_0x744e4d['id']}})[_0x73b2('0x24')](function(){return _0x2ef2e4;});})[_0x73b2('0x24')](function(){_0x4434e6[_0x73b2('0x1d')](0xcc)[_0x73b2('0x17')]();});}};}function handleEntityNotFound(_0x10ef75,_0x349834){return function(_0x1d18f1){if(!_0x1d18f1){_0x10ef75[_0x73b2('0x16')](0x194);}return _0x1d18f1;};}function handleError(_0x1b659c,_0x4b42cc){_0x4b42cc=_0x4b42cc||0x1f4;return function(_0x2509fe){logger[_0x73b2('0x28')](_0x2509fe[_0x73b2('0x29')]);if(_0x2509fe[_0x73b2('0x2a')]){delete _0x2509fe[_0x73b2('0x2a')];}_0x1b659c[_0x73b2('0x1d')](_0x4b42cc)['send'](_0x2509fe);};}exports[_0x73b2('0x2b')]=function(_0x1a2466,_0x5e0a1e){var _0x47814d={},_0x11b526={},_0x315eb4={'count':0x0,'rows':[]};var _0x1a1254=_[_0x73b2('0x2c')](db[_0x73b2('0x2d')][_0x73b2('0x2e')],function(_0x5e06ca){return{'name':_0x5e06ca['fieldName'],'type':_0x5e06ca[_0x73b2('0x2f')][_0x73b2('0x30')]};});_0x11b526[_0x73b2('0x31')]=_[_0x73b2('0x2c')](_0x1a1254,_0x73b2('0x2a'));_0x11b526[_0x73b2('0x32')]=_[_0x73b2('0x33')](_0x1a2466[_0x73b2('0x32')]);_0x11b526[_0x73b2('0x34')]=_[_0x73b2('0x35')](_0x11b526[_0x73b2('0x31')],_0x11b526[_0x73b2('0x32')]);_0x47814d[_0x73b2('0x36')]=_[_0x73b2('0x35')](_0x11b526[_0x73b2('0x31')],qs[_0x73b2('0x37')](_0x1a2466[_0x73b2('0x32')][_0x73b2('0x37')]));_0x47814d[_0x73b2('0x36')]=_0x47814d['attributes'][_0x73b2('0x38')]?_0x47814d[_0x73b2('0x36')]:_0x11b526[_0x73b2('0x31')];if(!_0x1a2466[_0x73b2('0x32')][_0x73b2('0x39')]('nolimit')){_0x47814d[_0x73b2('0x1b')]=qs['limit'](_0x1a2466[_0x73b2('0x32')]['limit']);_0x47814d[_0x73b2('0x19')]=qs['offset'](_0x1a2466[_0x73b2('0x32')]['offset']);}_0x47814d[_0x73b2('0x3a')]=qs[_0x73b2('0x3b')](_0x1a2466[_0x73b2('0x32')][_0x73b2('0x3b')]);_0x47814d['where']=qs[_0x73b2('0x34')](_[_0x73b2('0x3c')](_0x1a2466[_0x73b2('0x32')],_0x11b526[_0x73b2('0x34')]),_0x1a1254);if(_0x1a2466[_0x73b2('0x32')][_0x73b2('0x3d')]){_0x47814d['where']=_[_0x73b2('0x3e')](_0x47814d[_0x73b2('0x3f')],{'$or':_[_0x73b2('0x2c')](_0x1a1254,function(_0x3ffb99){if(_0x3ffb99[_0x73b2('0x2f')]!==_0x73b2('0x40')){var _0x16a66b={};_0x16a66b[_0x3ffb99['name']]={'$like':'%'+_0x1a2466['query'][_0x73b2('0x3d')]+'%'};return _0x16a66b;}})});}_0x47814d=_[_0x73b2('0x3e')]({},_0x47814d,_0x1a2466['options']);var _0x1b72e9={'where':_0x47814d[_0x73b2('0x3f')]};return db[_0x73b2('0x2d')][_0x73b2('0x1c')](_0x1b72e9)[_0x73b2('0x24')](function(_0x282d56){_0x315eb4['count']=_0x282d56;if(_0x1a2466[_0x73b2('0x32')]['includeAll']){_0x47814d['include']=[{'all':!![]}];}return db[_0x73b2('0x2d')][_0x73b2('0x41')](_0x47814d);})[_0x73b2('0x24')](function(_0x5ef4a3){_0x315eb4[_0x73b2('0x42')]=_0x5ef4a3;return _0x315eb4;})[_0x73b2('0x24')](respondWithFilteredResult(_0x5e0a1e,_0x47814d))[_0x73b2('0x43')](handleError(_0x5e0a1e,null));};exports[_0x73b2('0x44')]=function(_0xdcd9b6,_0x8f9917){var _0x100d7c={'raw':!![],'where':{'id':_0xdcd9b6[_0x73b2('0x45')]['id']}},_0x20695e={};_0x20695e[_0x73b2('0x31')]=_['keys'](db[_0x73b2('0x2d')][_0x73b2('0x2e')]);_0x20695e['query']=_[_0x73b2('0x33')](_0xdcd9b6[_0x73b2('0x32')]);_0x20695e[_0x73b2('0x34')]=_[_0x73b2('0x35')](_0x20695e[_0x73b2('0x31')],_0x20695e[_0x73b2('0x32')]);_0x100d7c[_0x73b2('0x36')]=_[_0x73b2('0x35')](_0x20695e[_0x73b2('0x31')],qs['fields'](_0xdcd9b6['query'][_0x73b2('0x37')]));_0x100d7c[_0x73b2('0x36')]=_0x100d7c[_0x73b2('0x36')]['length']?_0x100d7c[_0x73b2('0x36')]:_0x20695e[_0x73b2('0x31')];if(_0xdcd9b6['query']['includeAll']){_0x100d7c[_0x73b2('0x46')]=[{'all':!![]}];}_0x100d7c=_[_0x73b2('0x3e')]({},_0x100d7c,_0xdcd9b6[_0x73b2('0x47')]);return db[_0x73b2('0x2d')][_0x73b2('0x48')](_0x100d7c)[_0x73b2('0x24')](handleEntityNotFound(_0x8f9917,null))[_0x73b2('0x24')](respondWithResult(_0x8f9917,null))[_0x73b2('0x43')](handleError(_0x8f9917,null));};exports[_0x73b2('0x49')]=function(_0x26a864,_0x291a6f){return db['CmHopperAdditionalPhone']['create'](_0x26a864[_0x73b2('0x4a')],{})[_0x73b2('0x24')](function(_0x41ac15){var _0x55aa5f=_0x26a864[_0x73b2('0x4b')][_0x73b2('0x26')]({'plain':!![]});if(!_0x55aa5f)throw new Error(_0x73b2('0x4c'));if(_0x55aa5f['role']===_0x73b2('0x4b')){var _0x5049a3=_0x41ac15['get']({'plain':!![]});var _0x49c00f=_0x73b2('0x27');return db['UserProfileSection'][_0x73b2('0x48')]({'where':{'name':_0x49c00f,'userProfileId':_0x55aa5f[_0x73b2('0x4d')]},'raw':!![]})[_0x73b2('0x24')](function(_0xd04811){if(_0xd04811&&_0xd04811[_0x73b2('0x4e')]===0x0){return db['UserProfileResource'][_0x73b2('0x49')]({'name':_0x5049a3['name'],'resourceId':_0x5049a3['id'],'type':_0xd04811[_0x73b2('0x2a')],'sectionId':_0xd04811['id']},{})[_0x73b2('0x24')](function(){return _0x41ac15;});}else{return _0x41ac15;}})['catch'](function(_0x5cb4f7){logger[_0x73b2('0x28')](_0x73b2('0x4f'),_0x5cb4f7);throw _0x5cb4f7;});}return _0x41ac15;})[_0x73b2('0x24')](respondWithResult(_0x291a6f,0xc9))[_0x73b2('0x43')](handleError(_0x291a6f,null));};exports[_0x73b2('0x23')]=function(_0x4c4a08,_0xb90da1){if(_0x4c4a08[_0x73b2('0x4a')]['id']){delete _0x4c4a08[_0x73b2('0x4a')]['id'];}return db[_0x73b2('0x2d')][_0x73b2('0x48')]({'where':{'id':_0x4c4a08['params']['id']}})[_0x73b2('0x24')](handleEntityNotFound(_0xb90da1,null))[_0x73b2('0x24')](saveUpdates(_0x4c4a08[_0x73b2('0x4a')],null))[_0x73b2('0x24')](respondWithResult(_0xb90da1,null))[_0x73b2('0x43')](handleError(_0xb90da1,null));};exports[_0x73b2('0x25')]=function(_0x335ea3,_0x50e858){return db[_0x73b2('0x2d')][_0x73b2('0x48')]({'where':{'id':_0x335ea3[_0x73b2('0x45')]['id']}})[_0x73b2('0x24')](handleEntityNotFound(_0x50e858,null))['then'](removeEntity(_0x50e858,null))[_0x73b2('0x43')](handleError(_0x50e858,null));}; \ No newline at end of file +var _0x85dd=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x12fbeb,_0x1d057f){var _0x505f48=function(_0x93ff6a){while(--_0x93ff6a){_0x12fbeb['push'](_0x12fbeb['shift']());}};_0x505f48(++_0x1d057f);}(_0x85dd,0x182));var _0xd85d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x85dd[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd85d('0x0'));var zipdir=require(_0xd85d('0x1'));var jsonpatch=require(_0xd85d('0x2'));var rp=require(_0xd85d('0x3'));var moment=require(_0xd85d('0x4'));var BPromise=require(_0xd85d('0x5'));var Mustache=require(_0xd85d('0x6'));var util=require(_0xd85d('0x7'));var path=require('path');var sox=require(_0xd85d('0x8'));var csv=require(_0xd85d('0x9'));var ejs=require(_0xd85d('0xa'));var fs=require('fs');var fs_extra=require(_0xd85d('0xb'));var _=require(_0xd85d('0xc'));var squel=require(_0xd85d('0xd'));var crypto=require(_0xd85d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd85d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd85d('0x10'));var Papa=require(_0xd85d('0x11'));var Redis=require(_0xd85d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd85d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd85d('0x14'));var logger=require(_0xd85d('0x15'))(_0xd85d('0x16'));var utils=require('../../config/utils');var config=require(_0xd85d('0x17'));var licenseUtil=require(_0xd85d('0x18'));var db=require(_0xd85d('0x19'))['db'];function respondWithStatusCode(_0x188b9b,_0x1c0997){_0x1c0997=_0x1c0997||0xcc;return function(_0x214c41){if(_0x214c41){return _0x188b9b[_0xd85d('0x1a')](_0x1c0997);}return _0x188b9b[_0xd85d('0x1b')](_0x1c0997)['end']();};}function respondWithResult(_0x1cf9d5,_0x3f82f4){_0x3f82f4=_0x3f82f4||0xc8;return function(_0x54946a){if(_0x54946a){return _0x1cf9d5[_0xd85d('0x1b')](_0x3f82f4)['json'](_0x54946a);}};}function respondWithFilteredResult(_0x39f8e0,_0x23a478){return function(_0x24d90d){if(_0x24d90d){var _0x106094=typeof _0x23a478['offset']===_0xd85d('0x1c')&&typeof _0x23a478[_0xd85d('0x1d')]===_0xd85d('0x1c');var _0x320ea6=_0x24d90d['count'];var _0x2dbe1b=_0x106094?0x0:_0x23a478[_0xd85d('0x1e')];var _0x12b119=_0x106094?_0x24d90d[_0xd85d('0x1f')]:_0x23a478[_0xd85d('0x1e')]+_0x23a478[_0xd85d('0x1d')];var _0x215239;if(_0x12b119>=_0x320ea6){_0x12b119=_0x320ea6;_0x215239=0xc8;}else{_0x215239=0xce;}_0x39f8e0['status'](_0x215239);return _0x39f8e0[_0xd85d('0x20')](_0xd85d('0x21'),_0x2dbe1b+'-'+_0x12b119+'/'+_0x320ea6)[_0xd85d('0x22')](_0x24d90d);}return null;};}function patchUpdates(_0x1c28ac){return function(_0x213e5d){try{jsonpatch['apply'](_0x213e5d,_0x1c28ac,!![]);}catch(_0x4bad45){return BPromise['reject'](_0x4bad45);}return _0x213e5d['save']();};}function saveUpdates(_0x32fc88,_0x578fbb){return function(_0x5b70d1){if(_0x5b70d1){return _0x5b70d1[_0xd85d('0x23')](_0x32fc88)['then'](function(_0x36fd2a){return _0x36fd2a;});}return null;};}function removeEntity(_0x470167,_0x1dfcef){return function(_0x5d40a1){if(_0x5d40a1){return _0x5d40a1[_0xd85d('0x24')]()[_0xd85d('0x25')](function(){var _0x461be1=_0x5d40a1[_0xd85d('0x26')]({'plain':!![]});var _0x48485d='CmHopperAdditionalPhones';return db[_0xd85d('0x27')]['destroy']({'where':{'type':_0x48485d,'resourceId':_0x461be1['id']}})[_0xd85d('0x25')](function(){return _0x5d40a1;});})[_0xd85d('0x25')](function(){_0x470167[_0xd85d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb34b,_0x15e1c8){return function(_0x306236){if(!_0x306236){_0x4fb34b[_0xd85d('0x1a')](0x194);}return _0x306236;};}function handleError(_0x24749d,_0x5edec5){_0x5edec5=_0x5edec5||0x1f4;return function(_0x16863d){logger[_0xd85d('0x28')](_0x16863d[_0xd85d('0x29')]);if(_0x16863d[_0xd85d('0x2a')]){delete _0x16863d[_0xd85d('0x2a')];}_0x24749d[_0xd85d('0x1b')](_0x5edec5)[_0xd85d('0x2b')](_0x16863d);};}exports['index']=function(_0x439ecf,_0x3f1aff){var _0x4b7e4c={},_0x375350={},_0x533c60={'count':0x0,'rows':[]};var _0xd2401e=_[_0xd85d('0x2c')](db[_0xd85d('0x2d')]['rawAttributes'],function(_0x28364a){return{'name':_0x28364a['fieldName'],'type':_0x28364a[_0xd85d('0x2e')]['key']};});_0x375350[_0xd85d('0x2f')]=_['map'](_0xd2401e,_0xd85d('0x2a'));_0x375350[_0xd85d('0x30')]=_[_0xd85d('0x31')](_0x439ecf[_0xd85d('0x30')]);_0x375350[_0xd85d('0x32')]=_['intersection'](_0x375350[_0xd85d('0x2f')],_0x375350[_0xd85d('0x30')]);_0x4b7e4c[_0xd85d('0x33')]=_[_0xd85d('0x34')](_0x375350[_0xd85d('0x2f')],qs[_0xd85d('0x35')](_0x439ecf[_0xd85d('0x30')][_0xd85d('0x35')]));_0x4b7e4c[_0xd85d('0x33')]=_0x4b7e4c[_0xd85d('0x33')][_0xd85d('0x36')]?_0x4b7e4c['attributes']:_0x375350[_0xd85d('0x2f')];if(!_0x439ecf['query'][_0xd85d('0x37')](_0xd85d('0x38'))){_0x4b7e4c[_0xd85d('0x1d')]=qs['limit'](_0x439ecf[_0xd85d('0x30')]['limit']);_0x4b7e4c[_0xd85d('0x1e')]=qs[_0xd85d('0x1e')](_0x439ecf[_0xd85d('0x30')][_0xd85d('0x1e')]);}_0x4b7e4c[_0xd85d('0x39')]=qs[_0xd85d('0x3a')](_0x439ecf[_0xd85d('0x30')]['sort']);_0x4b7e4c[_0xd85d('0x3b')]=qs[_0xd85d('0x32')](_[_0xd85d('0x3c')](_0x439ecf[_0xd85d('0x30')],_0x375350[_0xd85d('0x32')]),_0xd2401e);if(_0x439ecf[_0xd85d('0x30')]['filter']){_0x4b7e4c['where']=_[_0xd85d('0x3d')](_0x4b7e4c[_0xd85d('0x3b')],{'$or':_[_0xd85d('0x2c')](_0xd2401e,function(_0x49e355){if(_0x49e355['type']!=='VIRTUAL'){var _0x36abae={};_0x36abae[_0x49e355[_0xd85d('0x2a')]]={'$like':'%'+_0x439ecf[_0xd85d('0x30')][_0xd85d('0x3e')]+'%'};return _0x36abae;}})});}_0x4b7e4c=_[_0xd85d('0x3d')]({},_0x4b7e4c,_0x439ecf[_0xd85d('0x3f')]);var _0x502376={'where':_0x4b7e4c[_0xd85d('0x3b')]};return db[_0xd85d('0x2d')][_0xd85d('0x1f')](_0x502376)['then'](function(_0x28aada){_0x533c60[_0xd85d('0x1f')]=_0x28aada;if(_0x439ecf['query'][_0xd85d('0x40')]){_0x4b7e4c[_0xd85d('0x41')]=[{'all':!![]}];}return db[_0xd85d('0x2d')][_0xd85d('0x42')](_0x4b7e4c);})[_0xd85d('0x25')](function(_0x45589b){_0x533c60[_0xd85d('0x43')]=_0x45589b;return _0x533c60;})['then'](respondWithFilteredResult(_0x3f1aff,_0x4b7e4c))[_0xd85d('0x44')](handleError(_0x3f1aff,null));};exports['show']=function(_0x3a39f0,_0x1ace22){var _0x326a60={'raw':!![],'where':{'id':_0x3a39f0[_0xd85d('0x45')]['id']}},_0x1b07de={};_0x1b07de[_0xd85d('0x2f')]=_[_0xd85d('0x31')](db[_0xd85d('0x2d')]['rawAttributes']);_0x1b07de[_0xd85d('0x30')]=_[_0xd85d('0x31')](_0x3a39f0[_0xd85d('0x30')]);_0x1b07de[_0xd85d('0x32')]=_['intersection'](_0x1b07de[_0xd85d('0x2f')],_0x1b07de[_0xd85d('0x30')]);_0x326a60[_0xd85d('0x33')]=_[_0xd85d('0x34')](_0x1b07de[_0xd85d('0x2f')],qs['fields'](_0x3a39f0[_0xd85d('0x30')][_0xd85d('0x35')]));_0x326a60['attributes']=_0x326a60[_0xd85d('0x33')][_0xd85d('0x36')]?_0x326a60[_0xd85d('0x33')]:_0x1b07de[_0xd85d('0x2f')];if(_0x3a39f0[_0xd85d('0x30')]['includeAll']){_0x326a60['include']=[{'all':!![]}];}_0x326a60=_[_0xd85d('0x3d')]({},_0x326a60,_0x3a39f0[_0xd85d('0x3f')]);return db[_0xd85d('0x2d')][_0xd85d('0x46')](_0x326a60)[_0xd85d('0x25')](handleEntityNotFound(_0x1ace22,null))['then'](respondWithResult(_0x1ace22,null))[_0xd85d('0x44')](handleError(_0x1ace22,null));};exports[_0xd85d('0x47')]=function(_0x355a9b,_0x264580){return db[_0xd85d('0x2d')][_0xd85d('0x47')](_0x355a9b[_0xd85d('0x48')],{})[_0xd85d('0x25')](function(_0x433b47){var _0x4c8111=_0x355a9b['user']['get']({'plain':!![]});if(!_0x4c8111)throw new Error(_0xd85d('0x49'));if(_0x4c8111[_0xd85d('0x4a')]==='user'){var _0xce5155=_0x433b47[_0xd85d('0x26')]({'plain':!![]});var _0x3e53c7='CmHopperAdditionalPhones';return db[_0xd85d('0x4b')]['find']({'where':{'name':_0x3e53c7,'userProfileId':_0x4c8111[_0xd85d('0x4c')]},'raw':!![]})[_0xd85d('0x25')](function(_0x49c21f){if(_0x49c21f&&_0x49c21f[_0xd85d('0x4d')]===0x0){return db['UserProfileResource'][_0xd85d('0x47')]({'name':_0xce5155[_0xd85d('0x2a')],'resourceId':_0xce5155['id'],'type':_0x49c21f[_0xd85d('0x2a')],'sectionId':_0x49c21f['id']},{})['then'](function(){return _0x433b47;});}else{return _0x433b47;}})['catch'](function(_0x69d2af){logger[_0xd85d('0x28')](_0xd85d('0x4e'),_0x69d2af);throw _0x69d2af;});}return _0x433b47;})[_0xd85d('0x25')](respondWithResult(_0x264580,0xc9))[_0xd85d('0x44')](handleError(_0x264580,null));};exports['update']=function(_0x4ba687,_0x37a7ca){if(_0x4ba687['body']['id']){delete _0x4ba687[_0xd85d('0x48')]['id'];}return db['CmHopperAdditionalPhone'][_0xd85d('0x46')]({'where':{'id':_0x4ba687[_0xd85d('0x45')]['id']}})[_0xd85d('0x25')](handleEntityNotFound(_0x37a7ca,null))[_0xd85d('0x25')](saveUpdates(_0x4ba687[_0xd85d('0x48')],null))[_0xd85d('0x25')](respondWithResult(_0x37a7ca,null))[_0xd85d('0x44')](handleError(_0x37a7ca,null));};exports[_0xd85d('0x24')]=function(_0x14cd87,_0x2e9bfb){return db[_0xd85d('0x2d')]['find']({'where':{'id':_0x14cd87[_0xd85d('0x45')]['id']}})[_0xd85d('0x25')](handleEntityNotFound(_0x2e9bfb,null))[_0xd85d('0x25')](removeEntity(_0x2e9bfb,null))[_0xd85d('0x44')](handleError(_0x2e9bfb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a60ef9e..4958894 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 _0xbe36=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x5c1b03,_0x3e8077){var _0x53706b=function(_0x2d3569){while(--_0x2d3569){_0x5c1b03['push'](_0x5c1b03['shift']());}};_0x53706b(++_0x3e8077);}(_0xbe36,0xd1));var _0x6be3=function(_0x3ef5f8,_0x5ae8d6){_0x3ef5f8=_0x3ef5f8-0x0;var _0x328b3b=_0xbe36[_0x3ef5f8];return _0x328b3b;};'use strict';var _=require(_0x6be3('0x0'));var util=require('util');var logger=require(_0x6be3('0x1'))('api');var moment=require(_0x6be3('0x2'));var BPromise=require(_0x6be3('0x3'));var rp=require(_0x6be3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6be3('0x5'));var config=require(_0x6be3('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x6be3('0x7')]=function(_0xfd656d,_0x4d8bac){return _0xfd656d[_0x6be3('0x8')](_0x6be3('0x9'),attributes,{'tableName':_0x6be3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd252=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x112319,_0x578711){var _0x2f767d=function(_0x5a7882){while(--_0x5a7882){_0x112319['push'](_0x112319['shift']());}};_0x2f767d(++_0x578711);}(_0xd252,0xb3));var _0x2d25=function(_0x530e0e,_0x54d536){_0x530e0e=_0x530e0e-0x0;var _0x2742fb=_0xd252[_0x530e0e];return _0x2742fb;};'use strict';var _=require(_0x2d25('0x0'));var util=require(_0x2d25('0x1'));var logger=require(_0x2d25('0x2'))('api');var moment=require(_0x2d25('0x3'));var BPromise=require(_0x2d25('0x4'));var rp=require(_0x2d25('0x5'));var fs=require('fs');var path=require(_0x2d25('0x6'));var rimraf=require(_0x2d25('0x7'));var config=require(_0x2d25('0x8'));var attributes=require(_0x2d25('0x9'));module[_0x2d25('0xa')]=function(_0x30ca66,_0x21c7b6){return _0x30ca66['define'](_0x2d25('0xb'),attributes,{'tableName':_0x2d25('0xc'),'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 5c5db53..c4cc164 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 _0xaed1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','entity','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','add','minutes','isNil','createdAt','updatedAt','phone','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash'];(function(_0x2b890f,_0x141edb){var _0x3223ca=function(_0x544c2c){while(--_0x544c2c){_0x2b890f['push'](_0x2b890f['shift']());}};_0x3223ca(++_0x141edb);}(_0xaed1,0x1b1));var _0x1aed=function(_0x27e811,_0x1fad22){_0x27e811=_0x27e811-0x0;var _0x1bfe61=_0xaed1[_0x27e811];return _0x1bfe61;};'use strict';var _=require(_0x1aed('0x0'));var util=require(_0x1aed('0x1'));var moment=require(_0x1aed('0x2'));var BPromise=require(_0x1aed('0x3'));var rs=require(_0x1aed('0x4'));var fs=require('fs');var Redis=require(_0x1aed('0x5'));var db=require(_0x1aed('0x6'))['db'];var utils=require(_0x1aed('0x7'));var logger=require(_0x1aed('0x8'))(_0x1aed('0x9'));var config=require(_0x1aed('0xa'));var jayson=require(_0x1aed('0xb'));var client=jayson[_0x1aed('0xc')][_0x1aed('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x318564,_0x23b23b,_0x562bea){return new BPromise(function(_0x3e0d0f,_0x1813ef){return client[_0x1aed('0xe')](_0x318564,_0x562bea)['then'](function(_0x3cacd2){logger[_0x1aed('0xf')](_0x1aed('0x10'),_0x23b23b,_0x1aed('0x11'));logger[_0x1aed('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x23b23b,_0x1aed('0x11'),JSON['stringify'](_0x3cacd2));if(_0x3cacd2['error']){if(_0x3cacd2[_0x1aed('0x13')][_0x1aed('0x14')]===0x1f4){logger['error'](_0x1aed('0x10'),_0x23b23b,_0x3cacd2[_0x1aed('0x13')]['message']);return _0x1813ef(_0x3cacd2['error'][_0x1aed('0x15')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x23b23b,_0x3cacd2[_0x1aed('0x13')][_0x1aed('0x15')]);return _0x3e0d0f(_0x3cacd2[_0x1aed('0x13')][_0x1aed('0x15')]);}else{logger[_0x1aed('0xf')](_0x1aed('0x10'),_0x23b23b,'request\x20sent');_0x3e0d0f(_0x3cacd2[_0x1aed('0x16')][_0x1aed('0x15')]);}})[_0x1aed('0x17')](function(_0x327330){logger[_0x1aed('0x13')](_0x1aed('0x10'),_0x23b23b,_0x327330);_0x1813ef(_0x327330);});});}exports[_0x1aed('0x18')]=function(_0x2df4ef){var _0x272b4c=this;return new Promise(function(_0x462871,_0x4b4146){return db[_0x1aed('0x19')][_0x1aed('0x1a')]({'raw':!![],'where':{'ContactId':_0x2df4ef[_0x1aed('0x1b')][_0x1aed('0x1c')],'ListId':_0x2df4ef[_0x1aed('0x1b')]['ListId'],'VoiceQueueId':_0x2df4ef[_0x1aed('0x1b')][_0x1aed('0x1d')]===undefined?null:_0x2df4ef['body'][_0x1aed('0x1d')],'CampaignId':_0x2df4ef['body'][_0x1aed('0x1e')]===undefined?null:_0x2df4ef[_0x1aed('0x1b')][_0x1aed('0x1e')]}})['then'](function(_0xf45c60){if(_0xf45c60!=null){return db[_0x1aed('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xf45c60['id'],'OrderBy':{'$gt':_0xf45c60[_0x1aed('0x20')]}},'order':[[_0x1aed('0x20'),_0x1aed('0x21')]]})[_0x1aed('0x22')](function(_0x47fa08){var _0x1a00ad=0x0;if(_0x47fa08){if(_0x47fa08[_0x1aed('0x23')]+_0x47fa08[_0x1aed('0x24')]+_0x47fa08[_0x1aed('0x25')]+_0x47fa08[_0x1aed('0x26')]+_0x47fa08[_0x1aed('0x27')]+_0x47fa08[_0x1aed('0x28')]+_0x47fa08[_0x1aed('0x29')]+_0x47fa08[_0x1aed('0x2a')]<_0x2df4ef['entity'][_0x1aed('0x2b')])_0x1a00ad=0x1;_0x462871({'additional':_0x1a00ad});}else{return db['CmHopperAdditionalPhone'][_0x1aed('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xf45c60['id']},'order':[['OrderBy',_0x1aed('0x21')]]})[_0x1aed('0x22')](function(_0x2363a8){var _0x130cd0=0x0;if(_0x2363a8){if(_0x2363a8[_0x1aed('0x23')]+_0x2363a8[_0x1aed('0x24')]+_0x2363a8['countnoanswerretry']+_0x2363a8[_0x1aed('0x26')]+_0x2363a8['countdropretry']+_0x2363a8['countabandonedretry']+_0x2363a8[_0x1aed('0x29')]+_0x2363a8['countagentrejectretry']<_0x2df4ef[_0x1aed('0x2c')][_0x1aed('0x2b')])_0x130cd0=0x1;_0x462871({'additional':_0x130cd0});}else{_0x462871({'additional':0x0});}})[_0x1aed('0x17')](function(_0x5d6e28){logger[_0x1aed('0x13')](_0x1aed('0x18'),_0x5d6e28[_0x1aed('0x15')]);_0x4b4146(_0x272b4c[_0x1aed('0x13')](0x1f4,_0x5d6e28[_0x1aed('0x15')]));});}})[_0x1aed('0x17')](function(_0x4d5423){logger[_0x1aed('0x13')](_0x1aed('0x18'),_0x4d5423[_0x1aed('0x15')]);_0x4b4146(_0x272b4c[_0x1aed('0x13')](0x1f4,_0x4d5423[_0x1aed('0x15')]));});}else _0x462871({'additional':0x0});});});};exports[_0x1aed('0x2d')]=function(_0x316596){var _0x14d948=this;return new Promise(function(_0x42c47d,_0x45f4b8){return db['CmHopper'][_0x1aed('0x1a')]({'raw':!![],'where':{'ContactId':_0x316596[_0x1aed('0x1b')][_0x1aed('0x1c')],'ListId':_0x316596[_0x1aed('0x1b')][_0x1aed('0x2e')],'VoiceQueueId':_0x316596[_0x1aed('0x1b')][_0x1aed('0x1d')]===undefined?null:_0x316596[_0x1aed('0x1b')][_0x1aed('0x1d')],'CampaignId':_0x316596[_0x1aed('0x1b')][_0x1aed('0x1e')]===undefined?null:_0x316596[_0x1aed('0x1b')][_0x1aed('0x1e')]}})[_0x1aed('0x22')](function(_0x492dc6){if(_0x492dc6!=null){return db['CmHopperAdditionalPhone'][_0x1aed('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x492dc6['id'],'OrderBy':{'$gte':_0x492dc6[_0x1aed('0x20')]}},'order':[[_0x1aed('0x20'),_0x1aed('0x21')]]})['then'](function(_0x1a303d){if(_0x1a303d)return activateAdditionalPhone(_0x492dc6,_0x316596[_0x1aed('0x1b')],_0x1a303d,_0x316596[_0x1aed('0x2f')],_0x316596[_0x1aed('0x30')])['then'](function(_0x20f2b7){_0x42c47d(_0x20f2b7);});else{return db[_0x1aed('0x1f')][_0x1aed('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x492dc6['id']},'order':[[_0x1aed('0x20'),_0x1aed('0x21')]]})['then'](function(_0x111a45){if(_0x111a45)return activateAdditionalPhone(_0x492dc6,_0x316596[_0x1aed('0x1b')],_0x111a45,_0x316596[_0x1aed('0x2f')],_0x316596[_0x1aed('0x30')])[_0x1aed('0x22')](function(_0x67d3bd){_0x42c47d(_0x67d3bd);});else{_0x42c47d({'id':_0x492dc6['id'],'phone':''});}})[_0x1aed('0x17')](function(_0x3e8d78){logger[_0x1aed('0x13')]('VerifyAdditionalPhones',_0x3e8d78[_0x1aed('0x15')]);_0x45f4b8(_0x14d948['error'](0x1f4,_0x3e8d78['message']));});}})[_0x1aed('0x17')](function(_0x440bac){logger[_0x1aed('0x13')](_0x1aed('0x18'),_0x440bac['message']);_0x45f4b8(_0x14d948[_0x1aed('0x13')](0x1f4,_0x440bac['message']));});}else _0x42c47d(0x1);});});};function activateAdditionalPhone(_0x2b0967,_0x12e8c2,_0x48deeb,_0x2a5211,_0x2f1446){return new Promise(function(_0x579f5c,_0x319ab6){var _0x29e4eb;if(_['isNil'](_0x48deeb[_0x1aed('0x31')])){_0x48deeb['scheduledat']=moment();}if(moment()>moment(_0x48deeb[_0x1aed('0x31')])){_0x29e4eb=moment()['add'](_0x2f1446||0x3,'minutes');}else{if(_0x48deeb[_0x1aed('0x20')]==0x0){_0x29e4eb=moment(_0x48deeb[_0x1aed('0x31')]);}else{_0x29e4eb=moment()['add'](_0x2f1446||0x3,'minutes');}}if(_['isNil'](_0x29e4eb)){_0x29e4eb=moment()[_0x1aed('0x32')](_0x2f1446||0x3,_0x1aed('0x33'));}var _0x4c07ad={'phone':_0x2b0967['phone'],'active':0x0,'OrderBy':_[_0x1aed('0x34')](_0x2b0967[_0x1aed('0x20')])?0x0:_0x2b0967[_0x1aed('0x20')],'scheduledat':moment()[_0x1aed('0x32')](_0x2a5211||0x1,_0x1aed('0x33')),'countbusyretry':_0x12e8c2[_0x1aed('0x23')],'countcongestionretry':_0x12e8c2[_0x1aed('0x24')],'countnoanswerretry':_0x12e8c2[_0x1aed('0x25')],'countnosuchnumberretry':_0x12e8c2[_0x1aed('0x26')],'countdropretry':_0x12e8c2[_0x1aed('0x27')],'countabandonedretry':_0x12e8c2[_0x1aed('0x28')],'countmachineretry':_0x12e8c2[_0x1aed('0x29')],'countagentrejectretry':_0x12e8c2[_0x1aed('0x2a')],'createdAt':_0x12e8c2[_0x1aed('0x35')],'updatedAt':_0x12e8c2[_0x1aed('0x36')]};var _0xe9e640={'CmHopperId':_0x2b0967['id'],'phone':_0x48deeb[_0x1aed('0x37')],'active':0x0,'OrderBy':_['isNil'](_0x48deeb[_0x1aed('0x20')])?0x0:_0x48deeb[_0x1aed('0x20')],'scheduledat':_0x29e4eb,'countbusyretry':_0x48deeb[_0x1aed('0x23')],'countcongestionretry':_0x48deeb[_0x1aed('0x24')],'countnoanswerretry':_0x48deeb[_0x1aed('0x25')],'countnosuchnumberretry':_0x48deeb[_0x1aed('0x26')],'countdropretry':_0x48deeb[_0x1aed('0x27')],'countabandonedretry':_0x48deeb[_0x1aed('0x28')],'countmachineretry':_0x48deeb[_0x1aed('0x29')],'countagentrejectretry':_0x48deeb[_0x1aed('0x2a')],'createdAt':_0x48deeb['createdAt'],'updatedAt':_0x48deeb[_0x1aed('0x36')]};return db[_0x1aed('0x38')][_0x1aed('0x39')](function(_0x4cb1d5){return db[_0x1aed('0x1f')][_0x1aed('0x3a')](_0x4c07ad,{'where':{'id':_0x48deeb['id']}},{'transaction':_0x4cb1d5})['then'](function(){return db['CmHopper'][_0x1aed('0x3a')](_0xe9e640,{'where':{'id':_0x2b0967['id']}},{'transaction':_0x4cb1d5});});})[_0x1aed('0x22')](function(_0x351094){_0x579f5c({'id':_0x2b0967['id'],'phone':_0x48deeb[_0x1aed('0x37')]});})[_0x1aed('0x17')](function(_0x39318c){logger[_0x1aed('0x13')](_0x1aed('0x3b'),_0x39318c[_0x1aed('0x15')]);_0x319ab6({'error':_0x39318c[_0x1aed('0x15')]});});});}exports[_0x1aed('0x3c')]=function(_0x4eeb20){var _0x457150=this;return new Promise(function(_0xe9a9b0,_0x2de28a){return db['CmHopper'][_0x1aed('0x3a')](_0x4eeb20[_0x1aed('0x1b')][_0x1aed('0x3d')],{'where':{'id':_0x4eeb20[_0x1aed('0x1b')]['id']}})[_0x1aed('0x22')](function(_0x1ae618){_0xe9a9b0(_0x1ae618);})[_0x1aed('0x17')](function(_0x598c20){logger['error'](_0x1aed('0x3c'),_0x598c20['message']);_0x2de28a(_0x457150[_0x1aed('0x13')](0x1f4,_0x598c20[_0x1aed('0x15')]));});});}; \ No newline at end of file +var _0xcf5d=['http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countagentrejectretry','SwapAdditionalPhones','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client'];(function(_0x488a09,_0x2ce70f){var _0xe6bfb0=function(_0x3fe8eb){while(--_0x3fe8eb){_0x488a09['push'](_0x488a09['shift']());}};_0xe6bfb0(++_0x2ce70f);}(_0xcf5d,0x1c0));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdcf5('0x0'));var util=require('util');var moment=require(_0xdcf5('0x1'));var BPromise=require(_0xdcf5('0x2'));var rs=require(_0xdcf5('0x3'));var fs=require('fs');var Redis=require(_0xdcf5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdcf5('0x5'))('rpc');var config=require(_0xdcf5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdcf5('0x7')][_0xdcf5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcd09e9,_0x42bd00,_0x1a8a92){return new BPromise(function(_0xeede13,_0x431d4a){return client[_0xdcf5('0x9')](_0xcd09e9,_0x1a8a92)[_0xdcf5('0xa')](function(_0x29fd23){logger[_0xdcf5('0xb')](_0xdcf5('0xc'),_0x42bd00,_0xdcf5('0xd'));logger[_0xdcf5('0xe')](_0xdcf5('0xf'),_0x42bd00,_0xdcf5('0xd'),JSON[_0xdcf5('0x10')](_0x29fd23));if(_0x29fd23['error']){if(_0x29fd23[_0xdcf5('0x11')][_0xdcf5('0x12')]===0x1f4){logger[_0xdcf5('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x42bd00,_0x29fd23[_0xdcf5('0x11')][_0xdcf5('0x13')]);return _0x431d4a(_0x29fd23[_0xdcf5('0x11')][_0xdcf5('0x13')]);}logger[_0xdcf5('0x11')](_0xdcf5('0xc'),_0x42bd00,_0x29fd23[_0xdcf5('0x11')][_0xdcf5('0x13')]);return _0xeede13(_0x29fd23['error'][_0xdcf5('0x13')]);}else{logger[_0xdcf5('0xb')](_0xdcf5('0xc'),_0x42bd00,_0xdcf5('0xd'));_0xeede13(_0x29fd23[_0xdcf5('0x14')][_0xdcf5('0x13')]);}})[_0xdcf5('0x15')](function(_0xafe214){logger[_0xdcf5('0x11')](_0xdcf5('0xc'),_0x42bd00,_0xafe214);_0x431d4a(_0xafe214);});});}exports[_0xdcf5('0x16')]=function(_0x444e3f){var _0x5278be=this;return new Promise(function(_0x2dbe24,_0x355f5b){return db[_0xdcf5('0x17')][_0xdcf5('0x18')]({'raw':!![],'where':{'ContactId':_0x444e3f['body'][_0xdcf5('0x19')],'ListId':_0x444e3f[_0xdcf5('0x1a')][_0xdcf5('0x1b')],'VoiceQueueId':_0x444e3f[_0xdcf5('0x1a')][_0xdcf5('0x1c')]===undefined?null:_0x444e3f['body']['VoiceQueueId'],'CampaignId':_0x444e3f[_0xdcf5('0x1a')][_0xdcf5('0x1d')]===undefined?null:_0x444e3f['body'][_0xdcf5('0x1d')]}})[_0xdcf5('0xa')](function(_0x4e4308){if(_0x4e4308!=null){return db[_0xdcf5('0x1e')][_0xdcf5('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4e4308['id'],'OrderBy':{'$gt':_0x4e4308[_0xdcf5('0x1f')]}},'order':[[_0xdcf5('0x1f'),_0xdcf5('0x20')]]})[_0xdcf5('0xa')](function(_0x47fc63){var _0x5d473a=0x0;if(_0x47fc63){if(_0x47fc63[_0xdcf5('0x21')]+_0x47fc63[_0xdcf5('0x22')]+_0x47fc63[_0xdcf5('0x23')]+_0x47fc63[_0xdcf5('0x24')]+_0x47fc63[_0xdcf5('0x25')]+_0x47fc63[_0xdcf5('0x26')]+_0x47fc63[_0xdcf5('0x27')]+_0x47fc63['countagentrejectretry']<_0x444e3f[_0xdcf5('0x28')][_0xdcf5('0x29')])_0x5d473a=0x1;_0x2dbe24({'additional':_0x5d473a});}else{return db['CmHopperAdditionalPhone'][_0xdcf5('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4e4308['id']},'order':[[_0xdcf5('0x1f'),'ASC']]})[_0xdcf5('0xa')](function(_0x565a0a){var _0x2226f1=0x0;if(_0x565a0a){if(_0x565a0a[_0xdcf5('0x21')]+_0x565a0a['countcongestionretry']+_0x565a0a[_0xdcf5('0x23')]+_0x565a0a[_0xdcf5('0x24')]+_0x565a0a[_0xdcf5('0x25')]+_0x565a0a[_0xdcf5('0x26')]+_0x565a0a[_0xdcf5('0x27')]+_0x565a0a[_0xdcf5('0x2a')]<_0x444e3f[_0xdcf5('0x28')]['dialGlobalMaxRetry'])_0x2226f1=0x1;_0x2dbe24({'additional':_0x2226f1});}else{_0x2dbe24({'additional':0x0});}})['catch'](function(_0x1616c8){logger[_0xdcf5('0x11')](_0xdcf5('0x16'),_0x1616c8[_0xdcf5('0x13')]);_0x355f5b(_0x5278be['error'](0x1f4,_0x1616c8[_0xdcf5('0x13')]));});}})[_0xdcf5('0x15')](function(_0xe96897){logger['error']('VerifyAdditionalPhones',_0xe96897['message']);_0x355f5b(_0x5278be[_0xdcf5('0x11')](0x1f4,_0xe96897[_0xdcf5('0x13')]));});}else _0x2dbe24({'additional':0x0});});});};exports[_0xdcf5('0x2b')]=function(_0x147180){var _0x1b8600=this;return new Promise(function(_0x1df682,_0x4b78c5){return db[_0xdcf5('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x147180['body'][_0xdcf5('0x19')],'ListId':_0x147180[_0xdcf5('0x1a')][_0xdcf5('0x1b')],'VoiceQueueId':_0x147180[_0xdcf5('0x1a')][_0xdcf5('0x1c')]===undefined?null:_0x147180['body'][_0xdcf5('0x1c')],'CampaignId':_0x147180[_0xdcf5('0x1a')][_0xdcf5('0x1d')]===undefined?null:_0x147180[_0xdcf5('0x1a')]['CampaignId']}})[_0xdcf5('0xa')](function(_0x2b679c){if(_0x2b679c!=null){return db[_0xdcf5('0x1e')][_0xdcf5('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2b679c['id'],'OrderBy':{'$gte':_0x2b679c['OrderBy']}},'order':[[_0xdcf5('0x1f'),_0xdcf5('0x20')]]})[_0xdcf5('0xa')](function(_0x2cf47c){if(_0x2cf47c)return activateAdditionalPhone(_0x2b679c,_0x147180[_0xdcf5('0x1a')],_0x2cf47c,_0x147180['duration'],_0x147180[_0xdcf5('0x2c')])[_0xdcf5('0xa')](function(_0x484c16){_0x1df682(_0x484c16);});else{return db[_0xdcf5('0x1e')][_0xdcf5('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2b679c['id']},'order':[[_0xdcf5('0x1f'),_0xdcf5('0x20')]]})[_0xdcf5('0xa')](function(_0x1c3c5e){if(_0x1c3c5e)return activateAdditionalPhone(_0x2b679c,_0x147180[_0xdcf5('0x1a')],_0x1c3c5e,_0x147180['duration'],_0x147180[_0xdcf5('0x2c')])[_0xdcf5('0xa')](function(_0x2f978a){_0x1df682(_0x2f978a);});else{_0x1df682({'id':_0x2b679c['id'],'phone':''});}})[_0xdcf5('0x15')](function(_0x27a9a9){logger['error']('VerifyAdditionalPhones',_0x27a9a9[_0xdcf5('0x13')]);_0x4b78c5(_0x1b8600[_0xdcf5('0x11')](0x1f4,_0x27a9a9[_0xdcf5('0x13')]));});}})['catch'](function(_0x36c9bb){logger[_0xdcf5('0x11')](_0xdcf5('0x16'),_0x36c9bb['message']);_0x4b78c5(_0x1b8600['error'](0x1f4,_0x36c9bb[_0xdcf5('0x13')]));});}else _0x1df682(0x1);});});};function activateAdditionalPhone(_0x33ce52,_0x280b0e,_0x36f113,_0x3b21a4,_0x4b01f2){return new Promise(function(_0x40ab2f,_0x2d9949){var _0x557e23;if(_[_0xdcf5('0x2d')](_0x36f113[_0xdcf5('0x2e')])){_0x36f113[_0xdcf5('0x2e')]=moment();}if(moment()>moment(_0x36f113[_0xdcf5('0x2e')])){_0x557e23=moment()['add'](_0x4b01f2||0x3,_0xdcf5('0x2f'));}else{if(_0x36f113[_0xdcf5('0x1f')]==0x0){_0x557e23=moment(_0x36f113[_0xdcf5('0x2e')]);}else{_0x557e23=moment()['add'](_0x4b01f2||0x3,_0xdcf5('0x2f'));}}if(_['isNil'](_0x557e23)){_0x557e23=moment()[_0xdcf5('0x30')](_0x4b01f2||0x3,_0xdcf5('0x2f'));}var _0x22c531={'phone':_0x33ce52[_0xdcf5('0x31')],'active':0x0,'OrderBy':_[_0xdcf5('0x2d')](_0x33ce52[_0xdcf5('0x1f')])?0x0:_0x33ce52['OrderBy'],'scheduledat':moment()['add'](_0x3b21a4||0x1,'minutes'),'countbusyretry':_0x280b0e[_0xdcf5('0x21')],'countcongestionretry':_0x280b0e[_0xdcf5('0x22')],'countnoanswerretry':_0x280b0e[_0xdcf5('0x23')],'countnosuchnumberretry':_0x280b0e['countnosuchnumberretry'],'countdropretry':_0x280b0e[_0xdcf5('0x25')],'countabandonedretry':_0x280b0e[_0xdcf5('0x26')],'countmachineretry':_0x280b0e[_0xdcf5('0x27')],'countagentrejectretry':_0x280b0e[_0xdcf5('0x2a')],'createdAt':_0x280b0e[_0xdcf5('0x32')],'updatedAt':_0x280b0e[_0xdcf5('0x33')]};var _0x2b98ef={'CmHopperId':_0x33ce52['id'],'phone':_0x36f113[_0xdcf5('0x31')],'active':0x0,'OrderBy':_[_0xdcf5('0x2d')](_0x36f113[_0xdcf5('0x1f')])?0x0:_0x36f113[_0xdcf5('0x1f')],'scheduledat':_0x557e23,'countbusyretry':_0x36f113[_0xdcf5('0x21')],'countcongestionretry':_0x36f113['countcongestionretry'],'countnoanswerretry':_0x36f113[_0xdcf5('0x23')],'countnosuchnumberretry':_0x36f113[_0xdcf5('0x24')],'countdropretry':_0x36f113[_0xdcf5('0x25')],'countabandonedretry':_0x36f113[_0xdcf5('0x26')],'countmachineretry':_0x36f113[_0xdcf5('0x27')],'countagentrejectretry':_0x36f113[_0xdcf5('0x2a')],'createdAt':_0x36f113[_0xdcf5('0x32')],'updatedAt':_0x36f113[_0xdcf5('0x33')]};return db['sequelize'][_0xdcf5('0x34')](function(_0x1bda64){return db['CmHopperAdditionalPhone'][_0xdcf5('0x35')](_0x22c531,{'where':{'id':_0x36f113['id']}},{'transaction':_0x1bda64})[_0xdcf5('0xa')](function(){return db[_0xdcf5('0x17')][_0xdcf5('0x35')](_0x2b98ef,{'where':{'id':_0x33ce52['id']}},{'transaction':_0x1bda64});});})[_0xdcf5('0xa')](function(_0x4f42d9){_0x40ab2f({'id':_0x33ce52['id'],'phone':_0x36f113[_0xdcf5('0x31')]});})[_0xdcf5('0x15')](function(_0x6f560f){logger[_0xdcf5('0x11')](_0xdcf5('0x36'),_0x6f560f[_0xdcf5('0x13')]);_0x2d9949({'error':_0x6f560f['message']});});});}exports['IncrementPreviewCounters']=function(_0xcdfbb5){var _0x4926bd=this;return new Promise(function(_0x22399b,_0x36967a){return db['CmHopper'][_0xdcf5('0x35')](_0xcdfbb5[_0xdcf5('0x1a')][_0xdcf5('0x37')],{'where':{'id':_0xcdfbb5['body']['id']}})['then'](function(_0xd2513f){_0x22399b(_0xd2513f);})[_0xdcf5('0x15')](function(_0x5ea1c0){logger[_0xdcf5('0x11')](_0xdcf5('0x38'),_0x5ea1c0[_0xdcf5('0x13')]);_0x36967a(_0x4926bd[_0xdcf5('0x11')](0x1f4,_0x5ea1c0['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 8d916a2..53c5b15 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 _0x3c8e=['/:id','show','post','create','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x3c8e,0xf3));var _0xe3c8=function(_0x4266c9,_0x3281c3){_0x4266c9=_0x4266c9-0x0;var _0x23b46f=_0x3c8e[_0x4266c9];return _0x23b46f;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require(_0xe3c8('0x2'));var timeout=require(_0xe3c8('0x3'));var express=require(_0xe3c8('0x4'));var router=express['Router']();var fs_extra=require(_0xe3c8('0x5'));var auth=require(_0xe3c8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe3c8('0x7'));var controller=require(_0xe3c8('0x8'));router[_0xe3c8('0x9')]('/',auth[_0xe3c8('0xa')](),controller[_0xe3c8('0xb')]);router['get'](_0xe3c8('0xc'),auth[_0xe3c8('0xa')](),controller[_0xe3c8('0xd')]);router[_0xe3c8('0xe')]('/',auth[_0xe3c8('0xa')](),controller[_0xe3c8('0xf')]);router['put'](_0xe3c8('0xc'),auth[_0xe3c8('0xa')](),controller['update']);router[_0xe3c8('0x10')](_0xe3c8('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5686=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get'];(function(_0x2686f9,_0x820879){var _0x16fcb4=function(_0x1a7a7e){while(--_0x1a7a7e){_0x2686f9['push'](_0x2686f9['shift']());}};_0x16fcb4(++_0x820879);}(_0x5686,0x1be));var _0x6568=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x5686[_0x130209];return _0x155fb7;};'use strict';var multer=require(_0x6568('0x0'));var util=require(_0x6568('0x1'));var path=require(_0x6568('0x2'));var timeout=require(_0x6568('0x3'));var express=require(_0x6568('0x4'));var router=express[_0x6568('0x5')]();var fs_extra=require(_0x6568('0x6'));var auth=require(_0x6568('0x7'));var interaction=require(_0x6568('0x8'));var config=require(_0x6568('0x9'));var controller=require(_0x6568('0xa'));router['get']('/',auth[_0x6568('0xb')](),controller[_0x6568('0xc')]);router[_0x6568('0xd')](_0x6568('0xe'),auth[_0x6568('0xb')](),controller[_0x6568('0xf')]);router[_0x6568('0x10')]('/',auth[_0x6568('0xb')](),controller[_0x6568('0x11')]);router[_0x6568('0x12')](_0x6568('0xe'),auth[_0x6568('0xb')](),controller[_0x6568('0x13')]);router[_0x6568('0x14')]('/:id',auth[_0x6568('0xb')](),controller[_0x6568('0x15')]);module[_0x6568('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a82b9d5..c0e322e 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 _0x5655=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x194794,_0x2858f2){var _0x4720fb=function(_0x2baeb0){while(--_0x2baeb0){_0x194794['push'](_0x194794['shift']());}};_0x4720fb(++_0x2858f2);}(_0x5655,0x15e));var _0x5565=function(_0x3beef3,_0x3518d0){_0x3beef3=_0x3beef3-0x0;var _0x7139c9=_0x5655[_0x3beef3];return _0x7139c9;};'use strict';var moment=require(_0x5565('0x0'));var Sequelize=require(_0x5565('0x1'));module[_0x5565('0x2')]={'phone':{'type':Sequelize[_0x5565('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5565('0x4')],'unique':_0x5565('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x5565('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x7e4b=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7e4b,0x84));var _0xb7e4=function(_0x2f8c7d,_0x405be0){_0x2f8c7d=_0x2f8c7d-0x0;var _0x317f1a=_0x7e4b[_0x2f8c7d];return _0x317f1a;};'use strict';var moment=require(_0xb7e4('0x0'));var Sequelize=require(_0xb7e4('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb7e4('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb7e4('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb7e4('0x3')],'unique':_0xb7e4('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb7e4('0x3')],'unique':_0xb7e4('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index fd209a9..0367e64 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 _0x1a67=['status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','catch','find','describe','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1a67,0x1a4));var _0x71a6=function(_0xf7bad1,_0xf807c2){_0xf7bad1=_0xf7bad1-0x0;var _0x14b712=_0x1a67[_0xf7bad1];return _0x14b712;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71a6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71a6('0x1'));var rp=require('request-promise');var moment=require(_0x71a6('0x2'));var BPromise=require(_0x71a6('0x3'));var Mustache=require(_0x71a6('0x4'));var util=require('util');var path=require(_0x71a6('0x5'));var sox=require(_0x71a6('0x6'));var csv=require('to-csv');var ejs=require(_0x71a6('0x7'));var fs=require('fs');var fs_extra=require(_0x71a6('0x8'));var _=require(_0x71a6('0x9'));var squel=require(_0x71a6('0xa'));var crypto=require('crypto');var jsforce=require(_0x71a6('0xb'));var deskjs=require(_0x71a6('0xc'));var toCsv=require(_0x71a6('0xd'));var querystring=require(_0x71a6('0xe'));var Papa=require(_0x71a6('0xf'));var Redis=require(_0x71a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x71a6('0x11'));var as=require(_0x71a6('0x12'));var hardwareService=require(_0x71a6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x71a6('0x14'));var config=require(_0x71a6('0x15'));var licenseUtil=require(_0x71a6('0x16'));var db=require(_0x71a6('0x17'))['db'];function respondWithStatusCode(_0x31a235,_0x2db8b2){_0x2db8b2=_0x2db8b2||0xcc;return function(_0x1048eb){if(_0x1048eb){return _0x31a235['sendStatus'](_0x2db8b2);}return _0x31a235[_0x71a6('0x18')](_0x2db8b2)[_0x71a6('0x19')]();};}function respondWithResult(_0x439a35,_0x931c99){_0x931c99=_0x931c99||0xc8;return function(_0x5c564e){if(_0x5c564e){return _0x439a35[_0x71a6('0x18')](_0x931c99)[_0x71a6('0x1a')](_0x5c564e);}};}function respondWithFilteredResult(_0x295ac0,_0x5f0cd8){return function(_0x22006){if(_0x22006){var _0x40b728=typeof _0x5f0cd8[_0x71a6('0x1b')]===_0x71a6('0x1c')&&typeof _0x5f0cd8[_0x71a6('0x1d')]===_0x71a6('0x1c');var _0x131af1=_0x22006[_0x71a6('0x1e')];var _0x191ae1=_0x40b728?0x0:_0x5f0cd8[_0x71a6('0x1b')];var _0x5a274b=_0x40b728?_0x22006[_0x71a6('0x1e')]:_0x5f0cd8[_0x71a6('0x1b')]+_0x5f0cd8['limit'];var _0x5158d9;if(_0x5a274b>=_0x131af1){_0x5a274b=_0x131af1;_0x5158d9=0xc8;}else{_0x5158d9=0xce;}_0x295ac0['status'](_0x5158d9);return _0x295ac0['set'](_0x71a6('0x1f'),_0x191ae1+'-'+_0x5a274b+'/'+_0x131af1)[_0x71a6('0x1a')](_0x22006);}return null;};}function patchUpdates(_0x9378e7){return function(_0x7651cc){try{jsonpatch[_0x71a6('0x20')](_0x7651cc,_0x9378e7,!![]);}catch(_0x227cfd){return BPromise[_0x71a6('0x21')](_0x227cfd);}return _0x7651cc['save']();};}function saveUpdates(_0x17a592,_0x337be7){return function(_0x8c81f6){if(_0x8c81f6){return _0x8c81f6[_0x71a6('0x22')](_0x17a592)[_0x71a6('0x23')](function(_0x4946c8){return _0x4946c8;});}return null;};}function removeEntity(_0x2c143c,_0x5f34a4){return function(_0x3a56cc){if(_0x3a56cc){return _0x3a56cc[_0x71a6('0x24')]()[_0x71a6('0x23')](function(){_0x2c143c[_0x71a6('0x18')](0xcc)[_0x71a6('0x19')]();});}};}function handleEntityNotFound(_0x474eb1,_0xa3c39a){return function(_0x4cef62){if(!_0x4cef62){_0x474eb1[_0x71a6('0x25')](0x194);}return _0x4cef62;};}function handleError(_0x7b49b0,_0x38011d){_0x38011d=_0x38011d||0x1f4;return function(_0x1439f9){logger[_0x71a6('0x26')](_0x1439f9[_0x71a6('0x27')]);if(_0x1439f9['name']){delete _0x1439f9[_0x71a6('0x28')];}_0x7b49b0[_0x71a6('0x18')](_0x38011d)[_0x71a6('0x29')](_0x1439f9);};}exports[_0x71a6('0x2a')]=function(_0x31933f,_0x1e8811){var _0x5e9c29={},_0x17ac44={},_0xdec012={'count':0x0,'rows':[]};var _0x2a1eaa=_[_0x71a6('0x2b')](db[_0x71a6('0x2c')][_0x71a6('0x2d')],function(_0x25088e){return{'name':_0x25088e['fieldName'],'type':_0x25088e[_0x71a6('0x2e')][_0x71a6('0x2f')]};});_0x17ac44['model']=_['map'](_0x2a1eaa,'name');_0x17ac44[_0x71a6('0x30')]=_[_0x71a6('0x31')](_0x31933f['query']);_0x17ac44['filters']=_['intersection'](_0x17ac44[_0x71a6('0x32')],_0x17ac44[_0x71a6('0x30')]);_0x5e9c29[_0x71a6('0x33')]=_[_0x71a6('0x34')](_0x17ac44[_0x71a6('0x32')],qs[_0x71a6('0x35')](_0x31933f[_0x71a6('0x30')][_0x71a6('0x35')]));_0x5e9c29[_0x71a6('0x33')]=_0x5e9c29[_0x71a6('0x33')][_0x71a6('0x36')]?_0x5e9c29['attributes']:_0x17ac44[_0x71a6('0x32')];if(!_0x31933f[_0x71a6('0x30')][_0x71a6('0x37')](_0x71a6('0x38'))){_0x5e9c29['limit']=qs[_0x71a6('0x1d')](_0x31933f[_0x71a6('0x30')][_0x71a6('0x1d')]);_0x5e9c29['offset']=qs[_0x71a6('0x1b')](_0x31933f[_0x71a6('0x30')]['offset']);}_0x5e9c29[_0x71a6('0x39')]=qs[_0x71a6('0x3a')](_0x31933f[_0x71a6('0x30')][_0x71a6('0x3a')]);_0x5e9c29[_0x71a6('0x3b')]=qs[_0x71a6('0x3c')](_[_0x71a6('0x3d')](_0x31933f[_0x71a6('0x30')],_0x17ac44['filters']),_0x2a1eaa);if(_0x31933f[_0x71a6('0x30')][_0x71a6('0x3e')]){_0x5e9c29[_0x71a6('0x3b')]=_[_0x71a6('0x3f')](_0x5e9c29['where'],{'$or':_['map'](_0x2a1eaa,function(_0x4df37c){if(_0x4df37c[_0x71a6('0x2e')]!==_0x71a6('0x40')){var _0xddd04c={};_0xddd04c[_0x4df37c[_0x71a6('0x28')]]={'$like':'%'+_0x31933f['query'][_0x71a6('0x3e')]+'%'};return _0xddd04c;}})});}_0x5e9c29=_[_0x71a6('0x3f')]({},_0x5e9c29,_0x31933f[_0x71a6('0x41')]);var _0x26f7c1={'where':_0x5e9c29[_0x71a6('0x3b')]};return db[_0x71a6('0x2c')]['count'](_0x26f7c1)[_0x71a6('0x23')](function(_0x1e2ca0){_0xdec012['count']=_0x1e2ca0;if(_0x31933f[_0x71a6('0x30')]['includeAll']){_0x5e9c29[_0x71a6('0x42')]=[{'all':!![]}];}return db[_0x71a6('0x2c')][_0x71a6('0x43')](_0x5e9c29);})['then'](function(_0x8a2e2f){_0xdec012[_0x71a6('0x44')]=_0x8a2e2f;return _0xdec012;})[_0x71a6('0x23')](respondWithFilteredResult(_0x1e8811,_0x5e9c29))['catch'](handleError(_0x1e8811,null));};exports['show']=function(_0x3dbebe,_0x182b1e){var _0x47ba9d={'raw':!![],'where':{'id':_0x3dbebe[_0x71a6('0x45')]['id']}},_0x1f775a={};_0x1f775a[_0x71a6('0x32')]=_[_0x71a6('0x31')](db[_0x71a6('0x2c')]['rawAttributes']);_0x1f775a[_0x71a6('0x30')]=_['keys'](_0x3dbebe[_0x71a6('0x30')]);_0x1f775a[_0x71a6('0x3c')]=_[_0x71a6('0x34')](_0x1f775a[_0x71a6('0x32')],_0x1f775a[_0x71a6('0x30')]);_0x47ba9d[_0x71a6('0x33')]=_[_0x71a6('0x34')](_0x1f775a[_0x71a6('0x32')],qs[_0x71a6('0x35')](_0x3dbebe['query'][_0x71a6('0x35')]));_0x47ba9d[_0x71a6('0x33')]=_0x47ba9d[_0x71a6('0x33')][_0x71a6('0x36')]?_0x47ba9d['attributes']:_0x1f775a[_0x71a6('0x32')];if(_0x3dbebe[_0x71a6('0x30')][_0x71a6('0x46')]){_0x47ba9d[_0x71a6('0x42')]=[{'all':!![]}];}_0x47ba9d=_[_0x71a6('0x3f')]({},_0x47ba9d,_0x3dbebe['options']);return db[_0x71a6('0x2c')]['find'](_0x47ba9d)[_0x71a6('0x23')](handleEntityNotFound(_0x182b1e,null))[_0x71a6('0x23')](respondWithResult(_0x182b1e,null))[_0x71a6('0x47')](handleError(_0x182b1e,null));};exports['update']=function(_0x50b84b,_0x528ab9){if(_0x50b84b['body']['id']){delete _0x50b84b['body']['id'];}return db[_0x71a6('0x2c')][_0x71a6('0x48')]({'where':{'id':_0x50b84b[_0x71a6('0x45')]['id']}})[_0x71a6('0x23')](handleEntityNotFound(_0x528ab9,null))[_0x71a6('0x23')](saveUpdates(_0x50b84b['body'],null))[_0x71a6('0x23')](respondWithResult(_0x528ab9,null))[_0x71a6('0x47')](handleError(_0x528ab9,null));};exports['destroy']=function(_0x18aacc,_0x4d970e){return db[_0x71a6('0x2c')][_0x71a6('0x48')]({'where':{'id':_0x18aacc[_0x71a6('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d970e,null))[_0x71a6('0x23')](removeEntity(_0x4d970e,null))[_0x71a6('0x47')](handleError(_0x4d970e,null));};exports[_0x71a6('0x49')]=function(_0x276ffc,_0x165728){return db[_0x71a6('0x2c')]['describe']()[_0x71a6('0x23')](respondWithResult(_0x165728,null))[_0x71a6('0x47')](handleError(_0x165728,null));}; \ No newline at end of file +var _0x6cac=['options','find','catch','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params'];(function(_0x236af4,_0x1d1aef){var _0x20c76c=function(_0x1bd441){while(--_0x1bd441){_0x236af4['push'](_0x236af4['shift']());}};_0x20c76c(++_0x1d1aef);}(_0x6cac,0xe7));var _0xc6ca=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6cac[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xc6ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6ca('0x1'));var jsonpatch=require(_0xc6ca('0x2'));var rp=require(_0xc6ca('0x3'));var moment=require(_0xc6ca('0x4'));var BPromise=require(_0xc6ca('0x5'));var Mustache=require('mustache');var util=require(_0xc6ca('0x6'));var path=require(_0xc6ca('0x7'));var sox=require(_0xc6ca('0x8'));var csv=require(_0xc6ca('0x9'));var ejs=require(_0xc6ca('0xa'));var fs=require('fs');var fs_extra=require(_0xc6ca('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc6ca('0xc'));var jsforce=require(_0xc6ca('0xd'));var deskjs=require(_0xc6ca('0xe'));var toCsv=require(_0xc6ca('0x9'));var querystring=require('querystring');var Papa=require(_0xc6ca('0xf'));var Redis=require(_0xc6ca('0x10'));var authService=require(_0xc6ca('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc6ca('0x12'));var hardwareService=require(_0xc6ca('0x13'));var logger=require('../../config/logger')(_0xc6ca('0x14'));var utils=require(_0xc6ca('0x15'));var config=require(_0xc6ca('0x16'));var licenseUtil=require(_0xc6ca('0x17'));var db=require(_0xc6ca('0x18'))['db'];function respondWithStatusCode(_0x2d25d7,_0xf8f9b9){_0xf8f9b9=_0xf8f9b9||0xcc;return function(_0x3a2494){if(_0x3a2494){return _0x2d25d7['sendStatus'](_0xf8f9b9);}return _0x2d25d7[_0xc6ca('0x19')](_0xf8f9b9)[_0xc6ca('0x1a')]();};}function respondWithResult(_0x169714,_0x4b97fb){_0x4b97fb=_0x4b97fb||0xc8;return function(_0x568c38){if(_0x568c38){return _0x169714[_0xc6ca('0x19')](_0x4b97fb)['json'](_0x568c38);}};}function respondWithFilteredResult(_0x4ead4d,_0xe18468){return function(_0x256ebf){if(_0x256ebf){var _0x494ab1=typeof _0xe18468[_0xc6ca('0x1b')]===_0xc6ca('0x1c')&&typeof _0xe18468[_0xc6ca('0x1d')]===_0xc6ca('0x1c');var _0x11d7a9=_0x256ebf[_0xc6ca('0x1e')];var _0x1e566a=_0x494ab1?0x0:_0xe18468['offset'];var _0x198468=_0x494ab1?_0x256ebf[_0xc6ca('0x1e')]:_0xe18468[_0xc6ca('0x1b')]+_0xe18468[_0xc6ca('0x1d')];var _0x3fc168;if(_0x198468>=_0x11d7a9){_0x198468=_0x11d7a9;_0x3fc168=0xc8;}else{_0x3fc168=0xce;}_0x4ead4d[_0xc6ca('0x19')](_0x3fc168);return _0x4ead4d[_0xc6ca('0x1f')](_0xc6ca('0x20'),_0x1e566a+'-'+_0x198468+'/'+_0x11d7a9)['json'](_0x256ebf);}return null;};}function patchUpdates(_0x58c13c){return function(_0xe33db0){try{jsonpatch[_0xc6ca('0x21')](_0xe33db0,_0x58c13c,!![]);}catch(_0x29cfee){return BPromise[_0xc6ca('0x22')](_0x29cfee);}return _0xe33db0['save']();};}function saveUpdates(_0x438cbf,_0x23f108){return function(_0x422e90){if(_0x422e90){return _0x422e90['update'](_0x438cbf)[_0xc6ca('0x23')](function(_0x298032){return _0x298032;});}return null;};}function removeEntity(_0x5bbc4e,_0x40b99b){return function(_0x49d214){if(_0x49d214){return _0x49d214[_0xc6ca('0x24')]()[_0xc6ca('0x23')](function(){_0x5bbc4e[_0xc6ca('0x19')](0xcc)[_0xc6ca('0x1a')]();});}};}function handleEntityNotFound(_0x5d4157,_0x214eb9){return function(_0x5bb6b9){if(!_0x5bb6b9){_0x5d4157[_0xc6ca('0x25')](0x194);}return _0x5bb6b9;};}function handleError(_0x1a084b,_0x4e91e2){_0x4e91e2=_0x4e91e2||0x1f4;return function(_0x344d56){logger['error'](_0x344d56[_0xc6ca('0x26')]);if(_0x344d56[_0xc6ca('0x27')]){delete _0x344d56[_0xc6ca('0x27')];}_0x1a084b[_0xc6ca('0x19')](_0x4e91e2)[_0xc6ca('0x28')](_0x344d56);};}exports[_0xc6ca('0x29')]=function(_0x3b2d55,_0x17b4b2){var _0x4b256b={},_0x43a8d0={},_0x4fe1e5={'count':0x0,'rows':[]};var _0x20688a=_[_0xc6ca('0x2a')](db[_0xc6ca('0x2b')][_0xc6ca('0x2c')],function(_0x1e5a62){return{'name':_0x1e5a62['fieldName'],'type':_0x1e5a62[_0xc6ca('0x2d')]['key']};});_0x43a8d0[_0xc6ca('0x2e')]=_['map'](_0x20688a,_0xc6ca('0x27'));_0x43a8d0[_0xc6ca('0x2f')]=_[_0xc6ca('0x30')](_0x3b2d55['query']);_0x43a8d0[_0xc6ca('0x31')]=_[_0xc6ca('0x32')](_0x43a8d0['model'],_0x43a8d0['query']);_0x4b256b[_0xc6ca('0x33')]=_[_0xc6ca('0x32')](_0x43a8d0[_0xc6ca('0x2e')],qs[_0xc6ca('0x34')](_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x34')]));_0x4b256b[_0xc6ca('0x33')]=_0x4b256b[_0xc6ca('0x33')][_0xc6ca('0x35')]?_0x4b256b[_0xc6ca('0x33')]:_0x43a8d0[_0xc6ca('0x2e')];if(!_0x3b2d55['query'][_0xc6ca('0x36')](_0xc6ca('0x37'))){_0x4b256b['limit']=qs[_0xc6ca('0x1d')](_0x3b2d55['query'][_0xc6ca('0x1d')]);_0x4b256b[_0xc6ca('0x1b')]=qs[_0xc6ca('0x1b')](_0x3b2d55['query']['offset']);}_0x4b256b[_0xc6ca('0x38')]=qs[_0xc6ca('0x39')](_0x3b2d55['query'][_0xc6ca('0x39')]);_0x4b256b[_0xc6ca('0x3a')]=qs['filters'](_[_0xc6ca('0x3b')](_0x3b2d55[_0xc6ca('0x2f')],_0x43a8d0[_0xc6ca('0x31')]),_0x20688a);if(_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x3c')]){_0x4b256b[_0xc6ca('0x3a')]=_[_0xc6ca('0x3d')](_0x4b256b['where'],{'$or':_['map'](_0x20688a,function(_0x10c7a2){if(_0x10c7a2[_0xc6ca('0x2d')]!==_0xc6ca('0x3e')){var _0x4905e2={};_0x4905e2[_0x10c7a2['name']]={'$like':'%'+_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x3c')]+'%'};return _0x4905e2;}})});}_0x4b256b=_[_0xc6ca('0x3d')]({},_0x4b256b,_0x3b2d55['options']);var _0x3c0ea1={'where':_0x4b256b[_0xc6ca('0x3a')]};return db['CmHopperBlack']['count'](_0x3c0ea1)[_0xc6ca('0x23')](function(_0x9b9c53){_0x4fe1e5[_0xc6ca('0x1e')]=_0x9b9c53;if(_0x3b2d55[_0xc6ca('0x2f')][_0xc6ca('0x3f')]){_0x4b256b[_0xc6ca('0x40')]=[{'all':!![]}];}return db[_0xc6ca('0x2b')][_0xc6ca('0x41')](_0x4b256b);})[_0xc6ca('0x23')](function(_0x1892c0){_0x4fe1e5[_0xc6ca('0x42')]=_0x1892c0;return _0x4fe1e5;})[_0xc6ca('0x23')](respondWithFilteredResult(_0x17b4b2,_0x4b256b))['catch'](handleError(_0x17b4b2,null));};exports[_0xc6ca('0x43')]=function(_0x594c0a,_0x4fc439){var _0x179813={'raw':!![],'where':{'id':_0x594c0a[_0xc6ca('0x44')]['id']}},_0x41b592={};_0x41b592['model']=_[_0xc6ca('0x30')](db[_0xc6ca('0x2b')]['rawAttributes']);_0x41b592[_0xc6ca('0x2f')]=_['keys'](_0x594c0a[_0xc6ca('0x2f')]);_0x41b592['filters']=_[_0xc6ca('0x32')](_0x41b592[_0xc6ca('0x2e')],_0x41b592[_0xc6ca('0x2f')]);_0x179813['attributes']=_[_0xc6ca('0x32')](_0x41b592[_0xc6ca('0x2e')],qs[_0xc6ca('0x34')](_0x594c0a[_0xc6ca('0x2f')][_0xc6ca('0x34')]));_0x179813[_0xc6ca('0x33')]=_0x179813['attributes']['length']?_0x179813[_0xc6ca('0x33')]:_0x41b592[_0xc6ca('0x2e')];if(_0x594c0a['query']['includeAll']){_0x179813[_0xc6ca('0x40')]=[{'all':!![]}];}_0x179813=_[_0xc6ca('0x3d')]({},_0x179813,_0x594c0a[_0xc6ca('0x45')]);return db[_0xc6ca('0x2b')][_0xc6ca('0x46')](_0x179813)['then'](handleEntityNotFound(_0x4fc439,null))['then'](respondWithResult(_0x4fc439,null))[_0xc6ca('0x47')](handleError(_0x4fc439,null));};exports[_0xc6ca('0x48')]=function(_0x299c85,_0x5f20ab){if(_0x299c85[_0xc6ca('0x49')]['id']){delete _0x299c85[_0xc6ca('0x49')]['id'];}return db[_0xc6ca('0x2b')][_0xc6ca('0x46')]({'where':{'id':_0x299c85['params']['id']}})['then'](handleEntityNotFound(_0x5f20ab,null))[_0xc6ca('0x23')](saveUpdates(_0x299c85['body'],null))['then'](respondWithResult(_0x5f20ab,null))[_0xc6ca('0x47')](handleError(_0x5f20ab,null));};exports[_0xc6ca('0x24')]=function(_0x46c8e4,_0x5a3c2a){return db[_0xc6ca('0x2b')][_0xc6ca('0x46')]({'where':{'id':_0x46c8e4[_0xc6ca('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a3c2a,null))[_0xc6ca('0x23')](removeEntity(_0x5a3c2a,null))[_0xc6ca('0x47')](handleError(_0x5a3c2a,null));};exports[_0xc6ca('0x4a')]=function(_0x22f9f4,_0x12370e){return db['CmHopperBlack'][_0xc6ca('0x4a')]()[_0xc6ca('0x23')](respondWithResult(_0x12370e,null))[_0xc6ca('0x47')](handleError(_0x12370e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a0a452e..64e01b0 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 _0x012f=['lodash','../../config/logger','moment','bluebird','path','../../config/environment','define','CmHopperBlack','cm_hopper_black'];(function(_0x5dda2a,_0xf0ba56){var _0x3a4ae7=function(_0x1cefc7){while(--_0x1cefc7){_0x5dda2a['push'](_0x5dda2a['shift']());}};_0x3a4ae7(++_0xf0ba56);}(_0x012f,0x1b0));var _0xf012=function(_0x200b47,_0x23670f){_0x200b47=_0x200b47-0x0;var _0x577a7b=_0x012f[_0x200b47];return _0x577a7b;};'use strict';var _=require(_0xf012('0x0'));var util=require('util');var logger=require(_0xf012('0x1'))('api');var moment=require(_0xf012('0x2'));var BPromise=require(_0xf012('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf012('0x4'));var rimraf=require('rimraf');var config=require(_0xf012('0x5'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x5148e0,_0x5833dc){return _0x5148e0[_0xf012('0x6')](_0xf012('0x7'),attributes,{'tableName':_0xf012('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb2e=['define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0xfb2e,0x13b));var _0xefb2=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xfb2e[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xefb2('0x0'));var util=require('util');var logger=require(_0xefb2('0x1'))(_0xefb2('0x2'));var moment=require(_0xefb2('0x3'));var BPromise=require(_0xefb2('0x4'));var rp=require(_0xefb2('0x5'));var fs=require('fs');var path=require(_0xefb2('0x6'));var rimraf=require('rimraf');var config=require(_0xefb2('0x7'));var attributes=require(_0xefb2('0x8'));module[_0xefb2('0x9')]=function(_0x24850e,_0x51a213){return _0x24850e[_0xefb2('0xa')](_0xefb2('0xb'),attributes,{'tableName':_0xefb2('0xc'),'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 51bb8d3..1ad9f8c 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 _0x6bdb=['code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','UpdateCmHopperBlack','update','stringify','DestroyCmHopperBlack','destroy','util','moment','../../config/logger','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x6bdb,0x1a8));var _0xb6bd=function(_0x15b653,_0x1f9242){_0x15b653=_0x15b653-0x0;var _0xc9dcf9=_0x6bdb[_0x15b653];return _0xc9dcf9;};'use strict';var _=require('lodash');var util=require(_0xb6bd('0x0'));var moment=require(_0xb6bd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb6bd('0x2'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb6bd('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x1c2795,_0x2cf90a,_0x5afe5a){return new BPromise(function(_0x22c987,_0x529707){return client['request'](_0x1c2795,_0x5afe5a)[_0xb6bd('0x4')](function(_0x2778db){logger[_0xb6bd('0x5')](_0xb6bd('0x6'),_0x2cf90a,'request\x20sent');logger[_0xb6bd('0x7')](_0xb6bd('0x8'),_0x2cf90a,_0xb6bd('0x9'),JSON['stringify'](_0x2778db));if(_0x2778db['error']){if(_0x2778db[_0xb6bd('0xa')][_0xb6bd('0xb')]===0x1f4){logger[_0xb6bd('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x2cf90a,_0x2778db[_0xb6bd('0xa')][_0xb6bd('0xc')]);return _0x529707(_0x2778db[_0xb6bd('0xa')][_0xb6bd('0xc')]);}logger[_0xb6bd('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x2cf90a,_0x2778db[_0xb6bd('0xa')][_0xb6bd('0xc')]);return _0x22c987(_0x2778db[_0xb6bd('0xa')][_0xb6bd('0xc')]);}else{logger[_0xb6bd('0x5')](_0xb6bd('0x6'),_0x2cf90a,_0xb6bd('0x9'));_0x22c987(_0x2778db['result'][_0xb6bd('0xc')]);}})[_0xb6bd('0xd')](function(_0x55faba){logger[_0xb6bd('0xa')](_0xb6bd('0x6'),_0x2cf90a,_0x55faba);_0x529707(_0x55faba);});});}exports[_0xb6bd('0xe')]=function(_0x5e143){var _0x5619e9=this;return new Promise(function(_0x1e260f,_0x271821){return db[_0xb6bd('0xf')][_0xb6bd('0x10')]({'raw':_0x5e143[_0xb6bd('0x11')]?_0x5e143[_0xb6bd('0x11')][_0xb6bd('0x12')]===undefined?!![]:![]:!![],'where':_0x5e143[_0xb6bd('0x11')]?_0x5e143['options'][_0xb6bd('0x13')]||null:null,'attributes':_0x5e143[_0xb6bd('0x11')]?_0x5e143['options'][_0xb6bd('0x14')]||null:null,'limit':_0x5e143[_0xb6bd('0x11')]?_0x5e143[_0xb6bd('0x11')][_0xb6bd('0x15')]||null:null,'include':_0x5e143[_0xb6bd('0x11')]?_0x5e143[_0xb6bd('0x11')][_0xb6bd('0x16')]?_['map'](_0x5e143[_0xb6bd('0x11')][_0xb6bd('0x16')],function(_0x2ee3fe){return{'model':db[_0x2ee3fe[_0xb6bd('0x17')]],'as':_0x2ee3fe['as'],'attributes':_0x2ee3fe[_0xb6bd('0x14')],'include':_0x2ee3fe[_0xb6bd('0x16')]?_['map'](_0x2ee3fe[_0xb6bd('0x16')],function(_0x9c7564){return{'model':db[_0x9c7564[_0xb6bd('0x17')]],'as':_0x9c7564['as'],'attributes':_0x9c7564[_0xb6bd('0x14')],'include':_0x9c7564[_0xb6bd('0x16')]?_['map'](_0x9c7564[_0xb6bd('0x16')],function(_0x24c91f){return{'model':db[_0x24c91f[_0xb6bd('0x17')]],'as':_0x24c91f['as'],'attributes':_0x24c91f[_0xb6bd('0x14')]};}):[]};}):[]};}):[]:[]})[_0xb6bd('0x4')](function(_0x5f5203){logger[_0xb6bd('0x5')](_0xb6bd('0xe'),_0x5e143);logger[_0xb6bd('0x7')](_0xb6bd('0xe'),_0x5e143,JSON['stringify'](_0x5f5203));_0x1e260f(_0x5f5203);})[_0xb6bd('0xd')](function(_0x597630){logger['error']('GetCmHopperBlack',_0x597630[_0xb6bd('0xc')],_0x5e143);_0x271821(_0x5619e9[_0xb6bd('0xa')](0x1f4,_0x597630[_0xb6bd('0xc')]));});});};exports[_0xb6bd('0x18')]=function(_0x46af30){var _0x1cdb4f=this;return new Promise(function(_0x109fcd,_0x436687){return db[_0xb6bd('0xf')][_0xb6bd('0x19')](_0x46af30['body'],{'raw':_0x46af30['options']?_0x46af30[_0xb6bd('0x11')][_0xb6bd('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46af30['options']?_0x46af30[_0xb6bd('0x11')][_0xb6bd('0x13')]||null:null,'attributes':_0x46af30['options']?_0x46af30[_0xb6bd('0x11')][_0xb6bd('0x14')]||null:null,'limit':_0x46af30[_0xb6bd('0x11')]?_0x46af30[_0xb6bd('0x11')][_0xb6bd('0x15')]||null:null})[_0xb6bd('0x4')](function(_0x2f74d0){logger['info'](_0xb6bd('0x18'),_0x46af30);logger[_0xb6bd('0x7')](_0xb6bd('0x18'),_0x46af30,JSON[_0xb6bd('0x1a')](_0x2f74d0));_0x109fcd(_0x2f74d0);})[_0xb6bd('0xd')](function(_0x351b38){logger[_0xb6bd('0xa')]('UpdateCmHopperBlack',_0x351b38[_0xb6bd('0xc')],_0x46af30);_0x436687(_0x1cdb4f[_0xb6bd('0xa')](0x1f4,_0x351b38[_0xb6bd('0xc')]));});});};exports[_0xb6bd('0x1b')]=function(_0x318da2){var _0x429c55=this;return new Promise(function(_0x1d543c,_0x427617){return db[_0xb6bd('0xf')][_0xb6bd('0x1c')]({'where':_0x318da2[_0xb6bd('0x11')]?_0x318da2[_0xb6bd('0x11')][_0xb6bd('0x13')]||null:null})[_0xb6bd('0x4')](function(_0x32cbbf){logger['info'](_0xb6bd('0x1b'),_0x318da2);logger[_0xb6bd('0x7')](_0xb6bd('0x1b'),_0x318da2,JSON[_0xb6bd('0x1a')](_0x32cbbf));_0x1d543c(_0x32cbbf);})[_0xb6bd('0xd')](function(_0x2f853c){logger['error'](_0xb6bd('0x1b'),_0x2f853c[_0xb6bd('0xc')],_0x318da2);_0x427617(_0x429c55[_0xb6bd('0xa')](0x1f4,_0x2f853c[_0xb6bd('0xc')]));});});}; \ No newline at end of file +var _0xe292=['catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','model','stringify','UpdateCmHopperBlack','update','body','destroy','where','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4f536e,_0x247157){var _0x1ba053=function(_0x2239e4){while(--_0x2239e4){_0x4f536e['push'](_0x4f536e['shift']());}};_0x1ba053(++_0x247157);}(_0xe292,0x1b3));var _0x2e29=function(_0x1d4de1,_0x33cd41){_0x1d4de1=_0x1d4de1-0x0;var _0x500a2b=_0xe292[_0x1d4de1];return _0x500a2b;};'use strict';var _=require(_0x2e29('0x0'));var util=require(_0x2e29('0x1'));var moment=require('moment');var BPromise=require(_0x2e29('0x2'));var rs=require(_0x2e29('0x3'));var fs=require('fs');var Redis=require(_0x2e29('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e29('0x5'))(_0x2e29('0x6'));var config=require('../../config/environment');var jayson=require(_0x2e29('0x7'));var client=jayson[_0x2e29('0x8')][_0x2e29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x306ece,_0x293ef2,_0x312541){return new BPromise(function(_0x3538db,_0x1874eb){return client[_0x2e29('0xa')](_0x306ece,_0x312541)[_0x2e29('0xb')](function(_0x321ef5){logger[_0x2e29('0xc')](_0x2e29('0xd'),_0x293ef2,_0x2e29('0xe'));logger[_0x2e29('0xf')](_0x2e29('0x10'),_0x293ef2,_0x2e29('0xe'),JSON['stringify'](_0x321ef5));if(_0x321ef5['error']){if(_0x321ef5[_0x2e29('0x11')][_0x2e29('0x12')]===0x1f4){logger[_0x2e29('0x11')](_0x2e29('0xd'),_0x293ef2,_0x321ef5['error'][_0x2e29('0x13')]);return _0x1874eb(_0x321ef5['error']['message']);}logger[_0x2e29('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x293ef2,_0x321ef5[_0x2e29('0x11')][_0x2e29('0x13')]);return _0x3538db(_0x321ef5[_0x2e29('0x11')][_0x2e29('0x13')]);}else{logger[_0x2e29('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x293ef2,_0x2e29('0xe'));_0x3538db(_0x321ef5[_0x2e29('0x14')][_0x2e29('0x13')]);}})[_0x2e29('0x15')](function(_0xda88a6){logger[_0x2e29('0x11')](_0x2e29('0xd'),_0x293ef2,_0xda88a6);_0x1874eb(_0xda88a6);});});}exports[_0x2e29('0x16')]=function(_0x4feba1){var _0x17b2b5=this;return new Promise(function(_0x2fcf5d,_0x34c16d){return db[_0x2e29('0x17')][_0x2e29('0x18')]({'raw':_0x4feba1[_0x2e29('0x19')]?_0x4feba1[_0x2e29('0x19')][_0x2e29('0x1a')]===undefined?!![]:![]:!![],'where':_0x4feba1[_0x2e29('0x19')]?_0x4feba1[_0x2e29('0x19')]['where']||null:null,'attributes':_0x4feba1[_0x2e29('0x19')]?_0x4feba1['options'][_0x2e29('0x1b')]||null:null,'limit':_0x4feba1[_0x2e29('0x19')]?_0x4feba1[_0x2e29('0x19')][_0x2e29('0x1c')]||null:null,'include':_0x4feba1[_0x2e29('0x19')]?_0x4feba1[_0x2e29('0x19')][_0x2e29('0x1d')]?_['map'](_0x4feba1[_0x2e29('0x19')]['include'],function(_0xdf95e9){return{'model':db[_0xdf95e9[_0x2e29('0x1e')]],'as':_0xdf95e9['as'],'attributes':_0xdf95e9[_0x2e29('0x1b')],'include':_0xdf95e9[_0x2e29('0x1d')]?_['map'](_0xdf95e9[_0x2e29('0x1d')],function(_0x3c8ded){return{'model':db[_0x3c8ded['model']],'as':_0x3c8ded['as'],'attributes':_0x3c8ded[_0x2e29('0x1b')],'include':_0x3c8ded[_0x2e29('0x1d')]?_['map'](_0x3c8ded['include'],function(_0x2e970f){return{'model':db[_0x2e970f[_0x2e29('0x1e')]],'as':_0x2e970f['as'],'attributes':_0x2e970f['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e29('0xb')](function(_0x14ceba){logger[_0x2e29('0xc')]('GetCmHopperBlack',_0x4feba1);logger[_0x2e29('0xf')](_0x2e29('0x16'),_0x4feba1,JSON[_0x2e29('0x1f')](_0x14ceba));_0x2fcf5d(_0x14ceba);})[_0x2e29('0x15')](function(_0x29a7ba){logger[_0x2e29('0x11')](_0x2e29('0x16'),_0x29a7ba['message'],_0x4feba1);_0x34c16d(_0x17b2b5[_0x2e29('0x11')](0x1f4,_0x29a7ba['message']));});});};exports[_0x2e29('0x20')]=function(_0x3d8c3d){var _0x374454=this;return new Promise(function(_0x57a0ea,_0x50a73f){return db['CmHopperBlack'][_0x2e29('0x21')](_0x3d8c3d[_0x2e29('0x22')],{'raw':_0x3d8c3d[_0x2e29('0x19')]?_0x3d8c3d['options'][_0x2e29('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d8c3d[_0x2e29('0x19')]?_0x3d8c3d[_0x2e29('0x19')]['where']||null:null,'attributes':_0x3d8c3d[_0x2e29('0x19')]?_0x3d8c3d[_0x2e29('0x19')]['attributes']||null:null,'limit':_0x3d8c3d[_0x2e29('0x19')]?_0x3d8c3d[_0x2e29('0x19')][_0x2e29('0x1c')]||null:null})[_0x2e29('0xb')](function(_0x212bb5){logger['info'](_0x2e29('0x20'),_0x3d8c3d);logger[_0x2e29('0xf')](_0x2e29('0x20'),_0x3d8c3d,JSON[_0x2e29('0x1f')](_0x212bb5));_0x57a0ea(_0x212bb5);})[_0x2e29('0x15')](function(_0x5bdb73){logger[_0x2e29('0x11')](_0x2e29('0x20'),_0x5bdb73['message'],_0x3d8c3d);_0x50a73f(_0x374454['error'](0x1f4,_0x5bdb73['message']));});});};exports['DestroyCmHopperBlack']=function(_0x4026d5){var _0x4e6cae=this;return new Promise(function(_0x26b514,_0xc05a9b){return db[_0x2e29('0x17')][_0x2e29('0x23')]({'where':_0x4026d5[_0x2e29('0x19')]?_0x4026d5['options'][_0x2e29('0x24')]||null:null})['then'](function(_0x106230){logger[_0x2e29('0xc')](_0x2e29('0x25'),_0x4026d5);logger[_0x2e29('0xf')](_0x2e29('0x25'),_0x4026d5,JSON[_0x2e29('0x1f')](_0x106230));_0x26b514(_0x106230);})['catch'](function(_0x3fe672){logger[_0x2e29('0x11')](_0x2e29('0x25'),_0x3fe672[_0x2e29('0x13')],_0x4026d5);_0xc05a9b(_0x4e6cae['error'](0x1f4,_0x3fe672[_0x2e29('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a99407e..b1e3e2d 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 _0x8ace=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','put'];(function(_0xdd3278,_0x300441){var _0x1e39da=function(_0x33fa18){while(--_0x33fa18){_0xdd3278['push'](_0xdd3278['shift']());}};_0x1e39da(++_0x300441);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x18e3a1,_0xd51faa){_0x18e3a1=_0x18e3a1-0x0;var _0x69b4a1=_0x8ace[_0x18e3a1];return _0x69b4a1;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['describe']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')](_0xe8ac('0xf'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')]('/:id',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x14')]);module[_0xe8ac('0x15')]=router; \ No newline at end of file +var _0x57ca=['../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x56c498,_0x4e3cf6){var _0x2a238e=function(_0x3619ab){while(--_0x3619ab){_0x56c498['push'](_0x56c498['shift']());}};_0x2a238e(++_0x4e3cf6);}(_0x57ca,0x108));var _0xa57c=function(_0x387247,_0x394428){_0x387247=_0x387247-0x0;var _0x1bd5ee=_0x57ca[_0x387247];return _0x1bd5ee;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/:id',auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x10')](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index bbcf362..a200a3a 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 _0x9382=['sequelize','moment','exports','INTEGER','STRING','DATE','followuptime','diff','seconds','BOOLEAN'];(function(_0x125ac4,_0x41e10f){var _0x3bcc8f=function(_0x5b7b99){while(--_0x5b7b99){_0x125ac4['push'](_0x125ac4['shift']());}};_0x3bcc8f(++_0x41e10f);}(_0x9382,0x1e0));var _0x2938=function(_0xc0185c,_0x4e1987){_0xc0185c=_0xc0185c-0x0;var _0x8f5d0e=_0x9382[_0xc0185c];return _0x8f5d0e;};'use strict';var Sequelize=require(_0x2938('0x0'));var moment=require(_0x2938('0x1'));module[_0x2938('0x2')]={'state':{'type':Sequelize[_0x2938('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x2938('0x4')]},'scheduledat':{'type':Sequelize[_0x2938('0x5')]},'countbusyretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2938('0x4')]},'originatecalleridname':{'type':Sequelize[_0x2938('0x4')]},'calleridnum':{'type':Sequelize[_0x2938('0x4')]},'calleridname':{'type':Sequelize[_0x2938('0x4')]},'starttime':{'type':Sequelize[_0x2938('0x5')]},'responsetime':{'type':Sequelize[_0x2938('0x5')]},'answertime':{'type':Sequelize[_0x2938('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2938('0x4')]},'campaign':{'type':Sequelize[_0x2938('0x4')]},'campaigntype':{'type':Sequelize[_0x2938('0x4')]},'membername':{'type':Sequelize[_0x2938('0x4')]},'reason':{'type':Sequelize[_0x2938('0x4')]},'disposition':{'type':Sequelize[_0x2938('0x4')]},'secondDisposition':{'type':Sequelize[_0x2938('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x2938('0x5')],'set':function(_0x527298){var _0x2e638c=this['getDataValue']('endtime');if(_0x2e638c&&_0x527298){this['setDataValue'](_0x2938('0x6'),moment(_0x527298)[_0x2938('0x7')](moment(_0x2e638c),_0x2938('0x8')));}}},'amd':{'type':Sequelize[_0x2938('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2938('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2938('0x5')]},'callback':{'type':Sequelize[_0x2938('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x2938('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x2938('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2938('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2938('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x04be=['followuptime','seconds','BOOLEAN','sequelize','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue'];(function(_0x5356bf,_0x30453b){var _0x569ef4=function(_0x27b227){while(--_0x27b227){_0x5356bf['push'](_0x5356bf['shift']());}};_0x569ef4(++_0x30453b);}(_0x04be,0x71));var _0xe04b=function(_0x3ab7cf,_0x20d5ed){_0x3ab7cf=_0x3ab7cf-0x0;var _0x1c356a=_0x04be[_0x3ab7cf];return _0x1c356a;};'use strict';var Sequelize=require(_0xe04b('0x0'));var moment=require('moment');module[_0xe04b('0x1')]={'state':{'type':Sequelize[_0xe04b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe04b('0x3')]},'countbusyretry':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe04b('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe04b('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe04b('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe04b('0x4')]},'starttime':{'type':Sequelize[_0xe04b('0x3')]},'responsetime':{'type':Sequelize[_0xe04b('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe04b('0x3')]},'endtime':{'type':Sequelize[_0xe04b('0x3')]},'ringtime':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe04b('0x4')]},'campaign':{'type':Sequelize[_0xe04b('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe04b('0x4')]},'disposition':{'type':Sequelize[_0xe04b('0x4')]},'secondDisposition':{'type':Sequelize[_0xe04b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3a70ec){var _0x134739=this[_0xe04b('0x5')](_0xe04b('0x6'));if(_0x134739&&_0x3a70ec){this[_0xe04b('0x7')](_0xe04b('0x8'),moment(_0x3a70ec)['diff'](moment(_0x134739),_0xe04b('0x9')));}}},'amd':{'type':Sequelize[_0xe04b('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe04b('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe04b('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xe04b('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe04b('0x3')]},'deleted':{'type':Sequelize[_0xe04b('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe04b('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe04b('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe04b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'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 52cde34..3cc2617 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 _0x2a07=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x54e0da,_0x5b3a72){var _0x55b326=function(_0x3f1492){while(--_0x3f1492){_0x54e0da['push'](_0x54e0da['shift']());}};_0x55b326(++_0x5b3a72);}(_0x2a07,0x74));var _0x72a0=function(_0x4753f3,_0xfa186e){_0x4753f3=_0x4753f3-0x0;var _0x124353=_0x2a07[_0x4753f3];return _0x124353;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['CmHopperFinal'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file +var _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x44db1f,_0x28676d){var _0x3a364f=function(_0x2f8a1b){while(--_0x2f8a1b){_0x44db1f['push'](_0x44db1f['shift']());}};_0x3a364f(++_0x28676d);}(_0x90b1,0x1bb));var _0x190b=function(_0x4c7c4a,_0x520920){_0x4c7c4a=_0x4c7c4a-0x0;var _0x4d78ae=_0x90b1[_0x4c7c4a];return _0x4d78ae;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['CmHopperFinal'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 1acab71..2269f04 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 _0x1848=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x4c3645,_0x28079a){var _0x191acc=function(_0x4d9530){while(--_0x4d9530){_0x4c3645['push'](_0x4c3645['shift']());}};_0x191acc(++_0x28079a);}(_0x1848,0x105));var _0x8184=function(_0x1e1a98,_0x4d731c){_0x1e1a98=_0x1e1a98-0x0;var _0x4b54b2=_0x1848[_0x1e1a98];return _0x4b54b2;};'use strict';var _=require(_0x8184('0x0'));var util=require(_0x8184('0x1'));var logger=require(_0x8184('0x2'))(_0x8184('0x3'));var moment=require(_0x8184('0x4'));var BPromise=require(_0x8184('0x5'));var rp=require(_0x8184('0x6'));var fs=require('fs');var path=require(_0x8184('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x12480b,_0x3df8b0){return _0x12480b[_0x8184('0x8')](_0x8184('0x9'),attributes,{'tableName':_0x8184('0xa'),'paranoid':![],'indexes':[{'name':_0x8184('0xb'),'fields':['calleridnum']},{'name':_0x8184('0xc'),'fields':[_0x8184('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x782a=['util','../../config/logger','api','moment','bluebird','path','rimraf','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x9172a9,_0xa80a2){var _0x568a7b=function(_0x5d5b1a){while(--_0x5d5b1a){_0x9172a9['push'](_0x9172a9['shift']());}};_0x568a7b(++_0xa80a2);}(_0x782a,0x1e0));var _0xa782=function(_0x17c2c9,_0x514905){_0x17c2c9=_0x17c2c9-0x0;var _0x1c57c0=_0x782a[_0x17c2c9];return _0x1c57c0;};'use strict';var _=require('lodash');var util=require(_0xa782('0x0'));var logger=require(_0xa782('0x1'))(_0xa782('0x2'));var moment=require(_0xa782('0x3'));var BPromise=require(_0xa782('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa782('0x5'));var rimraf=require(_0xa782('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x4bb3ca,_0x495387){return _0x4bb3ca[_0xa782('0x7')](_0xa782('0x8'),attributes,{'tableName':_0xa782('0x9'),'paranoid':![],'indexes':[{'name':_0xa782('0xa'),'fields':[_0xa782('0xa')]},{'name':_0xa782('0xb'),'fields':[_0xa782('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 035c90f..e8f9502 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(_0x51a673,_0x41919a){var _0x3a4aaa=function(_0x3b1635){while(--_0x3b1635){_0x51a673['push'](_0x51a673['shift']());}};_0x3a4aaa(++_0x41919a);}(_0x7a54,0x106));var _0x47a5=function(_0x9ceb6a,_0x90c27e){_0x9ceb6a=_0x9ceb6a-0x0;var _0x5ae9a9=_0x7a54[_0x9ceb6a];return _0x5ae9a9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5402f4,_0x5549c3){var _0x2e60c8=function(_0x1fed62){while(--_0x1fed62){_0x5402f4['push'](_0x5402f4['shift']());}};_0x2e60c8(++_0x5549c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0xb10b[_0x531d15];return _0x271a18;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 3679435..35910f5 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 _0xd1f1=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x37bb40,_0x259deb){_0x37bb40=_0x37bb40-0x0;var _0x598fb0=_0xd1f1[_0x37bb40];return _0x598fb0;};'use strict';var multer=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var path=require('path');var timeout=require(_0x1d1f('0x2'));var express=require(_0x1d1f('0x3'));var router=express[_0x1d1f('0x4')]();var fs_extra=require(_0x1d1f('0x5'));var auth=require(_0x1d1f('0x6'));var interaction=require(_0x1d1f('0x7'));var config=require(_0x1d1f('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x1d1f('0x9')]('/',auth[_0x1d1f('0xa')](),controller[_0x1d1f('0xb')]);router[_0x1d1f('0x9')](_0x1d1f('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1d1f('0xd'),auth[_0x1d1f('0xa')](),controller[_0x1d1f('0xe')]);router[_0x1d1f('0x9')]('/voice/queue/countAttributes/:id',auth[_0x1d1f('0xa')](),controller[_0x1d1f('0xf')]);router[_0x1d1f('0x9')](_0x1d1f('0x10'),auth[_0x1d1f('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x1d1f('0x11'),auth[_0x1d1f('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x1d1f('0x12')](_0x1d1f('0x13'),auth[_0x1d1f('0xa')](),controller[_0x1d1f('0x14')]);router['post'](_0x1d1f('0x15'),auth[_0x1d1f('0xa')](),controller[_0x1d1f('0x16')]);router[_0x1d1f('0x17')](_0x1d1f('0xd'),auth[_0x1d1f('0xa')](),controller[_0x1d1f('0x18')]);module[_0x1d1f('0x19')]=router; \ No newline at end of file +var _0xe066=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xe066,0xdf));var _0x6e06=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0xe066[_0x59eacf];return _0x5d74f2;};'use strict';var multer=require(_0x6e06('0x0'));var util=require(_0x6e06('0x1'));var path=require(_0x6e06('0x2'));var timeout=require(_0x6e06('0x3'));var express=require(_0x6e06('0x4'));var router=express[_0x6e06('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6e06('0x6'));var interaction=require(_0x6e06('0x7'));var config=require('../../config/environment');var controller=require(_0x6e06('0x8'));router[_0x6e06('0x9')]('/',auth[_0x6e06('0xa')](),controller['index']);router[_0x6e06('0x9')]('/describe',auth[_0x6e06('0xa')](),controller[_0x6e06('0xb')]);router[_0x6e06('0x9')](_0x6e06('0xc'),auth[_0x6e06('0xa')](),controller[_0x6e06('0xd')]);router['get'](_0x6e06('0xe'),auth[_0x6e06('0xa')](),controller[_0x6e06('0xf')]);router['get'](_0x6e06('0x10'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x11')]);router[_0x6e06('0x12')](_0x6e06('0x13'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x14')]);router[_0x6e06('0x12')](_0x6e06('0x15'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x16')]);router[_0x6e06('0x12')](_0x6e06('0x17'),auth['isAuthenticated'](),controller[_0x6e06('0x18')]);router[_0x6e06('0x19')](_0x6e06('0xc'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x1a')]);module[_0x6e06('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2bbd740..f597f10 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 _0x6873=['DATE','BOOLEAN','exports','INTEGER','STRING'];(function(_0x5726ad,_0x2c66cf){var _0x2f243e=function(_0x555e93){while(--_0x555e93){_0x5726ad['push'](_0x5726ad['shift']());}};_0x2f243e(++_0x2c66cf);}(_0x6873,0x124));var _0x3687=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0x6873[_0x56e32e];return _0x2a757b;};'use strict';var Sequelize=require('sequelize');module[_0x3687('0x0')]={'state':{'type':Sequelize[_0x3687('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3687('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x3687('0x2')]},'calleridnum':{'type':Sequelize[_0x3687('0x2')]},'calleridname':{'type':Sequelize[_0x3687('0x2')]},'starttime':{'type':Sequelize[_0x3687('0x3')]},'responsetime':{'type':Sequelize[_0x3687('0x3')]},'answertime':{'type':Sequelize[_0x3687('0x3')]},'droptime':{'type':Sequelize[_0x3687('0x3')]},'endtime':{'type':Sequelize[_0x3687('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3687('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3687('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3687('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3687('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x3687('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3687('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3687('0x2')]}}; \ No newline at end of file +var _0x7a0b=['BOOLEAN','sequelize','exports','INTEGER','DATE','STRING'];(function(_0x193422,_0x3e6f64){var _0x233639=function(_0x4697ab){while(--_0x4697ab){_0x193422['push'](_0x193422['shift']());}};_0x233639(++_0x3e6f64);}(_0x7a0b,0x85));var _0xb7a0=function(_0x1443ce,_0x586e0f){_0x1443ce=_0x1443ce-0x0;var _0x5d6445=_0x7a0b[_0x1443ce];return _0x5d6445;};'use strict';var Sequelize=require(_0xb7a0('0x0'));module[_0xb7a0('0x1')]={'state':{'type':Sequelize[_0xb7a0('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb7a0('0x3')]},'countbusyretry':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb7a0('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xb7a0('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb7a0('0x4')]},'calleridname':{'type':Sequelize[_0xb7a0('0x4')]},'starttime':{'type':Sequelize[_0xb7a0('0x3')]},'responsetime':{'type':Sequelize[_0xb7a0('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb7a0('0x3')]},'ringtime':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb7a0('0x4')]},'campaign':{'type':Sequelize[_0xb7a0('0x4')]},'campaigntype':{'type':Sequelize[_0xb7a0('0x4')]},'membername':{'type':Sequelize[_0xb7a0('0x4')]},'reason':{'type':Sequelize[_0xb7a0('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb7a0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb7a0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb7a0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb7a0('0x3')]},'recallme':{'type':Sequelize[_0xb7a0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb7a0('0x3')]},'edited':{'type':Sequelize[_0xb7a0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb7a0('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb7a0('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c8c76dc..37a6bef 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 _0xc340=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','CmHopperHistory','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x57977c,_0x115cb8){var _0xced947=function(_0x2db2c6){while(--_0x2db2c6){_0x57977c['push'](_0x57977c['shift']());}};_0xced947(++_0x115cb8);}(_0xc340,0xd7));var _0x0c34=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc340[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x0c34('0x0'));var rimraf=require(_0x0c34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c34('0x2'));var rp=require(_0x0c34('0x3'));var moment=require(_0x0c34('0x4'));var BPromise=require(_0x0c34('0x5'));var Mustache=require('mustache');var util=require(_0x0c34('0x6'));var path=require(_0x0c34('0x7'));var sox=require(_0x0c34('0x8'));var csv=require('to-csv');var ejs=require(_0x0c34('0x9'));var fs=require('fs');var fs_extra=require(_0x0c34('0xa'));var _=require(_0x0c34('0xb'));var squel=require(_0x0c34('0xc'));var crypto=require(_0x0c34('0xd'));var jsforce=require(_0x0c34('0xe'));var deskjs=require(_0x0c34('0xf'));var toCsv=require(_0x0c34('0x10'));var querystring=require(_0x0c34('0x11'));var Papa=require('papaparse');var Redis=require(_0x0c34('0x12'));var authService=require(_0x0c34('0x13'));var qs=require(_0x0c34('0x14'));var as=require(_0x0c34('0x15'));var hardwareService=require(_0x0c34('0x16'));var logger=require(_0x0c34('0x17'))(_0x0c34('0x18'));var utils=require(_0x0c34('0x19'));var config=require(_0x0c34('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c34('0x1b'))['db'];function respondWithStatusCode(_0x4b5937,_0xaafd2c){_0xaafd2c=_0xaafd2c||0xcc;return function(_0x5bb44b){if(_0x5bb44b){return _0x4b5937[_0x0c34('0x1c')](_0xaafd2c);}return _0x4b5937[_0x0c34('0x1d')](_0xaafd2c)[_0x0c34('0x1e')]();};}function respondWithResult(_0x4a8ba2,_0x3ed405){_0x3ed405=_0x3ed405||0xc8;return function(_0x1e6450){if(_0x1e6450){return _0x4a8ba2['status'](_0x3ed405)['json'](_0x1e6450);}};}function respondWithFilteredResult(_0x3b6ab9,_0x2f59e5){return function(_0x1f2304){if(_0x1f2304){var _0x6fcd68=typeof _0x2f59e5[_0x0c34('0x1f')]===_0x0c34('0x20')&&typeof _0x2f59e5[_0x0c34('0x21')]===_0x0c34('0x20');var _0x52499c=_0x1f2304[_0x0c34('0x22')];var _0x1b998b=_0x6fcd68?0x0:_0x2f59e5[_0x0c34('0x1f')];var _0x3a86a=_0x6fcd68?_0x1f2304[_0x0c34('0x22')]:_0x2f59e5[_0x0c34('0x1f')]+_0x2f59e5[_0x0c34('0x21')];var _0x43bffb;if(_0x3a86a>=_0x52499c){_0x3a86a=_0x52499c;_0x43bffb=0xc8;}else{_0x43bffb=0xce;}_0x3b6ab9[_0x0c34('0x1d')](_0x43bffb);return _0x3b6ab9[_0x0c34('0x23')](_0x0c34('0x24'),_0x1b998b+'-'+_0x3a86a+'/'+_0x52499c)['json'](_0x1f2304);}return null;};}function patchUpdates(_0x4ded20){return function(_0x18323d){try{jsonpatch['apply'](_0x18323d,_0x4ded20,!![]);}catch(_0x2c6d68){return BPromise[_0x0c34('0x25')](_0x2c6d68);}return _0x18323d[_0x0c34('0x26')]();};}function saveUpdates(_0x1e5f16,_0x57277e){return function(_0x1c9eaa){if(_0x1c9eaa){return _0x1c9eaa[_0x0c34('0x27')](_0x1e5f16)[_0x0c34('0x28')](function(_0x364228){return _0x364228;});}return null;};}function removeEntity(_0x4717ff,_0x2826cf){return function(_0x25aefa){if(_0x25aefa){return _0x25aefa['destroy']()[_0x0c34('0x28')](function(){_0x4717ff['status'](0xcc)[_0x0c34('0x1e')]();});}};}function handleEntityNotFound(_0x2d1b5e,_0x439a2c){return function(_0x1933b5){if(!_0x1933b5){_0x2d1b5e[_0x0c34('0x1c')](0x194);}return _0x1933b5;};}function handleError(_0x3b8015,_0x491534){_0x491534=_0x491534||0x1f4;return function(_0x210cac){logger[_0x0c34('0x29')](_0x210cac['stack']);if(_0x210cac[_0x0c34('0x2a')]){delete _0x210cac[_0x0c34('0x2a')];}_0x3b8015[_0x0c34('0x1d')](_0x491534)[_0x0c34('0x2b')](_0x210cac);};}exports[_0x0c34('0x2c')]=function(_0x2d4545,_0x60702c){var _0x588944={},_0x488564={},_0x338e50={'count':0x0,'rows':[]};var _0x3abeea=_[_0x0c34('0x2d')](db['CmHopperHistory']['rawAttributes'],function(_0x295e26){return{'name':_0x295e26[_0x0c34('0x2e')],'type':_0x295e26[_0x0c34('0x2f')]['key']};});_0x488564[_0x0c34('0x30')]=_[_0x0c34('0x2d')](_0x3abeea,_0x0c34('0x2a'));_0x488564[_0x0c34('0x31')]=_[_0x0c34('0x32')](_0x2d4545[_0x0c34('0x31')]);_0x488564[_0x0c34('0x33')]=_[_0x0c34('0x34')](_0x488564[_0x0c34('0x30')],_0x488564[_0x0c34('0x31')]);_0x588944[_0x0c34('0x35')]=_[_0x0c34('0x34')](_0x488564[_0x0c34('0x30')],qs[_0x0c34('0x36')](_0x2d4545[_0x0c34('0x31')][_0x0c34('0x36')]));_0x588944[_0x0c34('0x35')]=_0x588944['attributes'][_0x0c34('0x37')]?_0x588944[_0x0c34('0x35')]:_0x488564[_0x0c34('0x30')];if(!_0x2d4545[_0x0c34('0x31')][_0x0c34('0x38')](_0x0c34('0x39'))){_0x588944['limit']=qs[_0x0c34('0x21')](_0x2d4545[_0x0c34('0x31')][_0x0c34('0x21')]);_0x588944[_0x0c34('0x1f')]=qs['offset'](_0x2d4545[_0x0c34('0x31')]['offset']);}_0x588944['order']=qs['sort'](_0x2d4545[_0x0c34('0x31')][_0x0c34('0x3a')]);_0x588944[_0x0c34('0x3b')]=qs[_0x0c34('0x33')](_[_0x0c34('0x3c')](_0x2d4545[_0x0c34('0x31')],_0x488564['filters']),_0x3abeea);if(_0x2d4545[_0x0c34('0x31')]['filter']){_0x588944[_0x0c34('0x3b')]=_['merge'](_0x588944[_0x0c34('0x3b')],{'$or':_[_0x0c34('0x2d')](_0x3abeea,function(_0x4214cd){if(_0x4214cd['type']!==_0x0c34('0x3d')){var _0x418145={};_0x418145[_0x4214cd[_0x0c34('0x2a')]]={'$like':'%'+_0x2d4545[_0x0c34('0x31')][_0x0c34('0x3e')]+'%'};return _0x418145;}})});}_0x588944=_[_0x0c34('0x3f')]({},_0x588944,_0x2d4545[_0x0c34('0x40')]);var _0x51b9f2={'where':_0x588944[_0x0c34('0x3b')]};return db[_0x0c34('0x41')][_0x0c34('0x22')](_0x51b9f2)[_0x0c34('0x28')](function(_0x51bf85){_0x338e50['count']=_0x51bf85;if(_0x2d4545['query'][_0x0c34('0x42')]){_0x588944[_0x0c34('0x43')]=[{'all':!![]}];}return db[_0x0c34('0x41')][_0x0c34('0x44')](_0x588944);})[_0x0c34('0x28')](function(_0x89654){_0x338e50['rows']=_0x89654;return _0x338e50;})['then'](respondWithFilteredResult(_0x60702c,_0x588944))[_0x0c34('0x45')](handleError(_0x60702c,null));};exports[_0x0c34('0x46')]=function(_0x39401f,_0x2faf0d){var _0x109c44={'raw':!![],'where':{'id':_0x39401f[_0x0c34('0x47')]['id']}},_0x129113={};_0x129113[_0x0c34('0x30')]=_[_0x0c34('0x32')](db[_0x0c34('0x41')][_0x0c34('0x48')]);_0x129113[_0x0c34('0x31')]=_[_0x0c34('0x32')](_0x39401f[_0x0c34('0x31')]);_0x129113[_0x0c34('0x33')]=_[_0x0c34('0x34')](_0x129113[_0x0c34('0x30')],_0x129113[_0x0c34('0x31')]);_0x109c44['attributes']=_['intersection'](_0x129113['model'],qs[_0x0c34('0x36')](_0x39401f[_0x0c34('0x31')][_0x0c34('0x36')]));_0x109c44[_0x0c34('0x35')]=_0x109c44[_0x0c34('0x35')][_0x0c34('0x37')]?_0x109c44[_0x0c34('0x35')]:_0x129113['model'];if(_0x39401f[_0x0c34('0x31')][_0x0c34('0x42')]){_0x109c44[_0x0c34('0x43')]=[{'all':!![]}];}_0x109c44=_[_0x0c34('0x3f')]({},_0x109c44,_0x39401f[_0x0c34('0x40')]);return db[_0x0c34('0x41')][_0x0c34('0x49')](_0x109c44)[_0x0c34('0x28')](handleEntityNotFound(_0x2faf0d,null))[_0x0c34('0x28')](respondWithResult(_0x2faf0d,null))['catch'](handleError(_0x2faf0d,null));};exports[_0x0c34('0x4a')]=function(_0x2b8132,_0x2ad8c9){return db[_0x0c34('0x41')]['create'](_0x2b8132[_0x0c34('0x4b')],{})[_0x0c34('0x28')](respondWithResult(_0x2ad8c9,0xc9))['catch'](handleError(_0x2ad8c9,null));};exports[_0x0c34('0x4c')]=function(_0x3c0327,_0x1c17b2){return db[_0x0c34('0x41')]['describe']()[_0x0c34('0x28')](respondWithResult(_0x1c17b2,null))[_0x0c34('0x45')](handleError(_0x1c17b2,null));};exports[_0x0c34('0x27')]=function(_0x3b2ff8,_0x5c4715){if(_0x3b2ff8[_0x0c34('0x4b')][_0x0c34('0x4d')]){delete _0x3b2ff8['body'][_0x0c34('0x4d')];}return db[_0x0c34('0x41')]['find']({'where':{'uniqueid':_0x3b2ff8[_0x0c34('0x47')]['id']}})[_0x0c34('0x28')](handleEntityNotFound(_0x5c4715,null))[_0x0c34('0x28')](saveUpdates(_0x3b2ff8[_0x0c34('0x4b')],null))[_0x0c34('0x28')](respondWithResult(_0x5c4715,null))[_0x0c34('0x45')](handleError(_0x5c4715,null));}; \ No newline at end of file +var _0xe2dc=['nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x42631f,_0x349b87){var _0x4bf7f8=function(_0x407c13){while(--_0x407c13){_0x42631f['push'](_0x42631f['shift']());}};_0x4bf7f8(++_0x349b87);}(_0xe2dc,0xf6));var _0xce2d=function(_0x232fd2,_0x546a17){_0x232fd2=_0x232fd2-0x0;var _0x3d13a0=_0xe2dc[_0x232fd2];return _0x3d13a0;};'use strict';var emlformat=require(_0xce2d('0x0'));var rimraf=require(_0xce2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce2d('0x2'));var rp=require('request-promise');var moment=require(_0xce2d('0x3'));var BPromise=require(_0xce2d('0x4'));var Mustache=require(_0xce2d('0x5'));var util=require('util');var path=require(_0xce2d('0x6'));var sox=require(_0xce2d('0x7'));var csv=require(_0xce2d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce2d('0x9'));var _=require(_0xce2d('0xa'));var squel=require(_0xce2d('0xb'));var crypto=require(_0xce2d('0xc'));var jsforce=require(_0xce2d('0xd'));var deskjs=require(_0xce2d('0xe'));var toCsv=require(_0xce2d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce2d('0xf'));var authService=require(_0xce2d('0x10'));var qs=require(_0xce2d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce2d('0x12'));var logger=require(_0xce2d('0x13'))(_0xce2d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce2d('0x15'))['db'];function respondWithStatusCode(_0x54f89a,_0x5f080b){_0x5f080b=_0x5f080b||0xcc;return function(_0x514151){if(_0x514151){return _0x54f89a[_0xce2d('0x16')](_0x5f080b);}return _0x54f89a[_0xce2d('0x17')](_0x5f080b)[_0xce2d('0x18')]();};}function respondWithResult(_0x43fbb4,_0x3e561d){_0x3e561d=_0x3e561d||0xc8;return function(_0x1b02e9){if(_0x1b02e9){return _0x43fbb4[_0xce2d('0x17')](_0x3e561d)[_0xce2d('0x19')](_0x1b02e9);}};}function respondWithFilteredResult(_0x16f5e1,_0x4dda5c){return function(_0x451d3c){if(_0x451d3c){var _0x51616c=typeof _0x4dda5c[_0xce2d('0x1a')]===_0xce2d('0x1b')&&typeof _0x4dda5c[_0xce2d('0x1c')]==='undefined';var _0x2936b8=_0x451d3c[_0xce2d('0x1d')];var _0x4a9bd6=_0x51616c?0x0:_0x4dda5c['offset'];var _0x40952c=_0x51616c?_0x451d3c[_0xce2d('0x1d')]:_0x4dda5c[_0xce2d('0x1a')]+_0x4dda5c[_0xce2d('0x1c')];var _0x4a0e42;if(_0x40952c>=_0x2936b8){_0x40952c=_0x2936b8;_0x4a0e42=0xc8;}else{_0x4a0e42=0xce;}_0x16f5e1[_0xce2d('0x17')](_0x4a0e42);return _0x16f5e1[_0xce2d('0x1e')](_0xce2d('0x1f'),_0x4a9bd6+'-'+_0x40952c+'/'+_0x2936b8)[_0xce2d('0x19')](_0x451d3c);}return null;};}function patchUpdates(_0x4ee280){return function(_0xabc7ce){try{jsonpatch[_0xce2d('0x20')](_0xabc7ce,_0x4ee280,!![]);}catch(_0x391c92){return BPromise[_0xce2d('0x21')](_0x391c92);}return _0xabc7ce[_0xce2d('0x22')]();};}function saveUpdates(_0x1fa494,_0x31fba1){return function(_0x3e19a2){if(_0x3e19a2){return _0x3e19a2[_0xce2d('0x23')](_0x1fa494)[_0xce2d('0x24')](function(_0xfffb34){return _0xfffb34;});}return null;};}function removeEntity(_0x228d20,_0x2b3c80){return function(_0x25ff87){if(_0x25ff87){return _0x25ff87[_0xce2d('0x25')]()[_0xce2d('0x24')](function(){_0x228d20[_0xce2d('0x17')](0xcc)[_0xce2d('0x18')]();});}};}function handleEntityNotFound(_0x5cdd5d,_0x78220f){return function(_0x22a541){if(!_0x22a541){_0x5cdd5d[_0xce2d('0x16')](0x194);}return _0x22a541;};}function handleError(_0x173c36,_0x8df496){_0x8df496=_0x8df496||0x1f4;return function(_0x29edb0){logger['error'](_0x29edb0[_0xce2d('0x26')]);if(_0x29edb0[_0xce2d('0x27')]){delete _0x29edb0[_0xce2d('0x27')];}_0x173c36[_0xce2d('0x17')](_0x8df496)[_0xce2d('0x28')](_0x29edb0);};}exports['index']=function(_0x5ce2a4,_0x23fafe){var _0x2186b8={},_0x489186={},_0x5b1e7e={'count':0x0,'rows':[]};var _0x3ad1fd=_[_0xce2d('0x29')](db[_0xce2d('0x2a')][_0xce2d('0x2b')],function(_0x123505){return{'name':_0x123505[_0xce2d('0x2c')],'type':_0x123505['type'][_0xce2d('0x2d')]};});_0x489186[_0xce2d('0x2e')]=_[_0xce2d('0x29')](_0x3ad1fd,_0xce2d('0x27'));_0x489186[_0xce2d('0x2f')]=_[_0xce2d('0x30')](_0x5ce2a4[_0xce2d('0x2f')]);_0x489186[_0xce2d('0x31')]=_[_0xce2d('0x32')](_0x489186[_0xce2d('0x2e')],_0x489186[_0xce2d('0x2f')]);_0x2186b8[_0xce2d('0x33')]=_[_0xce2d('0x32')](_0x489186[_0xce2d('0x2e')],qs['fields'](_0x5ce2a4[_0xce2d('0x2f')]['fields']));_0x2186b8['attributes']=_0x2186b8[_0xce2d('0x33')][_0xce2d('0x34')]?_0x2186b8[_0xce2d('0x33')]:_0x489186[_0xce2d('0x2e')];if(!_0x5ce2a4['query'][_0xce2d('0x35')](_0xce2d('0x36'))){_0x2186b8[_0xce2d('0x1c')]=qs[_0xce2d('0x1c')](_0x5ce2a4[_0xce2d('0x2f')][_0xce2d('0x1c')]);_0x2186b8[_0xce2d('0x1a')]=qs[_0xce2d('0x1a')](_0x5ce2a4[_0xce2d('0x2f')][_0xce2d('0x1a')]);}_0x2186b8['order']=qs['sort'](_0x5ce2a4['query'][_0xce2d('0x37')]);_0x2186b8[_0xce2d('0x38')]=qs[_0xce2d('0x31')](_[_0xce2d('0x39')](_0x5ce2a4[_0xce2d('0x2f')],_0x489186[_0xce2d('0x31')]),_0x3ad1fd);if(_0x5ce2a4[_0xce2d('0x2f')][_0xce2d('0x3a')]){_0x2186b8['where']=_[_0xce2d('0x3b')](_0x2186b8[_0xce2d('0x38')],{'$or':_['map'](_0x3ad1fd,function(_0xf3f231){if(_0xf3f231[_0xce2d('0x3c')]!==_0xce2d('0x3d')){var _0x2d8b0a={};_0x2d8b0a[_0xf3f231[_0xce2d('0x27')]]={'$like':'%'+_0x5ce2a4[_0xce2d('0x2f')][_0xce2d('0x3a')]+'%'};return _0x2d8b0a;}})});}_0x2186b8=_[_0xce2d('0x3b')]({},_0x2186b8,_0x5ce2a4[_0xce2d('0x3e')]);var _0xd70702={'where':_0x2186b8[_0xce2d('0x38')]};return db[_0xce2d('0x2a')][_0xce2d('0x1d')](_0xd70702)[_0xce2d('0x24')](function(_0x1ae923){_0x5b1e7e[_0xce2d('0x1d')]=_0x1ae923;if(_0x5ce2a4[_0xce2d('0x2f')][_0xce2d('0x3f')]){_0x2186b8[_0xce2d('0x40')]=[{'all':!![]}];}return db[_0xce2d('0x2a')][_0xce2d('0x41')](_0x2186b8);})[_0xce2d('0x24')](function(_0x498c87){_0x5b1e7e[_0xce2d('0x42')]=_0x498c87;return _0x5b1e7e;})[_0xce2d('0x24')](respondWithFilteredResult(_0x23fafe,_0x2186b8))[_0xce2d('0x43')](handleError(_0x23fafe,null));};exports['show']=function(_0x32d9cb,_0x134e2f){var _0x25c85a={'raw':!![],'where':{'id':_0x32d9cb[_0xce2d('0x44')]['id']}},_0xf3bc6f={};_0xf3bc6f[_0xce2d('0x2e')]=_[_0xce2d('0x30')](db[_0xce2d('0x2a')][_0xce2d('0x2b')]);_0xf3bc6f[_0xce2d('0x2f')]=_[_0xce2d('0x30')](_0x32d9cb[_0xce2d('0x2f')]);_0xf3bc6f[_0xce2d('0x31')]=_[_0xce2d('0x32')](_0xf3bc6f[_0xce2d('0x2e')],_0xf3bc6f['query']);_0x25c85a['attributes']=_[_0xce2d('0x32')](_0xf3bc6f[_0xce2d('0x2e')],qs['fields'](_0x32d9cb[_0xce2d('0x2f')][_0xce2d('0x45')]));_0x25c85a[_0xce2d('0x33')]=_0x25c85a[_0xce2d('0x33')][_0xce2d('0x34')]?_0x25c85a[_0xce2d('0x33')]:_0xf3bc6f[_0xce2d('0x2e')];if(_0x32d9cb[_0xce2d('0x2f')][_0xce2d('0x3f')]){_0x25c85a['include']=[{'all':!![]}];}_0x25c85a=_[_0xce2d('0x3b')]({},_0x25c85a,_0x32d9cb[_0xce2d('0x3e')]);return db[_0xce2d('0x2a')][_0xce2d('0x46')](_0x25c85a)[_0xce2d('0x24')](handleEntityNotFound(_0x134e2f,null))[_0xce2d('0x24')](respondWithResult(_0x134e2f,null))[_0xce2d('0x43')](handleError(_0x134e2f,null));};exports[_0xce2d('0x47')]=function(_0x7192fd,_0x3c13ba){return db['CmHopperHistory'][_0xce2d('0x47')](_0x7192fd[_0xce2d('0x48')],{})[_0xce2d('0x24')](respondWithResult(_0x3c13ba,0xc9))['catch'](handleError(_0x3c13ba,null));};exports[_0xce2d('0x49')]=function(_0x4f7bd4,_0xf8786f){return db[_0xce2d('0x2a')]['describe']()['then'](respondWithResult(_0xf8786f,null))['catch'](handleError(_0xf8786f,null));};exports[_0xce2d('0x23')]=function(_0x5f3968,_0x4a7806){if(_0x5f3968[_0xce2d('0x48')][_0xce2d('0x4a')]){delete _0x5f3968[_0xce2d('0x48')][_0xce2d('0x4a')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x5f3968[_0xce2d('0x44')]['id']}})[_0xce2d('0x24')](handleEntityNotFound(_0x4a7806,null))[_0xce2d('0x24')](saveUpdates(_0x5f3968[_0xce2d('0x48')],null))['then'](respondWithResult(_0x4a7806,null))[_0xce2d('0x43')](handleError(_0x4a7806,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0a9175c..cbe4568 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 _0x980e=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','api','bluebird','path','rimraf','exports','define'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe980('0x1'));var moment=require('moment');var BPromise=require(_0xe980('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe980('0x3'));var rimraf=require(_0xe980('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xe980('0x5')]=function(_0x55b114,_0x539945){return _0x55b114[_0xe980('0x6')](_0xe980('0x7'),attributes,{'tableName':_0xe980('0x8'),'paranoid':![],'indexes':[{'name':_0xe980('0x9'),'fields':[_0xe980('0x9')]},{'name':_0xe980('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc891=['endtime','uniqueid','lodash','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xc891,0x152));var _0x1c89=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc891[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x1c89('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1c89('0x1'));var moment=require('moment');var BPromise=require(_0x1c89('0x2'));var rp=require(_0x1c89('0x3'));var fs=require('fs');var path=require(_0x1c89('0x4'));var rimraf=require('rimraf');var config=require(_0x1c89('0x5'));var attributes=require(_0x1c89('0x6'));module[_0x1c89('0x7')]=function(_0x16b4a3,_0x5c9cb9){return _0x16b4a3[_0x1c89('0x8')](_0x1c89('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x1c89('0xa'),'fields':[_0x1c89('0xa')]},{'name':'uniqueid','fields':[_0x1c89('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index dd88aa7..0b016f9 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 _0xb2b3=['predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','GetVoiceQueueHopperHistory','findAll','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','create','options','CreateCmHopperHistory','stringify','catch','AvgHandleTime','CmHopperHistory','where','sequelize','COUNT','col'];(function(_0x559e2b,_0x2731f8){var _0x244a86=function(_0x4cf0f0){while(--_0x4cf0f0){_0x559e2b['push'](_0x559e2b['shift']());}};_0x244a86(++_0x2731f8);}(_0xb2b3,0x71));var _0x3b2b=function(_0x2cd37c,_0x5edeae){_0x2cd37c=_0x2cd37c-0x0;var _0x556902=_0xb2b3[_0x2cd37c];return _0x556902;};'use strict';var _=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var moment=require(_0x3b2b('0x2'));var BPromise=require(_0x3b2b('0x3'));var rs=require(_0x3b2b('0x4'));var fs=require('fs');var Redis=require(_0x3b2b('0x5'));var db=require(_0x3b2b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2b('0x7'))(_0x3b2b('0x8'));var config=require(_0x3b2b('0x9'));var jayson=require(_0x3b2b('0xa'));var client=jayson[_0x3b2b('0xb')][_0x3b2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x83e7ef,_0x24b585,_0x1a9054){return new BPromise(function(_0x3ec416,_0x33b807){return client[_0x3b2b('0xd')](_0x83e7ef,_0x1a9054)['then'](function(_0x430be0){logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));logger[_0x3b2b('0x11')](_0x3b2b('0x12'),_0x24b585,'request\x20sent',JSON['stringify'](_0x430be0));if(_0x430be0[_0x3b2b('0x13')]){if(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x14')]===0x1f4){logger[_0x3b2b('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x24b585,_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);return _0x33b807(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);}logger[_0x3b2b('0x13')](_0x3b2b('0xf'),_0x24b585,_0x430be0['error'][_0x3b2b('0x15')]);return _0x3ec416(_0x430be0[_0x3b2b('0x13')]['message']);}else{logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));_0x3ec416(_0x430be0['result'][_0x3b2b('0x15')]);}})['catch'](function(_0x21743d){logger[_0x3b2b('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x24b585,_0x21743d);_0x33b807(_0x21743d);});});}exports['CreateCmHopperHistory']=function(_0x1a3bfb){var _0x52bba5=this;return new Promise(function(_0x157155,_0x30e4c2){return db['CmHopperHistory'][_0x3b2b('0x16')](_0x1a3bfb['body'],{'raw':_0x1a3bfb[_0x3b2b('0x17')]?_0x1a3bfb[_0x3b2b('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1d786b){logger[_0x3b2b('0xe')](_0x3b2b('0x18'),_0x1a3bfb);logger[_0x3b2b('0x11')](_0x3b2b('0x18'),_0x1a3bfb,JSON[_0x3b2b('0x19')](_0x1d786b));_0x157155(_0x1d786b);})[_0x3b2b('0x1a')](function(_0xc5b0bf){logger[_0x3b2b('0x13')](_0x3b2b('0x18'),_0xc5b0bf[_0x3b2b('0x15')],_0x1a3bfb);_0x30e4c2(_0x52bba5['error'](0x1f4,_0xc5b0bf[_0x3b2b('0x15')]));});});};exports[_0x3b2b('0x1b')]=function(_0x252e36){var _0x50e95c=this;return new Promise(function(_0x306739,_0x5ef8cf){return db[_0x3b2b('0x1c')]['findAll']({'raw':_0x252e36[_0x3b2b('0x17')]?_0x252e36['options']['raw']===undefined?!![]:![]:!![],'where':_0x252e36[_0x3b2b('0x17')]?_0x252e36[_0x3b2b('0x17')][_0x3b2b('0x1d')]||null:null,'attributes':[[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')][_0x3b2b('0x20')]('id')),_0x3b2b('0x21')],[db[_0x3b2b('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3b2b('0x22')))),_0x3b2b('0x23')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0x3b2b('0x25')],[db['sequelize']['fn']('COUNT',db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x3b2b('0x27'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x3b2b('0x1e')]['fn']('AVG',db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x29')))),_0x3b2b('0x2a')]]})[_0x3b2b('0x2b')](function(_0x340f97){logger[_0x3b2b('0xe')]('AvgHandleTime',_0x252e36);logger['debug'](_0x3b2b('0x1b'),_0x252e36,JSON['stringify'](_0x340f97));_0x306739(_0x340f97);})[_0x3b2b('0x1a')](function(_0x2696b1){logger[_0x3b2b('0x13')](_0x3b2b('0x1b'),_0x2696b1[_0x3b2b('0x15')],_0x252e36);_0x5ef8cf(_0x50e95c[_0x3b2b('0x13')](0x1f4,_0x2696b1[_0x3b2b('0x15')]));});});};exports[_0x3b2b('0x2c')]=function(_0x41b2af){var _0x43ae3a=this;return new Promise(function(_0x517eb3,_0x466079){return db[_0x3b2b('0x1c')][_0x3b2b('0x2d')]({'raw':_0x41b2af[_0x3b2b('0x17')]?_0x41b2af[_0x3b2b('0x17')][_0x3b2b('0x2e')]===undefined?!![]:![]:!![],'where':_0x41b2af[_0x3b2b('0x17')]?_0x41b2af[_0x3b2b('0x17')][_0x3b2b('0x1d')]||null:null,'attributes':[[_0x3b2b('0x2f'),_0x3b2b('0x30')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db['sequelize'][_0x3b2b('0x24')](_0x3b2b('0x31')))),_0x3b2b('0x32')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x3b2b('0x33')],[db['sequelize']['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x22')))),_0x3b2b('0x34')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3b2b('0x35')))),_0x3b2b('0x36')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')]['literal'](_0x3b2b('0x37')))),'outboundCongestionCallsDay'],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3b2b('0x38')],[db['sequelize']['fn'](_0x3b2b('0x1f'),db['sequelize']['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x39')))),_0x3b2b('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x3b2b('0x1e')]['fn']('IF',db['sequelize'][_0x3b2b('0x24')](_0x3b2b('0x3b')))),'outboundUnknownCallsDay'],[db[_0x3b2b('0x1e')]['fn']('COUNT',db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x3c')))),_0x3b2b('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')]['literal'](_0x3b2b('0x3e')))),_0x3b2b('0x3f')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x40')))),_0x3b2b('0x41')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')]['literal'](_0x3b2b('0x42')))),_0x3b2b('0x43')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x3b2b('0x41')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x44')))),_0x3b2b('0x45')]],'group':[_0x3b2b('0x2f')]})[_0x3b2b('0x2b')](function(_0x1c7f08){logger[_0x3b2b('0xe')](_0x3b2b('0x2c'),_0x41b2af);logger['debug'](_0x3b2b('0x2c'),_0x41b2af,JSON[_0x3b2b('0x19')](_0x1c7f08));_0x517eb3(_0x1c7f08);})['catch'](function(_0x2704f3){logger[_0x3b2b('0x13')](_0x3b2b('0x2c'),_0x2704f3[_0x3b2b('0x15')],_0x41b2af);_0x466079(_0x43ae3a[_0x3b2b('0x13')](0x1f4,_0x2704f3[_0x3b2b('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x535816){var _0x3210ae=this;return new Promise(function(_0x3582db,_0x2eec87){return db['CmHopperHistory'][_0x3b2b('0x2d')]({'raw':_0x535816[_0x3b2b('0x17')]?_0x535816[_0x3b2b('0x17')][_0x3b2b('0x2e')]===undefined?!![]:![]:!![],'where':_0x535816['options']?_0x535816[_0x3b2b('0x17')][_0x3b2b('0x1d')]||null:null,'attributes':[[_0x3b2b('0x2f'),_0x3b2b('0x30')],[db[_0x3b2b('0x1e')]['fn'](_0x3b2b('0x1f'),db['sequelize'][_0x3b2b('0x20')]('id')),_0x3b2b('0x46')],[db['sequelize']['fn']('COUNT',db[_0x3b2b('0x1e')]['fn']('IF',db[_0x3b2b('0x1e')][_0x3b2b('0x24')](_0x3b2b('0x22')))),_0x3b2b('0x47')]],'group':[_0x3b2b('0x2f')]})[_0x3b2b('0x2b')](function(_0x71c544){logger[_0x3b2b('0xe')](_0x3b2b('0x48'),_0x535816);logger['debug'](_0x3b2b('0x48'),_0x535816,JSON['stringify'](_0x71c544));_0x3582db(_0x71c544);})[_0x3b2b('0x1a')](function(_0x896288){logger['error']('GetCampaignHopperHistory',_0x896288[_0x3b2b('0x15')],_0x535816);_0x2eec87(_0x3210ae['error'](0x1f4,_0x896288['message']));});});}; \ No newline at end of file +var _0x1d0d=['../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','GetCampaignHopperHistory','findAll','name','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','../../config/utils'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1d0d,0x183));var _0xd1d0=function(_0x3347a3,_0x149eae){_0x3347a3=_0x3347a3-0x0;var _0x36b36b=_0x1d0d[_0x3347a3];return _0x36b36b;};'use strict';var _=require('lodash');var util=require(_0xd1d0('0x0'));var moment=require(_0xd1d0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd1d0('0x2'));var logger=require(_0xd1d0('0x3'))(_0xd1d0('0x4'));var config=require(_0xd1d0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd1d0('0x6')][_0xd1d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18f081,_0xa70f9e,_0x439a3c){return new BPromise(function(_0x76e53f,_0x271c1a){return client['request'](_0x18f081,_0x439a3c)['then'](function(_0x4988a1){logger[_0xd1d0('0x8')]('CmHopperHistory,\x20%s,\x20%s',_0xa70f9e,_0xd1d0('0x9'));logger[_0xd1d0('0xa')](_0xd1d0('0xb'),_0xa70f9e,_0xd1d0('0x9'),JSON[_0xd1d0('0xc')](_0x4988a1));if(_0x4988a1[_0xd1d0('0xd')]){if(_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0xe')]===0x1f4){logger['error'](_0xd1d0('0xf'),_0xa70f9e,_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0x10')]);return _0x271c1a(_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0x10')]);}logger[_0xd1d0('0xd')](_0xd1d0('0xf'),_0xa70f9e,_0x4988a1[_0xd1d0('0xd')][_0xd1d0('0x10')]);return _0x76e53f(_0x4988a1['error'][_0xd1d0('0x10')]);}else{logger[_0xd1d0('0x8')](_0xd1d0('0xf'),_0xa70f9e,'request\x20sent');_0x76e53f(_0x4988a1[_0xd1d0('0x11')]['message']);}})[_0xd1d0('0x12')](function(_0x4becb1){logger[_0xd1d0('0xd')](_0xd1d0('0xf'),_0xa70f9e,_0x4becb1);_0x271c1a(_0x4becb1);});});}exports[_0xd1d0('0x13')]=function(_0x3c92e6){var _0x1c2034=this;return new Promise(function(_0x261dc4,_0x5628a6){return db[_0xd1d0('0x14')][_0xd1d0('0x15')](_0x3c92e6[_0xd1d0('0x16')],{'raw':_0x3c92e6[_0xd1d0('0x17')]?_0x3c92e6[_0xd1d0('0x17')][_0xd1d0('0x18')]===undefined?!![]:![]:!![]})[_0xd1d0('0x19')](function(_0x2ca99a){logger['info']('CreateCmHopperHistory',_0x3c92e6);logger[_0xd1d0('0xa')]('CreateCmHopperHistory',_0x3c92e6,JSON[_0xd1d0('0xc')](_0x2ca99a));_0x261dc4(_0x2ca99a);})[_0xd1d0('0x12')](function(_0x5ea872){logger[_0xd1d0('0xd')]('CreateCmHopperHistory',_0x5ea872[_0xd1d0('0x10')],_0x3c92e6);_0x5628a6(_0x1c2034['error'](0x1f4,_0x5ea872[_0xd1d0('0x10')]));});});};exports[_0xd1d0('0x1a')]=function(_0x11fa68){var _0x10b7bc=this;return new Promise(function(_0xf58d5d,_0x5b7bef){return db[_0xd1d0('0x14')]['findAll']({'raw':_0x11fa68[_0xd1d0('0x17')]?_0x11fa68[_0xd1d0('0x17')][_0xd1d0('0x18')]===undefined?!![]:![]:!![],'where':_0x11fa68[_0xd1d0('0x17')]?_0x11fa68['options'][_0xd1d0('0x1b')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xd1d0('0x1c')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x1f')))),'predictiveIntervalAnsweredCalls'],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x20')))),_0xd1d0('0x21')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x22')))),_0xd1d0('0x23')],[db['sequelize']['fn'](_0xd1d0('0x24'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x25')))),_0xd1d0('0x26')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x24'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')]['literal'](_0xd1d0('0x27')))),_0xd1d0('0x28')]]})[_0xd1d0('0x19')](function(_0x305467){logger[_0xd1d0('0x8')](_0xd1d0('0x1a'),_0x11fa68);logger[_0xd1d0('0xa')](_0xd1d0('0x1a'),_0x11fa68,JSON['stringify'](_0x305467));_0xf58d5d(_0x305467);})[_0xd1d0('0x12')](function(_0x551296){logger[_0xd1d0('0xd')](_0xd1d0('0x1a'),_0x551296[_0xd1d0('0x10')],_0x11fa68);_0x5b7bef(_0x10b7bc['error'](0x1f4,_0x551296[_0xd1d0('0x10')]));});});};exports[_0xd1d0('0x29')]=function(_0x106339){var _0xd3af76=this;return new Promise(function(_0x442cf1,_0x4831bd){return db[_0xd1d0('0x14')]['findAll']({'raw':_0x106339[_0xd1d0('0x17')]?_0x106339[_0xd1d0('0x17')][_0xd1d0('0x18')]===undefined?!![]:![]:!![],'where':_0x106339[_0xd1d0('0x17')]?_0x106339[_0xd1d0('0x17')][_0xd1d0('0x1b')]||null:null,'attributes':[[_0xd1d0('0x2a'),'name'],[db['sequelize']['fn']('COUNT',db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')]['literal'](_0xd1d0('0x2b')))),_0xd1d0('0x2c')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')]['literal'](_0xd1d0('0x2d')))),_0xd1d0('0x2e')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x1f')))),'outboundAnswerCallsDay'],[db[_0xd1d0('0x1c')]['fn']('COUNT',db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x2f')))),'outboundBusyCallsDay'],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db['sequelize']['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')]('`state`\x20=\x208,\x201,\x20null'))),_0xd1d0('0x30')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x31')))),_0xd1d0('0x32')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x33')))),_0xd1d0('0x34')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xd1d0('0x35')))),_0xd1d0('0x36')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db['sequelize']['fn']('IF',db[_0xd1d0('0x1c')]['literal'](_0xd1d0('0x37')))),'outboundBlacklistCallsDay'],[db[_0xd1d0('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd1d0('0x1c')]['literal'](_0xd1d0('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db['sequelize'][_0xd1d0('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xd1d0('0x1c')]['fn']('COUNT',db[_0xd1d0('0x1c')]['fn']('IF',db['sequelize'][_0xd1d0('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),_0xd1d0('0x39')],[db[_0xd1d0('0x1c')]['fn']('COUNT',db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')](_0xd1d0('0x3a')))),_0xd1d0('0x3b')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db['sequelize']['fn']('IF',db[_0xd1d0('0x1c')][_0xd1d0('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0xd1d0('0x2a')]})[_0xd1d0('0x19')](function(_0x28c582){logger[_0xd1d0('0x8')]('GetVoiceQueueHopperHistory',_0x106339);logger[_0xd1d0('0xa')](_0xd1d0('0x29'),_0x106339,JSON[_0xd1d0('0xc')](_0x28c582));_0x442cf1(_0x28c582);})[_0xd1d0('0x12')](function(_0x57e4f0){logger[_0xd1d0('0xd')](_0xd1d0('0x29'),_0x57e4f0[_0xd1d0('0x10')],_0x106339);_0x4831bd(_0xd3af76['error'](0x1f4,_0x57e4f0[_0xd1d0('0x10')]));});});};exports[_0xd1d0('0x3c')]=function(_0x4d3f2b){var _0x574582=this;return new Promise(function(_0x47ebab,_0x542281){return db[_0xd1d0('0x14')][_0xd1d0('0x3d')]({'raw':_0x4d3f2b[_0xd1d0('0x17')]?_0x4d3f2b['options'][_0xd1d0('0x18')]===undefined?!![]:![]:!![],'where':_0x4d3f2b[_0xd1d0('0x17')]?_0x4d3f2b['options'][_0xd1d0('0x1b')]||null:null,'attributes':[['campaign',_0xd1d0('0x3e')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['col']('id')),_0xd1d0('0x3f')],[db[_0xd1d0('0x1c')]['fn'](_0xd1d0('0x1d'),db[_0xd1d0('0x1c')]['fn']('IF',db[_0xd1d0('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xd1d0('0x40')]],'group':[_0xd1d0('0x2a')]})[_0xd1d0('0x19')](function(_0x514f11){logger['info'](_0xd1d0('0x3c'),_0x4d3f2b);logger[_0xd1d0('0xa')](_0xd1d0('0x3c'),_0x4d3f2b,JSON[_0xd1d0('0xc')](_0x514f11));_0x47ebab(_0x514f11);})['catch'](function(_0x1579f4){logger['error'](_0xd1d0('0x3c'),_0x1579f4[_0xd1d0('0x10')],_0x4d3f2b);_0x542281(_0x574582[_0xd1d0('0xd')](0x1f4,_0x1579f4[_0xd1d0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 06557c3..8a60ce8 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 _0xb893=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','/:id','isAuthenticated','show','post','create','put','update','multer','util','path','connect-timeout','Router'];(function(_0x3f4027,_0x221cbb){var _0x4aea2e=function(_0x29bcbb){while(--_0x29bcbb){_0x3f4027['push'](_0x3f4027['shift']());}};_0x4aea2e(++_0x221cbb);}(_0xb893,0x18a));var _0x3b89=function(_0x1c8fdc,_0x4210b1){_0x1c8fdc=_0x1c8fdc-0x0;var _0x39e241=_0xb893[_0x1c8fdc];return _0x39e241;};'use strict';var multer=require(_0x3b89('0x0'));var util=require(_0x3b89('0x1'));var path=require(_0x3b89('0x2'));var timeout=require(_0x3b89('0x3'));var express=require('express');var router=express[_0x3b89('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3b89('0x5'));var interaction=require(_0x3b89('0x6'));var config=require(_0x3b89('0x7'));var controller=require(_0x3b89('0x8'));router[_0x3b89('0x9')]('/',auth['isAuthenticated'](),controller[_0x3b89('0xa')]);router['get'](_0x3b89('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3b89('0x9')](_0x3b89('0xc'),auth[_0x3b89('0xd')](),controller[_0x3b89('0xe')]);router[_0x3b89('0xf')]('/',auth[_0x3b89('0xd')](),controller[_0x3b89('0x10')]);router[_0x3b89('0x11')](_0x3b89('0xc'),auth[_0x3b89('0xd')](),controller[_0x3b89('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6935=['../../components/auth/service','get','isAuthenticated','index','describe','/:id','show','post','create','put','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x6935,0xca));var _0x5693=function(_0x360b64,_0x242c5e){_0x360b64=_0x360b64-0x0;var _0x23907=_0x6935[_0x360b64];return _0x23907;};'use strict';var multer=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var path=require(_0x5693('0x2'));var timeout=require(_0x5693('0x3'));var express=require('express');var router=express[_0x5693('0x4')]();var fs_extra=require(_0x5693('0x5'));var auth=require(_0x5693('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x5693('0x7')]('/',auth[_0x5693('0x8')](),controller[_0x5693('0x9')]);router[_0x5693('0x7')]('/describe',auth[_0x5693('0x8')](),controller[_0x5693('0xa')]);router['get'](_0x5693('0xb'),auth[_0x5693('0x8')](),controller[_0x5693('0xc')]);router[_0x5693('0xd')]('/',auth[_0x5693('0x8')](),controller[_0x5693('0xe')]);router[_0x5693('0xf')]('/:id',auth[_0x5693('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index d69d78e..e2b38e4 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 _0xad36=['STRING','name','exports'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xad36,0x11c));var _0x6ad3=function(_0x263163,_0x347d2a){_0x263163=_0x263163-0x0;var _0xd7362=_0xad36[_0x263163];return _0xd7362;};'use strict';var Sequelize=require('sequelize');module[_0x6ad3('0x0')]={'name':{'type':Sequelize[_0x6ad3('0x1')],'unique':_0x6ad3('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6ad3('0x1')]},'dialPrefix':{'type':Sequelize[_0x6ad3('0x1')]}}; \ No newline at end of file +var _0xafa5=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafa5,0x1af));var _0x5afa=function(_0x520fe9,_0x5e3bc3){_0x520fe9=_0x520fe9-0x0;var _0x24e5c8=_0xafa5[_0x520fe9];return _0x24e5c8;};'use strict';var Sequelize=require('sequelize');module[_0x5afa('0x0')]={'name':{'type':Sequelize[_0x5afa('0x1')],'unique':_0x5afa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5afa('0x1')]},'dialPrefix':{'type':Sequelize[_0x5afa('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 25e22d9..2710f26 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 _0x943a=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Lists','UserProfileResource','destroy','end','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','user'];(function(_0x457074,_0x413013){var _0x3dfdf3=function(_0x2dde0b){while(--_0x2dde0b){_0x457074['push'](_0x457074['shift']());}};_0x3dfdf3(++_0x413013);}(_0x943a,0xfc));var _0xa943=function(_0x1529d2,_0x6d4256){_0x1529d2=_0x1529d2-0x0;var _0x3fe05f=_0x943a[_0x1529d2];return _0x3fe05f;};'use strict';var emlformat=require(_0xa943('0x0'));var rimraf=require(_0xa943('0x1'));var zipdir=require(_0xa943('0x2'));var jsonpatch=require(_0xa943('0x3'));var rp=require(_0xa943('0x4'));var moment=require('moment');var BPromise=require(_0xa943('0x5'));var Mustache=require(_0xa943('0x6'));var util=require(_0xa943('0x7'));var path=require('path');var sox=require(_0xa943('0x8'));var csv=require(_0xa943('0x9'));var ejs=require(_0xa943('0xa'));var fs=require('fs');var fs_extra=require(_0xa943('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa943('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa943('0x9'));var querystring=require(_0xa943('0xd'));var Papa=require(_0xa943('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa943('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa943('0x10'));var logger=require(_0xa943('0x11'))(_0xa943('0x12'));var utils=require(_0xa943('0x13'));var config=require(_0xa943('0x14'));var licenseUtil=require(_0xa943('0x15'));var db=require(_0xa943('0x16'))['db'];var csv_results;config[_0xa943('0x17')]=_['defaults'](config[_0xa943('0x17')],{'host':_0xa943('0x18'),'port':0x18eb});var socket=require(_0xa943('0x19'))(new Redis(config[_0xa943('0x17')]));require(_0xa943('0x1a'))[_0xa943('0x1b')](socket);function respondWithStatusCode(_0x3c83db,_0x319589){_0x319589=_0x319589||0xcc;return function(_0x5ab69f){if(_0x5ab69f){return _0x3c83db[_0xa943('0x1c')](_0x319589);}return _0x3c83db['status'](_0x319589)['end']();};}function respondWithResult(_0x1800db,_0x4b96ce){_0x4b96ce=_0x4b96ce||0xc8;return function(_0x2f27b1){if(_0x2f27b1){return _0x1800db[_0xa943('0x1d')](_0x4b96ce)[_0xa943('0x1e')](_0x2f27b1);}};}function respondWithFilteredResult(_0x541c43,_0xf157fc){return function(_0x3a692c){if(_0x3a692c){var _0x3606fc=typeof _0xf157fc[_0xa943('0x1f')]===_0xa943('0x20')&&typeof _0xf157fc[_0xa943('0x21')]==='undefined';var _0x5b6328=_0x3a692c[_0xa943('0x22')];var _0x2448e1=_0x3606fc?0x0:_0xf157fc[_0xa943('0x1f')];var _0x479611=_0x3606fc?_0x3a692c[_0xa943('0x22')]:_0xf157fc[_0xa943('0x1f')]+_0xf157fc[_0xa943('0x21')];var _0x2d9263;if(_0x479611>=_0x5b6328){_0x479611=_0x5b6328;_0x2d9263=0xc8;}else{_0x2d9263=0xce;}_0x541c43[_0xa943('0x1d')](_0x2d9263);return _0x541c43[_0xa943('0x23')](_0xa943('0x24'),_0x2448e1+'-'+_0x479611+'/'+_0x5b6328)[_0xa943('0x1e')](_0x3a692c);}return null;};}function patchUpdates(_0x18c89a){return function(_0x175bb2){try{jsonpatch[_0xa943('0x25')](_0x175bb2,_0x18c89a,!![]);}catch(_0x32bb45){return BPromise[_0xa943('0x26')](_0x32bb45);}return _0x175bb2['save']();};}function saveUpdates(_0x25aa98,_0x18ed15){return function(_0x52bb72){if(_0x52bb72){return _0x52bb72[_0xa943('0x27')](_0x25aa98)[_0xa943('0x28')](function(_0x3e8dbb){return _0x3e8dbb;});}return null;};}function removeEntity(_0x235980,_0x4beb1a){return function(_0x422d1b){if(_0x422d1b){return _0x422d1b['destroy']()['then'](function(){var _0x1382c0=_0x422d1b[_0xa943('0x29')]({'plain':!![]});var _0x381cda=_0xa943('0x2a');return db[_0xa943('0x2b')][_0xa943('0x2c')]({'where':{'type':_0x381cda,'resourceId':_0x1382c0['id']}})['then'](function(){return _0x422d1b;});})[_0xa943('0x28')](function(){_0x235980[_0xa943('0x1d')](0xcc)[_0xa943('0x2d')]();});}};}function handleEntityNotFound(_0x19d060,_0x3f1d7f){return function(_0x124d72){if(!_0x124d72){_0x19d060[_0xa943('0x1c')](0x194);}return _0x124d72;};}function handleError(_0x48471b,_0x2050b2){_0x2050b2=_0x2050b2||0x1f4;return function(_0x213648){logger['error'](_0x213648[_0xa943('0x2e')]);if(_0x213648[_0xa943('0x2f')]){delete _0x213648[_0xa943('0x2f')];}_0x48471b[_0xa943('0x1d')](_0x2050b2)[_0xa943('0x30')](_0x213648);};}exports[_0xa943('0x31')]=function(_0x25c26d,_0x29d4c5){var _0x340c95={},_0x1db527={},_0x4a102={'count':0x0,'rows':[]};var _0x2f2982=_['map'](db[_0xa943('0x32')][_0xa943('0x33')],function(_0x3c85e5){return{'name':_0x3c85e5[_0xa943('0x34')],'type':_0x3c85e5[_0xa943('0x35')][_0xa943('0x36')]};});_0x1db527['model']=_[_0xa943('0x37')](_0x2f2982,'name');_0x1db527[_0xa943('0x38')]=_['keys'](_0x25c26d[_0xa943('0x38')]);_0x1db527[_0xa943('0x39')]=_[_0xa943('0x3a')](_0x1db527[_0xa943('0x3b')],_0x1db527[_0xa943('0x38')]);_0x340c95[_0xa943('0x3c')]=_[_0xa943('0x3a')](_0x1db527[_0xa943('0x3b')],qs['fields'](_0x25c26d[_0xa943('0x38')][_0xa943('0x3d')]));_0x340c95[_0xa943('0x3c')]=_0x340c95['attributes'][_0xa943('0x3e')]?_0x340c95[_0xa943('0x3c')]:_0x1db527[_0xa943('0x3b')];if(!_0x25c26d[_0xa943('0x38')][_0xa943('0x3f')](_0xa943('0x40'))){_0x340c95[_0xa943('0x21')]=qs[_0xa943('0x21')](_0x25c26d[_0xa943('0x38')][_0xa943('0x21')]);_0x340c95[_0xa943('0x1f')]=qs[_0xa943('0x1f')](_0x25c26d[_0xa943('0x38')]['offset']);}_0x340c95['order']=qs[_0xa943('0x41')](_0x25c26d['query'][_0xa943('0x41')]);_0x340c95[_0xa943('0x42')]=qs[_0xa943('0x39')](_[_0xa943('0x43')](_0x25c26d[_0xa943('0x38')],_0x1db527[_0xa943('0x39')]),_0x2f2982);if(_0x25c26d[_0xa943('0x38')]['filter']){_0x340c95[_0xa943('0x42')]=_[_0xa943('0x44')](_0x340c95[_0xa943('0x42')],{'$or':_[_0xa943('0x37')](_0x2f2982,function(_0x1e0756){if(_0x1e0756[_0xa943('0x35')]!==_0xa943('0x45')){var _0x3360dd={};_0x3360dd[_0x1e0756['name']]={'$like':'%'+_0x25c26d[_0xa943('0x38')][_0xa943('0x46')]+'%'};return _0x3360dd;}})});}_0x340c95=_[_0xa943('0x44')]({},_0x340c95,_0x25c26d[_0xa943('0x47')]);var _0x5a0c00={'where':_0x340c95[_0xa943('0x42')]};return db[_0xa943('0x32')][_0xa943('0x22')](_0x5a0c00)[_0xa943('0x28')](function(_0x407c96){_0x4a102[_0xa943('0x22')]=_0x407c96;if(_0x25c26d[_0xa943('0x38')][_0xa943('0x48')]){_0x340c95[_0xa943('0x49')]=[{'all':!![]}];}return db[_0xa943('0x32')][_0xa943('0x4a')](_0x340c95);})[_0xa943('0x28')](function(_0x30f11d){_0x4a102[_0xa943('0x4b')]=_0x30f11d;return _0x4a102;})['then'](respondWithFilteredResult(_0x29d4c5,_0x340c95))[_0xa943('0x4c')](handleError(_0x29d4c5,null));};exports[_0xa943('0x4d')]=function(_0x179a56,_0xd8cabc){var _0x76faba={'raw':![],'where':{'id':_0x179a56['params']['id']}},_0x29ac38={};_0x29ac38[_0xa943('0x3b')]=_[_0xa943('0x4e')](db[_0xa943('0x32')]['rawAttributes']);_0x29ac38[_0xa943('0x38')]=_['keys'](_0x179a56[_0xa943('0x38')]);_0x29ac38[_0xa943('0x39')]=_[_0xa943('0x3a')](_0x29ac38[_0xa943('0x3b')],_0x29ac38[_0xa943('0x38')]);_0x76faba[_0xa943('0x3c')]=_[_0xa943('0x3a')](_0x29ac38['model'],qs['fields'](_0x179a56[_0xa943('0x38')][_0xa943('0x3d')]));_0x76faba['attributes']=_0x76faba[_0xa943('0x3c')][_0xa943('0x3e')]?_0x76faba[_0xa943('0x3c')]:_0x29ac38[_0xa943('0x3b')];if(_0x179a56[_0xa943('0x38')][_0xa943('0x48')]){_0x76faba[_0xa943('0x49')]=[{'all':!![]}];}_0x76faba=_['merge']({},_0x76faba,_0x179a56[_0xa943('0x47')]);return db[_0xa943('0x32')][_0xa943('0x4f')](_0x76faba)[_0xa943('0x28')](handleEntityNotFound(_0xd8cabc,null))['then'](respondWithResult(_0xd8cabc,null))[_0xa943('0x4c')](handleError(_0xd8cabc,null));};exports[_0xa943('0x50')]=function(_0x145040,_0x146a3e){return db['CmList']['create'](_0x145040['body'],{})['then'](function(_0x5ed055){var _0x324313=_0x145040[_0xa943('0x51')]['get']({'plain':!![]});if(!_0x324313)throw new Error(_0xa943('0x52'));if(_0x324313[_0xa943('0x53')]===_0xa943('0x51')){var _0x160e85=_0x5ed055['get']({'plain':!![]});var _0x3afa1c=_0xa943('0x2a');return db[_0xa943('0x54')]['find']({'where':{'name':_0x3afa1c,'userProfileId':_0x324313['userProfileId']},'raw':!![]})['then'](function(_0x129c51){if(_0x129c51&&_0x129c51[_0xa943('0x55')]===0x0){return db[_0xa943('0x2b')]['create']({'name':_0x160e85[_0xa943('0x2f')],'resourceId':_0x160e85['id'],'type':_0x129c51[_0xa943('0x2f')],'sectionId':_0x129c51['id']},{})[_0xa943('0x28')](function(){return _0x5ed055;});}else{return _0x5ed055;}})[_0xa943('0x4c')](function(_0xfca38d){logger[_0xa943('0x56')](_0xa943('0x57'),_0xfca38d);throw _0xfca38d;});}return _0x5ed055;})[_0xa943('0x28')](respondWithResult(_0x146a3e,0xc9))[_0xa943('0x4c')](handleError(_0x146a3e,null));};exports[_0xa943('0x27')]=function(_0x5b66c3,_0x120d8e){if(_0x5b66c3[_0xa943('0x58')]['id']){delete _0x5b66c3['body']['id'];}return db[_0xa943('0x32')]['find']({'where':{'id':_0x5b66c3[_0xa943('0x59')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x120d8e,null))[_0xa943('0x28')](saveUpdates(_0x5b66c3['body'],null))['then'](respondWithResult(_0x120d8e,null))[_0xa943('0x4c')](handleError(_0x120d8e,null));};exports[_0xa943('0x2c')]=function(_0xadab0a,_0x5a2119){return db['CmList'][_0xa943('0x4f')]({'where':{'id':_0xadab0a[_0xa943('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a2119,null))[_0xa943('0x28')](removeEntity(_0x5a2119,null))[_0xa943('0x4c')](handleError(_0x5a2119,null));};exports[_0xa943('0x5a')]=function(_0x20c557,_0x2deb6e){return db[_0xa943('0x32')][_0xa943('0x5a')]()[_0xa943('0x28')](respondWithResult(_0x2deb6e,null))[_0xa943('0x4c')](handleError(_0x2deb6e,null));};exports[_0xa943('0x5b')]=function(_0x302a93,_0x1c9780,_0x184a69){if(_0x302a93[_0xa943('0x58')]['id']){delete _0x302a93['body']['id'];}return db['CmList'][_0xa943('0x4f')]({'where':{'id':_0x302a93[_0xa943('0x59')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x1c9780,null))[_0xa943('0x28')](function(_0x5d36e8){if(_0x5d36e8){_0x302a93[_0xa943('0x58')][_0xa943('0x5c')]=_0x5d36e8['id'];return db[_0xa943('0x5d')][_0xa943('0x50')](_0x302a93['body']);}})[_0xa943('0x28')](respondWithResult(_0x1c9780,null))[_0xa943('0x4c')](handleError(_0x1c9780,null));};exports[_0xa943('0x5e')]=function(_0x2581ee,_0x4981d5,_0x5d403b){var _0x38b9b5={'raw':![],'where':{}};var _0x4af26e={};var _0x553964={'count':0x0,'rows':[]};return db[_0xa943('0x32')][_0xa943('0x5f')]({'where':{'id':_0x2581ee[_0xa943('0x59')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x4981d5,null))['then'](function(_0x1f30f8){if(_0x1f30f8){_0x4af26e['model']=_['keys'](db[_0xa943('0x5d')]['rawAttributes']);_0x4af26e[_0xa943('0x38')]=_[_0xa943('0x4e')](_0x2581ee[_0xa943('0x38')]);_0x4af26e[_0xa943('0x39')]=_[_0xa943('0x3a')](_0x4af26e[_0xa943('0x3b')],_0x4af26e['query']);_0x38b9b5['attributes']=_[_0xa943('0x3a')](_0x4af26e['model'],qs[_0xa943('0x3d')](_0x2581ee[_0xa943('0x38')]['fields']));_0x38b9b5[_0xa943('0x3c')]=_0x38b9b5[_0xa943('0x3c')]['length']?_0x38b9b5['attributes']:_0x4af26e[_0xa943('0x3b')];if(!_0x2581ee[_0xa943('0x38')][_0xa943('0x3f')](_0xa943('0x40'))){_0x38b9b5['limit']=qs['limit'](_0x2581ee[_0xa943('0x38')][_0xa943('0x21')]);_0x38b9b5[_0xa943('0x1f')]=qs[_0xa943('0x1f')](_0x2581ee[_0xa943('0x38')][_0xa943('0x1f')]);}_0x38b9b5[_0xa943('0x60')]=qs['sort'](_0x2581ee[_0xa943('0x38')][_0xa943('0x41')]);_0x38b9b5['where']=qs[_0xa943('0x39')](_[_0xa943('0x43')](_0x2581ee['query'],_0x4af26e[_0xa943('0x39')]));_0x38b9b5['where']['ListId']=_0x1f30f8['id'];if(_0x2581ee['query']['filter']){_0x38b9b5[_0xa943('0x42')]=_[_0xa943('0x44')](_0x38b9b5[_0xa943('0x42')],{'$or':_[_0xa943('0x37')](_0x38b9b5['attributes'],function(_0x1ec363){var _0x1add44={};_0x1add44[_0x1ec363]={'$like':'%'+_0x2581ee[_0xa943('0x38')][_0xa943('0x46')]+'%'};return _0x1add44;})});}_0x38b9b5=_[_0xa943('0x44')]({},_0x38b9b5,_0x2581ee[_0xa943('0x47')]);return db[_0xa943('0x5d')]['count']({'where':_0x38b9b5[_0xa943('0x42')]})['then'](function(_0xa9ff89){_0x553964[_0xa943('0x22')]=_0xa9ff89;if(_0x2581ee[_0xa943('0x38')][_0xa943('0x48')]){_0x38b9b5[_0xa943('0x49')]=[{'all':!![]}];}return db[_0xa943('0x5d')][_0xa943('0x4a')](_0x38b9b5);})['then'](function(_0x4c0d8a){_0x553964[_0xa943('0x4b')]=_0x4c0d8a;return _0x553964;});}})[_0xa943('0x28')](respondWithFilteredResult(_0x4981d5,_0x38b9b5))[_0xa943('0x4c')](handleError(_0x4981d5,null));};exports[_0xa943('0x61')]=function(_0x2dd95e,_0x40dcd7,_0x473d66){return db[_0xa943('0x32')][_0xa943('0x4f')]({'where':{'id':_0x2dd95e[_0xa943('0x59')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x40dcd7,null))[_0xa943('0x28')](function(_0x17f05a){if(_0x17f05a){return _0x17f05a[_0xa943('0x61')](_0x2dd95e[_0xa943('0x38')][_0xa943('0x62')]);}})[_0xa943('0x28')](respondWithStatusCode(_0x40dcd7,null))[_0xa943('0x4c')](handleError(_0x40dcd7,null));};exports[_0xa943('0x63')]=function(_0x349492,_0x4fa24c,_0x2bdf6f){return db['CmList'][_0xa943('0x4f')]({'where':{'id':_0x349492[_0xa943('0x59')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x4fa24c,null))[_0xa943('0x28')](function(_0x351fc0){if(_0x351fc0){var _0x34f32d=[];var _0x433c37={'success':[],'errors':[]};return db[_0xa943('0x64')][_0xa943('0x5a')]()[_0xa943('0x28')](function(_0x83de49){if(_0x349492['body']['tags']&&_['isArray'](_0x349492[_0xa943('0x58')][_0xa943('0x65')])){if(_0x349492['body'][_0xa943('0x65')][_0xa943('0x3e')]){_0x349492[_0xa943('0x58')][_0xa943('0x65')]=_0x349492[_0xa943('0x58')][_0xa943('0x65')]['join'](';')+';';}else{_0x349492[_0xa943('0x58')]['tags']=null;}}else{_0x349492[_0xa943('0x58')][_0xa943('0x65')]=null;}if(_0x349492[_0xa943('0x58')]&&_[_0xa943('0x66')](_0x349492[_0xa943('0x58')])){for(var _0x47b1c1=0x0;_0x47b1c1<_0x349492['body'][_0xa943('0x3e')];_0x47b1c1+=0x1){_0x349492[_0xa943('0x58')][_0x47b1c1][_0xa943('0x5c')]=_0x349492[_0xa943('0x59')]['id'];_0x34f32d[_0xa943('0x67')](_0x349492[_0xa943('0x58')][_0x47b1c1]);}return BPromise[_0xa943('0x68')](_0x34f32d,function(_0x2c1406){return db['CmContact'][_0xa943('0x50')](_[_0xa943('0x69')](_0x2c1406,[_0xa943('0x62'),'id'])||{},{'fields':_[_0xa943('0x4e')](_0x83de49),'raw':!![]})[_0xa943('0x28')](function(_0x48f06f){_0x433c37['success'][_0xa943('0x67')](_0x48f06f[_0xa943('0x6a')]);})['catch'](function(_0x3142c6){_0x433c37[_0xa943('0x6b')][_0xa943('0x67')]({'data':_0x2c1406,'error':_0x3142c6[_0xa943('0x6c')]});});})['then'](function(_0x505d36){return _0x433c37;})[_0xa943('0x4c')](function(_0x2bcb96){return _0x2bcb96;});}else{_0x4fa24c[_0xa943('0x1d')](0x190)[_0xa943('0x1e')]({'message':_0xa943('0x6d')});}});}})['then'](respondWithResult(_0x4fa24c,null))[_0xa943('0x4c')](handleError(_0x4fa24c,null));};exports[_0xa943('0x6e')]=function(_0x1d3295,_0x251914,_0x4b86b5){var _0xbe5871;return db['CmList']['find']({'where':{'id':_0x1d3295[_0xa943('0x59')]['id']},'include':[{'model':db[_0xa943('0x6f')],'as':_0xa943('0x70')}]})[_0xa943('0x28')](handleEntityNotFound(_0x251914,null))[_0xa943('0x28')](function(_0x28ed74){if(_0x28ed74){_0xbe5871=_0x28ed74;return db[_0xa943('0x64')]['rawAttributes'];}})[_0xa943('0x28')](function(_0x49341f){if(_0x49341f){var _0x1ad443={};var _0x29d53e={};_0x29d53e[_0xa943('0x3b')]=_['concat'](_[_0xa943('0x4e')](_0x49341f),_[_0xa943('0x37')](_0xbe5871[_0xa943('0x70')],function(_0x4a9f0a){return util['format'](_0xa943('0x71'),_0x4a9f0a['id']);}));_0x29d53e[_0xa943('0x38')]=_[_0xa943('0x4e')](_0x1d3295[_0xa943('0x38')]);_0x29d53e[_0xa943('0x39')]=_[_0xa943('0x3a')](_0x29d53e['model'],_0x29d53e[_0xa943('0x38')]);_0x1ad443['attributes']=_[_0xa943('0x3a')](_0x29d53e[_0xa943('0x3b')],qs[_0xa943('0x3d')](_0x1d3295[_0xa943('0x38')][_0xa943('0x3d')]));_0x1ad443[_0xa943('0x3c')]=_0x1ad443[_0xa943('0x3c')][_0xa943('0x3e')]?_0x1ad443[_0xa943('0x3c')]:_0x29d53e['model'];if(!_0x1d3295[_0xa943('0x38')]['hasOwnProperty']('nolimit')){_0x1ad443[_0xa943('0x21')]=qs[_0xa943('0x21')](_0x1d3295[_0xa943('0x38')][_0xa943('0x21')]);_0x1ad443[_0xa943('0x1f')]=qs[_0xa943('0x1f')](_0x1d3295[_0xa943('0x38')][_0xa943('0x1f')]);}_0x1ad443[_0xa943('0x60')]=qs[_0xa943('0x41')](_0x1d3295[_0xa943('0x38')][_0xa943('0x41')]);_0x1ad443[_0xa943('0x42')]=qs['filters'](_[_0xa943('0x43')](_0x1d3295[_0xa943('0x38')],_0x29d53e[_0xa943('0x39')]));_0x1ad443[_0xa943('0x72')]=!![];if(_0x1d3295[_0xa943('0x38')][_0xa943('0x46')]){_0x1ad443[_0xa943('0x42')]=_[_0xa943('0x44')](_0x1ad443[_0xa943('0x42')],{'$or':_['map'](_0x1ad443[_0xa943('0x3c')],function(_0x24b05f){var _0x20466d={};_0x20466d[_0x24b05f]={'$like':'%'+_0x1d3295[_0xa943('0x38')][_0xa943('0x46')]+'%'};return _0x20466d;})});}_0x1ad443=_[_0xa943('0x44')]({},_0x1ad443,_0x1d3295[_0xa943('0x47')]);return _0xbe5871[_0xa943('0x6e')](_0x1ad443);}})[_0xa943('0x28')](respondWithResult(_0x251914,null))[_0xa943('0x4c')](handleError(_0x251914,null));};exports[_0xa943('0x73')]=function(_0x57787e,_0x5bda0d,_0xe51400){var _0x525b21;var _0x1a39c8;var _0x5b264a;var _0x2b8356=_0x57787e['params']['id'];csv_results=[];return db[_0xa943('0x74')][_0xa943('0x4a')]({'attributes':['id','name'],'raw':!![],'order':[_0xa943('0x75')]})[_0xa943('0x28')](function(_0x387d35){_0x525b21=_0x387d35;var _0x4c6b97=_[_0xa943('0x4e')](db['CmContact'][_0xa943('0x33')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0xa943('0x76')]})[_0xa943('0x28')](function(_0x59cb16){_0x1a39c8=_0x59cb16;var _0x52a347=squel[_0xa943('0x77')]()[_0xa943('0x3d')](_0x4c6b97)['from'](_0xa943('0x78'),'c')['where'](_0xa943('0x79'),_0x2b8356)[_0xa943('0x42')](_0xa943('0x7a'))[_0xa943('0x7b')]();for(var _0x28b90c=0x0;_0x28b90c<_0x1a39c8[_0xa943('0x3e')];_0x28b90c++){_0x52a347[_0xa943('0x7c')]('c.cf_'+_0x1a39c8[_0x28b90c]['id'],_0xa943('0x7d')+_0x1a39c8[_0x28b90c][_0xa943('0x76')]);}for(var _0x28b90c=0x0;_0x28b90c<_0x525b21[_0xa943('0x3e')];_0x28b90c++){_0x52a347[_0xa943('0x7c')](squel['select']()[_0xa943('0x7c')](_0xa943('0x7e'))[_0xa943('0x7f')](_0xa943('0x80'))[_0xa943('0x42')](_0xa943('0x81'),_0x525b21[_0x28b90c]['id'])[_0xa943('0x42')](_0xa943('0x82')),_0xa943('0x83')+_0x525b21[_0x28b90c]['name']);_0x52a347[_0xa943('0x7c')](squel[_0xa943('0x77')]()[_0xa943('0x7c')](_0xa943('0x84'))[_0xa943('0x7f')](_0xa943('0x80'))[_0xa943('0x42')](_0xa943('0x81'),_0x525b21[_0x28b90c]['id'])[_0xa943('0x42')]('CmContactId\x20=\x20c.id'),_0xa943('0x85')+_0x525b21[_0x28b90c]['name']);}var _0x8bc887=[];_0x8bc887[_0xa943('0x67')](_0x52a347['toString']());BPromise['each'](_0x8bc887,handleQuery)[_0xa943('0x28')](function(_0x366ed6){handleQuery(_0x52a347[_0xa943('0x86')]());var _0x34dcd4=csv_results[0x0];if(!_[_0xa943('0x87')](_0x34dcd4)){var _0x9af1b6=toCsv(_0x34dcd4);var _0x370c12=Date[_0xa943('0x88')]();fs[_0xa943('0x89')](util[_0xa943('0x8a')](_0xa943('0x8b'),_0x2b8356,_0x370c12),_0x9af1b6);_0x5bda0d['setHeader'](_0xa943('0x8c'),_0xa943('0x8d')+util[_0xa943('0x8a')](_0xa943('0x8e'),_0x2b8356,_0x370c12));_0x5bda0d['setHeader'](_0xa943('0x8f'),_0xa943('0x90'));return _0x5bda0d['download'](util[_0xa943('0x8a')](_0xa943('0x8b'),_0x2b8356,_0x370c12));}else{return _0x5bda0d['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x29b33b,_0x3193df,_0x2299b0){var _0x2f4463;delete _0x29b33b[_0xa943('0x58')]['id'];return db[_0xa943('0x32')][_0xa943('0x5f')]({'where':{'id':_0x29b33b[_0xa943('0x59')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x3193df,null))[_0xa943('0x28')](function(_0x107ba4){if(_0x107ba4){return db[_0xa943('0x91')][_0xa943('0x92')](function(_0x31c25e){return db[_0xa943('0x6f')]['create'](_0x29b33b['body'],{'transaction':_0x31c25e})[_0xa943('0x28')](function(_0x84ac02){_0x2f4463=_0x84ac02;return _0x107ba4[_0xa943('0x93')](_0x84ac02,{'transaction':_0x31c25e});})[_0xa943('0x28')](function(){var _0x227ae6={'type':db[_0xa943('0x94')][_0xa943('0x95')],'transaction':_0x31c25e};switch(_0x29b33b[_0xa943('0x58')][_0xa943('0x35')]){case _0xa943('0x96'):_0x227ae6[_0xa943('0x35')]=db[_0xa943('0x94')][_0xa943('0x95')];break;case _0xa943('0x97'):_0x227ae6[_0xa943('0x35')]=db['Sequelize'][_0xa943('0x98')];break;case _0xa943('0x99'):_0x227ae6['type']=db['Sequelize'][_0xa943('0x9a')];_0x227ae6[_0xa943('0x9b')]=![];break;default:}return db[_0xa943('0x91')][_0xa943('0x9c')][_0xa943('0x9d')](_0xa943('0x78'),util[_0xa943('0x8a')](_0xa943('0x9e'),_0x2f4463['id']),_0x227ae6);})['then'](function(){return _0x2f4463;});});}})[_0xa943('0x28')](respondWithResult(_0x3193df,null))['catch'](handleError(_0x3193df,null));};exports['getCustomFields']=function(_0x73f314,_0x969513,_0x5df0a3){var _0x27082f={};var _0x4a3460={};var _0x4ea2b3;var _0x1f73c4;return db[_0xa943('0x32')][_0xa943('0x5f')]({'where':{'id':_0x73f314[_0xa943('0x59')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x969513,null))['then'](function(_0x578e3d){if(_0x578e3d){_0x4ea2b3=_0x578e3d;_0x4a3460['model']=_['keys'](db[_0xa943('0x6f')][_0xa943('0x33')]);_0x4a3460[_0xa943('0x38')]=_[_0xa943('0x4e')](_0x73f314['query']);_0x4a3460[_0xa943('0x39')]=_['intersection'](_0x4a3460[_0xa943('0x3b')],_0x4a3460[_0xa943('0x38')]);_0x27082f[_0xa943('0x3c')]=_['intersection'](_0x4a3460[_0xa943('0x3b')],qs['fields'](_0x73f314[_0xa943('0x38')]['fields']));_0x27082f[_0xa943('0x3c')]=_0x27082f['attributes'][_0xa943('0x3e')]?_0x27082f[_0xa943('0x3c')]:_0x4a3460[_0xa943('0x3b')];_0x27082f['order']=qs[_0xa943('0x41')](_0x73f314['query'][_0xa943('0x41')]);_0x27082f['where']=qs[_0xa943('0x39')](_[_0xa943('0x43')](_0x73f314[_0xa943('0x38')],_0x4a3460[_0xa943('0x39')]));_0x27082f[_0xa943('0x42')]=_[_0xa943('0x44')](_0x27082f[_0xa943('0x42')],{'$or':[{'ListId':_0x578e3d['id']},{'ListId':null}]});if(_0x73f314[_0xa943('0x38')][_0xa943('0x46')]){_0x27082f[_0xa943('0x42')]=_[_0xa943('0x44')](_0x27082f[_0xa943('0x42')],{'$or':_[_0xa943('0x37')](_0x27082f['attributes'],function(_0x449b29){var _0x3564d5={};_0x3564d5[_0x449b29]={'$like':'%'+_0x73f314[_0xa943('0x38')][_0xa943('0x46')]+'%'};return _0x3564d5;})});}_0x27082f=_[_0xa943('0x44')]({},_0x27082f,_0x73f314[_0xa943('0x47')]);return db['CmCustomField'][_0xa943('0x9f')](_0x27082f);}})[_0xa943('0x28')](respondWithResult(_0x969513,null))['catch'](handleError(_0x969513,null));};exports['getGlobalCustomFields']=function(_0x5064cc,_0x3a32b1){return db[_0xa943('0x6f')][_0xa943('0x9f')]({'where':{'ListId':null}})[_0xa943('0x28')](handleEntityNotFound(_0x3a32b1,null))[_0xa943('0x28')](function(_0x50f6fa){return _0x50f6fa;})[_0xa943('0x28')](respondWithResult(_0x3a32b1,null))[_0xa943('0x4c')](handleError(_0x3a32b1,null));};exports[_0xa943('0xa0')]=function(_0x54a8d9,_0xcfbc47,_0x193c72){return db[_0xa943('0x32')][_0xa943('0x4f')]({'where':{'id':_0x54a8d9['params']['id']}})[_0xa943('0x28')](handleEntityNotFound(_0xcfbc47,null))['then'](function(_0x1fea41){if(_0x1fea41){return _0x1fea41['addAgents'](_0x54a8d9[_0xa943('0x58')][_0xa943('0x62')],_[_0xa943('0x69')](_0x54a8d9[_0xa943('0x58')],[_0xa943('0x62'),'id'])||{})[_0xa943('0xa1')](function(_0x4d9b4f){for(var _0x430151=0x0;_0x430151<_0x54a8d9[_0xa943('0x58')][_0xa943('0x62')][_0xa943('0x3e')];_0x430151+=0x1){socket[_0xa943('0xa2')](_0xa943('0xa3'),{'UserId':Number(_0x54a8d9['body'][_0xa943('0x62')][_0x430151]),'CmListId':Number(_0x54a8d9[_0xa943('0x59')]['id'])});}return _0x4d9b4f;});}})[_0xa943('0x28')](respondWithResult(_0xcfbc47,null))[_0xa943('0x4c')](handleError(_0xcfbc47,null));};exports[_0xa943('0xa4')]=function(_0x3378ab,_0x3f5a07,_0x19083b){return db[_0xa943('0x32')]['find']({'where':{'id':_0x3378ab['params']['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x3f5a07,null))['then'](function(_0x3ec2ae){if(_0x3ec2ae){return _0x3ec2ae['removeAgents'](_0x3378ab['query'][_0xa943('0x62')])[_0xa943('0x28')](function(){if(_['isArray'](_0x3378ab[_0xa943('0x38')]['ids'])){for(var _0x3a479b=0x0;_0x3a479b<_0x3378ab[_0xa943('0x38')][_0xa943('0x62')][_0xa943('0x3e')];_0x3a479b+=0x1){socket[_0xa943('0xa2')](_0xa943('0xa5'),{'UserId':Number(_0x3378ab[_0xa943('0x38')][_0xa943('0x62')][_0x3a479b]),'CmListId':Number(_0x3378ab['params']['id'])});}}else{socket[_0xa943('0xa2')]('userCmList:remove',{'UserId':Number(_0x3378ab[_0xa943('0x38')][_0xa943('0x62')]),'CmListId':Number(_0x3378ab[_0xa943('0x59')]['id'])});}});}})[_0xa943('0x28')](respondWithStatusCode(_0x3f5a07,null))[_0xa943('0x4c')](handleError(_0x3f5a07,null));};exports['getAgents']=function(_0x107f57,_0x1aba4e,_0x578281){var _0x5f5079={};var _0x298b96={};var _0x2b9043;var _0x525445;return db[_0xa943('0x32')][_0xa943('0x5f')]({'where':{'id':_0x107f57[_0xa943('0x59')]['id']}})['then'](handleEntityNotFound(_0x1aba4e,null))[_0xa943('0x28')](function(_0x15dd52){if(_0x15dd52){_0x2b9043=_0x15dd52;_0x298b96[_0xa943('0x3b')]=_[_0xa943('0x4e')](db['User'][_0xa943('0x33')]);_0x298b96[_0xa943('0x38')]=_[_0xa943('0x4e')](_0x107f57[_0xa943('0x38')]);_0x298b96[_0xa943('0x39')]=_[_0xa943('0x3a')](_0x298b96['model'],_0x298b96[_0xa943('0x38')]);_0x5f5079[_0xa943('0x3c')]=_[_0xa943('0x3a')](_0x298b96[_0xa943('0x3b')],qs[_0xa943('0x3d')](_0x107f57[_0xa943('0x38')][_0xa943('0x3d')]));_0x5f5079['attributes']=_0x5f5079[_0xa943('0x3c')]['length']?_0x5f5079['attributes']:_0x298b96[_0xa943('0x3b')];_0x5f5079['order']=qs[_0xa943('0x41')](_0x107f57[_0xa943('0x38')][_0xa943('0x41')]);_0x5f5079['where']=qs[_0xa943('0x39')](_[_0xa943('0x43')](_0x107f57[_0xa943('0x38')],_0x298b96[_0xa943('0x39')]));if(_0x107f57[_0xa943('0x38')][_0xa943('0x46')]){_0x5f5079[_0xa943('0x42')]=_[_0xa943('0x44')](_0x5f5079[_0xa943('0x42')],{'$or':_['map'](_0x5f5079['attributes'],function(_0x2dc0a5){var _0x202630={};_0x202630[_0x2dc0a5]={'$like':'%'+_0x107f57[_0xa943('0x38')]['filter']+'%'};return _0x202630;})});}_0x5f5079=_[_0xa943('0x44')]({},_0x5f5079,_0x107f57['options']);return _0x2b9043[_0xa943('0xa6')](_0x5f5079);}})[_0xa943('0x28')](function(_0x51b7e5){if(_0x51b7e5){_0x525445=_0x51b7e5[_0xa943('0x3e')];if(!_0x107f57['query']['hasOwnProperty'](_0xa943('0x40'))){_0x5f5079[_0xa943('0x21')]=qs[_0xa943('0x21')](_0x107f57[_0xa943('0x38')][_0xa943('0x21')]);_0x5f5079['offset']=qs[_0xa943('0x1f')](_0x107f57[_0xa943('0x38')][_0xa943('0x1f')]);}return _0x2b9043['getAgents'](_0x5f5079);}})[_0xa943('0x28')](function(_0xea1fec){if(_0xea1fec){return _0xea1fec?{'count':_0x525445,'rows':_0xea1fec}:null;}})['then'](respondWithResult(_0x1aba4e,null))[_0xa943('0x4c')](handleError(_0x1aba4e,null));};function handleQuery(_0x49c6ed){logger['info'](_0x49c6ed);return db[_0xa943('0x91')][_0xa943('0x38')](_0x49c6ed)[_0xa943('0xa1')](function(_0x172f8f){csv_results[_0xa943('0x67')](_0x172f8f);})[_0xa943('0x4c')](function(_0xe14aab){logger[_0xa943('0x56')](_0xe14aab[_0xa943('0x6c')]);});} \ No newline at end of file +var _0x1306=['zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./cmList.socket','status','end','json','limit','undefined','count','offset','set','Content-Range','save','update','then','get','Lists','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','CmList','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','findOne','removeDispositions','ids','CmContact','describe','tags','isArray','join','push','each','omit','dataValues','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','cm_contact_has_items','additionalPhone_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','defaultValue','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','info','eml-format','rimraf'];(function(_0x3fc2ea,_0x2c7bdc){var _0x4f5120=function(_0x4804c9){while(--_0x4804c9){_0x3fc2ea['push'](_0x3fc2ea['shift']());}};_0x4f5120(++_0x2c7bdc);}(_0x1306,0x9b));var _0x6130=function(_0x1e4683,_0x255d0e){_0x1e4683=_0x1e4683-0x0;var _0x57c6f4=_0x1306[_0x1e4683];return _0x57c6f4;};'use strict';var emlformat=require(_0x6130('0x0'));var rimraf=require(_0x6130('0x1'));var zipdir=require(_0x6130('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6130('0x3'));var BPromise=require(_0x6130('0x4'));var Mustache=require(_0x6130('0x5'));var util=require(_0x6130('0x6'));var path=require(_0x6130('0x7'));var sox=require(_0x6130('0x8'));var csv=require(_0x6130('0x9'));var ejs=require(_0x6130('0xa'));var fs=require('fs');var fs_extra=require(_0x6130('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6130('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6130('0xd'));var toCsv=require(_0x6130('0x9'));var querystring=require(_0x6130('0xe'));var Papa=require(_0x6130('0xf'));var Redis=require(_0x6130('0x10'));var authService=require(_0x6130('0x11'));var qs=require(_0x6130('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6130('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6130('0x14'));var config=require(_0x6130('0x15'));var licenseUtil=require(_0x6130('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x6130('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6130('0x18'))(new Redis(config[_0x6130('0x17')]));require(_0x6130('0x19'))['register'](socket);function respondWithStatusCode(_0x4dc698,_0x1658a5){_0x1658a5=_0x1658a5||0xcc;return function(_0x61393b){if(_0x61393b){return _0x4dc698['sendStatus'](_0x1658a5);}return _0x4dc698[_0x6130('0x1a')](_0x1658a5)[_0x6130('0x1b')]();};}function respondWithResult(_0x56d261,_0x23a970){_0x23a970=_0x23a970||0xc8;return function(_0xb7bc60){if(_0xb7bc60){return _0x56d261[_0x6130('0x1a')](_0x23a970)[_0x6130('0x1c')](_0xb7bc60);}};}function respondWithFilteredResult(_0x148b59,_0x3495dc){return function(_0x105d48){if(_0x105d48){var _0x58a738=typeof _0x3495dc['offset']==='undefined'&&typeof _0x3495dc[_0x6130('0x1d')]===_0x6130('0x1e');var _0xcd4475=_0x105d48[_0x6130('0x1f')];var _0x4e4e4f=_0x58a738?0x0:_0x3495dc[_0x6130('0x20')];var _0x5b7e89=_0x58a738?_0x105d48[_0x6130('0x1f')]:_0x3495dc['offset']+_0x3495dc[_0x6130('0x1d')];var _0x296d30;if(_0x5b7e89>=_0xcd4475){_0x5b7e89=_0xcd4475;_0x296d30=0xc8;}else{_0x296d30=0xce;}_0x148b59[_0x6130('0x1a')](_0x296d30);return _0x148b59[_0x6130('0x21')](_0x6130('0x22'),_0x4e4e4f+'-'+_0x5b7e89+'/'+_0xcd4475)[_0x6130('0x1c')](_0x105d48);}return null;};}function patchUpdates(_0xfdb06e){return function(_0x351d9e){try{jsonpatch['apply'](_0x351d9e,_0xfdb06e,!![]);}catch(_0x1f4da7){return BPromise['reject'](_0x1f4da7);}return _0x351d9e[_0x6130('0x23')]();};}function saveUpdates(_0x513325,_0x2d3a8a){return function(_0x269897){if(_0x269897){return _0x269897[_0x6130('0x24')](_0x513325)['then'](function(_0xddd672){return _0xddd672;});}return null;};}function removeEntity(_0x714fdc,_0xabeaef){return function(_0x5c2da5){if(_0x5c2da5){return _0x5c2da5['destroy']()[_0x6130('0x25')](function(){var _0xcfe12a=_0x5c2da5[_0x6130('0x26')]({'plain':!![]});var _0x2a02ad=_0x6130('0x27');return db[_0x6130('0x28')][_0x6130('0x29')]({'where':{'type':_0x2a02ad,'resourceId':_0xcfe12a['id']}})[_0x6130('0x25')](function(){return _0x5c2da5;});})['then'](function(){_0x714fdc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee404,_0x205db4){return function(_0x5be6c6){if(!_0x5be6c6){_0x1ee404['sendStatus'](0x194);}return _0x5be6c6;};}function handleError(_0x54de5b,_0x259605){_0x259605=_0x259605||0x1f4;return function(_0x8027d3){logger[_0x6130('0x2a')](_0x8027d3[_0x6130('0x2b')]);if(_0x8027d3['name']){delete _0x8027d3[_0x6130('0x2c')];}_0x54de5b[_0x6130('0x1a')](_0x259605)['send'](_0x8027d3);};}exports[_0x6130('0x2d')]=function(_0x4cbf3b,_0xacd369){var _0x3770d0={},_0xc4a911={},_0x10d702={'count':0x0,'rows':[]};var _0x31fa5a=_[_0x6130('0x2e')](db['CmList'][_0x6130('0x2f')],function(_0x287b36){return{'name':_0x287b36[_0x6130('0x30')],'type':_0x287b36[_0x6130('0x31')][_0x6130('0x32')]};});_0xc4a911[_0x6130('0x33')]=_[_0x6130('0x2e')](_0x31fa5a,_0x6130('0x2c'));_0xc4a911[_0x6130('0x34')]=_[_0x6130('0x35')](_0x4cbf3b[_0x6130('0x34')]);_0xc4a911[_0x6130('0x36')]=_[_0x6130('0x37')](_0xc4a911[_0x6130('0x33')],_0xc4a911[_0x6130('0x34')]);_0x3770d0[_0x6130('0x38')]=_[_0x6130('0x37')](_0xc4a911[_0x6130('0x33')],qs[_0x6130('0x39')](_0x4cbf3b[_0x6130('0x34')][_0x6130('0x39')]));_0x3770d0['attributes']=_0x3770d0['attributes'][_0x6130('0x3a')]?_0x3770d0['attributes']:_0xc4a911[_0x6130('0x33')];if(!_0x4cbf3b[_0x6130('0x34')][_0x6130('0x3b')](_0x6130('0x3c'))){_0x3770d0[_0x6130('0x1d')]=qs[_0x6130('0x1d')](_0x4cbf3b[_0x6130('0x34')][_0x6130('0x1d')]);_0x3770d0['offset']=qs[_0x6130('0x20')](_0x4cbf3b[_0x6130('0x34')][_0x6130('0x20')]);}_0x3770d0[_0x6130('0x3d')]=qs[_0x6130('0x3e')](_0x4cbf3b[_0x6130('0x34')][_0x6130('0x3e')]);_0x3770d0[_0x6130('0x3f')]=qs[_0x6130('0x36')](_[_0x6130('0x40')](_0x4cbf3b[_0x6130('0x34')],_0xc4a911[_0x6130('0x36')]),_0x31fa5a);if(_0x4cbf3b[_0x6130('0x34')][_0x6130('0x41')]){_0x3770d0[_0x6130('0x3f')]=_['merge'](_0x3770d0[_0x6130('0x3f')],{'$or':_[_0x6130('0x2e')](_0x31fa5a,function(_0x4c13ed){if(_0x4c13ed[_0x6130('0x31')]!==_0x6130('0x42')){var _0x6559e={};_0x6559e[_0x4c13ed[_0x6130('0x2c')]]={'$like':'%'+_0x4cbf3b[_0x6130('0x34')][_0x6130('0x41')]+'%'};return _0x6559e;}})});}_0x3770d0=_[_0x6130('0x43')]({},_0x3770d0,_0x4cbf3b['options']);var _0x265dfa={'where':_0x3770d0['where']};return db[_0x6130('0x44')][_0x6130('0x1f')](_0x265dfa)[_0x6130('0x25')](function(_0x7c73ce){_0x10d702[_0x6130('0x1f')]=_0x7c73ce;if(_0x4cbf3b[_0x6130('0x34')][_0x6130('0x45')]){_0x3770d0[_0x6130('0x46')]=[{'all':!![]}];}return db['CmList'][_0x6130('0x47')](_0x3770d0);})[_0x6130('0x25')](function(_0x36c643){_0x10d702[_0x6130('0x48')]=_0x36c643;return _0x10d702;})[_0x6130('0x25')](respondWithFilteredResult(_0xacd369,_0x3770d0))[_0x6130('0x49')](handleError(_0xacd369,null));};exports[_0x6130('0x4a')]=function(_0x40cefc,_0x40e3ca){var _0x3896e5={'raw':![],'where':{'id':_0x40cefc[_0x6130('0x4b')]['id']}},_0x5d5022={};_0x5d5022[_0x6130('0x33')]=_[_0x6130('0x35')](db[_0x6130('0x44')][_0x6130('0x2f')]);_0x5d5022[_0x6130('0x34')]=_[_0x6130('0x35')](_0x40cefc[_0x6130('0x34')]);_0x5d5022[_0x6130('0x36')]=_[_0x6130('0x37')](_0x5d5022[_0x6130('0x33')],_0x5d5022[_0x6130('0x34')]);_0x3896e5[_0x6130('0x38')]=_[_0x6130('0x37')](_0x5d5022[_0x6130('0x33')],qs[_0x6130('0x39')](_0x40cefc['query']['fields']));_0x3896e5['attributes']=_0x3896e5[_0x6130('0x38')][_0x6130('0x3a')]?_0x3896e5[_0x6130('0x38')]:_0x5d5022[_0x6130('0x33')];if(_0x40cefc[_0x6130('0x34')][_0x6130('0x45')]){_0x3896e5[_0x6130('0x46')]=[{'all':!![]}];}_0x3896e5=_[_0x6130('0x43')]({},_0x3896e5,_0x40cefc[_0x6130('0x4c')]);return db['CmList'][_0x6130('0x4d')](_0x3896e5)[_0x6130('0x25')](handleEntityNotFound(_0x40e3ca,null))[_0x6130('0x25')](respondWithResult(_0x40e3ca,null))[_0x6130('0x49')](handleError(_0x40e3ca,null));};exports[_0x6130('0x4e')]=function(_0x4d54ff,_0x1142b5){return db[_0x6130('0x44')]['create'](_0x4d54ff[_0x6130('0x4f')],{})[_0x6130('0x25')](function(_0x3fd66f){var _0x265433=_0x4d54ff[_0x6130('0x50')]['get']({'plain':!![]});if(!_0x265433)throw new Error(_0x6130('0x51'));if(_0x265433[_0x6130('0x52')]==='user'){var _0xebdd0d=_0x3fd66f['get']({'plain':!![]});var _0xf46f9c=_0x6130('0x27');return db[_0x6130('0x53')]['find']({'where':{'name':_0xf46f9c,'userProfileId':_0x265433[_0x6130('0x54')]},'raw':!![]})[_0x6130('0x25')](function(_0xa440c3){if(_0xa440c3&&_0xa440c3[_0x6130('0x55')]===0x0){return db[_0x6130('0x28')][_0x6130('0x4e')]({'name':_0xebdd0d[_0x6130('0x2c')],'resourceId':_0xebdd0d['id'],'type':_0xa440c3[_0x6130('0x2c')],'sectionId':_0xa440c3['id']},{})[_0x6130('0x25')](function(){return _0x3fd66f;});}else{return _0x3fd66f;}})[_0x6130('0x49')](function(_0x33f160){logger[_0x6130('0x2a')](_0x6130('0x56'),_0x33f160);throw _0x33f160;});}return _0x3fd66f;})[_0x6130('0x25')](respondWithResult(_0x1142b5,0xc9))[_0x6130('0x49')](handleError(_0x1142b5,null));};exports[_0x6130('0x24')]=function(_0xf9b4f7,_0x3db794){if(_0xf9b4f7[_0x6130('0x4f')]['id']){delete _0xf9b4f7[_0x6130('0x4f')]['id'];}return db[_0x6130('0x44')][_0x6130('0x4d')]({'where':{'id':_0xf9b4f7[_0x6130('0x4b')]['id']}})[_0x6130('0x25')](handleEntityNotFound(_0x3db794,null))[_0x6130('0x25')](saveUpdates(_0xf9b4f7['body'],null))[_0x6130('0x25')](respondWithResult(_0x3db794,null))[_0x6130('0x49')](handleError(_0x3db794,null));};exports[_0x6130('0x29')]=function(_0x37464c,_0x15c45b){return db['CmList'][_0x6130('0x4d')]({'where':{'id':_0x37464c['params']['id']}})[_0x6130('0x25')](handleEntityNotFound(_0x15c45b,null))[_0x6130('0x25')](removeEntity(_0x15c45b,null))[_0x6130('0x49')](handleError(_0x15c45b,null));};exports['describe']=function(_0x413541,_0x58a255){return db[_0x6130('0x44')]['describe']()['then'](respondWithResult(_0x58a255,null))[_0x6130('0x49')](handleError(_0x58a255,null));};exports[_0x6130('0x57')]=function(_0x54fc1c,_0x3d53fc,_0x55ef87){if(_0x54fc1c[_0x6130('0x4f')]['id']){delete _0x54fc1c[_0x6130('0x4f')]['id'];}return db[_0x6130('0x44')][_0x6130('0x4d')]({'where':{'id':_0x54fc1c['params']['id']}})[_0x6130('0x25')](handleEntityNotFound(_0x3d53fc,null))[_0x6130('0x25')](function(_0x5ab6ed){if(_0x5ab6ed){_0x54fc1c[_0x6130('0x4f')][_0x6130('0x58')]=_0x5ab6ed['id'];return db[_0x6130('0x59')]['create'](_0x54fc1c[_0x6130('0x4f')]);}})[_0x6130('0x25')](respondWithResult(_0x3d53fc,null))[_0x6130('0x49')](handleError(_0x3d53fc,null));};exports['getDispositions']=function(_0x5d9caa,_0x2d3088,_0x3303d2){var _0x4129d2={'raw':![],'where':{}};var _0x5bd62f={};var _0x4363ca={'count':0x0,'rows':[]};return db[_0x6130('0x44')][_0x6130('0x5a')]({'where':{'id':_0x5d9caa['params']['id']}})['then'](handleEntityNotFound(_0x2d3088,null))[_0x6130('0x25')](function(_0x5525ff){if(_0x5525ff){_0x5bd62f[_0x6130('0x33')]=_['keys'](db[_0x6130('0x59')][_0x6130('0x2f')]);_0x5bd62f[_0x6130('0x34')]=_[_0x6130('0x35')](_0x5d9caa[_0x6130('0x34')]);_0x5bd62f['filters']=_[_0x6130('0x37')](_0x5bd62f[_0x6130('0x33')],_0x5bd62f[_0x6130('0x34')]);_0x4129d2['attributes']=_['intersection'](_0x5bd62f[_0x6130('0x33')],qs[_0x6130('0x39')](_0x5d9caa[_0x6130('0x34')]['fields']));_0x4129d2[_0x6130('0x38')]=_0x4129d2[_0x6130('0x38')]['length']?_0x4129d2[_0x6130('0x38')]:_0x5bd62f[_0x6130('0x33')];if(!_0x5d9caa[_0x6130('0x34')]['hasOwnProperty'](_0x6130('0x3c'))){_0x4129d2[_0x6130('0x1d')]=qs[_0x6130('0x1d')](_0x5d9caa['query'][_0x6130('0x1d')]);_0x4129d2[_0x6130('0x20')]=qs[_0x6130('0x20')](_0x5d9caa[_0x6130('0x34')][_0x6130('0x20')]);}_0x4129d2[_0x6130('0x3d')]=qs[_0x6130('0x3e')](_0x5d9caa['query']['sort']);_0x4129d2[_0x6130('0x3f')]=qs[_0x6130('0x36')](_[_0x6130('0x40')](_0x5d9caa[_0x6130('0x34')],_0x5bd62f[_0x6130('0x36')]));_0x4129d2[_0x6130('0x3f')][_0x6130('0x58')]=_0x5525ff['id'];if(_0x5d9caa['query'][_0x6130('0x41')]){_0x4129d2[_0x6130('0x3f')]=_[_0x6130('0x43')](_0x4129d2[_0x6130('0x3f')],{'$or':_[_0x6130('0x2e')](_0x4129d2[_0x6130('0x38')],function(_0x4cfd84){var _0x317a95={};_0x317a95[_0x4cfd84]={'$like':'%'+_0x5d9caa[_0x6130('0x34')][_0x6130('0x41')]+'%'};return _0x317a95;})});}_0x4129d2=_[_0x6130('0x43')]({},_0x4129d2,_0x5d9caa[_0x6130('0x4c')]);return db[_0x6130('0x59')][_0x6130('0x1f')]({'where':_0x4129d2[_0x6130('0x3f')]})['then'](function(_0x348028){_0x4363ca[_0x6130('0x1f')]=_0x348028;if(_0x5d9caa[_0x6130('0x34')][_0x6130('0x45')]){_0x4129d2[_0x6130('0x46')]=[{'all':!![]}];}return db[_0x6130('0x59')][_0x6130('0x47')](_0x4129d2);})[_0x6130('0x25')](function(_0x3c626c){_0x4363ca[_0x6130('0x48')]=_0x3c626c;return _0x4363ca;});}})[_0x6130('0x25')](respondWithFilteredResult(_0x2d3088,_0x4129d2))['catch'](handleError(_0x2d3088,null));};exports[_0x6130('0x5b')]=function(_0x5ce280,_0x2dacfd,_0x2ccaf2){return db[_0x6130('0x44')][_0x6130('0x4d')]({'where':{'id':_0x5ce280[_0x6130('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2dacfd,null))[_0x6130('0x25')](function(_0x5898bd){if(_0x5898bd){return _0x5898bd[_0x6130('0x5b')](_0x5ce280[_0x6130('0x34')][_0x6130('0x5c')]);}})['then'](respondWithStatusCode(_0x2dacfd,null))[_0x6130('0x49')](handleError(_0x2dacfd,null));};exports['addContacts']=function(_0x2db33a,_0x5478a3,_0xa1819){return db['CmList'][_0x6130('0x4d')]({'where':{'id':_0x2db33a[_0x6130('0x4b')]['id']}})[_0x6130('0x25')](handleEntityNotFound(_0x5478a3,null))['then'](function(_0x38b8d5){if(_0x38b8d5){var _0x3c5f59=[];var _0x4b5503={'success':[],'errors':[]};return db[_0x6130('0x5d')][_0x6130('0x5e')]()[_0x6130('0x25')](function(_0x5591b2){if(_0x2db33a[_0x6130('0x4f')][_0x6130('0x5f')]&&_[_0x6130('0x60')](_0x2db33a['body']['tags'])){if(_0x2db33a['body'][_0x6130('0x5f')][_0x6130('0x3a')]){_0x2db33a['body'][_0x6130('0x5f')]=_0x2db33a[_0x6130('0x4f')][_0x6130('0x5f')][_0x6130('0x61')](';')+';';}else{_0x2db33a[_0x6130('0x4f')]['tags']=null;}}else{_0x2db33a[_0x6130('0x4f')][_0x6130('0x5f')]=null;}if(_0x2db33a['body']&&_['isArray'](_0x2db33a[_0x6130('0x4f')])){for(var _0x480e38=0x0;_0x480e38<_0x2db33a[_0x6130('0x4f')][_0x6130('0x3a')];_0x480e38+=0x1){_0x2db33a[_0x6130('0x4f')][_0x480e38][_0x6130('0x58')]=_0x2db33a['params']['id'];_0x3c5f59[_0x6130('0x62')](_0x2db33a[_0x6130('0x4f')][_0x480e38]);}return BPromise[_0x6130('0x63')](_0x3c5f59,function(_0x384879){return db[_0x6130('0x5d')][_0x6130('0x4e')](_[_0x6130('0x64')](_0x384879,[_0x6130('0x5c'),'id'])||{},{'fields':_[_0x6130('0x35')](_0x5591b2),'raw':!![]})[_0x6130('0x25')](function(_0x80b3ad){_0x4b5503['success'][_0x6130('0x62')](_0x80b3ad[_0x6130('0x65')]);})[_0x6130('0x49')](function(_0x302095){_0x4b5503['errors'][_0x6130('0x62')]({'data':_0x384879,'error':_0x302095[_0x6130('0x66')]});});})[_0x6130('0x25')](function(_0x290215){return _0x4b5503;})[_0x6130('0x49')](function(_0x2520eb){return _0x2520eb;});}else{_0x5478a3[_0x6130('0x1a')](0x190)[_0x6130('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x6130('0x25')](respondWithResult(_0x5478a3,null))[_0x6130('0x49')](handleError(_0x5478a3,null));};exports[_0x6130('0x67')]=function(_0x1a5837,_0x251f69,_0x38d829){var _0x26d5b9;return db[_0x6130('0x44')]['find']({'where':{'id':_0x1a5837[_0x6130('0x4b')]['id']},'include':[{'model':db[_0x6130('0x68')],'as':_0x6130('0x69')}]})[_0x6130('0x25')](handleEntityNotFound(_0x251f69,null))['then'](function(_0x6d3695){if(_0x6d3695){_0x26d5b9=_0x6d3695;return db['CmContact']['rawAttributes'];}})['then'](function(_0x2f7200){if(_0x2f7200){var _0x5bdc3e={};var _0x4d4c8d={};_0x4d4c8d[_0x6130('0x33')]=_[_0x6130('0x6a')](_[_0x6130('0x35')](_0x2f7200),_[_0x6130('0x2e')](_0x26d5b9['CustomFields'],function(_0x43c566){return util[_0x6130('0x6b')](_0x6130('0x6c'),_0x43c566['id']);}));_0x4d4c8d[_0x6130('0x34')]=_[_0x6130('0x35')](_0x1a5837[_0x6130('0x34')]);_0x4d4c8d['filters']=_['intersection'](_0x4d4c8d['model'],_0x4d4c8d[_0x6130('0x34')]);_0x5bdc3e[_0x6130('0x38')]=_['intersection'](_0x4d4c8d[_0x6130('0x33')],qs[_0x6130('0x39')](_0x1a5837['query']['fields']));_0x5bdc3e[_0x6130('0x38')]=_0x5bdc3e[_0x6130('0x38')]['length']?_0x5bdc3e[_0x6130('0x38')]:_0x4d4c8d[_0x6130('0x33')];if(!_0x1a5837[_0x6130('0x34')][_0x6130('0x3b')](_0x6130('0x3c'))){_0x5bdc3e[_0x6130('0x1d')]=qs[_0x6130('0x1d')](_0x1a5837[_0x6130('0x34')][_0x6130('0x1d')]);_0x5bdc3e['offset']=qs['offset'](_0x1a5837[_0x6130('0x34')]['offset']);}_0x5bdc3e[_0x6130('0x3d')]=qs[_0x6130('0x3e')](_0x1a5837[_0x6130('0x34')][_0x6130('0x3e')]);_0x5bdc3e[_0x6130('0x3f')]=qs[_0x6130('0x36')](_['pick'](_0x1a5837[_0x6130('0x34')],_0x4d4c8d[_0x6130('0x36')]));_0x5bdc3e[_0x6130('0x6d')]=!![];if(_0x1a5837['query'][_0x6130('0x41')]){_0x5bdc3e[_0x6130('0x3f')]=_[_0x6130('0x43')](_0x5bdc3e[_0x6130('0x3f')],{'$or':_['map'](_0x5bdc3e['attributes'],function(_0x464335){var _0x550150={};_0x550150[_0x464335]={'$like':'%'+_0x1a5837[_0x6130('0x34')][_0x6130('0x41')]+'%'};return _0x550150;})});}_0x5bdc3e=_[_0x6130('0x43')]({},_0x5bdc3e,_0x1a5837['options']);return _0x26d5b9['getContacts'](_0x5bdc3e);}})['then'](respondWithResult(_0x251f69,null))[_0x6130('0x49')](handleError(_0x251f69,null));};exports[_0x6130('0x6e')]=function(_0x2a70ec,_0x342933,_0x1258e4){var _0x20f3d5;var _0x1535f0;var _0x52e22f;var _0x3de7e1=_0x2a70ec[_0x6130('0x4b')]['id'];csv_results=[];return db[_0x6130('0x6f')][_0x6130('0x47')]({'attributes':['id','name'],'raw':!![],'order':[_0x6130('0x70')]})[_0x6130('0x25')](function(_0x48a0d8){_0x20f3d5=_0x48a0d8;var _0x304ce2=_['keys'](db[_0x6130('0x5d')][_0x6130('0x2f')]);return db['CmCustomField'][_0x6130('0x47')]({'raw':!![],'attributes':['id',_0x6130('0x71')]})[_0x6130('0x25')](function(_0x5d2d48){_0x1535f0=_0x5d2d48;var _0x50285b=squel[_0x6130('0x72')]()[_0x6130('0x39')](_0x304ce2)[_0x6130('0x73')](_0x6130('0x74'),'c')[_0x6130('0x3f')](_0x6130('0x75'),_0x3de7e1)[_0x6130('0x3f')](_0x6130('0x76'))[_0x6130('0x77')]();for(var _0x2f2e07=0x0;_0x2f2e07<_0x1535f0[_0x6130('0x3a')];_0x2f2e07++){_0x50285b[_0x6130('0x78')](_0x6130('0x79')+_0x1535f0[_0x2f2e07]['id'],_0x6130('0x7a')+_0x1535f0[_0x2f2e07]['alias']);}for(var _0x2f2e07=0x0;_0x2f2e07<_0x20f3d5[_0x6130('0x3a')];_0x2f2e07++){_0x50285b['field'](squel[_0x6130('0x72')]()[_0x6130('0x78')]('item')['from'](_0x6130('0x7b'))[_0x6130('0x3f')]('ItemTypeId\x20=\x20?',_0x20f3d5[_0x2f2e07]['id'])[_0x6130('0x3f')]('CmContactId\x20=\x20c.id'),_0x6130('0x7c')+_0x20f3d5[_0x2f2e07]['name']);_0x50285b['field'](squel[_0x6130('0x72')]()['field']('description')[_0x6130('0x73')](_0x6130('0x7b'))['where'](_0x6130('0x7d'),_0x20f3d5[_0x2f2e07]['id'])[_0x6130('0x3f')](_0x6130('0x7e')),_0x6130('0x7f')+_0x20f3d5[_0x2f2e07][_0x6130('0x2c')]);}var _0x566547=[];_0x566547[_0x6130('0x62')](_0x50285b[_0x6130('0x80')]());BPromise[_0x6130('0x63')](_0x566547,handleQuery)['then'](function(_0x540c9a){handleQuery(_0x50285b[_0x6130('0x80')]());var _0x3b52a1=csv_results[0x0];if(!_['isEmpty'](_0x3b52a1)){var _0x4be278=toCsv(_0x3b52a1);var _0x27b102=Date[_0x6130('0x81')]();fs['writeFileSync'](util['format'](_0x6130('0x82'),_0x3de7e1,_0x27b102),_0x4be278);_0x342933[_0x6130('0x83')](_0x6130('0x84'),_0x6130('0x85')+util[_0x6130('0x6b')](_0x6130('0x86'),_0x3de7e1,_0x27b102));_0x342933[_0x6130('0x83')](_0x6130('0x87'),_0x6130('0x88'));return _0x342933['download'](util[_0x6130('0x6b')](_0x6130('0x82'),_0x3de7e1,_0x27b102));}else{return _0x342933['sendStatus'](0xcc);}});});});};exports[_0x6130('0x89')]=function(_0x1dde57,_0x309b50,_0x5f4ff1){var _0x20ef10;delete _0x1dde57[_0x6130('0x4f')]['id'];return db[_0x6130('0x44')][_0x6130('0x5a')]({'where':{'id':_0x1dde57[_0x6130('0x4b')]['id']}})['then'](handleEntityNotFound(_0x309b50,null))[_0x6130('0x25')](function(_0x15c288){if(_0x15c288){return db[_0x6130('0x8a')][_0x6130('0x8b')](function(_0x2429bd){return db[_0x6130('0x68')][_0x6130('0x4e')](_0x1dde57[_0x6130('0x4f')],{'transaction':_0x2429bd})[_0x6130('0x25')](function(_0x1c2b5e){_0x20ef10=_0x1c2b5e;return _0x15c288[_0x6130('0x8c')](_0x1c2b5e,{'transaction':_0x2429bd});})[_0x6130('0x25')](function(){var _0x42dff6={'type':db[_0x6130('0x8d')][_0x6130('0x8e')],'transaction':_0x2429bd};switch(_0x1dde57[_0x6130('0x4f')]['type']){case'text':_0x42dff6[_0x6130('0x31')]=db[_0x6130('0x8d')][_0x6130('0x8e')];break;case'number':_0x42dff6[_0x6130('0x31')]=db['Sequelize'][_0x6130('0x8f')];break;case'switch':_0x42dff6[_0x6130('0x31')]=db[_0x6130('0x8d')]['BOOLEAN'];_0x42dff6[_0x6130('0x90')]=![];break;default:}return db[_0x6130('0x8a')]['queryInterface']['addColumn']('cm_contacts',util['format'](_0x6130('0x91'),_0x20ef10['id']),_0x42dff6);})[_0x6130('0x25')](function(){return _0x20ef10;});});}})[_0x6130('0x25')](respondWithResult(_0x309b50,null))['catch'](handleError(_0x309b50,null));};exports['getCustomFields']=function(_0xd13618,_0x50b376,_0x5b4e24){var _0xb18f97={};var _0x1ec393={};var _0x3b3f3e;var _0x656fcd;return db[_0x6130('0x44')][_0x6130('0x5a')]({'where':{'id':_0xd13618[_0x6130('0x4b')]['id']}})[_0x6130('0x25')](handleEntityNotFound(_0x50b376,null))['then'](function(_0x5f0653){if(_0x5f0653){_0x3b3f3e=_0x5f0653;_0x1ec393[_0x6130('0x33')]=_[_0x6130('0x35')](db[_0x6130('0x68')][_0x6130('0x2f')]);_0x1ec393[_0x6130('0x34')]=_['keys'](_0xd13618[_0x6130('0x34')]);_0x1ec393[_0x6130('0x36')]=_['intersection'](_0x1ec393[_0x6130('0x33')],_0x1ec393[_0x6130('0x34')]);_0xb18f97['attributes']=_[_0x6130('0x37')](_0x1ec393[_0x6130('0x33')],qs[_0x6130('0x39')](_0xd13618['query'][_0x6130('0x39')]));_0xb18f97[_0x6130('0x38')]=_0xb18f97[_0x6130('0x38')][_0x6130('0x3a')]?_0xb18f97[_0x6130('0x38')]:_0x1ec393['model'];_0xb18f97[_0x6130('0x3d')]=qs[_0x6130('0x3e')](_0xd13618[_0x6130('0x34')]['sort']);_0xb18f97[_0x6130('0x3f')]=qs[_0x6130('0x36')](_['pick'](_0xd13618[_0x6130('0x34')],_0x1ec393[_0x6130('0x36')]));_0xb18f97[_0x6130('0x3f')]=_['merge'](_0xb18f97[_0x6130('0x3f')],{'$or':[{'ListId':_0x5f0653['id']},{'ListId':null}]});if(_0xd13618[_0x6130('0x34')]['filter']){_0xb18f97[_0x6130('0x3f')]=_[_0x6130('0x43')](_0xb18f97[_0x6130('0x3f')],{'$or':_[_0x6130('0x2e')](_0xb18f97[_0x6130('0x38')],function(_0x30406a){var _0x53d5af={};_0x53d5af[_0x30406a]={'$like':'%'+_0xd13618[_0x6130('0x34')][_0x6130('0x41')]+'%'};return _0x53d5af;})});}_0xb18f97=_['merge']({},_0xb18f97,_0xd13618['options']);return db[_0x6130('0x68')][_0x6130('0x92')](_0xb18f97);}})['then'](respondWithResult(_0x50b376,null))[_0x6130('0x49')](handleError(_0x50b376,null));};exports[_0x6130('0x93')]=function(_0x53a976,_0x1e73dd){return db[_0x6130('0x68')][_0x6130('0x92')]({'where':{'ListId':null}})[_0x6130('0x25')](handleEntityNotFound(_0x1e73dd,null))[_0x6130('0x25')](function(_0x42518b){return _0x42518b;})[_0x6130('0x25')](respondWithResult(_0x1e73dd,null))[_0x6130('0x49')](handleError(_0x1e73dd,null));};exports[_0x6130('0x94')]=function(_0x621d48,_0x2db04e,_0x5b429a){return db[_0x6130('0x44')][_0x6130('0x4d')]({'where':{'id':_0x621d48[_0x6130('0x4b')]['id']}})[_0x6130('0x25')](handleEntityNotFound(_0x2db04e,null))[_0x6130('0x25')](function(_0x4e5ba3){if(_0x4e5ba3){return _0x4e5ba3[_0x6130('0x94')](_0x621d48[_0x6130('0x4f')][_0x6130('0x5c')],_[_0x6130('0x64')](_0x621d48[_0x6130('0x4f')],['ids','id'])||{})[_0x6130('0x95')](function(_0x4bf581){for(var _0x3ea782=0x0;_0x3ea782<_0x621d48[_0x6130('0x4f')][_0x6130('0x5c')]['length'];_0x3ea782+=0x1){socket['emit'](_0x6130('0x96'),{'UserId':Number(_0x621d48[_0x6130('0x4f')][_0x6130('0x5c')][_0x3ea782]),'CmListId':Number(_0x621d48[_0x6130('0x4b')]['id'])});}return _0x4bf581;});}})[_0x6130('0x25')](respondWithResult(_0x2db04e,null))[_0x6130('0x49')](handleError(_0x2db04e,null));};exports[_0x6130('0x97')]=function(_0x55c64d,_0x5e716d,_0x41e2c9){return db[_0x6130('0x44')]['find']({'where':{'id':_0x55c64d[_0x6130('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e716d,null))[_0x6130('0x25')](function(_0x11eafb){if(_0x11eafb){return _0x11eafb['removeAgents'](_0x55c64d[_0x6130('0x34')][_0x6130('0x5c')])['then'](function(){if(_[_0x6130('0x60')](_0x55c64d['query']['ids'])){for(var _0x562bc4=0x0;_0x562bc4<_0x55c64d[_0x6130('0x34')][_0x6130('0x5c')]['length'];_0x562bc4+=0x1){socket[_0x6130('0x98')](_0x6130('0x99'),{'UserId':Number(_0x55c64d[_0x6130('0x34')][_0x6130('0x5c')][_0x562bc4]),'CmListId':Number(_0x55c64d[_0x6130('0x4b')]['id'])});}}else{socket[_0x6130('0x98')](_0x6130('0x99'),{'UserId':Number(_0x55c64d[_0x6130('0x34')][_0x6130('0x5c')]),'CmListId':Number(_0x55c64d[_0x6130('0x4b')]['id'])});}});}})[_0x6130('0x25')](respondWithStatusCode(_0x5e716d,null))['catch'](handleError(_0x5e716d,null));};exports['getAgents']=function(_0x1198ba,_0xd818bf,_0x379475){var _0x279697={};var _0x1f886a={};var _0x22b79c;var _0x55e9f9;return db['CmList'][_0x6130('0x5a')]({'where':{'id':_0x1198ba[_0x6130('0x4b')]['id']}})[_0x6130('0x25')](handleEntityNotFound(_0xd818bf,null))[_0x6130('0x25')](function(_0x366d07){if(_0x366d07){_0x22b79c=_0x366d07;_0x1f886a[_0x6130('0x33')]=_[_0x6130('0x35')](db[_0x6130('0x9a')][_0x6130('0x2f')]);_0x1f886a[_0x6130('0x34')]=_[_0x6130('0x35')](_0x1198ba[_0x6130('0x34')]);_0x1f886a[_0x6130('0x36')]=_[_0x6130('0x37')](_0x1f886a['model'],_0x1f886a['query']);_0x279697['attributes']=_[_0x6130('0x37')](_0x1f886a[_0x6130('0x33')],qs['fields'](_0x1198ba['query'][_0x6130('0x39')]));_0x279697[_0x6130('0x38')]=_0x279697[_0x6130('0x38')][_0x6130('0x3a')]?_0x279697[_0x6130('0x38')]:_0x1f886a[_0x6130('0x33')];_0x279697[_0x6130('0x3d')]=qs[_0x6130('0x3e')](_0x1198ba[_0x6130('0x34')][_0x6130('0x3e')]);_0x279697['where']=qs[_0x6130('0x36')](_['pick'](_0x1198ba[_0x6130('0x34')],_0x1f886a[_0x6130('0x36')]));if(_0x1198ba[_0x6130('0x34')]['filter']){_0x279697[_0x6130('0x3f')]=_[_0x6130('0x43')](_0x279697[_0x6130('0x3f')],{'$or':_[_0x6130('0x2e')](_0x279697[_0x6130('0x38')],function(_0x552c85){var _0x4980e8={};_0x4980e8[_0x552c85]={'$like':'%'+_0x1198ba[_0x6130('0x34')]['filter']+'%'};return _0x4980e8;})});}_0x279697=_[_0x6130('0x43')]({},_0x279697,_0x1198ba[_0x6130('0x4c')]);return _0x22b79c[_0x6130('0x9b')](_0x279697);}})[_0x6130('0x25')](function(_0x254bf5){if(_0x254bf5){_0x55e9f9=_0x254bf5[_0x6130('0x3a')];if(!_0x1198ba[_0x6130('0x34')][_0x6130('0x3b')]('nolimit')){_0x279697[_0x6130('0x1d')]=qs[_0x6130('0x1d')](_0x1198ba[_0x6130('0x34')][_0x6130('0x1d')]);_0x279697[_0x6130('0x20')]=qs['offset'](_0x1198ba[_0x6130('0x34')][_0x6130('0x20')]);}return _0x22b79c['getAgents'](_0x279697);}})['then'](function(_0x102837){if(_0x102837){return _0x102837?{'count':_0x55e9f9,'rows':_0x102837}:null;}})[_0x6130('0x25')](respondWithResult(_0xd818bf,null))[_0x6130('0x49')](handleError(_0xd818bf,null));};function handleQuery(_0x5c2c4d){logger[_0x6130('0x9c')](_0x5c2c4d);return db[_0x6130('0x8a')]['query'](_0x5c2c4d)[_0x6130('0x95')](function(_0x36aec5){csv_results[_0x6130('0x62')](_0x36aec5);})[_0x6130('0x49')](function(_0x400c0e){logger[_0x6130('0x2a')](_0x400c0e[_0x6130('0x66')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 42433aa..15897d5 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x5fc3[_0x1eda20];return _0x31b953;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x537e89,_0x575254){var _0x58e0c0=function(_0x1cd00c){while(--_0x1cd00c){_0x537e89['push'](_0x537e89['shift']());}};_0x58e0c0(++_0x575254);}(_0x814b,0x1a2));var _0xb814=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x814b[_0x37d3f3];return _0x185c9c;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ea9a699..4f77b1a 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util'];(function(_0x1c824a,_0x37acf9){var _0x73a314=function(_0x4a3c86){while(--_0x4a3c86){_0x1c824a['push'](_0x1c824a['shift']());}};_0x73a314(++_0x37acf9);}(_0x54ef,0x112));var _0xf54e=function(_0x569ca5,_0x340350){_0x569ca5=_0x569ca5-0x0;var _0x27ab0f=_0x54ef[_0x569ca5];return _0x27ab0f;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList','cm_lists','lodash'];(function(_0xf9e585,_0x4d48ad){var _0xe17f0b=function(_0x30fc03){while(--_0x30fc03){_0xf9e585['push'](_0xf9e585['shift']());}};_0xe17f0b(++_0x4d48ad);}(_0xda55,0x6d));var _0x5da5=function(_0x88ee16,_0x5eef04){_0x88ee16=_0x88ee16-0x0;var _0x10c753=_0xda55[_0x88ee16];return _0x10c753;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'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 0249605..87928c3 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 _0xc7e7=['defaults','localhost','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xc7e7,0x104));var _0x7c7e=function(_0x22fb71,_0xa19d70){_0x22fb71=_0x22fb71-0x0;var _0x5d97be=_0xc7e7[_0x22fb71];return _0x5d97be;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c7e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c7e('0x1'))['db'];var utils=require(_0x7c7e('0x2'));var logger=require(_0x7c7e('0x3'))(_0x7c7e('0x4'));var config=require('../../config/environment');var jayson=require(_0x7c7e('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7c7e('0x6')](config['redis'],{'host':_0x7c7e('0x7'),'port':0x18eb});var socket=require(_0x7c7e('0x8'))(new Redis(config['redis']));require(_0x7c7e('0x9'))[_0x7c7e('0xa')](socket);function respondWithRpcPromise(_0x21e2f3,_0x1265cb,_0x22aa92){return new BPromise(function(_0x25271e,_0xd6f1d9){return client['request'](_0x21e2f3,_0x22aa92)['then'](function(_0x2b0856){logger[_0x7c7e('0xb')](_0x7c7e('0xc'),_0x1265cb,_0x7c7e('0xd'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x1265cb,_0x7c7e('0xd'),JSON['stringify'](_0x2b0856));if(_0x2b0856[_0x7c7e('0xe')]){if(_0x2b0856['error'][_0x7c7e('0xf')]===0x1f4){logger[_0x7c7e('0xe')]('CmList,\x20%s,\x20%s',_0x1265cb,_0x2b0856['error'][_0x7c7e('0x10')]);return _0xd6f1d9(_0x2b0856[_0x7c7e('0xe')][_0x7c7e('0x10')]);}logger[_0x7c7e('0xe')]('CmList,\x20%s,\x20%s',_0x1265cb,_0x2b0856[_0x7c7e('0xe')][_0x7c7e('0x10')]);return _0x25271e(_0x2b0856['error'][_0x7c7e('0x10')]);}else{logger[_0x7c7e('0xb')](_0x7c7e('0xc'),_0x1265cb,'request\x20sent');_0x25271e(_0x2b0856[_0x7c7e('0x11')][_0x7c7e('0x10')]);}})[_0x7c7e('0x12')](function(_0x2f1dfe){logger['error'](_0x7c7e('0xc'),_0x1265cb,_0x2f1dfe);_0xd6f1d9(_0x2f1dfe);});});} \ No newline at end of file +var _0x161f=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x161f,0xd7));var _0xf161=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x161f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf161('0x0'));var util=require(_0xf161('0x1'));var moment=require(_0xf161('0x2'));var BPromise=require(_0xf161('0x3'));var rs=require(_0xf161('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf161('0x5'));var logger=require(_0xf161('0x6'))(_0xf161('0x7'));var config=require(_0xf161('0x8'));var jayson=require(_0xf161('0x9'));var client=jayson[_0xf161('0xa')][_0xf161('0xb')]({'port':0x232a});config[_0xf161('0xc')]=_[_0xf161('0xd')](config[_0xf161('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf161('0xc')]));require(_0xf161('0xe'))[_0xf161('0xf')](socket);function respondWithRpcPromise(_0x2668d7,_0x5c16eb,_0x5e3443){return new BPromise(function(_0x1b0d93,_0x443139){return client['request'](_0x2668d7,_0x5e3443)[_0xf161('0x10')](function(_0x1e8bf){logger[_0xf161('0x11')](_0xf161('0x12'),_0x5c16eb,_0xf161('0x13'));logger[_0xf161('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x5c16eb,'request\x20sent',JSON[_0xf161('0x15')](_0x1e8bf));if(_0x1e8bf[_0xf161('0x16')]){if(_0x1e8bf[_0xf161('0x16')][_0xf161('0x17')]===0x1f4){logger[_0xf161('0x16')]('CmList,\x20%s,\x20%s',_0x5c16eb,_0x1e8bf[_0xf161('0x16')][_0xf161('0x18')]);return _0x443139(_0x1e8bf[_0xf161('0x16')][_0xf161('0x18')]);}logger[_0xf161('0x16')](_0xf161('0x12'),_0x5c16eb,_0x1e8bf[_0xf161('0x16')][_0xf161('0x18')]);return _0x1b0d93(_0x1e8bf[_0xf161('0x16')][_0xf161('0x18')]);}else{logger[_0xf161('0x11')](_0xf161('0x12'),_0x5c16eb,_0xf161('0x13'));_0x1b0d93(_0x1e8bf[_0xf161('0x19')][_0xf161('0x18')]);}})[_0xf161('0x1a')](function(_0x30e22e){logger[_0xf161('0x16')](_0xf161('0x12'),_0x5c16eb,_0x30e22e);_0x443139(_0x30e22e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7a12a1d..c9c49fe 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 _0x7f94=['emit','removeListener','register','length','cmList:','./cmList.events','remove','update'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x7f94,0x65));var _0x47f9=function(_0x626317,_0x20a464){_0x626317=_0x626317-0x0;var _0x2c7686=_0x7f94[_0x626317];return _0x2c7686;};'use strict';var CmListEvents=require(_0x47f9('0x0'));var events=['save',_0x47f9('0x1'),_0x47f9('0x2')];function createListener(_0x2c1abf,_0x15afad){return function(_0x4a4dad){_0x15afad[_0x47f9('0x3')](_0x2c1abf,_0x4a4dad);};}function removeListener(_0x1ecb98,_0x146950){return function(){CmListEvents[_0x47f9('0x4')](_0x1ecb98,_0x146950);};}exports[_0x47f9('0x5')]=function(_0xfba0ba){for(var _0x386d8f=0x0,_0x572cab=events[_0x47f9('0x6')];_0x386d8f<_0x572cab;_0x386d8f++){var _0x4a8f54=events[_0x386d8f];var _0x23ab0b=createListener(_0x47f9('0x7')+_0x4a8f54,_0xfba0ba);CmListEvents['on'](_0x4a8f54,_0x23ab0b);}}; \ No newline at end of file +var _0xe000=['remove','update','emit','removeListener','register','cmList:'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe000,0x7e));var _0x0e00=function(_0x9a6004,_0x37044e){_0x9a6004=_0x9a6004-0x0;var _0x3fd463=_0xe000[_0x9a6004];return _0x3fd463;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x0e00('0x0'),_0x0e00('0x1')];function createListener(_0x38385b,_0x538f79){return function(_0x1856cf){_0x538f79[_0x0e00('0x2')](_0x38385b,_0x1856cf);};}function removeListener(_0x221c22,_0x57b460){return function(){CmListEvents[_0x0e00('0x3')](_0x221c22,_0x57b460);};}exports[_0x0e00('0x4')]=function(_0x58d475){for(var _0x57075b=0x0,_0x37a083=events['length'];_0x57075b<_0x37a083;_0x57075b++){var _0x4a7646=events[_0x57075b];var _0x1a84dd=createListener(_0x0e00('0x5')+_0x4a7646,_0x58d475);CmListEvents['on'](_0x4a7646,_0x1a84dd);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 36b2aaa..c54c2de 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 _0x4d0b=['getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x18ead4,_0x71f159){var _0x3aedbb=function(_0x4028fd){while(--_0x4028fd){_0x18ead4['push'](_0x18ead4['shift']());}};_0x3aedbb(++_0x71f159);}(_0x4d0b,0x1d5));var _0xb4d0=function(_0x5ea06a,_0x3135cd){_0x5ea06a=_0x5ea06a-0x0;var _0xd760f9=_0x4d0b[_0x5ea06a];return _0xd760f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb4d0('0x0'));var timeout=require(_0xb4d0('0x1'));var express=require(_0xb4d0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb4d0('0x3'));var interaction=require(_0xb4d0('0x4'));var config=require(_0xb4d0('0x5'));var controller=require(_0xb4d0('0x6'));router[_0xb4d0('0x7')]('/',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x9')]);router[_0xb4d0('0x7')](_0xb4d0('0xa'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0xb')]);router['get'](_0xb4d0('0xc'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0xd')]);router['get'](_0xb4d0('0xe'),auth[_0xb4d0('0x8')](),controller['show']);router[_0xb4d0('0x7')](_0xb4d0('0xf'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x10')]);router[_0xb4d0('0x7')]('/:id/contacts',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x11')]);router['get'](_0xb4d0('0x12'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x13')]);router[_0xb4d0('0x7')](_0xb4d0('0x14'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x15')]);router[_0xb4d0('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xb4d0('0x16')]);router[_0xb4d0('0x17')]('/',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x18')]);router[_0xb4d0('0x17')]('/:id/dispositions',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x19')]);router[_0xb4d0('0x17')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xb4d0('0x1a')]);router[_0xb4d0('0x17')](_0xb4d0('0x14'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x1b')]);router[_0xb4d0('0x17')](_0xb4d0('0x1c'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x1d')]);router[_0xb4d0('0x1e')](_0xb4d0('0xe'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x1f')]);router[_0xb4d0('0x20')]('/:id',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x21')]);router['delete'](_0xb4d0('0xf'),auth[_0xb4d0('0x8')](),controller['removeDispositions']);router['delete'](_0xb4d0('0x1c'),auth[_0xb4d0('0x8')](),controller['removeAgents']);module[_0xb4d0('0x22')]=router; \ No newline at end of file +var _0xfe65=['/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','create','post','addDisposition','/:id/contacts','/:id/fields','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./cmList.controller','get','index','isAuthenticated','/:id','show','/:id/dispositions','getDispositions'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0xfe65,0xb7));var _0x5fe6=function(_0x23945f,_0x9d3e4e){_0x23945f=_0x23945f-0x0;var _0xa38592=_0xfe65[_0x23945f];return _0xa38592;};'use strict';var multer=require(_0x5fe6('0x0'));var util=require(_0x5fe6('0x1'));var path=require(_0x5fe6('0x2'));var timeout=require(_0x5fe6('0x3'));var express=require('express');var router=express[_0x5fe6('0x4')]();var fs_extra=require(_0x5fe6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5fe6('0x6'));var config=require('../../config/environment');var controller=require(_0x5fe6('0x7'));router[_0x5fe6('0x8')]('/',auth['isAuthenticated'](),controller[_0x5fe6('0x9')]);router[_0x5fe6('0x8')]('/describe',auth[_0x5fe6('0xa')](),controller['describe']);router[_0x5fe6('0x8')]('/global_fields',auth[_0x5fe6('0xa')](),controller['getGlobalCustomFields']);router[_0x5fe6('0x8')](_0x5fe6('0xb'),auth['isAuthenticated'](),controller[_0x5fe6('0xc')]);router[_0x5fe6('0x8')](_0x5fe6('0xd'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0xe')]);router[_0x5fe6('0x8')]('/:id/contacts',auth[_0x5fe6('0xa')](),controller['getContacts']);router[_0x5fe6('0x8')](_0x5fe6('0xf'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x10')]);router[_0x5fe6('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5fe6('0x11')]);router[_0x5fe6('0x8')](_0x5fe6('0x12'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x13')]);router['post']('/',auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x14')]);router[_0x5fe6('0x15')](_0x5fe6('0xd'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x16')]);router[_0x5fe6('0x15')](_0x5fe6('0x17'),auth['isAuthenticated'](),controller['addContacts']);router[_0x5fe6('0x15')](_0x5fe6('0x18'),auth['isAuthenticated'](),controller['addCustomField']);router[_0x5fe6('0x15')](_0x5fe6('0x12'),auth['isAuthenticated'](),controller[_0x5fe6('0x19')]);router[_0x5fe6('0x1a')](_0x5fe6('0xb'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x1b')]);router[_0x5fe6('0x1c')](_0x5fe6('0xb'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x1d')]);router['delete'](_0x5fe6('0xd'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x1e')]);router['delete'](_0x5fe6('0x12'),auth[_0x5fe6('0xa')](),controller[_0x5fe6('0x1f')]);module[_0x5fe6('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1792f68..648cf2c 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 _0xaf2e=['sequelize','VIRTUAL','STRING'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xaf2e,0x126));var _0xeaf2=function(_0x3d5a15,_0x38cf56){_0x3d5a15=_0x3d5a15-0x0;var _0x1e0cc7=_0xaf2e[_0x3d5a15];return _0x1e0cc7;};'use strict';var Sequelize=require(_0xeaf2('0x0'));module['exports']={'name':{'type':Sequelize[_0xeaf2('0x1')],'get':function(_0xa4089f){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xeaf2('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0xeaf2('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xeaf2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa647=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x1ec75d,_0x357c5e){var _0x1dd653=function(_0x33433e){while(--_0x33433e){_0x1ec75d['push'](_0x1ec75d['shift']());}};_0x1dd653(++_0x357c5e);}(_0xa647,0x107));var _0x7a64=function(_0x52c842,_0x9c60f4){_0x52c842=_0x52c842-0x0;var _0x58d520=_0xa647[_0x52c842];return _0x58d520;};'use strict';var Sequelize=require(_0x7a64('0x0'));module[_0x7a64('0x1')]={'name':{'type':Sequelize[_0x7a64('0x2')],'get':function(_0xa2b2d1){return this[_0x7a64('0x3')](_0x7a64('0x4'));}},'field':{'type':Sequelize[_0x7a64('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x7a64('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x7a64('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 41cf275..0ca3c8a 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x13dc03,_0x432a8c){var _0x233ffa=function(_0x226248){while(--_0x226248){_0x13dc03['push'](_0x13dc03['shift']());}};_0x233ffa(++_0x432a8c);}(_0x7a54,0x106));var _0x47a5=function(_0x22214b,_0x1eb9df){_0x22214b=_0x22214b-0x0;var _0x31a1ad=_0x7a54[_0x22214b];return _0x31a1ad;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5e7c47,_0x571c06){var _0x5a1714=function(_0x5e0f44){while(--_0x5e0f44){_0x5e7c47['push'](_0x5e7c47['shift']());}};_0x5a1714(++_0x571c06);}(_0x7a54,0x106));var _0x47a5=function(_0x729465,_0x2a3b2b){_0x729465=_0x729465-0x0;var _0x705cf0=_0x7a54[_0x729465];return _0x705cf0;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2f06e4a..370ac49 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 _0x4eee=['path','rimraf','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x4eee,0xe1));var _0xe4ee=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0x4eee[_0xcf4569];return _0x7fef;};'use strict';var _=require(_0xe4ee('0x0'));var util=require(_0xe4ee('0x1'));var logger=require(_0xe4ee('0x2'))(_0xe4ee('0x3'));var moment=require(_0xe4ee('0x4'));var BPromise=require(_0xe4ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4ee('0x6'));var rimraf=require(_0xe4ee('0x7'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module['exports']=function(_0x458ba2,_0x44b636){return _0x458ba2[_0xe4ee('0x8')](_0xe4ee('0x9'),attributes,{'tableName':_0xe4ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8036=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','Condition','tools_conditions'];(function(_0x1b3e27,_0x164472){var _0x453859=function(_0x35f135){while(--_0x35f135){_0x1b3e27['push'](_0x1b3e27['shift']());}};_0x453859(++_0x164472);}(_0x8036,0x114));var _0x6803=function(_0x174694,_0x5b3d9b){_0x174694=_0x174694-0x0;var _0x4a074f=_0x8036[_0x174694];return _0x4a074f;};'use strict';var _=require('lodash');var util=require(_0x6803('0x0'));var logger=require(_0x6803('0x1'))(_0x6803('0x2'));var moment=require(_0x6803('0x3'));var BPromise=require(_0x6803('0x4'));var rp=require(_0x6803('0x5'));var fs=require('fs');var path=require(_0x6803('0x6'));var rimraf=require('rimraf');var config=require(_0x6803('0x7'));var attributes=require(_0x6803('0x8'));module[_0x6803('0x9')]=function(_0x12fb66,_0x34b4d3){return _0x12fb66['define'](_0x6803('0xa'),attributes,{'tableName':_0x6803('0xb'),'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 c8a052a..345bb89 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 _0xd8d3=['stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c42d1,_0x3258b6){var _0x4aecdc=function(_0x4a4238){while(--_0x4a4238){_0x3c42d1['push'](_0x3c42d1['shift']());}};_0x4aecdc(++_0x3258b6);}(_0xd8d3,0x8a));var _0x3d8d=function(_0x39c6ff,_0x5e1d26){_0x39c6ff=_0x39c6ff-0x0;var _0x20b85e=_0xd8d3[_0x39c6ff];return _0x20b85e;};'use strict';var _=require('lodash');var util=require(_0x3d8d('0x0'));var moment=require(_0x3d8d('0x1'));var BPromise=require(_0x3d8d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d8d('0x3'));var db=require(_0x3d8d('0x4'))['db'];var utils=require(_0x3d8d('0x5'));var logger=require(_0x3d8d('0x6'))(_0x3d8d('0x7'));var config=require(_0x3d8d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3d8d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bdf09,_0x27d147,_0x7bad8a){return new BPromise(function(_0x245201,_0x3d8d95){return client[_0x3d8d('0xa')](_0x2bdf09,_0x7bad8a)[_0x3d8d('0xb')](function(_0x215d47){logger[_0x3d8d('0xc')](_0x3d8d('0xd'),_0x27d147,_0x3d8d('0xe'));logger[_0x3d8d('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x27d147,_0x3d8d('0xe'),JSON[_0x3d8d('0x10')](_0x215d47));if(_0x215d47['error']){if(_0x215d47[_0x3d8d('0x11')][_0x3d8d('0x12')]===0x1f4){logger[_0x3d8d('0x11')](_0x3d8d('0xd'),_0x27d147,_0x215d47[_0x3d8d('0x11')][_0x3d8d('0x13')]);return _0x3d8d95(_0x215d47[_0x3d8d('0x11')][_0x3d8d('0x13')]);}logger[_0x3d8d('0x11')](_0x3d8d('0xd'),_0x27d147,_0x215d47[_0x3d8d('0x11')]['message']);return _0x245201(_0x215d47[_0x3d8d('0x11')][_0x3d8d('0x13')]);}else{logger[_0x3d8d('0xc')](_0x3d8d('0xd'),_0x27d147,_0x3d8d('0xe'));_0x245201(_0x215d47[_0x3d8d('0x14')][_0x3d8d('0x13')]);}})[_0x3d8d('0x15')](function(_0x523e69){logger['error'](_0x3d8d('0xd'),_0x27d147,_0x523e69);_0x3d8d95(_0x523e69);});});} \ No newline at end of file +var _0x9981=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x128bdb,_0x57c86a){var _0x4b6bf2=function(_0x220f09){while(--_0x220f09){_0x128bdb['push'](_0x128bdb['shift']());}};_0x4b6bf2(++_0x57c86a);}(_0x9981,0xa7));var _0x1998=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x9981[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x1998('0x0'));var util=require(_0x1998('0x1'));var moment=require(_0x1998('0x2'));var BPromise=require(_0x1998('0x3'));var rs=require(_0x1998('0x4'));var fs=require('fs');var Redis=require(_0x1998('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1998('0x6'));var logger=require(_0x1998('0x7'))(_0x1998('0x8'));var config=require(_0x1998('0x9'));var jayson=require(_0x1998('0xa'));var client=jayson[_0x1998('0xb')][_0x1998('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13caac,_0x29eed3,_0x4eea32){return new BPromise(function(_0x27211,_0x4bc973){return client[_0x1998('0xd')](_0x13caac,_0x4eea32)[_0x1998('0xe')](function(_0x5e9eef){logger[_0x1998('0xf')](_0x1998('0x10'),_0x29eed3,_0x1998('0x11'));logger[_0x1998('0x12')]('Condition,\x20%s,\x20%s,\x20%s',_0x29eed3,_0x1998('0x11'),JSON[_0x1998('0x13')](_0x5e9eef));if(_0x5e9eef[_0x1998('0x14')]){if(_0x5e9eef['error']['code']===0x1f4){logger[_0x1998('0x14')](_0x1998('0x10'),_0x29eed3,_0x5e9eef[_0x1998('0x14')][_0x1998('0x15')]);return _0x4bc973(_0x5e9eef[_0x1998('0x14')][_0x1998('0x15')]);}logger['error'](_0x1998('0x10'),_0x29eed3,_0x5e9eef[_0x1998('0x14')][_0x1998('0x15')]);return _0x27211(_0x5e9eef[_0x1998('0x14')][_0x1998('0x15')]);}else{logger[_0x1998('0xf')](_0x1998('0x10'),_0x29eed3,_0x1998('0x11'));_0x27211(_0x5e9eef[_0x1998('0x16')][_0x1998('0x15')]);}})[_0x1998('0x17')](function(_0x4fe0f7){logger['error']('Condition,\x20%s,\x20%s',_0x29eed3,_0x4fe0f7);_0x4bc973(_0x4fe0f7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6a43032..714556a 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 _0x49ca=['Router','fs-extra','../../config/environment','./condition.controller','put','isAuthenticated','update','/:id','exports','multer','util','express'];(function(_0x29af75,_0x152b87){var _0x32b56b=function(_0x5460fe){while(--_0x5460fe){_0x29af75['push'](_0x29af75['shift']());}};_0x32b56b(++_0x152b87);}(_0x49ca,0x129));var _0xa49c=function(_0x145550,_0x492e9c){_0x145550=_0x145550-0x0;var _0x4c558c=_0x49ca[_0x145550];return _0x4c558c;};'use strict';var multer=require(_0xa49c('0x0'));var util=require(_0xa49c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa49c('0x2'));var router=express[_0xa49c('0x3')]();var fs_extra=require(_0xa49c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa49c('0x5'));var controller=require(_0xa49c('0x6'));router[_0xa49c('0x7')]('/:id',auth[_0xa49c('0x8')](),controller[_0xa49c('0x9')]);router['delete'](_0xa49c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa49c('0xb')]=router; \ No newline at end of file +var _0x448c=['destroy','multer','util','path','express','Router','../../components/auth/service','put','/:id','isAuthenticated','update'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x448c,0x9b));var _0xc448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x448c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc448('0x0'));var util=require(_0xc448('0x1'));var path=require(_0xc448('0x2'));var timeout=require('connect-timeout');var express=require(_0xc448('0x3'));var router=express[_0xc448('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc448('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xc448('0x6')](_0xc448('0x7'),auth[_0xc448('0x8')](),controller[_0xc448('0x9')]);router['delete'](_0xc448('0x7'),auth[_0xc448('0x8')](),controller[_0xc448('0xa')]);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 eee8442..846cfb1 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 _0x1588=['INTEGER','sequelize','exports','STRING','name'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1588,0x132));var _0x8158=function(_0x5557b1,_0x17ab88){_0x5557b1=_0x5557b1-0x0;var _0x710c45=_0x1588[_0x5557b1];return _0x710c45;};'use strict';var Sequelize=require(_0x8158('0x0'));module[_0x8158('0x1')]={'name':{'type':Sequelize[_0x8158('0x2')],'allowNull':![],'unique':_0x8158('0x3')},'OrderBy':{'type':Sequelize[_0x8158('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8158('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x639a=['INTEGER','sequelize','exports','STRING','name'];(function(_0xd95114,_0x403ece){var _0x3275af=function(_0x40f48f){while(--_0x40f48f){_0xd95114['push'](_0xd95114['shift']());}};_0x3275af(++_0x403ece);}(_0x639a,0x137));var _0xa639=function(_0x259bf2,_0xc48e54){_0x259bf2=_0x259bf2-0x0;var _0x3183dc=_0x639a[_0x259bf2];return _0x3183dc;};'use strict';var Sequelize=require(_0xa639('0x0'));module[_0xa639('0x1')]={'name':{'type':Sequelize[_0xa639('0x2')],'allowNull':![],'unique':_0xa639('0x3')},'OrderBy':{'type':Sequelize[_0xa639('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 3203e1e..092b1f0 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 _0x8f59=['index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','ContactItemType','includeAll','findAll','show','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','ContactItemTypes','end','stack','name','send'];(function(_0x2a60c9,_0x61afad){var _0x291d16=function(_0x5f0360){while(--_0x5f0360){_0x2a60c9['push'](_0x2a60c9['shift']());}};_0x291d16(++_0x61afad);}(_0x8f59,0x11d));var _0x98f5=function(_0x4aee8a,_0x3198e2){_0x4aee8a=_0x4aee8a-0x0;var _0x51fddb=_0x8f59[_0x4aee8a];return _0x51fddb;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];function respondWithStatusCode(_0x259abe,_0x1f00e8){_0x1f00e8=_0x1f00e8||0xcc;return function(_0x160626){if(_0x160626){return _0x259abe[_0x98f5('0x18')](_0x1f00e8);}return _0x259abe[_0x98f5('0x19')](_0x1f00e8)['end']();};}function respondWithResult(_0x24a7a9,_0xbade31){_0xbade31=_0xbade31||0xc8;return function(_0x5b8bab){if(_0x5b8bab){return _0x24a7a9[_0x98f5('0x19')](_0xbade31)[_0x98f5('0x1a')](_0x5b8bab);}};}function respondWithFilteredResult(_0xaa951a,_0x4ae70d){return function(_0x2437e7){if(_0x2437e7){var _0xc7a49b=typeof _0x4ae70d[_0x98f5('0x1b')]==='undefined'&&typeof _0x4ae70d[_0x98f5('0x1c')]===_0x98f5('0x1d');var _0x574644=_0x2437e7[_0x98f5('0x1e')];var _0x51a567=_0xc7a49b?0x0:_0x4ae70d[_0x98f5('0x1b')];var _0x9e42dd=_0xc7a49b?_0x2437e7[_0x98f5('0x1e')]:_0x4ae70d[_0x98f5('0x1b')]+_0x4ae70d[_0x98f5('0x1c')];var _0xa4477c;if(_0x9e42dd>=_0x574644){_0x9e42dd=_0x574644;_0xa4477c=0xc8;}else{_0xa4477c=0xce;}_0xaa951a['status'](_0xa4477c);return _0xaa951a[_0x98f5('0x1f')]('Content-Range',_0x51a567+'-'+_0x9e42dd+'/'+_0x574644)[_0x98f5('0x1a')](_0x2437e7);}return null;};}function patchUpdates(_0x191f23){return function(_0x5deca0){try{jsonpatch[_0x98f5('0x20')](_0x5deca0,_0x191f23,!![]);}catch(_0x2933d1){return BPromise[_0x98f5('0x21')](_0x2933d1);}return _0x5deca0[_0x98f5('0x22')]();};}function saveUpdates(_0x3b2d9d,_0x3dc7c2){return function(_0x38b46d){if(_0x38b46d){return _0x38b46d['update'](_0x3b2d9d)[_0x98f5('0x23')](function(_0x49ee4e){return _0x49ee4e;});}return null;};}function removeEntity(_0xcb10d6,_0x495889){return function(_0x44bfbb){if(_0x44bfbb){return _0x44bfbb[_0x98f5('0x24')]()[_0x98f5('0x23')](function(){var _0x5c64e=_0x44bfbb[_0x98f5('0x25')]({'plain':!![]});var _0x18052d=_0x98f5('0x26');return db['UserProfileResource'][_0x98f5('0x24')]({'where':{'type':_0x18052d,'resourceId':_0x5c64e['id']}})[_0x98f5('0x23')](function(){return _0x44bfbb;});})['then'](function(){_0xcb10d6[_0x98f5('0x19')](0xcc)[_0x98f5('0x27')]();});}};}function handleEntityNotFound(_0x5b08c2,_0x214130){return function(_0x230d1b){if(!_0x230d1b){_0x5b08c2[_0x98f5('0x18')](0x194);}return _0x230d1b;};}function handleError(_0x17dcb2,_0x2b6993){_0x2b6993=_0x2b6993||0x1f4;return function(_0x576c4b){logger['error'](_0x576c4b[_0x98f5('0x28')]);if(_0x576c4b[_0x98f5('0x29')]){delete _0x576c4b[_0x98f5('0x29')];}_0x17dcb2[_0x98f5('0x19')](_0x2b6993)[_0x98f5('0x2a')](_0x576c4b);};}exports[_0x98f5('0x2b')]=function(_0x5e9d73,_0x29e1f5){var _0x6d7418={},_0x7a922b={},_0xd20823={'count':0x0,'rows':[]};var _0x1e7138=_[_0x98f5('0x2c')](db['ContactItemType'][_0x98f5('0x2d')],function(_0x4d4b5c){return{'name':_0x4d4b5c[_0x98f5('0x2e')],'type':_0x4d4b5c[_0x98f5('0x2f')]['key']};});_0x7a922b[_0x98f5('0x30')]=_[_0x98f5('0x2c')](_0x1e7138,_0x98f5('0x29'));_0x7a922b[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x5e9d73[_0x98f5('0x31')]);_0x7a922b[_0x98f5('0x33')]=_[_0x98f5('0x34')](_0x7a922b[_0x98f5('0x30')],_0x7a922b[_0x98f5('0x31')]);_0x6d7418[_0x98f5('0x35')]=_[_0x98f5('0x34')](_0x7a922b[_0x98f5('0x30')],qs[_0x98f5('0x36')](_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x36')]));_0x6d7418[_0x98f5('0x35')]=_0x6d7418[_0x98f5('0x35')][_0x98f5('0x37')]?_0x6d7418[_0x98f5('0x35')]:_0x7a922b['model'];if(!_0x5e9d73[_0x98f5('0x31')]['hasOwnProperty']('nolimit')){_0x6d7418[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x1c')]);_0x6d7418['offset']=qs[_0x98f5('0x1b')](_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x1b')]);}_0x6d7418['order']=qs[_0x98f5('0x38')](_0x5e9d73[_0x98f5('0x31')]['sort']);_0x6d7418[_0x98f5('0x39')]=qs[_0x98f5('0x33')](_[_0x98f5('0x3a')](_0x5e9d73['query'],_0x7a922b[_0x98f5('0x33')]),_0x1e7138);if(_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x3b')]){_0x6d7418[_0x98f5('0x39')]=_[_0x98f5('0x3c')](_0x6d7418['where'],{'$or':_['map'](_0x1e7138,function(_0x46cb30){if(_0x46cb30[_0x98f5('0x2f')]!==_0x98f5('0x3d')){var _0x3d7a4f={};_0x3d7a4f[_0x46cb30[_0x98f5('0x29')]]={'$like':'%'+_0x5e9d73[_0x98f5('0x31')]['filter']+'%'};return _0x3d7a4f;}})});}_0x6d7418=_['merge']({},_0x6d7418,_0x5e9d73[_0x98f5('0x3e')]);var _0xd74af2={'where':_0x6d7418[_0x98f5('0x39')]};return db[_0x98f5('0x3f')]['count'](_0xd74af2)['then'](function(_0x2dafcd){_0xd20823[_0x98f5('0x1e')]=_0x2dafcd;if(_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x40')]){_0x6d7418['include']=[{'all':!![]}];}return db['ContactItemType'][_0x98f5('0x41')](_0x6d7418);})[_0x98f5('0x23')](function(_0x372c33){_0xd20823['rows']=_0x372c33;return _0xd20823;})[_0x98f5('0x23')](respondWithFilteredResult(_0x29e1f5,_0x6d7418))['catch'](handleError(_0x29e1f5,null));};exports[_0x98f5('0x42')]=function(_0x4ff7b0,_0x45d732){var _0x166e05={'raw':!![],'where':{'id':_0x4ff7b0['params']['id']}},_0x1b8d40={};_0x1b8d40[_0x98f5('0x30')]=_[_0x98f5('0x32')](db['ContactItemType'][_0x98f5('0x2d')]);_0x1b8d40[_0x98f5('0x31')]=_['keys'](_0x4ff7b0[_0x98f5('0x31')]);_0x1b8d40['filters']=_[_0x98f5('0x34')](_0x1b8d40[_0x98f5('0x30')],_0x1b8d40['query']);_0x166e05['attributes']=_['intersection'](_0x1b8d40['model'],qs[_0x98f5('0x36')](_0x4ff7b0['query'][_0x98f5('0x36')]));_0x166e05[_0x98f5('0x35')]=_0x166e05[_0x98f5('0x35')][_0x98f5('0x37')]?_0x166e05[_0x98f5('0x35')]:_0x1b8d40[_0x98f5('0x30')];if(_0x4ff7b0['query'][_0x98f5('0x40')]){_0x166e05[_0x98f5('0x43')]=[{'all':!![]}];}_0x166e05=_[_0x98f5('0x3c')]({},_0x166e05,_0x4ff7b0[_0x98f5('0x3e')]);return db[_0x98f5('0x3f')][_0x98f5('0x44')](_0x166e05)['then'](handleEntityNotFound(_0x45d732,null))[_0x98f5('0x23')](respondWithResult(_0x45d732,null))[_0x98f5('0x45')](handleError(_0x45d732,null));};exports[_0x98f5('0x46')]=function(_0x1d4b3b,_0x4a0cda){return db[_0x98f5('0x3f')][_0x98f5('0x46')](_0x1d4b3b[_0x98f5('0x47')],{})[_0x98f5('0x23')](function(_0x269861){var _0x4da817=_0x1d4b3b[_0x98f5('0x48')][_0x98f5('0x25')]({'plain':!![]});if(!_0x4da817)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4da817[_0x98f5('0x49')]==='user'){var _0x27ed57=_0x269861['get']({'plain':!![]});var _0x1bd2b9=_0x98f5('0x26');return db[_0x98f5('0x4a')]['find']({'where':{'name':_0x1bd2b9,'userProfileId':_0x4da817[_0x98f5('0x4b')]},'raw':!![]})[_0x98f5('0x23')](function(_0x1503fa){if(_0x1503fa&&_0x1503fa[_0x98f5('0x4c')]===0x0){return db[_0x98f5('0x4d')][_0x98f5('0x46')]({'name':_0x27ed57[_0x98f5('0x29')],'resourceId':_0x27ed57['id'],'type':_0x1503fa[_0x98f5('0x29')],'sectionId':_0x1503fa['id']},{})[_0x98f5('0x23')](function(){return _0x269861;});}else{return _0x269861;}})[_0x98f5('0x45')](function(_0x50343c){logger[_0x98f5('0x4e')](_0x98f5('0x4f'),_0x50343c);throw _0x50343c;});}return _0x269861;})[_0x98f5('0x23')](respondWithResult(_0x4a0cda,0xc9))[_0x98f5('0x45')](handleError(_0x4a0cda,null));};exports[_0x98f5('0x50')]=function(_0x23e955,_0x5c565d){if(_0x23e955[_0x98f5('0x47')]['id']){delete _0x23e955[_0x98f5('0x47')]['id'];}return db[_0x98f5('0x3f')][_0x98f5('0x44')]({'where':{'id':_0x23e955[_0x98f5('0x51')]['id']}})[_0x98f5('0x23')](handleEntityNotFound(_0x5c565d,null))['then'](saveUpdates(_0x23e955['body'],null))['then'](respondWithResult(_0x5c565d,null))[_0x98f5('0x45')](handleError(_0x5c565d,null));};exports[_0x98f5('0x24')]=function(_0x372c49,_0x1c5fb2){return db['ContactItemType'][_0x98f5('0x44')]({'where':{'id':_0x372c49['params']['id']}})[_0x98f5('0x23')](handleEntityNotFound(_0x1c5fb2,null))['then'](db['CmContactHasItem'][_0x98f5('0x50')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x372c49[_0x98f5('0x51')]['id']}}))[_0x98f5('0x23')](removeEntity(_0x1c5fb2,null))['catch'](handleError(_0x1c5fb2,null));}; \ No newline at end of file +var _0xf61e=['sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','UserProfileResource','status','error','stack','name','send','index','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','ContactItemType','includeAll','include','findAll','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xf61e,0x191));var _0xef61=function(_0x2942a3,_0x260e49){_0x2942a3=_0x2942a3-0x0;var _0x5cf5c1=_0xf61e[_0x2942a3];return _0x5cf5c1;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){var _0x111bac=_0xfbee94['get']({'plain':!![]});var _0x16b144='ContactItemTypes';return db[_0xef61('0x29')][_0xef61('0x27')]({'where':{'type':_0x16b144,'resourceId':_0x111bac['id']}})[_0xef61('0x28')](function(){return _0xfbee94;});})[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x2a')](0xcc)[_0xef61('0x1e')]();});}};}function handleEntityNotFound(_0x258b5a,_0x23837f){return function(_0x297df7){if(!_0x297df7){_0x258b5a[_0xef61('0x1d')](0x194);}return _0x297df7;};}function handleError(_0x3a16ba,_0x18426f){_0x18426f=_0x18426f||0x1f4;return function(_0xeb9a62){logger[_0xef61('0x2b')](_0xeb9a62[_0xef61('0x2c')]);if(_0xeb9a62[_0xef61('0x2d')]){delete _0xeb9a62[_0xef61('0x2d')];}_0x3a16ba[_0xef61('0x2a')](_0x18426f)[_0xef61('0x2e')](_0xeb9a62);};}exports[_0xef61('0x2f')]=function(_0x43bc47,_0x53fa3b){var _0x4f35ad={},_0x51d5d1={},_0x38b522={'count':0x0,'rows':[]};var _0x36713e=_[_0xef61('0x30')](db['ContactItemType'][_0xef61('0x31')],function(_0x21d6f0){return{'name':_0x21d6f0['fieldName'],'type':_0x21d6f0[_0xef61('0x32')]['key']};});_0x51d5d1['model']=_[_0xef61('0x30')](_0x36713e,'name');_0x51d5d1[_0xef61('0x33')]=_['keys'](_0x43bc47[_0xef61('0x33')]);_0x51d5d1[_0xef61('0x34')]=_[_0xef61('0x35')](_0x51d5d1[_0xef61('0x36')],_0x51d5d1[_0xef61('0x33')]);_0x4f35ad[_0xef61('0x37')]=_[_0xef61('0x35')](_0x51d5d1[_0xef61('0x36')],qs[_0xef61('0x38')](_0x43bc47[_0xef61('0x33')]['fields']));_0x4f35ad[_0xef61('0x37')]=_0x4f35ad[_0xef61('0x37')][_0xef61('0x39')]?_0x4f35ad[_0xef61('0x37')]:_0x51d5d1[_0xef61('0x36')];if(!_0x43bc47['query'][_0xef61('0x3a')](_0xef61('0x3b'))){_0x4f35ad[_0xef61('0x23')]=qs['limit'](_0x43bc47['query']['limit']);_0x4f35ad[_0xef61('0x20')]=qs['offset'](_0x43bc47['query']['offset']);}_0x4f35ad[_0xef61('0x3c')]=qs[_0xef61('0x3d')](_0x43bc47[_0xef61('0x33')]['sort']);_0x4f35ad['where']=qs['filters'](_[_0xef61('0x3e')](_0x43bc47[_0xef61('0x33')],_0x51d5d1['filters']),_0x36713e);if(_0x43bc47[_0xef61('0x33')][_0xef61('0x3f')]){_0x4f35ad[_0xef61('0x40')]=_[_0xef61('0x41')](_0x4f35ad['where'],{'$or':_[_0xef61('0x30')](_0x36713e,function(_0x184063){if(_0x184063[_0xef61('0x32')]!==_0xef61('0x42')){var _0x54410d={};_0x54410d[_0x184063['name']]={'$like':'%'+_0x43bc47[_0xef61('0x33')][_0xef61('0x3f')]+'%'};return _0x54410d;}})});}_0x4f35ad=_[_0xef61('0x41')]({},_0x4f35ad,_0x43bc47['options']);var _0x3eee46={'where':_0x4f35ad[_0xef61('0x40')]};return db[_0xef61('0x43')][_0xef61('0x22')](_0x3eee46)['then'](function(_0x545597){_0x38b522['count']=_0x545597;if(_0x43bc47[_0xef61('0x33')][_0xef61('0x44')]){_0x4f35ad[_0xef61('0x45')]=[{'all':!![]}];}return db[_0xef61('0x43')][_0xef61('0x46')](_0x4f35ad);})[_0xef61('0x28')](function(_0xc9b467){_0x38b522['rows']=_0xc9b467;return _0x38b522;})[_0xef61('0x28')](respondWithFilteredResult(_0x53fa3b,_0x4f35ad))[_0xef61('0x47')](handleError(_0x53fa3b,null));};exports[_0xef61('0x48')]=function(_0x898c74,_0x51fac1){var _0x17279b={'raw':!![],'where':{'id':_0x898c74[_0xef61('0x49')]['id']}},_0x4686df={};_0x4686df[_0xef61('0x36')]=_[_0xef61('0x4a')](db[_0xef61('0x43')]['rawAttributes']);_0x4686df[_0xef61('0x33')]=_[_0xef61('0x4a')](_0x898c74[_0xef61('0x33')]);_0x4686df['filters']=_[_0xef61('0x35')](_0x4686df[_0xef61('0x36')],_0x4686df[_0xef61('0x33')]);_0x17279b[_0xef61('0x37')]=_[_0xef61('0x35')](_0x4686df[_0xef61('0x36')],qs['fields'](_0x898c74[_0xef61('0x33')][_0xef61('0x38')]));_0x17279b['attributes']=_0x17279b[_0xef61('0x37')][_0xef61('0x39')]?_0x17279b[_0xef61('0x37')]:_0x4686df[_0xef61('0x36')];if(_0x898c74['query'][_0xef61('0x44')]){_0x17279b[_0xef61('0x45')]=[{'all':!![]}];}_0x17279b=_[_0xef61('0x41')]({},_0x17279b,_0x898c74['options']);return db[_0xef61('0x43')][_0xef61('0x4b')](_0x17279b)['then'](handleEntityNotFound(_0x51fac1,null))[_0xef61('0x28')](respondWithResult(_0x51fac1,null))[_0xef61('0x47')](handleError(_0x51fac1,null));};exports[_0xef61('0x4c')]=function(_0x2904e0,_0x13bb20){return db[_0xef61('0x43')][_0xef61('0x4c')](_0x2904e0['body'],{})[_0xef61('0x28')](function(_0x505631){var _0x89c04e=_0x2904e0[_0xef61('0x4d')][_0xef61('0x4e')]({'plain':!![]});if(!_0x89c04e)throw new Error(_0xef61('0x4f'));if(_0x89c04e[_0xef61('0x50')]===_0xef61('0x4d')){var _0x3e23eb=_0x505631[_0xef61('0x4e')]({'plain':!![]});var _0x264877='ContactItemTypes';return db[_0xef61('0x51')][_0xef61('0x4b')]({'where':{'name':_0x264877,'userProfileId':_0x89c04e['userProfileId']},'raw':!![]})['then'](function(_0x122251){if(_0x122251&&_0x122251[_0xef61('0x52')]===0x0){return db['UserProfileResource'][_0xef61('0x4c')]({'name':_0x3e23eb['name'],'resourceId':_0x3e23eb['id'],'type':_0x122251[_0xef61('0x2d')],'sectionId':_0x122251['id']},{})[_0xef61('0x28')](function(){return _0x505631;});}else{return _0x505631;}})[_0xef61('0x47')](function(_0x2533f2){logger[_0xef61('0x2b')](_0xef61('0x53'),_0x2533f2);throw _0x2533f2;});}return _0x505631;})['then'](respondWithResult(_0x13bb20,0xc9))[_0xef61('0x47')](handleError(_0x13bb20,null));};exports[_0xef61('0x54')]=function(_0x5373f5,_0x29863d){if(_0x5373f5[_0xef61('0x55')]['id']){delete _0x5373f5['body']['id'];}return db['ContactItemType'][_0xef61('0x4b')]({'where':{'id':_0x5373f5['params']['id']}})['then'](handleEntityNotFound(_0x29863d,null))['then'](saveUpdates(_0x5373f5[_0xef61('0x55')],null))[_0xef61('0x28')](respondWithResult(_0x29863d,null))['catch'](handleError(_0x29863d,null));};exports[_0xef61('0x27')]=function(_0x1928a5,_0x34ae9d){return db[_0xef61('0x43')][_0xef61('0x4b')]({'where':{'id':_0x1928a5[_0xef61('0x49')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x34ae9d,null))[_0xef61('0x28')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1928a5[_0xef61('0x49')]['id']}}))[_0xef61('0x28')](removeEntity(_0x34ae9d,null))[_0xef61('0x47')](handleError(_0x34ae9d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 88e0ac5..c624169 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 _0x8888=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x4c0f27,_0x13e7ac){var _0x2513a6=function(_0x50e5ea){while(--_0x50e5ea){_0x4c0f27['push'](_0x4c0f27['shift']());}};_0x2513a6(++_0x13e7ac);}(_0x8888,0xfb));var _0x8888=function(_0xb02645,_0x55de61){_0xb02645=_0xb02645-0x0;var _0x39463e=_0x8888[_0xb02645];return _0x39463e;};'use strict';var _=require(_0x8888('0x0'));var util=require('util');var logger=require(_0x8888('0x1'))(_0x8888('0x2'));var moment=require(_0x8888('0x3'));var BPromise=require(_0x8888('0x4'));var rp=require(_0x8888('0x5'));var fs=require('fs');var path=require(_0x8888('0x6'));var rimraf=require(_0x8888('0x7'));var config=require(_0x8888('0x8'));var attributes=require(_0x8888('0x9'));module[_0x8888('0xa')]=function(_0x286844,_0x2ab2b0){return _0x286844[_0x8888('0xb')](_0x8888('0xc'),attributes,{'tableName':_0x8888('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2306=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','tools_contact_item_types','lodash','../../config/logger'];(function(_0x1339af,_0x221dc4){var _0x2e9cb0=function(_0x424114){while(--_0x424114){_0x1339af['push'](_0x1339af['shift']());}};_0x2e9cb0(++_0x221dc4);}(_0x2306,0xa3));var _0x6230=function(_0x12671d,_0x15255b){_0x12671d=_0x12671d-0x0;var _0x38463f=_0x2306[_0x12671d];return _0x38463f;};'use strict';var _=require(_0x6230('0x0'));var util=require('util');var logger=require(_0x6230('0x1'))(_0x6230('0x2'));var moment=require(_0x6230('0x3'));var BPromise=require(_0x6230('0x4'));var rp=require(_0x6230('0x5'));var fs=require('fs');var path=require(_0x6230('0x6'));var rimraf=require('rimraf');var config=require(_0x6230('0x7'));var attributes=require('./contactItemType.attributes');module[_0x6230('0x8')]=function(_0xfd029c,_0x260158){return _0xfd029c[_0x6230('0x9')]('ContactItemType',attributes,{'tableName':_0x6230('0xa'),'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 b80f3ee..67838a1 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 _0x802b=['ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d22dc,_0x5eaa1c){var _0x4dd41b=function(_0x13c4d9){while(--_0x13c4d9){_0x5d22dc['push'](_0x5d22dc['shift']());}};_0x4dd41b(++_0x5eaa1c);}(_0x802b,0x103));var _0xb802=function(_0x3595de,_0x43ab3b){_0x3595de=_0x3595de-0x0;var _0x58a255=_0x802b[_0x3595de];return _0x58a255;};'use strict';var _=require('lodash');var util=require(_0xb802('0x0'));var moment=require('moment');var BPromise=require(_0xb802('0x1'));var rs=require(_0xb802('0x2'));var fs=require('fs');var Redis=require(_0xb802('0x3'));var db=require(_0xb802('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb802('0x5'));var config=require(_0xb802('0x6'));var jayson=require(_0xb802('0x7'));var client=jayson[_0xb802('0x8')][_0xb802('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a647d,_0x4aba45,_0x377cbc){return new BPromise(function(_0x45f345,_0x5ce81f){return client['request'](_0x2a647d,_0x377cbc)[_0xb802('0xa')](function(_0x1a535b){logger['info'](_0xb802('0xb'),_0x4aba45,_0xb802('0xc'));logger[_0xb802('0xd')](_0xb802('0xe'),_0x4aba45,'request\x20sent',JSON['stringify'](_0x1a535b));if(_0x1a535b['error']){if(_0x1a535b[_0xb802('0xf')][_0xb802('0x10')]===0x1f4){logger[_0xb802('0xf')](_0xb802('0xb'),_0x4aba45,_0x1a535b[_0xb802('0xf')][_0xb802('0x11')]);return _0x5ce81f(_0x1a535b[_0xb802('0xf')][_0xb802('0x11')]);}logger[_0xb802('0xf')](_0xb802('0xb'),_0x4aba45,_0x1a535b[_0xb802('0xf')][_0xb802('0x11')]);return _0x45f345(_0x1a535b['error']['message']);}else{logger[_0xb802('0x12')](_0xb802('0xb'),_0x4aba45,'request\x20sent');_0x45f345(_0x1a535b[_0xb802('0x13')][_0xb802('0x11')]);}})[_0xb802('0x14')](function(_0x5332fd){logger[_0xb802('0xf')](_0xb802('0xb'),_0x4aba45,_0x5332fd);_0x5ce81f(_0x5332fd);});});} \ No newline at end of file +var _0xe5ad=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe5ad,0x110));var _0xde5a=function(_0x526d1a,_0x5b964d){_0x526d1a=_0x526d1a-0x0;var _0x12b6a2=_0xe5ad[_0x526d1a];return _0x12b6a2;};'use strict';var _=require(_0xde5a('0x0'));var util=require(_0xde5a('0x1'));var moment=require('moment');var BPromise=require(_0xde5a('0x2'));var rs=require(_0xde5a('0x3'));var fs=require('fs');var Redis=require(_0xde5a('0x4'));var db=require(_0xde5a('0x5'))['db'];var utils=require(_0xde5a('0x6'));var logger=require(_0xde5a('0x7'))(_0xde5a('0x8'));var config=require(_0xde5a('0x9'));var jayson=require(_0xde5a('0xa'));var client=jayson[_0xde5a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ab91e,_0x2805c8,_0x317941){return new BPromise(function(_0x5cce95,_0x2e7b53){return client[_0xde5a('0xc')](_0x1ab91e,_0x317941)['then'](function(_0x12b3f2){logger[_0xde5a('0xd')](_0xde5a('0xe'),_0x2805c8,_0xde5a('0xf'));logger[_0xde5a('0x10')](_0xde5a('0x11'),_0x2805c8,_0xde5a('0xf'),JSON[_0xde5a('0x12')](_0x12b3f2));if(_0x12b3f2[_0xde5a('0x13')]){if(_0x12b3f2[_0xde5a('0x13')]['code']===0x1f4){logger['error'](_0xde5a('0xe'),_0x2805c8,_0x12b3f2[_0xde5a('0x13')][_0xde5a('0x14')]);return _0x2e7b53(_0x12b3f2['error'][_0xde5a('0x14')]);}logger[_0xde5a('0x13')](_0xde5a('0xe'),_0x2805c8,_0x12b3f2[_0xde5a('0x13')][_0xde5a('0x14')]);return _0x5cce95(_0x12b3f2[_0xde5a('0x13')]['message']);}else{logger[_0xde5a('0xd')](_0xde5a('0xe'),_0x2805c8,'request\x20sent');_0x5cce95(_0x12b3f2[_0xde5a('0x15')][_0xde5a('0x14')]);}})[_0xde5a('0x16')](function(_0x2777ed){logger[_0xde5a('0x13')]('ContactItemType,\x20%s,\x20%s',_0x2805c8,_0x2777ed);_0x2e7b53(_0x2777ed);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6198912..6e4e78c 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 _0xdcd3=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get'];(function(_0x12eca4,_0x45eafb){var _0xc48aca=function(_0x4c8ecc){while(--_0x4c8ecc){_0x12eca4['push'](_0x12eca4['shift']());}};_0xc48aca(++_0x45eafb);}(_0xdcd3,0x15f));var _0x3dcd=function(_0x44bd70,_0x5e891c){_0x44bd70=_0x44bd70-0x0;var _0x52d923=_0xdcd3[_0x44bd70];return _0x52d923;};'use strict';var multer=require(_0x3dcd('0x0'));var util=require(_0x3dcd('0x1'));var path=require('path');var timeout=require(_0x3dcd('0x2'));var express=require(_0x3dcd('0x3'));var router=express[_0x3dcd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3dcd('0x5'));var interaction=require(_0x3dcd('0x6'));var config=require(_0x3dcd('0x7'));var controller=require(_0x3dcd('0x8'));router[_0x3dcd('0x9')]('/',auth[_0x3dcd('0xa')](),controller['index']);router[_0x3dcd('0x9')](_0x3dcd('0xb'),auth[_0x3dcd('0xa')](),controller[_0x3dcd('0xc')]);router[_0x3dcd('0xd')]('/',auth[_0x3dcd('0xa')](),controller[_0x3dcd('0xe')]);router['put']('/:id',auth[_0x3dcd('0xa')](),controller[_0x3dcd('0xf')]);router[_0x3dcd('0x10')]('/:id',auth[_0x3dcd('0xa')](),controller[_0x3dcd('0x11')]);module[_0x3dcd('0x12')]=router; \ No newline at end of file +var _0xd08e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x21d9a4,_0x1c78e8){var _0xa93014=function(_0x43d6d4){while(--_0x43d6d4){_0x21d9a4['push'](_0x21d9a4['shift']());}};_0xa93014(++_0x1c78e8);}(_0xd08e,0x120));var _0xed08=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xd08e[_0x32b993];return _0x482780;};'use strict';var multer=require(_0xed08('0x0'));var util=require(_0xed08('0x1'));var path=require(_0xed08('0x2'));var timeout=require(_0xed08('0x3'));var express=require(_0xed08('0x4'));var router=express[_0xed08('0x5')]();var fs_extra=require(_0xed08('0x6'));var auth=require(_0xed08('0x7'));var interaction=require(_0xed08('0x8'));var config=require(_0xed08('0x9'));var controller=require(_0xed08('0xa'));router[_0xed08('0xb')]('/',auth[_0xed08('0xc')](),controller[_0xed08('0xd')]);router[_0xed08('0xb')](_0xed08('0xe'),auth[_0xed08('0xc')](),controller[_0xed08('0xf')]);router[_0xed08('0x10')]('/',auth[_0xed08('0xc')](),controller[_0xed08('0x11')]);router[_0xed08('0x12')](_0xed08('0xe'),auth[_0xed08('0xc')](),controller[_0xed08('0x13')]);router['delete']('/:id',auth[_0xed08('0xc')](),controller[_0xed08('0x14')]);module[_0xed08('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5e4cf54..3074427 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x4ec3da,_0x951e39){var _0x53ff18=function(_0x37e913){while(--_0x37e913){_0x4ec3da['push'](_0x4ec3da['shift']());}};_0x53ff18(++_0x951e39);}(_0x2032,0xd9));var _0x2203=function(_0x2f1941,_0x171d1d){_0x2f1941=_0x2f1941-0x0;var _0x5a9e03=_0x2032[_0x2f1941];return _0x5a9e03;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0xe6894,_0x25d3ef){var _0x2cb14f=function(_0x12160d){while(--_0x12160d){_0xe6894['push'](_0xe6894['shift']());}};_0x2cb14f(++_0x25d3ef);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a675220..6c6e82e 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 _0x6a92=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','updatedAt','omit','createdAt','role','userProfileId','UserProfileResource','error','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboard.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','CustomDashboards','end','name','send','index','map','Dashboard','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','length','options','find','create','body'];(function(_0xc8a692,_0x579320){var _0x5055d8=function(_0x528459){while(--_0x528459){_0xc8a692['push'](_0xc8a692['shift']());}};_0x5055d8(++_0x579320);}(_0x6a92,0xb6));var _0x26a9=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6a92[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x26a9('0x0'));var rimraf=require(_0x26a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26a9('0x2'));var rp=require(_0x26a9('0x3'));var moment=require('moment');var BPromise=require(_0x26a9('0x4'));var Mustache=require(_0x26a9('0x5'));var util=require(_0x26a9('0x6'));var path=require(_0x26a9('0x7'));var sox=require(_0x26a9('0x8'));var csv=require('to-csv');var ejs=require(_0x26a9('0x9'));var fs=require('fs');var fs_extra=require(_0x26a9('0xa'));var _=require(_0x26a9('0xb'));var squel=require(_0x26a9('0xc'));var crypto=require(_0x26a9('0xd'));var jsforce=require(_0x26a9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x26a9('0xf'));var querystring=require(_0x26a9('0x10'));var Papa=require(_0x26a9('0x11'));var Redis=require(_0x26a9('0x12'));var authService=require(_0x26a9('0x13'));var qs=require(_0x26a9('0x14'));var as=require(_0x26a9('0x15'));var hardwareService=require(_0x26a9('0x16'));var logger=require(_0x26a9('0x17'))(_0x26a9('0x18'));var utils=require(_0x26a9('0x19'));var config=require(_0x26a9('0x1a'));var licenseUtil=require(_0x26a9('0x1b'));var db=require(_0x26a9('0x1c'))['db'];config[_0x26a9('0x1d')]=_[_0x26a9('0x1e')](config[_0x26a9('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x26a9('0x1d')]));require(_0x26a9('0x1f'))[_0x26a9('0x20')](socket);function respondWithStatusCode(_0x2132dc,_0x1ca4b3){_0x1ca4b3=_0x1ca4b3||0xcc;return function(_0x558514){if(_0x558514){return _0x2132dc[_0x26a9('0x21')](_0x1ca4b3);}return _0x2132dc[_0x26a9('0x22')](_0x1ca4b3)['end']();};}function respondWithResult(_0x5ef341,_0x3dfc74){_0x3dfc74=_0x3dfc74||0xc8;return function(_0x5922ed){if(_0x5922ed){return _0x5ef341[_0x26a9('0x22')](_0x3dfc74)['json'](_0x5922ed);}};}function respondWithFilteredResult(_0x4fea71,_0x567989){return function(_0x2a56ee){if(_0x2a56ee){var _0x8d87d0=typeof _0x567989['offset']===_0x26a9('0x23')&&typeof _0x567989[_0x26a9('0x24')]===_0x26a9('0x23');var _0xaa3fb8=_0x2a56ee[_0x26a9('0x25')];var _0x292ae3=_0x8d87d0?0x0:_0x567989[_0x26a9('0x26')];var _0x5c7cd9=_0x8d87d0?_0x2a56ee[_0x26a9('0x25')]:_0x567989[_0x26a9('0x26')]+_0x567989[_0x26a9('0x24')];var _0x4d8613;if(_0x5c7cd9>=_0xaa3fb8){_0x5c7cd9=_0xaa3fb8;_0x4d8613=0xc8;}else{_0x4d8613=0xce;}_0x4fea71[_0x26a9('0x22')](_0x4d8613);return _0x4fea71[_0x26a9('0x27')](_0x26a9('0x28'),_0x292ae3+'-'+_0x5c7cd9+'/'+_0xaa3fb8)['json'](_0x2a56ee);}return null;};}function patchUpdates(_0x486bad){return function(_0x50b9b6){try{jsonpatch['apply'](_0x50b9b6,_0x486bad,!![]);}catch(_0x408f9a){return BPromise[_0x26a9('0x29')](_0x408f9a);}return _0x50b9b6[_0x26a9('0x2a')]();};}function saveUpdates(_0x1f5eda,_0x5a221c){return function(_0x2fc71c){if(_0x2fc71c){return _0x2fc71c[_0x26a9('0x2b')](_0x1f5eda)[_0x26a9('0x2c')](function(_0x3b4e2d){return _0x3b4e2d;});}return null;};}function removeEntity(_0x175e46,_0x55f4e1){return function(_0x13c7fe){if(_0x13c7fe){return _0x13c7fe[_0x26a9('0x2d')]()[_0x26a9('0x2c')](function(){var _0x2c0f40=_0x13c7fe['get']({'plain':!![]});var _0x48731e=_0x26a9('0x2e');return db['UserProfileResource'][_0x26a9('0x2d')]({'where':{'type':_0x48731e,'resourceId':_0x2c0f40['id']}})['then'](function(){return _0x13c7fe;});})[_0x26a9('0x2c')](function(){_0x175e46[_0x26a9('0x22')](0xcc)[_0x26a9('0x2f')]();});}};}function handleEntityNotFound(_0x23598f,_0x5c05d9){return function(_0x4b1e4a){if(!_0x4b1e4a){_0x23598f[_0x26a9('0x21')](0x194);}return _0x4b1e4a;};}function handleError(_0x407921,_0x3672ca){_0x3672ca=_0x3672ca||0x1f4;return function(_0x5f2f85){logger['error'](_0x5f2f85['stack']);if(_0x5f2f85[_0x26a9('0x30')]){delete _0x5f2f85[_0x26a9('0x30')];}_0x407921[_0x26a9('0x22')](_0x3672ca)[_0x26a9('0x31')](_0x5f2f85);};}exports[_0x26a9('0x32')]=function(_0x381ede,_0x1f135c){var _0x549a08={},_0x53c983={},_0x2f3e61={'count':0x0,'rows':[]};var _0x3561db=_[_0x26a9('0x33')](db[_0x26a9('0x34')]['rawAttributes'],function(_0x5c1a57){return{'name':_0x5c1a57[_0x26a9('0x35')],'type':_0x5c1a57['type']['key']};});_0x53c983[_0x26a9('0x36')]=_[_0x26a9('0x33')](_0x3561db,_0x26a9('0x30'));_0x53c983[_0x26a9('0x37')]=_[_0x26a9('0x38')](_0x381ede[_0x26a9('0x37')]);_0x53c983[_0x26a9('0x39')]=_[_0x26a9('0x3a')](_0x53c983[_0x26a9('0x36')],_0x53c983['query']);_0x549a08[_0x26a9('0x3b')]=_[_0x26a9('0x3a')](_0x53c983['model'],qs[_0x26a9('0x3c')](_0x381ede[_0x26a9('0x37')]['fields']));_0x549a08[_0x26a9('0x3b')]=_0x549a08[_0x26a9('0x3b')]['length']?_0x549a08[_0x26a9('0x3b')]:_0x53c983[_0x26a9('0x36')];if(!_0x381ede[_0x26a9('0x37')][_0x26a9('0x3d')]('nolimit')){_0x549a08['limit']=qs['limit'](_0x381ede['query'][_0x26a9('0x24')]);_0x549a08[_0x26a9('0x26')]=qs['offset'](_0x381ede[_0x26a9('0x37')][_0x26a9('0x26')]);}_0x549a08['order']=qs[_0x26a9('0x3e')](_0x381ede['query'][_0x26a9('0x3e')]);_0x549a08[_0x26a9('0x3f')]=qs[_0x26a9('0x39')](_[_0x26a9('0x40')](_0x381ede[_0x26a9('0x37')],_0x53c983[_0x26a9('0x39')]),_0x3561db);if(_0x381ede['query'][_0x26a9('0x41')]){_0x549a08[_0x26a9('0x3f')]=_[_0x26a9('0x42')](_0x549a08['where'],{'$or':_['map'](_0x3561db,function(_0x31dba5){if(_0x31dba5[_0x26a9('0x43')]!==_0x26a9('0x44')){var _0x29da14={};_0x29da14[_0x31dba5[_0x26a9('0x30')]]={'$like':'%'+_0x381ede[_0x26a9('0x37')][_0x26a9('0x41')]+'%'};return _0x29da14;}})});}_0x549a08=_[_0x26a9('0x42')]({},_0x549a08,_0x381ede['options']);var _0x132251={'where':_0x549a08['where']};return db['Dashboard'][_0x26a9('0x25')](_0x132251)['then'](function(_0x504e08){_0x2f3e61[_0x26a9('0x25')]=_0x504e08;if(_0x381ede['query']['includeAll']){_0x549a08[_0x26a9('0x45')]=[{'all':!![]}];}return db[_0x26a9('0x34')][_0x26a9('0x46')](_0x549a08);})[_0x26a9('0x2c')](function(_0x862b70){_0x2f3e61[_0x26a9('0x47')]=_0x862b70;return _0x2f3e61;})['then'](respondWithFilteredResult(_0x1f135c,_0x549a08))[_0x26a9('0x48')](handleError(_0x1f135c,null));};exports[_0x26a9('0x49')]=function(_0x27882f,_0x13b1c0){var _0x2d38d6={'raw':![],'where':{'id':_0x27882f['params']['id']}},_0x48062a={};_0x48062a['model']=_[_0x26a9('0x38')](db[_0x26a9('0x34')][_0x26a9('0x4a')]);_0x48062a[_0x26a9('0x37')]=_[_0x26a9('0x38')](_0x27882f[_0x26a9('0x37')]);_0x48062a[_0x26a9('0x39')]=_[_0x26a9('0x3a')](_0x48062a[_0x26a9('0x36')],_0x48062a['query']);_0x2d38d6[_0x26a9('0x3b')]=_['intersection'](_0x48062a['model'],qs[_0x26a9('0x3c')](_0x27882f[_0x26a9('0x37')]['fields']));_0x2d38d6[_0x26a9('0x3b')]=_0x2d38d6[_0x26a9('0x3b')][_0x26a9('0x4b')]?_0x2d38d6[_0x26a9('0x3b')]:_0x48062a[_0x26a9('0x36')];if(_0x27882f[_0x26a9('0x37')]['includeAll']){_0x2d38d6['include']=[{'all':!![]}];}_0x2d38d6=_[_0x26a9('0x42')]({},_0x2d38d6,_0x27882f[_0x26a9('0x4c')]);return db[_0x26a9('0x34')][_0x26a9('0x4d')](_0x2d38d6)[_0x26a9('0x2c')](handleEntityNotFound(_0x13b1c0,null))[_0x26a9('0x2c')](respondWithResult(_0x13b1c0,null))[_0x26a9('0x48')](handleError(_0x13b1c0,null));};exports[_0x26a9('0x4e')]=function(_0x5aa186,_0xa88365){return db['Dashboard']['create'](_0x5aa186[_0x26a9('0x4f')],{})[_0x26a9('0x2c')](function(_0x157ebc){var _0x23cd8e=_0x5aa186[_0x26a9('0x50')][_0x26a9('0x51')]({'plain':!![]});if(!_0x23cd8e)throw new Error(_0x26a9('0x52'));if(_0x23cd8e['role']==='user'){var _0x1baab6=_0x157ebc['get']({'plain':!![]});var _0x5657cd=_0x26a9('0x2e');return db[_0x26a9('0x53')][_0x26a9('0x4d')]({'where':{'name':_0x5657cd,'userProfileId':_0x23cd8e['userProfileId']},'raw':!![]})[_0x26a9('0x2c')](function(_0x637b5f){if(_0x637b5f&&_0x637b5f[_0x26a9('0x54')]===0x0){return db['UserProfileResource'][_0x26a9('0x4e')]({'name':_0x1baab6['name'],'resourceId':_0x1baab6['id'],'type':_0x637b5f[_0x26a9('0x30')],'sectionId':_0x637b5f['id']},{})['then'](function(){return _0x157ebc;});}else{return _0x157ebc;}})[_0x26a9('0x48')](function(_0x397355){logger['error'](_0x26a9('0x55'),_0x397355);throw _0x397355;});}return _0x157ebc;})[_0x26a9('0x2c')](respondWithResult(_0xa88365,0xc9))[_0x26a9('0x48')](handleError(_0xa88365,null));};exports[_0x26a9('0x56')]=function(_0x31aba4,_0x17ee49){var _0x450b73={'where':{'id':_0x31aba4[_0x26a9('0x57')]['id']}},_0x5ade78={};_0x5ade78[_0x26a9('0x36')]=_[_0x26a9('0x38')](db[_0x26a9('0x34')][_0x26a9('0x4a')]);_0x450b73[_0x26a9('0x3b')]=_['intersection'](_0x5ade78['model'],qs[_0x26a9('0x3c')](_0x31aba4[_0x26a9('0x37')][_0x26a9('0x3c')]));_0x450b73[_0x26a9('0x3b')]=_0x450b73[_0x26a9('0x3b')][_0x26a9('0x4b')]?_0x450b73[_0x26a9('0x3b')]:_0x5ade78[_0x26a9('0x36')];if(_0x31aba4[_0x26a9('0x37')][_0x26a9('0x58')]){_0x450b73[_0x26a9('0x45')]=[{'all':!![]}];}_0x450b73=_[_0x26a9('0x42')]({},_0x450b73,_0x31aba4[_0x26a9('0x4c')]);return db[_0x26a9('0x34')]['find'](_0x450b73)[_0x26a9('0x2c')](handleEntityNotFound(_0x17ee49,null))[_0x26a9('0x2c')](function(_0x572839){if(_0x572839){var _0x16d293=_0x572839[_0x26a9('0x51')]({'plain':!![]});_0x16d293=qs['omit'](_0x16d293,['id','createdAt',_0x26a9('0x59')]);_0x31aba4[_0x26a9('0x4f')]=_[_0x26a9('0x5a')](_0x31aba4[_0x26a9('0x4f')],['id',_0x26a9('0x5b'),_0x26a9('0x59')]);return db['Dashboard'][_0x26a9('0x4e')](_[_0x26a9('0x42')](_0x16d293,_0x31aba4['body']),{'include':_0x31aba4['query'][_0x26a9('0x58')]?[{'all':!![]}]:undefined})['then'](function(_0x467870){var _0x22e8f6=_0x31aba4[_0x26a9('0x50')]['get']({'plain':!![]});if(!_0x22e8f6)throw new Error(_0x26a9('0x52'));if(_0x22e8f6[_0x26a9('0x5c')]===_0x26a9('0x50')){var _0x5f0578=_0x467870[_0x26a9('0x51')]({'plain':!![]});var _0x4baa35=_0x26a9('0x2e');return db['UserProfileSection'][_0x26a9('0x4d')]({'where':{'name':_0x4baa35,'userProfileId':_0x22e8f6[_0x26a9('0x5d')]},'raw':!![]})[_0x26a9('0x2c')](function(_0x30f30a){if(_0x30f30a&&_0x30f30a[_0x26a9('0x54')]===0x0){return db[_0x26a9('0x5e')][_0x26a9('0x4e')]({'name':_0x5f0578[_0x26a9('0x30')],'resourceId':_0x5f0578['id'],'type':_0x30f30a[_0x26a9('0x30')],'sectionId':_0x30f30a['id']},{})['then'](function(){return _0x467870;});}else{return _0x467870;}})[_0x26a9('0x48')](function(_0x2369ad){logger[_0x26a9('0x5f')](_0x26a9('0x55'),_0x2369ad);throw _0x2369ad;});}return _0x467870;});}})['then'](respondWithResult(_0x17ee49,0xc9))[_0x26a9('0x48')](handleError(_0x17ee49,null));};exports[_0x26a9('0x2b')]=function(_0x56f995,_0xc2fcbd){if(_0x56f995[_0x26a9('0x4f')]['id']){delete _0x56f995['body']['id'];}return db[_0x26a9('0x34')][_0x26a9('0x4d')]({'where':{'id':_0x56f995[_0x26a9('0x57')]['id']}})[_0x26a9('0x2c')](handleEntityNotFound(_0xc2fcbd,null))[_0x26a9('0x2c')](saveUpdates(_0x56f995['body'],null))['then'](respondWithResult(_0xc2fcbd,null))[_0x26a9('0x48')](handleError(_0xc2fcbd,null));};exports['destroy']=function(_0x454fc7,_0x3e6257){return db['Dashboard'][_0x26a9('0x4d')]({'where':{'id':_0x454fc7[_0x26a9('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e6257,null))[_0x26a9('0x2c')](removeEntity(_0x3e6257,null))['catch'](handleError(_0x3e6257,null));};function widgetAttributes(_0x20ba66){try{switch(_0x20ba66['type']){case'iframe':return[{'name':_0x26a9('0x60'),'value':_0x20ba66['attrUrl']||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x0]?_0x20ba66[_0x26a9('0x61')][0x0][_0x26a9('0x62')]:undefined)||'https://'}];case _0x26a9('0x63'):return[{'name':_0x26a9('0x64'),'value':_0x20ba66[_0x26a9('0x64')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x0]?_0x20ba66[_0x26a9('0x61')][0x0]['value']:undefined)||''}];case _0x26a9('0x65'):return[{'name':_0x26a9('0x66'),'value':_0x20ba66[_0x26a9('0x66')]||(_0x20ba66['attrs']&&_0x20ba66[_0x26a9('0x61')][0x0]?_0x20ba66['attrs'][0x0][_0x26a9('0x62')]:undefined)||'HH:mm:ss'},{'name':_0x26a9('0x67'),'value':_0x20ba66['attrTimezone']||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x1]?_0x20ba66[_0x26a9('0x61')][0x1]['value']:undefined)||_0x26a9('0x68')},{'name':_0x26a9('0x69'),'value':_0x20ba66[_0x26a9('0x69')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x2]?_0x20ba66[_0x26a9('0x61')][0x2][_0x26a9('0x62')]:undefined)||0xc}];case _0x26a9('0x6a'):return[{'name':_0x26a9('0x6b'),'value':_0x20ba66[_0x26a9('0x6b')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66['attrs'][0x0]?_0x20ba66[_0x26a9('0x61')][0x0][_0x26a9('0x62')]:undefined)||'total'},{'name':_0x26a9('0x6c'),'value':_0x20ba66[_0x26a9('0x6c')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x1]?_0x20ba66[_0x26a9('0x61')][0x1][_0x26a9('0x62')]:undefined)||[]},{'name':_0x26a9('0x69'),'value':_0x20ba66[_0x26a9('0x69')]||(_0x20ba66['attrs']&&_0x20ba66['attrs'][0x2]?_0x20ba66[_0x26a9('0x61')][0x2]['value']:undefined)||0x14},{'name':_0x26a9('0x6d'),'value':_0x20ba66[_0x26a9('0x6d')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66['attrs'][0x3]?_0x20ba66[_0x26a9('0x61')][0x3][_0x26a9('0x62')]:undefined)||_0x26a9('0x6e')},{'name':_0x26a9('0x6f'),'value':_0x20ba66['attrEmailAccounts']||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x4]?_0x20ba66[_0x26a9('0x61')][0x4][_0x26a9('0x62')]:undefined)||''},{'name':_0x26a9('0x70'),'value':_0x20ba66[_0x26a9('0x70')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x5]?_0x20ba66[_0x26a9('0x61')][0x5][_0x26a9('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x20ba66[_0x26a9('0x71')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x6]?_0x20ba66[_0x26a9('0x61')][0x6][_0x26a9('0x62')]:undefined)||''},{'name':_0x26a9('0x72'),'value':_0x20ba66[_0x26a9('0x72')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x7]?_0x20ba66[_0x26a9('0x61')][0x7][_0x26a9('0x62')]:undefined)||''},{'name':_0x26a9('0x73'),'value':_0x20ba66[_0x26a9('0x73')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x8]?_0x20ba66[_0x26a9('0x61')][0x8][_0x26a9('0x62')]:undefined)||''},{'name':_0x26a9('0x74'),'value':_0x20ba66['attrChatWebsites']||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x9]?_0x20ba66[_0x26a9('0x61')][0x9]['value']:undefined)||''}];case _0x26a9('0x75'):case'pie-chart':return[{'name':_0x26a9('0x76'),'value':_0x20ba66[_0x26a9('0x76')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66['attrs'][0x0]?_0x20ba66[_0x26a9('0x61')][0x0][_0x26a9('0x62')]:undefined)||'total'},{'name':_0x26a9('0x77'),'value':_0x20ba66[_0x26a9('0x77')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66['attrs'][0x1]?_0x20ba66['attrs'][0x1][_0x26a9('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0x20ba66[_0x26a9('0x78')]||(_0x20ba66['attrs']&&_0x20ba66['attrs'][0x2]?_0x20ba66[_0x26a9('0x61')][0x2]['value']:undefined)||null},{'name':_0x26a9('0x6c'),'value':_0x20ba66['attrVoiceQueues']||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x3]?_0x20ba66[_0x26a9('0x61')][0x3][_0x26a9('0x62')]:undefined)||[]},{'name':'attrChannel','value':_0x20ba66['attrChannel']||(_0x20ba66['attrs']&&_0x20ba66['attrs'][0x4]?_0x20ba66[_0x26a9('0x61')][0x4]['value']:undefined)||_0x26a9('0x6e')},{'name':_0x26a9('0x6f'),'value':_0x20ba66[_0x26a9('0x6f')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66['attrs'][0x5]?_0x20ba66[_0x26a9('0x61')][0x5][_0x26a9('0x62')]:undefined)||''},{'name':_0x26a9('0x70'),'value':_0x20ba66[_0x26a9('0x70')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x6]?_0x20ba66[_0x26a9('0x61')][0x6][_0x26a9('0x62')]:undefined)||''},{'name':_0x26a9('0x71'),'value':_0x20ba66[_0x26a9('0x71')]||(_0x20ba66['attrs']&&_0x20ba66['attrs'][0x7]?_0x20ba66[_0x26a9('0x61')][0x7][_0x26a9('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x20ba66[_0x26a9('0x72')]||(_0x20ba66['attrs']&&_0x20ba66[_0x26a9('0x61')][0x8]?_0x20ba66['attrs'][0x8][_0x26a9('0x62')]:undefined)||''},{'name':_0x26a9('0x73'),'value':_0x20ba66[_0x26a9('0x73')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x9]?_0x20ba66[_0x26a9('0x61')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x20ba66[_0x26a9('0x74')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0xa]?_0x20ba66[_0x26a9('0x61')][0xa][_0x26a9('0x62')]:undefined)||''}];case _0x26a9('0x79'):return[{'name':_0x26a9('0x7a'),'type':_0x20ba66[_0x26a9('0x7b')]||(_0x20ba66['attrs']&&_0x20ba66[_0x26a9('0x61')][0x0]?_0x20ba66[_0x26a9('0x61')][0x0][_0x26a9('0x43')]:undefined)||null,'value':_0x20ba66[_0x26a9('0x7a')]||(_0x20ba66[_0x26a9('0x61')]&&_0x20ba66[_0x26a9('0x61')][0x0]?_0x20ba66[_0x26a9('0x61')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x20ba66['attrRefresh']||(_0x20ba66['attrs']&&_0x20ba66['attrs'][0x1]?_0x20ba66[_0x26a9('0x61')][0x1][_0x26a9('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x5b65e1){logger[_0x26a9('0x5f')](_0x26a9('0x7c'),JSON['stringify'](_0x5b65e1));return[];}}exports[_0x26a9('0x7d')]=function(_0x3d8d57,_0xe689f3,_0xd129a0){if(_0x3d8d57[_0x26a9('0x4f')]['id']){delete _0x3d8d57[_0x26a9('0x4f')]['id'];}return db[_0x26a9('0x34')][_0x26a9('0x4d')]({'where':{'id':_0x3d8d57[_0x26a9('0x57')]['id']}})[_0x26a9('0x2c')](handleEntityNotFound(_0xe689f3,null))[_0x26a9('0x2c')](function(_0x25e8ad){if(_0x25e8ad){_0x3d8d57[_0x26a9('0x4f')][_0x26a9('0x7e')]=_0x25e8ad['id'];_0x3d8d57[_0x26a9('0x4f')][_0x26a9('0x61')]=widgetAttributes(_0x3d8d57[_0x26a9('0x4f')]);return db[_0x26a9('0x7f')]['create'](_0x3d8d57['body']);}})['then'](respondWithResult(_0xe689f3,null))[_0x26a9('0x48')](handleError(_0xe689f3,null));};exports[_0x26a9('0x80')]=function(_0x13232a,_0x46e0c2,_0x45551a){var _0x4e6131={};var _0x44698={};var _0x51842d;var _0xb7b427;return db[_0x26a9('0x34')][_0x26a9('0x81')]({'where':{'id':_0x13232a['params']['id']}})[_0x26a9('0x2c')](handleEntityNotFound(_0x46e0c2,null))[_0x26a9('0x2c')](function(_0x48b6dc){if(_0x48b6dc){_0x51842d=_0x48b6dc;_0x44698[_0x26a9('0x36')]=_[_0x26a9('0x38')](db[_0x26a9('0x7f')][_0x26a9('0x4a')]);_0x44698[_0x26a9('0x37')]=_[_0x26a9('0x38')](_0x13232a['query']);_0x44698[_0x26a9('0x39')]=_['intersection'](_0x44698[_0x26a9('0x36')],_0x44698['query']);_0x4e6131[_0x26a9('0x3b')]=_[_0x26a9('0x3a')](_0x44698[_0x26a9('0x36')],qs[_0x26a9('0x3c')](_0x13232a[_0x26a9('0x37')]['fields']));_0x4e6131[_0x26a9('0x3b')]=_0x4e6131[_0x26a9('0x3b')][_0x26a9('0x4b')]?_0x4e6131['attributes']:_0x44698[_0x26a9('0x36')];_0x4e6131['order']=qs['sort'](_0x13232a[_0x26a9('0x37')][_0x26a9('0x3e')]);_0x4e6131[_0x26a9('0x3f')]=qs[_0x26a9('0x39')](_['pick'](_0x13232a[_0x26a9('0x37')],_0x44698[_0x26a9('0x39')]));if(_0x13232a['query']['filter']){_0x4e6131[_0x26a9('0x3f')]=_[_0x26a9('0x42')](_0x4e6131[_0x26a9('0x3f')],{'$or':_[_0x26a9('0x33')](_0x4e6131['attributes'],function(_0xed1ad0){var _0x44148e={};_0x44148e[_0xed1ad0]={'$like':'%'+_0x13232a[_0x26a9('0x37')]['filter']+'%'};return _0x44148e;})});}_0x4e6131=_[_0x26a9('0x42')]({},_0x4e6131,_0x13232a[_0x26a9('0x4c')]);return _0x51842d[_0x26a9('0x80')](_0x4e6131);}})['then'](function(_0x147aee){if(_0x147aee){_0xb7b427=_0x147aee[_0x26a9('0x4b')];if(!_0x13232a[_0x26a9('0x37')]['hasOwnProperty'](_0x26a9('0x82'))){_0x4e6131[_0x26a9('0x24')]=qs[_0x26a9('0x24')](_0x13232a[_0x26a9('0x37')]['limit']);_0x4e6131['offset']=qs[_0x26a9('0x26')](_0x13232a['query'][_0x26a9('0x26')]);}return _0x51842d[_0x26a9('0x80')](_0x4e6131);}})[_0x26a9('0x2c')](function(_0x5d95bf){if(_0x5d95bf){return _0x5d95bf?{'count':_0xb7b427,'rows':_0x5d95bf}:null;}})['then'](respondWithResult(_0x46e0c2,null))[_0x26a9('0x48')](handleError(_0x46e0c2,null));}; \ No newline at end of file +var _0xbfe0=['attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','limit','undefined','offset','count','set','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Dashboard','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','role','user','userProfileId','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3'];(function(_0x164ba7,_0x114291){var _0x624591=function(_0x531cf1){while(--_0x531cf1){_0x164ba7['push'](_0x164ba7['shift']());}};_0x624591(++_0x114291);}(_0xbfe0,0x107));var _0x0bfe=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xbfe0[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x0bfe('0x0'));var rimraf=require(_0x0bfe('0x1'));var zipdir=require(_0x0bfe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0bfe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0bfe('0x4'));var util=require(_0x0bfe('0x5'));var path=require('path');var sox=require(_0x0bfe('0x6'));var csv=require(_0x0bfe('0x7'));var ejs=require(_0x0bfe('0x8'));var fs=require('fs');var fs_extra=require(_0x0bfe('0x9'));var _=require(_0x0bfe('0xa'));var squel=require(_0x0bfe('0xb'));var crypto=require('crypto');var jsforce=require(_0x0bfe('0xc'));var deskjs=require(_0x0bfe('0xd'));var toCsv=require(_0x0bfe('0x7'));var querystring=require(_0x0bfe('0xe'));var Papa=require(_0x0bfe('0xf'));var Redis=require(_0x0bfe('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bfe('0x11'));var logger=require(_0x0bfe('0x12'))(_0x0bfe('0x13'));var utils=require(_0x0bfe('0x14'));var config=require(_0x0bfe('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0bfe('0x16'))['db'];config[_0x0bfe('0x17')]=_[_0x0bfe('0x18')](config[_0x0bfe('0x17')],{'host':_0x0bfe('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bfe('0x17')]));require(_0x0bfe('0x1a'))['register'](socket);function respondWithStatusCode(_0x554cad,_0x39b75e){_0x39b75e=_0x39b75e||0xcc;return function(_0x233dd1){if(_0x233dd1){return _0x554cad[_0x0bfe('0x1b')](_0x39b75e);}return _0x554cad[_0x0bfe('0x1c')](_0x39b75e)[_0x0bfe('0x1d')]();};}function respondWithResult(_0x5a5513,_0x3ef7a1){_0x3ef7a1=_0x3ef7a1||0xc8;return function(_0x3524b8){if(_0x3524b8){return _0x5a5513[_0x0bfe('0x1c')](_0x3ef7a1)[_0x0bfe('0x1e')](_0x3524b8);}};}function respondWithFilteredResult(_0x2ef639,_0x5b961c){return function(_0x1bb139){if(_0x1bb139){var _0x4d1fdc=typeof _0x5b961c['offset']==='undefined'&&typeof _0x5b961c[_0x0bfe('0x1f')]===_0x0bfe('0x20');var _0x2a4c86=_0x1bb139['count'];var _0x38a9cc=_0x4d1fdc?0x0:_0x5b961c[_0x0bfe('0x21')];var _0x19d889=_0x4d1fdc?_0x1bb139[_0x0bfe('0x22')]:_0x5b961c[_0x0bfe('0x21')]+_0x5b961c[_0x0bfe('0x1f')];var _0x4ae24a;if(_0x19d889>=_0x2a4c86){_0x19d889=_0x2a4c86;_0x4ae24a=0xc8;}else{_0x4ae24a=0xce;}_0x2ef639[_0x0bfe('0x1c')](_0x4ae24a);return _0x2ef639[_0x0bfe('0x23')]('Content-Range',_0x38a9cc+'-'+_0x19d889+'/'+_0x2a4c86)['json'](_0x1bb139);}return null;};}function patchUpdates(_0x459813){return function(_0x844194){try{jsonpatch['apply'](_0x844194,_0x459813,!![]);}catch(_0x13851d){return BPromise[_0x0bfe('0x24')](_0x13851d);}return _0x844194['save']();};}function saveUpdates(_0x32d4a2,_0x355f8e){return function(_0x5bb037){if(_0x5bb037){return _0x5bb037[_0x0bfe('0x25')](_0x32d4a2)[_0x0bfe('0x26')](function(_0x26ef56){return _0x26ef56;});}return null;};}function removeEntity(_0x5647af,_0x1569b5){return function(_0x116f6c){if(_0x116f6c){return _0x116f6c[_0x0bfe('0x27')]()['then'](function(){var _0x4f3b59=_0x116f6c[_0x0bfe('0x28')]({'plain':!![]});var _0x18c9af='CustomDashboards';return db[_0x0bfe('0x29')]['destroy']({'where':{'type':_0x18c9af,'resourceId':_0x4f3b59['id']}})[_0x0bfe('0x26')](function(){return _0x116f6c;});})[_0x0bfe('0x26')](function(){_0x5647af[_0x0bfe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d042f,_0x562aee){return function(_0x374d7e){if(!_0x374d7e){_0x4d042f['sendStatus'](0x194);}return _0x374d7e;};}function handleError(_0x560cb5,_0xff15bc){_0xff15bc=_0xff15bc||0x1f4;return function(_0x19b309){logger[_0x0bfe('0x2a')](_0x19b309[_0x0bfe('0x2b')]);if(_0x19b309[_0x0bfe('0x2c')]){delete _0x19b309['name'];}_0x560cb5[_0x0bfe('0x1c')](_0xff15bc)[_0x0bfe('0x2d')](_0x19b309);};}exports['index']=function(_0xe9c72b,_0x583c1e){var _0x304a82={},_0x4f95c4={},_0x2e8ea7={'count':0x0,'rows':[]};var _0x29c685=_[_0x0bfe('0x2e')](db[_0x0bfe('0x2f')][_0x0bfe('0x30')],function(_0xca5186){return{'name':_0xca5186['fieldName'],'type':_0xca5186[_0x0bfe('0x31')][_0x0bfe('0x32')]};});_0x4f95c4['model']=_[_0x0bfe('0x2e')](_0x29c685,_0x0bfe('0x2c'));_0x4f95c4[_0x0bfe('0x33')]=_[_0x0bfe('0x34')](_0xe9c72b[_0x0bfe('0x33')]);_0x4f95c4[_0x0bfe('0x35')]=_['intersection'](_0x4f95c4[_0x0bfe('0x36')],_0x4f95c4[_0x0bfe('0x33')]);_0x304a82[_0x0bfe('0x37')]=_[_0x0bfe('0x38')](_0x4f95c4['model'],qs[_0x0bfe('0x39')](_0xe9c72b[_0x0bfe('0x33')][_0x0bfe('0x39')]));_0x304a82[_0x0bfe('0x37')]=_0x304a82[_0x0bfe('0x37')][_0x0bfe('0x3a')]?_0x304a82['attributes']:_0x4f95c4['model'];if(!_0xe9c72b[_0x0bfe('0x33')][_0x0bfe('0x3b')](_0x0bfe('0x3c'))){_0x304a82[_0x0bfe('0x1f')]=qs[_0x0bfe('0x1f')](_0xe9c72b[_0x0bfe('0x33')][_0x0bfe('0x1f')]);_0x304a82[_0x0bfe('0x21')]=qs['offset'](_0xe9c72b[_0x0bfe('0x33')][_0x0bfe('0x21')]);}_0x304a82[_0x0bfe('0x3d')]=qs['sort'](_0xe9c72b[_0x0bfe('0x33')][_0x0bfe('0x3e')]);_0x304a82[_0x0bfe('0x3f')]=qs[_0x0bfe('0x35')](_[_0x0bfe('0x40')](_0xe9c72b[_0x0bfe('0x33')],_0x4f95c4[_0x0bfe('0x35')]),_0x29c685);if(_0xe9c72b[_0x0bfe('0x33')][_0x0bfe('0x41')]){_0x304a82['where']=_[_0x0bfe('0x42')](_0x304a82[_0x0bfe('0x3f')],{'$or':_[_0x0bfe('0x2e')](_0x29c685,function(_0x349edd){if(_0x349edd[_0x0bfe('0x31')]!==_0x0bfe('0x43')){var _0x4ed529={};_0x4ed529[_0x349edd[_0x0bfe('0x2c')]]={'$like':'%'+_0xe9c72b['query']['filter']+'%'};return _0x4ed529;}})});}_0x304a82=_[_0x0bfe('0x42')]({},_0x304a82,_0xe9c72b['options']);var _0x174c07={'where':_0x304a82['where']};return db[_0x0bfe('0x2f')][_0x0bfe('0x22')](_0x174c07)[_0x0bfe('0x26')](function(_0x330d23){_0x2e8ea7['count']=_0x330d23;if(_0xe9c72b[_0x0bfe('0x33')]['includeAll']){_0x304a82[_0x0bfe('0x44')]=[{'all':!![]}];}return db[_0x0bfe('0x2f')]['findAll'](_0x304a82);})['then'](function(_0x572d22){_0x2e8ea7[_0x0bfe('0x45')]=_0x572d22;return _0x2e8ea7;})[_0x0bfe('0x26')](respondWithFilteredResult(_0x583c1e,_0x304a82))[_0x0bfe('0x46')](handleError(_0x583c1e,null));};exports['show']=function(_0x2407f1,_0x5826a7){var _0x5395a2={'raw':![],'where':{'id':_0x2407f1['params']['id']}},_0x2f1cc={};_0x2f1cc[_0x0bfe('0x36')]=_[_0x0bfe('0x34')](db[_0x0bfe('0x2f')][_0x0bfe('0x30')]);_0x2f1cc[_0x0bfe('0x33')]=_['keys'](_0x2407f1[_0x0bfe('0x33')]);_0x2f1cc['filters']=_[_0x0bfe('0x38')](_0x2f1cc[_0x0bfe('0x36')],_0x2f1cc[_0x0bfe('0x33')]);_0x5395a2[_0x0bfe('0x37')]=_[_0x0bfe('0x38')](_0x2f1cc[_0x0bfe('0x36')],qs[_0x0bfe('0x39')](_0x2407f1[_0x0bfe('0x33')]['fields']));_0x5395a2[_0x0bfe('0x37')]=_0x5395a2[_0x0bfe('0x37')][_0x0bfe('0x3a')]?_0x5395a2['attributes']:_0x2f1cc[_0x0bfe('0x36')];if(_0x2407f1[_0x0bfe('0x33')][_0x0bfe('0x47')]){_0x5395a2[_0x0bfe('0x44')]=[{'all':!![]}];}_0x5395a2=_[_0x0bfe('0x42')]({},_0x5395a2,_0x2407f1[_0x0bfe('0x48')]);return db[_0x0bfe('0x2f')][_0x0bfe('0x49')](_0x5395a2)[_0x0bfe('0x26')](handleEntityNotFound(_0x5826a7,null))['then'](respondWithResult(_0x5826a7,null))[_0x0bfe('0x46')](handleError(_0x5826a7,null));};exports[_0x0bfe('0x4a')]=function(_0x12103d,_0x18fc46){return db['Dashboard'][_0x0bfe('0x4a')](_0x12103d[_0x0bfe('0x4b')],{})['then'](function(_0x1b0c51){var _0x28deac=_0x12103d['user'][_0x0bfe('0x28')]({'plain':!![]});if(!_0x28deac)throw new Error(_0x0bfe('0x4c'));if(_0x28deac['role']==='user'){var _0x509c40=_0x1b0c51['get']({'plain':!![]});var _0x37f22a=_0x0bfe('0x4d');return db[_0x0bfe('0x4e')][_0x0bfe('0x49')]({'where':{'name':_0x37f22a,'userProfileId':_0x28deac['userProfileId']},'raw':!![]})['then'](function(_0x26e585){if(_0x26e585&&_0x26e585[_0x0bfe('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x509c40[_0x0bfe('0x2c')],'resourceId':_0x509c40['id'],'type':_0x26e585['name'],'sectionId':_0x26e585['id']},{})['then'](function(){return _0x1b0c51;});}else{return _0x1b0c51;}})[_0x0bfe('0x46')](function(_0x1e4ce7){logger[_0x0bfe('0x2a')](_0x0bfe('0x50'),_0x1e4ce7);throw _0x1e4ce7;});}return _0x1b0c51;})[_0x0bfe('0x26')](respondWithResult(_0x18fc46,0xc9))[_0x0bfe('0x46')](handleError(_0x18fc46,null));};exports[_0x0bfe('0x51')]=function(_0x3b6ec0,_0x225d56){var _0x496de5={'where':{'id':_0x3b6ec0[_0x0bfe('0x52')]['id']}},_0x153e1e={};_0x153e1e[_0x0bfe('0x36')]=_['keys'](db['Dashboard']['rawAttributes']);_0x496de5[_0x0bfe('0x37')]=_[_0x0bfe('0x38')](_0x153e1e[_0x0bfe('0x36')],qs[_0x0bfe('0x39')](_0x3b6ec0[_0x0bfe('0x33')]['fields']));_0x496de5[_0x0bfe('0x37')]=_0x496de5[_0x0bfe('0x37')][_0x0bfe('0x3a')]?_0x496de5['attributes']:_0x153e1e['model'];if(_0x3b6ec0[_0x0bfe('0x33')]['includeAll']){_0x496de5['include']=[{'all':!![]}];}_0x496de5=_[_0x0bfe('0x42')]({},_0x496de5,_0x3b6ec0[_0x0bfe('0x48')]);return db['Dashboard'][_0x0bfe('0x49')](_0x496de5)[_0x0bfe('0x26')](handleEntityNotFound(_0x225d56,null))[_0x0bfe('0x26')](function(_0x182c99){if(_0x182c99){var _0x428a11=_0x182c99[_0x0bfe('0x28')]({'plain':!![]});_0x428a11=qs[_0x0bfe('0x53')](_0x428a11,['id',_0x0bfe('0x54'),'updatedAt']);_0x3b6ec0[_0x0bfe('0x4b')]=_[_0x0bfe('0x53')](_0x3b6ec0[_0x0bfe('0x4b')],['id',_0x0bfe('0x54'),_0x0bfe('0x55')]);return db[_0x0bfe('0x2f')][_0x0bfe('0x4a')](_[_0x0bfe('0x42')](_0x428a11,_0x3b6ec0['body']),{'include':_0x3b6ec0[_0x0bfe('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x34c8ea){var _0x334fd6=_0x3b6ec0['user'][_0x0bfe('0x28')]({'plain':!![]});if(!_0x334fd6)throw new Error(_0x0bfe('0x4c'));if(_0x334fd6[_0x0bfe('0x56')]===_0x0bfe('0x57')){var _0x5c1fc3=_0x34c8ea[_0x0bfe('0x28')]({'plain':!![]});var _0x566863=_0x0bfe('0x4d');return db[_0x0bfe('0x4e')][_0x0bfe('0x49')]({'where':{'name':_0x566863,'userProfileId':_0x334fd6[_0x0bfe('0x58')]},'raw':!![]})[_0x0bfe('0x26')](function(_0x2f1af7){if(_0x2f1af7&&_0x2f1af7['autoAssociation']===0x0){return db['UserProfileResource'][_0x0bfe('0x4a')]({'name':_0x5c1fc3[_0x0bfe('0x2c')],'resourceId':_0x5c1fc3['id'],'type':_0x2f1af7[_0x0bfe('0x2c')],'sectionId':_0x2f1af7['id']},{})[_0x0bfe('0x26')](function(){return _0x34c8ea;});}else{return _0x34c8ea;}})['catch'](function(_0x5352a4){logger[_0x0bfe('0x2a')](_0x0bfe('0x50'),_0x5352a4);throw _0x5352a4;});}return _0x34c8ea;});}})[_0x0bfe('0x26')](respondWithResult(_0x225d56,0xc9))[_0x0bfe('0x46')](handleError(_0x225d56,null));};exports[_0x0bfe('0x25')]=function(_0x5ad7f5,_0x35cd49){if(_0x5ad7f5['body']['id']){delete _0x5ad7f5['body']['id'];}return db[_0x0bfe('0x2f')][_0x0bfe('0x49')]({'where':{'id':_0x5ad7f5[_0x0bfe('0x52')]['id']}})[_0x0bfe('0x26')](handleEntityNotFound(_0x35cd49,null))[_0x0bfe('0x26')](saveUpdates(_0x5ad7f5[_0x0bfe('0x4b')],null))['then'](respondWithResult(_0x35cd49,null))[_0x0bfe('0x46')](handleError(_0x35cd49,null));};exports[_0x0bfe('0x27')]=function(_0x2223bf,_0x755109){return db['Dashboard']['find']({'where':{'id':_0x2223bf['params']['id']}})[_0x0bfe('0x26')](handleEntityNotFound(_0x755109,null))['then'](removeEntity(_0x755109,null))['catch'](handleError(_0x755109,null));};function widgetAttributes(_0x4c462b){try{switch(_0x4c462b['type']){case _0x0bfe('0x59'):return[{'name':_0x0bfe('0x5a'),'value':_0x4c462b['attrUrl']||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b['attrs'][0x0]?_0x4c462b['attrs'][0x0][_0x0bfe('0x5c')]:undefined)||_0x0bfe('0x5d')}];case'custom':return[{'name':_0x0bfe('0x5e'),'value':_0x4c462b[_0x0bfe('0x5e')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x0]?_0x4c462b[_0x0bfe('0x5b')][0x0]['value']:undefined)||''}];case _0x0bfe('0x5f'):return[{'name':_0x0bfe('0x60'),'value':_0x4c462b[_0x0bfe('0x60')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x0]?_0x4c462b[_0x0bfe('0x5b')][0x0][_0x0bfe('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x0bfe('0x61'),'value':_0x4c462b[_0x0bfe('0x61')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b['attrs'][0x1]?_0x4c462b[_0x0bfe('0x5b')][0x1][_0x0bfe('0x5c')]:undefined)||_0x0bfe('0x62')},{'name':_0x0bfe('0x63'),'value':_0x4c462b[_0x0bfe('0x63')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x2]?_0x4c462b[_0x0bfe('0x5b')][0x2][_0x0bfe('0x5c')]:undefined)||0xc}];case _0x0bfe('0x64'):return[{'name':_0x0bfe('0x65'),'value':_0x4c462b[_0x0bfe('0x65')]||(_0x4c462b['attrs']&&_0x4c462b['attrs'][0x0]?_0x4c462b[_0x0bfe('0x5b')][0x0][_0x0bfe('0x5c')]:undefined)||_0x0bfe('0x66')},{'name':_0x0bfe('0x67'),'value':_0x4c462b[_0x0bfe('0x67')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x1]?_0x4c462b[_0x0bfe('0x5b')][0x1]['value']:undefined)||[]},{'name':_0x0bfe('0x63'),'value':_0x4c462b[_0x0bfe('0x63')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x2]?_0x4c462b[_0x0bfe('0x5b')][0x2]['value']:undefined)||0x14},{'name':_0x0bfe('0x68'),'value':_0x4c462b[_0x0bfe('0x68')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x3]?_0x4c462b[_0x0bfe('0x5b')][0x3][_0x0bfe('0x5c')]:undefined)||_0x0bfe('0x69')},{'name':'attrEmailAccounts','value':_0x4c462b['attrEmailAccounts']||(_0x4c462b['attrs']&&_0x4c462b['attrs'][0x4]?_0x4c462b[_0x0bfe('0x5b')][0x4][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6a'),'value':_0x4c462b[_0x0bfe('0x6a')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x5]?_0x4c462b['attrs'][0x5][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6b'),'value':_0x4c462b[_0x0bfe('0x6b')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x6]?_0x4c462b['attrs'][0x6][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6c'),'value':_0x4c462b[_0x0bfe('0x6c')]||(_0x4c462b['attrs']&&_0x4c462b[_0x0bfe('0x5b')][0x7]?_0x4c462b[_0x0bfe('0x5b')][0x7]['value']:undefined)||''},{'name':_0x0bfe('0x6d'),'value':_0x4c462b[_0x0bfe('0x6d')]||(_0x4c462b['attrs']&&_0x4c462b[_0x0bfe('0x5b')][0x8]?_0x4c462b[_0x0bfe('0x5b')][0x8][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6e'),'value':_0x4c462b[_0x0bfe('0x6e')]||(_0x4c462b['attrs']&&_0x4c462b['attrs'][0x9]?_0x4c462b['attrs'][0x9][_0x0bfe('0x5c')]:undefined)||''}];case _0x0bfe('0x6f'):case _0x0bfe('0x70'):return[{'name':_0x0bfe('0x71'),'value':_0x4c462b['attrSerie1']||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x0]?_0x4c462b[_0x0bfe('0x5b')][0x0][_0x0bfe('0x5c')]:undefined)||_0x0bfe('0x66')},{'name':'attrSerie2','value':_0x4c462b['attrSerie2']||(_0x4c462b['attrs']&&_0x4c462b['attrs'][0x1]?_0x4c462b['attrs'][0x1][_0x0bfe('0x5c')]:undefined)||null},{'name':_0x0bfe('0x72'),'value':_0x4c462b[_0x0bfe('0x72')]||(_0x4c462b['attrs']&&_0x4c462b[_0x0bfe('0x5b')][0x2]?_0x4c462b[_0x0bfe('0x5b')][0x2][_0x0bfe('0x5c')]:undefined)||null},{'name':_0x0bfe('0x67'),'value':_0x4c462b[_0x0bfe('0x67')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x3]?_0x4c462b[_0x0bfe('0x5b')][0x3][_0x0bfe('0x5c')]:undefined)||[]},{'name':_0x0bfe('0x68'),'value':_0x4c462b[_0x0bfe('0x68')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x4]?_0x4c462b[_0x0bfe('0x5b')][0x4][_0x0bfe('0x5c')]:undefined)||_0x0bfe('0x69')},{'name':_0x0bfe('0x73'),'value':_0x4c462b[_0x0bfe('0x73')]||(_0x4c462b['attrs']&&_0x4c462b['attrs'][0x5]?_0x4c462b[_0x0bfe('0x5b')][0x5][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6a'),'value':_0x4c462b[_0x0bfe('0x6a')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b['attrs'][0x6]?_0x4c462b[_0x0bfe('0x5b')][0x6][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6b'),'value':_0x4c462b[_0x0bfe('0x6b')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x7]?_0x4c462b[_0x0bfe('0x5b')][0x7][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6c'),'value':_0x4c462b[_0x0bfe('0x6c')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x8]?_0x4c462b[_0x0bfe('0x5b')][0x8][_0x0bfe('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4c462b[_0x0bfe('0x6d')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x9]?_0x4c462b['attrs'][0x9][_0x0bfe('0x5c')]:undefined)||''},{'name':_0x0bfe('0x6e'),'value':_0x4c462b[_0x0bfe('0x6e')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0xa]?_0x4c462b[_0x0bfe('0x5b')][0xa][_0x0bfe('0x5c')]:undefined)||''}];case _0x0bfe('0x74'):return[{'name':_0x0bfe('0x75'),'type':_0x4c462b[_0x0bfe('0x76')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x0]?_0x4c462b[_0x0bfe('0x5b')][0x0]['type']:undefined)||null,'value':_0x4c462b[_0x0bfe('0x75')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x0]?_0x4c462b['attrs'][0x0][_0x0bfe('0x5c')]:undefined)||null},{'name':_0x0bfe('0x77'),'value':_0x4c462b[_0x0bfe('0x77')]||(_0x4c462b[_0x0bfe('0x5b')]&&_0x4c462b[_0x0bfe('0x5b')][0x1]?_0x4c462b[_0x0bfe('0x5b')][0x1][_0x0bfe('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x5d90fc){logger[_0x0bfe('0x2a')](_0x0bfe('0x78'),JSON['stringify'](_0x5d90fc));return[];}}exports[_0x0bfe('0x79')]=function(_0x176492,_0xf64bd9,_0x52c8b2){if(_0x176492[_0x0bfe('0x4b')]['id']){delete _0x176492[_0x0bfe('0x4b')]['id'];}return db[_0x0bfe('0x2f')]['find']({'where':{'id':_0x176492['params']['id']}})['then'](handleEntityNotFound(_0xf64bd9,null))[_0x0bfe('0x26')](function(_0x3d6b98){if(_0x3d6b98){_0x176492[_0x0bfe('0x4b')][_0x0bfe('0x7a')]=_0x3d6b98['id'];_0x176492[_0x0bfe('0x4b')][_0x0bfe('0x5b')]=widgetAttributes(_0x176492[_0x0bfe('0x4b')]);return db[_0x0bfe('0x7b')][_0x0bfe('0x4a')](_0x176492[_0x0bfe('0x4b')]);}})['then'](respondWithResult(_0xf64bd9,null))[_0x0bfe('0x46')](handleError(_0xf64bd9,null));};exports[_0x0bfe('0x7c')]=function(_0x5a4f0a,_0x2ff755,_0x2d2f78){var _0x3eb610={};var _0x55810c={};var _0x198007;var _0x86daab;return db['Dashboard'][_0x0bfe('0x7d')]({'where':{'id':_0x5a4f0a[_0x0bfe('0x52')]['id']}})[_0x0bfe('0x26')](handleEntityNotFound(_0x2ff755,null))['then'](function(_0x47ec30){if(_0x47ec30){_0x198007=_0x47ec30;_0x55810c[_0x0bfe('0x36')]=_[_0x0bfe('0x34')](db[_0x0bfe('0x7b')]['rawAttributes']);_0x55810c['query']=_[_0x0bfe('0x34')](_0x5a4f0a['query']);_0x55810c[_0x0bfe('0x35')]=_[_0x0bfe('0x38')](_0x55810c[_0x0bfe('0x36')],_0x55810c[_0x0bfe('0x33')]);_0x3eb610[_0x0bfe('0x37')]=_[_0x0bfe('0x38')](_0x55810c['model'],qs[_0x0bfe('0x39')](_0x5a4f0a[_0x0bfe('0x33')]['fields']));_0x3eb610[_0x0bfe('0x37')]=_0x3eb610[_0x0bfe('0x37')]['length']?_0x3eb610[_0x0bfe('0x37')]:_0x55810c[_0x0bfe('0x36')];_0x3eb610[_0x0bfe('0x3d')]=qs['sort'](_0x5a4f0a['query'][_0x0bfe('0x3e')]);_0x3eb610[_0x0bfe('0x3f')]=qs[_0x0bfe('0x35')](_['pick'](_0x5a4f0a[_0x0bfe('0x33')],_0x55810c['filters']));if(_0x5a4f0a[_0x0bfe('0x33')][_0x0bfe('0x41')]){_0x3eb610[_0x0bfe('0x3f')]=_[_0x0bfe('0x42')](_0x3eb610[_0x0bfe('0x3f')],{'$or':_[_0x0bfe('0x2e')](_0x3eb610[_0x0bfe('0x37')],function(_0x98eeb5){var _0x3e6759={};_0x3e6759[_0x98eeb5]={'$like':'%'+_0x5a4f0a['query'][_0x0bfe('0x41')]+'%'};return _0x3e6759;})});}_0x3eb610=_['merge']({},_0x3eb610,_0x5a4f0a['options']);return _0x198007[_0x0bfe('0x7c')](_0x3eb610);}})[_0x0bfe('0x26')](function(_0x129599){if(_0x129599){_0x86daab=_0x129599[_0x0bfe('0x3a')];if(!_0x5a4f0a[_0x0bfe('0x33')][_0x0bfe('0x3b')]('nolimit')){_0x3eb610['limit']=qs['limit'](_0x5a4f0a[_0x0bfe('0x33')][_0x0bfe('0x1f')]);_0x3eb610[_0x0bfe('0x21')]=qs[_0x0bfe('0x21')](_0x5a4f0a[_0x0bfe('0x33')][_0x0bfe('0x21')]);}return _0x198007['getItems'](_0x3eb610);}})[_0x0bfe('0x26')](function(_0x494cf7){if(_0x494cf7){return _0x494cf7?{'count':_0x86daab,'rows':_0x494cf7}:null;}})[_0x0bfe('0x26')](respondWithResult(_0x2ff755,null))['catch'](handleError(_0x2ff755,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7c1b27a..97dafff 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 _0xba49=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x25112f,_0xb87d5c){var _0x4a2975=function(_0x3238ab){while(--_0x3238ab){_0x25112f['push'](_0x25112f['shift']());}};_0x4a2975(++_0xb87d5c);}(_0xba49,0x1b4));var _0x9ba4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xba49[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x9ba4('0x0'));var Dashboard=require(_0x9ba4('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9ba4('0x2')](0x0);var events={'afterCreate':_0x9ba4('0x3'),'afterUpdate':'update','afterDestroy':_0x9ba4('0x4')};function emitEvent(_0xb3cf54){return function(_0xc46af3,_0x446f98,_0x62631c){DashboardEvents[_0x9ba4('0x5')](_0xb3cf54+':'+_0xc46af3['id'],_0xc46af3);DashboardEvents['emit'](_0xb3cf54,_0xc46af3);_0x62631c(null);};}for(var e in events){if(events[_0x9ba4('0x6')](e)){var event=events[e];Dashboard[_0x9ba4('0x7')](e,emitEvent(event));}}module[_0x9ba4('0x8')]=DashboardEvents; \ No newline at end of file +var _0x39b5=['exports','Dashboard','save','update','emit','hasOwnProperty','hook'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x39b5,0x1ba));var _0x539b=function(_0x547ff0,_0x267bfd){_0x547ff0=_0x547ff0-0x0;var _0x35fe16=_0x39b5[_0x547ff0];return _0x35fe16;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x539b('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x539b('0x1'),'afterUpdate':_0x539b('0x2'),'afterDestroy':'remove'};function emitEvent(_0x508ce6){return function(_0x222da1,_0x516169,_0x2d1f89){DashboardEvents['emit'](_0x508ce6+':'+_0x222da1['id'],_0x222da1);DashboardEvents[_0x539b('0x3')](_0x508ce6,_0x222da1);_0x2d1f89(null);};}for(var e in events){if(events[_0x539b('0x4')](e)){var event=events[e];Dashboard[_0x539b('0x5')](e,emitEvent(event));}}module[_0x539b('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f205ae9..640d26a 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 _0xcfef=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','../../config/logger','bluebird'];(function(_0x591886,_0x2bf05a){var _0x45a1b0=function(_0x4f7fc6){while(--_0x4f7fc6){_0x591886['push'](_0x591886['shift']());}};_0x45a1b0(++_0x2bf05a);}(_0xcfef,0x1b5));var _0xfcfe=function(_0x4e4dcd,_0x25b419){_0x4e4dcd=_0x4e4dcd-0x0;var _0x6bebaa=_0xcfef[_0x4e4dcd];return _0x6bebaa;};'use strict';var _=require(_0xfcfe('0x0'));var util=require('util');var logger=require(_0xfcfe('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfcfe('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcfe('0x3'));var rimraf=require(_0xfcfe('0x4'));var config=require(_0xfcfe('0x5'));var attributes=require(_0xfcfe('0x6'));module[_0xfcfe('0x7')]=function(_0x58236a,_0x68c3ea){return _0x58236a[_0xfcfe('0x8')](_0xfcfe('0x9'),attributes,{'tableName':_0xfcfe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x135b=['request-promise','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger','api','bluebird'];(function(_0x4af763,_0x26ac13){var _0x2fcdd6=function(_0x136450){while(--_0x136450){_0x4af763['push'](_0x4af763['shift']());}};_0x2fcdd6(++_0x26ac13);}(_0x135b,0xaf));var _0xb135=function(_0x3f5290,_0x53c67c){_0x3f5290=_0x3f5290-0x0;var _0x8a452d=_0x135b[_0x3f5290];return _0x8a452d;};'use strict';var _=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var logger=require(_0xb135('0x2'))(_0xb135('0x3'));var moment=require('moment');var BPromise=require(_0xb135('0x4'));var rp=require(_0xb135('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb135('0x6'));var config=require(_0xb135('0x7'));var attributes=require(_0xb135('0x8'));module['exports']=function(_0x51a09c,_0x5b96fe){return _0x51a09c[_0xb135('0x9')](_0xb135('0xa'),attributes,{'tableName':_0xb135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 926651c..2788bdc 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 _0x66c7=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x557668,_0x20a0dc){var _0x3c2a37=function(_0x11d68a){while(--_0x11d68a){_0x557668['push'](_0x557668['shift']());}};_0x3c2a37(++_0x20a0dc);}(_0x66c7,0x1b4));var _0x766c=function(_0x856ee4,_0x305a07){_0x856ee4=_0x856ee4-0x0;var _0x4e6b71=_0x66c7[_0x856ee4];return _0x4e6b71;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var BPromise=require(_0x766c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x766c('0x4'));var db=require(_0x766c('0x5'))['db'];var utils=require(_0x766c('0x6'));var logger=require('../../config/logger')(_0x766c('0x7'));var config=require(_0x766c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x766c('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x766c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x766c('0xb'))(new Redis(config[_0x766c('0xa')]));require(_0x766c('0xc'))['register'](socket);function respondWithRpcPromise(_0x50bdf9,_0x333837,_0x340dcc){return new BPromise(function(_0x49ba23,_0x56307f){return client[_0x766c('0xd')](_0x50bdf9,_0x340dcc)[_0x766c('0xe')](function(_0x1d7ffd){logger[_0x766c('0xf')](_0x766c('0x10'),_0x333837,_0x766c('0x11'));logger[_0x766c('0x12')](_0x766c('0x13'),_0x333837,_0x766c('0x11'),JSON['stringify'](_0x1d7ffd));if(_0x1d7ffd[_0x766c('0x14')]){if(_0x1d7ffd[_0x766c('0x14')]['code']===0x1f4){logger['error'](_0x766c('0x10'),_0x333837,_0x1d7ffd[_0x766c('0x14')]['message']);return _0x56307f(_0x1d7ffd[_0x766c('0x14')][_0x766c('0x15')]);}logger[_0x766c('0x14')](_0x766c('0x10'),_0x333837,_0x1d7ffd[_0x766c('0x14')]['message']);return _0x49ba23(_0x1d7ffd[_0x766c('0x14')]['message']);}else{logger[_0x766c('0xf')](_0x766c('0x10'),_0x333837,_0x766c('0x11'));_0x49ba23(_0x1d7ffd[_0x766c('0x16')]['message']);}})[_0x766c('0x17')](function(_0x18d779){logger[_0x766c('0x14')](_0x766c('0x10'),_0x333837,_0x18d779);_0x56307f(_0x18d779);});});} \ No newline at end of file +var _0x9b02=['error','code','Dashboard,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a50f3,_0x20df54){var _0x1c370d=function(_0x32a226){while(--_0x32a226){_0x5a50f3['push'](_0x5a50f3['shift']());}};_0x1c370d(++_0x20df54);}(_0x9b02,0x17d));var _0x29b0=function(_0x4714c1,_0xa0c259){_0x4714c1=_0x4714c1-0x0;var _0x42a68d=_0x9b02[_0x4714c1];return _0x42a68d;};'use strict';var _=require('lodash');var util=require(_0x29b0('0x0'));var moment=require(_0x29b0('0x1'));var BPromise=require(_0x29b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29b0('0x3'))['db'];var utils=require(_0x29b0('0x4'));var logger=require('../../config/logger')(_0x29b0('0x5'));var config=require(_0x29b0('0x6'));var jayson=require(_0x29b0('0x7'));var client=jayson[_0x29b0('0x8')]['http']({'port':0x232a});config[_0x29b0('0x9')]=_['defaults'](config[_0x29b0('0x9')],{'host':_0x29b0('0xa'),'port':0x18eb});var socket=require(_0x29b0('0xb'))(new Redis(config[_0x29b0('0x9')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x1d7220,_0x2a5005,_0x42cd12){return new BPromise(function(_0x560241,_0x110180){return client[_0x29b0('0xc')](_0x1d7220,_0x42cd12)[_0x29b0('0xd')](function(_0x2d739f){logger[_0x29b0('0xe')]('Dashboard,\x20%s,\x20%s',_0x2a5005,_0x29b0('0xf'));logger[_0x29b0('0x10')](_0x29b0('0x11'),_0x2a5005,_0x29b0('0xf'),JSON[_0x29b0('0x12')](_0x2d739f));if(_0x2d739f[_0x29b0('0x13')]){if(_0x2d739f['error'][_0x29b0('0x14')]===0x1f4){logger['error'](_0x29b0('0x15'),_0x2a5005,_0x2d739f[_0x29b0('0x13')][_0x29b0('0x16')]);return _0x110180(_0x2d739f['error'][_0x29b0('0x16')]);}logger[_0x29b0('0x13')](_0x29b0('0x15'),_0x2a5005,_0x2d739f[_0x29b0('0x13')][_0x29b0('0x16')]);return _0x560241(_0x2d739f[_0x29b0('0x13')][_0x29b0('0x16')]);}else{logger[_0x29b0('0xe')](_0x29b0('0x15'),_0x2a5005,_0x29b0('0xf'));_0x560241(_0x2d739f[_0x29b0('0x17')][_0x29b0('0x16')]);}})[_0x29b0('0x18')](function(_0x4dfeb5){logger['error'](_0x29b0('0x15'),_0x2a5005,_0x4dfeb5);_0x110180(_0x4dfeb5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b424580..83fcbeb 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 _0x069e=['emit','register','./dashboard.events','save','remove','update'];(function(_0x1304b2,_0x104075){var _0x1d1155=function(_0x2eac5c){while(--_0x2eac5c){_0x1304b2['push'](_0x1304b2['shift']());}};_0x1d1155(++_0x104075);}(_0x069e,0x104));var _0xe069=function(_0x1eb402,_0x164f02){_0x1eb402=_0x1eb402-0x0;var _0x577f76=_0x069e[_0x1eb402];return _0x577f76;};'use strict';var DashboardEvents=require(_0xe069('0x0'));var events=[_0xe069('0x1'),_0xe069('0x2'),_0xe069('0x3')];function createListener(_0xb2ee44,_0x4e7698){return function(_0x17fcad){_0x4e7698[_0xe069('0x4')](_0xb2ee44,_0x17fcad);};}function removeListener(_0x1ef9bc,_0x2c6c89){return function(){DashboardEvents['removeListener'](_0x1ef9bc,_0x2c6c89);};}exports[_0xe069('0x5')]=function(_0x113611){for(var _0x2828db=0x0,_0x1d9a84=events['length'];_0x2828db<_0x1d9a84;_0x2828db++){var _0x190d27=events[_0x2828db];var _0x3a04d8=createListener('dashboard:'+_0x190d27,_0x113611);DashboardEvents['on'](_0x190d27,_0x3a04d8);}}; \ No newline at end of file +var _0x794b=['remove','update','emit','register','dashboard:','./dashboard.events','save'];(function(_0x48ef1c,_0x2a6c66){var _0x3119d4=function(_0x45e954){while(--_0x45e954){_0x48ef1c['push'](_0x48ef1c['shift']());}};_0x3119d4(++_0x2a6c66);}(_0x794b,0x6e));var _0xb794=function(_0x27af71,_0x341999){_0x27af71=_0x27af71-0x0;var _0x337775=_0x794b[_0x27af71];return _0x337775;};'use strict';var DashboardEvents=require(_0xb794('0x0'));var events=[_0xb794('0x1'),_0xb794('0x2'),_0xb794('0x3')];function createListener(_0x43ae35,_0x100dd1){return function(_0x12439f){_0x100dd1[_0xb794('0x4')](_0x43ae35,_0x12439f);};}function removeListener(_0x1947a1,_0xf75056){return function(){DashboardEvents['removeListener'](_0x1947a1,_0xf75056);};}exports[_0xb794('0x5')]=function(_0x3ab9c6){for(var _0x32439e=0x0,_0x5c91d5=events['length'];_0x32439e<_0x5c91d5;_0x32439e++){var _0x1f3675=events[_0x32439e];var _0x5162e2=createListener(_0xb794('0x6')+_0x1f3675,_0x3ab9c6);DashboardEvents['on'](_0x1f3675,_0x5162e2);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6926b66..9993613 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 _0xd7eb=['post','create','/:id/clone','addItem','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems'];(function(_0x5defe5,_0x454030){var _0x1a53f2=function(_0x5d5502){while(--_0x5d5502){_0x5defe5['push'](_0x5defe5['shift']());}};_0x1a53f2(++_0x454030);}(_0xd7eb,0x6c));var _0xbd7e=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xd7eb[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0xbd7e('0x0'));var util=require(_0xbd7e('0x1'));var path=require(_0xbd7e('0x2'));var timeout=require(_0xbd7e('0x3'));var express=require(_0xbd7e('0x4'));var router=express[_0xbd7e('0x5')]();var fs_extra=require(_0xbd7e('0x6'));var auth=require(_0xbd7e('0x7'));var interaction=require(_0xbd7e('0x8'));var config=require(_0xbd7e('0x9'));var controller=require('./dashboard.controller');router[_0xbd7e('0xa')]('/',auth[_0xbd7e('0xb')](),controller[_0xbd7e('0xc')]);router[_0xbd7e('0xa')](_0xbd7e('0xd'),auth[_0xbd7e('0xb')](),controller[_0xbd7e('0xe')]);router['get'](_0xbd7e('0xf'),auth[_0xbd7e('0xb')](),controller[_0xbd7e('0x10')]);router[_0xbd7e('0x11')]('/',auth[_0xbd7e('0xb')](),controller[_0xbd7e('0x12')]);router[_0xbd7e('0x11')](_0xbd7e('0x13'),auth[_0xbd7e('0xb')](),controller['clone']);router[_0xbd7e('0x11')](_0xbd7e('0xf'),auth['isAuthenticated'](),controller[_0xbd7e('0x14')]);router[_0xbd7e('0x15')](_0xbd7e('0xd'),auth['isAuthenticated'](),controller[_0xbd7e('0x16')]);router[_0xbd7e('0x17')](_0xbd7e('0xd'),auth[_0xbd7e('0xb')](),controller['destroy']);module[_0xbd7e('0x18')]=router; \ No newline at end of file +var _0xcceb=['create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0xcceb,0xec));var _0xbcce=function(_0x281678,_0x1dd450){_0x281678=_0x281678-0x0;var _0x5c9ac8=_0xcceb[_0x281678];return _0x5c9ac8;};'use strict';var multer=require(_0xbcce('0x0'));var util=require(_0xbcce('0x1'));var path=require(_0xbcce('0x2'));var timeout=require(_0xbcce('0x3'));var express=require('express');var router=express[_0xbcce('0x4')]();var fs_extra=require(_0xbcce('0x5'));var auth=require(_0xbcce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcce('0x7'));var controller=require(_0xbcce('0x8'));router[_0xbcce('0x9')]('/',auth[_0xbcce('0xa')](),controller[_0xbcce('0xb')]);router[_0xbcce('0x9')](_0xbcce('0xc'),auth[_0xbcce('0xa')](),controller['show']);router[_0xbcce('0x9')](_0xbcce('0xd'),auth[_0xbcce('0xa')](),controller[_0xbcce('0xe')]);router[_0xbcce('0xf')]('/',auth[_0xbcce('0xa')](),controller[_0xbcce('0x10')]);router[_0xbcce('0xf')]('/:id/clone',auth[_0xbcce('0xa')](),controller['clone']);router[_0xbcce('0xf')]('/:id/items',auth[_0xbcce('0xa')](),controller['addItem']);router[_0xbcce('0x11')](_0xbcce('0xc'),auth[_0xbcce('0xa')](),controller[_0xbcce('0x12')]);router['delete'](_0xbcce('0xc'),auth[_0xbcce('0xa')](),controller[_0xbcce('0x13')]);module[_0xbcce('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 242aabb..81f0115 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 _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x1261,0x144));var _0x1126=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0x1261[_0x5bf2b3];return _0x5e8a9b;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x814b=['lodash','exports','STRING','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel'];(function(_0x24df34,_0x50aa1a){var _0x3980e8=function(_0x24c43f){while(--_0x24c43f){_0x24df34['push'](_0x24df34['shift']());}};_0x3980e8(++_0x50aa1a);}(_0x814b,0x1a2));var _0xb814=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x814b[_0x59b439];return _0x521ea3;};'use strict';var Sequelize=require(_0xb814('0x0'));var squel=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));module[_0xb814('0x3')]={'title':{'type':Sequelize[_0xb814('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xb814('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xb814('0x5')),'get':function(){try{return JSON[_0xb814('0x6')](this[_0xb814('0x7')](_0xb814('0x8')));}catch(_0x44931c){return[];}},'set':function(_0x322a70){try{this['setDataValue'](_0xb814('0x8'),JSON[_0xb814('0x9')](_0x322a70));}catch(_0x5c8539){this[_0xb814('0xa')](_0xb814('0x8'),JSON[_0xb814('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb814('0xb')]},'col':{'type':Sequelize[_0xb814('0xb')]},'background':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xb814('0xb')],'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 4912494..cc71560 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 _0xe558=['multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','redis','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','attributes','fields','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites'];(function(_0x327232,_0x32fa9c){var _0x5cdbcf=function(_0x3bdd1e){while(--_0x3bdd1e){_0x327232['push'](_0x327232['shift']());}};_0x5cdbcf(++_0x32fa9c);}(_0xe558,0x70));var _0x8e55=function(_0x434356,_0x176c70){_0x434356=_0x434356-0x0;var _0x36bc0d=_0xe558[_0x434356];return _0x36bc0d;};'use strict';var emlformat=require(_0x8e55('0x0'));var rimraf=require(_0x8e55('0x1'));var zipdir=require(_0x8e55('0x2'));var jsonpatch=require(_0x8e55('0x3'));var rp=require(_0x8e55('0x4'));var moment=require(_0x8e55('0x5'));var BPromise=require(_0x8e55('0x6'));var Mustache=require(_0x8e55('0x7'));var util=require(_0x8e55('0x8'));var path=require('path');var sox=require(_0x8e55('0x9'));var csv=require(_0x8e55('0xa'));var ejs=require(_0x8e55('0xb'));var fs=require('fs');var fs_extra=require(_0x8e55('0xc'));var _=require(_0x8e55('0xd'));var squel=require(_0x8e55('0xe'));var crypto=require('crypto');var jsforce=require(_0x8e55('0xf'));var deskjs=require(_0x8e55('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8e55('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e55('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e55('0x13'))(_0x8e55('0x14'));var utils=require(_0x8e55('0x15'));var config=require(_0x8e55('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e55('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x8e55('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e55('0x19')]));require(_0x8e55('0x1a'))[_0x8e55('0x1b')](socket);function respondWithStatusCode(_0x2b5a04,_0x8cbfc7){_0x8cbfc7=_0x8cbfc7||0xcc;return function(_0x125388){if(_0x125388){return _0x2b5a04[_0x8e55('0x1c')](_0x8cbfc7);}return _0x2b5a04[_0x8e55('0x1d')](_0x8cbfc7)[_0x8e55('0x1e')]();};}function respondWithResult(_0xb2e25e,_0x45029c){_0x45029c=_0x45029c||0xc8;return function(_0x1d6b69){if(_0x1d6b69){return _0xb2e25e[_0x8e55('0x1d')](_0x45029c)[_0x8e55('0x1f')](_0x1d6b69);}};}function respondWithFilteredResult(_0x411b79,_0x5ac9f4){return function(_0xda8f1a){if(_0xda8f1a){var _0x1e5d1f=typeof _0x5ac9f4[_0x8e55('0x20')]===_0x8e55('0x21')&&typeof _0x5ac9f4['limit']===_0x8e55('0x21');var _0x148b4a=_0xda8f1a[_0x8e55('0x22')];var _0x4583e5=_0x1e5d1f?0x0:_0x5ac9f4[_0x8e55('0x20')];var _0xa7551d=_0x1e5d1f?_0xda8f1a[_0x8e55('0x22')]:_0x5ac9f4[_0x8e55('0x20')]+_0x5ac9f4['limit'];var _0x4d69bc;if(_0xa7551d>=_0x148b4a){_0xa7551d=_0x148b4a;_0x4d69bc=0xc8;}else{_0x4d69bc=0xce;}_0x411b79[_0x8e55('0x1d')](_0x4d69bc);return _0x411b79[_0x8e55('0x23')](_0x8e55('0x24'),_0x4583e5+'-'+_0xa7551d+'/'+_0x148b4a)['json'](_0xda8f1a);}return null;};}function patchUpdates(_0x42adae){return function(_0x154175){try{jsonpatch[_0x8e55('0x25')](_0x154175,_0x42adae,!![]);}catch(_0xa9484f){return BPromise[_0x8e55('0x26')](_0xa9484f);}return _0x154175[_0x8e55('0x27')]();};}function saveUpdates(_0x493308,_0x276bc0){return function(_0x430fb1){if(_0x430fb1){return _0x430fb1['update'](_0x493308)[_0x8e55('0x28')](function(_0x3f6fd8){return _0x3f6fd8;});}return null;};}function removeEntity(_0x166148,_0x2fe96d){return function(_0x2d6e4d){if(_0x2d6e4d){return _0x2d6e4d[_0x8e55('0x29')]()[_0x8e55('0x28')](function(){_0x166148[_0x8e55('0x1d')](0xcc)[_0x8e55('0x1e')]();});}};}function handleEntityNotFound(_0x45fedf,_0x4692c5){return function(_0x5393e6){if(!_0x5393e6){_0x45fedf[_0x8e55('0x1c')](0x194);}return _0x5393e6;};}function handleError(_0x2411b2,_0xf4ff6a){_0xf4ff6a=_0xf4ff6a||0x1f4;return function(_0x2a8ccb){logger['error'](_0x2a8ccb[_0x8e55('0x2a')]);if(_0x2a8ccb['name']){delete _0x2a8ccb[_0x8e55('0x2b')];}_0x2411b2[_0x8e55('0x1d')](_0xf4ff6a)['send'](_0x2a8ccb);};}exports[_0x8e55('0x2c')]=function(_0x641786,_0x454635){var _0x52b0d8={'raw':![],'where':{'id':_0x641786[_0x8e55('0x2d')]['id']}},_0x3a8c4d={};_0x3a8c4d[_0x8e55('0x2e')]=_[_0x8e55('0x2f')](db[_0x8e55('0x30')][_0x8e55('0x31')]);_0x3a8c4d[_0x8e55('0x32')]=_[_0x8e55('0x2f')](_0x641786['query']);_0x3a8c4d['filters']=_['intersection'](_0x3a8c4d[_0x8e55('0x2e')],_0x3a8c4d[_0x8e55('0x32')]);_0x52b0d8[_0x8e55('0x33')]=_['intersection'](_0x3a8c4d[_0x8e55('0x2e')],qs['fields'](_0x641786['query'][_0x8e55('0x34')]));_0x52b0d8[_0x8e55('0x33')]=_0x52b0d8['attributes'][_0x8e55('0x35')]?_0x52b0d8[_0x8e55('0x33')]:_0x3a8c4d[_0x8e55('0x2e')];if(_0x641786[_0x8e55('0x32')][_0x8e55('0x36')]){_0x52b0d8['include']=[{'all':!![]}];}_0x52b0d8=_[_0x8e55('0x37')]({},_0x52b0d8,_0x641786[_0x8e55('0x38')]);return db[_0x8e55('0x30')][_0x8e55('0x39')](_0x52b0d8)['then'](handleEntityNotFound(_0x454635,null))[_0x8e55('0x28')](respondWithResult(_0x454635,null))[_0x8e55('0x3a')](handleError(_0x454635,null));};exports[_0x8e55('0x29')]=function(_0x517048,_0x17e3dc){return db[_0x8e55('0x30')][_0x8e55('0x39')]({'where':{'id':_0x517048[_0x8e55('0x2d')]['id']}})[_0x8e55('0x28')](handleEntityNotFound(_0x17e3dc,null))[_0x8e55('0x28')](removeEntity(_0x17e3dc,null))['catch'](handleError(_0x17e3dc,null));};function widgetAttributes(_0x40f69d){try{switch(_0x40f69d[_0x8e55('0x3b')]){case _0x8e55('0x3c'):return[{'name':_0x8e55('0x3d'),'value':_0x40f69d[_0x8e55('0x3d')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x0]?_0x40f69d[_0x8e55('0x3e')][0x0][_0x8e55('0x3f')]:undefined)||_0x8e55('0x40')}];case _0x8e55('0x41'):return[{'name':_0x8e55('0x42'),'value':_0x40f69d[_0x8e55('0x42')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x0]?_0x40f69d['attrs'][0x0][_0x8e55('0x3f')]:undefined)||''}];case _0x8e55('0x43'):return[{'name':_0x8e55('0x44'),'value':_0x40f69d[_0x8e55('0x44')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x0]?_0x40f69d['attrs'][0x0][_0x8e55('0x3f')]:undefined)||_0x8e55('0x45')},{'name':_0x8e55('0x46'),'value':_0x40f69d[_0x8e55('0x46')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x1]?_0x40f69d[_0x8e55('0x3e')][0x1]['value']:undefined)||_0x8e55('0x47')},{'name':_0x8e55('0x48'),'value':_0x40f69d['attrFontSize']||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x2]?_0x40f69d['attrs'][0x2]['value']:undefined)||0xc}];case _0x8e55('0x49'):return[{'name':_0x8e55('0x4a'),'value':_0x40f69d[_0x8e55('0x4a')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x0]?_0x40f69d[_0x8e55('0x3e')][0x0][_0x8e55('0x3f')]:undefined)||_0x8e55('0x4b')},{'name':_0x8e55('0x4c'),'value':_0x40f69d[_0x8e55('0x4c')]||(_0x40f69d['attrs']&&_0x40f69d[_0x8e55('0x3e')][0x1]?_0x40f69d[_0x8e55('0x3e')][0x1]['value']:undefined)||[]},{'name':_0x8e55('0x48'),'value':_0x40f69d[_0x8e55('0x48')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x2]?_0x40f69d[_0x8e55('0x3e')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x40f69d[_0x8e55('0x4d')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x3]?_0x40f69d['attrs'][0x3][_0x8e55('0x3f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x40f69d[_0x8e55('0x4e')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x4]?_0x40f69d[_0x8e55('0x3e')][0x4][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x4f'),'value':_0x40f69d[_0x8e55('0x4f')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x5]?_0x40f69d[_0x8e55('0x3e')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x40f69d[_0x8e55('0x50')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x6]?_0x40f69d[_0x8e55('0x3e')][0x6][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x51'),'value':_0x40f69d[_0x8e55('0x51')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x7]?_0x40f69d[_0x8e55('0x3e')][0x7][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x52'),'value':_0x40f69d[_0x8e55('0x52')]||(_0x40f69d['attrs']&&_0x40f69d['attrs'][0x8]?_0x40f69d[_0x8e55('0x3e')][0x8][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x53'),'value':_0x40f69d['attrChatWebsites']||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x9]?_0x40f69d[_0x8e55('0x3e')][0x9][_0x8e55('0x3f')]:undefined)||''}];case _0x8e55('0x54'):case _0x8e55('0x55'):return[{'name':_0x8e55('0x56'),'value':_0x40f69d[_0x8e55('0x56')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x0]?_0x40f69d[_0x8e55('0x3e')][0x0][_0x8e55('0x3f')]:undefined)||_0x8e55('0x4b')},{'name':_0x8e55('0x57'),'value':_0x40f69d['attrSerie2']||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x1]?_0x40f69d[_0x8e55('0x3e')][0x1][_0x8e55('0x3f')]:undefined)||null},{'name':_0x8e55('0x58'),'value':_0x40f69d[_0x8e55('0x58')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x2]?_0x40f69d['attrs'][0x2][_0x8e55('0x3f')]:undefined)||null},{'name':_0x8e55('0x4c'),'value':_0x40f69d['attrVoiceQueues']||(_0x40f69d['attrs']&&_0x40f69d[_0x8e55('0x3e')][0x3]?_0x40f69d['attrs'][0x3][_0x8e55('0x3f')]:undefined)||[]},{'name':_0x8e55('0x4d'),'value':_0x40f69d[_0x8e55('0x4d')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x4]?_0x40f69d['attrs'][0x4][_0x8e55('0x3f')]:undefined)||_0x8e55('0x59')},{'name':_0x8e55('0x4e'),'value':_0x40f69d[_0x8e55('0x4e')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x5]?_0x40f69d['attrs'][0x5][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x4f'),'value':_0x40f69d['attrFaxAccounts']||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x6]?_0x40f69d[_0x8e55('0x3e')][0x6][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x50'),'value':_0x40f69d[_0x8e55('0x50')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x7]?_0x40f69d[_0x8e55('0x3e')][0x7][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x51'),'value':_0x40f69d[_0x8e55('0x51')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x8]?_0x40f69d[_0x8e55('0x3e')][0x8]['value']:undefined)||''},{'name':_0x8e55('0x52'),'value':_0x40f69d[_0x8e55('0x52')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x9]?_0x40f69d['attrs'][0x9][_0x8e55('0x3f')]:undefined)||''},{'name':_0x8e55('0x53'),'value':_0x40f69d[_0x8e55('0x53')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0xa]?_0x40f69d['attrs'][0xa][_0x8e55('0x3f')]:undefined)||''}];case _0x8e55('0x5a'):return[{'name':_0x8e55('0x5b'),'type':_0x40f69d['reportType']||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x0]?_0x40f69d[_0x8e55('0x3e')][0x0][_0x8e55('0x3b')]:undefined)||null,'value':_0x40f69d[_0x8e55('0x5b')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d[_0x8e55('0x3e')][0x0]?_0x40f69d['attrs'][0x0][_0x8e55('0x3f')]:undefined)||null},{'name':_0x8e55('0x5c'),'value':_0x40f69d[_0x8e55('0x5c')]||(_0x40f69d[_0x8e55('0x3e')]&&_0x40f69d['attrs'][0x1]?_0x40f69d[_0x8e55('0x3e')][0x1][_0x8e55('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x5da257){logger[_0x8e55('0x5d')](_0x8e55('0x5e'),JSON[_0x8e55('0x5f')](_0x5da257));return[];}}exports[_0x8e55('0x60')]=function(_0x5da956,_0x3d3f5c){if(_0x5da956['body']){_0x5da956[_0x8e55('0x61')][_0x8e55('0x3e')]=widgetAttributes(_0x5da956[_0x8e55('0x61')]);}return db[_0x8e55('0x30')][_0x8e55('0x60')](_0x5da956['body'],{})[_0x8e55('0x28')](respondWithResult(_0x3d3f5c,0xc9))[_0x8e55('0x3a')](handleError(_0x3d3f5c,null));};exports['update']=function(_0x5cba04,_0x10f82b){if(_0x5cba04[_0x8e55('0x61')]['id']){delete _0x5cba04[_0x8e55('0x61')]['id'];}_0x5cba04[_0x8e55('0x61')]['attrs']=widgetAttributes(_0x5cba04['body']);return db[_0x8e55('0x30')][_0x8e55('0x39')]({'where':{'id':_0x5cba04['params']['id']}})[_0x8e55('0x28')](handleEntityNotFound(_0x10f82b,null))[_0x8e55('0x28')](saveUpdates(_0x5cba04['body'],null))[_0x8e55('0x28')](respondWithResult(_0x10f82b,null))[_0x8e55('0x3a')](handleError(_0x10f82b,null));}; \ No newline at end of file +var _0xb0df=['length','includeAll','merge','options','DashboardItem','find','catch','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','value','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','params','model','rawAttributes','query','keys','intersection','fields','attributes'];(function(_0x39a757,_0x51e36d){var _0x3df2f=function(_0x1e5083){while(--_0x1e5083){_0x39a757['push'](_0x39a757['shift']());}};_0x3df2f(++_0x51e36d);}(_0xb0df,0x85));var _0xfb0d=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xb0df[_0x151381];return _0x2afab6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb0d('0x0'));var zipdir=require(_0xfb0d('0x1'));var jsonpatch=require(_0xfb0d('0x2'));var rp=require(_0xfb0d('0x3'));var moment=require(_0xfb0d('0x4'));var BPromise=require(_0xfb0d('0x5'));var Mustache=require(_0xfb0d('0x6'));var util=require(_0xfb0d('0x7'));var path=require(_0xfb0d('0x8'));var sox=require('sox');var csv=require(_0xfb0d('0x9'));var ejs=require(_0xfb0d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb0d('0xb'));var crypto=require(_0xfb0d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb0d('0x9'));var querystring=require(_0xfb0d('0xd'));var Papa=require('papaparse');var Redis=require(_0xfb0d('0xe'));var authService=require(_0xfb0d('0xf'));var qs=require(_0xfb0d('0x10'));var as=require(_0xfb0d('0x11'));var hardwareService=require(_0xfb0d('0x12'));var logger=require(_0xfb0d('0x13'))('api');var utils=require(_0xfb0d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfb0d('0x15'));var db=require(_0xfb0d('0x16'))['db'];config[_0xfb0d('0x17')]=_[_0xfb0d('0x18')](config[_0xfb0d('0x17')],{'host':_0xfb0d('0x19'),'port':0x18eb});var socket=require(_0xfb0d('0x1a'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x13ec1c,_0x22b9a1){_0x22b9a1=_0x22b9a1||0xcc;return function(_0x45cc75){if(_0x45cc75){return _0x13ec1c[_0xfb0d('0x1b')](_0x22b9a1);}return _0x13ec1c[_0xfb0d('0x1c')](_0x22b9a1)[_0xfb0d('0x1d')]();};}function respondWithResult(_0xced21c,_0x595903){_0x595903=_0x595903||0xc8;return function(_0x77e8e7){if(_0x77e8e7){return _0xced21c[_0xfb0d('0x1c')](_0x595903)[_0xfb0d('0x1e')](_0x77e8e7);}};}function respondWithFilteredResult(_0x2aa48d,_0x58b1cc){return function(_0x28f8dc){if(_0x28f8dc){var _0x318c5e=typeof _0x58b1cc[_0xfb0d('0x1f')]===_0xfb0d('0x20')&&typeof _0x58b1cc[_0xfb0d('0x21')]===_0xfb0d('0x20');var _0x2778ab=_0x28f8dc['count'];var _0x1b869f=_0x318c5e?0x0:_0x58b1cc[_0xfb0d('0x1f')];var _0x2baa88=_0x318c5e?_0x28f8dc[_0xfb0d('0x22')]:_0x58b1cc[_0xfb0d('0x1f')]+_0x58b1cc[_0xfb0d('0x21')];var _0x2fb83c;if(_0x2baa88>=_0x2778ab){_0x2baa88=_0x2778ab;_0x2fb83c=0xc8;}else{_0x2fb83c=0xce;}_0x2aa48d[_0xfb0d('0x1c')](_0x2fb83c);return _0x2aa48d[_0xfb0d('0x23')](_0xfb0d('0x24'),_0x1b869f+'-'+_0x2baa88+'/'+_0x2778ab)[_0xfb0d('0x1e')](_0x28f8dc);}return null;};}function patchUpdates(_0x5ef220){return function(_0x4f605a){try{jsonpatch[_0xfb0d('0x25')](_0x4f605a,_0x5ef220,!![]);}catch(_0x1b2096){return BPromise['reject'](_0x1b2096);}return _0x4f605a['save']();};}function saveUpdates(_0x3bd70b,_0x7f0f4c){return function(_0x5a1e63){if(_0x5a1e63){return _0x5a1e63[_0xfb0d('0x26')](_0x3bd70b)[_0xfb0d('0x27')](function(_0x1c234c){return _0x1c234c;});}return null;};}function removeEntity(_0x3f27a6,_0xec0688){return function(_0x10c1f9){if(_0x10c1f9){return _0x10c1f9[_0xfb0d('0x28')]()[_0xfb0d('0x27')](function(){_0x3f27a6[_0xfb0d('0x1c')](0xcc)[_0xfb0d('0x1d')]();});}};}function handleEntityNotFound(_0x1c6770,_0x803bdd){return function(_0x5ccecd){if(!_0x5ccecd){_0x1c6770[_0xfb0d('0x1b')](0x194);}return _0x5ccecd;};}function handleError(_0x4313f0,_0x48ba7a){_0x48ba7a=_0x48ba7a||0x1f4;return function(_0x13de4){logger[_0xfb0d('0x29')](_0x13de4[_0xfb0d('0x2a')]);if(_0x13de4[_0xfb0d('0x2b')]){delete _0x13de4['name'];}_0x4313f0['status'](_0x48ba7a)[_0xfb0d('0x2c')](_0x13de4);};}exports['show']=function(_0x21f005,_0x58fdf1){var _0x38bdfc={'raw':![],'where':{'id':_0x21f005[_0xfb0d('0x2d')]['id']}},_0x3093f5={};_0x3093f5[_0xfb0d('0x2e')]=_['keys'](db['DashboardItem'][_0xfb0d('0x2f')]);_0x3093f5[_0xfb0d('0x30')]=_[_0xfb0d('0x31')](_0x21f005[_0xfb0d('0x30')]);_0x3093f5['filters']=_[_0xfb0d('0x32')](_0x3093f5['model'],_0x3093f5[_0xfb0d('0x30')]);_0x38bdfc['attributes']=_[_0xfb0d('0x32')](_0x3093f5[_0xfb0d('0x2e')],qs[_0xfb0d('0x33')](_0x21f005[_0xfb0d('0x30')][_0xfb0d('0x33')]));_0x38bdfc[_0xfb0d('0x34')]=_0x38bdfc['attributes'][_0xfb0d('0x35')]?_0x38bdfc[_0xfb0d('0x34')]:_0x3093f5[_0xfb0d('0x2e')];if(_0x21f005[_0xfb0d('0x30')][_0xfb0d('0x36')]){_0x38bdfc['include']=[{'all':!![]}];}_0x38bdfc=_[_0xfb0d('0x37')]({},_0x38bdfc,_0x21f005[_0xfb0d('0x38')]);return db[_0xfb0d('0x39')][_0xfb0d('0x3a')](_0x38bdfc)['then'](handleEntityNotFound(_0x58fdf1,null))['then'](respondWithResult(_0x58fdf1,null))['catch'](handleError(_0x58fdf1,null));};exports[_0xfb0d('0x28')]=function(_0x127116,_0x2e33e9){return db[_0xfb0d('0x39')][_0xfb0d('0x3a')]({'where':{'id':_0x127116[_0xfb0d('0x2d')]['id']}})[_0xfb0d('0x27')](handleEntityNotFound(_0x2e33e9,null))['then'](removeEntity(_0x2e33e9,null))[_0xfb0d('0x3b')](handleError(_0x2e33e9,null));};function widgetAttributes(_0x3c7ace){try{switch(_0x3c7ace['type']){case'iframe':return[{'name':_0xfb0d('0x3c'),'value':_0x3c7ace[_0xfb0d('0x3c')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||_0xfb0d('0x3e')}];case _0xfb0d('0x3f'):return[{'name':_0xfb0d('0x40'),'value':_0x3c7ace[_0xfb0d('0x40')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||''}];case _0xfb0d('0x41'):return[{'name':_0xfb0d('0x42'),'value':_0x3c7ace[_0xfb0d('0x42')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||_0xfb0d('0x43')},{'name':_0xfb0d('0x44'),'value':_0x3c7ace[_0xfb0d('0x44')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1]['value']:undefined)||_0xfb0d('0x45')},{'name':'attrFontSize','value':_0x3c7ace[_0xfb0d('0x46')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x2]?_0x3c7ace['attrs'][0x2][_0xfb0d('0x47')]:undefined)||0xc}];case'counter':return[{'name':_0xfb0d('0x48'),'value':_0x3c7ace[_0xfb0d('0x48')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0][_0xfb0d('0x47')]:undefined)||_0xfb0d('0x49')},{'name':'attrVoiceQueues','value':_0x3c7ace[_0xfb0d('0x4a')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1][_0xfb0d('0x47')]:undefined)||[]},{'name':'attrFontSize','value':_0x3c7ace[_0xfb0d('0x46')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x2]?_0x3c7ace[_0xfb0d('0x3d')][0x2][_0xfb0d('0x47')]:undefined)||0x14},{'name':_0xfb0d('0x4b'),'value':_0x3c7ace[_0xfb0d('0x4b')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x3]?_0x3c7ace['attrs'][0x3][_0xfb0d('0x47')]:undefined)||_0xfb0d('0x4c')},{'name':_0xfb0d('0x4d'),'value':_0x3c7ace[_0xfb0d('0x4d')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x4]?_0x3c7ace['attrs'][0x4][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4e'),'value':_0x3c7ace['attrFaxAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x5]?_0x3c7ace['attrs'][0x5][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4f'),'value':_0x3c7ace[_0xfb0d('0x4f')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x6]?_0x3c7ace[_0xfb0d('0x3d')][0x6][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x50'),'value':_0x3c7ace[_0xfb0d('0x50')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x7]?_0x3c7ace[_0xfb0d('0x3d')][0x7][_0xfb0d('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c7ace[_0xfb0d('0x51')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x8]?_0x3c7ace['attrs'][0x8][_0xfb0d('0x47')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3c7ace[_0xfb0d('0x52')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x9]?_0x3c7ace[_0xfb0d('0x3d')][0x9]['value']:undefined)||''}];case _0xfb0d('0x53'):case _0xfb0d('0x54'):return[{'name':_0xfb0d('0x55'),'value':_0x3c7ace[_0xfb0d('0x55')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||_0xfb0d('0x49')},{'name':_0xfb0d('0x56'),'value':_0x3c7ace[_0xfb0d('0x56')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1][_0xfb0d('0x47')]:undefined)||null},{'name':_0xfb0d('0x57'),'value':_0x3c7ace['attrSerie3']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x2]?_0x3c7ace[_0xfb0d('0x3d')][0x2][_0xfb0d('0x47')]:undefined)||null},{'name':_0xfb0d('0x4a'),'value':_0x3c7ace[_0xfb0d('0x4a')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x3]?_0x3c7ace['attrs'][0x3][_0xfb0d('0x47')]:undefined)||[]},{'name':_0xfb0d('0x4b'),'value':_0x3c7ace[_0xfb0d('0x4b')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x4]?_0x3c7ace[_0xfb0d('0x3d')][0x4][_0xfb0d('0x47')]:undefined)||_0xfb0d('0x4c')},{'name':'attrEmailAccounts','value':_0x3c7ace[_0xfb0d('0x4d')]||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0x5]?_0x3c7ace['attrs'][0x5][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4e'),'value':_0x3c7ace['attrFaxAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x6]?_0x3c7ace[_0xfb0d('0x3d')][0x6][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x4f'),'value':_0x3c7ace[_0xfb0d('0x4f')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x7]?_0x3c7ace[_0xfb0d('0x3d')][0x7][_0xfb0d('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c7ace['attrOpenchannelAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x8]?_0x3c7ace[_0xfb0d('0x3d')][0x8][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x51'),'value':_0x3c7ace['attrWhatsappAccounts']||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x9]?_0x3c7ace[_0xfb0d('0x3d')][0x9][_0xfb0d('0x47')]:undefined)||''},{'name':_0xfb0d('0x52'),'value':_0x3c7ace['attrChatWebsites']||(_0x3c7ace['attrs']&&_0x3c7ace[_0xfb0d('0x3d')][0xa]?_0x3c7ace[_0xfb0d('0x3d')][0xa][_0xfb0d('0x47')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3c7ace[_0xfb0d('0x58')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace[_0xfb0d('0x3d')][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['type']:undefined)||null,'value':_0x3c7ace[_0xfb0d('0x59')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x0]?_0x3c7ace[_0xfb0d('0x3d')][0x0]['value']:undefined)||null},{'name':_0xfb0d('0x5a'),'value':_0x3c7ace[_0xfb0d('0x5a')]||(_0x3c7ace[_0xfb0d('0x3d')]&&_0x3c7ace['attrs'][0x1]?_0x3c7ace[_0xfb0d('0x3d')][0x1][_0xfb0d('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x2b6553){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x2b6553));return[];}}exports[_0xfb0d('0x5b')]=function(_0x2d125c,_0x55ece4){if(_0x2d125c['body']){_0x2d125c[_0xfb0d('0x5c')]['attrs']=widgetAttributes(_0x2d125c[_0xfb0d('0x5c')]);}return db[_0xfb0d('0x39')]['create'](_0x2d125c[_0xfb0d('0x5c')],{})[_0xfb0d('0x27')](respondWithResult(_0x55ece4,0xc9))['catch'](handleError(_0x55ece4,null));};exports[_0xfb0d('0x26')]=function(_0x4dea17,_0x345623){if(_0x4dea17[_0xfb0d('0x5c')]['id']){delete _0x4dea17[_0xfb0d('0x5c')]['id'];}_0x4dea17[_0xfb0d('0x5c')][_0xfb0d('0x3d')]=widgetAttributes(_0x4dea17[_0xfb0d('0x5c')]);return db[_0xfb0d('0x39')]['find']({'where':{'id':_0x4dea17[_0xfb0d('0x2d')]['id']}})['then'](handleEntityNotFound(_0x345623,null))[_0xfb0d('0x27')](saveUpdates(_0x4dea17[_0xfb0d('0x5c')],null))[_0xfb0d('0x27')](respondWithResult(_0x345623,null))['catch'](handleError(_0x345623,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 422d0ac..a6fb77a 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 _0xb64b=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xb64b,0x103));var _0xbb64=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0xb64b[_0x15ee41];return _0x2b2846;};'use strict';var EventEmitter=require(_0xbb64('0x0'));var DashboardItem=require(_0xbb64('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbb64('0x2')](0x0);var events={'afterCreate':_0xbb64('0x3'),'afterUpdate':_0xbb64('0x4'),'afterDestroy':_0xbb64('0x5')};function emitEvent(_0x2ac0b1){return function(_0xa89142,_0x3485bd,_0x1237fd){DashboardItemEvents[_0xbb64('0x6')](_0x2ac0b1+':'+_0xa89142['id'],_0xa89142);DashboardItemEvents['emit'](_0x2ac0b1,_0xa89142);_0x1237fd(null);};}for(var e in events){if(events[_0xbb64('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x3e94=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x1ac41c,_0x1dacbf){var _0x561d64=function(_0x2654df){while(--_0x2654df){_0x1ac41c['push'](_0x1ac41c['shift']());}};_0x561d64(++_0x1dacbf);}(_0x3e94,0x67));var _0x43e9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3e94[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x43e9('0x0'));var DashboardItem=require(_0x43e9('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x43e9('0x2')](0x0);var events={'afterCreate':_0x43e9('0x3'),'afterUpdate':_0x43e9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e3b33){return function(_0x42c806,_0x2fac0f,_0x50eacc){DashboardItemEvents[_0x43e9('0x5')](_0x2e3b33+':'+_0x42c806['id'],_0x42c806);DashboardItemEvents['emit'](_0x2e3b33,_0x42c806);_0x50eacc(null);};}for(var e in events){if(events[_0x43e9('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x43e9('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 599c801..d7cc28b 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 _0x2af3=['../../config/logger','api','moment','bluebird','path','exports','DashboardItem','dashboard_items','lodash'];(function(_0x2bb82d,_0x42c7f8){var _0x5e0b92=function(_0x19f44b){while(--_0x19f44b){_0x2bb82d['push'](_0x2bb82d['shift']());}};_0x5e0b92(++_0x42c7f8);}(_0x2af3,0xbc));var _0x32af=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0x2af3[_0x469fc4];return _0x11f6d4;};'use strict';var _=require(_0x32af('0x0'));var util=require('util');var logger=require(_0x32af('0x1'))(_0x32af('0x2'));var moment=require(_0x32af('0x3'));var BPromise=require(_0x32af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32af('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x32af('0x6')]=function(_0x346938,_0x4ac619){return _0x346938['define'](_0x32af('0x7'),attributes,{'tableName':_0x32af('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10be=['dashboard_items','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./dashboardItem.attributes','define'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x10be,0xc9));var _0xe10b=function(_0x254a14,_0x156510){_0x254a14=_0x254a14-0x0;var _0x679a91=_0x10be[_0x254a14];return _0x679a91;};'use strict';var _=require(_0xe10b('0x0'));var util=require(_0xe10b('0x1'));var logger=require(_0xe10b('0x2'))('api');var moment=require(_0xe10b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe10b('0x4'));var fs=require('fs');var path=require(_0xe10b('0x5'));var rimraf=require(_0xe10b('0x6'));var config=require('../../config/environment');var attributes=require(_0xe10b('0x7'));module['exports']=function(_0x4e6f64,_0x4fde81){return _0x4e6f64[_0xe10b('0x8')]('DashboardItem',attributes,{'tableName':_0xe10b('0x9'),'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 283f272..8f3abc8 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 _0xee4f=['DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','request','info'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xee4f,0xd8));var _0xfee4=function(_0x35709e,_0x5c7468){_0x35709e=_0x35709e-0x0;var _0xd8a115=_0xee4f[_0x35709e];return _0xd8a115;};'use strict';var _=require('lodash');var util=require(_0xfee4('0x0'));var moment=require(_0xfee4('0x1'));var BPromise=require(_0xfee4('0x2'));var rs=require(_0xfee4('0x3'));var fs=require('fs');var Redis=require(_0xfee4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x5'));var logger=require(_0xfee4('0x6'))(_0xfee4('0x7'));var config=require(_0xfee4('0x8'));var jayson=require(_0xfee4('0x9'));var client=jayson[_0xfee4('0xa')][_0xfee4('0xb')]({'port':0x232a});config['redis']=_[_0xfee4('0xc')](config['redis'],{'host':_0xfee4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfee4('0xe')]));require('./dashboardItem.socket')[_0xfee4('0xf')](socket);function respondWithRpcPromise(_0x5467f6,_0x2685fd,_0xce2936){return new BPromise(function(_0x2b1976,_0x555ed9){return client[_0xfee4('0x10')](_0x5467f6,_0xce2936)['then'](function(_0x38a741){logger[_0xfee4('0x11')](_0xfee4('0x12'),_0x2685fd,'request\x20sent');logger[_0xfee4('0x13')](_0xfee4('0x14'),_0x2685fd,_0xfee4('0x15'),JSON['stringify'](_0x38a741));if(_0x38a741[_0xfee4('0x16')]){if(_0x38a741[_0xfee4('0x16')][_0xfee4('0x17')]===0x1f4){logger[_0xfee4('0x16')](_0xfee4('0x12'),_0x2685fd,_0x38a741['error'][_0xfee4('0x18')]);return _0x555ed9(_0x38a741[_0xfee4('0x16')][_0xfee4('0x18')]);}logger[_0xfee4('0x16')]('DashboardItem,\x20%s,\x20%s',_0x2685fd,_0x38a741[_0xfee4('0x16')][_0xfee4('0x18')]);return _0x2b1976(_0x38a741[_0xfee4('0x16')][_0xfee4('0x18')]);}else{logger[_0xfee4('0x11')](_0xfee4('0x12'),_0x2685fd,_0xfee4('0x15'));_0x2b1976(_0x38a741[_0xfee4('0x19')]['message']);}})['catch'](function(_0x1366cb){logger[_0xfee4('0x16')](_0xfee4('0x12'),_0x2685fd,_0x1366cb);_0x555ed9(_0x1366cb);});});} \ No newline at end of file +var _0x82d8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3b3150,_0x31b1a5){var _0x20ec5d=function(_0x59d03b){while(--_0x59d03b){_0x3b3150['push'](_0x3b3150['shift']());}};_0x20ec5d(++_0x31b1a5);}(_0x82d8,0x1eb));var _0x882d=function(_0x4747c7,_0x2c48b5){_0x4747c7=_0x4747c7-0x0;var _0x323dfc=_0x82d8[_0x4747c7];return _0x323dfc;};'use strict';var _=require('lodash');var util=require(_0x882d('0x0'));var moment=require(_0x882d('0x1'));var BPromise=require('bluebird');var rs=require(_0x882d('0x2'));var fs=require('fs');var Redis=require(_0x882d('0x3'));var db=require(_0x882d('0x4'))['db'];var utils=require(_0x882d('0x5'));var logger=require(_0x882d('0x6'))(_0x882d('0x7'));var config=require(_0x882d('0x8'));var jayson=require(_0x882d('0x9'));var client=jayson[_0x882d('0xa')][_0x882d('0xb')]({'port':0x232a});config[_0x882d('0xc')]=_[_0x882d('0xd')](config['redis'],{'host':_0x882d('0xe'),'port':0x18eb});var socket=require(_0x882d('0xf'))(new Redis(config['redis']));require(_0x882d('0x10'))[_0x882d('0x11')](socket);function respondWithRpcPromise(_0x8cb311,_0x5b24ce,_0x1388e8){return new BPromise(function(_0x10233e,_0x6d17dc){return client[_0x882d('0x12')](_0x8cb311,_0x1388e8)[_0x882d('0x13')](function(_0x451e2d){logger[_0x882d('0x14')](_0x882d('0x15'),_0x5b24ce,_0x882d('0x16'));logger[_0x882d('0x17')](_0x882d('0x18'),_0x5b24ce,_0x882d('0x16'),JSON[_0x882d('0x19')](_0x451e2d));if(_0x451e2d[_0x882d('0x1a')]){if(_0x451e2d[_0x882d('0x1a')][_0x882d('0x1b')]===0x1f4){logger[_0x882d('0x1a')](_0x882d('0x15'),_0x5b24ce,_0x451e2d['error'][_0x882d('0x1c')]);return _0x6d17dc(_0x451e2d[_0x882d('0x1a')][_0x882d('0x1c')]);}logger[_0x882d('0x1a')](_0x882d('0x15'),_0x5b24ce,_0x451e2d[_0x882d('0x1a')][_0x882d('0x1c')]);return _0x10233e(_0x451e2d[_0x882d('0x1a')][_0x882d('0x1c')]);}else{logger[_0x882d('0x14')](_0x882d('0x15'),_0x5b24ce,_0x882d('0x16'));_0x10233e(_0x451e2d[_0x882d('0x1d')][_0x882d('0x1c')]);}})[_0x882d('0x1e')](function(_0x38f2a5){logger['error'](_0x882d('0x15'),_0x5b24ce,_0x38f2a5);_0x6d17dc(_0x38f2a5);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 1206173..3179ee7 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 _0x195c=['length','dashboardItem:','./dashboardItem.events','save','remove','update','removeListener','register'];(function(_0x17e14d,_0xf4099f){var _0x42ffb8=function(_0x367a47){while(--_0x367a47){_0x17e14d['push'](_0x17e14d['shift']());}};_0x42ffb8(++_0xf4099f);}(_0x195c,0x152));var _0xc195=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x195c[_0xefd519];return _0x4bb882;};'use strict';var DashboardItemEvents=require(_0xc195('0x0'));var events=[_0xc195('0x1'),_0xc195('0x2'),_0xc195('0x3')];function createListener(_0x1fe9c9,_0x102af5){return function(_0x3f940d){_0x102af5['emit'](_0x1fe9c9,_0x3f940d);};}function removeListener(_0x563372,_0x5506e1){return function(){DashboardItemEvents[_0xc195('0x4')](_0x563372,_0x5506e1);};}exports[_0xc195('0x5')]=function(_0xba437f){for(var _0x5742a7=0x0,_0x1e1865=events[_0xc195('0x6')];_0x5742a7<_0x1e1865;_0x5742a7++){var _0x3b0fad=events[_0x5742a7];var _0x467878=createListener(_0xc195('0x7')+_0x3b0fad,_0xba437f);DashboardItemEvents['on'](_0x3b0fad,_0x467878);}}; \ No newline at end of file +var _0xd14f=['./dashboardItem.events','save','remove','emit','removeListener','length','dashboardItem:'];(function(_0x421558,_0x42ae59){var _0x33f22e=function(_0x5e7010){while(--_0x5e7010){_0x421558['push'](_0x421558['shift']());}};_0x33f22e(++_0x42ae59);}(_0xd14f,0xa1));var _0xfd14=function(_0x56cb8c,_0xf4de3){_0x56cb8c=_0x56cb8c-0x0;var _0x547c44=_0xd14f[_0x56cb8c];return _0x547c44;};'use strict';var DashboardItemEvents=require(_0xfd14('0x0'));var events=[_0xfd14('0x1'),_0xfd14('0x2'),'update'];function createListener(_0x34648e,_0x3fb580){return function(_0xefe69d){_0x3fb580[_0xfd14('0x3')](_0x34648e,_0xefe69d);};}function removeListener(_0x31d789,_0x42a319){return function(){DashboardItemEvents[_0xfd14('0x4')](_0x31d789,_0x42a319);};}exports['register']=function(_0x1fad11){for(var _0xadc09b=0x0,_0x142859=events[_0xfd14('0x5')];_0xadc09b<_0x142859;_0xadc09b++){var _0x19bbb9=events[_0xadc09b];var _0x3e4f38=createListener(_0xfd14('0x6')+_0x19bbb9,_0x1fad11);DashboardItemEvents['on'](_0x19bbb9,_0x3e4f38);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 513d403..4f1be55 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 _0x3d94=['./dashboardItem.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x28366e,_0x2ac7e1){var _0x37637b=function(_0x1c9257){while(--_0x1c9257){_0x28366e['push'](_0x28366e['shift']());}};_0x37637b(++_0x2ac7e1);}(_0x3d94,0xfb));var _0x43d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d94[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x43d9('0x0'));var util=require(_0x43d9('0x1'));var path=require(_0x43d9('0x2'));var timeout=require(_0x43d9('0x3'));var express=require(_0x43d9('0x4'));var router=express[_0x43d9('0x5')]();var fs_extra=require(_0x43d9('0x6'));var auth=require(_0x43d9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d9('0x8'));var controller=require(_0x43d9('0x9'));router[_0x43d9('0xa')]('/:id',auth[_0x43d9('0xb')](),controller[_0x43d9('0xc')]);router[_0x43d9('0xd')]('/',auth[_0x43d9('0xb')](),controller[_0x43d9('0xe')]);router['put'](_0x43d9('0xf'),auth[_0x43d9('0xb')](),controller[_0x43d9('0x10')]);router[_0x43d9('0x11')](_0x43d9('0xf'),auth['isAuthenticated'](),controller[_0x43d9('0x12')]);module[_0x43d9('0x13')]=router; \ No newline at end of file +var _0xa75c=['isAuthenticated','show','post','create','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa75c,0x18e));var _0xca75=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0xa75c[_0x2bb3f6];return _0x62b339;};'use strict';var multer=require(_0xca75('0x0'));var util=require(_0xca75('0x1'));var path=require('path');var timeout=require(_0xca75('0x2'));var express=require('express');var router=express[_0xca75('0x3')]();var fs_extra=require(_0xca75('0x4'));var auth=require(_0xca75('0x5'));var interaction=require(_0xca75('0x6'));var config=require('../../config/environment');var controller=require(_0xca75('0x7'));router[_0xca75('0x8')](_0xca75('0x9'),auth[_0xca75('0xa')](),controller[_0xca75('0xb')]);router[_0xca75('0xc')]('/',auth[_0xca75('0xa')](),controller[_0xca75('0xd')]);router['put'](_0xca75('0x9'),auth['isAuthenticated'](),controller[_0xca75('0xe')]);router[_0xca75('0xf')]('/:id',auth[_0xca75('0xa')](),controller[_0xca75('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4dfe793..7adff4a 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 _0xda69=['STRING','ENUM','third','sequelize','exports'];(function(_0x3118fa,_0x53208a){var _0x4dddca=function(_0xcf0274){while(--_0xcf0274){_0x3118fa['push'](_0x3118fa['shift']());}};_0x4dddca(++_0x53208a);}(_0xda69,0xcb));var _0x9da6=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xda69[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x9da6('0x0'));module[_0x9da6('0x1')]={'name':{'type':Sequelize[_0x9da6('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x9da6('0x3')]('first','second',_0x9da6('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9da6('0x2')]}}; \ No newline at end of file +var _0x66b5=['exports','STRING','ENUM','first','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x66b5,0xa9));var _0x566b=function(_0xff2497,_0x415688){_0xff2497=_0xff2497-0x0;var _0x2a1071=_0x66b5[_0xff2497];return _0x2a1071;};'use strict';var Sequelize=require(_0x566b('0x0'));module[_0x566b('0x1')]={'name':{'type':Sequelize[_0x566b('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x566b('0x3')](_0x566b('0x4'),'second','third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f0b11a3..f75b6f3 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 _0xbacd=['name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','error'];(function(_0x33c083,_0x3f5489){var _0x55688d=function(_0x5cd402){while(--_0x5cd402){_0x33c083['push'](_0x33c083['shift']());}};_0x55688d(++_0x3f5489);}(_0xbacd,0x1c5));var _0xdbac=function(_0x5191d6,_0x28481a){_0x5191d6=_0x5191d6-0x0;var _0x3a69e3=_0xbacd[_0x5191d6];return _0x3a69e3;};'use strict';var emlformat=require(_0xdbac('0x0'));var rimraf=require(_0xdbac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbac('0x2'));var rp=require(_0xdbac('0x3'));var moment=require(_0xdbac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbac('0x5'));var util=require(_0xdbac('0x6'));var path=require(_0xdbac('0x7'));var sox=require(_0xdbac('0x8'));var csv=require(_0xdbac('0x9'));var ejs=require(_0xdbac('0xa'));var fs=require('fs');var fs_extra=require(_0xdbac('0xb'));var _=require(_0xdbac('0xc'));var squel=require(_0xdbac('0xd'));var crypto=require(_0xdbac('0xe'));var jsforce=require(_0xdbac('0xf'));var deskjs=require(_0xdbac('0x10'));var toCsv=require(_0xdbac('0x9'));var querystring=require(_0xdbac('0x11'));var Papa=require(_0xdbac('0x12'));var Redis=require('ioredis');var authService=require(_0xdbac('0x13'));var qs=require(_0xdbac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbac('0x15'));var logger=require('../../config/logger')(_0xdbac('0x16'));var utils=require(_0xdbac('0x17'));var config=require(_0xdbac('0x18'));var licenseUtil=require(_0xdbac('0x19'));var db=require(_0xdbac('0x1a'))['db'];function respondWithStatusCode(_0x1ebee0,_0xd9ec70){_0xd9ec70=_0xd9ec70||0xcc;return function(_0x2c7f44){if(_0x2c7f44){return _0x1ebee0[_0xdbac('0x1b')](_0xd9ec70);}return _0x1ebee0['status'](_0xd9ec70)[_0xdbac('0x1c')]();};}function respondWithResult(_0x1793b9,_0x1eed36){_0x1eed36=_0x1eed36||0xc8;return function(_0x14ebaa){if(_0x14ebaa){return _0x1793b9[_0xdbac('0x1d')](_0x1eed36)[_0xdbac('0x1e')](_0x14ebaa);}};}function respondWithFilteredResult(_0x94a61,_0x176da6){return function(_0x574e58){if(_0x574e58){var _0x2694ef=typeof _0x176da6[_0xdbac('0x1f')]===_0xdbac('0x20')&&typeof _0x176da6['limit']===_0xdbac('0x20');var _0x36e0de=_0x574e58[_0xdbac('0x21')];var _0x252fc1=_0x2694ef?0x0:_0x176da6[_0xdbac('0x1f')];var _0x1a9690=_0x2694ef?_0x574e58[_0xdbac('0x21')]:_0x176da6[_0xdbac('0x1f')]+_0x176da6[_0xdbac('0x22')];var _0x1301d2;if(_0x1a9690>=_0x36e0de){_0x1a9690=_0x36e0de;_0x1301d2=0xc8;}else{_0x1301d2=0xce;}_0x94a61[_0xdbac('0x1d')](_0x1301d2);return _0x94a61[_0xdbac('0x23')]('Content-Range',_0x252fc1+'-'+_0x1a9690+'/'+_0x36e0de)[_0xdbac('0x1e')](_0x574e58);}return null;};}function patchUpdates(_0x323801){return function(_0x4e4af9){try{jsonpatch[_0xdbac('0x24')](_0x4e4af9,_0x323801,!![]);}catch(_0x582c0b){return BPromise[_0xdbac('0x25')](_0x582c0b);}return _0x4e4af9['save']();};}function saveUpdates(_0x1ead7b,_0x2bcf69){return function(_0x20642c){if(_0x20642c){return _0x20642c[_0xdbac('0x26')](_0x1ead7b)[_0xdbac('0x27')](function(_0x4148fc){return _0x4148fc;});}return null;};}function removeEntity(_0x28393a,_0x4e68b0){return function(_0x361930){if(_0x361930){return _0x361930[_0xdbac('0x28')]()[_0xdbac('0x27')](function(){var _0x3f17ad=_0x361930[_0xdbac('0x29')]({'plain':!![]});var _0x2b4cda=_0xdbac('0x2a');return db[_0xdbac('0x2b')][_0xdbac('0x28')]({'where':{'type':_0x2b4cda,'resourceId':_0x3f17ad['id']}})[_0xdbac('0x27')](function(){return _0x361930;});})[_0xdbac('0x27')](function(){_0x28393a[_0xdbac('0x1d')](0xcc)[_0xdbac('0x1c')]();});}};}function handleEntityNotFound(_0x3c8bfc,_0x35a7f0){return function(_0x31361d){if(!_0x31361d){_0x3c8bfc[_0xdbac('0x1b')](0x194);}return _0x31361d;};}function handleError(_0x2bdb01,_0x31223b){_0x31223b=_0x31223b||0x1f4;return function(_0xe744cc){logger[_0xdbac('0x2c')](_0xe744cc['stack']);if(_0xe744cc[_0xdbac('0x2d')]){delete _0xe744cc[_0xdbac('0x2d')];}_0x2bdb01[_0xdbac('0x1d')](_0x31223b)[_0xdbac('0x2e')](_0xe744cc);};}exports['index']=function(_0x505321,_0x10c3c8){var _0x267d70={},_0x40dccc={},_0x413428={'count':0x0,'rows':[]};var _0x4ec6f0=_[_0xdbac('0x2f')](db[_0xdbac('0x30')][_0xdbac('0x31')],function(_0x2f53ef){return{'name':_0x2f53ef[_0xdbac('0x32')],'type':_0x2f53ef[_0xdbac('0x33')][_0xdbac('0x34')]};});_0x40dccc[_0xdbac('0x35')]=_['map'](_0x4ec6f0,'name');_0x40dccc[_0xdbac('0x36')]=_[_0xdbac('0x37')](_0x505321[_0xdbac('0x36')]);_0x40dccc[_0xdbac('0x38')]=_['intersection'](_0x40dccc['model'],_0x40dccc[_0xdbac('0x36')]);_0x267d70[_0xdbac('0x39')]=_[_0xdbac('0x3a')](_0x40dccc[_0xdbac('0x35')],qs[_0xdbac('0x3b')](_0x505321[_0xdbac('0x36')][_0xdbac('0x3b')]));_0x267d70[_0xdbac('0x39')]=_0x267d70[_0xdbac('0x39')][_0xdbac('0x3c')]?_0x267d70[_0xdbac('0x39')]:_0x40dccc[_0xdbac('0x35')];if(!_0x505321[_0xdbac('0x36')]['hasOwnProperty'](_0xdbac('0x3d'))){_0x267d70['limit']=qs[_0xdbac('0x22')](_0x505321[_0xdbac('0x36')][_0xdbac('0x22')]);_0x267d70[_0xdbac('0x1f')]=qs['offset'](_0x505321[_0xdbac('0x36')][_0xdbac('0x1f')]);}_0x267d70['order']=qs['sort'](_0x505321[_0xdbac('0x36')]['sort']);_0x267d70['where']=qs[_0xdbac('0x38')](_[_0xdbac('0x3e')](_0x505321[_0xdbac('0x36')],_0x40dccc['filters']),_0x4ec6f0);if(_0x505321[_0xdbac('0x36')][_0xdbac('0x3f')]){_0x267d70[_0xdbac('0x40')]=_[_0xdbac('0x41')](_0x267d70['where'],{'$or':_['map'](_0x4ec6f0,function(_0x309da5){if(_0x309da5[_0xdbac('0x33')]!==_0xdbac('0x42')){var _0x2edbb0={};_0x2edbb0[_0x309da5[_0xdbac('0x2d')]]={'$like':'%'+_0x505321['query'][_0xdbac('0x3f')]+'%'};return _0x2edbb0;}})});}_0x267d70=_[_0xdbac('0x41')]({},_0x267d70,_0x505321['options']);var _0x182a97={'where':_0x267d70[_0xdbac('0x40')]};return db[_0xdbac('0x30')][_0xdbac('0x21')](_0x182a97)[_0xdbac('0x27')](function(_0x575b59){_0x413428[_0xdbac('0x21')]=_0x575b59;if(_0x505321[_0xdbac('0x36')][_0xdbac('0x43')]){_0x267d70[_0xdbac('0x44')]=[{'all':!![]}];}return db[_0xdbac('0x30')][_0xdbac('0x45')](_0x267d70);})[_0xdbac('0x27')](function(_0x3c1894){_0x413428[_0xdbac('0x46')]=_0x3c1894;return _0x413428;})[_0xdbac('0x27')](respondWithFilteredResult(_0x10c3c8,_0x267d70))[_0xdbac('0x47')](handleError(_0x10c3c8,null));};exports[_0xdbac('0x48')]=function(_0x575384,_0x5395fd){var _0x5b10e9={'raw':!![],'where':{'id':_0x575384[_0xdbac('0x49')]['id']}},_0x5495eb={};_0x5495eb[_0xdbac('0x35')]=_[_0xdbac('0x37')](db[_0xdbac('0x30')][_0xdbac('0x31')]);_0x5495eb[_0xdbac('0x36')]=_[_0xdbac('0x37')](_0x575384[_0xdbac('0x36')]);_0x5495eb[_0xdbac('0x38')]=_['intersection'](_0x5495eb['model'],_0x5495eb['query']);_0x5b10e9[_0xdbac('0x39')]=_[_0xdbac('0x3a')](_0x5495eb['model'],qs['fields'](_0x575384['query'][_0xdbac('0x3b')]));_0x5b10e9[_0xdbac('0x39')]=_0x5b10e9[_0xdbac('0x39')]['length']?_0x5b10e9[_0xdbac('0x39')]:_0x5495eb[_0xdbac('0x35')];if(_0x575384[_0xdbac('0x36')][_0xdbac('0x43')]){_0x5b10e9[_0xdbac('0x44')]=[{'all':!![]}];}_0x5b10e9=_['merge']({},_0x5b10e9,_0x575384[_0xdbac('0x4a')]);return db[_0xdbac('0x30')][_0xdbac('0x4b')](_0x5b10e9)[_0xdbac('0x27')](handleEntityNotFound(_0x5395fd,null))['then'](respondWithResult(_0x5395fd,null))[_0xdbac('0x47')](handleError(_0x5395fd,null));};exports[_0xdbac('0x4c')]=function(_0x1463ca,_0x5d6e86){return db[_0xdbac('0x30')][_0xdbac('0x4c')](_0x1463ca[_0xdbac('0x4d')],{})[_0xdbac('0x27')](function(_0x1536b2){var _0xffc061=_0x1463ca['user'][_0xdbac('0x29')]({'plain':!![]});if(!_0xffc061)throw new Error(_0xdbac('0x4e'));if(_0xffc061['role']===_0xdbac('0x4f')){var _0x12b600=_0x1536b2[_0xdbac('0x29')]({'plain':!![]});var _0x14db9d='Dispositions';return db['UserProfileSection'][_0xdbac('0x4b')]({'where':{'name':_0x14db9d,'userProfileId':_0xffc061[_0xdbac('0x50')]},'raw':!![]})['then'](function(_0x4d9bd7){if(_0x4d9bd7&&_0x4d9bd7[_0xdbac('0x51')]===0x0){return db['UserProfileResource'][_0xdbac('0x4c')]({'name':_0x12b600[_0xdbac('0x2d')],'resourceId':_0x12b600['id'],'type':_0x4d9bd7[_0xdbac('0x2d')],'sectionId':_0x4d9bd7['id']},{})['then'](function(){return _0x1536b2;});}else{return _0x1536b2;}})['catch'](function(_0x21ad54){logger[_0xdbac('0x2c')](_0xdbac('0x52'),_0x21ad54);throw _0x21ad54;});}return _0x1536b2;})[_0xdbac('0x27')](respondWithResult(_0x5d6e86,0xc9))[_0xdbac('0x47')](handleError(_0x5d6e86,null));};exports[_0xdbac('0x26')]=function(_0x1641b3,_0x50a29b){if(_0x1641b3['body']['id']){delete _0x1641b3[_0xdbac('0x4d')]['id'];}return db[_0xdbac('0x30')][_0xdbac('0x4b')]({'where':{'id':_0x1641b3[_0xdbac('0x49')]['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x50a29b,null))[_0xdbac('0x27')](saveUpdates(_0x1641b3['body'],null))[_0xdbac('0x27')](respondWithResult(_0x50a29b,null))[_0xdbac('0x47')](handleError(_0x50a29b,null));};exports[_0xdbac('0x28')]=function(_0x3f331b,_0x1f7966){return db['Disposition']['find']({'where':{'id':_0x3f331b[_0xdbac('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f7966,null))[_0xdbac('0x27')](removeEntity(_0x1f7966,null))[_0xdbac('0x47')](handleError(_0x1f7966,null));}; \ No newline at end of file +var _0x5e8d=['error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','catch','show','params','length','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','destroy','end'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x14ca02,_0x4c3d7f){_0x14ca02=_0x14ca02-0x0;var _0xd4dea6=_0x5e8d[_0x14ca02];return _0xd4dea6;};'use strict';var emlformat=require(_0xd5e8('0x0'));var rimraf=require(_0xd5e8('0x1'));var zipdir=require(_0xd5e8('0x2'));var jsonpatch=require(_0xd5e8('0x3'));var rp=require(_0xd5e8('0x4'));var moment=require(_0xd5e8('0x5'));var BPromise=require(_0xd5e8('0x6'));var Mustache=require('mustache');var util=require(_0xd5e8('0x7'));var path=require(_0xd5e8('0x8'));var sox=require('sox');var csv=require(_0xd5e8('0x9'));var ejs=require(_0xd5e8('0xa'));var fs=require('fs');var fs_extra=require(_0xd5e8('0xb'));var _=require('lodash');var squel=require(_0xd5e8('0xc'));var crypto=require(_0xd5e8('0xd'));var jsforce=require(_0xd5e8('0xe'));var deskjs=require(_0xd5e8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e8('0x10'));var Redis=require(_0xd5e8('0x11'));var authService=require(_0xd5e8('0x12'));var qs=require(_0xd5e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5e8('0x14'));var logger=require(_0xd5e8('0x15'))('api');var utils=require(_0xd5e8('0x16'));var config=require(_0xd5e8('0x17'));var licenseUtil=require(_0xd5e8('0x18'));var db=require(_0xd5e8('0x19'))['db'];function respondWithStatusCode(_0xd8fa54,_0x3b2780){_0x3b2780=_0x3b2780||0xcc;return function(_0x397eb3){if(_0x397eb3){return _0xd8fa54[_0xd5e8('0x1a')](_0x3b2780);}return _0xd8fa54[_0xd5e8('0x1b')](_0x3b2780)['end']();};}function respondWithResult(_0x5a6665,_0x457bfb){_0x457bfb=_0x457bfb||0xc8;return function(_0x32de91){if(_0x32de91){return _0x5a6665[_0xd5e8('0x1b')](_0x457bfb)[_0xd5e8('0x1c')](_0x32de91);}};}function respondWithFilteredResult(_0x5a35cd,_0x399cb1){return function(_0x489a8e){if(_0x489a8e){var _0x2ef357=typeof _0x399cb1[_0xd5e8('0x1d')]===_0xd5e8('0x1e')&&typeof _0x399cb1[_0xd5e8('0x1f')]==='undefined';var _0x3daf6a=_0x489a8e[_0xd5e8('0x20')];var _0x529d45=_0x2ef357?0x0:_0x399cb1[_0xd5e8('0x1d')];var _0x1be884=_0x2ef357?_0x489a8e[_0xd5e8('0x20')]:_0x399cb1[_0xd5e8('0x1d')]+_0x399cb1[_0xd5e8('0x1f')];var _0x196648;if(_0x1be884>=_0x3daf6a){_0x1be884=_0x3daf6a;_0x196648=0xc8;}else{_0x196648=0xce;}_0x5a35cd[_0xd5e8('0x1b')](_0x196648);return _0x5a35cd[_0xd5e8('0x21')]('Content-Range',_0x529d45+'-'+_0x1be884+'/'+_0x3daf6a)[_0xd5e8('0x1c')](_0x489a8e);}return null;};}function patchUpdates(_0x1b1631){return function(_0x2c4fde){try{jsonpatch[_0xd5e8('0x22')](_0x2c4fde,_0x1b1631,!![]);}catch(_0x26b187){return BPromise[_0xd5e8('0x23')](_0x26b187);}return _0x2c4fde[_0xd5e8('0x24')]();};}function saveUpdates(_0x1d515d,_0x45bb02){return function(_0x33a4ff){if(_0x33a4ff){return _0x33a4ff[_0xd5e8('0x25')](_0x1d515d)[_0xd5e8('0x26')](function(_0x4592e5){return _0x4592e5;});}return null;};}function removeEntity(_0x5bfbb2,_0x4a133e){return function(_0x5f177c){if(_0x5f177c){return _0x5f177c['destroy']()[_0xd5e8('0x26')](function(){var _0x5620cb=_0x5f177c[_0xd5e8('0x27')]({'plain':!![]});var _0x3b1a69='Dispositions';return db['UserProfileResource'][_0xd5e8('0x28')]({'where':{'type':_0x3b1a69,'resourceId':_0x5620cb['id']}})[_0xd5e8('0x26')](function(){return _0x5f177c;});})[_0xd5e8('0x26')](function(){_0x5bfbb2[_0xd5e8('0x1b')](0xcc)[_0xd5e8('0x29')]();});}};}function handleEntityNotFound(_0x314352,_0x3cb0ea){return function(_0x2b7244){if(!_0x2b7244){_0x314352[_0xd5e8('0x1a')](0x194);}return _0x2b7244;};}function handleError(_0x583ea1,_0x46b78d){_0x46b78d=_0x46b78d||0x1f4;return function(_0x570e6a){logger[_0xd5e8('0x2a')](_0x570e6a[_0xd5e8('0x2b')]);if(_0x570e6a[_0xd5e8('0x2c')]){delete _0x570e6a[_0xd5e8('0x2c')];}_0x583ea1[_0xd5e8('0x1b')](_0x46b78d)['send'](_0x570e6a);};}exports[_0xd5e8('0x2d')]=function(_0x3d2e7b,_0x49276c){var _0x315955={},_0x5d4b1c={},_0x3980a1={'count':0x0,'rows':[]};var _0x202cb7=_[_0xd5e8('0x2e')](db[_0xd5e8('0x2f')][_0xd5e8('0x30')],function(_0x118da1){return{'name':_0x118da1[_0xd5e8('0x31')],'type':_0x118da1[_0xd5e8('0x32')]['key']};});_0x5d4b1c[_0xd5e8('0x33')]=_[_0xd5e8('0x2e')](_0x202cb7,_0xd5e8('0x2c'));_0x5d4b1c[_0xd5e8('0x34')]=_[_0xd5e8('0x35')](_0x3d2e7b[_0xd5e8('0x34')]);_0x5d4b1c[_0xd5e8('0x36')]=_[_0xd5e8('0x37')](_0x5d4b1c['model'],_0x5d4b1c['query']);_0x315955['attributes']=_[_0xd5e8('0x37')](_0x5d4b1c[_0xd5e8('0x33')],qs[_0xd5e8('0x38')](_0x3d2e7b[_0xd5e8('0x34')][_0xd5e8('0x38')]));_0x315955[_0xd5e8('0x39')]=_0x315955[_0xd5e8('0x39')]['length']?_0x315955['attributes']:_0x5d4b1c[_0xd5e8('0x33')];if(!_0x3d2e7b[_0xd5e8('0x34')][_0xd5e8('0x3a')](_0xd5e8('0x3b'))){_0x315955[_0xd5e8('0x1f')]=qs[_0xd5e8('0x1f')](_0x3d2e7b[_0xd5e8('0x34')][_0xd5e8('0x1f')]);_0x315955[_0xd5e8('0x1d')]=qs[_0xd5e8('0x1d')](_0x3d2e7b[_0xd5e8('0x34')]['offset']);}_0x315955[_0xd5e8('0x3c')]=qs['sort'](_0x3d2e7b[_0xd5e8('0x34')]['sort']);_0x315955[_0xd5e8('0x3d')]=qs['filters'](_[_0xd5e8('0x3e')](_0x3d2e7b[_0xd5e8('0x34')],_0x5d4b1c[_0xd5e8('0x36')]),_0x202cb7);if(_0x3d2e7b[_0xd5e8('0x34')][_0xd5e8('0x3f')]){_0x315955[_0xd5e8('0x3d')]=_['merge'](_0x315955['where'],{'$or':_[_0xd5e8('0x2e')](_0x202cb7,function(_0x2e5b08){if(_0x2e5b08['type']!=='VIRTUAL'){var _0xb8c1fb={};_0xb8c1fb[_0x2e5b08[_0xd5e8('0x2c')]]={'$like':'%'+_0x3d2e7b[_0xd5e8('0x34')][_0xd5e8('0x3f')]+'%'};return _0xb8c1fb;}})});}_0x315955=_[_0xd5e8('0x40')]({},_0x315955,_0x3d2e7b[_0xd5e8('0x41')]);var _0x5001bc={'where':_0x315955['where']};return db[_0xd5e8('0x2f')][_0xd5e8('0x20')](_0x5001bc)['then'](function(_0x13c718){_0x3980a1[_0xd5e8('0x20')]=_0x13c718;if(_0x3d2e7b[_0xd5e8('0x34')][_0xd5e8('0x42')]){_0x315955[_0xd5e8('0x43')]=[{'all':!![]}];}return db[_0xd5e8('0x2f')]['findAll'](_0x315955);})[_0xd5e8('0x26')](function(_0x26b14e){_0x3980a1['rows']=_0x26b14e;return _0x3980a1;})['then'](respondWithFilteredResult(_0x49276c,_0x315955))[_0xd5e8('0x44')](handleError(_0x49276c,null));};exports[_0xd5e8('0x45')]=function(_0x17add4,_0x50cf35){var _0x511ee8={'raw':!![],'where':{'id':_0x17add4[_0xd5e8('0x46')]['id']}},_0x165326={};_0x165326['model']=_[_0xd5e8('0x35')](db[_0xd5e8('0x2f')][_0xd5e8('0x30')]);_0x165326[_0xd5e8('0x34')]=_[_0xd5e8('0x35')](_0x17add4[_0xd5e8('0x34')]);_0x165326[_0xd5e8('0x36')]=_['intersection'](_0x165326[_0xd5e8('0x33')],_0x165326[_0xd5e8('0x34')]);_0x511ee8[_0xd5e8('0x39')]=_[_0xd5e8('0x37')](_0x165326[_0xd5e8('0x33')],qs[_0xd5e8('0x38')](_0x17add4[_0xd5e8('0x34')][_0xd5e8('0x38')]));_0x511ee8['attributes']=_0x511ee8[_0xd5e8('0x39')][_0xd5e8('0x47')]?_0x511ee8[_0xd5e8('0x39')]:_0x165326[_0xd5e8('0x33')];if(_0x17add4[_0xd5e8('0x34')]['includeAll']){_0x511ee8[_0xd5e8('0x43')]=[{'all':!![]}];}_0x511ee8=_[_0xd5e8('0x40')]({},_0x511ee8,_0x17add4[_0xd5e8('0x41')]);return db[_0xd5e8('0x2f')]['find'](_0x511ee8)[_0xd5e8('0x26')](handleEntityNotFound(_0x50cf35,null))[_0xd5e8('0x26')](respondWithResult(_0x50cf35,null))[_0xd5e8('0x44')](handleError(_0x50cf35,null));};exports['create']=function(_0x58a40b,_0x4b2f79){return db['Disposition'][_0xd5e8('0x48')](_0x58a40b[_0xd5e8('0x49')],{})[_0xd5e8('0x26')](function(_0x5e200b){var _0x2d9f8c=_0x58a40b[_0xd5e8('0x4a')]['get']({'plain':!![]});if(!_0x2d9f8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d9f8c['role']===_0xd5e8('0x4a')){var _0x1c9926=_0x5e200b[_0xd5e8('0x27')]({'plain':!![]});var _0x590413='Dispositions';return db[_0xd5e8('0x4b')][_0xd5e8('0x4c')]({'where':{'name':_0x590413,'userProfileId':_0x2d9f8c[_0xd5e8('0x4d')]},'raw':!![]})[_0xd5e8('0x26')](function(_0x43aaf0){if(_0x43aaf0&&_0x43aaf0[_0xd5e8('0x4e')]===0x0){return db[_0xd5e8('0x4f')]['create']({'name':_0x1c9926[_0xd5e8('0x2c')],'resourceId':_0x1c9926['id'],'type':_0x43aaf0[_0xd5e8('0x2c')],'sectionId':_0x43aaf0['id']},{})['then'](function(){return _0x5e200b;});}else{return _0x5e200b;}})[_0xd5e8('0x44')](function(_0x31e8d2){logger['error'](_0xd5e8('0x50'),_0x31e8d2);throw _0x31e8d2;});}return _0x5e200b;})['then'](respondWithResult(_0x4b2f79,0xc9))[_0xd5e8('0x44')](handleError(_0x4b2f79,null));};exports[_0xd5e8('0x25')]=function(_0x59b25a,_0x55e608){if(_0x59b25a[_0xd5e8('0x49')]['id']){delete _0x59b25a[_0xd5e8('0x49')]['id'];}return db['Disposition'][_0xd5e8('0x4c')]({'where':{'id':_0x59b25a[_0xd5e8('0x46')]['id']}})['then'](handleEntityNotFound(_0x55e608,null))[_0xd5e8('0x26')](saveUpdates(_0x59b25a[_0xd5e8('0x49')],null))[_0xd5e8('0x26')](respondWithResult(_0x55e608,null))[_0xd5e8('0x44')](handleError(_0x55e608,null));};exports[_0xd5e8('0x28')]=function(_0x578348,_0x545ec2){return db[_0xd5e8('0x2f')][_0xd5e8('0x4c')]({'where':{'id':_0x578348[_0xd5e8('0x46')]['id']}})[_0xd5e8('0x26')](handleEntityNotFound(_0x545ec2,null))[_0xd5e8('0x26')](removeEntity(_0x545ec2,null))['catch'](handleError(_0x545ec2,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index cecfa19..efd02c6 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 _0xad44=['WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp'];(function(_0xe7f924,_0x1d6fdd){var _0x5d9530=function(_0x4d2d34){while(--_0x4d2d34){_0xe7f924['push'](_0xe7f924['shift']());}};_0x5d9530(++_0x1d6fdd);}(_0xad44,0x109));var _0x4ad4=function(_0x549cad,_0xc32566){_0x549cad=_0x549cad-0x0;var _0x5a9eed=_0xad44[_0x549cad];return _0x5a9eed;};'use strict';var _=require(_0x4ad4('0x0'));var util=require('util');var logger=require(_0x4ad4('0x1'))('api');var moment=require(_0x4ad4('0x2'));var BPromise=require(_0x4ad4('0x3'));var rp=require(_0x4ad4('0x4'));var fs=require('fs');var path=require(_0x4ad4('0x5'));var rimraf=require(_0x4ad4('0x6'));var config=require(_0x4ad4('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x4113f1,_0x242160){return _0x4113f1['define']('Disposition',attributes,{'tableName':_0x4ad4('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4ad4('0x9'),'fields':[_0x4ad4('0xa'),_0x4ad4('0xb')]},{'unique':!![],'name':_0x4ad4('0xc'),'fields':['name',_0x4ad4('0xd')]},{'unique':!![],'name':_0x4ad4('0xe'),'fields':[_0x4ad4('0xa'),_0x4ad4('0xf')]},{'unique':!![],'name':_0x4ad4('0x10'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x4ad4('0x11'),'fields':['name',_0x4ad4('0x12')]},{'unique':!![],'name':_0x4ad4('0x13'),'fields':[_0x4ad4('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0x4ad4('0x14'),'fields':[_0x4ad4('0xa'),_0x4ad4('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5832=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x15f968,_0xc17341){var _0x290861=function(_0x2275e7){while(--_0x2275e7){_0x15f968['push'](_0x15f968['shift']());}};_0x290861(++_0xc17341);}(_0x5832,0x1f3));var _0x2583=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x5832[_0x4d67b8];return _0x55af3b;};'use strict';var _=require(_0x2583('0x0'));var util=require(_0x2583('0x1'));var logger=require(_0x2583('0x2'))(_0x2583('0x3'));var moment=require(_0x2583('0x4'));var BPromise=require(_0x2583('0x5'));var rp=require(_0x2583('0x6'));var fs=require('fs');var path=require(_0x2583('0x7'));var rimraf=require(_0x2583('0x8'));var config=require(_0x2583('0x9'));var attributes=require(_0x2583('0xa'));module['exports']=function(_0x3eed5a,_0x5b6bce){return _0x3eed5a['define'](_0x2583('0xb'),attributes,{'tableName':_0x2583('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2583('0xd'),'fields':[_0x2583('0xe'),'ListId']},{'unique':!![],'name':_0x2583('0xf'),'fields':[_0x2583('0xe'),_0x2583('0x10')]},{'unique':!![],'name':_0x2583('0x11'),'fields':['name',_0x2583('0x12')]},{'unique':!![],'name':_0x2583('0x13'),'fields':[_0x2583('0xe'),_0x2583('0x14')]},{'unique':!![],'name':_0x2583('0x15'),'fields':[_0x2583('0xe'),_0x2583('0x16')]},{'unique':!![],'name':_0x2583('0x17'),'fields':[_0x2583('0xe'),_0x2583('0x18')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x2583('0xe'),_0x2583('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8e804e3..3306af3 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(_0x2a4a21,_0x4cceb0){var _0x9bef4d=function(_0x26e27d){while(--_0x26e27d){_0x2a4a21['push'](_0x2a4a21['shift']());}};_0x9bef4d(++_0x4cceb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x3b04e4,_0x5c32f8){var _0x2fedb5=function(_0x558060){while(--_0x558060){_0x3b04e4['push'](_0x3b04e4['shift']());}};_0x2fedb5(++_0x5c32f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 6fb41df..434701e 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 _0x068a=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x4ffd20,_0x1e83b6){var _0x49b5e2=function(_0xfdd1a6){while(--_0xfdd1a6){_0x4ffd20['push'](_0x4ffd20['shift']());}};_0x49b5e2(++_0x1e83b6);}(_0x068a,0x140));var _0xa068=function(_0x3078cd,_0xbd49a5){_0x3078cd=_0x3078cd-0x0;var _0x553add=_0x068a[_0x3078cd];return _0x553add;};'use strict';var multer=require(_0xa068('0x0'));var util=require(_0xa068('0x1'));var path=require(_0xa068('0x2'));var timeout=require(_0xa068('0x3'));var express=require(_0xa068('0x4'));var router=express['Router']();var fs_extra=require(_0xa068('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa068('0x6'));var config=require(_0xa068('0x7'));var controller=require(_0xa068('0x8'));router[_0xa068('0x9')]('/',auth[_0xa068('0xa')](),controller[_0xa068('0xb')]);router[_0xa068('0x9')]('/:id',auth[_0xa068('0xa')](),controller[_0xa068('0xc')]);router[_0xa068('0xd')]('/',auth[_0xa068('0xa')](),controller[_0xa068('0xe')]);router[_0xa068('0xf')](_0xa068('0x10'),auth[_0xa068('0xa')](),controller[_0xa068('0x11')]);router[_0xa068('0x12')](_0xa068('0x10'),auth[_0xa068('0xa')](),controller[_0xa068('0x13')]);module[_0xa068('0x14')]=router; \ No newline at end of file +var _0x4d1b=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1667b9,_0x32193c){var _0x342992=function(_0x68f5cb){while(--_0x68f5cb){_0x1667b9['push'](_0x1667b9['shift']());}};_0x342992(++_0x32193c);}(_0x4d1b,0x102));var _0xb4d1=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0x4d1b[_0x542d80];return _0x1f4492;};'use strict';var multer=require(_0xb4d1('0x0'));var util=require('util');var path=require(_0xb4d1('0x1'));var timeout=require(_0xb4d1('0x2'));var express=require(_0xb4d1('0x3'));var router=express[_0xb4d1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb4d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb4d1('0x6'));var controller=require(_0xb4d1('0x7'));router['get']('/',auth[_0xb4d1('0x8')](),controller[_0xb4d1('0x9')]);router[_0xb4d1('0xa')](_0xb4d1('0xb'),auth['isAuthenticated'](),controller[_0xb4d1('0xc')]);router[_0xb4d1('0xd')]('/',auth['isAuthenticated'](),controller[_0xb4d1('0xe')]);router[_0xb4d1('0xf')](_0xb4d1('0xb'),auth[_0xb4d1('0x8')](),controller[_0xb4d1('0x10')]);router[_0xb4d1('0x11')]('/:id',auth[_0xb4d1('0x8')](),controller[_0xb4d1('0x12')]);module[_0xb4d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a851537..733e621 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 _0x260f=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','12000','14400','9600','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2cd752,_0x4ae8c3){var _0x2af2f4=function(_0x5c8fc2){while(--_0x5c8fc2){_0x2cd752['push'](_0x2cd752['shift']());}};_0x2af2f4(++_0x4ae8c3);}(_0x260f,0xfd));var _0xf260=function(_0x1edf83,_0x5b07b5){_0x1edf83=_0x1edf83-0x0;var _0x320ef9=_0x260f[_0x1edf83];return _0x320ef9;};'use strict';var Sequelize=require(_0xf260('0x0'));module[_0xf260('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf260('0x2')]},'ecm':{'type':Sequelize[_0xf260('0x3')](_0xf260('0x4'),'no'),'defaultValue':_0xf260('0x4')},'headerinfo':{'type':Sequelize[_0xf260('0x2')],'defaultValue':_0xf260('0x5')},'localstationid':{'type':Sequelize[_0xf260('0x2')],'unique':_0xf260('0x6')},'minrate':{'type':Sequelize[_0xf260('0x3')](_0xf260('0x7'),_0xf260('0x8'),'7200','9600',_0xf260('0x9'),_0xf260('0xa')),'defaultValue':_0xf260('0x8')},'maxrate':{'type':Sequelize[_0xf260('0x3')](_0xf260('0x7'),_0xf260('0x8'),'7200',_0xf260('0xb'),_0xf260('0x9'),_0xf260('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf260('0x2')],'defaultValue':_0xf260('0xc')},'gateway':{'type':Sequelize[_0xf260('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf260('0x3')](_0xf260('0xd'),_0xf260('0xe'),_0xf260('0xf'),_0xf260('0x10')),'defaultValue':_0xf260('0xd')},'key':{'type':Sequelize[_0xf260('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf260('0x11')],'defaultValue':function(){return _0xf260('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf260('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf260('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf260('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf260('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf260('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf260('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf260('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xdbee33){if(!_0xdbee33)this[_0xf260('0x16')](_0xf260('0x17'),null);this['setDataValue'](_0xf260('0x18'),_0xdbee33);}}}; \ No newline at end of file +var _0xc1f9=['INTEGER','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','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','9600','12000','14400','7200','v17,v27,v29'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1f9,0x153));var _0x9c1f=function(_0x2ce179,_0x391f85){_0x2ce179=_0x2ce179-0x0;var _0x9622e7=_0xc1f9[_0x2ce179];return _0x9622e7;};'use strict';var Sequelize=require(_0x9c1f('0x0'));module[_0x9c1f('0x1')]={'name':{'type':Sequelize[_0x9c1f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c1f('0x2')]},'ecm':{'type':Sequelize[_0x9c1f('0x3')](_0x9c1f('0x4'),'no'),'defaultValue':_0x9c1f('0x4')},'headerinfo':{'type':Sequelize[_0x9c1f('0x2')],'defaultValue':_0x9c1f('0x5')},'localstationid':{'type':Sequelize[_0x9c1f('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x9c1f('0x3')](_0x9c1f('0x6'),_0x9c1f('0x7'),'7200',_0x9c1f('0x8'),_0x9c1f('0x9'),_0x9c1f('0xa')),'defaultValue':_0x9c1f('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x9c1f('0x6'),'4800',_0x9c1f('0xb'),_0x9c1f('0x8'),_0x9c1f('0x9'),_0x9c1f('0xa')),'defaultValue':_0x9c1f('0xa')},'modem':{'type':Sequelize[_0x9c1f('0x2')],'defaultValue':_0x9c1f('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9c1f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9c1f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9c1f('0x3')]('SIP',_0x9c1f('0xe'),_0x9c1f('0xf'),_0x9c1f('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9c1f('0x11')],'defaultValue':function(){return _0x9c1f('0x12');}},'notificationSound':{'type':Sequelize[_0x9c1f('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9c1f('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c1f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c1f('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c1f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c1f('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c1f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9c1f('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x9c1f('0x13')],'defaultValue':![],'comment':_0x9c1f('0x15'),'set':function(_0x520d1f){if(!_0x520d1f)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x520d1f);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2baf67c..f07dca7 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 _0x15a1=['Content-Range','json','apply','reject','save','update','destroy','get','FaxAccounts','end','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','count','includeAll','include','FaxAccount','findAll','rows','catch','show','Pause','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','FaxAccountId','getDispositions','findOne','Disposition','filter','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Owner','fullname','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','transaction','bulkCreate','updateAccountApplications','VoiceExtension','tech','createdAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','Send\x20Fax\x20failed','Contact\x20not\x20found','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','offset','undefined','limit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x15a1,0x97));var _0x115a=function(_0x38d2a8,_0x481f8c){_0x38d2a8=_0x38d2a8-0x0;var _0x3ca716=_0x15a1[_0x38d2a8];return _0x3ca716;};'use strict';var emlformat=require(_0x115a('0x0'));var rimraf=require(_0x115a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x115a('0x2'));var rp=require('request-promise');var moment=require(_0x115a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x115a('0x4'));var util=require(_0x115a('0x5'));var path=require(_0x115a('0x6'));var sox=require(_0x115a('0x7'));var csv=require(_0x115a('0x8'));var ejs=require(_0x115a('0x9'));var fs=require('fs');var fs_extra=require(_0x115a('0xa'));var _=require(_0x115a('0xb'));var squel=require('squel');var crypto=require(_0x115a('0xc'));var jsforce=require(_0x115a('0xd'));var deskjs=require(_0x115a('0xe'));var toCsv=require(_0x115a('0x8'));var querystring=require('querystring');var Papa=require(_0x115a('0xf'));var Redis=require(_0x115a('0x10'));var authService=require(_0x115a('0x11'));var qs=require(_0x115a('0x12'));var as=require(_0x115a('0x13'));var hardwareService=require(_0x115a('0x14'));var logger=require(_0x115a('0x15'))('api');var utils=require(_0x115a('0x16'));var config=require(_0x115a('0x17'));var licenseUtil=require(_0x115a('0x18'));var db=require(_0x115a('0x19'))['db'];config[_0x115a('0x1a')]=_[_0x115a('0x1b')](config[_0x115a('0x1a')],{'host':_0x115a('0x1c'),'port':0x18eb});var socket=require(_0x115a('0x1d'))(new Redis(config[_0x115a('0x1a')]));require('./faxAccount.socket')[_0x115a('0x1e')](socket);var jayson=require(_0x115a('0x1f'));var client=jayson[_0x115a('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x115a('0x20')][_0x115a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x212ed1,_0x570554,_0x114f5a,_0x2b10c5){return new BPromise(function(_0x29f1eb,_0x230f2c){var _0x29a05b=_0x2b10c5||client;return _0x29a05b[_0x115a('0x22')](_0x212ed1,_0x114f5a)[_0x115a('0x23')](function(_0x52e679){logger[_0x115a('0x24')](_0x115a('0x25'),_0x570554,_0x115a('0x26'));logger[_0x115a('0x27')](_0x115a('0x28'),_0x570554,_0x115a('0x26'),JSON['stringify'](_0x52e679));if(_0x52e679[_0x115a('0x29')]){if(_0x52e679['error'][_0x115a('0x2a')]===0x1f4){logger[_0x115a('0x29')]('FaxAccount,\x20%s,\x20%s',_0x570554,_0x52e679['error']['message']);return _0x230f2c(_0x52e679[_0x115a('0x29')][_0x115a('0x2b')]);}logger[_0x115a('0x29')]('FaxAccount,\x20%s,\x20%s',_0x570554,_0x52e679[_0x115a('0x29')][_0x115a('0x2b')]);return _0x29f1eb(_0x52e679['error'][_0x115a('0x2b')]);}else{logger[_0x115a('0x24')](_0x115a('0x25'),_0x570554,_0x115a('0x26'));_0x29f1eb(_0x52e679[_0x115a('0x2c')][_0x115a('0x2b')]);}})['catch'](function(_0x1f3d4){logger[_0x115a('0x29')](_0x115a('0x25'),_0x570554,_0x1f3d4);_0x230f2c(_0x1f3d4);});});}function respondWithStatusCode(_0x43fc48,_0x45ca54){_0x45ca54=_0x45ca54||0xcc;return function(_0x542e14){if(_0x542e14){return _0x43fc48[_0x115a('0x2d')](_0x45ca54);}return _0x43fc48[_0x115a('0x2e')](_0x45ca54)['end']();};}function respondWithResult(_0x43efd2,_0x3aca1b){_0x3aca1b=_0x3aca1b||0xc8;return function(_0x3bf16b){if(_0x3bf16b){return _0x43efd2[_0x115a('0x2e')](_0x3aca1b)['json'](_0x3bf16b);}};}function respondWithFilteredResult(_0x2111eb,_0x2765c1){return function(_0x3bfe11){if(_0x3bfe11){var _0x1ce445=typeof _0x2765c1[_0x115a('0x2f')]===_0x115a('0x30')&&typeof _0x2765c1[_0x115a('0x31')]===_0x115a('0x30');var _0x3efc68=_0x3bfe11['count'];var _0x54d60d=_0x1ce445?0x0:_0x2765c1[_0x115a('0x2f')];var _0x14d339=_0x1ce445?_0x3bfe11['count']:_0x2765c1[_0x115a('0x2f')]+_0x2765c1[_0x115a('0x31')];var _0x25c68f;if(_0x14d339>=_0x3efc68){_0x14d339=_0x3efc68;_0x25c68f=0xc8;}else{_0x25c68f=0xce;}_0x2111eb[_0x115a('0x2e')](_0x25c68f);return _0x2111eb['set'](_0x115a('0x32'),_0x54d60d+'-'+_0x14d339+'/'+_0x3efc68)[_0x115a('0x33')](_0x3bfe11);}return null;};}function patchUpdates(_0x3afe1e){return function(_0x3c91b4){try{jsonpatch[_0x115a('0x34')](_0x3c91b4,_0x3afe1e,!![]);}catch(_0x4d15b6){return BPromise[_0x115a('0x35')](_0x4d15b6);}return _0x3c91b4[_0x115a('0x36')]();};}function saveUpdates(_0x39a611,_0x2254d2){return function(_0x3be6e2){if(_0x3be6e2){return _0x3be6e2[_0x115a('0x37')](_0x39a611)['then'](function(_0x5e21ea){return _0x5e21ea;});}return null;};}function removeEntity(_0x35cf57,_0xc112d2){return function(_0x4832cf){if(_0x4832cf){return _0x4832cf[_0x115a('0x38')]()[_0x115a('0x23')](function(){var _0x2309d0=_0x4832cf[_0x115a('0x39')]({'plain':!![]});var _0xe4f03e=_0x115a('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0xe4f03e,'resourceId':_0x2309d0['id']}})[_0x115a('0x23')](function(){return _0x4832cf;});})[_0x115a('0x23')](function(){_0x35cf57[_0x115a('0x2e')](0xcc)[_0x115a('0x3b')]();});}};}function handleEntityNotFound(_0x195c11,_0x522f08){return function(_0x77c690){if(!_0x77c690){_0x195c11[_0x115a('0x2d')](0x194);}return _0x77c690;};}function handleError(_0x495e31,_0x5de8bf){_0x5de8bf=_0x5de8bf||0x1f4;return function(_0x3b43c2){logger['error'](_0x3b43c2[_0x115a('0x3c')]);if(_0x3b43c2[_0x115a('0x3d')]){delete _0x3b43c2['name'];}_0x495e31[_0x115a('0x2e')](_0x5de8bf)[_0x115a('0x3e')](_0x3b43c2);};}exports[_0x115a('0x3f')]=function(_0x519f7c,_0x25a663){var _0x2b5311={'include':[{'model':db['Pause'],'as':_0x115a('0x40')}]},_0xa5f56e={},_0x21fcff={'count':0x0,'rows':[]};var _0x45d56f=_[_0x115a('0x41')](db['FaxAccount'][_0x115a('0x42')],function(_0x5c3144){return{'name':_0x5c3144[_0x115a('0x43')],'type':_0x5c3144[_0x115a('0x44')][_0x115a('0x45')]};});_0xa5f56e[_0x115a('0x46')]=_['map'](_0x45d56f,'name');_0xa5f56e['query']=_[_0x115a('0x47')](_0x519f7c[_0x115a('0x48')]);_0xa5f56e[_0x115a('0x49')]=_[_0x115a('0x4a')](_0xa5f56e[_0x115a('0x46')],_0xa5f56e[_0x115a('0x48')]);_0x2b5311[_0x115a('0x4b')]=_[_0x115a('0x4a')](_0xa5f56e['model'],qs[_0x115a('0x4c')](_0x519f7c[_0x115a('0x48')][_0x115a('0x4c')]));_0x2b5311[_0x115a('0x4b')]=_0x2b5311['attributes'][_0x115a('0x4d')]?_0x2b5311[_0x115a('0x4b')]:_0xa5f56e[_0x115a('0x46')];if(!_0x519f7c[_0x115a('0x48')]['hasOwnProperty'](_0x115a('0x4e'))){_0x2b5311['limit']=qs['limit'](_0x519f7c['query'][_0x115a('0x31')]);_0x2b5311[_0x115a('0x2f')]=qs[_0x115a('0x2f')](_0x519f7c['query']['offset']);}_0x2b5311[_0x115a('0x4f')]=qs[_0x115a('0x50')](_0x519f7c[_0x115a('0x48')][_0x115a('0x50')]);_0x2b5311[_0x115a('0x51')]=qs[_0x115a('0x49')](_[_0x115a('0x52')](_0x519f7c['query'],_0xa5f56e[_0x115a('0x49')]),_0x45d56f);if(_0x519f7c[_0x115a('0x48')]['filter']){_0x2b5311['where']=_[_0x115a('0x53')](_0x2b5311[_0x115a('0x51')],{'$or':_[_0x115a('0x41')](_0x45d56f,function(_0x2b2b3e){if(_0x2b2b3e[_0x115a('0x44')]!=='VIRTUAL'){var _0x109071={};_0x109071[_0x2b2b3e['name']]={'$like':'%'+_0x519f7c[_0x115a('0x48')]['filter']+'%'};return _0x109071;}})});}_0x2b5311=_[_0x115a('0x53')]({},_0x2b5311,_0x519f7c[_0x115a('0x54')]);var _0x9819c0={'where':_0x2b5311[_0x115a('0x51')]};return db['FaxAccount']['count'](_0x9819c0)['then'](function(_0xebc1e){_0x21fcff[_0x115a('0x55')]=_0xebc1e;if(_0x519f7c[_0x115a('0x48')][_0x115a('0x56')]){_0x2b5311[_0x115a('0x57')]=[{'all':!![]}];}return db[_0x115a('0x58')][_0x115a('0x59')](_0x2b5311);})[_0x115a('0x23')](function(_0x31fa59){_0x21fcff[_0x115a('0x5a')]=_0x31fa59;return _0x21fcff;})[_0x115a('0x23')](respondWithFilteredResult(_0x25a663,_0x2b5311))[_0x115a('0x5b')](handleError(_0x25a663,null));};exports[_0x115a('0x5c')]=function(_0x524838,_0xec575a){var _0x5ebc40={'raw':![],'where':{'id':_0x524838['params']['id']},'include':[{'model':db[_0x115a('0x5d')],'as':_0x115a('0x40')}]},_0x401af6={};_0x401af6[_0x115a('0x46')]=_['keys'](db['FaxAccount']['rawAttributes']);_0x401af6[_0x115a('0x48')]=_[_0x115a('0x47')](_0x524838['query']);_0x401af6['filters']=_['intersection'](_0x401af6['model'],_0x401af6[_0x115a('0x48')]);_0x5ebc40[_0x115a('0x4b')]=_['intersection'](_0x401af6['model'],qs[_0x115a('0x4c')](_0x524838[_0x115a('0x48')]['fields']));_0x5ebc40[_0x115a('0x4b')]=_0x5ebc40[_0x115a('0x4b')][_0x115a('0x4d')]?_0x5ebc40[_0x115a('0x4b')]:_0x401af6['model'];if(_0x524838[_0x115a('0x48')][_0x115a('0x56')]){_0x5ebc40[_0x115a('0x57')]=[{'all':!![]}];}_0x5ebc40=_[_0x115a('0x53')]({},_0x5ebc40,_0x524838[_0x115a('0x54')]);return db[_0x115a('0x58')]['find'](_0x5ebc40)[_0x115a('0x23')](handleEntityNotFound(_0xec575a,null))['then'](respondWithResult(_0xec575a,null))['catch'](handleError(_0xec575a,null));};exports[_0x115a('0x5e')]=function(_0x3d05c3,_0x3b87fb){return db[_0x115a('0x58')]['create'](_0x3d05c3['body'],{})['then'](function(_0xf18c2b){var _0x3ee4dd=_0x3d05c3[_0x115a('0x5f')][_0x115a('0x39')]({'plain':!![]});if(!_0x3ee4dd)throw new Error(_0x115a('0x60'));if(_0x3ee4dd[_0x115a('0x61')]===_0x115a('0x5f')){var _0x4cd329=_0xf18c2b[_0x115a('0x39')]({'plain':!![]});var _0x18face=_0x115a('0x3a');return db['UserProfileSection'][_0x115a('0x62')]({'where':{'name':_0x18face,'userProfileId':_0x3ee4dd[_0x115a('0x63')]},'raw':!![]})[_0x115a('0x23')](function(_0x4609a9){if(_0x4609a9&&_0x4609a9[_0x115a('0x64')]===0x0){return db[_0x115a('0x65')][_0x115a('0x5e')]({'name':_0x4cd329[_0x115a('0x3d')],'resourceId':_0x4cd329['id'],'type':_0x4609a9[_0x115a('0x3d')],'sectionId':_0x4609a9['id']},{})['then'](function(){return _0xf18c2b;});}else{return _0xf18c2b;}})[_0x115a('0x5b')](function(_0x3a1d7c){logger['error'](_0x115a('0x66'),_0x3a1d7c);throw _0x3a1d7c;});}return _0xf18c2b;})['then'](respondWithResult(_0x3b87fb,0xc9))[_0x115a('0x5b')](handleError(_0x3b87fb,null));};exports[_0x115a('0x37')]=function(_0x77ed38,_0x2a9ccd){if(_0x77ed38[_0x115a('0x67')]['id']){delete _0x77ed38['body']['id'];}return db[_0x115a('0x58')][_0x115a('0x62')]({'where':{'id':_0x77ed38[_0x115a('0x68')]['id']},'include':[{'model':db[_0x115a('0x5d')],'as':_0x115a('0x40')}]})[_0x115a('0x23')](handleEntityNotFound(_0x2a9ccd,null))[_0x115a('0x23')](saveUpdates(_0x77ed38['body'],null))[_0x115a('0x23')](respondWithResult(_0x2a9ccd,null))[_0x115a('0x5b')](handleError(_0x2a9ccd,null));};exports[_0x115a('0x38')]=function(_0x3a32ad,_0x36b89f){return db[_0x115a('0x58')]['find']({'where':{'id':_0x3a32ad['params']['id']}})['then'](handleEntityNotFound(_0x36b89f,null))[_0x115a('0x23')](removeEntity(_0x36b89f,null))[_0x115a('0x5b')](handleError(_0x36b89f,null));};exports[_0x115a('0x69')]=function(_0x23c831,_0x305773){return db[_0x115a('0x58')]['describe']()[_0x115a('0x23')](respondWithResult(_0x305773,null))[_0x115a('0x5b')](handleError(_0x305773,null));};exports['addDisposition']=function(_0x191c82,_0x4d9475,_0x44837b){if(_0x191c82[_0x115a('0x67')]['id']){delete _0x191c82[_0x115a('0x67')]['id'];}return db[_0x115a('0x58')][_0x115a('0x62')]({'where':{'id':_0x191c82[_0x115a('0x68')]['id']}})['then'](handleEntityNotFound(_0x4d9475,null))[_0x115a('0x23')](function(_0xe16a13){if(_0xe16a13){_0x191c82[_0x115a('0x67')][_0x115a('0x6a')]=_0xe16a13['id'];return db['Disposition']['create'](_0x191c82[_0x115a('0x67')]);}})[_0x115a('0x23')](respondWithResult(_0x4d9475,null))['catch'](handleError(_0x4d9475,null));};exports[_0x115a('0x6b')]=function(_0x4a361c,_0x2edd9d,_0xde4996){var _0x1afe45={'raw':![],'where':{}};var _0x39b0a0={};var _0x1ef075={'count':0x0,'rows':[]};return db[_0x115a('0x58')][_0x115a('0x6c')]({'where':{'id':_0x4a361c[_0x115a('0x68')]['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x2edd9d,null))[_0x115a('0x23')](function(_0x33b482){if(_0x33b482){_0x39b0a0['model']=_['keys'](db[_0x115a('0x6d')][_0x115a('0x42')]);_0x39b0a0['query']=_['keys'](_0x4a361c[_0x115a('0x48')]);_0x39b0a0[_0x115a('0x49')]=_['intersection'](_0x39b0a0[_0x115a('0x46')],_0x39b0a0[_0x115a('0x48')]);_0x1afe45[_0x115a('0x4b')]=_['intersection'](_0x39b0a0[_0x115a('0x46')],qs[_0x115a('0x4c')](_0x4a361c[_0x115a('0x48')][_0x115a('0x4c')]));_0x1afe45[_0x115a('0x4b')]=_0x1afe45[_0x115a('0x4b')][_0x115a('0x4d')]?_0x1afe45[_0x115a('0x4b')]:_0x39b0a0[_0x115a('0x46')];if(!_0x4a361c[_0x115a('0x48')]['hasOwnProperty'](_0x115a('0x4e'))){_0x1afe45[_0x115a('0x31')]=qs['limit'](_0x4a361c[_0x115a('0x48')]['limit']);_0x1afe45[_0x115a('0x2f')]=qs[_0x115a('0x2f')](_0x4a361c['query'][_0x115a('0x2f')]);}_0x1afe45['order']=qs[_0x115a('0x50')](_0x4a361c['query'][_0x115a('0x50')]);_0x1afe45[_0x115a('0x51')]=qs[_0x115a('0x49')](_[_0x115a('0x52')](_0x4a361c[_0x115a('0x48')],_0x39b0a0[_0x115a('0x49')]));_0x1afe45[_0x115a('0x51')][_0x115a('0x6a')]=_0x33b482['id'];if(_0x4a361c[_0x115a('0x48')][_0x115a('0x6e')]){_0x1afe45[_0x115a('0x51')]=_[_0x115a('0x53')](_0x1afe45[_0x115a('0x51')],{'$or':_[_0x115a('0x41')](_0x1afe45[_0x115a('0x4b')],function(_0xff636a){var _0x35ad7d={};_0x35ad7d[_0xff636a]={'$like':'%'+_0x4a361c['query']['filter']+'%'};return _0x35ad7d;})});}_0x1afe45=_[_0x115a('0x53')]({},_0x1afe45,_0x4a361c['options']);return db[_0x115a('0x6d')]['count']({'where':_0x1afe45[_0x115a('0x51')]})[_0x115a('0x23')](function(_0x5603c0){_0x1ef075['count']=_0x5603c0;if(_0x4a361c[_0x115a('0x48')][_0x115a('0x56')]){_0x1afe45[_0x115a('0x57')]=[{'all':!![]}];}return db[_0x115a('0x6d')]['findAll'](_0x1afe45);})[_0x115a('0x23')](function(_0x53abd1){_0x1ef075['rows']=_0x53abd1;return _0x1ef075;});}})['then'](respondWithFilteredResult(_0x2edd9d,_0x1afe45))[_0x115a('0x5b')](handleError(_0x2edd9d,null));};exports[_0x115a('0x6f')]=function(_0x3ce219,_0x16cdd5,_0x461cf3){return db[_0x115a('0x58')][_0x115a('0x62')]({'where':{'id':_0x3ce219[_0x115a('0x68')]['id']}})['then'](handleEntityNotFound(_0x16cdd5,null))['then'](function(_0x22f159){if(_0x22f159){return _0x22f159['removeDispositions'](_0x3ce219[_0x115a('0x48')][_0x115a('0x70')]);}})[_0x115a('0x23')](respondWithStatusCode(_0x16cdd5,null))[_0x115a('0x5b')](handleError(_0x16cdd5,null));};exports[_0x115a('0x71')]=function(_0x49b733,_0x206b55,_0x3062c5){if(_0x49b733[_0x115a('0x67')]['id']){delete _0x49b733['body']['id'];}return db[_0x115a('0x58')][_0x115a('0x62')]({'where':{'id':_0x49b733[_0x115a('0x68')]['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x206b55,null))[_0x115a('0x23')](function(_0x420dc0){if(_0x420dc0){_0x49b733['body'][_0x115a('0x6a')]=_0x420dc0['id'];return db['CannedAnswer'][_0x115a('0x5e')](_0x49b733[_0x115a('0x67')]);}})[_0x115a('0x23')](respondWithResult(_0x206b55,null))[_0x115a('0x5b')](handleError(_0x206b55,null));};exports['getAnswers']=function(_0x587d3d,_0x288c63,_0x1c9263){var _0x33ce37={'raw':![],'where':{}};var _0x3022e1={};var _0x2929a5={'count':0x0,'rows':[]};return db[_0x115a('0x58')]['findOne']({'where':{'id':_0x587d3d['params']['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x288c63,null))[_0x115a('0x23')](function(_0xf6e2cc){if(_0xf6e2cc){_0x3022e1['model']=_[_0x115a('0x47')](db[_0x115a('0x72')][_0x115a('0x42')]);_0x3022e1[_0x115a('0x48')]=_[_0x115a('0x47')](_0x587d3d[_0x115a('0x48')]);_0x3022e1['filters']=_[_0x115a('0x4a')](_0x3022e1[_0x115a('0x46')],_0x3022e1[_0x115a('0x48')]);_0x33ce37[_0x115a('0x4b')]=_['intersection'](_0x3022e1[_0x115a('0x46')],qs['fields'](_0x587d3d['query'][_0x115a('0x4c')]));_0x33ce37[_0x115a('0x4b')]=_0x33ce37['attributes'][_0x115a('0x4d')]?_0x33ce37[_0x115a('0x4b')]:_0x3022e1['model'];if(!_0x587d3d[_0x115a('0x48')][_0x115a('0x73')]('nolimit')){_0x33ce37[_0x115a('0x31')]=qs[_0x115a('0x31')](_0x587d3d['query'][_0x115a('0x31')]);_0x33ce37[_0x115a('0x2f')]=qs[_0x115a('0x2f')](_0x587d3d[_0x115a('0x48')][_0x115a('0x2f')]);}_0x33ce37[_0x115a('0x4f')]=qs[_0x115a('0x50')](_0x587d3d[_0x115a('0x48')][_0x115a('0x50')]);_0x33ce37[_0x115a('0x51')]=qs['filters'](_['pick'](_0x587d3d[_0x115a('0x48')],_0x3022e1[_0x115a('0x49')]));_0x33ce37[_0x115a('0x51')][_0x115a('0x6a')]=_0xf6e2cc['id'];if(_0x587d3d['query'][_0x115a('0x6e')]){_0x33ce37[_0x115a('0x51')]=_[_0x115a('0x53')](_0x33ce37['where'],{'$or':_[_0x115a('0x41')](_0x33ce37[_0x115a('0x4b')],function(_0x168c1e){var _0x30da40={};_0x30da40[_0x168c1e]={'$like':'%'+_0x587d3d[_0x115a('0x48')][_0x115a('0x6e')]+'%'};return _0x30da40;})});}_0x33ce37=_['merge']({},_0x33ce37,_0x587d3d[_0x115a('0x54')]);return db['CannedAnswer'][_0x115a('0x55')]({'where':_0x33ce37[_0x115a('0x51')]})[_0x115a('0x23')](function(_0x248279){_0x2929a5['count']=_0x248279;if(_0x587d3d[_0x115a('0x48')][_0x115a('0x56')]){_0x33ce37['include']=[{'all':!![]}];}return db[_0x115a('0x72')][_0x115a('0x59')](_0x33ce37);})[_0x115a('0x23')](function(_0x1f52b1){_0x2929a5['rows']=_0x1f52b1;return _0x2929a5;});}})[_0x115a('0x23')](respondWithFilteredResult(_0x288c63,_0x33ce37))[_0x115a('0x5b')](handleError(_0x288c63,null));};exports[_0x115a('0x74')]=function(_0x4e6ec8,_0x158c80,_0x38b94a){return db[_0x115a('0x58')]['find']({'where':{'id':_0x4e6ec8[_0x115a('0x68')]['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x158c80,null))[_0x115a('0x23')](function(_0x384496){if(_0x384496){return _0x384496['removeAnswers'](_0x4e6ec8[_0x115a('0x48')][_0x115a('0x70')]);}})['then'](respondWithStatusCode(_0x158c80,null))[_0x115a('0x5b')](handleError(_0x158c80,null));};exports[_0x115a('0x75')]=function(_0x4cd354,_0x520672,_0x218064){return db[_0x115a('0x76')]['find']({'where':{'id':_0x4cd354[_0x115a('0x68')]['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x520672,null))[_0x115a('0x23')](function(_0x48e2dd){if(_0x48e2dd){return _0x48e2dd['addInteraction'](_0x4cd354[_0x115a('0x67')][_0x115a('0x70')],_[_0x115a('0x77')](_0x4cd354[_0x115a('0x67')],[_0x115a('0x70'),'id'])||{});}})[_0x115a('0x23')](respondWithResult(_0x520672,null))['catch'](handleError(_0x520672,null));};exports['getInteractions']=function(_0x1f34bc,_0x17f30e,_0x2ce958){var _0x43573e={'raw':![],'where':{}};var _0xcebf65={};var _0x393216={'count':0x0,'rows':[]};return db[_0x115a('0x58')][_0x115a('0x6c')]({'where':{'id':_0x1f34bc['params']['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x17f30e,null))[_0x115a('0x23')](function(_0x122080){if(_0x122080){_0xcebf65[_0x115a('0x46')]=_[_0x115a('0x47')](db['FaxInteraction'][_0x115a('0x42')]);_0xcebf65[_0x115a('0x48')]=_[_0x115a('0x47')](_0x1f34bc[_0x115a('0x48')]);_0xcebf65[_0x115a('0x49')]=_[_0x115a('0x4a')](_0xcebf65['model'],_0xcebf65['query']);_0x43573e['attributes']=_[_0x115a('0x4a')](_0xcebf65['model'],qs[_0x115a('0x4c')](_0x1f34bc[_0x115a('0x48')][_0x115a('0x4c')]));_0x43573e[_0x115a('0x4b')]=_0x43573e[_0x115a('0x4b')]['length']?_0x43573e[_0x115a('0x4b')]:_0xcebf65[_0x115a('0x46')];if(!_0x1f34bc[_0x115a('0x48')]['hasOwnProperty'](_0x115a('0x4e'))){_0x43573e[_0x115a('0x31')]=qs[_0x115a('0x31')](_0x1f34bc['query'][_0x115a('0x31')]);_0x43573e[_0x115a('0x2f')]=qs['offset'](_0x1f34bc[_0x115a('0x48')][_0x115a('0x2f')]);}_0x43573e['order']=qs['sort'](_0x1f34bc['query']['sort']);_0x43573e[_0x115a('0x51')]=qs[_0x115a('0x49')](_[_0x115a('0x52')](_0x1f34bc[_0x115a('0x48')],_0xcebf65[_0x115a('0x49')]));_0x43573e['where']['FaxAccountId']=_0x122080['id'];if(_0x1f34bc['query'][_0x115a('0x6e')]){_0x43573e[_0x115a('0x51')]=_[_0x115a('0x53')](_0x43573e['where'],{'$or':_[_0x115a('0x41')](_0x43573e['attributes'],function(_0x312f19){var _0x6b8c3a={};_0x6b8c3a[_0x312f19]={'$like':'%'+_0x1f34bc[_0x115a('0x48')][_0x115a('0x6e')]+'%'};return _0x6b8c3a;})});}_0x43573e=_[_0x115a('0x53')]({},_0x43573e,_0x1f34bc[_0x115a('0x54')]);return db['FaxInteraction']['count']({'where':_0x43573e[_0x115a('0x51')]})[_0x115a('0x23')](function(_0x5d976b){_0x393216[_0x115a('0x55')]=_0x5d976b;if(_0x1f34bc['query'][_0x115a('0x56')]){_0x43573e[_0x115a('0x57')]=[{'model':db[_0x115a('0x78')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x115a('0x79'),'attributes':[_0x115a('0x3d'),_0x115a('0x7a'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x115a('0x7b'),'attributes':['id',_0x115a('0x3d'),_0x115a('0x7c')],'where':_0x1f34bc[_0x115a('0x48')][_0x115a('0x7d')]?{'id':_0x1f34bc[_0x115a('0x48')]['tag']}:undefined,'required':_0x1f34bc[_0x115a('0x48')]['tag']?!![]:![]}];}return db[_0x115a('0x76')][_0x115a('0x59')](_0x43573e);})[_0x115a('0x23')](function(_0x135501){_0x393216['rows']=_0x135501;return _0x393216;});}})[_0x115a('0x23')](respondWithFilteredResult(_0x17f30e,_0x43573e))[_0x115a('0x5b')](handleError(_0x17f30e,null));};exports[_0x115a('0x7e')]=function(_0x3f9450,_0x385306){var _0x5dce7a=_0x3f9450[_0x115a('0x68')]['id'];var _0x686ed7=_0x3f9450[_0x115a('0x67')];var _0x2ead86=0xc8;var _0x1fc3aa=null;return db[_0x115a('0x7f')]['transaction']({'isolationLevel':db[_0x115a('0x7f')][_0x115a('0x80')][_0x115a('0x81')][_0x115a('0x82')]},function(_0x5671eb){return db[_0x115a('0x58')][_0x115a('0x6c')]({'where':{'id':_0x5dce7a},'transaction':_0x5671eb})['then'](function(_0x173aa4){if(_0x173aa4){return db[_0x115a('0x83')][_0x115a('0x38')]({'where':{'FaxAccountId':_0x5dce7a},'transaction':_0x5671eb})[_0x115a('0x23')](function(){var _0x22974d=_[_0x115a('0x41')](_0x686ed7,function(_0x2472af){_0x2472af[_0x115a('0x6a')]=_0x5dce7a;return _0x2472af;});return db[_0x115a('0x83')]['bulkCreate'](_0x22974d,{'transaction':_0x5671eb});});}else{_0x2ead86=0x194;_0x1fc3aa=[];}});})[_0x115a('0x23')](function(){if(_0x2ead86!==0x194){return db[_0x115a('0x83')][_0x115a('0x84')]({'where':{'FaxAccountId':_0x5dce7a},'order':_0x115a('0x85')})['then'](function(_0x3605fc){_0x1fc3aa=_0x3605fc;});}})[_0x115a('0x5b')](function(_0x3a8cf2){_0x2ead86=0x1f4;logger[_0x115a('0x29')](_0x3a8cf2['stack']);if(_0x3a8cf2[_0x115a('0x3d')]){delete _0x3a8cf2[_0x115a('0x3d')];}_0x1fc3aa=_0x3a8cf2;})[_0x115a('0x86')](function(){if(_0x1fc3aa===null){_0x385306[_0x115a('0x2d')](_0x2ead86);}else{if(_0x2ead86===0x1f4){_0x385306[_0x115a('0x2e')](_0x2ead86)[_0x115a('0x3e')](_0x1fc3aa);}else{_0x385306[_0x115a('0x2e')](_0x2ead86)[_0x115a('0x33')](_0x1fc3aa);}}});};exports[_0x115a('0x87')]=function(_0x3c2bea,_0x4a78fa,_0x4a74b6){var _0x39150f={};var _0x2f165d={};var _0x25a44c;var _0x529eae;return db['FaxAccount'][_0x115a('0x6c')]({'where':{'id':_0x3c2bea['params']['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x4a78fa,null))[_0x115a('0x23')](function(_0x269a0f){if(_0x269a0f){_0x25a44c=_0x269a0f;_0x2f165d['model']=_[_0x115a('0x47')](db['FaxApplication'][_0x115a('0x42')]);_0x2f165d[_0x115a('0x48')]=_[_0x115a('0x47')](_0x3c2bea[_0x115a('0x48')]);_0x2f165d['filters']=_[_0x115a('0x4a')](_0x2f165d['model'],_0x2f165d[_0x115a('0x48')]);_0x39150f['attributes']=_[_0x115a('0x4a')](_0x2f165d['model'],qs[_0x115a('0x4c')](_0x3c2bea[_0x115a('0x48')][_0x115a('0x4c')]));_0x39150f[_0x115a('0x4b')]=_0x39150f[_0x115a('0x4b')]['length']?_0x39150f[_0x115a('0x4b')]:_0x2f165d['model'];_0x39150f[_0x115a('0x4f')]=qs['sort'](_0x3c2bea[_0x115a('0x48')][_0x115a('0x50')]);_0x39150f[_0x115a('0x51')]=qs[_0x115a('0x49')](_[_0x115a('0x52')](_0x3c2bea['query'],_0x2f165d[_0x115a('0x49')]));if(_0x3c2bea[_0x115a('0x48')][_0x115a('0x6e')]){_0x39150f[_0x115a('0x51')]=_[_0x115a('0x53')](_0x39150f[_0x115a('0x51')],{'$or':_['map'](_0x39150f[_0x115a('0x4b')],function(_0x16f9e6){var _0x484014={};_0x484014[_0x16f9e6]={'$like':'%'+_0x3c2bea[_0x115a('0x48')][_0x115a('0x6e')]+'%'};return _0x484014;})});}_0x39150f=_[_0x115a('0x53')]({},_0x39150f,_0x3c2bea['options']);return _0x25a44c[_0x115a('0x87')](_0x39150f);}})[_0x115a('0x23')](function(_0x4bcb25){if(_0x4bcb25){_0x529eae=_0x4bcb25[_0x115a('0x4d')];if(!_0x3c2bea['query'][_0x115a('0x73')]('nolimit')){_0x39150f[_0x115a('0x31')]=qs[_0x115a('0x31')](_0x3c2bea[_0x115a('0x48')]['limit']);_0x39150f[_0x115a('0x2f')]=qs[_0x115a('0x2f')](_0x3c2bea['query']['offset']);}return _0x25a44c['getApplications'](_0x39150f);}})[_0x115a('0x23')](function(_0x1bc490){if(_0x1bc490){return _0x1bc490?{'count':_0x529eae,'rows':_0x1bc490}:null;}})[_0x115a('0x23')](respondWithResult(_0x4a78fa,null))[_0x115a('0x5b')](handleError(_0x4a78fa,null));};function Extension(_0x288a7f,_0x1d4b8c,_0x72926b,_0x328e7d){this['context']=_0x115a('0x88');this[_0x115a('0x89')]=_0x288a7f[_0x115a('0x8a')];this[_0x115a('0x8b')]=_0x328e7d;this[_0x115a('0x44')]=_0x115a('0x8c');this[_0x115a('0x8d')]=_0x115a('0x8e');this[_0x115a('0x6a')]=_0x288a7f['id'];this[_0x115a('0x85')]=_0x1d4b8c;this[_0x115a('0x8f')]=_0x72926b;}function createExtensionsReciveFax(_0xd59c15){var _0xc0743e=0x1;var _0x2c532f=[];_0x2c532f[_0x115a('0x90')](new Extension(_0xd59c15,_0xc0743e,'',_0x115a('0x91')));_0xc0743e+=0x1;_0x2c532f[_0x115a('0x90')](new Extension(_0xd59c15,_0xc0743e,_0x115a('0x92'),_0x115a('0x93')));_0xc0743e+=0x1;for(var _0x1e4c2b in _0xd59c15){if(_0xd59c15[_0x115a('0x73')](_0x1e4c2b)&&(_0x1e4c2b===_0x115a('0x94')||_0x1e4c2b===_0x115a('0x8a')||_0x1e4c2b==='gateway'||_0x1e4c2b===_0x115a('0x95')||_0x1e4c2b==='headerinfo'||_0x1e4c2b===_0x115a('0x96')||_0x1e4c2b===_0x115a('0x97')||_0x1e4c2b===_0x115a('0x98')||_0x1e4c2b===_0x115a('0x99'))){_0x2c532f[_0x115a('0x90')](new Extension(_0xd59c15,_0xc0743e,_0x115a('0x9a')+_0x1e4c2b+')='+_0xd59c15[_0x1e4c2b],_0x115a('0x93')));_0xc0743e+=0x1;}}_0x2c532f[_0x115a('0x90')](new Extension(_0xd59c15,_0xc0743e,'6',_0x115a('0x9b')));_0xc0743e+=0x1;_0x2c532f[_0x115a('0x90')](new Extension(_0xd59c15,_0xc0743e,'/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',_0x115a('0x9c')));_0xc0743e=0x0;return _0x2c532f;}exports['addAccountApplications']=function(_0x3d0be1,_0x1d7ee8,_0x6a0fa5){var _0x248474;return db[_0x115a('0x7f')][_0x115a('0x9d')](function(_0x2b49c3){return db[_0x115a('0x58')][_0x115a('0x5e')](_0x3d0be1[_0x115a('0x67')],{'transaction':_0x2b49c3})[_0x115a('0x23')](function(_0x124474){_0x248474=_0x124474[_0x115a('0x39')]({'plain':!![]});return db['VoiceExtension'][_0x115a('0x9e')](createExtensionsReciveFax(_0x248474),{'transaction':_0x2b49c3});});})[_0x115a('0x23')](function(){return _0x248474;})['then'](respondWithResult(_0x1d7ee8,null))[_0x115a('0x5b')](handleError(_0x1d7ee8,null));};exports[_0x115a('0x9f')]=function(_0x3e6ddf,_0x29524d,_0x20d9f6){var _0x50bfdf;return db[_0x115a('0x7f')][_0x115a('0x9d')](function(_0x3b2a0a){return db[_0x115a('0x58')][_0x115a('0x37')](_0x3e6ddf[_0x115a('0x67')],{'where':{'id':_0x3e6ddf[_0x115a('0x67')]['id']},'transaction':_0x3b2a0a})[_0x115a('0x23')](function(_0xddcf9c){return db[_0x115a('0xa0')][_0x115a('0x38')]({'where':{'FaxAccountId':_0x3e6ddf[_0x115a('0x67')]['id']},'transaction':_0x3b2a0a})[_0x115a('0x23')](function(_0x1fa935){return db[_0x115a('0xa0')][_0x115a('0x9e')](createExtensionsReciveFax(_[_0x115a('0x77')](_0x3e6ddf['body'],[_0x115a('0xa1'),_0x115a('0x45'),_0x115a('0xa2'),'updatedAt',_0x115a('0xa3'),'ListId'])),{'transaction':_0x3b2a0a});});});})[_0x115a('0x23')](function(){return db['FaxAccount'][_0x115a('0xa4')](_0x3e6ddf[_0x115a('0x67')]['id']);})['then'](respondWithResult(_0x29524d,null))['catch'](handleError(_0x29524d,null));};exports[_0x115a('0xa5')]=function(_0x2b15c4,_0xd26041,_0x2b5ca8){var _0x5937c4={'raw':!![],'where':{}};var _0x1722ae={};var _0x2b3fa4={'count':0x0,'rows':[]};return db[_0x115a('0x58')][_0x115a('0x6c')]({'where':{'id':_0x2b15c4[_0x115a('0x68')]['id']}})[_0x115a('0x23')](handleEntityNotFound(_0xd26041,null))[_0x115a('0x23')](function(_0x1e212d){if(_0x1e212d){_0x1722ae[_0x115a('0x46')]=_[_0x115a('0x47')](db[_0x115a('0xa6')][_0x115a('0x42')]);_0x1722ae[_0x115a('0x48')]=_[_0x115a('0x47')](_0x2b15c4[_0x115a('0x48')]);_0x1722ae['filters']=_[_0x115a('0x4a')](_0x1722ae[_0x115a('0x46')],_0x1722ae[_0x115a('0x48')]);_0x5937c4['attributes']=_[_0x115a('0x4a')](_0x1722ae[_0x115a('0x46')],qs[_0x115a('0x4c')](_0x2b15c4[_0x115a('0x48')][_0x115a('0x4c')]));_0x5937c4[_0x115a('0x4b')]=_0x5937c4[_0x115a('0x4b')][_0x115a('0x4d')]?_0x5937c4[_0x115a('0x4b')]:_0x1722ae[_0x115a('0x46')];if(!_0x2b15c4[_0x115a('0x48')][_0x115a('0x73')]('nolimit')){_0x5937c4[_0x115a('0x31')]=qs[_0x115a('0x31')](_0x2b15c4[_0x115a('0x48')][_0x115a('0x31')]);_0x5937c4[_0x115a('0x2f')]=qs[_0x115a('0x2f')](_0x2b15c4[_0x115a('0x48')][_0x115a('0x2f')]);}_0x5937c4[_0x115a('0x4f')]=qs[_0x115a('0x50')](_0x2b15c4[_0x115a('0x48')][_0x115a('0x50')]);_0x5937c4['where']=qs[_0x115a('0x49')](_[_0x115a('0x52')](_0x2b15c4[_0x115a('0x48')],_0x1722ae[_0x115a('0x49')]));_0x5937c4[_0x115a('0x51')][_0x115a('0x6a')]=_0x1e212d['id'];if(_0x2b15c4['query'][_0x115a('0x6e')]){_0x5937c4[_0x115a('0x51')]=_[_0x115a('0x53')](_0x5937c4[_0x115a('0x51')],{'$or':_[_0x115a('0x41')](_0x5937c4[_0x115a('0x4b')],function(_0x385058){var _0x2d80d6={};_0x2d80d6[_0x385058]={'$like':'%'+_0x2b15c4['query']['filter']+'%'};return _0x2d80d6;})});}if(_0x2b15c4[_0x115a('0x48')][_0x115a('0xa7')]){var _0x3759ab=_0x2b15c4[_0x115a('0x48')]['$gte'][_0x115a('0xa8')](',');var _0x2c2841={};_0x2c2841[_0x3759ab[0x0]]={'$gte':moment(_0x3759ab[0x1])[_0x115a('0xa9')](_0x115a('0xaa'))};_0x5937c4['where']=_['merge'](_0x5937c4[_0x115a('0x51')],_0x2c2841);}_0x5937c4=_[_0x115a('0x53')]({},_0x5937c4,_0x2b15c4[_0x115a('0x54')]);return db[_0x115a('0xa6')]['count']({'where':_0x5937c4[_0x115a('0x51')]})['then'](function(_0xf845f2){_0x2b3fa4[_0x115a('0x55')]=_0xf845f2;if(_0x2b15c4[_0x115a('0x48')][_0x115a('0x56')]){_0x5937c4[_0x115a('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x115a('0x59')](_0x5937c4);})[_0x115a('0x23')](function(_0x5873ee){_0x2b3fa4[_0x115a('0x5a')]=_0x5873ee;return _0x2b3fa4;});}})['then'](respondWithFilteredResult(_0xd26041,_0x5937c4))[_0x115a('0x5b')](handleError(_0xd26041,null));};exports[_0x115a('0x3e')]=function(_0x531dab,_0x5d88bf,_0x2efc86){var _0xab3f50,_0x108aa5={},_0x190188;if(_0x531dab[_0x115a('0x67')]['to']){_0x190188=_0x531dab['body']['to'][0x0];}return db[_0x115a('0x58')][_0x115a('0x62')]({'where':{'id':_0x531dab[_0x115a('0x68')]['id']},'include':[{'model':db[_0x115a('0xab')],'as':_0x115a('0xac'),'include':[{'model':db[_0x115a('0x78')],'as':_0x115a('0xad'),'where':{'fax':_0x190188},'limit':0x1,'order':[[_0x115a('0xae'),_0x115a('0xaf')]]}]}]})['then'](handleEntityNotFound(_0x5d88bf,null))['then'](function(_0x5a8adf){_0xab3f50=_0x5a8adf;if(_0x531dab[_0x115a('0x67')][_0x115a('0xb0')]&&_0x531dab[_0x115a('0x67')][_0x115a('0xb0')]['length']){for(var _0x25aae5=0x0;_0x25aae5<_0x531dab[_0x115a('0x67')]['attachments'][_0x115a('0x4d')];_0x25aae5+=0x1){_0x531dab[_0x115a('0x67')]['attachments'][_0x25aae5]={'filename':_0x531dab[_0x115a('0x67')]['attachments'][_0x25aae5]['name'],'id':_0x531dab[_0x115a('0x67')]['attachments'][_0x25aae5]['id'],'path':path[_0x115a('0xb1')](config['root'],_0x115a('0xb2'),_0x531dab['body'][_0x115a('0xb0')][_0x25aae5]['basename'])};}}return respondWithRpcPromise(_0x115a('0xb3'),_0x115a('0xb3'),{'FaxAccountId':_[_0x115a('0xb4')](_0x531dab[_0x115a('0x68')]['id'])?undefined:_0x531dab[_0x115a('0x68')]['id'],'path':_[_0x115a('0xb4')](_0x531dab[_0x115a('0x67')][_0x115a('0xb0')][0x0][_0x115a('0x6')])?undefined:_0x531dab[_0x115a('0x67')]['attachments'][0x0][_0x115a('0x6')],'fax':_['isNil'](_0x531dab[_0x115a('0x67')]['to'][0x0])?undefined:_0x531dab[_0x115a('0x67')]['to'][0x0]},client9002);})[_0x115a('0x23')](function(){if(_0xab3f50){if(_['isNil'](_0x531dab['body'][_0x115a('0xb5')])){_0x531dab[_0x115a('0x67')][_0x115a('0xb5')]=util[_0x115a('0xa9')](_0x115a('0xb6'),_0xab3f50[_0x115a('0x3d')],_0xab3f50[_0x115a('0xb7')]);}if(_0xab3f50['List']){if(_0xab3f50['List'][_0x115a('0xad')][_0x115a('0x4d')]){return _0xab3f50[_0x115a('0xac')][_0x115a('0xad')][0x0];}else{return db[_0x115a('0x78')][_0x115a('0x5e')](_['defaults'](_0x531dab[_0x115a('0x67')],{'firstName':_0x531dab[_0x115a('0x67')]['to'][0x0],'phone':_0x531dab[_0x115a('0x67')]['to'][0x0],'fax':_0x531dab[_0x115a('0x67')]['to'][0x0],'ListId':_0xab3f50[_0x115a('0xb8')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x115a('0xb9'));}})[_0x115a('0x23')](function(_0x51710c){if(_0x51710c){return db[_0x115a('0x76')][_0x115a('0x62')]({'where':{'ContactId':_0x51710c['id'],'closed':![],'FaxAccountId':_0xab3f50['id']}})['then'](function(_0xad1aaa){if(_0xad1aaa){return[_0xad1aaa,![]];}return db[_0x115a('0x76')][_0x115a('0x5e')]({'UserId':_0x531dab[_0x115a('0x5f')]['id'],'ContactId':_0x51710c['id'],'FaxAccountId':_0xab3f50['id'],'fax':_0x531dab[_0x115a('0x67')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x115a('0x53')](_0x531dab['body'],{'read':![],'body':_0x531dab['body']['attachments'][0x0]['filename'],'FaxAccountId':_0xab3f50['id'],'UserId':_0x531dab['user']['id'],'ContactId':_0x51710c['id'],'AttachmentId':_0x531dab[_0x115a('0x67')][_0x115a('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0x115a('0xa6')],'as':'Messages'}]})[_0x115a('0x23')](function(_0x3b55d0){return[_0x3b55d0,!![]];});});}else{throw new Error(_0x115a('0xba'));}})['spread'](function(_0x4a4517,_0x5d315c){if(_0x5d315c){return _0x4a4517;}return db[_0x115a('0xa6')][_0x115a('0x5e')]({'direction':_0x115a('0xbb'),'read':![],'body':_0x531dab[_0x115a('0x67')][_0x115a('0xb0')][0x0][_0x115a('0xbc')],'FaxAccountId':_0xab3f50['id'],'FaxInteractionId':_0x4a4517['id'],'UserId':_0x531dab[_0x115a('0x5f')]['id'],'ContactId':_0x4a4517[_0x115a('0xbd')],'AttachmentId':_0x531dab['body'][_0x115a('0xb0')][0x0]['id']})[_0x115a('0x23')](function(_0x3fd91a){_0x4a4517[_0x115a('0xbe')]['Messages']=[];_0x4a4517[_0x115a('0xbe')]['Messages']['push'](_0x3fd91a[_0x115a('0xbe')]);return _0x4a4517;});})[_0x115a('0x23')](function(_0x4a7e8b){respondWithRpcPromise('SendFax',_0x115a('0xbf'),{'FaxAccountId':_[_0x115a('0xb4')](_0x531dab['params']['id'])?undefined:_0x531dab['params']['id'],'path':_['isNil'](_0x531dab[_0x115a('0x67')][_0x115a('0xb0')][0x0][_0x115a('0x6')])?undefined:_0x531dab[_0x115a('0x67')][_0x115a('0xb0')][0x0][_0x115a('0x6')],'fax':_['isNil'](_0x531dab['body']['to'][0x0])?undefined:_0x531dab[_0x115a('0x67')]['to'][0x0],'AttachmentId':_0x531dab['body'][_0x115a('0xb0')][0x0]['id']},client9002)[_0x115a('0x23')](function(_0x44180d){logger[_0x115a('0x24')](_0x115a('0xc0'),_0x44180d);})['catch'](function(_0x39db3b){logger['info']('SendFaxRpc,\x20%s',_0x39db3b);});return _0x4a7e8b;})[_0x115a('0x23')](respondWithResult(_0x5d88bf,null))[_0x115a('0x5b')](handleError(_0x5d88bf,null));};exports['addAgents']=function(_0x3eba94,_0x26c2ef,_0x3dd132){return db[_0x115a('0x58')]['find']({'where':{'id':_0x3eba94[_0x115a('0x68')]['id']}})['then'](handleEntityNotFound(_0x26c2ef,null))[_0x115a('0x23')](function(_0x44accc){if(_0x44accc){return _0x44accc[_0x115a('0xc1')](_0x3eba94[_0x115a('0x67')]['ids'],_[_0x115a('0x77')](_0x3eba94[_0x115a('0x67')],[_0x115a('0x70'),'id'])||{})[_0x115a('0xc2')](function(_0x215ae2){for(var _0x3c1fd4=0x0;_0x3c1fd4<_0x3eba94[_0x115a('0x67')]['ids'][_0x115a('0x4d')];_0x3c1fd4+=0x1){socket[_0x115a('0xc3')]('userFaxAccount:save',{'UserId':Number(_0x3eba94[_0x115a('0x67')][_0x115a('0x70')][_0x3c1fd4]),'FaxAccountId':Number(_0x3eba94['params']['id'])});}return _0x215ae2;});}})[_0x115a('0x23')](respondWithResult(_0x26c2ef,null))[_0x115a('0x5b')](handleError(_0x26c2ef,null));};exports[_0x115a('0xc4')]=function(_0x48008e,_0x4ba998,_0x3a6825){return db[_0x115a('0x58')][_0x115a('0x62')]({'where':{'id':_0x48008e['params']['id']}})[_0x115a('0x23')](handleEntityNotFound(_0x4ba998,null))[_0x115a('0x23')](function(_0x24af0a){if(_0x24af0a){return _0x24af0a[_0x115a('0xc4')](_0x48008e[_0x115a('0x48')][_0x115a('0x70')])['then'](function(){if(_[_0x115a('0xc5')](_0x48008e['query'][_0x115a('0x70')])){for(var _0x38f6b9=0x0;_0x38f6b9<_0x48008e[_0x115a('0x48')][_0x115a('0x70')]['length'];_0x38f6b9+=0x1){socket['emit'](_0x115a('0xc6'),{'UserId':Number(_0x48008e[_0x115a('0x48')][_0x115a('0x70')][_0x38f6b9]),'FaxAccountId':Number(_0x48008e[_0x115a('0x68')]['id'])});}}else{socket[_0x115a('0xc3')](_0x115a('0xc6'),{'UserId':Number(_0x48008e[_0x115a('0x48')]['ids']),'FaxAccountId':Number(_0x48008e[_0x115a('0x68')]['id'])});}});}})[_0x115a('0x23')](respondWithStatusCode(_0x4ba998,null))[_0x115a('0x5b')](handleError(_0x4ba998,null));};exports[_0x115a('0xc7')]=function(_0x3e8f5f,_0x561617,_0x1788b6){var _0x287f83={};var _0x265ea3={};var _0x5357a2;var _0x42240e;return db[_0x115a('0x58')][_0x115a('0x6c')]({'where':{'id':_0x3e8f5f[_0x115a('0x68')]['id']}})['then'](handleEntityNotFound(_0x561617,null))[_0x115a('0x23')](function(_0x3f0028){if(_0x3f0028){_0x5357a2=_0x3f0028;_0x265ea3[_0x115a('0x46')]=_[_0x115a('0x47')](db[_0x115a('0xc8')][_0x115a('0x42')]);_0x265ea3[_0x115a('0x48')]=_[_0x115a('0x47')](_0x3e8f5f['query']);_0x265ea3[_0x115a('0x49')]=_[_0x115a('0x4a')](_0x265ea3[_0x115a('0x46')],_0x265ea3[_0x115a('0x48')]);_0x287f83[_0x115a('0x4b')]=_['intersection'](_0x265ea3['model'],qs['fields'](_0x3e8f5f[_0x115a('0x48')][_0x115a('0x4c')]));_0x287f83[_0x115a('0x4b')]=_0x287f83[_0x115a('0x4b')][_0x115a('0x4d')]?_0x287f83[_0x115a('0x4b')]:_0x265ea3['model'];_0x287f83[_0x115a('0x4f')]=qs[_0x115a('0x50')](_0x3e8f5f[_0x115a('0x48')]['sort']);_0x287f83[_0x115a('0x51')]=qs[_0x115a('0x49')](_[_0x115a('0x52')](_0x3e8f5f[_0x115a('0x48')],_0x265ea3[_0x115a('0x49')]));if(_0x3e8f5f[_0x115a('0x48')][_0x115a('0x6e')]){_0x287f83[_0x115a('0x51')]=_[_0x115a('0x53')](_0x287f83[_0x115a('0x51')],{'$or':_[_0x115a('0x41')](_0x287f83[_0x115a('0x4b')],function(_0x146953){var _0x1ad5c7={};_0x1ad5c7[_0x146953]={'$like':'%'+_0x3e8f5f[_0x115a('0x48')]['filter']+'%'};return _0x1ad5c7;})});}_0x287f83=_['merge']({},_0x287f83,_0x3e8f5f['options']);return _0x5357a2[_0x115a('0xc7')](_0x287f83);}})[_0x115a('0x23')](function(_0x13d630){if(_0x13d630){_0x42240e=_0x13d630[_0x115a('0x4d')];if(!_0x3e8f5f[_0x115a('0x48')][_0x115a('0x73')](_0x115a('0x4e'))){_0x287f83[_0x115a('0x31')]=qs[_0x115a('0x31')](_0x3e8f5f['query'][_0x115a('0x31')]);_0x287f83['offset']=qs[_0x115a('0x2f')](_0x3e8f5f['query'][_0x115a('0x2f')]);}return _0x5357a2[_0x115a('0xc7')](_0x287f83);}})[_0x115a('0x23')](function(_0x9aa486){if(_0x9aa486){return _0x9aa486?{'count':_0x42240e,'rows':_0x9aa486}:null;}})[_0x115a('0x23')](respondWithResult(_0x561617,null))['catch'](handleError(_0x561617,null));}; \ No newline at end of file +var _0xe2ec=['fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','intersection','find','catch','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','findAll','removeAnswers','addInteraction','FaxInteraction','omit','User','Owner','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','sendStatus','getApplications','context','from-voip-provider','exten','description','Fax\x20Extension','push','Answer','ecm','localstationid','faxdetect','minrate','modem','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','format','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','offset','undefined','count','limit','status','set','json','apply','reject','update','destroy','get','FaxAccounts','end','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','query','keys','filters','model','attributes'];(function(_0x2db45e,_0x3c3b37){var _0x200a5=function(_0x2a9fb2){while(--_0x2a9fb2){_0x2db45e['push'](_0x2db45e['shift']());}};_0x200a5(++_0x3c3b37);}(_0xe2ec,0x1f0));var _0xce2e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe2ec[_0x24237f];return _0x48298e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce2e('0x0'));var zipdir=require(_0xce2e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce2e('0x2'));var BPromise=require(_0xce2e('0x3'));var Mustache=require(_0xce2e('0x4'));var util=require(_0xce2e('0x5'));var path=require(_0xce2e('0x6'));var sox=require(_0xce2e('0x7'));var csv=require(_0xce2e('0x8'));var ejs=require(_0xce2e('0x9'));var fs=require('fs');var fs_extra=require(_0xce2e('0xa'));var _=require(_0xce2e('0xb'));var squel=require(_0xce2e('0xc'));var crypto=require(_0xce2e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xce2e('0xe'));var toCsv=require(_0xce2e('0x8'));var querystring=require(_0xce2e('0xf'));var Papa=require('papaparse');var Redis=require(_0xce2e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xce2e('0x11'));var as=require(_0xce2e('0x12'));var hardwareService=require(_0xce2e('0x13'));var logger=require(_0xce2e('0x14'))(_0xce2e('0x15'));var utils=require('../../config/utils');var config=require(_0xce2e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xce2e('0x17'))['db'];config[_0xce2e('0x18')]=_[_0xce2e('0x19')](config[_0xce2e('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xce2e('0x1a'))(new Redis(config['redis']));require(_0xce2e('0x1b'))[_0xce2e('0x1c')](socket);var jayson=require(_0xce2e('0x1d'));var client=jayson[_0xce2e('0x1e')][_0xce2e('0x1f')]({'port':0x232c});var client9002=jayson[_0xce2e('0x1e')][_0xce2e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x39080a,_0x5938f1,_0x28a69e,_0x1fe66f){return new BPromise(function(_0x151584,_0x4e7bfc){var _0x41efc6=_0x1fe66f||client;return _0x41efc6[_0xce2e('0x20')](_0x39080a,_0x28a69e)[_0xce2e('0x21')](function(_0x2f16c9){logger['info']('FaxAccount,\x20%s,\x20%s',_0x5938f1,_0xce2e('0x22'));logger[_0xce2e('0x23')](_0xce2e('0x24'),_0x5938f1,_0xce2e('0x22'),JSON['stringify'](_0x2f16c9));if(_0x2f16c9[_0xce2e('0x25')]){if(_0x2f16c9[_0xce2e('0x25')][_0xce2e('0x26')]===0x1f4){logger[_0xce2e('0x25')](_0xce2e('0x27'),_0x5938f1,_0x2f16c9[_0xce2e('0x25')][_0xce2e('0x28')]);return _0x4e7bfc(_0x2f16c9[_0xce2e('0x25')][_0xce2e('0x28')]);}logger['error'](_0xce2e('0x27'),_0x5938f1,_0x2f16c9['error'][_0xce2e('0x28')]);return _0x151584(_0x2f16c9['error'][_0xce2e('0x28')]);}else{logger[_0xce2e('0x29')]('FaxAccount,\x20%s,\x20%s',_0x5938f1,_0xce2e('0x22'));_0x151584(_0x2f16c9[_0xce2e('0x2a')][_0xce2e('0x28')]);}})['catch'](function(_0x205298){logger[_0xce2e('0x25')](_0xce2e('0x27'),_0x5938f1,_0x205298);_0x4e7bfc(_0x205298);});});}function respondWithStatusCode(_0x67a2f0,_0x3e4594){_0x3e4594=_0x3e4594||0xcc;return function(_0x413e71){if(_0x413e71){return _0x67a2f0['sendStatus'](_0x3e4594);}return _0x67a2f0['status'](_0x3e4594)['end']();};}function respondWithResult(_0x1ebaea,_0x3a3efb){_0x3a3efb=_0x3a3efb||0xc8;return function(_0x4bdd76){if(_0x4bdd76){return _0x1ebaea['status'](_0x3a3efb)['json'](_0x4bdd76);}};}function respondWithFilteredResult(_0x1295c5,_0x21f9e6){return function(_0x4a0337){if(_0x4a0337){var _0x18aaa3=typeof _0x21f9e6[_0xce2e('0x2b')]===_0xce2e('0x2c')&&typeof _0x21f9e6['limit']===_0xce2e('0x2c');var _0x54bc7f=_0x4a0337[_0xce2e('0x2d')];var _0xd437ae=_0x18aaa3?0x0:_0x21f9e6['offset'];var _0x6eab00=_0x18aaa3?_0x4a0337['count']:_0x21f9e6['offset']+_0x21f9e6[_0xce2e('0x2e')];var _0x43b825;if(_0x6eab00>=_0x54bc7f){_0x6eab00=_0x54bc7f;_0x43b825=0xc8;}else{_0x43b825=0xce;}_0x1295c5[_0xce2e('0x2f')](_0x43b825);return _0x1295c5[_0xce2e('0x30')]('Content-Range',_0xd437ae+'-'+_0x6eab00+'/'+_0x54bc7f)[_0xce2e('0x31')](_0x4a0337);}return null;};}function patchUpdates(_0x16aadf){return function(_0x105613){try{jsonpatch[_0xce2e('0x32')](_0x105613,_0x16aadf,!![]);}catch(_0x192c79){return BPromise[_0xce2e('0x33')](_0x192c79);}return _0x105613['save']();};}function saveUpdates(_0x20a133,_0x14903a){return function(_0x11d6b0){if(_0x11d6b0){return _0x11d6b0[_0xce2e('0x34')](_0x20a133)[_0xce2e('0x21')](function(_0x2f0270){return _0x2f0270;});}return null;};}function removeEntity(_0x38bd46,_0x4f47ac){return function(_0x4b0209){if(_0x4b0209){return _0x4b0209[_0xce2e('0x35')]()[_0xce2e('0x21')](function(){var _0x1a2ae7=_0x4b0209[_0xce2e('0x36')]({'plain':!![]});var _0x12102c=_0xce2e('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x12102c,'resourceId':_0x1a2ae7['id']}})[_0xce2e('0x21')](function(){return _0x4b0209;});})[_0xce2e('0x21')](function(){_0x38bd46[_0xce2e('0x2f')](0xcc)[_0xce2e('0x38')]();});}};}function handleEntityNotFound(_0xe67f68,_0x82d956){return function(_0xfb7853){if(!_0xfb7853){_0xe67f68['sendStatus'](0x194);}return _0xfb7853;};}function handleError(_0x27d809,_0x18cd3c){_0x18cd3c=_0x18cd3c||0x1f4;return function(_0x16353f){logger['error'](_0x16353f[_0xce2e('0x39')]);if(_0x16353f['name']){delete _0x16353f[_0xce2e('0x3a')];}_0x27d809[_0xce2e('0x2f')](_0x18cd3c)[_0xce2e('0x3b')](_0x16353f);};}exports['index']=function(_0x46c31a,_0x4139f2){var _0x2fea44={'include':[{'model':db[_0xce2e('0x3c')],'as':_0xce2e('0x3d')}]},_0x278918={},_0x2d2763={'count':0x0,'rows':[]};var _0xa2f8a3=_[_0xce2e('0x3e')](db[_0xce2e('0x3f')][_0xce2e('0x40')],function(_0x1b57dd){return{'name':_0x1b57dd[_0xce2e('0x41')],'type':_0x1b57dd['type']['key']};});_0x278918['model']=_[_0xce2e('0x3e')](_0xa2f8a3,'name');_0x278918[_0xce2e('0x42')]=_[_0xce2e('0x43')](_0x46c31a[_0xce2e('0x42')]);_0x278918[_0xce2e('0x44')]=_['intersection'](_0x278918[_0xce2e('0x45')],_0x278918['query']);_0x2fea44[_0xce2e('0x46')]=_['intersection'](_0x278918['model'],qs['fields'](_0x46c31a[_0xce2e('0x42')][_0xce2e('0x47')]));_0x2fea44[_0xce2e('0x46')]=_0x2fea44[_0xce2e('0x46')][_0xce2e('0x48')]?_0x2fea44[_0xce2e('0x46')]:_0x278918[_0xce2e('0x45')];if(!_0x46c31a[_0xce2e('0x42')][_0xce2e('0x49')]('nolimit')){_0x2fea44[_0xce2e('0x2e')]=qs[_0xce2e('0x2e')](_0x46c31a['query'][_0xce2e('0x2e')]);_0x2fea44[_0xce2e('0x2b')]=qs['offset'](_0x46c31a[_0xce2e('0x42')]['offset']);}_0x2fea44['order']=qs[_0xce2e('0x4a')](_0x46c31a[_0xce2e('0x42')][_0xce2e('0x4a')]);_0x2fea44[_0xce2e('0x4b')]=qs['filters'](_[_0xce2e('0x4c')](_0x46c31a[_0xce2e('0x42')],_0x278918[_0xce2e('0x44')]),_0xa2f8a3);if(_0x46c31a[_0xce2e('0x42')]['filter']){_0x2fea44[_0xce2e('0x4b')]=_[_0xce2e('0x4d')](_0x2fea44[_0xce2e('0x4b')],{'$or':_[_0xce2e('0x3e')](_0xa2f8a3,function(_0x2329b1){if(_0x2329b1[_0xce2e('0x4e')]!==_0xce2e('0x4f')){var _0x3b28dc={};_0x3b28dc[_0x2329b1['name']]={'$like':'%'+_0x46c31a['query'][_0xce2e('0x50')]+'%'};return _0x3b28dc;}})});}_0x2fea44=_[_0xce2e('0x4d')]({},_0x2fea44,_0x46c31a[_0xce2e('0x51')]);var _0x5082de={'where':_0x2fea44[_0xce2e('0x4b')]};return db['FaxAccount'][_0xce2e('0x2d')](_0x5082de)[_0xce2e('0x21')](function(_0x3b2176){_0x2d2763[_0xce2e('0x2d')]=_0x3b2176;if(_0x46c31a[_0xce2e('0x42')][_0xce2e('0x52')]){_0x2fea44[_0xce2e('0x53')]=[{'all':!![]}];}return db[_0xce2e('0x3f')]['findAll'](_0x2fea44);})[_0xce2e('0x21')](function(_0x5d21bf){_0x2d2763[_0xce2e('0x54')]=_0x5d21bf;return _0x2d2763;})[_0xce2e('0x21')](respondWithFilteredResult(_0x4139f2,_0x2fea44))['catch'](handleError(_0x4139f2,null));};exports[_0xce2e('0x55')]=function(_0x50196d,_0x105ab5){var _0xd860a5={'raw':![],'where':{'id':_0x50196d[_0xce2e('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xce2e('0x3d')}]},_0x570d98={};_0x570d98['model']=_['keys'](db[_0xce2e('0x3f')][_0xce2e('0x40')]);_0x570d98[_0xce2e('0x42')]=_[_0xce2e('0x43')](_0x50196d['query']);_0x570d98[_0xce2e('0x44')]=_[_0xce2e('0x57')](_0x570d98['model'],_0x570d98[_0xce2e('0x42')]);_0xd860a5[_0xce2e('0x46')]=_['intersection'](_0x570d98[_0xce2e('0x45')],qs[_0xce2e('0x47')](_0x50196d[_0xce2e('0x42')][_0xce2e('0x47')]));_0xd860a5[_0xce2e('0x46')]=_0xd860a5['attributes']['length']?_0xd860a5[_0xce2e('0x46')]:_0x570d98[_0xce2e('0x45')];if(_0x50196d['query'][_0xce2e('0x52')]){_0xd860a5[_0xce2e('0x53')]=[{'all':!![]}];}_0xd860a5=_[_0xce2e('0x4d')]({},_0xd860a5,_0x50196d[_0xce2e('0x51')]);return db[_0xce2e('0x3f')][_0xce2e('0x58')](_0xd860a5)[_0xce2e('0x21')](handleEntityNotFound(_0x105ab5,null))[_0xce2e('0x21')](respondWithResult(_0x105ab5,null))[_0xce2e('0x59')](handleError(_0x105ab5,null));};exports[_0xce2e('0x5a')]=function(_0x53bd14,_0x392a15){return db['FaxAccount'][_0xce2e('0x5a')](_0x53bd14[_0xce2e('0x5b')],{})[_0xce2e('0x21')](function(_0x34b850){var _0x2e6919=_0x53bd14[_0xce2e('0x5c')]['get']({'plain':!![]});if(!_0x2e6919)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e6919[_0xce2e('0x5d')]===_0xce2e('0x5c')){var _0x344bcc=_0x34b850[_0xce2e('0x36')]({'plain':!![]});var _0x509154=_0xce2e('0x37');return db[_0xce2e('0x5e')]['find']({'where':{'name':_0x509154,'userProfileId':_0x2e6919[_0xce2e('0x5f')]},'raw':!![]})[_0xce2e('0x21')](function(_0xa5f4eb){if(_0xa5f4eb&&_0xa5f4eb['autoAssociation']===0x0){return db[_0xce2e('0x60')][_0xce2e('0x5a')]({'name':_0x344bcc['name'],'resourceId':_0x344bcc['id'],'type':_0xa5f4eb[_0xce2e('0x3a')],'sectionId':_0xa5f4eb['id']},{})[_0xce2e('0x21')](function(){return _0x34b850;});}else{return _0x34b850;}})[_0xce2e('0x59')](function(_0x20d34e){logger[_0xce2e('0x25')](_0xce2e('0x61'),_0x20d34e);throw _0x20d34e;});}return _0x34b850;})[_0xce2e('0x21')](respondWithResult(_0x392a15,0xc9))[_0xce2e('0x59')](handleError(_0x392a15,null));};exports[_0xce2e('0x34')]=function(_0x4c2112,_0x304990){if(_0x4c2112[_0xce2e('0x5b')]['id']){delete _0x4c2112[_0xce2e('0x5b')]['id'];}return db['FaxAccount'][_0xce2e('0x58')]({'where':{'id':_0x4c2112[_0xce2e('0x56')]['id']},'include':[{'model':db[_0xce2e('0x3c')],'as':_0xce2e('0x3d')}]})[_0xce2e('0x21')](handleEntityNotFound(_0x304990,null))['then'](saveUpdates(_0x4c2112[_0xce2e('0x5b')],null))[_0xce2e('0x21')](respondWithResult(_0x304990,null))[_0xce2e('0x59')](handleError(_0x304990,null));};exports[_0xce2e('0x35')]=function(_0x43eebf,_0x5a3030){return db[_0xce2e('0x3f')][_0xce2e('0x58')]({'where':{'id':_0x43eebf[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x5a3030,null))[_0xce2e('0x21')](removeEntity(_0x5a3030,null))[_0xce2e('0x59')](handleError(_0x5a3030,null));};exports[_0xce2e('0x62')]=function(_0x269a07,_0xd1a222){return db['FaxAccount'][_0xce2e('0x62')]()[_0xce2e('0x21')](respondWithResult(_0xd1a222,null))[_0xce2e('0x59')](handleError(_0xd1a222,null));};exports[_0xce2e('0x63')]=function(_0x72933,_0x5961f6,_0xe5bf66){if(_0x72933[_0xce2e('0x5b')]['id']){delete _0x72933[_0xce2e('0x5b')]['id'];}return db[_0xce2e('0x3f')]['find']({'where':{'id':_0x72933[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x5961f6,null))['then'](function(_0x271ed6){if(_0x271ed6){_0x72933[_0xce2e('0x5b')][_0xce2e('0x64')]=_0x271ed6['id'];return db[_0xce2e('0x65')]['create'](_0x72933['body']);}})['then'](respondWithResult(_0x5961f6,null))[_0xce2e('0x59')](handleError(_0x5961f6,null));};exports[_0xce2e('0x66')]=function(_0x37c3e4,_0x3d76bf,_0x2b750a){var _0x5e805e={'raw':![],'where':{}};var _0x54694f={};var _0x1adcce={'count':0x0,'rows':[]};return db[_0xce2e('0x3f')]['findOne']({'where':{'id':_0x37c3e4[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x3d76bf,null))['then'](function(_0xb1db1f){if(_0xb1db1f){_0x54694f['model']=_['keys'](db['Disposition'][_0xce2e('0x40')]);_0x54694f['query']=_['keys'](_0x37c3e4[_0xce2e('0x42')]);_0x54694f[_0xce2e('0x44')]=_[_0xce2e('0x57')](_0x54694f[_0xce2e('0x45')],_0x54694f[_0xce2e('0x42')]);_0x5e805e[_0xce2e('0x46')]=_[_0xce2e('0x57')](_0x54694f[_0xce2e('0x45')],qs[_0xce2e('0x47')](_0x37c3e4['query'][_0xce2e('0x47')]));_0x5e805e[_0xce2e('0x46')]=_0x5e805e['attributes']['length']?_0x5e805e[_0xce2e('0x46')]:_0x54694f['model'];if(!_0x37c3e4[_0xce2e('0x42')][_0xce2e('0x49')](_0xce2e('0x67'))){_0x5e805e[_0xce2e('0x2e')]=qs[_0xce2e('0x2e')](_0x37c3e4['query'][_0xce2e('0x2e')]);_0x5e805e[_0xce2e('0x2b')]=qs['offset'](_0x37c3e4[_0xce2e('0x42')][_0xce2e('0x2b')]);}_0x5e805e[_0xce2e('0x68')]=qs['sort'](_0x37c3e4[_0xce2e('0x42')][_0xce2e('0x4a')]);_0x5e805e['where']=qs[_0xce2e('0x44')](_[_0xce2e('0x4c')](_0x37c3e4[_0xce2e('0x42')],_0x54694f[_0xce2e('0x44')]));_0x5e805e[_0xce2e('0x4b')][_0xce2e('0x64')]=_0xb1db1f['id'];if(_0x37c3e4[_0xce2e('0x42')][_0xce2e('0x50')]){_0x5e805e[_0xce2e('0x4b')]=_[_0xce2e('0x4d')](_0x5e805e[_0xce2e('0x4b')],{'$or':_['map'](_0x5e805e[_0xce2e('0x46')],function(_0x491ef4){var _0x2a3244={};_0x2a3244[_0x491ef4]={'$like':'%'+_0x37c3e4[_0xce2e('0x42')][_0xce2e('0x50')]+'%'};return _0x2a3244;})});}_0x5e805e=_['merge']({},_0x5e805e,_0x37c3e4[_0xce2e('0x51')]);return db[_0xce2e('0x65')][_0xce2e('0x2d')]({'where':_0x5e805e[_0xce2e('0x4b')]})['then'](function(_0x27a032){_0x1adcce['count']=_0x27a032;if(_0x37c3e4['query'][_0xce2e('0x52')]){_0x5e805e[_0xce2e('0x53')]=[{'all':!![]}];}return db[_0xce2e('0x65')]['findAll'](_0x5e805e);})[_0xce2e('0x21')](function(_0x25a5be){_0x1adcce[_0xce2e('0x54')]=_0x25a5be;return _0x1adcce;});}})[_0xce2e('0x21')](respondWithFilteredResult(_0x3d76bf,_0x5e805e))[_0xce2e('0x59')](handleError(_0x3d76bf,null));};exports[_0xce2e('0x69')]=function(_0x367e52,_0x14b4ef,_0x401783){return db['FaxAccount'][_0xce2e('0x58')]({'where':{'id':_0x367e52[_0xce2e('0x56')]['id']}})['then'](handleEntityNotFound(_0x14b4ef,null))[_0xce2e('0x21')](function(_0x1176be){if(_0x1176be){return _0x1176be[_0xce2e('0x69')](_0x367e52[_0xce2e('0x42')][_0xce2e('0x6a')]);}})[_0xce2e('0x21')](respondWithStatusCode(_0x14b4ef,null))['catch'](handleError(_0x14b4ef,null));};exports[_0xce2e('0x6b')]=function(_0x5fc09a,_0x5145cc,_0x22b501){if(_0x5fc09a[_0xce2e('0x5b')]['id']){delete _0x5fc09a[_0xce2e('0x5b')]['id'];}return db[_0xce2e('0x3f')][_0xce2e('0x58')]({'where':{'id':_0x5fc09a['params']['id']}})['then'](handleEntityNotFound(_0x5145cc,null))['then'](function(_0x5c51c6){if(_0x5c51c6){_0x5fc09a[_0xce2e('0x5b')]['FaxAccountId']=_0x5c51c6['id'];return db[_0xce2e('0x6c')][_0xce2e('0x5a')](_0x5fc09a[_0xce2e('0x5b')]);}})[_0xce2e('0x21')](respondWithResult(_0x5145cc,null))[_0xce2e('0x59')](handleError(_0x5145cc,null));};exports[_0xce2e('0x6d')]=function(_0x13d528,_0x513726,_0x1f1db7){var _0x4fb03e={'raw':![],'where':{}};var _0x607e0f={};var _0x4ead63={'count':0x0,'rows':[]};return db[_0xce2e('0x3f')][_0xce2e('0x6e')]({'where':{'id':_0x13d528['params']['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x513726,null))[_0xce2e('0x21')](function(_0x109af5){if(_0x109af5){_0x607e0f[_0xce2e('0x45')]=_[_0xce2e('0x43')](db[_0xce2e('0x6c')][_0xce2e('0x40')]);_0x607e0f[_0xce2e('0x42')]=_['keys'](_0x13d528[_0xce2e('0x42')]);_0x607e0f[_0xce2e('0x44')]=_[_0xce2e('0x57')](_0x607e0f[_0xce2e('0x45')],_0x607e0f['query']);_0x4fb03e['attributes']=_['intersection'](_0x607e0f['model'],qs[_0xce2e('0x47')](_0x13d528[_0xce2e('0x42')][_0xce2e('0x47')]));_0x4fb03e[_0xce2e('0x46')]=_0x4fb03e[_0xce2e('0x46')][_0xce2e('0x48')]?_0x4fb03e[_0xce2e('0x46')]:_0x607e0f[_0xce2e('0x45')];if(!_0x13d528[_0xce2e('0x42')]['hasOwnProperty'](_0xce2e('0x67'))){_0x4fb03e[_0xce2e('0x2e')]=qs[_0xce2e('0x2e')](_0x13d528[_0xce2e('0x42')]['limit']);_0x4fb03e[_0xce2e('0x2b')]=qs[_0xce2e('0x2b')](_0x13d528[_0xce2e('0x42')]['offset']);}_0x4fb03e[_0xce2e('0x68')]=qs[_0xce2e('0x4a')](_0x13d528['query'][_0xce2e('0x4a')]);_0x4fb03e[_0xce2e('0x4b')]=qs[_0xce2e('0x44')](_[_0xce2e('0x4c')](_0x13d528[_0xce2e('0x42')],_0x607e0f[_0xce2e('0x44')]));_0x4fb03e[_0xce2e('0x4b')]['FaxAccountId']=_0x109af5['id'];if(_0x13d528[_0xce2e('0x42')][_0xce2e('0x50')]){_0x4fb03e[_0xce2e('0x4b')]=_[_0xce2e('0x4d')](_0x4fb03e['where'],{'$or':_[_0xce2e('0x3e')](_0x4fb03e[_0xce2e('0x46')],function(_0x1b9a05){var _0x559cf0={};_0x559cf0[_0x1b9a05]={'$like':'%'+_0x13d528[_0xce2e('0x42')][_0xce2e('0x50')]+'%'};return _0x559cf0;})});}_0x4fb03e=_[_0xce2e('0x4d')]({},_0x4fb03e,_0x13d528['options']);return db[_0xce2e('0x6c')][_0xce2e('0x2d')]({'where':_0x4fb03e[_0xce2e('0x4b')]})[_0xce2e('0x21')](function(_0x546936){_0x4ead63['count']=_0x546936;if(_0x13d528[_0xce2e('0x42')]['includeAll']){_0x4fb03e[_0xce2e('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xce2e('0x6f')](_0x4fb03e);})[_0xce2e('0x21')](function(_0x439334){_0x4ead63[_0xce2e('0x54')]=_0x439334;return _0x4ead63;});}})['then'](respondWithFilteredResult(_0x513726,_0x4fb03e))[_0xce2e('0x59')](handleError(_0x513726,null));};exports[_0xce2e('0x70')]=function(_0xf70abc,_0x32c51a,_0x53958c){return db[_0xce2e('0x3f')][_0xce2e('0x58')]({'where':{'id':_0xf70abc[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x32c51a,null))[_0xce2e('0x21')](function(_0x1904cd){if(_0x1904cd){return _0x1904cd['removeAnswers'](_0xf70abc[_0xce2e('0x42')]['ids']);}})[_0xce2e('0x21')](respondWithStatusCode(_0x32c51a,null))[_0xce2e('0x59')](handleError(_0x32c51a,null));};exports[_0xce2e('0x71')]=function(_0x4130a5,_0x1c22ba,_0x2f3831){return db[_0xce2e('0x72')][_0xce2e('0x58')]({'where':{'id':_0x4130a5['params']['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x1c22ba,null))['then'](function(_0x247636){if(_0x247636){return _0x247636[_0xce2e('0x71')](_0x4130a5[_0xce2e('0x5b')]['ids'],_[_0xce2e('0x73')](_0x4130a5['body'],['ids','id'])||{});}})[_0xce2e('0x21')](respondWithResult(_0x1c22ba,null))['catch'](handleError(_0x1c22ba,null));};exports['getInteractions']=function(_0x5ead86,_0x2251ea,_0x110540){var _0x53872c={'raw':![],'where':{}};var _0x2da6ed={};var _0x5c87da={'count':0x0,'rows':[]};return db[_0xce2e('0x3f')][_0xce2e('0x6e')]({'where':{'id':_0x5ead86[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x2251ea,null))[_0xce2e('0x21')](function(_0x22862d){if(_0x22862d){_0x2da6ed['model']=_[_0xce2e('0x43')](db[_0xce2e('0x72')][_0xce2e('0x40')]);_0x2da6ed['query']=_[_0xce2e('0x43')](_0x5ead86[_0xce2e('0x42')]);_0x2da6ed[_0xce2e('0x44')]=_[_0xce2e('0x57')](_0x2da6ed['model'],_0x2da6ed[_0xce2e('0x42')]);_0x53872c[_0xce2e('0x46')]=_[_0xce2e('0x57')](_0x2da6ed[_0xce2e('0x45')],qs[_0xce2e('0x47')](_0x5ead86['query'][_0xce2e('0x47')]));_0x53872c[_0xce2e('0x46')]=_0x53872c['attributes']['length']?_0x53872c[_0xce2e('0x46')]:_0x2da6ed[_0xce2e('0x45')];if(!_0x5ead86[_0xce2e('0x42')]['hasOwnProperty'](_0xce2e('0x67'))){_0x53872c[_0xce2e('0x2e')]=qs['limit'](_0x5ead86[_0xce2e('0x42')][_0xce2e('0x2e')]);_0x53872c[_0xce2e('0x2b')]=qs[_0xce2e('0x2b')](_0x5ead86[_0xce2e('0x42')][_0xce2e('0x2b')]);}_0x53872c[_0xce2e('0x68')]=qs[_0xce2e('0x4a')](_0x5ead86[_0xce2e('0x42')][_0xce2e('0x4a')]);_0x53872c['where']=qs[_0xce2e('0x44')](_['pick'](_0x5ead86[_0xce2e('0x42')],_0x2da6ed[_0xce2e('0x44')]));_0x53872c[_0xce2e('0x4b')]['FaxAccountId']=_0x22862d['id'];if(_0x5ead86['query']['filter']){_0x53872c[_0xce2e('0x4b')]=_[_0xce2e('0x4d')](_0x53872c[_0xce2e('0x4b')],{'$or':_['map'](_0x53872c[_0xce2e('0x46')],function(_0x45f001){var _0x3b6d09={};_0x3b6d09[_0x45f001]={'$like':'%'+_0x5ead86[_0xce2e('0x42')][_0xce2e('0x50')]+'%'};return _0x3b6d09;})});}_0x53872c=_[_0xce2e('0x4d')]({},_0x53872c,_0x5ead86['options']);return db[_0xce2e('0x72')][_0xce2e('0x2d')]({'where':_0x53872c['where']})['then'](function(_0x19e1bf){_0x5c87da[_0xce2e('0x2d')]=_0x19e1bf;if(_0x5ead86[_0xce2e('0x42')][_0xce2e('0x52')]){_0x53872c[_0xce2e('0x53')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xce2e('0x74')],'as':_0xce2e('0x75'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xce2e('0x76'),'attributes':['id',_0xce2e('0x3a'),_0xce2e('0x77')],'where':_0x5ead86[_0xce2e('0x42')][_0xce2e('0x78')]?{'id':_0x5ead86['query'][_0xce2e('0x78')]}:undefined,'required':_0x5ead86[_0xce2e('0x42')]['tag']?!![]:![]}];}return db[_0xce2e('0x72')][_0xce2e('0x6f')](_0x53872c);})[_0xce2e('0x21')](function(_0x181c86){_0x5c87da[_0xce2e('0x54')]=_0x181c86;return _0x5c87da;});}})[_0xce2e('0x21')](respondWithFilteredResult(_0x2251ea,_0x53872c))['catch'](handleError(_0x2251ea,null));};exports[_0xce2e('0x79')]=function(_0x1dc114,_0x4ec580){var _0x52bb15=_0x1dc114['params']['id'];var _0x5c1df2=_0x1dc114[_0xce2e('0x5b')];var _0x4a68eb=0xc8;var _0x1d526c=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xce2e('0x7a')][_0xce2e('0x7b')][_0xce2e('0x7c')][_0xce2e('0x7d')]},function(_0x2b8feb){return db[_0xce2e('0x3f')][_0xce2e('0x6e')]({'where':{'id':_0x52bb15},'transaction':_0x2b8feb})['then'](function(_0x4ceb45){if(_0x4ceb45){return db[_0xce2e('0x7e')]['destroy']({'where':{'FaxAccountId':_0x52bb15},'transaction':_0x2b8feb})[_0xce2e('0x21')](function(){var _0x48cf08=_[_0xce2e('0x3e')](_0x5c1df2,function(_0x434b1b){_0x434b1b['FaxAccountId']=_0x52bb15;return _0x434b1b;});return db[_0xce2e('0x7e')]['bulkCreate'](_0x48cf08,{'transaction':_0x2b8feb});});}else{_0x4a68eb=0x194;_0x1d526c=[];}});})[_0xce2e('0x21')](function(){if(_0x4a68eb!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x52bb15},'order':_0xce2e('0x7f')})['then'](function(_0x2f4d5b){_0x1d526c=_0x2f4d5b;});}})['catch'](function(_0x28439e){_0x4a68eb=0x1f4;logger[_0xce2e('0x25')](_0x28439e[_0xce2e('0x39')]);if(_0x28439e[_0xce2e('0x3a')]){delete _0x28439e[_0xce2e('0x3a')];}_0x1d526c=_0x28439e;})['finally'](function(){if(_0x1d526c===null){_0x4ec580[_0xce2e('0x80')](_0x4a68eb);}else{if(_0x4a68eb===0x1f4){_0x4ec580[_0xce2e('0x2f')](_0x4a68eb)[_0xce2e('0x3b')](_0x1d526c);}else{_0x4ec580[_0xce2e('0x2f')](_0x4a68eb)[_0xce2e('0x31')](_0x1d526c);}}});};exports[_0xce2e('0x81')]=function(_0x374b15,_0x1a5db7,_0x28b3e9){var _0x25e83c={};var _0x5d8f1c={};var _0x450c09;var _0x3e8a06;return db[_0xce2e('0x3f')][_0xce2e('0x6e')]({'where':{'id':_0x374b15['params']['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x1a5db7,null))[_0xce2e('0x21')](function(_0x2d4658){if(_0x2d4658){_0x450c09=_0x2d4658;_0x5d8f1c['model']=_[_0xce2e('0x43')](db[_0xce2e('0x7e')][_0xce2e('0x40')]);_0x5d8f1c[_0xce2e('0x42')]=_[_0xce2e('0x43')](_0x374b15[_0xce2e('0x42')]);_0x5d8f1c['filters']=_[_0xce2e('0x57')](_0x5d8f1c['model'],_0x5d8f1c[_0xce2e('0x42')]);_0x25e83c[_0xce2e('0x46')]=_[_0xce2e('0x57')](_0x5d8f1c['model'],qs[_0xce2e('0x47')](_0x374b15['query'][_0xce2e('0x47')]));_0x25e83c[_0xce2e('0x46')]=_0x25e83c['attributes'][_0xce2e('0x48')]?_0x25e83c[_0xce2e('0x46')]:_0x5d8f1c[_0xce2e('0x45')];_0x25e83c[_0xce2e('0x68')]=qs[_0xce2e('0x4a')](_0x374b15[_0xce2e('0x42')][_0xce2e('0x4a')]);_0x25e83c['where']=qs['filters'](_['pick'](_0x374b15[_0xce2e('0x42')],_0x5d8f1c[_0xce2e('0x44')]));if(_0x374b15[_0xce2e('0x42')][_0xce2e('0x50')]){_0x25e83c[_0xce2e('0x4b')]=_[_0xce2e('0x4d')](_0x25e83c[_0xce2e('0x4b')],{'$or':_[_0xce2e('0x3e')](_0x25e83c[_0xce2e('0x46')],function(_0x1d6026){var _0x6c5ae5={};_0x6c5ae5[_0x1d6026]={'$like':'%'+_0x374b15[_0xce2e('0x42')][_0xce2e('0x50')]+'%'};return _0x6c5ae5;})});}_0x25e83c=_[_0xce2e('0x4d')]({},_0x25e83c,_0x374b15[_0xce2e('0x51')]);return _0x450c09[_0xce2e('0x81')](_0x25e83c);}})[_0xce2e('0x21')](function(_0x145fba){if(_0x145fba){_0x3e8a06=_0x145fba[_0xce2e('0x48')];if(!_0x374b15[_0xce2e('0x42')]['hasOwnProperty'](_0xce2e('0x67'))){_0x25e83c[_0xce2e('0x2e')]=qs[_0xce2e('0x2e')](_0x374b15[_0xce2e('0x42')]['limit']);_0x25e83c[_0xce2e('0x2b')]=qs[_0xce2e('0x2b')](_0x374b15['query'][_0xce2e('0x2b')]);}return _0x450c09['getApplications'](_0x25e83c);}})['then'](function(_0x5adaae){if(_0x5adaae){return _0x5adaae?{'count':_0x3e8a06,'rows':_0x5adaae}:null;}})['then'](respondWithResult(_0x1a5db7,null))[_0xce2e('0x59')](handleError(_0x1a5db7,null));};function Extension(_0x6c308f,_0x4dd32f,_0xf5305e,_0x2c1ef7){this[_0xce2e('0x82')]=_0xce2e('0x83');this[_0xce2e('0x84')]=_0x6c308f['localstationid'];this['app']=_0x2c1ef7;this[_0xce2e('0x4e')]='system';this[_0xce2e('0x85')]=_0xce2e('0x86');this[_0xce2e('0x64')]=_0x6c308f['id'];this[_0xce2e('0x7f')]=_0x4dd32f;this['appdata']=_0xf5305e;}function createExtensionsReciveFax(_0x467ef8){var _0x41fb19=0x1;var _0x399960=[];_0x399960[_0xce2e('0x87')](new Extension(_0x467ef8,_0x41fb19,'',_0xce2e('0x88')));_0x41fb19+=0x1;_0x399960['push'](new Extension(_0x467ef8,_0x41fb19,'CDR(type)=inbound-fax','Set'));_0x41fb19+=0x1;for(var _0x5f3f0f in _0x467ef8){if(_0x467ef8['hasOwnProperty'](_0x5f3f0f)&&(_0x5f3f0f===_0xce2e('0x89')||_0x5f3f0f===_0xce2e('0x8a')||_0x5f3f0f==='gateway'||_0x5f3f0f===_0xce2e('0x8b')||_0x5f3f0f==='headerinfo'||_0x5f3f0f==='maxrate'||_0x5f3f0f===_0xce2e('0x8c')||_0x5f3f0f===_0xce2e('0x8d')||_0x5f3f0f===_0xce2e('0x8e'))){_0x399960[_0xce2e('0x87')](new Extension(_0x467ef8,_0x41fb19,_0xce2e('0x8f')+_0x5f3f0f+')='+_0x467ef8[_0x5f3f0f],_0xce2e('0x90')));_0x41fb19+=0x1;}}_0x399960[_0xce2e('0x87')](new Extension(_0x467ef8,_0x41fb19,'6',_0xce2e('0x91')));_0x41fb19+=0x1;_0x399960[_0xce2e('0x87')](new Extension(_0x467ef8,_0x41fb19,'/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',_0xce2e('0x92')));_0x41fb19=0x0;return _0x399960;}exports[_0xce2e('0x93')]=function(_0x38a5e7,_0x5a4144,_0x625271){var _0x30e5b2;return db[_0xce2e('0x7a')]['transaction'](function(_0x378f83){return db[_0xce2e('0x3f')][_0xce2e('0x5a')](_0x38a5e7['body'],{'transaction':_0x378f83})[_0xce2e('0x21')](function(_0x222746){_0x30e5b2=_0x222746[_0xce2e('0x36')]({'plain':!![]});return db[_0xce2e('0x94')]['bulkCreate'](createExtensionsReciveFax(_0x30e5b2),{'transaction':_0x378f83});});})['then'](function(){return _0x30e5b2;})[_0xce2e('0x21')](respondWithResult(_0x5a4144,null))['catch'](handleError(_0x5a4144,null));};exports['updateAccountApplications']=function(_0x54151d,_0x29ce44,_0x37df83){var _0x5ea53d;return db[_0xce2e('0x7a')]['transaction'](function(_0x51dd3b){return db[_0xce2e('0x3f')][_0xce2e('0x34')](_0x54151d['body'],{'where':{'id':_0x54151d[_0xce2e('0x5b')]['id']},'transaction':_0x51dd3b})[_0xce2e('0x21')](function(_0x13b118){return db['VoiceExtension'][_0xce2e('0x35')]({'where':{'FaxAccountId':_0x54151d[_0xce2e('0x5b')]['id']},'transaction':_0x51dd3b})[_0xce2e('0x21')](function(_0x11fe43){return db[_0xce2e('0x94')][_0xce2e('0x95')](createExtensionsReciveFax(_['omit'](_0x54151d[_0xce2e('0x5b')],[_0xce2e('0x96'),_0xce2e('0x97'),_0xce2e('0x98'),_0xce2e('0x99'),_0xce2e('0x9a'),'ListId'])),{'transaction':_0x51dd3b});});});})['then'](function(){return db[_0xce2e('0x3f')][_0xce2e('0x9b')](_0x54151d[_0xce2e('0x5b')]['id']);})[_0xce2e('0x21')](respondWithResult(_0x29ce44,null))[_0xce2e('0x59')](handleError(_0x29ce44,null));};exports[_0xce2e('0x9c')]=function(_0x4b9abb,_0xbdaaad,_0x35aebc){var _0x3d1ce2={'raw':!![],'where':{}};var _0x5810fa={};var _0x50f6d1={'count':0x0,'rows':[]};return db[_0xce2e('0x3f')]['findOne']({'where':{'id':_0x4b9abb[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0xbdaaad,null))[_0xce2e('0x21')](function(_0x3fb679){if(_0x3fb679){_0x5810fa['model']=_['keys'](db[_0xce2e('0x9d')][_0xce2e('0x40')]);_0x5810fa[_0xce2e('0x42')]=_[_0xce2e('0x43')](_0x4b9abb['query']);_0x5810fa[_0xce2e('0x44')]=_[_0xce2e('0x57')](_0x5810fa[_0xce2e('0x45')],_0x5810fa[_0xce2e('0x42')]);_0x3d1ce2[_0xce2e('0x46')]=_[_0xce2e('0x57')](_0x5810fa[_0xce2e('0x45')],qs[_0xce2e('0x47')](_0x4b9abb['query'][_0xce2e('0x47')]));_0x3d1ce2[_0xce2e('0x46')]=_0x3d1ce2['attributes'][_0xce2e('0x48')]?_0x3d1ce2[_0xce2e('0x46')]:_0x5810fa['model'];if(!_0x4b9abb[_0xce2e('0x42')]['hasOwnProperty']('nolimit')){_0x3d1ce2[_0xce2e('0x2e')]=qs[_0xce2e('0x2e')](_0x4b9abb[_0xce2e('0x42')][_0xce2e('0x2e')]);_0x3d1ce2['offset']=qs['offset'](_0x4b9abb[_0xce2e('0x42')]['offset']);}_0x3d1ce2[_0xce2e('0x68')]=qs[_0xce2e('0x4a')](_0x4b9abb['query'][_0xce2e('0x4a')]);_0x3d1ce2[_0xce2e('0x4b')]=qs['filters'](_[_0xce2e('0x4c')](_0x4b9abb['query'],_0x5810fa[_0xce2e('0x44')]));_0x3d1ce2[_0xce2e('0x4b')][_0xce2e('0x64')]=_0x3fb679['id'];if(_0x4b9abb['query']['filter']){_0x3d1ce2[_0xce2e('0x4b')]=_[_0xce2e('0x4d')](_0x3d1ce2[_0xce2e('0x4b')],{'$or':_[_0xce2e('0x3e')](_0x3d1ce2[_0xce2e('0x46')],function(_0x3928ee){var _0x32f78e={};_0x32f78e[_0x3928ee]={'$like':'%'+_0x4b9abb[_0xce2e('0x42')][_0xce2e('0x50')]+'%'};return _0x32f78e;})});}if(_0x4b9abb[_0xce2e('0x42')]['$gte']){var _0x484110=_0x4b9abb[_0xce2e('0x42')]['$gte'][_0xce2e('0x9e')](',');var _0x4e6938={};_0x4e6938[_0x484110[0x0]]={'$gte':moment(_0x484110[0x1])['format'](_0xce2e('0x9f'))};_0x3d1ce2[_0xce2e('0x4b')]=_[_0xce2e('0x4d')](_0x3d1ce2['where'],_0x4e6938);}_0x3d1ce2=_[_0xce2e('0x4d')]({},_0x3d1ce2,_0x4b9abb['options']);return db[_0xce2e('0x9d')][_0xce2e('0x2d')]({'where':_0x3d1ce2[_0xce2e('0x4b')]})['then'](function(_0x1b3835){_0x50f6d1[_0xce2e('0x2d')]=_0x1b3835;if(_0x4b9abb[_0xce2e('0x42')][_0xce2e('0x52')]){_0x3d1ce2[_0xce2e('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0xce2e('0x6f')](_0x3d1ce2);})['then'](function(_0x217975){_0x50f6d1[_0xce2e('0x54')]=_0x217975;return _0x50f6d1;});}})[_0xce2e('0x21')](respondWithFilteredResult(_0xbdaaad,_0x3d1ce2))[_0xce2e('0x59')](handleError(_0xbdaaad,null));};exports[_0xce2e('0x3b')]=function(_0x644bed,_0x108ac5,_0x1b55cc){var _0x75d76d,_0x168331={},_0xc173a8;if(_0x644bed['body']['to']){_0xc173a8=_0x644bed[_0xce2e('0x5b')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x644bed[_0xce2e('0x56')]['id']},'include':[{'model':db[_0xce2e('0xa0')],'as':_0xce2e('0xa1'),'include':[{'model':db['CmContact'],'as':_0xce2e('0xa2'),'where':{'fax':_0xc173a8},'limit':0x1,'order':[[_0xce2e('0x99'),_0xce2e('0xa3')]]}]}]})[_0xce2e('0x21')](handleEntityNotFound(_0x108ac5,null))[_0xce2e('0x21')](function(_0x3a2b99){_0x75d76d=_0x3a2b99;if(_0x644bed['body']['attachments']&&_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa4')][_0xce2e('0x48')]){for(var _0x1840e5=0x0;_0x1840e5<_0x644bed[_0xce2e('0x5b')]['attachments'][_0xce2e('0x48')];_0x1840e5+=0x1){_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa4')][_0x1840e5]={'filename':_0x644bed[_0xce2e('0x5b')]['attachments'][_0x1840e5][_0xce2e('0x3a')],'id':_0x644bed['body'][_0xce2e('0xa4')][_0x1840e5]['id'],'path':path['join'](config[_0xce2e('0xa5')],_0xce2e('0xa6'),_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa4')][_0x1840e5]['basename'])};}}return respondWithRpcPromise(_0xce2e('0xa7'),_0xce2e('0xa7'),{'FaxAccountId':_[_0xce2e('0xa8')](_0x644bed['params']['id'])?undefined:_0x644bed[_0xce2e('0x56')]['id'],'path':_['isNil'](_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa4')][0x0]['path'])?undefined:_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa4')][0x0][_0xce2e('0x6')],'fax':_[_0xce2e('0xa8')](_0x644bed[_0xce2e('0x5b')]['to'][0x0])?undefined:_0x644bed[_0xce2e('0x5b')]['to'][0x0]},client9002);})[_0xce2e('0x21')](function(){if(_0x75d76d){if(_[_0xce2e('0xa8')](_0x644bed['body'][_0xce2e('0xa9')])){_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa9')]=util[_0xce2e('0xaa')]('\x22%s\x22\x20<%s>',_0x75d76d['name'],_0x75d76d[_0xce2e('0xab')]);}if(_0x75d76d['List']){if(_0x75d76d[_0xce2e('0xa1')]['Contacts']['length']){return _0x75d76d[_0xce2e('0xa1')][_0xce2e('0xa2')][0x0];}else{return db['CmContact'][_0xce2e('0x5a')](_[_0xce2e('0x19')](_0x644bed[_0xce2e('0x5b')],{'firstName':_0x644bed['body']['to'][0x0],'phone':_0x644bed[_0xce2e('0x5b')]['to'][0x0],'fax':_0x644bed[_0xce2e('0x5b')]['to'][0x0],'ListId':_0x75d76d['ListId']}));}}else{throw new Error(_0xce2e('0xac'));}}else{throw new Error(_0xce2e('0xad'));}})[_0xce2e('0x21')](function(_0x33fd91){if(_0x33fd91){return db[_0xce2e('0x72')][_0xce2e('0x58')]({'where':{'ContactId':_0x33fd91['id'],'closed':![],'FaxAccountId':_0x75d76d['id']}})[_0xce2e('0x21')](function(_0x4460b8){if(_0x4460b8){return[_0x4460b8,![]];}return db[_0xce2e('0x72')][_0xce2e('0x5a')]({'UserId':_0x644bed[_0xce2e('0x5c')]['id'],'ContactId':_0x33fd91['id'],'FaxAccountId':_0x75d76d['id'],'fax':_0x644bed[_0xce2e('0x5b')]['to'][0x0],'firstMsgDirection':_0xce2e('0xae'),'Messages':[_[_0xce2e('0x4d')](_0x644bed[_0xce2e('0x5b')],{'read':![],'body':_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa4')][0x0][_0xce2e('0xaf')],'FaxAccountId':_0x75d76d['id'],'UserId':_0x644bed[_0xce2e('0x5c')]['id'],'ContactId':_0x33fd91['id'],'AttachmentId':_0x644bed['body'][_0xce2e('0xa4')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xce2e('0xb0')}]})[_0xce2e('0x21')](function(_0x240b33){return[_0x240b33,!![]];});});}else{throw new Error(_0xce2e('0xb1'));}})['spread'](function(_0x1c9740,_0x588a6f){if(_0x588a6f){return _0x1c9740;}return db[_0xce2e('0x9d')][_0xce2e('0x5a')]({'direction':_0xce2e('0xae'),'read':![],'body':_0x644bed[_0xce2e('0x5b')]['attachments'][0x0][_0xce2e('0xaf')],'FaxAccountId':_0x75d76d['id'],'FaxInteractionId':_0x1c9740['id'],'UserId':_0x644bed[_0xce2e('0x5c')]['id'],'ContactId':_0x1c9740[_0xce2e('0xb2')],'AttachmentId':_0x644bed[_0xce2e('0x5b')][_0xce2e('0xa4')][0x0]['id']})[_0xce2e('0x21')](function(_0x2572f5){_0x1c9740[_0xce2e('0xb3')]['Messages']=[];_0x1c9740[_0xce2e('0xb3')][_0xce2e('0xb0')]['push'](_0x2572f5[_0xce2e('0xb3')]);return _0x1c9740;});})['then'](function(_0x2b24d6){respondWithRpcPromise(_0xce2e('0xb4'),_0xce2e('0xb4'),{'FaxAccountId':_[_0xce2e('0xa8')](_0x644bed[_0xce2e('0x56')]['id'])?undefined:_0x644bed[_0xce2e('0x56')]['id'],'path':_[_0xce2e('0xa8')](_0x644bed['body'][_0xce2e('0xa4')][0x0][_0xce2e('0x6')])?undefined:_0x644bed['body'][_0xce2e('0xa4')][0x0]['path'],'fax':_[_0xce2e('0xa8')](_0x644bed['body']['to'][0x0])?undefined:_0x644bed[_0xce2e('0x5b')]['to'][0x0],'AttachmentId':_0x644bed[_0xce2e('0x5b')]['attachments'][0x0]['id']},client9002)['then'](function(_0x143dbb){logger[_0xce2e('0x29')](_0xce2e('0xb5'),_0x143dbb);})[_0xce2e('0x59')](function(_0x456690){logger[_0xce2e('0x29')]('SendFaxRpc,\x20%s',_0x456690);});return _0x2b24d6;})['then'](respondWithResult(_0x108ac5,null))[_0xce2e('0x59')](handleError(_0x108ac5,null));};exports[_0xce2e('0xb6')]=function(_0x4136ab,_0x36f120,_0x53b3b8){return db[_0xce2e('0x3f')][_0xce2e('0x58')]({'where':{'id':_0x4136ab[_0xce2e('0x56')]['id']}})['then'](handleEntityNotFound(_0x36f120,null))[_0xce2e('0x21')](function(_0x193ff9){if(_0x193ff9){return _0x193ff9[_0xce2e('0xb6')](_0x4136ab['body'][_0xce2e('0x6a')],_['omit'](_0x4136ab[_0xce2e('0x5b')],[_0xce2e('0x6a'),'id'])||{})['spread'](function(_0x127698){for(var _0x548be1=0x0;_0x548be1<_0x4136ab[_0xce2e('0x5b')]['ids']['length'];_0x548be1+=0x1){socket[_0xce2e('0xb7')](_0xce2e('0xb8'),{'UserId':Number(_0x4136ab[_0xce2e('0x5b')][_0xce2e('0x6a')][_0x548be1]),'FaxAccountId':Number(_0x4136ab[_0xce2e('0x56')]['id'])});}return _0x127698;});}})[_0xce2e('0x21')](respondWithResult(_0x36f120,null))[_0xce2e('0x59')](handleError(_0x36f120,null));};exports[_0xce2e('0xb9')]=function(_0x222c88,_0x553133,_0x25d624){return db[_0xce2e('0x3f')][_0xce2e('0x58')]({'where':{'id':_0x222c88[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x553133,null))[_0xce2e('0x21')](function(_0x244e3b){if(_0x244e3b){return _0x244e3b[_0xce2e('0xb9')](_0x222c88[_0xce2e('0x42')][_0xce2e('0x6a')])['then'](function(){if(_[_0xce2e('0xba')](_0x222c88[_0xce2e('0x42')][_0xce2e('0x6a')])){for(var _0x49ec16=0x0;_0x49ec16<_0x222c88['query']['ids'][_0xce2e('0x48')];_0x49ec16+=0x1){socket[_0xce2e('0xb7')]('userFaxAccount:remove',{'UserId':Number(_0x222c88[_0xce2e('0x42')][_0xce2e('0x6a')][_0x49ec16]),'FaxAccountId':Number(_0x222c88[_0xce2e('0x56')]['id'])});}}else{socket[_0xce2e('0xb7')](_0xce2e('0xbb'),{'UserId':Number(_0x222c88[_0xce2e('0x42')][_0xce2e('0x6a')]),'FaxAccountId':Number(_0x222c88[_0xce2e('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x553133,null))[_0xce2e('0x59')](handleError(_0x553133,null));};exports[_0xce2e('0xbc')]=function(_0x28da75,_0x25fb72,_0x2e4cac){var _0x43f7e6={};var _0x59a222={};var _0x565b80;var _0x52dbf6;return db[_0xce2e('0x3f')][_0xce2e('0x6e')]({'where':{'id':_0x28da75[_0xce2e('0x56')]['id']}})[_0xce2e('0x21')](handleEntityNotFound(_0x25fb72,null))[_0xce2e('0x21')](function(_0x1a1152){if(_0x1a1152){_0x565b80=_0x1a1152;_0x59a222['model']=_[_0xce2e('0x43')](db[_0xce2e('0x74')]['rawAttributes']);_0x59a222[_0xce2e('0x42')]=_[_0xce2e('0x43')](_0x28da75['query']);_0x59a222[_0xce2e('0x44')]=_[_0xce2e('0x57')](_0x59a222[_0xce2e('0x45')],_0x59a222[_0xce2e('0x42')]);_0x43f7e6[_0xce2e('0x46')]=_[_0xce2e('0x57')](_0x59a222[_0xce2e('0x45')],qs['fields'](_0x28da75[_0xce2e('0x42')][_0xce2e('0x47')]));_0x43f7e6[_0xce2e('0x46')]=_0x43f7e6[_0xce2e('0x46')][_0xce2e('0x48')]?_0x43f7e6[_0xce2e('0x46')]:_0x59a222[_0xce2e('0x45')];_0x43f7e6['order']=qs[_0xce2e('0x4a')](_0x28da75[_0xce2e('0x42')][_0xce2e('0x4a')]);_0x43f7e6[_0xce2e('0x4b')]=qs[_0xce2e('0x44')](_[_0xce2e('0x4c')](_0x28da75[_0xce2e('0x42')],_0x59a222['filters']));if(_0x28da75['query'][_0xce2e('0x50')]){_0x43f7e6['where']=_[_0xce2e('0x4d')](_0x43f7e6[_0xce2e('0x4b')],{'$or':_[_0xce2e('0x3e')](_0x43f7e6[_0xce2e('0x46')],function(_0x3fce8e){var _0x3b1bc6={};_0x3b1bc6[_0x3fce8e]={'$like':'%'+_0x28da75[_0xce2e('0x42')][_0xce2e('0x50')]+'%'};return _0x3b1bc6;})});}_0x43f7e6=_[_0xce2e('0x4d')]({},_0x43f7e6,_0x28da75['options']);return _0x565b80[_0xce2e('0xbc')](_0x43f7e6);}})[_0xce2e('0x21')](function(_0x5dea81){if(_0x5dea81){_0x52dbf6=_0x5dea81[_0xce2e('0x48')];if(!_0x28da75[_0xce2e('0x42')][_0xce2e('0x49')](_0xce2e('0x67'))){_0x43f7e6[_0xce2e('0x2e')]=qs[_0xce2e('0x2e')](_0x28da75[_0xce2e('0x42')][_0xce2e('0x2e')]);_0x43f7e6[_0xce2e('0x2b')]=qs[_0xce2e('0x2b')](_0x28da75[_0xce2e('0x42')][_0xce2e('0x2b')]);}return _0x565b80[_0xce2e('0xbc')](_0x43f7e6);}})[_0xce2e('0x21')](function(_0x172e1d){if(_0x172e1d){return _0x172e1d?{'count':_0x52dbf6,'rows':_0x172e1d}:null;}})[_0xce2e('0x21')](respondWithResult(_0x25fb72,null))[_0xce2e('0x59')](handleError(_0x25fb72,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6ab053f..b0e9516 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 _0x3840=['events','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x3840,0x130));var _0x0384=function(_0x88e249,_0x17c92d){_0x88e249=_0x88e249-0x0;var _0x5a71f4=_0x3840[_0x88e249];return _0x5a71f4;};'use strict';var EventEmitter=require(_0x0384('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0384('0x1')](0x0);var events={'afterCreate':_0x0384('0x2'),'afterUpdate':_0x0384('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c1348){return function(_0x42ace6,_0x7784ba,_0x14bb79){FaxAccountEvents[_0x0384('0x4')](_0x3c1348+':'+_0x42ace6['id'],_0x42ace6);FaxAccountEvents[_0x0384('0x4')](_0x3c1348,_0x42ace6);_0x14bb79(null);};}for(var e in events){if(events[_0x0384('0x5')](e)){var event=events[e];FaxAccount[_0x0384('0x6')](e,emitEvent(event));}}module[_0x0384('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xd9db=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x287cfd,_0xb7bd47){var _0x21bfb7=function(_0x275e8a){while(--_0x275e8a){_0x287cfd['push'](_0x287cfd['shift']());}};_0x21bfb7(++_0xb7bd47);}(_0xd9db,0x8a));var _0xbd9d=function(_0x112c30,_0x54a84c){_0x112c30=_0x112c30-0x0;var _0x61a11c=_0xd9db[_0x112c30];return _0x61a11c;};'use strict';var EventEmitter=require(_0xbd9d('0x0'));var FaxAccount=require(_0xbd9d('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xbd9d('0x2')](0x0);var events={'afterCreate':_0xbd9d('0x3'),'afterUpdate':_0xbd9d('0x4'),'afterDestroy':_0xbd9d('0x5')};function emitEvent(_0x11af25){return function(_0x284c2b,_0x363833,_0x126901){FaxAccountEvents[_0xbd9d('0x6')](_0x11af25+':'+_0x284c2b['id'],_0x284c2b);FaxAccountEvents[_0xbd9d('0x6')](_0x11af25,_0x284c2b);_0x126901(null);};}for(var e in events){if(events[_0xbd9d('0x7')](e)){var event=events[e];FaxAccount['hook'](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 9b9e44b..ccb6f9b 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 _0x653c=['api','moment','bluebird','request-promise','path','../../config/environment','FaxAccount','fax_accounts','lodash','util'];(function(_0x221b76,_0x311a2d){var _0x1466bb=function(_0x311dd2){while(--_0x311dd2){_0x221b76['push'](_0x221b76['shift']());}};_0x1466bb(++_0x311a2d);}(_0x653c,0x17a));var _0xc653=function(_0x44ba45,_0x569f21){_0x44ba45=_0x44ba45-0x0;var _0x2072be=_0x653c[_0x44ba45];return _0x2072be;};'use strict';var _=require(_0xc653('0x0'));var util=require(_0xc653('0x1'));var logger=require('../../config/logger')(_0xc653('0x2'));var moment=require(_0xc653('0x3'));var BPromise=require(_0xc653('0x4'));var rp=require(_0xc653('0x5'));var fs=require('fs');var path=require(_0xc653('0x6'));var rimraf=require('rimraf');var config=require(_0xc653('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x284c45,_0x4f5001){return _0x284c45['define'](_0xc653('0x8'),attributes,{'tableName':_0xc653('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa388=['fax_accounts','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x456028,_0x136ef1){var _0x20000e=function(_0x1db9df){while(--_0x1db9df){_0x456028['push'](_0x456028['shift']());}};_0x20000e(++_0x136ef1);}(_0xa388,0x109));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a38('0x0'))(_0x8a38('0x1'));var moment=require(_0x8a38('0x2'));var BPromise=require('bluebird');var rp=require(_0x8a38('0x3'));var fs=require('fs');var path=require(_0x8a38('0x4'));var rimraf=require(_0x8a38('0x5'));var config=require(_0x8a38('0x6'));var attributes=require(_0x8a38('0x7'));module[_0x8a38('0x8')]=function(_0x5d133c,_0x327b4e){return _0x5d133c[_0x8a38('0x9')](_0x8a38('0xa'),attributes,{'tableName':_0x8a38('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 16aad5d..29f93e3 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 _0xf92e=['fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','applications','Applications','list','orderBy','priority','asc','account','defaults','create','contact','FaxInteraction','spread','get','autoclose','push','length','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount'];(function(_0x42a87a,_0x296374){var _0x4504c4=function(_0x97f04c){while(--_0x97f04c){_0x42a87a['push'](_0x42a87a['shift']());}};_0x4504c4(++_0x296374);}(_0xf92e,0x1a6));var _0xef92=function(_0x22049c,_0x45ee9a){_0x22049c=_0x22049c-0x0;var _0x188ac3=_0xf92e[_0x22049c];return _0x188ac3;};'use strict';var _=require(_0xef92('0x0'));var util=require('util');var moment=require(_0xef92('0x1'));var BPromise=require(_0xef92('0x2'));var rs=require(_0xef92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef92('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef92('0x5'))(_0xef92('0x6'));var config=require(_0xef92('0x7'));var jayson=require(_0xef92('0x8'));var client=jayson['client'][_0xef92('0x9')]({'port':0x232c});config[_0xef92('0xa')]=_['defaults'](config[_0xef92('0xa')],{'host':_0xef92('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xef92('0xc'))[_0xef92('0xd')](socket);function respondWithRpcPromise(_0x1815cc,_0x29507e,_0x4d7316){return new BPromise(function(_0x186275,_0x137a51){return client[_0xef92('0xe')](_0x1815cc,_0x4d7316)[_0xef92('0xf')](function(_0x1425a4){logger['info']('FaxAccount,\x20%s,\x20%s',_0x29507e,_0xef92('0x10'));logger[_0xef92('0x11')](_0xef92('0x12'),_0x29507e,_0xef92('0x10'),JSON[_0xef92('0x13')](_0x1425a4));if(_0x1425a4['error']){if(_0x1425a4[_0xef92('0x14')][_0xef92('0x15')]===0x1f4){logger[_0xef92('0x14')](_0xef92('0x16'),_0x29507e,_0x1425a4[_0xef92('0x14')][_0xef92('0x17')]);return _0x137a51(_0x1425a4[_0xef92('0x14')][_0xef92('0x17')]);}logger[_0xef92('0x14')](_0xef92('0x16'),_0x29507e,_0x1425a4[_0xef92('0x14')][_0xef92('0x17')]);return _0x186275(_0x1425a4[_0xef92('0x14')][_0xef92('0x17')]);}else{logger[_0xef92('0x18')](_0xef92('0x16'),_0x29507e,_0xef92('0x10'));_0x186275(_0x1425a4[_0xef92('0x19')][_0xef92('0x17')]);}})[_0xef92('0x1a')](function(_0x5a907d){logger[_0xef92('0x14')]('FaxAccount,\x20%s,\x20%s',_0x29507e,_0x5a907d);_0x137a51(_0x5a907d);});});}exports[_0xef92('0x1b')]=function(_0x5e89d8){var _0x22c78a=this;return new Promise(function(_0x3eed35,_0x2f9377){return db[_0xef92('0x1c')][_0xef92('0x1d')]({'raw':_0x5e89d8[_0xef92('0x1e')]?_0x5e89d8[_0xef92('0x1e')][_0xef92('0x1f')]===undefined?!![]:![]:!![],'where':_0x5e89d8[_0xef92('0x1e')]?_0x5e89d8['options']['where']||null:null,'attributes':_0x5e89d8[_0xef92('0x1e')]?_0x5e89d8[_0xef92('0x1e')][_0xef92('0x20')]||null:null,'limit':_0x5e89d8['options']?_0x5e89d8[_0xef92('0x1e')][_0xef92('0x21')]||null:null,'include':_0x5e89d8['options']?_0x5e89d8[_0xef92('0x1e')][_0xef92('0x22')]?_[_0xef92('0x23')](_0x5e89d8['options']['include'],function(_0x25d205){return{'model':db[_0x25d205[_0xef92('0x24')]],'as':_0x25d205['as'],'attributes':_0x25d205[_0xef92('0x20')],'include':_0x25d205[_0xef92('0x22')]?_['map'](_0x25d205[_0xef92('0x22')],function(_0x51b5fa){return{'model':db[_0x51b5fa[_0xef92('0x24')]],'as':_0x51b5fa['as'],'attributes':_0x51b5fa[_0xef92('0x20')],'include':_0x51b5fa[_0xef92('0x22')]?_[_0xef92('0x23')](_0x51b5fa[_0xef92('0x22')],function(_0x35327a){return{'model':db[_0x35327a[_0xef92('0x24')]],'as':_0x35327a['as'],'attributes':_0x35327a['attributes']};}):[]};}):[]};}):[]:[]})[_0xef92('0xf')](function(_0x4b2fa9){logger['info'](_0xef92('0x1b'),_0x5e89d8);logger['debug'](_0xef92('0x1b'),_0x5e89d8,JSON[_0xef92('0x13')](_0x4b2fa9));_0x3eed35(_0x4b2fa9);})[_0xef92('0x1a')](function(_0x1cc032){logger['error'](_0xef92('0x1b'),_0x1cc032[_0xef92('0x17')],_0x5e89d8);_0x2f9377(_0x22c78a[_0xef92('0x14')](0x1f4,_0x1cc032[_0xef92('0x17')]));});});};exports[_0xef92('0x25')]=function(_0x5af45d,_0x479a58,_0x28b501){var _0x501085=this;return new Promise(function(_0xe2ade5,_0x5b4132){var _0x1df579={'body':_0x5af45d['body'],'channel':_0xef92('0x26')};var _0x26ffd9=[];var _0x192298=[];var _0x5760dc={};return db[_0xef92('0x27')][_0xef92('0x28')]()[_0xef92('0xf')](function(_0x3b08f3){if(!_0x3b08f3){throw new db[(_0xef92('0x29'))][(_0xef92('0x2a'))](_0xef92('0x2b'));}_0x26ffd9=_[_0xef92('0x2c')](_[_0xef92('0x2d')](_0x3b08f3),['createdAt',_0xef92('0x2e')]);_0x192298=_['difference'](_[_0xef92('0x2d')](_0x3b08f3),['createdAt',_0xef92('0x2e'),'CompanyId',_0xef92('0x2f')]);if(_0x5af45d['body']['id']){delete _0x5af45d[_0xef92('0x30')]['id'];}if(_[_0xef92('0x31')](_0x5af45d['body'][_0xef92('0x32')])){throw new db[(_0xef92('0x29'))][(_0xef92('0x2a'))](_0xef92('0x33'));}if(_[_0xef92('0x31')](_0x5af45d[_0xef92('0x30')][_0xef92('0x30')])||_0x5af45d[_0xef92('0x30')][_0xef92('0x30')]===''){throw new db['Sequelize']['ValidationError'](_0xef92('0x34'));}if(_['isNil'](_0x5af45d[_0xef92('0x30')][_0xef92('0x35')])){throw new db[(_0xef92('0x29'))]['ValidationError'](_0xef92('0x36')+_0x192298);}if(!_[_0xef92('0x37')](_0x192298,_0x5af45d[_0xef92('0x30')][_0xef92('0x35')])){throw new db['Sequelize']['ValidationError'](_0xef92('0x38')+_0x192298);}_0x5760dc[_0x5af45d[_0xef92('0x30')][_0xef92('0x35')]]=_0x5af45d['body']['from'];})['then'](function(){return db[_0xef92('0x1c')][_0xef92('0x39')]({'where':{'id':_0x5af45d['account']['id']},'include':[{'model':db[_0xef92('0x3a')],'as':_0xef92('0x3b'),'include':[{'model':db[_0xef92('0x27')],'as':_0xef92('0x3c'),'where':_0x5760dc,'limit':0x1,'order':[[_0xef92('0x2e'),_0xef92('0x3d')]]}]},{'model':db[_0xef92('0x3e')],'as':'Applications'}]});})[_0xef92('0xf')](function(_0x465e1f){if(_0x465e1f&&_0x465e1f[_0xef92('0x3b')]){var _0x132f20=_0x465e1f['get']({'plain':!![]});_0x1df579['account']=_0x132f20;_0x1df579[_0xef92('0x3f')]=_0x132f20[_0xef92('0x40')];_0x1df579[_0xef92('0x41')]=_0x132f20[_0xef92('0x3b')];_0x1df579['applications']=_[_0xef92('0x42')](_0x1df579[_0xef92('0x3f')],[_0xef92('0x43')],[_0xef92('0x44')]);if(_0x1df579[_0xef92('0x45')][_0xef92('0x40')]){delete _0x1df579['account']['Applications'];}if(_0x1df579[_0xef92('0x45')][_0xef92('0x3b')]&&_0x1df579[_0xef92('0x45')]['List'][_0xef92('0x3c')]['length']){return _0x1df579['account'][_0xef92('0x3b')][_0xef92('0x3c')][0x0];}var _0x1ced8e=_[_0xef92('0x46')](_0x5af45d[_0xef92('0x30')],{'firstName':_0x5af45d[_0xef92('0x30')]['from'],'ListId':_0x132f20[_0xef92('0x2f')]});_0x1ced8e[_0x5af45d[_0xef92('0x30')]['mapKey']]=_0x5af45d['body'][_0xef92('0x32')];return db[_0xef92('0x27')][_0xef92('0x47')](_0x1ced8e,{'fields':_0x26ffd9,'raw':!![]});}})[_0xef92('0xf')](function(_0x4ff1d9){_0x1df579[_0xef92('0x48')]=_0x4ff1d9;if(_0x4ff1d9){var _0x35e07c={'ContactId':_0x4ff1d9['id'],'FaxAccountId':_0x5af45d['account']['id'],'fax':_0x4ff1d9[_0xef92('0x26')]};return db[_0xef92('0x49')]['find']({'where':{'ContactId':_0x4ff1d9['id'],'closed':![],'FaxAccountId':_0x5af45d['account']['id']}})[_0xef92('0xf')](function(_0x2c1aa2){if(_0x2c1aa2){return[_0x2c1aa2,![]];}return db[_0xef92('0x49')][_0xef92('0x47')](_0x35e07c)['then'](function(_0x1b3406){return[_0x1b3406,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xef92('0x4a')](function(_0x32a347,_0x213c42){var _0x4551d8=_0x32a347[_0xef92('0x4b')]({'plain':!![]});if(_0x213c42){if(_0x1df579[_0xef92('0x45')][_0xef92('0x4c')]){_0x1df579['applications'][_0xef92('0x4d')]({'id':0x0,'priority':_0x1df579['applications'][_0xef92('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xef92('0x4f')});}_0x4551d8[_0xef92('0x50')]=!![];}else{_0x4551d8[_0xef92('0x50')]=![];}_0x1df579[_0xef92('0x51')]=_0x4551d8;return db[_0xef92('0x52')][_0xef92('0x47')]({'body':_0x5af45d['body'][_0xef92('0x30')],'FaxAccountId':_0x5af45d[_0xef92('0x45')]['id'],'FaxInteractionId':_0x32a347['id'],'direction':'in','ContactId':_0x32a347[_0xef92('0x53')],'AttachmentId':_0x5af45d[_0xef92('0x30')][_0xef92('0x54')]});})[_0xef92('0xf')](function(_0x41de04){_0x1df579[_0xef92('0x17')]=_0x41de04;if(_0x1df579[_0xef92('0x51')][_0xef92('0x55')]){return db[_0xef92('0x56')][_0xef92('0x39')]({'attributes':['id',_0xef92('0x57')],'where':{'id':_0x1df579['interaction'][_0xef92('0x55')]}})[_0xef92('0xf')](function(_0x30913a){if(_0x30913a){_0x1df579[_0xef92('0x3f')][_0xef92('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x30913a[_0xef92('0x57')]+','+(_0x1df579[_0xef92('0x45')][_0xef92('0x59')]||0xa),'interval':_0xef92('0x4f')});}return respondWithRpcPromise(_0xef92('0x5a'),_0xef92('0x5b'),_0x1df579);});}return respondWithRpcPromise(_0xef92('0x5a'),_0xef92('0x5b'),_0x1df579);})[_0xef92('0xf')](function(_0x2a9fe4){_0xe2ade5(_0x2a9fe4);})[_0xef92('0x1a')](function(_0x402a1d){_0x5b4132(_0x501085[_0xef92('0x14')](0x1f4,_0x402a1d[_0xef92('0x17')]));});});}; \ No newline at end of file +var _0xaa47=['where','limit','include','map','model','attributes','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','priority','Contacts','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','Start','startRouting','util','moment','bluebird','ioredis','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0xaa47,0xef));var _0x7aa4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xaa47[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x7aa4('0x0'));var moment=require(_0x7aa4('0x1'));var BPromise=require(_0x7aa4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aa4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7aa4('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7aa4('0x5')][_0x7aa4('0x6')]({'port':0x232c});config[_0x7aa4('0x7')]=_[_0x7aa4('0x8')](config['redis'],{'host':_0x7aa4('0x9'),'port':0x18eb});var socket=require(_0x7aa4('0xa'))(new Redis(config[_0x7aa4('0x7')]));require(_0x7aa4('0xb'))[_0x7aa4('0xc')](socket);function respondWithRpcPromise(_0x2a4773,_0x47ce42,_0x39302f){return new BPromise(function(_0x4cfefb,_0x37bbfd){return client[_0x7aa4('0xd')](_0x2a4773,_0x39302f)[_0x7aa4('0xe')](function(_0x3b040f){logger[_0x7aa4('0xf')](_0x7aa4('0x10'),_0x47ce42,'request\x20sent');logger[_0x7aa4('0x11')](_0x7aa4('0x12'),_0x47ce42,_0x7aa4('0x13'),JSON[_0x7aa4('0x14')](_0x3b040f));if(_0x3b040f['error']){if(_0x3b040f[_0x7aa4('0x15')][_0x7aa4('0x16')]===0x1f4){logger[_0x7aa4('0x15')]('FaxAccount,\x20%s,\x20%s',_0x47ce42,_0x3b040f[_0x7aa4('0x15')]['message']);return _0x37bbfd(_0x3b040f[_0x7aa4('0x15')]['message']);}logger['error'](_0x7aa4('0x10'),_0x47ce42,_0x3b040f[_0x7aa4('0x15')][_0x7aa4('0x17')]);return _0x4cfefb(_0x3b040f[_0x7aa4('0x15')]['message']);}else{logger[_0x7aa4('0xf')](_0x7aa4('0x10'),_0x47ce42,_0x7aa4('0x13'));_0x4cfefb(_0x3b040f[_0x7aa4('0x18')][_0x7aa4('0x17')]);}})[_0x7aa4('0x19')](function(_0x2ed8d5){logger[_0x7aa4('0x15')]('FaxAccount,\x20%s,\x20%s',_0x47ce42,_0x2ed8d5);_0x37bbfd(_0x2ed8d5);});});}exports[_0x7aa4('0x1a')]=function(_0x31ca85){var _0x3bd945=this;return new Promise(function(_0x284666,_0x27fde3){return db[_0x7aa4('0x1b')][_0x7aa4('0x1c')]({'raw':_0x31ca85[_0x7aa4('0x1d')]?_0x31ca85['options'][_0x7aa4('0x1e')]===undefined?!![]:![]:!![],'where':_0x31ca85[_0x7aa4('0x1d')]?_0x31ca85[_0x7aa4('0x1d')][_0x7aa4('0x1f')]||null:null,'attributes':_0x31ca85[_0x7aa4('0x1d')]?_0x31ca85[_0x7aa4('0x1d')]['attributes']||null:null,'limit':_0x31ca85[_0x7aa4('0x1d')]?_0x31ca85['options'][_0x7aa4('0x20')]||null:null,'include':_0x31ca85[_0x7aa4('0x1d')]?_0x31ca85[_0x7aa4('0x1d')][_0x7aa4('0x21')]?_[_0x7aa4('0x22')](_0x31ca85[_0x7aa4('0x1d')][_0x7aa4('0x21')],function(_0x55bdcd){return{'model':db[_0x55bdcd[_0x7aa4('0x23')]],'as':_0x55bdcd['as'],'attributes':_0x55bdcd[_0x7aa4('0x24')],'include':_0x55bdcd[_0x7aa4('0x21')]?_['map'](_0x55bdcd['include'],function(_0x1a3e82){return{'model':db[_0x1a3e82[_0x7aa4('0x23')]],'as':_0x1a3e82['as'],'attributes':_0x1a3e82['attributes'],'include':_0x1a3e82[_0x7aa4('0x21')]?_[_0x7aa4('0x22')](_0x1a3e82[_0x7aa4('0x21')],function(_0x231407){return{'model':db[_0x231407[_0x7aa4('0x23')]],'as':_0x231407['as'],'attributes':_0x231407[_0x7aa4('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7aa4('0xe')](function(_0x2a6e5b){logger[_0x7aa4('0xf')]('GetFaxAccount',_0x31ca85);logger['debug'](_0x7aa4('0x1a'),_0x31ca85,JSON[_0x7aa4('0x14')](_0x2a6e5b));_0x284666(_0x2a6e5b);})[_0x7aa4('0x19')](function(_0x3c731e){logger[_0x7aa4('0x15')](_0x7aa4('0x1a'),_0x3c731e[_0x7aa4('0x17')],_0x31ca85);_0x27fde3(_0x3bd945['error'](0x1f4,_0x3c731e[_0x7aa4('0x17')]));});});};exports[_0x7aa4('0x25')]=function(_0x31da28,_0x558710,_0x29a1a9){var _0x10b79b=this;return new Promise(function(_0x1b3eec,_0x34b862){var _0x479f20={'body':_0x31da28['body'],'channel':'fax'};var _0x24e6b3=[];var _0x5b195a=[];var _0x1d8ed5={};return db[_0x7aa4('0x26')][_0x7aa4('0x27')]()[_0x7aa4('0xe')](function(_0x4d1f53){if(!_0x4d1f53){throw new db[(_0x7aa4('0x28'))][(_0x7aa4('0x29'))](_0x7aa4('0x2a'));}_0x24e6b3=_[_0x7aa4('0x2b')](_[_0x7aa4('0x2c')](_0x4d1f53),[_0x7aa4('0x2d'),'updatedAt']);_0x5b195a=_[_0x7aa4('0x2b')](_['keys'](_0x4d1f53),[_0x7aa4('0x2d'),_0x7aa4('0x2e'),_0x7aa4('0x2f'),_0x7aa4('0x30')]);if(_0x31da28['body']['id']){delete _0x31da28[_0x7aa4('0x31')]['id'];}if(_[_0x7aa4('0x32')](_0x31da28[_0x7aa4('0x31')][_0x7aa4('0x33')])){throw new db[(_0x7aa4('0x28'))]['ValidationError'](_0x7aa4('0x34'));}if(_['isNil'](_0x31da28['body'][_0x7aa4('0x31')])||_0x31da28['body'][_0x7aa4('0x31')]===''){throw new db[(_0x7aa4('0x28'))]['ValidationError'](_0x7aa4('0x35'));}if(_['isNil'](_0x31da28['body']['mapKey'])){throw new db['Sequelize'][(_0x7aa4('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b195a);}if(!_[_0x7aa4('0x36')](_0x5b195a,_0x31da28[_0x7aa4('0x31')][_0x7aa4('0x37')])){throw new db[(_0x7aa4('0x28'))][(_0x7aa4('0x29'))](_0x7aa4('0x38')+_0x5b195a);}_0x1d8ed5[_0x31da28['body']['mapKey']]=_0x31da28['body'][_0x7aa4('0x33')];})[_0x7aa4('0xe')](function(){return db['FaxAccount'][_0x7aa4('0x39')]({'where':{'id':_0x31da28['account']['id']},'include':[{'model':db['CmList'],'as':_0x7aa4('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1d8ed5,'limit':0x1,'order':[[_0x7aa4('0x2e'),_0x7aa4('0x3b')]]}]},{'model':db[_0x7aa4('0x3c')],'as':_0x7aa4('0x3d')}]});})[_0x7aa4('0xe')](function(_0x209a06){if(_0x209a06&&_0x209a06[_0x7aa4('0x3a')]){var _0x3fcb09=_0x209a06[_0x7aa4('0x3e')]({'plain':!![]});_0x479f20[_0x7aa4('0x3f')]=_0x3fcb09;_0x479f20[_0x7aa4('0x40')]=_0x3fcb09[_0x7aa4('0x3d')];_0x479f20[_0x7aa4('0x41')]=_0x3fcb09[_0x7aa4('0x3a')];_0x479f20[_0x7aa4('0x40')]=_[_0x7aa4('0x42')](_0x479f20[_0x7aa4('0x40')],[_0x7aa4('0x43')],['asc']);if(_0x479f20[_0x7aa4('0x3f')][_0x7aa4('0x3d')]){delete _0x479f20[_0x7aa4('0x3f')]['Applications'];}if(_0x479f20[_0x7aa4('0x3f')]['List']&&_0x479f20['account'][_0x7aa4('0x3a')][_0x7aa4('0x44')][_0x7aa4('0x45')]){return _0x479f20['account'][_0x7aa4('0x3a')][_0x7aa4('0x44')][0x0];}var _0x183673=_[_0x7aa4('0x8')](_0x31da28[_0x7aa4('0x31')],{'firstName':_0x31da28[_0x7aa4('0x31')][_0x7aa4('0x33')],'ListId':_0x3fcb09[_0x7aa4('0x30')]});_0x183673[_0x31da28[_0x7aa4('0x31')][_0x7aa4('0x37')]]=_0x31da28[_0x7aa4('0x31')][_0x7aa4('0x33')];return db['CmContact'][_0x7aa4('0x46')](_0x183673,{'fields':_0x24e6b3,'raw':!![]});}})['then'](function(_0x23098c){_0x479f20[_0x7aa4('0x47')]=_0x23098c;if(_0x23098c){var _0x75bbc8={'ContactId':_0x23098c['id'],'FaxAccountId':_0x31da28[_0x7aa4('0x3f')]['id'],'fax':_0x23098c[_0x7aa4('0x48')]};return db[_0x7aa4('0x49')][_0x7aa4('0x39')]({'where':{'ContactId':_0x23098c['id'],'closed':![],'FaxAccountId':_0x31da28['account']['id']}})['then'](function(_0x112e09){if(_0x112e09){return[_0x112e09,![]];}return db['FaxInteraction'][_0x7aa4('0x46')](_0x75bbc8)[_0x7aa4('0xe')](function(_0x21fd5a){return[_0x21fd5a,!![]];});});}else{throw new Error(_0x7aa4('0x4a'));}})['spread'](function(_0x1e4c86,_0x10a581){var _0x6703fd=_0x1e4c86['get']({'plain':!![]});if(_0x10a581){if(_0x479f20[_0x7aa4('0x3f')][_0x7aa4('0x4b')]){_0x479f20[_0x7aa4('0x40')][_0x7aa4('0x4c')]({'id':0x0,'priority':_0x479f20[_0x7aa4('0x40')][_0x7aa4('0x45')]+0x1,'app':_0x7aa4('0x4d'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x6703fd[_0x7aa4('0x4e')]=!![];}else{_0x6703fd[_0x7aa4('0x4e')]=![];}_0x479f20[_0x7aa4('0x4f')]=_0x6703fd;return db[_0x7aa4('0x50')][_0x7aa4('0x46')]({'body':_0x31da28[_0x7aa4('0x31')]['body'],'FaxAccountId':_0x31da28[_0x7aa4('0x3f')]['id'],'FaxInteractionId':_0x1e4c86['id'],'direction':'in','ContactId':_0x1e4c86[_0x7aa4('0x51')],'AttachmentId':_0x31da28[_0x7aa4('0x31')][_0x7aa4('0x52')]});})[_0x7aa4('0xe')](function(_0x3bc1f2){_0x479f20['message']=_0x3bc1f2;if(_0x479f20[_0x7aa4('0x4f')]['UserId']){return db[_0x7aa4('0x53')][_0x7aa4('0x39')]({'attributes':['id',_0x7aa4('0x54')],'where':{'id':_0x479f20['interaction'][_0x7aa4('0x55')]}})['then'](function(_0x141a01){if(_0x141a01){_0x479f20[_0x7aa4('0x40')][_0x7aa4('0x56')]({'id':0x0,'priority':0x0,'app':_0x7aa4('0x57'),'appdata':_0x141a01[_0x7aa4('0x54')]+','+(_0x479f20[_0x7aa4('0x3f')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7aa4('0x58'),_0x7aa4('0x59'),_0x479f20);});}return respondWithRpcPromise(_0x7aa4('0x58'),_0x7aa4('0x59'),_0x479f20);})[_0x7aa4('0xe')](function(_0x289b40){_0x1b3eec(_0x289b40);})['catch'](function(_0x598e7d){_0x34b862(_0x10b79b[_0x7aa4('0x15')](0x1f4,_0x598e7d[_0x7aa4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a70b9ca..a842e3c 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 _0x4a05=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x28366e,_0x2ac7e1){var _0x37637b=function(_0x1c9257){while(--_0x1c9257){_0x28366e['push'](_0x28366e['shift']());}};_0x37637b(++_0x2ac7e1);}(_0x4a05,0x175));var _0x54a0=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x4a05[_0x1d9163];return _0xb42197;};'use strict';var FaxAccountEvents=require(_0x54a0('0x0'));var events=[_0x54a0('0x1'),_0x54a0('0x2'),_0x54a0('0x3')];function createListener(_0x14b343,_0x4a3590){return function(_0x4624fd){_0x4a3590[_0x54a0('0x4')](_0x14b343,_0x4624fd);};}function removeListener(_0x32ff8,_0x35505c){return function(){FaxAccountEvents[_0x54a0('0x5')](_0x32ff8,_0x35505c);};}exports[_0x54a0('0x6')]=function(_0x5aa72a){for(var _0x4fdd48=0x0,_0x269445=events[_0x54a0('0x7')];_0x4fdd48<_0x269445;_0x4fdd48++){var _0xbabef3=events[_0x4fdd48];var _0x43bb04=createListener(_0x54a0('0x8')+_0xbabef3,_0x5aa72a);FaxAccountEvents['on'](_0xbabef3,_0x43bb04);}}; \ No newline at end of file +var _0x253b=['removeListener','register','length','faxAccount:','./faxAccount.events','save','update'];(function(_0x56106b,_0x4fbe47){var _0x1d64ef=function(_0x1fa923){while(--_0x1fa923){_0x56106b['push'](_0x56106b['shift']());}};_0x1d64ef(++_0x4fbe47);}(_0x253b,0x6d));var _0xb253=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x253b[_0x14add3];return _0x4a174f;};'use strict';var FaxAccountEvents=require(_0xb253('0x0'));var events=[_0xb253('0x1'),'remove',_0xb253('0x2')];function createListener(_0x24168c,_0x20ed80){return function(_0xd848a5){_0x20ed80['emit'](_0x24168c,_0xd848a5);};}function removeListener(_0x4499ad,_0x1d1740){return function(){FaxAccountEvents[_0xb253('0x3')](_0x4499ad,_0x1d1740);};}exports[_0xb253('0x4')]=function(_0x48ac1a){for(var _0x223d30=0x0,_0x5a0d60=events[_0xb253('0x5')];_0x223d30<_0x5a0d60;_0x223d30++){var _0x4b8ff0=events[_0x223d30];var _0x10f173=createListener(_0xb253('0x6')+_0x4b8ff0,_0x48ac1a);FaxAccountEvents['on'](_0x4b8ff0,_0x10f173);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e75547b..5b0250d 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(_0x2fbdd5,_0x389146){var _0x3eb861=function(_0x38feed){while(--_0x38feed){_0x2fbdd5['push'](_0x2fbdd5['shift']());}};_0x3eb861(++_0x389146);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x3e0083,_0x52824e){var _0x1cd002=function(_0x210772){while(--_0x210772){_0x3e0083['push'](_0x3e0083['shift']());}};_0x1cd002(++_0x52824e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 1463795..4bed56b 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 _0x49ca=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x49ca,0x106));var _0xa49c=function(_0x16e4a2,_0x448a3d){_0x16e4a2=_0x16e4a2-0x0;var _0x430bd8=_0x49ca[_0x16e4a2];return _0x430bd8;};'use strict';var Sequelize=require(_0xa49c('0x0'));module[_0xa49c('0x1')]={'priority':{'type':Sequelize[_0xa49c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa49c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa49c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa49c('0x4')}}; \ No newline at end of file +var _0x7a6c=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x1d4aca,_0x33d411){var _0x53bbba=function(_0x187d94){while(--_0x187d94){_0x1d4aca['push'](_0x1d4aca['shift']());}};_0x53bbba(++_0x33d411);}(_0x7a6c,0x13f));var _0xc7a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc7a6('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc7a6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc7a6('0x2')],'allowNull':![],'defaultValue':_0xc7a6('0x3')},'appdata':{'type':Sequelize[_0xc7a6('0x4')]()},'description':{'type':Sequelize[_0xc7a6('0x2')]},'interval':{'type':Sequelize[_0xc7a6('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a39fa87..8c50a17 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 _0x5860=['name','send','index','map','FaxApplication','fieldName','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','rawAttributes','find','catch','create','body','destroy','zip-dir','request-promise','bluebird','util','path','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','apply','reject','update','then'];(function(_0x357fd2,_0x302156){var _0x4b4a0e=function(_0x59de8b){while(--_0x59de8b){_0x357fd2['push'](_0x357fd2['shift']());}};_0x4b4a0e(++_0x302156);}(_0x5860,0x9f));var _0x0586=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x5860[_0x35d8af];return _0x1d08b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0586('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0586('0x1'));var moment=require('moment');var BPromise=require(_0x0586('0x2'));var Mustache=require('mustache');var util=require(_0x0586('0x3'));var path=require(_0x0586('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0586('0x5'));var _=require(_0x0586('0x6'));var squel=require(_0x0586('0x7'));var crypto=require(_0x0586('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0586('0x9'));var querystring=require(_0x0586('0xa'));var Papa=require(_0x0586('0xb'));var Redis=require(_0x0586('0xc'));var authService=require(_0x0586('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0586('0xe'));var logger=require('../../config/logger')(_0x0586('0xf'));var utils=require(_0x0586('0x10'));var config=require(_0x0586('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x0586('0x12'))['db'];function respondWithStatusCode(_0x3f23b6,_0x27a3ca){_0x27a3ca=_0x27a3ca||0xcc;return function(_0x2928b0){if(_0x2928b0){return _0x3f23b6[_0x0586('0x13')](_0x27a3ca);}return _0x3f23b6[_0x0586('0x14')](_0x27a3ca)[_0x0586('0x15')]();};}function respondWithResult(_0x43c8a6,_0x70dd3e){_0x70dd3e=_0x70dd3e||0xc8;return function(_0x4fdf01){if(_0x4fdf01){return _0x43c8a6['status'](_0x70dd3e)['json'](_0x4fdf01);}};}function respondWithFilteredResult(_0x583b76,_0x46b0cc){return function(_0x3e7003){if(_0x3e7003){var _0x242bad=typeof _0x46b0cc[_0x0586('0x16')]===_0x0586('0x17')&&typeof _0x46b0cc['limit']===_0x0586('0x17');var _0x28b977=_0x3e7003[_0x0586('0x18')];var _0x35e96c=_0x242bad?0x0:_0x46b0cc[_0x0586('0x16')];var _0x241ad2=_0x242bad?_0x3e7003['count']:_0x46b0cc[_0x0586('0x16')]+_0x46b0cc[_0x0586('0x19')];var _0x1c3227;if(_0x241ad2>=_0x28b977){_0x241ad2=_0x28b977;_0x1c3227=0xc8;}else{_0x1c3227=0xce;}_0x583b76['status'](_0x1c3227);return _0x583b76['set']('Content-Range',_0x35e96c+'-'+_0x241ad2+'/'+_0x28b977)['json'](_0x3e7003);}return null;};}function patchUpdates(_0x5a21ef){return function(_0x592165){try{jsonpatch[_0x0586('0x1a')](_0x592165,_0x5a21ef,!![]);}catch(_0x426c6d){return BPromise[_0x0586('0x1b')](_0x426c6d);}return _0x592165['save']();};}function saveUpdates(_0x1d4103,_0x3efd84){return function(_0xfdc776){if(_0xfdc776){return _0xfdc776[_0x0586('0x1c')](_0x1d4103)[_0x0586('0x1d')](function(_0x4ae0af){return _0x4ae0af;});}return null;};}function removeEntity(_0x2559fd,_0x469668){return function(_0x1b0a29){if(_0x1b0a29){return _0x1b0a29['destroy']()[_0x0586('0x1d')](function(){_0x2559fd[_0x0586('0x14')](0xcc)[_0x0586('0x15')]();});}};}function handleEntityNotFound(_0x6346bb,_0x13fb08){return function(_0x3d703a){if(!_0x3d703a){_0x6346bb['sendStatus'](0x194);}return _0x3d703a;};}function handleError(_0x4c0905,_0x439f3b){_0x439f3b=_0x439f3b||0x1f4;return function(_0x1d508c){logger['error'](_0x1d508c['stack']);if(_0x1d508c['name']){delete _0x1d508c[_0x0586('0x1e')];}_0x4c0905[_0x0586('0x14')](_0x439f3b)[_0x0586('0x1f')](_0x1d508c);};}exports[_0x0586('0x20')]=function(_0x462ce9,_0x58cb5e){var _0x1a1db8={},_0x508bd8={},_0x20d835={'count':0x0,'rows':[]};var _0x52eb8f=_[_0x0586('0x21')](db[_0x0586('0x22')]['rawAttributes'],function(_0x236914){return{'name':_0x236914[_0x0586('0x23')],'type':_0x236914['type']['key']};});_0x508bd8['model']=_[_0x0586('0x21')](_0x52eb8f,_0x0586('0x1e'));_0x508bd8[_0x0586('0x24')]=_[_0x0586('0x25')](_0x462ce9[_0x0586('0x24')]);_0x508bd8[_0x0586('0x26')]=_[_0x0586('0x27')](_0x508bd8[_0x0586('0x28')],_0x508bd8[_0x0586('0x24')]);_0x1a1db8[_0x0586('0x29')]=_[_0x0586('0x27')](_0x508bd8[_0x0586('0x28')],qs[_0x0586('0x2a')](_0x462ce9['query'][_0x0586('0x2a')]));_0x1a1db8[_0x0586('0x29')]=_0x1a1db8[_0x0586('0x29')][_0x0586('0x2b')]?_0x1a1db8[_0x0586('0x29')]:_0x508bd8[_0x0586('0x28')];if(!_0x462ce9[_0x0586('0x24')]['hasOwnProperty']('nolimit')){_0x1a1db8['limit']=qs[_0x0586('0x19')](_0x462ce9[_0x0586('0x24')]['limit']);_0x1a1db8['offset']=qs[_0x0586('0x16')](_0x462ce9[_0x0586('0x24')][_0x0586('0x16')]);}_0x1a1db8[_0x0586('0x2c')]=qs[_0x0586('0x2d')](_0x462ce9[_0x0586('0x24')][_0x0586('0x2d')]);_0x1a1db8[_0x0586('0x2e')]=qs[_0x0586('0x26')](_[_0x0586('0x2f')](_0x462ce9[_0x0586('0x24')],_0x508bd8['filters']),_0x52eb8f);if(_0x462ce9[_0x0586('0x24')][_0x0586('0x30')]){_0x1a1db8['where']=_[_0x0586('0x31')](_0x1a1db8['where'],{'$or':_['map'](_0x52eb8f,function(_0x3a2b28){if(_0x3a2b28[_0x0586('0x32')]!==_0x0586('0x33')){var _0xbd2296={};_0xbd2296[_0x3a2b28[_0x0586('0x1e')]]={'$like':'%'+_0x462ce9[_0x0586('0x24')][_0x0586('0x30')]+'%'};return _0xbd2296;}})});}_0x1a1db8=_[_0x0586('0x31')]({},_0x1a1db8,_0x462ce9[_0x0586('0x34')]);var _0xa35a8c={'where':_0x1a1db8[_0x0586('0x2e')]};return db[_0x0586('0x22')][_0x0586('0x18')](_0xa35a8c)[_0x0586('0x1d')](function(_0x5e20ee){_0x20d835['count']=_0x5e20ee;if(_0x462ce9['query']['includeAll']){_0x1a1db8[_0x0586('0x35')]=[{'all':!![]}];}return db[_0x0586('0x22')][_0x0586('0x36')](_0x1a1db8);})[_0x0586('0x1d')](function(_0x4c103c){_0x20d835['rows']=_0x4c103c;return _0x20d835;})[_0x0586('0x1d')](respondWithFilteredResult(_0x58cb5e,_0x1a1db8))['catch'](handleError(_0x58cb5e,null));};exports[_0x0586('0x37')]=function(_0x35e4a6,_0x1597cd){var _0x169e7b={'raw':!![],'where':{'id':_0x35e4a6[_0x0586('0x38')]['id']}},_0x4d3467={};_0x4d3467[_0x0586('0x28')]=_['keys'](db[_0x0586('0x22')][_0x0586('0x39')]);_0x4d3467[_0x0586('0x24')]=_[_0x0586('0x25')](_0x35e4a6[_0x0586('0x24')]);_0x4d3467[_0x0586('0x26')]=_[_0x0586('0x27')](_0x4d3467[_0x0586('0x28')],_0x4d3467['query']);_0x169e7b['attributes']=_[_0x0586('0x27')](_0x4d3467[_0x0586('0x28')],qs[_0x0586('0x2a')](_0x35e4a6['query'][_0x0586('0x2a')]));_0x169e7b['attributes']=_0x169e7b[_0x0586('0x29')]['length']?_0x169e7b[_0x0586('0x29')]:_0x4d3467[_0x0586('0x28')];if(_0x35e4a6['query']['includeAll']){_0x169e7b[_0x0586('0x35')]=[{'all':!![]}];}_0x169e7b=_[_0x0586('0x31')]({},_0x169e7b,_0x35e4a6[_0x0586('0x34')]);return db[_0x0586('0x22')][_0x0586('0x3a')](_0x169e7b)[_0x0586('0x1d')](handleEntityNotFound(_0x1597cd,null))['then'](respondWithResult(_0x1597cd,null))[_0x0586('0x3b')](handleError(_0x1597cd,null));};exports['create']=function(_0x598804,_0x4f7645){return db[_0x0586('0x22')][_0x0586('0x3c')](_0x598804[_0x0586('0x3d')],{})[_0x0586('0x1d')](respondWithResult(_0x4f7645,0xc9))['catch'](handleError(_0x4f7645,null));};exports[_0x0586('0x1c')]=function(_0x96b665,_0x2dd8f){if(_0x96b665[_0x0586('0x3d')]['id']){delete _0x96b665['body']['id'];}return db[_0x0586('0x22')][_0x0586('0x3a')]({'where':{'id':_0x96b665['params']['id']}})['then'](handleEntityNotFound(_0x2dd8f,null))[_0x0586('0x1d')](saveUpdates(_0x96b665[_0x0586('0x3d')],null))[_0x0586('0x1d')](respondWithResult(_0x2dd8f,null))[_0x0586('0x3b')](handleError(_0x2dd8f,null));};exports[_0x0586('0x3e')]=function(_0x20aaee,_0x139e7d){return db[_0x0586('0x22')][_0x0586('0x3a')]({'where':{'id':_0x20aaee[_0x0586('0x38')]['id']}})['then'](handleEntityNotFound(_0x139e7d,null))[_0x0586('0x1d')](removeEntity(_0x139e7d,null))[_0x0586('0x3b')](handleError(_0x139e7d,null));}; \ No newline at end of file +var _0x786e=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','update','then','end','stack','name','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','VIRTUAL','options','includeAll','include','catch','show','find','create','body','destroy','params','eml-format','rimraf','zip-dir','request-promise','sox','to-csv','ejs','squel'];(function(_0x47ff13,_0x36ef7a){var _0x1252c5=function(_0x1f5f5c){while(--_0x1f5f5c){_0x47ff13['push'](_0x47ff13['shift']());}};_0x1252c5(++_0x36ef7a);}(_0x786e,0x7c));var _0xe786=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x786e[_0x26da89];return _0xc95b7b;};'use strict';var emlformat=require(_0xe786('0x0'));var rimraf=require(_0xe786('0x1'));var zipdir=require(_0xe786('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe786('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe786('0x4'));var csv=require(_0xe786('0x5'));var ejs=require(_0xe786('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe786('0x7'));var crypto=require(_0xe786('0x8'));var jsforce=require(_0xe786('0x9'));var deskjs=require(_0xe786('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe786('0xb'));var Redis=require('ioredis');var authService=require(_0xe786('0xc'));var qs=require(_0xe786('0xd'));var as=require(_0xe786('0xe'));var hardwareService=require(_0xe786('0xf'));var logger=require('../../config/logger')(_0xe786('0x10'));var utils=require(_0xe786('0x11'));var config=require(_0xe786('0x12'));var licenseUtil=require(_0xe786('0x13'));var db=require(_0xe786('0x14'))['db'];function respondWithStatusCode(_0x3aa054,_0x17e698){_0x17e698=_0x17e698||0xcc;return function(_0x55c87e){if(_0x55c87e){return _0x3aa054[_0xe786('0x15')](_0x17e698);}return _0x3aa054[_0xe786('0x16')](_0x17e698)['end']();};}function respondWithResult(_0x42b160,_0x7f681b){_0x7f681b=_0x7f681b||0xc8;return function(_0x519649){if(_0x519649){return _0x42b160[_0xe786('0x16')](_0x7f681b)['json'](_0x519649);}};}function respondWithFilteredResult(_0x271f76,_0x1c7008){return function(_0x611193){if(_0x611193){var _0x5b5a9c=typeof _0x1c7008[_0xe786('0x17')]===_0xe786('0x18')&&typeof _0x1c7008[_0xe786('0x19')]===_0xe786('0x18');var _0x11428e=_0x611193['count'];var _0x1085fb=_0x5b5a9c?0x0:_0x1c7008['offset'];var _0x960fcd=_0x5b5a9c?_0x611193[_0xe786('0x1a')]:_0x1c7008['offset']+_0x1c7008[_0xe786('0x19')];var _0x18d1a0;if(_0x960fcd>=_0x11428e){_0x960fcd=_0x11428e;_0x18d1a0=0xc8;}else{_0x18d1a0=0xce;}_0x271f76['status'](_0x18d1a0);return _0x271f76['set'](_0xe786('0x1b'),_0x1085fb+'-'+_0x960fcd+'/'+_0x11428e)[_0xe786('0x1c')](_0x611193);}return null;};}function patchUpdates(_0x2b0d44){return function(_0x2088e7){try{jsonpatch['apply'](_0x2088e7,_0x2b0d44,!![]);}catch(_0x2d7251){return BPromise[_0xe786('0x1d')](_0x2d7251);}return _0x2088e7['save']();};}function saveUpdates(_0x4cc4d0,_0x55d101){return function(_0x32c40f){if(_0x32c40f){return _0x32c40f[_0xe786('0x1e')](_0x4cc4d0)['then'](function(_0x546adf){return _0x546adf;});}return null;};}function removeEntity(_0x8856de,_0x53159d){return function(_0x557202){if(_0x557202){return _0x557202['destroy']()[_0xe786('0x1f')](function(){_0x8856de['status'](0xcc)[_0xe786('0x20')]();});}};}function handleEntityNotFound(_0x404e6d,_0x2cad1a){return function(_0x12e3a7){if(!_0x12e3a7){_0x404e6d[_0xe786('0x15')](0x194);}return _0x12e3a7;};}function handleError(_0x588012,_0x42a6ac){_0x42a6ac=_0x42a6ac||0x1f4;return function(_0x46e8e5){logger['error'](_0x46e8e5[_0xe786('0x21')]);if(_0x46e8e5[_0xe786('0x22')]){delete _0x46e8e5[_0xe786('0x22')];}_0x588012['status'](_0x42a6ac)['send'](_0x46e8e5);};}exports['index']=function(_0x8b47c1,_0x7276c3){var _0x5c2729={},_0x1dfc78={},_0x503a86={'count':0x0,'rows':[]};var _0x576ced=_[_0xe786('0x23')](db[_0xe786('0x24')][_0xe786('0x25')],function(_0x3939ae){return{'name':_0x3939ae[_0xe786('0x26')],'type':_0x3939ae[_0xe786('0x27')][_0xe786('0x28')]};});_0x1dfc78[_0xe786('0x29')]=_[_0xe786('0x23')](_0x576ced,'name');_0x1dfc78[_0xe786('0x2a')]=_['keys'](_0x8b47c1[_0xe786('0x2a')]);_0x1dfc78['filters']=_[_0xe786('0x2b')](_0x1dfc78[_0xe786('0x29')],_0x1dfc78['query']);_0x5c2729[_0xe786('0x2c')]=_['intersection'](_0x1dfc78[_0xe786('0x29')],qs[_0xe786('0x2d')](_0x8b47c1[_0xe786('0x2a')][_0xe786('0x2d')]));_0x5c2729[_0xe786('0x2c')]=_0x5c2729[_0xe786('0x2c')][_0xe786('0x2e')]?_0x5c2729['attributes']:_0x1dfc78[_0xe786('0x29')];if(!_0x8b47c1[_0xe786('0x2a')][_0xe786('0x2f')](_0xe786('0x30'))){_0x5c2729[_0xe786('0x19')]=qs[_0xe786('0x19')](_0x8b47c1[_0xe786('0x2a')][_0xe786('0x19')]);_0x5c2729[_0xe786('0x17')]=qs[_0xe786('0x17')](_0x8b47c1[_0xe786('0x2a')][_0xe786('0x17')]);}_0x5c2729[_0xe786('0x31')]=qs[_0xe786('0x32')](_0x8b47c1[_0xe786('0x2a')][_0xe786('0x32')]);_0x5c2729['where']=qs['filters'](_[_0xe786('0x33')](_0x8b47c1[_0xe786('0x2a')],_0x1dfc78[_0xe786('0x34')]),_0x576ced);if(_0x8b47c1['query']['filter']){_0x5c2729['where']=_[_0xe786('0x35')](_0x5c2729[_0xe786('0x36')],{'$or':_['map'](_0x576ced,function(_0x4c1059){if(_0x4c1059['type']!==_0xe786('0x37')){var _0x2b7ec7={};_0x2b7ec7[_0x4c1059['name']]={'$like':'%'+_0x8b47c1['query']['filter']+'%'};return _0x2b7ec7;}})});}_0x5c2729=_['merge']({},_0x5c2729,_0x8b47c1[_0xe786('0x38')]);var _0x50f1d3={'where':_0x5c2729[_0xe786('0x36')]};return db[_0xe786('0x24')][_0xe786('0x1a')](_0x50f1d3)[_0xe786('0x1f')](function(_0x2eab9f){_0x503a86[_0xe786('0x1a')]=_0x2eab9f;if(_0x8b47c1['query'][_0xe786('0x39')]){_0x5c2729[_0xe786('0x3a')]=[{'all':!![]}];}return db[_0xe786('0x24')]['findAll'](_0x5c2729);})['then'](function(_0x482080){_0x503a86['rows']=_0x482080;return _0x503a86;})[_0xe786('0x1f')](respondWithFilteredResult(_0x7276c3,_0x5c2729))[_0xe786('0x3b')](handleError(_0x7276c3,null));};exports[_0xe786('0x3c')]=function(_0x59e10f,_0x455548){var _0x526e68={'raw':!![],'where':{'id':_0x59e10f['params']['id']}},_0x354040={};_0x354040[_0xe786('0x29')]=_['keys'](db[_0xe786('0x24')][_0xe786('0x25')]);_0x354040[_0xe786('0x2a')]=_['keys'](_0x59e10f[_0xe786('0x2a')]);_0x354040[_0xe786('0x34')]=_[_0xe786('0x2b')](_0x354040[_0xe786('0x29')],_0x354040[_0xe786('0x2a')]);_0x526e68[_0xe786('0x2c')]=_[_0xe786('0x2b')](_0x354040['model'],qs[_0xe786('0x2d')](_0x59e10f['query'][_0xe786('0x2d')]));_0x526e68[_0xe786('0x2c')]=_0x526e68['attributes'][_0xe786('0x2e')]?_0x526e68[_0xe786('0x2c')]:_0x354040[_0xe786('0x29')];if(_0x59e10f[_0xe786('0x2a')][_0xe786('0x39')]){_0x526e68['include']=[{'all':!![]}];}_0x526e68=_[_0xe786('0x35')]({},_0x526e68,_0x59e10f[_0xe786('0x38')]);return db['FaxApplication'][_0xe786('0x3d')](_0x526e68)['then'](handleEntityNotFound(_0x455548,null))[_0xe786('0x1f')](respondWithResult(_0x455548,null))[_0xe786('0x3b')](handleError(_0x455548,null));};exports['create']=function(_0x3cd04a,_0x311316){return db[_0xe786('0x24')][_0xe786('0x3e')](_0x3cd04a['body'],{})[_0xe786('0x1f')](respondWithResult(_0x311316,0xc9))[_0xe786('0x3b')](handleError(_0x311316,null));};exports[_0xe786('0x1e')]=function(_0x5137e8,_0x3dbda3){if(_0x5137e8[_0xe786('0x3f')]['id']){delete _0x5137e8[_0xe786('0x3f')]['id'];}return db[_0xe786('0x24')]['find']({'where':{'id':_0x5137e8['params']['id']}})[_0xe786('0x1f')](handleEntityNotFound(_0x3dbda3,null))[_0xe786('0x1f')](saveUpdates(_0x5137e8[_0xe786('0x3f')],null))['then'](respondWithResult(_0x3dbda3,null))['catch'](handleError(_0x3dbda3,null));};exports[_0xe786('0x40')]=function(_0x27c4da,_0x40b8a4){return db[_0xe786('0x24')][_0xe786('0x3d')]({'where':{'id':_0x27c4da[_0xe786('0x41')]['id']}})[_0xe786('0x1f')](handleEntityNotFound(_0x40b8a4,null))['then'](removeEntity(_0x40b8a4,null))[_0xe786('0x3b')](handleError(_0x40b8a4,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bb5741e..fabb33b 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 _0x6b5f=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x510be7,_0x2eba08){var _0x17af2d=function(_0x56b567){while(--_0x56b567){_0x510be7['push'](_0x510be7['shift']());}};_0x17af2d(++_0x2eba08);}(_0x6b5f,0x153));var _0xf6b5=function(_0x1d79e8,_0x25b4cd){_0x1d79e8=_0x1d79e8-0x0;var _0x5b484d=_0x6b5f[_0x1d79e8];return _0x5b484d;};'use strict';var _=require(_0xf6b5('0x0'));var util=require(_0xf6b5('0x1'));var logger=require('../../config/logger')(_0xf6b5('0x2'));var moment=require(_0xf6b5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6b5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6b5('0x5'));var config=require(_0xf6b5('0x6'));var attributes=require('./faxApplication.attributes');module[_0xf6b5('0x7')]=function(_0x3167d4,_0x3ca089){return _0x3167d4[_0xf6b5('0x8')]('FaxApplication',attributes,{'tableName':_0xf6b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6b5('0xa'),'collate':_0xf6b5('0xb')});}; \ No newline at end of file +var _0x4d13=['exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x1384c6,_0x1e8085){var _0x131809=function(_0x29763b){while(--_0x29763b){_0x1384c6['push'](_0x1384c6['shift']());}};_0x131809(++_0x1e8085);}(_0x4d13,0xe6));var _0x34d1=function(_0x128931,_0x1fd40d){_0x128931=_0x128931-0x0;var _0x560ccb=_0x4d13[_0x128931];return _0x560ccb;};'use strict';var _=require(_0x34d1('0x0'));var util=require(_0x34d1('0x1'));var logger=require(_0x34d1('0x2'))(_0x34d1('0x3'));var moment=require(_0x34d1('0x4'));var BPromise=require(_0x34d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34d1('0x6'));var rimraf=require(_0x34d1('0x7'));var config=require(_0x34d1('0x8'));var attributes=require(_0x34d1('0x9'));module[_0x34d1('0xa')]=function(_0x1fcb6d,_0x49153d){return _0x1fcb6d[_0x34d1('0xb')]('FaxApplication',attributes,{'tableName':_0x34d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x34d1('0xd'),'collate':_0x34d1('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 2f275bc..9bdb8fc 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 _0x95c3=['limit','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x95c3,0xfb));var _0x395c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x95c3[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x395c('0x0'));var util=require('util');var moment=require(_0x395c('0x1'));var BPromise=require(_0x395c('0x2'));var rs=require(_0x395c('0x3'));var fs=require('fs');var Redis=require(_0x395c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x395c('0x5'))(_0x395c('0x6'));var config=require(_0x395c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x395c('0x8')][_0x395c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4650,_0x59d315,_0x4950ad){return new BPromise(function(_0x509ee0,_0xf993e4){return client[_0x395c('0xa')](_0x2b4650,_0x4950ad)['then'](function(_0xc55a83){logger[_0x395c('0xb')](_0x395c('0xc'),_0x59d315,'request\x20sent');logger[_0x395c('0xd')](_0x395c('0xe'),_0x59d315,_0x395c('0xf'),JSON[_0x395c('0x10')](_0xc55a83));if(_0xc55a83[_0x395c('0x11')]){if(_0xc55a83[_0x395c('0x11')][_0x395c('0x12')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x59d315,_0xc55a83[_0x395c('0x11')][_0x395c('0x13')]);return _0xf993e4(_0xc55a83['error'][_0x395c('0x13')]);}logger[_0x395c('0x11')](_0x395c('0xc'),_0x59d315,_0xc55a83['error'][_0x395c('0x13')]);return _0x509ee0(_0xc55a83[_0x395c('0x11')][_0x395c('0x13')]);}else{logger['info'](_0x395c('0xc'),_0x59d315,_0x395c('0xf'));_0x509ee0(_0xc55a83['result'][_0x395c('0x13')]);}})['catch'](function(_0x1f6f9e){logger[_0x395c('0x11')](_0x395c('0xc'),_0x59d315,_0x1f6f9e);_0xf993e4(_0x1f6f9e);});});}exports[_0x395c('0x14')]=function(_0x2ca8a2){var _0x2203a5=this;return new Promise(function(_0x2998eb,_0x32e2cd){return db[_0x395c('0x15')][_0x395c('0x16')](_0x2ca8a2[_0x395c('0x17')],{'raw':_0x2ca8a2[_0x395c('0x18')]?_0x2ca8a2[_0x395c('0x18')][_0x395c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca8a2[_0x395c('0x18')]?_0x2ca8a2[_0x395c('0x18')][_0x395c('0x1a')]||null:null,'attributes':_0x2ca8a2[_0x395c('0x18')]?_0x2ca8a2['options'][_0x395c('0x1b')]||null:null,'limit':_0x2ca8a2['options']?_0x2ca8a2['options'][_0x395c('0x1c')]||null:null})[_0x395c('0x1d')](function(_0x371c4f){logger[_0x395c('0xb')]('UpdateFaxApplication',_0x2ca8a2);logger[_0x395c('0xd')](_0x395c('0x14'),_0x2ca8a2,JSON[_0x395c('0x10')](_0x371c4f));_0x2998eb(_0x371c4f);})[_0x395c('0x1e')](function(_0x1ac72f){logger[_0x395c('0x11')](_0x395c('0x14'),_0x1ac72f[_0x395c('0x13')],_0x2ca8a2);_0x32e2cd(_0x2203a5['error'](0x1f4,_0x1ac72f[_0x395c('0x13')]));});});}; \ No newline at end of file +var _0xface=['http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','limit','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xface,0x12c));var _0xefac=function(_0x38aaa6,_0x54f2b2){_0x38aaa6=_0x38aaa6-0x0;var _0x2e45e5=_0xface[_0x38aaa6];return _0x2e45e5;};'use strict';var _=require('lodash');var util=require(_0xefac('0x0'));var moment=require('moment');var BPromise=require(_0xefac('0x1'));var rs=require(_0xefac('0x2'));var fs=require('fs');var Redis=require(_0xefac('0x3'));var db=require(_0xefac('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xefac('0x5'));var jayson=require(_0xefac('0x6'));var client=jayson[_0xefac('0x7')][_0xefac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5db987,_0x53f02a,_0x75a95a){return new BPromise(function(_0x358858,_0x5103ee){return client[_0xefac('0x9')](_0x5db987,_0x75a95a)[_0xefac('0xa')](function(_0x490840){logger[_0xefac('0xb')]('FaxApplication,\x20%s,\x20%s',_0x53f02a,_0xefac('0xc'));logger[_0xefac('0xd')](_0xefac('0xe'),_0x53f02a,'request\x20sent',JSON['stringify'](_0x490840));if(_0x490840[_0xefac('0xf')]){if(_0x490840[_0xefac('0xf')]['code']===0x1f4){logger[_0xefac('0xf')](_0xefac('0x10'),_0x53f02a,_0x490840['error'][_0xefac('0x11')]);return _0x5103ee(_0x490840[_0xefac('0xf')]['message']);}logger['error'](_0xefac('0x10'),_0x53f02a,_0x490840[_0xefac('0xf')][_0xefac('0x11')]);return _0x358858(_0x490840['error'][_0xefac('0x11')]);}else{logger[_0xefac('0xb')](_0xefac('0x10'),_0x53f02a,_0xefac('0xc'));_0x358858(_0x490840[_0xefac('0x12')]['message']);}})[_0xefac('0x13')](function(_0x1cd56a){logger[_0xefac('0xf')](_0xefac('0x10'),_0x53f02a,_0x1cd56a);_0x5103ee(_0x1cd56a);});});}exports[_0xefac('0x14')]=function(_0x41b937){var _0x583038=this;return new Promise(function(_0x264662,_0x474b0f){return db[_0xefac('0x15')]['update'](_0x41b937['body'],{'raw':_0x41b937['options']?_0x41b937[_0xefac('0x16')][_0xefac('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41b937['options']?_0x41b937[_0xefac('0x16')][_0xefac('0x18')]||null:null,'attributes':_0x41b937['options']?_0x41b937[_0xefac('0x16')][_0xefac('0x19')]||null:null,'limit':_0x41b937[_0xefac('0x16')]?_0x41b937['options'][_0xefac('0x1a')]||null:null})[_0xefac('0xa')](function(_0x306a53){logger[_0xefac('0xb')](_0xefac('0x14'),_0x41b937);logger[_0xefac('0xd')](_0xefac('0x14'),_0x41b937,JSON[_0xefac('0x1b')](_0x306a53));_0x264662(_0x306a53);})['catch'](function(_0x3e31a7){logger[_0xefac('0xf')](_0xefac('0x14'),_0x3e31a7[_0xefac('0x11')],_0x41b937);_0x474b0f(_0x583038[_0xefac('0xf')](0x1f4,_0x3e31a7[_0xefac('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a849813..726868b 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 _0x0b0e=['./faxApplication.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(_0x503d48,_0x42e5a9){var _0x59743e=function(_0x496dbd){while(--_0x496dbd){_0x503d48['push'](_0x503d48['shift']());}};_0x59743e(++_0x42e5a9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x0b0e[_0x3ed054];return _0x16dd95;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x184c2c,_0x46777d){var _0x356f01=function(_0xfa6fb){while(--_0xfa6fb){_0x184c2c['push'](_0x184c2c['shift']());}};_0x356f01(++_0x46777d);}(_0xa571,0x107));var _0x1a57=function(_0x4f6342,_0x1c54e5){_0x4f6342=_0x4f6342-0x0;var _0xbb2867=_0xa571[_0x4f6342];return _0xbb2867;};'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('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b45cfa4..364ea0e 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 _0xf894=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x5204e2,_0x29981c){var _0x5c51e9=function(_0x206ea1){while(--_0x206ea1){_0x5204e2['push'](_0x5204e2['shift']());}};_0x5c51e9(++_0x29981c);}(_0xf894,0xfd));var _0x4f89=function(_0x2f74cc,_0x4b6531){_0x2f74cc=_0x2f74cc-0x0;var _0x1966cc=_0xf894[_0x2f74cc];return _0x1966cc;};'use strict';var Sequelize=require(_0x4f89('0x0'));module[_0x4f89('0x1')]={'closed':{'type':Sequelize[_0x4f89('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f89('0x3')]},'disposition':{'type':Sequelize[_0x4f89('0x4')]},'secondDisposition':{'type':Sequelize[_0x4f89('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4f89('0x4')]},'note':{'type':Sequelize[_0x4f89('0x4')]},'read1stAt':{'type':Sequelize[_0x4f89('0x3')]},'fax':{'type':Sequelize[_0x4f89('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4f89('0x5')]('in',_0x4f89('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4f89('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4f89('0x5')]('in',_0x4f89('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xf7df=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x153e7d,_0x10a35f){var _0x3c22dd=function(_0x4d33f6){while(--_0x4d33f6){_0x153e7d['push'](_0x153e7d['shift']());}};_0x3c22dd(++_0x10a35f);}(_0xf7df,0x1f0));var _0xff7d=function(_0xe74678,_0x2aa168){_0xe74678=_0xe74678-0x0;var _0x11597e=_0xf7df[_0xe74678];return _0x11597e;};'use strict';var Sequelize=require(_0xff7d('0x0'));module[_0xff7d('0x1')]={'closed':{'type':Sequelize[_0xff7d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xff7d('0x3')]},'secondDisposition':{'type':Sequelize[_0xff7d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xff7d('0x3')]},'note':{'type':Sequelize[_0xff7d('0x3')]},'read1stAt':{'type':Sequelize[_0xff7d('0x4')]},'fax':{'type':Sequelize[_0xff7d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xff7d('0x5')]('in',_0xff7d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xff7d('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xff7d('0x6')),'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 e1a3e76..2feef90 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 _0x64bc=['split','forEach','push','catch','waiting','unmanaged','total','closed','UserId','answered','talking','index','map','FaxInteraction','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','tools_tags','u.fullname','from','user_has_fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','update','describe','FaxMessage','addMessage','ids','findOne','rawAttributes','YYYY-MM-DD\x20HH:mm:ss','findAll','omit','color','faxInteractionTags:save','removeTags','unix','join','root','files','server','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','sendStatus','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','TagIds','Tags'];(function(_0x5e52cd,_0xb33897){var _0x5e367c=function(_0x25f65b){while(--_0x25f65b){_0x5e52cd['push'](_0x5e52cd['shift']());}};_0x5e367c(++_0xb33897);}(_0x64bc,0xa9));var _0xc64b=function(_0x39221a,_0xf9c0c2){_0x39221a=_0x39221a-0x0;var _0x14644d=_0x64bc[_0x39221a];return _0x14644d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc64b('0x0'));var zipdir=require(_0xc64b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc64b('0x2'));var moment=require('moment');var BPromise=require(_0xc64b('0x3'));var Mustache=require(_0xc64b('0x4'));var util=require('util');var path=require(_0xc64b('0x5'));var sox=require(_0xc64b('0x6'));var csv=require(_0xc64b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc64b('0x8'));var _=require(_0xc64b('0x9'));var squel=require(_0xc64b('0xa'));var crypto=require(_0xc64b('0xb'));var jsforce=require(_0xc64b('0xc'));var deskjs=require(_0xc64b('0xd'));var toCsv=require(_0xc64b('0x7'));var querystring=require(_0xc64b('0xe'));var Papa=require(_0xc64b('0xf'));var Redis=require(_0xc64b('0x10'));var authService=require(_0xc64b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc64b('0x12'));var hardwareService=require(_0xc64b('0x13'));var logger=require(_0xc64b('0x14'))('api');var utils=require(_0xc64b('0x15'));var config=require(_0xc64b('0x16'));var licenseUtil=require(_0xc64b('0x17'));var db=require(_0xc64b('0x18'))['db'];config[_0xc64b('0x19')]=_[_0xc64b('0x1a')](config[_0xc64b('0x19')],{'host':_0xc64b('0x1b'),'port':0x18eb});var socket=require(_0xc64b('0x1c'))(new Redis(config[_0xc64b('0x19')]));require(_0xc64b('0x1d'))['register'](socket);function respondWithStatusCode(_0x553b76,_0x4a29dd){_0x4a29dd=_0x4a29dd||0xcc;return function(_0x46d507){if(_0x46d507){return _0x553b76['sendStatus'](_0x4a29dd);}return _0x553b76['status'](_0x4a29dd)[_0xc64b('0x1e')]();};}function respondWithResult(_0x556a28,_0xfc33a){_0xfc33a=_0xfc33a||0xc8;return function(_0x544447){if(_0x544447){return _0x556a28['status'](_0xfc33a)[_0xc64b('0x1f')](_0x544447);}};}function respondWithFilteredResult(_0x5ba5f4,_0x5a0f47){return function(_0x27141c){if(_0x27141c){var _0x22584a=typeof _0x5a0f47['offset']==='undefined'&&typeof _0x5a0f47[_0xc64b('0x20')]===_0xc64b('0x21');var _0x3738e0=_0x27141c[_0xc64b('0x22')];var _0x4100c3=_0x22584a?0x0:_0x5a0f47[_0xc64b('0x23')];var _0x8535bd=_0x22584a?_0x27141c[_0xc64b('0x22')]:_0x5a0f47[_0xc64b('0x23')]+_0x5a0f47[_0xc64b('0x20')];var _0xb12fb0;if(_0x8535bd>=_0x3738e0){_0x8535bd=_0x3738e0;_0xb12fb0=0xc8;}else{_0xb12fb0=0xce;}_0x5ba5f4[_0xc64b('0x24')](_0xb12fb0);return _0x5ba5f4[_0xc64b('0x25')](_0xc64b('0x26'),_0x4100c3+'-'+_0x8535bd+'/'+_0x3738e0)[_0xc64b('0x1f')](_0x27141c);}return null;};}function patchUpdates(_0x2caaae){return function(_0x1b2344){try{jsonpatch[_0xc64b('0x27')](_0x1b2344,_0x2caaae,!![]);}catch(_0x5cf086){return BPromise[_0xc64b('0x28')](_0x5cf086);}return _0x1b2344[_0xc64b('0x29')]();};}function saveUpdates(_0x38be29,_0x43477b){return function(_0x47369b){if(_0x47369b){return _0x47369b['update'](_0x38be29)[_0xc64b('0x2a')](function(_0x4a3ee2){return _0x4a3ee2;});}return null;};}function removeEntity(_0x220560,_0x2e7c0f){return function(_0x4a409f){if(_0x4a409f){return _0x4a409f[_0xc64b('0x2b')]()['then'](function(){_0x220560['status'](0xcc)[_0xc64b('0x1e')]();});}};}function handleEntityNotFound(_0x3f77d7,_0xb84a77){return function(_0x2fe1c5){if(!_0x2fe1c5){_0x3f77d7['sendStatus'](0x194);}return _0x2fe1c5;};}function handleError(_0x266442,_0x4e7ec0){_0x4e7ec0=_0x4e7ec0||0x1f4;return function(_0x23a9f6){logger[_0xc64b('0x2c')](_0x23a9f6[_0xc64b('0x2d')]);if(_0x23a9f6['name']){delete _0x23a9f6[_0xc64b('0x2e')];}_0x266442[_0xc64b('0x24')](_0x4e7ec0)[_0xc64b('0x2f')](_0x23a9f6);};}function getInteractionUsers(_0x130adb,_0x31850c){return new BPromise(function(_0x234e42,_0x49de05){try{if(_0x31850c[_0x130adb['id']]){_0x130adb['Users']=_['map'](_0x31850c[_0x130adb['id']],function(_0x5a05a3){return{'id':_0x5a05a3['id'],'fullname':_0x5a05a3['fullname']};});}}catch(_0x1d8917){_0x49de05(_0x1d8917);}_0x234e42(_0x130adb);});}function getInteractionTags(_0x53b7f9,_0x284010){return new BPromise(function(_0x20e728,_0x388728){try{if(_0x53b7f9[_0xc64b('0x30')]){_0x53b7f9[_0xc64b('0x31')]=[];_0x53b7f9['TagIds'][_0xc64b('0x32')](',')[_0xc64b('0x33')](function(_0x2ed983){_0x53b7f9['Tags'][_0xc64b('0x34')](_0x284010[_0x2ed983]);});}delete _0x53b7f9[_0xc64b('0x30')];}catch(_0x3dcce6){_0x388728(_0x3dcce6);}_0x20e728(_0x53b7f9);});}function updateFaxInteraction(_0x1ad890,_0x4d56f7,_0x2c23f1){return new BPromise(function(_0x3a4ba2,_0x2ddff1){return getInteractionUsers(_0x1ad890,_0x2c23f1)[_0xc64b('0x2a')](function(_0x53192a){return getInteractionTags(_0x53192a,_0x4d56f7);})[_0xc64b('0x2a')](function(_0x5f45e6){return getStateInteraction(_0x5f45e6);})[_0xc64b('0x2a')](function(_0x245253){_0x3a4ba2(_0x245253);})[_0xc64b('0x35')](function(_0x1c700e){_0x2ddff1(_0x1c700e);});});}function getStateInteraction(_0xe8a05f){return new BPromise(function(_0x5f525c){_0xe8a05f[_0xc64b('0x36')]=0x0;_0xe8a05f['talking']=0x0;_0xe8a05f['answered']=0x0;_0xe8a05f[_0xc64b('0x37')]=0x0;_0xe8a05f[_0xc64b('0x38')]=0x0;if(!_0xe8a05f[_0xc64b('0x39')]&&!_0xe8a05f[_0xc64b('0x3a')]){_0xe8a05f['waiting']+=0x1;}if(!_0xe8a05f[_0xc64b('0x39')]&&_0xe8a05f['UserId']){_0xe8a05f['talking']+=0x1;if(_0xe8a05f[_0xc64b('0x36')]){_0xe8a05f[_0xc64b('0x36')]-=0x1;}}if(_0xe8a05f['closed']&&_0xe8a05f[_0xc64b('0x3a')]){_0xe8a05f[_0xc64b('0x3b')]+=0x1;if(_0xe8a05f['talking']){_0xe8a05f[_0xc64b('0x3c')]-=0x1;}}if(_0xe8a05f['closed']&&!_0xe8a05f[_0xc64b('0x3a')]){_0xe8a05f[_0xc64b('0x37')]+=0x1;if(_0xe8a05f['waiting']){_0xe8a05f[_0xc64b('0x36')]-=0x1;}}_0xe8a05f[_0xc64b('0x38')]+=0x1;_0x5f525c(_0xe8a05f);});}exports[_0xc64b('0x3d')]=function(_0x5dbea2,_0x19f54f){var _0x64891a={},_0x17d504={},_0x5bebb7={'count':0x0,'rows':[]};var _0xadab3a=_[_0xc64b('0x3e')](db[_0xc64b('0x3f')]['rawAttributes'],function(_0x3ef760){return{'name':_0x3ef760[_0xc64b('0x40')],'type':_0x3ef760['type'][_0xc64b('0x41')]};});_0x17d504[_0xc64b('0x42')]=_[_0xc64b('0x3e')](_0xadab3a,_0xc64b('0x2e'));_0x17d504[_0xc64b('0x43')]=_[_0xc64b('0x44')](_0x5dbea2[_0xc64b('0x43')]);_0x17d504['filters']=_[_0xc64b('0x45')](_0x17d504[_0xc64b('0x42')],_0x17d504[_0xc64b('0x43')]);_0x64891a[_0xc64b('0x46')]=_['intersection'](_0x17d504[_0xc64b('0x42')],qs['fields'](_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x47')]));_0x64891a['attributes']=_0x64891a[_0xc64b('0x46')][_0xc64b('0x48')]?_0x64891a[_0xc64b('0x46')]:_0x17d504[_0xc64b('0x42')];if(!_0x5dbea2['query'][_0xc64b('0x49')](_0xc64b('0x4a'))){_0x64891a['limit']=qs[_0xc64b('0x20')](_0x5dbea2[_0xc64b('0x43')]['limit']);_0x64891a['offset']=qs[_0xc64b('0x23')](_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x23')]);}_0x64891a[_0xc64b('0x4b')]=qs[_0xc64b('0x4c')](_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x4c')]);_0x64891a[_0xc64b('0x4d')]=qs[_0xc64b('0x4e')](_['pick'](_0x5dbea2[_0xc64b('0x43')],_0x17d504['filters']),_0xadab3a);var _0x5e2570=[];var _0x3cc1cc=squel[_0xc64b('0x4f')]()['field']('id')[_0xc64b('0x50')]('name')['field']('color')['from'](_0xc64b('0x51'));var _0x5cf49e=squel[_0xc64b('0x4f')]()[_0xc64b('0x50')]('u.id')[_0xc64b('0x50')](_0xc64b('0x52'))[_0xc64b('0x50')]('ui.FaxInteractionId')[_0xc64b('0x53')](_0xc64b('0x54'),'ui')[_0xc64b('0x55')]('users','u','u.id\x20=\x20ui.UserId');var _0x1f89d0=squel[_0xc64b('0x4f')]()['from']('fax_interactions','i')[_0xc64b('0x55')](_0xc64b('0x56'),'c',_0xc64b('0x57'))[_0xc64b('0x55')](_0xc64b('0x58'),'o',_0xc64b('0x59'))[_0xc64b('0x55')](_0xc64b('0x5a'),'a',_0xc64b('0x5b'))[_0xc64b('0x55')]('fax_messages','me',_0xc64b('0x5c'))[_0xc64b('0x55')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0xc64b('0x55')](_0xc64b('0x51'),'t',_0xc64b('0x5d'));var _0x351efb=squel['expr']();var _0xf18919=[];var _0x3b0add=squel[_0xc64b('0x5e')]();var _0x3e6977;if(_0x5dbea2[_0xc64b('0x43')]['search']){_0x3e6977=as[_0xc64b('0x5f')](_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x60')]);var _0x50bff7=_0x3e6977['sqlOperator'];for(var _0x151450=0x0;_0x151450<_0x3e6977[_0xc64b('0x61')][_0xc64b('0x48')];_0x151450++){var _0x20877a=_0x3e6977[_0xc64b('0x61')][_0x151450];var _0x3a502f='i';var _0x92efeb=_[_0xc64b('0x62')](_0xadab3a,[_0xc64b('0x2e'),_0x20877a['field']]);if(!_0x92efeb){switch(_0x20877a['field']){case _0xc64b('0x63'):if(_0x20877a[_0xc64b('0x64')]==0x1){_0x1f89d0['having']('`'+_0x20877a[_0xc64b('0x50')]+'`\x20=\x200');}else{_0x1f89d0[_0xc64b('0x65')]('`'+_0x20877a[_0xc64b('0x50')]+'`\x20>\x200');}break;case'Contact':if(_0x20877a['operator']===_0xc64b('0x66')){if(_0x20877a['value'][_0xc64b('0x32')]('\x20')[_0xc64b('0x48')]>0x1){_0x351efb[_0x50bff7](_0xc64b('0x67'),qs[_0xc64b('0x68')](_0x20877a[_0xc64b('0x64')]),null);}else{var _0x537775='%'+_0x20877a[_0xc64b('0x64')]+'%';_0x351efb[_0x50bff7](_0xc64b('0x69'),_0x537775,_0x537775,_0x537775);}}else{_0x92efeb=_['find'](_0xadab3a,[_0xc64b('0x2e'),'ContactId']);_0x20877a[_0xc64b('0x50')]='ContactId';_0x4a6eb7=as[_0xc64b('0x6a')](_0x3a502f,_0x92efeb[_0xc64b('0x6b')],_0x20877a);_0x351efb[_0x50bff7](_0x4a6eb7[_0xc64b('0x6c')],_0x4a6eb7[_0xc64b('0x64')][_0xc64b('0x6d')],_0x4a6eb7[_0xc64b('0x64')][_0xc64b('0x1e')]);}break;case _0xc64b('0x6e'):var _0x5667b0=_0x20877a[_0xc64b('0x64')][_0xc64b('0x32')](',')[_0xc64b('0x3e')](function(_0x4a52a2){return Number(_0x4a52a2);});_0x5667b0['forEach'](function(_0x5d6d7b){_0x3b0add['or'](_0xc64b('0x6f'),'%,'+_0x5d6d7b+',%');});_0xf18919=_[_0xc64b('0x70')](_0xf18919,_0x5667b0);break;case _0xc64b('0x71'):if(_0x20877a['operator']===_0xc64b('0x66')){_0x351efb[_0x50bff7](_0xc64b('0x72'),'%'+_0x20877a['value']+'%',null);}else{_0x92efeb=_[_0xc64b('0x62')](_0xadab3a,['name','UserId']);_0x20877a['field']=_0xc64b('0x3a');_0x4a6eb7=as['buildExpression'](_0x3a502f,_0x92efeb['type'],_0x20877a);_0x351efb[_0x50bff7](_0x4a6eb7[_0xc64b('0x6c')],_0x4a6eb7[_0xc64b('0x64')]['start'],_0x4a6eb7[_0xc64b('0x64')][_0xc64b('0x1e')]);}break;case _0xc64b('0x73'):_0x4a6eb7=as[_0xc64b('0x6a')]('me',null,_0x20877a);_0x351efb[_0x50bff7](_0x4a6eb7['text'],_0x4a6eb7[_0xc64b('0x64')][_0xc64b('0x6d')],_0x4a6eb7[_0xc64b('0x64')][_0xc64b('0x1e')]);break;}}else{var _0x4a6eb7=as[_0xc64b('0x6a')](_0x3a502f,_0x92efeb[_0xc64b('0x6b')],_0x20877a);_0x351efb[_0x50bff7](_0x4a6eb7[_0xc64b('0x6c')],_0x4a6eb7[_0xc64b('0x64')]['start'],_0x4a6eb7[_0xc64b('0x64')][_0xc64b('0x1e')]);}}}else{var _0x1946c3=_(_0x5dbea2[_0xc64b('0x43')])[_0xc64b('0x44')]()['map'](function(_0x6d6cfc){return _[_0xc64b('0x74')](_0xadab3a,[_0xc64b('0x2e'),_0x6d6cfc])?_0x6d6cfc:undefined;})[_0xc64b('0x75')]()[_0xc64b('0x64')]();if(!_['isEmpty'](_0x1946c3)){_0x1946c3[_0xc64b('0x33')](function(_0x25a52d){if(_0x25a52d===_0xc64b('0x76')){_0x1f89d0[_0xc64b('0x4d')](_0xc64b('0x77'),[][_0xc64b('0x78')](_0x5dbea2[_0xc64b('0x43')][_0x25a52d]));}else if(_0x25a52d==='createdAt'){var _0x36b074=JSON['parse'](_0x5dbea2['query'][_0x25a52d])[_0xc64b('0x79')];var _0x14d8ec=JSON[_0xc64b('0x7a')](_0x5dbea2[_0xc64b('0x43')][_0x25a52d])[_0xc64b('0x7b')];_0x1f89d0[_0xc64b('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x36b074,_0x14d8ec);}else{if(_0x5dbea2[_0xc64b('0x43')][_0x25a52d]===_0xc64b('0x7c')){_0x1f89d0[_0xc64b('0x4d')]('i.'+_0x25a52d+_0xc64b('0x7d'));}else{_0x1f89d0['where']('i.'+_0x25a52d+_0xc64b('0x7e'),_0x5dbea2[_0xc64b('0x43')][_0x25a52d]);}}});}if(_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x7f')]){if(_0x5dbea2['query']['read']==0x1){_0x1f89d0[_0xc64b('0x65')](_0xc64b('0x80'));}else{_0x1f89d0[_0xc64b('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x81')]){_0xf18919=_[_0xc64b('0x82')](_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x81')])?_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x81')]:new Array(_0x5dbea2['query'][_0xc64b('0x81')]);_0xf18919['forEach'](function(_0x4dbdb4){_0x3b0add['or'](_0xc64b('0x6f'),'%,'+_0x4dbdb4+',%');});}if(_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x83')]){var _0x21bc20=_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x83')][_0xc64b('0x84')]('\x5c','\x5c\x5c')[_0xc64b('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x21bc20)){_0x351efb['or'](_0xc64b('0x85'),_0x21bc20+'%')['or'](_0xc64b('0x86'),_0x21bc20+'%');}_0x351efb['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x21bc20+'%');}}_0x1f89d0[_0xc64b('0x4d')](_0x351efb);_0x1f89d0[_0xc64b('0x87')]('i.id');var _0x21ceef={'type':db[_0xc64b('0x88')][_0xc64b('0x89')]['SELECT'],'raw':!![]};var _0x50630f=_0x1f89d0[_0xc64b('0x8a')]();_0x50630f['field'](_0xc64b('0x8b'));_0x50630f[_0xc64b('0x50')](_0xc64b('0x8c'),_0xc64b('0x63'));if(_0x64891a[_0xc64b('0x4b')]){_0x64891a[_0xc64b('0x4b')]['forEach'](function(_0x452575){var _0x1cefe8=_0x452575[0x0]===_0xc64b('0x8d')?_0x452575[0x0]:'i.'+_0x452575[0x0];_0x1f89d0[_0xc64b('0x4b')](_0x1cefe8,_0x452575[0x1]===_0xc64b('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0xf18919)){_0x1f89d0[_0xc64b('0x65')](_0x3b0add);_0x50630f[_0xc64b('0x4d')](_0xc64b('0x8f'),_0xf18919);}BPromise[_0xc64b('0x90')]()['then'](function(){if(!_0x3e6977){if(_0x5dbea2[_0xc64b('0x43')]['FaxAccountId'])return;_0x50630f['where'](_0xc64b('0x91'));_0x1f89d0[_0xc64b('0x4d')](_0xc64b('0x91'));return;}if(_0x5dbea2['user'][_0xc64b('0x92')]!==_0xc64b('0x93'))return;return _0x5dbea2[_0xc64b('0x94')][_0xc64b('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2033bf){if(_[_0xc64b('0x96')](_0x2033bf)){_0x50630f[_0xc64b('0x4d')](_0xc64b('0x97'));_0x1f89d0['where'](_0xc64b('0x97'));}else{_0x50630f[_0xc64b('0x4d')](_0xc64b('0x77'),_[_0xc64b('0x3e')](_0x2033bf,'id'));_0x1f89d0['where'](_0xc64b('0x77'),_['map'](_0x2033bf,'id'));}});})[_0xc64b('0x2a')](function(){if(_0x5dbea2[_0xc64b('0x94')][_0xc64b('0x92')]===_0xc64b('0x93')&&!_0x3e6977&&!_0x5dbea2[_0xc64b('0x43')][_0xc64b('0x76')])return[];return db['sequelize']['query'](_0x50630f[_0xc64b('0x98')](),_0x21ceef);})[_0xc64b('0x2a')](function(_0x5d2eec){_0x5bebb7['count']=_0x5d2eec[_0xc64b('0x48')];if(_0x5bebb7[_0xc64b('0x22')]===0x0)return[];return db[_0xc64b('0x99')][_0xc64b('0x43')](_0x3cc1cc[_0xc64b('0x98')](),_0x21ceef)[_0xc64b('0x2a')](function(_0x2ce69a){_0x5e2570=_[_0xc64b('0x9a')](_0x2ce69a,'id');_0x21ceef=_[_0xc64b('0x9b')](_0x21ceef,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5dbea2['query'][_0xc64b('0x47')]){_0x64891a[_0xc64b('0x46')][_0xc64b('0x33')](function(_0x502688){_0x1f89d0[_0xc64b('0x50')]('i.'+_0x502688);});}else{_0x1f89d0[_0xc64b('0x50')](_0xc64b('0x8c'),_0xc64b('0x63'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0x9c'),_0xc64b('0x9d'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0x9e'),'Account.mandatoryDisposition');_0x1f89d0[_0xc64b('0x50')](_0xc64b('0x9f'),_0xc64b('0x8d'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xa0'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xa1'),'Contact.firstName');_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xa2'),_0xc64b('0xa3'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xa4'),_0xc64b('0xa5'));_0x1f89d0[_0xc64b('0x50')]('c.phone',_0xc64b('0xa6'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xa7'),_0xc64b('0xa8'));_0x1f89d0[_0xc64b('0x50')]('c.fax',_0xc64b('0xa9'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xaa'),_0xc64b('0xab'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xac'),_0xc64b('0xad'));_0x1f89d0[_0xc64b('0x50')](_0xc64b('0xae'),_0xc64b('0x30'));}if(_0x64891a[_0xc64b('0x20')])_0x1f89d0[_0xc64b('0x20')](_0x64891a[_0xc64b('0x20')]);if(_0x64891a['offset'])_0x1f89d0[_0xc64b('0x23')](_0x64891a[_0xc64b('0x23')]);return db[_0xc64b('0x99')][_0xc64b('0x43')](_0x1f89d0[_0xc64b('0x98')](),_0x21ceef);})['then'](function(_0xb85b38){if(_0xb85b38[_0xc64b('0x48')]>0x0)_0x5cf49e[_0xc64b('0x4d')]('ui.FaxInteractionId\x20IN\x20?',_[_0xc64b('0x3e')](_0xb85b38,'id'));return db['sequelize']['query'](_0x5cf49e[_0xc64b('0x98')](),_0x21ceef)[_0xc64b('0x2a')](function(_0x528bf6){var _0x335b93=_['groupBy'](_0x528bf6,_0xc64b('0xaf'));var _0x4cdd80=[];_0xb85b38['forEach'](function(_0x2b07c3){_0x4cdd80['push'](updateFaxInteraction(_0x2b07c3,_0x5e2570,_0x335b93));});return BPromise[_0xc64b('0xb0')](_0x4cdd80);});});})['then'](function(_0x30c190){_0x5bebb7[_0xc64b('0xb1')]=_0x30c190;return _0x5bebb7;})['then'](respondWithFilteredResult(_0x19f54f,_0x64891a))['catch'](handleError(_0x19f54f,null));};exports[_0xc64b('0xb2')]=function(_0xcd8ac2,_0x12ff0e){var _0x2880df={'raw':![],'where':{'id':_0xcd8ac2[_0xc64b('0xb3')]['id']}},_0x58fe55={};_0x58fe55[_0xc64b('0x42')]=_[_0xc64b('0x44')](db[_0xc64b('0x3f')]['rawAttributes']);_0x58fe55[_0xc64b('0x43')]=_[_0xc64b('0x44')](_0xcd8ac2[_0xc64b('0x43')]);_0x58fe55[_0xc64b('0x4e')]=_[_0xc64b('0x45')](_0x58fe55[_0xc64b('0x42')],_0x58fe55[_0xc64b('0x43')]);_0x2880df['attributes']=_[_0xc64b('0x45')](_0x58fe55[_0xc64b('0x42')],qs['fields'](_0xcd8ac2['query'][_0xc64b('0x47')]));_0x2880df[_0xc64b('0x46')]=_0x2880df[_0xc64b('0x46')]['length']?_0x2880df['attributes']:_0x58fe55[_0xc64b('0x42')];if(_0xcd8ac2[_0xc64b('0x43')][_0xc64b('0xb4')]){_0x2880df[_0xc64b('0xb5')]=[{'all':!![]}];}_0x2880df=_['merge']({},_0x2880df,_0xcd8ac2[_0xc64b('0xb6')]);return db['FaxInteraction'][_0xc64b('0x62')](_0x2880df)[_0xc64b('0x2a')](handleEntityNotFound(_0x12ff0e,null))[_0xc64b('0x2a')](respondWithResult(_0x12ff0e,null))[_0xc64b('0x35')](handleError(_0x12ff0e,null));};exports[_0xc64b('0xb7')]=function(_0x153bd3,_0x2943ed){return db[_0xc64b('0x3f')][_0xc64b('0xb7')](_0x153bd3['body'],{})['then'](respondWithResult(_0x2943ed,0xc9))['catch'](handleError(_0x2943ed,null));};exports[_0xc64b('0xb8')]=function(_0x2c3229,_0x288910){if(_0x2c3229['body']['id']){delete _0x2c3229[_0xc64b('0x73')]['id'];}return db[_0xc64b('0x3f')]['find']({'where':{'id':_0x2c3229[_0xc64b('0xb3')]['id']}})[_0xc64b('0x2a')](handleEntityNotFound(_0x288910,null))[_0xc64b('0x2a')](saveUpdates(_0x2c3229[_0xc64b('0x73')],null))['then'](respondWithResult(_0x288910,null))[_0xc64b('0x35')](handleError(_0x288910,null));};exports[_0xc64b('0x2b')]=function(_0x187f8f,_0x3119dc){return db[_0xc64b('0x3f')]['find']({'where':{'id':_0x187f8f[_0xc64b('0xb3')]['id']}})[_0xc64b('0x2a')](handleEntityNotFound(_0x3119dc,null))['then'](removeEntity(_0x3119dc,null))[_0xc64b('0x35')](handleError(_0x3119dc,null));};exports[_0xc64b('0xb9')]=function(_0x4c8df1,_0x2a6aab){return db['FaxInteraction'][_0xc64b('0xb9')]()[_0xc64b('0x2a')](respondWithResult(_0x2a6aab,null))[_0xc64b('0x35')](handleError(_0x2a6aab,null));};exports['addMessage']=function(_0x37a1a6,_0x228fb5,_0x4e4a61){return db[_0xc64b('0xba')][_0xc64b('0x62')]({'where':{'id':_0x37a1a6[_0xc64b('0xb3')]['id']}})['then'](handleEntityNotFound(_0x228fb5,null))['then'](function(_0x3c7e11){if(_0x3c7e11){return _0x3c7e11[_0xc64b('0xbb')](_0x37a1a6['body'][_0xc64b('0xbc')],_['omit'](_0x37a1a6[_0xc64b('0x73')],[_0xc64b('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x228fb5,null))['catch'](handleError(_0x228fb5,null));};exports['getMessages']=function(_0x318e71,_0x249ac7,_0x4a9b4e){var _0x229d69={'raw':![],'where':{}};var _0x18b5cd={};var _0x3412be={'count':0x0,'rows':[]};return db[_0xc64b('0x3f')][_0xc64b('0xbd')]({'where':{'id':_0x318e71['params']['id']}})[_0xc64b('0x2a')](handleEntityNotFound(_0x249ac7,null))[_0xc64b('0x2a')](function(_0x1d2733){if(_0x1d2733){_0x18b5cd[_0xc64b('0x42')]=_['keys'](db[_0xc64b('0xba')][_0xc64b('0xbe')]);_0x18b5cd[_0xc64b('0x43')]=_[_0xc64b('0x44')](_0x318e71['query']);_0x18b5cd['filters']=_[_0xc64b('0x45')](_0x18b5cd[_0xc64b('0x42')],_0x18b5cd[_0xc64b('0x43')]);_0x229d69[_0xc64b('0x46')]=_[_0xc64b('0x45')](_0x18b5cd[_0xc64b('0x42')],qs[_0xc64b('0x47')](_0x318e71['query'][_0xc64b('0x47')]));_0x229d69[_0xc64b('0x46')]=_0x229d69[_0xc64b('0x46')][_0xc64b('0x48')]?_0x229d69['attributes']:_0x18b5cd[_0xc64b('0x42')];if(!_0x318e71[_0xc64b('0x43')][_0xc64b('0x49')](_0xc64b('0x4a'))){_0x229d69[_0xc64b('0x20')]=qs[_0xc64b('0x20')](_0x318e71[_0xc64b('0x43')][_0xc64b('0x20')]);_0x229d69[_0xc64b('0x23')]=qs[_0xc64b('0x23')](_0x318e71[_0xc64b('0x43')]['offset']);}_0x229d69[_0xc64b('0x4b')]=qs['sort'](_0x318e71[_0xc64b('0x43')][_0xc64b('0x4c')]);_0x229d69['where']=qs['filters'](_['pick'](_0x318e71[_0xc64b('0x43')],_0x18b5cd[_0xc64b('0x4e')]));_0x229d69[_0xc64b('0x4d')][_0xc64b('0xaf')]=_0x1d2733['id'];if(_0x318e71[_0xc64b('0x43')][_0xc64b('0x83')]){_0x229d69[_0xc64b('0x4d')]=_['merge'](_0x229d69[_0xc64b('0x4d')],{'$or':_[_0xc64b('0x3e')](_0x229d69[_0xc64b('0x46')],function(_0x3f6824){var _0x4b9797={};_0x4b9797[_0x3f6824]={'$like':'%'+_0x318e71[_0xc64b('0x43')][_0xc64b('0x83')]+'%'};return _0x4b9797;})});}if(_0x318e71['query'][_0xc64b('0x79')]){var _0x344add=_0x318e71[_0xc64b('0x43')]['$gte'][_0xc64b('0x32')](',');var _0x517b6a={};_0x517b6a[_0x344add[0x0]]={'$gte':moment(_0x344add[0x1])['format'](_0xc64b('0xbf'))};_0x229d69[_0xc64b('0x4d')]=_[_0xc64b('0x9b')](_0x229d69[_0xc64b('0x4d')],_0x517b6a);}_0x229d69=_[_0xc64b('0x9b')]({},_0x229d69,_0x318e71['options']);return db[_0xc64b('0xba')][_0xc64b('0x22')]({'where':_0x229d69[_0xc64b('0x4d')]})[_0xc64b('0x2a')](function(_0x5237e8){_0x3412be[_0xc64b('0x22')]=_0x5237e8;if(_0x318e71[_0xc64b('0x43')][_0xc64b('0xb4')]){_0x229d69[_0xc64b('0xb5')]=[{'all':!![]}];}return db[_0xc64b('0xba')][_0xc64b('0xc0')](_0x229d69);})['then'](function(_0x45a3d9){_0x3412be[_0xc64b('0xb1')]=_0x45a3d9;return _0x3412be;});}})[_0xc64b('0x2a')](respondWithFilteredResult(_0x249ac7,_0x229d69))[_0xc64b('0x35')](handleError(_0x249ac7,null));};exports['addTags']=function(_0x1f6020,_0x373751,_0x5662ca){return db[_0xc64b('0x3f')][_0xc64b('0x62')]({'where':{'id':_0x1f6020[_0xc64b('0xb3')]['id']}})['then'](handleEntityNotFound(_0x373751,null))[_0xc64b('0x2a')](function(_0x4b050c){if(_0x4b050c){return _0x4b050c['setTags'](_0x1f6020[_0xc64b('0x73')][_0xc64b('0xbc')],_[_0xc64b('0xc1')](_0x1f6020[_0xc64b('0x73')],[_0xc64b('0xbc'),'id'])||{})['spread'](function(){return db[_0xc64b('0x6e')][_0xc64b('0xc0')]({'attributes':['id',_0xc64b('0x2e'),_0xc64b('0xc2')],'where':{'id':_0x1f6020[_0xc64b('0x73')][_0xc64b('0xbc')]}});})[_0xc64b('0x2a')](function(_0x3af4fc){socket['emit'](_0xc64b('0xc3'),{'id':Number(_0x1f6020['params']['id']),'tags':_0x3af4fc||[]});return{'id':Number(_0x1f6020[_0xc64b('0xb3')]['id']),'tags':_0x3af4fc||[]};});}})[_0xc64b('0x2a')](respondWithResult(_0x373751,null))[_0xc64b('0x35')](handleError(_0x373751,null));};exports[_0xc64b('0xc4')]=function(_0x118821,_0x11b4e0,_0x17c142){return db[_0xc64b('0x3f')][_0xc64b('0x62')]({'where':{'id':_0x118821[_0xc64b('0xb3')]['id']}})[_0xc64b('0x2a')](handleEntityNotFound(_0x11b4e0,null))['then'](function(_0x2d19a5){if(_0x2d19a5){return _0x2d19a5['removeTags'](_0x118821[_0xc64b('0x43')][_0xc64b('0xbc')]);}})[_0xc64b('0x2a')](respondWithStatusCode(_0x11b4e0,null))[_0xc64b('0x35')](handleError(_0x11b4e0,null));};exports['download']=function(_0x1dd86d,_0x38ebfe){var _0x121377=moment()[_0xc64b('0xc5')]()['toString']();var _0xe2b9ac=path[_0xc64b('0xc6')](config[_0xc64b('0xc7')],'server',_0xc64b('0xc8'),'tmp');var _0x2bffdf=path[_0xc64b('0xc6')](config[_0xc64b('0xc7')],_0xc64b('0xc9'),'files',_0xc64b('0xca'));var _0x228173=path[_0xc64b('0xc6')](_0xe2b9ac,_0x121377);var _0x13a07d=util[_0xc64b('0xcb')](_0xc64b('0xcc'),_0x1dd86d['params']['id'],_0x121377);var _0x5bd4da=path[_0xc64b('0xc6')](_0xe2b9ac,_0x13a07d);var _0x5efbc0=[];_0x5efbc0[_0xc64b('0x34')]({'model':db[_0xc64b('0xcd')],'as':_0xc64b('0xcd'),'raw':!![]});var _0x7cbd2b=[{'model':db[_0xc64b('0xba')],'as':_0xc64b('0xce'),'attributes':['id',_0xc64b('0x73'),_0xc64b('0xcf')],'include':_0x5efbc0}];return db[_0xc64b('0x3f')][_0xc64b('0x62')]({'where':{'id':_0x1dd86d[_0xc64b('0xb3')]['id']},'include':_0x7cbd2b})[_0xc64b('0x2a')](handleEntityNotFound(_0x38ebfe,null))[_0xc64b('0x2a')](function(_0x308d02){if(_0x308d02&&_0x308d02[_0xc64b('0xce')]){var _0x51c8b9=_0x308d02['get']({'plain':!![]});fs[_0xc64b('0xd0')](_0x228173);for(var _0x159837=0x0;_0x159837<_0x51c8b9['Messages']['length'];_0x159837++){var _0x185cda=_0x51c8b9[_0xc64b('0xce')][_0x159837]['Attachment'];if(_0x185cda){var _0x4c3375=path[_0xc64b('0xc6')](_0x2bffdf,_0x185cda[_0xc64b('0xd1')]);if(fs[_0xc64b('0xd2')](_0x4c3375)){fs[_0xc64b('0xd3')](_0x4c3375)[_0xc64b('0xd4')](fs[_0xc64b('0xd5')](path['join'](_0x228173,_0x185cda[_0xc64b('0xd1')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x3c43c9,_0x2bc5b7){zipdir(_0x228173,{'saveTo':_0x5bd4da},function(_0x4a35fd,_0x40c484){if(_0x4a35fd)return _0x2bc5b7(_0x4a35fd);return _0x3c43c9(_0x40c484);});})[_0xc64b('0x2a')](function(){return new BPromise(function(_0x33faaf,_0x4998d7){rimraf(_0x228173,function(_0x5bf4c9){if(_0x5bf4c9)_0x4998d7(_0x5bf4c9);return _0x33faaf();});});})['then'](function(){return _0x38ebfe[_0xc64b('0xd6')](_0x5bd4da,_0x13a07d,function(_0x1aae8f){if(_0x1aae8f){console[_0xc64b('0xd7')](_0xc64b('0xd8'),_0x1aae8f);}else{fs[_0xc64b('0xd9')](_0x5bd4da);}});});});}else{return _0x38ebfe[_0xc64b('0xda')](0xc8);}})[_0xc64b('0x35')](handleError(_0x38ebfe,null));}; \ No newline at end of file +var _0x3aec=['spread','emit','faxInteractionTags:save','removeTags','download','unix','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createWriteStream','resolve','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','unmanaged','total','closed','UserId','waiting','talking','index','FaxInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','Contact','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','show','rawAttributes','includeAll','include','merge','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','findAll','addTags','setTags'];(function(_0x546f3d,_0x64bd17){var _0x103621=function(_0x29a7dc){while(--_0x29a7dc){_0x546f3d['push'](_0x546f3d['shift']());}};_0x103621(++_0x64bd17);}(_0x3aec,0x1d9));var _0xc3ae=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0x3aec[_0x566168];return _0x4e1f7a;};'use strict';var emlformat=require(_0xc3ae('0x0'));var rimraf=require(_0xc3ae('0x1'));var zipdir=require(_0xc3ae('0x2'));var jsonpatch=require(_0xc3ae('0x3'));var rp=require('request-promise');var moment=require(_0xc3ae('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc3ae('0x5'));var sox=require(_0xc3ae('0x6'));var csv=require(_0xc3ae('0x7'));var ejs=require(_0xc3ae('0x8'));var fs=require('fs');var fs_extra=require(_0xc3ae('0x9'));var _=require(_0xc3ae('0xa'));var squel=require(_0xc3ae('0xb'));var crypto=require(_0xc3ae('0xc'));var jsforce=require(_0xc3ae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc3ae('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc3ae('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc3ae('0xf'));var as=require(_0xc3ae('0x10'));var hardwareService=require(_0xc3ae('0x11'));var logger=require(_0xc3ae('0x12'))('api');var utils=require(_0xc3ae('0x13'));var config=require(_0xc3ae('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3ae('0x15'))['db'];config[_0xc3ae('0x16')]=_[_0xc3ae('0x17')](config[_0xc3ae('0x16')],{'host':_0xc3ae('0x18'),'port':0x18eb});var socket=require(_0xc3ae('0x19'))(new Redis(config[_0xc3ae('0x16')]));require(_0xc3ae('0x1a'))[_0xc3ae('0x1b')](socket);function respondWithStatusCode(_0x14292c,_0x51cb35){_0x51cb35=_0x51cb35||0xcc;return function(_0x2a5bb3){if(_0x2a5bb3){return _0x14292c['sendStatus'](_0x51cb35);}return _0x14292c['status'](_0x51cb35)[_0xc3ae('0x1c')]();};}function respondWithResult(_0x5b615c,_0x423874){_0x423874=_0x423874||0xc8;return function(_0xf16175){if(_0xf16175){return _0x5b615c[_0xc3ae('0x1d')](_0x423874)[_0xc3ae('0x1e')](_0xf16175);}};}function respondWithFilteredResult(_0x517e25,_0xd554c8){return function(_0x1cbcc2){if(_0x1cbcc2){var _0xc1a0ed=typeof _0xd554c8[_0xc3ae('0x1f')]===_0xc3ae('0x20')&&typeof _0xd554c8[_0xc3ae('0x21')]===_0xc3ae('0x20');var _0x3b98e9=_0x1cbcc2['count'];var _0xa08802=_0xc1a0ed?0x0:_0xd554c8['offset'];var _0x5d3c5f=_0xc1a0ed?_0x1cbcc2[_0xc3ae('0x22')]:_0xd554c8['offset']+_0xd554c8[_0xc3ae('0x21')];var _0x53af97;if(_0x5d3c5f>=_0x3b98e9){_0x5d3c5f=_0x3b98e9;_0x53af97=0xc8;}else{_0x53af97=0xce;}_0x517e25[_0xc3ae('0x1d')](_0x53af97);return _0x517e25[_0xc3ae('0x23')]('Content-Range',_0xa08802+'-'+_0x5d3c5f+'/'+_0x3b98e9)[_0xc3ae('0x1e')](_0x1cbcc2);}return null;};}function patchUpdates(_0x418275){return function(_0x17e3ac){try{jsonpatch[_0xc3ae('0x24')](_0x17e3ac,_0x418275,!![]);}catch(_0x293625){return BPromise[_0xc3ae('0x25')](_0x293625);}return _0x17e3ac[_0xc3ae('0x26')]();};}function saveUpdates(_0x2c8351,_0x471bd9){return function(_0x4d0fb4){if(_0x4d0fb4){return _0x4d0fb4[_0xc3ae('0x27')](_0x2c8351)[_0xc3ae('0x28')](function(_0x213a04){return _0x213a04;});}return null;};}function removeEntity(_0x11038c,_0x15e375){return function(_0xc463a4){if(_0xc463a4){return _0xc463a4['destroy']()['then'](function(){_0x11038c['status'](0xcc)[_0xc3ae('0x1c')]();});}};}function handleEntityNotFound(_0x1a9e0e,_0x3c81e6){return function(_0x51f8e2){if(!_0x51f8e2){_0x1a9e0e[_0xc3ae('0x29')](0x194);}return _0x51f8e2;};}function handleError(_0x2b7214,_0xe9c688){_0xe9c688=_0xe9c688||0x1f4;return function(_0x69e51){logger['error'](_0x69e51[_0xc3ae('0x2a')]);if(_0x69e51[_0xc3ae('0x2b')]){delete _0x69e51[_0xc3ae('0x2b')];}_0x2b7214['status'](_0xe9c688)[_0xc3ae('0x2c')](_0x69e51);};}function getInteractionUsers(_0x239d33,_0x112f39){return new BPromise(function(_0x135d71,_0xb06a8c){try{if(_0x112f39[_0x239d33['id']]){_0x239d33['Users']=_[_0xc3ae('0x2d')](_0x112f39[_0x239d33['id']],function(_0x170ada){return{'id':_0x170ada['id'],'fullname':_0x170ada[_0xc3ae('0x2e')]};});}}catch(_0x22f422){_0xb06a8c(_0x22f422);}_0x135d71(_0x239d33);});}function getInteractionTags(_0x401ec5,_0x974b18){return new BPromise(function(_0x444ecd,_0x1724a2){try{if(_0x401ec5[_0xc3ae('0x2f')]){_0x401ec5[_0xc3ae('0x30')]=[];_0x401ec5[_0xc3ae('0x2f')][_0xc3ae('0x31')](',')[_0xc3ae('0x32')](function(_0x2d769d){_0x401ec5[_0xc3ae('0x30')][_0xc3ae('0x33')](_0x974b18[_0x2d769d]);});}delete _0x401ec5[_0xc3ae('0x2f')];}catch(_0xa5b00b){_0x1724a2(_0xa5b00b);}_0x444ecd(_0x401ec5);});}function updateFaxInteraction(_0x3568d4,_0x9d7efa,_0x9c96f0){return new BPromise(function(_0x233944,_0x500d7d){return getInteractionUsers(_0x3568d4,_0x9c96f0)['then'](function(_0x7fa3e4){return getInteractionTags(_0x7fa3e4,_0x9d7efa);})[_0xc3ae('0x28')](function(_0x364b51){return getStateInteraction(_0x364b51);})[_0xc3ae('0x28')](function(_0x56ce1e){_0x233944(_0x56ce1e);})[_0xc3ae('0x34')](function(_0x14fbc2){_0x500d7d(_0x14fbc2);});});}function getStateInteraction(_0x459049){return new BPromise(function(_0x4cee12){_0x459049['waiting']=0x0;_0x459049['talking']=0x0;_0x459049['answered']=0x0;_0x459049[_0xc3ae('0x35')]=0x0;_0x459049[_0xc3ae('0x36')]=0x0;if(!_0x459049[_0xc3ae('0x37')]&&!_0x459049[_0xc3ae('0x38')]){_0x459049[_0xc3ae('0x39')]+=0x1;}if(!_0x459049[_0xc3ae('0x37')]&&_0x459049[_0xc3ae('0x38')]){_0x459049[_0xc3ae('0x3a')]+=0x1;if(_0x459049[_0xc3ae('0x39')]){_0x459049[_0xc3ae('0x39')]-=0x1;}}if(_0x459049[_0xc3ae('0x37')]&&_0x459049['UserId']){_0x459049['answered']+=0x1;if(_0x459049['talking']){_0x459049['talking']-=0x1;}}if(_0x459049[_0xc3ae('0x37')]&&!_0x459049[_0xc3ae('0x38')]){_0x459049[_0xc3ae('0x35')]+=0x1;if(_0x459049['waiting']){_0x459049[_0xc3ae('0x39')]-=0x1;}}_0x459049[_0xc3ae('0x36')]+=0x1;_0x4cee12(_0x459049);});}exports[_0xc3ae('0x3b')]=function(_0x3590fc,_0x5387ba){var _0x22954f={},_0x45f43f={},_0x1daec3={'count':0x0,'rows':[]};var _0x105ccd=_[_0xc3ae('0x2d')](db[_0xc3ae('0x3c')]['rawAttributes'],function(_0x3edce3){return{'name':_0x3edce3[_0xc3ae('0x3d')],'type':_0x3edce3[_0xc3ae('0x3e')][_0xc3ae('0x3f')]};});_0x45f43f[_0xc3ae('0x40')]=_[_0xc3ae('0x2d')](_0x105ccd,_0xc3ae('0x2b'));_0x45f43f[_0xc3ae('0x41')]=_[_0xc3ae('0x42')](_0x3590fc[_0xc3ae('0x41')]);_0x45f43f[_0xc3ae('0x43')]=_[_0xc3ae('0x44')](_0x45f43f[_0xc3ae('0x40')],_0x45f43f[_0xc3ae('0x41')]);_0x22954f[_0xc3ae('0x45')]=_[_0xc3ae('0x44')](_0x45f43f[_0xc3ae('0x40')],qs[_0xc3ae('0x46')](_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x46')]));_0x22954f['attributes']=_0x22954f[_0xc3ae('0x45')]['length']?_0x22954f[_0xc3ae('0x45')]:_0x45f43f[_0xc3ae('0x40')];if(!_0x3590fc[_0xc3ae('0x41')]['hasOwnProperty'](_0xc3ae('0x47'))){_0x22954f[_0xc3ae('0x21')]=qs[_0xc3ae('0x21')](_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x21')]);_0x22954f[_0xc3ae('0x1f')]=qs['offset'](_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x1f')]);}_0x22954f['order']=qs[_0xc3ae('0x48')](_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x48')]);_0x22954f[_0xc3ae('0x49')]=qs[_0xc3ae('0x43')](_[_0xc3ae('0x4a')](_0x3590fc['query'],_0x45f43f[_0xc3ae('0x43')]),_0x105ccd);var _0x149607=[];var _0x537180=squel['select']()['field']('id')[_0xc3ae('0x4b')]('name')[_0xc3ae('0x4b')](_0xc3ae('0x4c'))[_0xc3ae('0x4d')](_0xc3ae('0x4e'));var _0x46a823=squel[_0xc3ae('0x4f')]()[_0xc3ae('0x4b')](_0xc3ae('0x50'))[_0xc3ae('0x4b')](_0xc3ae('0x51'))['field'](_0xc3ae('0x52'))[_0xc3ae('0x4d')](_0xc3ae('0x53'),'ui')[_0xc3ae('0x54')](_0xc3ae('0x55'),'u',_0xc3ae('0x56'));var _0x3c14ff=squel['select']()[_0xc3ae('0x4d')](_0xc3ae('0x57'),'i')['left_join'](_0xc3ae('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc3ae('0x54')](_0xc3ae('0x55'),'o',_0xc3ae('0x59'))[_0xc3ae('0x54')](_0xc3ae('0x5a'),'a',_0xc3ae('0x5b'))[_0xc3ae('0x54')](_0xc3ae('0x5c'),'me',_0xc3ae('0x5d'))[_0xc3ae('0x54')](_0xc3ae('0x5e'),'it',_0xc3ae('0x5f'))[_0xc3ae('0x54')]('tools_tags','t',_0xc3ae('0x60'));var _0x79102f=squel[_0xc3ae('0x61')]();var _0x47ba8b=[];var _0x14483e=squel[_0xc3ae('0x61')]();var _0x49fdab;if(_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x62')]){_0x49fdab=as[_0xc3ae('0x63')](_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x62')]);var _0x30b151=_0x49fdab['sqlOperator'];for(var _0x152a87=0x0;_0x152a87<_0x49fdab[_0xc3ae('0x64')][_0xc3ae('0x65')];_0x152a87++){var _0x4f4865=_0x49fdab['conditions'][_0x152a87];var _0x13ba7f='i';var _0x500ea1=_[_0xc3ae('0x66')](_0x105ccd,[_0xc3ae('0x2b'),_0x4f4865[_0xc3ae('0x4b')]]);if(!_0x500ea1){switch(_0x4f4865[_0xc3ae('0x4b')]){case _0xc3ae('0x67'):if(_0x4f4865[_0xc3ae('0x68')]==0x1){_0x3c14ff[_0xc3ae('0x69')]('`'+_0x4f4865[_0xc3ae('0x4b')]+_0xc3ae('0x6a'));}else{_0x3c14ff[_0xc3ae('0x69')]('`'+_0x4f4865[_0xc3ae('0x4b')]+'`\x20>\x200');}break;case _0xc3ae('0x6b'):if(_0x4f4865['operator']==='$substring'){if(_0x4f4865[_0xc3ae('0x68')][_0xc3ae('0x31')]('\x20')[_0xc3ae('0x65')]>0x1){_0x79102f[_0x30b151]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc3ae('0x6c')](_0x4f4865[_0xc3ae('0x68')]),null);}else{var _0x36d080='%'+_0x4f4865[_0xc3ae('0x68')]+'%';_0x79102f[_0x30b151](_0xc3ae('0x6d'),_0x36d080,_0x36d080,_0x36d080);}}else{_0x500ea1=_[_0xc3ae('0x66')](_0x105ccd,[_0xc3ae('0x2b'),_0xc3ae('0x6e')]);_0x4f4865[_0xc3ae('0x4b')]=_0xc3ae('0x6e');_0x3c8b3c=as[_0xc3ae('0x6f')](_0x13ba7f,_0x500ea1[_0xc3ae('0x3e')],_0x4f4865);_0x79102f[_0x30b151](_0x3c8b3c['text'],_0x3c8b3c[_0xc3ae('0x68')]['start'],_0x3c8b3c['value'][_0xc3ae('0x1c')]);}break;case _0xc3ae('0x70'):var _0x21b418=_0x4f4865[_0xc3ae('0x68')][_0xc3ae('0x31')](',')[_0xc3ae('0x2d')](function(_0x3dafe7){return Number(_0x3dafe7);});_0x21b418[_0xc3ae('0x32')](function(_0x1320bc){_0x14483e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1320bc+',%');});_0x47ba8b=_[_0xc3ae('0x71')](_0x47ba8b,_0x21b418);break;case _0xc3ae('0x72'):if(_0x4f4865[_0xc3ae('0x73')]==='$substring'){_0x79102f[_0x30b151](_0xc3ae('0x74'),'%'+_0x4f4865[_0xc3ae('0x68')]+'%',null);}else{_0x500ea1=_[_0xc3ae('0x66')](_0x105ccd,['name',_0xc3ae('0x38')]);_0x4f4865[_0xc3ae('0x4b')]=_0xc3ae('0x38');_0x3c8b3c=as[_0xc3ae('0x6f')](_0x13ba7f,_0x500ea1['type'],_0x4f4865);_0x79102f[_0x30b151](_0x3c8b3c[_0xc3ae('0x75')],_0x3c8b3c[_0xc3ae('0x68')][_0xc3ae('0x76')],_0x3c8b3c['value'][_0xc3ae('0x1c')]);}break;case _0xc3ae('0x77'):_0x3c8b3c=as[_0xc3ae('0x6f')]('me',null,_0x4f4865);_0x79102f[_0x30b151](_0x3c8b3c['text'],_0x3c8b3c[_0xc3ae('0x68')][_0xc3ae('0x76')],_0x3c8b3c[_0xc3ae('0x68')][_0xc3ae('0x1c')]);break;}}else{var _0x3c8b3c=as[_0xc3ae('0x6f')](_0x13ba7f,_0x500ea1['type'],_0x4f4865);_0x79102f[_0x30b151](_0x3c8b3c[_0xc3ae('0x75')],_0x3c8b3c[_0xc3ae('0x68')][_0xc3ae('0x76')],_0x3c8b3c[_0xc3ae('0x68')]['end']);}}}else{var _0x1d2824=_(_0x3590fc[_0xc3ae('0x41')])[_0xc3ae('0x42')]()[_0xc3ae('0x2d')](function(_0x5be743){return _[_0xc3ae('0x78')](_0x105ccd,[_0xc3ae('0x2b'),_0x5be743])?_0x5be743:undefined;})[_0xc3ae('0x79')]()['value']();if(!_[_0xc3ae('0x7a')](_0x1d2824)){_0x1d2824['forEach'](function(_0x3bf539){if(_0x3bf539==='FaxAccountId'){_0x3c14ff[_0xc3ae('0x49')](_0xc3ae('0x7b'),[][_0xc3ae('0x7c')](_0x3590fc[_0xc3ae('0x41')][_0x3bf539]));}else if(_0x3bf539===_0xc3ae('0x7d')){var _0x454cb0=JSON[_0xc3ae('0x7e')](_0x3590fc[_0xc3ae('0x41')][_0x3bf539])[_0xc3ae('0x7f')];var _0xa865f2=JSON[_0xc3ae('0x7e')](_0x3590fc[_0xc3ae('0x41')][_0x3bf539])[_0xc3ae('0x80')];_0x3c14ff[_0xc3ae('0x49')](_0xc3ae('0x81'),_0x454cb0,_0xa865f2);}else{if(_0x3590fc[_0xc3ae('0x41')][_0x3bf539]===_0xc3ae('0x82')){_0x3c14ff[_0xc3ae('0x49')]('i.'+_0x3bf539+_0xc3ae('0x83'));}else{_0x3c14ff[_0xc3ae('0x49')]('i.'+_0x3bf539+_0xc3ae('0x84'),_0x3590fc[_0xc3ae('0x41')][_0x3bf539]);}}});}if(_0x3590fc[_0xc3ae('0x41')]['read']){if(_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x85')]==0x1){_0x3c14ff[_0xc3ae('0x69')](_0xc3ae('0x86'));}else{_0x3c14ff[_0xc3ae('0x69')]('`unreadMessages`\x20>\x200');}}if(_0x3590fc[_0xc3ae('0x41')]['tag']){_0x47ba8b=_[_0xc3ae('0x87')](_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x88')])?_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x88')]:new Array(_0x3590fc['query']['tag']);_0x47ba8b[_0xc3ae('0x32')](function(_0x45d46c){_0x14483e['or'](_0xc3ae('0x89'),'%,'+_0x45d46c+',%');});}if(_0x3590fc[_0xc3ae('0x41')]['filter']){var _0x326350=_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x8a')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc3ae('0x8b')](_0x326350)){_0x79102f['or'](_0xc3ae('0x8c'),_0x326350+'%')['or']('i.fax\x20LIKE\x20?',_0x326350+'%');}_0x79102f['or'](_0xc3ae('0x8d'),_0x326350+'%');}}_0x3c14ff[_0xc3ae('0x49')](_0x79102f);_0x3c14ff['group'](_0xc3ae('0x8e'));var _0x31c29f={'type':db[_0xc3ae('0x8f')][_0xc3ae('0x90')][_0xc3ae('0x91')],'raw':!![]};var _0x4101ca=_0x3c14ff[_0xc3ae('0x92')]();_0x4101ca['field']('i.id');_0x4101ca[_0xc3ae('0x4b')](_0xc3ae('0x93'),'unreadMessages');if(_0x22954f[_0xc3ae('0x94')]){_0x22954f['order'][_0xc3ae('0x32')](function(_0x113bba){var _0x30e0ef=_0x113bba[0x0]===_0xc3ae('0x95')?_0x113bba[0x0]:'i.'+_0x113bba[0x0];_0x3c14ff[_0xc3ae('0x94')](_0x30e0ef,_0x113bba[0x1]===_0xc3ae('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x47ba8b)){_0x3c14ff[_0xc3ae('0x69')](_0x14483e);_0x4101ca[_0xc3ae('0x49')](_0xc3ae('0x97'),_0x47ba8b);}BPromise['resolve']()[_0xc3ae('0x28')](function(){if(!_0x49fdab){if(_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x98')])return;_0x4101ca['where'](_0xc3ae('0x99'));_0x3c14ff[_0xc3ae('0x49')](_0xc3ae('0x99'));return;}if(_0x3590fc[_0xc3ae('0x9a')]['role']!==_0xc3ae('0x9b'))return;return _0x3590fc['user'][_0xc3ae('0x9c')]({'attributes':['id'],'raw':!![]})[_0xc3ae('0x28')](function(_0x300047){if(_[_0xc3ae('0x7a')](_0x300047)){_0x4101ca[_0xc3ae('0x49')](_0xc3ae('0x9d'));_0x3c14ff[_0xc3ae('0x49')](_0xc3ae('0x9d'));}else{_0x4101ca[_0xc3ae('0x49')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x300047,'id'));_0x3c14ff[_0xc3ae('0x49')]('i.FaxAccountId\x20IN\x20?',_[_0xc3ae('0x2d')](_0x300047,'id'));}});})[_0xc3ae('0x28')](function(){if(_0x3590fc[_0xc3ae('0x9a')][_0xc3ae('0x9e')]==='agent'&&!_0x49fdab&&!_0x3590fc[_0xc3ae('0x41')]['FaxAccountId'])return[];return db[_0xc3ae('0x9f')]['query'](_0x4101ca[_0xc3ae('0xa0')](),_0x31c29f);})[_0xc3ae('0x28')](function(_0x31882d){_0x1daec3[_0xc3ae('0x22')]=_0x31882d[_0xc3ae('0x65')];if(_0x1daec3[_0xc3ae('0x22')]===0x0)return[];return db[_0xc3ae('0x9f')]['query'](_0x537180[_0xc3ae('0xa0')](),_0x31c29f)[_0xc3ae('0x28')](function(_0x15d370){_0x149607=_[_0xc3ae('0xa1')](_0x15d370,'id');_0x31c29f=_['merge'](_0x31c29f,{'model':db[_0xc3ae('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3590fc[_0xc3ae('0x41')][_0xc3ae('0x46')]){_0x22954f[_0xc3ae('0x45')][_0xc3ae('0x32')](function(_0x36d7f0){_0x3c14ff[_0xc3ae('0x4b')]('i.'+_0x36d7f0);});}else{_0x3c14ff[_0xc3ae('0x4b')](_0xc3ae('0x93'),'unreadMessages');_0x3c14ff[_0xc3ae('0x4b')](_0xc3ae('0xa2'),_0xc3ae('0xa3'));_0x3c14ff[_0xc3ae('0x4b')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3c14ff[_0xc3ae('0x4b')](_0xc3ae('0xa4'),_0xc3ae('0x95'));_0x3c14ff[_0xc3ae('0x4b')](_0xc3ae('0xa5'));_0x3c14ff[_0xc3ae('0x4b')](_0xc3ae('0xa6'),'Contact.firstName');_0x3c14ff[_0xc3ae('0x4b')]('c.lastName',_0xc3ae('0xa7'));_0x3c14ff['field']('c.email',_0xc3ae('0xa8'));_0x3c14ff['field'](_0xc3ae('0xa9'),_0xc3ae('0xaa'));_0x3c14ff['field'](_0xc3ae('0xab'),'Contact.mobile');_0x3c14ff[_0xc3ae('0x4b')]('c.fax',_0xc3ae('0xac'));_0x3c14ff['field'](_0xc3ae('0xad'),_0xc3ae('0xae'));_0x3c14ff['field'](_0xc3ae('0xaf'),_0xc3ae('0xb0'));_0x3c14ff[_0xc3ae('0x4b')](_0xc3ae('0xb1'),_0xc3ae('0x2f'));}if(_0x22954f['limit'])_0x3c14ff['limit'](_0x22954f['limit']);if(_0x22954f[_0xc3ae('0x1f')])_0x3c14ff[_0xc3ae('0x1f')](_0x22954f['offset']);return db['sequelize'][_0xc3ae('0x41')](_0x3c14ff[_0xc3ae('0xa0')](),_0x31c29f);})['then'](function(_0x12fc53){if(_0x12fc53[_0xc3ae('0x65')]>0x0)_0x46a823[_0xc3ae('0x49')](_0xc3ae('0xb2'),_[_0xc3ae('0x2d')](_0x12fc53,'id'));return db['sequelize'][_0xc3ae('0x41')](_0x46a823[_0xc3ae('0xa0')](),_0x31c29f)[_0xc3ae('0x28')](function(_0x8c6a0e){var _0x3a2c8d=_['groupBy'](_0x8c6a0e,_0xc3ae('0xb3'));var _0x40c97f=[];_0x12fc53[_0xc3ae('0x32')](function(_0xf2795b){_0x40c97f[_0xc3ae('0x33')](updateFaxInteraction(_0xf2795b,_0x149607,_0x3a2c8d));});return BPromise[_0xc3ae('0xb4')](_0x40c97f);});});})[_0xc3ae('0x28')](function(_0x16f8ab){_0x1daec3[_0xc3ae('0xb5')]=_0x16f8ab;return _0x1daec3;})['then'](respondWithFilteredResult(_0x5387ba,_0x22954f))[_0xc3ae('0x34')](handleError(_0x5387ba,null));};exports[_0xc3ae('0xb6')]=function(_0x2995fa,_0x4f53b8){var _0x48dbc={'raw':![],'where':{'id':_0x2995fa['params']['id']}},_0x396caa={};_0x396caa[_0xc3ae('0x40')]=_['keys'](db[_0xc3ae('0x3c')][_0xc3ae('0xb7')]);_0x396caa[_0xc3ae('0x41')]=_[_0xc3ae('0x42')](_0x2995fa[_0xc3ae('0x41')]);_0x396caa['filters']=_['intersection'](_0x396caa[_0xc3ae('0x40')],_0x396caa[_0xc3ae('0x41')]);_0x48dbc[_0xc3ae('0x45')]=_[_0xc3ae('0x44')](_0x396caa['model'],qs[_0xc3ae('0x46')](_0x2995fa[_0xc3ae('0x41')][_0xc3ae('0x46')]));_0x48dbc[_0xc3ae('0x45')]=_0x48dbc[_0xc3ae('0x45')]['length']?_0x48dbc[_0xc3ae('0x45')]:_0x396caa[_0xc3ae('0x40')];if(_0x2995fa[_0xc3ae('0x41')][_0xc3ae('0xb8')]){_0x48dbc[_0xc3ae('0xb9')]=[{'all':!![]}];}_0x48dbc=_[_0xc3ae('0xba')]({},_0x48dbc,_0x2995fa[_0xc3ae('0xbb')]);return db[_0xc3ae('0x3c')]['find'](_0x48dbc)[_0xc3ae('0x28')](handleEntityNotFound(_0x4f53b8,null))[_0xc3ae('0x28')](respondWithResult(_0x4f53b8,null))[_0xc3ae('0x34')](handleError(_0x4f53b8,null));};exports[_0xc3ae('0xbc')]=function(_0x5b4407,_0x30f92c){return db[_0xc3ae('0x3c')]['create'](_0x5b4407[_0xc3ae('0x77')],{})[_0xc3ae('0x28')](respondWithResult(_0x30f92c,0xc9))[_0xc3ae('0x34')](handleError(_0x30f92c,null));};exports[_0xc3ae('0x27')]=function(_0x4599f4,_0xf32619){if(_0x4599f4['body']['id']){delete _0x4599f4[_0xc3ae('0x77')]['id'];}return db[_0xc3ae('0x3c')][_0xc3ae('0x66')]({'where':{'id':_0x4599f4[_0xc3ae('0xbd')]['id']}})[_0xc3ae('0x28')](handleEntityNotFound(_0xf32619,null))[_0xc3ae('0x28')](saveUpdates(_0x4599f4[_0xc3ae('0x77')],null))[_0xc3ae('0x28')](respondWithResult(_0xf32619,null))[_0xc3ae('0x34')](handleError(_0xf32619,null));};exports['destroy']=function(_0xa48a97,_0x3be192){return db[_0xc3ae('0x3c')][_0xc3ae('0x66')]({'where':{'id':_0xa48a97['params']['id']}})[_0xc3ae('0x28')](handleEntityNotFound(_0x3be192,null))[_0xc3ae('0x28')](removeEntity(_0x3be192,null))[_0xc3ae('0x34')](handleError(_0x3be192,null));};exports[_0xc3ae('0xbe')]=function(_0x491f1c,_0x50845f){return db[_0xc3ae('0x3c')]['describe']()[_0xc3ae('0x28')](respondWithResult(_0x50845f,null))[_0xc3ae('0x34')](handleError(_0x50845f,null));};exports[_0xc3ae('0xbf')]=function(_0x41ab44,_0xc1c904,_0x2130fb){return db['FaxMessage'][_0xc3ae('0x66')]({'where':{'id':_0x41ab44[_0xc3ae('0xbd')]['id']}})[_0xc3ae('0x28')](handleEntityNotFound(_0xc1c904,null))[_0xc3ae('0x28')](function(_0x757fe3){if(_0x757fe3){return _0x757fe3[_0xc3ae('0xbf')](_0x41ab44[_0xc3ae('0x77')][_0xc3ae('0xc0')],_[_0xc3ae('0xc1')](_0x41ab44[_0xc3ae('0x77')],[_0xc3ae('0xc0'),'id'])||{});}})[_0xc3ae('0x28')](respondWithResult(_0xc1c904,null))['catch'](handleError(_0xc1c904,null));};exports[_0xc3ae('0xc2')]=function(_0x14104c,_0xd072c7,_0x209c12){var _0x4273f9={'raw':![],'where':{}};var _0x279d3a={};var _0x5c6277={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xc3ae('0xc3')]({'where':{'id':_0x14104c[_0xc3ae('0xbd')]['id']}})[_0xc3ae('0x28')](handleEntityNotFound(_0xd072c7,null))['then'](function(_0x219c1f){if(_0x219c1f){_0x279d3a[_0xc3ae('0x40')]=_[_0xc3ae('0x42')](db['FaxMessage'][_0xc3ae('0xb7')]);_0x279d3a[_0xc3ae('0x41')]=_[_0xc3ae('0x42')](_0x14104c['query']);_0x279d3a[_0xc3ae('0x43')]=_[_0xc3ae('0x44')](_0x279d3a['model'],_0x279d3a[_0xc3ae('0x41')]);_0x4273f9[_0xc3ae('0x45')]=_[_0xc3ae('0x44')](_0x279d3a['model'],qs[_0xc3ae('0x46')](_0x14104c[_0xc3ae('0x41')][_0xc3ae('0x46')]));_0x4273f9[_0xc3ae('0x45')]=_0x4273f9[_0xc3ae('0x45')]['length']?_0x4273f9['attributes']:_0x279d3a[_0xc3ae('0x40')];if(!_0x14104c[_0xc3ae('0x41')]['hasOwnProperty'](_0xc3ae('0x47'))){_0x4273f9[_0xc3ae('0x21')]=qs[_0xc3ae('0x21')](_0x14104c[_0xc3ae('0x41')][_0xc3ae('0x21')]);_0x4273f9[_0xc3ae('0x1f')]=qs[_0xc3ae('0x1f')](_0x14104c[_0xc3ae('0x41')][_0xc3ae('0x1f')]);}_0x4273f9['order']=qs[_0xc3ae('0x48')](_0x14104c[_0xc3ae('0x41')][_0xc3ae('0x48')]);_0x4273f9[_0xc3ae('0x49')]=qs[_0xc3ae('0x43')](_[_0xc3ae('0x4a')](_0x14104c[_0xc3ae('0x41')],_0x279d3a[_0xc3ae('0x43')]));_0x4273f9[_0xc3ae('0x49')][_0xc3ae('0xb3')]=_0x219c1f['id'];if(_0x14104c[_0xc3ae('0x41')][_0xc3ae('0x8a')]){_0x4273f9[_0xc3ae('0x49')]=_[_0xc3ae('0xba')](_0x4273f9[_0xc3ae('0x49')],{'$or':_[_0xc3ae('0x2d')](_0x4273f9['attributes'],function(_0x4bcf98){var _0x366998={};_0x366998[_0x4bcf98]={'$like':'%'+_0x14104c[_0xc3ae('0x41')][_0xc3ae('0x8a')]+'%'};return _0x366998;})});}if(_0x14104c['query'][_0xc3ae('0x7f')]){var _0x46c8b2=_0x14104c['query'][_0xc3ae('0x7f')][_0xc3ae('0x31')](',');var _0x37e373={};_0x37e373[_0x46c8b2[0x0]]={'$gte':moment(_0x46c8b2[0x1])[_0xc3ae('0xc4')](_0xc3ae('0xc5'))};_0x4273f9['where']=_[_0xc3ae('0xba')](_0x4273f9[_0xc3ae('0x49')],_0x37e373);}_0x4273f9=_[_0xc3ae('0xba')]({},_0x4273f9,_0x14104c[_0xc3ae('0xbb')]);return db[_0xc3ae('0xc6')]['count']({'where':_0x4273f9[_0xc3ae('0x49')]})['then'](function(_0x2f52f0){_0x5c6277[_0xc3ae('0x22')]=_0x2f52f0;if(_0x14104c[_0xc3ae('0x41')][_0xc3ae('0xb8')]){_0x4273f9[_0xc3ae('0xb9')]=[{'all':!![]}];}return db[_0xc3ae('0xc6')][_0xc3ae('0xc7')](_0x4273f9);})[_0xc3ae('0x28')](function(_0x10f4c0){_0x5c6277['rows']=_0x10f4c0;return _0x5c6277;});}})[_0xc3ae('0x28')](respondWithFilteredResult(_0xd072c7,_0x4273f9))['catch'](handleError(_0xd072c7,null));};exports[_0xc3ae('0xc8')]=function(_0xd24a62,_0x1d531a,_0x21e7ba){return db[_0xc3ae('0x3c')]['find']({'where':{'id':_0xd24a62[_0xc3ae('0xbd')]['id']}})[_0xc3ae('0x28')](handleEntityNotFound(_0x1d531a,null))['then'](function(_0x4953a4){if(_0x4953a4){return _0x4953a4[_0xc3ae('0xc9')](_0xd24a62[_0xc3ae('0x77')][_0xc3ae('0xc0')],_['omit'](_0xd24a62[_0xc3ae('0x77')],[_0xc3ae('0xc0'),'id'])||{})[_0xc3ae('0xca')](function(){return db[_0xc3ae('0x70')][_0xc3ae('0xc7')]({'attributes':['id',_0xc3ae('0x2b'),_0xc3ae('0x4c')],'where':{'id':_0xd24a62[_0xc3ae('0x77')][_0xc3ae('0xc0')]}});})['then'](function(_0x1530be){socket[_0xc3ae('0xcb')](_0xc3ae('0xcc'),{'id':Number(_0xd24a62[_0xc3ae('0xbd')]['id']),'tags':_0x1530be||[]});return{'id':Number(_0xd24a62[_0xc3ae('0xbd')]['id']),'tags':_0x1530be||[]};});}})[_0xc3ae('0x28')](respondWithResult(_0x1d531a,null))['catch'](handleError(_0x1d531a,null));};exports[_0xc3ae('0xcd')]=function(_0x6291cf,_0x586599,_0x148fe6){return db[_0xc3ae('0x3c')][_0xc3ae('0x66')]({'where':{'id':_0x6291cf[_0xc3ae('0xbd')]['id']}})[_0xc3ae('0x28')](handleEntityNotFound(_0x586599,null))[_0xc3ae('0x28')](function(_0x264c0e){if(_0x264c0e){return _0x264c0e['removeTags'](_0x6291cf[_0xc3ae('0x41')][_0xc3ae('0xc0')]);}})[_0xc3ae('0x28')](respondWithStatusCode(_0x586599,null))['catch'](handleError(_0x586599,null));};exports[_0xc3ae('0xce')]=function(_0x4ea248,_0x2d50eb){var _0x382307=moment()[_0xc3ae('0xcf')]()[_0xc3ae('0xa0')]();var _0x227569=path[_0xc3ae('0xd0')](config['root'],'server',_0xc3ae('0xd1'),_0xc3ae('0xd2'));var _0x1594af=path[_0xc3ae('0xd0')](config[_0xc3ae('0xd3')],_0xc3ae('0xd4'),_0xc3ae('0xd1'),_0xc3ae('0xd5'));var _0x5c932a=path[_0xc3ae('0xd0')](_0x227569,_0x382307);var _0x5918b6=util[_0xc3ae('0xc4')](_0xc3ae('0xd6'),_0x4ea248['params']['id'],_0x382307);var _0x4b70a6=path['join'](_0x227569,_0x5918b6);var _0x3906f2=[];_0x3906f2[_0xc3ae('0x33')]({'model':db[_0xc3ae('0xd7')],'as':_0xc3ae('0xd7'),'raw':!![]});var _0x581a58=[{'model':db['FaxMessage'],'as':_0xc3ae('0xd8'),'attributes':['id',_0xc3ae('0x77'),_0xc3ae('0x7d')],'include':_0x3906f2}];return db[_0xc3ae('0x3c')][_0xc3ae('0x66')]({'where':{'id':_0x4ea248[_0xc3ae('0xbd')]['id']},'include':_0x581a58})['then'](handleEntityNotFound(_0x2d50eb,null))[_0xc3ae('0x28')](function(_0x49a9ba){if(_0x49a9ba&&_0x49a9ba[_0xc3ae('0xd8')]){var _0x331036=_0x49a9ba[_0xc3ae('0xd9')]({'plain':!![]});fs[_0xc3ae('0xda')](_0x5c932a);for(var _0x92331d=0x0;_0x92331d<_0x331036[_0xc3ae('0xd8')]['length'];_0x92331d++){var _0x41b2cc=_0x331036[_0xc3ae('0xd8')][_0x92331d][_0xc3ae('0xd7')];if(_0x41b2cc){var _0x52a8a7=path[_0xc3ae('0xd0')](_0x1594af,_0x41b2cc[_0xc3ae('0xdb')]);if(fs[_0xc3ae('0xdc')](_0x52a8a7)){fs['createReadStream'](_0x52a8a7)['pipe'](fs[_0xc3ae('0xdd')](path[_0xc3ae('0xd0')](_0x5c932a,_0x41b2cc['basename'])));}}}return BPromise[_0xc3ae('0xde')]()[_0xc3ae('0x28')](function(){return new BPromise(function(_0x107043,_0x1acd0d){zipdir(_0x5c932a,{'saveTo':_0x4b70a6},function(_0x2e87f1,_0x3b697d){if(_0x2e87f1)return _0x1acd0d(_0x2e87f1);return _0x107043(_0x3b697d);});})[_0xc3ae('0x28')](function(){return new BPromise(function(_0x2c7fdf,_0x1492f0){rimraf(_0x5c932a,function(_0x57809c){if(_0x57809c)_0x1492f0(_0x57809c);return _0x2c7fdf();});});})[_0xc3ae('0x28')](function(){return _0x2d50eb[_0xc3ae('0xce')](_0x4b70a6,_0x5918b6,function(_0x588767){if(_0x588767){console[_0xc3ae('0xdf')]('err',_0x588767);}else{fs[_0xc3ae('0xe0')](_0x4b70a6);}});});});}else{return _0x2d50eb['sendStatus'](0xc8);}})[_0xc3ae('0x34')](handleError(_0x2d50eb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 06f602a..ae7531f 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 _0x0273=['update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x0273,0x177));var _0x3027=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0273[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x3027('0x0'))['db'][_0x3027('0x1')];var FaxMessage=require(_0x3027('0x0'))['db'][_0x3027('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3027('0x3')](0x0);var events={'afterCreate':_0x3027('0x4'),'afterUpdate':_0x3027('0x5'),'afterDestroy':_0x3027('0x6')};function emitEvent(_0x4ef0a9){return function(_0xe9de98,_0x214497,_0xd0af73){_0xe9de98[_0x3027('0x7')]({'attributes':['id'],'raw':!![]})[_0x3027('0x8')](function(_0x5d761e){_0xe9de98[_0x3027('0x9')](_0x3027('0xa'),_0x5d761e[_0x3027('0xb')](function(_0xf1c51f){return{'id':_0xf1c51f['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xe9de98['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x37e2a2){_0xe9de98[_0x3027('0x9')](_0x3027('0xc'),_0x37e2a2[_0x3027('0xd')]);FaxInteractionEvents[_0x3027('0xe')](_0x4ef0a9+':'+_0xe9de98['id'],_0xe9de98);FaxInteractionEvents['emit'](_0x4ef0a9,_0xe9de98);_0xd0af73(null);})[_0x3027('0xf')](_0xd0af73(null));};}for(var e in events){if(events[_0x3027('0x10')](e)){var event=events[e];FaxInteraction[_0x3027('0x11')](e,emitEvent(event));}}module[_0x3027('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0xc687=['hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','length','emit','catch'];(function(_0x4bc56e,_0x4f2fc0){var _0x29c230=function(_0x2068d2){while(--_0x2068d2){_0x4bc56e['push'](_0x4bc56e['shift']());}};_0x29c230(++_0x4f2fc0);}(_0xc687,0x156));var _0x7c68=function(_0x2fe400,_0x4b29a0){_0x2fe400=_0x2fe400-0x0;var _0x721359=_0xc687[_0x2fe400];return _0x721359;};'use strict';var EventEmitter=require(_0x7c68('0x0'));var FaxInteraction=require(_0x7c68('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x7c68('0x1'))['db'][_0x7c68('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7c68('0x3')](0x0);var events={'afterCreate':_0x7c68('0x4'),'afterUpdate':_0x7c68('0x5'),'afterDestroy':_0x7c68('0x6')};function emitEvent(_0x2e7ad4){return function(_0x49d625,_0x39fdd4,_0x2a63a0){_0x49d625[_0x7c68('0x7')]({'attributes':['id'],'raw':!![]})[_0x7c68('0x8')](function(_0x1b164a){_0x49d625['setDataValue'](_0x7c68('0x9'),_0x1b164a[_0x7c68('0xa')](function(_0x324d27){return{'id':_0x324d27['id']};}));return FaxMessage[_0x7c68('0xb')]({'where':{'FaxInteractionId':_0x49d625['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c68('0x8')](function(_0x3670f8){_0x49d625['setDataValue']('unreadMessages',_0x3670f8[_0x7c68('0xc')]);FaxInteractionEvents[_0x7c68('0xd')](_0x2e7ad4+':'+_0x49d625['id'],_0x49d625);FaxInteractionEvents[_0x7c68('0xd')](_0x2e7ad4,_0x49d625);_0x2a63a0(null);})[_0x7c68('0xe')](_0x2a63a0(null));};}for(var e in events){if(events[_0x7c68('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x7c68('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5afc3f2..787fad4 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 _0xa161=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x1722c0,_0x18e2c7){var _0x3fc971=function(_0x3de912){while(--_0x3de912){_0x1722c0['push'](_0x1722c0['shift']());}};_0x3fc971(++_0x18e2c7);}(_0xa161,0x1bf));var _0x1a16=function(_0x35f44b,_0x13e2b9){_0x35f44b=_0x35f44b-0x0;var _0x56d92e=_0xa161[_0x35f44b];return _0x56d92e;};'use strict';var _=require(_0x1a16('0x0'));var util=require(_0x1a16('0x1'));var logger=require(_0x1a16('0x2'))(_0x1a16('0x3'));var moment=require('moment');var BPromise=require(_0x1a16('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a16('0x5'));var rimraf=require(_0x1a16('0x6'));var config=require(_0x1a16('0x7'));var attributes=require(_0x1a16('0x8'));module[_0x1a16('0x9')]=function(_0x235249,_0x25f1f1){return _0x235249[_0x1a16('0xa')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48b491,_0x5fad90,_0x2ec2f5){if(_0x48b491['changed'](_0x1a16('0xb'))){_0x48b491['closedAt']=moment()[_0x1a16('0xc')](_0x1a16('0xd'));}_0x2ec2f5(null,_0x48b491);}}});}; \ No newline at end of file +var _0xd7c8=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','rimraf','./faxInteraction.attributes','exports','define','fax_interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd7c8,0x17a));var _0x8d7c=function(_0x10f298,_0x330326){_0x10f298=_0x10f298-0x0;var _0x1feb62=_0xd7c8[_0x10f298];return _0x1feb62;};'use strict';var _=require(_0x8d7c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8d7c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d7c('0x2'));var config=require('../../config/environment');var attributes=require(_0x8d7c('0x3'));module[_0x8d7c('0x4')]=function(_0x5b6933,_0x456aeb){return _0x5b6933[_0x8d7c('0x5')]('FaxInteraction',attributes,{'tableName':_0x8d7c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe67978,_0x2510ee,_0x355a80){if(_0xe67978[_0x8d7c('0x7')](_0x8d7c('0x8'))){_0xe67978[_0x8d7c('0x9')]=moment()['format'](_0x8d7c('0xa'));}_0x355a80(null,_0xe67978);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 832d399..a91df28 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 _0x3d2e=['client','http','redis','defaults','localhost','./faxInteraction.socket','register','info','request\x20sent','debug','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','then','catch','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3009d0,_0x4edd4a){var _0x280a4f=function(_0x4d989d){while(--_0x4d989d){_0x3009d0['push'](_0x3009d0['shift']());}};_0x280a4f(++_0x4edd4a);}(_0x3d2e,0xfd));var _0xe3d2=function(_0xaf62a3,_0x367b9b){_0xaf62a3=_0xaf62a3-0x0;var _0x55acec=_0x3d2e[_0xaf62a3];return _0x55acec;};'use strict';var _=require(_0xe3d2('0x0'));var util=require(_0xe3d2('0x1'));var moment=require(_0xe3d2('0x2'));var BPromise=require(_0xe3d2('0x3'));var rs=require(_0xe3d2('0x4'));var fs=require('fs');var Redis=require(_0xe3d2('0x5'));var db=require(_0xe3d2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3d2('0x7'))(_0xe3d2('0x8'));var config=require(_0xe3d2('0x9'));var jayson=require(_0xe3d2('0xa'));var client=jayson[_0xe3d2('0xb')][_0xe3d2('0xc')]({'port':0x232a});config[_0xe3d2('0xd')]=_[_0xe3d2('0xe')](config[_0xe3d2('0xd')],{'host':_0xe3d2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3d2('0xd')]));require(_0xe3d2('0x10'))[_0xe3d2('0x11')](socket);function respondWithRpcPromise(_0x14fb30,_0x52bcc1,_0x8a32e2){return new BPromise(function(_0x517523,_0xe2021){return client['request'](_0x14fb30,_0x8a32e2)['then'](function(_0xc0f459){logger[_0xe3d2('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x52bcc1,_0xe3d2('0x13'));logger[_0xe3d2('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x52bcc1,_0xe3d2('0x13'),JSON[_0xe3d2('0x15')](_0xc0f459));if(_0xc0f459['error']){if(_0xc0f459[_0xe3d2('0x16')][_0xe3d2('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x52bcc1,_0xc0f459[_0xe3d2('0x16')][_0xe3d2('0x18')]);return _0xe2021(_0xc0f459['error'][_0xe3d2('0x18')]);}logger[_0xe3d2('0x16')](_0xe3d2('0x19'),_0x52bcc1,_0xc0f459[_0xe3d2('0x16')][_0xe3d2('0x18')]);return _0x517523(_0xc0f459[_0xe3d2('0x16')]['message']);}else{logger[_0xe3d2('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x52bcc1,_0xe3d2('0x13'));_0x517523(_0xc0f459[_0xe3d2('0x1a')][_0xe3d2('0x18')]);}})['catch'](function(_0x2c3510){logger[_0xe3d2('0x16')](_0xe3d2('0x19'),_0x52bcc1,_0x2c3510);_0xe2021(_0x2c3510);});});}exports[_0xe3d2('0x1b')]=function(_0x74f89e){var _0x31cd3b=this;return new Promise(function(_0x343218,_0x26637f){return db[_0xe3d2('0x1c')][_0xe3d2('0x1d')](_0x74f89e[_0xe3d2('0x1e')],{'raw':_0x74f89e[_0xe3d2('0x1f')]?_0x74f89e[_0xe3d2('0x1f')][_0xe3d2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x74f89e[_0xe3d2('0x1f')]?_0x74f89e['options']['where']||null:null,'attributes':_0x74f89e[_0xe3d2('0x1f')]?_0x74f89e[_0xe3d2('0x1f')][_0xe3d2('0x21')]||null:null,'limit':_0x74f89e[_0xe3d2('0x1f')]?_0x74f89e['options']['limit']||null:null})[_0xe3d2('0x22')](function(_0x428c18){logger['info'](_0xe3d2('0x1b'),_0x74f89e);logger[_0xe3d2('0x14')](_0xe3d2('0x1b'),_0x74f89e,JSON[_0xe3d2('0x15')](_0x428c18));_0x343218(_0x428c18);})[_0xe3d2('0x23')](function(_0x444dd0){logger[_0xe3d2('0x16')]('UpdateFaxInteraction',_0x444dd0[_0xe3d2('0x18')],_0x74f89e);_0x26637f(_0x31cd3b[_0xe3d2('0x16')](0x1f4,_0x444dd0[_0xe3d2('0x18')]));});});};exports[_0xe3d2('0x24')]=function(_0xc76b68){return new Promise(function(_0xb7722b,_0x587f47){return db['FaxInteraction'][_0xe3d2('0x25')]({'where':_0xc76b68[_0xe3d2('0x1f')]?_0xc76b68[_0xe3d2('0x1f')][_0xe3d2('0x26')]||null:null})['then'](function(_0x41ec5f){if(_0x41ec5f){return _0x41ec5f[_0xe3d2('0x27')](_0xc76b68[_0xe3d2('0x1e')][_0xe3d2('0x28')],_[_0xe3d2('0x29')](_0xc76b68[_0xe3d2('0x1e')],[_0xe3d2('0x28'),'id'])||{});}})[_0xe3d2('0x2a')](function(_0x210dd4){logger[_0xe3d2('0x12')](_0xe3d2('0x2b'),_0xc76b68);logger[_0xe3d2('0x14')](_0xe3d2('0x2b'),_0xc76b68,JSON[_0xe3d2('0x15')](_0x210dd4));_0xb7722b(_0x210dd4);})[_0xe3d2('0x23')](function(_0x4bb8ea){logger[_0xe3d2('0x16')](_0xe3d2('0x2b'),_0x4bb8ea[_0xe3d2('0x18')],_0xc76b68);_0x587f47(_this[_0xe3d2('0x16')](0x1f4,_0x4bb8ea[_0xe3d2('0x18')]));});});}; \ No newline at end of file +var _0x7a27=['FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','where','attributes','then','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b0c91,_0x1e2dcd){var _0x28b7d6=function(_0x215c99){while(--_0x215c99){_0x4b0c91['push'](_0x4b0c91['shift']());}};_0x28b7d6(++_0x1e2dcd);}(_0x7a27,0x125));var _0x77a2=function(_0xd606c0,_0x1e089b){_0xd606c0=_0xd606c0-0x0;var _0x57777e=_0x7a27[_0xd606c0];return _0x57777e;};'use strict';var _=require(_0x77a2('0x0'));var util=require(_0x77a2('0x1'));var moment=require('moment');var BPromise=require(_0x77a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x77a2('0x4'));var logger=require(_0x77a2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x77a2('0x6'));var client=jayson[_0x77a2('0x7')][_0x77a2('0x8')]({'port':0x232a});config[_0x77a2('0x9')]=_[_0x77a2('0xa')](config[_0x77a2('0x9')],{'host':_0x77a2('0xb'),'port':0x18eb});var socket=require(_0x77a2('0xc'))(new Redis(config[_0x77a2('0x9')]));require(_0x77a2('0xd'))[_0x77a2('0xe')](socket);function respondWithRpcPromise(_0x21aa56,_0x164166,_0x4a9698){return new BPromise(function(_0x486dee,_0x57198a){return client['request'](_0x21aa56,_0x4a9698)['then'](function(_0x27b1b5){logger[_0x77a2('0xf')](_0x77a2('0x10'),_0x164166,_0x77a2('0x11'));logger[_0x77a2('0x12')](_0x77a2('0x13'),_0x164166,_0x77a2('0x11'),JSON[_0x77a2('0x14')](_0x27b1b5));if(_0x27b1b5[_0x77a2('0x15')]){if(_0x27b1b5[_0x77a2('0x15')]['code']===0x1f4){logger[_0x77a2('0x15')](_0x77a2('0x10'),_0x164166,_0x27b1b5[_0x77a2('0x15')][_0x77a2('0x16')]);return _0x57198a(_0x27b1b5[_0x77a2('0x15')][_0x77a2('0x16')]);}logger[_0x77a2('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x164166,_0x27b1b5[_0x77a2('0x15')][_0x77a2('0x16')]);return _0x486dee(_0x27b1b5[_0x77a2('0x15')]['message']);}else{logger[_0x77a2('0xf')](_0x77a2('0x10'),_0x164166,'request\x20sent');_0x486dee(_0x27b1b5[_0x77a2('0x17')]['message']);}})[_0x77a2('0x18')](function(_0x46bdff){logger[_0x77a2('0x15')](_0x77a2('0x10'),_0x164166,_0x46bdff);_0x57198a(_0x46bdff);});});}exports['UpdateFaxInteraction']=function(_0xf24a0f){var _0x216e71=this;return new Promise(function(_0x446649,_0x5d64b3){return db['FaxInteraction'][_0x77a2('0x19')](_0xf24a0f[_0x77a2('0x1a')],{'raw':_0xf24a0f[_0x77a2('0x1b')]?_0xf24a0f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf24a0f[_0x77a2('0x1b')]?_0xf24a0f['options'][_0x77a2('0x1c')]||null:null,'attributes':_0xf24a0f['options']?_0xf24a0f['options'][_0x77a2('0x1d')]||null:null,'limit':_0xf24a0f[_0x77a2('0x1b')]?_0xf24a0f[_0x77a2('0x1b')]['limit']||null:null})[_0x77a2('0x1e')](function(_0x350242){logger[_0x77a2('0xf')](_0x77a2('0x1f'),_0xf24a0f);logger[_0x77a2('0x12')](_0x77a2('0x1f'),_0xf24a0f,JSON[_0x77a2('0x14')](_0x350242));_0x446649(_0x350242);})[_0x77a2('0x18')](function(_0x1b2649){logger['error'](_0x77a2('0x1f'),_0x1b2649[_0x77a2('0x16')],_0xf24a0f);_0x5d64b3(_0x216e71[_0x77a2('0x15')](0x1f4,_0x1b2649[_0x77a2('0x16')]));});});};exports[_0x77a2('0x20')]=function(_0x190a94){return new Promise(function(_0x391720,_0x6719ad){return db[_0x77a2('0x21')][_0x77a2('0x22')]({'where':_0x190a94[_0x77a2('0x1b')]?_0x190a94[_0x77a2('0x1b')][_0x77a2('0x1c')]||null:null})['then'](function(_0x174435){if(_0x174435){return _0x174435[_0x77a2('0x23')](_0x190a94[_0x77a2('0x1a')]['ids'],_[_0x77a2('0x24')](_0x190a94[_0x77a2('0x1a')],['ids','id'])||{});}})[_0x77a2('0x25')](function(_0x257bb4){logger[_0x77a2('0xf')]('AddTags',_0x190a94);logger[_0x77a2('0x12')]('AddTags',_0x190a94,JSON[_0x77a2('0x14')](_0x257bb4));_0x391720(_0x257bb4);})[_0x77a2('0x18')](function(_0x31febf){logger[_0x77a2('0x15')](_0x77a2('0x26'),_0x31febf[_0x77a2('0x16')],_0x190a94);_0x6719ad(_this[_0x77a2('0x15')](0x1f4,_0x31febf[_0x77a2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 03a187d..5a033d1 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 _0x7a59=['register','faxInteraction:','./faxInteraction.events','remove','update','removeListener'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7a59,0x128));var _0x97a5=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x7a59[_0x1589dd];return _0x1bddd1;};'use strict';var FaxInteractionEvents=require(_0x97a5('0x0'));var events=['save',_0x97a5('0x1'),_0x97a5('0x2')];function createListener(_0x1acc16,_0x1f915e){return function(_0x4a75a6){_0x1f915e['emit'](_0x1acc16,_0x4a75a6);};}function removeListener(_0x12e396,_0x3ddc0a){return function(){FaxInteractionEvents[_0x97a5('0x3')](_0x12e396,_0x3ddc0a);};}exports[_0x97a5('0x4')]=function(_0x261d2f){for(var _0xc05223=0x0,_0xaf1ef9=events['length'];_0xc05223<_0xaf1ef9;_0xc05223++){var _0x432d30=events[_0xc05223];var _0x50d509=createListener(_0x97a5('0x5')+_0x432d30,_0x261d2f);FaxInteractionEvents['on'](_0x432d30,_0x50d509);}}; \ No newline at end of file +var _0x4231=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x439fda,_0x20ca40){var _0x488ce6=function(_0x1dafc8){while(--_0x1dafc8){_0x439fda['push'](_0x439fda['shift']());}};_0x488ce6(++_0x20ca40);}(_0x4231,0x10f));var _0x1423=function(_0x193266,_0x37c379){_0x193266=_0x193266-0x0;var _0x2a9bde=_0x4231[_0x193266];return _0x2a9bde;};'use strict';var FaxInteractionEvents=require(_0x1423('0x0'));var events=[_0x1423('0x1'),'remove','update'];function createListener(_0x18ec11,_0x227bef){return function(_0x3b0ca4){_0x227bef[_0x1423('0x2')](_0x18ec11,_0x3b0ca4);};}function removeListener(_0x23cc06,_0x49717a){return function(){FaxInteractionEvents[_0x1423('0x3')](_0x23cc06,_0x49717a);};}exports[_0x1423('0x4')]=function(_0x27a31b){for(var _0x2b1982=0x0,_0x581780=events[_0x1423('0x5')];_0x2b1982<_0x581780;_0x2b1982++){var _0x205dae=events[_0x2b1982];var _0x2531a0=createListener(_0x1423('0x6')+_0x205dae,_0x27a31b);FaxInteractionEvents['on'](_0x205dae,_0x2531a0);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index d629718..0a69260 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 _0x1580=['fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:destroy','destroy','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x326def,_0x2a0364){var _0x579ab1=function(_0x3ea80e){while(--_0x3ea80e){_0x326def['push'](_0x326def['shift']());}};_0x579ab1(++_0x2a0364);}(_0x1580,0x6f));var _0x0158=function(_0x1bc400,_0x5a7128){_0x1bc400=_0x1bc400-0x0;var _0x14e171=_0x1580[_0x1bc400];return _0x14e171;};'use strict';var multer=require('multer');var util=require(_0x0158('0x0'));var path=require(_0x0158('0x1'));var timeout=require(_0x0158('0x2'));var express=require(_0x0158('0x3'));var router=express[_0x0158('0x4')]();var fs_extra=require(_0x0158('0x5'));var auth=require(_0x0158('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0158('0x7'));var controller=require(_0x0158('0x8'));router[_0x0158('0x9')]('/',auth[_0x0158('0xa')](),controller['index']);router['get'](_0x0158('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0158('0xc'),auth[_0x0158('0xa')](),controller['show']);router[_0x0158('0x9')](_0x0158('0xd'),auth[_0x0158('0xa')](),controller[_0x0158('0xe')]);router[_0x0158('0x9')](_0x0158('0xf'),auth[_0x0158('0xa')](),controller[_0x0158('0x10')]);router[_0x0158('0x11')]('/',auth['isAuthenticated'](),controller[_0x0158('0x12')]);router[_0x0158('0x11')]('/:id/messages',auth[_0x0158('0xa')](),controller[_0x0158('0x13')]);router['post'](_0x0158('0x14'),auth[_0x0158('0xa')](),interaction[_0x0158('0x15')]('fax',_0x0158('0x16')),controller[_0x0158('0x17')]);router['put'](_0x0158('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x0158('0x18'),'faxinteraction:update'),controller['update']);router['delete'](_0x0158('0xc'),auth[_0x0158('0xa')](),interaction[_0x0158('0x15')](_0x0158('0x18'),_0x0158('0x19')),controller[_0x0158('0x1a')]);router[_0x0158('0x1b')](_0x0158('0x14'),auth[_0x0158('0xa')](),controller['removeTags']);module[_0x0158('0x1c')]=router; \ No newline at end of file +var _0xb76f=['post','addMessage','/:id/tags','tracked','fax','put','/:id','delete','faxinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb76f,0x78));var _0xfb76=function(_0x4538ca,_0x1a5a99){_0x4538ca=_0x4538ca-0x0;var _0x26a5ed=_0xb76f[_0x4538ca];return _0x26a5ed;};'use strict';var multer=require('multer');var util=require(_0xfb76('0x0'));var path=require('path');var timeout=require(_0xfb76('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfb76('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfb76('0x3'));var config=require(_0xfb76('0x4'));var controller=require('./faxInteraction.controller');router[_0xfb76('0x5')]('/',auth['isAuthenticated'](),controller[_0xfb76('0x6')]);router[_0xfb76('0x5')](_0xfb76('0x7'),auth[_0xfb76('0x8')](),controller[_0xfb76('0x9')]);router['get']('/:id',auth[_0xfb76('0x8')](),controller[_0xfb76('0xa')]);router[_0xfb76('0x5')](_0xfb76('0xb'),auth['isAuthenticated'](),controller[_0xfb76('0xc')]);router[_0xfb76('0x5')](_0xfb76('0xd'),auth[_0xfb76('0x8')](),controller[_0xfb76('0xe')]);router[_0xfb76('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfb76('0xf')](_0xfb76('0xb'),auth[_0xfb76('0x8')](),controller[_0xfb76('0x10')]);router[_0xfb76('0xf')](_0xfb76('0x11'),auth['isAuthenticated'](),interaction[_0xfb76('0x12')](_0xfb76('0x13'),'faxinteraction:addtags'),controller['addTags']);router[_0xfb76('0x14')](_0xfb76('0x15'),auth['isAuthenticated'](),interaction[_0xfb76('0x12')]('fax','faxinteraction:update'),controller['update']);router[_0xfb76('0x16')](_0xfb76('0x15'),auth[_0xfb76('0x8')](),interaction[_0xfb76('0x12')](_0xfb76('0x13'),_0xfb76('0x17')),controller[_0xfb76('0x18')]);router['delete']('/:id/tags',auth[_0xfb76('0x8')](),controller[_0xfb76('0x19')]);module[_0xfb76('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 837ad01..c086821 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 _0xffe1=['TEXT','DATE','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xffe1,0x175));var _0x1ffe=function(_0x3372fb,_0x3a4b3c){_0x3372fb=_0x3372fb-0x0;var _0x59690d=_0xffe1[_0x3372fb];return _0x59690d;};'use strict';var Sequelize=require(_0x1ffe('0x0'));module[_0x1ffe('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1ffe('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1ffe('0x3')]('in',_0x1ffe('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x1ffe('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1ffe('0x6')]}}; \ No newline at end of file +var _0x5044=['ENUM','out','TEXT','DATE','exports','medium','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5044,0xc8));var _0x4504=function(_0x1404b2,_0x458abd){_0x1404b2=_0x1404b2-0x0;var _0x530122=_0x5044[_0x1404b2];return _0x530122;};'use strict';var Sequelize=require('sequelize');module[_0x4504('0x0')]={'body':{'type':Sequelize['TEXT'](_0x4504('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4504('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4504('0x3')]('in',_0x4504('0x4')),'defaultValue':_0x4504('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4504('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4504('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3eb4d92..07dd213 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 _0x36ed=['describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','basename','download','join','root','files','attachments','rimraf','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','show','params','keys','find','body','destroy'];(function(_0x5b541d,_0x4ed333){var _0x2878ee=function(_0x48363b){while(--_0x48363b){_0x5b541d['push'](_0x5b541d['shift']());}};_0x2878ee(++_0x4ed333);}(_0x36ed,0x145));var _0xd36e=function(_0x15780c,_0x238ace){_0x15780c=_0x15780c-0x0;var _0x26a42d=_0x36ed[_0x15780c];return _0x26a42d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd36e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd36e('0x1'));var rp=require(_0xd36e('0x2'));var moment=require(_0xd36e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd36e('0x4'));var sox=require('sox');var csv=require(_0xd36e('0x5'));var ejs=require(_0xd36e('0x6'));var fs=require('fs');var fs_extra=require(_0xd36e('0x7'));var _=require('lodash');var squel=require(_0xd36e('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd36e('0x9'));var toCsv=require('to-csv');var querystring=require(_0xd36e('0xa'));var Papa=require('papaparse');var Redis=require(_0xd36e('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xd36e('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd36e('0xd'));var logger=require(_0xd36e('0xe'))(_0xd36e('0xf'));var utils=require('../../config/utils');var config=require(_0xd36e('0x10'));var licenseUtil=require(_0xd36e('0x11'));var db=require(_0xd36e('0x12'))['db'];config[_0xd36e('0x13')]=_[_0xd36e('0x14')](config['redis'],{'host':_0xd36e('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd36e('0x13')]));require(_0xd36e('0x16'))['register'](socket);var jayson=require(_0xd36e('0x17'));var client=jayson[_0xd36e('0x18')]['http']({'port':0x232c});var client9002=jayson['client'][_0xd36e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4c503e,_0x74c085,_0x512d09,_0x17cbef){return new BPromise(function(_0x140724,_0x1ebe0e){var _0x5a3567=_0x17cbef||client;return _0x5a3567[_0xd36e('0x1a')](_0x4c503e,_0x512d09)[_0xd36e('0x1b')](function(_0x205dce){logger[_0xd36e('0x1c')](_0xd36e('0x1d'),_0x74c085,_0xd36e('0x1e'));logger[_0xd36e('0x1f')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x74c085,_0xd36e('0x1e'),JSON[_0xd36e('0x20')](_0x205dce));if(_0x205dce['error']){if(_0x205dce[_0xd36e('0x21')][_0xd36e('0x22')]===0x1f4){logger[_0xd36e('0x21')]('FaxMessage,\x20%s,\x20%s',_0x74c085,_0x205dce[_0xd36e('0x21')][_0xd36e('0x23')]);return _0x1ebe0e(_0x205dce['error'][_0xd36e('0x23')]);}logger['error'](_0xd36e('0x1d'),_0x74c085,_0x205dce['error']['message']);return _0x140724(_0x205dce[_0xd36e('0x21')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x74c085,_0xd36e('0x1e'));_0x140724(_0x205dce[_0xd36e('0x24')][_0xd36e('0x23')]);}})[_0xd36e('0x25')](function(_0x4caa1d){logger[_0xd36e('0x21')]('FaxMessage,\x20%s,\x20%s',_0x74c085,_0x4caa1d);_0x1ebe0e(_0x4caa1d);});});}function respondWithStatusCode(_0xb1da81,_0x45dfbf){_0x45dfbf=_0x45dfbf||0xcc;return function(_0x4aafde){if(_0x4aafde){return _0xb1da81[_0xd36e('0x26')](_0x45dfbf);}return _0xb1da81['status'](_0x45dfbf)[_0xd36e('0x27')]();};}function respondWithResult(_0x42d01b,_0x35defa){_0x35defa=_0x35defa||0xc8;return function(_0x17f138){if(_0x17f138){return _0x42d01b[_0xd36e('0x28')](_0x35defa)[_0xd36e('0x29')](_0x17f138);}};}function respondWithFilteredResult(_0x5960c4,_0x17c7d1){return function(_0x30e1db){if(_0x30e1db){var _0x345b69=typeof _0x17c7d1[_0xd36e('0x2a')]===_0xd36e('0x2b')&&typeof _0x17c7d1[_0xd36e('0x2c')]==='undefined';var _0x362fa2=_0x30e1db[_0xd36e('0x2d')];var _0x463897=_0x345b69?0x0:_0x17c7d1['offset'];var _0x48bd52=_0x345b69?_0x30e1db[_0xd36e('0x2d')]:_0x17c7d1['offset']+_0x17c7d1[_0xd36e('0x2c')];var _0xc9e62c;if(_0x48bd52>=_0x362fa2){_0x48bd52=_0x362fa2;_0xc9e62c=0xc8;}else{_0xc9e62c=0xce;}_0x5960c4[_0xd36e('0x28')](_0xc9e62c);return _0x5960c4[_0xd36e('0x2e')](_0xd36e('0x2f'),_0x463897+'-'+_0x48bd52+'/'+_0x362fa2)['json'](_0x30e1db);}return null;};}function patchUpdates(_0x39d5f4){return function(_0x1d6600){try{jsonpatch['apply'](_0x1d6600,_0x39d5f4,!![]);}catch(_0x44baf2){return BPromise[_0xd36e('0x30')](_0x44baf2);}return _0x1d6600[_0xd36e('0x31')]();};}function saveUpdates(_0x222d9a,_0x27cd9a){return function(_0xc1cbca){if(_0xc1cbca){return _0xc1cbca[_0xd36e('0x32')](_0x222d9a)['then'](function(_0x53e955){return _0x53e955;});}return null;};}function removeEntity(_0x34aada,_0x378fbd){return function(_0x5f326a){if(_0x5f326a){return _0x5f326a['destroy']()[_0xd36e('0x1b')](function(){_0x34aada[_0xd36e('0x28')](0xcc)[_0xd36e('0x27')]();});}};}function handleEntityNotFound(_0x1a9ac3,_0xec3b3c){return function(_0x2ffc5e){if(!_0x2ffc5e){_0x1a9ac3[_0xd36e('0x26')](0x194);}return _0x2ffc5e;};}function handleError(_0xaef920,_0x5012a9){_0x5012a9=_0x5012a9||0x1f4;return function(_0x1578db){logger[_0xd36e('0x21')](_0x1578db[_0xd36e('0x33')]);if(_0x1578db[_0xd36e('0x34')]){delete _0x1578db['name'];}_0xaef920[_0xd36e('0x28')](_0x5012a9)[_0xd36e('0x35')](_0x1578db);};}exports[_0xd36e('0x36')]=function(_0x4919ad,_0x56552a){var _0x46118f={},_0x24cb5a={},_0x2ece0a={'count':0x0,'rows':[]};var _0x2ada9e=_[_0xd36e('0x37')](db['FaxMessage'][_0xd36e('0x38')],function(_0x59a415){return{'name':_0x59a415[_0xd36e('0x39')],'type':_0x59a415[_0xd36e('0x3a')][_0xd36e('0x3b')]};});_0x24cb5a['model']=_[_0xd36e('0x37')](_0x2ada9e,'name');_0x24cb5a[_0xd36e('0x3c')]=_['keys'](_0x4919ad[_0xd36e('0x3c')]);_0x24cb5a['filters']=_[_0xd36e('0x3d')](_0x24cb5a[_0xd36e('0x3e')],_0x24cb5a[_0xd36e('0x3c')]);_0x46118f[_0xd36e('0x3f')]=_[_0xd36e('0x3d')](_0x24cb5a[_0xd36e('0x3e')],qs[_0xd36e('0x40')](_0x4919ad[_0xd36e('0x3c')][_0xd36e('0x40')]));_0x46118f[_0xd36e('0x3f')]=_0x46118f[_0xd36e('0x3f')][_0xd36e('0x41')]?_0x46118f[_0xd36e('0x3f')]:_0x24cb5a['model'];if(!_0x4919ad[_0xd36e('0x3c')][_0xd36e('0x42')]('nolimit')){_0x46118f[_0xd36e('0x2c')]=qs['limit'](_0x4919ad['query'][_0xd36e('0x2c')]);_0x46118f[_0xd36e('0x2a')]=qs[_0xd36e('0x2a')](_0x4919ad[_0xd36e('0x3c')][_0xd36e('0x2a')]);}_0x46118f[_0xd36e('0x43')]=qs['sort'](_0x4919ad[_0xd36e('0x3c')][_0xd36e('0x44')]);_0x46118f[_0xd36e('0x45')]=qs[_0xd36e('0x46')](_['pick'](_0x4919ad['query'],_0x24cb5a['filters']),_0x2ada9e);if(_0x4919ad[_0xd36e('0x3c')][_0xd36e('0x47')]){_0x46118f[_0xd36e('0x45')]=_[_0xd36e('0x48')](_0x46118f['where'],{'$or':_['map'](_0x2ada9e,function(_0x1a6dcc){if(_0x1a6dcc[_0xd36e('0x3a')]!==_0xd36e('0x49')){var _0x17bbb5={};_0x17bbb5[_0x1a6dcc['name']]={'$like':'%'+_0x4919ad['query']['filter']+'%'};return _0x17bbb5;}})});}_0x46118f=_['merge']({},_0x46118f,_0x4919ad[_0xd36e('0x4a')]);var _0x231a11={'where':_0x46118f[_0xd36e('0x45')]};return db[_0xd36e('0x4b')]['count'](_0x231a11)[_0xd36e('0x1b')](function(_0x1dd396){_0x2ece0a[_0xd36e('0x2d')]=_0x1dd396;if(_0x4919ad[_0xd36e('0x3c')][_0xd36e('0x4c')]){_0x46118f[_0xd36e('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0xd36e('0x4e')](_0x46118f);})[_0xd36e('0x1b')](function(_0x22d77d){_0x2ece0a[_0xd36e('0x4f')]=_0x22d77d;return _0x2ece0a;})[_0xd36e('0x1b')](respondWithFilteredResult(_0x56552a,_0x46118f))[_0xd36e('0x25')](handleError(_0x56552a,null));};exports[_0xd36e('0x50')]=function(_0x3666ec,_0x1005e4){var _0x33a14a={'raw':!![],'where':{'id':_0x3666ec[_0xd36e('0x51')]['id']}},_0x23b83d={};_0x23b83d[_0xd36e('0x3e')]=_[_0xd36e('0x52')](db['FaxMessage']['rawAttributes']);_0x23b83d[_0xd36e('0x3c')]=_[_0xd36e('0x52')](_0x3666ec[_0xd36e('0x3c')]);_0x23b83d[_0xd36e('0x46')]=_[_0xd36e('0x3d')](_0x23b83d[_0xd36e('0x3e')],_0x23b83d[_0xd36e('0x3c')]);_0x33a14a[_0xd36e('0x3f')]=_[_0xd36e('0x3d')](_0x23b83d[_0xd36e('0x3e')],qs[_0xd36e('0x40')](_0x3666ec[_0xd36e('0x3c')][_0xd36e('0x40')]));_0x33a14a[_0xd36e('0x3f')]=_0x33a14a[_0xd36e('0x3f')][_0xd36e('0x41')]?_0x33a14a['attributes']:_0x23b83d[_0xd36e('0x3e')];if(_0x3666ec[_0xd36e('0x3c')][_0xd36e('0x4c')]){_0x33a14a[_0xd36e('0x4d')]=[{'all':!![]}];}_0x33a14a=_['merge']({},_0x33a14a,_0x3666ec[_0xd36e('0x4a')]);return db['FaxMessage'][_0xd36e('0x53')](_0x33a14a)[_0xd36e('0x1b')](handleEntityNotFound(_0x1005e4,null))[_0xd36e('0x1b')](respondWithResult(_0x1005e4,null))['catch'](handleError(_0x1005e4,null));};exports[_0xd36e('0x32')]=function(_0x7b940,_0x513ffa){if(_0x7b940['body']['id']){delete _0x7b940[_0xd36e('0x54')]['id'];}return db[_0xd36e('0x4b')][_0xd36e('0x53')]({'where':{'id':_0x7b940[_0xd36e('0x51')]['id']}})[_0xd36e('0x1b')](handleEntityNotFound(_0x513ffa,null))[_0xd36e('0x1b')](saveUpdates(_0x7b940['body'],null))['then'](respondWithResult(_0x513ffa,null))[_0xd36e('0x25')](handleError(_0x513ffa,null));};exports[_0xd36e('0x55')]=function(_0x17a52d,_0x240796){return db['FaxMessage'][_0xd36e('0x53')]({'where':{'id':_0x17a52d[_0xd36e('0x51')]['id']}})[_0xd36e('0x1b')](handleEntityNotFound(_0x240796,null))[_0xd36e('0x1b')](removeEntity(_0x240796,null))[_0xd36e('0x25')](handleError(_0x240796,null));};exports['describe']=function(_0x174da8,_0x1827a0){return db[_0xd36e('0x4b')][_0xd36e('0x56')]()['then'](respondWithResult(_0x1827a0,null))[_0xd36e('0x25')](handleError(_0x1827a0,null));};var interaction_log=require(_0xd36e('0xe'))(_0xd36e('0x57'));exports[_0xd36e('0x58')]=function(_0x5a2e52,_0x2602a,_0x229e0a){var _0x3ae74f={'agent':{},'channel':_0xd36e('0x59')};if(_0x5a2e52['body']['id']){delete _0x5a2e52[_0xd36e('0x54')]['id'];}_0x5a2e52['body']['read']=!![];_0x5a2e52[_0xd36e('0x54')]['readAt']=moment()[_0xd36e('0x5a')](_0xd36e('0x5b'));_0x5a2e52[_0xd36e('0x54')][_0xd36e('0x5c')]=_0x5a2e52[_0xd36e('0x54')][_0xd36e('0x5c')]||_0x5a2e52['user']['id'];_0x3ae74f[_0xd36e('0x5d')]['id']=_0x5a2e52[_0xd36e('0x54')][_0xd36e('0x5c')];return db['FaxMessage'][_0xd36e('0x53')]({'where':{'id':_0x5a2e52[_0xd36e('0x51')]['id'],'UserId':null}})[_0xd36e('0x1b')](handleEntityNotFound(_0x2602a,null))[_0xd36e('0x1b')](saveUpdates(_0x5a2e52['body'],null))[_0xd36e('0x1b')](function(_0x5eb713){if(_0x5eb713){_0x3ae74f['message']=_0x5eb713[_0xd36e('0x5e')]({'plain':!![]});return db[_0xd36e('0x5f')][_0xd36e('0x53')]({'where':{'id':_0x5eb713['FaxInteractionId']}});}return null;})[_0xd36e('0x1b')](handleEntityNotFound(_0x2602a,null))[_0xd36e('0x1b')](function(_0x5075ca){if(_0x5075ca){return _0x5075ca[_0xd36e('0x32')]({'UserId':_0x5a2e52[_0xd36e('0x54')]['UserId'],'read1stAt':_[_0xd36e('0x60')](_0x5075ca[_0xd36e('0x61')])?moment()[_0xd36e('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd36e('0x1b')](function(_0x121921){if(_0x121921){_0x3ae74f[_0xd36e('0x62')]=_0x121921['get']({'plain':!![]});interaction_log[_0xd36e('0x1c')](_0xd36e('0x63'),_0x5a2e52[_0xd36e('0x64')]['id'],_0x5a2e52[_0xd36e('0x64')][_0xd36e('0x34')],_0x5a2e52[_0xd36e('0x64')][_0xd36e('0x65')],_0x3ae74f[_0xd36e('0x62')]['id'],_0x5a2e52[_0xd36e('0x54')]?JSON[_0xd36e('0x20')](_0x5a2e52[_0xd36e('0x54')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3ae74f);}return null;})[_0xd36e('0x1b')](function(_0x56e176){var _0x1fa46f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56e176[_0xd36e('0x23')][_0xd36e('0x66')];return db[_0xd36e('0x67')]['query'](_0x1fa46f,{'type':db[_0xd36e('0x68')][_0xd36e('0x69')][_0xd36e('0x6a')],'raw':!![]})[_0xd36e('0x1b')](function(_0x41c93a){return _0x41c93a;});})['then'](function(_0xc651ca){if(_0xc651ca){_0x3ae74f[_0xd36e('0x23')][_0xd36e('0x6b')]=_0xc651ca[0x0];if(!_0x5a2e52[_0xd36e('0x54')]['UserId'])return;return db[_0xd36e('0x6c')][_0xd36e('0x53')]({'where':{'id':_0x5a2e52[_0xd36e('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0xd36e('0x34'),_0xd36e('0x6d'),_0xd36e('0x6e'),_0xd36e('0x6f')],'raw':!![]});}return null;})[_0xd36e('0x1b')](function(_0x424fca){if(!_0x424fca)return null;_0x3ae74f['message']['agent']=_0x424fca;return _0x3ae74f;})[_0xd36e('0x1b')](function(_0x55ff7a){if(_0x55ff7a){if(_0x5a2e52[_0xd36e('0x54')][_0xd36e('0x70')]){_0x3ae74f[_0xd36e('0x23')][_0xd36e('0x71')]=util[_0xd36e('0x5a')](_0xd36e('0x72'),_0x5a2e52[_0xd36e('0x64')][_0xd36e('0x34')]);_0x3ae74f[_0xd36e('0x23')][_0xd36e('0x73')]=_0x3ae74f[_0xd36e('0x73')];_0x3ae74f[_0xd36e('0x23')][_0xd36e('0x74')]=_0x3ae74f[_0xd36e('0x73')];_0x3ae74f['message']['event']=_0xd36e('0x58');return respondWithRpcPromise(_0xd36e('0x75'),_0xd36e('0x75'),{'event':_0xd36e('0x76'),'message':_0x3ae74f[_0xd36e('0x23')]},client9002)[_0xd36e('0x1b')](function(){return _0x3ae74f;});}return _0x3ae74f;}return null;})[_0xd36e('0x1b')](respondWithResult(_0x2602a,null))[_0xd36e('0x25')](handleError(_0x2602a,null));};var interaction_log=require('../../config/logger')(_0xd36e('0x57'));exports[_0xd36e('0x30')]=function(_0x4088ba,_0x2e8fc3,_0x482cc8){var _0x3164de={'agent':{},'channel':'fax'};if(_0x4088ba[_0xd36e('0x54')]['id']){delete _0x4088ba[_0xd36e('0x54')]['id'];}_0x4088ba['body'][_0xd36e('0x5c')]=_0x4088ba[_0xd36e('0x54')][_0xd36e('0x5c')]||_0x4088ba[_0xd36e('0x64')]['id'];_0x3164de[_0xd36e('0x5d')]['id']=_0x4088ba[_0xd36e('0x54')][_0xd36e('0x5c')];return db[_0xd36e('0x4b')][_0xd36e('0x53')]({'where':{'id':_0x4088ba[_0xd36e('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e8fc3,null))[_0xd36e('0x1b')](function(_0xbe7103){if(_0xbe7103){_0x3164de[_0xd36e('0x23')]=_0xbe7103[_0xd36e('0x5e')]({'plain':!![]});return db[_0xd36e('0x5f')][_0xd36e('0x53')]({'where':{'id':_0xbe7103['FaxInteractionId']}});}return null;})[_0xd36e('0x1b')](handleEntityNotFound(_0x2e8fc3,null))[_0xd36e('0x1b')](function(_0xd56758){if(_0xd56758){_0x3164de[_0xd36e('0x62')]=_0xd56758['get']({'plain':!![]});interaction_log[_0xd36e('0x1c')](_0xd36e('0x77'),_0x4088ba['user']['id'],_0x4088ba[_0xd36e('0x64')][_0xd36e('0x34')],_0x4088ba[_0xd36e('0x64')]['role'],_0x3164de['interaction']['id'],_0x4088ba['body']?JSON['stringify'](_0x4088ba[_0xd36e('0x54')]):_0xd36e('0x78'));return respondWithRpcPromise('RejectMessage',_0xd36e('0x79'),_0x3164de);}return null;})['then'](function(_0x1c41c0){var _0x441e94=_0xd36e('0x7a')+_0x1c41c0[_0xd36e('0x23')][_0xd36e('0x66')];return db[_0xd36e('0x67')][_0xd36e('0x3c')](_0x441e94,{'type':db[_0xd36e('0x68')][_0xd36e('0x69')][_0xd36e('0x6a')],'raw':!![]})[_0xd36e('0x1b')](function(_0x3f5605){return _0x3f5605;});})[_0xd36e('0x1b')](function(_0x36c973){if(_0x36c973){_0x3164de[_0xd36e('0x23')][_0xd36e('0x6b')]=_0x36c973[0x0];if(!_0x4088ba[_0xd36e('0x54')][_0xd36e('0x5c')])return;return db[_0xd36e('0x6c')][_0xd36e('0x53')]({'where':{'id':_0x4088ba['body'][_0xd36e('0x5c')],'role':_0xd36e('0x5d')},'attributes':['id',_0xd36e('0x34'),_0xd36e('0x6d'),_0xd36e('0x6e'),_0xd36e('0x6f')],'raw':!![]});}return null;})[_0xd36e('0x1b')](function(_0x5e4a55){if(!_0x5e4a55)return null;_0x3164de['message'][_0xd36e('0x5d')]=_0x5e4a55;return _0x3164de;})[_0xd36e('0x1b')](function(_0x40b31b){if(_0x40b31b){_0x40b31b[_0xd36e('0x23')]['interface']=util[_0xd36e('0x5a')](_0xd36e('0x72'),_0x4088ba['user'][_0xd36e('0x34')]);_0x40b31b[_0xd36e('0x23')][_0xd36e('0x73')]=_0x3164de['channel'];_0x40b31b[_0xd36e('0x23')][_0xd36e('0x74')]=_0x3164de[_0xd36e('0x73')];_0x40b31b[_0xd36e('0x23')][_0xd36e('0x7b')]=_0xd36e('0x30');respondWithRpcPromise(_0xd36e('0x75'),_0xd36e('0x75'),{'event':_0xd36e('0x7c'),'message':_0x40b31b[_0xd36e('0x23')]},client9002);return _0x3164de;}return null;})['then'](respondWithResult(_0x2e8fc3,null))[_0xd36e('0x25')](handleError(_0x2e8fc3,null));};exports['create']=function(_0x197ec6,_0x2eb254){var _0x11517f;return db[_0xd36e('0x4b')][_0xd36e('0x7d')](_0x197ec6[_0xd36e('0x54')],{})[_0xd36e('0x1b')](function(_0x3d4250){_0x11517f=_0x3d4250;return db[_0xd36e('0x7e')][_0xd36e('0x7f')]({'where':{'id':_0x11517f[_0xd36e('0x66')]}});})['then'](function(_0x5cb9da){if(_[_0xd36e('0x60')](_0x5cb9da)){return;}else{_0x11517f[_0xd36e('0x59')]=_0x5cb9da['fax'];return db[_0xd36e('0x80')][_0xd36e('0x7f')]({'where':{'id':_0x11517f[_0xd36e('0x81')]}});}})[_0xd36e('0x1b')](function(_0x1de777){return respondWithRpcPromise('SendFax',_0xd36e('0x82'),{'FaxAccountId':_[_0xd36e('0x60')](_0x197ec6[_0xd36e('0x54')])?undefined:_0x197ec6[_0xd36e('0x54')]['FaxAccountId'],'path':_[_0xd36e('0x60')](_0x1de777)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x1de777[_0xd36e('0x83')]),'fax':_[_0xd36e('0x60')](_0x11517f[_0xd36e('0x59')])?undefined:_0x11517f[_0xd36e('0x59')],'AttachmentId':_0x11517f[_0xd36e('0x81')]},client9002);})[_0xd36e('0x1b')](respondWithResult(_0x2eb254,0xc9))[_0xd36e('0x25')](handleError(_0x2eb254,null));};exports[_0xd36e('0x84')]=function(_0x4418d6,_0x245810){var _0x325372=path[_0xd36e('0x85')](config[_0xd36e('0x86')],'server',_0xd36e('0x87'),_0xd36e('0x88'));return db['FaxMessage'][_0xd36e('0x53')]({'where':{'id':_0x4418d6[_0xd36e('0x51')]['id']},'include':[{'model':db['Attachment'],'as':_0xd36e('0x80')}]})[_0xd36e('0x1b')](handleEntityNotFound(_0x245810,null))[_0xd36e('0x1b')](function(_0x371b10){if(_0x371b10){return _0x245810[_0xd36e('0x84')](path[_0xd36e('0x85')](_0x325372,_0x371b10[_0xd36e('0x80')][_0xd36e('0x83')]));}})[_0xd36e('0x25')](handleError(_0x245810,null));}; \ No newline at end of file +var _0xd647=['AttachmentId','SendFax','download','root','files','attachments','basename','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','end','stack','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','body','find','describe','fax-interactions','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','channel','event','accept','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','SIP/%s','motionChannel','rejectmessage','create','CmContact','Attachment','findOne'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0xd647,0x98));var _0x7d64=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xd647[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require(_0x7d64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d64('0x1'));var jsonpatch=require(_0x7d64('0x2'));var rp=require(_0x7d64('0x3'));var moment=require('moment');var BPromise=require(_0x7d64('0x4'));var Mustache=require('mustache');var util=require(_0x7d64('0x5'));var path=require('path');var sox=require(_0x7d64('0x6'));var csv=require(_0x7d64('0x7'));var ejs=require(_0x7d64('0x8'));var fs=require('fs');var fs_extra=require(_0x7d64('0x9'));var _=require('lodash');var squel=require(_0x7d64('0xa'));var crypto=require(_0x7d64('0xb'));var jsforce=require(_0x7d64('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7d64('0x7'));var querystring=require(_0x7d64('0xd'));var Papa=require(_0x7d64('0xe'));var Redis=require(_0x7d64('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d64('0x10'));var hardwareService=require(_0x7d64('0x11'));var logger=require(_0x7d64('0x12'))(_0x7d64('0x13'));var utils=require(_0x7d64('0x14'));var config=require(_0x7d64('0x15'));var licenseUtil=require(_0x7d64('0x16'));var db=require(_0x7d64('0x17'))['db'];config['redis']=_[_0x7d64('0x18')](config[_0x7d64('0x19')],{'host':_0x7d64('0x1a'),'port':0x18eb});var socket=require(_0x7d64('0x1b'))(new Redis(config[_0x7d64('0x19')]));require(_0x7d64('0x1c'))[_0x7d64('0x1d')](socket);var jayson=require(_0x7d64('0x1e'));var client=jayson[_0x7d64('0x1f')][_0x7d64('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x7d64('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2373ff,_0x1e5bd2,_0x2384ac,_0x4b1e09){return new BPromise(function(_0x3af852,_0x4d7e2f){var _0x95b682=_0x4b1e09||client;return _0x95b682[_0x7d64('0x21')](_0x2373ff,_0x2384ac)[_0x7d64('0x22')](function(_0x15ee5d){logger[_0x7d64('0x23')](_0x7d64('0x24'),_0x1e5bd2,_0x7d64('0x25'));logger[_0x7d64('0x26')](_0x7d64('0x27'),_0x1e5bd2,'request\x20sent',JSON[_0x7d64('0x28')](_0x15ee5d));if(_0x15ee5d[_0x7d64('0x29')]){if(_0x15ee5d[_0x7d64('0x29')]['code']===0x1f4){logger[_0x7d64('0x29')](_0x7d64('0x24'),_0x1e5bd2,_0x15ee5d['error']['message']);return _0x4d7e2f(_0x15ee5d[_0x7d64('0x29')][_0x7d64('0x2a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x1e5bd2,_0x15ee5d[_0x7d64('0x29')][_0x7d64('0x2a')]);return _0x3af852(_0x15ee5d[_0x7d64('0x29')][_0x7d64('0x2a')]);}else{logger[_0x7d64('0x23')](_0x7d64('0x24'),_0x1e5bd2,'request\x20sent');_0x3af852(_0x15ee5d[_0x7d64('0x2b')]['message']);}})[_0x7d64('0x2c')](function(_0x422ab1){logger[_0x7d64('0x29')]('FaxMessage,\x20%s,\x20%s',_0x1e5bd2,_0x422ab1);_0x4d7e2f(_0x422ab1);});});}function respondWithStatusCode(_0x2a1d60,_0x1241d3){_0x1241d3=_0x1241d3||0xcc;return function(_0x2aa7e5){if(_0x2aa7e5){return _0x2a1d60[_0x7d64('0x2d')](_0x1241d3);}return _0x2a1d60[_0x7d64('0x2e')](_0x1241d3)['end']();};}function respondWithResult(_0x46cfe3,_0x3e96a6){_0x3e96a6=_0x3e96a6||0xc8;return function(_0x2f03f4){if(_0x2f03f4){return _0x46cfe3['status'](_0x3e96a6)[_0x7d64('0x2f')](_0x2f03f4);}};}function respondWithFilteredResult(_0x6f39b3,_0x47c728){return function(_0x198853){if(_0x198853){var _0xc2a026=typeof _0x47c728[_0x7d64('0x30')]==='undefined'&&typeof _0x47c728[_0x7d64('0x31')]===_0x7d64('0x32');var _0x5448ed=_0x198853['count'];var _0x4071e1=_0xc2a026?0x0:_0x47c728[_0x7d64('0x30')];var _0x153222=_0xc2a026?_0x198853[_0x7d64('0x33')]:_0x47c728[_0x7d64('0x30')]+_0x47c728['limit'];var _0x3cc339;if(_0x153222>=_0x5448ed){_0x153222=_0x5448ed;_0x3cc339=0xc8;}else{_0x3cc339=0xce;}_0x6f39b3[_0x7d64('0x2e')](_0x3cc339);return _0x6f39b3[_0x7d64('0x34')](_0x7d64('0x35'),_0x4071e1+'-'+_0x153222+'/'+_0x5448ed)[_0x7d64('0x2f')](_0x198853);}return null;};}function patchUpdates(_0x228346){return function(_0x4bc242){try{jsonpatch[_0x7d64('0x36')](_0x4bc242,_0x228346,!![]);}catch(_0x3dd71d){return BPromise['reject'](_0x3dd71d);}return _0x4bc242[_0x7d64('0x37')]();};}function saveUpdates(_0x5c06cf,_0x5e58e7){return function(_0x5b9d5e){if(_0x5b9d5e){return _0x5b9d5e[_0x7d64('0x38')](_0x5c06cf)[_0x7d64('0x22')](function(_0x46b6d3){return _0x46b6d3;});}return null;};}function removeEntity(_0x78159e,_0x1b65bb){return function(_0x16fef0){if(_0x16fef0){return _0x16fef0[_0x7d64('0x39')]()[_0x7d64('0x22')](function(){_0x78159e[_0x7d64('0x2e')](0xcc)[_0x7d64('0x3a')]();});}};}function handleEntityNotFound(_0x993902,_0x968aff){return function(_0x3e1a4c){if(!_0x3e1a4c){_0x993902[_0x7d64('0x2d')](0x194);}return _0x3e1a4c;};}function handleError(_0x514a9a,_0x3d01f8){_0x3d01f8=_0x3d01f8||0x1f4;return function(_0x17793f){logger['error'](_0x17793f[_0x7d64('0x3b')]);if(_0x17793f[_0x7d64('0x3c')]){delete _0x17793f[_0x7d64('0x3c')];}_0x514a9a[_0x7d64('0x2e')](_0x3d01f8)[_0x7d64('0x3d')](_0x17793f);};}exports['index']=function(_0x39beed,_0x5acd08){var _0x3e275c={},_0x1a062b={},_0x171047={'count':0x0,'rows':[]};var _0x5292c3=_[_0x7d64('0x3e')](db[_0x7d64('0x3f')][_0x7d64('0x40')],function(_0x1d43f7){return{'name':_0x1d43f7[_0x7d64('0x41')],'type':_0x1d43f7[_0x7d64('0x42')][_0x7d64('0x43')]};});_0x1a062b[_0x7d64('0x44')]=_[_0x7d64('0x3e')](_0x5292c3,_0x7d64('0x3c'));_0x1a062b['query']=_[_0x7d64('0x45')](_0x39beed['query']);_0x1a062b[_0x7d64('0x46')]=_[_0x7d64('0x47')](_0x1a062b[_0x7d64('0x44')],_0x1a062b[_0x7d64('0x48')]);_0x3e275c[_0x7d64('0x49')]=_[_0x7d64('0x47')](_0x1a062b[_0x7d64('0x44')],qs[_0x7d64('0x4a')](_0x39beed['query'][_0x7d64('0x4a')]));_0x3e275c[_0x7d64('0x49')]=_0x3e275c[_0x7d64('0x49')][_0x7d64('0x4b')]?_0x3e275c['attributes']:_0x1a062b[_0x7d64('0x44')];if(!_0x39beed[_0x7d64('0x48')][_0x7d64('0x4c')](_0x7d64('0x4d'))){_0x3e275c[_0x7d64('0x31')]=qs['limit'](_0x39beed[_0x7d64('0x48')][_0x7d64('0x31')]);_0x3e275c[_0x7d64('0x30')]=qs[_0x7d64('0x30')](_0x39beed['query'][_0x7d64('0x30')]);}_0x3e275c[_0x7d64('0x4e')]=qs[_0x7d64('0x4f')](_0x39beed[_0x7d64('0x48')][_0x7d64('0x4f')]);_0x3e275c['where']=qs[_0x7d64('0x46')](_[_0x7d64('0x50')](_0x39beed[_0x7d64('0x48')],_0x1a062b['filters']),_0x5292c3);if(_0x39beed[_0x7d64('0x48')][_0x7d64('0x51')]){_0x3e275c[_0x7d64('0x52')]=_[_0x7d64('0x53')](_0x3e275c[_0x7d64('0x52')],{'$or':_['map'](_0x5292c3,function(_0x4e5c0f){if(_0x4e5c0f[_0x7d64('0x42')]!=='VIRTUAL'){var _0x22a507={};_0x22a507[_0x4e5c0f['name']]={'$like':'%'+_0x39beed[_0x7d64('0x48')][_0x7d64('0x51')]+'%'};return _0x22a507;}})});}_0x3e275c=_[_0x7d64('0x53')]({},_0x3e275c,_0x39beed[_0x7d64('0x54')]);var _0x569f58={'where':_0x3e275c[_0x7d64('0x52')]};return db[_0x7d64('0x3f')]['count'](_0x569f58)[_0x7d64('0x22')](function(_0x6d5387){_0x171047[_0x7d64('0x33')]=_0x6d5387;if(_0x39beed[_0x7d64('0x48')][_0x7d64('0x55')]){_0x3e275c[_0x7d64('0x56')]=[{'all':!![]}];}return db[_0x7d64('0x3f')][_0x7d64('0x57')](_0x3e275c);})['then'](function(_0x1b5e1a){_0x171047[_0x7d64('0x58')]=_0x1b5e1a;return _0x171047;})[_0x7d64('0x22')](respondWithFilteredResult(_0x5acd08,_0x3e275c))[_0x7d64('0x2c')](handleError(_0x5acd08,null));};exports['show']=function(_0xc5cd45,_0x3e15fa){var _0x4d5919={'raw':!![],'where':{'id':_0xc5cd45[_0x7d64('0x59')]['id']}},_0x120e37={};_0x120e37[_0x7d64('0x44')]=_[_0x7d64('0x45')](db[_0x7d64('0x3f')][_0x7d64('0x40')]);_0x120e37[_0x7d64('0x48')]=_['keys'](_0xc5cd45[_0x7d64('0x48')]);_0x120e37[_0x7d64('0x46')]=_[_0x7d64('0x47')](_0x120e37[_0x7d64('0x44')],_0x120e37['query']);_0x4d5919[_0x7d64('0x49')]=_[_0x7d64('0x47')](_0x120e37[_0x7d64('0x44')],qs[_0x7d64('0x4a')](_0xc5cd45[_0x7d64('0x48')]['fields']));_0x4d5919[_0x7d64('0x49')]=_0x4d5919['attributes'][_0x7d64('0x4b')]?_0x4d5919[_0x7d64('0x49')]:_0x120e37[_0x7d64('0x44')];if(_0xc5cd45[_0x7d64('0x48')][_0x7d64('0x55')]){_0x4d5919['include']=[{'all':!![]}];}_0x4d5919=_[_0x7d64('0x53')]({},_0x4d5919,_0xc5cd45[_0x7d64('0x54')]);return db['FaxMessage']['find'](_0x4d5919)['then'](handleEntityNotFound(_0x3e15fa,null))[_0x7d64('0x22')](respondWithResult(_0x3e15fa,null))[_0x7d64('0x2c')](handleError(_0x3e15fa,null));};exports[_0x7d64('0x38')]=function(_0x1200dd,_0x4e4334){if(_0x1200dd[_0x7d64('0x5a')]['id']){delete _0x1200dd[_0x7d64('0x5a')]['id'];}return db[_0x7d64('0x3f')][_0x7d64('0x5b')]({'where':{'id':_0x1200dd[_0x7d64('0x59')]['id']}})[_0x7d64('0x22')](handleEntityNotFound(_0x4e4334,null))['then'](saveUpdates(_0x1200dd['body'],null))['then'](respondWithResult(_0x4e4334,null))[_0x7d64('0x2c')](handleError(_0x4e4334,null));};exports[_0x7d64('0x39')]=function(_0x4b3906,_0x480e9d){return db[_0x7d64('0x3f')]['find']({'where':{'id':_0x4b3906['params']['id']}})[_0x7d64('0x22')](handleEntityNotFound(_0x480e9d,null))[_0x7d64('0x22')](removeEntity(_0x480e9d,null))[_0x7d64('0x2c')](handleError(_0x480e9d,null));};exports[_0x7d64('0x5c')]=function(_0x27dbe2,_0x2f57b3){return db['FaxMessage'][_0x7d64('0x5c')]()[_0x7d64('0x22')](respondWithResult(_0x2f57b3,null))[_0x7d64('0x2c')](handleError(_0x2f57b3,null));};var interaction_log=require(_0x7d64('0x12'))(_0x7d64('0x5d'));exports['accept']=function(_0x9164b5,_0x148fbf,_0x5ac802){var _0x38fa43={'agent':{},'channel':_0x7d64('0x5e')};if(_0x9164b5[_0x7d64('0x5a')]['id']){delete _0x9164b5[_0x7d64('0x5a')]['id'];}_0x9164b5[_0x7d64('0x5a')][_0x7d64('0x5f')]=!![];_0x9164b5[_0x7d64('0x5a')]['readAt']=moment()['format'](_0x7d64('0x60'));_0x9164b5['body'][_0x7d64('0x61')]=_0x9164b5[_0x7d64('0x5a')][_0x7d64('0x61')]||_0x9164b5[_0x7d64('0x62')]['id'];_0x38fa43[_0x7d64('0x63')]['id']=_0x9164b5[_0x7d64('0x5a')][_0x7d64('0x61')];return db[_0x7d64('0x3f')]['find']({'where':{'id':_0x9164b5[_0x7d64('0x59')]['id'],'UserId':null}})[_0x7d64('0x22')](handleEntityNotFound(_0x148fbf,null))['then'](saveUpdates(_0x9164b5['body'],null))[_0x7d64('0x22')](function(_0x43495c){if(_0x43495c){_0x38fa43[_0x7d64('0x2a')]=_0x43495c[_0x7d64('0x64')]({'plain':!![]});return db[_0x7d64('0x65')][_0x7d64('0x5b')]({'where':{'id':_0x43495c[_0x7d64('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x148fbf,null))[_0x7d64('0x22')](function(_0x53acc1){if(_0x53acc1){return _0x53acc1[_0x7d64('0x38')]({'UserId':_0x9164b5[_0x7d64('0x5a')][_0x7d64('0x61')],'read1stAt':_[_0x7d64('0x67')](_0x53acc1[_0x7d64('0x68')])?moment()[_0x7d64('0x69')](_0x7d64('0x60')):undefined});}return null;})[_0x7d64('0x22')](function(_0x27452b){if(_0x27452b){_0x38fa43['interaction']=_0x27452b[_0x7d64('0x64')]({'plain':!![]});interaction_log[_0x7d64('0x23')](_0x7d64('0x6a'),_0x9164b5[_0x7d64('0x62')]['id'],_0x9164b5[_0x7d64('0x62')][_0x7d64('0x3c')],_0x9164b5[_0x7d64('0x62')]['role'],_0x38fa43[_0x7d64('0x6b')]['id'],_0x9164b5[_0x7d64('0x5a')]?JSON['stringify'](_0x9164b5[_0x7d64('0x5a')]):_0x7d64('0x6c'));return respondWithRpcPromise(_0x7d64('0x6d'),_0x7d64('0x6e'),_0x38fa43);}return null;})['then'](function(_0x1150c5){var _0x451a3e=_0x7d64('0x6f')+_0x1150c5['message']['ContactId'];return db[_0x7d64('0x70')]['query'](_0x451a3e,{'type':db[_0x7d64('0x71')]['QueryTypes'][_0x7d64('0x72')],'raw':!![]})[_0x7d64('0x22')](function(_0x2b2859){return _0x2b2859;});})[_0x7d64('0x22')](function(_0x46609b){if(_0x46609b){_0x38fa43[_0x7d64('0x2a')][_0x7d64('0x73')]=_0x46609b[0x0];if(!_0x9164b5[_0x7d64('0x5a')][_0x7d64('0x61')])return;return db[_0x7d64('0x74')]['find']({'where':{'id':_0x9164b5[_0x7d64('0x5a')]['UserId'],'role':_0x7d64('0x63')},'attributes':['id',_0x7d64('0x3c'),_0x7d64('0x75'),_0x7d64('0x76'),_0x7d64('0x77')],'raw':!![]});}return null;})[_0x7d64('0x22')](function(_0x30ddf8){if(!_0x30ddf8)return null;_0x38fa43[_0x7d64('0x2a')]['agent']=_0x30ddf8;return _0x38fa43;})[_0x7d64('0x22')](function(_0x1ed2e1){if(_0x1ed2e1){if(_0x9164b5[_0x7d64('0x5a')][_0x7d64('0x78')]){_0x38fa43[_0x7d64('0x2a')][_0x7d64('0x79')]=util[_0x7d64('0x69')]('SIP/%s',_0x9164b5[_0x7d64('0x62')][_0x7d64('0x3c')]);_0x38fa43[_0x7d64('0x2a')][_0x7d64('0x7a')]=_0x38fa43[_0x7d64('0x7a')];_0x38fa43['message']['motionChannel']=_0x38fa43[_0x7d64('0x7a')];_0x38fa43[_0x7d64('0x2a')][_0x7d64('0x7b')]=_0x7d64('0x7c');return respondWithRpcPromise(_0x7d64('0x7d'),'EventManager',{'event':_0x7d64('0x7e'),'message':_0x38fa43[_0x7d64('0x2a')]},client9002)['then'](function(){return _0x38fa43;});}return _0x38fa43;}return null;})[_0x7d64('0x22')](respondWithResult(_0x148fbf,null))[_0x7d64('0x2c')](handleError(_0x148fbf,null));};var interaction_log=require(_0x7d64('0x12'))(_0x7d64('0x5d'));exports['reject']=function(_0x53406c,_0x299e96,_0x1e48f0){var _0xa98a04={'agent':{},'channel':_0x7d64('0x5e')};if(_0x53406c['body']['id']){delete _0x53406c['body']['id'];}_0x53406c['body']['UserId']=_0x53406c[_0x7d64('0x5a')]['UserId']||_0x53406c[_0x7d64('0x62')]['id'];_0xa98a04['agent']['id']=_0x53406c[_0x7d64('0x5a')][_0x7d64('0x61')];return db[_0x7d64('0x3f')][_0x7d64('0x5b')]({'where':{'id':_0x53406c[_0x7d64('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x299e96,null))[_0x7d64('0x22')](function(_0x3220ec){if(_0x3220ec){_0xa98a04[_0x7d64('0x2a')]=_0x3220ec[_0x7d64('0x64')]({'plain':!![]});return db[_0x7d64('0x65')][_0x7d64('0x5b')]({'where':{'id':_0x3220ec[_0x7d64('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x299e96,null))[_0x7d64('0x22')](function(_0x8900b3){if(_0x8900b3){_0xa98a04['interaction']=_0x8900b3[_0x7d64('0x64')]({'plain':!![]});interaction_log['info'](_0x7d64('0x7f'),_0x53406c[_0x7d64('0x62')]['id'],_0x53406c['user'][_0x7d64('0x3c')],_0x53406c[_0x7d64('0x62')]['role'],_0xa98a04[_0x7d64('0x6b')]['id'],_0x53406c['body']?JSON[_0x7d64('0x28')](_0x53406c[_0x7d64('0x5a')]):_0x7d64('0x6c'));return respondWithRpcPromise(_0x7d64('0x80'),_0x7d64('0x81'),_0xa98a04);}return null;})['then'](function(_0x412b58){var _0x340f0a=_0x7d64('0x6f')+_0x412b58[_0x7d64('0x2a')]['ContactId'];return db[_0x7d64('0x70')]['query'](_0x340f0a,{'type':db['Sequelize'][_0x7d64('0x82')][_0x7d64('0x72')],'raw':!![]})[_0x7d64('0x22')](function(_0x2f32e8){return _0x2f32e8;});})[_0x7d64('0x22')](function(_0x41f988){if(_0x41f988){_0xa98a04[_0x7d64('0x2a')][_0x7d64('0x73')]=_0x41f988[0x0];if(!_0x53406c[_0x7d64('0x5a')][_0x7d64('0x61')])return;return db['User'][_0x7d64('0x5b')]({'where':{'id':_0x53406c['body'][_0x7d64('0x61')],'role':'agent'},'attributes':['id','name','fullname',_0x7d64('0x76'),_0x7d64('0x77')],'raw':!![]});}return null;})['then'](function(_0x1ed398){if(!_0x1ed398)return null;_0xa98a04[_0x7d64('0x2a')][_0x7d64('0x63')]=_0x1ed398;return _0xa98a04;})[_0x7d64('0x22')](function(_0xeb49da){if(_0xeb49da){_0xeb49da[_0x7d64('0x2a')][_0x7d64('0x79')]=util['format'](_0x7d64('0x83'),_0x53406c[_0x7d64('0x62')][_0x7d64('0x3c')]);_0xeb49da['message'][_0x7d64('0x7a')]=_0xa98a04[_0x7d64('0x7a')];_0xeb49da[_0x7d64('0x2a')][_0x7d64('0x84')]=_0xa98a04[_0x7d64('0x7a')];_0xeb49da[_0x7d64('0x2a')]['event']='reject';respondWithRpcPromise('EventManager',_0x7d64('0x7d'),{'event':_0x7d64('0x85'),'message':_0xeb49da[_0x7d64('0x2a')]},client9002);return _0xa98a04;}return null;})[_0x7d64('0x22')](respondWithResult(_0x299e96,null))[_0x7d64('0x2c')](handleError(_0x299e96,null));};exports[_0x7d64('0x86')]=function(_0x16a850,_0x3159c7){var _0x4c3914;return db[_0x7d64('0x3f')][_0x7d64('0x86')](_0x16a850[_0x7d64('0x5a')],{})[_0x7d64('0x22')](function(_0x292198){_0x4c3914=_0x292198;return db[_0x7d64('0x87')]['findOne']({'where':{'id':_0x4c3914['ContactId']}});})[_0x7d64('0x22')](function(_0x129274){if(_[_0x7d64('0x67')](_0x129274)){return;}else{_0x4c3914[_0x7d64('0x5e')]=_0x129274[_0x7d64('0x5e')];return db[_0x7d64('0x88')][_0x7d64('0x89')]({'where':{'id':_0x4c3914[_0x7d64('0x8a')]}});}})['then'](function(_0x59e0ad){return respondWithRpcPromise(_0x7d64('0x8b'),'SendFax',{'FaxAccountId':_[_0x7d64('0x67')](_0x16a850[_0x7d64('0x5a')])?undefined:_0x16a850[_0x7d64('0x5a')]['FaxAccountId'],'path':_[_0x7d64('0x67')](_0x59e0ad)?undefined:util[_0x7d64('0x69')]('/var/opt/motion2/server/files/attachments/%s',_0x59e0ad['basename']),'fax':_[_0x7d64('0x67')](_0x4c3914['fax'])?undefined:_0x4c3914[_0x7d64('0x5e')],'AttachmentId':_0x4c3914[_0x7d64('0x8a')]},client9002);})[_0x7d64('0x22')](respondWithResult(_0x3159c7,0xc9))[_0x7d64('0x2c')](handleError(_0x3159c7,null));};exports[_0x7d64('0x8c')]=function(_0x18fae7,_0x34aab2){var _0xfcd004=path['join'](config[_0x7d64('0x8d')],'server',_0x7d64('0x8e'),_0x7d64('0x8f'));return db[_0x7d64('0x3f')][_0x7d64('0x5b')]({'where':{'id':_0x18fae7[_0x7d64('0x59')]['id']},'include':[{'model':db[_0x7d64('0x88')],'as':'Attachment'}]})[_0x7d64('0x22')](handleEntityNotFound(_0x34aab2,null))[_0x7d64('0x22')](function(_0x4d20aa){if(_0x4d20aa){return _0x34aab2['download'](path['join'](_0xfcd004,_0x4d20aa[_0x7d64('0x88')][_0x7d64('0x90')]));}})[_0x7d64('0x2c')](handleError(_0x34aab2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8d67834..bae2939 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 _0xf811=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x198a7b,_0x20b05a){var _0x5168b4=function(_0x1c38e9){while(--_0x1c38e9){_0x198a7b['push'](_0x198a7b['shift']());}};_0x5168b4(++_0x20b05a);}(_0xf811,0x6f));var _0x1f81=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xf811[_0x288f5e];return _0x476cc9;};'use strict';var EventEmitter=require(_0x1f81('0x0'));var FaxMessage=require(_0x1f81('0x1'))['db'][_0x1f81('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1f81('0x3')](0x0);var events={'afterCreate':_0x1f81('0x4'),'afterUpdate':_0x1f81('0x5'),'afterDestroy':_0x1f81('0x6')};function emitEvent(_0x1650f4){return function(_0x18f178,_0x4281c3,_0x40b2b6){FaxMessageEvents[_0x1f81('0x7')](_0x1650f4+':'+_0x18f178['id'],_0x18f178);FaxMessageEvents[_0x1f81('0x7')](_0x1650f4,_0x18f178);_0x40b2b6(null);};}for(var e in events){if(events[_0x1f81('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x1f81('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x22ed=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x6a5ea6,_0x32e118){var _0x114c69=function(_0x572081){while(--_0x572081){_0x6a5ea6['push'](_0x6a5ea6['shift']());}};_0x114c69(++_0x32e118);}(_0x22ed,0x1a9));var _0xd22e=function(_0x554acd,_0x350d2a){_0x554acd=_0x554acd-0x0;var _0x1d2a22=_0x22ed[_0x554acd];return _0x1d2a22;};'use strict';var EventEmitter=require(_0xd22e('0x0'));var FaxMessage=require(_0xd22e('0x1'))['db'][_0xd22e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd22e('0x3')](0x0);var events={'afterCreate':_0xd22e('0x4'),'afterUpdate':_0xd22e('0x5'),'afterDestroy':_0xd22e('0x6')};function emitEvent(_0x10244b){return function(_0x3a1306,_0x214c17,_0x3c4894){FaxMessageEvents[_0xd22e('0x7')](_0x10244b+':'+_0x3a1306['id'],_0x3a1306);FaxMessageEvents['emit'](_0x10244b,_0x3a1306);_0x3c4894(null);};}for(var e in events){if(events[_0xd22e('0x8')](e)){var event=events[e];FaxMessage[_0xd22e('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 7178264..bcd1a43 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 _0x0d03=['error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','FaxMessage','fax_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','then','update','createdAt','catch'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x0d03,0x120));var _0x30d0=function(_0x6f427c,_0x11352f){_0x6f427c=_0x6f427c-0x0;var _0x5828b8=_0x0d03[_0x6f427c];return _0x5828b8;};'use strict';var _=require(_0x30d0('0x0'));var util=require(_0x30d0('0x1'));var logger=require(_0x30d0('0x2'))(_0x30d0('0x3'));var moment=require(_0x30d0('0x4'));var BPromise=require('bluebird');var rp=require(_0x30d0('0x5'));var fs=require('fs');var path=require(_0x30d0('0x6'));var rimraf=require('rimraf');var config=require(_0x30d0('0x7'));var attributes=require('./faxMessage.attributes');module[_0x30d0('0x8')]=function(_0x52770a,_0x59bd1a){return _0x52770a[_0x30d0('0x9')](_0x30d0('0xa'),attributes,{'tableName':_0x30d0('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x30d0('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20f5c5,_0x165e5d,_0x36af1f){var _0xe50ec7=_0x52770a['models'];var _0x1c2f94=_0x20f5c5[_0x30d0('0xd')]({'plain':!![]});if(_0x1c2f94[_0x30d0('0xe')][_0x30d0('0xf')]()==='in'||_0x1c2f94[_0x30d0('0xe')][_0x30d0('0xf')]()==='out'&&!_0x1c2f94[_0x30d0('0x10')]&&!_[_0x30d0('0x11')](_0x1c2f94[_0x30d0('0x12')])){_0xe50ec7[_0x30d0('0x13')]['findOne']({'where':{'id':_0x1c2f94['FaxInteractionId']}})[_0x30d0('0x14')](function(_0xbbb778){if(_0xbbb778){_0xbbb778[_0x30d0('0x15')]({'lastMsgAt':_0x1c2f94[_0x30d0('0x16')],'lastMsgDirection':_0x1c2f94[_0x30d0('0xe')]['toLowerCase']()});}})[_0x30d0('0x17')](function(_0xcbde07){console[_0x30d0('0x18')](_0xcbde07);});}_0x36af1f();}},'charset':_0x30d0('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0e4e=['out','UserId','FaxInteraction','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x0e4e,0xbf));var _0xe0e4=function(_0x512490,_0x474d3d){_0x512490=_0x512490-0x0;var _0x4cf8e4=_0x0e4e[_0x512490];return _0x4cf8e4;};'use strict';var _=require('lodash');var util=require(_0xe0e4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe0e4('0x1'));var BPromise=require('bluebird');var rp=require(_0xe0e4('0x2'));var fs=require('fs');var path=require(_0xe0e4('0x3'));var rimraf=require(_0xe0e4('0x4'));var config=require(_0xe0e4('0x5'));var attributes=require(_0xe0e4('0x6'));module['exports']=function(_0x426d63,_0x1c2594){return _0x426d63[_0xe0e4('0x7')](_0xe0e4('0x8'),attributes,{'tableName':_0xe0e4('0x9'),'paranoid':![],'indexes':[{'name':_0xe0e4('0xa'),'fields':[_0xe0e4('0xb')],'type':_0xe0e4('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2aa703,_0x53a0ae,_0x595438){var _0x45db01=_0x426d63[_0xe0e4('0xd')];var _0x27a718=_0x2aa703[_0xe0e4('0xe')]({'plain':!![]});if(_0x27a718[_0xe0e4('0xf')]['toLowerCase']()==='in'||_0x27a718[_0xe0e4('0xf')][_0xe0e4('0x10')]()===_0xe0e4('0x11')&&!_0x27a718['secret']&&!_['isNil'](_0x27a718[_0xe0e4('0x12')])){_0x45db01[_0xe0e4('0x13')]['findOne']({'where':{'id':_0x27a718['FaxInteractionId']}})[_0xe0e4('0x14')](function(_0x48e4b0){if(_0x48e4b0){_0x48e4b0[_0xe0e4('0x15')]({'lastMsgAt':_0x27a718[_0xe0e4('0x16')],'lastMsgDirection':_0x27a718[_0xe0e4('0xf')][_0xe0e4('0x10')]()});}})[_0xe0e4('0x17')](function(_0x2fbd2e){console[_0xe0e4('0x18')](_0x2fbd2e);});}_0x595438();}},'charset':'utf8mb4','collate':_0xe0e4('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 50522b9..8db6c96 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 _0x24ca=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','create','body','options','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x24ca[_0x2706da];return _0x3ba87e;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});config[_0xa24c('0xc')]=_[_0xa24c('0xd')](config[_0xa24c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0xe'))(new Redis(config[_0xa24c('0xc')]));require(_0xa24c('0xf'))['register'](socket);function respondWithRpcPromise(_0x399f32,_0x325c6d,_0x288f76){return new BPromise(function(_0x211003,_0x169632){return client[_0xa24c('0x10')](_0x399f32,_0x288f76)[_0xa24c('0x11')](function(_0xc82af0){logger[_0xa24c('0x12')]('FaxMessage,\x20%s,\x20%s',_0x325c6d,_0xa24c('0x13'));logger[_0xa24c('0x14')](_0xa24c('0x15'),_0x325c6d,_0xa24c('0x13'),JSON['stringify'](_0xc82af0));if(_0xc82af0[_0xa24c('0x16')]){if(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x17')]===0x1f4){logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);return _0x169632(_0xc82af0['error']['message']);}logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0['error']['message']);return _0x211003(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);}else{logger['info'](_0xa24c('0x18'),_0x325c6d,'request\x20sent');_0x211003(_0xc82af0[_0xa24c('0x1a')][_0xa24c('0x19')]);}})[_0xa24c('0x1b')](function(_0xefdbd9){logger['error'](_0xa24c('0x18'),_0x325c6d,_0xefdbd9);_0x169632(_0xefdbd9);});});}exports[_0xa24c('0x1c')]=function(_0x773f70){var _0x4d4bab=this;return new Promise(function(_0x48a768,_0x506424){return db['FaxMessage'][_0xa24c('0x1d')](_0x773f70[_0xa24c('0x1e')],{'raw':_0x773f70[_0xa24c('0x1f')]?_0x773f70[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xa24c('0x11')](function(_0x5f299e){logger[_0xa24c('0x12')](_0xa24c('0x1c'),_0x773f70);logger['debug'](_0xa24c('0x1c'),_0x773f70,JSON[_0xa24c('0x20')](_0x5f299e));_0x48a768(_0x5f299e);})[_0xa24c('0x1b')](function(_0x188ee2){logger[_0xa24c('0x16')]('CreateFaxMessage',_0x188ee2[_0xa24c('0x19')],_0x773f70);_0x506424(_0x4d4bab['error'](0x1f4,_0x188ee2[_0xa24c('0x19')]));});});};exports[_0xa24c('0x21')]=function(_0x294685){var _0x51dc3f=this;return new Promise(function(_0x1beb55,_0x31c4d9){return db[_0xa24c('0x22')][_0xa24c('0x23')](_0x294685[_0xa24c('0x1e')],{'raw':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')][_0xa24c('0x24')]||null:null,'attributes':_0x294685[_0xa24c('0x1f')]?_0x294685['options'][_0xa24c('0x25')]||null:null,'limit':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['limit']||null:null})[_0xa24c('0x11')](function(_0x3dcb1b){logger[_0xa24c('0x12')]('UpdateFaxMessage',_0x294685);logger[_0xa24c('0x14')]('UpdateFaxMessage',_0x294685,JSON[_0xa24c('0x20')](_0x3dcb1b));_0x1beb55(_0x3dcb1b);})[_0xa24c('0x1b')](function(_0x1a247b){logger['error'](_0xa24c('0x21'),_0x1a247b[_0xa24c('0x19')],_0x294685);_0x31c4d9(_0x51dc3f[_0xa24c('0x16')](0x1f4,_0x1a247b['message']));});});}; \ No newline at end of file +var _0x6aa7=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','catch','update','body','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x5d54fc,_0x59ec74){var _0x2cfdc0=function(_0x54d3a4){while(--_0x54d3a4){_0x5d54fc['push'](_0x5d54fc['shift']());}};_0x2cfdc0(++_0x59ec74);}(_0x6aa7,0x178));var _0x76aa=function(_0x2ef30b,_0x3efca1){_0x2ef30b=_0x2ef30b-0x0;var _0x467c0b=_0x6aa7[_0x2ef30b];return _0x467c0b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});}exports[_0x76aa('0x18')]=function(_0x15b931){var _0x15109b=this;return new Promise(function(_0x191560,_0x19af92){return db[_0x76aa('0x19')][_0x76aa('0x1a')](_0x15b931['body'],{'raw':_0x15b931[_0x76aa('0x1b')]?_0x15b931[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x41463a){logger[_0x76aa('0xf')](_0x76aa('0x18'),_0x15b931);logger[_0x76aa('0x11')](_0x76aa('0x18'),_0x15b931,JSON[_0x76aa('0x13')](_0x41463a));_0x191560(_0x41463a);})[_0x76aa('0x1d')](function(_0x3363b3){logger[_0x76aa('0x14')](_0x76aa('0x18'),_0x3363b3[_0x76aa('0x16')],_0x15b931);_0x19af92(_0x15109b[_0x76aa('0x14')](0x1f4,_0x3363b3[_0x76aa('0x16')]));});});};exports['UpdateFaxMessage']=function(_0xb5e8a9){var _0x1d6d15=this;return new Promise(function(_0x25c614,_0x2e7ab4){return db[_0x76aa('0x19')][_0x76aa('0x1e')](_0xb5e8a9[_0x76aa('0x1f')],{'raw':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5e8a9['options']?_0xb5e8a9[_0x76aa('0x1b')]['where']||null:null,'attributes':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x20')]||null:null,'limit':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x21')]||null:null})[_0x76aa('0xe')](function(_0x3827ec){logger[_0x76aa('0xf')](_0x76aa('0x22'),_0xb5e8a9);logger['debug'](_0x76aa('0x22'),_0xb5e8a9,JSON[_0x76aa('0x13')](_0x3827ec));_0x25c614(_0x3827ec);})[_0x76aa('0x1d')](function(_0x928ccf){logger[_0x76aa('0x14')](_0x76aa('0x22'),_0x928ccf[_0x76aa('0x16')],_0xb5e8a9);_0x2e7ab4(_0x1d6d15['error'](0x1f4,_0x928ccf[_0x76aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 270a564..d4ef2ee 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 _0x6ec2=['remove','update','emit','register','length'];(function(_0x42311a,_0x37005d){var _0x20c60f=function(_0x22c032){while(--_0x22c032){_0x42311a['push'](_0x42311a['shift']());}};_0x20c60f(++_0x37005d);}(_0x6ec2,0x154));var _0x26ec=function(_0x546112,_0xc4b8a2){_0x546112=_0x546112-0x0;var _0xa1cf3b=_0x6ec2[_0x546112];return _0xa1cf3b;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x26ec('0x0'),_0x26ec('0x1')];function createListener(_0x1358a0,_0x4933ad){return function(_0x507934){_0x4933ad[_0x26ec('0x2')](_0x1358a0,_0x507934);};}function removeListener(_0x587642,_0x5f53b3){return function(){FaxMessageEvents['removeListener'](_0x587642,_0x5f53b3);};}exports[_0x26ec('0x3')]=function(_0x416b9f){for(var _0x12de5f=0x0,_0x5e19ab=events[_0x26ec('0x4')];_0x12de5f<_0x5e19ab;_0x12de5f++){var _0x370997=events[_0x12de5f];var _0x1e21bf=createListener('faxMessage:'+_0x370997,_0x416b9f);FaxMessageEvents['on'](_0x370997,_0x1e21bf);}}; \ No newline at end of file +var _0x7dd2=['emit','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x149055,_0x42bd96){var _0x2862bf=function(_0x39a5dc){while(--_0x39a5dc){_0x149055['push'](_0x149055['shift']());}};_0x2862bf(++_0x42bd96);}(_0x7dd2,0x1c4));var _0x27dd=function(_0x315ea6,_0x274063){_0x315ea6=_0x315ea6-0x0;var _0x833ba4=_0x7dd2[_0x315ea6];return _0x833ba4;};'use strict';var FaxMessageEvents=require(_0x27dd('0x0'));var events=[_0x27dd('0x1'),_0x27dd('0x2'),_0x27dd('0x3')];function createListener(_0x35b472,_0x13cc37){return function(_0x4d755b){_0x13cc37[_0x27dd('0x4')](_0x35b472,_0x4d755b);};}function removeListener(_0x40b35c,_0x5df0c2){return function(){FaxMessageEvents['removeListener'](_0x40b35c,_0x5df0c2);};}exports[_0x27dd('0x5')]=function(_0x116527){for(var _0x2a9396=0x0,_0x377915=events[_0x27dd('0x6')];_0x2a9396<_0x377915;_0x2a9396++){var _0x4360a8=events[_0x2a9396];var _0x4e1e12=createListener(_0x27dd('0x7')+_0x4360a8,_0x116527);FaxMessageEvents['on'](_0x4360a8,_0x4e1e12);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 700bee3..4577ec5 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 _0xdb94=['express','fs-extra','../../components/auth/service','./faxMessage.controller','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/download','download','post','fax','faxmessage:create','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','connect-timeout'];(function(_0x4535b0,_0x2a3ff7){var _0x18b740=function(_0x39386b){while(--_0x39386b){_0x4535b0['push'](_0x4535b0['shift']());}};_0x18b740(++_0x2a3ff7);}(_0xdb94,0xab));var _0x4db9=function(_0x5b7b81,_0x4f97ca){_0x5b7b81=_0x5b7b81-0x0;var _0x92c277=_0xdb94[_0x5b7b81];return _0x92c277;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),interaction['tracked'](_0x4db9('0x12'),_0x4db9('0x13')),controller['create']);router['put'](_0x4db9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4db9('0x14')](_0x4db9('0x15'),auth['isAuthenticated'](),controller[_0x4db9('0x16')]);router[_0x4db9('0x14')](_0x4db9('0x17'),auth[_0x4db9('0xd')](),controller['reject']);router['delete'](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller['destroy']);module[_0x4db9('0x18')]=router; \ No newline at end of file +var _0xbee3=['update','/:id/accept','accept','/:id/reject','reject','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','fax','create','put'];(function(_0x45d249,_0x2cea03){var _0x90b700=function(_0x448ed9){while(--_0x448ed9){_0x45d249['push'](_0x45d249['shift']());}};_0x90b700(++_0x2cea03);}(_0xbee3,0xd5));var _0x3bee=function(_0x1d6da1,_0x4ad243){_0x1d6da1=_0x1d6da1-0x0;var _0x561a1b=_0xbee3[_0x1d6da1];return _0x561a1b;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var controller=require('./faxMessage.controller');router[_0x3bee('0x6')]('/',auth[_0x3bee('0x7')](),controller['index']);router[_0x3bee('0x6')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x6')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller['show']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),interaction['tracked'](_0x3bee('0xe'),'faxmessage:create'),controller[_0x3bee('0xf')]);router[_0x3bee('0x10')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x11')]);router[_0x3bee('0x10')](_0x3bee('0x12'),auth['isAuthenticated'](),controller[_0x3bee('0x13')]);router[_0x3bee('0x10')](_0x3bee('0x14'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x15')]);router['delete']('/:id',auth[_0x3bee('0x7')](),controller['destroy']);module[_0x3bee('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fff780f..5926b3f 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 _0x22e9=['STRING','ENUM','rrmemory','beepall','roundrobin','INTEGER','sequelize','exports'];(function(_0x2bc8fd,_0x4424dc){var _0x40afe2=function(_0x13f737){while(--_0x13f737){_0x2bc8fd['push'](_0x2bc8fd['shift']());}};_0x40afe2(++_0x4424dc);}(_0x22e9,0x10e));var _0x922e=function(_0x201efd,_0x561cd2){_0x201efd=_0x201efd-0x0;var _0x328cdb=_0x22e9[_0x201efd];return _0x328cdb;};'use strict';var Sequelize=require(_0x922e('0x0'));module[_0x922e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x922e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x922e('0x3')](_0x922e('0x4'),_0x922e('0x5'),_0x922e('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x922e('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x222a=['rrmemory','beepall','INTEGER','sequelize','exports','STRING','name','ENUM'];(function(_0x427f34,_0x30b090){var _0x271c48=function(_0x4ef99c){while(--_0x4ef99c){_0x427f34['push'](_0x427f34['shift']());}};_0x271c48(++_0x30b090);}(_0x222a,0xb3));var _0xa222=function(_0x246e56,_0x280906){_0x246e56=_0x246e56-0x0;var _0x1ab60c=_0x222a[_0x246e56];return _0x1ab60c;};'use strict';var Sequelize=require(_0xa222('0x0'));module[_0xa222('0x1')]={'name':{'type':Sequelize[_0xa222('0x2')],'unique':_0xa222('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa222('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa222('0x4')](_0xa222('0x5'),_0xa222('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa222('0x7')],'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 3961cb7..511031e 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 _0x3051=['QueryTypes','SELECT','includes','all','union','compact','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','merge','VIRTUAL','options','where','FaxQueue','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','sort','User','findAndCountAll','updatedAt','createdAt','rows','format','%s/%s','faxPause','getTeams','Team','length','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','UserFaxQueue','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString'];(function(_0x2fa106,_0xc4bc18){var _0x5b57e6=function(_0x1606a1){while(--_0x1606a1){_0x2fa106['push'](_0x2fa106['shift']());}};_0x5b57e6(++_0xc4bc18);}(_0x3051,0x1a1));var _0x1305=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3051[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x1305('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1305('0x1'));var rp=require(_0x1305('0x2'));var moment=require('moment');var BPromise=require(_0x1305('0x3'));var Mustache=require(_0x1305('0x4'));var util=require(_0x1305('0x5'));var path=require(_0x1305('0x6'));var sox=require(_0x1305('0x7'));var csv=require(_0x1305('0x8'));var ejs=require(_0x1305('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1305('0xa'));var squel=require(_0x1305('0xb'));var crypto=require(_0x1305('0xc'));var jsforce=require(_0x1305('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1305('0x8'));var querystring=require(_0x1305('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1305('0xf'));var as=require(_0x1305('0x10'));var hardwareService=require(_0x1305('0x11'));var logger=require('../../config/logger')(_0x1305('0x12'));var utils=require(_0x1305('0x13'));var config=require(_0x1305('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1305('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1305('0x16'))[_0x1305('0x17')](socket);function respondWithStatusCode(_0x162396,_0x3640e8){_0x3640e8=_0x3640e8||0xcc;return function(_0x1fdd08){if(_0x1fdd08){return _0x162396[_0x1305('0x18')](_0x3640e8);}return _0x162396[_0x1305('0x19')](_0x3640e8)[_0x1305('0x1a')]();};}function respondWithResult(_0x3e82c4,_0xa406e2){_0xa406e2=_0xa406e2||0xc8;return function(_0x13c0eb){if(_0x13c0eb){return _0x3e82c4[_0x1305('0x19')](_0xa406e2)[_0x1305('0x1b')](_0x13c0eb);}};}function respondWithFilteredResult(_0x2f6ce6,_0x251415){return function(_0x20bc81){if(_0x20bc81){var _0x5397ea=typeof _0x251415[_0x1305('0x1c')]==='undefined'&&typeof _0x251415['limit']===_0x1305('0x1d');var _0x259279=_0x20bc81[_0x1305('0x1e')];var _0x50300d=_0x5397ea?0x0:_0x251415['offset'];var _0x19e26d=_0x5397ea?_0x20bc81[_0x1305('0x1e')]:_0x251415[_0x1305('0x1c')]+_0x251415[_0x1305('0x1f')];var _0x21f6b2;if(_0x19e26d>=_0x259279){_0x19e26d=_0x259279;_0x21f6b2=0xc8;}else{_0x21f6b2=0xce;}_0x2f6ce6['status'](_0x21f6b2);return _0x2f6ce6[_0x1305('0x20')](_0x1305('0x21'),_0x50300d+'-'+_0x19e26d+'/'+_0x259279)[_0x1305('0x1b')](_0x20bc81);}return null;};}function patchUpdates(_0xd18cc8){return function(_0x1909b3){try{jsonpatch[_0x1305('0x22')](_0x1909b3,_0xd18cc8,!![]);}catch(_0x3d8689){return BPromise[_0x1305('0x23')](_0x3d8689);}return _0x1909b3[_0x1305('0x24')]();};}function saveUpdates(_0x3127ab,_0x3a96cd){return function(_0x5d15c2){if(_0x5d15c2){return _0x5d15c2['update'](_0x3127ab)[_0x1305('0x25')](function(_0xdcbb1d){return _0xdcbb1d;});}return null;};}function removeEntity(_0x1a20ce,_0x4c1041){return function(_0x280630){if(_0x280630){return _0x280630[_0x1305('0x26')]()[_0x1305('0x25')](function(){var _0x3e16d5=_0x280630[_0x1305('0x27')]({'plain':!![]});var _0x4b7229=_0x1305('0x28');return db[_0x1305('0x29')][_0x1305('0x26')]({'where':{'type':_0x4b7229,'resourceId':_0x3e16d5['id']}})[_0x1305('0x25')](function(){return _0x280630;});})[_0x1305('0x25')](function(){_0x1a20ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f400,_0x24dd82){return function(_0x33fc8b){if(!_0x33fc8b){_0x50f400[_0x1305('0x18')](0x194);}return _0x33fc8b;};}function handleError(_0xdf0e43,_0x173690){_0x173690=_0x173690||0x1f4;return function(_0x5800de){logger[_0x1305('0x2a')](_0x5800de[_0x1305('0x2b')]);if(_0x5800de['name']){delete _0x5800de[_0x1305('0x2c')];}_0xdf0e43['status'](_0x173690)['send'](_0x5800de);};}exports[_0x1305('0x2d')]=function(_0x2a9f74,_0x4fd7b1){var _0x5b56c5={},_0x117cb4={},_0x125e56={'count':0x0,'rows':[]};var _0x3fefaa=_[_0x1305('0x2e')](db['FaxQueue'][_0x1305('0x2f')],function(_0x4aa2ad){return{'name':_0x4aa2ad[_0x1305('0x30')],'type':_0x4aa2ad[_0x1305('0x31')][_0x1305('0x32')]};});_0x117cb4[_0x1305('0x33')]=_['map'](_0x3fefaa,'name');_0x117cb4[_0x1305('0x34')]=_['keys'](_0x2a9f74[_0x1305('0x34')]);_0x117cb4[_0x1305('0x35')]=_[_0x1305('0x36')](_0x117cb4[_0x1305('0x33')],_0x117cb4['query']);_0x5b56c5[_0x1305('0x37')]=_[_0x1305('0x36')](_0x117cb4[_0x1305('0x33')],qs[_0x1305('0x38')](_0x2a9f74[_0x1305('0x34')]['fields']));_0x5b56c5[_0x1305('0x37')]=_0x5b56c5['attributes']['length']?_0x5b56c5[_0x1305('0x37')]:_0x117cb4[_0x1305('0x33')];if(!_0x2a9f74[_0x1305('0x34')][_0x1305('0x39')](_0x1305('0x3a'))){_0x5b56c5[_0x1305('0x1f')]=qs[_0x1305('0x1f')](_0x2a9f74['query']['limit']);_0x5b56c5['offset']=qs[_0x1305('0x1c')](_0x2a9f74[_0x1305('0x34')]['offset']);}_0x5b56c5[_0x1305('0x3b')]=qs['sort'](_0x2a9f74['query']['sort']);_0x5b56c5['where']=qs[_0x1305('0x35')](_[_0x1305('0x3c')](_0x2a9f74[_0x1305('0x34')],_0x117cb4[_0x1305('0x35')]),_0x3fefaa);if(_0x2a9f74[_0x1305('0x34')][_0x1305('0x3d')]){_0x5b56c5['where']=_[_0x1305('0x3e')](_0x5b56c5['where'],{'$or':_[_0x1305('0x2e')](_0x3fefaa,function(_0x1918f9){if(_0x1918f9[_0x1305('0x31')]!==_0x1305('0x3f')){var _0x4db141={};_0x4db141[_0x1918f9[_0x1305('0x2c')]]={'$like':'%'+_0x2a9f74['query'][_0x1305('0x3d')]+'%'};return _0x4db141;}})});}_0x5b56c5=_[_0x1305('0x3e')]({},_0x5b56c5,_0x2a9f74[_0x1305('0x40')]);var _0xe6d378={'where':_0x5b56c5[_0x1305('0x41')]};return db[_0x1305('0x42')][_0x1305('0x1e')](_0xe6d378)[_0x1305('0x25')](function(_0x1f942c){_0x125e56[_0x1305('0x1e')]=_0x1f942c;if(_0x2a9f74['query'][_0x1305('0x43')]){_0x5b56c5[_0x1305('0x44')]=[{'all':!![]}];}return db[_0x1305('0x42')][_0x1305('0x45')](_0x5b56c5);})[_0x1305('0x25')](function(_0x2a7a5b){_0x125e56['rows']=_0x2a7a5b;return _0x125e56;})[_0x1305('0x25')](respondWithFilteredResult(_0x4fd7b1,_0x5b56c5))[_0x1305('0x46')](handleError(_0x4fd7b1,null));};exports[_0x1305('0x47')]=function(_0x581009,_0x485370){var _0xafd47={'raw':!![],'where':{'id':_0x581009[_0x1305('0x48')]['id']}},_0x48d859={};_0x48d859['model']=_[_0x1305('0x49')](db[_0x1305('0x42')][_0x1305('0x2f')]);_0x48d859[_0x1305('0x34')]=_[_0x1305('0x49')](_0x581009[_0x1305('0x34')]);_0x48d859[_0x1305('0x35')]=_[_0x1305('0x36')](_0x48d859['model'],_0x48d859[_0x1305('0x34')]);_0xafd47[_0x1305('0x37')]=_[_0x1305('0x36')](_0x48d859[_0x1305('0x33')],qs['fields'](_0x581009['query'][_0x1305('0x38')]));_0xafd47[_0x1305('0x37')]=_0xafd47[_0x1305('0x37')]['length']?_0xafd47['attributes']:_0x48d859[_0x1305('0x33')];if(_0x581009[_0x1305('0x34')]['includeAll']){_0xafd47[_0x1305('0x44')]=[{'all':!![]}];}_0xafd47=_[_0x1305('0x3e')]({},_0xafd47,_0x581009[_0x1305('0x40')]);return db['FaxQueue'][_0x1305('0x4a')](_0xafd47)[_0x1305('0x25')](handleEntityNotFound(_0x485370,null))['then'](respondWithResult(_0x485370,null))[_0x1305('0x46')](handleError(_0x485370,null));};exports[_0x1305('0x4b')]=function(_0x5a6a18,_0x3c42d8){return db[_0x1305('0x42')][_0x1305('0x4b')](_0x5a6a18[_0x1305('0x4c')],{})[_0x1305('0x25')](function(_0x57b972){var _0x3f4abd=_0x5a6a18[_0x1305('0x4d')]['get']({'plain':!![]});if(!_0x3f4abd)throw new Error(_0x1305('0x4e'));if(_0x3f4abd[_0x1305('0x4f')]==='user'){var _0x3606d8=_0x57b972[_0x1305('0x27')]({'plain':!![]});var _0x14f1a6='FaxQueues';return db[_0x1305('0x50')][_0x1305('0x4a')]({'where':{'name':_0x14f1a6,'userProfileId':_0x3f4abd[_0x1305('0x51')]},'raw':!![]})['then'](function(_0x1236c0){if(_0x1236c0&&_0x1236c0[_0x1305('0x52')]===0x0){return db[_0x1305('0x29')][_0x1305('0x4b')]({'name':_0x3606d8[_0x1305('0x2c')],'resourceId':_0x3606d8['id'],'type':_0x1236c0[_0x1305('0x2c')],'sectionId':_0x1236c0['id']},{})['then'](function(){return _0x57b972;});}else{return _0x57b972;}})[_0x1305('0x46')](function(_0x2dc155){logger[_0x1305('0x2a')](_0x1305('0x53'),_0x2dc155);throw _0x2dc155;});}return _0x57b972;})[_0x1305('0x25')](respondWithResult(_0x3c42d8,0xc9))[_0x1305('0x46')](handleError(_0x3c42d8,null));};exports[_0x1305('0x54')]=function(_0x433fbb,_0x3b65d6){if(_0x433fbb['body']['id']){delete _0x433fbb[_0x1305('0x4c')]['id'];}return db[_0x1305('0x42')]['find']({'where':{'id':_0x433fbb[_0x1305('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b65d6,null))[_0x1305('0x25')](saveUpdates(_0x433fbb[_0x1305('0x4c')],null))[_0x1305('0x25')](respondWithResult(_0x3b65d6,null))[_0x1305('0x46')](handleError(_0x3b65d6,null));};exports[_0x1305('0x26')]=function(_0x32f5a5,_0x1844c1){return db[_0x1305('0x42')][_0x1305('0x4a')]({'where':{'id':_0x32f5a5[_0x1305('0x48')]['id']}})[_0x1305('0x25')](handleEntityNotFound(_0x1844c1,null))['then'](removeEntity(_0x1844c1,null))[_0x1305('0x46')](handleError(_0x1844c1,null));};exports[_0x1305('0x55')]=function(_0x1c2be6,_0x2fa504){return db[_0x1305('0x42')][_0x1305('0x55')]()['then'](respondWithResult(_0x2fa504,null))[_0x1305('0x46')](handleError(_0x2fa504,null));};exports[_0x1305('0x56')]=function(_0x27864a,_0xf44852,_0x2bdd2c){var _0x76a683={'raw':!![],'where':{}},_0x1058aa={},_0x249445;return db[_0x1305('0x42')][_0x1305('0x57')]({'where':{'id':_0x27864a[_0x1305('0x48')]['id']}})[_0x1305('0x25')](handleEntityNotFound(_0xf44852,null))['then'](function(_0x5f1e2a){if(_0x5f1e2a){_0x249445=_0x5f1e2a['get']({'plain':!![]});_0x1058aa[_0x1305('0x33')]=_[_0x1305('0x49')](db['UserFaxQueue'][_0x1305('0x2f')]);_0x1058aa['query']=_['keys'](_0x27864a[_0x1305('0x34')]);_0x1058aa[_0x1305('0x35')]=_[_0x1305('0x36')](_0x1058aa[_0x1305('0x33')],_0x1058aa[_0x1305('0x34')]);_0x76a683[_0x1305('0x37')]=_['intersection'](_0x1058aa['model'],qs[_0x1305('0x38')](_0x27864a[_0x1305('0x34')][_0x1305('0x38')]));_0x76a683[_0x1305('0x37')]=_0x76a683[_0x1305('0x37')]['length']?_0x76a683[_0x1305('0x37')]:_0x1058aa[_0x1305('0x33')];if(!_0x27864a[_0x1305('0x34')][_0x1305('0x39')](_0x1305('0x3a'))){_0x76a683[_0x1305('0x1f')]=qs['limit'](_0x27864a[_0x1305('0x34')][_0x1305('0x1f')]);_0x76a683['offset']=qs[_0x1305('0x1c')](_0x27864a[_0x1305('0x34')]['offset']);}_0x76a683[_0x1305('0x3b')]=qs[_0x1305('0x58')](_0x27864a[_0x1305('0x34')][_0x1305('0x58')]);_0x76a683[_0x1305('0x41')]=qs[_0x1305('0x35')](_[_0x1305('0x3c')](_0x27864a[_0x1305('0x34')],_0x1058aa[_0x1305('0x35')]));_0x76a683[_0x1305('0x41')]['FaxQueueId']=_0x5f1e2a['id'];if(_0x27864a[_0x1305('0x34')]['filter']){_0x76a683[_0x1305('0x41')]=_[_0x1305('0x3e')](_0x76a683[_0x1305('0x41')],{'$or':_['map'](_0x76a683['attributes'],function(_0x4541ba){var _0x5002b6={};_0x5002b6[_0x4541ba]={'$like':'%'+_0x27864a[_0x1305('0x34')]['filter']+'%'};return _0x5002b6;})});}_0x76a683=_[_0x1305('0x3e')]({},_0x76a683,_0x27864a[_0x1305('0x40')]);return db['UserFaxQueue'][_0x1305('0x45')](_0x76a683);}})[_0x1305('0x25')](function(_0x3555b6){if(_0x3555b6){return db[_0x1305('0x59')][_0x1305('0x5a')]({'where':{'id':_[_0x1305('0x2e')](_0x3555b6,'UserId'),'role':'agent'},'attributes':['id','name','faxPause',_0x1305('0x5b'),_0x1305('0x5c')]});}})[_0x1305('0x25')](function(_0x40199e){if(_0x40199e){return{'count':_0x40199e[_0x1305('0x1e')],'rows':_[_0x1305('0x2e')](_0x40199e[_0x1305('0x5d')],function(_0x29fe1e){return{'membername':_0x29fe1e[_0x1305('0x2c')],'UserId':_0x29fe1e['id'],'queue_name':_0x249445[_0x1305('0x2c')],'FaxQueueId':_0x249445['id'],'interface':util[_0x1305('0x5e')](_0x1305('0x5f'),'SIP',_0x29fe1e['name']),'penalty':0x0,'paused':_0x29fe1e[_0x1305('0x60')],'createdAt':_0x29fe1e[_0x1305('0x5c')],'updatedAt':_0x29fe1e[_0x1305('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1305('0x25')](respondWithFilteredResult(_0xf44852,_0x76a683))[_0x1305('0x46')](handleError(_0xf44852,null));};exports[_0x1305('0x61')]=function(_0x530a01,_0x53d5c6,_0x1150c4){var _0x27bbec={};var _0x4cedc4={};var _0x473fe2;var _0x1368ec;return db[_0x1305('0x42')]['findOne']({'where':{'id':_0x530a01[_0x1305('0x48')]['id']}})[_0x1305('0x25')](handleEntityNotFound(_0x53d5c6,null))[_0x1305('0x25')](function(_0x32cd23){if(_0x32cd23){_0x473fe2=_0x32cd23;_0x4cedc4['model']=_[_0x1305('0x49')](db[_0x1305('0x62')]['rawAttributes']);_0x4cedc4['query']=_['keys'](_0x530a01['query']);_0x4cedc4[_0x1305('0x35')]=_['intersection'](_0x4cedc4['model'],_0x4cedc4[_0x1305('0x34')]);_0x27bbec[_0x1305('0x37')]=_[_0x1305('0x36')](_0x4cedc4[_0x1305('0x33')],qs[_0x1305('0x38')](_0x530a01[_0x1305('0x34')]['fields']));_0x27bbec['attributes']=_0x27bbec[_0x1305('0x37')][_0x1305('0x63')]?_0x27bbec[_0x1305('0x37')]:_0x4cedc4[_0x1305('0x33')];_0x27bbec['order']=qs['sort'](_0x530a01['query'][_0x1305('0x58')]);_0x27bbec[_0x1305('0x41')]=qs['filters'](_[_0x1305('0x3c')](_0x530a01[_0x1305('0x34')],_0x4cedc4[_0x1305('0x35')]));if(_0x530a01['query'][_0x1305('0x3d')]){_0x27bbec['where']=_[_0x1305('0x3e')](_0x27bbec['where'],{'$or':_[_0x1305('0x2e')](_0x27bbec['attributes'],function(_0x1201ff){var _0x1efa9b={};_0x1efa9b[_0x1201ff]={'$like':'%'+_0x530a01['query']['filter']+'%'};return _0x1efa9b;})});}_0x27bbec=_[_0x1305('0x3e')]({},_0x27bbec,_0x530a01[_0x1305('0x40')]);return _0x473fe2[_0x1305('0x61')](_0x27bbec);}})['then'](function(_0xebc564){if(_0xebc564){_0x1368ec=_0xebc564[_0x1305('0x63')];if(!_0x530a01[_0x1305('0x34')]['hasOwnProperty'](_0x1305('0x3a'))){_0x27bbec[_0x1305('0x1f')]=qs[_0x1305('0x1f')](_0x530a01['query'][_0x1305('0x1f')]);_0x27bbec[_0x1305('0x1c')]=qs[_0x1305('0x1c')](_0x530a01[_0x1305('0x34')][_0x1305('0x1c')]);}return _0x473fe2['getTeams'](_0x27bbec);}})['then'](function(_0x5158c0){if(_0x5158c0){return _0x5158c0?{'count':_0x1368ec,'rows':_0x5158c0}:null;}})[_0x1305('0x25')](respondWithResult(_0x53d5c6,null))[_0x1305('0x46')](handleError(_0x53d5c6,null));};exports['addTeams']=function(_0x4c828e,_0x295600,_0x1ca455){var _0x168c84=_0x4c828e[_0x1305('0x4c')][_0x1305('0x64')];return db[_0x1305('0x62')][_0x1305('0x45')]({'where':{'id':_0x168c84},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1305('0x65'),'attributes':['id','name',_0x1305('0x66'),'voicePause',_0x1305('0x67')],'raw':!![]}]})[_0x1305('0x25')](function(_0xf5c039){if(_0xf5c039){var _0x1180b2=_[_0x1305('0x68')](_0xf5c039,function(_0x5f2938){var _0x24eb19=_0x5f2938[_0x1305('0x27')]({'plain':!![]});return _0x24eb19[_0x1305('0x65')];});return db[_0x1305('0x42')][_0x1305('0x4a')]({'where':{'id':_0x4c828e['params']['id']}})[_0x1305('0x25')](function(_0x18f334){return db[_0x1305('0x69')][_0x1305('0x6a')](function(_0x1533ed){return _0x18f334[_0x1305('0x6b')](_0x168c84,{'transaction':_0x1533ed})['then'](function(){return BPromise[_0x1305('0x6c')](_0x1180b2,function(_0x48eb46){return db[_0x1305('0x6d')][_0x1305('0x6e')]({'where':{'UserId':_0x48eb46['id'],'FaxQueueId':_0x4c828e[_0x1305('0x48')]['id']},'transaction':_0x1533ed});});})['then'](function(){_0x1180b2[_0x1305('0x6f')](function(_0x227295){socket[_0x1305('0x70')](_0x1305('0x71'),{'UserId':_0x227295['id'],'FaxQueueId':_0x18f334['id']});});});});});}})[_0x1305('0x25')](respondWithStatusCode(_0x295600,null))[_0x1305('0x46')](handleError(_0x295600,null));};exports[_0x1305('0x72')]=function(_0x578993,_0x304c7b,_0x50be11){return db[_0x1305('0x62')][_0x1305('0x45')]({'where':{'id':_0x578993[_0x1305('0x34')][_0x1305('0x64')]},'attributes':['id'],'include':[{'model':db[_0x1305('0x59')],'as':_0x1305('0x65'),'attributes':['id'],'raw':!![]}]})[_0x1305('0x25')](handleEntityNotFound(_0x304c7b,null))[_0x1305('0x25')](function(_0x1a8a48){var _0x57b5da=_[_0x1305('0x2e')](_0x1a8a48,'id');var _0x5b0201=[];var _0x3ee83b=[];var _0x2d6ea3=squel['select']();_0x2d6ea3[_0x1305('0x73')](_0x1305('0x74'))[_0x1305('0x75')](_0x1305('0x76'),'tq')['join'](_0x1305('0x77'),'ut',_0x1305('0x78'))[_0x1305('0x41')]('FaxQueueId\x20=\x20?',_0x578993[_0x1305('0x48')]['id']);for(var _0x3f9aa3=0x0;_0x3f9aa3<_0x1a8a48[_0x1305('0x63')];_0x3f9aa3+=0x1){let _0x3902d0=_0x1a8a48[_0x3f9aa3];for(var _0x46e080=0x0;_0x46e080<_0x3902d0[_0x1305('0x65')][_0x1305('0x63')];_0x46e080+=0x1){let _0x1556cc=_0x3902d0[_0x1305('0x65')][_0x46e080];var _0x1c5618=_0x2d6ea3['clone']();_0x1c5618['where']('ut.UserId\x20=\x20?',_0x1556cc['id']);_0x3ee83b[_0x1305('0x79')](db['sequelize'][_0x1305('0x34')](_0x1c5618[_0x1305('0x7a')](),{'type':db[_0x1305('0x69')][_0x1305('0x7b')][_0x1305('0x7c')]})[_0x1305('0x25')](function(_0x13ce65){if(_0x13ce65[_0x1305('0x63')]===0x1){return _0x1556cc['id'];}else{var _0x39f865=_['every'](_[_0x1305('0x2e')](_0x13ce65,'TeamId'),function(_0x33d62e){return _[_0x1305('0x7d')](_0x57b5da,_0x33d62e);});if(_0x39f865){return _0x1556cc['id'];}}}));}}return BPromise[_0x1305('0x7e')](_0x3ee83b)[_0x1305('0x25')](function(_0x3c7636){_0x5b0201=_(_0x5b0201)[_0x1305('0x7f')](_0x3c7636)[_0x1305('0x80')]()['value']();return db['FaxQueue'][_0x1305('0x4a')]({'where':{'id':_0x578993[_0x1305('0x48')]['id']}})[_0x1305('0x25')](function(_0x438e3a){return db[_0x1305('0x69')][_0x1305('0x6a')](function(_0x5b1212){return _0x438e3a[_0x1305('0x72')](_0x578993[_0x1305('0x34')][_0x1305('0x64')],{'transaction':_0x5b1212})[_0x1305('0x25')](function(){if(!_['isEmpty'](_0x5b0201)){return _0x438e3a[_0x1305('0x81')](_0x5b0201,{'transaction':_0x5b1212});}})[_0x1305('0x25')](function(){_0x5b0201[_0x1305('0x6f')](function(_0x2a8fbf){socket[_0x1305('0x70')](_0x1305('0x82'),{'UserId':_0x2a8fbf,'FaxQueueId':_0x438e3a['id']});});});});});});})[_0x1305('0x25')](respondWithStatusCode(_0x304c7b,null))[_0x1305('0x46')](handleError(_0x304c7b,null));};exports[_0x1305('0x83')]=function(_0x5c8801,_0x41dde8,_0x570cda){return db[_0x1305('0x42')][_0x1305('0x4a')]({'where':{'id':_0x5c8801[_0x1305('0x48')]['id']}})[_0x1305('0x25')](handleEntityNotFound(_0x41dde8,null))[_0x1305('0x25')](function(_0x33585e){if(_0x33585e){return _0x33585e[_0x1305('0x83')](_0x5c8801[_0x1305('0x4c')]['ids'],_[_0x1305('0x84')](_0x5c8801[_0x1305('0x4c')],['ids','id'])||{})['spread'](function(_0x1fb75f){for(var _0x17dd71=0x0;_0x17dd71<_0x5c8801[_0x1305('0x4c')][_0x1305('0x64')][_0x1305('0x63')];_0x17dd71+=0x1){socket[_0x1305('0x70')](_0x1305('0x71'),{'UserId':Number(_0x5c8801['body'][_0x1305('0x64')][_0x17dd71]),'FaxQueueId':Number(_0x5c8801[_0x1305('0x48')]['id'])});}return _0x1fb75f;});}})[_0x1305('0x25')](respondWithResult(_0x41dde8,null))[_0x1305('0x46')](handleError(_0x41dde8,null));};exports[_0x1305('0x81')]=function(_0x101dd8,_0x172489,_0xbad49b){return db[_0x1305('0x42')][_0x1305('0x4a')]({'where':{'id':_0x101dd8[_0x1305('0x48')]['id']}})['then'](handleEntityNotFound(_0x172489,null))[_0x1305('0x25')](function(_0x2b3960){if(_0x2b3960){return _0x2b3960[_0x1305('0x81')](_0x101dd8[_0x1305('0x34')]['ids'])[_0x1305('0x25')](function(){if(_[_0x1305('0x85')](_0x101dd8['query'][_0x1305('0x64')])){for(var _0x30dd79=0x0;_0x30dd79<_0x101dd8[_0x1305('0x34')][_0x1305('0x64')]['length'];_0x30dd79+=0x1){socket[_0x1305('0x70')](_0x1305('0x82'),{'UserId':Number(_0x101dd8[_0x1305('0x34')][_0x1305('0x64')][_0x30dd79]),'FaxQueueId':Number(_0x101dd8[_0x1305('0x48')]['id'])});}}else{socket[_0x1305('0x70')](_0x1305('0x82'),{'UserId':Number(_0x101dd8[_0x1305('0x34')]['ids']),'FaxQueueId':Number(_0x101dd8[_0x1305('0x48')]['id'])});}});}})[_0x1305('0x25')](respondWithStatusCode(_0x172489,null))[_0x1305('0x46')](handleError(_0x172489,null));};exports['getAgents']=function(_0xa71843,_0x5377d0,_0x42414f){var _0x24e100={};var _0x9a2f23={};var _0x543437;var _0xd44390;return db[_0x1305('0x42')]['findOne']({'where':{'id':_0xa71843[_0x1305('0x48')]['id']}})[_0x1305('0x25')](handleEntityNotFound(_0x5377d0,null))[_0x1305('0x25')](function(_0x3def07){if(_0x3def07){_0x543437=_0x3def07;_0x9a2f23[_0x1305('0x33')]=_[_0x1305('0x49')](db[_0x1305('0x59')][_0x1305('0x2f')]);_0x9a2f23[_0x1305('0x34')]=_[_0x1305('0x49')](_0xa71843[_0x1305('0x34')]);_0x9a2f23[_0x1305('0x35')]=_[_0x1305('0x36')](_0x9a2f23[_0x1305('0x33')],_0x9a2f23[_0x1305('0x34')]);_0x24e100['attributes']=_[_0x1305('0x36')](_0x9a2f23[_0x1305('0x33')],qs[_0x1305('0x38')](_0xa71843[_0x1305('0x34')][_0x1305('0x38')]));_0x24e100[_0x1305('0x37')]=_0x24e100[_0x1305('0x37')][_0x1305('0x63')]?_0x24e100[_0x1305('0x37')]:_0x9a2f23['model'];_0x24e100[_0x1305('0x3b')]=qs[_0x1305('0x58')](_0xa71843[_0x1305('0x34')]['sort']);_0x24e100['where']=qs[_0x1305('0x35')](_['pick'](_0xa71843[_0x1305('0x34')],_0x9a2f23[_0x1305('0x35')]));if(_0xa71843[_0x1305('0x34')][_0x1305('0x3d')]){_0x24e100[_0x1305('0x41')]=_['merge'](_0x24e100[_0x1305('0x41')],{'$or':_[_0x1305('0x2e')](_0x24e100[_0x1305('0x37')],function(_0x1c2d38){var _0x216d37={};_0x216d37[_0x1c2d38]={'$like':'%'+_0xa71843[_0x1305('0x34')][_0x1305('0x3d')]+'%'};return _0x216d37;})});}_0x24e100=_['merge']({},_0x24e100,_0xa71843[_0x1305('0x40')]);return _0x543437[_0x1305('0x86')](_0x24e100);}})[_0x1305('0x25')](function(_0x5bec1d){if(_0x5bec1d){_0xd44390=_0x5bec1d[_0x1305('0x63')];if(!_0xa71843[_0x1305('0x34')][_0x1305('0x39')]('nolimit')){_0x24e100[_0x1305('0x1f')]=qs['limit'](_0xa71843[_0x1305('0x34')][_0x1305('0x1f')]);_0x24e100[_0x1305('0x1c')]=qs[_0x1305('0x1c')](_0xa71843[_0x1305('0x34')][_0x1305('0x1c')]);}return _0x543437[_0x1305('0x86')](_0x24e100);}})['then'](function(_0x1621c4){if(_0x1621c4){return _0x1621c4?{'count':_0xd44390,'rows':_0x1621c4}:null;}})[_0x1305('0x25')](respondWithResult(_0x5377d0,null))['catch'](handleError(_0x5377d0,null));}; \ No newline at end of file +var _0x8bc9=['request-promise','bluebird','mustache','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','FaxQueue','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','UserProfileResource','destroy','describe','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','findAll','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','TeamId','includes','all','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x8bc9,0x88));var _0x98bc=function(_0x59798f,_0x8c67d6){_0x59798f=_0x59798f-0x0;var _0x3bdce3=_0x8bc9[_0x59798f];return _0x3bdce3;};'use strict';var emlformat=require(_0x98bc('0x0'));var rimraf=require(_0x98bc('0x1'));var zipdir=require(_0x98bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98bc('0x3'));var moment=require('moment');var BPromise=require(_0x98bc('0x4'));var Mustache=require(_0x98bc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x98bc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98bc('0x7'));var _=require(_0x98bc('0x8'));var squel=require(_0x98bc('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98bc('0xa'));var toCsv=require(_0x98bc('0x6'));var querystring=require(_0x98bc('0xb'));var Papa=require(_0x98bc('0xc'));var Redis=require(_0x98bc('0xd'));var authService=require(_0x98bc('0xe'));var qs=require(_0x98bc('0xf'));var as=require(_0x98bc('0x10'));var hardwareService=require(_0x98bc('0x11'));var logger=require(_0x98bc('0x12'))(_0x98bc('0x13'));var utils=require(_0x98bc('0x14'));var config=require(_0x98bc('0x15'));var licenseUtil=require(_0x98bc('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x98bc('0x17')](config[_0x98bc('0x18')],{'host':_0x98bc('0x19'),'port':0x18eb});var socket=require(_0x98bc('0x1a'))(new Redis(config[_0x98bc('0x18')]));require(_0x98bc('0x1b'))[_0x98bc('0x1c')](socket);function respondWithStatusCode(_0x2e6c11,_0x33be73){_0x33be73=_0x33be73||0xcc;return function(_0x51ce7f){if(_0x51ce7f){return _0x2e6c11[_0x98bc('0x1d')](_0x33be73);}return _0x2e6c11[_0x98bc('0x1e')](_0x33be73)[_0x98bc('0x1f')]();};}function respondWithResult(_0x5af358,_0x4fe6b4){_0x4fe6b4=_0x4fe6b4||0xc8;return function(_0x49cdb3){if(_0x49cdb3){return _0x5af358['status'](_0x4fe6b4)['json'](_0x49cdb3);}};}function respondWithFilteredResult(_0x5c946a,_0x62ecba){return function(_0x4d7d3d){if(_0x4d7d3d){var _0x25c164=typeof _0x62ecba['offset']===_0x98bc('0x20')&&typeof _0x62ecba[_0x98bc('0x21')]===_0x98bc('0x20');var _0x29e0c7=_0x4d7d3d[_0x98bc('0x22')];var _0x4a1a26=_0x25c164?0x0:_0x62ecba['offset'];var _0x16d5e5=_0x25c164?_0x4d7d3d[_0x98bc('0x22')]:_0x62ecba[_0x98bc('0x23')]+_0x62ecba[_0x98bc('0x21')];var _0x2e33ce;if(_0x16d5e5>=_0x29e0c7){_0x16d5e5=_0x29e0c7;_0x2e33ce=0xc8;}else{_0x2e33ce=0xce;}_0x5c946a[_0x98bc('0x1e')](_0x2e33ce);return _0x5c946a[_0x98bc('0x24')]('Content-Range',_0x4a1a26+'-'+_0x16d5e5+'/'+_0x29e0c7)['json'](_0x4d7d3d);}return null;};}function patchUpdates(_0x1dca55){return function(_0x18556c){try{jsonpatch[_0x98bc('0x25')](_0x18556c,_0x1dca55,!![]);}catch(_0xca5808){return BPromise[_0x98bc('0x26')](_0xca5808);}return _0x18556c[_0x98bc('0x27')]();};}function saveUpdates(_0x11a04e,_0x122d78){return function(_0x5584eb){if(_0x5584eb){return _0x5584eb[_0x98bc('0x28')](_0x11a04e)[_0x98bc('0x29')](function(_0x135a53){return _0x135a53;});}return null;};}function removeEntity(_0x377d40,_0x6aaae5){return function(_0x2133d3){if(_0x2133d3){return _0x2133d3['destroy']()[_0x98bc('0x29')](function(){var _0x45a712=_0x2133d3['get']({'plain':!![]});var _0x418ea3='FaxQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x418ea3,'resourceId':_0x45a712['id']}})[_0x98bc('0x29')](function(){return _0x2133d3;});})['then'](function(){_0x377d40[_0x98bc('0x1e')](0xcc)[_0x98bc('0x1f')]();});}};}function handleEntityNotFound(_0x146e51,_0x2d8879){return function(_0x56503e){if(!_0x56503e){_0x146e51[_0x98bc('0x1d')](0x194);}return _0x56503e;};}function handleError(_0x26535e,_0x550c37){_0x550c37=_0x550c37||0x1f4;return function(_0x540bac){logger[_0x98bc('0x2a')](_0x540bac[_0x98bc('0x2b')]);if(_0x540bac[_0x98bc('0x2c')]){delete _0x540bac[_0x98bc('0x2c')];}_0x26535e['status'](_0x550c37)[_0x98bc('0x2d')](_0x540bac);};}exports[_0x98bc('0x2e')]=function(_0x4d47ce,_0x36aef2){var _0x3163e7={},_0x40f5c0={},_0x536946={'count':0x0,'rows':[]};var _0x4a49e3=_['map'](db[_0x98bc('0x2f')]['rawAttributes'],function(_0x11a9fa){return{'name':_0x11a9fa[_0x98bc('0x30')],'type':_0x11a9fa[_0x98bc('0x31')][_0x98bc('0x32')]};});_0x40f5c0[_0x98bc('0x33')]=_[_0x98bc('0x34')](_0x4a49e3,_0x98bc('0x2c'));_0x40f5c0[_0x98bc('0x35')]=_[_0x98bc('0x36')](_0x4d47ce[_0x98bc('0x35')]);_0x40f5c0[_0x98bc('0x37')]=_['intersection'](_0x40f5c0['model'],_0x40f5c0[_0x98bc('0x35')]);_0x3163e7['attributes']=_[_0x98bc('0x38')](_0x40f5c0[_0x98bc('0x33')],qs['fields'](_0x4d47ce[_0x98bc('0x35')][_0x98bc('0x39')]));_0x3163e7[_0x98bc('0x3a')]=_0x3163e7['attributes'][_0x98bc('0x3b')]?_0x3163e7[_0x98bc('0x3a')]:_0x40f5c0['model'];if(!_0x4d47ce[_0x98bc('0x35')][_0x98bc('0x3c')](_0x98bc('0x3d'))){_0x3163e7[_0x98bc('0x21')]=qs[_0x98bc('0x21')](_0x4d47ce[_0x98bc('0x35')][_0x98bc('0x21')]);_0x3163e7[_0x98bc('0x23')]=qs[_0x98bc('0x23')](_0x4d47ce[_0x98bc('0x35')]['offset']);}_0x3163e7[_0x98bc('0x3e')]=qs[_0x98bc('0x3f')](_0x4d47ce[_0x98bc('0x35')][_0x98bc('0x3f')]);_0x3163e7[_0x98bc('0x40')]=qs[_0x98bc('0x37')](_[_0x98bc('0x41')](_0x4d47ce[_0x98bc('0x35')],_0x40f5c0[_0x98bc('0x37')]),_0x4a49e3);if(_0x4d47ce[_0x98bc('0x35')][_0x98bc('0x42')]){_0x3163e7[_0x98bc('0x40')]=_[_0x98bc('0x43')](_0x3163e7[_0x98bc('0x40')],{'$or':_[_0x98bc('0x34')](_0x4a49e3,function(_0x327730){if(_0x327730[_0x98bc('0x31')]!==_0x98bc('0x44')){var _0x2c2e46={};_0x2c2e46[_0x327730['name']]={'$like':'%'+_0x4d47ce[_0x98bc('0x35')][_0x98bc('0x42')]+'%'};return _0x2c2e46;}})});}_0x3163e7=_['merge']({},_0x3163e7,_0x4d47ce['options']);var _0x23b926={'where':_0x3163e7[_0x98bc('0x40')]};return db['FaxQueue']['count'](_0x23b926)[_0x98bc('0x29')](function(_0x541749){_0x536946[_0x98bc('0x22')]=_0x541749;if(_0x4d47ce['query']['includeAll']){_0x3163e7['include']=[{'all':!![]}];}return db[_0x98bc('0x2f')]['findAll'](_0x3163e7);})[_0x98bc('0x29')](function(_0x1451a4){_0x536946[_0x98bc('0x45')]=_0x1451a4;return _0x536946;})[_0x98bc('0x29')](respondWithFilteredResult(_0x36aef2,_0x3163e7))[_0x98bc('0x46')](handleError(_0x36aef2,null));};exports[_0x98bc('0x47')]=function(_0x56e89d,_0x1bd3db){var _0x55a393={'raw':!![],'where':{'id':_0x56e89d[_0x98bc('0x48')]['id']}},_0x274ce3={};_0x274ce3[_0x98bc('0x33')]=_[_0x98bc('0x36')](db['FaxQueue'][_0x98bc('0x49')]);_0x274ce3['query']=_[_0x98bc('0x36')](_0x56e89d['query']);_0x274ce3[_0x98bc('0x37')]=_[_0x98bc('0x38')](_0x274ce3[_0x98bc('0x33')],_0x274ce3['query']);_0x55a393['attributes']=_[_0x98bc('0x38')](_0x274ce3[_0x98bc('0x33')],qs[_0x98bc('0x39')](_0x56e89d[_0x98bc('0x35')]['fields']));_0x55a393['attributes']=_0x55a393['attributes'][_0x98bc('0x3b')]?_0x55a393[_0x98bc('0x3a')]:_0x274ce3[_0x98bc('0x33')];if(_0x56e89d[_0x98bc('0x35')][_0x98bc('0x4a')]){_0x55a393[_0x98bc('0x4b')]=[{'all':!![]}];}_0x55a393=_[_0x98bc('0x43')]({},_0x55a393,_0x56e89d[_0x98bc('0x4c')]);return db['FaxQueue'][_0x98bc('0x4d')](_0x55a393)[_0x98bc('0x29')](handleEntityNotFound(_0x1bd3db,null))['then'](respondWithResult(_0x1bd3db,null))[_0x98bc('0x46')](handleError(_0x1bd3db,null));};exports[_0x98bc('0x4e')]=function(_0x2ed484,_0x2f7628){return db['FaxQueue'][_0x98bc('0x4e')](_0x2ed484[_0x98bc('0x4f')],{})[_0x98bc('0x29')](function(_0x360c8b){var _0x3287d6=_0x2ed484[_0x98bc('0x50')]['get']({'plain':!![]});if(!_0x3287d6)throw new Error(_0x98bc('0x51'));if(_0x3287d6[_0x98bc('0x52')]===_0x98bc('0x50')){var _0x5ab903=_0x360c8b[_0x98bc('0x53')]({'plain':!![]});var _0x415e78='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x415e78,'userProfileId':_0x3287d6[_0x98bc('0x54')]},'raw':!![]})[_0x98bc('0x29')](function(_0x372d1d){if(_0x372d1d&&_0x372d1d[_0x98bc('0x55')]===0x0){return db[_0x98bc('0x56')][_0x98bc('0x4e')]({'name':_0x5ab903[_0x98bc('0x2c')],'resourceId':_0x5ab903['id'],'type':_0x372d1d[_0x98bc('0x2c')],'sectionId':_0x372d1d['id']},{})[_0x98bc('0x29')](function(){return _0x360c8b;});}else{return _0x360c8b;}})['catch'](function(_0x4510e4){logger[_0x98bc('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4510e4);throw _0x4510e4;});}return _0x360c8b;})['then'](respondWithResult(_0x2f7628,0xc9))['catch'](handleError(_0x2f7628,null));};exports['update']=function(_0x44498f,_0x3e0275){if(_0x44498f[_0x98bc('0x4f')]['id']){delete _0x44498f[_0x98bc('0x4f')]['id'];}return db[_0x98bc('0x2f')][_0x98bc('0x4d')]({'where':{'id':_0x44498f[_0x98bc('0x48')]['id']}})[_0x98bc('0x29')](handleEntityNotFound(_0x3e0275,null))[_0x98bc('0x29')](saveUpdates(_0x44498f['body'],null))[_0x98bc('0x29')](respondWithResult(_0x3e0275,null))[_0x98bc('0x46')](handleError(_0x3e0275,null));};exports[_0x98bc('0x57')]=function(_0xe712d,_0x1a95d2){return db['FaxQueue'][_0x98bc('0x4d')]({'where':{'id':_0xe712d[_0x98bc('0x48')]['id']}})[_0x98bc('0x29')](handleEntityNotFound(_0x1a95d2,null))['then'](removeEntity(_0x1a95d2,null))[_0x98bc('0x46')](handleError(_0x1a95d2,null));};exports[_0x98bc('0x58')]=function(_0x16a6a2,_0x92cecc){return db[_0x98bc('0x2f')][_0x98bc('0x58')]()[_0x98bc('0x29')](respondWithResult(_0x92cecc,null))[_0x98bc('0x46')](handleError(_0x92cecc,null));};exports['getMembers']=function(_0x42a624,_0x15bba,_0x5bf187){var _0x4a94c9={'raw':!![],'where':{}},_0x15ec49={},_0x176933;return db[_0x98bc('0x2f')][_0x98bc('0x59')]({'where':{'id':_0x42a624[_0x98bc('0x48')]['id']}})['then'](handleEntityNotFound(_0x15bba,null))[_0x98bc('0x29')](function(_0x2a063){if(_0x2a063){_0x176933=_0x2a063[_0x98bc('0x53')]({'plain':!![]});_0x15ec49[_0x98bc('0x33')]=_[_0x98bc('0x36')](db[_0x98bc('0x5a')][_0x98bc('0x49')]);_0x15ec49[_0x98bc('0x35')]=_[_0x98bc('0x36')](_0x42a624[_0x98bc('0x35')]);_0x15ec49[_0x98bc('0x37')]=_[_0x98bc('0x38')](_0x15ec49[_0x98bc('0x33')],_0x15ec49['query']);_0x4a94c9[_0x98bc('0x3a')]=_['intersection'](_0x15ec49[_0x98bc('0x33')],qs[_0x98bc('0x39')](_0x42a624[_0x98bc('0x35')][_0x98bc('0x39')]));_0x4a94c9[_0x98bc('0x3a')]=_0x4a94c9[_0x98bc('0x3a')][_0x98bc('0x3b')]?_0x4a94c9[_0x98bc('0x3a')]:_0x15ec49[_0x98bc('0x33')];if(!_0x42a624['query'][_0x98bc('0x3c')](_0x98bc('0x3d'))){_0x4a94c9[_0x98bc('0x21')]=qs[_0x98bc('0x21')](_0x42a624[_0x98bc('0x35')][_0x98bc('0x21')]);_0x4a94c9[_0x98bc('0x23')]=qs[_0x98bc('0x23')](_0x42a624[_0x98bc('0x35')][_0x98bc('0x23')]);}_0x4a94c9[_0x98bc('0x3e')]=qs[_0x98bc('0x3f')](_0x42a624['query'][_0x98bc('0x3f')]);_0x4a94c9[_0x98bc('0x40')]=qs[_0x98bc('0x37')](_[_0x98bc('0x41')](_0x42a624[_0x98bc('0x35')],_0x15ec49[_0x98bc('0x37')]));_0x4a94c9[_0x98bc('0x40')][_0x98bc('0x5b')]=_0x2a063['id'];if(_0x42a624[_0x98bc('0x35')][_0x98bc('0x42')]){_0x4a94c9[_0x98bc('0x40')]=_[_0x98bc('0x43')](_0x4a94c9[_0x98bc('0x40')],{'$or':_[_0x98bc('0x34')](_0x4a94c9[_0x98bc('0x3a')],function(_0x519713){var _0x3fbf3a={};_0x3fbf3a[_0x519713]={'$like':'%'+_0x42a624[_0x98bc('0x35')]['filter']+'%'};return _0x3fbf3a;})});}_0x4a94c9=_[_0x98bc('0x43')]({},_0x4a94c9,_0x42a624['options']);return db[_0x98bc('0x5a')]['findAll'](_0x4a94c9);}})[_0x98bc('0x29')](function(_0x3f472c){if(_0x3f472c){return db[_0x98bc('0x5c')][_0x98bc('0x5d')]({'where':{'id':_['map'](_0x3f472c,_0x98bc('0x5e')),'role':_0x98bc('0x5f')},'attributes':['id',_0x98bc('0x2c'),_0x98bc('0x60'),_0x98bc('0x61'),_0x98bc('0x62')]});}})[_0x98bc('0x29')](function(_0x386354){if(_0x386354){return{'count':_0x386354[_0x98bc('0x22')],'rows':_[_0x98bc('0x34')](_0x386354[_0x98bc('0x45')],function(_0x17d75f){return{'membername':_0x17d75f[_0x98bc('0x2c')],'UserId':_0x17d75f['id'],'queue_name':_0x176933['name'],'FaxQueueId':_0x176933['id'],'interface':util[_0x98bc('0x63')]('%s/%s','SIP',_0x17d75f[_0x98bc('0x2c')]),'penalty':0x0,'paused':_0x17d75f['faxPause'],'createdAt':_0x17d75f[_0x98bc('0x62')],'updatedAt':_0x17d75f[_0x98bc('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x98bc('0x29')](respondWithFilteredResult(_0x15bba,_0x4a94c9))[_0x98bc('0x46')](handleError(_0x15bba,null));};exports[_0x98bc('0x64')]=function(_0x204c0f,_0x22fcdf,_0x57ac7b){var _0x55a982={};var _0xfb6acf={};var _0x15da6d;var _0x78b649;return db['FaxQueue'][_0x98bc('0x59')]({'where':{'id':_0x204c0f[_0x98bc('0x48')]['id']}})['then'](handleEntityNotFound(_0x22fcdf,null))['then'](function(_0x58310f){if(_0x58310f){_0x15da6d=_0x58310f;_0xfb6acf[_0x98bc('0x33')]=_[_0x98bc('0x36')](db[_0x98bc('0x65')][_0x98bc('0x49')]);_0xfb6acf[_0x98bc('0x35')]=_[_0x98bc('0x36')](_0x204c0f[_0x98bc('0x35')]);_0xfb6acf[_0x98bc('0x37')]=_[_0x98bc('0x38')](_0xfb6acf[_0x98bc('0x33')],_0xfb6acf[_0x98bc('0x35')]);_0x55a982[_0x98bc('0x3a')]=_[_0x98bc('0x38')](_0xfb6acf['model'],qs[_0x98bc('0x39')](_0x204c0f[_0x98bc('0x35')]['fields']));_0x55a982[_0x98bc('0x3a')]=_0x55a982['attributes'][_0x98bc('0x3b')]?_0x55a982[_0x98bc('0x3a')]:_0xfb6acf[_0x98bc('0x33')];_0x55a982[_0x98bc('0x3e')]=qs[_0x98bc('0x3f')](_0x204c0f[_0x98bc('0x35')]['sort']);_0x55a982[_0x98bc('0x40')]=qs['filters'](_[_0x98bc('0x41')](_0x204c0f[_0x98bc('0x35')],_0xfb6acf[_0x98bc('0x37')]));if(_0x204c0f[_0x98bc('0x35')][_0x98bc('0x42')]){_0x55a982['where']=_['merge'](_0x55a982['where'],{'$or':_[_0x98bc('0x34')](_0x55a982['attributes'],function(_0x3e2813){var _0x44a167={};_0x44a167[_0x3e2813]={'$like':'%'+_0x204c0f[_0x98bc('0x35')][_0x98bc('0x42')]+'%'};return _0x44a167;})});}_0x55a982=_[_0x98bc('0x43')]({},_0x55a982,_0x204c0f[_0x98bc('0x4c')]);return _0x15da6d['getTeams'](_0x55a982);}})['then'](function(_0x44f454){if(_0x44f454){_0x78b649=_0x44f454[_0x98bc('0x3b')];if(!_0x204c0f[_0x98bc('0x35')][_0x98bc('0x3c')](_0x98bc('0x3d'))){_0x55a982['limit']=qs[_0x98bc('0x21')](_0x204c0f[_0x98bc('0x35')][_0x98bc('0x21')]);_0x55a982[_0x98bc('0x23')]=qs[_0x98bc('0x23')](_0x204c0f[_0x98bc('0x35')][_0x98bc('0x23')]);}return _0x15da6d[_0x98bc('0x64')](_0x55a982);}})[_0x98bc('0x29')](function(_0x1c2e98){if(_0x1c2e98){return _0x1c2e98?{'count':_0x78b649,'rows':_0x1c2e98}:null;}})[_0x98bc('0x29')](respondWithResult(_0x22fcdf,null))[_0x98bc('0x46')](handleError(_0x22fcdf,null));};exports[_0x98bc('0x66')]=function(_0x191eac,_0x17d963,_0x2ccc13){var _0x4f38ee=_0x191eac[_0x98bc('0x4f')][_0x98bc('0x67')];return db[_0x98bc('0x65')][_0x98bc('0x68')]({'where':{'id':_0x4f38ee},'attributes':['id'],'include':[{'model':db[_0x98bc('0x5c')],'as':_0x98bc('0x69'),'attributes':['id',_0x98bc('0x2c'),_0x98bc('0x6a'),_0x98bc('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x1f721b){if(_0x1f721b){var _0x429b61=_[_0x98bc('0x6c')](_0x1f721b,function(_0x36cac9){var _0x8cd432=_0x36cac9[_0x98bc('0x53')]({'plain':!![]});return _0x8cd432[_0x98bc('0x69')];});return db[_0x98bc('0x2f')][_0x98bc('0x4d')]({'where':{'id':_0x191eac[_0x98bc('0x48')]['id']}})[_0x98bc('0x29')](function(_0x545adc){return db[_0x98bc('0x6d')][_0x98bc('0x6e')](function(_0x4015b2){return _0x545adc[_0x98bc('0x66')](_0x4f38ee,{'transaction':_0x4015b2})['then'](function(){return BPromise[_0x98bc('0x6f')](_0x429b61,function(_0xd130c7){return db['UserFaxQueue'][_0x98bc('0x70')]({'where':{'UserId':_0xd130c7['id'],'FaxQueueId':_0x191eac[_0x98bc('0x48')]['id']},'transaction':_0x4015b2});});})[_0x98bc('0x29')](function(){_0x429b61[_0x98bc('0x71')](function(_0x3e4d75){socket[_0x98bc('0x72')](_0x98bc('0x73'),{'UserId':_0x3e4d75['id'],'FaxQueueId':_0x545adc['id']});});});});});}})[_0x98bc('0x29')](respondWithStatusCode(_0x17d963,null))[_0x98bc('0x46')](handleError(_0x17d963,null));};exports[_0x98bc('0x74')]=function(_0xd08602,_0x2afbbf,_0x1c21c1){return db[_0x98bc('0x65')]['findAll']({'where':{'id':_0xd08602[_0x98bc('0x35')][_0x98bc('0x67')]},'attributes':['id'],'include':[{'model':db[_0x98bc('0x5c')],'as':_0x98bc('0x69'),'attributes':['id'],'raw':!![]}]})[_0x98bc('0x29')](handleEntityNotFound(_0x2afbbf,null))[_0x98bc('0x29')](function(_0x4fc3ca){var _0x1af7b4=_['map'](_0x4fc3ca,'id');var _0x4a4baf=[];var _0x130b5c=[];var _0x52a0d3=squel[_0x98bc('0x75')]();_0x52a0d3['field'](_0x98bc('0x76'))[_0x98bc('0x77')]('team_has_fax_queues','tq')[_0x98bc('0x78')](_0x98bc('0x79'),'ut',_0x98bc('0x7a'))['where']('FaxQueueId\x20=\x20?',_0xd08602[_0x98bc('0x48')]['id']);for(var _0x1b441b=0x0;_0x1b441b<_0x4fc3ca[_0x98bc('0x3b')];_0x1b441b+=0x1){let _0x3d221c=_0x4fc3ca[_0x1b441b];for(var _0x512b32=0x0;_0x512b32<_0x3d221c[_0x98bc('0x69')][_0x98bc('0x3b')];_0x512b32+=0x1){let _0x2a28e8=_0x3d221c['Agents'][_0x512b32];var _0xbd6c63=_0x52a0d3[_0x98bc('0x7b')]();_0xbd6c63[_0x98bc('0x40')]('ut.UserId\x20=\x20?',_0x2a28e8['id']);_0x130b5c[_0x98bc('0x7c')](db[_0x98bc('0x6d')][_0x98bc('0x35')](_0xbd6c63[_0x98bc('0x7d')](),{'type':db[_0x98bc('0x6d')][_0x98bc('0x7e')]['SELECT']})[_0x98bc('0x29')](function(_0x247e2e){if(_0x247e2e[_0x98bc('0x3b')]===0x1){return _0x2a28e8['id'];}else{var _0x1ae65a=_['every'](_[_0x98bc('0x34')](_0x247e2e,_0x98bc('0x7f')),function(_0x1fda37){return _[_0x98bc('0x80')](_0x1af7b4,_0x1fda37);});if(_0x1ae65a){return _0x2a28e8['id'];}}}));}}return BPromise[_0x98bc('0x81')](_0x130b5c)[_0x98bc('0x29')](function(_0x13ecad){_0x4a4baf=_(_0x4a4baf)[_0x98bc('0x82')](_0x13ecad)[_0x98bc('0x83')]()['value']();return db[_0x98bc('0x2f')][_0x98bc('0x4d')]({'where':{'id':_0xd08602[_0x98bc('0x48')]['id']}})['then'](function(_0x155161){return db['sequelize'][_0x98bc('0x6e')](function(_0x51a386){return _0x155161['removeTeams'](_0xd08602[_0x98bc('0x35')][_0x98bc('0x67')],{'transaction':_0x51a386})['then'](function(){if(!_[_0x98bc('0x84')](_0x4a4baf)){return _0x155161[_0x98bc('0x85')](_0x4a4baf,{'transaction':_0x51a386});}})[_0x98bc('0x29')](function(){_0x4a4baf[_0x98bc('0x71')](function(_0xb93cd9){socket[_0x98bc('0x72')](_0x98bc('0x86'),{'UserId':_0xb93cd9,'FaxQueueId':_0x155161['id']});});});});});});})[_0x98bc('0x29')](respondWithStatusCode(_0x2afbbf,null))[_0x98bc('0x46')](handleError(_0x2afbbf,null));};exports[_0x98bc('0x87')]=function(_0x35536f,_0x3674c9,_0x5d46c8){return db[_0x98bc('0x2f')]['find']({'where':{'id':_0x35536f[_0x98bc('0x48')]['id']}})['then'](handleEntityNotFound(_0x3674c9,null))[_0x98bc('0x29')](function(_0x4ca7df){if(_0x4ca7df){return _0x4ca7df[_0x98bc('0x87')](_0x35536f[_0x98bc('0x4f')][_0x98bc('0x67')],_[_0x98bc('0x88')](_0x35536f['body'],[_0x98bc('0x67'),'id'])||{})[_0x98bc('0x89')](function(_0x98d3a1){for(var _0x1c0792=0x0;_0x1c0792<_0x35536f[_0x98bc('0x4f')][_0x98bc('0x67')][_0x98bc('0x3b')];_0x1c0792+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x35536f[_0x98bc('0x4f')][_0x98bc('0x67')][_0x1c0792]),'FaxQueueId':Number(_0x35536f[_0x98bc('0x48')]['id'])});}return _0x98d3a1;});}})['then'](respondWithResult(_0x3674c9,null))['catch'](handleError(_0x3674c9,null));};exports['removeAgents']=function(_0x47e4f7,_0x4fdf54,_0x537da0){return db[_0x98bc('0x2f')][_0x98bc('0x4d')]({'where':{'id':_0x47e4f7[_0x98bc('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fdf54,null))[_0x98bc('0x29')](function(_0x471b1c){if(_0x471b1c){return _0x471b1c[_0x98bc('0x85')](_0x47e4f7[_0x98bc('0x35')][_0x98bc('0x67')])['then'](function(){if(_['isArray'](_0x47e4f7['query'][_0x98bc('0x67')])){for(var _0x2de042=0x0;_0x2de042<_0x47e4f7[_0x98bc('0x35')][_0x98bc('0x67')]['length'];_0x2de042+=0x1){socket[_0x98bc('0x72')](_0x98bc('0x86'),{'UserId':Number(_0x47e4f7[_0x98bc('0x35')][_0x98bc('0x67')][_0x2de042]),'FaxQueueId':Number(_0x47e4f7['params']['id'])});}}else{socket[_0x98bc('0x72')](_0x98bc('0x86'),{'UserId':Number(_0x47e4f7[_0x98bc('0x35')][_0x98bc('0x67')]),'FaxQueueId':Number(_0x47e4f7[_0x98bc('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x4fdf54,null))[_0x98bc('0x46')](handleError(_0x4fdf54,null));};exports['getAgents']=function(_0x5b59c7,_0x3f4b53,_0x2eac89){var _0x28d6ef={};var _0x4a9654={};var _0x140f5f;var _0x1ab985;return db[_0x98bc('0x2f')][_0x98bc('0x59')]({'where':{'id':_0x5b59c7[_0x98bc('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f4b53,null))[_0x98bc('0x29')](function(_0x3704e3){if(_0x3704e3){_0x140f5f=_0x3704e3;_0x4a9654[_0x98bc('0x33')]=_[_0x98bc('0x36')](db[_0x98bc('0x5c')][_0x98bc('0x49')]);_0x4a9654[_0x98bc('0x35')]=_[_0x98bc('0x36')](_0x5b59c7[_0x98bc('0x35')]);_0x4a9654[_0x98bc('0x37')]=_[_0x98bc('0x38')](_0x4a9654[_0x98bc('0x33')],_0x4a9654[_0x98bc('0x35')]);_0x28d6ef[_0x98bc('0x3a')]=_[_0x98bc('0x38')](_0x4a9654[_0x98bc('0x33')],qs[_0x98bc('0x39')](_0x5b59c7['query'][_0x98bc('0x39')]));_0x28d6ef[_0x98bc('0x3a')]=_0x28d6ef[_0x98bc('0x3a')][_0x98bc('0x3b')]?_0x28d6ef[_0x98bc('0x3a')]:_0x4a9654[_0x98bc('0x33')];_0x28d6ef[_0x98bc('0x3e')]=qs['sort'](_0x5b59c7['query']['sort']);_0x28d6ef[_0x98bc('0x40')]=qs[_0x98bc('0x37')](_[_0x98bc('0x41')](_0x5b59c7[_0x98bc('0x35')],_0x4a9654[_0x98bc('0x37')]));if(_0x5b59c7['query']['filter']){_0x28d6ef['where']=_[_0x98bc('0x43')](_0x28d6ef[_0x98bc('0x40')],{'$or':_[_0x98bc('0x34')](_0x28d6ef[_0x98bc('0x3a')],function(_0x222e05){var _0xbff339={};_0xbff339[_0x222e05]={'$like':'%'+_0x5b59c7[_0x98bc('0x35')]['filter']+'%'};return _0xbff339;})});}_0x28d6ef=_['merge']({},_0x28d6ef,_0x5b59c7[_0x98bc('0x4c')]);return _0x140f5f[_0x98bc('0x8a')](_0x28d6ef);}})[_0x98bc('0x29')](function(_0x83c52c){if(_0x83c52c){_0x1ab985=_0x83c52c[_0x98bc('0x3b')];if(!_0x5b59c7[_0x98bc('0x35')][_0x98bc('0x3c')]('nolimit')){_0x28d6ef['limit']=qs[_0x98bc('0x21')](_0x5b59c7['query']['limit']);_0x28d6ef['offset']=qs[_0x98bc('0x23')](_0x5b59c7[_0x98bc('0x35')][_0x98bc('0x23')]);}return _0x140f5f[_0x98bc('0x8a')](_0x28d6ef);}})[_0x98bc('0x29')](function(_0x321d7a){if(_0x321d7a){return _0x321d7a?{'count':_0x1ab985,'rows':_0x321d7a}:null;}})[_0x98bc('0x29')](respondWithResult(_0x3f4b53,null))[_0x98bc('0x46')](handleError(_0x3f4b53,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 31e4ff1..b67b5e3 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 _0x0750=['emit','hasOwnProperty','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x0750,0x1c2));var _0x0075=function(_0x48d13b,_0x5496db){_0x48d13b=_0x48d13b-0x0;var _0x2b0a28=_0x0750[_0x48d13b];return _0x2b0a28;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x0075('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0075('0x1')](0x0);var events={'afterCreate':_0x0075('0x2'),'afterUpdate':_0x0075('0x3'),'afterDestroy':_0x0075('0x4')};function emitEvent(_0x3de48f){return function(_0x33583c,_0x59ec8f,_0x57eda5){FaxQueueEvents[_0x0075('0x5')](_0x3de48f+':'+_0x33583c['id'],_0x33583c);FaxQueueEvents[_0x0075('0x5')](_0x3de48f,_0x33583c);_0x57eda5(null);};}for(var e in events){if(events[_0x0075('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x0ad5=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue'];(function(_0x5ee182,_0x54dfd6){var _0x4978bf=function(_0x108a1a){while(--_0x108a1a){_0x5ee182['push'](_0x5ee182['shift']());}};_0x4978bf(++_0x54dfd6);}(_0x0ad5,0x115));var _0x50ad=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0ad5[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x50ad('0x0'));var FaxQueue=require(_0x50ad('0x1'))['db'][_0x50ad('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x50ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x50ad('0x4'),'afterDestroy':_0x50ad('0x5')};function emitEvent(_0x535bcb){return function(_0x5da8f8,_0x3dda0e,_0x437668){FaxQueueEvents[_0x50ad('0x6')](_0x535bcb+':'+_0x5da8f8['id'],_0x5da8f8);FaxQueueEvents[_0x50ad('0x6')](_0x535bcb,_0x5da8f8);_0x437668(null);};}for(var e in events){if(events[_0x50ad('0x7')](e)){var event=events[e];FaxQueue[_0x50ad('0x8')](e,emitEvent(event));}}module[_0x50ad('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 168f505..8e00764 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 _0x3265=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','lodash','util'];(function(_0x40cda4,_0x4ae226){var _0x171b2e=function(_0x1c6eb3){while(--_0x1c6eb3){_0x40cda4['push'](_0x40cda4['shift']());}};_0x171b2e(++_0x4ae226);}(_0x3265,0xce));var _0x5326=function(_0x1a862f,_0x200222){_0x1a862f=_0x1a862f-0x0;var _0x4cccbb=_0x3265[_0x1a862f];return _0x4cccbb;};'use strict';var _=require(_0x5326('0x0'));var util=require(_0x5326('0x1'));var logger=require(_0x5326('0x2'))(_0x5326('0x3'));var moment=require(_0x5326('0x4'));var BPromise=require(_0x5326('0x5'));var rp=require(_0x5326('0x6'));var fs=require('fs');var path=require(_0x5326('0x7'));var rimraf=require(_0x5326('0x8'));var config=require(_0x5326('0x9'));var attributes=require(_0x5326('0xa'));module[_0x5326('0xb')]=function(_0xfea7ac,_0x22a726){return _0xfea7ac['define'](_0x5326('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa5=['fax_queues','lodash','../../config/logger','bluebird','rimraf','../../config/environment','exports','define','FaxQueue'];(function(_0x80a060,_0x38b70f){var _0x3f5c26=function(_0x566d0a){while(--_0x566d0a){_0x80a060['push'](_0x80a060['shift']());}};_0x3f5c26(++_0x38b70f);}(_0xfaa5,0x118));var _0x5faa=function(_0x4e07c6,_0x5d8c10){_0x4e07c6=_0x4e07c6-0x0;var _0x37023e=_0xfaa5[_0x4e07c6];return _0x37023e;};'use strict';var _=require(_0x5faa('0x0'));var util=require('util');var logger=require(_0x5faa('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5faa('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5faa('0x3'));var config=require(_0x5faa('0x4'));var attributes=require('./faxQueue.attributes');module[_0x5faa('0x5')]=function(_0x52eba9,_0x13681e){return _0x52eba9[_0x5faa('0x6')](_0x5faa('0x7'),attributes,{'tableName':_0x5faa('0x8'),'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 ad85cb0..88ab384 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 _0x8641=['ioredis','../../mysqldb','rpc','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','moment','bluebird'];(function(_0x129746,_0x52ad3a){var _0x12d27c=function(_0x32b6ae){while(--_0x32b6ae){_0x129746['push'](_0x129746['shift']());}};_0x12d27c(++_0x52ad3a);}(_0x8641,0xdb));var _0x1864=function(_0x789179,_0x455e5f){_0x789179=_0x789179-0x0;var _0x10878f=_0x8641[_0x789179];return _0x10878f;};'use strict';var _=require(_0x1864('0x0'));var util=require('util');var moment=require(_0x1864('0x1'));var BPromise=require(_0x1864('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1864('0x3'));var db=require(_0x1864('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1864('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1864('0x6')]({'port':0x232a});config['redis']=_[_0x1864('0x7')](config[_0x1864('0x8')],{'host':_0x1864('0x9'),'port':0x18eb});var socket=require(_0x1864('0xa'))(new Redis(config[_0x1864('0x8')]));require(_0x1864('0xb'))[_0x1864('0xc')](socket);function respondWithRpcPromise(_0x1cf8c4,_0x240177,_0x6ed6f6){return new BPromise(function(_0x5b400b,_0x2eb16d){return client[_0x1864('0xd')](_0x1cf8c4,_0x6ed6f6)[_0x1864('0xe')](function(_0x38b44a){logger['info'](_0x1864('0xf'),_0x240177,_0x1864('0x10'));logger[_0x1864('0x11')](_0x1864('0x12'),_0x240177,_0x1864('0x10'),JSON[_0x1864('0x13')](_0x38b44a));if(_0x38b44a[_0x1864('0x14')]){if(_0x38b44a[_0x1864('0x14')][_0x1864('0x15')]===0x1f4){logger[_0x1864('0x14')](_0x1864('0xf'),_0x240177,_0x38b44a[_0x1864('0x14')]['message']);return _0x2eb16d(_0x38b44a[_0x1864('0x14')][_0x1864('0x16')]);}logger['error'](_0x1864('0xf'),_0x240177,_0x38b44a[_0x1864('0x14')]['message']);return _0x5b400b(_0x38b44a[_0x1864('0x14')][_0x1864('0x16')]);}else{logger[_0x1864('0x17')](_0x1864('0xf'),_0x240177,_0x1864('0x10'));_0x5b400b(_0x38b44a[_0x1864('0x18')]['message']);}})[_0x1864('0x19')](function(_0x1dbede){logger[_0x1864('0x14')]('FaxQueue,\x20%s,\x20%s',_0x240177,_0x1dbede);_0x2eb16d(_0x1dbede);});});}exports[_0x1864('0x1a')]=function(_0x5e5b6f){var _0x241fa1=this;return new Promise(function(_0xe3d59f,_0x47b900){return db['FaxQueue']['findAll']({'raw':_0x5e5b6f[_0x1864('0x1b')]?_0x5e5b6f[_0x1864('0x1b')][_0x1864('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e5b6f[_0x1864('0x1b')]?_0x5e5b6f[_0x1864('0x1b')][_0x1864('0x1d')]||null:null,'attributes':_0x5e5b6f[_0x1864('0x1b')]?_0x5e5b6f['options'][_0x1864('0x1e')]||null:null,'limit':_0x5e5b6f[_0x1864('0x1b')]?_0x5e5b6f['options'][_0x1864('0x1f')]||null:null,'include':_0x5e5b6f[_0x1864('0x1b')]?_0x5e5b6f[_0x1864('0x1b')][_0x1864('0x20')]?_[_0x1864('0x21')](_0x5e5b6f[_0x1864('0x1b')][_0x1864('0x20')],function(_0xa1fb4d){return{'model':db[_0xa1fb4d['model']],'as':_0xa1fb4d['as'],'attributes':_0xa1fb4d[_0x1864('0x1e')],'include':_0xa1fb4d[_0x1864('0x20')]?_[_0x1864('0x21')](_0xa1fb4d[_0x1864('0x20')],function(_0x7ea95d){return{'model':db[_0x7ea95d[_0x1864('0x22')]],'as':_0x7ea95d['as'],'attributes':_0x7ea95d[_0x1864('0x1e')],'include':_0x7ea95d['include']?_[_0x1864('0x21')](_0x7ea95d[_0x1864('0x20')],function(_0x3e72b7){return{'model':db[_0x3e72b7[_0x1864('0x22')]],'as':_0x3e72b7['as'],'attributes':_0x3e72b7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11b58b){logger[_0x1864('0x17')]('GetFaxQueue',_0x5e5b6f);logger[_0x1864('0x11')](_0x1864('0x1a'),_0x5e5b6f,JSON['stringify'](_0x11b58b));_0xe3d59f(_0x11b58b);})[_0x1864('0x19')](function(_0x33158e){logger['error']('GetFaxQueue',_0x33158e[_0x1864('0x16')],_0x5e5b6f);_0x47b900(_0x241fa1['error'](0x1f4,_0x33158e['message']));});});};exports[_0x1864('0x23')]=function(_0x411311){var _0x477b4c=this;return new Promise(function(_0x1f764d,_0x44ca35){return db['FaxQueue'][_0x1864('0x24')]({'raw':_0x411311['options']?_0x411311['options'][_0x1864('0x1c')]===undefined?!![]:![]:!![],'where':_0x411311[_0x1864('0x1b')]?_0x411311[_0x1864('0x1b')][_0x1864('0x1d')]||null:null,'attributes':_0x411311[_0x1864('0x1b')]?_0x411311[_0x1864('0x1b')]['attributes']||null:null,'include':_0x411311['options']?_0x411311[_0x1864('0x1b')]['include']?_[_0x1864('0x21')](_0x411311[_0x1864('0x1b')]['include'],function(_0x4443d6){return{'model':db[_0x4443d6['model']],'as':_0x4443d6['as'],'attributes':_0x4443d6[_0x1864('0x1e')],'include':_0x4443d6[_0x1864('0x20')]?_[_0x1864('0x21')](_0x4443d6[_0x1864('0x20')],function(_0x5e7515){return{'model':db[_0x5e7515[_0x1864('0x22')]],'as':_0x5e7515['as'],'attributes':_0x5e7515[_0x1864('0x1e')],'include':_0x5e7515['include']?_['map'](_0x5e7515[_0x1864('0x20')],function(_0x38a3db){return{'model':db[_0x38a3db[_0x1864('0x22')]],'as':_0x38a3db['as'],'attributes':_0x38a3db[_0x1864('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1864('0xe')](function(_0x4e0d3f){logger['info'](_0x1864('0x23'),_0x411311);logger[_0x1864('0x11')](_0x1864('0x23'),_0x411311,JSON[_0x1864('0x13')](_0x4e0d3f));_0x1f764d(_0x4e0d3f);})['catch'](function(_0x4547d9){logger[_0x1864('0x14')](_0x1864('0x23'),_0x4547d9['message'],_0x411311);_0x44ca35(_0x477b4c['error'](0x1f4,_0x4547d9['message']));});});}; \ No newline at end of file +var _0xf7bc=['socket.io-emitter','./faxQueue.socket','register','then','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','info','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','redis'];(function(_0x1da136,_0x20e2c1){var _0x2f25ed=function(_0x3da43a){while(--_0x3da43a){_0x1da136['push'](_0x1da136['shift']());}};_0x2f25ed(++_0x20e2c1);}(_0xf7bc,0x171));var _0xcf7b=function(_0x2bcd95,_0x3390ae){_0x2bcd95=_0x2bcd95-0x0;var _0x24b032=_0xf7bc[_0x2bcd95];return _0x24b032;};'use strict';var _=require(_0xcf7b('0x0'));var util=require(_0xcf7b('0x1'));var moment=require(_0xcf7b('0x2'));var BPromise=require(_0xcf7b('0x3'));var rs=require(_0xcf7b('0x4'));var fs=require('fs');var Redis=require(_0xcf7b('0x5'));var db=require(_0xcf7b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf7b('0x7'));var config=require('../../config/environment');var jayson=require(_0xcf7b('0x8'));var client=jayson['client'][_0xcf7b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcf7b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf7b('0xb'))(new Redis(config['redis']));require(_0xcf7b('0xc'))[_0xcf7b('0xd')](socket);function respondWithRpcPromise(_0x561dd5,_0x485a8d,_0x151193){return new BPromise(function(_0x55d685,_0x381e1d){return client['request'](_0x561dd5,_0x151193)[_0xcf7b('0xe')](function(_0x313261){logger['info']('FaxQueue,\x20%s,\x20%s',_0x485a8d,'request\x20sent');logger[_0xcf7b('0xf')](_0xcf7b('0x10'),_0x485a8d,_0xcf7b('0x11'),JSON[_0xcf7b('0x12')](_0x313261));if(_0x313261['error']){if(_0x313261[_0xcf7b('0x13')][_0xcf7b('0x14')]===0x1f4){logger[_0xcf7b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x485a8d,_0x313261[_0xcf7b('0x13')][_0xcf7b('0x15')]);return _0x381e1d(_0x313261[_0xcf7b('0x13')][_0xcf7b('0x15')]);}logger[_0xcf7b('0x13')](_0xcf7b('0x16'),_0x485a8d,_0x313261[_0xcf7b('0x13')]['message']);return _0x55d685(_0x313261['error'][_0xcf7b('0x15')]);}else{logger[_0xcf7b('0x17')](_0xcf7b('0x16'),_0x485a8d,_0xcf7b('0x11'));_0x55d685(_0x313261['result'][_0xcf7b('0x15')]);}})[_0xcf7b('0x18')](function(_0x588ee5){logger[_0xcf7b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x485a8d,_0x588ee5);_0x381e1d(_0x588ee5);});});}exports[_0xcf7b('0x19')]=function(_0x1f95a1){var _0x48a214=this;return new Promise(function(_0x6ad09e,_0x4f13dc){return db['FaxQueue'][_0xcf7b('0x1a')]({'raw':_0x1f95a1[_0xcf7b('0x1b')]?_0x1f95a1[_0xcf7b('0x1b')][_0xcf7b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f95a1[_0xcf7b('0x1b')]?_0x1f95a1[_0xcf7b('0x1b')][_0xcf7b('0x1d')]||null:null,'attributes':_0x1f95a1['options']?_0x1f95a1['options'][_0xcf7b('0x1e')]||null:null,'limit':_0x1f95a1[_0xcf7b('0x1b')]?_0x1f95a1['options'][_0xcf7b('0x1f')]||null:null,'include':_0x1f95a1[_0xcf7b('0x1b')]?_0x1f95a1[_0xcf7b('0x1b')][_0xcf7b('0x20')]?_[_0xcf7b('0x21')](_0x1f95a1[_0xcf7b('0x1b')][_0xcf7b('0x20')],function(_0x22a7b4){return{'model':db[_0x22a7b4['model']],'as':_0x22a7b4['as'],'attributes':_0x22a7b4[_0xcf7b('0x1e')],'include':_0x22a7b4[_0xcf7b('0x20')]?_[_0xcf7b('0x21')](_0x22a7b4[_0xcf7b('0x20')],function(_0x3f003f){return{'model':db[_0x3f003f[_0xcf7b('0x22')]],'as':_0x3f003f['as'],'attributes':_0x3f003f[_0xcf7b('0x1e')],'include':_0x3f003f[_0xcf7b('0x20')]?_[_0xcf7b('0x21')](_0x3f003f['include'],function(_0x30a058){return{'model':db[_0x30a058[_0xcf7b('0x22')]],'as':_0x30a058['as'],'attributes':_0x30a058[_0xcf7b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcf7b('0xe')](function(_0x4c2cac){logger[_0xcf7b('0x17')](_0xcf7b('0x19'),_0x1f95a1);logger[_0xcf7b('0xf')](_0xcf7b('0x19'),_0x1f95a1,JSON['stringify'](_0x4c2cac));_0x6ad09e(_0x4c2cac);})['catch'](function(_0x28989e){logger[_0xcf7b('0x13')]('GetFaxQueue',_0x28989e[_0xcf7b('0x15')],_0x1f95a1);_0x4f13dc(_0x48a214[_0xcf7b('0x13')](0x1f4,_0x28989e[_0xcf7b('0x15')]));});});};exports[_0xcf7b('0x23')]=function(_0x4c5aee){var _0x5021c6=this;return new Promise(function(_0x174050,_0x454796){return db[_0xcf7b('0x24')][_0xcf7b('0x25')]({'raw':_0x4c5aee[_0xcf7b('0x1b')]?_0x4c5aee['options'][_0xcf7b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c5aee['options']?_0x4c5aee[_0xcf7b('0x1b')][_0xcf7b('0x1d')]||null:null,'attributes':_0x4c5aee[_0xcf7b('0x1b')]?_0x4c5aee['options'][_0xcf7b('0x1e')]||null:null,'include':_0x4c5aee[_0xcf7b('0x1b')]?_0x4c5aee[_0xcf7b('0x1b')][_0xcf7b('0x20')]?_[_0xcf7b('0x21')](_0x4c5aee[_0xcf7b('0x1b')]['include'],function(_0x3b5314){return{'model':db[_0x3b5314['model']],'as':_0x3b5314['as'],'attributes':_0x3b5314[_0xcf7b('0x1e')],'include':_0x3b5314[_0xcf7b('0x20')]?_[_0xcf7b('0x21')](_0x3b5314[_0xcf7b('0x20')],function(_0x296501){return{'model':db[_0x296501[_0xcf7b('0x22')]],'as':_0x296501['as'],'attributes':_0x296501[_0xcf7b('0x1e')],'include':_0x296501[_0xcf7b('0x20')]?_[_0xcf7b('0x21')](_0x296501['include'],function(_0x149c61){return{'model':db[_0x149c61[_0xcf7b('0x22')]],'as':_0x149c61['as'],'attributes':_0x149c61['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x369981){logger[_0xcf7b('0x17')]('ShowFaxQueue',_0x4c5aee);logger[_0xcf7b('0xf')](_0xcf7b('0x23'),_0x4c5aee,JSON[_0xcf7b('0x12')](_0x369981));_0x174050(_0x369981);})[_0xcf7b('0x18')](function(_0x318e3b){logger['error'](_0xcf7b('0x23'),_0x318e3b['message'],_0x4c5aee);_0x454796(_0x5021c6[_0xcf7b('0x13')](0x1f4,_0x318e3b[_0xcf7b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0a24d39..e416ede 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 _0x2635=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2635,0x148));var _0x5263=function(_0x10994f,_0x121abb){_0x10994f=_0x10994f-0x0;var _0x15bea3=_0x2635[_0x10994f];return _0x15bea3;};'use strict';var FaxQueueEvents=require(_0x5263('0x0'));var events=[_0x5263('0x1'),_0x5263('0x2'),_0x5263('0x3')];function createListener(_0xbb834d,_0x3a698a){return function(_0x44d7c6){_0x3a698a[_0x5263('0x4')](_0xbb834d,_0x44d7c6);};}function removeListener(_0x5840c8,_0x16ca1d){return function(){FaxQueueEvents[_0x5263('0x5')](_0x5840c8,_0x16ca1d);};}exports[_0x5263('0x6')]=function(_0x2afee5){for(var _0x2edd24=0x0,_0x789367=events[_0x5263('0x7')];_0x2edd24<_0x789367;_0x2edd24++){var _0x223325=events[_0x2edd24];var _0x264c23=createListener(_0x5263('0x8')+_0x223325,_0x2afee5);FaxQueueEvents['on'](_0x223325,_0x264c23);}}; \ No newline at end of file +var _0x27a8=['removeListener','register','length','faxQueue:','remove','update','emit'];(function(_0x5f3410,_0x1a7958){var _0x43e2db=function(_0x405e09){while(--_0x405e09){_0x5f3410['push'](_0x5f3410['shift']());}};_0x43e2db(++_0x1a7958);}(_0x27a8,0x170));var _0x827a=function(_0x518b99,_0x2052aa){_0x518b99=_0x518b99-0x0;var _0x58cc7a=_0x27a8[_0x518b99];return _0x58cc7a;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x827a('0x0'),_0x827a('0x1')];function createListener(_0x7dc5a2,_0xbd0964){return function(_0x252d74){_0xbd0964[_0x827a('0x2')](_0x7dc5a2,_0x252d74);};}function removeListener(_0x18cf5e,_0x215b35){return function(){FaxQueueEvents[_0x827a('0x3')](_0x18cf5e,_0x215b35);};}exports[_0x827a('0x4')]=function(_0x19d10d){for(var _0x61767e=0x0,_0xa0df3c=events[_0x827a('0x5')];_0x61767e<_0xa0df3c;_0x61767e++){var _0x2e20da=events[_0x61767e];var _0x2bd7f3=createListener(_0x827a('0x6')+_0x2e20da,_0x19d10d);FaxQueueEvents['on'](_0x2e20da,_0x2bd7f3);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 3dfcd58..10f75a7 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 _0xd117=['/:id/teams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd117,0x182));var _0x7d11=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0xd117[_0x57928b];return _0x49aad6;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/teams',auth[_0x7d11('0xc')](),controller['getTeams']);router['get'](_0x7d11('0x14'),auth['isAuthenticated'](),controller[_0x7d11('0x15')]);router[_0x7d11('0x16')]('/',auth['isAuthenticated'](),controller[_0x7d11('0x17')]);router[_0x7d11('0x16')]('/:id/teams',auth[_0x7d11('0xc')](),controller[_0x7d11('0x18')]);router[_0x7d11('0x16')](_0x7d11('0x14'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x19')]);router[_0x7d11('0x1a')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x1b')]);router[_0x7d11('0x1c')](_0x7d11('0x10'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1d')]);router['delete'](_0x7d11('0x1e'),auth[_0x7d11('0xc')](),controller['removeTeams']);router['delete'](_0x7d11('0x14'),auth['isAuthenticated'](),controller[_0x7d11('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xf69c=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','removeTeams','delete','removeAgents','exports','multer'];(function(_0x16957e,_0x45dfac){var _0xfc1da5=function(_0x151fa1){while(--_0x151fa1){_0x16957e['push'](_0x16957e['shift']());}};_0xfc1da5(++_0x45dfac);}(_0xf69c,0x151));var _0xcf69=function(_0x46647b,_0x4e8678){_0x46647b=_0x46647b-0x0;var _0x2bef5d=_0xf69c[_0x46647b];return _0x2bef5d;};'use strict';var multer=require(_0xcf69('0x0'));var util=require('util');var path=require(_0xcf69('0x1'));var timeout=require(_0xcf69('0x2'));var express=require('express');var router=express[_0xcf69('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcf69('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf69('0x5'));var controller=require('./faxQueue.controller');router[_0xcf69('0x6')]('/',auth[_0xcf69('0x7')](),controller[_0xcf69('0x8')]);router[_0xcf69('0x6')](_0xcf69('0x9'),auth['isAuthenticated'](),controller[_0xcf69('0xa')]);router[_0xcf69('0x6')](_0xcf69('0xb'),auth[_0xcf69('0x7')](),controller['show']);router[_0xcf69('0x6')](_0xcf69('0xc'),auth[_0xcf69('0x7')](),controller[_0xcf69('0xd')]);router[_0xcf69('0x6')](_0xcf69('0xe'),auth['isAuthenticated'](),controller[_0xcf69('0xf')]);router['get'](_0xcf69('0x10'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x11')]);router[_0xcf69('0x12')]('/',auth[_0xcf69('0x7')](),controller[_0xcf69('0x13')]);router[_0xcf69('0x12')](_0xcf69('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xcf69('0x7')](),controller['addAgents']);router[_0xcf69('0x14')](_0xcf69('0xb'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x15')]);router['delete'](_0xcf69('0xb'),auth[_0xcf69('0x7')](),controller['destroy']);router['delete'](_0xcf69('0xe'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x16')]);router[_0xcf69('0x17')](_0xcf69('0x10'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x18')]);module[_0xcf69('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3bf53e7..ed4244b 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 _0xe1ea=['STRING','DATE','moment','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe1ea,0x19c));var _0xae1e=function(_0x235b0a,_0x77c405){_0x235b0a=_0x235b0a-0x0;var _0x3f5718=_0xe1ea[_0x235b0a];return _0x3f5718;};'use strict';var moment=require(_0xae1e('0x0'));var Sequelize=require(_0xae1e('0x1'));module[_0xae1e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xae1e('0x3')]},'joinAt':{'type':Sequelize[_0xae1e('0x4')]},'leaveAt':{'type':Sequelize[_0xae1e('0x4')]},'acceptAt':{'type':Sequelize[_0xae1e('0x4')]},'exitAt':{'type':Sequelize[_0xae1e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb9c6=['STRING','DATE','moment','sequelize','exports'];(function(_0x12749c,_0x3e1320){var _0x5812e3=function(_0x45a224){while(--_0x45a224){_0x12749c['push'](_0x12749c['shift']());}};_0x5812e3(++_0x3e1320);}(_0xb9c6,0x1d8));var _0x6b9c=function(_0x22e832,_0x3086d6){_0x22e832=_0x22e832-0x0;var _0x411511=_0xb9c6[_0x22e832];return _0x411511;};'use strict';var moment=require(_0x6b9c('0x0'));var Sequelize=require(_0x6b9c('0x1'));module[_0x6b9c('0x2')]={'uniqueid':{'type':Sequelize[_0x6b9c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6b9c('0x3')]},'joinAt':{'type':Sequelize[_0x6b9c('0x4')]},'leaveAt':{'type':Sequelize[_0x6b9c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6b9c('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c9a4b69..a89ee9b 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 _0x4627=['apply','reject','save','then','end','sendStatus','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','params','length','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','Content-Range','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4627,0x115));var _0x7462=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x4627[_0x53abe5];return _0xc1c37e;};'use strict';var emlformat=require(_0x7462('0x0'));var rimraf=require(_0x7462('0x1'));var zipdir=require(_0x7462('0x2'));var jsonpatch=require(_0x7462('0x3'));var rp=require(_0x7462('0x4'));var moment=require(_0x7462('0x5'));var BPromise=require(_0x7462('0x6'));var Mustache=require(_0x7462('0x7'));var util=require(_0x7462('0x8'));var path=require(_0x7462('0x9'));var sox=require(_0x7462('0xa'));var csv=require(_0x7462('0xb'));var ejs=require(_0x7462('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7462('0xd'));var squel=require(_0x7462('0xe'));var crypto=require(_0x7462('0xf'));var jsforce=require(_0x7462('0x10'));var deskjs=require(_0x7462('0x11'));var toCsv=require(_0x7462('0xb'));var querystring=require(_0x7462('0x12'));var Papa=require(_0x7462('0x13'));var Redis=require(_0x7462('0x14'));var authService=require(_0x7462('0x15'));var qs=require(_0x7462('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7462('0x17'))(_0x7462('0x18'));var utils=require(_0x7462('0x19'));var config=require(_0x7462('0x1a'));var licenseUtil=require(_0x7462('0x1b'));var db=require(_0x7462('0x1c'))['db'];function respondWithStatusCode(_0x31bf84,_0x4e313a){_0x4e313a=_0x4e313a||0xcc;return function(_0x5cb363){if(_0x5cb363){return _0x31bf84['sendStatus'](_0x4e313a);}return _0x31bf84[_0x7462('0x1d')](_0x4e313a)['end']();};}function respondWithResult(_0x1ba7e5,_0x461bd2){_0x461bd2=_0x461bd2||0xc8;return function(_0x368f45){if(_0x368f45){return _0x1ba7e5[_0x7462('0x1d')](_0x461bd2)['json'](_0x368f45);}};}function respondWithFilteredResult(_0x27b8f5,_0x4913ff){return function(_0x36b008){if(_0x36b008){var _0x42ed50=typeof _0x4913ff[_0x7462('0x1e')]===_0x7462('0x1f')&&typeof _0x4913ff['limit']===_0x7462('0x1f');var _0x56ed70=_0x36b008[_0x7462('0x20')];var _0x216eba=_0x42ed50?0x0:_0x4913ff[_0x7462('0x1e')];var _0x26e25f=_0x42ed50?_0x36b008['count']:_0x4913ff[_0x7462('0x1e')]+_0x4913ff['limit'];var _0x85341c;if(_0x26e25f>=_0x56ed70){_0x26e25f=_0x56ed70;_0x85341c=0xc8;}else{_0x85341c=0xce;}_0x27b8f5[_0x7462('0x1d')](_0x85341c);return _0x27b8f5['set'](_0x7462('0x21'),_0x216eba+'-'+_0x26e25f+'/'+_0x56ed70)[_0x7462('0x22')](_0x36b008);}return null;};}function patchUpdates(_0x4d0e60){return function(_0x25a44a){try{jsonpatch[_0x7462('0x23')](_0x25a44a,_0x4d0e60,!![]);}catch(_0x2e9a25){return BPromise[_0x7462('0x24')](_0x2e9a25);}return _0x25a44a[_0x7462('0x25')]();};}function saveUpdates(_0x4404eb,_0x32da06){return function(_0x3c9616){if(_0x3c9616){return _0x3c9616['update'](_0x4404eb)[_0x7462('0x26')](function(_0x52460e){return _0x52460e;});}return null;};}function removeEntity(_0x185934,_0x11caf5){return function(_0x290715){if(_0x290715){return _0x290715['destroy']()[_0x7462('0x26')](function(){_0x185934['status'](0xcc)[_0x7462('0x27')]();});}};}function handleEntityNotFound(_0x5473d1,_0x5759fa){return function(_0x29992b){if(!_0x29992b){_0x5473d1[_0x7462('0x28')](0x194);}return _0x29992b;};}function handleError(_0x51d9d9,_0x5575fc){_0x5575fc=_0x5575fc||0x1f4;return function(_0x554d21){logger['error'](_0x554d21['stack']);if(_0x554d21[_0x7462('0x29')]){delete _0x554d21[_0x7462('0x29')];}_0x51d9d9['status'](_0x5575fc)[_0x7462('0x2a')](_0x554d21);};}exports[_0x7462('0x2b')]=function(_0x3a3313,_0x10a673){var _0x4948c9={},_0x1f279b={},_0x3523c={'count':0x0,'rows':[]};var _0x30cb61=_[_0x7462('0x2c')](db[_0x7462('0x2d')][_0x7462('0x2e')],function(_0x1136e7){return{'name':_0x1136e7[_0x7462('0x2f')],'type':_0x1136e7[_0x7462('0x30')][_0x7462('0x31')]};});_0x1f279b['model']=_[_0x7462('0x2c')](_0x30cb61,'name');_0x1f279b[_0x7462('0x32')]=_[_0x7462('0x33')](_0x3a3313[_0x7462('0x32')]);_0x1f279b[_0x7462('0x34')]=_['intersection'](_0x1f279b[_0x7462('0x35')],_0x1f279b[_0x7462('0x32')]);_0x4948c9[_0x7462('0x36')]=_[_0x7462('0x37')](_0x1f279b[_0x7462('0x35')],qs[_0x7462('0x38')](_0x3a3313['query'][_0x7462('0x38')]));_0x4948c9['attributes']=_0x4948c9[_0x7462('0x36')]['length']?_0x4948c9[_0x7462('0x36')]:_0x1f279b[_0x7462('0x35')];if(!_0x3a3313['query'][_0x7462('0x39')](_0x7462('0x3a'))){_0x4948c9[_0x7462('0x3b')]=qs[_0x7462('0x3b')](_0x3a3313[_0x7462('0x32')][_0x7462('0x3b')]);_0x4948c9[_0x7462('0x1e')]=qs[_0x7462('0x1e')](_0x3a3313[_0x7462('0x32')][_0x7462('0x1e')]);}_0x4948c9[_0x7462('0x3c')]=qs[_0x7462('0x3d')](_0x3a3313[_0x7462('0x32')][_0x7462('0x3d')]);_0x4948c9['where']=qs[_0x7462('0x34')](_[_0x7462('0x3e')](_0x3a3313[_0x7462('0x32')],_0x1f279b[_0x7462('0x34')]),_0x30cb61);if(_0x3a3313['query'][_0x7462('0x3f')]){_0x4948c9[_0x7462('0x40')]=_[_0x7462('0x41')](_0x4948c9[_0x7462('0x40')],{'$or':_[_0x7462('0x2c')](_0x30cb61,function(_0x235075){if(_0x235075['type']!==_0x7462('0x42')){var _0x11192a={};_0x11192a[_0x235075[_0x7462('0x29')]]={'$like':'%'+_0x3a3313[_0x7462('0x32')]['filter']+'%'};return _0x11192a;}})});}_0x4948c9=_[_0x7462('0x41')]({},_0x4948c9,_0x3a3313[_0x7462('0x43')]);var _0x2ceb2c={'where':_0x4948c9['where']};return db[_0x7462('0x2d')][_0x7462('0x20')](_0x2ceb2c)[_0x7462('0x26')](function(_0x592df3){_0x3523c[_0x7462('0x20')]=_0x592df3;if(_0x3a3313['query'][_0x7462('0x44')]){_0x4948c9['include']=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4948c9);})[_0x7462('0x26')](function(_0x128029){_0x3523c[_0x7462('0x45')]=_0x128029;return _0x3523c;})['then'](respondWithFilteredResult(_0x10a673,_0x4948c9))['catch'](handleError(_0x10a673,null));};exports['show']=function(_0x3baf7a,_0x8aa7cd){var _0x57e0ae={'raw':!![],'where':{'id':_0x3baf7a[_0x7462('0x46')]['id']}},_0x5e50c7={};_0x5e50c7[_0x7462('0x35')]=_[_0x7462('0x33')](db[_0x7462('0x2d')]['rawAttributes']);_0x5e50c7['query']=_[_0x7462('0x33')](_0x3baf7a[_0x7462('0x32')]);_0x5e50c7[_0x7462('0x34')]=_[_0x7462('0x37')](_0x5e50c7['model'],_0x5e50c7[_0x7462('0x32')]);_0x57e0ae[_0x7462('0x36')]=_[_0x7462('0x37')](_0x5e50c7['model'],qs[_0x7462('0x38')](_0x3baf7a['query'][_0x7462('0x38')]));_0x57e0ae['attributes']=_0x57e0ae['attributes'][_0x7462('0x47')]?_0x57e0ae[_0x7462('0x36')]:_0x5e50c7[_0x7462('0x35')];if(_0x3baf7a[_0x7462('0x32')][_0x7462('0x44')]){_0x57e0ae[_0x7462('0x48')]=[{'all':!![]}];}_0x57e0ae=_[_0x7462('0x41')]({},_0x57e0ae,_0x3baf7a[_0x7462('0x43')]);return db[_0x7462('0x2d')]['find'](_0x57e0ae)['then'](handleEntityNotFound(_0x8aa7cd,null))[_0x7462('0x26')](respondWithResult(_0x8aa7cd,null))['catch'](handleError(_0x8aa7cd,null));};exports[_0x7462('0x49')]=function(_0x53ddd2,_0x331459){return db[_0x7462('0x2d')][_0x7462('0x49')](_0x53ddd2[_0x7462('0x4a')],{})[_0x7462('0x26')](respondWithResult(_0x331459,0xc9))['catch'](handleError(_0x331459,null));};exports['update']=function(_0xe71f4d,_0x37fc97){if(_0xe71f4d[_0x7462('0x4a')]['id']){delete _0xe71f4d[_0x7462('0x4a')]['id'];}return db[_0x7462('0x2d')][_0x7462('0x4b')]({'where':{'id':_0xe71f4d['params']['id']}})[_0x7462('0x26')](handleEntityNotFound(_0x37fc97,null))[_0x7462('0x26')](saveUpdates(_0xe71f4d[_0x7462('0x4a')],null))[_0x7462('0x26')](respondWithResult(_0x37fc97,null))['catch'](handleError(_0x37fc97,null));};exports[_0x7462('0x4c')]=function(_0x26fa39,_0x4429da){return db['FaxQueueReport'][_0x7462('0x4b')]({'where':{'id':_0x26fa39['params']['id']}})[_0x7462('0x26')](handleEntityNotFound(_0x4429da,null))[_0x7462('0x26')](removeEntity(_0x4429da,null))['catch'](handleError(_0x4429da,null));};exports['describe']=function(_0x198fdb,_0x3c82fa){return db[_0x7462('0x2d')][_0x7462('0x4d')]()[_0x7462('0x26')](respondWithResult(_0x3c82fa,null))['catch'](handleError(_0x3c82fa,null));}; \ No newline at end of file +var _0x0962=['type','VIRTUAL','options','includeAll','include','findAll','catch','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0xc8c272,_0x27e5b5){var _0x1fed6d=function(_0x341ae1){while(--_0x341ae1){_0xc8c272['push'](_0xc8c272['shift']());}};_0x1fed6d(++_0x27e5b5);}(_0x0962,0x198));var _0x2096=function(_0xa914dd,_0x6252a6){_0xa914dd=_0xa914dd-0x0;var _0x1e13ba=_0x0962[_0xa914dd];return _0x1e13ba;};'use strict';var emlformat=require(_0x2096('0x0'));var rimraf=require(_0x2096('0x1'));var zipdir=require(_0x2096('0x2'));var jsonpatch=require(_0x2096('0x3'));var rp=require('request-promise');var moment=require(_0x2096('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2096('0x5'));var path=require(_0x2096('0x6'));var sox=require(_0x2096('0x7'));var csv=require(_0x2096('0x8'));var ejs=require(_0x2096('0x9'));var fs=require('fs');var fs_extra=require(_0x2096('0xa'));var _=require(_0x2096('0xb'));var squel=require(_0x2096('0xc'));var crypto=require('crypto');var jsforce=require(_0x2096('0xd'));var deskjs=require(_0x2096('0xe'));var toCsv=require(_0x2096('0x8'));var querystring=require(_0x2096('0xf'));var Papa=require(_0x2096('0x10'));var Redis=require(_0x2096('0x11'));var authService=require(_0x2096('0x12'));var qs=require(_0x2096('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2096('0x14'));var logger=require(_0x2096('0x15'))('api');var utils=require(_0x2096('0x16'));var config=require(_0x2096('0x17'));var licenseUtil=require(_0x2096('0x18'));var db=require(_0x2096('0x19'))['db'];function respondWithStatusCode(_0x5d351e,_0x541213){_0x541213=_0x541213||0xcc;return function(_0x404e2b){if(_0x404e2b){return _0x5d351e[_0x2096('0x1a')](_0x541213);}return _0x5d351e[_0x2096('0x1b')](_0x541213)['end']();};}function respondWithResult(_0x14bf54,_0x45b7ec){_0x45b7ec=_0x45b7ec||0xc8;return function(_0x420c57){if(_0x420c57){return _0x14bf54['status'](_0x45b7ec)[_0x2096('0x1c')](_0x420c57);}};}function respondWithFilteredResult(_0x37dcd0,_0x2c6e88){return function(_0x305ada){if(_0x305ada){var _0x5b151a=typeof _0x2c6e88[_0x2096('0x1d')]===_0x2096('0x1e')&&typeof _0x2c6e88[_0x2096('0x1f')]==='undefined';var _0x479ba2=_0x305ada[_0x2096('0x20')];var _0x22c478=_0x5b151a?0x0:_0x2c6e88['offset'];var _0xd7e9e0=_0x5b151a?_0x305ada[_0x2096('0x20')]:_0x2c6e88[_0x2096('0x1d')]+_0x2c6e88['limit'];var _0x2a9f62;if(_0xd7e9e0>=_0x479ba2){_0xd7e9e0=_0x479ba2;_0x2a9f62=0xc8;}else{_0x2a9f62=0xce;}_0x37dcd0['status'](_0x2a9f62);return _0x37dcd0[_0x2096('0x21')](_0x2096('0x22'),_0x22c478+'-'+_0xd7e9e0+'/'+_0x479ba2)[_0x2096('0x1c')](_0x305ada);}return null;};}function patchUpdates(_0x12fe63){return function(_0x3f4d7d){try{jsonpatch[_0x2096('0x23')](_0x3f4d7d,_0x12fe63,!![]);}catch(_0x2125ad){return BPromise[_0x2096('0x24')](_0x2125ad);}return _0x3f4d7d[_0x2096('0x25')]();};}function saveUpdates(_0x58c61c,_0x40f28c){return function(_0x4b74e2){if(_0x4b74e2){return _0x4b74e2[_0x2096('0x26')](_0x58c61c)['then'](function(_0x5dfdd5){return _0x5dfdd5;});}return null;};}function removeEntity(_0x362414,_0x686f15){return function(_0x3c3d9c){if(_0x3c3d9c){return _0x3c3d9c[_0x2096('0x27')]()[_0x2096('0x28')](function(){_0x362414[_0x2096('0x1b')](0xcc)[_0x2096('0x29')]();});}};}function handleEntityNotFound(_0xe72b8a,_0x285ff1){return function(_0x2e2c03){if(!_0x2e2c03){_0xe72b8a[_0x2096('0x1a')](0x194);}return _0x2e2c03;};}function handleError(_0xd70ed4,_0x587afa){_0x587afa=_0x587afa||0x1f4;return function(_0x4a78e7){logger[_0x2096('0x2a')](_0x4a78e7[_0x2096('0x2b')]);if(_0x4a78e7[_0x2096('0x2c')]){delete _0x4a78e7[_0x2096('0x2c')];}_0xd70ed4[_0x2096('0x1b')](_0x587afa)[_0x2096('0x2d')](_0x4a78e7);};}exports[_0x2096('0x2e')]=function(_0x1e980c,_0x73b7b4){var _0x56e019={},_0x1524de={},_0x393ef1={'count':0x0,'rows':[]};var _0x77692b=_[_0x2096('0x2f')](db[_0x2096('0x30')][_0x2096('0x31')],function(_0x1a0ace){return{'name':_0x1a0ace[_0x2096('0x32')],'type':_0x1a0ace['type'][_0x2096('0x33')]};});_0x1524de[_0x2096('0x34')]=_['map'](_0x77692b,_0x2096('0x2c'));_0x1524de[_0x2096('0x35')]=_[_0x2096('0x36')](_0x1e980c[_0x2096('0x35')]);_0x1524de[_0x2096('0x37')]=_[_0x2096('0x38')](_0x1524de[_0x2096('0x34')],_0x1524de[_0x2096('0x35')]);_0x56e019['attributes']=_[_0x2096('0x38')](_0x1524de[_0x2096('0x34')],qs['fields'](_0x1e980c[_0x2096('0x35')]['fields']));_0x56e019['attributes']=_0x56e019[_0x2096('0x39')][_0x2096('0x3a')]?_0x56e019[_0x2096('0x39')]:_0x1524de[_0x2096('0x34')];if(!_0x1e980c['query']['hasOwnProperty'](_0x2096('0x3b'))){_0x56e019[_0x2096('0x1f')]=qs[_0x2096('0x1f')](_0x1e980c[_0x2096('0x35')]['limit']);_0x56e019['offset']=qs[_0x2096('0x1d')](_0x1e980c[_0x2096('0x35')]['offset']);}_0x56e019[_0x2096('0x3c')]=qs[_0x2096('0x3d')](_0x1e980c['query'][_0x2096('0x3d')]);_0x56e019['where']=qs['filters'](_[_0x2096('0x3e')](_0x1e980c['query'],_0x1524de[_0x2096('0x37')]),_0x77692b);if(_0x1e980c['query'][_0x2096('0x3f')]){_0x56e019[_0x2096('0x40')]=_[_0x2096('0x41')](_0x56e019[_0x2096('0x40')],{'$or':_[_0x2096('0x2f')](_0x77692b,function(_0x2f226a){if(_0x2f226a[_0x2096('0x42')]!==_0x2096('0x43')){var _0x1072af={};_0x1072af[_0x2f226a[_0x2096('0x2c')]]={'$like':'%'+_0x1e980c[_0x2096('0x35')][_0x2096('0x3f')]+'%'};return _0x1072af;}})});}_0x56e019=_['merge']({},_0x56e019,_0x1e980c[_0x2096('0x44')]);var _0x4d7ec5={'where':_0x56e019[_0x2096('0x40')]};return db[_0x2096('0x30')][_0x2096('0x20')](_0x4d7ec5)[_0x2096('0x28')](function(_0x3ebe73){_0x393ef1[_0x2096('0x20')]=_0x3ebe73;if(_0x1e980c[_0x2096('0x35')][_0x2096('0x45')]){_0x56e019[_0x2096('0x46')]=[{'all':!![]}];}return db[_0x2096('0x30')][_0x2096('0x47')](_0x56e019);})['then'](function(_0x38efd0){_0x393ef1['rows']=_0x38efd0;return _0x393ef1;})[_0x2096('0x28')](respondWithFilteredResult(_0x73b7b4,_0x56e019))[_0x2096('0x48')](handleError(_0x73b7b4,null));};exports['show']=function(_0x492116,_0x3bd152){var _0x167b97={'raw':!![],'where':{'id':_0x492116[_0x2096('0x49')]['id']}},_0x52b4dc={};_0x52b4dc[_0x2096('0x34')]=_[_0x2096('0x36')](db[_0x2096('0x30')][_0x2096('0x31')]);_0x52b4dc[_0x2096('0x35')]=_['keys'](_0x492116[_0x2096('0x35')]);_0x52b4dc[_0x2096('0x37')]=_[_0x2096('0x38')](_0x52b4dc['model'],_0x52b4dc[_0x2096('0x35')]);_0x167b97[_0x2096('0x39')]=_[_0x2096('0x38')](_0x52b4dc['model'],qs[_0x2096('0x4a')](_0x492116[_0x2096('0x35')]['fields']));_0x167b97[_0x2096('0x39')]=_0x167b97[_0x2096('0x39')][_0x2096('0x3a')]?_0x167b97[_0x2096('0x39')]:_0x52b4dc['model'];if(_0x492116['query'][_0x2096('0x45')]){_0x167b97['include']=[{'all':!![]}];}_0x167b97=_['merge']({},_0x167b97,_0x492116['options']);return db[_0x2096('0x30')][_0x2096('0x4b')](_0x167b97)[_0x2096('0x28')](handleEntityNotFound(_0x3bd152,null))[_0x2096('0x28')](respondWithResult(_0x3bd152,null))['catch'](handleError(_0x3bd152,null));};exports['create']=function(_0x18b972,_0x300e02){return db[_0x2096('0x30')][_0x2096('0x4c')](_0x18b972[_0x2096('0x4d')],{})[_0x2096('0x28')](respondWithResult(_0x300e02,0xc9))['catch'](handleError(_0x300e02,null));};exports['update']=function(_0x1e7dea,_0x2ed29c){if(_0x1e7dea[_0x2096('0x4d')]['id']){delete _0x1e7dea[_0x2096('0x4d')]['id'];}return db[_0x2096('0x30')]['find']({'where':{'id':_0x1e7dea['params']['id']}})[_0x2096('0x28')](handleEntityNotFound(_0x2ed29c,null))[_0x2096('0x28')](saveUpdates(_0x1e7dea['body'],null))[_0x2096('0x28')](respondWithResult(_0x2ed29c,null))[_0x2096('0x48')](handleError(_0x2ed29c,null));};exports[_0x2096('0x27')]=function(_0x58a25d,_0x5e0c64){return db['FaxQueueReport'][_0x2096('0x4b')]({'where':{'id':_0x58a25d[_0x2096('0x49')]['id']}})[_0x2096('0x28')](handleEntityNotFound(_0x5e0c64,null))[_0x2096('0x28')](removeEntity(_0x5e0c64,null))[_0x2096('0x48')](handleError(_0x5e0c64,null));};exports[_0x2096('0x4e')]=function(_0x542915,_0x2aff64){return db[_0x2096('0x30')]['describe']()['then'](respondWithResult(_0x2aff64,null))[_0x2096('0x48')](handleError(_0x2aff64,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c600297..0910389 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x3321d0,_0x524888){var _0x1c8000=function(_0x3e0a81){while(--_0x3e0a81){_0x3321d0['push'](_0x3321d0['shift']());}};_0x1c8000(++_0x524888);}(_0x326f,0xd1));var _0xf326=function(_0x2644ff,_0x42665b){_0x2644ff=_0x2644ff-0x0;var _0x5dea16=_0x326f[_0x2644ff];return _0x5dea16;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x180dda,_0x5904f9){var _0xbf91e4=function(_0x1f8cde){while(--_0x1f8cde){_0x180dda['push'](_0x180dda['shift']());}};_0xbf91e4(++_0x5904f9);}(_0x4975,0x86));var _0x5497=function(_0x4f9441,_0x158d5e){_0x4f9441=_0x4f9441-0x0;var _0x1399a8=_0x4975[_0x4f9441];return _0x1399a8;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index a420db9..9eef650 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 _0x4035=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','body','attributes','limit','UpdateFaxQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2282f5,_0x5b1a2f){var _0x1002d0=function(_0x4eb674){while(--_0x4eb674){_0x2282f5['push'](_0x2282f5['shift']());}};_0x1002d0(++_0x5b1a2f);}(_0x4035,0xbf));var _0x5403=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x4035[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x5403('0x0'));var util=require(_0x5403('0x1'));var moment=require(_0x5403('0x2'));var BPromise=require(_0x5403('0x3'));var rs=require(_0x5403('0x4'));var fs=require('fs');var Redis=require(_0x5403('0x5'));var db=require(_0x5403('0x6'))['db'];var utils=require(_0x5403('0x7'));var logger=require(_0x5403('0x8'))(_0x5403('0x9'));var config=require(_0x5403('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5403('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2103cc,_0x260db8,_0x5e6e6a){return new BPromise(function(_0x46e165,_0x4bc4cb){return client[_0x5403('0xc')](_0x2103cc,_0x5e6e6a)[_0x5403('0xd')](function(_0x1f8475){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x260db8,_0x5403('0xe'));logger[_0x5403('0xf')](_0x5403('0x10'),_0x260db8,_0x5403('0xe'),JSON['stringify'](_0x1f8475));if(_0x1f8475['error']){if(_0x1f8475[_0x5403('0x11')]['code']===0x1f4){logger['error'](_0x5403('0x12'),_0x260db8,_0x1f8475[_0x5403('0x11')][_0x5403('0x13')]);return _0x4bc4cb(_0x1f8475['error']['message']);}logger[_0x5403('0x11')](_0x5403('0x12'),_0x260db8,_0x1f8475[_0x5403('0x11')]['message']);return _0x46e165(_0x1f8475[_0x5403('0x11')]['message']);}else{logger[_0x5403('0x14')](_0x5403('0x12'),_0x260db8,'request\x20sent');_0x46e165(_0x1f8475[_0x5403('0x15')][_0x5403('0x13')]);}})[_0x5403('0x16')](function(_0x92f4bd){logger[_0x5403('0x11')](_0x5403('0x12'),_0x260db8,_0x92f4bd);_0x4bc4cb(_0x92f4bd);});});}exports[_0x5403('0x17')]=function(_0x54aa5b){var _0x31a8d4=this;return new Promise(function(_0x47ba53,_0x41d08e){return db[_0x5403('0x18')][_0x5403('0x19')](_0x54aa5b['body'],{'raw':_0x54aa5b[_0x5403('0x1a')]?_0x54aa5b[_0x5403('0x1a')][_0x5403('0x1b')]===undefined?!![]:![]:!![]})[_0x5403('0xd')](function(_0x464690){logger[_0x5403('0x14')](_0x5403('0x17'),_0x54aa5b);logger[_0x5403('0xf')](_0x5403('0x17'),_0x54aa5b,JSON['stringify'](_0x464690));_0x47ba53(_0x464690);})['catch'](function(_0xbeb615){logger[_0x5403('0x11')](_0x5403('0x17'),_0xbeb615[_0x5403('0x13')],_0x54aa5b);_0x41d08e(_0x31a8d4[_0x5403('0x11')](0x1f4,_0xbeb615[_0x5403('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x1bf02b){var _0x3a7963=this;return new Promise(function(_0x1300f2,_0x341097){return db[_0x5403('0x18')]['update'](_0x1bf02b[_0x5403('0x1c')],{'raw':_0x1bf02b[_0x5403('0x1a')]?_0x1bf02b[_0x5403('0x1a')][_0x5403('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bf02b[_0x5403('0x1a')]?_0x1bf02b[_0x5403('0x1a')]['where']||null:null,'attributes':_0x1bf02b[_0x5403('0x1a')]?_0x1bf02b[_0x5403('0x1a')][_0x5403('0x1d')]||null:null,'limit':_0x1bf02b[_0x5403('0x1a')]?_0x1bf02b[_0x5403('0x1a')][_0x5403('0x1e')]||null:null})[_0x5403('0xd')](function(_0x189e05){logger[_0x5403('0x14')](_0x5403('0x1f'),_0x1bf02b);logger[_0x5403('0xf')](_0x5403('0x1f'),_0x1bf02b,JSON[_0x5403('0x20')](_0x189e05));_0x1300f2(_0x189e05);})[_0x5403('0x16')](function(_0x23ca93){logger[_0x5403('0x11')]('UpdateFaxQueueReport',_0x23ca93['message'],_0x1bf02b);_0x341097(_0x3a7963[_0x5403('0x11')](0x1f4,_0x23ca93[_0x5403('0x13')]));});});}; \ No newline at end of file +var _0xb215=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','body','attributes','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x481812,_0x599a09){var _0xeadbb3=function(_0x48b22e){while(--_0x48b22e){_0x481812['push'](_0x481812['shift']());}};_0xeadbb3(++_0x599a09);}(_0xb215,0x164));var _0x5b21=function(_0x54cb39,_0xe5e781){_0x54cb39=_0x54cb39-0x0;var _0x2194de=_0xb215[_0x54cb39];return _0x2194de;};'use strict';var _=require(_0x5b21('0x0'));var util=require('util');var moment=require(_0x5b21('0x1'));var BPromise=require(_0x5b21('0x2'));var rs=require(_0x5b21('0x3'));var fs=require('fs');var Redis=require(_0x5b21('0x4'));var db=require(_0x5b21('0x5'))['db'];var utils=require(_0x5b21('0x6'));var logger=require(_0x5b21('0x7'))('rpc');var config=require(_0x5b21('0x8'));var jayson=require(_0x5b21('0x9'));var client=jayson[_0x5b21('0xa')][_0x5b21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45c6db,_0x3b9d3c,_0x4b3f99){return new BPromise(function(_0x459a50,_0x5b9c62){return client[_0x5b21('0xc')](_0x45c6db,_0x4b3f99)['then'](function(_0x3acc41){logger[_0x5b21('0xd')](_0x5b21('0xe'),_0x3b9d3c,'request\x20sent');logger[_0x5b21('0xf')](_0x5b21('0x10'),_0x3b9d3c,_0x5b21('0x11'),JSON[_0x5b21('0x12')](_0x3acc41));if(_0x3acc41['error']){if(_0x3acc41[_0x5b21('0x13')][_0x5b21('0x14')]===0x1f4){logger[_0x5b21('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x3b9d3c,_0x3acc41['error']['message']);return _0x5b9c62(_0x3acc41[_0x5b21('0x13')]['message']);}logger[_0x5b21('0x13')](_0x5b21('0xe'),_0x3b9d3c,_0x3acc41[_0x5b21('0x13')][_0x5b21('0x15')]);return _0x459a50(_0x3acc41[_0x5b21('0x13')][_0x5b21('0x15')]);}else{logger[_0x5b21('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x3b9d3c,_0x5b21('0x11'));_0x459a50(_0x3acc41[_0x5b21('0x16')]['message']);}})[_0x5b21('0x17')](function(_0x1c17f2){logger['error'](_0x5b21('0xe'),_0x3b9d3c,_0x1c17f2);_0x5b9c62(_0x1c17f2);});});}exports[_0x5b21('0x18')]=function(_0x54bd7d){var _0x1ebca7=this;return new Promise(function(_0x12d809,_0x105045){return db[_0x5b21('0x19')][_0x5b21('0x1a')](_0x54bd7d['body'],{'raw':_0x54bd7d[_0x5b21('0x1b')]?_0x54bd7d[_0x5b21('0x1b')][_0x5b21('0x1c')]===undefined?!![]:![]:!![]})[_0x5b21('0x1d')](function(_0x16a121){logger['info'](_0x5b21('0x18'),_0x54bd7d);logger[_0x5b21('0xf')](_0x5b21('0x18'),_0x54bd7d,JSON[_0x5b21('0x12')](_0x16a121));_0x12d809(_0x16a121);})['catch'](function(_0x1cef0a){logger[_0x5b21('0x13')](_0x5b21('0x18'),_0x1cef0a[_0x5b21('0x15')],_0x54bd7d);_0x105045(_0x1ebca7['error'](0x1f4,_0x1cef0a[_0x5b21('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0xde8d7f){var _0x35f897=this;return new Promise(function(_0x2c28c2,_0x2d222f){return db[_0x5b21('0x19')]['update'](_0xde8d7f[_0x5b21('0x1e')],{'raw':_0xde8d7f[_0x5b21('0x1b')]?_0xde8d7f[_0x5b21('0x1b')][_0x5b21('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xde8d7f[_0x5b21('0x1b')]?_0xde8d7f[_0x5b21('0x1b')]['where']||null:null,'attributes':_0xde8d7f['options']?_0xde8d7f[_0x5b21('0x1b')][_0x5b21('0x1f')]||null:null,'limit':_0xde8d7f[_0x5b21('0x1b')]?_0xde8d7f[_0x5b21('0x1b')]['limit']||null:null})[_0x5b21('0x1d')](function(_0x2a378a){logger[_0x5b21('0xd')](_0x5b21('0x20'),_0xde8d7f);logger[_0x5b21('0xf')](_0x5b21('0x20'),_0xde8d7f,JSON[_0x5b21('0x12')](_0x2a378a));_0x2c28c2(_0x2a378a);})['catch'](function(_0x50b132){logger[_0x5b21('0x13')](_0x5b21('0x20'),_0x50b132[_0x5b21('0x15')],_0xde8d7f);_0x2d222f(_0x35f897['error'](0x1f4,_0x50b132[_0x5b21('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 00d0d26..9e5f721 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 _0xf001=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x455fea,_0x51f808){var _0x32f39b=function(_0x339cac){while(--_0x339cac){_0x455fea['push'](_0x455fea['shift']());}};_0x32f39b(++_0x51f808);}(_0xf001,0x72));var _0x1f00=function(_0x56260c,_0x3594bc){_0x56260c=_0x56260c-0x0;var _0x3293b9=_0xf001[_0x56260c];return _0x3293b9;};'use strict';var multer=require(_0x1f00('0x0'));var util=require(_0x1f00('0x1'));var path=require(_0x1f00('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f00('0x3'));var router=express[_0x1f00('0x4')]();var fs_extra=require(_0x1f00('0x5'));var auth=require(_0x1f00('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f00('0x7'));var controller=require(_0x1f00('0x8'));router[_0x1f00('0x9')]('/',auth[_0x1f00('0xa')](),controller[_0x1f00('0xb')]);router[_0x1f00('0x9')](_0x1f00('0xc'),auth[_0x1f00('0xa')](),controller[_0x1f00('0xd')]);router[_0x1f00('0x9')](_0x1f00('0xe'),auth[_0x1f00('0xa')](),controller['show']);router[_0x1f00('0xf')]('/',auth[_0x1f00('0xa')](),controller[_0x1f00('0x10')]);router[_0x1f00('0x11')]('/:id',auth[_0x1f00('0xa')](),controller[_0x1f00('0x12')]);router[_0x1f00('0x13')](_0x1f00('0xe'),auth['isAuthenticated'](),controller[_0x1f00('0x14')]);module[_0x1f00('0x15')]=router; \ No newline at end of file +var _0x202e=['/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe'];(function(_0x15ec1a,_0x59dd6f){var _0x52cd20=function(_0x343c98){while(--_0x343c98){_0x15ec1a['push'](_0x15ec1a['shift']());}};_0x52cd20(++_0x59dd6f);}(_0x202e,0xb2));var _0xe202=function(_0x674f83,_0x2b9592){_0x674f83=_0x674f83-0x0;var _0x3a40b1=_0x202e[_0x674f83];return _0x3a40b1;};'use strict';var multer=require(_0xe202('0x0'));var util=require(_0xe202('0x1'));var path=require(_0xe202('0x2'));var timeout=require(_0xe202('0x3'));var express=require(_0xe202('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe202('0x5'));var interaction=require(_0xe202('0x6'));var config=require(_0xe202('0x7'));var controller=require(_0xe202('0x8'));router['get']('/',auth[_0xe202('0x9')](),controller['index']);router[_0xe202('0xa')](_0xe202('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe202('0xa')](_0xe202('0xc'),auth[_0xe202('0x9')](),controller['show']);router[_0xe202('0xd')]('/',auth[_0xe202('0x9')](),controller[_0xe202('0xe')]);router[_0xe202('0xf')](_0xe202('0xc'),auth['isAuthenticated'](),controller[_0xe202('0x10')]);router[_0xe202('0x11')](_0xe202('0xc'),auth[_0xe202('0x9')](),controller['destroy']);module[_0xe202('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 550495a..908d89c 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x264d9b,_0x3b552f){var _0x24a049=function(_0x539739){while(--_0x539739){_0x264d9b['push'](_0x264d9b['shift']());}};_0x24a049(++_0x3b552f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b9652,_0x2de633){_0x4b9652=_0x4b9652-0x0;var _0x539f82=_0xedd9[_0x4b9652];return _0x539f82;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x373c04,_0x4795a4){var _0x5d4178=function(_0x358635){while(--_0x358635){_0x373c04['push'](_0x373c04['shift']());}};_0x5d4178(++_0x4795a4);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x00bb[_0x55f8b4];return _0x2475f9;};'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 1c40779..732c227 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 _0x5670=['merge','VIRTUAL','FaxTransferReport','count','includeAll','include','findAll','catch','keys','options','create','update','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where'];(function(_0x158988,_0x30addd){var _0x2bd5cd=function(_0x15f3b2){while(--_0x15f3b2){_0x158988['push'](_0x158988['shift']());}};_0x2bd5cd(++_0x30addd);}(_0x5670,0x17c));var _0x0567=function(_0x694719,_0x4dc62c){_0x694719=_0x694719-0x0;var _0x393ec6=_0x5670[_0x694719];return _0x393ec6;};'use strict';var emlformat=require(_0x0567('0x0'));var rimraf=require(_0x0567('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0567('0x2'));var rp=require('request-promise');var moment=require(_0x0567('0x3'));var BPromise=require(_0x0567('0x4'));var Mustache=require(_0x0567('0x5'));var util=require(_0x0567('0x6'));var path=require(_0x0567('0x7'));var sox=require(_0x0567('0x8'));var csv=require(_0x0567('0x9'));var ejs=require(_0x0567('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0567('0xb'));var crypto=require(_0x0567('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0567('0xd'));var toCsv=require(_0x0567('0x9'));var querystring=require(_0x0567('0xe'));var Papa=require('papaparse');var Redis=require(_0x0567('0xf'));var authService=require(_0x0567('0x10'));var qs=require(_0x0567('0x11'));var as=require(_0x0567('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0567('0x13'))(_0x0567('0x14'));var utils=require(_0x0567('0x15'));var config=require(_0x0567('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0567('0x17'))['db'];function respondWithStatusCode(_0x36acae,_0x9dfc29){_0x9dfc29=_0x9dfc29||0xcc;return function(_0x3c2b92){if(_0x3c2b92){return _0x36acae[_0x0567('0x18')](_0x9dfc29);}return _0x36acae[_0x0567('0x19')](_0x9dfc29)[_0x0567('0x1a')]();};}function respondWithResult(_0x568af2,_0x370ace){_0x370ace=_0x370ace||0xc8;return function(_0x49aa82){if(_0x49aa82){return _0x568af2[_0x0567('0x19')](_0x370ace)[_0x0567('0x1b')](_0x49aa82);}};}function respondWithFilteredResult(_0xda9891,_0x5c79f3){return function(_0x23c104){if(_0x23c104){var _0x5c08a=typeof _0x5c79f3[_0x0567('0x1c')]===_0x0567('0x1d')&&typeof _0x5c79f3[_0x0567('0x1e')]===_0x0567('0x1d');var _0x258837=_0x23c104['count'];var _0x116f2a=_0x5c08a?0x0:_0x5c79f3['offset'];var _0x36922b=_0x5c08a?_0x23c104['count']:_0x5c79f3[_0x0567('0x1c')]+_0x5c79f3['limit'];var _0x3b59cb;if(_0x36922b>=_0x258837){_0x36922b=_0x258837;_0x3b59cb=0xc8;}else{_0x3b59cb=0xce;}_0xda9891[_0x0567('0x19')](_0x3b59cb);return _0xda9891['set'](_0x0567('0x1f'),_0x116f2a+'-'+_0x36922b+'/'+_0x258837)['json'](_0x23c104);}return null;};}function patchUpdates(_0x1c6ef1){return function(_0x5ac69d){try{jsonpatch[_0x0567('0x20')](_0x5ac69d,_0x1c6ef1,!![]);}catch(_0x1b6d67){return BPromise[_0x0567('0x21')](_0x1b6d67);}return _0x5ac69d[_0x0567('0x22')]();};}function saveUpdates(_0x624317,_0x5d71e1){return function(_0x1df568){if(_0x1df568){return _0x1df568['update'](_0x624317)[_0x0567('0x23')](function(_0x41bf42){return _0x41bf42;});}return null;};}function removeEntity(_0x31c90a,_0x55aef8){return function(_0x3938ab){if(_0x3938ab){return _0x3938ab[_0x0567('0x24')]()[_0x0567('0x23')](function(){_0x31c90a[_0x0567('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a684c,_0x1b0ddf){return function(_0x53d3ca){if(!_0x53d3ca){_0x4a684c[_0x0567('0x18')](0x194);}return _0x53d3ca;};}function handleError(_0x98ff4f,_0xcb7ff3){_0xcb7ff3=_0xcb7ff3||0x1f4;return function(_0x3cf6dc){logger[_0x0567('0x25')](_0x3cf6dc[_0x0567('0x26')]);if(_0x3cf6dc[_0x0567('0x27')]){delete _0x3cf6dc['name'];}_0x98ff4f['status'](_0xcb7ff3)['send'](_0x3cf6dc);};}exports[_0x0567('0x28')]=function(_0xcc9237,_0x25b8d6){var _0x15ffc4={},_0x17b586={},_0x35650c={'count':0x0,'rows':[]};var _0x18bb00=_[_0x0567('0x29')](db['FaxTransferReport'][_0x0567('0x2a')],function(_0x1f33ab){return{'name':_0x1f33ab[_0x0567('0x2b')],'type':_0x1f33ab[_0x0567('0x2c')][_0x0567('0x2d')]};});_0x17b586[_0x0567('0x2e')]=_[_0x0567('0x29')](_0x18bb00,_0x0567('0x27'));_0x17b586[_0x0567('0x2f')]=_['keys'](_0xcc9237[_0x0567('0x2f')]);_0x17b586[_0x0567('0x30')]=_[_0x0567('0x31')](_0x17b586[_0x0567('0x2e')],_0x17b586[_0x0567('0x2f')]);_0x15ffc4['attributes']=_[_0x0567('0x31')](_0x17b586[_0x0567('0x2e')],qs[_0x0567('0x32')](_0xcc9237[_0x0567('0x2f')]['fields']));_0x15ffc4[_0x0567('0x33')]=_0x15ffc4[_0x0567('0x33')][_0x0567('0x34')]?_0x15ffc4[_0x0567('0x33')]:_0x17b586['model'];if(!_0xcc9237[_0x0567('0x2f')][_0x0567('0x35')]('nolimit')){_0x15ffc4[_0x0567('0x1e')]=qs['limit'](_0xcc9237['query'][_0x0567('0x1e')]);_0x15ffc4[_0x0567('0x1c')]=qs['offset'](_0xcc9237[_0x0567('0x2f')][_0x0567('0x1c')]);}_0x15ffc4[_0x0567('0x36')]=qs['sort'](_0xcc9237[_0x0567('0x2f')][_0x0567('0x37')]);_0x15ffc4['where']=qs[_0x0567('0x30')](_['pick'](_0xcc9237[_0x0567('0x2f')],_0x17b586[_0x0567('0x30')]),_0x18bb00);if(_0xcc9237[_0x0567('0x2f')][_0x0567('0x38')]){_0x15ffc4[_0x0567('0x39')]=_[_0x0567('0x3a')](_0x15ffc4[_0x0567('0x39')],{'$or':_[_0x0567('0x29')](_0x18bb00,function(_0xb8c292){if(_0xb8c292[_0x0567('0x2c')]!==_0x0567('0x3b')){var _0x1175ef={};_0x1175ef[_0xb8c292[_0x0567('0x27')]]={'$like':'%'+_0xcc9237[_0x0567('0x2f')][_0x0567('0x38')]+'%'};return _0x1175ef;}})});}_0x15ffc4=_[_0x0567('0x3a')]({},_0x15ffc4,_0xcc9237['options']);var _0x5c2116={'where':_0x15ffc4[_0x0567('0x39')]};return db[_0x0567('0x3c')][_0x0567('0x3d')](_0x5c2116)['then'](function(_0x250eb8){_0x35650c[_0x0567('0x3d')]=_0x250eb8;if(_0xcc9237['query'][_0x0567('0x3e')]){_0x15ffc4[_0x0567('0x3f')]=[{'all':!![]}];}return db[_0x0567('0x3c')][_0x0567('0x40')](_0x15ffc4);})[_0x0567('0x23')](function(_0x1607fb){_0x35650c['rows']=_0x1607fb;return _0x35650c;})['then'](respondWithFilteredResult(_0x25b8d6,_0x15ffc4))[_0x0567('0x41')](handleError(_0x25b8d6,null));};exports['show']=function(_0x3f7a46,_0x3acefb){var _0x87761f={'raw':!![],'where':{'id':_0x3f7a46['params']['id']}},_0x1a2fb9={};_0x1a2fb9[_0x0567('0x2e')]=_[_0x0567('0x42')](db[_0x0567('0x3c')][_0x0567('0x2a')]);_0x1a2fb9['query']=_['keys'](_0x3f7a46['query']);_0x1a2fb9[_0x0567('0x30')]=_[_0x0567('0x31')](_0x1a2fb9['model'],_0x1a2fb9[_0x0567('0x2f')]);_0x87761f[_0x0567('0x33')]=_[_0x0567('0x31')](_0x1a2fb9[_0x0567('0x2e')],qs[_0x0567('0x32')](_0x3f7a46[_0x0567('0x2f')]['fields']));_0x87761f[_0x0567('0x33')]=_0x87761f[_0x0567('0x33')][_0x0567('0x34')]?_0x87761f[_0x0567('0x33')]:_0x1a2fb9[_0x0567('0x2e')];if(_0x3f7a46[_0x0567('0x2f')][_0x0567('0x3e')]){_0x87761f[_0x0567('0x3f')]=[{'all':!![]}];}_0x87761f=_['merge']({},_0x87761f,_0x3f7a46[_0x0567('0x43')]);return db['FaxTransferReport']['find'](_0x87761f)['then'](handleEntityNotFound(_0x3acefb,null))['then'](respondWithResult(_0x3acefb,null))[_0x0567('0x41')](handleError(_0x3acefb,null));};exports[_0x0567('0x44')]=function(_0x4e28e4,_0x291dba){return db[_0x0567('0x3c')][_0x0567('0x44')](_0x4e28e4['body'],{})['then'](respondWithResult(_0x291dba,0xc9))['catch'](handleError(_0x291dba,null));};exports[_0x0567('0x45')]=function(_0x1d1f0e,_0x5042c7){if(_0x1d1f0e[_0x0567('0x46')]['id']){delete _0x1d1f0e[_0x0567('0x46')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x1d1f0e[_0x0567('0x47')]['id']}})[_0x0567('0x23')](handleEntityNotFound(_0x5042c7,null))['then'](saveUpdates(_0x1d1f0e[_0x0567('0x46')],null))[_0x0567('0x23')](respondWithResult(_0x5042c7,null))[_0x0567('0x41')](handleError(_0x5042c7,null));};exports['destroy']=function(_0x21b0ac,_0x396939){return db['FaxTransferReport']['find']({'where':{'id':_0x21b0ac[_0x0567('0x47')]['id']}})[_0x0567('0x23')](handleEntityNotFound(_0x396939,null))['then'](removeEntity(_0x396939,null))[_0x0567('0x41')](handleError(_0x396939,null));};exports[_0x0567('0x48')]=function(_0x7d831d,_0x391bee){return db[_0x0567('0x3c')]['describe']()['then'](respondWithResult(_0x391bee,null))[_0x0567('0x41')](handleError(_0x391bee,null));}; \ No newline at end of file +var _0x194e=['apply','reject','save','destroy','then','status','stack','name','send','index','map','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxTransferReport','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','offset','undefined','limit','count','Content-Range','json'];(function(_0x5e6fe1,_0x8f80ad){var _0x5a6018=function(_0x1f1225){while(--_0x1f1225){_0x5e6fe1['push'](_0x5e6fe1['shift']());}};_0x5a6018(++_0x8f80ad);}(_0x194e,0x17d));var _0xe194=function(_0x311f64,_0x27f526){_0x311f64=_0x311f64-0x0;var _0xa90146=_0x194e[_0x311f64];return _0xa90146;};'use strict';var emlformat=require(_0xe194('0x0'));var rimraf=require(_0xe194('0x1'));var zipdir=require(_0xe194('0x2'));var jsonpatch=require(_0xe194('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe194('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe194('0x5'));var sox=require('sox');var csv=require(_0xe194('0x6'));var ejs=require(_0xe194('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe194('0x8'));var squel=require('squel');var crypto=require(_0xe194('0x9'));var jsforce=require(_0xe194('0xa'));var deskjs=require(_0xe194('0xb'));var toCsv=require(_0xe194('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe194('0xc'));var authService=require(_0xe194('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe194('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe194('0xf'))(_0xe194('0x10'));var utils=require(_0xe194('0x11'));var config=require(_0xe194('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25a704,_0x4e30f5){_0x4e30f5=_0x4e30f5||0xcc;return function(_0x1a7c08){if(_0x1a7c08){return _0x25a704[_0xe194('0x13')](_0x4e30f5);}return _0x25a704['status'](_0x4e30f5)[_0xe194('0x14')]();};}function respondWithResult(_0xbe174f,_0x101ee5){_0x101ee5=_0x101ee5||0xc8;return function(_0x450278){if(_0x450278){return _0xbe174f['status'](_0x101ee5)['json'](_0x450278);}};}function respondWithFilteredResult(_0xad0a9e,_0x51f37b){return function(_0x1dce0a){if(_0x1dce0a){var _0x3929ff=typeof _0x51f37b[_0xe194('0x15')]===_0xe194('0x16')&&typeof _0x51f37b[_0xe194('0x17')]==='undefined';var _0x3e1556=_0x1dce0a[_0xe194('0x18')];var _0x28e31c=_0x3929ff?0x0:_0x51f37b[_0xe194('0x15')];var _0x1d9182=_0x3929ff?_0x1dce0a[_0xe194('0x18')]:_0x51f37b['offset']+_0x51f37b[_0xe194('0x17')];var _0x56bc20;if(_0x1d9182>=_0x3e1556){_0x1d9182=_0x3e1556;_0x56bc20=0xc8;}else{_0x56bc20=0xce;}_0xad0a9e['status'](_0x56bc20);return _0xad0a9e['set'](_0xe194('0x19'),_0x28e31c+'-'+_0x1d9182+'/'+_0x3e1556)[_0xe194('0x1a')](_0x1dce0a);}return null;};}function patchUpdates(_0x210e62){return function(_0x107162){try{jsonpatch[_0xe194('0x1b')](_0x107162,_0x210e62,!![]);}catch(_0x1a4496){return BPromise[_0xe194('0x1c')](_0x1a4496);}return _0x107162[_0xe194('0x1d')]();};}function saveUpdates(_0x4b03bb,_0x51cb1b){return function(_0x490ed5){if(_0x490ed5){return _0x490ed5['update'](_0x4b03bb)['then'](function(_0xc95369){return _0xc95369;});}return null;};}function removeEntity(_0x2ceaf4,_0x4c70fa){return function(_0x276fe8){if(_0x276fe8){return _0x276fe8[_0xe194('0x1e')]()[_0xe194('0x1f')](function(){_0x2ceaf4[_0xe194('0x20')](0xcc)[_0xe194('0x14')]();});}};}function handleEntityNotFound(_0x5cd30d,_0x3eb14a){return function(_0x1152ec){if(!_0x1152ec){_0x5cd30d['sendStatus'](0x194);}return _0x1152ec;};}function handleError(_0x37ab5e,_0x54f9cb){_0x54f9cb=_0x54f9cb||0x1f4;return function(_0x8b3f0a){logger['error'](_0x8b3f0a[_0xe194('0x21')]);if(_0x8b3f0a[_0xe194('0x22')]){delete _0x8b3f0a[_0xe194('0x22')];}_0x37ab5e[_0xe194('0x20')](_0x54f9cb)[_0xe194('0x23')](_0x8b3f0a);};}exports[_0xe194('0x24')]=function(_0x278818,_0x26b85d){var _0x1de627={},_0x4b12ec={},_0x850a88={'count':0x0,'rows':[]};var _0x4bfa0c=_[_0xe194('0x25')](db['FaxTransferReport'][_0xe194('0x26')],function(_0x2fee0f){return{'name':_0x2fee0f['fieldName'],'type':_0x2fee0f[_0xe194('0x27')][_0xe194('0x28')]};});_0x4b12ec['model']=_['map'](_0x4bfa0c,_0xe194('0x22'));_0x4b12ec['query']=_[_0xe194('0x29')](_0x278818[_0xe194('0x2a')]);_0x4b12ec['filters']=_[_0xe194('0x2b')](_0x4b12ec[_0xe194('0x2c')],_0x4b12ec[_0xe194('0x2a')]);_0x1de627['attributes']=_[_0xe194('0x2b')](_0x4b12ec[_0xe194('0x2c')],qs[_0xe194('0x2d')](_0x278818['query'][_0xe194('0x2d')]));_0x1de627[_0xe194('0x2e')]=_0x1de627['attributes']['length']?_0x1de627[_0xe194('0x2e')]:_0x4b12ec['model'];if(!_0x278818['query']['hasOwnProperty'](_0xe194('0x2f'))){_0x1de627[_0xe194('0x17')]=qs[_0xe194('0x17')](_0x278818['query'][_0xe194('0x17')]);_0x1de627[_0xe194('0x15')]=qs[_0xe194('0x15')](_0x278818[_0xe194('0x2a')]['offset']);}_0x1de627[_0xe194('0x30')]=qs[_0xe194('0x31')](_0x278818[_0xe194('0x2a')][_0xe194('0x31')]);_0x1de627[_0xe194('0x32')]=qs[_0xe194('0x33')](_['pick'](_0x278818['query'],_0x4b12ec[_0xe194('0x33')]),_0x4bfa0c);if(_0x278818['query'][_0xe194('0x34')]){_0x1de627[_0xe194('0x32')]=_[_0xe194('0x35')](_0x1de627[_0xe194('0x32')],{'$or':_[_0xe194('0x25')](_0x4bfa0c,function(_0x54ddad){if(_0x54ddad[_0xe194('0x27')]!==_0xe194('0x36')){var _0x2ade17={};_0x2ade17[_0x54ddad[_0xe194('0x22')]]={'$like':'%'+_0x278818[_0xe194('0x2a')][_0xe194('0x34')]+'%'};return _0x2ade17;}})});}_0x1de627=_[_0xe194('0x35')]({},_0x1de627,_0x278818[_0xe194('0x37')]);var _0x4645c0={'where':_0x1de627[_0xe194('0x32')]};return db[_0xe194('0x38')][_0xe194('0x18')](_0x4645c0)[_0xe194('0x1f')](function(_0x911eee){_0x850a88[_0xe194('0x18')]=_0x911eee;if(_0x278818[_0xe194('0x2a')][_0xe194('0x39')]){_0x1de627['include']=[{'all':!![]}];}return db[_0xe194('0x38')][_0xe194('0x3a')](_0x1de627);})['then'](function(_0x483e84){_0x850a88[_0xe194('0x3b')]=_0x483e84;return _0x850a88;})[_0xe194('0x1f')](respondWithFilteredResult(_0x26b85d,_0x1de627))[_0xe194('0x3c')](handleError(_0x26b85d,null));};exports['show']=function(_0x3008cf,_0x1beef0){var _0x56f290={'raw':!![],'where':{'id':_0x3008cf[_0xe194('0x3d')]['id']}},_0x6ec7e0={};_0x6ec7e0[_0xe194('0x2c')]=_[_0xe194('0x29')](db[_0xe194('0x38')]['rawAttributes']);_0x6ec7e0[_0xe194('0x2a')]=_[_0xe194('0x29')](_0x3008cf[_0xe194('0x2a')]);_0x6ec7e0['filters']=_[_0xe194('0x2b')](_0x6ec7e0[_0xe194('0x2c')],_0x6ec7e0[_0xe194('0x2a')]);_0x56f290[_0xe194('0x2e')]=_[_0xe194('0x2b')](_0x6ec7e0[_0xe194('0x2c')],qs[_0xe194('0x2d')](_0x3008cf['query'][_0xe194('0x2d')]));_0x56f290[_0xe194('0x2e')]=_0x56f290[_0xe194('0x2e')][_0xe194('0x3e')]?_0x56f290['attributes']:_0x6ec7e0[_0xe194('0x2c')];if(_0x3008cf['query'][_0xe194('0x39')]){_0x56f290[_0xe194('0x3f')]=[{'all':!![]}];}_0x56f290=_[_0xe194('0x35')]({},_0x56f290,_0x3008cf[_0xe194('0x37')]);return db[_0xe194('0x38')][_0xe194('0x40')](_0x56f290)['then'](handleEntityNotFound(_0x1beef0,null))[_0xe194('0x1f')](respondWithResult(_0x1beef0,null))[_0xe194('0x3c')](handleError(_0x1beef0,null));};exports[_0xe194('0x41')]=function(_0x5bbe18,_0x4dd45f){return db[_0xe194('0x38')][_0xe194('0x41')](_0x5bbe18['body'],{})[_0xe194('0x1f')](respondWithResult(_0x4dd45f,0xc9))['catch'](handleError(_0x4dd45f,null));};exports['update']=function(_0x561bee,_0x4e7c2c){if(_0x561bee[_0xe194('0x42')]['id']){delete _0x561bee['body']['id'];}return db['FaxTransferReport'][_0xe194('0x40')]({'where':{'id':_0x561bee[_0xe194('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4e7c2c,null))[_0xe194('0x1f')](saveUpdates(_0x561bee[_0xe194('0x42')],null))[_0xe194('0x1f')](respondWithResult(_0x4e7c2c,null))['catch'](handleError(_0x4e7c2c,null));};exports['destroy']=function(_0x3949f6,_0x39a0c3){return db[_0xe194('0x38')][_0xe194('0x40')]({'where':{'id':_0x3949f6[_0xe194('0x3d')]['id']}})['then'](handleEntityNotFound(_0x39a0c3,null))['then'](removeEntity(_0x39a0c3,null))[_0xe194('0x3c')](handleError(_0x39a0c3,null));};exports[_0xe194('0x43')]=function(_0x17c18b,_0x18160d){return db[_0xe194('0x38')][_0xe194('0x43')]()[_0xe194('0x1f')](respondWithResult(_0x18160d,null))[_0xe194('0x3c')](handleError(_0x18160d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5efbbbf..4fcc95f 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 _0xa0d5=['uniqueid','util','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa0d5,0xab));var _0x5a0d=function(_0x3b2397,_0x4d52e8){_0x3b2397=_0x3b2397-0x0;var _0x4a81ea=_0xa0d5[_0x3b2397];return _0x4a81ea;};'use strict';var _=require('lodash');var util=require(_0x5a0d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a0d('0x1'));var fs=require('fs');var path=require(_0x5a0d('0x2'));var rimraf=require(_0x5a0d('0x3'));var config=require(_0x5a0d('0x4'));var attributes=require(_0x5a0d('0x5'));module[_0x5a0d('0x6')]=function(_0x4b2028,_0x23cd70){return _0x4b2028['define'](_0x5a0d('0x7'),attributes,{'tableName':_0x5a0d('0x8'),'paranoid':![],'indexes':[{'name':_0x5a0d('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb66=['bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xfb66,0xf7));var _0x6fb6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfb66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x6fb6('0x0'));var util=require(_0x6fb6('0x1'));var logger=require(_0x6fb6('0x2'))(_0x6fb6('0x3'));var moment=require(_0x6fb6('0x4'));var BPromise=require(_0x6fb6('0x5'));var rp=require(_0x6fb6('0x6'));var fs=require('fs');var path=require(_0x6fb6('0x7'));var rimraf=require(_0x6fb6('0x8'));var config=require('../../config/environment');var attributes=require(_0x6fb6('0x9'));module[_0x6fb6('0xa')]=function(_0x1041f5,_0x374f2e){return _0x1041f5[_0x6fb6('0xb')](_0x6fb6('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x6fb6('0xd'),'fields':[_0x6fb6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f4d902d..0684f64 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 _0x0365=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x0365,0x1c7));var _0x5036=function(_0x5ad0e1,_0x2466be){_0x5ad0e1=_0x5ad0e1-0x0;var _0x355c7b=_0x0365[_0x5ad0e1];return _0x355c7b;};'use strict';var _=require(_0x5036('0x0'));var util=require(_0x5036('0x1'));var moment=require(_0x5036('0x2'));var BPromise=require(_0x5036('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5036('0x4'));var db=require(_0x5036('0x5'))['db'];var utils=require(_0x5036('0x6'));var logger=require(_0x5036('0x7'))(_0x5036('0x8'));var config=require(_0x5036('0x9'));var jayson=require(_0x5036('0xa'));var client=jayson[_0x5036('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57151a,_0x11e8a3,_0x487eef){return new BPromise(function(_0xc80444,_0x459901){return client[_0x5036('0xc')](_0x57151a,_0x487eef)[_0x5036('0xd')](function(_0x299a1b){logger[_0x5036('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x11e8a3,_0x5036('0xf'));logger['debug'](_0x5036('0x10'),_0x11e8a3,_0x5036('0xf'),JSON[_0x5036('0x11')](_0x299a1b));if(_0x299a1b[_0x5036('0x12')]){if(_0x299a1b[_0x5036('0x12')]['code']===0x1f4){logger['error'](_0x5036('0x13'),_0x11e8a3,_0x299a1b['error']['message']);return _0x459901(_0x299a1b[_0x5036('0x12')][_0x5036('0x14')]);}logger[_0x5036('0x12')](_0x5036('0x13'),_0x11e8a3,_0x299a1b[_0x5036('0x12')][_0x5036('0x14')]);return _0xc80444(_0x299a1b[_0x5036('0x12')][_0x5036('0x14')]);}else{logger[_0x5036('0xe')](_0x5036('0x13'),_0x11e8a3,'request\x20sent');_0xc80444(_0x299a1b[_0x5036('0x15')][_0x5036('0x14')]);}})['catch'](function(_0x474a3a){logger[_0x5036('0x12')](_0x5036('0x13'),_0x11e8a3,_0x474a3a);_0x459901(_0x474a3a);});});} \ No newline at end of file +var _0x47e9=['request','then','info','debug','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47e9,0x198));var _0x947e=function(_0x252063,_0x2e7a4e){_0x252063=_0x252063-0x0;var _0x104d71=_0x47e9[_0x252063];return _0x104d71;};'use strict';var _=require('lodash');var util=require(_0x947e('0x0'));var moment=require(_0x947e('0x1'));var BPromise=require(_0x947e('0x2'));var rs=require(_0x947e('0x3'));var fs=require('fs');var Redis=require(_0x947e('0x4'));var db=require(_0x947e('0x5'))['db'];var utils=require(_0x947e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x947e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x947e('0x8')][_0x947e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bb68a,_0xa126fe,_0x394061){return new BPromise(function(_0x1bbeef,_0x25d06d){return client[_0x947e('0xa')](_0x3bb68a,_0x394061)[_0x947e('0xb')](function(_0x311cbb){logger[_0x947e('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0xa126fe,'request\x20sent');logger[_0x947e('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xa126fe,_0x947e('0xe'),JSON[_0x947e('0xf')](_0x311cbb));if(_0x311cbb[_0x947e('0x10')]){if(_0x311cbb['error'][_0x947e('0x11')]===0x1f4){logger['error'](_0x947e('0x12'),_0xa126fe,_0x311cbb[_0x947e('0x10')][_0x947e('0x13')]);return _0x25d06d(_0x311cbb[_0x947e('0x10')][_0x947e('0x13')]);}logger['error'](_0x947e('0x12'),_0xa126fe,_0x311cbb[_0x947e('0x10')][_0x947e('0x13')]);return _0x1bbeef(_0x311cbb[_0x947e('0x10')][_0x947e('0x13')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0xa126fe,'request\x20sent');_0x1bbeef(_0x311cbb[_0x947e('0x14')][_0x947e('0x13')]);}})[_0x947e('0x15')](function(_0x2a2dae){logger[_0x947e('0x10')](_0x947e('0x12'),_0xa126fe,_0x2a2dae);_0x25d06d(_0x2a2dae);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1b79ffb..80e1d4d 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 _0xe91d=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer'];(function(_0x379aa4,_0x513f19){var _0x2c5e31=function(_0xdf03ab){while(--_0xdf03ab){_0x379aa4['push'](_0x379aa4['shift']());}};_0x2c5e31(++_0x513f19);}(_0xe91d,0x1f3));var _0xde91=function(_0x37d239,_0x9890dc){_0x37d239=_0x37d239-0x0;var _0x219891=_0xe91d[_0x37d239];return _0x219891;};'use strict';var multer=require(_0xde91('0x0'));var util=require(_0xde91('0x1'));var path=require(_0xde91('0x2'));var timeout=require('connect-timeout');var express=require(_0xde91('0x3'));var router=express[_0xde91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xde91('0x5'));var interaction=require(_0xde91('0x6'));var config=require(_0xde91('0x7'));var controller=require(_0xde91('0x8'));router[_0xde91('0x9')]('/',auth[_0xde91('0xa')](),controller[_0xde91('0xb')]);router[_0xde91('0x9')]('/describe',auth[_0xde91('0xa')](),controller[_0xde91('0xc')]);router['get'](_0xde91('0xd'),auth[_0xde91('0xa')](),controller['show']);router[_0xde91('0xe')]('/',auth[_0xde91('0xa')](),controller['create']);router[_0xde91('0xf')](_0xde91('0xd'),auth[_0xde91('0xa')](),controller[_0xde91('0x10')]);router[_0xde91('0x11')](_0xde91('0xd'),auth[_0xde91('0xa')](),controller[_0xde91('0x12')]);module[_0xde91('0x13')]=router; \ No newline at end of file +var _0x164b=['put','/:id','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x27cfc5,_0x630ac4){var _0x21eb36=function(_0x67e00d){while(--_0x67e00d){_0x27cfc5['push'](_0x27cfc5['shift']());}};_0x21eb36(++_0x630ac4);}(_0x164b,0xc3));var _0xb164=function(_0x1e6cf1,_0x40c6d8){_0x1e6cf1=_0x1e6cf1-0x0;var _0x527676=_0x164b[_0x1e6cf1];return _0x527676;};'use strict';var multer=require(_0xb164('0x0'));var util=require(_0xb164('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb164('0x2'));var router=express[_0xb164('0x3')]();var fs_extra=require(_0xb164('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb164('0x5'));var config=require(_0xb164('0x6'));var controller=require('./faxTransferReport.controller');router[_0xb164('0x7')]('/',auth[_0xb164('0x8')](),controller[_0xb164('0x9')]);router[_0xb164('0x7')](_0xb164('0xa'),auth['isAuthenticated'](),controller[_0xb164('0xb')]);router['get']('/:id',auth[_0xb164('0x8')](),controller[_0xb164('0xc')]);router[_0xb164('0xd')]('/',auth[_0xb164('0x8')](),controller['create']);router[_0xb164('0xe')](_0xb164('0xf'),auth['isAuthenticated'](),controller[_0xb164('0x10')]);router['delete'](_0xb164('0xf'),auth['isAuthenticated'](),controller[_0xb164('0x11')]);module[_0xb164('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 985ece6..a01ad42 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 _0x6daf=['post','addConfiguration','update','delete','/:id','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3a218d,_0x340ffa){var _0x23580d=function(_0x2c4dbb){while(--_0x2c4dbb){_0x3a218d['push'](_0x3a218d['shift']());}};_0x23580d(++_0x340ffa);}(_0x6daf,0xd7));var _0xf6da=function(_0x18a793,_0x2c80e2){_0x18a793=_0x18a793-0x0;var _0x24c288=_0x6daf[_0x18a793];return _0x24c288;};'use strict';var multer=require('multer');var util=require(_0xf6da('0x0'));var path=require(_0xf6da('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6da('0x2'));var router=express[_0xf6da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf6da('0x4'));var interaction=require(_0xf6da('0x5'));var config=require(_0xf6da('0x6'));var controller=require('./intDeskAccount.controller');router[_0xf6da('0x7')]('/',auth[_0xf6da('0x8')](),controller['index']);router[_0xf6da('0x7')]('/:id',auth[_0xf6da('0x8')](),controller[_0xf6da('0x9')]);router[_0xf6da('0x7')](_0xf6da('0xa'),auth[_0xf6da('0x8')](),controller[_0xf6da('0xb')]);router[_0xf6da('0x7')](_0xf6da('0xc'),auth[_0xf6da('0x8')](),controller['getFields']);router[_0xf6da('0xd')]('/',auth[_0xf6da('0x8')](),controller['create']);router[_0xf6da('0xd')](_0xf6da('0xa'),auth['isAuthenticated'](),controller[_0xf6da('0xe')]);router['put']('/:id',auth[_0xf6da('0x8')](),controller[_0xf6da('0xf')]);router[_0xf6da('0x10')](_0xf6da('0x11'),auth[_0xf6da('0x8')](),controller[_0xf6da('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe6ab=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xeaf92d,_0x26a3bf){var _0x573a6a=function(_0x3214f1){while(--_0x3214f1){_0xeaf92d['push'](_0xeaf92d['shift']());}};_0x573a6a(++_0x26a3bf);}(_0xe6ab,0x152));var _0xbe6a=function(_0x51ed4d,_0x3f39c6){_0x51ed4d=_0x51ed4d-0x0;var _0x27c7f0=_0xe6ab[_0x51ed4d];return _0x27c7f0;};'use strict';var multer=require('multer');var util=require(_0xbe6a('0x0'));var path=require(_0xbe6a('0x1'));var timeout=require(_0xbe6a('0x2'));var express=require(_0xbe6a('0x3'));var router=express[_0xbe6a('0x4')]();var fs_extra=require(_0xbe6a('0x5'));var auth=require(_0xbe6a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe6a('0x7'));var controller=require(_0xbe6a('0x8'));router[_0xbe6a('0x9')]('/',auth[_0xbe6a('0xa')](),controller['index']);router[_0xbe6a('0x9')](_0xbe6a('0xb'),auth[_0xbe6a('0xa')](),controller[_0xbe6a('0xc')]);router[_0xbe6a('0x9')]('/:id/configurations',auth[_0xbe6a('0xa')](),controller[_0xbe6a('0xd')]);router[_0xbe6a('0x9')]('/:id/fields',auth[_0xbe6a('0xa')](),controller[_0xbe6a('0xe')]);router[_0xbe6a('0xf')]('/',auth[_0xbe6a('0xa')](),controller[_0xbe6a('0x10')]);router[_0xbe6a('0xf')](_0xbe6a('0x11'),auth[_0xbe6a('0xa')](),controller[_0xbe6a('0x12')]);router[_0xbe6a('0x13')](_0xbe6a('0xb'),auth[_0xbe6a('0xa')](),controller[_0xbe6a('0x14')]);router['delete'](_0xbe6a('0xb'),auth[_0xbe6a('0xa')](),controller[_0xbe6a('0x15')]);module[_0xbe6a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 42910a8..baeb481 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 _0x0425=['STRING','ENUM','basic','integrationTab','sequelize','exports'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x0425,0xd6));var _0x5042=function(_0x2aadda,_0x193fa4){_0x2aadda=_0x2aadda-0x0;var _0x358d80=_0x0425[_0x2aadda];return _0x358d80;};'use strict';var Sequelize=require(_0x5042('0x0'));module[_0x5042('0x1')]={'name':{'type':Sequelize[_0x5042('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5042('0x2')]},'authType':{'type':Sequelize[_0x5042('0x3')](_0x5042('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x5042('0x2')]},'consumerSecret':{'type':Sequelize[_0x5042('0x2')]},'token':{'type':Sequelize[_0x5042('0x2')]},'tokenSecret':{'type':Sequelize[_0x5042('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5042('0x3')](_0x5042('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9665=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9665,0x95));var _0x5966=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9665[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require('sequelize');module[_0x5966('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5966('0x1')]},'username':{'type':Sequelize[_0x5966('0x1')]},'remoteUri':{'type':Sequelize[_0x5966('0x1')]},'authType':{'type':Sequelize[_0x5966('0x2')]('basic'),'defaultValue':_0x5966('0x3')},'password':{'type':Sequelize[_0x5966('0x1')]},'consumerKey':{'type':Sequelize[_0x5966('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x5966('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5966('0x2')](_0x5966('0x4'),_0x5966('0x5')),'defaultValue':_0x5966('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 72cd6bc..c9e98b4 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 _0x3c79=['consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','basic','format','%s:%s','toString','base64','entries','active','label','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','DeskAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','DeskConfiguration','pick','nolimit','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password'];(function(_0x536a1c,_0x3e0e48){var _0x237dfe=function(_0x765b95){while(--_0x765b95){_0x536a1c['push'](_0x536a1c['shift']());}};_0x237dfe(++_0x3e0e48);}(_0x3c79,0x1da));var _0x93c7=function(_0x480be7,_0x47983e){_0x480be7=_0x480be7-0x0;var _0x4976df=_0x3c79[_0x480be7];return _0x4976df;};'use strict';var emlformat=require(_0x93c7('0x0'));var rimraf=require(_0x93c7('0x1'));var zipdir=require(_0x93c7('0x2'));var jsonpatch=require(_0x93c7('0x3'));var rp=require(_0x93c7('0x4'));var moment=require(_0x93c7('0x5'));var BPromise=require(_0x93c7('0x6'));var Mustache=require('mustache');var util=require(_0x93c7('0x7'));var path=require(_0x93c7('0x8'));var sox=require(_0x93c7('0x9'));var csv=require(_0x93c7('0xa'));var ejs=require(_0x93c7('0xb'));var fs=require('fs');var fs_extra=require(_0x93c7('0xc'));var _=require('lodash');var squel=require(_0x93c7('0xd'));var crypto=require(_0x93c7('0xe'));var jsforce=require(_0x93c7('0xf'));var deskjs=require(_0x93c7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x93c7('0x11'));var Papa=require(_0x93c7('0x12'));var Redis=require(_0x93c7('0x13'));var authService=require(_0x93c7('0x14'));var qs=require(_0x93c7('0x15'));var as=require(_0x93c7('0x16'));var hardwareService=require(_0x93c7('0x17'));var logger=require('../../config/logger')(_0x93c7('0x18'));var utils=require(_0x93c7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x93c7('0x1a'));var db=require(_0x93c7('0x1b'))['db'];var integrations=require(_0x93c7('0x1c'));function respondWithStatusCode(_0x5a37ef,_0x56b468){_0x56b468=_0x56b468||0xcc;return function(_0x5a5d61){if(_0x5a5d61){return _0x5a37ef[_0x93c7('0x1d')](_0x56b468);}return _0x5a37ef[_0x93c7('0x1e')](_0x56b468)[_0x93c7('0x1f')]();};}function respondWithResult(_0x3e49ba,_0x1323f6){_0x1323f6=_0x1323f6||0xc8;return function(_0x464a86){if(_0x464a86){return _0x3e49ba[_0x93c7('0x1e')](_0x1323f6)['json'](_0x464a86);}};}function respondWithFilteredResult(_0x374ddd,_0x1907fd){return function(_0x212f16){if(_0x212f16){var _0x2a012b=typeof _0x1907fd['offset']===_0x93c7('0x20')&&typeof _0x1907fd[_0x93c7('0x21')]===_0x93c7('0x20');var _0xb6aa40=_0x212f16[_0x93c7('0x22')];var _0x445107=_0x2a012b?0x0:_0x1907fd[_0x93c7('0x23')];var _0x1fa194=_0x2a012b?_0x212f16[_0x93c7('0x22')]:_0x1907fd['offset']+_0x1907fd[_0x93c7('0x21')];var _0x4eb841;if(_0x1fa194>=_0xb6aa40){_0x1fa194=_0xb6aa40;_0x4eb841=0xc8;}else{_0x4eb841=0xce;}_0x374ddd[_0x93c7('0x1e')](_0x4eb841);return _0x374ddd[_0x93c7('0x24')](_0x93c7('0x25'),_0x445107+'-'+_0x1fa194+'/'+_0xb6aa40)[_0x93c7('0x26')](_0x212f16);}return null;};}function patchUpdates(_0x281019){return function(_0x15c18b){try{jsonpatch['apply'](_0x15c18b,_0x281019,!![]);}catch(_0xb0625a){return BPromise[_0x93c7('0x27')](_0xb0625a);}return _0x15c18b[_0x93c7('0x28')]();};}function saveUpdates(_0x32bc9d,_0x14abd6){return function(_0x373995){if(_0x373995){return _0x373995[_0x93c7('0x29')](_0x32bc9d)[_0x93c7('0x2a')](function(_0x3611ee){return _0x3611ee;});}return null;};}function removeEntity(_0xd52020,_0x185606){return function(_0x1586d2){if(_0x1586d2){return _0x1586d2['destroy']()['then'](function(){_0xd52020[_0x93c7('0x1e')](0xcc)[_0x93c7('0x1f')]();});}};}function handleEntityNotFound(_0x25bcdf,_0x5c9ec4){return function(_0x4f24fe){if(!_0x4f24fe){_0x25bcdf[_0x93c7('0x1d')](0x194);}return _0x4f24fe;};}function handleError(_0x522d7c,_0x3f5d70){_0x3f5d70=_0x3f5d70||0x1f4;return function(_0x8ce0a1){logger[_0x93c7('0x2b')](_0x8ce0a1[_0x93c7('0x2c')]);if(_0x8ce0a1[_0x93c7('0x2d')]){delete _0x8ce0a1[_0x93c7('0x2d')];}_0x522d7c[_0x93c7('0x1e')](_0x3f5d70)[_0x93c7('0x2e')](_0x8ce0a1);};}exports[_0x93c7('0x2f')]=function(_0x4a3576,_0x3f044b){var _0x3a6e15={},_0x178f3d={},_0x1430aa={'count':0x0,'rows':[]};var _0x23166a=_['map'](db[_0x93c7('0x30')][_0x93c7('0x31')],function(_0x3280b2){return{'name':_0x3280b2['fieldName'],'type':_0x3280b2[_0x93c7('0x32')][_0x93c7('0x33')]};});_0x178f3d[_0x93c7('0x34')]=_[_0x93c7('0x35')](_0x23166a,_0x93c7('0x2d'));_0x178f3d['query']=_[_0x93c7('0x36')](_0x4a3576[_0x93c7('0x37')]);_0x178f3d[_0x93c7('0x38')]=_['intersection'](_0x178f3d['model'],_0x178f3d[_0x93c7('0x37')]);_0x3a6e15['attributes']=_[_0x93c7('0x39')](_0x178f3d[_0x93c7('0x34')],qs[_0x93c7('0x3a')](_0x4a3576[_0x93c7('0x37')][_0x93c7('0x3a')]));_0x3a6e15[_0x93c7('0x3b')]=_0x3a6e15[_0x93c7('0x3b')][_0x93c7('0x3c')]?_0x3a6e15[_0x93c7('0x3b')]:_0x178f3d[_0x93c7('0x34')];if(!_0x4a3576['query'][_0x93c7('0x3d')]('nolimit')){_0x3a6e15[_0x93c7('0x21')]=qs[_0x93c7('0x21')](_0x4a3576[_0x93c7('0x37')][_0x93c7('0x21')]);_0x3a6e15[_0x93c7('0x23')]=qs['offset'](_0x4a3576[_0x93c7('0x37')]['offset']);}_0x3a6e15[_0x93c7('0x3e')]=qs['sort'](_0x4a3576[_0x93c7('0x37')][_0x93c7('0x3f')]);_0x3a6e15['where']=qs[_0x93c7('0x38')](_['pick'](_0x4a3576['query'],_0x178f3d[_0x93c7('0x38')]),_0x23166a);if(_0x4a3576['query'][_0x93c7('0x40')]){_0x3a6e15['where']=_['merge'](_0x3a6e15[_0x93c7('0x41')],{'$or':_[_0x93c7('0x35')](_0x23166a,function(_0x570b8f){if(_0x570b8f[_0x93c7('0x32')]!==_0x93c7('0x42')){var _0xaad693={};_0xaad693[_0x570b8f[_0x93c7('0x2d')]]={'$like':'%'+_0x4a3576[_0x93c7('0x37')][_0x93c7('0x40')]+'%'};return _0xaad693;}})});}_0x3a6e15=_[_0x93c7('0x43')]({},_0x3a6e15,_0x4a3576[_0x93c7('0x44')]);var _0x2ba667={'where':_0x3a6e15['where']};return db[_0x93c7('0x30')][_0x93c7('0x22')](_0x2ba667)[_0x93c7('0x2a')](function(_0x433c5c){_0x1430aa[_0x93c7('0x22')]=_0x433c5c;if(_0x4a3576[_0x93c7('0x37')][_0x93c7('0x45')]){_0x3a6e15['include']=[{'all':!![]}];}return db[_0x93c7('0x30')][_0x93c7('0x46')](_0x3a6e15);})[_0x93c7('0x2a')](function(_0x1509ff){_0x1430aa[_0x93c7('0x47')]=_0x1509ff;return _0x1430aa;})[_0x93c7('0x2a')](respondWithFilteredResult(_0x3f044b,_0x3a6e15))[_0x93c7('0x48')](handleError(_0x3f044b,null));};exports[_0x93c7('0x49')]=function(_0x58ff4c,_0x8b4ed1){var _0x59db81={'raw':![],'where':{'id':_0x58ff4c[_0x93c7('0x4a')]['id']}},_0x492a64={};_0x492a64['model']=_[_0x93c7('0x36')](db['DeskAccount'][_0x93c7('0x31')]);_0x492a64['query']=_['keys'](_0x58ff4c[_0x93c7('0x37')]);_0x492a64['filters']=_[_0x93c7('0x39')](_0x492a64[_0x93c7('0x34')],_0x492a64[_0x93c7('0x37')]);_0x59db81[_0x93c7('0x3b')]=_[_0x93c7('0x39')](_0x492a64['model'],qs[_0x93c7('0x3a')](_0x58ff4c[_0x93c7('0x37')][_0x93c7('0x3a')]));_0x59db81['attributes']=_0x59db81[_0x93c7('0x3b')]['length']?_0x59db81[_0x93c7('0x3b')]:_0x492a64['model'];if(_0x58ff4c[_0x93c7('0x37')]['includeAll']){_0x59db81['include']=[{'all':!![]}];}_0x59db81=_[_0x93c7('0x43')]({},_0x59db81,_0x58ff4c[_0x93c7('0x44')]);return db[_0x93c7('0x30')][_0x93c7('0x4b')](_0x59db81)[_0x93c7('0x2a')](handleEntityNotFound(_0x8b4ed1,null))[_0x93c7('0x2a')](respondWithResult(_0x8b4ed1,null))[_0x93c7('0x48')](handleError(_0x8b4ed1,null));};exports[_0x93c7('0x4c')]=function(_0xa6a20a,_0xac5139){return db[_0x93c7('0x30')][_0x93c7('0x4c')](_0xa6a20a[_0x93c7('0x4d')],{})[_0x93c7('0x2a')](respondWithResult(_0xac5139,0xc9))[_0x93c7('0x48')](handleError(_0xac5139,null));};exports[_0x93c7('0x29')]=function(_0x411d29,_0x102c58){if(_0x411d29[_0x93c7('0x4d')]['id']){delete _0x411d29[_0x93c7('0x4d')]['id'];}return db[_0x93c7('0x30')][_0x93c7('0x4b')]({'where':{'id':_0x411d29[_0x93c7('0x4a')]['id']}})[_0x93c7('0x2a')](handleEntityNotFound(_0x102c58,null))[_0x93c7('0x2a')](saveUpdates(_0x411d29[_0x93c7('0x4d')],null))['then'](respondWithResult(_0x102c58,null))['catch'](handleError(_0x102c58,null));};exports[_0x93c7('0x4e')]=function(_0x4b25dc,_0x31219e){return db[_0x93c7('0x30')][_0x93c7('0x4b')]({'where':{'id':_0x4b25dc[_0x93c7('0x4a')]['id']}})[_0x93c7('0x2a')](handleEntityNotFound(_0x31219e,null))[_0x93c7('0x2a')](removeEntity(_0x31219e,null))[_0x93c7('0x48')](handleError(_0x31219e,null));};exports[_0x93c7('0x4f')]=function(_0x16a97e,_0x7f0993,_0x42d11c){var _0x210b6f={};var _0x221828={};var _0x440eca;var _0xe90e02;return db[_0x93c7('0x30')]['findOne']({'where':{'id':_0x16a97e[_0x93c7('0x4a')]['id']}})[_0x93c7('0x2a')](handleEntityNotFound(_0x7f0993,null))['then'](function(_0x10140c){if(_0x10140c){_0x440eca=_0x10140c;_0x221828[_0x93c7('0x34')]=_[_0x93c7('0x36')](db[_0x93c7('0x50')][_0x93c7('0x31')]);_0x221828[_0x93c7('0x37')]=_[_0x93c7('0x36')](_0x16a97e[_0x93c7('0x37')]);_0x221828['filters']=_[_0x93c7('0x39')](_0x221828[_0x93c7('0x34')],_0x221828[_0x93c7('0x37')]);_0x210b6f['attributes']=_[_0x93c7('0x39')](_0x221828[_0x93c7('0x34')],qs[_0x93c7('0x3a')](_0x16a97e[_0x93c7('0x37')][_0x93c7('0x3a')]));_0x210b6f[_0x93c7('0x3b')]=_0x210b6f['attributes'][_0x93c7('0x3c')]?_0x210b6f[_0x93c7('0x3b')]:_0x221828['model'];_0x210b6f[_0x93c7('0x3e')]=qs[_0x93c7('0x3f')](_0x16a97e['query'][_0x93c7('0x3f')]);_0x210b6f[_0x93c7('0x41')]=qs['filters'](_[_0x93c7('0x51')](_0x16a97e['query'],_0x221828[_0x93c7('0x38')]));if(_0x16a97e[_0x93c7('0x37')][_0x93c7('0x40')]){_0x210b6f[_0x93c7('0x41')]=_[_0x93c7('0x43')](_0x210b6f['where'],{'$or':_[_0x93c7('0x35')](_0x210b6f[_0x93c7('0x3b')],function(_0x4d6c43){var _0x1bbfc7={};_0x1bbfc7[_0x4d6c43]={'$like':'%'+_0x16a97e['query'][_0x93c7('0x40')]+'%'};return _0x1bbfc7;})});}_0x210b6f=_[_0x93c7('0x43')]({},_0x210b6f,_0x16a97e[_0x93c7('0x44')]);return _0x440eca[_0x93c7('0x4f')](_0x210b6f);}})[_0x93c7('0x2a')](function(_0x48b1a4){if(_0x48b1a4){_0xe90e02=_0x48b1a4[_0x93c7('0x3c')];if(!_0x16a97e['query']['hasOwnProperty'](_0x93c7('0x52'))){_0x210b6f[_0x93c7('0x21')]=qs[_0x93c7('0x21')](_0x16a97e[_0x93c7('0x37')][_0x93c7('0x21')]);_0x210b6f['offset']=qs[_0x93c7('0x23')](_0x16a97e[_0x93c7('0x37')][_0x93c7('0x23')]);}return _0x440eca[_0x93c7('0x4f')](_0x210b6f);}})[_0x93c7('0x2a')](function(_0x24551d){if(_0x24551d){return _0x24551d?{'count':_0xe90e02,'rows':_0x24551d}:null;}})[_0x93c7('0x2a')](respondWithResult(_0x7f0993,null))[_0x93c7('0x48')](handleError(_0x7f0993,null));};exports['addConfiguration']=function(_0x56253d,_0x44f5de,_0x31af2c){if(_0x56253d[_0x93c7('0x4d')]['id']){delete _0x56253d[_0x93c7('0x4d')]['id'];}return db['DeskAccount'][_0x93c7('0x53')]({'where':{'id':_0x56253d['params']['id']}})[_0x93c7('0x2a')](handleEntityNotFound(_0x44f5de,null))['then'](function(_0x46792f){if(_0x46792f){_0x56253d['body'][_0x93c7('0x54')]=_0x46792f['id'];_0x56253d[_0x93c7('0x4d')][_0x93c7('0x55')]=integrations[_0x93c7('0x56')](_0x56253d[_0x93c7('0x4d')][_0x93c7('0x57')],_0x56253d['body']['type']);_0x56253d[_0x93c7('0x4d')]['Descriptions']=integrations[_0x93c7('0x58')](_0x56253d[_0x93c7('0x4d')][_0x93c7('0x57')],_0x56253d['body'][_0x93c7('0x32')]);return db[_0x93c7('0x50')][_0x93c7('0x4c')](_0x56253d[_0x93c7('0x4d')],{'include':[{'model':db[_0x93c7('0x59')],'as':_0x93c7('0x55')},{'model':db[_0x93c7('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x44f5de,null))[_0x93c7('0x48')](handleError(_0x44f5de,null));};exports[_0x93c7('0x5a')]=function(_0x64f86c,_0x3a5d60,_0x2bf04d){var _0x46f110=[{'name':_0x93c7('0x5b'),'label':_0x93c7('0x5b'),'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 _0x3af90b='';return db[_0x93c7('0x30')][_0x93c7('0x53')]({'where':{'id':_0x64f86c[_0x93c7('0x4a')]['id']},'attributes':['id',_0x93c7('0x5c'),_0x93c7('0x5d'),_0x93c7('0x5e'),_0x93c7('0x5f'),_0x93c7('0x60'),_0x93c7('0x61'),'token',_0x93c7('0x62')]})[_0x93c7('0x2a')](handleEntityNotFound(_0x3a5d60,null))['then'](function(_0x229c54){if(_0x229c54){_0x3af90b=_0x229c54[_0x93c7('0x5c')];var _0x3c5bc9=_0x3af90b[_0x93c7('0x63')](-0x1);if(_0x3c5bc9==='/'){_0x3af90b=_0x3af90b[_0x93c7('0x64')](0x0,_0x3af90b[_0x93c7('0x65')](_0x3c5bc9));}var _0x4e59e0={'method':'GET','uri':util['format']('%s/custom_fields',_0x3af90b),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x229c54[_0x93c7('0x5d')]===_0x93c7('0x66')){_0x4e59e0['headers']['Authorization']=util[_0x93c7('0x67')]('Basic\x20%s',new Buffer(util['format'](_0x93c7('0x68'),_0x229c54['username'],_0x229c54[_0x93c7('0x5f')]))[_0x93c7('0x69')](_0x93c7('0x6a')));}return rp(_0x4e59e0)['then'](function(_0x444bb0){return _0x46f110['concat'](_[_0x93c7('0x35')](_0x444bb0['_embedded'][_0x93c7('0x6b')],function(_0x5dc3a6){return{'id':_0x5dc3a6[_0x93c7('0x2d')],'name':_0x5dc3a6[_0x93c7('0x2d')],'type':_0x5dc3a6['type'],'active':_0x5dc3a6[_0x93c7('0x6c')],'label':_0x5dc3a6[_0x93c7('0x6d')],'custom':!![]};}));});}})[_0x93c7('0x2a')](function(_0x4e4cb8){return{'count':_0x4e4cb8[_0x93c7('0x3c')],'rows':_0x4e4cb8};})[_0x93c7('0x2a')](respondWithResult(_0x3a5d60,null))[_0x93c7('0x48')](function(_0x2f7b0b){var _0x3b3d8d=_0x64f86c[_0x93c7('0x37')]['test']?0x1f4:_0x2f7b0b[_0x93c7('0x6e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x93c7('0x5a'),_0x3b3d8d,JSON[_0x93c7('0x6f')](_0x2f7b0b));delete _0x2f7b0b[_0x93c7('0x2d')];if(_0x3b3d8d===0x191){_0x3b3d8d=0x190;}_0x3a5d60[_0x93c7('0x1e')](_0x3b3d8d)[_0x93c7('0x2e')](_0x64f86c[_0x93c7('0x37')][_0x93c7('0x70')]?{'message':_0x93c7('0x71'),'statusCode':_0x2f7b0b[_0x93c7('0x6e')]}:_0x2f7b0b);});}; \ No newline at end of file +var _0x4201=['set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','DeskAccount','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','DeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','token','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','toString','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x1f5baf,_0x782936){var _0x32301c=function(_0x5cc916){while(--_0x5cc916){_0x1f5baf['push'](_0x1f5baf['shift']());}};_0x32301c(++_0x782936);}(_0x4201,0x1b8));var _0x1420=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0x4201[_0x40b981];return _0x58696b;};'use strict';var emlformat=require(_0x1420('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1420('0x1'));var jsonpatch=require(_0x1420('0x2'));var rp=require(_0x1420('0x3'));var moment=require(_0x1420('0x4'));var BPromise=require(_0x1420('0x5'));var Mustache=require(_0x1420('0x6'));var util=require(_0x1420('0x7'));var path=require(_0x1420('0x8'));var sox=require(_0x1420('0x9'));var csv=require(_0x1420('0xa'));var ejs=require(_0x1420('0xb'));var fs=require('fs');var fs_extra=require(_0x1420('0xc'));var _=require(_0x1420('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1420('0xe'));var deskjs=require(_0x1420('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1420('0x10'));var Papa=require('papaparse');var Redis=require(_0x1420('0x11'));var authService=require(_0x1420('0x12'));var qs=require(_0x1420('0x13'));var as=require(_0x1420('0x14'));var hardwareService=require(_0x1420('0x15'));var logger=require(_0x1420('0x16'))(_0x1420('0x17'));var utils=require(_0x1420('0x18'));var config=require(_0x1420('0x19'));var licenseUtil=require(_0x1420('0x1a'));var db=require(_0x1420('0x1b'))['db'];var integrations=require(_0x1420('0x1c'));function respondWithStatusCode(_0x2bd6a4,_0x19be65){_0x19be65=_0x19be65||0xcc;return function(_0x59b3e2){if(_0x59b3e2){return _0x2bd6a4[_0x1420('0x1d')](_0x19be65);}return _0x2bd6a4[_0x1420('0x1e')](_0x19be65)[_0x1420('0x1f')]();};}function respondWithResult(_0x25c7f,_0x24bda3){_0x24bda3=_0x24bda3||0xc8;return function(_0x5917c1){if(_0x5917c1){return _0x25c7f[_0x1420('0x1e')](_0x24bda3)[_0x1420('0x20')](_0x5917c1);}};}function respondWithFilteredResult(_0x2999f6,_0x201291){return function(_0xc261aa){if(_0xc261aa){var _0x2e25bf=typeof _0x201291[_0x1420('0x21')]===_0x1420('0x22')&&typeof _0x201291[_0x1420('0x23')]===_0x1420('0x22');var _0x450407=_0xc261aa['count'];var _0x36df37=_0x2e25bf?0x0:_0x201291[_0x1420('0x21')];var _0x3cea9b=_0x2e25bf?_0xc261aa['count']:_0x201291[_0x1420('0x21')]+_0x201291[_0x1420('0x23')];var _0x261310;if(_0x3cea9b>=_0x450407){_0x3cea9b=_0x450407;_0x261310=0xc8;}else{_0x261310=0xce;}_0x2999f6['status'](_0x261310);return _0x2999f6[_0x1420('0x24')](_0x1420('0x25'),_0x36df37+'-'+_0x3cea9b+'/'+_0x450407)[_0x1420('0x20')](_0xc261aa);}return null;};}function patchUpdates(_0x3967a4){return function(_0x3b5d52){try{jsonpatch['apply'](_0x3b5d52,_0x3967a4,!![]);}catch(_0x5cb689){return BPromise[_0x1420('0x26')](_0x5cb689);}return _0x3b5d52['save']();};}function saveUpdates(_0x25b6db,_0x36da27){return function(_0x126721){if(_0x126721){return _0x126721[_0x1420('0x27')](_0x25b6db)['then'](function(_0x399caf){return _0x399caf;});}return null;};}function removeEntity(_0x3d6f42,_0x2bed0b){return function(_0x476241){if(_0x476241){return _0x476241[_0x1420('0x28')]()[_0x1420('0x29')](function(){_0x3d6f42[_0x1420('0x1e')](0xcc)[_0x1420('0x1f')]();});}};}function handleEntityNotFound(_0x1a94e2,_0x2ecf3d){return function(_0x4fdc35){if(!_0x4fdc35){_0x1a94e2['sendStatus'](0x194);}return _0x4fdc35;};}function handleError(_0x3a1169,_0x30eb5b){_0x30eb5b=_0x30eb5b||0x1f4;return function(_0x2f3b7b){logger[_0x1420('0x2a')](_0x2f3b7b[_0x1420('0x2b')]);if(_0x2f3b7b[_0x1420('0x2c')]){delete _0x2f3b7b['name'];}_0x3a1169[_0x1420('0x1e')](_0x30eb5b)[_0x1420('0x2d')](_0x2f3b7b);};}exports[_0x1420('0x2e')]=function(_0x55ed45,_0x3cd742){var _0x160435={},_0x3f7e5d={},_0x1ea1f5={'count':0x0,'rows':[]};var _0x2f1b51=_[_0x1420('0x2f')](db['DeskAccount']['rawAttributes'],function(_0x4522df){return{'name':_0x4522df[_0x1420('0x30')],'type':_0x4522df[_0x1420('0x31')][_0x1420('0x32')]};});_0x3f7e5d[_0x1420('0x33')]=_['map'](_0x2f1b51,'name');_0x3f7e5d[_0x1420('0x34')]=_[_0x1420('0x35')](_0x55ed45[_0x1420('0x34')]);_0x3f7e5d[_0x1420('0x36')]=_[_0x1420('0x37')](_0x3f7e5d['model'],_0x3f7e5d[_0x1420('0x34')]);_0x160435[_0x1420('0x38')]=_['intersection'](_0x3f7e5d[_0x1420('0x33')],qs[_0x1420('0x39')](_0x55ed45[_0x1420('0x34')][_0x1420('0x39')]));_0x160435[_0x1420('0x38')]=_0x160435[_0x1420('0x38')][_0x1420('0x3a')]?_0x160435[_0x1420('0x38')]:_0x3f7e5d[_0x1420('0x33')];if(!_0x55ed45['query'][_0x1420('0x3b')](_0x1420('0x3c'))){_0x160435[_0x1420('0x23')]=qs[_0x1420('0x23')](_0x55ed45[_0x1420('0x34')][_0x1420('0x23')]);_0x160435[_0x1420('0x21')]=qs['offset'](_0x55ed45[_0x1420('0x34')][_0x1420('0x21')]);}_0x160435['order']=qs[_0x1420('0x3d')](_0x55ed45[_0x1420('0x34')][_0x1420('0x3d')]);_0x160435['where']=qs[_0x1420('0x36')](_[_0x1420('0x3e')](_0x55ed45[_0x1420('0x34')],_0x3f7e5d[_0x1420('0x36')]),_0x2f1b51);if(_0x55ed45[_0x1420('0x34')][_0x1420('0x3f')]){_0x160435[_0x1420('0x40')]=_['merge'](_0x160435[_0x1420('0x40')],{'$or':_[_0x1420('0x2f')](_0x2f1b51,function(_0x1640ab){if(_0x1640ab['type']!==_0x1420('0x41')){var _0x5dde97={};_0x5dde97[_0x1640ab[_0x1420('0x2c')]]={'$like':'%'+_0x55ed45['query'][_0x1420('0x3f')]+'%'};return _0x5dde97;}})});}_0x160435=_[_0x1420('0x42')]({},_0x160435,_0x55ed45[_0x1420('0x43')]);var _0x4b604a={'where':_0x160435[_0x1420('0x40')]};return db[_0x1420('0x44')][_0x1420('0x45')](_0x4b604a)[_0x1420('0x29')](function(_0x24d61a){_0x1ea1f5[_0x1420('0x45')]=_0x24d61a;if(_0x55ed45[_0x1420('0x34')][_0x1420('0x46')]){_0x160435[_0x1420('0x47')]=[{'all':!![]}];}return db[_0x1420('0x44')]['findAll'](_0x160435);})[_0x1420('0x29')](function(_0x6ba63){_0x1ea1f5[_0x1420('0x48')]=_0x6ba63;return _0x1ea1f5;})[_0x1420('0x29')](respondWithFilteredResult(_0x3cd742,_0x160435))[_0x1420('0x49')](handleError(_0x3cd742,null));};exports[_0x1420('0x4a')]=function(_0xf6dc60,_0x288f21){var _0x147dbc={'raw':![],'where':{'id':_0xf6dc60[_0x1420('0x4b')]['id']}},_0x2e62cf={};_0x2e62cf[_0x1420('0x33')]=_[_0x1420('0x35')](db[_0x1420('0x44')][_0x1420('0x4c')]);_0x2e62cf['query']=_['keys'](_0xf6dc60[_0x1420('0x34')]);_0x2e62cf[_0x1420('0x36')]=_[_0x1420('0x37')](_0x2e62cf[_0x1420('0x33')],_0x2e62cf[_0x1420('0x34')]);_0x147dbc['attributes']=_[_0x1420('0x37')](_0x2e62cf['model'],qs[_0x1420('0x39')](_0xf6dc60[_0x1420('0x34')][_0x1420('0x39')]));_0x147dbc[_0x1420('0x38')]=_0x147dbc[_0x1420('0x38')][_0x1420('0x3a')]?_0x147dbc[_0x1420('0x38')]:_0x2e62cf['model'];if(_0xf6dc60['query'][_0x1420('0x46')]){_0x147dbc[_0x1420('0x47')]=[{'all':!![]}];}_0x147dbc=_[_0x1420('0x42')]({},_0x147dbc,_0xf6dc60[_0x1420('0x43')]);return db['DeskAccount'][_0x1420('0x4d')](_0x147dbc)[_0x1420('0x29')](handleEntityNotFound(_0x288f21,null))['then'](respondWithResult(_0x288f21,null))['catch'](handleError(_0x288f21,null));};exports[_0x1420('0x4e')]=function(_0x150f27,_0x2cc555){return db[_0x1420('0x44')][_0x1420('0x4e')](_0x150f27['body'],{})[_0x1420('0x29')](respondWithResult(_0x2cc555,0xc9))[_0x1420('0x49')](handleError(_0x2cc555,null));};exports[_0x1420('0x27')]=function(_0x5b2bf3,_0x535812){if(_0x5b2bf3[_0x1420('0x4f')]['id']){delete _0x5b2bf3[_0x1420('0x4f')]['id'];}return db[_0x1420('0x44')][_0x1420('0x4d')]({'where':{'id':_0x5b2bf3[_0x1420('0x4b')]['id']}})[_0x1420('0x29')](handleEntityNotFound(_0x535812,null))['then'](saveUpdates(_0x5b2bf3[_0x1420('0x4f')],null))[_0x1420('0x29')](respondWithResult(_0x535812,null))[_0x1420('0x49')](handleError(_0x535812,null));};exports[_0x1420('0x28')]=function(_0xf79528,_0x29262a){return db['DeskAccount'][_0x1420('0x4d')]({'where':{'id':_0xf79528[_0x1420('0x4b')]['id']}})[_0x1420('0x29')](handleEntityNotFound(_0x29262a,null))[_0x1420('0x29')](removeEntity(_0x29262a,null))['catch'](handleError(_0x29262a,null));};exports[_0x1420('0x50')]=function(_0x34a6a0,_0xb31b2c,_0x3b1683){var _0xecf4c5={};var _0x10e848={};var _0x231aba;var _0x68b2ee;return db[_0x1420('0x44')]['findOne']({'where':{'id':_0x34a6a0[_0x1420('0x4b')]['id']}})[_0x1420('0x29')](handleEntityNotFound(_0xb31b2c,null))['then'](function(_0x43aff5){if(_0x43aff5){_0x231aba=_0x43aff5;_0x10e848[_0x1420('0x33')]=_[_0x1420('0x35')](db[_0x1420('0x51')][_0x1420('0x4c')]);_0x10e848[_0x1420('0x34')]=_[_0x1420('0x35')](_0x34a6a0[_0x1420('0x34')]);_0x10e848['filters']=_[_0x1420('0x37')](_0x10e848['model'],_0x10e848['query']);_0xecf4c5[_0x1420('0x38')]=_['intersection'](_0x10e848[_0x1420('0x33')],qs[_0x1420('0x39')](_0x34a6a0[_0x1420('0x34')][_0x1420('0x39')]));_0xecf4c5['attributes']=_0xecf4c5['attributes'][_0x1420('0x3a')]?_0xecf4c5['attributes']:_0x10e848[_0x1420('0x33')];_0xecf4c5[_0x1420('0x52')]=qs[_0x1420('0x3d')](_0x34a6a0[_0x1420('0x34')][_0x1420('0x3d')]);_0xecf4c5[_0x1420('0x40')]=qs[_0x1420('0x36')](_[_0x1420('0x3e')](_0x34a6a0[_0x1420('0x34')],_0x10e848[_0x1420('0x36')]));if(_0x34a6a0[_0x1420('0x34')][_0x1420('0x3f')]){_0xecf4c5[_0x1420('0x40')]=_[_0x1420('0x42')](_0xecf4c5['where'],{'$or':_[_0x1420('0x2f')](_0xecf4c5['attributes'],function(_0x3bc825){var _0x39cd84={};_0x39cd84[_0x3bc825]={'$like':'%'+_0x34a6a0['query']['filter']+'%'};return _0x39cd84;})});}_0xecf4c5=_[_0x1420('0x42')]({},_0xecf4c5,_0x34a6a0[_0x1420('0x43')]);return _0x231aba[_0x1420('0x50')](_0xecf4c5);}})[_0x1420('0x29')](function(_0x1971e7){if(_0x1971e7){_0x68b2ee=_0x1971e7['length'];if(!_0x34a6a0['query'][_0x1420('0x3b')](_0x1420('0x3c'))){_0xecf4c5[_0x1420('0x23')]=qs[_0x1420('0x23')](_0x34a6a0[_0x1420('0x34')][_0x1420('0x23')]);_0xecf4c5[_0x1420('0x21')]=qs[_0x1420('0x21')](_0x34a6a0['query'][_0x1420('0x21')]);}return _0x231aba[_0x1420('0x50')](_0xecf4c5);}})[_0x1420('0x29')](function(_0xc6495){if(_0xc6495){return _0xc6495?{'count':_0x68b2ee,'rows':_0xc6495}:null;}})['then'](respondWithResult(_0xb31b2c,null))[_0x1420('0x49')](handleError(_0xb31b2c,null));};exports[_0x1420('0x53')]=function(_0x111464,_0x5f5845,_0x251f03){if(_0x111464[_0x1420('0x4f')]['id']){delete _0x111464[_0x1420('0x4f')]['id'];}return db['DeskAccount'][_0x1420('0x54')]({'where':{'id':_0x111464[_0x1420('0x4b')]['id']}})[_0x1420('0x29')](handleEntityNotFound(_0x5f5845,null))[_0x1420('0x29')](function(_0x3b5eb5){if(_0x3b5eb5){_0x111464[_0x1420('0x4f')][_0x1420('0x55')]=_0x3b5eb5['id'];_0x111464[_0x1420('0x4f')][_0x1420('0x56')]=integrations[_0x1420('0x57')](_0x111464['body'][_0x1420('0x58')],_0x111464[_0x1420('0x4f')][_0x1420('0x31')]);_0x111464[_0x1420('0x4f')][_0x1420('0x59')]=integrations[_0x1420('0x5a')](_0x111464[_0x1420('0x4f')][_0x1420('0x58')],_0x111464[_0x1420('0x4f')]['type']);return db[_0x1420('0x51')][_0x1420('0x4e')](_0x111464[_0x1420('0x4f')],{'include':[{'model':db[_0x1420('0x5b')],'as':'Subjects'},{'model':db[_0x1420('0x5b')],'as':_0x1420('0x59')}]});}return null;})['then'](respondWithResult(_0x5f5845,null))[_0x1420('0x49')](handleError(_0x5f5845,null));};exports[_0x1420('0x5c')]=function(_0x4c1cb8,_0x1ef6c3,_0x10112b){var _0x156461=[{'name':_0x1420('0x5d'),'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 _0x48ae65='';return db['DeskAccount']['findOne']({'where':{'id':_0x4c1cb8['params']['id']},'attributes':['id',_0x1420('0x5e'),_0x1420('0x5f'),_0x1420('0x60'),_0x1420('0x61'),'consumerKey','consumerSecret',_0x1420('0x62'),'tokenSecret']})[_0x1420('0x29')](handleEntityNotFound(_0x1ef6c3,null))[_0x1420('0x29')](function(_0x23542c){if(_0x23542c){_0x48ae65=_0x23542c[_0x1420('0x5e')];var _0xb8238b=_0x48ae65[_0x1420('0x63')](-0x1);if(_0xb8238b==='/'){_0x48ae65=_0x48ae65['substring'](0x0,_0x48ae65[_0x1420('0x64')](_0xb8238b));}var _0x5223bb={'method':_0x1420('0x65'),'uri':util[_0x1420('0x66')](_0x1420('0x67'),_0x48ae65),'headers':{'Content-Type':'application/json','Accept':_0x1420('0x68')},'json':!![]};if(_0x23542c[_0x1420('0x5f')]===_0x1420('0x69')){_0x5223bb[_0x1420('0x6a')]['Authorization']=util[_0x1420('0x66')](_0x1420('0x6b'),new Buffer(util[_0x1420('0x66')]('%s:%s',_0x23542c[_0x1420('0x60')],_0x23542c['password']))[_0x1420('0x6c')](_0x1420('0x6d')));}return rp(_0x5223bb)[_0x1420('0x29')](function(_0x82c012){return _0x156461[_0x1420('0x6e')](_[_0x1420('0x2f')](_0x82c012[_0x1420('0x6f')]['entries'],function(_0x2f07e9){return{'id':_0x2f07e9[_0x1420('0x2c')],'name':_0x2f07e9[_0x1420('0x2c')],'type':_0x2f07e9['type'],'active':_0x2f07e9[_0x1420('0x70')],'label':_0x2f07e9[_0x1420('0x71')],'custom':!![]};}));});}})[_0x1420('0x29')](function(_0x134ebd){return{'count':_0x134ebd[_0x1420('0x3a')],'rows':_0x134ebd};})['then'](respondWithResult(_0x1ef6c3,null))[_0x1420('0x49')](function(_0x586d88){var _0x5db814=_0x4c1cb8['query'][_0x1420('0x72')]?0x1f4:_0x586d88[_0x1420('0x73')]||0x1f4;logger[_0x1420('0x2a')](_0x1420('0x74'),'getFields',_0x5db814,JSON[_0x1420('0x75')](_0x586d88));delete _0x586d88[_0x1420('0x2c')];if(_0x5db814===0x191){_0x5db814=0x190;}_0x1ef6c3[_0x1420('0x1e')](_0x5db814)[_0x1420('0x2d')](_0x4c1cb8['query']['test']?{'message':_0x1420('0x76'),'statusCode':_0x586d88['statusCode']}:_0x586d88);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cb1ac4c..c1005f7 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 _0x2268=['request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0x2268,0x19f));var _0x8226=function(_0x1111af,_0x2604c7){_0x1111af=_0x1111af-0x0;var _0x27a0c0=_0x2268[_0x1111af];return _0x27a0c0;};'use strict';var _=require(_0x8226('0x0'));var util=require(_0x8226('0x1'));var logger=require(_0x8226('0x2'))(_0x8226('0x3'));var moment=require('moment');var BPromise=require(_0x8226('0x4'));var rp=require(_0x8226('0x5'));var fs=require('fs');var path=require(_0x8226('0x6'));var rimraf=require(_0x8226('0x7'));var config=require(_0x8226('0x8'));var attributes=require(_0x8226('0x9'));var integrations=require(_0x8226('0xa'));module[_0x8226('0xb')]=function(_0x3eff12,_0xbe5abd){return _0x3eff12[_0x8226('0xc')](_0x8226('0xd'),attributes,{'tableName':_0x8226('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e0=['request-promise','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x9264dc,_0x3432ac){var _0x4ac434=function(_0x36163b){while(--_0x36163b){_0x9264dc['push'](_0x9264dc['shift']());}};_0x4ac434(++_0x3432ac);}(_0x44e0,0xc7));var _0x044e=function(_0x5a2abe,_0x53f542){_0x5a2abe=_0x5a2abe-0x0;var _0x4d945f=_0x44e0[_0x5a2abe];return _0x4d945f;};'use strict';var _=require(_0x044e('0x0'));var util=require(_0x044e('0x1'));var logger=require(_0x044e('0x2'))(_0x044e('0x3'));var moment=require('moment');var BPromise=require(_0x044e('0x4'));var rp=require(_0x044e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x044e('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x044e('0x7'));module[_0x044e('0x8')]=function(_0x32e774,_0x1aa8c6){return _0x32e774[_0x044e('0x9')](_0x044e('0xa'),attributes,{'tableName':_0x044e('0xb'),'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 078498d..d1c0c8f 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 _0xadce=['DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','map','include','model','attributes','stringify','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ac096,_0x2ff644){var _0x5de0bc=function(_0x10f449){while(--_0x10f449){_0x2ac096['push'](_0x2ac096['shift']());}};_0x5de0bc(++_0x2ff644);}(_0xadce,0x1aa));var _0xeadc=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xadce[_0x1793de];return _0x4f0309;};'use strict';var _=require(_0xeadc('0x0'));var util=require(_0xeadc('0x1'));var moment=require(_0xeadc('0x2'));var BPromise=require(_0xeadc('0x3'));var rs=require(_0xeadc('0x4'));var fs=require('fs');var Redis=require(_0xeadc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeadc('0x6'));var logger=require('../../config/logger')(_0xeadc('0x7'));var config=require(_0xeadc('0x8'));var jayson=require(_0xeadc('0x9'));var client=jayson[_0xeadc('0xa')][_0xeadc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e9bfe,_0x5aa98b,_0x330fae){return new BPromise(function(_0x498843,_0x6be5c3){return client[_0xeadc('0xc')](_0x4e9bfe,_0x330fae)[_0xeadc('0xd')](function(_0x322409){logger[_0xeadc('0xe')](_0xeadc('0xf'),_0x5aa98b,_0xeadc('0x10'));logger[_0xeadc('0x11')](_0xeadc('0x12'),_0x5aa98b,'request\x20sent',JSON['stringify'](_0x322409));if(_0x322409[_0xeadc('0x13')]){if(_0x322409[_0xeadc('0x13')][_0xeadc('0x14')]===0x1f4){logger['error'](_0xeadc('0xf'),_0x5aa98b,_0x322409[_0xeadc('0x13')][_0xeadc('0x15')]);return _0x6be5c3(_0x322409['error']['message']);}logger[_0xeadc('0x13')](_0xeadc('0xf'),_0x5aa98b,_0x322409[_0xeadc('0x13')][_0xeadc('0x15')]);return _0x498843(_0x322409['error']['message']);}else{logger['info'](_0xeadc('0xf'),_0x5aa98b,_0xeadc('0x10'));_0x498843(_0x322409[_0xeadc('0x16')][_0xeadc('0x15')]);}})[_0xeadc('0x17')](function(_0x42cadc){logger[_0xeadc('0x13')]('DeskAccount,\x20%s,\x20%s',_0x5aa98b,_0x42cadc);_0x6be5c3(_0x42cadc);});});}exports[_0xeadc('0x18')]=function(_0x46c244){var _0x37c78e=this;return new Promise(function(_0x40add2,_0x148511){return db[_0xeadc('0x19')][_0xeadc('0x1a')]({'raw':_0x46c244[_0xeadc('0x1b')]?_0x46c244[_0xeadc('0x1b')][_0xeadc('0x1c')]===undefined?!![]:![]:!![],'where':_0x46c244[_0xeadc('0x1b')]?_0x46c244[_0xeadc('0x1b')][_0xeadc('0x1d')]||null:null,'attributes':_0x46c244[_0xeadc('0x1b')]?_0x46c244[_0xeadc('0x1b')]['attributes']||null:null,'limit':_0x46c244[_0xeadc('0x1b')]?_0x46c244[_0xeadc('0x1b')][_0xeadc('0x1e')]||null:null,'include':_0x46c244[_0xeadc('0x1b')]?_0x46c244[_0xeadc('0x1b')]['include']?_[_0xeadc('0x1f')](_0x46c244[_0xeadc('0x1b')][_0xeadc('0x20')],function(_0x48007c){return{'model':db[_0x48007c[_0xeadc('0x21')]],'as':_0x48007c['as'],'attributes':_0x48007c[_0xeadc('0x22')],'include':_0x48007c[_0xeadc('0x20')]?_[_0xeadc('0x1f')](_0x48007c[_0xeadc('0x20')],function(_0x59a8c8){return{'model':db[_0x59a8c8[_0xeadc('0x21')]],'as':_0x59a8c8['as'],'attributes':_0x59a8c8[_0xeadc('0x22')],'include':_0x59a8c8[_0xeadc('0x20')]?_[_0xeadc('0x1f')](_0x59a8c8[_0xeadc('0x20')],function(_0x16e73f){return{'model':db[_0x16e73f['model']],'as':_0x16e73f['as'],'attributes':_0x16e73f[_0xeadc('0x22')]};}):[]};}):[]};}):[]:[]})[_0xeadc('0xd')](function(_0x266537){logger[_0xeadc('0xe')](_0xeadc('0x18'),_0x46c244);logger[_0xeadc('0x11')]('GetDeskAccount',_0x46c244,JSON[_0xeadc('0x23')](_0x266537));_0x40add2(_0x266537);})[_0xeadc('0x17')](function(_0x53691c){logger['error'](_0xeadc('0x18'),_0x53691c[_0xeadc('0x15')],_0x46c244);_0x148511(_0x37c78e[_0xeadc('0x13')](0x1f4,_0x53691c['message']));});});};exports['ShowDeskAccount']=function(_0x28d15f){var _0x57948c=this;return new Promise(function(_0x2ac91c,_0x319e78){return db[_0xeadc('0x19')]['find']({'raw':_0x28d15f[_0xeadc('0x1b')]?_0x28d15f[_0xeadc('0x1b')][_0xeadc('0x1c')]===undefined?!![]:![]:!![],'where':_0x28d15f[_0xeadc('0x1b')]?_0x28d15f[_0xeadc('0x1b')][_0xeadc('0x1d')]||null:null,'attributes':_0x28d15f[_0xeadc('0x1b')]?_0x28d15f[_0xeadc('0x1b')][_0xeadc('0x22')]||null:null,'include':_0x28d15f[_0xeadc('0x1b')]?_0x28d15f[_0xeadc('0x1b')][_0xeadc('0x20')]?_[_0xeadc('0x1f')](_0x28d15f['options'][_0xeadc('0x20')],function(_0x494605){return{'model':db[_0x494605[_0xeadc('0x21')]],'as':_0x494605['as'],'attributes':_0x494605[_0xeadc('0x22')],'include':_0x494605[_0xeadc('0x20')]?_[_0xeadc('0x1f')](_0x494605['include'],function(_0x7cca7){return{'model':db[_0x7cca7[_0xeadc('0x21')]],'as':_0x7cca7['as'],'attributes':_0x7cca7[_0xeadc('0x22')],'include':_0x7cca7[_0xeadc('0x20')]?_[_0xeadc('0x1f')](_0x7cca7[_0xeadc('0x20')],function(_0x1e00ce){return{'model':db[_0x1e00ce['model']],'as':_0x1e00ce['as'],'attributes':_0x1e00ce[_0xeadc('0x22')]};}):[]};}):[]};}):[]:[]})[_0xeadc('0xd')](function(_0x2d4f1d){logger[_0xeadc('0xe')](_0xeadc('0x24'),_0x28d15f);logger[_0xeadc('0x11')](_0xeadc('0x24'),_0x28d15f,JSON['stringify'](_0x2d4f1d));_0x2ac91c(_0x2d4f1d);})[_0xeadc('0x17')](function(_0x38ebfb){logger['error'](_0xeadc('0x24'),_0x38ebfb['message'],_0x28d15f);_0x319e78(_0x57948c[_0xeadc('0x13')](0x1f4,_0x38ebfb[_0xeadc('0x15')]));});});}; \ No newline at end of file +var _0x6f85=['message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowDeskAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6f85,0x105));var _0x56f8=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x6f85[_0x3a3c17];return _0xd07f21;};'use strict';var _=require(_0x56f8('0x0'));var util=require(_0x56f8('0x1'));var moment=require(_0x56f8('0x2'));var BPromise=require(_0x56f8('0x3'));var rs=require(_0x56f8('0x4'));var fs=require('fs');var Redis=require(_0x56f8('0x5'));var db=require(_0x56f8('0x6'))['db'];var utils=require(_0x56f8('0x7'));var logger=require(_0x56f8('0x8'))('rpc');var config=require(_0x56f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x56f8('0xa')][_0x56f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dae20,_0x1f4eca,_0x543783){return new BPromise(function(_0x53a357,_0x4aac07){return client['request'](_0x5dae20,_0x543783)[_0x56f8('0xc')](function(_0x15fa57){logger[_0x56f8('0xd')](_0x56f8('0xe'),_0x1f4eca,_0x56f8('0xf'));logger[_0x56f8('0x10')](_0x56f8('0x11'),_0x1f4eca,_0x56f8('0xf'),JSON['stringify'](_0x15fa57));if(_0x15fa57[_0x56f8('0x12')]){if(_0x15fa57['error']['code']===0x1f4){logger[_0x56f8('0x12')](_0x56f8('0xe'),_0x1f4eca,_0x15fa57['error'][_0x56f8('0x13')]);return _0x4aac07(_0x15fa57['error']['message']);}logger[_0x56f8('0x12')](_0x56f8('0xe'),_0x1f4eca,_0x15fa57['error'][_0x56f8('0x13')]);return _0x53a357(_0x15fa57[_0x56f8('0x12')][_0x56f8('0x13')]);}else{logger[_0x56f8('0xd')](_0x56f8('0xe'),_0x1f4eca,_0x56f8('0xf'));_0x53a357(_0x15fa57['result'][_0x56f8('0x13')]);}})[_0x56f8('0x14')](function(_0x1015ac){logger[_0x56f8('0x12')](_0x56f8('0xe'),_0x1f4eca,_0x1015ac);_0x4aac07(_0x1015ac);});});}exports[_0x56f8('0x15')]=function(_0x868727){var _0x230301=this;return new Promise(function(_0x2a2e89,_0x50598d){return db[_0x56f8('0x16')][_0x56f8('0x17')]({'raw':_0x868727[_0x56f8('0x18')]?_0x868727['options'][_0x56f8('0x19')]===undefined?!![]:![]:!![],'where':_0x868727[_0x56f8('0x18')]?_0x868727[_0x56f8('0x18')][_0x56f8('0x1a')]||null:null,'attributes':_0x868727[_0x56f8('0x18')]?_0x868727[_0x56f8('0x18')]['attributes']||null:null,'limit':_0x868727['options']?_0x868727[_0x56f8('0x18')][_0x56f8('0x1b')]||null:null,'include':_0x868727['options']?_0x868727[_0x56f8('0x18')][_0x56f8('0x1c')]?_['map'](_0x868727[_0x56f8('0x18')][_0x56f8('0x1c')],function(_0x321509){return{'model':db[_0x321509[_0x56f8('0x1d')]],'as':_0x321509['as'],'attributes':_0x321509[_0x56f8('0x1e')],'include':_0x321509[_0x56f8('0x1c')]?_[_0x56f8('0x1f')](_0x321509[_0x56f8('0x1c')],function(_0x4111ff){return{'model':db[_0x4111ff[_0x56f8('0x1d')]],'as':_0x4111ff['as'],'attributes':_0x4111ff[_0x56f8('0x1e')],'include':_0x4111ff[_0x56f8('0x1c')]?_['map'](_0x4111ff[_0x56f8('0x1c')],function(_0x5bf153){return{'model':db[_0x5bf153[_0x56f8('0x1d')]],'as':_0x5bf153['as'],'attributes':_0x5bf153[_0x56f8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x56f8('0xc')](function(_0x4718e1){logger[_0x56f8('0xd')](_0x56f8('0x15'),_0x868727);logger[_0x56f8('0x10')](_0x56f8('0x15'),_0x868727,JSON['stringify'](_0x4718e1));_0x2a2e89(_0x4718e1);})[_0x56f8('0x14')](function(_0x3a7a68){logger[_0x56f8('0x12')](_0x56f8('0x15'),_0x3a7a68['message'],_0x868727);_0x50598d(_0x230301[_0x56f8('0x12')](0x1f4,_0x3a7a68[_0x56f8('0x13')]));});});};exports[_0x56f8('0x20')]=function(_0x573c31){var _0x591c72=this;return new Promise(function(_0x4ebf91,_0xce7c25){return db[_0x56f8('0x16')][_0x56f8('0x21')]({'raw':_0x573c31[_0x56f8('0x18')]?_0x573c31['options'][_0x56f8('0x19')]===undefined?!![]:![]:!![],'where':_0x573c31[_0x56f8('0x18')]?_0x573c31['options'][_0x56f8('0x1a')]||null:null,'attributes':_0x573c31[_0x56f8('0x18')]?_0x573c31[_0x56f8('0x18')]['attributes']||null:null,'include':_0x573c31['options']?_0x573c31['options'][_0x56f8('0x1c')]?_[_0x56f8('0x1f')](_0x573c31[_0x56f8('0x18')][_0x56f8('0x1c')],function(_0x3d2d8c){return{'model':db[_0x3d2d8c[_0x56f8('0x1d')]],'as':_0x3d2d8c['as'],'attributes':_0x3d2d8c[_0x56f8('0x1e')],'include':_0x3d2d8c['include']?_['map'](_0x3d2d8c['include'],function(_0x491154){return{'model':db[_0x491154['model']],'as':_0x491154['as'],'attributes':_0x491154['attributes'],'include':_0x491154[_0x56f8('0x1c')]?_[_0x56f8('0x1f')](_0x491154['include'],function(_0x380600){return{'model':db[_0x380600[_0x56f8('0x1d')]],'as':_0x380600['as'],'attributes':_0x380600[_0x56f8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x56f8('0xc')](function(_0x16c6c8){logger[_0x56f8('0xd')]('ShowDeskAccount',_0x573c31);logger['debug'](_0x56f8('0x20'),_0x573c31,JSON[_0x56f8('0x22')](_0x16c6c8));_0x4ebf91(_0x16c6c8);})[_0x56f8('0x14')](function(_0x5344a2){logger[_0x56f8('0x12')]('ShowDeskAccount',_0x5344a2[_0x56f8('0x13')],_0x573c31);_0xce7c25(_0x591c72['error'](0x1f4,_0x5344a2[_0x56f8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 0eee24b..9f2d462 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x487f67,_0x3b08da){var _0x2f788e=function(_0x178860){while(--_0x178860){_0x487f67['push'](_0x487f67['shift']());}};_0x2f788e(++_0x3b08da);}(_0x7217,0x19e));var _0x7721=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x7217[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x55ca,0x126));var _0xa55c=function(_0x2cd8d0,_0x5ddefb){_0x2cd8d0=_0x2cd8d0-0x0;var _0x49a221=_0x55ca[_0x2cd8d0];return _0x49a221;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index b49b8cc..daa336c 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 _0x6998=['STRING','sequelize'];(function(_0x65e857,_0x3a3faf){var _0x469e3d=function(_0x5e2b61){while(--_0x5e2b61){_0x65e857['push'](_0x65e857['shift']());}};_0x469e3d(++_0x3a3faf);}(_0x6998,0xa9));var _0x8699=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0x6998[_0x43b06b];return _0x2c555b;};'use strict';var Sequelize=require(_0x8699('0x0'));module['exports']={'name':{'type':Sequelize[_0x8699('0x1')]},'description':{'type':Sequelize[_0x8699('0x1')]}}; \ No newline at end of file +var _0xb6ec=['exports','sequelize'];(function(_0x1141ad,_0x1a2ec4){var _0x1ef210=function(_0x5d65c4){while(--_0x5d65c4){_0x1141ad['push'](_0x1141ad['shift']());}};_0x1ef210(++_0x1a2ec4);}(_0xb6ec,0x9f));var _0xcb6e=function(_0x1a08e7,_0x2eb235){_0x1a08e7=_0x1a08e7-0x0;var _0x577a48=_0xb6ec[_0x1a08e7];return _0x577a48;};'use strict';var Sequelize=require(_0xcb6e('0x0'));module[_0xcb6e('0x1')]={'name':{'type':Sequelize['STRING']},'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 7eb41ed..4f1b0d8 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 _0x4f2e=['catch','show','params','intersection','include','create','body','find','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','destroy','end','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','then','findAll','rows'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4f2e,0xb9));var _0xe4f2=function(_0x201490,_0x235e70){_0x201490=_0x201490-0x0;var _0x1479df=_0x4f2e[_0x201490];return _0x1479df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4f2('0x0'));var zipdir=require(_0xe4f2('0x1'));var jsonpatch=require(_0xe4f2('0x2'));var rp=require(_0xe4f2('0x3'));var moment=require(_0xe4f2('0x4'));var BPromise=require(_0xe4f2('0x5'));var Mustache=require(_0xe4f2('0x6'));var util=require(_0xe4f2('0x7'));var path=require(_0xe4f2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe4f2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4f2('0xa'));var squel=require('squel');var crypto=require(_0xe4f2('0xb'));var jsforce=require(_0xe4f2('0xc'));var deskjs=require(_0xe4f2('0xd'));var toCsv=require(_0xe4f2('0xe'));var querystring=require(_0xe4f2('0xf'));var Papa=require('papaparse');var Redis=require(_0xe4f2('0x10'));var authService=require(_0xe4f2('0x11'));var qs=require(_0xe4f2('0x12'));var as=require(_0xe4f2('0x13'));var hardwareService=require(_0xe4f2('0x14'));var logger=require(_0xe4f2('0x15'))('api');var utils=require(_0xe4f2('0x16'));var config=require(_0xe4f2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4f2('0x18'))['db'];function respondWithStatusCode(_0x22be7f,_0x16b0a6){_0x16b0a6=_0x16b0a6||0xcc;return function(_0x438244){if(_0x438244){return _0x22be7f[_0xe4f2('0x19')](_0x16b0a6);}return _0x22be7f[_0xe4f2('0x1a')](_0x16b0a6)['end']();};}function respondWithResult(_0x2158f8,_0x5eaba7){_0x5eaba7=_0x5eaba7||0xc8;return function(_0x769a87){if(_0x769a87){return _0x2158f8[_0xe4f2('0x1a')](_0x5eaba7)[_0xe4f2('0x1b')](_0x769a87);}};}function respondWithFilteredResult(_0x3f40d5,_0x455b0d){return function(_0x4173b7){if(_0x4173b7){var _0x16d51e=typeof _0x455b0d['offset']===_0xe4f2('0x1c')&&typeof _0x455b0d['limit']===_0xe4f2('0x1c');var _0x416ffe=_0x4173b7['count'];var _0x5dae25=_0x16d51e?0x0:_0x455b0d[_0xe4f2('0x1d')];var _0x11258f=_0x16d51e?_0x4173b7[_0xe4f2('0x1e')]:_0x455b0d[_0xe4f2('0x1d')]+_0x455b0d[_0xe4f2('0x1f')];var _0x3464f1;if(_0x11258f>=_0x416ffe){_0x11258f=_0x416ffe;_0x3464f1=0xc8;}else{_0x3464f1=0xce;}_0x3f40d5[_0xe4f2('0x1a')](_0x3464f1);return _0x3f40d5[_0xe4f2('0x20')](_0xe4f2('0x21'),_0x5dae25+'-'+_0x11258f+'/'+_0x416ffe)[_0xe4f2('0x1b')](_0x4173b7);}return null;};}function patchUpdates(_0x4d3fde){return function(_0x3cda5a){try{jsonpatch['apply'](_0x3cda5a,_0x4d3fde,!![]);}catch(_0x2314fc){return BPromise[_0xe4f2('0x22')](_0x2314fc);}return _0x3cda5a[_0xe4f2('0x23')]();};}function saveUpdates(_0x596286,_0x527b70){return function(_0x38a83c){if(_0x38a83c){return _0x38a83c[_0xe4f2('0x24')](_0x596286)['then'](function(_0x25912a){return _0x25912a;});}return null;};}function removeEntity(_0x1fc9ce,_0xe86bc9){return function(_0x2af517){if(_0x2af517){return _0x2af517[_0xe4f2('0x25')]()['then'](function(){_0x1fc9ce[_0xe4f2('0x1a')](0xcc)[_0xe4f2('0x26')]();});}};}function handleEntityNotFound(_0x290358,_0x4ff090){return function(_0x4ffe8b){if(!_0x4ffe8b){_0x290358[_0xe4f2('0x19')](0x194);}return _0x4ffe8b;};}function handleError(_0x4198ba,_0x52816c){_0x52816c=_0x52816c||0x1f4;return function(_0x1b3348){logger[_0xe4f2('0x27')](_0x1b3348[_0xe4f2('0x28')]);if(_0x1b3348[_0xe4f2('0x29')]){delete _0x1b3348[_0xe4f2('0x29')];}_0x4198ba['status'](_0x52816c)[_0xe4f2('0x2a')](_0x1b3348);};}exports[_0xe4f2('0x2b')]=function(_0x314c26,_0x58f26b){var _0x2d56f4={},_0x2b8a80={},_0x445813={'count':0x0,'rows':[]};var _0x2b1cf4=_[_0xe4f2('0x2c')](db[_0xe4f2('0x2d')][_0xe4f2('0x2e')],function(_0x2fafde){return{'name':_0x2fafde[_0xe4f2('0x2f')],'type':_0x2fafde[_0xe4f2('0x30')][_0xe4f2('0x31')]};});_0x2b8a80[_0xe4f2('0x32')]=_['map'](_0x2b1cf4,'name');_0x2b8a80['query']=_[_0xe4f2('0x33')](_0x314c26['query']);_0x2b8a80['filters']=_['intersection'](_0x2b8a80[_0xe4f2('0x32')],_0x2b8a80[_0xe4f2('0x34')]);_0x2d56f4[_0xe4f2('0x35')]=_['intersection'](_0x2b8a80['model'],qs[_0xe4f2('0x36')](_0x314c26['query'][_0xe4f2('0x36')]));_0x2d56f4[_0xe4f2('0x35')]=_0x2d56f4[_0xe4f2('0x35')][_0xe4f2('0x37')]?_0x2d56f4[_0xe4f2('0x35')]:_0x2b8a80[_0xe4f2('0x32')];if(!_0x314c26[_0xe4f2('0x34')][_0xe4f2('0x38')](_0xe4f2('0x39'))){_0x2d56f4[_0xe4f2('0x1f')]=qs[_0xe4f2('0x1f')](_0x314c26['query']['limit']);_0x2d56f4[_0xe4f2('0x1d')]=qs[_0xe4f2('0x1d')](_0x314c26[_0xe4f2('0x34')]['offset']);}_0x2d56f4[_0xe4f2('0x3a')]=qs[_0xe4f2('0x3b')](_0x314c26[_0xe4f2('0x34')][_0xe4f2('0x3b')]);_0x2d56f4['where']=qs['filters'](_[_0xe4f2('0x3c')](_0x314c26[_0xe4f2('0x34')],_0x2b8a80[_0xe4f2('0x3d')]),_0x2b1cf4);if(_0x314c26['query'][_0xe4f2('0x3e')]){_0x2d56f4[_0xe4f2('0x3f')]=_[_0xe4f2('0x40')](_0x2d56f4[_0xe4f2('0x3f')],{'$or':_['map'](_0x2b1cf4,function(_0x35f312){if(_0x35f312[_0xe4f2('0x30')]!==_0xe4f2('0x41')){var _0x30dad7={};_0x30dad7[_0x35f312[_0xe4f2('0x29')]]={'$like':'%'+_0x314c26['query']['filter']+'%'};return _0x30dad7;}})});}_0x2d56f4=_[_0xe4f2('0x40')]({},_0x2d56f4,_0x314c26[_0xe4f2('0x42')]);var _0x182ee2={'where':_0x2d56f4[_0xe4f2('0x3f')]};return db[_0xe4f2('0x2d')][_0xe4f2('0x1e')](_0x182ee2)[_0xe4f2('0x43')](function(_0x21dfe5){_0x445813['count']=_0x21dfe5;if(_0x314c26[_0xe4f2('0x34')]['includeAll']){_0x2d56f4['include']=[{'all':!![]}];}return db[_0xe4f2('0x2d')][_0xe4f2('0x44')](_0x2d56f4);})[_0xe4f2('0x43')](function(_0x4cb8e8){_0x445813[_0xe4f2('0x45')]=_0x4cb8e8;return _0x445813;})[_0xe4f2('0x43')](respondWithFilteredResult(_0x58f26b,_0x2d56f4))[_0xe4f2('0x46')](handleError(_0x58f26b,null));};exports[_0xe4f2('0x47')]=function(_0x450685,_0x14d363){var _0x55d576={'raw':![],'where':{'id':_0x450685[_0xe4f2('0x48')]['id']}},_0x5dde0f={};_0x5dde0f[_0xe4f2('0x32')]=_['keys'](db[_0xe4f2('0x2d')][_0xe4f2('0x2e')]);_0x5dde0f['query']=_[_0xe4f2('0x33')](_0x450685['query']);_0x5dde0f[_0xe4f2('0x3d')]=_[_0xe4f2('0x49')](_0x5dde0f[_0xe4f2('0x32')],_0x5dde0f['query']);_0x55d576[_0xe4f2('0x35')]=_['intersection'](_0x5dde0f['model'],qs[_0xe4f2('0x36')](_0x450685['query'][_0xe4f2('0x36')]));_0x55d576['attributes']=_0x55d576[_0xe4f2('0x35')][_0xe4f2('0x37')]?_0x55d576['attributes']:_0x5dde0f['model'];if(_0x450685[_0xe4f2('0x34')]['includeAll']){_0x55d576[_0xe4f2('0x4a')]=[{'all':!![]}];}_0x55d576=_['merge']({},_0x55d576,_0x450685[_0xe4f2('0x42')]);return db[_0xe4f2('0x2d')]['find'](_0x55d576)['then'](handleEntityNotFound(_0x14d363,null))[_0xe4f2('0x43')](respondWithResult(_0x14d363,null))['catch'](handleError(_0x14d363,null));};exports['create']=function(_0xbd63b9,_0x275100){return db[_0xe4f2('0x2d')][_0xe4f2('0x4b')](_0xbd63b9[_0xe4f2('0x4c')],{})[_0xe4f2('0x43')](respondWithResult(_0x275100,0xc9))[_0xe4f2('0x46')](handleError(_0x275100,null));};exports['update']=function(_0x18d483,_0x5e8591){if(_0x18d483['body']['id']){delete _0x18d483['body']['id'];}return db[_0xe4f2('0x2d')][_0xe4f2('0x4d')]({'where':{'id':_0x18d483[_0xe4f2('0x48')]['id']}})[_0xe4f2('0x43')](handleEntityNotFound(_0x5e8591,null))[_0xe4f2('0x43')](saveUpdates(_0x18d483[_0xe4f2('0x4c')],null))[_0xe4f2('0x43')](respondWithResult(_0x5e8591,null))[_0xe4f2('0x46')](handleError(_0x5e8591,null));};exports['destroy']=function(_0x498bbb,_0x464e2a){return db['DeskConfiguration'][_0xe4f2('0x4d')]({'where':{'id':_0x498bbb['params']['id']}})[_0xe4f2('0x43')](handleEntityNotFound(_0x464e2a,null))['then'](removeEntity(_0x464e2a,null))[_0xe4f2('0x46')](handleError(_0x464e2a,null));};exports['getFields']=function(_0xcaee54,_0x1efa9f,_0x38fb11){var _0x223573={};var _0x7d1415={};var _0x115ec1;var _0xc6d9e2;return db[_0xe4f2('0x2d')][_0xe4f2('0x4e')]({'where':{'id':_0xcaee54['params']['id']}})[_0xe4f2('0x43')](handleEntityNotFound(_0x1efa9f,null))[_0xe4f2('0x43')](function(_0x46d555){if(_0x46d555){_0x115ec1=_0x46d555;_0x7d1415[_0xe4f2('0x32')]=_[_0xe4f2('0x33')](db[_0xe4f2('0x4f')][_0xe4f2('0x2e')]);_0x7d1415[_0xe4f2('0x34')]=_[_0xe4f2('0x33')](_0xcaee54[_0xe4f2('0x34')]);_0x7d1415[_0xe4f2('0x3d')]=_[_0xe4f2('0x49')](_0x7d1415[_0xe4f2('0x32')],_0x7d1415[_0xe4f2('0x34')]);_0x223573[_0xe4f2('0x35')]=_[_0xe4f2('0x49')](_0x7d1415[_0xe4f2('0x32')],qs['fields'](_0xcaee54[_0xe4f2('0x34')][_0xe4f2('0x36')]));_0x223573[_0xe4f2('0x35')]=_0x223573[_0xe4f2('0x35')][_0xe4f2('0x37')]?_0x223573[_0xe4f2('0x35')]:_0x7d1415[_0xe4f2('0x32')];_0x223573[_0xe4f2('0x3a')]=qs[_0xe4f2('0x3b')](_0xcaee54['query'][_0xe4f2('0x3b')]);_0x223573[_0xe4f2('0x3f')]=qs['filters'](_[_0xe4f2('0x3c')](_0xcaee54['query'],_0x7d1415[_0xe4f2('0x3d')]));if(_0xcaee54[_0xe4f2('0x34')][_0xe4f2('0x3e')]){_0x223573['where']=_[_0xe4f2('0x40')](_0x223573[_0xe4f2('0x3f')],{'$or':_[_0xe4f2('0x2c')](_0x223573[_0xe4f2('0x35')],function(_0x894c73){var _0x2d23e8={};_0x2d23e8[_0x894c73]={'$like':'%'+_0xcaee54['query'][_0xe4f2('0x3e')]+'%'};return _0x2d23e8;})});}_0x223573=_['merge']({},_0x223573,_0xcaee54[_0xe4f2('0x42')]);return _0x115ec1['getFields'](_0x223573);}})[_0xe4f2('0x43')](function(_0x14808f){if(_0x14808f){_0xc6d9e2=_0x14808f[_0xe4f2('0x37')];if(!_0xcaee54[_0xe4f2('0x34')][_0xe4f2('0x38')](_0xe4f2('0x39'))){_0x223573['limit']=qs['limit'](_0xcaee54[_0xe4f2('0x34')][_0xe4f2('0x1f')]);_0x223573[_0xe4f2('0x1d')]=qs['offset'](_0xcaee54[_0xe4f2('0x34')][_0xe4f2('0x1d')]);}return _0x115ec1[_0xe4f2('0x50')](_0x223573);}})['then'](function(_0x5cc8fe){if(_0x5cc8fe){return _0x5cc8fe?{'count':_0xc6d9e2,'rows':_0x5cc8fe}:null;}})['then'](respondWithResult(_0x1efa9f,null))[_0xe4f2('0x46')](handleError(_0x1efa9f,null));};exports[_0xe4f2('0x51')]=function(_0x4f1d1a,_0x97dd49,_0x3c707c){var _0xe391f4={};var _0x151fbc={};var _0x3a8fec;var _0x61be35;return db[_0xe4f2('0x2d')][_0xe4f2('0x4e')]({'where':{'id':_0x4f1d1a[_0xe4f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x97dd49,null))[_0xe4f2('0x43')](function(_0x1c1df1){if(_0x1c1df1){_0x3a8fec=_0x1c1df1;_0x151fbc[_0xe4f2('0x32')]=_['keys'](db[_0xe4f2('0x4f')][_0xe4f2('0x2e')]);_0x151fbc[_0xe4f2('0x34')]=_[_0xe4f2('0x33')](_0x4f1d1a[_0xe4f2('0x34')]);_0x151fbc[_0xe4f2('0x3d')]=_[_0xe4f2('0x49')](_0x151fbc[_0xe4f2('0x32')],_0x151fbc[_0xe4f2('0x34')]);_0xe391f4[_0xe4f2('0x35')]=_[_0xe4f2('0x49')](_0x151fbc[_0xe4f2('0x32')],qs['fields'](_0x4f1d1a['query'][_0xe4f2('0x36')]));_0xe391f4[_0xe4f2('0x35')]=_0xe391f4[_0xe4f2('0x35')][_0xe4f2('0x37')]?_0xe391f4[_0xe4f2('0x35')]:_0x151fbc[_0xe4f2('0x32')];_0xe391f4[_0xe4f2('0x3a')]=qs['sort'](_0x4f1d1a[_0xe4f2('0x34')][_0xe4f2('0x3b')]);_0xe391f4[_0xe4f2('0x3f')]=qs['filters'](_['pick'](_0x4f1d1a[_0xe4f2('0x34')],_0x151fbc['filters']));if(_0x4f1d1a['query'][_0xe4f2('0x3e')]){_0xe391f4[_0xe4f2('0x3f')]=_['merge'](_0xe391f4[_0xe4f2('0x3f')],{'$or':_[_0xe4f2('0x2c')](_0xe391f4['attributes'],function(_0x3d15aa){var _0x129bd4={};_0x129bd4[_0x3d15aa]={'$like':'%'+_0x4f1d1a[_0xe4f2('0x34')][_0xe4f2('0x3e')]+'%'};return _0x129bd4;})});}_0xe391f4=_[_0xe4f2('0x40')]({},_0xe391f4,_0x4f1d1a[_0xe4f2('0x42')]);return _0x3a8fec[_0xe4f2('0x51')](_0xe391f4);}})['then'](function(_0x593462){if(_0x593462){_0x61be35=_0x593462[_0xe4f2('0x37')];if(!_0x4f1d1a[_0xe4f2('0x34')][_0xe4f2('0x38')]('nolimit')){_0xe391f4[_0xe4f2('0x1f')]=qs[_0xe4f2('0x1f')](_0x4f1d1a[_0xe4f2('0x34')][_0xe4f2('0x1f')]);_0xe391f4['offset']=qs['offset'](_0x4f1d1a['query'][_0xe4f2('0x1d')]);}return _0x3a8fec[_0xe4f2('0x51')](_0xe391f4);}})[_0xe4f2('0x43')](function(_0x40374d){if(_0x40374d){return _0x40374d?{'count':_0x61be35,'rows':_0x40374d}:null;}})[_0xe4f2('0x43')](respondWithResult(_0x97dd49,null))[_0xe4f2('0x46')](handleError(_0x97dd49,null));};exports[_0xe4f2('0x52')]=function(_0x59f6b4,_0x8c57d2,_0x19b758){var _0x30e4e3={};var _0x28cc3e={};var _0x217836;var _0x4e6cf5;return db[_0xe4f2('0x2d')][_0xe4f2('0x4e')]({'where':{'id':_0x59f6b4[_0xe4f2('0x48')]['id']}})[_0xe4f2('0x43')](handleEntityNotFound(_0x8c57d2,null))[_0xe4f2('0x43')](function(_0x4bfc1f){if(_0x4bfc1f){_0x217836=_0x4bfc1f;_0x28cc3e['model']=_[_0xe4f2('0x33')](db[_0xe4f2('0x4f')][_0xe4f2('0x2e')]);_0x28cc3e['query']=_[_0xe4f2('0x33')](_0x59f6b4[_0xe4f2('0x34')]);_0x28cc3e['filters']=_[_0xe4f2('0x49')](_0x28cc3e['model'],_0x28cc3e[_0xe4f2('0x34')]);_0x30e4e3[_0xe4f2('0x35')]=_[_0xe4f2('0x49')](_0x28cc3e['model'],qs[_0xe4f2('0x36')](_0x59f6b4[_0xe4f2('0x34')][_0xe4f2('0x36')]));_0x30e4e3[_0xe4f2('0x35')]=_0x30e4e3[_0xe4f2('0x35')][_0xe4f2('0x37')]?_0x30e4e3[_0xe4f2('0x35')]:_0x28cc3e[_0xe4f2('0x32')];_0x30e4e3[_0xe4f2('0x3a')]=qs[_0xe4f2('0x3b')](_0x59f6b4[_0xe4f2('0x34')][_0xe4f2('0x3b')]);_0x30e4e3[_0xe4f2('0x3f')]=qs[_0xe4f2('0x3d')](_['pick'](_0x59f6b4[_0xe4f2('0x34')],_0x28cc3e['filters']));if(_0x59f6b4['query'][_0xe4f2('0x3e')]){_0x30e4e3[_0xe4f2('0x3f')]=_['merge'](_0x30e4e3['where'],{'$or':_[_0xe4f2('0x2c')](_0x30e4e3[_0xe4f2('0x35')],function(_0x49b08f){var _0x3d6828={};_0x3d6828[_0x49b08f]={'$like':'%'+_0x59f6b4[_0xe4f2('0x34')][_0xe4f2('0x3e')]+'%'};return _0x3d6828;})});}_0x30e4e3=_[_0xe4f2('0x40')]({},_0x30e4e3,_0x59f6b4[_0xe4f2('0x42')]);return _0x217836['getDescriptions'](_0x30e4e3);}})[_0xe4f2('0x43')](function(_0x41c361){if(_0x41c361){_0x4e6cf5=_0x41c361[_0xe4f2('0x37')];if(!_0x59f6b4[_0xe4f2('0x34')][_0xe4f2('0x38')](_0xe4f2('0x39'))){_0x30e4e3[_0xe4f2('0x1f')]=qs[_0xe4f2('0x1f')](_0x59f6b4[_0xe4f2('0x34')]['limit']);_0x30e4e3[_0xe4f2('0x1d')]=qs['offset'](_0x59f6b4[_0xe4f2('0x34')]['offset']);}return _0x217836[_0xe4f2('0x52')](_0x30e4e3);}})[_0xe4f2('0x43')](function(_0x1da9f9){if(_0x1da9f9){return _0x1da9f9?{'count':_0x4e6cf5,'rows':_0x1da9f9}:null;}})[_0xe4f2('0x43')](respondWithResult(_0x8c57d2,null))[_0xe4f2('0x46')](handleError(_0x8c57d2,null));};exports['getTags']=function(_0x518a19,_0x4a7386,_0x1bfb4f){var _0x3ed187={};var _0x1bb7bf={};var _0x5e7a16;var _0x20945f;return db['DeskConfiguration'][_0xe4f2('0x4e')]({'where':{'id':_0x518a19['params']['id']}})['then'](handleEntityNotFound(_0x4a7386,null))['then'](function(_0x5300c3){if(_0x5300c3){_0x5e7a16=_0x5300c3;_0x1bb7bf[_0xe4f2('0x32')]=_[_0xe4f2('0x33')](db['Tag'][_0xe4f2('0x2e')]);_0x1bb7bf[_0xe4f2('0x34')]=_[_0xe4f2('0x33')](_0x518a19['query']);_0x1bb7bf['filters']=_['intersection'](_0x1bb7bf[_0xe4f2('0x32')],_0x1bb7bf[_0xe4f2('0x34')]);_0x3ed187[_0xe4f2('0x35')]=_[_0xe4f2('0x49')](_0x1bb7bf[_0xe4f2('0x32')],qs[_0xe4f2('0x36')](_0x518a19[_0xe4f2('0x34')][_0xe4f2('0x36')]));_0x3ed187[_0xe4f2('0x35')]=_0x3ed187['attributes'][_0xe4f2('0x37')]?_0x3ed187[_0xe4f2('0x35')]:_0x1bb7bf[_0xe4f2('0x32')];_0x3ed187[_0xe4f2('0x3a')]=qs[_0xe4f2('0x3b')](_0x518a19[_0xe4f2('0x34')][_0xe4f2('0x3b')]);_0x3ed187[_0xe4f2('0x3f')]=qs[_0xe4f2('0x3d')](_[_0xe4f2('0x3c')](_0x518a19[_0xe4f2('0x34')],_0x1bb7bf[_0xe4f2('0x3d')]));if(_0x518a19[_0xe4f2('0x34')][_0xe4f2('0x3e')]){_0x3ed187[_0xe4f2('0x3f')]=_['merge'](_0x3ed187[_0xe4f2('0x3f')],{'$or':_[_0xe4f2('0x2c')](_0x3ed187[_0xe4f2('0x35')],function(_0x36cc86){var _0xb7d34a={};_0xb7d34a[_0x36cc86]={'$like':'%'+_0x518a19[_0xe4f2('0x34')][_0xe4f2('0x3e')]+'%'};return _0xb7d34a;})});}_0x3ed187=_[_0xe4f2('0x40')]({},_0x3ed187,_0x518a19[_0xe4f2('0x42')]);return _0x5e7a16['getTags'](_0x3ed187);}})[_0xe4f2('0x43')](function(_0x26c4f6){if(_0x26c4f6){_0x20945f=_0x26c4f6['length'];if(!_0x518a19['query'][_0xe4f2('0x38')](_0xe4f2('0x39'))){_0x3ed187[_0xe4f2('0x1f')]=qs['limit'](_0x518a19[_0xe4f2('0x34')][_0xe4f2('0x1f')]);_0x3ed187[_0xe4f2('0x1d')]=qs[_0xe4f2('0x1d')](_0x518a19[_0xe4f2('0x34')][_0xe4f2('0x1d')]);}return _0x5e7a16[_0xe4f2('0x53')](_0x3ed187);}})['then'](function(_0x408d7b){if(_0x408d7b){return _0x408d7b?{'count':_0x20945f,'rows':_0x408d7b}:null;}})[_0xe4f2('0x43')](respondWithResult(_0x4a7386,null))[_0xe4f2('0x46')](handleError(_0x4a7386,null));};exports['setTags']=function(_0x574960,_0xefcfad,_0x32dc66){if(_0x574960[_0xe4f2('0x4c')]['id']){delete _0x574960['body']['id'];}return db[_0xe4f2('0x2d')]['findOne']({'where':{'id':_0x574960[_0xe4f2('0x48')]['id']}})['then'](handleEntityNotFound(_0xefcfad,null))[_0xe4f2('0x43')](function(_0x5aa0f9){if(_0x5aa0f9){return _0x5aa0f9[_0xe4f2('0x54')](_0x574960[_0xe4f2('0x4c')]['ids']||[]);}return null;})['then'](respondWithResult(_0xefcfad,null))[_0xe4f2('0x46')](handleError(_0xefcfad,null));}; \ No newline at end of file +var _0xfa5e=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','options','find','create','body','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','stack','name','send','index','map','DeskConfiguration','rawAttributes'];(function(_0x4bc9bb,_0xcf6005){var _0x1777a3=function(_0x25fca1){while(--_0x25fca1){_0x4bc9bb['push'](_0x4bc9bb['shift']());}};_0x1777a3(++_0xcf6005);}(_0xfa5e,0x16a));var _0xefa5=function(_0x2cc91f,_0x278f4a){_0x2cc91f=_0x2cc91f-0x0;var _0x39ebea=_0xfa5e[_0x2cc91f];return _0x39ebea;};'use strict';var emlformat=require(_0xefa5('0x0'));var rimraf=require(_0xefa5('0x1'));var zipdir=require(_0xefa5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefa5('0x3'));var moment=require(_0xefa5('0x4'));var BPromise=require(_0xefa5('0x5'));var Mustache=require(_0xefa5('0x6'));var util=require(_0xefa5('0x7'));var path=require('path');var sox=require(_0xefa5('0x8'));var csv=require('to-csv');var ejs=require(_0xefa5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefa5('0xa'));var squel=require(_0xefa5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xefa5('0xc'));var querystring=require(_0xefa5('0xd'));var Papa=require('papaparse');var Redis=require(_0xefa5('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xefa5('0xf'));var hardwareService=require(_0xefa5('0x10'));var logger=require('../../config/logger')(_0xefa5('0x11'));var utils=require(_0xefa5('0x12'));var config=require(_0xefa5('0x13'));var licenseUtil=require(_0xefa5('0x14'));var db=require(_0xefa5('0x15'))['db'];function respondWithStatusCode(_0x18b7ab,_0x283564){_0x283564=_0x283564||0xcc;return function(_0x399bc3){if(_0x399bc3){return _0x18b7ab['sendStatus'](_0x283564);}return _0x18b7ab[_0xefa5('0x16')](_0x283564)['end']();};}function respondWithResult(_0x19d43f,_0x56f97e){_0x56f97e=_0x56f97e||0xc8;return function(_0xe30134){if(_0xe30134){return _0x19d43f[_0xefa5('0x16')](_0x56f97e)[_0xefa5('0x17')](_0xe30134);}};}function respondWithFilteredResult(_0x407d1f,_0x50f586){return function(_0x5227cb){if(_0x5227cb){var _0xa177f3=typeof _0x50f586['offset']===_0xefa5('0x18')&&typeof _0x50f586[_0xefa5('0x19')]==='undefined';var _0x33adb3=_0x5227cb['count'];var _0x229aca=_0xa177f3?0x0:_0x50f586['offset'];var _0x443fd2=_0xa177f3?_0x5227cb[_0xefa5('0x1a')]:_0x50f586['offset']+_0x50f586[_0xefa5('0x19')];var _0x44a8fd;if(_0x443fd2>=_0x33adb3){_0x443fd2=_0x33adb3;_0x44a8fd=0xc8;}else{_0x44a8fd=0xce;}_0x407d1f[_0xefa5('0x16')](_0x44a8fd);return _0x407d1f[_0xefa5('0x1b')](_0xefa5('0x1c'),_0x229aca+'-'+_0x443fd2+'/'+_0x33adb3)[_0xefa5('0x17')](_0x5227cb);}return null;};}function patchUpdates(_0x4640ea){return function(_0x3bef20){try{jsonpatch[_0xefa5('0x1d')](_0x3bef20,_0x4640ea,!![]);}catch(_0x2e26b6){return BPromise[_0xefa5('0x1e')](_0x2e26b6);}return _0x3bef20[_0xefa5('0x1f')]();};}function saveUpdates(_0x6f29fc,_0xda11d){return function(_0x298807){if(_0x298807){return _0x298807['update'](_0x6f29fc)[_0xefa5('0x20')](function(_0x31ccba){return _0x31ccba;});}return null;};}function removeEntity(_0x5a0260,_0x4b54e1){return function(_0x7ea873){if(_0x7ea873){return _0x7ea873[_0xefa5('0x21')]()[_0xefa5('0x20')](function(){_0x5a0260['status'](0xcc)[_0xefa5('0x22')]();});}};}function handleEntityNotFound(_0x1274b4,_0x3fa4a4){return function(_0xfce288){if(!_0xfce288){_0x1274b4[_0xefa5('0x23')](0x194);}return _0xfce288;};}function handleError(_0xd719e7,_0x5d8e1d){_0x5d8e1d=_0x5d8e1d||0x1f4;return function(_0x2af244){logger['error'](_0x2af244[_0xefa5('0x24')]);if(_0x2af244[_0xefa5('0x25')]){delete _0x2af244['name'];}_0xd719e7[_0xefa5('0x16')](_0x5d8e1d)[_0xefa5('0x26')](_0x2af244);};}exports[_0xefa5('0x27')]=function(_0x3e9f16,_0x4dd837){var _0x55af7a={},_0x187f4a={},_0x484178={'count':0x0,'rows':[]};var _0x28fc0b=_[_0xefa5('0x28')](db[_0xefa5('0x29')][_0xefa5('0x2a')],function(_0x17c64c){return{'name':_0x17c64c[_0xefa5('0x2b')],'type':_0x17c64c[_0xefa5('0x2c')]['key']};});_0x187f4a[_0xefa5('0x2d')]=_['map'](_0x28fc0b,_0xefa5('0x25'));_0x187f4a[_0xefa5('0x2e')]=_[_0xefa5('0x2f')](_0x3e9f16['query']);_0x187f4a[_0xefa5('0x30')]=_[_0xefa5('0x31')](_0x187f4a[_0xefa5('0x2d')],_0x187f4a[_0xefa5('0x2e')]);_0x55af7a[_0xefa5('0x32')]=_['intersection'](_0x187f4a[_0xefa5('0x2d')],qs[_0xefa5('0x33')](_0x3e9f16[_0xefa5('0x2e')][_0xefa5('0x33')]));_0x55af7a[_0xefa5('0x32')]=_0x55af7a[_0xefa5('0x32')]['length']?_0x55af7a[_0xefa5('0x32')]:_0x187f4a['model'];if(!_0x3e9f16['query'][_0xefa5('0x34')](_0xefa5('0x35'))){_0x55af7a['limit']=qs[_0xefa5('0x19')](_0x3e9f16[_0xefa5('0x2e')][_0xefa5('0x19')]);_0x55af7a[_0xefa5('0x36')]=qs['offset'](_0x3e9f16[_0xefa5('0x2e')][_0xefa5('0x36')]);}_0x55af7a['order']=qs[_0xefa5('0x37')](_0x3e9f16[_0xefa5('0x2e')][_0xefa5('0x37')]);_0x55af7a['where']=qs[_0xefa5('0x30')](_[_0xefa5('0x38')](_0x3e9f16[_0xefa5('0x2e')],_0x187f4a[_0xefa5('0x30')]),_0x28fc0b);if(_0x3e9f16['query'][_0xefa5('0x39')]){_0x55af7a[_0xefa5('0x3a')]=_[_0xefa5('0x3b')](_0x55af7a[_0xefa5('0x3a')],{'$or':_[_0xefa5('0x28')](_0x28fc0b,function(_0x166607){if(_0x166607[_0xefa5('0x2c')]!==_0xefa5('0x3c')){var _0x1809c8={};_0x1809c8[_0x166607[_0xefa5('0x25')]]={'$like':'%'+_0x3e9f16[_0xefa5('0x2e')]['filter']+'%'};return _0x1809c8;}})});}_0x55af7a=_[_0xefa5('0x3b')]({},_0x55af7a,_0x3e9f16['options']);var _0x12fea9={'where':_0x55af7a['where']};return db[_0xefa5('0x29')][_0xefa5('0x1a')](_0x12fea9)[_0xefa5('0x20')](function(_0x27ee7e){_0x484178[_0xefa5('0x1a')]=_0x27ee7e;if(_0x3e9f16['query']['includeAll']){_0x55af7a[_0xefa5('0x3d')]=[{'all':!![]}];}return db[_0xefa5('0x29')][_0xefa5('0x3e')](_0x55af7a);})[_0xefa5('0x20')](function(_0x222daa){_0x484178[_0xefa5('0x3f')]=_0x222daa;return _0x484178;})[_0xefa5('0x20')](respondWithFilteredResult(_0x4dd837,_0x55af7a))[_0xefa5('0x40')](handleError(_0x4dd837,null));};exports[_0xefa5('0x41')]=function(_0x1b5b08,_0x445c18){var _0x58a463={'raw':![],'where':{'id':_0x1b5b08[_0xefa5('0x42')]['id']}},_0x192f9e={};_0x192f9e[_0xefa5('0x2d')]=_[_0xefa5('0x2f')](db[_0xefa5('0x29')][_0xefa5('0x2a')]);_0x192f9e[_0xefa5('0x2e')]=_[_0xefa5('0x2f')](_0x1b5b08[_0xefa5('0x2e')]);_0x192f9e[_0xefa5('0x30')]=_[_0xefa5('0x31')](_0x192f9e[_0xefa5('0x2d')],_0x192f9e['query']);_0x58a463[_0xefa5('0x32')]=_[_0xefa5('0x31')](_0x192f9e[_0xefa5('0x2d')],qs[_0xefa5('0x33')](_0x1b5b08[_0xefa5('0x2e')]['fields']));_0x58a463[_0xefa5('0x32')]=_0x58a463[_0xefa5('0x32')][_0xefa5('0x43')]?_0x58a463[_0xefa5('0x32')]:_0x192f9e[_0xefa5('0x2d')];if(_0x1b5b08[_0xefa5('0x2e')]['includeAll']){_0x58a463['include']=[{'all':!![]}];}_0x58a463=_[_0xefa5('0x3b')]({},_0x58a463,_0x1b5b08[_0xefa5('0x44')]);return db[_0xefa5('0x29')][_0xefa5('0x45')](_0x58a463)[_0xefa5('0x20')](handleEntityNotFound(_0x445c18,null))['then'](respondWithResult(_0x445c18,null))['catch'](handleError(_0x445c18,null));};exports[_0xefa5('0x46')]=function(_0x5b1234,_0x4a3b9f){return db[_0xefa5('0x29')][_0xefa5('0x46')](_0x5b1234[_0xefa5('0x47')],{})['then'](respondWithResult(_0x4a3b9f,0xc9))['catch'](handleError(_0x4a3b9f,null));};exports['update']=function(_0x38c471,_0x113bc9){if(_0x38c471[_0xefa5('0x47')]['id']){delete _0x38c471['body']['id'];}return db[_0xefa5('0x29')][_0xefa5('0x45')]({'where':{'id':_0x38c471[_0xefa5('0x42')]['id']}})[_0xefa5('0x20')](handleEntityNotFound(_0x113bc9,null))[_0xefa5('0x20')](saveUpdates(_0x38c471['body'],null))[_0xefa5('0x20')](respondWithResult(_0x113bc9,null))[_0xefa5('0x40')](handleError(_0x113bc9,null));};exports['destroy']=function(_0x138d8c,_0x16f512){return db[_0xefa5('0x29')][_0xefa5('0x45')]({'where':{'id':_0x138d8c['params']['id']}})['then'](handleEntityNotFound(_0x16f512,null))[_0xefa5('0x20')](removeEntity(_0x16f512,null))[_0xefa5('0x40')](handleError(_0x16f512,null));};exports[_0xefa5('0x48')]=function(_0x3f7c33,_0xd40c59,_0x43d055){var _0x390770={};var _0x2e2d82={};var _0x4141eb;var _0x3234a6;return db[_0xefa5('0x29')][_0xefa5('0x49')]({'where':{'id':_0x3f7c33[_0xefa5('0x42')]['id']}})[_0xefa5('0x20')](handleEntityNotFound(_0xd40c59,null))[_0xefa5('0x20')](function(_0x43a0e8){if(_0x43a0e8){_0x4141eb=_0x43a0e8;_0x2e2d82['model']=_[_0xefa5('0x2f')](db[_0xefa5('0x4a')]['rawAttributes']);_0x2e2d82[_0xefa5('0x2e')]=_[_0xefa5('0x2f')](_0x3f7c33['query']);_0x2e2d82['filters']=_['intersection'](_0x2e2d82[_0xefa5('0x2d')],_0x2e2d82[_0xefa5('0x2e')]);_0x390770[_0xefa5('0x32')]=_[_0xefa5('0x31')](_0x2e2d82[_0xefa5('0x2d')],qs[_0xefa5('0x33')](_0x3f7c33['query'][_0xefa5('0x33')]));_0x390770[_0xefa5('0x32')]=_0x390770[_0xefa5('0x32')][_0xefa5('0x43')]?_0x390770[_0xefa5('0x32')]:_0x2e2d82['model'];_0x390770[_0xefa5('0x4b')]=qs[_0xefa5('0x37')](_0x3f7c33[_0xefa5('0x2e')][_0xefa5('0x37')]);_0x390770['where']=qs[_0xefa5('0x30')](_['pick'](_0x3f7c33[_0xefa5('0x2e')],_0x2e2d82[_0xefa5('0x30')]));if(_0x3f7c33[_0xefa5('0x2e')][_0xefa5('0x39')]){_0x390770[_0xefa5('0x3a')]=_[_0xefa5('0x3b')](_0x390770[_0xefa5('0x3a')],{'$or':_[_0xefa5('0x28')](_0x390770[_0xefa5('0x32')],function(_0x427f36){var _0x4426dc={};_0x4426dc[_0x427f36]={'$like':'%'+_0x3f7c33[_0xefa5('0x2e')][_0xefa5('0x39')]+'%'};return _0x4426dc;})});}_0x390770=_['merge']({},_0x390770,_0x3f7c33[_0xefa5('0x44')]);return _0x4141eb[_0xefa5('0x48')](_0x390770);}})[_0xefa5('0x20')](function(_0x59080c){if(_0x59080c){_0x3234a6=_0x59080c[_0xefa5('0x43')];if(!_0x3f7c33[_0xefa5('0x2e')][_0xefa5('0x34')]('nolimit')){_0x390770[_0xefa5('0x19')]=qs[_0xefa5('0x19')](_0x3f7c33['query'][_0xefa5('0x19')]);_0x390770[_0xefa5('0x36')]=qs[_0xefa5('0x36')](_0x3f7c33['query']['offset']);}return _0x4141eb[_0xefa5('0x48')](_0x390770);}})[_0xefa5('0x20')](function(_0x5d3c8c){if(_0x5d3c8c){return _0x5d3c8c?{'count':_0x3234a6,'rows':_0x5d3c8c}:null;}})[_0xefa5('0x20')](respondWithResult(_0xd40c59,null))[_0xefa5('0x40')](handleError(_0xd40c59,null));};exports[_0xefa5('0x4c')]=function(_0x162e95,_0x34dd94,_0x24b7f5){var _0x57eb42={};var _0xa9dd85={};var _0x104874;var _0x222a65;return db[_0xefa5('0x29')]['findOne']({'where':{'id':_0x162e95[_0xefa5('0x42')]['id']}})[_0xefa5('0x20')](handleEntityNotFound(_0x34dd94,null))[_0xefa5('0x20')](function(_0xb5c9f6){if(_0xb5c9f6){_0x104874=_0xb5c9f6;_0xa9dd85['model']=_[_0xefa5('0x2f')](db['DeskField'][_0xefa5('0x2a')]);_0xa9dd85[_0xefa5('0x2e')]=_['keys'](_0x162e95['query']);_0xa9dd85[_0xefa5('0x30')]=_[_0xefa5('0x31')](_0xa9dd85[_0xefa5('0x2d')],_0xa9dd85['query']);_0x57eb42[_0xefa5('0x32')]=_[_0xefa5('0x31')](_0xa9dd85[_0xefa5('0x2d')],qs['fields'](_0x162e95[_0xefa5('0x2e')][_0xefa5('0x33')]));_0x57eb42[_0xefa5('0x32')]=_0x57eb42['attributes'][_0xefa5('0x43')]?_0x57eb42[_0xefa5('0x32')]:_0xa9dd85[_0xefa5('0x2d')];_0x57eb42[_0xefa5('0x4b')]=qs[_0xefa5('0x37')](_0x162e95[_0xefa5('0x2e')][_0xefa5('0x37')]);_0x57eb42['where']=qs[_0xefa5('0x30')](_[_0xefa5('0x38')](_0x162e95['query'],_0xa9dd85['filters']));if(_0x162e95['query'][_0xefa5('0x39')]){_0x57eb42[_0xefa5('0x3a')]=_['merge'](_0x57eb42['where'],{'$or':_[_0xefa5('0x28')](_0x57eb42[_0xefa5('0x32')],function(_0x2604a4){var _0x134941={};_0x134941[_0x2604a4]={'$like':'%'+_0x162e95[_0xefa5('0x2e')][_0xefa5('0x39')]+'%'};return _0x134941;})});}_0x57eb42=_['merge']({},_0x57eb42,_0x162e95[_0xefa5('0x44')]);return _0x104874[_0xefa5('0x4c')](_0x57eb42);}})[_0xefa5('0x20')](function(_0x2f36c5){if(_0x2f36c5){_0x222a65=_0x2f36c5[_0xefa5('0x43')];if(!_0x162e95[_0xefa5('0x2e')][_0xefa5('0x34')](_0xefa5('0x35'))){_0x57eb42['limit']=qs['limit'](_0x162e95[_0xefa5('0x2e')][_0xefa5('0x19')]);_0x57eb42[_0xefa5('0x36')]=qs[_0xefa5('0x36')](_0x162e95[_0xefa5('0x2e')]['offset']);}return _0x104874[_0xefa5('0x4c')](_0x57eb42);}})[_0xefa5('0x20')](function(_0x45e3f2){if(_0x45e3f2){return _0x45e3f2?{'count':_0x222a65,'rows':_0x45e3f2}:null;}})['then'](respondWithResult(_0x34dd94,null))[_0xefa5('0x40')](handleError(_0x34dd94,null));};exports[_0xefa5('0x4d')]=function(_0x16cb17,_0x5220c6,_0x42faa7){var _0x191fae={};var _0x4bf369={};var _0x5c092d;var _0x1cb5a0;return db[_0xefa5('0x29')][_0xefa5('0x49')]({'where':{'id':_0x16cb17[_0xefa5('0x42')]['id']}})[_0xefa5('0x20')](handleEntityNotFound(_0x5220c6,null))['then'](function(_0x4594f5){if(_0x4594f5){_0x5c092d=_0x4594f5;_0x4bf369[_0xefa5('0x2d')]=_[_0xefa5('0x2f')](db[_0xefa5('0x4a')][_0xefa5('0x2a')]);_0x4bf369[_0xefa5('0x2e')]=_['keys'](_0x16cb17[_0xefa5('0x2e')]);_0x4bf369[_0xefa5('0x30')]=_['intersection'](_0x4bf369[_0xefa5('0x2d')],_0x4bf369[_0xefa5('0x2e')]);_0x191fae['attributes']=_['intersection'](_0x4bf369[_0xefa5('0x2d')],qs[_0xefa5('0x33')](_0x16cb17[_0xefa5('0x2e')]['fields']));_0x191fae[_0xefa5('0x32')]=_0x191fae[_0xefa5('0x32')]['length']?_0x191fae[_0xefa5('0x32')]:_0x4bf369[_0xefa5('0x2d')];_0x191fae[_0xefa5('0x4b')]=qs[_0xefa5('0x37')](_0x16cb17[_0xefa5('0x2e')][_0xefa5('0x37')]);_0x191fae[_0xefa5('0x3a')]=qs[_0xefa5('0x30')](_[_0xefa5('0x38')](_0x16cb17[_0xefa5('0x2e')],_0x4bf369['filters']));if(_0x16cb17['query'][_0xefa5('0x39')]){_0x191fae[_0xefa5('0x3a')]=_[_0xefa5('0x3b')](_0x191fae[_0xefa5('0x3a')],{'$or':_[_0xefa5('0x28')](_0x191fae[_0xefa5('0x32')],function(_0x3fdbae){var _0x322628={};_0x322628[_0x3fdbae]={'$like':'%'+_0x16cb17[_0xefa5('0x2e')]['filter']+'%'};return _0x322628;})});}_0x191fae=_[_0xefa5('0x3b')]({},_0x191fae,_0x16cb17['options']);return _0x5c092d[_0xefa5('0x4d')](_0x191fae);}})[_0xefa5('0x20')](function(_0x31d84a){if(_0x31d84a){_0x1cb5a0=_0x31d84a[_0xefa5('0x43')];if(!_0x16cb17[_0xefa5('0x2e')][_0xefa5('0x34')](_0xefa5('0x35'))){_0x191fae[_0xefa5('0x19')]=qs['limit'](_0x16cb17[_0xefa5('0x2e')]['limit']);_0x191fae['offset']=qs['offset'](_0x16cb17[_0xefa5('0x2e')][_0xefa5('0x36')]);}return _0x5c092d['getDescriptions'](_0x191fae);}})['then'](function(_0x17189a){if(_0x17189a){return _0x17189a?{'count':_0x1cb5a0,'rows':_0x17189a}:null;}})[_0xefa5('0x20')](respondWithResult(_0x5220c6,null))[_0xefa5('0x40')](handleError(_0x5220c6,null));};exports[_0xefa5('0x4e')]=function(_0x10da63,_0x35e20b,_0x2bdb4c){var _0x72048c={};var _0x23c390={};var _0x50af96;var _0x132984;return db[_0xefa5('0x29')][_0xefa5('0x49')]({'where':{'id':_0x10da63[_0xefa5('0x42')]['id']}})[_0xefa5('0x20')](handleEntityNotFound(_0x35e20b,null))[_0xefa5('0x20')](function(_0x4296ce){if(_0x4296ce){_0x50af96=_0x4296ce;_0x23c390[_0xefa5('0x2d')]=_[_0xefa5('0x2f')](db['Tag'][_0xefa5('0x2a')]);_0x23c390['query']=_[_0xefa5('0x2f')](_0x10da63[_0xefa5('0x2e')]);_0x23c390[_0xefa5('0x30')]=_[_0xefa5('0x31')](_0x23c390[_0xefa5('0x2d')],_0x23c390[_0xefa5('0x2e')]);_0x72048c[_0xefa5('0x32')]=_['intersection'](_0x23c390['model'],qs[_0xefa5('0x33')](_0x10da63[_0xefa5('0x2e')][_0xefa5('0x33')]));_0x72048c[_0xefa5('0x32')]=_0x72048c['attributes']['length']?_0x72048c['attributes']:_0x23c390[_0xefa5('0x2d')];_0x72048c['order']=qs[_0xefa5('0x37')](_0x10da63[_0xefa5('0x2e')][_0xefa5('0x37')]);_0x72048c[_0xefa5('0x3a')]=qs['filters'](_[_0xefa5('0x38')](_0x10da63[_0xefa5('0x2e')],_0x23c390['filters']));if(_0x10da63['query'][_0xefa5('0x39')]){_0x72048c[_0xefa5('0x3a')]=_[_0xefa5('0x3b')](_0x72048c[_0xefa5('0x3a')],{'$or':_[_0xefa5('0x28')](_0x72048c[_0xefa5('0x32')],function(_0x8e7cf3){var _0x506a78={};_0x506a78[_0x8e7cf3]={'$like':'%'+_0x10da63[_0xefa5('0x2e')]['filter']+'%'};return _0x506a78;})});}_0x72048c=_['merge']({},_0x72048c,_0x10da63[_0xefa5('0x44')]);return _0x50af96[_0xefa5('0x4e')](_0x72048c);}})[_0xefa5('0x20')](function(_0x12463c){if(_0x12463c){_0x132984=_0x12463c[_0xefa5('0x43')];if(!_0x10da63[_0xefa5('0x2e')][_0xefa5('0x34')]('nolimit')){_0x72048c[_0xefa5('0x19')]=qs['limit'](_0x10da63[_0xefa5('0x2e')][_0xefa5('0x19')]);_0x72048c[_0xefa5('0x36')]=qs['offset'](_0x10da63[_0xefa5('0x2e')][_0xefa5('0x36')]);}return _0x50af96[_0xefa5('0x4e')](_0x72048c);}})[_0xefa5('0x20')](function(_0x15f4bc){if(_0x15f4bc){return _0x15f4bc?{'count':_0x132984,'rows':_0x15f4bc}:null;}})[_0xefa5('0x20')](respondWithResult(_0x35e20b,null))[_0xefa5('0x40')](handleError(_0x35e20b,null));};exports[_0xefa5('0x4f')]=function(_0x2882cc,_0x1ccb22,_0x4d988e){if(_0x2882cc[_0xefa5('0x47')]['id']){delete _0x2882cc[_0xefa5('0x47')]['id'];}return db[_0xefa5('0x29')][_0xefa5('0x49')]({'where':{'id':_0x2882cc[_0xefa5('0x42')]['id']}})[_0xefa5('0x20')](handleEntityNotFound(_0x1ccb22,null))['then'](function(_0x4adcb2){if(_0x4adcb2){return _0x4adcb2[_0xefa5('0x4f')](_0x2882cc['body'][_0xefa5('0x50')]||[]);}return null;})[_0xefa5('0x20')](respondWithResult(_0x1ccb22,null))[_0xefa5('0x40')](handleError(_0x1ccb22,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8b6a097..89a5ffe 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 _0xff3f=['./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x80ab9e,_0x32c636){var _0x7605e6=function(_0x207f0d){while(--_0x207f0d){_0x80ab9e['push'](_0x80ab9e['shift']());}};_0x7605e6(++_0x32c636);}(_0xff3f,0x190));var _0xfff3=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xff3f[_0x4ea413];return _0x51cf25;};'use strict';var _=require(_0xfff3('0x0'));var util=require(_0xfff3('0x1'));var logger=require(_0xfff3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfff3('0x3'));var rp=require(_0xfff3('0x4'));var fs=require('fs');var path=require(_0xfff3('0x5'));var rimraf=require(_0xfff3('0x6'));var config=require(_0xfff3('0x7'));var attributes=require(_0xfff3('0x8'));module[_0xfff3('0x9')]=function(_0x3463ee,_0x96c9c){return _0x3463ee['define'](_0xfff3('0xa'),attributes,{'tableName':_0xfff3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd70=['../../config/environment','exports','define','DeskConfiguration','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x45be52,_0x46d496){var _0x15294f=function(_0x3fa77d){while(--_0x3fa77d){_0x45be52['push'](_0x45be52['shift']());}};_0x15294f(++_0x46d496);}(_0xcd70,0xb8));var _0x0cd7=function(_0x2266e6,_0x1c781f){_0x2266e6=_0x2266e6-0x0;var _0x346c55=_0xcd70[_0x2266e6];return _0x346c55;};'use strict';var _=require('lodash');var util=require(_0x0cd7('0x0'));var logger=require(_0x0cd7('0x1'))(_0x0cd7('0x2'));var moment=require('moment');var BPromise=require(_0x0cd7('0x3'));var rp=require(_0x0cd7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cd7('0x5'));var config=require(_0x0cd7('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x0cd7('0x7')]=function(_0x5bca74,_0x37f036){return _0x5bca74[_0x0cd7('0x8')](_0x0cd7('0x9'),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 217d3d8..174e460 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 _0x9627=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9627,0x8a));var _0x7962=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x9627[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x7962('0x0'));var util=require('util');var moment=require(_0x7962('0x1'));var BPromise=require(_0x7962('0x2'));var rs=require(_0x7962('0x3'));var fs=require('fs');var Redis=require(_0x7962('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7962('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7962('0x6'));var jayson=require(_0x7962('0x7'));var client=jayson[_0x7962('0x8')][_0x7962('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34202a,_0x54b615,_0xcaa306){return new BPromise(function(_0x1446d1,_0x27072f){return client[_0x7962('0xa')](_0x34202a,_0xcaa306)[_0x7962('0xb')](function(_0x6e25f5){logger[_0x7962('0xc')](_0x7962('0xd'),_0x54b615,_0x7962('0xe'));logger[_0x7962('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x54b615,_0x7962('0xe'),JSON[_0x7962('0x10')](_0x6e25f5));if(_0x6e25f5[_0x7962('0x11')]){if(_0x6e25f5[_0x7962('0x11')][_0x7962('0x12')]===0x1f4){logger[_0x7962('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x54b615,_0x6e25f5[_0x7962('0x11')][_0x7962('0x13')]);return _0x27072f(_0x6e25f5[_0x7962('0x11')]['message']);}logger[_0x7962('0x11')](_0x7962('0xd'),_0x54b615,_0x6e25f5[_0x7962('0x11')][_0x7962('0x13')]);return _0x1446d1(_0x6e25f5[_0x7962('0x11')][_0x7962('0x13')]);}else{logger[_0x7962('0xc')](_0x7962('0xd'),_0x54b615,_0x7962('0xe'));_0x1446d1(_0x6e25f5[_0x7962('0x14')][_0x7962('0x13')]);}})[_0x7962('0x15')](function(_0x390fc8){logger[_0x7962('0x11')](_0x7962('0xd'),_0x54b615,_0x390fc8);_0x27072f(_0x390fc8);});});} \ No newline at end of file +var _0x96be=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x12b595,_0x57fbb7){var _0x3f7c8b=function(_0x10c024){while(--_0x10c024){_0x12b595['push'](_0x12b595['shift']());}};_0x3f7c8b(++_0x57fbb7);}(_0x96be,0x1c9));var _0xe96b=function(_0x4ec7fe,_0x1fb3b0){_0x4ec7fe=_0x4ec7fe-0x0;var _0x712b89=_0x96be[_0x4ec7fe];return _0x712b89;};'use strict';var _=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var moment=require(_0xe96b('0x2'));var BPromise=require(_0xe96b('0x3'));var rs=require(_0xe96b('0x4'));var fs=require('fs');var Redis=require(_0xe96b('0x5'));var db=require(_0xe96b('0x6'))['db'];var utils=require(_0xe96b('0x7'));var logger=require(_0xe96b('0x8'))(_0xe96b('0x9'));var config=require(_0xe96b('0xa'));var jayson=require(_0xe96b('0xb'));var client=jayson[_0xe96b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ba98b,_0x4ffa3b,_0x57656b){return new BPromise(function(_0x18e309,_0x332b95){return client['request'](_0x5ba98b,_0x57656b)['then'](function(_0x48b02c){logger[_0xe96b('0xd')](_0xe96b('0xe'),_0x4ffa3b,_0xe96b('0xf'));logger[_0xe96b('0x10')](_0xe96b('0x11'),_0x4ffa3b,_0xe96b('0xf'),JSON[_0xe96b('0x12')](_0x48b02c));if(_0x48b02c[_0xe96b('0x13')]){if(_0x48b02c['error'][_0xe96b('0x14')]===0x1f4){logger[_0xe96b('0x13')](_0xe96b('0xe'),_0x4ffa3b,_0x48b02c[_0xe96b('0x13')][_0xe96b('0x15')]);return _0x332b95(_0x48b02c['error'][_0xe96b('0x15')]);}logger[_0xe96b('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4ffa3b,_0x48b02c[_0xe96b('0x13')][_0xe96b('0x15')]);return _0x18e309(_0x48b02c[_0xe96b('0x13')][_0xe96b('0x15')]);}else{logger[_0xe96b('0xd')](_0xe96b('0xe'),_0x4ffa3b,'request\x20sent');_0x18e309(_0x48b02c[_0xe96b('0x16')][_0xe96b('0x15')]);}})[_0xe96b('0x17')](function(_0x189296){logger['error'](_0xe96b('0xe'),_0x4ffa3b,_0x189296);_0x332b95(_0x189296);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 03410ca..a949460 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 _0x7757=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7757,0x12b));var _0x7775=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7757[_0x4baae2];return _0x1a2285;};'use strict';var multer=require('multer');var util=require(_0x7775('0x0'));var path=require(_0x7775('0x1'));var timeout=require(_0x7775('0x2'));var express=require(_0x7775('0x3'));var router=express[_0x7775('0x4')]();var fs_extra=require(_0x7775('0x5'));var auth=require(_0x7775('0x6'));var interaction=require(_0x7775('0x7'));var config=require('../../config/environment');var controller=require(_0x7775('0x8'));router[_0x7775('0x9')]('/',auth['isAuthenticated'](),controller[_0x7775('0xa')]);router[_0x7775('0x9')](_0x7775('0xb'),auth[_0x7775('0xc')](),controller[_0x7775('0xd')]);router[_0x7775('0xe')]('/',auth['isAuthenticated'](),controller[_0x7775('0xf')]);router[_0x7775('0x10')](_0x7775('0xb'),auth[_0x7775('0xc')](),controller['update']);router[_0x7775('0x11')](_0x7775('0xb'),auth[_0x7775('0xc')](),controller[_0x7775('0x12')]);module[_0x7775('0x13')]=router; \ No newline at end of file +var _0xafcd=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','show'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xafcd,0x157));var _0xdafc=function(_0x1f8a2a,_0x906b0f){_0x1f8a2a=_0x1f8a2a-0x0;var _0x4dcaa7=_0xafcd[_0x1f8a2a];return _0x4dcaa7;};'use strict';var multer=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var path=require(_0xdafc('0x2'));var timeout=require(_0xdafc('0x3'));var express=require(_0xdafc('0x4'));var router=express[_0xdafc('0x5')]();var fs_extra=require(_0xdafc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdafc('0x7'));var config=require(_0xdafc('0x8'));var controller=require(_0xdafc('0x9'));router['get']('/',auth[_0xdafc('0xa')](),controller[_0xdafc('0xb')]);router[_0xdafc('0xc')]('/:id',auth[_0xdafc('0xa')](),controller[_0xdafc('0xd')]);router[_0xdafc('0xe')]('/',auth[_0xdafc('0xa')](),controller[_0xdafc('0xf')]);router[_0xdafc('0x10')](_0xdafc('0x11'),auth[_0xdafc('0xa')](),controller[_0xdafc('0x12')]);router[_0xdafc('0x13')](_0xdafc('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xdafc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5704a4b..39032a6 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 _0x75c7=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','string','variable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x75c7,0xee));var _0x775c=function(_0x1cc4c1,_0x41ec38){_0x1cc4c1=_0x1cc4c1-0x0;var _0x4e840d=_0x75c7[_0x1cc4c1];return _0x4e840d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x775c('0x0'),_0x775c('0x1'),_0x775c('0x2'),_0x775c('0x3'),_0x775c('0x4')),'defaultValue':_0x775c('0x0')},'content':{'type':Sequelize[_0x775c('0x5')]},'key':{'type':Sequelize[_0x775c('0x5')]},'keyType':{'type':Sequelize[_0x775c('0x6')](_0x775c('0x0'),_0x775c('0x1'),_0x775c('0x2'))},'keyContent':{'type':Sequelize[_0x775c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x775c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x775c('0x5')]}}; \ No newline at end of file +var _0x8093=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x52d7df,_0x5d5742){var _0x6163fc=function(_0x79d617){while(--_0x79d617){_0x52d7df['push'](_0x52d7df['shift']());}};_0x6163fc(++_0x5d5742);}(_0x8093,0x14f));var _0x3809=function(_0x510347,_0xdf770a){_0x510347=_0x510347-0x0;var _0x5cb84f=_0x8093[_0x510347];return _0x5cb84f;};'use strict';var Sequelize=require(_0x3809('0x0'));module[_0x3809('0x1')]={'type':{'type':Sequelize[_0x3809('0x2')](_0x3809('0x3'),_0x3809('0x4'),'customVariable',_0x3809('0x5'),_0x3809('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3809('0x7')]},'key':{'type':Sequelize[_0x3809('0x7')]},'keyType':{'type':Sequelize[_0x3809('0x2')](_0x3809('0x3'),'variable',_0x3809('0x8'))},'keyContent':{'type':Sequelize[_0x3809('0x7')]},'idField':{'type':Sequelize[_0x3809('0x7')]},'nameField':{'type':Sequelize[_0x3809('0x7')]},'customField':{'type':Sequelize[_0x3809('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 1977843..800a4cd 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 _0x972c=['query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','type','key','model'];(function(_0x3d90b4,_0x1e2fc6){var _0x4c65d3=function(_0x311abc){while(--_0x311abc){_0x3d90b4['push'](_0x3d90b4['shift']());}};_0x4c65d3(++_0x1e2fc6);}(_0x972c,0xf2));var _0xc972=function(_0x4afb9a,_0x2221a4){_0x4afb9a=_0x4afb9a-0x0;var _0x221c13=_0x972c[_0x4afb9a];return _0x221c13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc972('0x0'));var jsonpatch=require(_0xc972('0x1'));var rp=require('request-promise');var moment=require(_0xc972('0x2'));var BPromise=require(_0xc972('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc972('0x4'));var sox=require(_0xc972('0x5'));var csv=require(_0xc972('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc972('0x7'));var _=require('lodash');var squel=require(_0xc972('0x8'));var crypto=require(_0xc972('0x9'));var jsforce=require(_0xc972('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc972('0xb'));var Redis=require('ioredis');var authService=require(_0xc972('0xc'));var qs=require(_0xc972('0xd'));var as=require(_0xc972('0xe'));var hardwareService=require(_0xc972('0xf'));var logger=require(_0xc972('0x10'))(_0xc972('0x11'));var utils=require(_0xc972('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc972('0x13'));var db=require(_0xc972('0x14'))['db'];function respondWithStatusCode(_0x27851c,_0x5829ab){_0x5829ab=_0x5829ab||0xcc;return function(_0x3623ca){if(_0x3623ca){return _0x27851c[_0xc972('0x15')](_0x5829ab);}return _0x27851c[_0xc972('0x16')](_0x5829ab)['end']();};}function respondWithResult(_0x37786e,_0x298f92){_0x298f92=_0x298f92||0xc8;return function(_0x3aa39d){if(_0x3aa39d){return _0x37786e[_0xc972('0x16')](_0x298f92)['json'](_0x3aa39d);}};}function respondWithFilteredResult(_0x665f8f,_0x3d519e){return function(_0x2b20d2){if(_0x2b20d2){var _0x341564=typeof _0x3d519e[_0xc972('0x17')]===_0xc972('0x18')&&typeof _0x3d519e[_0xc972('0x19')]===_0xc972('0x18');var _0x3a7521=_0x2b20d2[_0xc972('0x1a')];var _0x2bfe0e=_0x341564?0x0:_0x3d519e[_0xc972('0x17')];var _0x214417=_0x341564?_0x2b20d2[_0xc972('0x1a')]:_0x3d519e[_0xc972('0x17')]+_0x3d519e[_0xc972('0x19')];var _0x4a2b5f;if(_0x214417>=_0x3a7521){_0x214417=_0x3a7521;_0x4a2b5f=0xc8;}else{_0x4a2b5f=0xce;}_0x665f8f[_0xc972('0x16')](_0x4a2b5f);return _0x665f8f[_0xc972('0x1b')](_0xc972('0x1c'),_0x2bfe0e+'-'+_0x214417+'/'+_0x3a7521)[_0xc972('0x1d')](_0x2b20d2);}return null;};}function patchUpdates(_0x486340){return function(_0x5e1b06){try{jsonpatch[_0xc972('0x1e')](_0x5e1b06,_0x486340,!![]);}catch(_0x3c4b7c){return BPromise['reject'](_0x3c4b7c);}return _0x5e1b06[_0xc972('0x1f')]();};}function saveUpdates(_0x3fdacf,_0x10c6ce){return function(_0x331338){if(_0x331338){return _0x331338[_0xc972('0x20')](_0x3fdacf)[_0xc972('0x21')](function(_0x59cae4){return _0x59cae4;});}return null;};}function removeEntity(_0x11a9f1,_0x5d11e4){return function(_0x5f0c94){if(_0x5f0c94){return _0x5f0c94[_0xc972('0x22')]()[_0xc972('0x21')](function(){_0x11a9f1[_0xc972('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9bed,_0x47332e){return function(_0xf115da){if(!_0xf115da){_0x1f9bed[_0xc972('0x15')](0x194);}return _0xf115da;};}function handleError(_0x228f99,_0x2497d9){_0x2497d9=_0x2497d9||0x1f4;return function(_0x33ced1){logger[_0xc972('0x23')](_0x33ced1[_0xc972('0x24')]);if(_0x33ced1[_0xc972('0x25')]){delete _0x33ced1[_0xc972('0x25')];}_0x228f99[_0xc972('0x16')](_0x2497d9)[_0xc972('0x26')](_0x33ced1);};}exports[_0xc972('0x27')]=function(_0x5ad71d,_0x1203a8){var _0x481026={},_0x164d52={},_0x4efef1={'count':0x0,'rows':[]};var _0x26aa4c=_[_0xc972('0x28')](db[_0xc972('0x29')][_0xc972('0x2a')],function(_0x166779){return{'name':_0x166779['fieldName'],'type':_0x166779[_0xc972('0x2b')][_0xc972('0x2c')]};});_0x164d52[_0xc972('0x2d')]=_[_0xc972('0x28')](_0x26aa4c,'name');_0x164d52[_0xc972('0x2e')]=_[_0xc972('0x2f')](_0x5ad71d['query']);_0x164d52['filters']=_['intersection'](_0x164d52['model'],_0x164d52[_0xc972('0x2e')]);_0x481026['attributes']=_[_0xc972('0x30')](_0x164d52['model'],qs['fields'](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x31')]));_0x481026[_0xc972('0x32')]=_0x481026['attributes'][_0xc972('0x33')]?_0x481026['attributes']:_0x164d52[_0xc972('0x2d')];if(!_0x5ad71d[_0xc972('0x2e')]['hasOwnProperty'](_0xc972('0x34'))){_0x481026[_0xc972('0x19')]=qs[_0xc972('0x19')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x19')]);_0x481026[_0xc972('0x17')]=qs[_0xc972('0x17')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x17')]);}_0x481026[_0xc972('0x35')]=qs[_0xc972('0x36')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x36')]);_0x481026[_0xc972('0x37')]=qs[_0xc972('0x38')](_[_0xc972('0x39')](_0x5ad71d[_0xc972('0x2e')],_0x164d52[_0xc972('0x38')]),_0x26aa4c);if(_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3a')]){_0x481026[_0xc972('0x37')]=_['merge'](_0x481026[_0xc972('0x37')],{'$or':_[_0xc972('0x28')](_0x26aa4c,function(_0x4880f7){if(_0x4880f7[_0xc972('0x2b')]!==_0xc972('0x3b')){var _0x255fcf={};_0x255fcf[_0x4880f7[_0xc972('0x25')]]={'$like':'%'+_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3a')]+'%'};return _0x255fcf;}})});}_0x481026=_[_0xc972('0x3c')]({},_0x481026,_0x5ad71d[_0xc972('0x3d')]);var _0x4bb412={'where':_0x481026[_0xc972('0x37')]};return db[_0xc972('0x29')]['count'](_0x4bb412)[_0xc972('0x21')](function(_0x1bc249){_0x4efef1[_0xc972('0x1a')]=_0x1bc249;if(_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3e')]){_0x481026['include']=[{'all':!![]}];}return db['DeskField'][_0xc972('0x3f')](_0x481026);})[_0xc972('0x21')](function(_0x483f11){_0x4efef1[_0xc972('0x40')]=_0x483f11;return _0x4efef1;})[_0xc972('0x21')](respondWithFilteredResult(_0x1203a8,_0x481026))[_0xc972('0x41')](handleError(_0x1203a8,null));};exports[_0xc972('0x42')]=function(_0x3edc1e,_0x498a43){var _0x1f0d3f={'raw':!![],'where':{'id':_0x3edc1e[_0xc972('0x43')]['id']}},_0x21830b={};_0x21830b[_0xc972('0x2d')]=_[_0xc972('0x2f')](db[_0xc972('0x29')][_0xc972('0x2a')]);_0x21830b[_0xc972('0x2e')]=_[_0xc972('0x2f')](_0x3edc1e['query']);_0x21830b[_0xc972('0x38')]=_[_0xc972('0x30')](_0x21830b['model'],_0x21830b['query']);_0x1f0d3f['attributes']=_['intersection'](_0x21830b[_0xc972('0x2d')],qs[_0xc972('0x31')](_0x3edc1e[_0xc972('0x2e')][_0xc972('0x31')]));_0x1f0d3f[_0xc972('0x32')]=_0x1f0d3f[_0xc972('0x32')][_0xc972('0x33')]?_0x1f0d3f[_0xc972('0x32')]:_0x21830b['model'];if(_0x3edc1e[_0xc972('0x2e')][_0xc972('0x3e')]){_0x1f0d3f[_0xc972('0x44')]=[{'all':!![]}];}_0x1f0d3f=_[_0xc972('0x3c')]({},_0x1f0d3f,_0x3edc1e[_0xc972('0x3d')]);return db[_0xc972('0x29')][_0xc972('0x45')](_0x1f0d3f)['then'](handleEntityNotFound(_0x498a43,null))[_0xc972('0x21')](respondWithResult(_0x498a43,null))[_0xc972('0x41')](handleError(_0x498a43,null));};exports['create']=function(_0x48bcbf,_0x215e81){return db['DeskField'][_0xc972('0x46')](_0x48bcbf[_0xc972('0x47')],{})[_0xc972('0x21')](respondWithResult(_0x215e81,0xc9))[_0xc972('0x41')](handleError(_0x215e81,null));};exports[_0xc972('0x20')]=function(_0x2e921d,_0x2e2afe){if(_0x2e921d['body']['id']){delete _0x2e921d[_0xc972('0x47')]['id'];}return db[_0xc972('0x29')]['find']({'where':{'id':_0x2e921d[_0xc972('0x43')]['id']}})[_0xc972('0x21')](handleEntityNotFound(_0x2e2afe,null))[_0xc972('0x21')](saveUpdates(_0x2e921d[_0xc972('0x47')],null))['then'](respondWithResult(_0x2e2afe,null))['catch'](handleError(_0x2e2afe,null));};exports[_0xc972('0x22')]=function(_0x384ff4,_0x398be7){return db[_0xc972('0x29')][_0xc972('0x45')]({'where':{'id':_0x384ff4[_0xc972('0x43')]['id']}})['then'](handleEntityNotFound(_0x398be7,null))[_0xc972('0x21')](removeEntity(_0x398be7,null))[_0xc972('0x41')](handleError(_0x398be7,null));}; \ No newline at end of file +var _0x1d63=['rows','show','params','include','find','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','DeskField','includeAll','findAll'];(function(_0x579042,_0x5a356f){var _0x3546af=function(_0x5a2689){while(--_0x5a2689){_0x579042['push'](_0x579042['shift']());}};_0x3546af(++_0x5a356f);}(_0x1d63,0x16f));var _0x31d6=function(_0x98a5b9,_0x554b4c){_0x98a5b9=_0x98a5b9-0x0;var _0x16f343=_0x1d63[_0x98a5b9];return _0x16f343;};'use strict';var emlformat=require(_0x31d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31d6('0x1'));var jsonpatch=require(_0x31d6('0x2'));var rp=require(_0x31d6('0x3'));var moment=require('moment');var BPromise=require(_0x31d6('0x4'));var Mustache=require(_0x31d6('0x5'));var util=require('util');var path=require(_0x31d6('0x6'));var sox=require('sox');var csv=require(_0x31d6('0x7'));var ejs=require(_0x31d6('0x8'));var fs=require('fs');var fs_extra=require(_0x31d6('0x9'));var _=require(_0x31d6('0xa'));var squel=require('squel');var crypto=require(_0x31d6('0xb'));var jsforce=require(_0x31d6('0xc'));var deskjs=require(_0x31d6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x31d6('0xe'));var Papa=require(_0x31d6('0xf'));var Redis=require('ioredis');var authService=require(_0x31d6('0x10'));var qs=require(_0x31d6('0x11'));var as=require(_0x31d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31d6('0x13'))(_0x31d6('0x14'));var utils=require('../../config/utils');var config=require(_0x31d6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x31d6('0x16'))['db'];function respondWithStatusCode(_0x47c83d,_0x341a62){_0x341a62=_0x341a62||0xcc;return function(_0x7bb3e1){if(_0x7bb3e1){return _0x47c83d[_0x31d6('0x17')](_0x341a62);}return _0x47c83d['status'](_0x341a62)[_0x31d6('0x18')]();};}function respondWithResult(_0x1fd2c2,_0x368717){_0x368717=_0x368717||0xc8;return function(_0x507afe){if(_0x507afe){return _0x1fd2c2[_0x31d6('0x19')](_0x368717)[_0x31d6('0x1a')](_0x507afe);}};}function respondWithFilteredResult(_0x290b59,_0x5573f7){return function(_0x230de8){if(_0x230de8){var _0x145da0=typeof _0x5573f7[_0x31d6('0x1b')]===_0x31d6('0x1c')&&typeof _0x5573f7[_0x31d6('0x1d')]===_0x31d6('0x1c');var _0x3e7528=_0x230de8['count'];var _0x378bbe=_0x145da0?0x0:_0x5573f7[_0x31d6('0x1b')];var _0x509b76=_0x145da0?_0x230de8[_0x31d6('0x1e')]:_0x5573f7[_0x31d6('0x1b')]+_0x5573f7[_0x31d6('0x1d')];var _0x1e1d1a;if(_0x509b76>=_0x3e7528){_0x509b76=_0x3e7528;_0x1e1d1a=0xc8;}else{_0x1e1d1a=0xce;}_0x290b59['status'](_0x1e1d1a);return _0x290b59['set'](_0x31d6('0x1f'),_0x378bbe+'-'+_0x509b76+'/'+_0x3e7528)[_0x31d6('0x1a')](_0x230de8);}return null;};}function patchUpdates(_0x134f48){return function(_0x3f6de7){try{jsonpatch[_0x31d6('0x20')](_0x3f6de7,_0x134f48,!![]);}catch(_0x3af3ee){return BPromise[_0x31d6('0x21')](_0x3af3ee);}return _0x3f6de7[_0x31d6('0x22')]();};}function saveUpdates(_0x5506a9,_0x25c570){return function(_0x360a65){if(_0x360a65){return _0x360a65[_0x31d6('0x23')](_0x5506a9)[_0x31d6('0x24')](function(_0x1be232){return _0x1be232;});}return null;};}function removeEntity(_0x5a1fde,_0x5a1ba8){return function(_0x19beda){if(_0x19beda){return _0x19beda[_0x31d6('0x25')]()[_0x31d6('0x24')](function(){_0x5a1fde[_0x31d6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4064,_0x2c6687){return function(_0x5f2653){if(!_0x5f2653){_0x4d4064[_0x31d6('0x17')](0x194);}return _0x5f2653;};}function handleError(_0x32fa32,_0x4b0487){_0x4b0487=_0x4b0487||0x1f4;return function(_0x22268c){logger['error'](_0x22268c[_0x31d6('0x26')]);if(_0x22268c[_0x31d6('0x27')]){delete _0x22268c[_0x31d6('0x27')];}_0x32fa32[_0x31d6('0x19')](_0x4b0487)['send'](_0x22268c);};}exports[_0x31d6('0x28')]=function(_0x3a0d74,_0x1b21c7){var _0x4b8158={},_0x540998={},_0x329655={'count':0x0,'rows':[]};var _0xb69422=_[_0x31d6('0x29')](db['DeskField'][_0x31d6('0x2a')],function(_0x8bfda9){return{'name':_0x8bfda9[_0x31d6('0x2b')],'type':_0x8bfda9[_0x31d6('0x2c')][_0x31d6('0x2d')]};});_0x540998[_0x31d6('0x2e')]=_[_0x31d6('0x29')](_0xb69422,_0x31d6('0x27'));_0x540998[_0x31d6('0x2f')]=_[_0x31d6('0x30')](_0x3a0d74[_0x31d6('0x2f')]);_0x540998[_0x31d6('0x31')]=_[_0x31d6('0x32')](_0x540998[_0x31d6('0x2e')],_0x540998['query']);_0x4b8158[_0x31d6('0x33')]=_['intersection'](_0x540998[_0x31d6('0x2e')],qs[_0x31d6('0x34')](_0x3a0d74[_0x31d6('0x2f')][_0x31d6('0x34')]));_0x4b8158[_0x31d6('0x33')]=_0x4b8158[_0x31d6('0x33')][_0x31d6('0x35')]?_0x4b8158[_0x31d6('0x33')]:_0x540998[_0x31d6('0x2e')];if(!_0x3a0d74[_0x31d6('0x2f')][_0x31d6('0x36')]('nolimit')){_0x4b8158['limit']=qs['limit'](_0x3a0d74[_0x31d6('0x2f')][_0x31d6('0x1d')]);_0x4b8158[_0x31d6('0x1b')]=qs[_0x31d6('0x1b')](_0x3a0d74[_0x31d6('0x2f')][_0x31d6('0x1b')]);}_0x4b8158[_0x31d6('0x37')]=qs[_0x31d6('0x38')](_0x3a0d74[_0x31d6('0x2f')]['sort']);_0x4b8158['where']=qs[_0x31d6('0x31')](_[_0x31d6('0x39')](_0x3a0d74['query'],_0x540998[_0x31d6('0x31')]),_0xb69422);if(_0x3a0d74['query'][_0x31d6('0x3a')]){_0x4b8158[_0x31d6('0x3b')]=_[_0x31d6('0x3c')](_0x4b8158[_0x31d6('0x3b')],{'$or':_[_0x31d6('0x29')](_0xb69422,function(_0x1bdf4a){if(_0x1bdf4a['type']!=='VIRTUAL'){var _0x4e08fe={};_0x4e08fe[_0x1bdf4a[_0x31d6('0x27')]]={'$like':'%'+_0x3a0d74[_0x31d6('0x2f')][_0x31d6('0x3a')]+'%'};return _0x4e08fe;}})});}_0x4b8158=_[_0x31d6('0x3c')]({},_0x4b8158,_0x3a0d74[_0x31d6('0x3d')]);var _0x516a80={'where':_0x4b8158[_0x31d6('0x3b')]};return db[_0x31d6('0x3e')][_0x31d6('0x1e')](_0x516a80)[_0x31d6('0x24')](function(_0x350fbb){_0x329655[_0x31d6('0x1e')]=_0x350fbb;if(_0x3a0d74['query'][_0x31d6('0x3f')]){_0x4b8158['include']=[{'all':!![]}];}return db['DeskField'][_0x31d6('0x40')](_0x4b8158);})['then'](function(_0x4d1514){_0x329655[_0x31d6('0x41')]=_0x4d1514;return _0x329655;})['then'](respondWithFilteredResult(_0x1b21c7,_0x4b8158))['catch'](handleError(_0x1b21c7,null));};exports[_0x31d6('0x42')]=function(_0x33001a,_0x5909dc){var _0x2c2961={'raw':!![],'where':{'id':_0x33001a[_0x31d6('0x43')]['id']}},_0x1e0b4b={};_0x1e0b4b[_0x31d6('0x2e')]=_[_0x31d6('0x30')](db[_0x31d6('0x3e')]['rawAttributes']);_0x1e0b4b[_0x31d6('0x2f')]=_[_0x31d6('0x30')](_0x33001a[_0x31d6('0x2f')]);_0x1e0b4b[_0x31d6('0x31')]=_[_0x31d6('0x32')](_0x1e0b4b[_0x31d6('0x2e')],_0x1e0b4b[_0x31d6('0x2f')]);_0x2c2961[_0x31d6('0x33')]=_['intersection'](_0x1e0b4b['model'],qs[_0x31d6('0x34')](_0x33001a[_0x31d6('0x2f')][_0x31d6('0x34')]));_0x2c2961[_0x31d6('0x33')]=_0x2c2961['attributes']['length']?_0x2c2961['attributes']:_0x1e0b4b[_0x31d6('0x2e')];if(_0x33001a[_0x31d6('0x2f')]['includeAll']){_0x2c2961[_0x31d6('0x44')]=[{'all':!![]}];}_0x2c2961=_['merge']({},_0x2c2961,_0x33001a[_0x31d6('0x3d')]);return db[_0x31d6('0x3e')][_0x31d6('0x45')](_0x2c2961)[_0x31d6('0x24')](handleEntityNotFound(_0x5909dc,null))['then'](respondWithResult(_0x5909dc,null))['catch'](handleError(_0x5909dc,null));};exports['create']=function(_0x2fb387,_0x40c87d){return db[_0x31d6('0x3e')]['create'](_0x2fb387[_0x31d6('0x46')],{})['then'](respondWithResult(_0x40c87d,0xc9))[_0x31d6('0x47')](handleError(_0x40c87d,null));};exports[_0x31d6('0x23')]=function(_0x538506,_0x54f798){if(_0x538506['body']['id']){delete _0x538506[_0x31d6('0x46')]['id'];}return db[_0x31d6('0x3e')][_0x31d6('0x45')]({'where':{'id':_0x538506[_0x31d6('0x43')]['id']}})[_0x31d6('0x24')](handleEntityNotFound(_0x54f798,null))['then'](saveUpdates(_0x538506[_0x31d6('0x46')],null))['then'](respondWithResult(_0x54f798,null))[_0x31d6('0x47')](handleError(_0x54f798,null));};exports[_0x31d6('0x25')]=function(_0x372a7e,_0x51a29f){return db[_0x31d6('0x3e')]['find']({'where':{'id':_0x372a7e['params']['id']}})[_0x31d6('0x24')](handleEntityNotFound(_0x51a29f,null))[_0x31d6('0x24')](removeEntity(_0x51a29f,null))['catch'](handleError(_0x51a29f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0d2578e..a216184 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 _0x72b5=['lodash','../../config/logger','moment','bluebird','../../config/environment','./intDeskField.attributes','define','int_desk_fields','desk_unique_index','idField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72b5,0x10e));var _0x572b=function(_0x42345a,_0x1677af){_0x42345a=_0x42345a-0x0;var _0x95ad74=_0x72b5[_0x42345a];return _0x95ad74;};'use strict';var _=require(_0x572b('0x0'));var util=require('util');var logger=require(_0x572b('0x1'))('api');var moment=require(_0x572b('0x2'));var BPromise=require(_0x572b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x572b('0x4'));var attributes=require(_0x572b('0x5'));module['exports']=function(_0x3374b3,_0x696318){return _0x3374b3[_0x572b('0x6')]('DeskField',attributes,{'tableName':_0x572b('0x7'),'paranoid':![],'indexes':[{'name':_0x572b('0x8'),'fields':[_0x572b('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc4e=['int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc4e,0x1b1));var _0xefc4=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xfc4e[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0xefc4('0x0'));var logger=require(_0xefc4('0x1'))('api');var moment=require(_0xefc4('0x2'));var BPromise=require(_0xefc4('0x3'));var rp=require(_0xefc4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefc4('0x5'));var config=require(_0xefc4('0x6'));var attributes=require('./intDeskField.attributes');module[_0xefc4('0x7')]=function(_0x3f9e73,_0x610d84){return _0x3f9e73[_0xefc4('0x8')]('DeskField',attributes,{'tableName':_0xefc4('0x9'),'paranoid':![],'indexes':[{'name':_0xefc4('0xa'),'fields':[_0xefc4('0xb'),_0xefc4('0xc')],'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 a0737ac..cbefb7b 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 _0x817a=['then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x3bc5a1,_0x530b19){var _0x5d23a3=function(_0x25253f){while(--_0x25253f){_0x3bc5a1['push'](_0x3bc5a1['shift']());}};_0x5d23a3(++_0x530b19);}(_0x817a,0x8f));var _0xa817=function(_0x238dcf,_0x888504){_0x238dcf=_0x238dcf-0x0;var _0x4dd8b5=_0x817a[_0x238dcf];return _0x4dd8b5;};'use strict';var _=require(_0xa817('0x0'));var util=require('util');var moment=require(_0xa817('0x1'));var BPromise=require(_0xa817('0x2'));var rs=require(_0xa817('0x3'));var fs=require('fs');var Redis=require(_0xa817('0x4'));var db=require(_0xa817('0x5'))['db'];var utils=require(_0xa817('0x6'));var logger=require(_0xa817('0x7'))(_0xa817('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa817('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37c03b,_0x3c2ea8,_0x45cf80){return new BPromise(function(_0x189594,_0x53750d){return client[_0xa817('0xa')](_0x37c03b,_0x45cf80)[_0xa817('0xb')](function(_0x2564db){logger[_0xa817('0xc')](_0xa817('0xd'),_0x3c2ea8,_0xa817('0xe'));logger[_0xa817('0xf')](_0xa817('0x10'),_0x3c2ea8,_0xa817('0xe'),JSON[_0xa817('0x11')](_0x2564db));if(_0x2564db[_0xa817('0x12')]){if(_0x2564db[_0xa817('0x12')][_0xa817('0x13')]===0x1f4){logger[_0xa817('0x12')](_0xa817('0xd'),_0x3c2ea8,_0x2564db['error']['message']);return _0x53750d(_0x2564db[_0xa817('0x12')][_0xa817('0x14')]);}logger[_0xa817('0x12')](_0xa817('0xd'),_0x3c2ea8,_0x2564db['error'][_0xa817('0x14')]);return _0x189594(_0x2564db[_0xa817('0x12')][_0xa817('0x14')]);}else{logger[_0xa817('0xc')](_0xa817('0xd'),_0x3c2ea8,_0xa817('0xe'));_0x189594(_0x2564db[_0xa817('0x15')]['message']);}})['catch'](function(_0x8b20bc){logger['error'](_0xa817('0xd'),_0x3c2ea8,_0x8b20bc);_0x53750d(_0x8b20bc);});});} \ No newline at end of file +var _0x47e7=['client','request','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x47e7,0x65));var _0x747e=function(_0x261ea3,_0x2ff6b7){_0x261ea3=_0x261ea3-0x0;var _0x16ef97=_0x47e7[_0x261ea3];return _0x16ef97;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x747e('0x0'));var BPromise=require(_0x747e('0x1'));var rs=require(_0x747e('0x2'));var fs=require('fs');var Redis=require(_0x747e('0x3'));var db=require(_0x747e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x747e('0x5'));var config=require(_0x747e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x747e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16fddc,_0xa9f209,_0x5246b){return new BPromise(function(_0x3d123c,_0x4eaf19){return client[_0x747e('0x8')](_0x16fddc,_0x5246b)['then'](function(_0x46bb9e){logger['info'](_0x747e('0x9'),_0xa9f209,_0x747e('0xa'));logger['debug'](_0x747e('0xb'),_0xa9f209,_0x747e('0xa'),JSON[_0x747e('0xc')](_0x46bb9e));if(_0x46bb9e['error']){if(_0x46bb9e[_0x747e('0xd')][_0x747e('0xe')]===0x1f4){logger[_0x747e('0xd')](_0x747e('0x9'),_0xa9f209,_0x46bb9e['error'][_0x747e('0xf')]);return _0x4eaf19(_0x46bb9e[_0x747e('0xd')][_0x747e('0xf')]);}logger[_0x747e('0xd')](_0x747e('0x9'),_0xa9f209,_0x46bb9e['error'][_0x747e('0xf')]);return _0x3d123c(_0x46bb9e[_0x747e('0xd')][_0x747e('0xf')]);}else{logger[_0x747e('0x10')](_0x747e('0x9'),_0xa9f209,'request\x20sent');_0x3d123c(_0x46bb9e[_0x747e('0x11')][_0x747e('0xf')]);}})['catch'](function(_0x316e55){logger[_0x747e('0xd')]('DeskField,\x20%s,\x20%s',_0xa9f209,_0x316e55);_0x4eaf19(_0x316e55);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 85b5bb9..d69c7b0 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 _0xe29b=['update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put'];(function(_0x55409f,_0xbe76be){var _0x1fdf81=function(_0x3fea86){while(--_0x3fea86){_0x55409f['push'](_0x55409f['shift']());}};_0x1fdf81(++_0xbe76be);}(_0xe29b,0x18a));var _0xbe29=function(_0x4ee8de,_0x2b4532){_0x4ee8de=_0x4ee8de-0x0;var _0x5554bf=_0xe29b[_0x4ee8de];return _0x5554bf;};'use strict';var multer=require('multer');var util=require(_0xbe29('0x0'));var path=require(_0xbe29('0x1'));var timeout=require(_0xbe29('0x2'));var express=require('express');var router=express[_0xbe29('0x3')]();var fs_extra=require(_0xbe29('0x4'));var auth=require(_0xbe29('0x5'));var interaction=require(_0xbe29('0x6'));var config=require(_0xbe29('0x7'));var controller=require(_0xbe29('0x8'));router[_0xbe29('0x9')]('/',auth[_0xbe29('0xa')](),controller[_0xbe29('0xb')]);router['get'](_0xbe29('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbe29('0x9')](_0xbe29('0xd'),auth[_0xbe29('0xa')](),controller[_0xbe29('0xe')]);router['get']('/:id/fields',auth[_0xbe29('0xa')](),controller[_0xbe29('0xf')]);router['post']('/',auth[_0xbe29('0xa')](),controller[_0xbe29('0x10')]);router[_0xbe29('0x11')](_0xbe29('0xd'),auth[_0xbe29('0xa')](),controller[_0xbe29('0x12')]);router[_0xbe29('0x13')](_0xbe29('0xc'),auth[_0xbe29('0xa')](),controller[_0xbe29('0x14')]);router[_0xbe29('0x15')]('/:id',auth[_0xbe29('0xa')](),controller['destroy']);module[_0xbe29('0x16')]=router; \ No newline at end of file +var _0x2b92=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0x504bba,_0x1651b4){var _0xf13869=function(_0x79c90c){while(--_0x79c90c){_0x504bba['push'](_0x504bba['shift']());}};_0xf13869(++_0x1651b4);}(_0x2b92,0x170));var _0x22b9=function(_0x3621b4,_0x586667){_0x3621b4=_0x3621b4-0x0;var _0x3e32ee=_0x2b92[_0x3621b4];return _0x3e32ee;};'use strict';var multer=require(_0x22b9('0x0'));var util=require(_0x22b9('0x1'));var path=require(_0x22b9('0x2'));var timeout=require(_0x22b9('0x3'));var express=require(_0x22b9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22b9('0x5'));var controller=require(_0x22b9('0x6'));router[_0x22b9('0x7')]('/',auth[_0x22b9('0x8')](),controller[_0x22b9('0x9')]);router[_0x22b9('0x7')](_0x22b9('0xa'),auth[_0x22b9('0x8')](),controller[_0x22b9('0xb')]);router['get'](_0x22b9('0xc'),auth[_0x22b9('0x8')](),controller[_0x22b9('0xd')]);router[_0x22b9('0x7')](_0x22b9('0xe'),auth[_0x22b9('0x8')](),controller[_0x22b9('0xf')]);router[_0x22b9('0x10')]('/',auth['isAuthenticated'](),controller[_0x22b9('0x11')]);router[_0x22b9('0x10')](_0x22b9('0xc'),auth[_0x22b9('0x8')](),controller[_0x22b9('0x12')]);router[_0x22b9('0x13')]('/:id',auth[_0x22b9('0x8')](),controller[_0x22b9('0x14')]);router[_0x22b9('0x15')](_0x22b9('0xa'),auth[_0x22b9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 2d46dff..f303e9f 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 _0xedf2=['exports','STRING'];(function(_0x31aca4,_0x39e4ee){var _0x27b4e6=function(_0x7dc4fc){while(--_0x7dc4fc){_0x31aca4['push'](_0x31aca4['shift']());}};_0x27b4e6(++_0x39e4ee);}(_0xedf2,0x1ac));var _0x2edf=function(_0x7491a2,_0x413424){_0x7491a2=_0x7491a2-0x0;var _0x20dc48=_0xedf2[_0x7491a2];return _0x20dc48;};'use strict';var Sequelize=require('sequelize');module[_0x2edf('0x0')]={'name':{'type':Sequelize[_0x2edf('0x1')]},'username':{'type':Sequelize[_0x2edf('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2edf('0x1')]},'tenantId':{'type':Sequelize[_0x2edf('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2edf('0x1')]},'serverUrl':{'type':Sequelize[_0x2edf('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe132=['sequelize','STRING'];(function(_0x33a07f,_0xc0330e){var _0x2368a9=function(_0x3db422){while(--_0x3db422){_0x33a07f['push'](_0x33a07f['shift']());}};_0x2368a9(++_0xc0330e);}(_0xe132,0x162));var _0x2e13=function(_0x5f217f,_0xf3527f){_0x5f217f=_0x5f217f-0x0;var _0x1775ba=_0xe132[_0x5f217f];return _0x1775ba;};'use strict';var Sequelize=require(_0x2e13('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e13('0x1')]},'username':{'type':Sequelize[_0x2e13('0x1')]},'password':{'type':Sequelize[_0x2e13('0x1')]},'remoteUri':{'type':Sequelize[_0x2e13('0x1')]},'tenantId':{'type':Sequelize[_0x2e13('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2e13('0x1')]},'serverUrl':{'type':Sequelize[_0x2e13('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ec804b7..73df09b 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 _0x8e93=[')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','options','Dynamics365Account','includeAll','include','findAll','catch','params','keys','fields','find','create','body','getConfigurations','Dynamics365Configuration','sort','pick','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','customeridyominame','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','username','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption'];(function(_0x42a0ea,_0x2bdf87){var _0x1eb686=function(_0x49fbd9){while(--_0x49fbd9){_0x42a0ea['push'](_0x42a0ea['shift']());}};_0x1eb686(++_0x2bdf87);}(_0x8e93,0xba));var _0x38e9=function(_0x50132f,_0x37faeb){_0x50132f=_0x50132f-0x0;var _0x53162a=_0x8e93[_0x50132f];return _0x53162a;};'use strict';var rp=require('request-promise');var util=require(_0x38e9('0x0'));var _=require(_0x38e9('0x1'));var qs=require(_0x38e9('0x2'));var logger=require(_0x38e9('0x3'))('api');var db=require(_0x38e9('0x4'))['db'];var integrations=require(_0x38e9('0x5'));function respondWithResult(_0x38a55e,_0x57e9f0){_0x57e9f0=_0x57e9f0||0xc8;return function(_0x5f3b53){if(_0x5f3b53){return _0x38a55e['status'](_0x57e9f0)[_0x38e9('0x6')](_0x5f3b53);}};}function respondWithFilteredResult(_0x4400de,_0x107001){return function(_0x4a2856){if(_0x4a2856){var _0x3a3237=typeof _0x107001[_0x38e9('0x7')]===_0x38e9('0x8')&&typeof _0x107001[_0x38e9('0x9')]===_0x38e9('0x8');var _0x3e6436=_0x4a2856[_0x38e9('0xa')];var _0x367100=_0x3a3237?0x0:_0x107001[_0x38e9('0x7')];var _0x4e18e4=_0x3a3237?_0x4a2856['count']:_0x107001[_0x38e9('0x7')]+_0x107001[_0x38e9('0x9')];var _0x1a1a6b;if(_0x4e18e4>=_0x3e6436){_0x4e18e4=_0x3e6436;_0x1a1a6b=0xc8;}else{_0x1a1a6b=0xce;}_0x4400de[_0x38e9('0xb')](_0x1a1a6b);return _0x4400de[_0x38e9('0xc')]('Content-Range',_0x367100+'-'+_0x4e18e4+'/'+_0x3e6436)[_0x38e9('0x6')](_0x4a2856);}return null;};}function saveUpdates(_0x8976ff){return function(_0x3d4bb1){if(_0x3d4bb1){return _0x3d4bb1[_0x38e9('0xd')](_0x8976ff)[_0x38e9('0xe')](function(_0x1d721a){return _0x1d721a;});}return null;};}function removeEntity(_0x18c26d){return function(_0x1d04ff){if(_0x1d04ff){return _0x1d04ff[_0x38e9('0xf')]()['then'](function(){_0x18c26d[_0x38e9('0xb')](0xcc)[_0x38e9('0x10')]();});}};}function handleEntityNotFound(_0x2f68cb){return function(_0x426503){if(!_0x426503){_0x2f68cb[_0x38e9('0x11')](0x194);}return _0x426503;};}function handleError(_0x50ba05,_0x26baa5){_0x26baa5=_0x26baa5||0x1f4;return function(_0x67cc54){logger[_0x38e9('0x12')](_0x67cc54[_0x38e9('0x13')]);if(_0x67cc54[_0x38e9('0x14')]){delete _0x67cc54['name'];}_0x50ba05[_0x38e9('0xb')](_0x26baa5)[_0x38e9('0x15')](_0x67cc54);};}exports['index']=function(_0x5f456a,_0x45343c){var _0xfccd24={},_0x29e35a={},_0x584d00={'count':0x0,'rows':[]};var _0xb1772a=_[_0x38e9('0x16')](db['Dynamics365Account'][_0x38e9('0x17')],function(_0x5c866f){return{'name':_0x5c866f[_0x38e9('0x18')],'type':_0x5c866f[_0x38e9('0x19')][_0x38e9('0x1a')]};});_0x29e35a[_0x38e9('0x1b')]=_[_0x38e9('0x16')](_0xb1772a,'name');_0x29e35a['query']=_['keys'](_0x5f456a['query']);_0x29e35a[_0x38e9('0x1c')]=_[_0x38e9('0x1d')](_0x29e35a[_0x38e9('0x1b')],_0x29e35a[_0x38e9('0x1e')]);_0xfccd24['attributes']=_[_0x38e9('0x1d')](_0x29e35a[_0x38e9('0x1b')],qs['fields'](_0x5f456a[_0x38e9('0x1e')]['fields']));_0xfccd24[_0x38e9('0x1f')]=_0xfccd24[_0x38e9('0x1f')][_0x38e9('0x20')]?_0xfccd24[_0x38e9('0x1f')]:_0x29e35a[_0x38e9('0x1b')];if(!_0x5f456a['query'][_0x38e9('0x21')](_0x38e9('0x22'))){_0xfccd24[_0x38e9('0x9')]=qs[_0x38e9('0x9')](_0x5f456a['query'][_0x38e9('0x9')]);_0xfccd24['offset']=qs[_0x38e9('0x7')](_0x5f456a['query'][_0x38e9('0x7')]);}_0xfccd24[_0x38e9('0x23')]=qs['sort'](_0x5f456a[_0x38e9('0x1e')]['sort']);_0xfccd24[_0x38e9('0x24')]=qs[_0x38e9('0x1c')](_['pick'](_0x5f456a[_0x38e9('0x1e')],_0x29e35a[_0x38e9('0x1c')]),_0xb1772a);if(_0x5f456a['query'][_0x38e9('0x25')]){_0xfccd24[_0x38e9('0x24')]=_[_0x38e9('0x26')](_0xfccd24['where'],{'$or':_[_0x38e9('0x16')](_0xb1772a,function(_0x1398c4){if(_0x1398c4['type']!=='VIRTUAL'){var _0x18d5f4={};_0x18d5f4[_0x1398c4[_0x38e9('0x14')]]={'$like':'%'+_0x5f456a[_0x38e9('0x1e')][_0x38e9('0x25')]+'%'};return _0x18d5f4;}})});}_0xfccd24=_[_0x38e9('0x26')]({},_0xfccd24,_0x5f456a[_0x38e9('0x27')]);var _0x52c2f6={'where':_0xfccd24[_0x38e9('0x24')]};return db[_0x38e9('0x28')]['count'](_0x52c2f6)[_0x38e9('0xe')](function(_0x128582){_0x584d00['count']=_0x128582;if(_0x5f456a[_0x38e9('0x1e')][_0x38e9('0x29')]){_0xfccd24[_0x38e9('0x2a')]=[{'all':!![]}];}return db[_0x38e9('0x28')][_0x38e9('0x2b')](_0xfccd24);})[_0x38e9('0xe')](function(_0x5936b1){_0x584d00['rows']=_0x5936b1;return _0x584d00;})[_0x38e9('0xe')](respondWithFilteredResult(_0x45343c,_0xfccd24))[_0x38e9('0x2c')](handleError(_0x45343c,null));};exports['show']=function(_0x31066b,_0x551cc3){var _0x3511c3={'raw':![],'where':{'id':_0x31066b[_0x38e9('0x2d')]['id']}},_0x2e15a2={};_0x2e15a2['model']=_[_0x38e9('0x2e')](db[_0x38e9('0x28')]['rawAttributes']);_0x2e15a2[_0x38e9('0x1e')]=_['keys'](_0x31066b['query']);_0x2e15a2[_0x38e9('0x1c')]=_[_0x38e9('0x1d')](_0x2e15a2['model'],_0x2e15a2['query']);_0x3511c3[_0x38e9('0x1f')]=_['intersection'](_0x2e15a2[_0x38e9('0x1b')],qs[_0x38e9('0x2f')](_0x31066b[_0x38e9('0x1e')]['fields']));_0x3511c3[_0x38e9('0x1f')]=_0x3511c3[_0x38e9('0x1f')]['length']?_0x3511c3[_0x38e9('0x1f')]:_0x2e15a2[_0x38e9('0x1b')];if(_0x31066b['query'][_0x38e9('0x29')]){_0x3511c3[_0x38e9('0x2a')]=[{'all':!![]}];}_0x3511c3=_[_0x38e9('0x26')]({},_0x3511c3,_0x31066b[_0x38e9('0x27')]);return db['Dynamics365Account'][_0x38e9('0x30')](_0x3511c3)[_0x38e9('0xe')](handleEntityNotFound(_0x551cc3,null))[_0x38e9('0xe')](respondWithResult(_0x551cc3,null))['catch'](handleError(_0x551cc3,null));};exports['create']=function(_0x31beeb,_0x4ed381){return db['Dynamics365Account'][_0x38e9('0x31')](_0x31beeb[_0x38e9('0x32')],{})[_0x38e9('0xe')](respondWithResult(_0x4ed381,0xc9))[_0x38e9('0x2c')](handleError(_0x4ed381,null));};exports[_0x38e9('0xd')]=function(_0x2ba863,_0x1d0871){if(_0x2ba863[_0x38e9('0x32')]['id']){delete _0x2ba863[_0x38e9('0x32')]['id'];}return db[_0x38e9('0x28')][_0x38e9('0x30')]({'where':{'id':_0x2ba863[_0x38e9('0x2d')]['id']}})[_0x38e9('0xe')](handleEntityNotFound(_0x1d0871,null))[_0x38e9('0xe')](saveUpdates(_0x2ba863[_0x38e9('0x32')],null))['then'](respondWithResult(_0x1d0871,null))['catch'](handleError(_0x1d0871,null));};exports[_0x38e9('0xf')]=function(_0x93ab3e,_0x373bee){return db[_0x38e9('0x28')][_0x38e9('0x30')]({'where':{'id':_0x93ab3e[_0x38e9('0x2d')]['id']}})[_0x38e9('0xe')](handleEntityNotFound(_0x373bee,null))['then'](removeEntity(_0x373bee,null))[_0x38e9('0x2c')](handleError(_0x373bee,null));};exports[_0x38e9('0x33')]=function(_0x16f6c4,_0x175d3d){var _0x46d1e2={};var _0x4c63c9={};var _0x12000c;var _0x5c1de9;return db['Dynamics365Account']['findOne']({'where':{'id':_0x16f6c4[_0x38e9('0x2d')]['id']}})['then'](handleEntityNotFound(_0x175d3d,null))[_0x38e9('0xe')](function(_0x183ea9){if(_0x183ea9){_0x12000c=_0x183ea9;_0x4c63c9['model']=_['keys'](db[_0x38e9('0x34')][_0x38e9('0x17')]);_0x4c63c9[_0x38e9('0x1e')]=_[_0x38e9('0x2e')](_0x16f6c4['query']);_0x4c63c9[_0x38e9('0x1c')]=_[_0x38e9('0x1d')](_0x4c63c9[_0x38e9('0x1b')],_0x4c63c9[_0x38e9('0x1e')]);_0x46d1e2[_0x38e9('0x1f')]=_[_0x38e9('0x1d')](_0x4c63c9[_0x38e9('0x1b')],qs[_0x38e9('0x2f')](_0x16f6c4[_0x38e9('0x1e')]['fields']));_0x46d1e2[_0x38e9('0x1f')]=_0x46d1e2[_0x38e9('0x1f')][_0x38e9('0x20')]?_0x46d1e2[_0x38e9('0x1f')]:_0x4c63c9[_0x38e9('0x1b')];_0x46d1e2['order']=qs[_0x38e9('0x35')](_0x16f6c4[_0x38e9('0x1e')][_0x38e9('0x35')]);_0x46d1e2[_0x38e9('0x24')]=qs[_0x38e9('0x1c')](_[_0x38e9('0x36')](_0x16f6c4['query'],_0x4c63c9[_0x38e9('0x1c')]));if(_0x16f6c4['query'][_0x38e9('0x25')]){_0x46d1e2['where']=_[_0x38e9('0x26')](_0x46d1e2[_0x38e9('0x24')],{'$or':_[_0x38e9('0x16')](_0x46d1e2['attributes'],function(_0x46296d){var _0x9d902b={};_0x9d902b[_0x46296d]={'$like':'%'+_0x16f6c4['query'][_0x38e9('0x25')]+'%'};return _0x9d902b;})});}_0x46d1e2=_[_0x38e9('0x26')]({},_0x46d1e2,_0x16f6c4[_0x38e9('0x27')]);return _0x12000c['getConfigurations'](_0x46d1e2);}})[_0x38e9('0xe')](function(_0x1a6eb9){if(_0x1a6eb9){_0x5c1de9=_0x1a6eb9[_0x38e9('0x20')];if(!_0x16f6c4[_0x38e9('0x1e')][_0x38e9('0x21')](_0x38e9('0x22'))){_0x46d1e2['limit']=qs[_0x38e9('0x9')](_0x16f6c4[_0x38e9('0x1e')][_0x38e9('0x9')]);_0x46d1e2[_0x38e9('0x7')]=qs[_0x38e9('0x7')](_0x16f6c4[_0x38e9('0x1e')][_0x38e9('0x7')]);}return _0x12000c[_0x38e9('0x33')](_0x46d1e2);}})[_0x38e9('0xe')](function(_0x3badbe){if(_0x3badbe){return _0x3badbe?{'count':_0x5c1de9,'rows':_0x3badbe}:null;}})[_0x38e9('0xe')](respondWithResult(_0x175d3d,null))['catch'](handleError(_0x175d3d,null));};exports['addConfiguration']=function(_0xd175cc,_0x62e394){if(_0xd175cc['body']['id']){delete _0xd175cc['body']['id'];}return db[_0x38e9('0x28')][_0x38e9('0x37')]({'where':{'id':_0xd175cc[_0x38e9('0x2d')]['id']}})[_0x38e9('0xe')](handleEntityNotFound(_0x62e394,null))[_0x38e9('0xe')](function(_0x512e21){if(_0x512e21){_0xd175cc[_0x38e9('0x32')][_0x38e9('0x38')]=_0x512e21['id'];_0xd175cc[_0x38e9('0x32')][_0x38e9('0x39')]=integrations[_0x38e9('0x3a')](_0xd175cc[_0x38e9('0x32')][_0x38e9('0x3b')],_0xd175cc[_0x38e9('0x32')][_0x38e9('0x19')]);_0xd175cc['body'][_0x38e9('0x3c')]=integrations[_0x38e9('0x3d')](_0xd175cc[_0x38e9('0x32')][_0x38e9('0x3b')],_0xd175cc['body'][_0x38e9('0x19')]);return db[_0x38e9('0x34')][_0x38e9('0x31')](_0xd175cc[_0x38e9('0x32')],{'include':[{'model':db[_0x38e9('0x3e')],'as':_0x38e9('0x39')},{'model':db[_0x38e9('0x3e')],'as':_0x38e9('0x3c')}]});}return null;})[_0x38e9('0xe')](respondWithResult(_0x62e394,null))[_0x38e9('0x2c')](handleError(_0x62e394,null));};function sanitizeRemoteUri(_0x228860){var _0x45ef17=_0x228860[_0x38e9('0x3f')](-0x1);if(_0x45ef17==='/')return _0x228860[_0x38e9('0x40')](0x0,_0x228860[_0x38e9('0x41')](_0x45ef17));return _0x228860;}function getWebApiUrl(_0x4c09ea){return util[_0x38e9('0x42')](_0x38e9('0x43'),_0x4c09ea);}exports[_0x38e9('0x44')]=function(_0x54f837,_0x57334d){var _0x392abb=_0x54f837[_0x38e9('0x1e')][_0x38e9('0x45')];var _0xfd4e99=_0x392abb==='incident'?_0x38e9('0x46'):_0x38e9('0x47');var _0x525e59='';var _0x26c758='';var _0x5e2523='';var _0x549505='';var _0x456a9b='';var _0x1ad007='';var _0x56a656='';var _0xda20de='';var _0x9b1447=[_0x38e9('0x48'),'description',_0x38e9('0x49'),_0x38e9('0x4a'),'caseorigincode',_0x38e9('0x4b'),'phonenumber',_0x38e9('0x4c'),_0x38e9('0x4d'),_0x38e9('0x4e')];var _0x4170bc=['accountidname',_0x38e9('0x4f'),_0x38e9('0x50'),'billedserviceunits',_0x38e9('0x51'),_0x38e9('0x52'),_0x38e9('0x53'),_0x38e9('0x54'),_0x38e9('0x55'),_0x38e9('0x56'),'createdbyname',_0x38e9('0x57'),_0x38e9('0x58'),'createdonbehalfbyname',_0x38e9('0x59'),'customeridname',_0x38e9('0x5a'),_0x38e9('0x5b'),'emailaddress','entitlementidname','entityimage_timestamp',_0x38e9('0x5c'),_0x38e9('0x5d'),_0x38e9('0x5e'),_0x38e9('0x5f'),_0x38e9('0x60'),_0x38e9('0x61'),'influencescore',_0x38e9('0x62'),_0x38e9('0x63'),'masteridname',_0x38e9('0x64'),_0x38e9('0x65'),_0x38e9('0x66'),_0x38e9('0x67'),'modifiedon','modifiedonbehalfbyname',_0x38e9('0x68'),_0x38e9('0x69'),_0x38e9('0x6a'),_0x38e9('0x6b'),_0x38e9('0x6c'),_0x38e9('0x6d'),'owneridname',_0x38e9('0x6e'),_0x38e9('0x6f'),_0x38e9('0x70'),_0x38e9('0x71'),_0x38e9('0x72'),'prioritycodename',_0x38e9('0x73'),'productserialnumber','resolveby',_0x38e9('0x74'),'responseby',_0x38e9('0x75'),_0x38e9('0x76'),'sentimentvalue',_0x38e9('0x77'),_0x38e9('0x78'),'socialprofileidname','statecode',_0x38e9('0x79'),_0x38e9('0x7a'),'ticketnumber',_0x38e9('0x7b'),_0x38e9('0x7c'),_0x38e9('0x7d'),_0x38e9('0x7e'),_0x38e9('0x7f')];var _0x27b6b2=_0x9b1447[_0x38e9('0x80')](_0x4170bc);return db['Dynamics365Account'][_0x38e9('0x37')]({'where':{'id':_0x54f837[_0x38e9('0x2d')]['id']},'attributes':['id','username',_0x38e9('0x81'),_0x38e9('0x82'),_0x38e9('0x83'),_0x38e9('0x84'),_0x38e9('0x85'),'modernAuthentication'],'include':[{'model':db[_0x38e9('0x86')],'as':_0x38e9('0x86'),'attributes':['id',_0x38e9('0x87'),_0x38e9('0x88')]}]})[_0x38e9('0xe')](handleEntityNotFound(_0x57334d,null))[_0x38e9('0xe')](function(_0x4b20aa){if(_0x4b20aa){if(_0x4b20aa['modernAuthentication']){_0x4b20aa['access_token']=_0x4b20aa['CloudProvider']['data5'];_0xda20de=sanitizeRemoteUri(_0x4b20aa[_0x38e9('0x86')]['data7']);_0x56a656=getWebApiUrl(_0xda20de);return _0x4b20aa;}_0xda20de=sanitizeRemoteUri(_0x4b20aa['remoteUri']);_0x56a656=getWebApiUrl(_0xda20de);var _0x55e2d2={'method':_0x38e9('0x89'),'uri':_0x38e9('0x8a')+_0x4b20aa['tenantId']+'/oauth2/token','form':{'client_id':_0x4b20aa[_0x38e9('0x84')],'resource':_0xda20de,'username':_0x4b20aa[_0x38e9('0x8b')],'password':_0x4b20aa[_0x38e9('0x81')],'grant_type':_0x38e9('0x81'),'client_secret':_0x4b20aa[_0x38e9('0x85')]},'json':!![]};return rp(_0x55e2d2);}})[_0x38e9('0xe')](function(_0x18d787){_0x1ad007=_0x18d787[_0x38e9('0x8c')];var _0x5494fc={'method':'GET','uri':encodeURI(_0x56a656+_0x38e9('0x8d')+_0xfd4e99+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1ad007,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5494fc);})[_0x38e9('0xe')](function(_0x44989f){var _0x25909a=_0x44989f[_0x38e9('0x8e')][0x0];var _0x4c57ab=_0x25909a['MetadataId'];var _0x48fc0a={'method':'GET','uri':_0x56a656+_0x38e9('0x8f')+_0x4c57ab+_0x38e9('0x90'),'headers':{'Authorization':'Bearer\x20'+_0x1ad007,'If-None-Match':null,'OData-Version':_0x38e9('0x91')},'json':!![]};return rp(_0x48fc0a);})[_0x38e9('0xe')](function(_0x1eca94){_0x525e59=_0x1eca94;_0x26c758=_0x525e59[_0x38e9('0x92')];_0x26c758=_[_0x38e9('0x93')](_0x26c758,function(_0x324915){return!_0x27b6b2[_0x38e9('0x94')](_0x324915[_0x38e9('0x95')]);});var _0x1c17ce=[];var _0x4727e6=[];_0x26c758[_0x38e9('0x96')](function(_0xb16207){if(_0xb16207[_0x38e9('0x97')]){var _0x54b923=_0xb16207[_0x38e9('0x97')]['substring'](_0xb16207[_0x38e9('0x97')][_0x38e9('0x41')]('.')+0x1);if(_0x54b923===_0x38e9('0x98')){_0x1c17ce[_0x38e9('0x99')](getSelectList(_0x56a656,_0x392abb,_0x4727e6,_0x525e59[_0x38e9('0x9a')],_0xb16207[_0x38e9('0x9a')],_0x1ad007));}}});return Promise[_0x38e9('0x9b')](_0x1c17ce);})['then'](function(_0x541f86){_0x5e2523=_0x541f86[0x0];var _0x1b736d=[];var _0x27af8d=[];_0x26c758['forEach'](function(_0xf87d46){if(!_[_0x38e9('0x9c')](_0xf87d46[_0x38e9('0x97')])){var _0x237011=_0xf87d46['@odata.type']['substring'](_0xf87d46[_0x38e9('0x97')][_0x38e9('0x41')]('.')+0x1);if(_0x237011==='BooleanAttributeMetadata'){_0x1b736d[_0x38e9('0x99')](getBooleanList(_0x56a656,_0x392abb,_0x27af8d,_0x525e59['MetadataId'],_0xf87d46['MetadataId'],_0x1ad007));}}});return Promise[_0x38e9('0x9b')](_0x1b736d);})[_0x38e9('0xe')](function(_0x1a62bc){_0x549505=_0x1a62bc[0x0];var _0x2314c5=[];var _0x1ecbc5=[];_0x26c758[_0x38e9('0x96')](function(_0x47f098){if(_0x47f098[_0x38e9('0x97')]){var _0x1f736b=_0x47f098[_0x38e9('0x97')][_0x38e9('0x40')](_0x47f098[_0x38e9('0x97')]['lastIndexOf']('.')+0x1);if(_0x1f736b===_0x38e9('0x9d')||_0x1f736b===_0x38e9('0x9e')||_0x1f736b===_0x38e9('0x9f')||_0x1f736b==='IntegerAttributeMetadata'||_0x1f736b===_0x38e9('0xa0')||_0x1f736b===_0x38e9('0xa1')||_0x1f736b===_0x38e9('0xa2')||_0x1f736b===_0x38e9('0xa3')||_0x1f736b===_0x38e9('0xa4')||_0x1f736b===_0x38e9('0xa5')){_0x2314c5[_0x38e9('0x99')](getInputList(_0x56a656,_0x392abb,_0x1f736b,_0x1ecbc5,_0x525e59[_0x38e9('0x9a')],_0x47f098['MetadataId'],_0x1ad007));}}});return Promise['all'](_0x2314c5);})[_0x38e9('0xe')](function(_0x233f34){_0x456a9b=_0x233f34[0x0];var _0x3a447f=_0x5e2523['concat'](_0x549505)[_0x38e9('0x80')](_0x456a9b);var _0x32161e={'count':_0x3a447f[_0x38e9('0x20')],'rows':_0x3a447f};return _0x32161e;})[_0x38e9('0xe')](respondWithResult(_0x57334d,null))['catch'](function(_0x1e6fe8){var _0x4a1d26=_0x54f837[_0x38e9('0x1e')]['test']?0x1f4:_0x1e6fe8[_0x38e9('0xa6')]||0x1f4;logger[_0x38e9('0x12')](_0x1e6fe8[_0x38e9('0x13')]);delete _0x1e6fe8[_0x38e9('0x14')];if(_0x4a1d26===0x191){_0x4a1d26=0x190;}_0x57334d[_0x38e9('0xb')](_0x4a1d26)['send'](_0x54f837['query'][_0x38e9('0xa7')]?{'message':'Wrong\x20credentials','statusCode':_0x1e6fe8['statusCode']}:_0x1e6fe8);});};function getSelectList(_0x35d2a0,_0x473824,_0x1559d0,_0x378ef2,_0x1f2a42,_0xb17d87){var _0x55b731={'method':_0x38e9('0xa8'),'uri':_0x35d2a0+_0x38e9('0x8f')+_0x378ef2+_0x38e9('0xa9')+_0x1f2a42+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x38e9('0xaa'),'headers':{'Authorization':_0x38e9('0xab')+_0xb17d87,'If-None-Match':null,'OData-Version':_0x38e9('0x91')},'json':!![]};return rp(_0x55b731)[_0x38e9('0xe')](function(_0x45356e){var _0x5c2791=[];var _0x3727f8=_0x45356e[_0x38e9('0xac')][_0x38e9('0xad')];_0x3727f8[_0x38e9('0x96')](function(_0x5abdd8){_0x5c2791['push']({'name':_0x5abdd8[_0x38e9('0xae')]['UserLocalizedLabel'][_0x38e9('0xae')],'value':String(_0x5abdd8['Value'])});});var _0x185b0d={'id':_0x473824+'_'+_0x45356e[_0x38e9('0x95')],'name':_0x45356e['DisplayName'][_0x38e9('0xaf')][_0x38e9('0xae')],'custom':![],'options':_0x5c2791};_0x1559d0['push'](_0x185b0d);return _0x1559d0;});}function getBooleanList(_0x30c144,_0x2a112a,_0x57c219,_0x20d0a8,_0x1fd72f,_0x438499){var _0x5608e8={'method':'GET','uri':_0x30c144+_0x38e9('0x8f')+_0x20d0a8+_0x38e9('0xa9')+_0x1fd72f+_0x38e9('0xb0'),'headers':{'Authorization':_0x38e9('0xab')+_0x438499,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5608e8)[_0x38e9('0xe')](function(_0x4e4927){var _0xce4d10=[];_0xce4d10[_0x38e9('0x99')]({'name':_0x4e4927[_0x38e9('0xac')][_0x38e9('0xb1')][_0x38e9('0xae')][_0x38e9('0xaf')][_0x38e9('0xae')],'value':_0x38e9('0xb2')},{'name':_0x4e4927[_0x38e9('0xac')][_0x38e9('0xb3')]['Label']['UserLocalizedLabel'][_0x38e9('0xae')],'value':'false'});var _0x2499e7={'id':_0x2a112a+'_'+_0x4e4927[_0x38e9('0x95')],'name':_0x4e4927['DisplayName'][_0x38e9('0xaf')][_0x38e9('0xae')],'custom':![],'options':_0xce4d10};_0x57c219[_0x38e9('0x99')](_0x2499e7);return _0x57c219;});}function getInputList(_0x211a78,_0x435b89,_0x422c18,_0x5303c5,_0x16f591,_0x43a879,_0x110b2f){var _0xa64391={'method':_0x38e9('0xa8'),'uri':_0x211a78+_0x38e9('0x8f')+_0x16f591+_0x38e9('0xa9')+_0x43a879+_0x38e9('0xb4')+_0x422c18+_0x38e9('0xb5'),'headers':{'Authorization':_0x38e9('0xab')+_0x110b2f,'If-None-Match':null,'OData-Version':_0x38e9('0x91')},'json':!![]};return rp(_0xa64391)[_0x38e9('0xe')](function(_0x5895d0){var _0x3c494a={'id':_0x435b89+'_'+_0x5895d0[_0x38e9('0x95')],'name':_0x5895d0['DisplayName'][_0x38e9('0xaf')]?_0x5895d0[_0x38e9('0xb6')][_0x38e9('0xaf')][_0x38e9('0xae')]:_0x5895d0[_0x38e9('0x95')],'custom':![],'options':[]};_0x5303c5['push'](_0x3c494a);return _0x5303c5;});} \ No newline at end of file +var _0xd6dc=['ticketType','incident','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','slainvokedidname','slaname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Attributes(',')/Microsoft.Dynamics.CRM.','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','count','limit','set','update','then','destroy','end','stack','send','index','Dynamics365Account','rawAttributes','key','model','map','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','Dynamics365Configuration','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd6dc,0x1d7));var _0xcd6d=function(_0x7c4ac,_0x2cc85c){_0x7c4ac=_0x7c4ac-0x0;var _0x2d4b54=_0xd6dc[_0x7c4ac];return _0x2d4b54;};'use strict';var rp=require(_0xcd6d('0x0'));var util=require('util');var _=require(_0xcd6d('0x1'));var qs=require(_0xcd6d('0x2'));var logger=require(_0xcd6d('0x3'))(_0xcd6d('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcd6d('0x5'));function respondWithResult(_0x36d693,_0x9da23f){_0x9da23f=_0x9da23f||0xc8;return function(_0x3019be){if(_0x3019be){return _0x36d693[_0xcd6d('0x6')](_0x9da23f)[_0xcd6d('0x7')](_0x3019be);}};}function respondWithFilteredResult(_0x11f0b3,_0x28902d){return function(_0x16400c){if(_0x16400c){var _0x4d880b=typeof _0x28902d[_0xcd6d('0x8')]==='undefined'&&typeof _0x28902d['limit']==='undefined';var _0x33a461=_0x16400c[_0xcd6d('0x9')];var _0x566380=_0x4d880b?0x0:_0x28902d[_0xcd6d('0x8')];var _0x3ae3fb=_0x4d880b?_0x16400c['count']:_0x28902d[_0xcd6d('0x8')]+_0x28902d[_0xcd6d('0xa')];var _0x147b1a;if(_0x3ae3fb>=_0x33a461){_0x3ae3fb=_0x33a461;_0x147b1a=0xc8;}else{_0x147b1a=0xce;}_0x11f0b3['status'](_0x147b1a);return _0x11f0b3[_0xcd6d('0xb')]('Content-Range',_0x566380+'-'+_0x3ae3fb+'/'+_0x33a461)['json'](_0x16400c);}return null;};}function saveUpdates(_0x1e55bd){return function(_0x2a58a5){if(_0x2a58a5){return _0x2a58a5[_0xcd6d('0xc')](_0x1e55bd)[_0xcd6d('0xd')](function(_0x3c5652){return _0x3c5652;});}return null;};}function removeEntity(_0x3e806b){return function(_0x42205e){if(_0x42205e){return _0x42205e[_0xcd6d('0xe')]()[_0xcd6d('0xd')](function(){_0x3e806b['status'](0xcc)[_0xcd6d('0xf')]();});}};}function handleEntityNotFound(_0x2145cc){return function(_0x1f44b3){if(!_0x1f44b3){_0x2145cc['sendStatus'](0x194);}return _0x1f44b3;};}function handleError(_0x107354,_0x5aabbe){_0x5aabbe=_0x5aabbe||0x1f4;return function(_0x16ce89){logger['error'](_0x16ce89[_0xcd6d('0x10')]);if(_0x16ce89['name']){delete _0x16ce89['name'];}_0x107354[_0xcd6d('0x6')](_0x5aabbe)[_0xcd6d('0x11')](_0x16ce89);};}exports[_0xcd6d('0x12')]=function(_0x41b9d5,_0x1bcd95){var _0x57aafe={},_0x5de23c={},_0x299773={'count':0x0,'rows':[]};var _0x2417d7=_['map'](db[_0xcd6d('0x13')][_0xcd6d('0x14')],function(_0x40d02a){return{'name':_0x40d02a['fieldName'],'type':_0x40d02a['type'][_0xcd6d('0x15')]};});_0x5de23c[_0xcd6d('0x16')]=_[_0xcd6d('0x17')](_0x2417d7,_0xcd6d('0x18'));_0x5de23c[_0xcd6d('0x19')]=_[_0xcd6d('0x1a')](_0x41b9d5[_0xcd6d('0x19')]);_0x5de23c['filters']=_['intersection'](_0x5de23c[_0xcd6d('0x16')],_0x5de23c[_0xcd6d('0x19')]);_0x57aafe[_0xcd6d('0x1b')]=_[_0xcd6d('0x1c')](_0x5de23c[_0xcd6d('0x16')],qs[_0xcd6d('0x1d')](_0x41b9d5[_0xcd6d('0x19')][_0xcd6d('0x1d')]));_0x57aafe[_0xcd6d('0x1b')]=_0x57aafe[_0xcd6d('0x1b')][_0xcd6d('0x1e')]?_0x57aafe[_0xcd6d('0x1b')]:_0x5de23c[_0xcd6d('0x16')];if(!_0x41b9d5['query'][_0xcd6d('0x1f')](_0xcd6d('0x20'))){_0x57aafe[_0xcd6d('0xa')]=qs['limit'](_0x41b9d5[_0xcd6d('0x19')]['limit']);_0x57aafe['offset']=qs[_0xcd6d('0x8')](_0x41b9d5[_0xcd6d('0x19')]['offset']);}_0x57aafe[_0xcd6d('0x21')]=qs[_0xcd6d('0x22')](_0x41b9d5[_0xcd6d('0x19')][_0xcd6d('0x22')]);_0x57aafe[_0xcd6d('0x23')]=qs['filters'](_[_0xcd6d('0x24')](_0x41b9d5[_0xcd6d('0x19')],_0x5de23c[_0xcd6d('0x25')]),_0x2417d7);if(_0x41b9d5[_0xcd6d('0x19')][_0xcd6d('0x26')]){_0x57aafe[_0xcd6d('0x23')]=_[_0xcd6d('0x27')](_0x57aafe[_0xcd6d('0x23')],{'$or':_[_0xcd6d('0x17')](_0x2417d7,function(_0x3ead8a){if(_0x3ead8a[_0xcd6d('0x28')]!==_0xcd6d('0x29')){var _0x4b4931={};_0x4b4931[_0x3ead8a[_0xcd6d('0x18')]]={'$like':'%'+_0x41b9d5['query'][_0xcd6d('0x26')]+'%'};return _0x4b4931;}})});}_0x57aafe=_[_0xcd6d('0x27')]({},_0x57aafe,_0x41b9d5[_0xcd6d('0x2a')]);var _0x18c4a0={'where':_0x57aafe[_0xcd6d('0x23')]};return db[_0xcd6d('0x13')][_0xcd6d('0x9')](_0x18c4a0)[_0xcd6d('0xd')](function(_0x584531){_0x299773[_0xcd6d('0x9')]=_0x584531;if(_0x41b9d5[_0xcd6d('0x19')]['includeAll']){_0x57aafe['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x57aafe);})[_0xcd6d('0xd')](function(_0x4c0ce7){_0x299773['rows']=_0x4c0ce7;return _0x299773;})[_0xcd6d('0xd')](respondWithFilteredResult(_0x1bcd95,_0x57aafe))[_0xcd6d('0x2b')](handleError(_0x1bcd95,null));};exports[_0xcd6d('0x2c')]=function(_0x1eae7b,_0x42af5f){var _0x358409={'raw':![],'where':{'id':_0x1eae7b[_0xcd6d('0x2d')]['id']}},_0x428936={};_0x428936['model']=_['keys'](db[_0xcd6d('0x13')][_0xcd6d('0x14')]);_0x428936[_0xcd6d('0x19')]=_[_0xcd6d('0x1a')](_0x1eae7b[_0xcd6d('0x19')]);_0x428936[_0xcd6d('0x25')]=_[_0xcd6d('0x1c')](_0x428936[_0xcd6d('0x16')],_0x428936[_0xcd6d('0x19')]);_0x358409[_0xcd6d('0x1b')]=_['intersection'](_0x428936[_0xcd6d('0x16')],qs[_0xcd6d('0x1d')](_0x1eae7b['query'][_0xcd6d('0x1d')]));_0x358409[_0xcd6d('0x1b')]=_0x358409['attributes'][_0xcd6d('0x1e')]?_0x358409[_0xcd6d('0x1b')]:_0x428936[_0xcd6d('0x16')];if(_0x1eae7b[_0xcd6d('0x19')][_0xcd6d('0x2e')]){_0x358409['include']=[{'all':!![]}];}_0x358409=_[_0xcd6d('0x27')]({},_0x358409,_0x1eae7b[_0xcd6d('0x2a')]);return db[_0xcd6d('0x13')]['find'](_0x358409)['then'](handleEntityNotFound(_0x42af5f,null))[_0xcd6d('0xd')](respondWithResult(_0x42af5f,null))[_0xcd6d('0x2b')](handleError(_0x42af5f,null));};exports[_0xcd6d('0x2f')]=function(_0x348806,_0x855bd4){return db[_0xcd6d('0x13')]['create'](_0x348806[_0xcd6d('0x30')],{})[_0xcd6d('0xd')](respondWithResult(_0x855bd4,0xc9))[_0xcd6d('0x2b')](handleError(_0x855bd4,null));};exports[_0xcd6d('0xc')]=function(_0x3ea66c,_0xe2bce8){if(_0x3ea66c[_0xcd6d('0x30')]['id']){delete _0x3ea66c[_0xcd6d('0x30')]['id'];}return db[_0xcd6d('0x13')]['find']({'where':{'id':_0x3ea66c[_0xcd6d('0x2d')]['id']}})[_0xcd6d('0xd')](handleEntityNotFound(_0xe2bce8,null))['then'](saveUpdates(_0x3ea66c['body'],null))[_0xcd6d('0xd')](respondWithResult(_0xe2bce8,null))[_0xcd6d('0x2b')](handleError(_0xe2bce8,null));};exports['destroy']=function(_0x18f673,_0x3aaa97){return db['Dynamics365Account'][_0xcd6d('0x31')]({'where':{'id':_0x18f673[_0xcd6d('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3aaa97,null))[_0xcd6d('0xd')](removeEntity(_0x3aaa97,null))[_0xcd6d('0x2b')](handleError(_0x3aaa97,null));};exports[_0xcd6d('0x32')]=function(_0x372816,_0x48d3b1){var _0x584180={};var _0x48fcff={};var _0x45b9f6;var _0x48bd10;return db[_0xcd6d('0x13')][_0xcd6d('0x33')]({'where':{'id':_0x372816[_0xcd6d('0x2d')]['id']}})[_0xcd6d('0xd')](handleEntityNotFound(_0x48d3b1,null))[_0xcd6d('0xd')](function(_0x314a82){if(_0x314a82){_0x45b9f6=_0x314a82;_0x48fcff[_0xcd6d('0x16')]=_[_0xcd6d('0x1a')](db[_0xcd6d('0x34')][_0xcd6d('0x14')]);_0x48fcff[_0xcd6d('0x19')]=_['keys'](_0x372816[_0xcd6d('0x19')]);_0x48fcff['filters']=_[_0xcd6d('0x1c')](_0x48fcff[_0xcd6d('0x16')],_0x48fcff[_0xcd6d('0x19')]);_0x584180[_0xcd6d('0x1b')]=_[_0xcd6d('0x1c')](_0x48fcff[_0xcd6d('0x16')],qs[_0xcd6d('0x1d')](_0x372816[_0xcd6d('0x19')][_0xcd6d('0x1d')]));_0x584180[_0xcd6d('0x1b')]=_0x584180[_0xcd6d('0x1b')][_0xcd6d('0x1e')]?_0x584180[_0xcd6d('0x1b')]:_0x48fcff[_0xcd6d('0x16')];_0x584180[_0xcd6d('0x21')]=qs[_0xcd6d('0x22')](_0x372816['query'][_0xcd6d('0x22')]);_0x584180[_0xcd6d('0x23')]=qs[_0xcd6d('0x25')](_[_0xcd6d('0x24')](_0x372816[_0xcd6d('0x19')],_0x48fcff[_0xcd6d('0x25')]));if(_0x372816[_0xcd6d('0x19')][_0xcd6d('0x26')]){_0x584180[_0xcd6d('0x23')]=_[_0xcd6d('0x27')](_0x584180[_0xcd6d('0x23')],{'$or':_[_0xcd6d('0x17')](_0x584180[_0xcd6d('0x1b')],function(_0x50d749){var _0xea18e8={};_0xea18e8[_0x50d749]={'$like':'%'+_0x372816[_0xcd6d('0x19')][_0xcd6d('0x26')]+'%'};return _0xea18e8;})});}_0x584180=_[_0xcd6d('0x27')]({},_0x584180,_0x372816['options']);return _0x45b9f6[_0xcd6d('0x32')](_0x584180);}})[_0xcd6d('0xd')](function(_0x5b0476){if(_0x5b0476){_0x48bd10=_0x5b0476[_0xcd6d('0x1e')];if(!_0x372816['query']['hasOwnProperty']('nolimit')){_0x584180[_0xcd6d('0xa')]=qs[_0xcd6d('0xa')](_0x372816[_0xcd6d('0x19')][_0xcd6d('0xa')]);_0x584180[_0xcd6d('0x8')]=qs[_0xcd6d('0x8')](_0x372816[_0xcd6d('0x19')]['offset']);}return _0x45b9f6['getConfigurations'](_0x584180);}})[_0xcd6d('0xd')](function(_0x17fc10){if(_0x17fc10){return _0x17fc10?{'count':_0x48bd10,'rows':_0x17fc10}:null;}})[_0xcd6d('0xd')](respondWithResult(_0x48d3b1,null))['catch'](handleError(_0x48d3b1,null));};exports['addConfiguration']=function(_0x104a1c,_0xa69e30){if(_0x104a1c['body']['id']){delete _0x104a1c['body']['id'];}return db[_0xcd6d('0x13')][_0xcd6d('0x33')]({'where':{'id':_0x104a1c['params']['id']}})['then'](handleEntityNotFound(_0xa69e30,null))[_0xcd6d('0xd')](function(_0x5ea7a3){if(_0x5ea7a3){_0x104a1c[_0xcd6d('0x30')]['AccountId']=_0x5ea7a3['id'];_0x104a1c[_0xcd6d('0x30')][_0xcd6d('0x35')]=integrations[_0xcd6d('0x36')](_0x104a1c[_0xcd6d('0x30')][_0xcd6d('0x37')],_0x104a1c[_0xcd6d('0x30')][_0xcd6d('0x28')]);_0x104a1c['body']['Descriptions']=integrations[_0xcd6d('0x38')](_0x104a1c['body'][_0xcd6d('0x37')],_0x104a1c[_0xcd6d('0x30')][_0xcd6d('0x28')]);return db[_0xcd6d('0x34')]['create'](_0x104a1c[_0xcd6d('0x30')],{'include':[{'model':db['Dynamics365Field'],'as':_0xcd6d('0x35')},{'model':db[_0xcd6d('0x39')],'as':'Descriptions'}]});}return null;})[_0xcd6d('0xd')](respondWithResult(_0xa69e30,null))[_0xcd6d('0x2b')](handleError(_0xa69e30,null));};function sanitizeRemoteUri(_0x90ebdf){var _0xb6efb3=_0x90ebdf[_0xcd6d('0x3a')](-0x1);if(_0xb6efb3==='/')return _0x90ebdf[_0xcd6d('0x3b')](0x0,_0x90ebdf[_0xcd6d('0x3c')](_0xb6efb3));return _0x90ebdf;}function getWebApiUrl(_0x2f997f){return util['format'](_0xcd6d('0x3d'),_0x2f997f);}exports[_0xcd6d('0x3e')]=function(_0x148f9f,_0x36734c){var _0x35bd0e=_0x148f9f['query'][_0xcd6d('0x3f')];var _0x570f98=_0x35bd0e===_0xcd6d('0x40')?'Incident':'PhoneCall';var _0xbeb3a2='';var _0x2c9762='';var _0x199d7d='';var _0x37edb4='';var _0x4387cb='';var _0x5db56d='';var _0x1484a5='';var _0x89f501='';var _0x2c9855=[_0xcd6d('0x41'),_0xcd6d('0x42'),_0xcd6d('0x43'),'ownerid',_0xcd6d('0x44'),_0xcd6d('0x45'),_0xcd6d('0x46'),_0xcd6d('0x47'),_0xcd6d('0x48'),'phonecall_activity_parties'];var _0x570fc1=[_0xcd6d('0x49'),_0xcd6d('0x4a'),_0xcd6d('0x4b'),_0xcd6d('0x4c'),'contactidname',_0xcd6d('0x4d'),_0xcd6d('0x4e'),_0xcd6d('0x4f'),_0xcd6d('0x50'),_0xcd6d('0x51'),_0xcd6d('0x52'),_0xcd6d('0x53'),_0xcd6d('0x54'),'createdonbehalfbyname',_0xcd6d('0x55'),_0xcd6d('0x56'),'customeridtype','customeridyominame',_0xcd6d('0x57'),_0xcd6d('0x58'),_0xcd6d('0x59'),'entityimage_url','escalatedon',_0xcd6d('0x5a'),_0xcd6d('0x5b'),_0xcd6d('0x5c'),_0xcd6d('0x5d'),_0xcd6d('0x5e'),_0xcd6d('0x5f'),_0xcd6d('0x60'),_0xcd6d('0x61'),_0xcd6d('0x62'),_0xcd6d('0x63'),_0xcd6d('0x64'),_0xcd6d('0x65'),'modifiedon','modifiedonbehalfbyname',_0xcd6d('0x66'),_0xcd6d('0x67'),_0xcd6d('0x68'),'numberofchildincidents','onholdtime',_0xcd6d('0x69'),_0xcd6d('0x6a'),_0xcd6d('0x6b'),_0xcd6d('0x6c'),'parentcaseidname',_0xcd6d('0x6d'),_0xcd6d('0x6e'),'prioritycodename',_0xcd6d('0x6f'),_0xcd6d('0x70'),'resolveby',_0xcd6d('0x71'),'responseby',_0xcd6d('0x72'),'responsiblecontactidyominame','sentimentvalue',_0xcd6d('0x73'),_0xcd6d('0x74'),'socialprofileidname','statecode','statuscode',_0xcd6d('0x75'),_0xcd6d('0x76'),_0xcd6d('0x77'),_0xcd6d('0x78'),_0xcd6d('0x79'),_0xcd6d('0x7a'),_0xcd6d('0x7b')];var _0xe051a=_0x2c9855[_0xcd6d('0x7c')](_0x570fc1);return db[_0xcd6d('0x13')][_0xcd6d('0x33')]({'where':{'id':_0x148f9f[_0xcd6d('0x2d')]['id']},'attributes':['id',_0xcd6d('0x7d'),_0xcd6d('0x7e'),_0xcd6d('0x7f'),_0xcd6d('0x80'),'clientId','clientSecret','modernAuthentication'],'include':[{'model':db[_0xcd6d('0x81')],'as':_0xcd6d('0x81'),'attributes':['id',_0xcd6d('0x82'),_0xcd6d('0x83')]}]})['then'](handleEntityNotFound(_0x36734c,null))['then'](function(_0x409abd){if(_0x409abd){if(_0x409abd['modernAuthentication']){_0x409abd[_0xcd6d('0x84')]=_0x409abd[_0xcd6d('0x81')][_0xcd6d('0x82')];_0x89f501=sanitizeRemoteUri(_0x409abd[_0xcd6d('0x81')][_0xcd6d('0x83')]);_0x1484a5=getWebApiUrl(_0x89f501);return _0x409abd;}_0x89f501=sanitizeRemoteUri(_0x409abd[_0xcd6d('0x7f')]);_0x1484a5=getWebApiUrl(_0x89f501);var _0x59c793={'method':_0xcd6d('0x85'),'uri':_0xcd6d('0x86')+_0x409abd[_0xcd6d('0x80')]+_0xcd6d('0x87'),'form':{'client_id':_0x409abd[_0xcd6d('0x88')],'resource':_0x89f501,'username':_0x409abd[_0xcd6d('0x7d')],'password':_0x409abd[_0xcd6d('0x7e')],'grant_type':'password','client_secret':_0x409abd[_0xcd6d('0x89')]},'json':!![]};return rp(_0x59c793);}})[_0xcd6d('0xd')](function(_0x2126e8){_0x5db56d=_0x2126e8[_0xcd6d('0x84')];var _0x200e6d={'method':_0xcd6d('0x8a'),'uri':encodeURI(_0x1484a5+_0xcd6d('0x8b')+_0x570f98+'\x27'),'headers':{'Authorization':_0xcd6d('0x8c')+_0x5db56d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x200e6d);})['then'](function(_0x5ee5f4){var _0x55bf15=_0x5ee5f4['value'][0x0];var _0x472603=_0x55bf15[_0xcd6d('0x8d')];var _0x304c01={'method':_0xcd6d('0x8a'),'uri':_0x1484a5+_0xcd6d('0x8e')+_0x472603+_0xcd6d('0x8f'),'headers':{'Authorization':_0xcd6d('0x8c')+_0x5db56d,'If-None-Match':null,'OData-Version':_0xcd6d('0x90')},'json':!![]};return rp(_0x304c01);})[_0xcd6d('0xd')](function(_0x517ad0){_0xbeb3a2=_0x517ad0;_0x2c9762=_0xbeb3a2[_0xcd6d('0x91')];_0x2c9762=_[_0xcd6d('0x92')](_0x2c9762,function(_0x3d6f7d){return!_0xe051a[_0xcd6d('0x93')](_0x3d6f7d[_0xcd6d('0x94')]);});var _0x4c9ef5=[];var _0x2a0031=[];_0x2c9762['forEach'](function(_0x1ba1d3){if(_0x1ba1d3[_0xcd6d('0x95')]){var _0x411433=_0x1ba1d3[_0xcd6d('0x95')][_0xcd6d('0x3b')](_0x1ba1d3[_0xcd6d('0x95')]['lastIndexOf']('.')+0x1);if(_0x411433===_0xcd6d('0x96')){_0x4c9ef5[_0xcd6d('0x97')](getSelectList(_0x1484a5,_0x35bd0e,_0x2a0031,_0xbeb3a2[_0xcd6d('0x8d')],_0x1ba1d3['MetadataId'],_0x5db56d));}}});return Promise[_0xcd6d('0x98')](_0x4c9ef5);})['then'](function(_0x2743f6){_0x199d7d=_0x2743f6[0x0];var _0xa3cdd7=[];var _0x1c02ff=[];_0x2c9762[_0xcd6d('0x99')](function(_0x2014d9){if(!_[_0xcd6d('0x9a')](_0x2014d9[_0xcd6d('0x95')])){var _0x179472=_0x2014d9[_0xcd6d('0x95')][_0xcd6d('0x3b')](_0x2014d9[_0xcd6d('0x95')][_0xcd6d('0x3c')]('.')+0x1);if(_0x179472===_0xcd6d('0x9b')){_0xa3cdd7[_0xcd6d('0x97')](getBooleanList(_0x1484a5,_0x35bd0e,_0x1c02ff,_0xbeb3a2[_0xcd6d('0x8d')],_0x2014d9['MetadataId'],_0x5db56d));}}});return Promise[_0xcd6d('0x98')](_0xa3cdd7);})[_0xcd6d('0xd')](function(_0x412c71){_0x37edb4=_0x412c71[0x0];var _0x51dd84=[];var _0x5a201a=[];_0x2c9762[_0xcd6d('0x99')](function(_0x68dba2){if(_0x68dba2[_0xcd6d('0x95')]){var _0x6db9e6=_0x68dba2[_0xcd6d('0x95')]['substring'](_0x68dba2[_0xcd6d('0x95')][_0xcd6d('0x3c')]('.')+0x1);if(_0x6db9e6==='StringAttributeMetadata'||_0x6db9e6===_0xcd6d('0x9c')||_0x6db9e6===_0xcd6d('0x9d')||_0x6db9e6===_0xcd6d('0x9e')||_0x6db9e6===_0xcd6d('0x9f')||_0x6db9e6===_0xcd6d('0xa0')||_0x6db9e6===_0xcd6d('0xa1')||_0x6db9e6==='EntityNameAttributeMetadata'||_0x6db9e6==='StateAttributeMetadata'||_0x6db9e6==='DecimalAttributeMetadata'){_0x51dd84[_0xcd6d('0x97')](getInputList(_0x1484a5,_0x35bd0e,_0x6db9e6,_0x5a201a,_0xbeb3a2[_0xcd6d('0x8d')],_0x68dba2[_0xcd6d('0x8d')],_0x5db56d));}}});return Promise[_0xcd6d('0x98')](_0x51dd84);})[_0xcd6d('0xd')](function(_0x292d68){_0x4387cb=_0x292d68[0x0];var _0x4f5b1b=_0x199d7d[_0xcd6d('0x7c')](_0x37edb4)[_0xcd6d('0x7c')](_0x4387cb);var _0x482f27={'count':_0x4f5b1b[_0xcd6d('0x1e')],'rows':_0x4f5b1b};return _0x482f27;})['then'](respondWithResult(_0x36734c,null))[_0xcd6d('0x2b')](function(_0x49d650){var _0x569d6c=_0x148f9f[_0xcd6d('0x19')][_0xcd6d('0xa2')]?0x1f4:_0x49d650[_0xcd6d('0xa3')]||0x1f4;logger['error'](_0x49d650[_0xcd6d('0x10')]);delete _0x49d650[_0xcd6d('0x18')];if(_0x569d6c===0x191){_0x569d6c=0x190;}_0x36734c['status'](_0x569d6c)['send'](_0x148f9f[_0xcd6d('0x19')][_0xcd6d('0xa2')]?{'message':_0xcd6d('0xa4'),'statusCode':_0x49d650[_0xcd6d('0xa3')]}:_0x49d650);});};function getSelectList(_0x27c9e5,_0x4df067,_0x23e77e,_0x504b91,_0x196b27,_0x29552a){var _0x1d0342={'method':_0xcd6d('0x8a'),'uri':_0x27c9e5+'EntityDefinitions('+_0x504b91+')/Attributes('+_0x196b27+_0xcd6d('0xa5')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xcd6d('0x8c')+_0x29552a,'If-None-Match':null,'OData-Version':_0xcd6d('0x90')},'json':!![]};return rp(_0x1d0342)['then'](function(_0x5c91c4){var _0x59ba24=[];var _0x551fba=_0x5c91c4[_0xcd6d('0xa6')]['Options'];_0x551fba[_0xcd6d('0x99')](function(_0x5e1284){_0x59ba24[_0xcd6d('0x97')]({'name':_0x5e1284[_0xcd6d('0xa7')][_0xcd6d('0xa8')][_0xcd6d('0xa7')],'value':String(_0x5e1284[_0xcd6d('0xa9')])});});var _0x494c06={'id':_0x4df067+'_'+_0x5c91c4[_0xcd6d('0x94')],'name':_0x5c91c4[_0xcd6d('0xaa')][_0xcd6d('0xa8')]['Label'],'custom':![],'options':_0x59ba24};_0x23e77e[_0xcd6d('0x97')](_0x494c06);return _0x23e77e;});}function getBooleanList(_0x12561b,_0x3e1804,_0x2a1c4f,_0x91ab7e,_0xe1499c,_0xdb1e1e){var _0x370700={'method':_0xcd6d('0x8a'),'uri':_0x12561b+_0xcd6d('0x8e')+_0x91ab7e+')/Attributes('+_0xe1499c+_0xcd6d('0xab'),'headers':{'Authorization':'Bearer\x20'+_0xdb1e1e,'If-None-Match':null,'OData-Version':_0xcd6d('0x90')},'json':!![]};return rp(_0x370700)['then'](function(_0x5cd353){var _0x37eedc=[];_0x37eedc[_0xcd6d('0x97')]({'name':_0x5cd353[_0xcd6d('0xa6')][_0xcd6d('0xac')][_0xcd6d('0xa7')][_0xcd6d('0xa8')][_0xcd6d('0xa7')],'value':_0xcd6d('0xad')},{'name':_0x5cd353[_0xcd6d('0xa6')][_0xcd6d('0xae')][_0xcd6d('0xa7')][_0xcd6d('0xa8')][_0xcd6d('0xa7')],'value':_0xcd6d('0xaf')});var _0x2d2918={'id':_0x3e1804+'_'+_0x5cd353[_0xcd6d('0x94')],'name':_0x5cd353[_0xcd6d('0xaa')][_0xcd6d('0xa8')][_0xcd6d('0xa7')],'custom':![],'options':_0x37eedc};_0x2a1c4f[_0xcd6d('0x97')](_0x2d2918);return _0x2a1c4f;});}function getInputList(_0x291d6e,_0x10e432,_0x1876fb,_0x19771c,_0x302fef,_0x199821,_0x23b1a0){var _0x343a29={'method':'GET','uri':_0x291d6e+_0xcd6d('0x8e')+_0x302fef+_0xcd6d('0xb0')+_0x199821+_0xcd6d('0xb1')+_0x1876fb+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xcd6d('0x8c')+_0x23b1a0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x343a29)['then'](function(_0x1be802){var _0x2c32d2={'id':_0x10e432+'_'+_0x1be802['LogicalName'],'name':_0x1be802[_0xcd6d('0xaa')][_0xcd6d('0xa8')]?_0x1be802[_0xcd6d('0xaa')][_0xcd6d('0xa8')]['Label']:_0x1be802[_0xcd6d('0x94')],'custom':![],'options':[]};_0x19771c[_0xcd6d('0x97')](_0x2c32d2);return _0x19771c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 890bf5b..45c84f1 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(_0x1a1fc6,_0x1a7471){var _0x147c10=function(_0x35ae66){while(--_0x35ae66){_0x1a1fc6['push'](_0x1a1fc6['shift']());}};_0x147c10(++_0x1a7471);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x288d8e,_0x17b6a0){var _0x34e0a0=function(_0x16484e){while(--_0x16484e){_0x288d8e['push'](_0x288d8e['shift']());}};_0x34e0a0(++_0x17b6a0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 3332fbb..570b860 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 _0x6bed=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','attributes','include','map','model','find','raw','ShowDynamics365Account','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6bed,0x194));var _0xd6be=function(_0x4c3ed7,_0x55d37f){_0x4c3ed7=_0x4c3ed7-0x0;var _0x21d70c=_0x6bed[_0x4c3ed7];return _0x21d70c;};'use strict';var _=require(_0xd6be('0x0'));var util=require('util');var moment=require(_0xd6be('0x1'));var BPromise=require(_0xd6be('0x2'));var rs=require(_0xd6be('0x3'));var fs=require('fs');var Redis=require(_0xd6be('0x4'));var db=require(_0xd6be('0x5'))['db'];var utils=require(_0xd6be('0x6'));var logger=require(_0xd6be('0x7'))(_0xd6be('0x8'));var config=require('../../config/environment');var jayson=require(_0xd6be('0x9'));var client=jayson[_0xd6be('0xa')][_0xd6be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c5f27,_0x5c06f2,_0x4ac32d){return new BPromise(function(_0x2aa48e,_0x39ed7a){return client['request'](_0x2c5f27,_0x4ac32d)[_0xd6be('0xc')](function(_0x3cbfda){logger[_0xd6be('0xd')](_0xd6be('0xe'),_0x5c06f2,_0xd6be('0xf'));logger[_0xd6be('0x10')](_0xd6be('0x11'),_0x5c06f2,_0xd6be('0xf'),JSON[_0xd6be('0x12')](_0x3cbfda));if(_0x3cbfda[_0xd6be('0x13')]){if(_0x3cbfda[_0xd6be('0x13')][_0xd6be('0x14')]===0x1f4){logger[_0xd6be('0x13')](_0xd6be('0xe'),_0x5c06f2,_0x3cbfda['error']['message']);return _0x39ed7a(_0x3cbfda[_0xd6be('0x13')]['message']);}logger[_0xd6be('0x13')](_0xd6be('0xe'),_0x5c06f2,_0x3cbfda[_0xd6be('0x13')][_0xd6be('0x15')]);return _0x2aa48e(_0x3cbfda[_0xd6be('0x13')][_0xd6be('0x15')]);}else{logger[_0xd6be('0xd')](_0xd6be('0xe'),_0x5c06f2,'request\x20sent');_0x2aa48e(_0x3cbfda[_0xd6be('0x16')][_0xd6be('0x15')]);}})['catch'](function(_0x373c75){logger[_0xd6be('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x5c06f2,_0x373c75);_0x39ed7a(_0x373c75);});});}exports[_0xd6be('0x17')]=function(_0x37cb36){var _0x3b7c4b=this;return new Promise(function(_0x5062d5,_0x19fc08){return db[_0xd6be('0x18')][_0xd6be('0x19')]({'raw':_0x37cb36[_0xd6be('0x1a')]?_0x37cb36[_0xd6be('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x37cb36['options']?_0x37cb36[_0xd6be('0x1a')]['where']||null:null,'attributes':_0x37cb36[_0xd6be('0x1a')]?_0x37cb36[_0xd6be('0x1a')][_0xd6be('0x1b')]||null:null,'limit':_0x37cb36[_0xd6be('0x1a')]?_0x37cb36[_0xd6be('0x1a')]['limit']||null:null,'include':_0x37cb36[_0xd6be('0x1a')]?_0x37cb36[_0xd6be('0x1a')][_0xd6be('0x1c')]?_[_0xd6be('0x1d')](_0x37cb36['options'][_0xd6be('0x1c')],function(_0x3e3cea){return{'model':db[_0x3e3cea['model']],'as':_0x3e3cea['as'],'attributes':_0x3e3cea['attributes'],'include':_0x3e3cea[_0xd6be('0x1c')]?_[_0xd6be('0x1d')](_0x3e3cea[_0xd6be('0x1c')],function(_0x22d5de){return{'model':db[_0x22d5de['model']],'as':_0x22d5de['as'],'attributes':_0x22d5de[_0xd6be('0x1b')],'include':_0x22d5de[_0xd6be('0x1c')]?_['map'](_0x22d5de[_0xd6be('0x1c')],function(_0x20bd1a){return{'model':db[_0x20bd1a[_0xd6be('0x1e')]],'as':_0x20bd1a['as'],'attributes':_0x20bd1a[_0xd6be('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18d260){logger[_0xd6be('0xd')](_0xd6be('0x17'),_0x37cb36);logger[_0xd6be('0x10')](_0xd6be('0x17'),_0x37cb36,JSON[_0xd6be('0x12')](_0x18d260));_0x5062d5(_0x18d260);})['catch'](function(_0x2c6878){logger[_0xd6be('0x13')]('GetDynamics365Account',_0x2c6878[_0xd6be('0x15')],_0x37cb36);_0x19fc08(_0x3b7c4b[_0xd6be('0x13')](0x1f4,_0x2c6878['message']));});});};exports['ShowDynamics365Account']=function(_0x3d4961){var _0x18123f=this;return new Promise(function(_0x40534a,_0x3d89cb){return db['Dynamics365Account'][_0xd6be('0x1f')]({'raw':_0x3d4961[_0xd6be('0x1a')]?_0x3d4961[_0xd6be('0x1a')][_0xd6be('0x20')]===undefined?!![]:![]:!![],'where':_0x3d4961[_0xd6be('0x1a')]?_0x3d4961[_0xd6be('0x1a')]['where']||null:null,'attributes':_0x3d4961[_0xd6be('0x1a')]?_0x3d4961[_0xd6be('0x1a')][_0xd6be('0x1b')]||null:null,'include':_0x3d4961[_0xd6be('0x1a')]?_0x3d4961[_0xd6be('0x1a')][_0xd6be('0x1c')]?_[_0xd6be('0x1d')](_0x3d4961[_0xd6be('0x1a')][_0xd6be('0x1c')],function(_0x38a922){return{'model':db[_0x38a922[_0xd6be('0x1e')]],'as':_0x38a922['as'],'attributes':_0x38a922['attributes'],'include':_0x38a922[_0xd6be('0x1c')]?_[_0xd6be('0x1d')](_0x38a922[_0xd6be('0x1c')],function(_0x2b0b5b){return{'model':db[_0x2b0b5b[_0xd6be('0x1e')]],'as':_0x2b0b5b['as'],'attributes':_0x2b0b5b[_0xd6be('0x1b')],'include':_0x2b0b5b[_0xd6be('0x1c')]?_[_0xd6be('0x1d')](_0x2b0b5b[_0xd6be('0x1c')],function(_0x5aeaec){return{'model':db[_0x5aeaec[_0xd6be('0x1e')]],'as':_0x5aeaec['as'],'attributes':_0x5aeaec[_0xd6be('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd6be('0xc')](function(_0x376e66){logger['info'](_0xd6be('0x21'),_0x3d4961);logger[_0xd6be('0x10')](_0xd6be('0x21'),_0x3d4961,JSON[_0xd6be('0x12')](_0x376e66));_0x40534a(_0x376e66);})[_0xd6be('0x22')](function(_0x2f4b84){logger['error'](_0xd6be('0x21'),_0x2f4b84[_0xd6be('0x15')],_0x3d4961);_0x3d89cb(_0x18123f[_0xd6be('0x13')](0x1f4,_0x2f4b84[_0xd6be('0x15')]));});});}; \ No newline at end of file +var _0x02d5=['find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account'];(function(_0x409521,_0x1eef13){var _0x24df06=function(_0x38c0f5){while(--_0x38c0f5){_0x409521['push'](_0x409521['shift']());}};_0x24df06(++_0x1eef13);}(_0x02d5,0x111));var _0x502d=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0x02d5[_0x52a6e3];return _0x8910d0;};'use strict';var _=require(_0x502d('0x0'));var util=require(_0x502d('0x1'));var moment=require('moment');var BPromise=require(_0x502d('0x2'));var rs=require(_0x502d('0x3'));var fs=require('fs');var Redis=require(_0x502d('0x4'));var db=require(_0x502d('0x5'))['db'];var utils=require(_0x502d('0x6'));var logger=require(_0x502d('0x7'))('rpc');var config=require(_0x502d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x502d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2894b8,_0x1d3532,_0x1105de){return new BPromise(function(_0x4a9f4c,_0x133026){return client[_0x502d('0xa')](_0x2894b8,_0x1105de)[_0x502d('0xb')](function(_0x2f632b){logger[_0x502d('0xc')](_0x502d('0xd'),_0x1d3532,'request\x20sent');logger[_0x502d('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1d3532,_0x502d('0xf'),JSON[_0x502d('0x10')](_0x2f632b));if(_0x2f632b[_0x502d('0x11')]){if(_0x2f632b[_0x502d('0x11')][_0x502d('0x12')]===0x1f4){logger[_0x502d('0x11')](_0x502d('0xd'),_0x1d3532,_0x2f632b[_0x502d('0x11')][_0x502d('0x13')]);return _0x133026(_0x2f632b[_0x502d('0x11')][_0x502d('0x13')]);}logger[_0x502d('0x11')](_0x502d('0xd'),_0x1d3532,_0x2f632b[_0x502d('0x11')]['message']);return _0x4a9f4c(_0x2f632b[_0x502d('0x11')][_0x502d('0x13')]);}else{logger[_0x502d('0xc')](_0x502d('0xd'),_0x1d3532,_0x502d('0xf'));_0x4a9f4c(_0x2f632b['result']['message']);}})[_0x502d('0x14')](function(_0x3f3a4d){logger['error'](_0x502d('0xd'),_0x1d3532,_0x3f3a4d);_0x133026(_0x3f3a4d);});});}exports[_0x502d('0x15')]=function(_0x4ef275){var _0x2086bc=this;return new Promise(function(_0x3223f3,_0x10bcd9){return db[_0x502d('0x16')][_0x502d('0x17')]({'raw':_0x4ef275['options']?_0x4ef275[_0x502d('0x18')][_0x502d('0x19')]===undefined?!![]:![]:!![],'where':_0x4ef275[_0x502d('0x18')]?_0x4ef275['options'][_0x502d('0x1a')]||null:null,'attributes':_0x4ef275[_0x502d('0x18')]?_0x4ef275['options'][_0x502d('0x1b')]||null:null,'limit':_0x4ef275[_0x502d('0x18')]?_0x4ef275[_0x502d('0x18')][_0x502d('0x1c')]||null:null,'include':_0x4ef275[_0x502d('0x18')]?_0x4ef275[_0x502d('0x18')][_0x502d('0x1d')]?_[_0x502d('0x1e')](_0x4ef275[_0x502d('0x18')][_0x502d('0x1d')],function(_0x1e4bea){return{'model':db[_0x1e4bea[_0x502d('0x1f')]],'as':_0x1e4bea['as'],'attributes':_0x1e4bea['attributes'],'include':_0x1e4bea[_0x502d('0x1d')]?_['map'](_0x1e4bea[_0x502d('0x1d')],function(_0x59de12){return{'model':db[_0x59de12[_0x502d('0x1f')]],'as':_0x59de12['as'],'attributes':_0x59de12['attributes'],'include':_0x59de12[_0x502d('0x1d')]?_[_0x502d('0x1e')](_0x59de12['include'],function(_0x315bca){return{'model':db[_0x315bca[_0x502d('0x1f')]],'as':_0x315bca['as'],'attributes':_0x315bca[_0x502d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x502d('0xb')](function(_0x17894a){logger[_0x502d('0xc')](_0x502d('0x15'),_0x4ef275);logger[_0x502d('0xe')](_0x502d('0x15'),_0x4ef275,JSON[_0x502d('0x10')](_0x17894a));_0x3223f3(_0x17894a);})[_0x502d('0x14')](function(_0x4c407d){logger[_0x502d('0x11')](_0x502d('0x15'),_0x4c407d[_0x502d('0x13')],_0x4ef275);_0x10bcd9(_0x2086bc[_0x502d('0x11')](0x1f4,_0x4c407d[_0x502d('0x13')]));});});};exports[_0x502d('0x20')]=function(_0x21e51e){var _0x9e19c8=this;return new Promise(function(_0x3abb43,_0x4e4b8d){return db['Dynamics365Account'][_0x502d('0x21')]({'raw':_0x21e51e[_0x502d('0x18')]?_0x21e51e['options']['raw']===undefined?!![]:![]:!![],'where':_0x21e51e[_0x502d('0x18')]?_0x21e51e[_0x502d('0x18')]['where']||null:null,'attributes':_0x21e51e[_0x502d('0x18')]?_0x21e51e[_0x502d('0x18')][_0x502d('0x1b')]||null:null,'include':_0x21e51e[_0x502d('0x18')]?_0x21e51e[_0x502d('0x18')][_0x502d('0x1d')]?_['map'](_0x21e51e[_0x502d('0x18')]['include'],function(_0x3beb24){return{'model':db[_0x3beb24[_0x502d('0x1f')]],'as':_0x3beb24['as'],'attributes':_0x3beb24['attributes'],'include':_0x3beb24[_0x502d('0x1d')]?_[_0x502d('0x1e')](_0x3beb24['include'],function(_0x442d62){return{'model':db[_0x442d62['model']],'as':_0x442d62['as'],'attributes':_0x442d62[_0x502d('0x1b')],'include':_0x442d62[_0x502d('0x1d')]?_[_0x502d('0x1e')](_0x442d62[_0x502d('0x1d')],function(_0x2141d1){return{'model':db[_0x2141d1[_0x502d('0x1f')]],'as':_0x2141d1['as'],'attributes':_0x2141d1[_0x502d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x502d('0xb')](function(_0x1d225b){logger[_0x502d('0xc')](_0x502d('0x20'),_0x21e51e);logger[_0x502d('0xe')](_0x502d('0x20'),_0x21e51e,JSON[_0x502d('0x10')](_0x1d225b));_0x3abb43(_0x1d225b);})['catch'](function(_0x39ae17){logger[_0x502d('0x11')](_0x502d('0x20'),_0x39ae17[_0x502d('0x13')],_0x21e51e);_0x4e4b8d(_0x9e19c8[_0x502d('0x11')](0x1f4,_0x39ae17['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9392b10..955f90c 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 _0x376f=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/subjects'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x376f,0x78));var _0xf376=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x376f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf376('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf376('0x1'));var express=require(_0xf376('0x2'));var router=express['Router']();var fs_extra=require(_0xf376('0x3'));var auth=require(_0xf376('0x4'));var interaction=require(_0xf376('0x5'));var config=require(_0xf376('0x6'));var controller=require(_0xf376('0x7'));router[_0xf376('0x8')]('/',auth[_0xf376('0x9')](),controller['index']);router[_0xf376('0x8')](_0xf376('0xa'),auth[_0xf376('0x9')](),controller['show']);router[_0xf376('0x8')]('/:id/fields',auth[_0xf376('0x9')](),controller['getFields']);router[_0xf376('0x8')](_0xf376('0xb'),auth[_0xf376('0x9')](),controller[_0xf376('0xc')]);router['get'](_0xf376('0xd'),auth[_0xf376('0x9')](),controller[_0xf376('0xe')]);router[_0xf376('0xf')]('/',auth['isAuthenticated'](),controller[_0xf376('0x10')]);router[_0xf376('0x11')](_0xf376('0xa'),auth['isAuthenticated'](),controller[_0xf376('0x12')]);router[_0xf376('0x13')](_0xf376('0xa'),auth[_0xf376('0x9')](),controller[_0xf376('0x14')]);module[_0xf376('0x15')]=router; \ No newline at end of file +var _0x2ade=['get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0xd5dd0,_0x1216b2){var _0xfc087b=function(_0x3f1ff8){while(--_0x3f1ff8){_0xd5dd0['push'](_0xd5dd0['shift']());}};_0xfc087b(++_0x1216b2);}(_0x2ade,0xb6));var _0xe2ad=function(_0xad0534,_0x48003d){_0xad0534=_0xad0534-0x0;var _0x13921f=_0x2ade[_0xad0534];return _0x13921f;};'use strict';var multer=require(_0xe2ad('0x0'));var util=require(_0xe2ad('0x1'));var path=require(_0xe2ad('0x2'));var timeout=require(_0xe2ad('0x3'));var express=require(_0xe2ad('0x4'));var router=express[_0xe2ad('0x5')]();var fs_extra=require(_0xe2ad('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe2ad('0x7'));var config=require(_0xe2ad('0x8'));var controller=require(_0xe2ad('0x9'));router[_0xe2ad('0xa')]('/',auth[_0xe2ad('0xb')](),controller['index']);router[_0xe2ad('0xa')]('/:id',auth[_0xe2ad('0xb')](),controller[_0xe2ad('0xc')]);router[_0xe2ad('0xa')](_0xe2ad('0xd'),auth[_0xe2ad('0xb')](),controller[_0xe2ad('0xe')]);router[_0xe2ad('0xa')](_0xe2ad('0xf'),auth[_0xe2ad('0xb')](),controller[_0xe2ad('0x10')]);router['get'](_0xe2ad('0x11'),auth[_0xe2ad('0xb')](),controller[_0xe2ad('0x12')]);router[_0xe2ad('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2ad('0x14')](_0xe2ad('0x15'),auth['isAuthenticated'](),controller[_0xe2ad('0x16')]);router['delete'](_0xe2ad('0x15'),auth[_0xe2ad('0xb')](),controller['destroy']);module[_0xe2ad('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index fee9f53..7cc9d35 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 _0xe944=['contact','STRING','incident','phonecall','ENUM'];(function(_0x2cde8a,_0x18949e){var _0x3e36c2=function(_0x54458c){while(--_0x54458c){_0x2cde8a['push'](_0x2cde8a['shift']());}};_0x3e36c2(++_0x18949e);}(_0xe944,0x1dc));var _0x4e94=function(_0x3dd0a9,_0x4dfef5){_0x3dd0a9=_0x3dd0a9-0x0;var _0x2ccff3=_0xe944[_0x3dd0a9];return _0x2ccff3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4e94('0x0')]},'description':{'type':Sequelize[_0x4e94('0x0')]},'ticketType':{'type':Sequelize['ENUM'](_0x4e94('0x1'),_0x4e94('0x2')),'defaultValue':_0x4e94('0x1')},'moduleCreate':{'type':Sequelize[_0x4e94('0x3')](_0x4e94('0x4'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x4e94('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xdb45=['STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN'];(function(_0x56366f,_0x276a27){var _0x8e85b0=function(_0x155a83){while(--_0x155a83){_0x56366f['push'](_0x56366f['shift']());}};_0x8e85b0(++_0x276a27);}(_0xdb45,0x1ab));var _0x5db4=function(_0xe46818,_0x5125b5){_0xe46818=_0xe46818-0x0;var _0xd2fb1e=_0xdb45[_0xe46818];return _0xd2fb1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5db4('0x0')]},'description':{'type':Sequelize[_0x5db4('0x0')]},'ticketType':{'type':Sequelize[_0x5db4('0x1')](_0x5db4('0x2'),_0x5db4('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x5db4('0x1')](_0x5db4('0x4'),_0x5db4('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5db4('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5db4('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7fb0f5c..4ee0653 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 _0xc86b=['undefined','limit','count','set','apply','save','then','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','map','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','find','create','body','update','destroy','Dynamics365Field','getFields','getSubjects','findOne','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset'];(function(_0x24529e,_0x20b864){var _0x4f37ba=function(_0x1532e3){while(--_0x1532e3){_0x24529e['push'](_0x24529e['shift']());}};_0x4f37ba(++_0x20b864);}(_0xc86b,0xd2));var _0xbc86=function(_0x3704d2,_0x180599){_0x3704d2=_0x3704d2-0x0;var _0x47301a=_0xc86b[_0x3704d2];return _0x47301a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc86('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc86('0x1'));var rp=require(_0xbc86('0x2'));var moment=require(_0xbc86('0x3'));var BPromise=require(_0xbc86('0x4'));var Mustache=require(_0xbc86('0x5'));var util=require(_0xbc86('0x6'));var path=require(_0xbc86('0x7'));var sox=require(_0xbc86('0x8'));var csv=require(_0xbc86('0x9'));var ejs=require(_0xbc86('0xa'));var fs=require('fs');var fs_extra=require(_0xbc86('0xb'));var _=require(_0xbc86('0xc'));var squel=require(_0xbc86('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc86('0xe'));var toCsv=require(_0xbc86('0x9'));var querystring=require(_0xbc86('0xf'));var Papa=require(_0xbc86('0x10'));var Redis=require(_0xbc86('0x11'));var authService=require(_0xbc86('0x12'));var qs=require(_0xbc86('0x13'));var as=require(_0xbc86('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc86('0x15'))(_0xbc86('0x16'));var utils=require(_0xbc86('0x17'));var config=require(_0xbc86('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc86('0x19'))['db'];function respondWithStatusCode(_0x5c6b0d,_0x133b15){_0x133b15=_0x133b15||0xcc;return function(_0x4daf5f){if(_0x4daf5f){return _0x5c6b0d[_0xbc86('0x1a')](_0x133b15);}return _0x5c6b0d[_0xbc86('0x1b')](_0x133b15)[_0xbc86('0x1c')]();};}function respondWithResult(_0x5caf72,_0x39729b){_0x39729b=_0x39729b||0xc8;return function(_0x519c6d){if(_0x519c6d){return _0x5caf72[_0xbc86('0x1b')](_0x39729b)['json'](_0x519c6d);}};}function respondWithFilteredResult(_0x2350e0,_0x482a1e){return function(_0x1f4f81){if(_0x1f4f81){var _0x2b1ffc=typeof _0x482a1e[_0xbc86('0x1d')]===_0xbc86('0x1e')&&typeof _0x482a1e[_0xbc86('0x1f')]===_0xbc86('0x1e');var _0x268534=_0x1f4f81[_0xbc86('0x20')];var _0x305b2b=_0x2b1ffc?0x0:_0x482a1e[_0xbc86('0x1d')];var _0x14d527=_0x2b1ffc?_0x1f4f81[_0xbc86('0x20')]:_0x482a1e[_0xbc86('0x1d')]+_0x482a1e[_0xbc86('0x1f')];var _0x39d39e;if(_0x14d527>=_0x268534){_0x14d527=_0x268534;_0x39d39e=0xc8;}else{_0x39d39e=0xce;}_0x2350e0['status'](_0x39d39e);return _0x2350e0[_0xbc86('0x21')]('Content-Range',_0x305b2b+'-'+_0x14d527+'/'+_0x268534)['json'](_0x1f4f81);}return null;};}function patchUpdates(_0x3af10f){return function(_0xf3ce03){try{jsonpatch[_0xbc86('0x22')](_0xf3ce03,_0x3af10f,!![]);}catch(_0x3cbd27){return BPromise['reject'](_0x3cbd27);}return _0xf3ce03[_0xbc86('0x23')]();};}function saveUpdates(_0x2020a7,_0x3232a0){return function(_0x468d40){if(_0x468d40){return _0x468d40['update'](_0x2020a7)['then'](function(_0x2be7ef){return _0x2be7ef;});}return null;};}function removeEntity(_0x29a382,_0x567c0e){return function(_0x5ec586){if(_0x5ec586){return _0x5ec586['destroy']()[_0xbc86('0x24')](function(){_0x29a382[_0xbc86('0x1b')](0xcc)[_0xbc86('0x1c')]();});}};}function handleEntityNotFound(_0x295bbd,_0x4e5396){return function(_0x2dd91e){if(!_0x2dd91e){_0x295bbd['sendStatus'](0x194);}return _0x2dd91e;};}function handleError(_0x4328df,_0x178658){_0x178658=_0x178658||0x1f4;return function(_0x1b3be3){logger[_0xbc86('0x25')](_0x1b3be3[_0xbc86('0x26')]);if(_0x1b3be3[_0xbc86('0x27')]){delete _0x1b3be3['name'];}_0x4328df['status'](_0x178658)[_0xbc86('0x28')](_0x1b3be3);};}exports[_0xbc86('0x29')]=function(_0x16470f,_0x40135d){var _0x39ffe0={},_0x4ac27d={},_0x3640c3={'count':0x0,'rows':[]};var _0x25b90b=_['map'](db[_0xbc86('0x2a')][_0xbc86('0x2b')],function(_0x390bee){return{'name':_0x390bee[_0xbc86('0x2c')],'type':_0x390bee['type'][_0xbc86('0x2d')]};});_0x4ac27d[_0xbc86('0x2e')]=_['map'](_0x25b90b,'name');_0x4ac27d[_0xbc86('0x2f')]=_[_0xbc86('0x30')](_0x16470f[_0xbc86('0x2f')]);_0x4ac27d['filters']=_[_0xbc86('0x31')](_0x4ac27d[_0xbc86('0x2e')],_0x4ac27d[_0xbc86('0x2f')]);_0x39ffe0[_0xbc86('0x32')]=_['intersection'](_0x4ac27d[_0xbc86('0x2e')],qs[_0xbc86('0x33')](_0x16470f[_0xbc86('0x2f')][_0xbc86('0x33')]));_0x39ffe0['attributes']=_0x39ffe0[_0xbc86('0x32')][_0xbc86('0x34')]?_0x39ffe0[_0xbc86('0x32')]:_0x4ac27d[_0xbc86('0x2e')];if(!_0x16470f[_0xbc86('0x2f')][_0xbc86('0x35')](_0xbc86('0x36'))){_0x39ffe0['limit']=qs[_0xbc86('0x1f')](_0x16470f[_0xbc86('0x2f')][_0xbc86('0x1f')]);_0x39ffe0[_0xbc86('0x1d')]=qs[_0xbc86('0x1d')](_0x16470f[_0xbc86('0x2f')]['offset']);}_0x39ffe0[_0xbc86('0x37')]=qs[_0xbc86('0x38')](_0x16470f['query'][_0xbc86('0x38')]);_0x39ffe0['where']=qs[_0xbc86('0x39')](_[_0xbc86('0x3a')](_0x16470f[_0xbc86('0x2f')],_0x4ac27d[_0xbc86('0x39')]),_0x25b90b);if(_0x16470f[_0xbc86('0x2f')]['filter']){_0x39ffe0[_0xbc86('0x3b')]=_['merge'](_0x39ffe0['where'],{'$or':_[_0xbc86('0x3c')](_0x25b90b,function(_0x5c7bb3){if(_0x5c7bb3['type']!==_0xbc86('0x3d')){var _0x4bbc60={};_0x4bbc60[_0x5c7bb3[_0xbc86('0x27')]]={'$like':'%'+_0x16470f[_0xbc86('0x2f')][_0xbc86('0x3e')]+'%'};return _0x4bbc60;}})});}_0x39ffe0=_[_0xbc86('0x3f')]({},_0x39ffe0,_0x16470f[_0xbc86('0x40')]);var _0x3d1d70={'where':_0x39ffe0[_0xbc86('0x3b')]};return db['Dynamics365Configuration'][_0xbc86('0x20')](_0x3d1d70)['then'](function(_0x30cd3f){_0x3640c3[_0xbc86('0x20')]=_0x30cd3f;if(_0x16470f[_0xbc86('0x2f')][_0xbc86('0x41')]){_0x39ffe0['include']=[{'all':!![]}];}return db[_0xbc86('0x2a')][_0xbc86('0x42')](_0x39ffe0);})[_0xbc86('0x24')](function(_0x5cdefb){_0x3640c3[_0xbc86('0x43')]=_0x5cdefb;return _0x3640c3;})[_0xbc86('0x24')](respondWithFilteredResult(_0x40135d,_0x39ffe0))[_0xbc86('0x44')](handleError(_0x40135d,null));};exports['show']=function(_0x49be1a,_0x2327ed){var _0x4d44b5={'raw':![],'where':{'id':_0x49be1a[_0xbc86('0x45')]['id']}},_0xd42d55={};_0xd42d55[_0xbc86('0x2e')]=_[_0xbc86('0x30')](db[_0xbc86('0x2a')][_0xbc86('0x2b')]);_0xd42d55[_0xbc86('0x2f')]=_[_0xbc86('0x30')](_0x49be1a[_0xbc86('0x2f')]);_0xd42d55[_0xbc86('0x39')]=_[_0xbc86('0x31')](_0xd42d55[_0xbc86('0x2e')],_0xd42d55['query']);_0x4d44b5[_0xbc86('0x32')]=_[_0xbc86('0x31')](_0xd42d55[_0xbc86('0x2e')],qs[_0xbc86('0x33')](_0x49be1a['query'][_0xbc86('0x33')]));_0x4d44b5['attributes']=_0x4d44b5[_0xbc86('0x32')]['length']?_0x4d44b5[_0xbc86('0x32')]:_0xd42d55['model'];if(_0x49be1a[_0xbc86('0x2f')][_0xbc86('0x41')]){_0x4d44b5['include']=[{'all':!![]}];}_0x4d44b5=_[_0xbc86('0x3f')]({},_0x4d44b5,_0x49be1a[_0xbc86('0x40')]);return db[_0xbc86('0x2a')][_0xbc86('0x46')](_0x4d44b5)[_0xbc86('0x24')](handleEntityNotFound(_0x2327ed,null))[_0xbc86('0x24')](respondWithResult(_0x2327ed,null))[_0xbc86('0x44')](handleError(_0x2327ed,null));};exports['create']=function(_0x168a62,_0x39e17e){return db['Dynamics365Configuration'][_0xbc86('0x47')](_0x168a62[_0xbc86('0x48')],{})[_0xbc86('0x24')](respondWithResult(_0x39e17e,0xc9))[_0xbc86('0x44')](handleError(_0x39e17e,null));};exports[_0xbc86('0x49')]=function(_0x50c7d6,_0x59c8d3){if(_0x50c7d6['body']['id']){delete _0x50c7d6[_0xbc86('0x48')]['id'];}return db[_0xbc86('0x2a')][_0xbc86('0x46')]({'where':{'id':_0x50c7d6[_0xbc86('0x45')]['id']}})[_0xbc86('0x24')](handleEntityNotFound(_0x59c8d3,null))[_0xbc86('0x24')](saveUpdates(_0x50c7d6['body'],null))['then'](respondWithResult(_0x59c8d3,null))[_0xbc86('0x44')](handleError(_0x59c8d3,null));};exports[_0xbc86('0x4a')]=function(_0x1897de,_0x26c6e5){return db['Dynamics365Configuration']['find']({'where':{'id':_0x1897de[_0xbc86('0x45')]['id']}})[_0xbc86('0x24')](handleEntityNotFound(_0x26c6e5,null))[_0xbc86('0x24')](removeEntity(_0x26c6e5,null))[_0xbc86('0x44')](handleError(_0x26c6e5,null));};exports['getFields']=function(_0x5232bc,_0x42e982,_0x101eae){var _0x58f10b={};var _0x648cc6={};var _0x4fdcdd;var _0xba9c81;return db[_0xbc86('0x2a')]['findOne']({'where':{'id':_0x5232bc[_0xbc86('0x45')]['id']}})[_0xbc86('0x24')](handleEntityNotFound(_0x42e982,null))[_0xbc86('0x24')](function(_0x57da30){if(_0x57da30){_0x4fdcdd=_0x57da30;_0x648cc6[_0xbc86('0x2e')]=_[_0xbc86('0x30')](db[_0xbc86('0x4b')]['rawAttributes']);_0x648cc6[_0xbc86('0x2f')]=_[_0xbc86('0x30')](_0x5232bc[_0xbc86('0x2f')]);_0x648cc6[_0xbc86('0x39')]=_['intersection'](_0x648cc6[_0xbc86('0x2e')],_0x648cc6[_0xbc86('0x2f')]);_0x58f10b[_0xbc86('0x32')]=_['intersection'](_0x648cc6['model'],qs[_0xbc86('0x33')](_0x5232bc[_0xbc86('0x2f')][_0xbc86('0x33')]));_0x58f10b[_0xbc86('0x32')]=_0x58f10b[_0xbc86('0x32')][_0xbc86('0x34')]?_0x58f10b[_0xbc86('0x32')]:_0x648cc6[_0xbc86('0x2e')];_0x58f10b[_0xbc86('0x37')]=qs[_0xbc86('0x38')](_0x5232bc[_0xbc86('0x2f')][_0xbc86('0x38')]);_0x58f10b['where']=qs['filters'](_[_0xbc86('0x3a')](_0x5232bc['query'],_0x648cc6['filters']));if(_0x5232bc[_0xbc86('0x2f')][_0xbc86('0x3e')]){_0x58f10b[_0xbc86('0x3b')]=_[_0xbc86('0x3f')](_0x58f10b[_0xbc86('0x3b')],{'$or':_[_0xbc86('0x3c')](_0x58f10b[_0xbc86('0x32')],function(_0x533887){var _0x1f5762={};_0x1f5762[_0x533887]={'$like':'%'+_0x5232bc[_0xbc86('0x2f')][_0xbc86('0x3e')]+'%'};return _0x1f5762;})});}_0x58f10b=_['merge']({},_0x58f10b,_0x5232bc[_0xbc86('0x40')]);return _0x4fdcdd[_0xbc86('0x4c')](_0x58f10b);}})[_0xbc86('0x24')](function(_0x21fd80){if(_0x21fd80){_0xba9c81=_0x21fd80['length'];if(!_0x5232bc[_0xbc86('0x2f')][_0xbc86('0x35')]('nolimit')){_0x58f10b[_0xbc86('0x1f')]=qs[_0xbc86('0x1f')](_0x5232bc[_0xbc86('0x2f')][_0xbc86('0x1f')]);_0x58f10b[_0xbc86('0x1d')]=qs[_0xbc86('0x1d')](_0x5232bc[_0xbc86('0x2f')][_0xbc86('0x1d')]);}return _0x4fdcdd[_0xbc86('0x4c')](_0x58f10b);}})[_0xbc86('0x24')](function(_0x1e3854){if(_0x1e3854){return _0x1e3854?{'count':_0xba9c81,'rows':_0x1e3854}:null;}})[_0xbc86('0x24')](respondWithResult(_0x42e982,null))[_0xbc86('0x44')](handleError(_0x42e982,null));};exports[_0xbc86('0x4d')]=function(_0x116039,_0x344867,_0x3b5a31){var _0x2c5fc8={};var _0x1691aa={};var _0x1e9258;var _0x4f7760;return db['Dynamics365Configuration'][_0xbc86('0x4e')]({'where':{'id':_0x116039[_0xbc86('0x45')]['id']}})[_0xbc86('0x24')](handleEntityNotFound(_0x344867,null))[_0xbc86('0x24')](function(_0x18dd90){if(_0x18dd90){_0x1e9258=_0x18dd90;_0x1691aa[_0xbc86('0x2e')]=_['keys'](db[_0xbc86('0x4b')]['rawAttributes']);_0x1691aa[_0xbc86('0x2f')]=_['keys'](_0x116039[_0xbc86('0x2f')]);_0x1691aa[_0xbc86('0x39')]=_[_0xbc86('0x31')](_0x1691aa[_0xbc86('0x2e')],_0x1691aa[_0xbc86('0x2f')]);_0x2c5fc8['attributes']=_[_0xbc86('0x31')](_0x1691aa[_0xbc86('0x2e')],qs[_0xbc86('0x33')](_0x116039[_0xbc86('0x2f')]['fields']));_0x2c5fc8[_0xbc86('0x32')]=_0x2c5fc8[_0xbc86('0x32')][_0xbc86('0x34')]?_0x2c5fc8[_0xbc86('0x32')]:_0x1691aa[_0xbc86('0x2e')];_0x2c5fc8['order']=qs[_0xbc86('0x38')](_0x116039[_0xbc86('0x2f')][_0xbc86('0x38')]);_0x2c5fc8[_0xbc86('0x3b')]=qs['filters'](_[_0xbc86('0x3a')](_0x116039[_0xbc86('0x2f')],_0x1691aa[_0xbc86('0x39')]));if(_0x116039[_0xbc86('0x2f')][_0xbc86('0x3e')]){_0x2c5fc8[_0xbc86('0x3b')]=_[_0xbc86('0x3f')](_0x2c5fc8[_0xbc86('0x3b')],{'$or':_['map'](_0x2c5fc8[_0xbc86('0x32')],function(_0x3d5982){var _0x5df265={};_0x5df265[_0x3d5982]={'$like':'%'+_0x116039[_0xbc86('0x2f')][_0xbc86('0x3e')]+'%'};return _0x5df265;})});}_0x2c5fc8=_[_0xbc86('0x3f')]({},_0x2c5fc8,_0x116039[_0xbc86('0x40')]);return _0x1e9258[_0xbc86('0x4d')](_0x2c5fc8);}})[_0xbc86('0x24')](function(_0x10b405){if(_0x10b405){_0x4f7760=_0x10b405['length'];if(!_0x116039[_0xbc86('0x2f')][_0xbc86('0x35')]('nolimit')){_0x2c5fc8[_0xbc86('0x1f')]=qs[_0xbc86('0x1f')](_0x116039['query'][_0xbc86('0x1f')]);_0x2c5fc8[_0xbc86('0x1d')]=qs[_0xbc86('0x1d')](_0x116039[_0xbc86('0x2f')][_0xbc86('0x1d')]);}return _0x1e9258[_0xbc86('0x4d')](_0x2c5fc8);}})['then'](function(_0xcb9ba8){if(_0xcb9ba8){return _0xcb9ba8?{'count':_0x4f7760,'rows':_0xcb9ba8}:null;}})[_0xbc86('0x24')](respondWithResult(_0x344867,null))[_0xbc86('0x44')](handleError(_0x344867,null));};exports[_0xbc86('0x4f')]=function(_0x303622,_0x46402c,_0x5f5ad6){var _0x566b4f={};var _0x1f703f={};var _0x4b1900;var _0x4d06ef;return db[_0xbc86('0x2a')]['findOne']({'where':{'id':_0x303622[_0xbc86('0x45')]['id']}})['then'](handleEntityNotFound(_0x46402c,null))['then'](function(_0x1f207d){if(_0x1f207d){_0x4b1900=_0x1f207d;_0x1f703f[_0xbc86('0x2e')]=_[_0xbc86('0x30')](db[_0xbc86('0x4b')][_0xbc86('0x2b')]);_0x1f703f[_0xbc86('0x2f')]=_[_0xbc86('0x30')](_0x303622['query']);_0x1f703f[_0xbc86('0x39')]=_[_0xbc86('0x31')](_0x1f703f[_0xbc86('0x2e')],_0x1f703f[_0xbc86('0x2f')]);_0x566b4f[_0xbc86('0x32')]=_[_0xbc86('0x31')](_0x1f703f[_0xbc86('0x2e')],qs['fields'](_0x303622[_0xbc86('0x2f')]['fields']));_0x566b4f[_0xbc86('0x32')]=_0x566b4f['attributes'][_0xbc86('0x34')]?_0x566b4f['attributes']:_0x1f703f[_0xbc86('0x2e')];_0x566b4f[_0xbc86('0x37')]=qs[_0xbc86('0x38')](_0x303622[_0xbc86('0x2f')][_0xbc86('0x38')]);_0x566b4f[_0xbc86('0x3b')]=qs['filters'](_['pick'](_0x303622['query'],_0x1f703f[_0xbc86('0x39')]));if(_0x303622['query'][_0xbc86('0x3e')]){_0x566b4f[_0xbc86('0x3b')]=_[_0xbc86('0x3f')](_0x566b4f[_0xbc86('0x3b')],{'$or':_[_0xbc86('0x3c')](_0x566b4f[_0xbc86('0x32')],function(_0xfef8fa){var _0x37c5d3={};_0x37c5d3[_0xfef8fa]={'$like':'%'+_0x303622[_0xbc86('0x2f')][_0xbc86('0x3e')]+'%'};return _0x37c5d3;})});}_0x566b4f=_[_0xbc86('0x3f')]({},_0x566b4f,_0x303622[_0xbc86('0x40')]);return _0x4b1900[_0xbc86('0x4f')](_0x566b4f);}})['then'](function(_0x927327){if(_0x927327){_0x4d06ef=_0x927327[_0xbc86('0x34')];if(!_0x303622[_0xbc86('0x2f')][_0xbc86('0x35')](_0xbc86('0x36'))){_0x566b4f[_0xbc86('0x1f')]=qs[_0xbc86('0x1f')](_0x303622[_0xbc86('0x2f')][_0xbc86('0x1f')]);_0x566b4f[_0xbc86('0x1d')]=qs[_0xbc86('0x1d')](_0x303622[_0xbc86('0x2f')][_0xbc86('0x1d')]);}return _0x4b1900[_0xbc86('0x4f')](_0x566b4f);}})['then'](function(_0x1691e7){if(_0x1691e7){return _0x1691e7?{'count':_0x4d06ef,'rows':_0x1691e7}:null;}})[_0xbc86('0x24')](respondWithResult(_0x46402c,null))[_0xbc86('0x44')](handleError(_0x46402c,null));}; \ No newline at end of file +var _0x5667=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','find','getFields','order','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection'];(function(_0x425af8,_0x366c35){var _0x5c2eb1=function(_0x44785f){while(--_0x44785f){_0x425af8['push'](_0x425af8['shift']());}};_0x5c2eb1(++_0x366c35);}(_0x5667,0xb7));var _0x7566=function(_0x2a3eed,_0x17159a){_0x2a3eed=_0x2a3eed-0x0;var _0x2235a2=_0x5667[_0x2a3eed];return _0x2235a2;};'use strict';var emlformat=require(_0x7566('0x0'));var rimraf=require(_0x7566('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7566('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7566('0x3'));var path=require('path');var sox=require(_0x7566('0x4'));var csv=require(_0x7566('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7566('0x6'));var _=require(_0x7566('0x7'));var squel=require(_0x7566('0x8'));var crypto=require(_0x7566('0x9'));var jsforce=require(_0x7566('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7566('0x5'));var querystring=require(_0x7566('0xb'));var Papa=require(_0x7566('0xc'));var Redis=require(_0x7566('0xd'));var authService=require(_0x7566('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7566('0xf'));var hardwareService=require(_0x7566('0x10'));var logger=require(_0x7566('0x11'))(_0x7566('0x12'));var utils=require(_0x7566('0x13'));var config=require(_0x7566('0x14'));var licenseUtil=require(_0x7566('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43e9fc,_0x56386b){_0x56386b=_0x56386b||0xcc;return function(_0x401294){if(_0x401294){return _0x43e9fc[_0x7566('0x16')](_0x56386b);}return _0x43e9fc[_0x7566('0x17')](_0x56386b)[_0x7566('0x18')]();};}function respondWithResult(_0x9e37be,_0x2f9753){_0x2f9753=_0x2f9753||0xc8;return function(_0x2f431a){if(_0x2f431a){return _0x9e37be['status'](_0x2f9753)[_0x7566('0x19')](_0x2f431a);}};}function respondWithFilteredResult(_0xe95422,_0x2ab6f7){return function(_0x39dafd){if(_0x39dafd){var _0x4d064c=typeof _0x2ab6f7['offset']==='undefined'&&typeof _0x2ab6f7['limit']===_0x7566('0x1a');var _0x15b457=_0x39dafd[_0x7566('0x1b')];var _0x109a18=_0x4d064c?0x0:_0x2ab6f7[_0x7566('0x1c')];var _0x48aa1d=_0x4d064c?_0x39dafd['count']:_0x2ab6f7[_0x7566('0x1c')]+_0x2ab6f7[_0x7566('0x1d')];var _0x2aedcc;if(_0x48aa1d>=_0x15b457){_0x48aa1d=_0x15b457;_0x2aedcc=0xc8;}else{_0x2aedcc=0xce;}_0xe95422['status'](_0x2aedcc);return _0xe95422[_0x7566('0x1e')]('Content-Range',_0x109a18+'-'+_0x48aa1d+'/'+_0x15b457)['json'](_0x39dafd);}return null;};}function patchUpdates(_0x2b4f96){return function(_0x4b46ff){try{jsonpatch['apply'](_0x4b46ff,_0x2b4f96,!![]);}catch(_0x3b63f2){return BPromise['reject'](_0x3b63f2);}return _0x4b46ff[_0x7566('0x1f')]();};}function saveUpdates(_0x291230,_0x3114c2){return function(_0x5d31a8){if(_0x5d31a8){return _0x5d31a8[_0x7566('0x20')](_0x291230)['then'](function(_0xeb4fa2){return _0xeb4fa2;});}return null;};}function removeEntity(_0x497d20,_0x2cbbfb){return function(_0x16d643){if(_0x16d643){return _0x16d643[_0x7566('0x21')]()[_0x7566('0x22')](function(){_0x497d20[_0x7566('0x17')](0xcc)[_0x7566('0x18')]();});}};}function handleEntityNotFound(_0x13fc7a,_0x12fe2f){return function(_0x7353d5){if(!_0x7353d5){_0x13fc7a[_0x7566('0x16')](0x194);}return _0x7353d5;};}function handleError(_0x914ef6,_0x42aa9a){_0x42aa9a=_0x42aa9a||0x1f4;return function(_0x431685){logger[_0x7566('0x23')](_0x431685[_0x7566('0x24')]);if(_0x431685[_0x7566('0x25')]){delete _0x431685['name'];}_0x914ef6[_0x7566('0x17')](_0x42aa9a)[_0x7566('0x26')](_0x431685);};}exports[_0x7566('0x27')]=function(_0x5683d1,_0x495780){var _0x1cb735={},_0x3c925b={},_0x36d745={'count':0x0,'rows':[]};var _0x126904=_[_0x7566('0x28')](db[_0x7566('0x29')][_0x7566('0x2a')],function(_0x5adff6){return{'name':_0x5adff6[_0x7566('0x2b')],'type':_0x5adff6['type'][_0x7566('0x2c')]};});_0x3c925b[_0x7566('0x2d')]=_[_0x7566('0x28')](_0x126904,_0x7566('0x25'));_0x3c925b['query']=_[_0x7566('0x2e')](_0x5683d1['query']);_0x3c925b[_0x7566('0x2f')]=_['intersection'](_0x3c925b[_0x7566('0x2d')],_0x3c925b[_0x7566('0x30')]);_0x1cb735[_0x7566('0x31')]=_[_0x7566('0x32')](_0x3c925b[_0x7566('0x2d')],qs[_0x7566('0x33')](_0x5683d1[_0x7566('0x30')][_0x7566('0x33')]));_0x1cb735['attributes']=_0x1cb735['attributes'][_0x7566('0x34')]?_0x1cb735[_0x7566('0x31')]:_0x3c925b[_0x7566('0x2d')];if(!_0x5683d1[_0x7566('0x30')][_0x7566('0x35')](_0x7566('0x36'))){_0x1cb735['limit']=qs['limit'](_0x5683d1[_0x7566('0x30')]['limit']);_0x1cb735[_0x7566('0x1c')]=qs['offset'](_0x5683d1[_0x7566('0x30')][_0x7566('0x1c')]);}_0x1cb735['order']=qs[_0x7566('0x37')](_0x5683d1[_0x7566('0x30')][_0x7566('0x37')]);_0x1cb735[_0x7566('0x38')]=qs[_0x7566('0x2f')](_[_0x7566('0x39')](_0x5683d1[_0x7566('0x30')],_0x3c925b[_0x7566('0x2f')]),_0x126904);if(_0x5683d1['query'][_0x7566('0x3a')]){_0x1cb735['where']=_[_0x7566('0x3b')](_0x1cb735[_0x7566('0x38')],{'$or':_[_0x7566('0x28')](_0x126904,function(_0x391f6f){if(_0x391f6f[_0x7566('0x3c')]!==_0x7566('0x3d')){var _0x2f3580={};_0x2f3580[_0x391f6f[_0x7566('0x25')]]={'$like':'%'+_0x5683d1[_0x7566('0x30')][_0x7566('0x3a')]+'%'};return _0x2f3580;}})});}_0x1cb735=_[_0x7566('0x3b')]({},_0x1cb735,_0x5683d1[_0x7566('0x3e')]);var _0x548f2b={'where':_0x1cb735[_0x7566('0x38')]};return db[_0x7566('0x29')]['count'](_0x548f2b)[_0x7566('0x22')](function(_0x805c51){_0x36d745['count']=_0x805c51;if(_0x5683d1[_0x7566('0x30')][_0x7566('0x3f')]){_0x1cb735[_0x7566('0x40')]=[{'all':!![]}];}return db[_0x7566('0x29')][_0x7566('0x41')](_0x1cb735);})[_0x7566('0x22')](function(_0x114268){_0x36d745[_0x7566('0x42')]=_0x114268;return _0x36d745;})['then'](respondWithFilteredResult(_0x495780,_0x1cb735))['catch'](handleError(_0x495780,null));};exports['show']=function(_0x1cdb72,_0x4f4c0b){var _0x1fc2ef={'raw':![],'where':{'id':_0x1cdb72[_0x7566('0x43')]['id']}},_0x86f2ed={};_0x86f2ed[_0x7566('0x2d')]=_[_0x7566('0x2e')](db[_0x7566('0x29')][_0x7566('0x2a')]);_0x86f2ed[_0x7566('0x30')]=_[_0x7566('0x2e')](_0x1cdb72[_0x7566('0x30')]);_0x86f2ed['filters']=_[_0x7566('0x32')](_0x86f2ed[_0x7566('0x2d')],_0x86f2ed[_0x7566('0x30')]);_0x1fc2ef[_0x7566('0x31')]=_['intersection'](_0x86f2ed[_0x7566('0x2d')],qs[_0x7566('0x33')](_0x1cdb72[_0x7566('0x30')][_0x7566('0x33')]));_0x1fc2ef[_0x7566('0x31')]=_0x1fc2ef[_0x7566('0x31')]['length']?_0x1fc2ef[_0x7566('0x31')]:_0x86f2ed[_0x7566('0x2d')];if(_0x1cdb72[_0x7566('0x30')][_0x7566('0x3f')]){_0x1fc2ef[_0x7566('0x40')]=[{'all':!![]}];}_0x1fc2ef=_[_0x7566('0x3b')]({},_0x1fc2ef,_0x1cdb72[_0x7566('0x3e')]);return db[_0x7566('0x29')]['find'](_0x1fc2ef)['then'](handleEntityNotFound(_0x4f4c0b,null))[_0x7566('0x22')](respondWithResult(_0x4f4c0b,null))[_0x7566('0x44')](handleError(_0x4f4c0b,null));};exports[_0x7566('0x45')]=function(_0x38404e,_0x585c4f){return db[_0x7566('0x29')][_0x7566('0x45')](_0x38404e[_0x7566('0x46')],{})[_0x7566('0x22')](respondWithResult(_0x585c4f,0xc9))['catch'](handleError(_0x585c4f,null));};exports[_0x7566('0x20')]=function(_0x22d450,_0x2edd8b){if(_0x22d450['body']['id']){delete _0x22d450['body']['id'];}return db[_0x7566('0x29')][_0x7566('0x47')]({'where':{'id':_0x22d450['params']['id']}})[_0x7566('0x22')](handleEntityNotFound(_0x2edd8b,null))[_0x7566('0x22')](saveUpdates(_0x22d450[_0x7566('0x46')],null))[_0x7566('0x22')](respondWithResult(_0x2edd8b,null))[_0x7566('0x44')](handleError(_0x2edd8b,null));};exports[_0x7566('0x21')]=function(_0x25119a,_0x420ed2){return db[_0x7566('0x29')][_0x7566('0x47')]({'where':{'id':_0x25119a[_0x7566('0x43')]['id']}})[_0x7566('0x22')](handleEntityNotFound(_0x420ed2,null))['then'](removeEntity(_0x420ed2,null))[_0x7566('0x44')](handleError(_0x420ed2,null));};exports[_0x7566('0x48')]=function(_0x4f246f,_0x272cdb,_0x3549ef){var _0x504db9={};var _0xca0bb5={};var _0x23312f;var _0x2e739c;return db[_0x7566('0x29')]['findOne']({'where':{'id':_0x4f246f[_0x7566('0x43')]['id']}})[_0x7566('0x22')](handleEntityNotFound(_0x272cdb,null))[_0x7566('0x22')](function(_0x2e34ba){if(_0x2e34ba){_0x23312f=_0x2e34ba;_0xca0bb5[_0x7566('0x2d')]=_['keys'](db['Dynamics365Field'][_0x7566('0x2a')]);_0xca0bb5[_0x7566('0x30')]=_[_0x7566('0x2e')](_0x4f246f[_0x7566('0x30')]);_0xca0bb5[_0x7566('0x2f')]=_['intersection'](_0xca0bb5[_0x7566('0x2d')],_0xca0bb5['query']);_0x504db9['attributes']=_[_0x7566('0x32')](_0xca0bb5[_0x7566('0x2d')],qs[_0x7566('0x33')](_0x4f246f[_0x7566('0x30')][_0x7566('0x33')]));_0x504db9['attributes']=_0x504db9[_0x7566('0x31')]['length']?_0x504db9[_0x7566('0x31')]:_0xca0bb5['model'];_0x504db9[_0x7566('0x49')]=qs['sort'](_0x4f246f[_0x7566('0x30')][_0x7566('0x37')]);_0x504db9[_0x7566('0x38')]=qs[_0x7566('0x2f')](_[_0x7566('0x39')](_0x4f246f['query'],_0xca0bb5[_0x7566('0x2f')]));if(_0x4f246f[_0x7566('0x30')][_0x7566('0x3a')]){_0x504db9[_0x7566('0x38')]=_['merge'](_0x504db9['where'],{'$or':_[_0x7566('0x28')](_0x504db9['attributes'],function(_0x33aca8){var _0x409e54={};_0x409e54[_0x33aca8]={'$like':'%'+_0x4f246f['query'][_0x7566('0x3a')]+'%'};return _0x409e54;})});}_0x504db9=_[_0x7566('0x3b')]({},_0x504db9,_0x4f246f[_0x7566('0x3e')]);return _0x23312f[_0x7566('0x48')](_0x504db9);}})[_0x7566('0x22')](function(_0x21a4e4){if(_0x21a4e4){_0x2e739c=_0x21a4e4['length'];if(!_0x4f246f[_0x7566('0x30')][_0x7566('0x35')](_0x7566('0x36'))){_0x504db9[_0x7566('0x1d')]=qs['limit'](_0x4f246f[_0x7566('0x30')][_0x7566('0x1d')]);_0x504db9['offset']=qs[_0x7566('0x1c')](_0x4f246f['query']['offset']);}return _0x23312f['getFields'](_0x504db9);}})[_0x7566('0x22')](function(_0x54be0c){if(_0x54be0c){return _0x54be0c?{'count':_0x2e739c,'rows':_0x54be0c}:null;}})[_0x7566('0x22')](respondWithResult(_0x272cdb,null))['catch'](handleError(_0x272cdb,null));};exports[_0x7566('0x4a')]=function(_0x3a108f,_0x354973,_0x711cca){var _0x4c30d7={};var _0x1063cf={};var _0x52b0f5;var _0x2dd6c7;return db['Dynamics365Configuration'][_0x7566('0x4b')]({'where':{'id':_0x3a108f['params']['id']}})[_0x7566('0x22')](handleEntityNotFound(_0x354973,null))[_0x7566('0x22')](function(_0x29e321){if(_0x29e321){_0x52b0f5=_0x29e321;_0x1063cf[_0x7566('0x2d')]=_[_0x7566('0x2e')](db[_0x7566('0x4c')]['rawAttributes']);_0x1063cf[_0x7566('0x30')]=_[_0x7566('0x2e')](_0x3a108f[_0x7566('0x30')]);_0x1063cf[_0x7566('0x2f')]=_[_0x7566('0x32')](_0x1063cf[_0x7566('0x2d')],_0x1063cf[_0x7566('0x30')]);_0x4c30d7[_0x7566('0x31')]=_[_0x7566('0x32')](_0x1063cf['model'],qs[_0x7566('0x33')](_0x3a108f[_0x7566('0x30')]['fields']));_0x4c30d7[_0x7566('0x31')]=_0x4c30d7[_0x7566('0x31')][_0x7566('0x34')]?_0x4c30d7[_0x7566('0x31')]:_0x1063cf[_0x7566('0x2d')];_0x4c30d7[_0x7566('0x49')]=qs[_0x7566('0x37')](_0x3a108f['query']['sort']);_0x4c30d7['where']=qs[_0x7566('0x2f')](_['pick'](_0x3a108f[_0x7566('0x30')],_0x1063cf[_0x7566('0x2f')]));if(_0x3a108f[_0x7566('0x30')][_0x7566('0x3a')]){_0x4c30d7[_0x7566('0x38')]=_[_0x7566('0x3b')](_0x4c30d7[_0x7566('0x38')],{'$or':_[_0x7566('0x28')](_0x4c30d7[_0x7566('0x31')],function(_0x585397){var _0x54b1af={};_0x54b1af[_0x585397]={'$like':'%'+_0x3a108f['query']['filter']+'%'};return _0x54b1af;})});}_0x4c30d7=_[_0x7566('0x3b')]({},_0x4c30d7,_0x3a108f[_0x7566('0x3e')]);return _0x52b0f5[_0x7566('0x4a')](_0x4c30d7);}})['then'](function(_0x4db984){if(_0x4db984){_0x2dd6c7=_0x4db984[_0x7566('0x34')];if(!_0x3a108f['query'][_0x7566('0x35')]('nolimit')){_0x4c30d7[_0x7566('0x1d')]=qs[_0x7566('0x1d')](_0x3a108f['query'][_0x7566('0x1d')]);_0x4c30d7['offset']=qs[_0x7566('0x1c')](_0x3a108f[_0x7566('0x30')]['offset']);}return _0x52b0f5[_0x7566('0x4a')](_0x4c30d7);}})[_0x7566('0x22')](function(_0x21b482){if(_0x21b482){return _0x21b482?{'count':_0x2dd6c7,'rows':_0x21b482}:null;}})[_0x7566('0x22')](respondWithResult(_0x354973,null))[_0x7566('0x44')](handleError(_0x354973,null));};exports[_0x7566('0x4d')]=function(_0x3c6038,_0xdcab6c,_0x5ce54a){var _0x5d1f19={};var _0x1eae12={};var _0x7bff4e;var _0x1e934f;return db[_0x7566('0x29')][_0x7566('0x4b')]({'where':{'id':_0x3c6038['params']['id']}})[_0x7566('0x22')](handleEntityNotFound(_0xdcab6c,null))['then'](function(_0x19ec6f){if(_0x19ec6f){_0x7bff4e=_0x19ec6f;_0x1eae12[_0x7566('0x2d')]=_[_0x7566('0x2e')](db[_0x7566('0x4c')][_0x7566('0x2a')]);_0x1eae12[_0x7566('0x30')]=_[_0x7566('0x2e')](_0x3c6038[_0x7566('0x30')]);_0x1eae12['filters']=_['intersection'](_0x1eae12[_0x7566('0x2d')],_0x1eae12[_0x7566('0x30')]);_0x5d1f19[_0x7566('0x31')]=_['intersection'](_0x1eae12[_0x7566('0x2d')],qs['fields'](_0x3c6038[_0x7566('0x30')][_0x7566('0x33')]));_0x5d1f19[_0x7566('0x31')]=_0x5d1f19[_0x7566('0x31')][_0x7566('0x34')]?_0x5d1f19[_0x7566('0x31')]:_0x1eae12['model'];_0x5d1f19[_0x7566('0x49')]=qs[_0x7566('0x37')](_0x3c6038[_0x7566('0x30')][_0x7566('0x37')]);_0x5d1f19[_0x7566('0x38')]=qs['filters'](_[_0x7566('0x39')](_0x3c6038[_0x7566('0x30')],_0x1eae12[_0x7566('0x2f')]));if(_0x3c6038[_0x7566('0x30')][_0x7566('0x3a')]){_0x5d1f19['where']=_[_0x7566('0x3b')](_0x5d1f19[_0x7566('0x38')],{'$or':_[_0x7566('0x28')](_0x5d1f19[_0x7566('0x31')],function(_0x198d8c){var _0x1c0268={};_0x1c0268[_0x198d8c]={'$like':'%'+_0x3c6038[_0x7566('0x30')][_0x7566('0x3a')]+'%'};return _0x1c0268;})});}_0x5d1f19=_[_0x7566('0x3b')]({},_0x5d1f19,_0x3c6038['options']);return _0x7bff4e[_0x7566('0x4d')](_0x5d1f19);}})['then'](function(_0x306422){if(_0x306422){_0x1e934f=_0x306422[_0x7566('0x34')];if(!_0x3c6038['query'][_0x7566('0x35')](_0x7566('0x36'))){_0x5d1f19['limit']=qs[_0x7566('0x1d')](_0x3c6038[_0x7566('0x30')]['limit']);_0x5d1f19[_0x7566('0x1c')]=qs[_0x7566('0x1c')](_0x3c6038[_0x7566('0x30')][_0x7566('0x1c')]);}return _0x7bff4e[_0x7566('0x4d')](_0x5d1f19);}})[_0x7566('0x22')](function(_0x31f2ff){if(_0x31f2ff){return _0x31f2ff?{'count':_0x1e934f,'rows':_0x31f2ff}:null;}})[_0x7566('0x22')](respondWithResult(_0xdcab6c,null))[_0x7566('0x44')](handleError(_0xdcab6c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 6f37c98..ca01270 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 _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x1a8a79,_0x57182d){var _0x436f4c=function(_0x4cc5c2){while(--_0x4cc5c2){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x436f4c(++_0x57182d);}(_0x008c,0x188));var _0xc008=function(_0x6d0a22,_0x55d6c4){_0x6d0a22=_0x6d0a22-0x0;var _0x4c1e70=_0x008c[_0x6d0a22];return _0x4c1e70;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x1a3488,_0x3874b0){var _0x8398da=function(_0x282b95){while(--_0x282b95){_0x1a3488['push'](_0x1a3488['shift']());}};_0x8398da(++_0x3874b0);}(_0x70e0,0x17b));var _0x070e=function(_0x355837,_0x5b5e46){_0x355837=_0x355837-0x0;var _0x2f6b5f=_0x70e0[_0x355837];return _0x2f6b5f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'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 406836c..6db1cb5 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 _0x1259=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x1259,0xca));var _0x9125=function(_0x53eeac,_0x1babff){_0x53eeac=_0x53eeac-0x0;var _0x41dddf=_0x1259[_0x53eeac];return _0x41dddf;};'use strict';var _=require(_0x9125('0x0'));var util=require('util');var moment=require(_0x9125('0x1'));var BPromise=require('bluebird');var rs=require(_0x9125('0x2'));var fs=require('fs');var Redis=require(_0x9125('0x3'));var db=require(_0x9125('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9125('0x5'))(_0x9125('0x6'));var config=require('../../config/environment');var jayson=require(_0x9125('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d0262,_0x49197c,_0x2c75a0){return new BPromise(function(_0x3f260f,_0x1d844f){return client[_0x9125('0x8')](_0x2d0262,_0x2c75a0)[_0x9125('0x9')](function(_0x4133fb){logger['info'](_0x9125('0xa'),_0x49197c,_0x9125('0xb'));logger[_0x9125('0xc')](_0x9125('0xd'),_0x49197c,'request\x20sent',JSON[_0x9125('0xe')](_0x4133fb));if(_0x4133fb[_0x9125('0xf')]){if(_0x4133fb['error']['code']===0x1f4){logger[_0x9125('0xf')](_0x9125('0xa'),_0x49197c,_0x4133fb['error'][_0x9125('0x10')]);return _0x1d844f(_0x4133fb[_0x9125('0xf')]['message']);}logger['error'](_0x9125('0xa'),_0x49197c,_0x4133fb[_0x9125('0xf')][_0x9125('0x10')]);return _0x3f260f(_0x4133fb['error'][_0x9125('0x10')]);}else{logger[_0x9125('0x11')](_0x9125('0xa'),_0x49197c,'request\x20sent');_0x3f260f(_0x4133fb[_0x9125('0x12')][_0x9125('0x10')]);}})[_0x9125('0x13')](function(_0x177a07){logger[_0x9125('0xf')](_0x9125('0xa'),_0x49197c,_0x177a07);_0x1d844f(_0x177a07);});});} \ No newline at end of file +var _0xe0a6=['util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe0a6,0x1df));var _0x6e0a=function(_0x1cfc85,_0x225f42){_0x1cfc85=_0x1cfc85-0x0;var _0x54359e=_0xe0a6[_0x1cfc85];return _0x54359e;};'use strict';var _=require(_0x6e0a('0x0'));var util=require(_0x6e0a('0x1'));var moment=require('moment');var BPromise=require(_0x6e0a('0x2'));var rs=require(_0x6e0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e0a('0x4'));var logger=require('../../config/logger')(_0x6e0a('0x5'));var config=require('../../config/environment');var jayson=require(_0x6e0a('0x6'));var client=jayson['client'][_0x6e0a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46d3a0,_0x2729bf,_0x32eaa4){return new BPromise(function(_0x1db143,_0x1f677d){return client[_0x6e0a('0x8')](_0x46d3a0,_0x32eaa4)['then'](function(_0x5f5973){logger[_0x6e0a('0x9')](_0x6e0a('0xa'),_0x2729bf,_0x6e0a('0xb'));logger[_0x6e0a('0xc')](_0x6e0a('0xd'),_0x2729bf,_0x6e0a('0xb'),JSON[_0x6e0a('0xe')](_0x5f5973));if(_0x5f5973[_0x6e0a('0xf')]){if(_0x5f5973['error'][_0x6e0a('0x10')]===0x1f4){logger[_0x6e0a('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2729bf,_0x5f5973[_0x6e0a('0xf')][_0x6e0a('0x11')]);return _0x1f677d(_0x5f5973[_0x6e0a('0xf')]['message']);}logger[_0x6e0a('0xf')](_0x6e0a('0xa'),_0x2729bf,_0x5f5973[_0x6e0a('0xf')][_0x6e0a('0x11')]);return _0x1db143(_0x5f5973['error'][_0x6e0a('0x11')]);}else{logger['info'](_0x6e0a('0xa'),_0x2729bf,_0x6e0a('0xb'));_0x1db143(_0x5f5973[_0x6e0a('0x12')]['message']);}})[_0x6e0a('0x13')](function(_0x312fdb){logger[_0x6e0a('0xf')](_0x6e0a('0xa'),_0x2729bf,_0x312fdb);_0x1f677d(_0x312fdb);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 5c2f9ff..e266eda 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 _0xb763=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x2fed0e,_0x12e913){var _0x3b2a8d=function(_0x8a8298){while(--_0x8a8298){_0x2fed0e['push'](_0x2fed0e['shift']());}};_0x3b2a8d(++_0x12e913);}(_0xb763,0xc8));var _0x3b76=function(_0x10b227,_0x1f082b){_0x10b227=_0x10b227-0x0;var _0x496338=_0xb763[_0x10b227];return _0x496338;};'use strict';var multer=require(_0x3b76('0x0'));var util=require(_0x3b76('0x1'));var path=require(_0x3b76('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b76('0x3'));var router=express[_0x3b76('0x4')]();var fs_extra=require(_0x3b76('0x5'));var auth=require(_0x3b76('0x6'));var interaction=require(_0x3b76('0x7'));var config=require(_0x3b76('0x8'));var controller=require(_0x3b76('0x9'));router[_0x3b76('0xa')]('/',auth[_0x3b76('0xb')](),controller[_0x3b76('0xc')]);router[_0x3b76('0xa')](_0x3b76('0xd'),auth[_0x3b76('0xb')](),controller[_0x3b76('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b76('0xf')]);router[_0x3b76('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3b76('0x11')]);router[_0x3b76('0x12')](_0x3b76('0xd'),auth[_0x3b76('0xb')](),controller[_0x3b76('0x13')]);module[_0x3b76('0x14')]=router; \ No newline at end of file +var _0x34fb=['../../config/environment','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4e64c0,_0x4365a2){var _0xe44aab=function(_0x26192b){while(--_0x26192b){_0x4e64c0['push'](_0x4e64c0['shift']());}};_0xe44aab(++_0x4365a2);}(_0x34fb,0x1e9));var _0xb34f=function(_0x16ec6d,_0x28418d){_0x16ec6d=_0x16ec6d-0x0;var _0x49c0df=_0x34fb[_0x16ec6d];return _0x49c0df;};'use strict';var multer=require(_0xb34f('0x0'));var util=require(_0xb34f('0x1'));var path=require(_0xb34f('0x2'));var timeout=require('connect-timeout');var express=require(_0xb34f('0x3'));var router=express[_0xb34f('0x4')]();var fs_extra=require(_0xb34f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb34f('0x6'));var config=require(_0xb34f('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xb34f('0x8')](),controller['index']);router['get'](_0xb34f('0x9'),auth[_0xb34f('0x8')](),controller[_0xb34f('0xa')]);router[_0xb34f('0xb')]('/',auth[_0xb34f('0x8')](),controller[_0xb34f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb34f('0xd')]('/:id',auth[_0xb34f('0x8')](),controller[_0xb34f('0xe')]);module[_0xb34f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 28ca4ad..656989e 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 _0x6f60=['keyValue','picklist','STRING','string','customVariable','BOOLEAN','exports','ENUM','variable'];(function(_0x310118,_0x43cd74){var _0x57799b=function(_0x16a7b3){while(--_0x16a7b3){_0x310118['push'](_0x310118['shift']());}};_0x57799b(++_0x43cd74);}(_0x6f60,0x12f));var _0x06f6=function(_0x2a557f,_0x13d072){_0x2a557f=_0x2a557f-0x0;var _0x42b774=_0x6f60[_0x2a557f];return _0x42b774;};'use strict';var Sequelize=require('sequelize');module[_0x06f6('0x0')]={'type':{'type':Sequelize[_0x06f6('0x1')]('string',_0x06f6('0x2'),'customVariable',_0x06f6('0x3'),_0x06f6('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x06f6('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x06f6('0x1')](_0x06f6('0x6'),'variable',_0x06f6('0x7'))},'keyContent':{'type':Sequelize[_0x06f6('0x5')]},'idField':{'type':Sequelize[_0x06f6('0x5')]},'nameField':{'type':Sequelize[_0x06f6('0x5')]},'customField':{'type':Sequelize[_0x06f6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb146=['exports','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xb146,0x143));var _0x6b14=function(_0x3b444f,_0x4bb0b2){_0x3b444f=_0x3b444f-0x0;var _0x17de94=_0xb146[_0x3b444f];return _0x17de94;};'use strict';var Sequelize=require(_0x6b14('0x0'));module[_0x6b14('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6b14('0x2'),_0x6b14('0x3'),_0x6b14('0x4'),'keyValue',_0x6b14('0x5')),'defaultValue':_0x6b14('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6b14('0x6')]},'keyType':{'type':Sequelize[_0x6b14('0x7')](_0x6b14('0x2'),_0x6b14('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6b14('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6b14('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b14('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 55f7482..0ac4305 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 _0x5b92=['sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','keys','intersection','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','update','then','destroy','error','stack','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x5b92,0xa6));var _0x25b9=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x5b92[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25b9('0x0'));var zipdir=require(_0x25b9('0x1'));var jsonpatch=require(_0x25b9('0x2'));var rp=require(_0x25b9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x25b9('0x4'));var util=require(_0x25b9('0x5'));var path=require(_0x25b9('0x6'));var sox=require('sox');var csv=require(_0x25b9('0x7'));var ejs=require(_0x25b9('0x8'));var fs=require('fs');var fs_extra=require(_0x25b9('0x9'));var _=require(_0x25b9('0xa'));var squel=require('squel');var crypto=require(_0x25b9('0xb'));var jsforce=require(_0x25b9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b9('0xd'));var Papa=require(_0x25b9('0xe'));var Redis=require(_0x25b9('0xf'));var authService=require(_0x25b9('0x10'));var qs=require(_0x25b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25b9('0x12'));var logger=require(_0x25b9('0x13'))(_0x25b9('0x14'));var utils=require(_0x25b9('0x15'));var config=require(_0x25b9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x25b9('0x17'))['db'];function respondWithStatusCode(_0x4b2e9c,_0x116e3f){_0x116e3f=_0x116e3f||0xcc;return function(_0x548bab){if(_0x548bab){return _0x4b2e9c[_0x25b9('0x18')](_0x116e3f);}return _0x4b2e9c[_0x25b9('0x19')](_0x116e3f)[_0x25b9('0x1a')]();};}function respondWithResult(_0x18890e,_0x4f0954){_0x4f0954=_0x4f0954||0xc8;return function(_0x505abf){if(_0x505abf){return _0x18890e[_0x25b9('0x19')](_0x4f0954)[_0x25b9('0x1b')](_0x505abf);}};}function respondWithFilteredResult(_0x1e207a,_0x3afcb4){return function(_0x47d718){if(_0x47d718){var _0x967522=typeof _0x3afcb4['offset']===_0x25b9('0x1c')&&typeof _0x3afcb4['limit']==='undefined';var _0xbb4445=_0x47d718[_0x25b9('0x1d')];var _0xed53df=_0x967522?0x0:_0x3afcb4['offset'];var _0x5b8e5e=_0x967522?_0x47d718[_0x25b9('0x1d')]:_0x3afcb4[_0x25b9('0x1e')]+_0x3afcb4['limit'];var _0x319cb3;if(_0x5b8e5e>=_0xbb4445){_0x5b8e5e=_0xbb4445;_0x319cb3=0xc8;}else{_0x319cb3=0xce;}_0x1e207a[_0x25b9('0x19')](_0x319cb3);return _0x1e207a[_0x25b9('0x1f')]('Content-Range',_0xed53df+'-'+_0x5b8e5e+'/'+_0xbb4445)[_0x25b9('0x1b')](_0x47d718);}return null;};}function patchUpdates(_0x2c9a2d){return function(_0x4a3e04){try{jsonpatch[_0x25b9('0x20')](_0x4a3e04,_0x2c9a2d,!![]);}catch(_0x4dee35){return BPromise['reject'](_0x4dee35);}return _0x4a3e04['save']();};}function saveUpdates(_0x2e5bf5,_0x37d901){return function(_0x51e866){if(_0x51e866){return _0x51e866[_0x25b9('0x21')](_0x2e5bf5)[_0x25b9('0x22')](function(_0x4b37f6){return _0x4b37f6;});}return null;};}function removeEntity(_0x344ac7,_0x27f14b){return function(_0x2823e4){if(_0x2823e4){return _0x2823e4[_0x25b9('0x23')]()[_0x25b9('0x22')](function(){_0x344ac7[_0x25b9('0x19')](0xcc)[_0x25b9('0x1a')]();});}};}function handleEntityNotFound(_0x419961,_0x5dd824){return function(_0x89af7c){if(!_0x89af7c){_0x419961[_0x25b9('0x18')](0x194);}return _0x89af7c;};}function handleError(_0x36186b,_0x427837){_0x427837=_0x427837||0x1f4;return function(_0xb964fe){logger[_0x25b9('0x24')](_0xb964fe[_0x25b9('0x25')]);if(_0xb964fe['name']){delete _0xb964fe['name'];}_0x36186b[_0x25b9('0x19')](_0x427837)[_0x25b9('0x26')](_0xb964fe);};}exports[_0x25b9('0x27')]=function(_0x3a024a,_0x26830d){var _0x3fc374={},_0x9913ca={},_0x59723f={'count':0x0,'rows':[]};var _0x3ffe32=_[_0x25b9('0x28')](db[_0x25b9('0x29')][_0x25b9('0x2a')],function(_0x3345e0){return{'name':_0x3345e0[_0x25b9('0x2b')],'type':_0x3345e0[_0x25b9('0x2c')][_0x25b9('0x2d')]};});_0x9913ca[_0x25b9('0x2e')]=_[_0x25b9('0x28')](_0x3ffe32,_0x25b9('0x2f'));_0x9913ca[_0x25b9('0x30')]=_['keys'](_0x3a024a[_0x25b9('0x30')]);_0x9913ca[_0x25b9('0x31')]=_['intersection'](_0x9913ca[_0x25b9('0x2e')],_0x9913ca[_0x25b9('0x30')]);_0x3fc374[_0x25b9('0x32')]=_['intersection'](_0x9913ca['model'],qs[_0x25b9('0x33')](_0x3a024a['query'][_0x25b9('0x33')]));_0x3fc374['attributes']=_0x3fc374[_0x25b9('0x32')][_0x25b9('0x34')]?_0x3fc374[_0x25b9('0x32')]:_0x9913ca[_0x25b9('0x2e')];if(!_0x3a024a[_0x25b9('0x30')][_0x25b9('0x35')](_0x25b9('0x36'))){_0x3fc374[_0x25b9('0x37')]=qs['limit'](_0x3a024a[_0x25b9('0x30')][_0x25b9('0x37')]);_0x3fc374['offset']=qs[_0x25b9('0x1e')](_0x3a024a[_0x25b9('0x30')][_0x25b9('0x1e')]);}_0x3fc374['order']=qs[_0x25b9('0x38')](_0x3a024a['query']['sort']);_0x3fc374['where']=qs[_0x25b9('0x31')](_[_0x25b9('0x39')](_0x3a024a[_0x25b9('0x30')],_0x9913ca[_0x25b9('0x31')]),_0x3ffe32);if(_0x3a024a[_0x25b9('0x30')][_0x25b9('0x3a')]){_0x3fc374['where']=_[_0x25b9('0x3b')](_0x3fc374[_0x25b9('0x3c')],{'$or':_[_0x25b9('0x28')](_0x3ffe32,function(_0x2c8c47){if(_0x2c8c47[_0x25b9('0x2c')]!==_0x25b9('0x3d')){var _0x52f73e={};_0x52f73e[_0x2c8c47[_0x25b9('0x2f')]]={'$like':'%'+_0x3a024a[_0x25b9('0x30')]['filter']+'%'};return _0x52f73e;}})});}_0x3fc374=_['merge']({},_0x3fc374,_0x3a024a[_0x25b9('0x3e')]);var _0x3e30d8={'where':_0x3fc374[_0x25b9('0x3c')]};return db[_0x25b9('0x29')][_0x25b9('0x1d')](_0x3e30d8)[_0x25b9('0x22')](function(_0x54ac78){_0x59723f[_0x25b9('0x1d')]=_0x54ac78;if(_0x3a024a[_0x25b9('0x30')][_0x25b9('0x3f')]){_0x3fc374[_0x25b9('0x40')]=[{'all':!![]}];}return db[_0x25b9('0x29')]['findAll'](_0x3fc374);})[_0x25b9('0x22')](function(_0x41c387){_0x59723f[_0x25b9('0x41')]=_0x41c387;return _0x59723f;})[_0x25b9('0x22')](respondWithFilteredResult(_0x26830d,_0x3fc374))['catch'](handleError(_0x26830d,null));};exports[_0x25b9('0x42')]=function(_0x4d3d65,_0x2f6680){var _0xe3b2f6={'raw':!![],'where':{'id':_0x4d3d65[_0x25b9('0x43')]['id']}},_0x1d2ea8={};_0x1d2ea8[_0x25b9('0x2e')]=_[_0x25b9('0x44')](db['Dynamics365Field'][_0x25b9('0x2a')]);_0x1d2ea8[_0x25b9('0x30')]=_[_0x25b9('0x44')](_0x4d3d65[_0x25b9('0x30')]);_0x1d2ea8[_0x25b9('0x31')]=_[_0x25b9('0x45')](_0x1d2ea8['model'],_0x1d2ea8['query']);_0xe3b2f6[_0x25b9('0x32')]=_[_0x25b9('0x45')](_0x1d2ea8[_0x25b9('0x2e')],qs[_0x25b9('0x33')](_0x4d3d65[_0x25b9('0x30')]['fields']));_0xe3b2f6[_0x25b9('0x32')]=_0xe3b2f6['attributes'][_0x25b9('0x34')]?_0xe3b2f6[_0x25b9('0x32')]:_0x1d2ea8[_0x25b9('0x2e')];if(_0x4d3d65[_0x25b9('0x30')]['includeAll']){_0xe3b2f6[_0x25b9('0x40')]=[{'all':!![]}];}_0xe3b2f6=_[_0x25b9('0x3b')]({},_0xe3b2f6,_0x4d3d65[_0x25b9('0x3e')]);return db['Dynamics365Field']['find'](_0xe3b2f6)['then'](handleEntityNotFound(_0x2f6680,null))[_0x25b9('0x22')](respondWithResult(_0x2f6680,null))[_0x25b9('0x46')](handleError(_0x2f6680,null));};exports['create']=function(_0x25390c,_0x35c63a){return db[_0x25b9('0x29')][_0x25b9('0x47')](_0x25390c[_0x25b9('0x48')],{})[_0x25b9('0x22')](respondWithResult(_0x35c63a,0xc9))[_0x25b9('0x46')](handleError(_0x35c63a,null));};exports[_0x25b9('0x21')]=function(_0xb61707,_0x36f943){if(_0xb61707['body']['id']){delete _0xb61707['body']['id'];}return db[_0x25b9('0x29')][_0x25b9('0x49')]({'where':{'id':_0xb61707[_0x25b9('0x43')]['id']}})[_0x25b9('0x22')](handleEntityNotFound(_0x36f943,null))[_0x25b9('0x22')](saveUpdates(_0xb61707[_0x25b9('0x48')],null))[_0x25b9('0x22')](respondWithResult(_0x36f943,null))[_0x25b9('0x46')](handleError(_0x36f943,null));};exports['destroy']=function(_0xacb4b6,_0x3426cf){return db[_0x25b9('0x29')][_0x25b9('0x49')]({'where':{'id':_0xacb4b6[_0x25b9('0x43')]['id']}})[_0x25b9('0x22')](handleEntityNotFound(_0x3426cf,null))[_0x25b9('0x22')](removeEntity(_0x3426cf,null))[_0x25b9('0x46')](handleError(_0x3426cf,null));}; \ No newline at end of file +var _0x633c=['reject','save','update','then','stack','name','send','index','map','Dynamics365Field','fieldName','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x633c,0x194));var _0xc633=function(_0x59e460,_0x900f21){_0x59e460=_0x59e460-0x0;var _0x3cc4a2=_0x633c[_0x59e460];return _0x3cc4a2;};'use strict';var emlformat=require(_0xc633('0x0'));var rimraf=require(_0xc633('0x1'));var zipdir=require(_0xc633('0x2'));var jsonpatch=require(_0xc633('0x3'));var rp=require(_0xc633('0x4'));var moment=require(_0xc633('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc633('0x6'));var util=require(_0xc633('0x7'));var path=require(_0xc633('0x8'));var sox=require('sox');var csv=require(_0xc633('0x9'));var ejs=require(_0xc633('0xa'));var fs=require('fs');var fs_extra=require(_0xc633('0xb'));var _=require(_0xc633('0xc'));var squel=require(_0xc633('0xd'));var crypto=require('crypto');var jsforce=require(_0xc633('0xe'));var deskjs=require(_0xc633('0xf'));var toCsv=require(_0xc633('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc633('0x10'));var authService=require(_0xc633('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc633('0x12'));var logger=require(_0xc633('0x13'))(_0xc633('0x14'));var utils=require(_0xc633('0x15'));var config=require(_0xc633('0x16'));var licenseUtil=require(_0xc633('0x17'));var db=require(_0xc633('0x18'))['db'];function respondWithStatusCode(_0x152b92,_0x472967){_0x472967=_0x472967||0xcc;return function(_0x24bc90){if(_0x24bc90){return _0x152b92[_0xc633('0x19')](_0x472967);}return _0x152b92[_0xc633('0x1a')](_0x472967)['end']();};}function respondWithResult(_0x4cf64a,_0x511bf2){_0x511bf2=_0x511bf2||0xc8;return function(_0x523fe6){if(_0x523fe6){return _0x4cf64a[_0xc633('0x1a')](_0x511bf2)[_0xc633('0x1b')](_0x523fe6);}};}function respondWithFilteredResult(_0x1837fa,_0x14c625){return function(_0x361781){if(_0x361781){var _0xe5a675=typeof _0x14c625[_0xc633('0x1c')]===_0xc633('0x1d')&&typeof _0x14c625['limit']===_0xc633('0x1d');var _0x2c8f39=_0x361781[_0xc633('0x1e')];var _0x333dc7=_0xe5a675?0x0:_0x14c625['offset'];var _0xa67a94=_0xe5a675?_0x361781[_0xc633('0x1e')]:_0x14c625[_0xc633('0x1c')]+_0x14c625[_0xc633('0x1f')];var _0x312ba6;if(_0xa67a94>=_0x2c8f39){_0xa67a94=_0x2c8f39;_0x312ba6=0xc8;}else{_0x312ba6=0xce;}_0x1837fa[_0xc633('0x1a')](_0x312ba6);return _0x1837fa[_0xc633('0x20')]('Content-Range',_0x333dc7+'-'+_0xa67a94+'/'+_0x2c8f39)[_0xc633('0x1b')](_0x361781);}return null;};}function patchUpdates(_0x2eed12){return function(_0x29f29c){try{jsonpatch[_0xc633('0x21')](_0x29f29c,_0x2eed12,!![]);}catch(_0x3cf35f){return BPromise[_0xc633('0x22')](_0x3cf35f);}return _0x29f29c[_0xc633('0x23')]();};}function saveUpdates(_0x1efbb0,_0x374ed7){return function(_0xac16ac){if(_0xac16ac){return _0xac16ac[_0xc633('0x24')](_0x1efbb0)['then'](function(_0x4c608e){return _0x4c608e;});}return null;};}function removeEntity(_0x4e1456,_0xd81081){return function(_0x30b4c6){if(_0x30b4c6){return _0x30b4c6['destroy']()[_0xc633('0x25')](function(){_0x4e1456[_0xc633('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xece635,_0x238cde){return function(_0x38a8fe){if(!_0x38a8fe){_0xece635[_0xc633('0x19')](0x194);}return _0x38a8fe;};}function handleError(_0x2056cb,_0x44ab9f){_0x44ab9f=_0x44ab9f||0x1f4;return function(_0x4cf8ca){logger['error'](_0x4cf8ca[_0xc633('0x26')]);if(_0x4cf8ca['name']){delete _0x4cf8ca[_0xc633('0x27')];}_0x2056cb[_0xc633('0x1a')](_0x44ab9f)[_0xc633('0x28')](_0x4cf8ca);};}exports[_0xc633('0x29')]=function(_0x5cbfc4,_0x101fd5){var _0x50d10b={},_0x52219f={},_0x2b0951={'count':0x0,'rows':[]};var _0x5b35a8=_[_0xc633('0x2a')](db[_0xc633('0x2b')]['rawAttributes'],function(_0x2bcce6){return{'name':_0x2bcce6[_0xc633('0x2c')],'type':_0x2bcce6['type'][_0xc633('0x2d')]};});_0x52219f['model']=_[_0xc633('0x2a')](_0x5b35a8,_0xc633('0x27'));_0x52219f['query']=_[_0xc633('0x2e')](_0x5cbfc4[_0xc633('0x2f')]);_0x52219f[_0xc633('0x30')]=_[_0xc633('0x31')](_0x52219f['model'],_0x52219f[_0xc633('0x2f')]);_0x50d10b['attributes']=_[_0xc633('0x31')](_0x52219f[_0xc633('0x32')],qs['fields'](_0x5cbfc4[_0xc633('0x2f')]['fields']));_0x50d10b[_0xc633('0x33')]=_0x50d10b[_0xc633('0x33')]['length']?_0x50d10b[_0xc633('0x33')]:_0x52219f[_0xc633('0x32')];if(!_0x5cbfc4[_0xc633('0x2f')][_0xc633('0x34')](_0xc633('0x35'))){_0x50d10b['limit']=qs[_0xc633('0x1f')](_0x5cbfc4[_0xc633('0x2f')]['limit']);_0x50d10b[_0xc633('0x1c')]=qs[_0xc633('0x1c')](_0x5cbfc4[_0xc633('0x2f')][_0xc633('0x1c')]);}_0x50d10b[_0xc633('0x36')]=qs[_0xc633('0x37')](_0x5cbfc4[_0xc633('0x2f')][_0xc633('0x37')]);_0x50d10b[_0xc633('0x38')]=qs['filters'](_[_0xc633('0x39')](_0x5cbfc4[_0xc633('0x2f')],_0x52219f[_0xc633('0x30')]),_0x5b35a8);if(_0x5cbfc4[_0xc633('0x2f')][_0xc633('0x3a')]){_0x50d10b[_0xc633('0x38')]=_[_0xc633('0x3b')](_0x50d10b[_0xc633('0x38')],{'$or':_[_0xc633('0x2a')](_0x5b35a8,function(_0x10464e){if(_0x10464e['type']!==_0xc633('0x3c')){var _0x4748d3={};_0x4748d3[_0x10464e[_0xc633('0x27')]]={'$like':'%'+_0x5cbfc4['query'][_0xc633('0x3a')]+'%'};return _0x4748d3;}})});}_0x50d10b=_[_0xc633('0x3b')]({},_0x50d10b,_0x5cbfc4[_0xc633('0x3d')]);var _0x433b19={'where':_0x50d10b['where']};return db[_0xc633('0x2b')][_0xc633('0x1e')](_0x433b19)[_0xc633('0x25')](function(_0x207256){_0x2b0951[_0xc633('0x1e')]=_0x207256;if(_0x5cbfc4[_0xc633('0x2f')][_0xc633('0x3e')]){_0x50d10b[_0xc633('0x3f')]=[{'all':!![]}];}return db[_0xc633('0x2b')]['findAll'](_0x50d10b);})[_0xc633('0x25')](function(_0xaab2f8){_0x2b0951[_0xc633('0x40')]=_0xaab2f8;return _0x2b0951;})['then'](respondWithFilteredResult(_0x101fd5,_0x50d10b))[_0xc633('0x41')](handleError(_0x101fd5,null));};exports[_0xc633('0x42')]=function(_0x4dd417,_0x165990){var _0x402b94={'raw':!![],'where':{'id':_0x4dd417['params']['id']}},_0x524e12={};_0x524e12['model']=_[_0xc633('0x2e')](db[_0xc633('0x2b')][_0xc633('0x43')]);_0x524e12['query']=_[_0xc633('0x2e')](_0x4dd417[_0xc633('0x2f')]);_0x524e12[_0xc633('0x30')]=_[_0xc633('0x31')](_0x524e12[_0xc633('0x32')],_0x524e12[_0xc633('0x2f')]);_0x402b94['attributes']=_['intersection'](_0x524e12[_0xc633('0x32')],qs['fields'](_0x4dd417['query']['fields']));_0x402b94[_0xc633('0x33')]=_0x402b94[_0xc633('0x33')][_0xc633('0x44')]?_0x402b94[_0xc633('0x33')]:_0x524e12[_0xc633('0x32')];if(_0x4dd417[_0xc633('0x2f')]['includeAll']){_0x402b94['include']=[{'all':!![]}];}_0x402b94=_['merge']({},_0x402b94,_0x4dd417[_0xc633('0x3d')]);return db[_0xc633('0x2b')][_0xc633('0x45')](_0x402b94)['then'](handleEntityNotFound(_0x165990,null))[_0xc633('0x25')](respondWithResult(_0x165990,null))['catch'](handleError(_0x165990,null));};exports[_0xc633('0x46')]=function(_0x233a11,_0x5fb95){return db['Dynamics365Field']['create'](_0x233a11[_0xc633('0x47')],{})[_0xc633('0x25')](respondWithResult(_0x5fb95,0xc9))[_0xc633('0x41')](handleError(_0x5fb95,null));};exports[_0xc633('0x24')]=function(_0x18a350,_0x3eac1d){if(_0x18a350[_0xc633('0x47')]['id']){delete _0x18a350['body']['id'];}return db[_0xc633('0x2b')]['find']({'where':{'id':_0x18a350[_0xc633('0x48')]['id']}})[_0xc633('0x25')](handleEntityNotFound(_0x3eac1d,null))['then'](saveUpdates(_0x18a350[_0xc633('0x47')],null))[_0xc633('0x25')](respondWithResult(_0x3eac1d,null))[_0xc633('0x41')](handleError(_0x3eac1d,null));};exports['destroy']=function(_0x50091b,_0x2cbbf1){return db[_0xc633('0x2b')][_0xc633('0x45')]({'where':{'id':_0x50091b[_0xc633('0x48')]['id']}})[_0xc633('0x25')](handleEntityNotFound(_0x2cbbf1,null))['then'](removeEntity(_0x2cbbf1,null))['catch'](handleError(_0x2cbbf1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 41eed59..e626f35 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 _0xb703=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x326bcb,_0x2967b7){var _0xa23101=function(_0x23b90f){while(--_0x23b90f){_0x326bcb['push'](_0x326bcb['shift']());}};_0xa23101(++_0x2967b7);}(_0xb703,0xf9));var _0x3b70=function(_0x2947b9,_0x3a6a9f){_0x2947b9=_0x2947b9-0x0;var _0x10095d=_0xb703[_0x2947b9];return _0x10095d;};'use strict';var _=require(_0x3b70('0x0'));var util=require(_0x3b70('0x1'));var logger=require(_0x3b70('0x2'))(_0x3b70('0x3'));var moment=require(_0x3b70('0x4'));var BPromise=require(_0x3b70('0x5'));var rp=require(_0x3b70('0x6'));var fs=require('fs');var path=require(_0x3b70('0x7'));var rimraf=require(_0x3b70('0x8'));var config=require(_0x3b70('0x9'));var attributes=require(_0x3b70('0xa'));module['exports']=function(_0x1cfd1b,_0x59e42c){return _0x1cfd1b[_0x3b70('0xb')](_0x3b70('0xc'),attributes,{'tableName':_0x3b70('0xd'),'paranoid':![],'indexes':[{'name':_0x3b70('0xe'),'fields':[_0x3b70('0xf'),_0x3b70('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1049=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1049,0x1cb));var _0x9104=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1049[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9104('0x0'));var util=require(_0x9104('0x1'));var logger=require(_0x9104('0x2'))(_0x9104('0x3'));var moment=require(_0x9104('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9104('0x5'));var rimraf=require(_0x9104('0x6'));var config=require(_0x9104('0x7'));var attributes=require(_0x9104('0x8'));module[_0x9104('0x9')]=function(_0x1f2f5e,_0x460d8e){return _0x1f2f5e[_0x9104('0xa')](_0x9104('0xb'),attributes,{'tableName':_0x9104('0xc'),'paranoid':![],'indexes':[{'name':_0x9104('0xd'),'fields':[_0x9104('0xe'),_0x9104('0xf')],'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 99b4d07..d985b90 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 _0x17ce=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x1bda7d,_0x57fcc6){var _0x11e9f0=function(_0x57badc){while(--_0x57badc){_0x1bda7d['push'](_0x1bda7d['shift']());}};_0x11e9f0(++_0x57fcc6);}(_0x17ce,0x123));var _0xe17c=function(_0x2e46bc,_0x3bd106){_0x2e46bc=_0x2e46bc-0x0;var _0x1861cd=_0x17ce[_0x2e46bc];return _0x1861cd;};'use strict';var _=require(_0xe17c('0x0'));var util=require(_0xe17c('0x1'));var moment=require(_0xe17c('0x2'));var BPromise=require(_0xe17c('0x3'));var rs=require(_0xe17c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe17c('0x5'))['db'];var utils=require(_0xe17c('0x6'));var logger=require('../../config/logger')(_0xe17c('0x7'));var config=require(_0xe17c('0x8'));var jayson=require(_0xe17c('0x9'));var client=jayson[_0xe17c('0xa')][_0xe17c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27cf36,_0x4c3b28,_0x3e402e){return new BPromise(function(_0x11c14d,_0x156a91){return client[_0xe17c('0xc')](_0x27cf36,_0x3e402e)['then'](function(_0x53d65a){logger[_0xe17c('0xd')](_0xe17c('0xe'),_0x4c3b28,_0xe17c('0xf'));logger['debug'](_0xe17c('0x10'),_0x4c3b28,_0xe17c('0xf'),JSON['stringify'](_0x53d65a));if(_0x53d65a['error']){if(_0x53d65a[_0xe17c('0x11')][_0xe17c('0x12')]===0x1f4){logger[_0xe17c('0x11')](_0xe17c('0xe'),_0x4c3b28,_0x53d65a[_0xe17c('0x11')]['message']);return _0x156a91(_0x53d65a[_0xe17c('0x11')][_0xe17c('0x13')]);}logger[_0xe17c('0x11')](_0xe17c('0xe'),_0x4c3b28,_0x53d65a['error'][_0xe17c('0x13')]);return _0x11c14d(_0x53d65a[_0xe17c('0x11')][_0xe17c('0x13')]);}else{logger['info'](_0xe17c('0xe'),_0x4c3b28,_0xe17c('0xf'));_0x11c14d(_0x53d65a[_0xe17c('0x14')]['message']);}})['catch'](function(_0x29a10b){logger['error'](_0xe17c('0xe'),_0x4c3b28,_0x29a10b);_0x156a91(_0x29a10b);});});} \ No newline at end of file +var _0xe621=['../../config/environment','jayson/promise','client','request','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0xe621,0xfd));var _0x1e62=function(_0x305b49,_0x17ed26){_0x305b49=_0x305b49-0x0;var _0x364e28=_0xe621[_0x305b49];return _0x364e28;};'use strict';var _=require('lodash');var util=require(_0x1e62('0x0'));var moment=require(_0x1e62('0x1'));var BPromise=require(_0x1e62('0x2'));var rs=require(_0x1e62('0x3'));var fs=require('fs');var Redis=require(_0x1e62('0x4'));var db=require(_0x1e62('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e62('0x6'));var config=require(_0x1e62('0x7'));var jayson=require(_0x1e62('0x8'));var client=jayson[_0x1e62('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d59d8,_0x1241d6,_0x2bb73b){return new BPromise(function(_0x4323d3,_0x1f55fe){return client[_0x1e62('0xa')](_0x3d59d8,_0x2bb73b)['then'](function(_0x43d25e){logger['info'](_0x1e62('0xb'),_0x1241d6,_0x1e62('0xc'));logger[_0x1e62('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x1241d6,_0x1e62('0xc'),JSON[_0x1e62('0xe')](_0x43d25e));if(_0x43d25e[_0x1e62('0xf')]){if(_0x43d25e[_0x1e62('0xf')][_0x1e62('0x10')]===0x1f4){logger[_0x1e62('0xf')](_0x1e62('0xb'),_0x1241d6,_0x43d25e['error'][_0x1e62('0x11')]);return _0x1f55fe(_0x43d25e['error'][_0x1e62('0x11')]);}logger[_0x1e62('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x1241d6,_0x43d25e['error'][_0x1e62('0x11')]);return _0x4323d3(_0x43d25e['error']['message']);}else{logger[_0x1e62('0x12')](_0x1e62('0xb'),_0x1241d6,_0x1e62('0xc'));_0x4323d3(_0x43d25e['result']['message']);}})[_0x1e62('0x13')](function(_0x1aa28e){logger[_0x1e62('0xf')](_0x1e62('0xb'),_0x1241d6,_0x1aa28e);_0x1f55fe(_0x1aa28e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 9e7db6e..5d2a1a9 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 _0x1613=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1613,0x1c1));var _0x3161=function(_0x4ee107,_0x1a21a8){_0x4ee107=_0x4ee107-0x0;var _0x7ad7e9=_0x1613[_0x4ee107];return _0x7ad7e9;};'use strict';var multer=require(_0x3161('0x0'));var util=require(_0x3161('0x1'));var path=require(_0x3161('0x2'));var timeout=require(_0x3161('0x3'));var express=require(_0x3161('0x4'));var router=express['Router']();var fs_extra=require(_0x3161('0x5'));var auth=require(_0x3161('0x6'));var interaction=require(_0x3161('0x7'));var config=require(_0x3161('0x8'));var controller=require(_0x3161('0x9'));router[_0x3161('0xa')]('/',auth[_0x3161('0xb')](),controller[_0x3161('0xc')]);router[_0x3161('0xa')](_0x3161('0xd'),auth[_0x3161('0xb')](),controller[_0x3161('0xe')]);router[_0x3161('0xa')](_0x3161('0xf'),auth[_0x3161('0xb')](),controller[_0x3161('0x10')]);router['get'](_0x3161('0x11'),auth[_0x3161('0xb')](),controller['getFields']);router[_0x3161('0x12')]('/',auth[_0x3161('0xb')](),controller['create']);router['post'](_0x3161('0xf'),auth[_0x3161('0xb')](),controller[_0x3161('0x13')]);router['put'](_0x3161('0xd'),auth['isAuthenticated'](),controller[_0x3161('0x14')]);router[_0x3161('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x3161('0x16')]);module[_0x3161('0x17')]=router; \ No newline at end of file +var _0x8ff1=['addConfiguration','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ff1,0x125));var _0x18ff=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x8ff1[_0x3ea913];return _0x2b4f28;};'use strict';var multer=require(_0x18ff('0x0'));var util=require(_0x18ff('0x1'));var path=require(_0x18ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x18ff('0x3'));var router=express['Router']();var fs_extra=require(_0x18ff('0x4'));var auth=require(_0x18ff('0x5'));var interaction=require(_0x18ff('0x6'));var config=require('../../config/environment');var controller=require(_0x18ff('0x7'));router[_0x18ff('0x8')]('/',auth[_0x18ff('0x9')](),controller[_0x18ff('0xa')]);router[_0x18ff('0x8')](_0x18ff('0xb'),auth[_0x18ff('0x9')](),controller[_0x18ff('0xc')]);router[_0x18ff('0x8')](_0x18ff('0xd'),auth[_0x18ff('0x9')](),controller[_0x18ff('0xe')]);router[_0x18ff('0x8')](_0x18ff('0xf'),auth[_0x18ff('0x9')](),controller[_0x18ff('0x10')]);router[_0x18ff('0x11')]('/',auth[_0x18ff('0x9')](),controller[_0x18ff('0x12')]);router['post'](_0x18ff('0xd'),auth[_0x18ff('0x9')](),controller[_0x18ff('0x13')]);router[_0x18ff('0x14')](_0x18ff('0xb'),auth[_0x18ff('0x9')](),controller[_0x18ff('0x15')]);router[_0x18ff('0x16')](_0x18ff('0xb'),auth[_0x18ff('0x9')](),controller['destroy']);module[_0x18ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3ca5cc2..eb6ebac 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 _0x1893=['STRING','username','remoteUri'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x1893,0xa2));var _0x3189=function(_0x4b19e3,_0x2b63c3){_0x4b19e3=_0x4b19e3-0x0;var _0x2ce22a=_0x1893[_0x4b19e3];return _0x2ce22a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xffd6=['exports','STRING','username','sequelize'];(function(_0x151c6d,_0x2e7b76){var _0x55e9ad=function(_0x425dc1){while(--_0x425dc1){_0x151c6d['push'](_0x151c6d['shift']());}};_0x55e9ad(++_0x2e7b76);}(_0xffd6,0x97));var _0x6ffd=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xffd6[_0x33bc64];return _0x3fdd34;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f3dc92d..e4a833c 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 _0xd624=['nolimit','order','sort','where','filter','merge','include','rows','catch','show','params','keys','rawAttributes','includeAll','options','create','update','body','find','findOne','FreshdeskConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','remoteUri','apiKey','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','base64','requester','subject','agent','description','source','ticket_type','group','remove','includes','default','custom_text','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','send','FreshdeskAccount','fieldName','type','key','model','map','name','query','filters','intersection','fields','length','attributes','hasOwnProperty'];(function(_0x591246,_0x348b0c){var _0x134430=function(_0x203056){while(--_0x203056){_0x591246['push'](_0x591246['shift']());}};_0x134430(++_0x348b0c);}(_0xd624,0x124));var _0x4d62=function(_0x4408c7,_0x19e657){_0x4408c7=_0x4408c7-0x0;var _0x320c05=_0xd624[_0x4408c7];return _0x320c05;};'use strict';var emlformat=require(_0x4d62('0x0'));var rimraf=require(_0x4d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d62('0x3'));var util=require(_0x4d62('0x4'));var path=require(_0x4d62('0x5'));var sox=require(_0x4d62('0x6'));var csv=require(_0x4d62('0x7'));var ejs=require(_0x4d62('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d62('0x9'));var crypto=require(_0x4d62('0xa'));var jsforce=require(_0x4d62('0xb'));var deskjs=require(_0x4d62('0xc'));var toCsv=require(_0x4d62('0x7'));var querystring=require('querystring');var Papa=require(_0x4d62('0xd'));var Redis=require(_0x4d62('0xe'));var authService=require(_0x4d62('0xf'));var qs=require(_0x4d62('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d62('0x11'));var logger=require(_0x4d62('0x12'))(_0x4d62('0x13'));var utils=require(_0x4d62('0x14'));var config=require(_0x4d62('0x15'));var licenseUtil=require(_0x4d62('0x16'));var db=require(_0x4d62('0x17'))['db'];var integrations=require(_0x4d62('0x18'));function respondWithStatusCode(_0x3d30a7,_0x282d79){_0x282d79=_0x282d79||0xcc;return function(_0x1a01c4){if(_0x1a01c4){return _0x3d30a7[_0x4d62('0x19')](_0x282d79);}return _0x3d30a7['status'](_0x282d79)[_0x4d62('0x1a')]();};}function respondWithResult(_0x409910,_0x1c6768){_0x1c6768=_0x1c6768||0xc8;return function(_0x5d9b93){if(_0x5d9b93){return _0x409910[_0x4d62('0x1b')](_0x1c6768)[_0x4d62('0x1c')](_0x5d9b93);}};}function respondWithFilteredResult(_0x142396,_0x5e2cee){return function(_0x4974f4){if(_0x4974f4){var _0x36b786=typeof _0x5e2cee[_0x4d62('0x1d')]==='undefined'&&typeof _0x5e2cee['limit']===_0x4d62('0x1e');var _0x14534d=_0x4974f4['count'];var _0x17a0e6=_0x36b786?0x0:_0x5e2cee[_0x4d62('0x1d')];var _0x11ed47=_0x36b786?_0x4974f4[_0x4d62('0x1f')]:_0x5e2cee[_0x4d62('0x1d')]+_0x5e2cee[_0x4d62('0x20')];var _0x268ece;if(_0x11ed47>=_0x14534d){_0x11ed47=_0x14534d;_0x268ece=0xc8;}else{_0x268ece=0xce;}_0x142396[_0x4d62('0x1b')](_0x268ece);return _0x142396[_0x4d62('0x21')](_0x4d62('0x22'),_0x17a0e6+'-'+_0x11ed47+'/'+_0x14534d)['json'](_0x4974f4);}return null;};}function patchUpdates(_0x5d9e64){return function(_0x50899b){try{jsonpatch[_0x4d62('0x23')](_0x50899b,_0x5d9e64,!![]);}catch(_0x1cafd9){return BPromise[_0x4d62('0x24')](_0x1cafd9);}return _0x50899b['save']();};}function saveUpdates(_0x3a5e4f,_0x16fa3a){return function(_0xcb93b8){if(_0xcb93b8){return _0xcb93b8['update'](_0x3a5e4f)[_0x4d62('0x25')](function(_0x30c443){return _0x30c443;});}return null;};}function removeEntity(_0x1a7ee9,_0x57987b){return function(_0xf38665){if(_0xf38665){return _0xf38665[_0x4d62('0x26')]()['then'](function(){_0x1a7ee9[_0x4d62('0x1b')](0xcc)[_0x4d62('0x1a')]();});}};}function handleEntityNotFound(_0x2a09f9,_0x414a9e){return function(_0x1cff73){if(!_0x1cff73){_0x2a09f9[_0x4d62('0x19')](0x194);}return _0x1cff73;};}function handleError(_0x5635a9,_0x40c9c8){_0x40c9c8=_0x40c9c8||0x1f4;return function(_0x181fe6){logger[_0x4d62('0x27')](_0x181fe6[_0x4d62('0x28')]);if(_0x181fe6['name']){delete _0x181fe6['name'];}_0x5635a9['status'](_0x40c9c8)[_0x4d62('0x29')](_0x181fe6);};}exports['index']=function(_0x1b1f0c,_0x2b76af){var _0x132181={},_0x50e6f0={},_0x2c450e={'count':0x0,'rows':[]};var _0x5aacba=_['map'](db[_0x4d62('0x2a')]['rawAttributes'],function(_0x4379a4){return{'name':_0x4379a4[_0x4d62('0x2b')],'type':_0x4379a4[_0x4d62('0x2c')][_0x4d62('0x2d')]};});_0x50e6f0[_0x4d62('0x2e')]=_[_0x4d62('0x2f')](_0x5aacba,_0x4d62('0x30'));_0x50e6f0[_0x4d62('0x31')]=_['keys'](_0x1b1f0c[_0x4d62('0x31')]);_0x50e6f0[_0x4d62('0x32')]=_[_0x4d62('0x33')](_0x50e6f0['model'],_0x50e6f0[_0x4d62('0x31')]);_0x132181['attributes']=_['intersection'](_0x50e6f0['model'],qs[_0x4d62('0x34')](_0x1b1f0c['query']['fields']));_0x132181['attributes']=_0x132181['attributes'][_0x4d62('0x35')]?_0x132181[_0x4d62('0x36')]:_0x50e6f0[_0x4d62('0x2e')];if(!_0x1b1f0c[_0x4d62('0x31')][_0x4d62('0x37')](_0x4d62('0x38'))){_0x132181[_0x4d62('0x20')]=qs[_0x4d62('0x20')](_0x1b1f0c[_0x4d62('0x31')]['limit']);_0x132181[_0x4d62('0x1d')]=qs['offset'](_0x1b1f0c['query']['offset']);}_0x132181[_0x4d62('0x39')]=qs[_0x4d62('0x3a')](_0x1b1f0c[_0x4d62('0x31')][_0x4d62('0x3a')]);_0x132181[_0x4d62('0x3b')]=qs[_0x4d62('0x32')](_['pick'](_0x1b1f0c[_0x4d62('0x31')],_0x50e6f0['filters']),_0x5aacba);if(_0x1b1f0c[_0x4d62('0x31')][_0x4d62('0x3c')]){_0x132181[_0x4d62('0x3b')]=_[_0x4d62('0x3d')](_0x132181['where'],{'$or':_[_0x4d62('0x2f')](_0x5aacba,function(_0x2dee13){if(_0x2dee13['type']!=='VIRTUAL'){var _0x21b88f={};_0x21b88f[_0x2dee13[_0x4d62('0x30')]]={'$like':'%'+_0x1b1f0c[_0x4d62('0x31')]['filter']+'%'};return _0x21b88f;}})});}_0x132181=_['merge']({},_0x132181,_0x1b1f0c['options']);var _0x5eb741={'where':_0x132181['where']};return db['FreshdeskAccount'][_0x4d62('0x1f')](_0x5eb741)[_0x4d62('0x25')](function(_0x3633e9){_0x2c450e[_0x4d62('0x1f')]=_0x3633e9;if(_0x1b1f0c[_0x4d62('0x31')]['includeAll']){_0x132181[_0x4d62('0x3e')]=[{'all':!![]}];}return db[_0x4d62('0x2a')]['findAll'](_0x132181);})[_0x4d62('0x25')](function(_0xda7aeb){_0x2c450e[_0x4d62('0x3f')]=_0xda7aeb;return _0x2c450e;})[_0x4d62('0x25')](respondWithFilteredResult(_0x2b76af,_0x132181))[_0x4d62('0x40')](handleError(_0x2b76af,null));};exports[_0x4d62('0x41')]=function(_0x560d83,_0x1873a2){var _0x570d11={'raw':![],'where':{'id':_0x560d83[_0x4d62('0x42')]['id']}},_0x18d8c6={};_0x18d8c6['model']=_[_0x4d62('0x43')](db['FreshdeskAccount'][_0x4d62('0x44')]);_0x18d8c6[_0x4d62('0x31')]=_[_0x4d62('0x43')](_0x560d83[_0x4d62('0x31')]);_0x18d8c6[_0x4d62('0x32')]=_['intersection'](_0x18d8c6[_0x4d62('0x2e')],_0x18d8c6[_0x4d62('0x31')]);_0x570d11[_0x4d62('0x36')]=_[_0x4d62('0x33')](_0x18d8c6[_0x4d62('0x2e')],qs[_0x4d62('0x34')](_0x560d83[_0x4d62('0x31')][_0x4d62('0x34')]));_0x570d11[_0x4d62('0x36')]=_0x570d11[_0x4d62('0x36')][_0x4d62('0x35')]?_0x570d11['attributes']:_0x18d8c6['model'];if(_0x560d83[_0x4d62('0x31')][_0x4d62('0x45')]){_0x570d11[_0x4d62('0x3e')]=[{'all':!![]}];}_0x570d11=_[_0x4d62('0x3d')]({},_0x570d11,_0x560d83[_0x4d62('0x46')]);return db['FreshdeskAccount']['find'](_0x570d11)[_0x4d62('0x25')](handleEntityNotFound(_0x1873a2,null))[_0x4d62('0x25')](respondWithResult(_0x1873a2,null))[_0x4d62('0x40')](handleError(_0x1873a2,null));};exports[_0x4d62('0x47')]=function(_0x3a8c7e,_0x514d3c){return db['FreshdeskAccount'][_0x4d62('0x47')](_0x3a8c7e['body'],{})[_0x4d62('0x25')](respondWithResult(_0x514d3c,0xc9))[_0x4d62('0x40')](handleError(_0x514d3c,null));};exports[_0x4d62('0x48')]=function(_0x485fe2,_0x3f883b){if(_0x485fe2[_0x4d62('0x49')]['id']){delete _0x485fe2[_0x4d62('0x49')]['id'];}return db[_0x4d62('0x2a')][_0x4d62('0x4a')]({'where':{'id':_0x485fe2[_0x4d62('0x42')]['id']}})[_0x4d62('0x25')](handleEntityNotFound(_0x3f883b,null))[_0x4d62('0x25')](saveUpdates(_0x485fe2[_0x4d62('0x49')],null))[_0x4d62('0x25')](respondWithResult(_0x3f883b,null))[_0x4d62('0x40')](handleError(_0x3f883b,null));};exports['destroy']=function(_0x1df6a5,_0x9fe769){return db[_0x4d62('0x2a')]['find']({'where':{'id':_0x1df6a5[_0x4d62('0x42')]['id']}})[_0x4d62('0x25')](handleEntityNotFound(_0x9fe769,null))[_0x4d62('0x25')](removeEntity(_0x9fe769,null))['catch'](handleError(_0x9fe769,null));};exports['getConfigurations']=function(_0x412388,_0x169e44,_0x57d2e1){var _0x54e5fe={};var _0x261d8d={};var _0x502dc3;var _0x47e932;return db[_0x4d62('0x2a')][_0x4d62('0x4b')]({'where':{'id':_0x412388[_0x4d62('0x42')]['id']}})['then'](handleEntityNotFound(_0x169e44,null))[_0x4d62('0x25')](function(_0x5066b0){if(_0x5066b0){_0x502dc3=_0x5066b0;_0x261d8d['model']=_[_0x4d62('0x43')](db[_0x4d62('0x4c')][_0x4d62('0x44')]);_0x261d8d[_0x4d62('0x31')]=_[_0x4d62('0x43')](_0x412388[_0x4d62('0x31')]);_0x261d8d['filters']=_[_0x4d62('0x33')](_0x261d8d[_0x4d62('0x2e')],_0x261d8d['query']);_0x54e5fe[_0x4d62('0x36')]=_[_0x4d62('0x33')](_0x261d8d[_0x4d62('0x2e')],qs['fields'](_0x412388[_0x4d62('0x31')][_0x4d62('0x34')]));_0x54e5fe[_0x4d62('0x36')]=_0x54e5fe['attributes'][_0x4d62('0x35')]?_0x54e5fe[_0x4d62('0x36')]:_0x261d8d[_0x4d62('0x2e')];_0x54e5fe['order']=qs[_0x4d62('0x3a')](_0x412388['query'][_0x4d62('0x3a')]);_0x54e5fe['where']=qs[_0x4d62('0x32')](_[_0x4d62('0x4d')](_0x412388['query'],_0x261d8d[_0x4d62('0x32')]));if(_0x412388['query'][_0x4d62('0x3c')]){_0x54e5fe[_0x4d62('0x3b')]=_['merge'](_0x54e5fe['where'],{'$or':_[_0x4d62('0x2f')](_0x54e5fe[_0x4d62('0x36')],function(_0x23df59){var _0x1cb510={};_0x1cb510[_0x23df59]={'$like':'%'+_0x412388[_0x4d62('0x31')]['filter']+'%'};return _0x1cb510;})});}_0x54e5fe=_[_0x4d62('0x3d')]({},_0x54e5fe,_0x412388[_0x4d62('0x46')]);return _0x502dc3[_0x4d62('0x4e')](_0x54e5fe);}})[_0x4d62('0x25')](function(_0x498445){if(_0x498445){_0x47e932=_0x498445[_0x4d62('0x35')];if(!_0x412388['query'][_0x4d62('0x37')](_0x4d62('0x38'))){_0x54e5fe['limit']=qs[_0x4d62('0x20')](_0x412388[_0x4d62('0x31')][_0x4d62('0x20')]);_0x54e5fe[_0x4d62('0x1d')]=qs[_0x4d62('0x1d')](_0x412388[_0x4d62('0x31')][_0x4d62('0x1d')]);}return _0x502dc3['getConfigurations'](_0x54e5fe);}})[_0x4d62('0x25')](function(_0x15961d){if(_0x15961d){return _0x15961d?{'count':_0x47e932,'rows':_0x15961d}:null;}})[_0x4d62('0x25')](respondWithResult(_0x169e44,null))[_0x4d62('0x40')](handleError(_0x169e44,null));};exports[_0x4d62('0x4f')]=function(_0x5398cc,_0x428604,_0x5d4029){if(_0x5398cc[_0x4d62('0x49')]['id']){delete _0x5398cc['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x5398cc[_0x4d62('0x42')]['id']}})['then'](handleEntityNotFound(_0x428604,null))[_0x4d62('0x25')](function(_0xee747){if(_0xee747){_0x5398cc[_0x4d62('0x49')][_0x4d62('0x50')]=_0xee747['id'];_0x5398cc[_0x4d62('0x49')][_0x4d62('0x51')]=integrations[_0x4d62('0x52')](_0x5398cc['body'][_0x4d62('0x53')],_0x5398cc['body'][_0x4d62('0x2c')]);_0x5398cc[_0x4d62('0x49')][_0x4d62('0x54')]=integrations[_0x4d62('0x55')](_0x5398cc['body']['channel'],_0x5398cc['body']['type']);return db[_0x4d62('0x4c')][_0x4d62('0x47')](_0x5398cc['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x4d62('0x51')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x4d62('0x25')](respondWithResult(_0x428604,null))[_0x4d62('0x40')](handleError(_0x428604,null));};exports[_0x4d62('0x56')]=function(_0x53a17e,_0x475e40,_0x4ddb54){var _0x2ec05e='';return db[_0x4d62('0x2a')][_0x4d62('0x4b')]({'where':{'id':_0x53a17e[_0x4d62('0x42')]['id']},'attributes':['id',_0x4d62('0x57'),_0x4d62('0x58')]})[_0x4d62('0x25')](handleEntityNotFound(_0x475e40,null))[_0x4d62('0x25')](function(_0x1398fe){if(_0x1398fe){_0x2ec05e=_0x1398fe[_0x4d62('0x57')];var _0x44921c=_0x2ec05e['slice'](-0x1);if(_0x44921c==='/'){_0x2ec05e=_0x2ec05e['substring'](0x0,_0x2ec05e[_0x4d62('0x59')](_0x44921c));}return rp({'method':_0x4d62('0x5a'),'uri':util['format'](_0x4d62('0x5b'),_0x2ec05e,_0x4d62('0x5c')),'headers':{'Authorization':util[_0x4d62('0x5d')](_0x4d62('0x5e'),new Buffer(util['format'](_0x4d62('0x5f'),_0x1398fe['apiKey']))['toString'](_0x4d62('0x60')))},'json':!![]});}})[_0x4d62('0x25')](function(_0x5366f2){if(_0x5366f2){var _0x4703e7=[_0x4d62('0x61'),_0x4d62('0x62'),_0x4d62('0x63'),_0x4d62('0x64'),'status','priority','group',_0x4d62('0x65'),_0x4d62('0x66'),_0x4d62('0x67'),'company'];_[_0x4d62('0x68')](_0x5366f2,function(_0x2ff25b){return _0x4703e7[_0x4d62('0x69')](_0x2ff25b[_0x4d62('0x30')])||!_0x2ff25b[_0x4d62('0x6a')]&&_0x2ff25b[_0x4d62('0x2c')]!==_0x4d62('0x6b')&&_0x2ff25b[_0x4d62('0x2c')]!=='custom_dropdown';});return{'count':_0x5366f2[_0x4d62('0x35')],'rows':_['map'](_0x5366f2,function(_0x4544f3){return{'id':_0x4544f3[_0x4d62('0x30')],'name':_0x4544f3[_0x4d62('0x6c')],'custom':!_0x4544f3[_0x4d62('0x6a')],'options':_0x4544f3['choices']?_[_0x4d62('0x2f')](_0x4544f3[_0x4d62('0x6d')],function(_0xbbea93){return{'name':_[_0x4d62('0x6e')](_0xbbea93),'value':_0xbbea93};}):[]};})};}})[_0x4d62('0x25')](respondWithResult(_0x475e40,null))['catch'](function(_0x3953a5){var _0x25003c=_0x53a17e[_0x4d62('0x31')][_0x4d62('0x6f')]?0x1f4:_0x3953a5['statusCode']||0x1f4;logger['error'](_0x4d62('0x70'),'getFields',_0x25003c,JSON[_0x4d62('0x71')](_0x3953a5));delete _0x3953a5[_0x4d62('0x30')];if(_0x25003c===0x191){_0x25003c=0x190;}_0x475e40[_0x4d62('0x1b')](_0x25003c)[_0x4d62('0x29')](_0x53a17e[_0x4d62('0x31')][_0x4d62('0x6f')]?{'message':_0x4d62('0x72'),'statusCode':_0x3953a5[_0x4d62('0x73')]}:_0x3953a5);});}; \ No newline at end of file +var _0xf17f=['rows','catch','show','length','include','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','getFields','remoteUri','slice','substring','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','default','custom_dropdown','choices','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','name','status','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','merge','filter','options','includeAll','findAll'];(function(_0x4ff8e0,_0x4c9a52){var _0x2bc28e=function(_0x1a647f){while(--_0x1a647f){_0x4ff8e0['push'](_0x4ff8e0['shift']());}};_0x2bc28e(++_0x4c9a52);}(_0xf17f,0x113));var _0xff17=function(_0x28bc89,_0x1edcd4){_0x28bc89=_0x28bc89-0x0;var _0x31aaa2=_0xf17f[_0x28bc89];return _0x31aaa2;};'use strict';var emlformat=require(_0xff17('0x0'));var rimraf=require(_0xff17('0x1'));var zipdir=require(_0xff17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff17('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff17('0x4'));var util=require(_0xff17('0x5'));var path=require(_0xff17('0x6'));var sox=require(_0xff17('0x7'));var csv=require('to-csv');var ejs=require(_0xff17('0x8'));var fs=require('fs');var fs_extra=require(_0xff17('0x9'));var _=require('lodash');var squel=require(_0xff17('0xa'));var crypto=require(_0xff17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xff17('0xc'));var toCsv=require(_0xff17('0xd'));var querystring=require(_0xff17('0xe'));var Papa=require('papaparse');var Redis=require(_0xff17('0xf'));var authService=require(_0xff17('0x10'));var qs=require(_0xff17('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff17('0x12'));var logger=require(_0xff17('0x13'))(_0xff17('0x14'));var utils=require(_0xff17('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff17('0x16'))['db'];var integrations=require(_0xff17('0x17'));function respondWithStatusCode(_0x1b2a62,_0x54dc3c){_0x54dc3c=_0x54dc3c||0xcc;return function(_0x1ea9b4){if(_0x1ea9b4){return _0x1b2a62[_0xff17('0x18')](_0x54dc3c);}return _0x1b2a62['status'](_0x54dc3c)[_0xff17('0x19')]();};}function respondWithResult(_0x4218bc,_0x4e3435){_0x4e3435=_0x4e3435||0xc8;return function(_0x5721de){if(_0x5721de){return _0x4218bc['status'](_0x4e3435)[_0xff17('0x1a')](_0x5721de);}};}function respondWithFilteredResult(_0x5b7870,_0x2f501a){return function(_0x2a6d05){if(_0x2a6d05){var _0x249641=typeof _0x2f501a[_0xff17('0x1b')]===_0xff17('0x1c')&&typeof _0x2f501a['limit']===_0xff17('0x1c');var _0x173592=_0x2a6d05[_0xff17('0x1d')];var _0x594830=_0x249641?0x0:_0x2f501a['offset'];var _0x1950ff=_0x249641?_0x2a6d05[_0xff17('0x1d')]:_0x2f501a[_0xff17('0x1b')]+_0x2f501a['limit'];var _0x47bafc;if(_0x1950ff>=_0x173592){_0x1950ff=_0x173592;_0x47bafc=0xc8;}else{_0x47bafc=0xce;}_0x5b7870['status'](_0x47bafc);return _0x5b7870['set'](_0xff17('0x1e'),_0x594830+'-'+_0x1950ff+'/'+_0x173592)['json'](_0x2a6d05);}return null;};}function patchUpdates(_0x12f10f){return function(_0x3794f0){try{jsonpatch[_0xff17('0x1f')](_0x3794f0,_0x12f10f,!![]);}catch(_0x4c5366){return BPromise[_0xff17('0x20')](_0x4c5366);}return _0x3794f0[_0xff17('0x21')]();};}function saveUpdates(_0x5ab76c,_0x583240){return function(_0x29f655){if(_0x29f655){return _0x29f655[_0xff17('0x22')](_0x5ab76c)[_0xff17('0x23')](function(_0x5cd3be){return _0x5cd3be;});}return null;};}function removeEntity(_0x594018,_0x20f5f3){return function(_0xecd4cb){if(_0xecd4cb){return _0xecd4cb[_0xff17('0x24')]()[_0xff17('0x23')](function(){_0x594018['status'](0xcc)[_0xff17('0x19')]();});}};}function handleEntityNotFound(_0x3904bb,_0x5ad4df){return function(_0x294aa2){if(!_0x294aa2){_0x3904bb[_0xff17('0x18')](0x194);}return _0x294aa2;};}function handleError(_0x509d30,_0x301511){_0x301511=_0x301511||0x1f4;return function(_0x512f7b){logger['error'](_0x512f7b['stack']);if(_0x512f7b[_0xff17('0x25')]){delete _0x512f7b[_0xff17('0x25')];}_0x509d30[_0xff17('0x26')](_0x301511)[_0xff17('0x27')](_0x512f7b);};}exports[_0xff17('0x28')]=function(_0x1d3fbf,_0xa80345){var _0x21dcbf={},_0x2ce834={},_0x364374={'count':0x0,'rows':[]};var _0x52f588=_[_0xff17('0x29')](db[_0xff17('0x2a')][_0xff17('0x2b')],function(_0x15c0be){return{'name':_0x15c0be[_0xff17('0x2c')],'type':_0x15c0be[_0xff17('0x2d')][_0xff17('0x2e')]};});_0x2ce834[_0xff17('0x2f')]=_[_0xff17('0x29')](_0x52f588,_0xff17('0x25'));_0x2ce834[_0xff17('0x30')]=_[_0xff17('0x31')](_0x1d3fbf[_0xff17('0x30')]);_0x2ce834[_0xff17('0x32')]=_[_0xff17('0x33')](_0x2ce834[_0xff17('0x2f')],_0x2ce834[_0xff17('0x30')]);_0x21dcbf[_0xff17('0x34')]=_[_0xff17('0x33')](_0x2ce834[_0xff17('0x2f')],qs['fields'](_0x1d3fbf[_0xff17('0x30')][_0xff17('0x35')]));_0x21dcbf[_0xff17('0x34')]=_0x21dcbf['attributes']['length']?_0x21dcbf['attributes']:_0x2ce834['model'];if(!_0x1d3fbf[_0xff17('0x30')][_0xff17('0x36')]('nolimit')){_0x21dcbf[_0xff17('0x37')]=qs[_0xff17('0x37')](_0x1d3fbf['query'][_0xff17('0x37')]);_0x21dcbf[_0xff17('0x1b')]=qs[_0xff17('0x1b')](_0x1d3fbf['query']['offset']);}_0x21dcbf[_0xff17('0x38')]=qs[_0xff17('0x39')](_0x1d3fbf[_0xff17('0x30')][_0xff17('0x39')]);_0x21dcbf[_0xff17('0x3a')]=qs['filters'](_['pick'](_0x1d3fbf[_0xff17('0x30')],_0x2ce834['filters']),_0x52f588);if(_0x1d3fbf[_0xff17('0x30')]['filter']){_0x21dcbf[_0xff17('0x3a')]=_[_0xff17('0x3b')](_0x21dcbf[_0xff17('0x3a')],{'$or':_[_0xff17('0x29')](_0x52f588,function(_0x4523f8){if(_0x4523f8[_0xff17('0x2d')]!=='VIRTUAL'){var _0x32c0bf={};_0x32c0bf[_0x4523f8[_0xff17('0x25')]]={'$like':'%'+_0x1d3fbf['query'][_0xff17('0x3c')]+'%'};return _0x32c0bf;}})});}_0x21dcbf=_[_0xff17('0x3b')]({},_0x21dcbf,_0x1d3fbf[_0xff17('0x3d')]);var _0x16bd03={'where':_0x21dcbf[_0xff17('0x3a')]};return db['FreshdeskAccount']['count'](_0x16bd03)['then'](function(_0x4e1fd1){_0x364374[_0xff17('0x1d')]=_0x4e1fd1;if(_0x1d3fbf[_0xff17('0x30')][_0xff17('0x3e')]){_0x21dcbf['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0xff17('0x3f')](_0x21dcbf);})[_0xff17('0x23')](function(_0x5ec47c){_0x364374[_0xff17('0x40')]=_0x5ec47c;return _0x364374;})[_0xff17('0x23')](respondWithFilteredResult(_0xa80345,_0x21dcbf))[_0xff17('0x41')](handleError(_0xa80345,null));};exports[_0xff17('0x42')]=function(_0x40fe0d,_0x6e8ebd){var _0x3f0046={'raw':![],'where':{'id':_0x40fe0d['params']['id']}},_0x3bae99={};_0x3bae99[_0xff17('0x2f')]=_[_0xff17('0x31')](db[_0xff17('0x2a')][_0xff17('0x2b')]);_0x3bae99[_0xff17('0x30')]=_[_0xff17('0x31')](_0x40fe0d[_0xff17('0x30')]);_0x3bae99['filters']=_[_0xff17('0x33')](_0x3bae99['model'],_0x3bae99['query']);_0x3f0046[_0xff17('0x34')]=_[_0xff17('0x33')](_0x3bae99[_0xff17('0x2f')],qs[_0xff17('0x35')](_0x40fe0d[_0xff17('0x30')][_0xff17('0x35')]));_0x3f0046['attributes']=_0x3f0046[_0xff17('0x34')][_0xff17('0x43')]?_0x3f0046[_0xff17('0x34')]:_0x3bae99['model'];if(_0x40fe0d['query'][_0xff17('0x3e')]){_0x3f0046[_0xff17('0x44')]=[{'all':!![]}];}_0x3f0046=_[_0xff17('0x3b')]({},_0x3f0046,_0x40fe0d[_0xff17('0x3d')]);return db[_0xff17('0x2a')][_0xff17('0x45')](_0x3f0046)[_0xff17('0x23')](handleEntityNotFound(_0x6e8ebd,null))[_0xff17('0x23')](respondWithResult(_0x6e8ebd,null))['catch'](handleError(_0x6e8ebd,null));};exports['create']=function(_0x460802,_0x1c7b18){return db[_0xff17('0x2a')][_0xff17('0x46')](_0x460802[_0xff17('0x47')],{})['then'](respondWithResult(_0x1c7b18,0xc9))[_0xff17('0x41')](handleError(_0x1c7b18,null));};exports[_0xff17('0x22')]=function(_0xa9579b,_0x44cb09){if(_0xa9579b[_0xff17('0x47')]['id']){delete _0xa9579b['body']['id'];}return db[_0xff17('0x2a')][_0xff17('0x45')]({'where':{'id':_0xa9579b[_0xff17('0x48')]['id']}})[_0xff17('0x23')](handleEntityNotFound(_0x44cb09,null))['then'](saveUpdates(_0xa9579b[_0xff17('0x47')],null))[_0xff17('0x23')](respondWithResult(_0x44cb09,null))[_0xff17('0x41')](handleError(_0x44cb09,null));};exports[_0xff17('0x24')]=function(_0x4b0d98,_0x13a237){return db[_0xff17('0x2a')][_0xff17('0x45')]({'where':{'id':_0x4b0d98['params']['id']}})[_0xff17('0x23')](handleEntityNotFound(_0x13a237,null))['then'](removeEntity(_0x13a237,null))['catch'](handleError(_0x13a237,null));};exports[_0xff17('0x49')]=function(_0x4dd0a6,_0x42fa1d,_0x1a1722){var _0x1c7e63={};var _0xcdc37b={};var _0x370863;var _0x12b81e;return db[_0xff17('0x2a')][_0xff17('0x4a')]({'where':{'id':_0x4dd0a6['params']['id']}})[_0xff17('0x23')](handleEntityNotFound(_0x42fa1d,null))['then'](function(_0x22c3b7){if(_0x22c3b7){_0x370863=_0x22c3b7;_0xcdc37b['model']=_[_0xff17('0x31')](db[_0xff17('0x4b')][_0xff17('0x2b')]);_0xcdc37b['query']=_[_0xff17('0x31')](_0x4dd0a6[_0xff17('0x30')]);_0xcdc37b[_0xff17('0x32')]=_[_0xff17('0x33')](_0xcdc37b[_0xff17('0x2f')],_0xcdc37b['query']);_0x1c7e63['attributes']=_[_0xff17('0x33')](_0xcdc37b[_0xff17('0x2f')],qs[_0xff17('0x35')](_0x4dd0a6[_0xff17('0x30')]['fields']));_0x1c7e63['attributes']=_0x1c7e63[_0xff17('0x34')]['length']?_0x1c7e63['attributes']:_0xcdc37b[_0xff17('0x2f')];_0x1c7e63['order']=qs[_0xff17('0x39')](_0x4dd0a6[_0xff17('0x30')][_0xff17('0x39')]);_0x1c7e63[_0xff17('0x3a')]=qs[_0xff17('0x32')](_[_0xff17('0x4c')](_0x4dd0a6[_0xff17('0x30')],_0xcdc37b[_0xff17('0x32')]));if(_0x4dd0a6[_0xff17('0x30')][_0xff17('0x3c')]){_0x1c7e63[_0xff17('0x3a')]=_['merge'](_0x1c7e63[_0xff17('0x3a')],{'$or':_[_0xff17('0x29')](_0x1c7e63['attributes'],function(_0xca0db2){var _0x4945cc={};_0x4945cc[_0xca0db2]={'$like':'%'+_0x4dd0a6[_0xff17('0x30')][_0xff17('0x3c')]+'%'};return _0x4945cc;})});}_0x1c7e63=_[_0xff17('0x3b')]({},_0x1c7e63,_0x4dd0a6['options']);return _0x370863[_0xff17('0x49')](_0x1c7e63);}})[_0xff17('0x23')](function(_0x10249a){if(_0x10249a){_0x12b81e=_0x10249a[_0xff17('0x43')];if(!_0x4dd0a6[_0xff17('0x30')]['hasOwnProperty'](_0xff17('0x4d'))){_0x1c7e63[_0xff17('0x37')]=qs[_0xff17('0x37')](_0x4dd0a6[_0xff17('0x30')][_0xff17('0x37')]);_0x1c7e63[_0xff17('0x1b')]=qs['offset'](_0x4dd0a6['query'][_0xff17('0x1b')]);}return _0x370863[_0xff17('0x49')](_0x1c7e63);}})[_0xff17('0x23')](function(_0x201ab9){if(_0x201ab9){return _0x201ab9?{'count':_0x12b81e,'rows':_0x201ab9}:null;}})[_0xff17('0x23')](respondWithResult(_0x42fa1d,null))[_0xff17('0x41')](handleError(_0x42fa1d,null));};exports[_0xff17('0x4e')]=function(_0x7661a6,_0x398e2c,_0x3f44b9){if(_0x7661a6[_0xff17('0x47')]['id']){delete _0x7661a6[_0xff17('0x47')]['id'];}return db[_0xff17('0x2a')]['findOne']({'where':{'id':_0x7661a6['params']['id']}})[_0xff17('0x23')](handleEntityNotFound(_0x398e2c,null))['then'](function(_0x3fc5ba){if(_0x3fc5ba){_0x7661a6[_0xff17('0x47')][_0xff17('0x4f')]=_0x3fc5ba['id'];_0x7661a6[_0xff17('0x47')]['Subjects']=integrations['getSubjects'](_0x7661a6[_0xff17('0x47')][_0xff17('0x50')],_0x7661a6['body'][_0xff17('0x2d')]);_0x7661a6['body'][_0xff17('0x51')]=integrations[_0xff17('0x52')](_0x7661a6['body'][_0xff17('0x50')],_0x7661a6[_0xff17('0x47')][_0xff17('0x2d')]);return db[_0xff17('0x4b')][_0xff17('0x46')](_0x7661a6['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xff17('0x51')}]});}return null;})['then'](respondWithResult(_0x398e2c,null))['catch'](handleError(_0x398e2c,null));};exports[_0xff17('0x53')]=function(_0x567c66,_0x2d6233,_0x27c96f){var _0x11deaa='';return db['FreshdeskAccount'][_0xff17('0x4a')]({'where':{'id':_0x567c66[_0xff17('0x48')]['id']},'attributes':['id',_0xff17('0x54'),'apiKey']})[_0xff17('0x23')](handleEntityNotFound(_0x2d6233,null))['then'](function(_0x4598dd){if(_0x4598dd){_0x11deaa=_0x4598dd[_0xff17('0x54')];var _0x1ba53a=_0x11deaa[_0xff17('0x55')](-0x1);if(_0x1ba53a==='/'){_0x11deaa=_0x11deaa[_0xff17('0x56')](0x0,_0x11deaa['lastIndexOf'](_0x1ba53a));}return rp({'method':'GET','uri':util[_0xff17('0x57')](_0xff17('0x58'),_0x11deaa,_0xff17('0x59')),'headers':{'Authorization':util[_0xff17('0x57')](_0xff17('0x5a'),new Buffer(util[_0xff17('0x57')](_0xff17('0x5b'),_0x4598dd[_0xff17('0x5c')]))[_0xff17('0x5d')](_0xff17('0x5e')))},'json':!![]});}})['then'](function(_0x53d8a4){if(_0x53d8a4){var _0x6e904e=[_0xff17('0x5f'),_0xff17('0x60'),'agent',_0xff17('0x61'),'status',_0xff17('0x62'),_0xff17('0x63'),_0xff17('0x64'),_0xff17('0x65'),_0xff17('0x63'),_0xff17('0x66')];_[_0xff17('0x67')](_0x53d8a4,function(_0x3166b3){return _0x6e904e['includes'](_0x3166b3[_0xff17('0x25')])||!_0x3166b3[_0xff17('0x68')]&&_0x3166b3['type']!=='custom_text'&&_0x3166b3[_0xff17('0x2d')]!==_0xff17('0x69');});return{'count':_0x53d8a4['length'],'rows':_[_0xff17('0x29')](_0x53d8a4,function(_0x136073){return{'id':_0x136073[_0xff17('0x25')],'name':_0x136073['label'],'custom':!_0x136073['default'],'options':_0x136073[_0xff17('0x6a')]?_['map'](_0x136073[_0xff17('0x6a')],function(_0x13fd39){return{'name':_['capitalize'](_0x13fd39),'value':_0x13fd39};}):[]};})};}})[_0xff17('0x23')](respondWithResult(_0x2d6233,null))['catch'](function(_0x1a03d4){var _0x5c925e=_0x567c66[_0xff17('0x30')][_0xff17('0x6b')]?0x1f4:_0x1a03d4[_0xff17('0x6c')]||0x1f4;logger[_0xff17('0x6d')](_0xff17('0x6e'),_0xff17('0x53'),_0x5c925e,JSON[_0xff17('0x6f')](_0x1a03d4));delete _0x1a03d4['name'];if(_0x5c925e===0x191){_0x5c925e=0x190;}_0x2d6233[_0xff17('0x26')](_0x5c925e)['send'](_0x567c66[_0xff17('0x30')][_0xff17('0x6b')]?{'message':_0xff17('0x70'),'statusCode':_0x1a03d4[_0xff17('0x6c')]}:_0x1a03d4);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9e2e2f2..d1fa6da 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 _0x4da9=['moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger'];(function(_0x208ab6,_0x214cf7){var _0x3de310=function(_0x54a3a4){while(--_0x54a3a4){_0x208ab6['push'](_0x208ab6['shift']());}};_0x3de310(++_0x214cf7);}(_0x4da9,0x189));var _0x94da=function(_0x4d9f5a,_0x5723c5){_0x4d9f5a=_0x4d9f5a-0x0;var _0x38539a=_0x4da9[_0x4d9f5a];return _0x38539a;};'use strict';var _=require(_0x94da('0x0'));var util=require(_0x94da('0x1'));var logger=require(_0x94da('0x2'))('api');var moment=require(_0x94da('0x3'));var BPromise=require('bluebird');var rp=require(_0x94da('0x4'));var fs=require('fs');var path=require(_0x94da('0x5'));var rimraf=require(_0x94da('0x6'));var config=require(_0x94da('0x7'));var attributes=require(_0x94da('0x8'));var integrations=require(_0x94da('0x9'));module[_0x94da('0xa')]=function(_0x155f78,_0x47b4e7){return _0x155f78[_0x94da('0xb')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9a7=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xd9a7,0x170));var _0x7d9a=function(_0x34d1aa,_0x2e1799){_0x34d1aa=_0x34d1aa-0x0;var _0x11e755=_0xd9a7[_0x34d1aa];return _0x11e755;};'use strict';var _=require(_0x7d9a('0x0'));var util=require(_0x7d9a('0x1'));var logger=require(_0x7d9a('0x2'))(_0x7d9a('0x3'));var moment=require(_0x7d9a('0x4'));var BPromise=require(_0x7d9a('0x5'));var rp=require(_0x7d9a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d9a('0x7'));var config=require(_0x7d9a('0x8'));var attributes=require(_0x7d9a('0x9'));var integrations=require(_0x7d9a('0xa'));module[_0x7d9a('0xb')]=function(_0x543b05,_0x2b9748){return _0x543b05['define']('FreshdeskAccount',attributes,{'tableName':_0x7d9a('0xc'),'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 aea720d..c42df3b 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 _0x74e2=['GetFreshdeskAccount','FreshdeskAccount','options','raw','attributes','include','map','model','then','debug','catch','ShowFreshdeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x454dab,_0x40f8fd){var _0xcd5ff5=function(_0x17c2da){while(--_0x17c2da){_0x454dab['push'](_0x454dab['shift']());}};_0xcd5ff5(++_0x40f8fd);}(_0x74e2,0x1d4));var _0x274e=function(_0x210eae,_0x1a6007){_0x210eae=_0x210eae-0x0;var _0x11e4b6=_0x74e2[_0x210eae];return _0x11e4b6;};'use strict';var _=require(_0x274e('0x0'));var util=require(_0x274e('0x1'));var moment=require(_0x274e('0x2'));var BPromise=require(_0x274e('0x3'));var rs=require(_0x274e('0x4'));var fs=require('fs');var Redis=require(_0x274e('0x5'));var db=require(_0x274e('0x6'))['db'];var utils=require(_0x274e('0x7'));var logger=require(_0x274e('0x8'))(_0x274e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x274e('0xa')][_0x274e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41273a,_0x6b33b8,_0x332590){return new BPromise(function(_0x4aa79e,_0x580439){return client[_0x274e('0xc')](_0x41273a,_0x332590)['then'](function(_0x7e384d){logger[_0x274e('0xd')](_0x274e('0xe'),_0x6b33b8,_0x274e('0xf'));logger['debug'](_0x274e('0x10'),_0x6b33b8,_0x274e('0xf'),JSON[_0x274e('0x11')](_0x7e384d));if(_0x7e384d[_0x274e('0x12')]){if(_0x7e384d[_0x274e('0x12')][_0x274e('0x13')]===0x1f4){logger['error'](_0x274e('0xe'),_0x6b33b8,_0x7e384d[_0x274e('0x12')]['message']);return _0x580439(_0x7e384d[_0x274e('0x12')][_0x274e('0x14')]);}logger[_0x274e('0x12')](_0x274e('0xe'),_0x6b33b8,_0x7e384d[_0x274e('0x12')][_0x274e('0x14')]);return _0x4aa79e(_0x7e384d[_0x274e('0x12')]['message']);}else{logger['info'](_0x274e('0xe'),_0x6b33b8,_0x274e('0xf'));_0x4aa79e(_0x7e384d[_0x274e('0x15')]['message']);}})['catch'](function(_0x7d017e){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x6b33b8,_0x7d017e);_0x580439(_0x7d017e);});});}exports[_0x274e('0x16')]=function(_0x351151){var _0xdf5d05=this;return new Promise(function(_0x500f54,_0x18ae01){return db[_0x274e('0x17')]['findAll']({'raw':_0x351151[_0x274e('0x18')]?_0x351151['options'][_0x274e('0x19')]===undefined?!![]:![]:!![],'where':_0x351151[_0x274e('0x18')]?_0x351151[_0x274e('0x18')]['where']||null:null,'attributes':_0x351151['options']?_0x351151[_0x274e('0x18')][_0x274e('0x1a')]||null:null,'limit':_0x351151[_0x274e('0x18')]?_0x351151[_0x274e('0x18')]['limit']||null:null,'include':_0x351151['options']?_0x351151[_0x274e('0x18')][_0x274e('0x1b')]?_[_0x274e('0x1c')](_0x351151[_0x274e('0x18')][_0x274e('0x1b')],function(_0x4a455c){return{'model':db[_0x4a455c['model']],'as':_0x4a455c['as'],'attributes':_0x4a455c[_0x274e('0x1a')],'include':_0x4a455c[_0x274e('0x1b')]?_[_0x274e('0x1c')](_0x4a455c['include'],function(_0x4ab121){return{'model':db[_0x4ab121[_0x274e('0x1d')]],'as':_0x4ab121['as'],'attributes':_0x4ab121[_0x274e('0x1a')],'include':_0x4ab121[_0x274e('0x1b')]?_[_0x274e('0x1c')](_0x4ab121['include'],function(_0x5a9c6c){return{'model':db[_0x5a9c6c['model']],'as':_0x5a9c6c['as'],'attributes':_0x5a9c6c[_0x274e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x274e('0x1e')](function(_0x5ee756){logger[_0x274e('0xd')]('GetFreshdeskAccount',_0x351151);logger[_0x274e('0x1f')](_0x274e('0x16'),_0x351151,JSON['stringify'](_0x5ee756));_0x500f54(_0x5ee756);})[_0x274e('0x20')](function(_0x13a6ad){logger[_0x274e('0x12')]('GetFreshdeskAccount',_0x13a6ad[_0x274e('0x14')],_0x351151);_0x18ae01(_0xdf5d05[_0x274e('0x12')](0x1f4,_0x13a6ad[_0x274e('0x14')]));});});};exports[_0x274e('0x21')]=function(_0x4073c8){var _0x450e1c=this;return new Promise(function(_0x7bcfb3,_0x5da7e4){return db['FreshdeskAccount']['find']({'raw':_0x4073c8['options']?_0x4073c8['options'][_0x274e('0x19')]===undefined?!![]:![]:!![],'where':_0x4073c8['options']?_0x4073c8[_0x274e('0x18')][_0x274e('0x22')]||null:null,'attributes':_0x4073c8[_0x274e('0x18')]?_0x4073c8['options'][_0x274e('0x1a')]||null:null,'include':_0x4073c8[_0x274e('0x18')]?_0x4073c8[_0x274e('0x18')][_0x274e('0x1b')]?_[_0x274e('0x1c')](_0x4073c8['options']['include'],function(_0x443005){return{'model':db[_0x443005[_0x274e('0x1d')]],'as':_0x443005['as'],'attributes':_0x443005['attributes'],'include':_0x443005[_0x274e('0x1b')]?_[_0x274e('0x1c')](_0x443005[_0x274e('0x1b')],function(_0x341562){return{'model':db[_0x341562[_0x274e('0x1d')]],'as':_0x341562['as'],'attributes':_0x341562[_0x274e('0x1a')],'include':_0x341562[_0x274e('0x1b')]?_[_0x274e('0x1c')](_0x341562[_0x274e('0x1b')],function(_0x3b8b46){return{'model':db[_0x3b8b46['model']],'as':_0x3b8b46['as'],'attributes':_0x3b8b46[_0x274e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x274e('0x1e')](function(_0x48746a){logger[_0x274e('0xd')](_0x274e('0x21'),_0x4073c8);logger[_0x274e('0x1f')]('ShowFreshdeskAccount',_0x4073c8,JSON[_0x274e('0x11')](_0x48746a));_0x7bcfb3(_0x48746a);})[_0x274e('0x20')](function(_0x3ae542){logger['error'](_0x274e('0x21'),_0x3ae542[_0x274e('0x14')],_0x4073c8);_0x5da7e4(_0x450e1c['error'](0x1f4,_0x3ae542['message']));});});}; \ No newline at end of file +var _0x948d=['FreshdeskAccount','options','raw','include','map','model','attributes','ShowFreshdeskAccount','where','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FreshdeskAccount,\x20%s,\x20%s','GetFreshdeskAccount'];(function(_0x456c0b,_0xb6d3a9){var _0x3b4866=function(_0xb3ff69){while(--_0xb3ff69){_0x456c0b['push'](_0x456c0b['shift']());}};_0x3b4866(++_0xb6d3a9);}(_0x948d,0x1c9));var _0xd948=function(_0x1a9440,_0x461355){_0x1a9440=_0x1a9440-0x0;var _0x87d554=_0x948d[_0x1a9440];return _0x87d554;};'use strict';var _=require('lodash');var util=require(_0xd948('0x0'));var moment=require('moment');var BPromise=require(_0xd948('0x1'));var rs=require(_0xd948('0x2'));var fs=require('fs');var Redis=require(_0xd948('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd948('0x4'));var logger=require('../../config/logger')(_0xd948('0x5'));var config=require(_0xd948('0x6'));var jayson=require(_0xd948('0x7'));var client=jayson[_0xd948('0x8')][_0xd948('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3313d9,_0x8b2bd0,_0x2da851){return new BPromise(function(_0x2e26ba,_0xc5c355){return client[_0xd948('0xa')](_0x3313d9,_0x2da851)[_0xd948('0xb')](function(_0x32f7a8){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x8b2bd0,'request\x20sent');logger[_0xd948('0xc')](_0xd948('0xd'),_0x8b2bd0,_0xd948('0xe'),JSON[_0xd948('0xf')](_0x32f7a8));if(_0x32f7a8[_0xd948('0x10')]){if(_0x32f7a8['error'][_0xd948('0x11')]===0x1f4){logger[_0xd948('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x8b2bd0,_0x32f7a8['error'][_0xd948('0x12')]);return _0xc5c355(_0x32f7a8[_0xd948('0x10')][_0xd948('0x12')]);}logger[_0xd948('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x8b2bd0,_0x32f7a8[_0xd948('0x10')]['message']);return _0x2e26ba(_0x32f7a8[_0xd948('0x10')][_0xd948('0x12')]);}else{logger[_0xd948('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x8b2bd0,_0xd948('0xe'));_0x2e26ba(_0x32f7a8['result'][_0xd948('0x12')]);}})[_0xd948('0x14')](function(_0x5cfa2b){logger['error'](_0xd948('0x15'),_0x8b2bd0,_0x5cfa2b);_0xc5c355(_0x5cfa2b);});});}exports[_0xd948('0x16')]=function(_0x1f017b){var _0x3eab3c=this;return new Promise(function(_0x512280,_0x1e9d8d){return db[_0xd948('0x17')]['findAll']({'raw':_0x1f017b[_0xd948('0x18')]?_0x1f017b[_0xd948('0x18')][_0xd948('0x19')]===undefined?!![]:![]:!![],'where':_0x1f017b[_0xd948('0x18')]?_0x1f017b['options']['where']||null:null,'attributes':_0x1f017b[_0xd948('0x18')]?_0x1f017b[_0xd948('0x18')]['attributes']||null:null,'limit':_0x1f017b[_0xd948('0x18')]?_0x1f017b[_0xd948('0x18')]['limit']||null:null,'include':_0x1f017b[_0xd948('0x18')]?_0x1f017b['options'][_0xd948('0x1a')]?_[_0xd948('0x1b')](_0x1f017b['options'][_0xd948('0x1a')],function(_0x1568c8){return{'model':db[_0x1568c8[_0xd948('0x1c')]],'as':_0x1568c8['as'],'attributes':_0x1568c8['attributes'],'include':_0x1568c8[_0xd948('0x1a')]?_[_0xd948('0x1b')](_0x1568c8[_0xd948('0x1a')],function(_0x5b1dd1){return{'model':db[_0x5b1dd1[_0xd948('0x1c')]],'as':_0x5b1dd1['as'],'attributes':_0x5b1dd1[_0xd948('0x1d')],'include':_0x5b1dd1['include']?_[_0xd948('0x1b')](_0x5b1dd1[_0xd948('0x1a')],function(_0x4e7f9b){return{'model':db[_0x4e7f9b[_0xd948('0x1c')]],'as':_0x4e7f9b['as'],'attributes':_0x4e7f9b[_0xd948('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd948('0xb')](function(_0x5c29fe){logger['info']('GetFreshdeskAccount',_0x1f017b);logger[_0xd948('0xc')](_0xd948('0x16'),_0x1f017b,JSON['stringify'](_0x5c29fe));_0x512280(_0x5c29fe);})[_0xd948('0x14')](function(_0x39eae1){logger[_0xd948('0x10')](_0xd948('0x16'),_0x39eae1[_0xd948('0x12')],_0x1f017b);_0x1e9d8d(_0x3eab3c[_0xd948('0x10')](0x1f4,_0x39eae1[_0xd948('0x12')]));});});};exports[_0xd948('0x1e')]=function(_0x290f01){var _0x5b1127=this;return new Promise(function(_0x3c3f13,_0x4c033a){return db[_0xd948('0x17')]['find']({'raw':_0x290f01['options']?_0x290f01[_0xd948('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x290f01[_0xd948('0x18')]?_0x290f01[_0xd948('0x18')][_0xd948('0x1f')]||null:null,'attributes':_0x290f01[_0xd948('0x18')]?_0x290f01[_0xd948('0x18')][_0xd948('0x1d')]||null:null,'include':_0x290f01[_0xd948('0x18')]?_0x290f01['options']['include']?_['map'](_0x290f01['options'][_0xd948('0x1a')],function(_0x1aa224){return{'model':db[_0x1aa224[_0xd948('0x1c')]],'as':_0x1aa224['as'],'attributes':_0x1aa224[_0xd948('0x1d')],'include':_0x1aa224[_0xd948('0x1a')]?_[_0xd948('0x1b')](_0x1aa224[_0xd948('0x1a')],function(_0x1c3855){return{'model':db[_0x1c3855[_0xd948('0x1c')]],'as':_0x1c3855['as'],'attributes':_0x1c3855['attributes'],'include':_0x1c3855[_0xd948('0x1a')]?_[_0xd948('0x1b')](_0x1c3855[_0xd948('0x1a')],function(_0x10305f){return{'model':db[_0x10305f[_0xd948('0x1c')]],'as':_0x10305f['as'],'attributes':_0x10305f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36355d){logger['info'](_0xd948('0x1e'),_0x290f01);logger[_0xd948('0xc')](_0xd948('0x1e'),_0x290f01,JSON[_0xd948('0xf')](_0x36355d));_0x3c3f13(_0x36355d);})[_0xd948('0x14')](function(_0x5c6b5a){logger['error'](_0xd948('0x1e'),_0x5c6b5a['message'],_0x290f01);_0x4c033a(_0x5b1127[_0xd948('0x10')](0x1f4,_0x5c6b5a[_0xd948('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 58ccf38..c5c79da 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 _0xa0bf=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','/:id/fields','isAuthenticated','getFields'];(function(_0x5bdc31,_0x500d27){var _0x587d73=function(_0xb37131){while(--_0xb37131){_0x5bdc31['push'](_0x5bdc31['shift']());}};_0x587d73(++_0x500d27);}(_0xa0bf,0x8e));var _0xfa0b=function(_0x116d82,_0x1b2aca){_0x116d82=_0x116d82-0x0;var _0x49e9f9=_0xa0bf[_0x116d82];return _0x49e9f9;};'use strict';var multer=require(_0xfa0b('0x0'));var util=require(_0xfa0b('0x1'));var path=require(_0xfa0b('0x2'));var timeout=require(_0xfa0b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfa0b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfa0b('0x5'));var config=require(_0xfa0b('0x6'));var controller=require(_0xfa0b('0x7'));router[_0xfa0b('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa0b('0x9')]);router[_0xfa0b('0x8')](_0xfa0b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfa0b('0x8')](_0xfa0b('0xb'),auth[_0xfa0b('0xc')](),controller[_0xfa0b('0xd')]);router['get'](_0xfa0b('0xe'),auth[_0xfa0b('0xc')](),controller[_0xfa0b('0xf')]);router[_0xfa0b('0x8')](_0xfa0b('0x10'),auth[_0xfa0b('0xc')](),controller[_0xfa0b('0x11')]);router[_0xfa0b('0x8')](_0xfa0b('0x12'),auth[_0xfa0b('0xc')](),controller[_0xfa0b('0x13')]);router[_0xfa0b('0x14')]('/',auth[_0xfa0b('0xc')](),controller['create']);router[_0xfa0b('0x14')](_0xfa0b('0x12'),auth[_0xfa0b('0xc')](),controller[_0xfa0b('0x15')]);router[_0xfa0b('0x16')](_0xfa0b('0xa'),auth[_0xfa0b('0xc')](),controller[_0xfa0b('0x17')]);router[_0xfa0b('0x18')](_0xfa0b('0xa'),auth[_0xfa0b('0xc')](),controller['destroy']);module[_0xfa0b('0x19')]=router; \ No newline at end of file +var _0x0b72=['isAuthenticated','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x402eff,_0x2525f2){var _0x2eb371=function(_0x15e9b3){while(--_0x15e9b3){_0x402eff['push'](_0x402eff['shift']());}};_0x2eb371(++_0x2525f2);}(_0x0b72,0xf5));var _0x20b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b72[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20b7('0x0'));var path=require(_0x20b7('0x1'));var timeout=require('connect-timeout');var express=require(_0x20b7('0x2'));var router=express[_0x20b7('0x3')]();var fs_extra=require(_0x20b7('0x4'));var auth=require(_0x20b7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x20b7('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x20b7('0x7')]('/',auth[_0x20b7('0x8')](),controller['index']);router[_0x20b7('0x7')](_0x20b7('0x9'),auth[_0x20b7('0x8')](),controller[_0x20b7('0xa')]);router[_0x20b7('0x7')]('/:id/fields',auth[_0x20b7('0x8')](),controller['getFields']);router[_0x20b7('0x7')](_0x20b7('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x20b7('0x7')](_0x20b7('0xc'),auth[_0x20b7('0x8')](),controller[_0x20b7('0xd')]);router[_0x20b7('0x7')](_0x20b7('0xe'),auth['isAuthenticated'](),controller[_0x20b7('0xf')]);router[_0x20b7('0x10')]('/',auth[_0x20b7('0x8')](),controller[_0x20b7('0x11')]);router[_0x20b7('0x10')](_0x20b7('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x20b7('0x12')](_0x20b7('0x9'),auth[_0x20b7('0x8')](),controller[_0x20b7('0x13')]);router[_0x20b7('0x14')](_0x20b7('0x9'),auth['isAuthenticated'](),controller[_0x20b7('0x15')]);module[_0x20b7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 51fe588..23d659c 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 _0xd24e=['sequelize','exports','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd24e,0x1aa));var _0xed24=function(_0x4d1a56,_0x43609a){_0x4d1a56=_0x4d1a56-0x0;var _0x21e37e=_0xd24e[_0x4d1a56];return _0x21e37e;};'use strict';var Sequelize=require(_0xed24('0x0'));module[_0xed24('0x1')]={'name':{'type':Sequelize[_0xed24('0x2')]},'description':{'type':Sequelize[_0xed24('0x2')]}}; \ No newline at end of file +var _0xa7e5=['STRING','sequelize','exports'];(function(_0x19dd2d,_0x2c5f31){var _0x485ef5=function(_0x44d3a2){while(--_0x44d3a2){_0x19dd2d['push'](_0x19dd2d['shift']());}};_0x485ef5(++_0x2c5f31);}(_0xa7e5,0x1a8));var _0x5a7e=function(_0x25726d,_0x396ebf){_0x25726d=_0x25726d-0x0;var _0x524dd3=_0xa7e5[_0x25726d];return _0x524dd3;};'use strict';var Sequelize=require(_0x5a7e('0x0'));module[_0x5a7e('0x1')]={'name':{'type':Sequelize[_0x5a7e('0x2')]},'description':{'type':Sequelize[_0x5a7e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 071a05b..09bb047 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 _0x4f50=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','FreshdeskConfiguration','findAll','rows','catch','show','params','intersection','find','create','body','getFields','findOne','order','getSubjects','FreshdeskField','getTags','Tag','setTags','ids','eml-format','fast-json-patch','moment','bluebird','util','path','sox'];(function(_0x3cedd7,_0x48ee31){var _0x3f655d=function(_0x564641){while(--_0x564641){_0x3cedd7['push'](_0x3cedd7['shift']());}};_0x3f655d(++_0x48ee31);}(_0x4f50,0x149));var _0x04f5=function(_0x3c0ea0,_0x127cd2){_0x3c0ea0=_0x3c0ea0-0x0;var _0x114c06=_0x4f50[_0x3c0ea0];return _0x114c06;};'use strict';var emlformat=require(_0x04f5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x04f5('0x1'));var rp=require('request-promise');var moment=require(_0x04f5('0x2'));var BPromise=require(_0x04f5('0x3'));var Mustache=require('mustache');var util=require(_0x04f5('0x4'));var path=require(_0x04f5('0x5'));var sox=require(_0x04f5('0x6'));var csv=require(_0x04f5('0x7'));var ejs=require(_0x04f5('0x8'));var fs=require('fs');var fs_extra=require(_0x04f5('0x9'));var _=require('lodash');var squel=require(_0x04f5('0xa'));var crypto=require(_0x04f5('0xb'));var jsforce=require(_0x04f5('0xc'));var deskjs=require(_0x04f5('0xd'));var toCsv=require(_0x04f5('0x7'));var querystring=require('querystring');var Papa=require(_0x04f5('0xe'));var Redis=require(_0x04f5('0xf'));var authService=require(_0x04f5('0x10'));var qs=require(_0x04f5('0x11'));var as=require(_0x04f5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04f5('0x13'))(_0x04f5('0x14'));var utils=require('../../config/utils');var config=require(_0x04f5('0x15'));var licenseUtil=require(_0x04f5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x94bdd9,_0x55d5fc){_0x55d5fc=_0x55d5fc||0xcc;return function(_0x618707){if(_0x618707){return _0x94bdd9[_0x04f5('0x17')](_0x55d5fc);}return _0x94bdd9['status'](_0x55d5fc)[_0x04f5('0x18')]();};}function respondWithResult(_0x51e679,_0x329874){_0x329874=_0x329874||0xc8;return function(_0x21937c){if(_0x21937c){return _0x51e679[_0x04f5('0x19')](_0x329874)[_0x04f5('0x1a')](_0x21937c);}};}function respondWithFilteredResult(_0x3a98f2,_0x45ac21){return function(_0x4db1e3){if(_0x4db1e3){var _0x4a17ec=typeof _0x45ac21[_0x04f5('0x1b')]===_0x04f5('0x1c')&&typeof _0x45ac21[_0x04f5('0x1d')]===_0x04f5('0x1c');var _0x523f28=_0x4db1e3['count'];var _0x30ee36=_0x4a17ec?0x0:_0x45ac21[_0x04f5('0x1b')];var _0x11ab22=_0x4a17ec?_0x4db1e3[_0x04f5('0x1e')]:_0x45ac21['offset']+_0x45ac21[_0x04f5('0x1d')];var _0x334c64;if(_0x11ab22>=_0x523f28){_0x11ab22=_0x523f28;_0x334c64=0xc8;}else{_0x334c64=0xce;}_0x3a98f2[_0x04f5('0x19')](_0x334c64);return _0x3a98f2['set']('Content-Range',_0x30ee36+'-'+_0x11ab22+'/'+_0x523f28)[_0x04f5('0x1a')](_0x4db1e3);}return null;};}function patchUpdates(_0x58150f){return function(_0x2d7679){try{jsonpatch[_0x04f5('0x1f')](_0x2d7679,_0x58150f,!![]);}catch(_0x298253){return BPromise[_0x04f5('0x20')](_0x298253);}return _0x2d7679[_0x04f5('0x21')]();};}function saveUpdates(_0x3c128e,_0x17c0bd){return function(_0x3e3ce4){if(_0x3e3ce4){return _0x3e3ce4[_0x04f5('0x22')](_0x3c128e)['then'](function(_0x4cd64a){return _0x4cd64a;});}return null;};}function removeEntity(_0x5c63c4,_0x25d615){return function(_0x30c900){if(_0x30c900){return _0x30c900[_0x04f5('0x23')]()['then'](function(){_0x5c63c4[_0x04f5('0x19')](0xcc)[_0x04f5('0x18')]();});}};}function handleEntityNotFound(_0x5e05f7,_0x582c17){return function(_0x5ea588){if(!_0x5ea588){_0x5e05f7[_0x04f5('0x17')](0x194);}return _0x5ea588;};}function handleError(_0x578efe,_0x115680){_0x115680=_0x115680||0x1f4;return function(_0x479435){logger[_0x04f5('0x24')](_0x479435[_0x04f5('0x25')]);if(_0x479435[_0x04f5('0x26')]){delete _0x479435[_0x04f5('0x26')];}_0x578efe[_0x04f5('0x19')](_0x115680)[_0x04f5('0x27')](_0x479435);};}exports[_0x04f5('0x28')]=function(_0x33b33c,_0x4be24a){var _0x32ec46={},_0x2e7fa0={},_0xb18601={'count':0x0,'rows':[]};var _0x4bc2f5=_[_0x04f5('0x29')](db['FreshdeskConfiguration'][_0x04f5('0x2a')],function(_0x56ad2b){return{'name':_0x56ad2b[_0x04f5('0x2b')],'type':_0x56ad2b[_0x04f5('0x2c')][_0x04f5('0x2d')]};});_0x2e7fa0[_0x04f5('0x2e')]=_[_0x04f5('0x29')](_0x4bc2f5,_0x04f5('0x26'));_0x2e7fa0['query']=_[_0x04f5('0x2f')](_0x33b33c[_0x04f5('0x30')]);_0x2e7fa0['filters']=_['intersection'](_0x2e7fa0[_0x04f5('0x2e')],_0x2e7fa0[_0x04f5('0x30')]);_0x32ec46[_0x04f5('0x31')]=_['intersection'](_0x2e7fa0[_0x04f5('0x2e')],qs[_0x04f5('0x32')](_0x33b33c[_0x04f5('0x30')]['fields']));_0x32ec46[_0x04f5('0x31')]=_0x32ec46[_0x04f5('0x31')][_0x04f5('0x33')]?_0x32ec46[_0x04f5('0x31')]:_0x2e7fa0[_0x04f5('0x2e')];if(!_0x33b33c[_0x04f5('0x30')][_0x04f5('0x34')](_0x04f5('0x35'))){_0x32ec46[_0x04f5('0x1d')]=qs[_0x04f5('0x1d')](_0x33b33c[_0x04f5('0x30')]['limit']);_0x32ec46[_0x04f5('0x1b')]=qs['offset'](_0x33b33c[_0x04f5('0x30')][_0x04f5('0x1b')]);}_0x32ec46['order']=qs[_0x04f5('0x36')](_0x33b33c[_0x04f5('0x30')][_0x04f5('0x36')]);_0x32ec46['where']=qs[_0x04f5('0x37')](_[_0x04f5('0x38')](_0x33b33c[_0x04f5('0x30')],_0x2e7fa0[_0x04f5('0x37')]),_0x4bc2f5);if(_0x33b33c[_0x04f5('0x30')][_0x04f5('0x39')]){_0x32ec46[_0x04f5('0x3a')]=_[_0x04f5('0x3b')](_0x32ec46[_0x04f5('0x3a')],{'$or':_[_0x04f5('0x29')](_0x4bc2f5,function(_0x24f9b6){if(_0x24f9b6[_0x04f5('0x2c')]!==_0x04f5('0x3c')){var _0x4367d8={};_0x4367d8[_0x24f9b6[_0x04f5('0x26')]]={'$like':'%'+_0x33b33c['query'][_0x04f5('0x39')]+'%'};return _0x4367d8;}})});}_0x32ec46=_[_0x04f5('0x3b')]({},_0x32ec46,_0x33b33c[_0x04f5('0x3d')]);var _0x5d4b0c={'where':_0x32ec46['where']};return db['FreshdeskConfiguration'][_0x04f5('0x1e')](_0x5d4b0c)[_0x04f5('0x3e')](function(_0xdc9c8){_0xb18601[_0x04f5('0x1e')]=_0xdc9c8;if(_0x33b33c[_0x04f5('0x30')][_0x04f5('0x3f')]){_0x32ec46[_0x04f5('0x40')]=[{'all':!![]}];}return db[_0x04f5('0x41')][_0x04f5('0x42')](_0x32ec46);})[_0x04f5('0x3e')](function(_0x36d8d7){_0xb18601[_0x04f5('0x43')]=_0x36d8d7;return _0xb18601;})['then'](respondWithFilteredResult(_0x4be24a,_0x32ec46))[_0x04f5('0x44')](handleError(_0x4be24a,null));};exports[_0x04f5('0x45')]=function(_0x4ed050,_0x50b313){var _0x4360cd={'raw':![],'where':{'id':_0x4ed050[_0x04f5('0x46')]['id']}},_0x2bca25={};_0x2bca25[_0x04f5('0x2e')]=_[_0x04f5('0x2f')](db['FreshdeskConfiguration'][_0x04f5('0x2a')]);_0x2bca25[_0x04f5('0x30')]=_[_0x04f5('0x2f')](_0x4ed050['query']);_0x2bca25[_0x04f5('0x37')]=_[_0x04f5('0x47')](_0x2bca25[_0x04f5('0x2e')],_0x2bca25[_0x04f5('0x30')]);_0x4360cd['attributes']=_[_0x04f5('0x47')](_0x2bca25[_0x04f5('0x2e')],qs[_0x04f5('0x32')](_0x4ed050[_0x04f5('0x30')][_0x04f5('0x32')]));_0x4360cd[_0x04f5('0x31')]=_0x4360cd[_0x04f5('0x31')]['length']?_0x4360cd[_0x04f5('0x31')]:_0x2bca25[_0x04f5('0x2e')];if(_0x4ed050[_0x04f5('0x30')][_0x04f5('0x3f')]){_0x4360cd['include']=[{'all':!![]}];}_0x4360cd=_['merge']({},_0x4360cd,_0x4ed050[_0x04f5('0x3d')]);return db['FreshdeskConfiguration'][_0x04f5('0x48')](_0x4360cd)['then'](handleEntityNotFound(_0x50b313,null))['then'](respondWithResult(_0x50b313,null))[_0x04f5('0x44')](handleError(_0x50b313,null));};exports['create']=function(_0x28ba83,_0x513dda){return db[_0x04f5('0x41')][_0x04f5('0x49')](_0x28ba83[_0x04f5('0x4a')],{})['then'](respondWithResult(_0x513dda,0xc9))[_0x04f5('0x44')](handleError(_0x513dda,null));};exports['update']=function(_0x42f328,_0x1d2780){if(_0x42f328[_0x04f5('0x4a')]['id']){delete _0x42f328[_0x04f5('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0x04f5('0x48')]({'where':{'id':_0x42f328[_0x04f5('0x46')]['id']}})[_0x04f5('0x3e')](handleEntityNotFound(_0x1d2780,null))['then'](saveUpdates(_0x42f328[_0x04f5('0x4a')],null))['then'](respondWithResult(_0x1d2780,null))['catch'](handleError(_0x1d2780,null));};exports[_0x04f5('0x23')]=function(_0x55d208,_0x16e9d2){return db[_0x04f5('0x41')][_0x04f5('0x48')]({'where':{'id':_0x55d208['params']['id']}})[_0x04f5('0x3e')](handleEntityNotFound(_0x16e9d2,null))[_0x04f5('0x3e')](removeEntity(_0x16e9d2,null))[_0x04f5('0x44')](handleError(_0x16e9d2,null));};exports[_0x04f5('0x4b')]=function(_0x23c573,_0x59d152,_0x3a03a0){var _0x17f6c0={};var _0x53ef1f={};var _0x4a0f4a;var _0x120361;return db[_0x04f5('0x41')][_0x04f5('0x4c')]({'where':{'id':_0x23c573[_0x04f5('0x46')]['id']}})[_0x04f5('0x3e')](handleEntityNotFound(_0x59d152,null))[_0x04f5('0x3e')](function(_0x44ebeb){if(_0x44ebeb){_0x4a0f4a=_0x44ebeb;_0x53ef1f[_0x04f5('0x2e')]=_[_0x04f5('0x2f')](db['FreshdeskField'][_0x04f5('0x2a')]);_0x53ef1f['query']=_[_0x04f5('0x2f')](_0x23c573[_0x04f5('0x30')]);_0x53ef1f[_0x04f5('0x37')]=_['intersection'](_0x53ef1f[_0x04f5('0x2e')],_0x53ef1f[_0x04f5('0x30')]);_0x17f6c0[_0x04f5('0x31')]=_[_0x04f5('0x47')](_0x53ef1f[_0x04f5('0x2e')],qs[_0x04f5('0x32')](_0x23c573[_0x04f5('0x30')][_0x04f5('0x32')]));_0x17f6c0['attributes']=_0x17f6c0[_0x04f5('0x31')][_0x04f5('0x33')]?_0x17f6c0[_0x04f5('0x31')]:_0x53ef1f[_0x04f5('0x2e')];_0x17f6c0[_0x04f5('0x4d')]=qs[_0x04f5('0x36')](_0x23c573['query'][_0x04f5('0x36')]);_0x17f6c0['where']=qs[_0x04f5('0x37')](_[_0x04f5('0x38')](_0x23c573[_0x04f5('0x30')],_0x53ef1f[_0x04f5('0x37')]));if(_0x23c573['query'][_0x04f5('0x39')]){_0x17f6c0['where']=_[_0x04f5('0x3b')](_0x17f6c0[_0x04f5('0x3a')],{'$or':_[_0x04f5('0x29')](_0x17f6c0[_0x04f5('0x31')],function(_0x51c9e7){var _0x147ea5={};_0x147ea5[_0x51c9e7]={'$like':'%'+_0x23c573[_0x04f5('0x30')][_0x04f5('0x39')]+'%'};return _0x147ea5;})});}_0x17f6c0=_['merge']({},_0x17f6c0,_0x23c573['options']);return _0x4a0f4a['getFields'](_0x17f6c0);}})[_0x04f5('0x3e')](function(_0x29dfaa){if(_0x29dfaa){_0x120361=_0x29dfaa[_0x04f5('0x33')];if(!_0x23c573['query'][_0x04f5('0x34')](_0x04f5('0x35'))){_0x17f6c0[_0x04f5('0x1d')]=qs[_0x04f5('0x1d')](_0x23c573[_0x04f5('0x30')]['limit']);_0x17f6c0[_0x04f5('0x1b')]=qs[_0x04f5('0x1b')](_0x23c573[_0x04f5('0x30')][_0x04f5('0x1b')]);}return _0x4a0f4a[_0x04f5('0x4b')](_0x17f6c0);}})[_0x04f5('0x3e')](function(_0x2d070e){if(_0x2d070e){return _0x2d070e?{'count':_0x120361,'rows':_0x2d070e}:null;}})[_0x04f5('0x3e')](respondWithResult(_0x59d152,null))[_0x04f5('0x44')](handleError(_0x59d152,null));};exports[_0x04f5('0x4e')]=function(_0x369109,_0x25f708,_0x1738bd){var _0x99b943={};var _0x21c9d0={};var _0x588153;var _0x449012;return db['FreshdeskConfiguration'][_0x04f5('0x4c')]({'where':{'id':_0x369109[_0x04f5('0x46')]['id']}})[_0x04f5('0x3e')](handleEntityNotFound(_0x25f708,null))[_0x04f5('0x3e')](function(_0x13c10a){if(_0x13c10a){_0x588153=_0x13c10a;_0x21c9d0[_0x04f5('0x2e')]=_[_0x04f5('0x2f')](db[_0x04f5('0x4f')][_0x04f5('0x2a')]);_0x21c9d0[_0x04f5('0x30')]=_[_0x04f5('0x2f')](_0x369109[_0x04f5('0x30')]);_0x21c9d0[_0x04f5('0x37')]=_['intersection'](_0x21c9d0['model'],_0x21c9d0['query']);_0x99b943['attributes']=_[_0x04f5('0x47')](_0x21c9d0['model'],qs[_0x04f5('0x32')](_0x369109[_0x04f5('0x30')][_0x04f5('0x32')]));_0x99b943[_0x04f5('0x31')]=_0x99b943[_0x04f5('0x31')][_0x04f5('0x33')]?_0x99b943[_0x04f5('0x31')]:_0x21c9d0[_0x04f5('0x2e')];_0x99b943[_0x04f5('0x4d')]=qs['sort'](_0x369109[_0x04f5('0x30')]['sort']);_0x99b943['where']=qs[_0x04f5('0x37')](_[_0x04f5('0x38')](_0x369109[_0x04f5('0x30')],_0x21c9d0[_0x04f5('0x37')]));if(_0x369109[_0x04f5('0x30')][_0x04f5('0x39')]){_0x99b943['where']=_['merge'](_0x99b943['where'],{'$or':_[_0x04f5('0x29')](_0x99b943[_0x04f5('0x31')],function(_0x8693ba){var _0x718a13={};_0x718a13[_0x8693ba]={'$like':'%'+_0x369109[_0x04f5('0x30')][_0x04f5('0x39')]+'%'};return _0x718a13;})});}_0x99b943=_[_0x04f5('0x3b')]({},_0x99b943,_0x369109[_0x04f5('0x3d')]);return _0x588153['getSubjects'](_0x99b943);}})[_0x04f5('0x3e')](function(_0x51a517){if(_0x51a517){_0x449012=_0x51a517['length'];if(!_0x369109[_0x04f5('0x30')][_0x04f5('0x34')](_0x04f5('0x35'))){_0x99b943[_0x04f5('0x1d')]=qs[_0x04f5('0x1d')](_0x369109[_0x04f5('0x30')][_0x04f5('0x1d')]);_0x99b943[_0x04f5('0x1b')]=qs[_0x04f5('0x1b')](_0x369109[_0x04f5('0x30')][_0x04f5('0x1b')]);}return _0x588153[_0x04f5('0x4e')](_0x99b943);}})['then'](function(_0x2ee90c){if(_0x2ee90c){return _0x2ee90c?{'count':_0x449012,'rows':_0x2ee90c}:null;}})[_0x04f5('0x3e')](respondWithResult(_0x25f708,null))[_0x04f5('0x44')](handleError(_0x25f708,null));};exports['getDescriptions']=function(_0x2295ab,_0x372be4,_0x1e19e4){var _0x302d6d={};var _0x3bdcfd={};var _0x54ba95;var _0x157a52;return db['FreshdeskConfiguration'][_0x04f5('0x4c')]({'where':{'id':_0x2295ab[_0x04f5('0x46')]['id']}})[_0x04f5('0x3e')](handleEntityNotFound(_0x372be4,null))[_0x04f5('0x3e')](function(_0x1a3551){if(_0x1a3551){_0x54ba95=_0x1a3551;_0x3bdcfd[_0x04f5('0x2e')]=_[_0x04f5('0x2f')](db[_0x04f5('0x4f')][_0x04f5('0x2a')]);_0x3bdcfd[_0x04f5('0x30')]=_[_0x04f5('0x2f')](_0x2295ab['query']);_0x3bdcfd[_0x04f5('0x37')]=_['intersection'](_0x3bdcfd[_0x04f5('0x2e')],_0x3bdcfd[_0x04f5('0x30')]);_0x302d6d[_0x04f5('0x31')]=_['intersection'](_0x3bdcfd[_0x04f5('0x2e')],qs[_0x04f5('0x32')](_0x2295ab[_0x04f5('0x30')][_0x04f5('0x32')]));_0x302d6d[_0x04f5('0x31')]=_0x302d6d[_0x04f5('0x31')][_0x04f5('0x33')]?_0x302d6d[_0x04f5('0x31')]:_0x3bdcfd[_0x04f5('0x2e')];_0x302d6d[_0x04f5('0x4d')]=qs[_0x04f5('0x36')](_0x2295ab[_0x04f5('0x30')][_0x04f5('0x36')]);_0x302d6d[_0x04f5('0x3a')]=qs['filters'](_[_0x04f5('0x38')](_0x2295ab[_0x04f5('0x30')],_0x3bdcfd[_0x04f5('0x37')]));if(_0x2295ab[_0x04f5('0x30')]['filter']){_0x302d6d[_0x04f5('0x3a')]=_[_0x04f5('0x3b')](_0x302d6d[_0x04f5('0x3a')],{'$or':_['map'](_0x302d6d['attributes'],function(_0x4cc759){var _0x3a7a59={};_0x3a7a59[_0x4cc759]={'$like':'%'+_0x2295ab[_0x04f5('0x30')][_0x04f5('0x39')]+'%'};return _0x3a7a59;})});}_0x302d6d=_['merge']({},_0x302d6d,_0x2295ab[_0x04f5('0x3d')]);return _0x54ba95['getDescriptions'](_0x302d6d);}})[_0x04f5('0x3e')](function(_0x1d1fa9){if(_0x1d1fa9){_0x157a52=_0x1d1fa9[_0x04f5('0x33')];if(!_0x2295ab[_0x04f5('0x30')]['hasOwnProperty'](_0x04f5('0x35'))){_0x302d6d[_0x04f5('0x1d')]=qs[_0x04f5('0x1d')](_0x2295ab['query'][_0x04f5('0x1d')]);_0x302d6d[_0x04f5('0x1b')]=qs[_0x04f5('0x1b')](_0x2295ab[_0x04f5('0x30')][_0x04f5('0x1b')]);}return _0x54ba95['getDescriptions'](_0x302d6d);}})[_0x04f5('0x3e')](function(_0x574e62){if(_0x574e62){return _0x574e62?{'count':_0x157a52,'rows':_0x574e62}:null;}})[_0x04f5('0x3e')](respondWithResult(_0x372be4,null))[_0x04f5('0x44')](handleError(_0x372be4,null));};exports[_0x04f5('0x50')]=function(_0x1c89fa,_0x183948,_0x3faa41){var _0x4b50c7={};var _0x4e4aa2={};var _0x57f753;var _0x4c31b0;return db[_0x04f5('0x41')][_0x04f5('0x4c')]({'where':{'id':_0x1c89fa[_0x04f5('0x46')]['id']}})[_0x04f5('0x3e')](handleEntityNotFound(_0x183948,null))['then'](function(_0x34123b){if(_0x34123b){_0x57f753=_0x34123b;_0x4e4aa2[_0x04f5('0x2e')]=_[_0x04f5('0x2f')](db[_0x04f5('0x51')][_0x04f5('0x2a')]);_0x4e4aa2[_0x04f5('0x30')]=_[_0x04f5('0x2f')](_0x1c89fa['query']);_0x4e4aa2[_0x04f5('0x37')]=_[_0x04f5('0x47')](_0x4e4aa2[_0x04f5('0x2e')],_0x4e4aa2[_0x04f5('0x30')]);_0x4b50c7['attributes']=_['intersection'](_0x4e4aa2[_0x04f5('0x2e')],qs['fields'](_0x1c89fa[_0x04f5('0x30')]['fields']));_0x4b50c7[_0x04f5('0x31')]=_0x4b50c7[_0x04f5('0x31')][_0x04f5('0x33')]?_0x4b50c7[_0x04f5('0x31')]:_0x4e4aa2[_0x04f5('0x2e')];_0x4b50c7[_0x04f5('0x4d')]=qs[_0x04f5('0x36')](_0x1c89fa[_0x04f5('0x30')][_0x04f5('0x36')]);_0x4b50c7[_0x04f5('0x3a')]=qs[_0x04f5('0x37')](_[_0x04f5('0x38')](_0x1c89fa[_0x04f5('0x30')],_0x4e4aa2[_0x04f5('0x37')]));if(_0x1c89fa[_0x04f5('0x30')][_0x04f5('0x39')]){_0x4b50c7[_0x04f5('0x3a')]=_[_0x04f5('0x3b')](_0x4b50c7[_0x04f5('0x3a')],{'$or':_[_0x04f5('0x29')](_0x4b50c7[_0x04f5('0x31')],function(_0x318a68){var _0x2dc49a={};_0x2dc49a[_0x318a68]={'$like':'%'+_0x1c89fa[_0x04f5('0x30')][_0x04f5('0x39')]+'%'};return _0x2dc49a;})});}_0x4b50c7=_[_0x04f5('0x3b')]({},_0x4b50c7,_0x1c89fa[_0x04f5('0x3d')]);return _0x57f753['getTags'](_0x4b50c7);}})[_0x04f5('0x3e')](function(_0x4cad50){if(_0x4cad50){_0x4c31b0=_0x4cad50['length'];if(!_0x1c89fa['query'][_0x04f5('0x34')](_0x04f5('0x35'))){_0x4b50c7[_0x04f5('0x1d')]=qs[_0x04f5('0x1d')](_0x1c89fa[_0x04f5('0x30')][_0x04f5('0x1d')]);_0x4b50c7['offset']=qs[_0x04f5('0x1b')](_0x1c89fa['query'][_0x04f5('0x1b')]);}return _0x57f753[_0x04f5('0x50')](_0x4b50c7);}})[_0x04f5('0x3e')](function(_0xf342b){if(_0xf342b){return _0xf342b?{'count':_0x4c31b0,'rows':_0xf342b}:null;}})[_0x04f5('0x3e')](respondWithResult(_0x183948,null))[_0x04f5('0x44')](handleError(_0x183948,null));};exports[_0x04f5('0x52')]=function(_0x9d413b,_0x34f25a,_0x5c54dc){if(_0x9d413b[_0x04f5('0x4a')]['id']){delete _0x9d413b[_0x04f5('0x4a')]['id'];}return db[_0x04f5('0x41')][_0x04f5('0x4c')]({'where':{'id':_0x9d413b[_0x04f5('0x46')]['id']}})['then'](handleEntityNotFound(_0x34f25a,null))[_0x04f5('0x3e')](function(_0x5245ae){if(_0x5245ae){return _0x5245ae[_0x04f5('0x52')](_0x9d413b['body'][_0x04f5('0x53')]||[]);}return null;})['then'](respondWithResult(_0x34f25a,null))[_0x04f5('0x44')](handleError(_0x34f25a,null));}; \ No newline at end of file +var _0x8563=['create','body','params','find','findOne','FreshdeskField','hasOwnProperty','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','map','filter','options','findAll','catch','show','includeAll','include'];(function(_0x4d1483,_0x3c7b5a){var _0x4c35fb=function(_0x5d97f8){while(--_0x5d97f8){_0x4d1483['push'](_0x4d1483['shift']());}};_0x4c35fb(++_0x3c7b5a);}(_0x8563,0x104));var _0x3856=function(_0x5ce14b,_0x204cab){_0x5ce14b=_0x5ce14b-0x0;var _0x29c5fc=_0x8563[_0x5ce14b];return _0x29c5fc;};'use strict';var emlformat=require(_0x3856('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3856('0x1'));var jsonpatch=require(_0x3856('0x2'));var rp=require(_0x3856('0x3'));var moment=require(_0x3856('0x4'));var BPromise=require(_0x3856('0x5'));var Mustache=require(_0x3856('0x6'));var util=require('util');var path=require(_0x3856('0x7'));var sox=require(_0x3856('0x8'));var csv=require(_0x3856('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3856('0xa'));var _=require('lodash');var squel=require(_0x3856('0xb'));var crypto=require('crypto');var jsforce=require(_0x3856('0xc'));var deskjs=require(_0x3856('0xd'));var toCsv=require(_0x3856('0x9'));var querystring=require('querystring');var Papa=require(_0x3856('0xe'));var Redis=require(_0x3856('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3856('0x10'));var hardwareService=require(_0x3856('0x11'));var logger=require(_0x3856('0x12'))(_0x3856('0x13'));var utils=require(_0x3856('0x14'));var config=require(_0x3856('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3856('0x16'))['db'];function respondWithStatusCode(_0xee151c,_0x380754){_0x380754=_0x380754||0xcc;return function(_0x2d9175){if(_0x2d9175){return _0xee151c['sendStatus'](_0x380754);}return _0xee151c['status'](_0x380754)[_0x3856('0x17')]();};}function respondWithResult(_0x37f5e2,_0x333dd0){_0x333dd0=_0x333dd0||0xc8;return function(_0xcdf9df){if(_0xcdf9df){return _0x37f5e2['status'](_0x333dd0)[_0x3856('0x18')](_0xcdf9df);}};}function respondWithFilteredResult(_0x46f309,_0xd13fbd){return function(_0x3af6d8){if(_0x3af6d8){var _0xb2cf85=typeof _0xd13fbd[_0x3856('0x19')]===_0x3856('0x1a')&&typeof _0xd13fbd[_0x3856('0x1b')]==='undefined';var _0x5c5c4d=_0x3af6d8[_0x3856('0x1c')];var _0x319e46=_0xb2cf85?0x0:_0xd13fbd[_0x3856('0x19')];var _0x32f613=_0xb2cf85?_0x3af6d8['count']:_0xd13fbd['offset']+_0xd13fbd[_0x3856('0x1b')];var _0x3ddeba;if(_0x32f613>=_0x5c5c4d){_0x32f613=_0x5c5c4d;_0x3ddeba=0xc8;}else{_0x3ddeba=0xce;}_0x46f309[_0x3856('0x1d')](_0x3ddeba);return _0x46f309[_0x3856('0x1e')](_0x3856('0x1f'),_0x319e46+'-'+_0x32f613+'/'+_0x5c5c4d)[_0x3856('0x18')](_0x3af6d8);}return null;};}function patchUpdates(_0xa73ef5){return function(_0x186e64){try{jsonpatch[_0x3856('0x20')](_0x186e64,_0xa73ef5,!![]);}catch(_0xe73394){return BPromise[_0x3856('0x21')](_0xe73394);}return _0x186e64['save']();};}function saveUpdates(_0xee4edc,_0x8d75a0){return function(_0x4e5eb8){if(_0x4e5eb8){return _0x4e5eb8['update'](_0xee4edc)[_0x3856('0x22')](function(_0xdfc43f){return _0xdfc43f;});}return null;};}function removeEntity(_0x44297e,_0x46fd5a){return function(_0x55728f){if(_0x55728f){return _0x55728f[_0x3856('0x23')]()['then'](function(){_0x44297e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50e5a2,_0x4d99dc){return function(_0x3230ab){if(!_0x3230ab){_0x50e5a2[_0x3856('0x24')](0x194);}return _0x3230ab;};}function handleError(_0x4dcef1,_0x228406){_0x228406=_0x228406||0x1f4;return function(_0x3e4117){logger[_0x3856('0x25')](_0x3e4117[_0x3856('0x26')]);if(_0x3e4117[_0x3856('0x27')]){delete _0x3e4117['name'];}_0x4dcef1[_0x3856('0x1d')](_0x228406)['send'](_0x3e4117);};}exports[_0x3856('0x28')]=function(_0x5869a1,_0x1df312){var _0x5965af={},_0x4b2c14={},_0x3f5f12={'count':0x0,'rows':[]};var _0xdd9921=_['map'](db[_0x3856('0x29')][_0x3856('0x2a')],function(_0x436ace){return{'name':_0x436ace[_0x3856('0x2b')],'type':_0x436ace[_0x3856('0x2c')][_0x3856('0x2d')]};});_0x4b2c14['model']=_['map'](_0xdd9921,_0x3856('0x27'));_0x4b2c14[_0x3856('0x2e')]=_[_0x3856('0x2f')](_0x5869a1[_0x3856('0x2e')]);_0x4b2c14[_0x3856('0x30')]=_[_0x3856('0x31')](_0x4b2c14[_0x3856('0x32')],_0x4b2c14[_0x3856('0x2e')]);_0x5965af['attributes']=_['intersection'](_0x4b2c14['model'],qs[_0x3856('0x33')](_0x5869a1[_0x3856('0x2e')]['fields']));_0x5965af[_0x3856('0x34')]=_0x5965af[_0x3856('0x34')][_0x3856('0x35')]?_0x5965af[_0x3856('0x34')]:_0x4b2c14[_0x3856('0x32')];if(!_0x5869a1[_0x3856('0x2e')]['hasOwnProperty'](_0x3856('0x36'))){_0x5965af[_0x3856('0x1b')]=qs[_0x3856('0x1b')](_0x5869a1['query'][_0x3856('0x1b')]);_0x5965af[_0x3856('0x19')]=qs[_0x3856('0x19')](_0x5869a1[_0x3856('0x2e')][_0x3856('0x19')]);}_0x5965af[_0x3856('0x37')]=qs[_0x3856('0x38')](_0x5869a1[_0x3856('0x2e')][_0x3856('0x38')]);_0x5965af[_0x3856('0x39')]=qs[_0x3856('0x30')](_[_0x3856('0x3a')](_0x5869a1[_0x3856('0x2e')],_0x4b2c14['filters']),_0xdd9921);if(_0x5869a1['query']['filter']){_0x5965af[_0x3856('0x39')]=_[_0x3856('0x3b')](_0x5965af[_0x3856('0x39')],{'$or':_[_0x3856('0x3c')](_0xdd9921,function(_0x489a01){if(_0x489a01['type']!=='VIRTUAL'){var _0x829916={};_0x829916[_0x489a01['name']]={'$like':'%'+_0x5869a1[_0x3856('0x2e')][_0x3856('0x3d')]+'%'};return _0x829916;}})});}_0x5965af=_[_0x3856('0x3b')]({},_0x5965af,_0x5869a1[_0x3856('0x3e')]);var _0x2c7689={'where':_0x5965af['where']};return db['FreshdeskConfiguration'][_0x3856('0x1c')](_0x2c7689)[_0x3856('0x22')](function(_0x14d33d){_0x3f5f12['count']=_0x14d33d;if(_0x5869a1[_0x3856('0x2e')]['includeAll']){_0x5965af['include']=[{'all':!![]}];}return db[_0x3856('0x29')][_0x3856('0x3f')](_0x5965af);})[_0x3856('0x22')](function(_0x182c40){_0x3f5f12['rows']=_0x182c40;return _0x3f5f12;})[_0x3856('0x22')](respondWithFilteredResult(_0x1df312,_0x5965af))[_0x3856('0x40')](handleError(_0x1df312,null));};exports[_0x3856('0x41')]=function(_0x4f1029,_0x434e20){var _0x5dc533={'raw':![],'where':{'id':_0x4f1029['params']['id']}},_0x2e5bab={};_0x2e5bab[_0x3856('0x32')]=_['keys'](db[_0x3856('0x29')][_0x3856('0x2a')]);_0x2e5bab[_0x3856('0x2e')]=_['keys'](_0x4f1029['query']);_0x2e5bab[_0x3856('0x30')]=_['intersection'](_0x2e5bab[_0x3856('0x32')],_0x2e5bab[_0x3856('0x2e')]);_0x5dc533[_0x3856('0x34')]=_[_0x3856('0x31')](_0x2e5bab[_0x3856('0x32')],qs[_0x3856('0x33')](_0x4f1029[_0x3856('0x2e')][_0x3856('0x33')]));_0x5dc533[_0x3856('0x34')]=_0x5dc533['attributes'][_0x3856('0x35')]?_0x5dc533[_0x3856('0x34')]:_0x2e5bab['model'];if(_0x4f1029[_0x3856('0x2e')][_0x3856('0x42')]){_0x5dc533[_0x3856('0x43')]=[{'all':!![]}];}_0x5dc533=_[_0x3856('0x3b')]({},_0x5dc533,_0x4f1029[_0x3856('0x3e')]);return db[_0x3856('0x29')]['find'](_0x5dc533)[_0x3856('0x22')](handleEntityNotFound(_0x434e20,null))[_0x3856('0x22')](respondWithResult(_0x434e20,null))['catch'](handleError(_0x434e20,null));};exports[_0x3856('0x44')]=function(_0x2dc497,_0x1e7768){return db['FreshdeskConfiguration']['create'](_0x2dc497[_0x3856('0x45')],{})[_0x3856('0x22')](respondWithResult(_0x1e7768,0xc9))['catch'](handleError(_0x1e7768,null));};exports['update']=function(_0x160480,_0x29f6e6){if(_0x160480[_0x3856('0x45')]['id']){delete _0x160480[_0x3856('0x45')]['id'];}return db[_0x3856('0x29')]['find']({'where':{'id':_0x160480[_0x3856('0x46')]['id']}})['then'](handleEntityNotFound(_0x29f6e6,null))[_0x3856('0x22')](saveUpdates(_0x160480[_0x3856('0x45')],null))[_0x3856('0x22')](respondWithResult(_0x29f6e6,null))[_0x3856('0x40')](handleError(_0x29f6e6,null));};exports[_0x3856('0x23')]=function(_0x3ba5ff,_0x4381fd){return db['FreshdeskConfiguration'][_0x3856('0x47')]({'where':{'id':_0x3ba5ff[_0x3856('0x46')]['id']}})[_0x3856('0x22')](handleEntityNotFound(_0x4381fd,null))[_0x3856('0x22')](removeEntity(_0x4381fd,null))['catch'](handleError(_0x4381fd,null));};exports['getFields']=function(_0x409b8f,_0x1292b8,_0x465363){var _0x4b3ccf={};var _0xf25e64={};var _0x1e50c7;var _0x357461;return db['FreshdeskConfiguration'][_0x3856('0x48')]({'where':{'id':_0x409b8f[_0x3856('0x46')]['id']}})[_0x3856('0x22')](handleEntityNotFound(_0x1292b8,null))[_0x3856('0x22')](function(_0xd72919){if(_0xd72919){_0x1e50c7=_0xd72919;_0xf25e64['model']=_[_0x3856('0x2f')](db[_0x3856('0x49')]['rawAttributes']);_0xf25e64[_0x3856('0x2e')]=_['keys'](_0x409b8f[_0x3856('0x2e')]);_0xf25e64[_0x3856('0x30')]=_['intersection'](_0xf25e64[_0x3856('0x32')],_0xf25e64['query']);_0x4b3ccf['attributes']=_['intersection'](_0xf25e64[_0x3856('0x32')],qs[_0x3856('0x33')](_0x409b8f[_0x3856('0x2e')][_0x3856('0x33')]));_0x4b3ccf['attributes']=_0x4b3ccf['attributes']['length']?_0x4b3ccf[_0x3856('0x34')]:_0xf25e64[_0x3856('0x32')];_0x4b3ccf[_0x3856('0x37')]=qs['sort'](_0x409b8f['query'][_0x3856('0x38')]);_0x4b3ccf[_0x3856('0x39')]=qs['filters'](_[_0x3856('0x3a')](_0x409b8f[_0x3856('0x2e')],_0xf25e64[_0x3856('0x30')]));if(_0x409b8f[_0x3856('0x2e')][_0x3856('0x3d')]){_0x4b3ccf[_0x3856('0x39')]=_['merge'](_0x4b3ccf['where'],{'$or':_[_0x3856('0x3c')](_0x4b3ccf[_0x3856('0x34')],function(_0xac1bfe){var _0x42625c={};_0x42625c[_0xac1bfe]={'$like':'%'+_0x409b8f['query'][_0x3856('0x3d')]+'%'};return _0x42625c;})});}_0x4b3ccf=_[_0x3856('0x3b')]({},_0x4b3ccf,_0x409b8f[_0x3856('0x3e')]);return _0x1e50c7['getFields'](_0x4b3ccf);}})['then'](function(_0x5b1519){if(_0x5b1519){_0x357461=_0x5b1519['length'];if(!_0x409b8f[_0x3856('0x2e')][_0x3856('0x4a')](_0x3856('0x36'))){_0x4b3ccf[_0x3856('0x1b')]=qs['limit'](_0x409b8f['query'][_0x3856('0x1b')]);_0x4b3ccf[_0x3856('0x19')]=qs[_0x3856('0x19')](_0x409b8f[_0x3856('0x2e')][_0x3856('0x19')]);}return _0x1e50c7[_0x3856('0x4b')](_0x4b3ccf);}})[_0x3856('0x22')](function(_0x48c8fa){if(_0x48c8fa){return _0x48c8fa?{'count':_0x357461,'rows':_0x48c8fa}:null;}})[_0x3856('0x22')](respondWithResult(_0x1292b8,null))[_0x3856('0x40')](handleError(_0x1292b8,null));};exports['getSubjects']=function(_0x1a0ccd,_0xa70701,_0x3166ec){var _0xd48c0c={};var _0x51a95b={};var _0x17f6dc;var _0xa20183;return db[_0x3856('0x29')][_0x3856('0x48')]({'where':{'id':_0x1a0ccd[_0x3856('0x46')]['id']}})[_0x3856('0x22')](handleEntityNotFound(_0xa70701,null))[_0x3856('0x22')](function(_0x21031d){if(_0x21031d){_0x17f6dc=_0x21031d;_0x51a95b['model']=_[_0x3856('0x2f')](db[_0x3856('0x49')]['rawAttributes']);_0x51a95b[_0x3856('0x2e')]=_[_0x3856('0x2f')](_0x1a0ccd[_0x3856('0x2e')]);_0x51a95b[_0x3856('0x30')]=_[_0x3856('0x31')](_0x51a95b['model'],_0x51a95b[_0x3856('0x2e')]);_0xd48c0c['attributes']=_['intersection'](_0x51a95b[_0x3856('0x32')],qs['fields'](_0x1a0ccd['query'][_0x3856('0x33')]));_0xd48c0c[_0x3856('0x34')]=_0xd48c0c[_0x3856('0x34')][_0x3856('0x35')]?_0xd48c0c['attributes']:_0x51a95b[_0x3856('0x32')];_0xd48c0c['order']=qs[_0x3856('0x38')](_0x1a0ccd[_0x3856('0x2e')][_0x3856('0x38')]);_0xd48c0c[_0x3856('0x39')]=qs[_0x3856('0x30')](_[_0x3856('0x3a')](_0x1a0ccd[_0x3856('0x2e')],_0x51a95b[_0x3856('0x30')]));if(_0x1a0ccd[_0x3856('0x2e')]['filter']){_0xd48c0c['where']=_[_0x3856('0x3b')](_0xd48c0c['where'],{'$or':_[_0x3856('0x3c')](_0xd48c0c['attributes'],function(_0x1cdead){var _0x4b969a={};_0x4b969a[_0x1cdead]={'$like':'%'+_0x1a0ccd[_0x3856('0x2e')][_0x3856('0x3d')]+'%'};return _0x4b969a;})});}_0xd48c0c=_[_0x3856('0x3b')]({},_0xd48c0c,_0x1a0ccd[_0x3856('0x3e')]);return _0x17f6dc[_0x3856('0x4c')](_0xd48c0c);}})['then'](function(_0x35e4ce){if(_0x35e4ce){_0xa20183=_0x35e4ce['length'];if(!_0x1a0ccd[_0x3856('0x2e')][_0x3856('0x4a')](_0x3856('0x36'))){_0xd48c0c[_0x3856('0x1b')]=qs[_0x3856('0x1b')](_0x1a0ccd['query']['limit']);_0xd48c0c[_0x3856('0x19')]=qs[_0x3856('0x19')](_0x1a0ccd[_0x3856('0x2e')]['offset']);}return _0x17f6dc[_0x3856('0x4c')](_0xd48c0c);}})['then'](function(_0x61852f){if(_0x61852f){return _0x61852f?{'count':_0xa20183,'rows':_0x61852f}:null;}})[_0x3856('0x22')](respondWithResult(_0xa70701,null))[_0x3856('0x40')](handleError(_0xa70701,null));};exports[_0x3856('0x4d')]=function(_0x1166ef,_0x32c4bb,_0x4f2431){var _0x1b225f={};var _0x52d124={};var _0x479f93;var _0x27d42e;return db[_0x3856('0x29')]['findOne']({'where':{'id':_0x1166ef['params']['id']}})[_0x3856('0x22')](handleEntityNotFound(_0x32c4bb,null))['then'](function(_0x3e1be5){if(_0x3e1be5){_0x479f93=_0x3e1be5;_0x52d124[_0x3856('0x32')]=_[_0x3856('0x2f')](db[_0x3856('0x49')][_0x3856('0x2a')]);_0x52d124[_0x3856('0x2e')]=_[_0x3856('0x2f')](_0x1166ef[_0x3856('0x2e')]);_0x52d124['filters']=_[_0x3856('0x31')](_0x52d124[_0x3856('0x32')],_0x52d124[_0x3856('0x2e')]);_0x1b225f[_0x3856('0x34')]=_[_0x3856('0x31')](_0x52d124[_0x3856('0x32')],qs[_0x3856('0x33')](_0x1166ef[_0x3856('0x2e')]['fields']));_0x1b225f[_0x3856('0x34')]=_0x1b225f[_0x3856('0x34')]['length']?_0x1b225f[_0x3856('0x34')]:_0x52d124[_0x3856('0x32')];_0x1b225f['order']=qs[_0x3856('0x38')](_0x1166ef[_0x3856('0x2e')][_0x3856('0x38')]);_0x1b225f[_0x3856('0x39')]=qs['filters'](_[_0x3856('0x3a')](_0x1166ef[_0x3856('0x2e')],_0x52d124[_0x3856('0x30')]));if(_0x1166ef[_0x3856('0x2e')][_0x3856('0x3d')]){_0x1b225f[_0x3856('0x39')]=_['merge'](_0x1b225f[_0x3856('0x39')],{'$or':_['map'](_0x1b225f[_0x3856('0x34')],function(_0x545b69){var _0x5d626f={};_0x5d626f[_0x545b69]={'$like':'%'+_0x1166ef[_0x3856('0x2e')]['filter']+'%'};return _0x5d626f;})});}_0x1b225f=_[_0x3856('0x3b')]({},_0x1b225f,_0x1166ef['options']);return _0x479f93[_0x3856('0x4d')](_0x1b225f);}})['then'](function(_0x42d01f){if(_0x42d01f){_0x27d42e=_0x42d01f[_0x3856('0x35')];if(!_0x1166ef['query'][_0x3856('0x4a')](_0x3856('0x36'))){_0x1b225f[_0x3856('0x1b')]=qs[_0x3856('0x1b')](_0x1166ef['query'][_0x3856('0x1b')]);_0x1b225f[_0x3856('0x19')]=qs[_0x3856('0x19')](_0x1166ef[_0x3856('0x2e')][_0x3856('0x19')]);}return _0x479f93[_0x3856('0x4d')](_0x1b225f);}})[_0x3856('0x22')](function(_0x5885e3){if(_0x5885e3){return _0x5885e3?{'count':_0x27d42e,'rows':_0x5885e3}:null;}})[_0x3856('0x22')](respondWithResult(_0x32c4bb,null))[_0x3856('0x40')](handleError(_0x32c4bb,null));};exports['getTags']=function(_0x553cf2,_0x1990eb,_0x1269e6){var _0x4932ae={};var _0x1ca273={};var _0x45d798;var _0x5885e6;return db[_0x3856('0x29')][_0x3856('0x48')]({'where':{'id':_0x553cf2['params']['id']}})[_0x3856('0x22')](handleEntityNotFound(_0x1990eb,null))['then'](function(_0x166257){if(_0x166257){_0x45d798=_0x166257;_0x1ca273['model']=_['keys'](db[_0x3856('0x4e')][_0x3856('0x2a')]);_0x1ca273['query']=_[_0x3856('0x2f')](_0x553cf2['query']);_0x1ca273[_0x3856('0x30')]=_[_0x3856('0x31')](_0x1ca273[_0x3856('0x32')],_0x1ca273[_0x3856('0x2e')]);_0x4932ae['attributes']=_['intersection'](_0x1ca273['model'],qs[_0x3856('0x33')](_0x553cf2[_0x3856('0x2e')][_0x3856('0x33')]));_0x4932ae[_0x3856('0x34')]=_0x4932ae[_0x3856('0x34')][_0x3856('0x35')]?_0x4932ae['attributes']:_0x1ca273[_0x3856('0x32')];_0x4932ae[_0x3856('0x37')]=qs[_0x3856('0x38')](_0x553cf2['query'][_0x3856('0x38')]);_0x4932ae['where']=qs[_0x3856('0x30')](_[_0x3856('0x3a')](_0x553cf2[_0x3856('0x2e')],_0x1ca273[_0x3856('0x30')]));if(_0x553cf2[_0x3856('0x2e')][_0x3856('0x3d')]){_0x4932ae['where']=_[_0x3856('0x3b')](_0x4932ae[_0x3856('0x39')],{'$or':_[_0x3856('0x3c')](_0x4932ae[_0x3856('0x34')],function(_0x2f4e5e){var _0x2e7fd5={};_0x2e7fd5[_0x2f4e5e]={'$like':'%'+_0x553cf2['query'][_0x3856('0x3d')]+'%'};return _0x2e7fd5;})});}_0x4932ae=_[_0x3856('0x3b')]({},_0x4932ae,_0x553cf2[_0x3856('0x3e')]);return _0x45d798['getTags'](_0x4932ae);}})[_0x3856('0x22')](function(_0x1c02c2){if(_0x1c02c2){_0x5885e6=_0x1c02c2[_0x3856('0x35')];if(!_0x553cf2['query'][_0x3856('0x4a')](_0x3856('0x36'))){_0x4932ae[_0x3856('0x1b')]=qs[_0x3856('0x1b')](_0x553cf2[_0x3856('0x2e')][_0x3856('0x1b')]);_0x4932ae['offset']=qs[_0x3856('0x19')](_0x553cf2[_0x3856('0x2e')][_0x3856('0x19')]);}return _0x45d798[_0x3856('0x4f')](_0x4932ae);}})[_0x3856('0x22')](function(_0x35bf8c){if(_0x35bf8c){return _0x35bf8c?{'count':_0x5885e6,'rows':_0x35bf8c}:null;}})[_0x3856('0x22')](respondWithResult(_0x1990eb,null))[_0x3856('0x40')](handleError(_0x1990eb,null));};exports[_0x3856('0x50')]=function(_0x48c39d,_0x1a4277,_0x3cf89c){if(_0x48c39d['body']['id']){delete _0x48c39d[_0x3856('0x45')]['id'];}return db[_0x3856('0x29')][_0x3856('0x48')]({'where':{'id':_0x48c39d[_0x3856('0x46')]['id']}})[_0x3856('0x22')](handleEntityNotFound(_0x1a4277,null))[_0x3856('0x22')](function(_0x1460d4){if(_0x1460d4){return _0x1460d4[_0x3856('0x50')](_0x48c39d[_0x3856('0x45')][_0x3856('0x51')]||[]);}return null;})[_0x3856('0x22')](respondWithResult(_0x1a4277,null))['catch'](handleError(_0x1a4277,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 35231c2..c5b4db8 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 _0xe7f8=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d9dc2,_0x4d0f69){var _0x9f75a0=function(_0x23d927){while(--_0x23d927){_0x3d9dc2['push'](_0x3d9dc2['shift']());}};_0x9f75a0(++_0x4d0f69);}(_0xe7f8,0x1e1));var _0x8e7f=function(_0x58cbbb,_0x386435){_0x58cbbb=_0x58cbbb-0x0;var _0x4f29c9=_0xe7f8[_0x58cbbb];return _0x4f29c9;};'use strict';var _=require(_0x8e7f('0x0'));var util=require('util');var logger=require(_0x8e7f('0x1'))(_0x8e7f('0x2'));var moment=require(_0x8e7f('0x3'));var BPromise=require(_0x8e7f('0x4'));var rp=require(_0x8e7f('0x5'));var fs=require('fs');var path=require(_0x8e7f('0x6'));var rimraf=require(_0x8e7f('0x7'));var config=require(_0x8e7f('0x8'));var attributes=require(_0x8e7f('0x9'));module[_0x8e7f('0xa')]=function(_0x47e081,_0x5dca5f){return _0x47e081[_0x8e7f('0xb')](_0x8e7f('0xc'),attributes,{'tableName':_0x8e7f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb40d=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x4df5d3,_0x522c48){var _0x34a8d=function(_0x52f363){while(--_0x52f363){_0x4df5d3['push'](_0x4df5d3['shift']());}};_0x34a8d(++_0x522c48);}(_0xb40d,0x10e));var _0xdb40=function(_0x392fed,_0x15b150){_0x392fed=_0x392fed-0x0;var _0x588bfe=_0xb40d[_0x392fed];return _0x588bfe;};'use strict';var _=require(_0xdb40('0x0'));var util=require(_0xdb40('0x1'));var logger=require('../../config/logger')(_0xdb40('0x2'));var moment=require(_0xdb40('0x3'));var BPromise=require(_0xdb40('0x4'));var rp=require(_0xdb40('0x5'));var fs=require('fs');var path=require(_0xdb40('0x6'));var rimraf=require(_0xdb40('0x7'));var config=require(_0xdb40('0x8'));var attributes=require(_0xdb40('0x9'));module[_0xdb40('0xa')]=function(_0x26ba9c,_0x4fb494){return _0x26ba9c[_0xdb40('0xb')](_0xdb40('0xc'),attributes,{'tableName':_0xdb40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 79d98f8..886fe9e 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 _0xe412=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird'];(function(_0x5108fb,_0x53b8d2){var _0x35fee7=function(_0x15499f){while(--_0x15499f){_0x5108fb['push'](_0x5108fb['shift']());}};_0x35fee7(++_0x53b8d2);}(_0xe412,0x162));var _0x2e41=function(_0xde3a12,_0x3110e5){_0xde3a12=_0xde3a12-0x0;var _0x5bc6f9=_0xe412[_0xde3a12];return _0x5bc6f9;};'use strict';var _=require(_0x2e41('0x0'));var util=require(_0x2e41('0x1'));var moment=require('moment');var BPromise=require(_0x2e41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e41('0x3'));var db=require(_0x2e41('0x4'))['db'];var utils=require(_0x2e41('0x5'));var logger=require('../../config/logger')(_0x2e41('0x6'));var config=require(_0x2e41('0x7'));var jayson=require(_0x2e41('0x8'));var client=jayson[_0x2e41('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19d64e,_0x11e794,_0x264d97){return new BPromise(function(_0x349c1e,_0x1eab82){return client['request'](_0x19d64e,_0x264d97)['then'](function(_0x2bbdc0){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x11e794,_0x2e41('0xa'));logger[_0x2e41('0xb')](_0x2e41('0xc'),_0x11e794,_0x2e41('0xa'),JSON[_0x2e41('0xd')](_0x2bbdc0));if(_0x2bbdc0[_0x2e41('0xe')]){if(_0x2bbdc0[_0x2e41('0xe')][_0x2e41('0xf')]===0x1f4){logger[_0x2e41('0xe')](_0x2e41('0x10'),_0x11e794,_0x2bbdc0[_0x2e41('0xe')]['message']);return _0x1eab82(_0x2bbdc0[_0x2e41('0xe')][_0x2e41('0x11')]);}logger[_0x2e41('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11e794,_0x2bbdc0['error'][_0x2e41('0x11')]);return _0x349c1e(_0x2bbdc0[_0x2e41('0xe')][_0x2e41('0x11')]);}else{logger[_0x2e41('0x12')](_0x2e41('0x10'),_0x11e794,'request\x20sent');_0x349c1e(_0x2bbdc0[_0x2e41('0x13')][_0x2e41('0x11')]);}})[_0x2e41('0x14')](function(_0x51833e){logger['error'](_0x2e41('0x10'),_0x11e794,_0x51833e);_0x1eab82(_0x51833e);});});} \ No newline at end of file +var _0xdb4a=['jayson/promise','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb4a,0x1af));var _0xadb4=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xdb4a[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0xadb4('0x0'));var util=require(_0xadb4('0x1'));var moment=require(_0xadb4('0x2'));var BPromise=require(_0xadb4('0x3'));var rs=require(_0xadb4('0x4'));var fs=require('fs');var Redis=require(_0xadb4('0x5'));var db=require(_0xadb4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xadb4('0x7'))(_0xadb4('0x8'));var config=require('../../config/environment');var jayson=require(_0xadb4('0x9'));var client=jayson['client'][_0xadb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5845be,_0xf9adc5,_0x209462){return new BPromise(function(_0x31a99e,_0x151112){return client['request'](_0x5845be,_0x209462)[_0xadb4('0xb')](function(_0x5834ac){logger['info'](_0xadb4('0xc'),_0xf9adc5,_0xadb4('0xd'));logger[_0xadb4('0xe')](_0xadb4('0xf'),_0xf9adc5,_0xadb4('0xd'),JSON[_0xadb4('0x10')](_0x5834ac));if(_0x5834ac[_0xadb4('0x11')]){if(_0x5834ac['error'][_0xadb4('0x12')]===0x1f4){logger[_0xadb4('0x11')](_0xadb4('0xc'),_0xf9adc5,_0x5834ac[_0xadb4('0x11')]['message']);return _0x151112(_0x5834ac[_0xadb4('0x11')][_0xadb4('0x13')]);}logger['error'](_0xadb4('0xc'),_0xf9adc5,_0x5834ac[_0xadb4('0x11')][_0xadb4('0x13')]);return _0x31a99e(_0x5834ac[_0xadb4('0x11')]['message']);}else{logger[_0xadb4('0x14')](_0xadb4('0xc'),_0xf9adc5,_0xadb4('0xd'));_0x31a99e(_0x5834ac[_0xadb4('0x15')][_0xadb4('0x13')]);}})['catch'](function(_0x234953){logger[_0xadb4('0x11')](_0xadb4('0xc'),_0xf9adc5,_0x234953);_0x151112(_0x234953);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2ef1bef..b3a1d93 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 _0x321c=['update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','index','/:id','isAuthenticated','show','post','create'];(function(_0x6d7900,_0x4841af){var _0x33709e=function(_0x521cd6){while(--_0x521cd6){_0x6d7900['push'](_0x6d7900['shift']());}};_0x33709e(++_0x4841af);}(_0x321c,0xc3));var _0xc321=function(_0x2b1592,_0x1d2f69){_0x2b1592=_0x2b1592-0x0;var _0xbbeaed=_0x321c[_0x2b1592];return _0xbbeaed;};'use strict';var multer=require(_0xc321('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc321('0x1'));var express=require(_0xc321('0x2'));var router=express['Router']();var fs_extra=require(_0xc321('0x3'));var auth=require(_0xc321('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc321('0x5'));var controller=require(_0xc321('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc321('0x7')]);router['get'](_0xc321('0x8'),auth[_0xc321('0x9')](),controller[_0xc321('0xa')]);router[_0xc321('0xb')]('/',auth['isAuthenticated'](),controller[_0xc321('0xc')]);router['put'](_0xc321('0x8'),auth['isAuthenticated'](),controller[_0xc321('0xd')]);router['delete'](_0xc321('0x8'),auth['isAuthenticated'](),controller[_0xc321('0xe')]);module[_0xc321('0xf')]=router; \ No newline at end of file +var _0x2695=['/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x126056,_0x205fdd){var _0x1c1384=function(_0x16bd82){while(--_0x16bd82){_0x126056['push'](_0x126056['shift']());}};_0x1c1384(++_0x205fdd);}(_0x2695,0x126));var _0x5269=function(_0x4803cf,_0x4c8fe7){_0x4803cf=_0x4803cf-0x0;var _0x54ee12=_0x2695[_0x4803cf];return _0x54ee12;};'use strict';var multer=require(_0x5269('0x0'));var util=require(_0x5269('0x1'));var path=require(_0x5269('0x2'));var timeout=require(_0x5269('0x3'));var express=require(_0x5269('0x4'));var router=express[_0x5269('0x5')]();var fs_extra=require(_0x5269('0x6'));var auth=require(_0x5269('0x7'));var interaction=require(_0x5269('0x8'));var config=require(_0x5269('0x9'));var controller=require(_0x5269('0xa'));router[_0x5269('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5269('0xc'),auth[_0x5269('0xd')](),controller[_0x5269('0xe')]);router['post']('/',auth[_0x5269('0xd')](),controller['create']);router['put']('/:id',auth[_0x5269('0xd')](),controller[_0x5269('0xf')]);router[_0x5269('0x10')](_0x5269('0xc'),auth['isAuthenticated'](),controller[_0x5269('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a117e3a..eb097a2 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 _0x8f7f=['picklist','string','STRING','customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue'];(function(_0x1be157,_0x97edbe){var _0x42e690=function(_0xf4971a){while(--_0xf4971a){_0x1be157['push'](_0x1be157['shift']());}};_0x42e690(++_0x97edbe);}(_0x8f7f,0x95));var _0xf8f7=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x8f7f[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0xf8f7('0x0'));module['exports']={'type':{'type':Sequelize[_0xf8f7('0x1')]('string',_0xf8f7('0x2'),'customVariable',_0xf8f7('0x3'),_0xf8f7('0x4')),'defaultValue':_0xf8f7('0x5')},'content':{'type':Sequelize[_0xf8f7('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf8f7('0x5'),_0xf8f7('0x2'),_0xf8f7('0x7'))},'keyContent':{'type':Sequelize[_0xf8f7('0x6')]},'idField':{'type':Sequelize[_0xf8f7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf8f7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf8f7('0x6')]}}; \ No newline at end of file +var _0x6d8c=['variable','customVariable','BOOLEAN','sequelize','ENUM','string','keyValue','picklist','STRING'];(function(_0x291475,_0x171328){var _0x353c40=function(_0x367151){while(--_0x367151){_0x291475['push'](_0x291475['shift']());}};_0x353c40(++_0x171328);}(_0x6d8c,0x6f));var _0xc6d8=function(_0x2ce93a,_0x52394b){_0x2ce93a=_0x2ce93a-0x0;var _0x16a018=_0x6d8c[_0x2ce93a];return _0x16a018;};'use strict';var Sequelize=require(_0xc6d8('0x0'));module['exports']={'type':{'type':Sequelize[_0xc6d8('0x1')](_0xc6d8('0x2'),'variable','customVariable',_0xc6d8('0x3'),_0xc6d8('0x4')),'defaultValue':_0xc6d8('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc6d8('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xc6d8('0x2'),_0xc6d8('0x6'),_0xc6d8('0x7'))},'keyContent':{'type':Sequelize[_0xc6d8('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc6d8('0x5')]},'customField':{'type':Sequelize[_0xc6d8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6d8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 301e98c..b7cc5e1 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 _0x1b73=['include','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll'];(function(_0x140e0a,_0x93233){var _0x373878=function(_0x1ac83a){while(--_0x1ac83a){_0x140e0a['push'](_0x140e0a['shift']());}};_0x373878(++_0x93233);}(_0x1b73,0x1d5));var _0x31b7=function(_0x581420,_0x20b8f7){_0x581420=_0x581420-0x0;var _0x167e9b=_0x1b73[_0x581420];return _0x167e9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0x2c993b,_0x4e5673){return function(_0xb8a998){if(!_0xb8a998){_0x2c993b['sendStatus'](0x194);}return _0xb8a998;};}function handleError(_0x3dd60d,_0x2da751){_0x2da751=_0x2da751||0x1f4;return function(_0x14b63f){logger[_0x31b7('0x28')](_0x14b63f[_0x31b7('0x29')]);if(_0x14b63f[_0x31b7('0x2a')]){delete _0x14b63f[_0x31b7('0x2a')];}_0x3dd60d[_0x31b7('0x1b')](_0x2da751)['send'](_0x14b63f);};}exports['index']=function(_0x503549,_0x46508a){var _0x39521d={},_0x2a7c54={},_0x4f5e1d={'count':0x0,'rows':[]};var _0x169238=_[_0x31b7('0x2b')](db[_0x31b7('0x2c')][_0x31b7('0x2d')],function(_0x58a87e){return{'name':_0x58a87e[_0x31b7('0x2e')],'type':_0x58a87e[_0x31b7('0x2f')]['key']};});_0x2a7c54['model']=_[_0x31b7('0x2b')](_0x169238,_0x31b7('0x2a'));_0x2a7c54[_0x31b7('0x30')]=_[_0x31b7('0x31')](_0x503549['query']);_0x2a7c54['filters']=_[_0x31b7('0x32')](_0x2a7c54[_0x31b7('0x33')],_0x2a7c54[_0x31b7('0x30')]);_0x39521d[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x2a7c54['model'],qs['fields'](_0x503549[_0x31b7('0x30')][_0x31b7('0x35')]));_0x39521d['attributes']=_0x39521d[_0x31b7('0x34')][_0x31b7('0x36')]?_0x39521d['attributes']:_0x2a7c54[_0x31b7('0x33')];if(!_0x503549[_0x31b7('0x30')][_0x31b7('0x37')](_0x31b7('0x38'))){_0x39521d[_0x31b7('0x1e')]=qs[_0x31b7('0x1e')](_0x503549[_0x31b7('0x30')][_0x31b7('0x1e')]);_0x39521d[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x503549[_0x31b7('0x30')][_0x31b7('0x20')]);}_0x39521d[_0x31b7('0x39')]=qs['sort'](_0x503549['query'][_0x31b7('0x3a')]);_0x39521d[_0x31b7('0x3b')]=qs[_0x31b7('0x3c')](_[_0x31b7('0x3d')](_0x503549[_0x31b7('0x30')],_0x2a7c54[_0x31b7('0x3c')]),_0x169238);if(_0x503549[_0x31b7('0x30')][_0x31b7('0x3e')]){_0x39521d[_0x31b7('0x3b')]=_[_0x31b7('0x3f')](_0x39521d['where'],{'$or':_[_0x31b7('0x2b')](_0x169238,function(_0xfd4863){if(_0xfd4863[_0x31b7('0x2f')]!==_0x31b7('0x40')){var _0x5c9cec={};_0x5c9cec[_0xfd4863[_0x31b7('0x2a')]]={'$like':'%'+_0x503549[_0x31b7('0x30')]['filter']+'%'};return _0x5c9cec;}})});}_0x39521d=_[_0x31b7('0x3f')]({},_0x39521d,_0x503549['options']);var _0x587506={'where':_0x39521d[_0x31b7('0x3b')]};return db[_0x31b7('0x2c')][_0x31b7('0x1f')](_0x587506)[_0x31b7('0x27')](function(_0x3d0413){_0x4f5e1d['count']=_0x3d0413;if(_0x503549[_0x31b7('0x30')]['includeAll']){_0x39521d['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x31b7('0x41')](_0x39521d);})[_0x31b7('0x27')](function(_0x1527b3){_0x4f5e1d[_0x31b7('0x42')]=_0x1527b3;return _0x4f5e1d;})[_0x31b7('0x27')](respondWithFilteredResult(_0x46508a,_0x39521d))['catch'](handleError(_0x46508a,null));};exports[_0x31b7('0x43')]=function(_0x5d1f25,_0xef2b18){var _0x3caab0={'raw':!![],'where':{'id':_0x5d1f25[_0x31b7('0x44')]['id']}},_0x41c92e={};_0x41c92e['model']=_[_0x31b7('0x31')](db[_0x31b7('0x2c')][_0x31b7('0x2d')]);_0x41c92e['query']=_[_0x31b7('0x31')](_0x5d1f25['query']);_0x41c92e[_0x31b7('0x3c')]=_[_0x31b7('0x32')](_0x41c92e['model'],_0x41c92e[_0x31b7('0x30')]);_0x3caab0[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x41c92e[_0x31b7('0x33')],qs['fields'](_0x5d1f25[_0x31b7('0x30')]['fields']));_0x3caab0['attributes']=_0x3caab0[_0x31b7('0x34')][_0x31b7('0x36')]?_0x3caab0[_0x31b7('0x34')]:_0x41c92e[_0x31b7('0x33')];if(_0x5d1f25['query'][_0x31b7('0x45')]){_0x3caab0[_0x31b7('0x46')]=[{'all':!![]}];}_0x3caab0=_['merge']({},_0x3caab0,_0x5d1f25[_0x31b7('0x47')]);return db[_0x31b7('0x2c')][_0x31b7('0x48')](_0x3caab0)['then'](handleEntityNotFound(_0xef2b18,null))[_0x31b7('0x27')](respondWithResult(_0xef2b18,null))[_0x31b7('0x49')](handleError(_0xef2b18,null));};exports[_0x31b7('0x4a')]=function(_0x164115,_0x345059){return db[_0x31b7('0x2c')][_0x31b7('0x4a')](_0x164115[_0x31b7('0x4b')],{})['then'](respondWithResult(_0x345059,0xc9))[_0x31b7('0x49')](handleError(_0x345059,null));};exports['update']=function(_0x5a72ee,_0x22cc77){if(_0x5a72ee[_0x31b7('0x4b')]['id']){delete _0x5a72ee[_0x31b7('0x4b')]['id'];}return db[_0x31b7('0x2c')]['find']({'where':{'id':_0x5a72ee[_0x31b7('0x44')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x22cc77,null))[_0x31b7('0x27')](saveUpdates(_0x5a72ee['body'],null))[_0x31b7('0x27')](respondWithResult(_0x22cc77,null))[_0x31b7('0x49')](handleError(_0x22cc77,null));};exports[_0x31b7('0x4c')]=function(_0x3b5868,_0x2bf59c){return db[_0x31b7('0x2c')][_0x31b7('0x48')]({'where':{'id':_0x3b5868[_0x31b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bf59c,null))['then'](removeEntity(_0x2bf59c,null))[_0x31b7('0x49')](handleError(_0x2bf59c,null));}; \ No newline at end of file +var _0xa571=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','end','error','name','index','map','FreshdeskField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa571,0x107));var _0x1a57=function(_0x1c8606,_0x3b75f9){_0x1c8606=_0x1c8606-0x0;var _0x58ff61=_0xa571[_0x1c8606];return _0x58ff61;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x23')]();});}};}function handleEntityNotFound(_0x2f9454,_0x182649){return function(_0x25c1e9){if(!_0x25c1e9){_0x2f9454[_0x1a57('0x18')](0x194);}return _0x25c1e9;};}function handleError(_0x27cfe1,_0xf6ffef){_0xf6ffef=_0xf6ffef||0x1f4;return function(_0x26584b){logger[_0x1a57('0x24')](_0x26584b['stack']);if(_0x26584b['name']){delete _0x26584b[_0x1a57('0x25')];}_0x27cfe1[_0x1a57('0x19')](_0xf6ffef)['send'](_0x26584b);};}exports[_0x1a57('0x26')]=function(_0x54f6a5,_0x2d8738){var _0x4a2901={},_0x53bf6e={},_0x8179a4={'count':0x0,'rows':[]};var _0x274fe6=_[_0x1a57('0x27')](db[_0x1a57('0x28')]['rawAttributes'],function(_0x366d5f){return{'name':_0x366d5f[_0x1a57('0x29')],'type':_0x366d5f[_0x1a57('0x2a')][_0x1a57('0x2b')]};});_0x53bf6e['model']=_[_0x1a57('0x27')](_0x274fe6,_0x1a57('0x25'));_0x53bf6e[_0x1a57('0x2c')]=_[_0x1a57('0x2d')](_0x54f6a5[_0x1a57('0x2c')]);_0x53bf6e[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],_0x53bf6e[_0x1a57('0x2c')]);_0x4a2901['attributes']=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],qs['fields'](_0x54f6a5['query'][_0x1a57('0x31')]));_0x4a2901[_0x1a57('0x32')]=_0x4a2901[_0x1a57('0x32')][_0x1a57('0x33')]?_0x4a2901[_0x1a57('0x32')]:_0x53bf6e[_0x1a57('0x30')];if(!_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x34')](_0x1a57('0x35'))){_0x4a2901[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1c')]);_0x4a2901[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1e')]);}_0x4a2901[_0x1a57('0x36')]=qs['sort'](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x37')]);_0x4a2901[_0x1a57('0x38')]=qs[_0x1a57('0x2e')](_[_0x1a57('0x39')](_0x54f6a5[_0x1a57('0x2c')],_0x53bf6e[_0x1a57('0x2e')]),_0x274fe6);if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]){_0x4a2901['where']=_['merge'](_0x4a2901['where'],{'$or':_['map'](_0x274fe6,function(_0x333b32){if(_0x333b32[_0x1a57('0x2a')]!==_0x1a57('0x3b')){var _0x4d6e1e={};_0x4d6e1e[_0x333b32[_0x1a57('0x25')]]={'$like':'%'+_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]+'%'};return _0x4d6e1e;}})});}_0x4a2901=_[_0x1a57('0x3c')]({},_0x4a2901,_0x54f6a5['options']);var _0x1be254={'where':_0x4a2901['where']};return db[_0x1a57('0x28')][_0x1a57('0x1d')](_0x1be254)[_0x1a57('0x21')](function(_0x534a9a){_0x8179a4[_0x1a57('0x1d')]=_0x534a9a;if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x4a2901[_0x1a57('0x3e')]=[{'all':!![]}];}return db[_0x1a57('0x28')]['findAll'](_0x4a2901);})[_0x1a57('0x21')](function(_0x47e998){_0x8179a4['rows']=_0x47e998;return _0x8179a4;})[_0x1a57('0x21')](respondWithFilteredResult(_0x2d8738,_0x4a2901))['catch'](handleError(_0x2d8738,null));};exports[_0x1a57('0x3f')]=function(_0x398c59,_0x3fbae1){var _0x59abb1={'raw':!![],'where':{'id':_0x398c59[_0x1a57('0x40')]['id']}},_0x188a50={};_0x188a50[_0x1a57('0x30')]=_[_0x1a57('0x2d')](db['FreshdeskField'][_0x1a57('0x41')]);_0x188a50[_0x1a57('0x2c')]=_['keys'](_0x398c59[_0x1a57('0x2c')]);_0x188a50['filters']=_['intersection'](_0x188a50[_0x1a57('0x30')],_0x188a50[_0x1a57('0x2c')]);_0x59abb1[_0x1a57('0x32')]=_[_0x1a57('0x2f')](_0x188a50['model'],qs[_0x1a57('0x31')](_0x398c59[_0x1a57('0x2c')][_0x1a57('0x31')]));_0x59abb1[_0x1a57('0x32')]=_0x59abb1[_0x1a57('0x32')]['length']?_0x59abb1[_0x1a57('0x32')]:_0x188a50[_0x1a57('0x30')];if(_0x398c59[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x59abb1['include']=[{'all':!![]}];}_0x59abb1=_[_0x1a57('0x3c')]({},_0x59abb1,_0x398c59['options']);return db[_0x1a57('0x28')][_0x1a57('0x42')](_0x59abb1)[_0x1a57('0x21')](handleEntityNotFound(_0x3fbae1,null))[_0x1a57('0x21')](respondWithResult(_0x3fbae1,null))[_0x1a57('0x43')](handleError(_0x3fbae1,null));};exports[_0x1a57('0x44')]=function(_0x28f629,_0x401285){return db[_0x1a57('0x28')][_0x1a57('0x44')](_0x28f629[_0x1a57('0x45')],{})[_0x1a57('0x21')](respondWithResult(_0x401285,0xc9))[_0x1a57('0x43')](handleError(_0x401285,null));};exports['update']=function(_0xf4d056,_0x480aff){if(_0xf4d056[_0x1a57('0x45')]['id']){delete _0xf4d056[_0x1a57('0x45')]['id'];}return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0xf4d056[_0x1a57('0x40')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x480aff,null))[_0x1a57('0x21')](saveUpdates(_0xf4d056[_0x1a57('0x45')],null))[_0x1a57('0x21')](respondWithResult(_0x480aff,null))['catch'](handleError(_0x480aff,null));};exports[_0x1a57('0x22')]=function(_0x439a42,_0x51651d){return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0x439a42['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x51651d,null))[_0x1a57('0x21')](removeEntity(_0x51651d,null))['catch'](handleError(_0x51651d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3f9454e..1081012 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 _0x9f47=['./intFreshdeskField.attributes','exports','define','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3f97a7,_0x4732e9){var _0x4cead3=function(_0x4fb68c){while(--_0x4fb68c){_0x3f97a7['push'](_0x3f97a7['shift']());}};_0x4cead3(++_0x4732e9);}(_0x9f47,0x1e9));var _0x79f4=function(_0x43001a,_0x108167){_0x43001a=_0x43001a-0x0;var _0x384e04=_0x9f47[_0x43001a];return _0x384e04;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79f4('0x0'))(_0x79f4('0x1'));var moment=require(_0x79f4('0x2'));var BPromise=require(_0x79f4('0x3'));var rp=require(_0x79f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x79f4('0x5'));var attributes=require(_0x79f4('0x6'));module[_0x79f4('0x7')]=function(_0x554b21,_0x36db52){return _0x554b21[_0x79f4('0x8')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x79f4('0x9'),_0x79f4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd23e=['idField','FieldId','lodash','util','api','bluebird','request-promise','rimraf','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x3129fc,_0x58981b){var _0x2ffca2=function(_0x4c68e7){while(--_0x4c68e7){_0x3129fc['push'](_0x3129fc['shift']());}};_0x2ffca2(++_0x58981b);}(_0xd23e,0xaa));var _0xed23=function(_0x37087e,_0x719222){_0x37087e=_0x37087e-0x0;var _0x117e6f=_0xd23e[_0x37087e];return _0x117e6f;};'use strict';var _=require(_0xed23('0x0'));var util=require(_0xed23('0x1'));var logger=require('../../config/logger')(_0xed23('0x2'));var moment=require('moment');var BPromise=require(_0xed23('0x3'));var rp=require(_0xed23('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed23('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xed23('0x6')]=function(_0x173b6a,_0x46212b){return _0x173b6a['define'](_0xed23('0x7'),attributes,{'tableName':_0xed23('0x8'),'paranoid':![],'indexes':[{'name':_0xed23('0x9'),'fields':[_0xed23('0xa'),_0xed23('0xb')],'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 b7565a1..98ad6ef 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 _0x8ca8=['FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug'];(function(_0x28add8,_0x18d6bd){var _0x2b1f4f=function(_0x454de1){while(--_0x454de1){_0x28add8['push'](_0x28add8['shift']());}};_0x2b1f4f(++_0x18d6bd);}(_0x8ca8,0x1d5));var _0x88ca=function(_0x3632ea,_0x25b7bf){_0x3632ea=_0x3632ea-0x0;var _0x1c0dda=_0x8ca8[_0x3632ea];return _0x1c0dda;};'use strict';var _=require(_0x88ca('0x0'));var util=require(_0x88ca('0x1'));var moment=require(_0x88ca('0x2'));var BPromise=require(_0x88ca('0x3'));var rs=require(_0x88ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x88ca('0x5'));var logger=require('../../config/logger')(_0x88ca('0x6'));var config=require(_0x88ca('0x7'));var jayson=require(_0x88ca('0x8'));var client=jayson['client'][_0x88ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dbdf1,_0x28785a,_0x55ec4d){return new BPromise(function(_0x24e0b9,_0x32bd3b){return client[_0x88ca('0xa')](_0x2dbdf1,_0x55ec4d)[_0x88ca('0xb')](function(_0x1ba28f){logger[_0x88ca('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x28785a,'request\x20sent');logger[_0x88ca('0xd')](_0x88ca('0xe'),_0x28785a,_0x88ca('0xf'),JSON[_0x88ca('0x10')](_0x1ba28f));if(_0x1ba28f['error']){if(_0x1ba28f[_0x88ca('0x11')][_0x88ca('0x12')]===0x1f4){logger[_0x88ca('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x28785a,_0x1ba28f['error']['message']);return _0x32bd3b(_0x1ba28f[_0x88ca('0x11')][_0x88ca('0x13')]);}logger[_0x88ca('0x11')](_0x88ca('0x14'),_0x28785a,_0x1ba28f[_0x88ca('0x11')][_0x88ca('0x13')]);return _0x24e0b9(_0x1ba28f[_0x88ca('0x11')][_0x88ca('0x13')]);}else{logger[_0x88ca('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x28785a,_0x88ca('0xf'));_0x24e0b9(_0x1ba28f[_0x88ca('0x15')]['message']);}})[_0x88ca('0x16')](function(_0x58803a){logger['error'](_0x88ca('0x14'),_0x28785a,_0x58803a);_0x32bd3b(_0x58803a);});});} \ No newline at end of file +var _0x688f=['jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3eb3f0,_0x47db11){var _0x45b6bb=function(_0x20075c){while(--_0x20075c){_0x3eb3f0['push'](_0x3eb3f0['shift']());}};_0x45b6bb(++_0x47db11);}(_0x688f,0x103));var _0xf688=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x688f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf688('0x0'));var util=require(_0xf688('0x1'));var moment=require(_0xf688('0x2'));var BPromise=require(_0xf688('0x3'));var rs=require(_0xf688('0x4'));var fs=require('fs');var Redis=require(_0xf688('0x5'));var db=require(_0xf688('0x6'))['db'];var utils=require(_0xf688('0x7'));var logger=require(_0xf688('0x8'))(_0xf688('0x9'));var config=require(_0xf688('0xa'));var jayson=require(_0xf688('0xb'));var client=jayson[_0xf688('0xc')][_0xf688('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3fe984,_0xf52db3,_0x54262c){return new BPromise(function(_0x16ac50,_0x262255){return client[_0xf688('0xe')](_0x3fe984,_0x54262c)[_0xf688('0xf')](function(_0xa7f418){logger[_0xf688('0x10')](_0xf688('0x11'),_0xf52db3,'request\x20sent');logger[_0xf688('0x12')](_0xf688('0x13'),_0xf52db3,'request\x20sent',JSON[_0xf688('0x14')](_0xa7f418));if(_0xa7f418[_0xf688('0x15')]){if(_0xa7f418['error'][_0xf688('0x16')]===0x1f4){logger[_0xf688('0x15')]('FreshdeskField,\x20%s,\x20%s',_0xf52db3,_0xa7f418[_0xf688('0x15')][_0xf688('0x17')]);return _0x262255(_0xa7f418['error'][_0xf688('0x17')]);}logger['error'](_0xf688('0x11'),_0xf52db3,_0xa7f418['error'][_0xf688('0x17')]);return _0x16ac50(_0xa7f418[_0xf688('0x15')]['message']);}else{logger[_0xf688('0x10')](_0xf688('0x11'),_0xf52db3,_0xf688('0x18'));_0x16ac50(_0xa7f418[_0xf688('0x19')][_0xf688('0x17')]);}})[_0xf688('0x1a')](function(_0x4136af){logger['error'](_0xf688('0x11'),_0xf52db3,_0x4136af);_0x262255(_0x4136af);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 2607a46..34d654f 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 _0x9c00=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x194547,_0x5dd8c1){var _0x1194a1=function(_0x4b9f0b){while(--_0x4b9f0b){_0x194547['push'](_0x194547['shift']());}};_0x1194a1(++_0x5dd8c1);}(_0x9c00,0x1a0));var _0x09c0=function(_0x345865,_0x1d878d){_0x345865=_0x345865-0x0;var _0x2e14f4=_0x9c00[_0x345865];return _0x2e14f4;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id/configurations',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0xf')](_0x09c0('0x11'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x13')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x14')]);router[_0x09c0('0x15')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);module[_0x09c0('0x17')]=router; \ No newline at end of file +var _0x282b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x282b,0xec));var _0xb282=function(_0xefa2a1,_0x7bec4d){_0xefa2a1=_0xefa2a1-0x0;var _0x39c0d5=_0x282b[_0xefa2a1];return _0x39c0d5;};'use strict';var multer=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var timeout=require(_0xb282('0x3'));var express=require(_0xb282('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb282('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb282('0x6'));var controller=require(_0xb282('0x7'));router[_0xb282('0x8')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xa')]);router[_0xb282('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb282('0xb')]);router[_0xb282('0x8')]('/:id/configurations',auth[_0xb282('0x9')](),controller[_0xb282('0xc')]);router[_0xb282('0x8')](_0xb282('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb282('0xe')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xf')]);router[_0xb282('0xe')](_0xb282('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb282('0x11')](_0xb282('0x12'),auth[_0xb282('0x9')](),controller[_0xb282('0x13')]);router[_0xb282('0x14')]('/:id',auth[_0xb282('0x9')](),controller['destroy']);module[_0xb282('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 286699e..49838f1 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 _0x5430=['STRING','username','remoteUri','sequelize','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5430,0x10c));var _0x0543=function(_0x4cd437,_0x39f2de){_0x4cd437=_0x4cd437-0x0;var _0x3cf66f=_0x5430[_0x4cd437];return _0x3cf66f;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')]},'description':{'type':Sequelize[_0x0543('0x2')]},'username':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0543('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x32f4,0x154));var _0x432f=function(_0xe67e03,_0x386c32){_0xe67e03=_0xe67e03-0x0;var _0x27670b=_0x32f4[_0xe67e03];return _0x27670b;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('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 244cc96..eb38d91 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 _0xf5e8=['params','keys','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xf5e8,0xe6));var _0x8f5e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xf5e8[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0x8f5e('0x0'));var rimraf=require(_0x8f5e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f5e('0x2'));var rp=require(_0x8f5e('0x3'));var moment=require(_0x8f5e('0x4'));var BPromise=require(_0x8f5e('0x5'));var Mustache=require('mustache');var util=require(_0x8f5e('0x6'));var path=require('path');var sox=require(_0x8f5e('0x7'));var csv=require(_0x8f5e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f5e('0x9'));var squel=require(_0x8f5e('0xa'));var crypto=require('crypto');var jsforce=require(_0x8f5e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f5e('0xc'));var authService=require(_0x8f5e('0xd'));var qs=require(_0x8f5e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f5e('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x8f5e('0x10'));var config=require(_0x8f5e('0x11'));var licenseUtil=require(_0x8f5e('0x12'));var db=require(_0x8f5e('0x13'))['db'];var integrations=require(_0x8f5e('0x14'));function respondWithStatusCode(_0xc0d81,_0x1492e7){_0x1492e7=_0x1492e7||0xcc;return function(_0x503e87){if(_0x503e87){return _0xc0d81[_0x8f5e('0x15')](_0x1492e7);}return _0xc0d81[_0x8f5e('0x16')](_0x1492e7)[_0x8f5e('0x17')]();};}function respondWithResult(_0x43a84b,_0x5cf4ef){_0x5cf4ef=_0x5cf4ef||0xc8;return function(_0x2b406d){if(_0x2b406d){return _0x43a84b[_0x8f5e('0x16')](_0x5cf4ef)[_0x8f5e('0x18')](_0x2b406d);}};}function respondWithFilteredResult(_0x581d7e,_0x5133f5){return function(_0x387291){if(_0x387291){var _0x5cd574=typeof _0x5133f5[_0x8f5e('0x19')]==='undefined'&&typeof _0x5133f5[_0x8f5e('0x1a')]===_0x8f5e('0x1b');var _0x3817d1=_0x387291[_0x8f5e('0x1c')];var _0x3a0e30=_0x5cd574?0x0:_0x5133f5['offset'];var _0x2ea9eb=_0x5cd574?_0x387291['count']:_0x5133f5['offset']+_0x5133f5[_0x8f5e('0x1a')];var _0x2e2566;if(_0x2ea9eb>=_0x3817d1){_0x2ea9eb=_0x3817d1;_0x2e2566=0xc8;}else{_0x2e2566=0xce;}_0x581d7e[_0x8f5e('0x16')](_0x2e2566);return _0x581d7e[_0x8f5e('0x1d')](_0x8f5e('0x1e'),_0x3a0e30+'-'+_0x2ea9eb+'/'+_0x3817d1)['json'](_0x387291);}return null;};}function patchUpdates(_0x3a3026){return function(_0x483280){try{jsonpatch['apply'](_0x483280,_0x3a3026,!![]);}catch(_0x50039b){return BPromise['reject'](_0x50039b);}return _0x483280[_0x8f5e('0x1f')]();};}function saveUpdates(_0x4b8479,_0x1e96cb){return function(_0x37a8b4){if(_0x37a8b4){return _0x37a8b4[_0x8f5e('0x20')](_0x4b8479)[_0x8f5e('0x21')](function(_0x526095){return _0x526095;});}return null;};}function removeEntity(_0x51f90b,_0x1a6fda){return function(_0x42022f){if(_0x42022f){return _0x42022f[_0x8f5e('0x22')]()[_0x8f5e('0x21')](function(){_0x51f90b[_0x8f5e('0x16')](0xcc)[_0x8f5e('0x17')]();});}};}function handleEntityNotFound(_0x5fc375,_0x14253f){return function(_0x11dc06){if(!_0x11dc06){_0x5fc375[_0x8f5e('0x15')](0x194);}return _0x11dc06;};}function handleError(_0x11866c,_0x55b7f7){_0x55b7f7=_0x55b7f7||0x1f4;return function(_0x352a0a){logger[_0x8f5e('0x23')](_0x352a0a['stack']);if(_0x352a0a['name']){delete _0x352a0a[_0x8f5e('0x24')];}_0x11866c[_0x8f5e('0x16')](_0x55b7f7)['send'](_0x352a0a);};}exports[_0x8f5e('0x25')]=function(_0x2627da,_0x1fb4d2){var _0x1cd28d={},_0x1cf0cd={},_0x8c322d={'count':0x0,'rows':[]};var _0x1e7ac2=_[_0x8f5e('0x26')](db[_0x8f5e('0x27')][_0x8f5e('0x28')],function(_0x2042b9){return{'name':_0x2042b9[_0x8f5e('0x29')],'type':_0x2042b9[_0x8f5e('0x2a')][_0x8f5e('0x2b')]};});_0x1cf0cd[_0x8f5e('0x2c')]=_[_0x8f5e('0x26')](_0x1e7ac2,_0x8f5e('0x24'));_0x1cf0cd['query']=_['keys'](_0x2627da[_0x8f5e('0x2d')]);_0x1cf0cd['filters']=_['intersection'](_0x1cf0cd[_0x8f5e('0x2c')],_0x1cf0cd[_0x8f5e('0x2d')]);_0x1cd28d[_0x8f5e('0x2e')]=_[_0x8f5e('0x2f')](_0x1cf0cd[_0x8f5e('0x2c')],qs[_0x8f5e('0x30')](_0x2627da[_0x8f5e('0x2d')]['fields']));_0x1cd28d[_0x8f5e('0x2e')]=_0x1cd28d[_0x8f5e('0x2e')][_0x8f5e('0x31')]?_0x1cd28d[_0x8f5e('0x2e')]:_0x1cf0cd[_0x8f5e('0x2c')];if(!_0x2627da[_0x8f5e('0x2d')]['hasOwnProperty']('nolimit')){_0x1cd28d[_0x8f5e('0x1a')]=qs[_0x8f5e('0x1a')](_0x2627da[_0x8f5e('0x2d')][_0x8f5e('0x1a')]);_0x1cd28d['offset']=qs[_0x8f5e('0x19')](_0x2627da['query']['offset']);}_0x1cd28d[_0x8f5e('0x32')]=qs[_0x8f5e('0x33')](_0x2627da[_0x8f5e('0x2d')]['sort']);_0x1cd28d[_0x8f5e('0x34')]=qs[_0x8f5e('0x35')](_[_0x8f5e('0x36')](_0x2627da[_0x8f5e('0x2d')],_0x1cf0cd[_0x8f5e('0x35')]),_0x1e7ac2);if(_0x2627da[_0x8f5e('0x2d')][_0x8f5e('0x37')]){_0x1cd28d[_0x8f5e('0x34')]=_[_0x8f5e('0x38')](_0x1cd28d['where'],{'$or':_[_0x8f5e('0x26')](_0x1e7ac2,function(_0x1e7ba4){if(_0x1e7ba4[_0x8f5e('0x2a')]!=='VIRTUAL'){var _0x5892f8={};_0x5892f8[_0x1e7ba4[_0x8f5e('0x24')]]={'$like':'%'+_0x2627da[_0x8f5e('0x2d')][_0x8f5e('0x37')]+'%'};return _0x5892f8;}})});}_0x1cd28d=_[_0x8f5e('0x38')]({},_0x1cd28d,_0x2627da[_0x8f5e('0x39')]);var _0x2f990a={'where':_0x1cd28d[_0x8f5e('0x34')]};return db['FreshsalesAccount'][_0x8f5e('0x1c')](_0x2f990a)[_0x8f5e('0x21')](function(_0x20b880){_0x8c322d[_0x8f5e('0x1c')]=_0x20b880;if(_0x2627da[_0x8f5e('0x2d')][_0x8f5e('0x3a')]){_0x1cd28d[_0x8f5e('0x3b')]=[{'all':!![]}];}return db[_0x8f5e('0x27')][_0x8f5e('0x3c')](_0x1cd28d);})[_0x8f5e('0x21')](function(_0x38b5cb){_0x8c322d[_0x8f5e('0x3d')]=_0x38b5cb;return _0x8c322d;})[_0x8f5e('0x21')](respondWithFilteredResult(_0x1fb4d2,_0x1cd28d))[_0x8f5e('0x3e')](handleError(_0x1fb4d2,null));};exports[_0x8f5e('0x3f')]=function(_0x106ad7,_0x110350){var _0x59054f={'raw':![],'where':{'id':_0x106ad7[_0x8f5e('0x40')]['id']}},_0x384bd0={};_0x384bd0[_0x8f5e('0x2c')]=_['keys'](db[_0x8f5e('0x27')][_0x8f5e('0x28')]);_0x384bd0[_0x8f5e('0x2d')]=_[_0x8f5e('0x41')](_0x106ad7[_0x8f5e('0x2d')]);_0x384bd0['filters']=_[_0x8f5e('0x2f')](_0x384bd0[_0x8f5e('0x2c')],_0x384bd0[_0x8f5e('0x2d')]);_0x59054f['attributes']=_[_0x8f5e('0x2f')](_0x384bd0['model'],qs[_0x8f5e('0x30')](_0x106ad7[_0x8f5e('0x2d')][_0x8f5e('0x30')]));_0x59054f['attributes']=_0x59054f[_0x8f5e('0x2e')][_0x8f5e('0x31')]?_0x59054f[_0x8f5e('0x2e')]:_0x384bd0[_0x8f5e('0x2c')];if(_0x106ad7[_0x8f5e('0x2d')][_0x8f5e('0x3a')]){_0x59054f['include']=[{'all':!![]}];}_0x59054f=_['merge']({},_0x59054f,_0x106ad7[_0x8f5e('0x39')]);return db[_0x8f5e('0x27')][_0x8f5e('0x42')](_0x59054f)[_0x8f5e('0x21')](handleEntityNotFound(_0x110350,null))[_0x8f5e('0x21')](respondWithResult(_0x110350,null))[_0x8f5e('0x3e')](handleError(_0x110350,null));};exports[_0x8f5e('0x43')]=function(_0x33784e,_0x4e17cb){return db[_0x8f5e('0x27')]['create'](_0x33784e['body'],{})[_0x8f5e('0x21')](respondWithResult(_0x4e17cb,0xc9))['catch'](handleError(_0x4e17cb,null));};exports[_0x8f5e('0x20')]=function(_0x1efc4c,_0x5e87bf){if(_0x1efc4c[_0x8f5e('0x44')]['id']){delete _0x1efc4c['body']['id'];}return db['FreshsalesAccount'][_0x8f5e('0x42')]({'where':{'id':_0x1efc4c['params']['id']}})[_0x8f5e('0x21')](handleEntityNotFound(_0x5e87bf,null))['then'](saveUpdates(_0x1efc4c['body'],null))[_0x8f5e('0x21')](respondWithResult(_0x5e87bf,null))[_0x8f5e('0x3e')](handleError(_0x5e87bf,null));};exports['destroy']=function(_0x3e2c4f,_0x35e87d){return db[_0x8f5e('0x27')][_0x8f5e('0x42')]({'where':{'id':_0x3e2c4f[_0x8f5e('0x40')]['id']}})[_0x8f5e('0x21')](handleEntityNotFound(_0x35e87d,null))[_0x8f5e('0x21')](removeEntity(_0x35e87d,null))[_0x8f5e('0x3e')](handleError(_0x35e87d,null));};exports[_0x8f5e('0x45')]=function(_0x47b462,_0xaa0bd4,_0x59dd61){var _0x3bd702={};var _0x44918f={};var _0x21706e;var _0x1293dd;return db[_0x8f5e('0x27')][_0x8f5e('0x46')]({'where':{'id':_0x47b462[_0x8f5e('0x40')]['id']}})[_0x8f5e('0x21')](handleEntityNotFound(_0xaa0bd4,null))[_0x8f5e('0x21')](function(_0x1fbe41){if(_0x1fbe41){_0x21706e=_0x1fbe41;_0x44918f[_0x8f5e('0x2c')]=_[_0x8f5e('0x41')](db[_0x8f5e('0x47')][_0x8f5e('0x28')]);_0x44918f[_0x8f5e('0x2d')]=_[_0x8f5e('0x41')](_0x47b462[_0x8f5e('0x2d')]);_0x44918f[_0x8f5e('0x35')]=_['intersection'](_0x44918f['model'],_0x44918f[_0x8f5e('0x2d')]);_0x3bd702[_0x8f5e('0x2e')]=_[_0x8f5e('0x2f')](_0x44918f[_0x8f5e('0x2c')],qs[_0x8f5e('0x30')](_0x47b462['query'][_0x8f5e('0x30')]));_0x3bd702[_0x8f5e('0x2e')]=_0x3bd702[_0x8f5e('0x2e')]['length']?_0x3bd702[_0x8f5e('0x2e')]:_0x44918f[_0x8f5e('0x2c')];_0x3bd702[_0x8f5e('0x32')]=qs['sort'](_0x47b462[_0x8f5e('0x2d')]['sort']);_0x3bd702[_0x8f5e('0x34')]=qs['filters'](_['pick'](_0x47b462[_0x8f5e('0x2d')],_0x44918f[_0x8f5e('0x35')]));if(_0x47b462[_0x8f5e('0x2d')]['filter']){_0x3bd702[_0x8f5e('0x34')]=_[_0x8f5e('0x38')](_0x3bd702['where'],{'$or':_['map'](_0x3bd702['attributes'],function(_0x1cb716){var _0x40c57d={};_0x40c57d[_0x1cb716]={'$like':'%'+_0x47b462[_0x8f5e('0x2d')][_0x8f5e('0x37')]+'%'};return _0x40c57d;})});}_0x3bd702=_[_0x8f5e('0x38')]({},_0x3bd702,_0x47b462[_0x8f5e('0x39')]);return _0x21706e[_0x8f5e('0x45')](_0x3bd702);}})[_0x8f5e('0x21')](function(_0x5c04c7){if(_0x5c04c7){_0x1293dd=_0x5c04c7['length'];if(!_0x47b462[_0x8f5e('0x2d')][_0x8f5e('0x48')](_0x8f5e('0x49'))){_0x3bd702['limit']=qs['limit'](_0x47b462[_0x8f5e('0x2d')][_0x8f5e('0x1a')]);_0x3bd702[_0x8f5e('0x19')]=qs[_0x8f5e('0x19')](_0x47b462[_0x8f5e('0x2d')][_0x8f5e('0x19')]);}return _0x21706e['getConfigurations'](_0x3bd702);}})[_0x8f5e('0x21')](function(_0x416bcd){if(_0x416bcd){return _0x416bcd?{'count':_0x1293dd,'rows':_0x416bcd}:null;}})[_0x8f5e('0x21')](respondWithResult(_0xaa0bd4,null))['catch'](handleError(_0xaa0bd4,null));};exports[_0x8f5e('0x4a')]=function(_0x579c13,_0xc98576,_0x21b52c){if(_0x579c13[_0x8f5e('0x44')]['id']){delete _0x579c13[_0x8f5e('0x44')]['id'];}return db[_0x8f5e('0x27')][_0x8f5e('0x46')]({'where':{'id':_0x579c13[_0x8f5e('0x40')]['id']}})['then'](handleEntityNotFound(_0xc98576,null))['then'](function(_0x28f2f7){if(_0x28f2f7){_0x579c13[_0x8f5e('0x44')]['AccountId']=_0x28f2f7['id'];_0x579c13['body']['Subjects']=integrations[_0x8f5e('0x4b')](_0x579c13['body'][_0x8f5e('0x4c')],_0x579c13[_0x8f5e('0x44')][_0x8f5e('0x2a')]);_0x579c13[_0x8f5e('0x44')][_0x8f5e('0x4d')]=integrations[_0x8f5e('0x4e')](_0x579c13['body'][_0x8f5e('0x4c')],_0x579c13[_0x8f5e('0x44')][_0x8f5e('0x2a')]);return db[_0x8f5e('0x47')][_0x8f5e('0x43')](_0x579c13[_0x8f5e('0x44')],{'include':[{'model':db[_0x8f5e('0x4f')],'as':_0x8f5e('0x50')},{'model':db[_0x8f5e('0x4f')],'as':_0x8f5e('0x4d')}]});}return null;})[_0x8f5e('0x21')](respondWithResult(_0xc98576,null))[_0x8f5e('0x3e')](handleError(_0xc98576,null));};exports[_0x8f5e('0x51')]=function(_0x186a8c,_0x558d3f,_0x38c9b0){var _0x287781='';var _0x5d6ad1='';return db['FreshsalesAccount'][_0x8f5e('0x46')]({'where':{'id':_0x186a8c[_0x8f5e('0x40')]['id']},'attributes':['id',_0x8f5e('0x52'),_0x8f5e('0x53'),_0x8f5e('0x54')]})[_0x8f5e('0x21')](handleEntityNotFound(_0x558d3f,null))[_0x8f5e('0x21')](function(_0x3e9ac1){if(_0x3e9ac1){_0x5d6ad1=_0x3e9ac1[_0x8f5e('0x52')];_0x287781=_0x3e9ac1[_0x8f5e('0x53')];var _0x130038=_0x3e9ac1[_0x8f5e('0x53')][_0x8f5e('0x55')](-0x1);if(_0x130038==='/'){_0x287781=_0x287781[_0x8f5e('0x56')](0x0,_0x287781[_0x8f5e('0x57')](_0x130038));}return rp({'method':_0x8f5e('0x58'),'uri':util[_0x8f5e('0x59')](_0x8f5e('0x5a'),_0x287781,_0x8f5e('0x5b')),'headers':{'Authorization':'Token\x20token='+_0x3e9ac1['apiKey']},'json':!![]});}})[_0x8f5e('0x21')](function(_0x4a0a6e){if(_0x4a0a6e){var _0x1526ee=_0x4a0a6e['users'];var _0x3b8e04=![];var _0x4a902d=null;for(_0x4a902d=0x0;_0x4a902d<_0x1526ee[_0x8f5e('0x31')];_0x4a902d++){if(_0x1526ee[_0x4a902d][_0x8f5e('0x5c')]===_0x5d6ad1){_0x3b8e04=!![];}}if(_0x3b8e04){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8f5e('0x21')](respondWithResult(_0x558d3f,null))[_0x8f5e('0x3e')](function(_0x58a774){var _0x280fe8=_0x186a8c[_0x8f5e('0x2d')]['test']?0x1f4:_0x58a774[_0x8f5e('0x5d')]||0x1f4;logger[_0x8f5e('0x23')](_0x8f5e('0x5e'),_0x8f5e('0x51'),_0x280fe8,JSON[_0x8f5e('0x5f')](_0x58a774));delete _0x58a774[_0x8f5e('0x24')];if(_0x280fe8===0x191){_0x280fe8=0x190;}_0x558d3f[_0x8f5e('0x16')](_0x280fe8)[_0x8f5e('0x60')](_0x186a8c[_0x8f5e('0x2d')]['test']?{'message':_0x8f5e('0x61'),'statusCode':_0x58a774['statusCode']}:_0x58a774);});}; \ No newline at end of file +var _0xe8d8=['../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','username','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','getFields','send','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xd580e2,_0x109182){var _0x4d955f=function(_0x568fff){while(--_0x568fff){_0xd580e2['push'](_0xd580e2['shift']());}};_0x4d955f(++_0x109182);}(_0xe8d8,0x124));var _0x8e8d=function(_0x164c3f,_0x4d85f5){_0x164c3f=_0x164c3f-0x0;var _0x33e35b=_0xe8d8[_0x164c3f];return _0x33e35b;};'use strict';var emlformat=require(_0x8e8d('0x0'));var rimraf=require(_0x8e8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e8d('0x2'));var rp=require(_0x8e8d('0x3'));var moment=require(_0x8e8d('0x4'));var BPromise=require(_0x8e8d('0x5'));var Mustache=require(_0x8e8d('0x6'));var util=require(_0x8e8d('0x7'));var path=require(_0x8e8d('0x8'));var sox=require('sox');var csv=require(_0x8e8d('0x9'));var ejs=require(_0x8e8d('0xa'));var fs=require('fs');var fs_extra=require(_0x8e8d('0xb'));var _=require(_0x8e8d('0xc'));var squel=require(_0x8e8d('0xd'));var crypto=require(_0x8e8d('0xe'));var jsforce=require(_0x8e8d('0xf'));var deskjs=require(_0x8e8d('0x10'));var toCsv=require(_0x8e8d('0x9'));var querystring=require('querystring');var Papa=require(_0x8e8d('0x11'));var Redis=require(_0x8e8d('0x12'));var authService=require(_0x8e8d('0x13'));var qs=require(_0x8e8d('0x14'));var as=require(_0x8e8d('0x15'));var hardwareService=require(_0x8e8d('0x16'));var logger=require(_0x8e8d('0x17'))(_0x8e8d('0x18'));var utils=require(_0x8e8d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8e8d('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8e8d('0x1b'));function respondWithStatusCode(_0xf080c8,_0x1f3b4c){_0x1f3b4c=_0x1f3b4c||0xcc;return function(_0x539f88){if(_0x539f88){return _0xf080c8[_0x8e8d('0x1c')](_0x1f3b4c);}return _0xf080c8[_0x8e8d('0x1d')](_0x1f3b4c)['end']();};}function respondWithResult(_0xdd9cc0,_0x17be9d){_0x17be9d=_0x17be9d||0xc8;return function(_0x33527e){if(_0x33527e){return _0xdd9cc0[_0x8e8d('0x1d')](_0x17be9d)[_0x8e8d('0x1e')](_0x33527e);}};}function respondWithFilteredResult(_0x30e1db,_0x66d6c){return function(_0x24229c){if(_0x24229c){var _0x88d9e0=typeof _0x66d6c[_0x8e8d('0x1f')]==='undefined'&&typeof _0x66d6c['limit']===_0x8e8d('0x20');var _0x5409bf=_0x24229c[_0x8e8d('0x21')];var _0x489d9e=_0x88d9e0?0x0:_0x66d6c[_0x8e8d('0x1f')];var _0xb424fa=_0x88d9e0?_0x24229c[_0x8e8d('0x21')]:_0x66d6c[_0x8e8d('0x1f')]+_0x66d6c['limit'];var _0x56bf76;if(_0xb424fa>=_0x5409bf){_0xb424fa=_0x5409bf;_0x56bf76=0xc8;}else{_0x56bf76=0xce;}_0x30e1db[_0x8e8d('0x1d')](_0x56bf76);return _0x30e1db[_0x8e8d('0x22')](_0x8e8d('0x23'),_0x489d9e+'-'+_0xb424fa+'/'+_0x5409bf)[_0x8e8d('0x1e')](_0x24229c);}return null;};}function patchUpdates(_0x22fe79){return function(_0x2604c3){try{jsonpatch[_0x8e8d('0x24')](_0x2604c3,_0x22fe79,!![]);}catch(_0x15327a){return BPromise[_0x8e8d('0x25')](_0x15327a);}return _0x2604c3[_0x8e8d('0x26')]();};}function saveUpdates(_0x140e11,_0x167a5e){return function(_0x427a9c){if(_0x427a9c){return _0x427a9c[_0x8e8d('0x27')](_0x140e11)[_0x8e8d('0x28')](function(_0x3bed38){return _0x3bed38;});}return null;};}function removeEntity(_0x3c6c06,_0x22672f){return function(_0x5bcfb0){if(_0x5bcfb0){return _0x5bcfb0['destroy']()['then'](function(){_0x3c6c06[_0x8e8d('0x1d')](0xcc)[_0x8e8d('0x29')]();});}};}function handleEntityNotFound(_0x1f64ce,_0x46b263){return function(_0x20ee67){if(!_0x20ee67){_0x1f64ce[_0x8e8d('0x1c')](0x194);}return _0x20ee67;};}function handleError(_0x870db9,_0x1a9000){_0x1a9000=_0x1a9000||0x1f4;return function(_0x48a0d4){logger[_0x8e8d('0x2a')](_0x48a0d4['stack']);if(_0x48a0d4[_0x8e8d('0x2b')]){delete _0x48a0d4[_0x8e8d('0x2b')];}_0x870db9[_0x8e8d('0x1d')](_0x1a9000)['send'](_0x48a0d4);};}exports[_0x8e8d('0x2c')]=function(_0xa34c5a,_0x310369){var _0xf4751e={},_0x5f4d98={},_0x5332fc={'count':0x0,'rows':[]};var _0x44a6db=_[_0x8e8d('0x2d')](db[_0x8e8d('0x2e')][_0x8e8d('0x2f')],function(_0x5eb57d){return{'name':_0x5eb57d[_0x8e8d('0x30')],'type':_0x5eb57d[_0x8e8d('0x31')][_0x8e8d('0x32')]};});_0x5f4d98[_0x8e8d('0x33')]=_[_0x8e8d('0x2d')](_0x44a6db,_0x8e8d('0x2b'));_0x5f4d98[_0x8e8d('0x34')]=_[_0x8e8d('0x35')](_0xa34c5a[_0x8e8d('0x34')]);_0x5f4d98[_0x8e8d('0x36')]=_['intersection'](_0x5f4d98[_0x8e8d('0x33')],_0x5f4d98[_0x8e8d('0x34')]);_0xf4751e[_0x8e8d('0x37')]=_['intersection'](_0x5f4d98[_0x8e8d('0x33')],qs[_0x8e8d('0x38')](_0xa34c5a[_0x8e8d('0x34')][_0x8e8d('0x38')]));_0xf4751e[_0x8e8d('0x37')]=_0xf4751e[_0x8e8d('0x37')][_0x8e8d('0x39')]?_0xf4751e[_0x8e8d('0x37')]:_0x5f4d98[_0x8e8d('0x33')];if(!_0xa34c5a[_0x8e8d('0x34')][_0x8e8d('0x3a')](_0x8e8d('0x3b'))){_0xf4751e[_0x8e8d('0x3c')]=qs[_0x8e8d('0x3c')](_0xa34c5a[_0x8e8d('0x34')][_0x8e8d('0x3c')]);_0xf4751e[_0x8e8d('0x1f')]=qs['offset'](_0xa34c5a['query'][_0x8e8d('0x1f')]);}_0xf4751e[_0x8e8d('0x3d')]=qs[_0x8e8d('0x3e')](_0xa34c5a[_0x8e8d('0x34')][_0x8e8d('0x3e')]);_0xf4751e['where']=qs[_0x8e8d('0x36')](_[_0x8e8d('0x3f')](_0xa34c5a[_0x8e8d('0x34')],_0x5f4d98[_0x8e8d('0x36')]),_0x44a6db);if(_0xa34c5a[_0x8e8d('0x34')]['filter']){_0xf4751e[_0x8e8d('0x40')]=_[_0x8e8d('0x41')](_0xf4751e[_0x8e8d('0x40')],{'$or':_['map'](_0x44a6db,function(_0x276fd3){if(_0x276fd3[_0x8e8d('0x31')]!==_0x8e8d('0x42')){var _0x35cb36={};_0x35cb36[_0x276fd3[_0x8e8d('0x2b')]]={'$like':'%'+_0xa34c5a[_0x8e8d('0x34')][_0x8e8d('0x43')]+'%'};return _0x35cb36;}})});}_0xf4751e=_['merge']({},_0xf4751e,_0xa34c5a[_0x8e8d('0x44')]);var _0x26a286={'where':_0xf4751e[_0x8e8d('0x40')]};return db[_0x8e8d('0x2e')]['count'](_0x26a286)[_0x8e8d('0x28')](function(_0x4cec57){_0x5332fc[_0x8e8d('0x21')]=_0x4cec57;if(_0xa34c5a[_0x8e8d('0x34')][_0x8e8d('0x45')]){_0xf4751e['include']=[{'all':!![]}];}return db[_0x8e8d('0x2e')]['findAll'](_0xf4751e);})[_0x8e8d('0x28')](function(_0x2624a0){_0x5332fc[_0x8e8d('0x46')]=_0x2624a0;return _0x5332fc;})[_0x8e8d('0x28')](respondWithFilteredResult(_0x310369,_0xf4751e))[_0x8e8d('0x47')](handleError(_0x310369,null));};exports[_0x8e8d('0x48')]=function(_0x21bf96,_0x3e237d){var _0x2c66cd={'raw':![],'where':{'id':_0x21bf96[_0x8e8d('0x49')]['id']}},_0x48de07={};_0x48de07['model']=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x48de07[_0x8e8d('0x34')]=_['keys'](_0x21bf96[_0x8e8d('0x34')]);_0x48de07[_0x8e8d('0x36')]=_[_0x8e8d('0x4a')](_0x48de07['model'],_0x48de07[_0x8e8d('0x34')]);_0x2c66cd['attributes']=_['intersection'](_0x48de07[_0x8e8d('0x33')],qs[_0x8e8d('0x38')](_0x21bf96[_0x8e8d('0x34')][_0x8e8d('0x38')]));_0x2c66cd[_0x8e8d('0x37')]=_0x2c66cd[_0x8e8d('0x37')]['length']?_0x2c66cd[_0x8e8d('0x37')]:_0x48de07[_0x8e8d('0x33')];if(_0x21bf96['query'][_0x8e8d('0x45')]){_0x2c66cd[_0x8e8d('0x4b')]=[{'all':!![]}];}_0x2c66cd=_[_0x8e8d('0x41')]({},_0x2c66cd,_0x21bf96['options']);return db[_0x8e8d('0x2e')][_0x8e8d('0x4c')](_0x2c66cd)['then'](handleEntityNotFound(_0x3e237d,null))[_0x8e8d('0x28')](respondWithResult(_0x3e237d,null))[_0x8e8d('0x47')](handleError(_0x3e237d,null));};exports[_0x8e8d('0x4d')]=function(_0x4f0463,_0x21e9b1){return db[_0x8e8d('0x2e')][_0x8e8d('0x4d')](_0x4f0463[_0x8e8d('0x4e')],{})[_0x8e8d('0x28')](respondWithResult(_0x21e9b1,0xc9))[_0x8e8d('0x47')](handleError(_0x21e9b1,null));};exports[_0x8e8d('0x27')]=function(_0x3b9f27,_0x7653fd){if(_0x3b9f27[_0x8e8d('0x4e')]['id']){delete _0x3b9f27[_0x8e8d('0x4e')]['id'];}return db[_0x8e8d('0x2e')]['find']({'where':{'id':_0x3b9f27[_0x8e8d('0x49')]['id']}})['then'](handleEntityNotFound(_0x7653fd,null))['then'](saveUpdates(_0x3b9f27[_0x8e8d('0x4e')],null))[_0x8e8d('0x28')](respondWithResult(_0x7653fd,null))['catch'](handleError(_0x7653fd,null));};exports[_0x8e8d('0x4f')]=function(_0x29b628,_0x507b57){return db['FreshsalesAccount']['find']({'where':{'id':_0x29b628[_0x8e8d('0x49')]['id']}})[_0x8e8d('0x28')](handleEntityNotFound(_0x507b57,null))[_0x8e8d('0x28')](removeEntity(_0x507b57,null))[_0x8e8d('0x47')](handleError(_0x507b57,null));};exports[_0x8e8d('0x50')]=function(_0x2e3e2f,_0x469f7a,_0x578533){var _0x9bc93d={};var _0x1ed60d={};var _0x424d9a;var _0x2aa9ce;return db[_0x8e8d('0x2e')][_0x8e8d('0x51')]({'where':{'id':_0x2e3e2f['params']['id']}})['then'](handleEntityNotFound(_0x469f7a,null))[_0x8e8d('0x28')](function(_0x3627db){if(_0x3627db){_0x424d9a=_0x3627db;_0x1ed60d[_0x8e8d('0x33')]=_[_0x8e8d('0x35')](db['FreshsalesConfiguration'][_0x8e8d('0x2f')]);_0x1ed60d[_0x8e8d('0x34')]=_[_0x8e8d('0x35')](_0x2e3e2f[_0x8e8d('0x34')]);_0x1ed60d[_0x8e8d('0x36')]=_[_0x8e8d('0x4a')](_0x1ed60d[_0x8e8d('0x33')],_0x1ed60d[_0x8e8d('0x34')]);_0x9bc93d['attributes']=_['intersection'](_0x1ed60d['model'],qs['fields'](_0x2e3e2f[_0x8e8d('0x34')][_0x8e8d('0x38')]));_0x9bc93d['attributes']=_0x9bc93d[_0x8e8d('0x37')][_0x8e8d('0x39')]?_0x9bc93d['attributes']:_0x1ed60d[_0x8e8d('0x33')];_0x9bc93d['order']=qs[_0x8e8d('0x3e')](_0x2e3e2f['query'][_0x8e8d('0x3e')]);_0x9bc93d[_0x8e8d('0x40')]=qs[_0x8e8d('0x36')](_[_0x8e8d('0x3f')](_0x2e3e2f[_0x8e8d('0x34')],_0x1ed60d[_0x8e8d('0x36')]));if(_0x2e3e2f[_0x8e8d('0x34')][_0x8e8d('0x43')]){_0x9bc93d[_0x8e8d('0x40')]=_[_0x8e8d('0x41')](_0x9bc93d[_0x8e8d('0x40')],{'$or':_[_0x8e8d('0x2d')](_0x9bc93d['attributes'],function(_0x5e60d9){var _0x548a19={};_0x548a19[_0x5e60d9]={'$like':'%'+_0x2e3e2f['query'][_0x8e8d('0x43')]+'%'};return _0x548a19;})});}_0x9bc93d=_[_0x8e8d('0x41')]({},_0x9bc93d,_0x2e3e2f[_0x8e8d('0x44')]);return _0x424d9a['getConfigurations'](_0x9bc93d);}})[_0x8e8d('0x28')](function(_0x4b41fc){if(_0x4b41fc){_0x2aa9ce=_0x4b41fc[_0x8e8d('0x39')];if(!_0x2e3e2f[_0x8e8d('0x34')][_0x8e8d('0x3a')](_0x8e8d('0x3b'))){_0x9bc93d[_0x8e8d('0x3c')]=qs[_0x8e8d('0x3c')](_0x2e3e2f[_0x8e8d('0x34')]['limit']);_0x9bc93d['offset']=qs[_0x8e8d('0x1f')](_0x2e3e2f[_0x8e8d('0x34')][_0x8e8d('0x1f')]);}return _0x424d9a[_0x8e8d('0x50')](_0x9bc93d);}})[_0x8e8d('0x28')](function(_0x261bec){if(_0x261bec){return _0x261bec?{'count':_0x2aa9ce,'rows':_0x261bec}:null;}})[_0x8e8d('0x28')](respondWithResult(_0x469f7a,null))['catch'](handleError(_0x469f7a,null));};exports[_0x8e8d('0x52')]=function(_0x5c7506,_0xcab4b2,_0x307319){if(_0x5c7506[_0x8e8d('0x4e')]['id']){delete _0x5c7506[_0x8e8d('0x4e')]['id'];}return db[_0x8e8d('0x2e')]['findOne']({'where':{'id':_0x5c7506[_0x8e8d('0x49')]['id']}})[_0x8e8d('0x28')](handleEntityNotFound(_0xcab4b2,null))[_0x8e8d('0x28')](function(_0x17887c){if(_0x17887c){_0x5c7506[_0x8e8d('0x4e')][_0x8e8d('0x53')]=_0x17887c['id'];_0x5c7506[_0x8e8d('0x4e')][_0x8e8d('0x54')]=integrations['getSubjects'](_0x5c7506[_0x8e8d('0x4e')]['channel'],_0x5c7506[_0x8e8d('0x4e')][_0x8e8d('0x31')]);_0x5c7506[_0x8e8d('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x5c7506[_0x8e8d('0x4e')][_0x8e8d('0x55')],_0x5c7506[_0x8e8d('0x4e')]['type']);return db[_0x8e8d('0x56')][_0x8e8d('0x4d')](_0x5c7506[_0x8e8d('0x4e')],{'include':[{'model':db[_0x8e8d('0x57')],'as':_0x8e8d('0x54')},{'model':db[_0x8e8d('0x57')],'as':_0x8e8d('0x58')}]});}return null;})['then'](respondWithResult(_0xcab4b2,null))[_0x8e8d('0x47')](handleError(_0xcab4b2,null));};exports['getFields']=function(_0x42c6be,_0x1cd680,_0x4ba439){var _0x565ce8='';var _0x5b3128='';return db[_0x8e8d('0x2e')][_0x8e8d('0x51')]({'where':{'id':_0x42c6be[_0x8e8d('0x49')]['id']},'attributes':['id',_0x8e8d('0x59'),'remoteUri','apiKey']})[_0x8e8d('0x28')](handleEntityNotFound(_0x1cd680,null))[_0x8e8d('0x28')](function(_0x45374f){if(_0x45374f){_0x5b3128=_0x45374f[_0x8e8d('0x59')];_0x565ce8=_0x45374f[_0x8e8d('0x5a')];var _0x5de870=_0x45374f[_0x8e8d('0x5a')][_0x8e8d('0x5b')](-0x1);if(_0x5de870==='/'){_0x565ce8=_0x565ce8[_0x8e8d('0x5c')](0x0,_0x565ce8[_0x8e8d('0x5d')](_0x5de870));}return rp({'method':_0x8e8d('0x5e'),'uri':util['format'](_0x8e8d('0x5f'),_0x565ce8,_0x8e8d('0x60')),'headers':{'Authorization':_0x8e8d('0x61')+_0x45374f[_0x8e8d('0x62')]},'json':!![]});}})[_0x8e8d('0x28')](function(_0x44109d){if(_0x44109d){var _0x3652a5=_0x44109d[_0x8e8d('0x63')];var _0x26b383=![];var _0x32db91=null;for(_0x32db91=0x0;_0x32db91<_0x3652a5[_0x8e8d('0x39')];_0x32db91++){if(_0x3652a5[_0x32db91][_0x8e8d('0x64')]===_0x5b3128){_0x26b383=!![];}}if(_0x26b383){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8e8d('0x65')});}}})[_0x8e8d('0x28')](respondWithResult(_0x1cd680,null))[_0x8e8d('0x47')](function(_0x47ed5f){var _0xd1322f=_0x42c6be[_0x8e8d('0x34')][_0x8e8d('0x66')]?0x1f4:_0x47ed5f['statusCode']||0x1f4;logger[_0x8e8d('0x2a')](_0x8e8d('0x67'),_0x8e8d('0x68'),_0xd1322f,JSON['stringify'](_0x47ed5f));delete _0x47ed5f[_0x8e8d('0x2b')];if(_0xd1322f===0x191){_0xd1322f=0x190;}_0x1cd680[_0x8e8d('0x1d')](_0xd1322f)[_0x8e8d('0x69')](_0x42c6be[_0x8e8d('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x47ed5f['statusCode']}:_0x47ed5f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 647b54c..5c39fe9 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 _0x5fdc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','lodash','util','../../config/logger','api'];(function(_0x3df967,_0x977148){var _0x101ae2=function(_0x2e33a9){while(--_0x2e33a9){_0x3df967['push'](_0x3df967['shift']());}};_0x101ae2(++_0x977148);}(_0x5fdc,0x127));var _0xc5fd=function(_0x5d6a53,_0x5dcad0){_0x5d6a53=_0x5d6a53-0x0;var _0x34f3dd=_0x5fdc[_0x5d6a53];return _0x34f3dd;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var logger=require(_0xc5fd('0x2'))(_0xc5fd('0x3'));var moment=require(_0xc5fd('0x4'));var BPromise=require(_0xc5fd('0x5'));var rp=require(_0xc5fd('0x6'));var fs=require('fs');var path=require(_0xc5fd('0x7'));var rimraf=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var attributes=require(_0xc5fd('0xa'));var integrations=require(_0xc5fd('0xb'));module[_0xc5fd('0xc')]=function(_0x216902,_0x15ffe7){return _0x216902['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x6455,0x97));var _0x5645=function(_0x5198e5,_0x1ffd89){_0x5198e5=_0x5198e5-0x0;var _0x482f9f=_0x6455[_0x5198e5];return _0x482f9f;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));var integrations=require(_0x5645('0x9'));module[_0x5645('0xa')]=function(_0x3a635d,_0x37d672){return _0x3a635d[_0x5645('0xb')](_0x5645('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 8e04963..5e2e6b3 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 _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include','map','model','ShowFreshsalesAccount','find','where'];(function(_0x13306f,_0x539894){var _0x19cf05=function(_0x3eb446){while(--_0x3eb446){_0x13306f['push'](_0x13306f['shift']());}};_0x19cf05(++_0x539894);}(_0xb44a,0x1c2));var _0xab44=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0xb44a[_0x4b2251];return _0x5d22fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['findAll']({'raw':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')]['where']||null:null,'attributes':_0x354b09[_0xab44('0x14')]?_0x354b09['options'][_0xab44('0x16')]||null:null,'limit':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x17')]||null:null,'include':_0x354b09['options']?_0x354b09[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x354b09[_0xab44('0x14')][_0xab44('0x18')],function(_0x402950){return{'model':db[_0x402950[_0xab44('0x1a')]],'as':_0x402950['as'],'attributes':_0x402950['attributes'],'include':_0x402950['include']?_[_0xab44('0x19')](_0x402950['include'],function(_0x2439f3){return{'model':db[_0x2439f3['model']],'as':_0x2439f3['as'],'attributes':_0x2439f3[_0xab44('0x16')],'include':_0x2439f3['include']?_['map'](_0x2439f3[_0xab44('0x18')],function(_0x25287b){return{'model':db[_0x25287b[_0xab44('0x1a')]],'as':_0x25287b['as'],'attributes':_0x25287b[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x4e820c){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger['debug'](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x4e820c));_0x310b15(_0x4e820c);})[_0xab44('0x11')](function(_0x1cd486){logger[_0xab44('0xd')](_0xab44('0x12'),_0x1cd486['message'],_0x354b09);_0xc4b3dc(_0x44fa43[_0xab44('0xd')](0x1f4,_0x1cd486[_0xab44('0xf')]));});});};exports[_0xab44('0x1b')]=function(_0x47e1be){var _0x54cac8=this;return new Promise(function(_0x106d3a,_0x5082e4){return db['FreshsalesAccount'][_0xab44('0x1c')]({'raw':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x1d')]||null:null,'attributes':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x16')]||null:null,'include':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x47e1be['options']['include'],function(_0x27e318){return{'model':db[_0x27e318[_0xab44('0x1a')]],'as':_0x27e318['as'],'attributes':_0x27e318['attributes'],'include':_0x27e318[_0xab44('0x18')]?_[_0xab44('0x19')](_0x27e318[_0xab44('0x18')],function(_0x1e0be7){return{'model':db[_0x1e0be7[_0xab44('0x1a')]],'as':_0x1e0be7['as'],'attributes':_0x1e0be7[_0xab44('0x16')],'include':_0x1e0be7[_0xab44('0x18')]?_[_0xab44('0x19')](_0x1e0be7[_0xab44('0x18')],function(_0xe26f9f){return{'model':db[_0xe26f9f[_0xab44('0x1a')]],'as':_0xe26f9f['as'],'attributes':_0xe26f9f[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x532aad){logger[_0xab44('0x10')](_0xab44('0x1b'),_0x47e1be);logger[_0xab44('0xb')](_0xab44('0x1b'),_0x47e1be,JSON['stringify'](_0x532aad));_0x106d3a(_0x532aad);})[_0xab44('0x11')](function(_0x31b599){logger[_0xab44('0xd')](_0xab44('0x1b'),_0x31b599['message'],_0x47e1be);_0x5082e4(_0x54cac8[_0xab44('0xd')](0x1f4,_0x31b599[_0xab44('0xf')]));});});}; \ No newline at end of file +var _0x7ee1=['attributes','limit','include','map','model','info','ShowFreshsalesAccount','find','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x7ee1,0x8d));var _0x17ee=function(_0x458702,_0x27282b){_0x458702=_0x458702-0x0;var _0x2e832b=_0x7ee1[_0x458702];return _0x2e832b;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});}exports[_0x17ee('0x13')]=function(_0x63d27f){var _0x587ca7=this;return new Promise(function(_0x44fe58,_0x1118a3){return db[_0x17ee('0x14')][_0x17ee('0x15')]({'raw':_0x63d27f[_0x17ee('0x16')]?_0x63d27f['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x63d27f['options']?_0x63d27f[_0x17ee('0x16')]['where']||null:null,'attributes':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'limit':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x19')]||null:null,'include':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x63d27f[_0x17ee('0x16')]['include'],function(_0x4b7bfe){return{'model':db[_0x4b7bfe[_0x17ee('0x1c')]],'as':_0x4b7bfe['as'],'attributes':_0x4b7bfe[_0x17ee('0x18')],'include':_0x4b7bfe[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x4b7bfe[_0x17ee('0x1a')],function(_0xea358f){return{'model':db[_0xea358f[_0x17ee('0x1c')]],'as':_0xea358f['as'],'attributes':_0xea358f[_0x17ee('0x18')],'include':_0xea358f[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0xea358f[_0x17ee('0x1a')],function(_0x2a332f){return{'model':db[_0x2a332f['model']],'as':_0x2a332f['as'],'attributes':_0x2a332f[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x11ce7e){logger[_0x17ee('0x1d')](_0x17ee('0x13'),_0x63d27f);logger['debug'](_0x17ee('0x13'),_0x63d27f,JSON[_0x17ee('0xd')](_0x11ce7e));_0x44fe58(_0x11ce7e);})[_0x17ee('0x12')](function(_0x4c461b){logger[_0x17ee('0xe')](_0x17ee('0x13'),_0x4c461b['message'],_0x63d27f);_0x1118a3(_0x587ca7[_0x17ee('0xe')](0x1f4,_0x4c461b['message']));});});};exports[_0x17ee('0x1e')]=function(_0x5a44c4){var _0x141ac9=this;return new Promise(function(_0x23ca2e,_0x373c20){return db['FreshsalesAccount'][_0x17ee('0x1f')]({'raw':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['where']||null:null,'attributes':_0x5a44c4['options']?_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'include':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['include']?_['map'](_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x1a')],function(_0x23578a){return{'model':db[_0x23578a[_0x17ee('0x1c')]],'as':_0x23578a['as'],'attributes':_0x23578a[_0x17ee('0x18')],'include':_0x23578a[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x23578a['include'],function(_0x4a6bc9){return{'model':db[_0x4a6bc9['model']],'as':_0x4a6bc9['as'],'attributes':_0x4a6bc9[_0x17ee('0x18')],'include':_0x4a6bc9['include']?_[_0x17ee('0x1b')](_0x4a6bc9[_0x17ee('0x1a')],function(_0xed7e8a){return{'model':db[_0xed7e8a['model']],'as':_0xed7e8a['as'],'attributes':_0xed7e8a[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x590d27){logger['info'](_0x17ee('0x1e'),_0x5a44c4);logger[_0x17ee('0x20')](_0x17ee('0x1e'),_0x5a44c4,JSON[_0x17ee('0xd')](_0x590d27));_0x23ca2e(_0x590d27);})[_0x17ee('0x12')](function(_0x5a2c08){logger['error'](_0x17ee('0x1e'),_0x5a2c08[_0x17ee('0x11')],_0x5a44c4);_0x373c20(_0x141ac9[_0x17ee('0xe')](0x1f4,_0x5a2c08[_0x17ee('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 266e51c..aa07f8b 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 _0xdb7d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','get','/:id','show','getSubjects','/:id/descriptions','/:id/fields','getFields','create','update','delete','multer','util','connect-timeout','express','Router'];(function(_0x2a9065,_0x5f022a){var _0x318c8f=function(_0x1a989c){while(--_0x1a989c){_0x2a9065['push'](_0x2a9065['shift']());}};_0x318c8f(++_0x5f022a);}(_0xdb7d,0xe2));var _0xddb7=function(_0x1c16c8,_0x134fe3){_0x1c16c8=_0x1c16c8-0x0;var _0x2e9719=_0xdb7d[_0x1c16c8];return _0x2e9719;};'use strict';var multer=require(_0xddb7('0x0'));var util=require(_0xddb7('0x1'));var path=require('path');var timeout=require(_0xddb7('0x2'));var express=require(_0xddb7('0x3'));var router=express[_0xddb7('0x4')]();var fs_extra=require(_0xddb7('0x5'));var auth=require(_0xddb7('0x6'));var interaction=require(_0xddb7('0x7'));var config=require(_0xddb7('0x8'));var controller=require(_0xddb7('0x9'));router['get']('/',auth[_0xddb7('0xa')](),controller['index']);router[_0xddb7('0xb')](_0xddb7('0xc'),auth[_0xddb7('0xa')](),controller[_0xddb7('0xd')]);router[_0xddb7('0xb')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xddb7('0xe')]);router['get'](_0xddb7('0xf'),auth[_0xddb7('0xa')](),controller['getDescriptions']);router[_0xddb7('0xb')](_0xddb7('0x10'),auth[_0xddb7('0xa')](),controller[_0xddb7('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xddb7('0x12')]);router['put'](_0xddb7('0xc'),auth['isAuthenticated'](),controller[_0xddb7('0x13')]);router[_0xddb7('0x14')](_0xddb7('0xc'),auth[_0xddb7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd632=['index','/:id','show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd632,0x75));var _0x2d63=function(_0x28c648,_0x2fe756){_0x28c648=_0x28c648-0x0;var _0x11e77e=_0xd632[_0x28c648];return _0x11e77e;};'use strict';var multer=require(_0x2d63('0x0'));var util=require(_0x2d63('0x1'));var path=require(_0x2d63('0x2'));var timeout=require(_0x2d63('0x3'));var express=require(_0x2d63('0x4'));var router=express[_0x2d63('0x5')]();var fs_extra=require(_0x2d63('0x6'));var auth=require(_0x2d63('0x7'));var interaction=require(_0x2d63('0x8'));var config=require(_0x2d63('0x9'));var controller=require(_0x2d63('0xa'));router[_0x2d63('0xb')]('/',auth[_0x2d63('0xc')](),controller[_0x2d63('0xd')]);router[_0x2d63('0xb')](_0x2d63('0xe'),auth[_0x2d63('0xc')](),controller[_0x2d63('0xf')]);router[_0x2d63('0xb')](_0x2d63('0x10'),auth[_0x2d63('0xc')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2d63('0x11')]);router[_0x2d63('0xb')](_0x2d63('0x12'),auth['isAuthenticated'](),controller[_0x2d63('0x13')]);router[_0x2d63('0x14')]('/',auth[_0x2d63('0xc')](),controller[_0x2d63('0x15')]);router[_0x2d63('0x16')]('/:id',auth[_0x2d63('0xc')](),controller[_0x2d63('0x17')]);router['delete']('/:id',auth[_0x2d63('0xc')](),controller[_0x2d63('0x18')]);module[_0x2d63('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7384f71..466fee0 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 _0xf5ca=['sequelize','exports','STRING'];(function(_0x59fe51,_0x18cc46){var _0x1de982=function(_0x5d4841){while(--_0x5d4841){_0x59fe51['push'](_0x59fe51['shift']());}};_0x1de982(++_0x18cc46);}(_0xf5ca,0xde));var _0xaf5c=function(_0x1d7966,_0x359208){_0x1d7966=_0x1d7966-0x0;var _0x27bbf7=_0xf5ca[_0x1d7966];return _0x27bbf7;};'use strict';var Sequelize=require(_0xaf5c('0x0'));module[_0xaf5c('0x1')]={'name':{'type':Sequelize[_0xaf5c('0x2')]},'description':{'type':Sequelize[_0xaf5c('0x2')]}}; \ No newline at end of file +var _0x00ea=['sequelize','exports','STRING'];(function(_0x23dd11,_0x101083){var _0x254dd1=function(_0x50af2d){while(--_0x50af2d){_0x23dd11['push'](_0x23dd11['shift']());}};_0x254dd1(++_0x101083);}(_0x00ea,0x1da));var _0xa00e=function(_0x28db0d,_0x4832dd){_0x28db0d=_0x28db0d-0x0;var _0x12ee14=_0x00ea[_0x28db0d];return _0x12ee14;};'use strict';var Sequelize=require(_0xa00e('0x0'));module[_0xa00e('0x1')]={'name':{'type':Sequelize[_0xa00e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7f9479f..a3dd847 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 _0xca96=['rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','getSubjects','findOne','nolimit','getDescriptions','FreshsalesField','getFields','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','apply','reject','save','then','error','name','map','FreshsalesConfiguration'];(function(_0x5981ee,_0x2abfa9){var _0x3dd4d2=function(_0x4d9a03){while(--_0x4d9a03){_0x5981ee['push'](_0x5981ee['shift']());}};_0x3dd4d2(++_0x2abfa9);}(_0xca96,0x10f));var _0x6ca9=function(_0x5a1298,_0x1a9399){_0x5a1298=_0x5a1298-0x0;var _0xc63b5b=_0xca96[_0x5a1298];return _0xc63b5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ca9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca9('0x1'));var rp=require(_0x6ca9('0x2'));var moment=require(_0x6ca9('0x3'));var BPromise=require(_0x6ca9('0x4'));var Mustache=require(_0x6ca9('0x5'));var util=require('util');var path=require(_0x6ca9('0x6'));var sox=require(_0x6ca9('0x7'));var csv=require('to-csv');var ejs=require(_0x6ca9('0x8'));var fs=require('fs');var fs_extra=require(_0x6ca9('0x9'));var _=require(_0x6ca9('0xa'));var squel=require(_0x6ca9('0xb'));var crypto=require(_0x6ca9('0xc'));var jsforce=require(_0x6ca9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6ca9('0xe'));var querystring=require(_0x6ca9('0xf'));var Papa=require('papaparse');var Redis=require(_0x6ca9('0x10'));var authService=require(_0x6ca9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6ca9('0x12'));var hardwareService=require(_0x6ca9('0x13'));var logger=require(_0x6ca9('0x14'))(_0x6ca9('0x15'));var utils=require(_0x6ca9('0x16'));var config=require(_0x6ca9('0x17'));var licenseUtil=require(_0x6ca9('0x18'));var db=require(_0x6ca9('0x19'))['db'];function respondWithStatusCode(_0x171e63,_0x13ec8a){_0x13ec8a=_0x13ec8a||0xcc;return function(_0x4b2f6f){if(_0x4b2f6f){return _0x171e63[_0x6ca9('0x1a')](_0x13ec8a);}return _0x171e63[_0x6ca9('0x1b')](_0x13ec8a)[_0x6ca9('0x1c')]();};}function respondWithResult(_0x5814e8,_0x23bddd){_0x23bddd=_0x23bddd||0xc8;return function(_0x54eed3){if(_0x54eed3){return _0x5814e8[_0x6ca9('0x1b')](_0x23bddd)[_0x6ca9('0x1d')](_0x54eed3);}};}function respondWithFilteredResult(_0x53b7c0,_0x40f77a){return function(_0x21e1a0){if(_0x21e1a0){var _0x5c701e=typeof _0x40f77a[_0x6ca9('0x1e')]===_0x6ca9('0x1f')&&typeof _0x40f77a['limit']===_0x6ca9('0x1f');var _0x3c3651=_0x21e1a0['count'];var _0x2736f4=_0x5c701e?0x0:_0x40f77a[_0x6ca9('0x1e')];var _0x51fc9d=_0x5c701e?_0x21e1a0['count']:_0x40f77a[_0x6ca9('0x1e')]+_0x40f77a['limit'];var _0x52e3a9;if(_0x51fc9d>=_0x3c3651){_0x51fc9d=_0x3c3651;_0x52e3a9=0xc8;}else{_0x52e3a9=0xce;}_0x53b7c0[_0x6ca9('0x1b')](_0x52e3a9);return _0x53b7c0[_0x6ca9('0x20')]('Content-Range',_0x2736f4+'-'+_0x51fc9d+'/'+_0x3c3651)[_0x6ca9('0x1d')](_0x21e1a0);}return null;};}function patchUpdates(_0x50938d){return function(_0x334551){try{jsonpatch[_0x6ca9('0x21')](_0x334551,_0x50938d,!![]);}catch(_0x41e089){return BPromise[_0x6ca9('0x22')](_0x41e089);}return _0x334551[_0x6ca9('0x23')]();};}function saveUpdates(_0x188fe4,_0x4ceea0){return function(_0x14c5eb){if(_0x14c5eb){return _0x14c5eb['update'](_0x188fe4)['then'](function(_0xce817a){return _0xce817a;});}return null;};}function removeEntity(_0x3f1fe0,_0x148a9a){return function(_0x41a0d8){if(_0x41a0d8){return _0x41a0d8['destroy']()[_0x6ca9('0x24')](function(){_0x3f1fe0[_0x6ca9('0x1b')](0xcc)[_0x6ca9('0x1c')]();});}};}function handleEntityNotFound(_0x54e698,_0x42684c){return function(_0xe754bd){if(!_0xe754bd){_0x54e698[_0x6ca9('0x1a')](0x194);}return _0xe754bd;};}function handleError(_0x19c8ca,_0x1b41e6){_0x1b41e6=_0x1b41e6||0x1f4;return function(_0x43baee){logger[_0x6ca9('0x25')](_0x43baee['stack']);if(_0x43baee['name']){delete _0x43baee[_0x6ca9('0x26')];}_0x19c8ca[_0x6ca9('0x1b')](_0x1b41e6)['send'](_0x43baee);};}exports['index']=function(_0x11441d,_0x3c09dd){var _0x1d2313={},_0x4c17a6={},_0x5e8964={'count':0x0,'rows':[]};var _0x111727=_[_0x6ca9('0x27')](db[_0x6ca9('0x28')][_0x6ca9('0x29')],function(_0x296334){return{'name':_0x296334['fieldName'],'type':_0x296334[_0x6ca9('0x2a')]['key']};});_0x4c17a6[_0x6ca9('0x2b')]=_[_0x6ca9('0x27')](_0x111727,_0x6ca9('0x26'));_0x4c17a6[_0x6ca9('0x2c')]=_[_0x6ca9('0x2d')](_0x11441d[_0x6ca9('0x2c')]);_0x4c17a6[_0x6ca9('0x2e')]=_[_0x6ca9('0x2f')](_0x4c17a6[_0x6ca9('0x2b')],_0x4c17a6[_0x6ca9('0x2c')]);_0x1d2313['attributes']=_[_0x6ca9('0x2f')](_0x4c17a6[_0x6ca9('0x2b')],qs[_0x6ca9('0x30')](_0x11441d[_0x6ca9('0x2c')][_0x6ca9('0x30')]));_0x1d2313['attributes']=_0x1d2313[_0x6ca9('0x31')][_0x6ca9('0x32')]?_0x1d2313[_0x6ca9('0x31')]:_0x4c17a6[_0x6ca9('0x2b')];if(!_0x11441d[_0x6ca9('0x2c')][_0x6ca9('0x33')]('nolimit')){_0x1d2313[_0x6ca9('0x34')]=qs[_0x6ca9('0x34')](_0x11441d['query'][_0x6ca9('0x34')]);_0x1d2313[_0x6ca9('0x1e')]=qs['offset'](_0x11441d['query'][_0x6ca9('0x1e')]);}_0x1d2313[_0x6ca9('0x35')]=qs[_0x6ca9('0x36')](_0x11441d['query'][_0x6ca9('0x36')]);_0x1d2313[_0x6ca9('0x37')]=qs[_0x6ca9('0x2e')](_[_0x6ca9('0x38')](_0x11441d[_0x6ca9('0x2c')],_0x4c17a6[_0x6ca9('0x2e')]),_0x111727);if(_0x11441d['query'][_0x6ca9('0x39')]){_0x1d2313['where']=_[_0x6ca9('0x3a')](_0x1d2313[_0x6ca9('0x37')],{'$or':_[_0x6ca9('0x27')](_0x111727,function(_0x38786a){if(_0x38786a[_0x6ca9('0x2a')]!==_0x6ca9('0x3b')){var _0x3599b2={};_0x3599b2[_0x38786a[_0x6ca9('0x26')]]={'$like':'%'+_0x11441d['query'][_0x6ca9('0x39')]+'%'};return _0x3599b2;}})});}_0x1d2313=_['merge']({},_0x1d2313,_0x11441d[_0x6ca9('0x3c')]);var _0x13435b={'where':_0x1d2313['where']};return db['FreshsalesConfiguration'][_0x6ca9('0x3d')](_0x13435b)['then'](function(_0x7a9904){_0x5e8964[_0x6ca9('0x3d')]=_0x7a9904;if(_0x11441d['query'][_0x6ca9('0x3e')]){_0x1d2313[_0x6ca9('0x3f')]=[{'all':!![]}];}return db[_0x6ca9('0x28')][_0x6ca9('0x40')](_0x1d2313);})[_0x6ca9('0x24')](function(_0x3ab6cc){_0x5e8964[_0x6ca9('0x41')]=_0x3ab6cc;return _0x5e8964;})[_0x6ca9('0x24')](respondWithFilteredResult(_0x3c09dd,_0x1d2313))[_0x6ca9('0x42')](handleError(_0x3c09dd,null));};exports['show']=function(_0x43d4e7,_0x30d022){var _0x516c3d={'raw':![],'where':{'id':_0x43d4e7[_0x6ca9('0x43')]['id']}},_0x48ecff={};_0x48ecff[_0x6ca9('0x2b')]=_['keys'](db[_0x6ca9('0x28')][_0x6ca9('0x29')]);_0x48ecff[_0x6ca9('0x2c')]=_[_0x6ca9('0x2d')](_0x43d4e7[_0x6ca9('0x2c')]);_0x48ecff[_0x6ca9('0x2e')]=_['intersection'](_0x48ecff['model'],_0x48ecff[_0x6ca9('0x2c')]);_0x516c3d[_0x6ca9('0x31')]=_[_0x6ca9('0x2f')](_0x48ecff[_0x6ca9('0x2b')],qs['fields'](_0x43d4e7['query'][_0x6ca9('0x30')]));_0x516c3d['attributes']=_0x516c3d[_0x6ca9('0x31')][_0x6ca9('0x32')]?_0x516c3d['attributes']:_0x48ecff['model'];if(_0x43d4e7[_0x6ca9('0x2c')][_0x6ca9('0x3e')]){_0x516c3d[_0x6ca9('0x3f')]=[{'all':!![]}];}_0x516c3d=_[_0x6ca9('0x3a')]({},_0x516c3d,_0x43d4e7['options']);return db[_0x6ca9('0x28')]['find'](_0x516c3d)[_0x6ca9('0x24')](handleEntityNotFound(_0x30d022,null))['then'](respondWithResult(_0x30d022,null))['catch'](handleError(_0x30d022,null));};exports[_0x6ca9('0x44')]=function(_0x3ca45e,_0x31722a){return db[_0x6ca9('0x28')][_0x6ca9('0x44')](_0x3ca45e['body'],{})[_0x6ca9('0x24')](respondWithResult(_0x31722a,0xc9))[_0x6ca9('0x42')](handleError(_0x31722a,null));};exports['update']=function(_0x53e32a,_0x9115f){if(_0x53e32a[_0x6ca9('0x45')]['id']){delete _0x53e32a[_0x6ca9('0x45')]['id'];}return db['FreshsalesConfiguration'][_0x6ca9('0x46')]({'where':{'id':_0x53e32a[_0x6ca9('0x43')]['id']}})['then'](handleEntityNotFound(_0x9115f,null))['then'](saveUpdates(_0x53e32a['body'],null))['then'](respondWithResult(_0x9115f,null))[_0x6ca9('0x42')](handleError(_0x9115f,null));};exports[_0x6ca9('0x47')]=function(_0x31992e,_0x3f32cb){return db[_0x6ca9('0x28')][_0x6ca9('0x46')]({'where':{'id':_0x31992e[_0x6ca9('0x43')]['id']}})[_0x6ca9('0x24')](handleEntityNotFound(_0x3f32cb,null))[_0x6ca9('0x24')](removeEntity(_0x3f32cb,null))[_0x6ca9('0x42')](handleError(_0x3f32cb,null));};exports[_0x6ca9('0x48')]=function(_0x2bf72a,_0x3d98e3,_0x1d339c){var _0x54916f={};var _0x3b0de7={};var _0x5df4b8;var _0x885a44;return db[_0x6ca9('0x28')][_0x6ca9('0x49')]({'where':{'id':_0x2bf72a['params']['id']}})[_0x6ca9('0x24')](handleEntityNotFound(_0x3d98e3,null))[_0x6ca9('0x24')](function(_0x4b924c){if(_0x4b924c){_0x5df4b8=_0x4b924c;_0x3b0de7[_0x6ca9('0x2b')]=_[_0x6ca9('0x2d')](db['FreshsalesField'][_0x6ca9('0x29')]);_0x3b0de7[_0x6ca9('0x2c')]=_[_0x6ca9('0x2d')](_0x2bf72a['query']);_0x3b0de7[_0x6ca9('0x2e')]=_[_0x6ca9('0x2f')](_0x3b0de7[_0x6ca9('0x2b')],_0x3b0de7[_0x6ca9('0x2c')]);_0x54916f[_0x6ca9('0x31')]=_[_0x6ca9('0x2f')](_0x3b0de7[_0x6ca9('0x2b')],qs[_0x6ca9('0x30')](_0x2bf72a[_0x6ca9('0x2c')][_0x6ca9('0x30')]));_0x54916f[_0x6ca9('0x31')]=_0x54916f['attributes']['length']?_0x54916f[_0x6ca9('0x31')]:_0x3b0de7['model'];_0x54916f[_0x6ca9('0x35')]=qs[_0x6ca9('0x36')](_0x2bf72a['query'][_0x6ca9('0x36')]);_0x54916f['where']=qs[_0x6ca9('0x2e')](_['pick'](_0x2bf72a['query'],_0x3b0de7[_0x6ca9('0x2e')]));if(_0x2bf72a[_0x6ca9('0x2c')][_0x6ca9('0x39')]){_0x54916f[_0x6ca9('0x37')]=_[_0x6ca9('0x3a')](_0x54916f[_0x6ca9('0x37')],{'$or':_[_0x6ca9('0x27')](_0x54916f[_0x6ca9('0x31')],function(_0x12e012){var _0x325f81={};_0x325f81[_0x12e012]={'$like':'%'+_0x2bf72a[_0x6ca9('0x2c')][_0x6ca9('0x39')]+'%'};return _0x325f81;})});}_0x54916f=_[_0x6ca9('0x3a')]({},_0x54916f,_0x2bf72a[_0x6ca9('0x3c')]);return _0x5df4b8[_0x6ca9('0x48')](_0x54916f);}})[_0x6ca9('0x24')](function(_0x564d42){if(_0x564d42){_0x885a44=_0x564d42[_0x6ca9('0x32')];if(!_0x2bf72a['query'][_0x6ca9('0x33')](_0x6ca9('0x4a'))){_0x54916f[_0x6ca9('0x34')]=qs[_0x6ca9('0x34')](_0x2bf72a[_0x6ca9('0x2c')][_0x6ca9('0x34')]);_0x54916f[_0x6ca9('0x1e')]=qs[_0x6ca9('0x1e')](_0x2bf72a[_0x6ca9('0x2c')][_0x6ca9('0x1e')]);}return _0x5df4b8[_0x6ca9('0x48')](_0x54916f);}})['then'](function(_0x1e3bfa){if(_0x1e3bfa){return _0x1e3bfa?{'count':_0x885a44,'rows':_0x1e3bfa}:null;}})['then'](respondWithResult(_0x3d98e3,null))[_0x6ca9('0x42')](handleError(_0x3d98e3,null));};exports[_0x6ca9('0x4b')]=function(_0x298316,_0x29e118,_0x14141e){var _0x2c10cc={};var _0x17d8fc={};var _0x846431;var _0x4a2f54;return db['FreshsalesConfiguration'][_0x6ca9('0x49')]({'where':{'id':_0x298316[_0x6ca9('0x43')]['id']}})[_0x6ca9('0x24')](handleEntityNotFound(_0x29e118,null))[_0x6ca9('0x24')](function(_0x2a1096){if(_0x2a1096){_0x846431=_0x2a1096;_0x17d8fc['model']=_['keys'](db[_0x6ca9('0x4c')][_0x6ca9('0x29')]);_0x17d8fc['query']=_['keys'](_0x298316[_0x6ca9('0x2c')]);_0x17d8fc[_0x6ca9('0x2e')]=_[_0x6ca9('0x2f')](_0x17d8fc[_0x6ca9('0x2b')],_0x17d8fc[_0x6ca9('0x2c')]);_0x2c10cc[_0x6ca9('0x31')]=_[_0x6ca9('0x2f')](_0x17d8fc['model'],qs[_0x6ca9('0x30')](_0x298316[_0x6ca9('0x2c')]['fields']));_0x2c10cc[_0x6ca9('0x31')]=_0x2c10cc[_0x6ca9('0x31')]['length']?_0x2c10cc[_0x6ca9('0x31')]:_0x17d8fc[_0x6ca9('0x2b')];_0x2c10cc[_0x6ca9('0x35')]=qs['sort'](_0x298316[_0x6ca9('0x2c')][_0x6ca9('0x36')]);_0x2c10cc[_0x6ca9('0x37')]=qs[_0x6ca9('0x2e')](_[_0x6ca9('0x38')](_0x298316[_0x6ca9('0x2c')],_0x17d8fc[_0x6ca9('0x2e')]));if(_0x298316[_0x6ca9('0x2c')][_0x6ca9('0x39')]){_0x2c10cc[_0x6ca9('0x37')]=_[_0x6ca9('0x3a')](_0x2c10cc[_0x6ca9('0x37')],{'$or':_[_0x6ca9('0x27')](_0x2c10cc[_0x6ca9('0x31')],function(_0x1ab331){var _0x102126={};_0x102126[_0x1ab331]={'$like':'%'+_0x298316[_0x6ca9('0x2c')][_0x6ca9('0x39')]+'%'};return _0x102126;})});}_0x2c10cc=_[_0x6ca9('0x3a')]({},_0x2c10cc,_0x298316[_0x6ca9('0x3c')]);return _0x846431['getDescriptions'](_0x2c10cc);}})[_0x6ca9('0x24')](function(_0x414a98){if(_0x414a98){_0x4a2f54=_0x414a98[_0x6ca9('0x32')];if(!_0x298316[_0x6ca9('0x2c')][_0x6ca9('0x33')]('nolimit')){_0x2c10cc['limit']=qs[_0x6ca9('0x34')](_0x298316[_0x6ca9('0x2c')]['limit']);_0x2c10cc[_0x6ca9('0x1e')]=qs[_0x6ca9('0x1e')](_0x298316[_0x6ca9('0x2c')][_0x6ca9('0x1e')]);}return _0x846431['getDescriptions'](_0x2c10cc);}})[_0x6ca9('0x24')](function(_0x2393ec){if(_0x2393ec){return _0x2393ec?{'count':_0x4a2f54,'rows':_0x2393ec}:null;}})[_0x6ca9('0x24')](respondWithResult(_0x29e118,null))[_0x6ca9('0x42')](handleError(_0x29e118,null));};exports[_0x6ca9('0x4d')]=function(_0x14172d,_0x31f51c,_0x216988){var _0x167ce3={};var _0x481d88={};var _0x2f91d0;var _0x57ca68;return db[_0x6ca9('0x28')][_0x6ca9('0x49')]({'where':{'id':_0x14172d[_0x6ca9('0x43')]['id']}})['then'](handleEntityNotFound(_0x31f51c,null))[_0x6ca9('0x24')](function(_0x46861f){if(_0x46861f){_0x2f91d0=_0x46861f;_0x481d88[_0x6ca9('0x2b')]=_[_0x6ca9('0x2d')](db[_0x6ca9('0x4c')][_0x6ca9('0x29')]);_0x481d88[_0x6ca9('0x2c')]=_[_0x6ca9('0x2d')](_0x14172d[_0x6ca9('0x2c')]);_0x481d88[_0x6ca9('0x2e')]=_['intersection'](_0x481d88[_0x6ca9('0x2b')],_0x481d88['query']);_0x167ce3['attributes']=_[_0x6ca9('0x2f')](_0x481d88['model'],qs[_0x6ca9('0x30')](_0x14172d['query']['fields']));_0x167ce3[_0x6ca9('0x31')]=_0x167ce3[_0x6ca9('0x31')][_0x6ca9('0x32')]?_0x167ce3[_0x6ca9('0x31')]:_0x481d88['model'];_0x167ce3[_0x6ca9('0x35')]=qs['sort'](_0x14172d['query'][_0x6ca9('0x36')]);_0x167ce3[_0x6ca9('0x37')]=qs[_0x6ca9('0x2e')](_[_0x6ca9('0x38')](_0x14172d[_0x6ca9('0x2c')],_0x481d88[_0x6ca9('0x2e')]));if(_0x14172d[_0x6ca9('0x2c')][_0x6ca9('0x39')]){_0x167ce3[_0x6ca9('0x37')]=_['merge'](_0x167ce3[_0x6ca9('0x37')],{'$or':_[_0x6ca9('0x27')](_0x167ce3[_0x6ca9('0x31')],function(_0x32f8e0){var _0x529c02={};_0x529c02[_0x32f8e0]={'$like':'%'+_0x14172d['query'][_0x6ca9('0x39')]+'%'};return _0x529c02;})});}_0x167ce3=_[_0x6ca9('0x3a')]({},_0x167ce3,_0x14172d[_0x6ca9('0x3c')]);return _0x2f91d0[_0x6ca9('0x4d')](_0x167ce3);}})['then'](function(_0x209cb4){if(_0x209cb4){_0x57ca68=_0x209cb4[_0x6ca9('0x32')];if(!_0x14172d['query'][_0x6ca9('0x33')](_0x6ca9('0x4a'))){_0x167ce3[_0x6ca9('0x34')]=qs[_0x6ca9('0x34')](_0x14172d[_0x6ca9('0x2c')][_0x6ca9('0x34')]);_0x167ce3[_0x6ca9('0x1e')]=qs[_0x6ca9('0x1e')](_0x14172d['query'][_0x6ca9('0x1e')]);}return _0x2f91d0[_0x6ca9('0x4d')](_0x167ce3);}})['then'](function(_0x5142ac){if(_0x5142ac){return _0x5142ac?{'count':_0x57ca68,'rows':_0x5142ac}:null;}})['then'](respondWithResult(_0x31f51c,null))[_0x6ca9('0x42')](handleError(_0x31f51c,null));}; \ No newline at end of file +var _0x2327=['to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','index','FreshsalesConfiguration','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','map','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2327,0x12d));var _0x7232=function(_0x21a8ba,_0x2b09e1){_0x21a8ba=_0x21a8ba-0x0;var _0x1da12a=_0x2327[_0x21a8ba];return _0x1da12a;};'use strict';var emlformat=require(_0x7232('0x0'));var rimraf=require(_0x7232('0x1'));var zipdir=require(_0x7232('0x2'));var jsonpatch=require(_0x7232('0x3'));var rp=require(_0x7232('0x4'));var moment=require(_0x7232('0x5'));var BPromise=require(_0x7232('0x6'));var Mustache=require(_0x7232('0x7'));var util=require(_0x7232('0x8'));var path=require(_0x7232('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7232('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7232('0xb'));var squel=require(_0x7232('0xc'));var crypto=require('crypto');var jsforce=require(_0x7232('0xd'));var deskjs=require(_0x7232('0xe'));var toCsv=require(_0x7232('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7232('0x10'));var authService=require(_0x7232('0x11'));var qs=require(_0x7232('0x12'));var as=require(_0x7232('0x13'));var hardwareService=require(_0x7232('0x14'));var logger=require('../../config/logger')(_0x7232('0x15'));var utils=require('../../config/utils');var config=require(_0x7232('0x16'));var licenseUtil=require(_0x7232('0x17'));var db=require(_0x7232('0x18'))['db'];function respondWithStatusCode(_0x800701,_0x35d35e){_0x35d35e=_0x35d35e||0xcc;return function(_0x5ebc60){if(_0x5ebc60){return _0x800701['sendStatus'](_0x35d35e);}return _0x800701[_0x7232('0x19')](_0x35d35e)[_0x7232('0x1a')]();};}function respondWithResult(_0x4cc6fb,_0x8b7bbb){_0x8b7bbb=_0x8b7bbb||0xc8;return function(_0x14eb42){if(_0x14eb42){return _0x4cc6fb[_0x7232('0x19')](_0x8b7bbb)[_0x7232('0x1b')](_0x14eb42);}};}function respondWithFilteredResult(_0x1511a9,_0x3a6a92){return function(_0x1f1eb3){if(_0x1f1eb3){var _0x35be4c=typeof _0x3a6a92['offset']===_0x7232('0x1c')&&typeof _0x3a6a92[_0x7232('0x1d')]===_0x7232('0x1c');var _0x540c65=_0x1f1eb3[_0x7232('0x1e')];var _0x49820b=_0x35be4c?0x0:_0x3a6a92[_0x7232('0x1f')];var _0x56c4ad=_0x35be4c?_0x1f1eb3['count']:_0x3a6a92[_0x7232('0x1f')]+_0x3a6a92['limit'];var _0x57ca49;if(_0x56c4ad>=_0x540c65){_0x56c4ad=_0x540c65;_0x57ca49=0xc8;}else{_0x57ca49=0xce;}_0x1511a9[_0x7232('0x19')](_0x57ca49);return _0x1511a9[_0x7232('0x20')](_0x7232('0x21'),_0x49820b+'-'+_0x56c4ad+'/'+_0x540c65)[_0x7232('0x1b')](_0x1f1eb3);}return null;};}function patchUpdates(_0x10207e){return function(_0x3386f0){try{jsonpatch[_0x7232('0x22')](_0x3386f0,_0x10207e,!![]);}catch(_0x1ce3c1){return BPromise['reject'](_0x1ce3c1);}return _0x3386f0[_0x7232('0x23')]();};}function saveUpdates(_0x180b59,_0x5dc5d9){return function(_0x20bc61){if(_0x20bc61){return _0x20bc61[_0x7232('0x24')](_0x180b59)[_0x7232('0x25')](function(_0x1d78e8){return _0x1d78e8;});}return null;};}function removeEntity(_0x30b7b6,_0x44a1e0){return function(_0x1f07e3){if(_0x1f07e3){return _0x1f07e3[_0x7232('0x26')]()[_0x7232('0x25')](function(){_0x30b7b6[_0x7232('0x19')](0xcc)[_0x7232('0x1a')]();});}};}function handleEntityNotFound(_0x2ce0b2,_0x3e4505){return function(_0x5a5b98){if(!_0x5a5b98){_0x2ce0b2[_0x7232('0x27')](0x194);}return _0x5a5b98;};}function handleError(_0x1714fa,_0x5c58ad){_0x5c58ad=_0x5c58ad||0x1f4;return function(_0x2d68eb){logger[_0x7232('0x28')](_0x2d68eb['stack']);if(_0x2d68eb[_0x7232('0x29')]){delete _0x2d68eb[_0x7232('0x29')];}_0x1714fa['status'](_0x5c58ad)['send'](_0x2d68eb);};}exports[_0x7232('0x2a')]=function(_0x43baa1,_0x16e379){var _0x197955={},_0x130df4={},_0x3b3026={'count':0x0,'rows':[]};var _0x2a3daf=_['map'](db[_0x7232('0x2b')]['rawAttributes'],function(_0x49a3c9){return{'name':_0x49a3c9['fieldName'],'type':_0x49a3c9[_0x7232('0x2c')][_0x7232('0x2d')]};});_0x130df4[_0x7232('0x2e')]=_['map'](_0x2a3daf,_0x7232('0x29'));_0x130df4[_0x7232('0x2f')]=_[_0x7232('0x30')](_0x43baa1[_0x7232('0x2f')]);_0x130df4[_0x7232('0x31')]=_[_0x7232('0x32')](_0x130df4[_0x7232('0x2e')],_0x130df4[_0x7232('0x2f')]);_0x197955['attributes']=_[_0x7232('0x32')](_0x130df4['model'],qs[_0x7232('0x33')](_0x43baa1[_0x7232('0x2f')]['fields']));_0x197955[_0x7232('0x34')]=_0x197955[_0x7232('0x34')][_0x7232('0x35')]?_0x197955['attributes']:_0x130df4['model'];if(!_0x43baa1[_0x7232('0x2f')]['hasOwnProperty']('nolimit')){_0x197955[_0x7232('0x1d')]=qs['limit'](_0x43baa1[_0x7232('0x2f')][_0x7232('0x1d')]);_0x197955[_0x7232('0x1f')]=qs[_0x7232('0x1f')](_0x43baa1[_0x7232('0x2f')][_0x7232('0x1f')]);}_0x197955[_0x7232('0x36')]=qs[_0x7232('0x37')](_0x43baa1[_0x7232('0x2f')][_0x7232('0x37')]);_0x197955['where']=qs[_0x7232('0x31')](_[_0x7232('0x38')](_0x43baa1[_0x7232('0x2f')],_0x130df4[_0x7232('0x31')]),_0x2a3daf);if(_0x43baa1[_0x7232('0x2f')][_0x7232('0x39')]){_0x197955[_0x7232('0x3a')]=_['merge'](_0x197955[_0x7232('0x3a')],{'$or':_[_0x7232('0x3b')](_0x2a3daf,function(_0x3d2238){if(_0x3d2238['type']!=='VIRTUAL'){var _0x96cf93={};_0x96cf93[_0x3d2238[_0x7232('0x29')]]={'$like':'%'+_0x43baa1[_0x7232('0x2f')][_0x7232('0x39')]+'%'};return _0x96cf93;}})});}_0x197955=_[_0x7232('0x3c')]({},_0x197955,_0x43baa1['options']);var _0x178de3={'where':_0x197955[_0x7232('0x3a')]};return db[_0x7232('0x2b')][_0x7232('0x1e')](_0x178de3)[_0x7232('0x25')](function(_0x4afffa){_0x3b3026[_0x7232('0x1e')]=_0x4afffa;if(_0x43baa1[_0x7232('0x2f')][_0x7232('0x3d')]){_0x197955[_0x7232('0x3e')]=[{'all':!![]}];}return db[_0x7232('0x2b')][_0x7232('0x3f')](_0x197955);})['then'](function(_0x1ad159){_0x3b3026['rows']=_0x1ad159;return _0x3b3026;})[_0x7232('0x25')](respondWithFilteredResult(_0x16e379,_0x197955))[_0x7232('0x40')](handleError(_0x16e379,null));};exports[_0x7232('0x41')]=function(_0x36919c,_0x243b5e){var _0x2eb941={'raw':![],'where':{'id':_0x36919c[_0x7232('0x42')]['id']}},_0x367a9f={};_0x367a9f[_0x7232('0x2e')]=_[_0x7232('0x30')](db[_0x7232('0x2b')][_0x7232('0x43')]);_0x367a9f[_0x7232('0x2f')]=_['keys'](_0x36919c[_0x7232('0x2f')]);_0x367a9f[_0x7232('0x31')]=_[_0x7232('0x32')](_0x367a9f['model'],_0x367a9f['query']);_0x2eb941['attributes']=_[_0x7232('0x32')](_0x367a9f[_0x7232('0x2e')],qs['fields'](_0x36919c[_0x7232('0x2f')][_0x7232('0x33')]));_0x2eb941['attributes']=_0x2eb941[_0x7232('0x34')]['length']?_0x2eb941[_0x7232('0x34')]:_0x367a9f[_0x7232('0x2e')];if(_0x36919c[_0x7232('0x2f')][_0x7232('0x3d')]){_0x2eb941[_0x7232('0x3e')]=[{'all':!![]}];}_0x2eb941=_[_0x7232('0x3c')]({},_0x2eb941,_0x36919c[_0x7232('0x44')]);return db[_0x7232('0x2b')][_0x7232('0x45')](_0x2eb941)[_0x7232('0x25')](handleEntityNotFound(_0x243b5e,null))['then'](respondWithResult(_0x243b5e,null))[_0x7232('0x40')](handleError(_0x243b5e,null));};exports[_0x7232('0x46')]=function(_0x2710e9,_0x1db2ae){return db[_0x7232('0x2b')][_0x7232('0x46')](_0x2710e9['body'],{})[_0x7232('0x25')](respondWithResult(_0x1db2ae,0xc9))[_0x7232('0x40')](handleError(_0x1db2ae,null));};exports['update']=function(_0x13e612,_0x4e3a2e){if(_0x13e612[_0x7232('0x47')]['id']){delete _0x13e612[_0x7232('0x47')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x13e612[_0x7232('0x42')]['id']}})[_0x7232('0x25')](handleEntityNotFound(_0x4e3a2e,null))['then'](saveUpdates(_0x13e612[_0x7232('0x47')],null))[_0x7232('0x25')](respondWithResult(_0x4e3a2e,null))['catch'](handleError(_0x4e3a2e,null));};exports[_0x7232('0x26')]=function(_0x40e17d,_0x43ee15){return db[_0x7232('0x2b')][_0x7232('0x45')]({'where':{'id':_0x40e17d[_0x7232('0x42')]['id']}})[_0x7232('0x25')](handleEntityNotFound(_0x43ee15,null))[_0x7232('0x25')](removeEntity(_0x43ee15,null))[_0x7232('0x40')](handleError(_0x43ee15,null));};exports[_0x7232('0x48')]=function(_0x1c3f15,_0x53c52e,_0x54f688){var _0x4a2e96={};var _0x48e64b={};var _0x10c464;var _0x4b2220;return db[_0x7232('0x2b')][_0x7232('0x49')]({'where':{'id':_0x1c3f15[_0x7232('0x42')]['id']}})[_0x7232('0x25')](handleEntityNotFound(_0x53c52e,null))[_0x7232('0x25')](function(_0x3ad721){if(_0x3ad721){_0x10c464=_0x3ad721;_0x48e64b['model']=_[_0x7232('0x30')](db[_0x7232('0x4a')]['rawAttributes']);_0x48e64b[_0x7232('0x2f')]=_[_0x7232('0x30')](_0x1c3f15[_0x7232('0x2f')]);_0x48e64b['filters']=_[_0x7232('0x32')](_0x48e64b[_0x7232('0x2e')],_0x48e64b[_0x7232('0x2f')]);_0x4a2e96[_0x7232('0x34')]=_[_0x7232('0x32')](_0x48e64b[_0x7232('0x2e')],qs[_0x7232('0x33')](_0x1c3f15[_0x7232('0x2f')][_0x7232('0x33')]));_0x4a2e96[_0x7232('0x34')]=_0x4a2e96[_0x7232('0x34')][_0x7232('0x35')]?_0x4a2e96['attributes']:_0x48e64b[_0x7232('0x2e')];_0x4a2e96[_0x7232('0x36')]=qs[_0x7232('0x37')](_0x1c3f15['query'][_0x7232('0x37')]);_0x4a2e96[_0x7232('0x3a')]=qs['filters'](_['pick'](_0x1c3f15[_0x7232('0x2f')],_0x48e64b[_0x7232('0x31')]));if(_0x1c3f15['query'][_0x7232('0x39')]){_0x4a2e96[_0x7232('0x3a')]=_[_0x7232('0x3c')](_0x4a2e96[_0x7232('0x3a')],{'$or':_['map'](_0x4a2e96[_0x7232('0x34')],function(_0x318240){var _0x1f4849={};_0x1f4849[_0x318240]={'$like':'%'+_0x1c3f15[_0x7232('0x2f')][_0x7232('0x39')]+'%'};return _0x1f4849;})});}_0x4a2e96=_[_0x7232('0x3c')]({},_0x4a2e96,_0x1c3f15[_0x7232('0x44')]);return _0x10c464['getSubjects'](_0x4a2e96);}})[_0x7232('0x25')](function(_0x30fafe){if(_0x30fafe){_0x4b2220=_0x30fafe[_0x7232('0x35')];if(!_0x1c3f15[_0x7232('0x2f')][_0x7232('0x4b')](_0x7232('0x4c'))){_0x4a2e96['limit']=qs['limit'](_0x1c3f15[_0x7232('0x2f')][_0x7232('0x1d')]);_0x4a2e96[_0x7232('0x1f')]=qs['offset'](_0x1c3f15[_0x7232('0x2f')][_0x7232('0x1f')]);}return _0x10c464['getSubjects'](_0x4a2e96);}})[_0x7232('0x25')](function(_0x21293f){if(_0x21293f){return _0x21293f?{'count':_0x4b2220,'rows':_0x21293f}:null;}})[_0x7232('0x25')](respondWithResult(_0x53c52e,null))[_0x7232('0x40')](handleError(_0x53c52e,null));};exports['getDescriptions']=function(_0x3e5bd0,_0x4ba74d,_0x24cda0){var _0xd6835f={};var _0x377277={};var _0x39c057;var _0x114230;return db[_0x7232('0x2b')][_0x7232('0x49')]({'where':{'id':_0x3e5bd0[_0x7232('0x42')]['id']}})[_0x7232('0x25')](handleEntityNotFound(_0x4ba74d,null))[_0x7232('0x25')](function(_0x560661){if(_0x560661){_0x39c057=_0x560661;_0x377277[_0x7232('0x2e')]=_['keys'](db['FreshsalesField'][_0x7232('0x43')]);_0x377277[_0x7232('0x2f')]=_[_0x7232('0x30')](_0x3e5bd0[_0x7232('0x2f')]);_0x377277[_0x7232('0x31')]=_[_0x7232('0x32')](_0x377277[_0x7232('0x2e')],_0x377277[_0x7232('0x2f')]);_0xd6835f[_0x7232('0x34')]=_['intersection'](_0x377277[_0x7232('0x2e')],qs[_0x7232('0x33')](_0x3e5bd0['query'][_0x7232('0x33')]));_0xd6835f['attributes']=_0xd6835f[_0x7232('0x34')]['length']?_0xd6835f[_0x7232('0x34')]:_0x377277[_0x7232('0x2e')];_0xd6835f[_0x7232('0x36')]=qs[_0x7232('0x37')](_0x3e5bd0[_0x7232('0x2f')][_0x7232('0x37')]);_0xd6835f[_0x7232('0x3a')]=qs[_0x7232('0x31')](_[_0x7232('0x38')](_0x3e5bd0[_0x7232('0x2f')],_0x377277[_0x7232('0x31')]));if(_0x3e5bd0['query'][_0x7232('0x39')]){_0xd6835f['where']=_['merge'](_0xd6835f[_0x7232('0x3a')],{'$or':_['map'](_0xd6835f[_0x7232('0x34')],function(_0x1e3d9d){var _0x3032b4={};_0x3032b4[_0x1e3d9d]={'$like':'%'+_0x3e5bd0[_0x7232('0x2f')][_0x7232('0x39')]+'%'};return _0x3032b4;})});}_0xd6835f=_[_0x7232('0x3c')]({},_0xd6835f,_0x3e5bd0[_0x7232('0x44')]);return _0x39c057[_0x7232('0x4d')](_0xd6835f);}})[_0x7232('0x25')](function(_0x435a1d){if(_0x435a1d){_0x114230=_0x435a1d[_0x7232('0x35')];if(!_0x3e5bd0[_0x7232('0x2f')][_0x7232('0x4b')](_0x7232('0x4c'))){_0xd6835f['limit']=qs[_0x7232('0x1d')](_0x3e5bd0['query'][_0x7232('0x1d')]);_0xd6835f[_0x7232('0x1f')]=qs[_0x7232('0x1f')](_0x3e5bd0['query']['offset']);}return _0x39c057[_0x7232('0x4d')](_0xd6835f);}})['then'](function(_0x203584){if(_0x203584){return _0x203584?{'count':_0x114230,'rows':_0x203584}:null;}})[_0x7232('0x25')](respondWithResult(_0x4ba74d,null))[_0x7232('0x40')](handleError(_0x4ba74d,null));};exports[_0x7232('0x4e')]=function(_0x44424a,_0x291831,_0x5663e7){var _0x492a9c={};var _0x3f087a={};var _0x17f841;var _0x37e954;return db[_0x7232('0x2b')]['findOne']({'where':{'id':_0x44424a['params']['id']}})[_0x7232('0x25')](handleEntityNotFound(_0x291831,null))['then'](function(_0x5158b0){if(_0x5158b0){_0x17f841=_0x5158b0;_0x3f087a[_0x7232('0x2e')]=_[_0x7232('0x30')](db[_0x7232('0x4a')][_0x7232('0x43')]);_0x3f087a[_0x7232('0x2f')]=_[_0x7232('0x30')](_0x44424a['query']);_0x3f087a['filters']=_[_0x7232('0x32')](_0x3f087a[_0x7232('0x2e')],_0x3f087a[_0x7232('0x2f')]);_0x492a9c[_0x7232('0x34')]=_['intersection'](_0x3f087a['model'],qs['fields'](_0x44424a[_0x7232('0x2f')]['fields']));_0x492a9c[_0x7232('0x34')]=_0x492a9c['attributes'][_0x7232('0x35')]?_0x492a9c['attributes']:_0x3f087a['model'];_0x492a9c['order']=qs['sort'](_0x44424a[_0x7232('0x2f')][_0x7232('0x37')]);_0x492a9c[_0x7232('0x3a')]=qs[_0x7232('0x31')](_[_0x7232('0x38')](_0x44424a['query'],_0x3f087a[_0x7232('0x31')]));if(_0x44424a[_0x7232('0x2f')][_0x7232('0x39')]){_0x492a9c[_0x7232('0x3a')]=_['merge'](_0x492a9c[_0x7232('0x3a')],{'$or':_[_0x7232('0x3b')](_0x492a9c['attributes'],function(_0xda7038){var _0x343942={};_0x343942[_0xda7038]={'$like':'%'+_0x44424a[_0x7232('0x2f')][_0x7232('0x39')]+'%'};return _0x343942;})});}_0x492a9c=_['merge']({},_0x492a9c,_0x44424a['options']);return _0x17f841[_0x7232('0x4e')](_0x492a9c);}})['then'](function(_0x3a4e7f){if(_0x3a4e7f){_0x37e954=_0x3a4e7f[_0x7232('0x35')];if(!_0x44424a[_0x7232('0x2f')][_0x7232('0x4b')](_0x7232('0x4c'))){_0x492a9c['limit']=qs[_0x7232('0x1d')](_0x44424a[_0x7232('0x2f')][_0x7232('0x1d')]);_0x492a9c['offset']=qs[_0x7232('0x1f')](_0x44424a[_0x7232('0x2f')][_0x7232('0x1f')]);}return _0x17f841[_0x7232('0x4e')](_0x492a9c);}})[_0x7232('0x25')](function(_0x443109){if(_0x443109){return _0x443109?{'count':_0x37e954,'rows':_0x443109}:null;}})[_0x7232('0x25')](respondWithResult(_0x291831,null))[_0x7232('0x40')](handleError(_0x291831,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d303afc..1d1e348 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 _0x8045=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api'];(function(_0x5d38a7,_0x245127){var _0x968e05=function(_0x2db38a){while(--_0x2db38a){_0x5d38a7['push'](_0x5d38a7['shift']());}};_0x968e05(++_0x245127);}(_0x8045,0x19d));var _0x5804=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x8045[_0x36d703];return _0x12c909;};'use strict';var _=require('lodash');var util=require(_0x5804('0x0'));var logger=require(_0x5804('0x1'))(_0x5804('0x2'));var moment=require(_0x5804('0x3'));var BPromise=require(_0x5804('0x4'));var rp=require(_0x5804('0x5'));var fs=require('fs');var path=require(_0x5804('0x6'));var rimraf=require(_0x5804('0x7'));var config=require(_0x5804('0x8'));var attributes=require(_0x5804('0x9'));module[_0x5804('0xa')]=function(_0x324fa2,_0x3299a8){return _0x324fa2['define'](_0x5804('0xb'),attributes,{'tableName':_0x5804('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa105=['rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1e5db8,_0x44ef41){var _0x219a51=function(_0x5b86a3){while(--_0x5b86a3){_0x1e5db8['push'](_0x1e5db8['shift']());}};_0x219a51(++_0x44ef41);}(_0xa105,0x7a));var _0x5a10=function(_0x41ed54,_0x1ec5c0){_0x41ed54=_0x41ed54-0x0;var _0x309d81=_0xa105[_0x41ed54];return _0x309d81;};'use strict';var _=require(_0x5a10('0x0'));var util=require(_0x5a10('0x1'));var logger=require(_0x5a10('0x2'))(_0x5a10('0x3'));var moment=require(_0x5a10('0x4'));var BPromise=require(_0x5a10('0x5'));var rp=require(_0x5a10('0x6'));var fs=require('fs');var path=require(_0x5a10('0x7'));var rimraf=require(_0x5a10('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a10('0x9'));module[_0x5a10('0xa')]=function(_0x25288e,_0x4ad196){return _0x25288e[_0x5a10('0xb')]('FreshsalesConfiguration',attributes,{'tableName':_0x5a10('0xc'),'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 04fd06a..e25dc63 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 _0x329a=['error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x43a073,_0x1bb91d){var _0x2e9407=function(_0x2976e9){while(--_0x2976e9){_0x43a073['push'](_0x43a073['shift']());}};_0x2e9407(++_0x1bb91d);}(_0x329a,0x15f));var _0xa329=function(_0x2cd8ed,_0x33840c){_0x2cd8ed=_0x2cd8ed-0x0;var _0x1a3be7=_0x329a[_0x2cd8ed];return _0x1a3be7;};'use strict';var _=require('lodash');var util=require(_0xa329('0x0'));var moment=require(_0xa329('0x1'));var BPromise=require(_0xa329('0x2'));var rs=require(_0xa329('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa329('0x4'))['db'];var utils=require(_0xa329('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa329('0x6'));var jayson=require(_0xa329('0x7'));var client=jayson[_0xa329('0x8')][_0xa329('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33c41d,_0x5e61a1,_0x49cd20){return new BPromise(function(_0x4e2ab7,_0x22da7a){return client[_0xa329('0xa')](_0x33c41d,_0x49cd20)[_0xa329('0xb')](function(_0x59cd99){logger['info'](_0xa329('0xc'),_0x5e61a1,_0xa329('0xd'));logger[_0xa329('0xe')](_0xa329('0xf'),_0x5e61a1,_0xa329('0xd'),JSON[_0xa329('0x10')](_0x59cd99));if(_0x59cd99['error']){if(_0x59cd99[_0xa329('0x11')][_0xa329('0x12')]===0x1f4){logger[_0xa329('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5e61a1,_0x59cd99['error']['message']);return _0x22da7a(_0x59cd99[_0xa329('0x11')][_0xa329('0x13')]);}logger[_0xa329('0x11')](_0xa329('0xc'),_0x5e61a1,_0x59cd99[_0xa329('0x11')][_0xa329('0x13')]);return _0x4e2ab7(_0x59cd99[_0xa329('0x11')][_0xa329('0x13')]);}else{logger[_0xa329('0x14')](_0xa329('0xc'),_0x5e61a1,_0xa329('0xd'));_0x4e2ab7(_0x59cd99[_0xa329('0x15')][_0xa329('0x13')]);}})[_0xa329('0x16')](function(_0x156715){logger['error'](_0xa329('0xc'),_0x5e61a1,_0x156715);_0x22da7a(_0x156715);});});} \ No newline at end of file +var _0xfc18=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird'];(function(_0xf4a4b,_0xe7b478){var _0x435a59=function(_0x306464){while(--_0x306464){_0xf4a4b['push'](_0xf4a4b['shift']());}};_0x435a59(++_0xe7b478);}(_0xfc18,0x17e));var _0x8fc1=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0xfc18[_0xe15270];return _0x1e813b;};'use strict';var _=require(_0x8fc1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8fc1('0x1'));var rs=require(_0x8fc1('0x2'));var fs=require('fs');var Redis=require(_0x8fc1('0x3'));var db=require(_0x8fc1('0x4'))['db'];var utils=require(_0x8fc1('0x5'));var logger=require(_0x8fc1('0x6'))(_0x8fc1('0x7'));var config=require(_0x8fc1('0x8'));var jayson=require(_0x8fc1('0x9'));var client=jayson[_0x8fc1('0xa')][_0x8fc1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x184b24,_0x328674,_0x145c23){return new BPromise(function(_0x3cbd00,_0x49c250){return client[_0x8fc1('0xc')](_0x184b24,_0x145c23)[_0x8fc1('0xd')](function(_0x4a08b0){logger[_0x8fc1('0xe')](_0x8fc1('0xf'),_0x328674,_0x8fc1('0x10'));logger[_0x8fc1('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x328674,_0x8fc1('0x10'),JSON[_0x8fc1('0x12')](_0x4a08b0));if(_0x4a08b0[_0x8fc1('0x13')]){if(_0x4a08b0[_0x8fc1('0x13')][_0x8fc1('0x14')]===0x1f4){logger[_0x8fc1('0x13')](_0x8fc1('0xf'),_0x328674,_0x4a08b0[_0x8fc1('0x13')][_0x8fc1('0x15')]);return _0x49c250(_0x4a08b0['error']['message']);}logger['error'](_0x8fc1('0xf'),_0x328674,_0x4a08b0[_0x8fc1('0x13')][_0x8fc1('0x15')]);return _0x3cbd00(_0x4a08b0[_0x8fc1('0x13')][_0x8fc1('0x15')]);}else{logger[_0x8fc1('0xe')](_0x8fc1('0xf'),_0x328674,_0x8fc1('0x10'));_0x3cbd00(_0x4a08b0[_0x8fc1('0x16')]['message']);}})[_0x8fc1('0x17')](function(_0x9c01e8){logger[_0x8fc1('0x13')](_0x8fc1('0xf'),_0x328674,_0x9c01e8);_0x49c250(_0x9c01e8);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 83b4cf5..d8ea0c0 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 _0xa74d=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0xbf81e,_0x23742b){var _0x4c6fea=function(_0x56b0fc){while(--_0x56b0fc){_0xbf81e['push'](_0xbf81e['shift']());}};_0x4c6fea(++_0x23742b);}(_0xa74d,0x1cf));var _0xda74=function(_0x2b360d,_0x28b204){_0x2b360d=_0x2b360d-0x0;var _0x5f4ce8=_0xa74d[_0x2b360d];return _0x5f4ce8;};'use strict';var multer=require('multer');var util=require(_0xda74('0x0'));var path=require(_0xda74('0x1'));var timeout=require(_0xda74('0x2'));var express=require(_0xda74('0x3'));var router=express[_0xda74('0x4')]();var fs_extra=require(_0xda74('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xda74('0x6'));var config=require(_0xda74('0x7'));var controller=require(_0xda74('0x8'));router[_0xda74('0x9')]('/',auth[_0xda74('0xa')](),controller[_0xda74('0xb')]);router[_0xda74('0x9')](_0xda74('0xc'),auth['isAuthenticated'](),controller[_0xda74('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xda74('0xe')]);router[_0xda74('0xf')]('/:id',auth[_0xda74('0xa')](),controller[_0xda74('0x10')]);router[_0xda74('0x11')](_0xda74('0xc'),auth[_0xda74('0xa')](),controller[_0xda74('0x12')]);module[_0xda74('0x13')]=router; \ No newline at end of file +var _0xb43b=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id'];(function(_0xbd375d,_0xf6ffe4){var _0x2b3542=function(_0x4a6c24){while(--_0x4a6c24){_0xbd375d['push'](_0xbd375d['shift']());}};_0x2b3542(++_0xf6ffe4);}(_0xb43b,0xbf));var _0xbb43=function(_0x2fb1d8,_0x59f3d5){_0x2fb1d8=_0x2fb1d8-0x0;var _0x445c3d=_0xb43b[_0x2fb1d8];return _0x445c3d;};'use strict';var multer=require(_0xbb43('0x0'));var util=require('util');var path=require(_0xbb43('0x1'));var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require(_0xbb43('0x5'));var auth=require(_0xbb43('0x6'));var interaction=require(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var controller=require(_0xbb43('0x9'));router[_0xbb43('0xa')]('/',auth[_0xbb43('0xb')](),controller['index']);router[_0xbb43('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')]('/',auth[_0xbb43('0xb')](),controller[_0xbb43('0xe')]);router[_0xbb43('0xf')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')](_0xbb43('0x12'),auth['isAuthenticated'](),controller[_0xbb43('0x13')]);module[_0xbb43('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 27c9d86..5358cb6 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 _0x75ae=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x4e0a3f,_0x3f28db){var _0x59d9ce=function(_0x46a1b3){while(--_0x46a1b3){_0x4e0a3f['push'](_0x4e0a3f['shift']());}};_0x59d9ce(++_0x3f28db);}(_0x75ae,0x19b));var _0xe75a=function(_0x9a87b3,_0x42751c){_0x9a87b3=_0x9a87b3-0x0;var _0x53731f=_0x75ae[_0x9a87b3];return _0x53731f;};'use strict';var Sequelize=require(_0xe75a('0x0'));module[_0xe75a('0x1')]={'type':{'type':Sequelize[_0xe75a('0x2')]('string',_0xe75a('0x3'),_0xe75a('0x4'),_0xe75a('0x5'),_0xe75a('0x6')),'defaultValue':_0xe75a('0x7')},'content':{'type':Sequelize[_0xe75a('0x8')]},'key':{'type':Sequelize[_0xe75a('0x8')]},'keyType':{'type':Sequelize[_0xe75a('0x2')]('string',_0xe75a('0x3'),_0xe75a('0x4'))},'keyContent':{'type':Sequelize[_0xe75a('0x8')]},'idField':{'type':Sequelize[_0xe75a('0x8')]},'nameField':{'type':Sequelize[_0xe75a('0x8')]},'customField':{'type':Sequelize[_0xe75a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe75a('0x8')]}}; \ No newline at end of file +var _0xbdc1=['STRING','sequelize','exports','ENUM','string','variable','keyValue','picklist','customVariable'];(function(_0xa75fe1,_0x1f9a6f){var _0x588736=function(_0x3e9826){while(--_0x3e9826){_0xa75fe1['push'](_0xa75fe1['shift']());}};_0x588736(++_0x1f9a6f);}(_0xbdc1,0xe2));var _0x1bdc=function(_0x5f3d30,_0x173276){_0x5f3d30=_0x5f3d30-0x0;var _0x5cfb2d=_0xbdc1[_0x5f3d30];return _0x5cfb2d;};'use strict';var Sequelize=require(_0x1bdc('0x0'));module[_0x1bdc('0x1')]={'type':{'type':Sequelize[_0x1bdc('0x2')](_0x1bdc('0x3'),_0x1bdc('0x4'),'customVariable',_0x1bdc('0x5'),_0x1bdc('0x6')),'defaultValue':_0x1bdc('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1bdc('0x2')](_0x1bdc('0x3'),_0x1bdc('0x4'),_0x1bdc('0x7'))},'keyContent':{'type':Sequelize[_0x1bdc('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1bdc('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4339fea..2357b7d 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 _0x04a5=['save','update','error','stack','name','send','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','FreshsalesField','include','findAll','then','show','params','model','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x19cd29,_0x1ac3e7){var _0x27c96d=function(_0x198a8f){while(--_0x198a8f){_0x19cd29['push'](_0x19cd29['shift']());}};_0x27c96d(++_0x1ac3e7);}(_0x04a5,0xb7));var _0x504a=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x04a5[_0x422ac3];return _0x53c0d4;};'use strict';var emlformat=require(_0x504a('0x0'));var rimraf=require(_0x504a('0x1'));var zipdir=require(_0x504a('0x2'));var jsonpatch=require(_0x504a('0x3'));var rp=require('request-promise');var moment=require(_0x504a('0x4'));var BPromise=require(_0x504a('0x5'));var Mustache=require(_0x504a('0x6'));var util=require(_0x504a('0x7'));var path=require(_0x504a('0x8'));var sox=require('sox');var csv=require(_0x504a('0x9'));var ejs=require(_0x504a('0xa'));var fs=require('fs');var fs_extra=require(_0x504a('0xb'));var _=require(_0x504a('0xc'));var squel=require(_0x504a('0xd'));var crypto=require(_0x504a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x504a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x504a('0x10'));var Papa=require('papaparse');var Redis=require(_0x504a('0x11'));var authService=require(_0x504a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x504a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x504a('0x14'))(_0x504a('0x15'));var utils=require(_0x504a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x504a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d0fba,_0x5975af){_0x5975af=_0x5975af||0xcc;return function(_0x470c8d){if(_0x470c8d){return _0x3d0fba[_0x504a('0x18')](_0x5975af);}return _0x3d0fba[_0x504a('0x19')](_0x5975af)[_0x504a('0x1a')]();};}function respondWithResult(_0x2c75e2,_0x3d3c50){_0x3d3c50=_0x3d3c50||0xc8;return function(_0x770127){if(_0x770127){return _0x2c75e2['status'](_0x3d3c50)[_0x504a('0x1b')](_0x770127);}};}function respondWithFilteredResult(_0x5cdd88,_0x35bf79){return function(_0x33c96b){if(_0x33c96b){var _0x2bbe01=typeof _0x35bf79['offset']===_0x504a('0x1c')&&typeof _0x35bf79[_0x504a('0x1d')]===_0x504a('0x1c');var _0x56dcd8=_0x33c96b[_0x504a('0x1e')];var _0x5939ce=_0x2bbe01?0x0:_0x35bf79[_0x504a('0x1f')];var _0x3f5f13=_0x2bbe01?_0x33c96b['count']:_0x35bf79[_0x504a('0x1f')]+_0x35bf79['limit'];var _0xee12db;if(_0x3f5f13>=_0x56dcd8){_0x3f5f13=_0x56dcd8;_0xee12db=0xc8;}else{_0xee12db=0xce;}_0x5cdd88[_0x504a('0x19')](_0xee12db);return _0x5cdd88[_0x504a('0x20')](_0x504a('0x21'),_0x5939ce+'-'+_0x3f5f13+'/'+_0x56dcd8)[_0x504a('0x1b')](_0x33c96b);}return null;};}function patchUpdates(_0x4be752){return function(_0x24e4b2){try{jsonpatch[_0x504a('0x22')](_0x24e4b2,_0x4be752,!![]);}catch(_0x2607c1){return BPromise[_0x504a('0x23')](_0x2607c1);}return _0x24e4b2[_0x504a('0x24')]();};}function saveUpdates(_0x2738bf,_0xa30d19){return function(_0x251ebf){if(_0x251ebf){return _0x251ebf[_0x504a('0x25')](_0x2738bf)['then'](function(_0x541676){return _0x541676;});}return null;};}function removeEntity(_0x3272bc,_0x9a33f0){return function(_0xcbfc1a){if(_0xcbfc1a){return _0xcbfc1a['destroy']()['then'](function(){_0x3272bc[_0x504a('0x19')](0xcc)[_0x504a('0x1a')]();});}};}function handleEntityNotFound(_0x2984c7,_0x318b36){return function(_0x17db23){if(!_0x17db23){_0x2984c7['sendStatus'](0x194);}return _0x17db23;};}function handleError(_0x22a559,_0x249c8a){_0x249c8a=_0x249c8a||0x1f4;return function(_0x1850d7){logger[_0x504a('0x26')](_0x1850d7[_0x504a('0x27')]);if(_0x1850d7[_0x504a('0x28')]){delete _0x1850d7['name'];}_0x22a559[_0x504a('0x19')](_0x249c8a)[_0x504a('0x29')](_0x1850d7);};}exports['index']=function(_0x2bd2f7,_0x3352c9){var _0x1981f0={},_0x16a82e={},_0x4f9431={'count':0x0,'rows':[]};var _0x43971d=_[_0x504a('0x2a')](db['FreshsalesField'][_0x504a('0x2b')],function(_0x20cf3c){return{'name':_0x20cf3c[_0x504a('0x2c')],'type':_0x20cf3c['type']['key']};});_0x16a82e['model']=_[_0x504a('0x2a')](_0x43971d,_0x504a('0x28'));_0x16a82e[_0x504a('0x2d')]=_[_0x504a('0x2e')](_0x2bd2f7[_0x504a('0x2d')]);_0x16a82e[_0x504a('0x2f')]=_[_0x504a('0x30')](_0x16a82e['model'],_0x16a82e[_0x504a('0x2d')]);_0x1981f0[_0x504a('0x31')]=_[_0x504a('0x30')](_0x16a82e['model'],qs['fields'](_0x2bd2f7[_0x504a('0x2d')][_0x504a('0x32')]));_0x1981f0['attributes']=_0x1981f0[_0x504a('0x31')][_0x504a('0x33')]?_0x1981f0[_0x504a('0x31')]:_0x16a82e['model'];if(!_0x2bd2f7[_0x504a('0x2d')][_0x504a('0x34')]('nolimit')){_0x1981f0[_0x504a('0x1d')]=qs['limit'](_0x2bd2f7[_0x504a('0x2d')]['limit']);_0x1981f0[_0x504a('0x1f')]=qs[_0x504a('0x1f')](_0x2bd2f7[_0x504a('0x2d')][_0x504a('0x1f')]);}_0x1981f0[_0x504a('0x35')]=qs[_0x504a('0x36')](_0x2bd2f7[_0x504a('0x2d')][_0x504a('0x36')]);_0x1981f0[_0x504a('0x37')]=qs[_0x504a('0x2f')](_['pick'](_0x2bd2f7[_0x504a('0x2d')],_0x16a82e['filters']),_0x43971d);if(_0x2bd2f7[_0x504a('0x2d')][_0x504a('0x38')]){_0x1981f0['where']=_[_0x504a('0x39')](_0x1981f0[_0x504a('0x37')],{'$or':_[_0x504a('0x2a')](_0x43971d,function(_0x22f6cd){if(_0x22f6cd[_0x504a('0x3a')]!==_0x504a('0x3b')){var _0x779b88={};_0x779b88[_0x22f6cd['name']]={'$like':'%'+_0x2bd2f7['query'][_0x504a('0x38')]+'%'};return _0x779b88;}})});}_0x1981f0=_['merge']({},_0x1981f0,_0x2bd2f7[_0x504a('0x3c')]);var _0x19efe0={'where':_0x1981f0[_0x504a('0x37')]};return db[_0x504a('0x3d')]['count'](_0x19efe0)['then'](function(_0x55cb99){_0x4f9431[_0x504a('0x1e')]=_0x55cb99;if(_0x2bd2f7[_0x504a('0x2d')]['includeAll']){_0x1981f0[_0x504a('0x3e')]=[{'all':!![]}];}return db[_0x504a('0x3d')][_0x504a('0x3f')](_0x1981f0);})[_0x504a('0x40')](function(_0x950773){_0x4f9431['rows']=_0x950773;return _0x4f9431;})[_0x504a('0x40')](respondWithFilteredResult(_0x3352c9,_0x1981f0))['catch'](handleError(_0x3352c9,null));};exports[_0x504a('0x41')]=function(_0x54b973,_0xa2fc80){var _0x493fc4={'raw':!![],'where':{'id':_0x54b973[_0x504a('0x42')]['id']}},_0x1bc2b7={};_0x1bc2b7[_0x504a('0x43')]=_[_0x504a('0x2e')](db[_0x504a('0x3d')][_0x504a('0x2b')]);_0x1bc2b7['query']=_[_0x504a('0x2e')](_0x54b973[_0x504a('0x2d')]);_0x1bc2b7['filters']=_[_0x504a('0x30')](_0x1bc2b7[_0x504a('0x43')],_0x1bc2b7[_0x504a('0x2d')]);_0x493fc4[_0x504a('0x31')]=_[_0x504a('0x30')](_0x1bc2b7[_0x504a('0x43')],qs[_0x504a('0x32')](_0x54b973[_0x504a('0x2d')]['fields']));_0x493fc4[_0x504a('0x31')]=_0x493fc4['attributes'][_0x504a('0x33')]?_0x493fc4['attributes']:_0x1bc2b7[_0x504a('0x43')];if(_0x54b973['query']['includeAll']){_0x493fc4[_0x504a('0x3e')]=[{'all':!![]}];}_0x493fc4=_[_0x504a('0x39')]({},_0x493fc4,_0x54b973['options']);return db[_0x504a('0x3d')][_0x504a('0x44')](_0x493fc4)[_0x504a('0x40')](handleEntityNotFound(_0xa2fc80,null))['then'](respondWithResult(_0xa2fc80,null))[_0x504a('0x45')](handleError(_0xa2fc80,null));};exports[_0x504a('0x46')]=function(_0x46371c,_0x1c34d2){return db[_0x504a('0x3d')]['create'](_0x46371c['body'],{})[_0x504a('0x40')](respondWithResult(_0x1c34d2,0xc9))[_0x504a('0x45')](handleError(_0x1c34d2,null));};exports[_0x504a('0x25')]=function(_0xbc4a05,_0x1cbb80){if(_0xbc4a05[_0x504a('0x47')]['id']){delete _0xbc4a05['body']['id'];}return db[_0x504a('0x3d')]['find']({'where':{'id':_0xbc4a05[_0x504a('0x42')]['id']}})[_0x504a('0x40')](handleEntityNotFound(_0x1cbb80,null))[_0x504a('0x40')](saveUpdates(_0xbc4a05[_0x504a('0x47')],null))[_0x504a('0x40')](respondWithResult(_0x1cbb80,null))[_0x504a('0x45')](handleError(_0x1cbb80,null));};exports[_0x504a('0x48')]=function(_0x1acdc5,_0xa8945d){return db[_0x504a('0x3d')][_0x504a('0x44')]({'where':{'id':_0x1acdc5[_0x504a('0x42')]['id']}})[_0x504a('0x40')](handleEntityNotFound(_0xa8945d,null))[_0x504a('0x40')](removeEntity(_0xa8945d,null))[_0x504a('0x45')](handleError(_0xa8945d,null));}; \ No newline at end of file +var _0xbb80=['attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','show','params','keys','find','create','body','catch','rimraf','zip-dir','request-promise','mustache','util','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','intersection','model','query'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xbb80,0x18c));var _0x0bb8=function(_0x32a923,_0x524c14){_0x32a923=_0x32a923-0x0;var _0x11677d=_0xbb80[_0x32a923];return _0x11677d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bb8('0x0'));var zipdir=require(_0x0bb8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0bb8('0x3'));var util=require(_0x0bb8('0x4'));var path=require(_0x0bb8('0x5'));var sox=require('sox');var csv=require(_0x0bb8('0x6'));var ejs=require(_0x0bb8('0x7'));var fs=require('fs');var fs_extra=require(_0x0bb8('0x8'));var _=require(_0x0bb8('0x9'));var squel=require(_0x0bb8('0xa'));var crypto=require(_0x0bb8('0xb'));var jsforce=require(_0x0bb8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0bb8('0xd'));var Papa=require(_0x0bb8('0xe'));var Redis=require(_0x0bb8('0xf'));var authService=require(_0x0bb8('0x10'));var qs=require(_0x0bb8('0x11'));var as=require(_0x0bb8('0x12'));var hardwareService=require(_0x0bb8('0x13'));var logger=require(_0x0bb8('0x14'))(_0x0bb8('0x15'));var utils=require(_0x0bb8('0x16'));var config=require(_0x0bb8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0bb8('0x18'))['db'];function respondWithStatusCode(_0x519097,_0x84cfee){_0x84cfee=_0x84cfee||0xcc;return function(_0x18dad6){if(_0x18dad6){return _0x519097[_0x0bb8('0x19')](_0x84cfee);}return _0x519097[_0x0bb8('0x1a')](_0x84cfee)[_0x0bb8('0x1b')]();};}function respondWithResult(_0x57345b,_0x1b721e){_0x1b721e=_0x1b721e||0xc8;return function(_0x43dc24){if(_0x43dc24){return _0x57345b['status'](_0x1b721e)[_0x0bb8('0x1c')](_0x43dc24);}};}function respondWithFilteredResult(_0x29a7c2,_0x3ee910){return function(_0xc9155c){if(_0xc9155c){var _0x393e2d=typeof _0x3ee910['offset']===_0x0bb8('0x1d')&&typeof _0x3ee910[_0x0bb8('0x1e')]==='undefined';var _0x57e0fd=_0xc9155c[_0x0bb8('0x1f')];var _0x541f84=_0x393e2d?0x0:_0x3ee910['offset'];var _0x20b233=_0x393e2d?_0xc9155c[_0x0bb8('0x1f')]:_0x3ee910[_0x0bb8('0x20')]+_0x3ee910['limit'];var _0x1f0ce7;if(_0x20b233>=_0x57e0fd){_0x20b233=_0x57e0fd;_0x1f0ce7=0xc8;}else{_0x1f0ce7=0xce;}_0x29a7c2[_0x0bb8('0x1a')](_0x1f0ce7);return _0x29a7c2['set'](_0x0bb8('0x21'),_0x541f84+'-'+_0x20b233+'/'+_0x57e0fd)[_0x0bb8('0x1c')](_0xc9155c);}return null;};}function patchUpdates(_0x487695){return function(_0x46a727){try{jsonpatch[_0x0bb8('0x22')](_0x46a727,_0x487695,!![]);}catch(_0x4f05d8){return BPromise[_0x0bb8('0x23')](_0x4f05d8);}return _0x46a727[_0x0bb8('0x24')]();};}function saveUpdates(_0x5b8bdb,_0x350407){return function(_0x26c3ce){if(_0x26c3ce){return _0x26c3ce[_0x0bb8('0x25')](_0x5b8bdb)[_0x0bb8('0x26')](function(_0x5ba3a6){return _0x5ba3a6;});}return null;};}function removeEntity(_0x52e734,_0xfe65fa){return function(_0x672d03){if(_0x672d03){return _0x672d03[_0x0bb8('0x27')]()[_0x0bb8('0x26')](function(){_0x52e734[_0x0bb8('0x1a')](0xcc)[_0x0bb8('0x1b')]();});}};}function handleEntityNotFound(_0x35b839,_0x58d9c3){return function(_0x4dbb21){if(!_0x4dbb21){_0x35b839[_0x0bb8('0x19')](0x194);}return _0x4dbb21;};}function handleError(_0x23c223,_0x2453f0){_0x2453f0=_0x2453f0||0x1f4;return function(_0x4b4587){logger[_0x0bb8('0x28')](_0x4b4587[_0x0bb8('0x29')]);if(_0x4b4587[_0x0bb8('0x2a')]){delete _0x4b4587[_0x0bb8('0x2a')];}_0x23c223[_0x0bb8('0x1a')](_0x2453f0)[_0x0bb8('0x2b')](_0x4b4587);};}exports[_0x0bb8('0x2c')]=function(_0x43392f,_0x347f26){var _0x53d6df={},_0x50f246={},_0x925ba7={'count':0x0,'rows':[]};var _0xe51fb4=_[_0x0bb8('0x2d')](db[_0x0bb8('0x2e')][_0x0bb8('0x2f')],function(_0x4abc46){return{'name':_0x4abc46[_0x0bb8('0x30')],'type':_0x4abc46[_0x0bb8('0x31')][_0x0bb8('0x32')]};});_0x50f246['model']=_[_0x0bb8('0x2d')](_0xe51fb4,_0x0bb8('0x2a'));_0x50f246['query']=_['keys'](_0x43392f['query']);_0x50f246['filters']=_[_0x0bb8('0x33')](_0x50f246[_0x0bb8('0x34')],_0x50f246[_0x0bb8('0x35')]);_0x53d6df[_0x0bb8('0x36')]=_[_0x0bb8('0x33')](_0x50f246[_0x0bb8('0x34')],qs[_0x0bb8('0x37')](_0x43392f['query'][_0x0bb8('0x37')]));_0x53d6df[_0x0bb8('0x36')]=_0x53d6df[_0x0bb8('0x36')][_0x0bb8('0x38')]?_0x53d6df[_0x0bb8('0x36')]:_0x50f246[_0x0bb8('0x34')];if(!_0x43392f['query'][_0x0bb8('0x39')]('nolimit')){_0x53d6df[_0x0bb8('0x1e')]=qs[_0x0bb8('0x1e')](_0x43392f[_0x0bb8('0x35')][_0x0bb8('0x1e')]);_0x53d6df[_0x0bb8('0x20')]=qs[_0x0bb8('0x20')](_0x43392f[_0x0bb8('0x35')]['offset']);}_0x53d6df[_0x0bb8('0x3a')]=qs[_0x0bb8('0x3b')](_0x43392f[_0x0bb8('0x35')][_0x0bb8('0x3b')]);_0x53d6df[_0x0bb8('0x3c')]=qs[_0x0bb8('0x3d')](_[_0x0bb8('0x3e')](_0x43392f[_0x0bb8('0x35')],_0x50f246[_0x0bb8('0x3d')]),_0xe51fb4);if(_0x43392f[_0x0bb8('0x35')][_0x0bb8('0x3f')]){_0x53d6df[_0x0bb8('0x3c')]=_[_0x0bb8('0x40')](_0x53d6df[_0x0bb8('0x3c')],{'$or':_[_0x0bb8('0x2d')](_0xe51fb4,function(_0x2b7377){if(_0x2b7377[_0x0bb8('0x31')]!=='VIRTUAL'){var _0x26952f={};_0x26952f[_0x2b7377[_0x0bb8('0x2a')]]={'$like':'%'+_0x43392f[_0x0bb8('0x35')][_0x0bb8('0x3f')]+'%'};return _0x26952f;}})});}_0x53d6df=_[_0x0bb8('0x40')]({},_0x53d6df,_0x43392f['options']);var _0x1de378={'where':_0x53d6df[_0x0bb8('0x3c')]};return db[_0x0bb8('0x2e')][_0x0bb8('0x1f')](_0x1de378)[_0x0bb8('0x26')](function(_0x397887){_0x925ba7[_0x0bb8('0x1f')]=_0x397887;if(_0x43392f[_0x0bb8('0x35')][_0x0bb8('0x41')]){_0x53d6df[_0x0bb8('0x42')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x53d6df);})['then'](function(_0x167cdf){_0x925ba7[_0x0bb8('0x43')]=_0x167cdf;return _0x925ba7;})[_0x0bb8('0x26')](respondWithFilteredResult(_0x347f26,_0x53d6df))['catch'](handleError(_0x347f26,null));};exports[_0x0bb8('0x44')]=function(_0x75497c,_0x2fdfd2){var _0x543b78={'raw':!![],'where':{'id':_0x75497c[_0x0bb8('0x45')]['id']}},_0x2f5d77={};_0x2f5d77[_0x0bb8('0x34')]=_[_0x0bb8('0x46')](db['FreshsalesField'][_0x0bb8('0x2f')]);_0x2f5d77['query']=_[_0x0bb8('0x46')](_0x75497c[_0x0bb8('0x35')]);_0x2f5d77[_0x0bb8('0x3d')]=_['intersection'](_0x2f5d77['model'],_0x2f5d77['query']);_0x543b78['attributes']=_['intersection'](_0x2f5d77[_0x0bb8('0x34')],qs[_0x0bb8('0x37')](_0x75497c[_0x0bb8('0x35')][_0x0bb8('0x37')]));_0x543b78['attributes']=_0x543b78[_0x0bb8('0x36')][_0x0bb8('0x38')]?_0x543b78['attributes']:_0x2f5d77[_0x0bb8('0x34')];if(_0x75497c[_0x0bb8('0x35')][_0x0bb8('0x41')]){_0x543b78[_0x0bb8('0x42')]=[{'all':!![]}];}_0x543b78=_[_0x0bb8('0x40')]({},_0x543b78,_0x75497c['options']);return db[_0x0bb8('0x2e')][_0x0bb8('0x47')](_0x543b78)[_0x0bb8('0x26')](handleEntityNotFound(_0x2fdfd2,null))[_0x0bb8('0x26')](respondWithResult(_0x2fdfd2,null))['catch'](handleError(_0x2fdfd2,null));};exports[_0x0bb8('0x48')]=function(_0x323f22,_0x2a15c0){return db['FreshsalesField']['create'](_0x323f22[_0x0bb8('0x49')],{})[_0x0bb8('0x26')](respondWithResult(_0x2a15c0,0xc9))[_0x0bb8('0x4a')](handleError(_0x2a15c0,null));};exports[_0x0bb8('0x25')]=function(_0x54f993,_0xbfcf9a){if(_0x54f993['body']['id']){delete _0x54f993[_0x0bb8('0x49')]['id'];}return db[_0x0bb8('0x2e')][_0x0bb8('0x47')]({'where':{'id':_0x54f993[_0x0bb8('0x45')]['id']}})[_0x0bb8('0x26')](handleEntityNotFound(_0xbfcf9a,null))['then'](saveUpdates(_0x54f993[_0x0bb8('0x49')],null))[_0x0bb8('0x26')](respondWithResult(_0xbfcf9a,null))['catch'](handleError(_0xbfcf9a,null));};exports['destroy']=function(_0x551d3e,_0x571a68){return db[_0x0bb8('0x2e')]['find']({'where':{'id':_0x551d3e['params']['id']}})[_0x0bb8('0x26')](handleEntityNotFound(_0x571a68,null))[_0x0bb8('0x26')](removeEntity(_0x571a68,null))[_0x0bb8('0x4a')](handleError(_0x571a68,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 95ea30e..2117021 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 _0xf69c=['./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x1d31e1,_0x5d7b4e){var _0x49c575=function(_0xa28ad2){while(--_0xa28ad2){_0x1d31e1['push'](_0x1d31e1['shift']());}};_0x49c575(++_0x5d7b4e);}(_0xf69c,0x1e2));var _0xcf69=function(_0x296588,_0x49f98d){_0x296588=_0x296588-0x0;var _0x2f6d92=_0xf69c[_0x296588];return _0x2f6d92;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var logger=require(_0xcf69('0x2'))(_0xcf69('0x3'));var moment=require('moment');var BPromise=require(_0xcf69('0x4'));var rp=require(_0xcf69('0x5'));var fs=require('fs');var path=require(_0xcf69('0x6'));var rimraf=require('rimraf');var config=require(_0xcf69('0x7'));var attributes=require(_0xcf69('0x8'));module[_0xcf69('0x9')]=function(_0x2e8d3,_0x2ec528){return _0x2e8d3[_0xcf69('0xa')](_0xcf69('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xcf69('0xc'),'fields':[_0xcf69('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8533=['moment','bluebird','path','../../config/environment','exports','define','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger'];(function(_0x381cd5,_0x1f66dd){var _0x14b162=function(_0x1e7e89){while(--_0x1e7e89){_0x381cd5['push'](_0x381cd5['shift']());}};_0x14b162(++_0x1f66dd);}(_0x8533,0x141));var _0x3853=function(_0x543780,_0x1a6c08){_0x543780=_0x543780-0x0;var _0x353294=_0x8533[_0x543780];return _0x353294;};'use strict';var _=require(_0x3853('0x0'));var util=require(_0x3853('0x1'));var logger=require(_0x3853('0x2'))('api');var moment=require(_0x3853('0x3'));var BPromise=require(_0x3853('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3853('0x5'));var rimraf=require('rimraf');var config=require(_0x3853('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x3853('0x7')]=function(_0x4644ba,_0x630746){return _0x4644ba[_0x3853('0x8')]('FreshsalesField',attributes,{'tableName':_0x3853('0x9'),'paranoid':![],'indexes':[{'name':_0x3853('0xa'),'fields':[_0x3853('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 4d4bcb7..4fece3d 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 _0x0295=['client','http','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5f2655,_0x17a54d){var _0x2b0edd=function(_0xf18261){while(--_0xf18261){_0x5f2655['push'](_0x5f2655['shift']());}};_0x2b0edd(++_0x17a54d);}(_0x0295,0x1f0));var _0x5029=function(_0x56278e,_0x5083c5){_0x56278e=_0x56278e-0x0;var _0x46d37e=_0x0295[_0x56278e];return _0x46d37e;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xd117,0x182));var _0x7d11=function(_0x1a9b94,_0x4d763e){_0x1a9b94=_0x1a9b94-0x0;var _0x379102=_0xd117[_0x1a9b94];return _0x379102;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 783cde2..ed7ec61 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(_0x32893f,_0x3c8f68){var _0x4eff08=function(_0x328070){while(--_0x328070){_0x32893f['push'](_0x32893f['shift']());}};_0x4eff08(++_0x3c8f68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x4362ed,_0x25af33){var _0x1a3f12=function(_0x89dbe2){while(--_0x89dbe2){_0x4362ed['push'](_0x4362ed['shift']());}};_0x1a3f12(++_0x25af33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 d7d0c1f..aea46ff 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 _0x0767=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x6b0c72,_0xa303b7){var _0x3538c1=function(_0xbc56cd){while(--_0xbc56cd){_0x6b0c72['push'](_0x6b0c72['shift']());}};_0x3538c1(++_0xa303b7);}(_0x0767,0x1bf));var _0x7076=function(_0x572e1b,_0x4df9bc){_0x572e1b=_0x572e1b-0x0;var _0x3f24c9=_0x0767[_0x572e1b];return _0x3f24c9;};'use strict';var Sequelize=require(_0x7076('0x0'));module[_0x7076('0x1')]={'name':{'type':Sequelize[_0x7076('0x2')]},'description':{'type':Sequelize[_0x7076('0x2')]},'username':{'type':Sequelize[_0x7076('0x2')],'unique':_0x7076('0x3')},'remoteUri':{'type':Sequelize[_0x7076('0x2')]},'password':{'type':Sequelize[_0x7076('0x2')]},'clientId':{'type':Sequelize[_0x7076('0x2')]},'clientSecret':{'type':Sequelize[_0x7076('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7076('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7076('0x4')](_0x7076('0x5'),_0x7076('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb1fa=['STRING','newTab'];(function(_0x4c9296,_0x5d07f5){var _0x3d8557=function(_0x2143e6){while(--_0x2143e6){_0x4c9296['push'](_0x4c9296['shift']());}};_0x3d8557(++_0x5d07f5);}(_0xb1fa,0x9e));var _0xab1f=function(_0x209e72,_0x14ef13){_0x209e72=_0x209e72-0x0;var _0x38a5a4=_0xb1fa[_0x209e72];return _0x38a5a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xab1f('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xab1f('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xab1f('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xab1f('0x1')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 993ecb5..96c4031 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 _0x8fb8=['securityToken','slice','substring','lastIndexOf','Connection','clientId','login','username','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','string','int','picklist','boolean','email','phone','includes','custom','picklistValues','label','False','false','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','password'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x8fb8,0x9f));var _0x88fb=function(_0x2762ce,_0x4505a0){_0x2762ce=_0x2762ce-0x0;var _0x444b75=_0x8fb8[_0x2762ce];return _0x444b75;};'use strict';var emlformat=require(_0x88fb('0x0'));var rimraf=require(_0x88fb('0x1'));var zipdir=require(_0x88fb('0x2'));var jsonpatch=require(_0x88fb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x88fb('0x4'));var Mustache=require(_0x88fb('0x5'));var util=require('util');var path=require(_0x88fb('0x6'));var sox=require(_0x88fb('0x7'));var csv=require(_0x88fb('0x8'));var ejs=require(_0x88fb('0x9'));var fs=require('fs');var fs_extra=require(_0x88fb('0xa'));var _=require(_0x88fb('0xb'));var squel=require(_0x88fb('0xc'));var crypto=require(_0x88fb('0xd'));var jsforce=require(_0x88fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x88fb('0x8'));var querystring=require(_0x88fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x88fb('0x10'));var authService=require(_0x88fb('0x11'));var qs=require(_0x88fb('0x12'));var as=require(_0x88fb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88fb('0x14'))(_0x88fb('0x15'));var utils=require(_0x88fb('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x88fb('0x17'))['db'];var integrations=require(_0x88fb('0x18'));function respondWithStatusCode(_0x34019d,_0x41f0ea){_0x41f0ea=_0x41f0ea||0xcc;return function(_0x58af7e){if(_0x58af7e){return _0x34019d[_0x88fb('0x19')](_0x41f0ea);}return _0x34019d[_0x88fb('0x1a')](_0x41f0ea)[_0x88fb('0x1b')]();};}function respondWithResult(_0x1c824f,_0x3e48e7){_0x3e48e7=_0x3e48e7||0xc8;return function(_0x1b0b18){if(_0x1b0b18){return _0x1c824f[_0x88fb('0x1a')](_0x3e48e7)[_0x88fb('0x1c')](_0x1b0b18);}};}function respondWithFilteredResult(_0x3650f5,_0x186c5a){return function(_0x407be7){if(_0x407be7){var _0x2ea992=typeof _0x186c5a[_0x88fb('0x1d')]==='undefined'&&typeof _0x186c5a[_0x88fb('0x1e')]==='undefined';var _0x316ded=_0x407be7['count'];var _0x4b30b6=_0x2ea992?0x0:_0x186c5a[_0x88fb('0x1d')];var _0x463b54=_0x2ea992?_0x407be7[_0x88fb('0x1f')]:_0x186c5a['offset']+_0x186c5a[_0x88fb('0x1e')];var _0x2f2716;if(_0x463b54>=_0x316ded){_0x463b54=_0x316ded;_0x2f2716=0xc8;}else{_0x2f2716=0xce;}_0x3650f5[_0x88fb('0x1a')](_0x2f2716);return _0x3650f5[_0x88fb('0x20')](_0x88fb('0x21'),_0x4b30b6+'-'+_0x463b54+'/'+_0x316ded)['json'](_0x407be7);}return null;};}function patchUpdates(_0x4ecd58){return function(_0x364ccb){try{jsonpatch[_0x88fb('0x22')](_0x364ccb,_0x4ecd58,!![]);}catch(_0x5f43eb){return BPromise[_0x88fb('0x23')](_0x5f43eb);}return _0x364ccb['save']();};}function saveUpdates(_0x3213cd,_0x36e801){return function(_0x459176){if(_0x459176){return _0x459176[_0x88fb('0x24')](_0x3213cd)[_0x88fb('0x25')](function(_0x44e6d0){return _0x44e6d0;});}return null;};}function removeEntity(_0x574c18,_0x40536b){return function(_0x3ac294){if(_0x3ac294){return _0x3ac294[_0x88fb('0x26')]()[_0x88fb('0x25')](function(){_0x574c18[_0x88fb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed7f1,_0x9b51af){return function(_0x448488){if(!_0x448488){_0x5ed7f1['sendStatus'](0x194);}return _0x448488;};}function handleError(_0x29f28e,_0x5bee43){_0x5bee43=_0x5bee43||0x1f4;return function(_0x1e26f2){logger['error'](_0x1e26f2[_0x88fb('0x27')]);if(_0x1e26f2[_0x88fb('0x28')]){delete _0x1e26f2[_0x88fb('0x28')];}_0x29f28e[_0x88fb('0x1a')](_0x5bee43)[_0x88fb('0x29')](_0x1e26f2);};}exports[_0x88fb('0x2a')]=function(_0x7522f3,_0x527b35){var _0x5dc855={},_0x56f843={},_0x34d714={'count':0x0,'rows':[]};var _0x3bed21=_[_0x88fb('0x2b')](db[_0x88fb('0x2c')][_0x88fb('0x2d')],function(_0x39a835){return{'name':_0x39a835[_0x88fb('0x2e')],'type':_0x39a835[_0x88fb('0x2f')][_0x88fb('0x30')]};});_0x56f843[_0x88fb('0x31')]=_[_0x88fb('0x2b')](_0x3bed21,_0x88fb('0x28'));_0x56f843['query']=_[_0x88fb('0x32')](_0x7522f3['query']);_0x56f843['filters']=_[_0x88fb('0x33')](_0x56f843[_0x88fb('0x31')],_0x56f843[_0x88fb('0x34')]);_0x5dc855[_0x88fb('0x35')]=_[_0x88fb('0x33')](_0x56f843[_0x88fb('0x31')],qs[_0x88fb('0x36')](_0x7522f3[_0x88fb('0x34')]['fields']));_0x5dc855['attributes']=_0x5dc855[_0x88fb('0x35')][_0x88fb('0x37')]?_0x5dc855[_0x88fb('0x35')]:_0x56f843[_0x88fb('0x31')];if(!_0x7522f3['query'][_0x88fb('0x38')]('nolimit')){_0x5dc855[_0x88fb('0x1e')]=qs[_0x88fb('0x1e')](_0x7522f3[_0x88fb('0x34')][_0x88fb('0x1e')]);_0x5dc855[_0x88fb('0x1d')]=qs['offset'](_0x7522f3[_0x88fb('0x34')][_0x88fb('0x1d')]);}_0x5dc855[_0x88fb('0x39')]=qs[_0x88fb('0x3a')](_0x7522f3[_0x88fb('0x34')][_0x88fb('0x3a')]);_0x5dc855[_0x88fb('0x3b')]=qs['filters'](_['pick'](_0x7522f3['query'],_0x56f843[_0x88fb('0x3c')]),_0x3bed21);if(_0x7522f3[_0x88fb('0x34')][_0x88fb('0x3d')]){_0x5dc855[_0x88fb('0x3b')]=_[_0x88fb('0x3e')](_0x5dc855['where'],{'$or':_[_0x88fb('0x2b')](_0x3bed21,function(_0x1923f0){if(_0x1923f0[_0x88fb('0x2f')]!==_0x88fb('0x3f')){var _0x343c59={};_0x343c59[_0x1923f0['name']]={'$like':'%'+_0x7522f3[_0x88fb('0x34')][_0x88fb('0x3d')]+'%'};return _0x343c59;}})});}_0x5dc855=_[_0x88fb('0x3e')]({},_0x5dc855,_0x7522f3[_0x88fb('0x40')]);var _0x212570={'where':_0x5dc855['where']};return db[_0x88fb('0x2c')][_0x88fb('0x1f')](_0x212570)['then'](function(_0x5dcdb2){_0x34d714[_0x88fb('0x1f')]=_0x5dcdb2;if(_0x7522f3[_0x88fb('0x34')][_0x88fb('0x41')]){_0x5dc855['include']=[{'all':!![]}];}return db[_0x88fb('0x2c')][_0x88fb('0x42')](_0x5dc855);})['then'](function(_0x5e6fba){_0x34d714[_0x88fb('0x43')]=_0x5e6fba;return _0x34d714;})[_0x88fb('0x25')](respondWithFilteredResult(_0x527b35,_0x5dc855))[_0x88fb('0x44')](handleError(_0x527b35,null));};exports[_0x88fb('0x45')]=function(_0x329db6,_0x380ab3){var _0x425047={'raw':![],'where':{'id':_0x329db6[_0x88fb('0x46')]['id']}},_0x5022a6={};_0x5022a6[_0x88fb('0x31')]=_[_0x88fb('0x32')](db[_0x88fb('0x2c')][_0x88fb('0x2d')]);_0x5022a6[_0x88fb('0x34')]=_[_0x88fb('0x32')](_0x329db6['query']);_0x5022a6[_0x88fb('0x3c')]=_[_0x88fb('0x33')](_0x5022a6['model'],_0x5022a6['query']);_0x425047[_0x88fb('0x35')]=_[_0x88fb('0x33')](_0x5022a6['model'],qs[_0x88fb('0x36')](_0x329db6[_0x88fb('0x34')][_0x88fb('0x36')]));_0x425047[_0x88fb('0x35')]=_0x425047[_0x88fb('0x35')][_0x88fb('0x37')]?_0x425047[_0x88fb('0x35')]:_0x5022a6[_0x88fb('0x31')];if(_0x329db6[_0x88fb('0x34')]['includeAll']){_0x425047[_0x88fb('0x47')]=[{'all':!![]}];}_0x425047=_[_0x88fb('0x3e')]({},_0x425047,_0x329db6[_0x88fb('0x40')]);return db['SalesforceAccount'][_0x88fb('0x48')](_0x425047)['then'](handleEntityNotFound(_0x380ab3,null))['then'](respondWithResult(_0x380ab3,null))[_0x88fb('0x44')](handleError(_0x380ab3,null));};exports[_0x88fb('0x49')]=function(_0x10351,_0x43c34e){return db[_0x88fb('0x2c')][_0x88fb('0x49')](_0x10351['body'],{})['then'](respondWithResult(_0x43c34e,0xc9))[_0x88fb('0x44')](handleError(_0x43c34e,null));};exports[_0x88fb('0x24')]=function(_0x1254a2,_0xe8206d){if(_0x1254a2[_0x88fb('0x4a')]['id']){delete _0x1254a2[_0x88fb('0x4a')]['id'];}return db[_0x88fb('0x2c')][_0x88fb('0x48')]({'where':{'id':_0x1254a2['params']['id']}})['then'](handleEntityNotFound(_0xe8206d,null))[_0x88fb('0x25')](saveUpdates(_0x1254a2['body'],null))[_0x88fb('0x25')](respondWithResult(_0xe8206d,null))[_0x88fb('0x44')](handleError(_0xe8206d,null));};exports[_0x88fb('0x26')]=function(_0xb0ce72,_0x10765e){return db[_0x88fb('0x2c')][_0x88fb('0x48')]({'where':{'id':_0xb0ce72['params']['id']}})[_0x88fb('0x25')](handleEntityNotFound(_0x10765e,null))[_0x88fb('0x25')](removeEntity(_0x10765e,null))['catch'](handleError(_0x10765e,null));};exports[_0x88fb('0x4b')]=function(_0x116859,_0x2a4299,_0x5bfdc9){var _0xb5485b={};var _0x55d191={};var _0x356ccb;var _0x119050;return db[_0x88fb('0x2c')][_0x88fb('0x4c')]({'where':{'id':_0x116859[_0x88fb('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a4299,null))[_0x88fb('0x25')](function(_0x3b27ac){if(_0x3b27ac){_0x356ccb=_0x3b27ac;_0x55d191[_0x88fb('0x31')]=_['keys'](db[_0x88fb('0x4d')][_0x88fb('0x2d')]);_0x55d191[_0x88fb('0x34')]=_[_0x88fb('0x32')](_0x116859[_0x88fb('0x34')]);_0x55d191[_0x88fb('0x3c')]=_['intersection'](_0x55d191[_0x88fb('0x31')],_0x55d191[_0x88fb('0x34')]);_0xb5485b['attributes']=_['intersection'](_0x55d191[_0x88fb('0x31')],qs[_0x88fb('0x36')](_0x116859['query'][_0x88fb('0x36')]));_0xb5485b[_0x88fb('0x35')]=_0xb5485b[_0x88fb('0x35')]['length']?_0xb5485b[_0x88fb('0x35')]:_0x55d191[_0x88fb('0x31')];_0xb5485b[_0x88fb('0x39')]=qs[_0x88fb('0x3a')](_0x116859[_0x88fb('0x34')]['sort']);_0xb5485b[_0x88fb('0x3b')]=qs[_0x88fb('0x3c')](_[_0x88fb('0x4e')](_0x116859['query'],_0x55d191[_0x88fb('0x3c')]));if(_0x116859[_0x88fb('0x34')]['filter']){_0xb5485b[_0x88fb('0x3b')]=_[_0x88fb('0x3e')](_0xb5485b[_0x88fb('0x3b')],{'$or':_[_0x88fb('0x2b')](_0xb5485b[_0x88fb('0x35')],function(_0x1a0a0c){var _0x537a3d={};_0x537a3d[_0x1a0a0c]={'$like':'%'+_0x116859[_0x88fb('0x34')][_0x88fb('0x3d')]+'%'};return _0x537a3d;})});}_0xb5485b=_[_0x88fb('0x3e')]({},_0xb5485b,_0x116859[_0x88fb('0x40')]);return _0x356ccb['getConfigurations'](_0xb5485b);}})[_0x88fb('0x25')](function(_0x5cf032){if(_0x5cf032){_0x119050=_0x5cf032['length'];if(!_0x116859['query'][_0x88fb('0x38')](_0x88fb('0x4f'))){_0xb5485b['limit']=qs[_0x88fb('0x1e')](_0x116859[_0x88fb('0x34')][_0x88fb('0x1e')]);_0xb5485b[_0x88fb('0x1d')]=qs[_0x88fb('0x1d')](_0x116859['query'][_0x88fb('0x1d')]);}return _0x356ccb['getConfigurations'](_0xb5485b);}})[_0x88fb('0x25')](function(_0x3efe66){if(_0x3efe66){return _0x3efe66?{'count':_0x119050,'rows':_0x3efe66}:null;}})[_0x88fb('0x25')](respondWithResult(_0x2a4299,null))[_0x88fb('0x44')](handleError(_0x2a4299,null));};exports[_0x88fb('0x50')]=function(_0x35944f,_0x4be26d,_0x2b299e){if(_0x35944f[_0x88fb('0x4a')]['id']){delete _0x35944f[_0x88fb('0x4a')]['id'];}return db[_0x88fb('0x2c')]['findOne']({'where':{'id':_0x35944f[_0x88fb('0x46')]['id']}})[_0x88fb('0x25')](handleEntityNotFound(_0x4be26d,null))[_0x88fb('0x25')](function(_0x527a13){if(_0x527a13){_0x35944f[_0x88fb('0x4a')][_0x88fb('0x51')]=_0x527a13['id'];_0x35944f[_0x88fb('0x4a')][_0x88fb('0x52')]=integrations[_0x88fb('0x53')](_0x35944f[_0x88fb('0x4a')][_0x88fb('0x54')],_0x35944f[_0x88fb('0x4a')][_0x88fb('0x2f')]);_0x35944f[_0x88fb('0x4a')][_0x88fb('0x55')]=integrations[_0x88fb('0x56')](_0x35944f[_0x88fb('0x4a')][_0x88fb('0x54')],_0x35944f[_0x88fb('0x4a')][_0x88fb('0x2f')]);return db[_0x88fb('0x4d')]['create'](_0x35944f[_0x88fb('0x4a')],{'include':[{'model':db[_0x88fb('0x57')],'as':_0x88fb('0x52')},{'model':db[_0x88fb('0x57')],'as':_0x88fb('0x55')}]});}return null;})['then'](respondWithResult(_0x4be26d,null))[_0x88fb('0x44')](handleError(_0x4be26d,null));};exports[_0x88fb('0x58')]=function(_0x5942f2,_0x2e5bd7,_0x38a92f){var _0x9e7239;var _0x3fd1dc='';var _0x10543b=_0x88fb('0x59');return db[_0x88fb('0x2c')][_0x88fb('0x4c')]({'where':{'id':_0x5942f2[_0x88fb('0x46')]['id']},'attributes':['id',_0x88fb('0x5a'),'clientId',_0x88fb('0x5b'),'username',_0x88fb('0x5c'),_0x88fb('0x5d')]})['then'](handleEntityNotFound(_0x2e5bd7,null))[_0x88fb('0x25')](function(_0x14cd8e){if(_0x14cd8e){_0x3fd1dc=_0x14cd8e[_0x88fb('0x5a')];var _0x5ad67f=_0x3fd1dc[_0x88fb('0x5e')](-0x1);if(_0x5ad67f==='/'){_0x3fd1dc=_0x3fd1dc[_0x88fb('0x5f')](0x0,_0x3fd1dc[_0x88fb('0x60')](_0x5ad67f));}_0x9e7239=new jsforce[(_0x88fb('0x61'))]({'oauth2':{'loginUrl':_0x3fd1dc,'clientId':_0x14cd8e[_0x88fb('0x62')],'clientSecret':_0x14cd8e[_0x88fb('0x5b')]}});return _0x9e7239[_0x88fb('0x63')](_0x14cd8e[_0x88fb('0x64')],_0x14cd8e[_0x88fb('0x5c')][_0x88fb('0x65')](_0x14cd8e[_0x88fb('0x5d')]));}})[_0x88fb('0x25')](function(_0x155dad){if(_0x155dad){if(!_['isNil'](_0x5942f2[_0x88fb('0x34')][_0x88fb('0x66')])){_0x10543b=_0x5942f2['query'][_0x88fb('0x66')];}return _0x9e7239[_0x88fb('0x67')](_0x10543b)[_0x88fb('0x68')]();}})['then'](function(_0x2ab292){var _0x4fdbf4=[_0x88fb('0x69'),_0x88fb('0x6a'),_0x88fb('0x6b'),_0x88fb('0x6c'),'Subject','Description'];var _0x4348c4=[_0x88fb('0x6d'),_0x88fb('0x6e'),_0x88fb('0x6f'),_0x88fb('0x70'),_0x88fb('0x71'),'textarea',_0x88fb('0x72')];if(_0x2ab292){_['remove'](_0x2ab292[_0x88fb('0x36')],function(_0x4e23c9){return _0x4fdbf4[_0x88fb('0x73')](_0x4e23c9[_0x88fb('0x28')])||!_0x4348c4[_0x88fb('0x73')](_0x4e23c9[_0x88fb('0x2f')]);});return{'count':_0x2ab292[_0x88fb('0x36')]['length'],'rows':_[_0x88fb('0x2b')](_0x2ab292['fields'],function(_0x1dee1f){return{'id':_0x1dee1f[_0x88fb('0x28')],'name':_0x1dee1f['label'],'custom':_0x1dee1f[_0x88fb('0x74')],'options':_0x1dee1f[_0x88fb('0x75')]['length']>0x0?_[_0x88fb('0x2b')](_0x1dee1f[_0x88fb('0x75')],function(_0x17060b){return{'name':_0x17060b[_0x88fb('0x76')],'value':_0x17060b['value']};}):_0x1dee1f[_0x88fb('0x2f')]==_0x88fb('0x70')?[{'name':'True','value':'true'},{'name':_0x88fb('0x77'),'value':_0x88fb('0x78')}]:[]};})};}})[_0x88fb('0x25')](respondWithResult(_0x2e5bd7,null))[_0x88fb('0x44')](function(_0x411cbd){var _0x1af7b5=_0x5942f2['query'][_0x88fb('0x79')]?0x1f4:_0x411cbd[_0x88fb('0x7a')]||0x1f4;logger[_0x88fb('0x7b')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1af7b5,JSON[_0x88fb('0x7c')](_0x411cbd));delete _0x411cbd['name'];if(_0x1af7b5===0x191){_0x1af7b5=0x190;}_0x2e5bd7[_0x88fb('0x1a')](_0x1af7b5)['send'](_0x5942f2[_0x88fb('0x34')][_0x88fb('0x79')]?{'message':_0x88fb('0x7d'),'statusCode':_0x411cbd[_0x88fb('0x7a')]}:_0x411cbd);});}; \ No newline at end of file +var _0x2cd8=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceAccount','rawAttributes','type','keys','filters','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','SalesforceConfiguration','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','clientId','securityToken','slice','lastIndexOf','Connection','clientSecret','login','username','password','isNil','ticketType','sobject','describe','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count'];(function(_0x1b1c9c,_0x1092e1){var _0x464176=function(_0xdf58fb){while(--_0xdf58fb){_0x1b1c9c['push'](_0x1b1c9c['shift']());}};_0x464176(++_0x1092e1);}(_0x2cd8,0x156));var _0x82cd=function(_0x4c2e45,_0x40d854){_0x4c2e45=_0x4c2e45-0x0;var _0x2306b2=_0x2cd8[_0x4c2e45];return _0x2306b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82cd('0x0'));var zipdir=require(_0x82cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82cd('0x2'));var moment=require(_0x82cd('0x3'));var BPromise=require(_0x82cd('0x4'));var Mustache=require(_0x82cd('0x5'));var util=require(_0x82cd('0x6'));var path=require(_0x82cd('0x7'));var sox=require(_0x82cd('0x8'));var csv=require(_0x82cd('0x9'));var ejs=require(_0x82cd('0xa'));var fs=require('fs');var fs_extra=require(_0x82cd('0xb'));var _=require(_0x82cd('0xc'));var squel=require('squel');var crypto=require(_0x82cd('0xd'));var jsforce=require(_0x82cd('0xe'));var deskjs=require(_0x82cd('0xf'));var toCsv=require(_0x82cd('0x9'));var querystring=require(_0x82cd('0x10'));var Papa=require(_0x82cd('0x11'));var Redis=require('ioredis');var authService=require(_0x82cd('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82cd('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x82cd('0x14'));var config=require(_0x82cd('0x15'));var licenseUtil=require(_0x82cd('0x16'));var db=require(_0x82cd('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1f247a,_0x1fe29e){_0x1fe29e=_0x1fe29e||0xcc;return function(_0x2b083a){if(_0x2b083a){return _0x1f247a[_0x82cd('0x18')](_0x1fe29e);}return _0x1f247a[_0x82cd('0x19')](_0x1fe29e)[_0x82cd('0x1a')]();};}function respondWithResult(_0x1edd2a,_0x21e17d){_0x21e17d=_0x21e17d||0xc8;return function(_0x389a85){if(_0x389a85){return _0x1edd2a['status'](_0x21e17d)[_0x82cd('0x1b')](_0x389a85);}};}function respondWithFilteredResult(_0x1276de,_0x382c39){return function(_0x172982){if(_0x172982){var _0xb35c36=typeof _0x382c39[_0x82cd('0x1c')]==='undefined'&&typeof _0x382c39['limit']==='undefined';var _0x4eccc8=_0x172982[_0x82cd('0x1d')];var _0x344485=_0xb35c36?0x0:_0x382c39['offset'];var _0x2b40d5=_0xb35c36?_0x172982[_0x82cd('0x1d')]:_0x382c39[_0x82cd('0x1c')]+_0x382c39[_0x82cd('0x1e')];var _0x1db91b;if(_0x2b40d5>=_0x4eccc8){_0x2b40d5=_0x4eccc8;_0x1db91b=0xc8;}else{_0x1db91b=0xce;}_0x1276de[_0x82cd('0x19')](_0x1db91b);return _0x1276de[_0x82cd('0x1f')](_0x82cd('0x20'),_0x344485+'-'+_0x2b40d5+'/'+_0x4eccc8)[_0x82cd('0x1b')](_0x172982);}return null;};}function patchUpdates(_0x56abea){return function(_0x2907b7){try{jsonpatch[_0x82cd('0x21')](_0x2907b7,_0x56abea,!![]);}catch(_0x543606){return BPromise[_0x82cd('0x22')](_0x543606);}return _0x2907b7[_0x82cd('0x23')]();};}function saveUpdates(_0x404a86,_0xbe0ad9){return function(_0x4dbe5){if(_0x4dbe5){return _0x4dbe5[_0x82cd('0x24')](_0x404a86)[_0x82cd('0x25')](function(_0x35bc8f){return _0x35bc8f;});}return null;};}function removeEntity(_0x1edde3,_0x3c69eb){return function(_0x3b5b09){if(_0x3b5b09){return _0x3b5b09[_0x82cd('0x26')]()['then'](function(){_0x1edde3[_0x82cd('0x19')](0xcc)[_0x82cd('0x1a')]();});}};}function handleEntityNotFound(_0x31b506,_0x22c6c9){return function(_0x4f6aa6){if(!_0x4f6aa6){_0x31b506[_0x82cd('0x18')](0x194);}return _0x4f6aa6;};}function handleError(_0x50ca0e,_0x226a40){_0x226a40=_0x226a40||0x1f4;return function(_0x3d27f8){logger[_0x82cd('0x27')](_0x3d27f8['stack']);if(_0x3d27f8[_0x82cd('0x28')]){delete _0x3d27f8['name'];}_0x50ca0e[_0x82cd('0x19')](_0x226a40)[_0x82cd('0x29')](_0x3d27f8);};}exports[_0x82cd('0x2a')]=function(_0x106393,_0x138375){var _0x3836b1={},_0x1759c1={},_0x19b91a={'count':0x0,'rows':[]};var _0x492125=_[_0x82cd('0x2b')](db[_0x82cd('0x2c')][_0x82cd('0x2d')],function(_0x503152){return{'name':_0x503152['fieldName'],'type':_0x503152[_0x82cd('0x2e')]['key']};});_0x1759c1['model']=_['map'](_0x492125,'name');_0x1759c1['query']=_[_0x82cd('0x2f')](_0x106393['query']);_0x1759c1[_0x82cd('0x30')]=_[_0x82cd('0x31')](_0x1759c1[_0x82cd('0x32')],_0x1759c1['query']);_0x3836b1[_0x82cd('0x33')]=_['intersection'](_0x1759c1[_0x82cd('0x32')],qs[_0x82cd('0x34')](_0x106393[_0x82cd('0x35')][_0x82cd('0x34')]));_0x3836b1[_0x82cd('0x33')]=_0x3836b1[_0x82cd('0x33')]['length']?_0x3836b1['attributes']:_0x1759c1[_0x82cd('0x32')];if(!_0x106393['query'][_0x82cd('0x36')](_0x82cd('0x37'))){_0x3836b1['limit']=qs[_0x82cd('0x1e')](_0x106393[_0x82cd('0x35')][_0x82cd('0x1e')]);_0x3836b1[_0x82cd('0x1c')]=qs[_0x82cd('0x1c')](_0x106393[_0x82cd('0x35')][_0x82cd('0x1c')]);}_0x3836b1['order']=qs[_0x82cd('0x38')](_0x106393[_0x82cd('0x35')][_0x82cd('0x38')]);_0x3836b1[_0x82cd('0x39')]=qs[_0x82cd('0x30')](_[_0x82cd('0x3a')](_0x106393[_0x82cd('0x35')],_0x1759c1[_0x82cd('0x30')]),_0x492125);if(_0x106393['query'][_0x82cd('0x3b')]){_0x3836b1[_0x82cd('0x39')]=_[_0x82cd('0x3c')](_0x3836b1['where'],{'$or':_[_0x82cd('0x2b')](_0x492125,function(_0x5a9a24){if(_0x5a9a24[_0x82cd('0x2e')]!==_0x82cd('0x3d')){var _0x51ee2b={};_0x51ee2b[_0x5a9a24['name']]={'$like':'%'+_0x106393['query'][_0x82cd('0x3b')]+'%'};return _0x51ee2b;}})});}_0x3836b1=_['merge']({},_0x3836b1,_0x106393[_0x82cd('0x3e')]);var _0x3262b8={'where':_0x3836b1['where']};return db[_0x82cd('0x2c')][_0x82cd('0x1d')](_0x3262b8)['then'](function(_0x4a098d){_0x19b91a[_0x82cd('0x1d')]=_0x4a098d;if(_0x106393[_0x82cd('0x35')][_0x82cd('0x3f')]){_0x3836b1[_0x82cd('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x82cd('0x41')](_0x3836b1);})[_0x82cd('0x25')](function(_0x3ca70e){_0x19b91a['rows']=_0x3ca70e;return _0x19b91a;})[_0x82cd('0x25')](respondWithFilteredResult(_0x138375,_0x3836b1))[_0x82cd('0x42')](handleError(_0x138375,null));};exports[_0x82cd('0x43')]=function(_0x3cb689,_0x40087f){var _0xe42493={'raw':![],'where':{'id':_0x3cb689[_0x82cd('0x44')]['id']}},_0x3ed059={};_0x3ed059[_0x82cd('0x32')]=_[_0x82cd('0x2f')](db[_0x82cd('0x2c')][_0x82cd('0x2d')]);_0x3ed059['query']=_[_0x82cd('0x2f')](_0x3cb689[_0x82cd('0x35')]);_0x3ed059['filters']=_['intersection'](_0x3ed059[_0x82cd('0x32')],_0x3ed059[_0x82cd('0x35')]);_0xe42493[_0x82cd('0x33')]=_[_0x82cd('0x31')](_0x3ed059[_0x82cd('0x32')],qs[_0x82cd('0x34')](_0x3cb689[_0x82cd('0x35')][_0x82cd('0x34')]));_0xe42493['attributes']=_0xe42493['attributes']['length']?_0xe42493[_0x82cd('0x33')]:_0x3ed059[_0x82cd('0x32')];if(_0x3cb689[_0x82cd('0x35')][_0x82cd('0x3f')]){_0xe42493[_0x82cd('0x40')]=[{'all':!![]}];}_0xe42493=_[_0x82cd('0x3c')]({},_0xe42493,_0x3cb689[_0x82cd('0x3e')]);return db[_0x82cd('0x2c')][_0x82cd('0x45')](_0xe42493)['then'](handleEntityNotFound(_0x40087f,null))[_0x82cd('0x25')](respondWithResult(_0x40087f,null))['catch'](handleError(_0x40087f,null));};exports[_0x82cd('0x46')]=function(_0x34b367,_0x5a5a98){return db[_0x82cd('0x2c')][_0x82cd('0x46')](_0x34b367['body'],{})[_0x82cd('0x25')](respondWithResult(_0x5a5a98,0xc9))[_0x82cd('0x42')](handleError(_0x5a5a98,null));};exports[_0x82cd('0x24')]=function(_0x21bef8,_0x5a8f3b){if(_0x21bef8[_0x82cd('0x47')]['id']){delete _0x21bef8[_0x82cd('0x47')]['id'];}return db[_0x82cd('0x2c')]['find']({'where':{'id':_0x21bef8[_0x82cd('0x44')]['id']}})[_0x82cd('0x25')](handleEntityNotFound(_0x5a8f3b,null))[_0x82cd('0x25')](saveUpdates(_0x21bef8[_0x82cd('0x47')],null))[_0x82cd('0x25')](respondWithResult(_0x5a8f3b,null))[_0x82cd('0x42')](handleError(_0x5a8f3b,null));};exports[_0x82cd('0x26')]=function(_0x2bf581,_0x4a5b79){return db[_0x82cd('0x2c')][_0x82cd('0x45')]({'where':{'id':_0x2bf581[_0x82cd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a5b79,null))[_0x82cd('0x25')](removeEntity(_0x4a5b79,null))[_0x82cd('0x42')](handleError(_0x4a5b79,null));};exports[_0x82cd('0x48')]=function(_0x99e8d8,_0x326072,_0x3cf96e){var _0xacead6={};var _0x3b991b={};var _0x270b79;var _0x5630d9;return db[_0x82cd('0x2c')]['findOne']({'where':{'id':_0x99e8d8[_0x82cd('0x44')]['id']}})[_0x82cd('0x25')](handleEntityNotFound(_0x326072,null))[_0x82cd('0x25')](function(_0x88be37){if(_0x88be37){_0x270b79=_0x88be37;_0x3b991b[_0x82cd('0x32')]=_[_0x82cd('0x2f')](db[_0x82cd('0x49')][_0x82cd('0x2d')]);_0x3b991b[_0x82cd('0x35')]=_[_0x82cd('0x2f')](_0x99e8d8[_0x82cd('0x35')]);_0x3b991b[_0x82cd('0x30')]=_[_0x82cd('0x31')](_0x3b991b['model'],_0x3b991b[_0x82cd('0x35')]);_0xacead6[_0x82cd('0x33')]=_[_0x82cd('0x31')](_0x3b991b[_0x82cd('0x32')],qs[_0x82cd('0x34')](_0x99e8d8['query'][_0x82cd('0x34')]));_0xacead6[_0x82cd('0x33')]=_0xacead6[_0x82cd('0x33')][_0x82cd('0x4a')]?_0xacead6[_0x82cd('0x33')]:_0x3b991b['model'];_0xacead6['order']=qs[_0x82cd('0x38')](_0x99e8d8[_0x82cd('0x35')]['sort']);_0xacead6[_0x82cd('0x39')]=qs[_0x82cd('0x30')](_['pick'](_0x99e8d8[_0x82cd('0x35')],_0x3b991b[_0x82cd('0x30')]));if(_0x99e8d8[_0x82cd('0x35')][_0x82cd('0x3b')]){_0xacead6[_0x82cd('0x39')]=_[_0x82cd('0x3c')](_0xacead6[_0x82cd('0x39')],{'$or':_[_0x82cd('0x2b')](_0xacead6['attributes'],function(_0x1e9d6c){var _0xd45898={};_0xd45898[_0x1e9d6c]={'$like':'%'+_0x99e8d8['query'][_0x82cd('0x3b')]+'%'};return _0xd45898;})});}_0xacead6=_[_0x82cd('0x3c')]({},_0xacead6,_0x99e8d8[_0x82cd('0x3e')]);return _0x270b79[_0x82cd('0x48')](_0xacead6);}})[_0x82cd('0x25')](function(_0x1064f9){if(_0x1064f9){_0x5630d9=_0x1064f9[_0x82cd('0x4a')];if(!_0x99e8d8[_0x82cd('0x35')][_0x82cd('0x36')](_0x82cd('0x37'))){_0xacead6[_0x82cd('0x1e')]=qs[_0x82cd('0x1e')](_0x99e8d8['query'][_0x82cd('0x1e')]);_0xacead6[_0x82cd('0x1c')]=qs[_0x82cd('0x1c')](_0x99e8d8['query']['offset']);}return _0x270b79['getConfigurations'](_0xacead6);}})['then'](function(_0xc67462){if(_0xc67462){return _0xc67462?{'count':_0x5630d9,'rows':_0xc67462}:null;}})[_0x82cd('0x25')](respondWithResult(_0x326072,null))['catch'](handleError(_0x326072,null));};exports[_0x82cd('0x4b')]=function(_0x1737d7,_0x40b112,_0x41a1ec){if(_0x1737d7[_0x82cd('0x47')]['id']){delete _0x1737d7[_0x82cd('0x47')]['id'];}return db[_0x82cd('0x2c')][_0x82cd('0x4c')]({'where':{'id':_0x1737d7['params']['id']}})[_0x82cd('0x25')](handleEntityNotFound(_0x40b112,null))['then'](function(_0x40ee0b){if(_0x40ee0b){_0x1737d7[_0x82cd('0x47')][_0x82cd('0x4d')]=_0x40ee0b['id'];_0x1737d7['body'][_0x82cd('0x4e')]=integrations[_0x82cd('0x4f')](_0x1737d7[_0x82cd('0x47')][_0x82cd('0x50')],_0x1737d7[_0x82cd('0x47')][_0x82cd('0x2e')]);_0x1737d7['body'][_0x82cd('0x51')]=integrations[_0x82cd('0x52')](_0x1737d7[_0x82cd('0x47')][_0x82cd('0x50')],_0x1737d7[_0x82cd('0x47')]['type']);return db['SalesforceConfiguration']['create'](_0x1737d7['body'],{'include':[{'model':db[_0x82cd('0x53')],'as':_0x82cd('0x4e')},{'model':db[_0x82cd('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x40b112,null))[_0x82cd('0x42')](handleError(_0x40b112,null));};exports['getFields']=function(_0x5807d0,_0x2fe23f,_0x5148ca){var _0x2d0abb;var _0xd206a4='';var _0x4f30c1=_0x82cd('0x54');return db[_0x82cd('0x2c')]['findOne']({'where':{'id':_0x5807d0[_0x82cd('0x44')]['id']},'attributes':['id','remoteUri',_0x82cd('0x55'),'clientSecret','username','password',_0x82cd('0x56')]})[_0x82cd('0x25')](handleEntityNotFound(_0x2fe23f,null))['then'](function(_0x1cb05d){if(_0x1cb05d){_0xd206a4=_0x1cb05d['remoteUri'];var _0x2b471c=_0xd206a4[_0x82cd('0x57')](-0x1);if(_0x2b471c==='/'){_0xd206a4=_0xd206a4['substring'](0x0,_0xd206a4[_0x82cd('0x58')](_0x2b471c));}_0x2d0abb=new jsforce[(_0x82cd('0x59'))]({'oauth2':{'loginUrl':_0xd206a4,'clientId':_0x1cb05d['clientId'],'clientSecret':_0x1cb05d[_0x82cd('0x5a')]}});return _0x2d0abb[_0x82cd('0x5b')](_0x1cb05d[_0x82cd('0x5c')],_0x1cb05d[_0x82cd('0x5d')]['concat'](_0x1cb05d[_0x82cd('0x56')]));}})[_0x82cd('0x25')](function(_0x2929e0){if(_0x2929e0){if(!_[_0x82cd('0x5e')](_0x5807d0[_0x82cd('0x35')]['ticketType'])){_0x4f30c1=_0x5807d0[_0x82cd('0x35')][_0x82cd('0x5f')];}return _0x2d0abb[_0x82cd('0x60')](_0x4f30c1)[_0x82cd('0x61')]();}})[_0x82cd('0x25')](function(_0x546159){var _0x245e2d=['OwnerId','ActivityDate',_0x82cd('0x62'),_0x82cd('0x63'),_0x82cd('0x64'),_0x82cd('0x65')];var _0x44781d=[_0x82cd('0x66'),_0x82cd('0x67'),_0x82cd('0x68'),_0x82cd('0x69'),_0x82cd('0x6a'),_0x82cd('0x6b'),'phone'];if(_0x546159){_[_0x82cd('0x6c')](_0x546159[_0x82cd('0x34')],function(_0x3f5709){return _0x245e2d[_0x82cd('0x6d')](_0x3f5709[_0x82cd('0x28')])||!_0x44781d[_0x82cd('0x6d')](_0x3f5709['type']);});return{'count':_0x546159[_0x82cd('0x34')][_0x82cd('0x4a')],'rows':_[_0x82cd('0x2b')](_0x546159[_0x82cd('0x34')],function(_0x87824d){return{'id':_0x87824d['name'],'name':_0x87824d[_0x82cd('0x6e')],'custom':_0x87824d[_0x82cd('0x6f')],'options':_0x87824d['picklistValues']['length']>0x0?_[_0x82cd('0x2b')](_0x87824d[_0x82cd('0x70')],function(_0x31cd08){return{'name':_0x31cd08[_0x82cd('0x6e')],'value':_0x31cd08[_0x82cd('0x71')]};}):_0x87824d[_0x82cd('0x2e')]==_0x82cd('0x69')?[{'name':_0x82cd('0x72'),'value':_0x82cd('0x73')},{'name':_0x82cd('0x74'),'value':_0x82cd('0x75')}]:[]};})};}})[_0x82cd('0x25')](respondWithResult(_0x2fe23f,null))[_0x82cd('0x42')](function(_0x11f7d8){var _0x4a3c21=_0x5807d0[_0x82cd('0x35')]['test']?0x1f4:_0x11f7d8['statusCode']||0x1f4;logger[_0x82cd('0x27')](_0x82cd('0x76'),_0x82cd('0x77'),_0x4a3c21,JSON[_0x82cd('0x78')](_0x11f7d8));delete _0x11f7d8[_0x82cd('0x28')];if(_0x4a3c21===0x191){_0x4a3c21=0x190;}_0x2fe23f['status'](_0x4a3c21)[_0x82cd('0x29')](_0x5807d0[_0x82cd('0x35')][_0x82cd('0x79')]?{'message':_0x82cd('0x7a'),'statusCode':_0x11f7d8[_0x82cd('0x7b')]}:_0x11f7d8);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9056a41..2904b29 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 _0xffab=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xffab,0x1a5));var _0xbffa=function(_0x59dad8,_0x399fc5){_0x59dad8=_0x59dad8-0x0;var _0x1f02df=_0xffab[_0x59dad8];return _0x1f02df;};'use strict';var _=require(_0xbffa('0x0'));var util=require(_0xbffa('0x1'));var logger=require(_0xbffa('0x2'))('api');var moment=require(_0xbffa('0x3'));var BPromise=require(_0xbffa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbffa('0x5'));var rimraf=require(_0xbffa('0x6'));var config=require(_0xbffa('0x7'));var attributes=require(_0xbffa('0x8'));var integrations=require(_0xbffa('0x9'));module[_0xbffa('0xa')]=function(_0x416045,_0x5e33d3){return _0x416045[_0xbffa('0xb')]('SalesforceAccount',attributes,{'tableName':_0xbffa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xece2=['int_salesforce_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount'];(function(_0x7548d9,_0x23ecb8){var _0x3e2ac0=function(_0x47457b){while(--_0x47457b){_0x7548d9['push'](_0x7548d9['shift']());}};_0x3e2ac0(++_0x23ecb8);}(_0xece2,0xd9));var _0x2ece=function(_0x3662a7,_0x1a1ca4){_0x3662a7=_0x3662a7-0x0;var _0x295866=_0xece2[_0x3662a7];return _0x295866;};'use strict';var _=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var logger=require(_0x2ece('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2ece('0x3'));var rp=require(_0x2ece('0x4'));var fs=require('fs');var path=require(_0x2ece('0x5'));var rimraf=require(_0x2ece('0x6'));var config=require('../../config/environment');var attributes=require(_0x2ece('0x7'));var integrations=require(_0x2ece('0x8'));module['exports']=function(_0x2fcd25,_0x46917a){return _0x2fcd25[_0x2ece('0x9')](_0x2ece('0xa'),attributes,{'tableName':_0x2ece('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 73e49f2..7e6fb7a 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 _0x2e32=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetSalesforceAccount','findAll','options','attributes','limit','map','include','model','stringify','ShowSalesforceAccount','find','where','lodash','moment','bluebird'];(function(_0x4474c2,_0x59cf02){var _0x435fbb=function(_0x3c86eb){while(--_0x3c86eb){_0x4474c2['push'](_0x4474c2['shift']());}};_0x435fbb(++_0x59cf02);}(_0x2e32,0x12f));var _0x22e3=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x2e32[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x22e3('0x0'));var util=require('util');var moment=require(_0x22e3('0x1'));var BPromise=require(_0x22e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22e3('0x3'));var db=require(_0x22e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22e3('0x5'))(_0x22e3('0x6'));var config=require(_0x22e3('0x7'));var jayson=require(_0x22e3('0x8'));var client=jayson[_0x22e3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c4886,_0x3d9677,_0x38f32b){return new BPromise(function(_0x4951e1,_0x17b36c){return client[_0x22e3('0xa')](_0x2c4886,_0x38f32b)[_0x22e3('0xb')](function(_0x4275e9){logger['info'](_0x22e3('0xc'),_0x3d9677,'request\x20sent');logger[_0x22e3('0xd')](_0x22e3('0xe'),_0x3d9677,_0x22e3('0xf'),JSON['stringify'](_0x4275e9));if(_0x4275e9[_0x22e3('0x10')]){if(_0x4275e9['error'][_0x22e3('0x11')]===0x1f4){logger[_0x22e3('0x10')](_0x22e3('0xc'),_0x3d9677,_0x4275e9[_0x22e3('0x10')]['message']);return _0x17b36c(_0x4275e9[_0x22e3('0x10')]['message']);}logger[_0x22e3('0x10')](_0x22e3('0xc'),_0x3d9677,_0x4275e9[_0x22e3('0x10')][_0x22e3('0x12')]);return _0x4951e1(_0x4275e9[_0x22e3('0x10')][_0x22e3('0x12')]);}else{logger[_0x22e3('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x3d9677,_0x22e3('0xf'));_0x4951e1(_0x4275e9[_0x22e3('0x14')][_0x22e3('0x12')]);}})[_0x22e3('0x15')](function(_0x437cb4){logger[_0x22e3('0x10')](_0x22e3('0xc'),_0x3d9677,_0x437cb4);_0x17b36c(_0x437cb4);});});}exports[_0x22e3('0x16')]=function(_0x2f9e71){var _0x42d79c=this;return new Promise(function(_0xc60fb5,_0x5117bf){return db['SalesforceAccount'][_0x22e3('0x17')]({'raw':_0x2f9e71['options']?_0x2f9e71[_0x22e3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2f9e71['options']?_0x2f9e71[_0x22e3('0x18')]['where']||null:null,'attributes':_0x2f9e71['options']?_0x2f9e71[_0x22e3('0x18')][_0x22e3('0x19')]||null:null,'limit':_0x2f9e71[_0x22e3('0x18')]?_0x2f9e71[_0x22e3('0x18')][_0x22e3('0x1a')]||null:null,'include':_0x2f9e71[_0x22e3('0x18')]?_0x2f9e71[_0x22e3('0x18')]['include']?_[_0x22e3('0x1b')](_0x2f9e71[_0x22e3('0x18')][_0x22e3('0x1c')],function(_0x52f696){return{'model':db[_0x52f696[_0x22e3('0x1d')]],'as':_0x52f696['as'],'attributes':_0x52f696[_0x22e3('0x19')],'include':_0x52f696[_0x22e3('0x1c')]?_[_0x22e3('0x1b')](_0x52f696['include'],function(_0x2ff634){return{'model':db[_0x2ff634[_0x22e3('0x1d')]],'as':_0x2ff634['as'],'attributes':_0x2ff634[_0x22e3('0x19')],'include':_0x2ff634[_0x22e3('0x1c')]?_[_0x22e3('0x1b')](_0x2ff634['include'],function(_0x4b3978){return{'model':db[_0x4b3978[_0x22e3('0x1d')]],'as':_0x4b3978['as'],'attributes':_0x4b3978[_0x22e3('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13104a){logger[_0x22e3('0x13')](_0x22e3('0x16'),_0x2f9e71);logger['debug'](_0x22e3('0x16'),_0x2f9e71,JSON[_0x22e3('0x1e')](_0x13104a));_0xc60fb5(_0x13104a);})[_0x22e3('0x15')](function(_0x327b43){logger['error']('GetSalesforceAccount',_0x327b43[_0x22e3('0x12')],_0x2f9e71);_0x5117bf(_0x42d79c['error'](0x1f4,_0x327b43[_0x22e3('0x12')]));});});};exports[_0x22e3('0x1f')]=function(_0x21485b){var _0x3b62aa=this;return new Promise(function(_0x1cfdbe,_0x4a972c){return db['SalesforceAccount'][_0x22e3('0x20')]({'raw':_0x21485b[_0x22e3('0x18')]?_0x21485b[_0x22e3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21485b[_0x22e3('0x18')]?_0x21485b['options'][_0x22e3('0x21')]||null:null,'attributes':_0x21485b[_0x22e3('0x18')]?_0x21485b[_0x22e3('0x18')]['attributes']||null:null,'include':_0x21485b[_0x22e3('0x18')]?_0x21485b['options'][_0x22e3('0x1c')]?_[_0x22e3('0x1b')](_0x21485b['options']['include'],function(_0x4895ce){return{'model':db[_0x4895ce[_0x22e3('0x1d')]],'as':_0x4895ce['as'],'attributes':_0x4895ce['attributes'],'include':_0x4895ce[_0x22e3('0x1c')]?_[_0x22e3('0x1b')](_0x4895ce[_0x22e3('0x1c')],function(_0x41d894){return{'model':db[_0x41d894[_0x22e3('0x1d')]],'as':_0x41d894['as'],'attributes':_0x41d894[_0x22e3('0x19')],'include':_0x41d894['include']?_[_0x22e3('0x1b')](_0x41d894['include'],function(_0x7aaa2){return{'model':db[_0x7aaa2['model']],'as':_0x7aaa2['as'],'attributes':_0x7aaa2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x198836){logger[_0x22e3('0x13')](_0x22e3('0x1f'),_0x21485b);logger[_0x22e3('0xd')](_0x22e3('0x1f'),_0x21485b,JSON[_0x22e3('0x1e')](_0x198836));_0x1cfdbe(_0x198836);})[_0x22e3('0x15')](function(_0x38dda2){logger[_0x22e3('0x10')](_0x22e3('0x1f'),_0x38dda2['message'],_0x21485b);_0x4a972c(_0x3b62aa[_0x22e3('0x10')](0x1f4,_0x38dda2[_0x22e3('0x12')]));});});}; \ No newline at end of file +var _0xd2fa=['raw','where','attributes','limit','include','model','map','GetSalesforceAccount','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','catch','SalesforceAccount','findAll','options'];(function(_0x5424a7,_0x26b579){var _0x574ec0=function(_0x131661){while(--_0x131661){_0x5424a7['push'](_0x5424a7['shift']());}};_0x574ec0(++_0x26b579);}(_0xd2fa,0x161));var _0xad2f=function(_0x5258cc,_0x395ea1){_0x5258cc=_0x5258cc-0x0;var _0x5235c5=_0xd2fa[_0x5258cc];return _0x5235c5;};'use strict';var _=require(_0xad2f('0x0'));var util=require(_0xad2f('0x1'));var moment=require(_0xad2f('0x2'));var BPromise=require(_0xad2f('0x3'));var rs=require(_0xad2f('0x4'));var fs=require('fs');var Redis=require(_0xad2f('0x5'));var db=require(_0xad2f('0x6'))['db'];var utils=require(_0xad2f('0x7'));var logger=require(_0xad2f('0x8'))(_0xad2f('0x9'));var config=require('../../config/environment');var jayson=require(_0xad2f('0xa'));var client=jayson['client'][_0xad2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f63c,_0xd35d9b,_0x373246){return new BPromise(function(_0x5f14e3,_0x13e54f){return client[_0xad2f('0xc')](_0x52f63c,_0x373246)[_0xad2f('0xd')](function(_0x2640c0){logger[_0xad2f('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0xd35d9b,'request\x20sent');logger['debug'](_0xad2f('0xf'),_0xd35d9b,_0xad2f('0x10'),JSON[_0xad2f('0x11')](_0x2640c0));if(_0x2640c0[_0xad2f('0x12')]){if(_0x2640c0[_0xad2f('0x12')][_0xad2f('0x13')]===0x1f4){logger[_0xad2f('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0xd35d9b,_0x2640c0[_0xad2f('0x12')][_0xad2f('0x14')]);return _0x13e54f(_0x2640c0[_0xad2f('0x12')][_0xad2f('0x14')]);}logger[_0xad2f('0x12')](_0xad2f('0x15'),_0xd35d9b,_0x2640c0['error'][_0xad2f('0x14')]);return _0x5f14e3(_0x2640c0[_0xad2f('0x12')][_0xad2f('0x14')]);}else{logger[_0xad2f('0xe')](_0xad2f('0x15'),_0xd35d9b,'request\x20sent');_0x5f14e3(_0x2640c0[_0xad2f('0x16')][_0xad2f('0x14')]);}})[_0xad2f('0x17')](function(_0x1699b7){logger[_0xad2f('0x12')](_0xad2f('0x15'),_0xd35d9b,_0x1699b7);_0x13e54f(_0x1699b7);});});}exports['GetSalesforceAccount']=function(_0x570191){var _0x322fc7=this;return new Promise(function(_0x1f09cd,_0x3d63ce){return db[_0xad2f('0x18')][_0xad2f('0x19')]({'raw':_0x570191[_0xad2f('0x1a')]?_0x570191[_0xad2f('0x1a')][_0xad2f('0x1b')]===undefined?!![]:![]:!![],'where':_0x570191[_0xad2f('0x1a')]?_0x570191[_0xad2f('0x1a')][_0xad2f('0x1c')]||null:null,'attributes':_0x570191[_0xad2f('0x1a')]?_0x570191[_0xad2f('0x1a')][_0xad2f('0x1d')]||null:null,'limit':_0x570191[_0xad2f('0x1a')]?_0x570191[_0xad2f('0x1a')][_0xad2f('0x1e')]||null:null,'include':_0x570191['options']?_0x570191[_0xad2f('0x1a')][_0xad2f('0x1f')]?_['map'](_0x570191[_0xad2f('0x1a')]['include'],function(_0x59381e){return{'model':db[_0x59381e[_0xad2f('0x20')]],'as':_0x59381e['as'],'attributes':_0x59381e['attributes'],'include':_0x59381e[_0xad2f('0x1f')]?_[_0xad2f('0x21')](_0x59381e[_0xad2f('0x1f')],function(_0x2c7a0a){return{'model':db[_0x2c7a0a[_0xad2f('0x20')]],'as':_0x2c7a0a['as'],'attributes':_0x2c7a0a[_0xad2f('0x1d')],'include':_0x2c7a0a['include']?_['map'](_0x2c7a0a[_0xad2f('0x1f')],function(_0x2f0537){return{'model':db[_0x2f0537[_0xad2f('0x20')]],'as':_0x2f0537['as'],'attributes':_0x2f0537[_0xad2f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xad2f('0xd')](function(_0x84b8c2){logger[_0xad2f('0xe')](_0xad2f('0x22'),_0x570191);logger[_0xad2f('0x23')]('GetSalesforceAccount',_0x570191,JSON['stringify'](_0x84b8c2));_0x1f09cd(_0x84b8c2);})[_0xad2f('0x17')](function(_0x34035e){logger[_0xad2f('0x12')](_0xad2f('0x22'),_0x34035e[_0xad2f('0x14')],_0x570191);_0x3d63ce(_0x322fc7[_0xad2f('0x12')](0x1f4,_0x34035e[_0xad2f('0x14')]));});});};exports[_0xad2f('0x24')]=function(_0x44b150){var _0x1610d5=this;return new Promise(function(_0x433c86,_0x18a2f0){return db[_0xad2f('0x18')][_0xad2f('0x25')]({'raw':_0x44b150[_0xad2f('0x1a')]?_0x44b150[_0xad2f('0x1a')][_0xad2f('0x1b')]===undefined?!![]:![]:!![],'where':_0x44b150[_0xad2f('0x1a')]?_0x44b150[_0xad2f('0x1a')][_0xad2f('0x1c')]||null:null,'attributes':_0x44b150['options']?_0x44b150['options'][_0xad2f('0x1d')]||null:null,'include':_0x44b150[_0xad2f('0x1a')]?_0x44b150['options']['include']?_[_0xad2f('0x21')](_0x44b150['options'][_0xad2f('0x1f')],function(_0x2329da){return{'model':db[_0x2329da[_0xad2f('0x20')]],'as':_0x2329da['as'],'attributes':_0x2329da[_0xad2f('0x1d')],'include':_0x2329da[_0xad2f('0x1f')]?_[_0xad2f('0x21')](_0x2329da[_0xad2f('0x1f')],function(_0x18e7fc){return{'model':db[_0x18e7fc[_0xad2f('0x20')]],'as':_0x18e7fc['as'],'attributes':_0x18e7fc[_0xad2f('0x1d')],'include':_0x18e7fc[_0xad2f('0x1f')]?_['map'](_0x18e7fc[_0xad2f('0x1f')],function(_0x45eb31){return{'model':db[_0x45eb31[_0xad2f('0x20')]],'as':_0x45eb31['as'],'attributes':_0x45eb31[_0xad2f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xad2f('0xd')](function(_0x1b93e8){logger[_0xad2f('0xe')](_0xad2f('0x24'),_0x44b150);logger[_0xad2f('0x23')](_0xad2f('0x24'),_0x44b150,JSON[_0xad2f('0x11')](_0x1b93e8));_0x433c86(_0x1b93e8);})[_0xad2f('0x17')](function(_0x415185){logger[_0xad2f('0x12')](_0xad2f('0x24'),_0x415185[_0xad2f('0x14')],_0x44b150);_0x18a2f0(_0x1610d5[_0xad2f('0x12')](0x1f4,_0x415185[_0xad2f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3f174bd..7c69481 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(_0x137ea4,_0x99e607){var _0x2197ea=function(_0x557fa4){while(--_0x557fa4){_0x137ea4['push'](_0x137ea4['shift']());}};_0x2197ea(++_0x99e607);}(_0x5f2f,0x73));var _0xf5f2=function(_0x544d84,_0x7dba39){_0x544d84=_0x544d84-0x0;var _0x52e3d4=_0x5f2f[_0x544d84];return _0x52e3d4;};'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(_0x1a4112,_0xeda4f2){var _0x244baa=function(_0x5d8718){while(--_0x5d8718){_0x1a4112['push'](_0x1a4112['shift']());}};_0x244baa(++_0xeda4f2);}(_0x2ef3,0xba));var _0x32ef=function(_0x2d4b92,_0x65a2f){_0x2d4b92=_0x2d4b92-0x0;var _0x177335=_0x2ef3[_0x2d4b92];return _0x177335;};'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 f90c34d..de158cf 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 _0xd0af=['ENUM','Task','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING'];(function(_0x4e889a,_0x2ef4eb){var _0x3eae25=function(_0x2cbb83){while(--_0x2cbb83){_0x4e889a['push'](_0x4e889a['shift']());}};_0x3eae25(++_0x2ef4eb);}(_0xd0af,0x1cb));var _0xfd0a=function(_0x5f1e1c,_0x329fc6){_0x5f1e1c=_0x5f1e1c-0x0;var _0x5981f5=_0xd0af[_0x5f1e1c];return _0x5981f5;};'use strict';var Sequelize=require(_0xfd0a('0x0'));module[_0xfd0a('0x1')]={'name':{'type':Sequelize[_0xfd0a('0x2')]},'description':{'type':Sequelize[_0xfd0a('0x2')]},'ticketType':{'type':Sequelize[_0xfd0a('0x3')]('Task','Case'),'defaultValue':_0xfd0a('0x4')},'moduleSearch':{'type':Sequelize[_0xfd0a('0x3')](_0xfd0a('0x5'),_0xfd0a('0x6'),_0xfd0a('0x7'),_0xfd0a('0x8'),_0xfd0a('0x9')),'defaultValue':_0xfd0a('0x5')},'moduleCreate':{'type':Sequelize[_0xfd0a('0x3')](_0xfd0a('0xa'),'contact',_0xfd0a('0x7'),_0xfd0a('0x9')),'defaultValue':_0xfd0a('0x7')},'leadId':{'type':Sequelize[_0xfd0a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xfd0a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xfd0a('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xfd0a('0x2')]}}; \ No newline at end of file +var _0xc85d=['STRING','ENUM','Task','contact_lead','contact','lead','nothing','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc85d,0x19f));var _0xdc85=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xc85d[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require('sequelize');module[_0xdc85('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdc85('0x1')]},'ticketType':{'type':Sequelize[_0xdc85('0x2')](_0xdc85('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xdc85('0x4'),_0xdc85('0x5'),_0xdc85('0x6'),'account_contact_lead','account'),'defaultValue':_0xdc85('0x4')},'moduleCreate':{'type':Sequelize[_0xdc85('0x2')](_0xdc85('0x7'),_0xdc85('0x5'),_0xdc85('0x6'),'account'),'defaultValue':_0xdc85('0x6')},'leadId':{'type':Sequelize[_0xdc85('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xdc85('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xdc85('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xdc85('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index dd95dc1..3356ade 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 _0x0223=['filter','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','update','body','getFields','findOne','SalesforceField','length','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','type'];(function(_0x4ebf0d,_0x3089f0){var _0xd99f1b=function(_0x379e6d){while(--_0x379e6d){_0x4ebf0d['push'](_0x4ebf0d['shift']());}};_0xd99f1b(++_0x3089f0);}(_0x0223,0xaf));var _0x3022=function(_0x389da3,_0x1208ed){_0x389da3=_0x389da3-0x0;var _0x5a8e6c=_0x0223[_0x389da3];return _0x5a8e6c;};'use strict';var emlformat=require(_0x3022('0x0'));var rimraf=require(_0x3022('0x1'));var zipdir=require(_0x3022('0x2'));var jsonpatch=require(_0x3022('0x3'));var rp=require('request-promise');var moment=require(_0x3022('0x4'));var BPromise=require(_0x3022('0x5'));var Mustache=require(_0x3022('0x6'));var util=require(_0x3022('0x7'));var path=require(_0x3022('0x8'));var sox=require(_0x3022('0x9'));var csv=require(_0x3022('0xa'));var ejs=require(_0x3022('0xb'));var fs=require('fs');var fs_extra=require(_0x3022('0xc'));var _=require(_0x3022('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3022('0xe'));var toCsv=require(_0x3022('0xa'));var querystring=require('querystring');var Papa=require(_0x3022('0xf'));var Redis=require(_0x3022('0x10'));var authService=require(_0x3022('0x11'));var qs=require(_0x3022('0x12'));var as=require(_0x3022('0x13'));var hardwareService=require(_0x3022('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3022('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3022('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21f87f,_0x15caeb){_0x15caeb=_0x15caeb||0xcc;return function(_0x291843){if(_0x291843){return _0x21f87f[_0x3022('0x17')](_0x15caeb);}return _0x21f87f[_0x3022('0x18')](_0x15caeb)[_0x3022('0x19')]();};}function respondWithResult(_0x510c3a,_0x23d6fc){_0x23d6fc=_0x23d6fc||0xc8;return function(_0xcbb1b){if(_0xcbb1b){return _0x510c3a['status'](_0x23d6fc)[_0x3022('0x1a')](_0xcbb1b);}};}function respondWithFilteredResult(_0x4b79af,_0x1d5fd9){return function(_0x3dd72e){if(_0x3dd72e){var _0x55cedb=typeof _0x1d5fd9[_0x3022('0x1b')]==='undefined'&&typeof _0x1d5fd9[_0x3022('0x1c')]===_0x3022('0x1d');var _0x4ac59e=_0x3dd72e[_0x3022('0x1e')];var _0x32a891=_0x55cedb?0x0:_0x1d5fd9['offset'];var _0x15901d=_0x55cedb?_0x3dd72e[_0x3022('0x1e')]:_0x1d5fd9[_0x3022('0x1b')]+_0x1d5fd9[_0x3022('0x1c')];var _0x134348;if(_0x15901d>=_0x4ac59e){_0x15901d=_0x4ac59e;_0x134348=0xc8;}else{_0x134348=0xce;}_0x4b79af['status'](_0x134348);return _0x4b79af['set'](_0x3022('0x1f'),_0x32a891+'-'+_0x15901d+'/'+_0x4ac59e)[_0x3022('0x1a')](_0x3dd72e);}return null;};}function patchUpdates(_0x5e81d1){return function(_0x404dfb){try{jsonpatch[_0x3022('0x20')](_0x404dfb,_0x5e81d1,!![]);}catch(_0x3c0f9a){return BPromise[_0x3022('0x21')](_0x3c0f9a);}return _0x404dfb['save']();};}function saveUpdates(_0x32a945,_0x53947c){return function(_0xb6ca6c){if(_0xb6ca6c){return _0xb6ca6c['update'](_0x32a945)[_0x3022('0x22')](function(_0x1ba355){return _0x1ba355;});}return null;};}function removeEntity(_0x49da67,_0x4af23a){return function(_0xd7d37){if(_0xd7d37){return _0xd7d37[_0x3022('0x23')]()['then'](function(){_0x49da67[_0x3022('0x18')](0xcc)[_0x3022('0x19')]();});}};}function handleEntityNotFound(_0x417801,_0x5772f2){return function(_0x46e695){if(!_0x46e695){_0x417801[_0x3022('0x17')](0x194);}return _0x46e695;};}function handleError(_0x547081,_0x2b99e5){_0x2b99e5=_0x2b99e5||0x1f4;return function(_0x3c8ec1){logger[_0x3022('0x24')](_0x3c8ec1[_0x3022('0x25')]);if(_0x3c8ec1[_0x3022('0x26')]){delete _0x3c8ec1[_0x3022('0x26')];}_0x547081[_0x3022('0x18')](_0x2b99e5)['send'](_0x3c8ec1);};}exports['index']=function(_0x5e3738,_0x297d24){var _0x2cb86b={},_0x4525ba={},_0x15942d={'count':0x0,'rows':[]};var _0x49f49a=_[_0x3022('0x27')](db['SalesforceConfiguration'][_0x3022('0x28')],function(_0x5a96be){return{'name':_0x5a96be[_0x3022('0x29')],'type':_0x5a96be['type'][_0x3022('0x2a')]};});_0x4525ba[_0x3022('0x2b')]=_[_0x3022('0x27')](_0x49f49a,_0x3022('0x26'));_0x4525ba[_0x3022('0x2c')]=_['keys'](_0x5e3738[_0x3022('0x2c')]);_0x4525ba['filters']=_[_0x3022('0x2d')](_0x4525ba['model'],_0x4525ba[_0x3022('0x2c')]);_0x2cb86b[_0x3022('0x2e')]=_[_0x3022('0x2d')](_0x4525ba[_0x3022('0x2b')],qs['fields'](_0x5e3738[_0x3022('0x2c')][_0x3022('0x2f')]));_0x2cb86b[_0x3022('0x2e')]=_0x2cb86b[_0x3022('0x2e')]['length']?_0x2cb86b[_0x3022('0x2e')]:_0x4525ba[_0x3022('0x2b')];if(!_0x5e3738[_0x3022('0x2c')][_0x3022('0x30')](_0x3022('0x31'))){_0x2cb86b[_0x3022('0x1c')]=qs[_0x3022('0x1c')](_0x5e3738['query'][_0x3022('0x1c')]);_0x2cb86b[_0x3022('0x1b')]=qs[_0x3022('0x1b')](_0x5e3738['query'][_0x3022('0x1b')]);}_0x2cb86b['order']=qs[_0x3022('0x32')](_0x5e3738[_0x3022('0x2c')][_0x3022('0x32')]);_0x2cb86b[_0x3022('0x33')]=qs['filters'](_[_0x3022('0x34')](_0x5e3738['query'],_0x4525ba[_0x3022('0x35')]),_0x49f49a);if(_0x5e3738[_0x3022('0x2c')]['filter']){_0x2cb86b['where']=_[_0x3022('0x36')](_0x2cb86b[_0x3022('0x33')],{'$or':_[_0x3022('0x27')](_0x49f49a,function(_0x307a4f){if(_0x307a4f[_0x3022('0x37')]!=='VIRTUAL'){var _0x48611e={};_0x48611e[_0x307a4f[_0x3022('0x26')]]={'$like':'%'+_0x5e3738[_0x3022('0x2c')][_0x3022('0x38')]+'%'};return _0x48611e;}})});}_0x2cb86b=_[_0x3022('0x36')]({},_0x2cb86b,_0x5e3738[_0x3022('0x39')]);var _0x47e585={'where':_0x2cb86b[_0x3022('0x33')]};return db[_0x3022('0x3a')][_0x3022('0x1e')](_0x47e585)[_0x3022('0x22')](function(_0x1d2fd6){_0x15942d[_0x3022('0x1e')]=_0x1d2fd6;if(_0x5e3738['query'][_0x3022('0x3b')]){_0x2cb86b[_0x3022('0x3c')]=[{'all':!![]}];}return db[_0x3022('0x3a')][_0x3022('0x3d')](_0x2cb86b);})[_0x3022('0x22')](function(_0x23e9af){_0x15942d[_0x3022('0x3e')]=_0x23e9af;return _0x15942d;})[_0x3022('0x22')](respondWithFilteredResult(_0x297d24,_0x2cb86b))[_0x3022('0x3f')](handleError(_0x297d24,null));};exports[_0x3022('0x40')]=function(_0x12963e,_0x2567b6){var _0x399609={'raw':![],'where':{'id':_0x12963e[_0x3022('0x41')]['id']}},_0x5c4746={};_0x5c4746['model']=_[_0x3022('0x42')](db['SalesforceConfiguration'][_0x3022('0x28')]);_0x5c4746[_0x3022('0x2c')]=_[_0x3022('0x42')](_0x12963e[_0x3022('0x2c')]);_0x5c4746[_0x3022('0x35')]=_['intersection'](_0x5c4746[_0x3022('0x2b')],_0x5c4746['query']);_0x399609[_0x3022('0x2e')]=_[_0x3022('0x2d')](_0x5c4746[_0x3022('0x2b')],qs[_0x3022('0x2f')](_0x12963e['query'][_0x3022('0x2f')]));_0x399609[_0x3022('0x2e')]=_0x399609[_0x3022('0x2e')]['length']?_0x399609[_0x3022('0x2e')]:_0x5c4746[_0x3022('0x2b')];if(_0x12963e[_0x3022('0x2c')][_0x3022('0x3b')]){_0x399609[_0x3022('0x3c')]=[{'all':!![]}];}_0x399609=_[_0x3022('0x36')]({},_0x399609,_0x12963e['options']);return db[_0x3022('0x3a')]['find'](_0x399609)['then'](handleEntityNotFound(_0x2567b6,null))[_0x3022('0x22')](respondWithResult(_0x2567b6,null))[_0x3022('0x3f')](handleError(_0x2567b6,null));};exports[_0x3022('0x43')]=function(_0x1c785e,_0x332087){return db[_0x3022('0x3a')]['create'](_0x1c785e['body'],{})[_0x3022('0x22')](respondWithResult(_0x332087,0xc9))[_0x3022('0x3f')](handleError(_0x332087,null));};exports[_0x3022('0x44')]=function(_0x48bd80,_0x290802){if(_0x48bd80[_0x3022('0x45')]['id']){delete _0x48bd80['body']['id'];}return db[_0x3022('0x3a')]['find']({'where':{'id':_0x48bd80[_0x3022('0x41')]['id']}})[_0x3022('0x22')](handleEntityNotFound(_0x290802,null))['then'](saveUpdates(_0x48bd80[_0x3022('0x45')],null))[_0x3022('0x22')](respondWithResult(_0x290802,null))['catch'](handleError(_0x290802,null));};exports[_0x3022('0x23')]=function(_0x3ab19a,_0x51fcdd){return db['SalesforceConfiguration']['find']({'where':{'id':_0x3ab19a[_0x3022('0x41')]['id']}})[_0x3022('0x22')](handleEntityNotFound(_0x51fcdd,null))[_0x3022('0x22')](removeEntity(_0x51fcdd,null))['catch'](handleError(_0x51fcdd,null));};exports[_0x3022('0x46')]=function(_0x224f16,_0x1b0ce6,_0x5e4702){var _0x37cb74={};var _0x3450ed={};var _0x46bf63;var _0x13297a;return db[_0x3022('0x3a')][_0x3022('0x47')]({'where':{'id':_0x224f16[_0x3022('0x41')]['id']}})[_0x3022('0x22')](handleEntityNotFound(_0x1b0ce6,null))[_0x3022('0x22')](function(_0x49b708){if(_0x49b708){_0x46bf63=_0x49b708;_0x3450ed[_0x3022('0x2b')]=_[_0x3022('0x42')](db[_0x3022('0x48')][_0x3022('0x28')]);_0x3450ed[_0x3022('0x2c')]=_[_0x3022('0x42')](_0x224f16[_0x3022('0x2c')]);_0x3450ed['filters']=_[_0x3022('0x2d')](_0x3450ed[_0x3022('0x2b')],_0x3450ed[_0x3022('0x2c')]);_0x37cb74['attributes']=_[_0x3022('0x2d')](_0x3450ed['model'],qs['fields'](_0x224f16[_0x3022('0x2c')]['fields']));_0x37cb74[_0x3022('0x2e')]=_0x37cb74[_0x3022('0x2e')][_0x3022('0x49')]?_0x37cb74[_0x3022('0x2e')]:_0x3450ed['model'];_0x37cb74[_0x3022('0x4a')]=qs[_0x3022('0x32')](_0x224f16['query'][_0x3022('0x32')]);_0x37cb74['where']=qs[_0x3022('0x35')](_[_0x3022('0x34')](_0x224f16['query'],_0x3450ed[_0x3022('0x35')]));if(_0x224f16[_0x3022('0x2c')][_0x3022('0x38')]){_0x37cb74[_0x3022('0x33')]=_[_0x3022('0x36')](_0x37cb74[_0x3022('0x33')],{'$or':_[_0x3022('0x27')](_0x37cb74['attributes'],function(_0x1a8d85){var _0x34b3de={};_0x34b3de[_0x1a8d85]={'$like':'%'+_0x224f16[_0x3022('0x2c')][_0x3022('0x38')]+'%'};return _0x34b3de;})});}_0x37cb74=_[_0x3022('0x36')]({},_0x37cb74,_0x224f16[_0x3022('0x39')]);return _0x46bf63[_0x3022('0x46')](_0x37cb74);}})[_0x3022('0x22')](function(_0x410ce5){if(_0x410ce5){_0x13297a=_0x410ce5[_0x3022('0x49')];if(!_0x224f16['query'][_0x3022('0x30')](_0x3022('0x31'))){_0x37cb74[_0x3022('0x1c')]=qs['limit'](_0x224f16[_0x3022('0x2c')]['limit']);_0x37cb74[_0x3022('0x1b')]=qs[_0x3022('0x1b')](_0x224f16[_0x3022('0x2c')][_0x3022('0x1b')]);}return _0x46bf63['getFields'](_0x37cb74);}})[_0x3022('0x22')](function(_0x4c04ee){if(_0x4c04ee){return _0x4c04ee?{'count':_0x13297a,'rows':_0x4c04ee}:null;}})[_0x3022('0x22')](respondWithResult(_0x1b0ce6,null))[_0x3022('0x3f')](handleError(_0x1b0ce6,null));};exports[_0x3022('0x4b')]=function(_0x13eaad,_0x1a7826,_0x2b569b){var _0x3a26a2={};var _0xf4d18b={};var _0x104dd9;var _0x49910a;return db[_0x3022('0x3a')][_0x3022('0x47')]({'where':{'id':_0x13eaad[_0x3022('0x41')]['id']}})[_0x3022('0x22')](handleEntityNotFound(_0x1a7826,null))['then'](function(_0x37b713){if(_0x37b713){_0x104dd9=_0x37b713;_0xf4d18b[_0x3022('0x2b')]=_[_0x3022('0x42')](db[_0x3022('0x48')][_0x3022('0x28')]);_0xf4d18b[_0x3022('0x2c')]=_[_0x3022('0x42')](_0x13eaad[_0x3022('0x2c')]);_0xf4d18b[_0x3022('0x35')]=_[_0x3022('0x2d')](_0xf4d18b[_0x3022('0x2b')],_0xf4d18b[_0x3022('0x2c')]);_0x3a26a2[_0x3022('0x2e')]=_[_0x3022('0x2d')](_0xf4d18b[_0x3022('0x2b')],qs['fields'](_0x13eaad['query']['fields']));_0x3a26a2[_0x3022('0x2e')]=_0x3a26a2['attributes'][_0x3022('0x49')]?_0x3a26a2['attributes']:_0xf4d18b[_0x3022('0x2b')];_0x3a26a2[_0x3022('0x4a')]=qs[_0x3022('0x32')](_0x13eaad[_0x3022('0x2c')][_0x3022('0x32')]);_0x3a26a2[_0x3022('0x33')]=qs[_0x3022('0x35')](_[_0x3022('0x34')](_0x13eaad['query'],_0xf4d18b[_0x3022('0x35')]));if(_0x13eaad[_0x3022('0x2c')][_0x3022('0x38')]){_0x3a26a2['where']=_['merge'](_0x3a26a2[_0x3022('0x33')],{'$or':_[_0x3022('0x27')](_0x3a26a2[_0x3022('0x2e')],function(_0x52726e){var _0x4fddc6={};_0x4fddc6[_0x52726e]={'$like':'%'+_0x13eaad[_0x3022('0x2c')][_0x3022('0x38')]+'%'};return _0x4fddc6;})});}_0x3a26a2=_[_0x3022('0x36')]({},_0x3a26a2,_0x13eaad[_0x3022('0x39')]);return _0x104dd9[_0x3022('0x4b')](_0x3a26a2);}})[_0x3022('0x22')](function(_0x4e2244){if(_0x4e2244){_0x49910a=_0x4e2244[_0x3022('0x49')];if(!_0x13eaad[_0x3022('0x2c')][_0x3022('0x30')](_0x3022('0x31'))){_0x3a26a2[_0x3022('0x1c')]=qs[_0x3022('0x1c')](_0x13eaad[_0x3022('0x2c')][_0x3022('0x1c')]);_0x3a26a2[_0x3022('0x1b')]=qs[_0x3022('0x1b')](_0x13eaad[_0x3022('0x2c')][_0x3022('0x1b')]);}return _0x104dd9[_0x3022('0x4b')](_0x3a26a2);}})[_0x3022('0x22')](function(_0x20a835){if(_0x20a835){return _0x20a835?{'count':_0x49910a,'rows':_0x20a835}:null;}})['then'](respondWithResult(_0x1a7826,null))[_0x3022('0x3f')](handleError(_0x1a7826,null));};exports['getDescriptions']=function(_0x3e950e,_0x119f20,_0x2549f3){var _0x492bd3={};var _0x1ff776={};var _0x33c4f4;var _0x4ca8c9;return db[_0x3022('0x3a')][_0x3022('0x47')]({'where':{'id':_0x3e950e['params']['id']}})[_0x3022('0x22')](handleEntityNotFound(_0x119f20,null))[_0x3022('0x22')](function(_0x205d76){if(_0x205d76){_0x33c4f4=_0x205d76;_0x1ff776['model']=_[_0x3022('0x42')](db[_0x3022('0x48')]['rawAttributes']);_0x1ff776[_0x3022('0x2c')]=_['keys'](_0x3e950e[_0x3022('0x2c')]);_0x1ff776[_0x3022('0x35')]=_['intersection'](_0x1ff776[_0x3022('0x2b')],_0x1ff776['query']);_0x492bd3['attributes']=_[_0x3022('0x2d')](_0x1ff776['model'],qs[_0x3022('0x2f')](_0x3e950e[_0x3022('0x2c')][_0x3022('0x2f')]));_0x492bd3['attributes']=_0x492bd3[_0x3022('0x2e')][_0x3022('0x49')]?_0x492bd3['attributes']:_0x1ff776[_0x3022('0x2b')];_0x492bd3[_0x3022('0x4a')]=qs['sort'](_0x3e950e[_0x3022('0x2c')]['sort']);_0x492bd3[_0x3022('0x33')]=qs[_0x3022('0x35')](_['pick'](_0x3e950e[_0x3022('0x2c')],_0x1ff776['filters']));if(_0x3e950e['query'][_0x3022('0x38')]){_0x492bd3[_0x3022('0x33')]=_[_0x3022('0x36')](_0x492bd3[_0x3022('0x33')],{'$or':_[_0x3022('0x27')](_0x492bd3['attributes'],function(_0x49ed42){var _0x3c5d5e={};_0x3c5d5e[_0x49ed42]={'$like':'%'+_0x3e950e['query']['filter']+'%'};return _0x3c5d5e;})});}_0x492bd3=_['merge']({},_0x492bd3,_0x3e950e[_0x3022('0x39')]);return _0x33c4f4['getDescriptions'](_0x492bd3);}})[_0x3022('0x22')](function(_0x1d14d0){if(_0x1d14d0){_0x4ca8c9=_0x1d14d0[_0x3022('0x49')];if(!_0x3e950e['query']['hasOwnProperty'](_0x3022('0x31'))){_0x492bd3[_0x3022('0x1c')]=qs[_0x3022('0x1c')](_0x3e950e[_0x3022('0x2c')][_0x3022('0x1c')]);_0x492bd3[_0x3022('0x1b')]=qs[_0x3022('0x1b')](_0x3e950e[_0x3022('0x2c')][_0x3022('0x1b')]);}return _0x33c4f4[_0x3022('0x4c')](_0x492bd3);}})[_0x3022('0x22')](function(_0x539018){if(_0x539018){return _0x539018?{'count':_0x4ca8c9,'rows':_0x539018}:null;}})[_0x3022('0x22')](respondWithResult(_0x119f20,null))[_0x3022('0x3f')](handleError(_0x119f20,null));}; \ No newline at end of file +var _0x4536=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','catch','create','body','find','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring'];(function(_0x1af12a,_0x5c4cb5){var _0x28262f=function(_0x1f15eb){while(--_0x1f15eb){_0x1af12a['push'](_0x1af12a['shift']());}};_0x28262f(++_0x5c4cb5);}(_0x4536,0xe9));var _0x6453=function(_0x91db9,_0x5b4ac6){_0x91db9=_0x91db9-0x0;var _0xb1fb2a=_0x4536[_0x91db9];return _0xb1fb2a;};'use strict';var emlformat=require(_0x6453('0x0'));var rimraf=require(_0x6453('0x1'));var zipdir=require(_0x6453('0x2'));var jsonpatch=require(_0x6453('0x3'));var rp=require('request-promise');var moment=require(_0x6453('0x4'));var BPromise=require(_0x6453('0x5'));var Mustache=require('mustache');var util=require(_0x6453('0x6'));var path=require(_0x6453('0x7'));var sox=require(_0x6453('0x8'));var csv=require('to-csv');var ejs=require(_0x6453('0x9'));var fs=require('fs');var fs_extra=require(_0x6453('0xa'));var _=require('lodash');var squel=require(_0x6453('0xb'));var crypto=require(_0x6453('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6453('0xd'));var toCsv=require(_0x6453('0xe'));var querystring=require(_0x6453('0xf'));var Papa=require(_0x6453('0x10'));var Redis=require(_0x6453('0x11'));var authService=require(_0x6453('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6453('0x13'));var hardwareService=require(_0x6453('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6453('0x15'));var config=require(_0x6453('0x16'));var licenseUtil=require(_0x6453('0x17'));var db=require(_0x6453('0x18'))['db'];function respondWithStatusCode(_0x5cc82c,_0x561ae8){_0x561ae8=_0x561ae8||0xcc;return function(_0x435d0a){if(_0x435d0a){return _0x5cc82c[_0x6453('0x19')](_0x561ae8);}return _0x5cc82c[_0x6453('0x1a')](_0x561ae8)[_0x6453('0x1b')]();};}function respondWithResult(_0x11fcc5,_0x40a45a){_0x40a45a=_0x40a45a||0xc8;return function(_0x5e9873){if(_0x5e9873){return _0x11fcc5['status'](_0x40a45a)[_0x6453('0x1c')](_0x5e9873);}};}function respondWithFilteredResult(_0x2f111d,_0x414cd0){return function(_0x3c1354){if(_0x3c1354){var _0x3e7c5e=typeof _0x414cd0[_0x6453('0x1d')]===_0x6453('0x1e')&&typeof _0x414cd0[_0x6453('0x1f')]===_0x6453('0x1e');var _0x579331=_0x3c1354[_0x6453('0x20')];var _0x446707=_0x3e7c5e?0x0:_0x414cd0[_0x6453('0x1d')];var _0xbbc06a=_0x3e7c5e?_0x3c1354[_0x6453('0x20')]:_0x414cd0[_0x6453('0x1d')]+_0x414cd0[_0x6453('0x1f')];var _0x4ac4fd;if(_0xbbc06a>=_0x579331){_0xbbc06a=_0x579331;_0x4ac4fd=0xc8;}else{_0x4ac4fd=0xce;}_0x2f111d[_0x6453('0x1a')](_0x4ac4fd);return _0x2f111d[_0x6453('0x21')](_0x6453('0x22'),_0x446707+'-'+_0xbbc06a+'/'+_0x579331)[_0x6453('0x1c')](_0x3c1354);}return null;};}function patchUpdates(_0x37aade){return function(_0x532197){try{jsonpatch[_0x6453('0x23')](_0x532197,_0x37aade,!![]);}catch(_0x526ee9){return BPromise[_0x6453('0x24')](_0x526ee9);}return _0x532197[_0x6453('0x25')]();};}function saveUpdates(_0x3c80f4,_0x2a82d9){return function(_0x28d953){if(_0x28d953){return _0x28d953[_0x6453('0x26')](_0x3c80f4)[_0x6453('0x27')](function(_0x3fa66d){return _0x3fa66d;});}return null;};}function removeEntity(_0x178cb1,_0xaec691){return function(_0x15f6a5){if(_0x15f6a5){return _0x15f6a5[_0x6453('0x28')]()[_0x6453('0x27')](function(){_0x178cb1[_0x6453('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x118716,_0x12c453){return function(_0x408783){if(!_0x408783){_0x118716[_0x6453('0x19')](0x194);}return _0x408783;};}function handleError(_0x530de5,_0x23733e){_0x23733e=_0x23733e||0x1f4;return function(_0x2c3261){logger[_0x6453('0x29')](_0x2c3261['stack']);if(_0x2c3261[_0x6453('0x2a')]){delete _0x2c3261[_0x6453('0x2a')];}_0x530de5[_0x6453('0x1a')](_0x23733e)[_0x6453('0x2b')](_0x2c3261);};}exports[_0x6453('0x2c')]=function(_0x4ae0da,_0x45ea8c){var _0x1fd416={},_0x1b5750={},_0xa39cd5={'count':0x0,'rows':[]};var _0x5f2140=_[_0x6453('0x2d')](db[_0x6453('0x2e')][_0x6453('0x2f')],function(_0x21726d){return{'name':_0x21726d[_0x6453('0x30')],'type':_0x21726d[_0x6453('0x31')]['key']};});_0x1b5750['model']=_[_0x6453('0x2d')](_0x5f2140,_0x6453('0x2a'));_0x1b5750[_0x6453('0x32')]=_[_0x6453('0x33')](_0x4ae0da[_0x6453('0x32')]);_0x1b5750[_0x6453('0x34')]=_[_0x6453('0x35')](_0x1b5750[_0x6453('0x36')],_0x1b5750[_0x6453('0x32')]);_0x1fd416['attributes']=_['intersection'](_0x1b5750[_0x6453('0x36')],qs[_0x6453('0x37')](_0x4ae0da[_0x6453('0x32')][_0x6453('0x37')]));_0x1fd416['attributes']=_0x1fd416[_0x6453('0x38')]['length']?_0x1fd416[_0x6453('0x38')]:_0x1b5750['model'];if(!_0x4ae0da['query'][_0x6453('0x39')](_0x6453('0x3a'))){_0x1fd416[_0x6453('0x1f')]=qs[_0x6453('0x1f')](_0x4ae0da[_0x6453('0x32')][_0x6453('0x1f')]);_0x1fd416['offset']=qs['offset'](_0x4ae0da[_0x6453('0x32')][_0x6453('0x1d')]);}_0x1fd416['order']=qs[_0x6453('0x3b')](_0x4ae0da[_0x6453('0x32')]['sort']);_0x1fd416['where']=qs[_0x6453('0x34')](_[_0x6453('0x3c')](_0x4ae0da[_0x6453('0x32')],_0x1b5750[_0x6453('0x34')]),_0x5f2140);if(_0x4ae0da[_0x6453('0x32')][_0x6453('0x3d')]){_0x1fd416[_0x6453('0x3e')]=_[_0x6453('0x3f')](_0x1fd416[_0x6453('0x3e')],{'$or':_[_0x6453('0x2d')](_0x5f2140,function(_0x50479f){if(_0x50479f['type']!==_0x6453('0x40')){var _0x101fd9={};_0x101fd9[_0x50479f[_0x6453('0x2a')]]={'$like':'%'+_0x4ae0da[_0x6453('0x32')]['filter']+'%'};return _0x101fd9;}})});}_0x1fd416=_[_0x6453('0x3f')]({},_0x1fd416,_0x4ae0da[_0x6453('0x41')]);var _0x123eaf={'where':_0x1fd416['where']};return db[_0x6453('0x2e')][_0x6453('0x20')](_0x123eaf)['then'](function(_0x3eb886){_0xa39cd5[_0x6453('0x20')]=_0x3eb886;if(_0x4ae0da[_0x6453('0x32')][_0x6453('0x42')]){_0x1fd416['include']=[{'all':!![]}];}return db[_0x6453('0x2e')][_0x6453('0x43')](_0x1fd416);})['then'](function(_0x22bf44){_0xa39cd5[_0x6453('0x44')]=_0x22bf44;return _0xa39cd5;})[_0x6453('0x27')](respondWithFilteredResult(_0x45ea8c,_0x1fd416))['catch'](handleError(_0x45ea8c,null));};exports[_0x6453('0x45')]=function(_0x21aaa8,_0x499807){var _0x31e5e3={'raw':![],'where':{'id':_0x21aaa8[_0x6453('0x46')]['id']}},_0x2f466f={};_0x2f466f[_0x6453('0x36')]=_[_0x6453('0x33')](db[_0x6453('0x2e')][_0x6453('0x2f')]);_0x2f466f['query']=_[_0x6453('0x33')](_0x21aaa8[_0x6453('0x32')]);_0x2f466f[_0x6453('0x34')]=_[_0x6453('0x35')](_0x2f466f['model'],_0x2f466f[_0x6453('0x32')]);_0x31e5e3['attributes']=_['intersection'](_0x2f466f[_0x6453('0x36')],qs[_0x6453('0x37')](_0x21aaa8['query'][_0x6453('0x37')]));_0x31e5e3[_0x6453('0x38')]=_0x31e5e3[_0x6453('0x38')][_0x6453('0x47')]?_0x31e5e3[_0x6453('0x38')]:_0x2f466f[_0x6453('0x36')];if(_0x21aaa8[_0x6453('0x32')]['includeAll']){_0x31e5e3[_0x6453('0x48')]=[{'all':!![]}];}_0x31e5e3=_[_0x6453('0x3f')]({},_0x31e5e3,_0x21aaa8['options']);return db['SalesforceConfiguration']['find'](_0x31e5e3)['then'](handleEntityNotFound(_0x499807,null))['then'](respondWithResult(_0x499807,null))[_0x6453('0x49')](handleError(_0x499807,null));};exports[_0x6453('0x4a')]=function(_0x3242dd,_0x51f1e5){return db[_0x6453('0x2e')]['create'](_0x3242dd[_0x6453('0x4b')],{})[_0x6453('0x27')](respondWithResult(_0x51f1e5,0xc9))[_0x6453('0x49')](handleError(_0x51f1e5,null));};exports[_0x6453('0x26')]=function(_0x3a3254,_0x546b58){if(_0x3a3254['body']['id']){delete _0x3a3254[_0x6453('0x4b')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x3a3254[_0x6453('0x46')]['id']}})['then'](handleEntityNotFound(_0x546b58,null))[_0x6453('0x27')](saveUpdates(_0x3a3254[_0x6453('0x4b')],null))[_0x6453('0x27')](respondWithResult(_0x546b58,null))[_0x6453('0x49')](handleError(_0x546b58,null));};exports[_0x6453('0x28')]=function(_0x5979b4,_0x59aec9){return db[_0x6453('0x2e')][_0x6453('0x4c')]({'where':{'id':_0x5979b4[_0x6453('0x46')]['id']}})[_0x6453('0x27')](handleEntityNotFound(_0x59aec9,null))[_0x6453('0x27')](removeEntity(_0x59aec9,null))['catch'](handleError(_0x59aec9,null));};exports[_0x6453('0x4d')]=function(_0x22273,_0x432d2d,_0x56f6ed){var _0x355d93={};var _0x4c5129={};var _0x4ca691;var _0x1d0b64;return db['SalesforceConfiguration'][_0x6453('0x4e')]({'where':{'id':_0x22273[_0x6453('0x46')]['id']}})[_0x6453('0x27')](handleEntityNotFound(_0x432d2d,null))['then'](function(_0x4ce5c4){if(_0x4ce5c4){_0x4ca691=_0x4ce5c4;_0x4c5129[_0x6453('0x36')]=_['keys'](db[_0x6453('0x4f')]['rawAttributes']);_0x4c5129[_0x6453('0x32')]=_[_0x6453('0x33')](_0x22273[_0x6453('0x32')]);_0x4c5129[_0x6453('0x34')]=_[_0x6453('0x35')](_0x4c5129['model'],_0x4c5129[_0x6453('0x32')]);_0x355d93[_0x6453('0x38')]=_[_0x6453('0x35')](_0x4c5129[_0x6453('0x36')],qs[_0x6453('0x37')](_0x22273['query']['fields']));_0x355d93[_0x6453('0x38')]=_0x355d93[_0x6453('0x38')]['length']?_0x355d93[_0x6453('0x38')]:_0x4c5129[_0x6453('0x36')];_0x355d93[_0x6453('0x50')]=qs[_0x6453('0x3b')](_0x22273[_0x6453('0x32')][_0x6453('0x3b')]);_0x355d93['where']=qs[_0x6453('0x34')](_[_0x6453('0x3c')](_0x22273[_0x6453('0x32')],_0x4c5129[_0x6453('0x34')]));if(_0x22273[_0x6453('0x32')][_0x6453('0x3d')]){_0x355d93[_0x6453('0x3e')]=_['merge'](_0x355d93[_0x6453('0x3e')],{'$or':_[_0x6453('0x2d')](_0x355d93[_0x6453('0x38')],function(_0x2153db){var _0x54eaa0={};_0x54eaa0[_0x2153db]={'$like':'%'+_0x22273[_0x6453('0x32')][_0x6453('0x3d')]+'%'};return _0x54eaa0;})});}_0x355d93=_['merge']({},_0x355d93,_0x22273[_0x6453('0x41')]);return _0x4ca691[_0x6453('0x4d')](_0x355d93);}})[_0x6453('0x27')](function(_0x377641){if(_0x377641){_0x1d0b64=_0x377641[_0x6453('0x47')];if(!_0x22273[_0x6453('0x32')][_0x6453('0x39')](_0x6453('0x3a'))){_0x355d93['limit']=qs[_0x6453('0x1f')](_0x22273['query']['limit']);_0x355d93[_0x6453('0x1d')]=qs[_0x6453('0x1d')](_0x22273[_0x6453('0x32')][_0x6453('0x1d')]);}return _0x4ca691[_0x6453('0x4d')](_0x355d93);}})[_0x6453('0x27')](function(_0x5038ee){if(_0x5038ee){return _0x5038ee?{'count':_0x1d0b64,'rows':_0x5038ee}:null;}})[_0x6453('0x27')](respondWithResult(_0x432d2d,null))['catch'](handleError(_0x432d2d,null));};exports['getSubjects']=function(_0x555410,_0x43ecf1,_0x5b3b9b){var _0x65286a={};var _0x296c87={};var _0x542d81;var _0x88116d;return db[_0x6453('0x2e')][_0x6453('0x4e')]({'where':{'id':_0x555410[_0x6453('0x46')]['id']}})[_0x6453('0x27')](handleEntityNotFound(_0x43ecf1,null))['then'](function(_0x3686df){if(_0x3686df){_0x542d81=_0x3686df;_0x296c87[_0x6453('0x36')]=_['keys'](db[_0x6453('0x4f')][_0x6453('0x2f')]);_0x296c87[_0x6453('0x32')]=_['keys'](_0x555410['query']);_0x296c87['filters']=_[_0x6453('0x35')](_0x296c87[_0x6453('0x36')],_0x296c87[_0x6453('0x32')]);_0x65286a[_0x6453('0x38')]=_['intersection'](_0x296c87[_0x6453('0x36')],qs[_0x6453('0x37')](_0x555410[_0x6453('0x32')][_0x6453('0x37')]));_0x65286a[_0x6453('0x38')]=_0x65286a[_0x6453('0x38')][_0x6453('0x47')]?_0x65286a['attributes']:_0x296c87[_0x6453('0x36')];_0x65286a[_0x6453('0x50')]=qs[_0x6453('0x3b')](_0x555410[_0x6453('0x32')][_0x6453('0x3b')]);_0x65286a[_0x6453('0x3e')]=qs[_0x6453('0x34')](_['pick'](_0x555410[_0x6453('0x32')],_0x296c87['filters']));if(_0x555410['query'][_0x6453('0x3d')]){_0x65286a[_0x6453('0x3e')]=_[_0x6453('0x3f')](_0x65286a[_0x6453('0x3e')],{'$or':_[_0x6453('0x2d')](_0x65286a[_0x6453('0x38')],function(_0x10f1e4){var _0x423197={};_0x423197[_0x10f1e4]={'$like':'%'+_0x555410[_0x6453('0x32')][_0x6453('0x3d')]+'%'};return _0x423197;})});}_0x65286a=_[_0x6453('0x3f')]({},_0x65286a,_0x555410[_0x6453('0x41')]);return _0x542d81[_0x6453('0x51')](_0x65286a);}})[_0x6453('0x27')](function(_0x16dd76){if(_0x16dd76){_0x88116d=_0x16dd76[_0x6453('0x47')];if(!_0x555410[_0x6453('0x32')][_0x6453('0x39')](_0x6453('0x3a'))){_0x65286a[_0x6453('0x1f')]=qs[_0x6453('0x1f')](_0x555410['query']['limit']);_0x65286a[_0x6453('0x1d')]=qs[_0x6453('0x1d')](_0x555410[_0x6453('0x32')][_0x6453('0x1d')]);}return _0x542d81[_0x6453('0x51')](_0x65286a);}})[_0x6453('0x27')](function(_0x2c302a){if(_0x2c302a){return _0x2c302a?{'count':_0x88116d,'rows':_0x2c302a}:null;}})[_0x6453('0x27')](respondWithResult(_0x43ecf1,null))['catch'](handleError(_0x43ecf1,null));};exports[_0x6453('0x52')]=function(_0x3853f2,_0x27a05f,_0x1db9e6){var _0x390c1a={};var _0x1ec276={};var _0x511e1c;var _0x8b578e;return db[_0x6453('0x2e')]['findOne']({'where':{'id':_0x3853f2[_0x6453('0x46')]['id']}})[_0x6453('0x27')](handleEntityNotFound(_0x27a05f,null))[_0x6453('0x27')](function(_0x3d2c87){if(_0x3d2c87){_0x511e1c=_0x3d2c87;_0x1ec276[_0x6453('0x36')]=_[_0x6453('0x33')](db['SalesforceField'][_0x6453('0x2f')]);_0x1ec276[_0x6453('0x32')]=_[_0x6453('0x33')](_0x3853f2[_0x6453('0x32')]);_0x1ec276[_0x6453('0x34')]=_['intersection'](_0x1ec276[_0x6453('0x36')],_0x1ec276[_0x6453('0x32')]);_0x390c1a[_0x6453('0x38')]=_['intersection'](_0x1ec276[_0x6453('0x36')],qs[_0x6453('0x37')](_0x3853f2[_0x6453('0x32')][_0x6453('0x37')]));_0x390c1a['attributes']=_0x390c1a[_0x6453('0x38')]['length']?_0x390c1a[_0x6453('0x38')]:_0x1ec276[_0x6453('0x36')];_0x390c1a[_0x6453('0x50')]=qs['sort'](_0x3853f2[_0x6453('0x32')][_0x6453('0x3b')]);_0x390c1a[_0x6453('0x3e')]=qs['filters'](_[_0x6453('0x3c')](_0x3853f2[_0x6453('0x32')],_0x1ec276[_0x6453('0x34')]));if(_0x3853f2[_0x6453('0x32')]['filter']){_0x390c1a[_0x6453('0x3e')]=_[_0x6453('0x3f')](_0x390c1a['where'],{'$or':_['map'](_0x390c1a['attributes'],function(_0x437fb9){var _0x4b3553={};_0x4b3553[_0x437fb9]={'$like':'%'+_0x3853f2[_0x6453('0x32')][_0x6453('0x3d')]+'%'};return _0x4b3553;})});}_0x390c1a=_[_0x6453('0x3f')]({},_0x390c1a,_0x3853f2['options']);return _0x511e1c[_0x6453('0x52')](_0x390c1a);}})[_0x6453('0x27')](function(_0x5d5269){if(_0x5d5269){_0x8b578e=_0x5d5269[_0x6453('0x47')];if(!_0x3853f2[_0x6453('0x32')][_0x6453('0x39')](_0x6453('0x3a'))){_0x390c1a[_0x6453('0x1f')]=qs[_0x6453('0x1f')](_0x3853f2[_0x6453('0x32')][_0x6453('0x1f')]);_0x390c1a['offset']=qs[_0x6453('0x1d')](_0x3853f2['query'][_0x6453('0x1d')]);}return _0x511e1c[_0x6453('0x52')](_0x390c1a);}})['then'](function(_0x38d970){if(_0x38d970){return _0x38d970?{'count':_0x8b578e,'rows':_0x38d970}:null;}})[_0x6453('0x27')](respondWithResult(_0x27a05f,null))[_0x6453('0x49')](handleError(_0x27a05f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2dc5ee0..6755131 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 _0x134a=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24c15a,_0x261c48){var _0x2a3137=function(_0x25096a){while(--_0x25096a){_0x24c15a['push'](_0x24c15a['shift']());}};_0x2a3137(++_0x261c48);}(_0x134a,0x101));var _0xa134=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x134a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa134('0x0'));var util=require(_0xa134('0x1'));var logger=require(_0xa134('0x2'))(_0xa134('0x3'));var moment=require(_0xa134('0x4'));var BPromise=require(_0xa134('0x5'));var rp=require(_0xa134('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa134('0x7'));var attributes=require(_0xa134('0x8'));module[_0xa134('0x9')]=function(_0x47706b,_0x261ff3){return _0x47706b[_0xa134('0xa')](_0xa134('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa500=['exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x521a8d,_0x561fe9){var _0x36a820=function(_0x3b365e){while(--_0x3b365e){_0x521a8d['push'](_0x521a8d['shift']());}};_0x36a820(++_0x561fe9);}(_0xa500,0x1ef));var _0x0a50=function(_0x524ed2,_0x219984){_0x524ed2=_0x524ed2-0x0;var _0x593550=_0xa500[_0x524ed2];return _0x593550;};'use strict';var _=require(_0x0a50('0x0'));var util=require(_0x0a50('0x1'));var logger=require(_0x0a50('0x2'))(_0x0a50('0x3'));var moment=require(_0x0a50('0x4'));var BPromise=require(_0x0a50('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a50('0x6'));var rimraf=require(_0x0a50('0x7'));var config=require(_0x0a50('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x0a50('0x9')]=function(_0x32bfee,_0x5f3430){return _0x32bfee[_0x0a50('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x0a50('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 9dd786e..ca9b2e2 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 _0x3ea1=['http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client'];(function(_0x137f52,_0x16dbf9){var _0x44b99f=function(_0x379261){while(--_0x379261){_0x137f52['push'](_0x137f52['shift']());}};_0x44b99f(++_0x16dbf9);}(_0x3ea1,0x1e5));var _0x13ea=function(_0x19279d,_0x188e83){_0x19279d=_0x19279d-0x0;var _0x15dc47=_0x3ea1[_0x19279d];return _0x15dc47;};'use strict';var _=require(_0x13ea('0x0'));var util=require(_0x13ea('0x1'));var moment=require(_0x13ea('0x2'));var BPromise=require(_0x13ea('0x3'));var rs=require(_0x13ea('0x4'));var fs=require('fs');var Redis=require(_0x13ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13ea('0x6'))('rpc');var config=require(_0x13ea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13ea('0x8')][_0x13ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e0d8e,_0x4fe15b,_0x5ae6d9){return new BPromise(function(_0x4c29e7,_0x4aa70f){return client[_0x13ea('0xa')](_0x4e0d8e,_0x5ae6d9)[_0x13ea('0xb')](function(_0x37e69d){logger['info'](_0x13ea('0xc'),_0x4fe15b,_0x13ea('0xd'));logger['debug'](_0x13ea('0xe'),_0x4fe15b,_0x13ea('0xd'),JSON['stringify'](_0x37e69d));if(_0x37e69d['error']){if(_0x37e69d[_0x13ea('0xf')][_0x13ea('0x10')]===0x1f4){logger[_0x13ea('0xf')](_0x13ea('0xc'),_0x4fe15b,_0x37e69d[_0x13ea('0xf')]['message']);return _0x4aa70f(_0x37e69d['error']['message']);}logger['error'](_0x13ea('0xc'),_0x4fe15b,_0x37e69d['error'][_0x13ea('0x11')]);return _0x4c29e7(_0x37e69d[_0x13ea('0xf')][_0x13ea('0x11')]);}else{logger['info'](_0x13ea('0xc'),_0x4fe15b,_0x13ea('0xd'));_0x4c29e7(_0x37e69d[_0x13ea('0x12')]['message']);}})['catch'](function(_0x46f1d4){logger[_0x13ea('0xf')](_0x13ea('0xc'),_0x4fe15b,_0x46f1d4);_0x4aa70f(_0x46f1d4);});});} \ No newline at end of file +var _0xb0ba=['rpc','jayson/promise','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43b61c,_0x1cd508){var _0x4ed59e=function(_0x58d334){while(--_0x58d334){_0x43b61c['push'](_0x43b61c['shift']());}};_0x4ed59e(++_0x1cd508);}(_0xb0ba,0x10c));var _0xab0b=function(_0x3589fb,_0x402113){_0x3589fb=_0x3589fb-0x0;var _0x4f2bea=_0xb0ba[_0x3589fb];return _0x4f2bea;};'use strict';var _=require('lodash');var util=require(_0xab0b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab0b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab0b('0x2'))['db'];var utils=require(_0xab0b('0x3'));var logger=require(_0xab0b('0x4'))(_0xab0b('0x5'));var config=require('../../config/environment');var jayson=require(_0xab0b('0x6'));var client=jayson['client'][_0xab0b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c0900,_0x3d62f2,_0x5ed42f){return new BPromise(function(_0x3b10ab,_0xa6ca1c){return client[_0xab0b('0x8')](_0x5c0900,_0x5ed42f)[_0xab0b('0x9')](function(_0x116b72){logger[_0xab0b('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3d62f2,'request\x20sent');logger[_0xab0b('0xb')](_0xab0b('0xc'),_0x3d62f2,'request\x20sent',JSON[_0xab0b('0xd')](_0x116b72));if(_0x116b72[_0xab0b('0xe')]){if(_0x116b72[_0xab0b('0xe')][_0xab0b('0xf')]===0x1f4){logger['error'](_0xab0b('0x10'),_0x3d62f2,_0x116b72[_0xab0b('0xe')][_0xab0b('0x11')]);return _0xa6ca1c(_0x116b72[_0xab0b('0xe')][_0xab0b('0x11')]);}logger[_0xab0b('0xe')](_0xab0b('0x10'),_0x3d62f2,_0x116b72[_0xab0b('0xe')]['message']);return _0x3b10ab(_0x116b72[_0xab0b('0xe')][_0xab0b('0x11')]);}else{logger[_0xab0b('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3d62f2,_0xab0b('0x12'));_0x3b10ab(_0x116b72[_0xab0b('0x13')]['message']);}})[_0xab0b('0x14')](function(_0x935d9d){logger[_0xab0b('0xe')](_0xab0b('0x10'),_0x3d62f2,_0x935d9d);_0xa6ca1c(_0x935d9d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f5c6d3e..4a272ce 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 _0x6264=['./intSalesforceField.controller','get','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0x6264,0x108));var _0x4626=function(_0x4d955b,_0x1eb048){_0x4d955b=_0x4d955b-0x0;var _0x1c06b8=_0x6264[_0x4d955b];return _0x1c06b8;};'use strict';var multer=require(_0x4626('0x0'));var util=require('util');var path=require(_0x4626('0x1'));var timeout=require('connect-timeout');var express=require(_0x4626('0x2'));var router=express['Router']();var fs_extra=require(_0x4626('0x3'));var auth=require(_0x4626('0x4'));var interaction=require(_0x4626('0x5'));var config=require('../../config/environment');var controller=require(_0x4626('0x6'));router[_0x4626('0x7')]('/',auth[_0x4626('0x8')](),controller['index']);router[_0x4626('0x7')]('/:id',auth[_0x4626('0x8')](),controller[_0x4626('0x9')]);router[_0x4626('0xa')]('/',auth['isAuthenticated'](),controller[_0x4626('0xb')]);router[_0x4626('0xc')](_0x4626('0xd'),auth[_0x4626('0x8')](),controller['update']);router['delete'](_0x4626('0xd'),auth[_0x4626('0x8')](),controller[_0x4626('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5d80=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5d80,0x139));var _0x05d8=function(_0xbbab21,_0x230e4e){_0xbbab21=_0xbbab21-0x0;var _0x141bc9=_0x5d80[_0xbbab21];return _0x141bc9;};'use strict';var multer=require(_0x05d8('0x0'));var util=require(_0x05d8('0x1'));var path=require(_0x05d8('0x2'));var timeout=require(_0x05d8('0x3'));var express=require('express');var router=express[_0x05d8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x05d8('0x5'));var interaction=require(_0x05d8('0x6'));var config=require(_0x05d8('0x7'));var controller=require(_0x05d8('0x8'));router[_0x05d8('0x9')]('/',auth[_0x05d8('0xa')](),controller[_0x05d8('0xb')]);router['get'](_0x05d8('0xc'),auth[_0x05d8('0xa')](),controller[_0x05d8('0xd')]);router['post']('/',auth[_0x05d8('0xa')](),controller[_0x05d8('0xe')]);router[_0x05d8('0xf')](_0x05d8('0xc'),auth['isAuthenticated'](),controller[_0x05d8('0x10')]);router[_0x05d8('0x11')](_0x05d8('0xc'),auth[_0x05d8('0xa')](),controller[_0x05d8('0x12')]);module[_0x05d8('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 0b7ff36..3ecf97f 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 _0xcbee=['string','variable','keyValue','picklist','STRING','customVariable','ENUM'];(function(_0x4acdc1,_0x5e4a1c){var _0x1696a0=function(_0xda108b){while(--_0xda108b){_0x4acdc1['push'](_0x4acdc1['shift']());}};_0x1696a0(++_0x5e4a1c);}(_0xcbee,0x92));var _0xecbe=function(_0x48f21b,_0x3a1be0){_0x48f21b=_0x48f21b-0x0;var _0x51b062=_0xcbee[_0x48f21b];return _0x51b062;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xecbe('0x0')](_0xecbe('0x1'),_0xecbe('0x2'),'customVariable',_0xecbe('0x3'),_0xecbe('0x4')),'defaultValue':_0xecbe('0x1')},'content':{'type':Sequelize[_0xecbe('0x5')]},'key':{'type':Sequelize[_0xecbe('0x5')]},'keyType':{'type':Sequelize[_0xecbe('0x0')](_0xecbe('0x1'),_0xecbe('0x2'),_0xecbe('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xecbe('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9bad=['sequelize','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x52f071,_0x2874bb){var _0x23badb=function(_0x133e99){while(--_0x133e99){_0x52f071['push'](_0x52f071['shift']());}};_0x23badb(++_0x2874bb);}(_0x9bad,0x1e3));var _0xd9ba=function(_0x313544,_0x46516d){_0x313544=_0x313544-0x0;var _0x303515=_0x9bad[_0x313544];return _0x303515;};'use strict';var Sequelize=require(_0xd9ba('0x0'));module['exports']={'type':{'type':Sequelize[_0xd9ba('0x1')](_0xd9ba('0x2'),_0xd9ba('0x3'),'customVariable','keyValue',_0xd9ba('0x4')),'defaultValue':_0xd9ba('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd9ba('0x5')]},'keyType':{'type':Sequelize[_0xd9ba('0x1')]('string','variable',_0xd9ba('0x6'))},'keyContent':{'type':Sequelize[_0xd9ba('0x5')]},'idField':{'type':Sequelize[_0xd9ba('0x5')]},'variableName':{'type':Sequelize[_0xd9ba('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e458c44..c18084f 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 _0xa651=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','params','length','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xa651,0xc6));var _0x1a65=function(_0x4287bd,_0x4b6c73){_0x4287bd=_0x4287bd-0x0;var _0x7a7d4b=_0xa651[_0x4287bd];return _0x7a7d4b;};'use strict';var emlformat=require(_0x1a65('0x0'));var rimraf=require(_0x1a65('0x1'));var zipdir=require(_0x1a65('0x2'));var jsonpatch=require(_0x1a65('0x3'));var rp=require(_0x1a65('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a65('0x5'));var util=require(_0x1a65('0x6'));var path=require(_0x1a65('0x7'));var sox=require(_0x1a65('0x8'));var csv=require('to-csv');var ejs=require(_0x1a65('0x9'));var fs=require('fs');var fs_extra=require(_0x1a65('0xa'));var _=require(_0x1a65('0xb'));var squel=require(_0x1a65('0xc'));var crypto=require(_0x1a65('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1a65('0xe'));var toCsv=require(_0x1a65('0xf'));var querystring=require(_0x1a65('0x10'));var Papa=require('papaparse');var Redis=require(_0x1a65('0x11'));var authService=require(_0x1a65('0x12'));var qs=require(_0x1a65('0x13'));var as=require(_0x1a65('0x14'));var hardwareService=require(_0x1a65('0x15'));var logger=require(_0x1a65('0x16'))(_0x1a65('0x17'));var utils=require(_0x1a65('0x18'));var config=require(_0x1a65('0x19'));var licenseUtil=require(_0x1a65('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x148c82,_0x32a144){_0x32a144=_0x32a144||0xcc;return function(_0x2aa2ab){if(_0x2aa2ab){return _0x148c82[_0x1a65('0x1b')](_0x32a144);}return _0x148c82[_0x1a65('0x1c')](_0x32a144)[_0x1a65('0x1d')]();};}function respondWithResult(_0x5154a2,_0x4bf93a){_0x4bf93a=_0x4bf93a||0xc8;return function(_0x128652){if(_0x128652){return _0x5154a2['status'](_0x4bf93a)[_0x1a65('0x1e')](_0x128652);}};}function respondWithFilteredResult(_0x496288,_0x2a0c68){return function(_0x4bb7ef){if(_0x4bb7ef){var _0x12c875=typeof _0x2a0c68[_0x1a65('0x1f')]===_0x1a65('0x20')&&typeof _0x2a0c68[_0x1a65('0x21')]==='undefined';var _0x88734=_0x4bb7ef[_0x1a65('0x22')];var _0x1e3bde=_0x12c875?0x0:_0x2a0c68[_0x1a65('0x1f')];var _0x4e1d6f=_0x12c875?_0x4bb7ef[_0x1a65('0x22')]:_0x2a0c68[_0x1a65('0x1f')]+_0x2a0c68[_0x1a65('0x21')];var _0xb2425a;if(_0x4e1d6f>=_0x88734){_0x4e1d6f=_0x88734;_0xb2425a=0xc8;}else{_0xb2425a=0xce;}_0x496288[_0x1a65('0x1c')](_0xb2425a);return _0x496288[_0x1a65('0x23')](_0x1a65('0x24'),_0x1e3bde+'-'+_0x4e1d6f+'/'+_0x88734)[_0x1a65('0x1e')](_0x4bb7ef);}return null;};}function patchUpdates(_0xf6b811){return function(_0x321f10){try{jsonpatch[_0x1a65('0x25')](_0x321f10,_0xf6b811,!![]);}catch(_0x3f39ac){return BPromise[_0x1a65('0x26')](_0x3f39ac);}return _0x321f10[_0x1a65('0x27')]();};}function saveUpdates(_0x2f9238,_0x4fb7f5){return function(_0x5dc577){if(_0x5dc577){return _0x5dc577[_0x1a65('0x28')](_0x2f9238)[_0x1a65('0x29')](function(_0x3ab50b){return _0x3ab50b;});}return null;};}function removeEntity(_0x37ecd0,_0x27ae72){return function(_0x546bd3){if(_0x546bd3){return _0x546bd3[_0x1a65('0x2a')]()[_0x1a65('0x29')](function(){_0x37ecd0[_0x1a65('0x1c')](0xcc)[_0x1a65('0x1d')]();});}};}function handleEntityNotFound(_0x4b57cc,_0x5b94b0){return function(_0x416e45){if(!_0x416e45){_0x4b57cc[_0x1a65('0x1b')](0x194);}return _0x416e45;};}function handleError(_0x24c60e,_0x7a8433){_0x7a8433=_0x7a8433||0x1f4;return function(_0x4f92b1){logger[_0x1a65('0x2b')](_0x4f92b1[_0x1a65('0x2c')]);if(_0x4f92b1[_0x1a65('0x2d')]){delete _0x4f92b1[_0x1a65('0x2d')];}_0x24c60e['status'](_0x7a8433)[_0x1a65('0x2e')](_0x4f92b1);};}exports[_0x1a65('0x2f')]=function(_0x14ed84,_0x1be221){var _0x8b63b1={},_0x2d5ad2={},_0x32e5ed={'count':0x0,'rows':[]};var _0x38bc1f=_[_0x1a65('0x30')](db[_0x1a65('0x31')][_0x1a65('0x32')],function(_0x1a0bf3){return{'name':_0x1a0bf3[_0x1a65('0x33')],'type':_0x1a0bf3[_0x1a65('0x34')][_0x1a65('0x35')]};});_0x2d5ad2['model']=_['map'](_0x38bc1f,_0x1a65('0x2d'));_0x2d5ad2[_0x1a65('0x36')]=_[_0x1a65('0x37')](_0x14ed84['query']);_0x2d5ad2[_0x1a65('0x38')]=_['intersection'](_0x2d5ad2['model'],_0x2d5ad2[_0x1a65('0x36')]);_0x8b63b1[_0x1a65('0x39')]=_[_0x1a65('0x3a')](_0x2d5ad2[_0x1a65('0x3b')],qs['fields'](_0x14ed84[_0x1a65('0x36')][_0x1a65('0x3c')]));_0x8b63b1[_0x1a65('0x39')]=_0x8b63b1[_0x1a65('0x39')]['length']?_0x8b63b1[_0x1a65('0x39')]:_0x2d5ad2[_0x1a65('0x3b')];if(!_0x14ed84[_0x1a65('0x36')]['hasOwnProperty']('nolimit')){_0x8b63b1[_0x1a65('0x21')]=qs[_0x1a65('0x21')](_0x14ed84[_0x1a65('0x36')][_0x1a65('0x21')]);_0x8b63b1[_0x1a65('0x1f')]=qs['offset'](_0x14ed84['query'][_0x1a65('0x1f')]);}_0x8b63b1[_0x1a65('0x3d')]=qs['sort'](_0x14ed84[_0x1a65('0x36')][_0x1a65('0x3e')]);_0x8b63b1[_0x1a65('0x3f')]=qs[_0x1a65('0x38')](_[_0x1a65('0x40')](_0x14ed84['query'],_0x2d5ad2[_0x1a65('0x38')]),_0x38bc1f);if(_0x14ed84[_0x1a65('0x36')][_0x1a65('0x41')]){_0x8b63b1['where']=_['merge'](_0x8b63b1['where'],{'$or':_[_0x1a65('0x30')](_0x38bc1f,function(_0x4310c4){if(_0x4310c4['type']!==_0x1a65('0x42')){var _0x106e88={};_0x106e88[_0x4310c4['name']]={'$like':'%'+_0x14ed84[_0x1a65('0x36')][_0x1a65('0x41')]+'%'};return _0x106e88;}})});}_0x8b63b1=_['merge']({},_0x8b63b1,_0x14ed84[_0x1a65('0x43')]);var _0x52c96e={'where':_0x8b63b1[_0x1a65('0x3f')]};return db[_0x1a65('0x31')][_0x1a65('0x22')](_0x52c96e)[_0x1a65('0x29')](function(_0x21f3bd){_0x32e5ed[_0x1a65('0x22')]=_0x21f3bd;if(_0x14ed84[_0x1a65('0x36')][_0x1a65('0x44')]){_0x8b63b1[_0x1a65('0x45')]=[{'all':!![]}];}return db[_0x1a65('0x31')][_0x1a65('0x46')](_0x8b63b1);})[_0x1a65('0x29')](function(_0x51e8eb){_0x32e5ed['rows']=_0x51e8eb;return _0x32e5ed;})[_0x1a65('0x29')](respondWithFilteredResult(_0x1be221,_0x8b63b1))['catch'](handleError(_0x1be221,null));};exports['show']=function(_0xf0daf0,_0x38380d){var _0x59b107={'raw':!![],'where':{'id':_0xf0daf0[_0x1a65('0x47')]['id']}},_0xc79d21={};_0xc79d21[_0x1a65('0x3b')]=_[_0x1a65('0x37')](db[_0x1a65('0x31')][_0x1a65('0x32')]);_0xc79d21[_0x1a65('0x36')]=_[_0x1a65('0x37')](_0xf0daf0[_0x1a65('0x36')]);_0xc79d21['filters']=_[_0x1a65('0x3a')](_0xc79d21['model'],_0xc79d21['query']);_0x59b107['attributes']=_['intersection'](_0xc79d21[_0x1a65('0x3b')],qs[_0x1a65('0x3c')](_0xf0daf0['query'][_0x1a65('0x3c')]));_0x59b107['attributes']=_0x59b107['attributes'][_0x1a65('0x48')]?_0x59b107['attributes']:_0xc79d21['model'];if(_0xf0daf0['query'][_0x1a65('0x44')]){_0x59b107[_0x1a65('0x45')]=[{'all':!![]}];}_0x59b107=_[_0x1a65('0x49')]({},_0x59b107,_0xf0daf0[_0x1a65('0x43')]);return db['SalesforceField'][_0x1a65('0x4a')](_0x59b107)[_0x1a65('0x29')](handleEntityNotFound(_0x38380d,null))['then'](respondWithResult(_0x38380d,null))[_0x1a65('0x4b')](handleError(_0x38380d,null));};exports[_0x1a65('0x4c')]=function(_0x5ae74b,_0x36e83c){return db[_0x1a65('0x31')][_0x1a65('0x4c')](_0x5ae74b['body'],{})['then'](respondWithResult(_0x36e83c,0xc9))[_0x1a65('0x4b')](handleError(_0x36e83c,null));};exports['update']=function(_0xde7a69,_0x2a88de){if(_0xde7a69[_0x1a65('0x4d')]['id']){delete _0xde7a69['body']['id'];}return db[_0x1a65('0x31')][_0x1a65('0x4a')]({'where':{'id':_0xde7a69[_0x1a65('0x47')]['id']}})[_0x1a65('0x29')](handleEntityNotFound(_0x2a88de,null))['then'](saveUpdates(_0xde7a69['body'],null))[_0x1a65('0x29')](respondWithResult(_0x2a88de,null))['catch'](handleError(_0x2a88de,null));};exports[_0x1a65('0x2a')]=function(_0x53a50c,_0x2a1284){return db[_0x1a65('0x31')][_0x1a65('0x4a')]({'where':{'id':_0x53a50c[_0x1a65('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a1284,null))[_0x1a65('0x29')](removeEntity(_0x2a1284,null))[_0x1a65('0x4b')](handleError(_0x2a1284,null));}; \ No newline at end of file +var _0x7bf6=['apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','map','includeAll','include','rows','catch','params','options','find','create','body','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x7bf6,0x194));var _0x67bf=function(_0x19595e,_0x4f2b8a){_0x19595e=_0x19595e-0x0;var _0x3f76fa=_0x7bf6[_0x19595e];return _0x3f76fa;};'use strict';var emlformat=require(_0x67bf('0x0'));var rimraf=require(_0x67bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x67bf('0x2'));var moment=require('moment');var BPromise=require(_0x67bf('0x3'));var Mustache=require(_0x67bf('0x4'));var util=require(_0x67bf('0x5'));var path=require(_0x67bf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x67bf('0x7'));var fs=require('fs');var fs_extra=require(_0x67bf('0x8'));var _=require(_0x67bf('0x9'));var squel=require(_0x67bf('0xa'));var crypto=require(_0x67bf('0xb'));var jsforce=require(_0x67bf('0xc'));var deskjs=require(_0x67bf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x67bf('0xe'));var Papa=require(_0x67bf('0xf'));var Redis=require(_0x67bf('0x10'));var authService=require(_0x67bf('0x11'));var qs=require(_0x67bf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67bf('0x13'));var logger=require('../../config/logger')(_0x67bf('0x14'));var utils=require(_0x67bf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x67bf('0x16'));var db=require(_0x67bf('0x17'))['db'];function respondWithStatusCode(_0x567cbd,_0x5159b3){_0x5159b3=_0x5159b3||0xcc;return function(_0x1bfea4){if(_0x1bfea4){return _0x567cbd[_0x67bf('0x18')](_0x5159b3);}return _0x567cbd[_0x67bf('0x19')](_0x5159b3)[_0x67bf('0x1a')]();};}function respondWithResult(_0x43d1a6,_0x14c1b2){_0x14c1b2=_0x14c1b2||0xc8;return function(_0x4b9030){if(_0x4b9030){return _0x43d1a6[_0x67bf('0x19')](_0x14c1b2)['json'](_0x4b9030);}};}function respondWithFilteredResult(_0x3e50b2,_0xc957a3){return function(_0x4796e0){if(_0x4796e0){var _0xdf850b=typeof _0xc957a3[_0x67bf('0x1b')]===_0x67bf('0x1c')&&typeof _0xc957a3[_0x67bf('0x1d')]===_0x67bf('0x1c');var _0x34db3c=_0x4796e0[_0x67bf('0x1e')];var _0x3efa7d=_0xdf850b?0x0:_0xc957a3[_0x67bf('0x1b')];var _0x2c8f1c=_0xdf850b?_0x4796e0[_0x67bf('0x1e')]:_0xc957a3[_0x67bf('0x1b')]+_0xc957a3['limit'];var _0x13148e;if(_0x2c8f1c>=_0x34db3c){_0x2c8f1c=_0x34db3c;_0x13148e=0xc8;}else{_0x13148e=0xce;}_0x3e50b2['status'](_0x13148e);return _0x3e50b2[_0x67bf('0x1f')](_0x67bf('0x20'),_0x3efa7d+'-'+_0x2c8f1c+'/'+_0x34db3c)[_0x67bf('0x21')](_0x4796e0);}return null;};}function patchUpdates(_0x16b9b8){return function(_0x373b9d){try{jsonpatch[_0x67bf('0x22')](_0x373b9d,_0x16b9b8,!![]);}catch(_0x3b13c6){return BPromise[_0x67bf('0x23')](_0x3b13c6);}return _0x373b9d[_0x67bf('0x24')]();};}function saveUpdates(_0xdd76d,_0x5c0229){return function(_0x59fa43){if(_0x59fa43){return _0x59fa43[_0x67bf('0x25')](_0xdd76d)[_0x67bf('0x26')](function(_0x14a98d){return _0x14a98d;});}return null;};}function removeEntity(_0x3d349c,_0x3ecc8e){return function(_0x1eddb6){if(_0x1eddb6){return _0x1eddb6[_0x67bf('0x27')]()['then'](function(){_0x3d349c[_0x67bf('0x19')](0xcc)[_0x67bf('0x1a')]();});}};}function handleEntityNotFound(_0xc8465,_0x433da1){return function(_0x5c2cd7){if(!_0x5c2cd7){_0xc8465[_0x67bf('0x18')](0x194);}return _0x5c2cd7;};}function handleError(_0x637283,_0x1b48de){_0x1b48de=_0x1b48de||0x1f4;return function(_0x5e7d9b){logger[_0x67bf('0x28')](_0x5e7d9b[_0x67bf('0x29')]);if(_0x5e7d9b[_0x67bf('0x2a')]){delete _0x5e7d9b[_0x67bf('0x2a')];}_0x637283[_0x67bf('0x19')](_0x1b48de)[_0x67bf('0x2b')](_0x5e7d9b);};}exports[_0x67bf('0x2c')]=function(_0x5f05a3,_0x16aca2){var _0x4282dc={},_0x14129f={},_0x74d6b4={'count':0x0,'rows':[]};var _0x453562=_['map'](db[_0x67bf('0x2d')][_0x67bf('0x2e')],function(_0x2d246f){return{'name':_0x2d246f[_0x67bf('0x2f')],'type':_0x2d246f[_0x67bf('0x30')][_0x67bf('0x31')]};});_0x14129f[_0x67bf('0x32')]=_['map'](_0x453562,_0x67bf('0x2a'));_0x14129f[_0x67bf('0x33')]=_[_0x67bf('0x34')](_0x5f05a3['query']);_0x14129f[_0x67bf('0x35')]=_[_0x67bf('0x36')](_0x14129f[_0x67bf('0x32')],_0x14129f[_0x67bf('0x33')]);_0x4282dc[_0x67bf('0x37')]=_[_0x67bf('0x36')](_0x14129f[_0x67bf('0x32')],qs[_0x67bf('0x38')](_0x5f05a3[_0x67bf('0x33')]['fields']));_0x4282dc['attributes']=_0x4282dc[_0x67bf('0x37')][_0x67bf('0x39')]?_0x4282dc[_0x67bf('0x37')]:_0x14129f[_0x67bf('0x32')];if(!_0x5f05a3[_0x67bf('0x33')]['hasOwnProperty'](_0x67bf('0x3a'))){_0x4282dc[_0x67bf('0x1d')]=qs[_0x67bf('0x1d')](_0x5f05a3['query'][_0x67bf('0x1d')]);_0x4282dc[_0x67bf('0x1b')]=qs[_0x67bf('0x1b')](_0x5f05a3[_0x67bf('0x33')][_0x67bf('0x1b')]);}_0x4282dc['order']=qs[_0x67bf('0x3b')](_0x5f05a3[_0x67bf('0x33')][_0x67bf('0x3b')]);_0x4282dc['where']=qs[_0x67bf('0x35')](_['pick'](_0x5f05a3[_0x67bf('0x33')],_0x14129f[_0x67bf('0x35')]),_0x453562);if(_0x5f05a3['query'][_0x67bf('0x3c')]){_0x4282dc[_0x67bf('0x3d')]=_[_0x67bf('0x3e')](_0x4282dc['where'],{'$or':_[_0x67bf('0x3f')](_0x453562,function(_0x542ba8){if(_0x542ba8[_0x67bf('0x30')]!=='VIRTUAL'){var _0x6b0452={};_0x6b0452[_0x542ba8['name']]={'$like':'%'+_0x5f05a3[_0x67bf('0x33')][_0x67bf('0x3c')]+'%'};return _0x6b0452;}})});}_0x4282dc=_[_0x67bf('0x3e')]({},_0x4282dc,_0x5f05a3['options']);var _0x5900ea={'where':_0x4282dc[_0x67bf('0x3d')]};return db[_0x67bf('0x2d')]['count'](_0x5900ea)[_0x67bf('0x26')](function(_0x4a4c62){_0x74d6b4[_0x67bf('0x1e')]=_0x4a4c62;if(_0x5f05a3[_0x67bf('0x33')][_0x67bf('0x40')]){_0x4282dc[_0x67bf('0x41')]=[{'all':!![]}];}return db[_0x67bf('0x2d')]['findAll'](_0x4282dc);})[_0x67bf('0x26')](function(_0x53357c){_0x74d6b4[_0x67bf('0x42')]=_0x53357c;return _0x74d6b4;})['then'](respondWithFilteredResult(_0x16aca2,_0x4282dc))[_0x67bf('0x43')](handleError(_0x16aca2,null));};exports['show']=function(_0x1eeef3,_0x1ffa58){var _0x18973b={'raw':!![],'where':{'id':_0x1eeef3[_0x67bf('0x44')]['id']}},_0x266f0b={};_0x266f0b[_0x67bf('0x32')]=_[_0x67bf('0x34')](db[_0x67bf('0x2d')][_0x67bf('0x2e')]);_0x266f0b[_0x67bf('0x33')]=_[_0x67bf('0x34')](_0x1eeef3[_0x67bf('0x33')]);_0x266f0b[_0x67bf('0x35')]=_[_0x67bf('0x36')](_0x266f0b[_0x67bf('0x32')],_0x266f0b[_0x67bf('0x33')]);_0x18973b[_0x67bf('0x37')]=_[_0x67bf('0x36')](_0x266f0b[_0x67bf('0x32')],qs[_0x67bf('0x38')](_0x1eeef3[_0x67bf('0x33')]['fields']));_0x18973b[_0x67bf('0x37')]=_0x18973b[_0x67bf('0x37')]['length']?_0x18973b[_0x67bf('0x37')]:_0x266f0b[_0x67bf('0x32')];if(_0x1eeef3['query'][_0x67bf('0x40')]){_0x18973b[_0x67bf('0x41')]=[{'all':!![]}];}_0x18973b=_['merge']({},_0x18973b,_0x1eeef3[_0x67bf('0x45')]);return db[_0x67bf('0x2d')][_0x67bf('0x46')](_0x18973b)[_0x67bf('0x26')](handleEntityNotFound(_0x1ffa58,null))['then'](respondWithResult(_0x1ffa58,null))[_0x67bf('0x43')](handleError(_0x1ffa58,null));};exports['create']=function(_0x5e383e,_0x2f40f0){return db[_0x67bf('0x2d')][_0x67bf('0x47')](_0x5e383e[_0x67bf('0x48')],{})['then'](respondWithResult(_0x2f40f0,0xc9))['catch'](handleError(_0x2f40f0,null));};exports[_0x67bf('0x25')]=function(_0x437dd6,_0x3d6473){if(_0x437dd6[_0x67bf('0x48')]['id']){delete _0x437dd6['body']['id'];}return db[_0x67bf('0x2d')][_0x67bf('0x46')]({'where':{'id':_0x437dd6[_0x67bf('0x44')]['id']}})[_0x67bf('0x26')](handleEntityNotFound(_0x3d6473,null))[_0x67bf('0x26')](saveUpdates(_0x437dd6['body'],null))[_0x67bf('0x26')](respondWithResult(_0x3d6473,null))[_0x67bf('0x43')](handleError(_0x3d6473,null));};exports[_0x67bf('0x27')]=function(_0xcf654c,_0x322139){return db[_0x67bf('0x2d')][_0x67bf('0x46')]({'where':{'id':_0xcf654c[_0x67bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x322139,null))[_0x67bf('0x26')](removeEntity(_0x322139,null))[_0x67bf('0x43')](handleError(_0x322139,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6be6fb7..0edafa1 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 _0xdbe2=['bluebird','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','api'];(function(_0xb60674,_0xa4e08a){var _0x2514a0=function(_0x5bfc26){while(--_0x5bfc26){_0xb60674['push'](_0xb60674['shift']());}};_0x2514a0(++_0xa4e08a);}(_0xdbe2,0xe2));var _0x2dbe=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0xdbe2[_0x2e914];return _0x936e45;};'use strict';var _=require(_0x2dbe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2dbe('0x1'));var moment=require('moment');var BPromise=require(_0x2dbe('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2dbe('0x3'));var rimraf=require('rimraf');var config=require(_0x2dbe('0x4'));var attributes=require(_0x2dbe('0x5'));module[_0x2dbe('0x6')]=function(_0x4d6906,_0x5eac85){return _0x4d6906[_0x2dbe('0x7')](_0x2dbe('0x8'),attributes,{'tableName':_0x2dbe('0x9'),'paranoid':![],'indexes':[{'name':_0x2dbe('0xa'),'fields':[_0x2dbe('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3756=['moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','util','../../config/logger','api'];(function(_0x2b338b,_0x4a06ba){var _0x256f66=function(_0x13c9c4){while(--_0x13c9c4){_0x2b338b['push'](_0x2b338b['shift']());}};_0x256f66(++_0x4a06ba);}(_0x3756,0x15b));var _0x6375=function(_0x54ec23,_0x3e8a6f){_0x54ec23=_0x54ec23-0x0;var _0x20c7aa=_0x3756[_0x54ec23];return _0x20c7aa;};'use strict';var _=require('lodash');var util=require(_0x6375('0x0'));var logger=require(_0x6375('0x1'))(_0x6375('0x2'));var moment=require(_0x6375('0x3'));var BPromise=require(_0x6375('0x4'));var rp=require(_0x6375('0x5'));var fs=require('fs');var path=require(_0x6375('0x6'));var rimraf=require(_0x6375('0x7'));var config=require('../../config/environment');var attributes=require(_0x6375('0x8'));module[_0x6375('0x9')]=function(_0x5485f7,_0x3971bf){return _0x5485f7[_0x6375('0xa')]('SalesforceField',attributes,{'tableName':_0x6375('0xb'),'paranoid':![],'indexes':[{'name':_0x6375('0xc'),'fields':[_0x6375('0xd'),'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 c8055fe..9038710 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 _0xa07c=['../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x28b9fa,_0x25f40a){var _0x1beb5d=function(_0x56dc14){while(--_0x56dc14){_0x28b9fa['push'](_0x28b9fa['shift']());}};_0x1beb5d(++_0x25f40a);}(_0xa07c,0xeb));var _0xca07=function(_0x1590ea,_0x29daa5){_0x1590ea=_0x1590ea-0x0;var _0x3b3be6=_0xa07c[_0x1590ea];return _0x3b3be6;};'use strict';var _=require('lodash');var util=require(_0xca07('0x0'));var moment=require(_0xca07('0x1'));var BPromise=require(_0xca07('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca07('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xca07('0x4'));var logger=require(_0xca07('0x5'))(_0xca07('0x6'));var config=require(_0xca07('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xca07('0x8')][_0xca07('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20a0a6,_0x41e02d,_0x53e481){return new BPromise(function(_0x18c323,_0x301fff){return client[_0xca07('0xa')](_0x20a0a6,_0x53e481)[_0xca07('0xb')](function(_0x23e689){logger[_0xca07('0xc')](_0xca07('0xd'),_0x41e02d,_0xca07('0xe'));logger[_0xca07('0xf')](_0xca07('0x10'),_0x41e02d,_0xca07('0xe'),JSON[_0xca07('0x11')](_0x23e689));if(_0x23e689[_0xca07('0x12')]){if(_0x23e689[_0xca07('0x12')][_0xca07('0x13')]===0x1f4){logger[_0xca07('0x12')](_0xca07('0xd'),_0x41e02d,_0x23e689['error'][_0xca07('0x14')]);return _0x301fff(_0x23e689['error'][_0xca07('0x14')]);}logger[_0xca07('0x12')]('SalesforceField,\x20%s,\x20%s',_0x41e02d,_0x23e689[_0xca07('0x12')][_0xca07('0x14')]);return _0x18c323(_0x23e689[_0xca07('0x12')][_0xca07('0x14')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x41e02d,_0xca07('0xe'));_0x18c323(_0x23e689[_0xca07('0x15')][_0xca07('0x14')]);}})['catch'](function(_0x3a259e){logger[_0xca07('0x12')](_0xca07('0xd'),_0x41e02d,_0x3a259e);_0x301fff(_0x3a259e);});});} \ No newline at end of file +var _0xa64d=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xa64d,0x1ac));var _0xda64=function(_0x3643fa,_0x186435){_0x3643fa=_0x3643fa-0x0;var _0x3803a8=_0xa64d[_0x3643fa];return _0x3803a8;};'use strict';var _=require(_0xda64('0x0'));var util=require(_0xda64('0x1'));var moment=require(_0xda64('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda64('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda64('0x4'));var logger=require(_0xda64('0x5'))(_0xda64('0x6'));var config=require(_0xda64('0x7'));var jayson=require(_0xda64('0x8'));var client=jayson[_0xda64('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c4d04,_0x61017c,_0x408d3e){return new BPromise(function(_0x2c6a94,_0x335adf){return client['request'](_0x1c4d04,_0x408d3e)[_0xda64('0xa')](function(_0x1f7c1d){logger[_0xda64('0xb')](_0xda64('0xc'),_0x61017c,_0xda64('0xd'));logger[_0xda64('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x61017c,_0xda64('0xd'),JSON[_0xda64('0xf')](_0x1f7c1d));if(_0x1f7c1d['error']){if(_0x1f7c1d[_0xda64('0x10')][_0xda64('0x11')]===0x1f4){logger[_0xda64('0x10')]('SalesforceField,\x20%s,\x20%s',_0x61017c,_0x1f7c1d[_0xda64('0x10')][_0xda64('0x12')]);return _0x335adf(_0x1f7c1d['error'][_0xda64('0x12')]);}logger[_0xda64('0x10')](_0xda64('0xc'),_0x61017c,_0x1f7c1d[_0xda64('0x10')][_0xda64('0x12')]);return _0x2c6a94(_0x1f7c1d[_0xda64('0x10')]['message']);}else{logger[_0xda64('0xb')]('SalesforceField,\x20%s,\x20%s',_0x61017c,_0xda64('0xd'));_0x2c6a94(_0x1f7c1d[_0xda64('0x13')][_0xda64('0x12')]);}})['catch'](function(_0x553df2){logger['error'](_0xda64('0xc'),_0x61017c,_0x553df2);_0x335adf(_0x553df2);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 21abec5..06dd133 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 _0xa4b1=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x122976,_0x1506ad){var _0x3ed4f7=function(_0x549ac8){while(--_0x549ac8){_0x122976['push'](_0x122976['shift']());}};_0x3ed4f7(++_0x1506ad);}(_0xa4b1,0x133));var _0x1a4b=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa4b1[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x1a4b('0x0'));var util=require(_0x1a4b('0x1'));var path=require(_0x1a4b('0x2'));var timeout=require(_0x1a4b('0x3'));var express=require(_0x1a4b('0x4'));var router=express['Router']();var fs_extra=require(_0x1a4b('0x5'));var auth=require(_0x1a4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a4b('0x7'));var controller=require(_0x1a4b('0x8'));router[_0x1a4b('0x9')]('/',auth[_0x1a4b('0xa')](),controller['index']);router[_0x1a4b('0x9')](_0x1a4b('0xb'),auth[_0x1a4b('0xa')](),controller['show']);router['get']('/:id/configurations',auth[_0x1a4b('0xa')](),controller['getConfigurations']);router[_0x1a4b('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1a4b('0xc')]);router[_0x1a4b('0xd')]('/',auth['isAuthenticated'](),controller[_0x1a4b('0xe')]);router[_0x1a4b('0xd')](_0x1a4b('0xf'),auth[_0x1a4b('0xa')](),controller[_0x1a4b('0x10')]);router[_0x1a4b('0x11')](_0x1a4b('0xb'),auth[_0x1a4b('0xa')](),controller[_0x1a4b('0x12')]);router[_0x1a4b('0x13')](_0x1a4b('0xb'),auth[_0x1a4b('0xa')](),controller[_0x1a4b('0x14')]);module[_0x1a4b('0x15')]=router; \ No newline at end of file +var _0x8093=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x2c3087,_0x241747){var _0x31ded9=function(_0x5b50fe){while(--_0x5b50fe){_0x2c3087['push'](_0x2c3087['shift']());}};_0x31ded9(++_0x241747);}(_0x8093,0xa9));var _0x3809=function(_0x2bab95,_0x15f1a8){_0x2bab95=_0x2bab95-0x0;var _0x5b31cd=_0x8093[_0x2bab95];return _0x5b31cd;};'use strict';var multer=require(_0x3809('0x0'));var util=require(_0x3809('0x1'));var path=require(_0x3809('0x2'));var timeout=require(_0x3809('0x3'));var express=require(_0x3809('0x4'));var router=express[_0x3809('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3809('0x6'));var interaction=require(_0x3809('0x7'));var config=require(_0x3809('0x8'));var controller=require(_0x3809('0x9'));router[_0x3809('0xa')]('/',auth[_0x3809('0xb')](),controller[_0x3809('0xc')]);router[_0x3809('0xa')](_0x3809('0xd'),auth[_0x3809('0xb')](),controller[_0x3809('0xe')]);router[_0x3809('0xa')]('/:id/configurations',auth[_0x3809('0xb')](),controller[_0x3809('0xf')]);router[_0x3809('0xa')](_0x3809('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x3809('0x11')]('/',auth['isAuthenticated'](),controller[_0x3809('0x12')]);router['post']('/:id/configurations',auth[_0x3809('0xb')](),controller[_0x3809('0x13')]);router[_0x3809('0x14')]('/:id',auth[_0x3809('0xb')](),controller[_0x3809('0x15')]);router[_0x3809('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3809('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d4d5cbf..18d23d1 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 _0x26c1=['STRING','remoteUri','sequelize'];(function(_0x18a3fd,_0x2577de){var _0x30077f=function(_0x2e7172){while(--_0x2e7172){_0x18a3fd['push'](_0x18a3fd['shift']());}};_0x30077f(++_0x2577de);}(_0x26c1,0x194));var _0x126c=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x26c1[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x126c('0x0'));module['exports']={'name':{'type':Sequelize[_0x126c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x126c('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x126c('0x1')]},'email':{'type':Sequelize[_0x126c('0x1')]},'remoteUri':{'type':Sequelize[_0x126c('0x1')],'unique':_0x126c('0x2')},'serverUrl':{'type':Sequelize[_0x126c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x41e5=['STRING','username','sequelize','exports'];(function(_0x17d87f,_0x1e1646){var _0x4d7e05=function(_0x5f0f48){while(--_0x5f0f48){_0x17d87f['push'](_0x17d87f['shift']());}};_0x4d7e05(++_0x1e1646);}(_0x41e5,0x1b2));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x541e('0x0'));module[_0x541e('0x1')]={'name':{'type':Sequelize[_0x541e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x541e('0x2')],'unique':_0x541e('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x541e('0x2')]},'remoteUri':{'type':Sequelize[_0x541e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x541e('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 461f168..a7c2357 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 _0x6602=['type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','destroy','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','parent','caused_by','watch_list','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','parent_incident','contact_type','reopened_by','incident_state','urgency','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','value','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','ServicenowAccount','fieldName'];(function(_0xe485c4,_0x3d0f36){var _0x24cb58=function(_0x492673){while(--_0x492673){_0xe485c4['push'](_0xe485c4['shift']());}};_0x24cb58(++_0x3d0f36);}(_0x6602,0x141));var _0x2660=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6602[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2660('0x0'));var rp=require(_0x2660('0x1'));var moment=require(_0x2660('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2660('0x3'));var util=require(_0x2660('0x4'));var path=require('path');var sox=require(_0x2660('0x5'));var csv=require(_0x2660('0x6'));var ejs=require(_0x2660('0x7'));var fs=require('fs');var fs_extra=require(_0x2660('0x8'));var _=require(_0x2660('0x9'));var squel=require(_0x2660('0xa'));var crypto=require(_0x2660('0xb'));var jsforce=require(_0x2660('0xc'));var deskjs=require(_0x2660('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2660('0xe'));var Papa=require('papaparse');var Redis=require(_0x2660('0xf'));var authService=require(_0x2660('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2660('0x11'));var hardwareService=require(_0x2660('0x12'));var logger=require(_0x2660('0x13'))(_0x2660('0x14'));var utils=require('../../config/utils');var config=require(_0x2660('0x15'));var licenseUtil=require(_0x2660('0x16'));var db=require(_0x2660('0x17'))['db'];var integrations=require(_0x2660('0x18'));function respondWithStatusCode(_0x9bea58,_0xe39b9a){_0xe39b9a=_0xe39b9a||0xcc;return function(_0x46ab9e){if(_0x46ab9e){return _0x9bea58['sendStatus'](_0xe39b9a);}return _0x9bea58[_0x2660('0x19')](_0xe39b9a)[_0x2660('0x1a')]();};}function respondWithResult(_0x330881,_0x3c20fd){_0x3c20fd=_0x3c20fd||0xc8;return function(_0x5ed24a){if(_0x5ed24a){return _0x330881[_0x2660('0x19')](_0x3c20fd)[_0x2660('0x1b')](_0x5ed24a);}};}function respondWithFilteredResult(_0x104ba0,_0x33e906){return function(_0x19f54d){if(_0x19f54d){var _0x364aa4=typeof _0x33e906[_0x2660('0x1c')]===_0x2660('0x1d')&&typeof _0x33e906[_0x2660('0x1e')]===_0x2660('0x1d');var _0x558c49=_0x19f54d['count'];var _0x354166=_0x364aa4?0x0:_0x33e906[_0x2660('0x1c')];var _0x3efa38=_0x364aa4?_0x19f54d[_0x2660('0x1f')]:_0x33e906[_0x2660('0x1c')]+_0x33e906[_0x2660('0x1e')];var _0xea5ebe;if(_0x3efa38>=_0x558c49){_0x3efa38=_0x558c49;_0xea5ebe=0xc8;}else{_0xea5ebe=0xce;}_0x104ba0[_0x2660('0x19')](_0xea5ebe);return _0x104ba0[_0x2660('0x20')](_0x2660('0x21'),_0x354166+'-'+_0x3efa38+'/'+_0x558c49)[_0x2660('0x1b')](_0x19f54d);}return null;};}function patchUpdates(_0x3169b3){return function(_0x31f114){try{jsonpatch['apply'](_0x31f114,_0x3169b3,!![]);}catch(_0x358cf6){return BPromise['reject'](_0x358cf6);}return _0x31f114[_0x2660('0x22')]();};}function saveUpdates(_0x181ed4,_0x439dee){return function(_0x39cc89){if(_0x39cc89){return _0x39cc89[_0x2660('0x23')](_0x181ed4)[_0x2660('0x24')](function(_0x5b66e9){return _0x5b66e9;});}return null;};}function removeEntity(_0x63d13b,_0x40a705){return function(_0x4f5f34){if(_0x4f5f34){return _0x4f5f34['destroy']()['then'](function(){_0x63d13b[_0x2660('0x19')](0xcc)[_0x2660('0x1a')]();});}};}function handleEntityNotFound(_0x3755c5,_0x548713){return function(_0x54f93b){if(!_0x54f93b){_0x3755c5[_0x2660('0x25')](0x194);}return _0x54f93b;};}function handleError(_0x5009db,_0x40497b){_0x40497b=_0x40497b||0x1f4;return function(_0x4d352e){logger[_0x2660('0x26')](_0x4d352e[_0x2660('0x27')]);if(_0x4d352e[_0x2660('0x28')]){delete _0x4d352e[_0x2660('0x28')];}_0x5009db[_0x2660('0x19')](_0x40497b)[_0x2660('0x29')](_0x4d352e);};}exports[_0x2660('0x2a')]=function(_0x2f472a,_0xf3c84c){var _0xbcdb1c={},_0x351844={},_0x50c6db={'count':0x0,'rows':[]};var _0x16d86b=_['map'](db[_0x2660('0x2b')]['rawAttributes'],function(_0x2b879f){return{'name':_0x2b879f[_0x2660('0x2c')],'type':_0x2b879f[_0x2660('0x2d')]['key']};});_0x351844[_0x2660('0x2e')]=_[_0x2660('0x2f')](_0x16d86b,_0x2660('0x28'));_0x351844[_0x2660('0x30')]=_['keys'](_0x2f472a[_0x2660('0x30')]);_0x351844['filters']=_[_0x2660('0x31')](_0x351844[_0x2660('0x2e')],_0x351844[_0x2660('0x30')]);_0xbcdb1c[_0x2660('0x32')]=_[_0x2660('0x31')](_0x351844[_0x2660('0x2e')],qs[_0x2660('0x33')](_0x2f472a[_0x2660('0x30')][_0x2660('0x33')]));_0xbcdb1c[_0x2660('0x32')]=_0xbcdb1c[_0x2660('0x32')][_0x2660('0x34')]?_0xbcdb1c[_0x2660('0x32')]:_0x351844['model'];if(!_0x2f472a[_0x2660('0x30')][_0x2660('0x35')](_0x2660('0x36'))){_0xbcdb1c[_0x2660('0x1e')]=qs[_0x2660('0x1e')](_0x2f472a[_0x2660('0x30')][_0x2660('0x1e')]);_0xbcdb1c['offset']=qs[_0x2660('0x1c')](_0x2f472a[_0x2660('0x30')][_0x2660('0x1c')]);}_0xbcdb1c['order']=qs[_0x2660('0x37')](_0x2f472a['query'][_0x2660('0x37')]);_0xbcdb1c[_0x2660('0x38')]=qs[_0x2660('0x39')](_[_0x2660('0x3a')](_0x2f472a[_0x2660('0x30')],_0x351844['filters']),_0x16d86b);if(_0x2f472a[_0x2660('0x30')][_0x2660('0x3b')]){_0xbcdb1c['where']=_[_0x2660('0x3c')](_0xbcdb1c[_0x2660('0x38')],{'$or':_[_0x2660('0x2f')](_0x16d86b,function(_0x19ca29){if(_0x19ca29['type']!=='VIRTUAL'){var _0x542795={};_0x542795[_0x19ca29[_0x2660('0x28')]]={'$like':'%'+_0x2f472a['query']['filter']+'%'};return _0x542795;}})});}_0xbcdb1c=_[_0x2660('0x3c')]({},_0xbcdb1c,_0x2f472a[_0x2660('0x3d')]);var _0x7b6ed6={'where':_0xbcdb1c[_0x2660('0x38')]};return db[_0x2660('0x2b')][_0x2660('0x1f')](_0x7b6ed6)['then'](function(_0x4bdaef){_0x50c6db['count']=_0x4bdaef;if(_0x2f472a['query']['includeAll']){_0xbcdb1c[_0x2660('0x3e')]=[{'all':!![]}];}return db[_0x2660('0x2b')][_0x2660('0x3f')](_0xbcdb1c);})[_0x2660('0x24')](function(_0x20afb7){_0x50c6db[_0x2660('0x40')]=_0x20afb7;return _0x50c6db;})[_0x2660('0x24')](respondWithFilteredResult(_0xf3c84c,_0xbcdb1c))['catch'](handleError(_0xf3c84c,null));};exports[_0x2660('0x41')]=function(_0x7366bb,_0x181bef){var _0x551fa2={'raw':![],'where':{'id':_0x7366bb[_0x2660('0x42')]['id']}},_0x3adecf={};_0x3adecf[_0x2660('0x2e')]=_[_0x2660('0x43')](db['ServicenowAccount']['rawAttributes']);_0x3adecf[_0x2660('0x30')]=_['keys'](_0x7366bb[_0x2660('0x30')]);_0x3adecf[_0x2660('0x39')]=_[_0x2660('0x31')](_0x3adecf[_0x2660('0x2e')],_0x3adecf[_0x2660('0x30')]);_0x551fa2[_0x2660('0x32')]=_['intersection'](_0x3adecf[_0x2660('0x2e')],qs[_0x2660('0x33')](_0x7366bb[_0x2660('0x30')][_0x2660('0x33')]));_0x551fa2[_0x2660('0x32')]=_0x551fa2[_0x2660('0x32')][_0x2660('0x34')]?_0x551fa2['attributes']:_0x3adecf[_0x2660('0x2e')];if(_0x7366bb[_0x2660('0x30')][_0x2660('0x44')]){_0x551fa2['include']=[{'all':!![]}];}_0x551fa2=_[_0x2660('0x3c')]({},_0x551fa2,_0x7366bb[_0x2660('0x3d')]);return db['ServicenowAccount'][_0x2660('0x45')](_0x551fa2)[_0x2660('0x24')](handleEntityNotFound(_0x181bef,null))[_0x2660('0x24')](respondWithResult(_0x181bef,null))['catch'](handleError(_0x181bef,null));};exports[_0x2660('0x46')]=function(_0x51a7d1,_0x76ba5c){return db['ServicenowAccount'][_0x2660('0x46')](_0x51a7d1[_0x2660('0x47')],{})[_0x2660('0x24')](respondWithResult(_0x76ba5c,0xc9))[_0x2660('0x48')](handleError(_0x76ba5c,null));};exports['update']=function(_0x532a12,_0x487e70){if(_0x532a12[_0x2660('0x47')]['id']){delete _0x532a12[_0x2660('0x47')]['id'];}return db[_0x2660('0x2b')]['find']({'where':{'id':_0x532a12[_0x2660('0x42')]['id']}})[_0x2660('0x24')](handleEntityNotFound(_0x487e70,null))[_0x2660('0x24')](saveUpdates(_0x532a12[_0x2660('0x47')],null))[_0x2660('0x24')](respondWithResult(_0x487e70,null))['catch'](handleError(_0x487e70,null));};exports[_0x2660('0x49')]=function(_0x241024,_0x51caad){return db[_0x2660('0x2b')][_0x2660('0x45')]({'where':{'id':_0x241024[_0x2660('0x42')]['id']}})['then'](handleEntityNotFound(_0x51caad,null))[_0x2660('0x24')](removeEntity(_0x51caad,null))[_0x2660('0x48')](handleError(_0x51caad,null));};exports[_0x2660('0x4a')]=function(_0x25cc7c,_0x727b0d,_0x2bdfa9){var _0xf2d72f={};var _0x5e8da8={};var _0x15dc07;var _0x4b9327;return db['ServicenowAccount'][_0x2660('0x4b')]({'where':{'id':_0x25cc7c['params']['id']}})[_0x2660('0x24')](handleEntityNotFound(_0x727b0d,null))[_0x2660('0x24')](function(_0x5a3c9a){if(_0x5a3c9a){_0x15dc07=_0x5a3c9a;_0x5e8da8[_0x2660('0x2e')]=_[_0x2660('0x43')](db[_0x2660('0x4c')]['rawAttributes']);_0x5e8da8[_0x2660('0x30')]=_[_0x2660('0x43')](_0x25cc7c[_0x2660('0x30')]);_0x5e8da8['filters']=_[_0x2660('0x31')](_0x5e8da8[_0x2660('0x2e')],_0x5e8da8[_0x2660('0x30')]);_0xf2d72f[_0x2660('0x32')]=_[_0x2660('0x31')](_0x5e8da8['model'],qs[_0x2660('0x33')](_0x25cc7c[_0x2660('0x30')][_0x2660('0x33')]));_0xf2d72f[_0x2660('0x32')]=_0xf2d72f[_0x2660('0x32')][_0x2660('0x34')]?_0xf2d72f[_0x2660('0x32')]:_0x5e8da8[_0x2660('0x2e')];_0xf2d72f[_0x2660('0x4d')]=qs['sort'](_0x25cc7c[_0x2660('0x30')][_0x2660('0x37')]);_0xf2d72f[_0x2660('0x38')]=qs[_0x2660('0x39')](_[_0x2660('0x3a')](_0x25cc7c[_0x2660('0x30')],_0x5e8da8[_0x2660('0x39')]));if(_0x25cc7c[_0x2660('0x30')]['filter']){_0xf2d72f[_0x2660('0x38')]=_[_0x2660('0x3c')](_0xf2d72f[_0x2660('0x38')],{'$or':_[_0x2660('0x2f')](_0xf2d72f[_0x2660('0x32')],function(_0x2c6656){var _0x3075ad={};_0x3075ad[_0x2c6656]={'$like':'%'+_0x25cc7c['query'][_0x2660('0x3b')]+'%'};return _0x3075ad;})});}_0xf2d72f=_[_0x2660('0x3c')]({},_0xf2d72f,_0x25cc7c['options']);return _0x15dc07['getConfigurations'](_0xf2d72f);}})[_0x2660('0x24')](function(_0x2a06f5){if(_0x2a06f5){_0x4b9327=_0x2a06f5[_0x2660('0x34')];if(!_0x25cc7c[_0x2660('0x30')][_0x2660('0x35')]('nolimit')){_0xf2d72f[_0x2660('0x1e')]=qs[_0x2660('0x1e')](_0x25cc7c['query'][_0x2660('0x1e')]);_0xf2d72f['offset']=qs[_0x2660('0x1c')](_0x25cc7c['query'][_0x2660('0x1c')]);}return _0x15dc07[_0x2660('0x4a')](_0xf2d72f);}})[_0x2660('0x24')](function(_0x470be8){if(_0x470be8){return _0x470be8?{'count':_0x4b9327,'rows':_0x470be8}:null;}})[_0x2660('0x24')](respondWithResult(_0x727b0d,null))[_0x2660('0x48')](handleError(_0x727b0d,null));};exports[_0x2660('0x4e')]=function(_0x363774,_0x41758a,_0x527318){if(_0x363774['body']['id']){delete _0x363774[_0x2660('0x47')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x363774['params']['id']}})[_0x2660('0x24')](handleEntityNotFound(_0x41758a,null))[_0x2660('0x24')](function(_0x400a1c){if(_0x400a1c){_0x363774['body'][_0x2660('0x4f')]=_0x400a1c['id'];_0x363774[_0x2660('0x47')][_0x2660('0x50')]=integrations[_0x2660('0x51')](_0x363774['body'][_0x2660('0x52')],_0x363774[_0x2660('0x47')][_0x2660('0x2d')]);_0x363774['body'][_0x2660('0x53')]=integrations['getDescriptions'](_0x363774[_0x2660('0x47')][_0x2660('0x52')],_0x363774[_0x2660('0x47')]['type']);return db[_0x2660('0x4c')][_0x2660('0x46')](_0x363774[_0x2660('0x47')],{'include':[{'model':db[_0x2660('0x54')],'as':_0x2660('0x50')},{'model':db[_0x2660('0x54')],'as':'Descriptions'}]});}return null;})[_0x2660('0x24')](respondWithResult(_0x41758a,null))[_0x2660('0x48')](handleError(_0x41758a,null));};exports['getFields']=function(_0x3d26df,_0x59058a,_0x3f21d5){var _0x4e59a7=[_0x2660('0x55'),_0x2660('0x56'),_0x2660('0x57'),_0x2660('0x58'),_0x2660('0x59'),'notify','incident_state',_0x2660('0x5a'),_0x2660('0x5b')];var _0x4fcd09=[_0x2660('0x5c'),_0x2660('0x55'),_0x2660('0x5d'),_0x2660('0x5e'),'upon_reject','sys_updated_on',_0x2660('0x5f'),_0x2660('0x56'),_0x2660('0x60'),_0x2660('0x61'),_0x2660('0x62'),'sys_updated_by',_0x2660('0x63'),_0x2660('0x64'),_0x2660('0x65'),_0x2660('0x66'),_0x2660('0x67'),_0x2660('0x68'),_0x2660('0x57'),'order',_0x2660('0x69'),'closed_at',_0x2660('0x6a'),_0x2660('0x6b'),_0x2660('0x6c'),_0x2660('0x6d'),_0x2660('0x6e'),_0x2660('0x6f'),'priority',_0x2660('0x70'),'rfc','time_worked',_0x2660('0x71'),_0x2660('0x72'),_0x2660('0x73'),_0x2660('0x74'),_0x2660('0x75'),_0x2660('0x76'),'resolved_at',_0x2660('0x77'),_0x2660('0x78'),_0x2660('0x58'),_0x2660('0x79'),_0x2660('0x7a'),_0x2660('0x59'),'correlation_display',_0x2660('0x7b'),_0x2660('0x7c'),_0x2660('0x7d'),_0x2660('0x7e'),_0x2660('0x7f'),_0x2660('0x80'),_0x2660('0x81'),_0x2660('0x82'),_0x2660('0x83'),_0x2660('0x84'),_0x2660('0x85'),'follow_up',_0x2660('0x86'),'sys_id',_0x2660('0x87'),_0x2660('0x88'),_0x2660('0x89'),_0x2660('0x8a'),'problem_id','company',_0x2660('0x8b'),_0x2660('0x8c'),'assigned_to',_0x2660('0x5a'),_0x2660('0x8d'),_0x2660('0x8e'),'approval',_0x2660('0x8f'),'due_date',_0x2660('0x90'),_0x2660('0x91'),_0x2660('0x92'),_0x2660('0x93'),_0x2660('0x94'),_0x2660('0x95'),_0x2660('0x96'),_0x2660('0x5b')];var _0x5b4f19='';var _0x3c125b='';var _0x6babc1=[];var _0x23a59b='';var _0xb15277='';var _0x4e516f=[];var _0x15e46f='';var _0x3734e6='';var _0x3286d0={};var _0x4683ff='';return db[_0x2660('0x2b')][_0x2660('0x4b')]({'where':{'id':_0x3d26df[_0x2660('0x42')]['id']},'attributes':['id',_0x2660('0x97'),'password','email',_0x2660('0x98'),'serverUrl']})['then'](handleEntityNotFound(_0x59058a,null))['then'](function(_0x47657e){if(_0x47657e){_0x4683ff=_0x47657e['remoteUri'];var _0x17a97b=_0x4683ff[_0x2660('0x99')](-0x1);if(_0x17a97b==='/'){_0x4683ff=_0x4683ff[_0x2660('0x9a')](0x0,_0x4683ff[_0x2660('0x9b')](_0x17a97b));}_0x3734e6=util[_0x2660('0x9c')](_0x2660('0x9d'),_0x4683ff);_0x15e46f=util[_0x2660('0x9c')](_0x2660('0x9e'),_0x4683ff);_0x3286d0={'user':_0x47657e[_0x2660('0x97')],'pass':_0x47657e[_0x2660('0x9f')]};var _0x2bb2a3={'method':_0x2660('0xa0'),'uri':_0x3734e6+_0x2660('0xa1'),'auth':_0x3286d0,'json':!![]};return rp(_0x2bb2a3);}})['then'](function(_0x278eef){if(_0x278eef[_0x2660('0xa2')][_0x2660('0x34')]>0x0){_0x5b4f19=_0x278eef[_0x2660('0xa2')];}console[_0x2660('0xa3')](_0x2660('0xa4'),_0x5b4f19);_0x4e516f=[];_0x3c125b=Object[_0x2660('0xa5')]([],_0x5b4f19);_['remove'](_0x3c125b,function(_0x5143d5){return!_0x4e59a7[_0x2660('0xa6')](_0x5143d5[_0x2660('0x28')]);});_0x3c125b[_0x2660('0xa7')](function(_0x291bdb){var _0x3ee628=createFieldObject(_0x15e46f,_0x3286d0,_0x291bdb[_0x2660('0xa8')],_0x291bdb['name'],_0x291bdb[_0x2660('0xa9')],![]);_0x4e516f[_0x2660('0xaa')](_0x3ee628);});return Promise[_0x2660('0xab')](_0x4e516f);})['then'](function(_0x16bd30){_0x6babc1=_0x16bd30;_0x23a59b=Object[_0x2660('0xa5')]([],_0x5b4f19);console[_0x2660('0xa3')](_0x2660('0xac'),_0x5b4f19);_['remove'](_0x23a59b,function(_0x5f15ff){return _0x4fcd09[_0x2660('0xa6')](_0x5f15ff[_0x2660('0x28')]);});console[_0x2660('0xa3')](_0x2660('0xad'),_0x23a59b);_0x4e516f=[];_0x23a59b[_0x2660('0xa7')](function(_0x3eb1ac){var _0xdf21f6=createFieldObject(_0x15e46f,_0x3286d0,_0x3eb1ac[_0x2660('0xa8')],_0x3eb1ac[_0x2660('0x28')],_0x3eb1ac['label'],!![]);_0x4e516f[_0x2660('0xaa')](_0xdf21f6);});return Promise[_0x2660('0xab')](_0x4e516f);})[_0x2660('0x24')](function(_0x210dc9){_0xb15277=_0x210dc9;var _0x3afa90=_0x6babc1['concat'](_0xb15277);return{'count':_0x3afa90['length'],'rows':_0x3afa90};})[_0x2660('0x24')](respondWithResult(_0x59058a,null))[_0x2660('0x48')](function(_0x1b9e38){console[_0x2660('0xa3')]('ServiceNow\x20error:\x20'+_0x1b9e38);var _0x1e1f42=_0x3d26df[_0x2660('0x30')][_0x2660('0xae')]?0x1f4:_0x1b9e38[_0x2660('0xaf')]||0x1f4;logger[_0x2660('0x26')](_0x1b9e38[_0x2660('0x27')]);delete _0x1b9e38['name'];if(_0x1e1f42===0x191){_0x1e1f42=0x190;}_0x59058a[_0x2660('0x19')](_0x1e1f42)['send'](_0x3d26df[_0x2660('0x30')][_0x2660('0xae')]?{'message':_0x2660('0xb0'),'statusCode':_0x1b9e38[_0x2660('0xaf')]}:_0x1b9e38);});};function createFieldObject(_0x38ab78,_0xad4897,_0x1036e0,_0x6180a5,_0x1311d3,_0x1e2876){return new Promise(function(_0x277a98,_0x5d5aac){var _0x1d144a={'id':_0x6180a5,'name':_0x1311d3,'custom':_0x1e2876};if(_0x1036e0===_0x2660('0xb1')){_0x1d144a[_0x2660('0x3d')]=[{'name':_0x2660('0xb2'),'value':_0x2660('0xb3')},{'name':_0x2660('0xb4'),'value':_0x2660('0xb5')}];_0x277a98(_0x1d144a);}else{var _0x144544={'method':_0x2660('0xa0'),'uri':_0x38ab78+'sys_choice?sysparm_query=name=incident^element='+_0x6180a5,'auth':_0xad4897,'json':!![]};return rp(_0x144544)[_0x2660('0x24')](function(_0x433ebf){var _0x302530=[];if(_0x433ebf[_0x2660('0xa2')][_0x2660('0x34')]>0x0){_0x433ebf[_0x2660('0xa2')][_0x2660('0xa7')](function(_0x3bb5cb){if(_0x3bb5cb['inactive']==='false'){var _0x1e45d0={'name':_0x3bb5cb['label'],'value':_0x3bb5cb[_0x2660('0xb6')]};_0x302530[_0x2660('0xaa')](_0x1e45d0);}});}_0x1d144a[_0x2660('0x3d')]=_0x302530;if(_0x1d144a[_0x2660('0x3d')][_0x2660('0x34')]>0x0){_0x277a98(_0x1d144a);}else{if(_0x1e2876==![]){_0x277a98();}else{_0x277a98(_0x1d144a);}}});}});} \ No newline at end of file +var _0xd32b=['ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','time_worked','expected_start','opened_at','group_list','reopened_time','caller_id','work_notes','short_description','close_code','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','urgency','problem_id','company','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','category','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','log','TCL:\x20_object','push','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','False','false','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xd32b,0x1de));var _0xbd32=function(_0x264370,_0x4d70b9){_0x264370=_0x264370-0x0;var _0x16bbaa=_0xd32b[_0x264370];return _0x16bbaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd32('0x0'));var zipdir=require(_0xbd32('0x1'));var jsonpatch=require(_0xbd32('0x2'));var rp=require(_0xbd32('0x3'));var moment=require(_0xbd32('0x4'));var BPromise=require(_0xbd32('0x5'));var Mustache=require(_0xbd32('0x6'));var util=require(_0xbd32('0x7'));var path=require(_0xbd32('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd32('0x9'));var fs=require('fs');var fs_extra=require(_0xbd32('0xa'));var _=require(_0xbd32('0xb'));var squel=require(_0xbd32('0xc'));var crypto=require(_0xbd32('0xd'));var jsforce=require(_0xbd32('0xe'));var deskjs=require(_0xbd32('0xf'));var toCsv=require(_0xbd32('0x10'));var querystring=require(_0xbd32('0x11'));var Papa=require(_0xbd32('0x12'));var Redis=require('ioredis');var authService=require(_0xbd32('0x13'));var qs=require(_0xbd32('0x14'));var as=require(_0xbd32('0x15'));var hardwareService=require(_0xbd32('0x16'));var logger=require(_0xbd32('0x17'))(_0xbd32('0x18'));var utils=require(_0xbd32('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbd32('0x1a'));var db=require(_0xbd32('0x1b'))['db'];var integrations=require(_0xbd32('0x1c'));function respondWithStatusCode(_0xe12a3c,_0x3de17f){_0x3de17f=_0x3de17f||0xcc;return function(_0x32d14f){if(_0x32d14f){return _0xe12a3c[_0xbd32('0x1d')](_0x3de17f);}return _0xe12a3c[_0xbd32('0x1e')](_0x3de17f)[_0xbd32('0x1f')]();};}function respondWithResult(_0x5aa90e,_0x87cefc){_0x87cefc=_0x87cefc||0xc8;return function(_0x23281e){if(_0x23281e){return _0x5aa90e[_0xbd32('0x1e')](_0x87cefc)[_0xbd32('0x20')](_0x23281e);}};}function respondWithFilteredResult(_0x181734,_0x14fc5a){return function(_0x5c3a02){if(_0x5c3a02){var _0x1759d6=typeof _0x14fc5a[_0xbd32('0x21')]===_0xbd32('0x22')&&typeof _0x14fc5a[_0xbd32('0x23')]===_0xbd32('0x22');var _0x1244b4=_0x5c3a02[_0xbd32('0x24')];var _0x48f8a4=_0x1759d6?0x0:_0x14fc5a['offset'];var _0x2a24b3=_0x1759d6?_0x5c3a02[_0xbd32('0x24')]:_0x14fc5a[_0xbd32('0x21')]+_0x14fc5a[_0xbd32('0x23')];var _0x327747;if(_0x2a24b3>=_0x1244b4){_0x2a24b3=_0x1244b4;_0x327747=0xc8;}else{_0x327747=0xce;}_0x181734[_0xbd32('0x1e')](_0x327747);return _0x181734['set'](_0xbd32('0x25'),_0x48f8a4+'-'+_0x2a24b3+'/'+_0x1244b4)[_0xbd32('0x20')](_0x5c3a02);}return null;};}function patchUpdates(_0x5be6d8){return function(_0x4e861b){try{jsonpatch[_0xbd32('0x26')](_0x4e861b,_0x5be6d8,!![]);}catch(_0x5558c1){return BPromise[_0xbd32('0x27')](_0x5558c1);}return _0x4e861b[_0xbd32('0x28')]();};}function saveUpdates(_0x52f883,_0x221bae){return function(_0x27a012){if(_0x27a012){return _0x27a012[_0xbd32('0x29')](_0x52f883)[_0xbd32('0x2a')](function(_0x332029){return _0x332029;});}return null;};}function removeEntity(_0x4f686b,_0xe0dbf8){return function(_0x220969){if(_0x220969){return _0x220969['destroy']()[_0xbd32('0x2a')](function(){_0x4f686b[_0xbd32('0x1e')](0xcc)[_0xbd32('0x1f')]();});}};}function handleEntityNotFound(_0xbf8032,_0x285d16){return function(_0x48bc24){if(!_0x48bc24){_0xbf8032[_0xbd32('0x1d')](0x194);}return _0x48bc24;};}function handleError(_0x5f1dc9,_0x510c27){_0x510c27=_0x510c27||0x1f4;return function(_0x307638){logger[_0xbd32('0x2b')](_0x307638[_0xbd32('0x2c')]);if(_0x307638[_0xbd32('0x2d')]){delete _0x307638[_0xbd32('0x2d')];}_0x5f1dc9[_0xbd32('0x1e')](_0x510c27)[_0xbd32('0x2e')](_0x307638);};}exports[_0xbd32('0x2f')]=function(_0x681d96,_0x2a9e82){var _0x1b28b8={},_0x15eb29={},_0x662388={'count':0x0,'rows':[]};var _0x458cf4=_[_0xbd32('0x30')](db[_0xbd32('0x31')][_0xbd32('0x32')],function(_0x517091){return{'name':_0x517091[_0xbd32('0x33')],'type':_0x517091[_0xbd32('0x34')][_0xbd32('0x35')]};});_0x15eb29[_0xbd32('0x36')]=_[_0xbd32('0x30')](_0x458cf4,_0xbd32('0x2d'));_0x15eb29[_0xbd32('0x37')]=_[_0xbd32('0x38')](_0x681d96[_0xbd32('0x37')]);_0x15eb29[_0xbd32('0x39')]=_[_0xbd32('0x3a')](_0x15eb29[_0xbd32('0x36')],_0x15eb29[_0xbd32('0x37')]);_0x1b28b8[_0xbd32('0x3b')]=_[_0xbd32('0x3a')](_0x15eb29[_0xbd32('0x36')],qs['fields'](_0x681d96[_0xbd32('0x37')]['fields']));_0x1b28b8['attributes']=_0x1b28b8['attributes'][_0xbd32('0x3c')]?_0x1b28b8[_0xbd32('0x3b')]:_0x15eb29[_0xbd32('0x36')];if(!_0x681d96['query'][_0xbd32('0x3d')](_0xbd32('0x3e'))){_0x1b28b8[_0xbd32('0x23')]=qs[_0xbd32('0x23')](_0x681d96[_0xbd32('0x37')][_0xbd32('0x23')]);_0x1b28b8['offset']=qs['offset'](_0x681d96[_0xbd32('0x37')]['offset']);}_0x1b28b8[_0xbd32('0x3f')]=qs[_0xbd32('0x40')](_0x681d96[_0xbd32('0x37')][_0xbd32('0x40')]);_0x1b28b8[_0xbd32('0x41')]=qs[_0xbd32('0x39')](_[_0xbd32('0x42')](_0x681d96[_0xbd32('0x37')],_0x15eb29[_0xbd32('0x39')]),_0x458cf4);if(_0x681d96[_0xbd32('0x37')][_0xbd32('0x43')]){_0x1b28b8[_0xbd32('0x41')]=_[_0xbd32('0x44')](_0x1b28b8[_0xbd32('0x41')],{'$or':_[_0xbd32('0x30')](_0x458cf4,function(_0x137637){if(_0x137637[_0xbd32('0x34')]!=='VIRTUAL'){var _0x336484={};_0x336484[_0x137637[_0xbd32('0x2d')]]={'$like':'%'+_0x681d96[_0xbd32('0x37')][_0xbd32('0x43')]+'%'};return _0x336484;}})});}_0x1b28b8=_[_0xbd32('0x44')]({},_0x1b28b8,_0x681d96[_0xbd32('0x45')]);var _0x21021c={'where':_0x1b28b8[_0xbd32('0x41')]};return db[_0xbd32('0x31')][_0xbd32('0x24')](_0x21021c)[_0xbd32('0x2a')](function(_0x29065a){_0x662388[_0xbd32('0x24')]=_0x29065a;if(_0x681d96[_0xbd32('0x37')][_0xbd32('0x46')]){_0x1b28b8[_0xbd32('0x47')]=[{'all':!![]}];}return db[_0xbd32('0x31')][_0xbd32('0x48')](_0x1b28b8);})[_0xbd32('0x2a')](function(_0xecaac9){_0x662388[_0xbd32('0x49')]=_0xecaac9;return _0x662388;})['then'](respondWithFilteredResult(_0x2a9e82,_0x1b28b8))['catch'](handleError(_0x2a9e82,null));};exports[_0xbd32('0x4a')]=function(_0x3423b8,_0x2c2250){var _0x43fbef={'raw':![],'where':{'id':_0x3423b8[_0xbd32('0x4b')]['id']}},_0xc37d48={};_0xc37d48[_0xbd32('0x36')]=_[_0xbd32('0x38')](db[_0xbd32('0x31')]['rawAttributes']);_0xc37d48[_0xbd32('0x37')]=_[_0xbd32('0x38')](_0x3423b8[_0xbd32('0x37')]);_0xc37d48[_0xbd32('0x39')]=_['intersection'](_0xc37d48[_0xbd32('0x36')],_0xc37d48[_0xbd32('0x37')]);_0x43fbef['attributes']=_['intersection'](_0xc37d48[_0xbd32('0x36')],qs[_0xbd32('0x4c')](_0x3423b8['query'][_0xbd32('0x4c')]));_0x43fbef[_0xbd32('0x3b')]=_0x43fbef[_0xbd32('0x3b')][_0xbd32('0x3c')]?_0x43fbef[_0xbd32('0x3b')]:_0xc37d48[_0xbd32('0x36')];if(_0x3423b8[_0xbd32('0x37')][_0xbd32('0x46')]){_0x43fbef[_0xbd32('0x47')]=[{'all':!![]}];}_0x43fbef=_[_0xbd32('0x44')]({},_0x43fbef,_0x3423b8[_0xbd32('0x45')]);return db[_0xbd32('0x31')]['find'](_0x43fbef)[_0xbd32('0x2a')](handleEntityNotFound(_0x2c2250,null))[_0xbd32('0x2a')](respondWithResult(_0x2c2250,null))[_0xbd32('0x4d')](handleError(_0x2c2250,null));};exports[_0xbd32('0x4e')]=function(_0xd35fb8,_0x38e4d8){return db[_0xbd32('0x31')][_0xbd32('0x4e')](_0xd35fb8[_0xbd32('0x4f')],{})[_0xbd32('0x2a')](respondWithResult(_0x38e4d8,0xc9))[_0xbd32('0x4d')](handleError(_0x38e4d8,null));};exports['update']=function(_0x50437c,_0x530925){if(_0x50437c[_0xbd32('0x4f')]['id']){delete _0x50437c[_0xbd32('0x4f')]['id'];}return db[_0xbd32('0x31')]['find']({'where':{'id':_0x50437c['params']['id']}})['then'](handleEntityNotFound(_0x530925,null))[_0xbd32('0x2a')](saveUpdates(_0x50437c['body'],null))[_0xbd32('0x2a')](respondWithResult(_0x530925,null))[_0xbd32('0x4d')](handleError(_0x530925,null));};exports['destroy']=function(_0x2073ef,_0x5248b3){return db[_0xbd32('0x31')][_0xbd32('0x50')]({'where':{'id':_0x2073ef[_0xbd32('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5248b3,null))['then'](removeEntity(_0x5248b3,null))[_0xbd32('0x4d')](handleError(_0x5248b3,null));};exports['getConfigurations']=function(_0x5e630d,_0xfd1c44,_0xb0ebbd){var _0x2804f4={};var _0x3de52c={};var _0xd407e3;var _0x27e1bc;return db[_0xbd32('0x31')][_0xbd32('0x51')]({'where':{'id':_0x5e630d[_0xbd32('0x4b')]['id']}})['then'](handleEntityNotFound(_0xfd1c44,null))[_0xbd32('0x2a')](function(_0x2f7381){if(_0x2f7381){_0xd407e3=_0x2f7381;_0x3de52c[_0xbd32('0x36')]=_['keys'](db[_0xbd32('0x52')]['rawAttributes']);_0x3de52c[_0xbd32('0x37')]=_[_0xbd32('0x38')](_0x5e630d[_0xbd32('0x37')]);_0x3de52c[_0xbd32('0x39')]=_[_0xbd32('0x3a')](_0x3de52c['model'],_0x3de52c[_0xbd32('0x37')]);_0x2804f4[_0xbd32('0x3b')]=_[_0xbd32('0x3a')](_0x3de52c[_0xbd32('0x36')],qs[_0xbd32('0x4c')](_0x5e630d['query'][_0xbd32('0x4c')]));_0x2804f4[_0xbd32('0x3b')]=_0x2804f4['attributes'][_0xbd32('0x3c')]?_0x2804f4['attributes']:_0x3de52c[_0xbd32('0x36')];_0x2804f4[_0xbd32('0x3f')]=qs[_0xbd32('0x40')](_0x5e630d[_0xbd32('0x37')]['sort']);_0x2804f4[_0xbd32('0x41')]=qs[_0xbd32('0x39')](_[_0xbd32('0x42')](_0x5e630d[_0xbd32('0x37')],_0x3de52c[_0xbd32('0x39')]));if(_0x5e630d[_0xbd32('0x37')][_0xbd32('0x43')]){_0x2804f4[_0xbd32('0x41')]=_[_0xbd32('0x44')](_0x2804f4[_0xbd32('0x41')],{'$or':_[_0xbd32('0x30')](_0x2804f4[_0xbd32('0x3b')],function(_0x4b29f9){var _0x3e74eb={};_0x3e74eb[_0x4b29f9]={'$like':'%'+_0x5e630d[_0xbd32('0x37')]['filter']+'%'};return _0x3e74eb;})});}_0x2804f4=_[_0xbd32('0x44')]({},_0x2804f4,_0x5e630d[_0xbd32('0x45')]);return _0xd407e3[_0xbd32('0x53')](_0x2804f4);}})[_0xbd32('0x2a')](function(_0xde404a){if(_0xde404a){_0x27e1bc=_0xde404a[_0xbd32('0x3c')];if(!_0x5e630d['query']['hasOwnProperty'](_0xbd32('0x3e'))){_0x2804f4[_0xbd32('0x23')]=qs[_0xbd32('0x23')](_0x5e630d[_0xbd32('0x37')][_0xbd32('0x23')]);_0x2804f4['offset']=qs[_0xbd32('0x21')](_0x5e630d[_0xbd32('0x37')][_0xbd32('0x21')]);}return _0xd407e3[_0xbd32('0x53')](_0x2804f4);}})[_0xbd32('0x2a')](function(_0x187c33){if(_0x187c33){return _0x187c33?{'count':_0x27e1bc,'rows':_0x187c33}:null;}})['then'](respondWithResult(_0xfd1c44,null))[_0xbd32('0x4d')](handleError(_0xfd1c44,null));};exports[_0xbd32('0x54')]=function(_0x4ff3bd,_0x41069d,_0xcf4344){if(_0x4ff3bd[_0xbd32('0x4f')]['id']){delete _0x4ff3bd[_0xbd32('0x4f')]['id'];}return db[_0xbd32('0x31')][_0xbd32('0x51')]({'where':{'id':_0x4ff3bd['params']['id']}})[_0xbd32('0x2a')](handleEntityNotFound(_0x41069d,null))['then'](function(_0x168b76){if(_0x168b76){_0x4ff3bd[_0xbd32('0x4f')][_0xbd32('0x55')]=_0x168b76['id'];_0x4ff3bd[_0xbd32('0x4f')][_0xbd32('0x56')]=integrations['getSubjects'](_0x4ff3bd[_0xbd32('0x4f')][_0xbd32('0x57')],_0x4ff3bd[_0xbd32('0x4f')][_0xbd32('0x34')]);_0x4ff3bd[_0xbd32('0x4f')][_0xbd32('0x58')]=integrations['getDescriptions'](_0x4ff3bd['body'][_0xbd32('0x57')],_0x4ff3bd['body'][_0xbd32('0x34')]);return db[_0xbd32('0x52')][_0xbd32('0x4e')](_0x4ff3bd['body'],{'include':[{'model':db[_0xbd32('0x59')],'as':_0xbd32('0x56')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0xbd32('0x2a')](respondWithResult(_0x41069d,null))[_0xbd32('0x4d')](handleError(_0x41069d,null));};exports[_0xbd32('0x5a')]=function(_0x1823f9,_0x5a8f98,_0x4f3672){var _0x63675e=[_0xbd32('0x5b'),_0xbd32('0x5c'),_0xbd32('0x5d'),_0xbd32('0x5e'),'close_code','notify','incident_state','severity','category'];var _0xc04c1d=['parent',_0xbd32('0x5b'),_0xbd32('0x5f'),_0xbd32('0x60'),_0xbd32('0x61'),_0xbd32('0x62'),_0xbd32('0x63'),'hold_reason',_0xbd32('0x64'),_0xbd32('0x65'),_0xbd32('0x66'),_0xbd32('0x67'),'opened_by',_0xbd32('0x68'),_0xbd32('0x69'),_0xbd32('0x6a'),_0xbd32('0x6b'),_0xbd32('0x6c'),'knowledge',_0xbd32('0x3f'),_0xbd32('0x6d'),_0xbd32('0x6e'),_0xbd32('0x6f'),_0xbd32('0x70'),_0xbd32('0x71'),_0xbd32('0x72'),_0xbd32('0x73'),_0xbd32('0x74'),'priority','sys_domain_path','rfc',_0xbd32('0x75'),_0xbd32('0x76'),_0xbd32('0x77'),'business_duration',_0xbd32('0x78'),'work_end',_0xbd32('0x79'),'resolved_at',_0xbd32('0x7a'),'approval_set',_0xbd32('0x5e'),_0xbd32('0x7b'),_0xbd32('0x7c'),_0xbd32('0x7d'),'correlation_display',_0xbd32('0x7e'),_0xbd32('0x7f'),'assignment_group',_0xbd32('0x80'),_0xbd32('0x81'),_0xbd32('0x82'),_0xbd32('0x83'),'notify',_0xbd32('0x84'),_0xbd32('0x85'),_0xbd32('0x86'),'follow_up',_0xbd32('0x87'),_0xbd32('0x88'),_0xbd32('0x89'),'reopened_by','incident_state',_0xbd32('0x8a'),_0xbd32('0x8b'),_0xbd32('0x8c'),'reassignment_count','activity_due',_0xbd32('0x8d'),_0xbd32('0x8e'),_0xbd32('0x8f'),_0xbd32('0x90'),_0xbd32('0x91'),_0xbd32('0x92'),_0xbd32('0x93'),_0xbd32('0x94'),_0xbd32('0x95'),'sys_tags',_0xbd32('0x96'),_0xbd32('0x97'),_0xbd32('0x98'),_0xbd32('0x99'),_0xbd32('0x9a')];var _0x11a573='';var _0x598548='';var _0x7c43a9=[];var _0x51109e='';var _0x488809='';var _0x11a950=[];var _0x335b4b='';var _0x2bc55f='';var _0x4e22aa={};var _0x4688d3='';return db[_0xbd32('0x31')][_0xbd32('0x51')]({'where':{'id':_0x1823f9[_0xbd32('0x4b')]['id']},'attributes':['id',_0xbd32('0x9b'),_0xbd32('0x9c'),_0xbd32('0x9d'),'remoteUri',_0xbd32('0x9e')]})[_0xbd32('0x2a')](handleEntityNotFound(_0x5a8f98,null))[_0xbd32('0x2a')](function(_0x668fb3){if(_0x668fb3){_0x4688d3=_0x668fb3[_0xbd32('0x9f')];var _0x278bb9=_0x4688d3[_0xbd32('0xa0')](-0x1);if(_0x278bb9==='/'){_0x4688d3=_0x4688d3['substring'](0x0,_0x4688d3[_0xbd32('0xa1')](_0x278bb9));}_0x2bc55f=util[_0xbd32('0xa2')](_0xbd32('0xa3'),_0x4688d3);_0x335b4b=util['format'](_0xbd32('0xa4'),_0x4688d3);_0x4e22aa={'user':_0x668fb3[_0xbd32('0x9b')],'pass':_0x668fb3[_0xbd32('0x9c')]};var _0x201d2a={'method':_0xbd32('0xa5'),'uri':_0x2bc55f+_0xbd32('0xa6'),'auth':_0x4e22aa,'json':!![]};return rp(_0x201d2a);}})['then'](function(_0x2836b0){if(_0x2836b0[_0xbd32('0xa7')][_0xbd32('0x3c')]>0x0){_0x11a573=_0x2836b0[_0xbd32('0xa7')];}console['log'](_0xbd32('0xa8'),_0x11a573);_0x11a950=[];_0x598548=Object[_0xbd32('0xa9')]([],_0x11a573);_[_0xbd32('0xaa')](_0x598548,function(_0x5e14cc){return!_0x63675e[_0xbd32('0xab')](_0x5e14cc[_0xbd32('0x2d')]);});_0x598548[_0xbd32('0xac')](function(_0x3d7f6e){var _0x4d4f53=createFieldObject(_0x335b4b,_0x4e22aa,_0x3d7f6e[_0xbd32('0xad')],_0x3d7f6e[_0xbd32('0x2d')],_0x3d7f6e[_0xbd32('0xae')],![]);_0x11a950['push'](_0x4d4f53);});return Promise[_0xbd32('0xaf')](_0x11a950);})[_0xbd32('0x2a')](function(_0x46f534){_0x7c43a9=_0x46f534;_0x51109e=Object[_0xbd32('0xa9')]([],_0x11a573);console[_0xbd32('0xb0')](_0xbd32('0xb1'),_0x11a573);_[_0xbd32('0xaa')](_0x51109e,function(_0x12f397){return _0xc04c1d[_0xbd32('0xab')](_0x12f397[_0xbd32('0x2d')]);});console[_0xbd32('0xb0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x51109e);_0x11a950=[];_0x51109e[_0xbd32('0xac')](function(_0x12fa5d){var _0x9f7578=createFieldObject(_0x335b4b,_0x4e22aa,_0x12fa5d[_0xbd32('0xad')],_0x12fa5d['name'],_0x12fa5d['label'],!![]);_0x11a950[_0xbd32('0xb2')](_0x9f7578);});return Promise[_0xbd32('0xaf')](_0x11a950);})[_0xbd32('0x2a')](function(_0x477cd3){_0x488809=_0x477cd3;var _0x12f073=_0x7c43a9['concat'](_0x488809);return{'count':_0x12f073[_0xbd32('0x3c')],'rows':_0x12f073};})[_0xbd32('0x2a')](respondWithResult(_0x5a8f98,null))[_0xbd32('0x4d')](function(_0x36f49b){console[_0xbd32('0xb0')](_0xbd32('0xb3')+_0x36f49b);var _0x2b8a10=_0x1823f9[_0xbd32('0x37')][_0xbd32('0xb4')]?0x1f4:_0x36f49b['statusCode']||0x1f4;logger[_0xbd32('0x2b')](_0x36f49b['stack']);delete _0x36f49b[_0xbd32('0x2d')];if(_0x2b8a10===0x191){_0x2b8a10=0x190;}_0x5a8f98['status'](_0x2b8a10)[_0xbd32('0x2e')](_0x1823f9[_0xbd32('0x37')]['test']?{'message':_0xbd32('0xb5'),'statusCode':_0x36f49b[_0xbd32('0xb6')]}:_0x36f49b);});};function createFieldObject(_0x3a7c0c,_0x1d4702,_0x2e1f31,_0x556d0d,_0x482e3b,_0x5ae0af){return new Promise(function(_0x5f41f7,_0x256715){var _0x3e80a6={'id':_0x556d0d,'name':_0x482e3b,'custom':_0x5ae0af};if(_0x2e1f31===_0xbd32('0xb7')){_0x3e80a6[_0xbd32('0x45')]=[{'name':_0xbd32('0xb8'),'value':_0xbd32('0xb9')},{'name':_0xbd32('0xba'),'value':_0xbd32('0xbb')}];_0x5f41f7(_0x3e80a6);}else{var _0x38d8b5={'method':_0xbd32('0xa5'),'uri':_0x3a7c0c+'sys_choice?sysparm_query=name=incident^element='+_0x556d0d,'auth':_0x1d4702,'json':!![]};return rp(_0x38d8b5)[_0xbd32('0x2a')](function(_0x729683){var _0x553458=[];if(_0x729683[_0xbd32('0xa7')][_0xbd32('0x3c')]>0x0){_0x729683[_0xbd32('0xa7')]['forEach'](function(_0x2b9a79){if(_0x2b9a79['inactive']===_0xbd32('0xbb')){var _0xd75d67={'name':_0x2b9a79['label'],'value':_0x2b9a79[_0xbd32('0xbc')]};_0x553458[_0xbd32('0xb2')](_0xd75d67);}});}_0x3e80a6[_0xbd32('0x45')]=_0x553458;if(_0x3e80a6[_0xbd32('0x45')][_0xbd32('0x3c')]>0x0){_0x5f41f7(_0x3e80a6);}else{if(_0x5ae0af==![]){_0x5f41f7();}else{_0x5f41f7(_0x3e80a6);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index de0b184..42403c1 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x2d47b2,_0x1fe185){var _0x35209b=function(_0x4c6112){while(--_0x4c6112){_0x2d47b2['push'](_0x2d47b2['shift']());}};_0x35209b(++_0x1fe185);}(_0x7217,0x19e));var _0x7721=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7217[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0xd765ea,_0x91aa05){var _0x2f0c69=function(_0x3bca09){while(--_0x3bca09){_0xd765ea['push'](_0xd765ea['shift']());}};_0x2f0c69(++_0x91aa05);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x34ccf5,_0x3c566a){_0x34ccf5=_0x34ccf5-0x0;var _0xa7d7e6=_0x9c5a[_0x34ccf5];return _0xa7d7e6;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'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 87141ee..c660cfe 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 _0x86d7=['catch','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x3a27b1,_0x55f3cc){var _0x1bcbbb=function(_0x106044){while(--_0x106044){_0x3a27b1['push'](_0x3a27b1['shift']());}};_0x1bcbbb(++_0x55f3cc);}(_0x86d7,0xc8));var _0x786d=function(_0x233706,_0x3b382e){_0x233706=_0x233706-0x0;var _0xba3aba=_0x86d7[_0x233706];return _0xba3aba;};'use strict';var _=require(_0x786d('0x0'));var util=require(_0x786d('0x1'));var moment=require(_0x786d('0x2'));var BPromise=require(_0x786d('0x3'));var rs=require(_0x786d('0x4'));var fs=require('fs');var Redis=require(_0x786d('0x5'));var db=require(_0x786d('0x6'))['db'];var utils=require(_0x786d('0x7'));var logger=require(_0x786d('0x8'))(_0x786d('0x9'));var config=require(_0x786d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x786d('0xb')][_0x786d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b735,_0x45d3cc,_0x36f8fb){return new BPromise(function(_0x2fa3bb,_0x5f0b2c){return client['request'](_0x42b735,_0x36f8fb)[_0x786d('0xd')](function(_0x5bd15f){logger[_0x786d('0xe')](_0x786d('0xf'),_0x45d3cc,_0x786d('0x10'));logger[_0x786d('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x45d3cc,_0x786d('0x10'),JSON['stringify'](_0x5bd15f));if(_0x5bd15f[_0x786d('0x12')]){if(_0x5bd15f[_0x786d('0x12')][_0x786d('0x13')]===0x1f4){logger['error'](_0x786d('0xf'),_0x45d3cc,_0x5bd15f['error']['message']);return _0x5f0b2c(_0x5bd15f['error'][_0x786d('0x14')]);}logger[_0x786d('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x45d3cc,_0x5bd15f['error'][_0x786d('0x14')]);return _0x2fa3bb(_0x5bd15f['error'][_0x786d('0x14')]);}else{logger[_0x786d('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x45d3cc,_0x786d('0x10'));_0x2fa3bb(_0x5bd15f[_0x786d('0x15')][_0x786d('0x14')]);}})[_0x786d('0x16')](function(_0x25c9d9){logger[_0x786d('0x12')](_0x786d('0xf'),_0x45d3cc,_0x25c9d9);_0x5f0b2c(_0x25c9d9);});});}exports['GetServicenowAccount']=function(_0x5be9a4){var _0x4a9c2f=this;return new Promise(function(_0x5bccd0,_0x534c1f){return db[_0x786d('0x17')][_0x786d('0x18')]({'raw':_0x5be9a4['options']?_0x5be9a4[_0x786d('0x19')][_0x786d('0x1a')]===undefined?!![]:![]:!![],'where':_0x5be9a4[_0x786d('0x19')]?_0x5be9a4['options'][_0x786d('0x1b')]||null:null,'attributes':_0x5be9a4[_0x786d('0x19')]?_0x5be9a4[_0x786d('0x19')][_0x786d('0x1c')]||null:null,'limit':_0x5be9a4['options']?_0x5be9a4['options'][_0x786d('0x1d')]||null:null,'include':_0x5be9a4[_0x786d('0x19')]?_0x5be9a4[_0x786d('0x19')][_0x786d('0x1e')]?_[_0x786d('0x1f')](_0x5be9a4[_0x786d('0x19')][_0x786d('0x1e')],function(_0x1f459d){return{'model':db[_0x1f459d[_0x786d('0x20')]],'as':_0x1f459d['as'],'attributes':_0x1f459d[_0x786d('0x1c')],'include':_0x1f459d['include']?_[_0x786d('0x1f')](_0x1f459d['include'],function(_0x4c0bc3){return{'model':db[_0x4c0bc3[_0x786d('0x20')]],'as':_0x4c0bc3['as'],'attributes':_0x4c0bc3[_0x786d('0x1c')],'include':_0x4c0bc3['include']?_[_0x786d('0x1f')](_0x4c0bc3[_0x786d('0x1e')],function(_0x57d8ee){return{'model':db[_0x57d8ee[_0x786d('0x20')]],'as':_0x57d8ee['as'],'attributes':_0x57d8ee[_0x786d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30e5be){logger[_0x786d('0xe')](_0x786d('0x21'),_0x5be9a4);logger[_0x786d('0x11')](_0x786d('0x21'),_0x5be9a4,JSON[_0x786d('0x22')](_0x30e5be));_0x5bccd0(_0x30e5be);})[_0x786d('0x16')](function(_0x255955){logger['error'](_0x786d('0x21'),_0x255955[_0x786d('0x14')],_0x5be9a4);_0x534c1f(_0x4a9c2f['error'](0x1f4,_0x255955[_0x786d('0x14')]));});});};exports[_0x786d('0x23')]=function(_0x82645b){var _0x6dd647=this;return new Promise(function(_0x1eb90f,_0x54d92a){return db[_0x786d('0x17')][_0x786d('0x24')]({'raw':_0x82645b[_0x786d('0x19')]?_0x82645b['options']['raw']===undefined?!![]:![]:!![],'where':_0x82645b[_0x786d('0x19')]?_0x82645b['options'][_0x786d('0x1b')]||null:null,'attributes':_0x82645b['options']?_0x82645b['options'][_0x786d('0x1c')]||null:null,'include':_0x82645b[_0x786d('0x19')]?_0x82645b[_0x786d('0x19')]['include']?_['map'](_0x82645b['options']['include'],function(_0x2f3fb6){return{'model':db[_0x2f3fb6[_0x786d('0x20')]],'as':_0x2f3fb6['as'],'attributes':_0x2f3fb6['attributes'],'include':_0x2f3fb6['include']?_[_0x786d('0x1f')](_0x2f3fb6[_0x786d('0x1e')],function(_0x8e50e2){return{'model':db[_0x8e50e2[_0x786d('0x20')]],'as':_0x8e50e2['as'],'attributes':_0x8e50e2['attributes'],'include':_0x8e50e2[_0x786d('0x1e')]?_[_0x786d('0x1f')](_0x8e50e2[_0x786d('0x1e')],function(_0x137cdc){return{'model':db[_0x137cdc['model']],'as':_0x137cdc['as'],'attributes':_0x137cdc['attributes']};}):[]};}):[]};}):[]:[]})[_0x786d('0xd')](function(_0x574987){logger[_0x786d('0xe')](_0x786d('0x23'),_0x82645b);logger[_0x786d('0x11')]('ShowServicenowAccount',_0x82645b,JSON[_0x786d('0x22')](_0x574987));_0x1eb90f(_0x574987);})[_0x786d('0x16')](function(_0x75775a){logger[_0x786d('0x12')](_0x786d('0x23'),_0x75775a[_0x786d('0x14')],_0x82645b);_0x54d92a(_0x6dd647[_0x786d('0x12')](0x1f4,_0x75775a['message']));});});}; \ No newline at end of file +var _0x255c=['ShowServicenowAccount','ServicenowAccount','find','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x5cceb8,_0xa8e57a){var _0xeaf4be=function(_0x154250){while(--_0x154250){_0x5cceb8['push'](_0x5cceb8['shift']());}};_0xeaf4be(++_0xa8e57a);}(_0x255c,0x1bd));var _0xc255=function(_0x25b80c,_0x290b29){_0x25b80c=_0x25b80c-0x0;var _0x38ad1d=_0x255c[_0x25b80c];return _0x38ad1d;};'use strict';var _=require(_0xc255('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc255('0x1'));var rs=require(_0xc255('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc255('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc255('0x4'))(_0xc255('0x5'));var config=require(_0xc255('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc255('0x7')][_0xc255('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17b60f,_0x3bf221,_0x4ead55){return new BPromise(function(_0x57e0ed,_0x5df8b8){return client['request'](_0x17b60f,_0x4ead55)[_0xc255('0x9')](function(_0x2880fc){logger[_0xc255('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x3bf221,_0xc255('0xb'));logger[_0xc255('0xc')](_0xc255('0xd'),_0x3bf221,_0xc255('0xb'),JSON[_0xc255('0xe')](_0x2880fc));if(_0x2880fc[_0xc255('0xf')]){if(_0x2880fc['error'][_0xc255('0x10')]===0x1f4){logger[_0xc255('0xf')](_0xc255('0x11'),_0x3bf221,_0x2880fc[_0xc255('0xf')][_0xc255('0x12')]);return _0x5df8b8(_0x2880fc[_0xc255('0xf')][_0xc255('0x12')]);}logger[_0xc255('0xf')](_0xc255('0x11'),_0x3bf221,_0x2880fc['error']['message']);return _0x57e0ed(_0x2880fc['error'][_0xc255('0x12')]);}else{logger['info'](_0xc255('0x11'),_0x3bf221,'request\x20sent');_0x57e0ed(_0x2880fc[_0xc255('0x13')]['message']);}})[_0xc255('0x14')](function(_0x52e864){logger[_0xc255('0xf')](_0xc255('0x11'),_0x3bf221,_0x52e864);_0x5df8b8(_0x52e864);});});}exports[_0xc255('0x15')]=function(_0x3ae43f){var _0x501a4c=this;return new Promise(function(_0x54e276,_0x5a3358){return db['ServicenowAccount'][_0xc255('0x16')]({'raw':_0x3ae43f[_0xc255('0x17')]?_0x3ae43f[_0xc255('0x17')][_0xc255('0x18')]===undefined?!![]:![]:!![],'where':_0x3ae43f[_0xc255('0x17')]?_0x3ae43f[_0xc255('0x17')][_0xc255('0x19')]||null:null,'attributes':_0x3ae43f[_0xc255('0x17')]?_0x3ae43f[_0xc255('0x17')][_0xc255('0x1a')]||null:null,'limit':_0x3ae43f[_0xc255('0x17')]?_0x3ae43f['options'][_0xc255('0x1b')]||null:null,'include':_0x3ae43f[_0xc255('0x17')]?_0x3ae43f[_0xc255('0x17')][_0xc255('0x1c')]?_[_0xc255('0x1d')](_0x3ae43f[_0xc255('0x17')][_0xc255('0x1c')],function(_0x1e4c65){return{'model':db[_0x1e4c65[_0xc255('0x1e')]],'as':_0x1e4c65['as'],'attributes':_0x1e4c65[_0xc255('0x1a')],'include':_0x1e4c65['include']?_['map'](_0x1e4c65[_0xc255('0x1c')],function(_0x459e9f){return{'model':db[_0x459e9f[_0xc255('0x1e')]],'as':_0x459e9f['as'],'attributes':_0x459e9f['attributes'],'include':_0x459e9f['include']?_[_0xc255('0x1d')](_0x459e9f[_0xc255('0x1c')],function(_0xee0571){return{'model':db[_0xee0571[_0xc255('0x1e')]],'as':_0xee0571['as'],'attributes':_0xee0571[_0xc255('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x542076){logger['info'](_0xc255('0x15'),_0x3ae43f);logger['debug'](_0xc255('0x15'),_0x3ae43f,JSON[_0xc255('0xe')](_0x542076));_0x54e276(_0x542076);})[_0xc255('0x14')](function(_0x1dbfc3){logger[_0xc255('0xf')](_0xc255('0x15'),_0x1dbfc3[_0xc255('0x12')],_0x3ae43f);_0x5a3358(_0x501a4c[_0xc255('0xf')](0x1f4,_0x1dbfc3['message']));});});};exports[_0xc255('0x1f')]=function(_0x4b96a5){var _0x359950=this;return new Promise(function(_0xa4da0d,_0x586252){return db[_0xc255('0x20')][_0xc255('0x21')]({'raw':_0x4b96a5[_0xc255('0x17')]?_0x4b96a5[_0xc255('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4b96a5[_0xc255('0x17')]?_0x4b96a5[_0xc255('0x17')][_0xc255('0x19')]||null:null,'attributes':_0x4b96a5[_0xc255('0x17')]?_0x4b96a5['options'][_0xc255('0x1a')]||null:null,'include':_0x4b96a5['options']?_0x4b96a5['options'][_0xc255('0x1c')]?_[_0xc255('0x1d')](_0x4b96a5[_0xc255('0x17')]['include'],function(_0x389233){return{'model':db[_0x389233[_0xc255('0x1e')]],'as':_0x389233['as'],'attributes':_0x389233['attributes'],'include':_0x389233[_0xc255('0x1c')]?_[_0xc255('0x1d')](_0x389233['include'],function(_0x45a6d8){return{'model':db[_0x45a6d8[_0xc255('0x1e')]],'as':_0x45a6d8['as'],'attributes':_0x45a6d8['attributes'],'include':_0x45a6d8[_0xc255('0x1c')]?_[_0xc255('0x1d')](_0x45a6d8[_0xc255('0x1c')],function(_0x809202){return{'model':db[_0x809202[_0xc255('0x1e')]],'as':_0x809202['as'],'attributes':_0x809202['attributes']};}):[]};}):[]};}):[]:[]})[_0xc255('0x9')](function(_0x1d100b){logger[_0xc255('0xa')](_0xc255('0x1f'),_0x4b96a5);logger[_0xc255('0xc')](_0xc255('0x1f'),_0x4b96a5,JSON['stringify'](_0x1d100b));_0xa4da0d(_0x1d100b);})[_0xc255('0x14')](function(_0x4b4fe1){logger[_0xc255('0xf')](_0xc255('0x1f'),_0x4b4fe1[_0xc255('0x12')],_0x4b96a5);_0x586252(_0x359950[_0xc255('0xf')](0x1f4,_0x4b4fe1[_0xc255('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5a8d284..f8fd266 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 _0x1b61=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','post','create','update','delete','exports','util','path','connect-timeout','express'];(function(_0x41ce61,_0x30358d){var _0x356b98=function(_0x44523b){while(--_0x44523b){_0x41ce61['push'](_0x41ce61['shift']());}};_0x356b98(++_0x30358d);}(_0x1b61,0x1dc));var _0x11b6=function(_0x46f047,_0x23a936){_0x46f047=_0x46f047-0x0;var _0x352bef=_0x1b61[_0x46f047];return _0x352bef;};'use strict';var multer=require('multer');var util=require(_0x11b6('0x0'));var path=require(_0x11b6('0x1'));var timeout=require(_0x11b6('0x2'));var express=require(_0x11b6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x11b6('0x4'));var interaction=require(_0x11b6('0x5'));var config=require(_0x11b6('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x11b6('0x7')]('/',auth[_0x11b6('0x8')](),controller[_0x11b6('0x9')]);router[_0x11b6('0x7')](_0x11b6('0xa'),auth[_0x11b6('0x8')](),controller[_0x11b6('0xb')]);router[_0x11b6('0x7')](_0x11b6('0xc'),auth[_0x11b6('0x8')](),controller[_0x11b6('0xd')]);router['get'](_0x11b6('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x11b6('0x7')]('/:id/descriptions',auth[_0x11b6('0x8')](),controller['getDescriptions']);router[_0x11b6('0xf')]('/',auth[_0x11b6('0x8')](),controller[_0x11b6('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x11b6('0x11')]);router[_0x11b6('0x12')](_0x11b6('0xa'),auth[_0x11b6('0x8')](),controller['destroy']);module[_0x11b6('0x13')]=router; \ No newline at end of file +var _0x5357=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x48836e,_0x533ed8){var _0x144b1e=function(_0x1d97ae){while(--_0x1d97ae){_0x48836e['push'](_0x48836e['shift']());}};_0x144b1e(++_0x533ed8);}(_0x5357,0x1bf));var _0x7535=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x5357[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x7535('0x0'));var util=require(_0x7535('0x1'));var path=require(_0x7535('0x2'));var timeout=require(_0x7535('0x3'));var express=require('express');var router=express[_0x7535('0x4')]();var fs_extra=require(_0x7535('0x5'));var auth=require(_0x7535('0x6'));var interaction=require(_0x7535('0x7'));var config=require(_0x7535('0x8'));var controller=require(_0x7535('0x9'));router[_0x7535('0xa')]('/',auth[_0x7535('0xb')](),controller['index']);router[_0x7535('0xa')](_0x7535('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7535('0xa')](_0x7535('0xd'),auth[_0x7535('0xb')](),controller['getFields']);router[_0x7535('0xa')](_0x7535('0xe'),auth['isAuthenticated'](),controller[_0x7535('0xf')]);router['get'](_0x7535('0x10'),auth['isAuthenticated'](),controller[_0x7535('0x11')]);router[_0x7535('0x12')]('/',auth[_0x7535('0xb')](),controller[_0x7535('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7535('0x14')]);router['delete'](_0x7535('0xc'),auth[_0x7535('0xb')](),controller[_0x7535('0x15')]);module[_0x7535('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 1607822..2959b50 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 _0xa0f2=['STRING','sequelize','exports'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0xa0f2,0x106));var _0x2a0f=function(_0x127418,_0x480a1b){_0x127418=_0x127418-0x0;var _0x5d2ca7=_0xa0f2[_0x127418];return _0x5d2ca7;};'use strict';var Sequelize=require(_0x2a0f('0x0'));module[_0x2a0f('0x1')]={'name':{'type':Sequelize[_0x2a0f('0x2')]},'description':{'type':Sequelize[_0x2a0f('0x2')]}}; \ No newline at end of file +var _0x7a8a=['exports','sequelize'];(function(_0x40cc74,_0x37e2ce){var _0x50610e=function(_0x3a0f22){while(--_0x3a0f22){_0x40cc74['push'](_0x40cc74['shift']());}};_0x50610e(++_0x37e2ce);}(_0x7a8a,0x67));var _0xa7a8=function(_0x446d7b,_0x366054){_0x446d7b=_0x446d7b-0x0;var _0x21e089=_0x7a8a[_0x446d7b];return _0x21e089;};'use strict';var Sequelize=require(_0xa7a8('0x0'));module[_0xa7a8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index c876637..a9465ce 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 _0x8268=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','params','create','body','find','getFields','ServicenowField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8268,0x1ce));var _0x8826=function(_0x2ce0df,_0x2f7641){_0x2ce0df=_0x2ce0df-0x0;var _0x2c07a6=_0x8268[_0x2ce0df];return _0x2c07a6;};'use strict';var emlformat=require(_0x8826('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8826('0x1'));var jsonpatch=require(_0x8826('0x2'));var rp=require(_0x8826('0x3'));var moment=require(_0x8826('0x4'));var BPromise=require(_0x8826('0x5'));var Mustache=require(_0x8826('0x6'));var util=require(_0x8826('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8826('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8826('0x9'));var _=require(_0x8826('0xa'));var squel=require(_0x8826('0xb'));var crypto=require(_0x8826('0xc'));var jsforce=require(_0x8826('0xd'));var deskjs=require(_0x8826('0xe'));var toCsv=require(_0x8826('0x8'));var querystring=require(_0x8826('0xf'));var Papa=require(_0x8826('0x10'));var Redis=require(_0x8826('0x11'));var authService=require(_0x8826('0x12'));var qs=require(_0x8826('0x13'));var as=require(_0x8826('0x14'));var hardwareService=require(_0x8826('0x15'));var logger=require(_0x8826('0x16'))(_0x8826('0x17'));var utils=require('../../config/utils');var config=require(_0x8826('0x18'));var licenseUtil=require(_0x8826('0x19'));var db=require(_0x8826('0x1a'))['db'];function respondWithStatusCode(_0x3f0312,_0x48f883){_0x48f883=_0x48f883||0xcc;return function(_0x3d34f8){if(_0x3d34f8){return _0x3f0312[_0x8826('0x1b')](_0x48f883);}return _0x3f0312[_0x8826('0x1c')](_0x48f883)['end']();};}function respondWithResult(_0x9d58b2,_0x877bb4){_0x877bb4=_0x877bb4||0xc8;return function(_0x4fdc9e){if(_0x4fdc9e){return _0x9d58b2['status'](_0x877bb4)[_0x8826('0x1d')](_0x4fdc9e);}};}function respondWithFilteredResult(_0xbe0a37,_0x3f715d){return function(_0x279132){if(_0x279132){var _0x10d9de=typeof _0x3f715d[_0x8826('0x1e')]===_0x8826('0x1f')&&typeof _0x3f715d[_0x8826('0x20')]===_0x8826('0x1f');var _0x599d47=_0x279132[_0x8826('0x21')];var _0x43f367=_0x10d9de?0x0:_0x3f715d[_0x8826('0x1e')];var _0xab2a95=_0x10d9de?_0x279132[_0x8826('0x21')]:_0x3f715d[_0x8826('0x1e')]+_0x3f715d[_0x8826('0x20')];var _0x5c60e5;if(_0xab2a95>=_0x599d47){_0xab2a95=_0x599d47;_0x5c60e5=0xc8;}else{_0x5c60e5=0xce;}_0xbe0a37[_0x8826('0x1c')](_0x5c60e5);return _0xbe0a37[_0x8826('0x22')](_0x8826('0x23'),_0x43f367+'-'+_0xab2a95+'/'+_0x599d47)[_0x8826('0x1d')](_0x279132);}return null;};}function patchUpdates(_0x40a7a7){return function(_0xe7b08f){try{jsonpatch[_0x8826('0x24')](_0xe7b08f,_0x40a7a7,!![]);}catch(_0xd86d44){return BPromise['reject'](_0xd86d44);}return _0xe7b08f['save']();};}function saveUpdates(_0x53d5e3,_0x490f0a){return function(_0xc30c4){if(_0xc30c4){return _0xc30c4[_0x8826('0x25')](_0x53d5e3)[_0x8826('0x26')](function(_0x43a1da){return _0x43a1da;});}return null;};}function removeEntity(_0x75532f,_0x6ff8){return function(_0xb73106){if(_0xb73106){return _0xb73106[_0x8826('0x27')]()[_0x8826('0x26')](function(){_0x75532f[_0x8826('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a3fe,_0x38b7d0){return function(_0x345b2e){if(!_0x345b2e){_0x13a3fe[_0x8826('0x1b')](0x194);}return _0x345b2e;};}function handleError(_0x38dbfc,_0x1d8c09){_0x1d8c09=_0x1d8c09||0x1f4;return function(_0x51e19f){logger['error'](_0x51e19f[_0x8826('0x28')]);if(_0x51e19f[_0x8826('0x29')]){delete _0x51e19f['name'];}_0x38dbfc[_0x8826('0x1c')](_0x1d8c09)[_0x8826('0x2a')](_0x51e19f);};}exports[_0x8826('0x2b')]=function(_0x1391ee,_0x3b003e){var _0xab2611={},_0x36dff7={},_0x2b286c={'count':0x0,'rows':[]};var _0x3637b4=_[_0x8826('0x2c')](db[_0x8826('0x2d')][_0x8826('0x2e')],function(_0x9bdf13){return{'name':_0x9bdf13[_0x8826('0x2f')],'type':_0x9bdf13[_0x8826('0x30')][_0x8826('0x31')]};});_0x36dff7[_0x8826('0x32')]=_[_0x8826('0x2c')](_0x3637b4,'name');_0x36dff7['query']=_[_0x8826('0x33')](_0x1391ee[_0x8826('0x34')]);_0x36dff7[_0x8826('0x35')]=_[_0x8826('0x36')](_0x36dff7[_0x8826('0x32')],_0x36dff7[_0x8826('0x34')]);_0xab2611[_0x8826('0x37')]=_['intersection'](_0x36dff7[_0x8826('0x32')],qs[_0x8826('0x38')](_0x1391ee[_0x8826('0x34')][_0x8826('0x38')]));_0xab2611[_0x8826('0x37')]=_0xab2611[_0x8826('0x37')][_0x8826('0x39')]?_0xab2611[_0x8826('0x37')]:_0x36dff7['model'];if(!_0x1391ee['query'][_0x8826('0x3a')](_0x8826('0x3b'))){_0xab2611['limit']=qs['limit'](_0x1391ee[_0x8826('0x34')][_0x8826('0x20')]);_0xab2611[_0x8826('0x1e')]=qs[_0x8826('0x1e')](_0x1391ee[_0x8826('0x34')][_0x8826('0x1e')]);}_0xab2611[_0x8826('0x3c')]=qs[_0x8826('0x3d')](_0x1391ee[_0x8826('0x34')][_0x8826('0x3d')]);_0xab2611[_0x8826('0x3e')]=qs[_0x8826('0x35')](_[_0x8826('0x3f')](_0x1391ee[_0x8826('0x34')],_0x36dff7[_0x8826('0x35')]),_0x3637b4);if(_0x1391ee[_0x8826('0x34')]['filter']){_0xab2611[_0x8826('0x3e')]=_['merge'](_0xab2611['where'],{'$or':_[_0x8826('0x2c')](_0x3637b4,function(_0x5ab91e){if(_0x5ab91e['type']!==_0x8826('0x40')){var _0x28da44={};_0x28da44[_0x5ab91e[_0x8826('0x29')]]={'$like':'%'+_0x1391ee[_0x8826('0x34')][_0x8826('0x41')]+'%'};return _0x28da44;}})});}_0xab2611=_[_0x8826('0x42')]({},_0xab2611,_0x1391ee[_0x8826('0x43')]);var _0x303045={'where':_0xab2611[_0x8826('0x3e')]};return db[_0x8826('0x2d')]['count'](_0x303045)[_0x8826('0x26')](function(_0x523c1a){_0x2b286c[_0x8826('0x21')]=_0x523c1a;if(_0x1391ee[_0x8826('0x34')][_0x8826('0x44')]){_0xab2611[_0x8826('0x45')]=[{'all':!![]}];}return db[_0x8826('0x2d')][_0x8826('0x46')](_0xab2611);})[_0x8826('0x26')](function(_0x1ad06a){_0x2b286c['rows']=_0x1ad06a;return _0x2b286c;})[_0x8826('0x26')](respondWithFilteredResult(_0x3b003e,_0xab2611))[_0x8826('0x47')](handleError(_0x3b003e,null));};exports['show']=function(_0x572234,_0x32a985){var _0x2c0f1d={'raw':![],'where':{'id':_0x572234[_0x8826('0x48')]['id']}},_0x1a1f21={};_0x1a1f21['model']=_[_0x8826('0x33')](db[_0x8826('0x2d')][_0x8826('0x2e')]);_0x1a1f21[_0x8826('0x34')]=_[_0x8826('0x33')](_0x572234[_0x8826('0x34')]);_0x1a1f21[_0x8826('0x35')]=_['intersection'](_0x1a1f21[_0x8826('0x32')],_0x1a1f21[_0x8826('0x34')]);_0x2c0f1d[_0x8826('0x37')]=_['intersection'](_0x1a1f21['model'],qs[_0x8826('0x38')](_0x572234['query'][_0x8826('0x38')]));_0x2c0f1d[_0x8826('0x37')]=_0x2c0f1d[_0x8826('0x37')][_0x8826('0x39')]?_0x2c0f1d[_0x8826('0x37')]:_0x1a1f21[_0x8826('0x32')];if(_0x572234[_0x8826('0x34')][_0x8826('0x44')]){_0x2c0f1d['include']=[{'all':!![]}];}_0x2c0f1d=_[_0x8826('0x42')]({},_0x2c0f1d,_0x572234['options']);return db[_0x8826('0x2d')]['find'](_0x2c0f1d)[_0x8826('0x26')](handleEntityNotFound(_0x32a985,null))[_0x8826('0x26')](respondWithResult(_0x32a985,null))[_0x8826('0x47')](handleError(_0x32a985,null));};exports[_0x8826('0x49')]=function(_0x5776fd,_0xc267b5){return db['ServicenowConfiguration'][_0x8826('0x49')](_0x5776fd[_0x8826('0x4a')],{})[_0x8826('0x26')](respondWithResult(_0xc267b5,0xc9))[_0x8826('0x47')](handleError(_0xc267b5,null));};exports['update']=function(_0x804c53,_0x4b18c9){if(_0x804c53['body']['id']){delete _0x804c53[_0x8826('0x4a')]['id'];}return db[_0x8826('0x2d')][_0x8826('0x4b')]({'where':{'id':_0x804c53[_0x8826('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b18c9,null))[_0x8826('0x26')](saveUpdates(_0x804c53['body'],null))[_0x8826('0x26')](respondWithResult(_0x4b18c9,null))[_0x8826('0x47')](handleError(_0x4b18c9,null));};exports[_0x8826('0x27')]=function(_0x24a4a5,_0x4172f3){return db[_0x8826('0x2d')][_0x8826('0x4b')]({'where':{'id':_0x24a4a5['params']['id']}})[_0x8826('0x26')](handleEntityNotFound(_0x4172f3,null))[_0x8826('0x26')](removeEntity(_0x4172f3,null))[_0x8826('0x47')](handleError(_0x4172f3,null));};exports[_0x8826('0x4c')]=function(_0x5ad114,_0x137406,_0x161b9a){var _0x4a74e4={};var _0x49e12d={};var _0x4ad769;var _0x224fd4;return db[_0x8826('0x2d')]['findOne']({'where':{'id':_0x5ad114['params']['id']}})[_0x8826('0x26')](handleEntityNotFound(_0x137406,null))['then'](function(_0x4c9e79){if(_0x4c9e79){_0x4ad769=_0x4c9e79;_0x49e12d[_0x8826('0x32')]=_[_0x8826('0x33')](db[_0x8826('0x4d')][_0x8826('0x2e')]);_0x49e12d['query']=_[_0x8826('0x33')](_0x5ad114[_0x8826('0x34')]);_0x49e12d[_0x8826('0x35')]=_[_0x8826('0x36')](_0x49e12d[_0x8826('0x32')],_0x49e12d['query']);_0x4a74e4['attributes']=_[_0x8826('0x36')](_0x49e12d[_0x8826('0x32')],qs[_0x8826('0x38')](_0x5ad114['query'][_0x8826('0x38')]));_0x4a74e4[_0x8826('0x37')]=_0x4a74e4[_0x8826('0x37')]['length']?_0x4a74e4[_0x8826('0x37')]:_0x49e12d[_0x8826('0x32')];_0x4a74e4[_0x8826('0x3c')]=qs[_0x8826('0x3d')](_0x5ad114[_0x8826('0x34')][_0x8826('0x3d')]);_0x4a74e4[_0x8826('0x3e')]=qs[_0x8826('0x35')](_[_0x8826('0x3f')](_0x5ad114['query'],_0x49e12d[_0x8826('0x35')]));if(_0x5ad114['query']['filter']){_0x4a74e4[_0x8826('0x3e')]=_[_0x8826('0x42')](_0x4a74e4[_0x8826('0x3e')],{'$or':_[_0x8826('0x2c')](_0x4a74e4['attributes'],function(_0x210a56){var _0x232cc6={};_0x232cc6[_0x210a56]={'$like':'%'+_0x5ad114[_0x8826('0x34')][_0x8826('0x41')]+'%'};return _0x232cc6;})});}_0x4a74e4=_[_0x8826('0x42')]({},_0x4a74e4,_0x5ad114[_0x8826('0x43')]);return _0x4ad769['getFields'](_0x4a74e4);}})[_0x8826('0x26')](function(_0x4820be){if(_0x4820be){_0x224fd4=_0x4820be[_0x8826('0x39')];if(!_0x5ad114[_0x8826('0x34')][_0x8826('0x3a')](_0x8826('0x3b'))){_0x4a74e4['limit']=qs[_0x8826('0x20')](_0x5ad114[_0x8826('0x34')][_0x8826('0x20')]);_0x4a74e4['offset']=qs[_0x8826('0x1e')](_0x5ad114[_0x8826('0x34')][_0x8826('0x1e')]);}return _0x4ad769['getFields'](_0x4a74e4);}})['then'](function(_0x1995b2){if(_0x1995b2){return _0x1995b2?{'count':_0x224fd4,'rows':_0x1995b2}:null;}})[_0x8826('0x26')](respondWithResult(_0x137406,null))['catch'](handleError(_0x137406,null));};exports[_0x8826('0x4e')]=function(_0x7528f7,_0x4858dd,_0x28eb44){var _0x173e54={};var _0x4da1fd={};var _0x33d67e;var _0xdb1586;return db[_0x8826('0x2d')][_0x8826('0x4f')]({'where':{'id':_0x7528f7[_0x8826('0x48')]['id']}})[_0x8826('0x26')](handleEntityNotFound(_0x4858dd,null))[_0x8826('0x26')](function(_0x1959cf){if(_0x1959cf){_0x33d67e=_0x1959cf;_0x4da1fd[_0x8826('0x32')]=_[_0x8826('0x33')](db[_0x8826('0x4d')][_0x8826('0x2e')]);_0x4da1fd['query']=_['keys'](_0x7528f7[_0x8826('0x34')]);_0x4da1fd[_0x8826('0x35')]=_[_0x8826('0x36')](_0x4da1fd[_0x8826('0x32')],_0x4da1fd[_0x8826('0x34')]);_0x173e54[_0x8826('0x37')]=_[_0x8826('0x36')](_0x4da1fd[_0x8826('0x32')],qs['fields'](_0x7528f7[_0x8826('0x34')][_0x8826('0x38')]));_0x173e54['attributes']=_0x173e54[_0x8826('0x37')][_0x8826('0x39')]?_0x173e54[_0x8826('0x37')]:_0x4da1fd[_0x8826('0x32')];_0x173e54[_0x8826('0x3c')]=qs[_0x8826('0x3d')](_0x7528f7[_0x8826('0x34')][_0x8826('0x3d')]);_0x173e54[_0x8826('0x3e')]=qs[_0x8826('0x35')](_['pick'](_0x7528f7[_0x8826('0x34')],_0x4da1fd['filters']));if(_0x7528f7[_0x8826('0x34')][_0x8826('0x41')]){_0x173e54[_0x8826('0x3e')]=_[_0x8826('0x42')](_0x173e54[_0x8826('0x3e')],{'$or':_[_0x8826('0x2c')](_0x173e54[_0x8826('0x37')],function(_0x50a1e9){var _0x5e4d93={};_0x5e4d93[_0x50a1e9]={'$like':'%'+_0x7528f7[_0x8826('0x34')][_0x8826('0x41')]+'%'};return _0x5e4d93;})});}_0x173e54=_[_0x8826('0x42')]({},_0x173e54,_0x7528f7[_0x8826('0x43')]);return _0x33d67e['getSubjects'](_0x173e54);}})[_0x8826('0x26')](function(_0xc23cc9){if(_0xc23cc9){_0xdb1586=_0xc23cc9[_0x8826('0x39')];if(!_0x7528f7[_0x8826('0x34')][_0x8826('0x3a')](_0x8826('0x3b'))){_0x173e54[_0x8826('0x20')]=qs['limit'](_0x7528f7[_0x8826('0x34')][_0x8826('0x20')]);_0x173e54[_0x8826('0x1e')]=qs[_0x8826('0x1e')](_0x7528f7['query']['offset']);}return _0x33d67e[_0x8826('0x4e')](_0x173e54);}})[_0x8826('0x26')](function(_0xe706a3){if(_0xe706a3){return _0xe706a3?{'count':_0xdb1586,'rows':_0xe706a3}:null;}})[_0x8826('0x26')](respondWithResult(_0x4858dd,null))['catch'](handleError(_0x4858dd,null));};exports[_0x8826('0x50')]=function(_0x208779,_0x77e684,_0x1d449d){var _0x1e1e00={};var _0xb6470c={};var _0x40ec6b;var _0x1047aa;return db[_0x8826('0x2d')][_0x8826('0x4f')]({'where':{'id':_0x208779[_0x8826('0x48')]['id']}})[_0x8826('0x26')](handleEntityNotFound(_0x77e684,null))[_0x8826('0x26')](function(_0x525520){if(_0x525520){_0x40ec6b=_0x525520;_0xb6470c['model']=_['keys'](db[_0x8826('0x4d')][_0x8826('0x2e')]);_0xb6470c['query']=_[_0x8826('0x33')](_0x208779[_0x8826('0x34')]);_0xb6470c['filters']=_[_0x8826('0x36')](_0xb6470c[_0x8826('0x32')],_0xb6470c[_0x8826('0x34')]);_0x1e1e00['attributes']=_[_0x8826('0x36')](_0xb6470c[_0x8826('0x32')],qs[_0x8826('0x38')](_0x208779['query'][_0x8826('0x38')]));_0x1e1e00['attributes']=_0x1e1e00[_0x8826('0x37')]['length']?_0x1e1e00['attributes']:_0xb6470c[_0x8826('0x32')];_0x1e1e00[_0x8826('0x3c')]=qs[_0x8826('0x3d')](_0x208779['query'][_0x8826('0x3d')]);_0x1e1e00[_0x8826('0x3e')]=qs[_0x8826('0x35')](_[_0x8826('0x3f')](_0x208779[_0x8826('0x34')],_0xb6470c[_0x8826('0x35')]));if(_0x208779[_0x8826('0x34')][_0x8826('0x41')]){_0x1e1e00[_0x8826('0x3e')]=_[_0x8826('0x42')](_0x1e1e00[_0x8826('0x3e')],{'$or':_[_0x8826('0x2c')](_0x1e1e00['attributes'],function(_0x4d3ea2){var _0x5d673e={};_0x5d673e[_0x4d3ea2]={'$like':'%'+_0x208779[_0x8826('0x34')][_0x8826('0x41')]+'%'};return _0x5d673e;})});}_0x1e1e00=_[_0x8826('0x42')]({},_0x1e1e00,_0x208779[_0x8826('0x43')]);return _0x40ec6b['getDescriptions'](_0x1e1e00);}})[_0x8826('0x26')](function(_0x52f6bd){if(_0x52f6bd){_0x1047aa=_0x52f6bd[_0x8826('0x39')];if(!_0x208779[_0x8826('0x34')][_0x8826('0x3a')](_0x8826('0x3b'))){_0x1e1e00[_0x8826('0x20')]=qs[_0x8826('0x20')](_0x208779[_0x8826('0x34')][_0x8826('0x20')]);_0x1e1e00['offset']=qs[_0x8826('0x1e')](_0x208779['query'][_0x8826('0x1e')]);}return _0x40ec6b['getDescriptions'](_0x1e1e00);}})[_0x8826('0x26')](function(_0x280a44){if(_0x280a44){return _0x280a44?{'count':_0x1047aa,'rows':_0x280a44}:null;}})['then'](respondWithResult(_0x77e684,null))[_0x8826('0x47')](handleError(_0x77e684,null));}; \ No newline at end of file +var _0x324b=['then','error','stack','name','send','index','ServicenowConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','catch','show','params','rawAttributes','find','create','body','destroy','ServicenowField','order','getFields','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','save','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x324b,0x7e));var _0xb324=function(_0x5372e2,_0x531fcf){_0x5372e2=_0x5372e2-0x0;var _0x55ff3d=_0x324b[_0x5372e2];return _0x55ff3d;};'use strict';var emlformat=require(_0xb324('0x0'));var rimraf=require(_0xb324('0x1'));var zipdir=require(_0xb324('0x2'));var jsonpatch=require(_0xb324('0x3'));var rp=require(_0xb324('0x4'));var moment=require(_0xb324('0x5'));var BPromise=require(_0xb324('0x6'));var Mustache=require('mustache');var util=require(_0xb324('0x7'));var path=require(_0xb324('0x8'));var sox=require(_0xb324('0x9'));var csv=require(_0xb324('0xa'));var ejs=require(_0xb324('0xb'));var fs=require('fs');var fs_extra=require(_0xb324('0xc'));var _=require(_0xb324('0xd'));var squel=require(_0xb324('0xe'));var crypto=require(_0xb324('0xf'));var jsforce=require(_0xb324('0x10'));var deskjs=require(_0xb324('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb324('0x12'));var Papa=require(_0xb324('0x13'));var Redis=require(_0xb324('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb324('0x15'));var as=require(_0xb324('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb324('0x17'))(_0xb324('0x18'));var utils=require(_0xb324('0x19'));var config=require(_0xb324('0x1a'));var licenseUtil=require(_0xb324('0x1b'));var db=require(_0xb324('0x1c'))['db'];function respondWithStatusCode(_0x49fd0f,_0x577506){_0x577506=_0x577506||0xcc;return function(_0x5a191b){if(_0x5a191b){return _0x49fd0f[_0xb324('0x1d')](_0x577506);}return _0x49fd0f[_0xb324('0x1e')](_0x577506)[_0xb324('0x1f')]();};}function respondWithResult(_0x476b64,_0x186165){_0x186165=_0x186165||0xc8;return function(_0x3dda09){if(_0x3dda09){return _0x476b64[_0xb324('0x1e')](_0x186165)['json'](_0x3dda09);}};}function respondWithFilteredResult(_0x347f48,_0x298593){return function(_0x471c16){if(_0x471c16){var _0x1be1ab=typeof _0x298593['offset']===_0xb324('0x20')&&typeof _0x298593[_0xb324('0x21')]===_0xb324('0x20');var _0x41bfa5=_0x471c16['count'];var _0x487f1a=_0x1be1ab?0x0:_0x298593[_0xb324('0x22')];var _0x393277=_0x1be1ab?_0x471c16[_0xb324('0x23')]:_0x298593['offset']+_0x298593[_0xb324('0x21')];var _0x23e568;if(_0x393277>=_0x41bfa5){_0x393277=_0x41bfa5;_0x23e568=0xc8;}else{_0x23e568=0xce;}_0x347f48[_0xb324('0x1e')](_0x23e568);return _0x347f48[_0xb324('0x24')](_0xb324('0x25'),_0x487f1a+'-'+_0x393277+'/'+_0x41bfa5)[_0xb324('0x26')](_0x471c16);}return null;};}function patchUpdates(_0x3db61a){return function(_0x12a7db){try{jsonpatch[_0xb324('0x27')](_0x12a7db,_0x3db61a,!![]);}catch(_0x147bf7){return BPromise['reject'](_0x147bf7);}return _0x12a7db[_0xb324('0x28')]();};}function saveUpdates(_0x3e163c,_0x4f985f){return function(_0x24de78){if(_0x24de78){return _0x24de78[_0xb324('0x29')](_0x3e163c)['then'](function(_0x2bffbb){return _0x2bffbb;});}return null;};}function removeEntity(_0x2a139c,_0x1962c6){return function(_0x213d3c){if(_0x213d3c){return _0x213d3c['destroy']()[_0xb324('0x2a')](function(){_0x2a139c[_0xb324('0x1e')](0xcc)[_0xb324('0x1f')]();});}};}function handleEntityNotFound(_0x3d1c33,_0xe14c6e){return function(_0x12c58d){if(!_0x12c58d){_0x3d1c33[_0xb324('0x1d')](0x194);}return _0x12c58d;};}function handleError(_0x19fd1f,_0x42006c){_0x42006c=_0x42006c||0x1f4;return function(_0xb53092){logger[_0xb324('0x2b')](_0xb53092[_0xb324('0x2c')]);if(_0xb53092['name']){delete _0xb53092[_0xb324('0x2d')];}_0x19fd1f[_0xb324('0x1e')](_0x42006c)[_0xb324('0x2e')](_0xb53092);};}exports[_0xb324('0x2f')]=function(_0x2600a5,_0x114db7){var _0x3fa95b={},_0xf903bc={},_0x53ca38={'count':0x0,'rows':[]};var _0x1042b6=_['map'](db[_0xb324('0x30')]['rawAttributes'],function(_0x4106f4){return{'name':_0x4106f4[_0xb324('0x31')],'type':_0x4106f4[_0xb324('0x32')][_0xb324('0x33')]};});_0xf903bc[_0xb324('0x34')]=_[_0xb324('0x35')](_0x1042b6,'name');_0xf903bc[_0xb324('0x36')]=_[_0xb324('0x37')](_0x2600a5[_0xb324('0x36')]);_0xf903bc[_0xb324('0x38')]=_[_0xb324('0x39')](_0xf903bc[_0xb324('0x34')],_0xf903bc['query']);_0x3fa95b['attributes']=_[_0xb324('0x39')](_0xf903bc[_0xb324('0x34')],qs[_0xb324('0x3a')](_0x2600a5[_0xb324('0x36')][_0xb324('0x3a')]));_0x3fa95b[_0xb324('0x3b')]=_0x3fa95b[_0xb324('0x3b')][_0xb324('0x3c')]?_0x3fa95b[_0xb324('0x3b')]:_0xf903bc[_0xb324('0x34')];if(!_0x2600a5['query'][_0xb324('0x3d')](_0xb324('0x3e'))){_0x3fa95b[_0xb324('0x21')]=qs[_0xb324('0x21')](_0x2600a5['query']['limit']);_0x3fa95b[_0xb324('0x22')]=qs['offset'](_0x2600a5[_0xb324('0x36')][_0xb324('0x22')]);}_0x3fa95b['order']=qs[_0xb324('0x3f')](_0x2600a5[_0xb324('0x36')][_0xb324('0x3f')]);_0x3fa95b[_0xb324('0x40')]=qs['filters'](_[_0xb324('0x41')](_0x2600a5[_0xb324('0x36')],_0xf903bc[_0xb324('0x38')]),_0x1042b6);if(_0x2600a5[_0xb324('0x36')]['filter']){_0x3fa95b[_0xb324('0x40')]=_['merge'](_0x3fa95b[_0xb324('0x40')],{'$or':_['map'](_0x1042b6,function(_0x4150c4){if(_0x4150c4['type']!=='VIRTUAL'){var _0x28b39f={};_0x28b39f[_0x4150c4[_0xb324('0x2d')]]={'$like':'%'+_0x2600a5['query'][_0xb324('0x42')]+'%'};return _0x28b39f;}})});}_0x3fa95b=_[_0xb324('0x43')]({},_0x3fa95b,_0x2600a5[_0xb324('0x44')]);var _0x55f6f5={'where':_0x3fa95b['where']};return db[_0xb324('0x30')][_0xb324('0x23')](_0x55f6f5)['then'](function(_0x177c5c){_0x53ca38[_0xb324('0x23')]=_0x177c5c;if(_0x2600a5[_0xb324('0x36')]['includeAll']){_0x3fa95b[_0xb324('0x45')]=[{'all':!![]}];}return db[_0xb324('0x30')]['findAll'](_0x3fa95b);})[_0xb324('0x2a')](function(_0xf319eb){_0x53ca38['rows']=_0xf319eb;return _0x53ca38;})['then'](respondWithFilteredResult(_0x114db7,_0x3fa95b))[_0xb324('0x46')](handleError(_0x114db7,null));};exports[_0xb324('0x47')]=function(_0x444bbb,_0x31ec08){var _0x5bfb72={'raw':![],'where':{'id':_0x444bbb[_0xb324('0x48')]['id']}},_0x10bbe4={};_0x10bbe4[_0xb324('0x34')]=_[_0xb324('0x37')](db[_0xb324('0x30')][_0xb324('0x49')]);_0x10bbe4[_0xb324('0x36')]=_[_0xb324('0x37')](_0x444bbb['query']);_0x10bbe4['filters']=_[_0xb324('0x39')](_0x10bbe4['model'],_0x10bbe4[_0xb324('0x36')]);_0x5bfb72[_0xb324('0x3b')]=_['intersection'](_0x10bbe4[_0xb324('0x34')],qs[_0xb324('0x3a')](_0x444bbb[_0xb324('0x36')][_0xb324('0x3a')]));_0x5bfb72[_0xb324('0x3b')]=_0x5bfb72[_0xb324('0x3b')][_0xb324('0x3c')]?_0x5bfb72['attributes']:_0x10bbe4['model'];if(_0x444bbb[_0xb324('0x36')]['includeAll']){_0x5bfb72[_0xb324('0x45')]=[{'all':!![]}];}_0x5bfb72=_[_0xb324('0x43')]({},_0x5bfb72,_0x444bbb[_0xb324('0x44')]);return db['ServicenowConfiguration'][_0xb324('0x4a')](_0x5bfb72)[_0xb324('0x2a')](handleEntityNotFound(_0x31ec08,null))[_0xb324('0x2a')](respondWithResult(_0x31ec08,null))['catch'](handleError(_0x31ec08,null));};exports['create']=function(_0x1d26f8,_0x347667){return db[_0xb324('0x30')][_0xb324('0x4b')](_0x1d26f8[_0xb324('0x4c')],{})[_0xb324('0x2a')](respondWithResult(_0x347667,0xc9))[_0xb324('0x46')](handleError(_0x347667,null));};exports[_0xb324('0x29')]=function(_0xeb926f,_0x14277b){if(_0xeb926f[_0xb324('0x4c')]['id']){delete _0xeb926f[_0xb324('0x4c')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0xeb926f[_0xb324('0x48')]['id']}})['then'](handleEntityNotFound(_0x14277b,null))[_0xb324('0x2a')](saveUpdates(_0xeb926f[_0xb324('0x4c')],null))[_0xb324('0x2a')](respondWithResult(_0x14277b,null))['catch'](handleError(_0x14277b,null));};exports[_0xb324('0x4d')]=function(_0x3e506c,_0x418905){return db[_0xb324('0x30')]['find']({'where':{'id':_0x3e506c[_0xb324('0x48')]['id']}})[_0xb324('0x2a')](handleEntityNotFound(_0x418905,null))[_0xb324('0x2a')](removeEntity(_0x418905,null))[_0xb324('0x46')](handleError(_0x418905,null));};exports['getFields']=function(_0x448544,_0x1907ed,_0x33bd69){var _0x3b8e4b={};var _0x2d87be={};var _0x476bf7;var _0x199914;return db[_0xb324('0x30')]['findOne']({'where':{'id':_0x448544[_0xb324('0x48')]['id']}})[_0xb324('0x2a')](handleEntityNotFound(_0x1907ed,null))[_0xb324('0x2a')](function(_0x36c79a){if(_0x36c79a){_0x476bf7=_0x36c79a;_0x2d87be['model']=_[_0xb324('0x37')](db[_0xb324('0x4e')][_0xb324('0x49')]);_0x2d87be['query']=_[_0xb324('0x37')](_0x448544[_0xb324('0x36')]);_0x2d87be[_0xb324('0x38')]=_[_0xb324('0x39')](_0x2d87be[_0xb324('0x34')],_0x2d87be[_0xb324('0x36')]);_0x3b8e4b['attributes']=_[_0xb324('0x39')](_0x2d87be[_0xb324('0x34')],qs[_0xb324('0x3a')](_0x448544[_0xb324('0x36')]['fields']));_0x3b8e4b['attributes']=_0x3b8e4b['attributes']['length']?_0x3b8e4b[_0xb324('0x3b')]:_0x2d87be['model'];_0x3b8e4b[_0xb324('0x4f')]=qs['sort'](_0x448544[_0xb324('0x36')][_0xb324('0x3f')]);_0x3b8e4b[_0xb324('0x40')]=qs['filters'](_['pick'](_0x448544[_0xb324('0x36')],_0x2d87be[_0xb324('0x38')]));if(_0x448544[_0xb324('0x36')][_0xb324('0x42')]){_0x3b8e4b['where']=_[_0xb324('0x43')](_0x3b8e4b['where'],{'$or':_[_0xb324('0x35')](_0x3b8e4b['attributes'],function(_0x30d347){var _0xe5452e={};_0xe5452e[_0x30d347]={'$like':'%'+_0x448544['query'][_0xb324('0x42')]+'%'};return _0xe5452e;})});}_0x3b8e4b=_[_0xb324('0x43')]({},_0x3b8e4b,_0x448544[_0xb324('0x44')]);return _0x476bf7[_0xb324('0x50')](_0x3b8e4b);}})[_0xb324('0x2a')](function(_0x3a6334){if(_0x3a6334){_0x199914=_0x3a6334[_0xb324('0x3c')];if(!_0x448544[_0xb324('0x36')]['hasOwnProperty']('nolimit')){_0x3b8e4b['limit']=qs[_0xb324('0x21')](_0x448544[_0xb324('0x36')][_0xb324('0x21')]);_0x3b8e4b[_0xb324('0x22')]=qs[_0xb324('0x22')](_0x448544[_0xb324('0x36')]['offset']);}return _0x476bf7['getFields'](_0x3b8e4b);}})[_0xb324('0x2a')](function(_0x3edcf7){if(_0x3edcf7){return _0x3edcf7?{'count':_0x199914,'rows':_0x3edcf7}:null;}})[_0xb324('0x2a')](respondWithResult(_0x1907ed,null))[_0xb324('0x46')](handleError(_0x1907ed,null));};exports['getSubjects']=function(_0x244d9c,_0x1b1b92,_0x31bb42){var _0x4ecd35={};var _0x4dc87c={};var _0x1206e6;var _0x1336b7;return db[_0xb324('0x30')][_0xb324('0x51')]({'where':{'id':_0x244d9c[_0xb324('0x48')]['id']}})[_0xb324('0x2a')](handleEntityNotFound(_0x1b1b92,null))[_0xb324('0x2a')](function(_0x12929c){if(_0x12929c){_0x1206e6=_0x12929c;_0x4dc87c[_0xb324('0x34')]=_['keys'](db[_0xb324('0x4e')][_0xb324('0x49')]);_0x4dc87c['query']=_[_0xb324('0x37')](_0x244d9c[_0xb324('0x36')]);_0x4dc87c['filters']=_[_0xb324('0x39')](_0x4dc87c[_0xb324('0x34')],_0x4dc87c[_0xb324('0x36')]);_0x4ecd35[_0xb324('0x3b')]=_['intersection'](_0x4dc87c[_0xb324('0x34')],qs[_0xb324('0x3a')](_0x244d9c[_0xb324('0x36')][_0xb324('0x3a')]));_0x4ecd35[_0xb324('0x3b')]=_0x4ecd35[_0xb324('0x3b')][_0xb324('0x3c')]?_0x4ecd35[_0xb324('0x3b')]:_0x4dc87c[_0xb324('0x34')];_0x4ecd35[_0xb324('0x4f')]=qs[_0xb324('0x3f')](_0x244d9c[_0xb324('0x36')]['sort']);_0x4ecd35[_0xb324('0x40')]=qs[_0xb324('0x38')](_['pick'](_0x244d9c[_0xb324('0x36')],_0x4dc87c[_0xb324('0x38')]));if(_0x244d9c[_0xb324('0x36')][_0xb324('0x42')]){_0x4ecd35['where']=_[_0xb324('0x43')](_0x4ecd35[_0xb324('0x40')],{'$or':_[_0xb324('0x35')](_0x4ecd35[_0xb324('0x3b')],function(_0xda6085){var _0x244521={};_0x244521[_0xda6085]={'$like':'%'+_0x244d9c[_0xb324('0x36')][_0xb324('0x42')]+'%'};return _0x244521;})});}_0x4ecd35=_['merge']({},_0x4ecd35,_0x244d9c[_0xb324('0x44')]);return _0x1206e6[_0xb324('0x52')](_0x4ecd35);}})[_0xb324('0x2a')](function(_0x287dfd){if(_0x287dfd){_0x1336b7=_0x287dfd[_0xb324('0x3c')];if(!_0x244d9c[_0xb324('0x36')]['hasOwnProperty'](_0xb324('0x3e'))){_0x4ecd35[_0xb324('0x21')]=qs[_0xb324('0x21')](_0x244d9c[_0xb324('0x36')]['limit']);_0x4ecd35[_0xb324('0x22')]=qs[_0xb324('0x22')](_0x244d9c[_0xb324('0x36')][_0xb324('0x22')]);}return _0x1206e6[_0xb324('0x52')](_0x4ecd35);}})[_0xb324('0x2a')](function(_0x488df6){if(_0x488df6){return _0x488df6?{'count':_0x1336b7,'rows':_0x488df6}:null;}})['then'](respondWithResult(_0x1b1b92,null))['catch'](handleError(_0x1b1b92,null));};exports['getDescriptions']=function(_0x48149d,_0x383ca2,_0x3dc500){var _0x1b9420={};var _0x64b1ab={};var _0x19b330;var _0x45b8d7;return db['ServicenowConfiguration'][_0xb324('0x51')]({'where':{'id':_0x48149d['params']['id']}})['then'](handleEntityNotFound(_0x383ca2,null))['then'](function(_0x2a88f6){if(_0x2a88f6){_0x19b330=_0x2a88f6;_0x64b1ab[_0xb324('0x34')]=_[_0xb324('0x37')](db['ServicenowField'][_0xb324('0x49')]);_0x64b1ab[_0xb324('0x36')]=_[_0xb324('0x37')](_0x48149d['query']);_0x64b1ab[_0xb324('0x38')]=_[_0xb324('0x39')](_0x64b1ab['model'],_0x64b1ab[_0xb324('0x36')]);_0x1b9420[_0xb324('0x3b')]=_['intersection'](_0x64b1ab['model'],qs[_0xb324('0x3a')](_0x48149d['query'][_0xb324('0x3a')]));_0x1b9420[_0xb324('0x3b')]=_0x1b9420[_0xb324('0x3b')][_0xb324('0x3c')]?_0x1b9420['attributes']:_0x64b1ab[_0xb324('0x34')];_0x1b9420[_0xb324('0x4f')]=qs[_0xb324('0x3f')](_0x48149d[_0xb324('0x36')]['sort']);_0x1b9420[_0xb324('0x40')]=qs[_0xb324('0x38')](_[_0xb324('0x41')](_0x48149d[_0xb324('0x36')],_0x64b1ab[_0xb324('0x38')]));if(_0x48149d['query'][_0xb324('0x42')]){_0x1b9420[_0xb324('0x40')]=_[_0xb324('0x43')](_0x1b9420[_0xb324('0x40')],{'$or':_[_0xb324('0x35')](_0x1b9420[_0xb324('0x3b')],function(_0x49e310){var _0x3fc42={};_0x3fc42[_0x49e310]={'$like':'%'+_0x48149d[_0xb324('0x36')][_0xb324('0x42')]+'%'};return _0x3fc42;})});}_0x1b9420=_[_0xb324('0x43')]({},_0x1b9420,_0x48149d[_0xb324('0x44')]);return _0x19b330['getDescriptions'](_0x1b9420);}})[_0xb324('0x2a')](function(_0x18671a){if(_0x18671a){_0x45b8d7=_0x18671a['length'];if(!_0x48149d[_0xb324('0x36')][_0xb324('0x3d')](_0xb324('0x3e'))){_0x1b9420['limit']=qs[_0xb324('0x21')](_0x48149d[_0xb324('0x36')]['limit']);_0x1b9420[_0xb324('0x22')]=qs[_0xb324('0x22')](_0x48149d['query'][_0xb324('0x22')]);}return _0x19b330[_0xb324('0x53')](_0x1b9420);}})['then'](function(_0x1eba1b){if(_0x1eba1b){return _0x1eba1b?{'count':_0x45b8d7,'rows':_0x1eba1b}:null;}})[_0xb324('0x2a')](respondWithResult(_0x383ca2,null))[_0xb324('0x46')](handleError(_0x383ca2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 6867e5a..cf1a885 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 _0x0e21=['int_servicenow_configurations','util','../../config/logger','api','bluebird','request-promise','path','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0xf4990c,_0x37b7a7){var _0x171da9=function(_0x1f92dc){while(--_0x1f92dc){_0xf4990c['push'](_0xf4990c['shift']());}};_0x171da9(++_0x37b7a7);}(_0x0e21,0xe8));var _0x10e2=function(_0x40b75e,_0x2022c6){_0x40b75e=_0x40b75e-0x0;var _0x286101=_0x0e21[_0x40b75e];return _0x286101;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var logger=require(_0x10e2('0x1'))(_0x10e2('0x2'));var moment=require('moment');var BPromise=require(_0x10e2('0x3'));var rp=require(_0x10e2('0x4'));var fs=require('fs');var path=require(_0x10e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10e2('0x6'));module[_0x10e2('0x7')]=function(_0x2fb9e4,_0x44e30e){return _0x2fb9e4[_0x10e2('0x8')](_0x10e2('0x9'),attributes,{'tableName':_0x10e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d3=['path','rimraf','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x18758d,_0x486cff){var _0x10191a=function(_0x24006f){while(--_0x24006f){_0x18758d['push'](_0x18758d['shift']());}};_0x10191a(++_0x486cff);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x2ea93d,_0x4ee824){_0x2ea93d=_0x2ea93d-0x0;var _0x52256b=_0xd1d3[_0x2ea93d];return _0x52256b;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var logger=require(_0x3d1d('0x1'))('api');var moment=require(_0x3d1d('0x2'));var BPromise=require(_0x3d1d('0x3'));var rp=require(_0x3d1d('0x4'));var fs=require('fs');var path=require(_0x3d1d('0x5'));var rimraf=require(_0x3d1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x3d1d('0x7'));module[_0x3d1d('0x8')]=function(_0x55c165,_0x2d3a52){return _0x55c165[_0x3d1d('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x3d1d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 145c46b..24b94cf 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 _0xd68c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x17158c,_0x58cb92){var _0x734f31=function(_0x2a7a84){while(--_0x2a7a84){_0x17158c['push'](_0x17158c['shift']());}};_0x734f31(++_0x58cb92);}(_0xd68c,0x113));var _0xcd68=function(_0x224834,_0x4055ff){_0x224834=_0x224834-0x0;var _0x376e50=_0xd68c[_0x224834];return _0x376e50;};'use strict';var _=require(_0xcd68('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd68('0x1'));var rs=require(_0xcd68('0x2'));var fs=require('fs');var Redis=require(_0xcd68('0x3'));var db=require(_0xcd68('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd68('0x5'))(_0xcd68('0x6'));var config=require(_0xcd68('0x7'));var jayson=require(_0xcd68('0x8'));var client=jayson[_0xcd68('0x9')][_0xcd68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42ca81,_0x15a7d1,_0x276e73){return new BPromise(function(_0x5e9ed5,_0x8a592e){return client[_0xcd68('0xb')](_0x42ca81,_0x276e73)[_0xcd68('0xc')](function(_0x8402e7){logger[_0xcd68('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x15a7d1,_0xcd68('0xe'));logger[_0xcd68('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x15a7d1,_0xcd68('0xe'),JSON['stringify'](_0x8402e7));if(_0x8402e7[_0xcd68('0x10')]){if(_0x8402e7[_0xcd68('0x10')]['code']===0x1f4){logger[_0xcd68('0x10')](_0xcd68('0x11'),_0x15a7d1,_0x8402e7['error']['message']);return _0x8a592e(_0x8402e7[_0xcd68('0x10')][_0xcd68('0x12')]);}logger[_0xcd68('0x10')](_0xcd68('0x11'),_0x15a7d1,_0x8402e7['error'][_0xcd68('0x12')]);return _0x5e9ed5(_0x8402e7['error'][_0xcd68('0x12')]);}else{logger[_0xcd68('0xd')](_0xcd68('0x11'),_0x15a7d1,_0xcd68('0xe'));_0x5e9ed5(_0x8402e7[_0xcd68('0x13')][_0xcd68('0x12')]);}})['catch'](function(_0x23bac4){logger[_0xcd68('0x10')](_0xcd68('0x11'),_0x15a7d1,_0x23bac4);_0x8a592e(_0x23bac4);});});} \ No newline at end of file +var _0x7fd1=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x291808,_0x643ff8){var _0x5e0dba=function(_0x30fcba){while(--_0x30fcba){_0x291808['push'](_0x291808['shift']());}};_0x5e0dba(++_0x643ff8);}(_0x7fd1,0x6a));var _0x17fd=function(_0x4e3052,_0x51f707){_0x4e3052=_0x4e3052-0x0;var _0x430de1=_0x7fd1[_0x4e3052];return _0x430de1;};'use strict';var _=require(_0x17fd('0x0'));var util=require(_0x17fd('0x1'));var moment=require(_0x17fd('0x2'));var BPromise=require(_0x17fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x17fd('0x5'));var logger=require('../../config/logger')(_0x17fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x17fd('0x7'));var client=jayson[_0x17fd('0x8')][_0x17fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55db38,_0x4bf786,_0x44fe13){return new BPromise(function(_0xedec47,_0x23e925){return client[_0x17fd('0xa')](_0x55db38,_0x44fe13)[_0x17fd('0xb')](function(_0x29224b){logger['info'](_0x17fd('0xc'),_0x4bf786,_0x17fd('0xd'));logger[_0x17fd('0xe')](_0x17fd('0xf'),_0x4bf786,_0x17fd('0xd'),JSON['stringify'](_0x29224b));if(_0x29224b[_0x17fd('0x10')]){if(_0x29224b['error'][_0x17fd('0x11')]===0x1f4){logger[_0x17fd('0x10')](_0x17fd('0xc'),_0x4bf786,_0x29224b['error']['message']);return _0x23e925(_0x29224b['error'][_0x17fd('0x12')]);}logger[_0x17fd('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4bf786,_0x29224b[_0x17fd('0x10')][_0x17fd('0x12')]);return _0xedec47(_0x29224b[_0x17fd('0x10')][_0x17fd('0x12')]);}else{logger['info'](_0x17fd('0xc'),_0x4bf786,_0x17fd('0xd'));_0xedec47(_0x29224b[_0x17fd('0x13')][_0x17fd('0x12')]);}})['catch'](function(_0xcf159c){logger[_0x17fd('0x10')](_0x17fd('0xc'),_0x4bf786,_0xcf159c);_0x23e925(_0xcf159c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a5e9550..b5e8ff3 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 _0x9f6d=['get','isAuthenticated','/:id','post','create','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x315bf4,_0x48ae19){var _0x3a144e=function(_0x4da6aa){while(--_0x4da6aa){_0x315bf4['push'](_0x315bf4['shift']());}};_0x3a144e(++_0x48ae19);}(_0x9f6d,0x1b1));var _0xd9f6=function(_0x54955b,_0x4e5d37){_0x54955b=_0x54955b-0x0;var _0x2226ed=_0x9f6d[_0x54955b];return _0x2226ed;};'use strict';var multer=require('multer');var util=require(_0xd9f6('0x0'));var path=require(_0xd9f6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd9f6('0x2'));var router=express[_0xd9f6('0x3')]();var fs_extra=require(_0xd9f6('0x4'));var auth=require(_0xd9f6('0x5'));var interaction=require(_0xd9f6('0x6'));var config=require(_0xd9f6('0x7'));var controller=require(_0xd9f6('0x8'));router[_0xd9f6('0x9')]('/',auth[_0xd9f6('0xa')](),controller['index']);router['get'](_0xd9f6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd9f6('0xc')]('/',auth['isAuthenticated'](),controller[_0xd9f6('0xd')]);router['put'](_0xd9f6('0xb'),auth['isAuthenticated'](),controller[_0xd9f6('0xe')]);router[_0xd9f6('0xf')](_0xd9f6('0xb'),auth[_0xd9f6('0xa')](),controller['destroy']);module[_0xd9f6('0x10')]=router; \ No newline at end of file +var _0x82d8=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','show','post','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x45ae7b,_0xa7577d){var _0x2298fc=function(_0x4c0922){while(--_0x4c0922){_0x45ae7b['push'](_0x45ae7b['shift']());}};_0x2298fc(++_0xa7577d);}(_0x82d8,0x91));var _0x882d=function(_0x45e8e6,_0x36b307){_0x45e8e6=_0x45e8e6-0x0;var _0xc95b82=_0x82d8[_0x45e8e6];return _0xc95b82;};'use strict';var multer=require(_0x882d('0x0'));var util=require(_0x882d('0x1'));var path=require(_0x882d('0x2'));var timeout=require(_0x882d('0x3'));var express=require(_0x882d('0x4'));var router=express[_0x882d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x882d('0x6'));var interaction=require(_0x882d('0x7'));var config=require(_0x882d('0x8'));var controller=require(_0x882d('0x9'));router[_0x882d('0xa')]('/',auth['isAuthenticated'](),controller[_0x882d('0xb')]);router[_0x882d('0xa')](_0x882d('0xc'),auth['isAuthenticated'](),controller[_0x882d('0xd')]);router[_0x882d('0xe')]('/',auth[_0x882d('0xf')](),controller['create']);router['put'](_0x882d('0xc'),auth[_0x882d('0xf')](),controller[_0x882d('0x10')]);router['delete'](_0x882d('0xc'),auth[_0x882d('0xf')](),controller[_0x882d('0x11')]);module[_0x882d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 4d19701..faaf46a 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 _0x4911=['picklist','string','STRING','sequelize','exports','variable','customVariable','keyValue'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x4911,0xfb));var _0x1491=function(_0x2a4c3a,_0x338cb0){_0x2a4c3a=_0x2a4c3a-0x0;var _0x2f41cb=_0x4911[_0x2a4c3a];return _0x2f41cb;};'use strict';var Sequelize=require(_0x1491('0x0'));module[_0x1491('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1491('0x2'),_0x1491('0x3'),_0x1491('0x4'),_0x1491('0x5')),'defaultValue':_0x1491('0x6')},'content':{'type':Sequelize[_0x1491('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1491('0x6'),'variable',_0x1491('0x3'))},'keyContent':{'type':Sequelize[_0x1491('0x7')]},'idField':{'type':Sequelize[_0x1491('0x7')]},'nameField':{'type':Sequelize[_0x1491('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1491('0x7')]}}; \ No newline at end of file +var _0xd426=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0xd426,0x1b5));var _0x6d42=function(_0x172fbb,_0x29ef71){_0x172fbb=_0x172fbb-0x0;var _0x55789e=_0xd426[_0x172fbb];return _0x55789e;};'use strict';var Sequelize=require(_0x6d42('0x0'));module[_0x6d42('0x1')]={'type':{'type':Sequelize[_0x6d42('0x2')](_0x6d42('0x3'),_0x6d42('0x4'),_0x6d42('0x5'),_0x6d42('0x6'),_0x6d42('0x7')),'defaultValue':_0x6d42('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6d42('0x8')]},'keyType':{'type':Sequelize[_0x6d42('0x2')](_0x6d42('0x3'),_0x6d42('0x4'),_0x6d42('0x5'))},'keyContent':{'type':Sequelize[_0x6d42('0x8')]},'idField':{'type':Sequelize[_0x6d42('0x8')]},'nameField':{'type':Sequelize[_0x6d42('0x8')]},'customField':{'type':Sequelize[_0x6d42('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d42('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 15e24df..bcb979d 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 _0x2b73=['name','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack'];(function(_0x34b215,_0x5f29f6){var _0x2d0323=function(_0x5db618){while(--_0x5db618){_0x34b215['push'](_0x34b215['shift']());}};_0x2d0323(++_0x5f29f6);}(_0x2b73,0x1e0));var _0x32b7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2b73[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x32b7('0x0'));var rimraf=require(_0x32b7('0x1'));var zipdir=require(_0x32b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32b7('0x3'));var moment=require(_0x32b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x32b7('0x5'));var util=require(_0x32b7('0x6'));var path=require(_0x32b7('0x7'));var sox=require('sox');var csv=require(_0x32b7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32b7('0x9'));var _=require(_0x32b7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x32b7('0xb'));var deskjs=require(_0x32b7('0xc'));var toCsv=require(_0x32b7('0x8'));var querystring=require(_0x32b7('0xd'));var Papa=require(_0x32b7('0xe'));var Redis=require('ioredis');var authService=require(_0x32b7('0xf'));var qs=require(_0x32b7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32b7('0x11'));var logger=require(_0x32b7('0x12'))(_0x32b7('0x13'));var utils=require(_0x32b7('0x14'));var config=require(_0x32b7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x32b7('0x16'))['db'];function respondWithStatusCode(_0x299201,_0x2b92ba){_0x2b92ba=_0x2b92ba||0xcc;return function(_0x40e0e7){if(_0x40e0e7){return _0x299201[_0x32b7('0x17')](_0x2b92ba);}return _0x299201[_0x32b7('0x18')](_0x2b92ba)[_0x32b7('0x19')]();};}function respondWithResult(_0x575e98,_0x4b6b63){_0x4b6b63=_0x4b6b63||0xc8;return function(_0x52f726){if(_0x52f726){return _0x575e98[_0x32b7('0x18')](_0x4b6b63)[_0x32b7('0x1a')](_0x52f726);}};}function respondWithFilteredResult(_0x4a434a,_0x3d6d45){return function(_0x295756){if(_0x295756){var _0x58efe6=typeof _0x3d6d45[_0x32b7('0x1b')]===_0x32b7('0x1c')&&typeof _0x3d6d45[_0x32b7('0x1d')]===_0x32b7('0x1c');var _0x2bd6fe=_0x295756[_0x32b7('0x1e')];var _0x13dee3=_0x58efe6?0x0:_0x3d6d45[_0x32b7('0x1b')];var _0x441d77=_0x58efe6?_0x295756[_0x32b7('0x1e')]:_0x3d6d45[_0x32b7('0x1b')]+_0x3d6d45[_0x32b7('0x1d')];var _0xf2d9e8;if(_0x441d77>=_0x2bd6fe){_0x441d77=_0x2bd6fe;_0xf2d9e8=0xc8;}else{_0xf2d9e8=0xce;}_0x4a434a['status'](_0xf2d9e8);return _0x4a434a[_0x32b7('0x1f')](_0x32b7('0x20'),_0x13dee3+'-'+_0x441d77+'/'+_0x2bd6fe)[_0x32b7('0x1a')](_0x295756);}return null;};}function patchUpdates(_0x3d2561){return function(_0x57dfc4){try{jsonpatch[_0x32b7('0x21')](_0x57dfc4,_0x3d2561,!![]);}catch(_0x1dec8e){return BPromise['reject'](_0x1dec8e);}return _0x57dfc4[_0x32b7('0x22')]();};}function saveUpdates(_0x37c6d6,_0x20cba0){return function(_0x35a269){if(_0x35a269){return _0x35a269['update'](_0x37c6d6)['then'](function(_0x2a438c){return _0x2a438c;});}return null;};}function removeEntity(_0x2bd4c9,_0x470184){return function(_0x2d7c7c){if(_0x2d7c7c){return _0x2d7c7c['destroy']()[_0x32b7('0x23')](function(){_0x2bd4c9[_0x32b7('0x18')](0xcc)[_0x32b7('0x19')]();});}};}function handleEntityNotFound(_0x42388c,_0x5bfafc){return function(_0x2747cb){if(!_0x2747cb){_0x42388c[_0x32b7('0x17')](0x194);}return _0x2747cb;};}function handleError(_0x2a4a56,_0x5eca43){_0x5eca43=_0x5eca43||0x1f4;return function(_0x387af5){logger[_0x32b7('0x24')](_0x387af5[_0x32b7('0x25')]);if(_0x387af5[_0x32b7('0x26')]){delete _0x387af5[_0x32b7('0x26')];}_0x2a4a56['status'](_0x5eca43)['send'](_0x387af5);};}exports[_0x32b7('0x27')]=function(_0x26525d,_0x4366bf){var _0x53d853={},_0x48a591={},_0x4d39a1={'count':0x0,'rows':[]};var _0x29e979=_['map'](db[_0x32b7('0x28')][_0x32b7('0x29')],function(_0x95caf6){return{'name':_0x95caf6[_0x32b7('0x2a')],'type':_0x95caf6[_0x32b7('0x2b')][_0x32b7('0x2c')]};});_0x48a591[_0x32b7('0x2d')]=_[_0x32b7('0x2e')](_0x29e979,_0x32b7('0x26'));_0x48a591[_0x32b7('0x2f')]=_[_0x32b7('0x30')](_0x26525d[_0x32b7('0x2f')]);_0x48a591[_0x32b7('0x31')]=_[_0x32b7('0x32')](_0x48a591['model'],_0x48a591[_0x32b7('0x2f')]);_0x53d853[_0x32b7('0x33')]=_[_0x32b7('0x32')](_0x48a591[_0x32b7('0x2d')],qs[_0x32b7('0x34')](_0x26525d[_0x32b7('0x2f')][_0x32b7('0x34')]));_0x53d853[_0x32b7('0x33')]=_0x53d853[_0x32b7('0x33')][_0x32b7('0x35')]?_0x53d853[_0x32b7('0x33')]:_0x48a591[_0x32b7('0x2d')];if(!_0x26525d[_0x32b7('0x2f')]['hasOwnProperty']('nolimit')){_0x53d853[_0x32b7('0x1d')]=qs[_0x32b7('0x1d')](_0x26525d[_0x32b7('0x2f')][_0x32b7('0x1d')]);_0x53d853['offset']=qs['offset'](_0x26525d['query'][_0x32b7('0x1b')]);}_0x53d853[_0x32b7('0x36')]=qs[_0x32b7('0x37')](_0x26525d['query'][_0x32b7('0x37')]);_0x53d853[_0x32b7('0x38')]=qs['filters'](_[_0x32b7('0x39')](_0x26525d[_0x32b7('0x2f')],_0x48a591[_0x32b7('0x31')]),_0x29e979);if(_0x26525d['query'][_0x32b7('0x3a')]){_0x53d853[_0x32b7('0x38')]=_[_0x32b7('0x3b')](_0x53d853[_0x32b7('0x38')],{'$or':_[_0x32b7('0x2e')](_0x29e979,function(_0x24a210){if(_0x24a210[_0x32b7('0x2b')]!==_0x32b7('0x3c')){var _0x3124bc={};_0x3124bc[_0x24a210[_0x32b7('0x26')]]={'$like':'%'+_0x26525d['query'][_0x32b7('0x3a')]+'%'};return _0x3124bc;}})});}_0x53d853=_[_0x32b7('0x3b')]({},_0x53d853,_0x26525d['options']);var _0x2f1b83={'where':_0x53d853['where']};return db[_0x32b7('0x28')]['count'](_0x2f1b83)[_0x32b7('0x23')](function(_0x1984f2){_0x4d39a1['count']=_0x1984f2;if(_0x26525d[_0x32b7('0x2f')][_0x32b7('0x3d')]){_0x53d853[_0x32b7('0x3e')]=[{'all':!![]}];}return db[_0x32b7('0x28')][_0x32b7('0x3f')](_0x53d853);})['then'](function(_0x5b394e){_0x4d39a1[_0x32b7('0x40')]=_0x5b394e;return _0x4d39a1;})['then'](respondWithFilteredResult(_0x4366bf,_0x53d853))[_0x32b7('0x41')](handleError(_0x4366bf,null));};exports[_0x32b7('0x42')]=function(_0x41bff1,_0x43f7ea){var _0x3a564d={'raw':!![],'where':{'id':_0x41bff1[_0x32b7('0x43')]['id']}},_0x247eff={};_0x247eff[_0x32b7('0x2d')]=_[_0x32b7('0x30')](db[_0x32b7('0x28')][_0x32b7('0x29')]);_0x247eff['query']=_[_0x32b7('0x30')](_0x41bff1[_0x32b7('0x2f')]);_0x247eff['filters']=_['intersection'](_0x247eff[_0x32b7('0x2d')],_0x247eff[_0x32b7('0x2f')]);_0x3a564d[_0x32b7('0x33')]=_[_0x32b7('0x32')](_0x247eff[_0x32b7('0x2d')],qs[_0x32b7('0x34')](_0x41bff1[_0x32b7('0x2f')][_0x32b7('0x34')]));_0x3a564d['attributes']=_0x3a564d['attributes'][_0x32b7('0x35')]?_0x3a564d[_0x32b7('0x33')]:_0x247eff[_0x32b7('0x2d')];if(_0x41bff1['query'][_0x32b7('0x3d')]){_0x3a564d[_0x32b7('0x3e')]=[{'all':!![]}];}_0x3a564d=_[_0x32b7('0x3b')]({},_0x3a564d,_0x41bff1[_0x32b7('0x44')]);return db[_0x32b7('0x28')][_0x32b7('0x45')](_0x3a564d)[_0x32b7('0x23')](handleEntityNotFound(_0x43f7ea,null))[_0x32b7('0x23')](respondWithResult(_0x43f7ea,null))[_0x32b7('0x41')](handleError(_0x43f7ea,null));};exports['create']=function(_0xefa00e,_0x525f2a){return db[_0x32b7('0x28')][_0x32b7('0x46')](_0xefa00e[_0x32b7('0x47')],{})[_0x32b7('0x23')](respondWithResult(_0x525f2a,0xc9))[_0x32b7('0x41')](handleError(_0x525f2a,null));};exports[_0x32b7('0x48')]=function(_0x4094ef,_0x49cc8d){if(_0x4094ef[_0x32b7('0x47')]['id']){delete _0x4094ef[_0x32b7('0x47')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x4094ef[_0x32b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x49cc8d,null))[_0x32b7('0x23')](saveUpdates(_0x4094ef['body'],null))[_0x32b7('0x23')](respondWithResult(_0x49cc8d,null))[_0x32b7('0x41')](handleError(_0x49cc8d,null));};exports[_0x32b7('0x49')]=function(_0x2d962a,_0x59cc80){return db[_0x32b7('0x28')][_0x32b7('0x45')]({'where':{'id':_0x2d962a[_0x32b7('0x43')]['id']}})[_0x32b7('0x23')](handleEntityNotFound(_0x59cc80,null))[_0x32b7('0x23')](removeEntity(_0x59cc80,null))[_0x32b7('0x41')](handleError(_0x59cc80,null));}; \ No newline at end of file +var _0x8cae=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x1bce27,_0x468041){var _0x18747d=function(_0x1e2f93){while(--_0x1e2f93){_0x1bce27['push'](_0x1bce27['shift']());}};_0x18747d(++_0x468041);}(_0x8cae,0x169));var _0xe8ca=function(_0x21d6d0,_0x3d3f10){_0x21d6d0=_0x21d6d0-0x0;var _0xcceb2f=_0x8cae[_0x21d6d0];return _0xcceb2f;};'use strict';var emlformat=require(_0xe8ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8ca('0x1'));var jsonpatch=require(_0xe8ca('0x2'));var rp=require(_0xe8ca('0x3'));var moment=require(_0xe8ca('0x4'));var BPromise=require(_0xe8ca('0x5'));var Mustache=require(_0xe8ca('0x6'));var util=require(_0xe8ca('0x7'));var path=require(_0xe8ca('0x8'));var sox=require(_0xe8ca('0x9'));var csv=require(_0xe8ca('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8ca('0xb'));var _=require(_0xe8ca('0xc'));var squel=require(_0xe8ca('0xd'));var crypto=require(_0xe8ca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe8ca('0xf'));var toCsv=require(_0xe8ca('0xa'));var querystring=require(_0xe8ca('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe8ca('0x11'));var qs=require(_0xe8ca('0x12'));var as=require(_0xe8ca('0x13'));var hardwareService=require(_0xe8ca('0x14'));var logger=require(_0xe8ca('0x15'))('api');var utils=require(_0xe8ca('0x16'));var config=require(_0xe8ca('0x17'));var licenseUtil=require(_0xe8ca('0x18'));var db=require(_0xe8ca('0x19'))['db'];function respondWithStatusCode(_0x10c059,_0x747687){_0x747687=_0x747687||0xcc;return function(_0x578841){if(_0x578841){return _0x10c059[_0xe8ca('0x1a')](_0x747687);}return _0x10c059[_0xe8ca('0x1b')](_0x747687)[_0xe8ca('0x1c')]();};}function respondWithResult(_0x377e24,_0x4cbb28){_0x4cbb28=_0x4cbb28||0xc8;return function(_0x26f9e6){if(_0x26f9e6){return _0x377e24[_0xe8ca('0x1b')](_0x4cbb28)['json'](_0x26f9e6);}};}function respondWithFilteredResult(_0x46467d,_0x4f60cc){return function(_0x5a17dd){if(_0x5a17dd){var _0x33508d=typeof _0x4f60cc[_0xe8ca('0x1d')]==='undefined'&&typeof _0x4f60cc['limit']===_0xe8ca('0x1e');var _0x2364b5=_0x5a17dd[_0xe8ca('0x1f')];var _0x138c5d=_0x33508d?0x0:_0x4f60cc[_0xe8ca('0x1d')];var _0x4556b9=_0x33508d?_0x5a17dd[_0xe8ca('0x1f')]:_0x4f60cc['offset']+_0x4f60cc[_0xe8ca('0x20')];var _0x5da0d2;if(_0x4556b9>=_0x2364b5){_0x4556b9=_0x2364b5;_0x5da0d2=0xc8;}else{_0x5da0d2=0xce;}_0x46467d[_0xe8ca('0x1b')](_0x5da0d2);return _0x46467d[_0xe8ca('0x21')](_0xe8ca('0x22'),_0x138c5d+'-'+_0x4556b9+'/'+_0x2364b5)[_0xe8ca('0x23')](_0x5a17dd);}return null;};}function patchUpdates(_0x2e879a){return function(_0x1c623d){try{jsonpatch['apply'](_0x1c623d,_0x2e879a,!![]);}catch(_0x55e18d){return BPromise[_0xe8ca('0x24')](_0x55e18d);}return _0x1c623d[_0xe8ca('0x25')]();};}function saveUpdates(_0x6670bf,_0x505975){return function(_0x2ae084){if(_0x2ae084){return _0x2ae084[_0xe8ca('0x26')](_0x6670bf)[_0xe8ca('0x27')](function(_0x11b143){return _0x11b143;});}return null;};}function removeEntity(_0x308b25,_0x17217c){return function(_0x51370e){if(_0x51370e){return _0x51370e[_0xe8ca('0x28')]()[_0xe8ca('0x27')](function(){_0x308b25[_0xe8ca('0x1b')](0xcc)[_0xe8ca('0x1c')]();});}};}function handleEntityNotFound(_0x598eca,_0x348baf){return function(_0x1bde2d){if(!_0x1bde2d){_0x598eca[_0xe8ca('0x1a')](0x194);}return _0x1bde2d;};}function handleError(_0xd5c97b,_0x5aee28){_0x5aee28=_0x5aee28||0x1f4;return function(_0x52f958){logger[_0xe8ca('0x29')](_0x52f958[_0xe8ca('0x2a')]);if(_0x52f958['name']){delete _0x52f958[_0xe8ca('0x2b')];}_0xd5c97b[_0xe8ca('0x1b')](_0x5aee28)[_0xe8ca('0x2c')](_0x52f958);};}exports['index']=function(_0x40d4c1,_0x1e3659){var _0x4f4455={},_0x2fa269={},_0x32cc82={'count':0x0,'rows':[]};var _0x3c5532=_['map'](db[_0xe8ca('0x2d')][_0xe8ca('0x2e')],function(_0x55e186){return{'name':_0x55e186[_0xe8ca('0x2f')],'type':_0x55e186[_0xe8ca('0x30')][_0xe8ca('0x31')]};});_0x2fa269['model']=_[_0xe8ca('0x32')](_0x3c5532,_0xe8ca('0x2b'));_0x2fa269[_0xe8ca('0x33')]=_[_0xe8ca('0x34')](_0x40d4c1[_0xe8ca('0x33')]);_0x2fa269[_0xe8ca('0x35')]=_[_0xe8ca('0x36')](_0x2fa269[_0xe8ca('0x37')],_0x2fa269[_0xe8ca('0x33')]);_0x4f4455[_0xe8ca('0x38')]=_[_0xe8ca('0x36')](_0x2fa269['model'],qs[_0xe8ca('0x39')](_0x40d4c1[_0xe8ca('0x33')][_0xe8ca('0x39')]));_0x4f4455[_0xe8ca('0x38')]=_0x4f4455['attributes'][_0xe8ca('0x3a')]?_0x4f4455[_0xe8ca('0x38')]:_0x2fa269[_0xe8ca('0x37')];if(!_0x40d4c1[_0xe8ca('0x33')][_0xe8ca('0x3b')]('nolimit')){_0x4f4455['limit']=qs['limit'](_0x40d4c1[_0xe8ca('0x33')][_0xe8ca('0x20')]);_0x4f4455[_0xe8ca('0x1d')]=qs[_0xe8ca('0x1d')](_0x40d4c1[_0xe8ca('0x33')]['offset']);}_0x4f4455[_0xe8ca('0x3c')]=qs[_0xe8ca('0x3d')](_0x40d4c1[_0xe8ca('0x33')]['sort']);_0x4f4455[_0xe8ca('0x3e')]=qs['filters'](_[_0xe8ca('0x3f')](_0x40d4c1['query'],_0x2fa269[_0xe8ca('0x35')]),_0x3c5532);if(_0x40d4c1[_0xe8ca('0x33')]['filter']){_0x4f4455[_0xe8ca('0x3e')]=_['merge'](_0x4f4455[_0xe8ca('0x3e')],{'$or':_[_0xe8ca('0x32')](_0x3c5532,function(_0x51c381){if(_0x51c381[_0xe8ca('0x30')]!==_0xe8ca('0x40')){var _0x2ecfed={};_0x2ecfed[_0x51c381[_0xe8ca('0x2b')]]={'$like':'%'+_0x40d4c1[_0xe8ca('0x33')][_0xe8ca('0x41')]+'%'};return _0x2ecfed;}})});}_0x4f4455=_[_0xe8ca('0x42')]({},_0x4f4455,_0x40d4c1[_0xe8ca('0x43')]);var _0x1dabde={'where':_0x4f4455[_0xe8ca('0x3e')]};return db[_0xe8ca('0x2d')][_0xe8ca('0x1f')](_0x1dabde)[_0xe8ca('0x27')](function(_0x3e8f9a){_0x32cc82[_0xe8ca('0x1f')]=_0x3e8f9a;if(_0x40d4c1[_0xe8ca('0x33')]['includeAll']){_0x4f4455[_0xe8ca('0x44')]=[{'all':!![]}];}return db[_0xe8ca('0x2d')][_0xe8ca('0x45')](_0x4f4455);})[_0xe8ca('0x27')](function(_0x52119c){_0x32cc82[_0xe8ca('0x46')]=_0x52119c;return _0x32cc82;})[_0xe8ca('0x27')](respondWithFilteredResult(_0x1e3659,_0x4f4455))[_0xe8ca('0x47')](handleError(_0x1e3659,null));};exports['show']=function(_0x42a67f,_0x308015){var _0x53f4e4={'raw':!![],'where':{'id':_0x42a67f[_0xe8ca('0x48')]['id']}},_0x1a4b99={};_0x1a4b99[_0xe8ca('0x37')]=_[_0xe8ca('0x34')](db[_0xe8ca('0x2d')][_0xe8ca('0x2e')]);_0x1a4b99[_0xe8ca('0x33')]=_[_0xe8ca('0x34')](_0x42a67f[_0xe8ca('0x33')]);_0x1a4b99['filters']=_[_0xe8ca('0x36')](_0x1a4b99[_0xe8ca('0x37')],_0x1a4b99[_0xe8ca('0x33')]);_0x53f4e4[_0xe8ca('0x38')]=_['intersection'](_0x1a4b99[_0xe8ca('0x37')],qs[_0xe8ca('0x39')](_0x42a67f[_0xe8ca('0x33')][_0xe8ca('0x39')]));_0x53f4e4[_0xe8ca('0x38')]=_0x53f4e4['attributes'][_0xe8ca('0x3a')]?_0x53f4e4[_0xe8ca('0x38')]:_0x1a4b99['model'];if(_0x42a67f['query'][_0xe8ca('0x49')]){_0x53f4e4[_0xe8ca('0x44')]=[{'all':!![]}];}_0x53f4e4=_['merge']({},_0x53f4e4,_0x42a67f[_0xe8ca('0x43')]);return db[_0xe8ca('0x2d')][_0xe8ca('0x4a')](_0x53f4e4)[_0xe8ca('0x27')](handleEntityNotFound(_0x308015,null))[_0xe8ca('0x27')](respondWithResult(_0x308015,null))[_0xe8ca('0x47')](handleError(_0x308015,null));};exports[_0xe8ca('0x4b')]=function(_0x58f0ea,_0x18e991){return db['ServicenowField'][_0xe8ca('0x4b')](_0x58f0ea[_0xe8ca('0x4c')],{})[_0xe8ca('0x27')](respondWithResult(_0x18e991,0xc9))[_0xe8ca('0x47')](handleError(_0x18e991,null));};exports[_0xe8ca('0x26')]=function(_0x351914,_0x57aac1){if(_0x351914[_0xe8ca('0x4c')]['id']){delete _0x351914[_0xe8ca('0x4c')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x351914['params']['id']}})[_0xe8ca('0x27')](handleEntityNotFound(_0x57aac1,null))[_0xe8ca('0x27')](saveUpdates(_0x351914[_0xe8ca('0x4c')],null))[_0xe8ca('0x27')](respondWithResult(_0x57aac1,null))[_0xe8ca('0x47')](handleError(_0x57aac1,null));};exports[_0xe8ca('0x28')]=function(_0x106b0b,_0x24b49a){return db['ServicenowField'][_0xe8ca('0x4a')]({'where':{'id':_0x106b0b[_0xe8ca('0x48')]['id']}})[_0xe8ca('0x27')](handleEntityNotFound(_0x24b49a,null))[_0xe8ca('0x27')](removeEntity(_0x24b49a,null))[_0xe8ca('0x47')](handleError(_0x24b49a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 7122907..4b4e4cc 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 _0x65af=['request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5aada8,_0x460a35){var _0xf5247e=function(_0x507709){while(--_0x507709){_0x5aada8['push'](_0x5aada8['shift']());}};_0xf5247e(++_0x460a35);}(_0x65af,0x6a));var _0xf65a=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x65af[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0xf65a('0x0'));var util=require(_0xf65a('0x1'));var logger=require(_0xf65a('0x2'))(_0xf65a('0x3'));var moment=require(_0xf65a('0x4'));var BPromise=require(_0xf65a('0x5'));var rp=require(_0xf65a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf65a('0x7'));var config=require(_0xf65a('0x8'));var attributes=require(_0xf65a('0x9'));module[_0xf65a('0xa')]=function(_0x3d29fb,_0x263042){return _0x3d29fb[_0xf65a('0xb')](_0xf65a('0xc'),attributes,{'tableName':_0xf65a('0xd'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xf65a('0xe'),_0xf65a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed83=['./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x252479,_0x1a990c){var _0x2501eb=function(_0x3d0d21){while(--_0x3d0d21){_0x252479['push'](_0x252479['shift']());}};_0x2501eb(++_0x1a990c);}(_0xed83,0xf5));var _0x3ed8=function(_0x4fd375,_0x5b255c){_0x4fd375=_0x4fd375-0x0;var _0x3f74e8=_0xed83[_0x4fd375];return _0x3f74e8;};'use strict';var _=require(_0x3ed8('0x0'));var util=require(_0x3ed8('0x1'));var logger=require(_0x3ed8('0x2'))(_0x3ed8('0x3'));var moment=require(_0x3ed8('0x4'));var BPromise=require(_0x3ed8('0x5'));var rp=require(_0x3ed8('0x6'));var fs=require('fs');var path=require(_0x3ed8('0x7'));var rimraf=require(_0x3ed8('0x8'));var config=require(_0x3ed8('0x9'));var attributes=require(_0x3ed8('0xa'));module[_0x3ed8('0xb')]=function(_0x57907f,_0x47b74c){return _0x57907f[_0x3ed8('0xc')](_0x3ed8('0xd'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x3ed8('0xe'),'fields':[_0x3ed8('0xf'),_0x3ed8('0x10')],'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 de8f6aa..33484c9 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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5dd148,_0x18df25){var _0x55f40e=function(_0x14ba33){while(--_0x14ba33){_0x5dd148['push'](_0x5dd148['shift']());}};_0x55f40e(++_0x18df25);}(_0x70e0,0x17b));var _0x070e=function(_0x9ebe91,_0x464a9c){_0x9ebe91=_0x9ebe91-0x0;var _0x4a35ff=_0x70e0[_0x9ebe91];return _0x4a35ff;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x401821,_0x4f1094){var _0x3bbd50=function(_0x267b7c){while(--_0x267b7c){_0x401821['push'](_0x401821['shift']());}};_0x3bbd50(++_0x4f1094);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1ae8e8,_0x348d6e){_0x1ae8e8=_0x1ae8e8-0x0;var _0x3ea443=_0xf4eb[_0x1ae8e8];return _0x3ea443;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ed0e318..e3bda1b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5f274f,_0x1b4104){var _0x470ddd=function(_0x41de46){while(--_0x41de46){_0x5f274f['push'](_0x5f274f['shift']());}};_0x470ddd(++_0x1b4104);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x4aebc4,_0xd9b259){var _0x493557=function(_0x4aa241){while(--_0x4aa241){_0x4aebc4['push'](_0x4aebc4['shift']());}};_0x493557(++_0xd9b259);}(_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('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 b64014b..686e8bd 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(_0x40e427,_0x29f7c9){var _0x81d83e=function(_0x538022){while(--_0x538022){_0x40e427['push'](_0x40e427['shift']());}};_0x81d83e(++_0x29f7c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x44a291,_0x912387){var _0x435870=function(_0x140fee){while(--_0x140fee){_0x44a291['push'](_0x44a291['shift']());}};_0x435870(++_0x912387);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 e049031..bafceb5 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 _0xea6f=['update','then','end','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','rows','catch','show','keys','includeAll','include','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','stringify','Calls','values','remove','endsWith','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x5528bc,_0x3fbeca){var _0x592eea=function(_0x3a2801){while(--_0x3a2801){_0x5528bc['push'](_0x5528bc['shift']());}};_0x592eea(++_0x3fbeca);}(_0xea6f,0x12c));var _0xfea6=function(_0x57fa58,_0x35d075){_0x57fa58=_0x57fa58-0x0;var _0x5747d8=_0xea6f[_0x57fa58];return _0x5747d8;};'use strict';var emlformat=require(_0xfea6('0x0'));var rimraf=require(_0xfea6('0x1'));var zipdir=require(_0xfea6('0x2'));var jsonpatch=require(_0xfea6('0x3'));var rp=require(_0xfea6('0x4'));var moment=require(_0xfea6('0x5'));var BPromise=require(_0xfea6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfea6('0x7'));var sox=require(_0xfea6('0x8'));var csv=require(_0xfea6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfea6('0xa'));var _=require(_0xfea6('0xb'));var squel=require(_0xfea6('0xc'));var crypto=require('crypto');var jsforce=require(_0xfea6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfea6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfea6('0xf'));var as=require(_0xfea6('0x10'));var hardwareService=require(_0xfea6('0x11'));var logger=require(_0xfea6('0x12'))(_0xfea6('0x13'));var utils=require(_0xfea6('0x14'));var config=require(_0xfea6('0x15'));var licenseUtil=require(_0xfea6('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53e3c1,_0x1ec3c6){_0x1ec3c6=_0x1ec3c6||0xcc;return function(_0x190f59){if(_0x190f59){return _0x53e3c1['sendStatus'](_0x1ec3c6);}return _0x53e3c1[_0xfea6('0x17')](_0x1ec3c6)['end']();};}function respondWithResult(_0x195705,_0x7f086c){_0x7f086c=_0x7f086c||0xc8;return function(_0x1740ff){if(_0x1740ff){return _0x195705[_0xfea6('0x17')](_0x7f086c)[_0xfea6('0x18')](_0x1740ff);}};}function respondWithFilteredResult(_0x40fa93,_0x34b788){return function(_0x3d2d0e){if(_0x3d2d0e){var _0x17a29d=typeof _0x34b788[_0xfea6('0x19')]===_0xfea6('0x1a')&&typeof _0x34b788[_0xfea6('0x1b')]==='undefined';var _0x2ee349=_0x3d2d0e[_0xfea6('0x1c')];var _0x22a2a4=_0x17a29d?0x0:_0x34b788[_0xfea6('0x19')];var _0x4567d3=_0x17a29d?_0x3d2d0e[_0xfea6('0x1c')]:_0x34b788[_0xfea6('0x19')]+_0x34b788[_0xfea6('0x1b')];var _0x4d0e26;if(_0x4567d3>=_0x2ee349){_0x4567d3=_0x2ee349;_0x4d0e26=0xc8;}else{_0x4d0e26=0xce;}_0x40fa93[_0xfea6('0x17')](_0x4d0e26);return _0x40fa93['set'](_0xfea6('0x1d'),_0x22a2a4+'-'+_0x4567d3+'/'+_0x2ee349)[_0xfea6('0x18')](_0x3d2d0e);}return null;};}function patchUpdates(_0x5b2e9c){return function(_0x24fed9){try{jsonpatch[_0xfea6('0x1e')](_0x24fed9,_0x5b2e9c,!![]);}catch(_0xf085bc){return BPromise[_0xfea6('0x1f')](_0xf085bc);}return _0x24fed9[_0xfea6('0x20')]();};}function saveUpdates(_0x4fbcb8,_0x18b12f){return function(_0x2fde53){if(_0x2fde53){return _0x2fde53[_0xfea6('0x21')](_0x4fbcb8)[_0xfea6('0x22')](function(_0x1e3a21){return _0x1e3a21;});}return null;};}function removeEntity(_0x35cdce,_0x391bb3){return function(_0x98fa0){if(_0x98fa0){return _0x98fa0['destroy']()[_0xfea6('0x22')](function(){_0x35cdce[_0xfea6('0x17')](0xcc)[_0xfea6('0x23')]();});}};}function handleEntityNotFound(_0x28a877,_0x326667){return function(_0x324572){if(!_0x324572){_0x28a877['sendStatus'](0x194);}return _0x324572;};}function handleError(_0x12d7f4,_0x2fa467){_0x2fa467=_0x2fa467||0x1f4;return function(_0x434171){logger[_0xfea6('0x24')](_0x434171[_0xfea6('0x25')]);if(_0x434171[_0xfea6('0x26')]){delete _0x434171[_0xfea6('0x26')];}_0x12d7f4[_0xfea6('0x17')](_0x2fa467)[_0xfea6('0x27')](_0x434171);};}exports[_0xfea6('0x28')]=function(_0x236907,_0x4e040e){var _0x197fb1={},_0x25350d={},_0x50e542={'count':0x0,'rows':[]};var _0x58d74a=_['map'](db[_0xfea6('0x29')][_0xfea6('0x2a')],function(_0x47bd3e){return{'name':_0x47bd3e[_0xfea6('0x2b')],'type':_0x47bd3e[_0xfea6('0x2c')][_0xfea6('0x2d')]};});_0x25350d[_0xfea6('0x2e')]=_[_0xfea6('0x2f')](_0x58d74a,_0xfea6('0x26'));_0x25350d[_0xfea6('0x30')]=_['keys'](_0x236907[_0xfea6('0x30')]);_0x25350d[_0xfea6('0x31')]=_['intersection'](_0x25350d['model'],_0x25350d[_0xfea6('0x30')]);_0x197fb1['attributes']=_[_0xfea6('0x32')](_0x25350d[_0xfea6('0x2e')],qs['fields'](_0x236907[_0xfea6('0x30')][_0xfea6('0x33')]));_0x197fb1[_0xfea6('0x34')]=_0x197fb1['attributes'][_0xfea6('0x35')]?_0x197fb1[_0xfea6('0x34')]:_0x25350d[_0xfea6('0x2e')];if(!_0x236907[_0xfea6('0x30')][_0xfea6('0x36')](_0xfea6('0x37'))){_0x197fb1[_0xfea6('0x1b')]=qs[_0xfea6('0x1b')](_0x236907[_0xfea6('0x30')]['limit']);_0x197fb1[_0xfea6('0x19')]=qs['offset'](_0x236907[_0xfea6('0x30')][_0xfea6('0x19')]);}_0x197fb1[_0xfea6('0x38')]=qs[_0xfea6('0x39')](_0x236907[_0xfea6('0x30')]['sort']);_0x197fb1[_0xfea6('0x3a')]=qs[_0xfea6('0x31')](_['pick'](_0x236907[_0xfea6('0x30')],_0x25350d[_0xfea6('0x31')]),_0x58d74a);if(_0x236907['query'][_0xfea6('0x3b')]){_0x197fb1[_0xfea6('0x3a')]=_['merge'](_0x197fb1[_0xfea6('0x3a')],{'$or':_[_0xfea6('0x2f')](_0x58d74a,function(_0x3b1578){if(_0x3b1578[_0xfea6('0x2c')]!=='VIRTUAL'){var _0x4e1e91={};_0x4e1e91[_0x3b1578['name']]={'$like':'%'+_0x236907[_0xfea6('0x30')][_0xfea6('0x3b')]+'%'};return _0x4e1e91;}})});}_0x197fb1=_[_0xfea6('0x3c')]({},_0x197fb1,_0x236907[_0xfea6('0x3d')]);var _0x28c2f0={'where':_0x197fb1[_0xfea6('0x3a')]};return db[_0xfea6('0x29')][_0xfea6('0x1c')](_0x28c2f0)[_0xfea6('0x22')](function(_0x57e77f){_0x50e542[_0xfea6('0x1c')]=_0x57e77f;if(_0x236907['query']['includeAll']){_0x197fb1['include']=[{'all':!![]}];}return db[_0xfea6('0x29')]['findAll'](_0x197fb1);})[_0xfea6('0x22')](function(_0x3a8bd9){_0x50e542[_0xfea6('0x3e')]=_0x3a8bd9;return _0x50e542;})['then'](respondWithFilteredResult(_0x4e040e,_0x197fb1))[_0xfea6('0x3f')](handleError(_0x4e040e,null));};exports[_0xfea6('0x40')]=function(_0x15ea33,_0xc64da9){var _0x50a076={'raw':![],'where':{'id':_0x15ea33['params']['id']}},_0x4e71f5={};_0x4e71f5[_0xfea6('0x2e')]=_[_0xfea6('0x41')](db['SugarcrmAccount']['rawAttributes']);_0x4e71f5[_0xfea6('0x30')]=_[_0xfea6('0x41')](_0x15ea33[_0xfea6('0x30')]);_0x4e71f5[_0xfea6('0x31')]=_[_0xfea6('0x32')](_0x4e71f5[_0xfea6('0x2e')],_0x4e71f5[_0xfea6('0x30')]);_0x50a076['attributes']=_[_0xfea6('0x32')](_0x4e71f5[_0xfea6('0x2e')],qs[_0xfea6('0x33')](_0x15ea33[_0xfea6('0x30')][_0xfea6('0x33')]));_0x50a076[_0xfea6('0x34')]=_0x50a076[_0xfea6('0x34')]['length']?_0x50a076[_0xfea6('0x34')]:_0x4e71f5[_0xfea6('0x2e')];if(_0x15ea33['query'][_0xfea6('0x42')]){_0x50a076[_0xfea6('0x43')]=[{'all':!![]}];}_0x50a076=_[_0xfea6('0x3c')]({},_0x50a076,_0x15ea33['options']);return db[_0xfea6('0x29')][_0xfea6('0x44')](_0x50a076)[_0xfea6('0x22')](handleEntityNotFound(_0xc64da9,null))['then'](respondWithResult(_0xc64da9,null))['catch'](handleError(_0xc64da9,null));};exports['create']=function(_0x5a1af2,_0x22db20){return db['SugarcrmAccount'][_0xfea6('0x45')](_0x5a1af2[_0xfea6('0x46')],{})['then'](respondWithResult(_0x22db20,0xc9))[_0xfea6('0x3f')](handleError(_0x22db20,null));};exports['update']=function(_0x1e400a,_0x2bb307){if(_0x1e400a[_0xfea6('0x46')]['id']){delete _0x1e400a['body']['id'];}return db['SugarcrmAccount'][_0xfea6('0x44')]({'where':{'id':_0x1e400a[_0xfea6('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bb307,null))[_0xfea6('0x22')](saveUpdates(_0x1e400a[_0xfea6('0x46')],null))[_0xfea6('0x22')](respondWithResult(_0x2bb307,null))['catch'](handleError(_0x2bb307,null));};exports['destroy']=function(_0x3ab435,_0x13e44c){return db[_0xfea6('0x29')]['find']({'where':{'id':_0x3ab435['params']['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x13e44c,null))['then'](removeEntity(_0x13e44c,null))['catch'](handleError(_0x13e44c,null));};exports[_0xfea6('0x48')]=function(_0x57d9c6,_0x40a4a0,_0x1410a3){var _0x4b7624={};var _0x4b5b92={};var _0x33f1be;var _0x4e6dab;return db[_0xfea6('0x29')][_0xfea6('0x49')]({'where':{'id':_0x57d9c6['params']['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x40a4a0,null))[_0xfea6('0x22')](function(_0xe0ac5c){if(_0xe0ac5c){_0x33f1be=_0xe0ac5c;_0x4b5b92['model']=_[_0xfea6('0x41')](db[_0xfea6('0x4a')][_0xfea6('0x2a')]);_0x4b5b92[_0xfea6('0x30')]=_['keys'](_0x57d9c6[_0xfea6('0x30')]);_0x4b5b92[_0xfea6('0x31')]=_[_0xfea6('0x32')](_0x4b5b92[_0xfea6('0x2e')],_0x4b5b92[_0xfea6('0x30')]);_0x4b7624[_0xfea6('0x34')]=_[_0xfea6('0x32')](_0x4b5b92[_0xfea6('0x2e')],qs[_0xfea6('0x33')](_0x57d9c6['query'][_0xfea6('0x33')]));_0x4b7624[_0xfea6('0x34')]=_0x4b7624[_0xfea6('0x34')][_0xfea6('0x35')]?_0x4b7624['attributes']:_0x4b5b92[_0xfea6('0x2e')];_0x4b7624['order']=qs[_0xfea6('0x39')](_0x57d9c6[_0xfea6('0x30')][_0xfea6('0x39')]);_0x4b7624[_0xfea6('0x3a')]=qs['filters'](_['pick'](_0x57d9c6[_0xfea6('0x30')],_0x4b5b92[_0xfea6('0x31')]));if(_0x57d9c6[_0xfea6('0x30')][_0xfea6('0x3b')]){_0x4b7624[_0xfea6('0x3a')]=_['merge'](_0x4b7624[_0xfea6('0x3a')],{'$or':_[_0xfea6('0x2f')](_0x4b7624['attributes'],function(_0x3d90da){var _0x170502={};_0x170502[_0x3d90da]={'$like':'%'+_0x57d9c6[_0xfea6('0x30')][_0xfea6('0x3b')]+'%'};return _0x170502;})});}_0x4b7624=_[_0xfea6('0x3c')]({},_0x4b7624,_0x57d9c6[_0xfea6('0x3d')]);return _0x33f1be['getConfigurations'](_0x4b7624);}})[_0xfea6('0x22')](function(_0x1df75b){if(_0x1df75b){_0x4e6dab=_0x1df75b['length'];if(!_0x57d9c6[_0xfea6('0x30')][_0xfea6('0x36')]('nolimit')){_0x4b7624[_0xfea6('0x1b')]=qs['limit'](_0x57d9c6[_0xfea6('0x30')]['limit']);_0x4b7624[_0xfea6('0x19')]=qs[_0xfea6('0x19')](_0x57d9c6[_0xfea6('0x30')][_0xfea6('0x19')]);}return _0x33f1be['getConfigurations'](_0x4b7624);}})['then'](function(_0x3128d8){if(_0x3128d8){return _0x3128d8?{'count':_0x4e6dab,'rows':_0x3128d8}:null;}})[_0xfea6('0x22')](respondWithResult(_0x40a4a0,null))[_0xfea6('0x3f')](handleError(_0x40a4a0,null));};exports[_0xfea6('0x4b')]=function(_0x1f7bec,_0x1a50b1,_0x506bcf){if(_0x1f7bec[_0xfea6('0x46')]['id']){delete _0x1f7bec[_0xfea6('0x46')]['id'];}return db[_0xfea6('0x29')][_0xfea6('0x49')]({'where':{'id':_0x1f7bec[_0xfea6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a50b1,null))['then'](function(_0x3bc7e9){if(_0x3bc7e9){_0x1f7bec[_0xfea6('0x46')][_0xfea6('0x4c')]=_0x3bc7e9['id'];_0x1f7bec[_0xfea6('0x46')]['Subjects']=integrations['getSubjects'](_0x1f7bec[_0xfea6('0x46')][_0xfea6('0x4d')],_0x1f7bec['body'][_0xfea6('0x2c')]);_0x1f7bec[_0xfea6('0x46')][_0xfea6('0x4e')]=integrations[_0xfea6('0x4f')](_0x1f7bec[_0xfea6('0x46')]['channel'],_0x1f7bec[_0xfea6('0x46')]['type']);return db['SugarcrmConfiguration']['create'](_0x1f7bec[_0xfea6('0x46')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xfea6('0x50')],'as':_0xfea6('0x4e')}]});}return null;})['then'](respondWithResult(_0x1a50b1,null))['catch'](handleError(_0x1a50b1,null));};exports['getFields']=function(_0x2ab2dd,_0x251b13,_0x5b9c27){var _0x57f97d='';var _0x26768a=['id','name',_0xfea6('0x51'),_0xfea6('0x52'),_0xfea6('0x53'),'date_start',_0xfea6('0x54'),_0xfea6('0x55'),_0xfea6('0x56'),_0xfea6('0x57'),_0xfea6('0x58'),_0xfea6('0x59')];return db[_0xfea6('0x29')][_0xfea6('0x49')]({'where':{'id':_0x2ab2dd[_0xfea6('0x47')]['id']},'attributes':['id',_0xfea6('0x5a'),'password','remoteUri']})[_0xfea6('0x22')](handleEntityNotFound(_0x251b13,null))['then'](function(_0xc75767){if(_0xc75767){_0x57f97d=_0xc75767[_0xfea6('0x5b')];var _0x179593=_0x57f97d[_0xfea6('0x5c')](-0x1);if(_0x179593==='/'){_0x57f97d=_0x57f97d[_0xfea6('0x5d')](0x0,_0x57f97d['lastIndexOf'](_0x179593));}return rp({'method':_0xfea6('0x5e'),'uri':util['format'](_0xfea6('0x5f'),_0x57f97d,_0xfea6('0x60')),'json':!![],'form':{'method':'login','input_type':_0xfea6('0x61'),'response_type':_0xfea6('0x61'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xc75767[_0xfea6('0x5a')],'password':_0xc75767['password'],'encryption':_0xfea6('0x62')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xfea6('0x22')](function(_0xda5590){if(_0xda5590&&_0xda5590[_0xfea6('0x26')]!==_0xfea6('0x63')&&_0xda5590[_0xfea6('0x26')]!==_0xfea6('0x64')){return rp({'method':_0xfea6('0x5e'),'uri':util['format'](_0xfea6('0x5f'),_0x57f97d,_0xfea6('0x60')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xfea6('0x61'),'response_type':'JSON','rest_data':JSON[_0xfea6('0x65')]({'session':_0xda5590['id'],'module_name':_0xfea6('0x66')})}})['then'](function(_0x26f123){if(_0x26f123){var _0x138b2b=_[_0xfea6('0x67')](_0x26f123['module_fields']);_[_0xfea6('0x68')](_0x138b2b,function(_0x47602a){return _0x26768a['includes'](_0x47602a['name']);});return{'count':_0x138b2b[_0xfea6('0x35')],'rows':_[_0xfea6('0x2f')](_0x138b2b,function(_0x499dd4){return{'id':_0x499dd4['name'],'name':_0x499dd4['label'],'custom':_[_0xfea6('0x69')](_0x499dd4[_0xfea6('0x26')],'_c')?!![]:![],'options':_0x499dd4[_0xfea6('0x3d')]?_[_0xfea6('0x2f')](_[_0xfea6('0x67')](_0x499dd4[_0xfea6('0x3d')]),function(_0x2d0736){return{'name':_0x2d0736[_0xfea6('0x6a')],'value':_0x2d0736[_0xfea6('0x26')]};}):[]};})};}})[_0xfea6('0x22')](respondWithResult(_0x251b13,null))[_0xfea6('0x3f')](function(_0x51b231){var _0x6375dd=_0x2ab2dd[_0xfea6('0x30')][_0xfea6('0x6b')]?0x1f4:_0x51b231[_0xfea6('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfea6('0x6d'),_0x6375dd,JSON['stringify'](_0x51b231));delete _0x51b231[_0xfea6('0x26')];if(_0x6375dd===0x191){_0x6375dd=0x190;}_0x251b13[_0xfea6('0x17')](_0x6375dd)[_0xfea6('0x27')](_0x2ab2dd[_0xfea6('0x30')][_0xfea6('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x51b231[_0xfea6('0x6c')]}:_0x51b231);});}else{var _0xfafa77=0x1f4;_0x251b13[_0xfea6('0x17')](_0xfafa77)['send']({'message':_0xfea6('0x6e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9bdf=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','model','fields','find','body','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','Calls','values','module_fields','remove','includes','label','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x87dfa0,_0x45360c){var _0x2c59c0=function(_0x5bb726){while(--_0x5bb726){_0x87dfa0['push'](_0x87dfa0['shift']());}};_0x2c59c0(++_0x45360c);}(_0x9bdf,0x1dd));var _0xf9bd=function(_0x50e750,_0x385003){_0x50e750=_0x50e750-0x0;var _0x37893d=_0x9bdf[_0x50e750];return _0x37893d;};'use strict';var emlformat=require(_0xf9bd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf9bd('0x1'));var moment=require('moment');var BPromise=require(_0xf9bd('0x2'));var Mustache=require(_0xf9bd('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf9bd('0x4'));var csv=require(_0xf9bd('0x5'));var ejs=require(_0xf9bd('0x6'));var fs=require('fs');var fs_extra=require(_0xf9bd('0x7'));var _=require('lodash');var squel=require(_0xf9bd('0x8'));var crypto=require(_0xf9bd('0x9'));var jsforce=require(_0xf9bd('0xa'));var deskjs=require(_0xf9bd('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf9bd('0xc'));var Papa=require('papaparse');var Redis=require(_0xf9bd('0xd'));var authService=require(_0xf9bd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf9bd('0xf'));var hardwareService=require(_0xf9bd('0x10'));var logger=require('../../config/logger')(_0xf9bd('0x11'));var utils=require(_0xf9bd('0x12'));var config=require(_0xf9bd('0x13'));var licenseUtil=require(_0xf9bd('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf9bd('0x15'));function respondWithStatusCode(_0x396be5,_0x3db689){_0x3db689=_0x3db689||0xcc;return function(_0x36d90d){if(_0x36d90d){return _0x396be5[_0xf9bd('0x16')](_0x3db689);}return _0x396be5[_0xf9bd('0x17')](_0x3db689)['end']();};}function respondWithResult(_0x549a6a,_0x225ed5){_0x225ed5=_0x225ed5||0xc8;return function(_0xa6f418){if(_0xa6f418){return _0x549a6a[_0xf9bd('0x17')](_0x225ed5)[_0xf9bd('0x18')](_0xa6f418);}};}function respondWithFilteredResult(_0x83bc53,_0x2d8a36){return function(_0x521075){if(_0x521075){var _0xae647e=typeof _0x2d8a36['offset']===_0xf9bd('0x19')&&typeof _0x2d8a36[_0xf9bd('0x1a')]==='undefined';var _0x4bce9b=_0x521075[_0xf9bd('0x1b')];var _0x25c320=_0xae647e?0x0:_0x2d8a36[_0xf9bd('0x1c')];var _0x479706=_0xae647e?_0x521075[_0xf9bd('0x1b')]:_0x2d8a36[_0xf9bd('0x1c')]+_0x2d8a36['limit'];var _0x427f31;if(_0x479706>=_0x4bce9b){_0x479706=_0x4bce9b;_0x427f31=0xc8;}else{_0x427f31=0xce;}_0x83bc53[_0xf9bd('0x17')](_0x427f31);return _0x83bc53[_0xf9bd('0x1d')]('Content-Range',_0x25c320+'-'+_0x479706+'/'+_0x4bce9b)[_0xf9bd('0x18')](_0x521075);}return null;};}function patchUpdates(_0x26a80a){return function(_0x1750d6){try{jsonpatch[_0xf9bd('0x1e')](_0x1750d6,_0x26a80a,!![]);}catch(_0x275333){return BPromise['reject'](_0x275333);}return _0x1750d6[_0xf9bd('0x1f')]();};}function saveUpdates(_0x1229ab,_0x4af235){return function(_0x4edbde){if(_0x4edbde){return _0x4edbde[_0xf9bd('0x20')](_0x1229ab)[_0xf9bd('0x21')](function(_0x23e69e){return _0x23e69e;});}return null;};}function removeEntity(_0x393d3f,_0x46db7f){return function(_0x3d30a8){if(_0x3d30a8){return _0x3d30a8[_0xf9bd('0x22')]()[_0xf9bd('0x21')](function(){_0x393d3f['status'](0xcc)[_0xf9bd('0x23')]();});}};}function handleEntityNotFound(_0x4a05f8,_0x24afd6){return function(_0x12d9e1){if(!_0x12d9e1){_0x4a05f8[_0xf9bd('0x16')](0x194);}return _0x12d9e1;};}function handleError(_0x47b841,_0x4a2ce9){_0x4a2ce9=_0x4a2ce9||0x1f4;return function(_0x5ea686){logger[_0xf9bd('0x24')](_0x5ea686[_0xf9bd('0x25')]);if(_0x5ea686[_0xf9bd('0x26')]){delete _0x5ea686['name'];}_0x47b841[_0xf9bd('0x17')](_0x4a2ce9)[_0xf9bd('0x27')](_0x5ea686);};}exports[_0xf9bd('0x28')]=function(_0x4ca556,_0x13fd34){var _0x235cdd={},_0x47fcc2={},_0x48eb0c={'count':0x0,'rows':[]};var _0x53124b=_[_0xf9bd('0x29')](db[_0xf9bd('0x2a')][_0xf9bd('0x2b')],function(_0x441693){return{'name':_0x441693[_0xf9bd('0x2c')],'type':_0x441693['type'][_0xf9bd('0x2d')]};});_0x47fcc2['model']=_[_0xf9bd('0x29')](_0x53124b,_0xf9bd('0x26'));_0x47fcc2['query']=_[_0xf9bd('0x2e')](_0x4ca556['query']);_0x47fcc2[_0xf9bd('0x2f')]=_[_0xf9bd('0x30')](_0x47fcc2['model'],_0x47fcc2[_0xf9bd('0x31')]);_0x235cdd[_0xf9bd('0x32')]=_[_0xf9bd('0x30')](_0x47fcc2['model'],qs['fields'](_0x4ca556[_0xf9bd('0x31')]['fields']));_0x235cdd[_0xf9bd('0x32')]=_0x235cdd[_0xf9bd('0x32')][_0xf9bd('0x33')]?_0x235cdd['attributes']:_0x47fcc2['model'];if(!_0x4ca556[_0xf9bd('0x31')][_0xf9bd('0x34')](_0xf9bd('0x35'))){_0x235cdd[_0xf9bd('0x1a')]=qs['limit'](_0x4ca556[_0xf9bd('0x31')][_0xf9bd('0x1a')]);_0x235cdd['offset']=qs[_0xf9bd('0x1c')](_0x4ca556['query'][_0xf9bd('0x1c')]);}_0x235cdd[_0xf9bd('0x36')]=qs[_0xf9bd('0x37')](_0x4ca556['query']['sort']);_0x235cdd[_0xf9bd('0x38')]=qs['filters'](_[_0xf9bd('0x39')](_0x4ca556['query'],_0x47fcc2['filters']),_0x53124b);if(_0x4ca556[_0xf9bd('0x31')][_0xf9bd('0x3a')]){_0x235cdd[_0xf9bd('0x38')]=_['merge'](_0x235cdd['where'],{'$or':_['map'](_0x53124b,function(_0x5dc434){if(_0x5dc434[_0xf9bd('0x3b')]!==_0xf9bd('0x3c')){var _0x194716={};_0x194716[_0x5dc434[_0xf9bd('0x26')]]={'$like':'%'+_0x4ca556[_0xf9bd('0x31')][_0xf9bd('0x3a')]+'%'};return _0x194716;}})});}_0x235cdd=_[_0xf9bd('0x3d')]({},_0x235cdd,_0x4ca556[_0xf9bd('0x3e')]);var _0x43b4ba={'where':_0x235cdd['where']};return db[_0xf9bd('0x2a')][_0xf9bd('0x1b')](_0x43b4ba)[_0xf9bd('0x21')](function(_0x240adf){_0x48eb0c[_0xf9bd('0x1b')]=_0x240adf;if(_0x4ca556[_0xf9bd('0x31')][_0xf9bd('0x3f')]){_0x235cdd[_0xf9bd('0x40')]=[{'all':!![]}];}return db[_0xf9bd('0x2a')][_0xf9bd('0x41')](_0x235cdd);})['then'](function(_0x1c345c){_0x48eb0c[_0xf9bd('0x42')]=_0x1c345c;return _0x48eb0c;})['then'](respondWithFilteredResult(_0x13fd34,_0x235cdd))[_0xf9bd('0x43')](handleError(_0x13fd34,null));};exports['show']=function(_0x129447,_0x27c053){var _0x6205f0={'raw':![],'where':{'id':_0x129447['params']['id']}},_0x596b96={};_0x596b96[_0xf9bd('0x44')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x596b96[_0xf9bd('0x31')]=_[_0xf9bd('0x2e')](_0x129447[_0xf9bd('0x31')]);_0x596b96[_0xf9bd('0x2f')]=_['intersection'](_0x596b96[_0xf9bd('0x44')],_0x596b96[_0xf9bd('0x31')]);_0x6205f0[_0xf9bd('0x32')]=_[_0xf9bd('0x30')](_0x596b96[_0xf9bd('0x44')],qs[_0xf9bd('0x45')](_0x129447[_0xf9bd('0x31')]['fields']));_0x6205f0[_0xf9bd('0x32')]=_0x6205f0['attributes'][_0xf9bd('0x33')]?_0x6205f0['attributes']:_0x596b96[_0xf9bd('0x44')];if(_0x129447[_0xf9bd('0x31')]['includeAll']){_0x6205f0[_0xf9bd('0x40')]=[{'all':!![]}];}_0x6205f0=_['merge']({},_0x6205f0,_0x129447[_0xf9bd('0x3e')]);return db[_0xf9bd('0x2a')][_0xf9bd('0x46')](_0x6205f0)[_0xf9bd('0x21')](handleEntityNotFound(_0x27c053,null))[_0xf9bd('0x21')](respondWithResult(_0x27c053,null))['catch'](handleError(_0x27c053,null));};exports['create']=function(_0xd70236,_0x14f2ef){return db['SugarcrmAccount']['create'](_0xd70236[_0xf9bd('0x47')],{})[_0xf9bd('0x21')](respondWithResult(_0x14f2ef,0xc9))[_0xf9bd('0x43')](handleError(_0x14f2ef,null));};exports[_0xf9bd('0x20')]=function(_0x494fd7,_0x562fcf){if(_0x494fd7['body']['id']){delete _0x494fd7[_0xf9bd('0x47')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x494fd7[_0xf9bd('0x48')]['id']}})[_0xf9bd('0x21')](handleEntityNotFound(_0x562fcf,null))['then'](saveUpdates(_0x494fd7[_0xf9bd('0x47')],null))['then'](respondWithResult(_0x562fcf,null))['catch'](handleError(_0x562fcf,null));};exports[_0xf9bd('0x22')]=function(_0x2c4948,_0x26e49a){return db[_0xf9bd('0x2a')][_0xf9bd('0x46')]({'where':{'id':_0x2c4948[_0xf9bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x26e49a,null))['then'](removeEntity(_0x26e49a,null))['catch'](handleError(_0x26e49a,null));};exports[_0xf9bd('0x49')]=function(_0x256238,_0x4113cd,_0x3d6bb1){var _0x36f6a8={};var _0xcd788={};var _0x22d87f;var _0xed7c87;return db[_0xf9bd('0x2a')][_0xf9bd('0x4a')]({'where':{'id':_0x256238[_0xf9bd('0x48')]['id']}})[_0xf9bd('0x21')](handleEntityNotFound(_0x4113cd,null))[_0xf9bd('0x21')](function(_0x3d3ddc){if(_0x3d3ddc){_0x22d87f=_0x3d3ddc;_0xcd788[_0xf9bd('0x44')]=_[_0xf9bd('0x2e')](db[_0xf9bd('0x4b')][_0xf9bd('0x2b')]);_0xcd788[_0xf9bd('0x31')]=_[_0xf9bd('0x2e')](_0x256238[_0xf9bd('0x31')]);_0xcd788[_0xf9bd('0x2f')]=_[_0xf9bd('0x30')](_0xcd788[_0xf9bd('0x44')],_0xcd788[_0xf9bd('0x31')]);_0x36f6a8[_0xf9bd('0x32')]=_[_0xf9bd('0x30')](_0xcd788[_0xf9bd('0x44')],qs[_0xf9bd('0x45')](_0x256238[_0xf9bd('0x31')]['fields']));_0x36f6a8[_0xf9bd('0x32')]=_0x36f6a8[_0xf9bd('0x32')]['length']?_0x36f6a8[_0xf9bd('0x32')]:_0xcd788['model'];_0x36f6a8[_0xf9bd('0x36')]=qs[_0xf9bd('0x37')](_0x256238[_0xf9bd('0x31')][_0xf9bd('0x37')]);_0x36f6a8['where']=qs[_0xf9bd('0x2f')](_[_0xf9bd('0x39')](_0x256238['query'],_0xcd788['filters']));if(_0x256238['query']['filter']){_0x36f6a8[_0xf9bd('0x38')]=_[_0xf9bd('0x3d')](_0x36f6a8[_0xf9bd('0x38')],{'$or':_[_0xf9bd('0x29')](_0x36f6a8[_0xf9bd('0x32')],function(_0x49760b){var _0x1eea96={};_0x1eea96[_0x49760b]={'$like':'%'+_0x256238[_0xf9bd('0x31')][_0xf9bd('0x3a')]+'%'};return _0x1eea96;})});}_0x36f6a8=_[_0xf9bd('0x3d')]({},_0x36f6a8,_0x256238['options']);return _0x22d87f[_0xf9bd('0x49')](_0x36f6a8);}})[_0xf9bd('0x21')](function(_0x1fea61){if(_0x1fea61){_0xed7c87=_0x1fea61[_0xf9bd('0x33')];if(!_0x256238[_0xf9bd('0x31')][_0xf9bd('0x34')](_0xf9bd('0x35'))){_0x36f6a8[_0xf9bd('0x1a')]=qs[_0xf9bd('0x1a')](_0x256238[_0xf9bd('0x31')][_0xf9bd('0x1a')]);_0x36f6a8['offset']=qs[_0xf9bd('0x1c')](_0x256238[_0xf9bd('0x31')][_0xf9bd('0x1c')]);}return _0x22d87f[_0xf9bd('0x49')](_0x36f6a8);}})[_0xf9bd('0x21')](function(_0xd42464){if(_0xd42464){return _0xd42464?{'count':_0xed7c87,'rows':_0xd42464}:null;}})[_0xf9bd('0x21')](respondWithResult(_0x4113cd,null))[_0xf9bd('0x43')](handleError(_0x4113cd,null));};exports[_0xf9bd('0x4c')]=function(_0x30b043,_0x4b9233,_0x59fb20){if(_0x30b043[_0xf9bd('0x47')]['id']){delete _0x30b043[_0xf9bd('0x47')]['id'];}return db[_0xf9bd('0x2a')][_0xf9bd('0x4a')]({'where':{'id':_0x30b043[_0xf9bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b9233,null))['then'](function(_0x287203){if(_0x287203){_0x30b043[_0xf9bd('0x47')][_0xf9bd('0x4d')]=_0x287203['id'];_0x30b043[_0xf9bd('0x47')][_0xf9bd('0x4e')]=integrations[_0xf9bd('0x4f')](_0x30b043[_0xf9bd('0x47')]['channel'],_0x30b043['body']['type']);_0x30b043[_0xf9bd('0x47')][_0xf9bd('0x50')]=integrations[_0xf9bd('0x51')](_0x30b043[_0xf9bd('0x47')][_0xf9bd('0x52')],_0x30b043['body']['type']);return db['SugarcrmConfiguration'][_0xf9bd('0x53')](_0x30b043['body'],{'include':[{'model':db[_0xf9bd('0x54')],'as':'Subjects'},{'model':db[_0xf9bd('0x54')],'as':_0xf9bd('0x50')}]});}return null;})[_0xf9bd('0x21')](respondWithResult(_0x4b9233,null))[_0xf9bd('0x43')](handleError(_0x4b9233,null));};exports[_0xf9bd('0x55')]=function(_0x56702e,_0x339d23,_0x3dd152){var _0x4cab71='';var _0x2bee45=['id',_0xf9bd('0x26'),_0xf9bd('0x56'),_0xf9bd('0x57'),_0xf9bd('0x58'),_0xf9bd('0x59'),_0xf9bd('0x5a'),_0xf9bd('0x5b'),_0xf9bd('0x5c'),_0xf9bd('0x5d'),_0xf9bd('0x5e'),_0xf9bd('0x5f')];return db[_0xf9bd('0x2a')][_0xf9bd('0x4a')]({'where':{'id':_0x56702e[_0xf9bd('0x48')]['id']},'attributes':['id',_0xf9bd('0x60'),_0xf9bd('0x61'),_0xf9bd('0x62')]})[_0xf9bd('0x21')](handleEntityNotFound(_0x339d23,null))['then'](function(_0x485f1e){if(_0x485f1e){_0x4cab71=_0x485f1e[_0xf9bd('0x62')];var _0x159f63=_0x4cab71[_0xf9bd('0x63')](-0x1);if(_0x159f63==='/'){_0x4cab71=_0x4cab71[_0xf9bd('0x64')](0x0,_0x4cab71[_0xf9bd('0x65')](_0x159f63));}return rp({'method':_0xf9bd('0x66'),'uri':util[_0xf9bd('0x67')]('%s%s',_0x4cab71,_0xf9bd('0x68')),'json':!![],'form':{'method':_0xf9bd('0x69'),'input_type':'JSON','response_type':_0xf9bd('0x6a'),'rest_data':JSON[_0xf9bd('0x6b')]({'user_auth':{'user_name':_0x485f1e[_0xf9bd('0x60')],'password':_0x485f1e[_0xf9bd('0x61')],'encryption':'PLAIN'},'application':_0xf9bd('0x6c')})}});}})[_0xf9bd('0x21')](function(_0x16560f){if(_0x16560f&&_0x16560f[_0xf9bd('0x26')]!==_0xf9bd('0x6d')&&_0x16560f[_0xf9bd('0x26')]!==_0xf9bd('0x6e')){return rp({'method':_0xf9bd('0x66'),'uri':util[_0xf9bd('0x67')](_0xf9bd('0x6f'),_0x4cab71,_0xf9bd('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xf9bd('0x6a'),'rest_data':JSON[_0xf9bd('0x6b')]({'session':_0x16560f['id'],'module_name':_0xf9bd('0x70')})}})[_0xf9bd('0x21')](function(_0x153db0){if(_0x153db0){var _0x3d3262=_[_0xf9bd('0x71')](_0x153db0[_0xf9bd('0x72')]);_[_0xf9bd('0x73')](_0x3d3262,function(_0x3974df){return _0x2bee45[_0xf9bd('0x74')](_0x3974df[_0xf9bd('0x26')]);});return{'count':_0x3d3262[_0xf9bd('0x33')],'rows':_[_0xf9bd('0x29')](_0x3d3262,function(_0x80e22a){return{'id':_0x80e22a[_0xf9bd('0x26')],'name':_0x80e22a[_0xf9bd('0x75')],'custom':_['endsWith'](_0x80e22a[_0xf9bd('0x26')],'_c')?!![]:![],'options':_0x80e22a['options']?_[_0xf9bd('0x29')](_[_0xf9bd('0x71')](_0x80e22a['options']),function(_0x139fea){return{'name':_0x139fea[_0xf9bd('0x76')],'value':_0x139fea[_0xf9bd('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x339d23,null))[_0xf9bd('0x43')](function(_0x3ab40c){var _0x40ec1d=_0x56702e[_0xf9bd('0x31')][_0xf9bd('0x77')]?0x1f4:_0x3ab40c['statusCode']||0x1f4;logger[_0xf9bd('0x24')](_0xf9bd('0x78'),_0xf9bd('0x55'),_0x40ec1d,JSON['stringify'](_0x3ab40c));delete _0x3ab40c['name'];if(_0x40ec1d===0x191){_0x40ec1d=0x190;}_0x339d23[_0xf9bd('0x17')](_0x40ec1d)['send'](_0x56702e[_0xf9bd('0x31')]['test']?{'message':_0xf9bd('0x79'),'statusCode':_0x3ab40c['statusCode']}:_0x3ab40c);});}else{var _0x4e93a8=0x1f4;_0x339d23[_0xf9bd('0x17')](_0x4e93a8)['send']({'message':_0xf9bd('0x79'),'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 b5296fd..3a41637 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 _0x57e4=['exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x57e4,0x1e5));var _0x457e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x57e4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x457e('0x0'));var util=require('util');var logger=require(_0x457e('0x1'))(_0x457e('0x2'));var moment=require('moment');var BPromise=require(_0x457e('0x3'));var rp=require(_0x457e('0x4'));var fs=require('fs');var path=require(_0x457e('0x5'));var rimraf=require('rimraf');var config=require(_0x457e('0x6'));var attributes=require(_0x457e('0x7'));var integrations=require(_0x457e('0x8'));module[_0x457e('0x9')]=function(_0x2a21f1,_0x40c09b){return _0x2a21f1[_0x457e('0xa')](_0x457e('0xb'),attributes,{'tableName':_0x457e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc434=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc434,0x16b));var _0x4c43=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xc434[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x4c43('0x0'));var util=require(_0x4c43('0x1'));var logger=require(_0x4c43('0x2'))(_0x4c43('0x3'));var moment=require(_0x4c43('0x4'));var BPromise=require(_0x4c43('0x5'));var rp=require(_0x4c43('0x6'));var fs=require('fs');var path=require(_0x4c43('0x7'));var rimraf=require('rimraf');var config=require(_0x4c43('0x8'));var attributes=require(_0x4c43('0x9'));var integrations=require(_0x4c43('0xa'));module[_0x4c43('0xb')]=function(_0x20c8af,_0x38f781){return _0x20c8af[_0x4c43('0xc')](_0x4c43('0xd'),attributes,{'tableName':_0x4c43('0xe'),'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 1bdb04b..ea99cfd 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 _0xc846=['../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','include','map','model','then','ShowSugarcrmAccount','find','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x340d75,_0x561cb0){var _0x3f1114=function(_0x2e2bcf){while(--_0x2e2bcf){_0x340d75['push'](_0x340d75['shift']());}};_0x3f1114(++_0x561cb0);}(_0xc846,0x1e9));var _0x6c84=function(_0x23669c,_0x514d31){_0x23669c=_0x23669c-0x0;var _0x5d1546=_0xc846[_0x23669c];return _0x5d1546;};'use strict';var _=require(_0x6c84('0x0'));var util=require(_0x6c84('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6c84('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c84('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c84('0x4'))(_0x6c84('0x5'));var config=require(_0x6c84('0x6'));var jayson=require(_0x6c84('0x7'));var client=jayson[_0x6c84('0x8')][_0x6c84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14aefa,_0x34cec9,_0x3cbe2d){return new BPromise(function(_0x285de3,_0x2653c0){return client[_0x6c84('0xa')](_0x14aefa,_0x3cbe2d)['then'](function(_0x380c92){logger[_0x6c84('0xb')](_0x6c84('0xc'),_0x34cec9,_0x6c84('0xd'));logger[_0x6c84('0xe')](_0x6c84('0xf'),_0x34cec9,_0x6c84('0xd'),JSON[_0x6c84('0x10')](_0x380c92));if(_0x380c92[_0x6c84('0x11')]){if(_0x380c92[_0x6c84('0x11')][_0x6c84('0x12')]===0x1f4){logger[_0x6c84('0x11')](_0x6c84('0xc'),_0x34cec9,_0x380c92[_0x6c84('0x11')][_0x6c84('0x13')]);return _0x2653c0(_0x380c92['error'][_0x6c84('0x13')]);}logger[_0x6c84('0x11')](_0x6c84('0xc'),_0x34cec9,_0x380c92['error'][_0x6c84('0x13')]);return _0x285de3(_0x380c92[_0x6c84('0x11')][_0x6c84('0x13')]);}else{logger[_0x6c84('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x34cec9,_0x6c84('0xd'));_0x285de3(_0x380c92[_0x6c84('0x14')][_0x6c84('0x13')]);}})[_0x6c84('0x15')](function(_0x5d5114){logger['error'](_0x6c84('0xc'),_0x34cec9,_0x5d5114);_0x2653c0(_0x5d5114);});});}exports[_0x6c84('0x16')]=function(_0x27e6bc){var _0x339b0d=this;return new Promise(function(_0x4d9370,_0x21ca8e){return db[_0x6c84('0x17')]['findAll']({'raw':_0x27e6bc[_0x6c84('0x18')]?_0x27e6bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x27e6bc[_0x6c84('0x18')]?_0x27e6bc['options'][_0x6c84('0x19')]||null:null,'attributes':_0x27e6bc[_0x6c84('0x18')]?_0x27e6bc['options'][_0x6c84('0x1a')]||null:null,'limit':_0x27e6bc[_0x6c84('0x18')]?_0x27e6bc[_0x6c84('0x18')]['limit']||null:null,'include':_0x27e6bc[_0x6c84('0x18')]?_0x27e6bc['options'][_0x6c84('0x1b')]?_['map'](_0x27e6bc[_0x6c84('0x18')][_0x6c84('0x1b')],function(_0x5a41be){return{'model':db[_0x5a41be['model']],'as':_0x5a41be['as'],'attributes':_0x5a41be['attributes'],'include':_0x5a41be[_0x6c84('0x1b')]?_[_0x6c84('0x1c')](_0x5a41be[_0x6c84('0x1b')],function(_0x2962b9){return{'model':db[_0x2962b9[_0x6c84('0x1d')]],'as':_0x2962b9['as'],'attributes':_0x2962b9[_0x6c84('0x1a')],'include':_0x2962b9['include']?_[_0x6c84('0x1c')](_0x2962b9[_0x6c84('0x1b')],function(_0x275d94){return{'model':db[_0x275d94[_0x6c84('0x1d')]],'as':_0x275d94['as'],'attributes':_0x275d94[_0x6c84('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6c84('0x1e')](function(_0x4c0f09){logger['info'](_0x6c84('0x16'),_0x27e6bc);logger[_0x6c84('0xe')]('GetSugarcrmAccount',_0x27e6bc,JSON[_0x6c84('0x10')](_0x4c0f09));_0x4d9370(_0x4c0f09);})['catch'](function(_0x3845a6){logger[_0x6c84('0x11')](_0x6c84('0x16'),_0x3845a6[_0x6c84('0x13')],_0x27e6bc);_0x21ca8e(_0x339b0d['error'](0x1f4,_0x3845a6[_0x6c84('0x13')]));});});};exports[_0x6c84('0x1f')]=function(_0x215e7d){var _0x4b4e26=this;return new Promise(function(_0x3aad6a,_0xcc54b1){return db[_0x6c84('0x17')][_0x6c84('0x20')]({'raw':_0x215e7d['options']?_0x215e7d[_0x6c84('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x215e7d[_0x6c84('0x18')]?_0x215e7d[_0x6c84('0x18')][_0x6c84('0x19')]||null:null,'attributes':_0x215e7d[_0x6c84('0x18')]?_0x215e7d[_0x6c84('0x18')][_0x6c84('0x1a')]||null:null,'include':_0x215e7d['options']?_0x215e7d[_0x6c84('0x18')]['include']?_[_0x6c84('0x1c')](_0x215e7d[_0x6c84('0x18')][_0x6c84('0x1b')],function(_0x366d80){return{'model':db[_0x366d80[_0x6c84('0x1d')]],'as':_0x366d80['as'],'attributes':_0x366d80[_0x6c84('0x1a')],'include':_0x366d80[_0x6c84('0x1b')]?_[_0x6c84('0x1c')](_0x366d80[_0x6c84('0x1b')],function(_0x21cf02){return{'model':db[_0x21cf02[_0x6c84('0x1d')]],'as':_0x21cf02['as'],'attributes':_0x21cf02[_0x6c84('0x1a')],'include':_0x21cf02[_0x6c84('0x1b')]?_[_0x6c84('0x1c')](_0x21cf02['include'],function(_0x22d733){return{'model':db[_0x22d733[_0x6c84('0x1d')]],'as':_0x22d733['as'],'attributes':_0x22d733[_0x6c84('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6c84('0x1e')](function(_0x157276){logger[_0x6c84('0xb')](_0x6c84('0x1f'),_0x215e7d);logger[_0x6c84('0xe')](_0x6c84('0x1f'),_0x215e7d,JSON[_0x6c84('0x10')](_0x157276));_0x3aad6a(_0x157276);})[_0x6c84('0x15')](function(_0x25a91f){logger[_0x6c84('0x11')]('ShowSugarcrmAccount',_0x25a91f[_0x6c84('0x13')],_0x215e7d);_0xcc54b1(_0x4b4e26[_0x6c84('0x11')](0x1f4,_0x25a91f[_0x6c84('0x13')]));});});}; \ No newline at end of file +var _0x9afe=['message','info','catch','findAll','options','raw','where','model','attributes','map','include','GetSugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x55778a,_0xb1f3c6){var _0x303749=function(_0x24e1f6){while(--_0x24e1f6){_0x55778a['push'](_0x55778a['shift']());}};_0x303749(++_0xb1f3c6);}(_0x9afe,0x152));var _0xe9af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9afe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe9af('0x0'));var util=require(_0xe9af('0x1'));var moment=require(_0xe9af('0x2'));var BPromise=require(_0xe9af('0x3'));var rs=require(_0xe9af('0x4'));var fs=require('fs');var Redis=require(_0xe9af('0x5'));var db=require(_0xe9af('0x6'))['db'];var utils=require(_0xe9af('0x7'));var logger=require(_0xe9af('0x8'))(_0xe9af('0x9'));var config=require('../../config/environment');var jayson=require(_0xe9af('0xa'));var client=jayson[_0xe9af('0xb')][_0xe9af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bc262,_0x56b193,_0x38e7c7){return new BPromise(function(_0x42fcb0,_0x51cab3){return client[_0xe9af('0xd')](_0x5bc262,_0x38e7c7)[_0xe9af('0xe')](function(_0x1054e0){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x56b193,_0xe9af('0xf'));logger[_0xe9af('0x10')](_0xe9af('0x11'),_0x56b193,_0xe9af('0xf'),JSON[_0xe9af('0x12')](_0x1054e0));if(_0x1054e0[_0xe9af('0x13')]){if(_0x1054e0[_0xe9af('0x13')][_0xe9af('0x14')]===0x1f4){logger[_0xe9af('0x13')](_0xe9af('0x15'),_0x56b193,_0x1054e0['error']['message']);return _0x51cab3(_0x1054e0[_0xe9af('0x13')][_0xe9af('0x16')]);}logger[_0xe9af('0x13')](_0xe9af('0x15'),_0x56b193,_0x1054e0[_0xe9af('0x13')]['message']);return _0x42fcb0(_0x1054e0[_0xe9af('0x13')][_0xe9af('0x16')]);}else{logger[_0xe9af('0x17')]('SugarcrmAccount,\x20%s,\x20%s',_0x56b193,_0xe9af('0xf'));_0x42fcb0(_0x1054e0['result'][_0xe9af('0x16')]);}})[_0xe9af('0x18')](function(_0xf95339){logger[_0xe9af('0x13')](_0xe9af('0x15'),_0x56b193,_0xf95339);_0x51cab3(_0xf95339);});});}exports['GetSugarcrmAccount']=function(_0x269bd2){var _0x239b73=this;return new Promise(function(_0x2d8dc7,_0x98de6f){return db['SugarcrmAccount'][_0xe9af('0x19')]({'raw':_0x269bd2[_0xe9af('0x1a')]?_0x269bd2['options'][_0xe9af('0x1b')]===undefined?!![]:![]:!![],'where':_0x269bd2[_0xe9af('0x1a')]?_0x269bd2[_0xe9af('0x1a')][_0xe9af('0x1c')]||null:null,'attributes':_0x269bd2['options']?_0x269bd2['options']['attributes']||null:null,'limit':_0x269bd2[_0xe9af('0x1a')]?_0x269bd2[_0xe9af('0x1a')]['limit']||null:null,'include':_0x269bd2['options']?_0x269bd2[_0xe9af('0x1a')]['include']?_['map'](_0x269bd2[_0xe9af('0x1a')]['include'],function(_0x427a7b){return{'model':db[_0x427a7b[_0xe9af('0x1d')]],'as':_0x427a7b['as'],'attributes':_0x427a7b[_0xe9af('0x1e')],'include':_0x427a7b['include']?_[_0xe9af('0x1f')](_0x427a7b[_0xe9af('0x20')],function(_0x1b134c){return{'model':db[_0x1b134c['model']],'as':_0x1b134c['as'],'attributes':_0x1b134c[_0xe9af('0x1e')],'include':_0x1b134c[_0xe9af('0x20')]?_[_0xe9af('0x1f')](_0x1b134c[_0xe9af('0x20')],function(_0x5b9fb4){return{'model':db[_0x5b9fb4[_0xe9af('0x1d')]],'as':_0x5b9fb4['as'],'attributes':_0x5b9fb4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9af('0xe')](function(_0x5e456c){logger['info'](_0xe9af('0x21'),_0x269bd2);logger[_0xe9af('0x10')](_0xe9af('0x21'),_0x269bd2,JSON[_0xe9af('0x12')](_0x5e456c));_0x2d8dc7(_0x5e456c);})[_0xe9af('0x18')](function(_0x56dc96){logger[_0xe9af('0x13')](_0xe9af('0x21'),_0x56dc96[_0xe9af('0x16')],_0x269bd2);_0x98de6f(_0x239b73[_0xe9af('0x13')](0x1f4,_0x56dc96[_0xe9af('0x16')]));});});};exports['ShowSugarcrmAccount']=function(_0x57883a){var _0x354faa=this;return new Promise(function(_0x324735,_0x358edf){return db['SugarcrmAccount'][_0xe9af('0x22')]({'raw':_0x57883a['options']?_0x57883a[_0xe9af('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x57883a[_0xe9af('0x1a')]?_0x57883a[_0xe9af('0x1a')][_0xe9af('0x1c')]||null:null,'attributes':_0x57883a[_0xe9af('0x1a')]?_0x57883a[_0xe9af('0x1a')][_0xe9af('0x1e')]||null:null,'include':_0x57883a[_0xe9af('0x1a')]?_0x57883a[_0xe9af('0x1a')][_0xe9af('0x20')]?_[_0xe9af('0x1f')](_0x57883a[_0xe9af('0x1a')][_0xe9af('0x20')],function(_0x305945){return{'model':db[_0x305945[_0xe9af('0x1d')]],'as':_0x305945['as'],'attributes':_0x305945[_0xe9af('0x1e')],'include':_0x305945[_0xe9af('0x20')]?_[_0xe9af('0x1f')](_0x305945[_0xe9af('0x20')],function(_0x41844f){return{'model':db[_0x41844f[_0xe9af('0x1d')]],'as':_0x41844f['as'],'attributes':_0x41844f['attributes'],'include':_0x41844f[_0xe9af('0x20')]?_[_0xe9af('0x1f')](_0x41844f[_0xe9af('0x20')],function(_0x1b9c82){return{'model':db[_0x1b9c82[_0xe9af('0x1d')]],'as':_0x1b9c82['as'],'attributes':_0x1b9c82[_0xe9af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe9af('0xe')](function(_0x518338){logger[_0xe9af('0x17')](_0xe9af('0x23'),_0x57883a);logger[_0xe9af('0x10')](_0xe9af('0x23'),_0x57883a,JSON['stringify'](_0x518338));_0x324735(_0x518338);})[_0xe9af('0x18')](function(_0x5666d9){logger[_0xe9af('0x13')](_0xe9af('0x23'),_0x5666d9[_0xe9af('0x16')],_0x57883a);_0x358edf(_0x354faa[_0xe9af('0x13')](0x1f4,_0x5666d9[_0xe9af('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 37b8815..305b20a 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 _0x6b83=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer'];(function(_0x43d106,_0x96a475){var _0x2160bc=function(_0x1219fb){while(--_0x1219fb){_0x43d106['push'](_0x43d106['shift']());}};_0x2160bc(++_0x96a475);}(_0x6b83,0x158));var _0x36b8=function(_0x3bee08,_0x128fcc){_0x3bee08=_0x3bee08-0x0;var _0x55cd6e=_0x6b83[_0x3bee08];return _0x55cd6e;};'use strict';var multer=require(_0x36b8('0x0'));var util=require(_0x36b8('0x1'));var path=require(_0x36b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x36b8('0x3'));var router=express['Router']();var fs_extra=require(_0x36b8('0x4'));var auth=require(_0x36b8('0x5'));var interaction=require(_0x36b8('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x36b8('0x7')]('/',auth[_0x36b8('0x8')](),controller['index']);router[_0x36b8('0x7')](_0x36b8('0x9'),auth[_0x36b8('0x8')](),controller[_0x36b8('0xa')]);router[_0x36b8('0x7')](_0x36b8('0xb'),auth[_0x36b8('0x8')](),controller[_0x36b8('0xc')]);router[_0x36b8('0x7')](_0x36b8('0xd'),auth['isAuthenticated'](),controller[_0x36b8('0xe')]);router[_0x36b8('0x7')](_0x36b8('0xf'),auth[_0x36b8('0x8')](),controller[_0x36b8('0x10')]);router[_0x36b8('0x11')]('/',auth[_0x36b8('0x8')](),controller[_0x36b8('0x12')]);router[_0x36b8('0x13')](_0x36b8('0x9'),auth[_0x36b8('0x8')](),controller[_0x36b8('0x14')]);router[_0x36b8('0x15')](_0x36b8('0x9'),auth[_0x36b8('0x8')](),controller[_0x36b8('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6b9f=['Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x19bc4e,_0x58df49){var _0x4b6a5a=function(_0x45504a){while(--_0x45504a){_0x19bc4e['push'](_0x19bc4e['shift']());}};_0x4b6a5a(++_0x58df49);}(_0x6b9f,0x110));var _0xf6b9=function(_0x118bfb,_0x20e783){_0x118bfb=_0x118bfb-0x0;var _0x382051=_0x6b9f[_0x118bfb];return _0x382051;};'use strict';var multer=require('multer');var util=require(_0xf6b9('0x0'));var path=require(_0xf6b9('0x1'));var timeout=require(_0xf6b9('0x2'));var express=require(_0xf6b9('0x3'));var router=express[_0xf6b9('0x4')]();var fs_extra=require(_0xf6b9('0x5'));var auth=require(_0xf6b9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b9('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf6b9('0x8')](_0xf6b9('0x9'),auth['isAuthenticated'](),controller[_0xf6b9('0xa')]);router[_0xf6b9('0x8')]('/:id/fields',auth[_0xf6b9('0xb')](),controller[_0xf6b9('0xc')]);router['get'](_0xf6b9('0xd'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0xe')]);router[_0xf6b9('0x8')](_0xf6b9('0xf'),auth['isAuthenticated'](),controller[_0xf6b9('0x10')]);router[_0xf6b9('0x11')]('/',auth['isAuthenticated'](),controller[_0xf6b9('0x12')]);router[_0xf6b9('0x13')](_0xf6b9('0x9'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0x14')]);router[_0xf6b9('0x15')](_0xf6b9('0x9'),auth['isAuthenticated'](),controller[_0xf6b9('0x16')]);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 8378484..3499b9b 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 _0x708f=['sequelize','exports','STRING'];(function(_0x574416,_0x37767b){var _0x2df91e=function(_0x3d0929){while(--_0x3d0929){_0x574416['push'](_0x574416['shift']());}};_0x2df91e(++_0x37767b);}(_0x708f,0x1e0));var _0xf708=function(_0x14afda,_0x512394){_0x14afda=_0x14afda-0x0;var _0x1923af=_0x708f[_0x14afda];return _0x1923af;};'use strict';var Sequelize=require(_0xf708('0x0'));module[_0xf708('0x1')]={'name':{'type':Sequelize[_0xf708('0x2')]},'description':{'type':Sequelize[_0xf708('0x2')]}}; \ No newline at end of file +var _0x7d07=['STRING'];(function(_0x304292,_0xcb4fb6){var _0x1b5918=function(_0x5a4c4d){while(--_0x5a4c4d){_0x304292['push'](_0x304292['shift']());}};_0x1b5918(++_0xcb4fb6);}(_0x7d07,0xa9));var _0x77d0=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0x7d07[_0x5de1bc];return _0x19f4b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x77d0('0x0')]},'description':{'type':Sequelize[_0x77d0('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 237f7f8..9d71799 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 _0x91de=['apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','SugarcrmConfiguration','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','options','getFields','nolimit','findOne','getSubjects','getDescriptions','SugarcrmField','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x91de,0x84));var _0xe91d=function(_0x3c9293,_0x163f1e){_0x3c9293=_0x3c9293-0x0;var _0x331064=_0x91de[_0x3c9293];return _0x331064;};'use strict';var emlformat=require(_0xe91d('0x0'));var rimraf=require(_0xe91d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe91d('0x2'));var rp=require('request-promise');var moment=require(_0xe91d('0x3'));var BPromise=require(_0xe91d('0x4'));var Mustache=require(_0xe91d('0x5'));var util=require(_0xe91d('0x6'));var path=require(_0xe91d('0x7'));var sox=require(_0xe91d('0x8'));var csv=require(_0xe91d('0x9'));var ejs=require(_0xe91d('0xa'));var fs=require('fs');var fs_extra=require(_0xe91d('0xb'));var _=require('lodash');var squel=require(_0xe91d('0xc'));var crypto=require(_0xe91d('0xd'));var jsforce=require(_0xe91d('0xe'));var deskjs=require(_0xe91d('0xf'));var toCsv=require(_0xe91d('0x9'));var querystring=require(_0xe91d('0x10'));var Papa=require('papaparse');var Redis=require(_0xe91d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe91d('0x12'));var hardwareService=require(_0xe91d('0x13'));var logger=require(_0xe91d('0x14'))(_0xe91d('0x15'));var utils=require(_0xe91d('0x16'));var config=require(_0xe91d('0x17'));var licenseUtil=require(_0xe91d('0x18'));var db=require(_0xe91d('0x19'))['db'];function respondWithStatusCode(_0x2a294f,_0x3224fc){_0x3224fc=_0x3224fc||0xcc;return function(_0x299540){if(_0x299540){return _0x2a294f['sendStatus'](_0x3224fc);}return _0x2a294f[_0xe91d('0x1a')](_0x3224fc)[_0xe91d('0x1b')]();};}function respondWithResult(_0x4949d4,_0xbc8508){_0xbc8508=_0xbc8508||0xc8;return function(_0x5990db){if(_0x5990db){return _0x4949d4[_0xe91d('0x1a')](_0xbc8508)['json'](_0x5990db);}};}function respondWithFilteredResult(_0x3de6af,_0x123a7e){return function(_0x167542){if(_0x167542){var _0x12afa8=typeof _0x123a7e[_0xe91d('0x1c')]==='undefined'&&typeof _0x123a7e['limit']===_0xe91d('0x1d');var _0x47d897=_0x167542[_0xe91d('0x1e')];var _0x52ad18=_0x12afa8?0x0:_0x123a7e[_0xe91d('0x1c')];var _0x54263b=_0x12afa8?_0x167542['count']:_0x123a7e[_0xe91d('0x1c')]+_0x123a7e[_0xe91d('0x1f')];var _0x6a8a02;if(_0x54263b>=_0x47d897){_0x54263b=_0x47d897;_0x6a8a02=0xc8;}else{_0x6a8a02=0xce;}_0x3de6af['status'](_0x6a8a02);return _0x3de6af['set'](_0xe91d('0x20'),_0x52ad18+'-'+_0x54263b+'/'+_0x47d897)[_0xe91d('0x21')](_0x167542);}return null;};}function patchUpdates(_0x501dfe){return function(_0x30834){try{jsonpatch[_0xe91d('0x22')](_0x30834,_0x501dfe,!![]);}catch(_0x29bbf7){return BPromise[_0xe91d('0x23')](_0x29bbf7);}return _0x30834[_0xe91d('0x24')]();};}function saveUpdates(_0x2a67b5,_0x38f1b5){return function(_0x101d2f){if(_0x101d2f){return _0x101d2f[_0xe91d('0x25')](_0x2a67b5)[_0xe91d('0x26')](function(_0x36e865){return _0x36e865;});}return null;};}function removeEntity(_0x3618d3,_0x3bf2aa){return function(_0x16d7ce){if(_0x16d7ce){return _0x16d7ce[_0xe91d('0x27')]()[_0xe91d('0x26')](function(){_0x3618d3[_0xe91d('0x1a')](0xcc)[_0xe91d('0x1b')]();});}};}function handleEntityNotFound(_0x42d223,_0xad07c3){return function(_0x5375c6){if(!_0x5375c6){_0x42d223[_0xe91d('0x28')](0x194);}return _0x5375c6;};}function handleError(_0x19e785,_0x321fcd){_0x321fcd=_0x321fcd||0x1f4;return function(_0x56640d){logger[_0xe91d('0x29')](_0x56640d[_0xe91d('0x2a')]);if(_0x56640d[_0xe91d('0x2b')]){delete _0x56640d[_0xe91d('0x2b')];}_0x19e785[_0xe91d('0x1a')](_0x321fcd)[_0xe91d('0x2c')](_0x56640d);};}exports['index']=function(_0x1424cc,_0x5ca31a){var _0x1f817d={},_0x5b9e09={},_0x174587={'count':0x0,'rows':[]};var _0x11855a=_[_0xe91d('0x2d')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x3ea1eb){return{'name':_0x3ea1eb[_0xe91d('0x2e')],'type':_0x3ea1eb[_0xe91d('0x2f')]['key']};});_0x5b9e09[_0xe91d('0x30')]=_[_0xe91d('0x2d')](_0x11855a,_0xe91d('0x2b'));_0x5b9e09['query']=_[_0xe91d('0x31')](_0x1424cc['query']);_0x5b9e09[_0xe91d('0x32')]=_[_0xe91d('0x33')](_0x5b9e09[_0xe91d('0x30')],_0x5b9e09[_0xe91d('0x34')]);_0x1f817d[_0xe91d('0x35')]=_[_0xe91d('0x33')](_0x5b9e09[_0xe91d('0x30')],qs[_0xe91d('0x36')](_0x1424cc[_0xe91d('0x34')]['fields']));_0x1f817d[_0xe91d('0x35')]=_0x1f817d[_0xe91d('0x35')][_0xe91d('0x37')]?_0x1f817d[_0xe91d('0x35')]:_0x5b9e09[_0xe91d('0x30')];if(!_0x1424cc[_0xe91d('0x34')][_0xe91d('0x38')]('nolimit')){_0x1f817d[_0xe91d('0x1f')]=qs[_0xe91d('0x1f')](_0x1424cc[_0xe91d('0x34')][_0xe91d('0x1f')]);_0x1f817d['offset']=qs[_0xe91d('0x1c')](_0x1424cc[_0xe91d('0x34')][_0xe91d('0x1c')]);}_0x1f817d[_0xe91d('0x39')]=qs['sort'](_0x1424cc[_0xe91d('0x34')][_0xe91d('0x3a')]);_0x1f817d[_0xe91d('0x3b')]=qs[_0xe91d('0x32')](_[_0xe91d('0x3c')](_0x1424cc[_0xe91d('0x34')],_0x5b9e09[_0xe91d('0x32')]),_0x11855a);if(_0x1424cc[_0xe91d('0x34')][_0xe91d('0x3d')]){_0x1f817d[_0xe91d('0x3b')]=_[_0xe91d('0x3e')](_0x1f817d['where'],{'$or':_[_0xe91d('0x2d')](_0x11855a,function(_0x2212af){if(_0x2212af[_0xe91d('0x2f')]!==_0xe91d('0x3f')){var _0x35d7bb={};_0x35d7bb[_0x2212af['name']]={'$like':'%'+_0x1424cc[_0xe91d('0x34')]['filter']+'%'};return _0x35d7bb;}})});}_0x1f817d=_['merge']({},_0x1f817d,_0x1424cc['options']);var _0x30fda9={'where':_0x1f817d[_0xe91d('0x3b')]};return db['SugarcrmConfiguration']['count'](_0x30fda9)[_0xe91d('0x26')](function(_0xa030bf){_0x174587['count']=_0xa030bf;if(_0x1424cc['query']['includeAll']){_0x1f817d[_0xe91d('0x40')]=[{'all':!![]}];}return db[_0xe91d('0x41')][_0xe91d('0x42')](_0x1f817d);})[_0xe91d('0x26')](function(_0x48c4d7){_0x174587[_0xe91d('0x43')]=_0x48c4d7;return _0x174587;})[_0xe91d('0x26')](respondWithFilteredResult(_0x5ca31a,_0x1f817d))[_0xe91d('0x44')](handleError(_0x5ca31a,null));};exports[_0xe91d('0x45')]=function(_0x12f7fe,_0x4a7c91){var _0x6d1a9b={'raw':![],'where':{'id':_0x12f7fe[_0xe91d('0x46')]['id']}},_0x40eccd={};_0x40eccd[_0xe91d('0x30')]=_[_0xe91d('0x31')](db[_0xe91d('0x41')][_0xe91d('0x47')]);_0x40eccd[_0xe91d('0x34')]=_[_0xe91d('0x31')](_0x12f7fe['query']);_0x40eccd[_0xe91d('0x32')]=_[_0xe91d('0x33')](_0x40eccd[_0xe91d('0x30')],_0x40eccd[_0xe91d('0x34')]);_0x6d1a9b['attributes']=_['intersection'](_0x40eccd[_0xe91d('0x30')],qs[_0xe91d('0x36')](_0x12f7fe[_0xe91d('0x34')][_0xe91d('0x36')]));_0x6d1a9b[_0xe91d('0x35')]=_0x6d1a9b[_0xe91d('0x35')][_0xe91d('0x37')]?_0x6d1a9b[_0xe91d('0x35')]:_0x40eccd[_0xe91d('0x30')];if(_0x12f7fe[_0xe91d('0x34')][_0xe91d('0x48')]){_0x6d1a9b[_0xe91d('0x40')]=[{'all':!![]}];}_0x6d1a9b=_['merge']({},_0x6d1a9b,_0x12f7fe['options']);return db[_0xe91d('0x41')][_0xe91d('0x49')](_0x6d1a9b)[_0xe91d('0x26')](handleEntityNotFound(_0x4a7c91,null))[_0xe91d('0x26')](respondWithResult(_0x4a7c91,null))[_0xe91d('0x44')](handleError(_0x4a7c91,null));};exports[_0xe91d('0x4a')]=function(_0x5ae08d,_0xc04751){return db[_0xe91d('0x41')][_0xe91d('0x4a')](_0x5ae08d['body'],{})[_0xe91d('0x26')](respondWithResult(_0xc04751,0xc9))['catch'](handleError(_0xc04751,null));};exports[_0xe91d('0x25')]=function(_0x4f9268,_0x3c1616){if(_0x4f9268['body']['id']){delete _0x4f9268[_0xe91d('0x4b')]['id'];}return db[_0xe91d('0x41')]['find']({'where':{'id':_0x4f9268['params']['id']}})[_0xe91d('0x26')](handleEntityNotFound(_0x3c1616,null))[_0xe91d('0x26')](saveUpdates(_0x4f9268['body'],null))[_0xe91d('0x26')](respondWithResult(_0x3c1616,null))[_0xe91d('0x44')](handleError(_0x3c1616,null));};exports['destroy']=function(_0x2953ab,_0x4caaea){return db[_0xe91d('0x41')]['find']({'where':{'id':_0x2953ab[_0xe91d('0x46')]['id']}})[_0xe91d('0x26')](handleEntityNotFound(_0x4caaea,null))['then'](removeEntity(_0x4caaea,null))[_0xe91d('0x44')](handleError(_0x4caaea,null));};exports['getFields']=function(_0x311418,_0x1bd6df,_0x447087){var _0x383cb2={};var _0x4422c7={};var _0x21b022;var _0x13a815;return db[_0xe91d('0x41')]['findOne']({'where':{'id':_0x311418['params']['id']}})['then'](handleEntityNotFound(_0x1bd6df,null))[_0xe91d('0x26')](function(_0x6ddd24){if(_0x6ddd24){_0x21b022=_0x6ddd24;_0x4422c7['model']=_[_0xe91d('0x31')](db['SugarcrmField'][_0xe91d('0x47')]);_0x4422c7[_0xe91d('0x34')]=_[_0xe91d('0x31')](_0x311418['query']);_0x4422c7['filters']=_[_0xe91d('0x33')](_0x4422c7['model'],_0x4422c7['query']);_0x383cb2['attributes']=_['intersection'](_0x4422c7[_0xe91d('0x30')],qs[_0xe91d('0x36')](_0x311418[_0xe91d('0x34')][_0xe91d('0x36')]));_0x383cb2['attributes']=_0x383cb2['attributes']['length']?_0x383cb2[_0xe91d('0x35')]:_0x4422c7[_0xe91d('0x30')];_0x383cb2[_0xe91d('0x39')]=qs['sort'](_0x311418['query']['sort']);_0x383cb2[_0xe91d('0x3b')]=qs['filters'](_[_0xe91d('0x3c')](_0x311418[_0xe91d('0x34')],_0x4422c7[_0xe91d('0x32')]));if(_0x311418[_0xe91d('0x34')][_0xe91d('0x3d')]){_0x383cb2[_0xe91d('0x3b')]=_[_0xe91d('0x3e')](_0x383cb2[_0xe91d('0x3b')],{'$or':_[_0xe91d('0x2d')](_0x383cb2[_0xe91d('0x35')],function(_0x3f0a88){var _0x3104fa={};_0x3104fa[_0x3f0a88]={'$like':'%'+_0x311418[_0xe91d('0x34')][_0xe91d('0x3d')]+'%'};return _0x3104fa;})});}_0x383cb2=_[_0xe91d('0x3e')]({},_0x383cb2,_0x311418[_0xe91d('0x4c')]);return _0x21b022[_0xe91d('0x4d')](_0x383cb2);}})['then'](function(_0x51feab){if(_0x51feab){_0x13a815=_0x51feab[_0xe91d('0x37')];if(!_0x311418[_0xe91d('0x34')][_0xe91d('0x38')](_0xe91d('0x4e'))){_0x383cb2[_0xe91d('0x1f')]=qs[_0xe91d('0x1f')](_0x311418[_0xe91d('0x34')][_0xe91d('0x1f')]);_0x383cb2[_0xe91d('0x1c')]=qs['offset'](_0x311418['query'][_0xe91d('0x1c')]);}return _0x21b022['getFields'](_0x383cb2);}})[_0xe91d('0x26')](function(_0x4adfeb){if(_0x4adfeb){return _0x4adfeb?{'count':_0x13a815,'rows':_0x4adfeb}:null;}})[_0xe91d('0x26')](respondWithResult(_0x1bd6df,null))[_0xe91d('0x44')](handleError(_0x1bd6df,null));};exports['getSubjects']=function(_0x201f01,_0x1ddc19,_0x520625){var _0x147fda={};var _0x3e9dc9={};var _0x3650a0;var _0x2fd662;return db[_0xe91d('0x41')][_0xe91d('0x4f')]({'where':{'id':_0x201f01['params']['id']}})[_0xe91d('0x26')](handleEntityNotFound(_0x1ddc19,null))[_0xe91d('0x26')](function(_0x3f6627){if(_0x3f6627){_0x3650a0=_0x3f6627;_0x3e9dc9[_0xe91d('0x30')]=_[_0xe91d('0x31')](db['SugarcrmField']['rawAttributes']);_0x3e9dc9[_0xe91d('0x34')]=_[_0xe91d('0x31')](_0x201f01['query']);_0x3e9dc9[_0xe91d('0x32')]=_[_0xe91d('0x33')](_0x3e9dc9['model'],_0x3e9dc9[_0xe91d('0x34')]);_0x147fda[_0xe91d('0x35')]=_['intersection'](_0x3e9dc9[_0xe91d('0x30')],qs[_0xe91d('0x36')](_0x201f01['query']['fields']));_0x147fda[_0xe91d('0x35')]=_0x147fda[_0xe91d('0x35')][_0xe91d('0x37')]?_0x147fda['attributes']:_0x3e9dc9[_0xe91d('0x30')];_0x147fda[_0xe91d('0x39')]=qs[_0xe91d('0x3a')](_0x201f01[_0xe91d('0x34')][_0xe91d('0x3a')]);_0x147fda[_0xe91d('0x3b')]=qs[_0xe91d('0x32')](_['pick'](_0x201f01[_0xe91d('0x34')],_0x3e9dc9['filters']));if(_0x201f01[_0xe91d('0x34')]['filter']){_0x147fda['where']=_['merge'](_0x147fda['where'],{'$or':_[_0xe91d('0x2d')](_0x147fda['attributes'],function(_0x16826f){var _0x847957={};_0x847957[_0x16826f]={'$like':'%'+_0x201f01[_0xe91d('0x34')][_0xe91d('0x3d')]+'%'};return _0x847957;})});}_0x147fda=_[_0xe91d('0x3e')]({},_0x147fda,_0x201f01['options']);return _0x3650a0['getSubjects'](_0x147fda);}})[_0xe91d('0x26')](function(_0x30db54){if(_0x30db54){_0x2fd662=_0x30db54[_0xe91d('0x37')];if(!_0x201f01['query'][_0xe91d('0x38')]('nolimit')){_0x147fda[_0xe91d('0x1f')]=qs[_0xe91d('0x1f')](_0x201f01[_0xe91d('0x34')][_0xe91d('0x1f')]);_0x147fda[_0xe91d('0x1c')]=qs[_0xe91d('0x1c')](_0x201f01[_0xe91d('0x34')]['offset']);}return _0x3650a0[_0xe91d('0x50')](_0x147fda);}})['then'](function(_0x23a668){if(_0x23a668){return _0x23a668?{'count':_0x2fd662,'rows':_0x23a668}:null;}})[_0xe91d('0x26')](respondWithResult(_0x1ddc19,null))[_0xe91d('0x44')](handleError(_0x1ddc19,null));};exports[_0xe91d('0x51')]=function(_0x404408,_0x5b3fb9,_0x39e2d1){var _0x4134be={};var _0x2b6c66={};var _0x38c3ba;var _0x83207e;return db[_0xe91d('0x41')]['findOne']({'where':{'id':_0x404408['params']['id']}})[_0xe91d('0x26')](handleEntityNotFound(_0x5b3fb9,null))[_0xe91d('0x26')](function(_0x18eb70){if(_0x18eb70){_0x38c3ba=_0x18eb70;_0x2b6c66[_0xe91d('0x30')]=_[_0xe91d('0x31')](db[_0xe91d('0x52')]['rawAttributes']);_0x2b6c66['query']=_['keys'](_0x404408[_0xe91d('0x34')]);_0x2b6c66[_0xe91d('0x32')]=_['intersection'](_0x2b6c66['model'],_0x2b6c66[_0xe91d('0x34')]);_0x4134be['attributes']=_['intersection'](_0x2b6c66['model'],qs[_0xe91d('0x36')](_0x404408['query'][_0xe91d('0x36')]));_0x4134be[_0xe91d('0x35')]=_0x4134be[_0xe91d('0x35')][_0xe91d('0x37')]?_0x4134be[_0xe91d('0x35')]:_0x2b6c66['model'];_0x4134be[_0xe91d('0x39')]=qs[_0xe91d('0x3a')](_0x404408[_0xe91d('0x34')]['sort']);_0x4134be[_0xe91d('0x3b')]=qs['filters'](_['pick'](_0x404408[_0xe91d('0x34')],_0x2b6c66[_0xe91d('0x32')]));if(_0x404408[_0xe91d('0x34')][_0xe91d('0x3d')]){_0x4134be[_0xe91d('0x3b')]=_[_0xe91d('0x3e')](_0x4134be['where'],{'$or':_[_0xe91d('0x2d')](_0x4134be[_0xe91d('0x35')],function(_0x1e26d6){var _0x2073f0={};_0x2073f0[_0x1e26d6]={'$like':'%'+_0x404408[_0xe91d('0x34')][_0xe91d('0x3d')]+'%'};return _0x2073f0;})});}_0x4134be=_[_0xe91d('0x3e')]({},_0x4134be,_0x404408['options']);return _0x38c3ba[_0xe91d('0x51')](_0x4134be);}})[_0xe91d('0x26')](function(_0x173761){if(_0x173761){_0x83207e=_0x173761[_0xe91d('0x37')];if(!_0x404408[_0xe91d('0x34')][_0xe91d('0x38')](_0xe91d('0x4e'))){_0x4134be[_0xe91d('0x1f')]=qs[_0xe91d('0x1f')](_0x404408['query'][_0xe91d('0x1f')]);_0x4134be[_0xe91d('0x1c')]=qs[_0xe91d('0x1c')](_0x404408[_0xe91d('0x34')][_0xe91d('0x1c')]);}return _0x38c3ba[_0xe91d('0x51')](_0x4134be);}})['then'](function(_0x521873){if(_0x521873){return _0x521873?{'count':_0x83207e,'rows':_0x521873}:null;}})[_0xe91d('0x26')](respondWithResult(_0x5b3fb9,null))[_0xe91d('0x44')](handleError(_0x5b3fb9,null));}; \ No newline at end of file +var _0x9657=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../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','apply','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','SugarcrmConfiguration','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','getFields','findOne','filter','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x9657,0x19d));var _0x7965=function(_0x243f17,_0xc51365){_0x243f17=_0x243f17-0x0;var _0x13449d=_0x9657[_0x243f17];return _0x13449d;};'use strict';var emlformat=require(_0x7965('0x0'));var rimraf=require(_0x7965('0x1'));var zipdir=require(_0x7965('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7965('0x3'));var moment=require(_0x7965('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7965('0x5'));var util=require(_0x7965('0x6'));var path=require(_0x7965('0x7'));var sox=require(_0x7965('0x8'));var csv=require(_0x7965('0x9'));var ejs=require(_0x7965('0xa'));var fs=require('fs');var fs_extra=require(_0x7965('0xb'));var _=require(_0x7965('0xc'));var squel=require(_0x7965('0xd'));var crypto=require('crypto');var jsforce=require(_0x7965('0xe'));var deskjs=require(_0x7965('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7965('0x10'));var Papa=require(_0x7965('0x11'));var Redis=require(_0x7965('0x12'));var authService=require(_0x7965('0x13'));var qs=require(_0x7965('0x14'));var as=require(_0x7965('0x15'));var hardwareService=require(_0x7965('0x16'));var logger=require(_0x7965('0x17'))(_0x7965('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7965('0x19'));var db=require(_0x7965('0x1a'))['db'];function respondWithStatusCode(_0x2e9ee5,_0x435226){_0x435226=_0x435226||0xcc;return function(_0xa7f0cc){if(_0xa7f0cc){return _0x2e9ee5[_0x7965('0x1b')](_0x435226);}return _0x2e9ee5[_0x7965('0x1c')](_0x435226)[_0x7965('0x1d')]();};}function respondWithResult(_0xa54d6b,_0x4fdc32){_0x4fdc32=_0x4fdc32||0xc8;return function(_0x4ca70f){if(_0x4ca70f){return _0xa54d6b[_0x7965('0x1c')](_0x4fdc32)[_0x7965('0x1e')](_0x4ca70f);}};}function respondWithFilteredResult(_0x41c2a6,_0x3b477a){return function(_0x121e79){if(_0x121e79){var _0x945019=typeof _0x3b477a['offset']===_0x7965('0x1f')&&typeof _0x3b477a[_0x7965('0x20')]===_0x7965('0x1f');var _0x2c557e=_0x121e79[_0x7965('0x21')];var _0x370003=_0x945019?0x0:_0x3b477a[_0x7965('0x22')];var _0x13d825=_0x945019?_0x121e79['count']:_0x3b477a[_0x7965('0x22')]+_0x3b477a['limit'];var _0x393c34;if(_0x13d825>=_0x2c557e){_0x13d825=_0x2c557e;_0x393c34=0xc8;}else{_0x393c34=0xce;}_0x41c2a6[_0x7965('0x1c')](_0x393c34);return _0x41c2a6[_0x7965('0x23')](_0x7965('0x24'),_0x370003+'-'+_0x13d825+'/'+_0x2c557e)[_0x7965('0x1e')](_0x121e79);}return null;};}function patchUpdates(_0x25ee65){return function(_0x444e64){try{jsonpatch[_0x7965('0x25')](_0x444e64,_0x25ee65,!![]);}catch(_0xf01817){return BPromise['reject'](_0xf01817);}return _0x444e64[_0x7965('0x26')]();};}function saveUpdates(_0x45e0d6,_0x2512d3){return function(_0x3dc694){if(_0x3dc694){return _0x3dc694[_0x7965('0x27')](_0x45e0d6)['then'](function(_0x18e3db){return _0x18e3db;});}return null;};}function removeEntity(_0x565d6e,_0x3b0dd8){return function(_0x41c1bd){if(_0x41c1bd){return _0x41c1bd[_0x7965('0x28')]()[_0x7965('0x29')](function(){_0x565d6e[_0x7965('0x1c')](0xcc)[_0x7965('0x1d')]();});}};}function handleEntityNotFound(_0x4ad698,_0x200850){return function(_0x273e4b){if(!_0x273e4b){_0x4ad698[_0x7965('0x1b')](0x194);}return _0x273e4b;};}function handleError(_0x11c549,_0x142976){_0x142976=_0x142976||0x1f4;return function(_0xc1aaed){logger['error'](_0xc1aaed[_0x7965('0x2a')]);if(_0xc1aaed[_0x7965('0x2b')]){delete _0xc1aaed[_0x7965('0x2b')];}_0x11c549[_0x7965('0x1c')](_0x142976)[_0x7965('0x2c')](_0xc1aaed);};}exports[_0x7965('0x2d')]=function(_0x1e1fbd,_0x499dc0){var _0x274eb6={},_0x9982a6={},_0x2ef65c={'count':0x0,'rows':[]};var _0x10225b=_[_0x7965('0x2e')](db['SugarcrmConfiguration'][_0x7965('0x2f')],function(_0x21b473){return{'name':_0x21b473[_0x7965('0x30')],'type':_0x21b473['type'][_0x7965('0x31')]};});_0x9982a6[_0x7965('0x32')]=_[_0x7965('0x2e')](_0x10225b,_0x7965('0x2b'));_0x9982a6['query']=_[_0x7965('0x33')](_0x1e1fbd[_0x7965('0x34')]);_0x9982a6[_0x7965('0x35')]=_[_0x7965('0x36')](_0x9982a6[_0x7965('0x32')],_0x9982a6[_0x7965('0x34')]);_0x274eb6['attributes']=_['intersection'](_0x9982a6[_0x7965('0x32')],qs[_0x7965('0x37')](_0x1e1fbd[_0x7965('0x34')][_0x7965('0x37')]));_0x274eb6[_0x7965('0x38')]=_0x274eb6[_0x7965('0x38')][_0x7965('0x39')]?_0x274eb6[_0x7965('0x38')]:_0x9982a6[_0x7965('0x32')];if(!_0x1e1fbd[_0x7965('0x34')][_0x7965('0x3a')](_0x7965('0x3b'))){_0x274eb6[_0x7965('0x20')]=qs['limit'](_0x1e1fbd[_0x7965('0x34')][_0x7965('0x20')]);_0x274eb6[_0x7965('0x22')]=qs[_0x7965('0x22')](_0x1e1fbd[_0x7965('0x34')]['offset']);}_0x274eb6[_0x7965('0x3c')]=qs[_0x7965('0x3d')](_0x1e1fbd[_0x7965('0x34')][_0x7965('0x3d')]);_0x274eb6[_0x7965('0x3e')]=qs['filters'](_[_0x7965('0x3f')](_0x1e1fbd[_0x7965('0x34')],_0x9982a6['filters']),_0x10225b);if(_0x1e1fbd[_0x7965('0x34')]['filter']){_0x274eb6[_0x7965('0x3e')]=_[_0x7965('0x40')](_0x274eb6[_0x7965('0x3e')],{'$or':_[_0x7965('0x2e')](_0x10225b,function(_0x3945aa){if(_0x3945aa[_0x7965('0x41')]!==_0x7965('0x42')){var _0x4250eb={};_0x4250eb[_0x3945aa['name']]={'$like':'%'+_0x1e1fbd[_0x7965('0x34')]['filter']+'%'};return _0x4250eb;}})});}_0x274eb6=_[_0x7965('0x40')]({},_0x274eb6,_0x1e1fbd['options']);var _0x45119e={'where':_0x274eb6[_0x7965('0x3e')]};return db[_0x7965('0x43')][_0x7965('0x21')](_0x45119e)[_0x7965('0x29')](function(_0x31221e){_0x2ef65c[_0x7965('0x21')]=_0x31221e;if(_0x1e1fbd['query']['includeAll']){_0x274eb6[_0x7965('0x44')]=[{'all':!![]}];}return db[_0x7965('0x43')][_0x7965('0x45')](_0x274eb6);})[_0x7965('0x29')](function(_0x1473ac){_0x2ef65c[_0x7965('0x46')]=_0x1473ac;return _0x2ef65c;})[_0x7965('0x29')](respondWithFilteredResult(_0x499dc0,_0x274eb6))[_0x7965('0x47')](handleError(_0x499dc0,null));};exports[_0x7965('0x48')]=function(_0xc1e7ed,_0x3396b8){var _0xe5c4ce={'raw':![],'where':{'id':_0xc1e7ed['params']['id']}},_0x42feeb={};_0x42feeb[_0x7965('0x32')]=_[_0x7965('0x33')](db['SugarcrmConfiguration']['rawAttributes']);_0x42feeb[_0x7965('0x34')]=_[_0x7965('0x33')](_0xc1e7ed[_0x7965('0x34')]);_0x42feeb[_0x7965('0x35')]=_['intersection'](_0x42feeb['model'],_0x42feeb[_0x7965('0x34')]);_0xe5c4ce['attributes']=_['intersection'](_0x42feeb['model'],qs[_0x7965('0x37')](_0xc1e7ed[_0x7965('0x34')]['fields']));_0xe5c4ce[_0x7965('0x38')]=_0xe5c4ce[_0x7965('0x38')][_0x7965('0x39')]?_0xe5c4ce[_0x7965('0x38')]:_0x42feeb[_0x7965('0x32')];if(_0xc1e7ed['query'][_0x7965('0x49')]){_0xe5c4ce['include']=[{'all':!![]}];}_0xe5c4ce=_[_0x7965('0x40')]({},_0xe5c4ce,_0xc1e7ed[_0x7965('0x4a')]);return db[_0x7965('0x43')][_0x7965('0x4b')](_0xe5c4ce)['then'](handleEntityNotFound(_0x3396b8,null))['then'](respondWithResult(_0x3396b8,null))[_0x7965('0x47')](handleError(_0x3396b8,null));};exports[_0x7965('0x4c')]=function(_0x1e0abd,_0x1f3369){return db[_0x7965('0x43')][_0x7965('0x4c')](_0x1e0abd[_0x7965('0x4d')],{})[_0x7965('0x29')](respondWithResult(_0x1f3369,0xc9))['catch'](handleError(_0x1f3369,null));};exports[_0x7965('0x27')]=function(_0x12c30e,_0x40d5e2){if(_0x12c30e[_0x7965('0x4d')]['id']){delete _0x12c30e[_0x7965('0x4d')]['id'];}return db[_0x7965('0x43')][_0x7965('0x4b')]({'where':{'id':_0x12c30e[_0x7965('0x4e')]['id']}})[_0x7965('0x29')](handleEntityNotFound(_0x40d5e2,null))['then'](saveUpdates(_0x12c30e[_0x7965('0x4d')],null))[_0x7965('0x29')](respondWithResult(_0x40d5e2,null))[_0x7965('0x47')](handleError(_0x40d5e2,null));};exports[_0x7965('0x28')]=function(_0x8b558e,_0x3b1f7e){return db['SugarcrmConfiguration'][_0x7965('0x4b')]({'where':{'id':_0x8b558e[_0x7965('0x4e')]['id']}})[_0x7965('0x29')](handleEntityNotFound(_0x3b1f7e,null))[_0x7965('0x29')](removeEntity(_0x3b1f7e,null))[_0x7965('0x47')](handleError(_0x3b1f7e,null));};exports[_0x7965('0x4f')]=function(_0x11928f,_0x41b362,_0x3352c5){var _0x3bf1eb={};var _0x1a6acd={};var _0x901146;var _0x2ce75f;return db[_0x7965('0x43')][_0x7965('0x50')]({'where':{'id':_0x11928f['params']['id']}})[_0x7965('0x29')](handleEntityNotFound(_0x41b362,null))[_0x7965('0x29')](function(_0x42a104){if(_0x42a104){_0x901146=_0x42a104;_0x1a6acd[_0x7965('0x32')]=_[_0x7965('0x33')](db['SugarcrmField'][_0x7965('0x2f')]);_0x1a6acd[_0x7965('0x34')]=_['keys'](_0x11928f[_0x7965('0x34')]);_0x1a6acd[_0x7965('0x35')]=_['intersection'](_0x1a6acd['model'],_0x1a6acd[_0x7965('0x34')]);_0x3bf1eb[_0x7965('0x38')]=_['intersection'](_0x1a6acd[_0x7965('0x32')],qs[_0x7965('0x37')](_0x11928f[_0x7965('0x34')][_0x7965('0x37')]));_0x3bf1eb['attributes']=_0x3bf1eb[_0x7965('0x38')][_0x7965('0x39')]?_0x3bf1eb[_0x7965('0x38')]:_0x1a6acd[_0x7965('0x32')];_0x3bf1eb[_0x7965('0x3c')]=qs[_0x7965('0x3d')](_0x11928f[_0x7965('0x34')][_0x7965('0x3d')]);_0x3bf1eb[_0x7965('0x3e')]=qs[_0x7965('0x35')](_[_0x7965('0x3f')](_0x11928f['query'],_0x1a6acd[_0x7965('0x35')]));if(_0x11928f[_0x7965('0x34')][_0x7965('0x51')]){_0x3bf1eb['where']=_['merge'](_0x3bf1eb[_0x7965('0x3e')],{'$or':_['map'](_0x3bf1eb[_0x7965('0x38')],function(_0x39f0f2){var _0x1f5e4a={};_0x1f5e4a[_0x39f0f2]={'$like':'%'+_0x11928f['query'][_0x7965('0x51')]+'%'};return _0x1f5e4a;})});}_0x3bf1eb=_['merge']({},_0x3bf1eb,_0x11928f['options']);return _0x901146[_0x7965('0x4f')](_0x3bf1eb);}})['then'](function(_0x1cae03){if(_0x1cae03){_0x2ce75f=_0x1cae03[_0x7965('0x39')];if(!_0x11928f['query']['hasOwnProperty'](_0x7965('0x3b'))){_0x3bf1eb[_0x7965('0x20')]=qs[_0x7965('0x20')](_0x11928f['query'][_0x7965('0x20')]);_0x3bf1eb[_0x7965('0x22')]=qs[_0x7965('0x22')](_0x11928f['query'][_0x7965('0x22')]);}return _0x901146[_0x7965('0x4f')](_0x3bf1eb);}})[_0x7965('0x29')](function(_0x291bfb){if(_0x291bfb){return _0x291bfb?{'count':_0x2ce75f,'rows':_0x291bfb}:null;}})[_0x7965('0x29')](respondWithResult(_0x41b362,null))['catch'](handleError(_0x41b362,null));};exports[_0x7965('0x52')]=function(_0x25aad3,_0x5c527f,_0x2995df){var _0xd09867={};var _0x60c775={};var _0x14fa74;var _0x20f21d;return db[_0x7965('0x43')][_0x7965('0x50')]({'where':{'id':_0x25aad3[_0x7965('0x4e')]['id']}})[_0x7965('0x29')](handleEntityNotFound(_0x5c527f,null))[_0x7965('0x29')](function(_0x4ff40a){if(_0x4ff40a){_0x14fa74=_0x4ff40a;_0x60c775[_0x7965('0x32')]=_[_0x7965('0x33')](db[_0x7965('0x53')][_0x7965('0x2f')]);_0x60c775[_0x7965('0x34')]=_[_0x7965('0x33')](_0x25aad3[_0x7965('0x34')]);_0x60c775[_0x7965('0x35')]=_[_0x7965('0x36')](_0x60c775['model'],_0x60c775[_0x7965('0x34')]);_0xd09867[_0x7965('0x38')]=_[_0x7965('0x36')](_0x60c775[_0x7965('0x32')],qs[_0x7965('0x37')](_0x25aad3[_0x7965('0x34')][_0x7965('0x37')]));_0xd09867[_0x7965('0x38')]=_0xd09867[_0x7965('0x38')][_0x7965('0x39')]?_0xd09867[_0x7965('0x38')]:_0x60c775[_0x7965('0x32')];_0xd09867[_0x7965('0x3c')]=qs[_0x7965('0x3d')](_0x25aad3[_0x7965('0x34')]['sort']);_0xd09867[_0x7965('0x3e')]=qs[_0x7965('0x35')](_[_0x7965('0x3f')](_0x25aad3['query'],_0x60c775['filters']));if(_0x25aad3[_0x7965('0x34')][_0x7965('0x51')]){_0xd09867[_0x7965('0x3e')]=_[_0x7965('0x40')](_0xd09867['where'],{'$or':_['map'](_0xd09867[_0x7965('0x38')],function(_0xab8f54){var _0x3101b1={};_0x3101b1[_0xab8f54]={'$like':'%'+_0x25aad3['query'][_0x7965('0x51')]+'%'};return _0x3101b1;})});}_0xd09867=_['merge']({},_0xd09867,_0x25aad3[_0x7965('0x4a')]);return _0x14fa74[_0x7965('0x52')](_0xd09867);}})[_0x7965('0x29')](function(_0x2d7bd5){if(_0x2d7bd5){_0x20f21d=_0x2d7bd5[_0x7965('0x39')];if(!_0x25aad3[_0x7965('0x34')]['hasOwnProperty'](_0x7965('0x3b'))){_0xd09867['limit']=qs[_0x7965('0x20')](_0x25aad3[_0x7965('0x34')][_0x7965('0x20')]);_0xd09867[_0x7965('0x22')]=qs[_0x7965('0x22')](_0x25aad3['query'][_0x7965('0x22')]);}return _0x14fa74[_0x7965('0x52')](_0xd09867);}})['then'](function(_0x43103d){if(_0x43103d){return _0x43103d?{'count':_0x20f21d,'rows':_0x43103d}:null;}})[_0x7965('0x29')](respondWithResult(_0x5c527f,null))[_0x7965('0x47')](handleError(_0x5c527f,null));};exports[_0x7965('0x54')]=function(_0x3e6024,_0x3dddd7,_0x29ac9e){var _0x40d3e0={};var _0x1f03a7={};var _0x1bd06a;var _0xe024f9;return db['SugarcrmConfiguration'][_0x7965('0x50')]({'where':{'id':_0x3e6024[_0x7965('0x4e')]['id']}})[_0x7965('0x29')](handleEntityNotFound(_0x3dddd7,null))[_0x7965('0x29')](function(_0x40509c){if(_0x40509c){_0x1bd06a=_0x40509c;_0x1f03a7[_0x7965('0x32')]=_['keys'](db[_0x7965('0x53')][_0x7965('0x2f')]);_0x1f03a7[_0x7965('0x34')]=_[_0x7965('0x33')](_0x3e6024['query']);_0x1f03a7['filters']=_[_0x7965('0x36')](_0x1f03a7[_0x7965('0x32')],_0x1f03a7['query']);_0x40d3e0[_0x7965('0x38')]=_[_0x7965('0x36')](_0x1f03a7['model'],qs[_0x7965('0x37')](_0x3e6024[_0x7965('0x34')][_0x7965('0x37')]));_0x40d3e0[_0x7965('0x38')]=_0x40d3e0[_0x7965('0x38')][_0x7965('0x39')]?_0x40d3e0[_0x7965('0x38')]:_0x1f03a7[_0x7965('0x32')];_0x40d3e0[_0x7965('0x3c')]=qs[_0x7965('0x3d')](_0x3e6024['query'][_0x7965('0x3d')]);_0x40d3e0['where']=qs[_0x7965('0x35')](_[_0x7965('0x3f')](_0x3e6024['query'],_0x1f03a7['filters']));if(_0x3e6024[_0x7965('0x34')][_0x7965('0x51')]){_0x40d3e0[_0x7965('0x3e')]=_[_0x7965('0x40')](_0x40d3e0[_0x7965('0x3e')],{'$or':_[_0x7965('0x2e')](_0x40d3e0[_0x7965('0x38')],function(_0x34b46e){var _0xdf51d1={};_0xdf51d1[_0x34b46e]={'$like':'%'+_0x3e6024['query'][_0x7965('0x51')]+'%'};return _0xdf51d1;})});}_0x40d3e0=_[_0x7965('0x40')]({},_0x40d3e0,_0x3e6024['options']);return _0x1bd06a['getDescriptions'](_0x40d3e0);}})[_0x7965('0x29')](function(_0x262afe){if(_0x262afe){_0xe024f9=_0x262afe['length'];if(!_0x3e6024[_0x7965('0x34')]['hasOwnProperty'](_0x7965('0x3b'))){_0x40d3e0[_0x7965('0x20')]=qs[_0x7965('0x20')](_0x3e6024[_0x7965('0x34')][_0x7965('0x20')]);_0x40d3e0['offset']=qs[_0x7965('0x22')](_0x3e6024[_0x7965('0x34')][_0x7965('0x22')]);}return _0x1bd06a[_0x7965('0x54')](_0x40d3e0);}})[_0x7965('0x29')](function(_0x4f4bbc){if(_0x4f4bbc){return _0x4f4bbc?{'count':_0xe024f9,'rows':_0x4f4bbc}:null;}})[_0x7965('0x29')](respondWithResult(_0x3dddd7,null))['catch'](handleError(_0x3dddd7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6157a8b..7a80280 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 _0x6515=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x3b96b3,_0x1d571b){var _0x4a510d=function(_0x37dbee){while(--_0x37dbee){_0x3b96b3['push'](_0x3b96b3['shift']());}};_0x4a510d(++_0x1d571b);}(_0x6515,0x117));var _0x5651=function(_0x31fa8b,_0x2ea3c0){_0x31fa8b=_0x31fa8b-0x0;var _0x2abaa=_0x6515[_0x31fa8b];return _0x2abaa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5651('0x0'))('api');var moment=require(_0x5651('0x1'));var BPromise=require(_0x5651('0x2'));var rp=require(_0x5651('0x3'));var fs=require('fs');var path=require(_0x5651('0x4'));var rimraf=require(_0x5651('0x5'));var config=require('../../config/environment');var attributes=require(_0x5651('0x6'));module[_0x5651('0x7')]=function(_0x1aa3b0,_0x381757){return _0x1aa3b0['define'](_0x5651('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b1f=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x6ff984,_0x52fbd1){var _0x1b8400=function(_0x15ce8c){while(--_0x15ce8c){_0x6ff984['push'](_0x6ff984['shift']());}};_0x1b8400(++_0x52fbd1);}(_0x6b1f,0x8e));var _0xf6b1=function(_0x54ded6,_0x4eeb65){_0x54ded6=_0x54ded6-0x0;var _0x470a87=_0x6b1f[_0x54ded6];return _0x470a87;};'use strict';var _=require('lodash');var util=require(_0xf6b1('0x0'));var logger=require(_0xf6b1('0x1'))(_0xf6b1('0x2'));var moment=require('moment');var BPromise=require(_0xf6b1('0x3'));var rp=require(_0xf6b1('0x4'));var fs=require('fs');var path=require(_0xf6b1('0x5'));var rimraf=require('rimraf');var config=require(_0xf6b1('0x6'));var attributes=require(_0xf6b1('0x7'));module['exports']=function(_0x2405d3,_0x2f51f5){return _0x2405d3['define']('SugarcrmConfiguration',attributes,{'tableName':_0xf6b1('0x8'),'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 9fb6605..5db7eca 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 _0xe801=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xe801,0x97));var _0x1e80=function(_0x3fee9a,_0x25c176){_0x3fee9a=_0x3fee9a-0x0;var _0xbe4355=_0xe801[_0x3fee9a];return _0xbe4355;};'use strict';var _=require('lodash');var util=require(_0x1e80('0x0'));var moment=require('moment');var BPromise=require(_0x1e80('0x1'));var rs=require(_0x1e80('0x2'));var fs=require('fs');var Redis=require(_0x1e80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e80('0x4'));var logger=require(_0x1e80('0x5'))(_0x1e80('0x6'));var config=require(_0x1e80('0x7'));var jayson=require(_0x1e80('0x8'));var client=jayson['client'][_0x1e80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11af92,_0x20a3c6,_0x48bdb2){return new BPromise(function(_0x1474a0,_0x1ff0ea){return client[_0x1e80('0xa')](_0x11af92,_0x48bdb2)[_0x1e80('0xb')](function(_0x282bf7){logger[_0x1e80('0xc')](_0x1e80('0xd'),_0x20a3c6,_0x1e80('0xe'));logger[_0x1e80('0xf')](_0x1e80('0x10'),_0x20a3c6,_0x1e80('0xe'),JSON[_0x1e80('0x11')](_0x282bf7));if(_0x282bf7[_0x1e80('0x12')]){if(_0x282bf7[_0x1e80('0x12')][_0x1e80('0x13')]===0x1f4){logger[_0x1e80('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x20a3c6,_0x282bf7[_0x1e80('0x12')][_0x1e80('0x14')]);return _0x1ff0ea(_0x282bf7[_0x1e80('0x12')][_0x1e80('0x14')]);}logger[_0x1e80('0x12')](_0x1e80('0xd'),_0x20a3c6,_0x282bf7[_0x1e80('0x12')][_0x1e80('0x14')]);return _0x1474a0(_0x282bf7[_0x1e80('0x12')]['message']);}else{logger[_0x1e80('0xc')](_0x1e80('0xd'),_0x20a3c6,_0x1e80('0xe'));_0x1474a0(_0x282bf7[_0x1e80('0x15')][_0x1e80('0x14')]);}})[_0x1e80('0x16')](function(_0xb5932c){logger['error'](_0x1e80('0xd'),_0x20a3c6,_0xb5932c);_0x1ff0ea(_0xb5932c);});});} \ No newline at end of file +var _0x03b7=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x131fe7,_0x21fcdb){var _0x2eddf3=function(_0x1be350){while(--_0x1be350){_0x131fe7['push'](_0x131fe7['shift']());}};_0x2eddf3(++_0x21fcdb);}(_0x03b7,0x6d));var _0x703b=function(_0x36fbf7,_0x3dfeb2){_0x36fbf7=_0x36fbf7-0x0;var _0x2fa1a5=_0x03b7[_0x36fbf7];return _0x2fa1a5;};'use strict';var _=require(_0x703b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x703b('0x1'));var rs=require(_0x703b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x703b('0x3'))['db'];var utils=require(_0x703b('0x4'));var logger=require(_0x703b('0x5'))('rpc');var config=require(_0x703b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x703b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35dd09,_0x4c73b4,_0x3865c5){return new BPromise(function(_0x3bd606,_0x1daacf){return client[_0x703b('0x8')](_0x35dd09,_0x3865c5)[_0x703b('0x9')](function(_0x3fae42){logger[_0x703b('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4c73b4,_0x703b('0xb'));logger[_0x703b('0xc')](_0x703b('0xd'),_0x4c73b4,_0x703b('0xb'),JSON[_0x703b('0xe')](_0x3fae42));if(_0x3fae42[_0x703b('0xf')]){if(_0x3fae42[_0x703b('0xf')]['code']===0x1f4){logger[_0x703b('0xf')](_0x703b('0x10'),_0x4c73b4,_0x3fae42[_0x703b('0xf')][_0x703b('0x11')]);return _0x1daacf(_0x3fae42[_0x703b('0xf')][_0x703b('0x11')]);}logger[_0x703b('0xf')](_0x703b('0x10'),_0x4c73b4,_0x3fae42['error']['message']);return _0x3bd606(_0x3fae42[_0x703b('0xf')][_0x703b('0x11')]);}else{logger[_0x703b('0xa')](_0x703b('0x10'),_0x4c73b4,_0x703b('0xb'));_0x3bd606(_0x3fae42[_0x703b('0x12')]['message']);}})[_0x703b('0x13')](function(_0x199414){logger[_0x703b('0xf')](_0x703b('0x10'),_0x4c73b4,_0x199414);_0x1daacf(_0x199414);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 7698716..e6c6691 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 _0xc63c=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','put','delete','exports','multer'];(function(_0x2b9f06,_0x5daef7){var _0x2ce344=function(_0x4b622a){while(--_0x4b622a){_0x2b9f06['push'](_0x2b9f06['shift']());}};_0x2ce344(++_0x5daef7);}(_0xc63c,0xa9));var _0xcc63=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xc63c[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0xcc63('0x0'));var util=require('util');var path=require(_0xcc63('0x1'));var timeout=require(_0xcc63('0x2'));var express=require('express');var router=express[_0xcc63('0x3')]();var fs_extra=require(_0xcc63('0x4'));var auth=require(_0xcc63('0x5'));var interaction=require(_0xcc63('0x6'));var config=require(_0xcc63('0x7'));var controller=require(_0xcc63('0x8'));router['get']('/',auth[_0xcc63('0x9')](),controller[_0xcc63('0xa')]);router[_0xcc63('0xb')](_0xcc63('0xc'),auth[_0xcc63('0x9')](),controller[_0xcc63('0xd')]);router['post']('/',auth[_0xcc63('0x9')](),controller['create']);router[_0xcc63('0xe')](_0xcc63('0xc'),auth[_0xcc63('0x9')](),controller['update']);router[_0xcc63('0xf')](_0xcc63('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc63('0x10')]=router; \ No newline at end of file +var _0x279a=['get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x2d0518,_0x49e5e6){var _0x429a3b=function(_0x288ce6){while(--_0x288ce6){_0x2d0518['push'](_0x2d0518['shift']());}};_0x429a3b(++_0x49e5e6);}(_0x279a,0x1b9));var _0xa279=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x279a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa279('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa279('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa279('0x2'));var auth=require(_0xa279('0x3'));var interaction=require(_0xa279('0x4'));var config=require(_0xa279('0x5'));var controller=require(_0xa279('0x6'));router[_0xa279('0x7')]('/',auth[_0xa279('0x8')](),controller['index']);router[_0xa279('0x7')](_0xa279('0x9'),auth[_0xa279('0x8')](),controller[_0xa279('0xa')]);router[_0xa279('0xb')]('/',auth[_0xa279('0x8')](),controller['create']);router[_0xa279('0xc')](_0xa279('0x9'),auth[_0xa279('0x8')](),controller['update']);router[_0xa279('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa279('0xe')]);module[_0xa279('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4021168..6f9fc0c 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 _0x265b=['customVariable','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x3fdd55,_0x291f46){var _0x226472=function(_0x552183){while(--_0x552183){_0x3fdd55['push'](_0x3fdd55['shift']());}};_0x226472(++_0x291f46);}(_0x265b,0x16d));var _0xb265=function(_0x58711d,_0x3dc0e9){_0x58711d=_0x58711d-0x0;var _0x5dfb60=_0x265b[_0x58711d];return _0x5dfb60;};'use strict';var Sequelize=require(_0xb265('0x0'));module['exports']={'type':{'type':Sequelize[_0xb265('0x1')](_0xb265('0x2'),'variable',_0xb265('0x3'),'keyValue',_0xb265('0x4')),'defaultValue':_0xb265('0x2')},'content':{'type':Sequelize[_0xb265('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb265('0x1')](_0xb265('0x2'),_0xb265('0x6'),_0xb265('0x3'))},'keyContent':{'type':Sequelize[_0xb265('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb265('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8092=['keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x16c2b1,_0x36a70c){var _0x199ac4=function(_0x2f1802){while(--_0x2f1802){_0x16c2b1['push'](_0x16c2b1['shift']());}};_0x199ac4(++_0x36a70c);}(_0x8092,0xd3));var _0x2809=function(_0x570257,_0x28cc7e){_0x570257=_0x570257-0x0;var _0x2f70f0=_0x8092[_0x570257];return _0x2f70f0;};'use strict';var Sequelize=require(_0x2809('0x0'));module[_0x2809('0x1')]={'type':{'type':Sequelize[_0x2809('0x2')](_0x2809('0x3'),'variable',_0x2809('0x4'),_0x2809('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2809('0x6')]},'key':{'type':Sequelize[_0x2809('0x6')]},'keyType':{'type':Sequelize[_0x2809('0x2')]('string',_0x2809('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2809('0x6')]},'customField':{'type':Sequelize[_0x2809('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2809('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8153dab..c68cc68 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 _0x7bee=['filters','pick','filter','merge','VIRTUAL','SugarcrmField','findAll','rows','catch','show','params','include','options','find','create','body','rimraf','zip-dir','fast-json-patch','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','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','rawAttributes','fieldName','type','key','keys','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x18300e,_0x4ce957){var _0x4044f8=function(_0x544588){while(--_0x544588){_0x18300e['push'](_0x18300e['shift']());}};_0x4044f8(++_0x4ce957);}(_0x7bee,0xf4));var _0xe7be=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7bee[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7be('0x0'));var zipdir=require(_0xe7be('0x1'));var jsonpatch=require(_0xe7be('0x2'));var rp=require(_0xe7be('0x3'));var moment=require('moment');var BPromise=require(_0xe7be('0x4'));var Mustache=require(_0xe7be('0x5'));var util=require(_0xe7be('0x6'));var path=require(_0xe7be('0x7'));var sox=require(_0xe7be('0x8'));var csv=require(_0xe7be('0x9'));var ejs=require(_0xe7be('0xa'));var fs=require('fs');var fs_extra=require(_0xe7be('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe7be('0xc'));var jsforce=require(_0xe7be('0xd'));var deskjs=require(_0xe7be('0xe'));var toCsv=require(_0xe7be('0x9'));var querystring=require(_0xe7be('0xf'));var Papa=require(_0xe7be('0x10'));var Redis=require(_0xe7be('0x11'));var authService=require(_0xe7be('0x12'));var qs=require(_0xe7be('0x13'));var as=require(_0xe7be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7be('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe7be('0x16'));var licenseUtil=require(_0xe7be('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x387d75,_0x334d50){_0x334d50=_0x334d50||0xcc;return function(_0x44a40c){if(_0x44a40c){return _0x387d75[_0xe7be('0x18')](_0x334d50);}return _0x387d75[_0xe7be('0x19')](_0x334d50)[_0xe7be('0x1a')]();};}function respondWithResult(_0xac4631,_0x3f92d8){_0x3f92d8=_0x3f92d8||0xc8;return function(_0x5f0ea1){if(_0x5f0ea1){return _0xac4631[_0xe7be('0x19')](_0x3f92d8)[_0xe7be('0x1b')](_0x5f0ea1);}};}function respondWithFilteredResult(_0xa7d808,_0x19e864){return function(_0x33df4f){if(_0x33df4f){var _0x28e84d=typeof _0x19e864[_0xe7be('0x1c')]==='undefined'&&typeof _0x19e864[_0xe7be('0x1d')]===_0xe7be('0x1e');var _0x25ffcc=_0x33df4f[_0xe7be('0x1f')];var _0x9e172a=_0x28e84d?0x0:_0x19e864[_0xe7be('0x1c')];var _0x227457=_0x28e84d?_0x33df4f['count']:_0x19e864[_0xe7be('0x1c')]+_0x19e864[_0xe7be('0x1d')];var _0xc2a7d6;if(_0x227457>=_0x25ffcc){_0x227457=_0x25ffcc;_0xc2a7d6=0xc8;}else{_0xc2a7d6=0xce;}_0xa7d808['status'](_0xc2a7d6);return _0xa7d808[_0xe7be('0x20')](_0xe7be('0x21'),_0x9e172a+'-'+_0x227457+'/'+_0x25ffcc)['json'](_0x33df4f);}return null;};}function patchUpdates(_0x25c94e){return function(_0x4c56e4){try{jsonpatch[_0xe7be('0x22')](_0x4c56e4,_0x25c94e,!![]);}catch(_0x18bd5b){return BPromise[_0xe7be('0x23')](_0x18bd5b);}return _0x4c56e4[_0xe7be('0x24')]();};}function saveUpdates(_0x171f05,_0x11da6e){return function(_0x2f1eb2){if(_0x2f1eb2){return _0x2f1eb2[_0xe7be('0x25')](_0x171f05)['then'](function(_0x2cd9e0){return _0x2cd9e0;});}return null;};}function removeEntity(_0x2f22ce,_0x25793b){return function(_0x179e9e){if(_0x179e9e){return _0x179e9e[_0xe7be('0x26')]()[_0xe7be('0x27')](function(){_0x2f22ce[_0xe7be('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18a5b2,_0x597750){return function(_0x2d7781){if(!_0x2d7781){_0x18a5b2['sendStatus'](0x194);}return _0x2d7781;};}function handleError(_0x157924,_0xd54857){_0xd54857=_0xd54857||0x1f4;return function(_0x5967f5){logger[_0xe7be('0x28')](_0x5967f5['stack']);if(_0x5967f5[_0xe7be('0x29')]){delete _0x5967f5[_0xe7be('0x29')];}_0x157924[_0xe7be('0x19')](_0xd54857)['send'](_0x5967f5);};}exports[_0xe7be('0x2a')]=function(_0x53e53e,_0x76f9ce){var _0x133072={},_0x29d6d3={},_0x594340={'count':0x0,'rows':[]};var _0x2984dc=_[_0xe7be('0x2b')](db['SugarcrmField'][_0xe7be('0x2c')],function(_0x527864){return{'name':_0x527864[_0xe7be('0x2d')],'type':_0x527864[_0xe7be('0x2e')][_0xe7be('0x2f')]};});_0x29d6d3['model']=_['map'](_0x2984dc,_0xe7be('0x29'));_0x29d6d3['query']=_[_0xe7be('0x30')](_0x53e53e['query']);_0x29d6d3['filters']=_[_0xe7be('0x31')](_0x29d6d3[_0xe7be('0x32')],_0x29d6d3['query']);_0x133072['attributes']=_[_0xe7be('0x31')](_0x29d6d3[_0xe7be('0x32')],qs[_0xe7be('0x33')](_0x53e53e[_0xe7be('0x34')][_0xe7be('0x33')]));_0x133072[_0xe7be('0x35')]=_0x133072[_0xe7be('0x35')][_0xe7be('0x36')]?_0x133072[_0xe7be('0x35')]:_0x29d6d3[_0xe7be('0x32')];if(!_0x53e53e[_0xe7be('0x34')][_0xe7be('0x37')](_0xe7be('0x38'))){_0x133072['limit']=qs[_0xe7be('0x1d')](_0x53e53e[_0xe7be('0x34')][_0xe7be('0x1d')]);_0x133072[_0xe7be('0x1c')]=qs[_0xe7be('0x1c')](_0x53e53e['query'][_0xe7be('0x1c')]);}_0x133072[_0xe7be('0x39')]=qs[_0xe7be('0x3a')](_0x53e53e['query'][_0xe7be('0x3a')]);_0x133072[_0xe7be('0x3b')]=qs[_0xe7be('0x3c')](_[_0xe7be('0x3d')](_0x53e53e['query'],_0x29d6d3[_0xe7be('0x3c')]),_0x2984dc);if(_0x53e53e[_0xe7be('0x34')][_0xe7be('0x3e')]){_0x133072[_0xe7be('0x3b')]=_[_0xe7be('0x3f')](_0x133072['where'],{'$or':_[_0xe7be('0x2b')](_0x2984dc,function(_0x2e0b76){if(_0x2e0b76[_0xe7be('0x2e')]!==_0xe7be('0x40')){var _0x2eae12={};_0x2eae12[_0x2e0b76[_0xe7be('0x29')]]={'$like':'%'+_0x53e53e[_0xe7be('0x34')][_0xe7be('0x3e')]+'%'};return _0x2eae12;}})});}_0x133072=_[_0xe7be('0x3f')]({},_0x133072,_0x53e53e['options']);var _0x24a56b={'where':_0x133072[_0xe7be('0x3b')]};return db['SugarcrmField'][_0xe7be('0x1f')](_0x24a56b)[_0xe7be('0x27')](function(_0x253fd4){_0x594340[_0xe7be('0x1f')]=_0x253fd4;if(_0x53e53e[_0xe7be('0x34')]['includeAll']){_0x133072['include']=[{'all':!![]}];}return db[_0xe7be('0x41')][_0xe7be('0x42')](_0x133072);})[_0xe7be('0x27')](function(_0x19caac){_0x594340[_0xe7be('0x43')]=_0x19caac;return _0x594340;})[_0xe7be('0x27')](respondWithFilteredResult(_0x76f9ce,_0x133072))[_0xe7be('0x44')](handleError(_0x76f9ce,null));};exports[_0xe7be('0x45')]=function(_0x5e4363,_0x3a1db0){var _0x5b5583={'raw':!![],'where':{'id':_0x5e4363[_0xe7be('0x46')]['id']}},_0x505f2b={};_0x505f2b['model']=_[_0xe7be('0x30')](db[_0xe7be('0x41')][_0xe7be('0x2c')]);_0x505f2b['query']=_[_0xe7be('0x30')](_0x5e4363[_0xe7be('0x34')]);_0x505f2b[_0xe7be('0x3c')]=_[_0xe7be('0x31')](_0x505f2b['model'],_0x505f2b[_0xe7be('0x34')]);_0x5b5583['attributes']=_['intersection'](_0x505f2b[_0xe7be('0x32')],qs[_0xe7be('0x33')](_0x5e4363[_0xe7be('0x34')]['fields']));_0x5b5583[_0xe7be('0x35')]=_0x5b5583['attributes'][_0xe7be('0x36')]?_0x5b5583[_0xe7be('0x35')]:_0x505f2b[_0xe7be('0x32')];if(_0x5e4363[_0xe7be('0x34')]['includeAll']){_0x5b5583[_0xe7be('0x47')]=[{'all':!![]}];}_0x5b5583=_[_0xe7be('0x3f')]({},_0x5b5583,_0x5e4363[_0xe7be('0x48')]);return db['SugarcrmField'][_0xe7be('0x49')](_0x5b5583)[_0xe7be('0x27')](handleEntityNotFound(_0x3a1db0,null))[_0xe7be('0x27')](respondWithResult(_0x3a1db0,null))[_0xe7be('0x44')](handleError(_0x3a1db0,null));};exports[_0xe7be('0x4a')]=function(_0x50c58c,_0x410b4e){return db[_0xe7be('0x41')][_0xe7be('0x4a')](_0x50c58c[_0xe7be('0x4b')],{})['then'](respondWithResult(_0x410b4e,0xc9))[_0xe7be('0x44')](handleError(_0x410b4e,null));};exports[_0xe7be('0x25')]=function(_0x517798,_0x22c8b1){if(_0x517798[_0xe7be('0x4b')]['id']){delete _0x517798[_0xe7be('0x4b')]['id'];}return db[_0xe7be('0x41')][_0xe7be('0x49')]({'where':{'id':_0x517798[_0xe7be('0x46')]['id']}})[_0xe7be('0x27')](handleEntityNotFound(_0x22c8b1,null))[_0xe7be('0x27')](saveUpdates(_0x517798[_0xe7be('0x4b')],null))[_0xe7be('0x27')](respondWithResult(_0x22c8b1,null))[_0xe7be('0x44')](handleError(_0x22c8b1,null));};exports['destroy']=function(_0xc7447,_0x32cc5f){return db[_0xe7be('0x41')][_0xe7be('0x49')]({'where':{'id':_0xc7447[_0xe7be('0x46')]['id']}})[_0xe7be('0x27')](handleEntityNotFound(_0x32cc5f,null))[_0xe7be('0x27')](removeEntity(_0x32cc5f,null))['catch'](handleError(_0x32cc5f,null));}; \ No newline at end of file +var _0xca46=['model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','index','SugarcrmField','fieldName','type','key'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xca46,0x18d));var _0x6ca4=function(_0xacc42b,_0x1047d0){_0xacc42b=_0xacc42b-0x0;var _0x121b93=_0xca46[_0xacc42b];return _0x121b93;};'use strict';var emlformat=require(_0x6ca4('0x0'));var rimraf=require(_0x6ca4('0x1'));var zipdir=require(_0x6ca4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ca4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6ca4('0x4'));var sox=require(_0x6ca4('0x5'));var csv=require(_0x6ca4('0x6'));var ejs=require(_0x6ca4('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca4('0x8'));var _=require(_0x6ca4('0x9'));var squel=require(_0x6ca4('0xa'));var crypto=require(_0x6ca4('0xb'));var jsforce=require(_0x6ca4('0xc'));var deskjs=require(_0x6ca4('0xd'));var toCsv=require(_0x6ca4('0x6'));var querystring=require(_0x6ca4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6ca4('0xf'));var qs=require(_0x6ca4('0x10'));var as=require(_0x6ca4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca4('0x12'))(_0x6ca4('0x13'));var utils=require(_0x6ca4('0x14'));var config=require(_0x6ca4('0x15'));var licenseUtil=require(_0x6ca4('0x16'));var db=require(_0x6ca4('0x17'))['db'];function respondWithStatusCode(_0x1be760,_0x48613a){_0x48613a=_0x48613a||0xcc;return function(_0xb686c){if(_0xb686c){return _0x1be760['sendStatus'](_0x48613a);}return _0x1be760['status'](_0x48613a)[_0x6ca4('0x18')]();};}function respondWithResult(_0x1556d5,_0x2eb4c0){_0x2eb4c0=_0x2eb4c0||0xc8;return function(_0x386ab7){if(_0x386ab7){return _0x1556d5[_0x6ca4('0x19')](_0x2eb4c0)['json'](_0x386ab7);}};}function respondWithFilteredResult(_0x3ec6e0,_0x222df6){return function(_0x3b5035){if(_0x3b5035){var _0x5d8071=typeof _0x222df6[_0x6ca4('0x1a')]==='undefined'&&typeof _0x222df6[_0x6ca4('0x1b')]===_0x6ca4('0x1c');var _0x4fc7f9=_0x3b5035['count'];var _0x19f95e=_0x5d8071?0x0:_0x222df6['offset'];var _0x445625=_0x5d8071?_0x3b5035[_0x6ca4('0x1d')]:_0x222df6[_0x6ca4('0x1a')]+_0x222df6[_0x6ca4('0x1b')];var _0x380aba;if(_0x445625>=_0x4fc7f9){_0x445625=_0x4fc7f9;_0x380aba=0xc8;}else{_0x380aba=0xce;}_0x3ec6e0['status'](_0x380aba);return _0x3ec6e0[_0x6ca4('0x1e')](_0x6ca4('0x1f'),_0x19f95e+'-'+_0x445625+'/'+_0x4fc7f9)[_0x6ca4('0x20')](_0x3b5035);}return null;};}function patchUpdates(_0x5043c5){return function(_0x494dd0){try{jsonpatch[_0x6ca4('0x21')](_0x494dd0,_0x5043c5,!![]);}catch(_0x52a5e2){return BPromise[_0x6ca4('0x22')](_0x52a5e2);}return _0x494dd0[_0x6ca4('0x23')]();};}function saveUpdates(_0x4d8d9e,_0x1006b5){return function(_0x335ab8){if(_0x335ab8){return _0x335ab8[_0x6ca4('0x24')](_0x4d8d9e)[_0x6ca4('0x25')](function(_0x313058){return _0x313058;});}return null;};}function removeEntity(_0x26ed05,_0x25b123){return function(_0x50a720){if(_0x50a720){return _0x50a720[_0x6ca4('0x26')]()[_0x6ca4('0x25')](function(){_0x26ed05[_0x6ca4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bb806,_0x18652e){return function(_0x3e7235){if(!_0x3e7235){_0x3bb806[_0x6ca4('0x27')](0x194);}return _0x3e7235;};}function handleError(_0x54aa19,_0x5fdc27){_0x5fdc27=_0x5fdc27||0x1f4;return function(_0x11b8ad){logger[_0x6ca4('0x28')](_0x11b8ad[_0x6ca4('0x29')]);if(_0x11b8ad['name']){delete _0x11b8ad['name'];}_0x54aa19[_0x6ca4('0x19')](_0x5fdc27)['send'](_0x11b8ad);};}exports[_0x6ca4('0x2a')]=function(_0x5a2940,_0x149383){var _0x5542f5={},_0x1a31f9={},_0x220dec={'count':0x0,'rows':[]};var _0x55cd4d=_['map'](db[_0x6ca4('0x2b')]['rawAttributes'],function(_0x2570c5){return{'name':_0x2570c5[_0x6ca4('0x2c')],'type':_0x2570c5[_0x6ca4('0x2d')][_0x6ca4('0x2e')]};});_0x1a31f9[_0x6ca4('0x2f')]=_[_0x6ca4('0x30')](_0x55cd4d,_0x6ca4('0x31'));_0x1a31f9[_0x6ca4('0x32')]=_[_0x6ca4('0x33')](_0x5a2940['query']);_0x1a31f9[_0x6ca4('0x34')]=_[_0x6ca4('0x35')](_0x1a31f9['model'],_0x1a31f9['query']);_0x5542f5[_0x6ca4('0x36')]=_[_0x6ca4('0x35')](_0x1a31f9[_0x6ca4('0x2f')],qs[_0x6ca4('0x37')](_0x5a2940['query']['fields']));_0x5542f5[_0x6ca4('0x36')]=_0x5542f5[_0x6ca4('0x36')][_0x6ca4('0x38')]?_0x5542f5[_0x6ca4('0x36')]:_0x1a31f9[_0x6ca4('0x2f')];if(!_0x5a2940[_0x6ca4('0x32')][_0x6ca4('0x39')](_0x6ca4('0x3a'))){_0x5542f5[_0x6ca4('0x1b')]=qs[_0x6ca4('0x1b')](_0x5a2940[_0x6ca4('0x32')][_0x6ca4('0x1b')]);_0x5542f5['offset']=qs['offset'](_0x5a2940[_0x6ca4('0x32')]['offset']);}_0x5542f5[_0x6ca4('0x3b')]=qs[_0x6ca4('0x3c')](_0x5a2940['query'][_0x6ca4('0x3c')]);_0x5542f5['where']=qs[_0x6ca4('0x34')](_['pick'](_0x5a2940[_0x6ca4('0x32')],_0x1a31f9[_0x6ca4('0x34')]),_0x55cd4d);if(_0x5a2940[_0x6ca4('0x32')][_0x6ca4('0x3d')]){_0x5542f5[_0x6ca4('0x3e')]=_['merge'](_0x5542f5['where'],{'$or':_[_0x6ca4('0x30')](_0x55cd4d,function(_0x415b01){if(_0x415b01[_0x6ca4('0x2d')]!==_0x6ca4('0x3f')){var _0x13816f={};_0x13816f[_0x415b01[_0x6ca4('0x31')]]={'$like':'%'+_0x5a2940[_0x6ca4('0x32')][_0x6ca4('0x3d')]+'%'};return _0x13816f;}})});}_0x5542f5=_['merge']({},_0x5542f5,_0x5a2940[_0x6ca4('0x40')]);var _0xa2fad2={'where':_0x5542f5['where']};return db[_0x6ca4('0x2b')]['count'](_0xa2fad2)[_0x6ca4('0x25')](function(_0x1ad835){_0x220dec['count']=_0x1ad835;if(_0x5a2940['query'][_0x6ca4('0x41')]){_0x5542f5['include']=[{'all':!![]}];}return db[_0x6ca4('0x2b')]['findAll'](_0x5542f5);})[_0x6ca4('0x25')](function(_0x3a0da7){_0x220dec['rows']=_0x3a0da7;return _0x220dec;})['then'](respondWithFilteredResult(_0x149383,_0x5542f5))[_0x6ca4('0x42')](handleError(_0x149383,null));};exports[_0x6ca4('0x43')]=function(_0x16e944,_0x1a2cc5){var _0x1ac71e={'raw':!![],'where':{'id':_0x16e944[_0x6ca4('0x44')]['id']}},_0x546485={};_0x546485[_0x6ca4('0x2f')]=_[_0x6ca4('0x33')](db[_0x6ca4('0x2b')][_0x6ca4('0x45')]);_0x546485['query']=_[_0x6ca4('0x33')](_0x16e944[_0x6ca4('0x32')]);_0x546485[_0x6ca4('0x34')]=_[_0x6ca4('0x35')](_0x546485[_0x6ca4('0x2f')],_0x546485[_0x6ca4('0x32')]);_0x1ac71e[_0x6ca4('0x36')]=_[_0x6ca4('0x35')](_0x546485[_0x6ca4('0x2f')],qs[_0x6ca4('0x37')](_0x16e944['query'][_0x6ca4('0x37')]));_0x1ac71e[_0x6ca4('0x36')]=_0x1ac71e[_0x6ca4('0x36')][_0x6ca4('0x38')]?_0x1ac71e['attributes']:_0x546485[_0x6ca4('0x2f')];if(_0x16e944['query'][_0x6ca4('0x41')]){_0x1ac71e[_0x6ca4('0x46')]=[{'all':!![]}];}_0x1ac71e=_['merge']({},_0x1ac71e,_0x16e944['options']);return db[_0x6ca4('0x2b')][_0x6ca4('0x47')](_0x1ac71e)[_0x6ca4('0x25')](handleEntityNotFound(_0x1a2cc5,null))[_0x6ca4('0x25')](respondWithResult(_0x1a2cc5,null))[_0x6ca4('0x42')](handleError(_0x1a2cc5,null));};exports[_0x6ca4('0x48')]=function(_0x9c38aa,_0x3ea605){return db[_0x6ca4('0x2b')][_0x6ca4('0x48')](_0x9c38aa[_0x6ca4('0x49')],{})[_0x6ca4('0x25')](respondWithResult(_0x3ea605,0xc9))[_0x6ca4('0x42')](handleError(_0x3ea605,null));};exports[_0x6ca4('0x24')]=function(_0x5acbd7,_0x14b83f){if(_0x5acbd7[_0x6ca4('0x49')]['id']){delete _0x5acbd7[_0x6ca4('0x49')]['id'];}return db[_0x6ca4('0x2b')]['find']({'where':{'id':_0x5acbd7[_0x6ca4('0x44')]['id']}})[_0x6ca4('0x25')](handleEntityNotFound(_0x14b83f,null))[_0x6ca4('0x25')](saveUpdates(_0x5acbd7[_0x6ca4('0x49')],null))['then'](respondWithResult(_0x14b83f,null))[_0x6ca4('0x42')](handleError(_0x14b83f,null));};exports['destroy']=function(_0x5bbec2,_0x27c278){return db[_0x6ca4('0x2b')][_0x6ca4('0x47')]({'where':{'id':_0x5bbec2[_0x6ca4('0x44')]['id']}})['then'](handleEntityNotFound(_0x27c278,null))[_0x6ca4('0x25')](removeEntity(_0x27c278,null))[_0x6ca4('0x42')](handleError(_0x27c278,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 17c5a52..8981c81 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 _0xd31a=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','define','int_sugarcrm_fields','idField','FieldId','lodash','util'];(function(_0x156a57,_0x5cbee4){var _0xf0a701=function(_0x3f1b36){while(--_0x3f1b36){_0x156a57['push'](_0x156a57['shift']());}};_0xf0a701(++_0x5cbee4);}(_0xd31a,0x143));var _0xad31=function(_0x17e2b2,_0xfdc014){_0x17e2b2=_0x17e2b2-0x0;var _0x130053=_0xd31a[_0x17e2b2];return _0x130053;};'use strict';var _=require(_0xad31('0x0'));var util=require(_0xad31('0x1'));var logger=require(_0xad31('0x2'))(_0xad31('0x3'));var moment=require(_0xad31('0x4'));var BPromise=require(_0xad31('0x5'));var rp=require(_0xad31('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad31('0x7'));var config=require('../../config/environment');var attributes=require(_0xad31('0x8'));module['exports']=function(_0x12a168,_0x5417f6){return _0x12a168[_0xad31('0x9')]('SugarcrmField',attributes,{'tableName':_0xad31('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xad31('0xb'),_0xad31('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb6ff=['../../config/environment','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x18421f,_0x13c1ed){var _0x455c7c=function(_0x1479e4){while(--_0x1479e4){_0x18421f['push'](_0x18421f['shift']());}};_0x455c7c(++_0x13c1ed);}(_0xb6ff,0x1c2));var _0xfb6f=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xb6ff[_0x198446];return _0x38d7b7;};'use strict';var _=require(_0xfb6f('0x0'));var util=require('util');var logger=require(_0xfb6f('0x1'))('api');var moment=require(_0xfb6f('0x2'));var BPromise=require(_0xfb6f('0x3'));var rp=require(_0xfb6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb6f('0x5'));var config=require(_0xfb6f('0x6'));var attributes=require(_0xfb6f('0x7'));module[_0xfb6f('0x8')]=function(_0x3984ab,_0x1d2a0f){return _0x3984ab[_0xfb6f('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xfb6f('0xa'),'fields':['idField',_0xfb6f('0xb')],'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 d4fc92e..df46d99 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 _0x9b37=['client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x304e0e,_0x33b054){var _0x568db1=function(_0x3db7dc){while(--_0x3db7dc){_0x304e0e['push'](_0x304e0e['shift']());}};_0x568db1(++_0x33b054);}(_0x9b37,0x1d8));var _0x79b3=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x9b37[_0x623e7];return _0x121131;};'use strict';var _=require('lodash');var util=require(_0x79b3('0x0'));var moment=require(_0x79b3('0x1'));var BPromise=require(_0x79b3('0x2'));var rs=require(_0x79b3('0x3'));var fs=require('fs');var Redis=require(_0x79b3('0x4'));var db=require(_0x79b3('0x5'))['db'];var utils=require(_0x79b3('0x6'));var logger=require(_0x79b3('0x7'))(_0x79b3('0x8'));var config=require(_0x79b3('0x9'));var jayson=require(_0x79b3('0xa'));var client=jayson[_0x79b3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfb8591,_0x292e83,_0x48980b){return new BPromise(function(_0x47bdd0,_0x2965bc){return client[_0x79b3('0xc')](_0xfb8591,_0x48980b)[_0x79b3('0xd')](function(_0x2e1d8a){logger[_0x79b3('0xe')](_0x79b3('0xf'),_0x292e83,_0x79b3('0x10'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x292e83,_0x79b3('0x10'),JSON[_0x79b3('0x11')](_0x2e1d8a));if(_0x2e1d8a[_0x79b3('0x12')]){if(_0x2e1d8a[_0x79b3('0x12')][_0x79b3('0x13')]===0x1f4){logger[_0x79b3('0x12')](_0x79b3('0xf'),_0x292e83,_0x2e1d8a[_0x79b3('0x12')][_0x79b3('0x14')]);return _0x2965bc(_0x2e1d8a[_0x79b3('0x12')]['message']);}logger[_0x79b3('0x12')](_0x79b3('0xf'),_0x292e83,_0x2e1d8a['error'][_0x79b3('0x14')]);return _0x47bdd0(_0x2e1d8a[_0x79b3('0x12')][_0x79b3('0x14')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x292e83,'request\x20sent');_0x47bdd0(_0x2e1d8a[_0x79b3('0x15')]['message']);}})[_0x79b3('0x16')](function(_0x4c2953){logger[_0x79b3('0x12')](_0x79b3('0xf'),_0x292e83,_0x4c2953);_0x2965bc(_0x4c2953);});});} \ No newline at end of file +var _0xf208=['SugarcrmField,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x42dd76,_0x3d017e){var _0x4af316=function(_0x5c5932){while(--_0x5c5932){_0x42dd76['push'](_0x42dd76['shift']());}};_0x4af316(++_0x3d017e);}(_0xf208,0x8c));var _0x8f20=function(_0x2b414c,_0x2ed020){_0x2b414c=_0x2b414c-0x0;var _0x51752b=_0xf208[_0x2b414c];return _0x51752b;};'use strict';var _=require(_0x8f20('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8f20('0x1'));var rs=require(_0x8f20('0x2'));var fs=require('fs');var Redis=require(_0x8f20('0x3'));var db=require(_0x8f20('0x4'))['db'];var utils=require(_0x8f20('0x5'));var logger=require(_0x8f20('0x6'))(_0x8f20('0x7'));var config=require(_0x8f20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32a6b8,_0x2abec0,_0x2f4510){return new BPromise(function(_0x11694b,_0x5c584a){return client['request'](_0x32a6b8,_0x2f4510)[_0x8f20('0xa')](function(_0x4d8852){logger[_0x8f20('0xb')](_0x8f20('0xc'),_0x2abec0,_0x8f20('0xd'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2abec0,_0x8f20('0xd'),JSON['stringify'](_0x4d8852));if(_0x4d8852['error']){if(_0x4d8852[_0x8f20('0xe')][_0x8f20('0xf')]===0x1f4){logger[_0x8f20('0xe')](_0x8f20('0xc'),_0x2abec0,_0x4d8852['error']['message']);return _0x5c584a(_0x4d8852[_0x8f20('0xe')][_0x8f20('0x10')]);}logger[_0x8f20('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2abec0,_0x4d8852[_0x8f20('0xe')]['message']);return _0x11694b(_0x4d8852['error'][_0x8f20('0x10')]);}else{logger['info'](_0x8f20('0xc'),_0x2abec0,'request\x20sent');_0x11694b(_0x4d8852[_0x8f20('0x11')][_0x8f20('0x10')]);}})[_0x8f20('0x12')](function(_0x2610b3){logger[_0x8f20('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2abec0,_0x2610b3);_0x5c584a(_0x2610b3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index dbc00d2..bc50803 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 _0x5577=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4038cb,_0x3da0c0){var _0x443513=function(_0x3e2bb5){while(--_0x3e2bb5){_0x4038cb['push'](_0x4038cb['shift']());}};_0x443513(++_0x3da0c0);}(_0x5577,0x1b4));var _0x7557=function(_0x178d52,_0x50ff09){_0x178d52=_0x178d52-0x0;var _0x523a80=_0x5577[_0x178d52];return _0x523a80;};'use strict';var multer=require(_0x7557('0x0'));var util=require('util');var path=require(_0x7557('0x1'));var timeout=require(_0x7557('0x2'));var express=require('express');var router=express[_0x7557('0x3')]();var fs_extra=require(_0x7557('0x4'));var auth=require(_0x7557('0x5'));var interaction=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var controller=require(_0x7557('0x8'));router['get']('/',auth[_0x7557('0x9')](),controller[_0x7557('0xa')]);router[_0x7557('0xb')](_0x7557('0xc'),auth[_0x7557('0x9')](),controller[_0x7557('0xd')]);router[_0x7557('0xb')](_0x7557('0xe'),auth[_0x7557('0x9')](),controller[_0x7557('0xf')]);router[_0x7557('0xb')](_0x7557('0x10'),auth[_0x7557('0x9')](),controller[_0x7557('0x11')]);router[_0x7557('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7557('0x12')](_0x7557('0xe'),auth[_0x7557('0x9')](),controller[_0x7557('0x13')]);router[_0x7557('0x14')](_0x7557('0xc'),auth[_0x7557('0x9')](),controller[_0x7557('0x15')]);router[_0x7557('0x16')](_0x7557('0xc'),auth['isAuthenticated'](),controller[_0x7557('0x17')]);module[_0x7557('0x18')]=router; \ No newline at end of file +var _0xe233=['getConfigurations','/:id/fields','create','post','update','delete','destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations'];(function(_0x56cded,_0x4ec5b1){var _0x1b09d5=function(_0x44f168){while(--_0x44f168){_0x56cded['push'](_0x56cded['shift']());}};_0x1b09d5(++_0x4ec5b1);}(_0xe233,0x15b));var _0x3e23=function(_0x393ebd,_0xa00754){_0x393ebd=_0x393ebd-0x0;var _0x3406a6=_0xe233[_0x393ebd];return _0x3406a6;};'use strict';var multer=require(_0x3e23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e23('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e23('0x2'));var auth=require(_0x3e23('0x3'));var interaction=require(_0x3e23('0x4'));var config=require(_0x3e23('0x5'));var controller=require(_0x3e23('0x6'));router['get']('/',auth[_0x3e23('0x7')](),controller[_0x3e23('0x8')]);router[_0x3e23('0x9')](_0x3e23('0xa'),auth[_0x3e23('0x7')](),controller[_0x3e23('0xb')]);router[_0x3e23('0x9')](_0x3e23('0xc'),auth[_0x3e23('0x7')](),controller[_0x3e23('0xd')]);router[_0x3e23('0x9')](_0x3e23('0xe'),auth[_0x3e23('0x7')](),controller['getFields']);router['post']('/',auth[_0x3e23('0x7')](),controller[_0x3e23('0xf')]);router[_0x3e23('0x10')](_0x3e23('0xc'),auth[_0x3e23('0x7')](),controller['addConfiguration']);router['put']('/:id',auth[_0x3e23('0x7')](),controller[_0x3e23('0x11')]);router[_0x3e23('0x12')](_0x3e23('0xa'),auth[_0x3e23('0x7')](),controller[_0x3e23('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 148ab2d..464888d 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 _0x6223=['STRING','HelpDesk','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6223,0x1d2));var _0x3622=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x6223[_0x22cc16];return _0x399b70;};'use strict';var Sequelize=require(_0x3622('0x0'));module[_0x3622('0x1')]={'name':{'type':Sequelize[_0x3622('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3622('0x2')]},'username':{'type':Sequelize[_0x3622('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3622('0x2')],'allowNull':![],'defaultValue':_0x3622('0x3')},'remoteUri':{'type':Sequelize[_0x3622('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3622('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3622('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd431=['HelpDesk','exports','STRING'];(function(_0x3580e2,_0x296337){var _0x1756fb=function(_0x3598aa){while(--_0x3598aa){_0x3580e2['push'](_0x3580e2['shift']());}};_0x1756fb(++_0x296337);}(_0xd431,0xd9));var _0x1d43=function(_0xd51d4b,_0x48bc70){_0xd51d4b=_0xd51d4b-0x0;var _0x2afbba=_0xd431[_0xd51d4b];return _0x2afbba;};'use strict';var Sequelize=require('sequelize');module[_0x1d43('0x0')]={'name':{'type':Sequelize[_0x1d43('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1d43('0x1')]},'username':{'type':Sequelize[_0x1d43('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1d43('0x1')],'allowNull':![],'defaultValue':_0x1d43('0x2')},'remoteUri':{'type':Sequelize[_0x1d43('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1d43('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1d43('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index d2637fa..70b7898 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 _0xee7a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','VtigerAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','rawAttributes','length','includeAll','merge','find','catch','body','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','create','VtigerField','md5','username','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xee7a,0x6c));var _0xaee7=function(_0x149093,_0x3bfbe4){_0x149093=_0x149093-0x0;var _0x242932=_0xee7a[_0x149093];return _0x242932;};'use strict';var emlformat=require(_0xaee7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaee7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaee7('0x2'));var moment=require(_0xaee7('0x3'));var BPromise=require(_0xaee7('0x4'));var Mustache=require(_0xaee7('0x5'));var util=require(_0xaee7('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaee7('0x7'));var fs=require('fs');var fs_extra=require(_0xaee7('0x8'));var _=require(_0xaee7('0x9'));var squel=require(_0xaee7('0xa'));var crypto=require(_0xaee7('0xb'));var jsforce=require(_0xaee7('0xc'));var deskjs=require(_0xaee7('0xd'));var toCsv=require(_0xaee7('0xe'));var querystring=require(_0xaee7('0xf'));var Papa=require(_0xaee7('0x10'));var Redis=require(_0xaee7('0x11'));var authService=require(_0xaee7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaee7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaee7('0x14'))(_0xaee7('0x15'));var utils=require(_0xaee7('0x16'));var config=require(_0xaee7('0x17'));var licenseUtil=require(_0xaee7('0x18'));var db=require(_0xaee7('0x19'))['db'];var integrations=require(_0xaee7('0x1a'));function respondWithStatusCode(_0x3993a9,_0x147da5){_0x147da5=_0x147da5||0xcc;return function(_0xbef7aa){if(_0xbef7aa){return _0x3993a9[_0xaee7('0x1b')](_0x147da5);}return _0x3993a9[_0xaee7('0x1c')](_0x147da5)[_0xaee7('0x1d')]();};}function respondWithResult(_0x5fb7b3,_0x5e9cbb){_0x5e9cbb=_0x5e9cbb||0xc8;return function(_0x6e2fa6){if(_0x6e2fa6){return _0x5fb7b3[_0xaee7('0x1c')](_0x5e9cbb)[_0xaee7('0x1e')](_0x6e2fa6);}};}function respondWithFilteredResult(_0x14a793,_0x1eee37){return function(_0x276030){if(_0x276030){var _0x21823b=typeof _0x1eee37[_0xaee7('0x1f')]===_0xaee7('0x20')&&typeof _0x1eee37[_0xaee7('0x21')]===_0xaee7('0x20');var _0x51be48=_0x276030['count'];var _0x332c27=_0x21823b?0x0:_0x1eee37['offset'];var _0x4ec145=_0x21823b?_0x276030[_0xaee7('0x22')]:_0x1eee37['offset']+_0x1eee37['limit'];var _0x546fbb;if(_0x4ec145>=_0x51be48){_0x4ec145=_0x51be48;_0x546fbb=0xc8;}else{_0x546fbb=0xce;}_0x14a793['status'](_0x546fbb);return _0x14a793[_0xaee7('0x23')]('Content-Range',_0x332c27+'-'+_0x4ec145+'/'+_0x51be48)[_0xaee7('0x1e')](_0x276030);}return null;};}function patchUpdates(_0x2e8513){return function(_0x3c5fe5){try{jsonpatch[_0xaee7('0x24')](_0x3c5fe5,_0x2e8513,!![]);}catch(_0x13598a){return BPromise[_0xaee7('0x25')](_0x13598a);}return _0x3c5fe5[_0xaee7('0x26')]();};}function saveUpdates(_0x3ba791,_0xd76ca2){return function(_0x4fc0d1){if(_0x4fc0d1){return _0x4fc0d1[_0xaee7('0x27')](_0x3ba791)['then'](function(_0x13a92a){return _0x13a92a;});}return null;};}function removeEntity(_0x20b591,_0xec8393){return function(_0x5c29a5){if(_0x5c29a5){return _0x5c29a5['destroy']()[_0xaee7('0x28')](function(){_0x20b591[_0xaee7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20df03,_0x16bbf6){return function(_0x34ff15){if(!_0x34ff15){_0x20df03[_0xaee7('0x1b')](0x194);}return _0x34ff15;};}function handleError(_0x7338c2,_0x519e85){_0x519e85=_0x519e85||0x1f4;return function(_0x2b9057){logger[_0xaee7('0x29')](_0x2b9057[_0xaee7('0x2a')]);if(_0x2b9057['name']){delete _0x2b9057[_0xaee7('0x2b')];}_0x7338c2[_0xaee7('0x1c')](_0x519e85)[_0xaee7('0x2c')](_0x2b9057);};}exports[_0xaee7('0x2d')]=function(_0x3423e7,_0x2a3755){var _0x55af57={},_0x55afb6={},_0x1155c3={'count':0x0,'rows':[]};var _0x4a7cc1=_['map'](db[_0xaee7('0x2e')]['rawAttributes'],function(_0x5b4f60){return{'name':_0x5b4f60[_0xaee7('0x2f')],'type':_0x5b4f60['type'][_0xaee7('0x30')]};});_0x55afb6[_0xaee7('0x31')]=_[_0xaee7('0x32')](_0x4a7cc1,_0xaee7('0x2b'));_0x55afb6[_0xaee7('0x33')]=_[_0xaee7('0x34')](_0x3423e7[_0xaee7('0x33')]);_0x55afb6[_0xaee7('0x35')]=_[_0xaee7('0x36')](_0x55afb6['model'],_0x55afb6[_0xaee7('0x33')]);_0x55af57[_0xaee7('0x37')]=_['intersection'](_0x55afb6['model'],qs['fields'](_0x3423e7[_0xaee7('0x33')][_0xaee7('0x38')]));_0x55af57['attributes']=_0x55af57[_0xaee7('0x37')]['length']?_0x55af57[_0xaee7('0x37')]:_0x55afb6[_0xaee7('0x31')];if(!_0x3423e7[_0xaee7('0x33')]['hasOwnProperty'](_0xaee7('0x39'))){_0x55af57[_0xaee7('0x21')]=qs[_0xaee7('0x21')](_0x3423e7[_0xaee7('0x33')][_0xaee7('0x21')]);_0x55af57[_0xaee7('0x1f')]=qs[_0xaee7('0x1f')](_0x3423e7[_0xaee7('0x33')][_0xaee7('0x1f')]);}_0x55af57[_0xaee7('0x3a')]=qs[_0xaee7('0x3b')](_0x3423e7['query'][_0xaee7('0x3b')]);_0x55af57[_0xaee7('0x3c')]=qs[_0xaee7('0x35')](_[_0xaee7('0x3d')](_0x3423e7[_0xaee7('0x33')],_0x55afb6['filters']),_0x4a7cc1);if(_0x3423e7[_0xaee7('0x33')][_0xaee7('0x3e')]){_0x55af57['where']=_['merge'](_0x55af57['where'],{'$or':_[_0xaee7('0x32')](_0x4a7cc1,function(_0x4ade84){if(_0x4ade84['type']!==_0xaee7('0x3f')){var _0x2499b8={};_0x2499b8[_0x4ade84[_0xaee7('0x2b')]]={'$like':'%'+_0x3423e7[_0xaee7('0x33')][_0xaee7('0x3e')]+'%'};return _0x2499b8;}})});}_0x55af57=_['merge']({},_0x55af57,_0x3423e7[_0xaee7('0x40')]);var _0x213759={'where':_0x55af57[_0xaee7('0x3c')]};return db['VtigerAccount']['count'](_0x213759)[_0xaee7('0x28')](function(_0x2a7ebe){_0x1155c3[_0xaee7('0x22')]=_0x2a7ebe;if(_0x3423e7[_0xaee7('0x33')]['includeAll']){_0x55af57[_0xaee7('0x41')]=[{'all':!![]}];}return db[_0xaee7('0x2e')][_0xaee7('0x42')](_0x55af57);})['then'](function(_0x27d684){_0x1155c3[_0xaee7('0x43')]=_0x27d684;return _0x1155c3;})['then'](respondWithFilteredResult(_0x2a3755,_0x55af57))['catch'](handleError(_0x2a3755,null));};exports['show']=function(_0x4b9668,_0x1f7808){var _0x40b4c6={'raw':![],'where':{'id':_0x4b9668[_0xaee7('0x44')]['id']}},_0x2f4b11={};_0x2f4b11['model']=_[_0xaee7('0x34')](db[_0xaee7('0x2e')][_0xaee7('0x45')]);_0x2f4b11[_0xaee7('0x33')]=_['keys'](_0x4b9668['query']);_0x2f4b11[_0xaee7('0x35')]=_['intersection'](_0x2f4b11[_0xaee7('0x31')],_0x2f4b11['query']);_0x40b4c6['attributes']=_[_0xaee7('0x36')](_0x2f4b11[_0xaee7('0x31')],qs[_0xaee7('0x38')](_0x4b9668[_0xaee7('0x33')][_0xaee7('0x38')]));_0x40b4c6[_0xaee7('0x37')]=_0x40b4c6[_0xaee7('0x37')][_0xaee7('0x46')]?_0x40b4c6[_0xaee7('0x37')]:_0x2f4b11[_0xaee7('0x31')];if(_0x4b9668[_0xaee7('0x33')][_0xaee7('0x47')]){_0x40b4c6[_0xaee7('0x41')]=[{'all':!![]}];}_0x40b4c6=_[_0xaee7('0x48')]({},_0x40b4c6,_0x4b9668[_0xaee7('0x40')]);return db[_0xaee7('0x2e')][_0xaee7('0x49')](_0x40b4c6)['then'](handleEntityNotFound(_0x1f7808,null))[_0xaee7('0x28')](respondWithResult(_0x1f7808,null))[_0xaee7('0x4a')](handleError(_0x1f7808,null));};exports['create']=function(_0x30d74c,_0x34efc4){return db[_0xaee7('0x2e')]['create'](_0x30d74c[_0xaee7('0x4b')],{})['then'](respondWithResult(_0x34efc4,0xc9))[_0xaee7('0x4a')](handleError(_0x34efc4,null));};exports[_0xaee7('0x27')]=function(_0x46370b,_0x1134c3){if(_0x46370b[_0xaee7('0x4b')]['id']){delete _0x46370b[_0xaee7('0x4b')]['id'];}return db[_0xaee7('0x2e')][_0xaee7('0x49')]({'where':{'id':_0x46370b[_0xaee7('0x44')]['id']}})['then'](handleEntityNotFound(_0x1134c3,null))[_0xaee7('0x28')](saveUpdates(_0x46370b['body'],null))['then'](respondWithResult(_0x1134c3,null))[_0xaee7('0x4a')](handleError(_0x1134c3,null));};exports['destroy']=function(_0x5389c1,_0x323216){return db[_0xaee7('0x2e')]['find']({'where':{'id':_0x5389c1[_0xaee7('0x44')]['id']}})[_0xaee7('0x28')](handleEntityNotFound(_0x323216,null))[_0xaee7('0x28')](removeEntity(_0x323216,null))[_0xaee7('0x4a')](handleError(_0x323216,null));};exports[_0xaee7('0x4c')]=function(_0x58df73,_0x48a83d,_0x2df497){var _0x39bbe3={};var _0x50fce9={};var _0x22e72a;var _0xbf1714;return db[_0xaee7('0x2e')][_0xaee7('0x4d')]({'where':{'id':_0x58df73['params']['id']}})['then'](handleEntityNotFound(_0x48a83d,null))['then'](function(_0x1de444){if(_0x1de444){_0x22e72a=_0x1de444;_0x50fce9[_0xaee7('0x31')]=_[_0xaee7('0x34')](db[_0xaee7('0x4e')]['rawAttributes']);_0x50fce9[_0xaee7('0x33')]=_[_0xaee7('0x34')](_0x58df73['query']);_0x50fce9[_0xaee7('0x35')]=_[_0xaee7('0x36')](_0x50fce9[_0xaee7('0x31')],_0x50fce9[_0xaee7('0x33')]);_0x39bbe3[_0xaee7('0x37')]=_[_0xaee7('0x36')](_0x50fce9[_0xaee7('0x31')],qs['fields'](_0x58df73['query'][_0xaee7('0x38')]));_0x39bbe3[_0xaee7('0x37')]=_0x39bbe3[_0xaee7('0x37')]['length']?_0x39bbe3[_0xaee7('0x37')]:_0x50fce9[_0xaee7('0x31')];_0x39bbe3['order']=qs[_0xaee7('0x3b')](_0x58df73[_0xaee7('0x33')]['sort']);_0x39bbe3[_0xaee7('0x3c')]=qs['filters'](_['pick'](_0x58df73['query'],_0x50fce9[_0xaee7('0x35')]));if(_0x58df73['query'][_0xaee7('0x3e')]){_0x39bbe3['where']=_['merge'](_0x39bbe3['where'],{'$or':_[_0xaee7('0x32')](_0x39bbe3[_0xaee7('0x37')],function(_0x21af76){var _0x15d7a4={};_0x15d7a4[_0x21af76]={'$like':'%'+_0x58df73[_0xaee7('0x33')][_0xaee7('0x3e')]+'%'};return _0x15d7a4;})});}_0x39bbe3=_[_0xaee7('0x48')]({},_0x39bbe3,_0x58df73['options']);return _0x22e72a[_0xaee7('0x4c')](_0x39bbe3);}})[_0xaee7('0x28')](function(_0x23f8e9){if(_0x23f8e9){_0xbf1714=_0x23f8e9['length'];if(!_0x58df73[_0xaee7('0x33')][_0xaee7('0x4f')](_0xaee7('0x39'))){_0x39bbe3['limit']=qs[_0xaee7('0x21')](_0x58df73[_0xaee7('0x33')][_0xaee7('0x21')]);_0x39bbe3['offset']=qs[_0xaee7('0x1f')](_0x58df73[_0xaee7('0x33')][_0xaee7('0x1f')]);}return _0x22e72a[_0xaee7('0x4c')](_0x39bbe3);}})[_0xaee7('0x28')](function(_0x51341f){if(_0x51341f){return _0x51341f?{'count':_0xbf1714,'rows':_0x51341f}:null;}})['then'](respondWithResult(_0x48a83d,null))[_0xaee7('0x4a')](handleError(_0x48a83d,null));};exports[_0xaee7('0x50')]=function(_0x58ea3c,_0x1f58f0,_0x33ce42){if(_0x58ea3c[_0xaee7('0x4b')]['id']){delete _0x58ea3c[_0xaee7('0x4b')]['id'];}return db[_0xaee7('0x2e')][_0xaee7('0x4d')]({'where':{'id':_0x58ea3c[_0xaee7('0x44')]['id']}})[_0xaee7('0x28')](handleEntityNotFound(_0x1f58f0,null))[_0xaee7('0x28')](function(_0xb6c13c){if(_0xb6c13c){_0x58ea3c[_0xaee7('0x4b')][_0xaee7('0x51')]=_0xb6c13c['id'];_0x58ea3c[_0xaee7('0x4b')][_0xaee7('0x52')]=integrations[_0xaee7('0x53')](_0x58ea3c[_0xaee7('0x4b')][_0xaee7('0x54')],_0x58ea3c['body']['type']);_0x58ea3c[_0xaee7('0x4b')][_0xaee7('0x55')]=integrations[_0xaee7('0x56')](_0x58ea3c[_0xaee7('0x4b')][_0xaee7('0x54')],_0x58ea3c[_0xaee7('0x4b')][_0xaee7('0x57')]);return db['VtigerConfiguration'][_0xaee7('0x58')](_0x58ea3c[_0xaee7('0x4b')],{'include':[{'model':db[_0xaee7('0x59')],'as':_0xaee7('0x52')},{'model':db[_0xaee7('0x59')],'as':_0xaee7('0x55')}]});}return null;})[_0xaee7('0x28')](respondWithResult(_0x1f58f0,null))['catch'](handleError(_0x1f58f0,null));};var md5=require(_0xaee7('0x5a'));exports['getFields']=function(_0x22f7fd,_0x1b003b,_0x2b7b35){var _0xb0db09=null;var _0x477d3e=null;var _0x1fd4b9=null;var _0x720fe=null;var _0x43e8a8='';return db[_0xaee7('0x2e')]['findOne']({'where':{'id':_0x22f7fd['params']['id']},'attributes':['id',_0xaee7('0x2b'),_0xaee7('0x5b'),'description',_0xaee7('0x5c'),_0xaee7('0x5d'),_0xaee7('0x5e'),_0xaee7('0x5f')]})['then'](handleEntityNotFound(_0x1b003b,null))[_0xaee7('0x28')](function(_0x55227b){if(_0x55227b){_0xb0db09=_0x55227b[_0xaee7('0x5b')];_0x477d3e=_0x55227b['accessKey'];_0x1fd4b9=_0x55227b[_0xaee7('0x5c')];_0x43e8a8=_0x55227b[_0xaee7('0x5d')];var _0x5ecfd9=_0x43e8a8[_0xaee7('0x60')](-0x1);if(_0x5ecfd9==='/'){_0x43e8a8=_0x43e8a8['substring'](0x0,_0x43e8a8[_0xaee7('0x61')](_0x5ecfd9));}_0x720fe=util[_0xaee7('0x62')](_0xaee7('0x63'),_0x43e8a8);var _0x3a8566={'method':_0xaee7('0x64'),'uri':_0x720fe,'qs':{'operation':_0xaee7('0x65'),'username':_0x55227b['username']},'json':!![]};return rp(_0x3a8566);}})[_0xaee7('0x28')](function(_0x43e859){if(_0x43e859[_0xaee7('0x66')]){var _0x351b05={'method':'POST','uri':_0x720fe,'form':{'operation':'login','username':_0xb0db09,'accessKey':md5(_0x43e859[_0xaee7('0x67')][_0xaee7('0x68')]+_0x477d3e)},'json':!![]};return rp(_0x351b05);}})['then'](function(_0x5aefbd){if(_0x5aefbd[_0xaee7('0x66')]){var _0x5632eb={'method':_0xaee7('0x64'),'uri':_0x720fe,'qs':{'operation':_0xaee7('0x69'),'username':_0xb0db09,'sessionName':_0x5aefbd[_0xaee7('0x67')][_0xaee7('0x6a')],'elementType':_0x1fd4b9},'json':!![]};return rp(_0x5632eb);}})[_0xaee7('0x28')](function(_0x4a39cc){if(_0x4a39cc[_0xaee7('0x66')]){var _0x3403c3=[_0xaee7('0x6b'),_0xaee7('0x6c'),_0xaee7('0x6d')];_[_0xaee7('0x6e')](_0x4a39cc[_0xaee7('0x67')][_0xaee7('0x38')],function(_0x3ad877){return _0x3403c3[_0xaee7('0x6f')](_0x3ad877[_0xaee7('0x57')][_0xaee7('0x2b')]);});_[_0xaee7('0x6e')](_0x4a39cc[_0xaee7('0x67')][_0xaee7('0x38')],function(_0x4c7daf){return _0x4c7daf[_0xaee7('0x70')]===_0xaee7('0x71');});return{'count':_0x4a39cc[_0xaee7('0x67')][_0xaee7('0x38')][_0xaee7('0x46')],'rows':_[_0xaee7('0x32')](_0x4a39cc[_0xaee7('0x67')][_0xaee7('0x38')],function(_0x53ab05){return{'id':_0x53ab05[_0xaee7('0x2b')],'name':_0x53ab05[_0xaee7('0x72')],'custom':_[_0xaee7('0x73')](_0x53ab05['name'],_0xaee7('0x74'))?!![]:![],'options':_0x53ab05[_0xaee7('0x57')][_0xaee7('0x2b')]===_0xaee7('0x75')&&_0x53ab05[_0xaee7('0x57')]['picklistValues'][_0xaee7('0x46')]>0x0?_[_0xaee7('0x32')](_0x53ab05['type'][_0xaee7('0x76')],function(_0x41f76b){return{'name':_0x41f76b[_0xaee7('0x72')],'value':_0x41f76b['value']};}):[]};})};}})[_0xaee7('0x28')](respondWithResult(_0x1b003b,null))[_0xaee7('0x4a')](function(_0x424195){console[_0xaee7('0x77')]('vTiger\x20error:\x20'+_0x424195);var _0x214dc9=_0x22f7fd['query'][_0xaee7('0x78')]?0x1f4:_0x424195[_0xaee7('0x79')]||0x1f4;logger[_0xaee7('0x29')](_0xaee7('0x7a'),'getFields',_0x214dc9,JSON['stringify'](_0x424195));delete _0x424195[_0xaee7('0x2b')];if(_0x214dc9===0x191){_0x214dc9=0x190;}_0x1b003b['status'](_0x214dc9)['send'](_0x22f7fd[_0xaee7('0x33')][_0xaee7('0x78')]?{'message':_0xaee7('0x7b'),'statusCode':_0x424195[_0xaee7('0x79')]}:_0x424195);});}; \ No newline at end of file +var _0x615b=['serverUrl','accessKey','slice','GET','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','owner','remove','editable','false','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','status','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerAccount','fieldName','type','key','keys','query','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','rawAttributes','fields','find','create','body','update','params','getConfigurations','options','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','getFields','username','description','moduleName','remoteUri'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x615b,0x185));var _0xb615=function(_0x35e08a,_0x27c739){_0x35e08a=_0x35e08a-0x0;var _0x2ead21=_0x615b[_0x35e08a];return _0x2ead21;};'use strict';var emlformat=require(_0xb615('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb615('0x1'));var jsonpatch=require(_0xb615('0x2'));var rp=require(_0xb615('0x3'));var moment=require('moment');var BPromise=require(_0xb615('0x4'));var Mustache=require(_0xb615('0x5'));var util=require(_0xb615('0x6'));var path=require('path');var sox=require(_0xb615('0x7'));var csv=require(_0xb615('0x8'));var ejs=require(_0xb615('0x9'));var fs=require('fs');var fs_extra=require(_0xb615('0xa'));var _=require('lodash');var squel=require(_0xb615('0xb'));var crypto=require(_0xb615('0xc'));var jsforce=require(_0xb615('0xd'));var deskjs=require(_0xb615('0xe'));var toCsv=require(_0xb615('0x8'));var querystring=require(_0xb615('0xf'));var Papa=require(_0xb615('0x10'));var Redis=require(_0xb615('0x11'));var authService=require(_0xb615('0x12'));var qs=require(_0xb615('0x13'));var as=require(_0xb615('0x14'));var hardwareService=require(_0xb615('0x15'));var logger=require(_0xb615('0x16'))(_0xb615('0x17'));var utils=require(_0xb615('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb615('0x19'));var db=require(_0xb615('0x1a'))['db'];var integrations=require(_0xb615('0x1b'));function respondWithStatusCode(_0x17b4e5,_0x5ad688){_0x5ad688=_0x5ad688||0xcc;return function(_0x531423){if(_0x531423){return _0x17b4e5['sendStatus'](_0x5ad688);}return _0x17b4e5['status'](_0x5ad688)[_0xb615('0x1c')]();};}function respondWithResult(_0x88c442,_0x29e850){_0x29e850=_0x29e850||0xc8;return function(_0x1afb11){if(_0x1afb11){return _0x88c442['status'](_0x29e850)[_0xb615('0x1d')](_0x1afb11);}};}function respondWithFilteredResult(_0x2d79b5,_0x309570){return function(_0xf8486c){if(_0xf8486c){var _0x556a39=typeof _0x309570[_0xb615('0x1e')]===_0xb615('0x1f')&&typeof _0x309570[_0xb615('0x20')]===_0xb615('0x1f');var _0x487267=_0xf8486c[_0xb615('0x21')];var _0x31c4bf=_0x556a39?0x0:_0x309570[_0xb615('0x1e')];var _0x1aa1a7=_0x556a39?_0xf8486c[_0xb615('0x21')]:_0x309570[_0xb615('0x1e')]+_0x309570[_0xb615('0x20')];var _0xe7a2ac;if(_0x1aa1a7>=_0x487267){_0x1aa1a7=_0x487267;_0xe7a2ac=0xc8;}else{_0xe7a2ac=0xce;}_0x2d79b5['status'](_0xe7a2ac);return _0x2d79b5['set']('Content-Range',_0x31c4bf+'-'+_0x1aa1a7+'/'+_0x487267)[_0xb615('0x1d')](_0xf8486c);}return null;};}function patchUpdates(_0x5cf018){return function(_0x1d3166){try{jsonpatch[_0xb615('0x22')](_0x1d3166,_0x5cf018,!![]);}catch(_0x235794){return BPromise[_0xb615('0x23')](_0x235794);}return _0x1d3166[_0xb615('0x24')]();};}function saveUpdates(_0x37cbbf,_0x5eeb26){return function(_0x22b4da){if(_0x22b4da){return _0x22b4da['update'](_0x37cbbf)[_0xb615('0x25')](function(_0x1a5530){return _0x1a5530;});}return null;};}function removeEntity(_0xbb8da2,_0x52c2b0){return function(_0x24a092){if(_0x24a092){return _0x24a092[_0xb615('0x26')]()[_0xb615('0x25')](function(){_0xbb8da2['status'](0xcc)[_0xb615('0x1c')]();});}};}function handleEntityNotFound(_0x3e57ae,_0x402330){return function(_0x2bc8e2){if(!_0x2bc8e2){_0x3e57ae['sendStatus'](0x194);}return _0x2bc8e2;};}function handleError(_0x1a001b,_0x1e695a){_0x1e695a=_0x1e695a||0x1f4;return function(_0x33c906){logger['error'](_0x33c906[_0xb615('0x27')]);if(_0x33c906[_0xb615('0x28')]){delete _0x33c906[_0xb615('0x28')];}_0x1a001b['status'](_0x1e695a)[_0xb615('0x29')](_0x33c906);};}exports[_0xb615('0x2a')]=function(_0x4ccd44,_0x25b0ea){var _0xa2a893={},_0x7701bf={},_0x61b636={'count':0x0,'rows':[]};var _0x5a7e46=_[_0xb615('0x2b')](db[_0xb615('0x2c')]['rawAttributes'],function(_0x51e4bb){return{'name':_0x51e4bb[_0xb615('0x2d')],'type':_0x51e4bb[_0xb615('0x2e')][_0xb615('0x2f')]};});_0x7701bf['model']=_['map'](_0x5a7e46,_0xb615('0x28'));_0x7701bf['query']=_[_0xb615('0x30')](_0x4ccd44[_0xb615('0x31')]);_0x7701bf[_0xb615('0x32')]=_['intersection'](_0x7701bf[_0xb615('0x33')],_0x7701bf[_0xb615('0x31')]);_0xa2a893['attributes']=_[_0xb615('0x34')](_0x7701bf[_0xb615('0x33')],qs['fields'](_0x4ccd44['query']['fields']));_0xa2a893[_0xb615('0x35')]=_0xa2a893['attributes'][_0xb615('0x36')]?_0xa2a893[_0xb615('0x35')]:_0x7701bf[_0xb615('0x33')];if(!_0x4ccd44[_0xb615('0x31')][_0xb615('0x37')](_0xb615('0x38'))){_0xa2a893[_0xb615('0x20')]=qs[_0xb615('0x20')](_0x4ccd44['query'][_0xb615('0x20')]);_0xa2a893[_0xb615('0x1e')]=qs['offset'](_0x4ccd44[_0xb615('0x31')][_0xb615('0x1e')]);}_0xa2a893[_0xb615('0x39')]=qs['sort'](_0x4ccd44[_0xb615('0x31')][_0xb615('0x3a')]);_0xa2a893[_0xb615('0x3b')]=qs['filters'](_[_0xb615('0x3c')](_0x4ccd44[_0xb615('0x31')],_0x7701bf[_0xb615('0x32')]),_0x5a7e46);if(_0x4ccd44[_0xb615('0x31')][_0xb615('0x3d')]){_0xa2a893[_0xb615('0x3b')]=_[_0xb615('0x3e')](_0xa2a893[_0xb615('0x3b')],{'$or':_[_0xb615('0x2b')](_0x5a7e46,function(_0x3616a9){if(_0x3616a9['type']!==_0xb615('0x3f')){var _0x220748={};_0x220748[_0x3616a9[_0xb615('0x28')]]={'$like':'%'+_0x4ccd44[_0xb615('0x31')]['filter']+'%'};return _0x220748;}})});}_0xa2a893=_[_0xb615('0x3e')]({},_0xa2a893,_0x4ccd44['options']);var _0x153771={'where':_0xa2a893[_0xb615('0x3b')]};return db['VtigerAccount'][_0xb615('0x21')](_0x153771)[_0xb615('0x25')](function(_0x4c8c81){_0x61b636[_0xb615('0x21')]=_0x4c8c81;if(_0x4ccd44['query'][_0xb615('0x40')]){_0xa2a893[_0xb615('0x41')]=[{'all':!![]}];}return db[_0xb615('0x2c')][_0xb615('0x42')](_0xa2a893);})[_0xb615('0x25')](function(_0x2bd6b6){_0x61b636['rows']=_0x2bd6b6;return _0x61b636;})[_0xb615('0x25')](respondWithFilteredResult(_0x25b0ea,_0xa2a893))[_0xb615('0x43')](handleError(_0x25b0ea,null));};exports[_0xb615('0x44')]=function(_0x41cc96,_0x57c58b){var _0x414fee={'raw':![],'where':{'id':_0x41cc96['params']['id']}},_0x4a82a2={};_0x4a82a2['model']=_['keys'](db[_0xb615('0x2c')][_0xb615('0x45')]);_0x4a82a2[_0xb615('0x31')]=_[_0xb615('0x30')](_0x41cc96['query']);_0x4a82a2['filters']=_[_0xb615('0x34')](_0x4a82a2['model'],_0x4a82a2[_0xb615('0x31')]);_0x414fee['attributes']=_[_0xb615('0x34')](_0x4a82a2[_0xb615('0x33')],qs[_0xb615('0x46')](_0x41cc96[_0xb615('0x31')][_0xb615('0x46')]));_0x414fee[_0xb615('0x35')]=_0x414fee['attributes'][_0xb615('0x36')]?_0x414fee[_0xb615('0x35')]:_0x4a82a2[_0xb615('0x33')];if(_0x41cc96['query']['includeAll']){_0x414fee[_0xb615('0x41')]=[{'all':!![]}];}_0x414fee=_[_0xb615('0x3e')]({},_0x414fee,_0x41cc96['options']);return db[_0xb615('0x2c')][_0xb615('0x47')](_0x414fee)[_0xb615('0x25')](handleEntityNotFound(_0x57c58b,null))[_0xb615('0x25')](respondWithResult(_0x57c58b,null))[_0xb615('0x43')](handleError(_0x57c58b,null));};exports[_0xb615('0x48')]=function(_0x13471c,_0x4f690a){return db[_0xb615('0x2c')][_0xb615('0x48')](_0x13471c[_0xb615('0x49')],{})[_0xb615('0x25')](respondWithResult(_0x4f690a,0xc9))[_0xb615('0x43')](handleError(_0x4f690a,null));};exports[_0xb615('0x4a')]=function(_0x13f529,_0x5dbfaf){if(_0x13f529['body']['id']){delete _0x13f529[_0xb615('0x49')]['id'];}return db[_0xb615('0x2c')]['find']({'where':{'id':_0x13f529['params']['id']}})['then'](handleEntityNotFound(_0x5dbfaf,null))[_0xb615('0x25')](saveUpdates(_0x13f529[_0xb615('0x49')],null))[_0xb615('0x25')](respondWithResult(_0x5dbfaf,null))[_0xb615('0x43')](handleError(_0x5dbfaf,null));};exports['destroy']=function(_0x2a214d,_0x4184ea){return db[_0xb615('0x2c')][_0xb615('0x47')]({'where':{'id':_0x2a214d[_0xb615('0x4b')]['id']}})[_0xb615('0x25')](handleEntityNotFound(_0x4184ea,null))[_0xb615('0x25')](removeEntity(_0x4184ea,null))[_0xb615('0x43')](handleError(_0x4184ea,null));};exports[_0xb615('0x4c')]=function(_0x1f57ec,_0x187be8,_0x15f38a){var _0x36c55a={};var _0x4c94e4={};var _0x15ceb6;var _0x541297;return db[_0xb615('0x2c')]['findOne']({'where':{'id':_0x1f57ec['params']['id']}})[_0xb615('0x25')](handleEntityNotFound(_0x187be8,null))[_0xb615('0x25')](function(_0x406997){if(_0x406997){_0x15ceb6=_0x406997;_0x4c94e4[_0xb615('0x33')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x4c94e4[_0xb615('0x31')]=_[_0xb615('0x30')](_0x1f57ec[_0xb615('0x31')]);_0x4c94e4[_0xb615('0x32')]=_[_0xb615('0x34')](_0x4c94e4[_0xb615('0x33')],_0x4c94e4[_0xb615('0x31')]);_0x36c55a[_0xb615('0x35')]=_[_0xb615('0x34')](_0x4c94e4[_0xb615('0x33')],qs[_0xb615('0x46')](_0x1f57ec[_0xb615('0x31')][_0xb615('0x46')]));_0x36c55a[_0xb615('0x35')]=_0x36c55a[_0xb615('0x35')][_0xb615('0x36')]?_0x36c55a[_0xb615('0x35')]:_0x4c94e4['model'];_0x36c55a[_0xb615('0x39')]=qs[_0xb615('0x3a')](_0x1f57ec[_0xb615('0x31')][_0xb615('0x3a')]);_0x36c55a[_0xb615('0x3b')]=qs['filters'](_[_0xb615('0x3c')](_0x1f57ec[_0xb615('0x31')],_0x4c94e4[_0xb615('0x32')]));if(_0x1f57ec[_0xb615('0x31')][_0xb615('0x3d')]){_0x36c55a[_0xb615('0x3b')]=_[_0xb615('0x3e')](_0x36c55a[_0xb615('0x3b')],{'$or':_[_0xb615('0x2b')](_0x36c55a[_0xb615('0x35')],function(_0x84c514){var _0xcd3bcd={};_0xcd3bcd[_0x84c514]={'$like':'%'+_0x1f57ec[_0xb615('0x31')][_0xb615('0x3d')]+'%'};return _0xcd3bcd;})});}_0x36c55a=_['merge']({},_0x36c55a,_0x1f57ec[_0xb615('0x4d')]);return _0x15ceb6['getConfigurations'](_0x36c55a);}})[_0xb615('0x25')](function(_0x2e955d){if(_0x2e955d){_0x541297=_0x2e955d['length'];if(!_0x1f57ec[_0xb615('0x31')][_0xb615('0x37')](_0xb615('0x38'))){_0x36c55a['limit']=qs[_0xb615('0x20')](_0x1f57ec[_0xb615('0x31')][_0xb615('0x20')]);_0x36c55a[_0xb615('0x1e')]=qs[_0xb615('0x1e')](_0x1f57ec['query'][_0xb615('0x1e')]);}return _0x15ceb6[_0xb615('0x4c')](_0x36c55a);}})[_0xb615('0x25')](function(_0x54b288){if(_0x54b288){return _0x54b288?{'count':_0x541297,'rows':_0x54b288}:null;}})['then'](respondWithResult(_0x187be8,null))[_0xb615('0x43')](handleError(_0x187be8,null));};exports['addConfiguration']=function(_0x1335ad,_0x249bd9,_0x2274c4){if(_0x1335ad['body']['id']){delete _0x1335ad[_0xb615('0x49')]['id'];}return db[_0xb615('0x2c')][_0xb615('0x4e')]({'where':{'id':_0x1335ad['params']['id']}})['then'](handleEntityNotFound(_0x249bd9,null))[_0xb615('0x25')](function(_0x588341){if(_0x588341){_0x1335ad[_0xb615('0x49')][_0xb615('0x4f')]=_0x588341['id'];_0x1335ad[_0xb615('0x49')][_0xb615('0x50')]=integrations[_0xb615('0x51')](_0x1335ad[_0xb615('0x49')][_0xb615('0x52')],_0x1335ad['body']['type']);_0x1335ad['body'][_0xb615('0x53')]=integrations[_0xb615('0x54')](_0x1335ad['body'][_0xb615('0x52')],_0x1335ad['body'][_0xb615('0x2e')]);return db[_0xb615('0x55')]['create'](_0x1335ad[_0xb615('0x49')],{'include':[{'model':db['VtigerField'],'as':_0xb615('0x50')},{'model':db['VtigerField'],'as':_0xb615('0x53')}]});}return null;})[_0xb615('0x25')](respondWithResult(_0x249bd9,null))[_0xb615('0x43')](handleError(_0x249bd9,null));};var md5=require('md5');exports[_0xb615('0x56')]=function(_0x4833dd,_0x53ef88,_0x4ea4cb){var _0x27866e=null;var _0x23aa81=null;var _0x122deb=null;var _0x58ec13=null;var _0x1894bb='';return db[_0xb615('0x2c')][_0xb615('0x4e')]({'where':{'id':_0x4833dd[_0xb615('0x4b')]['id']},'attributes':['id','name',_0xb615('0x57'),_0xb615('0x58'),_0xb615('0x59'),_0xb615('0x5a'),_0xb615('0x5b'),_0xb615('0x5c')]})[_0xb615('0x25')](handleEntityNotFound(_0x53ef88,null))[_0xb615('0x25')](function(_0x4237da){if(_0x4237da){_0x27866e=_0x4237da[_0xb615('0x57')];_0x23aa81=_0x4237da[_0xb615('0x5c')];_0x122deb=_0x4237da[_0xb615('0x59')];_0x1894bb=_0x4237da[_0xb615('0x5a')];var _0x5cf111=_0x1894bb[_0xb615('0x5d')](-0x1);if(_0x5cf111==='/'){_0x1894bb=_0x1894bb['substring'](0x0,_0x1894bb['lastIndexOf'](_0x5cf111));}_0x58ec13=util['format']('%s/webservice.php',_0x1894bb);var _0x3e81b7={'method':_0xb615('0x5e'),'uri':_0x58ec13,'qs':{'operation':_0xb615('0x5f'),'username':_0x4237da['username']},'json':!![]};return rp(_0x3e81b7);}})['then'](function(_0x4991b2){if(_0x4991b2[_0xb615('0x60')]){var _0x3814b9={'method':_0xb615('0x61'),'uri':_0x58ec13,'form':{'operation':_0xb615('0x62'),'username':_0x27866e,'accessKey':md5(_0x4991b2[_0xb615('0x63')]['token']+_0x23aa81)},'json':!![]};return rp(_0x3814b9);}})[_0xb615('0x25')](function(_0x1c5a80){if(_0x1c5a80[_0xb615('0x60')]){var _0x30df8e={'method':_0xb615('0x5e'),'uri':_0x58ec13,'qs':{'operation':_0xb615('0x64'),'username':_0x27866e,'sessionName':_0x1c5a80[_0xb615('0x63')][_0xb615('0x65')],'elementType':_0x122deb},'json':!![]};return rp(_0x30df8e);}})['then'](function(_0x7f8ef1){if(_0x7f8ef1[_0xb615('0x60')]){var _0x4ebde6=[_0xb615('0x66'),_0xb615('0x67'),_0xb615('0x68')];_[_0xb615('0x69')](_0x7f8ef1[_0xb615('0x63')][_0xb615('0x46')],function(_0x4aaf07){return _0x4ebde6['includes'](_0x4aaf07['type']['name']);});_[_0xb615('0x69')](_0x7f8ef1[_0xb615('0x63')]['fields'],function(_0x317d40){return _0x317d40[_0xb615('0x6a')]===_0xb615('0x6b');});return{'count':_0x7f8ef1[_0xb615('0x63')]['fields'][_0xb615('0x36')],'rows':_['map'](_0x7f8ef1['result']['fields'],function(_0x240921){return{'id':_0x240921['name'],'name':_0x240921['label'],'custom':_[_0xb615('0x6c')](_0x240921[_0xb615('0x28')],_0xb615('0x6d'))?!![]:![],'options':_0x240921[_0xb615('0x2e')][_0xb615('0x28')]===_0xb615('0x6e')&&_0x240921[_0xb615('0x2e')][_0xb615('0x6f')][_0xb615('0x36')]>0x0?_[_0xb615('0x2b')](_0x240921[_0xb615('0x2e')][_0xb615('0x6f')],function(_0x385208){return{'name':_0x385208['label'],'value':_0x385208[_0xb615('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x53ef88,null))[_0xb615('0x43')](function(_0x55ac10){console[_0xb615('0x71')](_0xb615('0x72')+_0x55ac10);var _0x393219=_0x4833dd[_0xb615('0x31')][_0xb615('0x73')]?0x1f4:_0x55ac10[_0xb615('0x74')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x393219,JSON[_0xb615('0x75')](_0x55ac10));delete _0x55ac10[_0xb615('0x28')];if(_0x393219===0x191){_0x393219=0x190;}_0x53ef88[_0xb615('0x76')](_0x393219)[_0xb615('0x29')](_0x4833dd[_0xb615('0x31')][_0xb615('0x73')]?{'message':_0xb615('0x77'),'statusCode':_0x55ac10[_0xb615('0x74')]}:_0x55ac10);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f209db8..a3cee4d 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 _0xa5ad=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa5ad,0x1d4));var _0xda5a=function(_0x3e33cf,_0xd5b878){_0x3e33cf=_0x3e33cf-0x0;var _0x3c8b1a=_0xa5ad[_0x3e33cf];return _0x3c8b1a;};'use strict';var _=require('lodash');var util=require(_0xda5a('0x0'));var logger=require(_0xda5a('0x1'))('api');var moment=require(_0xda5a('0x2'));var BPromise=require(_0xda5a('0x3'));var rp=require(_0xda5a('0x4'));var fs=require('fs');var path=require(_0xda5a('0x5'));var rimraf=require(_0xda5a('0x6'));var config=require(_0xda5a('0x7'));var attributes=require(_0xda5a('0x8'));var integrations=require(_0xda5a('0x9'));module[_0xda5a('0xa')]=function(_0x5c4939,_0x40c514){return _0x5c4939[_0xda5a('0xb')](_0xda5a('0xc'),attributes,{'tableName':_0xda5a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x145f=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount'];(function(_0x9f7ed6,_0x1e40ec){var _0x5d7ce8=function(_0x531078){while(--_0x531078){_0x9f7ed6['push'](_0x9f7ed6['shift']());}};_0x5d7ce8(++_0x1e40ec);}(_0x145f,0x9a));var _0xf145=function(_0x25047d,_0x4c9074){_0x25047d=_0x25047d-0x0;var _0x468c52=_0x145f[_0x25047d];return _0x468c52;};'use strict';var _=require(_0xf145('0x0'));var util=require(_0xf145('0x1'));var logger=require('../../config/logger')(_0xf145('0x2'));var moment=require(_0xf145('0x3'));var BPromise=require(_0xf145('0x4'));var rp=require(_0xf145('0x5'));var fs=require('fs');var path=require(_0xf145('0x6'));var rimraf=require('rimraf');var config=require(_0xf145('0x7'));var attributes=require(_0xf145('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x302b83,_0x3dd489){return _0x302b83[_0xf145('0x9')](_0xf145('0xa'),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 688a890..c7f522c 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 _0x5c00=['where','limit','include','map','model','attributes','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw'];(function(_0x2a9ddd,_0x464cc0){var _0x5ad506=function(_0x4df7f3){while(--_0x4df7f3){_0x2a9ddd['push'](_0x2a9ddd['shift']());}};_0x5ad506(++_0x464cc0);}(_0x5c00,0x17e));var _0x05c0=function(_0x1d656c,_0x14fba4){_0x1d656c=_0x1d656c-0x0;var _0x4eeb25=_0x5c00[_0x1d656c];return _0x4eeb25;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});}exports[_0x05c0('0x16')]=function(_0x521cbd){var _0x422401=this;return new Promise(function(_0x1230e5,_0x4613c0){return db['VtigerAccount'][_0x05c0('0x17')]({'raw':_0x521cbd[_0x05c0('0x18')]?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x19')]===undefined?!![]:![]:!![],'where':_0x521cbd[_0x05c0('0x18')]?_0x521cbd['options'][_0x05c0('0x1a')]||null:null,'attributes':_0x521cbd[_0x05c0('0x18')]?_0x521cbd['options']['attributes']||null:null,'limit':_0x521cbd['options']?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x1b')]||null:null,'include':_0x521cbd[_0x05c0('0x18')]?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x521cbd[_0x05c0('0x18')]['include'],function(_0x9b4930){return{'model':db[_0x9b4930[_0x05c0('0x1e')]],'as':_0x9b4930['as'],'attributes':_0x9b4930['attributes'],'include':_0x9b4930['include']?_['map'](_0x9b4930['include'],function(_0x56aa78){return{'model':db[_0x56aa78[_0x05c0('0x1e')]],'as':_0x56aa78['as'],'attributes':_0x56aa78[_0x05c0('0x1f')],'include':_0x56aa78['include']?_[_0x05c0('0x1d')](_0x56aa78[_0x05c0('0x1c')],function(_0x3617dc){return{'model':db[_0x3617dc[_0x05c0('0x1e')]],'as':_0x3617dc['as'],'attributes':_0x3617dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x05c0('0xb')](function(_0x1c14b1){logger[_0x05c0('0xc')](_0x05c0('0x16'),_0x521cbd);logger[_0x05c0('0xf')](_0x05c0('0x16'),_0x521cbd,JSON['stringify'](_0x1c14b1));_0x1230e5(_0x1c14b1);})['catch'](function(_0x2df109){logger[_0x05c0('0x11')](_0x05c0('0x16'),_0x2df109[_0x05c0('0x13')],_0x521cbd);_0x4613c0(_0x422401[_0x05c0('0x11')](0x1f4,_0x2df109[_0x05c0('0x13')]));});});};exports[_0x05c0('0x20')]=function(_0x3c9eb1){var _0x33eff3=this;return new Promise(function(_0x87b07c,_0x3e38f0){return db[_0x05c0('0x21')]['find']({'raw':_0x3c9eb1['options']?_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x19')]===undefined?!![]:![]:!![],'where':_0x3c9eb1[_0x05c0('0x18')]?_0x3c9eb1['options'][_0x05c0('0x1a')]||null:null,'attributes':_0x3c9eb1[_0x05c0('0x18')]?_0x3c9eb1['options'][_0x05c0('0x1f')]||null:null,'include':_0x3c9eb1['options']?_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x1c')],function(_0x2a9e82){return{'model':db[_0x2a9e82[_0x05c0('0x1e')]],'as':_0x2a9e82['as'],'attributes':_0x2a9e82[_0x05c0('0x1f')],'include':_0x2a9e82[_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x2a9e82[_0x05c0('0x1c')],function(_0x3a9c63){return{'model':db[_0x3a9c63[_0x05c0('0x1e')]],'as':_0x3a9c63['as'],'attributes':_0x3a9c63[_0x05c0('0x1f')],'include':_0x3a9c63[_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x3a9c63[_0x05c0('0x1c')],function(_0x21c22){return{'model':db[_0x21c22[_0x05c0('0x1e')]],'as':_0x21c22['as'],'attributes':_0x21c22[_0x05c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x05c0('0xb')](function(_0x337847){logger[_0x05c0('0xc')](_0x05c0('0x20'),_0x3c9eb1);logger[_0x05c0('0xf')](_0x05c0('0x20'),_0x3c9eb1,JSON[_0x05c0('0x10')](_0x337847));_0x87b07c(_0x337847);})[_0x05c0('0x15')](function(_0x40d4db){logger[_0x05c0('0x11')](_0x05c0('0x20'),_0x40d4db[_0x05c0('0x13')],_0x3c9eb1);_0x3e38f0(_0x33eff3[_0x05c0('0x11')](0x1f4,_0x40d4db['message']));});});}; \ No newline at end of file +var _0x80ed=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetVtigerAccount','VtigerAccount','find','raw','debug','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x80ed,0x11c));var _0xd80e=function(_0x2390ec,_0x1c584){_0x2390ec=_0x2390ec-0x0;var _0x201a77=_0x80ed[_0x2390ec];return _0x201a77;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['GetVtigerAccount']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['VtigerAccount'][_0xd80e('0x17')]({'raw':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['attributes']||null:null,'limit':_0x21ceec['options']?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1a')]||null:null,'include':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x21ceec[_0xd80e('0x18')]['include'],function(_0x1fbf8a){return{'model':db[_0x1fbf8a[_0xd80e('0x1d')]],'as':_0x1fbf8a['as'],'attributes':_0x1fbf8a[_0xd80e('0x1e')],'include':_0x1fbf8a['include']?_[_0xd80e('0x1c')](_0x1fbf8a[_0xd80e('0x1b')],function(_0xe9bb59){return{'model':db[_0xe9bb59['model']],'as':_0xe9bb59['as'],'attributes':_0xe9bb59['attributes'],'include':_0xe9bb59['include']?_[_0xd80e('0x1c')](_0xe9bb59['include'],function(_0x9f9287){return{'model':db[_0x9f9287[_0xd80e('0x1d')]],'as':_0x9f9287['as'],'attributes':_0x9f9287['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0xe1c04a){logger[_0xd80e('0xd')](_0xd80e('0x1f'),_0x21ceec);logger['debug'](_0xd80e('0x1f'),_0x21ceec,JSON[_0xd80e('0x11')](_0xe1c04a));_0x3b543d(_0xe1c04a);})[_0xd80e('0x16')](function(_0x39088b){logger[_0xd80e('0x12')](_0xd80e('0x1f'),_0x39088b[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x39088b['message']));});});};exports['ShowVtigerAccount']=function(_0x30f9bd){var _0x1303eb=this;return new Promise(function(_0x400220,_0x32360c){return db[_0xd80e('0x20')][_0xd80e('0x21')]({'raw':_0x30f9bd['options']?_0x30f9bd['options'][_0xd80e('0x22')]===undefined?!![]:![]:!![],'where':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1e')]||null:null,'include':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd['options']['include']?_[_0xd80e('0x1c')](_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1b')],function(_0x12d113){return{'model':db[_0x12d113[_0xd80e('0x1d')]],'as':_0x12d113['as'],'attributes':_0x12d113[_0xd80e('0x1e')],'include':_0x12d113[_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x12d113[_0xd80e('0x1b')],function(_0x192c08){return{'model':db[_0x192c08['model']],'as':_0x192c08['as'],'attributes':_0x192c08[_0xd80e('0x1e')],'include':_0x192c08['include']?_[_0xd80e('0x1c')](_0x192c08[_0xd80e('0x1b')],function(_0x366b80){return{'model':db[_0x366b80[_0xd80e('0x1d')]],'as':_0x366b80['as'],'attributes':_0x366b80['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0x54a969){logger[_0xd80e('0xd')]('ShowVtigerAccount',_0x30f9bd);logger[_0xd80e('0x23')](_0xd80e('0x24'),_0x30f9bd,JSON['stringify'](_0x54a969));_0x400220(_0x54a969);})[_0xd80e('0x16')](function(_0x41ac0d){logger[_0xd80e('0x12')]('ShowVtigerAccount',_0x41ac0d[_0xd80e('0x14')],_0x30f9bd);_0x32360c(_0x1303eb[_0xd80e('0x12')](0x1f4,_0x41ac0d[_0xd80e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 89f25cc..bfb6cbb 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 _0x8cb3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8cb3,0xaf));var _0x38cb=function(_0x1627de,_0x4e3d39){_0x1627de=_0x1627de-0x0;var _0x397b80=_0x8cb3[_0x1627de];return _0x397b80;};'use strict';var multer=require(_0x38cb('0x0'));var util=require(_0x38cb('0x1'));var path=require(_0x38cb('0x2'));var timeout=require(_0x38cb('0x3'));var express=require(_0x38cb('0x4'));var router=express[_0x38cb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x38cb('0x6'));var interaction=require(_0x38cb('0x7'));var config=require(_0x38cb('0x8'));var controller=require(_0x38cb('0x9'));router[_0x38cb('0xa')]('/',auth[_0x38cb('0xb')](),controller[_0x38cb('0xc')]);router[_0x38cb('0xa')](_0x38cb('0xd'),auth[_0x38cb('0xb')](),controller[_0x38cb('0xe')]);router[_0x38cb('0xa')](_0x38cb('0xf'),auth[_0x38cb('0xb')](),controller[_0x38cb('0x10')]);router[_0x38cb('0xa')](_0x38cb('0x11'),auth[_0x38cb('0xb')](),controller['getSubjects']);router[_0x38cb('0xa')](_0x38cb('0x12'),auth[_0x38cb('0xb')](),controller[_0x38cb('0x13')]);router[_0x38cb('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x38cb('0x15')](_0x38cb('0xd'),auth[_0x38cb('0xb')](),controller[_0x38cb('0x16')]);router['delete'](_0x38cb('0xd'),auth[_0x38cb('0xb')](),controller[_0x38cb('0x17')]);module[_0x38cb('0x18')]=router; \ No newline at end of file +var _0x9ec8=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','post','create','update','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x163b7f,_0x54a632){var _0x177bda=function(_0x5ebf60){while(--_0x5ebf60){_0x163b7f['push'](_0x163b7f['shift']());}};_0x177bda(++_0x54a632);}(_0x9ec8,0x163));var _0x89ec=function(_0x3e2020,_0x30338d){_0x3e2020=_0x3e2020-0x0;var _0x2a338e=_0x9ec8[_0x3e2020];return _0x2a338e;};'use strict';var multer=require('multer');var util=require(_0x89ec('0x0'));var path=require('path');var timeout=require(_0x89ec('0x1'));var express=require(_0x89ec('0x2'));var router=express[_0x89ec('0x3')]();var fs_extra=require(_0x89ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x89ec('0x5'));var config=require(_0x89ec('0x6'));var controller=require(_0x89ec('0x7'));router[_0x89ec('0x8')]('/',auth[_0x89ec('0x9')](),controller[_0x89ec('0xa')]);router[_0x89ec('0x8')](_0x89ec('0xb'),auth['isAuthenticated'](),controller[_0x89ec('0xc')]);router[_0x89ec('0x8')](_0x89ec('0xd'),auth[_0x89ec('0x9')](),controller['getFields']);router[_0x89ec('0x8')]('/:id/subjects',auth[_0x89ec('0x9')](),controller[_0x89ec('0xe')]);router['get'](_0x89ec('0xf'),auth[_0x89ec('0x9')](),controller['getDescriptions']);router[_0x89ec('0x10')]('/',auth[_0x89ec('0x9')](),controller[_0x89ec('0x11')]);router['put'](_0x89ec('0xb'),auth[_0x89ec('0x9')](),controller[_0x89ec('0x12')]);router['delete'](_0x89ec('0xb'),auth[_0x89ec('0x9')](),controller['destroy']);module[_0x89ec('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e71f4fa..aeef977 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 _0xaad0=['sequelize'];(function(_0x214b03,_0x351f66){var _0x186fcb=function(_0x524981){while(--_0x524981){_0x214b03['push'](_0x214b03['shift']());}};_0x186fcb(++_0x351f66);}(_0xaad0,0x1d5));var _0x0aad=function(_0x400001,_0x4b768f){_0x400001=_0x400001-0x0;var _0x343fbe=_0xaad0[_0x400001];return _0x343fbe;};'use strict';var Sequelize=require(_0x0aad('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x534e=['STRING','exports'];(function(_0x25f405,_0x13ad96){var _0x36c45e=function(_0x2c5f45){while(--_0x2c5f45){_0x25f405['push'](_0x25f405['shift']());}};_0x36c45e(++_0x13ad96);}(_0x534e,0x15f));var _0xe534=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0x534e[_0x16eb11];return _0x3ae7ef;};'use strict';var Sequelize=require('sequelize');module[_0xe534('0x0')]={'name':{'type':Sequelize[_0xe534('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a64ec55..0e29b22 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 _0xf9ec=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','options','VtigerConfiguration','include','rows','catch','keys','create','body','params','find','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis'];(function(_0x1b164a,_0x15fd4b){var _0x137e0f=function(_0x73b961){while(--_0x73b961){_0x1b164a['push'](_0x1b164a['shift']());}};_0x137e0f(++_0x15fd4b);}(_0xf9ec,0x128));var _0xcf9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9ec[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xcf9e('0x0'));var rimraf=require(_0xcf9e('0x1'));var zipdir=require(_0xcf9e('0x2'));var jsonpatch=require(_0xcf9e('0x3'));var rp=require(_0xcf9e('0x4'));var moment=require(_0xcf9e('0x5'));var BPromise=require(_0xcf9e('0x6'));var Mustache=require(_0xcf9e('0x7'));var util=require('util');var path=require(_0xcf9e('0x8'));var sox=require('sox');var csv=require(_0xcf9e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf9e('0xa'));var _=require(_0xcf9e('0xb'));var squel=require(_0xcf9e('0xc'));var crypto=require(_0xcf9e('0xd'));var jsforce=require(_0xcf9e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcf9e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcf9e('0xf'));var authService=require(_0xcf9e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcf9e('0x11'));var hardwareService=require(_0xcf9e('0x12'));var logger=require(_0xcf9e('0x13'))(_0xcf9e('0x14'));var utils=require(_0xcf9e('0x15'));var config=require(_0xcf9e('0x16'));var licenseUtil=require(_0xcf9e('0x17'));var db=require(_0xcf9e('0x18'))['db'];function respondWithStatusCode(_0x65424c,_0x83019a){_0x83019a=_0x83019a||0xcc;return function(_0x2bc440){if(_0x2bc440){return _0x65424c[_0xcf9e('0x19')](_0x83019a);}return _0x65424c[_0xcf9e('0x1a')](_0x83019a)[_0xcf9e('0x1b')]();};}function respondWithResult(_0x3675d6,_0x3abcd5){_0x3abcd5=_0x3abcd5||0xc8;return function(_0x262c71){if(_0x262c71){return _0x3675d6[_0xcf9e('0x1a')](_0x3abcd5)['json'](_0x262c71);}};}function respondWithFilteredResult(_0x579684,_0x1ceea2){return function(_0x4e5eb1){if(_0x4e5eb1){var _0x5a63c6=typeof _0x1ceea2[_0xcf9e('0x1c')]===_0xcf9e('0x1d')&&typeof _0x1ceea2['limit']==='undefined';var _0x4cf936=_0x4e5eb1[_0xcf9e('0x1e')];var _0x3a9e24=_0x5a63c6?0x0:_0x1ceea2['offset'];var _0x1c3852=_0x5a63c6?_0x4e5eb1[_0xcf9e('0x1e')]:_0x1ceea2[_0xcf9e('0x1c')]+_0x1ceea2['limit'];var _0x1698e3;if(_0x1c3852>=_0x4cf936){_0x1c3852=_0x4cf936;_0x1698e3=0xc8;}else{_0x1698e3=0xce;}_0x579684[_0xcf9e('0x1a')](_0x1698e3);return _0x579684['set'](_0xcf9e('0x1f'),_0x3a9e24+'-'+_0x1c3852+'/'+_0x4cf936)['json'](_0x4e5eb1);}return null;};}function patchUpdates(_0x52d6fa){return function(_0x366f1d){try{jsonpatch['apply'](_0x366f1d,_0x52d6fa,!![]);}catch(_0x375c01){return BPromise[_0xcf9e('0x20')](_0x375c01);}return _0x366f1d[_0xcf9e('0x21')]();};}function saveUpdates(_0x3ef972,_0x46e589){return function(_0x305842){if(_0x305842){return _0x305842[_0xcf9e('0x22')](_0x3ef972)[_0xcf9e('0x23')](function(_0x2cd8bd){return _0x2cd8bd;});}return null;};}function removeEntity(_0x450ac1,_0x161aca){return function(_0x5912a6){if(_0x5912a6){return _0x5912a6[_0xcf9e('0x24')]()[_0xcf9e('0x23')](function(){_0x450ac1[_0xcf9e('0x1a')](0xcc)[_0xcf9e('0x1b')]();});}};}function handleEntityNotFound(_0x42e2fc,_0x3d917b){return function(_0x137a59){if(!_0x137a59){_0x42e2fc[_0xcf9e('0x19')](0x194);}return _0x137a59;};}function handleError(_0x55913c,_0xede08){_0xede08=_0xede08||0x1f4;return function(_0x340e4f){logger[_0xcf9e('0x25')](_0x340e4f[_0xcf9e('0x26')]);if(_0x340e4f[_0xcf9e('0x27')]){delete _0x340e4f[_0xcf9e('0x27')];}_0x55913c['status'](_0xede08)[_0xcf9e('0x28')](_0x340e4f);};}exports[_0xcf9e('0x29')]=function(_0x4a0b6d,_0x28a7be){var _0x385ffc={},_0xf1f32b={},_0x67bcaa={'count':0x0,'rows':[]};var _0x1a7c3e=_[_0xcf9e('0x2a')](db['VtigerConfiguration'][_0xcf9e('0x2b')],function(_0x452127){return{'name':_0x452127['fieldName'],'type':_0x452127[_0xcf9e('0x2c')][_0xcf9e('0x2d')]};});_0xf1f32b[_0xcf9e('0x2e')]=_[_0xcf9e('0x2a')](_0x1a7c3e,_0xcf9e('0x27'));_0xf1f32b['query']=_['keys'](_0x4a0b6d[_0xcf9e('0x2f')]);_0xf1f32b[_0xcf9e('0x30')]=_[_0xcf9e('0x31')](_0xf1f32b[_0xcf9e('0x2e')],_0xf1f32b['query']);_0x385ffc[_0xcf9e('0x32')]=_[_0xcf9e('0x31')](_0xf1f32b[_0xcf9e('0x2e')],qs[_0xcf9e('0x33')](_0x4a0b6d[_0xcf9e('0x2f')][_0xcf9e('0x33')]));_0x385ffc['attributes']=_0x385ffc[_0xcf9e('0x32')][_0xcf9e('0x34')]?_0x385ffc[_0xcf9e('0x32')]:_0xf1f32b[_0xcf9e('0x2e')];if(!_0x4a0b6d[_0xcf9e('0x2f')][_0xcf9e('0x35')](_0xcf9e('0x36'))){_0x385ffc[_0xcf9e('0x37')]=qs[_0xcf9e('0x37')](_0x4a0b6d['query'][_0xcf9e('0x37')]);_0x385ffc[_0xcf9e('0x1c')]=qs[_0xcf9e('0x1c')](_0x4a0b6d[_0xcf9e('0x2f')][_0xcf9e('0x1c')]);}_0x385ffc[_0xcf9e('0x38')]=qs['sort'](_0x4a0b6d[_0xcf9e('0x2f')][_0xcf9e('0x39')]);_0x385ffc['where']=qs[_0xcf9e('0x30')](_['pick'](_0x4a0b6d['query'],_0xf1f32b['filters']),_0x1a7c3e);if(_0x4a0b6d[_0xcf9e('0x2f')][_0xcf9e('0x3a')]){_0x385ffc['where']=_[_0xcf9e('0x3b')](_0x385ffc[_0xcf9e('0x3c')],{'$or':_[_0xcf9e('0x2a')](_0x1a7c3e,function(_0xf20717){if(_0xf20717['type']!==_0xcf9e('0x3d')){var _0x2abf2d={};_0x2abf2d[_0xf20717[_0xcf9e('0x27')]]={'$like':'%'+_0x4a0b6d[_0xcf9e('0x2f')][_0xcf9e('0x3a')]+'%'};return _0x2abf2d;}})});}_0x385ffc=_[_0xcf9e('0x3b')]({},_0x385ffc,_0x4a0b6d[_0xcf9e('0x3e')]);var _0x530f95={'where':_0x385ffc[_0xcf9e('0x3c')]};return db[_0xcf9e('0x3f')]['count'](_0x530f95)[_0xcf9e('0x23')](function(_0x10b78b){_0x67bcaa[_0xcf9e('0x1e')]=_0x10b78b;if(_0x4a0b6d[_0xcf9e('0x2f')]['includeAll']){_0x385ffc[_0xcf9e('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x385ffc);})[_0xcf9e('0x23')](function(_0x1c1e66){_0x67bcaa[_0xcf9e('0x41')]=_0x1c1e66;return _0x67bcaa;})[_0xcf9e('0x23')](respondWithFilteredResult(_0x28a7be,_0x385ffc))[_0xcf9e('0x42')](handleError(_0x28a7be,null));};exports['show']=function(_0x5d18f5,_0x573642){var _0x46ee00={'raw':![],'where':{'id':_0x5d18f5['params']['id']}},_0x39fdd7={};_0x39fdd7['model']=_[_0xcf9e('0x43')](db[_0xcf9e('0x3f')][_0xcf9e('0x2b')]);_0x39fdd7[_0xcf9e('0x2f')]=_[_0xcf9e('0x43')](_0x5d18f5[_0xcf9e('0x2f')]);_0x39fdd7[_0xcf9e('0x30')]=_[_0xcf9e('0x31')](_0x39fdd7[_0xcf9e('0x2e')],_0x39fdd7['query']);_0x46ee00[_0xcf9e('0x32')]=_['intersection'](_0x39fdd7['model'],qs[_0xcf9e('0x33')](_0x5d18f5[_0xcf9e('0x2f')][_0xcf9e('0x33')]));_0x46ee00['attributes']=_0x46ee00[_0xcf9e('0x32')][_0xcf9e('0x34')]?_0x46ee00[_0xcf9e('0x32')]:_0x39fdd7[_0xcf9e('0x2e')];if(_0x5d18f5['query']['includeAll']){_0x46ee00['include']=[{'all':!![]}];}_0x46ee00=_[_0xcf9e('0x3b')]({},_0x46ee00,_0x5d18f5[_0xcf9e('0x3e')]);return db[_0xcf9e('0x3f')]['find'](_0x46ee00)[_0xcf9e('0x23')](handleEntityNotFound(_0x573642,null))[_0xcf9e('0x23')](respondWithResult(_0x573642,null))[_0xcf9e('0x42')](handleError(_0x573642,null));};exports['create']=function(_0x5e3b1b,_0x26784e){return db[_0xcf9e('0x3f')][_0xcf9e('0x44')](_0x5e3b1b[_0xcf9e('0x45')],{})['then'](respondWithResult(_0x26784e,0xc9))['catch'](handleError(_0x26784e,null));};exports['update']=function(_0x28bb75,_0x4b1669){if(_0x28bb75['body']['id']){delete _0x28bb75[_0xcf9e('0x45')]['id'];}return db[_0xcf9e('0x3f')]['find']({'where':{'id':_0x28bb75[_0xcf9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b1669,null))[_0xcf9e('0x23')](saveUpdates(_0x28bb75['body'],null))[_0xcf9e('0x23')](respondWithResult(_0x4b1669,null))['catch'](handleError(_0x4b1669,null));};exports[_0xcf9e('0x24')]=function(_0x12dcce,_0x83e9c0){return db[_0xcf9e('0x3f')][_0xcf9e('0x47')]({'where':{'id':_0x12dcce[_0xcf9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x83e9c0,null))[_0xcf9e('0x23')](removeEntity(_0x83e9c0,null))[_0xcf9e('0x42')](handleError(_0x83e9c0,null));};exports[_0xcf9e('0x48')]=function(_0xa825e,_0x2244b7,_0x23b64d){var _0x3a8906={};var _0x1acafd={};var _0x773fcc;var _0x542557;return db[_0xcf9e('0x3f')][_0xcf9e('0x49')]({'where':{'id':_0xa825e[_0xcf9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2244b7,null))['then'](function(_0x1075fc){if(_0x1075fc){_0x773fcc=_0x1075fc;_0x1acafd['model']=_['keys'](db['VtigerField'][_0xcf9e('0x2b')]);_0x1acafd['query']=_[_0xcf9e('0x43')](_0xa825e['query']);_0x1acafd[_0xcf9e('0x30')]=_[_0xcf9e('0x31')](_0x1acafd[_0xcf9e('0x2e')],_0x1acafd[_0xcf9e('0x2f')]);_0x3a8906[_0xcf9e('0x32')]=_[_0xcf9e('0x31')](_0x1acafd[_0xcf9e('0x2e')],qs[_0xcf9e('0x33')](_0xa825e[_0xcf9e('0x2f')][_0xcf9e('0x33')]));_0x3a8906[_0xcf9e('0x32')]=_0x3a8906['attributes']['length']?_0x3a8906[_0xcf9e('0x32')]:_0x1acafd[_0xcf9e('0x2e')];_0x3a8906[_0xcf9e('0x38')]=qs[_0xcf9e('0x39')](_0xa825e['query'][_0xcf9e('0x39')]);_0x3a8906[_0xcf9e('0x3c')]=qs[_0xcf9e('0x30')](_['pick'](_0xa825e[_0xcf9e('0x2f')],_0x1acafd['filters']));if(_0xa825e[_0xcf9e('0x2f')][_0xcf9e('0x3a')]){_0x3a8906[_0xcf9e('0x3c')]=_[_0xcf9e('0x3b')](_0x3a8906['where'],{'$or':_['map'](_0x3a8906['attributes'],function(_0x3824a6){var _0x4d1969={};_0x4d1969[_0x3824a6]={'$like':'%'+_0xa825e['query'][_0xcf9e('0x3a')]+'%'};return _0x4d1969;})});}_0x3a8906=_[_0xcf9e('0x3b')]({},_0x3a8906,_0xa825e['options']);return _0x773fcc['getFields'](_0x3a8906);}})['then'](function(_0x22e4f6){if(_0x22e4f6){_0x542557=_0x22e4f6[_0xcf9e('0x34')];if(!_0xa825e[_0xcf9e('0x2f')]['hasOwnProperty'](_0xcf9e('0x36'))){_0x3a8906[_0xcf9e('0x37')]=qs['limit'](_0xa825e['query'][_0xcf9e('0x37')]);_0x3a8906['offset']=qs[_0xcf9e('0x1c')](_0xa825e[_0xcf9e('0x2f')]['offset']);}return _0x773fcc[_0xcf9e('0x48')](_0x3a8906);}})[_0xcf9e('0x23')](function(_0x224720){if(_0x224720){return _0x224720?{'count':_0x542557,'rows':_0x224720}:null;}})['then'](respondWithResult(_0x2244b7,null))['catch'](handleError(_0x2244b7,null));};exports['getSubjects']=function(_0x3cb7d7,_0x170c5b,_0x27fb77){var _0x126a98={};var _0x26c746={};var _0xd79e52;var _0x1f6e9f;return db['VtigerConfiguration'][_0xcf9e('0x49')]({'where':{'id':_0x3cb7d7[_0xcf9e('0x46')]['id']}})[_0xcf9e('0x23')](handleEntityNotFound(_0x170c5b,null))[_0xcf9e('0x23')](function(_0xeaf231){if(_0xeaf231){_0xd79e52=_0xeaf231;_0x26c746[_0xcf9e('0x2e')]=_[_0xcf9e('0x43')](db[_0xcf9e('0x4a')][_0xcf9e('0x2b')]);_0x26c746[_0xcf9e('0x2f')]=_[_0xcf9e('0x43')](_0x3cb7d7['query']);_0x26c746[_0xcf9e('0x30')]=_['intersection'](_0x26c746['model'],_0x26c746[_0xcf9e('0x2f')]);_0x126a98[_0xcf9e('0x32')]=_[_0xcf9e('0x31')](_0x26c746[_0xcf9e('0x2e')],qs[_0xcf9e('0x33')](_0x3cb7d7[_0xcf9e('0x2f')][_0xcf9e('0x33')]));_0x126a98[_0xcf9e('0x32')]=_0x126a98[_0xcf9e('0x32')]['length']?_0x126a98['attributes']:_0x26c746[_0xcf9e('0x2e')];_0x126a98[_0xcf9e('0x38')]=qs[_0xcf9e('0x39')](_0x3cb7d7[_0xcf9e('0x2f')][_0xcf9e('0x39')]);_0x126a98['where']=qs[_0xcf9e('0x30')](_[_0xcf9e('0x4b')](_0x3cb7d7[_0xcf9e('0x2f')],_0x26c746[_0xcf9e('0x30')]));if(_0x3cb7d7[_0xcf9e('0x2f')][_0xcf9e('0x3a')]){_0x126a98[_0xcf9e('0x3c')]=_[_0xcf9e('0x3b')](_0x126a98[_0xcf9e('0x3c')],{'$or':_[_0xcf9e('0x2a')](_0x126a98[_0xcf9e('0x32')],function(_0x29d760){var _0x3924e6={};_0x3924e6[_0x29d760]={'$like':'%'+_0x3cb7d7[_0xcf9e('0x2f')][_0xcf9e('0x3a')]+'%'};return _0x3924e6;})});}_0x126a98=_[_0xcf9e('0x3b')]({},_0x126a98,_0x3cb7d7['options']);return _0xd79e52[_0xcf9e('0x4c')](_0x126a98);}})['then'](function(_0x1deac9){if(_0x1deac9){_0x1f6e9f=_0x1deac9[_0xcf9e('0x34')];if(!_0x3cb7d7[_0xcf9e('0x2f')][_0xcf9e('0x35')](_0xcf9e('0x36'))){_0x126a98['limit']=qs[_0xcf9e('0x37')](_0x3cb7d7['query']['limit']);_0x126a98[_0xcf9e('0x1c')]=qs['offset'](_0x3cb7d7['query'][_0xcf9e('0x1c')]);}return _0xd79e52[_0xcf9e('0x4c')](_0x126a98);}})[_0xcf9e('0x23')](function(_0x4dabad){if(_0x4dabad){return _0x4dabad?{'count':_0x1f6e9f,'rows':_0x4dabad}:null;}})[_0xcf9e('0x23')](respondWithResult(_0x170c5b,null))[_0xcf9e('0x42')](handleError(_0x170c5b,null));};exports[_0xcf9e('0x4d')]=function(_0x52988c,_0x532ae7,_0x500c71){var _0x36de10={};var _0x8298e6={};var _0x34864f;var _0xb7ce1d;return db[_0xcf9e('0x3f')]['findOne']({'where':{'id':_0x52988c[_0xcf9e('0x46')]['id']}})[_0xcf9e('0x23')](handleEntityNotFound(_0x532ae7,null))['then'](function(_0x5902ad){if(_0x5902ad){_0x34864f=_0x5902ad;_0x8298e6['model']=_[_0xcf9e('0x43')](db[_0xcf9e('0x4a')]['rawAttributes']);_0x8298e6[_0xcf9e('0x2f')]=_[_0xcf9e('0x43')](_0x52988c[_0xcf9e('0x2f')]);_0x8298e6[_0xcf9e('0x30')]=_[_0xcf9e('0x31')](_0x8298e6['model'],_0x8298e6[_0xcf9e('0x2f')]);_0x36de10[_0xcf9e('0x32')]=_[_0xcf9e('0x31')](_0x8298e6[_0xcf9e('0x2e')],qs[_0xcf9e('0x33')](_0x52988c[_0xcf9e('0x2f')][_0xcf9e('0x33')]));_0x36de10[_0xcf9e('0x32')]=_0x36de10[_0xcf9e('0x32')]['length']?_0x36de10[_0xcf9e('0x32')]:_0x8298e6[_0xcf9e('0x2e')];_0x36de10['order']=qs[_0xcf9e('0x39')](_0x52988c['query'][_0xcf9e('0x39')]);_0x36de10[_0xcf9e('0x3c')]=qs['filters'](_[_0xcf9e('0x4b')](_0x52988c[_0xcf9e('0x2f')],_0x8298e6[_0xcf9e('0x30')]));if(_0x52988c[_0xcf9e('0x2f')][_0xcf9e('0x3a')]){_0x36de10[_0xcf9e('0x3c')]=_['merge'](_0x36de10[_0xcf9e('0x3c')],{'$or':_[_0xcf9e('0x2a')](_0x36de10['attributes'],function(_0x25b579){var _0x4fb4ef={};_0x4fb4ef[_0x25b579]={'$like':'%'+_0x52988c['query']['filter']+'%'};return _0x4fb4ef;})});}_0x36de10=_[_0xcf9e('0x3b')]({},_0x36de10,_0x52988c[_0xcf9e('0x3e')]);return _0x34864f[_0xcf9e('0x4d')](_0x36de10);}})[_0xcf9e('0x23')](function(_0x466fdc){if(_0x466fdc){_0xb7ce1d=_0x466fdc['length'];if(!_0x52988c[_0xcf9e('0x2f')][_0xcf9e('0x35')]('nolimit')){_0x36de10['limit']=qs['limit'](_0x52988c['query'][_0xcf9e('0x37')]);_0x36de10[_0xcf9e('0x1c')]=qs[_0xcf9e('0x1c')](_0x52988c[_0xcf9e('0x2f')]['offset']);}return _0x34864f['getDescriptions'](_0x36de10);}})[_0xcf9e('0x23')](function(_0x2b1eb6){if(_0x2b1eb6){return _0x2b1eb6?{'count':_0xb7ce1d,'rows':_0x2b1eb6}:null;}})[_0xcf9e('0x23')](respondWithResult(_0x532ae7,null))[_0xcf9e('0x42')](handleError(_0x532ae7,null));}; \ No newline at end of file +var _0xacb8=['error','stack','name','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','catch','findOne','rawAttributes','getFields','getSubjects','getDescriptions','VtigerField','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x564d0f,_0x826bf2){var _0x28b2be=function(_0x32041d){while(--_0x32041d){_0x564d0f['push'](_0x564d0f['shift']());}};_0x28b2be(++_0x826bf2);}(_0xacb8,0x119));var _0x8acb=function(_0x35aeda,_0x264a31){_0x35aeda=_0x35aeda-0x0;var _0x40498c=_0xacb8[_0x35aeda];return _0x40498c;};'use strict';var emlformat=require(_0x8acb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8acb('0x1'));var jsonpatch=require(_0x8acb('0x2'));var rp=require(_0x8acb('0x3'));var moment=require('moment');var BPromise=require(_0x8acb('0x4'));var Mustache=require(_0x8acb('0x5'));var util=require('util');var path=require(_0x8acb('0x6'));var sox=require(_0x8acb('0x7'));var csv=require(_0x8acb('0x8'));var ejs=require(_0x8acb('0x9'));var fs=require('fs');var fs_extra=require(_0x8acb('0xa'));var _=require(_0x8acb('0xb'));var squel=require('squel');var crypto=require(_0x8acb('0xc'));var jsforce=require(_0x8acb('0xd'));var deskjs=require(_0x8acb('0xe'));var toCsv=require(_0x8acb('0x8'));var querystring=require(_0x8acb('0xf'));var Papa=require(_0x8acb('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8acb('0x11'));var as=require(_0x8acb('0x12'));var hardwareService=require(_0x8acb('0x13'));var logger=require(_0x8acb('0x14'))('api');var utils=require(_0x8acb('0x15'));var config=require(_0x8acb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8acb('0x17'))['db'];function respondWithStatusCode(_0x414e09,_0x7a7daa){_0x7a7daa=_0x7a7daa||0xcc;return function(_0x391ac3){if(_0x391ac3){return _0x414e09[_0x8acb('0x18')](_0x7a7daa);}return _0x414e09['status'](_0x7a7daa)[_0x8acb('0x19')]();};}function respondWithResult(_0x402959,_0x2b0fd4){_0x2b0fd4=_0x2b0fd4||0xc8;return function(_0x3d47f4){if(_0x3d47f4){return _0x402959[_0x8acb('0x1a')](_0x2b0fd4)[_0x8acb('0x1b')](_0x3d47f4);}};}function respondWithFilteredResult(_0x580151,_0x4525b6){return function(_0x20b809){if(_0x20b809){var _0x1fa864=typeof _0x4525b6[_0x8acb('0x1c')]===_0x8acb('0x1d')&&typeof _0x4525b6[_0x8acb('0x1e')]===_0x8acb('0x1d');var _0x2d0635=_0x20b809[_0x8acb('0x1f')];var _0x5c8edc=_0x1fa864?0x0:_0x4525b6[_0x8acb('0x1c')];var _0x49dee5=_0x1fa864?_0x20b809['count']:_0x4525b6['offset']+_0x4525b6[_0x8acb('0x1e')];var _0x4bbf34;if(_0x49dee5>=_0x2d0635){_0x49dee5=_0x2d0635;_0x4bbf34=0xc8;}else{_0x4bbf34=0xce;}_0x580151[_0x8acb('0x1a')](_0x4bbf34);return _0x580151[_0x8acb('0x20')]('Content-Range',_0x5c8edc+'-'+_0x49dee5+'/'+_0x2d0635)[_0x8acb('0x1b')](_0x20b809);}return null;};}function patchUpdates(_0x926cd7){return function(_0x14865c){try{jsonpatch[_0x8acb('0x21')](_0x14865c,_0x926cd7,!![]);}catch(_0x242eab){return BPromise[_0x8acb('0x22')](_0x242eab);}return _0x14865c[_0x8acb('0x23')]();};}function saveUpdates(_0x52f6c3,_0x494bff){return function(_0x316258){if(_0x316258){return _0x316258[_0x8acb('0x24')](_0x52f6c3)[_0x8acb('0x25')](function(_0x365f68){return _0x365f68;});}return null;};}function removeEntity(_0x344bde,_0x3db998){return function(_0x38bb75){if(_0x38bb75){return _0x38bb75[_0x8acb('0x26')]()['then'](function(){_0x344bde[_0x8acb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x273a4c,_0x4f224d){return function(_0x2591d6){if(!_0x2591d6){_0x273a4c[_0x8acb('0x18')](0x194);}return _0x2591d6;};}function handleError(_0x55b5fd,_0x462749){_0x462749=_0x462749||0x1f4;return function(_0x4e0c59){logger[_0x8acb('0x27')](_0x4e0c59[_0x8acb('0x28')]);if(_0x4e0c59[_0x8acb('0x29')]){delete _0x4e0c59[_0x8acb('0x29')];}_0x55b5fd[_0x8acb('0x1a')](_0x462749)['send'](_0x4e0c59);};}exports[_0x8acb('0x2a')]=function(_0x3e184c,_0x36f2a6){var _0x31770d={},_0x88a7e0={},_0x1bd338={'count':0x0,'rows':[]};var _0x29be92=_[_0x8acb('0x2b')](db[_0x8acb('0x2c')]['rawAttributes'],function(_0x2ff5b8){return{'name':_0x2ff5b8[_0x8acb('0x2d')],'type':_0x2ff5b8[_0x8acb('0x2e')][_0x8acb('0x2f')]};});_0x88a7e0[_0x8acb('0x30')]=_[_0x8acb('0x2b')](_0x29be92,_0x8acb('0x29'));_0x88a7e0[_0x8acb('0x31')]=_[_0x8acb('0x32')](_0x3e184c['query']);_0x88a7e0[_0x8acb('0x33')]=_['intersection'](_0x88a7e0['model'],_0x88a7e0[_0x8acb('0x31')]);_0x31770d['attributes']=_[_0x8acb('0x34')](_0x88a7e0[_0x8acb('0x30')],qs[_0x8acb('0x35')](_0x3e184c[_0x8acb('0x31')][_0x8acb('0x35')]));_0x31770d[_0x8acb('0x36')]=_0x31770d[_0x8acb('0x36')][_0x8acb('0x37')]?_0x31770d[_0x8acb('0x36')]:_0x88a7e0[_0x8acb('0x30')];if(!_0x3e184c[_0x8acb('0x31')][_0x8acb('0x38')](_0x8acb('0x39'))){_0x31770d[_0x8acb('0x1e')]=qs[_0x8acb('0x1e')](_0x3e184c[_0x8acb('0x31')][_0x8acb('0x1e')]);_0x31770d[_0x8acb('0x1c')]=qs[_0x8acb('0x1c')](_0x3e184c[_0x8acb('0x31')][_0x8acb('0x1c')]);}_0x31770d[_0x8acb('0x3a')]=qs['sort'](_0x3e184c['query'][_0x8acb('0x3b')]);_0x31770d[_0x8acb('0x3c')]=qs['filters'](_[_0x8acb('0x3d')](_0x3e184c['query'],_0x88a7e0[_0x8acb('0x33')]),_0x29be92);if(_0x3e184c[_0x8acb('0x31')][_0x8acb('0x3e')]){_0x31770d[_0x8acb('0x3c')]=_[_0x8acb('0x3f')](_0x31770d[_0x8acb('0x3c')],{'$or':_[_0x8acb('0x2b')](_0x29be92,function(_0x5053e7){if(_0x5053e7['type']!=='VIRTUAL'){var _0x836c93={};_0x836c93[_0x5053e7[_0x8acb('0x29')]]={'$like':'%'+_0x3e184c[_0x8acb('0x31')]['filter']+'%'};return _0x836c93;}})});}_0x31770d=_['merge']({},_0x31770d,_0x3e184c[_0x8acb('0x40')]);var _0x19e757={'where':_0x31770d[_0x8acb('0x3c')]};return db['VtigerConfiguration'][_0x8acb('0x1f')](_0x19e757)[_0x8acb('0x25')](function(_0xdbd290){_0x1bd338['count']=_0xdbd290;if(_0x3e184c[_0x8acb('0x31')][_0x8acb('0x41')]){_0x31770d[_0x8acb('0x42')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x8acb('0x43')](_0x31770d);})[_0x8acb('0x25')](function(_0x46a11e){_0x1bd338['rows']=_0x46a11e;return _0x1bd338;})[_0x8acb('0x25')](respondWithFilteredResult(_0x36f2a6,_0x31770d))['catch'](handleError(_0x36f2a6,null));};exports[_0x8acb('0x44')]=function(_0x389189,_0x586526){var _0x2d67ee={'raw':![],'where':{'id':_0x389189[_0x8acb('0x45')]['id']}},_0x44ef89={};_0x44ef89[_0x8acb('0x30')]=_['keys'](db[_0x8acb('0x2c')]['rawAttributes']);_0x44ef89[_0x8acb('0x31')]=_['keys'](_0x389189[_0x8acb('0x31')]);_0x44ef89[_0x8acb('0x33')]=_['intersection'](_0x44ef89[_0x8acb('0x30')],_0x44ef89[_0x8acb('0x31')]);_0x2d67ee[_0x8acb('0x36')]=_[_0x8acb('0x34')](_0x44ef89['model'],qs[_0x8acb('0x35')](_0x389189[_0x8acb('0x31')][_0x8acb('0x35')]));_0x2d67ee['attributes']=_0x2d67ee[_0x8acb('0x36')][_0x8acb('0x37')]?_0x2d67ee[_0x8acb('0x36')]:_0x44ef89[_0x8acb('0x30')];if(_0x389189[_0x8acb('0x31')][_0x8acb('0x41')]){_0x2d67ee[_0x8acb('0x42')]=[{'all':!![]}];}_0x2d67ee=_['merge']({},_0x2d67ee,_0x389189[_0x8acb('0x40')]);return db['VtigerConfiguration'][_0x8acb('0x46')](_0x2d67ee)[_0x8acb('0x25')](handleEntityNotFound(_0x586526,null))[_0x8acb('0x25')](respondWithResult(_0x586526,null))['catch'](handleError(_0x586526,null));};exports[_0x8acb('0x47')]=function(_0x18e940,_0x5582bf){return db[_0x8acb('0x2c')][_0x8acb('0x47')](_0x18e940[_0x8acb('0x48')],{})[_0x8acb('0x25')](respondWithResult(_0x5582bf,0xc9))[_0x8acb('0x49')](handleError(_0x5582bf,null));};exports[_0x8acb('0x24')]=function(_0x5ad1d7,_0x311920){if(_0x5ad1d7['body']['id']){delete _0x5ad1d7[_0x8acb('0x48')]['id'];}return db[_0x8acb('0x2c')][_0x8acb('0x46')]({'where':{'id':_0x5ad1d7[_0x8acb('0x45')]['id']}})[_0x8acb('0x25')](handleEntityNotFound(_0x311920,null))[_0x8acb('0x25')](saveUpdates(_0x5ad1d7[_0x8acb('0x48')],null))[_0x8acb('0x25')](respondWithResult(_0x311920,null))[_0x8acb('0x49')](handleError(_0x311920,null));};exports[_0x8acb('0x26')]=function(_0x1bd115,_0x515076){return db['VtigerConfiguration'][_0x8acb('0x46')]({'where':{'id':_0x1bd115[_0x8acb('0x45')]['id']}})['then'](handleEntityNotFound(_0x515076,null))[_0x8acb('0x25')](removeEntity(_0x515076,null))[_0x8acb('0x49')](handleError(_0x515076,null));};exports['getFields']=function(_0x1b428a,_0x2af055,_0x32b875){var _0x77b4a0={};var _0x3e9d0f={};var _0x110e4b;var _0x5065a9;return db['VtigerConfiguration'][_0x8acb('0x4a')]({'where':{'id':_0x1b428a[_0x8acb('0x45')]['id']}})[_0x8acb('0x25')](handleEntityNotFound(_0x2af055,null))[_0x8acb('0x25')](function(_0x9c9538){if(_0x9c9538){_0x110e4b=_0x9c9538;_0x3e9d0f['model']=_[_0x8acb('0x32')](db['VtigerField'][_0x8acb('0x4b')]);_0x3e9d0f[_0x8acb('0x31')]=_[_0x8acb('0x32')](_0x1b428a[_0x8acb('0x31')]);_0x3e9d0f[_0x8acb('0x33')]=_[_0x8acb('0x34')](_0x3e9d0f[_0x8acb('0x30')],_0x3e9d0f[_0x8acb('0x31')]);_0x77b4a0['attributes']=_['intersection'](_0x3e9d0f[_0x8acb('0x30')],qs['fields'](_0x1b428a['query']['fields']));_0x77b4a0['attributes']=_0x77b4a0[_0x8acb('0x36')][_0x8acb('0x37')]?_0x77b4a0[_0x8acb('0x36')]:_0x3e9d0f[_0x8acb('0x30')];_0x77b4a0['order']=qs[_0x8acb('0x3b')](_0x1b428a['query'][_0x8acb('0x3b')]);_0x77b4a0[_0x8acb('0x3c')]=qs['filters'](_[_0x8acb('0x3d')](_0x1b428a['query'],_0x3e9d0f[_0x8acb('0x33')]));if(_0x1b428a[_0x8acb('0x31')][_0x8acb('0x3e')]){_0x77b4a0[_0x8acb('0x3c')]=_[_0x8acb('0x3f')](_0x77b4a0['where'],{'$or':_['map'](_0x77b4a0[_0x8acb('0x36')],function(_0x3e115b){var _0x392cab={};_0x392cab[_0x3e115b]={'$like':'%'+_0x1b428a[_0x8acb('0x31')][_0x8acb('0x3e')]+'%'};return _0x392cab;})});}_0x77b4a0=_['merge']({},_0x77b4a0,_0x1b428a['options']);return _0x110e4b[_0x8acb('0x4c')](_0x77b4a0);}})[_0x8acb('0x25')](function(_0x42e478){if(_0x42e478){_0x5065a9=_0x42e478[_0x8acb('0x37')];if(!_0x1b428a[_0x8acb('0x31')][_0x8acb('0x38')](_0x8acb('0x39'))){_0x77b4a0[_0x8acb('0x1e')]=qs[_0x8acb('0x1e')](_0x1b428a[_0x8acb('0x31')]['limit']);_0x77b4a0[_0x8acb('0x1c')]=qs[_0x8acb('0x1c')](_0x1b428a['query'][_0x8acb('0x1c')]);}return _0x110e4b['getFields'](_0x77b4a0);}})[_0x8acb('0x25')](function(_0x399dc7){if(_0x399dc7){return _0x399dc7?{'count':_0x5065a9,'rows':_0x399dc7}:null;}})[_0x8acb('0x25')](respondWithResult(_0x2af055,null))['catch'](handleError(_0x2af055,null));};exports['getSubjects']=function(_0x1d1a81,_0x406cb9,_0x115baa){var _0x19067a={};var _0x3df955={};var _0x177c22;var _0x20f595;return db[_0x8acb('0x2c')][_0x8acb('0x4a')]({'where':{'id':_0x1d1a81[_0x8acb('0x45')]['id']}})['then'](handleEntityNotFound(_0x406cb9,null))[_0x8acb('0x25')](function(_0x467105){if(_0x467105){_0x177c22=_0x467105;_0x3df955[_0x8acb('0x30')]=_[_0x8acb('0x32')](db['VtigerField']['rawAttributes']);_0x3df955[_0x8acb('0x31')]=_['keys'](_0x1d1a81['query']);_0x3df955[_0x8acb('0x33')]=_[_0x8acb('0x34')](_0x3df955[_0x8acb('0x30')],_0x3df955['query']);_0x19067a[_0x8acb('0x36')]=_['intersection'](_0x3df955['model'],qs[_0x8acb('0x35')](_0x1d1a81['query'][_0x8acb('0x35')]));_0x19067a[_0x8acb('0x36')]=_0x19067a[_0x8acb('0x36')]['length']?_0x19067a[_0x8acb('0x36')]:_0x3df955['model'];_0x19067a[_0x8acb('0x3a')]=qs[_0x8acb('0x3b')](_0x1d1a81[_0x8acb('0x31')][_0x8acb('0x3b')]);_0x19067a[_0x8acb('0x3c')]=qs[_0x8acb('0x33')](_['pick'](_0x1d1a81['query'],_0x3df955[_0x8acb('0x33')]));if(_0x1d1a81[_0x8acb('0x31')][_0x8acb('0x3e')]){_0x19067a[_0x8acb('0x3c')]=_[_0x8acb('0x3f')](_0x19067a[_0x8acb('0x3c')],{'$or':_[_0x8acb('0x2b')](_0x19067a[_0x8acb('0x36')],function(_0x486c16){var _0x1fd9eb={};_0x1fd9eb[_0x486c16]={'$like':'%'+_0x1d1a81[_0x8acb('0x31')]['filter']+'%'};return _0x1fd9eb;})});}_0x19067a=_[_0x8acb('0x3f')]({},_0x19067a,_0x1d1a81[_0x8acb('0x40')]);return _0x177c22[_0x8acb('0x4d')](_0x19067a);}})[_0x8acb('0x25')](function(_0x4b5fec){if(_0x4b5fec){_0x20f595=_0x4b5fec[_0x8acb('0x37')];if(!_0x1d1a81['query']['hasOwnProperty'](_0x8acb('0x39'))){_0x19067a['limit']=qs['limit'](_0x1d1a81[_0x8acb('0x31')][_0x8acb('0x1e')]);_0x19067a[_0x8acb('0x1c')]=qs['offset'](_0x1d1a81[_0x8acb('0x31')][_0x8acb('0x1c')]);}return _0x177c22['getSubjects'](_0x19067a);}})[_0x8acb('0x25')](function(_0x1bf0a3){if(_0x1bf0a3){return _0x1bf0a3?{'count':_0x20f595,'rows':_0x1bf0a3}:null;}})[_0x8acb('0x25')](respondWithResult(_0x406cb9,null))[_0x8acb('0x49')](handleError(_0x406cb9,null));};exports[_0x8acb('0x4e')]=function(_0x313459,_0x14cde6,_0x425ce8){var _0x1aaab7={};var _0x3d5ea0={};var _0x3d2d45;var _0x547ea9;return db[_0x8acb('0x2c')][_0x8acb('0x4a')]({'where':{'id':_0x313459[_0x8acb('0x45')]['id']}})[_0x8acb('0x25')](handleEntityNotFound(_0x14cde6,null))[_0x8acb('0x25')](function(_0x497b61){if(_0x497b61){_0x3d2d45=_0x497b61;_0x3d5ea0[_0x8acb('0x30')]=_['keys'](db[_0x8acb('0x4f')][_0x8acb('0x4b')]);_0x3d5ea0[_0x8acb('0x31')]=_['keys'](_0x313459['query']);_0x3d5ea0[_0x8acb('0x33')]=_[_0x8acb('0x34')](_0x3d5ea0['model'],_0x3d5ea0[_0x8acb('0x31')]);_0x1aaab7[_0x8acb('0x36')]=_['intersection'](_0x3d5ea0['model'],qs[_0x8acb('0x35')](_0x313459[_0x8acb('0x31')][_0x8acb('0x35')]));_0x1aaab7[_0x8acb('0x36')]=_0x1aaab7[_0x8acb('0x36')][_0x8acb('0x37')]?_0x1aaab7[_0x8acb('0x36')]:_0x3d5ea0[_0x8acb('0x30')];_0x1aaab7[_0x8acb('0x3a')]=qs[_0x8acb('0x3b')](_0x313459['query']['sort']);_0x1aaab7[_0x8acb('0x3c')]=qs[_0x8acb('0x33')](_[_0x8acb('0x3d')](_0x313459[_0x8acb('0x31')],_0x3d5ea0[_0x8acb('0x33')]));if(_0x313459['query'][_0x8acb('0x3e')]){_0x1aaab7[_0x8acb('0x3c')]=_[_0x8acb('0x3f')](_0x1aaab7[_0x8acb('0x3c')],{'$or':_[_0x8acb('0x2b')](_0x1aaab7[_0x8acb('0x36')],function(_0x5cb6f3){var _0x549f1b={};_0x549f1b[_0x5cb6f3]={'$like':'%'+_0x313459[_0x8acb('0x31')][_0x8acb('0x3e')]+'%'};return _0x549f1b;})});}_0x1aaab7=_['merge']({},_0x1aaab7,_0x313459['options']);return _0x3d2d45[_0x8acb('0x4e')](_0x1aaab7);}})[_0x8acb('0x25')](function(_0x32b2f9){if(_0x32b2f9){_0x547ea9=_0x32b2f9[_0x8acb('0x37')];if(!_0x313459[_0x8acb('0x31')][_0x8acb('0x38')](_0x8acb('0x39'))){_0x1aaab7[_0x8acb('0x1e')]=qs[_0x8acb('0x1e')](_0x313459['query'][_0x8acb('0x1e')]);_0x1aaab7[_0x8acb('0x1c')]=qs[_0x8acb('0x1c')](_0x313459[_0x8acb('0x31')][_0x8acb('0x1c')]);}return _0x3d2d45[_0x8acb('0x4e')](_0x1aaab7);}})[_0x8acb('0x25')](function(_0x106c3a){if(_0x106c3a){return _0x106c3a?{'count':_0x547ea9,'rows':_0x106c3a}:null;}})[_0x8acb('0x25')](respondWithResult(_0x14cde6,null))[_0x8acb('0x49')](handleError(_0x14cde6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 99ff19b..8733ae6 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 _0xd9f1=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash','util'];(function(_0x22e8c7,_0x43d4b4){var _0x564c48=function(_0x30d516){while(--_0x30d516){_0x22e8c7['push'](_0x22e8c7['shift']());}};_0x564c48(++_0x43d4b4);}(_0xd9f1,0x169));var _0x1d9f=function(_0x3aff88,_0x14d02f){_0x3aff88=_0x3aff88-0x0;var _0x32eab8=_0xd9f1[_0x3aff88];return _0x32eab8;};'use strict';var _=require(_0x1d9f('0x0'));var util=require(_0x1d9f('0x1'));var logger=require(_0x1d9f('0x2'))(_0x1d9f('0x3'));var moment=require('moment');var BPromise=require(_0x1d9f('0x4'));var rp=require(_0x1d9f('0x5'));var fs=require('fs');var path=require(_0x1d9f('0x6'));var rimraf=require(_0x1d9f('0x7'));var config=require('../../config/environment');var attributes=require(_0x1d9f('0x8'));module['exports']=function(_0x39f0d1,_0x247b49){return _0x39f0d1[_0x1d9f('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x1d9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe62=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x16c824,_0x363c1d){var _0x267974=function(_0x58ab1f){while(--_0x58ab1f){_0x16c824['push'](_0x16c824['shift']());}};_0x267974(++_0x363c1d);}(_0xfe62,0x9c));var _0x2fe6=function(_0xa6a129,_0x4354fe){_0xa6a129=_0xa6a129-0x0;var _0xa8a6ad=_0xfe62[_0xa6a129];return _0xa8a6ad;};'use strict';var _=require(_0x2fe6('0x0'));var util=require(_0x2fe6('0x1'));var logger=require(_0x2fe6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2fe6('0x3'));var rp=require(_0x2fe6('0x4'));var fs=require('fs');var path=require(_0x2fe6('0x5'));var rimraf=require(_0x2fe6('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fe6('0x7'));module[_0x2fe6('0x8')]=function(_0x197db2,_0x5c5c5a){return _0x197db2[_0x2fe6('0x9')](_0x2fe6('0xa'),attributes,{'tableName':_0x2fe6('0xb'),'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 adac477..554ff35 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 _0x6ee0=['client','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5e9cbd,_0x2c7e22){var _0x10772a=function(_0x9feedf){while(--_0x9feedf){_0x5e9cbd['push'](_0x5e9cbd['shift']());}};_0x10772a(++_0x2c7e22);}(_0x6ee0,0x1c4));var _0x06ee=function(_0x5a896a,_0x1d7cbf){_0x5a896a=_0x5a896a-0x0;var _0x549cc7=_0x6ee0[_0x5a896a];return _0x549cc7;};'use strict';var _=require(_0x06ee('0x0'));var util=require(_0x06ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x06ee('0x2'));var fs=require('fs');var Redis=require(_0x06ee('0x3'));var db=require(_0x06ee('0x4'))['db'];var utils=require(_0x06ee('0x5'));var logger=require(_0x06ee('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x06ee('0x7'));var client=jayson[_0x06ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c781f,_0x5a5bfb,_0x37c01a){return new BPromise(function(_0x4f6b28,_0x15ce88){return client['request'](_0x4c781f,_0x37c01a)[_0x06ee('0x9')](function(_0x327052){logger[_0x06ee('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a5bfb,_0x06ee('0xb'));logger[_0x06ee('0xc')](_0x06ee('0xd'),_0x5a5bfb,_0x06ee('0xb'),JSON[_0x06ee('0xe')](_0x327052));if(_0x327052[_0x06ee('0xf')]){if(_0x327052['error']['code']===0x1f4){logger['error'](_0x06ee('0x10'),_0x5a5bfb,_0x327052[_0x06ee('0xf')][_0x06ee('0x11')]);return _0x15ce88(_0x327052[_0x06ee('0xf')][_0x06ee('0x11')]);}logger[_0x06ee('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a5bfb,_0x327052[_0x06ee('0xf')]['message']);return _0x4f6b28(_0x327052[_0x06ee('0xf')][_0x06ee('0x11')]);}else{logger[_0x06ee('0xa')](_0x06ee('0x10'),_0x5a5bfb,_0x06ee('0xb'));_0x4f6b28(_0x327052[_0x06ee('0x12')][_0x06ee('0x11')]);}})[_0x06ee('0x13')](function(_0x327fa7){logger[_0x06ee('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a5bfb,_0x327fa7);_0x15ce88(_0x327fa7);});});} \ No newline at end of file +var _0x2a4c=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x32156f,_0x230f05){var _0x1c1fa1=function(_0x4048d8){while(--_0x4048d8){_0x32156f['push'](_0x32156f['shift']());}};_0x1c1fa1(++_0x230f05);}(_0x2a4c,0xdd));var _0xc2a4=function(_0x54b978,_0x211f32){_0x54b978=_0x54b978-0x0;var _0x5531f0=_0x2a4c[_0x54b978];return _0x5531f0;};'use strict';var _=require('lodash');var util=require(_0xc2a4('0x0'));var moment=require(_0xc2a4('0x1'));var BPromise=require('bluebird');var rs=require(_0xc2a4('0x2'));var fs=require('fs');var Redis=require(_0xc2a4('0x3'));var db=require(_0xc2a4('0x4'))['db'];var utils=require(_0xc2a4('0x5'));var logger=require(_0xc2a4('0x6'))(_0xc2a4('0x7'));var config=require('../../config/environment');var jayson=require(_0xc2a4('0x8'));var client=jayson[_0xc2a4('0x9')][_0xc2a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ea108,_0x24f5c0,_0x3e8073){return new BPromise(function(_0x4fb324,_0x4a1dc4){return client[_0xc2a4('0xb')](_0x5ea108,_0x3e8073)[_0xc2a4('0xc')](function(_0x45142c){logger[_0xc2a4('0xd')](_0xc2a4('0xe'),_0x24f5c0,_0xc2a4('0xf'));logger[_0xc2a4('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x24f5c0,_0xc2a4('0xf'),JSON[_0xc2a4('0x11')](_0x45142c));if(_0x45142c[_0xc2a4('0x12')]){if(_0x45142c[_0xc2a4('0x12')][_0xc2a4('0x13')]===0x1f4){logger['error'](_0xc2a4('0xe'),_0x24f5c0,_0x45142c[_0xc2a4('0x12')][_0xc2a4('0x14')]);return _0x4a1dc4(_0x45142c[_0xc2a4('0x12')][_0xc2a4('0x14')]);}logger[_0xc2a4('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x24f5c0,_0x45142c[_0xc2a4('0x12')]['message']);return _0x4fb324(_0x45142c[_0xc2a4('0x12')][_0xc2a4('0x14')]);}else{logger[_0xc2a4('0xd')](_0xc2a4('0xe'),_0x24f5c0,_0xc2a4('0xf'));_0x4fb324(_0x45142c['result']['message']);}})[_0xc2a4('0x15')](function(_0x3130c6){logger[_0xc2a4('0x12')](_0xc2a4('0xe'),_0x24f5c0,_0x3130c6);_0x4a1dc4(_0x3130c6);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 01bb461..aa668d2 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 _0xf751=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x236029,_0x5d4c17){var _0x350df5=function(_0x551862){while(--_0x551862){_0x236029['push'](_0x236029['shift']());}};_0x350df5(++_0x5d4c17);}(_0xf751,0x1b4));var _0x1f75=function(_0x56c866,_0x1df004){_0x56c866=_0x56c866-0x0;var _0x325430=_0xf751[_0x56c866];return _0x325430;};'use strict';var multer=require(_0x1f75('0x0'));var util=require(_0x1f75('0x1'));var path=require(_0x1f75('0x2'));var timeout=require(_0x1f75('0x3'));var express=require(_0x1f75('0x4'));var router=express[_0x1f75('0x5')]();var fs_extra=require(_0x1f75('0x6'));var auth=require(_0x1f75('0x7'));var interaction=require(_0x1f75('0x8'));var config=require(_0x1f75('0x9'));var controller=require(_0x1f75('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x1f75('0xb')]);router[_0x1f75('0xc')](_0x1f75('0xd'),auth[_0x1f75('0xe')](),controller[_0x1f75('0xf')]);router[_0x1f75('0x10')]('/',auth[_0x1f75('0xe')](),controller[_0x1f75('0x11')]);router[_0x1f75('0x12')](_0x1f75('0xd'),auth[_0x1f75('0xe')](),controller['update']);router[_0x1f75('0x13')](_0x1f75('0xd'),auth['isAuthenticated'](),controller[_0x1f75('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4a26=['isAuthenticated','index','/:id','show','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x4d8fe1,_0x3ed474){var _0x46685e=function(_0x268c73){while(--_0x268c73){_0x4d8fe1['push'](_0x4d8fe1['shift']());}};_0x46685e(++_0x3ed474);}(_0x4a26,0x170));var _0x64a2=function(_0x4c7355,_0x599e8b){_0x4c7355=_0x4c7355-0x0;var _0x487e60=_0x4a26[_0x4c7355];return _0x487e60;};'use strict';var multer=require(_0x64a2('0x0'));var util=require('util');var path=require(_0x64a2('0x1'));var timeout=require(_0x64a2('0x2'));var express=require(_0x64a2('0x3'));var router=express[_0x64a2('0x4')]();var fs_extra=require(_0x64a2('0x5'));var auth=require(_0x64a2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64a2('0x7'));var controller=require(_0x64a2('0x8'));router[_0x64a2('0x9')]('/',auth[_0x64a2('0xa')](),controller[_0x64a2('0xb')]);router['get'](_0x64a2('0xc'),auth[_0x64a2('0xa')](),controller[_0x64a2('0xd')]);router['post']('/',auth[_0x64a2('0xa')](),controller[_0x64a2('0xe')]);router[_0x64a2('0xf')](_0x64a2('0xc'),auth[_0x64a2('0xa')](),controller['update']);router[_0x64a2('0x10')](_0x64a2('0xc'),auth[_0x64a2('0xa')](),controller['destroy']);module[_0x64a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 39e9053..6d36057 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 _0x66b4=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x195cc8,_0x12a738){var _0x13b76f=function(_0x5cb6af){while(--_0x5cb6af){_0x195cc8['push'](_0x195cc8['shift']());}};_0x13b76f(++_0x12a738);}(_0x66b4,0x152));var _0x466b=function(_0x12bacb,_0x3789f5){_0x12bacb=_0x12bacb-0x0;var _0x36c657=_0x66b4[_0x12bacb];return _0x36c657;};'use strict';var Sequelize=require(_0x466b('0x0'));module[_0x466b('0x1')]={'type':{'type':Sequelize[_0x466b('0x2')](_0x466b('0x3'),'variable',_0x466b('0x4'),_0x466b('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x466b('0x6')]},'key':{'type':Sequelize[_0x466b('0x6')]},'keyType':{'type':Sequelize[_0x466b('0x2')](_0x466b('0x3'),_0x466b('0x7'),_0x466b('0x4'))},'keyContent':{'type':Sequelize[_0x466b('0x6')]},'idField':{'type':Sequelize[_0x466b('0x6')]},'nameField':{'type':Sequelize[_0x466b('0x6')]},'customField':{'type':Sequelize[_0x466b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x466b('0x6')]}}; \ No newline at end of file +var _0x637f=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x637f,0x13f));var _0xf637=function(_0x532ac3,_0x55e608){_0x532ac3=_0x532ac3-0x0;var _0x37bd3e=_0x637f[_0x532ac3];return _0x37bd3e;};'use strict';var Sequelize=require('sequelize');module[_0xf637('0x0')]={'type':{'type':Sequelize[_0xf637('0x1')](_0xf637('0x2'),_0xf637('0x3'),_0xf637('0x4'),'keyValue',_0xf637('0x5')),'defaultValue':_0xf637('0x2')},'content':{'type':Sequelize[_0xf637('0x6')]},'key':{'type':Sequelize[_0xf637('0x6')]},'keyType':{'type':Sequelize[_0xf637('0x1')](_0xf637('0x2'),_0xf637('0x3'),_0xf637('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf637('0x6')]},'nameField':{'type':Sequelize[_0xf637('0x6')]},'customField':{'type':Sequelize[_0xf637('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf637('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6db9667..d978354 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 _0x1249=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index','VtigerField','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','create','body','find','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x1249,0xc9));var _0x9124=function(_0x2053fb,_0x268adb){_0x2053fb=_0x2053fb-0x0;var _0x333be0=_0x1249[_0x2053fb];return _0x333be0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9124('0x0'));var jsonpatch=require(_0x9124('0x1'));var rp=require('request-promise');var moment=require(_0x9124('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9124('0x3'));var path=require(_0x9124('0x4'));var sox=require(_0x9124('0x5'));var csv=require('to-csv');var ejs=require(_0x9124('0x6'));var fs=require('fs');var fs_extra=require(_0x9124('0x7'));var _=require(_0x9124('0x8'));var squel=require('squel');var crypto=require(_0x9124('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9124('0xa'));var toCsv=require(_0x9124('0xb'));var querystring=require(_0x9124('0xc'));var Papa=require('papaparse');var Redis=require(_0x9124('0xd'));var authService=require(_0x9124('0xe'));var qs=require(_0x9124('0xf'));var as=require(_0x9124('0x10'));var hardwareService=require(_0x9124('0x11'));var logger=require(_0x9124('0x12'))(_0x9124('0x13'));var utils=require(_0x9124('0x14'));var config=require(_0x9124('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9124('0x16'))['db'];function respondWithStatusCode(_0x365f61,_0x5e295a){_0x5e295a=_0x5e295a||0xcc;return function(_0x898f2){if(_0x898f2){return _0x365f61['sendStatus'](_0x5e295a);}return _0x365f61[_0x9124('0x17')](_0x5e295a)[_0x9124('0x18')]();};}function respondWithResult(_0x1254ef,_0x4314a8){_0x4314a8=_0x4314a8||0xc8;return function(_0x26073a){if(_0x26073a){return _0x1254ef[_0x9124('0x17')](_0x4314a8)[_0x9124('0x19')](_0x26073a);}};}function respondWithFilteredResult(_0x2a337b,_0x55f86d){return function(_0x5c50b8){if(_0x5c50b8){var _0x4f9e7e=typeof _0x55f86d[_0x9124('0x1a')]==='undefined'&&typeof _0x55f86d[_0x9124('0x1b')]===_0x9124('0x1c');var _0x3afa22=_0x5c50b8['count'];var _0x1ba06c=_0x4f9e7e?0x0:_0x55f86d['offset'];var _0x27992a=_0x4f9e7e?_0x5c50b8[_0x9124('0x1d')]:_0x55f86d[_0x9124('0x1a')]+_0x55f86d['limit'];var _0x4898d2;if(_0x27992a>=_0x3afa22){_0x27992a=_0x3afa22;_0x4898d2=0xc8;}else{_0x4898d2=0xce;}_0x2a337b[_0x9124('0x17')](_0x4898d2);return _0x2a337b[_0x9124('0x1e')](_0x9124('0x1f'),_0x1ba06c+'-'+_0x27992a+'/'+_0x3afa22)[_0x9124('0x19')](_0x5c50b8);}return null;};}function patchUpdates(_0x4838e2){return function(_0x55f961){try{jsonpatch['apply'](_0x55f961,_0x4838e2,!![]);}catch(_0x4c3f4){return BPromise[_0x9124('0x20')](_0x4c3f4);}return _0x55f961[_0x9124('0x21')]();};}function saveUpdates(_0x559506,_0x388806){return function(_0x55e13e){if(_0x55e13e){return _0x55e13e[_0x9124('0x22')](_0x559506)['then'](function(_0xfeef32){return _0xfeef32;});}return null;};}function removeEntity(_0x55828c,_0x13711d){return function(_0x5b8c65){if(_0x5b8c65){return _0x5b8c65[_0x9124('0x23')]()[_0x9124('0x24')](function(){_0x55828c['status'](0xcc)[_0x9124('0x18')]();});}};}function handleEntityNotFound(_0x44e4e2,_0x431814){return function(_0x51e704){if(!_0x51e704){_0x44e4e2[_0x9124('0x25')](0x194);}return _0x51e704;};}function handleError(_0x56f682,_0x5dfca9){_0x5dfca9=_0x5dfca9||0x1f4;return function(_0x478bf5){logger['error'](_0x478bf5[_0x9124('0x26')]);if(_0x478bf5[_0x9124('0x27')]){delete _0x478bf5[_0x9124('0x27')];}_0x56f682[_0x9124('0x17')](_0x5dfca9)[_0x9124('0x28')](_0x478bf5);};}exports[_0x9124('0x29')]=function(_0x2b6bb4,_0xdfcf1){var _0x28d6dd={},_0x475fef={},_0x1eb4b4={'count':0x0,'rows':[]};var _0x18b0c2=_['map'](db[_0x9124('0x2a')]['rawAttributes'],function(_0x27d59e){return{'name':_0x27d59e[_0x9124('0x2b')],'type':_0x27d59e[_0x9124('0x2c')]['key']};});_0x475fef[_0x9124('0x2d')]=_[_0x9124('0x2e')](_0x18b0c2,'name');_0x475fef[_0x9124('0x2f')]=_[_0x9124('0x30')](_0x2b6bb4[_0x9124('0x2f')]);_0x475fef['filters']=_[_0x9124('0x31')](_0x475fef[_0x9124('0x2d')],_0x475fef[_0x9124('0x2f')]);_0x28d6dd[_0x9124('0x32')]=_[_0x9124('0x31')](_0x475fef[_0x9124('0x2d')],qs[_0x9124('0x33')](_0x2b6bb4[_0x9124('0x2f')][_0x9124('0x33')]));_0x28d6dd[_0x9124('0x32')]=_0x28d6dd[_0x9124('0x32')]['length']?_0x28d6dd[_0x9124('0x32')]:_0x475fef[_0x9124('0x2d')];if(!_0x2b6bb4[_0x9124('0x2f')][_0x9124('0x34')](_0x9124('0x35'))){_0x28d6dd[_0x9124('0x1b')]=qs['limit'](_0x2b6bb4[_0x9124('0x2f')][_0x9124('0x1b')]);_0x28d6dd['offset']=qs['offset'](_0x2b6bb4[_0x9124('0x2f')]['offset']);}_0x28d6dd[_0x9124('0x36')]=qs['sort'](_0x2b6bb4[_0x9124('0x2f')][_0x9124('0x37')]);_0x28d6dd[_0x9124('0x38')]=qs['filters'](_[_0x9124('0x39')](_0x2b6bb4[_0x9124('0x2f')],_0x475fef[_0x9124('0x3a')]),_0x18b0c2);if(_0x2b6bb4[_0x9124('0x2f')][_0x9124('0x3b')]){_0x28d6dd[_0x9124('0x38')]=_[_0x9124('0x3c')](_0x28d6dd['where'],{'$or':_[_0x9124('0x2e')](_0x18b0c2,function(_0xecdfbf){if(_0xecdfbf[_0x9124('0x2c')]!==_0x9124('0x3d')){var _0x40ba53={};_0x40ba53[_0xecdfbf[_0x9124('0x27')]]={'$like':'%'+_0x2b6bb4[_0x9124('0x2f')]['filter']+'%'};return _0x40ba53;}})});}_0x28d6dd=_[_0x9124('0x3c')]({},_0x28d6dd,_0x2b6bb4[_0x9124('0x3e')]);var _0x1f4955={'where':_0x28d6dd[_0x9124('0x38')]};return db[_0x9124('0x2a')][_0x9124('0x1d')](_0x1f4955)['then'](function(_0x20917f){_0x1eb4b4[_0x9124('0x1d')]=_0x20917f;if(_0x2b6bb4[_0x9124('0x2f')]['includeAll']){_0x28d6dd[_0x9124('0x3f')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x28d6dd);})[_0x9124('0x24')](function(_0x8b10ad){_0x1eb4b4[_0x9124('0x40')]=_0x8b10ad;return _0x1eb4b4;})[_0x9124('0x24')](respondWithFilteredResult(_0xdfcf1,_0x28d6dd))[_0x9124('0x41')](handleError(_0xdfcf1,null));};exports['show']=function(_0x17e86f,_0x43ca4a){var _0x7784d4={'raw':!![],'where':{'id':_0x17e86f[_0x9124('0x42')]['id']}},_0xbdc37f={};_0xbdc37f['model']=_['keys'](db['VtigerField']['rawAttributes']);_0xbdc37f[_0x9124('0x2f')]=_[_0x9124('0x30')](_0x17e86f[_0x9124('0x2f')]);_0xbdc37f[_0x9124('0x3a')]=_[_0x9124('0x31')](_0xbdc37f[_0x9124('0x2d')],_0xbdc37f[_0x9124('0x2f')]);_0x7784d4[_0x9124('0x32')]=_[_0x9124('0x31')](_0xbdc37f[_0x9124('0x2d')],qs['fields'](_0x17e86f[_0x9124('0x2f')][_0x9124('0x33')]));_0x7784d4[_0x9124('0x32')]=_0x7784d4['attributes']['length']?_0x7784d4[_0x9124('0x32')]:_0xbdc37f[_0x9124('0x2d')];if(_0x17e86f[_0x9124('0x2f')][_0x9124('0x43')]){_0x7784d4['include']=[{'all':!![]}];}_0x7784d4=_['merge']({},_0x7784d4,_0x17e86f['options']);return db[_0x9124('0x2a')]['find'](_0x7784d4)[_0x9124('0x24')](handleEntityNotFound(_0x43ca4a,null))[_0x9124('0x24')](respondWithResult(_0x43ca4a,null))[_0x9124('0x41')](handleError(_0x43ca4a,null));};exports['create']=function(_0xc8b8cb,_0x3049da){return db[_0x9124('0x2a')][_0x9124('0x44')](_0xc8b8cb[_0x9124('0x45')],{})[_0x9124('0x24')](respondWithResult(_0x3049da,0xc9))['catch'](handleError(_0x3049da,null));};exports['update']=function(_0xc078bb,_0x4c2826){if(_0xc078bb['body']['id']){delete _0xc078bb[_0x9124('0x45')]['id'];}return db[_0x9124('0x2a')][_0x9124('0x46')]({'where':{'id':_0xc078bb[_0x9124('0x42')]['id']}})[_0x9124('0x24')](handleEntityNotFound(_0x4c2826,null))[_0x9124('0x24')](saveUpdates(_0xc078bb[_0x9124('0x45')],null))[_0x9124('0x24')](respondWithResult(_0x4c2826,null))[_0x9124('0x41')](handleError(_0x4c2826,null));};exports[_0x9124('0x23')]=function(_0x1574d2,_0xba7b){return db[_0x9124('0x2a')][_0x9124('0x46')]({'where':{'id':_0x1574d2[_0x9124('0x42')]['id']}})['then'](handleEntityNotFound(_0xba7b,null))[_0x9124('0x24')](removeEntity(_0xba7b,null))['catch'](handleError(_0xba7b,null));}; \ No newline at end of file +var _0x3c82=['body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','rows','show','intersection','catch','create'];(function(_0x32efb5,_0x1b6f42){var _0x5b644c=function(_0x44e59b){while(--_0x44e59b){_0x32efb5['push'](_0x32efb5['shift']());}};_0x5b644c(++_0x1b6f42);}(_0x3c82,0x1b9));var _0x23c8=function(_0x17db01,_0x4e3110){_0x17db01=_0x17db01-0x0;var _0x5b02aa=_0x3c82[_0x17db01];return _0x5b02aa;};'use strict';var emlformat=require(_0x23c8('0x0'));var rimraf=require(_0x23c8('0x1'));var zipdir=require(_0x23c8('0x2'));var jsonpatch=require(_0x23c8('0x3'));var rp=require(_0x23c8('0x4'));var moment=require(_0x23c8('0x5'));var BPromise=require(_0x23c8('0x6'));var Mustache=require(_0x23c8('0x7'));var util=require('util');var path=require(_0x23c8('0x8'));var sox=require(_0x23c8('0x9'));var csv=require(_0x23c8('0xa'));var ejs=require(_0x23c8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x23c8('0xc'));var crypto=require(_0x23c8('0xd'));var jsforce=require(_0x23c8('0xe'));var deskjs=require(_0x23c8('0xf'));var toCsv=require(_0x23c8('0xa'));var querystring=require(_0x23c8('0x10'));var Papa=require(_0x23c8('0x11'));var Redis=require('ioredis');var authService=require(_0x23c8('0x12'));var qs=require(_0x23c8('0x13'));var as=require(_0x23c8('0x14'));var hardwareService=require(_0x23c8('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x23c8('0x16'));var licenseUtil=require(_0x23c8('0x17'));var db=require(_0x23c8('0x18'))['db'];function respondWithStatusCode(_0x1d6d21,_0xf58a38){_0xf58a38=_0xf58a38||0xcc;return function(_0x38ce67){if(_0x38ce67){return _0x1d6d21[_0x23c8('0x19')](_0xf58a38);}return _0x1d6d21[_0x23c8('0x1a')](_0xf58a38)[_0x23c8('0x1b')]();};}function respondWithResult(_0x259d21,_0x33d451){_0x33d451=_0x33d451||0xc8;return function(_0x5c98d0){if(_0x5c98d0){return _0x259d21[_0x23c8('0x1a')](_0x33d451)[_0x23c8('0x1c')](_0x5c98d0);}};}function respondWithFilteredResult(_0x3560ff,_0x401a45){return function(_0x3d434c){if(_0x3d434c){var _0x3ad527=typeof _0x401a45[_0x23c8('0x1d')]===_0x23c8('0x1e')&&typeof _0x401a45['limit']===_0x23c8('0x1e');var _0x1ff49f=_0x3d434c[_0x23c8('0x1f')];var _0x44395b=_0x3ad527?0x0:_0x401a45[_0x23c8('0x1d')];var _0x313815=_0x3ad527?_0x3d434c[_0x23c8('0x1f')]:_0x401a45[_0x23c8('0x1d')]+_0x401a45[_0x23c8('0x20')];var _0x4541b1;if(_0x313815>=_0x1ff49f){_0x313815=_0x1ff49f;_0x4541b1=0xc8;}else{_0x4541b1=0xce;}_0x3560ff[_0x23c8('0x1a')](_0x4541b1);return _0x3560ff['set'](_0x23c8('0x21'),_0x44395b+'-'+_0x313815+'/'+_0x1ff49f)[_0x23c8('0x1c')](_0x3d434c);}return null;};}function patchUpdates(_0x3e897c){return function(_0x3c20ee){try{jsonpatch[_0x23c8('0x22')](_0x3c20ee,_0x3e897c,!![]);}catch(_0x5a7166){return BPromise['reject'](_0x5a7166);}return _0x3c20ee[_0x23c8('0x23')]();};}function saveUpdates(_0x2a05ce,_0x4f8a95){return function(_0x5b6b50){if(_0x5b6b50){return _0x5b6b50[_0x23c8('0x24')](_0x2a05ce)['then'](function(_0x58b59f){return _0x58b59f;});}return null;};}function removeEntity(_0x184b77,_0xc282d6){return function(_0x1a68b4){if(_0x1a68b4){return _0x1a68b4[_0x23c8('0x25')]()[_0x23c8('0x26')](function(){_0x184b77[_0x23c8('0x1a')](0xcc)[_0x23c8('0x1b')]();});}};}function handleEntityNotFound(_0x5b0221,_0x2c29ca){return function(_0x5303d1){if(!_0x5303d1){_0x5b0221[_0x23c8('0x19')](0x194);}return _0x5303d1;};}function handleError(_0xe20ade,_0x5825f9){_0x5825f9=_0x5825f9||0x1f4;return function(_0x5c3216){logger[_0x23c8('0x27')](_0x5c3216[_0x23c8('0x28')]);if(_0x5c3216[_0x23c8('0x29')]){delete _0x5c3216[_0x23c8('0x29')];}_0xe20ade[_0x23c8('0x1a')](_0x5825f9)[_0x23c8('0x2a')](_0x5c3216);};}exports[_0x23c8('0x2b')]=function(_0x20b335,_0x2c7978){var _0x313582={},_0x14cdf9={},_0x5e4883={'count':0x0,'rows':[]};var _0x16e7f4=_[_0x23c8('0x2c')](db[_0x23c8('0x2d')][_0x23c8('0x2e')],function(_0x819773){return{'name':_0x819773['fieldName'],'type':_0x819773[_0x23c8('0x2f')][_0x23c8('0x30')]};});_0x14cdf9[_0x23c8('0x31')]=_[_0x23c8('0x2c')](_0x16e7f4,_0x23c8('0x29'));_0x14cdf9['query']=_[_0x23c8('0x32')](_0x20b335[_0x23c8('0x33')]);_0x14cdf9[_0x23c8('0x34')]=_['intersection'](_0x14cdf9[_0x23c8('0x31')],_0x14cdf9['query']);_0x313582[_0x23c8('0x35')]=_['intersection'](_0x14cdf9[_0x23c8('0x31')],qs[_0x23c8('0x36')](_0x20b335[_0x23c8('0x33')]['fields']));_0x313582[_0x23c8('0x35')]=_0x313582[_0x23c8('0x35')][_0x23c8('0x37')]?_0x313582[_0x23c8('0x35')]:_0x14cdf9['model'];if(!_0x20b335['query'][_0x23c8('0x38')]('nolimit')){_0x313582[_0x23c8('0x20')]=qs[_0x23c8('0x20')](_0x20b335['query']['limit']);_0x313582['offset']=qs[_0x23c8('0x1d')](_0x20b335['query'][_0x23c8('0x1d')]);}_0x313582[_0x23c8('0x39')]=qs['sort'](_0x20b335[_0x23c8('0x33')][_0x23c8('0x3a')]);_0x313582[_0x23c8('0x3b')]=qs[_0x23c8('0x34')](_['pick'](_0x20b335['query'],_0x14cdf9['filters']),_0x16e7f4);if(_0x20b335['query']['filter']){_0x313582[_0x23c8('0x3b')]=_[_0x23c8('0x3c')](_0x313582['where'],{'$or':_[_0x23c8('0x2c')](_0x16e7f4,function(_0x3fbe3e){if(_0x3fbe3e[_0x23c8('0x2f')]!=='VIRTUAL'){var _0x4f4f9e={};_0x4f4f9e[_0x3fbe3e[_0x23c8('0x29')]]={'$like':'%'+_0x20b335['query'][_0x23c8('0x3d')]+'%'};return _0x4f4f9e;}})});}_0x313582=_[_0x23c8('0x3c')]({},_0x313582,_0x20b335[_0x23c8('0x3e')]);var _0x5b0816={'where':_0x313582[_0x23c8('0x3b')]};return db['VtigerField'][_0x23c8('0x1f')](_0x5b0816)['then'](function(_0x246e91){_0x5e4883[_0x23c8('0x1f')]=_0x246e91;if(_0x20b335[_0x23c8('0x33')][_0x23c8('0x3f')]){_0x313582[_0x23c8('0x40')]=[{'all':!![]}];}return db[_0x23c8('0x2d')]['findAll'](_0x313582);})[_0x23c8('0x26')](function(_0x10d9c8){_0x5e4883[_0x23c8('0x41')]=_0x10d9c8;return _0x5e4883;})[_0x23c8('0x26')](respondWithFilteredResult(_0x2c7978,_0x313582))['catch'](handleError(_0x2c7978,null));};exports[_0x23c8('0x42')]=function(_0x181931,_0x1bbaf1){var _0x1beca9={'raw':!![],'where':{'id':_0x181931['params']['id']}},_0x5c28dc={};_0x5c28dc[_0x23c8('0x31')]=_['keys'](db[_0x23c8('0x2d')]['rawAttributes']);_0x5c28dc[_0x23c8('0x33')]=_['keys'](_0x181931[_0x23c8('0x33')]);_0x5c28dc[_0x23c8('0x34')]=_['intersection'](_0x5c28dc[_0x23c8('0x31')],_0x5c28dc['query']);_0x1beca9['attributes']=_[_0x23c8('0x43')](_0x5c28dc['model'],qs[_0x23c8('0x36')](_0x181931[_0x23c8('0x33')][_0x23c8('0x36')]));_0x1beca9['attributes']=_0x1beca9[_0x23c8('0x35')]['length']?_0x1beca9['attributes']:_0x5c28dc[_0x23c8('0x31')];if(_0x181931['query']['includeAll']){_0x1beca9['include']=[{'all':!![]}];}_0x1beca9=_[_0x23c8('0x3c')]({},_0x1beca9,_0x181931[_0x23c8('0x3e')]);return db['VtigerField']['find'](_0x1beca9)[_0x23c8('0x26')](handleEntityNotFound(_0x1bbaf1,null))[_0x23c8('0x26')](respondWithResult(_0x1bbaf1,null))[_0x23c8('0x44')](handleError(_0x1bbaf1,null));};exports[_0x23c8('0x45')]=function(_0x315560,_0x4964ad){return db['VtigerField'][_0x23c8('0x45')](_0x315560[_0x23c8('0x46')],{})[_0x23c8('0x26')](respondWithResult(_0x4964ad,0xc9))[_0x23c8('0x44')](handleError(_0x4964ad,null));};exports[_0x23c8('0x24')]=function(_0x204cd0,_0x4483a2){if(_0x204cd0[_0x23c8('0x46')]['id']){delete _0x204cd0[_0x23c8('0x46')]['id'];}return db[_0x23c8('0x2d')]['find']({'where':{'id':_0x204cd0['params']['id']}})[_0x23c8('0x26')](handleEntityNotFound(_0x4483a2,null))['then'](saveUpdates(_0x204cd0['body'],null))['then'](respondWithResult(_0x4483a2,null))[_0x23c8('0x44')](handleError(_0x4483a2,null));};exports[_0x23c8('0x25')]=function(_0x9b69e1,_0x474c72){return db[_0x23c8('0x2d')][_0x23c8('0x47')]({'where':{'id':_0x9b69e1[_0x23c8('0x48')]['id']}})['then'](handleEntityNotFound(_0x474c72,null))['then'](removeEntity(_0x474c72,null))[_0x23c8('0x44')](handleError(_0x474c72,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4262599..eba09e9 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 _0x8f49=['define','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports'];(function(_0x394fdc,_0x115401){var _0x11f671=function(_0x2b628a){while(--_0x2b628a){_0x394fdc['push'](_0x394fdc['shift']());}};_0x11f671(++_0x115401);}(_0x8f49,0xba));var _0x98f4=function(_0x3709ca,_0x2a026b){_0x3709ca=_0x3709ca-0x0;var _0x44e1a8=_0x8f49[_0x3709ca];return _0x44e1a8;};'use strict';var _=require(_0x98f4('0x0'));var util=require(_0x98f4('0x1'));var logger=require(_0x98f4('0x2'))(_0x98f4('0x3'));var moment=require(_0x98f4('0x4'));var BPromise=require('bluebird');var rp=require(_0x98f4('0x5'));var fs=require('fs');var path=require(_0x98f4('0x6'));var rimraf=require(_0x98f4('0x7'));var config=require('../../config/environment');var attributes=require(_0x98f4('0x8'));module[_0x98f4('0x9')]=function(_0x203837,_0x6e198a){return _0x203837[_0x98f4('0xa')]('VtigerField',attributes,{'tableName':_0x98f4('0xb'),'paranoid':![],'indexes':[{'name':_0x98f4('0xc'),'fields':[_0x98f4('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9386=['request-promise','path','rimraf','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','api'];(function(_0x895fa7,_0x170542){var _0x22b85a=function(_0x270acb){while(--_0x270acb){_0x895fa7['push'](_0x895fa7['shift']());}};_0x22b85a(++_0x170542);}(_0x9386,0xce));var _0x6938=function(_0x52a43d,_0x56402a){_0x52a43d=_0x52a43d-0x0;var _0x43480d=_0x9386[_0x52a43d];return _0x43480d;};'use strict';var _=require(_0x6938('0x0'));var util=require(_0x6938('0x1'));var logger=require('../../config/logger')(_0x6938('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6938('0x3'));var fs=require('fs');var path=require(_0x6938('0x4'));var rimraf=require(_0x6938('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x48284b,_0x5a0fc5){return _0x48284b[_0x6938('0x6')](_0x6938('0x7'),attributes,{'tableName':_0x6938('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x6938('0x9'),_0x6938('0xa')],'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 890f814..5bec09b 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 _0x6d0c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x563152,_0x1f71cf){var _0xe7ffd3=function(_0x24d514){while(--_0x24d514){_0x563152['push'](_0x563152['shift']());}};_0xe7ffd3(++_0x1f71cf);}(_0x6d0c,0x8d));var _0xc6d0=function(_0x5c52ce,_0xa9d5b1){_0x5c52ce=_0x5c52ce-0x0;var _0x307409=_0x6d0c[_0x5c52ce];return _0x307409;};'use strict';var _=require(_0xc6d0('0x0'));var util=require(_0xc6d0('0x1'));var moment=require(_0xc6d0('0x2'));var BPromise=require(_0xc6d0('0x3'));var rs=require(_0xc6d0('0x4'));var fs=require('fs');var Redis=require(_0xc6d0('0x5'));var db=require(_0xc6d0('0x6'))['db'];var utils=require(_0xc6d0('0x7'));var logger=require(_0xc6d0('0x8'))(_0xc6d0('0x9'));var config=require(_0xc6d0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc6d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cc767,_0x39339e,_0x1aacab){return new BPromise(function(_0x566fb9,_0x52240e){return client[_0xc6d0('0xc')](_0x5cc767,_0x1aacab)['then'](function(_0x312539){logger[_0xc6d0('0xd')](_0xc6d0('0xe'),_0x39339e,_0xc6d0('0xf'));logger[_0xc6d0('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x39339e,'request\x20sent',JSON['stringify'](_0x312539));if(_0x312539[_0xc6d0('0x11')]){if(_0x312539[_0xc6d0('0x11')][_0xc6d0('0x12')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x39339e,_0x312539['error'][_0xc6d0('0x13')]);return _0x52240e(_0x312539[_0xc6d0('0x11')][_0xc6d0('0x13')]);}logger['error'](_0xc6d0('0xe'),_0x39339e,_0x312539[_0xc6d0('0x11')]['message']);return _0x566fb9(_0x312539[_0xc6d0('0x11')][_0xc6d0('0x13')]);}else{logger[_0xc6d0('0xd')](_0xc6d0('0xe'),_0x39339e,_0xc6d0('0xf'));_0x566fb9(_0x312539[_0xc6d0('0x14')]['message']);}})['catch'](function(_0x26d88c){logger[_0xc6d0('0x11')]('VtigerField,\x20%s,\x20%s',_0x39339e,_0x26d88c);_0x52240e(_0x26d88c);});});} \ No newline at end of file +var _0x5694=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0xa69733,_0x2aa122){var _0xca5645=function(_0x3a2729){while(--_0x3a2729){_0xa69733['push'](_0xa69733['shift']());}};_0xca5645(++_0x2aa122);}(_0x5694,0x1ca));var _0x4569=function(_0x155e2c,_0x2894f1){_0x155e2c=_0x155e2c-0x0;var _0x5a8aa6=_0x5694[_0x155e2c];return _0x5a8aa6;};'use strict';var _=require(_0x4569('0x0'));var util=require(_0x4569('0x1'));var moment=require(_0x4569('0x2'));var BPromise=require(_0x4569('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4569('0x4'));var db=require(_0x4569('0x5'))['db'];var utils=require(_0x4569('0x6'));var logger=require('../../config/logger')(_0x4569('0x7'));var config=require('../../config/environment');var jayson=require(_0x4569('0x8'));var client=jayson[_0x4569('0x9')][_0x4569('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x238f77,_0x3e31d0,_0x31199f){return new BPromise(function(_0x86dbc4,_0x2cbcfa){return client[_0x4569('0xb')](_0x238f77,_0x31199f)[_0x4569('0xc')](function(_0x5e4c6a){logger[_0x4569('0xd')](_0x4569('0xe'),_0x3e31d0,_0x4569('0xf'));logger[_0x4569('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3e31d0,'request\x20sent',JSON[_0x4569('0x11')](_0x5e4c6a));if(_0x5e4c6a[_0x4569('0x12')]){if(_0x5e4c6a[_0x4569('0x12')]['code']===0x1f4){logger[_0x4569('0x12')](_0x4569('0xe'),_0x3e31d0,_0x5e4c6a['error'][_0x4569('0x13')]);return _0x2cbcfa(_0x5e4c6a[_0x4569('0x12')][_0x4569('0x13')]);}logger[_0x4569('0x12')]('VtigerField,\x20%s,\x20%s',_0x3e31d0,_0x5e4c6a[_0x4569('0x12')][_0x4569('0x13')]);return _0x86dbc4(_0x5e4c6a[_0x4569('0x12')][_0x4569('0x13')]);}else{logger['info'](_0x4569('0xe'),_0x3e31d0,'request\x20sent');_0x86dbc4(_0x5e4c6a[_0x4569('0x14')][_0x4569('0x13')]);}})[_0x4569('0x15')](function(_0x4fc172){logger[_0x4569('0x12')](_0x4569('0xe'),_0x3e31d0,_0x4fc172);_0x2cbcfa(_0x4fc172);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5d6741b..7c31e4c 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 _0x981d=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','exports','path','fs-extra','../../components/auth/service'];(function(_0x244974,_0x2857df){var _0x5f28d6=function(_0x34a900){while(--_0x34a900){_0x244974['push'](_0x244974['shift']());}};_0x5f28d6(++_0x2857df);}(_0x981d,0x18c));var _0xd981=function(_0x6144c1,_0x5b4e17){_0x6144c1=_0x6144c1-0x0;var _0x22688d=_0x981d[_0x6144c1];return _0x22688d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd981('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd981('0x1'));var auth=require(_0xd981('0x2'));var interaction=require(_0xd981('0x3'));var config=require(_0xd981('0x4'));var controller=require(_0xd981('0x5'));router['get']('/',auth[_0xd981('0x6')](),controller[_0xd981('0x7')]);router[_0xd981('0x8')](_0xd981('0x9'),auth[_0xd981('0x6')](),controller[_0xd981('0xa')]);router[_0xd981('0x8')](_0xd981('0xb'),auth['isAuthenticated'](),controller[_0xd981('0xc')]);router[_0xd981('0x8')](_0xd981('0xd'),auth[_0xd981('0x6')](),controller[_0xd981('0xe')]);router['post']('/',auth[_0xd981('0x6')](),controller[_0xd981('0xf')]);router[_0xd981('0x10')](_0xd981('0xb'),auth['isAuthenticated'](),controller[_0xd981('0x11')]);router[_0xd981('0x12')](_0xd981('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xd981('0x13')](_0xd981('0x9'),auth[_0xd981('0x6')](),controller['destroy']);module[_0xd981('0x14')]=router; \ No newline at end of file +var _0xb75a=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','index','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb75a,0xb7));var _0xab75=function(_0x32e7d6,_0x682bc5){_0x32e7d6=_0x32e7d6-0x0;var _0x5427cf=_0xb75a[_0x32e7d6];return _0x5427cf;};'use strict';var multer=require(_0xab75('0x0'));var util=require(_0xab75('0x1'));var path=require('path');var timeout=require(_0xab75('0x2'));var express=require('express');var router=express[_0xab75('0x3')]();var fs_extra=require(_0xab75('0x4'));var auth=require(_0xab75('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xab75('0x6'));var controller=require(_0xab75('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xab75('0x8')]);router['get'](_0xab75('0x9'),auth[_0xab75('0xa')](),controller['show']);router[_0xab75('0xb')](_0xab75('0xc'),auth[_0xab75('0xa')](),controller[_0xab75('0xd')]);router[_0xab75('0xb')](_0xab75('0xe'),auth[_0xab75('0xa')](),controller[_0xab75('0xf')]);router[_0xab75('0x10')]('/',auth[_0xab75('0xa')](),controller[_0xab75('0x11')]);router[_0xab75('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xab75('0x12')]);router[_0xab75('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xab75('0x14')](_0xab75('0x9'),auth[_0xab75('0xa')](),controller[_0xab75('0x15')]);module[_0xab75('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 477a4a9..0a663dd 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 _0xa9fc=['exports','STRING','remoteUri','password','ENUM','integrationTab','newTab','sequelize'];(function(_0x199f08,_0x31b4f1){var _0xfff2d1=function(_0x11c6fb){while(--_0x11c6fb){_0x199f08['push'](_0x199f08['shift']());}};_0xfff2d1(++_0x31b4f1);}(_0xa9fc,0x19f));var _0xca9f=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0xa9fc[_0x5c14f6];return _0x4949b3;};'use strict';var Sequelize=require(_0xca9f('0x0'));module[_0xca9f('0x1')]={'name':{'type':Sequelize[_0xca9f('0x2')]},'description':{'type':Sequelize[_0xca9f('0x2')]},'username':{'type':Sequelize[_0xca9f('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xca9f('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xca9f('0x2')],'unique':_0xca9f('0x3')},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0xca9f('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xca9f('0x5')](_0xca9f('0x6'),_0xca9f('0x7')),'defaultValue':_0xca9f('0x6')}}; \ No newline at end of file +var _0xad5f=['password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x2c96c2,_0x4fe57d){var _0x1ff403=function(_0x1fd705){while(--_0x1fd705){_0x2c96c2['push'](_0x2c96c2['shift']());}};_0x1ff403(++_0x4fe57d);}(_0xad5f,0x1a8));var _0xfad5=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xad5f[_0xb68772];return _0x4189bb;};'use strict';var Sequelize=require(_0xfad5('0x0'));module[_0xfad5('0x1')]={'name':{'type':Sequelize[_0xfad5('0x2')]},'description':{'type':Sequelize[_0xfad5('0x2')]},'username':{'type':Sequelize[_0xfad5('0x2')],'unique':_0xfad5('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xfad5('0x2')]},'remoteUri':{'type':Sequelize[_0xfad5('0x2')],'unique':_0xfad5('0x4')},'authType':{'type':Sequelize[_0xfad5('0x5')](_0xfad5('0x6'),_0xfad5('0x7')),'defaultValue':_0xfad5('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfad5('0x5')](_0xfad5('0x8'),_0xfad5('0x9')),'defaultValue':_0xfad5('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 24f14d3..d886164 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 _0x5423=['Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','ZendeskConfiguration','nolimit','findOne','AccountId','getSubjects','channel','type','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x5423,0xe3));var _0x3542=function(_0x5b3770,_0x56633a){_0x5b3770=_0x5b3770-0x0;var _0x357726=_0x5423[_0x5b3770];return _0x357726;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];var integrations=require(_0x3542('0x18'));function respondWithStatusCode(_0x43e977,_0x4ee86){_0x4ee86=_0x4ee86||0xcc;return function(_0x1a9062){if(_0x1a9062){return _0x43e977[_0x3542('0x19')](_0x4ee86);}return _0x43e977[_0x3542('0x1a')](_0x4ee86)[_0x3542('0x1b')]();};}function respondWithResult(_0x4bac5b,_0x14fe57){_0x14fe57=_0x14fe57||0xc8;return function(_0x4fb366){if(_0x4fb366){return _0x4bac5b[_0x3542('0x1a')](_0x14fe57)[_0x3542('0x1c')](_0x4fb366);}};}function respondWithFilteredResult(_0xc33d42,_0x546fbd){return function(_0x270312){if(_0x270312){var _0x177fb9=typeof _0x546fbd[_0x3542('0x1d')]==='undefined'&&typeof _0x546fbd[_0x3542('0x1e')]===_0x3542('0x1f');var _0x116859=_0x270312[_0x3542('0x20')];var _0x493d95=_0x177fb9?0x0:_0x546fbd[_0x3542('0x1d')];var _0x53d4aa=_0x177fb9?_0x270312[_0x3542('0x20')]:_0x546fbd[_0x3542('0x1d')]+_0x546fbd['limit'];var _0x1c6403;if(_0x53d4aa>=_0x116859){_0x53d4aa=_0x116859;_0x1c6403=0xc8;}else{_0x1c6403=0xce;}_0xc33d42[_0x3542('0x1a')](_0x1c6403);return _0xc33d42[_0x3542('0x21')](_0x3542('0x22'),_0x493d95+'-'+_0x53d4aa+'/'+_0x116859)[_0x3542('0x1c')](_0x270312);}return null;};}function patchUpdates(_0x4a7695){return function(_0x4a74b0){try{jsonpatch['apply'](_0x4a74b0,_0x4a7695,!![]);}catch(_0x17e3cf){return BPromise['reject'](_0x17e3cf);}return _0x4a74b0[_0x3542('0x23')]();};}function saveUpdates(_0x551645,_0x1d5f1e){return function(_0x55774d){if(_0x55774d){return _0x55774d['update'](_0x551645)[_0x3542('0x24')](function(_0xe3f983){return _0xe3f983;});}return null;};}function removeEntity(_0x5ae097,_0x5d05b2){return function(_0x3fc964){if(_0x3fc964){return _0x3fc964['destroy']()[_0x3542('0x24')](function(){_0x5ae097[_0x3542('0x1a')](0xcc)[_0x3542('0x1b')]();});}};}function handleEntityNotFound(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(!_0xf1f7d0){_0x2f2e63[_0x3542('0x19')](0x194);}return _0xf1f7d0;};}function handleError(_0x1e156e,_0x18dc6c){_0x18dc6c=_0x18dc6c||0x1f4;return function(_0x2841a1){logger[_0x3542('0x25')](_0x2841a1[_0x3542('0x26')]);if(_0x2841a1[_0x3542('0x27')]){delete _0x2841a1[_0x3542('0x27')];}_0x1e156e[_0x3542('0x1a')](_0x18dc6c)[_0x3542('0x28')](_0x2841a1);};}exports[_0x3542('0x29')]=function(_0x20eda1,_0x3bd666){var _0x5590a2={},_0x31ad47={},_0x35bbc9={'count':0x0,'rows':[]};var _0x2aec76=_['map'](db[_0x3542('0x2a')][_0x3542('0x2b')],function(_0x2e883a){return{'name':_0x2e883a[_0x3542('0x2c')],'type':_0x2e883a['type']['key']};});_0x31ad47[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x2aec76,_0x3542('0x27'));_0x31ad47[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x20eda1[_0x3542('0x2f')]);_0x31ad47[_0x3542('0x31')]=_['intersection'](_0x31ad47['model'],_0x31ad47[_0x3542('0x2f')]);_0x5590a2['attributes']=_['intersection'](_0x31ad47[_0x3542('0x2d')],qs['fields'](_0x20eda1['query'][_0x3542('0x32')]));_0x5590a2[_0x3542('0x33')]=_0x5590a2[_0x3542('0x33')]['length']?_0x5590a2[_0x3542('0x33')]:_0x31ad47['model'];if(!_0x20eda1[_0x3542('0x2f')][_0x3542('0x34')]('nolimit')){_0x5590a2[_0x3542('0x1e')]=qs['limit'](_0x20eda1[_0x3542('0x2f')][_0x3542('0x1e')]);_0x5590a2[_0x3542('0x1d')]=qs['offset'](_0x20eda1[_0x3542('0x2f')]['offset']);}_0x5590a2[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x20eda1[_0x3542('0x2f')][_0x3542('0x36')]);_0x5590a2[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x20eda1[_0x3542('0x2f')],_0x31ad47[_0x3542('0x31')]),_0x2aec76);if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]){_0x5590a2[_0x3542('0x37')]=_[_0x3542('0x3a')](_0x5590a2['where'],{'$or':_[_0x3542('0x2e')](_0x2aec76,function(_0x4a80ea){if(_0x4a80ea['type']!==_0x3542('0x3b')){var _0x3ffccc={};_0x3ffccc[_0x4a80ea[_0x3542('0x27')]]={'$like':'%'+_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x3ffccc;}})});}_0x5590a2=_[_0x3542('0x3a')]({},_0x5590a2,_0x20eda1[_0x3542('0x3c')]);var _0x42e87a={'where':_0x5590a2['where']};return db[_0x3542('0x2a')]['count'](_0x42e87a)[_0x3542('0x24')](function(_0x2baa01){_0x35bbc9['count']=_0x2baa01;if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x3d')]){_0x5590a2['include']=[{'all':!![]}];}return db[_0x3542('0x2a')][_0x3542('0x3e')](_0x5590a2);})['then'](function(_0x2682d0){_0x35bbc9[_0x3542('0x3f')]=_0x2682d0;return _0x35bbc9;})[_0x3542('0x24')](respondWithFilteredResult(_0x3bd666,_0x5590a2))[_0x3542('0x40')](handleError(_0x3bd666,null));};exports[_0x3542('0x41')]=function(_0xb12441,_0x2b54b9){var _0x4bf45a={'raw':![],'where':{'id':_0xb12441[_0x3542('0x42')]['id']}},_0x542e0c={};_0x542e0c[_0x3542('0x2d')]=_[_0x3542('0x30')](db[_0x3542('0x2a')][_0x3542('0x2b')]);_0x542e0c['query']=_[_0x3542('0x30')](_0xb12441['query']);_0x542e0c[_0x3542('0x31')]=_[_0x3542('0x43')](_0x542e0c[_0x3542('0x2d')],_0x542e0c['query']);_0x4bf45a[_0x3542('0x33')]=_[_0x3542('0x43')](_0x542e0c['model'],qs[_0x3542('0x32')](_0xb12441[_0x3542('0x2f')][_0x3542('0x32')]));_0x4bf45a[_0x3542('0x33')]=_0x4bf45a[_0x3542('0x33')][_0x3542('0x44')]?_0x4bf45a[_0x3542('0x33')]:_0x542e0c[_0x3542('0x2d')];if(_0xb12441['query']['includeAll']){_0x4bf45a['include']=[{'all':!![]}];}_0x4bf45a=_[_0x3542('0x3a')]({},_0x4bf45a,_0xb12441[_0x3542('0x3c')]);return db[_0x3542('0x2a')][_0x3542('0x45')](_0x4bf45a)[_0x3542('0x24')](handleEntityNotFound(_0x2b54b9,null))[_0x3542('0x24')](respondWithResult(_0x2b54b9,null))[_0x3542('0x40')](handleError(_0x2b54b9,null));};exports['create']=function(_0x157683,_0x14b960){return db[_0x3542('0x2a')][_0x3542('0x46')](_0x157683['body'],{})[_0x3542('0x24')](respondWithResult(_0x14b960,0xc9))[_0x3542('0x40')](handleError(_0x14b960,null));};exports['update']=function(_0x528f8c,_0x1fb253){if(_0x528f8c[_0x3542('0x47')]['id']){delete _0x528f8c[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x528f8c[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x1fb253,null))['then'](saveUpdates(_0x528f8c[_0x3542('0x47')],null))[_0x3542('0x24')](respondWithResult(_0x1fb253,null))[_0x3542('0x40')](handleError(_0x1fb253,null));};exports[_0x3542('0x48')]=function(_0x1ebc82,_0x28be34){return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x1ebc82[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x28be34,null))['then'](removeEntity(_0x28be34,null))[_0x3542('0x40')](handleError(_0x28be34,null));};exports['getConfigurations']=function(_0x5a798a,_0x572e7a,_0x286222){var _0xd5c5c3={};var _0x381885={};var _0x48cfc4;var _0x2db495;return db[_0x3542('0x2a')]['findOne']({'where':{'id':_0x5a798a[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x572e7a,null))[_0x3542('0x24')](function(_0x196c59){if(_0x196c59){_0x48cfc4=_0x196c59;_0x381885[_0x3542('0x2d')]=_['keys'](db[_0x3542('0x49')][_0x3542('0x2b')]);_0x381885[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5a798a[_0x3542('0x2f')]);_0x381885['filters']=_['intersection'](_0x381885[_0x3542('0x2d')],_0x381885[_0x3542('0x2f')]);_0xd5c5c3[_0x3542('0x33')]=_['intersection'](_0x381885[_0x3542('0x2d')],qs[_0x3542('0x32')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x32')]));_0xd5c5c3[_0x3542('0x33')]=_0xd5c5c3['attributes']['length']?_0xd5c5c3[_0x3542('0x33')]:_0x381885['model'];_0xd5c5c3[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x5a798a['query'][_0x3542('0x36')]);_0xd5c5c3[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x5a798a[_0x3542('0x2f')],_0x381885['filters']));if(_0x5a798a['query'][_0x3542('0x39')]){_0xd5c5c3['where']=_[_0x3542('0x3a')](_0xd5c5c3[_0x3542('0x37')],{'$or':_[_0x3542('0x2e')](_0xd5c5c3['attributes'],function(_0xd9c90c){var _0x1f8ddb={};_0x1f8ddb[_0xd9c90c]={'$like':'%'+_0x5a798a[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x1f8ddb;})});}_0xd5c5c3=_[_0x3542('0x3a')]({},_0xd5c5c3,_0x5a798a[_0x3542('0x3c')]);return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})[_0x3542('0x24')](function(_0x3ee446){if(_0x3ee446){_0x2db495=_0x3ee446[_0x3542('0x44')];if(!_0x5a798a[_0x3542('0x2f')][_0x3542('0x34')](_0x3542('0x4a'))){_0xd5c5c3['limit']=qs[_0x3542('0x1e')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1e')]);_0xd5c5c3[_0x3542('0x1d')]=qs['offset'](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1d')]);}return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})['then'](function(_0x2908e5){if(_0x2908e5){return _0x2908e5?{'count':_0x2db495,'rows':_0x2908e5}:null;}})['then'](respondWithResult(_0x572e7a,null))[_0x3542('0x40')](handleError(_0x572e7a,null));};exports['addConfiguration']=function(_0x484204,_0x42a34a,_0x471408){if(_0x484204[_0x3542('0x47')]['id']){delete _0x484204[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x4b')]({'where':{'id':_0x484204[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a34a,null))[_0x3542('0x24')](function(_0xf1cf57){if(_0xf1cf57){_0x484204[_0x3542('0x47')][_0x3542('0x4c')]=_0xf1cf57['id'];_0x484204[_0x3542('0x47')]['Subjects']=integrations[_0x3542('0x4d')](_0x484204[_0x3542('0x47')][_0x3542('0x4e')],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);_0x484204[_0x3542('0x47')][_0x3542('0x50')]=integrations['getDescriptions'](_0x484204[_0x3542('0x47')]['channel'],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);return db[_0x3542('0x49')][_0x3542('0x46')](_0x484204['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x3542('0x51')],'as':_0x3542('0x50')}]});}return null;})[_0x3542('0x24')](respondWithResult(_0x42a34a,null))[_0x3542('0x40')](handleError(_0x42a34a,null));};exports[_0x3542('0x52')]=function(_0x2afc71,_0x3c84fa,_0x77f0af){var _0x2b0de0='';return db['ZendeskAccount'][_0x3542('0x4b')]({'where':{'id':_0x2afc71[_0x3542('0x42')]['id']},'attributes':['id',_0x3542('0x53'),_0x3542('0x54'),_0x3542('0x55'),'authType','remoteUri']})[_0x3542('0x24')](handleEntityNotFound(_0x3c84fa,null))[_0x3542('0x24')](function(_0x52c26d){if(_0x52c26d){_0x2b0de0=_0x52c26d[_0x3542('0x56')];var _0x4b5327=_0x2b0de0[_0x3542('0x57')](-0x1);if(_0x4b5327==='/'){_0x2b0de0=_0x2b0de0['substring'](0x0,_0x2b0de0[_0x3542('0x58')](_0x4b5327));}var _0x153e1b={'method':'GET','uri':util['format']('%s/%s',_0x2b0de0,_0x3542('0x59')),'json':!![]};switch(_0x52c26d['authType']){case _0x3542('0x54'):_0x153e1b[_0x3542('0x5a')]={'Authorization':util['format'](_0x3542('0x5b'),new Buffer(util[_0x3542('0x5c')](_0x3542('0x5d'),_0x52c26d['username'],_0x52c26d[_0x3542('0x54')]))['toString'](_0x3542('0x5e')))};break;case'token':_0x153e1b[_0x3542('0x5a')]={'Authorization':util[_0x3542('0x5c')](_0x3542('0x5b'),new Buffer(util['format'](_0x3542('0x5f'),_0x52c26d[_0x3542('0x53')],_0x52c26d[_0x3542('0x55')]))[_0x3542('0x60')]('base64'))};break;default:throw new db['Sequelize'][(_0x3542('0x61'))](_0x3542('0x62'));}return rp(_0x153e1b);}})[_0x3542('0x24')](function(_0xaa97d5){if(_0xaa97d5){var _0x191fdd=[_0x3542('0x63'),_0x3542('0x64'),_0x3542('0x65'),_0x3542('0x66')];_[_0x3542('0x67')](_0xaa97d5[_0x3542('0x59')],function(_0x1c318c){return _0x191fdd[_0x3542('0x68')](_0x1c318c[_0x3542('0x4f')]);});return{'count':_0xaa97d5[_0x3542('0x59')][_0x3542('0x44')],'rows':_[_0x3542('0x2e')](_0xaa97d5[_0x3542('0x59')],function(_0x4e04b6){return{'id':_0x4e04b6['id'],'name':_0x4e04b6[_0x3542('0x69')]>0x7?_0x4e04b6[_0x3542('0x6a')]:_0x4e04b6['type'],'custom':_0x4e04b6['position']>0x7?!![]:![],'options':_0x4e04b6[_0x3542('0x6b')]?_0x4e04b6[_0x3542('0x6b')]:_0x4e04b6[_0x3542('0x6c')]?_0x4e04b6[_0x3542('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3c84fa,null))[_0x3542('0x40')](function(_0x2d17ce){var _0x54e723=_0x2afc71[_0x3542('0x2f')]['test']?0x1f4:_0x2d17ce[_0x3542('0x6d')]||0x1f4;logger['error'](_0x3542('0x6e'),_0x3542('0x52'),_0x54e723,JSON[_0x3542('0x6f')](_0x2d17ce));delete _0x2d17ce[_0x3542('0x27')];if(_0x54e723===0x191){_0x54e723=0x190;}_0x3c84fa[_0x3542('0x1a')](_0x54e723)[_0x3542('0x28')](_0x2afc71[_0x3542('0x2f')]['test']?{'message':_0x3542('0x70'),'statusCode':_0x2d17ce['statusCode']}:_0x2d17ce);});}; \ No newline at end of file +var _0xf45e=['merge','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','GET','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','send','index','ZendeskAccount','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','fields','find','create','body','update','params','getConfigurations','findOne','ZendeskConfiguration','pick'];(function(_0x24531e,_0xcd2b3c){var _0x338fa=function(_0x44d59c){while(--_0x44d59c){_0x24531e['push'](_0x24531e['shift']());}};_0x338fa(++_0xcd2b3c);}(_0xf45e,0x115));var _0xef45=function(_0x4c152c,_0x23dfb5){_0x4c152c=_0x4c152c-0x0;var _0x8d9fa5=_0xf45e[_0x4c152c];return _0x8d9fa5;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];var integrations=require(_0xef45('0x1c'));function respondWithStatusCode(_0x433be9,_0x476739){_0x476739=_0x476739||0xcc;return function(_0x4a6e5c){if(_0x4a6e5c){return _0x433be9['sendStatus'](_0x476739);}return _0x433be9[_0xef45('0x1d')](_0x476739)['end']();};}function respondWithResult(_0x2ae89a,_0xb0fc43){_0xb0fc43=_0xb0fc43||0xc8;return function(_0x37c207){if(_0x37c207){return _0x2ae89a['status'](_0xb0fc43)['json'](_0x37c207);}};}function respondWithFilteredResult(_0x29c0c4,_0x5530e6){return function(_0x11cd3a){if(_0x11cd3a){var _0x2a342e=typeof _0x5530e6[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x5530e6['limit']==='undefined';var _0x45ee70=_0x11cd3a[_0xef45('0x20')];var _0x3ba1f4=_0x2a342e?0x0:_0x5530e6[_0xef45('0x1e')];var _0x4ca902=_0x2a342e?_0x11cd3a['count']:_0x5530e6[_0xef45('0x1e')]+_0x5530e6[_0xef45('0x21')];var _0xba941b;if(_0x4ca902>=_0x45ee70){_0x4ca902=_0x45ee70;_0xba941b=0xc8;}else{_0xba941b=0xce;}_0x29c0c4[_0xef45('0x1d')](_0xba941b);return _0x29c0c4[_0xef45('0x22')](_0xef45('0x23'),_0x3ba1f4+'-'+_0x4ca902+'/'+_0x45ee70)[_0xef45('0x24')](_0x11cd3a);}return null;};}function patchUpdates(_0x4a6217){return function(_0x11f1b0){try{jsonpatch[_0xef45('0x25')](_0x11f1b0,_0x4a6217,!![]);}catch(_0x449004){return BPromise[_0xef45('0x26')](_0x449004);}return _0x11f1b0[_0xef45('0x27')]();};}function saveUpdates(_0x5205bf,_0x40abc8){return function(_0x54a75d){if(_0x54a75d){return _0x54a75d['update'](_0x5205bf)[_0xef45('0x28')](function(_0x2b41d8){return _0x2b41d8;});}return null;};}function removeEntity(_0xbb859b,_0x7817d0){return function(_0x839eff){if(_0x839eff){return _0x839eff[_0xef45('0x29')]()[_0xef45('0x28')](function(){_0xbb859b['status'](0xcc)[_0xef45('0x2a')]();});}};}function handleEntityNotFound(_0x5f0593,_0x38b470){return function(_0xdbb42d){if(!_0xdbb42d){_0x5f0593['sendStatus'](0x194);}return _0xdbb42d;};}function handleError(_0x46e423,_0x2c356d){_0x2c356d=_0x2c356d||0x1f4;return function(_0x479e3c){logger[_0xef45('0x2b')](_0x479e3c['stack']);if(_0x479e3c['name']){delete _0x479e3c['name'];}_0x46e423['status'](_0x2c356d)[_0xef45('0x2c')](_0x479e3c);};}exports[_0xef45('0x2d')]=function(_0x217e8d,_0x15ad38){var _0x5782d0={},_0x18f304={},_0x4f028c={'count':0x0,'rows':[]};var _0x2525da=_['map'](db[_0xef45('0x2e')]['rawAttributes'],function(_0x575734){return{'name':_0x575734[_0xef45('0x2f')],'type':_0x575734[_0xef45('0x30')][_0xef45('0x31')]};});_0x18f304[_0xef45('0x32')]=_[_0xef45('0x33')](_0x2525da,'name');_0x18f304['query']=_['keys'](_0x217e8d[_0xef45('0x34')]);_0x18f304[_0xef45('0x35')]=_[_0xef45('0x36')](_0x18f304[_0xef45('0x32')],_0x18f304[_0xef45('0x34')]);_0x5782d0[_0xef45('0x37')]=_[_0xef45('0x36')](_0x18f304['model'],qs['fields'](_0x217e8d[_0xef45('0x34')]['fields']));_0x5782d0[_0xef45('0x37')]=_0x5782d0['attributes'][_0xef45('0x38')]?_0x5782d0[_0xef45('0x37')]:_0x18f304[_0xef45('0x32')];if(!_0x217e8d[_0xef45('0x34')][_0xef45('0x39')]('nolimit')){_0x5782d0[_0xef45('0x21')]=qs[_0xef45('0x21')](_0x217e8d[_0xef45('0x34')]['limit']);_0x5782d0['offset']=qs[_0xef45('0x1e')](_0x217e8d[_0xef45('0x34')]['offset']);}_0x5782d0[_0xef45('0x3a')]=qs['sort'](_0x217e8d['query'][_0xef45('0x3b')]);_0x5782d0[_0xef45('0x3c')]=qs[_0xef45('0x35')](_['pick'](_0x217e8d[_0xef45('0x34')],_0x18f304[_0xef45('0x35')]),_0x2525da);if(_0x217e8d[_0xef45('0x34')][_0xef45('0x3d')]){_0x5782d0['where']=_['merge'](_0x5782d0[_0xef45('0x3c')],{'$or':_[_0xef45('0x33')](_0x2525da,function(_0x11fd0b){if(_0x11fd0b[_0xef45('0x30')]!==_0xef45('0x3e')){var _0x309ba2={};_0x309ba2[_0x11fd0b[_0xef45('0x3f')]]={'$like':'%'+_0x217e8d[_0xef45('0x34')]['filter']+'%'};return _0x309ba2;}})});}_0x5782d0=_['merge']({},_0x5782d0,_0x217e8d[_0xef45('0x40')]);var _0x35d014={'where':_0x5782d0[_0xef45('0x3c')]};return db[_0xef45('0x2e')][_0xef45('0x20')](_0x35d014)[_0xef45('0x28')](function(_0x17c156){_0x4f028c[_0xef45('0x20')]=_0x17c156;if(_0x217e8d[_0xef45('0x34')][_0xef45('0x41')]){_0x5782d0[_0xef45('0x42')]=[{'all':!![]}];}return db[_0xef45('0x2e')][_0xef45('0x43')](_0x5782d0);})[_0xef45('0x28')](function(_0x311497){_0x4f028c[_0xef45('0x44')]=_0x311497;return _0x4f028c;})['then'](respondWithFilteredResult(_0x15ad38,_0x5782d0))[_0xef45('0x45')](handleError(_0x15ad38,null));};exports[_0xef45('0x46')]=function(_0x1b9d45,_0x82c123){var _0x54ccb8={'raw':![],'where':{'id':_0x1b9d45['params']['id']}},_0x4659c8={};_0x4659c8[_0xef45('0x32')]=_['keys'](db[_0xef45('0x2e')][_0xef45('0x47')]);_0x4659c8[_0xef45('0x34')]=_[_0xef45('0x48')](_0x1b9d45[_0xef45('0x34')]);_0x4659c8[_0xef45('0x35')]=_[_0xef45('0x36')](_0x4659c8['model'],_0x4659c8[_0xef45('0x34')]);_0x54ccb8[_0xef45('0x37')]=_[_0xef45('0x36')](_0x4659c8[_0xef45('0x32')],qs[_0xef45('0x49')](_0x1b9d45[_0xef45('0x34')][_0xef45('0x49')]));_0x54ccb8[_0xef45('0x37')]=_0x54ccb8[_0xef45('0x37')][_0xef45('0x38')]?_0x54ccb8[_0xef45('0x37')]:_0x4659c8[_0xef45('0x32')];if(_0x1b9d45[_0xef45('0x34')][_0xef45('0x41')]){_0x54ccb8[_0xef45('0x42')]=[{'all':!![]}];}_0x54ccb8=_['merge']({},_0x54ccb8,_0x1b9d45[_0xef45('0x40')]);return db[_0xef45('0x2e')][_0xef45('0x4a')](_0x54ccb8)['then'](handleEntityNotFound(_0x82c123,null))['then'](respondWithResult(_0x82c123,null))['catch'](handleError(_0x82c123,null));};exports[_0xef45('0x4b')]=function(_0x18143c,_0x12c74c){return db[_0xef45('0x2e')][_0xef45('0x4b')](_0x18143c[_0xef45('0x4c')],{})['then'](respondWithResult(_0x12c74c,0xc9))[_0xef45('0x45')](handleError(_0x12c74c,null));};exports[_0xef45('0x4d')]=function(_0x2b2419,_0x577d0c){if(_0x2b2419['body']['id']){delete _0x2b2419[_0xef45('0x4c')]['id'];}return db[_0xef45('0x2e')]['find']({'where':{'id':_0x2b2419[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x577d0c,null))[_0xef45('0x28')](saveUpdates(_0x2b2419[_0xef45('0x4c')],null))[_0xef45('0x28')](respondWithResult(_0x577d0c,null))[_0xef45('0x45')](handleError(_0x577d0c,null));};exports[_0xef45('0x29')]=function(_0xfa5fdd,_0x1961b4){return db[_0xef45('0x2e')][_0xef45('0x4a')]({'where':{'id':_0xfa5fdd[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x1961b4,null))[_0xef45('0x28')](removeEntity(_0x1961b4,null))['catch'](handleError(_0x1961b4,null));};exports[_0xef45('0x4f')]=function(_0x24aceb,_0x1910d3,_0x509626){var _0x416236={};var _0x3f9b9a={};var _0x464bda;var _0x1531ea;return db['ZendeskAccount'][_0xef45('0x50')]({'where':{'id':_0x24aceb[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x1910d3,null))[_0xef45('0x28')](function(_0x67d57b){if(_0x67d57b){_0x464bda=_0x67d57b;_0x3f9b9a[_0xef45('0x32')]=_[_0xef45('0x48')](db[_0xef45('0x51')][_0xef45('0x47')]);_0x3f9b9a[_0xef45('0x34')]=_[_0xef45('0x48')](_0x24aceb[_0xef45('0x34')]);_0x3f9b9a['filters']=_[_0xef45('0x36')](_0x3f9b9a[_0xef45('0x32')],_0x3f9b9a[_0xef45('0x34')]);_0x416236[_0xef45('0x37')]=_[_0xef45('0x36')](_0x3f9b9a[_0xef45('0x32')],qs['fields'](_0x24aceb['query'][_0xef45('0x49')]));_0x416236['attributes']=_0x416236[_0xef45('0x37')][_0xef45('0x38')]?_0x416236[_0xef45('0x37')]:_0x3f9b9a['model'];_0x416236[_0xef45('0x3a')]=qs[_0xef45('0x3b')](_0x24aceb['query'][_0xef45('0x3b')]);_0x416236['where']=qs['filters'](_[_0xef45('0x52')](_0x24aceb[_0xef45('0x34')],_0x3f9b9a[_0xef45('0x35')]));if(_0x24aceb[_0xef45('0x34')][_0xef45('0x3d')]){_0x416236['where']=_[_0xef45('0x53')](_0x416236[_0xef45('0x3c')],{'$or':_['map'](_0x416236[_0xef45('0x37')],function(_0x107cf3){var _0x3aa8ec={};_0x3aa8ec[_0x107cf3]={'$like':'%'+_0x24aceb[_0xef45('0x34')][_0xef45('0x3d')]+'%'};return _0x3aa8ec;})});}_0x416236=_[_0xef45('0x53')]({},_0x416236,_0x24aceb[_0xef45('0x40')]);return _0x464bda[_0xef45('0x4f')](_0x416236);}})['then'](function(_0x3be1b4){if(_0x3be1b4){_0x1531ea=_0x3be1b4['length'];if(!_0x24aceb['query'][_0xef45('0x39')]('nolimit')){_0x416236[_0xef45('0x21')]=qs[_0xef45('0x21')](_0x24aceb['query'][_0xef45('0x21')]);_0x416236[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x24aceb[_0xef45('0x34')][_0xef45('0x1e')]);}return _0x464bda[_0xef45('0x4f')](_0x416236);}})['then'](function(_0x3a7cf2){if(_0x3a7cf2){return _0x3a7cf2?{'count':_0x1531ea,'rows':_0x3a7cf2}:null;}})[_0xef45('0x28')](respondWithResult(_0x1910d3,null))[_0xef45('0x45')](handleError(_0x1910d3,null));};exports[_0xef45('0x54')]=function(_0x1d8c97,_0x51f841,_0x2a7857){if(_0x1d8c97['body']['id']){delete _0x1d8c97[_0xef45('0x4c')]['id'];}return db[_0xef45('0x2e')]['findOne']({'where':{'id':_0x1d8c97[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x51f841,null))[_0xef45('0x28')](function(_0x49a4ef){if(_0x49a4ef){_0x1d8c97['body'][_0xef45('0x55')]=_0x49a4ef['id'];_0x1d8c97[_0xef45('0x4c')][_0xef45('0x56')]=integrations['getSubjects'](_0x1d8c97[_0xef45('0x4c')][_0xef45('0x57')],_0x1d8c97['body'][_0xef45('0x30')]);_0x1d8c97['body'][_0xef45('0x58')]=integrations[_0xef45('0x59')](_0x1d8c97[_0xef45('0x4c')][_0xef45('0x57')],_0x1d8c97[_0xef45('0x4c')][_0xef45('0x30')]);return db[_0xef45('0x51')][_0xef45('0x4b')](_0x1d8c97['body'],{'include':[{'model':db[_0xef45('0x5a')],'as':_0xef45('0x56')},{'model':db[_0xef45('0x5a')],'as':_0xef45('0x58')}]});}return null;})[_0xef45('0x28')](respondWithResult(_0x51f841,null))[_0xef45('0x45')](handleError(_0x51f841,null));};exports[_0xef45('0x5b')]=function(_0x14ae27,_0x444d39,_0x41952f){var _0xbf9898='';return db['ZendeskAccount'][_0xef45('0x50')]({'where':{'id':_0x14ae27[_0xef45('0x4e')]['id']},'attributes':['id',_0xef45('0x5c'),_0xef45('0x5d'),_0xef45('0x5e'),'authType',_0xef45('0x5f')]})[_0xef45('0x28')](handleEntityNotFound(_0x444d39,null))['then'](function(_0x4ad1b8){if(_0x4ad1b8){_0xbf9898=_0x4ad1b8[_0xef45('0x5f')];var _0x37cd3f=_0xbf9898['slice'](-0x1);if(_0x37cd3f==='/'){_0xbf9898=_0xbf9898['substring'](0x0,_0xbf9898['lastIndexOf'](_0x37cd3f));}var _0x6b7e57={'method':_0xef45('0x60'),'uri':util['format']('%s/%s',_0xbf9898,_0xef45('0x61')),'json':!![]};switch(_0x4ad1b8['authType']){case _0xef45('0x5d'):_0x6b7e57[_0xef45('0x62')]={'Authorization':util[_0xef45('0x63')](_0xef45('0x64'),new Buffer(util[_0xef45('0x63')](_0xef45('0x65'),_0x4ad1b8[_0xef45('0x5c')],_0x4ad1b8['password']))[_0xef45('0x66')](_0xef45('0x67')))};break;case _0xef45('0x5e'):_0x6b7e57[_0xef45('0x62')]={'Authorization':util[_0xef45('0x63')](_0xef45('0x64'),new Buffer(util['format']('%s/token:%s',_0x4ad1b8[_0xef45('0x5c')],_0x4ad1b8[_0xef45('0x5e')]))[_0xef45('0x66')](_0xef45('0x67')))};break;default:throw new db[(_0xef45('0x68'))][(_0xef45('0x69'))](_0xef45('0x6a'));}return rp(_0x6b7e57);}})[_0xef45('0x28')](function(_0x53b36e){if(_0x53b36e){var _0x31b0a3=[_0xef45('0x6b'),_0xef45('0x6c'),_0xef45('0x6d'),_0xef45('0x6e')];_[_0xef45('0x6f')](_0x53b36e[_0xef45('0x61')],function(_0x5ece80){return _0x31b0a3[_0xef45('0x70')](_0x5ece80['type']);});return{'count':_0x53b36e[_0xef45('0x61')][_0xef45('0x38')],'rows':_['map'](_0x53b36e[_0xef45('0x61')],function(_0x1bc3c1){return{'id':_0x1bc3c1['id'],'name':_0x1bc3c1[_0xef45('0x71')]>0x7?_0x1bc3c1['title']:_0x1bc3c1[_0xef45('0x30')],'custom':_0x1bc3c1['position']>0x7?!![]:![],'options':_0x1bc3c1[_0xef45('0x72')]?_0x1bc3c1[_0xef45('0x72')]:_0x1bc3c1[_0xef45('0x73')]?_0x1bc3c1[_0xef45('0x73')]:[]};})};}})['then'](respondWithResult(_0x444d39,null))[_0xef45('0x45')](function(_0x32034a){var _0xcdcc33=_0x14ae27['query'][_0xef45('0x74')]?0x1f4:_0x32034a[_0xef45('0x75')]||0x1f4;logger[_0xef45('0x2b')](_0xef45('0x76'),_0xef45('0x5b'),_0xcdcc33,JSON['stringify'](_0x32034a));delete _0x32034a[_0xef45('0x3f')];if(_0xcdcc33===0x191){_0xcdcc33=0x190;}_0x444d39[_0xef45('0x1d')](_0xcdcc33)[_0xef45('0x2c')](_0x14ae27[_0xef45('0x34')][_0xef45('0x74')]?{'message':_0xef45('0x77'),'statusCode':_0x32034a[_0xef45('0x75')]}:_0x32034a);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 810e1d1..038b52e 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 _0xbaaf=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xbaaf,0x1d0));var _0xfbaa=function(_0x4341d5,_0x366480){_0x4341d5=_0x4341d5-0x0;var _0x47c448=_0xbaaf[_0x4341d5];return _0x47c448;};'use strict';var _=require(_0xfbaa('0x0'));var util=require(_0xfbaa('0x1'));var logger=require('../../config/logger')(_0xfbaa('0x2'));var moment=require(_0xfbaa('0x3'));var BPromise=require('bluebird');var rp=require(_0xfbaa('0x4'));var fs=require('fs');var path=require(_0xfbaa('0x5'));var rimraf=require(_0xfbaa('0x6'));var config=require(_0xfbaa('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xfbaa('0x8'));module[_0xfbaa('0x9')]=function(_0xfcb508,_0x3d1e22){return _0xfcb508[_0xfbaa('0xa')](_0xfbaa('0xb'),attributes,{'tableName':_0xfbaa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xced5=['define','ZendeskAccount','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x596e0b,_0xbc865c){var _0x1da6d5=function(_0x110b76){while(--_0x110b76){_0x596e0b['push'](_0x596e0b['shift']());}};_0x1da6d5(++_0xbc865c);}(_0xced5,0x152));var _0x5ced=function(_0x240d93,_0x349857){_0x240d93=_0x240d93-0x0;var _0x51e2f4=_0xced5[_0x240d93];return _0x51e2f4;};'use strict';var _=require(_0x5ced('0x0'));var util=require(_0x5ced('0x1'));var logger=require(_0x5ced('0x2'))(_0x5ced('0x3'));var moment=require(_0x5ced('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ced('0x5'));var config=require(_0x5ced('0x6'));var attributes=require(_0x5ced('0x7'));var integrations=require(_0x5ced('0x8'));module[_0x5ced('0x9')]=function(_0x3ec268,_0x4f850c){return _0x3ec268[_0x5ced('0xa')](_0x5ced('0xb'),attributes,{'tableName':'int_zendesk_accounts','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 74804ee..b59bbfd 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 _0x796d=['options','raw','where','limit','include','model','attributes','map','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','findAll'];(function(_0x43da0c,_0x519aeb){var _0x4037b5=function(_0x47e13c){while(--_0x47e13c){_0x43da0c['push'](_0x43da0c['shift']());}};_0x4037b5(++_0x519aeb);}(_0x796d,0xe4));var _0xd796=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x796d[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0xd796('0x0'));var util=require(_0xd796('0x1'));var moment=require(_0xd796('0x2'));var BPromise=require(_0xd796('0x3'));var rs=require(_0xd796('0x4'));var fs=require('fs');var Redis=require(_0xd796('0x5'));var db=require(_0xd796('0x6'))['db'];var utils=require(_0xd796('0x7'));var logger=require(_0xd796('0x8'))('rpc');var config=require(_0xd796('0x9'));var jayson=require(_0xd796('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x553ed8,_0x498e96,_0x4e4094){return new BPromise(function(_0x1e843d,_0xb2a2f){return client[_0xd796('0xb')](_0x553ed8,_0x4e4094)[_0xd796('0xc')](function(_0x421cf8){logger[_0xd796('0xd')](_0xd796('0xe'),_0x498e96,_0xd796('0xf'));logger['debug'](_0xd796('0x10'),_0x498e96,_0xd796('0xf'),JSON[_0xd796('0x11')](_0x421cf8));if(_0x421cf8[_0xd796('0x12')]){if(_0x421cf8[_0xd796('0x12')][_0xd796('0x13')]===0x1f4){logger[_0xd796('0x12')](_0xd796('0xe'),_0x498e96,_0x421cf8['error'][_0xd796('0x14')]);return _0xb2a2f(_0x421cf8[_0xd796('0x12')][_0xd796('0x14')]);}logger[_0xd796('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x498e96,_0x421cf8[_0xd796('0x12')]['message']);return _0x1e843d(_0x421cf8['error']['message']);}else{logger[_0xd796('0xd')](_0xd796('0xe'),_0x498e96,_0xd796('0xf'));_0x1e843d(_0x421cf8['result'][_0xd796('0x14')]);}})[_0xd796('0x15')](function(_0x1f931a){logger[_0xd796('0x12')](_0xd796('0xe'),_0x498e96,_0x1f931a);_0xb2a2f(_0x1f931a);});});}exports[_0xd796('0x16')]=function(_0x9e7270){var _0x3723f0=this;return new Promise(function(_0x58d77b,_0x613bf6){return db['ZendeskAccount'][_0xd796('0x17')]({'raw':_0x9e7270[_0xd796('0x18')]?_0x9e7270[_0xd796('0x18')][_0xd796('0x19')]===undefined?!![]:![]:!![],'where':_0x9e7270[_0xd796('0x18')]?_0x9e7270[_0xd796('0x18')][_0xd796('0x1a')]||null:null,'attributes':_0x9e7270[_0xd796('0x18')]?_0x9e7270['options']['attributes']||null:null,'limit':_0x9e7270['options']?_0x9e7270['options'][_0xd796('0x1b')]||null:null,'include':_0x9e7270['options']?_0x9e7270[_0xd796('0x18')][_0xd796('0x1c')]?_['map'](_0x9e7270['options'][_0xd796('0x1c')],function(_0x21f881){return{'model':db[_0x21f881[_0xd796('0x1d')]],'as':_0x21f881['as'],'attributes':_0x21f881[_0xd796('0x1e')],'include':_0x21f881[_0xd796('0x1c')]?_['map'](_0x21f881[_0xd796('0x1c')],function(_0x2a0517){return{'model':db[_0x2a0517['model']],'as':_0x2a0517['as'],'attributes':_0x2a0517[_0xd796('0x1e')],'include':_0x2a0517[_0xd796('0x1c')]?_[_0xd796('0x1f')](_0x2a0517['include'],function(_0x296e60){return{'model':db[_0x296e60[_0xd796('0x1d')]],'as':_0x296e60['as'],'attributes':_0x296e60[_0xd796('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x437afd){logger['info'](_0xd796('0x16'),_0x9e7270);logger[_0xd796('0x20')](_0xd796('0x16'),_0x9e7270,JSON['stringify'](_0x437afd));_0x58d77b(_0x437afd);})[_0xd796('0x15')](function(_0x273376){logger['error'](_0xd796('0x16'),_0x273376[_0xd796('0x14')],_0x9e7270);_0x613bf6(_0x3723f0[_0xd796('0x12')](0x1f4,_0x273376['message']));});});};exports[_0xd796('0x21')]=function(_0x1d46c0){var _0x315670=this;return new Promise(function(_0x317693,_0x339fbd){return db[_0xd796('0x22')][_0xd796('0x23')]({'raw':_0x1d46c0['options']?_0x1d46c0['options'][_0xd796('0x19')]===undefined?!![]:![]:!![],'where':_0x1d46c0[_0xd796('0x18')]?_0x1d46c0['options'][_0xd796('0x1a')]||null:null,'attributes':_0x1d46c0[_0xd796('0x18')]?_0x1d46c0[_0xd796('0x18')][_0xd796('0x1e')]||null:null,'include':_0x1d46c0[_0xd796('0x18')]?_0x1d46c0[_0xd796('0x18')][_0xd796('0x1c')]?_['map'](_0x1d46c0[_0xd796('0x18')]['include'],function(_0x3d1b04){return{'model':db[_0x3d1b04[_0xd796('0x1d')]],'as':_0x3d1b04['as'],'attributes':_0x3d1b04[_0xd796('0x1e')],'include':_0x3d1b04['include']?_[_0xd796('0x1f')](_0x3d1b04[_0xd796('0x1c')],function(_0x27523f){return{'model':db[_0x27523f['model']],'as':_0x27523f['as'],'attributes':_0x27523f['attributes'],'include':_0x27523f['include']?_['map'](_0x27523f[_0xd796('0x1c')],function(_0x1bab15){return{'model':db[_0x1bab15[_0xd796('0x1d')]],'as':_0x1bab15['as'],'attributes':_0x1bab15[_0xd796('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd796('0xc')](function(_0x364db9){logger[_0xd796('0xd')](_0xd796('0x21'),_0x1d46c0);logger[_0xd796('0x20')](_0xd796('0x21'),_0x1d46c0,JSON[_0xd796('0x11')](_0x364db9));_0x317693(_0x364db9);})[_0xd796('0x15')](function(_0x1a7a95){logger[_0xd796('0x12')]('ShowZendeskAccount',_0x1a7a95[_0xd796('0x14')],_0x1d46c0);_0x339fbd(_0x315670['error'](0x1f4,_0x1a7a95[_0xd796('0x14')]));});});}; \ No newline at end of file +var _0x6afc=['ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowZendeskAccount','find','where','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetZendeskAccount'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6afc,0x16b));var _0xc6af=function(_0x23d312,_0xd06cc8){_0x23d312=_0x23d312-0x0;var _0x3b08f5=_0x6afc[_0x23d312];return _0x3b08f5;};'use strict';var _=require(_0xc6af('0x0'));var util=require('util');var moment=require(_0xc6af('0x1'));var BPromise=require('bluebird');var rs=require(_0xc6af('0x2'));var fs=require('fs');var Redis=require(_0xc6af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6af('0x4'));var logger=require(_0xc6af('0x5'))(_0xc6af('0x6'));var config=require(_0xc6af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc6af('0x8')][_0xc6af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0485,_0x6d4994,_0x3bfb71){return new BPromise(function(_0x117df9,_0x57811b){return client[_0xc6af('0xa')](_0x3c0485,_0x3bfb71)[_0xc6af('0xb')](function(_0x5363c2){logger['info'](_0xc6af('0xc'),_0x6d4994,_0xc6af('0xd'));logger['debug'](_0xc6af('0xe'),_0x6d4994,_0xc6af('0xd'),JSON[_0xc6af('0xf')](_0x5363c2));if(_0x5363c2['error']){if(_0x5363c2[_0xc6af('0x10')]['code']===0x1f4){logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);return _0x57811b(_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);}logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x5363c2['error'][_0xc6af('0x11')]);return _0x117df9(_0x5363c2[_0xc6af('0x10')][_0xc6af('0x11')]);}else{logger[_0xc6af('0x12')](_0xc6af('0xc'),_0x6d4994,_0xc6af('0xd'));_0x117df9(_0x5363c2[_0xc6af('0x13')][_0xc6af('0x11')]);}})[_0xc6af('0x14')](function(_0x125e3f){logger[_0xc6af('0x10')](_0xc6af('0xc'),_0x6d4994,_0x125e3f);_0x57811b(_0x125e3f);});});}exports[_0xc6af('0x15')]=function(_0x5dde9d){var _0x46a5a5=this;return new Promise(function(_0x3d75b8,_0x4fb7f2){return db[_0xc6af('0x16')][_0xc6af('0x17')]({'raw':_0x5dde9d[_0xc6af('0x18')]?_0x5dde9d['options'][_0xc6af('0x19')]===undefined?!![]:![]:!![],'where':_0x5dde9d['options']?_0x5dde9d[_0xc6af('0x18')]['where']||null:null,'attributes':_0x5dde9d[_0xc6af('0x18')]?_0x5dde9d[_0xc6af('0x18')][_0xc6af('0x1a')]||null:null,'limit':_0x5dde9d[_0xc6af('0x18')]?_0x5dde9d[_0xc6af('0x18')][_0xc6af('0x1b')]||null:null,'include':_0x5dde9d[_0xc6af('0x18')]?_0x5dde9d[_0xc6af('0x18')][_0xc6af('0x1c')]?_[_0xc6af('0x1d')](_0x5dde9d[_0xc6af('0x18')]['include'],function(_0x128933){return{'model':db[_0x128933['model']],'as':_0x128933['as'],'attributes':_0x128933[_0xc6af('0x1a')],'include':_0x128933[_0xc6af('0x1c')]?_[_0xc6af('0x1d')](_0x128933[_0xc6af('0x1c')],function(_0x2f24c0){return{'model':db[_0x2f24c0['model']],'as':_0x2f24c0['as'],'attributes':_0x2f24c0[_0xc6af('0x1a')],'include':_0x2f24c0[_0xc6af('0x1c')]?_[_0xc6af('0x1d')](_0x2f24c0[_0xc6af('0x1c')],function(_0x4f931c){return{'model':db[_0x4f931c[_0xc6af('0x1e')]],'as':_0x4f931c['as'],'attributes':_0x4f931c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6af('0xb')](function(_0x36ba5a){logger[_0xc6af('0x12')](_0xc6af('0x15'),_0x5dde9d);logger[_0xc6af('0x1f')](_0xc6af('0x15'),_0x5dde9d,JSON['stringify'](_0x36ba5a));_0x3d75b8(_0x36ba5a);})[_0xc6af('0x14')](function(_0xf09541){logger[_0xc6af('0x10')](_0xc6af('0x15'),_0xf09541[_0xc6af('0x11')],_0x5dde9d);_0x4fb7f2(_0x46a5a5[_0xc6af('0x10')](0x1f4,_0xf09541['message']));});});};exports[_0xc6af('0x20')]=function(_0x52a012){var _0x14a0a2=this;return new Promise(function(_0x2354f7,_0x541a6c){return db[_0xc6af('0x16')][_0xc6af('0x21')]({'raw':_0x52a012[_0xc6af('0x18')]?_0x52a012['options'][_0xc6af('0x19')]===undefined?!![]:![]:!![],'where':_0x52a012['options']?_0x52a012[_0xc6af('0x18')][_0xc6af('0x22')]||null:null,'attributes':_0x52a012['options']?_0x52a012[_0xc6af('0x18')][_0xc6af('0x1a')]||null:null,'include':_0x52a012[_0xc6af('0x18')]?_0x52a012['options'][_0xc6af('0x1c')]?_[_0xc6af('0x1d')](_0x52a012['options'][_0xc6af('0x1c')],function(_0x2ff038){return{'model':db[_0x2ff038[_0xc6af('0x1e')]],'as':_0x2ff038['as'],'attributes':_0x2ff038[_0xc6af('0x1a')],'include':_0x2ff038[_0xc6af('0x1c')]?_['map'](_0x2ff038[_0xc6af('0x1c')],function(_0x47da2e){return{'model':db[_0x47da2e[_0xc6af('0x1e')]],'as':_0x47da2e['as'],'attributes':_0x47da2e[_0xc6af('0x1a')],'include':_0x47da2e[_0xc6af('0x1c')]?_[_0xc6af('0x1d')](_0x47da2e[_0xc6af('0x1c')],function(_0x528c8e){return{'model':db[_0x528c8e[_0xc6af('0x1e')]],'as':_0x528c8e['as'],'attributes':_0x528c8e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6af('0xb')](function(_0x45c307){logger[_0xc6af('0x12')]('ShowZendeskAccount',_0x52a012);logger[_0xc6af('0x1f')]('ShowZendeskAccount',_0x52a012,JSON[_0xc6af('0xf')](_0x45c307));_0x2354f7(_0x45c307);})['catch'](function(_0x7a0951){logger[_0xc6af('0x10')](_0xc6af('0x20'),_0x7a0951['message'],_0x52a012);_0x541a6c(_0x14a0a2[_0xc6af('0x10')](0x1f4,_0x7a0951[_0xc6af('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1353950..cdbfd24 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0xf4734a,_0x6fb33d){var _0x3be82a=function(_0x1166de){while(--_0x1166de){_0xf4734a['push'](_0xf4734a['shift']());}};_0x3be82a(++_0x6fb33d);}(_0xe706,0xa3));var _0x6e70=function(_0x368cd6,_0x275b63){_0x368cd6=_0x368cd6-0x0;var _0x16161d=_0xe706[_0x368cd6];return _0x16161d;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x51e30d,_0x2635b1){var _0x5b3c13=function(_0x11974d){while(--_0x11974d){_0x51e30d['push'](_0x51e30d['shift']());}};_0x5b3c13(++_0x2635b1);}(_0x0bb5,0x148));var _0x50bb=function(_0x68997b,_0x20770c){_0x68997b=_0x68997b-0x0;var _0x466671=_0x0bb5[_0x68997b];return _0x466671;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index bd5f752..ee8f55d 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 _0xf789=['STRING','sequelize'];(function(_0x28b049,_0x17b547){var _0x5f4172=function(_0x344491){while(--_0x344491){_0x28b049['push'](_0x28b049['shift']());}};_0x5f4172(++_0x17b547);}(_0xf789,0x149));var _0x9f78=function(_0x370b09,_0x5ba77b){_0x370b09=_0x370b09-0x0;var _0x35e61c=_0xf789[_0x370b09];return _0x35e61c;};'use strict';var Sequelize=require(_0x9f78('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f78('0x1')]}}; \ No newline at end of file +var _0xcf9a=['STRING','exports'];(function(_0x2851df,_0xc8e22b){var _0x4bac8c=function(_0x5144aa){while(--_0x5144aa){_0x2851df['push'](_0x2851df['shift']());}};_0x4bac8c(++_0xc8e22b);}(_0xcf9a,0x10f));var _0xacf9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcf9a[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0xacf9('0x0')]={'name':{'type':Sequelize[_0xacf9('0x1')]},'description':{'type':Sequelize[_0xacf9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5def93d..f708449 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 _0x0b19=['ZendeskConfiguration','then','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','hasOwnProperty','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x2bed57,_0x3d992a){var _0x240c1d=function(_0x1308a7){while(--_0x1308a7){_0x2bed57['push'](_0x2bed57['shift']());}};_0x240c1d(++_0x3d992a);}(_0x0b19,0x11f));var _0x90b1=function(_0x4b2dde,_0x16ab26){_0x4b2dde=_0x4b2dde-0x0;var _0x18080a=_0x0b19[_0x4b2dde];return _0x18080a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90b1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90b1('0x1'));var rp=require(_0x90b1('0x2'));var moment=require(_0x90b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x90b1('0x4'));var util=require(_0x90b1('0x5'));var path=require(_0x90b1('0x6'));var sox=require(_0x90b1('0x7'));var csv=require(_0x90b1('0x8'));var ejs=require(_0x90b1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90b1('0xa'));var squel=require(_0x90b1('0xb'));var crypto=require(_0x90b1('0xc'));var jsforce=require(_0x90b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x90b1('0x8'));var querystring=require(_0x90b1('0xe'));var Papa=require(_0x90b1('0xf'));var Redis=require(_0x90b1('0x10'));var authService=require(_0x90b1('0x11'));var qs=require(_0x90b1('0x12'));var as=require(_0x90b1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90b1('0x14'))(_0x90b1('0x15'));var utils=require(_0x90b1('0x16'));var config=require(_0x90b1('0x17'));var licenseUtil=require(_0x90b1('0x18'));var db=require(_0x90b1('0x19'))['db'];function respondWithStatusCode(_0x1d494f,_0x3bdb89){_0x3bdb89=_0x3bdb89||0xcc;return function(_0x5ef1f3){if(_0x5ef1f3){return _0x1d494f[_0x90b1('0x1a')](_0x3bdb89);}return _0x1d494f[_0x90b1('0x1b')](_0x3bdb89)[_0x90b1('0x1c')]();};}function respondWithResult(_0x56e933,_0x4a61c1){_0x4a61c1=_0x4a61c1||0xc8;return function(_0x4e0d9a){if(_0x4e0d9a){return _0x56e933['status'](_0x4a61c1)[_0x90b1('0x1d')](_0x4e0d9a);}};}function respondWithFilteredResult(_0x57876f,_0x3ba8a8){return function(_0x9f4152){if(_0x9f4152){var _0x5df465=typeof _0x3ba8a8['offset']===_0x90b1('0x1e')&&typeof _0x3ba8a8[_0x90b1('0x1f')]==='undefined';var _0x74d2ff=_0x9f4152[_0x90b1('0x20')];var _0x310786=_0x5df465?0x0:_0x3ba8a8['offset'];var _0x50aef9=_0x5df465?_0x9f4152['count']:_0x3ba8a8[_0x90b1('0x21')]+_0x3ba8a8['limit'];var _0x476413;if(_0x50aef9>=_0x74d2ff){_0x50aef9=_0x74d2ff;_0x476413=0xc8;}else{_0x476413=0xce;}_0x57876f[_0x90b1('0x1b')](_0x476413);return _0x57876f['set'](_0x90b1('0x22'),_0x310786+'-'+_0x50aef9+'/'+_0x74d2ff)['json'](_0x9f4152);}return null;};}function patchUpdates(_0x3fc2d4){return function(_0x12978f){try{jsonpatch[_0x90b1('0x23')](_0x12978f,_0x3fc2d4,!![]);}catch(_0x1d8927){return BPromise[_0x90b1('0x24')](_0x1d8927);}return _0x12978f[_0x90b1('0x25')]();};}function saveUpdates(_0x34349a,_0x5841ca){return function(_0x405929){if(_0x405929){return _0x405929[_0x90b1('0x26')](_0x34349a)['then'](function(_0x545a8d){return _0x545a8d;});}return null;};}function removeEntity(_0x3a2cdc,_0x11efc1){return function(_0x21d140){if(_0x21d140){return _0x21d140[_0x90b1('0x27')]()['then'](function(){_0x3a2cdc[_0x90b1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8ee0,_0x36fc79){return function(_0x209684){if(!_0x209684){_0x3d8ee0[_0x90b1('0x1a')](0x194);}return _0x209684;};}function handleError(_0x232638,_0x5c652d){_0x5c652d=_0x5c652d||0x1f4;return function(_0x3540f5){logger[_0x90b1('0x28')](_0x3540f5[_0x90b1('0x29')]);if(_0x3540f5['name']){delete _0x3540f5[_0x90b1('0x2a')];}_0x232638['status'](_0x5c652d)[_0x90b1('0x2b')](_0x3540f5);};}exports[_0x90b1('0x2c')]=function(_0x17be1,_0x39fc6f){var _0x4474ca={},_0x4ccadf={},_0x4d729a={'count':0x0,'rows':[]};var _0x276a7d=_[_0x90b1('0x2d')](db['ZendeskConfiguration'][_0x90b1('0x2e')],function(_0x58bb27){return{'name':_0x58bb27[_0x90b1('0x2f')],'type':_0x58bb27[_0x90b1('0x30')][_0x90b1('0x31')]};});_0x4ccadf[_0x90b1('0x32')]=_[_0x90b1('0x2d')](_0x276a7d,_0x90b1('0x2a'));_0x4ccadf[_0x90b1('0x33')]=_['keys'](_0x17be1[_0x90b1('0x33')]);_0x4ccadf[_0x90b1('0x34')]=_['intersection'](_0x4ccadf[_0x90b1('0x32')],_0x4ccadf[_0x90b1('0x33')]);_0x4474ca['attributes']=_[_0x90b1('0x35')](_0x4ccadf['model'],qs[_0x90b1('0x36')](_0x17be1[_0x90b1('0x33')][_0x90b1('0x36')]));_0x4474ca[_0x90b1('0x37')]=_0x4474ca[_0x90b1('0x37')][_0x90b1('0x38')]?_0x4474ca[_0x90b1('0x37')]:_0x4ccadf[_0x90b1('0x32')];if(!_0x17be1[_0x90b1('0x33')]['hasOwnProperty']('nolimit')){_0x4474ca[_0x90b1('0x1f')]=qs[_0x90b1('0x1f')](_0x17be1['query']['limit']);_0x4474ca[_0x90b1('0x21')]=qs[_0x90b1('0x21')](_0x17be1[_0x90b1('0x33')][_0x90b1('0x21')]);}_0x4474ca[_0x90b1('0x39')]=qs[_0x90b1('0x3a')](_0x17be1[_0x90b1('0x33')]['sort']);_0x4474ca[_0x90b1('0x3b')]=qs[_0x90b1('0x34')](_[_0x90b1('0x3c')](_0x17be1[_0x90b1('0x33')],_0x4ccadf[_0x90b1('0x34')]),_0x276a7d);if(_0x17be1[_0x90b1('0x33')][_0x90b1('0x3d')]){_0x4474ca[_0x90b1('0x3b')]=_[_0x90b1('0x3e')](_0x4474ca['where'],{'$or':_['map'](_0x276a7d,function(_0x3fb64a){if(_0x3fb64a[_0x90b1('0x30')]!==_0x90b1('0x3f')){var _0x27b02a={};_0x27b02a[_0x3fb64a[_0x90b1('0x2a')]]={'$like':'%'+_0x17be1[_0x90b1('0x33')][_0x90b1('0x3d')]+'%'};return _0x27b02a;}})});}_0x4474ca=_[_0x90b1('0x3e')]({},_0x4474ca,_0x17be1[_0x90b1('0x40')]);var _0x328e2e={'where':_0x4474ca[_0x90b1('0x3b')]};return db[_0x90b1('0x41')]['count'](_0x328e2e)[_0x90b1('0x42')](function(_0xd8daf8){_0x4d729a[_0x90b1('0x20')]=_0xd8daf8;if(_0x17be1[_0x90b1('0x33')][_0x90b1('0x43')]){_0x4474ca[_0x90b1('0x44')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x90b1('0x45')](_0x4474ca);})['then'](function(_0x576863){_0x4d729a[_0x90b1('0x46')]=_0x576863;return _0x4d729a;})[_0x90b1('0x42')](respondWithFilteredResult(_0x39fc6f,_0x4474ca))['catch'](handleError(_0x39fc6f,null));};exports[_0x90b1('0x47')]=function(_0x12c186,_0x1761c4){var _0x1000b0={'raw':![],'where':{'id':_0x12c186['params']['id']}},_0x1cb06c={};_0x1cb06c['model']=_[_0x90b1('0x48')](db[_0x90b1('0x41')][_0x90b1('0x2e')]);_0x1cb06c['query']=_[_0x90b1('0x48')](_0x12c186[_0x90b1('0x33')]);_0x1cb06c[_0x90b1('0x34')]=_[_0x90b1('0x35')](_0x1cb06c[_0x90b1('0x32')],_0x1cb06c['query']);_0x1000b0['attributes']=_['intersection'](_0x1cb06c[_0x90b1('0x32')],qs[_0x90b1('0x36')](_0x12c186[_0x90b1('0x33')][_0x90b1('0x36')]));_0x1000b0[_0x90b1('0x37')]=_0x1000b0['attributes'][_0x90b1('0x38')]?_0x1000b0[_0x90b1('0x37')]:_0x1cb06c['model'];if(_0x12c186[_0x90b1('0x33')]['includeAll']){_0x1000b0[_0x90b1('0x44')]=[{'all':!![]}];}_0x1000b0=_['merge']({},_0x1000b0,_0x12c186[_0x90b1('0x40')]);return db[_0x90b1('0x41')][_0x90b1('0x49')](_0x1000b0)[_0x90b1('0x42')](handleEntityNotFound(_0x1761c4,null))['then'](respondWithResult(_0x1761c4,null))[_0x90b1('0x4a')](handleError(_0x1761c4,null));};exports[_0x90b1('0x4b')]=function(_0x284942,_0x2001dc){return db[_0x90b1('0x41')][_0x90b1('0x4b')](_0x284942[_0x90b1('0x4c')],{})[_0x90b1('0x42')](respondWithResult(_0x2001dc,0xc9))[_0x90b1('0x4a')](handleError(_0x2001dc,null));};exports['update']=function(_0x49fa4c,_0x26662e){if(_0x49fa4c[_0x90b1('0x4c')]['id']){delete _0x49fa4c[_0x90b1('0x4c')]['id'];}return db[_0x90b1('0x41')]['find']({'where':{'id':_0x49fa4c[_0x90b1('0x4d')]['id']}})[_0x90b1('0x42')](handleEntityNotFound(_0x26662e,null))['then'](saveUpdates(_0x49fa4c[_0x90b1('0x4c')],null))[_0x90b1('0x42')](respondWithResult(_0x26662e,null))[_0x90b1('0x4a')](handleError(_0x26662e,null));};exports[_0x90b1('0x27')]=function(_0x544d9d,_0x164aff){return db[_0x90b1('0x41')][_0x90b1('0x49')]({'where':{'id':_0x544d9d[_0x90b1('0x4d')]['id']}})[_0x90b1('0x42')](handleEntityNotFound(_0x164aff,null))[_0x90b1('0x42')](removeEntity(_0x164aff,null))[_0x90b1('0x4a')](handleError(_0x164aff,null));};exports[_0x90b1('0x4e')]=function(_0x12a22e,_0x316c32,_0x1f6119){var _0x201b2e={};var _0xb58d59={};var _0x4eeef2;var _0x22944f;return db['ZendeskConfiguration'][_0x90b1('0x4f')]({'where':{'id':_0x12a22e['params']['id']}})[_0x90b1('0x42')](handleEntityNotFound(_0x316c32,null))[_0x90b1('0x42')](function(_0x648d43){if(_0x648d43){_0x4eeef2=_0x648d43;_0xb58d59[_0x90b1('0x32')]=_[_0x90b1('0x48')](db[_0x90b1('0x50')]['rawAttributes']);_0xb58d59[_0x90b1('0x33')]=_['keys'](_0x12a22e[_0x90b1('0x33')]);_0xb58d59['filters']=_[_0x90b1('0x35')](_0xb58d59[_0x90b1('0x32')],_0xb58d59['query']);_0x201b2e[_0x90b1('0x37')]=_['intersection'](_0xb58d59['model'],qs[_0x90b1('0x36')](_0x12a22e[_0x90b1('0x33')][_0x90b1('0x36')]));_0x201b2e[_0x90b1('0x37')]=_0x201b2e[_0x90b1('0x37')]['length']?_0x201b2e[_0x90b1('0x37')]:_0xb58d59[_0x90b1('0x32')];_0x201b2e['order']=qs['sort'](_0x12a22e[_0x90b1('0x33')][_0x90b1('0x3a')]);_0x201b2e['where']=qs[_0x90b1('0x34')](_[_0x90b1('0x3c')](_0x12a22e[_0x90b1('0x33')],_0xb58d59[_0x90b1('0x34')]));if(_0x12a22e['query'][_0x90b1('0x3d')]){_0x201b2e['where']=_[_0x90b1('0x3e')](_0x201b2e[_0x90b1('0x3b')],{'$or':_[_0x90b1('0x2d')](_0x201b2e[_0x90b1('0x37')],function(_0x38a3b6){var _0x1b21e0={};_0x1b21e0[_0x38a3b6]={'$like':'%'+_0x12a22e[_0x90b1('0x33')]['filter']+'%'};return _0x1b21e0;})});}_0x201b2e=_['merge']({},_0x201b2e,_0x12a22e['options']);return _0x4eeef2[_0x90b1('0x4e')](_0x201b2e);}})[_0x90b1('0x42')](function(_0x34cb62){if(_0x34cb62){_0x22944f=_0x34cb62[_0x90b1('0x38')];if(!_0x12a22e[_0x90b1('0x33')]['hasOwnProperty'](_0x90b1('0x51'))){_0x201b2e['limit']=qs['limit'](_0x12a22e[_0x90b1('0x33')][_0x90b1('0x1f')]);_0x201b2e['offset']=qs['offset'](_0x12a22e['query'][_0x90b1('0x21')]);}return _0x4eeef2[_0x90b1('0x4e')](_0x201b2e);}})[_0x90b1('0x42')](function(_0x385b7e){if(_0x385b7e){return _0x385b7e?{'count':_0x22944f,'rows':_0x385b7e}:null;}})[_0x90b1('0x42')](respondWithResult(_0x316c32,null))[_0x90b1('0x4a')](handleError(_0x316c32,null));};exports['getSubjects']=function(_0x152fe0,_0x1d9df6,_0x206bc5){var _0x261a1a={};var _0x70c9c0={};var _0x122b34;var _0x11b9d8;return db[_0x90b1('0x41')][_0x90b1('0x4f')]({'where':{'id':_0x152fe0[_0x90b1('0x4d')]['id']}})[_0x90b1('0x42')](handleEntityNotFound(_0x1d9df6,null))[_0x90b1('0x42')](function(_0xa5c1b4){if(_0xa5c1b4){_0x122b34=_0xa5c1b4;_0x70c9c0[_0x90b1('0x32')]=_['keys'](db[_0x90b1('0x50')][_0x90b1('0x2e')]);_0x70c9c0[_0x90b1('0x33')]=_[_0x90b1('0x48')](_0x152fe0[_0x90b1('0x33')]);_0x70c9c0[_0x90b1('0x34')]=_[_0x90b1('0x35')](_0x70c9c0['model'],_0x70c9c0['query']);_0x261a1a[_0x90b1('0x37')]=_[_0x90b1('0x35')](_0x70c9c0[_0x90b1('0x32')],qs[_0x90b1('0x36')](_0x152fe0[_0x90b1('0x33')][_0x90b1('0x36')]));_0x261a1a['attributes']=_0x261a1a['attributes'][_0x90b1('0x38')]?_0x261a1a[_0x90b1('0x37')]:_0x70c9c0['model'];_0x261a1a[_0x90b1('0x39')]=qs['sort'](_0x152fe0[_0x90b1('0x33')][_0x90b1('0x3a')]);_0x261a1a[_0x90b1('0x3b')]=qs[_0x90b1('0x34')](_[_0x90b1('0x3c')](_0x152fe0['query'],_0x70c9c0[_0x90b1('0x34')]));if(_0x152fe0[_0x90b1('0x33')][_0x90b1('0x3d')]){_0x261a1a[_0x90b1('0x3b')]=_[_0x90b1('0x3e')](_0x261a1a['where'],{'$or':_[_0x90b1('0x2d')](_0x261a1a[_0x90b1('0x37')],function(_0xb10b31){var _0x5083da={};_0x5083da[_0xb10b31]={'$like':'%'+_0x152fe0[_0x90b1('0x33')][_0x90b1('0x3d')]+'%'};return _0x5083da;})});}_0x261a1a=_[_0x90b1('0x3e')]({},_0x261a1a,_0x152fe0[_0x90b1('0x40')]);return _0x122b34[_0x90b1('0x52')](_0x261a1a);}})[_0x90b1('0x42')](function(_0x3bdea7){if(_0x3bdea7){_0x11b9d8=_0x3bdea7['length'];if(!_0x152fe0[_0x90b1('0x33')]['hasOwnProperty'](_0x90b1('0x51'))){_0x261a1a[_0x90b1('0x1f')]=qs[_0x90b1('0x1f')](_0x152fe0[_0x90b1('0x33')][_0x90b1('0x1f')]);_0x261a1a[_0x90b1('0x21')]=qs['offset'](_0x152fe0[_0x90b1('0x33')][_0x90b1('0x21')]);}return _0x122b34['getSubjects'](_0x261a1a);}})[_0x90b1('0x42')](function(_0xb9231c){if(_0xb9231c){return _0xb9231c?{'count':_0x11b9d8,'rows':_0xb9231c}:null;}})[_0x90b1('0x42')](respondWithResult(_0x1d9df6,null))[_0x90b1('0x4a')](handleError(_0x1d9df6,null));};exports[_0x90b1('0x53')]=function(_0x563e3e,_0x44216b,_0x5da8a0){var _0x4e22f7={};var _0x1af93a={};var _0x15ac14;var _0x520d94;return db['ZendeskConfiguration'][_0x90b1('0x4f')]({'where':{'id':_0x563e3e[_0x90b1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x44216b,null))['then'](function(_0xddeae){if(_0xddeae){_0x15ac14=_0xddeae;_0x1af93a[_0x90b1('0x32')]=_['keys'](db[_0x90b1('0x50')][_0x90b1('0x2e')]);_0x1af93a[_0x90b1('0x33')]=_[_0x90b1('0x48')](_0x563e3e['query']);_0x1af93a['filters']=_[_0x90b1('0x35')](_0x1af93a['model'],_0x1af93a['query']);_0x4e22f7[_0x90b1('0x37')]=_[_0x90b1('0x35')](_0x1af93a[_0x90b1('0x32')],qs['fields'](_0x563e3e[_0x90b1('0x33')][_0x90b1('0x36')]));_0x4e22f7[_0x90b1('0x37')]=_0x4e22f7['attributes'][_0x90b1('0x38')]?_0x4e22f7[_0x90b1('0x37')]:_0x1af93a['model'];_0x4e22f7[_0x90b1('0x39')]=qs[_0x90b1('0x3a')](_0x563e3e[_0x90b1('0x33')]['sort']);_0x4e22f7[_0x90b1('0x3b')]=qs[_0x90b1('0x34')](_['pick'](_0x563e3e[_0x90b1('0x33')],_0x1af93a[_0x90b1('0x34')]));if(_0x563e3e[_0x90b1('0x33')][_0x90b1('0x3d')]){_0x4e22f7[_0x90b1('0x3b')]=_[_0x90b1('0x3e')](_0x4e22f7[_0x90b1('0x3b')],{'$or':_[_0x90b1('0x2d')](_0x4e22f7['attributes'],function(_0x5dbf24){var _0x4e4b79={};_0x4e4b79[_0x5dbf24]={'$like':'%'+_0x563e3e[_0x90b1('0x33')][_0x90b1('0x3d')]+'%'};return _0x4e4b79;})});}_0x4e22f7=_['merge']({},_0x4e22f7,_0x563e3e['options']);return _0x15ac14['getDescriptions'](_0x4e22f7);}})[_0x90b1('0x42')](function(_0x57c317){if(_0x57c317){_0x520d94=_0x57c317[_0x90b1('0x38')];if(!_0x563e3e['query'][_0x90b1('0x54')](_0x90b1('0x51'))){_0x4e22f7[_0x90b1('0x1f')]=qs[_0x90b1('0x1f')](_0x563e3e['query'][_0x90b1('0x1f')]);_0x4e22f7[_0x90b1('0x21')]=qs[_0x90b1('0x21')](_0x563e3e[_0x90b1('0x33')]['offset']);}return _0x15ac14[_0x90b1('0x53')](_0x4e22f7);}})[_0x90b1('0x42')](function(_0xc236b1){if(_0xc236b1){return _0xc236b1?{'count':_0x520d94,'rows':_0xc236b1}:null;}})['then'](respondWithResult(_0x44216b,null))[_0x90b1('0x4a')](handleError(_0x44216b,null));};exports[_0x90b1('0x55')]=function(_0x296a24,_0x4a3d67,_0x5d92f3){var _0x5d1819={};var _0x325e4b={};var _0xe52d96;var _0x585021;return db[_0x90b1('0x41')]['findOne']({'where':{'id':_0x296a24['params']['id']}})[_0x90b1('0x42')](handleEntityNotFound(_0x4a3d67,null))[_0x90b1('0x42')](function(_0x3fe56c){if(_0x3fe56c){_0xe52d96=_0x3fe56c;_0x325e4b[_0x90b1('0x32')]=_[_0x90b1('0x48')](db['Tag']['rawAttributes']);_0x325e4b[_0x90b1('0x33')]=_[_0x90b1('0x48')](_0x296a24[_0x90b1('0x33')]);_0x325e4b[_0x90b1('0x34')]=_[_0x90b1('0x35')](_0x325e4b['model'],_0x325e4b['query']);_0x5d1819[_0x90b1('0x37')]=_[_0x90b1('0x35')](_0x325e4b['model'],qs[_0x90b1('0x36')](_0x296a24['query'][_0x90b1('0x36')]));_0x5d1819['attributes']=_0x5d1819[_0x90b1('0x37')][_0x90b1('0x38')]?_0x5d1819[_0x90b1('0x37')]:_0x325e4b[_0x90b1('0x32')];_0x5d1819['order']=qs[_0x90b1('0x3a')](_0x296a24['query'][_0x90b1('0x3a')]);_0x5d1819['where']=qs[_0x90b1('0x34')](_[_0x90b1('0x3c')](_0x296a24[_0x90b1('0x33')],_0x325e4b[_0x90b1('0x34')]));if(_0x296a24[_0x90b1('0x33')][_0x90b1('0x3d')]){_0x5d1819[_0x90b1('0x3b')]=_['merge'](_0x5d1819[_0x90b1('0x3b')],{'$or':_[_0x90b1('0x2d')](_0x5d1819[_0x90b1('0x37')],function(_0x24f34d){var _0x1a1aec={};_0x1a1aec[_0x24f34d]={'$like':'%'+_0x296a24[_0x90b1('0x33')]['filter']+'%'};return _0x1a1aec;})});}_0x5d1819=_[_0x90b1('0x3e')]({},_0x5d1819,_0x296a24['options']);return _0xe52d96[_0x90b1('0x55')](_0x5d1819);}})['then'](function(_0x572b8d){if(_0x572b8d){_0x585021=_0x572b8d['length'];if(!_0x296a24[_0x90b1('0x33')][_0x90b1('0x54')](_0x90b1('0x51'))){_0x5d1819['limit']=qs['limit'](_0x296a24[_0x90b1('0x33')][_0x90b1('0x1f')]);_0x5d1819[_0x90b1('0x21')]=qs[_0x90b1('0x21')](_0x296a24[_0x90b1('0x33')][_0x90b1('0x21')]);}return _0xe52d96[_0x90b1('0x55')](_0x5d1819);}})[_0x90b1('0x42')](function(_0x2769cd){if(_0x2769cd){return _0x2769cd?{'count':_0x585021,'rows':_0x2769cd}:null;}})[_0x90b1('0x42')](respondWithResult(_0x4a3d67,null))[_0x90b1('0x4a')](handleError(_0x4a3d67,null));};exports['setTags']=function(_0x3912c1,_0x119418,_0xc25213){if(_0x3912c1[_0x90b1('0x4c')]['id']){delete _0x3912c1[_0x90b1('0x4c')]['id'];}return db[_0x90b1('0x41')][_0x90b1('0x4f')]({'where':{'id':_0x3912c1[_0x90b1('0x4d')]['id']}})[_0x90b1('0x42')](handleEntityNotFound(_0x119418,null))[_0x90b1('0x42')](function(_0x3969c2){if(_0x3969c2){return _0x3969c2[_0x90b1('0x56')](_0x3912c1[_0x90b1('0x4c')][_0x90b1('0x57')]||[]);}return null;})[_0x90b1('0x42')](respondWithResult(_0x119418,null))[_0x90b1('0x4a')](handleError(_0x119418,null));}; \ No newline at end of file +var _0x5a77=['offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','pick','where','filter','options','includeAll','include','rows','show','params','merge','find','create','body','catch','findOne','ZendeskField','getFields','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x3f889c,_0x1c16af){var _0x5edf2a=function(_0x5adbc1){while(--_0x5adbc1){_0x3f889c['push'](_0x3f889c['shift']());}};_0x5edf2a(++_0x1c16af);}(_0x5a77,0xd7));var _0x75a7=function(_0x3818e4,_0x3242a8){_0x3818e4=_0x3818e4-0x0;var _0x3582c5=_0x5a77[_0x3818e4];return _0x3582c5;};'use strict';var emlformat=require(_0x75a7('0x0'));var rimraf=require(_0x75a7('0x1'));var zipdir=require(_0x75a7('0x2'));var jsonpatch=require(_0x75a7('0x3'));var rp=require(_0x75a7('0x4'));var moment=require(_0x75a7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75a7('0x6'));var util=require(_0x75a7('0x7'));var path=require(_0x75a7('0x8'));var sox=require('sox');var csv=require(_0x75a7('0x9'));var ejs=require(_0x75a7('0xa'));var fs=require('fs');var fs_extra=require(_0x75a7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x75a7('0xc'));var jsforce=require(_0x75a7('0xd'));var deskjs=require(_0x75a7('0xe'));var toCsv=require(_0x75a7('0x9'));var querystring=require(_0x75a7('0xf'));var Papa=require(_0x75a7('0x10'));var Redis=require(_0x75a7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75a7('0x12'));var hardwareService=require(_0x75a7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x75a7('0x14'));var config=require(_0x75a7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x75a7('0x16'))['db'];function respondWithStatusCode(_0x8658b3,_0x1389a9){_0x1389a9=_0x1389a9||0xcc;return function(_0x1d9146){if(_0x1d9146){return _0x8658b3[_0x75a7('0x17')](_0x1389a9);}return _0x8658b3['status'](_0x1389a9)['end']();};}function respondWithResult(_0x5eeeef,_0x240aec){_0x240aec=_0x240aec||0xc8;return function(_0x1bfedd){if(_0x1bfedd){return _0x5eeeef[_0x75a7('0x18')](_0x240aec)[_0x75a7('0x19')](_0x1bfedd);}};}function respondWithFilteredResult(_0x10e837,_0x1cf237){return function(_0x132538){if(_0x132538){var _0x55ced0=typeof _0x1cf237['offset']==='undefined'&&typeof _0x1cf237['limit']===_0x75a7('0x1a');var _0x3fb13f=_0x132538[_0x75a7('0x1b')];var _0x10f4e1=_0x55ced0?0x0:_0x1cf237[_0x75a7('0x1c')];var _0x5c1316=_0x55ced0?_0x132538[_0x75a7('0x1b')]:_0x1cf237[_0x75a7('0x1c')]+_0x1cf237[_0x75a7('0x1d')];var _0x11cc73;if(_0x5c1316>=_0x3fb13f){_0x5c1316=_0x3fb13f;_0x11cc73=0xc8;}else{_0x11cc73=0xce;}_0x10e837['status'](_0x11cc73);return _0x10e837[_0x75a7('0x1e')]('Content-Range',_0x10f4e1+'-'+_0x5c1316+'/'+_0x3fb13f)[_0x75a7('0x19')](_0x132538);}return null;};}function patchUpdates(_0x429d7f){return function(_0x2ebe53){try{jsonpatch[_0x75a7('0x1f')](_0x2ebe53,_0x429d7f,!![]);}catch(_0x44833c){return BPromise[_0x75a7('0x20')](_0x44833c);}return _0x2ebe53[_0x75a7('0x21')]();};}function saveUpdates(_0x2deda9,_0x21d363){return function(_0x4a0166){if(_0x4a0166){return _0x4a0166[_0x75a7('0x22')](_0x2deda9)[_0x75a7('0x23')](function(_0x119c1c){return _0x119c1c;});}return null;};}function removeEntity(_0x3baddd,_0x4a50fe){return function(_0x598249){if(_0x598249){return _0x598249[_0x75a7('0x24')]()[_0x75a7('0x23')](function(){_0x3baddd[_0x75a7('0x18')](0xcc)[_0x75a7('0x25')]();});}};}function handleEntityNotFound(_0x324a37,_0x3e7483){return function(_0x50881e){if(!_0x50881e){_0x324a37['sendStatus'](0x194);}return _0x50881e;};}function handleError(_0x3b3957,_0x2ef440){_0x2ef440=_0x2ef440||0x1f4;return function(_0x9463f){logger[_0x75a7('0x26')](_0x9463f['stack']);if(_0x9463f['name']){delete _0x9463f[_0x75a7('0x27')];}_0x3b3957[_0x75a7('0x18')](_0x2ef440)[_0x75a7('0x28')](_0x9463f);};}exports['index']=function(_0x2359c4,_0x5e0e1c){var _0x4cb12c={},_0x3035b9={},_0x13278e={'count':0x0,'rows':[]};var _0x3ce4c8=_[_0x75a7('0x29')](db[_0x75a7('0x2a')][_0x75a7('0x2b')],function(_0x561469){return{'name':_0x561469[_0x75a7('0x2c')],'type':_0x561469[_0x75a7('0x2d')]['key']};});_0x3035b9['model']=_[_0x75a7('0x29')](_0x3ce4c8,_0x75a7('0x27'));_0x3035b9[_0x75a7('0x2e')]=_[_0x75a7('0x2f')](_0x2359c4['query']);_0x3035b9[_0x75a7('0x30')]=_['intersection'](_0x3035b9['model'],_0x3035b9['query']);_0x4cb12c[_0x75a7('0x31')]=_[_0x75a7('0x32')](_0x3035b9[_0x75a7('0x33')],qs[_0x75a7('0x34')](_0x2359c4[_0x75a7('0x2e')][_0x75a7('0x34')]));_0x4cb12c['attributes']=_0x4cb12c['attributes'][_0x75a7('0x35')]?_0x4cb12c[_0x75a7('0x31')]:_0x3035b9[_0x75a7('0x33')];if(!_0x2359c4[_0x75a7('0x2e')][_0x75a7('0x36')](_0x75a7('0x37'))){_0x4cb12c[_0x75a7('0x1d')]=qs[_0x75a7('0x1d')](_0x2359c4['query'][_0x75a7('0x1d')]);_0x4cb12c[_0x75a7('0x1c')]=qs[_0x75a7('0x1c')](_0x2359c4[_0x75a7('0x2e')][_0x75a7('0x1c')]);}_0x4cb12c['order']=qs[_0x75a7('0x38')](_0x2359c4[_0x75a7('0x2e')][_0x75a7('0x38')]);_0x4cb12c['where']=qs[_0x75a7('0x30')](_[_0x75a7('0x39')](_0x2359c4[_0x75a7('0x2e')],_0x3035b9[_0x75a7('0x30')]),_0x3ce4c8);if(_0x2359c4[_0x75a7('0x2e')]['filter']){_0x4cb12c[_0x75a7('0x3a')]=_['merge'](_0x4cb12c['where'],{'$or':_[_0x75a7('0x29')](_0x3ce4c8,function(_0x4c6d37){if(_0x4c6d37['type']!=='VIRTUAL'){var _0x5fb53d={};_0x5fb53d[_0x4c6d37[_0x75a7('0x27')]]={'$like':'%'+_0x2359c4[_0x75a7('0x2e')][_0x75a7('0x3b')]+'%'};return _0x5fb53d;}})});}_0x4cb12c=_['merge']({},_0x4cb12c,_0x2359c4[_0x75a7('0x3c')]);var _0x1dfc80={'where':_0x4cb12c['where']};return db[_0x75a7('0x2a')][_0x75a7('0x1b')](_0x1dfc80)[_0x75a7('0x23')](function(_0x468812){_0x13278e[_0x75a7('0x1b')]=_0x468812;if(_0x2359c4['query'][_0x75a7('0x3d')]){_0x4cb12c[_0x75a7('0x3e')]=[{'all':!![]}];}return db[_0x75a7('0x2a')]['findAll'](_0x4cb12c);})[_0x75a7('0x23')](function(_0x2c69f3){_0x13278e[_0x75a7('0x3f')]=_0x2c69f3;return _0x13278e;})[_0x75a7('0x23')](respondWithFilteredResult(_0x5e0e1c,_0x4cb12c))['catch'](handleError(_0x5e0e1c,null));};exports[_0x75a7('0x40')]=function(_0x270d31,_0x431d14){var _0x50f13c={'raw':![],'where':{'id':_0x270d31[_0x75a7('0x41')]['id']}},_0x3bf1b9={};_0x3bf1b9[_0x75a7('0x33')]=_['keys'](db[_0x75a7('0x2a')][_0x75a7('0x2b')]);_0x3bf1b9[_0x75a7('0x2e')]=_[_0x75a7('0x2f')](_0x270d31[_0x75a7('0x2e')]);_0x3bf1b9['filters']=_[_0x75a7('0x32')](_0x3bf1b9[_0x75a7('0x33')],_0x3bf1b9[_0x75a7('0x2e')]);_0x50f13c[_0x75a7('0x31')]=_[_0x75a7('0x32')](_0x3bf1b9['model'],qs['fields'](_0x270d31[_0x75a7('0x2e')][_0x75a7('0x34')]));_0x50f13c[_0x75a7('0x31')]=_0x50f13c[_0x75a7('0x31')][_0x75a7('0x35')]?_0x50f13c[_0x75a7('0x31')]:_0x3bf1b9['model'];if(_0x270d31[_0x75a7('0x2e')][_0x75a7('0x3d')]){_0x50f13c['include']=[{'all':!![]}];}_0x50f13c=_[_0x75a7('0x42')]({},_0x50f13c,_0x270d31['options']);return db['ZendeskConfiguration'][_0x75a7('0x43')](_0x50f13c)[_0x75a7('0x23')](handleEntityNotFound(_0x431d14,null))['then'](respondWithResult(_0x431d14,null))['catch'](handleError(_0x431d14,null));};exports[_0x75a7('0x44')]=function(_0x5d8be0,_0x5e087d){return db[_0x75a7('0x2a')][_0x75a7('0x44')](_0x5d8be0['body'],{})[_0x75a7('0x23')](respondWithResult(_0x5e087d,0xc9))['catch'](handleError(_0x5e087d,null));};exports['update']=function(_0x222204,_0x2560f9){if(_0x222204[_0x75a7('0x45')]['id']){delete _0x222204[_0x75a7('0x45')]['id'];}return db[_0x75a7('0x2a')][_0x75a7('0x43')]({'where':{'id':_0x222204[_0x75a7('0x41')]['id']}})[_0x75a7('0x23')](handleEntityNotFound(_0x2560f9,null))[_0x75a7('0x23')](saveUpdates(_0x222204['body'],null))[_0x75a7('0x23')](respondWithResult(_0x2560f9,null))[_0x75a7('0x46')](handleError(_0x2560f9,null));};exports[_0x75a7('0x24')]=function(_0x4ece10,_0x8fd87e){return db[_0x75a7('0x2a')][_0x75a7('0x43')]({'where':{'id':_0x4ece10[_0x75a7('0x41')]['id']}})[_0x75a7('0x23')](handleEntityNotFound(_0x8fd87e,null))[_0x75a7('0x23')](removeEntity(_0x8fd87e,null))['catch'](handleError(_0x8fd87e,null));};exports['getFields']=function(_0x217409,_0x24806c,_0x58b415){var _0x1121eb={};var _0x25d6b2={};var _0x3f08d1;var _0x3c3fcb;return db['ZendeskConfiguration'][_0x75a7('0x47')]({'where':{'id':_0x217409['params']['id']}})[_0x75a7('0x23')](handleEntityNotFound(_0x24806c,null))[_0x75a7('0x23')](function(_0x538c98){if(_0x538c98){_0x3f08d1=_0x538c98;_0x25d6b2[_0x75a7('0x33')]=_[_0x75a7('0x2f')](db[_0x75a7('0x48')]['rawAttributes']);_0x25d6b2[_0x75a7('0x2e')]=_[_0x75a7('0x2f')](_0x217409[_0x75a7('0x2e')]);_0x25d6b2[_0x75a7('0x30')]=_['intersection'](_0x25d6b2['model'],_0x25d6b2[_0x75a7('0x2e')]);_0x1121eb[_0x75a7('0x31')]=_[_0x75a7('0x32')](_0x25d6b2[_0x75a7('0x33')],qs[_0x75a7('0x34')](_0x217409['query']['fields']));_0x1121eb[_0x75a7('0x31')]=_0x1121eb['attributes']['length']?_0x1121eb[_0x75a7('0x31')]:_0x25d6b2[_0x75a7('0x33')];_0x1121eb['order']=qs['sort'](_0x217409[_0x75a7('0x2e')][_0x75a7('0x38')]);_0x1121eb['where']=qs[_0x75a7('0x30')](_[_0x75a7('0x39')](_0x217409[_0x75a7('0x2e')],_0x25d6b2[_0x75a7('0x30')]));if(_0x217409[_0x75a7('0x2e')][_0x75a7('0x3b')]){_0x1121eb[_0x75a7('0x3a')]=_[_0x75a7('0x42')](_0x1121eb[_0x75a7('0x3a')],{'$or':_[_0x75a7('0x29')](_0x1121eb[_0x75a7('0x31')],function(_0x2c5428){var _0x1bdd5f={};_0x1bdd5f[_0x2c5428]={'$like':'%'+_0x217409[_0x75a7('0x2e')][_0x75a7('0x3b')]+'%'};return _0x1bdd5f;})});}_0x1121eb=_['merge']({},_0x1121eb,_0x217409[_0x75a7('0x3c')]);return _0x3f08d1[_0x75a7('0x49')](_0x1121eb);}})[_0x75a7('0x23')](function(_0x5f4190){if(_0x5f4190){_0x3c3fcb=_0x5f4190['length'];if(!_0x217409[_0x75a7('0x2e')][_0x75a7('0x36')](_0x75a7('0x37'))){_0x1121eb['limit']=qs['limit'](_0x217409['query']['limit']);_0x1121eb[_0x75a7('0x1c')]=qs[_0x75a7('0x1c')](_0x217409[_0x75a7('0x2e')][_0x75a7('0x1c')]);}return _0x3f08d1[_0x75a7('0x49')](_0x1121eb);}})['then'](function(_0x3b146b){if(_0x3b146b){return _0x3b146b?{'count':_0x3c3fcb,'rows':_0x3b146b}:null;}})[_0x75a7('0x23')](respondWithResult(_0x24806c,null))['catch'](handleError(_0x24806c,null));};exports[_0x75a7('0x4a')]=function(_0x5ede6e,_0x1f313f,_0x307d2c){var _0x5a3211={};var _0x2d66fb={};var _0x39b7da;var _0x4c4d95;return db[_0x75a7('0x2a')][_0x75a7('0x47')]({'where':{'id':_0x5ede6e[_0x75a7('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f313f,null))['then'](function(_0x485033){if(_0x485033){_0x39b7da=_0x485033;_0x2d66fb[_0x75a7('0x33')]=_[_0x75a7('0x2f')](db[_0x75a7('0x48')][_0x75a7('0x2b')]);_0x2d66fb[_0x75a7('0x2e')]=_[_0x75a7('0x2f')](_0x5ede6e['query']);_0x2d66fb[_0x75a7('0x30')]=_[_0x75a7('0x32')](_0x2d66fb[_0x75a7('0x33')],_0x2d66fb[_0x75a7('0x2e')]);_0x5a3211[_0x75a7('0x31')]=_[_0x75a7('0x32')](_0x2d66fb[_0x75a7('0x33')],qs[_0x75a7('0x34')](_0x5ede6e['query'][_0x75a7('0x34')]));_0x5a3211[_0x75a7('0x31')]=_0x5a3211[_0x75a7('0x31')]['length']?_0x5a3211[_0x75a7('0x31')]:_0x2d66fb['model'];_0x5a3211[_0x75a7('0x4b')]=qs[_0x75a7('0x38')](_0x5ede6e[_0x75a7('0x2e')]['sort']);_0x5a3211[_0x75a7('0x3a')]=qs['filters'](_['pick'](_0x5ede6e[_0x75a7('0x2e')],_0x2d66fb[_0x75a7('0x30')]));if(_0x5ede6e[_0x75a7('0x2e')][_0x75a7('0x3b')]){_0x5a3211[_0x75a7('0x3a')]=_[_0x75a7('0x42')](_0x5a3211[_0x75a7('0x3a')],{'$or':_['map'](_0x5a3211[_0x75a7('0x31')],function(_0x3e5362){var _0x214580={};_0x214580[_0x3e5362]={'$like':'%'+_0x5ede6e['query']['filter']+'%'};return _0x214580;})});}_0x5a3211=_[_0x75a7('0x42')]({},_0x5a3211,_0x5ede6e[_0x75a7('0x3c')]);return _0x39b7da[_0x75a7('0x4a')](_0x5a3211);}})[_0x75a7('0x23')](function(_0x4c5bac){if(_0x4c5bac){_0x4c4d95=_0x4c5bac[_0x75a7('0x35')];if(!_0x5ede6e[_0x75a7('0x2e')]['hasOwnProperty'](_0x75a7('0x37'))){_0x5a3211[_0x75a7('0x1d')]=qs[_0x75a7('0x1d')](_0x5ede6e[_0x75a7('0x2e')][_0x75a7('0x1d')]);_0x5a3211['offset']=qs[_0x75a7('0x1c')](_0x5ede6e[_0x75a7('0x2e')][_0x75a7('0x1c')]);}return _0x39b7da[_0x75a7('0x4a')](_0x5a3211);}})[_0x75a7('0x23')](function(_0x2cad09){if(_0x2cad09){return _0x2cad09?{'count':_0x4c4d95,'rows':_0x2cad09}:null;}})[_0x75a7('0x23')](respondWithResult(_0x1f313f,null))[_0x75a7('0x46')](handleError(_0x1f313f,null));};exports['getDescriptions']=function(_0x313b94,_0x3b6177,_0x2f09b0){var _0x46dacb={};var _0x2fd412={};var _0x14131f;var _0x1106e8;return db['ZendeskConfiguration'][_0x75a7('0x47')]({'where':{'id':_0x313b94['params']['id']}})[_0x75a7('0x23')](handleEntityNotFound(_0x3b6177,null))['then'](function(_0x50dd59){if(_0x50dd59){_0x14131f=_0x50dd59;_0x2fd412['model']=_[_0x75a7('0x2f')](db[_0x75a7('0x48')][_0x75a7('0x2b')]);_0x2fd412[_0x75a7('0x2e')]=_['keys'](_0x313b94[_0x75a7('0x2e')]);_0x2fd412[_0x75a7('0x30')]=_[_0x75a7('0x32')](_0x2fd412[_0x75a7('0x33')],_0x2fd412['query']);_0x46dacb[_0x75a7('0x31')]=_[_0x75a7('0x32')](_0x2fd412[_0x75a7('0x33')],qs['fields'](_0x313b94[_0x75a7('0x2e')][_0x75a7('0x34')]));_0x46dacb[_0x75a7('0x31')]=_0x46dacb[_0x75a7('0x31')][_0x75a7('0x35')]?_0x46dacb[_0x75a7('0x31')]:_0x2fd412[_0x75a7('0x33')];_0x46dacb['order']=qs[_0x75a7('0x38')](_0x313b94[_0x75a7('0x2e')][_0x75a7('0x38')]);_0x46dacb['where']=qs[_0x75a7('0x30')](_[_0x75a7('0x39')](_0x313b94[_0x75a7('0x2e')],_0x2fd412[_0x75a7('0x30')]));if(_0x313b94[_0x75a7('0x2e')]['filter']){_0x46dacb['where']=_[_0x75a7('0x42')](_0x46dacb['where'],{'$or':_[_0x75a7('0x29')](_0x46dacb[_0x75a7('0x31')],function(_0x20ca8a){var _0x69f1af={};_0x69f1af[_0x20ca8a]={'$like':'%'+_0x313b94['query'][_0x75a7('0x3b')]+'%'};return _0x69f1af;})});}_0x46dacb=_[_0x75a7('0x42')]({},_0x46dacb,_0x313b94['options']);return _0x14131f['getDescriptions'](_0x46dacb);}})[_0x75a7('0x23')](function(_0x29ba15){if(_0x29ba15){_0x1106e8=_0x29ba15[_0x75a7('0x35')];if(!_0x313b94[_0x75a7('0x2e')]['hasOwnProperty'](_0x75a7('0x37'))){_0x46dacb[_0x75a7('0x1d')]=qs[_0x75a7('0x1d')](_0x313b94[_0x75a7('0x2e')]['limit']);_0x46dacb[_0x75a7('0x1c')]=qs[_0x75a7('0x1c')](_0x313b94[_0x75a7('0x2e')][_0x75a7('0x1c')]);}return _0x14131f[_0x75a7('0x4c')](_0x46dacb);}})[_0x75a7('0x23')](function(_0x32d250){if(_0x32d250){return _0x32d250?{'count':_0x1106e8,'rows':_0x32d250}:null;}})[_0x75a7('0x23')](respondWithResult(_0x3b6177,null))['catch'](handleError(_0x3b6177,null));};exports[_0x75a7('0x4d')]=function(_0x29f220,_0x5893b8,_0x23c27a){var _0xb10adf={};var _0x2752e0={};var _0x1237d9;var _0x1a0b4b;return db[_0x75a7('0x2a')][_0x75a7('0x47')]({'where':{'id':_0x29f220['params']['id']}})[_0x75a7('0x23')](handleEntityNotFound(_0x5893b8,null))[_0x75a7('0x23')](function(_0x510cb2){if(_0x510cb2){_0x1237d9=_0x510cb2;_0x2752e0[_0x75a7('0x33')]=_[_0x75a7('0x2f')](db[_0x75a7('0x4e')][_0x75a7('0x2b')]);_0x2752e0[_0x75a7('0x2e')]=_[_0x75a7('0x2f')](_0x29f220[_0x75a7('0x2e')]);_0x2752e0[_0x75a7('0x30')]=_['intersection'](_0x2752e0[_0x75a7('0x33')],_0x2752e0['query']);_0xb10adf[_0x75a7('0x31')]=_['intersection'](_0x2752e0[_0x75a7('0x33')],qs[_0x75a7('0x34')](_0x29f220[_0x75a7('0x2e')][_0x75a7('0x34')]));_0xb10adf[_0x75a7('0x31')]=_0xb10adf['attributes']['length']?_0xb10adf[_0x75a7('0x31')]:_0x2752e0[_0x75a7('0x33')];_0xb10adf[_0x75a7('0x4b')]=qs[_0x75a7('0x38')](_0x29f220[_0x75a7('0x2e')][_0x75a7('0x38')]);_0xb10adf['where']=qs[_0x75a7('0x30')](_[_0x75a7('0x39')](_0x29f220[_0x75a7('0x2e')],_0x2752e0['filters']));if(_0x29f220[_0x75a7('0x2e')][_0x75a7('0x3b')]){_0xb10adf[_0x75a7('0x3a')]=_[_0x75a7('0x42')](_0xb10adf['where'],{'$or':_['map'](_0xb10adf['attributes'],function(_0x232156){var _0x5a4d33={};_0x5a4d33[_0x232156]={'$like':'%'+_0x29f220[_0x75a7('0x2e')][_0x75a7('0x3b')]+'%'};return _0x5a4d33;})});}_0xb10adf=_[_0x75a7('0x42')]({},_0xb10adf,_0x29f220['options']);return _0x1237d9['getTags'](_0xb10adf);}})[_0x75a7('0x23')](function(_0x1d03ad){if(_0x1d03ad){_0x1a0b4b=_0x1d03ad[_0x75a7('0x35')];if(!_0x29f220[_0x75a7('0x2e')][_0x75a7('0x36')]('nolimit')){_0xb10adf['limit']=qs[_0x75a7('0x1d')](_0x29f220[_0x75a7('0x2e')]['limit']);_0xb10adf[_0x75a7('0x1c')]=qs['offset'](_0x29f220['query']['offset']);}return _0x1237d9[_0x75a7('0x4d')](_0xb10adf);}})[_0x75a7('0x23')](function(_0x9b928){if(_0x9b928){return _0x9b928?{'count':_0x1a0b4b,'rows':_0x9b928}:null;}})[_0x75a7('0x23')](respondWithResult(_0x5893b8,null))[_0x75a7('0x46')](handleError(_0x5893b8,null));};exports[_0x75a7('0x4f')]=function(_0x425d2a,_0x117c44,_0x53e34b){if(_0x425d2a[_0x75a7('0x45')]['id']){delete _0x425d2a[_0x75a7('0x45')]['id'];}return db[_0x75a7('0x2a')]['findOne']({'where':{'id':_0x425d2a[_0x75a7('0x41')]['id']}})[_0x75a7('0x23')](handleEntityNotFound(_0x117c44,null))[_0x75a7('0x23')](function(_0x192b2e){if(_0x192b2e){return _0x192b2e['setTags'](_0x425d2a[_0x75a7('0x45')][_0x75a7('0x50')]||[]);}return null;})['then'](respondWithResult(_0x117c44,null))[_0x75a7('0x46')](handleError(_0x117c44,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 1c6433e..8fa6bc2 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 _0xb9be=['path','rimraf','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50ceed,_0x3392d9){var _0x1f21cd=function(_0x40a7fa){while(--_0x40a7fa){_0x50ceed['push'](_0x50ceed['shift']());}};_0x1f21cd(++_0x3392d9);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xb9be[_0x4b7b69];return _0x173b4c;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['define','int_zendesk_configurations','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x269094,_0x4701b3){var _0x10344f=function(_0x180a69){while(--_0x180a69){_0x269094['push'](_0x269094['shift']());}};_0x10344f(++_0x4701b3);}(_0x757a,0xde));var _0xa757=function(_0x5500fe,_0xc3d2e){_0x5500fe=_0x5500fe-0x0;var _0x7886ce=_0x757a[_0x5500fe];return _0x7886ce;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xa757('0x9'),'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 aa74c30..db90327 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 _0x1a36=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1c8af4,_0x3460af){var _0x51ea1e=function(_0x4279d0){while(--_0x4279d0){_0x1c8af4['push'](_0x1c8af4['shift']());}};_0x51ea1e(++_0x3460af);}(_0x1a36,0x90));var _0x61a3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1a36[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x61a3('0x0'));var util=require(_0x61a3('0x1'));var moment=require(_0x61a3('0x2'));var BPromise=require(_0x61a3('0x3'));var rs=require(_0x61a3('0x4'));var fs=require('fs');var Redis=require(_0x61a3('0x5'));var db=require(_0x61a3('0x6'))['db'];var utils=require(_0x61a3('0x7'));var logger=require(_0x61a3('0x8'))(_0x61a3('0x9'));var config=require(_0x61a3('0xa'));var jayson=require(_0x61a3('0xb'));var client=jayson[_0x61a3('0xc')][_0x61a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x116c49,_0x57a067,_0x1fdad9){return new BPromise(function(_0x4d18b7,_0x2ad87d){return client[_0x61a3('0xe')](_0x116c49,_0x1fdad9)[_0x61a3('0xf')](function(_0x29433e){logger[_0x61a3('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57a067,_0x61a3('0x11'));logger[_0x61a3('0x12')](_0x61a3('0x13'),_0x57a067,_0x61a3('0x11'),JSON[_0x61a3('0x14')](_0x29433e));if(_0x29433e[_0x61a3('0x15')]){if(_0x29433e[_0x61a3('0x15')][_0x61a3('0x16')]===0x1f4){logger[_0x61a3('0x15')](_0x61a3('0x17'),_0x57a067,_0x29433e[_0x61a3('0x15')][_0x61a3('0x18')]);return _0x2ad87d(_0x29433e[_0x61a3('0x15')][_0x61a3('0x18')]);}logger[_0x61a3('0x15')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57a067,_0x29433e[_0x61a3('0x15')][_0x61a3('0x18')]);return _0x4d18b7(_0x29433e['error'][_0x61a3('0x18')]);}else{logger[_0x61a3('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57a067,_0x61a3('0x11'));_0x4d18b7(_0x29433e[_0x61a3('0x19')]['message']);}})[_0x61a3('0x1a')](function(_0x1aae3d){logger[_0x61a3('0x15')](_0x61a3('0x17'),_0x57a067,_0x1aae3d);_0x2ad87d(_0x1aae3d);});});} \ No newline at end of file +var _0x3257=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5197d5,_0x2cea82){var _0x485a91=function(_0x4ce652){while(--_0x4ce652){_0x5197d5['push'](_0x5197d5['shift']());}};_0x485a91(++_0x2cea82);}(_0x3257,0x149));var _0x7325=function(_0x13778f,_0x2ce558){_0x13778f=_0x13778f-0x0;var _0x58ec76=_0x3257[_0x13778f];return _0x58ec76;};'use strict';var _=require(_0x7325('0x0'));var util=require(_0x7325('0x1'));var moment=require(_0x7325('0x2'));var BPromise=require(_0x7325('0x3'));var rs=require(_0x7325('0x4'));var fs=require('fs');var Redis=require(_0x7325('0x5'));var db=require(_0x7325('0x6'))['db'];var utils=require(_0x7325('0x7'));var logger=require(_0x7325('0x8'))(_0x7325('0x9'));var config=require(_0x7325('0xa'));var jayson=require(_0x7325('0xb'));var client=jayson[_0x7325('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b94a9,_0xf6e17f,_0x524580){return new BPromise(function(_0x204314,_0x5146e4){return client[_0x7325('0xd')](_0x5b94a9,_0x524580)['then'](function(_0x4c05fc){logger[_0x7325('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0xf6e17f,_0x7325('0xf'));logger[_0x7325('0x10')](_0x7325('0x11'),_0xf6e17f,_0x7325('0xf'),JSON[_0x7325('0x12')](_0x4c05fc));if(_0x4c05fc[_0x7325('0x13')]){if(_0x4c05fc[_0x7325('0x13')][_0x7325('0x14')]===0x1f4){logger[_0x7325('0x13')](_0x7325('0x15'),_0xf6e17f,_0x4c05fc[_0x7325('0x13')][_0x7325('0x16')]);return _0x5146e4(_0x4c05fc[_0x7325('0x13')][_0x7325('0x16')]);}logger['error'](_0x7325('0x15'),_0xf6e17f,_0x4c05fc[_0x7325('0x13')][_0x7325('0x16')]);return _0x204314(_0x4c05fc['error'][_0x7325('0x16')]);}else{logger[_0x7325('0xe')](_0x7325('0x15'),_0xf6e17f,_0x7325('0xf'));_0x204314(_0x4c05fc[_0x7325('0x17')]['message']);}})['catch'](function(_0x54154c){logger[_0x7325('0x13')](_0x7325('0x15'),_0xf6e17f,_0x54154c);_0x5146e4(_0x54154c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3aa5754..34b9ff7 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 _0xa8d4=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0xa8d4,0x101));var _0x4a8d=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0xa8d4[_0x3a60b8];return _0x4eb583;};'use strict';var multer=require(_0x4a8d('0x0'));var util=require(_0x4a8d('0x1'));var path=require(_0x4a8d('0x2'));var timeout=require(_0x4a8d('0x3'));var express=require(_0x4a8d('0x4'));var router=express[_0x4a8d('0x5')]();var fs_extra=require(_0x4a8d('0x6'));var auth=require(_0x4a8d('0x7'));var interaction=require(_0x4a8d('0x8'));var config=require(_0x4a8d('0x9'));var controller=require(_0x4a8d('0xa'));router[_0x4a8d('0xb')]('/',auth[_0x4a8d('0xc')](),controller['index']);router[_0x4a8d('0xb')](_0x4a8d('0xd'),auth[_0x4a8d('0xc')](),controller[_0x4a8d('0xe')]);router[_0x4a8d('0xf')]('/',auth[_0x4a8d('0xc')](),controller['create']);router['put'](_0x4a8d('0xd'),auth[_0x4a8d('0xc')](),controller['update']);router[_0x4a8d('0x10')](_0x4a8d('0xd'),auth[_0x4a8d('0xc')](),controller[_0x4a8d('0x11')]);module[_0x4a8d('0x12')]=router; \ No newline at end of file +var _0x9491=['show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','index','/:id','isAuthenticated'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x9491,0x77));var _0x1949=function(_0x3589e9,_0x55c1f8){_0x3589e9=_0x3589e9-0x0;var _0x2ab370=_0x9491[_0x3589e9];return _0x2ab370;};'use strict';var multer=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var path=require(_0x1949('0x2'));var timeout=require(_0x1949('0x3'));var express=require(_0x1949('0x4'));var router=express[_0x1949('0x5')]();var fs_extra=require(_0x1949('0x6'));var auth=require(_0x1949('0x7'));var interaction=require(_0x1949('0x8'));var config=require('../../config/environment');var controller=require(_0x1949('0x9'));router[_0x1949('0xa')]('/',auth['isAuthenticated'](),controller[_0x1949('0xb')]);router['get'](_0x1949('0xc'),auth[_0x1949('0xd')](),controller[_0x1949('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1949('0xf')](_0x1949('0xc'),auth['isAuthenticated'](),controller[_0x1949('0x10')]);router[_0x1949('0x11')](_0x1949('0xc'),auth[_0x1949('0xd')](),controller[_0x1949('0x12')]);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 d236ac7..3c8eb7b 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 _0xaee8=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x20d4d1,_0x2ff7b6){var _0x49419b=function(_0x2324df){while(--_0x2324df){_0x20d4d1['push'](_0x20d4d1['shift']());}};_0x49419b(++_0x2ff7b6);}(_0xaee8,0xf2));var _0x8aee=function(_0x58cef6,_0x4d577b){_0x58cef6=_0x58cef6-0x0;var _0x4f7826=_0xaee8[_0x58cef6];return _0x4f7826;};'use strict';var Sequelize=require(_0x8aee('0x0'));module['exports']={'type':{'type':Sequelize[_0x8aee('0x1')](_0x8aee('0x2'),'variable',_0x8aee('0x3'),_0x8aee('0x4'),_0x8aee('0x5')),'defaultValue':_0x8aee('0x2')},'content':{'type':Sequelize[_0x8aee('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8aee('0x1')](_0x8aee('0x2'),_0x8aee('0x7'),_0x8aee('0x3'))},'keyContent':{'type':Sequelize[_0x8aee('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8aee('0x6')]},'customField':{'type':Sequelize[_0x8aee('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8aee('0x6')]}}; \ No newline at end of file +var _0x0ddd=['string','variable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0x0ddd,0x115));var _0xd0dd=function(_0x5109d6,_0x44309d){_0x5109d6=_0x5109d6-0x0;var _0x50ed61=_0x0ddd[_0x5109d6];return _0x50ed61;};'use strict';var Sequelize=require(_0xd0dd('0x0'));module[_0xd0dd('0x1')]={'type':{'type':Sequelize[_0xd0dd('0x2')](_0xd0dd('0x3'),_0xd0dd('0x4'),'customVariable','keyValue',_0xd0dd('0x5')),'defaultValue':_0xd0dd('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd0dd('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd0dd('0x3'),_0xd0dd('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xd0dd('0x6')]},'idField':{'type':Sequelize[_0xd0dd('0x6')]},'nameField':{'type':Sequelize[_0xd0dd('0x6')]},'customField':{'type':Sequelize[_0xd0dd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd0dd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f940662..5445364 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 _0x9114=['rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','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','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','ZendeskField'];(function(_0x482815,_0x3601b1){var _0x272d11=function(_0x414e63){while(--_0x414e63){_0x482815['push'](_0x482815['shift']());}};_0x272d11(++_0x3601b1);}(_0x9114,0x72));var _0x4911=function(_0x49890b,_0x37e413){_0x49890b=_0x49890b-0x0;var _0x1c16ab=_0x9114[_0x49890b];return _0x1c16ab;};'use strict';var emlformat=require(_0x4911('0x0'));var rimraf=require(_0x4911('0x1'));var zipdir=require(_0x4911('0x2'));var jsonpatch=require(_0x4911('0x3'));var rp=require('request-promise');var moment=require(_0x4911('0x4'));var BPromise=require(_0x4911('0x5'));var Mustache=require(_0x4911('0x6'));var util=require(_0x4911('0x7'));var path=require(_0x4911('0x8'));var sox=require(_0x4911('0x9'));var csv=require(_0x4911('0xa'));var ejs=require(_0x4911('0xb'));var fs=require('fs');var fs_extra=require(_0x4911('0xc'));var _=require('lodash');var squel=require(_0x4911('0xd'));var crypto=require(_0x4911('0xe'));var jsforce=require(_0x4911('0xf'));var deskjs=require(_0x4911('0x10'));var toCsv=require(_0x4911('0xa'));var querystring=require(_0x4911('0x11'));var Papa=require(_0x4911('0x12'));var Redis=require(_0x4911('0x13'));var authService=require(_0x4911('0x14'));var qs=require(_0x4911('0x15'));var as=require(_0x4911('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4911('0x17'))(_0x4911('0x18'));var utils=require(_0x4911('0x19'));var config=require(_0x4911('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4911('0x1b'))['db'];function respondWithStatusCode(_0x5abf3d,_0x4ca386){_0x4ca386=_0x4ca386||0xcc;return function(_0x4d620b){if(_0x4d620b){return _0x5abf3d[_0x4911('0x1c')](_0x4ca386);}return _0x5abf3d['status'](_0x4ca386)[_0x4911('0x1d')]();};}function respondWithResult(_0x3098f6,_0x2de3ac){_0x2de3ac=_0x2de3ac||0xc8;return function(_0x38de3e){if(_0x38de3e){return _0x3098f6[_0x4911('0x1e')](_0x2de3ac)[_0x4911('0x1f')](_0x38de3e);}};}function respondWithFilteredResult(_0x5f1624,_0x152da4){return function(_0x3f4c8a){if(_0x3f4c8a){var _0x5220ac=typeof _0x152da4[_0x4911('0x20')]==='undefined'&&typeof _0x152da4['limit']===_0x4911('0x21');var _0x41e0c2=_0x3f4c8a[_0x4911('0x22')];var _0x3f179c=_0x5220ac?0x0:_0x152da4[_0x4911('0x20')];var _0x51bda4=_0x5220ac?_0x3f4c8a[_0x4911('0x22')]:_0x152da4[_0x4911('0x20')]+_0x152da4['limit'];var _0x9c5b48;if(_0x51bda4>=_0x41e0c2){_0x51bda4=_0x41e0c2;_0x9c5b48=0xc8;}else{_0x9c5b48=0xce;}_0x5f1624[_0x4911('0x1e')](_0x9c5b48);return _0x5f1624[_0x4911('0x23')](_0x4911('0x24'),_0x3f179c+'-'+_0x51bda4+'/'+_0x41e0c2)['json'](_0x3f4c8a);}return null;};}function patchUpdates(_0xdd837c){return function(_0x1a9c9c){try{jsonpatch['apply'](_0x1a9c9c,_0xdd837c,!![]);}catch(_0xe72e89){return BPromise['reject'](_0xe72e89);}return _0x1a9c9c[_0x4911('0x25')]();};}function saveUpdates(_0x452c94,_0x596a6f){return function(_0xcfe614){if(_0xcfe614){return _0xcfe614[_0x4911('0x26')](_0x452c94)[_0x4911('0x27')](function(_0x2dc786){return _0x2dc786;});}return null;};}function removeEntity(_0x42e9fc,_0x1e0a79){return function(_0x40ca91){if(_0x40ca91){return _0x40ca91[_0x4911('0x28')]()[_0x4911('0x27')](function(){_0x42e9fc[_0x4911('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aca60,_0xbf2014){return function(_0xcba32e){if(!_0xcba32e){_0x3aca60[_0x4911('0x1c')](0x194);}return _0xcba32e;};}function handleError(_0x3e1561,_0x5047f5){_0x5047f5=_0x5047f5||0x1f4;return function(_0x366a6b){logger[_0x4911('0x29')](_0x366a6b[_0x4911('0x2a')]);if(_0x366a6b['name']){delete _0x366a6b[_0x4911('0x2b')];}_0x3e1561[_0x4911('0x1e')](_0x5047f5)[_0x4911('0x2c')](_0x366a6b);};}exports['index']=function(_0x1b9ae9,_0x3f84e6){var _0x26a0fd={},_0x3ff2d1={},_0x24ad04={'count':0x0,'rows':[]};var _0x2ddf0d=_['map'](db[_0x4911('0x2d')][_0x4911('0x2e')],function(_0x465006){return{'name':_0x465006[_0x4911('0x2f')],'type':_0x465006[_0x4911('0x30')][_0x4911('0x31')]};});_0x3ff2d1['model']=_[_0x4911('0x32')](_0x2ddf0d,_0x4911('0x2b'));_0x3ff2d1[_0x4911('0x33')]=_[_0x4911('0x34')](_0x1b9ae9[_0x4911('0x33')]);_0x3ff2d1[_0x4911('0x35')]=_[_0x4911('0x36')](_0x3ff2d1[_0x4911('0x37')],_0x3ff2d1['query']);_0x26a0fd[_0x4911('0x38')]=_[_0x4911('0x36')](_0x3ff2d1[_0x4911('0x37')],qs[_0x4911('0x39')](_0x1b9ae9[_0x4911('0x33')]['fields']));_0x26a0fd[_0x4911('0x38')]=_0x26a0fd[_0x4911('0x38')][_0x4911('0x3a')]?_0x26a0fd[_0x4911('0x38')]:_0x3ff2d1[_0x4911('0x37')];if(!_0x1b9ae9[_0x4911('0x33')][_0x4911('0x3b')](_0x4911('0x3c'))){_0x26a0fd[_0x4911('0x3d')]=qs[_0x4911('0x3d')](_0x1b9ae9[_0x4911('0x33')]['limit']);_0x26a0fd[_0x4911('0x20')]=qs[_0x4911('0x20')](_0x1b9ae9[_0x4911('0x33')][_0x4911('0x20')]);}_0x26a0fd[_0x4911('0x3e')]=qs['sort'](_0x1b9ae9[_0x4911('0x33')][_0x4911('0x3f')]);_0x26a0fd[_0x4911('0x40')]=qs[_0x4911('0x35')](_[_0x4911('0x41')](_0x1b9ae9[_0x4911('0x33')],_0x3ff2d1['filters']),_0x2ddf0d);if(_0x1b9ae9[_0x4911('0x33')][_0x4911('0x42')]){_0x26a0fd[_0x4911('0x40')]=_['merge'](_0x26a0fd[_0x4911('0x40')],{'$or':_['map'](_0x2ddf0d,function(_0xfa19c8){if(_0xfa19c8[_0x4911('0x30')]!==_0x4911('0x43')){var _0x3fa35e={};_0x3fa35e[_0xfa19c8['name']]={'$like':'%'+_0x1b9ae9[_0x4911('0x33')][_0x4911('0x42')]+'%'};return _0x3fa35e;}})});}_0x26a0fd=_[_0x4911('0x44')]({},_0x26a0fd,_0x1b9ae9[_0x4911('0x45')]);var _0x11c55a={'where':_0x26a0fd[_0x4911('0x40')]};return db[_0x4911('0x2d')][_0x4911('0x22')](_0x11c55a)[_0x4911('0x27')](function(_0x3fe6f5){_0x24ad04[_0x4911('0x22')]=_0x3fe6f5;if(_0x1b9ae9[_0x4911('0x33')][_0x4911('0x46')]){_0x26a0fd[_0x4911('0x47')]=[{'all':!![]}];}return db[_0x4911('0x2d')][_0x4911('0x48')](_0x26a0fd);})[_0x4911('0x27')](function(_0x589427){_0x24ad04[_0x4911('0x49')]=_0x589427;return _0x24ad04;})[_0x4911('0x27')](respondWithFilteredResult(_0x3f84e6,_0x26a0fd))[_0x4911('0x4a')](handleError(_0x3f84e6,null));};exports[_0x4911('0x4b')]=function(_0x1bafb3,_0xb80c54){var _0x1e0b62={'raw':!![],'where':{'id':_0x1bafb3[_0x4911('0x4c')]['id']}},_0x32f6da={};_0x32f6da[_0x4911('0x37')]=_[_0x4911('0x34')](db['ZendeskField'][_0x4911('0x2e')]);_0x32f6da[_0x4911('0x33')]=_['keys'](_0x1bafb3[_0x4911('0x33')]);_0x32f6da[_0x4911('0x35')]=_[_0x4911('0x36')](_0x32f6da[_0x4911('0x37')],_0x32f6da[_0x4911('0x33')]);_0x1e0b62[_0x4911('0x38')]=_['intersection'](_0x32f6da[_0x4911('0x37')],qs[_0x4911('0x39')](_0x1bafb3[_0x4911('0x33')]['fields']));_0x1e0b62[_0x4911('0x38')]=_0x1e0b62[_0x4911('0x38')][_0x4911('0x3a')]?_0x1e0b62[_0x4911('0x38')]:_0x32f6da[_0x4911('0x37')];if(_0x1bafb3[_0x4911('0x33')][_0x4911('0x46')]){_0x1e0b62[_0x4911('0x47')]=[{'all':!![]}];}_0x1e0b62=_[_0x4911('0x44')]({},_0x1e0b62,_0x1bafb3[_0x4911('0x45')]);return db[_0x4911('0x2d')][_0x4911('0x4d')](_0x1e0b62)[_0x4911('0x27')](handleEntityNotFound(_0xb80c54,null))[_0x4911('0x27')](respondWithResult(_0xb80c54,null))['catch'](handleError(_0xb80c54,null));};exports[_0x4911('0x4e')]=function(_0x2c448d,_0x14962e){return db[_0x4911('0x2d')]['create'](_0x2c448d[_0x4911('0x4f')],{})[_0x4911('0x27')](respondWithResult(_0x14962e,0xc9))[_0x4911('0x4a')](handleError(_0x14962e,null));};exports[_0x4911('0x26')]=function(_0x34992b,_0x37ad31){if(_0x34992b[_0x4911('0x4f')]['id']){delete _0x34992b[_0x4911('0x4f')]['id'];}return db[_0x4911('0x2d')]['find']({'where':{'id':_0x34992b[_0x4911('0x4c')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0x37ad31,null))[_0x4911('0x27')](saveUpdates(_0x34992b[_0x4911('0x4f')],null))['then'](respondWithResult(_0x37ad31,null))[_0x4911('0x4a')](handleError(_0x37ad31,null));};exports['destroy']=function(_0x2a167d,_0xb937fa){return db[_0x4911('0x2d')][_0x4911('0x4d')]({'where':{'id':_0x2a167d[_0x4911('0x4c')]['id']}})[_0x4911('0x27')](handleEntityNotFound(_0xb937fa,null))[_0x4911('0x27')](removeEntity(_0xb937fa,null))['catch'](handleError(_0xb937fa,null));}; \ No newline at end of file +var _0xb826=['end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x5af886,_0x9957a3){var _0x170052=function(_0x2dc6fa){while(--_0x2dc6fa){_0x5af886['push'](_0x5af886['shift']());}};_0x170052(++_0x9957a3);}(_0xb826,0x1b8));var _0x6b82=function(_0x44fb85,_0xc62646){_0x44fb85=_0x44fb85-0x0;var _0x1045ca=_0xb826[_0x44fb85];return _0x1045ca;};'use strict';var emlformat=require(_0x6b82('0x0'));var rimraf=require(_0x6b82('0x1'));var zipdir=require(_0x6b82('0x2'));var jsonpatch=require(_0x6b82('0x3'));var rp=require(_0x6b82('0x4'));var moment=require(_0x6b82('0x5'));var BPromise=require(_0x6b82('0x6'));var Mustache=require(_0x6b82('0x7'));var util=require(_0x6b82('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6b82('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b82('0xa'));var _=require(_0x6b82('0xb'));var squel=require(_0x6b82('0xc'));var crypto=require('crypto');var jsforce=require(_0x6b82('0xd'));var deskjs=require(_0x6b82('0xe'));var toCsv=require(_0x6b82('0x9'));var querystring=require('querystring');var Papa=require(_0x6b82('0xf'));var Redis=require(_0x6b82('0x10'));var authService=require(_0x6b82('0x11'));var qs=require(_0x6b82('0x12'));var as=require(_0x6b82('0x13'));var hardwareService=require(_0x6b82('0x14'));var logger=require(_0x6b82('0x15'))(_0x6b82('0x16'));var utils=require(_0x6b82('0x17'));var config=require(_0x6b82('0x18'));var licenseUtil=require(_0x6b82('0x19'));var db=require(_0x6b82('0x1a'))['db'];function respondWithStatusCode(_0x44ea6d,_0xb20bcd){_0xb20bcd=_0xb20bcd||0xcc;return function(_0xfb9a12){if(_0xfb9a12){return _0x44ea6d['sendStatus'](_0xb20bcd);}return _0x44ea6d[_0x6b82('0x1b')](_0xb20bcd)[_0x6b82('0x1c')]();};}function respondWithResult(_0x36e512,_0x5e6ff8){_0x5e6ff8=_0x5e6ff8||0xc8;return function(_0x1db03e){if(_0x1db03e){return _0x36e512[_0x6b82('0x1b')](_0x5e6ff8)[_0x6b82('0x1d')](_0x1db03e);}};}function respondWithFilteredResult(_0x7c7f04,_0x1e5a43){return function(_0x3d0818){if(_0x3d0818){var _0x1555dc=typeof _0x1e5a43[_0x6b82('0x1e')]===_0x6b82('0x1f')&&typeof _0x1e5a43['limit']==='undefined';var _0x41da7b=_0x3d0818['count'];var _0x442c7a=_0x1555dc?0x0:_0x1e5a43[_0x6b82('0x1e')];var _0x372bcc=_0x1555dc?_0x3d0818[_0x6b82('0x20')]:_0x1e5a43[_0x6b82('0x1e')]+_0x1e5a43[_0x6b82('0x21')];var _0x406994;if(_0x372bcc>=_0x41da7b){_0x372bcc=_0x41da7b;_0x406994=0xc8;}else{_0x406994=0xce;}_0x7c7f04['status'](_0x406994);return _0x7c7f04[_0x6b82('0x22')](_0x6b82('0x23'),_0x442c7a+'-'+_0x372bcc+'/'+_0x41da7b)['json'](_0x3d0818);}return null;};}function patchUpdates(_0xe09e77){return function(_0x1f92a2){try{jsonpatch[_0x6b82('0x24')](_0x1f92a2,_0xe09e77,!![]);}catch(_0x1d1396){return BPromise['reject'](_0x1d1396);}return _0x1f92a2[_0x6b82('0x25')]();};}function saveUpdates(_0x59205e,_0x333197){return function(_0x3453f7){if(_0x3453f7){return _0x3453f7[_0x6b82('0x26')](_0x59205e)[_0x6b82('0x27')](function(_0x11d021){return _0x11d021;});}return null;};}function removeEntity(_0x2a5fdf,_0x49bcfe){return function(_0x33be6f){if(_0x33be6f){return _0x33be6f[_0x6b82('0x28')]()[_0x6b82('0x27')](function(){_0x2a5fdf['status'](0xcc)[_0x6b82('0x1c')]();});}};}function handleEntityNotFound(_0x3518a7,_0x44d587){return function(_0x55e84d){if(!_0x55e84d){_0x3518a7[_0x6b82('0x29')](0x194);}return _0x55e84d;};}function handleError(_0x1d7fb3,_0x58d6c0){_0x58d6c0=_0x58d6c0||0x1f4;return function(_0x441b67){logger[_0x6b82('0x2a')](_0x441b67[_0x6b82('0x2b')]);if(_0x441b67[_0x6b82('0x2c')]){delete _0x441b67[_0x6b82('0x2c')];}_0x1d7fb3['status'](_0x58d6c0)[_0x6b82('0x2d')](_0x441b67);};}exports['index']=function(_0x1fa2f0,_0x179ea1){var _0x4fab2c={},_0x5f3a2c={},_0x19db0b={'count':0x0,'rows':[]};var _0x5e96ad=_[_0x6b82('0x2e')](db[_0x6b82('0x2f')][_0x6b82('0x30')],function(_0x4355bd){return{'name':_0x4355bd[_0x6b82('0x31')],'type':_0x4355bd[_0x6b82('0x32')][_0x6b82('0x33')]};});_0x5f3a2c['model']=_[_0x6b82('0x2e')](_0x5e96ad,_0x6b82('0x2c'));_0x5f3a2c['query']=_[_0x6b82('0x34')](_0x1fa2f0['query']);_0x5f3a2c[_0x6b82('0x35')]=_[_0x6b82('0x36')](_0x5f3a2c[_0x6b82('0x37')],_0x5f3a2c[_0x6b82('0x38')]);_0x4fab2c[_0x6b82('0x39')]=_['intersection'](_0x5f3a2c[_0x6b82('0x37')],qs[_0x6b82('0x3a')](_0x1fa2f0[_0x6b82('0x38')][_0x6b82('0x3a')]));_0x4fab2c[_0x6b82('0x39')]=_0x4fab2c[_0x6b82('0x39')]['length']?_0x4fab2c['attributes']:_0x5f3a2c['model'];if(!_0x1fa2f0[_0x6b82('0x38')][_0x6b82('0x3b')](_0x6b82('0x3c'))){_0x4fab2c['limit']=qs['limit'](_0x1fa2f0[_0x6b82('0x38')][_0x6b82('0x21')]);_0x4fab2c[_0x6b82('0x1e')]=qs['offset'](_0x1fa2f0[_0x6b82('0x38')][_0x6b82('0x1e')]);}_0x4fab2c[_0x6b82('0x3d')]=qs[_0x6b82('0x3e')](_0x1fa2f0[_0x6b82('0x38')][_0x6b82('0x3e')]);_0x4fab2c['where']=qs[_0x6b82('0x35')](_['pick'](_0x1fa2f0[_0x6b82('0x38')],_0x5f3a2c[_0x6b82('0x35')]),_0x5e96ad);if(_0x1fa2f0[_0x6b82('0x38')][_0x6b82('0x3f')]){_0x4fab2c['where']=_[_0x6b82('0x40')](_0x4fab2c[_0x6b82('0x41')],{'$or':_[_0x6b82('0x2e')](_0x5e96ad,function(_0x5c8289){if(_0x5c8289[_0x6b82('0x32')]!==_0x6b82('0x42')){var _0x15ebd4={};_0x15ebd4[_0x5c8289[_0x6b82('0x2c')]]={'$like':'%'+_0x1fa2f0['query'][_0x6b82('0x3f')]+'%'};return _0x15ebd4;}})});}_0x4fab2c=_['merge']({},_0x4fab2c,_0x1fa2f0[_0x6b82('0x43')]);var _0x290bec={'where':_0x4fab2c['where']};return db[_0x6b82('0x2f')][_0x6b82('0x20')](_0x290bec)[_0x6b82('0x27')](function(_0x108f83){_0x19db0b[_0x6b82('0x20')]=_0x108f83;if(_0x1fa2f0[_0x6b82('0x38')][_0x6b82('0x44')]){_0x4fab2c['include']=[{'all':!![]}];}return db[_0x6b82('0x2f')][_0x6b82('0x45')](_0x4fab2c);})[_0x6b82('0x27')](function(_0x210e88){_0x19db0b[_0x6b82('0x46')]=_0x210e88;return _0x19db0b;})[_0x6b82('0x27')](respondWithFilteredResult(_0x179ea1,_0x4fab2c))[_0x6b82('0x47')](handleError(_0x179ea1,null));};exports[_0x6b82('0x48')]=function(_0x1ac835,_0x4d0b5c){var _0x50078d={'raw':!![],'where':{'id':_0x1ac835['params']['id']}},_0x3daac7={};_0x3daac7['model']=_['keys'](db[_0x6b82('0x2f')][_0x6b82('0x30')]);_0x3daac7[_0x6b82('0x38')]=_[_0x6b82('0x34')](_0x1ac835[_0x6b82('0x38')]);_0x3daac7[_0x6b82('0x35')]=_[_0x6b82('0x36')](_0x3daac7[_0x6b82('0x37')],_0x3daac7['query']);_0x50078d[_0x6b82('0x39')]=_[_0x6b82('0x36')](_0x3daac7['model'],qs[_0x6b82('0x3a')](_0x1ac835[_0x6b82('0x38')]['fields']));_0x50078d[_0x6b82('0x39')]=_0x50078d[_0x6b82('0x39')]['length']?_0x50078d[_0x6b82('0x39')]:_0x3daac7[_0x6b82('0x37')];if(_0x1ac835[_0x6b82('0x38')][_0x6b82('0x44')]){_0x50078d[_0x6b82('0x49')]=[{'all':!![]}];}_0x50078d=_[_0x6b82('0x40')]({},_0x50078d,_0x1ac835[_0x6b82('0x43')]);return db[_0x6b82('0x2f')][_0x6b82('0x4a')](_0x50078d)[_0x6b82('0x27')](handleEntityNotFound(_0x4d0b5c,null))[_0x6b82('0x27')](respondWithResult(_0x4d0b5c,null))[_0x6b82('0x47')](handleError(_0x4d0b5c,null));};exports[_0x6b82('0x4b')]=function(_0x28b407,_0x121d4e){return db[_0x6b82('0x2f')][_0x6b82('0x4b')](_0x28b407['body'],{})['then'](respondWithResult(_0x121d4e,0xc9))[_0x6b82('0x47')](handleError(_0x121d4e,null));};exports[_0x6b82('0x26')]=function(_0x119f04,_0x3eefe6){if(_0x119f04[_0x6b82('0x4c')]['id']){delete _0x119f04[_0x6b82('0x4c')]['id'];}return db[_0x6b82('0x2f')][_0x6b82('0x4a')]({'where':{'id':_0x119f04[_0x6b82('0x4d')]['id']}})[_0x6b82('0x27')](handleEntityNotFound(_0x3eefe6,null))[_0x6b82('0x27')](saveUpdates(_0x119f04[_0x6b82('0x4c')],null))['then'](respondWithResult(_0x3eefe6,null))[_0x6b82('0x47')](handleError(_0x3eefe6,null));};exports[_0x6b82('0x28')]=function(_0x3f09b2,_0x2355a8){return db[_0x6b82('0x2f')][_0x6b82('0x4a')]({'where':{'id':_0x3f09b2[_0x6b82('0x4d')]['id']}})[_0x6b82('0x27')](handleEntityNotFound(_0x2355a8,null))[_0x6b82('0x27')](removeEntity(_0x2355a8,null))[_0x6b82('0x47')](handleError(_0x2355a8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index bf82575..6bbc05c 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 _0xc90f=['bluebird','path','../../config/environment','./intZendeskField.attributes','exports','define','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc90f,0x7d));var _0xfc90=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xc90f[_0x43b08];return _0x5e05f4;};'use strict';var _=require(_0xfc90('0x0'));var util=require(_0xfc90('0x1'));var logger=require(_0xfc90('0x2'))(_0xfc90('0x3'));var moment=require(_0xfc90('0x4'));var BPromise=require(_0xfc90('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc90('0x6'));var rimraf=require('rimraf');var config=require(_0xfc90('0x7'));var attributes=require(_0xfc90('0x8'));module[_0xfc90('0x9')]=function(_0x3729f8,_0x426ec4){return _0x3729f8[_0xfc90('0xa')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xfc90('0xb'),'fields':['idField',_0xfc90('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44b7=['path','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x16e72f,_0x4b4aa2){var _0x520c54=function(_0x339beb){while(--_0x339beb){_0x16e72f['push'](_0x16e72f['shift']());}};_0x520c54(++_0x4b4aa2);}(_0x44b7,0xdb));var _0x744b=function(_0x6cc297,_0x22c19b){_0x6cc297=_0x6cc297-0x0;var _0xc67d2b=_0x44b7[_0x6cc297];return _0xc67d2b;};'use strict';var _=require('lodash');var util=require(_0x744b('0x0'));var logger=require(_0x744b('0x1'))(_0x744b('0x2'));var moment=require(_0x744b('0x3'));var BPromise=require(_0x744b('0x4'));var rp=require(_0x744b('0x5'));var fs=require('fs');var path=require(_0x744b('0x6'));var rimraf=require('rimraf');var config=require(_0x744b('0x7'));var attributes=require(_0x744b('0x8'));module[_0x744b('0x9')]=function(_0x3b7493,_0x175431){return _0x3b7493[_0x744b('0xa')]('ZendeskField',attributes,{'tableName':_0x744b('0xb'),'paranoid':![],'indexes':[{'name':_0x744b('0xc'),'fields':[_0x744b('0xd'),_0x744b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 0f0c596..139aa76 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 _0x5e05=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util'];(function(_0x282484,_0x27a8d3){var _0x53da23=function(_0x2d9849){while(--_0x2d9849){_0x282484['push'](_0x282484['shift']());}};_0x53da23(++_0x27a8d3);}(_0x5e05,0x1cc));var _0x55e0=function(_0xbab76b,_0xd5919d){_0xbab76b=_0xbab76b-0x0;var _0x593d9d=_0x5e05[_0xbab76b];return _0x593d9d;};'use strict';var _=require(_0x55e0('0x0'));var util=require(_0x55e0('0x1'));var moment=require('moment');var BPromise=require(_0x55e0('0x2'));var rs=require(_0x55e0('0x3'));var fs=require('fs');var Redis=require(_0x55e0('0x4'));var db=require(_0x55e0('0x5'))['db'];var utils=require(_0x55e0('0x6'));var logger=require(_0x55e0('0x7'))(_0x55e0('0x8'));var config=require(_0x55e0('0x9'));var jayson=require(_0x55e0('0xa'));var client=jayson['client'][_0x55e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeb8527,_0x2bbc48,_0x7442ae){return new BPromise(function(_0x54fa7b,_0x4a2456){return client[_0x55e0('0xc')](_0xeb8527,_0x7442ae)[_0x55e0('0xd')](function(_0x5ad858){logger[_0x55e0('0xe')](_0x55e0('0xf'),_0x2bbc48,_0x55e0('0x10'));logger[_0x55e0('0x11')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x2bbc48,_0x55e0('0x10'),JSON[_0x55e0('0x12')](_0x5ad858));if(_0x5ad858['error']){if(_0x5ad858[_0x55e0('0x13')]['code']===0x1f4){logger[_0x55e0('0x13')](_0x55e0('0xf'),_0x2bbc48,_0x5ad858[_0x55e0('0x13')]['message']);return _0x4a2456(_0x5ad858[_0x55e0('0x13')]['message']);}logger[_0x55e0('0x13')](_0x55e0('0xf'),_0x2bbc48,_0x5ad858[_0x55e0('0x13')][_0x55e0('0x14')]);return _0x54fa7b(_0x5ad858[_0x55e0('0x13')][_0x55e0('0x14')]);}else{logger[_0x55e0('0xe')]('ZendeskField,\x20%s,\x20%s',_0x2bbc48,_0x55e0('0x10'));_0x54fa7b(_0x5ad858['result'][_0x55e0('0x14')]);}})['catch'](function(_0x2b67c0){logger[_0x55e0('0x13')](_0x55e0('0xf'),_0x2bbc48,_0x2b67c0);_0x4a2456(_0x2b67c0);});});} \ No newline at end of file +var _0x590b=['request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1da47c,_0x81abfd){var _0xb4d224=function(_0x54b064){while(--_0x54b064){_0x1da47c['push'](_0x1da47c['shift']());}};_0xb4d224(++_0x81abfd);}(_0x590b,0x1a3));var _0xb590=function(_0x375f55,_0x2a53ce){_0x375f55=_0x375f55-0x0;var _0x1c0b23=_0x590b[_0x375f55];return _0x1c0b23;};'use strict';var _=require(_0xb590('0x0'));var util=require(_0xb590('0x1'));var moment=require(_0xb590('0x2'));var BPromise=require(_0xb590('0x3'));var rs=require(_0xb590('0x4'));var fs=require('fs');var Redis=require(_0xb590('0x5'));var db=require(_0xb590('0x6'))['db'];var utils=require(_0xb590('0x7'));var logger=require(_0xb590('0x8'))(_0xb590('0x9'));var config=require(_0xb590('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb590('0xb')][_0xb590('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cff0f,_0x55bcbd,_0x228eaa){return new BPromise(function(_0xdf9dfd,_0xf60ced){return client[_0xb590('0xd')](_0x5cff0f,_0x228eaa)['then'](function(_0x5e81a9){logger[_0xb590('0xe')](_0xb590('0xf'),_0x55bcbd,_0xb590('0x10'));logger[_0xb590('0x11')](_0xb590('0x12'),_0x55bcbd,_0xb590('0x10'),JSON[_0xb590('0x13')](_0x5e81a9));if(_0x5e81a9['error']){if(_0x5e81a9[_0xb590('0x14')][_0xb590('0x15')]===0x1f4){logger[_0xb590('0x14')]('ZendeskField,\x20%s,\x20%s',_0x55bcbd,_0x5e81a9[_0xb590('0x14')][_0xb590('0x16')]);return _0xf60ced(_0x5e81a9[_0xb590('0x14')][_0xb590('0x16')]);}logger[_0xb590('0x14')](_0xb590('0xf'),_0x55bcbd,_0x5e81a9[_0xb590('0x14')]['message']);return _0xdf9dfd(_0x5e81a9[_0xb590('0x14')][_0xb590('0x16')]);}else{logger[_0xb590('0xe')](_0xb590('0xf'),_0x55bcbd,'request\x20sent');_0xdf9dfd(_0x5e81a9[_0xb590('0x17')]['message']);}})['catch'](function(_0x4380f0){logger[_0xb590('0x14')](_0xb590('0xf'),_0x55bcbd,_0x4380f0);_0xf60ced(_0x4380f0);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 552d253..ce1914f 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 _0xbeab=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x4abd08,_0x1a03d1){var _0xd926e6=function(_0x49ab35){while(--_0x49ab35){_0x4abd08['push'](_0x4abd08['shift']());}};_0xd926e6(++_0x1a03d1);}(_0xbeab,0x198));var _0xbbea=function(_0x2336f9,_0x57b414){_0x2336f9=_0x2336f9-0x0;var _0x132bd7=_0xbeab[_0x2336f9];return _0x132bd7;};'use strict';var multer=require(_0xbbea('0x0'));var util=require(_0xbbea('0x1'));var path=require(_0xbbea('0x2'));var timeout=require(_0xbbea('0x3'));var express=require('express');var router=express[_0xbbea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbbea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbbea('0x6'));var controller=require('./intZohoAccount.controller');router[_0xbbea('0x7')]('/',auth[_0xbbea('0x8')](),controller[_0xbbea('0x9')]);router[_0xbbea('0x7')]('/:id',auth[_0xbbea('0x8')](),controller[_0xbbea('0xa')]);router[_0xbbea('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xbbea('0xb')]);router[_0xbbea('0x7')](_0xbbea('0xc'),auth['isAuthenticated'](),controller[_0xbbea('0xd')]);router[_0xbbea('0xe')]('/',auth[_0xbbea('0x8')](),controller[_0xbbea('0xf')]);router[_0xbbea('0xe')](_0xbbea('0x10'),auth[_0xbbea('0x8')](),controller[_0xbbea('0x11')]);router[_0xbbea('0x12')](_0xbbea('0x13'),auth['isAuthenticated'](),controller[_0xbbea('0x14')]);router[_0xbbea('0x15')](_0xbbea('0x13'),auth[_0xbbea('0x8')](),controller[_0xbbea('0x16')]);module[_0xbbea('0x17')]=router; \ No newline at end of file +var _0x5221=['express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x573d70,_0x2a5888){var _0x73fd43=function(_0x9ade71){while(--_0x9ade71){_0x573d70['push'](_0x573d70['shift']());}};_0x73fd43(++_0x2a5888);}(_0x5221,0x1e2));var _0x1522=function(_0x584c61,_0x564dec){_0x584c61=_0x584c61-0x0;var _0x260394=_0x5221[_0x584c61];return _0x260394;};'use strict';var multer=require('multer');var util=require(_0x1522('0x0'));var path=require('path');var timeout=require(_0x1522('0x1'));var express=require(_0x1522('0x2'));var router=express[_0x1522('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1522('0x4'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x1522('0x5')]('/',auth[_0x1522('0x6')](),controller[_0x1522('0x7')]);router[_0x1522('0x5')](_0x1522('0x8'),auth['isAuthenticated'](),controller[_0x1522('0x9')]);router['get'](_0x1522('0xa'),auth['isAuthenticated'](),controller[_0x1522('0xb')]);router[_0x1522('0x5')](_0x1522('0xc'),auth['isAuthenticated'](),controller[_0x1522('0xd')]);router[_0x1522('0xe')]('/',auth[_0x1522('0x6')](),controller[_0x1522('0xf')]);router[_0x1522('0xe')](_0x1522('0xa'),auth[_0x1522('0x6')](),controller[_0x1522('0x10')]);router[_0x1522('0x11')](_0x1522('0x8'),auth['isAuthenticated'](),controller[_0x1522('0x12')]);router[_0x1522('0x13')](_0x1522('0x8'),auth['isAuthenticated'](),controller[_0x1522('0x14')]);module[_0x1522('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1a4471f..f5dcc5c 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 _0x5636=['sequelize','exports','STRING'];(function(_0x30b037,_0x4e7bfc){var _0x1ab47e=function(_0x3e0ce2){while(--_0x3e0ce2){_0x30b037['push'](_0x30b037['shift']());}};_0x1ab47e(++_0x4e7bfc);}(_0x5636,0x102));var _0x6563=function(_0x5b8050,_0x2b7970){_0x5b8050=_0x5b8050-0x0;var _0x1224de=_0x5636[_0x5b8050];return _0x1224de;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6563('0x2')]},'clientId':{'type':Sequelize[_0x6563('0x2')]},'clientSecret':{'type':Sequelize[_0x6563('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6563('0x2')]},'refreshToken':{'type':Sequelize[_0x6563('0x2')]}}; \ No newline at end of file +var _0xa75b=['sequelize','STRING'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa75b,0x170));var _0xba75=function(_0x401cfc,_0x4e36aa){_0x401cfc=_0x401cfc-0x0;var _0x49e01f=_0xa75b[_0x401cfc];return _0x49e01f;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba75('0x1')]},'host':{'type':Sequelize[_0xba75('0x1')]},'zone':{'type':Sequelize[_0xba75('0x1')]},'clientId':{'type':Sequelize[_0xba75('0x1')]},'clientSecret':{'type':Sequelize[_0xba75('0x1')]},'serverUrl':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xba75('0x1')]},'refreshToken':{'type':Sequelize[_0xba75('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index da56865..a5f1c11 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 _0x5b5d=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params','rawAttributes','create','update','body','find','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','serverUrl','refreshToken','host','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','data_type','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ZohoAccount','fieldName'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5b5d,0xcd));var _0xd5b5=function(_0x316be3,_0x21de2e){_0x316be3=_0x316be3-0x0;var _0xb43181=_0x5b5d[_0x316be3];return _0xb43181;};'use strict';var emlformat=require(_0xd5b5('0x0'));var rimraf=require(_0xd5b5('0x1'));var zipdir=require(_0xd5b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5b5('0x3'));var moment=require(_0xd5b5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd5b5('0x5'));var util=require(_0xd5b5('0x6'));var path=require(_0xd5b5('0x7'));var sox=require('sox');var csv=require(_0xd5b5('0x8'));var ejs=require(_0xd5b5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5b5('0xa'));var squel=require(_0xd5b5('0xb'));var crypto=require(_0xd5b5('0xc'));var jsforce=require(_0xd5b5('0xd'));var deskjs=require(_0xd5b5('0xe'));var toCsv=require(_0xd5b5('0x8'));var querystring=require('querystring');var Papa=require(_0xd5b5('0xf'));var Redis=require(_0xd5b5('0x10'));var authService=require(_0xd5b5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd5b5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5b5('0x13'))(_0xd5b5('0x14'));var utils=require(_0xd5b5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd5b5('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd5b5('0x17'));function respondWithStatusCode(_0x486c5b,_0x55f4a9){_0x55f4a9=_0x55f4a9||0xcc;return function(_0x4826bb){if(_0x4826bb){return _0x486c5b[_0xd5b5('0x18')](_0x55f4a9);}return _0x486c5b[_0xd5b5('0x19')](_0x55f4a9)['end']();};}function respondWithResult(_0x5e0e96,_0x110e58){_0x110e58=_0x110e58||0xc8;return function(_0x19796c){if(_0x19796c){return _0x5e0e96[_0xd5b5('0x19')](_0x110e58)[_0xd5b5('0x1a')](_0x19796c);}};}function respondWithFilteredResult(_0x7d8dbb,_0x35f6eb){return function(_0x2178e7){if(_0x2178e7){var _0x496e8b=typeof _0x35f6eb[_0xd5b5('0x1b')]===_0xd5b5('0x1c')&&typeof _0x35f6eb[_0xd5b5('0x1d')]==='undefined';var _0x33290d=_0x2178e7[_0xd5b5('0x1e')];var _0x474cc1=_0x496e8b?0x0:_0x35f6eb[_0xd5b5('0x1b')];var _0x54b576=_0x496e8b?_0x2178e7[_0xd5b5('0x1e')]:_0x35f6eb[_0xd5b5('0x1b')]+_0x35f6eb['limit'];var _0x41dd42;if(_0x54b576>=_0x33290d){_0x54b576=_0x33290d;_0x41dd42=0xc8;}else{_0x41dd42=0xce;}_0x7d8dbb[_0xd5b5('0x19')](_0x41dd42);return _0x7d8dbb[_0xd5b5('0x1f')](_0xd5b5('0x20'),_0x474cc1+'-'+_0x54b576+'/'+_0x33290d)[_0xd5b5('0x1a')](_0x2178e7);}return null;};}function patchUpdates(_0x3f4401){return function(_0x389a39){try{jsonpatch[_0xd5b5('0x21')](_0x389a39,_0x3f4401,!![]);}catch(_0x2ae90a){return BPromise[_0xd5b5('0x22')](_0x2ae90a);}return _0x389a39[_0xd5b5('0x23')]();};}function saveUpdates(_0x3d10c8,_0x37083a){return function(_0x360d6d){if(_0x360d6d){return _0x360d6d['update'](_0x3d10c8)[_0xd5b5('0x24')](function(_0x52e3d9){return _0x52e3d9;});}return null;};}function removeEntity(_0x64bba0,_0x2f2427){return function(_0x2dd7cd){if(_0x2dd7cd){return _0x2dd7cd[_0xd5b5('0x25')]()[_0xd5b5('0x24')](function(){_0x64bba0[_0xd5b5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff319,_0x566b1e){return function(_0x4711a2){if(!_0x4711a2){_0x4ff319['sendStatus'](0x194);}return _0x4711a2;};}function handleError(_0x19a277,_0xed5e0){_0xed5e0=_0xed5e0||0x1f4;return function(_0x155ed9){logger[_0xd5b5('0x26')](_0x155ed9['stack']);if(_0x155ed9[_0xd5b5('0x27')]){delete _0x155ed9['name'];}_0x19a277[_0xd5b5('0x19')](_0xed5e0)[_0xd5b5('0x28')](_0x155ed9);};}exports[_0xd5b5('0x29')]=function(_0x17167e,_0x58331f){var _0x10a217={},_0x325e6d={},_0x420379={'count':0x0,'rows':[]};var _0x49c9b2=_[_0xd5b5('0x2a')](db[_0xd5b5('0x2b')]['rawAttributes'],function(_0x159a7c){return{'name':_0x159a7c[_0xd5b5('0x2c')],'type':_0x159a7c[_0xd5b5('0x2d')][_0xd5b5('0x2e')]};});_0x325e6d[_0xd5b5('0x2f')]=_['map'](_0x49c9b2,_0xd5b5('0x27'));_0x325e6d[_0xd5b5('0x30')]=_[_0xd5b5('0x31')](_0x17167e['query']);_0x325e6d[_0xd5b5('0x32')]=_[_0xd5b5('0x33')](_0x325e6d[_0xd5b5('0x2f')],_0x325e6d[_0xd5b5('0x30')]);_0x10a217[_0xd5b5('0x34')]=_[_0xd5b5('0x33')](_0x325e6d[_0xd5b5('0x2f')],qs[_0xd5b5('0x35')](_0x17167e['query']['fields']));_0x10a217[_0xd5b5('0x34')]=_0x10a217[_0xd5b5('0x34')][_0xd5b5('0x36')]?_0x10a217['attributes']:_0x325e6d['model'];if(!_0x17167e[_0xd5b5('0x30')][_0xd5b5('0x37')](_0xd5b5('0x38'))){_0x10a217[_0xd5b5('0x1d')]=qs['limit'](_0x17167e[_0xd5b5('0x30')][_0xd5b5('0x1d')]);_0x10a217['offset']=qs[_0xd5b5('0x1b')](_0x17167e['query'][_0xd5b5('0x1b')]);}_0x10a217[_0xd5b5('0x39')]=qs[_0xd5b5('0x3a')](_0x17167e[_0xd5b5('0x30')][_0xd5b5('0x3a')]);_0x10a217[_0xd5b5('0x3b')]=qs[_0xd5b5('0x32')](_[_0xd5b5('0x3c')](_0x17167e[_0xd5b5('0x30')],_0x325e6d['filters']),_0x49c9b2);if(_0x17167e['query'][_0xd5b5('0x3d')]){_0x10a217[_0xd5b5('0x3b')]=_['merge'](_0x10a217['where'],{'$or':_[_0xd5b5('0x2a')](_0x49c9b2,function(_0x1a88f6){if(_0x1a88f6[_0xd5b5('0x2d')]!==_0xd5b5('0x3e')){var _0x57e2a7={};_0x57e2a7[_0x1a88f6[_0xd5b5('0x27')]]={'$like':'%'+_0x17167e['query'][_0xd5b5('0x3d')]+'%'};return _0x57e2a7;}})});}_0x10a217=_[_0xd5b5('0x3f')]({},_0x10a217,_0x17167e[_0xd5b5('0x40')]);var _0x111028={'where':_0x10a217[_0xd5b5('0x3b')]};return db['ZohoAccount']['count'](_0x111028)[_0xd5b5('0x24')](function(_0x1421b7){_0x420379[_0xd5b5('0x1e')]=_0x1421b7;if(_0x17167e['query'][_0xd5b5('0x41')]){_0x10a217[_0xd5b5('0x42')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x10a217);})[_0xd5b5('0x24')](function(_0x1c786b){_0x420379['rows']=_0x1c786b;return _0x420379;})[_0xd5b5('0x24')](respondWithFilteredResult(_0x58331f,_0x10a217))[_0xd5b5('0x43')](handleError(_0x58331f,null));};exports['show']=function(_0x3f23ae,_0x1046ae){var _0x3c9f5a={'raw':![],'where':{'id':_0x3f23ae[_0xd5b5('0x44')]['id']}},_0x2544bd={};_0x2544bd[_0xd5b5('0x2f')]=_[_0xd5b5('0x31')](db[_0xd5b5('0x2b')][_0xd5b5('0x45')]);_0x2544bd['query']=_[_0xd5b5('0x31')](_0x3f23ae['query']);_0x2544bd[_0xd5b5('0x32')]=_[_0xd5b5('0x33')](_0x2544bd[_0xd5b5('0x2f')],_0x2544bd[_0xd5b5('0x30')]);_0x3c9f5a[_0xd5b5('0x34')]=_[_0xd5b5('0x33')](_0x2544bd[_0xd5b5('0x2f')],qs[_0xd5b5('0x35')](_0x3f23ae[_0xd5b5('0x30')][_0xd5b5('0x35')]));_0x3c9f5a[_0xd5b5('0x34')]=_0x3c9f5a[_0xd5b5('0x34')][_0xd5b5('0x36')]?_0x3c9f5a[_0xd5b5('0x34')]:_0x2544bd['model'];if(_0x3f23ae[_0xd5b5('0x30')][_0xd5b5('0x41')]){_0x3c9f5a[_0xd5b5('0x42')]=[{'all':!![]}];}_0x3c9f5a=_[_0xd5b5('0x3f')]({},_0x3c9f5a,_0x3f23ae[_0xd5b5('0x40')]);return db['ZohoAccount']['find'](_0x3c9f5a)[_0xd5b5('0x24')](handleEntityNotFound(_0x1046ae,null))[_0xd5b5('0x24')](respondWithResult(_0x1046ae,null))['catch'](handleError(_0x1046ae,null));};exports[_0xd5b5('0x46')]=function(_0x14c854,_0x53f479){return db[_0xd5b5('0x2b')][_0xd5b5('0x46')](_0x14c854['body'],{})[_0xd5b5('0x24')](respondWithResult(_0x53f479,0xc9))['catch'](handleError(_0x53f479,null));};exports[_0xd5b5('0x47')]=function(_0x35ada4,_0x536d05){if(_0x35ada4[_0xd5b5('0x48')]['id']){delete _0x35ada4[_0xd5b5('0x48')]['id'];}return db[_0xd5b5('0x2b')][_0xd5b5('0x49')]({'where':{'id':_0x35ada4[_0xd5b5('0x44')]['id']}})[_0xd5b5('0x24')](handleEntityNotFound(_0x536d05,null))[_0xd5b5('0x24')](saveUpdates(_0x35ada4[_0xd5b5('0x48')],null))['then'](respondWithResult(_0x536d05,null))[_0xd5b5('0x43')](handleError(_0x536d05,null));};exports[_0xd5b5('0x25')]=function(_0x4f1d19,_0x30650a){return db[_0xd5b5('0x2b')][_0xd5b5('0x49')]({'where':{'id':_0x4f1d19['params']['id']}})['then'](handleEntityNotFound(_0x30650a,null))[_0xd5b5('0x24')](removeEntity(_0x30650a,null))[_0xd5b5('0x43')](handleError(_0x30650a,null));};exports[_0xd5b5('0x4a')]=function(_0x20a798,_0x2b9e30,_0x3790c9){var _0x130096={};var _0x595371={};var _0x2ce4e3;var _0xd019b6;return db[_0xd5b5('0x2b')]['findOne']({'where':{'id':_0x20a798['params']['id']}})[_0xd5b5('0x24')](handleEntityNotFound(_0x2b9e30,null))['then'](function(_0x3ec393){if(_0x3ec393){_0x2ce4e3=_0x3ec393;_0x595371[_0xd5b5('0x2f')]=_['keys'](db[_0xd5b5('0x4b')][_0xd5b5('0x45')]);_0x595371[_0xd5b5('0x30')]=_['keys'](_0x20a798[_0xd5b5('0x30')]);_0x595371[_0xd5b5('0x32')]=_[_0xd5b5('0x33')](_0x595371[_0xd5b5('0x2f')],_0x595371['query']);_0x130096[_0xd5b5('0x34')]=_[_0xd5b5('0x33')](_0x595371[_0xd5b5('0x2f')],qs[_0xd5b5('0x35')](_0x20a798[_0xd5b5('0x30')][_0xd5b5('0x35')]));_0x130096[_0xd5b5('0x34')]=_0x130096[_0xd5b5('0x34')]['length']?_0x130096[_0xd5b5('0x34')]:_0x595371['model'];_0x130096[_0xd5b5('0x39')]=qs[_0xd5b5('0x3a')](_0x20a798[_0xd5b5('0x30')][_0xd5b5('0x3a')]);_0x130096[_0xd5b5('0x3b')]=qs[_0xd5b5('0x32')](_[_0xd5b5('0x3c')](_0x20a798[_0xd5b5('0x30')],_0x595371[_0xd5b5('0x32')]));if(_0x20a798[_0xd5b5('0x30')][_0xd5b5('0x3d')]){_0x130096['where']=_[_0xd5b5('0x3f')](_0x130096['where'],{'$or':_[_0xd5b5('0x2a')](_0x130096[_0xd5b5('0x34')],function(_0xdf0716){var _0x10ec00={};_0x10ec00[_0xdf0716]={'$like':'%'+_0x20a798[_0xd5b5('0x30')][_0xd5b5('0x3d')]+'%'};return _0x10ec00;})});}_0x130096=_[_0xd5b5('0x3f')]({},_0x130096,_0x20a798['options']);return _0x2ce4e3[_0xd5b5('0x4a')](_0x130096);}})[_0xd5b5('0x24')](function(_0x3f3111){if(_0x3f3111){_0xd019b6=_0x3f3111[_0xd5b5('0x36')];if(!_0x20a798[_0xd5b5('0x30')]['hasOwnProperty'](_0xd5b5('0x38'))){_0x130096['limit']=qs['limit'](_0x20a798[_0xd5b5('0x30')][_0xd5b5('0x1d')]);_0x130096['offset']=qs['offset'](_0x20a798[_0xd5b5('0x30')]['offset']);}return _0x2ce4e3[_0xd5b5('0x4a')](_0x130096);}})[_0xd5b5('0x24')](function(_0x1c41ee){if(_0x1c41ee){return _0x1c41ee?{'count':_0xd019b6,'rows':_0x1c41ee}:null;}})[_0xd5b5('0x24')](respondWithResult(_0x2b9e30,null))['catch'](handleError(_0x2b9e30,null));};exports[_0xd5b5('0x4c')]=function(_0xa034c,_0x29ed96,_0x4733bb){if(_0xa034c['body']['id']){delete _0xa034c['body']['id'];}return db[_0xd5b5('0x2b')][_0xd5b5('0x4d')]({'where':{'id':_0xa034c[_0xd5b5('0x44')]['id']}})[_0xd5b5('0x24')](handleEntityNotFound(_0x29ed96,null))[_0xd5b5('0x24')](function(_0x5128d8){if(_0x5128d8){_0xa034c[_0xd5b5('0x48')][_0xd5b5('0x4e')]=_0x5128d8['id'];_0xa034c[_0xd5b5('0x48')][_0xd5b5('0x4f')]=integrations[_0xd5b5('0x50')](_0xa034c[_0xd5b5('0x48')][_0xd5b5('0x51')],_0xa034c[_0xd5b5('0x48')][_0xd5b5('0x2d')]);_0xa034c['body']['Descriptions']=integrations['getDescriptions'](_0xa034c[_0xd5b5('0x48')][_0xd5b5('0x51')],_0xa034c[_0xd5b5('0x48')][_0xd5b5('0x2d')]);return db[_0xd5b5('0x4b')][_0xd5b5('0x46')](_0xa034c[_0xd5b5('0x48')],{'include':[{'model':db['ZohoField'],'as':_0xd5b5('0x4f')},{'model':db[_0xd5b5('0x52')],'as':_0xd5b5('0x53')}]});}return null;})[_0xd5b5('0x24')](respondWithResult(_0x29ed96,null))[_0xd5b5('0x43')](handleError(_0x29ed96,null));};function getAccessToken(_0x5600f1){return new Promise(function(_0x175bf9,_0x305c29){var _0x320c55;switch(_0x5600f1['zone']){case'US':_0x320c55=_0xd5b5('0x54');break;case'AU':_0x320c55='https://accounts.zoho.com.au';break;case'EU':_0x320c55=_0xd5b5('0x55');break;case'IN':_0x320c55=_0xd5b5('0x56');break;case'CN':_0x320c55=_0xd5b5('0x57');break;default:_0x320c55='https://accounts.zoho.eu';break;}var _0x4dcfa8={'method':'POST','uri':_0x320c55+'/oauth/v2/token','qs':{'refresh_token':_0x5600f1['refreshToken'],'client_id':_0x5600f1[_0xd5b5('0x58')],'client_secret':_0x5600f1[_0xd5b5('0x59')],'grant_type':_0xd5b5('0x5a')},'json':!![]};return rp(_0x4dcfa8)[_0xd5b5('0x24')](function(_0x3ddd73){if(_0x3ddd73[_0xd5b5('0x5b')]){_0x175bf9(_0x3ddd73['access_token']);}else{_0x305c29(_0xd5b5('0x5c'));}})[_0xd5b5('0x43')](function(_0x3d8b09){_0x305c29(_0x3d8b09);});});}exports[_0xd5b5('0x5d')]=function(_0xc5519a,_0x5e83a3,_0x2d21c2){var _0x5cb742,_0x4f60e0,_0x245917,_0xd6ed68,_0x4b90e7;return db[_0xd5b5('0x2b')][_0xd5b5('0x4d')]({'where':{'id':_0xc5519a[_0xd5b5('0x44')]['id']},'attributes':['id','host',_0xd5b5('0x5e'),_0xd5b5('0x58'),_0xd5b5('0x59'),_0xd5b5('0x5f'),'code',_0xd5b5('0x60')]})[_0xd5b5('0x24')](handleEntityNotFound(_0x5e83a3,null))[_0xd5b5('0x24')](function(_0x3e800f){_0x4b90e7=_0x3e800f;_0x5cb742=_0x4b90e7[_0xd5b5('0x61')];_0x4f60e0=_0x5cb742==='zoho.eu'?'eu':_0xd5b5('0x62');_0x245917=_0x4b90e7[_0xd5b5('0x5f')];var _0x27e063=_0x245917[_0xd5b5('0x63')](-0x1);if(_0x27e063==='/'||_0x27e063==='\x5c'||_0x27e063===':'){_0x245917=_0x245917[_0xd5b5('0x64')](0x0,_0x245917['lastIndexOf'](_0x27e063));}if(!_0x4b90e7[_0xd5b5('0x60')]){throw new Error(_0xd5b5('0x65'));}return getAccessToken(_0x4b90e7);})['then'](function(_0x13af1f){if(_0x13af1f){return rp({'method':_0xd5b5('0x66'),'uri':util['format'](_0xd5b5('0x67'),_0x4f60e0),'qs':{'module':_0xd5b5('0x68')},'headers':{'Authorization':_0xd5b5('0x69')+_0x13af1f},'json':!![]});}})[_0xd5b5('0x24')](function(_0x44d97f){if(_0x44d97f){if(_0x44d97f[_0xd5b5('0x6a')]&&_0x44d97f[_0xd5b5('0x6a')][_0xd5b5('0x26')]){throw new Error(_0x44d97f[_0xd5b5('0x6a')][_0xd5b5('0x26')]['message']);}var _0xbaf209=[];var _0x1fe439=[];var _0x2404cb=['Owner',_0xd5b5('0x6b'),_0xd5b5('0x6c'),_0xd5b5('0x6d'),'Call_Duration',_0xd5b5('0x6e'),_0xd5b5('0x6f'),_0xd5b5('0x70')];_0x1fe439=_[_0xd5b5('0x71')](_0x44d97f[_0xd5b5('0x35')],function(_0x5b0c61){return _0x2404cb[_0xd5b5('0x72')](_0x5b0c61[_0xd5b5('0x73')]);});for(var _0x5edf9b=0x0;_0x5edf9b<_0x1fe439[_0xd5b5('0x36')];_0x5edf9b++){if(_0x1fe439[_0x5edf9b][_0xd5b5('0x74')]===![]){_0xbaf209['push']({'id':_0x1fe439[_0x5edf9b]['id'],'name':_0x1fe439[_0x5edf9b][_0xd5b5('0x75')],'custom':_0x1fe439[_0x5edf9b]['custom_field'],'options':_0x1fe439[_0x5edf9b][_0xd5b5('0x76')]===_0xd5b5('0x77')&&_0x1fe439[_0x5edf9b][_0xd5b5('0x78')][_0xd5b5('0x36')]>-0x1?_[_0xd5b5('0x2a')](_0x1fe439[_0x5edf9b][_0xd5b5('0x78')],function(_0x2b9532){return{'name':_0x2b9532,'value':_0x2b9532};}):[]});}}return{'count':_0xbaf209[_0xd5b5('0x36')],'rows':_0xbaf209};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5e83a3,null))[_0xd5b5('0x43')](function(_0x584f27){var _0x43655d=_0xc5519a[_0xd5b5('0x30')][_0xd5b5('0x79')]?0x1f4:_0x584f27[_0xd5b5('0x7a')]||0x1f4;logger[_0xd5b5('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xd5b5('0x5d'),_0x43655d,JSON[_0xd5b5('0x7b')](_0x584f27));delete _0x584f27[_0xd5b5('0x27')];if(_0x43655d===0x191){_0x43655d=0x190;}_0x5e83a3[_0xd5b5('0x19')](_0x43655d)[_0xd5b5('0x28')](_0xc5519a[_0xd5b5('0x30')][_0xd5b5('0x79')]?{'message':_0xd5b5('0x7c'),'statusCode':_0x584f27[_0xd5b5('0x7a')]}:_0x584f27);});}; \ No newline at end of file +var _0x8864=['include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','order','pick','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','filter','where','merge','options','ZohoAccount','includeAll'];(function(_0x5cb7c0,_0x12acde){var _0x469a64=function(_0x2571d3){while(--_0x2571d3){_0x5cb7c0['push'](_0x5cb7c0['shift']());}};_0x469a64(++_0x12acde);}(_0x8864,0x148));var _0x4886=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x8864[_0x311f44];return _0x46f1e6;};'use strict';var emlformat=require(_0x4886('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4886('0x1'));var jsonpatch=require(_0x4886('0x2'));var rp=require(_0x4886('0x3'));var moment=require(_0x4886('0x4'));var BPromise=require(_0x4886('0x5'));var Mustache=require(_0x4886('0x6'));var util=require(_0x4886('0x7'));var path=require(_0x4886('0x8'));var sox=require('sox');var csv=require(_0x4886('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4886('0xa'));var squel=require(_0x4886('0xb'));var crypto=require(_0x4886('0xc'));var jsforce=require(_0x4886('0xd'));var deskjs=require(_0x4886('0xe'));var toCsv=require(_0x4886('0x9'));var querystring=require('querystring');var Papa=require(_0x4886('0xf'));var Redis=require(_0x4886('0x10'));var authService=require(_0x4886('0x11'));var qs=require(_0x4886('0x12'));var as=require(_0x4886('0x13'));var hardwareService=require(_0x4886('0x14'));var logger=require(_0x4886('0x15'))('api');var utils=require(_0x4886('0x16'));var config=require(_0x4886('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4886('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56f174,_0x6d7e89){_0x6d7e89=_0x6d7e89||0xcc;return function(_0x424e79){if(_0x424e79){return _0x56f174[_0x4886('0x19')](_0x6d7e89);}return _0x56f174['status'](_0x6d7e89)[_0x4886('0x1a')]();};}function respondWithResult(_0x402a84,_0x141eb3){_0x141eb3=_0x141eb3||0xc8;return function(_0x3492e1){if(_0x3492e1){return _0x402a84[_0x4886('0x1b')](_0x141eb3)['json'](_0x3492e1);}};}function respondWithFilteredResult(_0x290431,_0x35eb36){return function(_0x2f44b4){if(_0x2f44b4){var _0x1013da=typeof _0x35eb36[_0x4886('0x1c')]===_0x4886('0x1d')&&typeof _0x35eb36[_0x4886('0x1e')]===_0x4886('0x1d');var _0x11e9f5=_0x2f44b4[_0x4886('0x1f')];var _0x16cfbb=_0x1013da?0x0:_0x35eb36[_0x4886('0x1c')];var _0x290a84=_0x1013da?_0x2f44b4[_0x4886('0x1f')]:_0x35eb36[_0x4886('0x1c')]+_0x35eb36[_0x4886('0x1e')];var _0x3b43cf;if(_0x290a84>=_0x11e9f5){_0x290a84=_0x11e9f5;_0x3b43cf=0xc8;}else{_0x3b43cf=0xce;}_0x290431[_0x4886('0x1b')](_0x3b43cf);return _0x290431[_0x4886('0x20')](_0x4886('0x21'),_0x16cfbb+'-'+_0x290a84+'/'+_0x11e9f5)['json'](_0x2f44b4);}return null;};}function patchUpdates(_0xfe412e){return function(_0x4c088f){try{jsonpatch[_0x4886('0x22')](_0x4c088f,_0xfe412e,!![]);}catch(_0xfe9552){return BPromise[_0x4886('0x23')](_0xfe9552);}return _0x4c088f['save']();};}function saveUpdates(_0x6858c0,_0x4953aa){return function(_0x2f8bc6){if(_0x2f8bc6){return _0x2f8bc6['update'](_0x6858c0)[_0x4886('0x24')](function(_0x3a4c0a){return _0x3a4c0a;});}return null;};}function removeEntity(_0x5c24b3,_0x1bf931){return function(_0x5c32ec){if(_0x5c32ec){return _0x5c32ec[_0x4886('0x25')]()[_0x4886('0x24')](function(){_0x5c24b3[_0x4886('0x1b')](0xcc)[_0x4886('0x1a')]();});}};}function handleEntityNotFound(_0x32ccf3,_0x1ff3dc){return function(_0x4073c7){if(!_0x4073c7){_0x32ccf3[_0x4886('0x19')](0x194);}return _0x4073c7;};}function handleError(_0x53dc94,_0x23fe39){_0x23fe39=_0x23fe39||0x1f4;return function(_0x5888e6){logger[_0x4886('0x26')](_0x5888e6['stack']);if(_0x5888e6[_0x4886('0x27')]){delete _0x5888e6['name'];}_0x53dc94[_0x4886('0x1b')](_0x23fe39)['send'](_0x5888e6);};}exports[_0x4886('0x28')]=function(_0x2c39ea,_0x11b629){var _0x2933f2={},_0xac2d1b={},_0x1725cf={'count':0x0,'rows':[]};var _0xaca4b=_[_0x4886('0x29')](db['ZohoAccount'][_0x4886('0x2a')],function(_0x21c092){return{'name':_0x21c092[_0x4886('0x2b')],'type':_0x21c092[_0x4886('0x2c')][_0x4886('0x2d')]};});_0xac2d1b['model']=_[_0x4886('0x29')](_0xaca4b,_0x4886('0x27'));_0xac2d1b[_0x4886('0x2e')]=_[_0x4886('0x2f')](_0x2c39ea['query']);_0xac2d1b[_0x4886('0x30')]=_[_0x4886('0x31')](_0xac2d1b[_0x4886('0x32')],_0xac2d1b[_0x4886('0x2e')]);_0x2933f2['attributes']=_[_0x4886('0x31')](_0xac2d1b[_0x4886('0x32')],qs[_0x4886('0x33')](_0x2c39ea[_0x4886('0x2e')][_0x4886('0x33')]));_0x2933f2[_0x4886('0x34')]=_0x2933f2[_0x4886('0x34')][_0x4886('0x35')]?_0x2933f2[_0x4886('0x34')]:_0xac2d1b['model'];if(!_0x2c39ea[_0x4886('0x2e')][_0x4886('0x36')]('nolimit')){_0x2933f2[_0x4886('0x1e')]=qs['limit'](_0x2c39ea[_0x4886('0x2e')][_0x4886('0x1e')]);_0x2933f2[_0x4886('0x1c')]=qs['offset'](_0x2c39ea['query'][_0x4886('0x1c')]);}_0x2933f2['order']=qs[_0x4886('0x37')](_0x2c39ea[_0x4886('0x2e')][_0x4886('0x37')]);_0x2933f2['where']=qs[_0x4886('0x30')](_['pick'](_0x2c39ea[_0x4886('0x2e')],_0xac2d1b['filters']),_0xaca4b);if(_0x2c39ea[_0x4886('0x2e')][_0x4886('0x38')]){_0x2933f2[_0x4886('0x39')]=_[_0x4886('0x3a')](_0x2933f2[_0x4886('0x39')],{'$or':_[_0x4886('0x29')](_0xaca4b,function(_0xc6aeb0){if(_0xc6aeb0[_0x4886('0x2c')]!=='VIRTUAL'){var _0x4cfec6={};_0x4cfec6[_0xc6aeb0[_0x4886('0x27')]]={'$like':'%'+_0x2c39ea[_0x4886('0x2e')]['filter']+'%'};return _0x4cfec6;}})});}_0x2933f2=_[_0x4886('0x3a')]({},_0x2933f2,_0x2c39ea[_0x4886('0x3b')]);var _0x530bd8={'where':_0x2933f2['where']};return db[_0x4886('0x3c')][_0x4886('0x1f')](_0x530bd8)['then'](function(_0x3b5389){_0x1725cf[_0x4886('0x1f')]=_0x3b5389;if(_0x2c39ea['query'][_0x4886('0x3d')]){_0x2933f2[_0x4886('0x3e')]=[{'all':!![]}];}return db[_0x4886('0x3c')][_0x4886('0x3f')](_0x2933f2);})[_0x4886('0x24')](function(_0x572834){_0x1725cf[_0x4886('0x40')]=_0x572834;return _0x1725cf;})[_0x4886('0x24')](respondWithFilteredResult(_0x11b629,_0x2933f2))[_0x4886('0x41')](handleError(_0x11b629,null));};exports[_0x4886('0x42')]=function(_0x5a21aa,_0x3896b6){var _0x378490={'raw':![],'where':{'id':_0x5a21aa[_0x4886('0x43')]['id']}},_0x1becbe={};_0x1becbe['model']=_[_0x4886('0x2f')](db[_0x4886('0x3c')][_0x4886('0x2a')]);_0x1becbe['query']=_[_0x4886('0x2f')](_0x5a21aa[_0x4886('0x2e')]);_0x1becbe[_0x4886('0x30')]=_[_0x4886('0x31')](_0x1becbe[_0x4886('0x32')],_0x1becbe[_0x4886('0x2e')]);_0x378490[_0x4886('0x34')]=_['intersection'](_0x1becbe[_0x4886('0x32')],qs[_0x4886('0x33')](_0x5a21aa['query'][_0x4886('0x33')]));_0x378490[_0x4886('0x34')]=_0x378490['attributes'][_0x4886('0x35')]?_0x378490[_0x4886('0x34')]:_0x1becbe[_0x4886('0x32')];if(_0x5a21aa[_0x4886('0x2e')][_0x4886('0x3d')]){_0x378490[_0x4886('0x3e')]=[{'all':!![]}];}_0x378490=_[_0x4886('0x3a')]({},_0x378490,_0x5a21aa[_0x4886('0x3b')]);return db[_0x4886('0x3c')][_0x4886('0x44')](_0x378490)['then'](handleEntityNotFound(_0x3896b6,null))['then'](respondWithResult(_0x3896b6,null))[_0x4886('0x41')](handleError(_0x3896b6,null));};exports[_0x4886('0x45')]=function(_0x30a179,_0x88db4){return db[_0x4886('0x3c')][_0x4886('0x45')](_0x30a179[_0x4886('0x46')],{})[_0x4886('0x24')](respondWithResult(_0x88db4,0xc9))[_0x4886('0x41')](handleError(_0x88db4,null));};exports[_0x4886('0x47')]=function(_0x449d53,_0x43fa4e){if(_0x449d53['body']['id']){delete _0x449d53[_0x4886('0x46')]['id'];}return db['ZohoAccount'][_0x4886('0x44')]({'where':{'id':_0x449d53['params']['id']}})[_0x4886('0x24')](handleEntityNotFound(_0x43fa4e,null))[_0x4886('0x24')](saveUpdates(_0x449d53[_0x4886('0x46')],null))[_0x4886('0x24')](respondWithResult(_0x43fa4e,null))[_0x4886('0x41')](handleError(_0x43fa4e,null));};exports[_0x4886('0x25')]=function(_0x3da7a3,_0x46cb98){return db[_0x4886('0x3c')][_0x4886('0x44')]({'where':{'id':_0x3da7a3[_0x4886('0x43')]['id']}})[_0x4886('0x24')](handleEntityNotFound(_0x46cb98,null))[_0x4886('0x24')](removeEntity(_0x46cb98,null))['catch'](handleError(_0x46cb98,null));};exports[_0x4886('0x48')]=function(_0xe3ceca,_0x3283d9,_0x47bbc3){var _0x30149f={};var _0x40b27c={};var _0x43c0ae;var _0x1929e4;return db[_0x4886('0x3c')][_0x4886('0x49')]({'where':{'id':_0xe3ceca['params']['id']}})['then'](handleEntityNotFound(_0x3283d9,null))[_0x4886('0x24')](function(_0x2f82dc){if(_0x2f82dc){_0x43c0ae=_0x2f82dc;_0x40b27c[_0x4886('0x32')]=_['keys'](db[_0x4886('0x4a')]['rawAttributes']);_0x40b27c['query']=_[_0x4886('0x2f')](_0xe3ceca[_0x4886('0x2e')]);_0x40b27c[_0x4886('0x30')]=_[_0x4886('0x31')](_0x40b27c[_0x4886('0x32')],_0x40b27c[_0x4886('0x2e')]);_0x30149f[_0x4886('0x34')]=_['intersection'](_0x40b27c['model'],qs[_0x4886('0x33')](_0xe3ceca[_0x4886('0x2e')]['fields']));_0x30149f[_0x4886('0x34')]=_0x30149f[_0x4886('0x34')][_0x4886('0x35')]?_0x30149f['attributes']:_0x40b27c['model'];_0x30149f[_0x4886('0x4b')]=qs['sort'](_0xe3ceca[_0x4886('0x2e')][_0x4886('0x37')]);_0x30149f[_0x4886('0x39')]=qs[_0x4886('0x30')](_[_0x4886('0x4c')](_0xe3ceca['query'],_0x40b27c['filters']));if(_0xe3ceca['query'][_0x4886('0x38')]){_0x30149f[_0x4886('0x39')]=_[_0x4886('0x3a')](_0x30149f[_0x4886('0x39')],{'$or':_[_0x4886('0x29')](_0x30149f[_0x4886('0x34')],function(_0xb39041){var _0x4592d0={};_0x4592d0[_0xb39041]={'$like':'%'+_0xe3ceca[_0x4886('0x2e')]['filter']+'%'};return _0x4592d0;})});}_0x30149f=_['merge']({},_0x30149f,_0xe3ceca[_0x4886('0x3b')]);return _0x43c0ae[_0x4886('0x48')](_0x30149f);}})[_0x4886('0x24')](function(_0x2059a8){if(_0x2059a8){_0x1929e4=_0x2059a8[_0x4886('0x35')];if(!_0xe3ceca[_0x4886('0x2e')]['hasOwnProperty'](_0x4886('0x4d'))){_0x30149f[_0x4886('0x1e')]=qs[_0x4886('0x1e')](_0xe3ceca[_0x4886('0x2e')][_0x4886('0x1e')]);_0x30149f[_0x4886('0x1c')]=qs['offset'](_0xe3ceca[_0x4886('0x2e')][_0x4886('0x1c')]);}return _0x43c0ae[_0x4886('0x48')](_0x30149f);}})[_0x4886('0x24')](function(_0x2732c3){if(_0x2732c3){return _0x2732c3?{'count':_0x1929e4,'rows':_0x2732c3}:null;}})[_0x4886('0x24')](respondWithResult(_0x3283d9,null))['catch'](handleError(_0x3283d9,null));};exports[_0x4886('0x4e')]=function(_0x2ab862,_0x5c3c5f,_0x335dc6){if(_0x2ab862[_0x4886('0x46')]['id']){delete _0x2ab862[_0x4886('0x46')]['id'];}return db[_0x4886('0x3c')][_0x4886('0x49')]({'where':{'id':_0x2ab862[_0x4886('0x43')]['id']}})[_0x4886('0x24')](handleEntityNotFound(_0x5c3c5f,null))[_0x4886('0x24')](function(_0x3a164e){if(_0x3a164e){_0x2ab862['body'][_0x4886('0x4f')]=_0x3a164e['id'];_0x2ab862[_0x4886('0x46')][_0x4886('0x50')]=integrations['getSubjects'](_0x2ab862['body'][_0x4886('0x51')],_0x2ab862['body']['type']);_0x2ab862[_0x4886('0x46')][_0x4886('0x52')]=integrations[_0x4886('0x53')](_0x2ab862[_0x4886('0x46')][_0x4886('0x51')],_0x2ab862[_0x4886('0x46')][_0x4886('0x2c')]);return db['ZohoConfiguration'][_0x4886('0x45')](_0x2ab862['body'],{'include':[{'model':db[_0x4886('0x54')],'as':'Subjects'},{'model':db[_0x4886('0x54')],'as':_0x4886('0x52')}]});}return null;})['then'](respondWithResult(_0x5c3c5f,null))[_0x4886('0x41')](handleError(_0x5c3c5f,null));};function getAccessToken(_0x43b570){return new Promise(function(_0x796d35,_0x363e98){var _0x572612;switch(_0x43b570['zone']){case'US':_0x572612=_0x4886('0x55');break;case'AU':_0x572612=_0x4886('0x56');break;case'EU':_0x572612=_0x4886('0x57');break;case'IN':_0x572612=_0x4886('0x58');break;case'CN':_0x572612='https://accounts.zoho.com.cn';break;default:_0x572612=_0x4886('0x57');break;}var _0x50f714={'method':_0x4886('0x59'),'uri':_0x572612+_0x4886('0x5a'),'qs':{'refresh_token':_0x43b570[_0x4886('0x5b')],'client_id':_0x43b570[_0x4886('0x5c')],'client_secret':_0x43b570['clientSecret'],'grant_type':_0x4886('0x5d')},'json':!![]};return rp(_0x50f714)[_0x4886('0x24')](function(_0x3c867d){if(_0x3c867d[_0x4886('0x5e')]){_0x796d35(_0x3c867d[_0x4886('0x5e')]);}else{_0x363e98(_0x4886('0x5f'));}})['catch'](function(_0x2afb9b){_0x363e98(_0x2afb9b);});});}exports[_0x4886('0x60')]=function(_0x5719b5,_0x217b2e,_0x332573){var _0x4f3973,_0x5b4441,_0x84dbed,_0x511975,_0x40f667;return db[_0x4886('0x3c')][_0x4886('0x49')]({'where':{'id':_0x5719b5[_0x4886('0x43')]['id']},'attributes':['id',_0x4886('0x61'),_0x4886('0x62'),'clientId','clientSecret',_0x4886('0x63'),_0x4886('0x64'),'refreshToken']})[_0x4886('0x24')](handleEntityNotFound(_0x217b2e,null))[_0x4886('0x24')](function(_0x22f2ab){_0x40f667=_0x22f2ab;_0x4f3973=_0x40f667[_0x4886('0x61')];_0x5b4441=_0x4f3973===_0x4886('0x65')?'eu':_0x4886('0x66');_0x84dbed=_0x40f667[_0x4886('0x63')];var _0x2570ff=_0x84dbed[_0x4886('0x67')](-0x1);if(_0x2570ff==='/'||_0x2570ff==='\x5c'||_0x2570ff===':'){_0x84dbed=_0x84dbed[_0x4886('0x68')](0x0,_0x84dbed['lastIndexOf'](_0x2570ff));}if(!_0x40f667['refreshToken']){throw new Error(_0x4886('0x69'));}return getAccessToken(_0x40f667);})[_0x4886('0x24')](function(_0x56f80d){if(_0x56f80d){return rp({'method':_0x4886('0x6a'),'uri':util[_0x4886('0x6b')](_0x4886('0x6c'),_0x5b4441),'qs':{'module':_0x4886('0x6d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x56f80d},'json':!![]});}})[_0x4886('0x24')](function(_0x33ee75){if(_0x33ee75){if(_0x33ee75['response']&&_0x33ee75[_0x4886('0x6e')][_0x4886('0x26')]){throw new Error(_0x33ee75['response'][_0x4886('0x26')]['message']);}var _0x2f28e5=[];var _0x419df5=[];var _0x47ddcb=[_0x4886('0x6f'),_0x4886('0x70'),_0x4886('0x71'),_0x4886('0x72'),_0x4886('0x73'),'Call_Result',_0x4886('0x74'),_0x4886('0x75')];_0x419df5=_[_0x4886('0x76')](_0x33ee75[_0x4886('0x33')],function(_0xa4e2c7){return _0x47ddcb[_0x4886('0x77')](_0xa4e2c7[_0x4886('0x78')]);});for(var _0x418fbb=0x0;_0x418fbb<_0x419df5['length'];_0x418fbb++){if(_0x419df5[_0x418fbb][_0x4886('0x79')]===![]){_0x2f28e5['push']({'id':_0x419df5[_0x418fbb]['id'],'name':_0x419df5[_0x418fbb][_0x4886('0x7a')],'custom':_0x419df5[_0x418fbb][_0x4886('0x7b')],'options':_0x419df5[_0x418fbb][_0x4886('0x7c')]==='picklist'&&_0x419df5[_0x418fbb][_0x4886('0x7d')][_0x4886('0x35')]>-0x1?_[_0x4886('0x29')](_0x419df5[_0x418fbb][_0x4886('0x7d')],function(_0x2b673b){return{'name':_0x2b673b,'value':_0x2b673b};}):[]});}}return{'count':_0x2f28e5[_0x4886('0x35')],'rows':_0x2f28e5};}else{return{'count':0x0,'rows':[]};}})[_0x4886('0x24')](respondWithResult(_0x217b2e,null))[_0x4886('0x41')](function(_0x3bfd0a){var _0x1fb91e=_0x5719b5[_0x4886('0x2e')][_0x4886('0x7e')]?0x1f4:_0x3bfd0a[_0x4886('0x7f')]||0x1f4;logger[_0x4886('0x26')](_0x4886('0x80'),'getFields',_0x1fb91e,JSON[_0x4886('0x81')](_0x3bfd0a));delete _0x3bfd0a[_0x4886('0x27')];if(_0x1fb91e===0x191){_0x1fb91e=0x190;}_0x217b2e[_0x4886('0x1b')](_0x1fb91e)['send'](_0x5719b5[_0x4886('0x2e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3bfd0a[_0x4886('0x7f')]}:_0x3bfd0a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 066bcf1..d693b15 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 _0xc8a0=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','clientSecret','parse','refresh_token','refreshToken','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','substring','https://accounts.zoho.com.au','POST','application/x-www-form-urlencoded','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','slice','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.in'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0xc8a0,0x109));var _0x0c8a=function(_0x5e99ae,_0x37d21f){_0x5e99ae=_0x5e99ae-0x0;var _0x286019=_0xc8a0[_0x5e99ae];return _0x286019;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c8a('0x0'))(_0x0c8a('0x1'));var moment=require('moment');var BPromise=require(_0x0c8a('0x2'));var rp=require(_0x0c8a('0x3'));var fs=require('fs');var path=require(_0x0c8a('0x4'));var rimraf=require(_0x0c8a('0x5'));var config=require(_0x0c8a('0x6'));var attributes=require(_0x0c8a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x0c8a('0x8')]=function(_0x3f8a4c,_0x2f3aa2){return _0x3f8a4c[_0x0c8a('0x9')](_0x0c8a('0xa'),attributes,{'tableName':_0x0c8a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3289c1,_0x5e5650,_0x4ace05){if(_0x3289c1['changed']('zone')||_0x3289c1[_0x0c8a('0xc')](_0x0c8a('0xd'))||_0x3289c1[_0x0c8a('0xc')](_0x0c8a('0xe'))||_0x3289c1[_0x0c8a('0xc')]('clientSecret')||_0x3289c1[_0x0c8a('0xc')](_0x0c8a('0xf'))||_0x3289c1[_0x0c8a('0xc')](_0x0c8a('0x10'))){var _0x13b482,_0x2784c4;_0x13b482=_0x3289c1['serverUrl'];var _0x248732=_0x13b482[_0x0c8a('0x11')](-0x1);if(_0x248732==='/'||_0x248732==='\x5c'||_0x248732===':'){_0x13b482=_0x13b482['substring'](0x0,_0x13b482[_0x0c8a('0x12')](_0x248732));}switch(_0x3289c1[_0x0c8a('0x13')]){case'US':_0x2784c4=_0x0c8a('0x14');break;case'AU':_0x2784c4='https://accounts.zoho.com.au';break;case'IN':_0x2784c4=_0x0c8a('0x15');break;case'CN':_0x2784c4=_0x0c8a('0x16');break;default:_0x2784c4=_0x0c8a('0x17');break;}var _0x251188={'method':'POST','uri':_0x2784c4+'/oauth/v2/token','form':{'grant_type':_0x0c8a('0x18'),'client_id':_0x3289c1[_0x0c8a('0xe')],'client_secret':_0x3289c1[_0x0c8a('0x19')],'redirect_uri':_0x3289c1[_0x0c8a('0xd')],'code':_0x3289c1[_0x0c8a('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x251188)['then'](function(_0x16405d){var _0x4acf1a=JSON[_0x0c8a('0x1a')](_0x16405d);if(_0x4acf1a[_0x0c8a('0x1b')]){_0x3289c1[_0x0c8a('0x1c')]=_0x4acf1a[_0x0c8a('0x1b')];logger[_0x0c8a('0x1d')](util[_0x0c8a('0x1e')](_0x0c8a('0x1f'),_0x3289c1[_0x0c8a('0x20')],_0x3289c1['id']));}else{logger[_0x0c8a('0x21')](util[_0x0c8a('0x1e')](_0x0c8a('0x22'),_0x3289c1['name'],_0x3289c1['id']),util[_0x0c8a('0x23')](_0x4acf1a,{'showHidden':![],'depth':null}));}return _0x4ace05(null,_0x5e5650);})[_0x0c8a('0x24')](function(_0x5437a8){logger[_0x0c8a('0x21')](util[_0x0c8a('0x1e')](_0x0c8a('0x22'),_0x3289c1['name'],_0x3289c1['id']),util[_0x0c8a('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4ace05(_0x5437a8);});}else{return _0x4ace05(null,_0x5e5650);}},'beforeUpdate':function(_0x3b9a7c,_0x4e4238,_0x18a82e){if(_0x3b9a7c[_0x0c8a('0xc')](_0x0c8a('0x13'))||_0x3b9a7c[_0x0c8a('0xc')](_0x0c8a('0xd'))||_0x3b9a7c[_0x0c8a('0xc')](_0x0c8a('0xe'))||_0x3b9a7c[_0x0c8a('0xc')]('clientSecret')||_0x3b9a7c['changed'](_0x0c8a('0xf'))||_0x3b9a7c['changed'](_0x0c8a('0x10'))){var _0x4a10bc,_0x27b653;_0x4a10bc=_0x3b9a7c['serverUrl'];var _0x5ebe88=_0x4a10bc[_0x0c8a('0x11')](-0x1);if(_0x5ebe88==='/'||_0x5ebe88==='\x5c'||_0x5ebe88===':'){_0x4a10bc=_0x4a10bc[_0x0c8a('0x25')](0x0,_0x4a10bc[_0x0c8a('0x12')](_0x5ebe88));}switch(_0x3b9a7c['zone']){case'US':_0x27b653=_0x0c8a('0x14');break;case'AU':_0x27b653=_0x0c8a('0x26');break;case'IN':_0x27b653=_0x0c8a('0x15');break;case'CN':_0x27b653='https://accounts.zoho.com.cn';break;default:_0x27b653='https://accounts.zoho.eu';break;}var _0x5732bc={'method':_0x0c8a('0x27'),'uri':_0x27b653+'/oauth/v2/token','form':{'grant_type':_0x0c8a('0x18'),'client_id':_0x3b9a7c[_0x0c8a('0xe')],'client_secret':_0x3b9a7c['clientSecret'],'redirect_uri':_0x3b9a7c[_0x0c8a('0xd')],'code':_0x3b9a7c[_0x0c8a('0xf')]},'headers':{'Content-Type':_0x0c8a('0x28')}};return rp(_0x5732bc)['then'](function(_0x11c5d4){var _0xb9247f=JSON[_0x0c8a('0x1a')](_0x11c5d4);if(_0xb9247f[_0x0c8a('0x1b')]){_0x3b9a7c[_0x0c8a('0x1c')]=_0xb9247f[_0x0c8a('0x1b')];logger[_0x0c8a('0x1d')](util[_0x0c8a('0x1e')](_0x0c8a('0x1f'),_0x3b9a7c['name'],_0x3b9a7c['id']));}else{logger['error'](util[_0x0c8a('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3b9a7c[_0x0c8a('0x20')],_0x3b9a7c['id']),util[_0x0c8a('0x23')](_0xb9247f,{'showHidden':![],'depth':null}));}return _0x18a82e(null,_0x4e4238);})['catch'](function(_0x313610){logger[_0x0c8a('0x21')](util[_0x0c8a('0x1e')](_0x0c8a('0x22'),_0x3b9a7c[_0x0c8a('0x20')],_0x3b9a7c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x18a82e(_0x313610);});}else{return _0x18a82e(null,_0x4e4238);}}}});}; \ No newline at end of file +var _0x6f3e=['ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','clientId','clientSecret','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','https://accounts.zoho.com.au','then','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x110479,_0x492d7b){var _0x55335=function(_0xe4731b){while(--_0xe4731b){_0x110479['push'](_0x110479['shift']());}};_0x55335(++_0x492d7b);}(_0x6f3e,0x13d));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require(_0xe6f3('0x1'));var logger=require('../../config/logger')(_0xe6f3('0x2'));var moment=require(_0xe6f3('0x3'));var BPromise=require(_0xe6f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6f3('0x5'));var rimraf=require(_0xe6f3('0x6'));var config=require(_0xe6f3('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xe6f3('0x8'));module[_0xe6f3('0x9')]=function(_0x6b7c75,_0x3c70e8){return _0x6b7c75[_0xe6f3('0xa')](_0xe6f3('0xb'),attributes,{'tableName':_0xe6f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10bf24,_0x14369b,_0x49d278){if(_0x10bf24[_0xe6f3('0xd')](_0xe6f3('0xe'))||_0x10bf24[_0xe6f3('0xd')](_0xe6f3('0xf'))||_0x10bf24[_0xe6f3('0xd')]('clientId')||_0x10bf24[_0xe6f3('0xd')]('clientSecret')||_0x10bf24[_0xe6f3('0xd')](_0xe6f3('0x10'))||_0x10bf24[_0xe6f3('0xd')](_0xe6f3('0x11'))){var _0x1c6e0c,_0x22b85d;_0x1c6e0c=_0x10bf24[_0xe6f3('0xf')];var _0x4c7d7b=_0x1c6e0c[_0xe6f3('0x12')](-0x1);if(_0x4c7d7b==='/'||_0x4c7d7b==='\x5c'||_0x4c7d7b===':'){_0x1c6e0c=_0x1c6e0c[_0xe6f3('0x13')](0x0,_0x1c6e0c[_0xe6f3('0x14')](_0x4c7d7b));}switch(_0x10bf24[_0xe6f3('0xe')]){case'US':_0x22b85d=_0xe6f3('0x15');break;case'AU':_0x22b85d='https://accounts.zoho.com.au';break;case'IN':_0x22b85d='https://accounts.zoho.in';break;case'CN':_0x22b85d=_0xe6f3('0x16');break;default:_0x22b85d=_0xe6f3('0x17');break;}var _0x3bc106={'method':'POST','uri':_0x22b85d+'/oauth/v2/token','form':{'grant_type':_0xe6f3('0x18'),'client_id':_0x10bf24[_0xe6f3('0x19')],'client_secret':_0x10bf24[_0xe6f3('0x1a')],'redirect_uri':_0x10bf24['serverUrl'],'code':_0x10bf24[_0xe6f3('0x10')]},'headers':{'Content-Type':_0xe6f3('0x1b')}};return rp(_0x3bc106)['then'](function(_0x1ec986){var _0x413b26=JSON[_0xe6f3('0x1c')](_0x1ec986);if(_0x413b26['refresh_token']){_0x10bf24[_0xe6f3('0x1d')]=_0x413b26[_0xe6f3('0x1e')];logger[_0xe6f3('0x1f')](util['format'](_0xe6f3('0x20'),_0x10bf24[_0xe6f3('0x21')],_0x10bf24['id']));}else{logger[_0xe6f3('0x22')](util[_0xe6f3('0x23')](_0xe6f3('0x24'),_0x10bf24[_0xe6f3('0x21')],_0x10bf24['id']),util['inspect'](_0x413b26,{'showHidden':![],'depth':null}));}return _0x49d278(null,_0x14369b);})[_0xe6f3('0x25')](function(_0xdcada4){logger[_0xe6f3('0x22')](util['format'](_0xe6f3('0x24'),_0x10bf24[_0xe6f3('0x21')],_0x10bf24['id']),util[_0xe6f3('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x49d278(_0xdcada4);});}else{return _0x49d278(null,_0x14369b);}},'beforeUpdate':function(_0x4d1abc,_0x506b2d,_0x15ec44){if(_0x4d1abc[_0xe6f3('0xd')]('zone')||_0x4d1abc[_0xe6f3('0xd')](_0xe6f3('0xf'))||_0x4d1abc[_0xe6f3('0xd')](_0xe6f3('0x19'))||_0x4d1abc['changed'](_0xe6f3('0x1a'))||_0x4d1abc[_0xe6f3('0xd')](_0xe6f3('0x10'))||_0x4d1abc[_0xe6f3('0xd')](_0xe6f3('0x11'))){var _0xe133db,_0x887240;_0xe133db=_0x4d1abc[_0xe6f3('0xf')];var _0x239003=_0xe133db[_0xe6f3('0x12')](-0x1);if(_0x239003==='/'||_0x239003==='\x5c'||_0x239003===':'){_0xe133db=_0xe133db['substring'](0x0,_0xe133db[_0xe6f3('0x14')](_0x239003));}switch(_0x4d1abc[_0xe6f3('0xe')]){case'US':_0x887240=_0xe6f3('0x15');break;case'AU':_0x887240=_0xe6f3('0x27');break;case'IN':_0x887240='https://accounts.zoho.in';break;case'CN':_0x887240='https://accounts.zoho.com.cn';break;default:_0x887240=_0xe6f3('0x17');break;}var _0x374b21={'method':'POST','uri':_0x887240+'/oauth/v2/token','form':{'grant_type':_0xe6f3('0x18'),'client_id':_0x4d1abc[_0xe6f3('0x19')],'client_secret':_0x4d1abc[_0xe6f3('0x1a')],'redirect_uri':_0x4d1abc['serverUrl'],'code':_0x4d1abc['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x374b21)[_0xe6f3('0x28')](function(_0x3312e6){var _0x1b631c=JSON[_0xe6f3('0x1c')](_0x3312e6);if(_0x1b631c[_0xe6f3('0x1e')]){_0x4d1abc[_0xe6f3('0x1d')]=_0x1b631c[_0xe6f3('0x1e')];logger[_0xe6f3('0x1f')](util['format'](_0xe6f3('0x20'),_0x4d1abc[_0xe6f3('0x21')],_0x4d1abc['id']));}else{logger['error'](util[_0xe6f3('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4d1abc[_0xe6f3('0x21')],_0x4d1abc['id']),util[_0xe6f3('0x26')](_0x1b631c,{'showHidden':![],'depth':null}));}return _0x15ec44(null,_0x506b2d);})[_0xe6f3('0x25')](function(_0x2483bb){logger['error'](util['format'](_0xe6f3('0x24'),_0x4d1abc[_0xe6f3('0x21')],_0x4d1abc['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x15ec44(_0x2483bb);});}else{return _0x15ec44(null,_0x506b2d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bebe9cb..60c2536 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 _0xaebd=['GetZohoAccount','findAll','options','raw','attributes','include','map','model','debug','ShowZohoAccount','ZohoAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','catch'];(function(_0x2d4f98,_0x173ded){var _0x3b6084=function(_0x2e3f44){while(--_0x2e3f44){_0x2d4f98['push'](_0x2d4f98['shift']());}};_0x3b6084(++_0x173ded);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x2d41f6,_0x4ed75){_0x2d41f6=_0x2d41f6-0x0;var _0x5c07bd=_0xaebd[_0x2d41f6];return _0x5c07bd;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['ZohoAccount'][_0xdaeb('0x16')]({'raw':_0x1b5243['options']?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'where':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243['options']['where']||null:null,'attributes':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x19')]||null:null,'limit':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')]['limit']||null:null,'include':_0x1b5243['options']?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x1a')],function(_0x55c825){return{'model':db[_0x55c825[_0xdaeb('0x1c')]],'as':_0x55c825['as'],'attributes':_0x55c825['attributes'],'include':_0x55c825[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x55c825[_0xdaeb('0x1a')],function(_0x3b0770){return{'model':db[_0x3b0770[_0xdaeb('0x1c')]],'as':_0x3b0770['as'],'attributes':_0x3b0770['attributes'],'include':_0x3b0770[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x3b0770[_0xdaeb('0x1a')],function(_0x4eb719){return{'model':db[_0x4eb719['model']],'as':_0x4eb719['as'],'attributes':_0x4eb719[_0xdaeb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5045f8){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x1d')]('GetZohoAccount',_0x1b5243,JSON['stringify'](_0x5045f8));_0x2d8f11(_0x5045f8);})[_0xdaeb('0x14')](function(_0x440022){logger[_0xdaeb('0x11')]('GetZohoAccount',_0x440022[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e['error'](0x1f4,_0x440022['message']));});});};exports[_0xdaeb('0x1e')]=function(_0x21f6cf){var _0x2fb019=this;return new Promise(function(_0x28c15c,_0x3276c2){return db[_0xdaeb('0x1f')][_0xdaeb('0x20')]({'raw':_0x21f6cf['options']?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'where':_0x21f6cf[_0xdaeb('0x17')]?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x21')]||null:null,'attributes':_0x21f6cf['options']?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x19')]||null:null,'include':_0x21f6cf['options']?_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x21f6cf[_0xdaeb('0x17')][_0xdaeb('0x1a')],function(_0x1628b8){return{'model':db[_0x1628b8[_0xdaeb('0x1c')]],'as':_0x1628b8['as'],'attributes':_0x1628b8[_0xdaeb('0x19')],'include':_0x1628b8[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x1628b8['include'],function(_0x53b6c4){return{'model':db[_0x53b6c4[_0xdaeb('0x1c')]],'as':_0x53b6c4['as'],'attributes':_0x53b6c4['attributes'],'include':_0x53b6c4[_0xdaeb('0x1a')]?_[_0xdaeb('0x1b')](_0x53b6c4[_0xdaeb('0x1a')],function(_0x331624){return{'model':db[_0x331624[_0xdaeb('0x1c')]],'as':_0x331624['as'],'attributes':_0x331624[_0xdaeb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4dcb){logger[_0xdaeb('0xd')](_0xdaeb('0x1e'),_0x21f6cf);logger['debug'](_0xdaeb('0x1e'),_0x21f6cf,JSON[_0xdaeb('0x10')](_0x1f4dcb));_0x28c15c(_0x1f4dcb);})[_0xdaeb('0x14')](function(_0x104c90){logger[_0xdaeb('0x11')](_0xdaeb('0x1e'),_0x104c90[_0xdaeb('0x12')],_0x21f6cf);_0x3276c2(_0x2fb019['error'](0x1f4,_0x104c90[_0xdaeb('0x12')]));});});}; \ No newline at end of file +var _0xaf6e=['message','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','model','map','find','ShowZohoAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4f302c,_0x3608f5){var _0x247e69=function(_0x53b6cd){while(--_0x53b6cd){_0x4f302c['push'](_0x4f302c['shift']());}};_0x247e69(++_0x3608f5);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x2b84ac,_0x4e5e54){_0x2b84ac=_0x2b84ac-0x0;var _0x287ad2=_0xaf6e[_0x2b84ac];return _0x287ad2;};'use strict';var _=require(_0xeaf6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeaf6('0x1'));var rs=require(_0xeaf6('0x2'));var fs=require('fs');var Redis=require(_0xeaf6('0x3'));var db=require(_0xeaf6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeaf6('0x5'))(_0xeaf6('0x6'));var config=require(_0xeaf6('0x7'));var jayson=require(_0xeaf6('0x8'));var client=jayson[_0xeaf6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x595fc8,_0x4f82d1,_0xfa0e5d){return new BPromise(function(_0x4b55e6,_0x7655a5){return client['request'](_0x595fc8,_0xfa0e5d)[_0xeaf6('0xa')](function(_0x3d5ac7){logger[_0xeaf6('0xb')](_0xeaf6('0xc'),_0x4f82d1,_0xeaf6('0xd'));logger[_0xeaf6('0xe')](_0xeaf6('0xf'),_0x4f82d1,_0xeaf6('0xd'),JSON[_0xeaf6('0x10')](_0x3d5ac7));if(_0x3d5ac7[_0xeaf6('0x11')]){if(_0x3d5ac7[_0xeaf6('0x11')]['code']===0x1f4){logger[_0xeaf6('0x11')](_0xeaf6('0xc'),_0x4f82d1,_0x3d5ac7[_0xeaf6('0x11')][_0xeaf6('0x12')]);return _0x7655a5(_0x3d5ac7[_0xeaf6('0x11')][_0xeaf6('0x12')]);}logger[_0xeaf6('0x11')](_0xeaf6('0xc'),_0x4f82d1,_0x3d5ac7['error']['message']);return _0x4b55e6(_0x3d5ac7[_0xeaf6('0x11')][_0xeaf6('0x12')]);}else{logger[_0xeaf6('0xb')](_0xeaf6('0xc'),_0x4f82d1,_0xeaf6('0xd'));_0x4b55e6(_0x3d5ac7['result'][_0xeaf6('0x12')]);}})[_0xeaf6('0x13')](function(_0x382059){logger[_0xeaf6('0x11')](_0xeaf6('0xc'),_0x4f82d1,_0x382059);_0x7655a5(_0x382059);});});}exports[_0xeaf6('0x14')]=function(_0x3b3077){var _0x5cc9eb=this;return new Promise(function(_0xce8f00,_0x1c2ba9){return db[_0xeaf6('0x15')]['findAll']({'raw':_0x3b3077['options']?_0x3b3077[_0xeaf6('0x16')][_0xeaf6('0x17')]===undefined?!![]:![]:!![],'where':_0x3b3077[_0xeaf6('0x16')]?_0x3b3077[_0xeaf6('0x16')][_0xeaf6('0x18')]||null:null,'attributes':_0x3b3077[_0xeaf6('0x16')]?_0x3b3077[_0xeaf6('0x16')][_0xeaf6('0x19')]||null:null,'limit':_0x3b3077[_0xeaf6('0x16')]?_0x3b3077[_0xeaf6('0x16')][_0xeaf6('0x1a')]||null:null,'include':_0x3b3077[_0xeaf6('0x16')]?_0x3b3077[_0xeaf6('0x16')]['include']?_['map'](_0x3b3077['options'][_0xeaf6('0x1b')],function(_0x114f45){return{'model':db[_0x114f45[_0xeaf6('0x1c')]],'as':_0x114f45['as'],'attributes':_0x114f45[_0xeaf6('0x19')],'include':_0x114f45[_0xeaf6('0x1b')]?_[_0xeaf6('0x1d')](_0x114f45['include'],function(_0x2983b1){return{'model':db[_0x2983b1[_0xeaf6('0x1c')]],'as':_0x2983b1['as'],'attributes':_0x2983b1[_0xeaf6('0x19')],'include':_0x2983b1[_0xeaf6('0x1b')]?_['map'](_0x2983b1[_0xeaf6('0x1b')],function(_0x2e0713){return{'model':db[_0x2e0713['model']],'as':_0x2e0713['as'],'attributes':_0x2e0713[_0xeaf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeaf6('0xa')](function(_0x313ba3){logger[_0xeaf6('0xb')](_0xeaf6('0x14'),_0x3b3077);logger[_0xeaf6('0xe')](_0xeaf6('0x14'),_0x3b3077,JSON[_0xeaf6('0x10')](_0x313ba3));_0xce8f00(_0x313ba3);})[_0xeaf6('0x13')](function(_0x1cc040){logger[_0xeaf6('0x11')](_0xeaf6('0x14'),_0x1cc040[_0xeaf6('0x12')],_0x3b3077);_0x1c2ba9(_0x5cc9eb['error'](0x1f4,_0x1cc040[_0xeaf6('0x12')]));});});};exports['ShowZohoAccount']=function(_0x2efb28){var _0x5dc34a=this;return new Promise(function(_0x25902e,_0x5782f1){return db['ZohoAccount'][_0xeaf6('0x1e')]({'raw':_0x2efb28[_0xeaf6('0x16')]?_0x2efb28[_0xeaf6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2efb28['options']?_0x2efb28['options'][_0xeaf6('0x18')]||null:null,'attributes':_0x2efb28[_0xeaf6('0x16')]?_0x2efb28[_0xeaf6('0x16')][_0xeaf6('0x19')]||null:null,'include':_0x2efb28['options']?_0x2efb28[_0xeaf6('0x16')][_0xeaf6('0x1b')]?_[_0xeaf6('0x1d')](_0x2efb28[_0xeaf6('0x16')]['include'],function(_0x58d258){return{'model':db[_0x58d258['model']],'as':_0x58d258['as'],'attributes':_0x58d258[_0xeaf6('0x19')],'include':_0x58d258[_0xeaf6('0x1b')]?_[_0xeaf6('0x1d')](_0x58d258[_0xeaf6('0x1b')],function(_0x4b7014){return{'model':db[_0x4b7014[_0xeaf6('0x1c')]],'as':_0x4b7014['as'],'attributes':_0x4b7014[_0xeaf6('0x19')],'include':_0x4b7014[_0xeaf6('0x1b')]?_['map'](_0x4b7014[_0xeaf6('0x1b')],function(_0xab8645){return{'model':db[_0xab8645[_0xeaf6('0x1c')]],'as':_0xab8645['as'],'attributes':_0xab8645[_0xeaf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeaf6('0xa')](function(_0x44d2f1){logger[_0xeaf6('0xb')](_0xeaf6('0x1f'),_0x2efb28);logger[_0xeaf6('0xe')]('ShowZohoAccount',_0x2efb28,JSON[_0xeaf6('0x10')](_0x44d2f1));_0x25902e(_0x44d2f1);})['catch'](function(_0x17ffbc){logger['error'](_0xeaf6('0x1f'),_0x17ffbc[_0xeaf6('0x12')],_0x2efb28);_0x5782f1(_0x5dc34a[_0xeaf6('0x11')](0x1f4,_0x17ffbc['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index de2a3c4..cd965f9 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 _0x6349=['index','/:id/fields','/:id/subjects','getSubjects','getDescriptions','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0x5d49ca,_0x43fcb2){var _0x53e0c9=function(_0x16867d){while(--_0x16867d){_0x5d49ca['push'](_0x5d49ca['shift']());}};_0x53e0c9(++_0x43fcb2);}(_0x6349,0x132));var _0x9634=function(_0x25a73c,_0x160d0f){_0x25a73c=_0x25a73c-0x0;var _0x2dcbc2=_0x6349[_0x25a73c];return _0x2dcbc2;};'use strict';var multer=require('multer');var util=require(_0x9634('0x0'));var path=require('path');var timeout=require(_0x9634('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9634('0x2'));var auth=require(_0x9634('0x3'));var interaction=require(_0x9634('0x4'));var config=require(_0x9634('0x5'));var controller=require(_0x9634('0x6'));router[_0x9634('0x7')]('/',auth[_0x9634('0x8')](),controller[_0x9634('0x9')]);router[_0x9634('0x7')]('/:id',auth[_0x9634('0x8')](),controller['show']);router['get'](_0x9634('0xa'),auth[_0x9634('0x8')](),controller['getFields']);router[_0x9634('0x7')](_0x9634('0xb'),auth[_0x9634('0x8')](),controller[_0x9634('0xc')]);router['get']('/:id/descriptions',auth[_0x9634('0x8')](),controller[_0x9634('0xd')]);router['post']('/',auth[_0x9634('0x8')](),controller[_0x9634('0xe')]);router[_0x9634('0xf')](_0x9634('0x10'),auth[_0x9634('0x8')](),controller[_0x9634('0x11')]);router[_0x9634('0x12')](_0x9634('0x10'),auth[_0x9634('0x8')](),controller[_0x9634('0x13')]);module[_0x9634('0x14')]=router; \ No newline at end of file +var _0xad47=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad47,0xd2));var _0x7ad4=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xad47[_0x44946b];return _0x249bc4;};'use strict';var multer=require(_0x7ad4('0x0'));var util=require(_0x7ad4('0x1'));var path=require(_0x7ad4('0x2'));var timeout=require(_0x7ad4('0x3'));var express=require(_0x7ad4('0x4'));var router=express[_0x7ad4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7ad4('0x6'));var interaction=require(_0x7ad4('0x7'));var config=require(_0x7ad4('0x8'));var controller=require(_0x7ad4('0x9'));router['get']('/',auth[_0x7ad4('0xa')](),controller[_0x7ad4('0xb')]);router[_0x7ad4('0xc')]('/:id',auth[_0x7ad4('0xa')](),controller['show']);router['get'](_0x7ad4('0xd'),auth[_0x7ad4('0xa')](),controller[_0x7ad4('0xe')]);router[_0x7ad4('0xc')]('/:id/subjects',auth[_0x7ad4('0xa')](),controller[_0x7ad4('0xf')]);router[_0x7ad4('0xc')](_0x7ad4('0x10'),auth[_0x7ad4('0xa')](),controller[_0x7ad4('0x11')]);router[_0x7ad4('0x12')]('/',auth[_0x7ad4('0xa')](),controller[_0x7ad4('0x13')]);router[_0x7ad4('0x14')]('/:id',auth[_0x7ad4('0xa')](),controller['update']);router[_0x7ad4('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x7ad4('0x16')]);module[_0x7ad4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 0cb9982..727ece0 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 _0x3da6=['sequelize','STRING','ENUM','contact','lead','contact_lead'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3da6,0x17a));var _0x63da=function(_0x39131d,_0xa5a6bf){_0x39131d=_0x39131d-0x0;var _0x48498e=_0x3da6[_0x39131d];return _0x48498e;};'use strict';var Sequelize=require(_0x63da('0x0'));module['exports']={'name':{'type':Sequelize[_0x63da('0x1')]},'moduleCreate':{'type':Sequelize[_0x63da('0x2')]('lead',_0x63da('0x3'),'nothing'),'defaultValue':_0x63da('0x4')},'moduleSearch':{'type':Sequelize[_0x63da('0x2')]('contact_lead','contact',_0x63da('0x4')),'defaultValue':_0x63da('0x5')},'description':{'type':Sequelize[_0x63da('0x1')]}}; \ No newline at end of file +var _0x6f7f=['lead','contact','contact_lead','exports','STRING','ENUM'];(function(_0x1976b7,_0xea718a){var _0x2ad878=function(_0x34412a){while(--_0x34412a){_0x1976b7['push'](_0x1976b7['shift']());}};_0x2ad878(++_0xea718a);}(_0x6f7f,0x177));var _0xf6f7=function(_0x17d600,_0x144457){_0x17d600=_0x17d600-0x0;var _0x12101e=_0x6f7f[_0x17d600];return _0x12101e;};'use strict';var Sequelize=require('sequelize');module[_0xf6f7('0x0')]={'name':{'type':Sequelize[_0xf6f7('0x1')]},'moduleCreate':{'type':Sequelize[_0xf6f7('0x2')](_0xf6f7('0x3'),_0xf6f7('0x4'),'nothing'),'defaultValue':_0xf6f7('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf6f7('0x5'),_0xf6f7('0x4'),_0xf6f7('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xf6f7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index cd8b57f..9953237 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 _0xb80d=['pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','length','includeAll','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1f8a19,_0x4c8826){var _0x4a594d=function(_0x4269e0){while(--_0x4269e0){_0x1f8a19['push'](_0x1f8a19['shift']());}};_0x4a594d(++_0x4c8826);}(_0xb80d,0x14f));var _0xdb80=function(_0x91f539,_0x442a0c){_0x91f539=_0x91f539-0x0;var _0x2e3bdd=_0xb80d[_0x91f539];return _0x2e3bdd;};'use strict';var emlformat=require(_0xdb80('0x0'));var rimraf=require(_0xdb80('0x1'));var zipdir=require(_0xdb80('0x2'));var jsonpatch=require(_0xdb80('0x3'));var rp=require(_0xdb80('0x4'));var moment=require(_0xdb80('0x5'));var BPromise=require(_0xdb80('0x6'));var Mustache=require('mustache');var util=require(_0xdb80('0x7'));var path=require(_0xdb80('0x8'));var sox=require(_0xdb80('0x9'));var csv=require(_0xdb80('0xa'));var ejs=require(_0xdb80('0xb'));var fs=require('fs');var fs_extra=require(_0xdb80('0xc'));var _=require(_0xdb80('0xd'));var squel=require('squel');var crypto=require(_0xdb80('0xe'));var jsforce=require(_0xdb80('0xf'));var deskjs=require(_0xdb80('0x10'));var toCsv=require(_0xdb80('0xa'));var querystring=require(_0xdb80('0x11'));var Papa=require(_0xdb80('0x12'));var Redis=require(_0xdb80('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb80('0x14'));var hardwareService=require(_0xdb80('0x15'));var logger=require('../../config/logger')(_0xdb80('0x16'));var utils=require(_0xdb80('0x17'));var config=require(_0xdb80('0x18'));var licenseUtil=require(_0xdb80('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ed04e,_0x430946){_0x430946=_0x430946||0xcc;return function(_0x4020af){if(_0x4020af){return _0x6ed04e[_0xdb80('0x1a')](_0x430946);}return _0x6ed04e[_0xdb80('0x1b')](_0x430946)[_0xdb80('0x1c')]();};}function respondWithResult(_0x55bfd8,_0x15918f){_0x15918f=_0x15918f||0xc8;return function(_0x4af120){if(_0x4af120){return _0x55bfd8['status'](_0x15918f)[_0xdb80('0x1d')](_0x4af120);}};}function respondWithFilteredResult(_0xfbcb23,_0x4d9b00){return function(_0x30f7e6){if(_0x30f7e6){var _0x310813=typeof _0x4d9b00[_0xdb80('0x1e')]===_0xdb80('0x1f')&&typeof _0x4d9b00[_0xdb80('0x20')]===_0xdb80('0x1f');var _0x469b12=_0x30f7e6[_0xdb80('0x21')];var _0x4b19b9=_0x310813?0x0:_0x4d9b00[_0xdb80('0x1e')];var _0x11b050=_0x310813?_0x30f7e6[_0xdb80('0x21')]:_0x4d9b00['offset']+_0x4d9b00[_0xdb80('0x20')];var _0x7f504c;if(_0x11b050>=_0x469b12){_0x11b050=_0x469b12;_0x7f504c=0xc8;}else{_0x7f504c=0xce;}_0xfbcb23[_0xdb80('0x1b')](_0x7f504c);return _0xfbcb23[_0xdb80('0x22')](_0xdb80('0x23'),_0x4b19b9+'-'+_0x11b050+'/'+_0x469b12)[_0xdb80('0x1d')](_0x30f7e6);}return null;};}function patchUpdates(_0x37e7b8){return function(_0x36494d){try{jsonpatch['apply'](_0x36494d,_0x37e7b8,!![]);}catch(_0x53665a){return BPromise[_0xdb80('0x24')](_0x53665a);}return _0x36494d[_0xdb80('0x25')]();};}function saveUpdates(_0x8fb0af,_0x3f0f9b){return function(_0x1c7928){if(_0x1c7928){return _0x1c7928[_0xdb80('0x26')](_0x8fb0af)[_0xdb80('0x27')](function(_0x50d0e1){return _0x50d0e1;});}return null;};}function removeEntity(_0x12e732,_0x19c579){return function(_0x5e0f2c){if(_0x5e0f2c){return _0x5e0f2c['destroy']()['then'](function(){_0x12e732['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23b62e,_0x1fe41d){return function(_0xc72692){if(!_0xc72692){_0x23b62e[_0xdb80('0x1a')](0x194);}return _0xc72692;};}function handleError(_0x48a318,_0x27ef0e){_0x27ef0e=_0x27ef0e||0x1f4;return function(_0x1c9fbb){logger['error'](_0x1c9fbb['stack']);if(_0x1c9fbb['name']){delete _0x1c9fbb[_0xdb80('0x28')];}_0x48a318[_0xdb80('0x1b')](_0x27ef0e)['send'](_0x1c9fbb);};}exports[_0xdb80('0x29')]=function(_0x50c766,_0x1533e0){var _0x3db988={},_0x19b9b6={},_0x508164={'count':0x0,'rows':[]};var _0xdd2cb0=_['map'](db[_0xdb80('0x2a')][_0xdb80('0x2b')],function(_0x4bf089){return{'name':_0x4bf089[_0xdb80('0x2c')],'type':_0x4bf089[_0xdb80('0x2d')][_0xdb80('0x2e')]};});_0x19b9b6[_0xdb80('0x2f')]=_[_0xdb80('0x30')](_0xdd2cb0,_0xdb80('0x28'));_0x19b9b6['query']=_[_0xdb80('0x31')](_0x50c766[_0xdb80('0x32')]);_0x19b9b6[_0xdb80('0x33')]=_['intersection'](_0x19b9b6[_0xdb80('0x2f')],_0x19b9b6['query']);_0x3db988[_0xdb80('0x34')]=_[_0xdb80('0x35')](_0x19b9b6[_0xdb80('0x2f')],qs[_0xdb80('0x36')](_0x50c766[_0xdb80('0x32')]['fields']));_0x3db988[_0xdb80('0x34')]=_0x3db988['attributes']['length']?_0x3db988[_0xdb80('0x34')]:_0x19b9b6[_0xdb80('0x2f')];if(!_0x50c766[_0xdb80('0x32')][_0xdb80('0x37')](_0xdb80('0x38'))){_0x3db988[_0xdb80('0x20')]=qs[_0xdb80('0x20')](_0x50c766[_0xdb80('0x32')]['limit']);_0x3db988['offset']=qs[_0xdb80('0x1e')](_0x50c766[_0xdb80('0x32')][_0xdb80('0x1e')]);}_0x3db988[_0xdb80('0x39')]=qs[_0xdb80('0x3a')](_0x50c766[_0xdb80('0x32')][_0xdb80('0x3a')]);_0x3db988[_0xdb80('0x3b')]=qs[_0xdb80('0x33')](_[_0xdb80('0x3c')](_0x50c766['query'],_0x19b9b6[_0xdb80('0x33')]),_0xdd2cb0);if(_0x50c766[_0xdb80('0x32')][_0xdb80('0x3d')]){_0x3db988['where']=_['merge'](_0x3db988[_0xdb80('0x3b')],{'$or':_[_0xdb80('0x30')](_0xdd2cb0,function(_0xe08b28){if(_0xe08b28[_0xdb80('0x2d')]!==_0xdb80('0x3e')){var _0x3f580d={};_0x3f580d[_0xe08b28[_0xdb80('0x28')]]={'$like':'%'+_0x50c766[_0xdb80('0x32')][_0xdb80('0x3d')]+'%'};return _0x3f580d;}})});}_0x3db988=_[_0xdb80('0x3f')]({},_0x3db988,_0x50c766[_0xdb80('0x40')]);var _0x29f80c={'where':_0x3db988[_0xdb80('0x3b')]};return db[_0xdb80('0x2a')]['count'](_0x29f80c)[_0xdb80('0x27')](function(_0x5e5361){_0x508164[_0xdb80('0x21')]=_0x5e5361;if(_0x50c766['query']['includeAll']){_0x3db988[_0xdb80('0x41')]=[{'all':!![]}];}return db[_0xdb80('0x2a')]['findAll'](_0x3db988);})[_0xdb80('0x27')](function(_0x449657){_0x508164[_0xdb80('0x42')]=_0x449657;return _0x508164;})[_0xdb80('0x27')](respondWithFilteredResult(_0x1533e0,_0x3db988))[_0xdb80('0x43')](handleError(_0x1533e0,null));};exports[_0xdb80('0x44')]=function(_0x231f82,_0x389a5f){var _0x13d737={'raw':![],'where':{'id':_0x231f82[_0xdb80('0x45')]['id']}},_0x11a4ad={};_0x11a4ad[_0xdb80('0x2f')]=_[_0xdb80('0x31')](db[_0xdb80('0x2a')]['rawAttributes']);_0x11a4ad[_0xdb80('0x32')]=_[_0xdb80('0x31')](_0x231f82[_0xdb80('0x32')]);_0x11a4ad[_0xdb80('0x33')]=_[_0xdb80('0x35')](_0x11a4ad[_0xdb80('0x2f')],_0x11a4ad[_0xdb80('0x32')]);_0x13d737['attributes']=_[_0xdb80('0x35')](_0x11a4ad[_0xdb80('0x2f')],qs[_0xdb80('0x36')](_0x231f82[_0xdb80('0x32')]['fields']));_0x13d737[_0xdb80('0x34')]=_0x13d737[_0xdb80('0x34')][_0xdb80('0x46')]?_0x13d737[_0xdb80('0x34')]:_0x11a4ad['model'];if(_0x231f82['query'][_0xdb80('0x47')]){_0x13d737[_0xdb80('0x41')]=[{'all':!![]}];}_0x13d737=_[_0xdb80('0x3f')]({},_0x13d737,_0x231f82[_0xdb80('0x40')]);return db['ZohoConfiguration']['find'](_0x13d737)[_0xdb80('0x27')](handleEntityNotFound(_0x389a5f,null))[_0xdb80('0x27')](respondWithResult(_0x389a5f,null))['catch'](handleError(_0x389a5f,null));};exports[_0xdb80('0x48')]=function(_0x2c7586,_0x469af9){return db['ZohoConfiguration'][_0xdb80('0x48')](_0x2c7586[_0xdb80('0x49')],{})[_0xdb80('0x27')](respondWithResult(_0x469af9,0xc9))[_0xdb80('0x43')](handleError(_0x469af9,null));};exports[_0xdb80('0x26')]=function(_0x126b37,_0x512505){if(_0x126b37[_0xdb80('0x49')]['id']){delete _0x126b37[_0xdb80('0x49')]['id'];}return db[_0xdb80('0x2a')]['find']({'where':{'id':_0x126b37[_0xdb80('0x45')]['id']}})[_0xdb80('0x27')](handleEntityNotFound(_0x512505,null))[_0xdb80('0x27')](saveUpdates(_0x126b37[_0xdb80('0x49')],null))[_0xdb80('0x27')](respondWithResult(_0x512505,null))[_0xdb80('0x43')](handleError(_0x512505,null));};exports['destroy']=function(_0x46639f,_0x4a7b0f){return db['ZohoConfiguration']['find']({'where':{'id':_0x46639f[_0xdb80('0x45')]['id']}})[_0xdb80('0x27')](handleEntityNotFound(_0x4a7b0f,null))[_0xdb80('0x27')](removeEntity(_0x4a7b0f,null))[_0xdb80('0x43')](handleError(_0x4a7b0f,null));};exports[_0xdb80('0x4a')]=function(_0x383bfc,_0x9602f1,_0x2381b2){var _0x3730a5={};var _0x1fa977={};var _0x5383b2;var _0x189f4a;return db[_0xdb80('0x2a')][_0xdb80('0x4b')]({'where':{'id':_0x383bfc[_0xdb80('0x45')]['id']}})['then'](handleEntityNotFound(_0x9602f1,null))[_0xdb80('0x27')](function(_0x4c70b4){if(_0x4c70b4){_0x5383b2=_0x4c70b4;_0x1fa977[_0xdb80('0x2f')]=_['keys'](db[_0xdb80('0x4c')]['rawAttributes']);_0x1fa977[_0xdb80('0x32')]=_[_0xdb80('0x31')](_0x383bfc['query']);_0x1fa977[_0xdb80('0x33')]=_['intersection'](_0x1fa977['model'],_0x1fa977['query']);_0x3730a5[_0xdb80('0x34')]=_[_0xdb80('0x35')](_0x1fa977[_0xdb80('0x2f')],qs['fields'](_0x383bfc[_0xdb80('0x32')][_0xdb80('0x36')]));_0x3730a5[_0xdb80('0x34')]=_0x3730a5[_0xdb80('0x34')][_0xdb80('0x46')]?_0x3730a5['attributes']:_0x1fa977[_0xdb80('0x2f')];_0x3730a5[_0xdb80('0x39')]=qs[_0xdb80('0x3a')](_0x383bfc['query'][_0xdb80('0x3a')]);_0x3730a5['where']=qs[_0xdb80('0x33')](_[_0xdb80('0x3c')](_0x383bfc['query'],_0x1fa977[_0xdb80('0x33')]));if(_0x383bfc[_0xdb80('0x32')]['filter']){_0x3730a5[_0xdb80('0x3b')]=_[_0xdb80('0x3f')](_0x3730a5[_0xdb80('0x3b')],{'$or':_[_0xdb80('0x30')](_0x3730a5['attributes'],function(_0xaaed8d){var _0x1bc7d5={};_0x1bc7d5[_0xaaed8d]={'$like':'%'+_0x383bfc['query']['filter']+'%'};return _0x1bc7d5;})});}_0x3730a5=_[_0xdb80('0x3f')]({},_0x3730a5,_0x383bfc[_0xdb80('0x40')]);return _0x5383b2[_0xdb80('0x4a')](_0x3730a5);}})[_0xdb80('0x27')](function(_0x37bf00){if(_0x37bf00){_0x189f4a=_0x37bf00[_0xdb80('0x46')];if(!_0x383bfc['query'][_0xdb80('0x37')]('nolimit')){_0x3730a5[_0xdb80('0x20')]=qs['limit'](_0x383bfc['query'][_0xdb80('0x20')]);_0x3730a5[_0xdb80('0x1e')]=qs[_0xdb80('0x1e')](_0x383bfc[_0xdb80('0x32')]['offset']);}return _0x5383b2[_0xdb80('0x4a')](_0x3730a5);}})[_0xdb80('0x27')](function(_0x55d68f){if(_0x55d68f){return _0x55d68f?{'count':_0x189f4a,'rows':_0x55d68f}:null;}})[_0xdb80('0x27')](respondWithResult(_0x9602f1,null))[_0xdb80('0x43')](handleError(_0x9602f1,null));};exports['getSubjects']=function(_0x477b0f,_0x546edd,_0x510caa){var _0x59cb1b={};var _0x264100={};var _0x327e07;var _0x216789;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x477b0f[_0xdb80('0x45')]['id']}})[_0xdb80('0x27')](handleEntityNotFound(_0x546edd,null))[_0xdb80('0x27')](function(_0x3c6a3e){if(_0x3c6a3e){_0x327e07=_0x3c6a3e;_0x264100['model']=_['keys'](db['ZohoField'][_0xdb80('0x2b')]);_0x264100['query']=_[_0xdb80('0x31')](_0x477b0f[_0xdb80('0x32')]);_0x264100[_0xdb80('0x33')]=_[_0xdb80('0x35')](_0x264100['model'],_0x264100[_0xdb80('0x32')]);_0x59cb1b[_0xdb80('0x34')]=_[_0xdb80('0x35')](_0x264100[_0xdb80('0x2f')],qs[_0xdb80('0x36')](_0x477b0f[_0xdb80('0x32')][_0xdb80('0x36')]));_0x59cb1b['attributes']=_0x59cb1b['attributes'][_0xdb80('0x46')]?_0x59cb1b[_0xdb80('0x34')]:_0x264100['model'];_0x59cb1b[_0xdb80('0x39')]=qs[_0xdb80('0x3a')](_0x477b0f[_0xdb80('0x32')]['sort']);_0x59cb1b[_0xdb80('0x3b')]=qs[_0xdb80('0x33')](_[_0xdb80('0x3c')](_0x477b0f['query'],_0x264100[_0xdb80('0x33')]));if(_0x477b0f[_0xdb80('0x32')][_0xdb80('0x3d')]){_0x59cb1b[_0xdb80('0x3b')]=_[_0xdb80('0x3f')](_0x59cb1b[_0xdb80('0x3b')],{'$or':_['map'](_0x59cb1b['attributes'],function(_0x127cf3){var _0x292a82={};_0x292a82[_0x127cf3]={'$like':'%'+_0x477b0f[_0xdb80('0x32')]['filter']+'%'};return _0x292a82;})});}_0x59cb1b=_[_0xdb80('0x3f')]({},_0x59cb1b,_0x477b0f[_0xdb80('0x40')]);return _0x327e07[_0xdb80('0x4d')](_0x59cb1b);}})[_0xdb80('0x27')](function(_0x384a3e){if(_0x384a3e){_0x216789=_0x384a3e[_0xdb80('0x46')];if(!_0x477b0f['query'][_0xdb80('0x37')]('nolimit')){_0x59cb1b[_0xdb80('0x20')]=qs[_0xdb80('0x20')](_0x477b0f[_0xdb80('0x32')][_0xdb80('0x20')]);_0x59cb1b[_0xdb80('0x1e')]=qs[_0xdb80('0x1e')](_0x477b0f['query'][_0xdb80('0x1e')]);}return _0x327e07[_0xdb80('0x4d')](_0x59cb1b);}})[_0xdb80('0x27')](function(_0x1dd00e){if(_0x1dd00e){return _0x1dd00e?{'count':_0x216789,'rows':_0x1dd00e}:null;}})[_0xdb80('0x27')](respondWithResult(_0x546edd,null))[_0xdb80('0x43')](handleError(_0x546edd,null));};exports[_0xdb80('0x4e')]=function(_0x46d758,_0x261fc2,_0x5838cd){var _0x1613c8={};var _0x274d34={};var _0x4ee384;var _0x1fab5b;return db[_0xdb80('0x2a')]['findOne']({'where':{'id':_0x46d758['params']['id']}})['then'](handleEntityNotFound(_0x261fc2,null))['then'](function(_0x5a1d32){if(_0x5a1d32){_0x4ee384=_0x5a1d32;_0x274d34['model']=_[_0xdb80('0x31')](db['ZohoField'][_0xdb80('0x2b')]);_0x274d34[_0xdb80('0x32')]=_[_0xdb80('0x31')](_0x46d758[_0xdb80('0x32')]);_0x274d34[_0xdb80('0x33')]=_[_0xdb80('0x35')](_0x274d34['model'],_0x274d34[_0xdb80('0x32')]);_0x1613c8[_0xdb80('0x34')]=_[_0xdb80('0x35')](_0x274d34[_0xdb80('0x2f')],qs[_0xdb80('0x36')](_0x46d758['query'][_0xdb80('0x36')]));_0x1613c8[_0xdb80('0x34')]=_0x1613c8['attributes'][_0xdb80('0x46')]?_0x1613c8['attributes']:_0x274d34[_0xdb80('0x2f')];_0x1613c8[_0xdb80('0x39')]=qs[_0xdb80('0x3a')](_0x46d758[_0xdb80('0x32')][_0xdb80('0x3a')]);_0x1613c8[_0xdb80('0x3b')]=qs[_0xdb80('0x33')](_[_0xdb80('0x3c')](_0x46d758['query'],_0x274d34[_0xdb80('0x33')]));if(_0x46d758[_0xdb80('0x32')][_0xdb80('0x3d')]){_0x1613c8[_0xdb80('0x3b')]=_[_0xdb80('0x3f')](_0x1613c8[_0xdb80('0x3b')],{'$or':_[_0xdb80('0x30')](_0x1613c8['attributes'],function(_0x5aa1d6){var _0x5ce3da={};_0x5ce3da[_0x5aa1d6]={'$like':'%'+_0x46d758['query'][_0xdb80('0x3d')]+'%'};return _0x5ce3da;})});}_0x1613c8=_[_0xdb80('0x3f')]({},_0x1613c8,_0x46d758[_0xdb80('0x40')]);return _0x4ee384[_0xdb80('0x4e')](_0x1613c8);}})[_0xdb80('0x27')](function(_0x41963f){if(_0x41963f){_0x1fab5b=_0x41963f[_0xdb80('0x46')];if(!_0x46d758[_0xdb80('0x32')][_0xdb80('0x37')](_0xdb80('0x38'))){_0x1613c8[_0xdb80('0x20')]=qs['limit'](_0x46d758[_0xdb80('0x32')][_0xdb80('0x20')]);_0x1613c8[_0xdb80('0x1e')]=qs[_0xdb80('0x1e')](_0x46d758['query'][_0xdb80('0x1e')]);}return _0x4ee384[_0xdb80('0x4e')](_0x1613c8);}})[_0xdb80('0x27')](function(_0x1375e8){if(_0x1375e8){return _0x1375e8?{'count':_0x1fab5b,'rows':_0x1375e8}:null;}})[_0xdb80('0x27')](respondWithResult(_0x261fc2,null))[_0xdb80('0x43')](handleError(_0x261fc2,null));}; \ No newline at end of file +var _0x26e6=['json','offset','undefined','count','limit','status','set','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZohoConfiguration','findAll','rows','catch','show','params','create','body','find','getFields','findOne','ZohoField','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x26e6,0x130));var _0x626e=function(_0x3c3e72,_0x3e1858){_0x3c3e72=_0x3c3e72-0x0;var _0x48a7e5=_0x26e6[_0x3c3e72];return _0x48a7e5;};'use strict';var emlformat=require(_0x626e('0x0'));var rimraf=require(_0x626e('0x1'));var zipdir=require(_0x626e('0x2'));var jsonpatch=require(_0x626e('0x3'));var rp=require(_0x626e('0x4'));var moment=require(_0x626e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x626e('0x6'));var util=require('util');var path=require(_0x626e('0x7'));var sox=require(_0x626e('0x8'));var csv=require(_0x626e('0x9'));var ejs=require(_0x626e('0xa'));var fs=require('fs');var fs_extra=require(_0x626e('0xb'));var _=require(_0x626e('0xc'));var squel=require(_0x626e('0xd'));var crypto=require(_0x626e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x626e('0xf'));var toCsv=require(_0x626e('0x9'));var querystring=require('querystring');var Papa=require(_0x626e('0x10'));var Redis=require(_0x626e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x626e('0x12'));var as=require(_0x626e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x626e('0x14'))(_0x626e('0x15'));var utils=require(_0x626e('0x16'));var config=require(_0x626e('0x17'));var licenseUtil=require(_0x626e('0x18'));var db=require(_0x626e('0x19'))['db'];function respondWithStatusCode(_0x5c03b5,_0xb94669){_0xb94669=_0xb94669||0xcc;return function(_0x578d67){if(_0x578d67){return _0x5c03b5[_0x626e('0x1a')](_0xb94669);}return _0x5c03b5['status'](_0xb94669)[_0x626e('0x1b')]();};}function respondWithResult(_0x28f740,_0x4fba84){_0x4fba84=_0x4fba84||0xc8;return function(_0x47b58b){if(_0x47b58b){return _0x28f740['status'](_0x4fba84)[_0x626e('0x1c')](_0x47b58b);}};}function respondWithFilteredResult(_0x174442,_0x17d9f0){return function(_0x11206a){if(_0x11206a){var _0x5cb555=typeof _0x17d9f0[_0x626e('0x1d')]===_0x626e('0x1e')&&typeof _0x17d9f0['limit']===_0x626e('0x1e');var _0x44b291=_0x11206a['count'];var _0x18dc86=_0x5cb555?0x0:_0x17d9f0['offset'];var _0x17039a=_0x5cb555?_0x11206a[_0x626e('0x1f')]:_0x17d9f0[_0x626e('0x1d')]+_0x17d9f0[_0x626e('0x20')];var _0x1fe3c4;if(_0x17039a>=_0x44b291){_0x17039a=_0x44b291;_0x1fe3c4=0xc8;}else{_0x1fe3c4=0xce;}_0x174442[_0x626e('0x21')](_0x1fe3c4);return _0x174442[_0x626e('0x22')]('Content-Range',_0x18dc86+'-'+_0x17039a+'/'+_0x44b291)[_0x626e('0x1c')](_0x11206a);}return null;};}function patchUpdates(_0x8d1775){return function(_0x2c4b0e){try{jsonpatch[_0x626e('0x23')](_0x2c4b0e,_0x8d1775,!![]);}catch(_0x4504c1){return BPromise['reject'](_0x4504c1);}return _0x2c4b0e[_0x626e('0x24')]();};}function saveUpdates(_0xe5dd67,_0x3e00a5){return function(_0x3eb0c9){if(_0x3eb0c9){return _0x3eb0c9[_0x626e('0x25')](_0xe5dd67)[_0x626e('0x26')](function(_0x2d2af4){return _0x2d2af4;});}return null;};}function removeEntity(_0x3be1ff,_0x118c74){return function(_0x5db59b){if(_0x5db59b){return _0x5db59b[_0x626e('0x27')]()[_0x626e('0x26')](function(){_0x3be1ff[_0x626e('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c7bb,_0x1478ce){return function(_0x12cca7){if(!_0x12cca7){_0x27c7bb[_0x626e('0x1a')](0x194);}return _0x12cca7;};}function handleError(_0x5b7a77,_0x58c544){_0x58c544=_0x58c544||0x1f4;return function(_0x321e86){logger[_0x626e('0x28')](_0x321e86[_0x626e('0x29')]);if(_0x321e86[_0x626e('0x2a')]){delete _0x321e86[_0x626e('0x2a')];}_0x5b7a77['status'](_0x58c544)[_0x626e('0x2b')](_0x321e86);};}exports[_0x626e('0x2c')]=function(_0x2301e2,_0x544a4b){var _0x320a91={},_0x3a9245={},_0x2be8e2={'count':0x0,'rows':[]};var _0xfa6632=_[_0x626e('0x2d')](db['ZohoConfiguration'][_0x626e('0x2e')],function(_0x23ecaf){return{'name':_0x23ecaf['fieldName'],'type':_0x23ecaf[_0x626e('0x2f')][_0x626e('0x30')]};});_0x3a9245[_0x626e('0x31')]=_[_0x626e('0x2d')](_0xfa6632,'name');_0x3a9245[_0x626e('0x32')]=_[_0x626e('0x33')](_0x2301e2['query']);_0x3a9245[_0x626e('0x34')]=_[_0x626e('0x35')](_0x3a9245[_0x626e('0x31')],_0x3a9245[_0x626e('0x32')]);_0x320a91[_0x626e('0x36')]=_['intersection'](_0x3a9245[_0x626e('0x31')],qs[_0x626e('0x37')](_0x2301e2[_0x626e('0x32')][_0x626e('0x37')]));_0x320a91[_0x626e('0x36')]=_0x320a91[_0x626e('0x36')][_0x626e('0x38')]?_0x320a91[_0x626e('0x36')]:_0x3a9245[_0x626e('0x31')];if(!_0x2301e2[_0x626e('0x32')][_0x626e('0x39')](_0x626e('0x3a'))){_0x320a91['limit']=qs['limit'](_0x2301e2[_0x626e('0x32')]['limit']);_0x320a91[_0x626e('0x1d')]=qs[_0x626e('0x1d')](_0x2301e2[_0x626e('0x32')]['offset']);}_0x320a91['order']=qs['sort'](_0x2301e2['query'][_0x626e('0x3b')]);_0x320a91[_0x626e('0x3c')]=qs[_0x626e('0x34')](_[_0x626e('0x3d')](_0x2301e2['query'],_0x3a9245[_0x626e('0x34')]),_0xfa6632);if(_0x2301e2[_0x626e('0x32')][_0x626e('0x3e')]){_0x320a91[_0x626e('0x3c')]=_[_0x626e('0x3f')](_0x320a91[_0x626e('0x3c')],{'$or':_[_0x626e('0x2d')](_0xfa6632,function(_0xd627cc){if(_0xd627cc[_0x626e('0x2f')]!==_0x626e('0x40')){var _0x5b3b7e={};_0x5b3b7e[_0xd627cc[_0x626e('0x2a')]]={'$like':'%'+_0x2301e2['query'][_0x626e('0x3e')]+'%'};return _0x5b3b7e;}})});}_0x320a91=_['merge']({},_0x320a91,_0x2301e2[_0x626e('0x41')]);var _0x555696={'where':_0x320a91[_0x626e('0x3c')]};return db['ZohoConfiguration'][_0x626e('0x1f')](_0x555696)[_0x626e('0x26')](function(_0x40f0c2){_0x2be8e2[_0x626e('0x1f')]=_0x40f0c2;if(_0x2301e2['query'][_0x626e('0x42')]){_0x320a91[_0x626e('0x43')]=[{'all':!![]}];}return db[_0x626e('0x44')][_0x626e('0x45')](_0x320a91);})[_0x626e('0x26')](function(_0x5ce4df){_0x2be8e2[_0x626e('0x46')]=_0x5ce4df;return _0x2be8e2;})[_0x626e('0x26')](respondWithFilteredResult(_0x544a4b,_0x320a91))[_0x626e('0x47')](handleError(_0x544a4b,null));};exports[_0x626e('0x48')]=function(_0x190b2e,_0x28d29f){var _0x5b5972={'raw':![],'where':{'id':_0x190b2e[_0x626e('0x49')]['id']}},_0x14dfd4={};_0x14dfd4['model']=_[_0x626e('0x33')](db[_0x626e('0x44')][_0x626e('0x2e')]);_0x14dfd4['query']=_[_0x626e('0x33')](_0x190b2e[_0x626e('0x32')]);_0x14dfd4[_0x626e('0x34')]=_['intersection'](_0x14dfd4[_0x626e('0x31')],_0x14dfd4[_0x626e('0x32')]);_0x5b5972[_0x626e('0x36')]=_[_0x626e('0x35')](_0x14dfd4[_0x626e('0x31')],qs[_0x626e('0x37')](_0x190b2e[_0x626e('0x32')][_0x626e('0x37')]));_0x5b5972[_0x626e('0x36')]=_0x5b5972['attributes']['length']?_0x5b5972['attributes']:_0x14dfd4[_0x626e('0x31')];if(_0x190b2e[_0x626e('0x32')][_0x626e('0x42')]){_0x5b5972[_0x626e('0x43')]=[{'all':!![]}];}_0x5b5972=_[_0x626e('0x3f')]({},_0x5b5972,_0x190b2e[_0x626e('0x41')]);return db['ZohoConfiguration']['find'](_0x5b5972)['then'](handleEntityNotFound(_0x28d29f,null))[_0x626e('0x26')](respondWithResult(_0x28d29f,null))['catch'](handleError(_0x28d29f,null));};exports[_0x626e('0x4a')]=function(_0x208e1d,_0x50076e){return db[_0x626e('0x44')][_0x626e('0x4a')](_0x208e1d[_0x626e('0x4b')],{})[_0x626e('0x26')](respondWithResult(_0x50076e,0xc9))['catch'](handleError(_0x50076e,null));};exports[_0x626e('0x25')]=function(_0x4683a3,_0x1a2627){if(_0x4683a3[_0x626e('0x4b')]['id']){delete _0x4683a3['body']['id'];}return db[_0x626e('0x44')][_0x626e('0x4c')]({'where':{'id':_0x4683a3[_0x626e('0x49')]['id']}})[_0x626e('0x26')](handleEntityNotFound(_0x1a2627,null))['then'](saveUpdates(_0x4683a3[_0x626e('0x4b')],null))[_0x626e('0x26')](respondWithResult(_0x1a2627,null))[_0x626e('0x47')](handleError(_0x1a2627,null));};exports[_0x626e('0x27')]=function(_0x3e5fa7,_0x31f55b){return db[_0x626e('0x44')][_0x626e('0x4c')]({'where':{'id':_0x3e5fa7[_0x626e('0x49')]['id']}})['then'](handleEntityNotFound(_0x31f55b,null))[_0x626e('0x26')](removeEntity(_0x31f55b,null))[_0x626e('0x47')](handleError(_0x31f55b,null));};exports[_0x626e('0x4d')]=function(_0x272a49,_0x199569,_0x32e808){var _0x2ccb94={};var _0x193556={};var _0x3a3a3e;var _0x1bd7ec;return db['ZohoConfiguration'][_0x626e('0x4e')]({'where':{'id':_0x272a49[_0x626e('0x49')]['id']}})[_0x626e('0x26')](handleEntityNotFound(_0x199569,null))[_0x626e('0x26')](function(_0x433442){if(_0x433442){_0x3a3a3e=_0x433442;_0x193556[_0x626e('0x31')]=_[_0x626e('0x33')](db[_0x626e('0x4f')]['rawAttributes']);_0x193556['query']=_[_0x626e('0x33')](_0x272a49['query']);_0x193556[_0x626e('0x34')]=_[_0x626e('0x35')](_0x193556['model'],_0x193556[_0x626e('0x32')]);_0x2ccb94[_0x626e('0x36')]=_['intersection'](_0x193556[_0x626e('0x31')],qs['fields'](_0x272a49[_0x626e('0x32')][_0x626e('0x37')]));_0x2ccb94[_0x626e('0x36')]=_0x2ccb94[_0x626e('0x36')]['length']?_0x2ccb94[_0x626e('0x36')]:_0x193556[_0x626e('0x31')];_0x2ccb94['order']=qs[_0x626e('0x3b')](_0x272a49['query'][_0x626e('0x3b')]);_0x2ccb94[_0x626e('0x3c')]=qs[_0x626e('0x34')](_[_0x626e('0x3d')](_0x272a49[_0x626e('0x32')],_0x193556[_0x626e('0x34')]));if(_0x272a49[_0x626e('0x32')]['filter']){_0x2ccb94[_0x626e('0x3c')]=_['merge'](_0x2ccb94[_0x626e('0x3c')],{'$or':_['map'](_0x2ccb94[_0x626e('0x36')],function(_0x319dd4){var _0x58c4cd={};_0x58c4cd[_0x319dd4]={'$like':'%'+_0x272a49[_0x626e('0x32')]['filter']+'%'};return _0x58c4cd;})});}_0x2ccb94=_[_0x626e('0x3f')]({},_0x2ccb94,_0x272a49[_0x626e('0x41')]);return _0x3a3a3e[_0x626e('0x4d')](_0x2ccb94);}})['then'](function(_0x248c08){if(_0x248c08){_0x1bd7ec=_0x248c08[_0x626e('0x38')];if(!_0x272a49[_0x626e('0x32')][_0x626e('0x39')]('nolimit')){_0x2ccb94[_0x626e('0x20')]=qs[_0x626e('0x20')](_0x272a49[_0x626e('0x32')]['limit']);_0x2ccb94[_0x626e('0x1d')]=qs[_0x626e('0x1d')](_0x272a49[_0x626e('0x32')][_0x626e('0x1d')]);}return _0x3a3a3e[_0x626e('0x4d')](_0x2ccb94);}})[_0x626e('0x26')](function(_0xec7da7){if(_0xec7da7){return _0xec7da7?{'count':_0x1bd7ec,'rows':_0xec7da7}:null;}})['then'](respondWithResult(_0x199569,null))[_0x626e('0x47')](handleError(_0x199569,null));};exports[_0x626e('0x50')]=function(_0x4a55e4,_0x3dbbfd,_0x5cc275){var _0x51ca0a={};var _0xff8170={};var _0x57ce11;var _0xb41088;return db[_0x626e('0x44')][_0x626e('0x4e')]({'where':{'id':_0x4a55e4[_0x626e('0x49')]['id']}})[_0x626e('0x26')](handleEntityNotFound(_0x3dbbfd,null))[_0x626e('0x26')](function(_0xfab16f){if(_0xfab16f){_0x57ce11=_0xfab16f;_0xff8170['model']=_['keys'](db[_0x626e('0x4f')][_0x626e('0x2e')]);_0xff8170['query']=_[_0x626e('0x33')](_0x4a55e4[_0x626e('0x32')]);_0xff8170[_0x626e('0x34')]=_[_0x626e('0x35')](_0xff8170[_0x626e('0x31')],_0xff8170[_0x626e('0x32')]);_0x51ca0a[_0x626e('0x36')]=_['intersection'](_0xff8170[_0x626e('0x31')],qs[_0x626e('0x37')](_0x4a55e4[_0x626e('0x32')][_0x626e('0x37')]));_0x51ca0a[_0x626e('0x36')]=_0x51ca0a['attributes'][_0x626e('0x38')]?_0x51ca0a[_0x626e('0x36')]:_0xff8170['model'];_0x51ca0a[_0x626e('0x51')]=qs[_0x626e('0x3b')](_0x4a55e4[_0x626e('0x32')][_0x626e('0x3b')]);_0x51ca0a['where']=qs['filters'](_['pick'](_0x4a55e4[_0x626e('0x32')],_0xff8170['filters']));if(_0x4a55e4[_0x626e('0x32')][_0x626e('0x3e')]){_0x51ca0a[_0x626e('0x3c')]=_[_0x626e('0x3f')](_0x51ca0a[_0x626e('0x3c')],{'$or':_[_0x626e('0x2d')](_0x51ca0a[_0x626e('0x36')],function(_0x174107){var _0x3d5b5d={};_0x3d5b5d[_0x174107]={'$like':'%'+_0x4a55e4['query']['filter']+'%'};return _0x3d5b5d;})});}_0x51ca0a=_[_0x626e('0x3f')]({},_0x51ca0a,_0x4a55e4[_0x626e('0x41')]);return _0x57ce11[_0x626e('0x50')](_0x51ca0a);}})[_0x626e('0x26')](function(_0x51151b){if(_0x51151b){_0xb41088=_0x51151b[_0x626e('0x38')];if(!_0x4a55e4[_0x626e('0x32')]['hasOwnProperty'](_0x626e('0x3a'))){_0x51ca0a[_0x626e('0x20')]=qs[_0x626e('0x20')](_0x4a55e4[_0x626e('0x32')][_0x626e('0x20')]);_0x51ca0a[_0x626e('0x1d')]=qs[_0x626e('0x1d')](_0x4a55e4['query'][_0x626e('0x1d')]);}return _0x57ce11[_0x626e('0x50')](_0x51ca0a);}})[_0x626e('0x26')](function(_0x261028){if(_0x261028){return _0x261028?{'count':_0xb41088,'rows':_0x261028}:null;}})[_0x626e('0x26')](respondWithResult(_0x3dbbfd,null))['catch'](handleError(_0x3dbbfd,null));};exports[_0x626e('0x52')]=function(_0x3bb8a4,_0x33cec1,_0x2d3749){var _0x3c684b={};var _0x34b425={};var _0x55fd36;var _0x574b36;return db[_0x626e('0x44')][_0x626e('0x4e')]({'where':{'id':_0x3bb8a4[_0x626e('0x49')]['id']}})['then'](handleEntityNotFound(_0x33cec1,null))['then'](function(_0x12eeef){if(_0x12eeef){_0x55fd36=_0x12eeef;_0x34b425[_0x626e('0x31')]=_[_0x626e('0x33')](db[_0x626e('0x4f')]['rawAttributes']);_0x34b425[_0x626e('0x32')]=_[_0x626e('0x33')](_0x3bb8a4[_0x626e('0x32')]);_0x34b425[_0x626e('0x34')]=_['intersection'](_0x34b425[_0x626e('0x31')],_0x34b425['query']);_0x3c684b['attributes']=_[_0x626e('0x35')](_0x34b425['model'],qs[_0x626e('0x37')](_0x3bb8a4['query'][_0x626e('0x37')]));_0x3c684b[_0x626e('0x36')]=_0x3c684b[_0x626e('0x36')][_0x626e('0x38')]?_0x3c684b[_0x626e('0x36')]:_0x34b425[_0x626e('0x31')];_0x3c684b[_0x626e('0x51')]=qs[_0x626e('0x3b')](_0x3bb8a4[_0x626e('0x32')]['sort']);_0x3c684b[_0x626e('0x3c')]=qs['filters'](_['pick'](_0x3bb8a4[_0x626e('0x32')],_0x34b425[_0x626e('0x34')]));if(_0x3bb8a4[_0x626e('0x32')][_0x626e('0x3e')]){_0x3c684b[_0x626e('0x3c')]=_[_0x626e('0x3f')](_0x3c684b['where'],{'$or':_[_0x626e('0x2d')](_0x3c684b[_0x626e('0x36')],function(_0xe46f1b){var _0x3352cb={};_0x3352cb[_0xe46f1b]={'$like':'%'+_0x3bb8a4[_0x626e('0x32')][_0x626e('0x3e')]+'%'};return _0x3352cb;})});}_0x3c684b=_[_0x626e('0x3f')]({},_0x3c684b,_0x3bb8a4[_0x626e('0x41')]);return _0x55fd36['getDescriptions'](_0x3c684b);}})[_0x626e('0x26')](function(_0x4719ec){if(_0x4719ec){_0x574b36=_0x4719ec[_0x626e('0x38')];if(!_0x3bb8a4['query']['hasOwnProperty'](_0x626e('0x3a'))){_0x3c684b['limit']=qs[_0x626e('0x20')](_0x3bb8a4[_0x626e('0x32')][_0x626e('0x20')]);_0x3c684b[_0x626e('0x1d')]=qs[_0x626e('0x1d')](_0x3bb8a4[_0x626e('0x32')][_0x626e('0x1d')]);}return _0x55fd36['getDescriptions'](_0x3c684b);}})[_0x626e('0x26')](function(_0x275f6a){if(_0x275f6a){return _0x275f6a?{'count':_0x574b36,'rows':_0x275f6a}:null;}})[_0x626e('0x26')](respondWithResult(_0x33cec1,null))[_0x626e('0x47')](handleError(_0x33cec1,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 9173cf7..4c5bafc 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 _0x3fc8=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util'];(function(_0x5d166e,_0x4d26f7){var _0xb60d2b=function(_0x43becb){while(--_0x43becb){_0x5d166e['push'](_0x5d166e['shift']());}};_0xb60d2b(++_0x4d26f7);}(_0x3fc8,0x66));var _0x83fc=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3fc8[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x83fc('0x0'));var util=require(_0x83fc('0x1'));var logger=require(_0x83fc('0x2'))('api');var moment=require(_0x83fc('0x3'));var BPromise=require(_0x83fc('0x4'));var rp=require(_0x83fc('0x5'));var fs=require('fs');var path=require(_0x83fc('0x6'));var rimraf=require(_0x83fc('0x7'));var config=require(_0x83fc('0x8'));var attributes=require(_0x83fc('0x9'));module[_0x83fc('0xa')]=function(_0x3d620a,_0x1032d5){return _0x3d620a[_0x83fc('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x83fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3313=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3ee47b,_0x33c0fb){var _0x28bb08=function(_0x370a56){while(--_0x370a56){_0x3ee47b['push'](_0x3ee47b['shift']());}};_0x28bb08(++_0x33c0fb);}(_0x3313,0x95));var _0x3331=function(_0x48c221,_0x1b6b48){_0x48c221=_0x48c221-0x0;var _0x717d73=_0x3313[_0x48c221];return _0x717d73;};'use strict';var _=require(_0x3331('0x0'));var util=require(_0x3331('0x1'));var logger=require(_0x3331('0x2'))(_0x3331('0x3'));var moment=require(_0x3331('0x4'));var BPromise=require(_0x3331('0x5'));var rp=require(_0x3331('0x6'));var fs=require('fs');var path=require(_0x3331('0x7'));var rimraf=require(_0x3331('0x8'));var config=require(_0x3331('0x9'));var attributes=require(_0x3331('0xa'));module['exports']=function(_0x581fcb,_0x46c003){return _0x581fcb[_0x3331('0xb')](_0x3331('0xc'),attributes,{'tableName':_0x3331('0xd'),'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 0204890..621a553 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 _0xabb2=['catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabb2,0x135));var _0x2abb=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0xabb2[_0x49c68e];return _0x33032b;};'use strict';var _=require(_0x2abb('0x0'));var util=require('util');var moment=require(_0x2abb('0x1'));var BPromise=require(_0x2abb('0x2'));var rs=require(_0x2abb('0x3'));var fs=require('fs');var Redis=require(_0x2abb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2abb('0x5'));var config=require(_0x2abb('0x6'));var jayson=require(_0x2abb('0x7'));var client=jayson[_0x2abb('0x8')][_0x2abb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bfd56,_0x21319f,_0x443743){return new BPromise(function(_0xd54887,_0xda594e){return client[_0x2abb('0xa')](_0x2bfd56,_0x443743)[_0x2abb('0xb')](function(_0x26e172){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x21319f,_0x2abb('0xc'));logger[_0x2abb('0xd')](_0x2abb('0xe'),_0x21319f,'request\x20sent',JSON[_0x2abb('0xf')](_0x26e172));if(_0x26e172[_0x2abb('0x10')]){if(_0x26e172[_0x2abb('0x10')][_0x2abb('0x11')]===0x1f4){logger[_0x2abb('0x10')](_0x2abb('0x12'),_0x21319f,_0x26e172[_0x2abb('0x10')][_0x2abb('0x13')]);return _0xda594e(_0x26e172[_0x2abb('0x10')][_0x2abb('0x13')]);}logger[_0x2abb('0x10')](_0x2abb('0x12'),_0x21319f,_0x26e172[_0x2abb('0x10')][_0x2abb('0x13')]);return _0xd54887(_0x26e172[_0x2abb('0x10')][_0x2abb('0x13')]);}else{logger[_0x2abb('0x14')](_0x2abb('0x12'),_0x21319f,_0x2abb('0xc'));_0xd54887(_0x26e172['result']['message']);}})[_0x2abb('0x15')](function(_0x2938f2){logger[_0x2abb('0x10')](_0x2abb('0x12'),_0x21319f,_0x2938f2);_0xda594e(_0x2938f2);});});} \ No newline at end of file +var _0x0414=['info','debug','request\x20sent','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x18b2c1,_0x486238){var _0x4a2a71=function(_0x577861){while(--_0x577861){_0x18b2c1['push'](_0x18b2c1['shift']());}};_0x4a2a71(++_0x486238);}(_0x0414,0xe5));var _0x4041=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x0414[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require('lodash');var util=require(_0x4041('0x0'));var moment=require(_0x4041('0x1'));var BPromise=require(_0x4041('0x2'));var rs=require(_0x4041('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4041('0x4'))['db'];var utils=require(_0x4041('0x5'));var logger=require(_0x4041('0x6'))(_0x4041('0x7'));var config=require('../../config/environment');var jayson=require(_0x4041('0x8'));var client=jayson[_0x4041('0x9')][_0x4041('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x284fef,_0x134b8a,_0x38c4a1){return new BPromise(function(_0x3cab88,_0x11afdc){return client[_0x4041('0xb')](_0x284fef,_0x38c4a1)[_0x4041('0xc')](function(_0xf7a8c){logger[_0x4041('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x134b8a,'request\x20sent');logger[_0x4041('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x134b8a,_0x4041('0xf'),JSON[_0x4041('0x10')](_0xf7a8c));if(_0xf7a8c[_0x4041('0x11')]){if(_0xf7a8c[_0x4041('0x11')]['code']===0x1f4){logger[_0x4041('0x11')](_0x4041('0x12'),_0x134b8a,_0xf7a8c[_0x4041('0x11')][_0x4041('0x13')]);return _0x11afdc(_0xf7a8c['error'][_0x4041('0x13')]);}logger[_0x4041('0x11')](_0x4041('0x12'),_0x134b8a,_0xf7a8c[_0x4041('0x11')][_0x4041('0x13')]);return _0x3cab88(_0xf7a8c[_0x4041('0x11')][_0x4041('0x13')]);}else{logger[_0x4041('0xd')](_0x4041('0x12'),_0x134b8a,_0x4041('0xf'));_0x3cab88(_0xf7a8c[_0x4041('0x14')]['message']);}})[_0x4041('0x15')](function(_0xc4ca1f){logger[_0x4041('0x11')](_0x4041('0x12'),_0x134b8a,_0xc4ca1f);_0x11afdc(_0xc4ca1f);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index f3f0072..f580d2b 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 _0x775d=['multer','util','path','express','fs-extra','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','exports'];(function(_0x339a45,_0x391206){var _0x118e27=function(_0x12326c){while(--_0x12326c){_0x339a45['push'](_0x339a45['shift']());}};_0x118e27(++_0x391206);}(_0x775d,0x150));var _0xd775=function(_0x8f921e,_0x209ede){_0x8f921e=_0x8f921e-0x0;var _0x39138b=_0x775d[_0x8f921e];return _0x39138b;};'use strict';var multer=require(_0xd775('0x0'));var util=require(_0xd775('0x1'));var path=require(_0xd775('0x2'));var timeout=require('connect-timeout');var express=require(_0xd775('0x3'));var router=express['Router']();var fs_extra=require(_0xd775('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd775('0x5'));var config=require('../../config/environment');var controller=require(_0xd775('0x6'));router[_0xd775('0x7')]('/',auth[_0xd775('0x8')](),controller['index']);router[_0xd775('0x7')](_0xd775('0x9'),auth[_0xd775('0x8')](),controller[_0xd775('0xa')]);router['post']('/',auth[_0xd775('0x8')](),controller['create']);router[_0xd775('0xb')](_0xd775('0x9'),auth['isAuthenticated'](),controller[_0xd775('0xc')]);router[_0xd775('0xd')](_0xd775('0x9'),auth[_0xd775('0x8')](),controller[_0xd775('0xe')]);module[_0xd775('0xf')]=router; \ No newline at end of file +var _0xd1a3=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','create','update','exports','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd1a3,0x1df));var _0x3d1a=function(_0x138f54,_0x2eaf21){_0x138f54=_0x138f54-0x0;var _0x82a23=_0xd1a3[_0x138f54];return _0x82a23;};'use strict';var multer=require('multer');var util=require(_0x3d1a('0x0'));var path=require(_0x3d1a('0x1'));var timeout=require(_0x3d1a('0x2'));var express=require(_0x3d1a('0x3'));var router=express[_0x3d1a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3d1a('0x5'));var config=require(_0x3d1a('0x6'));var controller=require(_0x3d1a('0x7'));router[_0x3d1a('0x8')]('/',auth[_0x3d1a('0x9')](),controller['index']);router[_0x3d1a('0x8')](_0x3d1a('0xa'),auth[_0x3d1a('0x9')](),controller[_0x3d1a('0xb')]);router['post']('/',auth[_0x3d1a('0x9')](),controller[_0x3d1a('0xc')]);router['put'](_0x3d1a('0xa'),auth[_0x3d1a('0x9')](),controller[_0x3d1a('0xd')]);router['delete'](_0x3d1a('0xa'),auth[_0x3d1a('0x9')](),controller['destroy']);module[_0x3d1a('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 7f1f58d..1766ed0 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 _0x09af=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x49a3a5,_0x5a8caf){var _0xf6b7fb=function(_0x3b05aa){while(--_0x3b05aa){_0x49a3a5['push'](_0x49a3a5['shift']());}};_0xf6b7fb(++_0x5a8caf);}(_0x09af,0xe3));var _0xf09a=function(_0x4ca764,_0x572b2a){_0x4ca764=_0x4ca764-0x0;var _0x39292d=_0x09af[_0x4ca764];return _0x39292d;};'use strict';var Sequelize=require(_0xf09a('0x0'));module['exports']={'type':{'type':Sequelize[_0xf09a('0x1')](_0xf09a('0x2'),_0xf09a('0x3'),_0xf09a('0x4'),_0xf09a('0x5'),_0xf09a('0x6')),'defaultValue':_0xf09a('0x2')},'content':{'type':Sequelize[_0xf09a('0x7')]},'key':{'type':Sequelize[_0xf09a('0x7')]},'keyType':{'type':Sequelize[_0xf09a('0x1')](_0xf09a('0x2'),_0xf09a('0x3'),_0xf09a('0x4'))},'keyContent':{'type':Sequelize[_0xf09a('0x7')]},'idField':{'type':Sequelize[_0xf09a('0x7')]},'nameField':{'type':Sequelize[_0xf09a('0x7')]},'customField':{'type':Sequelize[_0xf09a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf09a('0x7')]}}; \ No newline at end of file +var _0xa06b=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize'];(function(_0xcda8af,_0x11dac1){var _0x4bb1ca=function(_0x1ec2d4){while(--_0x1ec2d4){_0xcda8af['push'](_0xcda8af['shift']());}};_0x4bb1ca(++_0x11dac1);}(_0xa06b,0xbd));var _0xba06=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa06b[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xba06('0x0'));module[_0xba06('0x1')]={'type':{'type':Sequelize[_0xba06('0x2')](_0xba06('0x3'),_0xba06('0x4'),'customVariable',_0xba06('0x5'),_0xba06('0x6')),'defaultValue':_0xba06('0x3')},'content':{'type':Sequelize[_0xba06('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xba06('0x2')](_0xba06('0x3'),_0xba06('0x4'),_0xba06('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xba06('0x7')]},'nameField':{'type':Sequelize[_0xba06('0x7')]},'customField':{'type':Sequelize[_0xba06('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 75f1372..bc5f215 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 _0xab95=['destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','body','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then'];(function(_0x49a954,_0x501f5a){var _0x53ef11=function(_0x1296c1){while(--_0x1296c1){_0x49a954['push'](_0x49a954['shift']());}};_0x53ef11(++_0x501f5a);}(_0xab95,0x1d5));var _0x5ab9=function(_0x5a1822,_0x5859e7){_0x5a1822=_0x5a1822-0x0;var _0x3a4d35=_0xab95[_0x5a1822];return _0x3a4d35;};'use strict';var emlformat=require(_0x5ab9('0x0'));var rimraf=require(_0x5ab9('0x1'));var zipdir=require(_0x5ab9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ab9('0x3'));var moment=require(_0x5ab9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ab9('0x5'));var path=require(_0x5ab9('0x6'));var sox=require('sox');var csv=require(_0x5ab9('0x7'));var ejs=require(_0x5ab9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ab9('0x9'));var squel=require(_0x5ab9('0xa'));var crypto=require('crypto');var jsforce=require(_0x5ab9('0xb'));var deskjs=require(_0x5ab9('0xc'));var toCsv=require(_0x5ab9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ab9('0xd'));var authService=require(_0x5ab9('0xe'));var qs=require(_0x5ab9('0xf'));var as=require(_0x5ab9('0x10'));var hardwareService=require(_0x5ab9('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5ab9('0x12'));var config=require(_0x5ab9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ab9('0x14'))['db'];function respondWithStatusCode(_0x5f2479,_0x43993a){_0x43993a=_0x43993a||0xcc;return function(_0x235916){if(_0x235916){return _0x5f2479[_0x5ab9('0x15')](_0x43993a);}return _0x5f2479[_0x5ab9('0x16')](_0x43993a)[_0x5ab9('0x17')]();};}function respondWithResult(_0x552b48,_0xec9e3c){_0xec9e3c=_0xec9e3c||0xc8;return function(_0x161c4c){if(_0x161c4c){return _0x552b48[_0x5ab9('0x16')](_0xec9e3c)['json'](_0x161c4c);}};}function respondWithFilteredResult(_0x4150d5,_0x56a4cd){return function(_0x4bcf18){if(_0x4bcf18){var _0x249172=typeof _0x56a4cd[_0x5ab9('0x18')]===_0x5ab9('0x19')&&typeof _0x56a4cd[_0x5ab9('0x1a')]===_0x5ab9('0x19');var _0x23bddf=_0x4bcf18[_0x5ab9('0x1b')];var _0x49970d=_0x249172?0x0:_0x56a4cd[_0x5ab9('0x18')];var _0x274383=_0x249172?_0x4bcf18['count']:_0x56a4cd[_0x5ab9('0x18')]+_0x56a4cd[_0x5ab9('0x1a')];var _0x559618;if(_0x274383>=_0x23bddf){_0x274383=_0x23bddf;_0x559618=0xc8;}else{_0x559618=0xce;}_0x4150d5[_0x5ab9('0x16')](_0x559618);return _0x4150d5[_0x5ab9('0x1c')](_0x5ab9('0x1d'),_0x49970d+'-'+_0x274383+'/'+_0x23bddf)[_0x5ab9('0x1e')](_0x4bcf18);}return null;};}function patchUpdates(_0x132c73){return function(_0x10d90f){try{jsonpatch[_0x5ab9('0x1f')](_0x10d90f,_0x132c73,!![]);}catch(_0x1205a6){return BPromise[_0x5ab9('0x20')](_0x1205a6);}return _0x10d90f[_0x5ab9('0x21')]();};}function saveUpdates(_0x3ee600,_0x1ee365){return function(_0x4c31e6){if(_0x4c31e6){return _0x4c31e6['update'](_0x3ee600)[_0x5ab9('0x22')](function(_0x5cc952){return _0x5cc952;});}return null;};}function removeEntity(_0x451da3,_0xdecd3d){return function(_0x1c45db){if(_0x1c45db){return _0x1c45db[_0x5ab9('0x23')]()[_0x5ab9('0x22')](function(){_0x451da3[_0x5ab9('0x16')](0xcc)[_0x5ab9('0x17')]();});}};}function handleEntityNotFound(_0x170f2d,_0x333f52){return function(_0x15bd3c){if(!_0x15bd3c){_0x170f2d['sendStatus'](0x194);}return _0x15bd3c;};}function handleError(_0x52f7d5,_0x2c65d2){_0x2c65d2=_0x2c65d2||0x1f4;return function(_0x120c92){logger[_0x5ab9('0x24')](_0x120c92[_0x5ab9('0x25')]);if(_0x120c92[_0x5ab9('0x26')]){delete _0x120c92[_0x5ab9('0x26')];}_0x52f7d5['status'](_0x2c65d2)[_0x5ab9('0x27')](_0x120c92);};}exports[_0x5ab9('0x28')]=function(_0x50a386,_0x2e492b){var _0x302a6c={},_0x4fccdf={},_0xe0f687={'count':0x0,'rows':[]};var _0x198b0f=_[_0x5ab9('0x29')](db[_0x5ab9('0x2a')][_0x5ab9('0x2b')],function(_0xf5c162){return{'name':_0xf5c162[_0x5ab9('0x2c')],'type':_0xf5c162['type']['key']};});_0x4fccdf[_0x5ab9('0x2d')]=_[_0x5ab9('0x29')](_0x198b0f,_0x5ab9('0x26'));_0x4fccdf[_0x5ab9('0x2e')]=_[_0x5ab9('0x2f')](_0x50a386[_0x5ab9('0x2e')]);_0x4fccdf[_0x5ab9('0x30')]=_[_0x5ab9('0x31')](_0x4fccdf[_0x5ab9('0x2d')],_0x4fccdf['query']);_0x302a6c[_0x5ab9('0x32')]=_[_0x5ab9('0x31')](_0x4fccdf[_0x5ab9('0x2d')],qs[_0x5ab9('0x33')](_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x33')]));_0x302a6c[_0x5ab9('0x32')]=_0x302a6c[_0x5ab9('0x32')]['length']?_0x302a6c[_0x5ab9('0x32')]:_0x4fccdf[_0x5ab9('0x2d')];if(!_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x34')](_0x5ab9('0x35'))){_0x302a6c[_0x5ab9('0x1a')]=qs[_0x5ab9('0x1a')](_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x1a')]);_0x302a6c[_0x5ab9('0x18')]=qs[_0x5ab9('0x18')](_0x50a386['query'][_0x5ab9('0x18')]);}_0x302a6c[_0x5ab9('0x36')]=qs[_0x5ab9('0x37')](_0x50a386['query'][_0x5ab9('0x37')]);_0x302a6c[_0x5ab9('0x38')]=qs[_0x5ab9('0x30')](_[_0x5ab9('0x39')](_0x50a386[_0x5ab9('0x2e')],_0x4fccdf[_0x5ab9('0x30')]),_0x198b0f);if(_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x3a')]){_0x302a6c['where']=_[_0x5ab9('0x3b')](_0x302a6c[_0x5ab9('0x38')],{'$or':_[_0x5ab9('0x29')](_0x198b0f,function(_0x3334ea){if(_0x3334ea['type']!==_0x5ab9('0x3c')){var _0x4d90d0={};_0x4d90d0[_0x3334ea['name']]={'$like':'%'+_0x50a386['query'][_0x5ab9('0x3a')]+'%'};return _0x4d90d0;}})});}_0x302a6c=_[_0x5ab9('0x3b')]({},_0x302a6c,_0x50a386[_0x5ab9('0x3d')]);var _0x1b5a5f={'where':_0x302a6c['where']};return db['ZohoField'][_0x5ab9('0x1b')](_0x1b5a5f)[_0x5ab9('0x22')](function(_0x13a5a1){_0xe0f687[_0x5ab9('0x1b')]=_0x13a5a1;if(_0x50a386[_0x5ab9('0x2e')][_0x5ab9('0x3e')]){_0x302a6c[_0x5ab9('0x3f')]=[{'all':!![]}];}return db['ZohoField'][_0x5ab9('0x40')](_0x302a6c);})[_0x5ab9('0x22')](function(_0x36ecfb){_0xe0f687[_0x5ab9('0x41')]=_0x36ecfb;return _0xe0f687;})[_0x5ab9('0x22')](respondWithFilteredResult(_0x2e492b,_0x302a6c))['catch'](handleError(_0x2e492b,null));};exports[_0x5ab9('0x42')]=function(_0x6fe2d3,_0x15de13){var _0xf1f964={'raw':!![],'where':{'id':_0x6fe2d3[_0x5ab9('0x43')]['id']}},_0x535478={};_0x535478[_0x5ab9('0x2d')]=_['keys'](db['ZohoField'][_0x5ab9('0x2b')]);_0x535478[_0x5ab9('0x2e')]=_['keys'](_0x6fe2d3[_0x5ab9('0x2e')]);_0x535478[_0x5ab9('0x30')]=_['intersection'](_0x535478['model'],_0x535478[_0x5ab9('0x2e')]);_0xf1f964[_0x5ab9('0x32')]=_[_0x5ab9('0x31')](_0x535478[_0x5ab9('0x2d')],qs['fields'](_0x6fe2d3['query']['fields']));_0xf1f964['attributes']=_0xf1f964['attributes']['length']?_0xf1f964[_0x5ab9('0x32')]:_0x535478[_0x5ab9('0x2d')];if(_0x6fe2d3['query']['includeAll']){_0xf1f964[_0x5ab9('0x3f')]=[{'all':!![]}];}_0xf1f964=_[_0x5ab9('0x3b')]({},_0xf1f964,_0x6fe2d3['options']);return db[_0x5ab9('0x2a')][_0x5ab9('0x44')](_0xf1f964)[_0x5ab9('0x22')](handleEntityNotFound(_0x15de13,null))[_0x5ab9('0x22')](respondWithResult(_0x15de13,null))[_0x5ab9('0x45')](handleError(_0x15de13,null));};exports['create']=function(_0x3a8be9,_0x5759e1){return db[_0x5ab9('0x2a')]['create'](_0x3a8be9[_0x5ab9('0x46')],{})['then'](respondWithResult(_0x5759e1,0xc9))[_0x5ab9('0x45')](handleError(_0x5759e1,null));};exports[_0x5ab9('0x47')]=function(_0x144602,_0x13daa8){if(_0x144602[_0x5ab9('0x46')]['id']){delete _0x144602['body']['id'];}return db[_0x5ab9('0x2a')]['find']({'where':{'id':_0x144602[_0x5ab9('0x43')]['id']}})[_0x5ab9('0x22')](handleEntityNotFound(_0x13daa8,null))['then'](saveUpdates(_0x144602[_0x5ab9('0x46')],null))['then'](respondWithResult(_0x13daa8,null))[_0x5ab9('0x45')](handleError(_0x13daa8,null));};exports['destroy']=function(_0x417113,_0x2fbfb8){return db[_0x5ab9('0x2a')][_0x5ab9('0x44')]({'where':{'id':_0x417113['params']['id']}})[_0x5ab9('0x22')](handleEntityNotFound(_0x2fbfb8,null))[_0x5ab9('0x22')](removeEntity(_0x2fbfb8,null))[_0x5ab9('0x45')](handleError(_0x2fbfb8,null));}; \ No newline at end of file +var _0x5c38=['body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','index','map','ZohoField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create'];(function(_0x33bee8,_0x47df8f){var _0x5959ab=function(_0xa0848f){while(--_0xa0848f){_0x33bee8['push'](_0x33bee8['shift']());}};_0x5959ab(++_0x47df8f);}(_0x5c38,0xe0));var _0x85c3=function(_0x59efbd,_0x332945){_0x59efbd=_0x59efbd-0x0;var _0x3d11f6=_0x5c38[_0x59efbd];return _0x3d11f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85c3('0x1'));var rp=require(_0x85c3('0x2'));var moment=require('moment');var BPromise=require(_0x85c3('0x3'));var Mustache=require(_0x85c3('0x4'));var util=require(_0x85c3('0x5'));var path=require(_0x85c3('0x6'));var sox=require(_0x85c3('0x7'));var csv=require('to-csv');var ejs=require(_0x85c3('0x8'));var fs=require('fs');var fs_extra=require(_0x85c3('0x9'));var _=require('lodash');var squel=require(_0x85c3('0xa'));var crypto=require(_0x85c3('0xb'));var jsforce=require(_0x85c3('0xc'));var deskjs=require(_0x85c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85c3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x85c3('0xf'));var qs=require(_0x85c3('0x10'));var as=require(_0x85c3('0x11'));var hardwareService=require(_0x85c3('0x12'));var logger=require('../../config/logger')(_0x85c3('0x13'));var utils=require(_0x85c3('0x14'));var config=require(_0x85c3('0x15'));var licenseUtil=require(_0x85c3('0x16'));var db=require(_0x85c3('0x17'))['db'];function respondWithStatusCode(_0x10c057,_0x271ace){_0x271ace=_0x271ace||0xcc;return function(_0x26e417){if(_0x26e417){return _0x10c057[_0x85c3('0x18')](_0x271ace);}return _0x10c057[_0x85c3('0x19')](_0x271ace)['end']();};}function respondWithResult(_0x410b0d,_0x236dcf){_0x236dcf=_0x236dcf||0xc8;return function(_0x48214c){if(_0x48214c){return _0x410b0d[_0x85c3('0x19')](_0x236dcf)[_0x85c3('0x1a')](_0x48214c);}};}function respondWithFilteredResult(_0xd85f9d,_0x175379){return function(_0x4d56b3){if(_0x4d56b3){var _0x20cd56=typeof _0x175379[_0x85c3('0x1b')]===_0x85c3('0x1c')&&typeof _0x175379[_0x85c3('0x1d')]===_0x85c3('0x1c');var _0x5672b4=_0x4d56b3[_0x85c3('0x1e')];var _0x39c94e=_0x20cd56?0x0:_0x175379[_0x85c3('0x1b')];var _0x225a33=_0x20cd56?_0x4d56b3[_0x85c3('0x1e')]:_0x175379['offset']+_0x175379[_0x85c3('0x1d')];var _0x3a0ffc;if(_0x225a33>=_0x5672b4){_0x225a33=_0x5672b4;_0x3a0ffc=0xc8;}else{_0x3a0ffc=0xce;}_0xd85f9d[_0x85c3('0x19')](_0x3a0ffc);return _0xd85f9d[_0x85c3('0x1f')]('Content-Range',_0x39c94e+'-'+_0x225a33+'/'+_0x5672b4)[_0x85c3('0x1a')](_0x4d56b3);}return null;};}function patchUpdates(_0x3866b0){return function(_0xc572fd){try{jsonpatch[_0x85c3('0x20')](_0xc572fd,_0x3866b0,!![]);}catch(_0x1dc41f){return BPromise[_0x85c3('0x21')](_0x1dc41f);}return _0xc572fd[_0x85c3('0x22')]();};}function saveUpdates(_0x565274,_0x4f2b89){return function(_0xda5a29){if(_0xda5a29){return _0xda5a29[_0x85c3('0x23')](_0x565274)[_0x85c3('0x24')](function(_0x5386f4){return _0x5386f4;});}return null;};}function removeEntity(_0x1637ab,_0x522302){return function(_0x53b918){if(_0x53b918){return _0x53b918[_0x85c3('0x25')]()[_0x85c3('0x24')](function(){_0x1637ab[_0x85c3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321b67,_0x59d25a){return function(_0x7d8312){if(!_0x7d8312){_0x321b67['sendStatus'](0x194);}return _0x7d8312;};}function handleError(_0x32cf87,_0x5229bb){_0x5229bb=_0x5229bb||0x1f4;return function(_0x24e3dc){logger[_0x85c3('0x26')](_0x24e3dc['stack']);if(_0x24e3dc[_0x85c3('0x27')]){delete _0x24e3dc[_0x85c3('0x27')];}_0x32cf87[_0x85c3('0x19')](_0x5229bb)['send'](_0x24e3dc);};}exports[_0x85c3('0x28')]=function(_0x178a1d,_0x13b25d){var _0xa033f3={},_0x42d504={},_0x527b0a={'count':0x0,'rows':[]};var _0x10cacc=_[_0x85c3('0x29')](db[_0x85c3('0x2a')][_0x85c3('0x2b')],function(_0x1e3c61){return{'name':_0x1e3c61[_0x85c3('0x2c')],'type':_0x1e3c61['type']['key']};});_0x42d504[_0x85c3('0x2d')]=_[_0x85c3('0x29')](_0x10cacc,_0x85c3('0x27'));_0x42d504[_0x85c3('0x2e')]=_[_0x85c3('0x2f')](_0x178a1d[_0x85c3('0x2e')]);_0x42d504[_0x85c3('0x30')]=_['intersection'](_0x42d504['model'],_0x42d504[_0x85c3('0x2e')]);_0xa033f3['attributes']=_[_0x85c3('0x31')](_0x42d504['model'],qs[_0x85c3('0x32')](_0x178a1d[_0x85c3('0x2e')][_0x85c3('0x32')]));_0xa033f3[_0x85c3('0x33')]=_0xa033f3['attributes']['length']?_0xa033f3['attributes']:_0x42d504[_0x85c3('0x2d')];if(!_0x178a1d[_0x85c3('0x2e')][_0x85c3('0x34')](_0x85c3('0x35'))){_0xa033f3[_0x85c3('0x1d')]=qs[_0x85c3('0x1d')](_0x178a1d[_0x85c3('0x2e')][_0x85c3('0x1d')]);_0xa033f3[_0x85c3('0x1b')]=qs[_0x85c3('0x1b')](_0x178a1d[_0x85c3('0x2e')][_0x85c3('0x1b')]);}_0xa033f3[_0x85c3('0x36')]=qs[_0x85c3('0x37')](_0x178a1d[_0x85c3('0x2e')][_0x85c3('0x37')]);_0xa033f3['where']=qs[_0x85c3('0x30')](_[_0x85c3('0x38')](_0x178a1d[_0x85c3('0x2e')],_0x42d504[_0x85c3('0x30')]),_0x10cacc);if(_0x178a1d[_0x85c3('0x2e')][_0x85c3('0x39')]){_0xa033f3[_0x85c3('0x3a')]=_[_0x85c3('0x3b')](_0xa033f3[_0x85c3('0x3a')],{'$or':_[_0x85c3('0x29')](_0x10cacc,function(_0x3702cc){if(_0x3702cc[_0x85c3('0x3c')]!==_0x85c3('0x3d')){var _0x1ba8f6={};_0x1ba8f6[_0x3702cc[_0x85c3('0x27')]]={'$like':'%'+_0x178a1d['query'][_0x85c3('0x39')]+'%'};return _0x1ba8f6;}})});}_0xa033f3=_['merge']({},_0xa033f3,_0x178a1d[_0x85c3('0x3e')]);var _0x361b79={'where':_0xa033f3[_0x85c3('0x3a')]};return db['ZohoField']['count'](_0x361b79)[_0x85c3('0x24')](function(_0x28be72){_0x527b0a[_0x85c3('0x1e')]=_0x28be72;if(_0x178a1d[_0x85c3('0x2e')][_0x85c3('0x3f')]){_0xa033f3[_0x85c3('0x40')]=[{'all':!![]}];}return db[_0x85c3('0x2a')][_0x85c3('0x41')](_0xa033f3);})['then'](function(_0x2a2bc9){_0x527b0a[_0x85c3('0x42')]=_0x2a2bc9;return _0x527b0a;})[_0x85c3('0x24')](respondWithFilteredResult(_0x13b25d,_0xa033f3))['catch'](handleError(_0x13b25d,null));};exports[_0x85c3('0x43')]=function(_0xddbfd8,_0x220ddf){var _0x4641e2={'raw':!![],'where':{'id':_0xddbfd8[_0x85c3('0x44')]['id']}},_0x39ae77={};_0x39ae77[_0x85c3('0x2d')]=_[_0x85c3('0x2f')](db['ZohoField'][_0x85c3('0x2b')]);_0x39ae77[_0x85c3('0x2e')]=_[_0x85c3('0x2f')](_0xddbfd8[_0x85c3('0x2e')]);_0x39ae77[_0x85c3('0x30')]=_[_0x85c3('0x31')](_0x39ae77[_0x85c3('0x2d')],_0x39ae77['query']);_0x4641e2[_0x85c3('0x33')]=_[_0x85c3('0x31')](_0x39ae77[_0x85c3('0x2d')],qs[_0x85c3('0x32')](_0xddbfd8[_0x85c3('0x2e')]['fields']));_0x4641e2[_0x85c3('0x33')]=_0x4641e2['attributes'][_0x85c3('0x45')]?_0x4641e2[_0x85c3('0x33')]:_0x39ae77['model'];if(_0xddbfd8[_0x85c3('0x2e')][_0x85c3('0x3f')]){_0x4641e2[_0x85c3('0x40')]=[{'all':!![]}];}_0x4641e2=_[_0x85c3('0x3b')]({},_0x4641e2,_0xddbfd8[_0x85c3('0x3e')]);return db[_0x85c3('0x2a')][_0x85c3('0x46')](_0x4641e2)[_0x85c3('0x24')](handleEntityNotFound(_0x220ddf,null))[_0x85c3('0x24')](respondWithResult(_0x220ddf,null))['catch'](handleError(_0x220ddf,null));};exports[_0x85c3('0x47')]=function(_0x2e9b71,_0x14b18e){return db[_0x85c3('0x2a')][_0x85c3('0x47')](_0x2e9b71[_0x85c3('0x48')],{})['then'](respondWithResult(_0x14b18e,0xc9))[_0x85c3('0x49')](handleError(_0x14b18e,null));};exports[_0x85c3('0x23')]=function(_0x3ab7b1,_0x386350){if(_0x3ab7b1[_0x85c3('0x48')]['id']){delete _0x3ab7b1[_0x85c3('0x48')]['id'];}return db['ZohoField'][_0x85c3('0x46')]({'where':{'id':_0x3ab7b1['params']['id']}})[_0x85c3('0x24')](handleEntityNotFound(_0x386350,null))[_0x85c3('0x24')](saveUpdates(_0x3ab7b1[_0x85c3('0x48')],null))['then'](respondWithResult(_0x386350,null))[_0x85c3('0x49')](handleError(_0x386350,null));};exports['destroy']=function(_0x4c7d2e,_0x542a24){return db[_0x85c3('0x2a')]['find']({'where':{'id':_0x4c7d2e[_0x85c3('0x44')]['id']}})[_0x85c3('0x24')](handleEntityNotFound(_0x542a24,null))[_0x85c3('0x24')](removeEntity(_0x542a24,null))[_0x85c3('0x49')](handleError(_0x542a24,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 472bb0a..9c2281a 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 _0x68b3=['../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4fd4cc,_0x5bb554){var _0x211a4c=function(_0x46f426){while(--_0x46f426){_0x4fd4cc['push'](_0x4fd4cc['shift']());}};_0x211a4c(++_0x5bb554);}(_0x68b3,0x1d8));var _0x368b=function(_0x12f274,_0xaad37c){_0x12f274=_0x12f274-0x0;var _0x2acb99=_0x68b3[_0x12f274];return _0x2acb99;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./intZohoField.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'paranoid':![],'indexes':[{'name':_0x368b('0xd'),'fields':[_0x368b('0xe'),_0x368b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x215bc6,_0x16a628){var _0x317422=function(_0x8edd95){while(--_0x8edd95){_0x215bc6['push'](_0x215bc6['shift']());}};_0x317422(++_0x16a628);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x145465,_0x3a673e){_0x145465=_0x145465-0x0;var _0x39284d=_0x0adf[_0x145465];return _0x39284d;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ad('0xd'),'fields':[_0xf0ad('0xe'),_0xf0ad('0xf')],'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 d3eea4d..aa642a8 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 _0xd656=['message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x501395,_0x2893f3){var _0x2393bf=function(_0x4741e7){while(--_0x4741e7){_0x501395['push'](_0x501395['shift']());}};_0x2393bf(++_0x2893f3);}(_0xd656,0xab));var _0x6d65=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd656[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x6d65('0x0'));var moment=require(_0x6d65('0x1'));var BPromise=require(_0x6d65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d65('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d65('0x4'));var logger=require(_0x6d65('0x5'))(_0x6d65('0x6'));var config=require(_0x6d65('0x7'));var jayson=require(_0x6d65('0x8'));var client=jayson['client'][_0x6d65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c9c8c,_0x4c39a7,_0x872372){return new BPromise(function(_0x75e800,_0x199f90){return client[_0x6d65('0xa')](_0x4c9c8c,_0x872372)['then'](function(_0x3435a0){logger[_0x6d65('0xb')](_0x6d65('0xc'),_0x4c39a7,_0x6d65('0xd'));logger[_0x6d65('0xe')](_0x6d65('0xf'),_0x4c39a7,'request\x20sent',JSON[_0x6d65('0x10')](_0x3435a0));if(_0x3435a0[_0x6d65('0x11')]){if(_0x3435a0[_0x6d65('0x11')]['code']===0x1f4){logger[_0x6d65('0x11')](_0x6d65('0xc'),_0x4c39a7,_0x3435a0['error']['message']);return _0x199f90(_0x3435a0[_0x6d65('0x11')][_0x6d65('0x12')]);}logger['error'](_0x6d65('0xc'),_0x4c39a7,_0x3435a0[_0x6d65('0x11')][_0x6d65('0x12')]);return _0x75e800(_0x3435a0['error'][_0x6d65('0x12')]);}else{logger[_0x6d65('0xb')]('ZohoField,\x20%s,\x20%s',_0x4c39a7,_0x6d65('0xd'));_0x75e800(_0x3435a0[_0x6d65('0x13')][_0x6d65('0x12')]);}})[_0x6d65('0x14')](function(_0x2f4ea2){logger[_0x6d65('0x11')](_0x6d65('0xc'),_0x4c39a7,_0x2f4ea2);_0x199f90(_0x2f4ea2);});});} \ No newline at end of file +var _0xf29d=['jayson/promise','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3c98c9,_0x5114f1){var _0x5ab508=function(_0x5d9c08){while(--_0x5d9c08){_0x3c98c9['push'](_0x3c98c9['shift']());}};_0x5ab508(++_0x5114f1);}(_0xf29d,0x8b));var _0xdf29=function(_0x953e6d,_0x5d1312){_0x953e6d=_0x953e6d-0x0;var _0x1dc402=_0xf29d[_0x953e6d];return _0x1dc402;};'use strict';var _=require('lodash');var util=require(_0xdf29('0x0'));var moment=require(_0xdf29('0x1'));var BPromise=require(_0xdf29('0x2'));var rs=require(_0xdf29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf29('0x5'))(_0xdf29('0x6'));var config=require(_0xdf29('0x7'));var jayson=require(_0xdf29('0x8'));var client=jayson['client'][_0xdf29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f76ec,_0x4a0d71,_0x7ed293){return new BPromise(function(_0x2ce191,_0x2acbcd){return client[_0xdf29('0xa')](_0x3f76ec,_0x7ed293)[_0xdf29('0xb')](function(_0x2a0512){logger['info'](_0xdf29('0xc'),_0x4a0d71,_0xdf29('0xd'));logger[_0xdf29('0xe')](_0xdf29('0xf'),_0x4a0d71,_0xdf29('0xd'),JSON['stringify'](_0x2a0512));if(_0x2a0512[_0xdf29('0x10')]){if(_0x2a0512[_0xdf29('0x10')][_0xdf29('0x11')]===0x1f4){logger[_0xdf29('0x10')](_0xdf29('0xc'),_0x4a0d71,_0x2a0512['error'][_0xdf29('0x12')]);return _0x2acbcd(_0x2a0512[_0xdf29('0x10')][_0xdf29('0x12')]);}logger[_0xdf29('0x10')](_0xdf29('0xc'),_0x4a0d71,_0x2a0512['error'][_0xdf29('0x12')]);return _0x2ce191(_0x2a0512[_0xdf29('0x10')][_0xdf29('0x12')]);}else{logger[_0xdf29('0x13')]('ZohoField,\x20%s,\x20%s',_0x4a0d71,_0xdf29('0xd'));_0x2ce191(_0x2a0512['result'][_0xdf29('0x12')]);}})[_0xdf29('0x14')](function(_0x1d70ce){logger[_0xdf29('0x10')](_0xdf29('0xc'),_0x4a0d71,_0x1d70ce);_0x2acbcd(_0x1d70ce);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 787e0ba..77be358 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2de48c,_0x5a41ce){var _0x300748=function(_0x446a60){while(--_0x446a60){_0x2de48c['push'](_0x2de48c['shift']());}};_0x300748(++_0x5a41ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f62ef,_0x10d18f){_0x3f62ef=_0x3f62ef-0x0;var _0x490b65=_0xedd9[_0x3f62ef];return _0x490b65;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5a2981,_0x2c94cb){var _0x27801f=function(_0x33b540){while(--_0x33b540){_0x5a2981['push'](_0x5a2981['shift']());}};_0x27801f(++_0x2c94cb);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 70eb169..02920dc 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 _0x4a1d=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x4edcbd,_0x1a6285){var _0x34686d=function(_0x736527){while(--_0x736527){_0x4edcbd['push'](_0x4edcbd['shift']());}};_0x34686d(++_0x1a6285);}(_0x4a1d,0x77));var _0xd4a1=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x4a1d[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]={'name':{'type':Sequelize[_0xd4a1('0x2')],'allowNull':![],'unique':_0xd4a1('0x3')},'version':{'type':Sequelize[_0xd4a1('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xd4a1('0x2')],'defaultValue':_0xd4a1('0x4')},'filename':{'type':Sequelize[_0xd4a1('0x2')]},'path':{'type':Sequelize[_0xd4a1('0x2')]},'type':{'type':Sequelize[_0xd4a1('0x2')]},'size':{'type':Sequelize[_0xd4a1('0x5')]},'active':{'type':Sequelize[_0xd4a1('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xd4a1('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xd4a1('0x2')],'unique':_0xd4a1('0x7')},'description':{'type':Sequelize[_0xd4a1('0x2')]},'title':{'type':Sequelize[_0xd4a1('0x2')]},'remoteUri':{'type':Sequelize[_0xd4a1('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x4a2e=['exports','STRING','unique_name_and_version','app.js','INTEGER','sequelize'];(function(_0x114967,_0x2af542){var _0x4633bc=function(_0x3583bd){while(--_0x3583bd){_0x114967['push'](_0x114967['shift']());}};_0x4633bc(++_0x2af542);}(_0x4a2e,0x125));var _0xe4a2=function(_0x190725,_0x4c879f){_0x190725=_0x190725-0x0;var _0x4fe2de=_0x4a2e[_0x190725];return _0x4fe2de;};'use strict';var Sequelize=require(_0xe4a2('0x0'));module[_0xe4a2('0x1')]={'name':{'type':Sequelize[_0xe4a2('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xe4a2('0x2')],'allowNull':![],'unique':_0xe4a2('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xe4a2('0x4')},'filename':{'type':Sequelize[_0xe4a2('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xe4a2('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xe4a2('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xe4a2('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xe4a2('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xe4a2('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 c259dd8..6c8656c 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 _0x6343=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','Integration','then','rows','catch','show','params','keys','includeAll','include','create','body','find','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length'];(function(_0x3b827e,_0x1d61cb){var _0x2b611b=function(_0x5adf6e){while(--_0x5adf6e){_0x3b827e['push'](_0x3b827e['shift']());}};_0x2b611b(++_0x1d61cb);}(_0x6343,0x168));var _0x3634=function(_0x512af9,_0x2f936d){_0x512af9=_0x512af9-0x0;var _0x3ded14=_0x6343[_0x512af9];return _0x3ded14;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['Integration'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));}; \ No newline at end of file +var _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x2dfe07,_0x2b663f){var _0x30aee0=function(_0x1a070a){while(--_0x1a070a){_0x2dfe07['push'](_0x2dfe07['shift']());}};_0x30aee0(++_0x2b663f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x570a9b,_0x63e837){_0x570a9b=_0x570a9b-0x0;var _0x4ffff4=_0xc6ac[_0x570a9b];return _0x4ffff4;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 79293c8..3ff9f47 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 _0x2934=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2934,0xc4));var _0x4293=function(_0x6ada44,_0xb3fc57){_0x6ada44=_0x6ada44-0x0;var _0x22fda5=_0x2934[_0x6ada44];return _0x22fda5;};'use strict';var _=require(_0x4293('0x0'));var util=require('util');var logger=require(_0x4293('0x1'))(_0x4293('0x2'));var moment=require(_0x4293('0x3'));var BPromise=require(_0x4293('0x4'));var rp=require(_0x4293('0x5'));var fs=require('fs');var path=require(_0x4293('0x6'));var rimraf=require(_0x4293('0x7'));var config=require(_0x4293('0x8'));var attributes=require(_0x4293('0x9'));module[_0x4293('0xa')]=function(_0x194c32,_0x327b5f){return _0x194c32[_0x4293('0xb')](_0x4293('0xc'),attributes,{'tableName':_0x4293('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaae9=['../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0xaae9,0xfc));var _0x9aae=function(_0x13c297,_0x45c7d3){_0x13c297=_0x13c297-0x0;var _0x539672=_0xaae9[_0x13c297];return _0x539672;};'use strict';var _=require(_0x9aae('0x0'));var util=require(_0x9aae('0x1'));var logger=require(_0x9aae('0x2'))(_0x9aae('0x3'));var moment=require(_0x9aae('0x4'));var BPromise=require(_0x9aae('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aae('0x6'));var rimraf=require(_0x9aae('0x7'));var config=require(_0x9aae('0x8'));var attributes=require('./integration.attributes');module[_0x9aae('0x9')]=function(_0x2188bf,_0x364509){return _0x2188bf[_0x9aae('0xa')](_0x9aae('0xb'),attributes,{'tableName':_0x9aae('0xc'),'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 acb3426..938202a 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2a4dda,_0x394a1b){var _0xe725e=function(_0x5c005c){while(--_0x5c005c){_0x2a4dda['push'](_0x2a4dda['shift']());}};_0xe725e(++_0x394a1b);}(_0x2ef3,0xba));var _0x32ef=function(_0x468d60,_0x29b9bc){_0x468d60=_0x468d60-0x0;var _0x34c018=_0x2ef3[_0x468d60];return _0x34c018;};'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')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 415e57f..5df011a 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0295,0x1f0));var _0x5029=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x0295[_0x3a3758];return _0x1a9234;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x16954c,_0x2f3051){var _0x93e220=function(_0x539dd1){while(--_0x539dd1){_0x16954c['push'](_0x16954c['shift']());}};_0x93e220(++_0x2f3051);}(_0x1a85,0x178));var _0x51a8=function(_0x447b23,_0x49c577){_0x447b23=_0x447b23-0x0;var _0x2f37c7=_0x1a85[_0x447b23];return _0x2f37c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 294a2da..ad70d35 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 _0xcc1f=['SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM'];(function(_0x4a7bcf,_0x44b127){var _0x52162c=function(_0x59a804){while(--_0x59a804){_0x4a7bcf['push'](_0x4a7bcf['shift']());}};_0x52162c(++_0x44b127);}(_0xcc1f,0x154));var _0xfcc1=function(_0x212cf4,_0x291156){_0x212cf4=_0x212cf4-0x0;var _0x252bd2=_0xcc1f[_0x212cf4];return _0x252bd2;};'use strict';var Sequelize=require(_0xfcc1('0x0'));module[_0xfcc1('0x1')]={'integration':{'type':Sequelize[_0xfcc1('0x2')]},'eventChannel':{'type':Sequelize[_0xfcc1('0x2')]},'exitStatus':{'type':Sequelize[_0xfcc1('0x2')]},'ticketId':{'type':Sequelize[_0xfcc1('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfcc1('0x2')]},'calleridnum':{'type':Sequelize[_0xfcc1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfcc1('0x2')]},'membername':{'type':Sequelize[_0xfcc1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfcc1('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfcc1('0x3')]},'holdtime':{'type':Sequelize[_0xfcc1('0x4')]},'agentcomplete':{'type':Sequelize[_0xfcc1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xfcc1('0x3')]},'talktime':{'type':Sequelize[_0xfcc1('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfcc1('0x4')]},'reason':{'type':Sequelize[_0xfcc1('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xfcc1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xfcc1('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfcc1('0x4')]},'channelstatedesc':{'type':Sequelize[_0xfcc1('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfcc1('0x2')]},'connectedlinename':{'type':Sequelize[_0xfcc1('0x2')]},'language':{'type':Sequelize[_0xfcc1('0x2')]},'accountcode':{'type':Sequelize[_0xfcc1('0x2')]},'context':{'type':Sequelize[_0xfcc1('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xfcc1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xfcc1('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfcc1('0x2')]},'destcalleridname':{'type':Sequelize[_0xfcc1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfcc1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xfcc1('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xfcc1('0x2')]},'destcontext':{'type':Sequelize[_0xfcc1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xfcc1('0x2')]},'messageId':{'type':Sequelize[_0xfcc1('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xfcc1('0x2')]},'from':{'type':Sequelize[_0xfcc1('0x2')]},'to':{'type':Sequelize[_0xfcc1('0x2')]},'cc':{'type':Sequelize[_0xfcc1('0x2')]},'attachment':{'type':Sequelize[_0xfcc1('0x6')]},'html':{'type':Sequelize[_0xfcc1('0x6')]},'text':{'type':Sequelize[_0xfcc1('0x6')]},'status':{'type':Sequelize[_0xfcc1('0x7')](_0xfcc1('0x8'),_0xfcc1('0x9'),_0xfcc1('0xa'),_0xfcc1('0xb'))},'url':{'type':Sequelize[_0xfcc1('0x2')]},'app':{'type':Sequelize[_0xfcc1('0x2')]},'appdata':{'type':Sequelize[_0xfcc1('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xeddd=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x58b5d7,_0x79ca8a){var _0x817269=function(_0x58dd9f){while(--_0x58dd9f){_0x58b5d7['push'](_0x58b5d7['shift']());}};_0x817269(++_0x79ca8a);}(_0xeddd,0x1d1));var _0xdedd=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xeddd[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0xdedd('0x0'));module[_0xdedd('0x1')]={'integration':{'type':Sequelize[_0xdedd('0x2')]},'eventChannel':{'type':Sequelize[_0xdedd('0x2')]},'exitStatus':{'type':Sequelize[_0xdedd('0x2')]},'ticketId':{'type':Sequelize[_0xdedd('0x2')]},'integrationId':{'type':Sequelize[_0xdedd('0x3')]},'contacts':{'type':Sequelize[_0xdedd('0x2')]},'uniqueid':{'type':Sequelize[_0xdedd('0x2')]},'calleridnum':{'type':Sequelize[_0xdedd('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdedd('0x2')]},'interface':{'type':Sequelize[_0xdedd('0x2')]},'membername':{'type':Sequelize[_0xdedd('0x2')]},'agentcalledAt':{'type':Sequelize[_0xdedd('0x4')]},'agentconnectAt':{'type':Sequelize[_0xdedd('0x4')]},'holdtime':{'type':Sequelize[_0xdedd('0x3')]},'agentcomplete':{'type':Sequelize[_0xdedd('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xdedd('0x4')]},'talktime':{'type':Sequelize[_0xdedd('0x3')]},'agentacw':{'type':Sequelize[_0xdedd('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdedd('0x3')]},'reason':{'type':Sequelize[_0xdedd('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xdedd('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xdedd('0x4')]},'agentdump':{'type':Sequelize[_0xdedd('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xdedd('0x4')]},'lastevent':{'type':Sequelize[_0xdedd('0x2')]},'channel':{'type':Sequelize[_0xdedd('0x2')]},'channelstate':{'type':Sequelize[_0xdedd('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdedd('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdedd('0x2')]},'connectedlinename':{'type':Sequelize[_0xdedd('0x2')]},'language':{'type':Sequelize[_0xdedd('0x2')]},'accountcode':{'type':Sequelize[_0xdedd('0x2')]},'context':{'type':Sequelize[_0xdedd('0x2')]},'exten':{'type':Sequelize[_0xdedd('0x2')]},'priority':{'type':Sequelize[_0xdedd('0x2')]},'destchannel':{'type':Sequelize[_0xdedd('0x2')]},'destchannelstate':{'type':Sequelize[_0xdedd('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xdedd('0x2')]},'destcalleridnum':{'type':Sequelize[_0xdedd('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xdedd('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xdedd('0x2')]},'destlanguage':{'type':Sequelize[_0xdedd('0x2')]},'destaccountcode':{'type':Sequelize[_0xdedd('0x2')]},'destcontext':{'type':Sequelize[_0xdedd('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xdedd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xdedd('0x2')]},'inReplyTo':{'type':Sequelize[_0xdedd('0x2')]},'subject':{'type':Sequelize[_0xdedd('0x2')]},'from':{'type':Sequelize[_0xdedd('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdedd('0x2')]},'attachment':{'type':Sequelize[_0xdedd('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xdedd('0x6')]},'status':{'type':Sequelize[_0xdedd('0x7')]('SENT',_0xdedd('0x8'),_0xdedd('0x9'),_0xdedd('0xa'))},'url':{'type':Sequelize[_0xdedd('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xdedd('0x2')]},'projectId':{'type':Sequelize[_0xdedd('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c23125b..8eefe70 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 _0xfd34=['where','VIRTUAL','options','includeAll','include','rows','catch','show','length','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','merge'];(function(_0x1b54ae,_0x5ce3d7){var _0x925c35=function(_0x33c039){while(--_0x33c039){_0x1b54ae['push'](_0x1b54ae['shift']());}};_0x925c35(++_0x5ce3d7);}(_0xfd34,0x142));var _0x4fd3=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0xfd34[_0x58f245];return _0x1f0cfb;};'use strict';var emlformat=require(_0x4fd3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fd3('0x1'));var jsonpatch=require(_0x4fd3('0x2'));var rp=require(_0x4fd3('0x3'));var moment=require(_0x4fd3('0x4'));var BPromise=require(_0x4fd3('0x5'));var Mustache=require(_0x4fd3('0x6'));var util=require(_0x4fd3('0x7'));var path=require(_0x4fd3('0x8'));var sox=require('sox');var csv=require(_0x4fd3('0x9'));var ejs=require(_0x4fd3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fd3('0xb'));var squel=require(_0x4fd3('0xc'));var crypto=require(_0x4fd3('0xd'));var jsforce=require(_0x4fd3('0xe'));var deskjs=require(_0x4fd3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4fd3('0x10'));var Papa=require(_0x4fd3('0x11'));var Redis=require(_0x4fd3('0x12'));var authService=require(_0x4fd3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4fd3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fd3('0x15'))(_0x4fd3('0x16'));var utils=require('../../config/utils');var config=require(_0x4fd3('0x17'));var licenseUtil=require(_0x4fd3('0x18'));var db=require(_0x4fd3('0x19'))['db'];function respondWithStatusCode(_0x5357e6,_0x550b6c){_0x550b6c=_0x550b6c||0xcc;return function(_0x14e503){if(_0x14e503){return _0x5357e6[_0x4fd3('0x1a')](_0x550b6c);}return _0x5357e6['status'](_0x550b6c)[_0x4fd3('0x1b')]();};}function respondWithResult(_0xe0070e,_0x4f9246){_0x4f9246=_0x4f9246||0xc8;return function(_0xc03237){if(_0xc03237){return _0xe0070e[_0x4fd3('0x1c')](_0x4f9246)[_0x4fd3('0x1d')](_0xc03237);}};}function respondWithFilteredResult(_0xb992f3,_0x6c6f89){return function(_0x5da4cd){if(_0x5da4cd){var _0x2ed48f=typeof _0x6c6f89['offset']===_0x4fd3('0x1e')&&typeof _0x6c6f89[_0x4fd3('0x1f')]===_0x4fd3('0x1e');var _0x329e41=_0x5da4cd['count'];var _0x12df31=_0x2ed48f?0x0:_0x6c6f89[_0x4fd3('0x20')];var _0x567ea2=_0x2ed48f?_0x5da4cd[_0x4fd3('0x21')]:_0x6c6f89[_0x4fd3('0x20')]+_0x6c6f89[_0x4fd3('0x1f')];var _0x3c7dcc;if(_0x567ea2>=_0x329e41){_0x567ea2=_0x329e41;_0x3c7dcc=0xc8;}else{_0x3c7dcc=0xce;}_0xb992f3[_0x4fd3('0x1c')](_0x3c7dcc);return _0xb992f3[_0x4fd3('0x22')]('Content-Range',_0x12df31+'-'+_0x567ea2+'/'+_0x329e41)[_0x4fd3('0x1d')](_0x5da4cd);}return null;};}function patchUpdates(_0x44d816){return function(_0x25bb61){try{jsonpatch[_0x4fd3('0x23')](_0x25bb61,_0x44d816,!![]);}catch(_0x3f992f){return BPromise[_0x4fd3('0x24')](_0x3f992f);}return _0x25bb61[_0x4fd3('0x25')]();};}function saveUpdates(_0x4d3527,_0x38d9e4){return function(_0x429ce7){if(_0x429ce7){return _0x429ce7[_0x4fd3('0x26')](_0x4d3527)[_0x4fd3('0x27')](function(_0x59e2f6){return _0x59e2f6;});}return null;};}function removeEntity(_0x51b455,_0x3d1342){return function(_0x202e10){if(_0x202e10){return _0x202e10[_0x4fd3('0x28')]()[_0x4fd3('0x27')](function(){_0x51b455['status'](0xcc)[_0x4fd3('0x1b')]();});}};}function handleEntityNotFound(_0x34cf71,_0x2ad335){return function(_0xe9ec71){if(!_0xe9ec71){_0x34cf71[_0x4fd3('0x1a')](0x194);}return _0xe9ec71;};}function handleError(_0xe230db,_0x7031){_0x7031=_0x7031||0x1f4;return function(_0x252386){logger[_0x4fd3('0x29')](_0x252386[_0x4fd3('0x2a')]);if(_0x252386['name']){delete _0x252386['name'];}_0xe230db['status'](_0x7031)[_0x4fd3('0x2b')](_0x252386);};}exports[_0x4fd3('0x2c')]=function(_0x1272b8,_0xc3e617){var _0x1fc48f={},_0x9703a0={},_0x588a74={'count':0x0,'rows':[]};var _0x321d56=_[_0x4fd3('0x2d')](db[_0x4fd3('0x2e')][_0x4fd3('0x2f')],function(_0x88c98f){return{'name':_0x88c98f[_0x4fd3('0x30')],'type':_0x88c98f[_0x4fd3('0x31')][_0x4fd3('0x32')]};});_0x9703a0[_0x4fd3('0x33')]=_[_0x4fd3('0x2d')](_0x321d56,_0x4fd3('0x34'));_0x9703a0[_0x4fd3('0x35')]=_[_0x4fd3('0x36')](_0x1272b8[_0x4fd3('0x35')]);_0x9703a0[_0x4fd3('0x37')]=_[_0x4fd3('0x38')](_0x9703a0[_0x4fd3('0x33')],_0x9703a0[_0x4fd3('0x35')]);_0x1fc48f[_0x4fd3('0x39')]=_[_0x4fd3('0x38')](_0x9703a0[_0x4fd3('0x33')],qs[_0x4fd3('0x3a')](_0x1272b8[_0x4fd3('0x35')][_0x4fd3('0x3a')]));_0x1fc48f[_0x4fd3('0x39')]=_0x1fc48f[_0x4fd3('0x39')]['length']?_0x1fc48f[_0x4fd3('0x39')]:_0x9703a0[_0x4fd3('0x33')];if(!_0x1272b8[_0x4fd3('0x35')][_0x4fd3('0x3b')](_0x4fd3('0x3c'))){_0x1fc48f[_0x4fd3('0x1f')]=qs['limit'](_0x1272b8[_0x4fd3('0x35')][_0x4fd3('0x1f')]);_0x1fc48f['offset']=qs['offset'](_0x1272b8[_0x4fd3('0x35')][_0x4fd3('0x20')]);}_0x1fc48f['order']=qs[_0x4fd3('0x3d')](_0x1272b8[_0x4fd3('0x35')][_0x4fd3('0x3d')]);_0x1fc48f['where']=qs[_0x4fd3('0x37')](_['pick'](_0x1272b8['query'],_0x9703a0[_0x4fd3('0x37')]),_0x321d56);if(_0x1272b8[_0x4fd3('0x35')]['filter']){_0x1fc48f['where']=_[_0x4fd3('0x3e')](_0x1fc48f[_0x4fd3('0x3f')],{'$or':_[_0x4fd3('0x2d')](_0x321d56,function(_0x4fc520){if(_0x4fc520[_0x4fd3('0x31')]!==_0x4fd3('0x40')){var _0x1cd205={};_0x1cd205[_0x4fc520[_0x4fd3('0x34')]]={'$like':'%'+_0x1272b8[_0x4fd3('0x35')]['filter']+'%'};return _0x1cd205;}})});}_0x1fc48f=_[_0x4fd3('0x3e')]({},_0x1fc48f,_0x1272b8[_0x4fd3('0x41')]);var _0x3d7ce6={'where':_0x1fc48f[_0x4fd3('0x3f')]};return db[_0x4fd3('0x2e')]['count'](_0x3d7ce6)[_0x4fd3('0x27')](function(_0x3aada0){_0x588a74['count']=_0x3aada0;if(_0x1272b8[_0x4fd3('0x35')][_0x4fd3('0x42')]){_0x1fc48f[_0x4fd3('0x43')]=[{'all':!![]}];}return db[_0x4fd3('0x2e')]['findAll'](_0x1fc48f);})['then'](function(_0x562270){_0x588a74[_0x4fd3('0x44')]=_0x562270;return _0x588a74;})['then'](respondWithFilteredResult(_0xc3e617,_0x1fc48f))[_0x4fd3('0x45')](handleError(_0xc3e617,null));};exports[_0x4fd3('0x46')]=function(_0x12408a,_0x407ba2){var _0x14d51d={'raw':![],'where':{'id':_0x12408a['params']['id']}},_0x191730={};_0x191730[_0x4fd3('0x33')]=_[_0x4fd3('0x36')](db[_0x4fd3('0x2e')][_0x4fd3('0x2f')]);_0x191730[_0x4fd3('0x35')]=_[_0x4fd3('0x36')](_0x12408a[_0x4fd3('0x35')]);_0x191730[_0x4fd3('0x37')]=_[_0x4fd3('0x38')](_0x191730['model'],_0x191730[_0x4fd3('0x35')]);_0x14d51d[_0x4fd3('0x39')]=_[_0x4fd3('0x38')](_0x191730[_0x4fd3('0x33')],qs[_0x4fd3('0x3a')](_0x12408a[_0x4fd3('0x35')][_0x4fd3('0x3a')]));_0x14d51d[_0x4fd3('0x39')]=_0x14d51d[_0x4fd3('0x39')][_0x4fd3('0x47')]?_0x14d51d['attributes']:_0x191730[_0x4fd3('0x33')];if(_0x12408a[_0x4fd3('0x35')]['includeAll']){_0x14d51d['include']=[{'all':!![]}];}_0x14d51d=_['merge']({},_0x14d51d,_0x12408a[_0x4fd3('0x41')]);return db[_0x4fd3('0x2e')]['find'](_0x14d51d)[_0x4fd3('0x27')](handleEntityNotFound(_0x407ba2,null))[_0x4fd3('0x27')](respondWithResult(_0x407ba2,null))['catch'](handleError(_0x407ba2,null));};exports[_0x4fd3('0x48')]=function(_0x5d5d88,_0x4ae7a1){return db[_0x4fd3('0x2e')][_0x4fd3('0x48')](_0x5d5d88[_0x4fd3('0x49')],{})[_0x4fd3('0x27')](respondWithResult(_0x4ae7a1,0xc9))[_0x4fd3('0x45')](handleError(_0x4ae7a1,null));};exports[_0x4fd3('0x26')]=function(_0x643c34,_0x29ce09){if(_0x643c34[_0x4fd3('0x49')]['id']){delete _0x643c34[_0x4fd3('0x49')]['id'];}return db[_0x4fd3('0x2e')][_0x4fd3('0x4a')]({'where':{'id':_0x643c34[_0x4fd3('0x4b')]['id']}})[_0x4fd3('0x27')](handleEntityNotFound(_0x29ce09,null))['then'](saveUpdates(_0x643c34['body'],null))[_0x4fd3('0x27')](respondWithResult(_0x29ce09,null))[_0x4fd3('0x45')](handleError(_0x29ce09,null));};exports[_0x4fd3('0x28')]=function(_0x23e735,_0x4e4b99){return db[_0x4fd3('0x2e')][_0x4fd3('0x4a')]({'where':{'id':_0x23e735[_0x4fd3('0x4b')]['id']}})[_0x4fd3('0x27')](handleEntityNotFound(_0x4e4b99,null))[_0x4fd3('0x27')](removeEntity(_0x4e4b99,null))[_0x4fd3('0x45')](handleError(_0x4e4b99,null));};exports[_0x4fd3('0x4c')]=function(_0x2d1749,_0x5af69a){return db[_0x4fd3('0x2e')][_0x4fd3('0x4c')]()[_0x4fd3('0x27')](respondWithResult(_0x5af69a,null))[_0x4fd3('0x45')](handleError(_0x5af69a,null));}; \ No newline at end of file +var _0x415f=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x415f,0x1bf));var _0xf415=function(_0x1dce7c,_0x49b6fc){_0x1dce7c=_0x1dce7c-0x0;var _0x165719=_0x415f[_0x1dce7c];return _0x165719;};'use strict';var emlformat=require(_0xf415('0x0'));var rimraf=require(_0xf415('0x1'));var zipdir=require(_0xf415('0x2'));var jsonpatch=require(_0xf415('0x3'));var rp=require(_0xf415('0x4'));var moment=require('moment');var BPromise=require(_0xf415('0x5'));var Mustache=require(_0xf415('0x6'));var util=require(_0xf415('0x7'));var path=require(_0xf415('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf415('0x9'));var fs=require('fs');var fs_extra=require(_0xf415('0xa'));var _=require(_0xf415('0xb'));var squel=require(_0xf415('0xc'));var crypto=require(_0xf415('0xd'));var jsforce=require(_0xf415('0xe'));var deskjs=require(_0xf415('0xf'));var toCsv=require(_0xf415('0x10'));var querystring=require(_0xf415('0x11'));var Papa=require('papaparse');var Redis=require(_0xf415('0x12'));var authService=require(_0xf415('0x13'));var qs=require(_0xf415('0x14'));var as=require(_0xf415('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf415('0x16'))(_0xf415('0x17'));var utils=require(_0xf415('0x18'));var config=require(_0xf415('0x19'));var licenseUtil=require(_0xf415('0x1a'));var db=require(_0xf415('0x1b'))['db'];function respondWithStatusCode(_0x4a4803,_0x363a67){_0x363a67=_0x363a67||0xcc;return function(_0x191d33){if(_0x191d33){return _0x4a4803[_0xf415('0x1c')](_0x363a67);}return _0x4a4803[_0xf415('0x1d')](_0x363a67)[_0xf415('0x1e')]();};}function respondWithResult(_0x4663ac,_0x22dc63){_0x22dc63=_0x22dc63||0xc8;return function(_0x501f78){if(_0x501f78){return _0x4663ac[_0xf415('0x1d')](_0x22dc63)['json'](_0x501f78);}};}function respondWithFilteredResult(_0x4a1011,_0x1566dd){return function(_0x4ada95){if(_0x4ada95){var _0x40c45d=typeof _0x1566dd[_0xf415('0x1f')]===_0xf415('0x20')&&typeof _0x1566dd[_0xf415('0x21')]===_0xf415('0x20');var _0xaf47b7=_0x4ada95[_0xf415('0x22')];var _0x1103d8=_0x40c45d?0x0:_0x1566dd[_0xf415('0x1f')];var _0x2c8c8b=_0x40c45d?_0x4ada95[_0xf415('0x22')]:_0x1566dd[_0xf415('0x1f')]+_0x1566dd[_0xf415('0x21')];var _0xccca53;if(_0x2c8c8b>=_0xaf47b7){_0x2c8c8b=_0xaf47b7;_0xccca53=0xc8;}else{_0xccca53=0xce;}_0x4a1011[_0xf415('0x1d')](_0xccca53);return _0x4a1011[_0xf415('0x23')](_0xf415('0x24'),_0x1103d8+'-'+_0x2c8c8b+'/'+_0xaf47b7)[_0xf415('0x25')](_0x4ada95);}return null;};}function patchUpdates(_0x3b3cbc){return function(_0x2d4329){try{jsonpatch[_0xf415('0x26')](_0x2d4329,_0x3b3cbc,!![]);}catch(_0x5aedc7){return BPromise[_0xf415('0x27')](_0x5aedc7);}return _0x2d4329[_0xf415('0x28')]();};}function saveUpdates(_0x1d317c,_0x4f9b92){return function(_0x457b5){if(_0x457b5){return _0x457b5[_0xf415('0x29')](_0x1d317c)[_0xf415('0x2a')](function(_0x58b4be){return _0x58b4be;});}return null;};}function removeEntity(_0x3b5214,_0x23f36b){return function(_0x2134b9){if(_0x2134b9){return _0x2134b9[_0xf415('0x2b')]()[_0xf415('0x2a')](function(){_0x3b5214[_0xf415('0x1d')](0xcc)[_0xf415('0x1e')]();});}};}function handleEntityNotFound(_0x1f0fd7,_0x5c80a5){return function(_0x2bcd1c){if(!_0x2bcd1c){_0x1f0fd7[_0xf415('0x1c')](0x194);}return _0x2bcd1c;};}function handleError(_0x59d852,_0x58ad22){_0x58ad22=_0x58ad22||0x1f4;return function(_0x599b15){logger['error'](_0x599b15[_0xf415('0x2c')]);if(_0x599b15[_0xf415('0x2d')]){delete _0x599b15['name'];}_0x59d852[_0xf415('0x1d')](_0x58ad22)['send'](_0x599b15);};}exports['index']=function(_0x550188,_0x126f4a){var _0x54981a={},_0x9c282={},_0x25e21c={'count':0x0,'rows':[]};var _0x4e02ab=_[_0xf415('0x2e')](db[_0xf415('0x2f')][_0xf415('0x30')],function(_0x2076ca){return{'name':_0x2076ca[_0xf415('0x31')],'type':_0x2076ca[_0xf415('0x32')]['key']};});_0x9c282['model']=_[_0xf415('0x2e')](_0x4e02ab,_0xf415('0x2d'));_0x9c282['query']=_[_0xf415('0x33')](_0x550188[_0xf415('0x34')]);_0x9c282[_0xf415('0x35')]=_[_0xf415('0x36')](_0x9c282[_0xf415('0x37')],_0x9c282[_0xf415('0x34')]);_0x54981a['attributes']=_[_0xf415('0x36')](_0x9c282[_0xf415('0x37')],qs[_0xf415('0x38')](_0x550188[_0xf415('0x34')]['fields']));_0x54981a[_0xf415('0x39')]=_0x54981a[_0xf415('0x39')]['length']?_0x54981a[_0xf415('0x39')]:_0x9c282['model'];if(!_0x550188['query'][_0xf415('0x3a')]('nolimit')){_0x54981a['limit']=qs[_0xf415('0x21')](_0x550188[_0xf415('0x34')]['limit']);_0x54981a[_0xf415('0x1f')]=qs[_0xf415('0x1f')](_0x550188[_0xf415('0x34')][_0xf415('0x1f')]);}_0x54981a[_0xf415('0x3b')]=qs['sort'](_0x550188[_0xf415('0x34')]['sort']);_0x54981a[_0xf415('0x3c')]=qs['filters'](_[_0xf415('0x3d')](_0x550188[_0xf415('0x34')],_0x9c282['filters']),_0x4e02ab);if(_0x550188[_0xf415('0x34')]['filter']){_0x54981a[_0xf415('0x3c')]=_[_0xf415('0x3e')](_0x54981a[_0xf415('0x3c')],{'$or':_[_0xf415('0x2e')](_0x4e02ab,function(_0x8ace7a){if(_0x8ace7a[_0xf415('0x32')]!==_0xf415('0x3f')){var _0x5341db={};_0x5341db[_0x8ace7a['name']]={'$like':'%'+_0x550188[_0xf415('0x34')][_0xf415('0x40')]+'%'};return _0x5341db;}})});}_0x54981a=_[_0xf415('0x3e')]({},_0x54981a,_0x550188[_0xf415('0x41')]);var _0xc18204={'where':_0x54981a['where']};return db[_0xf415('0x2f')][_0xf415('0x22')](_0xc18204)[_0xf415('0x2a')](function(_0x1e2e27){_0x25e21c[_0xf415('0x22')]=_0x1e2e27;if(_0x550188[_0xf415('0x34')][_0xf415('0x42')]){_0x54981a[_0xf415('0x43')]=[{'all':!![]}];}return db[_0xf415('0x2f')][_0xf415('0x44')](_0x54981a);})[_0xf415('0x2a')](function(_0x594a17){_0x25e21c['rows']=_0x594a17;return _0x25e21c;})[_0xf415('0x2a')](respondWithFilteredResult(_0x126f4a,_0x54981a))['catch'](handleError(_0x126f4a,null));};exports[_0xf415('0x45')]=function(_0x438f9e,_0x2e97c8){var _0x33a2f2={'raw':![],'where':{'id':_0x438f9e['params']['id']}},_0x2458e9={};_0x2458e9[_0xf415('0x37')]=_[_0xf415('0x33')](db[_0xf415('0x2f')][_0xf415('0x30')]);_0x2458e9[_0xf415('0x34')]=_[_0xf415('0x33')](_0x438f9e[_0xf415('0x34')]);_0x2458e9[_0xf415('0x35')]=_[_0xf415('0x36')](_0x2458e9[_0xf415('0x37')],_0x2458e9[_0xf415('0x34')]);_0x33a2f2[_0xf415('0x39')]=_[_0xf415('0x36')](_0x2458e9['model'],qs[_0xf415('0x38')](_0x438f9e[_0xf415('0x34')][_0xf415('0x38')]));_0x33a2f2[_0xf415('0x39')]=_0x33a2f2['attributes']['length']?_0x33a2f2[_0xf415('0x39')]:_0x2458e9[_0xf415('0x37')];if(_0x438f9e[_0xf415('0x34')][_0xf415('0x42')]){_0x33a2f2[_0xf415('0x43')]=[{'all':!![]}];}_0x33a2f2=_[_0xf415('0x3e')]({},_0x33a2f2,_0x438f9e['options']);return db[_0xf415('0x2f')][_0xf415('0x46')](_0x33a2f2)[_0xf415('0x2a')](handleEntityNotFound(_0x2e97c8,null))[_0xf415('0x2a')](respondWithResult(_0x2e97c8,null))['catch'](handleError(_0x2e97c8,null));};exports[_0xf415('0x47')]=function(_0x2d435c,_0x1b12bc){return db[_0xf415('0x2f')]['create'](_0x2d435c[_0xf415('0x48')],{})[_0xf415('0x2a')](respondWithResult(_0x1b12bc,0xc9))[_0xf415('0x49')](handleError(_0x1b12bc,null));};exports[_0xf415('0x29')]=function(_0x29053b,_0x24d94b){if(_0x29053b['body']['id']){delete _0x29053b[_0xf415('0x48')]['id'];}return db[_0xf415('0x2f')][_0xf415('0x46')]({'where':{'id':_0x29053b[_0xf415('0x4a')]['id']}})[_0xf415('0x2a')](handleEntityNotFound(_0x24d94b,null))[_0xf415('0x2a')](saveUpdates(_0x29053b[_0xf415('0x48')],null))[_0xf415('0x2a')](respondWithResult(_0x24d94b,null))[_0xf415('0x49')](handleError(_0x24d94b,null));};exports[_0xf415('0x2b')]=function(_0x372138,_0x2f8501){return db[_0xf415('0x2f')][_0xf415('0x46')]({'where':{'id':_0x372138[_0xf415('0x4a')]['id']}})[_0xf415('0x2a')](handleEntityNotFound(_0x2f8501,null))[_0xf415('0x2a')](removeEntity(_0x2f8501,null))['catch'](handleError(_0x2f8501,null));};exports[_0xf415('0x4b')]=function(_0x59e9b1,_0x4b352a){return db[_0xf415('0x2f')][_0xf415('0x4b')]()[_0xf415('0x2a')](respondWithResult(_0x4b352a,null))['catch'](handleError(_0x4b352a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 244f031..726a76f 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 _0x4398=['rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','moment','bluebird','request-promise','path'];(function(_0x3d7f45,_0x51db57){var _0x7c08df=function(_0x175d7f){while(--_0x175d7f){_0x3d7f45['push'](_0x3d7f45['shift']());}};_0x7c08df(++_0x51db57);}(_0x4398,0x132));var _0x8439=function(_0x2f4141,_0x2a9971){_0x2f4141=_0x2f4141-0x0;var _0x274b8e=_0x4398[_0x2f4141];return _0x274b8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8439('0x0'));var BPromise=require(_0x8439('0x1'));var rp=require(_0x8439('0x2'));var fs=require('fs');var path=require(_0x8439('0x3'));var rimraf=require(_0x8439('0x4'));var config=require(_0x8439('0x5'));var attributes=require(_0x8439('0x6'));module['exports']=function(_0x5e084c,_0x30f120){return _0x5e084c[_0x8439('0x7')](_0x8439('0x8'),attributes,{'tableName':_0x8439('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c8a=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3290e1,_0x4b0b16){var _0x19ff14=function(_0x240f42){while(--_0x240f42){_0x3290e1['push'](_0x3290e1['shift']());}};_0x19ff14(++_0x4b0b16);}(_0x9c8a,0x1cf));var _0xa9c8=function(_0x35b690,_0x561045){_0x35b690=_0x35b690-0x0;var _0xbb98a3=_0x9c8a[_0x35b690];return _0xbb98a3;};'use strict';var _=require('lodash');var util=require(_0xa9c8('0x0'));var logger=require(_0xa9c8('0x1'))(_0xa9c8('0x2'));var moment=require(_0xa9c8('0x3'));var BPromise=require(_0xa9c8('0x4'));var rp=require(_0xa9c8('0x5'));var fs=require('fs');var path=require(_0xa9c8('0x6'));var rimraf=require(_0xa9c8('0x7'));var config=require(_0xa9c8('0x8'));var attributes=require('./integrationReport.attributes');module[_0xa9c8('0x9')]=function(_0x4eba16,_0x2cb314){return _0x4eba16[_0xa9c8('0xa')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index ffa03a9..add95a1 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2a77ff,_0x489d1b){var _0x4bf3ef=function(_0xe8bb1e){while(--_0xe8bb1e){_0x2a77ff['push'](_0x2a77ff['shift']());}};_0x4bf3ef(++_0x489d1b);}(_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 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')]('IntegrationReport,\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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x21a4e4,_0x12146f){var _0x58f114=function(_0x535be4){while(--_0x535be4){_0x21a4e4['push'](_0x21a4e4['shift']());}};_0x58f114(++_0x12146f);}(_0xba34,0x119));var _0x4ba3=function(_0x5d32c8,_0x4ad76b){_0x5d32c8=_0x5d32c8-0x0;var _0xba3731=_0xba34[_0x5d32c8];return _0xba3731;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index eee9386..2e06267 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 _0x9075=['show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0x35d369,_0x3efbec){var _0xbfb4c9=function(_0x3a2184){while(--_0x3a2184){_0x35d369['push'](_0x35d369['shift']());}};_0xbfb4c9(++_0x3efbec);}(_0x9075,0x7a));var _0x5907=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0x9075[_0x43dc7e];return _0x21e12d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5907('0x0'));var timeout=require(_0x5907('0x1'));var express=require(_0x5907('0x2'));var router=express[_0x5907('0x3')]();var fs_extra=require(_0x5907('0x4'));var auth=require(_0x5907('0x5'));var interaction=require(_0x5907('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x5907('0x7')]('/',auth[_0x5907('0x8')](),controller['index']);router['get'](_0x5907('0x9'),auth['isAuthenticated'](),controller[_0x5907('0xa')]);router[_0x5907('0x7')](_0x5907('0xb'),auth['isAuthenticated'](),controller[_0x5907('0xc')]);router[_0x5907('0xd')]('/',auth[_0x5907('0x8')](),controller[_0x5907('0xe')]);router[_0x5907('0xd')](_0x5907('0xb'),auth[_0x5907('0x8')](),controller[_0x5907('0xf')]);router[_0x5907('0xd')](_0x5907('0x10'),auth[_0x5907('0x8')](),controller[_0x5907('0x11')]);router[_0x5907('0x12')](_0x5907('0x9'),auth[_0x5907('0x8')](),controller['update']);router[_0x5907('0x13')]('/:id',auth[_0x5907('0x8')](),controller[_0x5907('0x14')]);module[_0x5907('0x15')]=router; \ No newline at end of file +var _0x8343=['exports','multer','util','path','express','fs-extra','./interval.controller','get','isAuthenticated','/:id','show','getIntervals','post','create','/:id/sub_intervals','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy'];(function(_0x36e78e,_0x1fa22d){var _0x27c455=function(_0x1b0666){while(--_0x1b0666){_0x36e78e['push'](_0x36e78e['shift']());}};_0x27c455(++_0x1fa22d);}(_0x8343,0xa9));var _0x3834=function(_0x413f2b,_0x406b72){_0x413f2b=_0x413f2b-0x0;var _0x5b2682=_0x8343[_0x413f2b];return _0x5b2682;};'use strict';var multer=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var path=require(_0x3834('0x2'));var timeout=require('connect-timeout');var express=require(_0x3834('0x3'));var router=express['Router']();var fs_extra=require(_0x3834('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3834('0x5'));router[_0x3834('0x6')]('/',auth[_0x3834('0x7')](),controller['index']);router[_0x3834('0x6')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x9')]);router['get']('/:id/sub_intervals',auth[_0x3834('0x7')](),controller[_0x3834('0xa')]);router[_0x3834('0xb')]('/',auth[_0x3834('0x7')](),controller[_0x3834('0xc')]);router['post'](_0x3834('0xd'),auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x3834('0xe'),auth[_0x3834('0x7')](),controller[_0x3834('0xf')]);router[_0x3834('0x10')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x11')]);router[_0x3834('0x12')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x13')]);module[_0x3834('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index fb9a28a..c131e2c 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 _0xb00f=['STRING','sequelize'];(function(_0x37606b,_0xcced0c){var _0x4ed5b1=function(_0x259e09){while(--_0x259e09){_0x37606b['push'](_0x37606b['shift']());}};_0x4ed5b1(++_0xcced0c);}(_0xb00f,0x161));var _0xfb00=function(_0x1d31d0,_0x4fdb24){_0x1d31d0=_0x1d31d0-0x0;var _0x445ade=_0xb00f[_0x1d31d0];return _0x445ade;};'use strict';var Sequelize=require(_0xfb00('0x0'));module['exports']={'name':{'type':Sequelize[_0xfb00('0x1')]},'description':{'type':Sequelize[_0xfb00('0x1')]},'interval':{'type':Sequelize[_0xfb00('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xd9b0=['STRING','sequelize','exports'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xd9b0,0x151));var _0x0d9b=function(_0x54c7cf,_0x5060eb){_0x54c7cf=_0x54c7cf-0x0;var _0x4f94a0=_0xd9b0[_0x54c7cf];return _0x4f94a0;};'use strict';var Sequelize=require(_0x0d9b('0x0'));module[_0x0d9b('0x1')]={'name':{'type':Sequelize[_0x0d9b('0x2')]},'description':{'type':Sequelize[_0x0d9b('0x2')]},'interval':{'type':Sequelize[_0x0d9b('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 a9c108c..30fc037 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 _0x88e2=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','Intervals','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','type','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','bulkCreate','eml-format','zip-dir','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x1943d9,_0x245bb8){var _0x4b4f3f=function(_0x3bba90){while(--_0x3bba90){_0x1943d9['push'](_0x1943d9['shift']());}};_0x4b4f3f(++_0x245bb8);}(_0x88e2,0x1bd));var _0x288e=function(_0x5daab0,_0xbd7086){_0x5daab0=_0x5daab0-0x0;var _0x3a6a80=_0x88e2[_0x5daab0];return _0x3a6a80;};'use strict';var emlformat=require(_0x288e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x288e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x288e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x288e('0x3'));var util=require(_0x288e('0x4'));var path=require(_0x288e('0x5'));var sox=require(_0x288e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x288e('0x7'));var _=require(_0x288e('0x8'));var squel=require(_0x288e('0x9'));var crypto=require(_0x288e('0xa'));var jsforce=require(_0x288e('0xb'));var deskjs=require(_0x288e('0xc'));var toCsv=require(_0x288e('0xd'));var querystring=require(_0x288e('0xe'));var Papa=require(_0x288e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x288e('0x10'));var as=require(_0x288e('0x11'));var hardwareService=require(_0x288e('0x12'));var logger=require(_0x288e('0x13'))(_0x288e('0x14'));var utils=require(_0x288e('0x15'));var config=require(_0x288e('0x16'));var licenseUtil=require(_0x288e('0x17'));var db=require(_0x288e('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x265206,_0x24b10d){_0x24b10d=_0x24b10d||0xcc;return function(_0x46a9df){if(_0x46a9df){return _0x265206[_0x288e('0x19')](_0x24b10d);}return _0x265206[_0x288e('0x1a')](_0x24b10d)['end']();};}function respondWithResult(_0x1ba59c,_0xeb8115){_0xeb8115=_0xeb8115||0xc8;return function(_0x2f720c){if(_0x2f720c){return _0x1ba59c[_0x288e('0x1a')](_0xeb8115)[_0x288e('0x1b')](_0x2f720c);}};}function respondWithFilteredResult(_0x56489a,_0x3cf0d9){return function(_0x4282e9){if(_0x4282e9){var _0x42af9e=typeof _0x3cf0d9[_0x288e('0x1c')]==='undefined'&&typeof _0x3cf0d9['limit']===_0x288e('0x1d');var _0x1b909e=_0x4282e9[_0x288e('0x1e')];var _0x45a97c=_0x42af9e?0x0:_0x3cf0d9[_0x288e('0x1c')];var _0x5d2d02=_0x42af9e?_0x4282e9[_0x288e('0x1e')]:_0x3cf0d9['offset']+_0x3cf0d9[_0x288e('0x1f')];var _0x3e7389;if(_0x5d2d02>=_0x1b909e){_0x5d2d02=_0x1b909e;_0x3e7389=0xc8;}else{_0x3e7389=0xce;}_0x56489a[_0x288e('0x1a')](_0x3e7389);return _0x56489a[_0x288e('0x20')]('Content-Range',_0x45a97c+'-'+_0x5d2d02+'/'+_0x1b909e)[_0x288e('0x1b')](_0x4282e9);}return null;};}function patchUpdates(_0x2ffe24){return function(_0x5bb8ac){try{jsonpatch[_0x288e('0x21')](_0x5bb8ac,_0x2ffe24,!![]);}catch(_0x43b414){return BPromise['reject'](_0x43b414);}return _0x5bb8ac[_0x288e('0x22')]();};}function saveUpdates(_0x2ef363,_0x80ceb2){return function(_0x2a0f75){if(_0x2a0f75){return _0x2a0f75[_0x288e('0x23')](_0x2ef363)[_0x288e('0x24')](function(_0x2a3870){return _0x2a3870;});}return null;};}function removeEntity(_0xb16a71,_0x3298aa){return function(_0x192637){if(_0x192637){return _0x192637[_0x288e('0x25')]()[_0x288e('0x24')](function(){var _0x3096d7=_0x192637['get']({'plain':!![]});var _0x19e2b5=_0x288e('0x26');return db[_0x288e('0x27')]['destroy']({'where':{'type':_0x19e2b5,'resourceId':_0x3096d7['id']}})['then'](function(){return _0x192637;});})[_0x288e('0x24')](function(){_0xb16a71[_0x288e('0x1a')](0xcc)[_0x288e('0x28')]();});}};}function handleEntityNotFound(_0x460503,_0x113d79){return function(_0x4ffb29){if(!_0x4ffb29){_0x460503[_0x288e('0x19')](0x194);}return _0x4ffb29;};}function handleError(_0x378eec,_0x2e3cce){_0x2e3cce=_0x2e3cce||0x1f4;return function(_0x6975e4){logger[_0x288e('0x29')](_0x6975e4[_0x288e('0x2a')]);if(_0x6975e4[_0x288e('0x2b')]){delete _0x6975e4[_0x288e('0x2b')];}_0x378eec[_0x288e('0x1a')](_0x2e3cce)[_0x288e('0x2c')](_0x6975e4);};}exports[_0x288e('0x2d')]=function(_0x3ecd48,_0x1e27bb){var _0x5a1f68={},_0x4c76f0={},_0x35104b={'count':0x0,'rows':[]};var _0x462ad7=_[_0x288e('0x2e')](db[_0x288e('0x2f')][_0x288e('0x30')],function(_0x3b328b){return{'name':_0x3b328b['fieldName'],'type':_0x3b328b[_0x288e('0x31')]['key']};});_0x4c76f0['model']=_[_0x288e('0x2e')](_0x462ad7,_0x288e('0x2b'));_0x4c76f0['query']=_[_0x288e('0x32')](_0x3ecd48['query']);_0x4c76f0[_0x288e('0x33')]=_[_0x288e('0x34')](_0x4c76f0[_0x288e('0x35')],_0x4c76f0[_0x288e('0x36')]);_0x5a1f68[_0x288e('0x37')]=_['intersection'](_0x4c76f0['model'],qs[_0x288e('0x38')](_0x3ecd48['query'][_0x288e('0x38')]));_0x5a1f68[_0x288e('0x37')]=_0x5a1f68[_0x288e('0x37')]['length']?_0x5a1f68['attributes']:_0x4c76f0['model'];if(!_0x3ecd48[_0x288e('0x36')][_0x288e('0x39')](_0x288e('0x3a'))){_0x5a1f68[_0x288e('0x1f')]=qs[_0x288e('0x1f')](_0x3ecd48[_0x288e('0x36')][_0x288e('0x1f')]);_0x5a1f68[_0x288e('0x1c')]=qs[_0x288e('0x1c')](_0x3ecd48['query'][_0x288e('0x1c')]);}_0x5a1f68[_0x288e('0x3b')]=qs[_0x288e('0x3c')](_0x3ecd48[_0x288e('0x36')][_0x288e('0x3c')]);_0x5a1f68[_0x288e('0x3d')]=qs[_0x288e('0x33')](_['pick'](_0x3ecd48[_0x288e('0x36')],_0x4c76f0['filters']),_0x462ad7);if(_0x3ecd48['query'][_0x288e('0x3e')]){_0x5a1f68['where']=_[_0x288e('0x3f')](_0x5a1f68['where'],{'$or':_[_0x288e('0x2e')](_0x462ad7,function(_0x516d33){if(_0x516d33[_0x288e('0x31')]!==_0x288e('0x40')){var _0x705da6={};_0x705da6[_0x516d33[_0x288e('0x2b')]]={'$like':'%'+_0x3ecd48[_0x288e('0x36')]['filter']+'%'};return _0x705da6;}})});}_0x5a1f68=_[_0x288e('0x3f')]({},_0x5a1f68,_0x3ecd48[_0x288e('0x41')]);var _0x333626={'where':_0x5a1f68['where']};return db[_0x288e('0x2f')][_0x288e('0x1e')](_0x333626)[_0x288e('0x24')](function(_0x5a4107){_0x35104b[_0x288e('0x1e')]=_0x5a4107;if(_0x3ecd48['query'][_0x288e('0x42')]){_0x5a1f68[_0x288e('0x43')]=[{'all':!![]}];}return db[_0x288e('0x2f')][_0x288e('0x44')](_0x5a1f68);})['then'](function(_0xdb81bc){_0x35104b['rows']=_0xdb81bc;return _0x35104b;})[_0x288e('0x24')](respondWithFilteredResult(_0x1e27bb,_0x5a1f68))[_0x288e('0x45')](handleError(_0x1e27bb,null));};exports[_0x288e('0x46')]=function(_0x40eea8,_0x841229){var _0x12b9be={'raw':!![],'where':{'id':_0x40eea8['params']['id']}},_0x3dc83a={};_0x3dc83a['model']=_[_0x288e('0x32')](db[_0x288e('0x2f')][_0x288e('0x30')]);_0x3dc83a['query']=_[_0x288e('0x32')](_0x40eea8['query']);_0x3dc83a['filters']=_[_0x288e('0x34')](_0x3dc83a[_0x288e('0x35')],_0x3dc83a[_0x288e('0x36')]);_0x12b9be['attributes']=_['intersection'](_0x3dc83a[_0x288e('0x35')],qs['fields'](_0x40eea8[_0x288e('0x36')][_0x288e('0x38')]));_0x12b9be[_0x288e('0x37')]=_0x12b9be['attributes'][_0x288e('0x47')]?_0x12b9be['attributes']:_0x3dc83a[_0x288e('0x35')];if(_0x40eea8['query'][_0x288e('0x42')]){_0x12b9be['include']=[{'all':!![]}];}_0x12b9be=_[_0x288e('0x3f')]({},_0x12b9be,_0x40eea8['options']);return db[_0x288e('0x2f')][_0x288e('0x48')](_0x12b9be)['then'](handleEntityNotFound(_0x841229,null))['then'](respondWithResult(_0x841229,null))[_0x288e('0x45')](handleError(_0x841229,null));};exports['create']=function(_0x15a620,_0x2b1fd3){return db[_0x288e('0x2f')][_0x288e('0x49')](_0x15a620[_0x288e('0x4a')],{})['then'](function(_0xb0634b){var _0x2a8f92=_0x15a620[_0x288e('0x4b')][_0x288e('0x4c')]({'plain':!![]});if(!_0x2a8f92)throw new Error(_0x288e('0x4d'));if(_0x2a8f92[_0x288e('0x4e')]==='user'){var _0x8c7eaf=_0xb0634b[_0x288e('0x4c')]({'plain':!![]});var _0xd2c798='Intervals';return db[_0x288e('0x4f')]['find']({'where':{'name':_0xd2c798,'userProfileId':_0x2a8f92[_0x288e('0x50')]},'raw':!![]})['then'](function(_0x4c81f0){if(_0x4c81f0&&_0x4c81f0[_0x288e('0x51')]===0x0){return db['UserProfileResource'][_0x288e('0x49')]({'name':_0x8c7eaf['name'],'resourceId':_0x8c7eaf['id'],'type':_0x4c81f0[_0x288e('0x2b')],'sectionId':_0x4c81f0['id']},{})[_0x288e('0x24')](function(){return _0xb0634b;});}else{return _0xb0634b;}})['catch'](function(_0x21040d){logger['error'](_0x288e('0x52'),_0x21040d);throw _0x21040d;});}return _0xb0634b;})[_0x288e('0x24')](respondWithResult(_0x2b1fd3,0xc9))[_0x288e('0x45')](handleError(_0x2b1fd3,null));};exports[_0x288e('0x23')]=function(_0x51b09b,_0x44effb){if(_0x51b09b[_0x288e('0x4a')]['id']){delete _0x51b09b['body']['id'];}return db[_0x288e('0x2f')][_0x288e('0x48')]({'where':{'id':_0x51b09b[_0x288e('0x53')]['id']}})[_0x288e('0x24')](handleEntityNotFound(_0x44effb,null))[_0x288e('0x24')](saveUpdates(_0x51b09b[_0x288e('0x4a')],null))[_0x288e('0x24')](respondWithResult(_0x44effb,null))[_0x288e('0x45')](handleError(_0x44effb,null));};exports[_0x288e('0x25')]=function(_0x5dfd85,_0x42252f){return db['Interval'][_0x288e('0x48')]({'where':{'id':_0x5dfd85[_0x288e('0x53')]['id']}})[_0x288e('0x24')](handleEntityNotFound(_0x42252f,null))['then'](removeEntity(_0x42252f,null))[_0x288e('0x45')](handleError(_0x42252f,null));};exports[_0x288e('0x54')]=function(_0x2bb380,_0x44e494,_0x2f2a46){if(_0x2bb380[_0x288e('0x4a')]['id']){delete _0x2bb380[_0x288e('0x4a')]['id'];}return db[_0x288e('0x2f')]['find']({'where':{'id':_0x2bb380[_0x288e('0x53')]['id']}})[_0x288e('0x24')](handleEntityNotFound(_0x44e494,null))['then'](function(_0x1b4966){if(_0x1b4966){_0x2bb380[_0x288e('0x4a')][_0x288e('0x55')]=_0x1b4966['id'];return db['Interval']['create'](_0x2bb380[_0x288e('0x4a')]);}})[_0x288e('0x24')](respondWithResult(_0x44e494,null))[_0x288e('0x45')](handleError(_0x44e494,null));};exports[_0x288e('0x56')]=function(_0x1b1afb,_0x34bb4a,_0x28d668){var _0xd345f0={};var _0x762e4c={};var _0x5ca9ee;var _0xd67d6e;return db[_0x288e('0x2f')][_0x288e('0x57')]({'where':{'id':_0x1b1afb[_0x288e('0x53')]['id']}})[_0x288e('0x24')](handleEntityNotFound(_0x34bb4a,null))[_0x288e('0x24')](function(_0x5e701b){if(_0x5e701b){_0x5ca9ee=_0x5e701b;_0x762e4c[_0x288e('0x35')]=_[_0x288e('0x32')](db[_0x288e('0x2f')]['rawAttributes']);_0x762e4c['query']=_['keys'](_0x1b1afb[_0x288e('0x36')]);_0x762e4c['filters']=_['intersection'](_0x762e4c['model'],_0x762e4c[_0x288e('0x36')]);_0xd345f0[_0x288e('0x37')]=_[_0x288e('0x34')](_0x762e4c[_0x288e('0x35')],qs[_0x288e('0x38')](_0x1b1afb[_0x288e('0x36')]['fields']));_0xd345f0[_0x288e('0x37')]=_0xd345f0[_0x288e('0x37')][_0x288e('0x47')]?_0xd345f0[_0x288e('0x37')]:_0x762e4c[_0x288e('0x35')];_0xd345f0[_0x288e('0x3b')]=qs[_0x288e('0x3c')](_0x1b1afb['query'][_0x288e('0x3c')]);_0xd345f0[_0x288e('0x3d')]=qs[_0x288e('0x33')](_[_0x288e('0x58')](_0x1b1afb['query'],_0x762e4c[_0x288e('0x33')]));if(_0x1b1afb[_0x288e('0x36')]['filter']){_0xd345f0['where']=_[_0x288e('0x3f')](_0xd345f0[_0x288e('0x3d')],{'$or':_[_0x288e('0x2e')](_0xd345f0[_0x288e('0x37')],function(_0xea4460){var _0x478b51={};_0x478b51[_0xea4460]={'$like':'%'+_0x1b1afb['query'][_0x288e('0x3e')]+'%'};return _0x478b51;})});}_0xd345f0=_[_0x288e('0x3f')]({},_0xd345f0,_0x1b1afb[_0x288e('0x41')]);return _0x5ca9ee[_0x288e('0x56')](_0xd345f0);}})[_0x288e('0x24')](function(_0x55c163){if(_0x55c163){_0xd67d6e=_0x55c163[_0x288e('0x47')];if(!_0x1b1afb[_0x288e('0x36')][_0x288e('0x39')](_0x288e('0x3a'))){_0xd345f0[_0x288e('0x1f')]=qs[_0x288e('0x1f')](_0x1b1afb['query'][_0x288e('0x1f')]);_0xd345f0['offset']=qs['offset'](_0x1b1afb[_0x288e('0x36')][_0x288e('0x1c')]);}return _0x5ca9ee[_0x288e('0x56')](_0xd345f0);}})['then'](function(_0x394a35){if(_0x394a35){return _0x394a35?{'count':_0xd67d6e,'rows':_0x394a35}:null;}})[_0x288e('0x24')](respondWithResult(_0x34bb4a,null))[_0x288e('0x45')](handleError(_0x34bb4a,null));};exports[_0x288e('0x59')]=function(_0x40751b,_0x33399d,_0x5700b3){return db[_0x288e('0x2f')]['findOne']({'where':{'id':_0x40751b[_0x288e('0x53')]['id']}})['then'](handleEntityNotFound(_0x33399d,null))[_0x288e('0x24')](function(_0x321958){if(_0x321958){return db[_0x288e('0x5a')]['transaction'](function(_0x1d3864){return db['Interval']['destroy']({'where':{'IntervalId':_0x40751b[_0x288e('0x53')]['id']},'transaction':_0x1d3864})[_0x288e('0x24')](function(_0x38648f){var _0x3a92ae=_[_0x288e('0x2e')](_0x40751b[_0x288e('0x4a')],function(_0x27e86a){delete _0x27e86a['id'];_0x27e86a['IntervalId']=_0x40751b[_0x288e('0x53')]['id'];return _0x27e86a;});return db[_0x288e('0x2f')][_0x288e('0x5b')](_0x3a92ae,{'transaction':_0x1d3864});});})[_0x288e('0x24')](function(){return db['Interval'][_0x288e('0x44')]({'where':{'IntervalId':_0x40751b['params']['id']}});});}})[_0x288e('0x24')](respondWithResult(_0x33399d,null))[_0x288e('0x45')](handleError(_0x33399d,null));}; \ No newline at end of file +var _0x3a5d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Intervals','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','Interval','includeAll','include','rows','show','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','addIntervals','sequelize','transaction','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x3a5d,0xa8));var _0xd3a5=function(_0x42be6a,_0xd81fd8){_0x42be6a=_0x42be6a-0x0;var _0x2d8d9d=_0x3a5d[_0x42be6a];return _0x2d8d9d;};'use strict';var emlformat=require(_0xd3a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3a5('0x1'));var jsonpatch=require(_0xd3a5('0x2'));var rp=require(_0xd3a5('0x3'));var moment=require(_0xd3a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd3a5('0x5'));var util=require(_0xd3a5('0x6'));var path=require(_0xd3a5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd3a5('0x8'));var fs=require('fs');var fs_extra=require(_0xd3a5('0x9'));var _=require(_0xd3a5('0xa'));var squel=require(_0xd3a5('0xb'));var crypto=require(_0xd3a5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd3a5('0xd'));var querystring=require(_0xd3a5('0xe'));var Papa=require(_0xd3a5('0xf'));var Redis=require(_0xd3a5('0x10'));var authService=require(_0xd3a5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd3a5('0x12'));var hardwareService=require(_0xd3a5('0x13'));var logger=require(_0xd3a5('0x14'))('api');var utils=require(_0xd3a5('0x15'));var config=require(_0xd3a5('0x16'));var licenseUtil=require(_0xd3a5('0x17'));var db=require(_0xd3a5('0x18'))['db'];var extensions=require(_0xd3a5('0x19'));function respondWithStatusCode(_0x2de5ab,_0x5356ad){_0x5356ad=_0x5356ad||0xcc;return function(_0xde164e){if(_0xde164e){return _0x2de5ab[_0xd3a5('0x1a')](_0x5356ad);}return _0x2de5ab[_0xd3a5('0x1b')](_0x5356ad)[_0xd3a5('0x1c')]();};}function respondWithResult(_0x37a08a,_0x54b2a8){_0x54b2a8=_0x54b2a8||0xc8;return function(_0x42ed7f){if(_0x42ed7f){return _0x37a08a[_0xd3a5('0x1b')](_0x54b2a8)[_0xd3a5('0x1d')](_0x42ed7f);}};}function respondWithFilteredResult(_0x196aa1,_0x3b942f){return function(_0x3b7890){if(_0x3b7890){var _0x556a8c=typeof _0x3b942f[_0xd3a5('0x1e')]===_0xd3a5('0x1f')&&typeof _0x3b942f[_0xd3a5('0x20')]==='undefined';var _0xe6bc4c=_0x3b7890[_0xd3a5('0x21')];var _0x4ebca3=_0x556a8c?0x0:_0x3b942f['offset'];var _0x106129=_0x556a8c?_0x3b7890[_0xd3a5('0x21')]:_0x3b942f[_0xd3a5('0x1e')]+_0x3b942f[_0xd3a5('0x20')];var _0x1abe8c;if(_0x106129>=_0xe6bc4c){_0x106129=_0xe6bc4c;_0x1abe8c=0xc8;}else{_0x1abe8c=0xce;}_0x196aa1[_0xd3a5('0x1b')](_0x1abe8c);return _0x196aa1[_0xd3a5('0x22')](_0xd3a5('0x23'),_0x4ebca3+'-'+_0x106129+'/'+_0xe6bc4c)[_0xd3a5('0x1d')](_0x3b7890);}return null;};}function patchUpdates(_0xf1964b){return function(_0x25b316){try{jsonpatch[_0xd3a5('0x24')](_0x25b316,_0xf1964b,!![]);}catch(_0x91de81){return BPromise[_0xd3a5('0x25')](_0x91de81);}return _0x25b316[_0xd3a5('0x26')]();};}function saveUpdates(_0x58fb8e,_0x3d97af){return function(_0x7622f2){if(_0x7622f2){return _0x7622f2[_0xd3a5('0x27')](_0x58fb8e)['then'](function(_0x384b97){return _0x384b97;});}return null;};}function removeEntity(_0x36f399,_0xcf37b6){return function(_0xf695e6){if(_0xf695e6){return _0xf695e6[_0xd3a5('0x28')]()[_0xd3a5('0x29')](function(){var _0xbd022f=_0xf695e6['get']({'plain':!![]});var _0x1c37be=_0xd3a5('0x2a');return db['UserProfileResource'][_0xd3a5('0x28')]({'where':{'type':_0x1c37be,'resourceId':_0xbd022f['id']}})[_0xd3a5('0x29')](function(){return _0xf695e6;});})[_0xd3a5('0x29')](function(){_0x36f399[_0xd3a5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9301de,_0x4e77e0){return function(_0x48e18b){if(!_0x48e18b){_0x9301de[_0xd3a5('0x1a')](0x194);}return _0x48e18b;};}function handleError(_0x2dff74,_0x222022){_0x222022=_0x222022||0x1f4;return function(_0x3f368f){logger[_0xd3a5('0x2b')](_0x3f368f['stack']);if(_0x3f368f['name']){delete _0x3f368f[_0xd3a5('0x2c')];}_0x2dff74[_0xd3a5('0x1b')](_0x222022)[_0xd3a5('0x2d')](_0x3f368f);};}exports[_0xd3a5('0x2e')]=function(_0x5283e2,_0x126c14){var _0x1b9010={},_0xcda85a={},_0x4c0cf3={'count':0x0,'rows':[]};var _0x4ec293=_[_0xd3a5('0x2f')](db['Interval'][_0xd3a5('0x30')],function(_0x16d0be){return{'name':_0x16d0be[_0xd3a5('0x31')],'type':_0x16d0be[_0xd3a5('0x32')]['key']};});_0xcda85a[_0xd3a5('0x33')]=_['map'](_0x4ec293,_0xd3a5('0x2c'));_0xcda85a[_0xd3a5('0x34')]=_[_0xd3a5('0x35')](_0x5283e2[_0xd3a5('0x34')]);_0xcda85a['filters']=_[_0xd3a5('0x36')](_0xcda85a['model'],_0xcda85a['query']);_0x1b9010['attributes']=_[_0xd3a5('0x36')](_0xcda85a['model'],qs[_0xd3a5('0x37')](_0x5283e2[_0xd3a5('0x34')][_0xd3a5('0x37')]));_0x1b9010[_0xd3a5('0x38')]=_0x1b9010[_0xd3a5('0x38')][_0xd3a5('0x39')]?_0x1b9010[_0xd3a5('0x38')]:_0xcda85a[_0xd3a5('0x33')];if(!_0x5283e2[_0xd3a5('0x34')][_0xd3a5('0x3a')](_0xd3a5('0x3b'))){_0x1b9010[_0xd3a5('0x20')]=qs[_0xd3a5('0x20')](_0x5283e2['query']['limit']);_0x1b9010[_0xd3a5('0x1e')]=qs[_0xd3a5('0x1e')](_0x5283e2[_0xd3a5('0x34')][_0xd3a5('0x1e')]);}_0x1b9010[_0xd3a5('0x3c')]=qs['sort'](_0x5283e2[_0xd3a5('0x34')][_0xd3a5('0x3d')]);_0x1b9010[_0xd3a5('0x3e')]=qs[_0xd3a5('0x3f')](_['pick'](_0x5283e2['query'],_0xcda85a[_0xd3a5('0x3f')]),_0x4ec293);if(_0x5283e2['query'][_0xd3a5('0x40')]){_0x1b9010[_0xd3a5('0x3e')]=_['merge'](_0x1b9010[_0xd3a5('0x3e')],{'$or':_[_0xd3a5('0x2f')](_0x4ec293,function(_0x39f3f1){if(_0x39f3f1[_0xd3a5('0x32')]!==_0xd3a5('0x41')){var _0x2a6bc9={};_0x2a6bc9[_0x39f3f1[_0xd3a5('0x2c')]]={'$like':'%'+_0x5283e2[_0xd3a5('0x34')][_0xd3a5('0x40')]+'%'};return _0x2a6bc9;}})});}_0x1b9010=_['merge']({},_0x1b9010,_0x5283e2[_0xd3a5('0x42')]);var _0x25257f={'where':_0x1b9010[_0xd3a5('0x3e')]};return db[_0xd3a5('0x43')][_0xd3a5('0x21')](_0x25257f)['then'](function(_0x3d285a){_0x4c0cf3[_0xd3a5('0x21')]=_0x3d285a;if(_0x5283e2[_0xd3a5('0x34')][_0xd3a5('0x44')]){_0x1b9010[_0xd3a5('0x45')]=[{'all':!![]}];}return db[_0xd3a5('0x43')]['findAll'](_0x1b9010);})[_0xd3a5('0x29')](function(_0x17153c){_0x4c0cf3[_0xd3a5('0x46')]=_0x17153c;return _0x4c0cf3;})[_0xd3a5('0x29')](respondWithFilteredResult(_0x126c14,_0x1b9010))['catch'](handleError(_0x126c14,null));};exports[_0xd3a5('0x47')]=function(_0x971c96,_0x498a12){var _0x2f8bd8={'raw':!![],'where':{'id':_0x971c96['params']['id']}},_0x112d94={};_0x112d94[_0xd3a5('0x33')]=_['keys'](db[_0xd3a5('0x43')][_0xd3a5('0x30')]);_0x112d94[_0xd3a5('0x34')]=_[_0xd3a5('0x35')](_0x971c96[_0xd3a5('0x34')]);_0x112d94[_0xd3a5('0x3f')]=_[_0xd3a5('0x36')](_0x112d94[_0xd3a5('0x33')],_0x112d94[_0xd3a5('0x34')]);_0x2f8bd8['attributes']=_[_0xd3a5('0x36')](_0x112d94[_0xd3a5('0x33')],qs['fields'](_0x971c96[_0xd3a5('0x34')][_0xd3a5('0x37')]));_0x2f8bd8[_0xd3a5('0x38')]=_0x2f8bd8[_0xd3a5('0x38')][_0xd3a5('0x39')]?_0x2f8bd8['attributes']:_0x112d94[_0xd3a5('0x33')];if(_0x971c96[_0xd3a5('0x34')][_0xd3a5('0x44')]){_0x2f8bd8[_0xd3a5('0x45')]=[{'all':!![]}];}_0x2f8bd8=_[_0xd3a5('0x48')]({},_0x2f8bd8,_0x971c96['options']);return db[_0xd3a5('0x43')][_0xd3a5('0x49')](_0x2f8bd8)[_0xd3a5('0x29')](handleEntityNotFound(_0x498a12,null))[_0xd3a5('0x29')](respondWithResult(_0x498a12,null))[_0xd3a5('0x4a')](handleError(_0x498a12,null));};exports[_0xd3a5('0x4b')]=function(_0x2cdc6c,_0x203ffb){return db[_0xd3a5('0x43')]['create'](_0x2cdc6c[_0xd3a5('0x4c')],{})[_0xd3a5('0x29')](function(_0xe14454){var _0x53bce6=_0x2cdc6c[_0xd3a5('0x4d')][_0xd3a5('0x4e')]({'plain':!![]});if(!_0x53bce6)throw new Error(_0xd3a5('0x4f'));if(_0x53bce6[_0xd3a5('0x50')]===_0xd3a5('0x4d')){var _0x1f922e=_0xe14454['get']({'plain':!![]});var _0x11c54e='Intervals';return db[_0xd3a5('0x51')][_0xd3a5('0x49')]({'where':{'name':_0x11c54e,'userProfileId':_0x53bce6[_0xd3a5('0x52')]},'raw':!![]})[_0xd3a5('0x29')](function(_0x9f3854){if(_0x9f3854&&_0x9f3854[_0xd3a5('0x53')]===0x0){return db[_0xd3a5('0x54')]['create']({'name':_0x1f922e[_0xd3a5('0x2c')],'resourceId':_0x1f922e['id'],'type':_0x9f3854[_0xd3a5('0x2c')],'sectionId':_0x9f3854['id']},{})[_0xd3a5('0x29')](function(){return _0xe14454;});}else{return _0xe14454;}})[_0xd3a5('0x4a')](function(_0x32e76e){logger[_0xd3a5('0x2b')](_0xd3a5('0x55'),_0x32e76e);throw _0x32e76e;});}return _0xe14454;})[_0xd3a5('0x29')](respondWithResult(_0x203ffb,0xc9))['catch'](handleError(_0x203ffb,null));};exports[_0xd3a5('0x27')]=function(_0x681eae,_0x131bbb){if(_0x681eae[_0xd3a5('0x4c')]['id']){delete _0x681eae[_0xd3a5('0x4c')]['id'];}return db[_0xd3a5('0x43')]['find']({'where':{'id':_0x681eae[_0xd3a5('0x56')]['id']}})[_0xd3a5('0x29')](handleEntityNotFound(_0x131bbb,null))['then'](saveUpdates(_0x681eae[_0xd3a5('0x4c')],null))[_0xd3a5('0x29')](respondWithResult(_0x131bbb,null))['catch'](handleError(_0x131bbb,null));};exports['destroy']=function(_0x3d868e,_0x1a81bb){return db[_0xd3a5('0x43')][_0xd3a5('0x49')]({'where':{'id':_0x3d868e['params']['id']}})[_0xd3a5('0x29')](handleEntityNotFound(_0x1a81bb,null))[_0xd3a5('0x29')](removeEntity(_0x1a81bb,null))[_0xd3a5('0x4a')](handleError(_0x1a81bb,null));};exports[_0xd3a5('0x57')]=function(_0x2782b2,_0x149092,_0x201c7c){if(_0x2782b2[_0xd3a5('0x4c')]['id']){delete _0x2782b2[_0xd3a5('0x4c')]['id'];}return db[_0xd3a5('0x43')]['find']({'where':{'id':_0x2782b2[_0xd3a5('0x56')]['id']}})[_0xd3a5('0x29')](handleEntityNotFound(_0x149092,null))['then'](function(_0x16a0f6){if(_0x16a0f6){_0x2782b2[_0xd3a5('0x4c')]['IntervalId']=_0x16a0f6['id'];return db[_0xd3a5('0x43')]['create'](_0x2782b2[_0xd3a5('0x4c')]);}})['then'](respondWithResult(_0x149092,null))[_0xd3a5('0x4a')](handleError(_0x149092,null));};exports[_0xd3a5('0x58')]=function(_0x2b8e66,_0x43605c,_0xce2c5d){var _0xd397fd={};var _0xfe3d0d={};var _0x3c82fa;var _0x42f431;return db[_0xd3a5('0x43')]['findOne']({'where':{'id':_0x2b8e66[_0xd3a5('0x56')]['id']}})[_0xd3a5('0x29')](handleEntityNotFound(_0x43605c,null))[_0xd3a5('0x29')](function(_0x21f922){if(_0x21f922){_0x3c82fa=_0x21f922;_0xfe3d0d['model']=_[_0xd3a5('0x35')](db[_0xd3a5('0x43')][_0xd3a5('0x30')]);_0xfe3d0d[_0xd3a5('0x34')]=_[_0xd3a5('0x35')](_0x2b8e66[_0xd3a5('0x34')]);_0xfe3d0d['filters']=_[_0xd3a5('0x36')](_0xfe3d0d[_0xd3a5('0x33')],_0xfe3d0d[_0xd3a5('0x34')]);_0xd397fd['attributes']=_[_0xd3a5('0x36')](_0xfe3d0d['model'],qs[_0xd3a5('0x37')](_0x2b8e66[_0xd3a5('0x34')][_0xd3a5('0x37')]));_0xd397fd[_0xd3a5('0x38')]=_0xd397fd['attributes'][_0xd3a5('0x39')]?_0xd397fd[_0xd3a5('0x38')]:_0xfe3d0d[_0xd3a5('0x33')];_0xd397fd['order']=qs[_0xd3a5('0x3d')](_0x2b8e66[_0xd3a5('0x34')][_0xd3a5('0x3d')]);_0xd397fd[_0xd3a5('0x3e')]=qs['filters'](_['pick'](_0x2b8e66['query'],_0xfe3d0d['filters']));if(_0x2b8e66[_0xd3a5('0x34')][_0xd3a5('0x40')]){_0xd397fd[_0xd3a5('0x3e')]=_[_0xd3a5('0x48')](_0xd397fd[_0xd3a5('0x3e')],{'$or':_['map'](_0xd397fd[_0xd3a5('0x38')],function(_0x54fee3){var _0x293a09={};_0x293a09[_0x54fee3]={'$like':'%'+_0x2b8e66[_0xd3a5('0x34')][_0xd3a5('0x40')]+'%'};return _0x293a09;})});}_0xd397fd=_['merge']({},_0xd397fd,_0x2b8e66[_0xd3a5('0x42')]);return _0x3c82fa[_0xd3a5('0x58')](_0xd397fd);}})[_0xd3a5('0x29')](function(_0x1df882){if(_0x1df882){_0x42f431=_0x1df882[_0xd3a5('0x39')];if(!_0x2b8e66[_0xd3a5('0x34')][_0xd3a5('0x3a')]('nolimit')){_0xd397fd[_0xd3a5('0x20')]=qs[_0xd3a5('0x20')](_0x2b8e66[_0xd3a5('0x34')][_0xd3a5('0x20')]);_0xd397fd[_0xd3a5('0x1e')]=qs[_0xd3a5('0x1e')](_0x2b8e66[_0xd3a5('0x34')][_0xd3a5('0x1e')]);}return _0x3c82fa[_0xd3a5('0x58')](_0xd397fd);}})[_0xd3a5('0x29')](function(_0xfa0d6c){if(_0xfa0d6c){return _0xfa0d6c?{'count':_0x42f431,'rows':_0xfa0d6c}:null;}})[_0xd3a5('0x29')](respondWithResult(_0x43605c,null))['catch'](handleError(_0x43605c,null));};exports[_0xd3a5('0x59')]=function(_0x242c47,_0x1e80ee,_0x40e64f){return db['Interval']['findOne']({'where':{'id':_0x242c47[_0xd3a5('0x56')]['id']}})[_0xd3a5('0x29')](handleEntityNotFound(_0x1e80ee,null))[_0xd3a5('0x29')](function(_0x49c081){if(_0x49c081){return db[_0xd3a5('0x5a')][_0xd3a5('0x5b')](function(_0x46c4e0){return db[_0xd3a5('0x43')][_0xd3a5('0x28')]({'where':{'IntervalId':_0x242c47[_0xd3a5('0x56')]['id']},'transaction':_0x46c4e0})['then'](function(_0x487443){var _0xae4123=_['map'](_0x242c47[_0xd3a5('0x4c')],function(_0xc1111e){delete _0xc1111e['id'];_0xc1111e['IntervalId']=_0x242c47[_0xd3a5('0x56')]['id'];return _0xc1111e;});return db[_0xd3a5('0x43')]['bulkCreate'](_0xae4123,{'transaction':_0x46c4e0});});})[_0xd3a5('0x29')](function(){return db[_0xd3a5('0x43')][_0xd3a5('0x5c')]({'where':{'IntervalId':_0x242c47['params']['id']}});});}})[_0xd3a5('0x29')](respondWithResult(_0x1e80ee,null))['catch'](handleError(_0x1e80ee,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9314bc0..722cc4f 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 _0x9bc8=['../../config/logger','api','moment','bluebird','request-promise','path','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util'];(function(_0x1a10bd,_0x5ea83c){var _0x2df131=function(_0xd57a27){while(--_0xd57a27){_0x1a10bd['push'](_0x1a10bd['shift']());}};_0x2df131(++_0x5ea83c);}(_0x9bc8,0xa6));var _0x89bc=function(_0x2582f1,_0x5210fd){_0x2582f1=_0x2582f1-0x0;var _0x2a2252=_0x9bc8[_0x2582f1];return _0x2a2252;};'use strict';var _=require(_0x89bc('0x0'));var util=require(_0x89bc('0x1'));var logger=require(_0x89bc('0x2'))(_0x89bc('0x3'));var moment=require(_0x89bc('0x4'));var BPromise=require(_0x89bc('0x5'));var rp=require(_0x89bc('0x6'));var fs=require('fs');var path=require(_0x89bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x89bc('0x8'));module[_0x89bc('0x9')]=function(_0x49c366,_0x24ab05){return _0x49c366[_0x89bc('0xa')](_0x89bc('0xb'),attributes,{'tableName':_0x89bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ce421,_0x1c5108){extensions['rewrite'](_0x49c366,_0x3ce421);},'afterBulkCreate':function(_0x22e938,_0x36fc9d,_0x307aa0){_0x307aa0();extensions[_0x89bc('0xd')](_0x49c366,_0x22e938[0x0]);},'afterUpdate':function(_0x480e16,_0x22d594){extensions[_0x89bc('0xd')](_0x49c366,_0x480e16);},'afterDestroy':function(_0x42bd9e,_0x41ba91){extensions['rewrite'](_0x49c366,_0x42bd9e);}}});}; \ No newline at end of file +var _0x47a8=['Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','define'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x47a8,0x1b6));var _0x847a=function(_0x49a34a,_0x231f84){_0x49a34a=_0x49a34a-0x0;var _0x1359f5=_0x47a8[_0x49a34a];return _0x1359f5;};'use strict';var _=require(_0x847a('0x0'));var util=require(_0x847a('0x1'));var logger=require(_0x847a('0x2'))(_0x847a('0x3'));var moment=require(_0x847a('0x4'));var BPromise=require('bluebird');var rp=require(_0x847a('0x5'));var fs=require('fs');var path=require(_0x847a('0x6'));var rimraf=require(_0x847a('0x7'));var config=require(_0x847a('0x8'));var attributes=require(_0x847a('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0x847a('0xa')]=function(_0x14c658,_0x658013){return _0x14c658[_0x847a('0xb')](_0x847a('0xc'),attributes,{'tableName':_0x847a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1031ab,_0x3d4208){extensions[_0x847a('0xe')](_0x14c658,_0x1031ab);},'afterBulkCreate':function(_0x42370e,_0x37a861,_0x236046){_0x236046();extensions['rewrite'](_0x14c658,_0x42370e[0x0]);},'afterUpdate':function(_0xf8ea48,_0x58bf62){extensions['rewrite'](_0x14c658,_0xf8ea48);},'afterDestroy':function(_0x15888a,_0x5aa7cb){extensions[_0x847a('0xe')](_0x14c658,_0x15888a);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 980dc0d..0c1e92d 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 5a20427..cd5c527 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x13292f,_0x203f6f){var _0x4a2038=function(_0x567787){while(--_0x567787){_0x13292f['push'](_0x13292f['shift']());}};_0x4a2038(++_0x203f6f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1276c6,_0x439134){_0x1276c6=_0x1276c6-0x0;var _0x25a5c1=_0x5f2f[_0x1276c6];return _0x25a5c1;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x0b0e[_0x4a209a];return _0x4b3c20;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a91a9f5..91e8ce6 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 _0x249d=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11502','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','base64','request','setEncoding','utf8','data','status','json','parse'];(function(_0x3f2c63,_0x2be66e){var _0x23a298=function(_0x338f22){while(--_0x338f22){_0x3f2c63['push'](_0x3f2c63['shift']());}};_0x23a298(++_0x2be66e);}(_0x249d,0x1c3));var _0xd249=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x249d[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xd249('0x0'));var https=require(_0xd249('0x1'));var logger=require(_0xd249('0x2'))(_0xd249('0x3'));var USERNAME=_0xd249('0x4');var PASSWORD=_0xd249('0x5');function openIssue(_0x427e4c,_0x110865){var _0x1d2107={'fields':{'project':{'key':_0x427e4c[_0xd249('0x6')]||_0xd249('0x7')},'summary':(_0x427e4c[_0xd249('0x8')]||_0xd249('0x9'))+_0xd249('0xa')+_0x427e4c['ip'],'description':_0x427e4c[_0xd249('0xb')]||JSON[_0xd249('0xc')](_0x427e4c),'issuetype':{'name':_0x427e4c[_0xd249('0xd')]||_0xd249('0xe')}}};_0x1d2107[_0xd249('0xf')]['customfield_11500']=_0x427e4c['email'];_0x1d2107[_0xd249('0xf')]['customfield_11501']=_0x427e4c['oldToken'];_0x1d2107[_0xd249('0xf')][_0xd249('0x10')]=_0x427e4c['newToken'];_0x1d2107[_0xd249('0xf')][_0xd249('0x11')]=_0x427e4c[_0xd249('0x12')];_0x1d2107[_0xd249('0xf')]['customfield_11504']=_0x427e4c[_0xd249('0x13')];_0x1d2107['fields'][_0xd249('0x14')]=_0x427e4c['ip'];var _0x508817={'host':_0xd249('0x15'),'port':0x1bb,'path':_0xd249('0x16'),'method':_0xd249('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xd249('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd249('0x19'))}};var _0x451602=JSON[_0xd249('0xc')](_0x1d2107);var _0x3da83b=https[_0xd249('0x1a')](_0x508817,function(_0x35543a){_0x35543a[_0xd249('0x1b')](_0xd249('0x1c'));var _0x2b5548='';_0x35543a['on'](_0xd249('0x1d'),function(_0x3675e0){_0x2b5548+=_0x3675e0;});_0x35543a['on']('end',function(){if(_0x110865){return _0x110865[_0xd249('0x1e')](_0x35543a['statusCode'])[_0xd249('0x1f')](JSON[_0xd249('0x20')](_0x2b5548));}});});_0x3da83b['on'](_0xd249('0x21'),function(_0x5d1fc3){if(_0x110865){return _0x110865[_0xd249('0x1e')](0x1f4)[_0xd249('0x1f')]({'errors':[{'message':_0xd249('0x22'),'type':'api.jira'}]});}});_0x3da83b[_0xd249('0x23')](_0x451602);_0x3da83b[_0xd249('0x24')]();}exports['openIssue']=openIssue;exports[_0xd249('0x25')]=function(_0xec1d32,_0xd6367c){_0xec1d32[_0xd249('0x26')]['ip']=_0xec1d32[_0xd249('0x27')][_0xd249('0x28')]||_0xec1d32[_0xd249('0x29')][_0xd249('0x2a')]||_0xec1d32[_0xd249('0x2b')][_0xd249('0x2a')]||_0xec1d32[_0xd249('0x29')][_0xd249('0x2b')][_0xd249('0x2a')];return openIssue(_0xec1d32['body'],_0xd6367c);}; \ No newline at end of file +var _0xd8a2=['body','headers','x-forwarded-for','connection','remoteAddress','bluebird','https','../../config/logger','api','support','key','summary','Report','\x20from\x20','stringify','issuetype','Bug','customfield_11500','customfield_11501','oldToken','fields','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','setEncoding','utf8','data','end','status','statusCode','json','parse','error','write','openIssue','send'];(function(_0x4e846b,_0x23bac7){var _0x20dabc=function(_0x4c5c31){while(--_0x4c5c31){_0x4e846b['push'](_0x4e846b['shift']());}};_0x20dabc(++_0x23bac7);}(_0xd8a2,0xad));var _0x2d8a=function(_0x318f1d,_0x1c3cc2){_0x318f1d=_0x318f1d-0x0;var _0x5327d2=_0xd8a2[_0x318f1d];return _0x5327d2;};'use strict';var BPromise=require(_0x2d8a('0x0'));var https=require(_0x2d8a('0x1'));var logger=require(_0x2d8a('0x2'))(_0x2d8a('0x3'));var USERNAME=_0x2d8a('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4fa5c6,_0x4b8592){var _0x1bc371={'fields':{'project':{'key':_0x4fa5c6[_0x2d8a('0x5')]||'MOTGUI'},'summary':(_0x4fa5c6[_0x2d8a('0x6')]||_0x2d8a('0x7'))+_0x2d8a('0x8')+_0x4fa5c6['ip'],'description':_0x4fa5c6['description']||JSON[_0x2d8a('0x9')](_0x4fa5c6),'issuetype':{'name':_0x4fa5c6[_0x2d8a('0xa')]||_0x2d8a('0xb')}}};_0x1bc371['fields'][_0x2d8a('0xc')]=_0x4fa5c6['email'];_0x1bc371['fields'][_0x2d8a('0xd')]=_0x4fa5c6[_0x2d8a('0xe')];_0x1bc371[_0x2d8a('0xf')]['customfield_11502']=_0x4fa5c6['newToken'];_0x1bc371[_0x2d8a('0xf')][_0x2d8a('0x10')]=_0x4fa5c6[_0x2d8a('0x11')];_0x1bc371[_0x2d8a('0xf')][_0x2d8a('0x12')]=_0x4fa5c6[_0x2d8a('0x13')];_0x1bc371[_0x2d8a('0xf')]['customfield_10102']=_0x4fa5c6['ip'];var _0x206eae={'host':_0x2d8a('0x14'),'port':0x1bb,'path':_0x2d8a('0x15'),'method':_0x2d8a('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x2d8a('0x17'),'Authorization':_0x2d8a('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x25f5da=JSON[_0x2d8a('0x9')](_0x1bc371);var _0x34f76c=https['request'](_0x206eae,function(_0x177475){_0x177475[_0x2d8a('0x19')](_0x2d8a('0x1a'));var _0x3cd39b='';_0x177475['on'](_0x2d8a('0x1b'),function(_0x17d14d){_0x3cd39b+=_0x17d14d;});_0x177475['on'](_0x2d8a('0x1c'),function(){if(_0x4b8592){return _0x4b8592[_0x2d8a('0x1d')](_0x177475[_0x2d8a('0x1e')])[_0x2d8a('0x1f')](JSON[_0x2d8a('0x20')](_0x3cd39b));}});});_0x34f76c['on'](_0x2d8a('0x21'),function(_0x1a497e){if(_0x4b8592){return _0x4b8592[_0x2d8a('0x1d')](0x1f4)[_0x2d8a('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x34f76c[_0x2d8a('0x22')](_0x25f5da);_0x34f76c[_0x2d8a('0x1c')]();}exports[_0x2d8a('0x23')]=openIssue;exports[_0x2d8a('0x24')]=function(_0x26dff3,_0x4ae095){_0x26dff3[_0x2d8a('0x25')]['ip']=_0x26dff3[_0x2d8a('0x26')][_0x2d8a('0x27')]||_0x26dff3[_0x2d8a('0x28')][_0x2d8a('0x29')]||_0x26dff3['socket'][_0x2d8a('0x29')]||_0x26dff3[_0x2d8a('0x28')]['socket'][_0x2d8a('0x29')];return openIssue(_0x26dff3[_0x2d8a('0x25')],_0x4ae095);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 5880a29..457fd72 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 _0xd64b=['../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x50b89c,_0x500b8e){var _0x505db3=function(_0x859b4){while(--_0x859b4){_0x50b89c['push'](_0x50b89c['shift']());}};_0x505db3(++_0x500b8e);}(_0xd64b,0xc1));var _0xbd64=function(_0x50e086,_0x18f9b9){_0x50e086=_0x50e086-0x0;var _0x4e9143=_0xd64b[_0x50e086];return _0x4e9143;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbd64('0xd')]('/',auth[_0xbd64('0xa')](),controller[_0xbd64('0xe')]);router['put'](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xf')]);router[_0xbd64('0x10')]('/:id',auth[_0xbd64('0xa')](),controller['destroy']);module[_0xbd64('0x11')]=router; \ No newline at end of file +var _0x0bb5=['describe','show','post','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated'];(function(_0x3866c3,_0x2740cd){var _0x4de2c5=function(_0x2a0a10){while(--_0x2a0a10){_0x3866c3['push'](_0x3866c3['shift']());}};_0x4de2c5(++_0x2740cd);}(_0x0bb5,0x148));var _0x50bb=function(_0xd7b25b,_0x50583d){_0xd7b25b=_0xd7b25b-0x0;var _0x25ef7e=_0x0bb5[_0xd7b25b];return _0x25ef7e;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')]('/',auth[_0x50bb('0xb')](),controller['create']);router[_0x50bb('0xf')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x12')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller['destroy']);module[_0x50bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 869c6d2..c76ce21 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x58947c,_0x310b4){_0x58947c=_0x58947c-0x0;var _0x48000c=_0x7a54[_0x58947c];return _0x48000c;};'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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x32e961,_0xc24d9f){_0x32e961=_0x32e961-0x0;var _0x51cbe7=_0x7a54[_0x32e961];return _0x51cbe7;};'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 7d5a913..9e72e4c 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 _0xd1f9=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','VIRTUAL','name','merge','options','where','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd1f9,0x88));var _0x9d1f=function(_0x1b4bef,_0x5bb6be){_0x1b4bef=_0x1b4bef-0x0;var _0xf377eb=_0xd1f9[_0x1b4bef];return _0xf377eb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d1f('0x0'));var jsonpatch=require(_0x9d1f('0x1'));var rp=require(_0x9d1f('0x2'));var moment=require(_0x9d1f('0x3'));var BPromise=require(_0x9d1f('0x4'));var Mustache=require(_0x9d1f('0x5'));var util=require(_0x9d1f('0x6'));var path=require(_0x9d1f('0x7'));var sox=require(_0x9d1f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d1f('0x9'));var fs=require('fs');var fs_extra=require(_0x9d1f('0xa'));var _=require(_0x9d1f('0xb'));var squel=require(_0x9d1f('0xc'));var crypto=require(_0x9d1f('0xd'));var jsforce=require(_0x9d1f('0xe'));var deskjs=require(_0x9d1f('0xf'));var toCsv=require(_0x9d1f('0x10'));var querystring=require(_0x9d1f('0x11'));var Papa=require(_0x9d1f('0x12'));var Redis=require(_0x9d1f('0x13'));var authService=require(_0x9d1f('0x14'));var qs=require(_0x9d1f('0x15'));var as=require(_0x9d1f('0x16'));var hardwareService=require(_0x9d1f('0x17'));var logger=require(_0x9d1f('0x18'))(_0x9d1f('0x19'));var utils=require(_0x9d1f('0x1a'));var config=require(_0x9d1f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d1f('0x1c'))['db'];function respondWithStatusCode(_0x15a999,_0x7edbfa){_0x7edbfa=_0x7edbfa||0xcc;return function(_0x5a4d43){if(_0x5a4d43){return _0x15a999[_0x9d1f('0x1d')](_0x7edbfa);}return _0x15a999['status'](_0x7edbfa)['end']();};}function respondWithResult(_0x71e9c9,_0x38395d){_0x38395d=_0x38395d||0xc8;return function(_0x25c0b0){if(_0x25c0b0){return _0x71e9c9[_0x9d1f('0x1e')](_0x38395d)[_0x9d1f('0x1f')](_0x25c0b0);}};}function respondWithFilteredResult(_0x40a87f,_0x9f8cfc){return function(_0x2488a3){if(_0x2488a3){var _0x24cd8a=typeof _0x9f8cfc[_0x9d1f('0x20')]===_0x9d1f('0x21')&&typeof _0x9f8cfc[_0x9d1f('0x22')]===_0x9d1f('0x21');var _0x57ba11=_0x2488a3[_0x9d1f('0x23')];var _0x42a2b4=_0x24cd8a?0x0:_0x9f8cfc['offset'];var _0x329b69=_0x24cd8a?_0x2488a3['count']:_0x9f8cfc['offset']+_0x9f8cfc['limit'];var _0x2d39f3;if(_0x329b69>=_0x57ba11){_0x329b69=_0x57ba11;_0x2d39f3=0xc8;}else{_0x2d39f3=0xce;}_0x40a87f[_0x9d1f('0x1e')](_0x2d39f3);return _0x40a87f[_0x9d1f('0x24')]('Content-Range',_0x42a2b4+'-'+_0x329b69+'/'+_0x57ba11)[_0x9d1f('0x1f')](_0x2488a3);}return null;};}function patchUpdates(_0x4cfcf5){return function(_0x1c0280){try{jsonpatch['apply'](_0x1c0280,_0x4cfcf5,!![]);}catch(_0x552a84){return BPromise[_0x9d1f('0x25')](_0x552a84);}return _0x1c0280[_0x9d1f('0x26')]();};}function saveUpdates(_0x35a80d,_0x2d861b){return function(_0x44ef15){if(_0x44ef15){return _0x44ef15[_0x9d1f('0x27')](_0x35a80d)[_0x9d1f('0x28')](function(_0x3b10f7){return _0x3b10f7;});}return null;};}function removeEntity(_0x2c6417,_0xc05aa){return function(_0x1ab0f4){if(_0x1ab0f4){return _0x1ab0f4[_0x9d1f('0x29')]()[_0x9d1f('0x28')](function(){_0x2c6417[_0x9d1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b234d,_0xa2392f){return function(_0x48245c){if(!_0x48245c){_0x2b234d['sendStatus'](0x194);}return _0x48245c;};}function handleError(_0x1f2b0e,_0xfdd4ae){_0xfdd4ae=_0xfdd4ae||0x1f4;return function(_0x3ca450){logger[_0x9d1f('0x2a')](_0x3ca450[_0x9d1f('0x2b')]);if(_0x3ca450['name']){delete _0x3ca450['name'];}_0x1f2b0e[_0x9d1f('0x1e')](_0xfdd4ae)[_0x9d1f('0x2c')](_0x3ca450);};}exports[_0x9d1f('0x2d')]=function(_0x44515d,_0x1df1b8){var _0x1d8ffe={},_0x48fbf5={},_0x2b11db={'count':0x0,'rows':[]};var _0x4daec3=_[_0x9d1f('0x2e')](db[_0x9d1f('0x2f')][_0x9d1f('0x30')],function(_0x579c46){return{'name':_0x579c46[_0x9d1f('0x31')],'type':_0x579c46['type'][_0x9d1f('0x32')]};});_0x48fbf5[_0x9d1f('0x33')]=_[_0x9d1f('0x2e')](_0x4daec3,'name');_0x48fbf5['query']=_[_0x9d1f('0x34')](_0x44515d[_0x9d1f('0x35')]);_0x48fbf5['filters']=_[_0x9d1f('0x36')](_0x48fbf5[_0x9d1f('0x33')],_0x48fbf5[_0x9d1f('0x35')]);_0x1d8ffe[_0x9d1f('0x37')]=_['intersection'](_0x48fbf5[_0x9d1f('0x33')],qs[_0x9d1f('0x38')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x38')]));_0x1d8ffe['attributes']=_0x1d8ffe[_0x9d1f('0x37')]['length']?_0x1d8ffe[_0x9d1f('0x37')]:_0x48fbf5[_0x9d1f('0x33')];if(!_0x44515d[_0x9d1f('0x35')]['hasOwnProperty'](_0x9d1f('0x39'))){_0x1d8ffe[_0x9d1f('0x22')]=qs[_0x9d1f('0x22')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x22')]);_0x1d8ffe['offset']=qs[_0x9d1f('0x20')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x20')]);}_0x1d8ffe[_0x9d1f('0x3a')]=qs[_0x9d1f('0x3b')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x3b')]);_0x1d8ffe['where']=qs[_0x9d1f('0x3c')](_[_0x9d1f('0x3d')](_0x44515d[_0x9d1f('0x35')],_0x48fbf5[_0x9d1f('0x3c')]),_0x4daec3);if(_0x44515d['query'][_0x9d1f('0x3e')]){_0x1d8ffe['where']=_['merge'](_0x1d8ffe['where'],{'$or':_[_0x9d1f('0x2e')](_0x4daec3,function(_0x1253e2){if(_0x1253e2['type']!==_0x9d1f('0x3f')){var _0x28fde6={};_0x28fde6[_0x1253e2[_0x9d1f('0x40')]]={'$like':'%'+_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x3e')]+'%'};return _0x28fde6;}})});}_0x1d8ffe=_[_0x9d1f('0x41')]({},_0x1d8ffe,_0x44515d[_0x9d1f('0x42')]);var _0x537407={'where':_0x1d8ffe[_0x9d1f('0x43')]};return db['JscriptyAnswerReport'][_0x9d1f('0x23')](_0x537407)[_0x9d1f('0x28')](function(_0x5f2ae9){_0x2b11db[_0x9d1f('0x23')]=_0x5f2ae9;if(_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x44')]){_0x1d8ffe[_0x9d1f('0x45')]=[{'all':!![]}];}return db[_0x9d1f('0x2f')][_0x9d1f('0x46')](_0x1d8ffe);})[_0x9d1f('0x28')](function(_0x54c0c0){_0x2b11db[_0x9d1f('0x47')]=_0x54c0c0;return _0x2b11db;})[_0x9d1f('0x28')](respondWithFilteredResult(_0x1df1b8,_0x1d8ffe))['catch'](handleError(_0x1df1b8,null));};exports[_0x9d1f('0x48')]=function(_0x4ab238,_0x3555de){var _0x185185={'raw':!![],'where':{'id':_0x4ab238[_0x9d1f('0x49')]['id']}},_0x48dc9a={};_0x48dc9a[_0x9d1f('0x33')]=_[_0x9d1f('0x34')](db[_0x9d1f('0x2f')][_0x9d1f('0x30')]);_0x48dc9a['query']=_[_0x9d1f('0x34')](_0x4ab238[_0x9d1f('0x35')]);_0x48dc9a['filters']=_[_0x9d1f('0x36')](_0x48dc9a[_0x9d1f('0x33')],_0x48dc9a[_0x9d1f('0x35')]);_0x185185[_0x9d1f('0x37')]=_[_0x9d1f('0x36')](_0x48dc9a[_0x9d1f('0x33')],qs[_0x9d1f('0x38')](_0x4ab238[_0x9d1f('0x35')][_0x9d1f('0x38')]));_0x185185[_0x9d1f('0x37')]=_0x185185[_0x9d1f('0x37')][_0x9d1f('0x4a')]?_0x185185[_0x9d1f('0x37')]:_0x48dc9a[_0x9d1f('0x33')];if(_0x4ab238['query'][_0x9d1f('0x44')]){_0x185185[_0x9d1f('0x45')]=[{'all':!![]}];}_0x185185=_[_0x9d1f('0x41')]({},_0x185185,_0x4ab238[_0x9d1f('0x42')]);return db[_0x9d1f('0x2f')][_0x9d1f('0x4b')](_0x185185)[_0x9d1f('0x28')](handleEntityNotFound(_0x3555de,null))[_0x9d1f('0x28')](respondWithResult(_0x3555de,null))['catch'](handleError(_0x3555de,null));};exports[_0x9d1f('0x4c')]=function(_0x132904,_0xea9cae){return db[_0x9d1f('0x2f')]['create'](_0x132904[_0x9d1f('0x4d')],{})['then'](respondWithResult(_0xea9cae,0xc9))['catch'](handleError(_0xea9cae,null));};exports[_0x9d1f('0x27')]=function(_0x4306ec,_0x272357){if(_0x4306ec[_0x9d1f('0x4d')]['id']){delete _0x4306ec[_0x9d1f('0x4d')]['id'];}return db['JscriptyAnswerReport'][_0x9d1f('0x4b')]({'where':{'id':_0x4306ec[_0x9d1f('0x49')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x272357,null))[_0x9d1f('0x28')](saveUpdates(_0x4306ec[_0x9d1f('0x4d')],null))['then'](respondWithResult(_0x272357,null))[_0x9d1f('0x4e')](handleError(_0x272357,null));};exports[_0x9d1f('0x29')]=function(_0x4c0f05,_0x5a9b0d){return db[_0x9d1f('0x2f')][_0x9d1f('0x4b')]({'where':{'id':_0x4c0f05[_0x9d1f('0x49')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x5a9b0d,null))[_0x9d1f('0x28')](removeEntity(_0x5a9b0d,null))['catch'](handleError(_0x5a9b0d,null));};exports['describe']=function(_0x100d6c,_0x18a79a){return db[_0x9d1f('0x2f')][_0x9d1f('0x4f')]()['then'](respondWithResult(_0x18a79a,null))[_0x9d1f('0x4e')](handleError(_0x18a79a,null));}; \ No newline at end of file +var _0x8ad5=['order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','rows','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x499d07,_0x494e24){var _0x27e38a=function(_0x271329){while(--_0x271329){_0x499d07['push'](_0x499d07['shift']());}};_0x27e38a(++_0x494e24);}(_0x8ad5,0xf1));var _0x58ad=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8ad5[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x58ad('0x0'));var rimraf=require(_0x58ad('0x1'));var zipdir=require(_0x58ad('0x2'));var jsonpatch=require(_0x58ad('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x58ad('0x4'));var Mustache=require(_0x58ad('0x5'));var util=require(_0x58ad('0x6'));var path=require(_0x58ad('0x7'));var sox=require(_0x58ad('0x8'));var csv=require(_0x58ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58ad('0xa'));var squel=require(_0x58ad('0xb'));var crypto=require(_0x58ad('0xc'));var jsforce=require(_0x58ad('0xd'));var deskjs=require(_0x58ad('0xe'));var toCsv=require(_0x58ad('0x9'));var querystring=require(_0x58ad('0xf'));var Papa=require(_0x58ad('0x10'));var Redis=require(_0x58ad('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x58ad('0x12'));var as=require(_0x58ad('0x13'));var hardwareService=require(_0x58ad('0x14'));var logger=require(_0x58ad('0x15'))(_0x58ad('0x16'));var utils=require(_0x58ad('0x17'));var config=require(_0x58ad('0x18'));var licenseUtil=require(_0x58ad('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x315a24,_0x28290a){_0x28290a=_0x28290a||0xcc;return function(_0x5a208c){if(_0x5a208c){return _0x315a24[_0x58ad('0x1a')](_0x28290a);}return _0x315a24[_0x58ad('0x1b')](_0x28290a)[_0x58ad('0x1c')]();};}function respondWithResult(_0x36caa1,_0x24a1fb){_0x24a1fb=_0x24a1fb||0xc8;return function(_0x5bc297){if(_0x5bc297){return _0x36caa1['status'](_0x24a1fb)['json'](_0x5bc297);}};}function respondWithFilteredResult(_0x57ce95,_0x34bea5){return function(_0x5ba955){if(_0x5ba955){var _0x149583=typeof _0x34bea5[_0x58ad('0x1d')]===_0x58ad('0x1e')&&typeof _0x34bea5[_0x58ad('0x1f')]===_0x58ad('0x1e');var _0x575047=_0x5ba955[_0x58ad('0x20')];var _0x24fbe0=_0x149583?0x0:_0x34bea5[_0x58ad('0x1d')];var _0xc8b034=_0x149583?_0x5ba955[_0x58ad('0x20')]:_0x34bea5[_0x58ad('0x1d')]+_0x34bea5[_0x58ad('0x1f')];var _0xb0e5b1;if(_0xc8b034>=_0x575047){_0xc8b034=_0x575047;_0xb0e5b1=0xc8;}else{_0xb0e5b1=0xce;}_0x57ce95['status'](_0xb0e5b1);return _0x57ce95[_0x58ad('0x21')](_0x58ad('0x22'),_0x24fbe0+'-'+_0xc8b034+'/'+_0x575047)[_0x58ad('0x23')](_0x5ba955);}return null;};}function patchUpdates(_0x5e4ff8){return function(_0x850321){try{jsonpatch[_0x58ad('0x24')](_0x850321,_0x5e4ff8,!![]);}catch(_0x154804){return BPromise['reject'](_0x154804);}return _0x850321[_0x58ad('0x25')]();};}function saveUpdates(_0x32e3cf,_0xb50caf){return function(_0xf2129c){if(_0xf2129c){return _0xf2129c['update'](_0x32e3cf)[_0x58ad('0x26')](function(_0x3f87b2){return _0x3f87b2;});}return null;};}function removeEntity(_0x2bf81e,_0x5f7669){return function(_0x20a572){if(_0x20a572){return _0x20a572[_0x58ad('0x27')]()[_0x58ad('0x26')](function(){_0x2bf81e[_0x58ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13220b,_0x4ec837){return function(_0x3de31f){if(!_0x3de31f){_0x13220b['sendStatus'](0x194);}return _0x3de31f;};}function handleError(_0x50c131,_0x139149){_0x139149=_0x139149||0x1f4;return function(_0x3d7d74){logger[_0x58ad('0x28')](_0x3d7d74[_0x58ad('0x29')]);if(_0x3d7d74[_0x58ad('0x2a')]){delete _0x3d7d74[_0x58ad('0x2a')];}_0x50c131[_0x58ad('0x1b')](_0x139149)[_0x58ad('0x2b')](_0x3d7d74);};}exports[_0x58ad('0x2c')]=function(_0x167485,_0x230880){var _0x50731e={},_0x2bffbd={},_0x3b4a38={'count':0x0,'rows':[]};var _0xc2fa0d=_[_0x58ad('0x2d')](db[_0x58ad('0x2e')]['rawAttributes'],function(_0x3ee7dd){return{'name':_0x3ee7dd[_0x58ad('0x2f')],'type':_0x3ee7dd[_0x58ad('0x30')][_0x58ad('0x31')]};});_0x2bffbd[_0x58ad('0x32')]=_['map'](_0xc2fa0d,'name');_0x2bffbd[_0x58ad('0x33')]=_[_0x58ad('0x34')](_0x167485[_0x58ad('0x33')]);_0x2bffbd[_0x58ad('0x35')]=_[_0x58ad('0x36')](_0x2bffbd[_0x58ad('0x32')],_0x2bffbd[_0x58ad('0x33')]);_0x50731e[_0x58ad('0x37')]=_['intersection'](_0x2bffbd[_0x58ad('0x32')],qs[_0x58ad('0x38')](_0x167485[_0x58ad('0x33')]['fields']));_0x50731e[_0x58ad('0x37')]=_0x50731e['attributes'][_0x58ad('0x39')]?_0x50731e[_0x58ad('0x37')]:_0x2bffbd['model'];if(!_0x167485[_0x58ad('0x33')][_0x58ad('0x3a')]('nolimit')){_0x50731e['limit']=qs[_0x58ad('0x1f')](_0x167485[_0x58ad('0x33')]['limit']);_0x50731e[_0x58ad('0x1d')]=qs['offset'](_0x167485['query'][_0x58ad('0x1d')]);}_0x50731e[_0x58ad('0x3b')]=qs[_0x58ad('0x3c')](_0x167485[_0x58ad('0x33')][_0x58ad('0x3c')]);_0x50731e['where']=qs[_0x58ad('0x35')](_[_0x58ad('0x3d')](_0x167485[_0x58ad('0x33')],_0x2bffbd[_0x58ad('0x35')]),_0xc2fa0d);if(_0x167485[_0x58ad('0x33')]['filter']){_0x50731e[_0x58ad('0x3e')]=_[_0x58ad('0x3f')](_0x50731e[_0x58ad('0x3e')],{'$or':_['map'](_0xc2fa0d,function(_0x574486){if(_0x574486['type']!==_0x58ad('0x40')){var _0x5b0827={};_0x5b0827[_0x574486[_0x58ad('0x2a')]]={'$like':'%'+_0x167485[_0x58ad('0x33')][_0x58ad('0x41')]+'%'};return _0x5b0827;}})});}_0x50731e=_[_0x58ad('0x3f')]({},_0x50731e,_0x167485['options']);var _0x3d2c72={'where':_0x50731e[_0x58ad('0x3e')]};return db[_0x58ad('0x2e')]['count'](_0x3d2c72)['then'](function(_0x3c9fbb){_0x3b4a38[_0x58ad('0x20')]=_0x3c9fbb;if(_0x167485[_0x58ad('0x33')]['includeAll']){_0x50731e[_0x58ad('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x58ad('0x43')](_0x50731e);})[_0x58ad('0x26')](function(_0x240c45){_0x3b4a38[_0x58ad('0x44')]=_0x240c45;return _0x3b4a38;})[_0x58ad('0x26')](respondWithFilteredResult(_0x230880,_0x50731e))[_0x58ad('0x45')](handleError(_0x230880,null));};exports['show']=function(_0x40d337,_0x533f4b){var _0x425964={'raw':!![],'where':{'id':_0x40d337['params']['id']}},_0x2d333e={};_0x2d333e[_0x58ad('0x32')]=_[_0x58ad('0x34')](db['JscriptyAnswerReport']['rawAttributes']);_0x2d333e[_0x58ad('0x33')]=_['keys'](_0x40d337[_0x58ad('0x33')]);_0x2d333e[_0x58ad('0x35')]=_['intersection'](_0x2d333e['model'],_0x2d333e[_0x58ad('0x33')]);_0x425964[_0x58ad('0x37')]=_[_0x58ad('0x36')](_0x2d333e[_0x58ad('0x32')],qs[_0x58ad('0x38')](_0x40d337[_0x58ad('0x33')][_0x58ad('0x38')]));_0x425964[_0x58ad('0x37')]=_0x425964[_0x58ad('0x37')][_0x58ad('0x39')]?_0x425964[_0x58ad('0x37')]:_0x2d333e[_0x58ad('0x32')];if(_0x40d337[_0x58ad('0x33')]['includeAll']){_0x425964[_0x58ad('0x42')]=[{'all':!![]}];}_0x425964=_[_0x58ad('0x3f')]({},_0x425964,_0x40d337['options']);return db[_0x58ad('0x2e')]['find'](_0x425964)[_0x58ad('0x26')](handleEntityNotFound(_0x533f4b,null))[_0x58ad('0x26')](respondWithResult(_0x533f4b,null))[_0x58ad('0x45')](handleError(_0x533f4b,null));};exports['create']=function(_0x5b111d,_0x4d9216){return db[_0x58ad('0x2e')][_0x58ad('0x46')](_0x5b111d['body'],{})[_0x58ad('0x26')](respondWithResult(_0x4d9216,0xc9))[_0x58ad('0x45')](handleError(_0x4d9216,null));};exports['update']=function(_0x31592a,_0x2fce8b){if(_0x31592a[_0x58ad('0x47')]['id']){delete _0x31592a[_0x58ad('0x47')]['id'];}return db[_0x58ad('0x2e')][_0x58ad('0x48')]({'where':{'id':_0x31592a[_0x58ad('0x49')]['id']}})[_0x58ad('0x26')](handleEntityNotFound(_0x2fce8b,null))[_0x58ad('0x26')](saveUpdates(_0x31592a[_0x58ad('0x47')],null))['then'](respondWithResult(_0x2fce8b,null))[_0x58ad('0x45')](handleError(_0x2fce8b,null));};exports[_0x58ad('0x27')]=function(_0x12ec50,_0x1d6f05){return db[_0x58ad('0x2e')][_0x58ad('0x48')]({'where':{'id':_0x12ec50[_0x58ad('0x49')]['id']}})[_0x58ad('0x26')](handleEntityNotFound(_0x1d6f05,null))[_0x58ad('0x26')](removeEntity(_0x1d6f05,null))[_0x58ad('0x45')](handleError(_0x1d6f05,null));};exports[_0x58ad('0x4a')]=function(_0x3841b8,_0x4fbf4c){return db[_0x58ad('0x2e')][_0x58ad('0x4a')]()['then'](respondWithResult(_0x4fbf4c,null))['catch'](handleError(_0x4fbf4c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 584daad..d86ceec 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 _0x644e=['exports','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x644e,0xff));var _0xe644=function(_0x47b26c,_0x3b77be){_0x47b26c=_0x47b26c-0x0;var _0xf433a7=_0x644e[_0x47b26c];return _0xf433a7;};'use strict';var _=require(_0xe644('0x0'));var util=require(_0xe644('0x1'));var logger=require(_0xe644('0x2'))(_0xe644('0x3'));var moment=require(_0xe644('0x4'));var BPromise=require('bluebird');var rp=require(_0xe644('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe644('0x6'));var config=require(_0xe644('0x7'));var attributes=require(_0xe644('0x8'));module[_0xe644('0x9')]=function(_0x287f0a,_0x18da97){return _0x287f0a[_0xe644('0xa')](_0xe644('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61de=['bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x61de,0x104));var _0xe61d=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x61de[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xe61d('0x0'));var util=require(_0xe61d('0x1'));var logger=require(_0xe61d('0x2'))(_0xe61d('0x3'));var moment=require('moment');var BPromise=require(_0xe61d('0x4'));var rp=require(_0xe61d('0x5'));var fs=require('fs');var path=require(_0xe61d('0x6'));var rimraf=require(_0xe61d('0x7'));var config=require('../../config/environment');var attributes=require(_0xe61d('0x8'));module[_0xe61d('0x9')]=function(_0x2ad424,_0x20eabd){return _0x2ad424['define'](_0xe61d('0xa'),attributes,{'tableName':_0xe61d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 2579db7..6e5c79d 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 _0xbe83=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result'];(function(_0x25f8ca,_0x23b450){var _0x25386e=function(_0x407448){while(--_0x407448){_0x25f8ca['push'](_0x25f8ca['shift']());}};_0x25386e(++_0x23b450);}(_0xbe83,0x1e3));var _0x3be8=function(_0x598c9c,_0x575deb){_0x598c9c=_0x598c9c-0x0;var _0x3f2fc6=_0xbe83[_0x598c9c];return _0x3f2fc6;};'use strict';var _=require(_0x3be8('0x0'));var util=require(_0x3be8('0x1'));var moment=require(_0x3be8('0x2'));var BPromise=require(_0x3be8('0x3'));var rs=require(_0x3be8('0x4'));var fs=require('fs');var Redis=require(_0x3be8('0x5'));var db=require(_0x3be8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3be8('0x7'))(_0x3be8('0x8'));var config=require(_0x3be8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3be8('0xa')][_0x3be8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x593b8a,_0x1ef999,_0x86f3ad){return new BPromise(function(_0x55f2c3,_0x473076){return client[_0x3be8('0xc')](_0x593b8a,_0x86f3ad)[_0x3be8('0xd')](function(_0x97a7d5){logger[_0x3be8('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1ef999,'request\x20sent');logger[_0x3be8('0xf')](_0x3be8('0x10'),_0x1ef999,_0x3be8('0x11'),JSON[_0x3be8('0x12')](_0x97a7d5));if(_0x97a7d5['error']){if(_0x97a7d5[_0x3be8('0x13')]['code']===0x1f4){logger[_0x3be8('0x13')](_0x3be8('0x14'),_0x1ef999,_0x97a7d5[_0x3be8('0x13')][_0x3be8('0x15')]);return _0x473076(_0x97a7d5['error']['message']);}logger[_0x3be8('0x13')](_0x3be8('0x14'),_0x1ef999,_0x97a7d5['error'][_0x3be8('0x15')]);return _0x55f2c3(_0x97a7d5[_0x3be8('0x13')][_0x3be8('0x15')]);}else{logger['info'](_0x3be8('0x14'),_0x1ef999,_0x3be8('0x11'));_0x55f2c3(_0x97a7d5[_0x3be8('0x16')][_0x3be8('0x15')]);}})['catch'](function(_0x4b06b8){logger[_0x3be8('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1ef999,_0x4b06b8);_0x473076(_0x4b06b8);});});} \ No newline at end of file +var _0x3aa8=['info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x3aa8,0x7e));var _0x83aa=function(_0x2608da,_0x241527){_0x2608da=_0x2608da-0x0;var _0x2c15b8=_0x3aa8[_0x2608da];return _0x2c15b8;};'use strict';var _=require(_0x83aa('0x0'));var util=require('util');var moment=require(_0x83aa('0x1'));var BPromise=require('bluebird');var rs=require(_0x83aa('0x2'));var fs=require('fs');var Redis=require(_0x83aa('0x3'));var db=require(_0x83aa('0x4'))['db'];var utils=require(_0x83aa('0x5'));var logger=require(_0x83aa('0x6'))('rpc');var config=require(_0x83aa('0x7'));var jayson=require(_0x83aa('0x8'));var client=jayson['client'][_0x83aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5883df,_0x359edb,_0x5cc8a7){return new BPromise(function(_0xd94989,_0x180075){return client[_0x83aa('0xa')](_0x5883df,_0x5cc8a7)[_0x83aa('0xb')](function(_0x310913){logger[_0x83aa('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x359edb,_0x83aa('0xd'));logger[_0x83aa('0xe')](_0x83aa('0xf'),_0x359edb,'request\x20sent',JSON[_0x83aa('0x10')](_0x310913));if(_0x310913[_0x83aa('0x11')]){if(_0x310913[_0x83aa('0x11')][_0x83aa('0x12')]===0x1f4){logger[_0x83aa('0x11')](_0x83aa('0x13'),_0x359edb,_0x310913['error']['message']);return _0x180075(_0x310913[_0x83aa('0x11')][_0x83aa('0x14')]);}logger[_0x83aa('0x11')](_0x83aa('0x13'),_0x359edb,_0x310913[_0x83aa('0x11')][_0x83aa('0x14')]);return _0xd94989(_0x310913[_0x83aa('0x11')][_0x83aa('0x14')]);}else{logger[_0x83aa('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x359edb,_0x83aa('0xd'));_0xd94989(_0x310913[_0x83aa('0x15')][_0x83aa('0x14')]);}})[_0x83aa('0x16')](function(_0xd4bd0a){logger[_0x83aa('0x11')](_0x83aa('0x13'),_0x359edb,_0xd4bd0a);_0x180075(_0xd4bd0a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ba0f7d1..48a3a39 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 _0x7f4e=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete'];(function(_0x1e1836,_0x37d01a){var _0x495dc1=function(_0x215af6){while(--_0x215af6){_0x1e1836['push'](_0x1e1836['shift']());}};_0x495dc1(++_0x37d01a);}(_0x7f4e,0x12e));var _0xe7f4=function(_0x27fa28,_0x3e4ad6){_0x27fa28=_0x27fa28-0x0;var _0x46b233=_0x7f4e[_0x27fa28];return _0x46b233;};'use strict';var multer=require(_0xe7f4('0x0'));var util=require(_0xe7f4('0x1'));var path=require(_0xe7f4('0x2'));var timeout=require(_0xe7f4('0x3'));var express=require(_0xe7f4('0x4'));var router=express['Router']();var fs_extra=require(_0xe7f4('0x5'));var auth=require(_0xe7f4('0x6'));var interaction=require(_0xe7f4('0x7'));var config=require(_0xe7f4('0x8'));var controller=require(_0xe7f4('0x9'));router[_0xe7f4('0xa')]('/',auth[_0xe7f4('0xb')](),controller[_0xe7f4('0xc')]);router[_0xe7f4('0xa')](_0xe7f4('0xd'),auth[_0xe7f4('0xb')](),controller[_0xe7f4('0xe')]);router[_0xe7f4('0xa')](_0xe7f4('0xf'),auth[_0xe7f4('0xb')](),controller['getSessions']);router[_0xe7f4('0xa')](_0xe7f4('0x10'),auth['isAuthenticated'](),controller[_0xe7f4('0x11')]);router[_0xe7f4('0xa')](_0xe7f4('0x12'),auth[_0xe7f4('0xb')](),timeout(_0xe7f4('0x13')),controller[_0xe7f4('0x14')]);router[_0xe7f4('0x15')]('/',auth['isAuthenticated'](),controller[_0xe7f4('0x16')]);router[_0xe7f4('0x15')](_0xe7f4('0x17'),auth[_0xe7f4('0xb')](),controller[_0xe7f4('0x18')]);router[_0xe7f4('0x19')](_0xe7f4('0xd'),auth[_0xe7f4('0xb')](),controller[_0xe7f4('0x1a')]);router[_0xe7f4('0x1b')](_0xe7f4('0xd'),auth[_0xe7f4('0xb')](),controller[_0xe7f4('0x1c')]);module[_0xe7f4('0x1d')]=router; \ No newline at end of file +var _0x662a=['create','/:id/clone','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary'];(function(_0x155962,_0x43833e){var _0x459bbc=function(_0x4098db){while(--_0x4098db){_0x155962['push'](_0x155962['shift']());}};_0x459bbc(++_0x43833e);}(_0x662a,0xae));var _0xa662=function(_0x4869f9,_0x3a0045){_0x4869f9=_0x4869f9-0x0;var _0x5cd825=_0x662a[_0x4869f9];return _0x5cd825;};'use strict';var multer=require('multer');var util=require(_0xa662('0x0'));var path=require(_0xa662('0x1'));var timeout=require(_0xa662('0x2'));var express=require(_0xa662('0x3'));var router=express[_0xa662('0x4')]();var fs_extra=require(_0xa662('0x5'));var auth=require(_0xa662('0x6'));var interaction=require(_0xa662('0x7'));var config=require(_0xa662('0x8'));var controller=require(_0xa662('0x9'));router[_0xa662('0xa')]('/',auth[_0xa662('0xb')](),controller[_0xa662('0xc')]);router[_0xa662('0xa')](_0xa662('0xd'),auth[_0xa662('0xb')](),controller[_0xa662('0xe')]);router['get'](_0xa662('0xf'),auth[_0xa662('0xb')](),controller[_0xa662('0x10')]);router[_0xa662('0xa')](_0xa662('0x11'),auth[_0xa662('0xb')](),controller[_0xa662('0x12')]);router['get'](_0xa662('0x13'),auth[_0xa662('0xb')](),timeout(_0xa662('0x14')),controller[_0xa662('0x15')]);router['post']('/',auth[_0xa662('0xb')](),controller[_0xa662('0x16')]);router['post'](_0xa662('0x17'),auth[_0xa662('0xb')](),controller['clone']);router[_0xa662('0x18')](_0xa662('0xd'),auth['isAuthenticated'](),controller[_0xa662('0x19')]);router[_0xa662('0x1a')](_0xa662('0xd'),auth[_0xa662('0xb')](),controller[_0xa662('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e4d28ad..07e7308 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 _0xdcb3=['getDataValue','BOOLEAN','sequelize','util','STRING','name','TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x377cc6,_0x153dc7){var _0x22fc9b=function(_0x176fde){while(--_0x176fde){_0x377cc6['push'](_0x377cc6['shift']());}};_0x22fc9b(++_0x153dc7);}(_0xdcb3,0x13d));var _0x3dcb=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0xdcb3[_0x5ea2f9];return _0x36e586;};'use strict';var Sequelize=require(_0x3dcb('0x0'));var _=require('lodash');var util=require(_0x3dcb('0x1'));module['exports']={'name':{'type':Sequelize[_0x3dcb('0x2')],'unique':_0x3dcb('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3dcb('0x4')](_0x3dcb('0x5')),'set':function(_0x287435){if(_[_0x3dcb('0x6')](_0x287435)){this['setDataValue']('formData',JSON[_0x3dcb('0x7')](_0x287435));}else if(_[_0x3dcb('0x8')](_0x287435)){this[_0x3dcb('0x9')](_0x3dcb('0xa'),_0x287435);}else{this[_0x3dcb('0x9')]('formData',util[_0x3dcb('0xb')](_0x3dcb('0xc'),this[_0x3dcb('0xd')](_0x3dcb('0x3'))||'',this[_0x3dcb('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3dcb('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3dcb('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xbff5=['description','BOOLEAN','lodash','util','exports','STRING','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x10650b,_0x128945){var _0x2b6133=function(_0x350440){while(--_0x350440){_0x10650b['push'](_0x10650b['shift']());}};_0x2b6133(++_0x128945);}(_0xbff5,0xce));var _0x5bff=function(_0x2f8962,_0x29ebc4){_0x2f8962=_0x2f8962-0x0;var _0x1a9f6c=_0xbff5[_0x2f8962];return _0x1a9f6c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));module[_0x5bff('0x2')]={'name':{'type':Sequelize[_0x5bff('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x5bff('0x3')]},'formData':{'type':Sequelize[_0x5bff('0x4')](_0x5bff('0x5')),'set':function(_0x472e16){if(_[_0x5bff('0x6')](_0x472e16)){this['setDataValue'](_0x5bff('0x7'),JSON[_0x5bff('0x8')](_0x472e16));}else if(_[_0x5bff('0x9')](_0x472e16)){this[_0x5bff('0xa')](_0x5bff('0x7'),_0x472e16);}else{this[_0x5bff('0xa')](_0x5bff('0x7'),util[_0x5bff('0xb')](_0x5bff('0xc'),this[_0x5bff('0xd')](_0x5bff('0xe'))||'',this[_0x5bff('0xd')](_0x5bff('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5bff('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9210bdb..9fe4311 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 _0x9a86=['/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','rimraf','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','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','map','JscriptyProject','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','length','find','catch','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','findAll','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','starttime','parse','startTime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync'];(function(_0x4be5c6,_0x22b387){var _0x21631d=function(_0x53018c){while(--_0x53018c){_0x4be5c6['push'](_0x4be5c6['shift']());}};_0x21631d(++_0x22b387);}(_0x9a86,0x1ed));var _0x69a8=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x9a86[_0x45fc6a];return _0x14bcfd;};'use strict';var emlformat=require(_0x69a8('0x0'));var rimraf=require(_0x69a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69a8('0x2'));var rp=require(_0x69a8('0x3'));var moment=require(_0x69a8('0x4'));var BPromise=require(_0x69a8('0x5'));var Mustache=require(_0x69a8('0x6'));var util=require(_0x69a8('0x7'));var path=require(_0x69a8('0x8'));var sox=require(_0x69a8('0x9'));var csv=require(_0x69a8('0xa'));var ejs=require(_0x69a8('0xb'));var fs=require('fs');var fs_extra=require(_0x69a8('0xc'));var _=require(_0x69a8('0xd'));var squel=require(_0x69a8('0xe'));var crypto=require(_0x69a8('0xf'));var jsforce=require(_0x69a8('0x10'));var deskjs=require(_0x69a8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x69a8('0x12'));var Papa=require(_0x69a8('0x13'));var Redis=require('ioredis');var authService=require(_0x69a8('0x14'));var qs=require(_0x69a8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x69a8('0x16'))(_0x69a8('0x17'));var utils=require(_0x69a8('0x18'));var config=require(_0x69a8('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12bc21,_0x4eb43a){_0x4eb43a=_0x4eb43a||0xcc;return function(_0x18f782){if(_0x18f782){return _0x12bc21[_0x69a8('0x1a')](_0x4eb43a);}return _0x12bc21[_0x69a8('0x1b')](_0x4eb43a)[_0x69a8('0x1c')]();};}function respondWithResult(_0x272100,_0x524b28){_0x524b28=_0x524b28||0xc8;return function(_0x463937){if(_0x463937){return _0x272100['status'](_0x524b28)[_0x69a8('0x1d')](_0x463937);}};}function respondWithFilteredResult(_0x10c6c8,_0x5edd76){return function(_0x33b701){if(_0x33b701){var _0x264347=typeof _0x5edd76[_0x69a8('0x1e')]===_0x69a8('0x1f')&&typeof _0x5edd76[_0x69a8('0x20')]===_0x69a8('0x1f');var _0x1c15a3=_0x33b701[_0x69a8('0x21')];var _0x3c6252=_0x264347?0x0:_0x5edd76[_0x69a8('0x1e')];var _0x298aff=_0x264347?_0x33b701['count']:_0x5edd76[_0x69a8('0x1e')]+_0x5edd76[_0x69a8('0x20')];var _0x237232;if(_0x298aff>=_0x1c15a3){_0x298aff=_0x1c15a3;_0x237232=0xc8;}else{_0x237232=0xce;}_0x10c6c8['status'](_0x237232);return _0x10c6c8[_0x69a8('0x22')]('Content-Range',_0x3c6252+'-'+_0x298aff+'/'+_0x1c15a3)[_0x69a8('0x1d')](_0x33b701);}return null;};}function patchUpdates(_0x2db796){return function(_0x12cb53){try{jsonpatch[_0x69a8('0x23')](_0x12cb53,_0x2db796,!![]);}catch(_0x23df9e){return BPromise[_0x69a8('0x24')](_0x23df9e);}return _0x12cb53[_0x69a8('0x25')]();};}function saveUpdates(_0x40a35d,_0x363fc0){return function(_0x451f44){if(_0x451f44){return _0x451f44[_0x69a8('0x26')](_0x40a35d)[_0x69a8('0x27')](function(_0x33e39c){return _0x33e39c;});}return null;};}function removeEntity(_0x5a831e,_0x525883){return function(_0x2381bf){if(_0x2381bf){return _0x2381bf['destroy']()[_0x69a8('0x27')](function(){var _0x115cdd=_0x2381bf[_0x69a8('0x28')]({'plain':!![]});var _0x45a7c6=_0x69a8('0x29');return db[_0x69a8('0x2a')][_0x69a8('0x2b')]({'where':{'type':_0x45a7c6,'resourceId':_0x115cdd['id']}})[_0x69a8('0x27')](function(){return _0x2381bf;});})[_0x69a8('0x27')](function(){_0x5a831e[_0x69a8('0x1b')](0xcc)[_0x69a8('0x1c')]();});}};}function handleEntityNotFound(_0x21e789,_0x3d0754){return function(_0xb61a04){if(!_0xb61a04){_0x21e789[_0x69a8('0x1a')](0x194);}return _0xb61a04;};}function handleError(_0x277764,_0x2238ac){_0x2238ac=_0x2238ac||0x1f4;return function(_0xb1da74){logger[_0x69a8('0x2c')](_0xb1da74[_0x69a8('0x2d')]);if(_0xb1da74[_0x69a8('0x2e')]){delete _0xb1da74['name'];}_0x277764[_0x69a8('0x1b')](_0x2238ac)[_0x69a8('0x2f')](_0xb1da74);};}exports['index']=function(_0x2e7355,_0x5c8981){var _0x111167={},_0x2f5de1={},_0x5db1f0={'count':0x0,'rows':[]};var _0x51a25e=_[_0x69a8('0x30')](db[_0x69a8('0x31')]['rawAttributes'],function(_0x337a76){return{'name':_0x337a76['fieldName'],'type':_0x337a76[_0x69a8('0x32')][_0x69a8('0x33')]};});_0x2f5de1['model']=_['map'](_0x51a25e,_0x69a8('0x2e'));_0x2f5de1[_0x69a8('0x34')]=_[_0x69a8('0x35')](_0x2e7355['query']);_0x2f5de1[_0x69a8('0x36')]=_['intersection'](_0x2f5de1[_0x69a8('0x37')],_0x2f5de1[_0x69a8('0x34')]);_0x111167[_0x69a8('0x38')]=_[_0x69a8('0x39')](_0x2f5de1['model'],qs[_0x69a8('0x3a')](_0x2e7355[_0x69a8('0x34')][_0x69a8('0x3a')]));_0x111167[_0x69a8('0x38')]=_0x111167[_0x69a8('0x38')]['length']?_0x111167['attributes']:_0x2f5de1[_0x69a8('0x37')];if(!_0x2e7355['query']['hasOwnProperty'](_0x69a8('0x3b'))){_0x111167['limit']=qs[_0x69a8('0x20')](_0x2e7355['query'][_0x69a8('0x20')]);_0x111167[_0x69a8('0x1e')]=qs[_0x69a8('0x1e')](_0x2e7355[_0x69a8('0x34')][_0x69a8('0x1e')]);}_0x111167[_0x69a8('0x3c')]=qs['sort'](_0x2e7355[_0x69a8('0x34')][_0x69a8('0x3d')]);_0x111167[_0x69a8('0x3e')]=qs[_0x69a8('0x36')](_[_0x69a8('0x3f')](_0x2e7355[_0x69a8('0x34')],_0x2f5de1[_0x69a8('0x36')]),_0x51a25e);if(_0x2e7355[_0x69a8('0x34')][_0x69a8('0x40')]){_0x111167[_0x69a8('0x3e')]=_['merge'](_0x111167[_0x69a8('0x3e')],{'$or':_[_0x69a8('0x30')](_0x51a25e,function(_0x34c2f5){if(_0x34c2f5[_0x69a8('0x32')]!=='VIRTUAL'){var _0x19d2f0={};_0x19d2f0[_0x34c2f5['name']]={'$like':'%'+_0x2e7355[_0x69a8('0x34')]['filter']+'%'};return _0x19d2f0;}})});}_0x111167=_[_0x69a8('0x41')]({},_0x111167,_0x2e7355[_0x69a8('0x42')]);var _0x36b2a1={'where':_0x111167[_0x69a8('0x3e')]};return db[_0x69a8('0x31')][_0x69a8('0x21')](_0x36b2a1)[_0x69a8('0x27')](function(_0x36b7d9){_0x5db1f0['count']=_0x36b7d9;if(_0x2e7355['query'][_0x69a8('0x43')]){_0x111167[_0x69a8('0x44')]=[{'all':!![]}];}return db[_0x69a8('0x31')]['findAll'](_0x111167);})[_0x69a8('0x27')](function(_0x3e0da3){_0x5db1f0['rows']=_0x3e0da3;return _0x5db1f0;})[_0x69a8('0x27')](respondWithFilteredResult(_0x5c8981,_0x111167))['catch'](handleError(_0x5c8981,null));};exports[_0x69a8('0x45')]=function(_0x2574ff,_0x2dc8ed){var _0x2e3bc2={'raw':![],'where':{'id':_0x2574ff[_0x69a8('0x46')]['id']}},_0xd06eb={};_0xd06eb['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0xd06eb[_0x69a8('0x34')]=_[_0x69a8('0x35')](_0x2574ff[_0x69a8('0x34')]);_0xd06eb[_0x69a8('0x36')]=_['intersection'](_0xd06eb[_0x69a8('0x37')],_0xd06eb['query']);_0x2e3bc2[_0x69a8('0x38')]=_[_0x69a8('0x39')](_0xd06eb[_0x69a8('0x37')],qs[_0x69a8('0x3a')](_0x2574ff[_0x69a8('0x34')][_0x69a8('0x3a')]));_0x2e3bc2[_0x69a8('0x38')]=_0x2e3bc2[_0x69a8('0x38')][_0x69a8('0x47')]?_0x2e3bc2[_0x69a8('0x38')]:_0xd06eb[_0x69a8('0x37')];if(_0x2574ff['query'][_0x69a8('0x43')]){_0x2e3bc2[_0x69a8('0x44')]=[{'all':!![]}];}_0x2e3bc2=_[_0x69a8('0x41')]({},_0x2e3bc2,_0x2574ff['options']);return db[_0x69a8('0x31')][_0x69a8('0x48')](_0x2e3bc2)['then'](handleEntityNotFound(_0x2dc8ed,null))[_0x69a8('0x27')](respondWithResult(_0x2dc8ed,null))[_0x69a8('0x49')](handleError(_0x2dc8ed,null));};exports[_0x69a8('0x4a')]=function(_0x5d9d75,_0x3d5f0f){return db[_0x69a8('0x31')][_0x69a8('0x4a')](_0x5d9d75[_0x69a8('0x4b')],{})['then'](function(_0x5ef314){var _0x231213=_0x5d9d75['user'][_0x69a8('0x28')]({'plain':!![]});if(!_0x231213)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x231213['role']===_0x69a8('0x4c')){var _0x2b47a3=_0x5ef314[_0x69a8('0x28')]({'plain':!![]});var _0xdb2bee='Projects';return db[_0x69a8('0x4d')][_0x69a8('0x48')]({'where':{'name':_0xdb2bee,'userProfileId':_0x231213[_0x69a8('0x4e')]},'raw':!![]})[_0x69a8('0x27')](function(_0x3a2c82){if(_0x3a2c82&&_0x3a2c82['autoAssociation']===0x0){return db[_0x69a8('0x2a')][_0x69a8('0x4a')]({'name':_0x2b47a3[_0x69a8('0x2e')],'resourceId':_0x2b47a3['id'],'type':_0x3a2c82['name'],'sectionId':_0x3a2c82['id']},{})[_0x69a8('0x27')](function(){return _0x5ef314;});}else{return _0x5ef314;}})[_0x69a8('0x49')](function(_0x22a284){logger['error'](_0x69a8('0x4f'),_0x22a284);throw _0x22a284;});}return _0x5ef314;})[_0x69a8('0x27')](respondWithResult(_0x3d5f0f,0xc9))[_0x69a8('0x49')](handleError(_0x3d5f0f,null));};exports[_0x69a8('0x50')]=function(_0x55405a,_0x35e82b){var _0x2c1b4c={'where':{'id':_0x55405a[_0x69a8('0x46')]['id']}},_0x29ff7f={};_0x29ff7f[_0x69a8('0x37')]=_[_0x69a8('0x35')](db[_0x69a8('0x31')][_0x69a8('0x51')]);_0x2c1b4c['attributes']=_['intersection'](_0x29ff7f[_0x69a8('0x37')],qs[_0x69a8('0x3a')](_0x55405a[_0x69a8('0x34')][_0x69a8('0x3a')]));_0x2c1b4c[_0x69a8('0x38')]=_0x2c1b4c['attributes']['length']?_0x2c1b4c['attributes']:_0x29ff7f[_0x69a8('0x37')];if(_0x55405a[_0x69a8('0x34')][_0x69a8('0x43')]){_0x2c1b4c[_0x69a8('0x44')]=[{'all':!![]}];}_0x2c1b4c=_[_0x69a8('0x41')]({},_0x2c1b4c,_0x55405a['options']);return db['JscriptyProject'][_0x69a8('0x48')](_0x2c1b4c)[_0x69a8('0x27')](handleEntityNotFound(_0x35e82b,null))[_0x69a8('0x27')](function(_0x2a06fe){if(_0x2a06fe){var _0x4f1bbc=_0x2a06fe[_0x69a8('0x28')]({'plain':!![]});_0x4f1bbc=qs[_0x69a8('0x52')](_0x4f1bbc,['id',_0x69a8('0x53'),'updatedAt']);_0x55405a[_0x69a8('0x4b')]=_[_0x69a8('0x52')](_0x55405a[_0x69a8('0x4b')],['id',_0x69a8('0x53'),_0x69a8('0x54')]);return db[_0x69a8('0x31')]['create'](_[_0x69a8('0x41')](_0x4f1bbc,_0x55405a[_0x69a8('0x4b')]),{'include':_0x55405a[_0x69a8('0x34')][_0x69a8('0x43')]?[{'all':!![]}]:undefined})[_0x69a8('0x27')](function(_0x161444){var _0x1ca147=_0x55405a[_0x69a8('0x4c')][_0x69a8('0x28')]({'plain':!![]});if(!_0x1ca147)throw new Error(_0x69a8('0x55'));if(_0x1ca147[_0x69a8('0x56')]===_0x69a8('0x4c')){var _0x30302f=_0x161444[_0x69a8('0x28')]({'plain':!![]});var _0xd06034=_0x69a8('0x29');return db['UserProfileSection'][_0x69a8('0x48')]({'where':{'name':_0xd06034,'userProfileId':_0x1ca147['userProfileId']},'raw':!![]})[_0x69a8('0x27')](function(_0x3a0e9d){if(_0x3a0e9d&&_0x3a0e9d[_0x69a8('0x57')]===0x0){return db[_0x69a8('0x2a')][_0x69a8('0x4a')]({'name':_0x30302f[_0x69a8('0x2e')],'resourceId':_0x30302f['id'],'type':_0x3a0e9d['name'],'sectionId':_0x3a0e9d['id']},{})['then'](function(){return _0x161444;});}else{return _0x161444;}})['catch'](function(_0x3cc494){logger[_0x69a8('0x2c')](_0x69a8('0x4f'),_0x3cc494);throw _0x3cc494;});}return _0x161444;});}})[_0x69a8('0x27')](respondWithResult(_0x35e82b,0xc9))['catch'](handleError(_0x35e82b,null));};exports[_0x69a8('0x26')]=function(_0x35038d,_0x2c210c){if(_0x35038d['body']['id']){delete _0x35038d['body']['id'];}return db[_0x69a8('0x31')]['find']({'where':{'id':_0x35038d['params']['id']}})[_0x69a8('0x27')](handleEntityNotFound(_0x2c210c,null))[_0x69a8('0x27')](saveUpdates(_0x35038d[_0x69a8('0x4b')],null))[_0x69a8('0x27')](respondWithResult(_0x2c210c,null))[_0x69a8('0x49')](handleError(_0x2c210c,null));};exports['destroy']=function(_0x73dd47,_0x6df2e6){return db[_0x69a8('0x31')][_0x69a8('0x48')]({'where':{'id':_0x73dd47['params']['id']}})[_0x69a8('0x27')](handleEntityNotFound(_0x6df2e6,null))[_0x69a8('0x27')](removeEntity(_0x6df2e6,null))['catch'](handleError(_0x6df2e6,null));};exports[_0x69a8('0x58')]=function(_0x4ca648,_0x201bc6,_0x2e292e){var _0x11002c={'raw':!![],'where':{}};var _0x597f17={};var _0x2eac51={'count':0x0,'rows':[]};return db[_0x69a8('0x31')][_0x69a8('0x59')]({'where':{'id':_0x4ca648[_0x69a8('0x46')]['id']}})[_0x69a8('0x27')](handleEntityNotFound(_0x201bc6,null))['then'](function(_0x38ecaf){if(_0x38ecaf){_0x597f17['model']=_[_0x69a8('0x35')](db[_0x69a8('0x5a')]['rawAttributes']);_0x597f17[_0x69a8('0x34')]=_[_0x69a8('0x35')](_0x4ca648['query']);_0x597f17[_0x69a8('0x36')]=_[_0x69a8('0x39')](_0x597f17[_0x69a8('0x37')],_0x597f17[_0x69a8('0x34')]);_0x11002c[_0x69a8('0x38')]=_['intersection'](_0x597f17[_0x69a8('0x37')],qs[_0x69a8('0x3a')](_0x4ca648['query'][_0x69a8('0x3a')]));_0x11002c[_0x69a8('0x38')]=_0x11002c[_0x69a8('0x38')][_0x69a8('0x47')]?_0x11002c['attributes']:_0x597f17['model'];if(!_0x4ca648[_0x69a8('0x34')][_0x69a8('0x5b')]('nolimit')){_0x11002c['limit']=qs[_0x69a8('0x20')](_0x4ca648[_0x69a8('0x34')]['limit']);_0x11002c['offset']=qs[_0x69a8('0x1e')](_0x4ca648[_0x69a8('0x34')][_0x69a8('0x1e')]);}_0x11002c[_0x69a8('0x3c')]=qs[_0x69a8('0x3d')](_0x4ca648['query'][_0x69a8('0x3d')]);_0x11002c[_0x69a8('0x3e')]=qs['filters'](_[_0x69a8('0x3f')](_0x4ca648[_0x69a8('0x34')],_0x597f17[_0x69a8('0x36')]));_0x11002c['where'][_0x69a8('0x5c')]=_0x38ecaf['id'];if(_0x4ca648['query']['filter']){_0x11002c[_0x69a8('0x3e')]=_[_0x69a8('0x41')](_0x11002c[_0x69a8('0x3e')],{'$or':_[_0x69a8('0x30')](_0x11002c[_0x69a8('0x38')],function(_0x396e0b){var _0x185e11={};_0x185e11[_0x396e0b]={'$like':'%'+_0x4ca648[_0x69a8('0x34')][_0x69a8('0x40')]+'%'};return _0x185e11;})});}_0x11002c=_[_0x69a8('0x41')]({},_0x11002c,_0x4ca648['options']);return db[_0x69a8('0x5a')]['count']({'where':_0x11002c[_0x69a8('0x3e')]})[_0x69a8('0x27')](function(_0x113f01){_0x2eac51[_0x69a8('0x21')]=_0x113f01;if(_0x4ca648['query'][_0x69a8('0x43')]){_0x11002c[_0x69a8('0x44')]=[{'all':!![]}];}return db[_0x69a8('0x5a')][_0x69a8('0x5d')](_0x11002c);})[_0x69a8('0x27')](function(_0x106d5c){_0x2eac51[_0x69a8('0x5e')]=_0x106d5c;return _0x2eac51;});}})[_0x69a8('0x27')](respondWithFilteredResult(_0x201bc6,_0x11002c))[_0x69a8('0x49')](handleError(_0x201bc6,null));};exports[_0x69a8('0x5f')]=function(_0x175827,_0x465c44,_0x604c2){var _0x15717a={'raw':!![],'where':{}};var _0x4af47f={};var _0xf204a3={'count':0x0,'rows':[]};return db[_0x69a8('0x31')]['findOne']({'where':{'id':_0x175827['params']['id']}})[_0x69a8('0x27')](handleEntityNotFound(_0x465c44,null))['then'](function(_0x470e4a){if(_0x470e4a){_0x4af47f[_0x69a8('0x37')]=_[_0x69a8('0x35')](db['JscriptyAnswerReport'][_0x69a8('0x51')]);_0x4af47f[_0x69a8('0x34')]=_[_0x69a8('0x35')](_0x175827[_0x69a8('0x34')]);_0x4af47f['filters']=_['intersection'](_0x4af47f[_0x69a8('0x37')],_0x4af47f['query']);_0x15717a[_0x69a8('0x38')]=_[_0x69a8('0x39')](_0x4af47f['model'],qs[_0x69a8('0x3a')](_0x175827[_0x69a8('0x34')][_0x69a8('0x3a')]));_0x15717a[_0x69a8('0x38')]=_0x15717a[_0x69a8('0x38')]['length']?_0x15717a[_0x69a8('0x38')]:_0x4af47f[_0x69a8('0x37')];if(!_0x175827[_0x69a8('0x34')]['hasOwnProperty'](_0x69a8('0x3b'))){_0x15717a[_0x69a8('0x20')]=qs[_0x69a8('0x20')](_0x175827[_0x69a8('0x34')][_0x69a8('0x20')]);_0x15717a[_0x69a8('0x1e')]=qs['offset'](_0x175827[_0x69a8('0x34')][_0x69a8('0x1e')]);}_0x15717a[_0x69a8('0x3c')]=qs[_0x69a8('0x3d')](_0x175827['query']['sort']);_0x15717a[_0x69a8('0x3e')]=qs[_0x69a8('0x36')](_[_0x69a8('0x3f')](_0x175827[_0x69a8('0x34')],_0x4af47f[_0x69a8('0x36')]));_0x15717a['where'][_0x69a8('0x5c')]=_0x470e4a['id'];if(_0x175827[_0x69a8('0x34')][_0x69a8('0x40')]){_0x15717a[_0x69a8('0x3e')]=_[_0x69a8('0x41')](_0x15717a['where'],{'$or':_[_0x69a8('0x30')](_0x15717a[_0x69a8('0x38')],function(_0x3c09c6){var _0x2498e9={};_0x2498e9[_0x3c09c6]={'$like':'%'+_0x175827['query']['filter']+'%'};return _0x2498e9;})});}_0x15717a=_[_0x69a8('0x41')]({},_0x15717a,_0x175827[_0x69a8('0x42')]);return db['JscriptyAnswerReport'][_0x69a8('0x21')]({'where':_0x15717a['where']})[_0x69a8('0x27')](function(_0x529233){_0xf204a3['count']=_0x529233;if(_0x175827['query'][_0x69a8('0x43')]){_0x15717a[_0x69a8('0x44')]=[{'all':!![]}];}return db[_0x69a8('0x60')][_0x69a8('0x5d')](_0x15717a);})[_0x69a8('0x27')](function(_0x369459){_0xf204a3[_0x69a8('0x5e')]=_0x369459;return _0xf204a3;});}})[_0x69a8('0x27')](respondWithFilteredResult(_0x465c44,_0x15717a))[_0x69a8('0x49')](handleError(_0x465c44,null));};function char(_0xfc314b){return _0x69a8('0x61')===typeof _0xfc314b?String[_0x69a8('0x62')][_0x69a8('0x23')](null,arguments):_0xfc314b;}function needsEncapsulation(_0x28c1d5){return!!_0x28c1d5&&(_0x28c1d5['toString']()[_0x69a8('0x63')](char(0xd))>=0x0||_0x28c1d5[_0x69a8('0x64')]()[_0x69a8('0x63')](char(0xa))>=0x0||_0x28c1d5[_0x69a8('0x64')]()[_0x69a8('0x63')](char(0x2c))>=0x0||_0x28c1d5[_0x69a8('0x64')]()[_0x69a8('0x63')](char(0x22))>=0x0);}function encapsulate(_0x22346c){var _0x54edb2=char(0x22),_0x194831='\x5c'+char(0x22),_0x15d006=_0x22346c[_0x69a8('0x64')]()[_0x69a8('0x65')](new RegExp(_0x54edb2,'g'),_0x194831);return _0x54edb2+_0x15d006+_0x54edb2;}exports[_0x69a8('0x66')]=function(_0x3a9d72,_0x47f687,_0x1f1ef9){var _0x5ed946,_0x167144;var _0xedb32f={'where':{'ProjectId':_0x3a9d72[_0x69a8('0x46')]['id']}};if(_0x3a9d72[_0x69a8('0x34')]['startTime']){_0xedb32f[_0x69a8('0x3e')][_0x69a8('0x67')]=JSON[_0x69a8('0x68')](_0x3a9d72[_0x69a8('0x34')][_0x69a8('0x69')]);}return db[_0x69a8('0x5a')][_0x69a8('0x5d')](_0xedb32f)[_0x69a8('0x27')](handleEntityNotFound(_0x47f687,null))[_0x69a8('0x27')](function(_0xf82064){if(_0xf82064){_0x5ed946=_0xf82064;return db['JscriptyQuestionReport'][_0x69a8('0x5d')]({'where':{'SessionId':{'$in':_[_0x69a8('0x30')](_0x5ed946,'id')},'ProjectId':_0x3a9d72[_0x69a8('0x46')]['id']},'order':_0x69a8('0x6a')});}})[_0x69a8('0x27')](handleEntityNotFound(_0x47f687,null))[_0x69a8('0x27')](function(_0x472644){if(_0x472644){_0x167144=_0x472644;var _0x3af192={};for(var _0x1eb1e0=0x0,_0x2a6a37=_0x167144[_0x69a8('0x47')];_0x1eb1e0<_0x2a6a37;_0x1eb1e0++){if(!_0x3af192['hasOwnProperty'](_0x167144[_0x1eb1e0]['questionId'])){_0x3af192[_0x167144[_0x1eb1e0][_0x69a8('0x6b')]]=needsEncapsulation(_0x167144[_0x1eb1e0]['question'])?encapsulate(_0x167144[_0x1eb1e0]['question']):_0x167144[_0x1eb1e0][_0x69a8('0x6c')];}}var _0x48223f=[],_0x3cd32c={};for(var _0x595d07=0x0,_0x273d99=_0x5ed946[_0x69a8('0x47')];_0x595d07<_0x273d99;_0x595d07++){_0x3cd32c={'ProjectId':_0x3a9d72['params']['id'],'SessionId':_0x5ed946[_0x595d07]['id'],'StartTime':moment(_0x5ed946[_0x595d07]['starttime'])[_0x69a8('0x6d')](_0x69a8('0x6e'))};for(var _0x49f54e=0x0,_0x3585fb=_0x167144['length'];_0x49f54e<_0x3585fb;_0x49f54e++){if(_0x167144[_0x49f54e][_0x69a8('0x6f')]==_0x5ed946[_0x595d07]['id']&&_0x3af192[_0x69a8('0x5b')](_0x167144[_0x49f54e][_0x69a8('0x6b')])){_0x3cd32c[_0x3af192[_0x167144[_0x49f54e][_0x69a8('0x6b')]]]=_0x167144[_0x49f54e][_0x69a8('0x70')];}}for(var _0x510aba in _0x3af192){if(!_0x3cd32c[_0x69a8('0x5b')](_0x3af192[_0x510aba])){_0x3cd32c[_0x3af192[_0x510aba]]=null;}}_0x48223f[_0x69a8('0x71')](_0x3cd32c);}return _0x48223f;}})[_0x69a8('0x27')](function(_0xbf3c34){if(!_[_0x69a8('0x72')](_0xbf3c34)){var _0x2df37e=toCsv(_0xbf3c34);var _0x37b1b8=Date[_0x69a8('0x73')]();fs[_0x69a8('0x74')](util[_0x69a8('0x6d')](_0x69a8('0x75'),_0x3a9d72[_0x69a8('0x46')]['id'],_0x37b1b8),_0x2df37e);_0x47f687[_0x69a8('0x76')](_0x69a8('0x77'),'attachment;\x20filename='+util[_0x69a8('0x6d')](_0x69a8('0x78'),_0x3a9d72[_0x69a8('0x46')]['id'],_0x37b1b8));_0x47f687[_0x69a8('0x76')](_0x69a8('0x79'),'text/csv');return _0x47f687['download'](util[_0x69a8('0x6d')](_0x69a8('0x75'),_0x3a9d72[_0x69a8('0x46')]['id'],_0x37b1b8));}else{return _0x47f687[_0x69a8('0x1a')](0xcc);}})[_0x69a8('0x49')](handleError(_0x47f687,null));}; \ No newline at end of file +var _0x8048=['YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','key','query','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','params','keys','filters','includeAll','find','create','body','user','role','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','order','pick','rows','getAnswers','ProjectId','JscriptyAnswerReport','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8048,0x166));var _0x8804=function(_0x3836fd,_0x5f3641){_0x3836fd=_0x3836fd-0x0;var _0x5b608b=_0x8048[_0x3836fd];return _0x5b608b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8804('0x0'));var zipdir=require(_0x8804('0x1'));var jsonpatch=require(_0x8804('0x2'));var rp=require('request-promise');var moment=require(_0x8804('0x3'));var BPromise=require(_0x8804('0x4'));var Mustache=require(_0x8804('0x5'));var util=require(_0x8804('0x6'));var path=require('path');var sox=require(_0x8804('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8804('0x8'));var _=require('lodash');var squel=require(_0x8804('0x9'));var crypto=require(_0x8804('0xa'));var jsforce=require(_0x8804('0xb'));var deskjs=require(_0x8804('0xc'));var toCsv=require(_0x8804('0xd'));var querystring=require(_0x8804('0xe'));var Papa=require(_0x8804('0xf'));var Redis=require(_0x8804('0x10'));var authService=require(_0x8804('0x11'));var qs=require(_0x8804('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8804('0x13'));var logger=require('../../config/logger')(_0x8804('0x14'));var utils=require(_0x8804('0x15'));var config=require(_0x8804('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8804('0x17'))['db'];function respondWithStatusCode(_0x13255e,_0x50af28){_0x50af28=_0x50af28||0xcc;return function(_0x20a68c){if(_0x20a68c){return _0x13255e[_0x8804('0x18')](_0x50af28);}return _0x13255e[_0x8804('0x19')](_0x50af28)[_0x8804('0x1a')]();};}function respondWithResult(_0x5201fe,_0x1144e1){_0x1144e1=_0x1144e1||0xc8;return function(_0xcef34e){if(_0xcef34e){return _0x5201fe[_0x8804('0x19')](_0x1144e1)[_0x8804('0x1b')](_0xcef34e);}};}function respondWithFilteredResult(_0x43b8a4,_0x4efc0d){return function(_0x553936){if(_0x553936){var _0x2566d2=typeof _0x4efc0d[_0x8804('0x1c')]===_0x8804('0x1d')&&typeof _0x4efc0d['limit']===_0x8804('0x1d');var _0x58200c=_0x553936['count'];var _0x41dcc4=_0x2566d2?0x0:_0x4efc0d[_0x8804('0x1c')];var _0x44e478=_0x2566d2?_0x553936['count']:_0x4efc0d[_0x8804('0x1c')]+_0x4efc0d[_0x8804('0x1e')];var _0x3af403;if(_0x44e478>=_0x58200c){_0x44e478=_0x58200c;_0x3af403=0xc8;}else{_0x3af403=0xce;}_0x43b8a4['status'](_0x3af403);return _0x43b8a4['set'](_0x8804('0x1f'),_0x41dcc4+'-'+_0x44e478+'/'+_0x58200c)[_0x8804('0x1b')](_0x553936);}return null;};}function patchUpdates(_0x1f45dd){return function(_0x505ad2){try{jsonpatch[_0x8804('0x20')](_0x505ad2,_0x1f45dd,!![]);}catch(_0x2734d7){return BPromise['reject'](_0x2734d7);}return _0x505ad2['save']();};}function saveUpdates(_0x47faec,_0x2b259c){return function(_0x764447){if(_0x764447){return _0x764447['update'](_0x47faec)[_0x8804('0x21')](function(_0x2abd46){return _0x2abd46;});}return null;};}function removeEntity(_0x4aeb02,_0x1fdaa0){return function(_0x35e4c2){if(_0x35e4c2){return _0x35e4c2[_0x8804('0x22')]()[_0x8804('0x21')](function(){var _0x23456c=_0x35e4c2[_0x8804('0x23')]({'plain':!![]});var _0x4420f4=_0x8804('0x24');return db[_0x8804('0x25')][_0x8804('0x22')]({'where':{'type':_0x4420f4,'resourceId':_0x23456c['id']}})['then'](function(){return _0x35e4c2;});})['then'](function(){_0x4aeb02[_0x8804('0x19')](0xcc)[_0x8804('0x1a')]();});}};}function handleEntityNotFound(_0x2ac847,_0x206dbe){return function(_0x2cc281){if(!_0x2cc281){_0x2ac847[_0x8804('0x18')](0x194);}return _0x2cc281;};}function handleError(_0xfba3fe,_0x1d9f5b){_0x1d9f5b=_0x1d9f5b||0x1f4;return function(_0x217ea3){logger[_0x8804('0x26')](_0x217ea3[_0x8804('0x27')]);if(_0x217ea3[_0x8804('0x28')]){delete _0x217ea3[_0x8804('0x28')];}_0xfba3fe[_0x8804('0x19')](_0x1d9f5b)['send'](_0x217ea3);};}exports[_0x8804('0x29')]=function(_0x3fe3e4,_0x296587){var _0x3e90f6={},_0x1d07a6={},_0x47fdc0={'count':0x0,'rows':[]};var _0x3fe5c0=_[_0x8804('0x2a')](db[_0x8804('0x2b')][_0x8804('0x2c')],function(_0x301c12){return{'name':_0x301c12['fieldName'],'type':_0x301c12['type'][_0x8804('0x2d')]};});_0x1d07a6['model']=_[_0x8804('0x2a')](_0x3fe5c0,_0x8804('0x28'));_0x1d07a6[_0x8804('0x2e')]=_['keys'](_0x3fe3e4[_0x8804('0x2e')]);_0x1d07a6['filters']=_['intersection'](_0x1d07a6[_0x8804('0x2f')],_0x1d07a6[_0x8804('0x2e')]);_0x3e90f6[_0x8804('0x30')]=_[_0x8804('0x31')](_0x1d07a6[_0x8804('0x2f')],qs[_0x8804('0x32')](_0x3fe3e4['query'][_0x8804('0x32')]));_0x3e90f6['attributes']=_0x3e90f6['attributes'][_0x8804('0x33')]?_0x3e90f6['attributes']:_0x1d07a6['model'];if(!_0x3fe3e4[_0x8804('0x2e')][_0x8804('0x34')]('nolimit')){_0x3e90f6[_0x8804('0x1e')]=qs[_0x8804('0x1e')](_0x3fe3e4[_0x8804('0x2e')][_0x8804('0x1e')]);_0x3e90f6[_0x8804('0x1c')]=qs[_0x8804('0x1c')](_0x3fe3e4[_0x8804('0x2e')]['offset']);}_0x3e90f6['order']=qs[_0x8804('0x35')](_0x3fe3e4[_0x8804('0x2e')]['sort']);_0x3e90f6[_0x8804('0x36')]=qs['filters'](_['pick'](_0x3fe3e4['query'],_0x1d07a6['filters']),_0x3fe5c0);if(_0x3fe3e4['query'][_0x8804('0x37')]){_0x3e90f6[_0x8804('0x36')]=_[_0x8804('0x38')](_0x3e90f6[_0x8804('0x36')],{'$or':_[_0x8804('0x2a')](_0x3fe5c0,function(_0x450696){if(_0x450696['type']!==_0x8804('0x39')){var _0x209639={};_0x209639[_0x450696['name']]={'$like':'%'+_0x3fe3e4['query'][_0x8804('0x37')]+'%'};return _0x209639;}})});}_0x3e90f6=_[_0x8804('0x38')]({},_0x3e90f6,_0x3fe3e4[_0x8804('0x3a')]);var _0x190de9={'where':_0x3e90f6[_0x8804('0x36')]};return db[_0x8804('0x2b')][_0x8804('0x3b')](_0x190de9)[_0x8804('0x21')](function(_0x56f660){_0x47fdc0[_0x8804('0x3b')]=_0x56f660;if(_0x3fe3e4[_0x8804('0x2e')]['includeAll']){_0x3e90f6[_0x8804('0x3c')]=[{'all':!![]}];}return db[_0x8804('0x2b')][_0x8804('0x3d')](_0x3e90f6);})[_0x8804('0x21')](function(_0x30ea88){_0x47fdc0['rows']=_0x30ea88;return _0x47fdc0;})[_0x8804('0x21')](respondWithFilteredResult(_0x296587,_0x3e90f6))[_0x8804('0x3e')](handleError(_0x296587,null));};exports[_0x8804('0x3f')]=function(_0x6d73f,_0x269fd1){var _0x2fb853={'raw':![],'where':{'id':_0x6d73f[_0x8804('0x40')]['id']}},_0x155c20={};_0x155c20[_0x8804('0x2f')]=_[_0x8804('0x41')](db[_0x8804('0x2b')][_0x8804('0x2c')]);_0x155c20['query']=_[_0x8804('0x41')](_0x6d73f['query']);_0x155c20[_0x8804('0x42')]=_[_0x8804('0x31')](_0x155c20[_0x8804('0x2f')],_0x155c20[_0x8804('0x2e')]);_0x2fb853[_0x8804('0x30')]=_[_0x8804('0x31')](_0x155c20[_0x8804('0x2f')],qs[_0x8804('0x32')](_0x6d73f['query'][_0x8804('0x32')]));_0x2fb853[_0x8804('0x30')]=_0x2fb853['attributes'][_0x8804('0x33')]?_0x2fb853['attributes']:_0x155c20[_0x8804('0x2f')];if(_0x6d73f[_0x8804('0x2e')][_0x8804('0x43')]){_0x2fb853['include']=[{'all':!![]}];}_0x2fb853=_[_0x8804('0x38')]({},_0x2fb853,_0x6d73f[_0x8804('0x3a')]);return db[_0x8804('0x2b')][_0x8804('0x44')](_0x2fb853)[_0x8804('0x21')](handleEntityNotFound(_0x269fd1,null))['then'](respondWithResult(_0x269fd1,null))[_0x8804('0x3e')](handleError(_0x269fd1,null));};exports[_0x8804('0x45')]=function(_0x23bb02,_0x219a56){return db[_0x8804('0x2b')][_0x8804('0x45')](_0x23bb02[_0x8804('0x46')],{})[_0x8804('0x21')](function(_0x1845fd){var _0x4e35d0=_0x23bb02[_0x8804('0x47')][_0x8804('0x23')]({'plain':!![]});if(!_0x4e35d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e35d0[_0x8804('0x48')]===_0x8804('0x47')){var _0x4606ec=_0x1845fd[_0x8804('0x23')]({'plain':!![]});var _0x5005a4=_0x8804('0x24');return db['UserProfileSection'][_0x8804('0x44')]({'where':{'name':_0x5005a4,'userProfileId':_0x4e35d0['userProfileId']},'raw':!![]})[_0x8804('0x21')](function(_0x36ede7){if(_0x36ede7&&_0x36ede7[_0x8804('0x49')]===0x0){return db['UserProfileResource'][_0x8804('0x45')]({'name':_0x4606ec['name'],'resourceId':_0x4606ec['id'],'type':_0x36ede7[_0x8804('0x28')],'sectionId':_0x36ede7['id']},{})[_0x8804('0x21')](function(){return _0x1845fd;});}else{return _0x1845fd;}})[_0x8804('0x3e')](function(_0x5f3c0c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f3c0c);throw _0x5f3c0c;});}return _0x1845fd;})[_0x8804('0x21')](respondWithResult(_0x219a56,0xc9))['catch'](handleError(_0x219a56,null));};exports[_0x8804('0x4a')]=function(_0x3bf2f2,_0x3f7f9d){var _0x5d29c8={'where':{'id':_0x3bf2f2[_0x8804('0x40')]['id']}},_0x5c4ea3={};_0x5c4ea3[_0x8804('0x2f')]=_[_0x8804('0x41')](db[_0x8804('0x2b')]['rawAttributes']);_0x5d29c8[_0x8804('0x30')]=_[_0x8804('0x31')](_0x5c4ea3[_0x8804('0x2f')],qs[_0x8804('0x32')](_0x3bf2f2['query'][_0x8804('0x32')]));_0x5d29c8[_0x8804('0x30')]=_0x5d29c8[_0x8804('0x30')][_0x8804('0x33')]?_0x5d29c8[_0x8804('0x30')]:_0x5c4ea3['model'];if(_0x3bf2f2[_0x8804('0x2e')][_0x8804('0x43')]){_0x5d29c8[_0x8804('0x3c')]=[{'all':!![]}];}_0x5d29c8=_['merge']({},_0x5d29c8,_0x3bf2f2[_0x8804('0x3a')]);return db['JscriptyProject'][_0x8804('0x44')](_0x5d29c8)[_0x8804('0x21')](handleEntityNotFound(_0x3f7f9d,null))[_0x8804('0x21')](function(_0x19df71){if(_0x19df71){var _0x1eef08=_0x19df71[_0x8804('0x23')]({'plain':!![]});_0x1eef08=qs[_0x8804('0x4b')](_0x1eef08,['id',_0x8804('0x4c'),_0x8804('0x4d')]);_0x3bf2f2[_0x8804('0x46')]=_[_0x8804('0x4b')](_0x3bf2f2[_0x8804('0x46')],['id',_0x8804('0x4c'),_0x8804('0x4d')]);return db[_0x8804('0x2b')]['create'](_[_0x8804('0x38')](_0x1eef08,_0x3bf2f2['body']),{'include':_0x3bf2f2[_0x8804('0x2e')][_0x8804('0x43')]?[{'all':!![]}]:undefined})[_0x8804('0x21')](function(_0xfe842b){var _0x598efe=_0x3bf2f2['user'][_0x8804('0x23')]({'plain':!![]});if(!_0x598efe)throw new Error(_0x8804('0x4e'));if(_0x598efe['role']===_0x8804('0x47')){var _0x2eed55=_0xfe842b[_0x8804('0x23')]({'plain':!![]});var _0x4cd288=_0x8804('0x24');return db[_0x8804('0x4f')][_0x8804('0x44')]({'where':{'name':_0x4cd288,'userProfileId':_0x598efe[_0x8804('0x50')]},'raw':!![]})[_0x8804('0x21')](function(_0x2c4bb){if(_0x2c4bb&&_0x2c4bb['autoAssociation']===0x0){return db[_0x8804('0x25')][_0x8804('0x45')]({'name':_0x2eed55[_0x8804('0x28')],'resourceId':_0x2eed55['id'],'type':_0x2c4bb[_0x8804('0x28')],'sectionId':_0x2c4bb['id']},{})[_0x8804('0x21')](function(){return _0xfe842b;});}else{return _0xfe842b;}})[_0x8804('0x3e')](function(_0x144756){logger[_0x8804('0x26')](_0x8804('0x51'),_0x144756);throw _0x144756;});}return _0xfe842b;});}})[_0x8804('0x21')](respondWithResult(_0x3f7f9d,0xc9))['catch'](handleError(_0x3f7f9d,null));};exports[_0x8804('0x52')]=function(_0x1acf7a,_0x534785){if(_0x1acf7a[_0x8804('0x46')]['id']){delete _0x1acf7a['body']['id'];}return db['JscriptyProject'][_0x8804('0x44')]({'where':{'id':_0x1acf7a[_0x8804('0x40')]['id']}})[_0x8804('0x21')](handleEntityNotFound(_0x534785,null))['then'](saveUpdates(_0x1acf7a['body'],null))[_0x8804('0x21')](respondWithResult(_0x534785,null))['catch'](handleError(_0x534785,null));};exports[_0x8804('0x22')]=function(_0x33a14b,_0x1ed3a0){return db['JscriptyProject'][_0x8804('0x44')]({'where':{'id':_0x33a14b[_0x8804('0x40')]['id']}})[_0x8804('0x21')](handleEntityNotFound(_0x1ed3a0,null))[_0x8804('0x21')](removeEntity(_0x1ed3a0,null))[_0x8804('0x3e')](handleError(_0x1ed3a0,null));};exports[_0x8804('0x53')]=function(_0x395f21,_0x1236c6,_0xe23a27){var _0x930635={'raw':!![],'where':{}};var _0x40dcb1={};var _0x840b00={'count':0x0,'rows':[]};return db[_0x8804('0x2b')][_0x8804('0x54')]({'where':{'id':_0x395f21[_0x8804('0x40')]['id']}})[_0x8804('0x21')](handleEntityNotFound(_0x1236c6,null))[_0x8804('0x21')](function(_0x3d0fc8){if(_0x3d0fc8){_0x40dcb1[_0x8804('0x2f')]=_[_0x8804('0x41')](db[_0x8804('0x55')][_0x8804('0x2c')]);_0x40dcb1['query']=_[_0x8804('0x41')](_0x395f21[_0x8804('0x2e')]);_0x40dcb1['filters']=_[_0x8804('0x31')](_0x40dcb1['model'],_0x40dcb1[_0x8804('0x2e')]);_0x930635['attributes']=_[_0x8804('0x31')](_0x40dcb1[_0x8804('0x2f')],qs['fields'](_0x395f21['query'][_0x8804('0x32')]));_0x930635['attributes']=_0x930635[_0x8804('0x30')][_0x8804('0x33')]?_0x930635[_0x8804('0x30')]:_0x40dcb1['model'];if(!_0x395f21[_0x8804('0x2e')][_0x8804('0x34')]('nolimit')){_0x930635[_0x8804('0x1e')]=qs[_0x8804('0x1e')](_0x395f21[_0x8804('0x2e')][_0x8804('0x1e')]);_0x930635[_0x8804('0x1c')]=qs[_0x8804('0x1c')](_0x395f21[_0x8804('0x2e')][_0x8804('0x1c')]);}_0x930635[_0x8804('0x56')]=qs[_0x8804('0x35')](_0x395f21[_0x8804('0x2e')][_0x8804('0x35')]);_0x930635[_0x8804('0x36')]=qs[_0x8804('0x42')](_[_0x8804('0x57')](_0x395f21[_0x8804('0x2e')],_0x40dcb1[_0x8804('0x42')]));_0x930635[_0x8804('0x36')]['ProjectId']=_0x3d0fc8['id'];if(_0x395f21[_0x8804('0x2e')]['filter']){_0x930635[_0x8804('0x36')]=_[_0x8804('0x38')](_0x930635[_0x8804('0x36')],{'$or':_[_0x8804('0x2a')](_0x930635[_0x8804('0x30')],function(_0x38599b){var _0x5a15e9={};_0x5a15e9[_0x38599b]={'$like':'%'+_0x395f21[_0x8804('0x2e')][_0x8804('0x37')]+'%'};return _0x5a15e9;})});}_0x930635=_['merge']({},_0x930635,_0x395f21[_0x8804('0x3a')]);return db[_0x8804('0x55')][_0x8804('0x3b')]({'where':_0x930635['where']})[_0x8804('0x21')](function(_0x10c032){_0x840b00[_0x8804('0x3b')]=_0x10c032;if(_0x395f21[_0x8804('0x2e')][_0x8804('0x43')]){_0x930635[_0x8804('0x3c')]=[{'all':!![]}];}return db[_0x8804('0x55')]['findAll'](_0x930635);})[_0x8804('0x21')](function(_0x45d714){_0x840b00[_0x8804('0x58')]=_0x45d714;return _0x840b00;});}})['then'](respondWithFilteredResult(_0x1236c6,_0x930635))[_0x8804('0x3e')](handleError(_0x1236c6,null));};exports[_0x8804('0x59')]=function(_0x2fc7d0,_0x373524,_0x3f2b9e){var _0x1d547a={'raw':!![],'where':{}};var _0x4ed49b={};var _0x1e1569={'count':0x0,'rows':[]};return db[_0x8804('0x2b')]['findOne']({'where':{'id':_0x2fc7d0[_0x8804('0x40')]['id']}})[_0x8804('0x21')](handleEntityNotFound(_0x373524,null))[_0x8804('0x21')](function(_0x5bef2d){if(_0x5bef2d){_0x4ed49b[_0x8804('0x2f')]=_[_0x8804('0x41')](db['JscriptyAnswerReport']['rawAttributes']);_0x4ed49b[_0x8804('0x2e')]=_['keys'](_0x2fc7d0['query']);_0x4ed49b[_0x8804('0x42')]=_[_0x8804('0x31')](_0x4ed49b[_0x8804('0x2f')],_0x4ed49b[_0x8804('0x2e')]);_0x1d547a[_0x8804('0x30')]=_['intersection'](_0x4ed49b[_0x8804('0x2f')],qs[_0x8804('0x32')](_0x2fc7d0[_0x8804('0x2e')]['fields']));_0x1d547a[_0x8804('0x30')]=_0x1d547a[_0x8804('0x30')][_0x8804('0x33')]?_0x1d547a['attributes']:_0x4ed49b[_0x8804('0x2f')];if(!_0x2fc7d0[_0x8804('0x2e')][_0x8804('0x34')]('nolimit')){_0x1d547a[_0x8804('0x1e')]=qs[_0x8804('0x1e')](_0x2fc7d0[_0x8804('0x2e')][_0x8804('0x1e')]);_0x1d547a['offset']=qs['offset'](_0x2fc7d0[_0x8804('0x2e')][_0x8804('0x1c')]);}_0x1d547a[_0x8804('0x56')]=qs[_0x8804('0x35')](_0x2fc7d0[_0x8804('0x2e')][_0x8804('0x35')]);_0x1d547a[_0x8804('0x36')]=qs['filters'](_['pick'](_0x2fc7d0['query'],_0x4ed49b[_0x8804('0x42')]));_0x1d547a[_0x8804('0x36')][_0x8804('0x5a')]=_0x5bef2d['id'];if(_0x2fc7d0[_0x8804('0x2e')][_0x8804('0x37')]){_0x1d547a['where']=_['merge'](_0x1d547a[_0x8804('0x36')],{'$or':_[_0x8804('0x2a')](_0x1d547a[_0x8804('0x30')],function(_0x40fcdc){var _0x3372c7={};_0x3372c7[_0x40fcdc]={'$like':'%'+_0x2fc7d0[_0x8804('0x2e')][_0x8804('0x37')]+'%'};return _0x3372c7;})});}_0x1d547a=_['merge']({},_0x1d547a,_0x2fc7d0[_0x8804('0x3a')]);return db[_0x8804('0x5b')][_0x8804('0x3b')]({'where':_0x1d547a['where']})[_0x8804('0x21')](function(_0x49eb6d){_0x1e1569['count']=_0x49eb6d;if(_0x2fc7d0[_0x8804('0x2e')][_0x8804('0x43')]){_0x1d547a['include']=[{'all':!![]}];}return db[_0x8804('0x5b')]['findAll'](_0x1d547a);})[_0x8804('0x21')](function(_0x53b8fb){_0x1e1569[_0x8804('0x58')]=_0x53b8fb;return _0x1e1569;});}})[_0x8804('0x21')](respondWithFilteredResult(_0x373524,_0x1d547a))[_0x8804('0x3e')](handleError(_0x373524,null));};function char(_0x29abc9){return'number'===typeof _0x29abc9?String['fromCharCode']['apply'](null,arguments):_0x29abc9;}function needsEncapsulation(_0x1d9366){return!!_0x1d9366&&(_0x1d9366[_0x8804('0x5c')]()[_0x8804('0x5d')](char(0xd))>=0x0||_0x1d9366[_0x8804('0x5c')]()[_0x8804('0x5d')](char(0xa))>=0x0||_0x1d9366[_0x8804('0x5c')]()[_0x8804('0x5d')](char(0x2c))>=0x0||_0x1d9366['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x32b7f9){var _0x596340=char(0x22),_0x58c5fb='\x5c'+char(0x22),_0x1d01aa=_0x32b7f9[_0x8804('0x5c')]()[_0x8804('0x5e')](new RegExp(_0x596340,'g'),_0x58c5fb);return _0x596340+_0x1d01aa+_0x596340;}exports[_0x8804('0x5f')]=function(_0x137861,_0x40691d,_0x1768a5){var _0x3b0ba1,_0x8ef9eb;var _0x4a33f3={'where':{'ProjectId':_0x137861[_0x8804('0x40')]['id']}};if(_0x137861['query'][_0x8804('0x60')]){_0x4a33f3[_0x8804('0x36')][_0x8804('0x61')]=JSON[_0x8804('0x62')](_0x137861[_0x8804('0x2e')][_0x8804('0x60')]);}return db['JscriptySessionReport'][_0x8804('0x3d')](_0x4a33f3)['then'](handleEntityNotFound(_0x40691d,null))['then'](function(_0x55dc13){if(_0x55dc13){_0x3b0ba1=_0x55dc13;return db[_0x8804('0x63')][_0x8804('0x3d')]({'where':{'SessionId':{'$in':_[_0x8804('0x2a')](_0x3b0ba1,'id')},'ProjectId':_0x137861[_0x8804('0x40')]['id']},'order':'-createdAt'});}})[_0x8804('0x21')](handleEntityNotFound(_0x40691d,null))['then'](function(_0x4f9e1b){if(_0x4f9e1b){_0x8ef9eb=_0x4f9e1b;var _0x1e64d1={};for(var _0x1d33d1=0x0,_0x26d947=_0x8ef9eb[_0x8804('0x33')];_0x1d33d1<_0x26d947;_0x1d33d1++){if(!_0x1e64d1['hasOwnProperty'](_0x8ef9eb[_0x1d33d1][_0x8804('0x64')])){_0x1e64d1[_0x8ef9eb[_0x1d33d1]['questionId']]=needsEncapsulation(_0x8ef9eb[_0x1d33d1]['question'])?encapsulate(_0x8ef9eb[_0x1d33d1]['question']):_0x8ef9eb[_0x1d33d1][_0x8804('0x65')];}}var _0x18979a=[],_0x804b17={};for(var _0x540885=0x0,_0x9c0d57=_0x3b0ba1[_0x8804('0x33')];_0x540885<_0x9c0d57;_0x540885++){_0x804b17={'ProjectId':_0x137861[_0x8804('0x40')]['id'],'SessionId':_0x3b0ba1[_0x540885]['id'],'StartTime':moment(_0x3b0ba1[_0x540885][_0x8804('0x61')])['format'](_0x8804('0x66'))};for(var _0x12828a=0x0,_0x45d5f9=_0x8ef9eb['length'];_0x12828a<_0x45d5f9;_0x12828a++){if(_0x8ef9eb[_0x12828a]['SessionId']==_0x3b0ba1[_0x540885]['id']&&_0x1e64d1[_0x8804('0x34')](_0x8ef9eb[_0x12828a][_0x8804('0x64')])){_0x804b17[_0x1e64d1[_0x8ef9eb[_0x12828a][_0x8804('0x64')]]]=_0x8ef9eb[_0x12828a][_0x8804('0x67')];}}for(var _0xc1171b in _0x1e64d1){if(!_0x804b17['hasOwnProperty'](_0x1e64d1[_0xc1171b])){_0x804b17[_0x1e64d1[_0xc1171b]]=null;}}_0x18979a['push'](_0x804b17);}return _0x18979a;}})['then'](function(_0x54c310){if(!_[_0x8804('0x68')](_0x54c310)){var _0x39a5c0=toCsv(_0x54c310);var _0x5d273d=Date[_0x8804('0x69')]();fs[_0x8804('0x6a')](util[_0x8804('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x137861[_0x8804('0x40')]['id'],_0x5d273d),_0x39a5c0);_0x40691d[_0x8804('0x6c')](_0x8804('0x6d'),'attachment;\x20filename='+util[_0x8804('0x6b')](_0x8804('0x6e'),_0x137861[_0x8804('0x40')]['id'],_0x5d273d));_0x40691d[_0x8804('0x6c')](_0x8804('0x6f'),_0x8804('0x70'));return _0x40691d[_0x8804('0x71')](util[_0x8804('0x6b')](_0x8804('0x72'),_0x137861[_0x8804('0x40')]['id'],_0x5d273d));}else{return _0x40691d[_0x8804('0x18')](0xcc);}})[_0x8804('0x3e')](handleError(_0x40691d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8426b87..dd357ef 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 _0x0ef0=['bluebird','request-promise','path','rimraf','exports','define','jscripty_projects','lodash','util','api','moment'];(function(_0x4f5485,_0x5e2c0b){var _0x5e9b9c=function(_0x55c9dc){while(--_0x55c9dc){_0x4f5485['push'](_0x4f5485['shift']());}};_0x5e9b9c(++_0x5e2c0b);}(_0x0ef0,0x80));var _0x00ef=function(_0x1b69a4,_0x3e9f5f){_0x1b69a4=_0x1b69a4-0x0;var _0x4ab6a6=_0x0ef0[_0x1b69a4];return _0x4ab6a6;};'use strict';var _=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var logger=require('../../config/logger')(_0x00ef('0x2'));var moment=require(_0x00ef('0x3'));var BPromise=require(_0x00ef('0x4'));var rp=require(_0x00ef('0x5'));var fs=require('fs');var path=require(_0x00ef('0x6'));var rimraf=require(_0x00ef('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x00ef('0x8')]=function(_0x406d13,_0x471ebf){return _0x406d13[_0x00ef('0x9')]('JscriptyProject',attributes,{'tableName':_0x00ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a22=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x8036ba,_0x63b1ec){var _0x5aad55=function(_0x3afc85){while(--_0x3afc85){_0x8036ba['push'](_0x8036ba['shift']());}};_0x5aad55(++_0x63b1ec);}(_0x9a22,0x75));var _0x29a2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x9a22[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x29a2('0x0'));var util=require(_0x29a2('0x1'));var logger=require(_0x29a2('0x2'))(_0x29a2('0x3'));var moment=require(_0x29a2('0x4'));var BPromise=require(_0x29a2('0x5'));var rp=require(_0x29a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x29a2('0x7'));var attributes=require(_0x29a2('0x8'));module[_0x29a2('0x9')]=function(_0x2ea411,_0x261835){return _0x2ea411[_0x29a2('0xa')](_0x29a2('0xb'),attributes,{'tableName':_0x29a2('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 8b41a83..ee86dd1 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x209c44,_0x12eb9b){var _0x1bfb1d=function(_0x308137){while(--_0x308137){_0x209c44['push'](_0x209c44['shift']());}};_0x1bfb1d(++_0x12eb9b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x17e02c,_0x3e06fc){_0x17e02c=_0x17e02c-0x0;var _0x54c9bd=_0xb43b[_0x17e02c];return _0x54c9bd;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x46688f,_0x302e66){var _0x5ee527=function(_0x38337c){while(--_0x38337c){_0x46688f['push'](_0x46688f['shift']());}};_0x5ee527(++_0x302e66);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 653f46b..1adecf6 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 _0x1ac8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete'];(function(_0x3e3b8f,_0x57fb1b){var _0x203ccf=function(_0x14b441){while(--_0x14b441){_0x3e3b8f['push'](_0x3e3b8f['shift']());}};_0x203ccf(++_0x57fb1b);}(_0x1ac8,0x1b9));var _0x81ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1ac8[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x81ac('0x0'));var util=require(_0x81ac('0x1'));var path=require(_0x81ac('0x2'));var timeout=require(_0x81ac('0x3'));var express=require(_0x81ac('0x4'));var router=express[_0x81ac('0x5')]();var fs_extra=require(_0x81ac('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x81ac('0x7'));var config=require(_0x81ac('0x8'));var controller=require(_0x81ac('0x9'));router[_0x81ac('0xa')]('/',auth[_0x81ac('0xb')](),controller['index']);router[_0x81ac('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x81ac('0xc')]);router['get'](_0x81ac('0xd'),auth[_0x81ac('0xb')](),controller[_0x81ac('0xe')]);router[_0x81ac('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x81ac('0x10')](_0x81ac('0xd'),auth[_0x81ac('0xb')](),controller[_0x81ac('0x11')]);router[_0x81ac('0x12')]('/:id',auth[_0x81ac('0xb')](),controller['destroy']);module[_0x81ac('0x13')]=router; \ No newline at end of file +var _0xe998=['describe','/:id','post','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x94230c,_0x59e725){var _0x54f12c=function(_0x58cf81){while(--_0x58cf81){_0x94230c['push'](_0x94230c['shift']());}};_0x54f12c(++_0x59e725);}(_0xe998,0x8c));var _0x8e99=function(_0x2a8441,_0x5f5dc0){_0x2a8441=_0x2a8441-0x0;var _0x23f8f2=_0xe998[_0x2a8441];return _0x23f8f2;};'use strict';var multer=require(_0x8e99('0x0'));var util=require('util');var path=require(_0x8e99('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e99('0x2'));var router=express[_0x8e99('0x3')]();var fs_extra=require(_0x8e99('0x4'));var auth=require(_0x8e99('0x5'));var interaction=require(_0x8e99('0x6'));var config=require(_0x8e99('0x7'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8e99('0x8')]);router[_0x8e99('0x9')](_0x8e99('0xa'),auth[_0x8e99('0xb')](),controller[_0x8e99('0xc')]);router[_0x8e99('0x9')](_0x8e99('0xd'),auth[_0x8e99('0xb')](),controller['show']);router[_0x8e99('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8e99('0xf')](_0x8e99('0xd'),auth[_0x8e99('0xb')](),controller[_0x8e99('0x10')]);router[_0x8e99('0x11')](_0x8e99('0xd'),auth[_0x8e99('0xb')](),controller[_0x8e99('0x12')]);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 392ee0e..721e764 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x120410,_0x1df3a9){_0x120410=_0x120410-0x0;var _0x3c8da7=_0x7a54[_0x120410];return _0x3c8da7;};'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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x31930f,_0x56c293){_0x31930f=_0x31930f-0x0;var _0x4e341e=_0x7a54[_0x31930f];return _0x4e341e;};'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 50be956..fc05e4b 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 _0x1d1a=['nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','send','index','map','JscriptyQuestionReport','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','length'];(function(_0x19dcf9,_0x5ef8cc){var _0x4a3e0f=function(_0x1f7ae9){while(--_0x1f7ae9){_0x19dcf9['push'](_0x19dcf9['shift']());}};_0x4a3e0f(++_0x5ef8cc);}(_0x1d1a,0x142));var _0xa1d1=function(_0x44bafa,_0x241a08){_0x44bafa=_0x44bafa-0x0;var _0xf2570a=_0x1d1a[_0x44bafa];return _0xf2570a;};'use strict';var emlformat=require(_0xa1d1('0x0'));var rimraf=require(_0xa1d1('0x1'));var zipdir=require(_0xa1d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1d1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1d1('0x4'));var util=require(_0xa1d1('0x5'));var path=require(_0xa1d1('0x6'));var sox=require(_0xa1d1('0x7'));var csv=require(_0xa1d1('0x8'));var ejs=require(_0xa1d1('0x9'));var fs=require('fs');var fs_extra=require(_0xa1d1('0xa'));var _=require(_0xa1d1('0xb'));var squel=require('squel');var crypto=require(_0xa1d1('0xc'));var jsforce=require(_0xa1d1('0xd'));var deskjs=require(_0xa1d1('0xe'));var toCsv=require(_0xa1d1('0x8'));var querystring=require(_0xa1d1('0xf'));var Papa=require('papaparse');var Redis=require(_0xa1d1('0x10'));var authService=require(_0xa1d1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa1d1('0x12'));var hardwareService=require(_0xa1d1('0x13'));var logger=require('../../config/logger')(_0xa1d1('0x14'));var utils=require(_0xa1d1('0x15'));var config=require(_0xa1d1('0x16'));var licenseUtil=require(_0xa1d1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cee3e,_0x2e0d1b){_0x2e0d1b=_0x2e0d1b||0xcc;return function(_0x3a2dee){if(_0x3a2dee){return _0x1cee3e[_0xa1d1('0x18')](_0x2e0d1b);}return _0x1cee3e[_0xa1d1('0x19')](_0x2e0d1b)['end']();};}function respondWithResult(_0x52af06,_0x548d90){_0x548d90=_0x548d90||0xc8;return function(_0x31d100){if(_0x31d100){return _0x52af06[_0xa1d1('0x19')](_0x548d90)[_0xa1d1('0x1a')](_0x31d100);}};}function respondWithFilteredResult(_0x4c670c,_0x7a2afc){return function(_0x549708){if(_0x549708){var _0x3fd76a=typeof _0x7a2afc[_0xa1d1('0x1b')]===_0xa1d1('0x1c')&&typeof _0x7a2afc[_0xa1d1('0x1d')]===_0xa1d1('0x1c');var _0x252863=_0x549708[_0xa1d1('0x1e')];var _0x1a41fe=_0x3fd76a?0x0:_0x7a2afc[_0xa1d1('0x1b')];var _0x3a8ad8=_0x3fd76a?_0x549708[_0xa1d1('0x1e')]:_0x7a2afc[_0xa1d1('0x1b')]+_0x7a2afc[_0xa1d1('0x1d')];var _0x104230;if(_0x3a8ad8>=_0x252863){_0x3a8ad8=_0x252863;_0x104230=0xc8;}else{_0x104230=0xce;}_0x4c670c[_0xa1d1('0x19')](_0x104230);return _0x4c670c[_0xa1d1('0x1f')](_0xa1d1('0x20'),_0x1a41fe+'-'+_0x3a8ad8+'/'+_0x252863)[_0xa1d1('0x1a')](_0x549708);}return null;};}function patchUpdates(_0x47046b){return function(_0x31ae46){try{jsonpatch['apply'](_0x31ae46,_0x47046b,!![]);}catch(_0x3459a8){return BPromise['reject'](_0x3459a8);}return _0x31ae46[_0xa1d1('0x21')]();};}function saveUpdates(_0x3bf8f3,_0x50e539){return function(_0x2c20a3){if(_0x2c20a3){return _0x2c20a3[_0xa1d1('0x22')](_0x3bf8f3)[_0xa1d1('0x23')](function(_0x39f3fe){return _0x39f3fe;});}return null;};}function removeEntity(_0x54ea7b,_0x164a96){return function(_0x386da1){if(_0x386da1){return _0x386da1['destroy']()['then'](function(){_0x54ea7b['status'](0xcc)[_0xa1d1('0x24')]();});}};}function handleEntityNotFound(_0x303721,_0xa5d3b2){return function(_0x513fb7){if(!_0x513fb7){_0x303721[_0xa1d1('0x18')](0x194);}return _0x513fb7;};}function handleError(_0x3988eb,_0x390cd4){_0x390cd4=_0x390cd4||0x1f4;return function(_0x1a6b8e){logger[_0xa1d1('0x25')](_0x1a6b8e['stack']);if(_0x1a6b8e['name']){delete _0x1a6b8e['name'];}_0x3988eb[_0xa1d1('0x19')](_0x390cd4)[_0xa1d1('0x26')](_0x1a6b8e);};}exports[_0xa1d1('0x27')]=function(_0x23bf46,_0x1cfd5b){var _0x5db4ba={},_0x3460cc={},_0x3a3981={'count':0x0,'rows':[]};var _0x4f89fd=_[_0xa1d1('0x28')](db[_0xa1d1('0x29')]['rawAttributes'],function(_0x3fcb15){return{'name':_0x3fcb15[_0xa1d1('0x2a')],'type':_0x3fcb15[_0xa1d1('0x2b')][_0xa1d1('0x2c')]};});_0x3460cc['model']=_[_0xa1d1('0x28')](_0x4f89fd,_0xa1d1('0x2d'));_0x3460cc[_0xa1d1('0x2e')]=_[_0xa1d1('0x2f')](_0x23bf46['query']);_0x3460cc['filters']=_[_0xa1d1('0x30')](_0x3460cc['model'],_0x3460cc[_0xa1d1('0x2e')]);_0x5db4ba['attributes']=_[_0xa1d1('0x30')](_0x3460cc[_0xa1d1('0x31')],qs[_0xa1d1('0x32')](_0x23bf46[_0xa1d1('0x2e')][_0xa1d1('0x32')]));_0x5db4ba['attributes']=_0x5db4ba[_0xa1d1('0x33')][_0xa1d1('0x34')]?_0x5db4ba[_0xa1d1('0x33')]:_0x3460cc[_0xa1d1('0x31')];if(!_0x23bf46[_0xa1d1('0x2e')]['hasOwnProperty'](_0xa1d1('0x35'))){_0x5db4ba[_0xa1d1('0x1d')]=qs['limit'](_0x23bf46[_0xa1d1('0x2e')][_0xa1d1('0x1d')]);_0x5db4ba[_0xa1d1('0x1b')]=qs[_0xa1d1('0x1b')](_0x23bf46[_0xa1d1('0x2e')][_0xa1d1('0x1b')]);}_0x5db4ba[_0xa1d1('0x36')]=qs[_0xa1d1('0x37')](_0x23bf46[_0xa1d1('0x2e')][_0xa1d1('0x37')]);_0x5db4ba[_0xa1d1('0x38')]=qs['filters'](_[_0xa1d1('0x39')](_0x23bf46[_0xa1d1('0x2e')],_0x3460cc[_0xa1d1('0x3a')]),_0x4f89fd);if(_0x23bf46[_0xa1d1('0x2e')][_0xa1d1('0x3b')]){_0x5db4ba[_0xa1d1('0x38')]=_[_0xa1d1('0x3c')](_0x5db4ba[_0xa1d1('0x38')],{'$or':_[_0xa1d1('0x28')](_0x4f89fd,function(_0x474f85){if(_0x474f85[_0xa1d1('0x2b')]!==_0xa1d1('0x3d')){var _0x167469={};_0x167469[_0x474f85['name']]={'$like':'%'+_0x23bf46[_0xa1d1('0x2e')]['filter']+'%'};return _0x167469;}})});}_0x5db4ba=_[_0xa1d1('0x3c')]({},_0x5db4ba,_0x23bf46[_0xa1d1('0x3e')]);var _0x6f0e41={'where':_0x5db4ba['where']};return db[_0xa1d1('0x29')]['count'](_0x6f0e41)[_0xa1d1('0x23')](function(_0x47890f){_0x3a3981[_0xa1d1('0x1e')]=_0x47890f;if(_0x23bf46[_0xa1d1('0x2e')][_0xa1d1('0x3f')]){_0x5db4ba[_0xa1d1('0x40')]=[{'all':!![]}];}return db[_0xa1d1('0x29')][_0xa1d1('0x41')](_0x5db4ba);})[_0xa1d1('0x23')](function(_0xa7d51){_0x3a3981[_0xa1d1('0x42')]=_0xa7d51;return _0x3a3981;})[_0xa1d1('0x23')](respondWithFilteredResult(_0x1cfd5b,_0x5db4ba))[_0xa1d1('0x43')](handleError(_0x1cfd5b,null));};exports['show']=function(_0x5a6645,_0x4a1398){var _0x3486bd={'raw':!![],'where':{'id':_0x5a6645[_0xa1d1('0x44')]['id']}},_0x30e39e={};_0x30e39e[_0xa1d1('0x31')]=_['keys'](db[_0xa1d1('0x29')][_0xa1d1('0x45')]);_0x30e39e[_0xa1d1('0x2e')]=_[_0xa1d1('0x2f')](_0x5a6645[_0xa1d1('0x2e')]);_0x30e39e[_0xa1d1('0x3a')]=_[_0xa1d1('0x30')](_0x30e39e[_0xa1d1('0x31')],_0x30e39e['query']);_0x3486bd[_0xa1d1('0x33')]=_[_0xa1d1('0x30')](_0x30e39e[_0xa1d1('0x31')],qs['fields'](_0x5a6645[_0xa1d1('0x2e')][_0xa1d1('0x32')]));_0x3486bd[_0xa1d1('0x33')]=_0x3486bd[_0xa1d1('0x33')][_0xa1d1('0x34')]?_0x3486bd[_0xa1d1('0x33')]:_0x30e39e['model'];if(_0x5a6645['query'][_0xa1d1('0x3f')]){_0x3486bd['include']=[{'all':!![]}];}_0x3486bd=_[_0xa1d1('0x3c')]({},_0x3486bd,_0x5a6645[_0xa1d1('0x3e')]);return db[_0xa1d1('0x29')][_0xa1d1('0x46')](_0x3486bd)[_0xa1d1('0x23')](handleEntityNotFound(_0x4a1398,null))[_0xa1d1('0x23')](respondWithResult(_0x4a1398,null))[_0xa1d1('0x43')](handleError(_0x4a1398,null));};exports[_0xa1d1('0x47')]=function(_0x268136,_0x2f2a40){return db[_0xa1d1('0x29')]['create'](_0x268136[_0xa1d1('0x48')],{})[_0xa1d1('0x23')](respondWithResult(_0x2f2a40,0xc9))['catch'](handleError(_0x2f2a40,null));};exports[_0xa1d1('0x22')]=function(_0x355aaf,_0x1d99c1){if(_0x355aaf[_0xa1d1('0x48')]['id']){delete _0x355aaf[_0xa1d1('0x48')]['id'];}return db['JscriptyQuestionReport'][_0xa1d1('0x46')]({'where':{'id':_0x355aaf[_0xa1d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d99c1,null))[_0xa1d1('0x23')](saveUpdates(_0x355aaf['body'],null))[_0xa1d1('0x23')](respondWithResult(_0x1d99c1,null))[_0xa1d1('0x43')](handleError(_0x1d99c1,null));};exports[_0xa1d1('0x49')]=function(_0x18e03a,_0x2a203a){return db[_0xa1d1('0x29')][_0xa1d1('0x46')]({'where':{'id':_0x18e03a[_0xa1d1('0x44')]['id']}})[_0xa1d1('0x23')](handleEntityNotFound(_0x2a203a,null))['then'](removeEntity(_0x2a203a,null))[_0xa1d1('0x43')](handleError(_0x2a203a,null));};exports['describe']=function(_0x3df057,_0x29b7c5){return db['JscriptyQuestionReport'][_0xa1d1('0x4a')]()[_0xa1d1('0x23')](respondWithResult(_0x29b7c5,null))['catch'](handleError(_0x29b7c5,null));}; \ No newline at end of file +var _0x9c7d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','JscriptyQuestionReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x934c4d,_0x17b92c){var _0x416c29=function(_0x397d5d){while(--_0x397d5d){_0x934c4d['push'](_0x934c4d['shift']());}};_0x416c29(++_0x17b92c);}(_0x9c7d,0x1f2));var _0xd9c7=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x9c7d[_0x53b594];return _0x1e616f;};'use strict';var emlformat=require(_0xd9c7('0x0'));var rimraf=require(_0xd9c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9c7('0x2'));var util=require('util');var path=require(_0xd9c7('0x3'));var sox=require(_0xd9c7('0x4'));var csv=require(_0xd9c7('0x5'));var ejs=require(_0xd9c7('0x6'));var fs=require('fs');var fs_extra=require(_0xd9c7('0x7'));var _=require(_0xd9c7('0x8'));var squel=require(_0xd9c7('0x9'));var crypto=require(_0xd9c7('0xa'));var jsforce=require(_0xd9c7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd9c7('0x5'));var querystring=require(_0xd9c7('0xc'));var Papa=require(_0xd9c7('0xd'));var Redis=require(_0xd9c7('0xe'));var authService=require(_0xd9c7('0xf'));var qs=require(_0xd9c7('0x10'));var as=require(_0xd9c7('0x11'));var hardwareService=require(_0xd9c7('0x12'));var logger=require(_0xd9c7('0x13'))('api');var utils=require(_0xd9c7('0x14'));var config=require(_0xd9c7('0x15'));var licenseUtil=require(_0xd9c7('0x16'));var db=require(_0xd9c7('0x17'))['db'];function respondWithStatusCode(_0x3e3b4f,_0x20b274){_0x20b274=_0x20b274||0xcc;return function(_0x462fce){if(_0x462fce){return _0x3e3b4f[_0xd9c7('0x18')](_0x20b274);}return _0x3e3b4f['status'](_0x20b274)[_0xd9c7('0x19')]();};}function respondWithResult(_0xc6776d,_0x4d7008){_0x4d7008=_0x4d7008||0xc8;return function(_0x2f24b1){if(_0x2f24b1){return _0xc6776d[_0xd9c7('0x1a')](_0x4d7008)[_0xd9c7('0x1b')](_0x2f24b1);}};}function respondWithFilteredResult(_0x2c8425,_0x4dc755){return function(_0x32b63a){if(_0x32b63a){var _0x87d125=typeof _0x4dc755[_0xd9c7('0x1c')]==='undefined'&&typeof _0x4dc755['limit']===_0xd9c7('0x1d');var _0x5e73c3=_0x32b63a[_0xd9c7('0x1e')];var _0xa6607c=_0x87d125?0x0:_0x4dc755['offset'];var _0x4e8ed8=_0x87d125?_0x32b63a['count']:_0x4dc755['offset']+_0x4dc755[_0xd9c7('0x1f')];var _0x5f48d5;if(_0x4e8ed8>=_0x5e73c3){_0x4e8ed8=_0x5e73c3;_0x5f48d5=0xc8;}else{_0x5f48d5=0xce;}_0x2c8425[_0xd9c7('0x1a')](_0x5f48d5);return _0x2c8425[_0xd9c7('0x20')](_0xd9c7('0x21'),_0xa6607c+'-'+_0x4e8ed8+'/'+_0x5e73c3)[_0xd9c7('0x1b')](_0x32b63a);}return null;};}function patchUpdates(_0x5a1c30){return function(_0x50aa66){try{jsonpatch[_0xd9c7('0x22')](_0x50aa66,_0x5a1c30,!![]);}catch(_0x4d9cd5){return BPromise[_0xd9c7('0x23')](_0x4d9cd5);}return _0x50aa66['save']();};}function saveUpdates(_0x126694,_0x11eed2){return function(_0x2501f6){if(_0x2501f6){return _0x2501f6[_0xd9c7('0x24')](_0x126694)[_0xd9c7('0x25')](function(_0x514ac0){return _0x514ac0;});}return null;};}function removeEntity(_0x11bd24,_0x2823ff){return function(_0x809663){if(_0x809663){return _0x809663[_0xd9c7('0x26')]()[_0xd9c7('0x25')](function(){_0x11bd24[_0xd9c7('0x1a')](0xcc)[_0xd9c7('0x19')]();});}};}function handleEntityNotFound(_0x3ba852,_0x4f2ef5){return function(_0x470d3f){if(!_0x470d3f){_0x3ba852[_0xd9c7('0x18')](0x194);}return _0x470d3f;};}function handleError(_0x49e103,_0x4cd0ed){_0x4cd0ed=_0x4cd0ed||0x1f4;return function(_0x2aee39){logger[_0xd9c7('0x27')](_0x2aee39[_0xd9c7('0x28')]);if(_0x2aee39['name']){delete _0x2aee39[_0xd9c7('0x29')];}_0x49e103['status'](_0x4cd0ed)['send'](_0x2aee39);};}exports['index']=function(_0x24f0bb,_0x548da7){var _0x440195={},_0x44627f={},_0x42dcb2={'count':0x0,'rows':[]};var _0x422a23=_[_0xd9c7('0x2a')](db[_0xd9c7('0x2b')]['rawAttributes'],function(_0x2e7bf5){return{'name':_0x2e7bf5[_0xd9c7('0x2c')],'type':_0x2e7bf5['type'][_0xd9c7('0x2d')]};});_0x44627f[_0xd9c7('0x2e')]=_[_0xd9c7('0x2a')](_0x422a23,_0xd9c7('0x29'));_0x44627f[_0xd9c7('0x2f')]=_[_0xd9c7('0x30')](_0x24f0bb[_0xd9c7('0x2f')]);_0x44627f[_0xd9c7('0x31')]=_[_0xd9c7('0x32')](_0x44627f[_0xd9c7('0x2e')],_0x44627f[_0xd9c7('0x2f')]);_0x440195[_0xd9c7('0x33')]=_[_0xd9c7('0x32')](_0x44627f[_0xd9c7('0x2e')],qs[_0xd9c7('0x34')](_0x24f0bb[_0xd9c7('0x2f')][_0xd9c7('0x34')]));_0x440195[_0xd9c7('0x33')]=_0x440195[_0xd9c7('0x33')][_0xd9c7('0x35')]?_0x440195[_0xd9c7('0x33')]:_0x44627f[_0xd9c7('0x2e')];if(!_0x24f0bb['query'][_0xd9c7('0x36')](_0xd9c7('0x37'))){_0x440195[_0xd9c7('0x1f')]=qs[_0xd9c7('0x1f')](_0x24f0bb[_0xd9c7('0x2f')]['limit']);_0x440195[_0xd9c7('0x1c')]=qs[_0xd9c7('0x1c')](_0x24f0bb[_0xd9c7('0x2f')]['offset']);}_0x440195[_0xd9c7('0x38')]=qs['sort'](_0x24f0bb['query']['sort']);_0x440195[_0xd9c7('0x39')]=qs['filters'](_[_0xd9c7('0x3a')](_0x24f0bb['query'],_0x44627f['filters']),_0x422a23);if(_0x24f0bb[_0xd9c7('0x2f')][_0xd9c7('0x3b')]){_0x440195[_0xd9c7('0x39')]=_[_0xd9c7('0x3c')](_0x440195[_0xd9c7('0x39')],{'$or':_['map'](_0x422a23,function(_0x5448f1){if(_0x5448f1['type']!==_0xd9c7('0x3d')){var _0x183608={};_0x183608[_0x5448f1[_0xd9c7('0x29')]]={'$like':'%'+_0x24f0bb['query'][_0xd9c7('0x3b')]+'%'};return _0x183608;}})});}_0x440195=_['merge']({},_0x440195,_0x24f0bb[_0xd9c7('0x3e')]);var _0xadbc49={'where':_0x440195[_0xd9c7('0x39')]};return db[_0xd9c7('0x2b')]['count'](_0xadbc49)[_0xd9c7('0x25')](function(_0x37cb77){_0x42dcb2[_0xd9c7('0x1e')]=_0x37cb77;if(_0x24f0bb[_0xd9c7('0x2f')][_0xd9c7('0x3f')]){_0x440195[_0xd9c7('0x40')]=[{'all':!![]}];}return db[_0xd9c7('0x2b')]['findAll'](_0x440195);})[_0xd9c7('0x25')](function(_0x14d2b3){_0x42dcb2[_0xd9c7('0x41')]=_0x14d2b3;return _0x42dcb2;})[_0xd9c7('0x25')](respondWithFilteredResult(_0x548da7,_0x440195))[_0xd9c7('0x42')](handleError(_0x548da7,null));};exports['show']=function(_0x270d42,_0x91830c){var _0x5d447a={'raw':!![],'where':{'id':_0x270d42[_0xd9c7('0x43')]['id']}},_0x4448c8={};_0x4448c8['model']=_[_0xd9c7('0x30')](db['JscriptyQuestionReport'][_0xd9c7('0x44')]);_0x4448c8['query']=_[_0xd9c7('0x30')](_0x270d42[_0xd9c7('0x2f')]);_0x4448c8[_0xd9c7('0x31')]=_[_0xd9c7('0x32')](_0x4448c8[_0xd9c7('0x2e')],_0x4448c8[_0xd9c7('0x2f')]);_0x5d447a[_0xd9c7('0x33')]=_[_0xd9c7('0x32')](_0x4448c8['model'],qs['fields'](_0x270d42[_0xd9c7('0x2f')]['fields']));_0x5d447a[_0xd9c7('0x33')]=_0x5d447a['attributes'][_0xd9c7('0x35')]?_0x5d447a[_0xd9c7('0x33')]:_0x4448c8[_0xd9c7('0x2e')];if(_0x270d42[_0xd9c7('0x2f')][_0xd9c7('0x3f')]){_0x5d447a[_0xd9c7('0x40')]=[{'all':!![]}];}_0x5d447a=_['merge']({},_0x5d447a,_0x270d42[_0xd9c7('0x3e')]);return db[_0xd9c7('0x2b')][_0xd9c7('0x45')](_0x5d447a)['then'](handleEntityNotFound(_0x91830c,null))['then'](respondWithResult(_0x91830c,null))[_0xd9c7('0x42')](handleError(_0x91830c,null));};exports[_0xd9c7('0x46')]=function(_0x472373,_0x4a4215){return db['JscriptyQuestionReport'][_0xd9c7('0x46')](_0x472373[_0xd9c7('0x47')],{})[_0xd9c7('0x25')](respondWithResult(_0x4a4215,0xc9))[_0xd9c7('0x42')](handleError(_0x4a4215,null));};exports[_0xd9c7('0x24')]=function(_0xa1f1f8,_0x1566d1){if(_0xa1f1f8[_0xd9c7('0x47')]['id']){delete _0xa1f1f8['body']['id'];}return db[_0xd9c7('0x2b')]['find']({'where':{'id':_0xa1f1f8[_0xd9c7('0x43')]['id']}})[_0xd9c7('0x25')](handleEntityNotFound(_0x1566d1,null))[_0xd9c7('0x25')](saveUpdates(_0xa1f1f8['body'],null))[_0xd9c7('0x25')](respondWithResult(_0x1566d1,null))[_0xd9c7('0x42')](handleError(_0x1566d1,null));};exports[_0xd9c7('0x26')]=function(_0x65ffb6,_0x53a2d3){return db[_0xd9c7('0x2b')][_0xd9c7('0x45')]({'where':{'id':_0x65ffb6[_0xd9c7('0x43')]['id']}})['then'](handleEntityNotFound(_0x53a2d3,null))[_0xd9c7('0x25')](removeEntity(_0x53a2d3,null))['catch'](handleError(_0x53a2d3,null));};exports[_0xd9c7('0x48')]=function(_0xaf19db,_0x2ab912){return db[_0xd9c7('0x2b')][_0xd9c7('0x48')]()[_0xd9c7('0x25')](respondWithResult(_0x2ab912,null))[_0xd9c7('0x42')](handleError(_0x2ab912,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 71e3bc2..8b4eb1e 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 _0x269b=['rimraf','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','util','api','path'];(function(_0x599b16,_0x28e492){var _0x2812db=function(_0x21f34f){while(--_0x21f34f){_0x599b16['push'](_0x599b16['shift']());}};_0x2812db(++_0x28e492);}(_0x269b,0x8d));var _0xb269=function(_0x4536d7,_0x2c14bd){_0x4536d7=_0x4536d7-0x0;var _0x268280=_0x269b[_0x4536d7];return _0x268280;};'use strict';var _=require('lodash');var util=require(_0xb269('0x0'));var logger=require('../../config/logger')(_0xb269('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb269('0x2'));var rimraf=require(_0xb269('0x3'));var config=require(_0xb269('0x4'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xb269('0x5')]=function(_0x457b01,_0x2100e9){return _0x457b01['define'](_0xb269('0x6'),attributes,{'tableName':_0xb269('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd16f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','lodash','util'];(function(_0x22b8f0,_0x2cddee){var _0x8f8503=function(_0x222d2d){while(--_0x222d2d){_0x22b8f0['push'](_0x22b8f0['shift']());}};_0x8f8503(++_0x2cddee);}(_0xd16f,0xa6));var _0xfd16=function(_0x544281,_0x3cecba){_0x544281=_0x544281-0x0;var _0x4bc240=_0xd16f[_0x544281];return _0x4bc240;};'use strict';var _=require(_0xfd16('0x0'));var util=require(_0xfd16('0x1'));var logger=require(_0xfd16('0x2'))(_0xfd16('0x3'));var moment=require(_0xfd16('0x4'));var BPromise=require(_0xfd16('0x5'));var rp=require(_0xfd16('0x6'));var fs=require('fs');var path=require(_0xfd16('0x7'));var rimraf=require(_0xfd16('0x8'));var config=require('../../config/environment');var attributes=require(_0xfd16('0x9'));module[_0xfd16('0xa')]=function(_0x314d06,_0x2fe8c3){return _0x314d06[_0xfd16('0xb')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','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 35c44e0..10d8c53 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 _0x3f9c=['client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','info','lodash','moment','bluebird','../../config/utils','../../config/environment'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x3f9c,0x10b));var _0xc3f9=function(_0x45007d,_0x2333bf){_0x45007d=_0x45007d-0x0;var _0x307679=_0x3f9c[_0x45007d];return _0x307679;};'use strict';var _=require(_0xc3f9('0x0'));var util=require('util');var moment=require(_0xc3f9('0x1'));var BPromise=require(_0xc3f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc3f9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xc3f9('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xc3f9('0x5')][_0xc3f9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c4a02,_0x283cdb,_0x382402){return new BPromise(function(_0x525678,_0x47a466){return client[_0xc3f9('0x7')](_0x4c4a02,_0x382402)[_0xc3f9('0x8')](function(_0x3920c4){logger['info'](_0xc3f9('0x9'),_0x283cdb,_0xc3f9('0xa'));logger[_0xc3f9('0xb')](_0xc3f9('0xc'),_0x283cdb,_0xc3f9('0xa'),JSON['stringify'](_0x3920c4));if(_0x3920c4[_0xc3f9('0xd')]){if(_0x3920c4[_0xc3f9('0xd')]['code']===0x1f4){logger[_0xc3f9('0xd')](_0xc3f9('0x9'),_0x283cdb,_0x3920c4[_0xc3f9('0xd')][_0xc3f9('0xe')]);return _0x47a466(_0x3920c4['error'][_0xc3f9('0xe')]);}logger['error'](_0xc3f9('0x9'),_0x283cdb,_0x3920c4['error'][_0xc3f9('0xe')]);return _0x525678(_0x3920c4['error'][_0xc3f9('0xe')]);}else{logger[_0xc3f9('0xf')](_0xc3f9('0x9'),_0x283cdb,'request\x20sent');_0x525678(_0x3920c4['result'][_0xc3f9('0xe')]);}})['catch'](function(_0x1dd1bd){logger[_0xc3f9('0xd')](_0xc3f9('0x9'),_0x283cdb,_0x1dd1bd);_0x47a466(_0x1dd1bd);});});} \ No newline at end of file +var _0xcb0e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x145b54,_0x267c42){var _0x52007e=function(_0xfc9fdf){while(--_0xfc9fdf){_0x145b54['push'](_0x145b54['shift']());}};_0x52007e(++_0x267c42);}(_0xcb0e,0xab));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xecb0('0x0'));var util=require(_0xecb0('0x1'));var moment=require(_0xecb0('0x2'));var BPromise=require(_0xecb0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecb0('0x4'));var db=require(_0xecb0('0x5'))['db'];var utils=require(_0xecb0('0x6'));var logger=require('../../config/logger')(_0xecb0('0x7'));var config=require(_0xecb0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43df03,_0x5f5330,_0x24300c){return new BPromise(function(_0x258b6b,_0x5a00a5){return client[_0xecb0('0x9')](_0x43df03,_0x24300c)['then'](function(_0x1f2d0a){logger[_0xecb0('0xa')](_0xecb0('0xb'),_0x5f5330,_0xecb0('0xc'));logger[_0xecb0('0xd')](_0xecb0('0xe'),_0x5f5330,'request\x20sent',JSON[_0xecb0('0xf')](_0x1f2d0a));if(_0x1f2d0a['error']){if(_0x1f2d0a[_0xecb0('0x10')][_0xecb0('0x11')]===0x1f4){logger[_0xecb0('0x10')](_0xecb0('0xb'),_0x5f5330,_0x1f2d0a[_0xecb0('0x10')][_0xecb0('0x12')]);return _0x5a00a5(_0x1f2d0a[_0xecb0('0x10')][_0xecb0('0x12')]);}logger['error'](_0xecb0('0xb'),_0x5f5330,_0x1f2d0a[_0xecb0('0x10')][_0xecb0('0x12')]);return _0x258b6b(_0x1f2d0a[_0xecb0('0x10')][_0xecb0('0x12')]);}else{logger[_0xecb0('0xa')](_0xecb0('0xb'),_0x5f5330,_0xecb0('0xc'));_0x258b6b(_0x1f2d0a['result']['message']);}})['catch'](function(_0x1b4cf1){logger[_0xecb0('0x10')](_0xecb0('0xb'),_0x5f5330,_0x1b4cf1);_0x5a00a5(_0x1b4cf1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 82f024f..dc41f7c 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 _0xd714=['/:id/questions','getQuestions','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x3e84bd,_0x93765){var _0xd0fe59=function(_0x554092){while(--_0x554092){_0x3e84bd['push'](_0x3e84bd['shift']());}};_0xd0fe59(++_0x93765);}(_0xd714,0x71));var _0x4d71=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xd714[_0xf04c6d];return _0x4a804e;};'use strict';var multer=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var path=require(_0x4d71('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d71('0x3'));var router=express[_0x4d71('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d71('0x5'));var config=require(_0x4d71('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x4d71('0x7')]('/',auth[_0x4d71('0x8')](),controller[_0x4d71('0x9')]);router[_0x4d71('0x7')]('/describe',auth[_0x4d71('0x8')](),controller[_0x4d71('0xa')]);router[_0x4d71('0x7')](_0x4d71('0xb'),auth['isAuthenticated'](),controller[_0x4d71('0xc')]);router[_0x4d71('0x7')](_0x4d71('0xd'),auth[_0x4d71('0x8')](),controller[_0x4d71('0xe')]);router[_0x4d71('0xf')]('/',auth[_0x4d71('0x8')](),controller[_0x4d71('0x10')]);router[_0x4d71('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4d71('0x12')]);router['delete'](_0x4d71('0xb'),auth['isAuthenticated'](),controller[_0x4d71('0x13')]);module[_0x4d71('0x14')]=router; \ No newline at end of file +var _0x6041=['post','create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/questions','getQuestions'];(function(_0x46f9c7,_0x20590c){var _0x3efdeb=function(_0x3f2b57){while(--_0x3f2b57){_0x46f9c7['push'](_0x46f9c7['shift']());}};_0x3efdeb(++_0x20590c);}(_0x6041,0x103));var _0x1604=function(_0x343420,_0x480706){_0x343420=_0x343420-0x0;var _0x16b8b6=_0x6041[_0x343420];return _0x16b8b6;};'use strict';var multer=require(_0x1604('0x0'));var util=require('util');var path=require(_0x1604('0x1'));var timeout=require(_0x1604('0x2'));var express=require('express');var router=express[_0x1604('0x3')]();var fs_extra=require(_0x1604('0x4'));var auth=require(_0x1604('0x5'));var interaction=require(_0x1604('0x6'));var config=require(_0x1604('0x7'));var controller=require(_0x1604('0x8'));router['get']('/',auth[_0x1604('0x9')](),controller[_0x1604('0xa')]);router[_0x1604('0xb')](_0x1604('0xc'),auth[_0x1604('0x9')](),controller['describe']);router[_0x1604('0xb')](_0x1604('0xd'),auth['isAuthenticated'](),controller[_0x1604('0xe')]);router[_0x1604('0xb')](_0x1604('0xf'),auth[_0x1604('0x9')](),controller[_0x1604('0x10')]);router[_0x1604('0x11')]('/',auth[_0x1604('0x9')](),controller[_0x1604('0x12')]);router[_0x1604('0x13')](_0x1604('0xd'),auth[_0x1604('0x9')](),controller[_0x1604('0x14')]);router[_0x1604('0x15')](_0x1604('0xd'),auth[_0x1604('0x9')](),controller['destroy']);module[_0x1604('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 4e981fd..011c13e 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 _0xb73d=['endtime','format','STRING','BOOLEAN','moment','exports','DATE','setDataValue','starttime'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xb73d,0xd3));var _0xdb73=function(_0x2204ef,_0x10b4eb){_0x2204ef=_0x2204ef-0x0;var _0x4ac9f2=_0xb73d[_0x2204ef];return _0x4ac9f2;};'use strict';var moment=require(_0xdb73('0x0'));var Sequelize=require('sequelize');module[_0xdb73('0x1')]={'starttime':{'type':Sequelize[_0xdb73('0x2')],'set':function(_0x2c2abd){this[_0xdb73('0x3')](_0xdb73('0x4'),_0x2c2abd);this['setDataValue'](_0xdb73('0x5'),moment()[_0xdb73('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xdb73('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdb73('0x7')]},'queue':{'type':Sequelize[_0xdb73('0x7')]},'uniqueid':{'type':Sequelize[_0xdb73('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdb73('0x7')]},'completed':{'type':Sequelize[_0xdb73('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x2e21=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime','format'];(function(_0x375c5a,_0x3b2bdd){var _0xf8b9b2=function(_0x241bc9){while(--_0x241bc9){_0x375c5a['push'](_0x375c5a['shift']());}};_0xf8b9b2(++_0x3b2bdd);}(_0x2e21,0xcb));var _0x12e2=function(_0x15d6e9,_0x3134a1){_0x15d6e9=_0x15d6e9-0x0;var _0x4eb559=_0x2e21[_0x15d6e9];return _0x4eb559;};'use strict';var moment=require(_0x12e2('0x0'));var Sequelize=require(_0x12e2('0x1'));module[_0x12e2('0x2')]={'starttime':{'type':Sequelize[_0x12e2('0x3')],'set':function(_0x5e8ef0){this[_0x12e2('0x4')]('starttime',_0x5e8ef0);this[_0x12e2('0x4')](_0x12e2('0x5'),moment()[_0x12e2('0x6')](_0x12e2('0x7')));}},'endtime':{'type':Sequelize[_0x12e2('0x3')]},'membername':{'type':Sequelize[_0x12e2('0x8')]},'projectname':{'type':Sequelize[_0x12e2('0x8')]},'queue':{'type':Sequelize[_0x12e2('0x8')]},'uniqueid':{'type':Sequelize[_0x12e2('0x8')]},'calleridname':{'type':Sequelize[_0x12e2('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x12e2('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 999494f..5f805fc 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 _0xfb6f=['count','offset','set','reject','save','update','destroy','then','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','findOne','pick','JscriptyQuestionReport','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','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','sendStatus','status','end','json','undefined','limit'];(function(_0x5dca8c,_0x43a278){var _0x1985c3=function(_0xc90cd3){while(--_0xc90cd3){_0x5dca8c['push'](_0x5dca8c['shift']());}};_0x1985c3(++_0x43a278);}(_0xfb6f,0x11e));var _0xffb6=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xfb6f[_0x4a599b];return _0x2d53d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffb6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffb6('0x1'));var rp=require(_0xffb6('0x2'));var moment=require('moment');var BPromise=require(_0xffb6('0x3'));var Mustache=require(_0xffb6('0x4'));var util=require(_0xffb6('0x5'));var path=require(_0xffb6('0x6'));var sox=require('sox');var csv=require(_0xffb6('0x7'));var ejs=require(_0xffb6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffb6('0x9'));var squel=require('squel');var crypto=require(_0xffb6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xffb6('0xb'));var toCsv=require(_0xffb6('0x7'));var querystring=require(_0xffb6('0xc'));var Papa=require(_0xffb6('0xd'));var Redis=require(_0xffb6('0xe'));var authService=require(_0xffb6('0xf'));var qs=require(_0xffb6('0x10'));var as=require(_0xffb6('0x11'));var hardwareService=require(_0xffb6('0x12'));var logger=require(_0xffb6('0x13'))(_0xffb6('0x14'));var utils=require(_0xffb6('0x15'));var config=require(_0xffb6('0x16'));var licenseUtil=require(_0xffb6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fdb18,_0x5878f2){_0x5878f2=_0x5878f2||0xcc;return function(_0x1606fa){if(_0x1606fa){return _0x1fdb18[_0xffb6('0x18')](_0x5878f2);}return _0x1fdb18[_0xffb6('0x19')](_0x5878f2)[_0xffb6('0x1a')]();};}function respondWithResult(_0x3bdb9f,_0x1cbd35){_0x1cbd35=_0x1cbd35||0xc8;return function(_0x51dae9){if(_0x51dae9){return _0x3bdb9f['status'](_0x1cbd35)[_0xffb6('0x1b')](_0x51dae9);}};}function respondWithFilteredResult(_0x1c354a,_0x4fe2a4){return function(_0x235254){if(_0x235254){var _0x22ca51=typeof _0x4fe2a4['offset']===_0xffb6('0x1c')&&typeof _0x4fe2a4[_0xffb6('0x1d')]===_0xffb6('0x1c');var _0x215685=_0x235254[_0xffb6('0x1e')];var _0x4759fb=_0x22ca51?0x0:_0x4fe2a4[_0xffb6('0x1f')];var _0x2d2ccf=_0x22ca51?_0x235254['count']:_0x4fe2a4[_0xffb6('0x1f')]+_0x4fe2a4[_0xffb6('0x1d')];var _0x4052b7;if(_0x2d2ccf>=_0x215685){_0x2d2ccf=_0x215685;_0x4052b7=0xc8;}else{_0x4052b7=0xce;}_0x1c354a['status'](_0x4052b7);return _0x1c354a[_0xffb6('0x20')]('Content-Range',_0x4759fb+'-'+_0x2d2ccf+'/'+_0x215685)['json'](_0x235254);}return null;};}function patchUpdates(_0x276eec){return function(_0x17f98a){try{jsonpatch['apply'](_0x17f98a,_0x276eec,!![]);}catch(_0x109651){return BPromise[_0xffb6('0x21')](_0x109651);}return _0x17f98a[_0xffb6('0x22')]();};}function saveUpdates(_0x5e201b,_0x4e0140){return function(_0x218d77){if(_0x218d77){return _0x218d77[_0xffb6('0x23')](_0x5e201b)['then'](function(_0x2ad64a){return _0x2ad64a;});}return null;};}function removeEntity(_0x245de4,_0x65d670){return function(_0x11bfc4){if(_0x11bfc4){return _0x11bfc4[_0xffb6('0x24')]()[_0xffb6('0x25')](function(){_0x245de4[_0xffb6('0x19')](0xcc)[_0xffb6('0x1a')]();});}};}function handleEntityNotFound(_0x38bae7,_0x5b5df5){return function(_0x36164f){if(!_0x36164f){_0x38bae7[_0xffb6('0x18')](0x194);}return _0x36164f;};}function handleError(_0x9c013,_0x39042f){_0x39042f=_0x39042f||0x1f4;return function(_0xf29476){logger['error'](_0xf29476[_0xffb6('0x26')]);if(_0xf29476[_0xffb6('0x27')]){delete _0xf29476[_0xffb6('0x27')];}_0x9c013['status'](_0x39042f)[_0xffb6('0x28')](_0xf29476);};}exports[_0xffb6('0x29')]=function(_0x2a5728,_0x36a625){var _0x2067a0={},_0x4e6ba2={},_0x3746f5={'count':0x0,'rows':[]};var _0x258bb0=_[_0xffb6('0x2a')](db[_0xffb6('0x2b')][_0xffb6('0x2c')],function(_0x43824e){return{'name':_0x43824e[_0xffb6('0x2d')],'type':_0x43824e['type'][_0xffb6('0x2e')]};});_0x4e6ba2[_0xffb6('0x2f')]=_[_0xffb6('0x2a')](_0x258bb0,_0xffb6('0x27'));_0x4e6ba2['query']=_['keys'](_0x2a5728[_0xffb6('0x30')]);_0x4e6ba2[_0xffb6('0x31')]=_[_0xffb6('0x32')](_0x4e6ba2[_0xffb6('0x2f')],_0x4e6ba2['query']);_0x2067a0[_0xffb6('0x33')]=_[_0xffb6('0x32')](_0x4e6ba2[_0xffb6('0x2f')],qs[_0xffb6('0x34')](_0x2a5728[_0xffb6('0x30')][_0xffb6('0x34')]));_0x2067a0[_0xffb6('0x33')]=_0x2067a0['attributes'][_0xffb6('0x35')]?_0x2067a0['attributes']:_0x4e6ba2[_0xffb6('0x2f')];if(!_0x2a5728[_0xffb6('0x30')][_0xffb6('0x36')](_0xffb6('0x37'))){_0x2067a0[_0xffb6('0x1d')]=qs[_0xffb6('0x1d')](_0x2a5728[_0xffb6('0x30')][_0xffb6('0x1d')]);_0x2067a0['offset']=qs['offset'](_0x2a5728[_0xffb6('0x30')]['offset']);}_0x2067a0[_0xffb6('0x38')]=qs[_0xffb6('0x39')](_0x2a5728[_0xffb6('0x30')][_0xffb6('0x39')]);_0x2067a0[_0xffb6('0x3a')]=qs[_0xffb6('0x31')](_['pick'](_0x2a5728[_0xffb6('0x30')],_0x4e6ba2[_0xffb6('0x31')]),_0x258bb0);if(_0x2a5728[_0xffb6('0x30')][_0xffb6('0x3b')]){_0x2067a0['where']=_['merge'](_0x2067a0[_0xffb6('0x3a')],{'$or':_[_0xffb6('0x2a')](_0x258bb0,function(_0x300792){if(_0x300792[_0xffb6('0x3c')]!==_0xffb6('0x3d')){var _0xe1347a={};_0xe1347a[_0x300792[_0xffb6('0x27')]]={'$like':'%'+_0x2a5728[_0xffb6('0x30')][_0xffb6('0x3b')]+'%'};return _0xe1347a;}})});}_0x2067a0=_[_0xffb6('0x3e')]({},_0x2067a0,_0x2a5728[_0xffb6('0x3f')]);var _0x5d17de={'where':_0x2067a0['where']};return db[_0xffb6('0x2b')][_0xffb6('0x1e')](_0x5d17de)[_0xffb6('0x25')](function(_0x5df4ec){_0x3746f5[_0xffb6('0x1e')]=_0x5df4ec;if(_0x2a5728['query']['includeAll']){_0x2067a0[_0xffb6('0x40')]=[{'all':!![]}];}return db[_0xffb6('0x2b')][_0xffb6('0x41')](_0x2067a0);})[_0xffb6('0x25')](function(_0xe88f2c){_0x3746f5[_0xffb6('0x42')]=_0xe88f2c;return _0x3746f5;})[_0xffb6('0x25')](respondWithFilteredResult(_0x36a625,_0x2067a0))[_0xffb6('0x43')](handleError(_0x36a625,null));};exports[_0xffb6('0x44')]=function(_0x2e8de8,_0x119ac2){var _0x1a2226={'raw':!![],'where':{'id':_0x2e8de8[_0xffb6('0x45')]['id']}},_0x27ee5c={};_0x27ee5c[_0xffb6('0x2f')]=_[_0xffb6('0x46')](db[_0xffb6('0x2b')]['rawAttributes']);_0x27ee5c[_0xffb6('0x30')]=_['keys'](_0x2e8de8['query']);_0x27ee5c['filters']=_[_0xffb6('0x32')](_0x27ee5c[_0xffb6('0x2f')],_0x27ee5c['query']);_0x1a2226['attributes']=_[_0xffb6('0x32')](_0x27ee5c[_0xffb6('0x2f')],qs[_0xffb6('0x34')](_0x2e8de8[_0xffb6('0x30')][_0xffb6('0x34')]));_0x1a2226[_0xffb6('0x33')]=_0x1a2226['attributes']['length']?_0x1a2226[_0xffb6('0x33')]:_0x27ee5c[_0xffb6('0x2f')];if(_0x2e8de8[_0xffb6('0x30')][_0xffb6('0x47')]){_0x1a2226[_0xffb6('0x40')]=[{'all':!![]}];}_0x1a2226=_[_0xffb6('0x3e')]({},_0x1a2226,_0x2e8de8[_0xffb6('0x3f')]);return db[_0xffb6('0x2b')]['find'](_0x1a2226)[_0xffb6('0x25')](handleEntityNotFound(_0x119ac2,null))[_0xffb6('0x25')](respondWithResult(_0x119ac2,null))['catch'](handleError(_0x119ac2,null));};exports['create']=function(_0x4c034c,_0x39b0a8){return db[_0xffb6('0x2b')][_0xffb6('0x48')](_0x4c034c[_0xffb6('0x49')],{})[_0xffb6('0x25')](respondWithResult(_0x39b0a8,0xc9))[_0xffb6('0x43')](handleError(_0x39b0a8,null));};exports[_0xffb6('0x23')]=function(_0x3734da,_0x1b6ae8){if(_0x3734da[_0xffb6('0x49')]['id']){delete _0x3734da['body']['id'];}return db[_0xffb6('0x2b')][_0xffb6('0x4a')]({'where':{'id':_0x3734da[_0xffb6('0x45')]['id']}})[_0xffb6('0x25')](handleEntityNotFound(_0x1b6ae8,null))[_0xffb6('0x25')](saveUpdates(_0x3734da[_0xffb6('0x49')],null))[_0xffb6('0x25')](respondWithResult(_0x1b6ae8,null))[_0xffb6('0x43')](handleError(_0x1b6ae8,null));};exports[_0xffb6('0x24')]=function(_0x11d50c,_0x1afdb6){return db[_0xffb6('0x2b')][_0xffb6('0x4a')]({'where':{'id':_0x11d50c['params']['id']}})[_0xffb6('0x25')](handleEntityNotFound(_0x1afdb6,null))['then'](removeEntity(_0x1afdb6,null))[_0xffb6('0x43')](handleError(_0x1afdb6,null));};exports[_0xffb6('0x4b')]=function(_0x16f443,_0x21fd98){return db[_0xffb6('0x2b')][_0xffb6('0x4b')]()[_0xffb6('0x25')](respondWithResult(_0x21fd98,null))[_0xffb6('0x43')](handleError(_0x21fd98,null));};exports['getQuestions']=function(_0x4627e7,_0x466763,_0xa3e591){var _0x384aea={'raw':!![],'where':{}};var _0x3a650c={};var _0xf19ec1={'count':0x0,'rows':[]};return db[_0xffb6('0x2b')][_0xffb6('0x4c')]({'where':{'id':_0x4627e7['params']['id']}})[_0xffb6('0x25')](handleEntityNotFound(_0x466763,null))[_0xffb6('0x25')](function(_0xb3521a){if(_0xb3521a){_0x3a650c[_0xffb6('0x2f')]=_[_0xffb6('0x46')](db['JscriptyQuestionReport']['rawAttributes']);_0x3a650c[_0xffb6('0x30')]=_[_0xffb6('0x46')](_0x4627e7[_0xffb6('0x30')]);_0x3a650c[_0xffb6('0x31')]=_[_0xffb6('0x32')](_0x3a650c[_0xffb6('0x2f')],_0x3a650c[_0xffb6('0x30')]);_0x384aea[_0xffb6('0x33')]=_[_0xffb6('0x32')](_0x3a650c['model'],qs[_0xffb6('0x34')](_0x4627e7['query'][_0xffb6('0x34')]));_0x384aea[_0xffb6('0x33')]=_0x384aea['attributes'][_0xffb6('0x35')]?_0x384aea[_0xffb6('0x33')]:_0x3a650c[_0xffb6('0x2f')];if(!_0x4627e7[_0xffb6('0x30')][_0xffb6('0x36')](_0xffb6('0x37'))){_0x384aea['limit']=qs[_0xffb6('0x1d')](_0x4627e7['query'][_0xffb6('0x1d')]);_0x384aea[_0xffb6('0x1f')]=qs[_0xffb6('0x1f')](_0x4627e7[_0xffb6('0x30')][_0xffb6('0x1f')]);}_0x384aea['order']=qs[_0xffb6('0x39')](_0x4627e7[_0xffb6('0x30')]['sort']);_0x384aea[_0xffb6('0x3a')]=qs[_0xffb6('0x31')](_[_0xffb6('0x4d')](_0x4627e7['query'],_0x3a650c['filters']));_0x384aea[_0xffb6('0x3a')]['SessionId']=_0xb3521a['id'];if(_0x4627e7[_0xffb6('0x30')][_0xffb6('0x3b')]){_0x384aea['where']=_[_0xffb6('0x3e')](_0x384aea[_0xffb6('0x3a')],{'$or':_[_0xffb6('0x2a')](_0x384aea[_0xffb6('0x33')],function(_0x3c9da2){var _0x10e614={};_0x10e614[_0x3c9da2]={'$like':'%'+_0x4627e7[_0xffb6('0x30')][_0xffb6('0x3b')]+'%'};return _0x10e614;})});}_0x384aea=_[_0xffb6('0x3e')]({},_0x384aea,_0x4627e7[_0xffb6('0x3f')]);return db['JscriptyQuestionReport'][_0xffb6('0x1e')]({'where':_0x384aea[_0xffb6('0x3a')]})[_0xffb6('0x25')](function(_0x51751d){_0xf19ec1[_0xffb6('0x1e')]=_0x51751d;if(_0x4627e7[_0xffb6('0x30')]['includeAll']){_0x384aea['include']=[{'all':!![]}];}return db[_0xffb6('0x4e')][_0xffb6('0x41')](_0x384aea);})[_0xffb6('0x25')](function(_0x4997cb){_0xf19ec1[_0xffb6('0x42')]=_0x4997cb;return _0xf19ec1;});}})[_0xffb6('0x25')](respondWithFilteredResult(_0x466763,_0x384aea))['catch'](handleError(_0x466763,null));}; \ No newline at end of file +var _0x1518=['request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','JscriptySessionReport','findAll','rows','catch','params','keys','rawAttributes','length','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','pick','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4f126d,_0xbe90c){var _0x3ff779=function(_0x4aa013){while(--_0x4aa013){_0x4f126d['push'](_0x4f126d['shift']());}};_0x3ff779(++_0xbe90c);}(_0x1518,0x9c));var _0x8151=function(_0x3abfe0,_0x106ccd){_0x3abfe0=_0x3abfe0-0x0;var _0x506c64=_0x1518[_0x3abfe0];return _0x506c64;};'use strict';var emlformat=require(_0x8151('0x0'));var rimraf=require(_0x8151('0x1'));var zipdir=require(_0x8151('0x2'));var jsonpatch=require(_0x8151('0x3'));var rp=require(_0x8151('0x4'));var moment=require(_0x8151('0x5'));var BPromise=require(_0x8151('0x6'));var Mustache=require('mustache');var util=require(_0x8151('0x7'));var path=require(_0x8151('0x8'));var sox=require(_0x8151('0x9'));var csv=require(_0x8151('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8151('0xb'));var squel=require(_0x8151('0xc'));var crypto=require(_0x8151('0xd'));var jsforce=require(_0x8151('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8151('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8151('0xf'));var qs=require(_0x8151('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8151('0x11'));var logger=require(_0x8151('0x12'))('api');var utils=require(_0x8151('0x13'));var config=require(_0x8151('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8151('0x15'))['db'];function respondWithStatusCode(_0x2cecca,_0xfbd68f){_0xfbd68f=_0xfbd68f||0xcc;return function(_0x3237c9){if(_0x3237c9){return _0x2cecca[_0x8151('0x16')](_0xfbd68f);}return _0x2cecca[_0x8151('0x17')](_0xfbd68f)[_0x8151('0x18')]();};}function respondWithResult(_0x8da750,_0x148716){_0x148716=_0x148716||0xc8;return function(_0x3f43c6){if(_0x3f43c6){return _0x8da750[_0x8151('0x17')](_0x148716)[_0x8151('0x19')](_0x3f43c6);}};}function respondWithFilteredResult(_0x7d21ce,_0x39f74f){return function(_0x1c325c){if(_0x1c325c){var _0x393289=typeof _0x39f74f[_0x8151('0x1a')]===_0x8151('0x1b')&&typeof _0x39f74f[_0x8151('0x1c')]===_0x8151('0x1b');var _0x372c2d=_0x1c325c[_0x8151('0x1d')];var _0x7cfa1f=_0x393289?0x0:_0x39f74f[_0x8151('0x1a')];var _0x547ab9=_0x393289?_0x1c325c[_0x8151('0x1d')]:_0x39f74f[_0x8151('0x1a')]+_0x39f74f[_0x8151('0x1c')];var _0x4ccd71;if(_0x547ab9>=_0x372c2d){_0x547ab9=_0x372c2d;_0x4ccd71=0xc8;}else{_0x4ccd71=0xce;}_0x7d21ce[_0x8151('0x17')](_0x4ccd71);return _0x7d21ce[_0x8151('0x1e')](_0x8151('0x1f'),_0x7cfa1f+'-'+_0x547ab9+'/'+_0x372c2d)[_0x8151('0x19')](_0x1c325c);}return null;};}function patchUpdates(_0x124aaa){return function(_0x583d59){try{jsonpatch[_0x8151('0x20')](_0x583d59,_0x124aaa,!![]);}catch(_0x2a2ff0){return BPromise[_0x8151('0x21')](_0x2a2ff0);}return _0x583d59[_0x8151('0x22')]();};}function saveUpdates(_0x459d34,_0x28074f){return function(_0xd50770){if(_0xd50770){return _0xd50770[_0x8151('0x23')](_0x459d34)[_0x8151('0x24')](function(_0x3edfd6){return _0x3edfd6;});}return null;};}function removeEntity(_0x45643c,_0x424ec8){return function(_0x3e4b02){if(_0x3e4b02){return _0x3e4b02[_0x8151('0x25')]()[_0x8151('0x24')](function(){_0x45643c[_0x8151('0x17')](0xcc)[_0x8151('0x18')]();});}};}function handleEntityNotFound(_0x39fb67,_0x438326){return function(_0x228331){if(!_0x228331){_0x39fb67[_0x8151('0x16')](0x194);}return _0x228331;};}function handleError(_0x103367,_0x5a233e){_0x5a233e=_0x5a233e||0x1f4;return function(_0x4ab25c){logger[_0x8151('0x26')](_0x4ab25c[_0x8151('0x27')]);if(_0x4ab25c[_0x8151('0x28')]){delete _0x4ab25c[_0x8151('0x28')];}_0x103367[_0x8151('0x17')](_0x5a233e)[_0x8151('0x29')](_0x4ab25c);};}exports[_0x8151('0x2a')]=function(_0x5cd04d,_0x2ab79e){var _0x27d507={},_0x3c2074={},_0x494898={'count':0x0,'rows':[]};var _0x59f168=_[_0x8151('0x2b')](db['JscriptySessionReport']['rawAttributes'],function(_0x14f88f){return{'name':_0x14f88f[_0x8151('0x2c')],'type':_0x14f88f[_0x8151('0x2d')][_0x8151('0x2e')]};});_0x3c2074[_0x8151('0x2f')]=_[_0x8151('0x2b')](_0x59f168,_0x8151('0x28'));_0x3c2074[_0x8151('0x30')]=_['keys'](_0x5cd04d[_0x8151('0x30')]);_0x3c2074[_0x8151('0x31')]=_[_0x8151('0x32')](_0x3c2074[_0x8151('0x2f')],_0x3c2074[_0x8151('0x30')]);_0x27d507[_0x8151('0x33')]=_['intersection'](_0x3c2074[_0x8151('0x2f')],qs[_0x8151('0x34')](_0x5cd04d['query'][_0x8151('0x34')]));_0x27d507[_0x8151('0x33')]=_0x27d507[_0x8151('0x33')]['length']?_0x27d507[_0x8151('0x33')]:_0x3c2074[_0x8151('0x2f')];if(!_0x5cd04d[_0x8151('0x30')][_0x8151('0x35')](_0x8151('0x36'))){_0x27d507[_0x8151('0x1c')]=qs[_0x8151('0x1c')](_0x5cd04d[_0x8151('0x30')][_0x8151('0x1c')]);_0x27d507[_0x8151('0x1a')]=qs[_0x8151('0x1a')](_0x5cd04d[_0x8151('0x30')][_0x8151('0x1a')]);}_0x27d507[_0x8151('0x37')]=qs[_0x8151('0x38')](_0x5cd04d[_0x8151('0x30')]['sort']);_0x27d507['where']=qs[_0x8151('0x31')](_['pick'](_0x5cd04d['query'],_0x3c2074[_0x8151('0x31')]),_0x59f168);if(_0x5cd04d['query'][_0x8151('0x39')]){_0x27d507[_0x8151('0x3a')]=_[_0x8151('0x3b')](_0x27d507['where'],{'$or':_[_0x8151('0x2b')](_0x59f168,function(_0x16be15){if(_0x16be15[_0x8151('0x2d')]!==_0x8151('0x3c')){var _0x8e1bb5={};_0x8e1bb5[_0x16be15['name']]={'$like':'%'+_0x5cd04d[_0x8151('0x30')][_0x8151('0x39')]+'%'};return _0x8e1bb5;}})});}_0x27d507=_[_0x8151('0x3b')]({},_0x27d507,_0x5cd04d['options']);var _0x1e3874={'where':_0x27d507['where']};return db['JscriptySessionReport'][_0x8151('0x1d')](_0x1e3874)[_0x8151('0x24')](function(_0x1cb604){_0x494898[_0x8151('0x1d')]=_0x1cb604;if(_0x5cd04d['query'][_0x8151('0x3d')]){_0x27d507[_0x8151('0x3e')]=[{'all':!![]}];}return db[_0x8151('0x3f')][_0x8151('0x40')](_0x27d507);})[_0x8151('0x24')](function(_0xdf96eb){_0x494898[_0x8151('0x41')]=_0xdf96eb;return _0x494898;})[_0x8151('0x24')](respondWithFilteredResult(_0x2ab79e,_0x27d507))[_0x8151('0x42')](handleError(_0x2ab79e,null));};exports['show']=function(_0x3a5513,_0x328a8b){var _0x55b09b={'raw':!![],'where':{'id':_0x3a5513[_0x8151('0x43')]['id']}},_0x24c023={};_0x24c023['model']=_[_0x8151('0x44')](db['JscriptySessionReport'][_0x8151('0x45')]);_0x24c023[_0x8151('0x30')]=_[_0x8151('0x44')](_0x3a5513['query']);_0x24c023[_0x8151('0x31')]=_[_0x8151('0x32')](_0x24c023[_0x8151('0x2f')],_0x24c023[_0x8151('0x30')]);_0x55b09b[_0x8151('0x33')]=_['intersection'](_0x24c023[_0x8151('0x2f')],qs[_0x8151('0x34')](_0x3a5513['query'][_0x8151('0x34')]));_0x55b09b[_0x8151('0x33')]=_0x55b09b[_0x8151('0x33')][_0x8151('0x46')]?_0x55b09b['attributes']:_0x24c023[_0x8151('0x2f')];if(_0x3a5513[_0x8151('0x30')][_0x8151('0x3d')]){_0x55b09b['include']=[{'all':!![]}];}_0x55b09b=_[_0x8151('0x3b')]({},_0x55b09b,_0x3a5513[_0x8151('0x47')]);return db[_0x8151('0x3f')][_0x8151('0x48')](_0x55b09b)[_0x8151('0x24')](handleEntityNotFound(_0x328a8b,null))[_0x8151('0x24')](respondWithResult(_0x328a8b,null))[_0x8151('0x42')](handleError(_0x328a8b,null));};exports[_0x8151('0x49')]=function(_0x4929da,_0x4da757){return db[_0x8151('0x3f')][_0x8151('0x49')](_0x4929da[_0x8151('0x4a')],{})[_0x8151('0x24')](respondWithResult(_0x4da757,0xc9))['catch'](handleError(_0x4da757,null));};exports[_0x8151('0x23')]=function(_0x30d0ce,_0x87ed9b){if(_0x30d0ce[_0x8151('0x4a')]['id']){delete _0x30d0ce['body']['id'];}return db[_0x8151('0x3f')][_0x8151('0x48')]({'where':{'id':_0x30d0ce[_0x8151('0x43')]['id']}})[_0x8151('0x24')](handleEntityNotFound(_0x87ed9b,null))[_0x8151('0x24')](saveUpdates(_0x30d0ce[_0x8151('0x4a')],null))['then'](respondWithResult(_0x87ed9b,null))[_0x8151('0x42')](handleError(_0x87ed9b,null));};exports[_0x8151('0x25')]=function(_0x29a3b1,_0x5e4389){return db[_0x8151('0x3f')][_0x8151('0x48')]({'where':{'id':_0x29a3b1['params']['id']}})[_0x8151('0x24')](handleEntityNotFound(_0x5e4389,null))[_0x8151('0x24')](removeEntity(_0x5e4389,null))[_0x8151('0x42')](handleError(_0x5e4389,null));};exports['describe']=function(_0x290ef4,_0x610553){return db[_0x8151('0x3f')][_0x8151('0x4b')]()[_0x8151('0x24')](respondWithResult(_0x610553,null))['catch'](handleError(_0x610553,null));};exports[_0x8151('0x4c')]=function(_0x318f25,_0x29ef15,_0x1e0208){var _0x303e99={'raw':!![],'where':{}};var _0x4ea0a5={};var _0x20af14={'count':0x0,'rows':[]};return db[_0x8151('0x3f')][_0x8151('0x4d')]({'where':{'id':_0x318f25[_0x8151('0x43')]['id']}})[_0x8151('0x24')](handleEntityNotFound(_0x29ef15,null))[_0x8151('0x24')](function(_0x33acbf){if(_0x33acbf){_0x4ea0a5[_0x8151('0x2f')]=_[_0x8151('0x44')](db[_0x8151('0x4e')][_0x8151('0x45')]);_0x4ea0a5[_0x8151('0x30')]=_[_0x8151('0x44')](_0x318f25[_0x8151('0x30')]);_0x4ea0a5[_0x8151('0x31')]=_[_0x8151('0x32')](_0x4ea0a5[_0x8151('0x2f')],_0x4ea0a5[_0x8151('0x30')]);_0x303e99[_0x8151('0x33')]=_[_0x8151('0x32')](_0x4ea0a5[_0x8151('0x2f')],qs[_0x8151('0x34')](_0x318f25[_0x8151('0x30')][_0x8151('0x34')]));_0x303e99['attributes']=_0x303e99[_0x8151('0x33')][_0x8151('0x46')]?_0x303e99[_0x8151('0x33')]:_0x4ea0a5['model'];if(!_0x318f25['query'][_0x8151('0x35')](_0x8151('0x36'))){_0x303e99[_0x8151('0x1c')]=qs[_0x8151('0x1c')](_0x318f25[_0x8151('0x30')][_0x8151('0x1c')]);_0x303e99[_0x8151('0x1a')]=qs[_0x8151('0x1a')](_0x318f25[_0x8151('0x30')]['offset']);}_0x303e99[_0x8151('0x37')]=qs[_0x8151('0x38')](_0x318f25[_0x8151('0x30')][_0x8151('0x38')]);_0x303e99[_0x8151('0x3a')]=qs[_0x8151('0x31')](_[_0x8151('0x4f')](_0x318f25[_0x8151('0x30')],_0x4ea0a5[_0x8151('0x31')]));_0x303e99['where']['SessionId']=_0x33acbf['id'];if(_0x318f25['query'][_0x8151('0x39')]){_0x303e99[_0x8151('0x3a')]=_[_0x8151('0x3b')](_0x303e99[_0x8151('0x3a')],{'$or':_[_0x8151('0x2b')](_0x303e99['attributes'],function(_0x493607){var _0xe150b4={};_0xe150b4[_0x493607]={'$like':'%'+_0x318f25[_0x8151('0x30')][_0x8151('0x39')]+'%'};return _0xe150b4;})});}_0x303e99=_['merge']({},_0x303e99,_0x318f25[_0x8151('0x47')]);return db[_0x8151('0x4e')][_0x8151('0x1d')]({'where':_0x303e99[_0x8151('0x3a')]})[_0x8151('0x24')](function(_0xa1e930){_0x20af14[_0x8151('0x1d')]=_0xa1e930;if(_0x318f25['query'][_0x8151('0x3d')]){_0x303e99[_0x8151('0x3e')]=[{'all':!![]}];}return db[_0x8151('0x4e')][_0x8151('0x40')](_0x303e99);})['then'](function(_0x1ffc95){_0x20af14[_0x8151('0x41')]=_0x1ffc95;return _0x20af14;});}})[_0x8151('0x24')](respondWithFilteredResult(_0x29ef15,_0x303e99))[_0x8151('0x42')](handleError(_0x29ef15,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a0f4b06..4785c26 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 _0x6455=['request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4961b5,_0xd364b2){var _0x49b02a=function(_0x1c138b){while(--_0x1c138b){_0x4961b5['push'](_0x4961b5['shift']());}};_0x49b02a(++_0xd364b2);}(_0x6455,0x97));var _0x5645=function(_0x39e50d,_0x498000){_0x39e50d=_0x39e50d-0x0;var _0x5b39fc=_0x6455[_0x39e50d];return _0x5b39fc;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x885a,0x180));var _0xa885=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x885a[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('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 c80d127..de1b649 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 _0x77d4=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x77d4,0x108));var _0x477d=function(_0x162f05,_0x328e0f){_0x162f05=_0x162f05-0x0;var _0x54f59a=_0x77d4[_0x162f05];return _0x54f59a;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});} \ No newline at end of file +var _0xe2fe=['then','info','JscriptySessionReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x408c0a,_0xf47daa){var _0x4f45a5=function(_0x124a06){while(--_0x124a06){_0x408c0a['push'](_0x408c0a['shift']());}};_0x4f45a5(++_0xf47daa);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1b3417f..11828be 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 _0xa91a=['/download_log_file','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','update'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa91a,0x102));var _0xaa91=function(_0x5954b0,_0xe83fb2){_0x5954b0=_0x5954b0-0x0;var _0x133d90=_0xa91a[_0x5954b0];return _0x133d90;};'use strict';var multer=require(_0xaa91('0x0'));var util=require(_0xaa91('0x1'));var path=require(_0xaa91('0x2'));var timeout=require(_0xaa91('0x3'));var express=require(_0xaa91('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaa91('0x5'));var interaction=require(_0xaa91('0x6'));var config=require(_0xaa91('0x7'));var controller=require(_0xaa91('0x8'));router[_0xaa91('0x9')]('/',controller[_0xaa91('0xa')]);router[_0xaa91('0xb')](_0xaa91('0xc'),auth['isAuthenticated'](),controller[_0xaa91('0xd')]);router['get'](_0xaa91('0xe'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xaa91('0xf')]=router; \ No newline at end of file +var _0xabe2=['../../components/auth/service','../../components/interaction/service','index','put','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabe2,0x1c5));var _0x2abe=function(_0x14b9cd,_0x299437){_0x14b9cd=_0x14b9cd-0x0;var _0x144568=_0xabe2[_0x14b9cd];return _0x144568;};'use strict';var multer=require(_0x2abe('0x0'));var util=require(_0x2abe('0x1'));var path=require(_0x2abe('0x2'));var timeout=require(_0x2abe('0x3'));var express=require(_0x2abe('0x4'));var router=express[_0x2abe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2abe('0x6'));var interaction=require(_0x2abe('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x2abe('0x8')]);router[_0x2abe('0x9')](_0x2abe('0xa'),auth[_0x2abe('0xb')](),controller[_0x2abe('0xc')]);router[_0x2abe('0xd')](_0x2abe('0xe'),auth[_0x2abe('0xb')](),controller[_0x2abe('0xf')]);module[_0x2abe('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index dbe5c64..1ff1482 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 _0x4db9=['TEXT','STRING','INTEGER','exports'];(function(_0x3fdf48,_0x8bf3cd){var _0x5c7dfc=function(_0x6efb6f){while(--_0x6efb6f){_0x3fdf48['push'](_0x3fdf48['shift']());}};_0x5c7dfc(++_0x8bf3cd);}(_0x4db9,0x18b));var _0x94db=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4db9[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module[_0x94db('0x0')]={'license':{'type':Sequelize[_0x94db('0x1')]},'data1':{'type':Sequelize[_0x94db('0x2')]},'data2':{'type':Sequelize[_0x94db('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x94db('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8181=['STRING','INTEGER','sequelize','exports'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0x8181,0xd6));var _0x1818=function(_0x2465ee,_0x4a208e){_0x2465ee=_0x2465ee-0x0;var _0x593142=_0x8181[_0x2465ee];return _0x593142;};'use strict';var Sequelize=require(_0x1818('0x0'));module[_0x1818('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x1818('0x2')]},'data2':{'type':Sequelize[_0x1818('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1818('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index f8ab431..4042f97 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 _0xa534=['find','get','checkLicense','downloadLogFile','license-info.log','join','log','xcally','Content-Type','text/plain','download','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','json','apply','reject','save','update','then','error','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','getLicense','body'];(function(_0x54c9c6,_0x33303e){var _0x3cc860=function(_0x57d564){while(--_0x57d564){_0x54c9c6['push'](_0x54c9c6['shift']());}};_0x3cc860(++_0x33303e);}(_0xa534,0x1e0));var _0x4a53=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xa534[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x4a53('0x0'));var rimraf=require(_0x4a53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4a53('0x2'));var moment=require(_0x4a53('0x3'));var BPromise=require(_0x4a53('0x4'));var Mustache=require(_0x4a53('0x5'));var util=require(_0x4a53('0x6'));var path=require(_0x4a53('0x7'));var sox=require(_0x4a53('0x8'));var csv=require(_0x4a53('0x9'));var ejs=require(_0x4a53('0xa'));var fs=require('fs');var fs_extra=require(_0x4a53('0xb'));var _=require(_0x4a53('0xc'));var squel=require(_0x4a53('0xd'));var crypto=require(_0x4a53('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4a53('0xf'));var toCsv=require(_0x4a53('0x9'));var querystring=require(_0x4a53('0x10'));var Papa=require(_0x4a53('0x11'));var Redis=require(_0x4a53('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a53('0x13'));var logger=require(_0x4a53('0x14'))(_0x4a53('0x15'));var utils=require(_0x4a53('0x16'));var config=require(_0x4a53('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a53('0x18'))['db'];function respondWithStatusCode(_0x4a9f5f,_0x19c5fb){_0x19c5fb=_0x19c5fb||0xcc;return function(_0x209771){if(_0x209771){return _0x4a9f5f[_0x4a53('0x19')](_0x19c5fb);}return _0x4a9f5f['status'](_0x19c5fb)[_0x4a53('0x1a')]();};}function respondWithResult(_0x53aff1,_0x354525){_0x354525=_0x354525||0xc8;return function(_0x2b4844){if(_0x2b4844){return _0x53aff1['status'](_0x354525)['json'](_0x2b4844);}};}function respondWithFilteredResult(_0x3d5d48,_0xc6720a){return function(_0x10b578){if(_0x10b578){var _0x32a287=typeof _0xc6720a['offset']===_0x4a53('0x1b')&&typeof _0xc6720a[_0x4a53('0x1c')]===_0x4a53('0x1b');var _0x3dfcdd=_0x10b578[_0x4a53('0x1d')];var _0x36eeb2=_0x32a287?0x0:_0xc6720a[_0x4a53('0x1e')];var _0x3da505=_0x32a287?_0x10b578[_0x4a53('0x1d')]:_0xc6720a[_0x4a53('0x1e')]+_0xc6720a[_0x4a53('0x1c')];var _0x2d56e6;if(_0x3da505>=_0x3dfcdd){_0x3da505=_0x3dfcdd;_0x2d56e6=0xc8;}else{_0x2d56e6=0xce;}_0x3d5d48[_0x4a53('0x1f')](_0x2d56e6);return _0x3d5d48[_0x4a53('0x20')]('Content-Range',_0x36eeb2+'-'+_0x3da505+'/'+_0x3dfcdd)[_0x4a53('0x21')](_0x10b578);}return null;};}function patchUpdates(_0x23a1df){return function(_0x2a2747){try{jsonpatch[_0x4a53('0x22')](_0x2a2747,_0x23a1df,!![]);}catch(_0x1373ac){return BPromise[_0x4a53('0x23')](_0x1373ac);}return _0x2a2747[_0x4a53('0x24')]();};}function saveUpdates(_0x34994e,_0x43a7bf){return function(_0x5dcca8){if(_0x5dcca8){return _0x5dcca8[_0x4a53('0x25')](_0x34994e)['then'](function(_0x3dd3aa){return _0x3dd3aa;});}return null;};}function removeEntity(_0x5e34f2,_0x1bd507){return function(_0x23d9de){if(_0x23d9de){return _0x23d9de['destroy']()[_0x4a53('0x26')](function(){_0x5e34f2[_0x4a53('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fdaa4,_0x5b1074){return function(_0x2eb042){if(!_0x2eb042){_0x1fdaa4['sendStatus'](0x194);}return _0x2eb042;};}function handleError(_0x1b3542,_0x1ad272){_0x1ad272=_0x1ad272||0x1f4;return function(_0x3e4d3c){logger[_0x4a53('0x27')](_0x3e4d3c['stack']);if(_0x3e4d3c['name']){delete _0x3e4d3c[_0x4a53('0x28')];}_0x1b3542[_0x4a53('0x1f')](_0x1ad272)[_0x4a53('0x29')](_0x3e4d3c);};}var utilLicense=require(_0x4a53('0x2a'));exports[_0x4a53('0x2b')]=function(_0x56dd22,_0xae51f8){var _0x3d9c16={'raw':!![],'where':{'id':0x1}},_0x4267e9={};_0x4267e9[_0x4a53('0x2c')]=_[_0x4a53('0x2d')](db[_0x4a53('0x2e')][_0x4a53('0x2f')]);_0x4267e9[_0x4a53('0x30')]=_[_0x4a53('0x2d')](_0x56dd22[_0x4a53('0x30')]);_0x4267e9[_0x4a53('0x31')]=_[_0x4a53('0x32')](_0x4267e9[_0x4a53('0x2c')],_0x4267e9[_0x4a53('0x30')]);_0x3d9c16[_0x4a53('0x33')]=_[_0x4a53('0x32')](_0x4267e9['model'],qs['fields'](_0x56dd22[_0x4a53('0x30')][_0x4a53('0x34')]));_0x3d9c16[_0x4a53('0x33')]=_0x3d9c16['attributes']['length']?_0x3d9c16['attributes']:_0x4267e9[_0x4a53('0x2c')];_0x3d9c16=_[_0x4a53('0x35')]({},_0x3d9c16,_0x56dd22['options']);return utilLicense[_0x4a53('0x36')](_0x3d9c16)[_0x4a53('0x26')](respondWithResult(_0xae51f8,null))['catch'](handleError(_0xae51f8,null));};exports[_0x4a53('0x25')]=function(_0x4f7d79,_0x506e8b){if(_0x4f7d79[_0x4a53('0x37')]['id']){delete _0x4f7d79['body']['id'];}return db[_0x4a53('0x2e')][_0x4a53('0x38')]({'where':{'id':_0x4f7d79['params']['id']}})[_0x4a53('0x26')](handleEntityNotFound(_0x506e8b,null))['then'](function(_0x316de0){var _0x14642c=_0x316de0[_0x4a53('0x39')]({'plain':!![]});return utilLicense[_0x4a53('0x3a')](_0x14642c,_0x4f7d79[_0x4a53('0x37')]['key']);})[_0x4a53('0x26')](function(_0x5c51a9){if(!_0x5c51a9['demo']){return saveUpdates(_0x4f7d79[_0x4a53('0x37')],null);}return _0x5c51a9;})['then'](respondWithResult(_0x506e8b,null))['catch'](handleError(_0x506e8b,null));};exports[_0x4a53('0x3b')]=function(_0x4e3fd2,_0x26433f){var _0x46937e=_0x4a53('0x3c');var _0x564911=path[_0x4a53('0x3d')]('/var',_0x4a53('0x3e'),_0x4a53('0x3f'),_0x46937e);_0x26433f['setHeader']('Content-disposition','attachment;\x20filename='+_0x46937e);_0x26433f[_0x4a53('0x20')](_0x4a53('0x40'),_0x4a53('0x41'));_0x26433f[_0x4a53('0x42')](_0x564911);}; \ No newline at end of file +var _0xd2e6=['offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','attributes','model','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x513ed4,_0x285b60){var _0x1a22a0=function(_0x24ff1e){while(--_0x24ff1e){_0x513ed4['push'](_0x513ed4['shift']());}};_0x1a22a0(++_0x285b60);}(_0xd2e6,0x19e));var _0x6d2e=function(_0x291c14,_0x21c94e){_0x291c14=_0x291c14-0x0;var _0x555d78=_0xd2e6[_0x291c14];return _0x555d78;};'use strict';var emlformat=require(_0x6d2e('0x0'));var rimraf=require(_0x6d2e('0x1'));var zipdir=require(_0x6d2e('0x2'));var jsonpatch=require(_0x6d2e('0x3'));var rp=require(_0x6d2e('0x4'));var moment=require('moment');var BPromise=require(_0x6d2e('0x5'));var Mustache=require(_0x6d2e('0x6'));var util=require(_0x6d2e('0x7'));var path=require(_0x6d2e('0x8'));var sox=require('sox');var csv=require(_0x6d2e('0x9'));var ejs=require(_0x6d2e('0xa'));var fs=require('fs');var fs_extra=require(_0x6d2e('0xb'));var _=require(_0x6d2e('0xc'));var squel=require(_0x6d2e('0xd'));var crypto=require(_0x6d2e('0xe'));var jsforce=require(_0x6d2e('0xf'));var deskjs=require(_0x6d2e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6d2e('0x11'));var Papa=require(_0x6d2e('0x12'));var Redis=require('ioredis');var authService=require(_0x6d2e('0x13'));var qs=require(_0x6d2e('0x14'));var as=require(_0x6d2e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d2e('0x16'))(_0x6d2e('0x17'));var utils=require(_0x6d2e('0x18'));var config=require(_0x6d2e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d2e('0x1a'))['db'];function respondWithStatusCode(_0x5433bc,_0xece764){_0xece764=_0xece764||0xcc;return function(_0x2c95e3){if(_0x2c95e3){return _0x5433bc[_0x6d2e('0x1b')](_0xece764);}return _0x5433bc[_0x6d2e('0x1c')](_0xece764)[_0x6d2e('0x1d')]();};}function respondWithResult(_0x172534,_0x2b399c){_0x2b399c=_0x2b399c||0xc8;return function(_0x32fa51){if(_0x32fa51){return _0x172534['status'](_0x2b399c)['json'](_0x32fa51);}};}function respondWithFilteredResult(_0x3e4492,_0x3dda94){return function(_0x38dfc9){if(_0x38dfc9){var _0x4bebc2=typeof _0x3dda94[_0x6d2e('0x1e')]===_0x6d2e('0x1f')&&typeof _0x3dda94[_0x6d2e('0x20')]==='undefined';var _0x1fbe4e=_0x38dfc9[_0x6d2e('0x21')];var _0x56b79e=_0x4bebc2?0x0:_0x3dda94[_0x6d2e('0x1e')];var _0x1f6c65=_0x4bebc2?_0x38dfc9['count']:_0x3dda94[_0x6d2e('0x1e')]+_0x3dda94[_0x6d2e('0x20')];var _0x35192e;if(_0x1f6c65>=_0x1fbe4e){_0x1f6c65=_0x1fbe4e;_0x35192e=0xc8;}else{_0x35192e=0xce;}_0x3e4492[_0x6d2e('0x1c')](_0x35192e);return _0x3e4492[_0x6d2e('0x22')](_0x6d2e('0x23'),_0x56b79e+'-'+_0x1f6c65+'/'+_0x1fbe4e)[_0x6d2e('0x24')](_0x38dfc9);}return null;};}function patchUpdates(_0x4ff0ec){return function(_0x5dc8ab){try{jsonpatch[_0x6d2e('0x25')](_0x5dc8ab,_0x4ff0ec,!![]);}catch(_0x4bd0f6){return BPromise['reject'](_0x4bd0f6);}return _0x5dc8ab['save']();};}function saveUpdates(_0x4dceea,_0x2a7784){return function(_0x5625a4){if(_0x5625a4){return _0x5625a4[_0x6d2e('0x26')](_0x4dceea)[_0x6d2e('0x27')](function(_0x2843c8){return _0x2843c8;});}return null;};}function removeEntity(_0x4ee93b,_0x4ada2d){return function(_0x3c5357){if(_0x3c5357){return _0x3c5357[_0x6d2e('0x28')]()['then'](function(){_0x4ee93b[_0x6d2e('0x1c')](0xcc)[_0x6d2e('0x1d')]();});}};}function handleEntityNotFound(_0x14087d,_0x540046){return function(_0x58103b){if(!_0x58103b){_0x14087d[_0x6d2e('0x1b')](0x194);}return _0x58103b;};}function handleError(_0x2437c8,_0x2d6822){_0x2d6822=_0x2d6822||0x1f4;return function(_0x431be7){logger[_0x6d2e('0x29')](_0x431be7[_0x6d2e('0x2a')]);if(_0x431be7[_0x6d2e('0x2b')]){delete _0x431be7[_0x6d2e('0x2b')];}_0x2437c8[_0x6d2e('0x1c')](_0x2d6822)[_0x6d2e('0x2c')](_0x431be7);};}var utilLicense=require(_0x6d2e('0x2d'));exports[_0x6d2e('0x2e')]=function(_0x38600e,_0x452f3e){var _0x250f23={'raw':!![],'where':{'id':0x1}},_0x3242c7={};_0x3242c7['model']=_[_0x6d2e('0x2f')](db[_0x6d2e('0x30')][_0x6d2e('0x31')]);_0x3242c7[_0x6d2e('0x32')]=_[_0x6d2e('0x2f')](_0x38600e['query']);_0x3242c7[_0x6d2e('0x33')]=_[_0x6d2e('0x34')](_0x3242c7['model'],_0x3242c7[_0x6d2e('0x32')]);_0x250f23[_0x6d2e('0x35')]=_['intersection'](_0x3242c7[_0x6d2e('0x36')],qs[_0x6d2e('0x37')](_0x38600e['query'][_0x6d2e('0x37')]));_0x250f23[_0x6d2e('0x35')]=_0x250f23[_0x6d2e('0x35')][_0x6d2e('0x38')]?_0x250f23[_0x6d2e('0x35')]:_0x3242c7[_0x6d2e('0x36')];_0x250f23=_[_0x6d2e('0x39')]({},_0x250f23,_0x38600e[_0x6d2e('0x3a')]);return utilLicense[_0x6d2e('0x3b')](_0x250f23)['then'](respondWithResult(_0x452f3e,null))[_0x6d2e('0x3c')](handleError(_0x452f3e,null));};exports[_0x6d2e('0x26')]=function(_0x33523b,_0x41ce26){if(_0x33523b[_0x6d2e('0x3d')]['id']){delete _0x33523b[_0x6d2e('0x3d')]['id'];}return db[_0x6d2e('0x30')][_0x6d2e('0x3e')]({'where':{'id':_0x33523b['params']['id']}})['then'](handleEntityNotFound(_0x41ce26,null))[_0x6d2e('0x27')](function(_0x2d1e10){var _0x3850e8=_0x2d1e10[_0x6d2e('0x3f')]({'plain':!![]});return utilLicense[_0x6d2e('0x40')](_0x3850e8,_0x33523b[_0x6d2e('0x3d')][_0x6d2e('0x41')]);})[_0x6d2e('0x27')](function(_0x54a2bc){if(!_0x54a2bc[_0x6d2e('0x42')]){return saveUpdates(_0x33523b[_0x6d2e('0x3d')],null);}return _0x54a2bc;})[_0x6d2e('0x27')](respondWithResult(_0x41ce26,null))[_0x6d2e('0x3c')](handleError(_0x41ce26,null));};exports[_0x6d2e('0x43')]=function(_0x50b18f,_0x222603){var _0x2fb313=_0x6d2e('0x44');var _0x5554d5=path['join'](_0x6d2e('0x45'),'log',_0x6d2e('0x46'),_0x2fb313);_0x222603[_0x6d2e('0x47')](_0x6d2e('0x48'),_0x6d2e('0x49')+_0x2fb313);_0x222603[_0x6d2e('0x22')]('Content-Type','text/plain');_0x222603['download'](_0x5554d5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7cb0b35..047c09d 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 _0xedc0=['exports','license','lodash','../../config/logger','api','request-promise','path','../../config/environment','./license.attributes'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0xedc0,0xf5));var _0x0edc=function(_0x3926ba,_0x237901){_0x3926ba=_0x3926ba-0x0;var _0x18756e=_0xedc0[_0x3926ba];return _0x18756e;};'use strict';var _=require(_0x0edc('0x0'));var util=require('util');var logger=require(_0x0edc('0x1'))(_0x0edc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0edc('0x3'));var fs=require('fs');var path=require(_0x0edc('0x4'));var rimraf=require('rimraf');var config=require(_0x0edc('0x5'));var attributes=require(_0x0edc('0x6'));module[_0x0edc('0x7')]=function(_0x5c01cc,_0x3ff772){return _0x5c01cc['define']('License',attributes,{'tableName':_0x0edc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc83d=['exports','define','License','license','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc83d,0x163));var _0xdc83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc83d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xdc83('0x0'));var util=require('util');var logger=require(_0xdc83('0x1'))('api');var moment=require(_0xdc83('0x2'));var BPromise=require(_0xdc83('0x3'));var rp=require(_0xdc83('0x4'));var fs=require('fs');var path=require(_0xdc83('0x5'));var rimraf=require(_0xdc83('0x6'));var config=require(_0xdc83('0x7'));var attributes=require(_0xdc83('0x8'));module[_0xdc83('0x9')]=function(_0x19eda1,_0x47bc6a){return _0x19eda1[_0xdc83('0xa')](_0xdc83('0xb'),attributes,{'tableName':_0xdc83('0xc'),'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 90b0599..9b2a7de 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 _0x5764=['request\x20sent','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','License,\x20%s,\x20%s','debug'];(function(_0x26eb46,_0x734327){var _0x5470a2=function(_0x5050ba){while(--_0x5050ba){_0x26eb46['push'](_0x26eb46['shift']());}};_0x5470a2(++_0x734327);}(_0x5764,0x1ba));var _0x4576=function(_0x12e443,_0x2ce2f7){_0x12e443=_0x12e443-0x0;var _0x30d150=_0x5764[_0x12e443];return _0x30d150;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4576('0x0'));var BPromise=require(_0x4576('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4576('0x2'));var db=require(_0x4576('0x3'))['db'];var utils=require(_0x4576('0x4'));var logger=require(_0x4576('0x5'))(_0x4576('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4576('0x7')][_0x4576('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b9922,_0x1324b8,_0x45671e){return new BPromise(function(_0x155737,_0x1b2a0a){return client[_0x4576('0x9')](_0x4b9922,_0x45671e)[_0x4576('0xa')](function(_0x1505f3){logger[_0x4576('0xb')](_0x4576('0xc'),_0x1324b8,'request\x20sent');logger[_0x4576('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x1324b8,_0x4576('0xe'),JSON['stringify'](_0x1505f3));if(_0x1505f3['error']){if(_0x1505f3[_0x4576('0xf')]['code']===0x1f4){logger['error'](_0x4576('0xc'),_0x1324b8,_0x1505f3[_0x4576('0xf')][_0x4576('0x10')]);return _0x1b2a0a(_0x1505f3[_0x4576('0xf')][_0x4576('0x10')]);}logger[_0x4576('0xf')](_0x4576('0xc'),_0x1324b8,_0x1505f3[_0x4576('0xf')][_0x4576('0x10')]);return _0x155737(_0x1505f3[_0x4576('0xf')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x1324b8,'request\x20sent');_0x155737(_0x1505f3[_0x4576('0x11')][_0x4576('0x10')]);}})[_0x4576('0x12')](function(_0x2cb704){logger[_0x4576('0xf')](_0x4576('0xc'),_0x1324b8,_0x2cb704);_0x1b2a0a(_0x2cb704);});});} \ No newline at end of file +var _0x037d=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x5085f1,_0x42e56f){var _0x3a5dea=function(_0x3f9324){while(--_0x3f9324){_0x5085f1['push'](_0x5085f1['shift']());}};_0x3a5dea(++_0x42e56f);}(_0x037d,0x1d2));var _0xd037=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x037d[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd037('0x0'));var BPromise=require(_0xd037('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd037('0x2'));var db=require(_0xd037('0x3'))['db'];var utils=require(_0xd037('0x4'));var logger=require(_0xd037('0x5'))(_0xd037('0x6'));var config=require(_0xd037('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd037('0x8')][_0xd037('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x741360,_0x4f5ecd,_0x2e820a){return new BPromise(function(_0x4d7abf,_0x575152){return client[_0xd037('0xa')](_0x741360,_0x2e820a)[_0xd037('0xb')](function(_0x53ad57){logger[_0xd037('0xc')](_0xd037('0xd'),_0x4f5ecd,_0xd037('0xe'));logger[_0xd037('0xf')](_0xd037('0x10'),_0x4f5ecd,_0xd037('0xe'),JSON[_0xd037('0x11')](_0x53ad57));if(_0x53ad57[_0xd037('0x12')]){if(_0x53ad57['error'][_0xd037('0x13')]===0x1f4){logger[_0xd037('0x12')]('License,\x20%s,\x20%s',_0x4f5ecd,_0x53ad57[_0xd037('0x12')]['message']);return _0x575152(_0x53ad57[_0xd037('0x12')][_0xd037('0x14')]);}logger[_0xd037('0x12')](_0xd037('0xd'),_0x4f5ecd,_0x53ad57['error'][_0xd037('0x14')]);return _0x4d7abf(_0x53ad57['error'][_0xd037('0x14')]);}else{logger[_0xd037('0xc')](_0xd037('0xd'),_0x4f5ecd,_0xd037('0xe'));_0x4d7abf(_0x53ad57[_0xd037('0x15')][_0xd037('0x14')]);}})[_0xd037('0x16')](function(_0x417460){logger[_0xd037('0x12')](_0xd037('0xd'),_0x4f5ecd,_0x417460);_0x575152(_0x417460);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f3041c0..2249db2 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 _0x6280=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','verifySmtp','/:id/users','addDisposition','post','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller'];(function(_0x22ee0f,_0x22e6d2){var _0x204696=function(_0x4cab38){while(--_0x4cab38){_0x22ee0f['push'](_0x22ee0f['shift']());}};_0x204696(++_0x22e6d2);}(_0x6280,0x160));var _0x0628=function(_0x513df3,_0x1bcaec){_0x513df3=_0x513df3-0x0;var _0xb0dd15=_0x6280[_0x513df3];return _0xb0dd15;};'use strict';var multer=require(_0x0628('0x0'));var util=require(_0x0628('0x1'));var path=require('path');var timeout=require(_0x0628('0x2'));var express=require(_0x0628('0x3'));var router=express[_0x0628('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0628('0x5'));var interaction=require(_0x0628('0x6'));var config=require('../../config/environment');var controller=require(_0x0628('0x7'));router[_0x0628('0x8')]('/',auth[_0x0628('0x9')](),controller[_0x0628('0xa')]);router['get'](_0x0628('0xb'),auth[_0x0628('0x9')](),controller[_0x0628('0xc')]);router[_0x0628('0x8')](_0x0628('0xd'),auth['isAuthenticated'](),controller[_0x0628('0xe')]);router[_0x0628('0x8')](_0x0628('0xf'),auth[_0x0628('0x9')](),controller[_0x0628('0x10')]);router[_0x0628('0x8')](_0x0628('0x11'),auth[_0x0628('0x9')](),controller['getAnswers']);router[_0x0628('0x8')]('/:id/in_servers',auth['isAuthenticated'](),controller['getImap']);router[_0x0628('0x8')](_0x0628('0x12'),auth[_0x0628('0x9')](),controller['getSmtp']);router[_0x0628('0x8')](_0x0628('0x13'),auth[_0x0628('0x9')](),controller[_0x0628('0x14')]);router[_0x0628('0x8')]('/:id/applications',auth[_0x0628('0x9')](),controller[_0x0628('0x15')]);router[_0x0628('0x8')](_0x0628('0x16'),auth['isAuthenticated'](),controller['getMessages']);router[_0x0628('0x8')]('/:id/verify',auth[_0x0628('0x9')](),controller[_0x0628('0x17')]);router['get'](_0x0628('0x18'),auth[_0x0628('0x9')](),controller['getAgents']);router['post'](_0x0628('0xf'),auth[_0x0628('0x9')](),controller[_0x0628('0x19')]);router[_0x0628('0x1a')]('/:id/canned_answers',auth[_0x0628('0x9')](),controller[_0x0628('0x1b')]);router['post']('/',auth[_0x0628('0x9')](),controller[_0x0628('0x1c')]);router[_0x0628('0x1a')](_0x0628('0x1d'),auth['isAuthenticated'](),controller[_0x0628('0x1e')]);router['post']('/:id/out_servers',auth[_0x0628('0x9')](),controller[_0x0628('0x1f')]);router[_0x0628('0x1a')](_0x0628('0x13'),auth[_0x0628('0x9')](),controller[_0x0628('0x20')]);router[_0x0628('0x1a')](_0x0628('0x21'),auth['isAuthenticated'](),controller[_0x0628('0x22')]);router[_0x0628('0x1a')](_0x0628('0x23'),auth[_0x0628('0x9')](),controller['send']);router[_0x0628('0x1a')](_0x0628('0x18'),auth[_0x0628('0x9')](),controller['addAgents']);router[_0x0628('0x24')](_0x0628('0xd'),auth['isAuthenticated'](),controller[_0x0628('0x25')]);router[_0x0628('0x26')](_0x0628('0xf'),auth[_0x0628('0x9')](),controller[_0x0628('0x27')]);router[_0x0628('0x26')](_0x0628('0x11'),auth[_0x0628('0x9')](),controller[_0x0628('0x28')]);router[_0x0628('0x26')](_0x0628('0x1d'),auth[_0x0628('0x9')](),controller[_0x0628('0x29')]);router['delete'](_0x0628('0x12'),auth[_0x0628('0x9')](),controller[_0x0628('0x2a')]);router['delete'](_0x0628('0xd'),auth['isAuthenticated'](),controller[_0x0628('0x2b')]);router['delete']('/:id/users',auth[_0x0628('0x9')](),controller['removeAgents']);module[_0x0628('0x2c')]=router; \ No newline at end of file +var _0x324a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getAnswers','/:id/in_servers','getSmtp','getInteractions','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','addAgents','put','delete','removeDispositions','removeImap','removeSmtp','exports','multer','connect-timeout'];(function(_0x3fefe6,_0x534545){var _0x4c67e9=function(_0x214ff7){while(--_0x214ff7){_0x3fefe6['push'](_0x3fefe6['shift']());}};_0x4c67e9(++_0x534545);}(_0x324a,0x7f));var _0xa324=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x324a[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xa324('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa324('0x1'));var express=require(_0xa324('0x2'));var router=express[_0xa324('0x3')]();var fs_extra=require(_0xa324('0x4'));var auth=require(_0xa324('0x5'));var interaction=require(_0xa324('0x6'));var config=require(_0xa324('0x7'));var controller=require(_0xa324('0x8'));router[_0xa324('0x9')]('/',auth[_0xa324('0xa')](),controller[_0xa324('0xb')]);router[_0xa324('0x9')](_0xa324('0xc'),auth[_0xa324('0xa')](),controller[_0xa324('0xd')]);router[_0xa324('0x9')](_0xa324('0xe'),auth[_0xa324('0xa')](),controller['show']);router['get'](_0xa324('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa324('0x9')]('/:id/canned_answers',auth[_0xa324('0xa')](),controller[_0xa324('0x10')]);router[_0xa324('0x9')](_0xa324('0x11'),auth[_0xa324('0xa')](),controller['getImap']);router['get']('/:id/out_servers',auth[_0xa324('0xa')](),controller[_0xa324('0x12')]);router[_0xa324('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xa324('0x13')]);router[_0xa324('0x9')]('/:id/applications',auth[_0xa324('0xa')](),controller[_0xa324('0x14')]);router[_0xa324('0x9')]('/:id/messages',auth[_0xa324('0xa')](),controller[_0xa324('0x15')]);router['get'](_0xa324('0x16'),auth[_0xa324('0xa')](),controller[_0xa324('0x17')]);router[_0xa324('0x9')](_0xa324('0x18'),auth[_0xa324('0xa')](),controller[_0xa324('0x19')]);router['post'](_0xa324('0xf'),auth['isAuthenticated'](),controller[_0xa324('0x1a')]);router[_0xa324('0x1b')](_0xa324('0x1c'),auth[_0xa324('0xa')](),controller[_0xa324('0x1d')]);router[_0xa324('0x1b')]('/',auth[_0xa324('0xa')](),controller[_0xa324('0x1e')]);router[_0xa324('0x1b')](_0xa324('0x11'),auth['isAuthenticated'](),controller['addImap']);router[_0xa324('0x1b')](_0xa324('0x1f'),auth[_0xa324('0xa')](),controller[_0xa324('0x20')]);router[_0xa324('0x1b')]('/:id/interactions',auth[_0xa324('0xa')](),controller[_0xa324('0x21')]);router[_0xa324('0x1b')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xa324('0x1b')](_0xa324('0x22'),auth[_0xa324('0xa')](),controller[_0xa324('0x23')]);router[_0xa324('0x1b')](_0xa324('0x18'),auth[_0xa324('0xa')](),controller[_0xa324('0x24')]);router[_0xa324('0x25')](_0xa324('0xe'),auth[_0xa324('0xa')](),controller['update']);router[_0xa324('0x26')](_0xa324('0xf'),auth[_0xa324('0xa')](),controller[_0xa324('0x27')]);router['delete'](_0xa324('0x1c'),auth[_0xa324('0xa')](),controller['removeAnswers']);router[_0xa324('0x26')](_0xa324('0x11'),auth['isAuthenticated'](),controller[_0xa324('0x28')]);router[_0xa324('0x26')](_0xa324('0x1f'),auth[_0xa324('0xa')](),controller[_0xa324('0x29')]);router[_0xa324('0x26')](_0xa324('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xa324('0x18'),auth[_0xa324('0xa')](),controller['removeAgents']);module[_0xa324('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3efe5f4..6a27e16 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 _0x2415=['mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','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'];(function(_0x54f45c,_0x3b427d){var _0x1100a7=function(_0x24de6d){while(--_0x24de6d){_0x54f45c['push'](_0x54f45c['shift']());}};_0x1100a7(++_0x3b427d);}(_0x2415,0x1aa));var _0x5241=function(_0x49db04,_0x3088cb){_0x49db04=_0x49db04-0x0;var _0x199531=_0x2415[_0x49db04];return _0x199531;};'use strict';var Sequelize=require(_0x5241('0x0'));module[_0x5241('0x1')]={'description':{'type':Sequelize[_0x5241('0x2')]},'name':{'type':Sequelize[_0x5241('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5241('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5241('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5241('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5241('0x4')},'fontSize':{'type':Sequelize[_0x5241('0x5')](0x2)[_0x5241('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5241('0x7')],'defaultValue':function(){return _0x5241('0x8');}},'notificationSound':{'type':Sequelize[_0x5241('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5241('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5241('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5241('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5241('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5241('0x5')],'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[_0x5241('0x3')],'defaultValue':![],'comment':_0x5241('0x9'),'set':function(_0x158d03){if(!_0x158d03)this[_0x5241('0xa')](_0x5241('0xb'),null);this['setDataValue'](_0x5241('0xc'),_0x158d03);}},'provider':{'type':Sequelize[_0x5241('0xd')]('gmail',_0x5241('0xe'),'yahoo',_0x5241('0xf')),'defaultValue':null,'get':function(){if(!this[_0x5241('0x10')](_0x5241('0x11')))return _0x5241('0x12');return this[_0x5241('0x10')](_0x5241('0x11'));},'set':function(_0x377f8e){if(_0x377f8e===_0x5241('0x12'))_0x377f8e=null;return this['setDataValue'](_0x5241('0x11'),_0x377f8e);}}}; \ No newline at end of file +var _0x4074=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3ca73e,_0x1e79dc){var _0x1667fd=function(_0x100046){while(--_0x100046){_0x3ca73e['push'](_0x3ca73e['shift']());}};_0x1667fd(++_0x1e79dc);}(_0x4074,0x1ae));var _0x4407=function(_0x5c7d58,_0x7a5299){_0x5c7d58=_0x5c7d58-0x0;var _0x2c36ba=_0x4074[_0x5c7d58];return _0x2c36ba;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'description':{'type':Sequelize[_0x4407('0x2')]},'name':{'type':Sequelize[_0x4407('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4407('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4407('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4407('0x2')],'allowNull':![],'defaultValue':_0x4407('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x4407('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4407('0x6')],'defaultValue':function(){return _0x4407('0x7');}},'notificationSound':{'type':Sequelize[_0x4407('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4407('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4407('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4407('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4407('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x4407('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xd1fe63){if(!_0xd1fe63)this['setDataValue'](_0x4407('0xa'),null);this[_0x4407('0xb')](_0x4407('0xc'),_0xd1fe63);}},'provider':{'type':Sequelize[_0x4407('0xd')](_0x4407('0xe'),_0x4407('0xf'),_0x4407('0x10'),_0x4407('0x11')),'defaultValue':null,'get':function(){if(!this[_0x4407('0x12')](_0x4407('0x13')))return'custom';return this[_0x4407('0x12')](_0x4407('0x13'));},'set':function(_0x308967){if(_0x308967==='custom')_0x308967=null;return this[_0x4407('0xb')](_0x4407('0x13'),_0x308967);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8560123..15de4bc 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 _0xe9db=['CannedAnswer','getAnswers','removeAnswers','email','active','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','json','getApplications','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','Contacts','updatedAt','CloudProvider','from','format','%s\x20<%s>','attachments','join','server/files/attachments','getSmtpOptions','SendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','juice','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','status','end','offset','limit','undefined','count','destroy','then','get','MailAccounts','UserProfileResource','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','MailAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','update','body','provider','custom','secure','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','order','removeDispositions','ids'];(function(_0x5294c9,_0x1fa863){var _0x16fb13=function(_0x536ca7){while(--_0x536ca7){_0x5294c9['push'](_0x5294c9['shift']());}};_0x16fb13(++_0x1fa863);}(_0xe9db,0x1b6));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xbe9d('0x0'));var BPromise=require('bluebird');var util=require(_0xbe9d('0x1'));var path=require(_0xbe9d('0x2'));var _=require('lodash');var juice=require(_0xbe9d('0x3'));var Redis=require('ioredis');var qs=require(_0xbe9d('0x4'));var logger=require(_0xbe9d('0x5'))('api');var config=require(_0xbe9d('0x6'));var db=require(_0xbe9d('0x7'))['db'];config[_0xbe9d('0x8')]=_[_0xbe9d('0x9')](config[_0xbe9d('0x8')],{'host':_0xbe9d('0xa'),'port':0x18eb});var socket=require(_0xbe9d('0xb'))(new Redis(config[_0xbe9d('0x8')]));require(_0xbe9d('0xc'))[_0xbe9d('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbe9d('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0x2717d7,_0x338097,_0x24e94d,_0x1e1ed3){return new BPromise(function(_0x1b3d2b,_0x221822){var _0x150d2c=_0x1e1ed3||client;return _0x150d2c[_0xbe9d('0xf')](_0x2717d7,_0x24e94d)['then'](function(_0x355c1e){logger['info'](_0xbe9d('0x10'),_0x338097,_0xbe9d('0x11'));logger[_0xbe9d('0x12')](_0xbe9d('0x13'),_0x338097,'request\x20sent',JSON['stringify'](_0x355c1e));if(_0x355c1e[_0xbe9d('0x14')]){if(_0x355c1e['error'][_0xbe9d('0x15')]===0x1f4){logger['error'](_0xbe9d('0x10'),_0x338097,_0x355c1e[_0xbe9d('0x14')][_0xbe9d('0x16')]);return _0x221822(_0x355c1e[_0xbe9d('0x14')][_0xbe9d('0x16')]);}logger[_0xbe9d('0x14')](_0xbe9d('0x10'),_0x338097,_0x355c1e[_0xbe9d('0x14')][_0xbe9d('0x16')]);return _0x1b3d2b(_0x355c1e['error'][_0xbe9d('0x16')]);}else{logger[_0xbe9d('0x17')]('MailAccount,\x20%s,\x20%s',_0x338097,_0xbe9d('0x11'));_0x1b3d2b(_0x355c1e['result'][_0xbe9d('0x16')]);}})['catch'](function(_0x330d69){logger[_0xbe9d('0x14')](_0xbe9d('0x10'),_0x338097,_0x330d69);_0x221822(_0x330d69);});});}function respondWithStatusCode(_0x10088c,_0x36486d){_0x36486d=_0x36486d||0xcc;return function(_0x4f3a58){if(_0x4f3a58){return _0x10088c['sendStatus'](_0x36486d);}return _0x10088c[_0xbe9d('0x18')](_0x36486d)[_0xbe9d('0x19')]();};}function respondWithResult(_0x14bb52,_0x33c405){_0x33c405=_0x33c405||0xc8;return function(_0x52afee){if(_0x52afee){return _0x14bb52[_0xbe9d('0x18')](_0x33c405)['json'](_0x52afee);}};}function respondWithFilteredResult(_0x5a4a9e,_0x3337d6){return function(_0x3459d1){if(_0x3459d1){var _0x2e3f56=typeof _0x3337d6[_0xbe9d('0x1a')]==='undefined'&&typeof _0x3337d6[_0xbe9d('0x1b')]===_0xbe9d('0x1c');var _0x13b9ea=_0x3459d1[_0xbe9d('0x1d')];var _0x298bfe=_0x2e3f56?0x0:_0x3337d6[_0xbe9d('0x1a')];var _0x41c2b5=_0x2e3f56?_0x3459d1[_0xbe9d('0x1d')]:_0x3337d6[_0xbe9d('0x1a')]+_0x3337d6[_0xbe9d('0x1b')];var _0x1a66f7;if(_0x41c2b5>=_0x13b9ea){_0x41c2b5=_0x13b9ea;_0x1a66f7=0xc8;}else{_0x1a66f7=0xce;}_0x5a4a9e[_0xbe9d('0x18')](_0x1a66f7);return _0x5a4a9e['set']('Content-Range',_0x298bfe+'-'+_0x41c2b5+'/'+_0x13b9ea)['json'](_0x3459d1);}return null;};}function saveUpdates(_0x36f0da){return function(_0x2d7d11){if(_0x2d7d11){return _0x2d7d11['update'](_0x36f0da)['then'](function(_0x1ad02b){return _0x1ad02b;});}return null;};}function removeEntity(_0x595445){return function(_0x4bf6ef){if(_0x4bf6ef){return _0x4bf6ef[_0xbe9d('0x1e')]()[_0xbe9d('0x1f')](function(){var _0x2f8d10=_0x4bf6ef[_0xbe9d('0x20')]({'plain':!![]});var _0x5913f5=_0xbe9d('0x21');return db[_0xbe9d('0x22')][_0xbe9d('0x1e')]({'where':{'type':_0x5913f5,'resourceId':_0x2f8d10['id']}})[_0xbe9d('0x1f')](function(){return _0x4bf6ef;});})[_0xbe9d('0x1f')](function(){_0x595445[_0xbe9d('0x18')](0xcc)[_0xbe9d('0x19')]();});}};}function handleEntityNotFound(_0x174d65){return function(_0x4bf3be){if(!_0x4bf3be){_0x174d65[_0xbe9d('0x23')](0x194);}return _0x4bf3be;};}function handleError(_0x13c047,_0x4a9831){_0x4a9831=_0x4a9831||0x1f4;return function(_0x374165){logger['error'](_0x374165['stack']);if(_0x374165[_0xbe9d('0x24')]){delete _0x374165[_0xbe9d('0x24')];}_0x13c047[_0xbe9d('0x18')](_0x4a9831)[_0xbe9d('0x25')](_0x374165);};}function getImapHost(_0x6f96de){switch(_0x6f96de){case _0xbe9d('0x26'):return _0xbe9d('0x27');case _0xbe9d('0x28'):return _0xbe9d('0x29');case _0xbe9d('0x2a'):return _0xbe9d('0x2b');case _0xbe9d('0x2c'):return _0xbe9d('0x2d');}throw new Error(_0xbe9d('0x2e'),_0x6f96de);}function getSmtpHost(_0x3cf295){switch(_0x3cf295){case _0xbe9d('0x26'):return _0xbe9d('0x2f');case _0xbe9d('0x28'):return _0xbe9d('0x30');case _0xbe9d('0x2a'):return _0xbe9d('0x31');case _0xbe9d('0x2c'):return _0xbe9d('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3cf295);}function getAuthenticationOptions(_0x327613,_0x57aced){var _0x1078f1={};var _0x3c5de5={};if(_0x327613){_0x1078f1[_0xbe9d('0x33')]=_0x3c5de5['user']=_0x57aced[_0xbe9d('0x34')];_0x1078f1[_0xbe9d('0x35')]=_0x3c5de5[_0xbe9d('0x36')]=_0x57aced[_0xbe9d('0x35')];if(_0x57aced[_0xbe9d('0x37')]){_0x1078f1[_0xbe9d('0x37')]=_0x3c5de5[_0xbe9d('0x37')]=!![];_0x1078f1[_0xbe9d('0x38')]=_0x3c5de5[_0xbe9d('0x38')]=_0x57aced[_0xbe9d('0x38')];_0x1078f1[_0xbe9d('0x35')]=_0x3c5de5[_0xbe9d('0x36')]=null;}else{_0x1078f1['CloudProviderId']=_0x3c5de5[_0xbe9d('0x38')]=null;}_0x1078f1[_0xbe9d('0x39')]=getImapHost(_0x327613);_0x1078f1['port']=0x3e1;_0x3c5de5[_0xbe9d('0x39')]=getSmtpHost(_0x327613);_0x3c5de5[_0xbe9d('0x3a')]=0x24b;_0x3c5de5['secure']=![];_0x1078f1[_0xbe9d('0x3b')]=_0x3c5de5[_0xbe9d('0x3b')]=null;}else{if(_0x57aced[_0xbe9d('0x3c')]){_0x1078f1[_0xbe9d('0x33')]=_0x3c5de5[_0xbe9d('0x33')]=_0x57aced[_0xbe9d('0x34')];_0x1078f1[_0xbe9d('0x35')]=_0x3c5de5[_0xbe9d('0x36')]=_0x57aced[_0xbe9d('0x35')];}else{_0x1078f1['authentication']=_0x3c5de5['authentication']=![];_0x1078f1[_0xbe9d('0x33')]=_0x3c5de5[_0xbe9d('0x33')]=null;_0x1078f1['password']=_0x3c5de5[_0xbe9d('0x36')]=null;}_0x1078f1[_0xbe9d('0x39')]=_0x57aced['Imap']['host'];_0x1078f1[_0xbe9d('0x3a')]=_0x57aced[_0xbe9d('0x3d')]['port'];_0x3c5de5[_0xbe9d('0x39')]=_0x57aced[_0xbe9d('0x3e')][_0xbe9d('0x39')];_0x3c5de5[_0xbe9d('0x3a')]=_0x57aced[_0xbe9d('0x3e')][_0xbe9d('0x3a')];}return{'Imap':_0x1078f1,'Smtp':_0x3c5de5};}exports[_0xbe9d('0x3f')]=function(_0x5b5371,_0x111b94){var _0x3d6925={'include':[{'model':db[_0xbe9d('0x40')],'as':_0xbe9d('0x3d')},{'model':db[_0xbe9d('0x41')],'as':_0xbe9d('0x3e')},{'model':db[_0xbe9d('0x42')],'as':'mandatoryDispositionPause'}]},_0x239e0c={},_0x180909={'count':0x0,'rows':[]};var _0xb07331=_['map'](db[_0xbe9d('0x43')][_0xbe9d('0x44')],function(_0x377588){return{'name':_0x377588[_0xbe9d('0x45')],'type':_0x377588['type'][_0xbe9d('0x46')]};});_0x239e0c['model']=_[_0xbe9d('0x47')](_0xb07331,_0xbe9d('0x24'));_0x239e0c[_0xbe9d('0x48')]=_[_0xbe9d('0x49')](_0x5b5371[_0xbe9d('0x48')]);_0x239e0c[_0xbe9d('0x4a')]=_[_0xbe9d('0x4b')](_0x239e0c[_0xbe9d('0x4c')],_0x239e0c[_0xbe9d('0x48')]);_0x3d6925['attributes']=_[_0xbe9d('0x4b')](_0x239e0c[_0xbe9d('0x4c')],qs[_0xbe9d('0x4d')](_0x5b5371['query'][_0xbe9d('0x4d')]));_0x3d6925['attributes']=_0x3d6925['attributes'][_0xbe9d('0x4e')]?_0x3d6925[_0xbe9d('0x4f')]:_0x239e0c[_0xbe9d('0x4c')];if(!_0x5b5371[_0xbe9d('0x48')][_0xbe9d('0x50')]('nolimit')){_0x3d6925[_0xbe9d('0x1b')]=qs[_0xbe9d('0x1b')](_0x5b5371[_0xbe9d('0x48')]['limit']);_0x3d6925[_0xbe9d('0x1a')]=qs[_0xbe9d('0x1a')](_0x5b5371['query'][_0xbe9d('0x1a')]);}_0x3d6925['order']=qs[_0xbe9d('0x51')](_0x5b5371[_0xbe9d('0x48')][_0xbe9d('0x51')]);_0x3d6925['where']=qs['filters'](_[_0xbe9d('0x52')](_0x5b5371[_0xbe9d('0x48')],_0x239e0c['filters']),_0xb07331);if(_0x5b5371['query']['filter']){_0x3d6925[_0xbe9d('0x53')]=_[_0xbe9d('0x54')](_0x3d6925['where'],{'$or':_[_0xbe9d('0x47')](_0xb07331,function(_0x4b56c0){if(_0x4b56c0[_0xbe9d('0x55')]!==_0xbe9d('0x56')){var _0x7874e3={};_0x7874e3[_0x4b56c0[_0xbe9d('0x24')]]={'$like':'%'+_0x5b5371['query'][_0xbe9d('0x57')]+'%'};return _0x7874e3;}})});}_0x3d6925=_['merge']({},_0x3d6925,_0x5b5371[_0xbe9d('0x58')]);var _0x10300c={'where':_0x3d6925[_0xbe9d('0x53')]};return db[_0xbe9d('0x43')][_0xbe9d('0x1d')](_0x10300c)[_0xbe9d('0x1f')](function(_0x5721db){_0x180909['count']=_0x5721db;if(_0x5b5371[_0xbe9d('0x48')]['includeAll']){_0x3d6925[_0xbe9d('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0xbe9d('0x5a')](_0x3d6925);})[_0xbe9d('0x1f')](function(_0x189701){_0x180909[_0xbe9d('0x5b')]=_0x189701;return _0x180909;})[_0xbe9d('0x1f')](respondWithFilteredResult(_0x111b94,_0x3d6925))[_0xbe9d('0x5c')](handleError(_0x111b94,null));};exports[_0xbe9d('0x5d')]=function(_0x4ac7e9,_0x4434fc){var _0x276b36={'raw':![],'where':{'id':_0x4ac7e9[_0xbe9d('0x5e')]['id']},'include':[{'model':db[_0xbe9d('0x40')],'as':'Imap'},{'model':db[_0xbe9d('0x41')],'as':_0xbe9d('0x3e')},{'model':db[_0xbe9d('0x42')],'as':'mandatoryDispositionPause'}]},_0x47f969={};_0x47f969[_0xbe9d('0x4c')]=_[_0xbe9d('0x49')](db[_0xbe9d('0x43')]['rawAttributes']);_0x47f969[_0xbe9d('0x48')]=_[_0xbe9d('0x49')](_0x4ac7e9[_0xbe9d('0x48')]);_0x47f969[_0xbe9d('0x4a')]=_[_0xbe9d('0x4b')](_0x47f969[_0xbe9d('0x4c')],_0x47f969['query']);_0x276b36[_0xbe9d('0x4f')]=_['intersection'](_0x47f969[_0xbe9d('0x4c')],qs['fields'](_0x4ac7e9[_0xbe9d('0x48')][_0xbe9d('0x4d')]));_0x276b36['attributes']=_0x276b36[_0xbe9d('0x4f')]['length']?_0x276b36[_0xbe9d('0x4f')]:_0x47f969[_0xbe9d('0x4c')];if(_0x4ac7e9[_0xbe9d('0x48')][_0xbe9d('0x5f')]){_0x276b36[_0xbe9d('0x59')]=[{'all':!![]}];}_0x276b36=_[_0xbe9d('0x54')]({},_0x276b36,_0x4ac7e9[_0xbe9d('0x58')]);return db[_0xbe9d('0x43')][_0xbe9d('0x60')](_0x276b36)[_0xbe9d('0x1f')](handleEntityNotFound(_0x4434fc,null))[_0xbe9d('0x1f')](respondWithResult(_0x4434fc,null))[_0xbe9d('0x5c')](handleError(_0x4434fc,null));};exports[_0xbe9d('0x61')]=function(_0x194769,_0x499e67){if(_0x194769['body']['id']){delete _0x194769['body']['id'];}var _0x3a8d9a=_0x194769[_0xbe9d('0x62')][_0xbe9d('0x63')]===_0xbe9d('0x64')?null:_0x194769[_0xbe9d('0x62')][_0xbe9d('0x63')];var _0x496210=_0x194769[_0xbe9d('0x62')][_0xbe9d('0x3d')]||{};var _0x129d39=_0x194769[_0xbe9d('0x62')]['Smtp']||{};if(_0x3a8d9a){_0x496210['host']=getImapHost(_0x3a8d9a);_0x496210[_0xbe9d('0x3a')]=0x3e1;_0x129d39[_0xbe9d('0x39')]=getSmtpHost(_0x3a8d9a);_0x129d39[_0xbe9d('0x3a')]=0x24b;_0x129d39[_0xbe9d('0x65')]=![];}if(_0x129d39[_0xbe9d('0x37')]){_0x129d39['secure']=![];}else{_0x129d39[_0xbe9d('0x38')]=null;}if(!_0x496210[_0xbe9d('0x37')])_0x496210['CloudProviderId']=null;_0x194769['body'][_0xbe9d('0x3d')]=_0x496210;_0x194769[_0xbe9d('0x62')]['Smtp']=_0x129d39;return db['MailAccount'][_0xbe9d('0x60')]({'where':{'id':_0x194769[_0xbe9d('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xbe9d('0x3e')},{'model':db[_0xbe9d('0x42')],'as':_0xbe9d('0x66')}]})[_0xbe9d('0x1f')](handleEntityNotFound(_0x499e67,null))['then'](function(_0x4ce249){if(!_0x4ce249)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4ce249[_0xbe9d('0x3b')])delete _0x194769[_0xbe9d('0x62')][_0xbe9d('0x3d')];return _0x4ce249;})[_0xbe9d('0x1f')](saveUpdates(_0x194769[_0xbe9d('0x62')],null))[_0xbe9d('0x1f')](function(_0x57ad54){if(!_0x194769[_0xbe9d('0x62')][_0xbe9d('0x3d')])return _0x57ad54;return db[_0xbe9d('0x40')][_0xbe9d('0x61')](_0x194769['body']['Imap'],{'where':{'MailAccountId':_0x57ad54['id']}})[_0xbe9d('0x1f')](function(){return _0x57ad54;});})[_0xbe9d('0x1f')](function(_0x1cb2c3){if(!_0x194769['body'][_0xbe9d('0x3e')])return _0x1cb2c3;return db[_0xbe9d('0x41')][_0xbe9d('0x61')](_0x194769['body'][_0xbe9d('0x3e')],{'where':{'MailAccountId':_0x1cb2c3['id']}})[_0xbe9d('0x1f')](function(){return _0x1cb2c3;});})[_0xbe9d('0x1f')](respondWithResult(_0x499e67,null))[_0xbe9d('0x5c')](handleError(_0x499e67,null));};exports[_0xbe9d('0x67')]=function(_0x4573df,_0x426c2c){return db[_0xbe9d('0x43')][_0xbe9d('0x67')]()[_0xbe9d('0x1f')](respondWithResult(_0x426c2c,null))[_0xbe9d('0x5c')](handleError(_0x426c2c,null));};exports[_0xbe9d('0x68')]=function(_0xa81d2f,_0x4e5bc6){if(_0xa81d2f[_0xbe9d('0x62')]['id']){delete _0xa81d2f['body']['id'];}return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0xa81d2f[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x4e5bc6,null))['then'](function(_0x24645d){if(_0x24645d){_0xa81d2f['body'][_0xbe9d('0x69')]=_0x24645d['id'];return db[_0xbe9d('0x6a')][_0xbe9d('0x6b')](_0xa81d2f[_0xbe9d('0x62')]);}})['then'](respondWithResult(_0x4e5bc6,null))[_0xbe9d('0x5c')](handleError(_0x4e5bc6,null));};exports[_0xbe9d('0x6c')]=function(_0x185c1c,_0x250c6d){var _0x41e00d={'raw':![],'where':{}};var _0x2a914f={};var _0xaba73d={'count':0x0,'rows':[]};return db['MailAccount'][_0xbe9d('0x6d')]({'where':{'id':_0x185c1c[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x250c6d,null))['then'](function(_0xdaa46b){if(_0xdaa46b){_0x2a914f[_0xbe9d('0x4c')]=_[_0xbe9d('0x49')](db[_0xbe9d('0x6a')][_0xbe9d('0x44')]);_0x2a914f[_0xbe9d('0x48')]=_[_0xbe9d('0x49')](_0x185c1c['query']);_0x2a914f[_0xbe9d('0x4a')]=_['intersection'](_0x2a914f[_0xbe9d('0x4c')],_0x2a914f['query']);_0x41e00d[_0xbe9d('0x4f')]=_[_0xbe9d('0x4b')](_0x2a914f[_0xbe9d('0x4c')],qs['fields'](_0x185c1c[_0xbe9d('0x48')][_0xbe9d('0x4d')]));_0x41e00d[_0xbe9d('0x4f')]=_0x41e00d[_0xbe9d('0x4f')]['length']?_0x41e00d[_0xbe9d('0x4f')]:_0x2a914f[_0xbe9d('0x4c')];if(!_0x185c1c[_0xbe9d('0x48')][_0xbe9d('0x50')](_0xbe9d('0x6e'))){_0x41e00d[_0xbe9d('0x1b')]=qs[_0xbe9d('0x1b')](_0x185c1c[_0xbe9d('0x48')][_0xbe9d('0x1b')]);_0x41e00d['offset']=qs[_0xbe9d('0x1a')](_0x185c1c['query'][_0xbe9d('0x1a')]);}_0x41e00d[_0xbe9d('0x6f')]=qs[_0xbe9d('0x51')](_0x185c1c[_0xbe9d('0x48')][_0xbe9d('0x51')]);_0x41e00d[_0xbe9d('0x53')]=qs[_0xbe9d('0x4a')](_[_0xbe9d('0x52')](_0x185c1c['query'],_0x2a914f[_0xbe9d('0x4a')]));_0x41e00d[_0xbe9d('0x53')]['MailAccountId']=_0xdaa46b['id'];if(_0x185c1c['query'][_0xbe9d('0x57')]){_0x41e00d[_0xbe9d('0x53')]=_['merge'](_0x41e00d[_0xbe9d('0x53')],{'$or':_['map'](_0x41e00d[_0xbe9d('0x4f')],function(_0x1f57e8){var _0x57402d={};_0x57402d[_0x1f57e8]={'$like':'%'+_0x185c1c['query'][_0xbe9d('0x57')]+'%'};return _0x57402d;})});}_0x41e00d=_[_0xbe9d('0x54')]({},_0x41e00d,_0x185c1c[_0xbe9d('0x58')]);return db['Disposition'][_0xbe9d('0x1d')]({'where':_0x41e00d['where']})[_0xbe9d('0x1f')](function(_0x516596){_0xaba73d[_0xbe9d('0x1d')]=_0x516596;if(_0x185c1c[_0xbe9d('0x48')][_0xbe9d('0x5f')]){_0x41e00d[_0xbe9d('0x59')]=[{'all':!![]}];}return db[_0xbe9d('0x6a')][_0xbe9d('0x5a')](_0x41e00d);})[_0xbe9d('0x1f')](function(_0x28932c){_0xaba73d[_0xbe9d('0x5b')]=_0x28932c;return _0xaba73d;});}})[_0xbe9d('0x1f')](respondWithFilteredResult(_0x250c6d,_0x41e00d))[_0xbe9d('0x5c')](handleError(_0x250c6d,null));};exports[_0xbe9d('0x70')]=function(_0x25b015,_0xcd5cc0){return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0x25b015['params']['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0xcd5cc0,null))[_0xbe9d('0x1f')](function(_0x555a2b){if(_0x555a2b){return _0x555a2b[_0xbe9d('0x70')](_0x25b015[_0xbe9d('0x48')][_0xbe9d('0x71')]);}})['then'](respondWithStatusCode(_0xcd5cc0,null))[_0xbe9d('0x5c')](handleError(_0xcd5cc0,null));};exports['addAnswer']=function(_0x364d39,_0x4e1f42){if(_0x364d39[_0xbe9d('0x62')]['id']){delete _0x364d39[_0xbe9d('0x62')]['id'];}return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0x364d39[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x4e1f42,null))[_0xbe9d('0x1f')](function(_0x9906eb){if(_0x9906eb){_0x364d39[_0xbe9d('0x62')]['MailAccountId']=_0x9906eb['id'];return db[_0xbe9d('0x72')][_0xbe9d('0x6b')](_0x364d39[_0xbe9d('0x62')]);}})[_0xbe9d('0x1f')](respondWithResult(_0x4e1f42,null))[_0xbe9d('0x5c')](handleError(_0x4e1f42,null));};exports[_0xbe9d('0x73')]=function(_0x513313,_0x5a049c){var _0xe2f6e6={'raw':![],'where':{}};var _0x4c5035={};var _0x2eb703={'count':0x0,'rows':[]};return db[_0xbe9d('0x43')][_0xbe9d('0x6d')]({'where':{'id':_0x513313[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x5a049c,null))[_0xbe9d('0x1f')](function(_0x3739d4){if(_0x3739d4){_0x4c5035[_0xbe9d('0x4c')]=_[_0xbe9d('0x49')](db[_0xbe9d('0x72')][_0xbe9d('0x44')]);_0x4c5035[_0xbe9d('0x48')]=_[_0xbe9d('0x49')](_0x513313['query']);_0x4c5035[_0xbe9d('0x4a')]=_['intersection'](_0x4c5035[_0xbe9d('0x4c')],_0x4c5035[_0xbe9d('0x48')]);_0xe2f6e6[_0xbe9d('0x4f')]=_['intersection'](_0x4c5035[_0xbe9d('0x4c')],qs[_0xbe9d('0x4d')](_0x513313[_0xbe9d('0x48')][_0xbe9d('0x4d')]));_0xe2f6e6[_0xbe9d('0x4f')]=_0xe2f6e6[_0xbe9d('0x4f')][_0xbe9d('0x4e')]?_0xe2f6e6[_0xbe9d('0x4f')]:_0x4c5035[_0xbe9d('0x4c')];if(!_0x513313[_0xbe9d('0x48')][_0xbe9d('0x50')](_0xbe9d('0x6e'))){_0xe2f6e6[_0xbe9d('0x1b')]=qs[_0xbe9d('0x1b')](_0x513313[_0xbe9d('0x48')][_0xbe9d('0x1b')]);_0xe2f6e6[_0xbe9d('0x1a')]=qs[_0xbe9d('0x1a')](_0x513313[_0xbe9d('0x48')][_0xbe9d('0x1a')]);}_0xe2f6e6['order']=qs[_0xbe9d('0x51')](_0x513313['query'][_0xbe9d('0x51')]);_0xe2f6e6[_0xbe9d('0x53')]=qs['filters'](_[_0xbe9d('0x52')](_0x513313['query'],_0x4c5035['filters']));_0xe2f6e6[_0xbe9d('0x53')][_0xbe9d('0x69')]=_0x3739d4['id'];if(_0x513313['query'][_0xbe9d('0x57')]){_0xe2f6e6[_0xbe9d('0x53')]=_[_0xbe9d('0x54')](_0xe2f6e6[_0xbe9d('0x53')],{'$or':_['map'](_0xe2f6e6['attributes'],function(_0x39df14){var _0x3966a8={};_0x3966a8[_0x39df14]={'$like':'%'+_0x513313[_0xbe9d('0x48')][_0xbe9d('0x57')]+'%'};return _0x3966a8;})});}_0xe2f6e6=_['merge']({},_0xe2f6e6,_0x513313['options']);return db[_0xbe9d('0x72')]['count']({'where':_0xe2f6e6[_0xbe9d('0x53')]})[_0xbe9d('0x1f')](function(_0x59d30c){_0x2eb703[_0xbe9d('0x1d')]=_0x59d30c;if(_0x513313['query'][_0xbe9d('0x5f')]){_0xe2f6e6[_0xbe9d('0x59')]=[{'all':!![]}];}return db[_0xbe9d('0x72')]['findAll'](_0xe2f6e6);})[_0xbe9d('0x1f')](function(_0x2302de){_0x2eb703[_0xbe9d('0x5b')]=_0x2302de;return _0x2eb703;});}})['then'](respondWithFilteredResult(_0x5a049c,_0xe2f6e6))['catch'](handleError(_0x5a049c,null));};exports[_0xbe9d('0x74')]=function(_0x796522,_0x3b6ef6){return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0x796522[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x3b6ef6,null))[_0xbe9d('0x1f')](function(_0x130c9b){if(_0x130c9b){return _0x130c9b[_0xbe9d('0x74')](_0x796522['query'][_0xbe9d('0x71')]);}})[_0xbe9d('0x1f')](respondWithStatusCode(_0x3b6ef6,null))[_0xbe9d('0x5c')](handleError(_0x3b6ef6,null));};exports[_0xbe9d('0x6b')]=function(_0x4f479b,_0x192de0){var _0x3641ff={'name':_0x4f479b[_0xbe9d('0x62')]['name'],'key':_0x4f479b[_0xbe9d('0x62')]['key'],'provider':_0x4f479b['body'][_0xbe9d('0x63')]==='custom'?null:_0x4f479b[_0xbe9d('0x62')]['provider'],'email':_0x4f479b['body'][_0xbe9d('0x75')],'ListId':_0x4f479b[_0xbe9d('0x62')]['ListId'],'active':!_['isNil'](_0x4f479b[_0xbe9d('0x62')][_0xbe9d('0x76')])?_0x4f479b[_0xbe9d('0x62')][_0xbe9d('0x76')]:!![],'description':_0x4f479b[_0xbe9d('0x62')]['description']||null};var _0x88c95e=getAuthenticationOptions(_0x3641ff[_0xbe9d('0x63')],_0x4f479b[_0xbe9d('0x62')]);_0x3641ff[_0xbe9d('0x3d')]=_0x88c95e[_0xbe9d('0x3d')];_0x3641ff[_0xbe9d('0x3e')]=_0x88c95e[_0xbe9d('0x3e')];return db[_0xbe9d('0x43')][_0xbe9d('0x6b')](_0x3641ff,{'include':[{'model':db['MailServerOut'],'as':_0xbe9d('0x3e')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xbe9d('0x1f')](function(_0x3cef8a){var _0x342cf2=_0x4f479b[_0xbe9d('0x33')]['get']({'plain':!![]});if(!_0x342cf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x342cf2['role']===_0xbe9d('0x33')){var _0x4c711f=_0x3cef8a[_0xbe9d('0x20')]({'plain':!![]});return db['UserProfileSection'][_0xbe9d('0x60')]({'where':{'name':_0xbe9d('0x21'),'userProfileId':_0x342cf2[_0xbe9d('0x77')]},'raw':!![]})[_0xbe9d('0x1f')](function(_0x308279){if(_0x308279&&_0x308279[_0xbe9d('0x78')]===0x0){return db['UserProfileResource'][_0xbe9d('0x6b')]({'name':_0x4c711f['name'],'resourceId':_0x4c711f['id'],'type':_0x308279[_0xbe9d('0x24')],'sectionId':_0x308279['id']},{})[_0xbe9d('0x1f')](function(){return _0x3cef8a;});}else{return _0x3cef8a;}})['catch'](function(_0x23ddb5){logger[_0xbe9d('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23ddb5);throw _0x23ddb5;});}return _0x3cef8a;})[_0xbe9d('0x1f')](respondWithResult(_0x192de0,0xc9))[_0xbe9d('0x5c')](handleError(_0x192de0,null));};exports[_0xbe9d('0x79')]=function(_0x4482eb,_0x525c4e){return db[_0xbe9d('0x43')]['findOne']({'where':{'id':_0x4482eb[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x525c4e,null))['then'](function(_0x3caa4d){if(_0x3caa4d){return _0x3caa4d[_0xbe9d('0x79')]();}return null;})['then'](respondWithResult(_0x525c4e,null))[_0xbe9d('0x5c')](handleError(_0x525c4e,null));};exports[_0xbe9d('0x7a')]=function(_0x5c7b46,_0x95cb6b){if(_0x5c7b46[_0xbe9d('0x62')]['id']){delete _0x5c7b46['body']['id'];}return db[_0xbe9d('0x43')]['find']({'where':{'id':_0x5c7b46['params']['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x95cb6b,null))[_0xbe9d('0x1f')](function(_0x51cac4){if(_0x51cac4){_0x5c7b46['body'][_0xbe9d('0x69')]=_0x51cac4['id'];return db['MailServerIn'][_0xbe9d('0x6b')](_0x5c7b46[_0xbe9d('0x62')]);}})[_0xbe9d('0x1f')](respondWithResult(_0x95cb6b,null))[_0xbe9d('0x5c')](handleError(_0x95cb6b,null));};exports[_0xbe9d('0x7b')]=function(_0x20cc89,_0x3bf51f){return db[_0xbe9d('0x43')]['findOne']({'where':{'id':_0x20cc89[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x3bf51f,null))['then'](function(_0x4fdac6){if(_0x4fdac6){return _0x4fdac6[_0xbe9d('0x7c')](null);}return null;})['then'](respondWithStatusCode(_0x3bf51f,null))['catch'](handleError(_0x3bf51f,null));};exports[_0xbe9d('0x7d')]=function(_0x327c20,_0x17b654){return db[_0xbe9d('0x43')][_0xbe9d('0x6d')]({'where':{'id':_0x327c20[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x17b654,null))[_0xbe9d('0x1f')](function(_0x5c4fa7){if(_0x5c4fa7){return _0x5c4fa7[_0xbe9d('0x7d')]();}return null;})[_0xbe9d('0x1f')](respondWithResult(_0x17b654,null))['catch'](handleError(_0x17b654,null));};exports[_0xbe9d('0x7e')]=function(_0x35af7d,_0x545d90){if(_0x35af7d['body']['id']){delete _0x35af7d[_0xbe9d('0x62')]['id'];}return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0x35af7d[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x545d90,null))[_0xbe9d('0x1f')](function(_0x25719c){if(_0x25719c){_0x35af7d[_0xbe9d('0x62')]['MailAccountId']=_0x25719c['id'];return db[_0xbe9d('0x41')][_0xbe9d('0x6b')](_0x35af7d[_0xbe9d('0x62')]);}})['then'](respondWithResult(_0x545d90,null))[_0xbe9d('0x5c')](handleError(_0x545d90,null));};exports['removeSmtp']=function(_0x552dfe,_0x4e5ede){return db[_0xbe9d('0x43')][_0xbe9d('0x6d')]({'where':{'id':_0x552dfe['params']['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x4e5ede,null))[_0xbe9d('0x1f')](function(_0x452110){if(_0x452110){return _0x452110['setSmtp'](null);}return null;})[_0xbe9d('0x1f')](respondWithStatusCode(_0x4e5ede,null))[_0xbe9d('0x5c')](handleError(_0x4e5ede,null));};exports[_0xbe9d('0x7f')]=function(_0x48e56c,_0x5c4ff4){return db[_0xbe9d('0x80')]['find']({'where':{'id':_0x48e56c['params']['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x5c4ff4,null))[_0xbe9d('0x1f')](function(_0x2c8ac4){if(_0x2c8ac4){return _0x2c8ac4['addInteraction'](_0x48e56c['body'][_0xbe9d('0x71')],_[_0xbe9d('0x81')](_0x48e56c['body'],[_0xbe9d('0x71'),'id'])||{});}})[_0xbe9d('0x1f')](respondWithResult(_0x5c4ff4,null))[_0xbe9d('0x5c')](handleError(_0x5c4ff4,null));};exports[_0xbe9d('0x82')]=function(_0x47494f,_0x34c3da){var _0x5aa2b7={'raw':![],'where':{}};var _0xfbab79={};var _0x1f923f={'count':0x0,'rows':[]};return db[_0xbe9d('0x43')]['findOne']({'where':{'id':_0x47494f[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x34c3da,null))[_0xbe9d('0x1f')](function(_0x3831c3){if(_0x3831c3){_0xfbab79[_0xbe9d('0x4c')]=_[_0xbe9d('0x49')](db[_0xbe9d('0x80')][_0xbe9d('0x44')]);_0xfbab79['query']=_[_0xbe9d('0x49')](_0x47494f['query']);_0xfbab79[_0xbe9d('0x4a')]=_[_0xbe9d('0x4b')](_0xfbab79[_0xbe9d('0x4c')],_0xfbab79['query']);_0x5aa2b7['attributes']=_[_0xbe9d('0x4b')](_0xfbab79[_0xbe9d('0x4c')],qs['fields'](_0x47494f['query']['fields']));_0x5aa2b7[_0xbe9d('0x4f')]=_0x5aa2b7[_0xbe9d('0x4f')]['length']?_0x5aa2b7['attributes']:_0xfbab79[_0xbe9d('0x4c')];if(!_0x47494f[_0xbe9d('0x48')]['hasOwnProperty']('nolimit')){_0x5aa2b7[_0xbe9d('0x1b')]=qs[_0xbe9d('0x1b')](_0x47494f['query'][_0xbe9d('0x1b')]);_0x5aa2b7['offset']=qs['offset'](_0x47494f[_0xbe9d('0x48')]['offset']);}_0x5aa2b7[_0xbe9d('0x6f')]=qs['sort'](_0x47494f[_0xbe9d('0x48')]['sort']);_0x5aa2b7[_0xbe9d('0x53')]=qs[_0xbe9d('0x4a')](_[_0xbe9d('0x52')](_0x47494f[_0xbe9d('0x48')],_0xfbab79[_0xbe9d('0x4a')]));_0x5aa2b7[_0xbe9d('0x53')][_0xbe9d('0x69')]=_0x3831c3['id'];if(_0x47494f[_0xbe9d('0x48')]['filter']){_0x5aa2b7[_0xbe9d('0x53')]=_['merge'](_0x5aa2b7['where'],{'$or':_[_0xbe9d('0x47')](_0x5aa2b7[_0xbe9d('0x4f')],function(_0x578094){var _0x458c4b={};_0x458c4b[_0x578094]={'$like':'%'+_0x47494f[_0xbe9d('0x48')]['filter']+'%'};return _0x458c4b;})});}_0x5aa2b7=_[_0xbe9d('0x54')]({},_0x5aa2b7,_0x47494f['options']);return db[_0xbe9d('0x80')][_0xbe9d('0x1d')]({'where':_0x5aa2b7[_0xbe9d('0x53')]})[_0xbe9d('0x1f')](function(_0xa5ead3){_0x1f923f[_0xbe9d('0x1d')]=_0xa5ead3;if(_0x47494f[_0xbe9d('0x48')][_0xbe9d('0x5f')]){_0x5aa2b7[_0xbe9d('0x59')]=[{'model':db[_0xbe9d('0x83')],'as':_0xbe9d('0x84'),'required':![]},{'model':db[_0xbe9d('0x85')],'as':'Owner','attributes':[_0xbe9d('0x24'),_0xbe9d('0x86'),'internal'],'required':![]},{'model':db[_0xbe9d('0x87')],'as':_0xbe9d('0x88'),'attributes':['id',_0xbe9d('0x24'),_0xbe9d('0x89')],'where':_0x47494f[_0xbe9d('0x48')][_0xbe9d('0x8a')]?{'id':_0x47494f[_0xbe9d('0x48')]['tag']}:undefined,'required':_0x47494f[_0xbe9d('0x48')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xbe9d('0x5a')](_0x5aa2b7);})[_0xbe9d('0x1f')](function(_0x305aca){_0x1f923f[_0xbe9d('0x5b')]=_0x305aca;return _0x1f923f;});}})[_0xbe9d('0x1f')](respondWithFilteredResult(_0x34c3da,_0x5aa2b7))[_0xbe9d('0x5c')](handleError(_0x34c3da,null));};exports[_0xbe9d('0x8b')]=function addApplications(_0x1816df,_0x5602ae){var _0x42e3f2=_0x1816df[_0xbe9d('0x5e')]['id'];var _0x517a31=_0x1816df[_0xbe9d('0x62')];var _0x3e112a=0xc8;var _0x340194=null;return db[_0xbe9d('0x8c')][_0xbe9d('0x8d')]({'isolationLevel':db['sequelize'][_0xbe9d('0x8e')]['ISOLATION_LEVELS'][_0xbe9d('0x8f')]},function(_0x2483a6){return db[_0xbe9d('0x43')][_0xbe9d('0x6d')]({'where':{'id':_0x42e3f2},'transaction':_0x2483a6})[_0xbe9d('0x1f')](function(_0x1de33b){if(_0x1de33b){return db[_0xbe9d('0x90')][_0xbe9d('0x1e')]({'where':{'MailAccountId':_0x42e3f2},'transaction':_0x2483a6})[_0xbe9d('0x1f')](function(){var _0xe0a7e=_[_0xbe9d('0x47')](_0x517a31,function(_0x5a01b8){_0x5a01b8[_0xbe9d('0x69')]=_0x42e3f2;return _0x5a01b8;});return db[_0xbe9d('0x90')][_0xbe9d('0x91')](_0xe0a7e,{'transaction':_0x2483a6});});}else{_0x3e112a=0x194;_0x340194=[];}});})[_0xbe9d('0x1f')](function(){if(_0x3e112a!==0x194){return db[_0xbe9d('0x90')][_0xbe9d('0x92')]({'where':{'MailAccountId':_0x42e3f2},'order':_0xbe9d('0x93')})['then'](function(_0x5b0980){_0x340194=_0x5b0980;});}})[_0xbe9d('0x5c')](function(_0x497607){_0x3e112a=0x1f4;logger[_0xbe9d('0x14')](_0x497607[_0xbe9d('0x94')]);if(_0x497607['name']){delete _0x497607[_0xbe9d('0x24')];}_0x340194=_0x497607;})['finally'](function(){if(_0x340194===null){_0x5602ae[_0xbe9d('0x23')](_0x3e112a);}else{if(_0x3e112a===0x1f4){_0x5602ae[_0xbe9d('0x18')](_0x3e112a)[_0xbe9d('0x25')](_0x340194);}else{_0x5602ae[_0xbe9d('0x18')](_0x3e112a)[_0xbe9d('0x95')](_0x340194);}}});};exports[_0xbe9d('0x96')]=function(_0x2d3c9a,_0x5561b2){var _0x3c89f2={};var _0x5977dc={};var _0x18afa2;var _0x531376;return db[_0xbe9d('0x43')][_0xbe9d('0x6d')]({'where':{'id':_0x2d3c9a[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x5561b2,null))[_0xbe9d('0x1f')](function(_0x40c71d){if(_0x40c71d){_0x18afa2=_0x40c71d;_0x5977dc[_0xbe9d('0x4c')]=_['keys'](db[_0xbe9d('0x90')][_0xbe9d('0x44')]);_0x5977dc[_0xbe9d('0x48')]=_[_0xbe9d('0x49')](_0x2d3c9a['query']);_0x5977dc['filters']=_[_0xbe9d('0x4b')](_0x5977dc[_0xbe9d('0x4c')],_0x5977dc[_0xbe9d('0x48')]);_0x3c89f2[_0xbe9d('0x4f')]=_[_0xbe9d('0x4b')](_0x5977dc[_0xbe9d('0x4c')],qs[_0xbe9d('0x4d')](_0x2d3c9a['query']['fields']));_0x3c89f2[_0xbe9d('0x4f')]=_0x3c89f2[_0xbe9d('0x4f')][_0xbe9d('0x4e')]?_0x3c89f2[_0xbe9d('0x4f')]:_0x5977dc[_0xbe9d('0x4c')];_0x3c89f2[_0xbe9d('0x6f')]=qs[_0xbe9d('0x51')](_0x2d3c9a[_0xbe9d('0x48')][_0xbe9d('0x51')]);_0x3c89f2[_0xbe9d('0x53')]=qs[_0xbe9d('0x4a')](_[_0xbe9d('0x52')](_0x2d3c9a[_0xbe9d('0x48')],_0x5977dc[_0xbe9d('0x4a')]));if(_0x2d3c9a[_0xbe9d('0x48')][_0xbe9d('0x57')]){_0x3c89f2[_0xbe9d('0x53')]=_[_0xbe9d('0x54')](_0x3c89f2['where'],{'$or':_[_0xbe9d('0x47')](_0x3c89f2['attributes'],function(_0x553913){var _0x3594eb={};_0x3594eb[_0x553913]={'$like':'%'+_0x2d3c9a['query'][_0xbe9d('0x57')]+'%'};return _0x3594eb;})});}_0x3c89f2=_['merge']({},_0x3c89f2,_0x2d3c9a[_0xbe9d('0x58')]);return _0x18afa2[_0xbe9d('0x96')](_0x3c89f2);}})[_0xbe9d('0x1f')](function(_0x5e4c34){if(_0x5e4c34){_0x531376=_0x5e4c34[_0xbe9d('0x4e')];if(!_0x2d3c9a['query'][_0xbe9d('0x50')](_0xbe9d('0x6e'))){_0x3c89f2['limit']=qs[_0xbe9d('0x1b')](_0x2d3c9a[_0xbe9d('0x48')][_0xbe9d('0x1b')]);_0x3c89f2['offset']=qs[_0xbe9d('0x1a')](_0x2d3c9a['query'][_0xbe9d('0x1a')]);}return _0x18afa2['getApplications'](_0x3c89f2);}})[_0xbe9d('0x1f')](function(_0x14b19c){if(_0x14b19c){return _0x14b19c?{'count':_0x531376,'rows':_0x14b19c}:null;}})[_0xbe9d('0x1f')](respondWithResult(_0x5561b2,null))[_0xbe9d('0x5c')](handleError(_0x5561b2,null));};exports['getMessages']=function(_0xe8583,_0x126139){var _0x509dc7={'raw':!![],'where':{}};var _0x3dadf7={};var _0x34ffe3={'count':0x0,'rows':[]};return db[_0xbe9d('0x43')]['findOne']({'where':{'id':_0xe8583[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x126139,null))[_0xbe9d('0x1f')](function(_0x2e0f09){if(_0x2e0f09){_0x3dadf7[_0xbe9d('0x4c')]=_[_0xbe9d('0x49')](db['MailMessage'][_0xbe9d('0x44')]);_0x3dadf7[_0xbe9d('0x48')]=_['keys'](_0xe8583[_0xbe9d('0x48')]);_0x3dadf7[_0xbe9d('0x4a')]=_[_0xbe9d('0x4b')](_0x3dadf7[_0xbe9d('0x4c')],_0x3dadf7[_0xbe9d('0x48')]);_0x509dc7[_0xbe9d('0x4f')]=_['intersection'](_0x3dadf7[_0xbe9d('0x4c')],qs[_0xbe9d('0x4d')](_0xe8583[_0xbe9d('0x48')][_0xbe9d('0x4d')]));_0x509dc7[_0xbe9d('0x4f')]=_0x509dc7['attributes'][_0xbe9d('0x4e')]?_0x509dc7['attributes']:_0x3dadf7[_0xbe9d('0x4c')];if(!_0xe8583[_0xbe9d('0x48')][_0xbe9d('0x50')](_0xbe9d('0x6e'))){_0x509dc7[_0xbe9d('0x1b')]=qs[_0xbe9d('0x1b')](_0xe8583[_0xbe9d('0x48')][_0xbe9d('0x1b')]);_0x509dc7[_0xbe9d('0x1a')]=qs[_0xbe9d('0x1a')](_0xe8583['query'][_0xbe9d('0x1a')]);}_0x509dc7[_0xbe9d('0x6f')]=qs[_0xbe9d('0x51')](_0xe8583['query'][_0xbe9d('0x51')]);_0x509dc7['where']=qs[_0xbe9d('0x4a')](_[_0xbe9d('0x52')](_0xe8583[_0xbe9d('0x48')],_0x3dadf7[_0xbe9d('0x4a')]));_0x509dc7[_0xbe9d('0x53')][_0xbe9d('0x69')]=_0x2e0f09['id'];if(_0xe8583[_0xbe9d('0x48')]['filter']){_0x509dc7[_0xbe9d('0x53')]=_[_0xbe9d('0x54')](_0x509dc7[_0xbe9d('0x53')],{'$or':_[_0xbe9d('0x47')](_0x509dc7[_0xbe9d('0x4f')],function(_0x44de34){var _0x289571={};_0x289571[_0x44de34]={'$like':'%'+_0xe8583[_0xbe9d('0x48')][_0xbe9d('0x57')]+'%'};return _0x289571;})});}if(_0xe8583[_0xbe9d('0x48')][_0xbe9d('0x97')]){var _0x31bb80=_0xe8583[_0xbe9d('0x48')][_0xbe9d('0x97')][_0xbe9d('0x98')](',');var _0x4da1a6={};_0x4da1a6[_0x31bb80[0x0]]={'$gte':moment(_0x31bb80[0x1])['format'](_0xbe9d('0x99'))};_0x509dc7[_0xbe9d('0x53')]=_[_0xbe9d('0x54')](_0x509dc7[_0xbe9d('0x53')],_0x4da1a6);}_0x509dc7=_[_0xbe9d('0x54')]({},_0x509dc7,_0xe8583['options']);return db[_0xbe9d('0x9a')][_0xbe9d('0x1d')]({'where':_0x509dc7['where']})[_0xbe9d('0x1f')](function(_0x5dee4d){_0x34ffe3['count']=_0x5dee4d;if(_0xe8583['query']['includeAll']){_0x509dc7['include']=[{'all':!![]}];}return db[_0xbe9d('0x9a')][_0xbe9d('0x5a')](_0x509dc7);})['then'](function(_0x4661e0){if(_0xe8583[_0xbe9d('0x48')][_0xbe9d('0x9b')]==='true'){for(var _0x10370f=0x0;_0x10370f<_0x4661e0[_0xbe9d('0x4e')];_0x10370f++){_0x4661e0[_0x10370f]['body']=juice(_0x4661e0[_0x10370f][_0xbe9d('0x62')]);}}_0x34ffe3['rows']=_0x4661e0;return _0x34ffe3;});}})[_0xbe9d('0x1f')](respondWithFilteredResult(_0x126139,_0x509dc7))[_0xbe9d('0x5c')](handleError(_0x126139,null));};exports[_0xbe9d('0x25')]=function(_0x24a1aa,_0x39be9f){var _0x30e0e4,_0x47683d={},_0x45c287;if(_0x24a1aa[_0xbe9d('0x62')]['to']){_0x45c287=_0x24a1aa[_0xbe9d('0x62')]['to'][_0xbe9d('0x98')](',')[0x0];}return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0x24a1aa['params']['id']},'include':[{'model':db[_0xbe9d('0x9c')],'as':_0xbe9d('0x9d'),'include':[{'model':db[_0xbe9d('0x83')],'as':_0xbe9d('0x9e'),'where':{'email':_0x45c287},'limit':0x1,'order':[[_0xbe9d('0x9f'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xbe9d('0x3e'),'raw':!![],'include':[{'model':db[_0xbe9d('0xa0')],'as':_0xbe9d('0xa0'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x39be9f,null))['then'](function(_0x57e972){if(!_0x57e972)return;_0x30e0e4=_0x57e972;if(!_0x57e972[_0xbe9d('0x3e')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x24a1aa[_0xbe9d('0x62')]['from'])){_0x24a1aa[_0xbe9d('0x62')][_0xbe9d('0xa1')]=util[_0xbe9d('0xa2')](_0xbe9d('0xa3'),_0x57e972[_0xbe9d('0x24')],_0x57e972[_0xbe9d('0x75')]||_0x57e972[_0xbe9d('0x3e')][_0xbe9d('0x33')]);}if(_0x24a1aa[_0xbe9d('0x62')][_0xbe9d('0xa4')]&&_0x24a1aa['body'][_0xbe9d('0xa4')][_0xbe9d('0x4e')]){for(var _0x106afb=0x0;_0x106afb<_0x24a1aa['body'][_0xbe9d('0xa4')]['length'];_0x106afb+=0x1){_0x24a1aa[_0xbe9d('0x62')][_0xbe9d('0xa4')][_0x106afb]={'filename':_0x24a1aa[_0xbe9d('0x62')][_0xbe9d('0xa4')][_0x106afb][_0xbe9d('0x24')],'path':path[_0xbe9d('0xa5')](config['root'],_0xbe9d('0xa6'),_0x24a1aa['body'][_0xbe9d('0xa4')][_0x106afb]['basename'])};}}var _0x1ba6c6=_0x57e972[_0xbe9d('0xa7')]();return respondWithRpcPromise(_0xbe9d('0xa8'),'sendMail',{'account':_0x1ba6c6,'message':_0x24a1aa[_0xbe9d('0x62')]});})[_0xbe9d('0x1f')](function(_0x123189){if(!_0x123189)return;_0x47683d=_0x123189;if(!_0x30e0e4[_0xbe9d('0x9d')])throw new Error(_0xbe9d('0xa9'));if(_0x30e0e4[_0xbe9d('0x9d')][_0xbe9d('0x9e')][_0xbe9d('0x4e')])return _0x30e0e4[_0xbe9d('0x9d')]['Contacts'][0x0];return db[_0xbe9d('0x83')]['create'](_[_0xbe9d('0x9')](_0x24a1aa[_0xbe9d('0x62')],{'firstName':_0x24a1aa['body']['to'],'email':_0x24a1aa[_0xbe9d('0x62')]['to'],'phone':_0x24a1aa[_0xbe9d('0x62')]['to'],'ListId':_0x30e0e4[_0xbe9d('0xaa')]}));})[_0xbe9d('0x1f')](function(_0x13ae84){if(!_0x13ae84)return;var _0x382a68={'UserId':_0x24a1aa[_0xbe9d('0x33')]['id'],'ContactId':_0x13ae84['id'],'MailAccountId':_0x30e0e4['id'],'inReplyTo':_0x47683d[_0xbe9d('0xab')],'to':_0x24a1aa[_0xbe9d('0x62')][_0xbe9d('0xa1')],'cc':_0x24a1aa[_0xbe9d('0x62')]['cc'],'subject':_0x24a1aa['body'][_0xbe9d('0xac')],'attach':_0x24a1aa['body'][_0xbe9d('0xad')],'firstMsgDirection':_0xbe9d('0xae'),'lastMsgAt':moment()[_0xbe9d('0xa2')](_0xbe9d('0x99')),'lastMsgDirection':_0xbe9d('0xae'),'Messages':[_[_0xbe9d('0x54')](_0x24a1aa['body'],{'messageId':_0x47683d[_0xbe9d('0xab')],'sentAt':moment()[_0xbe9d('0xa2')](_0xbe9d('0x99')),'read':!![],'MailAccountId':_0x30e0e4['id'],'UserId':_0x24a1aa[_0xbe9d('0x33')]['id'],'ContactId':_0x13ae84['id']})]};if(_0x24a1aa['body']['Interaction']){_0x382a68=_[_0xbe9d('0x54')](_0x382a68,_0x24a1aa[_0xbe9d('0x62')][_0xbe9d('0xaf')]);}return db['MailInteraction'][_0xbe9d('0x6b')](_0x382a68,{'include':[{'model':db[_0xbe9d('0x9a')],'as':'Messages'}]});})[_0xbe9d('0x1f')](respondWithResult(_0x39be9f,null))[_0xbe9d('0x5c')](handleError(_0x39be9f,null));};exports['verifySmtp']=function(_0x20e651,_0x277f67){return db[_0xbe9d('0x43')]['find']({'where':{'id':_0x20e651[_0xbe9d('0x5e')]['id']},'include':[{'model':db[_0xbe9d('0x41')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xbe9d('0xa0')],'as':_0xbe9d('0xa0'),'raw':!![]}]}]})[_0xbe9d('0x1f')](handleEntityNotFound(_0x277f67,null))[_0xbe9d('0x1f')](function(_0x3a904a){if(!_0x3a904a[_0xbe9d('0x3e')])return;var _0x1295a1=_0x3a904a['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0xbe9d('0xb0'),{'account':_0x1295a1});})[_0xbe9d('0x1f')](respondWithResult(_0x277f67,null))[_0xbe9d('0x5c')](handleError(_0x277f67,null));};exports['destroy']=function(_0x26b031,_0x24d4c0){return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0x26b031[_0xbe9d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x24d4c0,null))['then'](function(_0x29d523){if(_0x29d523&&_0x29d523['service']){throw new db['Sequelize'][(_0xbe9d('0xb1'))](_0xbe9d('0xb2'));}return _0x29d523;})[_0xbe9d('0x1f')](removeEntity(_0x24d4c0,null))[_0xbe9d('0x5c')](handleError(_0x24d4c0,null));};exports['addAgents']=function(_0x33df0f,_0xe48a50){return db[_0xbe9d('0x43')][_0xbe9d('0x60')]({'where':{'id':_0x33df0f[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0xe48a50,null))[_0xbe9d('0x1f')](function(_0xfac123){if(_0xfac123){return _0xfac123['addAgents'](_0x33df0f[_0xbe9d('0x62')]['ids'],_[_0xbe9d('0x81')](_0x33df0f[_0xbe9d('0x62')],['ids','id'])||{})['spread'](function(_0x16567c){for(var _0x47c506=0x0;_0x47c506<_0x33df0f[_0xbe9d('0x62')][_0xbe9d('0x71')]['length'];_0x47c506+=0x1){socket[_0xbe9d('0xb3')]('userMailAccount:save',{'UserId':Number(_0x33df0f[_0xbe9d('0x62')][_0xbe9d('0x71')][_0x47c506]),'MailAccountId':Number(_0x33df0f[_0xbe9d('0x5e')]['id'])});}return _0x16567c;});}})[_0xbe9d('0x1f')](respondWithResult(_0xe48a50,null))[_0xbe9d('0x5c')](handleError(_0xe48a50,null));};exports['removeAgents']=function(_0x165d50,_0x4d6c92){return db['MailAccount'][_0xbe9d('0x60')]({'where':{'id':_0x165d50[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x4d6c92,null))[_0xbe9d('0x1f')](function(_0x799d6){if(_0x799d6){return _0x799d6[_0xbe9d('0xb4')](_0x165d50[_0xbe9d('0x48')][_0xbe9d('0x71')])[_0xbe9d('0x1f')](function(){if(_[_0xbe9d('0xb5')](_0x165d50[_0xbe9d('0x48')][_0xbe9d('0x71')])){for(var _0x51c2c6=0x0;_0x51c2c6<_0x165d50['query'][_0xbe9d('0x71')][_0xbe9d('0x4e')];_0x51c2c6+=0x1){socket[_0xbe9d('0xb3')]('userMailAccount:remove',{'UserId':Number(_0x165d50[_0xbe9d('0x48')][_0xbe9d('0x71')][_0x51c2c6]),'MailAccountId':Number(_0x165d50['params']['id'])});}}else{socket[_0xbe9d('0xb3')](_0xbe9d('0xb6'),{'UserId':Number(_0x165d50[_0xbe9d('0x48')][_0xbe9d('0x71')]),'MailAccountId':Number(_0x165d50['params']['id'])});}});}})[_0xbe9d('0x1f')](respondWithStatusCode(_0x4d6c92,null))[_0xbe9d('0x5c')](handleError(_0x4d6c92,null));};exports[_0xbe9d('0xb7')]=function(_0x236477,_0x391271){var _0x1940de={};var _0x3066cb={};var _0x25f855;var _0x3ee57d;return db[_0xbe9d('0x43')]['findOne']({'where':{'id':_0x236477[_0xbe9d('0x5e')]['id']}})[_0xbe9d('0x1f')](handleEntityNotFound(_0x391271,null))[_0xbe9d('0x1f')](function(_0x5649d9){if(_0x5649d9){_0x25f855=_0x5649d9;_0x3066cb[_0xbe9d('0x4c')]=_[_0xbe9d('0x49')](db[_0xbe9d('0x85')][_0xbe9d('0x44')]);_0x3066cb[_0xbe9d('0x48')]=_[_0xbe9d('0x49')](_0x236477['query']);_0x3066cb[_0xbe9d('0x4a')]=_[_0xbe9d('0x4b')](_0x3066cb[_0xbe9d('0x4c')],_0x3066cb[_0xbe9d('0x48')]);_0x1940de['attributes']=_[_0xbe9d('0x4b')](_0x3066cb[_0xbe9d('0x4c')],qs[_0xbe9d('0x4d')](_0x236477[_0xbe9d('0x48')][_0xbe9d('0x4d')]));_0x1940de[_0xbe9d('0x4f')]=_0x1940de[_0xbe9d('0x4f')]['length']?_0x1940de['attributes']:_0x3066cb[_0xbe9d('0x4c')];_0x1940de[_0xbe9d('0x6f')]=qs[_0xbe9d('0x51')](_0x236477['query']['sort']);_0x1940de[_0xbe9d('0x53')]=qs[_0xbe9d('0x4a')](_[_0xbe9d('0x52')](_0x236477[_0xbe9d('0x48')],_0x3066cb[_0xbe9d('0x4a')]));if(_0x236477[_0xbe9d('0x48')][_0xbe9d('0x57')]){_0x1940de[_0xbe9d('0x53')]=_[_0xbe9d('0x54')](_0x1940de[_0xbe9d('0x53')],{'$or':_[_0xbe9d('0x47')](_0x1940de[_0xbe9d('0x4f')],function(_0x2555fa){var _0x218afa={};_0x218afa[_0x2555fa]={'$like':'%'+_0x236477[_0xbe9d('0x48')]['filter']+'%'};return _0x218afa;})});}_0x1940de=_[_0xbe9d('0x54')]({},_0x1940de,_0x236477[_0xbe9d('0x58')]);return _0x25f855[_0xbe9d('0xb7')](_0x1940de);}})['then'](function(_0x4f53ab){if(_0x4f53ab){_0x3ee57d=_0x4f53ab[_0xbe9d('0x4e')];if(!_0x236477['query'][_0xbe9d('0x50')](_0xbe9d('0x6e'))){_0x1940de[_0xbe9d('0x1b')]=qs[_0xbe9d('0x1b')](_0x236477[_0xbe9d('0x48')][_0xbe9d('0x1b')]);_0x1940de[_0xbe9d('0x1a')]=qs[_0xbe9d('0x1a')](_0x236477[_0xbe9d('0x48')][_0xbe9d('0x1a')]);}return _0x25f855['getAgents'](_0x1940de);}})[_0xbe9d('0x1f')](function(_0x3bd33c){if(_0x3bd33c){return _0x3bd33c?{'count':_0x3ee57d,'rows':_0x3bd33c}:null;}})['then'](respondWithResult(_0x391271,null))[_0xbe9d('0x5c')](handleError(_0x391271,null));}; \ No newline at end of file +var _0xcefa=['MailMessage','$gte','inlineCss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','ListId','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','update','get','destroy','end','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','MailAccount','include','show','rawAttributes','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','sort','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','omit','MailInteraction','CmContact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications'];(function(_0x2d37a6,_0x4e4b20){var _0x1ddb89=function(_0x342682){while(--_0x342682){_0x2d37a6['push'](_0x2d37a6['shift']());}};_0x1ddb89(++_0x4e4b20);}(_0xcefa,0x1b3));var _0xacef=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcefa[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xacef('0x0'));var BPromise=require(_0xacef('0x1'));var util=require(_0xacef('0x2'));var path=require('path');var _=require(_0xacef('0x3'));var juice=require(_0xacef('0x4'));var Redis=require(_0xacef('0x5'));var qs=require(_0xacef('0x6'));var logger=require(_0xacef('0x7'))('api');var config=require(_0xacef('0x8'));var db=require(_0xacef('0x9'))['db'];config[_0xacef('0xa')]=_[_0xacef('0xb')](config['redis'],{'host':_0xacef('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacef('0xa')]));require(_0xacef('0xd'))[_0xacef('0xe')](socket);var jayson=require(_0xacef('0xf'));var client=jayson[_0xacef('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x1a7717,_0x17b0a2,_0x256d9f,_0x3be9a3){return new BPromise(function(_0xb224b5,_0x297f0a){var _0x263f06=_0x3be9a3||client;return _0x263f06[_0xacef('0x11')](_0x1a7717,_0x256d9f)[_0xacef('0x12')](function(_0x28555e){logger[_0xacef('0x13')]('MailAccount,\x20%s,\x20%s',_0x17b0a2,_0xacef('0x14'));logger[_0xacef('0x15')](_0xacef('0x16'),_0x17b0a2,_0xacef('0x14'),JSON['stringify'](_0x28555e));if(_0x28555e[_0xacef('0x17')]){if(_0x28555e['error'][_0xacef('0x18')]===0x1f4){logger[_0xacef('0x17')](_0xacef('0x19'),_0x17b0a2,_0x28555e['error'][_0xacef('0x1a')]);return _0x297f0a(_0x28555e[_0xacef('0x17')]['message']);}logger[_0xacef('0x17')]('MailAccount,\x20%s,\x20%s',_0x17b0a2,_0x28555e['error'][_0xacef('0x1a')]);return _0xb224b5(_0x28555e['error'][_0xacef('0x1a')]);}else{logger[_0xacef('0x13')](_0xacef('0x19'),_0x17b0a2,_0xacef('0x14'));_0xb224b5(_0x28555e[_0xacef('0x1b')][_0xacef('0x1a')]);}})[_0xacef('0x1c')](function(_0x147868){logger['error'](_0xacef('0x19'),_0x17b0a2,_0x147868);_0x297f0a(_0x147868);});});}function respondWithStatusCode(_0x90bf09,_0x500881){_0x500881=_0x500881||0xcc;return function(_0x24fa6b){if(_0x24fa6b){return _0x90bf09['sendStatus'](_0x500881);}return _0x90bf09[_0xacef('0x1d')](_0x500881)['end']();};}function respondWithResult(_0x2397b1,_0x6871b9){_0x6871b9=_0x6871b9||0xc8;return function(_0x13533c){if(_0x13533c){return _0x2397b1[_0xacef('0x1d')](_0x6871b9)[_0xacef('0x1e')](_0x13533c);}};}function respondWithFilteredResult(_0x281fbd,_0x2a07e4){return function(_0x15b4d1){if(_0x15b4d1){var _0x3cbb0c=typeof _0x2a07e4[_0xacef('0x1f')]===_0xacef('0x20')&&typeof _0x2a07e4[_0xacef('0x21')]==='undefined';var _0x5059c0=_0x15b4d1[_0xacef('0x22')];var _0x474236=_0x3cbb0c?0x0:_0x2a07e4['offset'];var _0x3a7d77=_0x3cbb0c?_0x15b4d1[_0xacef('0x22')]:_0x2a07e4['offset']+_0x2a07e4[_0xacef('0x21')];var _0x51e1f0;if(_0x3a7d77>=_0x5059c0){_0x3a7d77=_0x5059c0;_0x51e1f0=0xc8;}else{_0x51e1f0=0xce;}_0x281fbd[_0xacef('0x1d')](_0x51e1f0);return _0x281fbd['set']('Content-Range',_0x474236+'-'+_0x3a7d77+'/'+_0x5059c0)[_0xacef('0x1e')](_0x15b4d1);}return null;};}function saveUpdates(_0x44651b){return function(_0x9bc5aa){if(_0x9bc5aa){return _0x9bc5aa[_0xacef('0x23')](_0x44651b)[_0xacef('0x12')](function(_0x4a5835){return _0x4a5835;});}return null;};}function removeEntity(_0x47c8c6){return function(_0x562fb1){if(_0x562fb1){return _0x562fb1['destroy']()['then'](function(){var _0x5b5c89=_0x562fb1[_0xacef('0x24')]({'plain':!![]});var _0x512a6a='MailAccounts';return db['UserProfileResource'][_0xacef('0x25')]({'where':{'type':_0x512a6a,'resourceId':_0x5b5c89['id']}})[_0xacef('0x12')](function(){return _0x562fb1;});})[_0xacef('0x12')](function(){_0x47c8c6['status'](0xcc)[_0xacef('0x26')]();});}};}function handleEntityNotFound(_0x3961e3){return function(_0xce833c){if(!_0xce833c){_0x3961e3[_0xacef('0x27')](0x194);}return _0xce833c;};}function handleError(_0x4529cf,_0xf10ea8){_0xf10ea8=_0xf10ea8||0x1f4;return function(_0x36e87d){logger[_0xacef('0x17')](_0x36e87d[_0xacef('0x28')]);if(_0x36e87d[_0xacef('0x29')]){delete _0x36e87d[_0xacef('0x29')];}_0x4529cf[_0xacef('0x1d')](_0xf10ea8)[_0xacef('0x2a')](_0x36e87d);};}function getImapHost(_0x22402c){switch(_0x22402c){case _0xacef('0x2b'):return _0xacef('0x2c');case _0xacef('0x2d'):return _0xacef('0x2e');case _0xacef('0x2f'):return _0xacef('0x30');case _0xacef('0x31'):return _0xacef('0x32');}throw new Error(_0xacef('0x33'),_0x22402c);}function getSmtpHost(_0x15f242){switch(_0x15f242){case'gmail':return _0xacef('0x34');case _0xacef('0x2d'):return _0xacef('0x35');case _0xacef('0x2f'):return _0xacef('0x36');case _0xacef('0x31'):return _0xacef('0x37');}throw new Error('Unknown\x20email\x20service\x20provider',_0x15f242);}function getAuthenticationOptions(_0x31a9e7,_0x270ae0){var _0x2e2e83={};var _0x5a2cbd={};if(_0x31a9e7){_0x2e2e83[_0xacef('0x38')]=_0x5a2cbd[_0xacef('0x38')]=_0x270ae0['username'];_0x2e2e83[_0xacef('0x39')]=_0x5a2cbd['pass']=_0x270ae0[_0xacef('0x39')];if(_0x270ae0[_0xacef('0x3a')]){_0x2e2e83[_0xacef('0x3a')]=_0x5a2cbd[_0xacef('0x3a')]=!![];_0x2e2e83[_0xacef('0x3b')]=_0x5a2cbd['CloudProviderId']=_0x270ae0[_0xacef('0x3b')];_0x2e2e83[_0xacef('0x39')]=_0x5a2cbd[_0xacef('0x3c')]=null;}else{_0x2e2e83[_0xacef('0x3b')]=_0x5a2cbd[_0xacef('0x3b')]=null;}_0x2e2e83['host']=getImapHost(_0x31a9e7);_0x2e2e83['port']=0x3e1;_0x5a2cbd[_0xacef('0x3d')]=getSmtpHost(_0x31a9e7);_0x5a2cbd[_0xacef('0x3e')]=0x24b;_0x5a2cbd[_0xacef('0x3f')]=![];_0x2e2e83[_0xacef('0x40')]=_0x5a2cbd[_0xacef('0x40')]=null;}else{if(_0x270ae0[_0xacef('0x41')]){_0x2e2e83[_0xacef('0x38')]=_0x5a2cbd[_0xacef('0x38')]=_0x270ae0[_0xacef('0x42')];_0x2e2e83[_0xacef('0x39')]=_0x5a2cbd[_0xacef('0x3c')]=_0x270ae0[_0xacef('0x39')];}else{_0x2e2e83[_0xacef('0x41')]=_0x5a2cbd['authentication']=![];_0x2e2e83[_0xacef('0x38')]=_0x5a2cbd[_0xacef('0x38')]=null;_0x2e2e83[_0xacef('0x39')]=_0x5a2cbd[_0xacef('0x3c')]=null;}_0x2e2e83['host']=_0x270ae0[_0xacef('0x43')][_0xacef('0x3d')];_0x2e2e83['port']=_0x270ae0[_0xacef('0x43')][_0xacef('0x3e')];_0x5a2cbd[_0xacef('0x3d')]=_0x270ae0[_0xacef('0x44')][_0xacef('0x3d')];_0x5a2cbd['port']=_0x270ae0['Smtp'][_0xacef('0x3e')];}return{'Imap':_0x2e2e83,'Smtp':_0x5a2cbd};}exports[_0xacef('0x45')]=function(_0x79ced9,_0x32fa3a){var _0x3cfe71={'include':[{'model':db[_0xacef('0x46')],'as':_0xacef('0x43')},{'model':db[_0xacef('0x47')],'as':_0xacef('0x44')},{'model':db[_0xacef('0x48')],'as':_0xacef('0x49')}]},_0x28f0fb={},_0x48eb2c={'count':0x0,'rows':[]};var _0x25b486=_[_0xacef('0x4a')](db['MailAccount']['rawAttributes'],function(_0x23edc0){return{'name':_0x23edc0[_0xacef('0x4b')],'type':_0x23edc0['type'][_0xacef('0x4c')]};});_0x28f0fb[_0xacef('0x4d')]=_[_0xacef('0x4a')](_0x25b486,'name');_0x28f0fb[_0xacef('0x4e')]=_[_0xacef('0x4f')](_0x79ced9['query']);_0x28f0fb[_0xacef('0x50')]=_[_0xacef('0x51')](_0x28f0fb[_0xacef('0x4d')],_0x28f0fb[_0xacef('0x4e')]);_0x3cfe71[_0xacef('0x52')]=_['intersection'](_0x28f0fb['model'],qs[_0xacef('0x53')](_0x79ced9['query'][_0xacef('0x53')]));_0x3cfe71[_0xacef('0x52')]=_0x3cfe71['attributes'][_0xacef('0x54')]?_0x3cfe71[_0xacef('0x52')]:_0x28f0fb[_0xacef('0x4d')];if(!_0x79ced9[_0xacef('0x4e')][_0xacef('0x55')](_0xacef('0x56'))){_0x3cfe71[_0xacef('0x21')]=qs['limit'](_0x79ced9['query'][_0xacef('0x21')]);_0x3cfe71['offset']=qs[_0xacef('0x1f')](_0x79ced9[_0xacef('0x4e')]['offset']);}_0x3cfe71[_0xacef('0x57')]=qs['sort'](_0x79ced9[_0xacef('0x4e')]['sort']);_0x3cfe71['where']=qs[_0xacef('0x50')](_[_0xacef('0x58')](_0x79ced9['query'],_0x28f0fb[_0xacef('0x50')]),_0x25b486);if(_0x79ced9['query'][_0xacef('0x59')]){_0x3cfe71['where']=_['merge'](_0x3cfe71[_0xacef('0x5a')],{'$or':_[_0xacef('0x4a')](_0x25b486,function(_0xf8bea){if(_0xf8bea['type']!=='VIRTUAL'){var _0x32e13b={};_0x32e13b[_0xf8bea['name']]={'$like':'%'+_0x79ced9[_0xacef('0x4e')][_0xacef('0x59')]+'%'};return _0x32e13b;}})});}_0x3cfe71=_[_0xacef('0x5b')]({},_0x3cfe71,_0x79ced9[_0xacef('0x5c')]);var _0x3c919e={'where':_0x3cfe71[_0xacef('0x5a')]};return db[_0xacef('0x5d')][_0xacef('0x22')](_0x3c919e)[_0xacef('0x12')](function(_0x7d83cb){_0x48eb2c[_0xacef('0x22')]=_0x7d83cb;if(_0x79ced9['query']['includeAll']){_0x3cfe71[_0xacef('0x5e')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x3cfe71);})[_0xacef('0x12')](function(_0xd6336b){_0x48eb2c['rows']=_0xd6336b;return _0x48eb2c;})['then'](respondWithFilteredResult(_0x32fa3a,_0x3cfe71))[_0xacef('0x1c')](handleError(_0x32fa3a,null));};exports[_0xacef('0x5f')]=function(_0x1569b4,_0x3c2d61){var _0x2314ae={'raw':![],'where':{'id':_0x1569b4['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xacef('0x43')},{'model':db[_0xacef('0x47')],'as':_0xacef('0x44')},{'model':db['Pause'],'as':_0xacef('0x49')}]},_0x256682={};_0x256682[_0xacef('0x4d')]=_['keys'](db[_0xacef('0x5d')][_0xacef('0x60')]);_0x256682[_0xacef('0x4e')]=_[_0xacef('0x4f')](_0x1569b4[_0xacef('0x4e')]);_0x256682[_0xacef('0x50')]=_[_0xacef('0x51')](_0x256682[_0xacef('0x4d')],_0x256682[_0xacef('0x4e')]);_0x2314ae[_0xacef('0x52')]=_[_0xacef('0x51')](_0x256682['model'],qs['fields'](_0x1569b4[_0xacef('0x4e')][_0xacef('0x53')]));_0x2314ae['attributes']=_0x2314ae[_0xacef('0x52')][_0xacef('0x54')]?_0x2314ae['attributes']:_0x256682[_0xacef('0x4d')];if(_0x1569b4[_0xacef('0x4e')]['includeAll']){_0x2314ae[_0xacef('0x5e')]=[{'all':!![]}];}_0x2314ae=_[_0xacef('0x5b')]({},_0x2314ae,_0x1569b4['options']);return db[_0xacef('0x5d')][_0xacef('0x61')](_0x2314ae)['then'](handleEntityNotFound(_0x3c2d61,null))[_0xacef('0x12')](respondWithResult(_0x3c2d61,null))['catch'](handleError(_0x3c2d61,null));};exports[_0xacef('0x23')]=function(_0x1827aa,_0x19e361){if(_0x1827aa[_0xacef('0x62')]['id']){delete _0x1827aa[_0xacef('0x62')]['id'];}var _0x469125=_0x1827aa[_0xacef('0x62')][_0xacef('0x63')]===_0xacef('0x64')?null:_0x1827aa[_0xacef('0x62')][_0xacef('0x63')];var _0x25822a=_0x1827aa[_0xacef('0x62')][_0xacef('0x43')]||{};var _0x148c0d=_0x1827aa[_0xacef('0x62')]['Smtp']||{};if(_0x469125){_0x25822a[_0xacef('0x3d')]=getImapHost(_0x469125);_0x25822a[_0xacef('0x3e')]=0x3e1;_0x148c0d[_0xacef('0x3d')]=getSmtpHost(_0x469125);_0x148c0d[_0xacef('0x3e')]=0x24b;_0x148c0d[_0xacef('0x3f')]=![];}if(_0x148c0d['modernAuthentication']){_0x148c0d[_0xacef('0x3f')]=![];}else{_0x148c0d[_0xacef('0x3b')]=null;}if(!_0x25822a['modernAuthentication'])_0x25822a[_0xacef('0x3b')]=null;_0x1827aa['body'][_0xacef('0x43')]=_0x25822a;_0x1827aa[_0xacef('0x62')]['Smtp']=_0x148c0d;return db['MailAccount'][_0xacef('0x61')]({'where':{'id':_0x1827aa[_0xacef('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xacef('0x43')},{'model':db[_0xacef('0x47')],'as':_0xacef('0x44')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xacef('0x12')](handleEntityNotFound(_0x19e361,null))['then'](function(_0x243206){if(!_0x243206)throw new Error(_0xacef('0x66'));if(_0x243206[_0xacef('0x40')])delete _0x1827aa[_0xacef('0x62')][_0xacef('0x43')];return _0x243206;})[_0xacef('0x12')](saveUpdates(_0x1827aa[_0xacef('0x62')],null))[_0xacef('0x12')](function(_0x137a9f){if(!_0x1827aa[_0xacef('0x62')][_0xacef('0x43')])return _0x137a9f;return db[_0xacef('0x46')][_0xacef('0x23')](_0x1827aa[_0xacef('0x62')][_0xacef('0x43')],{'where':{'MailAccountId':_0x137a9f['id']}})[_0xacef('0x12')](function(){return _0x137a9f;});})['then'](function(_0x3a7dc9){if(!_0x1827aa['body'][_0xacef('0x44')])return _0x3a7dc9;return db[_0xacef('0x47')]['update'](_0x1827aa[_0xacef('0x62')][_0xacef('0x44')],{'where':{'MailAccountId':_0x3a7dc9['id']}})[_0xacef('0x12')](function(){return _0x3a7dc9;});})['then'](respondWithResult(_0x19e361,null))['catch'](handleError(_0x19e361,null));};exports[_0xacef('0x67')]=function(_0x313f71,_0x2d5e6d){return db[_0xacef('0x5d')][_0xacef('0x67')]()[_0xacef('0x12')](respondWithResult(_0x2d5e6d,null))[_0xacef('0x1c')](handleError(_0x2d5e6d,null));};exports[_0xacef('0x68')]=function(_0x3aebb7,_0x3e2f37){if(_0x3aebb7[_0xacef('0x62')]['id']){delete _0x3aebb7['body']['id'];}return db['MailAccount'][_0xacef('0x61')]({'where':{'id':_0x3aebb7[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x3e2f37,null))['then'](function(_0x5b8725){if(_0x5b8725){_0x3aebb7['body'][_0xacef('0x69')]=_0x5b8725['id'];return db[_0xacef('0x6a')][_0xacef('0x6b')](_0x3aebb7[_0xacef('0x62')]);}})[_0xacef('0x12')](respondWithResult(_0x3e2f37,null))[_0xacef('0x1c')](handleError(_0x3e2f37,null));};exports[_0xacef('0x6c')]=function(_0x3d71c9,_0x4f33ef){var _0x5a65fc={'raw':![],'where':{}};var _0x1b6d6a={};var _0x4c14f0={'count':0x0,'rows':[]};return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x3d71c9[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x4f33ef,null))['then'](function(_0x30f33e){if(_0x30f33e){_0x1b6d6a['model']=_['keys'](db[_0xacef('0x6a')][_0xacef('0x60')]);_0x1b6d6a[_0xacef('0x4e')]=_[_0xacef('0x4f')](_0x3d71c9['query']);_0x1b6d6a[_0xacef('0x50')]=_[_0xacef('0x51')](_0x1b6d6a[_0xacef('0x4d')],_0x1b6d6a['query']);_0x5a65fc[_0xacef('0x52')]=_[_0xacef('0x51')](_0x1b6d6a[_0xacef('0x4d')],qs[_0xacef('0x53')](_0x3d71c9[_0xacef('0x4e')][_0xacef('0x53')]));_0x5a65fc['attributes']=_0x5a65fc[_0xacef('0x52')][_0xacef('0x54')]?_0x5a65fc[_0xacef('0x52')]:_0x1b6d6a[_0xacef('0x4d')];if(!_0x3d71c9[_0xacef('0x4e')][_0xacef('0x55')](_0xacef('0x56'))){_0x5a65fc[_0xacef('0x21')]=qs[_0xacef('0x21')](_0x3d71c9[_0xacef('0x4e')][_0xacef('0x21')]);_0x5a65fc[_0xacef('0x1f')]=qs[_0xacef('0x1f')](_0x3d71c9[_0xacef('0x4e')][_0xacef('0x1f')]);}_0x5a65fc[_0xacef('0x57')]=qs['sort'](_0x3d71c9['query'][_0xacef('0x6e')]);_0x5a65fc[_0xacef('0x5a')]=qs['filters'](_[_0xacef('0x58')](_0x3d71c9[_0xacef('0x4e')],_0x1b6d6a[_0xacef('0x50')]));_0x5a65fc[_0xacef('0x5a')]['MailAccountId']=_0x30f33e['id'];if(_0x3d71c9['query'][_0xacef('0x59')]){_0x5a65fc['where']=_['merge'](_0x5a65fc[_0xacef('0x5a')],{'$or':_[_0xacef('0x4a')](_0x5a65fc[_0xacef('0x52')],function(_0x39dd30){var _0x4b0310={};_0x4b0310[_0x39dd30]={'$like':'%'+_0x3d71c9['query'][_0xacef('0x59')]+'%'};return _0x4b0310;})});}_0x5a65fc=_[_0xacef('0x5b')]({},_0x5a65fc,_0x3d71c9[_0xacef('0x5c')]);return db[_0xacef('0x6a')]['count']({'where':_0x5a65fc[_0xacef('0x5a')]})['then'](function(_0x151f9d){_0x4c14f0['count']=_0x151f9d;if(_0x3d71c9[_0xacef('0x4e')][_0xacef('0x6f')]){_0x5a65fc[_0xacef('0x5e')]=[{'all':!![]}];}return db[_0xacef('0x6a')]['findAll'](_0x5a65fc);})[_0xacef('0x12')](function(_0x2ade2d){_0x4c14f0[_0xacef('0x70')]=_0x2ade2d;return _0x4c14f0;});}})[_0xacef('0x12')](respondWithFilteredResult(_0x4f33ef,_0x5a65fc))['catch'](handleError(_0x4f33ef,null));};exports[_0xacef('0x71')]=function(_0x126d2b,_0x33dff1){return db[_0xacef('0x5d')][_0xacef('0x61')]({'where':{'id':_0x126d2b[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x33dff1,null))[_0xacef('0x12')](function(_0x272342){if(_0x272342){return _0x272342[_0xacef('0x71')](_0x126d2b[_0xacef('0x4e')][_0xacef('0x72')]);}})[_0xacef('0x12')](respondWithStatusCode(_0x33dff1,null))[_0xacef('0x1c')](handleError(_0x33dff1,null));};exports[_0xacef('0x73')]=function(_0xe61105,_0x3404d3){if(_0xe61105['body']['id']){delete _0xe61105[_0xacef('0x62')]['id'];}return db[_0xacef('0x5d')][_0xacef('0x61')]({'where':{'id':_0xe61105[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x3404d3,null))[_0xacef('0x12')](function(_0x55feff){if(_0x55feff){_0xe61105[_0xacef('0x62')][_0xacef('0x69')]=_0x55feff['id'];return db[_0xacef('0x74')][_0xacef('0x6b')](_0xe61105[_0xacef('0x62')]);}})['then'](respondWithResult(_0x3404d3,null))['catch'](handleError(_0x3404d3,null));};exports['getAnswers']=function(_0x22239c,_0x456f7b){var _0x3ccd91={'raw':![],'where':{}};var _0x11aa42={};var _0x1aa16d={'count':0x0,'rows':[]};return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x22239c[_0xacef('0x65')]['id']}})['then'](handleEntityNotFound(_0x456f7b,null))['then'](function(_0x5691c7){if(_0x5691c7){_0x11aa42[_0xacef('0x4d')]=_[_0xacef('0x4f')](db[_0xacef('0x74')][_0xacef('0x60')]);_0x11aa42[_0xacef('0x4e')]=_[_0xacef('0x4f')](_0x22239c[_0xacef('0x4e')]);_0x11aa42[_0xacef('0x50')]=_[_0xacef('0x51')](_0x11aa42['model'],_0x11aa42['query']);_0x3ccd91[_0xacef('0x52')]=_[_0xacef('0x51')](_0x11aa42['model'],qs[_0xacef('0x53')](_0x22239c['query']['fields']));_0x3ccd91[_0xacef('0x52')]=_0x3ccd91['attributes'][_0xacef('0x54')]?_0x3ccd91['attributes']:_0x11aa42[_0xacef('0x4d')];if(!_0x22239c[_0xacef('0x4e')][_0xacef('0x55')]('nolimit')){_0x3ccd91[_0xacef('0x21')]=qs[_0xacef('0x21')](_0x22239c[_0xacef('0x4e')][_0xacef('0x21')]);_0x3ccd91[_0xacef('0x1f')]=qs['offset'](_0x22239c[_0xacef('0x4e')][_0xacef('0x1f')]);}_0x3ccd91['order']=qs['sort'](_0x22239c[_0xacef('0x4e')][_0xacef('0x6e')]);_0x3ccd91[_0xacef('0x5a')]=qs['filters'](_[_0xacef('0x58')](_0x22239c['query'],_0x11aa42[_0xacef('0x50')]));_0x3ccd91[_0xacef('0x5a')][_0xacef('0x69')]=_0x5691c7['id'];if(_0x22239c[_0xacef('0x4e')][_0xacef('0x59')]){_0x3ccd91['where']=_[_0xacef('0x5b')](_0x3ccd91[_0xacef('0x5a')],{'$or':_['map'](_0x3ccd91['attributes'],function(_0x49cb6d){var _0x9264fa={};_0x9264fa[_0x49cb6d]={'$like':'%'+_0x22239c[_0xacef('0x4e')]['filter']+'%'};return _0x9264fa;})});}_0x3ccd91=_[_0xacef('0x5b')]({},_0x3ccd91,_0x22239c[_0xacef('0x5c')]);return db['CannedAnswer']['count']({'where':_0x3ccd91[_0xacef('0x5a')]})['then'](function(_0x587a9e){_0x1aa16d[_0xacef('0x22')]=_0x587a9e;if(_0x22239c[_0xacef('0x4e')][_0xacef('0x6f')]){_0x3ccd91[_0xacef('0x5e')]=[{'all':!![]}];}return db[_0xacef('0x74')][_0xacef('0x75')](_0x3ccd91);})[_0xacef('0x12')](function(_0x468bb9){_0x1aa16d[_0xacef('0x70')]=_0x468bb9;return _0x1aa16d;});}})[_0xacef('0x12')](respondWithFilteredResult(_0x456f7b,_0x3ccd91))['catch'](handleError(_0x456f7b,null));};exports['removeAnswers']=function(_0x1f941a,_0xad9c5a){return db['MailAccount']['find']({'where':{'id':_0x1f941a[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0xad9c5a,null))['then'](function(_0x2084a1){if(_0x2084a1){return _0x2084a1[_0xacef('0x76')](_0x1f941a[_0xacef('0x4e')]['ids']);}})['then'](respondWithStatusCode(_0xad9c5a,null))[_0xacef('0x1c')](handleError(_0xad9c5a,null));};exports[_0xacef('0x6b')]=function(_0x575727,_0x4a92c9){var _0x422285={'name':_0x575727[_0xacef('0x62')][_0xacef('0x29')],'key':_0x575727[_0xacef('0x62')][_0xacef('0x4c')],'provider':_0x575727[_0xacef('0x62')][_0xacef('0x63')]==='custom'?null:_0x575727[_0xacef('0x62')][_0xacef('0x63')],'email':_0x575727[_0xacef('0x62')][_0xacef('0x77')],'ListId':_0x575727['body']['ListId'],'active':!_['isNil'](_0x575727[_0xacef('0x62')][_0xacef('0x78')])?_0x575727['body'][_0xacef('0x78')]:!![],'description':_0x575727[_0xacef('0x62')][_0xacef('0x79')]||null};var _0x14d139=getAuthenticationOptions(_0x422285[_0xacef('0x63')],_0x575727[_0xacef('0x62')]);_0x422285[_0xacef('0x43')]=_0x14d139[_0xacef('0x43')];_0x422285[_0xacef('0x44')]=_0x14d139[_0xacef('0x44')];return db['MailAccount'][_0xacef('0x6b')](_0x422285,{'include':[{'model':db[_0xacef('0x47')],'as':_0xacef('0x44')},{'model':db[_0xacef('0x46')],'as':'Imap'}]})['then'](function(_0x2938e6){var _0x20e9b1=_0x575727[_0xacef('0x38')]['get']({'plain':!![]});if(!_0x20e9b1)throw new Error(_0xacef('0x7a'));if(_0x20e9b1[_0xacef('0x7b')]==='user'){var _0x7f851f=_0x2938e6[_0xacef('0x24')]({'plain':!![]});return db[_0xacef('0x7c')][_0xacef('0x61')]({'where':{'name':_0xacef('0x7d'),'userProfileId':_0x20e9b1[_0xacef('0x7e')]},'raw':!![]})[_0xacef('0x12')](function(_0x280035){if(_0x280035&&_0x280035[_0xacef('0x7f')]===0x0){return db[_0xacef('0x80')][_0xacef('0x6b')]({'name':_0x7f851f[_0xacef('0x29')],'resourceId':_0x7f851f['id'],'type':_0x280035['name'],'sectionId':_0x280035['id']},{})[_0xacef('0x12')](function(){return _0x2938e6;});}else{return _0x2938e6;}})['catch'](function(_0x177c66){logger[_0xacef('0x17')](_0xacef('0x81'),_0x177c66);throw _0x177c66;});}return _0x2938e6;})['then'](respondWithResult(_0x4a92c9,0xc9))[_0xacef('0x1c')](handleError(_0x4a92c9,null));};exports[_0xacef('0x82')]=function(_0x47349a,_0x182ec3){return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x47349a['params']['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x182ec3,null))[_0xacef('0x12')](function(_0x24cebb){if(_0x24cebb){return _0x24cebb[_0xacef('0x82')]();}return null;})[_0xacef('0x12')](respondWithResult(_0x182ec3,null))[_0xacef('0x1c')](handleError(_0x182ec3,null));};exports['addImap']=function(_0x327516,_0x46008a){if(_0x327516[_0xacef('0x62')]['id']){delete _0x327516[_0xacef('0x62')]['id'];}return db['MailAccount'][_0xacef('0x61')]({'where':{'id':_0x327516['params']['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x46008a,null))[_0xacef('0x12')](function(_0x354826){if(_0x354826){_0x327516['body'][_0xacef('0x69')]=_0x354826['id'];return db[_0xacef('0x46')]['create'](_0x327516['body']);}})[_0xacef('0x12')](respondWithResult(_0x46008a,null))['catch'](handleError(_0x46008a,null));};exports[_0xacef('0x83')]=function(_0x9782df,_0x232230){return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x9782df[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x232230,null))[_0xacef('0x12')](function(_0x3dd10f){if(_0x3dd10f){return _0x3dd10f[_0xacef('0x84')](null);}return null;})[_0xacef('0x12')](respondWithStatusCode(_0x232230,null))['catch'](handleError(_0x232230,null));};exports[_0xacef('0x85')]=function(_0x55f031,_0x40e650){return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x55f031['params']['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x40e650,null))[_0xacef('0x12')](function(_0x4238b8){if(_0x4238b8){return _0x4238b8[_0xacef('0x85')]();}return null;})['then'](respondWithResult(_0x40e650,null))['catch'](handleError(_0x40e650,null));};exports[_0xacef('0x86')]=function(_0x3c5ee8,_0x1b2b45){if(_0x3c5ee8[_0xacef('0x62')]['id']){delete _0x3c5ee8[_0xacef('0x62')]['id'];}return db['MailAccount'][_0xacef('0x61')]({'where':{'id':_0x3c5ee8[_0xacef('0x65')]['id']}})['then'](handleEntityNotFound(_0x1b2b45,null))['then'](function(_0x52ba9f){if(_0x52ba9f){_0x3c5ee8[_0xacef('0x62')][_0xacef('0x69')]=_0x52ba9f['id'];return db[_0xacef('0x47')][_0xacef('0x6b')](_0x3c5ee8[_0xacef('0x62')]);}})[_0xacef('0x12')](respondWithResult(_0x1b2b45,null))[_0xacef('0x1c')](handleError(_0x1b2b45,null));};exports['removeSmtp']=function(_0x82a474,_0xd480fd){return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x82a474[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0xd480fd,null))[_0xacef('0x12')](function(_0x14500f){if(_0x14500f){return _0x14500f['setSmtp'](null);}return null;})[_0xacef('0x12')](respondWithStatusCode(_0xd480fd,null))['catch'](handleError(_0xd480fd,null));};exports[_0xacef('0x87')]=function(_0xfc3c61,_0x3f6af5){return db['MailInteraction']['find']({'where':{'id':_0xfc3c61[_0xacef('0x65')]['id']}})['then'](handleEntityNotFound(_0x3f6af5,null))[_0xacef('0x12')](function(_0x552df1){if(_0x552df1){return _0x552df1[_0xacef('0x87')](_0xfc3c61[_0xacef('0x62')][_0xacef('0x72')],_[_0xacef('0x88')](_0xfc3c61[_0xacef('0x62')],[_0xacef('0x72'),'id'])||{});}})['then'](respondWithResult(_0x3f6af5,null))[_0xacef('0x1c')](handleError(_0x3f6af5,null));};exports['getInteractions']=function(_0x87ee58,_0x286c53){var _0x492408={'raw':![],'where':{}};var _0x4d8b26={};var _0x30ba5d={'count':0x0,'rows':[]};return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x87ee58['params']['id']}})['then'](handleEntityNotFound(_0x286c53,null))[_0xacef('0x12')](function(_0x3f37ad){if(_0x3f37ad){_0x4d8b26['model']=_[_0xacef('0x4f')](db[_0xacef('0x89')][_0xacef('0x60')]);_0x4d8b26['query']=_[_0xacef('0x4f')](_0x87ee58[_0xacef('0x4e')]);_0x4d8b26['filters']=_[_0xacef('0x51')](_0x4d8b26[_0xacef('0x4d')],_0x4d8b26[_0xacef('0x4e')]);_0x492408[_0xacef('0x52')]=_['intersection'](_0x4d8b26[_0xacef('0x4d')],qs[_0xacef('0x53')](_0x87ee58[_0xacef('0x4e')][_0xacef('0x53')]));_0x492408[_0xacef('0x52')]=_0x492408['attributes'][_0xacef('0x54')]?_0x492408['attributes']:_0x4d8b26[_0xacef('0x4d')];if(!_0x87ee58[_0xacef('0x4e')][_0xacef('0x55')](_0xacef('0x56'))){_0x492408[_0xacef('0x21')]=qs[_0xacef('0x21')](_0x87ee58['query'][_0xacef('0x21')]);_0x492408[_0xacef('0x1f')]=qs['offset'](_0x87ee58['query'][_0xacef('0x1f')]);}_0x492408[_0xacef('0x57')]=qs[_0xacef('0x6e')](_0x87ee58[_0xacef('0x4e')][_0xacef('0x6e')]);_0x492408[_0xacef('0x5a')]=qs[_0xacef('0x50')](_[_0xacef('0x58')](_0x87ee58[_0xacef('0x4e')],_0x4d8b26[_0xacef('0x50')]));_0x492408[_0xacef('0x5a')]['MailAccountId']=_0x3f37ad['id'];if(_0x87ee58[_0xacef('0x4e')]['filter']){_0x492408[_0xacef('0x5a')]=_[_0xacef('0x5b')](_0x492408[_0xacef('0x5a')],{'$or':_[_0xacef('0x4a')](_0x492408[_0xacef('0x52')],function(_0x464d55){var _0x5569c0={};_0x5569c0[_0x464d55]={'$like':'%'+_0x87ee58[_0xacef('0x4e')][_0xacef('0x59')]+'%'};return _0x5569c0;})});}_0x492408=_[_0xacef('0x5b')]({},_0x492408,_0x87ee58[_0xacef('0x5c')]);return db[_0xacef('0x89')]['count']({'where':_0x492408[_0xacef('0x5a')]})['then'](function(_0x28b822){_0x30ba5d[_0xacef('0x22')]=_0x28b822;if(_0x87ee58[_0xacef('0x4e')][_0xacef('0x6f')]){_0x492408[_0xacef('0x5e')]=[{'model':db[_0xacef('0x8a')],'as':'Contact','required':![]},{'model':db[_0xacef('0x8b')],'as':'Owner','attributes':[_0xacef('0x29'),_0xacef('0x8c'),'internal'],'required':![]},{'model':db[_0xacef('0x8d')],'as':_0xacef('0x8e'),'attributes':['id',_0xacef('0x29'),_0xacef('0x8f')],'where':_0x87ee58[_0xacef('0x4e')][_0xacef('0x90')]?{'id':_0x87ee58[_0xacef('0x4e')][_0xacef('0x90')]}:undefined,'required':_0x87ee58[_0xacef('0x4e')][_0xacef('0x90')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x492408);})[_0xacef('0x12')](function(_0x5a5dee){_0x30ba5d[_0xacef('0x70')]=_0x5a5dee;return _0x30ba5d;});}})[_0xacef('0x12')](respondWithFilteredResult(_0x286c53,_0x492408))['catch'](handleError(_0x286c53,null));};exports[_0xacef('0x91')]=function addApplications(_0x34dcb8,_0x3c125d){var _0x301b71=_0x34dcb8[_0xacef('0x65')]['id'];var _0x12a5cf=_0x34dcb8['body'];var _0x53ba09=0xc8;var _0x2231f0=null;return db[_0xacef('0x92')][_0xacef('0x93')]({'isolationLevel':db[_0xacef('0x92')][_0xacef('0x94')]['ISOLATION_LEVELS'][_0xacef('0x95')]},function(_0x512389){return db[_0xacef('0x5d')]['findOne']({'where':{'id':_0x301b71},'transaction':_0x512389})[_0xacef('0x12')](function(_0x595b97){if(_0x595b97){return db[_0xacef('0x96')][_0xacef('0x25')]({'where':{'MailAccountId':_0x301b71},'transaction':_0x512389})['then'](function(){var _0x2d8628=_[_0xacef('0x4a')](_0x12a5cf,function(_0x5ba0d3){_0x5ba0d3[_0xacef('0x69')]=_0x301b71;return _0x5ba0d3;});return db[_0xacef('0x96')][_0xacef('0x97')](_0x2d8628,{'transaction':_0x512389});});}else{_0x53ba09=0x194;_0x2231f0=[];}});})[_0xacef('0x12')](function(){if(_0x53ba09!==0x194){return db[_0xacef('0x96')][_0xacef('0x98')]({'where':{'MailAccountId':_0x301b71},'order':_0xacef('0x99')})[_0xacef('0x12')](function(_0x2d3282){_0x2231f0=_0x2d3282;});}})['catch'](function(_0x19c3a4){_0x53ba09=0x1f4;logger['error'](_0x19c3a4[_0xacef('0x28')]);if(_0x19c3a4[_0xacef('0x29')]){delete _0x19c3a4[_0xacef('0x29')];}_0x2231f0=_0x19c3a4;})[_0xacef('0x9a')](function(){if(_0x2231f0===null){_0x3c125d[_0xacef('0x27')](_0x53ba09);}else{if(_0x53ba09===0x1f4){_0x3c125d['status'](_0x53ba09)['send'](_0x2231f0);}else{_0x3c125d['status'](_0x53ba09)[_0xacef('0x1e')](_0x2231f0);}}});};exports['getApplications']=function(_0x481adc,_0x4e7f80){var _0x2a656d={};var _0x184503={};var _0x13930f;var _0x230074;return db[_0xacef('0x5d')][_0xacef('0x6d')]({'where':{'id':_0x481adc[_0xacef('0x65')]['id']}})['then'](handleEntityNotFound(_0x4e7f80,null))[_0xacef('0x12')](function(_0x278cff){if(_0x278cff){_0x13930f=_0x278cff;_0x184503[_0xacef('0x4d')]=_[_0xacef('0x4f')](db['MailApplication'][_0xacef('0x60')]);_0x184503[_0xacef('0x4e')]=_[_0xacef('0x4f')](_0x481adc['query']);_0x184503[_0xacef('0x50')]=_['intersection'](_0x184503[_0xacef('0x4d')],_0x184503[_0xacef('0x4e')]);_0x2a656d[_0xacef('0x52')]=_['intersection'](_0x184503[_0xacef('0x4d')],qs['fields'](_0x481adc[_0xacef('0x4e')]['fields']));_0x2a656d[_0xacef('0x52')]=_0x2a656d[_0xacef('0x52')]['length']?_0x2a656d[_0xacef('0x52')]:_0x184503[_0xacef('0x4d')];_0x2a656d['order']=qs['sort'](_0x481adc[_0xacef('0x4e')][_0xacef('0x6e')]);_0x2a656d[_0xacef('0x5a')]=qs[_0xacef('0x50')](_[_0xacef('0x58')](_0x481adc['query'],_0x184503[_0xacef('0x50')]));if(_0x481adc[_0xacef('0x4e')]['filter']){_0x2a656d[_0xacef('0x5a')]=_[_0xacef('0x5b')](_0x2a656d[_0xacef('0x5a')],{'$or':_[_0xacef('0x4a')](_0x2a656d[_0xacef('0x52')],function(_0x3a7948){var _0x5ebc3d={};_0x5ebc3d[_0x3a7948]={'$like':'%'+_0x481adc[_0xacef('0x4e')][_0xacef('0x59')]+'%'};return _0x5ebc3d;})});}_0x2a656d=_['merge']({},_0x2a656d,_0x481adc[_0xacef('0x5c')]);return _0x13930f[_0xacef('0x9b')](_0x2a656d);}})[_0xacef('0x12')](function(_0xcb9d56){if(_0xcb9d56){_0x230074=_0xcb9d56[_0xacef('0x54')];if(!_0x481adc[_0xacef('0x4e')][_0xacef('0x55')]('nolimit')){_0x2a656d[_0xacef('0x21')]=qs['limit'](_0x481adc[_0xacef('0x4e')][_0xacef('0x21')]);_0x2a656d[_0xacef('0x1f')]=qs['offset'](_0x481adc[_0xacef('0x4e')][_0xacef('0x1f')]);}return _0x13930f['getApplications'](_0x2a656d);}})[_0xacef('0x12')](function(_0x18110d){if(_0x18110d){return _0x18110d?{'count':_0x230074,'rows':_0x18110d}:null;}})[_0xacef('0x12')](respondWithResult(_0x4e7f80,null))[_0xacef('0x1c')](handleError(_0x4e7f80,null));};exports['getMessages']=function(_0x317857,_0x50189b){var _0x385845={'raw':!![],'where':{}};var _0x109dc7={};var _0x24c47f={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x317857[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x50189b,null))[_0xacef('0x12')](function(_0x34567e){if(_0x34567e){_0x109dc7['model']=_[_0xacef('0x4f')](db[_0xacef('0x9c')][_0xacef('0x60')]);_0x109dc7[_0xacef('0x4e')]=_['keys'](_0x317857[_0xacef('0x4e')]);_0x109dc7['filters']=_[_0xacef('0x51')](_0x109dc7[_0xacef('0x4d')],_0x109dc7[_0xacef('0x4e')]);_0x385845[_0xacef('0x52')]=_[_0xacef('0x51')](_0x109dc7['model'],qs['fields'](_0x317857['query'][_0xacef('0x53')]));_0x385845[_0xacef('0x52')]=_0x385845[_0xacef('0x52')]['length']?_0x385845[_0xacef('0x52')]:_0x109dc7[_0xacef('0x4d')];if(!_0x317857[_0xacef('0x4e')]['hasOwnProperty'](_0xacef('0x56'))){_0x385845[_0xacef('0x21')]=qs[_0xacef('0x21')](_0x317857[_0xacef('0x4e')]['limit']);_0x385845[_0xacef('0x1f')]=qs['offset'](_0x317857[_0xacef('0x4e')][_0xacef('0x1f')]);}_0x385845[_0xacef('0x57')]=qs['sort'](_0x317857[_0xacef('0x4e')][_0xacef('0x6e')]);_0x385845['where']=qs[_0xacef('0x50')](_[_0xacef('0x58')](_0x317857['query'],_0x109dc7[_0xacef('0x50')]));_0x385845[_0xacef('0x5a')][_0xacef('0x69')]=_0x34567e['id'];if(_0x317857[_0xacef('0x4e')][_0xacef('0x59')]){_0x385845[_0xacef('0x5a')]=_[_0xacef('0x5b')](_0x385845[_0xacef('0x5a')],{'$or':_['map'](_0x385845[_0xacef('0x52')],function(_0x4ea41a){var _0x17101d={};_0x17101d[_0x4ea41a]={'$like':'%'+_0x317857[_0xacef('0x4e')][_0xacef('0x59')]+'%'};return _0x17101d;})});}if(_0x317857[_0xacef('0x4e')][_0xacef('0x9d')]){var _0x5d2642=_0x317857[_0xacef('0x4e')]['$gte']['split'](',');var _0x9e8a={};_0x9e8a[_0x5d2642[0x0]]={'$gte':moment(_0x5d2642[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x385845[_0xacef('0x5a')]=_[_0xacef('0x5b')](_0x385845[_0xacef('0x5a')],_0x9e8a);}_0x385845=_[_0xacef('0x5b')]({},_0x385845,_0x317857['options']);return db[_0xacef('0x9c')][_0xacef('0x22')]({'where':_0x385845[_0xacef('0x5a')]})[_0xacef('0x12')](function(_0x55dd1f){_0x24c47f['count']=_0x55dd1f;if(_0x317857['query'][_0xacef('0x6f')]){_0x385845[_0xacef('0x5e')]=[{'all':!![]}];}return db[_0xacef('0x9c')][_0xacef('0x75')](_0x385845);})[_0xacef('0x12')](function(_0x2bde73){if(_0x317857[_0xacef('0x4e')][_0xacef('0x9e')]===_0xacef('0x9f')){for(var _0x3477cf=0x0;_0x3477cf<_0x2bde73[_0xacef('0x54')];_0x3477cf++){_0x2bde73[_0x3477cf][_0xacef('0x62')]=juice(_0x2bde73[_0x3477cf][_0xacef('0x62')]);}}_0x24c47f['rows']=_0x2bde73;return _0x24c47f;});}})['then'](respondWithFilteredResult(_0x50189b,_0x385845))['catch'](handleError(_0x50189b,null));};exports['send']=function(_0x326eab,_0x1f704d){var _0x133f6d,_0x130306={},_0x5cbe27;if(_0x326eab[_0xacef('0x62')]['to']){_0x5cbe27=_0x326eab[_0xacef('0x62')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xacef('0x61')]({'where':{'id':_0x326eab[_0xacef('0x65')]['id']},'include':[{'model':db[_0xacef('0xa0')],'as':'List','include':[{'model':db[_0xacef('0x8a')],'as':_0xacef('0xa1'),'where':{'email':_0x5cbe27},'limit':0x1,'order':[[_0xacef('0xa2'),_0xacef('0xa3')]]}]},{'model':db[_0xacef('0x47')],'as':_0xacef('0x44'),'raw':!![],'include':[{'model':db[_0xacef('0xa4')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x1f704d,null))[_0xacef('0x12')](function(_0x157b08){if(!_0x157b08)return;_0x133f6d=_0x157b08;if(!_0x157b08[_0xacef('0x44')])throw new Error(_0xacef('0xa5'));if(_[_0xacef('0xa6')](_0x326eab[_0xacef('0x62')][_0xacef('0xa7')])){_0x326eab[_0xacef('0x62')][_0xacef('0xa7')]=util[_0xacef('0xa8')](_0xacef('0xa9'),_0x157b08[_0xacef('0x29')],_0x157b08[_0xacef('0x77')]||_0x157b08['Smtp'][_0xacef('0x38')]);}if(_0x326eab[_0xacef('0x62')][_0xacef('0xaa')]&&_0x326eab[_0xacef('0x62')][_0xacef('0xaa')][_0xacef('0x54')]){for(var _0x4dfb64=0x0;_0x4dfb64<_0x326eab[_0xacef('0x62')]['attachments'][_0xacef('0x54')];_0x4dfb64+=0x1){_0x326eab[_0xacef('0x62')][_0xacef('0xaa')][_0x4dfb64]={'filename':_0x326eab[_0xacef('0x62')][_0xacef('0xaa')][_0x4dfb64][_0xacef('0x29')],'path':path[_0xacef('0xab')](config['root'],_0xacef('0xac'),_0x326eab[_0xacef('0x62')]['attachments'][_0x4dfb64][_0xacef('0xad')])};}}var _0x1e1f49=_0x157b08[_0xacef('0xae')]();return respondWithRpcPromise(_0xacef('0xaf'),_0xacef('0xb0'),{'account':_0x1e1f49,'message':_0x326eab[_0xacef('0x62')]});})[_0xacef('0x12')](function(_0x3b9306){if(!_0x3b9306)return;_0x130306=_0x3b9306;if(!_0x133f6d[_0xacef('0xb1')])throw new Error('List\x20not\x20found');if(_0x133f6d[_0xacef('0xb1')][_0xacef('0xa1')][_0xacef('0x54')])return _0x133f6d[_0xacef('0xb1')][_0xacef('0xa1')][0x0];return db['CmContact'][_0xacef('0x6b')](_[_0xacef('0xb')](_0x326eab[_0xacef('0x62')],{'firstName':_0x326eab[_0xacef('0x62')]['to'],'email':_0x326eab[_0xacef('0x62')]['to'],'phone':_0x326eab[_0xacef('0x62')]['to'],'ListId':_0x133f6d[_0xacef('0xb2')]}));})[_0xacef('0x12')](function(_0x1df18a){if(!_0x1df18a)return;var _0x2bcd7c={'UserId':_0x326eab[_0xacef('0x38')]['id'],'ContactId':_0x1df18a['id'],'MailAccountId':_0x133f6d['id'],'inReplyTo':_0x130306[_0xacef('0xb3')],'to':_0x326eab[_0xacef('0x62')][_0xacef('0xa7')],'cc':_0x326eab[_0xacef('0x62')]['cc'],'subject':_0x326eab[_0xacef('0x62')][_0xacef('0xb4')],'attach':_0x326eab[_0xacef('0x62')][_0xacef('0xb5')],'firstMsgDirection':_0xacef('0xb6'),'lastMsgAt':moment()[_0xacef('0xa8')](_0xacef('0xb7')),'lastMsgDirection':'out','Messages':[_['merge'](_0x326eab[_0xacef('0x62')],{'messageId':_0x130306[_0xacef('0xb3')],'sentAt':moment()['format'](_0xacef('0xb7')),'read':!![],'MailAccountId':_0x133f6d['id'],'UserId':_0x326eab['user']['id'],'ContactId':_0x1df18a['id']})]};if(_0x326eab[_0xacef('0x62')]['Interaction']){_0x2bcd7c=_[_0xacef('0x5b')](_0x2bcd7c,_0x326eab[_0xacef('0x62')][_0xacef('0xb8')]);}return db[_0xacef('0x89')][_0xacef('0x6b')](_0x2bcd7c,{'include':[{'model':db[_0xacef('0x9c')],'as':_0xacef('0xb9')}]});})[_0xacef('0x12')](respondWithResult(_0x1f704d,null))[_0xacef('0x1c')](handleError(_0x1f704d,null));};exports[_0xacef('0xba')]=function(_0x8ec3cc,_0x43d0e9){return db[_0xacef('0x5d')][_0xacef('0x61')]({'where':{'id':_0x8ec3cc[_0xacef('0x65')]['id']},'include':[{'model':db[_0xacef('0x47')],'as':_0xacef('0x44'),'raw':!![],'include':[{'model':db[_0xacef('0xa4')],'as':_0xacef('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x43d0e9,null))[_0xacef('0x12')](function(_0x22c1de){if(!_0x22c1de[_0xacef('0x44')])return;var _0x2421be=_0x22c1de['getSmtpOptions']();return respondWithRpcPromise(_0xacef('0xbb'),_0xacef('0xba'),{'account':_0x2421be});})[_0xacef('0x12')](respondWithResult(_0x43d0e9,null))[_0xacef('0x1c')](handleError(_0x43d0e9,null));};exports[_0xacef('0x25')]=function(_0x1dd599,_0x788e6a){return db[_0xacef('0x5d')][_0xacef('0x61')]({'where':{'id':_0x1dd599[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x788e6a,null))['then'](function(_0x5988f5){if(_0x5988f5&&_0x5988f5['service']){throw new db['Sequelize'][(_0xacef('0xbc'))](_0xacef('0xbd'));}return _0x5988f5;})[_0xacef('0x12')](removeEntity(_0x788e6a,null))[_0xacef('0x1c')](handleError(_0x788e6a,null));};exports[_0xacef('0xbe')]=function(_0x114a8c,_0x3f100b){return db['MailAccount'][_0xacef('0x61')]({'where':{'id':_0x114a8c[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x3f100b,null))[_0xacef('0x12')](function(_0x174a35){if(_0x174a35){return _0x174a35[_0xacef('0xbe')](_0x114a8c[_0xacef('0x62')][_0xacef('0x72')],_[_0xacef('0x88')](_0x114a8c[_0xacef('0x62')],[_0xacef('0x72'),'id'])||{})[_0xacef('0xbf')](function(_0x41b06f){for(var _0x436e25=0x0;_0x436e25<_0x114a8c[_0xacef('0x62')][_0xacef('0x72')]['length'];_0x436e25+=0x1){socket[_0xacef('0xc0')](_0xacef('0xc1'),{'UserId':Number(_0x114a8c[_0xacef('0x62')]['ids'][_0x436e25]),'MailAccountId':Number(_0x114a8c[_0xacef('0x65')]['id'])});}return _0x41b06f;});}})[_0xacef('0x12')](respondWithResult(_0x3f100b,null))[_0xacef('0x1c')](handleError(_0x3f100b,null));};exports[_0xacef('0xc2')]=function(_0x277fb4,_0xe069f1){return db[_0xacef('0x5d')][_0xacef('0x61')]({'where':{'id':_0x277fb4[_0xacef('0x65')]['id']}})[_0xacef('0x12')](handleEntityNotFound(_0xe069f1,null))['then'](function(_0x2b2968){if(_0x2b2968){return _0x2b2968['removeAgents'](_0x277fb4[_0xacef('0x4e')][_0xacef('0x72')])[_0xacef('0x12')](function(){if(_[_0xacef('0xc3')](_0x277fb4['query'][_0xacef('0x72')])){for(var _0x1881ee=0x0;_0x1881ee<_0x277fb4[_0xacef('0x4e')]['ids'][_0xacef('0x54')];_0x1881ee+=0x1){socket[_0xacef('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x277fb4[_0xacef('0x4e')][_0xacef('0x72')][_0x1881ee]),'MailAccountId':Number(_0x277fb4[_0xacef('0x65')]['id'])});}}else{socket[_0xacef('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x277fb4[_0xacef('0x4e')]['ids']),'MailAccountId':Number(_0x277fb4['params']['id'])});}});}})[_0xacef('0x12')](respondWithStatusCode(_0xe069f1,null))[_0xacef('0x1c')](handleError(_0xe069f1,null));};exports[_0xacef('0xc4')]=function(_0x7de160,_0x3da2f9){var _0x28f546={};var _0x30e9e3={};var _0x5eedd7;var _0x139d0f;return db['MailAccount']['findOne']({'where':{'id':_0x7de160['params']['id']}})[_0xacef('0x12')](handleEntityNotFound(_0x3da2f9,null))[_0xacef('0x12')](function(_0x24ce41){if(_0x24ce41){_0x5eedd7=_0x24ce41;_0x30e9e3[_0xacef('0x4d')]=_[_0xacef('0x4f')](db['User']['rawAttributes']);_0x30e9e3['query']=_[_0xacef('0x4f')](_0x7de160[_0xacef('0x4e')]);_0x30e9e3[_0xacef('0x50')]=_[_0xacef('0x51')](_0x30e9e3[_0xacef('0x4d')],_0x30e9e3[_0xacef('0x4e')]);_0x28f546[_0xacef('0x52')]=_[_0xacef('0x51')](_0x30e9e3[_0xacef('0x4d')],qs['fields'](_0x7de160[_0xacef('0x4e')]['fields']));_0x28f546['attributes']=_0x28f546['attributes'][_0xacef('0x54')]?_0x28f546[_0xacef('0x52')]:_0x30e9e3[_0xacef('0x4d')];_0x28f546[_0xacef('0x57')]=qs[_0xacef('0x6e')](_0x7de160['query'][_0xacef('0x6e')]);_0x28f546['where']=qs[_0xacef('0x50')](_[_0xacef('0x58')](_0x7de160[_0xacef('0x4e')],_0x30e9e3['filters']));if(_0x7de160['query'][_0xacef('0x59')]){_0x28f546[_0xacef('0x5a')]=_[_0xacef('0x5b')](_0x28f546[_0xacef('0x5a')],{'$or':_[_0xacef('0x4a')](_0x28f546[_0xacef('0x52')],function(_0xe83fba){var _0xe251ab={};_0xe251ab[_0xe83fba]={'$like':'%'+_0x7de160[_0xacef('0x4e')][_0xacef('0x59')]+'%'};return _0xe251ab;})});}_0x28f546=_[_0xacef('0x5b')]({},_0x28f546,_0x7de160[_0xacef('0x5c')]);return _0x5eedd7[_0xacef('0xc4')](_0x28f546);}})[_0xacef('0x12')](function(_0x1e3ec2){if(_0x1e3ec2){_0x139d0f=_0x1e3ec2[_0xacef('0x54')];if(!_0x7de160[_0xacef('0x4e')][_0xacef('0x55')]('nolimit')){_0x28f546[_0xacef('0x21')]=qs['limit'](_0x7de160['query'][_0xacef('0x21')]);_0x28f546[_0xacef('0x1f')]=qs[_0xacef('0x1f')](_0x7de160[_0xacef('0x4e')][_0xacef('0x1f')]);}return _0x5eedd7[_0xacef('0xc4')](_0x28f546);}})[_0xacef('0x12')](function(_0x2b0e9b){if(_0x2b0e9b){return _0x2b0e9b?{'count':_0x139d0f,'rows':_0x2b0e9b}:null;}})[_0xacef('0x12')](respondWithResult(_0x3da2f9,null))[_0xacef('0x1c')](handleError(_0x3da2f9,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2c520b2..8fcf436 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 _0xc165=['update','emit','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc165,0x199));var _0x5c16=function(_0x3f52a1,_0x1aaa20){_0x3f52a1=_0x3f52a1-0x0;var _0xf98fb7=_0xc165[_0x3f52a1];return _0xf98fb7;};'use strict';var EventEmitter=require(_0x5c16('0x0'));var MailAccount=require(_0x5c16('0x1'))['db'][_0x5c16('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5c16('0x3')](0x0);var events={'afterCreate':_0x5c16('0x4'),'afterUpdate':_0x5c16('0x5'),'afterDestroy':'remove'};function emitEvent(_0x25ffce){return function(_0x20b0b0,_0x549c80,_0x5db36f){MailAccountEvents[_0x5c16('0x6')](_0x25ffce+':'+_0x20b0b0['id'],_0x20b0b0);MailAccountEvents[_0x5c16('0x6')](_0x25ffce,_0x20b0b0);_0x5db36f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x5c16('0x7')](e,emitEvent(event));}}module[_0x5c16('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xa742=['exports','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa742,0xc7));var _0x2a74=function(_0x2e16c4,_0x190da2){_0x2e16c4=_0x2e16c4-0x0;var _0x37db41=_0xa742[_0x2e16c4];return _0x37db41;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2a74('0x0')](0x0);var events={'afterCreate':_0x2a74('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b4081){return function(_0x555ddc,_0x460764,_0x45bb06){MailAccountEvents[_0x2a74('0x2')](_0x3b4081+':'+_0x555ddc['id'],_0x555ddc);MailAccountEvents[_0x2a74('0x2')](_0x3b4081,_0x555ddc);_0x45bb06(null);};}for(var e in events){if(events[_0x2a74('0x3')](e)){var event=events[e];MailAccount[_0x2a74('0x4')](e,emitEvent(event));}}module[_0x2a74('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9886223..39c941b 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 _0x5812=['provider','custom','service','host','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','define','MailAccount','mail_accounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5812,0x140));var _0x2581=function(_0x2526f3,_0x401357){_0x2526f3=_0x2526f3-0x0;var _0x4fff0f=_0x5812[_0x2526f3];return _0x4fff0f;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x448604){return _0x448604[_0x2581('0x0')](_0x2581('0x1'),attributes,{'tableName':_0x2581('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xc44ce8=this;var _0x346f1e={'id':_0xc44ce8['id'],'tls':{'rejectUnauthorized':![]}};if(_0xc44ce8[_0x2581('0x3')]!==_0x2581('0x4')){_0x346f1e[_0x2581('0x5')]=_0xc44ce8[_0x2581('0x3')];}else{_0x346f1e[_0x2581('0x6')]=_0xc44ce8[_0x2581('0x7')]['host'];_0x346f1e['port']=_0xc44ce8[_0x2581('0x7')]['port'];_0x346f1e[_0x2581('0x8')]=_0xc44ce8[_0x2581('0x7')][_0x2581('0x8')];}if(_0xc44ce8[_0x2581('0x7')][_0x2581('0x9')]){if(_0xc44ce8[_0x2581('0x7')][_0x2581('0xa')]){if(!_0xc44ce8[_0x2581('0x7')][_0x2581('0xb')])throw new Error(_0x2581('0xc'));_0x346f1e[_0x2581('0xd')]={'type':_0x2581('0xe'),'user':_0xc44ce8[_0x2581('0x7')][_0x2581('0xf')],'accessToken':_0xc44ce8[_0x2581('0x7')][_0x2581('0xb')][_0x2581('0x10')]};}else{_0x346f1e[_0x2581('0xd')]={'user':_0xc44ce8['Smtp']['user'],'pass':_0xc44ce8[_0x2581('0x7')]['pass']};}}return _0x346f1e;}}});}; \ No newline at end of file +var _0xfffb=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','user','./mailAccount.attributes','exports','define','mail_accounts','provider','host','Smtp','port','secure','authentication'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xfffb,0xc8));var _0xbfff=function(_0x432a25,_0x35ff7b){_0x432a25=_0x432a25-0x0;var _0x4e3449=_0xfffb[_0x432a25];return _0x4e3449;};'use strict';var attributes=require(_0xbfff('0x0'));module[_0xbfff('0x1')]=function(_0x2c3a49){return _0x2c3a49[_0xbfff('0x2')]('MailAccount',attributes,{'tableName':_0xbfff('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xc76331=this;var _0x40e14b={'id':_0xc76331['id'],'tls':{'rejectUnauthorized':![]}};if(_0xc76331['provider']!=='custom'){_0x40e14b['service']=_0xc76331[_0xbfff('0x4')];}else{_0x40e14b[_0xbfff('0x5')]=_0xc76331[_0xbfff('0x6')][_0xbfff('0x5')];_0x40e14b[_0xbfff('0x7')]=_0xc76331[_0xbfff('0x6')][_0xbfff('0x7')];_0x40e14b[_0xbfff('0x8')]=_0xc76331['Smtp'][_0xbfff('0x8')];}if(_0xc76331[_0xbfff('0x6')][_0xbfff('0x9')]){if(_0xc76331[_0xbfff('0x6')]['modernAuthentication']){if(!_0xc76331[_0xbfff('0x6')]['CloudProvider'])throw new Error(_0xbfff('0xa'));_0x40e14b[_0xbfff('0xb')]={'type':_0xbfff('0xc'),'user':_0xc76331[_0xbfff('0x6')]['user'],'accessToken':_0xc76331[_0xbfff('0x6')]['CloudProvider'][_0xbfff('0xd')]};}else{_0x40e14b[_0xbfff('0xb')]={'user':_0xc76331['Smtp'][_0xbfff('0xe')],'pass':_0xc76331['Smtp']['pass']};}}return _0x40e14b;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 778bd0f..5d26450 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 _0x4975=['MailMessage','Messages','create','Contact\x20not\x20found','spread','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','User','UserId','agent','name','waitForTheAssignedAgent','startRouting','Start','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','list','applications','orderBy','priority','asc','push','close','autoclose','*,*,*,*','length','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4975,0x86));var _0x5497=function(_0x57f9a9,_0x30d61b){_0x57f9a9=_0x57f9a9-0x0;var _0x2b2196=_0x4975[_0x57f9a9];return _0x2b2196;};'use strict';var _=require(_0x5497('0x0'));var moment=require('moment');var BPromise=require(_0x5497('0x1'));var rs=require(_0x5497('0x2'));var Redis=require(_0x5497('0x3'));var db=require(_0x5497('0x4'))['db'];var logger=require(_0x5497('0x5'))(_0x5497('0x6'));var config=require(_0x5497('0x7'));var jayson=require(_0x5497('0x8'));var client=jayson[_0x5497('0x9')][_0x5497('0xa')]({'port':0x232c});config['redis']=_[_0x5497('0xb')](config['redis'],{'host':_0x5497('0xc'),'port':0x18eb});var socket=require(_0x5497('0xd'))(new Redis(config[_0x5497('0xe')]));require('./mailAccount.socket')[_0x5497('0xf')](socket);function respondWithRpcPromise(_0x49d94b,_0x1f63d8,_0x29c93f){return new BPromise(function(_0x2ec5a4,_0x32a8a2){return client[_0x5497('0x10')](_0x49d94b,_0x29c93f)[_0x5497('0x11')](function(_0x3e7886){logger[_0x5497('0x12')]('MailAccount,\x20%s,\x20%s',_0x1f63d8,'request\x20sent');logger['debug'](_0x5497('0x13'),_0x1f63d8,_0x5497('0x14'),JSON[_0x5497('0x15')](_0x3e7886));if(_0x3e7886[_0x5497('0x16')]){if(_0x3e7886[_0x5497('0x16')][_0x5497('0x17')]===0x1f4){logger[_0x5497('0x16')](_0x5497('0x18'),_0x1f63d8,_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);return _0x32a8a2(_0x3e7886['error'][_0x5497('0x19')]);}logger['error'](_0x5497('0x18'),_0x1f63d8,_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);return _0x2ec5a4(_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);}else{logger[_0x5497('0x12')](_0x5497('0x18'),_0x1f63d8,'request\x20sent');_0x2ec5a4(_0x3e7886['result'][_0x5497('0x19')]);}})[_0x5497('0x1a')](function(_0x3a47fd){logger['error'](_0x5497('0x18'),_0x1f63d8,_0x3a47fd);_0x32a8a2(_0x3a47fd);});});}exports[_0x5497('0x1b')]=function(_0x18e8a8){var _0x43da2c=this;return new Promise(function(_0x1b1b43,_0x1f6f18){return db[_0x5497('0x1c')][_0x5497('0x1d')]({'raw':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x1f')]===undefined?!![]:![]:!![],'where':_0x18e8a8['options']?_0x18e8a8[_0x5497('0x1e')]['where']||null:null,'attributes':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x20')]||null:null,'limit':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x21')]||null:null,'include':_0x18e8a8['options']?_0x18e8a8['options'][_0x5497('0x22')]?_[_0x5497('0x23')](_0x18e8a8[_0x5497('0x1e')][_0x5497('0x22')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x24')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x22')]?_[_0x5497('0x23')](_0x5223b5[_0x5497('0x22')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x24')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x20')],'include':_0x34a1a5['include']?_[_0x5497('0x23')](_0x34a1a5['include'],function(_0x583d06){return{'model':db[_0x583d06['model']],'as':_0x583d06['as'],'attributes':_0x583d06[_0x5497('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9356){logger[_0x5497('0x12')](_0x5497('0x1b'),_0x18e8a8);logger[_0x5497('0x25')]('GetMailAccount',_0x18e8a8,JSON['stringify'](_0x5e9356));_0x1b1b43(_0x5e9356);})['catch'](function(_0x371874){logger[_0x5497('0x16')](_0x5497('0x1b'),_0x371874['message'],_0x18e8a8);_0x1f6f18(_0x43da2c['error'](0x1f4,_0x371874['message']));});});};exports[_0x5497('0x26')]=function(_0x572460){var _0x438ee4=this;return new Promise(function(_0x258c2d,_0x77c575){return db['MailAccount'][_0x5497('0x27')]({'raw':_0x572460[_0x5497('0x1e')]?_0x572460['options'][_0x5497('0x1f')]===undefined?!![]:![]:!![],'where':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')]['where']||null:null,'attributes':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')][_0x5497('0x20')]||null:null,'include':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')]['include']?_[_0x5497('0x23')](_0x572460[_0x5497('0x1e')]['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x24')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x20')],'include':_0x1ffc9b[_0x5497('0x22')]?_[_0x5497('0x23')](_0x1ffc9b[_0x5497('0x22')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x24')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes'],'include':_0x580e86[_0x5497('0x22')]?_[_0x5497('0x23')](_0x580e86[_0x5497('0x22')],function(_0x5ab18c){return{'model':db[_0x5ab18c['model']],'as':_0x5ab18c['as'],'attributes':_0x5ab18c[_0x5497('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5497('0x11')](function(_0x326d48){if(_0x572460[_0x5497('0x1e')][_0x5497('0x28')]===!![])_0x326d48[_0x5497('0x29')]('smtpOptions',_0x326d48[_0x5497('0x2a')]());logger[_0x5497('0x12')](_0x5497('0x26'),_0x572460);logger[_0x5497('0x25')](_0x5497('0x26'),_0x572460,JSON[_0x5497('0x15')](_0x326d48));_0x258c2d(_0x326d48);})[_0x5497('0x1a')](function(_0x179635){logger[_0x5497('0x16')]('ShowMailAccount',_0x179635[_0x5497('0x19')],_0x572460);_0x77c575(_0x438ee4[_0x5497('0x16')](0x1f4,_0x179635[_0x5497('0x19')]));});});};exports[_0x5497('0x2b')]=function(_0x15029d){var _0xa5ebe6=this;return new Promise(function(_0x4299be,_0x59ed13){var _0x3e5f7d={'body':_0x15029d[_0x5497('0x2c')],'channel':_0x5497('0x2d')};var _0x35993c=_[_0x5497('0x2e')](_[_0x5497('0x2f')](db[_0x5497('0x30')]['rawAttributes']),[_0x5497('0x31'),_0x5497('0x32'),_0x5497('0x33'),_0x5497('0x34')]);var _0x20e947=![];if(_0x15029d[_0x5497('0x2c')]['id']){delete _0x15029d[_0x5497('0x2c')]['id'];}if(_[_0x5497('0x35')](_0x15029d[_0x5497('0x2c')][_0x5497('0x36')])){return _0x59ed13(_0xa5ebe6['error'](0x1f4,_0x5497('0x37')));}if(_['isNil'](_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')])||_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')]===''){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x5497('0x35')](_0x15029d[_0x5497('0x2c')]['mapKey'])){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x35993c));}if(!_[_0x5497('0x38')](_0x35993c,_0x15029d['body'][_0x5497('0x39')])){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,_0x5497('0x3a')+_0x35993c));}var _0x3a852a={};_0x3a852a[_0x15029d[_0x5497('0x2c')]['mapKey']]=_0x15029d['body']['from'];return db['MailAccount'][_0x5497('0x27')]({'where':{'id':_0x15029d[_0x5497('0x3b')]['id']},'include':[{'model':db[_0x5497('0x3c')],'as':_0x5497('0x3d'),'include':[{'model':db[_0x5497('0x30')],'as':_0x5497('0x3e'),'where':_0x3a852a,'limit':0x1,'order':[[_0x5497('0x32'),_0x5497('0x3f')]]}]},{'model':db[_0x5497('0x40')],'as':'Applications'},{'model':db[_0x5497('0x41')],'as':_0x5497('0x42'),'include':[{'model':db[_0x5497('0x43')],'as':'CloudProvider'}]}]})[_0x5497('0x11')](function(_0x530475){if(_0x530475&&_0x530475[_0x5497('0x3d')]){var _0x31f1ba=_0x530475[_0x5497('0x44')]({'plain':!![]});_0x3e5f7d['account']=_[_0x5497('0x45')](_0x31f1ba,[_0x5497('0x46'),'List']);_0x3e5f7d[_0x5497('0x3b')]['smtpOptions']=_0x530475[_0x5497('0x2a')]();_0x3e5f7d['applications']=_0x31f1ba[_0x5497('0x46')];_0x3e5f7d[_0x5497('0x47')]=_0x31f1ba[_0x5497('0x3d')];_0x3e5f7d[_0x5497('0x48')]=_[_0x5497('0x49')](_0x3e5f7d[_0x5497('0x48')],[_0x5497('0x4a')],[_0x5497('0x4b')]);if(_0x3e5f7d['account']&&_0x3e5f7d[_0x5497('0x3b')]['autoclose']){_0x3e5f7d['applications'][_0x5497('0x4c')]({'id':0x0,'priority':_0x3e5f7d[_0x5497('0x48')]['length']+0x1,'app':_0x5497('0x4d'),'appdata':_0x5497('0x4e'),'interval':_0x5497('0x4f')});}if(_0x3e5f7d[_0x5497('0x3b')]['Applications']){delete _0x3e5f7d[_0x5497('0x3b')]['Applications'];}if(_0x3e5f7d['account'][_0x5497('0x3d')]){delete _0x3e5f7d[_0x5497('0x3b')][_0x5497('0x3d')];}if(_0x31f1ba['List']['Contacts'][_0x5497('0x50')]){return _0x31f1ba['List'][_0x5497('0x3e')][0x0];}var _0x530431=_[_0x5497('0xb')](_0x15029d['body'],{'firstName':_0x15029d[_0x5497('0x2c')][_0x5497('0x36')],'ListId':_0x31f1ba['ListId']});_0x530431[_0x15029d[_0x5497('0x2c')]['mapKey']]=_0x15029d['body'][_0x5497('0x36')];return db[_0x5497('0x30')]['create'](_0x530431);}else{throw new Error(_0x5497('0x51'));}})[_0x5497('0x11')](function(_0x1dbab2){_0x3e5f7d[_0x5497('0x52')]=_0x1dbab2;if(_0x1dbab2){if(!_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['messageId']){_0x15029d[_0x5497('0x2c')]['message']['messageId']=rs['generate']()+'\x20'+_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')];}var _0x544085={'ContactId':_0x1dbab2['id'],'MailAccountId':_0x15029d[_0x5497('0x3b')]['id'],'inReplyTo':_0x15029d['body']['message'][_0x5497('0x53')],'to':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')],'cc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['cc'],'subject':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x54')],'attach':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['attach'],'lastMsgAt':moment()[_0x5497('0x55')](_0x5497('0x56')),'lastMsgDirection':'in'};return db[_0x5497('0x57')][_0x5497('0x27')]({'where':{'closed':![],'MailAccountId':_0x15029d['account']['id']},'include':[{'model':db[_0x5497('0x58')],'as':_0x5497('0x59'),'attributes':[_0x5497('0x53')],'where':{'messageId':_0x15029d['body'][_0x5497('0x19')]['inReplyTo']}}]})['then'](function(_0x53e050){if(_0x53e050){return[_0x53e050,![]];}return db[_0x5497('0x57')][_0x5497('0x5a')](_0x544085)[_0x5497('0x11')](function(_0x4e7d4c){return[_0x4e7d4c,!![]];});});}else{throw new Error(_0x5497('0x5b'));}})[_0x5497('0x5c')](function(_0x3cfebc,_0x35e75a){if(_0x3cfebc){_0x20e947=_0x35e75a;if(!_0x35e75a){return _0x3cfebc['update']({'inReplyTo':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x53')],'to':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x36')],'cc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['cc'],'subject':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x54')],'attach':_0x3cfebc['attach']?_0x3cfebc[_0x5497('0x5d')]:_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x5d')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x5497('0x56')),'lastMsgDirection':'in'});}else{return _0x3cfebc;}}})[_0x5497('0x11')](function(_0x179bbc){_0x3e5f7d['interaction']=_0x179bbc[_0x5497('0x44')]({'plain':!![]});_0x3e5f7d[_0x5497('0x5e')][_0x5497('0x5f')]=_0x20e947;return db[_0x5497('0x58')][_0x5497('0x5a')]({'body':_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')],'MailAccountId':_0x15029d[_0x5497('0x3b')]['id'],'MailInteractionId':_0x179bbc['id'],'direction':'in','ContactId':_0x3e5f7d[_0x5497('0x52')]['id'],'messageId':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['messageId'],'from':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')],'to':_0x15029d['body'][_0x5497('0x19')]['to'],'cc':_0x15029d['body'][_0x5497('0x19')]['cc'],'subject':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x54')],'attach':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x5d')],'Attachments':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x60')],'originTo':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x61')],'originCc':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x62')],'bcc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['bcc'],'ChatWebsiteId':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x63')]||null,'originChannel':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x64')]||_0x5497('0x65'),'ChatOfflineMessageId':_0x15029d[_0x5497('0x2c')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x5497('0x66')],'as':_0x5497('0x67')}]});})['then'](function(_0x15ca59){_0x3e5f7d[_0x5497('0x19')]=_0x15ca59;if(_0x3e5f7d[_0x5497('0x5e')]['UserId']){return db[_0x5497('0x68')][_0x5497('0x27')]({'attributes':['id','name'],'where':{'id':_0x3e5f7d[_0x5497('0x5e')][_0x5497('0x69')]}})[_0x5497('0x11')](function(_0x42d745){if(_0x42d745){_0x3e5f7d[_0x5497('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5497('0x6a'),'appdata':_0x42d745[_0x5497('0x6b')]+','+(_0x3e5f7d[_0x5497('0x3b')][_0x5497('0x6c')]||0xa),'interval':_0x5497('0x4f')});}return respondWithRpcPromise('Start',_0x5497('0x6d'),_0x3e5f7d);});}return respondWithRpcPromise(_0x5497('0x6e'),_0x5497('0x6d'),_0x3e5f7d);})[_0x5497('0x11')](function(_0x521d74){_0x4299be(_0x521d74);})[_0x5497('0x1a')](function(_0x21fc4e){_0x59ed13(_0xa5ebe6['error'](0x1f4,_0x21fc4e[_0x5497('0x19')]));});});}; \ No newline at end of file +var _0xe2fe=['list','List','priority','asc','autoclose','push','length','close','Contacts','defaults','ListId','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','Contact\x20not\x20found','spread','interaction','MailMessage','originCc','Attachments','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','then','debug','catch','ShowMailAccount','raw','smtp','smtpOptions','getSmtpOptions','body','mail','keys','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Smtp','CloudProvider','get','omit','Applications','applications'];(function(_0x56059b,_0x34c75e){var _0x1b524f=function(_0x20646b){while(--_0x20646b){_0x56059b['push'](_0x56059b['shift']());}};_0x1b524f(++_0x34c75e);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xee2f('0x1'));var Redis=require('ioredis');var db=require(_0xee2f('0x2'))['db'];var logger=require(_0xee2f('0x3'))(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var jayson=require(_0xee2f('0x6'));var client=jayson['client'][_0xee2f('0x7')]({'port':0x232c});config[_0xee2f('0x8')]=_['defaults'](config[_0xee2f('0x8')],{'host':_0xee2f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee2f('0x8')]));require('./mailAccount.socket')[_0xee2f('0xa')](socket);function respondWithRpcPromise(_0x36920f,_0x53f7dd,_0x3a49bb){return new BPromise(function(_0x43f451,_0x4bf3c3){return client['request'](_0x36920f,_0x3a49bb)['then'](function(_0x56bbea){logger[_0xee2f('0xb')]('MailAccount,\x20%s,\x20%s',_0x53f7dd,'request\x20sent');logger['debug'](_0xee2f('0xc'),_0x53f7dd,_0xee2f('0xd'),JSON[_0xee2f('0xe')](_0x56bbea));if(_0x56bbea[_0xee2f('0xf')]){if(_0x56bbea[_0xee2f('0xf')][_0xee2f('0x10')]===0x1f4){logger['error'](_0xee2f('0x11'),_0x53f7dd,_0x56bbea['error'][_0xee2f('0x12')]);return _0x4bf3c3(_0x56bbea[_0xee2f('0xf')]['message']);}logger[_0xee2f('0xf')](_0xee2f('0x11'),_0x53f7dd,_0x56bbea[_0xee2f('0xf')][_0xee2f('0x12')]);return _0x43f451(_0x56bbea[_0xee2f('0xf')]['message']);}else{logger[_0xee2f('0xb')]('MailAccount,\x20%s,\x20%s',_0x53f7dd,_0xee2f('0xd'));_0x43f451(_0x56bbea[_0xee2f('0x13')]['message']);}})['catch'](function(_0x40b5bc){logger['error'](_0xee2f('0x11'),_0x53f7dd,_0x40b5bc);_0x4bf3c3(_0x40b5bc);});});}exports[_0xee2f('0x14')]=function(_0x28549d){var _0x5b83b5=this;return new Promise(function(_0x35e1a4,_0x1e70aa){return db[_0xee2f('0x15')][_0xee2f('0x16')]({'raw':_0x28549d[_0xee2f('0x17')]?_0x28549d['options']['raw']===undefined?!![]:![]:!![],'where':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x18')]||null:null,'attributes':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x19')]||null:null,'limit':_0x28549d[_0xee2f('0x17')]?_0x28549d['options'][_0xee2f('0x1a')]||null:null,'include':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x28549d[_0xee2f('0x17')][_0xee2f('0x1b')],function(_0x13013f){return{'model':db[_0x13013f[_0xee2f('0x1d')]],'as':_0x13013f['as'],'attributes':_0x13013f[_0xee2f('0x19')],'include':_0x13013f[_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x13013f[_0xee2f('0x1b')],function(_0x45c4a0){return{'model':db[_0x45c4a0['model']],'as':_0x45c4a0['as'],'attributes':_0x45c4a0['attributes'],'include':_0x45c4a0['include']?_[_0xee2f('0x1c')](_0x45c4a0[_0xee2f('0x1b')],function(_0x2cb0cb){return{'model':db[_0x2cb0cb[_0xee2f('0x1d')]],'as':_0x2cb0cb['as'],'attributes':_0x2cb0cb[_0xee2f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0x1e')](function(_0x4d8398){logger[_0xee2f('0xb')]('GetMailAccount',_0x28549d);logger[_0xee2f('0x1f')](_0xee2f('0x14'),_0x28549d,JSON[_0xee2f('0xe')](_0x4d8398));_0x35e1a4(_0x4d8398);})[_0xee2f('0x20')](function(_0x3ddbe3){logger['error'](_0xee2f('0x14'),_0x3ddbe3[_0xee2f('0x12')],_0x28549d);_0x1e70aa(_0x5b83b5['error'](0x1f4,_0x3ddbe3['message']));});});};exports[_0xee2f('0x21')]=function(_0x574899){var _0x33c426=this;return new Promise(function(_0xc447e,_0x53d9b7){return db[_0xee2f('0x15')]['find']({'raw':_0x574899['options']?_0x574899['options'][_0xee2f('0x22')]===undefined?!![]:![]:!![],'where':_0x574899[_0xee2f('0x17')]?_0x574899['options'][_0xee2f('0x18')]||null:null,'attributes':_0x574899[_0xee2f('0x17')]?_0x574899[_0xee2f('0x17')][_0xee2f('0x19')]||null:null,'include':_0x574899[_0xee2f('0x17')]?_0x574899['options'][_0xee2f('0x1b')]?_['map'](_0x574899[_0xee2f('0x17')][_0xee2f('0x1b')],function(_0x3dcb9e){return{'model':db[_0x3dcb9e['model']],'as':_0x3dcb9e['as'],'attributes':_0x3dcb9e[_0xee2f('0x19')],'include':_0x3dcb9e['include']?_[_0xee2f('0x1c')](_0x3dcb9e['include'],function(_0x3e6dcc){return{'model':db[_0x3e6dcc[_0xee2f('0x1d')]],'as':_0x3e6dcc['as'],'attributes':_0x3e6dcc[_0xee2f('0x19')],'include':_0x3e6dcc[_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x3e6dcc[_0xee2f('0x1b')],function(_0x24380b){return{'model':db[_0x24380b[_0xee2f('0x1d')]],'as':_0x24380b['as'],'attributes':_0x24380b[_0xee2f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0x1e')](function(_0x433547){if(_0x574899['options'][_0xee2f('0x23')]===!![])_0x433547['setDataValue'](_0xee2f('0x24'),_0x433547[_0xee2f('0x25')]());logger[_0xee2f('0xb')](_0xee2f('0x21'),_0x574899);logger[_0xee2f('0x1f')](_0xee2f('0x21'),_0x574899,JSON[_0xee2f('0xe')](_0x433547));_0xc447e(_0x433547);})[_0xee2f('0x20')](function(_0x50ddd2){logger['error']('ShowMailAccount',_0x50ddd2[_0xee2f('0x12')],_0x574899);_0x53d9b7(_0x33c426['error'](0x1f4,_0x50ddd2[_0xee2f('0x12')]));});});};exports['NotifyMailAccount']=function(_0x558aa3){var _0x5027a6=this;return new Promise(function(_0x58e361,_0x430ac1){var _0x692686={'body':_0x558aa3[_0xee2f('0x26')],'channel':_0xee2f('0x27')};var _0x4823a7=_['difference'](_[_0xee2f('0x28')](db['CmContact']['rawAttributes']),[_0xee2f('0x29'),_0xee2f('0x2a'),_0xee2f('0x2b'),'ListId']);var _0x3bc173=![];if(_0x558aa3[_0xee2f('0x26')]['id']){delete _0x558aa3[_0xee2f('0x26')]['id'];}if(_['isNil'](_0x558aa3['body'][_0xee2f('0x2c')])){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x2d')));}if(_[_0xee2f('0x2e')](_0x558aa3['body'][_0xee2f('0x26')])||_0x558aa3[_0xee2f('0x26')][_0xee2f('0x26')]===''){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x2f')));}if(_[_0xee2f('0x2e')](_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')])){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x31')+_0x4823a7));}if(!_['includes'](_0x4823a7,_0x558aa3['body']['mapKey'])){return _0x430ac1(_0x5027a6['error'](0x1f4,_0xee2f('0x32')+_0x4823a7));}var _0x3e0d7b={};_0x3e0d7b[_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')]]=_0x558aa3[_0xee2f('0x26')]['from'];return db[_0xee2f('0x15')][_0xee2f('0x33')]({'where':{'id':_0x558aa3[_0xee2f('0x34')]['id']},'include':[{'model':db[_0xee2f('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3e0d7b,'limit':0x1,'order':[[_0xee2f('0x2a'),'DESC']]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xee2f('0x36'),'include':[{'model':db[_0xee2f('0x37')],'as':_0xee2f('0x37')}]}]})['then'](function(_0x22506e){if(_0x22506e&&_0x22506e['List']){var _0x3d95b8=_0x22506e[_0xee2f('0x38')]({'plain':!![]});_0x692686[_0xee2f('0x34')]=_[_0xee2f('0x39')](_0x3d95b8,[_0xee2f('0x3a'),'List']);_0x692686['account'][_0xee2f('0x24')]=_0x22506e['getSmtpOptions']();_0x692686[_0xee2f('0x3b')]=_0x3d95b8[_0xee2f('0x3a')];_0x692686[_0xee2f('0x3c')]=_0x3d95b8[_0xee2f('0x3d')];_0x692686['applications']=_['orderBy'](_0x692686[_0xee2f('0x3b')],[_0xee2f('0x3e')],[_0xee2f('0x3f')]);if(_0x692686[_0xee2f('0x34')]&&_0x692686[_0xee2f('0x34')][_0xee2f('0x40')]){_0x692686[_0xee2f('0x3b')][_0xee2f('0x41')]({'id':0x0,'priority':_0x692686[_0xee2f('0x3b')][_0xee2f('0x42')]+0x1,'app':_0xee2f('0x43'),'appdata':_0xee2f('0x40'),'interval':'*,*,*,*'});}if(_0x692686[_0xee2f('0x34')][_0xee2f('0x3a')]){delete _0x692686[_0xee2f('0x34')][_0xee2f('0x3a')];}if(_0x692686['account'][_0xee2f('0x3d')]){delete _0x692686[_0xee2f('0x34')][_0xee2f('0x3d')];}if(_0x3d95b8[_0xee2f('0x3d')][_0xee2f('0x44')]['length']){return _0x3d95b8[_0xee2f('0x3d')]['Contacts'][0x0];}var _0x4db455=_[_0xee2f('0x45')](_0x558aa3[_0xee2f('0x26')],{'firstName':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x2c')],'ListId':_0x3d95b8[_0xee2f('0x46')]});_0x4db455[_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')]]=_0x558aa3['body'][_0xee2f('0x2c')];return db[_0xee2f('0x47')][_0xee2f('0x48')](_0x4db455);}else{throw new Error(_0xee2f('0x49'));}})[_0xee2f('0x1e')](function(_0x3e1184){_0x692686[_0xee2f('0x4a')]=_0x3e1184;if(_0x3e1184){if(!_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['messageId']){_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4b')]=rs[_0xee2f('0x4c')]()+'\x20'+_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')];}var _0x5ee444={'ContactId':_0x3e1184['id'],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id'],'inReplyTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4b')],'to':_0x558aa3['body']['message']['from'],'cc':_0x558aa3['body']['message']['cc'],'subject':_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4d')],'attach':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4e')],'lastMsgAt':moment()[_0xee2f('0x4f')](_0xee2f('0x50')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0xee2f('0x51'),'attributes':['messageId'],'where':{'messageId':_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x52')]}}]})[_0xee2f('0x1e')](function(_0x2f419c){if(_0x2f419c){return[_0x2f419c,![]];}return db['MailInteraction'][_0xee2f('0x48')](_0x5ee444)[_0xee2f('0x1e')](function(_0x3bdfc5){return[_0x3bdfc5,!![]];});});}else{throw new Error(_0xee2f('0x53'));}})[_0xee2f('0x54')](function(_0x486146,_0xf0c721){if(_0x486146){_0x3bc173=_0xf0c721;if(!_0xf0c721){return _0x486146['update']({'inReplyTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4b')],'to':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')],'cc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['cc'],'subject':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4d')],'attach':_0x486146['attach']?_0x486146[_0xee2f('0x4e')]:_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4e')],'substatus':null,'substatusAt':moment()['format'](_0xee2f('0x50')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x486146;}}})[_0xee2f('0x1e')](function(_0x46ecac){_0x692686[_0xee2f('0x55')]=_0x46ecac[_0xee2f('0x38')]({'plain':!![]});_0x692686[_0xee2f('0x55')]['created']=_0x3bc173;return db[_0xee2f('0x56')][_0xee2f('0x48')]({'body':_0x558aa3[_0xee2f('0x26')]['body'],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id'],'MailInteractionId':_0x46ecac['id'],'direction':'in','ContactId':_0x692686[_0xee2f('0x4a')]['id'],'messageId':_0x558aa3['body'][_0xee2f('0x12')][_0xee2f('0x4b')],'from':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')],'to':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['to'],'cc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['cc'],'subject':_0x558aa3['body']['message']['subject'],'attach':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4e')],'Attachments':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['attachments'],'originTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['originTo'],'originCc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x57')],'bcc':_0x558aa3['body'][_0xee2f('0x12')]['bcc'],'ChatWebsiteId':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['ChatWebsiteId']||null,'originChannel':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['originChannel']||'Email','ChatOfflineMessageId':_0x558aa3['body'][_0xee2f('0x12')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xee2f('0x58')}]});})[_0xee2f('0x1e')](function(_0x50a972){_0x692686[_0xee2f('0x12')]=_0x50a972;if(_0x692686['interaction'][_0xee2f('0x59')]){return db[_0xee2f('0x5a')][_0xee2f('0x33')]({'attributes':['id',_0xee2f('0x5b')],'where':{'id':_0x692686[_0xee2f('0x55')][_0xee2f('0x59')]}})[_0xee2f('0x1e')](function(_0x58da0d){if(_0x58da0d){_0x692686[_0xee2f('0x3b')][_0xee2f('0x5c')]({'id':0x0,'priority':0x0,'app':_0xee2f('0x5d'),'appdata':_0x58da0d[_0xee2f('0x5b')]+','+(_0x692686[_0xee2f('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0xee2f('0x5e')});}return respondWithRpcPromise(_0xee2f('0x5f'),_0xee2f('0x60'),_0x692686);});}return respondWithRpcPromise(_0xee2f('0x5f'),_0xee2f('0x60'),_0x692686);})[_0xee2f('0x1e')](function(_0x4c3b2f){_0x58e361(_0x4c3b2f);})['catch'](function(_0x4051a7){_0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0x4051a7[_0xee2f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 4ab1adb..a1d2a5b 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 _0x50a8=['removeListener','register','length','save','update'];(function(_0x459d30,_0x4e010e){var _0x49526c=function(_0x20772b){while(--_0x20772b){_0x459d30['push'](_0x459d30['shift']());}};_0x49526c(++_0x4e010e);}(_0x50a8,0x193));var _0x850a=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x50a8[_0x4dc7b9];return _0x3ab114;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x850a('0x0'),'remove',_0x850a('0x1')];function createListener(_0xd71f18,_0x11c233){return function(_0x2c4e88){_0x11c233['emit'](_0xd71f18,_0x2c4e88);};}function removeListener(_0x5458e6,_0x5ca0f6){return function(){MailAccountEvents[_0x850a('0x2')](_0x5458e6,_0x5ca0f6);};}exports[_0x850a('0x3')]=function(_0x530b92){for(var _0x31c037=0x0,_0x4d74c5=events[_0x850a('0x4')];_0x31c037<_0x4d74c5;_0x31c037++){var _0x2cfc90=events[_0x31c037];var _0x245f43=createListener('mailAccount:'+_0x2cfc90,_0x530b92);MailAccountEvents['on'](_0x2cfc90,_0x245f43);}}; \ No newline at end of file +var _0x33d0=['register','length','mailAccount:','./mailAccount.events','remove','removeListener'];(function(_0x2db1f0,_0x3a63f8){var _0x97588f=function(_0x1ecc8b){while(--_0x1ecc8b){_0x2db1f0['push'](_0x2db1f0['shift']());}};_0x97588f(++_0x3a63f8);}(_0x33d0,0x99));var _0x033d=function(_0xe3b16b,_0x4be529){_0xe3b16b=_0xe3b16b-0x0;var _0x3278db=_0x33d0[_0xe3b16b];return _0x3278db;};'use strict';var MailAccountEvents=require(_0x033d('0x0'));var events=['save',_0x033d('0x1'),'update'];function createListener(_0x4b0415,_0x44bd99){return function(_0x3b44f5){_0x44bd99['emit'](_0x4b0415,_0x3b44f5);};}function removeListener(_0x5c3a4e,_0x18f5f9){return function(){MailAccountEvents[_0x033d('0x2')](_0x5c3a4e,_0x18f5f9);};}exports[_0x033d('0x3')]=function(_0x515747){for(var _0x5b750c=0x0,_0x31a584=events[_0x033d('0x4')];_0x5b750c<_0x31a584;_0x5b750c++){var _0x159075=events[_0x5b750c];var _0x222e3f=createListener(_0x033d('0x5')+_0x159075,_0x515747);MailAccountEvents['on'](_0x159075,_0x222e3f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d4eab53..c2276c1 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 _0xace7=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','show','put','isAuthenticated','update','destroy','exports','util'];(function(_0x386b7d,_0x12cf16){var _0xb59555=function(_0x3c5817){while(--_0x3c5817){_0x386b7d['push'](_0x386b7d['shift']());}};_0xb59555(++_0x12cf16);}(_0xace7,0xef));var _0x7ace=function(_0x52b494,_0x144998){_0x52b494=_0x52b494-0x0;var _0x295940=_0xace7[_0x52b494];return _0x295940;};'use strict';var multer=require('multer');var util=require(_0x7ace('0x0'));var path=require(_0x7ace('0x1'));var timeout=require(_0x7ace('0x2'));var express=require(_0x7ace('0x3'));var router=express[_0x7ace('0x4')]();var fs_extra=require(_0x7ace('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7ace('0x6'));var config=require(_0x7ace('0x7'));var controller=require(_0x7ace('0x8'));router['get'](_0x7ace('0x9'),auth['isAuthenticated'](),controller[_0x7ace('0xa')]);router[_0x7ace('0xb')](_0x7ace('0x9'),auth[_0x7ace('0xc')](),controller[_0x7ace('0xd')]);router['delete'](_0x7ace('0x9'),auth[_0x7ace('0xc')](),controller[_0x7ace('0xe')]);module[_0x7ace('0xf')]=router; \ No newline at end of file +var _0xdbce=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated'];(function(_0x320f33,_0x1db212){var _0x217d1e=function(_0x3c068){while(--_0x3c068){_0x320f33['push'](_0x320f33['shift']());}};_0x217d1e(++_0x1db212);}(_0xdbce,0x94));var _0xedbc=function(_0x3ef3e5,_0x1a1bc0){_0x3ef3e5=_0x3ef3e5-0x0;var _0x9833d5=_0xdbce[_0x3ef3e5];return _0x9833d5;};'use strict';var multer=require(_0xedbc('0x0'));var util=require(_0xedbc('0x1'));var path=require('path');var timeout=require(_0xedbc('0x2'));var express=require('express');var router=express[_0xedbc('0x3')]();var fs_extra=require(_0xedbc('0x4'));var auth=require(_0xedbc('0x5'));var interaction=require(_0xedbc('0x6'));var config=require(_0xedbc('0x7'));var controller=require(_0xedbc('0x8'));router[_0xedbc('0x9')](_0xedbc('0xa'),auth['isAuthenticated'](),controller[_0xedbc('0xb')]);router[_0xedbc('0xc')](_0xedbc('0xa'),auth[_0xedbc('0xd')](),controller[_0xedbc('0xe')]);router[_0xedbc('0xf')](_0xedbc('0xa'),auth[_0xedbc('0xd')](),controller[_0xedbc('0x10')]);module[_0xedbc('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 b19877f..026b87e 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 _0xf301=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x4b09f9,_0x1892ee){var _0x5b2c78=function(_0x540fe6){while(--_0x540fe6){_0x4b09f9['push'](_0x4b09f9['shift']());}};_0x5b2c78(++_0x1892ee);}(_0xf301,0xc6));var _0x1f30=function(_0x439783,_0x4ffd45){_0x439783=_0x439783-0x0;var _0x39cbef=_0xf301[_0x439783];return _0x39cbef;};'use strict';var Sequelize=require(_0x1f30('0x0'));module[_0x1f30('0x1')]={'priority':{'type':Sequelize[_0x1f30('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f30('0x3')},'appdata':{'type':Sequelize[_0x1f30('0x4')]()},'description':{'type':Sequelize[_0x1f30('0x5')]},'interval':{'type':Sequelize[_0x1f30('0x5')],'defaultValue':_0x1f30('0x6')}}; \ No newline at end of file +var _0xc68a=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x306cbb,_0x3d49e4){var _0xe8321e=function(_0x5372b9){while(--_0x5372b9){_0x306cbb['push'](_0x306cbb['shift']());}};_0xe8321e(++_0x3d49e4);}(_0xc68a,0x68));var _0xac68=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0xc68a[_0x3a21c0];return _0x411e84;};'use strict';var Sequelize=require(_0xac68('0x0'));module[_0xac68('0x1')]={'priority':{'type':Sequelize[_0xac68('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xac68('0x3')],'allowNull':![],'defaultValue':_0xac68('0x4')},'appdata':{'type':Sequelize[_0xac68('0x5')]()},'description':{'type':Sequelize[_0xac68('0x3')]},'interval':{'type':Sequelize[_0xac68('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 27f403d..dead974 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x592e40,_0x2ed011){var _0x5d4288=function(_0x366e87){while(--_0x366e87){_0x592e40['push'](_0x592e40['shift']());}};_0x5d4288(++_0x2ed011);}(_0x70e0,0x17b));var _0x070e=function(_0x15f241,_0x1cf313){_0x15f241=_0x15f241-0x0;var _0x2ccc12=_0x70e0[_0x15f241];return _0x2ccc12;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x525511,_0x3b9d9b){var _0x1ab032=function(_0x30c560){while(--_0x30c560){_0x525511['push'](_0x525511['shift']());}};_0x1ab032(++_0x3b9d9b);}(_0x54ef,0x112));var _0xf54e=function(_0x4838cc,_0x1eef0d){_0x4838cc=_0x4838cc-0x0;var _0x346e25=_0x54ef[_0x4838cc];return _0x346e25;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c424416..5385195 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 _0x47a4=['mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','MailApplication'];(function(_0x96b44a,_0x208efe){var _0x1e10a6=function(_0x38d02c){while(--_0x38d02c){_0x96b44a['push'](_0x96b44a['shift']());}};_0x1e10a6(++_0x208efe);}(_0x47a4,0xf2));var _0x447a=function(_0x2da508,_0x7e25f0){_0x2da508=_0x2da508-0x0;var _0x1b4c99=_0x47a4[_0x2da508];return _0x1b4c99;};'use strict';var _=require(_0x447a('0x0'));var util=require(_0x447a('0x1'));var logger=require(_0x447a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x447a('0x3'));var rp=require(_0x447a('0x4'));var fs=require('fs');var path=require(_0x447a('0x5'));var rimraf=require(_0x447a('0x6'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x447a('0x7')]=function(_0x197c7d,_0x14caf1){return _0x197c7d[_0x447a('0x8')](_0x447a('0x9'),attributes,{'tableName':_0x447a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x447a('0xb')});}; \ No newline at end of file +var _0x057a=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4566d9,_0x423da9){var _0x4230a5=function(_0x14e37d){while(--_0x14e37d){_0x4566d9['push'](_0x4566d9['shift']());}};_0x4230a5(++_0x423da9);}(_0x057a,0x15b));var _0xa057=function(_0x30ccc4,_0x54433d){_0x30ccc4=_0x30ccc4-0x0;var _0x48a197=_0x057a[_0x30ccc4];return _0x48a197;};'use strict';var _=require(_0xa057('0x0'));var util=require(_0xa057('0x1'));var logger=require(_0xa057('0x2'))('api');var moment=require(_0xa057('0x3'));var BPromise=require(_0xa057('0x4'));var rp=require(_0xa057('0x5'));var fs=require('fs');var path=require(_0xa057('0x6'));var rimraf=require('rimraf');var config=require(_0xa057('0x7'));var attributes=require(_0xa057('0x8'));module['exports']=function(_0x3f7620,_0x43c8b0){return _0x3f7620[_0xa057('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa057('0xa'),'collate':_0xa057('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index efc4adb..2690aef 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 _0x8452=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailApplication','MailApplication','options','raw','attributes','limit','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b40de,_0x3efe59){var _0x5c9460=function(_0x192494){while(--_0x192494){_0x4b40de['push'](_0x4b40de['shift']());}};_0x5c9460(++_0x3efe59);}(_0x8452,0xd0));var _0x2845=function(_0x43b88c,_0x46fb04){_0x43b88c=_0x43b88c-0x0;var _0x407299=_0x8452[_0x43b88c];return _0x407299;};'use strict';var _=require(_0x2845('0x0'));var util=require(_0x2845('0x1'));var moment=require('moment');var BPromise=require(_0x2845('0x2'));var rs=require(_0x2845('0x3'));var fs=require('fs');var Redis=require(_0x2845('0x4'));var db=require(_0x2845('0x5'))['db'];var utils=require(_0x2845('0x6'));var logger=require(_0x2845('0x7'))(_0x2845('0x8'));var config=require(_0x2845('0x9'));var jayson=require(_0x2845('0xa'));var client=jayson[_0x2845('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ba0dc,_0x4af730,_0x119a86){return new BPromise(function(_0x950f9b,_0x557105){return client['request'](_0x3ba0dc,_0x119a86)['then'](function(_0x48fd33){logger[_0x2845('0xc')](_0x2845('0xd'),_0x4af730,_0x2845('0xe'));logger[_0x2845('0xf')](_0x2845('0x10'),_0x4af730,'request\x20sent',JSON[_0x2845('0x11')](_0x48fd33));if(_0x48fd33[_0x2845('0x12')]){if(_0x48fd33[_0x2845('0x12')][_0x2845('0x13')]===0x1f4){logger[_0x2845('0x12')](_0x2845('0xd'),_0x4af730,_0x48fd33[_0x2845('0x12')]['message']);return _0x557105(_0x48fd33['error'][_0x2845('0x14')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x4af730,_0x48fd33[_0x2845('0x12')]['message']);return _0x950f9b(_0x48fd33[_0x2845('0x12')][_0x2845('0x14')]);}else{logger[_0x2845('0xc')](_0x2845('0xd'),_0x4af730,_0x2845('0xe'));_0x950f9b(_0x48fd33['result'][_0x2845('0x14')]);}})['catch'](function(_0xd787ef){logger[_0x2845('0x12')](_0x2845('0xd'),_0x4af730,_0xd787ef);_0x557105(_0xd787ef);});});}exports[_0x2845('0x15')]=function(_0x1020d6){var _0xda7f3d=this;return new Promise(function(_0x490dcb,_0x13d516){return db[_0x2845('0x16')]['update'](_0x1020d6['body'],{'raw':_0x1020d6[_0x2845('0x17')]?_0x1020d6['options'][_0x2845('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1020d6[_0x2845('0x17')]?_0x1020d6['options']['where']||null:null,'attributes':_0x1020d6[_0x2845('0x17')]?_0x1020d6[_0x2845('0x17')][_0x2845('0x19')]||null:null,'limit':_0x1020d6[_0x2845('0x17')]?_0x1020d6[_0x2845('0x17')][_0x2845('0x1a')]||null:null})[_0x2845('0x1b')](function(_0x4a8bc7){logger[_0x2845('0xc')]('UpdateMailApplication',_0x1020d6);logger['debug']('UpdateMailApplication',_0x1020d6,JSON['stringify'](_0x4a8bc7));_0x490dcb(_0x4a8bc7);})['catch'](function(_0xc4ec11){logger[_0x2845('0x12')](_0x2845('0x15'),_0xc4ec11[_0x2845('0x14')],_0x1020d6);_0x13d516(_0xda7f3d['error'](0x1f4,_0xc4ec11[_0x2845('0x14')]));});});}; \ No newline at end of file +var _0xfd27=['where','attributes','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw'];(function(_0x72a770,_0x198367){var _0x1d4703=function(_0x57764c){while(--_0x57764c){_0x72a770['push'](_0x72a770['shift']());}};_0x1d4703(++_0x198367);}(_0xfd27,0xff));var _0x7fd2=function(_0x57d73c,_0x14e742){_0x57d73c=_0x57d73c-0x0;var _0x6058af=_0xfd27[_0x57d73c];return _0x6058af;};'use strict';var _=require(_0x7fd2('0x0'));var util=require('util');var moment=require(_0x7fd2('0x1'));var BPromise=require(_0x7fd2('0x2'));var rs=require(_0x7fd2('0x3'));var fs=require('fs');var Redis=require(_0x7fd2('0x4'));var db=require(_0x7fd2('0x5'))['db'];var utils=require(_0x7fd2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7fd2('0x7'));var jayson=require(_0x7fd2('0x8'));var client=jayson['client'][_0x7fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2846da,_0x52bf49,_0x21a103){return new BPromise(function(_0x2e7e7d,_0x355396){return client['request'](_0x2846da,_0x21a103)['then'](function(_0x47d927){logger[_0x7fd2('0xa')](_0x7fd2('0xb'),_0x52bf49,_0x7fd2('0xc'));logger[_0x7fd2('0xd')](_0x7fd2('0xe'),_0x52bf49,_0x7fd2('0xc'),JSON[_0x7fd2('0xf')](_0x47d927));if(_0x47d927[_0x7fd2('0x10')]){if(_0x47d927[_0x7fd2('0x10')]['code']===0x1f4){logger['error'](_0x7fd2('0xb'),_0x52bf49,_0x47d927[_0x7fd2('0x10')][_0x7fd2('0x11')]);return _0x355396(_0x47d927[_0x7fd2('0x10')][_0x7fd2('0x11')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x52bf49,_0x47d927[_0x7fd2('0x10')][_0x7fd2('0x11')]);return _0x2e7e7d(_0x47d927[_0x7fd2('0x10')][_0x7fd2('0x11')]);}else{logger[_0x7fd2('0xa')](_0x7fd2('0xb'),_0x52bf49,_0x7fd2('0xc'));_0x2e7e7d(_0x47d927[_0x7fd2('0x12')][_0x7fd2('0x11')]);}})[_0x7fd2('0x13')](function(_0x21005d){logger[_0x7fd2('0x10')](_0x7fd2('0xb'),_0x52bf49,_0x21005d);_0x355396(_0x21005d);});});}exports[_0x7fd2('0x14')]=function(_0x360d9f){var _0x44aa16=this;return new Promise(function(_0x342d38,_0x1d09a0){return db[_0x7fd2('0x15')][_0x7fd2('0x16')](_0x360d9f['body'],{'raw':_0x360d9f[_0x7fd2('0x17')]?_0x360d9f[_0x7fd2('0x17')][_0x7fd2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360d9f['options']?_0x360d9f[_0x7fd2('0x17')][_0x7fd2('0x19')]||null:null,'attributes':_0x360d9f[_0x7fd2('0x17')]?_0x360d9f[_0x7fd2('0x17')][_0x7fd2('0x1a')]||null:null,'limit':_0x360d9f[_0x7fd2('0x17')]?_0x360d9f[_0x7fd2('0x17')]['limit']||null:null})[_0x7fd2('0x1b')](function(_0x25b64e){logger[_0x7fd2('0xa')](_0x7fd2('0x14'),_0x360d9f);logger[_0x7fd2('0xd')](_0x7fd2('0x14'),_0x360d9f,JSON[_0x7fd2('0xf')](_0x25b64e));_0x342d38(_0x25b64e);})[_0x7fd2('0x13')](function(_0x4d4f24){logger[_0x7fd2('0x10')](_0x7fd2('0x14'),_0x4d4f24[_0x7fd2('0x11')],_0x360d9f);_0x1d09a0(_0x44aa16[_0x7fd2('0x10')](0x1f4,_0x4d4f24['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b6dfaa7..cc2829b 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 _0x52b3=['index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','mail','addTags','put','/:id','tracked','delete','destroy','/:id/tags','removeTags','exports','express','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x4b13f0,_0x1273df){var _0x2a1955=function(_0x5634ea){while(--_0x5634ea){_0x4b13f0['push'](_0x4b13f0['shift']());}};_0x2a1955(++_0x1273df);}(_0x52b3,0xb3));var _0x352b=function(_0x258bb9,_0x3c4237){_0x258bb9=_0x258bb9-0x0;var _0x177241=_0x52b3[_0x258bb9];return _0x177241;};'use strict';var express=require(_0x352b('0x0'));var router=express[_0x352b('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x352b('0x2'));var controller=require('./mailInteraction.controller');router[_0x352b('0x3')]('/',auth[_0x352b('0x4')](),controller[_0x352b('0x5')]);router[_0x352b('0x3')](_0x352b('0x6'),auth['isAuthenticated'](),controller[_0x352b('0x7')]);router[_0x352b('0x3')]('/:id',auth[_0x352b('0x4')](),controller['show']);router[_0x352b('0x3')](_0x352b('0x8'),auth[_0x352b('0x4')](),controller[_0x352b('0x9')]);router['get'](_0x352b('0xa'),auth[_0x352b('0x4')](),controller[_0x352b('0xb')]);router[_0x352b('0xc')]('/',auth[_0x352b('0x4')](),controller['create']);router[_0x352b('0xc')](_0x352b('0x8'),auth[_0x352b('0x4')](),controller['addMessage']);router[_0x352b('0xc')]('/:id/tags',auth[_0x352b('0x4')](),interaction['tracked'](_0x352b('0xd'),'mailinteraction:addtags'),controller[_0x352b('0xe')]);router[_0x352b('0xf')](_0x352b('0x10'),auth[_0x352b('0x4')](),interaction[_0x352b('0x11')](_0x352b('0xd'),'mailinteraction:update'),controller['update']);router[_0x352b('0x12')](_0x352b('0x10'),auth[_0x352b('0x4')](),interaction[_0x352b('0x11')](_0x352b('0xd'),'mailinteraction:destroy'),controller[_0x352b('0x13')]);router[_0x352b('0x12')](_0x352b('0x14'),auth['isAuthenticated'](),controller[_0x352b('0x15')]);module[_0x352b('0x16')]=router; \ No newline at end of file +var _0x102b=['delete','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/messages','/:id/download','create','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','destroy'];(function(_0xe0a3ac,_0x1ce788){var _0x490262=function(_0x18995c){while(--_0x18995c){_0xe0a3ac['push'](_0xe0a3ac['shift']());}};_0x490262(++_0x1ce788);}(_0x102b,0xb0));var _0xb102=function(_0x2e4e31,_0x23c579){_0x2e4e31=_0x2e4e31-0x0;var _0x21aa50=_0x102b[_0x2e4e31];return _0x21aa50;};'use strict';var express=require('express');var router=express[_0xb102('0x0')]();var auth=require(_0xb102('0x1'));var interaction=require(_0xb102('0x2'));var controller=require(_0xb102('0x3'));router['get']('/',auth[_0xb102('0x4')](),controller[_0xb102('0x5')]);router['get'](_0xb102('0x6'),auth[_0xb102('0x4')](),controller[_0xb102('0x7')]);router['get'](_0xb102('0x8'),auth[_0xb102('0x4')](),controller[_0xb102('0x9')]);router[_0xb102('0xa')](_0xb102('0xb'),auth[_0xb102('0x4')](),controller['getMessages']);router['get'](_0xb102('0xc'),auth[_0xb102('0x4')](),controller['download']);router['post']('/',auth[_0xb102('0x4')](),controller[_0xb102('0xd')]);router[_0xb102('0xe')]('/:id/messages',auth[_0xb102('0x4')](),controller[_0xb102('0xf')]);router['post'](_0xb102('0x10'),auth[_0xb102('0x4')](),interaction['tracked'](_0xb102('0x11'),_0xb102('0x12')),controller[_0xb102('0x13')]);router[_0xb102('0x14')]('/:id',auth['isAuthenticated'](),interaction[_0xb102('0x15')]('mail',_0xb102('0x16')),controller['update']);router['delete'](_0xb102('0x8'),auth[_0xb102('0x4')](),interaction[_0xb102('0x15')](_0xb102('0x11'),'mailinteraction:destroy'),controller[_0xb102('0x17')]);router[_0xb102('0x18')](_0xb102('0x10'),auth[_0xb102('0x4')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6da760d..e593023 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 _0xdcc0=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0xbc2807,_0x307466){var _0x3e8d20=function(_0x3ef1dd){while(--_0x3ef1dd){_0xbc2807['push'](_0xbc2807['shift']());}};_0x3e8d20(++_0x307466);}(_0xdcc0,0x1bb));var _0x0dcc=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xdcc0[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x0dcc('0x0'));var iconv=require('iconv');module[_0x0dcc('0x1')]={'closed':{'type':Sequelize[_0x0dcc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0dcc('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0dcc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0dcc('0x4')]},'note':{'type':Sequelize[_0x0dcc('0x4')]},'inReplyTo':{'type':Sequelize[_0x0dcc('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x0dcc('0x5')](_0x0dcc('0x6'))},'subject':{'type':Sequelize[_0x0dcc('0x5')]()},'attach':{'type':Sequelize[_0x0dcc('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0dcc('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x0dcc('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0dcc('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0dcc('0x7')]('in',_0x0dcc('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0dcc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0c9c=['out','ENUM','sequelize','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0c9('0x0'));var iconv=require(_0xc0c9('0x1'));module[_0xc0c9('0x2')]={'closed':{'type':Sequelize[_0xc0c9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc0c9('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc0c9('0x4')]},'note':{'type':Sequelize[_0xc0c9('0x4')]},'inReplyTo':{'type':Sequelize[_0xc0c9('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc0c9('0x4')]},'cc':{'type':Sequelize[_0xc0c9('0x5')](_0xc0c9('0x6'))},'subject':{'type':Sequelize[_0xc0c9('0x5')]()},'attach':{'type':Sequelize[_0xc0c9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc0c9('0x7')]},'substatus':{'type':Sequelize[_0xc0c9('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc0c9('0x7')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc0c9('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc0c9('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xc0c9('0x9')]('in',_0xc0c9('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4f95b30..d527f78 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 _0x8593=['MailMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','inlineCss','true','spread','emit','removeTags','download','join','root','files','tmp','attachments','Attachment','Attachments','bcc','subject','Messages','mkdirSync','decode','headers','Bcc','basename','existsSync','readFileSync','build','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./mailInteraction.socket','register','status','end','json','undefined','limit','offset','count','set','Content-Range','update','then','sendStatus','error','name','send','Users','fullname','TagIds','split','forEach','Tags','push','findOne','plainBody','-id','trimStart','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','field','color','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','length','conditions','value','`\x20=\x200','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','isEmpty','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','MailInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','find','create','body','addMessage'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8593,0x107));var _0x3859=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8593[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x3859('0x0'));var rimraf=require(_0x3859('0x1'));var zipdir=require(_0x3859('0x2'));var moment=require(_0x3859('0x3'));var BPromise=require(_0x3859('0x4'));var util=require(_0x3859('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x3859('0x6'));var squel=require('squel');var juice=require(_0x3859('0x7'));var Redis=require(_0x3859('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0x3859('0x9'));var logger=require(_0x3859('0xa'))('api');var config=require(_0x3859('0xb'));var db=require(_0x3859('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x3859('0xd')]=_[_0x3859('0xe')](config[_0x3859('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3859('0xd')]));require(_0x3859('0xf'))[_0x3859('0x10')](socket);function respondWithStatusCode(_0x429539,_0x489bf9){_0x489bf9=_0x489bf9||0xcc;return function(_0x137e7c){if(_0x137e7c){return _0x429539['sendStatus'](_0x489bf9);}return _0x429539[_0x3859('0x11')](_0x489bf9)[_0x3859('0x12')]();};}function respondWithResult(_0x1ee4cb,_0x254dd7){_0x254dd7=_0x254dd7||0xc8;return function(_0x452ee2){if(_0x452ee2){return _0x1ee4cb[_0x3859('0x11')](_0x254dd7)[_0x3859('0x13')](_0x452ee2);}};}function respondWithFilteredResult(_0x143d0c,_0x254c69){return function(_0xbb777d){if(_0xbb777d){var _0x179446=typeof _0x254c69['offset']===_0x3859('0x14')&&typeof _0x254c69[_0x3859('0x15')]===_0x3859('0x14');var _0x50ddb0=_0xbb777d['count'];var _0x143e73=_0x179446?0x0:_0x254c69[_0x3859('0x16')];var _0x27f85b=_0x179446?_0xbb777d[_0x3859('0x17')]:_0x254c69['offset']+_0x254c69[_0x3859('0x15')];var _0x1806c2;if(_0x27f85b>=_0x50ddb0){_0x27f85b=_0x50ddb0;_0x1806c2=0xc8;}else{_0x1806c2=0xce;}_0x143d0c[_0x3859('0x11')](_0x1806c2);return _0x143d0c[_0x3859('0x18')](_0x3859('0x19'),_0x143e73+'-'+_0x27f85b+'/'+_0x50ddb0)[_0x3859('0x13')](_0xbb777d);}return null;};}function saveUpdates(_0x2b8984){return function(_0x229ab2){if(_0x229ab2){return _0x229ab2[_0x3859('0x1a')](_0x2b8984)[_0x3859('0x1b')](function(_0x1a1b98){return _0x1a1b98;});}return null;};}function removeEntity(_0x3c3555){return function(_0x98d201){if(_0x98d201){return _0x98d201['destroy']()[_0x3859('0x1b')](function(){_0x3c3555[_0x3859('0x11')](0xcc)[_0x3859('0x12')]();});}};}function handleEntityNotFound(_0x5e046d){return function(_0x4945d3){if(!_0x4945d3){_0x5e046d[_0x3859('0x1c')](0x194);}return _0x4945d3;};}function handleError(_0x4e50c6,_0x2f22f1){_0x2f22f1=_0x2f22f1||0x1f4;return function(_0xd9a01){logger[_0x3859('0x1d')](_0xd9a01['stack']);if(_0xd9a01[_0x3859('0x1e')]){delete _0xd9a01[_0x3859('0x1e')];}_0x4e50c6[_0x3859('0x11')](_0x2f22f1)[_0x3859('0x1f')](_0xd9a01);};}function getInteractionUsers(_0x40b869,_0x359956){return new BPromise(function(_0x27638,_0x4aadc6){try{if(_0x359956[_0x40b869['id']]){_0x40b869[_0x3859('0x20')]=_['map'](_0x359956[_0x40b869['id']],function(_0x322b73){return{'id':_0x322b73['id'],'fullname':_0x322b73[_0x3859('0x21')]};});}}catch(_0x2abb5e){_0x4aadc6(_0x2abb5e);}_0x27638(_0x40b869);});}function getInteractionTags(_0x292330,_0x142b2d){return new BPromise(function(_0x1fae9c,_0xc7eb60){try{if(_0x292330[_0x3859('0x22')]){_0x292330['Tags']=[];_0x292330[_0x3859('0x22')][_0x3859('0x23')](',')[_0x3859('0x24')](function(_0x31bfc6){_0x292330[_0x3859('0x25')][_0x3859('0x26')](_0x142b2d[_0x31bfc6]);});}delete _0x292330[_0x3859('0x22')];}catch(_0x450e6f){_0xc7eb60(_0x450e6f);}_0x1fae9c(_0x292330);});}function getLastMessageText(_0x47508a){return new BPromise(function(_0x38845b,_0x10fe7d){return db['MailMessage'][_0x3859('0x27')]({'where':{'$and':[{'MailInteractionId':_0x47508a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x3859('0x28')],'order':_0x3859('0x29'),'raw':!![]})['then'](function(_0x43f342){if(_0x43f342&&_0x43f342['plainBody']){_0x47508a['lastMsgText']=_[_0x3859('0x2a')](_0x43f342['plainBody']);}_0x38845b(_0x47508a);})[_0x3859('0x2b')](function(_0x447afd){_0x10fe7d(_0x447afd);});});}function updateMailInteraction(_0x49eaa0,_0x13c09c,_0x2b73b3,_0x420d40){return new BPromise(function(_0x4aefc9,_0x4ca320){return getInteractionUsers(_0x49eaa0,_0x2b73b3)['then'](function(_0x350734){return getInteractionTags(_0x350734,_0x13c09c);})[_0x3859('0x1b')](function(_0x32130e){return getStateInteraction(_0x32130e);})['then'](function(_0x24f0d5){if(_0x420d40){_0x4aefc9(getLastMessageText(_0x24f0d5));}else{_0x4aefc9(_0x24f0d5);}})['catch'](function(_0x3664ad){_0x4ca320(_0x3664ad);});});}function getStateInteraction(_0x5e12a6){return new BPromise(function(_0x4c899b){_0x5e12a6['waiting']=0x0;_0x5e12a6[_0x3859('0x2c')]=0x0;_0x5e12a6[_0x3859('0x2d')]=0x0;_0x5e12a6[_0x3859('0x2e')]=0x0;_0x5e12a6[_0x3859('0x2f')]=0x0;if(!_0x5e12a6[_0x3859('0x30')]&&!_0x5e12a6[_0x3859('0x31')]){_0x5e12a6[_0x3859('0x32')]+=0x1;}if(!_0x5e12a6[_0x3859('0x30')]&&_0x5e12a6['UserId']){_0x5e12a6[_0x3859('0x2c')]+=0x1;if(_0x5e12a6[_0x3859('0x32')]){_0x5e12a6['waiting']-=0x1;}}if(_0x5e12a6['closed']&&_0x5e12a6[_0x3859('0x31')]){_0x5e12a6[_0x3859('0x2d')]+=0x1;if(_0x5e12a6[_0x3859('0x2c')]){_0x5e12a6[_0x3859('0x2c')]-=0x1;}}if(_0x5e12a6['closed']&&!_0x5e12a6[_0x3859('0x31')]){_0x5e12a6[_0x3859('0x2e')]+=0x1;if(_0x5e12a6[_0x3859('0x32')]){_0x5e12a6[_0x3859('0x32')]-=0x1;}}_0x5e12a6[_0x3859('0x2f')]+=0x1;_0x4c899b(_0x5e12a6);});}exports[_0x3859('0x33')]=function(_0x487d62,_0x5007e6){var _0x5c46f7={},_0x14747b={},_0x14656e={'count':0x0,'rows':[]};var _0x1f29f6=_[_0x3859('0x34')](db['MailInteraction'][_0x3859('0x35')],function(_0x13cc4e){return{'name':_0x13cc4e[_0x3859('0x36')],'type':_0x13cc4e[_0x3859('0x37')][_0x3859('0x38')]};});_0x14747b[_0x3859('0x39')]=_[_0x3859('0x34')](_0x1f29f6,'name');_0x14747b['query']=_[_0x3859('0x3a')](_0x487d62[_0x3859('0x3b')]);_0x14747b[_0x3859('0x3c')]=_['intersection'](_0x14747b['model'],_0x14747b['query']);_0x5c46f7[_0x3859('0x3d')]=_[_0x3859('0x3e')](_0x14747b['model'],qs['fields'](_0x487d62[_0x3859('0x3b')][_0x3859('0x3f')]));_0x5c46f7[_0x3859('0x3d')]=_0x5c46f7['attributes']['length']?_0x5c46f7['attributes']:_0x14747b[_0x3859('0x39')];if(!_0x487d62['query'][_0x3859('0x40')]('nolimit')){_0x5c46f7[_0x3859('0x15')]=qs['limit'](_0x487d62[_0x3859('0x3b')][_0x3859('0x15')]);_0x5c46f7[_0x3859('0x16')]=qs['offset'](_0x487d62[_0x3859('0x3b')][_0x3859('0x16')]);}_0x5c46f7[_0x3859('0x41')]=qs[_0x3859('0x42')](_0x487d62['query'][_0x3859('0x42')]);_0x5c46f7[_0x3859('0x43')]=qs['filters'](_['pick'](_0x487d62[_0x3859('0x3b')],_0x14747b[_0x3859('0x3c')]),_0x1f29f6);var _0x1ba26b=[];var _0x544f81=squel['select']()[_0x3859('0x44')]('id')[_0x3859('0x44')]('name')['field'](_0x3859('0x45'))[_0x3859('0x46')](_0x3859('0x47'));var _0x26f730=squel['select']()['field'](_0x3859('0x48'))['field']('u.fullname')[_0x3859('0x44')](_0x3859('0x49'))[_0x3859('0x46')](_0x3859('0x4a'),'ui')[_0x3859('0x4b')](_0x3859('0x4c'),'u',_0x3859('0x4d'));var _0x8a9712=squel[_0x3859('0x4e')]()[_0x3859('0x46')](_0x3859('0x4f'),'i')[_0x3859('0x4b')]('cm_contacts','c',_0x3859('0x50'))[_0x3859('0x4b')](_0x3859('0x4c'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x3859('0x51'),'a',_0x3859('0x52'))['left_join'](_0x3859('0x53'),'me',_0x3859('0x54'))[_0x3859('0x4b')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0x3859('0x4b')](_0x3859('0x47'),'t',_0x3859('0x55'));var _0x19f262=squel[_0x3859('0x56')]();var _0x2f96e6=[];var _0x4bcb46=squel[_0x3859('0x56')]();var _0x23eb42;if(_0x487d62[_0x3859('0x3b')]['search']){_0x23eb42=as[_0x3859('0x57')](_0x487d62[_0x3859('0x3b')][_0x3859('0x58')]);var _0x11c458=_0x23eb42[_0x3859('0x59')];for(var _0x3cd8d5=0x0;_0x3cd8d5<_0x23eb42['conditions'][_0x3859('0x5a')];_0x3cd8d5++){var _0xe23159=_0x23eb42[_0x3859('0x5b')][_0x3cd8d5];var _0x54b9a7='i';var _0x32b621=_['find'](_0x1f29f6,[_0x3859('0x1e'),_0xe23159['field']]);if(!_0x32b621){switch(_0xe23159[_0x3859('0x44')]){case'unreadMessages':if(_0xe23159[_0x3859('0x5c')]==0x1){_0x8a9712['having']('`'+_0xe23159['field']+_0x3859('0x5d'));}else{_0x8a9712[_0x3859('0x5e')]('`'+_0xe23159[_0x3859('0x44')]+_0x3859('0x5f'));}break;case'Contact':if(_0xe23159['operator']===_0x3859('0x60')){if(_0xe23159[_0x3859('0x5c')][_0x3859('0x23')]('\x20')[_0x3859('0x5a')]>0x1){_0x19f262[_0x11c458](_0x3859('0x61'),qs[_0x3859('0x62')](_0xe23159[_0x3859('0x5c')]),null);}else{var _0x56a244='%'+_0xe23159[_0x3859('0x5c')]+'%';_0x19f262[_0x11c458](_0x3859('0x63'),_0x56a244,_0x56a244,_0x56a244);}}else{_0x32b621=_['find'](_0x1f29f6,[_0x3859('0x1e'),'ContactId']);_0xe23159['field']=_0x3859('0x64');_0x46336d=as['buildExpression'](_0x54b9a7,_0x32b621[_0x3859('0x37')],_0xe23159);_0x19f262[_0x11c458](_0x46336d[_0x3859('0x65')],_0x46336d[_0x3859('0x5c')][_0x3859('0x66')],_0x46336d['value']['end']);}break;case _0x3859('0x67'):var _0x100c1a=_0xe23159[_0x3859('0x5c')][_0x3859('0x23')](',')[_0x3859('0x34')](function(_0xcc8400){return Number(_0xcc8400);});_0x100c1a[_0x3859('0x24')](function(_0x72a536){_0x4bcb46['or'](_0x3859('0x68'),'%,'+_0x72a536+',%');});_0x2f96e6=_['union'](_0x2f96e6,_0x100c1a);break;case _0x3859('0x69'):if(_0xe23159[_0x3859('0x6a')]===_0x3859('0x60')){_0x19f262[_0x11c458](_0x3859('0x6b'),'%'+_0xe23159[_0x3859('0x5c')]+'%',null);}else{_0x32b621=_['find'](_0x1f29f6,[_0x3859('0x1e'),_0x3859('0x31')]);_0xe23159[_0x3859('0x44')]=_0x3859('0x31');_0x46336d=as['buildExpression'](_0x54b9a7,_0x32b621[_0x3859('0x37')],_0xe23159);_0x19f262[_0x11c458](_0x46336d[_0x3859('0x65')],_0x46336d['value']['start'],_0x46336d[_0x3859('0x5c')][_0x3859('0x12')]);}break;case'plainBody':_0x46336d=as['buildExpression']('me',null,_0xe23159);_0x19f262[_0x11c458](_0x46336d[_0x3859('0x65')],_0x46336d[_0x3859('0x5c')][_0x3859('0x66')],_0x46336d[_0x3859('0x5c')][_0x3859('0x12')]);break;}}else{var _0x46336d=as[_0x3859('0x6c')](_0x54b9a7,_0x32b621[_0x3859('0x37')],_0xe23159);_0x19f262[_0x11c458](_0x46336d['text'],_0x46336d[_0x3859('0x5c')]['start'],_0x46336d['value']['end']);}}}else{var _0x244b46=_(_0x487d62['query'])[_0x3859('0x3a')]()[_0x3859('0x34')](function(_0x674a2e){return _[_0x3859('0x6d')](_0x1f29f6,[_0x3859('0x1e'),_0x674a2e])?_0x674a2e:undefined;})['compact']()[_0x3859('0x5c')]();if(!_[_0x3859('0x6e')](_0x244b46)){_0x244b46[_0x3859('0x24')](function(_0x34cbd0){if(_0x34cbd0==='MailAccountId'){_0x8a9712[_0x3859('0x43')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x487d62[_0x3859('0x3b')][_0x34cbd0]));}else if(_0x34cbd0===_0x3859('0x6f')){var _0x2c6856=JSON['parse'](_0x487d62[_0x3859('0x3b')][_0x34cbd0])[_0x3859('0x70')];var _0x36f282=JSON['parse'](_0x487d62[_0x3859('0x3b')][_0x34cbd0])[_0x3859('0x71')];_0x8a9712['where'](_0x3859('0x72'),_0x2c6856,_0x36f282);}else{if(_0x487d62[_0x3859('0x3b')][_0x34cbd0]===_0x3859('0x73')){_0x8a9712[_0x3859('0x43')]('i.'+_0x34cbd0+_0x3859('0x74'));}else{_0x8a9712[_0x3859('0x43')]('i.'+_0x34cbd0+_0x3859('0x75'),_0x487d62[_0x3859('0x3b')][_0x34cbd0]);}}});}if(_0x487d62['query'][_0x3859('0x76')]){if(_0x487d62[_0x3859('0x3b')][_0x3859('0x76')]==0x1){_0x8a9712['having'](_0x3859('0x77'));}else{_0x8a9712[_0x3859('0x5e')](_0x3859('0x78'));}}if(_0x487d62[_0x3859('0x3b')]['tag']){_0x2f96e6=_['isArray'](_0x487d62[_0x3859('0x3b')]['tag'])?_0x487d62[_0x3859('0x3b')][_0x3859('0x79')]:new Array(_0x487d62[_0x3859('0x3b')][_0x3859('0x79')]);_0x2f96e6['forEach'](function(_0x400071){_0x4bcb46['or'](_0x3859('0x68'),'%,'+_0x400071+',%');});}if(_0x487d62[_0x3859('0x3b')]['filter']){var _0x13631e=_0x487d62[_0x3859('0x3b')][_0x3859('0x7a')][_0x3859('0x7b')]('\x5c','\x5c\x5c')[_0x3859('0x7b')](/'/g,'\x27\x27');if(qs[_0x3859('0x7c')](_0x13631e)){_0x19f262['or'](_0x3859('0x7d'),_0x13631e+'%');}else if(qs['isEmail'](_0x13631e)){_0x19f262['or'](_0x3859('0x7e'),_0x13631e+'%');}else{_0x19f262['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3859('0x62')](_0x13631e))['or'](_0x3859('0x7f'),qs[_0x3859('0x62')](_0x13631e));}}}_0x8a9712[_0x3859('0x43')](_0x19f262);_0x8a9712[_0x3859('0x80')]('i.id');var _0xd8ea00={'type':db[_0x3859('0x81')][_0x3859('0x82')]['SELECT'],'raw':!![]};var _0x2a6636=_0x8a9712[_0x3859('0x83')]();_0x2a6636[_0x3859('0x44')]('i.id');_0x2a6636[_0x3859('0x44')](_0x3859('0x84'),'unreadMessages');if(_0x5c46f7['order']){_0x5c46f7[_0x3859('0x41')][_0x3859('0x24')](function(_0x386457){var _0x82ef92=_0x386457[0x0]===_0x3859('0x85')?_0x386457[0x0]:'i.'+_0x386457[0x0];_0x8a9712[_0x3859('0x41')](_0x82ef92,_0x386457[0x1]===_0x3859('0x86')?![]:!![]);});}if(!_[_0x3859('0x6e')](_0x2f96e6)){_0x8a9712[_0x3859('0x5e')](_0x4bcb46);_0x2a6636[_0x3859('0x43')](_0x3859('0x87'),_0x2f96e6);}BPromise[_0x3859('0x88')]()[_0x3859('0x1b')](function(){if(!_0x23eb42){if(_0x487d62['query'][_0x3859('0x89')])return;_0x2a6636[_0x3859('0x43')](_0x3859('0x8a'));_0x8a9712[_0x3859('0x43')](_0x3859('0x8a'));return;}if(_0x487d62['user']['role']!==_0x3859('0x8b'))return;return _0x487d62[_0x3859('0x8c')][_0x3859('0x8d')]({'attributes':['id'],'raw':!![]})[_0x3859('0x1b')](function(_0x5764d6){if(_[_0x3859('0x6e')](_0x5764d6)){_0x2a6636[_0x3859('0x43')](_0x3859('0x8e'));_0x8a9712[_0x3859('0x43')]('i.MailAccountId\x20IS\x20NULL');}else{_0x2a6636['where']('i.MailAccountId\x20IN\x20?',_[_0x3859('0x34')](_0x5764d6,'id'));_0x8a9712[_0x3859('0x43')]('i.MailAccountId\x20IN\x20?',_[_0x3859('0x34')](_0x5764d6,'id'));}});})[_0x3859('0x1b')](function(){if(_0x487d62[_0x3859('0x8c')][_0x3859('0x8f')]===_0x3859('0x8b')&&!_0x23eb42&&!_0x487d62[_0x3859('0x3b')]['MailAccountId'])return[];return db[_0x3859('0x90')]['query'](_0x2a6636[_0x3859('0x91')](),_0xd8ea00);})['then'](function(_0x79f20f){_0x14656e[_0x3859('0x17')]=_0x79f20f[_0x3859('0x5a')];if(_0x14656e[_0x3859('0x17')]===0x0)return[];return db[_0x3859('0x90')][_0x3859('0x3b')](_0x544f81[_0x3859('0x91')](),_0xd8ea00)[_0x3859('0x1b')](function(_0x3d9647){_0x1ba26b=_[_0x3859('0x92')](_0x3d9647,'id');_0xd8ea00=_[_0x3859('0x93')](_0xd8ea00,{'model':db[_0x3859('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x487d62['query']['fields']){_0x5c46f7[_0x3859('0x3d')][_0x3859('0x24')](function(_0x26f300){_0x8a9712[_0x3859('0x44')]('i.'+_0x26f300);});}else{_0x8a9712['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x8a9712[_0x3859('0x44')](_0x3859('0x95'),_0x3859('0x96'));_0x8a9712['field'](_0x3859('0x97'),_0x3859('0x98'));_0x8a9712[_0x3859('0x44')](_0x3859('0x99'),_0x3859('0x9a'));_0x8a9712['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3859('0x85'));_0x8a9712[_0x3859('0x44')](_0x3859('0x9b'));_0x8a9712[_0x3859('0x44')](_0x3859('0x9c'));_0x8a9712[_0x3859('0x44')](_0x3859('0x9d'));_0x8a9712[_0x3859('0x44')](_0x3859('0x9e'));_0x8a9712['field'](_0x3859('0x9f'));_0x8a9712[_0x3859('0x44')](_0x3859('0xa0'));_0x8a9712[_0x3859('0x44')]('i.lastMsgAt');_0x8a9712[_0x3859('0x44')](_0x3859('0xa1'));_0x8a9712[_0x3859('0x44')](_0x3859('0xa2'));_0x8a9712[_0x3859('0x44')](_0x3859('0xa3'));_0x8a9712[_0x3859('0x44')](_0x3859('0xa4'));_0x8a9712[_0x3859('0x44')]('i.thirdDisposition');_0x8a9712[_0x3859('0x44')](_0x3859('0xa5'));_0x8a9712['field'](_0x3859('0xa6'));_0x8a9712[_0x3859('0x44')]('i.ContactId');_0x8a9712[_0x3859('0x44')](_0x3859('0xa7'));_0x8a9712['field']('i.UserId');_0x8a9712['field']('c.firstName',_0x3859('0xa8'));_0x8a9712[_0x3859('0x44')](_0x3859('0xa9'),_0x3859('0xaa'));_0x8a9712[_0x3859('0x44')](_0x3859('0xab'),'Contact.email');_0x8a9712[_0x3859('0x44')](_0x3859('0xac'),_0x3859('0xad'));_0x8a9712['field']('c.mobile','Contact.mobile');_0x8a9712[_0x3859('0x44')]('c.fax',_0x3859('0xae'));_0x8a9712['field'](_0x3859('0xaf'),_0x3859('0xb0'));_0x8a9712['field'](_0x3859('0xb1'),_0x3859('0xb2'));_0x8a9712[_0x3859('0x44')](_0x3859('0xb3'),_0x3859('0x22'));}if(_0x5c46f7[_0x3859('0x15')])_0x8a9712['limit'](_0x5c46f7[_0x3859('0x15')]);if(_0x5c46f7['offset'])_0x8a9712[_0x3859('0x16')](_0x5c46f7[_0x3859('0x16')]);return db['sequelize'][_0x3859('0x3b')](_0x8a9712[_0x3859('0x91')](),_0xd8ea00);})[_0x3859('0x1b')](function(_0x276257){if(_0x276257[_0x3859('0x5a')]>0x0)_0x26f730[_0x3859('0x43')](_0x3859('0xb4'),_[_0x3859('0x34')](_0x276257,'id'));return db['sequelize'][_0x3859('0x3b')](_0x26f730[_0x3859('0x91')](),_0xd8ea00)[_0x3859('0x1b')](function(_0x4116c6){var _0x519747=_[_0x3859('0xb5')](_0x4116c6,_0x3859('0xb6'));var _0x4a7d5d=[];return db[_0x3859('0xb7')][_0x3859('0x27')]({'attributes':[_0x3859('0xb8')],'raw':!![]})['then'](function(_0x3fc514){var _0x8b48c6=_0x3fc514[_0x3859('0xb8')];_0x276257[_0x3859('0x24')](function(_0x14fd65){_0x4a7d5d[_0x3859('0x26')](updateMailInteraction(_0x14fd65,_0x1ba26b,_0x519747,_0x8b48c6));});return BPromise[_0x3859('0xb9')](_0x4a7d5d);});});});})[_0x3859('0x1b')](function(_0x205a30){_0x14656e[_0x3859('0xba')]=_0x205a30;return _0x14656e;})[_0x3859('0x1b')](respondWithFilteredResult(_0x5007e6,_0x5c46f7))[_0x3859('0x2b')](handleError(_0x5007e6,null));};exports[_0x3859('0xbb')]=function(_0x1c3760,_0x30ccba){var _0x4ee214={'raw':![],'where':{'id':_0x1c3760[_0x3859('0xbc')]['id']}},_0x163134={};_0x163134['model']=_[_0x3859('0x3a')](db['MailInteraction'][_0x3859('0x35')]);_0x163134[_0x3859('0x3b')]=_['keys'](_0x1c3760[_0x3859('0x3b')]);_0x163134['filters']=_[_0x3859('0x3e')](_0x163134[_0x3859('0x39')],_0x163134[_0x3859('0x3b')]);_0x4ee214[_0x3859('0x3d')]=_['intersection'](_0x163134[_0x3859('0x39')],qs['fields'](_0x1c3760[_0x3859('0x3b')][_0x3859('0x3f')]));_0x4ee214['attributes']=_0x4ee214[_0x3859('0x3d')][_0x3859('0x5a')]?_0x4ee214['attributes']:_0x163134[_0x3859('0x39')];if(_0x1c3760['query']['includeAll']){_0x4ee214['include']=[{'all':!![]}];}_0x4ee214=_[_0x3859('0x93')]({},_0x4ee214,_0x1c3760['options']);return db[_0x3859('0x94')][_0x3859('0xbd')](_0x4ee214)[_0x3859('0x1b')](handleEntityNotFound(_0x30ccba,null))[_0x3859('0x1b')](respondWithResult(_0x30ccba,null))[_0x3859('0x2b')](handleError(_0x30ccba,null));};exports[_0x3859('0xbe')]=function(_0x3ef4a8,_0x3729a2){return db[_0x3859('0x94')]['create'](_0x3ef4a8[_0x3859('0xbf')],{})[_0x3859('0x1b')](respondWithResult(_0x3729a2,0xc9))[_0x3859('0x2b')](handleError(_0x3729a2,null));};exports[_0x3859('0x1a')]=function(_0x59ab93,_0x6d055b){if(_0x59ab93[_0x3859('0xbf')]['id']){delete _0x59ab93[_0x3859('0xbf')]['id'];}return db[_0x3859('0x94')][_0x3859('0xbd')]({'where':{'id':_0x59ab93[_0x3859('0xbc')]['id']}})['then'](handleEntityNotFound(_0x6d055b,null))['then'](saveUpdates(_0x59ab93[_0x3859('0xbf')],null))[_0x3859('0x1b')](respondWithResult(_0x6d055b,null))[_0x3859('0x2b')](handleError(_0x6d055b,null));};exports['destroy']=function(_0x2a81ed,_0x48f775){return db[_0x3859('0x94')][_0x3859('0xbd')]({'where':{'id':_0x2a81ed[_0x3859('0xbc')]['id']}})[_0x3859('0x1b')](handleEntityNotFound(_0x48f775,null))['then'](removeEntity(_0x48f775,null))[_0x3859('0x2b')](handleError(_0x48f775,null));};exports['describe']=function(_0x54afd3,_0x5e915d){return db[_0x3859('0x94')]['describe']()[_0x3859('0x1b')](respondWithResult(_0x5e915d,null))[_0x3859('0x2b')](handleError(_0x5e915d,null));};exports[_0x3859('0xc0')]=function(_0xab2d4a,_0x354e0e){return db[_0x3859('0xc1')][_0x3859('0xbd')]({'where':{'id':_0xab2d4a[_0x3859('0xbc')]['id']}})['then'](handleEntityNotFound(_0x354e0e,null))['then'](function(_0x4521ef){if(_0x4521ef){return _0x4521ef[_0x3859('0xc0')](_0xab2d4a[_0x3859('0xbf')][_0x3859('0xc2')],_[_0x3859('0xc3')](_0xab2d4a[_0x3859('0xbf')],['ids','id'])||{});}})[_0x3859('0x1b')](respondWithResult(_0x354e0e,null))[_0x3859('0x2b')](handleError(_0x354e0e,null));};exports[_0x3859('0xc4')]=function(_0x552b4a,_0x3d91b5){var _0x497551={'raw':![],'where':{}};var _0x4a6d65={};var _0x2a9822={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x552b4a[_0x3859('0xbc')]['id']}})[_0x3859('0x1b')](handleEntityNotFound(_0x3d91b5,null))[_0x3859('0x1b')](function(_0x2ed367){if(_0x2ed367){_0x4a6d65[_0x3859('0x39')]=_['keys'](db[_0x3859('0xc1')]['rawAttributes']);_0x4a6d65['query']=_[_0x3859('0x3a')](_0x552b4a['query']);_0x4a6d65['filters']=_[_0x3859('0x3e')](_0x4a6d65[_0x3859('0x39')],_0x4a6d65[_0x3859('0x3b')]);_0x497551['attributes']=_[_0x3859('0x3e')](_0x4a6d65[_0x3859('0x39')],qs[_0x3859('0x3f')](_0x552b4a['query'][_0x3859('0x3f')]));_0x497551[_0x3859('0x3d')]=_0x497551[_0x3859('0x3d')][_0x3859('0x5a')]?_0x497551['attributes']:_0x4a6d65[_0x3859('0x39')];if(!_0x552b4a[_0x3859('0x3b')]['hasOwnProperty']('nolimit')){_0x497551[_0x3859('0x15')]=qs[_0x3859('0x15')](_0x552b4a[_0x3859('0x3b')][_0x3859('0x15')]);_0x497551[_0x3859('0x16')]=qs['offset'](_0x552b4a[_0x3859('0x3b')]['offset']);}_0x497551[_0x3859('0x41')]=qs[_0x3859('0x42')](_0x552b4a['query']['sort']);_0x497551[_0x3859('0x43')]=qs['filters'](_[_0x3859('0xc5')](_0x552b4a[_0x3859('0x3b')],_0x4a6d65[_0x3859('0x3c')]));_0x497551[_0x3859('0x43')][_0x3859('0xb6')]=_0x2ed367['id'];if(_0x552b4a[_0x3859('0x3b')]['filter']){_0x497551[_0x3859('0x43')]=_[_0x3859('0x93')](_0x497551['where'],{'$or':_['map'](_0x497551[_0x3859('0x3d')],function(_0x3af798){var _0x45bb03={};_0x45bb03[_0x3af798]={'$like':'%'+_0x552b4a[_0x3859('0x3b')][_0x3859('0x7a')]+'%'};return _0x45bb03;})});}if(_0x552b4a[_0x3859('0x3b')][_0x3859('0x70')]){var _0x5a8997=_0x552b4a['query'][_0x3859('0x70')][_0x3859('0x23')](',');var _0x463bec={};_0x463bec[_0x5a8997[0x0]]={'$gte':moment(_0x5a8997[0x1])[_0x3859('0xc6')](_0x3859('0xc7'))};_0x497551[_0x3859('0x43')]=_[_0x3859('0x93')](_0x497551[_0x3859('0x43')],_0x463bec);}_0x497551=_[_0x3859('0x93')]({},_0x497551,_0x552b4a[_0x3859('0xc8')]);return db[_0x3859('0xc1')][_0x3859('0x17')]({'where':_0x497551['where']})['then'](function(_0x2af09d){_0x2a9822[_0x3859('0x17')]=_0x2af09d;if(_0x552b4a['query']['includeAll']){_0x497551[_0x3859('0xc9')]=[{'all':!![]}];}return db[_0x3859('0xc1')][_0x3859('0xca')](_0x497551);})[_0x3859('0x1b')](function(_0x11cc02){if(_0x552b4a[_0x3859('0x3b')][_0x3859('0xcb')]===_0x3859('0xcc')){for(var _0x174c7c=0x0;_0x174c7c<_0x11cc02[_0x3859('0x5a')];_0x174c7c++){_0x11cc02[_0x174c7c][_0x3859('0xbf')]=juice(_0x11cc02[_0x174c7c]['body']);}}_0x2a9822[_0x3859('0xba')]=_0x11cc02;return _0x2a9822;});}})['then'](respondWithFilteredResult(_0x3d91b5,_0x497551))[_0x3859('0x2b')](handleError(_0x3d91b5,null));};exports['addTags']=function(_0x3759d2,_0x475a79){return db[_0x3859('0x94')][_0x3859('0xbd')]({'where':{'id':_0x3759d2[_0x3859('0xbc')]['id']}})['then'](handleEntityNotFound(_0x475a79,null))['then'](function(_0x4d2f7d){if(_0x4d2f7d){return _0x4d2f7d['setTags'](_0x3759d2['body'][_0x3859('0xc2')],_['omit'](_0x3759d2[_0x3859('0xbf')],[_0x3859('0xc2'),'id'])||{})[_0x3859('0xcd')](function(){return db[_0x3859('0x67')][_0x3859('0xca')]({'attributes':['id','name',_0x3859('0x45')],'where':{'id':_0x3759d2['body']['ids']}});})[_0x3859('0x1b')](function(_0x302fe7){socket[_0x3859('0xce')]('mailInteractionTags:save',{'id':Number(_0x3759d2[_0x3859('0xbc')]['id']),'tags':_0x302fe7||[]});return{'id':Number(_0x3759d2[_0x3859('0xbc')]['id']),'tags':_0x302fe7||[]};});}})[_0x3859('0x1b')](respondWithResult(_0x475a79,null))[_0x3859('0x2b')](handleError(_0x475a79,null));};exports[_0x3859('0xcf')]=function(_0x1169ba,_0x2e8700){return db[_0x3859('0x94')][_0x3859('0xbd')]({'where':{'id':_0x1169ba[_0x3859('0xbc')]['id']}})[_0x3859('0x1b')](handleEntityNotFound(_0x2e8700,null))[_0x3859('0x1b')](function(_0x4b7b90){if(_0x4b7b90){return _0x4b7b90[_0x3859('0xcf')](_0x1169ba[_0x3859('0x3b')][_0x3859('0xc2')]);}})[_0x3859('0x1b')](respondWithStatusCode(_0x2e8700,null))[_0x3859('0x2b')](handleError(_0x2e8700,null));};exports[_0x3859('0xd0')]=function(_0x167c68,_0x1b4116){var _0x9ad510=moment()['unix']()[_0x3859('0x91')]();var _0x59470a=path[_0x3859('0xd1')](config[_0x3859('0xd2')],'server',_0x3859('0xd3'),_0x3859('0xd4'));var _0x204069=path[_0x3859('0xd1')](config[_0x3859('0xd2')],'server',_0x3859('0xd3'),_0x3859('0xd5'));var _0x1604d9=path['join'](_0x59470a,_0x9ad510);var _0x2bc19a=util[_0x3859('0xc6')]('transcript-%d-%s.zip',_0x167c68[_0x3859('0xbc')]['id'],_0x9ad510);var _0x38e408=path['join'](_0x59470a,_0x2bc19a);var _0x10cc63=[];if(_0x167c68[_0x3859('0x3b')][_0x3859('0xd5')]){_0x10cc63[_0x3859('0x26')]({'model':db[_0x3859('0xd6')],'as':_0x3859('0xd7'),'raw':!![]});}var _0x4665eb=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x3859('0xbf'),_0x3859('0x46'),'to','cc',_0x3859('0xd8'),_0x3859('0xd9'),_0x3859('0x6f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x10cc63}];return db[_0x3859('0x94')][_0x3859('0xbd')]({'where':{'id':_0x167c68[_0x3859('0xbc')]['id']},'include':_0x4665eb})[_0x3859('0x1b')](handleEntityNotFound(_0x1b4116,null))[_0x3859('0x1b')](function(_0x4d653b){if(_0x4d653b&&_0x4d653b[_0x3859('0xda')]){var _0x5a3631=_0x4d653b['get']({'plain':!![]});fs[_0x3859('0xdb')](_0x1604d9);return BPromise['each'](_0x5a3631[_0x3859('0xda')],function(_0x1605ed,_0x2abfc9){var _0x449e75={'from':_0x1605ed[_0x3859('0x46')],'to':_0x1605ed['to'],'subject':_0x1605ed[_0x3859('0xd9')],'html':htmlEntities[_0x3859('0xdc')](_0x1605ed[_0x3859('0xbf')]),'headers':{'Date':moment(_0x1605ed[_0x3859('0x6f')])[_0x3859('0xc6')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1605ed['cc']){_0x449e75[_0x3859('0xdd')]['Cc']=_0x1605ed['cc'];}if(_0x1605ed['bcc']){_0x449e75[_0x3859('0xdd')][_0x3859('0xde')]=_0x1605ed[_0x3859('0xd8')];}return new BPromise(function(_0x113978,_0x39df32){if(_0x1605ed['Attachments']){for(var _0x3d4766=0x0;_0x3d4766<_0x1605ed[_0x3859('0xd7')][_0x3859('0x5a')];_0x3d4766++){var _0x39901c=_0x1605ed[_0x3859('0xd7')][_0x3d4766];var _0x12ed02=path[_0x3859('0xd1')](_0x204069,_0x39901c[_0x3859('0xdf')]);if(fs[_0x3859('0xe0')](_0x12ed02)){_0x449e75[_0x3859('0xd5')]['push']({'name':_0x39901c[_0x3859('0x1e')],'contentType':_0x39901c[_0x3859('0x37')],'data':fs[_0x3859('0xe1')](_0x12ed02)});}}}emlformat[_0x3859('0xe2')](_0x449e75,function(_0x40632c,_0x2f516a){if(_0x40632c)return _0x39df32(_0x40632c);fs['writeFileSync'](path['join'](_0x1604d9,util['format'](_0x3859('0xe3'),_0x2abfc9)),_0x2f516a);return _0x113978(_0x2f516a);});});})[_0x3859('0x1b')](function(){return new BPromise(function(_0x382359,_0x3e7490){zipdir(_0x1604d9,{'saveTo':_0x38e408},function(_0x46620c,_0x4ad486){if(_0x46620c)return _0x3e7490(_0x46620c);return _0x382359(_0x4ad486);});})[_0x3859('0x1b')](function(){return new BPromise(function(_0x1c17ec,_0x592585){rimraf(_0x1604d9,function(_0x38f721){if(_0x38f721)_0x592585(_0x38f721);return _0x1c17ec();});});})['then'](function(){return _0x1b4116[_0x3859('0xd0')](_0x38e408,_0x2bc19a,function(_0x33c625){if(!_0x33c625)fs['unlinkSync'](_0x38e408);});});});}else{return _0x1b4116['sendStatus'](0xc8);}})['catch'](handleError(_0x1b4116,null));}; \ No newline at end of file +var _0x2c8c=['addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','unix','join','root','tmp','server','files','format','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','decode','headers','Bcc','existsSync','readFileSync','build','writeFileSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','squel','juice','ioredis','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','push','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','keys','compact','isEmpty','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','includeAll','options','MailInteraction','create','body','describe','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll'];(function(_0x5c2a08,_0xfcdd55){var _0x25ea44=function(_0x428153){while(--_0x428153){_0x5c2a08['push'](_0x5c2a08['shift']());}};_0x25ea44(++_0xfcdd55);}(_0x2c8c,0x10d));var _0xc2c8=function(_0x4c06f0,_0x54f5cd){_0x4c06f0=_0x4c06f0-0x0;var _0x3c0d17=_0x2c8c[_0x4c06f0];return _0x3c0d17;};'use strict';var emlformat=require(_0xc2c8('0x0'));var rimraf=require(_0xc2c8('0x1'));var zipdir=require(_0xc2c8('0x2'));var moment=require(_0xc2c8('0x3'));var BPromise=require(_0xc2c8('0x4'));var util=require(_0xc2c8('0x5'));var path=require(_0xc2c8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc2c8('0x7'));var juice=require(_0xc2c8('0x8'));var Redis=require(_0xc2c8('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0xc2c8('0xa'))(_0xc2c8('0xb'));var config=require('../../config/environment');var db=require(_0xc2c8('0xc'))['db'];var htmlEntities=require(_0xc2c8('0xd'));config[_0xc2c8('0xe')]=_[_0xc2c8('0xf')](config[_0xc2c8('0xe')],{'host':_0xc2c8('0x10'),'port':0x18eb});var socket=require(_0xc2c8('0x11'))(new Redis(config[_0xc2c8('0xe')]));require(_0xc2c8('0x12'))['register'](socket);function respondWithStatusCode(_0x460836,_0x2cb4f1){_0x2cb4f1=_0x2cb4f1||0xcc;return function(_0x30926f){if(_0x30926f){return _0x460836[_0xc2c8('0x13')](_0x2cb4f1);}return _0x460836['status'](_0x2cb4f1)[_0xc2c8('0x14')]();};}function respondWithResult(_0x43dbaf,_0x3d76e8){_0x3d76e8=_0x3d76e8||0xc8;return function(_0x2f7663){if(_0x2f7663){return _0x43dbaf[_0xc2c8('0x15')](_0x3d76e8)[_0xc2c8('0x16')](_0x2f7663);}};}function respondWithFilteredResult(_0x5e1181,_0x1ad393){return function(_0x2cc479){if(_0x2cc479){var _0x230a93=typeof _0x1ad393[_0xc2c8('0x17')]===_0xc2c8('0x18')&&typeof _0x1ad393[_0xc2c8('0x19')]===_0xc2c8('0x18');var _0x4d0595=_0x2cc479[_0xc2c8('0x1a')];var _0x4cdd6d=_0x230a93?0x0:_0x1ad393[_0xc2c8('0x17')];var _0x5dcde7=_0x230a93?_0x2cc479['count']:_0x1ad393[_0xc2c8('0x17')]+_0x1ad393['limit'];var _0x52e287;if(_0x5dcde7>=_0x4d0595){_0x5dcde7=_0x4d0595;_0x52e287=0xc8;}else{_0x52e287=0xce;}_0x5e1181[_0xc2c8('0x15')](_0x52e287);return _0x5e1181['set'](_0xc2c8('0x1b'),_0x4cdd6d+'-'+_0x5dcde7+'/'+_0x4d0595)[_0xc2c8('0x16')](_0x2cc479);}return null;};}function saveUpdates(_0x35ea35){return function(_0x16165e){if(_0x16165e){return _0x16165e[_0xc2c8('0x1c')](_0x35ea35)[_0xc2c8('0x1d')](function(_0x40a8ff){return _0x40a8ff;});}return null;};}function removeEntity(_0x2ff325){return function(_0x46f31c){if(_0x46f31c){return _0x46f31c[_0xc2c8('0x1e')]()['then'](function(){_0x2ff325['status'](0xcc)[_0xc2c8('0x14')]();});}};}function handleEntityNotFound(_0x587fee){return function(_0x4c2e83){if(!_0x4c2e83){_0x587fee[_0xc2c8('0x13')](0x194);}return _0x4c2e83;};}function handleError(_0x4e0af7,_0x47c1a0){_0x47c1a0=_0x47c1a0||0x1f4;return function(_0xcde994){logger[_0xc2c8('0x1f')](_0xcde994[_0xc2c8('0x20')]);if(_0xcde994[_0xc2c8('0x21')]){delete _0xcde994[_0xc2c8('0x21')];}_0x4e0af7['status'](_0x47c1a0)[_0xc2c8('0x22')](_0xcde994);};}function getInteractionUsers(_0x5d954a,_0x28566f){return new BPromise(function(_0x2b327f,_0x42b85b){try{if(_0x28566f[_0x5d954a['id']]){_0x5d954a[_0xc2c8('0x23')]=_[_0xc2c8('0x24')](_0x28566f[_0x5d954a['id']],function(_0x2d47a8){return{'id':_0x2d47a8['id'],'fullname':_0x2d47a8[_0xc2c8('0x25')]};});}}catch(_0x3c7ff2){_0x42b85b(_0x3c7ff2);}_0x2b327f(_0x5d954a);});}function getInteractionTags(_0x230c40,_0x20de28){return new BPromise(function(_0x3794a1,_0x3d4cde){try{if(_0x230c40[_0xc2c8('0x26')]){_0x230c40[_0xc2c8('0x27')]=[];_0x230c40[_0xc2c8('0x26')]['split'](',')['forEach'](function(_0x452979){_0x230c40['Tags'][_0xc2c8('0x28')](_0x20de28[_0x452979]);});}delete _0x230c40[_0xc2c8('0x26')];}catch(_0x177d49){_0x3d4cde(_0x177d49);}_0x3794a1(_0x230c40);});}function getLastMessageText(_0x137c6e){return new BPromise(function(_0x2e92f2,_0x1a2ee4){return db[_0xc2c8('0x29')][_0xc2c8('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x137c6e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc2c8('0x2b')],'order':_0xc2c8('0x2c'),'raw':!![]})[_0xc2c8('0x1d')](function(_0x909e2c){if(_0x909e2c&&_0x909e2c[_0xc2c8('0x2b')]){_0x137c6e[_0xc2c8('0x2d')]=_[_0xc2c8('0x2e')](_0x909e2c[_0xc2c8('0x2b')]);}_0x2e92f2(_0x137c6e);})['catch'](function(_0x5b180a){_0x1a2ee4(_0x5b180a);});});}function updateMailInteraction(_0x55ceec,_0x1748a4,_0x47b423,_0x36df3b){return new BPromise(function(_0x104839,_0x38b244){return getInteractionUsers(_0x55ceec,_0x47b423)['then'](function(_0x102168){return getInteractionTags(_0x102168,_0x1748a4);})[_0xc2c8('0x1d')](function(_0x44f6f3){return getStateInteraction(_0x44f6f3);})[_0xc2c8('0x1d')](function(_0x2fc124){if(_0x36df3b){_0x104839(getLastMessageText(_0x2fc124));}else{_0x104839(_0x2fc124);}})[_0xc2c8('0x2f')](function(_0x4764ed){_0x38b244(_0x4764ed);});});}function getStateInteraction(_0x284a19){return new BPromise(function(_0x49b136){_0x284a19[_0xc2c8('0x30')]=0x0;_0x284a19[_0xc2c8('0x31')]=0x0;_0x284a19['answered']=0x0;_0x284a19[_0xc2c8('0x32')]=0x0;_0x284a19[_0xc2c8('0x33')]=0x0;if(!_0x284a19[_0xc2c8('0x34')]&&!_0x284a19[_0xc2c8('0x35')]){_0x284a19[_0xc2c8('0x30')]+=0x1;}if(!_0x284a19[_0xc2c8('0x34')]&&_0x284a19[_0xc2c8('0x35')]){_0x284a19[_0xc2c8('0x31')]+=0x1;if(_0x284a19[_0xc2c8('0x30')]){_0x284a19[_0xc2c8('0x30')]-=0x1;}}if(_0x284a19['closed']&&_0x284a19[_0xc2c8('0x35')]){_0x284a19[_0xc2c8('0x36')]+=0x1;if(_0x284a19['talking']){_0x284a19[_0xc2c8('0x31')]-=0x1;}}if(_0x284a19[_0xc2c8('0x34')]&&!_0x284a19['UserId']){_0x284a19[_0xc2c8('0x32')]+=0x1;if(_0x284a19[_0xc2c8('0x30')]){_0x284a19[_0xc2c8('0x30')]-=0x1;}}_0x284a19[_0xc2c8('0x33')]+=0x1;_0x49b136(_0x284a19);});}exports[_0xc2c8('0x37')]=function(_0x108c64,_0x4d6654){var _0x52857b={},_0x23f62d={},_0x53afc7={'count':0x0,'rows':[]};var _0xce5c3f=_['map'](db['MailInteraction'][_0xc2c8('0x38')],function(_0x26f031){return{'name':_0x26f031[_0xc2c8('0x39')],'type':_0x26f031[_0xc2c8('0x3a')][_0xc2c8('0x3b')]};});_0x23f62d[_0xc2c8('0x3c')]=_[_0xc2c8('0x24')](_0xce5c3f,'name');_0x23f62d[_0xc2c8('0x3d')]=_['keys'](_0x108c64[_0xc2c8('0x3d')]);_0x23f62d[_0xc2c8('0x3e')]=_[_0xc2c8('0x3f')](_0x23f62d['model'],_0x23f62d[_0xc2c8('0x3d')]);_0x52857b[_0xc2c8('0x40')]=_[_0xc2c8('0x3f')](_0x23f62d['model'],qs[_0xc2c8('0x41')](_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x41')]));_0x52857b[_0xc2c8('0x40')]=_0x52857b[_0xc2c8('0x40')]['length']?_0x52857b[_0xc2c8('0x40')]:_0x23f62d['model'];if(!_0x108c64['query'][_0xc2c8('0x42')](_0xc2c8('0x43'))){_0x52857b['limit']=qs[_0xc2c8('0x19')](_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x19')]);_0x52857b['offset']=qs[_0xc2c8('0x17')](_0x108c64[_0xc2c8('0x3d')]['offset']);}_0x52857b[_0xc2c8('0x44')]=qs[_0xc2c8('0x45')](_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x45')]);_0x52857b['where']=qs[_0xc2c8('0x3e')](_['pick'](_0x108c64[_0xc2c8('0x3d')],_0x23f62d[_0xc2c8('0x3e')]),_0xce5c3f);var _0xf9d83e=[];var _0xb4eb63=squel[_0xc2c8('0x46')]()[_0xc2c8('0x47')]('id')[_0xc2c8('0x47')]('name')['field'](_0xc2c8('0x48'))[_0xc2c8('0x49')](_0xc2c8('0x4a'));var _0x29321a=squel[_0xc2c8('0x46')]()[_0xc2c8('0x47')]('u.id')[_0xc2c8('0x47')]('u.fullname')[_0xc2c8('0x47')]('ui.MailInteractionId')[_0xc2c8('0x49')]('user_has_mail_interactions','ui')[_0xc2c8('0x4b')](_0xc2c8('0x4c'),'u',_0xc2c8('0x4d'));var _0x1030e1=squel[_0xc2c8('0x46')]()['from'](_0xc2c8('0x4e'),'i')['left_join'](_0xc2c8('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc2c8('0x4b')](_0xc2c8('0x4c'),'o',_0xc2c8('0x50'))[_0xc2c8('0x4b')](_0xc2c8('0x51'),'a',_0xc2c8('0x52'))[_0xc2c8('0x4b')](_0xc2c8('0x53'),'me',_0xc2c8('0x54'))[_0xc2c8('0x4b')](_0xc2c8('0x55'),'it',_0xc2c8('0x56'))['left_join']('tools_tags','t',_0xc2c8('0x57'));var _0x4b8388=squel[_0xc2c8('0x58')]();var _0x5bc256=[];var _0x2e471a=squel[_0xc2c8('0x58')]();var _0x50bf06;if(_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x59')]){_0x50bf06=as[_0xc2c8('0x5a')](_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x59')]);var _0x318965=_0x50bf06[_0xc2c8('0x5b')];for(var _0x4cf43e=0x0;_0x4cf43e<_0x50bf06[_0xc2c8('0x5c')]['length'];_0x4cf43e++){var _0x348e14=_0x50bf06[_0xc2c8('0x5c')][_0x4cf43e];var _0x12e656='i';var _0x394548=_[_0xc2c8('0x5d')](_0xce5c3f,[_0xc2c8('0x21'),_0x348e14[_0xc2c8('0x47')]]);if(!_0x394548){switch(_0x348e14[_0xc2c8('0x47')]){case _0xc2c8('0x5e'):if(_0x348e14[_0xc2c8('0x5f')]==0x1){_0x1030e1[_0xc2c8('0x60')]('`'+_0x348e14[_0xc2c8('0x47')]+_0xc2c8('0x61'));}else{_0x1030e1[_0xc2c8('0x60')]('`'+_0x348e14['field']+_0xc2c8('0x62'));}break;case _0xc2c8('0x63'):if(_0x348e14[_0xc2c8('0x64')]===_0xc2c8('0x65')){if(_0x348e14[_0xc2c8('0x5f')][_0xc2c8('0x66')]('\x20')[_0xc2c8('0x67')]>0x1){_0x4b8388[_0x318965](_0xc2c8('0x68'),qs['getFullTextValue'](_0x348e14[_0xc2c8('0x5f')]),null);}else{var _0x3e9db2='%'+_0x348e14[_0xc2c8('0x5f')]+'%';_0x4b8388[_0x318965]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3e9db2,_0x3e9db2,_0x3e9db2);}}else{_0x394548=_[_0xc2c8('0x5d')](_0xce5c3f,[_0xc2c8('0x21'),_0xc2c8('0x69')]);_0x348e14[_0xc2c8('0x47')]=_0xc2c8('0x69');_0x11533e=as['buildExpression'](_0x12e656,_0x394548[_0xc2c8('0x3a')],_0x348e14);_0x4b8388[_0x318965](_0x11533e[_0xc2c8('0x6a')],_0x11533e[_0xc2c8('0x5f')][_0xc2c8('0x6b')],_0x11533e[_0xc2c8('0x5f')][_0xc2c8('0x14')]);}break;case'Tag':var _0x2d10e9=_0x348e14[_0xc2c8('0x5f')]['split'](',')[_0xc2c8('0x24')](function(_0x1fc08e){return Number(_0x1fc08e);});_0x2d10e9[_0xc2c8('0x6c')](function(_0x75159a){_0x2e471a['or'](_0xc2c8('0x6d'),'%,'+_0x75159a+',%');});_0x5bc256=_['union'](_0x5bc256,_0x2d10e9);break;case _0xc2c8('0x6e'):if(_0x348e14[_0xc2c8('0x64')]==='$substring'){_0x4b8388[_0x318965](_0xc2c8('0x6f'),'%'+_0x348e14[_0xc2c8('0x5f')]+'%',null);}else{_0x394548=_[_0xc2c8('0x5d')](_0xce5c3f,[_0xc2c8('0x21'),_0xc2c8('0x35')]);_0x348e14['field']='UserId';_0x11533e=as[_0xc2c8('0x70')](_0x12e656,_0x394548[_0xc2c8('0x3a')],_0x348e14);_0x4b8388[_0x318965](_0x11533e[_0xc2c8('0x6a')],_0x11533e[_0xc2c8('0x5f')][_0xc2c8('0x6b')],_0x11533e[_0xc2c8('0x5f')][_0xc2c8('0x14')]);}break;case'plainBody':_0x11533e=as[_0xc2c8('0x70')]('me',null,_0x348e14);_0x4b8388[_0x318965](_0x11533e[_0xc2c8('0x6a')],_0x11533e[_0xc2c8('0x5f')][_0xc2c8('0x6b')],_0x11533e['value'][_0xc2c8('0x14')]);break;}}else{var _0x11533e=as[_0xc2c8('0x70')](_0x12e656,_0x394548[_0xc2c8('0x3a')],_0x348e14);_0x4b8388[_0x318965](_0x11533e['text'],_0x11533e[_0xc2c8('0x5f')][_0xc2c8('0x6b')],_0x11533e[_0xc2c8('0x5f')]['end']);}}}else{var _0x4a187a=_(_0x108c64['query'])[_0xc2c8('0x71')]()[_0xc2c8('0x24')](function(_0x4819f2){return _['some'](_0xce5c3f,[_0xc2c8('0x21'),_0x4819f2])?_0x4819f2:undefined;})[_0xc2c8('0x72')]()[_0xc2c8('0x5f')]();if(!_[_0xc2c8('0x73')](_0x4a187a)){_0x4a187a['forEach'](function(_0x363fb0){if(_0x363fb0==='MailAccountId'){_0x1030e1[_0xc2c8('0x74')](_0xc2c8('0x75'),[][_0xc2c8('0x76')](_0x108c64[_0xc2c8('0x3d')][_0x363fb0]));}else if(_0x363fb0===_0xc2c8('0x77')){var _0x361107=JSON[_0xc2c8('0x78')](_0x108c64[_0xc2c8('0x3d')][_0x363fb0])['$gte'];var _0x51921d=JSON[_0xc2c8('0x78')](_0x108c64[_0xc2c8('0x3d')][_0x363fb0])[_0xc2c8('0x79')];_0x1030e1[_0xc2c8('0x74')](_0xc2c8('0x7a'),_0x361107,_0x51921d);}else{if(_0x108c64[_0xc2c8('0x3d')][_0x363fb0]===_0xc2c8('0x7b')){_0x1030e1['where']('i.'+_0x363fb0+_0xc2c8('0x7c'));}else{_0x1030e1['where']('i.'+_0x363fb0+_0xc2c8('0x7d'),_0x108c64[_0xc2c8('0x3d')][_0x363fb0]);}}});}if(_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x7e')]){if(_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x7e')]==0x1){_0x1030e1['having'](_0xc2c8('0x7f'));}else{_0x1030e1[_0xc2c8('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x108c64[_0xc2c8('0x3d')]['tag']){_0x5bc256=_[_0xc2c8('0x80')](_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x81')])?_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x81')]:new Array(_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x81')]);_0x5bc256[_0xc2c8('0x6c')](function(_0x520f74){_0x2e471a['or'](_0xc2c8('0x6d'),'%,'+_0x520f74+',%');});}if(_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x82')]){var _0x567c06=_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x82')]['replace']('\x5c','\x5c\x5c')[_0xc2c8('0x83')](/'/g,'\x27\x27');if(qs[_0xc2c8('0x84')](_0x567c06)){_0x4b8388['or'](_0xc2c8('0x85'),_0x567c06+'%');}else if(qs[_0xc2c8('0x86')](_0x567c06)){_0x4b8388['or'](_0xc2c8('0x87'),_0x567c06+'%');}else{_0x4b8388['or'](_0xc2c8('0x88'),qs['getFullTextValue'](_0x567c06))['or'](_0xc2c8('0x89'),qs[_0xc2c8('0x8a')](_0x567c06));}}}_0x1030e1['where'](_0x4b8388);_0x1030e1[_0xc2c8('0x8b')](_0xc2c8('0x8c'));var _0x507d6f={'type':db[_0xc2c8('0x8d')]['QueryTypes'][_0xc2c8('0x8e')],'raw':!![]};var _0x2c1da2=_0x1030e1[_0xc2c8('0x8f')]();_0x2c1da2['field'](_0xc2c8('0x8c'));_0x2c1da2['field'](_0xc2c8('0x90'),_0xc2c8('0x5e'));if(_0x52857b[_0xc2c8('0x44')]){_0x52857b[_0xc2c8('0x44')]['forEach'](function(_0x5549e7){var _0x2bc6eb=_0x5549e7[0x0]===_0xc2c8('0x91')?_0x5549e7[0x0]:'i.'+_0x5549e7[0x0];_0x1030e1[_0xc2c8('0x44')](_0x2bc6eb,_0x5549e7[0x1]===_0xc2c8('0x92')?![]:!![]);});}if(!_[_0xc2c8('0x73')](_0x5bc256)){_0x1030e1[_0xc2c8('0x60')](_0x2e471a);_0x2c1da2[_0xc2c8('0x74')](_0xc2c8('0x93'),_0x5bc256);}BPromise[_0xc2c8('0x94')]()[_0xc2c8('0x1d')](function(){if(!_0x50bf06){if(_0x108c64[_0xc2c8('0x3d')][_0xc2c8('0x95')])return;_0x2c1da2[_0xc2c8('0x74')](_0xc2c8('0x96'));_0x1030e1[_0xc2c8('0x74')](_0xc2c8('0x96'));return;}if(_0x108c64[_0xc2c8('0x97')][_0xc2c8('0x98')]!=='agent')return;return _0x108c64[_0xc2c8('0x97')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xc2c8('0x1d')](function(_0x136a20){if(_[_0xc2c8('0x73')](_0x136a20)){_0x2c1da2[_0xc2c8('0x74')](_0xc2c8('0x99'));_0x1030e1[_0xc2c8('0x74')]('i.MailAccountId\x20IS\x20NULL');}else{_0x2c1da2[_0xc2c8('0x74')](_0xc2c8('0x75'),_[_0xc2c8('0x24')](_0x136a20,'id'));_0x1030e1[_0xc2c8('0x74')]('i.MailAccountId\x20IN\x20?',_[_0xc2c8('0x24')](_0x136a20,'id'));}});})[_0xc2c8('0x1d')](function(){if(_0x108c64[_0xc2c8('0x97')][_0xc2c8('0x98')]===_0xc2c8('0x9a')&&!_0x50bf06&&!_0x108c64['query']['MailAccountId'])return[];return db['sequelize']['query'](_0x2c1da2[_0xc2c8('0x9b')](),_0x507d6f);})['then'](function(_0x5afbcf){_0x53afc7[_0xc2c8('0x1a')]=_0x5afbcf[_0xc2c8('0x67')];if(_0x53afc7[_0xc2c8('0x1a')]===0x0)return[];return db[_0xc2c8('0x9c')][_0xc2c8('0x3d')](_0xb4eb63[_0xc2c8('0x9b')](),_0x507d6f)[_0xc2c8('0x1d')](function(_0x534bd5){_0xf9d83e=_['keyBy'](_0x534bd5,'id');_0x507d6f=_[_0xc2c8('0x9d')](_0x507d6f,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x108c64[_0xc2c8('0x3d')]['fields']){_0x52857b['attributes'][_0xc2c8('0x6c')](function(_0x2bb5a4){_0x1030e1[_0xc2c8('0x47')]('i.'+_0x2bb5a4);});}else{_0x1030e1['field'](_0xc2c8('0x90'),_0xc2c8('0x5e'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0x9e'),_0xc2c8('0x9f'));_0x1030e1['field'](_0xc2c8('0xa0'),_0xc2c8('0xa1'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xa2'),_0xc2c8('0xa3'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xa4'),_0xc2c8('0x91'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0x8c'));_0x1030e1[_0xc2c8('0x47')]('i.createdAt');_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xa5'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xa6'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xa7'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xa8'));_0x1030e1[_0xc2c8('0x47')]('i.lastMsgAt');_0x1030e1[_0xc2c8('0x47')]('i.lastMsgDirection');_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xa9'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xaa'));_0x1030e1[_0xc2c8('0x47')]('i.secondDisposition');_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xab'));_0x1030e1['field'](_0xc2c8('0xac'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xad'));_0x1030e1[_0xc2c8('0x47')]('i.ContactId');_0x1030e1['field'](_0xc2c8('0xae'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xaf'));_0x1030e1[_0xc2c8('0x47')]('c.firstName',_0xc2c8('0xb0'));_0x1030e1['field'](_0xc2c8('0xb1'),_0xc2c8('0xb2'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xb3'),_0xc2c8('0xb4'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xb5'),_0xc2c8('0xb6'));_0x1030e1['field'](_0xc2c8('0xb7'),_0xc2c8('0xb8'));_0x1030e1[_0xc2c8('0x47')]('c.fax',_0xc2c8('0xb9'));_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xba'),'Owner.fullname');_0x1030e1['field']('o.internal','Owner.internal');_0x1030e1[_0xc2c8('0x47')](_0xc2c8('0xbb'),_0xc2c8('0x26'));}if(_0x52857b[_0xc2c8('0x19')])_0x1030e1[_0xc2c8('0x19')](_0x52857b['limit']);if(_0x52857b[_0xc2c8('0x17')])_0x1030e1[_0xc2c8('0x17')](_0x52857b['offset']);return db[_0xc2c8('0x9c')][_0xc2c8('0x3d')](_0x1030e1['toString'](),_0x507d6f);})[_0xc2c8('0x1d')](function(_0x5389d6){if(_0x5389d6[_0xc2c8('0x67')]>0x0)_0x29321a[_0xc2c8('0x74')](_0xc2c8('0xbc'),_[_0xc2c8('0x24')](_0x5389d6,'id'));return db[_0xc2c8('0x9c')][_0xc2c8('0x3d')](_0x29321a['toString'](),_0x507d6f)[_0xc2c8('0x1d')](function(_0x1f184c){var _0x2c32ba=_[_0xc2c8('0xbd')](_0x1f184c,_0xc2c8('0xbe'));var _0x3dc8b2=[];return db[_0xc2c8('0xbf')][_0xc2c8('0x2a')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xc2c8('0x1d')](function(_0x3fa4bf){var _0xe0fac=_0x3fa4bf[_0xc2c8('0xc0')];_0x5389d6['forEach'](function(_0x5cd9af){_0x3dc8b2[_0xc2c8('0x28')](updateMailInteraction(_0x5cd9af,_0xf9d83e,_0x2c32ba,_0xe0fac));});return BPromise[_0xc2c8('0xc1')](_0x3dc8b2);});});});})[_0xc2c8('0x1d')](function(_0x5c816b){_0x53afc7[_0xc2c8('0xc2')]=_0x5c816b;return _0x53afc7;})[_0xc2c8('0x1d')](respondWithFilteredResult(_0x4d6654,_0x52857b))[_0xc2c8('0x2f')](handleError(_0x4d6654,null));};exports['show']=function(_0x3b80fc,_0x217433){var _0x2d6d30={'raw':![],'where':{'id':_0x3b80fc[_0xc2c8('0xc3')]['id']}},_0x3f7e95={};_0x3f7e95['model']=_[_0xc2c8('0x71')](db['MailInteraction'][_0xc2c8('0x38')]);_0x3f7e95[_0xc2c8('0x3d')]=_['keys'](_0x3b80fc[_0xc2c8('0x3d')]);_0x3f7e95['filters']=_[_0xc2c8('0x3f')](_0x3f7e95[_0xc2c8('0x3c')],_0x3f7e95[_0xc2c8('0x3d')]);_0x2d6d30[_0xc2c8('0x40')]=_[_0xc2c8('0x3f')](_0x3f7e95[_0xc2c8('0x3c')],qs[_0xc2c8('0x41')](_0x3b80fc[_0xc2c8('0x3d')][_0xc2c8('0x41')]));_0x2d6d30[_0xc2c8('0x40')]=_0x2d6d30[_0xc2c8('0x40')]['length']?_0x2d6d30[_0xc2c8('0x40')]:_0x3f7e95['model'];if(_0x3b80fc[_0xc2c8('0x3d')][_0xc2c8('0xc4')]){_0x2d6d30['include']=[{'all':!![]}];}_0x2d6d30=_['merge']({},_0x2d6d30,_0x3b80fc[_0xc2c8('0xc5')]);return db[_0xc2c8('0xc6')][_0xc2c8('0x5d')](_0x2d6d30)['then'](handleEntityNotFound(_0x217433,null))[_0xc2c8('0x1d')](respondWithResult(_0x217433,null))[_0xc2c8('0x2f')](handleError(_0x217433,null));};exports[_0xc2c8('0xc7')]=function(_0x15b8d5,_0x187583){return db[_0xc2c8('0xc6')]['create'](_0x15b8d5[_0xc2c8('0xc8')],{})[_0xc2c8('0x1d')](respondWithResult(_0x187583,0xc9))[_0xc2c8('0x2f')](handleError(_0x187583,null));};exports['update']=function(_0x52d04d,_0x5b6144){if(_0x52d04d[_0xc2c8('0xc8')]['id']){delete _0x52d04d['body']['id'];}return db[_0xc2c8('0xc6')][_0xc2c8('0x5d')]({'where':{'id':_0x52d04d[_0xc2c8('0xc3')]['id']}})[_0xc2c8('0x1d')](handleEntityNotFound(_0x5b6144,null))[_0xc2c8('0x1d')](saveUpdates(_0x52d04d[_0xc2c8('0xc8')],null))[_0xc2c8('0x1d')](respondWithResult(_0x5b6144,null))['catch'](handleError(_0x5b6144,null));};exports[_0xc2c8('0x1e')]=function(_0x4bc2a8,_0x2104dc){return db[_0xc2c8('0xc6')][_0xc2c8('0x5d')]({'where':{'id':_0x4bc2a8[_0xc2c8('0xc3')]['id']}})['then'](handleEntityNotFound(_0x2104dc,null))[_0xc2c8('0x1d')](removeEntity(_0x2104dc,null))[_0xc2c8('0x2f')](handleError(_0x2104dc,null));};exports[_0xc2c8('0xc9')]=function(_0x213380,_0x1a6224){return db[_0xc2c8('0xc6')]['describe']()['then'](respondWithResult(_0x1a6224,null))[_0xc2c8('0x2f')](handleError(_0x1a6224,null));};exports['addMessage']=function(_0x5987a9,_0x39a1d2){return db[_0xc2c8('0x29')][_0xc2c8('0x5d')]({'where':{'id':_0x5987a9[_0xc2c8('0xc3')]['id']}})['then'](handleEntityNotFound(_0x39a1d2,null))[_0xc2c8('0x1d')](function(_0x3b1a73){if(_0x3b1a73){return _0x3b1a73[_0xc2c8('0xca')](_0x5987a9[_0xc2c8('0xc8')][_0xc2c8('0xcb')],_[_0xc2c8('0xcc')](_0x5987a9['body'],[_0xc2c8('0xcb'),'id'])||{});}})['then'](respondWithResult(_0x39a1d2,null))[_0xc2c8('0x2f')](handleError(_0x39a1d2,null));};exports[_0xc2c8('0xcd')]=function(_0x2deea2,_0x7efe16){var _0x48c212={'raw':![],'where':{}};var _0x22ba30={};var _0xee8d35={'count':0x0,'rows':[]};return db[_0xc2c8('0xc6')][_0xc2c8('0x2a')]({'where':{'id':_0x2deea2['params']['id']}})[_0xc2c8('0x1d')](handleEntityNotFound(_0x7efe16,null))[_0xc2c8('0x1d')](function(_0x24f1c7){if(_0x24f1c7){_0x22ba30[_0xc2c8('0x3c')]=_['keys'](db[_0xc2c8('0x29')][_0xc2c8('0x38')]);_0x22ba30[_0xc2c8('0x3d')]=_[_0xc2c8('0x71')](_0x2deea2[_0xc2c8('0x3d')]);_0x22ba30[_0xc2c8('0x3e')]=_[_0xc2c8('0x3f')](_0x22ba30[_0xc2c8('0x3c')],_0x22ba30[_0xc2c8('0x3d')]);_0x48c212['attributes']=_[_0xc2c8('0x3f')](_0x22ba30[_0xc2c8('0x3c')],qs[_0xc2c8('0x41')](_0x2deea2['query']['fields']));_0x48c212[_0xc2c8('0x40')]=_0x48c212['attributes'][_0xc2c8('0x67')]?_0x48c212[_0xc2c8('0x40')]:_0x22ba30[_0xc2c8('0x3c')];if(!_0x2deea2[_0xc2c8('0x3d')][_0xc2c8('0x42')](_0xc2c8('0x43'))){_0x48c212[_0xc2c8('0x19')]=qs[_0xc2c8('0x19')](_0x2deea2[_0xc2c8('0x3d')]['limit']);_0x48c212[_0xc2c8('0x17')]=qs[_0xc2c8('0x17')](_0x2deea2['query'][_0xc2c8('0x17')]);}_0x48c212[_0xc2c8('0x44')]=qs[_0xc2c8('0x45')](_0x2deea2[_0xc2c8('0x3d')][_0xc2c8('0x45')]);_0x48c212[_0xc2c8('0x74')]=qs[_0xc2c8('0x3e')](_['pick'](_0x2deea2['query'],_0x22ba30[_0xc2c8('0x3e')]));_0x48c212[_0xc2c8('0x74')][_0xc2c8('0xbe')]=_0x24f1c7['id'];if(_0x2deea2[_0xc2c8('0x3d')][_0xc2c8('0x82')]){_0x48c212[_0xc2c8('0x74')]=_['merge'](_0x48c212['where'],{'$or':_['map'](_0x48c212[_0xc2c8('0x40')],function(_0x4f56b2){var _0x571501={};_0x571501[_0x4f56b2]={'$like':'%'+_0x2deea2[_0xc2c8('0x3d')][_0xc2c8('0x82')]+'%'};return _0x571501;})});}if(_0x2deea2['query'][_0xc2c8('0xce')]){var _0x3950d7=_0x2deea2['query']['$gte'][_0xc2c8('0x66')](',');var _0x21c7cc={};_0x21c7cc[_0x3950d7[0x0]]={'$gte':moment(_0x3950d7[0x1])['format'](_0xc2c8('0xcf'))};_0x48c212['where']=_[_0xc2c8('0x9d')](_0x48c212['where'],_0x21c7cc);}_0x48c212=_[_0xc2c8('0x9d')]({},_0x48c212,_0x2deea2[_0xc2c8('0xc5')]);return db['MailMessage'][_0xc2c8('0x1a')]({'where':_0x48c212['where']})['then'](function(_0x1cb07e){_0xee8d35['count']=_0x1cb07e;if(_0x2deea2[_0xc2c8('0x3d')][_0xc2c8('0xc4')]){_0x48c212['include']=[{'all':!![]}];}return db[_0xc2c8('0x29')][_0xc2c8('0xd0')](_0x48c212);})[_0xc2c8('0x1d')](function(_0x38f47f){if(_0x2deea2['query']['inlineCss']==='true'){for(var _0x2b1b2b=0x0;_0x2b1b2b<_0x38f47f[_0xc2c8('0x67')];_0x2b1b2b++){_0x38f47f[_0x2b1b2b][_0xc2c8('0xc8')]=juice(_0x38f47f[_0x2b1b2b]['body']);}}_0xee8d35[_0xc2c8('0xc2')]=_0x38f47f;return _0xee8d35;});}})[_0xc2c8('0x1d')](respondWithFilteredResult(_0x7efe16,_0x48c212))['catch'](handleError(_0x7efe16,null));};exports[_0xc2c8('0xd1')]=function(_0x180644,_0x10e4b3){return db[_0xc2c8('0xc6')][_0xc2c8('0x5d')]({'where':{'id':_0x180644[_0xc2c8('0xc3')]['id']}})[_0xc2c8('0x1d')](handleEntityNotFound(_0x10e4b3,null))['then'](function(_0x2dfcb1){if(_0x2dfcb1){return _0x2dfcb1[_0xc2c8('0xd2')](_0x180644[_0xc2c8('0xc8')][_0xc2c8('0xcb')],_[_0xc2c8('0xcc')](_0x180644[_0xc2c8('0xc8')],[_0xc2c8('0xcb'),'id'])||{})[_0xc2c8('0xd3')](function(){return db[_0xc2c8('0xd4')][_0xc2c8('0xd0')]({'attributes':['id',_0xc2c8('0x21'),_0xc2c8('0x48')],'where':{'id':_0x180644[_0xc2c8('0xc8')][_0xc2c8('0xcb')]}});})[_0xc2c8('0x1d')](function(_0x4b1780){socket[_0xc2c8('0xd5')](_0xc2c8('0xd6'),{'id':Number(_0x180644[_0xc2c8('0xc3')]['id']),'tags':_0x4b1780||[]});return{'id':Number(_0x180644[_0xc2c8('0xc3')]['id']),'tags':_0x4b1780||[]};});}})['then'](respondWithResult(_0x10e4b3,null))['catch'](handleError(_0x10e4b3,null));};exports[_0xc2c8('0xd7')]=function(_0x13487d,_0x18e57e){return db[_0xc2c8('0xc6')][_0xc2c8('0x5d')]({'where':{'id':_0x13487d[_0xc2c8('0xc3')]['id']}})[_0xc2c8('0x1d')](handleEntityNotFound(_0x18e57e,null))['then'](function(_0x457936){if(_0x457936){return _0x457936[_0xc2c8('0xd7')](_0x13487d[_0xc2c8('0x3d')][_0xc2c8('0xcb')]);}})[_0xc2c8('0x1d')](respondWithStatusCode(_0x18e57e,null))[_0xc2c8('0x2f')](handleError(_0x18e57e,null));};exports['download']=function(_0x55afc0,_0x4c8ec6){var _0x36bf29=moment()[_0xc2c8('0xd8')]()[_0xc2c8('0x9b')]();var _0x321a10=path[_0xc2c8('0xd9')](config[_0xc2c8('0xda')],'server','files',_0xc2c8('0xdb'));var _0x36d99d=path[_0xc2c8('0xd9')](config[_0xc2c8('0xda')],_0xc2c8('0xdc'),_0xc2c8('0xdd'),'attachments');var _0x55ad06=path[_0xc2c8('0xd9')](_0x321a10,_0x36bf29);var _0x121b5c=util[_0xc2c8('0xde')](_0xc2c8('0xdf'),_0x55afc0[_0xc2c8('0xc3')]['id'],_0x36bf29);var _0x2e1835=path[_0xc2c8('0xd9')](_0x321a10,_0x121b5c);var _0x3c8482=[];if(_0x55afc0['query'][_0xc2c8('0xe0')]){_0x3c8482[_0xc2c8('0x28')]({'model':db[_0xc2c8('0xe1')],'as':_0xc2c8('0xe2'),'raw':!![]});}var _0x36440a=[{'model':db['MailMessage'],'as':_0xc2c8('0xe3'),'attributes':['id',_0xc2c8('0xc8'),_0xc2c8('0x49'),'to','cc',_0xc2c8('0xe4'),_0xc2c8('0xe5'),_0xc2c8('0x77')],'where':{'secret':![]},'order':qs[_0xc2c8('0x45')]('id'),'include':_0x3c8482}];return db['MailInteraction'][_0xc2c8('0x5d')]({'where':{'id':_0x55afc0[_0xc2c8('0xc3')]['id']},'include':_0x36440a})[_0xc2c8('0x1d')](handleEntityNotFound(_0x4c8ec6,null))[_0xc2c8('0x1d')](function(_0x20428d){if(_0x20428d&&_0x20428d[_0xc2c8('0xe3')]){var _0x50a651=_0x20428d[_0xc2c8('0xe6')]({'plain':!![]});fs[_0xc2c8('0xe7')](_0x55ad06);return BPromise['each'](_0x50a651[_0xc2c8('0xe3')],function(_0x30089c,_0x49acf2){var _0x4d7551={'from':_0x30089c['from'],'to':_0x30089c['to'],'subject':_0x30089c[_0xc2c8('0xe5')],'html':htmlEntities[_0xc2c8('0xe8')](_0x30089c[_0xc2c8('0xc8')]),'headers':{'Date':moment(_0x30089c[_0xc2c8('0x77')])[_0xc2c8('0xde')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x30089c['cc']){_0x4d7551[_0xc2c8('0xe9')]['Cc']=_0x30089c['cc'];}if(_0x30089c[_0xc2c8('0xe4')]){_0x4d7551['headers'][_0xc2c8('0xea')]=_0x30089c[_0xc2c8('0xe4')];}return new BPromise(function(_0x341a30,_0x2949b4){if(_0x30089c['Attachments']){for(var _0x110c23=0x0;_0x110c23<_0x30089c['Attachments'][_0xc2c8('0x67')];_0x110c23++){var _0x5b2306=_0x30089c['Attachments'][_0x110c23];var _0x1d9a5b=path[_0xc2c8('0xd9')](_0x36d99d,_0x5b2306['basename']);if(fs[_0xc2c8('0xeb')](_0x1d9a5b)){_0x4d7551[_0xc2c8('0xe0')][_0xc2c8('0x28')]({'name':_0x5b2306['name'],'contentType':_0x5b2306[_0xc2c8('0x3a')],'data':fs[_0xc2c8('0xec')](_0x1d9a5b)});}}}emlformat[_0xc2c8('0xed')](_0x4d7551,function(_0x5105ad,_0x3e4fce){if(_0x5105ad)return _0x2949b4(_0x5105ad);fs[_0xc2c8('0xee')](path[_0xc2c8('0xd9')](_0x55ad06,util[_0xc2c8('0xde')]('message%d.eml',_0x49acf2)),_0x3e4fce);return _0x341a30(_0x3e4fce);});});})[_0xc2c8('0x1d')](function(){return new BPromise(function(_0x168c7e,_0x90bc98){zipdir(_0x55ad06,{'saveTo':_0x2e1835},function(_0x5c0b97,_0x1906c0){if(_0x5c0b97)return _0x90bc98(_0x5c0b97);return _0x168c7e(_0x1906c0);});})[_0xc2c8('0x1d')](function(){return new BPromise(function(_0x16041c,_0x415217){rimraf(_0x55ad06,function(_0x55963c){if(_0x55963c)_0x415217(_0x55963c);return _0x16041c();});});})[_0xc2c8('0x1d')](function(){return _0x4c8ec6['download'](_0x2e1835,_0x121b5c,function(_0x38f902){if(!_0x38f902)fs['unlinkSync'](_0x2e1835);});});});}else{return _0x4c8ec6[_0xc2c8('0x13')](0xc8);}})[_0xc2c8('0x2f')](handleError(_0x4c8ec6,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 57718e1..b45818b 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 _0xce76=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x25d085,_0x40cebf){var _0x112d9d=function(_0x294b41){while(--_0x294b41){_0x25d085['push'](_0x25d085['shift']());}};_0x112d9d(++_0x40cebf);}(_0xce76,0x84));var _0x6ce7=function(_0xa99e3f,_0x1333a5){_0xa99e3f=_0xa99e3f-0x0;var _0x3ad28e=_0xce76[_0xa99e3f];return _0x3ad28e;};'use strict';var EventEmitter=require(_0x6ce7('0x0'));var MailInteraction=require(_0x6ce7('0x1'))['db'][_0x6ce7('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6ce7('0x3')](0x0);var events={'afterCreate':_0x6ce7('0x4'),'afterUpdate':_0x6ce7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x527aee){return function(_0x55daa6,_0x1f62f6,_0x39df73){_0x55daa6[_0x6ce7('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x34a18c){_0x55daa6[_0x6ce7('0x7')](_0x6ce7('0x8'),_0x34a18c[_0x6ce7('0x9')](function(_0x4def72){return{'id':_0x4def72['id']};}));return MailMessage[_0x6ce7('0xa')]({'where':{'MailInteractionId':_0x55daa6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x21db6f){_0x55daa6[_0x6ce7('0x7')](_0x6ce7('0xb'),_0x21db6f['length']);MailInteractionEvents[_0x6ce7('0xc')](_0x527aee+':'+_0x55daa6['id'],_0x55daa6);MailInteractionEvents['emit'](_0x527aee,_0x55daa6);_0x39df73(null);})[_0x6ce7('0xd')](_0x39df73(null));};}for(var e in events){if(events[_0x6ce7('0xe')](e)){var event=events[e];MailInteraction[_0x6ce7('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x6034=['setDataValue','map','findAll','unreadMessages','length','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x1676a5,_0x25a4e3){var _0x57ef9f=function(_0x260097){while(--_0x260097){_0x1676a5['push'](_0x1676a5['shift']());}};_0x57ef9f(++_0x25a4e3);}(_0x6034,0x147));var _0x4603=function(_0x29c5f6,_0x40c6da){_0x29c5f6=_0x29c5f6-0x0;var _0x251c2d=_0x6034[_0x29c5f6];return _0x251c2d;};'use strict';var EventEmitter=require(_0x4603('0x0'));var MailInteraction=require(_0x4603('0x1'))['db'][_0x4603('0x2')];var MailMessage=require(_0x4603('0x1'))['db'][_0x4603('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4603('0x4')](0x0);var events={'afterCreate':_0x4603('0x5'),'afterUpdate':_0x4603('0x6'),'afterDestroy':'remove'};function emitEvent(_0x112932){return function(_0x55b9cc,_0x4e0052,_0x25aad6){_0x55b9cc[_0x4603('0x7')]({'attributes':['id'],'raw':!![]})[_0x4603('0x8')](function(_0x5bacb6){_0x55b9cc[_0x4603('0x9')]('Users',_0x5bacb6[_0x4603('0xa')](function(_0x4dc904){return{'id':_0x4dc904['id']};}));return MailMessage[_0x4603('0xb')]({'where':{'MailInteractionId':_0x55b9cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4603('0x8')](function(_0x1b33e6){_0x55b9cc[_0x4603('0x9')](_0x4603('0xc'),_0x1b33e6[_0x4603('0xd')]);MailInteractionEvents['emit'](_0x112932+':'+_0x55b9cc['id'],_0x55b9cc);MailInteractionEvents['emit'](_0x112932,_0x55b9cc);_0x25aad6(null);})['catch'](_0x25aad6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x4603('0xe')](e,emitEvent(event));}}module[_0x4603('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4700591..b54bbac 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 _0x0418=['get','MailMessage','update','catch','utf8mb4','util','api','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','models'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x0418,0x13d));var _0x8041=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0418[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x8041('0x0'));var logger=require('../../config/logger')(_0x8041('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8041('0x2'));var fs=require('fs');var path=require(_0x8041('0x3'));var rimraf=require('rimraf');var config=require(_0x8041('0x4'));var attributes=require(_0x8041('0x5'));module[_0x8041('0x6')]=function(_0x26a62f,_0x506b6c){return _0x26a62f['define'](_0x8041('0x7'),attributes,{'tableName':_0x8041('0x8'),'paranoid':![],'indexes':[{'name':_0x8041('0x9'),'fields':[_0x8041('0xa'),'to'],'type':_0x8041('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d5859,_0x13ce2f,_0x26cbb9){if(_0x2d5859[_0x8041('0xc')]){_0x2d5859[_0x8041('0xd')]=moment()[_0x8041('0xe')](_0x8041('0xf'));}if(_0x2d5859[_0x8041('0x10')]){_0x2d5859['closedAt']=moment()[_0x8041('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x26cbb9(null,_0x13ce2f);},'beforeUpdate':function(_0x487e6b,_0x1bb793,_0x3afff2){if(_0x487e6b[_0x8041('0x11')](_0x8041('0xc'))){_0x487e6b[_0x8041('0xd')]=_0x487e6b[_0x8041('0xc')]?moment()[_0x8041('0xe')](_0x8041('0xf')):null;}if(_0x487e6b[_0x8041('0x11')]('closed')){_0x487e6b['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x487e6b['substatus']=null;_0x487e6b[_0x8041('0xd')]=null;}_0x3afff2(null,_0x487e6b);},'afterUpdate':function(_0x425cad,_0x5daf61,_0x1c6fbc){var _0x5752b5=_0x26a62f[_0x8041('0x12')];var _0x146a82=_0x425cad[_0x8041('0x13')]({'plain':!![]});if(_0x146a82[_0x8041('0x10')]){return _0x5752b5[_0x8041('0x14')][_0x8041('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x146a82['id']}})['then'](function(){_0x1c6fbc();})[_0x8041('0x16')](function(_0x58c4b4){_0x1c6fbc(_0x58c4b4);});}else{_0x1c6fbc();}}},'charset':_0x8041('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4224=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','get','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format'];(function(_0x5e369f,_0x250328){var _0x433c7a=function(_0x1b87d7){while(--_0x1b87d7){_0x5e369f['push'](_0x5e369f['shift']());}};_0x433c7a(++_0x250328);}(_0x4224,0x14d));var _0x4422=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x4224[_0x350182];return _0x4a0892;};'use strict';var _=require(_0x4422('0x0'));var util=require('util');var logger=require(_0x4422('0x1'))(_0x4422('0x2'));var moment=require(_0x4422('0x3'));var BPromise=require(_0x4422('0x4'));var rp=require(_0x4422('0x5'));var fs=require('fs');var path=require(_0x4422('0x6'));var rimraf=require('rimraf');var config=require(_0x4422('0x7'));var attributes=require(_0x4422('0x8'));module[_0x4422('0x9')]=function(_0x1ec15a,_0x3b9bc8){return _0x1ec15a[_0x4422('0xa')](_0x4422('0xb'),attributes,{'tableName':_0x4422('0xc'),'paranoid':![],'indexes':[{'name':_0x4422('0xd'),'fields':[_0x4422('0xe'),'to'],'type':_0x4422('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d7cd3,_0x28c570,_0x24f1e0){if(_0x5d7cd3['substatus']){_0x5d7cd3[_0x4422('0x10')]=moment()[_0x4422('0x11')](_0x4422('0x12'));}if(_0x5d7cd3[_0x4422('0x13')]){_0x5d7cd3[_0x4422('0x14')]=moment()['format'](_0x4422('0x12'));}_0x24f1e0(null,_0x28c570);},'beforeUpdate':function(_0x2ec869,_0x5167b3,_0x4bee07){if(_0x2ec869[_0x4422('0x15')]('substatus')){_0x2ec869[_0x4422('0x10')]=_0x2ec869[_0x4422('0x16')]?moment()[_0x4422('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ec869[_0x4422('0x15')](_0x4422('0x13'))){_0x2ec869[_0x4422('0x14')]=moment()[_0x4422('0x11')](_0x4422('0x12'));_0x2ec869[_0x4422('0x16')]=null;_0x2ec869[_0x4422('0x10')]=null;}_0x4bee07(null,_0x2ec869);},'afterUpdate':function(_0x77c3,_0xd1a38b,_0x45869c){var _0x5f0630=_0x1ec15a['models'];var _0x24c0fa=_0x77c3[_0x4422('0x17')]({'plain':!![]});if(_0x24c0fa[_0x4422('0x13')]){return _0x5f0630['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x24c0fa['id']}})[_0x4422('0x18')](function(){_0x45869c();})[_0x4422('0x19')](function(_0x317043){_0x45869c(_0x317043);});}else{_0x45869c();}}},'charset':'utf8mb4','collate':_0x4422('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 269953f..ec9772a 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 _0x5ad6=['AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','attributes','limit','stringify','AddTagsToMailInteraction','ids','omit','spread'];(function(_0x512661,_0x4b4012){var _0x1debde=function(_0x1ed401){while(--_0x1ed401){_0x512661['push'](_0x512661['shift']());}};_0x1debde(++_0x4b4012);}(_0x5ad6,0xba));var _0x65ad=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x5ad6[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0x65ad('0x0'));var util=require(_0x65ad('0x1'));var moment=require(_0x65ad('0x2'));var BPromise=require(_0x65ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65ad('0x4'));var db=require(_0x65ad('0x5'))['db'];var utils=require(_0x65ad('0x6'));var logger=require(_0x65ad('0x7'))('rpc');var config=require(_0x65ad('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x65ad('0x9')]['http']({'port':0x232a});config[_0x65ad('0xa')]=_[_0x65ad('0xb')](config[_0x65ad('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x65ad('0xc'))(new Redis(config[_0x65ad('0xa')]));require('./mailInteraction.socket')[_0x65ad('0xd')](socket);function respondWithRpcPromise(_0x2fa00f,_0x87dfd4,_0x9cc21a){return new BPromise(function(_0x52ca4b,_0x501da5){return client[_0x65ad('0xe')](_0x2fa00f,_0x9cc21a)[_0x65ad('0xf')](function(_0x3b5d58){logger[_0x65ad('0x10')](_0x65ad('0x11'),_0x87dfd4,_0x65ad('0x12'));logger[_0x65ad('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x87dfd4,_0x65ad('0x12'),JSON['stringify'](_0x3b5d58));if(_0x3b5d58[_0x65ad('0x14')]){if(_0x3b5d58[_0x65ad('0x14')]['code']===0x1f4){logger[_0x65ad('0x14')](_0x65ad('0x11'),_0x87dfd4,_0x3b5d58[_0x65ad('0x14')][_0x65ad('0x15')]);return _0x501da5(_0x3b5d58['error'][_0x65ad('0x15')]);}logger[_0x65ad('0x14')](_0x65ad('0x11'),_0x87dfd4,_0x3b5d58[_0x65ad('0x14')][_0x65ad('0x15')]);return _0x52ca4b(_0x3b5d58[_0x65ad('0x14')][_0x65ad('0x15')]);}else{logger[_0x65ad('0x10')](_0x65ad('0x11'),_0x87dfd4,_0x65ad('0x12'));_0x52ca4b(_0x3b5d58[_0x65ad('0x16')][_0x65ad('0x15')]);}})[_0x65ad('0x17')](function(_0x47c61f){logger['error'](_0x65ad('0x11'),_0x87dfd4,_0x47c61f);_0x501da5(_0x47c61f);});});}exports[_0x65ad('0x18')]=function(_0x4277ab){var _0x2640f3=this;return new Promise(function(_0x4c4f1c,_0x3da71a){return db[_0x65ad('0x19')][_0x65ad('0x1a')](_0x4277ab[_0x65ad('0x1b')],{'raw':_0x4277ab[_0x65ad('0x1c')]?_0x4277ab[_0x65ad('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4277ab['options']?_0x4277ab[_0x65ad('0x1c')]['where']||null:null,'attributes':_0x4277ab[_0x65ad('0x1c')]?_0x4277ab['options'][_0x65ad('0x1d')]||null:null,'limit':_0x4277ab[_0x65ad('0x1c')]?_0x4277ab['options'][_0x65ad('0x1e')]||null:null})['then'](function(_0x3e25db){logger[_0x65ad('0x10')]('UpdateMailInteraction',_0x4277ab);logger[_0x65ad('0x13')](_0x65ad('0x18'),_0x4277ab,JSON[_0x65ad('0x1f')](_0x3e25db));_0x4c4f1c(_0x3e25db);})['catch'](function(_0x4cf2ff){logger[_0x65ad('0x14')]('UpdateMailInteraction',_0x4cf2ff['message'],_0x4277ab);_0x3da71a(_0x2640f3[_0x65ad('0x14')](0x1f4,_0x4cf2ff[_0x65ad('0x15')]));});});};exports[_0x65ad('0x20')]=function(_0xd1c739){return new Promise(function(_0x551998,_0x42ce4e){return db[_0x65ad('0x19')]['find']({'where':_0xd1c739[_0x65ad('0x1c')]?_0xd1c739[_0x65ad('0x1c')]['where']||null:null})['then'](function(_0x554205){if(_0x554205){return _0x554205['addTags'](_0xd1c739[_0x65ad('0x1b')][_0x65ad('0x21')],_[_0x65ad('0x22')](_0xd1c739['body'],[_0x65ad('0x21'),'id'])||{});}})[_0x65ad('0x23')](function(_0x3b5df3){logger[_0x65ad('0x10')](_0x65ad('0x24'),_0xd1c739);logger[_0x65ad('0x13')](_0x65ad('0x24'),_0xd1c739,JSON[_0x65ad('0x1f')](_0x3b5df3));_0x551998(_0x3b5df3);})[_0x65ad('0x17')](function(_0x2648e3){logger[_0x65ad('0x14')](_0x65ad('0x24'),_0x2648e3[_0x65ad('0x15')],_0xd1c739);_0x42ce4e(_this[_0x65ad('0x14')](0x1f4,_0x2648e3['message']));});});}; \ No newline at end of file +var _0xd0ee=['addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','UpdateMailInteraction','body','options','raw','attributes','limit','AddTagsToMailInteraction','find'];(function(_0x347498,_0x332242){var _0x334f2b=function(_0x4156d1){while(--_0x4156d1){_0x347498['push'](_0x347498['shift']());}};_0x334f2b(++_0x332242);}(_0xd0ee,0x18c));var _0xed0e=function(_0x1aeac4,_0x37121f){_0x1aeac4=_0x1aeac4-0x0;var _0x573f5c=_0xd0ee[_0x1aeac4];return _0x573f5c;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var moment=require(_0xed0e('0x2'));var BPromise=require('bluebird');var rs=require(_0xed0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed0e('0x4'))['db'];var utils=require(_0xed0e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xed0e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xed0e('0x7')][_0xed0e('0x8')]({'port':0x232a});config[_0xed0e('0x9')]=_[_0xed0e('0xa')](config['redis'],{'host':_0xed0e('0xb'),'port':0x18eb});var socket=require(_0xed0e('0xc'))(new Redis(config[_0xed0e('0x9')]));require(_0xed0e('0xd'))[_0xed0e('0xe')](socket);function respondWithRpcPromise(_0x4414a3,_0x3f15b9,_0x573347){return new BPromise(function(_0x48c11f,_0x575dce){return client[_0xed0e('0xf')](_0x4414a3,_0x573347)[_0xed0e('0x10')](function(_0x319288){logger['info'](_0xed0e('0x11'),_0x3f15b9,'request\x20sent');logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3f15b9,'request\x20sent',JSON[_0xed0e('0x12')](_0x319288));if(_0x319288[_0xed0e('0x13')]){if(_0x319288['error'][_0xed0e('0x14')]===0x1f4){logger['error'](_0xed0e('0x11'),_0x3f15b9,_0x319288[_0xed0e('0x13')][_0xed0e('0x15')]);return _0x575dce(_0x319288[_0xed0e('0x13')]['message']);}logger[_0xed0e('0x13')](_0xed0e('0x11'),_0x3f15b9,_0x319288[_0xed0e('0x13')]['message']);return _0x48c11f(_0x319288[_0xed0e('0x13')][_0xed0e('0x15')]);}else{logger[_0xed0e('0x16')](_0xed0e('0x11'),_0x3f15b9,_0xed0e('0x17'));_0x48c11f(_0x319288['result']['message']);}})[_0xed0e('0x18')](function(_0x5f2b7c){logger[_0xed0e('0x13')](_0xed0e('0x11'),_0x3f15b9,_0x5f2b7c);_0x575dce(_0x5f2b7c);});});}exports[_0xed0e('0x19')]=function(_0x47c9b6){var _0xac789e=this;return new Promise(function(_0x447610,_0x3842c0){return db['MailInteraction']['update'](_0x47c9b6[_0xed0e('0x1a')],{'raw':_0x47c9b6[_0xed0e('0x1b')]?_0x47c9b6[_0xed0e('0x1b')][_0xed0e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c9b6[_0xed0e('0x1b')]?_0x47c9b6[_0xed0e('0x1b')]['where']||null:null,'attributes':_0x47c9b6[_0xed0e('0x1b')]?_0x47c9b6[_0xed0e('0x1b')][_0xed0e('0x1d')]||null:null,'limit':_0x47c9b6[_0xed0e('0x1b')]?_0x47c9b6[_0xed0e('0x1b')][_0xed0e('0x1e')]||null:null})[_0xed0e('0x10')](function(_0x4ef0bc){logger[_0xed0e('0x16')](_0xed0e('0x19'),_0x47c9b6);logger['debug'](_0xed0e('0x19'),_0x47c9b6,JSON[_0xed0e('0x12')](_0x4ef0bc));_0x447610(_0x4ef0bc);})[_0xed0e('0x18')](function(_0x546d59){logger['error'](_0xed0e('0x19'),_0x546d59[_0xed0e('0x15')],_0x47c9b6);_0x3842c0(_0xac789e[_0xed0e('0x13')](0x1f4,_0x546d59['message']));});});};exports[_0xed0e('0x1f')]=function(_0x33401d){return new Promise(function(_0x213a08,_0x7ccce0){return db['MailInteraction'][_0xed0e('0x20')]({'where':_0x33401d['options']?_0x33401d[_0xed0e('0x1b')]['where']||null:null})[_0xed0e('0x10')](function(_0x38d693){if(_0x38d693){return _0x38d693[_0xed0e('0x21')](_0x33401d[_0xed0e('0x1a')][_0xed0e('0x22')],_[_0xed0e('0x23')](_0x33401d[_0xed0e('0x1a')],['ids','id'])||{});}})[_0xed0e('0x24')](function(_0x4ad5bf){logger[_0xed0e('0x16')](_0xed0e('0x25'),_0x33401d);logger[_0xed0e('0x26')](_0xed0e('0x25'),_0x33401d,JSON[_0xed0e('0x12')](_0x4ad5bf));_0x213a08(_0x4ad5bf);})['catch'](function(_0x1ee2ce){logger[_0xed0e('0x13')](_0xed0e('0x25'),_0x1ee2ce[_0xed0e('0x15')],_0x33401d);_0x7ccce0(_this[_0xed0e('0x13')](0x1f4,_0x1ee2ce[_0xed0e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1169b2c..3ba98d5 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 _0xe6af=['./mailInteraction.events','save','update','emit','length','mailInteraction:'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe6af,0x17a));var _0xfe6a=function(_0x302c54,_0x2eb885){_0x302c54=_0x302c54-0x0;var _0x3286e2=_0xe6af[_0x302c54];return _0x3286e2;};'use strict';var MailInteractionEvents=require(_0xfe6a('0x0'));var events=[_0xfe6a('0x1'),'remove',_0xfe6a('0x2')];function createListener(_0x379732,_0x3941a7){return function(_0x52faa2){_0x3941a7[_0xfe6a('0x3')](_0x379732,_0x52faa2);};}function removeListener(_0x42301e,_0x3dc702){return function(){MailInteractionEvents['removeListener'](_0x42301e,_0x3dc702);};}exports['register']=function(_0x5db88a){for(var _0x1aa132=0x0,_0x27f170=events[_0xfe6a('0x4')];_0x1aa132<_0x27f170;_0x1aa132++){var _0x1082c8=events[_0x1aa132];var _0x51f104=createListener(_0xfe6a('0x5')+_0x1082c8,_0x5db88a);MailInteractionEvents['on'](_0x1082c8,_0x51f104);}}; \ No newline at end of file +var _0x548d=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','register'];(function(_0x55426b,_0x1c85db){var _0x1d7d4d=function(_0x246157){while(--_0x246157){_0x55426b['push'](_0x55426b['shift']());}};_0x1d7d4d(++_0x1c85db);}(_0x548d,0xd3));var _0xd548=function(_0x3d4ec2,_0x58113c){_0x3d4ec2=_0x3d4ec2-0x0;var _0x27608=_0x548d[_0x3d4ec2];return _0x27608;};'use strict';var MailInteractionEvents=require(_0xd548('0x0'));var events=[_0xd548('0x1'),_0xd548('0x2'),_0xd548('0x3')];function createListener(_0x33319a,_0x3a5981){return function(_0x14c46d){_0x3a5981[_0xd548('0x4')](_0x33319a,_0x14c46d);};}function removeListener(_0x40f573,_0x2c8519){return function(){MailInteractionEvents['removeListener'](_0x40f573,_0x2c8519);};}exports[_0xd548('0x5')]=function(_0x444dc9){for(var _0x395aef=0x0,_0x10c338=events['length'];_0x395aef<_0x10c338;_0x395aef++){var _0x290bfc=events[_0x395aef];var _0x54927f=createListener(_0xd548('0x6')+_0x290bfc,_0x444dc9);MailInteractionEvents['on'](_0x290bfc,_0x54927f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 18029ee..55a81d7 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 _0x8278=['create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail'];(function(_0x37b6f2,_0x21036a){var _0x10be7e=function(_0x5ec454){while(--_0x5ec454){_0x37b6f2['push'](_0x37b6f2['shift']());}};_0x10be7e(++_0x21036a);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var path=require(_0x8827('0x2'));var timeout=require(_0x8827('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8827('0x4'));var auth=require(_0x8827('0x5'));var interaction=require(_0x8827('0x6'));var config=require(_0x8827('0x7'));var controller=require('./mailMessage.controller');router[_0x8827('0x8')]('/',auth[_0x8827('0x9')](),controller[_0x8827('0xa')]);router[_0x8827('0x8')](_0x8827('0xb'),auth[_0x8827('0x9')](),controller[_0x8827('0xc')]);router[_0x8827('0x8')](_0x8827('0xd'),auth[_0x8827('0x9')](),controller[_0x8827('0xe')]);router[_0x8827('0x8')](_0x8827('0xf'),auth['isAuthenticated'](),controller[_0x8827('0x10')]);router[_0x8827('0x11')]('/',auth['isAuthenticated'](),interaction[_0x8827('0x12')](_0x8827('0x13'),'mailmessage:create'),controller[_0x8827('0x14')]);router['put']('/:id',auth[_0x8827('0x9')](),controller[_0x8827('0x15')]);router[_0x8827('0x16')](_0x8827('0x17'),auth['isAuthenticated'](),controller[_0x8827('0x18')]);router[_0x8827('0x16')](_0x8827('0x19'),auth[_0x8827('0x9')](),controller[_0x8827('0x1a')]);router[_0x8827('0x1b')](_0x8827('0xd'),auth['isAuthenticated'](),controller[_0x8827('0x1c')]);module[_0x8827('0x1d')]=router; \ No newline at end of file +var _0xb945=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','mail','create','put','update','/:id/accept','accept','delete','destroy'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xb945,0x97));var _0x5b94=function(_0x3be76f,_0x385568){_0x3be76f=_0x3be76f-0x0;var _0x13affb=_0xb945[_0x3be76f];return _0x13affb;};'use strict';var multer=require(_0x5b94('0x0'));var util=require('util');var path=require(_0x5b94('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b94('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b94('0x3'));var interaction=require(_0x5b94('0x4'));var config=require(_0x5b94('0x5'));var controller=require(_0x5b94('0x6'));router[_0x5b94('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b94('0x7')](_0x5b94('0x8'),auth[_0x5b94('0x9')](),controller[_0x5b94('0xa')]);router['get'](_0x5b94('0xb'),auth['isAuthenticated'](),controller[_0x5b94('0xc')]);router[_0x5b94('0x7')](_0x5b94('0xd'),auth[_0x5b94('0x9')](),controller[_0x5b94('0xe')]);router[_0x5b94('0xf')]('/',auth[_0x5b94('0x9')](),interaction['tracked'](_0x5b94('0x10'),'mailmessage:create'),controller[_0x5b94('0x11')]);router[_0x5b94('0x12')](_0x5b94('0xb'),auth[_0x5b94('0x9')](),controller[_0x5b94('0x13')]);router['put'](_0x5b94('0x14'),auth[_0x5b94('0x9')](),controller[_0x5b94('0x15')]);router[_0x5b94('0x12')]('/:id/reject',auth[_0x5b94('0x9')](),controller['reject']);router[_0x5b94('0x16')](_0x5b94('0xb'),auth['isAuthenticated'](),controller[_0x5b94('0x17')]);module[_0x5b94('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2bdc499..a87069c 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 _0x407e=['STRING','DATE','INTEGER','Email','sequelize','lodash','TEXT','long','medium','BOOLEAN','ENUM'];(function(_0x2c6be8,_0x3e0ab9){var _0x99299c=function(_0x2cb739){while(--_0x2cb739){_0x2c6be8['push'](_0x2c6be8['shift']());}};_0x99299c(++_0x3e0ab9);}(_0x407e,0x1e8));var _0xe407=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0x407e[_0x3de4f8];return _0x3d81fc;};'use strict';var Sequelize=require(_0xe407('0x0'));var _=require(_0xe407('0x1'));module['exports']={'body':{'type':Sequelize[_0xe407('0x2')](_0xe407('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xe407('0x4'))},'read':{'type':Sequelize[_0xe407('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe407('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe407('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xe407('0x2')](_0xe407('0x3'))},'cc':{'type':Sequelize[_0xe407('0x2')](_0xe407('0x3'))},'bcc':{'type':Sequelize[_0xe407('0x2')](_0xe407('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xe407('0x8')]},'attach':{'type':Sequelize[_0xe407('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe407('0x8')]},'originTo':{'type':Sequelize[_0xe407('0x2')](_0xe407('0x3'))},'originCc':{'type':Sequelize[_0xe407('0x2')](_0xe407('0x3'))},'originChannel':{'type':Sequelize[_0xe407('0x6')]('Email','Chat'),'defaultValue':_0xe407('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x9714=['sequelize','exports','TEXT','ENUM','out','STRING','long','DATE','INTEGER','BOOLEAN','Chat','Email'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9714,0xa8));var _0x4971=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x9714[_0x3e8270];return _0x1ccde9;};'use strict';var Sequelize=require(_0x4971('0x0'));var _=require('lodash');module[_0x4971('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4971('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4971('0x3')]('in',_0x4971('0x4')),'defaultValue':_0x4971('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x4971('0x5')]},'to':{'type':Sequelize[_0x4971('0x2')](_0x4971('0x6'))},'cc':{'type':Sequelize['TEXT'](_0x4971('0x6'))},'bcc':{'type':Sequelize['TEXT'](_0x4971('0x6'))},'subject':{'type':Sequelize[_0x4971('0x2')]},'sentAt':{'type':Sequelize[_0x4971('0x7')]},'attach':{'type':Sequelize[_0x4971('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4971('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4971('0x2')](_0x4971('0x6'))},'originCc':{'type':Sequelize['TEXT'](_0x4971('0x6'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x4971('0xa')),'defaultValue':_0x4971('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 abf9289..07248b7 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 _0x522b=['acceptmessage','reject','mail','MailInteractionId','RejectMessage','rejectMessage','sequelize','QueryTypes','download','toString','files','tmp','root','server','bcc','Attachment','Attachments','from','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','show','params','keys','include','options','find','body','destroy','describe','direction','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','read','readAt','UserId','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','internal','interface','channel','motionChannel','event','fromString','EventManager'];(function(_0x31f7d1,_0x354f4b){var _0x53af42=function(_0xd345be){while(--_0xd345be){_0x31f7d1['push'](_0x31f7d1['shift']());}};_0x53af42(++_0x354f4b);}(_0x522b,0x1e0));var _0xb522=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x522b[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0xb522('0x0'));var moment=require(_0xb522('0x1'));var BPromise=require('bluebird');var util=require(_0xb522('0x2'));var path=require(_0xb522('0x3'));var fs=require('fs');var _=require(_0xb522('0x4'));var Redis=require(_0xb522('0x5'));var htmlToText=require(_0xb522('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb522('0x7'));var interaction_log=require(_0xb522('0x8'))(_0xb522('0x9'));var config=require(_0xb522('0xa'));var db=require(_0xb522('0xb'))['db'];config['redis']=_[_0xb522('0xc')](config[_0xb522('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb522('0xd')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xb522('0xe')](socket);var jayson=require(_0xb522('0xf'));var client=jayson[_0xb522('0x10')][_0xb522('0x11')]({'port':0x232c});var client9003=jayson[_0xb522('0x10')]['http']({'port':0x232b});var client9002=jayson[_0xb522('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f2210,_0x478120,_0x5f1a18,_0x2b9ea2){return new BPromise(function(_0x56857b,_0x34b005){var _0x49a932=_0x2b9ea2||client;return _0x49a932[_0xb522('0x12')](_0x2f2210,_0x5f1a18)[_0xb522('0x13')](function(_0x1a16b6){logger['info'](_0xb522('0x14'),_0x478120,_0xb522('0x15'));logger['debug'](_0xb522('0x16'),_0x478120,'request\x20sent',JSON['stringify'](_0x1a16b6));if(_0x1a16b6['error']){if(_0x1a16b6[_0xb522('0x17')][_0xb522('0x18')]===0x1f4){logger[_0xb522('0x17')]('MailMessage,\x20%s,\x20%s',_0x478120,_0x1a16b6[_0xb522('0x17')][_0xb522('0x19')]);return _0x34b005(_0x1a16b6['error']['message']);}logger[_0xb522('0x17')](_0xb522('0x14'),_0x478120,_0x1a16b6[_0xb522('0x17')]['message']);return _0x56857b(_0x1a16b6[_0xb522('0x17')][_0xb522('0x19')]);}else{logger[_0xb522('0x1a')](_0xb522('0x14'),_0x478120,_0xb522('0x15'));_0x56857b(_0x1a16b6['result'][_0xb522('0x19')]);}})[_0xb522('0x1b')](function(_0x3621d9){logger[_0xb522('0x17')](_0xb522('0x14'),_0x478120,_0x3621d9);_0x34b005(_0x3621d9);});});}function respondWithResult(_0x594c1e,_0x43fa3b){_0x43fa3b=_0x43fa3b||0xc8;return function(_0x47bcd7){if(_0x47bcd7){return _0x594c1e[_0xb522('0x1c')](_0x43fa3b)[_0xb522('0x1d')](_0x47bcd7);}};}function respondWithFilteredResult(_0x4d03a0,_0x4d6acc){return function(_0x742e0c){if(_0x742e0c){var _0x4022f0=typeof _0x4d6acc[_0xb522('0x1e')]===_0xb522('0x1f')&&typeof _0x4d6acc[_0xb522('0x20')]===_0xb522('0x1f');var _0x1167d3=_0x742e0c[_0xb522('0x21')];var _0x3e3e30=_0x4022f0?0x0:_0x4d6acc[_0xb522('0x1e')];var _0x3ce76=_0x4022f0?_0x742e0c[_0xb522('0x21')]:_0x4d6acc[_0xb522('0x1e')]+_0x4d6acc[_0xb522('0x20')];var _0x40f8d0;if(_0x3ce76>=_0x1167d3){_0x3ce76=_0x1167d3;_0x40f8d0=0xc8;}else{_0x40f8d0=0xce;}_0x4d03a0[_0xb522('0x1c')](_0x40f8d0);return _0x4d03a0[_0xb522('0x22')](_0xb522('0x23'),_0x3e3e30+'-'+_0x3ce76+'/'+_0x1167d3)[_0xb522('0x1d')](_0x742e0c);}return null;};}function saveUpdates(_0x19834c){return function(_0x9de175){if(_0x9de175){return _0x9de175[_0xb522('0x24')](_0x19834c)['then'](function(_0x1203a4){return _0x1203a4;});}return null;};}function removeEntity(_0x2c2a4c){return function(_0x34acd5){if(_0x34acd5){return _0x34acd5['destroy']()[_0xb522('0x13')](function(){_0x2c2a4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8bdb){return function(_0x248f99){if(!_0x248f99){_0x5e8bdb[_0xb522('0x25')](0x194);}return _0x248f99;};}function handleError(_0x22a49a,_0x3b0344){_0x3b0344=_0x3b0344||0x1f4;return function(_0xd501c0){logger[_0xb522('0x17')](_0xd501c0[_0xb522('0x26')]);if(_0xd501c0[_0xb522('0x27')]){delete _0xd501c0['name'];}_0x22a49a[_0xb522('0x1c')](_0x3b0344)[_0xb522('0x28')](_0xd501c0);};}exports[_0xb522('0x29')]=function(_0x7bd69b,_0x1abf19){var _0x29ff93={},_0x518a5e={},_0x530dec={'count':0x0,'rows':[]};var _0xfb12e9=_[_0xb522('0x2a')](db[_0xb522('0x2b')][_0xb522('0x2c')],function(_0x3f9d5c){return{'name':_0x3f9d5c['fieldName'],'type':_0x3f9d5c[_0xb522('0x2d')][_0xb522('0x2e')]};});_0x518a5e[_0xb522('0x2f')]=_[_0xb522('0x2a')](_0xfb12e9,_0xb522('0x27'));_0x518a5e[_0xb522('0x30')]=_['keys'](_0x7bd69b[_0xb522('0x30')]);_0x518a5e['filters']=_[_0xb522('0x31')](_0x518a5e[_0xb522('0x2f')],_0x518a5e[_0xb522('0x30')]);_0x29ff93['attributes']=_[_0xb522('0x31')](_0x518a5e[_0xb522('0x2f')],qs[_0xb522('0x32')](_0x7bd69b['query'][_0xb522('0x32')]));_0x29ff93[_0xb522('0x33')]=_0x29ff93['attributes'][_0xb522('0x34')]?_0x29ff93[_0xb522('0x33')]:_0x518a5e[_0xb522('0x2f')];if(!_0x7bd69b[_0xb522('0x30')][_0xb522('0x35')](_0xb522('0x36'))){_0x29ff93['limit']=qs[_0xb522('0x20')](_0x7bd69b[_0xb522('0x30')][_0xb522('0x20')]);_0x29ff93[_0xb522('0x1e')]=qs[_0xb522('0x1e')](_0x7bd69b[_0xb522('0x30')][_0xb522('0x1e')]);}_0x29ff93['order']=qs[_0xb522('0x37')](_0x7bd69b[_0xb522('0x30')]['sort']);_0x29ff93[_0xb522('0x38')]=qs[_0xb522('0x39')](_['pick'](_0x7bd69b['query'],_0x518a5e[_0xb522('0x39')]),_0xfb12e9);if(_0x7bd69b[_0xb522('0x30')][_0xb522('0x3a')]){_0x29ff93[_0xb522('0x38')]=_[_0xb522('0x3b')](_0x29ff93['where'],{'$or':_[_0xb522('0x2a')](_0xfb12e9,function(_0x30009b){if(_0x30009b[_0xb522('0x2d')]!==_0xb522('0x3c')){var _0x4d3f0a={};_0x4d3f0a[_0x30009b['name']]={'$like':'%'+_0x7bd69b[_0xb522('0x30')][_0xb522('0x3a')]+'%'};return _0x4d3f0a;}})});}_0x29ff93=_[_0xb522('0x3b')]({},_0x29ff93,_0x7bd69b['options']);var _0xf33121={'where':_0x29ff93[_0xb522('0x38')]};return db[_0xb522('0x2b')][_0xb522('0x21')](_0xf33121)[_0xb522('0x13')](function(_0x5de458){_0x530dec[_0xb522('0x21')]=_0x5de458;if(_0x7bd69b['query'][_0xb522('0x3d')]){_0x29ff93['include']=[{'all':!![]}];}return db[_0xb522('0x2b')][_0xb522('0x3e')](_0x29ff93);})['then'](function(_0x3fcbcf){_0x530dec['rows']=_0x3fcbcf;return _0x530dec;})[_0xb522('0x13')](respondWithFilteredResult(_0x1abf19,_0x29ff93))[_0xb522('0x1b')](handleError(_0x1abf19,null));};exports[_0xb522('0x3f')]=function(_0x40bf78,_0x56f1c2){var _0x4eeba3={'raw':!![],'where':{'id':_0x40bf78[_0xb522('0x40')]['id']}},_0x3221b6={};_0x3221b6[_0xb522('0x2f')]=_[_0xb522('0x41')](db[_0xb522('0x2b')]['rawAttributes']);_0x3221b6[_0xb522('0x30')]=_[_0xb522('0x41')](_0x40bf78[_0xb522('0x30')]);_0x3221b6[_0xb522('0x39')]=_[_0xb522('0x31')](_0x3221b6[_0xb522('0x2f')],_0x3221b6[_0xb522('0x30')]);_0x4eeba3[_0xb522('0x33')]=_[_0xb522('0x31')](_0x3221b6[_0xb522('0x2f')],qs['fields'](_0x40bf78[_0xb522('0x30')][_0xb522('0x32')]));_0x4eeba3[_0xb522('0x33')]=_0x4eeba3['attributes'][_0xb522('0x34')]?_0x4eeba3['attributes']:_0x3221b6[_0xb522('0x2f')];if(_0x40bf78[_0xb522('0x30')][_0xb522('0x3d')]){_0x4eeba3[_0xb522('0x42')]=[{'all':!![]}];}_0x4eeba3=_[_0xb522('0x3b')]({},_0x4eeba3,_0x40bf78[_0xb522('0x43')]);return db[_0xb522('0x2b')][_0xb522('0x44')](_0x4eeba3)[_0xb522('0x13')](handleEntityNotFound(_0x56f1c2,null))[_0xb522('0x13')](respondWithResult(_0x56f1c2,null))[_0xb522('0x1b')](handleError(_0x56f1c2,null));};exports[_0xb522('0x24')]=function(_0x1543e4,_0x462be5){if(_0x1543e4[_0xb522('0x45')]['id']){delete _0x1543e4[_0xb522('0x45')]['id'];}return db[_0xb522('0x2b')]['find']({'where':{'id':_0x1543e4[_0xb522('0x40')]['id']}})[_0xb522('0x13')](handleEntityNotFound(_0x462be5,null))[_0xb522('0x13')](saveUpdates(_0x1543e4[_0xb522('0x45')],null))['then'](respondWithResult(_0x462be5,null))[_0xb522('0x1b')](handleError(_0x462be5,null));};exports[_0xb522('0x46')]=function(_0x30d96a,_0x2f4f49){return db[_0xb522('0x2b')][_0xb522('0x44')]({'where':{'id':_0x30d96a['params']['id']}})[_0xb522('0x13')](handleEntityNotFound(_0x2f4f49,null))[_0xb522('0x13')](removeEntity(_0x2f4f49,null))[_0xb522('0x1b')](handleError(_0x2f4f49,null));};exports[_0xb522('0x47')]=function(_0x15a992,_0x811bd9){return db[_0xb522('0x2b')][_0xb522('0x47')]()['then'](respondWithResult(_0x811bd9,null))[_0xb522('0x1b')](handleError(_0x811bd9,null));};exports['create']=function(_0x447154,_0x5e5089){return db[_0xb522('0x2b')]['create'](_0x447154['body'])[_0xb522('0x13')](function(_0x586b01){if(_0x586b01){if(_0x586b01[_0xb522('0x48')]===_0xb522('0x49')&&!_0x586b01[_0xb522('0x4a')]){var _0x13aea3,_0x558c1c,_0x2bb733;if(_0x447154[_0xb522('0x45')]['to']){_0x558c1c=_0x447154[_0xb522('0x45')]['to']['split'](',')[0x0];}return db[_0xb522('0x4b')]['findOne']({'where':{'id':_0x586b01[_0xb522('0x4c')]},'include':[{'model':db[_0xb522('0x4d')],'as':_0xb522('0x4e'),'include':[{'model':db[_0xb522('0x4f')],'as':'Contacts','where':{'email':_0x558c1c},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xb522('0x50')],'as':_0xb522('0x51'),'raw':!![],'include':[{'model':db[_0xb522('0x52')],'as':_0xb522('0x52'),'raw':!![]}]}]})['then'](function(_0x25e339){_0x13aea3=_0x25e339;if(!_0x13aea3||!_0x13aea3['Smtp'])return;var _0x3601b0=_0x13aea3[_0xb522('0x53')]();if(_0x447154[_0xb522('0x45')][_0xb522('0x54')]&&_0x447154[_0xb522('0x45')][_0xb522('0x54')]['length']){for(var _0x3df250=0x0;_0x3df250<_0x447154[_0xb522('0x45')][_0xb522('0x54')][_0xb522('0x34')];_0x3df250+=0x1){_0x447154[_0xb522('0x45')][_0xb522('0x54')][_0x3df250]={'filename':_0x447154[_0xb522('0x45')][_0xb522('0x54')][_0x3df250][_0xb522('0x27')],'path':path[_0xb522('0x55')](config['root'],_0xb522('0x56'),_0x447154[_0xb522('0x45')][_0xb522('0x54')][_0x3df250][_0xb522('0x57')])};}}_0x2bb733={'account':_0x3601b0,'message':_0x447154[_0xb522('0x45')]};return;})['then'](function(){if(_0x13aea3[_0xb522('0x4e')]){if(_0x13aea3['List'][_0xb522('0x58')][_0xb522('0x34')]){return _0x13aea3[_0xb522('0x4e')][_0xb522('0x58')][0x0];}else{return db[_0xb522('0x4f')]['create'](_[_0xb522('0xc')](_0x447154[_0xb522('0x45')],{'firstName':_0x447154['body']['to'],'email':_0x447154['body']['to'],'phone':_0x447154[_0xb522('0x45')]['to'],'ListId':_0x13aea3[_0xb522('0x59')]}));}}else{throw new Error(_0xb522('0x5a'));}})[_0xb522('0x13')](function(){if(_0x2bb733){return respondWithRpcPromise('SendMail','sendMail',_0x2bb733,client9003)[_0xb522('0x13')](function(_0x4154b8){return _0x586b01[_0xb522('0x24')]({'read':!![],'messageId':_0x4154b8[_0xb522('0x5b')],'sentAt':moment()[_0xb522('0x5c')](_0xb522('0x5d'))});})[_0xb522('0x1b')](function(_0x172684){logger[_0xb522('0x17')]('%s',JSON[_0xb522('0x5e')](_0x172684));return _0x586b01;});}return _0x586b01;});}return _0x586b01;}})[_0xb522('0x13')](respondWithResult(_0x5e5089,0xc9))[_0xb522('0x1b')](handleError(_0x5e5089,null));};exports[_0xb522('0x5f')]=function(_0x47b3f7,_0x5b5a33){var _0x3070d0={'agent':{},'channel':'mail'};if(_0x47b3f7['body']['id']){delete _0x47b3f7[_0xb522('0x45')]['id'];}_0x47b3f7['body'][_0xb522('0x60')]=!![];_0x47b3f7['body'][_0xb522('0x61')]=moment()['format'](_0xb522('0x5d'));_0x47b3f7[_0xb522('0x45')][_0xb522('0x62')]=_0x47b3f7['body'][_0xb522('0x62')]||_0x47b3f7['user']['id'];_0x3070d0['agent']['id']=_0x47b3f7['body'][_0xb522('0x62')];return db[_0xb522('0x2b')][_0xb522('0x44')]({'where':{'id':_0x47b3f7[_0xb522('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b5a33,null))[_0xb522('0x13')](saveUpdates(_0x47b3f7[_0xb522('0x45')],null))[_0xb522('0x13')](function(_0x327ecc){if(_0x327ecc){_0x3070d0[_0xb522('0x19')]=_0x327ecc[_0xb522('0x63')]({'plain':!![]});return db[_0xb522('0x64')]['find']({'where':{'id':_0x327ecc['MailInteractionId']}});}return null;})[_0xb522('0x13')](handleEntityNotFound(_0x5b5a33,null))[_0xb522('0x13')](function(_0x1084bf){if(_0x1084bf){return _0x1084bf[_0xb522('0x24')]({'UserId':_0x47b3f7[_0xb522('0x45')]['UserId'],'read1stAt':_[_0xb522('0x65')](_0x1084bf[_0xb522('0x66')])?moment()[_0xb522('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb522('0x13')](function(_0x106a20){if(_0x106a20){_0x3070d0[_0xb522('0x67')]=_0x106a20[_0xb522('0x63')]({'plain':!![]});interaction_log['info'](_0xb522('0x68'),_0x47b3f7[_0xb522('0x69')]['id'],_0x47b3f7[_0xb522('0x69')]['name'],_0x47b3f7['user'][_0xb522('0x6a')],_0x3070d0[_0xb522('0x67')]['id'],_0x47b3f7[_0xb522('0x45')]?JSON[_0xb522('0x5e')](_0x47b3f7['body']):_0xb522('0x6b'));return respondWithRpcPromise(_0xb522('0x6c'),'acceptMessage',_0x3070d0);}return null;})[_0xb522('0x13')](function(_0x5195f6){var _0xc06aaf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5195f6[_0xb522('0x19')][_0xb522('0x6d')];return db['sequelize'][_0xb522('0x30')](_0xc06aaf,{'type':db[_0xb522('0x6e')]['QueryTypes'][_0xb522('0x6f')],'raw':!![]})[_0xb522('0x13')](function(_0x211e57){return _0x211e57;});})['then'](function(_0x31dc00){if(_0x31dc00){_0x3070d0[_0xb522('0x19')][_0xb522('0x70')]=_0x31dc00[0x0];if(!_0x47b3f7['body'][_0xb522('0x62')])return;return db[_0xb522('0x71')][_0xb522('0x44')]({'where':{'id':_0x47b3f7['body'][_0xb522('0x62')],'role':_0xb522('0x72')},'attributes':['id',_0xb522('0x27'),_0xb522('0x73'),_0xb522('0x74'),_0xb522('0x75')],'raw':!![]});}return null;})[_0xb522('0x13')](function(_0x4ac40e){if(!_0x4ac40e)return null;_0x3070d0[_0xb522('0x19')][_0xb522('0x72')]=_0x4ac40e;return _0x3070d0;})[_0xb522('0x13')](function(_0x33b056){if(_0x33b056){if(_0x47b3f7[_0xb522('0x45')]['manual']){_0x3070d0[_0xb522('0x19')][_0xb522('0x76')]=util[_0xb522('0x5c')]('SIP/%s',_0x47b3f7[_0xb522('0x69')][_0xb522('0x27')]);_0x3070d0['message'][_0xb522('0x77')]=_0x3070d0[_0xb522('0x77')];_0x3070d0['message'][_0xb522('0x78')]=_0x3070d0[_0xb522('0x77')];_0x3070d0[_0xb522('0x19')][_0xb522('0x79')]=_0xb522('0x5f');_0x3070d0['message'][_0xb522('0x45')]=htmlToText[_0xb522('0x7a')](_0x3070d0[_0xb522('0x19')][_0xb522('0x45')]);return respondWithRpcPromise(_0xb522('0x7b'),_0xb522('0x7b'),{'event':_0xb522('0x7c'),'message':_0x3070d0[_0xb522('0x19')]},client9002)[_0xb522('0x13')](function(){return _0x3070d0;});}return _0x3070d0;}return null;})[_0xb522('0x13')](respondWithResult(_0x5b5a33,null))[_0xb522('0x1b')](handleError(_0x5b5a33,null));};exports[_0xb522('0x7d')]=function(_0x3983bd,_0x2645e1){var _0x17ae54={'agent':{},'channel':_0xb522('0x7e')};if(_0x3983bd[_0xb522('0x45')]['id']){delete _0x3983bd[_0xb522('0x45')]['id'];}_0x3983bd[_0xb522('0x45')]['UserId']=_0x3983bd[_0xb522('0x45')][_0xb522('0x62')]||_0x3983bd['user']['id'];_0x17ae54[_0xb522('0x72')]['id']=_0x3983bd[_0xb522('0x45')][_0xb522('0x62')];return db[_0xb522('0x2b')][_0xb522('0x44')]({'where':{'id':_0x3983bd['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2645e1,null))[_0xb522('0x13')](function(_0x3dd2ec){if(_0x3dd2ec){_0x17ae54[_0xb522('0x19')]=_0x3dd2ec['get']({'plain':!![]});return db['MailInteraction'][_0xb522('0x44')]({'where':{'id':_0x3dd2ec[_0xb522('0x7f')]}});}return null;})[_0xb522('0x13')](handleEntityNotFound(_0x2645e1,null))[_0xb522('0x13')](function(_0x1d410f){if(_0x1d410f){_0x17ae54['interaction']=_0x1d410f[_0xb522('0x63')]({'plain':!![]});interaction_log[_0xb522('0x1a')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3983bd[_0xb522('0x69')]['id'],_0x3983bd['user'][_0xb522('0x27')],_0x3983bd[_0xb522('0x69')][_0xb522('0x6a')],_0x17ae54[_0xb522('0x67')]['id'],_0x3983bd['body']?JSON[_0xb522('0x5e')](_0x3983bd[_0xb522('0x45')]):_0xb522('0x6b'));return respondWithRpcPromise(_0xb522('0x80'),_0xb522('0x81'),_0x17ae54);}return null;})['then'](function(_0x30757e){var _0x4c6ee1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30757e['message'][_0xb522('0x6d')];return db[_0xb522('0x82')][_0xb522('0x30')](_0x4c6ee1,{'type':db[_0xb522('0x6e')][_0xb522('0x83')][_0xb522('0x6f')],'raw':!![]})[_0xb522('0x13')](function(_0x1b209f){return _0x1b209f;});})[_0xb522('0x13')](function(_0x8a2c92){if(_0x8a2c92){_0x17ae54[_0xb522('0x19')][_0xb522('0x70')]=_0x8a2c92[0x0];if(!_0x3983bd[_0xb522('0x45')][_0xb522('0x62')])return;return db[_0xb522('0x71')][_0xb522('0x44')]({'where':{'id':_0x3983bd[_0xb522('0x45')]['UserId'],'role':_0xb522('0x72')},'attributes':['id','name',_0xb522('0x73'),_0xb522('0x74'),_0xb522('0x75')],'raw':!![]});}return null;})[_0xb522('0x13')](function(_0x598f2c){if(!_0x598f2c)return null;_0x17ae54[_0xb522('0x19')][_0xb522('0x72')]=_0x598f2c;return _0x17ae54;})['then'](function(_0x27cc2b){if(_0x27cc2b){_0x27cc2b[_0xb522('0x19')]['interface']=util[_0xb522('0x5c')]('SIP/%s',_0x3983bd['user'][_0xb522('0x27')]);_0x27cc2b[_0xb522('0x19')]['channel']=_0x17ae54[_0xb522('0x77')];_0x27cc2b[_0xb522('0x19')][_0xb522('0x78')]=_0x17ae54[_0xb522('0x77')];_0x27cc2b[_0xb522('0x19')][_0xb522('0x79')]=_0xb522('0x7d');_0x27cc2b[_0xb522('0x19')]['body']=htmlToText['fromString'](_0x17ae54[_0xb522('0x19')]['body']);respondWithRpcPromise(_0xb522('0x7b'),_0xb522('0x7b'),{'event':'rejectmessage','message':_0x27cc2b[_0xb522('0x19')]},client9002);return _0x17ae54;}return null;})['then'](respondWithResult(_0x2645e1,null))[_0xb522('0x1b')](handleError(_0x2645e1,null));};exports[_0xb522('0x84')]=function(_0x2bea07,_0x183f0c){var _0x2011f0=moment()['unix']()[_0xb522('0x85')]();var _0xec13ad=path['join'](config['root'],'server',_0xb522('0x86'),_0xb522('0x87'));var _0x364949=path[_0xb522('0x55')](config[_0xb522('0x88')],_0xb522('0x89'),'files',_0xb522('0x54'));var _0x330d71=util[_0xb522('0x5c')]('message-%s.eml',_0x2011f0);return db['MailMessage']['find']({'where':{'id':_0x2bea07[_0xb522('0x40')]['id']},'attributes':['id',_0xb522('0x45'),'from','to','cc',_0xb522('0x8a'),'subject','createdAt'],'include':_0x2bea07[_0xb522('0x30')]['attachments']?[{'model':db[_0xb522('0x8b')],'as':_0xb522('0x8c')}]:undefined})['then'](handleEntityNotFound(_0x183f0c,null))[_0xb522('0x13')](function(_0x391e3b){if(_0x391e3b){var _0x3a53d5=_0x391e3b;var _0x11872b={'from':_0x3a53d5[_0xb522('0x8d')],'to':_0x3a53d5['to'],'subject':_0x3a53d5[_0xb522('0x8e')],'html':htmlEntities[_0xb522('0x8f')](_0x3a53d5[_0xb522('0x45')]),'headers':{'Date':moment(_0x3a53d5['createdAt'])[_0xb522('0x5c')](_0xb522('0x90'))},'attachments':[]};if(_0x391e3b['cc']){_0x11872b[_0xb522('0x91')]['Cc']=_0x391e3b['cc'];}if(_0x391e3b[_0xb522('0x8a')]){_0x11872b[_0xb522('0x91')][_0xb522('0x92')]=_0x391e3b['bcc'];}return new BPromise(function(_0x18c773,_0x390a81){if(_0x391e3b[_0xb522('0x8c')]){for(var _0x9310b2=0x0;_0x9310b2<_0x391e3b[_0xb522('0x8c')][_0xb522('0x34')];_0x9310b2++){var _0x1dabe4=_0x391e3b[_0xb522('0x8c')][_0x9310b2];var _0x4b63d6=path[_0xb522('0x55')](_0x364949,_0x1dabe4['basename']);if(fs[_0xb522('0x93')](_0x4b63d6)){_0x11872b['attachments']['push']({'name':_0x1dabe4[_0xb522('0x27')],'contentType':_0x1dabe4[_0xb522('0x2d')],'data':fs[_0xb522('0x94')](_0x4b63d6)});}}}emlformat[_0xb522('0x95')](_0x11872b,function(_0x4139af,_0x586da8){if(_0x4139af)return _0x390a81(_0x4139af);fs['writeFileSync'](path[_0xb522('0x55')](_0xec13ad,_0x330d71),_0x586da8);return _0x18c773(_0x586da8);});});}})[_0xb522('0x13')](function(_0xe9bf90){if(_0xe9bf90){return _0x183f0c['download'](path[_0xb522('0x55')](_0xec13ad,_0x330d71),_0x330d71,function(_0x318f1d){if(!_0x318f1d)fs[_0xb522('0x96')](path['join'](_0xec13ad,_0x330d71));});}})['catch'](handleError(_0x183f0c,null));}; \ No newline at end of file +var _0xaa67=['decode','createdAt','headers','Bcc','Attachments','existsSync','push','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','json','offset','limit','undefined','count','status','set','Content-Range','destroy','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','params','includeAll','find','body','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','sendMail','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','MailInteraction','MailInteractionId','update','isNil','read1stAt','interaction','get','[MAILMESSAGE: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','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','reject','rejectmessage','download','unix','toString','join','server','tmp','files','message-%s.eml','from','bcc','subject'];(function(_0x1b580b,_0x256058){var _0x193939=function(_0x495860){while(--_0x495860){_0x1b580b['push'](_0x1b580b['shift']());}};_0x193939(++_0x256058);}(_0xaa67,0x1e6));var _0x7aa6=function(_0x248fae,_0x41e854){_0x248fae=_0x248fae-0x0;var _0x1c0929=_0xaa67[_0x248fae];return _0x1c0929;};'use strict';var emlformat=require(_0x7aa6('0x0'));var moment=require(_0x7aa6('0x1'));var BPromise=require('bluebird');var util=require(_0x7aa6('0x2'));var path=require(_0x7aa6('0x3'));var fs=require('fs');var _=require(_0x7aa6('0x4'));var Redis=require(_0x7aa6('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x7aa6('0x6'))(_0x7aa6('0x7'));var interaction_log=require(_0x7aa6('0x6'))(_0x7aa6('0x8'));var config=require(_0x7aa6('0x9'));var db=require(_0x7aa6('0xa'))['db'];config[_0x7aa6('0xb')]=_[_0x7aa6('0xc')](config[_0x7aa6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7aa6('0xd'))(new Redis(config[_0x7aa6('0xb')]));var htmlEntities=require(_0x7aa6('0xe'));require(_0x7aa6('0xf'))[_0x7aa6('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7aa6('0x11')][_0x7aa6('0x12')]({'port':0x232c});var client9003=jayson[_0x7aa6('0x11')]['http']({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55faf1,_0x48e2d9,_0x360414,_0x41f0e4){return new BPromise(function(_0x461130,_0x4da027){var _0xbeb7b1=_0x41f0e4||client;return _0xbeb7b1[_0x7aa6('0x13')](_0x55faf1,_0x360414)[_0x7aa6('0x14')](function(_0x391ad6){logger[_0x7aa6('0x15')](_0x7aa6('0x16'),_0x48e2d9,'request\x20sent');logger['debug'](_0x7aa6('0x17'),_0x48e2d9,_0x7aa6('0x18'),JSON[_0x7aa6('0x19')](_0x391ad6));if(_0x391ad6[_0x7aa6('0x1a')]){if(_0x391ad6[_0x7aa6('0x1a')][_0x7aa6('0x1b')]===0x1f4){logger[_0x7aa6('0x1a')](_0x7aa6('0x16'),_0x48e2d9,_0x391ad6[_0x7aa6('0x1a')][_0x7aa6('0x1c')]);return _0x4da027(_0x391ad6['error'][_0x7aa6('0x1c')]);}logger['error'](_0x7aa6('0x16'),_0x48e2d9,_0x391ad6['error'][_0x7aa6('0x1c')]);return _0x461130(_0x391ad6[_0x7aa6('0x1a')][_0x7aa6('0x1c')]);}else{logger[_0x7aa6('0x15')](_0x7aa6('0x16'),_0x48e2d9,_0x7aa6('0x18'));_0x461130(_0x391ad6[_0x7aa6('0x1d')]['message']);}})[_0x7aa6('0x1e')](function(_0x37152b){logger[_0x7aa6('0x1a')]('MailMessage,\x20%s,\x20%s',_0x48e2d9,_0x37152b);_0x4da027(_0x37152b);});});}function respondWithResult(_0x1bf1c7,_0x3a1162){_0x3a1162=_0x3a1162||0xc8;return function(_0x459805){if(_0x459805){return _0x1bf1c7['status'](_0x3a1162)[_0x7aa6('0x1f')](_0x459805);}};}function respondWithFilteredResult(_0x34d1c0,_0x55e855){return function(_0x260f84){if(_0x260f84){var _0x3d6d58=typeof _0x55e855[_0x7aa6('0x20')]==='undefined'&&typeof _0x55e855[_0x7aa6('0x21')]===_0x7aa6('0x22');var _0x45f594=_0x260f84[_0x7aa6('0x23')];var _0x4964a0=_0x3d6d58?0x0:_0x55e855['offset'];var _0x24dd78=_0x3d6d58?_0x260f84[_0x7aa6('0x23')]:_0x55e855[_0x7aa6('0x20')]+_0x55e855['limit'];var _0x5bccb5;if(_0x24dd78>=_0x45f594){_0x24dd78=_0x45f594;_0x5bccb5=0xc8;}else{_0x5bccb5=0xce;}_0x34d1c0[_0x7aa6('0x24')](_0x5bccb5);return _0x34d1c0[_0x7aa6('0x25')](_0x7aa6('0x26'),_0x4964a0+'-'+_0x24dd78+'/'+_0x45f594)['json'](_0x260f84);}return null;};}function saveUpdates(_0xf1ad29){return function(_0x364988){if(_0x364988){return _0x364988['update'](_0xf1ad29)[_0x7aa6('0x14')](function(_0x4a4872){return _0x4a4872;});}return null;};}function removeEntity(_0x1a26bc){return function(_0x115e4c){if(_0x115e4c){return _0x115e4c[_0x7aa6('0x27')]()[_0x7aa6('0x14')](function(){_0x1a26bc[_0x7aa6('0x24')](0xcc)[_0x7aa6('0x28')]();});}};}function handleEntityNotFound(_0x267c36){return function(_0x465ea1){if(!_0x465ea1){_0x267c36[_0x7aa6('0x29')](0x194);}return _0x465ea1;};}function handleError(_0x44b35f,_0x31b202){_0x31b202=_0x31b202||0x1f4;return function(_0x532118){logger[_0x7aa6('0x1a')](_0x532118[_0x7aa6('0x2a')]);if(_0x532118[_0x7aa6('0x2b')]){delete _0x532118['name'];}_0x44b35f[_0x7aa6('0x24')](_0x31b202)[_0x7aa6('0x2c')](_0x532118);};}exports['index']=function(_0x3e6d79,_0x3cdef7){var _0x282f2d={},_0x30f3bd={},_0x1d6e02={'count':0x0,'rows':[]};var _0x1c6835=_[_0x7aa6('0x2d')](db[_0x7aa6('0x2e')][_0x7aa6('0x2f')],function(_0x423117){return{'name':_0x423117[_0x7aa6('0x30')],'type':_0x423117[_0x7aa6('0x31')][_0x7aa6('0x32')]};});_0x30f3bd[_0x7aa6('0x33')]=_[_0x7aa6('0x2d')](_0x1c6835,_0x7aa6('0x2b'));_0x30f3bd[_0x7aa6('0x34')]=_[_0x7aa6('0x35')](_0x3e6d79['query']);_0x30f3bd[_0x7aa6('0x36')]=_[_0x7aa6('0x37')](_0x30f3bd[_0x7aa6('0x33')],_0x30f3bd[_0x7aa6('0x34')]);_0x282f2d['attributes']=_[_0x7aa6('0x37')](_0x30f3bd[_0x7aa6('0x33')],qs[_0x7aa6('0x38')](_0x3e6d79[_0x7aa6('0x34')][_0x7aa6('0x38')]));_0x282f2d['attributes']=_0x282f2d[_0x7aa6('0x39')][_0x7aa6('0x3a')]?_0x282f2d['attributes']:_0x30f3bd['model'];if(!_0x3e6d79['query']['hasOwnProperty']('nolimit')){_0x282f2d[_0x7aa6('0x21')]=qs[_0x7aa6('0x21')](_0x3e6d79[_0x7aa6('0x34')][_0x7aa6('0x21')]);_0x282f2d[_0x7aa6('0x20')]=qs['offset'](_0x3e6d79[_0x7aa6('0x34')]['offset']);}_0x282f2d['order']=qs[_0x7aa6('0x3b')](_0x3e6d79[_0x7aa6('0x34')]['sort']);_0x282f2d['where']=qs[_0x7aa6('0x36')](_[_0x7aa6('0x3c')](_0x3e6d79[_0x7aa6('0x34')],_0x30f3bd[_0x7aa6('0x36')]),_0x1c6835);if(_0x3e6d79[_0x7aa6('0x34')][_0x7aa6('0x3d')]){_0x282f2d[_0x7aa6('0x3e')]=_[_0x7aa6('0x3f')](_0x282f2d[_0x7aa6('0x3e')],{'$or':_[_0x7aa6('0x2d')](_0x1c6835,function(_0x4cf1d1){if(_0x4cf1d1['type']!==_0x7aa6('0x40')){var _0x76a1d8={};_0x76a1d8[_0x4cf1d1[_0x7aa6('0x2b')]]={'$like':'%'+_0x3e6d79[_0x7aa6('0x34')]['filter']+'%'};return _0x76a1d8;}})});}_0x282f2d=_[_0x7aa6('0x3f')]({},_0x282f2d,_0x3e6d79[_0x7aa6('0x41')]);var _0x171ffe={'where':_0x282f2d[_0x7aa6('0x3e')]};return db[_0x7aa6('0x2e')]['count'](_0x171ffe)[_0x7aa6('0x14')](function(_0x403412){_0x1d6e02['count']=_0x403412;if(_0x3e6d79[_0x7aa6('0x34')]['includeAll']){_0x282f2d[_0x7aa6('0x42')]=[{'all':!![]}];}return db[_0x7aa6('0x2e')]['findAll'](_0x282f2d);})[_0x7aa6('0x14')](function(_0x3c3e1e){_0x1d6e02[_0x7aa6('0x43')]=_0x3c3e1e;return _0x1d6e02;})[_0x7aa6('0x14')](respondWithFilteredResult(_0x3cdef7,_0x282f2d))[_0x7aa6('0x1e')](handleError(_0x3cdef7,null));};exports['show']=function(_0x14c6db,_0x35f4ea){var _0x1bdfa0={'raw':!![],'where':{'id':_0x14c6db[_0x7aa6('0x44')]['id']}},_0x3619d6={};_0x3619d6['model']=_[_0x7aa6('0x35')](db[_0x7aa6('0x2e')][_0x7aa6('0x2f')]);_0x3619d6[_0x7aa6('0x34')]=_[_0x7aa6('0x35')](_0x14c6db['query']);_0x3619d6[_0x7aa6('0x36')]=_['intersection'](_0x3619d6[_0x7aa6('0x33')],_0x3619d6[_0x7aa6('0x34')]);_0x1bdfa0[_0x7aa6('0x39')]=_[_0x7aa6('0x37')](_0x3619d6[_0x7aa6('0x33')],qs[_0x7aa6('0x38')](_0x14c6db[_0x7aa6('0x34')][_0x7aa6('0x38')]));_0x1bdfa0[_0x7aa6('0x39')]=_0x1bdfa0['attributes'][_0x7aa6('0x3a')]?_0x1bdfa0[_0x7aa6('0x39')]:_0x3619d6['model'];if(_0x14c6db[_0x7aa6('0x34')][_0x7aa6('0x45')]){_0x1bdfa0[_0x7aa6('0x42')]=[{'all':!![]}];}_0x1bdfa0=_['merge']({},_0x1bdfa0,_0x14c6db[_0x7aa6('0x41')]);return db['MailMessage']['find'](_0x1bdfa0)[_0x7aa6('0x14')](handleEntityNotFound(_0x35f4ea,null))[_0x7aa6('0x14')](respondWithResult(_0x35f4ea,null))[_0x7aa6('0x1e')](handleError(_0x35f4ea,null));};exports['update']=function(_0x42d31c,_0x1cefa7){if(_0x42d31c['body']['id']){delete _0x42d31c['body']['id'];}return db[_0x7aa6('0x2e')][_0x7aa6('0x46')]({'where':{'id':_0x42d31c[_0x7aa6('0x44')]['id']}})[_0x7aa6('0x14')](handleEntityNotFound(_0x1cefa7,null))[_0x7aa6('0x14')](saveUpdates(_0x42d31c[_0x7aa6('0x47')],null))[_0x7aa6('0x14')](respondWithResult(_0x1cefa7,null))[_0x7aa6('0x1e')](handleError(_0x1cefa7,null));};exports['destroy']=function(_0x16ef92,_0x469106){return db[_0x7aa6('0x2e')][_0x7aa6('0x46')]({'where':{'id':_0x16ef92[_0x7aa6('0x44')]['id']}})[_0x7aa6('0x14')](handleEntityNotFound(_0x469106,null))[_0x7aa6('0x14')](removeEntity(_0x469106,null))[_0x7aa6('0x1e')](handleError(_0x469106,null));};exports[_0x7aa6('0x48')]=function(_0x378dca,_0x46bfd8){return db[_0x7aa6('0x2e')]['describe']()['then'](respondWithResult(_0x46bfd8,null))[_0x7aa6('0x1e')](handleError(_0x46bfd8,null));};exports[_0x7aa6('0x49')]=function(_0x2f2dce,_0x3a9882){return db['MailMessage'][_0x7aa6('0x49')](_0x2f2dce[_0x7aa6('0x47')])['then'](function(_0x2a7390){if(_0x2a7390){if(_0x2a7390[_0x7aa6('0x4a')]==='out'&&!_0x2a7390[_0x7aa6('0x4b')]){var _0x54fd3b,_0x42b39d,_0x275f26;if(_0x2f2dce['body']['to']){_0x42b39d=_0x2f2dce[_0x7aa6('0x47')]['to']['split'](',')[0x0];}return db[_0x7aa6('0x4c')][_0x7aa6('0x4d')]({'where':{'id':_0x2a7390[_0x7aa6('0x4e')]},'include':[{'model':db[_0x7aa6('0x4f')],'as':'List','include':[{'model':db[_0x7aa6('0x50')],'as':_0x7aa6('0x51'),'where':{'email':_0x42b39d},'limit':0x1,'order':[[_0x7aa6('0x52'),_0x7aa6('0x53')]]}]},{'model':db['MailServerOut'],'as':_0x7aa6('0x54'),'raw':!![],'include':[{'model':db[_0x7aa6('0x55')],'as':_0x7aa6('0x55'),'raw':!![]}]}]})[_0x7aa6('0x14')](function(_0x413185){_0x54fd3b=_0x413185;if(!_0x54fd3b||!_0x54fd3b[_0x7aa6('0x54')])return;var _0x36e724=_0x54fd3b[_0x7aa6('0x56')]();if(_0x2f2dce[_0x7aa6('0x47')][_0x7aa6('0x57')]&&_0x2f2dce[_0x7aa6('0x47')]['attachments'][_0x7aa6('0x3a')]){for(var _0x104e68=0x0;_0x104e68<_0x2f2dce['body'][_0x7aa6('0x57')][_0x7aa6('0x3a')];_0x104e68+=0x1){_0x2f2dce[_0x7aa6('0x47')][_0x7aa6('0x57')][_0x104e68]={'filename':_0x2f2dce[_0x7aa6('0x47')]['attachments'][_0x104e68][_0x7aa6('0x2b')],'path':path['join'](config[_0x7aa6('0x58')],_0x7aa6('0x59'),_0x2f2dce[_0x7aa6('0x47')][_0x7aa6('0x57')][_0x104e68][_0x7aa6('0x5a')])};}}_0x275f26={'account':_0x36e724,'message':_0x2f2dce['body']};return;})[_0x7aa6('0x14')](function(){if(_0x54fd3b[_0x7aa6('0x5b')]){if(_0x54fd3b[_0x7aa6('0x5b')][_0x7aa6('0x51')][_0x7aa6('0x3a')]){return _0x54fd3b['List'][_0x7aa6('0x51')][0x0];}else{return db[_0x7aa6('0x50')]['create'](_[_0x7aa6('0xc')](_0x2f2dce[_0x7aa6('0x47')],{'firstName':_0x2f2dce[_0x7aa6('0x47')]['to'],'email':_0x2f2dce['body']['to'],'phone':_0x2f2dce['body']['to'],'ListId':_0x54fd3b[_0x7aa6('0x5c')]}));}}else{throw new Error(_0x7aa6('0x5d'));}})['then'](function(){if(_0x275f26){return respondWithRpcPromise('SendMail',_0x7aa6('0x5e'),_0x275f26,client9003)['then'](function(_0x47e03c){return _0x2a7390['update']({'read':!![],'messageId':_0x47e03c[_0x7aa6('0x5f')],'sentAt':moment()[_0x7aa6('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x41e769){logger[_0x7aa6('0x1a')]('%s',JSON[_0x7aa6('0x19')](_0x41e769));return _0x2a7390;});}return _0x2a7390;});}return _0x2a7390;}})['then'](respondWithResult(_0x3a9882,0xc9))[_0x7aa6('0x1e')](handleError(_0x3a9882,null));};exports[_0x7aa6('0x61')]=function(_0x2d11d0,_0x2913b5){var _0x1d95f4={'agent':{},'channel':_0x7aa6('0x62')};if(_0x2d11d0[_0x7aa6('0x47')]['id']){delete _0x2d11d0[_0x7aa6('0x47')]['id'];}_0x2d11d0[_0x7aa6('0x47')][_0x7aa6('0x63')]=!![];_0x2d11d0[_0x7aa6('0x47')][_0x7aa6('0x64')]=moment()[_0x7aa6('0x60')](_0x7aa6('0x65'));_0x2d11d0[_0x7aa6('0x47')][_0x7aa6('0x66')]=_0x2d11d0[_0x7aa6('0x47')]['UserId']||_0x2d11d0[_0x7aa6('0x67')]['id'];_0x1d95f4[_0x7aa6('0x68')]['id']=_0x2d11d0['body'][_0x7aa6('0x66')];return db[_0x7aa6('0x2e')][_0x7aa6('0x46')]({'where':{'id':_0x2d11d0[_0x7aa6('0x44')]['id'],'UserId':null}})[_0x7aa6('0x14')](handleEntityNotFound(_0x2913b5,null))[_0x7aa6('0x14')](saveUpdates(_0x2d11d0[_0x7aa6('0x47')],null))[_0x7aa6('0x14')](function(_0x70a5ea){if(_0x70a5ea){_0x1d95f4[_0x7aa6('0x1c')]=_0x70a5ea['get']({'plain':!![]});return db[_0x7aa6('0x69')][_0x7aa6('0x46')]({'where':{'id':_0x70a5ea[_0x7aa6('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x2913b5,null))[_0x7aa6('0x14')](function(_0x398335){if(_0x398335){return _0x398335[_0x7aa6('0x6b')]({'UserId':_0x2d11d0['body'][_0x7aa6('0x66')],'read1stAt':_[_0x7aa6('0x6c')](_0x398335[_0x7aa6('0x6d')])?moment()[_0x7aa6('0x60')](_0x7aa6('0x65')):undefined});}return null;})['then'](function(_0x53e7f5){if(_0x53e7f5){_0x1d95f4[_0x7aa6('0x6e')]=_0x53e7f5[_0x7aa6('0x6f')]({'plain':!![]});interaction_log[_0x7aa6('0x15')](_0x7aa6('0x70'),_0x2d11d0[_0x7aa6('0x67')]['id'],_0x2d11d0['user'][_0x7aa6('0x2b')],_0x2d11d0[_0x7aa6('0x67')][_0x7aa6('0x71')],_0x1d95f4['interaction']['id'],_0x2d11d0[_0x7aa6('0x47')]?JSON['stringify'](_0x2d11d0[_0x7aa6('0x47')]):_0x7aa6('0x72'));return respondWithRpcPromise(_0x7aa6('0x73'),'acceptMessage',_0x1d95f4);}return null;})[_0x7aa6('0x14')](function(_0x5a5194){var _0x3c9f03=_0x7aa6('0x74')+_0x5a5194[_0x7aa6('0x1c')][_0x7aa6('0x75')];return db[_0x7aa6('0x76')][_0x7aa6('0x34')](_0x3c9f03,{'type':db[_0x7aa6('0x77')][_0x7aa6('0x78')][_0x7aa6('0x79')],'raw':!![]})['then'](function(_0x1e71b9){return _0x1e71b9;});})[_0x7aa6('0x14')](function(_0x28dbc6){if(_0x28dbc6){_0x1d95f4['message'][_0x7aa6('0x7a')]=_0x28dbc6[0x0];if(!_0x2d11d0[_0x7aa6('0x47')][_0x7aa6('0x66')])return;return db['User'][_0x7aa6('0x46')]({'where':{'id':_0x2d11d0[_0x7aa6('0x47')][_0x7aa6('0x66')],'role':_0x7aa6('0x68')},'attributes':['id',_0x7aa6('0x2b'),_0x7aa6('0x7b'),_0x7aa6('0x7c'),_0x7aa6('0x7d')],'raw':!![]});}return null;})[_0x7aa6('0x14')](function(_0xcce9d1){if(!_0xcce9d1)return null;_0x1d95f4['message'][_0x7aa6('0x68')]=_0xcce9d1;return _0x1d95f4;})[_0x7aa6('0x14')](function(_0x5f3263){if(_0x5f3263){if(_0x2d11d0[_0x7aa6('0x47')][_0x7aa6('0x7e')]){_0x1d95f4[_0x7aa6('0x1c')][_0x7aa6('0x7f')]=util['format']('SIP/%s',_0x2d11d0[_0x7aa6('0x67')][_0x7aa6('0x2b')]);_0x1d95f4[_0x7aa6('0x1c')][_0x7aa6('0x80')]=_0x1d95f4['channel'];_0x1d95f4[_0x7aa6('0x1c')][_0x7aa6('0x81')]=_0x1d95f4[_0x7aa6('0x80')];_0x1d95f4[_0x7aa6('0x1c')]['event']='accept';_0x1d95f4[_0x7aa6('0x1c')][_0x7aa6('0x47')]=htmlToText[_0x7aa6('0x82')](_0x1d95f4[_0x7aa6('0x1c')]['body']);return respondWithRpcPromise(_0x7aa6('0x83'),_0x7aa6('0x83'),{'event':'acceptmessage','message':_0x1d95f4['message']},client9002)['then'](function(){return _0x1d95f4;});}return _0x1d95f4;}return null;})[_0x7aa6('0x14')](respondWithResult(_0x2913b5,null))[_0x7aa6('0x1e')](handleError(_0x2913b5,null));};exports['reject']=function(_0x2c6a40,_0x3e5816){var _0x3b19ed={'agent':{},'channel':_0x7aa6('0x62')};if(_0x2c6a40[_0x7aa6('0x47')]['id']){delete _0x2c6a40[_0x7aa6('0x47')]['id'];}_0x2c6a40['body'][_0x7aa6('0x66')]=_0x2c6a40['body'][_0x7aa6('0x66')]||_0x2c6a40[_0x7aa6('0x67')]['id'];_0x3b19ed[_0x7aa6('0x68')]['id']=_0x2c6a40[_0x7aa6('0x47')][_0x7aa6('0x66')];return db[_0x7aa6('0x2e')][_0x7aa6('0x46')]({'where':{'id':_0x2c6a40[_0x7aa6('0x44')]['id'],'UserId':null}})[_0x7aa6('0x14')](handleEntityNotFound(_0x3e5816,null))[_0x7aa6('0x14')](function(_0x210f6c){if(_0x210f6c){_0x3b19ed['message']=_0x210f6c[_0x7aa6('0x6f')]({'plain':!![]});return db[_0x7aa6('0x69')][_0x7aa6('0x46')]({'where':{'id':_0x210f6c['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3e5816,null))['then'](function(_0x414887){if(_0x414887){_0x3b19ed[_0x7aa6('0x6e')]=_0x414887[_0x7aa6('0x6f')]({'plain':!![]});interaction_log[_0x7aa6('0x15')](_0x7aa6('0x84'),_0x2c6a40['user']['id'],_0x2c6a40[_0x7aa6('0x67')]['name'],_0x2c6a40['user'][_0x7aa6('0x71')],_0x3b19ed[_0x7aa6('0x6e')]['id'],_0x2c6a40['body']?JSON[_0x7aa6('0x19')](_0x2c6a40[_0x7aa6('0x47')]):_0x7aa6('0x72'));return respondWithRpcPromise(_0x7aa6('0x85'),_0x7aa6('0x86'),_0x3b19ed);}return null;})[_0x7aa6('0x14')](function(_0x357f28){var _0x4b983b=_0x7aa6('0x74')+_0x357f28[_0x7aa6('0x1c')][_0x7aa6('0x75')];return db[_0x7aa6('0x76')][_0x7aa6('0x34')](_0x4b983b,{'type':db['Sequelize'][_0x7aa6('0x78')][_0x7aa6('0x79')],'raw':!![]})[_0x7aa6('0x14')](function(_0x3c1c17){return _0x3c1c17;});})[_0x7aa6('0x14')](function(_0x1f0487){if(_0x1f0487){_0x3b19ed[_0x7aa6('0x1c')][_0x7aa6('0x7a')]=_0x1f0487[0x0];if(!_0x2c6a40[_0x7aa6('0x47')][_0x7aa6('0x66')])return;return db['User'][_0x7aa6('0x46')]({'where':{'id':_0x2c6a40[_0x7aa6('0x47')][_0x7aa6('0x66')],'role':_0x7aa6('0x68')},'attributes':['id',_0x7aa6('0x2b'),_0x7aa6('0x7b'),_0x7aa6('0x7c'),'internal'],'raw':!![]});}return null;})[_0x7aa6('0x14')](function(_0x2828c8){if(!_0x2828c8)return null;_0x3b19ed[_0x7aa6('0x1c')][_0x7aa6('0x68')]=_0x2828c8;return _0x3b19ed;})[_0x7aa6('0x14')](function(_0x1bb026){if(_0x1bb026){_0x1bb026[_0x7aa6('0x1c')][_0x7aa6('0x7f')]=util[_0x7aa6('0x60')](_0x7aa6('0x87'),_0x2c6a40['user'][_0x7aa6('0x2b')]);_0x1bb026['message'][_0x7aa6('0x80')]=_0x3b19ed['channel'];_0x1bb026['message'][_0x7aa6('0x81')]=_0x3b19ed[_0x7aa6('0x80')];_0x1bb026[_0x7aa6('0x1c')][_0x7aa6('0x88')]=_0x7aa6('0x89');_0x1bb026[_0x7aa6('0x1c')][_0x7aa6('0x47')]=htmlToText[_0x7aa6('0x82')](_0x3b19ed[_0x7aa6('0x1c')]['body']);respondWithRpcPromise(_0x7aa6('0x83'),'EventManager',{'event':_0x7aa6('0x8a'),'message':_0x1bb026[_0x7aa6('0x1c')]},client9002);return _0x3b19ed;}return null;})[_0x7aa6('0x14')](respondWithResult(_0x3e5816,null))[_0x7aa6('0x1e')](handleError(_0x3e5816,null));};exports[_0x7aa6('0x8b')]=function(_0xc82242,_0x4d2c2d){var _0x2d87ee=moment()[_0x7aa6('0x8c')]()[_0x7aa6('0x8d')]();var _0x55462d=path[_0x7aa6('0x8e')](config[_0x7aa6('0x58')],_0x7aa6('0x8f'),'files',_0x7aa6('0x90'));var _0x3424fa=path[_0x7aa6('0x8e')](config[_0x7aa6('0x58')],_0x7aa6('0x8f'),_0x7aa6('0x91'),_0x7aa6('0x57'));var _0x1f4fa0=util['format'](_0x7aa6('0x92'),_0x2d87ee);return db[_0x7aa6('0x2e')][_0x7aa6('0x46')]({'where':{'id':_0xc82242['params']['id']},'attributes':['id',_0x7aa6('0x47'),_0x7aa6('0x93'),'to','cc',_0x7aa6('0x94'),_0x7aa6('0x95'),'createdAt'],'include':_0xc82242[_0x7aa6('0x34')][_0x7aa6('0x57')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x7aa6('0x14')](handleEntityNotFound(_0x4d2c2d,null))[_0x7aa6('0x14')](function(_0x4bffc4){if(_0x4bffc4){var _0x58947f=_0x4bffc4;var _0x2e32d0={'from':_0x58947f[_0x7aa6('0x93')],'to':_0x58947f['to'],'subject':_0x58947f['subject'],'html':htmlEntities[_0x7aa6('0x96')](_0x58947f['body']),'headers':{'Date':moment(_0x58947f[_0x7aa6('0x97')])[_0x7aa6('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4bffc4['cc']){_0x2e32d0['headers']['Cc']=_0x4bffc4['cc'];}if(_0x4bffc4[_0x7aa6('0x94')]){_0x2e32d0[_0x7aa6('0x98')][_0x7aa6('0x99')]=_0x4bffc4[_0x7aa6('0x94')];}return new BPromise(function(_0x568f76,_0x144ce3){if(_0x4bffc4[_0x7aa6('0x9a')]){for(var _0x529dfa=0x0;_0x529dfa<_0x4bffc4[_0x7aa6('0x9a')][_0x7aa6('0x3a')];_0x529dfa++){var _0x3d0a09=_0x4bffc4[_0x7aa6('0x9a')][_0x529dfa];var _0x400ebd=path[_0x7aa6('0x8e')](_0x3424fa,_0x3d0a09[_0x7aa6('0x5a')]);if(fs[_0x7aa6('0x9b')](_0x400ebd)){_0x2e32d0[_0x7aa6('0x57')][_0x7aa6('0x9c')]({'name':_0x3d0a09[_0x7aa6('0x2b')],'contentType':_0x3d0a09['type'],'data':fs['readFileSync'](_0x400ebd)});}}}emlformat['build'](_0x2e32d0,function(_0x15f47,_0x12bb3c){if(_0x15f47)return _0x144ce3(_0x15f47);fs[_0x7aa6('0x9d')](path[_0x7aa6('0x8e')](_0x55462d,_0x1f4fa0),_0x12bb3c);return _0x568f76(_0x12bb3c);});});}})['then'](function(_0x4231e9){if(_0x4231e9){return _0x4d2c2d[_0x7aa6('0x8b')](path[_0x7aa6('0x8e')](_0x55462d,_0x1f4fa0),_0x1f4fa0,function(_0x40aa13){if(!_0x40aa13)fs[_0x7aa6('0x9e')](path[_0x7aa6('0x8e')](_0x55462d,_0x1f4fa0));});}})[_0x7aa6('0x1e')](handleError(_0x4d2c2d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7df2133..f3a3630 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 _0xcedd=['remove','emit','hasOwnProperty','hook','MailMessage','setMaxListeners','save','update'];(function(_0x26c323,_0x559fa7){var _0xaa4f94=function(_0x7b9080){while(--_0x7b9080){_0x26c323['push'](_0x26c323['shift']());}};_0xaa4f94(++_0x559fa7);}(_0xcedd,0x194));var _0xdced=function(_0x92958f,_0x44430b){_0x92958f=_0x92958f-0x0;var _0x1e406d=_0xcedd[_0x92958f];return _0x1e406d;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0xdced('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xdced('0x1')](0x0);var events={'afterCreate':_0xdced('0x2'),'afterUpdate':_0xdced('0x3'),'afterDestroy':_0xdced('0x4')};function emitEvent(_0x2b9c01){return function(_0x23d185,_0x6e985,_0x331777){MailMessageEvents[_0xdced('0x5')](_0x2b9c01+':'+_0x23d185['id'],_0x23d185);MailMessageEvents[_0xdced('0x5')](_0x2b9c01,_0x23d185);_0x331777(null);};}for(var e in events){if(events[_0xdced('0x6')](e)){var event=events[e];MailMessage[_0xdced('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xa86d=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2c4789,_0x2cee6a){var _0x11de67=function(_0x548d2d){while(--_0x548d2d){_0x2c4789['push'](_0x2c4789['shift']());}};_0x11de67(++_0x2cee6a);}(_0xa86d,0x183));var _0xda86=function(_0x3f255e,_0x20c7be){_0x3f255e=_0x3f255e-0x0;var _0x2a58bf=_0xa86d[_0x3f255e];return _0x2a58bf;};'use strict';var EventEmitter=require(_0xda86('0x0'));var MailMessage=require(_0xda86('0x1'))['db'][_0xda86('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xda86('0x3')](0x0);var events={'afterCreate':_0xda86('0x4'),'afterUpdate':_0xda86('0x5'),'afterDestroy':_0xda86('0x6')};function emitEvent(_0x2d1650){return function(_0x4e4a4e,_0x4d2a51,_0x22d2ba){MailMessageEvents[_0xda86('0x7')](_0x2d1650+':'+_0x4e4a4e['id'],_0x4e4a4e);MailMessageEvents[_0xda86('0x7')](_0x2d1650,_0x4e4a4e);_0x22d2ba(null);};}for(var e in events){if(events[_0xda86('0x8')](e)){var event=events[e];MailMessage[_0xda86('0x9')](e,emitEvent(event));}}module[_0xda86('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index acde9f2..81e5452 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 _0x8c42=['models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString'];(function(_0x402396,_0x2b6624){var _0x34d6b0=function(_0x4be518){while(--_0x4be518){_0x402396['push'](_0x402396['shift']());}};_0x34d6b0(++_0x2b6624);}(_0x8c42,0x107));var _0x28c4=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0x8c42[_0x12e073];return _0x267748;};'use strict';var _=require(_0x28c4('0x0'));var util=require(_0x28c4('0x1'));var logger=require('../../config/logger')(_0x28c4('0x2'));var moment=require(_0x28c4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x28c4('0x4'));var rimraf=require(_0x28c4('0x5'));var config=require(_0x28c4('0x6'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x1135f3,_0x1a07c7){return _0x1135f3[_0x28c4('0x7')](_0x28c4('0x8'),attributes,{'tableName':_0x28c4('0x9'),'paranoid':![],'indexes':[{'name':_0x28c4('0xa'),'fields':[_0x28c4('0xa')]},{'name':'fti_mail_messages','fields':[_0x28c4('0xb'),_0x28c4('0xc')],'type':_0x28c4('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44b507,_0x5dccf8,_0x307c0f){if(_0x44b507[_0x28c4('0xe')]){_0x44b507[_0x28c4('0xb')]=htmlToText[_0x28c4('0xf')](_0x44b507[_0x28c4('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x307c0f(null,_0x5dccf8);},'afterCreate':function(_0x1586e3,_0x2180c5,_0x5b7d11){var _0x2ad87b=_0x1135f3[_0x28c4('0x10')];var _0xc652c7=_0x1586e3[_0x28c4('0x11')]({'plain':!![]});if(_0xc652c7[_0x28c4('0x12')][_0x28c4('0x13')]()==='in'||_0xc652c7['direction'][_0x28c4('0x13')]()===_0x28c4('0x14')&&!_0xc652c7[_0x28c4('0x15')]&&!_['isNil'](_0xc652c7[_0x28c4('0x16')])){_0x2ad87b[_0x28c4('0x17')][_0x28c4('0x18')]({'where':{'id':_0xc652c7[_0x28c4('0x19')]}})['then'](function(_0x46bf23){if(_0x46bf23){_0x46bf23[_0x28c4('0x1a')]({'lastMsgAt':_0xc652c7['createdAt'],'lastMsgDirection':_0xc652c7[_0x28c4('0x12')]['toLowerCase']()});}})[_0x28c4('0x1b')](function(_0x19e6fd){console[_0x28c4('0x1c')](_0x19e6fd);});}_0x5b7d11();}},'charset':_0x28c4('0x1d'),'collate':_0x28c4('0x1e')});}; \ No newline at end of file +var _0x6050=['isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x6050,0x71));var _0x0605=function(_0x436917,_0x3ad379){_0x436917=_0x436917-0x0;var _0xbafc45=_0x6050[_0x436917];return _0xbafc45;};'use strict';var _=require('lodash');var util=require(_0x0605('0x0'));var logger=require('../../config/logger')(_0x0605('0x1'));var moment=require('moment');var BPromise=require(_0x0605('0x2'));var rp=require('request-promise');var htmlToText=require(_0x0605('0x3'));var fs=require('fs');var path=require(_0x0605('0x4'));var rimraf=require(_0x0605('0x5'));var config=require(_0x0605('0x6'));var attributes=require(_0x0605('0x7'));module['exports']=function(_0x1182dc,_0x28da2a){return _0x1182dc[_0x0605('0x8')](_0x0605('0x9'),attributes,{'tableName':_0x0605('0xa'),'paranoid':![],'indexes':[{'name':_0x0605('0xb'),'fields':[_0x0605('0xb')]},{'name':_0x0605('0xc'),'fields':[_0x0605('0xd'),_0x0605('0xe')],'type':_0x0605('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3cc2ef,_0x1edb4d,_0x84537f){if(_0x3cc2ef[_0x0605('0x10')]){_0x3cc2ef[_0x0605('0xd')]=htmlToText['fromString'](_0x3cc2ef[_0x0605('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x84537f(null,_0x1edb4d);},'afterCreate':function(_0x5ad500,_0x23f1f4,_0x141a4f){var _0x885b7f=_0x1182dc[_0x0605('0x11')];var _0x2c2f23=_0x5ad500[_0x0605('0x12')]({'plain':!![]});if(_0x2c2f23[_0x0605('0x13')][_0x0605('0x14')]()==='in'||_0x2c2f23[_0x0605('0x13')]['toLowerCase']()===_0x0605('0x15')&&!_0x2c2f23[_0x0605('0x16')]&&!_[_0x0605('0x17')](_0x2c2f23[_0x0605('0x18')])){_0x885b7f[_0x0605('0x19')][_0x0605('0x1a')]({'where':{'id':_0x2c2f23[_0x0605('0x1b')]}})[_0x0605('0x1c')](function(_0x597b40){if(_0x597b40){_0x597b40[_0x0605('0x1d')]({'lastMsgAt':_0x2c2f23[_0x0605('0x1e')],'lastMsgDirection':_0x2c2f23[_0x0605('0x13')][_0x0605('0x14')]()});}})[_0x0605('0x1f')](function(_0x22e20e){console['error'](_0x22e20e);});}_0x141a4f();}},'charset':_0x0605('0x20'),'collate':_0x0605('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 84a9f67..b370153 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 _0xf4f4=['message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x129c31,_0x24c7f0){var _0x4256a8=function(_0x961328){while(--_0x961328){_0x129c31['push'](_0x129c31['shift']());}};_0x4256a8(++_0x24c7f0);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x22c17b,_0x4a7845){_0x22c17b=_0x22c17b-0x0;var _0x45f5bd=_0xf4f4[_0x22c17b];return _0x45f5bd;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});config[_0x4f4f('0xb')]=_[_0x4f4f('0xc')](config[_0x4f4f('0xb')],{'host':_0x4f4f('0xd'),'port':0x18eb});var socket=require(_0x4f4f('0xe'))(new Redis(config['redis']));require(_0x4f4f('0xf'))[_0x4f4f('0x10')](socket);function respondWithRpcPromise(_0x39e36b,_0x2d86d1,_0x116f22){return new BPromise(function(_0x11940f,_0x87a9a2){return client[_0x4f4f('0x11')](_0x39e36b,_0x116f22)['then'](function(_0x5956c6){logger[_0x4f4f('0x12')](_0x4f4f('0x13'),_0x2d86d1,_0x4f4f('0x14'));logger[_0x4f4f('0x15')](_0x4f4f('0x16'),_0x2d86d1,_0x4f4f('0x14'),JSON['stringify'](_0x5956c6));if(_0x5956c6[_0x4f4f('0x17')]){if(_0x5956c6['error'][_0x4f4f('0x18')]===0x1f4){logger[_0x4f4f('0x17')](_0x4f4f('0x13'),_0x2d86d1,_0x5956c6[_0x4f4f('0x17')]['message']);return _0x87a9a2(_0x5956c6[_0x4f4f('0x17')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2d86d1,_0x5956c6[_0x4f4f('0x17')][_0x4f4f('0x19')]);return _0x11940f(_0x5956c6[_0x4f4f('0x17')][_0x4f4f('0x19')]);}else{logger[_0x4f4f('0x12')](_0x4f4f('0x13'),_0x2d86d1,_0x4f4f('0x14'));_0x11940f(_0x5956c6[_0x4f4f('0x1a')][_0x4f4f('0x19')]);}})[_0x4f4f('0x1b')](function(_0x32b549){logger[_0x4f4f('0x17')]('MailMessage,\x20%s,\x20%s',_0x2d86d1,_0x32b549);_0x87a9a2(_0x32b549);});});}exports[_0x4f4f('0x1c')]=function(_0x4622c2){var _0x2f84e5=this;return new Promise(function(_0x201c60,_0x302a79){return db[_0x4f4f('0x1d')][_0x4f4f('0x1e')](_0x4622c2[_0x4f4f('0x1f')],{'raw':_0x4622c2[_0x4f4f('0x20')]?_0x4622c2[_0x4f4f('0x20')][_0x4f4f('0x21')]===undefined?!![]:![]:!![]})[_0x4f4f('0x22')](function(_0x17984d){logger[_0x4f4f('0x12')]('CreateMailMessage',_0x4622c2);logger['debug']('CreateMailMessage',_0x4622c2,JSON[_0x4f4f('0x23')](_0x17984d));_0x201c60(_0x17984d);})[_0x4f4f('0x1b')](function(_0x5186ac){logger[_0x4f4f('0x17')](_0x4f4f('0x1c'),_0x5186ac[_0x4f4f('0x19')],_0x4622c2);_0x302a79(_0x2f84e5[_0x4f4f('0x17')](0x1f4,_0x5186ac[_0x4f4f('0x19')]));});});}; \ No newline at end of file +var _0x0abf=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x4ccf7f,_0x161ffd){var _0x1953f0=function(_0xfd2ca6){while(--_0xfd2ca6){_0x4ccf7f['push'](_0x4ccf7f['shift']());}};_0x1953f0(++_0x161ffd);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});config[_0xf0ab('0xa')]=_['defaults'](config[_0xf0ab('0xa')],{'host':_0xf0ab('0xb'),'port':0x18eb});var socket=require(_0xf0ab('0xc'))(new Redis(config[_0xf0ab('0xa')]));require('./mailMessage.socket')[_0xf0ab('0xd')](socket);function respondWithRpcPromise(_0x4688d8,_0x1e7887,_0x4ab8e7){return new BPromise(function(_0x5d25a0,_0x30042c){return client['request'](_0x4688d8,_0x4ab8e7)[_0xf0ab('0xe')](function(_0x10a5a2){logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));logger[_0xf0ab('0x12')](_0xf0ab('0x13'),_0x1e7887,'request\x20sent',JSON[_0xf0ab('0x14')](_0x10a5a2));if(_0x10a5a2[_0xf0ab('0x15')]){if(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x16')]===0x1f4){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x30042c(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);}logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x5d25a0(_0x10a5a2[_0xf0ab('0x15')]['message']);}else{logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));_0x5d25a0(_0x10a5a2[_0xf0ab('0x18')][_0xf0ab('0x17')]);}})[_0xf0ab('0x19')](function(_0x3a0edf){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x3a0edf);_0x30042c(_0x3a0edf);});});}exports[_0xf0ab('0x1a')]=function(_0x715579){var _0xdfcfb2=this;return new Promise(function(_0xf43bc4,_0x22a205){return db[_0xf0ab('0x1b')][_0xf0ab('0x1c')](_0x715579['body'],{'raw':_0x715579[_0xf0ab('0x1d')]?_0x715579[_0xf0ab('0x1d')][_0xf0ab('0x1e')]===undefined?!![]:![]:!![]})[_0xf0ab('0xe')](function(_0x3bf6a1){logger[_0xf0ab('0xf')](_0xf0ab('0x1a'),_0x715579);logger[_0xf0ab('0x12')](_0xf0ab('0x1a'),_0x715579,JSON[_0xf0ab('0x14')](_0x3bf6a1));_0xf43bc4(_0x3bf6a1);})[_0xf0ab('0x19')](function(_0x5645b2){logger['error']('CreateMailMessage',_0x5645b2[_0xf0ab('0x17')],_0x715579);_0x22a205(_0xdfcfb2['error'](0x1f4,_0x5645b2[_0xf0ab('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index af98eb9..3069a10 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 _0x1427=['register','length','mailMessage:','save','remove','update','emit','removeListener'];(function(_0x158b75,_0x50b360){var _0x13c3c8=function(_0x3cc5ab){while(--_0x3cc5ab){_0x158b75['push'](_0x158b75['shift']());}};_0x13c3c8(++_0x50b360);}(_0x1427,0x7b));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x7142('0x0'),_0x7142('0x1'),_0x7142('0x2')];function createListener(_0xa26a2b,_0x5b94a6){return function(_0x5b3387){_0x5b94a6[_0x7142('0x3')](_0xa26a2b,_0x5b3387);};}function removeListener(_0x5a9c4a,_0x1b00b6){return function(){MailMessageEvents[_0x7142('0x4')](_0x5a9c4a,_0x1b00b6);};}exports[_0x7142('0x5')]=function(_0x3a225d){for(var _0x28a8cd=0x0,_0x1885f8=events[_0x7142('0x6')];_0x28a8cd<_0x1885f8;_0x28a8cd++){var _0x23b83b=events[_0x28a8cd];var _0x2dbbf5=createListener(_0x7142('0x7')+_0x23b83b,_0x3a225d);MailMessageEvents['on'](_0x23b83b,_0x2dbbf5);}}; \ No newline at end of file +var _0xf3dc=['mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x2efcbf,_0x43d254){var _0xf2ad5d=function(_0x170730){while(--_0x170730){_0x2efcbf['push'](_0x2efcbf['shift']());}};_0xf2ad5d(++_0x43d254);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x45bd84,_0x4a61bb){_0x45bd84=_0x45bd84-0x0;var _0x551b62=_0xf3dc[_0x45bd84];return _0x551b62;};'use strict';var MailMessageEvents=require(_0xcf3d('0x0'));var events=[_0xcf3d('0x1'),_0xcf3d('0x2'),'update'];function createListener(_0x44bb46,_0x1b869b){return function(_0x42319d){_0x1b869b[_0xcf3d('0x3')](_0x44bb46,_0x42319d);};}function removeListener(_0x17b83e,_0x44b3da){return function(){MailMessageEvents['removeListener'](_0x17b83e,_0x44b3da);};}exports['register']=function(_0x55074b){for(var _0x5b1441=0x0,_0x4e3427=events['length'];_0x5b1441<_0x4e3427;_0x5b1441++){var _0x1a69de=events[_0x5b1441];var _0x10d808=createListener(_0xcf3d('0x4')+_0x1a69de,_0x55074b);MailMessageEvents['on'](_0x1a69de,_0x10d808);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8a15f99..1907311 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 _0xcffa=['/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','/:id/teams','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x1ea230,_0x4258d6){var _0xdd7f44=function(_0x4fca65){while(--_0x4fca65){_0x1ea230['push'](_0x1ea230['shift']());}};_0xdd7f44(++_0x4258d6);}(_0xcffa,0x145));var _0xacff=function(_0x327c41,_0x53554f){_0x327c41=_0x327c41-0x0;var _0x39c899=_0xcffa[_0x327c41];return _0x39c899;};'use strict';var multer=require(_0xacff('0x0'));var util=require(_0xacff('0x1'));var path=require(_0xacff('0x2'));var timeout=require(_0xacff('0x3'));var express=require('express');var router=express[_0xacff('0x4')]();var fs_extra=require(_0xacff('0x5'));var auth=require(_0xacff('0x6'));var interaction=require(_0xacff('0x7'));var config=require(_0xacff('0x8'));var controller=require(_0xacff('0x9'));router[_0xacff('0xa')]('/',auth[_0xacff('0xb')](),controller[_0xacff('0xc')]);router[_0xacff('0xa')](_0xacff('0xd'),auth[_0xacff('0xb')](),controller[_0xacff('0xe')]);router[_0xacff('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xacff('0xf')]);router['get'](_0xacff('0x10'),auth[_0xacff('0xb')](),controller[_0xacff('0x11')]);router[_0xacff('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xacff('0x12')]);router[_0xacff('0xa')](_0xacff('0x13'),auth[_0xacff('0xb')](),controller[_0xacff('0x14')]);router[_0xacff('0x15')]('/',auth[_0xacff('0xb')](),controller[_0xacff('0x16')]);router['post']('/:id/teams',auth[_0xacff('0xb')](),controller[_0xacff('0x17')]);router[_0xacff('0x15')](_0xacff('0x13'),auth[_0xacff('0xb')](),controller[_0xacff('0x18')]);router['put'](_0xacff('0x19'),auth[_0xacff('0xb')](),controller[_0xacff('0x1a')]);router[_0xacff('0x1b')](_0xacff('0x19'),auth[_0xacff('0xb')](),controller[_0xacff('0x1c')]);router[_0xacff('0x1b')](_0xacff('0x1d'),auth[_0xacff('0xb')](),controller[_0xacff('0x1e')]);router['delete'](_0xacff('0x13'),auth[_0xacff('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6255=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x6255,0x133));var _0x5625=function(_0xae0c01,_0x449c99){_0xae0c01=_0xae0c01-0x0;var _0x913e86=_0x6255[_0xae0c01];return _0x913e86;};'use strict';var multer=require(_0x5625('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5625('0x1')]();var fs_extra=require(_0x5625('0x2'));var auth=require(_0x5625('0x3'));var interaction=require(_0x5625('0x4'));var config=require(_0x5625('0x5'));var controller=require(_0x5625('0x6'));router['get']('/',auth[_0x5625('0x7')](),controller[_0x5625('0x8')]);router[_0x5625('0x9')]('/describe',auth[_0x5625('0x7')](),controller[_0x5625('0xa')]);router[_0x5625('0x9')](_0x5625('0xb'),auth[_0x5625('0x7')](),controller['show']);router[_0x5625('0x9')](_0x5625('0xc'),auth[_0x5625('0x7')](),controller[_0x5625('0xd')]);router[_0x5625('0x9')]('/:id/teams',auth[_0x5625('0x7')](),controller[_0x5625('0xe')]);router['get'](_0x5625('0xf'),auth[_0x5625('0x7')](),controller[_0x5625('0x10')]);router[_0x5625('0x11')]('/',auth[_0x5625('0x7')](),controller[_0x5625('0x12')]);router[_0x5625('0x11')](_0x5625('0x13'),auth[_0x5625('0x7')](),controller[_0x5625('0x14')]);router['post']('/:id/users',auth[_0x5625('0x7')](),controller[_0x5625('0x15')]);router[_0x5625('0x16')](_0x5625('0xb'),auth[_0x5625('0x7')](),controller[_0x5625('0x17')]);router[_0x5625('0x18')](_0x5625('0xb'),auth[_0x5625('0x7')](),controller['destroy']);router[_0x5625('0x18')]('/:id/teams',auth[_0x5625('0x7')](),controller[_0x5625('0x19')]);router[_0x5625('0x18')](_0x5625('0xf'),auth[_0x5625('0x7')](),controller[_0x5625('0x1a')]);module[_0x5625('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b3f207f..58f931b 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 _0x53bd=['beepall','sequelize','exports','STRING','name'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x53bd,0x11e));var _0xd53b=function(_0x366bfa,_0x4a1061){_0x366bfa=_0x366bfa-0x0;var _0x26ba7b=_0x53bd[_0x366bfa];return _0x26ba7b;};'use strict';var Sequelize=require(_0xd53b('0x0'));module[_0xd53b('0x1')]={'name':{'type':Sequelize[_0xd53b('0x2')],'unique':_0xd53b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd53b('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x1f24=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0xec5c65,_0x2b5eb5){var _0x46a155=function(_0x3b7001){while(--_0x3b7001){_0xec5c65['push'](_0xec5c65['shift']());}};_0x46a155(++_0x2b5eb5);}(_0x1f24,0x1bf));var _0x41f2=function(_0x4aa2be,_0xc5569f){_0x4aa2be=_0x4aa2be-0x0;var _0x2eff83=_0x1f24[_0x4aa2be];return _0x2eff83;};'use strict';var Sequelize=require(_0x41f2('0x0'));module[_0x41f2('0x1')]={'name':{'type':Sequelize[_0x41f2('0x2')],'unique':_0x41f2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x41f2('0x2')]},'timeout':{'type':Sequelize[_0x41f2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x41f2('0x5'),_0x41f2('0x6'),_0x41f2('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7b29a2e..9d60a90 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 _0x9f9f=['api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./mailQueue.socket','register','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','MailQueues','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','MailQueueId','filter','UserMailQueue','User','findAndCountAll','agent','updatedAt','createdAt','format','SIP','mailPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','QueryTypes','all','union','compact','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x9f9f,0x100));var _0xf9f9=function(_0xa5bc6f,_0x54c809){_0xa5bc6f=_0xa5bc6f-0x0;var _0x558700=_0x9f9f[_0xa5bc6f];return _0x558700;};'use strict';var emlformat=require(_0xf9f9('0x0'));var rimraf=require(_0xf9f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9f9('0x2'));var rp=require(_0xf9f9('0x3'));var moment=require(_0xf9f9('0x4'));var BPromise=require(_0xf9f9('0x5'));var Mustache=require(_0xf9f9('0x6'));var util=require(_0xf9f9('0x7'));var path=require(_0xf9f9('0x8'));var sox=require(_0xf9f9('0x9'));var csv=require(_0xf9f9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf9f9('0xb'));var _=require(_0xf9f9('0xc'));var squel=require('squel');var crypto=require(_0xf9f9('0xd'));var jsforce=require(_0xf9f9('0xe'));var deskjs=require(_0xf9f9('0xf'));var toCsv=require(_0xf9f9('0xa'));var querystring=require('querystring');var Papa=require(_0xf9f9('0x10'));var Redis=require(_0xf9f9('0x11'));var authService=require(_0xf9f9('0x12'));var qs=require(_0xf9f9('0x13'));var as=require(_0xf9f9('0x14'));var hardwareService=require(_0xf9f9('0x15'));var logger=require('../../config/logger')(_0xf9f9('0x16'));var utils=require('../../config/utils');var config=require(_0xf9f9('0x17'));var licenseUtil=require(_0xf9f9('0x18'));var db=require(_0xf9f9('0x19'))['db'];config['redis']=_[_0xf9f9('0x1a')](config['redis'],{'host':_0xf9f9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9f9('0x1c')]));require(_0xf9f9('0x1d'))[_0xf9f9('0x1e')](socket);function respondWithStatusCode(_0x2b727c,_0x307476){_0x307476=_0x307476||0xcc;return function(_0x55a8c8){if(_0x55a8c8){return _0x2b727c['sendStatus'](_0x307476);}return _0x2b727c[_0xf9f9('0x1f')](_0x307476)[_0xf9f9('0x20')]();};}function respondWithResult(_0x341d33,_0x248a9a){_0x248a9a=_0x248a9a||0xc8;return function(_0x285b43){if(_0x285b43){return _0x341d33['status'](_0x248a9a)['json'](_0x285b43);}};}function respondWithFilteredResult(_0x20f9bd,_0x217323){return function(_0x40f305){if(_0x40f305){var _0x2550c8=typeof _0x217323[_0xf9f9('0x21')]===_0xf9f9('0x22')&&typeof _0x217323[_0xf9f9('0x23')]===_0xf9f9('0x22');var _0x234e31=_0x40f305['count'];var _0x446184=_0x2550c8?0x0:_0x217323['offset'];var _0x52c65c=_0x2550c8?_0x40f305[_0xf9f9('0x24')]:_0x217323[_0xf9f9('0x21')]+_0x217323[_0xf9f9('0x23')];var _0x2b909e;if(_0x52c65c>=_0x234e31){_0x52c65c=_0x234e31;_0x2b909e=0xc8;}else{_0x2b909e=0xce;}_0x20f9bd['status'](_0x2b909e);return _0x20f9bd['set'](_0xf9f9('0x25'),_0x446184+'-'+_0x52c65c+'/'+_0x234e31)[_0xf9f9('0x26')](_0x40f305);}return null;};}function patchUpdates(_0xbc192a){return function(_0x925b8f){try{jsonpatch[_0xf9f9('0x27')](_0x925b8f,_0xbc192a,!![]);}catch(_0x2bfc27){return BPromise[_0xf9f9('0x28')](_0x2bfc27);}return _0x925b8f['save']();};}function saveUpdates(_0x180b7d,_0xdb2008){return function(_0x43651a){if(_0x43651a){return _0x43651a[_0xf9f9('0x29')](_0x180b7d)[_0xf9f9('0x2a')](function(_0x2946b6){return _0x2946b6;});}return null;};}function removeEntity(_0x25958e,_0x2042c5){return function(_0x326af3){if(_0x326af3){return _0x326af3[_0xf9f9('0x2b')]()[_0xf9f9('0x2a')](function(){var _0x2d3ba7=_0x326af3['get']({'plain':!![]});var _0x5d31b1=_0xf9f9('0x2c');return db['UserProfileResource'][_0xf9f9('0x2b')]({'where':{'type':_0x5d31b1,'resourceId':_0x2d3ba7['id']}})[_0xf9f9('0x2a')](function(){return _0x326af3;});})['then'](function(){_0x25958e['status'](0xcc)[_0xf9f9('0x20')]();});}};}function handleEntityNotFound(_0x3bb76d,_0x4ce389){return function(_0x4e9fcb){if(!_0x4e9fcb){_0x3bb76d[_0xf9f9('0x2d')](0x194);}return _0x4e9fcb;};}function handleError(_0x183299,_0x49586b){_0x49586b=_0x49586b||0x1f4;return function(_0x790959){logger[_0xf9f9('0x2e')](_0x790959[_0xf9f9('0x2f')]);if(_0x790959[_0xf9f9('0x30')]){delete _0x790959[_0xf9f9('0x30')];}_0x183299[_0xf9f9('0x1f')](_0x49586b)[_0xf9f9('0x31')](_0x790959);};}exports[_0xf9f9('0x32')]=function(_0x65ab21,_0x5c2c49){var _0x152ef1={},_0xe67f0={},_0x24cf6b={'count':0x0,'rows':[]};var _0x568a63=_[_0xf9f9('0x33')](db['MailQueue'][_0xf9f9('0x34')],function(_0x374655){return{'name':_0x374655[_0xf9f9('0x35')],'type':_0x374655['type']['key']};});_0xe67f0['model']=_[_0xf9f9('0x33')](_0x568a63,_0xf9f9('0x30'));_0xe67f0[_0xf9f9('0x36')]=_[_0xf9f9('0x37')](_0x65ab21[_0xf9f9('0x36')]);_0xe67f0[_0xf9f9('0x38')]=_[_0xf9f9('0x39')](_0xe67f0[_0xf9f9('0x3a')],_0xe67f0['query']);_0x152ef1[_0xf9f9('0x3b')]=_['intersection'](_0xe67f0[_0xf9f9('0x3a')],qs[_0xf9f9('0x3c')](_0x65ab21['query']['fields']));_0x152ef1[_0xf9f9('0x3b')]=_0x152ef1[_0xf9f9('0x3b')][_0xf9f9('0x3d')]?_0x152ef1[_0xf9f9('0x3b')]:_0xe67f0[_0xf9f9('0x3a')];if(!_0x65ab21[_0xf9f9('0x36')][_0xf9f9('0x3e')]('nolimit')){_0x152ef1[_0xf9f9('0x23')]=qs[_0xf9f9('0x23')](_0x65ab21['query'][_0xf9f9('0x23')]);_0x152ef1[_0xf9f9('0x21')]=qs[_0xf9f9('0x21')](_0x65ab21['query'][_0xf9f9('0x21')]);}_0x152ef1[_0xf9f9('0x3f')]=qs['sort'](_0x65ab21['query'][_0xf9f9('0x40')]);_0x152ef1[_0xf9f9('0x41')]=qs[_0xf9f9('0x38')](_[_0xf9f9('0x42')](_0x65ab21[_0xf9f9('0x36')],_0xe67f0[_0xf9f9('0x38')]),_0x568a63);if(_0x65ab21[_0xf9f9('0x36')]['filter']){_0x152ef1[_0xf9f9('0x41')]=_[_0xf9f9('0x43')](_0x152ef1[_0xf9f9('0x41')],{'$or':_['map'](_0x568a63,function(_0x2cee84){if(_0x2cee84['type']!==_0xf9f9('0x44')){var _0x46b1a4={};_0x46b1a4[_0x2cee84[_0xf9f9('0x30')]]={'$like':'%'+_0x65ab21[_0xf9f9('0x36')]['filter']+'%'};return _0x46b1a4;}})});}_0x152ef1=_['merge']({},_0x152ef1,_0x65ab21[_0xf9f9('0x45')]);var _0x40f7e9={'where':_0x152ef1[_0xf9f9('0x41')]};return db[_0xf9f9('0x46')][_0xf9f9('0x24')](_0x40f7e9)['then'](function(_0x40bb57){_0x24cf6b['count']=_0x40bb57;if(_0x65ab21[_0xf9f9('0x36')][_0xf9f9('0x47')]){_0x152ef1[_0xf9f9('0x48')]=[{'all':!![]}];}return db[_0xf9f9('0x46')][_0xf9f9('0x49')](_0x152ef1);})[_0xf9f9('0x2a')](function(_0x54bd6c){_0x24cf6b[_0xf9f9('0x4a')]=_0x54bd6c;return _0x24cf6b;})[_0xf9f9('0x2a')](respondWithFilteredResult(_0x5c2c49,_0x152ef1))['catch'](handleError(_0x5c2c49,null));};exports[_0xf9f9('0x4b')]=function(_0x2ab391,_0x11a840){var _0x8c4bbd={'raw':!![],'where':{'id':_0x2ab391[_0xf9f9('0x4c')]['id']}},_0xad69a4={};_0xad69a4[_0xf9f9('0x3a')]=_['keys'](db[_0xf9f9('0x46')][_0xf9f9('0x34')]);_0xad69a4[_0xf9f9('0x36')]=_[_0xf9f9('0x37')](_0x2ab391['query']);_0xad69a4[_0xf9f9('0x38')]=_[_0xf9f9('0x39')](_0xad69a4[_0xf9f9('0x3a')],_0xad69a4[_0xf9f9('0x36')]);_0x8c4bbd['attributes']=_[_0xf9f9('0x39')](_0xad69a4[_0xf9f9('0x3a')],qs[_0xf9f9('0x3c')](_0x2ab391['query']['fields']));_0x8c4bbd[_0xf9f9('0x3b')]=_0x8c4bbd[_0xf9f9('0x3b')][_0xf9f9('0x3d')]?_0x8c4bbd['attributes']:_0xad69a4[_0xf9f9('0x3a')];if(_0x2ab391[_0xf9f9('0x36')][_0xf9f9('0x47')]){_0x8c4bbd[_0xf9f9('0x48')]=[{'all':!![]}];}_0x8c4bbd=_[_0xf9f9('0x43')]({},_0x8c4bbd,_0x2ab391[_0xf9f9('0x45')]);return db[_0xf9f9('0x46')][_0xf9f9('0x4d')](_0x8c4bbd)[_0xf9f9('0x2a')](handleEntityNotFound(_0x11a840,null))[_0xf9f9('0x2a')](respondWithResult(_0x11a840,null))[_0xf9f9('0x4e')](handleError(_0x11a840,null));};exports['create']=function(_0x55f520,_0x68d1dd){return db['MailQueue'][_0xf9f9('0x4f')](_0x55f520[_0xf9f9('0x50')],{})[_0xf9f9('0x2a')](function(_0x286177){var _0x483b3e=_0x55f520[_0xf9f9('0x51')][_0xf9f9('0x52')]({'plain':!![]});if(!_0x483b3e)throw new Error(_0xf9f9('0x53'));if(_0x483b3e['role']==='user'){var _0x44932e=_0x286177['get']({'plain':!![]});var _0x34837b='MailQueues';return db[_0xf9f9('0x54')][_0xf9f9('0x4d')]({'where':{'name':_0x34837b,'userProfileId':_0x483b3e['userProfileId']},'raw':!![]})[_0xf9f9('0x2a')](function(_0x364c5f){if(_0x364c5f&&_0x364c5f['autoAssociation']===0x0){return db[_0xf9f9('0x55')][_0xf9f9('0x4f')]({'name':_0x44932e['name'],'resourceId':_0x44932e['id'],'type':_0x364c5f['name'],'sectionId':_0x364c5f['id']},{})['then'](function(){return _0x286177;});}else{return _0x286177;}})[_0xf9f9('0x4e')](function(_0x294b08){logger['error'](_0xf9f9('0x56'),_0x294b08);throw _0x294b08;});}return _0x286177;})['then'](respondWithResult(_0x68d1dd,0xc9))[_0xf9f9('0x4e')](handleError(_0x68d1dd,null));};exports['update']=function(_0x176aef,_0x5eb33d){if(_0x176aef[_0xf9f9('0x50')]['id']){delete _0x176aef['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x176aef[_0xf9f9('0x4c')]['id']}})[_0xf9f9('0x2a')](handleEntityNotFound(_0x5eb33d,null))['then'](saveUpdates(_0x176aef[_0xf9f9('0x50')],null))[_0xf9f9('0x2a')](respondWithResult(_0x5eb33d,null))[_0xf9f9('0x4e')](handleError(_0x5eb33d,null));};exports['destroy']=function(_0x4154e7,_0x2174c2){return db['MailQueue'][_0xf9f9('0x4d')]({'where':{'id':_0x4154e7[_0xf9f9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2174c2,null))['then'](removeEntity(_0x2174c2,null))[_0xf9f9('0x4e')](handleError(_0x2174c2,null));};exports[_0xf9f9('0x57')]=function(_0x11dcf0,_0x4e681a){return db[_0xf9f9('0x46')][_0xf9f9('0x57')]()[_0xf9f9('0x2a')](respondWithResult(_0x4e681a,null))[_0xf9f9('0x4e')](handleError(_0x4e681a,null));};exports[_0xf9f9('0x58')]=function(_0x1b9466,_0x684824,_0x36c70f){var _0x51deaa={'raw':!![],'where':{}},_0x4eb078={},_0x3ef7c3;return db[_0xf9f9('0x46')][_0xf9f9('0x59')]({'where':{'id':_0x1b9466[_0xf9f9('0x4c')]['id']}})[_0xf9f9('0x2a')](handleEntityNotFound(_0x684824,null))[_0xf9f9('0x2a')](function(_0x1390bb){if(_0x1390bb){_0x3ef7c3=_0x1390bb['get']({'plain':!![]});_0x4eb078['model']=_['keys'](db['UserMailQueue'][_0xf9f9('0x34')]);_0x4eb078[_0xf9f9('0x36')]=_[_0xf9f9('0x37')](_0x1b9466[_0xf9f9('0x36')]);_0x4eb078['filters']=_[_0xf9f9('0x39')](_0x4eb078['model'],_0x4eb078[_0xf9f9('0x36')]);_0x51deaa['attributes']=_[_0xf9f9('0x39')](_0x4eb078[_0xf9f9('0x3a')],qs['fields'](_0x1b9466['query'][_0xf9f9('0x3c')]));_0x51deaa['attributes']=_0x51deaa[_0xf9f9('0x3b')][_0xf9f9('0x3d')]?_0x51deaa[_0xf9f9('0x3b')]:_0x4eb078['model'];if(!_0x1b9466[_0xf9f9('0x36')][_0xf9f9('0x3e')](_0xf9f9('0x5a'))){_0x51deaa['limit']=qs[_0xf9f9('0x23')](_0x1b9466[_0xf9f9('0x36')]['limit']);_0x51deaa[_0xf9f9('0x21')]=qs['offset'](_0x1b9466['query'][_0xf9f9('0x21')]);}_0x51deaa[_0xf9f9('0x3f')]=qs[_0xf9f9('0x40')](_0x1b9466[_0xf9f9('0x36')]['sort']);_0x51deaa[_0xf9f9('0x41')]=qs[_0xf9f9('0x38')](_[_0xf9f9('0x42')](_0x1b9466[_0xf9f9('0x36')],_0x4eb078[_0xf9f9('0x38')]));_0x51deaa['where'][_0xf9f9('0x5b')]=_0x1390bb['id'];if(_0x1b9466[_0xf9f9('0x36')][_0xf9f9('0x5c')]){_0x51deaa[_0xf9f9('0x41')]=_[_0xf9f9('0x43')](_0x51deaa[_0xf9f9('0x41')],{'$or':_['map'](_0x51deaa[_0xf9f9('0x3b')],function(_0x464ec6){var _0x317ee8={};_0x317ee8[_0x464ec6]={'$like':'%'+_0x1b9466[_0xf9f9('0x36')]['filter']+'%'};return _0x317ee8;})});}_0x51deaa=_['merge']({},_0x51deaa,_0x1b9466[_0xf9f9('0x45')]);return db[_0xf9f9('0x5d')][_0xf9f9('0x49')](_0x51deaa);}})[_0xf9f9('0x2a')](function(_0x3d66b7){if(_0x3d66b7){return db[_0xf9f9('0x5e')][_0xf9f9('0x5f')]({'where':{'id':_[_0xf9f9('0x33')](_0x3d66b7,'UserId'),'role':_0xf9f9('0x60')},'attributes':['id',_0xf9f9('0x30'),'mailPause',_0xf9f9('0x61'),_0xf9f9('0x62')]});}})[_0xf9f9('0x2a')](function(_0x5351c1){if(_0x5351c1){return{'count':_0x5351c1[_0xf9f9('0x24')],'rows':_[_0xf9f9('0x33')](_0x5351c1[_0xf9f9('0x4a')],function(_0x33a86b){return{'membername':_0x33a86b[_0xf9f9('0x30')],'UserId':_0x33a86b['id'],'queue_name':_0x3ef7c3[_0xf9f9('0x30')],'MailQueueId':_0x3ef7c3['id'],'interface':util[_0xf9f9('0x63')]('%s/%s',_0xf9f9('0x64'),_0x33a86b[_0xf9f9('0x30')]),'penalty':0x0,'paused':_0x33a86b[_0xf9f9('0x65')],'createdAt':_0x33a86b['createdAt'],'updatedAt':_0x33a86b[_0xf9f9('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf9f9('0x2a')](respondWithFilteredResult(_0x684824,_0x51deaa))[_0xf9f9('0x4e')](handleError(_0x684824,null));};exports['getTeams']=function(_0x21d97b,_0x361b4d,_0x38b3c0){var _0x32082f={};var _0x54b586={};var _0x37e423;var _0x521ebb;return db[_0xf9f9('0x46')]['findOne']({'where':{'id':_0x21d97b['params']['id']}})[_0xf9f9('0x2a')](handleEntityNotFound(_0x361b4d,null))['then'](function(_0x238015){if(_0x238015){_0x37e423=_0x238015;_0x54b586['model']=_[_0xf9f9('0x37')](db[_0xf9f9('0x66')][_0xf9f9('0x34')]);_0x54b586[_0xf9f9('0x36')]=_[_0xf9f9('0x37')](_0x21d97b[_0xf9f9('0x36')]);_0x54b586['filters']=_[_0xf9f9('0x39')](_0x54b586[_0xf9f9('0x3a')],_0x54b586[_0xf9f9('0x36')]);_0x32082f[_0xf9f9('0x3b')]=_['intersection'](_0x54b586[_0xf9f9('0x3a')],qs[_0xf9f9('0x3c')](_0x21d97b[_0xf9f9('0x36')][_0xf9f9('0x3c')]));_0x32082f[_0xf9f9('0x3b')]=_0x32082f[_0xf9f9('0x3b')][_0xf9f9('0x3d')]?_0x32082f['attributes']:_0x54b586[_0xf9f9('0x3a')];_0x32082f[_0xf9f9('0x3f')]=qs[_0xf9f9('0x40')](_0x21d97b[_0xf9f9('0x36')][_0xf9f9('0x40')]);_0x32082f[_0xf9f9('0x41')]=qs[_0xf9f9('0x38')](_['pick'](_0x21d97b[_0xf9f9('0x36')],_0x54b586['filters']));if(_0x21d97b[_0xf9f9('0x36')]['filter']){_0x32082f[_0xf9f9('0x41')]=_[_0xf9f9('0x43')](_0x32082f[_0xf9f9('0x41')],{'$or':_[_0xf9f9('0x33')](_0x32082f[_0xf9f9('0x3b')],function(_0x416781){var _0x15713f={};_0x15713f[_0x416781]={'$like':'%'+_0x21d97b[_0xf9f9('0x36')][_0xf9f9('0x5c')]+'%'};return _0x15713f;})});}_0x32082f=_[_0xf9f9('0x43')]({},_0x32082f,_0x21d97b[_0xf9f9('0x45')]);return _0x37e423['getTeams'](_0x32082f);}})[_0xf9f9('0x2a')](function(_0xa7b30a){if(_0xa7b30a){_0x521ebb=_0xa7b30a[_0xf9f9('0x3d')];if(!_0x21d97b[_0xf9f9('0x36')][_0xf9f9('0x3e')](_0xf9f9('0x5a'))){_0x32082f['limit']=qs[_0xf9f9('0x23')](_0x21d97b[_0xf9f9('0x36')]['limit']);_0x32082f['offset']=qs[_0xf9f9('0x21')](_0x21d97b[_0xf9f9('0x36')][_0xf9f9('0x21')]);}return _0x37e423[_0xf9f9('0x67')](_0x32082f);}})[_0xf9f9('0x2a')](function(_0x9cbc79){if(_0x9cbc79){return _0x9cbc79?{'count':_0x521ebb,'rows':_0x9cbc79}:null;}})['then'](respondWithResult(_0x361b4d,null))[_0xf9f9('0x4e')](handleError(_0x361b4d,null));};exports[_0xf9f9('0x68')]=function(_0x31d269,_0x5055cf,_0x1ad025){var _0x22e611=_0x31d269['body'][_0xf9f9('0x69')];return db[_0xf9f9('0x66')][_0xf9f9('0x49')]({'where':{'id':_0x22e611},'attributes':['id'],'include':[{'model':db[_0xf9f9('0x5e')],'as':_0xf9f9('0x6a'),'attributes':['id',_0xf9f9('0x30'),_0xf9f9('0x6b'),_0xf9f9('0x6c'),_0xf9f9('0x6d')],'raw':!![]}]})[_0xf9f9('0x2a')](function(_0x31cf2b){if(_0x31cf2b){var _0x3abe25=_['flatMap'](_0x31cf2b,function(_0x2b1ff5){var _0x15d700=_0x2b1ff5['get']({'plain':!![]});return _0x15d700[_0xf9f9('0x6a')];});return db['MailQueue'][_0xf9f9('0x4d')]({'where':{'id':_0x31d269[_0xf9f9('0x4c')]['id']}})['then'](function(_0x270105){return db[_0xf9f9('0x6e')][_0xf9f9('0x6f')](function(_0x5066ba){return _0x270105['addTeams'](_0x22e611,{'transaction':_0x5066ba})[_0xf9f9('0x2a')](function(){return BPromise[_0xf9f9('0x70')](_0x3abe25,function(_0x48d9cc){return db['UserMailQueue'][_0xf9f9('0x71')]({'where':{'UserId':_0x48d9cc['id'],'MailQueueId':_0x31d269[_0xf9f9('0x4c')]['id']},'transaction':_0x5066ba});});})[_0xf9f9('0x2a')](function(){_0x3abe25['forEach'](function(_0x4b6283){socket[_0xf9f9('0x72')](_0xf9f9('0x73'),{'UserId':_0x4b6283['id'],'MailQueueId':_0x270105['id']});});});});});}})[_0xf9f9('0x2a')](respondWithStatusCode(_0x5055cf,null))[_0xf9f9('0x4e')](handleError(_0x5055cf,null));};exports['removeTeams']=function(_0x335dfc,_0x53b413,_0x2daa87){return db['Team'][_0xf9f9('0x49')]({'where':{'id':_0x335dfc[_0xf9f9('0x36')][_0xf9f9('0x69')]},'attributes':['id'],'include':[{'model':db[_0xf9f9('0x5e')],'as':_0xf9f9('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x53b413,null))[_0xf9f9('0x2a')](function(_0x4d61c2){var _0x126ad5=_['map'](_0x4d61c2,'id');var _0x1c4525=[];var _0x40bbec=[];var _0x13ea32=squel[_0xf9f9('0x74')]();_0x13ea32[_0xf9f9('0x75')](_0xf9f9('0x76'))[_0xf9f9('0x77')](_0xf9f9('0x78'),'tq')[_0xf9f9('0x79')](_0xf9f9('0x7a'),'ut',_0xf9f9('0x7b'))[_0xf9f9('0x41')](_0xf9f9('0x7c'),_0x335dfc[_0xf9f9('0x4c')]['id']);for(var _0x706009=0x0;_0x706009<_0x4d61c2[_0xf9f9('0x3d')];_0x706009+=0x1){let _0x305a1f=_0x4d61c2[_0x706009];for(var _0x561397=0x0;_0x561397<_0x305a1f[_0xf9f9('0x6a')][_0xf9f9('0x3d')];_0x561397+=0x1){let _0x26b928=_0x305a1f[_0xf9f9('0x6a')][_0x561397];var _0xe5e3a3=_0x13ea32[_0xf9f9('0x7d')]();_0xe5e3a3['where']('ut.UserId\x20=\x20?',_0x26b928['id']);_0x40bbec['push'](db['sequelize']['query'](_0xe5e3a3['toString'](),{'type':db[_0xf9f9('0x6e')][_0xf9f9('0x7e')]['SELECT']})[_0xf9f9('0x2a')](function(_0x21cd8c){if(_0x21cd8c['length']===0x1){return _0x26b928['id'];}else{var _0x159017=_['every'](_[_0xf9f9('0x33')](_0x21cd8c,'TeamId'),function(_0x417006){return _['includes'](_0x126ad5,_0x417006);});if(_0x159017){return _0x26b928['id'];}}}));}}return BPromise[_0xf9f9('0x7f')](_0x40bbec)['then'](function(_0x304ffc){_0x1c4525=_(_0x1c4525)[_0xf9f9('0x80')](_0x304ffc)[_0xf9f9('0x81')]()['value']();return db[_0xf9f9('0x46')][_0xf9f9('0x4d')]({'where':{'id':_0x335dfc[_0xf9f9('0x4c')]['id']}})['then'](function(_0x45d931){return db['sequelize'][_0xf9f9('0x6f')](function(_0x5f3590){return _0x45d931[_0xf9f9('0x82')](_0x335dfc[_0xf9f9('0x36')]['ids'],{'transaction':_0x5f3590})[_0xf9f9('0x2a')](function(){if(!_[_0xf9f9('0x83')](_0x1c4525)){return _0x45d931[_0xf9f9('0x84')](_0x1c4525,{'transaction':_0x5f3590});}})[_0xf9f9('0x2a')](function(){_0x1c4525[_0xf9f9('0x85')](function(_0x2cce65){socket[_0xf9f9('0x72')](_0xf9f9('0x86'),{'UserId':_0x2cce65,'MailQueueId':_0x45d931['id']});});});});});});})[_0xf9f9('0x2a')](respondWithStatusCode(_0x53b413,null))[_0xf9f9('0x4e')](handleError(_0x53b413,null));};exports['addAgents']=function(_0x58b66f,_0x223f82,_0x3b35b7){return db[_0xf9f9('0x46')][_0xf9f9('0x4d')]({'where':{'id':_0x58b66f[_0xf9f9('0x4c')]['id']}})[_0xf9f9('0x2a')](handleEntityNotFound(_0x223f82,null))[_0xf9f9('0x2a')](function(_0x5b63c9){if(_0x5b63c9){return _0x5b63c9[_0xf9f9('0x87')](_0x58b66f[_0xf9f9('0x50')][_0xf9f9('0x69')],_['omit'](_0x58b66f[_0xf9f9('0x50')],[_0xf9f9('0x69'),'id'])||{})[_0xf9f9('0x88')](function(_0x4a1628){for(var _0x1beefb=0x0;_0x1beefb<_0x58b66f['body'][_0xf9f9('0x69')][_0xf9f9('0x3d')];_0x1beefb+=0x1){socket[_0xf9f9('0x72')](_0xf9f9('0x73'),{'UserId':Number(_0x58b66f[_0xf9f9('0x50')][_0xf9f9('0x69')][_0x1beefb]),'MailQueueId':Number(_0x58b66f[_0xf9f9('0x4c')]['id'])});}return _0x4a1628;});}})[_0xf9f9('0x2a')](respondWithResult(_0x223f82,null))[_0xf9f9('0x4e')](handleError(_0x223f82,null));};exports[_0xf9f9('0x84')]=function(_0x2b0e46,_0x4d04b6,_0x18a67f){return db[_0xf9f9('0x46')][_0xf9f9('0x4d')]({'where':{'id':_0x2b0e46['params']['id']}})[_0xf9f9('0x2a')](handleEntityNotFound(_0x4d04b6,null))['then'](function(_0x5cb8be){if(_0x5cb8be){return _0x5cb8be[_0xf9f9('0x84')](_0x2b0e46['query'][_0xf9f9('0x69')])[_0xf9f9('0x2a')](function(){if(_[_0xf9f9('0x89')](_0x2b0e46[_0xf9f9('0x36')][_0xf9f9('0x69')])){for(var _0x107338=0x0;_0x107338<_0x2b0e46['query'][_0xf9f9('0x69')][_0xf9f9('0x3d')];_0x107338+=0x1){socket[_0xf9f9('0x72')](_0xf9f9('0x86'),{'UserId':Number(_0x2b0e46[_0xf9f9('0x36')][_0xf9f9('0x69')][_0x107338]),'MailQueueId':Number(_0x2b0e46['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x2b0e46[_0xf9f9('0x36')][_0xf9f9('0x69')]),'MailQueueId':Number(_0x2b0e46[_0xf9f9('0x4c')]['id'])});}});}})[_0xf9f9('0x2a')](respondWithStatusCode(_0x4d04b6,null))['catch'](handleError(_0x4d04b6,null));};exports[_0xf9f9('0x8a')]=function(_0x7df36c,_0x386484,_0x34da3c){var _0x4b1b39={};var _0x5fc8c3={};var _0x35167b;var _0x504952;return db[_0xf9f9('0x46')]['findOne']({'where':{'id':_0x7df36c[_0xf9f9('0x4c')]['id']}})[_0xf9f9('0x2a')](handleEntityNotFound(_0x386484,null))[_0xf9f9('0x2a')](function(_0x33c5ab){if(_0x33c5ab){_0x35167b=_0x33c5ab;_0x5fc8c3['model']=_[_0xf9f9('0x37')](db[_0xf9f9('0x5e')][_0xf9f9('0x34')]);_0x5fc8c3[_0xf9f9('0x36')]=_[_0xf9f9('0x37')](_0x7df36c[_0xf9f9('0x36')]);_0x5fc8c3[_0xf9f9('0x38')]=_[_0xf9f9('0x39')](_0x5fc8c3['model'],_0x5fc8c3['query']);_0x4b1b39['attributes']=_[_0xf9f9('0x39')](_0x5fc8c3[_0xf9f9('0x3a')],qs[_0xf9f9('0x3c')](_0x7df36c[_0xf9f9('0x36')][_0xf9f9('0x3c')]));_0x4b1b39[_0xf9f9('0x3b')]=_0x4b1b39[_0xf9f9('0x3b')][_0xf9f9('0x3d')]?_0x4b1b39[_0xf9f9('0x3b')]:_0x5fc8c3['model'];_0x4b1b39['order']=qs[_0xf9f9('0x40')](_0x7df36c['query']['sort']);_0x4b1b39[_0xf9f9('0x41')]=qs[_0xf9f9('0x38')](_['pick'](_0x7df36c['query'],_0x5fc8c3[_0xf9f9('0x38')]));if(_0x7df36c[_0xf9f9('0x36')]['filter']){_0x4b1b39[_0xf9f9('0x41')]=_['merge'](_0x4b1b39[_0xf9f9('0x41')],{'$or':_[_0xf9f9('0x33')](_0x4b1b39[_0xf9f9('0x3b')],function(_0x373b67){var _0x1875ab={};_0x1875ab[_0x373b67]={'$like':'%'+_0x7df36c[_0xf9f9('0x36')][_0xf9f9('0x5c')]+'%'};return _0x1875ab;})});}_0x4b1b39=_[_0xf9f9('0x43')]({},_0x4b1b39,_0x7df36c[_0xf9f9('0x45')]);return _0x35167b['getAgents'](_0x4b1b39);}})[_0xf9f9('0x2a')](function(_0x3b3774){if(_0x3b3774){_0x504952=_0x3b3774['length'];if(!_0x7df36c['query'][_0xf9f9('0x3e')](_0xf9f9('0x5a'))){_0x4b1b39['limit']=qs[_0xf9f9('0x23')](_0x7df36c[_0xf9f9('0x36')][_0xf9f9('0x23')]);_0x4b1b39[_0xf9f9('0x21')]=qs[_0xf9f9('0x21')](_0x7df36c['query'][_0xf9f9('0x21')]);}return _0x35167b['getAgents'](_0x4b1b39);}})[_0xf9f9('0x2a')](function(_0x2f2ce5){if(_0x2f2ce5){return _0x2f2ce5?{'count':_0x504952,'rows':_0x2f2ce5}:null;}})['then'](respondWithResult(_0x386484,null))[_0xf9f9('0x4e')](handleError(_0x386484,null));}; \ No newline at end of file +var _0xe920=['hasOwnProperty','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','Team','pick','getTeams','addTeams','ids','online','flatMap','get','Agents','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','removeTeams','userMailQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./mailQueue.socket','register','end','status','offset','undefined','limit','set','Content-Range','save','update','then','MailQueues','sendStatus','error','stack','name','send','index','MailQueue','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','count','includeAll','include','catch','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserMailQueue'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe920,0xbe));var _0x0e92=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xe920[_0x523adf];return _0x283870;};'use strict';var emlformat=require(_0x0e92('0x0'));var rimraf=require(_0x0e92('0x1'));var zipdir=require(_0x0e92('0x2'));var jsonpatch=require(_0x0e92('0x3'));var rp=require(_0x0e92('0x4'));var moment=require(_0x0e92('0x5'));var BPromise=require(_0x0e92('0x6'));var Mustache=require(_0x0e92('0x7'));var util=require(_0x0e92('0x8'));var path=require(_0x0e92('0x9'));var sox=require('sox');var csv=require(_0x0e92('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e92('0xb'));var _=require(_0x0e92('0xc'));var squel=require(_0x0e92('0xd'));var crypto=require(_0x0e92('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0e92('0xf'));var toCsv=require(_0x0e92('0xa'));var querystring=require(_0x0e92('0x10'));var Papa=require(_0x0e92('0x11'));var Redis=require(_0x0e92('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e92('0x13'));var logger=require(_0x0e92('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e92('0x15'));var db=require(_0x0e92('0x16'))['db'];config['redis']=_[_0x0e92('0x17')](config[_0x0e92('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e92('0x19'))(new Redis(config[_0x0e92('0x18')]));require(_0x0e92('0x1a'))[_0x0e92('0x1b')](socket);function respondWithStatusCode(_0x218f02,_0x77fab3){_0x77fab3=_0x77fab3||0xcc;return function(_0x44dcd0){if(_0x44dcd0){return _0x218f02['sendStatus'](_0x77fab3);}return _0x218f02['status'](_0x77fab3)[_0x0e92('0x1c')]();};}function respondWithResult(_0x211716,_0x4f1e28){_0x4f1e28=_0x4f1e28||0xc8;return function(_0x4f4c4a){if(_0x4f4c4a){return _0x211716[_0x0e92('0x1d')](_0x4f1e28)['json'](_0x4f4c4a);}};}function respondWithFilteredResult(_0x9ecd13,_0x1b1d08){return function(_0x3316a5){if(_0x3316a5){var _0x46aa84=typeof _0x1b1d08[_0x0e92('0x1e')]===_0x0e92('0x1f')&&typeof _0x1b1d08[_0x0e92('0x20')]==='undefined';var _0x1412ef=_0x3316a5['count'];var _0x475ed2=_0x46aa84?0x0:_0x1b1d08['offset'];var _0x59be04=_0x46aa84?_0x3316a5['count']:_0x1b1d08[_0x0e92('0x1e')]+_0x1b1d08['limit'];var _0x433c05;if(_0x59be04>=_0x1412ef){_0x59be04=_0x1412ef;_0x433c05=0xc8;}else{_0x433c05=0xce;}_0x9ecd13['status'](_0x433c05);return _0x9ecd13[_0x0e92('0x21')](_0x0e92('0x22'),_0x475ed2+'-'+_0x59be04+'/'+_0x1412ef)['json'](_0x3316a5);}return null;};}function patchUpdates(_0x3f2105){return function(_0x475cc2){try{jsonpatch['apply'](_0x475cc2,_0x3f2105,!![]);}catch(_0x3a18e1){return BPromise['reject'](_0x3a18e1);}return _0x475cc2[_0x0e92('0x23')]();};}function saveUpdates(_0x40375c,_0xedeb4e){return function(_0x22c53b){if(_0x22c53b){return _0x22c53b[_0x0e92('0x24')](_0x40375c)[_0x0e92('0x25')](function(_0xc34ae4){return _0xc34ae4;});}return null;};}function removeEntity(_0x42c5bc,_0x32d258){return function(_0x1ea0dc){if(_0x1ea0dc){return _0x1ea0dc['destroy']()[_0x0e92('0x25')](function(){var _0x47f156=_0x1ea0dc['get']({'plain':!![]});var _0x28463d=_0x0e92('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x28463d,'resourceId':_0x47f156['id']}})[_0x0e92('0x25')](function(){return _0x1ea0dc;});})[_0x0e92('0x25')](function(){_0x42c5bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x140666,_0x329c5f){return function(_0xc3d81d){if(!_0xc3d81d){_0x140666[_0x0e92('0x27')](0x194);}return _0xc3d81d;};}function handleError(_0x36538b,_0x10000e){_0x10000e=_0x10000e||0x1f4;return function(_0x3139bf){logger[_0x0e92('0x28')](_0x3139bf[_0x0e92('0x29')]);if(_0x3139bf[_0x0e92('0x2a')]){delete _0x3139bf[_0x0e92('0x2a')];}_0x36538b[_0x0e92('0x1d')](_0x10000e)[_0x0e92('0x2b')](_0x3139bf);};}exports[_0x0e92('0x2c')]=function(_0x4201ab,_0x41d7e5){var _0x3542fa={},_0x1ca84b={},_0x3758f0={'count':0x0,'rows':[]};var _0xe043a5=_['map'](db[_0x0e92('0x2d')][_0x0e92('0x2e')],function(_0x5b5e46){return{'name':_0x5b5e46['fieldName'],'type':_0x5b5e46[_0x0e92('0x2f')][_0x0e92('0x30')]};});_0x1ca84b[_0x0e92('0x31')]=_[_0x0e92('0x32')](_0xe043a5,_0x0e92('0x2a'));_0x1ca84b[_0x0e92('0x33')]=_[_0x0e92('0x34')](_0x4201ab[_0x0e92('0x33')]);_0x1ca84b['filters']=_[_0x0e92('0x35')](_0x1ca84b[_0x0e92('0x31')],_0x1ca84b[_0x0e92('0x33')]);_0x3542fa[_0x0e92('0x36')]=_[_0x0e92('0x35')](_0x1ca84b[_0x0e92('0x31')],qs[_0x0e92('0x37')](_0x4201ab[_0x0e92('0x33')][_0x0e92('0x37')]));_0x3542fa['attributes']=_0x3542fa['attributes'][_0x0e92('0x38')]?_0x3542fa[_0x0e92('0x36')]:_0x1ca84b['model'];if(!_0x4201ab[_0x0e92('0x33')]['hasOwnProperty'](_0x0e92('0x39'))){_0x3542fa['limit']=qs[_0x0e92('0x20')](_0x4201ab['query'][_0x0e92('0x20')]);_0x3542fa[_0x0e92('0x1e')]=qs[_0x0e92('0x1e')](_0x4201ab['query']['offset']);}_0x3542fa[_0x0e92('0x3a')]=qs[_0x0e92('0x3b')](_0x4201ab[_0x0e92('0x33')]['sort']);_0x3542fa[_0x0e92('0x3c')]=qs['filters'](_['pick'](_0x4201ab[_0x0e92('0x33')],_0x1ca84b[_0x0e92('0x3d')]),_0xe043a5);if(_0x4201ab['query'][_0x0e92('0x3e')]){_0x3542fa['where']=_[_0x0e92('0x3f')](_0x3542fa[_0x0e92('0x3c')],{'$or':_['map'](_0xe043a5,function(_0x14b4ae){if(_0x14b4ae['type']!=='VIRTUAL'){var _0x499e6a={};_0x499e6a[_0x14b4ae[_0x0e92('0x2a')]]={'$like':'%'+_0x4201ab[_0x0e92('0x33')][_0x0e92('0x3e')]+'%'};return _0x499e6a;}})});}_0x3542fa=_[_0x0e92('0x3f')]({},_0x3542fa,_0x4201ab['options']);var _0x563a14={'where':_0x3542fa[_0x0e92('0x3c')]};return db[_0x0e92('0x2d')][_0x0e92('0x40')](_0x563a14)[_0x0e92('0x25')](function(_0x4f242d){_0x3758f0[_0x0e92('0x40')]=_0x4f242d;if(_0x4201ab[_0x0e92('0x33')][_0x0e92('0x41')]){_0x3542fa[_0x0e92('0x42')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x3542fa);})[_0x0e92('0x25')](function(_0x2d44f0){_0x3758f0['rows']=_0x2d44f0;return _0x3758f0;})[_0x0e92('0x25')](respondWithFilteredResult(_0x41d7e5,_0x3542fa))[_0x0e92('0x43')](handleError(_0x41d7e5,null));};exports[_0x0e92('0x44')]=function(_0xbc137f,_0x232eb9){var _0x8a5376={'raw':!![],'where':{'id':_0xbc137f[_0x0e92('0x45')]['id']}},_0x4ebd55={};_0x4ebd55[_0x0e92('0x31')]=_[_0x0e92('0x34')](db['MailQueue'][_0x0e92('0x2e')]);_0x4ebd55[_0x0e92('0x33')]=_[_0x0e92('0x34')](_0xbc137f[_0x0e92('0x33')]);_0x4ebd55[_0x0e92('0x3d')]=_[_0x0e92('0x35')](_0x4ebd55[_0x0e92('0x31')],_0x4ebd55[_0x0e92('0x33')]);_0x8a5376[_0x0e92('0x36')]=_['intersection'](_0x4ebd55['model'],qs[_0x0e92('0x37')](_0xbc137f[_0x0e92('0x33')][_0x0e92('0x37')]));_0x8a5376[_0x0e92('0x36')]=_0x8a5376[_0x0e92('0x36')]['length']?_0x8a5376[_0x0e92('0x36')]:_0x4ebd55[_0x0e92('0x31')];if(_0xbc137f['query']['includeAll']){_0x8a5376[_0x0e92('0x42')]=[{'all':!![]}];}_0x8a5376=_['merge']({},_0x8a5376,_0xbc137f[_0x0e92('0x46')]);return db[_0x0e92('0x2d')][_0x0e92('0x47')](_0x8a5376)[_0x0e92('0x25')](handleEntityNotFound(_0x232eb9,null))[_0x0e92('0x25')](respondWithResult(_0x232eb9,null))['catch'](handleError(_0x232eb9,null));};exports[_0x0e92('0x48')]=function(_0xa90e38,_0x1a8578){return db[_0x0e92('0x2d')][_0x0e92('0x48')](_0xa90e38[_0x0e92('0x49')],{})[_0x0e92('0x25')](function(_0x4a71d1){var _0xaa654a=_0xa90e38[_0x0e92('0x4a')]['get']({'plain':!![]});if(!_0xaa654a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaa654a[_0x0e92('0x4b')]==='user'){var _0x3c27f0=_0x4a71d1['get']({'plain':!![]});var _0x30b31d=_0x0e92('0x26');return db[_0x0e92('0x4c')][_0x0e92('0x47')]({'where':{'name':_0x30b31d,'userProfileId':_0xaa654a[_0x0e92('0x4d')]},'raw':!![]})[_0x0e92('0x25')](function(_0x1f593d){if(_0x1f593d&&_0x1f593d[_0x0e92('0x4e')]===0x0){return db[_0x0e92('0x4f')]['create']({'name':_0x3c27f0[_0x0e92('0x2a')],'resourceId':_0x3c27f0['id'],'type':_0x1f593d[_0x0e92('0x2a')],'sectionId':_0x1f593d['id']},{})[_0x0e92('0x25')](function(){return _0x4a71d1;});}else{return _0x4a71d1;}})[_0x0e92('0x43')](function(_0x532e18){logger['error'](_0x0e92('0x50'),_0x532e18);throw _0x532e18;});}return _0x4a71d1;})[_0x0e92('0x25')](respondWithResult(_0x1a8578,0xc9))['catch'](handleError(_0x1a8578,null));};exports[_0x0e92('0x24')]=function(_0x4a696c,_0x3ef78a){if(_0x4a696c[_0x0e92('0x49')]['id']){delete _0x4a696c[_0x0e92('0x49')]['id'];}return db[_0x0e92('0x2d')][_0x0e92('0x47')]({'where':{'id':_0x4a696c[_0x0e92('0x45')]['id']}})[_0x0e92('0x25')](handleEntityNotFound(_0x3ef78a,null))[_0x0e92('0x25')](saveUpdates(_0x4a696c[_0x0e92('0x49')],null))[_0x0e92('0x25')](respondWithResult(_0x3ef78a,null))['catch'](handleError(_0x3ef78a,null));};exports[_0x0e92('0x51')]=function(_0x141057,_0x45fe7e){return db[_0x0e92('0x2d')]['find']({'where':{'id':_0x141057['params']['id']}})['then'](handleEntityNotFound(_0x45fe7e,null))[_0x0e92('0x25')](removeEntity(_0x45fe7e,null))[_0x0e92('0x43')](handleError(_0x45fe7e,null));};exports['describe']=function(_0x41f110,_0x1ec439){return db[_0x0e92('0x2d')][_0x0e92('0x52')]()['then'](respondWithResult(_0x1ec439,null))[_0x0e92('0x43')](handleError(_0x1ec439,null));};exports[_0x0e92('0x53')]=function(_0x10353a,_0x5f1719,_0x7e8f83){var _0x3f3c08={'raw':!![],'where':{}},_0x116b25={},_0x33f00c;return db['MailQueue'][_0x0e92('0x54')]({'where':{'id':_0x10353a[_0x0e92('0x45')]['id']}})[_0x0e92('0x25')](handleEntityNotFound(_0x5f1719,null))[_0x0e92('0x25')](function(_0x1cbabe){if(_0x1cbabe){_0x33f00c=_0x1cbabe['get']({'plain':!![]});_0x116b25['model']=_[_0x0e92('0x34')](db[_0x0e92('0x55')][_0x0e92('0x2e')]);_0x116b25[_0x0e92('0x33')]=_[_0x0e92('0x34')](_0x10353a[_0x0e92('0x33')]);_0x116b25['filters']=_['intersection'](_0x116b25[_0x0e92('0x31')],_0x116b25[_0x0e92('0x33')]);_0x3f3c08['attributes']=_['intersection'](_0x116b25[_0x0e92('0x31')],qs[_0x0e92('0x37')](_0x10353a[_0x0e92('0x33')]['fields']));_0x3f3c08['attributes']=_0x3f3c08[_0x0e92('0x36')][_0x0e92('0x38')]?_0x3f3c08[_0x0e92('0x36')]:_0x116b25[_0x0e92('0x31')];if(!_0x10353a[_0x0e92('0x33')][_0x0e92('0x56')](_0x0e92('0x39'))){_0x3f3c08['limit']=qs[_0x0e92('0x20')](_0x10353a['query'][_0x0e92('0x20')]);_0x3f3c08[_0x0e92('0x1e')]=qs[_0x0e92('0x1e')](_0x10353a['query'][_0x0e92('0x1e')]);}_0x3f3c08['order']=qs[_0x0e92('0x3b')](_0x10353a[_0x0e92('0x33')][_0x0e92('0x3b')]);_0x3f3c08[_0x0e92('0x3c')]=qs['filters'](_['pick'](_0x10353a[_0x0e92('0x33')],_0x116b25['filters']));_0x3f3c08[_0x0e92('0x3c')][_0x0e92('0x57')]=_0x1cbabe['id'];if(_0x10353a['query']['filter']){_0x3f3c08[_0x0e92('0x3c')]=_['merge'](_0x3f3c08[_0x0e92('0x3c')],{'$or':_['map'](_0x3f3c08['attributes'],function(_0x3f6da6){var _0x64f354={};_0x64f354[_0x3f6da6]={'$like':'%'+_0x10353a[_0x0e92('0x33')][_0x0e92('0x3e')]+'%'};return _0x64f354;})});}_0x3f3c08=_[_0x0e92('0x3f')]({},_0x3f3c08,_0x10353a['options']);return db[_0x0e92('0x55')][_0x0e92('0x58')](_0x3f3c08);}})[_0x0e92('0x25')](function(_0xfb3937){if(_0xfb3937){return db[_0x0e92('0x59')][_0x0e92('0x5a')]({'where':{'id':_['map'](_0xfb3937,_0x0e92('0x5b')),'role':_0x0e92('0x5c')},'attributes':['id',_0x0e92('0x2a'),_0x0e92('0x5d'),_0x0e92('0x5e'),_0x0e92('0x5f')]});}})[_0x0e92('0x25')](function(_0x32d965){if(_0x32d965){return{'count':_0x32d965[_0x0e92('0x40')],'rows':_[_0x0e92('0x32')](_0x32d965[_0x0e92('0x60')],function(_0x43c894){return{'membername':_0x43c894[_0x0e92('0x2a')],'UserId':_0x43c894['id'],'queue_name':_0x33f00c[_0x0e92('0x2a')],'MailQueueId':_0x33f00c['id'],'interface':util[_0x0e92('0x61')]('%s/%s','SIP',_0x43c894[_0x0e92('0x2a')]),'penalty':0x0,'paused':_0x43c894[_0x0e92('0x5d')],'createdAt':_0x43c894[_0x0e92('0x5f')],'updatedAt':_0x43c894[_0x0e92('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0e92('0x25')](respondWithFilteredResult(_0x5f1719,_0x3f3c08))[_0x0e92('0x43')](handleError(_0x5f1719,null));};exports['getTeams']=function(_0x1387b5,_0x2f6978,_0x4605f2){var _0xbed5ce={};var _0x3fa2a6={};var _0x30798f;var _0x4a6cbf;return db[_0x0e92('0x2d')][_0x0e92('0x54')]({'where':{'id':_0x1387b5[_0x0e92('0x45')]['id']}})[_0x0e92('0x25')](handleEntityNotFound(_0x2f6978,null))['then'](function(_0x14fb76){if(_0x14fb76){_0x30798f=_0x14fb76;_0x3fa2a6[_0x0e92('0x31')]=_[_0x0e92('0x34')](db[_0x0e92('0x62')][_0x0e92('0x2e')]);_0x3fa2a6['query']=_[_0x0e92('0x34')](_0x1387b5[_0x0e92('0x33')]);_0x3fa2a6[_0x0e92('0x3d')]=_['intersection'](_0x3fa2a6[_0x0e92('0x31')],_0x3fa2a6[_0x0e92('0x33')]);_0xbed5ce[_0x0e92('0x36')]=_[_0x0e92('0x35')](_0x3fa2a6['model'],qs[_0x0e92('0x37')](_0x1387b5[_0x0e92('0x33')][_0x0e92('0x37')]));_0xbed5ce[_0x0e92('0x36')]=_0xbed5ce[_0x0e92('0x36')][_0x0e92('0x38')]?_0xbed5ce[_0x0e92('0x36')]:_0x3fa2a6[_0x0e92('0x31')];_0xbed5ce[_0x0e92('0x3a')]=qs['sort'](_0x1387b5[_0x0e92('0x33')][_0x0e92('0x3b')]);_0xbed5ce[_0x0e92('0x3c')]=qs['filters'](_[_0x0e92('0x63')](_0x1387b5['query'],_0x3fa2a6[_0x0e92('0x3d')]));if(_0x1387b5[_0x0e92('0x33')]['filter']){_0xbed5ce[_0x0e92('0x3c')]=_[_0x0e92('0x3f')](_0xbed5ce['where'],{'$or':_['map'](_0xbed5ce[_0x0e92('0x36')],function(_0x5b0b44){var _0x18f4bc={};_0x18f4bc[_0x5b0b44]={'$like':'%'+_0x1387b5[_0x0e92('0x33')][_0x0e92('0x3e')]+'%'};return _0x18f4bc;})});}_0xbed5ce=_[_0x0e92('0x3f')]({},_0xbed5ce,_0x1387b5[_0x0e92('0x46')]);return _0x30798f[_0x0e92('0x64')](_0xbed5ce);}})[_0x0e92('0x25')](function(_0x59b6a9){if(_0x59b6a9){_0x4a6cbf=_0x59b6a9[_0x0e92('0x38')];if(!_0x1387b5[_0x0e92('0x33')][_0x0e92('0x56')](_0x0e92('0x39'))){_0xbed5ce[_0x0e92('0x20')]=qs[_0x0e92('0x20')](_0x1387b5['query'][_0x0e92('0x20')]);_0xbed5ce[_0x0e92('0x1e')]=qs['offset'](_0x1387b5[_0x0e92('0x33')]['offset']);}return _0x30798f[_0x0e92('0x64')](_0xbed5ce);}})[_0x0e92('0x25')](function(_0x4e2f3d){if(_0x4e2f3d){return _0x4e2f3d?{'count':_0x4a6cbf,'rows':_0x4e2f3d}:null;}})[_0x0e92('0x25')](respondWithResult(_0x2f6978,null))[_0x0e92('0x43')](handleError(_0x2f6978,null));};exports[_0x0e92('0x65')]=function(_0x3339b1,_0x4491ea,_0xf4be12){var _0x15b6d2=_0x3339b1[_0x0e92('0x49')][_0x0e92('0x66')];return db[_0x0e92('0x62')][_0x0e92('0x58')]({'where':{'id':_0x15b6d2},'attributes':['id'],'include':[{'model':db[_0x0e92('0x59')],'as':'Agents','attributes':['id',_0x0e92('0x2a'),_0x0e92('0x67'),'voicePause','interface'],'raw':!![]}]})[_0x0e92('0x25')](function(_0x50e00c){if(_0x50e00c){var _0x3554bc=_[_0x0e92('0x68')](_0x50e00c,function(_0x80106){var _0x777e66=_0x80106[_0x0e92('0x69')]({'plain':!![]});return _0x777e66[_0x0e92('0x6a')];});return db[_0x0e92('0x2d')][_0x0e92('0x47')]({'where':{'id':_0x3339b1[_0x0e92('0x45')]['id']}})[_0x0e92('0x25')](function(_0x148e53){return db[_0x0e92('0x6b')][_0x0e92('0x6c')](function(_0x293fdc){return _0x148e53[_0x0e92('0x65')](_0x15b6d2,{'transaction':_0x293fdc})['then'](function(){return BPromise['each'](_0x3554bc,function(_0x585e60){return db[_0x0e92('0x55')][_0x0e92('0x6d')]({'where':{'UserId':_0x585e60['id'],'MailQueueId':_0x3339b1[_0x0e92('0x45')]['id']},'transaction':_0x293fdc});});})[_0x0e92('0x25')](function(){_0x3554bc[_0x0e92('0x6e')](function(_0xa128e5){socket[_0x0e92('0x6f')](_0x0e92('0x70'),{'UserId':_0xa128e5['id'],'MailQueueId':_0x148e53['id']});});});});});}})[_0x0e92('0x25')](respondWithStatusCode(_0x4491ea,null))['catch'](handleError(_0x4491ea,null));};exports['removeTeams']=function(_0x2a7b75,_0x5a854b,_0x1affeb){return db[_0x0e92('0x62')][_0x0e92('0x58')]({'where':{'id':_0x2a7b75['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e92('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x0e92('0x25')](handleEntityNotFound(_0x5a854b,null))['then'](function(_0x3f6f60){var _0x1d2fe1=_[_0x0e92('0x32')](_0x3f6f60,'id');var _0x2e25ec=[];var _0x38f4a9=[];var _0x32eb0c=squel[_0x0e92('0x71')]();_0x32eb0c[_0x0e92('0x72')](_0x0e92('0x73'))[_0x0e92('0x74')](_0x0e92('0x75'),'tq')[_0x0e92('0x76')](_0x0e92('0x77'),'ut',_0x0e92('0x78'))[_0x0e92('0x3c')](_0x0e92('0x79'),_0x2a7b75['params']['id']);for(var _0x1fada7=0x0;_0x1fada7<_0x3f6f60[_0x0e92('0x38')];_0x1fada7+=0x1){let _0x802848=_0x3f6f60[_0x1fada7];for(var _0x39b726=0x0;_0x39b726<_0x802848[_0x0e92('0x6a')]['length'];_0x39b726+=0x1){let _0x4305cd=_0x802848[_0x0e92('0x6a')][_0x39b726];var _0x4b22a8=_0x32eb0c[_0x0e92('0x7a')]();_0x4b22a8[_0x0e92('0x3c')](_0x0e92('0x7b'),_0x4305cd['id']);_0x38f4a9['push'](db['sequelize'][_0x0e92('0x33')](_0x4b22a8[_0x0e92('0x7c')](),{'type':db[_0x0e92('0x6b')][_0x0e92('0x7d')][_0x0e92('0x7e')]})[_0x0e92('0x25')](function(_0x29f74c){if(_0x29f74c[_0x0e92('0x38')]===0x1){return _0x4305cd['id'];}else{var _0xa8555d=_[_0x0e92('0x7f')](_['map'](_0x29f74c,_0x0e92('0x80')),function(_0x4e3826){return _[_0x0e92('0x81')](_0x1d2fe1,_0x4e3826);});if(_0xa8555d){return _0x4305cd['id'];}}}));}}return BPromise['all'](_0x38f4a9)['then'](function(_0x403d05){_0x2e25ec=_(_0x2e25ec)[_0x0e92('0x82')](_0x403d05)['compact']()['value']();return db['MailQueue'][_0x0e92('0x47')]({'where':{'id':_0x2a7b75['params']['id']}})[_0x0e92('0x25')](function(_0x178c63){return db[_0x0e92('0x6b')][_0x0e92('0x6c')](function(_0x52be59){return _0x178c63[_0x0e92('0x83')](_0x2a7b75[_0x0e92('0x33')][_0x0e92('0x66')],{'transaction':_0x52be59})[_0x0e92('0x25')](function(){if(!_['isEmpty'](_0x2e25ec)){return _0x178c63['removeAgents'](_0x2e25ec,{'transaction':_0x52be59});}})[_0x0e92('0x25')](function(){_0x2e25ec[_0x0e92('0x6e')](function(_0x4f4425){socket[_0x0e92('0x6f')](_0x0e92('0x84'),{'UserId':_0x4f4425,'MailQueueId':_0x178c63['id']});});});});});});})['then'](respondWithStatusCode(_0x5a854b,null))[_0x0e92('0x43')](handleError(_0x5a854b,null));};exports[_0x0e92('0x85')]=function(_0x25c519,_0x4a27eb,_0x49ff9e){return db[_0x0e92('0x2d')][_0x0e92('0x47')]({'where':{'id':_0x25c519['params']['id']}})['then'](handleEntityNotFound(_0x4a27eb,null))[_0x0e92('0x25')](function(_0x41631b){if(_0x41631b){return _0x41631b['addAgents'](_0x25c519[_0x0e92('0x49')]['ids'],_['omit'](_0x25c519[_0x0e92('0x49')],[_0x0e92('0x66'),'id'])||{})[_0x0e92('0x86')](function(_0x2ea3cc){for(var _0x4072a2=0x0;_0x4072a2<_0x25c519[_0x0e92('0x49')][_0x0e92('0x66')]['length'];_0x4072a2+=0x1){socket[_0x0e92('0x6f')](_0x0e92('0x70'),{'UserId':Number(_0x25c519[_0x0e92('0x49')][_0x0e92('0x66')][_0x4072a2]),'MailQueueId':Number(_0x25c519[_0x0e92('0x45')]['id'])});}return _0x2ea3cc;});}})[_0x0e92('0x25')](respondWithResult(_0x4a27eb,null))[_0x0e92('0x43')](handleError(_0x4a27eb,null));};exports[_0x0e92('0x87')]=function(_0xf35906,_0x57aa22,_0x4f8183){return db[_0x0e92('0x2d')][_0x0e92('0x47')]({'where':{'id':_0xf35906[_0x0e92('0x45')]['id']}})[_0x0e92('0x25')](handleEntityNotFound(_0x57aa22,null))[_0x0e92('0x25')](function(_0x41e6ff){if(_0x41e6ff){return _0x41e6ff['removeAgents'](_0xf35906[_0x0e92('0x33')]['ids'])[_0x0e92('0x25')](function(){if(_[_0x0e92('0x88')](_0xf35906[_0x0e92('0x33')][_0x0e92('0x66')])){for(var _0x32dffe=0x0;_0x32dffe<_0xf35906[_0x0e92('0x33')][_0x0e92('0x66')]['length'];_0x32dffe+=0x1){socket[_0x0e92('0x6f')]('userMailQueue:remove',{'UserId':Number(_0xf35906[_0x0e92('0x33')]['ids'][_0x32dffe]),'MailQueueId':Number(_0xf35906[_0x0e92('0x45')]['id'])});}}else{socket[_0x0e92('0x6f')](_0x0e92('0x84'),{'UserId':Number(_0xf35906[_0x0e92('0x33')]['ids']),'MailQueueId':Number(_0xf35906['params']['id'])});}});}})[_0x0e92('0x25')](respondWithStatusCode(_0x57aa22,null))[_0x0e92('0x43')](handleError(_0x57aa22,null));};exports[_0x0e92('0x89')]=function(_0x542cfb,_0x15cedd,_0x30532a){var _0x5bc336={};var _0x3e932f={};var _0x31995f;var _0x14a562;return db[_0x0e92('0x2d')][_0x0e92('0x54')]({'where':{'id':_0x542cfb[_0x0e92('0x45')]['id']}})[_0x0e92('0x25')](handleEntityNotFound(_0x15cedd,null))[_0x0e92('0x25')](function(_0x58bdc6){if(_0x58bdc6){_0x31995f=_0x58bdc6;_0x3e932f['model']=_['keys'](db[_0x0e92('0x59')][_0x0e92('0x2e')]);_0x3e932f[_0x0e92('0x33')]=_['keys'](_0x542cfb[_0x0e92('0x33')]);_0x3e932f['filters']=_[_0x0e92('0x35')](_0x3e932f[_0x0e92('0x31')],_0x3e932f[_0x0e92('0x33')]);_0x5bc336[_0x0e92('0x36')]=_['intersection'](_0x3e932f[_0x0e92('0x31')],qs[_0x0e92('0x37')](_0x542cfb[_0x0e92('0x33')]['fields']));_0x5bc336[_0x0e92('0x36')]=_0x5bc336['attributes'][_0x0e92('0x38')]?_0x5bc336[_0x0e92('0x36')]:_0x3e932f[_0x0e92('0x31')];_0x5bc336[_0x0e92('0x3a')]=qs[_0x0e92('0x3b')](_0x542cfb[_0x0e92('0x33')][_0x0e92('0x3b')]);_0x5bc336[_0x0e92('0x3c')]=qs[_0x0e92('0x3d')](_[_0x0e92('0x63')](_0x542cfb['query'],_0x3e932f[_0x0e92('0x3d')]));if(_0x542cfb[_0x0e92('0x33')]['filter']){_0x5bc336[_0x0e92('0x3c')]=_['merge'](_0x5bc336['where'],{'$or':_[_0x0e92('0x32')](_0x5bc336[_0x0e92('0x36')],function(_0x3c8e1c){var _0x936475={};_0x936475[_0x3c8e1c]={'$like':'%'+_0x542cfb['query'][_0x0e92('0x3e')]+'%'};return _0x936475;})});}_0x5bc336=_[_0x0e92('0x3f')]({},_0x5bc336,_0x542cfb[_0x0e92('0x46')]);return _0x31995f[_0x0e92('0x89')](_0x5bc336);}})[_0x0e92('0x25')](function(_0x5a8039){if(_0x5a8039){_0x14a562=_0x5a8039[_0x0e92('0x38')];if(!_0x542cfb[_0x0e92('0x33')][_0x0e92('0x56')](_0x0e92('0x39'))){_0x5bc336[_0x0e92('0x20')]=qs['limit'](_0x542cfb[_0x0e92('0x33')][_0x0e92('0x20')]);_0x5bc336[_0x0e92('0x1e')]=qs['offset'](_0x542cfb[_0x0e92('0x33')][_0x0e92('0x1e')]);}return _0x31995f[_0x0e92('0x89')](_0x5bc336);}})[_0x0e92('0x25')](function(_0x290bff){if(_0x290bff){return _0x290bff?{'count':_0x14a562,'rows':_0x290bff}:null;}})[_0x0e92('0x25')](respondWithResult(_0x15cedd,null))[_0x0e92('0x43')](handleError(_0x15cedd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 4b45a6f..6aa8104 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 _0x38ce=['exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x362727,_0x5da66f){var _0x572cc4=function(_0x2e364f){while(--_0x2e364f){_0x362727['push'](_0x362727['shift']());}};_0x572cc4(++_0x5da66f);}(_0x38ce,0x12d));var _0xe38c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x38ce[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xe38c('0x0'))['db'][_0xe38c('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe38c('0x2')](0x0);var events={'afterCreate':_0xe38c('0x3'),'afterUpdate':_0xe38c('0x4'),'afterDestroy':_0xe38c('0x5')};function emitEvent(_0x18fb2e){return function(_0x4b5d1a,_0x5f41b8,_0x4dda82){MailQueueEvents[_0xe38c('0x6')](_0x18fb2e+':'+_0x4b5d1a['id'],_0x4b5d1a);MailQueueEvents[_0xe38c('0x6')](_0x18fb2e,_0x4b5d1a);_0x4dda82(null);};}for(var e in events){if(events[_0xe38c('0x7')](e)){var event=events[e];MailQueue[_0xe38c('0x8')](e,emitEvent(event));}}module[_0xe38c('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xb247=['save','update','emit','hasOwnProperty','hook','exports','events','MailQueue'];(function(_0x2a79f2,_0xd2047e){var _0x4bfc17=function(_0x2a6ff1){while(--_0x2a6ff1){_0x2a79f2['push'](_0x2a79f2['shift']());}};_0x4bfc17(++_0xd2047e);}(_0xb247,0x116));var _0x7b24=function(_0x17c012,_0x581e0d){_0x17c012=_0x17c012-0x0;var _0x19e62c=_0xb247[_0x17c012];return _0x19e62c;};'use strict';var EventEmitter=require(_0x7b24('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x7b24('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7b24('0x2'),'afterUpdate':_0x7b24('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3423b8){return function(_0x40a2e5,_0x51e9f5,_0x501438){MailQueueEvents[_0x7b24('0x4')](_0x3423b8+':'+_0x40a2e5['id'],_0x40a2e5);MailQueueEvents[_0x7b24('0x4')](_0x3423b8,_0x40a2e5);_0x501438(null);};}for(var e in events){if(events[_0x7b24('0x5')](e)){var event=events[e];MailQueue[_0x7b24('0x6')](e,emitEvent(event));}}module[_0x7b24('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f44c22d..de51418 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 _0x2f32=['moment','bluebird','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api'];(function(_0x190a5b,_0x1a94fd){var _0x4f9595=function(_0x3018a8){while(--_0x3018a8){_0x190a5b['push'](_0x190a5b['shift']());}};_0x4f9595(++_0x1a94fd);}(_0x2f32,0x159));var _0x22f3=function(_0x56e6d7,_0x8c49a7){_0x56e6d7=_0x56e6d7-0x0;var _0x75ff63=_0x2f32[_0x56e6d7];return _0x75ff63;};'use strict';var _=require(_0x22f3('0x0'));var util=require('util');var logger=require(_0x22f3('0x1'))(_0x22f3('0x2'));var moment=require(_0x22f3('0x3'));var BPromise=require(_0x22f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22f3('0x5'));var rimraf=require(_0x22f3('0x6'));var config=require('../../config/environment');var attributes=require(_0x22f3('0x7'));module[_0x22f3('0x8')]=function(_0x29e377,_0x3a1a8){return _0x29e377[_0x22f3('0x9')](_0x22f3('0xa'),attributes,{'tableName':_0x22f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5660=['../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x57c142,_0x37c4e7){var _0x38b23d=function(_0x31d6d7){while(--_0x31d6d7){_0x57c142['push'](_0x57c142['shift']());}};_0x38b23d(++_0x37c4e7);}(_0x5660,0x17b));var _0x0566=function(_0x3e7f5a,_0x11c02e){_0x3e7f5a=_0x3e7f5a-0x0;var _0x29cb02=_0x5660[_0x3e7f5a];return _0x29cb02;};'use strict';var _=require(_0x0566('0x0'));var util=require(_0x0566('0x1'));var logger=require(_0x0566('0x2'))(_0x0566('0x3'));var moment=require(_0x0566('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0566('0x5'));var config=require(_0x0566('0x6'));var attributes=require('./mailQueue.attributes');module[_0x0566('0x7')]=function(_0x56b7ad,_0x224e48){return _0x56b7ad[_0x0566('0x8')](_0x0566('0x9'),attributes,{'tableName':_0x0566('0xa'),'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 2e9d34d..392901a 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 _0xf756=['include','map','attributes','model','debug','MailQueue','find','raw','where','ShowMailQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','findAll','options'];(function(_0x39426f,_0x3107d3){var _0x26cdbf=function(_0x50c099){while(--_0x50c099){_0x39426f['push'](_0x39426f['shift']());}};_0x26cdbf(++_0x3107d3);}(_0xf756,0x1ae));var _0x6f75=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf756[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x6f75('0x0'));var util=require(_0x6f75('0x1'));var moment=require('moment');var BPromise=require(_0x6f75('0x2'));var rs=require(_0x6f75('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f75('0x4'))['db'];var utils=require(_0x6f75('0x5'));var logger=require('../../config/logger')(_0x6f75('0x6'));var config=require(_0x6f75('0x7'));var jayson=require(_0x6f75('0x8'));var client=jayson[_0x6f75('0x9')][_0x6f75('0xa')]({'port':0x232a});config[_0x6f75('0xb')]=_[_0x6f75('0xc')](config[_0x6f75('0xb')],{'host':_0x6f75('0xd'),'port':0x18eb});var socket=require(_0x6f75('0xe'))(new Redis(config[_0x6f75('0xb')]));require(_0x6f75('0xf'))[_0x6f75('0x10')](socket);function respondWithRpcPromise(_0x46c1b1,_0x1f49c7,_0x4bfc43){return new BPromise(function(_0x37091c,_0x40c7f7){return client[_0x6f75('0x11')](_0x46c1b1,_0x4bfc43)[_0x6f75('0x12')](function(_0x17d75c){logger[_0x6f75('0x13')](_0x6f75('0x14'),_0x1f49c7,_0x6f75('0x15'));logger['debug'](_0x6f75('0x16'),_0x1f49c7,_0x6f75('0x15'),JSON[_0x6f75('0x17')](_0x17d75c));if(_0x17d75c[_0x6f75('0x18')]){if(_0x17d75c[_0x6f75('0x18')][_0x6f75('0x19')]===0x1f4){logger[_0x6f75('0x18')](_0x6f75('0x14'),_0x1f49c7,_0x17d75c[_0x6f75('0x18')][_0x6f75('0x1a')]);return _0x40c7f7(_0x17d75c[_0x6f75('0x18')][_0x6f75('0x1a')]);}logger[_0x6f75('0x18')](_0x6f75('0x14'),_0x1f49c7,_0x17d75c[_0x6f75('0x18')][_0x6f75('0x1a')]);return _0x37091c(_0x17d75c['error'][_0x6f75('0x1a')]);}else{logger['info'](_0x6f75('0x14'),_0x1f49c7,_0x6f75('0x15'));_0x37091c(_0x17d75c[_0x6f75('0x1b')]['message']);}})[_0x6f75('0x1c')](function(_0x5950f5){logger['error']('MailQueue,\x20%s,\x20%s',_0x1f49c7,_0x5950f5);_0x40c7f7(_0x5950f5);});});}exports[_0x6f75('0x1d')]=function(_0x240ea6){var _0xf2ea14=this;return new Promise(function(_0x1500b0,_0x1d6485){return db['MailQueue'][_0x6f75('0x1e')]({'raw':_0x240ea6[_0x6f75('0x1f')]?_0x240ea6['options']['raw']===undefined?!![]:![]:!![],'where':_0x240ea6[_0x6f75('0x1f')]?_0x240ea6[_0x6f75('0x1f')]['where']||null:null,'attributes':_0x240ea6[_0x6f75('0x1f')]?_0x240ea6[_0x6f75('0x1f')]['attributes']||null:null,'limit':_0x240ea6[_0x6f75('0x1f')]?_0x240ea6[_0x6f75('0x1f')]['limit']||null:null,'include':_0x240ea6[_0x6f75('0x1f')]?_0x240ea6[_0x6f75('0x1f')][_0x6f75('0x20')]?_[_0x6f75('0x21')](_0x240ea6['options'][_0x6f75('0x20')],function(_0x1aff60){return{'model':db[_0x1aff60['model']],'as':_0x1aff60['as'],'attributes':_0x1aff60[_0x6f75('0x22')],'include':_0x1aff60[_0x6f75('0x20')]?_['map'](_0x1aff60['include'],function(_0x52b09d){return{'model':db[_0x52b09d[_0x6f75('0x23')]],'as':_0x52b09d['as'],'attributes':_0x52b09d[_0x6f75('0x22')],'include':_0x52b09d[_0x6f75('0x20')]?_[_0x6f75('0x21')](_0x52b09d['include'],function(_0x494104){return{'model':db[_0x494104[_0x6f75('0x23')]],'as':_0x494104['as'],'attributes':_0x494104[_0x6f75('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6f75('0x12')](function(_0x457343){logger[_0x6f75('0x13')](_0x6f75('0x1d'),_0x240ea6);logger[_0x6f75('0x24')](_0x6f75('0x1d'),_0x240ea6,JSON[_0x6f75('0x17')](_0x457343));_0x1500b0(_0x457343);})['catch'](function(_0x5543de){logger[_0x6f75('0x18')](_0x6f75('0x1d'),_0x5543de[_0x6f75('0x1a')],_0x240ea6);_0x1d6485(_0xf2ea14[_0x6f75('0x18')](0x1f4,_0x5543de[_0x6f75('0x1a')]));});});};exports['ShowMailQueue']=function(_0x27c394){var _0x32a503=this;return new Promise(function(_0x1c9962,_0x4bc36e){return db[_0x6f75('0x25')][_0x6f75('0x26')]({'raw':_0x27c394[_0x6f75('0x1f')]?_0x27c394[_0x6f75('0x1f')][_0x6f75('0x27')]===undefined?!![]:![]:!![],'where':_0x27c394['options']?_0x27c394[_0x6f75('0x1f')][_0x6f75('0x28')]||null:null,'attributes':_0x27c394[_0x6f75('0x1f')]?_0x27c394[_0x6f75('0x1f')][_0x6f75('0x22')]||null:null,'include':_0x27c394[_0x6f75('0x1f')]?_0x27c394[_0x6f75('0x1f')]['include']?_[_0x6f75('0x21')](_0x27c394[_0x6f75('0x1f')]['include'],function(_0x73b9ca){return{'model':db[_0x73b9ca[_0x6f75('0x23')]],'as':_0x73b9ca['as'],'attributes':_0x73b9ca['attributes'],'include':_0x73b9ca[_0x6f75('0x20')]?_['map'](_0x73b9ca[_0x6f75('0x20')],function(_0x10f472){return{'model':db[_0x10f472[_0x6f75('0x23')]],'as':_0x10f472['as'],'attributes':_0x10f472[_0x6f75('0x22')],'include':_0x10f472[_0x6f75('0x20')]?_[_0x6f75('0x21')](_0x10f472[_0x6f75('0x20')],function(_0x45a4bc){return{'model':db[_0x45a4bc['model']],'as':_0x45a4bc['as'],'attributes':_0x45a4bc[_0x6f75('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6f75('0x12')](function(_0x31cc87){logger[_0x6f75('0x13')](_0x6f75('0x29'),_0x27c394);logger[_0x6f75('0x24')](_0x6f75('0x29'),_0x27c394,JSON[_0x6f75('0x17')](_0x31cc87));_0x1c9962(_0x31cc87);})[_0x6f75('0x1c')](function(_0x4d067a){logger['error'](_0x6f75('0x29'),_0x4d067a[_0x6f75('0x1a')],_0x27c394);_0x4bc36e(_0x32a503[_0x6f75('0x18')](0x1f4,_0x4d067a[_0x6f75('0x1a')]));});});}; \ No newline at end of file +var _0xccda=['rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./mailQueue.socket','register','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowMailQueue','find','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x50eb7d,_0x5e3731){var _0xe1ee=function(_0x297bc8){while(--_0x297bc8){_0x50eb7d['push'](_0x50eb7d['shift']());}};_0xe1ee(++_0x5e3731);}(_0xccda,0x14f));var _0xaccd=function(_0x22c50e,_0x4ea131){_0x22c50e=_0x22c50e-0x0;var _0x500f85=_0xccda[_0x22c50e];return _0x500f85;};'use strict';var _=require(_0xaccd('0x0'));var util=require('util');var moment=require(_0xaccd('0x1'));var BPromise=require(_0xaccd('0x2'));var rs=require(_0xaccd('0x3'));var fs=require('fs');var Redis=require(_0xaccd('0x4'));var db=require(_0xaccd('0x5'))['db'];var utils=require(_0xaccd('0x6'));var logger=require('../../config/logger')(_0xaccd('0x7'));var config=require('../../config/environment');var jayson=require(_0xaccd('0x8'));var client=jayson['client'][_0xaccd('0x9')]({'port':0x232a});config['redis']=_[_0xaccd('0xa')](config[_0xaccd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaccd('0xc'))(new Redis(config['redis']));require(_0xaccd('0xd'))[_0xaccd('0xe')](socket);function respondWithRpcPromise(_0x13aa4f,_0x3c82c1,_0x303120){return new BPromise(function(_0x3a6f34,_0x18a8b5){return client['request'](_0x13aa4f,_0x303120)[_0xaccd('0xf')](function(_0x29c647){logger[_0xaccd('0x10')]('MailQueue,\x20%s,\x20%s',_0x3c82c1,_0xaccd('0x11'));logger['debug'](_0xaccd('0x12'),_0x3c82c1,_0xaccd('0x11'),JSON['stringify'](_0x29c647));if(_0x29c647[_0xaccd('0x13')]){if(_0x29c647['error']['code']===0x1f4){logger['error'](_0xaccd('0x14'),_0x3c82c1,_0x29c647[_0xaccd('0x13')][_0xaccd('0x15')]);return _0x18a8b5(_0x29c647[_0xaccd('0x13')][_0xaccd('0x15')]);}logger['error'](_0xaccd('0x14'),_0x3c82c1,_0x29c647[_0xaccd('0x13')]['message']);return _0x3a6f34(_0x29c647['error'][_0xaccd('0x15')]);}else{logger[_0xaccd('0x10')](_0xaccd('0x14'),_0x3c82c1,'request\x20sent');_0x3a6f34(_0x29c647['result'][_0xaccd('0x15')]);}})[_0xaccd('0x16')](function(_0x25b071){logger[_0xaccd('0x13')]('MailQueue,\x20%s,\x20%s',_0x3c82c1,_0x25b071);_0x18a8b5(_0x25b071);});});}exports[_0xaccd('0x17')]=function(_0x30cd60){var _0x577534=this;return new Promise(function(_0x2b9d59,_0x53fe81){return db[_0xaccd('0x18')][_0xaccd('0x19')]({'raw':_0x30cd60[_0xaccd('0x1a')]?_0x30cd60['options'][_0xaccd('0x1b')]===undefined?!![]:![]:!![],'where':_0x30cd60[_0xaccd('0x1a')]?_0x30cd60['options'][_0xaccd('0x1c')]||null:null,'attributes':_0x30cd60[_0xaccd('0x1a')]?_0x30cd60[_0xaccd('0x1a')]['attributes']||null:null,'limit':_0x30cd60['options']?_0x30cd60[_0xaccd('0x1a')][_0xaccd('0x1d')]||null:null,'include':_0x30cd60[_0xaccd('0x1a')]?_0x30cd60[_0xaccd('0x1a')][_0xaccd('0x1e')]?_[_0xaccd('0x1f')](_0x30cd60[_0xaccd('0x1a')]['include'],function(_0x36f3f2){return{'model':db[_0x36f3f2[_0xaccd('0x20')]],'as':_0x36f3f2['as'],'attributes':_0x36f3f2[_0xaccd('0x21')],'include':_0x36f3f2[_0xaccd('0x1e')]?_[_0xaccd('0x1f')](_0x36f3f2[_0xaccd('0x1e')],function(_0x11edb4){return{'model':db[_0x11edb4[_0xaccd('0x20')]],'as':_0x11edb4['as'],'attributes':_0x11edb4[_0xaccd('0x21')],'include':_0x11edb4[_0xaccd('0x1e')]?_[_0xaccd('0x1f')](_0x11edb4['include'],function(_0x5efd59){return{'model':db[_0x5efd59[_0xaccd('0x20')]],'as':_0x5efd59['as'],'attributes':_0x5efd59['attributes']};}):[]};}):[]};}):[]:[]})[_0xaccd('0xf')](function(_0x1b2610){logger[_0xaccd('0x10')]('GetMailQueue',_0x30cd60);logger[_0xaccd('0x22')](_0xaccd('0x17'),_0x30cd60,JSON['stringify'](_0x1b2610));_0x2b9d59(_0x1b2610);})['catch'](function(_0x57b8e0){logger[_0xaccd('0x13')](_0xaccd('0x17'),_0x57b8e0['message'],_0x30cd60);_0x53fe81(_0x577534[_0xaccd('0x13')](0x1f4,_0x57b8e0['message']));});});};exports[_0xaccd('0x23')]=function(_0x31a974){var _0x4a9c1c=this;return new Promise(function(_0x2626af,_0xec8050){return db[_0xaccd('0x18')][_0xaccd('0x24')]({'raw':_0x31a974[_0xaccd('0x1a')]?_0x31a974[_0xaccd('0x1a')][_0xaccd('0x1b')]===undefined?!![]:![]:!![],'where':_0x31a974['options']?_0x31a974[_0xaccd('0x1a')][_0xaccd('0x1c')]||null:null,'attributes':_0x31a974[_0xaccd('0x1a')]?_0x31a974[_0xaccd('0x1a')][_0xaccd('0x21')]||null:null,'include':_0x31a974[_0xaccd('0x1a')]?_0x31a974['options'][_0xaccd('0x1e')]?_[_0xaccd('0x1f')](_0x31a974[_0xaccd('0x1a')][_0xaccd('0x1e')],function(_0x56c331){return{'model':db[_0x56c331[_0xaccd('0x20')]],'as':_0x56c331['as'],'attributes':_0x56c331[_0xaccd('0x21')],'include':_0x56c331[_0xaccd('0x1e')]?_[_0xaccd('0x1f')](_0x56c331[_0xaccd('0x1e')],function(_0x8a633c){return{'model':db[_0x8a633c[_0xaccd('0x20')]],'as':_0x8a633c['as'],'attributes':_0x8a633c['attributes'],'include':_0x8a633c[_0xaccd('0x1e')]?_[_0xaccd('0x1f')](_0x8a633c[_0xaccd('0x1e')],function(_0x1a6346){return{'model':db[_0x1a6346['model']],'as':_0x1a6346['as'],'attributes':_0x1a6346[_0xaccd('0x21')]};}):[]};}):[]};}):[]:[]})[_0xaccd('0xf')](function(_0x398094){logger[_0xaccd('0x10')](_0xaccd('0x23'),_0x31a974);logger[_0xaccd('0x22')](_0xaccd('0x23'),_0x31a974,JSON[_0xaccd('0x25')](_0x398094));_0x2626af(_0x398094);})[_0xaccd('0x16')](function(_0x80c0a8){logger[_0xaccd('0x13')](_0xaccd('0x23'),_0x80c0a8[_0xaccd('0x15')],_0x31a974);_0xec8050(_0x4a9c1c['error'](0x1f4,_0x80c0a8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 2bb7500..2eb9381 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 _0x6a6e=['register','length','mailQueue:','save','remove','update','emit','removeListener'];(function(_0x3b85dc,_0x1e5291){var _0x402933=function(_0x3dd06c){while(--_0x3dd06c){_0x3b85dc['push'](_0x3b85dc['shift']());}};_0x402933(++_0x1e5291);}(_0x6a6e,0xd3));var _0xe6a6=function(_0x1c1913,_0x1d1b59){_0x1c1913=_0x1c1913-0x0;var _0x3b352a=_0x6a6e[_0x1c1913];return _0x3b352a;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xe6a6('0x0'),_0xe6a6('0x1'),_0xe6a6('0x2')];function createListener(_0x1d2034,_0x4717bf){return function(_0x33d2c0){_0x4717bf[_0xe6a6('0x3')](_0x1d2034,_0x33d2c0);};}function removeListener(_0x23ed0d,_0x5b4830){return function(){MailQueueEvents[_0xe6a6('0x4')](_0x23ed0d,_0x5b4830);};}exports[_0xe6a6('0x5')]=function(_0x32cae8){for(var _0x222174=0x0,_0x161efc=events[_0xe6a6('0x6')];_0x222174<_0x161efc;_0x222174++){var _0x375c5c=events[_0x222174];var _0x24317d=createListener(_0xe6a6('0x7')+_0x375c5c,_0x32cae8);MailQueueEvents['on'](_0x375c5c,_0x24317d);}}; \ No newline at end of file +var _0x9d62=['./mailQueue.events','save','remove','update','emit','removeListener','length'];(function(_0xb5e37f,_0xc624f1){var _0x23f431=function(_0x3ec670){while(--_0x3ec670){_0xb5e37f['push'](_0xb5e37f['shift']());}};_0x23f431(++_0xc624f1);}(_0x9d62,0xaf));var _0x29d6=function(_0x4db9f1,_0x3da660){_0x4db9f1=_0x4db9f1-0x0;var _0x2fe17f=_0x9d62[_0x4db9f1];return _0x2fe17f;};'use strict';var MailQueueEvents=require(_0x29d6('0x0'));var events=[_0x29d6('0x1'),_0x29d6('0x2'),_0x29d6('0x3')];function createListener(_0x203fb3,_0x4e1453){return function(_0x15e8d7){_0x4e1453[_0x29d6('0x4')](_0x203fb3,_0x15e8d7);};}function removeListener(_0x1f9636,_0x190c2b){return function(){MailQueueEvents[_0x29d6('0x5')](_0x1f9636,_0x190c2b);};}exports['register']=function(_0x2962a9){for(var _0x468e41=0x0,_0xef4a2c=events[_0x29d6('0x6')];_0x468e41<_0xef4a2c;_0x468e41++){var _0x243871=events[_0x468e41];var _0x35b6cf=createListener('mailQueue:'+_0x243871,_0x2962a9);MailQueueEvents['on'](_0x243871,_0x35b6cf);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1706b32..062196c 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 _0x35d1=['./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4953c9,_0x24591d){var _0x263a5e=function(_0x4181bf){while(--_0x4181bf){_0x4953c9['push'](_0x4953c9['shift']());}};_0x263a5e(++_0x24591d);}(_0x35d1,0x77));var _0x135d=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x35d1[_0x35af23];return _0x340506;};'use strict';var multer=require(_0x135d('0x0'));var util=require('util');var path=require(_0x135d('0x1'));var timeout=require(_0x135d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x135d('0x3'));var auth=require(_0x135d('0x4'));var interaction=require(_0x135d('0x5'));var config=require(_0x135d('0x6'));var controller=require(_0x135d('0x7'));router[_0x135d('0x8')]('/',auth[_0x135d('0x9')](),controller['index']);router[_0x135d('0x8')](_0x135d('0xa'),auth[_0x135d('0x9')](),controller[_0x135d('0xb')]);router['get'](_0x135d('0xc'),auth['isAuthenticated'](),controller[_0x135d('0xd')]);router[_0x135d('0xe')]('/',auth[_0x135d('0x9')](),controller[_0x135d('0xf')]);router['put']('/:id',auth[_0x135d('0x9')](),controller['update']);router[_0x135d('0x10')](_0x135d('0xc'),auth[_0x135d('0x9')](),controller[_0x135d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6bda=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x10e23b,_0x5e23be){var _0x1c4c37=function(_0x37b52b){while(--_0x37b52b){_0x10e23b['push'](_0x10e23b['shift']());}};_0x1c4c37(++_0x5e23be);}(_0x6bda,0xa5));var _0xa6bd=function(_0x2107ca,_0x1aee9e){_0x2107ca=_0x2107ca-0x0;var _0x5b561c=_0x6bda[_0x2107ca];return _0x5b561c;};'use strict';var multer=require(_0xa6bd('0x0'));var util=require(_0xa6bd('0x1'));var path=require('path');var timeout=require(_0xa6bd('0x2'));var express=require(_0xa6bd('0x3'));var router=express[_0xa6bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa6bd('0x5'));var interaction=require(_0xa6bd('0x6'));var config=require(_0xa6bd('0x7'));var controller=require(_0xa6bd('0x8'));router['get']('/',auth[_0xa6bd('0x9')](),controller[_0xa6bd('0xa')]);router[_0xa6bd('0xb')](_0xa6bd('0xc'),auth['isAuthenticated'](),controller[_0xa6bd('0xd')]);router[_0xa6bd('0xb')](_0xa6bd('0xe'),auth['isAuthenticated'](),controller[_0xa6bd('0xf')]);router[_0xa6bd('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xa6bd('0x9')](),controller['update']);router['delete']('/:id',auth[_0xa6bd('0x9')](),controller[_0xa6bd('0x11')]);module[_0xa6bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2c5bd0e..4e8dcaf 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 _0x1903=['sequelize','exports','STRING','DATE'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x1903,0x16c));var _0x3190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1903[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x3190('0x0'));module[_0x3190('0x1')]={'uniqueid':{'type':Sequelize[_0x3190('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3190('0x3')]},'leaveAt':{'type':Sequelize[_0x3190('0x3')]},'acceptAt':{'type':Sequelize[_0x3190('0x3')]},'exitAt':{'type':Sequelize[_0x3190('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfbd1=['STRING','DATE','sequelize','exports'];(function(_0x4f8f56,_0x4a97c7){var _0x3bf0d7=function(_0xbe20cf){while(--_0xbe20cf){_0x4f8f56['push'](_0x4f8f56['shift']());}};_0x3bf0d7(++_0x4a97c7);}(_0xfbd1,0x176));var _0x1fbd=function(_0x103ac4,_0x137d0c){_0x103ac4=_0x103ac4-0x0;var _0x39d4c0=_0xfbd1[_0x103ac4];return _0x39d4c0;};'use strict';var moment=require('moment');var Sequelize=require(_0x1fbd('0x0'));module[_0x1fbd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1fbd('0x2')]},'joinAt':{'type':Sequelize[_0x1fbd('0x3')]},'leaveAt':{'type':Sequelize[_0x1fbd('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1fbd('0x3')]},'reason':{'type':Sequelize[_0x1fbd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 55469ff..1ab6d2a 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 _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x5f2f,0x73));var _0xf5f2=function(_0x6c1dcc,_0x431553){_0x6c1dcc=_0x6c1dcc-0x0;var _0x304d6e=_0x5f2f[_0x6c1dcc];return _0x304d6e;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file +var _0x1a85=['describe','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','destroy'];(function(_0x1c7a76,_0x3b6ac2){var _0x59f3f8=function(_0x4635b8){while(--_0x4635b8){_0x1c7a76['push'](_0x1c7a76['shift']());}};_0x59f3f8(++_0x3b6ac2);}(_0x1a85,0x178));var _0x51a8=function(_0x493c8c,_0x470567){_0x493c8c=_0x493c8c-0x0;var _0x17344b=_0x1a85[_0x493c8c];return _0x17344b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':!![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['MailQueueReport'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));};exports['describe']=function(_0x21c4da,_0xc89617){return db[_0x51a8('0x2a')][_0x51a8('0x4a')]()[_0x51a8('0x23')](respondWithResult(_0xc89617,null))[_0x51a8('0x41')](handleError(_0xc89617,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 19e4b30..6e1e894 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 _0xab95=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x399bb9,_0x3aafa8){var _0x2c53be=function(_0x162596){while(--_0x162596){_0x399bb9['push'](_0x399bb9['shift']());}};_0x2c53be(++_0x3aafa8);}(_0xab95,0x118));var _0x5ab9=function(_0x15d928,_0xaa4894){_0x15d928=_0x15d928-0x0;var _0x32072c=_0xab95[_0x15d928];return _0x32072c;};'use strict';var _=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var logger=require(_0x5ab9('0x2'))(_0x5ab9('0x3'));var moment=require(_0x5ab9('0x4'));var BPromise=require(_0x5ab9('0x5'));var rp=require(_0x5ab9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ab9('0x7'));var config=require(_0x5ab9('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x5ab9('0x9')]=function(_0x279ede,_0x54e691){return _0x279ede[_0x5ab9('0xa')](_0x5ab9('0xb'),attributes,{'tableName':_0x5ab9('0xc'),'paranoid':![],'indexes':[{'name':_0x5ab9('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5439=['lodash','../../config/logger','api','moment','path','rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x337800,_0x1e986e){var _0x2caa1d=function(_0x4fee6f){while(--_0x4fee6f){_0x337800['push'](_0x337800['shift']());}};_0x2caa1d(++_0x1e986e);}(_0x5439,0x1ef));var _0x9543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5439[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9543('0x0'));var util=require('util');var logger=require(_0x9543('0x1'))(_0x9543('0x2'));var moment=require(_0x9543('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9543('0x4'));var rimraf=require(_0x9543('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x9543('0x6')]=function(_0x45da1f,_0x17e74b){return _0x45da1f[_0x9543('0x7')](_0x9543('0x8'),attributes,{'tableName':_0x9543('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9543('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4807d56..8b1afe4 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(_0x5a05b4,_0x584e3f){var _0x7fcee6=function(_0x5247f9){while(--_0x5247f9){_0x5a05b4['push'](_0x5a05b4['shift']());}};_0x7fcee6(++_0x584e3f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20c7e0,_0x5dc197){_0x20c7e0=_0x20c7e0-0x0;var _0x32d0ab=_0x5f2f[_0x20c7e0];return _0x32d0ab;};'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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1c2b8c,_0x274772){var _0xe8c199=function(_0x28943f){while(--_0x28943f){_0x1c2b8c['push'](_0x1c2b8c['shift']());}};_0xe8c199(++_0x274772);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 740ef58..4b6188c 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(_0x36f1e0,_0x5316ce){var _0x2d3dfa=function(_0x4f4789){while(--_0x4f4789){_0x36f1e0['push'](_0x36f1e0['shift']());}};_0x2d3dfa(++_0x5316ce);}(_0x70e0,0x17b));var _0x070e=function(_0x513543,_0x14ed69){_0x513543=_0x513543-0x0;var _0x4358b1=_0x70e0[_0x513543];return _0x4358b1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xf004d2,_0x1878e4){var _0x2239fd=function(_0x323cbf){while(--_0x323cbf){_0xf004d2['push'](_0xf004d2['shift']());}};_0x2239fd(++_0x1878e4);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 19c4558..57a4777 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 _0x1199=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x14ff97,_0x264057){var _0x19b664=function(_0x492bcf){while(--_0x492bcf){_0x14ff97['push'](_0x14ff97['shift']());}};_0x19b664(++_0x264057);}(_0x1199,0x168));var _0x9119=function(_0x1f9b23,_0x4fec1f){_0x1f9b23=_0x1f9b23-0x0;var _0x39a610=_0x1199[_0x1f9b23];return _0x39a610;};'use strict';var Sequelize=require(_0x9119('0x0'));module[_0x9119('0x1')]={'description':{'type':Sequelize[_0x9119('0x2')]},'host':{'type':Sequelize[_0x9119('0x2')]},'authentication':{'type':Sequelize[_0x9119('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9119('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x9119('0x4')]},'tls':{'type':Sequelize[_0x9119('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9119('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x9119('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9119('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9119('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4f9f=['STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x4f9f,0x144));var _0xf4f9=function(_0x40ef1c,_0x5916a9){_0x40ef1c=_0x40ef1c-0x0;var _0x1858b3=_0x4f9f[_0x40ef1c];return _0x1858b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xf4f9('0x0')]},'host':{'type':Sequelize[_0xf4f9('0x0')]},'authentication':{'type':Sequelize[_0xf4f9('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf4f9('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf4f9('0x2')]},'tls':{'type':Sequelize[_0xf4f9('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xf4f9('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf4f9('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xf4f9('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index da66e5c..e94d8a3 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 _0xa728=['request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api','bluebird'];(function(_0x532e5a,_0x4c27d4){var _0x2806c8=function(_0x3a6aee){while(--_0x3a6aee){_0x532e5a['push'](_0x532e5a['shift']());}};_0x2806c8(++_0x4c27d4);}(_0xa728,0x8c));var _0x8a72=function(_0x3dc89b,_0x42cf34){_0x3dc89b=_0x3dc89b-0x0;var _0x5293aa=_0xa728[_0x3dc89b];return _0x5293aa;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var logger=require('../../config/logger')(_0x8a72('0x2'));var moment=require('moment');var BPromise=require(_0x8a72('0x3'));var rp=require(_0x8a72('0x4'));var fs=require('fs');var path=require(_0x8a72('0x5'));var rimraf=require('rimraf');var config=require(_0x8a72('0x6'));var attributes=require(_0x8a72('0x7'));module[_0x8a72('0x8')]=function(_0x7a68,_0x312f78){return _0x7a68[_0x8a72('0x9')](_0x8a72('0xa'),attributes,{'tableName':_0x8a72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d36=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','mail_servers_in','util'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0d36,0x1d3));var _0x60d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d36[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x60d3('0x0'));var logger=require(_0x60d3('0x1'))(_0x60d3('0x2'));var moment=require(_0x60d3('0x3'));var BPromise=require(_0x60d3('0x4'));var rp=require(_0x60d3('0x5'));var fs=require('fs');var path=require(_0x60d3('0x6'));var rimraf=require(_0x60d3('0x7'));var config=require(_0x60d3('0x8'));var attributes=require(_0x60d3('0x9'));module['exports']=function(_0x34ef0f,_0x3886c6){return _0x34ef0f[_0x60d3('0xa')]('MailServerIn',attributes,{'tableName':_0x60d3('0xb'),'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 7321238..b7631f0 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 _0x3c8e=['MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info'];(function(_0x5c750f,_0x5542fc){var _0x211b3a=function(_0x22553d){while(--_0x22553d){_0x5c750f['push'](_0x5c750f['shift']());}};_0x211b3a(++_0x5542fc);}(_0x3c8e,0x65));var _0xe3c8=function(_0x386e8e,_0x4e7cdc){_0x386e8e=_0x386e8e-0x0;var _0xbf0edc=_0x3c8e[_0x386e8e];return _0xbf0edc;};'use strict';var _=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var moment=require(_0xe3c8('0x2'));var BPromise=require(_0xe3c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3c8('0x4'))['db'];var utils=require(_0xe3c8('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe3c8('0x6'));var client=jayson[_0xe3c8('0x7')][_0xe3c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eca95,_0x3091ce,_0x505744){return new BPromise(function(_0x46cd46,_0x93a4b7){return client['request'](_0x2eca95,_0x505744)[_0xe3c8('0x9')](function(_0x2ec65f){logger[_0xe3c8('0xa')](_0xe3c8('0xb'),_0x3091ce,_0xe3c8('0xc'));logger['debug'](_0xe3c8('0xd'),_0x3091ce,'request\x20sent',JSON[_0xe3c8('0xe')](_0x2ec65f));if(_0x2ec65f[_0xe3c8('0xf')]){if(_0x2ec65f[_0xe3c8('0xf')][_0xe3c8('0x10')]===0x1f4){logger['error'](_0xe3c8('0xb'),_0x3091ce,_0x2ec65f[_0xe3c8('0xf')]['message']);return _0x93a4b7(_0x2ec65f[_0xe3c8('0xf')][_0xe3c8('0x11')]);}logger[_0xe3c8('0xf')]('MailServerIn,\x20%s,\x20%s',_0x3091ce,_0x2ec65f[_0xe3c8('0xf')][_0xe3c8('0x11')]);return _0x46cd46(_0x2ec65f[_0xe3c8('0xf')][_0xe3c8('0x11')]);}else{logger['info'](_0xe3c8('0xb'),_0x3091ce,_0xe3c8('0xc'));_0x46cd46(_0x2ec65f[_0xe3c8('0x12')][_0xe3c8('0x11')]);}})[_0xe3c8('0x13')](function(_0x3c319a){logger[_0xe3c8('0xf')]('MailServerIn,\x20%s,\x20%s',_0x3091ce,_0x3c319a);_0x93a4b7(_0x3c319a);});});}exports[_0xe3c8('0x14')]=function(_0x4f44f3){var _0x4727a4=this;return new Promise(function(_0x90f2ca,_0x1e2041){return db['MailServerIn']['findAll']({'raw':_0x4f44f3[_0xe3c8('0x15')]?_0x4f44f3[_0xe3c8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4f44f3[_0xe3c8('0x15')]?_0x4f44f3[_0xe3c8('0x15')][_0xe3c8('0x16')]||null:null,'attributes':_0x4f44f3['options']?_0x4f44f3[_0xe3c8('0x15')][_0xe3c8('0x17')]||null:null,'limit':_0x4f44f3['options']?_0x4f44f3[_0xe3c8('0x15')][_0xe3c8('0x18')]||null:null,'include':_0x4f44f3[_0xe3c8('0x15')]?_0x4f44f3[_0xe3c8('0x15')]['include']?_[_0xe3c8('0x19')](_0x4f44f3[_0xe3c8('0x15')][_0xe3c8('0x1a')],function(_0x17a5e2){return{'model':db[_0x17a5e2[_0xe3c8('0x1b')]],'as':_0x17a5e2['as'],'attributes':_0x17a5e2['attributes'],'include':_0x17a5e2[_0xe3c8('0x1a')]?_[_0xe3c8('0x19')](_0x17a5e2['include'],function(_0x5ef5a3){return{'model':db[_0x5ef5a3['model']],'as':_0x5ef5a3['as'],'attributes':_0x5ef5a3['attributes'],'include':_0x5ef5a3['include']?_[_0xe3c8('0x19')](_0x5ef5a3['include'],function(_0x2f5a53){return{'model':db[_0x2f5a53[_0xe3c8('0x1b')]],'as':_0x2f5a53['as'],'attributes':_0x2f5a53[_0xe3c8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe3c8('0x9')](function(_0x369e2a){logger[_0xe3c8('0xa')](_0xe3c8('0x14'),_0x4f44f3);logger['debug'](_0xe3c8('0x14'),_0x4f44f3,JSON['stringify'](_0x369e2a));_0x90f2ca(_0x369e2a);})['catch'](function(_0x5a0709){logger['error'](_0xe3c8('0x14'),_0x5a0709['message'],_0x4f44f3);_0x1e2041(_0x4727a4[_0xe3c8('0xf')](0x1f4,_0x5a0709[_0xe3c8('0x11')]));});});}; \ No newline at end of file +var _0x1a5b=['GetMailServerIn','MailServerIn','raw','options','limit','map','model','include','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a5b,0x153));var _0xb1a5=function(_0x4a0724,_0x3d5454){_0x4a0724=_0x4a0724-0x0;var _0x2c1635=_0x1a5b[_0x4a0724];return _0x2c1635;};'use strict';var _=require(_0xb1a5('0x0'));var util=require(_0xb1a5('0x1'));var moment=require(_0xb1a5('0x2'));var BPromise=require(_0xb1a5('0x3'));var rs=require(_0xb1a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1a5('0x5'))['db'];var utils=require(_0xb1a5('0x6'));var logger=require(_0xb1a5('0x7'))(_0xb1a5('0x8'));var config=require(_0xb1a5('0x9'));var jayson=require(_0xb1a5('0xa'));var client=jayson[_0xb1a5('0xb')][_0xb1a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f433e,_0x2a315d,_0x5a40a4){return new BPromise(function(_0x411797,_0x11f5c8){return client[_0xb1a5('0xd')](_0x3f433e,_0x5a40a4)[_0xb1a5('0xe')](function(_0x3fd94e){logger[_0xb1a5('0xf')](_0xb1a5('0x10'),_0x2a315d,_0xb1a5('0x11'));logger[_0xb1a5('0x12')](_0xb1a5('0x13'),_0x2a315d,'request\x20sent',JSON[_0xb1a5('0x14')](_0x3fd94e));if(_0x3fd94e[_0xb1a5('0x15')]){if(_0x3fd94e[_0xb1a5('0x15')][_0xb1a5('0x16')]===0x1f4){logger[_0xb1a5('0x15')](_0xb1a5('0x10'),_0x2a315d,_0x3fd94e[_0xb1a5('0x15')]['message']);return _0x11f5c8(_0x3fd94e['error'][_0xb1a5('0x17')]);}logger[_0xb1a5('0x15')]('MailServerIn,\x20%s,\x20%s',_0x2a315d,_0x3fd94e['error'][_0xb1a5('0x17')]);return _0x411797(_0x3fd94e[_0xb1a5('0x15')]['message']);}else{logger['info'](_0xb1a5('0x10'),_0x2a315d,'request\x20sent');_0x411797(_0x3fd94e['result'][_0xb1a5('0x17')]);}})['catch'](function(_0x4bd264){logger[_0xb1a5('0x15')](_0xb1a5('0x10'),_0x2a315d,_0x4bd264);_0x11f5c8(_0x4bd264);});});}exports[_0xb1a5('0x18')]=function(_0x3d5b5b){var _0x2be49e=this;return new Promise(function(_0x5332d3,_0x31274f){return db[_0xb1a5('0x19')]['findAll']({'raw':_0x3d5b5b['options']?_0x3d5b5b['options'][_0xb1a5('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d5b5b[_0xb1a5('0x1b')]?_0x3d5b5b['options']['where']||null:null,'attributes':_0x3d5b5b['options']?_0x3d5b5b[_0xb1a5('0x1b')]['attributes']||null:null,'limit':_0x3d5b5b[_0xb1a5('0x1b')]?_0x3d5b5b['options'][_0xb1a5('0x1c')]||null:null,'include':_0x3d5b5b[_0xb1a5('0x1b')]?_0x3d5b5b[_0xb1a5('0x1b')]['include']?_[_0xb1a5('0x1d')](_0x3d5b5b[_0xb1a5('0x1b')]['include'],function(_0x157a1c){return{'model':db[_0x157a1c[_0xb1a5('0x1e')]],'as':_0x157a1c['as'],'attributes':_0x157a1c['attributes'],'include':_0x157a1c[_0xb1a5('0x1f')]?_[_0xb1a5('0x1d')](_0x157a1c[_0xb1a5('0x1f')],function(_0x38da5b){return{'model':db[_0x38da5b[_0xb1a5('0x1e')]],'as':_0x38da5b['as'],'attributes':_0x38da5b['attributes'],'include':_0x38da5b[_0xb1a5('0x1f')]?_[_0xb1a5('0x1d')](_0x38da5b[_0xb1a5('0x1f')],function(_0x2e657a){return{'model':db[_0x2e657a['model']],'as':_0x2e657a['as'],'attributes':_0x2e657a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1a5('0xe')](function(_0x16c029){logger[_0xb1a5('0xf')]('GetMailServerIn',_0x3d5b5b);logger[_0xb1a5('0x12')](_0xb1a5('0x18'),_0x3d5b5b,JSON[_0xb1a5('0x14')](_0x16c029));_0x5332d3(_0x16c029);})[_0xb1a5('0x20')](function(_0x13eaa9){logger[_0xb1a5('0x15')]('GetMailServerIn',_0x13eaa9[_0xb1a5('0x17')],_0x3d5b5b);_0x31274f(_0x2be49e['error'](0x1f4,_0x13eaa9[_0xb1a5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c06b50b..eacf78d 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7a54,0x106));var _0x47a5=function(_0x19f235,_0xa07bb6){_0x19f235=_0x19f235-0x0;var _0x54f0ee=_0x7a54[_0x19f235];return _0x54f0ee;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7a54,0x106));var _0x47a5=function(_0x3b0ca8,_0x5776bc){_0x3b0ca8=_0x3b0ca8-0x0;var _0x544e59=_0x7a54[_0x3b0ca8];return _0x544e59;};'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 91dae3f..0efa0c1 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 _0xb10b=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x13f58e,_0x265b14){_0x13f58e=_0x13f58e-0x0;var _0x47f915=_0xb10b[_0x13f58e];return _0x47f915;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'description':{'type':Sequelize[_0xbb10('0x1')]},'host':{'type':Sequelize[_0xbb10('0x1')]},'user':{'type':Sequelize[_0xbb10('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbb10('0x2')]},'secure':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xbb10('0x1')]},'authentication':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4fc2=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x464ae3,_0x33b434){var _0x9745e9=function(_0x5961fc){while(--_0x5961fc){_0x464ae3['push'](_0x464ae3['shift']());}};_0x9745e9(++_0x33b434);}(_0x4fc2,0x111));var _0x24fc=function(_0x58c7b0,_0x4cb178){_0x58c7b0=_0x58c7b0-0x0;var _0x22a17d=_0x4fc2[_0x58c7b0];return _0x22a17d;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'description':{'type':Sequelize[_0x24fc('0x2')]},'host':{'type':Sequelize[_0x24fc('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x24fc('0x2')]},'port':{'type':Sequelize[_0x24fc('0x3')]},'secure':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index c31b522..69d239c 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 _0xbdae=['filters','intersection','fields','attributes','length','model','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x4ac9c3,_0x234b2c){var _0x5e5fcb=function(_0x9a2d1b){while(--_0x9a2d1b){_0x4ac9c3['push'](_0x4ac9c3['shift']());}};_0x5e5fcb(++_0x234b2c);}(_0xbdae,0xa7));var _0xebda=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0xbdae[_0x53b594];return _0x1e616f;};'use strict';var emlformat=require(_0xebda('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xebda('0x1'));var rp=require(_0xebda('0x2'));var moment=require(_0xebda('0x3'));var BPromise=require(_0xebda('0x4'));var Mustache=require(_0xebda('0x5'));var util=require(_0xebda('0x6'));var path=require(_0xebda('0x7'));var sox=require(_0xebda('0x8'));var csv=require(_0xebda('0x9'));var ejs=require(_0xebda('0xa'));var fs=require('fs');var fs_extra=require(_0xebda('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xebda('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebda('0xd'));var Papa=require(_0xebda('0xe'));var Redis=require(_0xebda('0xf'));var authService=require(_0xebda('0x10'));var qs=require(_0xebda('0x11'));var as=require(_0xebda('0x12'));var hardwareService=require(_0xebda('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xebda('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xebda('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9f9c06,_0x3fb819){_0x3fb819=_0x3fb819||0xcc;return function(_0x456682){if(_0x456682){return _0x9f9c06[_0xebda('0x16')](_0x3fb819);}return _0x9f9c06[_0xebda('0x17')](_0x3fb819)[_0xebda('0x18')]();};}function respondWithResult(_0x478582,_0x3c3707){_0x3c3707=_0x3c3707||0xc8;return function(_0x5ab04f){if(_0x5ab04f){return _0x478582[_0xebda('0x17')](_0x3c3707)[_0xebda('0x19')](_0x5ab04f);}};}function respondWithFilteredResult(_0x337716,_0x297ff8){return function(_0x57d06b){if(_0x57d06b){var _0x231ba4=typeof _0x297ff8['offset']==='undefined'&&typeof _0x297ff8[_0xebda('0x1a')]==='undefined';var _0x1761cd=_0x57d06b[_0xebda('0x1b')];var _0x253c16=_0x231ba4?0x0:_0x297ff8[_0xebda('0x1c')];var _0x568e4e=_0x231ba4?_0x57d06b[_0xebda('0x1b')]:_0x297ff8[_0xebda('0x1c')]+_0x297ff8[_0xebda('0x1a')];var _0x397554;if(_0x568e4e>=_0x1761cd){_0x568e4e=_0x1761cd;_0x397554=0xc8;}else{_0x397554=0xce;}_0x337716['status'](_0x397554);return _0x337716['set'](_0xebda('0x1d'),_0x253c16+'-'+_0x568e4e+'/'+_0x1761cd)[_0xebda('0x19')](_0x57d06b);}return null;};}function patchUpdates(_0x5d8e39){return function(_0xb219b){try{jsonpatch[_0xebda('0x1e')](_0xb219b,_0x5d8e39,!![]);}catch(_0x3d7485){return BPromise[_0xebda('0x1f')](_0x3d7485);}return _0xb219b[_0xebda('0x20')]();};}function saveUpdates(_0x2a4a6f,_0x43ea2e){return function(_0x1e8f42){if(_0x1e8f42){return _0x1e8f42[_0xebda('0x21')](_0x2a4a6f)[_0xebda('0x22')](function(_0x493f86){return _0x493f86;});}return null;};}function removeEntity(_0xd00a35,_0x35383d){return function(_0x31c47a){if(_0x31c47a){return _0x31c47a[_0xebda('0x23')]()['then'](function(){_0xd00a35[_0xebda('0x17')](0xcc)[_0xebda('0x18')]();});}};}function handleEntityNotFound(_0x273ddd,_0x1f1bfd){return function(_0x570752){if(!_0x570752){_0x273ddd[_0xebda('0x16')](0x194);}return _0x570752;};}function handleError(_0x305950,_0x30eb09){_0x30eb09=_0x30eb09||0x1f4;return function(_0x23c871){logger[_0xebda('0x24')](_0x23c871[_0xebda('0x25')]);if(_0x23c871[_0xebda('0x26')]){delete _0x23c871[_0xebda('0x26')];}_0x305950[_0xebda('0x17')](_0x30eb09)[_0xebda('0x27')](_0x23c871);};}exports[_0xebda('0x28')]=function(_0x4329e1,_0x240649){var _0x45644c={},_0x18ecaf={},_0x31a42e={'count':0x0,'rows':[]};var _0x2c1e5c=_['map'](db[_0xebda('0x29')][_0xebda('0x2a')],function(_0x3974a9){return{'name':_0x3974a9[_0xebda('0x2b')],'type':_0x3974a9[_0xebda('0x2c')][_0xebda('0x2d')]};});_0x18ecaf['model']=_[_0xebda('0x2e')](_0x2c1e5c,_0xebda('0x26'));_0x18ecaf[_0xebda('0x2f')]=_[_0xebda('0x30')](_0x4329e1[_0xebda('0x2f')]);_0x18ecaf[_0xebda('0x31')]=_['intersection'](_0x18ecaf['model'],_0x18ecaf[_0xebda('0x2f')]);_0x45644c['attributes']=_[_0xebda('0x32')](_0x18ecaf['model'],qs[_0xebda('0x33')](_0x4329e1['query']['fields']));_0x45644c[_0xebda('0x34')]=_0x45644c['attributes'][_0xebda('0x35')]?_0x45644c[_0xebda('0x34')]:_0x18ecaf[_0xebda('0x36')];if(!_0x4329e1[_0xebda('0x2f')]['hasOwnProperty']('nolimit')){_0x45644c['limit']=qs['limit'](_0x4329e1[_0xebda('0x2f')][_0xebda('0x1a')]);_0x45644c[_0xebda('0x1c')]=qs['offset'](_0x4329e1[_0xebda('0x2f')]['offset']);}_0x45644c[_0xebda('0x37')]=qs[_0xebda('0x38')](_0x4329e1['query']['sort']);_0x45644c[_0xebda('0x39')]=qs[_0xebda('0x31')](_[_0xebda('0x3a')](_0x4329e1[_0xebda('0x2f')],_0x18ecaf[_0xebda('0x31')]),_0x2c1e5c);if(_0x4329e1['query']['filter']){_0x45644c[_0xebda('0x39')]=_[_0xebda('0x3b')](_0x45644c[_0xebda('0x39')],{'$or':_[_0xebda('0x2e')](_0x2c1e5c,function(_0x37416b){if(_0x37416b[_0xebda('0x2c')]!=='VIRTUAL'){var _0x2b4784={};_0x2b4784[_0x37416b[_0xebda('0x26')]]={'$like':'%'+_0x4329e1[_0xebda('0x2f')][_0xebda('0x3c')]+'%'};return _0x2b4784;}})});}_0x45644c=_[_0xebda('0x3b')]({},_0x45644c,_0x4329e1[_0xebda('0x3d')]);var _0x152974={'where':_0x45644c[_0xebda('0x39')]};return db[_0xebda('0x29')][_0xebda('0x1b')](_0x152974)[_0xebda('0x22')](function(_0x8713a7){_0x31a42e[_0xebda('0x1b')]=_0x8713a7;if(_0x4329e1[_0xebda('0x2f')][_0xebda('0x3e')]){_0x45644c[_0xebda('0x3f')]=[{'all':!![]}];}return db[_0xebda('0x29')][_0xebda('0x40')](_0x45644c);})[_0xebda('0x22')](function(_0xeddb34){_0x31a42e[_0xebda('0x41')]=_0xeddb34;return _0x31a42e;})[_0xebda('0x22')](respondWithFilteredResult(_0x240649,_0x45644c))[_0xebda('0x42')](handleError(_0x240649,null));};exports[_0xebda('0x43')]=function(_0x228851,_0x5cdd7e){var _0x253607={'raw':!![],'where':{'id':_0x228851[_0xebda('0x44')]['id']}},_0x5e827a={};_0x5e827a[_0xebda('0x36')]=_['keys'](db[_0xebda('0x29')]['rawAttributes']);_0x5e827a['query']=_[_0xebda('0x30')](_0x228851['query']);_0x5e827a[_0xebda('0x31')]=_[_0xebda('0x32')](_0x5e827a[_0xebda('0x36')],_0x5e827a['query']);_0x253607[_0xebda('0x34')]=_['intersection'](_0x5e827a[_0xebda('0x36')],qs[_0xebda('0x33')](_0x228851[_0xebda('0x2f')]['fields']));_0x253607[_0xebda('0x34')]=_0x253607[_0xebda('0x34')][_0xebda('0x35')]?_0x253607[_0xebda('0x34')]:_0x5e827a['model'];if(_0x228851[_0xebda('0x2f')][_0xebda('0x3e')]){_0x253607[_0xebda('0x3f')]=[{'all':!![]}];}_0x253607=_[_0xebda('0x3b')]({},_0x253607,_0x228851[_0xebda('0x3d')]);return db[_0xebda('0x29')][_0xebda('0x45')](_0x253607)['then'](handleEntityNotFound(_0x5cdd7e,null))[_0xebda('0x22')](respondWithResult(_0x5cdd7e,null))[_0xebda('0x42')](handleError(_0x5cdd7e,null));};exports['create']=function(_0x32ae07,_0x215cf0){return db[_0xebda('0x29')][_0xebda('0x46')](_0x32ae07[_0xebda('0x47')],{})[_0xebda('0x22')](respondWithResult(_0x215cf0,0xc9))['catch'](handleError(_0x215cf0,null));};exports[_0xebda('0x21')]=function(_0x428d25,_0x298ce9){if(_0x428d25[_0xebda('0x47')]['id']){delete _0x428d25[_0xebda('0x47')]['id'];}return db[_0xebda('0x29')][_0xebda('0x45')]({'where':{'id':_0x428d25[_0xebda('0x44')]['id']}})[_0xebda('0x22')](handleEntityNotFound(_0x298ce9,null))[_0xebda('0x22')](saveUpdates(_0x428d25[_0xebda('0x47')],null))[_0xebda('0x22')](respondWithResult(_0x298ce9,null))['catch'](handleError(_0x298ce9,null));};exports['destroy']=function(_0x4c8383,_0x3abf7a){return db[_0xebda('0x29')][_0xebda('0x45')]({'where':{'id':_0x4c8383['params']['id']}})[_0xebda('0x22')](handleEntityNotFound(_0x3abf7a,null))['then'](removeEntity(_0x3abf7a,null))[_0xebda('0x42')](handleError(_0x3abf7a,null));}; \ No newline at end of file +var _0x6ad2=['catch','params','options','find','create','body','update','rimraf','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x1a3b58,_0xd5ba9a){var _0x1c0814=function(_0x3f3878){while(--_0x3f3878){_0x1a3b58['push'](_0x1a3b58['shift']());}};_0x1c0814(++_0xd5ba9a);}(_0x6ad2,0x127));var _0x26ad=function(_0x3500e7,_0x38ea3b){_0x3500e7=_0x3500e7-0x0;var _0x177cfe=_0x6ad2[_0x3500e7];return _0x177cfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x26ad('0x1'));var moment=require('moment');var BPromise=require(_0x26ad('0x2'));var Mustache=require('mustache');var util=require(_0x26ad('0x3'));var path=require(_0x26ad('0x4'));var sox=require(_0x26ad('0x5'));var csv=require('to-csv');var ejs=require(_0x26ad('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26ad('0x7'));var squel=require('squel');var crypto=require(_0x26ad('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x26ad('0x9'));var querystring=require('querystring');var Papa=require(_0x26ad('0xa'));var Redis=require('ioredis');var authService=require(_0x26ad('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x26ad('0xc'));var hardwareService=require(_0x26ad('0xd'));var logger=require(_0x26ad('0xe'))(_0x26ad('0xf'));var utils=require(_0x26ad('0x10'));var config=require(_0x26ad('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x26ad('0x12'))['db'];function respondWithStatusCode(_0x1b7cf7,_0x2df155){_0x2df155=_0x2df155||0xcc;return function(_0x20afba){if(_0x20afba){return _0x1b7cf7[_0x26ad('0x13')](_0x2df155);}return _0x1b7cf7[_0x26ad('0x14')](_0x2df155)[_0x26ad('0x15')]();};}function respondWithResult(_0x59dd0b,_0x2656a0){_0x2656a0=_0x2656a0||0xc8;return function(_0x1c9cb9){if(_0x1c9cb9){return _0x59dd0b['status'](_0x2656a0)[_0x26ad('0x16')](_0x1c9cb9);}};}function respondWithFilteredResult(_0x280795,_0x55e0e5){return function(_0x37142a){if(_0x37142a){var _0x47e64c=typeof _0x55e0e5[_0x26ad('0x17')]==='undefined'&&typeof _0x55e0e5['limit']===_0x26ad('0x18');var _0x199b57=_0x37142a[_0x26ad('0x19')];var _0x5bdfad=_0x47e64c?0x0:_0x55e0e5[_0x26ad('0x17')];var _0x28170e=_0x47e64c?_0x37142a[_0x26ad('0x19')]:_0x55e0e5[_0x26ad('0x17')]+_0x55e0e5[_0x26ad('0x1a')];var _0x441b25;if(_0x28170e>=_0x199b57){_0x28170e=_0x199b57;_0x441b25=0xc8;}else{_0x441b25=0xce;}_0x280795['status'](_0x441b25);return _0x280795[_0x26ad('0x1b')](_0x26ad('0x1c'),_0x5bdfad+'-'+_0x28170e+'/'+_0x199b57)['json'](_0x37142a);}return null;};}function patchUpdates(_0x2e8ccb){return function(_0x2a1db7){try{jsonpatch[_0x26ad('0x1d')](_0x2a1db7,_0x2e8ccb,!![]);}catch(_0x1c5f3d){return BPromise[_0x26ad('0x1e')](_0x1c5f3d);}return _0x2a1db7[_0x26ad('0x1f')]();};}function saveUpdates(_0x70ae28,_0x30e8da){return function(_0x30819a){if(_0x30819a){return _0x30819a['update'](_0x70ae28)[_0x26ad('0x20')](function(_0x56b0ba){return _0x56b0ba;});}return null;};}function removeEntity(_0x4a9de9,_0x16573c){return function(_0x3d8f68){if(_0x3d8f68){return _0x3d8f68[_0x26ad('0x21')]()[_0x26ad('0x20')](function(){_0x4a9de9[_0x26ad('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58bc63,_0x20243a){return function(_0x24aed6){if(!_0x24aed6){_0x58bc63[_0x26ad('0x13')](0x194);}return _0x24aed6;};}function handleError(_0x4832cc,_0x3d71cc){_0x3d71cc=_0x3d71cc||0x1f4;return function(_0x25386b){logger[_0x26ad('0x22')](_0x25386b[_0x26ad('0x23')]);if(_0x25386b[_0x26ad('0x24')]){delete _0x25386b[_0x26ad('0x24')];}_0x4832cc[_0x26ad('0x14')](_0x3d71cc)[_0x26ad('0x25')](_0x25386b);};}exports[_0x26ad('0x26')]=function(_0x5bd9e1,_0x4fb07b){var _0x115f15={},_0x501da1={},_0x44fd7f={'count':0x0,'rows':[]};var _0x2a34ee=_[_0x26ad('0x27')](db[_0x26ad('0x28')][_0x26ad('0x29')],function(_0xf7829b){return{'name':_0xf7829b[_0x26ad('0x2a')],'type':_0xf7829b[_0x26ad('0x2b')][_0x26ad('0x2c')]};});_0x501da1['model']=_[_0x26ad('0x27')](_0x2a34ee,_0x26ad('0x24'));_0x501da1[_0x26ad('0x2d')]=_[_0x26ad('0x2e')](_0x5bd9e1[_0x26ad('0x2d')]);_0x501da1[_0x26ad('0x2f')]=_[_0x26ad('0x30')](_0x501da1[_0x26ad('0x31')],_0x501da1[_0x26ad('0x2d')]);_0x115f15[_0x26ad('0x32')]=_[_0x26ad('0x30')](_0x501da1['model'],qs[_0x26ad('0x33')](_0x5bd9e1[_0x26ad('0x2d')]['fields']));_0x115f15['attributes']=_0x115f15[_0x26ad('0x32')][_0x26ad('0x34')]?_0x115f15[_0x26ad('0x32')]:_0x501da1['model'];if(!_0x5bd9e1['query'][_0x26ad('0x35')](_0x26ad('0x36'))){_0x115f15[_0x26ad('0x1a')]=qs[_0x26ad('0x1a')](_0x5bd9e1[_0x26ad('0x2d')][_0x26ad('0x1a')]);_0x115f15[_0x26ad('0x17')]=qs[_0x26ad('0x17')](_0x5bd9e1['query'][_0x26ad('0x17')]);}_0x115f15['order']=qs[_0x26ad('0x37')](_0x5bd9e1[_0x26ad('0x2d')][_0x26ad('0x37')]);_0x115f15['where']=qs[_0x26ad('0x2f')](_[_0x26ad('0x38')](_0x5bd9e1[_0x26ad('0x2d')],_0x501da1[_0x26ad('0x2f')]),_0x2a34ee);if(_0x5bd9e1['query'][_0x26ad('0x39')]){_0x115f15['where']=_[_0x26ad('0x3a')](_0x115f15[_0x26ad('0x3b')],{'$or':_[_0x26ad('0x27')](_0x2a34ee,function(_0x32b0fa){if(_0x32b0fa[_0x26ad('0x2b')]!==_0x26ad('0x3c')){var _0x59d958={};_0x59d958[_0x32b0fa[_0x26ad('0x24')]]={'$like':'%'+_0x5bd9e1[_0x26ad('0x2d')][_0x26ad('0x39')]+'%'};return _0x59d958;}})});}_0x115f15=_[_0x26ad('0x3a')]({},_0x115f15,_0x5bd9e1['options']);var _0x3ab541={'where':_0x115f15[_0x26ad('0x3b')]};return db[_0x26ad('0x28')][_0x26ad('0x19')](_0x3ab541)[_0x26ad('0x20')](function(_0x3eaaa7){_0x44fd7f[_0x26ad('0x19')]=_0x3eaaa7;if(_0x5bd9e1[_0x26ad('0x2d')][_0x26ad('0x3d')]){_0x115f15[_0x26ad('0x3e')]=[{'all':!![]}];}return db[_0x26ad('0x28')][_0x26ad('0x3f')](_0x115f15);})[_0x26ad('0x20')](function(_0x3e56ff){_0x44fd7f[_0x26ad('0x40')]=_0x3e56ff;return _0x44fd7f;})[_0x26ad('0x20')](respondWithFilteredResult(_0x4fb07b,_0x115f15))[_0x26ad('0x41')](handleError(_0x4fb07b,null));};exports['show']=function(_0x487f58,_0x489861){var _0x229337={'raw':!![],'where':{'id':_0x487f58[_0x26ad('0x42')]['id']}},_0x26905b={};_0x26905b[_0x26ad('0x31')]=_['keys'](db[_0x26ad('0x28')][_0x26ad('0x29')]);_0x26905b['query']=_[_0x26ad('0x2e')](_0x487f58[_0x26ad('0x2d')]);_0x26905b[_0x26ad('0x2f')]=_[_0x26ad('0x30')](_0x26905b[_0x26ad('0x31')],_0x26905b[_0x26ad('0x2d')]);_0x229337[_0x26ad('0x32')]=_[_0x26ad('0x30')](_0x26905b[_0x26ad('0x31')],qs[_0x26ad('0x33')](_0x487f58[_0x26ad('0x2d')][_0x26ad('0x33')]));_0x229337['attributes']=_0x229337[_0x26ad('0x32')][_0x26ad('0x34')]?_0x229337[_0x26ad('0x32')]:_0x26905b[_0x26ad('0x31')];if(_0x487f58[_0x26ad('0x2d')][_0x26ad('0x3d')]){_0x229337['include']=[{'all':!![]}];}_0x229337=_[_0x26ad('0x3a')]({},_0x229337,_0x487f58[_0x26ad('0x43')]);return db[_0x26ad('0x28')][_0x26ad('0x44')](_0x229337)['then'](handleEntityNotFound(_0x489861,null))[_0x26ad('0x20')](respondWithResult(_0x489861,null))[_0x26ad('0x41')](handleError(_0x489861,null));};exports[_0x26ad('0x45')]=function(_0x1fdd78,_0x4b1546){return db[_0x26ad('0x28')][_0x26ad('0x45')](_0x1fdd78[_0x26ad('0x46')],{})['then'](respondWithResult(_0x4b1546,0xc9))[_0x26ad('0x41')](handleError(_0x4b1546,null));};exports[_0x26ad('0x47')]=function(_0x483442,_0x47f004){if(_0x483442['body']['id']){delete _0x483442[_0x26ad('0x46')]['id'];}return db['MailServerOut'][_0x26ad('0x44')]({'where':{'id':_0x483442['params']['id']}})[_0x26ad('0x20')](handleEntityNotFound(_0x47f004,null))['then'](saveUpdates(_0x483442[_0x26ad('0x46')],null))[_0x26ad('0x20')](respondWithResult(_0x47f004,null))['catch'](handleError(_0x47f004,null));};exports[_0x26ad('0x21')]=function(_0x4ba29a,_0xd25c){return db['MailServerOut'][_0x26ad('0x44')]({'where':{'id':_0x4ba29a[_0x26ad('0x42')]['id']}})['then'](handleEntityNotFound(_0xd25c,null))[_0x26ad('0x20')](removeEntity(_0xd25c,null))[_0x26ad('0x41')](handleError(_0xd25c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1708512..c90baf7 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 _0x4a1c=['bluebird','request-promise','exports','mail_servers_out','util','moment'];(function(_0x310966,_0x38acb8){var _0x24e9bb=function(_0x39a79e){while(--_0x39a79e){_0x310966['push'](_0x310966['shift']());}};_0x24e9bb(++_0x38acb8);}(_0x4a1c,0x148));var _0xc4a1=function(_0x4b7f28,_0x27d23a){_0x4b7f28=_0x4b7f28-0x0;var _0xf5b553=_0x4a1c[_0x4b7f28];return _0xf5b553;};'use strict';var _=require('lodash');var util=require(_0xc4a1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc4a1('0x1'));var BPromise=require(_0xc4a1('0x2'));var rp=require(_0xc4a1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xc4a1('0x4')]=function(_0x2ce03c,_0x227405){return _0x2ce03c['define']('MailServerOut',attributes,{'tableName':_0xc4a1('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x391f=['request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird'];(function(_0x232ddf,_0x26d183){var _0x503d25=function(_0x49aa22){while(--_0x49aa22){_0x232ddf['push'](_0x232ddf['shift']());}};_0x503d25(++_0x26d183);}(_0x391f,0x1b5));var _0xf391=function(_0x587a46,_0x2bac43){_0x587a46=_0x587a46-0x0;var _0x13734d=_0x391f[_0x587a46];return _0x13734d;};'use strict';var _=require(_0xf391('0x0'));var util=require('util');var logger=require(_0xf391('0x1'))(_0xf391('0x2'));var moment=require(_0xf391('0x3'));var BPromise=require(_0xf391('0x4'));var rp=require(_0xf391('0x5'));var fs=require('fs');var path=require(_0xf391('0x6'));var rimraf=require('rimraf');var config=require(_0xf391('0x7'));var attributes=require(_0xf391('0x8'));module[_0xf391('0x9')]=function(_0x21e188,_0x2a53c8){return _0x21e188[_0xf391('0xa')](_0xf391('0xb'),attributes,{'tableName':_0xf391('0xc'),'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 2991b67..5ad823d 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x53bc60,_0x373c0d){var _0x4f91b9=function(_0xfa53ef){while(--_0xfa53ef){_0x53bc60['push'](_0x53bc60['shift']());}};_0x4f91b9(++_0x373c0d);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf382e5,_0x4c8690){_0xf382e5=_0xf382e5-0x0;var _0x3272b6=_0x5f2f[_0xf382e5];return _0x3272b6;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3c3543,_0x3b2518){var _0x24f503=function(_0x586f52){while(--_0x586f52){_0x3c3543['push'](_0x3c3543['shift']());}};_0x24f503(++_0x3b2518);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0b91b97..9540fc9 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 _0xd82d=['create','put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x582942,_0x6c75b0){var _0x2647e5=function(_0x303931){while(--_0x303931){_0x582942['push'](_0x582942['shift']());}};_0x2647e5(++_0x6c75b0);}(_0xd82d,0xeb));var _0xdd82=function(_0x2f0f13,_0x47ef44){_0x2f0f13=_0x2f0f13-0x0;var _0x20e7a8=_0xd82d[_0x2f0f13];return _0x20e7a8;};'use strict';var multer=require(_0xdd82('0x0'));var util=require(_0xdd82('0x1'));var path=require(_0xdd82('0x2'));var timeout=require(_0xdd82('0x3'));var express=require(_0xdd82('0x4'));var router=express[_0xdd82('0x5')]();var fs_extra=require(_0xdd82('0x6'));var auth=require(_0xdd82('0x7'));var interaction=require(_0xdd82('0x8'));var config=require('../../config/environment');var controller=require(_0xdd82('0x9'));router[_0xdd82('0xa')]('/',auth[_0xdd82('0xb')](),controller[_0xdd82('0xc')]);router[_0xdd82('0xa')](_0xdd82('0xd'),auth[_0xdd82('0xb')](),controller[_0xdd82('0xe')]);router[_0xdd82('0xa')]('/:id',auth[_0xdd82('0xb')](),controller[_0xdd82('0xf')]);router[_0xdd82('0x10')]('/',auth['isAuthenticated'](),controller[_0xdd82('0x11')]);router[_0xdd82('0x12')](_0xdd82('0x13'),auth[_0xdd82('0xb')](),controller[_0xdd82('0x14')]);router['delete'](_0xdd82('0x13'),auth[_0xdd82('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x52d3=['index','get','/describe','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x57261f,_0x588b8a){var _0x204a48=function(_0x5a9e6b){while(--_0x5a9e6b){_0x57261f['push'](_0x57261f['shift']());}};_0x204a48(++_0x588b8a);}(_0x52d3,0x15f));var _0x352d=function(_0x20c55d,_0x18f009){_0x20c55d=_0x20c55d-0x0;var _0x9842fd=_0x52d3[_0x20c55d];return _0x9842fd;};'use strict';var multer=require('multer');var util=require(_0x352d('0x0'));var path=require(_0x352d('0x1'));var timeout=require('connect-timeout');var express=require(_0x352d('0x2'));var router=express[_0x352d('0x3')]();var fs_extra=require(_0x352d('0x4'));var auth=require(_0x352d('0x5'));var interaction=require(_0x352d('0x6'));var config=require(_0x352d('0x7'));var controller=require(_0x352d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x352d('0x9')]);router[_0x352d('0xa')](_0x352d('0xb'),auth[_0x352d('0xc')](),controller['describe']);router['get'](_0x352d('0xd'),auth[_0x352d('0xc')](),controller[_0x352d('0xe')]);router[_0x352d('0xf')]('/',auth[_0x352d('0xc')](),controller['create']);router[_0x352d('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x352d('0x11')](_0x352d('0xd'),auth[_0x352d('0xc')](),controller[_0x352d('0x12')]);module[_0x352d('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 a9362d2..4d2b804 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 _0xb4c7=['STRING','name','sequelize','exports'];(function(_0x386f45,_0x767b67){var _0x1e9ce3=function(_0x53e934){while(--_0x53e934){_0x386f45['push'](_0x386f45['shift']());}};_0x1e9ce3(++_0x767b67);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x36563e,_0x5ac884){_0x36563e=_0x36563e-0x0;var _0x4cee35=_0xb4c7[_0x36563e];return _0x4cee35;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'unique':_0x7b4c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7b4c('0x2')]}}; \ No newline at end of file +var _0xd101=['name','sequelize','STRING'];(function(_0x2c8a17,_0x1841c4){var _0x126c37=function(_0x2b733d){while(--_0x2b733d){_0x2c8a17['push'](_0x2c8a17['shift']());}};_0x126c37(++_0x1841c4);}(_0xd101,0xc1));var _0x1d10=function(_0x20dbbc,_0x3b0e53){_0x20dbbc=_0x20dbbc-0x0;var _0x40fa67=_0xd101[_0x20dbbc];return _0x40fa67;};'use strict';var Sequelize=require(_0x1d10('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d10('0x1')],'unique':_0x1d10('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d10('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index e3746af..4ed2551 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 _0x1a91=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','end','error','stack','name','send','index','MailSubstatus','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x58caba,_0x1908e5){var _0x5f331e=function(_0x48662b){while(--_0x48662b){_0x58caba['push'](_0x58caba['shift']());}};_0x5f331e(++_0x1908e5);}(_0x1a91,0x12b));var _0x11a9=function(_0x5285d0,_0x3d424c){_0x5285d0=_0x5285d0-0x0;var _0x4dd0a2=_0x1a91[_0x5285d0];return _0x4dd0a2;};'use strict';var emlformat=require(_0x11a9('0x0'));var rimraf=require(_0x11a9('0x1'));var zipdir=require(_0x11a9('0x2'));var jsonpatch=require(_0x11a9('0x3'));var rp=require(_0x11a9('0x4'));var moment=require(_0x11a9('0x5'));var BPromise=require(_0x11a9('0x6'));var Mustache=require(_0x11a9('0x7'));var util=require(_0x11a9('0x8'));var path=require(_0x11a9('0x9'));var sox=require('sox');var csv=require(_0x11a9('0xa'));var ejs=require(_0x11a9('0xb'));var fs=require('fs');var fs_extra=require(_0x11a9('0xc'));var _=require('lodash');var squel=require(_0x11a9('0xd'));var crypto=require(_0x11a9('0xe'));var jsforce=require(_0x11a9('0xf'));var deskjs=require(_0x11a9('0x10'));var toCsv=require(_0x11a9('0xa'));var querystring=require(_0x11a9('0x11'));var Papa=require(_0x11a9('0x12'));var Redis=require(_0x11a9('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x11a9('0x14'));var as=require(_0x11a9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11a9('0x16'))(_0x11a9('0x17'));var utils=require('../../config/utils');var config=require(_0x11a9('0x18'));var licenseUtil=require(_0x11a9('0x19'));var db=require(_0x11a9('0x1a'))['db'];function respondWithStatusCode(_0x420e4d,_0xb72021){_0xb72021=_0xb72021||0xcc;return function(_0x4a1364){if(_0x4a1364){return _0x420e4d[_0x11a9('0x1b')](_0xb72021);}return _0x420e4d[_0x11a9('0x1c')](_0xb72021)['end']();};}function respondWithResult(_0x2816b9,_0x2478a6){_0x2478a6=_0x2478a6||0xc8;return function(_0x58333a){if(_0x58333a){return _0x2816b9[_0x11a9('0x1c')](_0x2478a6)['json'](_0x58333a);}};}function respondWithFilteredResult(_0x191210,_0x14f742){return function(_0x210d6f){if(_0x210d6f){var _0x12fa85=typeof _0x14f742['offset']===_0x11a9('0x1d')&&typeof _0x14f742[_0x11a9('0x1e')]===_0x11a9('0x1d');var _0x37d52a=_0x210d6f[_0x11a9('0x1f')];var _0x3e2036=_0x12fa85?0x0:_0x14f742[_0x11a9('0x20')];var _0x9b8927=_0x12fa85?_0x210d6f[_0x11a9('0x1f')]:_0x14f742[_0x11a9('0x20')]+_0x14f742[_0x11a9('0x1e')];var _0x58f14d;if(_0x9b8927>=_0x37d52a){_0x9b8927=_0x37d52a;_0x58f14d=0xc8;}else{_0x58f14d=0xce;}_0x191210['status'](_0x58f14d);return _0x191210[_0x11a9('0x21')](_0x11a9('0x22'),_0x3e2036+'-'+_0x9b8927+'/'+_0x37d52a)[_0x11a9('0x23')](_0x210d6f);}return null;};}function patchUpdates(_0x1fd7ba){return function(_0x1cd4eb){try{jsonpatch[_0x11a9('0x24')](_0x1cd4eb,_0x1fd7ba,!![]);}catch(_0x499356){return BPromise[_0x11a9('0x25')](_0x499356);}return _0x1cd4eb['save']();};}function saveUpdates(_0x2feea0,_0x59fe45){return function(_0x351381){if(_0x351381){return _0x351381[_0x11a9('0x26')](_0x2feea0)[_0x11a9('0x27')](function(_0x566ded){return _0x566ded;});}return null;};}function removeEntity(_0x593529,_0x542911){return function(_0x2f63c5){if(_0x2f63c5){return _0x2f63c5['destroy']()[_0x11a9('0x27')](function(){_0x593529['status'](0xcc)[_0x11a9('0x28')]();});}};}function handleEntityNotFound(_0x5f457b,_0x1e8611){return function(_0x2d408d){if(!_0x2d408d){_0x5f457b[_0x11a9('0x1b')](0x194);}return _0x2d408d;};}function handleError(_0x452805,_0x1abc13){_0x1abc13=_0x1abc13||0x1f4;return function(_0x7b0c3f){logger[_0x11a9('0x29')](_0x7b0c3f[_0x11a9('0x2a')]);if(_0x7b0c3f[_0x11a9('0x2b')]){delete _0x7b0c3f[_0x11a9('0x2b')];}_0x452805[_0x11a9('0x1c')](_0x1abc13)[_0x11a9('0x2c')](_0x7b0c3f);};}exports[_0x11a9('0x2d')]=function(_0x594f85,_0x5aab8a){var _0x828444={},_0x8c064b={},_0x5a450f={'count':0x0,'rows':[]};var _0x8fa5c3=_['map'](db[_0x11a9('0x2e')]['rawAttributes'],function(_0x1f163e){return{'name':_0x1f163e[_0x11a9('0x2f')],'type':_0x1f163e[_0x11a9('0x30')][_0x11a9('0x31')]};});_0x8c064b[_0x11a9('0x32')]=_[_0x11a9('0x33')](_0x8fa5c3,'name');_0x8c064b[_0x11a9('0x34')]=_[_0x11a9('0x35')](_0x594f85['query']);_0x8c064b[_0x11a9('0x36')]=_[_0x11a9('0x37')](_0x8c064b[_0x11a9('0x32')],_0x8c064b[_0x11a9('0x34')]);_0x828444[_0x11a9('0x38')]=_[_0x11a9('0x37')](_0x8c064b[_0x11a9('0x32')],qs[_0x11a9('0x39')](_0x594f85['query'][_0x11a9('0x39')]));_0x828444['attributes']=_0x828444[_0x11a9('0x38')][_0x11a9('0x3a')]?_0x828444[_0x11a9('0x38')]:_0x8c064b['model'];if(!_0x594f85['query']['hasOwnProperty'](_0x11a9('0x3b'))){_0x828444[_0x11a9('0x1e')]=qs[_0x11a9('0x1e')](_0x594f85[_0x11a9('0x34')][_0x11a9('0x1e')]);_0x828444['offset']=qs[_0x11a9('0x20')](_0x594f85['query'][_0x11a9('0x20')]);}_0x828444[_0x11a9('0x3c')]=qs['sort'](_0x594f85[_0x11a9('0x34')][_0x11a9('0x3d')]);_0x828444[_0x11a9('0x3e')]=qs['filters'](_[_0x11a9('0x3f')](_0x594f85[_0x11a9('0x34')],_0x8c064b['filters']),_0x8fa5c3);if(_0x594f85[_0x11a9('0x34')][_0x11a9('0x40')]){_0x828444[_0x11a9('0x3e')]=_[_0x11a9('0x41')](_0x828444['where'],{'$or':_[_0x11a9('0x33')](_0x8fa5c3,function(_0x52e34c){if(_0x52e34c[_0x11a9('0x30')]!==_0x11a9('0x42')){var _0x43e44f={};_0x43e44f[_0x52e34c['name']]={'$like':'%'+_0x594f85[_0x11a9('0x34')]['filter']+'%'};return _0x43e44f;}})});}_0x828444=_[_0x11a9('0x41')]({},_0x828444,_0x594f85[_0x11a9('0x43')]);var _0x4b5379={'where':_0x828444[_0x11a9('0x3e')]};return db[_0x11a9('0x2e')][_0x11a9('0x1f')](_0x4b5379)[_0x11a9('0x27')](function(_0x5fe60){_0x5a450f[_0x11a9('0x1f')]=_0x5fe60;if(_0x594f85[_0x11a9('0x34')]['includeAll']){_0x828444[_0x11a9('0x44')]=[{'all':!![]}];}return db[_0x11a9('0x2e')][_0x11a9('0x45')](_0x828444);})[_0x11a9('0x27')](function(_0x5a4119){_0x5a450f[_0x11a9('0x46')]=_0x5a4119;return _0x5a450f;})[_0x11a9('0x27')](respondWithFilteredResult(_0x5aab8a,_0x828444))['catch'](handleError(_0x5aab8a,null));};exports[_0x11a9('0x47')]=function(_0x4fc699,_0xf218be){var _0xa598ca={'raw':!![],'where':{'id':_0x4fc699['params']['id']}},_0x5f019c={};_0x5f019c[_0x11a9('0x32')]=_['keys'](db[_0x11a9('0x2e')][_0x11a9('0x48')]);_0x5f019c['query']=_['keys'](_0x4fc699[_0x11a9('0x34')]);_0x5f019c[_0x11a9('0x36')]=_[_0x11a9('0x37')](_0x5f019c['model'],_0x5f019c['query']);_0xa598ca[_0x11a9('0x38')]=_[_0x11a9('0x37')](_0x5f019c[_0x11a9('0x32')],qs[_0x11a9('0x39')](_0x4fc699[_0x11a9('0x34')][_0x11a9('0x39')]));_0xa598ca[_0x11a9('0x38')]=_0xa598ca['attributes'][_0x11a9('0x3a')]?_0xa598ca[_0x11a9('0x38')]:_0x5f019c[_0x11a9('0x32')];if(_0x4fc699[_0x11a9('0x34')][_0x11a9('0x49')]){_0xa598ca[_0x11a9('0x44')]=[{'all':!![]}];}_0xa598ca=_[_0x11a9('0x41')]({},_0xa598ca,_0x4fc699['options']);return db[_0x11a9('0x2e')][_0x11a9('0x4a')](_0xa598ca)[_0x11a9('0x27')](handleEntityNotFound(_0xf218be,null))['then'](respondWithResult(_0xf218be,null))[_0x11a9('0x4b')](handleError(_0xf218be,null));};exports[_0x11a9('0x4c')]=function(_0x3a48d0,_0x30e12b){return db['MailSubstatus']['create'](_0x3a48d0[_0x11a9('0x4d')],{})[_0x11a9('0x27')](respondWithResult(_0x30e12b,0xc9))[_0x11a9('0x4b')](handleError(_0x30e12b,null));};exports['update']=function(_0x346e78,_0x5b14c6){if(_0x346e78[_0x11a9('0x4d')]['id']){delete _0x346e78[_0x11a9('0x4d')]['id'];}return db[_0x11a9('0x2e')]['find']({'where':{'id':_0x346e78[_0x11a9('0x4e')]['id']}})[_0x11a9('0x27')](handleEntityNotFound(_0x5b14c6,null))[_0x11a9('0x27')](saveUpdates(_0x346e78[_0x11a9('0x4d')],null))[_0x11a9('0x27')](respondWithResult(_0x5b14c6,null))[_0x11a9('0x4b')](handleError(_0x5b14c6,null));};exports['destroy']=function(_0x40ba0a,_0x4152de){return db[_0x11a9('0x2e')]['find']({'where':{'id':_0x40ba0a['params']['id']}})[_0x11a9('0x27')](handleEntityNotFound(_0x4152de,null))[_0x11a9('0x27')](removeEntity(_0x4152de,null))['catch'](handleError(_0x4152de,null));};exports[_0x11a9('0x4f')]=function(_0x34e173,_0x15d42c){return db[_0x11a9('0x2e')][_0x11a9('0x4f')]()[_0x11a9('0x27')](respondWithResult(_0x15d42c,null))[_0x11a9('0x4b')](handleError(_0x15d42c,null));}; \ No newline at end of file +var _0x910c=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','MailSubstatus','include','catch','show','params','includeAll','find','create','body','destroy','describe','zip-dir','request-promise','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','reject','save','then','name','send','index','map','rawAttributes'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x910c,0x145));var _0xc910=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x910c[_0xbe40ad];return _0x50fac9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc910('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc910('0x1'));var moment=require('moment');var BPromise=require(_0xc910('0x2'));var Mustache=require(_0xc910('0x3'));var util=require(_0xc910('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc910('0x5'));var ejs=require(_0xc910('0x6'));var fs=require('fs');var fs_extra=require(_0xc910('0x7'));var _=require(_0xc910('0x8'));var squel=require(_0xc910('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc910('0xa'));var toCsv=require(_0xc910('0x5'));var querystring=require(_0xc910('0xb'));var Papa=require(_0xc910('0xc'));var Redis=require(_0xc910('0xd'));var authService=require(_0xc910('0xe'));var qs=require(_0xc910('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc910('0x10'));var logger=require(_0xc910('0x11'))(_0xc910('0x12'));var utils=require(_0xc910('0x13'));var config=require(_0xc910('0x14'));var licenseUtil=require(_0xc910('0x15'));var db=require(_0xc910('0x16'))['db'];function respondWithStatusCode(_0x2a0440,_0x2895b2){_0x2895b2=_0x2895b2||0xcc;return function(_0x7e5ee9){if(_0x7e5ee9){return _0x2a0440[_0xc910('0x17')](_0x2895b2);}return _0x2a0440[_0xc910('0x18')](_0x2895b2)[_0xc910('0x19')]();};}function respondWithResult(_0x3fb501,_0x38b9a4){_0x38b9a4=_0x38b9a4||0xc8;return function(_0x37f2ff){if(_0x37f2ff){return _0x3fb501[_0xc910('0x18')](_0x38b9a4)[_0xc910('0x1a')](_0x37f2ff);}};}function respondWithFilteredResult(_0x2ce639,_0x1abd85){return function(_0x476cab){if(_0x476cab){var _0x4152f5=typeof _0x1abd85['offset']==='undefined'&&typeof _0x1abd85['limit']===_0xc910('0x1b');var _0x59d65e=_0x476cab[_0xc910('0x1c')];var _0x301ff1=_0x4152f5?0x0:_0x1abd85['offset'];var _0x39d50c=_0x4152f5?_0x476cab[_0xc910('0x1c')]:_0x1abd85['offset']+_0x1abd85[_0xc910('0x1d')];var _0x80c110;if(_0x39d50c>=_0x59d65e){_0x39d50c=_0x59d65e;_0x80c110=0xc8;}else{_0x80c110=0xce;}_0x2ce639['status'](_0x80c110);return _0x2ce639[_0xc910('0x1e')](_0xc910('0x1f'),_0x301ff1+'-'+_0x39d50c+'/'+_0x59d65e)[_0xc910('0x1a')](_0x476cab);}return null;};}function patchUpdates(_0x5375e9){return function(_0x35f74f){try{jsonpatch['apply'](_0x35f74f,_0x5375e9,!![]);}catch(_0x384bdf){return BPromise[_0xc910('0x20')](_0x384bdf);}return _0x35f74f[_0xc910('0x21')]();};}function saveUpdates(_0x488a75,_0x30ede9){return function(_0x1892bf){if(_0x1892bf){return _0x1892bf['update'](_0x488a75)['then'](function(_0x4b4525){return _0x4b4525;});}return null;};}function removeEntity(_0x2ba744,_0x46fa0c){return function(_0x5d7e1b){if(_0x5d7e1b){return _0x5d7e1b['destroy']()[_0xc910('0x22')](function(){_0x2ba744['status'](0xcc)[_0xc910('0x19')]();});}};}function handleEntityNotFound(_0x2cae63,_0x167af9){return function(_0x4aa70d){if(!_0x4aa70d){_0x2cae63['sendStatus'](0x194);}return _0x4aa70d;};}function handleError(_0x192ccb,_0x2b896c){_0x2b896c=_0x2b896c||0x1f4;return function(_0x470f07){logger['error'](_0x470f07['stack']);if(_0x470f07[_0xc910('0x23')]){delete _0x470f07['name'];}_0x192ccb[_0xc910('0x18')](_0x2b896c)[_0xc910('0x24')](_0x470f07);};}exports[_0xc910('0x25')]=function(_0x2b3d1f,_0x495cb1){var _0x2c0e08={},_0xc4a2c5={},_0x481992={'count':0x0,'rows':[]};var _0x15045b=_[_0xc910('0x26')](db['MailSubstatus'][_0xc910('0x27')],function(_0x249f87){return{'name':_0x249f87[_0xc910('0x28')],'type':_0x249f87[_0xc910('0x29')][_0xc910('0x2a')]};});_0xc4a2c5[_0xc910('0x2b')]=_[_0xc910('0x26')](_0x15045b,'name');_0xc4a2c5[_0xc910('0x2c')]=_[_0xc910('0x2d')](_0x2b3d1f[_0xc910('0x2c')]);_0xc4a2c5['filters']=_[_0xc910('0x2e')](_0xc4a2c5[_0xc910('0x2b')],_0xc4a2c5[_0xc910('0x2c')]);_0x2c0e08[_0xc910('0x2f')]=_['intersection'](_0xc4a2c5[_0xc910('0x2b')],qs[_0xc910('0x30')](_0x2b3d1f[_0xc910('0x2c')][_0xc910('0x30')]));_0x2c0e08['attributes']=_0x2c0e08['attributes'][_0xc910('0x31')]?_0x2c0e08[_0xc910('0x2f')]:_0xc4a2c5[_0xc910('0x2b')];if(!_0x2b3d1f[_0xc910('0x2c')][_0xc910('0x32')](_0xc910('0x33'))){_0x2c0e08[_0xc910('0x1d')]=qs['limit'](_0x2b3d1f[_0xc910('0x2c')]['limit']);_0x2c0e08[_0xc910('0x34')]=qs[_0xc910('0x34')](_0x2b3d1f[_0xc910('0x2c')][_0xc910('0x34')]);}_0x2c0e08[_0xc910('0x35')]=qs[_0xc910('0x36')](_0x2b3d1f['query'][_0xc910('0x36')]);_0x2c0e08[_0xc910('0x37')]=qs[_0xc910('0x38')](_[_0xc910('0x39')](_0x2b3d1f[_0xc910('0x2c')],_0xc4a2c5[_0xc910('0x38')]),_0x15045b);if(_0x2b3d1f[_0xc910('0x2c')]['filter']){_0x2c0e08[_0xc910('0x37')]=_[_0xc910('0x3a')](_0x2c0e08['where'],{'$or':_['map'](_0x15045b,function(_0x464f71){if(_0x464f71[_0xc910('0x29')]!==_0xc910('0x3b')){var _0x42fe50={};_0x42fe50[_0x464f71[_0xc910('0x23')]]={'$like':'%'+_0x2b3d1f[_0xc910('0x2c')][_0xc910('0x3c')]+'%'};return _0x42fe50;}})});}_0x2c0e08=_[_0xc910('0x3a')]({},_0x2c0e08,_0x2b3d1f[_0xc910('0x3d')]);var _0x377b5c={'where':_0x2c0e08[_0xc910('0x37')]};return db[_0xc910('0x3e')][_0xc910('0x1c')](_0x377b5c)['then'](function(_0x4120ac){_0x481992[_0xc910('0x1c')]=_0x4120ac;if(_0x2b3d1f[_0xc910('0x2c')]['includeAll']){_0x2c0e08[_0xc910('0x3f')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x2c0e08);})[_0xc910('0x22')](function(_0x3e2f17){_0x481992['rows']=_0x3e2f17;return _0x481992;})[_0xc910('0x22')](respondWithFilteredResult(_0x495cb1,_0x2c0e08))[_0xc910('0x40')](handleError(_0x495cb1,null));};exports[_0xc910('0x41')]=function(_0x1b4e48,_0x30694d){var _0x28203d={'raw':!![],'where':{'id':_0x1b4e48[_0xc910('0x42')]['id']}},_0x5e93ae={};_0x5e93ae[_0xc910('0x2b')]=_[_0xc910('0x2d')](db[_0xc910('0x3e')][_0xc910('0x27')]);_0x5e93ae['query']=_[_0xc910('0x2d')](_0x1b4e48[_0xc910('0x2c')]);_0x5e93ae[_0xc910('0x38')]=_[_0xc910('0x2e')](_0x5e93ae[_0xc910('0x2b')],_0x5e93ae[_0xc910('0x2c')]);_0x28203d[_0xc910('0x2f')]=_[_0xc910('0x2e')](_0x5e93ae[_0xc910('0x2b')],qs[_0xc910('0x30')](_0x1b4e48['query'][_0xc910('0x30')]));_0x28203d['attributes']=_0x28203d[_0xc910('0x2f')]['length']?_0x28203d[_0xc910('0x2f')]:_0x5e93ae['model'];if(_0x1b4e48[_0xc910('0x2c')][_0xc910('0x43')]){_0x28203d[_0xc910('0x3f')]=[{'all':!![]}];}_0x28203d=_[_0xc910('0x3a')]({},_0x28203d,_0x1b4e48[_0xc910('0x3d')]);return db['MailSubstatus'][_0xc910('0x44')](_0x28203d)[_0xc910('0x22')](handleEntityNotFound(_0x30694d,null))[_0xc910('0x22')](respondWithResult(_0x30694d,null))[_0xc910('0x40')](handleError(_0x30694d,null));};exports[_0xc910('0x45')]=function(_0x1cb35d,_0x5cb57a){return db[_0xc910('0x3e')][_0xc910('0x45')](_0x1cb35d[_0xc910('0x46')],{})[_0xc910('0x22')](respondWithResult(_0x5cb57a,0xc9))[_0xc910('0x40')](handleError(_0x5cb57a,null));};exports['update']=function(_0x39421f,_0xd0abc8){if(_0x39421f[_0xc910('0x46')]['id']){delete _0x39421f[_0xc910('0x46')]['id'];}return db[_0xc910('0x3e')][_0xc910('0x44')]({'where':{'id':_0x39421f[_0xc910('0x42')]['id']}})[_0xc910('0x22')](handleEntityNotFound(_0xd0abc8,null))[_0xc910('0x22')](saveUpdates(_0x39421f[_0xc910('0x46')],null))['then'](respondWithResult(_0xd0abc8,null))[_0xc910('0x40')](handleError(_0xd0abc8,null));};exports[_0xc910('0x47')]=function(_0x409bc7,_0x2d6c64){return db[_0xc910('0x3e')][_0xc910('0x44')]({'where':{'id':_0x409bc7['params']['id']}})['then'](handleEntityNotFound(_0x2d6c64,null))['then'](removeEntity(_0x2d6c64,null))[_0xc910('0x40')](handleError(_0x2d6c64,null));};exports[_0xc910('0x48')]=function(_0x261403,_0x29cb99){return db[_0xc910('0x3e')][_0xc910('0x48')]()[_0xc910('0x22')](respondWithResult(_0x29cb99,null))[_0xc910('0x40')](handleError(_0x29cb99,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index dd8de73..1574129 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 _0xaebd=['hook','exports','events','../../mysqldb','setMaxListeners','emit'];(function(_0x100209,_0x163b91){var _0x3ffd34=function(_0x289b75){while(--_0x289b75){_0x100209['push'](_0x100209['shift']());}};_0x3ffd34(++_0x163b91);}(_0xaebd,0xb0));var _0xdaeb=function(_0x4799ff,_0x3f2d51){_0x4799ff=_0x4799ff-0x0;var _0x14c9df=_0xaebd[_0x4799ff];return _0x14c9df;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var MailSubstatus=require(_0xdaeb('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xdaeb('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x56a037){return function(_0x1acff0,_0x3f5fd0,_0x436cbc){MailSubstatusEvents[_0xdaeb('0x3')](_0x56a037+':'+_0x1acff0['id'],_0x1acff0);MailSubstatusEvents['emit'](_0x56a037,_0x1acff0);_0x436cbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xdaeb('0x4')](e,emitEvent(event));}}module[_0xdaeb('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x43c7=['MailSubstatus','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x57aa7a,_0x55db2d){var _0x5dd632=function(_0x862c8e){while(--_0x862c8e){_0x57aa7a['push'](_0x57aa7a['shift']());}};_0x5dd632(++_0x55db2d);}(_0x43c7,0xad));var _0x743c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x43c7[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x743c('0x0'));var MailSubstatus=require(_0x743c('0x1'))['db'][_0x743c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4597a4){return function(_0x560fa9,_0x3e68a6,_0x5981ea){MailSubstatusEvents[_0x743c('0x3')](_0x4597a4+':'+_0x560fa9['id'],_0x560fa9);MailSubstatusEvents[_0x743c('0x3')](_0x4597a4,_0x560fa9);_0x5981ea(null);};}for(var e in events){if(events[_0x743c('0x4')](e)){var event=events[e];MailSubstatus[_0x743c('0x5')](e,emitEvent(event));}}module[_0x743c('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 05773b8..dfae4a6 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 _0xae83=['define','Condition','mailSubstatus','name','then','catch','./mailSubstatus.attributes','exports'];(function(_0x32f9b2,_0x1750e6){var _0x1c3f2a=function(_0x4bbe6e){while(--_0x4bbe6e){_0x32f9b2['push'](_0x32f9b2['shift']());}};_0x1c3f2a(++_0x1750e6);}(_0xae83,0xee));var _0x3ae8=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xae83[_0x53ccf2];return _0x5a2964;};'use strict';var attributes=require(_0x3ae8('0x0'));module[_0x3ae8('0x1')]=function(_0x4068ce){var _0x464582=_0x4068ce['models'];return _0x4068ce[_0x3ae8('0x2')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4d185a,_0x32264b,_0x3231df){return _0x464582[_0x3ae8('0x3')]['update']({'value':_0x4d185a['name']},{'where':{'field':_0x3ae8('0x4'),'value':_0x4d185a['_previousDataValues'][_0x3ae8('0x5')]}})[_0x3ae8('0x6')](function(){_0x3231df();})[_0x3ae8('0x7')](function(_0x29e396){_0x3231df(_0x29e396);});}}});}; \ No newline at end of file +var _0x9e1e=['define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models'];(function(_0xccb95,_0x300783){var _0x382f46=function(_0x18519f){while(--_0x18519f){_0xccb95['push'](_0xccb95['shift']());}};_0x382f46(++_0x300783);}(_0x9e1e,0x82));var _0xe9e1=function(_0xe57d76,_0xd023a9){_0xe57d76=_0xe57d76-0x0;var _0x3512a0=_0x9e1e[_0xe57d76];return _0x3512a0;};'use strict';var attributes=require(_0xe9e1('0x0'));module['exports']=function(_0x4e22a3){var _0x510fe3=_0x4e22a3[_0xe9e1('0x1')];return _0x4e22a3[_0xe9e1('0x2')](_0xe9e1('0x3'),attributes,{'tableName':_0xe9e1('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x35e1f6,_0x27c5f9,_0x2c7625){return _0x510fe3[_0xe9e1('0x5')][_0xe9e1('0x6')]({'value':_0x35e1f6[_0xe9e1('0x7')]},{'where':{'field':_0xe9e1('0x8'),'value':_0x35e1f6[_0xe9e1('0x9')][_0xe9e1('0x7')]}})[_0xe9e1('0xa')](function(){_0x2c7625();})[_0xe9e1('0xb')](function(_0x139e29){_0x2c7625(_0x139e29);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 077a95f..d91f7ee 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 _0xc094=['MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x1f4a95,_0x55d7cc){var _0x2bc2b9=function(_0x4109d1){while(--_0x4109d1){_0x1f4a95['push'](_0x1f4a95['shift']());}};_0x2bc2b9(++_0x55d7cc);}(_0xc094,0x197));var _0x4c09=function(_0x515fd1,_0x35e5dc){_0x515fd1=_0x515fd1-0x0;var _0x24e3f0=_0xc094[_0x515fd1];return _0x24e3f0;};'use strict';var _=require(_0x4c09('0x0'));var util=require(_0x4c09('0x1'));var moment=require(_0x4c09('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c09('0x3'));var fs=require('fs');var Redis=require(_0x4c09('0x4'));var db=require(_0x4c09('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4c09('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c09('0x7'));var client=jayson[_0x4c09('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x168d51,_0x1a48dd,_0x2b793e){return new BPromise(function(_0x1323a0,_0x2cc00c){return client[_0x4c09('0x9')](_0x168d51,_0x2b793e)[_0x4c09('0xa')](function(_0xf86c43){logger[_0x4c09('0xb')](_0x4c09('0xc'),_0x1a48dd,'request\x20sent');logger['debug'](_0x4c09('0xd'),_0x1a48dd,_0x4c09('0xe'),JSON[_0x4c09('0xf')](_0xf86c43));if(_0xf86c43[_0x4c09('0x10')]){if(_0xf86c43[_0x4c09('0x10')][_0x4c09('0x11')]===0x1f4){logger[_0x4c09('0x10')](_0x4c09('0xc'),_0x1a48dd,_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);return _0x2cc00c(_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);}logger[_0x4c09('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x1a48dd,_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);return _0x1323a0(_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);}else{logger[_0x4c09('0xb')](_0x4c09('0xc'),_0x1a48dd,'request\x20sent');_0x1323a0(_0xf86c43['result'][_0x4c09('0x12')]);}})[_0x4c09('0x13')](function(_0x38e647){logger[_0x4c09('0x10')](_0x4c09('0xc'),_0x1a48dd,_0x38e647);_0x2cc00c(_0x38e647);});});} \ No newline at end of file +var _0x05eb=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x101ca2,_0x6d59cc){var _0x4a86fd=function(_0x3a441d){while(--_0x3a441d){_0x101ca2['push'](_0x101ca2['shift']());}};_0x4a86fd(++_0x6d59cc);}(_0x05eb,0x1bc));var _0xb05e=function(_0x1e586c,_0x1697b4){_0x1e586c=_0x1e586c-0x0;var _0x28a8a7=_0x05eb[_0x1e586c];return _0x28a8a7;};'use strict';var _=require(_0xb05e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb05e('0x1'));var rs=require(_0xb05e('0x2'));var fs=require('fs');var Redis=require(_0xb05e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb05e('0x4'));var logger=require(_0xb05e('0x5'))(_0xb05e('0x6'));var config=require(_0xb05e('0x7'));var jayson=require(_0xb05e('0x8'));var client=jayson['client'][_0xb05e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27cadc,_0x50b109,_0x147e6b){return new BPromise(function(_0x1198a8,_0xfd0576){return client[_0xb05e('0xa')](_0x27cadc,_0x147e6b)[_0xb05e('0xb')](function(_0x53fb6b){logger[_0xb05e('0xc')](_0xb05e('0xd'),_0x50b109,_0xb05e('0xe'));logger['debug'](_0xb05e('0xf'),_0x50b109,_0xb05e('0xe'),JSON[_0xb05e('0x10')](_0x53fb6b));if(_0x53fb6b[_0xb05e('0x11')]){if(_0x53fb6b[_0xb05e('0x11')][_0xb05e('0x12')]===0x1f4){logger[_0xb05e('0x11')](_0xb05e('0xd'),_0x50b109,_0x53fb6b[_0xb05e('0x11')][_0xb05e('0x13')]);return _0xfd0576(_0x53fb6b['error'][_0xb05e('0x13')]);}logger[_0xb05e('0x11')](_0xb05e('0xd'),_0x50b109,_0x53fb6b[_0xb05e('0x11')]['message']);return _0x1198a8(_0x53fb6b[_0xb05e('0x11')]['message']);}else{logger[_0xb05e('0xc')](_0xb05e('0xd'),_0x50b109,'request\x20sent');_0x1198a8(_0x53fb6b[_0xb05e('0x14')][_0xb05e('0x13')]);}})[_0xb05e('0x15')](function(_0x10bd8b){logger[_0xb05e('0x11')](_0xb05e('0xd'),_0x50b109,_0x10bd8b);_0xfd0576(_0x10bd8b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3d37aad..e700d8d 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 _0x40f1=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x40f1,0xb3));var _0x140f=function(_0x25aab5,_0x46504b){_0x25aab5=_0x25aab5-0x0;var _0x2e3343=_0x40f1[_0x25aab5];return _0x2e3343;};'use strict';var multer=require('multer');var util=require(_0x140f('0x0'));var path=require(_0x140f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x140f('0x2')]();var fs_extra=require(_0x140f('0x3'));var auth=require(_0x140f('0x4'));var interaction=require(_0x140f('0x5'));var config=require(_0x140f('0x6'));var controller=require(_0x140f('0x7'));router[_0x140f('0x8')]('/',auth[_0x140f('0x9')](),controller[_0x140f('0xa')]);router[_0x140f('0x8')]('/describe',auth[_0x140f('0x9')](),controller[_0x140f('0xb')]);router[_0x140f('0x8')](_0x140f('0xc'),auth['isAuthenticated'](),controller[_0x140f('0xd')]);router[_0x140f('0xe')]('/',auth['isAuthenticated'](),controller[_0x140f('0xf')]);router[_0x140f('0x10')](_0x140f('0xc'),auth[_0x140f('0x9')](),controller['update']);router[_0x140f('0x11')]('/:id',auth[_0x140f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfcb2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2f7a43,_0x525425){var _0x35880a=function(_0x509437){while(--_0x509437){_0x2f7a43['push'](_0x2f7a43['shift']());}};_0x35880a(++_0x525425);}(_0xfcb2,0xb9));var _0x2fcb=function(_0xe00bc4,_0x231adc){_0xe00bc4=_0xe00bc4-0x0;var _0x1e87cf=_0xfcb2[_0xe00bc4];return _0x1e87cf;};'use strict';var multer=require('multer');var util=require(_0x2fcb('0x0'));var path=require(_0x2fcb('0x1'));var timeout=require(_0x2fcb('0x2'));var express=require(_0x2fcb('0x3'));var router=express[_0x2fcb('0x4')]();var fs_extra=require(_0x2fcb('0x5'));var auth=require(_0x2fcb('0x6'));var interaction=require(_0x2fcb('0x7'));var config=require(_0x2fcb('0x8'));var controller=require(_0x2fcb('0x9'));router[_0x2fcb('0xa')]('/',auth['isAuthenticated'](),controller[_0x2fcb('0xb')]);router[_0x2fcb('0xa')](_0x2fcb('0xc'),auth['isAuthenticated'](),controller[_0x2fcb('0xd')]);router[_0x2fcb('0xa')](_0x2fcb('0xe'),auth[_0x2fcb('0xf')](),controller['show']);router['post']('/',auth[_0x2fcb('0xf')](),controller[_0x2fcb('0x10')]);router['put'](_0x2fcb('0xe'),auth[_0x2fcb('0xf')](),controller[_0x2fcb('0x11')]);router[_0x2fcb('0x12')](_0x2fcb('0xe'),auth[_0x2fcb('0xf')](),controller[_0x2fcb('0x13')]);module[_0x2fcb('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 0e659f7..10ca45e 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x26effc,_0x18ad86){var _0x3e2631=function(_0x194a00){while(--_0x194a00){_0x26effc['push'](_0x26effc['shift']());}};_0x3e2631(++_0x18ad86);}(_0xaa88,0x137));var _0x8aa8=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0xaa88[_0x51d71a];return _0xff01f1;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1a9142,_0x5539e6){var _0x3f14f6=function(_0x399e79){while(--_0x399e79){_0x1a9142['push'](_0x1a9142['shift']());}};_0x3f14f6(++_0x5539e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 78eca2c..f28b168 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 _0x4f8d=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','MailTransferReport'];(function(_0x2a318a,_0x3f8006){var _0x346cf3=function(_0x314595){while(--_0x314595){_0x2a318a['push'](_0x2a318a['shift']());}};_0x346cf3(++_0x3f8006);}(_0x4f8d,0xf9));var _0xd4f8=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x4f8d[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0xd4f8('0x0'));var rimraf=require(_0xd4f8('0x1'));var zipdir=require(_0xd4f8('0x2'));var jsonpatch=require(_0xd4f8('0x3'));var rp=require(_0xd4f8('0x4'));var moment=require(_0xd4f8('0x5'));var BPromise=require(_0xd4f8('0x6'));var Mustache=require(_0xd4f8('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4f8('0x8'));var fs=require('fs');var fs_extra=require(_0xd4f8('0x9'));var _=require('lodash');var squel=require(_0xd4f8('0xa'));var crypto=require(_0xd4f8('0xb'));var jsforce=require(_0xd4f8('0xc'));var deskjs=require(_0xd4f8('0xd'));var toCsv=require(_0xd4f8('0xe'));var querystring=require('querystring');var Papa=require(_0xd4f8('0xf'));var Redis=require(_0xd4f8('0x10'));var authService=require(_0xd4f8('0x11'));var qs=require(_0xd4f8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4f8('0x13'))(_0xd4f8('0x14'));var utils=require('../../config/utils');var config=require(_0xd4f8('0x15'));var licenseUtil=require(_0xd4f8('0x16'));var db=require(_0xd4f8('0x17'))['db'];function respondWithStatusCode(_0x383d8f,_0x3abad9){_0x3abad9=_0x3abad9||0xcc;return function(_0x3d9e5e){if(_0x3d9e5e){return _0x383d8f[_0xd4f8('0x18')](_0x3abad9);}return _0x383d8f['status'](_0x3abad9)[_0xd4f8('0x19')]();};}function respondWithResult(_0x579c9f,_0xe063fc){_0xe063fc=_0xe063fc||0xc8;return function(_0x4f46e8){if(_0x4f46e8){return _0x579c9f[_0xd4f8('0x1a')](_0xe063fc)[_0xd4f8('0x1b')](_0x4f46e8);}};}function respondWithFilteredResult(_0x14cbb7,_0x2d5867){return function(_0x1ea6a4){if(_0x1ea6a4){var _0x130e3a=typeof _0x2d5867[_0xd4f8('0x1c')]===_0xd4f8('0x1d')&&typeof _0x2d5867['limit']===_0xd4f8('0x1d');var _0x3fe81f=_0x1ea6a4['count'];var _0x277698=_0x130e3a?0x0:_0x2d5867['offset'];var _0x15af0e=_0x130e3a?_0x1ea6a4['count']:_0x2d5867[_0xd4f8('0x1c')]+_0x2d5867[_0xd4f8('0x1e')];var _0x6f3634;if(_0x15af0e>=_0x3fe81f){_0x15af0e=_0x3fe81f;_0x6f3634=0xc8;}else{_0x6f3634=0xce;}_0x14cbb7[_0xd4f8('0x1a')](_0x6f3634);return _0x14cbb7[_0xd4f8('0x1f')](_0xd4f8('0x20'),_0x277698+'-'+_0x15af0e+'/'+_0x3fe81f)[_0xd4f8('0x1b')](_0x1ea6a4);}return null;};}function patchUpdates(_0x15dac5){return function(_0x7bdeff){try{jsonpatch['apply'](_0x7bdeff,_0x15dac5,!![]);}catch(_0x5db728){return BPromise[_0xd4f8('0x21')](_0x5db728);}return _0x7bdeff['save']();};}function saveUpdates(_0x1d89b1,_0x55f568){return function(_0x519439){if(_0x519439){return _0x519439[_0xd4f8('0x22')](_0x1d89b1)[_0xd4f8('0x23')](function(_0x154f71){return _0x154f71;});}return null;};}function removeEntity(_0x24c1ea,_0xa73744){return function(_0x2d22f7){if(_0x2d22f7){return _0x2d22f7[_0xd4f8('0x24')]()[_0xd4f8('0x23')](function(){_0x24c1ea[_0xd4f8('0x1a')](0xcc)[_0xd4f8('0x19')]();});}};}function handleEntityNotFound(_0x2851c6,_0x50b4ad){return function(_0x2aa063){if(!_0x2aa063){_0x2851c6[_0xd4f8('0x18')](0x194);}return _0x2aa063;};}function handleError(_0x299ab0,_0x41c41e){_0x41c41e=_0x41c41e||0x1f4;return function(_0x48a2db){logger[_0xd4f8('0x25')](_0x48a2db[_0xd4f8('0x26')]);if(_0x48a2db['name']){delete _0x48a2db[_0xd4f8('0x27')];}_0x299ab0[_0xd4f8('0x1a')](_0x41c41e)['send'](_0x48a2db);};}exports[_0xd4f8('0x28')]=function(_0x5b1a92,_0x55a61c){var _0x2ae503={},_0x3e4881={},_0x5082ad={'count':0x0,'rows':[]};var _0x2a6708=_[_0xd4f8('0x29')](db[_0xd4f8('0x2a')][_0xd4f8('0x2b')],function(_0x18f7e4){return{'name':_0x18f7e4[_0xd4f8('0x2c')],'type':_0x18f7e4[_0xd4f8('0x2d')][_0xd4f8('0x2e')]};});_0x3e4881[_0xd4f8('0x2f')]=_[_0xd4f8('0x29')](_0x2a6708,_0xd4f8('0x27'));_0x3e4881[_0xd4f8('0x30')]=_[_0xd4f8('0x31')](_0x5b1a92[_0xd4f8('0x30')]);_0x3e4881[_0xd4f8('0x32')]=_[_0xd4f8('0x33')](_0x3e4881[_0xd4f8('0x2f')],_0x3e4881[_0xd4f8('0x30')]);_0x2ae503['attributes']=_[_0xd4f8('0x33')](_0x3e4881[_0xd4f8('0x2f')],qs[_0xd4f8('0x34')](_0x5b1a92[_0xd4f8('0x30')][_0xd4f8('0x34')]));_0x2ae503[_0xd4f8('0x35')]=_0x2ae503[_0xd4f8('0x35')][_0xd4f8('0x36')]?_0x2ae503[_0xd4f8('0x35')]:_0x3e4881[_0xd4f8('0x2f')];if(!_0x5b1a92['query']['hasOwnProperty']('nolimit')){_0x2ae503['limit']=qs[_0xd4f8('0x1e')](_0x5b1a92[_0xd4f8('0x30')][_0xd4f8('0x1e')]);_0x2ae503[_0xd4f8('0x1c')]=qs['offset'](_0x5b1a92[_0xd4f8('0x30')]['offset']);}_0x2ae503[_0xd4f8('0x37')]=qs[_0xd4f8('0x38')](_0x5b1a92['query'][_0xd4f8('0x38')]);_0x2ae503[_0xd4f8('0x39')]=qs['filters'](_['pick'](_0x5b1a92[_0xd4f8('0x30')],_0x3e4881[_0xd4f8('0x32')]),_0x2a6708);if(_0x5b1a92[_0xd4f8('0x30')][_0xd4f8('0x3a')]){_0x2ae503[_0xd4f8('0x39')]=_[_0xd4f8('0x3b')](_0x2ae503[_0xd4f8('0x39')],{'$or':_[_0xd4f8('0x29')](_0x2a6708,function(_0x150382){if(_0x150382[_0xd4f8('0x2d')]!==_0xd4f8('0x3c')){var _0x12acb2={};_0x12acb2[_0x150382[_0xd4f8('0x27')]]={'$like':'%'+_0x5b1a92[_0xd4f8('0x30')]['filter']+'%'};return _0x12acb2;}})});}_0x2ae503=_[_0xd4f8('0x3b')]({},_0x2ae503,_0x5b1a92['options']);var _0x112193={'where':_0x2ae503[_0xd4f8('0x39')]};return db[_0xd4f8('0x2a')][_0xd4f8('0x3d')](_0x112193)[_0xd4f8('0x23')](function(_0x479680){_0x5082ad[_0xd4f8('0x3d')]=_0x479680;if(_0x5b1a92[_0xd4f8('0x30')][_0xd4f8('0x3e')]){_0x2ae503[_0xd4f8('0x3f')]=[{'all':!![]}];}return db[_0xd4f8('0x2a')][_0xd4f8('0x40')](_0x2ae503);})[_0xd4f8('0x23')](function(_0xd5566d){_0x5082ad[_0xd4f8('0x41')]=_0xd5566d;return _0x5082ad;})[_0xd4f8('0x23')](respondWithFilteredResult(_0x55a61c,_0x2ae503))[_0xd4f8('0x42')](handleError(_0x55a61c,null));};exports['show']=function(_0x36fafe,_0x1c9505){var _0x31e8a6={'raw':!![],'where':{'id':_0x36fafe[_0xd4f8('0x43')]['id']}},_0x4309f7={};_0x4309f7[_0xd4f8('0x2f')]=_[_0xd4f8('0x31')](db[_0xd4f8('0x2a')][_0xd4f8('0x2b')]);_0x4309f7[_0xd4f8('0x30')]=_['keys'](_0x36fafe[_0xd4f8('0x30')]);_0x4309f7[_0xd4f8('0x32')]=_['intersection'](_0x4309f7[_0xd4f8('0x2f')],_0x4309f7[_0xd4f8('0x30')]);_0x31e8a6[_0xd4f8('0x35')]=_[_0xd4f8('0x33')](_0x4309f7[_0xd4f8('0x2f')],qs['fields'](_0x36fafe[_0xd4f8('0x30')]['fields']));_0x31e8a6[_0xd4f8('0x35')]=_0x31e8a6[_0xd4f8('0x35')]['length']?_0x31e8a6[_0xd4f8('0x35')]:_0x4309f7[_0xd4f8('0x2f')];if(_0x36fafe[_0xd4f8('0x30')][_0xd4f8('0x3e')]){_0x31e8a6[_0xd4f8('0x3f')]=[{'all':!![]}];}_0x31e8a6=_[_0xd4f8('0x3b')]({},_0x31e8a6,_0x36fafe[_0xd4f8('0x44')]);return db[_0xd4f8('0x2a')]['find'](_0x31e8a6)['then'](handleEntityNotFound(_0x1c9505,null))[_0xd4f8('0x23')](respondWithResult(_0x1c9505,null))[_0xd4f8('0x42')](handleError(_0x1c9505,null));};exports[_0xd4f8('0x45')]=function(_0x435275,_0x2a0851){return db[_0xd4f8('0x2a')][_0xd4f8('0x45')](_0x435275[_0xd4f8('0x46')],{})[_0xd4f8('0x23')](respondWithResult(_0x2a0851,0xc9))[_0xd4f8('0x42')](handleError(_0x2a0851,null));};exports[_0xd4f8('0x22')]=function(_0xa1b667,_0x2f152b){if(_0xa1b667[_0xd4f8('0x46')]['id']){delete _0xa1b667[_0xd4f8('0x46')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0xa1b667[_0xd4f8('0x43')]['id']}})[_0xd4f8('0x23')](handleEntityNotFound(_0x2f152b,null))[_0xd4f8('0x23')](saveUpdates(_0xa1b667[_0xd4f8('0x46')],null))['then'](respondWithResult(_0x2f152b,null))['catch'](handleError(_0x2f152b,null));};exports[_0xd4f8('0x24')]=function(_0x582afe,_0x537bcc){return db[_0xd4f8('0x2a')][_0xd4f8('0x47')]({'where':{'id':_0x582afe[_0xd4f8('0x43')]['id']}})[_0xd4f8('0x23')](handleEntityNotFound(_0x537bcc,null))[_0xd4f8('0x23')](removeEntity(_0x537bcc,null))['catch'](handleError(_0x537bcc,null));};exports[_0xd4f8('0x48')]=function(_0x58e891,_0x305325){return db[_0xd4f8('0x2a')][_0xd4f8('0x48')]()[_0xd4f8('0x23')](respondWithResult(_0x305325,null))[_0xd4f8('0x42')](handleError(_0x305325,null));}; \ No newline at end of file +var _0xcf15=['find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','findAll','catch','show','params'];(function(_0x5c3e2d,_0x16a3a3){var _0x1e0b46=function(_0x4708e4){while(--_0x4708e4){_0x5c3e2d['push'](_0x5c3e2d['shift']());}};_0x1e0b46(++_0x16a3a3);}(_0xcf15,0x1c6));var _0x5cf1=function(_0x3300f5,_0x5cd0c1){_0x3300f5=_0x3300f5-0x0;var _0x1ae058=_0xcf15[_0x3300f5];return _0x1ae058;};'use strict';var emlformat=require(_0x5cf1('0x0'));var rimraf=require(_0x5cf1('0x1'));var zipdir=require(_0x5cf1('0x2'));var jsonpatch=require(_0x5cf1('0x3'));var rp=require(_0x5cf1('0x4'));var moment=require(_0x5cf1('0x5'));var BPromise=require(_0x5cf1('0x6'));var Mustache=require(_0x5cf1('0x7'));var util=require(_0x5cf1('0x8'));var path=require(_0x5cf1('0x9'));var sox=require(_0x5cf1('0xa'));var csv=require('to-csv');var ejs=require(_0x5cf1('0xb'));var fs=require('fs');var fs_extra=require(_0x5cf1('0xc'));var _=require(_0x5cf1('0xd'));var squel=require(_0x5cf1('0xe'));var crypto=require('crypto');var jsforce=require(_0x5cf1('0xf'));var deskjs=require(_0x5cf1('0x10'));var toCsv=require(_0x5cf1('0x11'));var querystring=require('querystring');var Papa=require(_0x5cf1('0x12'));var Redis=require('ioredis');var authService=require(_0x5cf1('0x13'));var qs=require(_0x5cf1('0x14'));var as=require(_0x5cf1('0x15'));var hardwareService=require(_0x5cf1('0x16'));var logger=require(_0x5cf1('0x17'))(_0x5cf1('0x18'));var utils=require('../../config/utils');var config=require(_0x5cf1('0x19'));var licenseUtil=require(_0x5cf1('0x1a'));var db=require(_0x5cf1('0x1b'))['db'];function respondWithStatusCode(_0x18de49,_0x596912){_0x596912=_0x596912||0xcc;return function(_0x54bda6){if(_0x54bda6){return _0x18de49['sendStatus'](_0x596912);}return _0x18de49[_0x5cf1('0x1c')](_0x596912)[_0x5cf1('0x1d')]();};}function respondWithResult(_0x36861c,_0x4219f4){_0x4219f4=_0x4219f4||0xc8;return function(_0x5eb0bf){if(_0x5eb0bf){return _0x36861c[_0x5cf1('0x1c')](_0x4219f4)[_0x5cf1('0x1e')](_0x5eb0bf);}};}function respondWithFilteredResult(_0x5c61a9,_0x413156){return function(_0x2c8278){if(_0x2c8278){var _0xb0e23c=typeof _0x413156['offset']==='undefined'&&typeof _0x413156[_0x5cf1('0x1f')]==='undefined';var _0x394b1b=_0x2c8278[_0x5cf1('0x20')];var _0x3e09bb=_0xb0e23c?0x0:_0x413156[_0x5cf1('0x21')];var _0x12fc75=_0xb0e23c?_0x2c8278[_0x5cf1('0x20')]:_0x413156[_0x5cf1('0x21')]+_0x413156[_0x5cf1('0x1f')];var _0xd01be8;if(_0x12fc75>=_0x394b1b){_0x12fc75=_0x394b1b;_0xd01be8=0xc8;}else{_0xd01be8=0xce;}_0x5c61a9['status'](_0xd01be8);return _0x5c61a9[_0x5cf1('0x22')](_0x5cf1('0x23'),_0x3e09bb+'-'+_0x12fc75+'/'+_0x394b1b)['json'](_0x2c8278);}return null;};}function patchUpdates(_0x20aaf1){return function(_0x56e607){try{jsonpatch[_0x5cf1('0x24')](_0x56e607,_0x20aaf1,!![]);}catch(_0x1da8d9){return BPromise[_0x5cf1('0x25')](_0x1da8d9);}return _0x56e607[_0x5cf1('0x26')]();};}function saveUpdates(_0x78b6d5,_0x34cd3a){return function(_0x20bb62){if(_0x20bb62){return _0x20bb62['update'](_0x78b6d5)[_0x5cf1('0x27')](function(_0x3d1905){return _0x3d1905;});}return null;};}function removeEntity(_0x2abb7d,_0x3fb6c1){return function(_0x4247a2){if(_0x4247a2){return _0x4247a2[_0x5cf1('0x28')]()[_0x5cf1('0x27')](function(){_0x2abb7d['status'](0xcc)[_0x5cf1('0x1d')]();});}};}function handleEntityNotFound(_0x28d6d3,_0x1e481b){return function(_0x34fd2e){if(!_0x34fd2e){_0x28d6d3[_0x5cf1('0x29')](0x194);}return _0x34fd2e;};}function handleError(_0x16eeb,_0x2b480d){_0x2b480d=_0x2b480d||0x1f4;return function(_0x2c3548){logger[_0x5cf1('0x2a')](_0x2c3548[_0x5cf1('0x2b')]);if(_0x2c3548[_0x5cf1('0x2c')]){delete _0x2c3548[_0x5cf1('0x2c')];}_0x16eeb[_0x5cf1('0x1c')](_0x2b480d)[_0x5cf1('0x2d')](_0x2c3548);};}exports[_0x5cf1('0x2e')]=function(_0x427038,_0xe6a52c){var _0x34571c={},_0x425a12={},_0x3349ce={'count':0x0,'rows':[]};var _0x5ed5d5=_[_0x5cf1('0x2f')](db[_0x5cf1('0x30')][_0x5cf1('0x31')],function(_0x206212){return{'name':_0x206212['fieldName'],'type':_0x206212[_0x5cf1('0x32')]['key']};});_0x425a12[_0x5cf1('0x33')]=_[_0x5cf1('0x2f')](_0x5ed5d5,_0x5cf1('0x2c'));_0x425a12['query']=_[_0x5cf1('0x34')](_0x427038[_0x5cf1('0x35')]);_0x425a12['filters']=_[_0x5cf1('0x36')](_0x425a12['model'],_0x425a12[_0x5cf1('0x35')]);_0x34571c['attributes']=_['intersection'](_0x425a12[_0x5cf1('0x33')],qs[_0x5cf1('0x37')](_0x427038[_0x5cf1('0x35')][_0x5cf1('0x37')]));_0x34571c[_0x5cf1('0x38')]=_0x34571c[_0x5cf1('0x38')][_0x5cf1('0x39')]?_0x34571c[_0x5cf1('0x38')]:_0x425a12['model'];if(!_0x427038[_0x5cf1('0x35')][_0x5cf1('0x3a')]('nolimit')){_0x34571c[_0x5cf1('0x1f')]=qs['limit'](_0x427038[_0x5cf1('0x35')]['limit']);_0x34571c[_0x5cf1('0x21')]=qs['offset'](_0x427038['query'][_0x5cf1('0x21')]);}_0x34571c['order']=qs[_0x5cf1('0x3b')](_0x427038[_0x5cf1('0x35')]['sort']);_0x34571c[_0x5cf1('0x3c')]=qs['filters'](_[_0x5cf1('0x3d')](_0x427038[_0x5cf1('0x35')],_0x425a12[_0x5cf1('0x3e')]),_0x5ed5d5);if(_0x427038[_0x5cf1('0x35')]['filter']){_0x34571c[_0x5cf1('0x3c')]=_[_0x5cf1('0x3f')](_0x34571c[_0x5cf1('0x3c')],{'$or':_['map'](_0x5ed5d5,function(_0x320128){if(_0x320128[_0x5cf1('0x32')]!==_0x5cf1('0x40')){var _0x1effe8={};_0x1effe8[_0x320128[_0x5cf1('0x2c')]]={'$like':'%'+_0x427038[_0x5cf1('0x35')]['filter']+'%'};return _0x1effe8;}})});}_0x34571c=_[_0x5cf1('0x3f')]({},_0x34571c,_0x427038[_0x5cf1('0x41')]);var _0x461132={'where':_0x34571c[_0x5cf1('0x3c')]};return db[_0x5cf1('0x30')][_0x5cf1('0x20')](_0x461132)['then'](function(_0xd8821c){_0x3349ce[_0x5cf1('0x20')]=_0xd8821c;if(_0x427038[_0x5cf1('0x35')][_0x5cf1('0x42')]){_0x34571c['include']=[{'all':!![]}];}return db[_0x5cf1('0x30')][_0x5cf1('0x43')](_0x34571c);})[_0x5cf1('0x27')](function(_0x13a8a9){_0x3349ce['rows']=_0x13a8a9;return _0x3349ce;})[_0x5cf1('0x27')](respondWithFilteredResult(_0xe6a52c,_0x34571c))[_0x5cf1('0x44')](handleError(_0xe6a52c,null));};exports[_0x5cf1('0x45')]=function(_0x42d679,_0x34e6c3){var _0x40f06d={'raw':!![],'where':{'id':_0x42d679[_0x5cf1('0x46')]['id']}},_0x46e35e={};_0x46e35e[_0x5cf1('0x33')]=_[_0x5cf1('0x34')](db['MailTransferReport'][_0x5cf1('0x31')]);_0x46e35e[_0x5cf1('0x35')]=_[_0x5cf1('0x34')](_0x42d679[_0x5cf1('0x35')]);_0x46e35e['filters']=_[_0x5cf1('0x36')](_0x46e35e[_0x5cf1('0x33')],_0x46e35e[_0x5cf1('0x35')]);_0x40f06d[_0x5cf1('0x38')]=_[_0x5cf1('0x36')](_0x46e35e[_0x5cf1('0x33')],qs['fields'](_0x42d679[_0x5cf1('0x35')]['fields']));_0x40f06d[_0x5cf1('0x38')]=_0x40f06d[_0x5cf1('0x38')][_0x5cf1('0x39')]?_0x40f06d['attributes']:_0x46e35e[_0x5cf1('0x33')];if(_0x42d679[_0x5cf1('0x35')][_0x5cf1('0x42')]){_0x40f06d['include']=[{'all':!![]}];}_0x40f06d=_[_0x5cf1('0x3f')]({},_0x40f06d,_0x42d679[_0x5cf1('0x41')]);return db[_0x5cf1('0x30')][_0x5cf1('0x47')](_0x40f06d)[_0x5cf1('0x27')](handleEntityNotFound(_0x34e6c3,null))[_0x5cf1('0x27')](respondWithResult(_0x34e6c3,null))[_0x5cf1('0x44')](handleError(_0x34e6c3,null));};exports[_0x5cf1('0x48')]=function(_0x2d522b,_0x1cae19){return db['MailTransferReport'][_0x5cf1('0x48')](_0x2d522b[_0x5cf1('0x49')],{})[_0x5cf1('0x27')](respondWithResult(_0x1cae19,0xc9))[_0x5cf1('0x44')](handleError(_0x1cae19,null));};exports['update']=function(_0x2021c8,_0x5d19f1){if(_0x2021c8[_0x5cf1('0x49')]['id']){delete _0x2021c8[_0x5cf1('0x49')]['id'];}return db[_0x5cf1('0x30')][_0x5cf1('0x47')]({'where':{'id':_0x2021c8['params']['id']}})[_0x5cf1('0x27')](handleEntityNotFound(_0x5d19f1,null))[_0x5cf1('0x27')](saveUpdates(_0x2021c8[_0x5cf1('0x49')],null))[_0x5cf1('0x27')](respondWithResult(_0x5d19f1,null))[_0x5cf1('0x44')](handleError(_0x5d19f1,null));};exports[_0x5cf1('0x28')]=function(_0x8d39a7,_0x5e4fcb){return db[_0x5cf1('0x30')]['find']({'where':{'id':_0x8d39a7['params']['id']}})[_0x5cf1('0x27')](handleEntityNotFound(_0x5e4fcb,null))[_0x5cf1('0x27')](removeEntity(_0x5e4fcb,null))[_0x5cf1('0x44')](handleError(_0x5e4fcb,null));};exports[_0x5cf1('0x4a')]=function(_0x7ef77a,_0x4425ca){return db[_0x5cf1('0x30')][_0x5cf1('0x4a')]()[_0x5cf1('0x27')](respondWithResult(_0x4425ca,null))[_0x5cf1('0x44')](handleError(_0x4425ca,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b45d981..fa605f3 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 _0x432b=['uniqueid','lodash','../../config/logger','api','moment','bluebird','rimraf','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer'];(function(_0x1c31ff,_0x4d7927){var _0x1c657a=function(_0x46a4e8){while(--_0x46a4e8){_0x1c31ff['push'](_0x1c31ff['shift']());}};_0x1c657a(++_0x4d7927);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var logger=require(_0xb432('0x1'))(_0xb432('0x2'));var moment=require(_0xb432('0x3'));var BPromise=require(_0xb432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb432('0x5'));var config=require('../../config/environment');var attributes=require(_0xb432('0x6'));module['exports']=function(_0x143093,_0x3f1a78){return _0x143093[_0xb432('0x7')](_0xb432('0x8'),attributes,{'tableName':_0xb432('0x9'),'paranoid':![],'indexes':[{'name':_0xb432('0xa'),'fields':[_0xb432('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38df=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x577bb5,_0x50a2d6){var _0xa81b6a=function(_0x1b36a3){while(--_0x1b36a3){_0x577bb5['push'](_0x577bb5['shift']());}};_0xa81b6a(++_0x50a2d6);}(_0x38df,0x144));var _0xf38d=function(_0x4e2adf,_0x2c273){_0x4e2adf=_0x4e2adf-0x0;var _0x113d4f=_0x38df[_0x4e2adf];return _0x113d4f;};'use strict';var _=require(_0xf38d('0x0'));var util=require(_0xf38d('0x1'));var logger=require(_0xf38d('0x2'))(_0xf38d('0x3'));var moment=require(_0xf38d('0x4'));var BPromise=require(_0xf38d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf38d('0x6'));var config=require(_0xf38d('0x7'));var attributes=require(_0xf38d('0x8'));module['exports']=function(_0x42c0bc,_0x3b7646){return _0x42c0bc[_0xf38d('0x9')](_0xf38d('0xa'),attributes,{'tableName':_0xf38d('0xb'),'paranoid':![],'indexes':[{'name':_0xf38d('0xc'),'fields':[_0xf38d('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 950bb8b..da6470b 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 _0x803f=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x3a0021,_0x3dfa84){var _0x46fa7e=function(_0x2710db){while(--_0x2710db){_0x3a0021['push'](_0x3a0021['shift']());}};_0x46fa7e(++_0x3dfa84);}(_0x803f,0x144));var _0xf803=function(_0x262396,_0x4eaf99){_0x262396=_0x262396-0x0;var _0x35a6cf=_0x803f[_0x262396];return _0x35a6cf;};'use strict';var _=require('lodash');var util=require(_0xf803('0x0'));var moment=require(_0xf803('0x1'));var BPromise=require(_0xf803('0x2'));var rs=require(_0xf803('0x3'));var fs=require('fs');var Redis=require(_0xf803('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf803('0x5'));var logger=require(_0xf803('0x6'))(_0xf803('0x7'));var config=require(_0xf803('0x8'));var jayson=require(_0xf803('0x9'));var client=jayson[_0xf803('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5413,_0x4291f2,_0x43ea35){return new BPromise(function(_0x38ebfe,_0x56ab14){return client['request'](_0x2b5413,_0x43ea35)[_0xf803('0xb')](function(_0x58620e){logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,'request\x20sent');logger[_0xf803('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4291f2,_0xf803('0xf'),JSON['stringify'](_0x58620e));if(_0x58620e['error']){if(_0x58620e[_0xf803('0x10')]['code']===0x1f4){logger['error'](_0xf803('0xd'),_0x4291f2,_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);return _0x56ab14(_0x58620e['error'][_0xf803('0x11')]);}logger[_0xf803('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x4291f2,_0x58620e['error'][_0xf803('0x11')]);return _0x38ebfe(_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);}else{logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,_0xf803('0xf'));_0x38ebfe(_0x58620e['result'][_0xf803('0x11')]);}})['catch'](function(_0x27338a){logger[_0xf803('0x10')](_0xf803('0xd'),_0x4291f2,_0x27338a);_0x56ab14(_0x27338a);});});} \ No newline at end of file +var _0xfd5b=['debug','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0xfd5b,0x1aa));var _0xbfd5=function(_0x34cc9c,_0xebf095){_0x34cc9c=_0x34cc9c-0x0;var _0x19976a=_0xfd5b[_0x34cc9c];return _0x19976a;};'use strict';var _=require(_0xbfd5('0x0'));var util=require('util');var moment=require(_0xbfd5('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfd5('0x2'));var fs=require('fs');var Redis=require(_0xbfd5('0x3'));var db=require(_0xbfd5('0x4'))['db'];var utils=require(_0xbfd5('0x5'));var logger=require(_0xbfd5('0x6'))(_0xbfd5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfd5('0x8')][_0xbfd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52147c,_0x13ea8c,_0x2393eb){return new BPromise(function(_0x22af78,_0x5e2434){return client[_0xbfd5('0xa')](_0x52147c,_0x2393eb)[_0xbfd5('0xb')](function(_0x3e98de){logger[_0xbfd5('0xc')](_0xbfd5('0xd'),_0x13ea8c,_0xbfd5('0xe'));logger[_0xbfd5('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x13ea8c,_0xbfd5('0xe'),JSON['stringify'](_0x3e98de));if(_0x3e98de[_0xbfd5('0x10')]){if(_0x3e98de[_0xbfd5('0x10')][_0xbfd5('0x11')]===0x1f4){logger[_0xbfd5('0x10')](_0xbfd5('0xd'),_0x13ea8c,_0x3e98de[_0xbfd5('0x10')][_0xbfd5('0x12')]);return _0x5e2434(_0x3e98de[_0xbfd5('0x10')][_0xbfd5('0x12')]);}logger[_0xbfd5('0x10')](_0xbfd5('0xd'),_0x13ea8c,_0x3e98de[_0xbfd5('0x10')]['message']);return _0x22af78(_0x3e98de[_0xbfd5('0x10')]['message']);}else{logger['info'](_0xbfd5('0xd'),_0x13ea8c,'request\x20sent');_0x22af78(_0x3e98de[_0xbfd5('0x13')][_0xbfd5('0x12')]);}})[_0xbfd5('0x14')](function(_0x439632){logger[_0xbfd5('0x10')](_0xbfd5('0xd'),_0x13ea8c,_0x439632);_0x5e2434(_0x439632);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f2aafb8..c997bf9 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 _0xc9f1=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9f1,0x1c6));var _0x1c9f=function(_0x56500d,_0x20b671){_0x56500d=_0x56500d-0x0;var _0x54c07c=_0xc9f1[_0x56500d];return _0x54c07c;};'use strict';var multer=require('multer');var util=require(_0x1c9f('0x0'));var path=require(_0x1c9f('0x1'));var timeout=require(_0x1c9f('0x2'));var express=require(_0x1c9f('0x3'));var router=express['Router']();var fs_extra=require(_0x1c9f('0x4'));var auth=require(_0x1c9f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c9f('0x6'));var controller=require(_0x1c9f('0x7'));router[_0x1c9f('0x8')]('/',auth[_0x1c9f('0x9')](),controller[_0x1c9f('0xa')]);router[_0x1c9f('0x8')](_0x1c9f('0xb'),auth['isAuthenticated'](),controller[_0x1c9f('0xc')]);router[_0x1c9f('0x8')](_0x1c9f('0xd'),auth[_0x1c9f('0x9')](),controller[_0x1c9f('0xe')]);router[_0x1c9f('0xf')]('/',auth[_0x1c9f('0x9')](),controller[_0x1c9f('0x10')]);router[_0x1c9f('0x11')]('/:id',auth[_0x1c9f('0x9')](),controller[_0x1c9f('0x12')]);router[_0x1c9f('0x13')](_0x1c9f('0xd'),auth[_0x1c9f('0x9')](),controller['destroy']);module[_0x1c9f('0x14')]=router; \ No newline at end of file +var _0xb465=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','put','delete','exports'];(function(_0x43a4c2,_0x4e400f){var _0x3cd4fb=function(_0x28ec58){while(--_0x28ec58){_0x43a4c2['push'](_0x43a4c2['shift']());}};_0x3cd4fb(++_0x4e400f);}(_0xb465,0xa2));var _0x5b46=function(_0x34dbad,_0x4daf3c){_0x34dbad=_0x34dbad-0x0;var _0x4f8a32=_0xb465[_0x34dbad];return _0x4f8a32;};'use strict';var multer=require(_0x5b46('0x0'));var util=require(_0x5b46('0x1'));var path=require(_0x5b46('0x2'));var timeout=require(_0x5b46('0x3'));var express=require(_0x5b46('0x4'));var router=express[_0x5b46('0x5')]();var fs_extra=require(_0x5b46('0x6'));var auth=require(_0x5b46('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5b46('0x8'));var controller=require(_0x5b46('0x9'));router[_0x5b46('0xa')]('/',auth[_0x5b46('0xb')](),controller['index']);router['get'](_0x5b46('0xc'),auth[_0x5b46('0xb')](),controller[_0x5b46('0xd')]);router['get'](_0x5b46('0xe'),auth[_0x5b46('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5b46('0xf')](_0x5b46('0xe'),auth[_0x5b46('0xb')](),controller['update']);router[_0x5b46('0x10')](_0x5b46('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b46('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5b6b71c..d124a37 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 _0xefb8=['exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0xefb8,0xa8));var _0x8efb=function(_0x2ace1,_0x5239d5){_0x2ace1=_0x2ace1-0x0;var _0x18fc28=_0xefb8[_0x2ace1];return _0x18fc28;};'use strict';var Sequelize=require(_0x8efb('0x0'));var moment=require(_0x8efb('0x1'));module[_0x8efb('0x2')]={'channel':{'type':Sequelize[_0x8efb('0x3')]},'membername':{'type':Sequelize[_0x8efb('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8efb('0x3')],'defaultValue':_0x8efb('0x4'),'comment':_0x8efb('0x5')},'duration':{'type':Sequelize[_0x8efb('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8efb('0x7')],'set':function(_0x38d293){var _0x3e09b5=moment(_0x38d293);var _0x4e19c3=moment(this['getDataValue']('enterAt'));var _0x9e858f=_0x3e09b5[_0x8efb('0x8')](_0x4e19c3,_0x8efb('0x9'));this[_0x8efb('0xa')]('exitAt',_0x38d293);this[_0x8efb('0xa')](_0x8efb('0xb'),_0x9e858f>=0x0?_0x9e858f:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x8efb('0xc')},'data2':{'type':Sequelize[_0x8efb('0x3')],'comment':_0x8efb('0xd')},'data3':{'type':Sequelize[_0x8efb('0x3')],'comment':_0x8efb('0xe')},'data4':{'type':Sequelize[_0x8efb('0x3')],'comment':_0x8efb('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x8efb('0x10')},'role':{'type':Sequelize[_0x8efb('0x3')]},'internal':{'type':Sequelize[_0x8efb('0x6')]},'uniqueid':{'type':Sequelize[_0x8efb('0x3')]}}; \ No newline at end of file +var _0x01af=['talk:[start]','talk:[destination]','talk:[dial\x20string]','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds','exitAt','setDataValue','duration'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x01af,0x1c3));var _0xf01a=function(_0x22d546,_0x5994b0){_0x22d546=_0x22d546-0x0;var _0x299d31=_0x01af[_0x22d546];return _0x299d31;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf01a('0x0'));module['exports']={'channel':{'type':Sequelize[_0xf01a('0x1')]},'membername':{'type':Sequelize[_0xf01a('0x1')]},'interface':{'type':Sequelize[_0xf01a('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xf01a('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xf01a('0x3')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf01a('0x4')],'set':function(_0x1e5202){var _0x336969=moment(_0x1e5202);var _0x3dac35=moment(this[_0xf01a('0x5')](_0xf01a('0x6')));var _0x38640c=_0x336969['diff'](_0x3dac35,_0xf01a('0x7'));this['setDataValue'](_0xf01a('0x8'),_0x1e5202);this[_0xf01a('0x9')](_0xf01a('0xa'),_0x38640c>=0x0?_0x38640c:null);}},'data1':{'type':Sequelize[_0xf01a('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf01a('0x1')],'comment':_0xf01a('0xb')},'data3':{'type':Sequelize[_0xf01a('0x1')],'comment':_0xf01a('0xc')},'data4':{'type':Sequelize[_0xf01a('0x1')],'comment':_0xf01a('0xd')},'data5':{'type':Sequelize[_0xf01a('0x1')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xf01a('0x1')]},'internal':{'type':Sequelize[_0xf01a('0x3')]},'uniqueid':{'type':Sequelize[_0xf01a('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 811d623..1a02506 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x55ca,0x126));var _0xa55c=function(_0x329421,_0x414a49){_0x329421=_0x329421-0x0;var _0x5b31e8=_0x55ca[_0x329421];return _0x5b31e8;};'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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xedd9,0xfc));var _0x9edd=function(_0x405f9f,_0x1782aa){_0x405f9f=_0x405f9f-0x0;var _0x34a6d2=_0xedd9[_0x405f9f];return _0x34a6d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a3b219f..de9244b 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 _0xe683=['report_member','membername_interface','membername','interface','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x45cf18,_0x1c5e60){var _0x3c5783=function(_0x45e052){while(--_0x45e052){_0x45cf18['push'](_0x45cf18['shift']());}};_0x3c5783(++_0x1c5e60);}(_0xe683,0x1d2));var _0x3e68=function(_0x27422d,_0x46d34a){_0x27422d=_0x27422d-0x0;var _0x503a0b=_0xe683[_0x27422d];return _0x503a0b;};'use strict';var _=require(_0x3e68('0x0'));var util=require(_0x3e68('0x1'));var logger=require('../../config/logger')(_0x3e68('0x2'));var moment=require(_0x3e68('0x3'));var BPromise=require(_0x3e68('0x4'));var rp=require(_0x3e68('0x5'));var fs=require('fs');var path=require(_0x3e68('0x6'));var rimraf=require(_0x3e68('0x7'));var config=require(_0x3e68('0x8'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x396dd4,_0x49d42a){return _0x396dd4[_0x3e68('0x9')]('MemberReport',attributes,{'tableName':_0x3e68('0xa'),'paranoid':![],'indexes':[{'name':_0x3e68('0xb'),'fields':[_0x3e68('0xc'),_0x3e68('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5a3=['MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./memberReport.attributes','exports'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xd5a3,0x146));var _0x3d5a=function(_0x5ad00b,_0x22c334){_0x5ad00b=_0x5ad00b-0x0;var _0x2aab79=_0xd5a3[_0x5ad00b];return _0x2aab79;};'use strict';var _=require(_0x3d5a('0x0'));var util=require(_0x3d5a('0x1'));var logger=require(_0x3d5a('0x2'))(_0x3d5a('0x3'));var moment=require(_0x3d5a('0x4'));var BPromise=require(_0x3d5a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d5a('0x6'));var rimraf=require(_0x3d5a('0x7'));var config=require('../../config/environment');var attributes=require(_0x3d5a('0x8'));module[_0x3d5a('0x9')]=function(_0x25b32e,_0x295276){return _0x25b32e['define'](_0x3d5a('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x3d5a('0xb'),'fields':[_0x3d5a('0xc'),_0x3d5a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f90a96f..cc47ca9 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 _0x44c2=['options','where','attributes','limit','include','map','model','then','info','debug','CreateMemberReport','create','body','raw','update','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','code','error','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x2ec8ba,_0x3f7d7a){var _0x584100=function(_0x585646){while(--_0x585646){_0x2ec8ba['push'](_0x2ec8ba['shift']());}};_0x584100(++_0x3f7d7a);}(_0x44c2,0x100));var _0x244c=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0x44c2[_0xbebf50];return _0xce1496;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var moment=require(_0x244c('0x2'));var BPromise=require(_0x244c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244c('0x4'));var db=require(_0x244c('0x5'))['db'];var utils=require(_0x244c('0x6'));var logger=require(_0x244c('0x7'))(_0x244c('0x8'));var config=require(_0x244c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x244c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c758e,_0x18491b,_0x5b49a1){return new BPromise(function(_0x54b673,_0x1a0f7d){return client[_0x244c('0xb')](_0x4c758e,_0x5b49a1)['then'](function(_0xf5430e){logger['info']('MemberReport,\x20%s,\x20%s',_0x18491b,_0x244c('0xc'));logger['debug'](_0x244c('0xd'),_0x18491b,'request\x20sent',JSON[_0x244c('0xe')](_0xf5430e));if(_0xf5430e['error']){if(_0xf5430e['error'][_0x244c('0xf')]===0x1f4){logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0xf5430e['error'][_0x244c('0x12')]);return _0x1a0f7d(_0xf5430e[_0x244c('0x10')][_0x244c('0x12')]);}logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0xf5430e[_0x244c('0x10')][_0x244c('0x12')]);return _0x54b673(_0xf5430e['error'][_0x244c('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x18491b,_0x244c('0xc'));_0x54b673(_0xf5430e[_0x244c('0x13')][_0x244c('0x12')]);}})[_0x244c('0x14')](function(_0x5f2a11){logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0x5f2a11);_0x1a0f7d(_0x5f2a11);});});}exports[_0x244c('0x15')]=function(_0x1c339f){var _0x1ba203=this;return new Promise(function(_0x4ee7b2,_0x3531b){return db[_0x244c('0x16')][_0x244c('0x17')]({'raw':_0x1c339f['options']?_0x1c339f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c339f[_0x244c('0x18')]?_0x1c339f[_0x244c('0x18')][_0x244c('0x19')]||null:null,'attributes':_0x1c339f[_0x244c('0x18')]?_0x1c339f[_0x244c('0x18')][_0x244c('0x1a')]||null:null,'limit':_0x1c339f['options']?_0x1c339f[_0x244c('0x18')][_0x244c('0x1b')]||null:null,'include':_0x1c339f[_0x244c('0x18')]?_0x1c339f['options'][_0x244c('0x1c')]?_['map'](_0x1c339f['options'][_0x244c('0x1c')],function(_0x6aa1f4){return{'model':db[_0x6aa1f4['model']],'as':_0x6aa1f4['as'],'attributes':_0x6aa1f4[_0x244c('0x1a')],'include':_0x6aa1f4[_0x244c('0x1c')]?_[_0x244c('0x1d')](_0x6aa1f4[_0x244c('0x1c')],function(_0x54b7ae){return{'model':db[_0x54b7ae[_0x244c('0x1e')]],'as':_0x54b7ae['as'],'attributes':_0x54b7ae[_0x244c('0x1a')],'include':_0x54b7ae[_0x244c('0x1c')]?_[_0x244c('0x1d')](_0x54b7ae[_0x244c('0x1c')],function(_0x584d44){return{'model':db[_0x584d44['model']],'as':_0x584d44['as'],'attributes':_0x584d44[_0x244c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x244c('0x1f')](function(_0x193c50){logger[_0x244c('0x20')](_0x244c('0x15'),_0x1c339f);logger[_0x244c('0x21')](_0x244c('0x15'),_0x1c339f,JSON[_0x244c('0xe')](_0x193c50));_0x4ee7b2(_0x193c50);})[_0x244c('0x14')](function(_0x3dc983){logger['error']('GetMemberReport',_0x3dc983[_0x244c('0x12')],_0x1c339f);_0x3531b(_0x1ba203[_0x244c('0x10')](0x1f4,_0x3dc983[_0x244c('0x12')]));});});};exports[_0x244c('0x22')]=function(_0xf82c11){var _0x1e7340=this;return new Promise(function(_0x53d882,_0x33b062){return db[_0x244c('0x16')][_0x244c('0x23')](_0xf82c11[_0x244c('0x24')],{'raw':_0xf82c11[_0x244c('0x18')]?_0xf82c11[_0x244c('0x18')][_0x244c('0x25')]===undefined?!![]:![]:!![]})[_0x244c('0x1f')](function(_0x15aeaf){logger[_0x244c('0x20')](_0x244c('0x22'),_0xf82c11);logger[_0x244c('0x21')]('CreateMemberReport',_0xf82c11,JSON[_0x244c('0xe')](_0x15aeaf));_0x53d882(_0x15aeaf);})[_0x244c('0x14')](function(_0x38da69){logger[_0x244c('0x10')](_0x244c('0x22'),_0x38da69[_0x244c('0x12')],_0xf82c11);_0x33b062(_0x1e7340[_0x244c('0x10')](0x1f4,_0x38da69[_0x244c('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2e6a88){var _0x14c830=this;return new Promise(function(_0x4dd3a3,_0x3025a4){return db[_0x244c('0x16')][_0x244c('0x26')](_0x2e6a88[_0x244c('0x24')],{'raw':_0x2e6a88[_0x244c('0x18')]?_0x2e6a88[_0x244c('0x18')][_0x244c('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6a88[_0x244c('0x18')]?_0x2e6a88[_0x244c('0x18')][_0x244c('0x19')]||null:null,'attributes':_0x2e6a88['options']?_0x2e6a88[_0x244c('0x18')][_0x244c('0x1a')]||null:null,'limit':_0x2e6a88[_0x244c('0x18')]?_0x2e6a88[_0x244c('0x18')][_0x244c('0x1b')]||null:null})['then'](function(_0x5e1596){logger[_0x244c('0x20')]('UpdateMemberReport',_0x2e6a88);logger[_0x244c('0x21')](_0x244c('0x27'),_0x2e6a88,JSON[_0x244c('0xe')](_0x5e1596));_0x4dd3a3(_0x5e1596);})[_0x244c('0x14')](function(_0x1c69ab){logger[_0x244c('0x10')]('UpdateMemberReport',_0x1c69ab['message'],_0x2e6a88);_0x3025a4(_0x14c830[_0x244c('0x10')](0x1f4,_0x1c69ab[_0x244c('0x12')]));});});}; \ No newline at end of file +var _0xe714=['attributes','limit','include','map','model','CreateMemberReport','MemberReport','body','raw','UpdateMemberReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMemberReport','findAll','options','where'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe714,0xe2));var _0x4e71=function(_0x58f543,_0x3e07db){_0x58f543=_0x58f543-0x0;var _0xe9ad3d=_0xe714[_0x58f543];return _0xe9ad3d;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var moment=require(_0x4e71('0x1'));var BPromise=require(_0x4e71('0x2'));var rs=require(_0x4e71('0x3'));var fs=require('fs');var Redis=require(_0x4e71('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e71('0x5'));var logger=require('../../config/logger')(_0x4e71('0x6'));var config=require(_0x4e71('0x7'));var jayson=require(_0x4e71('0x8'));var client=jayson[_0x4e71('0x9')][_0x4e71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f1d35,_0x55b1cc,_0x3b0a3a){return new BPromise(function(_0x32b6d0,_0xda346c){return client['request'](_0x1f1d35,_0x3b0a3a)[_0x4e71('0xb')](function(_0x4fd08b){logger[_0x4e71('0xc')](_0x4e71('0xd'),_0x55b1cc,_0x4e71('0xe'));logger[_0x4e71('0xf')](_0x4e71('0x10'),_0x55b1cc,_0x4e71('0xe'),JSON[_0x4e71('0x11')](_0x4fd08b));if(_0x4fd08b[_0x4e71('0x12')]){if(_0x4fd08b['error'][_0x4e71('0x13')]===0x1f4){logger[_0x4e71('0x12')]('MemberReport,\x20%s,\x20%s',_0x55b1cc,_0x4fd08b[_0x4e71('0x12')][_0x4e71('0x14')]);return _0xda346c(_0x4fd08b['error'][_0x4e71('0x14')]);}logger[_0x4e71('0x12')]('MemberReport,\x20%s,\x20%s',_0x55b1cc,_0x4fd08b['error'][_0x4e71('0x14')]);return _0x32b6d0(_0x4fd08b['error']['message']);}else{logger['info'](_0x4e71('0xd'),_0x55b1cc,_0x4e71('0xe'));_0x32b6d0(_0x4fd08b['result']['message']);}})[_0x4e71('0x15')](function(_0x1941ad){logger[_0x4e71('0x12')](_0x4e71('0xd'),_0x55b1cc,_0x1941ad);_0xda346c(_0x1941ad);});});}exports[_0x4e71('0x16')]=function(_0x281a2b){var _0x5a98e9=this;return new Promise(function(_0x18b745,_0xd0a59e){return db['MemberReport'][_0x4e71('0x17')]({'raw':_0x281a2b[_0x4e71('0x18')]?_0x281a2b['options']['raw']===undefined?!![]:![]:!![],'where':_0x281a2b['options']?_0x281a2b[_0x4e71('0x18')][_0x4e71('0x19')]||null:null,'attributes':_0x281a2b[_0x4e71('0x18')]?_0x281a2b[_0x4e71('0x18')][_0x4e71('0x1a')]||null:null,'limit':_0x281a2b[_0x4e71('0x18')]?_0x281a2b[_0x4e71('0x18')][_0x4e71('0x1b')]||null:null,'include':_0x281a2b[_0x4e71('0x18')]?_0x281a2b[_0x4e71('0x18')][_0x4e71('0x1c')]?_[_0x4e71('0x1d')](_0x281a2b['options']['include'],function(_0x56dd25){return{'model':db[_0x56dd25['model']],'as':_0x56dd25['as'],'attributes':_0x56dd25[_0x4e71('0x1a')],'include':_0x56dd25[_0x4e71('0x1c')]?_[_0x4e71('0x1d')](_0x56dd25['include'],function(_0x35f181){return{'model':db[_0x35f181[_0x4e71('0x1e')]],'as':_0x35f181['as'],'attributes':_0x35f181[_0x4e71('0x1a')],'include':_0x35f181[_0x4e71('0x1c')]?_[_0x4e71('0x1d')](_0x35f181[_0x4e71('0x1c')],function(_0x53b08a){return{'model':db[_0x53b08a['model']],'as':_0x53b08a['as'],'attributes':_0x53b08a[_0x4e71('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4e71('0xb')](function(_0x376b12){logger[_0x4e71('0xc')](_0x4e71('0x16'),_0x281a2b);logger[_0x4e71('0xf')]('GetMemberReport',_0x281a2b,JSON['stringify'](_0x376b12));_0x18b745(_0x376b12);})['catch'](function(_0x2a7ce3){logger[_0x4e71('0x12')]('GetMemberReport',_0x2a7ce3[_0x4e71('0x14')],_0x281a2b);_0xd0a59e(_0x5a98e9['error'](0x1f4,_0x2a7ce3[_0x4e71('0x14')]));});});};exports[_0x4e71('0x1f')]=function(_0x26e14c){var _0x3ab32c=this;return new Promise(function(_0x34a84f,_0x595f05){return db[_0x4e71('0x20')]['create'](_0x26e14c[_0x4e71('0x21')],{'raw':_0x26e14c[_0x4e71('0x18')]?_0x26e14c[_0x4e71('0x18')][_0x4e71('0x22')]===undefined?!![]:![]:!![]})[_0x4e71('0xb')](function(_0x5cf822){logger['info']('CreateMemberReport',_0x26e14c);logger[_0x4e71('0xf')](_0x4e71('0x1f'),_0x26e14c,JSON['stringify'](_0x5cf822));_0x34a84f(_0x5cf822);})[_0x4e71('0x15')](function(_0x325255){logger['error']('CreateMemberReport',_0x325255[_0x4e71('0x14')],_0x26e14c);_0x595f05(_0x3ab32c[_0x4e71('0x12')](0x1f4,_0x325255['message']));});});};exports[_0x4e71('0x23')]=function(_0x22642a){var _0x5d67e2=this;return new Promise(function(_0x24a8eb,_0x16c910){return db[_0x4e71('0x20')]['update'](_0x22642a[_0x4e71('0x21')],{'raw':_0x22642a[_0x4e71('0x18')]?_0x22642a[_0x4e71('0x18')][_0x4e71('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22642a[_0x4e71('0x18')]?_0x22642a['options'][_0x4e71('0x19')]||null:null,'attributes':_0x22642a[_0x4e71('0x18')]?_0x22642a[_0x4e71('0x18')][_0x4e71('0x1a')]||null:null,'limit':_0x22642a[_0x4e71('0x18')]?_0x22642a['options']['limit']||null:null})[_0x4e71('0xb')](function(_0x1b5a34){logger[_0x4e71('0xc')](_0x4e71('0x23'),_0x22642a);logger[_0x4e71('0xf')]('UpdateMemberReport',_0x22642a,JSON[_0x4e71('0x11')](_0x1b5a34));_0x24a8eb(_0x1b5a34);})['catch'](function(_0x285b62){logger['error'](_0x4e71('0x23'),_0x285b62[_0x4e71('0x14')],_0x22642a);_0x16c910(_0x5d67e2['error'](0x1f4,_0x285b62[_0x4e71('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 88c7635..330679a 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 _0x68f5=['../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path','express','Router','fs-extra'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x68f5,0x11a));var _0x568f=function(_0x340598,_0x14454a){_0x340598=_0x340598-0x0;var _0x57d248=_0x68f5[_0x340598];return _0x57d248;};'use strict';var multer=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var path=require(_0x568f('0x2'));var timeout=require('connect-timeout');var express=require(_0x568f('0x3'));var router=express[_0x568f('0x4')]();var fs_extra=require(_0x568f('0x5'));var auth=require(_0x568f('0x6'));var interaction=require(_0x568f('0x7'));var config=require('../../config/environment');var controller=require(_0x568f('0x8'));router[_0x568f('0x9')]('/',controller[_0x568f('0xa')]);module[_0x568f('0xb')]=router; \ No newline at end of file +var _0x598a=['exports','multer','util','path','connect-timeout','express','fs-extra','./migration.controller','get','index'];(function(_0x1a4332,_0x4f3f5a){var _0x2e43ef=function(_0x336d5a){while(--_0x336d5a){_0x1a4332['push'](_0x1a4332['shift']());}};_0x2e43ef(++_0x4f3f5a);}(_0x598a,0xfb));var _0xa598=function(_0x5134b8,_0x2b9ec7){_0x5134b8=_0x5134b8-0x0;var _0x2da0c5=_0x598a[_0x5134b8];return _0x2da0c5;};'use strict';var multer=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var path=require(_0xa598('0x2'));var timeout=require(_0xa598('0x3'));var express=require(_0xa598('0x4'));var router=express['Router']();var fs_extra=require(_0xa598('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa598('0x6'));router[_0xa598('0x7')]('/',controller[_0xa598('0x8')]);module[_0xa598('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 34ad32f..15a5e9c 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 _0x9802=['exports','version'];(function(_0x1d341e,_0x25c2ea){var _0x1f9fce=function(_0x1d051c){while(--_0x1d051c){_0x1d341e['push'](_0x1d341e['shift']());}};_0x1f9fce(++_0x25c2ea);}(_0x9802,0x1f2));var _0x2980=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x9802[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require('sequelize');module[_0x2980('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x2980('0x1')}}; \ No newline at end of file +var _0x98fe=['version','sequelize','STRING'];(function(_0x4af1f1,_0x5c4d4b){var _0x22808a=function(_0x592f76){while(--_0x592f76){_0x4af1f1['push'](_0x4af1f1['shift']());}};_0x22808a(++_0x5c4d4b);}(_0x98fe,0x94));var _0xe98f=function(_0x477056,_0x19d9d8){_0x477056=_0x477056-0x0;var _0x3227d2=_0x98fe[_0x477056];return _0x3227d2;};'use strict';var Sequelize=require(_0xe98f('0x0'));module['exports']={'version':{'type':Sequelize[_0xe98f('0x1')],'unique':_0xe98f('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 60b8924..73fd4a5 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 _0x0fef=['where','pick','merge','type','VIRTUAL','filter','include','Migration','findAll','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','then','stack','name','map','fieldName','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x0fef,0xfa));var _0xf0fe=function(_0x32de72,_0x137aaf){_0x32de72=_0x32de72-0x0;var _0x224de0=_0x0fef[_0x32de72];return _0x224de0;};'use strict';var emlformat=require(_0xf0fe('0x0'));var rimraf=require(_0xf0fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0fe('0x2'));var rp=require('request-promise');var moment=require(_0xf0fe('0x3'));var BPromise=require(_0xf0fe('0x4'));var Mustache=require(_0xf0fe('0x5'));var util=require(_0xf0fe('0x6'));var path=require(_0xf0fe('0x7'));var sox=require(_0xf0fe('0x8'));var csv=require(_0xf0fe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0fe('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf0fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf0fe('0xc'));var toCsv=require(_0xf0fe('0x9'));var querystring=require(_0xf0fe('0xd'));var Papa=require('papaparse');var Redis=require(_0xf0fe('0xe'));var authService=require(_0xf0fe('0xf'));var qs=require(_0xf0fe('0x10'));var as=require(_0xf0fe('0x11'));var hardwareService=require(_0xf0fe('0x12'));var logger=require(_0xf0fe('0x13'))('api');var utils=require(_0xf0fe('0x14'));var config=require(_0xf0fe('0x15'));var licenseUtil=require(_0xf0fe('0x16'));var db=require(_0xf0fe('0x17'))['db'];function respondWithStatusCode(_0xb2a3b7,_0x2acfb5){_0x2acfb5=_0x2acfb5||0xcc;return function(_0x1c75a7){if(_0x1c75a7){return _0xb2a3b7['sendStatus'](_0x2acfb5);}return _0xb2a3b7['status'](_0x2acfb5)[_0xf0fe('0x18')]();};}function respondWithResult(_0x1cb10a,_0x29ea44){_0x29ea44=_0x29ea44||0xc8;return function(_0x3a3b64){if(_0x3a3b64){return _0x1cb10a['status'](_0x29ea44)[_0xf0fe('0x19')](_0x3a3b64);}};}function respondWithFilteredResult(_0x5cb9d4,_0x1fd367){return function(_0x317f43){if(_0x317f43){var _0x5be602=typeof _0x1fd367[_0xf0fe('0x1a')]==='undefined'&&typeof _0x1fd367[_0xf0fe('0x1b')]===_0xf0fe('0x1c');var _0xc77916=_0x317f43['count'];var _0x41457b=_0x5be602?0x0:_0x1fd367['offset'];var _0x4439ca=_0x5be602?_0x317f43[_0xf0fe('0x1d')]:_0x1fd367[_0xf0fe('0x1a')]+_0x1fd367['limit'];var _0x5c0134;if(_0x4439ca>=_0xc77916){_0x4439ca=_0xc77916;_0x5c0134=0xc8;}else{_0x5c0134=0xce;}_0x5cb9d4[_0xf0fe('0x1e')](_0x5c0134);return _0x5cb9d4[_0xf0fe('0x1f')](_0xf0fe('0x20'),_0x41457b+'-'+_0x4439ca+'/'+_0xc77916)['json'](_0x317f43);}return null;};}function patchUpdates(_0x3f261f){return function(_0xe7c8a){try{jsonpatch[_0xf0fe('0x21')](_0xe7c8a,_0x3f261f,!![]);}catch(_0x4a77cd){return BPromise['reject'](_0x4a77cd);}return _0xe7c8a[_0xf0fe('0x22')]();};}function saveUpdates(_0x48c5b3,_0x5d2be3){return function(_0x3c0ddd){if(_0x3c0ddd){return _0x3c0ddd['update'](_0x48c5b3)[_0xf0fe('0x23')](function(_0x3365ea){return _0x3365ea;});}return null;};}function removeEntity(_0x3e2601,_0xa98fdf){return function(_0x11d5fa){if(_0x11d5fa){return _0x11d5fa['destroy']()['then'](function(){_0x3e2601[_0xf0fe('0x1e')](0xcc)[_0xf0fe('0x18')]();});}};}function handleEntityNotFound(_0x144d40,_0x27c1f8){return function(_0x37bfd3){if(!_0x37bfd3){_0x144d40['sendStatus'](0x194);}return _0x37bfd3;};}function handleError(_0x3037bb,_0x3fb96e){_0x3fb96e=_0x3fb96e||0x1f4;return function(_0x313f18){logger['error'](_0x313f18[_0xf0fe('0x24')]);if(_0x313f18[_0xf0fe('0x25')]){delete _0x313f18[_0xf0fe('0x25')];}_0x3037bb[_0xf0fe('0x1e')](_0x3fb96e)['send'](_0x313f18);};}exports['index']=function(_0x137a22,_0x3df10d){var _0xc68179={},_0x1e7c99={},_0x2535e1={'count':0x0,'rows':[]};var _0x5a4213=_[_0xf0fe('0x26')](db['Migration']['rawAttributes'],function(_0x4befae){return{'name':_0x4befae[_0xf0fe('0x27')],'type':_0x4befae['type']['key']};});_0x1e7c99[_0xf0fe('0x28')]=_[_0xf0fe('0x26')](_0x5a4213,_0xf0fe('0x25'));_0x1e7c99['query']=_[_0xf0fe('0x29')](_0x137a22['query']);_0x1e7c99['filters']=_['intersection'](_0x1e7c99[_0xf0fe('0x28')],_0x1e7c99[_0xf0fe('0x2a')]);_0xc68179[_0xf0fe('0x2b')]=_[_0xf0fe('0x2c')](_0x1e7c99[_0xf0fe('0x28')],qs[_0xf0fe('0x2d')](_0x137a22['query']['fields']));_0xc68179[_0xf0fe('0x2b')]=_0xc68179['attributes'][_0xf0fe('0x2e')]?_0xc68179['attributes']:_0x1e7c99[_0xf0fe('0x28')];if(!_0x137a22['query']['hasOwnProperty'](_0xf0fe('0x2f'))){_0xc68179[_0xf0fe('0x1b')]=qs[_0xf0fe('0x1b')](_0x137a22['query'][_0xf0fe('0x1b')]);_0xc68179[_0xf0fe('0x1a')]=qs[_0xf0fe('0x1a')](_0x137a22[_0xf0fe('0x2a')]['offset']);}_0xc68179[_0xf0fe('0x30')]=qs[_0xf0fe('0x31')](_0x137a22[_0xf0fe('0x2a')]['sort']);_0xc68179[_0xf0fe('0x32')]=qs['filters'](_[_0xf0fe('0x33')](_0x137a22['query'],_0x1e7c99['filters']),_0x5a4213);if(_0x137a22[_0xf0fe('0x2a')]['filter']){_0xc68179[_0xf0fe('0x32')]=_[_0xf0fe('0x34')](_0xc68179[_0xf0fe('0x32')],{'$or':_[_0xf0fe('0x26')](_0x5a4213,function(_0x4e43fb){if(_0x4e43fb[_0xf0fe('0x35')]!==_0xf0fe('0x36')){var _0x1e3e51={};_0x1e3e51[_0x4e43fb['name']]={'$like':'%'+_0x137a22[_0xf0fe('0x2a')][_0xf0fe('0x37')]+'%'};return _0x1e3e51;}})});}_0xc68179=_[_0xf0fe('0x34')]({},_0xc68179,_0x137a22['options']);var _0x4cc667={'where':_0xc68179[_0xf0fe('0x32')]};return db['Migration'][_0xf0fe('0x1d')](_0x4cc667)['then'](function(_0xd6f2c0){_0x2535e1['count']=_0xd6f2c0;if(_0x137a22[_0xf0fe('0x2a')]['includeAll']){_0xc68179[_0xf0fe('0x38')]=[{'all':!![]}];}return db[_0xf0fe('0x39')][_0xf0fe('0x3a')](_0xc68179);})['then'](function(_0x3cfda4){_0x2535e1[_0xf0fe('0x3b')]=_0x3cfda4;return _0x2535e1;})[_0xf0fe('0x23')](respondWithFilteredResult(_0x3df10d,_0xc68179))['catch'](handleError(_0x3df10d,null));}; \ No newline at end of file +var _0xa038=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','Migration','rawAttributes','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3b8801,_0x45d560){var _0x277803=function(_0x34b546){while(--_0x34b546){_0x3b8801['push'](_0x3b8801['shift']());}};_0x277803(++_0x45d560);}(_0xa038,0x197));var _0x8a03=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa038[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x8a03('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a03('0x1'));var rp=require(_0x8a03('0x2'));var moment=require(_0x8a03('0x3'));var BPromise=require(_0x8a03('0x4'));var Mustache=require(_0x8a03('0x5'));var util=require(_0x8a03('0x6'));var path=require(_0x8a03('0x7'));var sox=require(_0x8a03('0x8'));var csv=require(_0x8a03('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a03('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a03('0xb'));var deskjs=require(_0x8a03('0xc'));var toCsv=require(_0x8a03('0x9'));var querystring=require(_0x8a03('0xd'));var Papa=require(_0x8a03('0xe'));var Redis=require(_0x8a03('0xf'));var authService=require(_0x8a03('0x10'));var qs=require(_0x8a03('0x11'));var as=require(_0x8a03('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a03('0x13'))(_0x8a03('0x14'));var utils=require('../../config/utils');var config=require(_0x8a03('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a03('0x16'))['db'];function respondWithStatusCode(_0x1ebb45,_0x39532b){_0x39532b=_0x39532b||0xcc;return function(_0x50ee05){if(_0x50ee05){return _0x1ebb45[_0x8a03('0x17')](_0x39532b);}return _0x1ebb45[_0x8a03('0x18')](_0x39532b)['end']();};}function respondWithResult(_0x627900,_0x253ade){_0x253ade=_0x253ade||0xc8;return function(_0x3211e5){if(_0x3211e5){return _0x627900[_0x8a03('0x18')](_0x253ade)[_0x8a03('0x19')](_0x3211e5);}};}function respondWithFilteredResult(_0x2b8cec,_0x27ce4f){return function(_0x332992){if(_0x332992){var _0xe2422e=typeof _0x27ce4f['offset']===_0x8a03('0x1a')&&typeof _0x27ce4f[_0x8a03('0x1b')]===_0x8a03('0x1a');var _0x4487a3=_0x332992[_0x8a03('0x1c')];var _0x166ba1=_0xe2422e?0x0:_0x27ce4f['offset'];var _0x471c3a=_0xe2422e?_0x332992[_0x8a03('0x1c')]:_0x27ce4f['offset']+_0x27ce4f[_0x8a03('0x1b')];var _0x1a5977;if(_0x471c3a>=_0x4487a3){_0x471c3a=_0x4487a3;_0x1a5977=0xc8;}else{_0x1a5977=0xce;}_0x2b8cec['status'](_0x1a5977);return _0x2b8cec[_0x8a03('0x1d')](_0x8a03('0x1e'),_0x166ba1+'-'+_0x471c3a+'/'+_0x4487a3)[_0x8a03('0x19')](_0x332992);}return null;};}function patchUpdates(_0x2b757a){return function(_0x59bc73){try{jsonpatch[_0x8a03('0x1f')](_0x59bc73,_0x2b757a,!![]);}catch(_0x20fc75){return BPromise[_0x8a03('0x20')](_0x20fc75);}return _0x59bc73[_0x8a03('0x21')]();};}function saveUpdates(_0x401608,_0x48d024){return function(_0x322aaf){if(_0x322aaf){return _0x322aaf[_0x8a03('0x22')](_0x401608)[_0x8a03('0x23')](function(_0x5e8bf0){return _0x5e8bf0;});}return null;};}function removeEntity(_0x241b00,_0x2fe2d6){return function(_0x461ad5){if(_0x461ad5){return _0x461ad5[_0x8a03('0x24')]()[_0x8a03('0x23')](function(){_0x241b00[_0x8a03('0x18')](0xcc)[_0x8a03('0x25')]();});}};}function handleEntityNotFound(_0x4f0ac3,_0x3d81a6){return function(_0x70d5da){if(!_0x70d5da){_0x4f0ac3[_0x8a03('0x17')](0x194);}return _0x70d5da;};}function handleError(_0x38ca13,_0x3ccbce){_0x3ccbce=_0x3ccbce||0x1f4;return function(_0x20d030){logger[_0x8a03('0x26')](_0x20d030[_0x8a03('0x27')]);if(_0x20d030['name']){delete _0x20d030[_0x8a03('0x28')];}_0x38ca13[_0x8a03('0x18')](_0x3ccbce)[_0x8a03('0x29')](_0x20d030);};}exports[_0x8a03('0x2a')]=function(_0x5ae3c2,_0x1f48c8){var _0x1f1cd4={},_0xe44c0={},_0x516a71={'count':0x0,'rows':[]};var _0x5d23d4=_['map'](db[_0x8a03('0x2b')][_0x8a03('0x2c')],function(_0x4c3972){return{'name':_0x4c3972['fieldName'],'type':_0x4c3972['type']['key']};});_0xe44c0[_0x8a03('0x2d')]=_['map'](_0x5d23d4,_0x8a03('0x28'));_0xe44c0[_0x8a03('0x2e')]=_[_0x8a03('0x2f')](_0x5ae3c2[_0x8a03('0x2e')]);_0xe44c0['filters']=_[_0x8a03('0x30')](_0xe44c0['model'],_0xe44c0[_0x8a03('0x2e')]);_0x1f1cd4['attributes']=_[_0x8a03('0x30')](_0xe44c0['model'],qs[_0x8a03('0x31')](_0x5ae3c2[_0x8a03('0x2e')]['fields']));_0x1f1cd4[_0x8a03('0x32')]=_0x1f1cd4['attributes'][_0x8a03('0x33')]?_0x1f1cd4[_0x8a03('0x32')]:_0xe44c0['model'];if(!_0x5ae3c2[_0x8a03('0x2e')][_0x8a03('0x34')](_0x8a03('0x35'))){_0x1f1cd4['limit']=qs[_0x8a03('0x1b')](_0x5ae3c2[_0x8a03('0x2e')][_0x8a03('0x1b')]);_0x1f1cd4['offset']=qs['offset'](_0x5ae3c2['query'][_0x8a03('0x36')]);}_0x1f1cd4[_0x8a03('0x37')]=qs[_0x8a03('0x38')](_0x5ae3c2['query'][_0x8a03('0x38')]);_0x1f1cd4[_0x8a03('0x39')]=qs[_0x8a03('0x3a')](_[_0x8a03('0x3b')](_0x5ae3c2[_0x8a03('0x2e')],_0xe44c0[_0x8a03('0x3a')]),_0x5d23d4);if(_0x5ae3c2[_0x8a03('0x2e')][_0x8a03('0x3c')]){_0x1f1cd4[_0x8a03('0x39')]=_[_0x8a03('0x3d')](_0x1f1cd4[_0x8a03('0x39')],{'$or':_[_0x8a03('0x3e')](_0x5d23d4,function(_0x579fa4){if(_0x579fa4[_0x8a03('0x3f')]!==_0x8a03('0x40')){var _0xf518bb={};_0xf518bb[_0x579fa4[_0x8a03('0x28')]]={'$like':'%'+_0x5ae3c2[_0x8a03('0x2e')][_0x8a03('0x3c')]+'%'};return _0xf518bb;}})});}_0x1f1cd4=_[_0x8a03('0x3d')]({},_0x1f1cd4,_0x5ae3c2[_0x8a03('0x41')]);var _0x827655={'where':_0x1f1cd4[_0x8a03('0x39')]};return db[_0x8a03('0x2b')]['count'](_0x827655)[_0x8a03('0x23')](function(_0xe6ea09){_0x516a71[_0x8a03('0x1c')]=_0xe6ea09;if(_0x5ae3c2[_0x8a03('0x2e')][_0x8a03('0x42')]){_0x1f1cd4[_0x8a03('0x43')]=[{'all':!![]}];}return db[_0x8a03('0x2b')][_0x8a03('0x44')](_0x1f1cd4);})['then'](function(_0xd1399b){_0x516a71[_0x8a03('0x45')]=_0xd1399b;return _0x516a71;})[_0x8a03('0x23')](respondWithFilteredResult(_0x1f48c8,_0x1f1cd4))[_0x8a03('0x46')](handleError(_0x1f48c8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2836b7c..053a5ca 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 _0x9b48=['rimraf','../../config/environment','./migration.attributes','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x43c6be,_0x24bbc3){var _0x40ddac=function(_0x589ca6){while(--_0x589ca6){_0x43c6be['push'](_0x43c6be['shift']());}};_0x40ddac(++_0x24bbc3);}(_0x9b48,0x7c));var _0x89b4=function(_0x5f1747,_0x47b9c3){_0x5f1747=_0x5f1747-0x0;var _0x4bdfe6=_0x9b48[_0x5f1747];return _0x4bdfe6;};'use strict';var _=require(_0x89b4('0x0'));var util=require(_0x89b4('0x1'));var logger=require(_0x89b4('0x2'))(_0x89b4('0x3'));var moment=require(_0x89b4('0x4'));var BPromise=require(_0x89b4('0x5'));var rp=require(_0x89b4('0x6'));var fs=require('fs');var path=require(_0x89b4('0x7'));var rimraf=require(_0x89b4('0x8'));var config=require(_0x89b4('0x9'));var attributes=require(_0x89b4('0xa'));module['exports']=function(_0x4dbc5a,_0x43bc41){return _0x4dbc5a['define']('Migration',attributes,{'tableName':_0x89b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e80=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x27e001,_0x23025b){var _0xe60c5f=function(_0x5d23ea){while(--_0x5d23ea){_0x27e001['push'](_0x27e001['shift']());}};_0xe60c5f(++_0x23025b);}(_0x3e80,0x1c6));var _0x03e8=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x3e80[_0x51b1a5];return _0x15c738;};'use strict';var _=require(_0x03e8('0x0'));var util=require(_0x03e8('0x1'));var logger=require(_0x03e8('0x2'))(_0x03e8('0x3'));var moment=require(_0x03e8('0x4'));var BPromise=require(_0x03e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03e8('0x6'));var rimraf=require(_0x03e8('0x7'));var config=require(_0x03e8('0x8'));var attributes=require(_0x03e8('0x9'));module[_0x03e8('0xa')]=function(_0x4781ef,_0x55a7f4){return _0x4781ef[_0x03e8('0xb')](_0x03e8('0xc'),attributes,{'tableName':_0x03e8('0xd'),'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 2c5c6ea..6cdc50a 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 _0x24b3=['code','message','result','lodash','util','moment','randomstring','../../config/logger','rpc','jayson/promise','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x8cba36,_0x5b358a){var _0x2aca99=function(_0x445f08){while(--_0x445f08){_0x8cba36['push'](_0x8cba36['shift']());}};_0x2aca99(++_0x5b358a);}(_0x24b3,0xd3));var _0x324b=function(_0x4e27a0,_0x24880d){_0x4e27a0=_0x4e27a0-0x0;var _0xf5888d=_0x24b3[_0x4e27a0];return _0xf5888d;};'use strict';var _=require(_0x324b('0x0'));var util=require(_0x324b('0x1'));var moment=require(_0x324b('0x2'));var BPromise=require('bluebird');var rs=require(_0x324b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x324b('0x4'))(_0x324b('0x5'));var config=require('../../config/environment');var jayson=require(_0x324b('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x563222,_0x4021fc,_0x39d42c){return new BPromise(function(_0x7da7d0,_0x5945ef){return client['request'](_0x563222,_0x39d42c)['then'](function(_0xfffec0){logger['info'](_0x324b('0x7'),_0x4021fc,_0x324b('0x8'));logger[_0x324b('0x9')](_0x324b('0xa'),_0x4021fc,_0x324b('0x8'),JSON[_0x324b('0xb')](_0xfffec0));if(_0xfffec0[_0x324b('0xc')]){if(_0xfffec0[_0x324b('0xc')][_0x324b('0xd')]===0x1f4){logger[_0x324b('0xc')]('Migration,\x20%s,\x20%s',_0x4021fc,_0xfffec0[_0x324b('0xc')][_0x324b('0xe')]);return _0x5945ef(_0xfffec0[_0x324b('0xc')][_0x324b('0xe')]);}logger[_0x324b('0xc')](_0x324b('0x7'),_0x4021fc,_0xfffec0[_0x324b('0xc')][_0x324b('0xe')]);return _0x7da7d0(_0xfffec0[_0x324b('0xc')][_0x324b('0xe')]);}else{logger['info'](_0x324b('0x7'),_0x4021fc,'request\x20sent');_0x7da7d0(_0xfffec0[_0x324b('0xf')][_0x324b('0xe')]);}})['catch'](function(_0x2c2a6d){logger[_0x324b('0xc')](_0x324b('0x7'),_0x4021fc,_0x2c2a6d);_0x5945ef(_0x2c2a6d);});});} \ No newline at end of file +var _0x938c=['catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result'];(function(_0x2a14cb,_0x182d7f){var _0x33327a=function(_0x20cc12){while(--_0x20cc12){_0x2a14cb['push'](_0x2a14cb['shift']());}};_0x33327a(++_0x182d7f);}(_0x938c,0x11f));var _0xc938=function(_0x4b714e,_0x489515){_0x4b714e=_0x4b714e-0x0;var _0x42084b=_0x938c[_0x4b714e];return _0x42084b;};'use strict';var _=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var moment=require('moment');var BPromise=require(_0xc938('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc938('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc938('0x4'))(_0xc938('0x5'));var config=require(_0xc938('0x6'));var jayson=require(_0xc938('0x7'));var client=jayson[_0xc938('0x8')][_0xc938('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c08fe,_0x384ff3,_0x6e8871){return new BPromise(function(_0x52fbb1,_0x3037f1){return client[_0xc938('0xa')](_0x5c08fe,_0x6e8871)['then'](function(_0x1bfe72){logger['info']('Migration,\x20%s,\x20%s',_0x384ff3,_0xc938('0xb'));logger[_0xc938('0xc')](_0xc938('0xd'),_0x384ff3,'request\x20sent',JSON[_0xc938('0xe')](_0x1bfe72));if(_0x1bfe72[_0xc938('0xf')]){if(_0x1bfe72['error'][_0xc938('0x10')]===0x1f4){logger['error'](_0xc938('0x11'),_0x384ff3,_0x1bfe72[_0xc938('0xf')][_0xc938('0x12')]);return _0x3037f1(_0x1bfe72['error'][_0xc938('0x12')]);}logger[_0xc938('0xf')](_0xc938('0x11'),_0x384ff3,_0x1bfe72['error']['message']);return _0x52fbb1(_0x1bfe72['error'][_0xc938('0x12')]);}else{logger[_0xc938('0x13')](_0xc938('0x11'),_0x384ff3,'request\x20sent');_0x52fbb1(_0x1bfe72[_0xc938('0x14')]['message']);}})[_0xc938('0x15')](function(_0x4b68be){logger['error'](_0xc938('0x11'),_0x384ff3,_0x4b68be);_0x3037f1(_0x4b68be);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5365a1c..3da5b0b 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 _0x115f=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','/:id','show','create','update','delete','destroy','multer'];(function(_0x297df7,_0x8d74c2){var _0x5de49f=function(_0x5ebc1b){while(--_0x5ebc1b){_0x297df7['push'](_0x297df7['shift']());}};_0x5de49f(++_0x8d74c2);}(_0x115f,0x76));var _0xf115=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x115f[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xf115('0x0'));var util=require(_0xf115('0x1'));var path=require(_0xf115('0x2'));var timeout=require(_0xf115('0x3'));var express=require(_0xf115('0x4'));var router=express[_0xf115('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf115('0x6'));var config=require(_0xf115('0x7'));var controller=require(_0xf115('0x8'));router['get']('/',auth[_0xf115('0x9')](),controller[_0xf115('0xa')]);router['get'](_0xf115('0xb'),auth['isAuthenticated'](),controller[_0xf115('0xc')]);router['post']('/',auth[_0xf115('0x9')](),controller[_0xf115('0xd')]);router['put']('/:id',auth[_0xf115('0x9')](),controller[_0xf115('0xe')]);router[_0xf115('0xf')](_0xf115('0xb'),auth['isAuthenticated'](),controller[_0xf115('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7008=['index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0x7008,0x185));var _0x8700=function(_0x24a18f,_0xd076cc){_0x24a18f=_0x24a18f-0x0;var _0x2d3d3f=_0x7008[_0x24a18f];return _0x2d3d3f;};'use strict';var multer=require(_0x8700('0x0'));var util=require(_0x8700('0x1'));var path=require(_0x8700('0x2'));var timeout=require(_0x8700('0x3'));var express=require('express');var router=express[_0x8700('0x4')]();var fs_extra=require(_0x8700('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8700('0x6'));var config=require(_0x8700('0x7'));var controller=require(_0x8700('0x8'));router[_0x8700('0x9')]('/',auth[_0x8700('0xa')](),controller[_0x8700('0xb')]);router[_0x8700('0x9')]('/:id',auth[_0x8700('0xa')](),controller[_0x8700('0xc')]);router[_0x8700('0xd')]('/',auth[_0x8700('0xa')](),controller[_0x8700('0xe')]);router[_0x8700('0xf')](_0x8700('0x10'),auth[_0x8700('0xa')](),controller[_0x8700('0x11')]);router[_0x8700('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8700('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 481029f..7e37765 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 _0x1604=['STRING','sequelize','exports','ENUM','localnet','stun'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1604,0xaf));var _0x4160=function(_0x1f269a,_0x23719d){_0x1f269a=_0x1f269a-0x0;var _0x9aa1d8=_0x1604[_0x1f269a];return _0x9aa1d8;};'use strict';var Sequelize=require(_0x4160('0x0'));module[_0x4160('0x1')]={'type':{'type':Sequelize[_0x4160('0x2')](_0x4160('0x3'),'externip',_0x4160('0x4'),'turn')},'value':{'type':Sequelize[_0x4160('0x5')]},'username':{'type':Sequelize[_0x4160('0x5')]},'password':{'type':Sequelize[_0x4160('0x5')]}}; \ No newline at end of file +var _0x414d=['STRING','sequelize','ENUM','localnet','stun','turn'];(function(_0x34e111,_0x3c2abd){var _0x4dcc22=function(_0x5d9293){while(--_0x5d9293){_0x34e111['push'](_0x34e111['shift']());}};_0x4dcc22(++_0x3c2abd);}(_0x414d,0x9d));var _0xd414=function(_0x5cb367,_0x27ec9d){_0x5cb367=_0x5cb367-0x0;var _0x279365=_0x414d[_0x5cb367];return _0x279365;};'use strict';var Sequelize=require(_0xd414('0x0'));module['exports']={'type':{'type':Sequelize[_0xd414('0x1')](_0xd414('0x2'),'externip',_0xd414('0x3'),_0xd414('0x4'))},'value':{'type':Sequelize[_0xd414('0x5')]},'username':{'type':Sequelize[_0xd414('0x5')]},'password':{'type':Sequelize[_0xd414('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 729d553..0b36fdb 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 _0xcdd9=['sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Network','includeAll','include','findAll','rows','show','keys','options','create','body','toUpperCase','readFileSync','root','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','Reload','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','find','STUN','server/files/templates/stun_multiple.ejs','writeFileSync','toLowerCase','TURN','path','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end'];(function(_0x36f74a,_0x3ac324){var _0x30c31f=function(_0x1c08ee){while(--_0x1c08ee){_0x36f74a['push'](_0x36f74a['shift']());}};_0x30c31f(++_0x3ac324);}(_0xcdd9,0x1e0));var _0x9cdd=function(_0x22ee31,_0x352943){_0x22ee31=_0x22ee31-0x0;var _0x134eb2=_0xcdd9[_0x22ee31];return _0x134eb2;};'use strict';var util=require('util');var path=require(_0x9cdd('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x9cdd('0x1'));var logger=require(_0x9cdd('0x2'))(_0x9cdd('0x3'));var config=require(_0x9cdd('0x4'));var db=require(_0x9cdd('0x5'))['db'];var jayson=require(_0x9cdd('0x6'));var client=jayson[_0x9cdd('0x7')][_0x9cdd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x524114,_0x5176e4,_0x15b994,_0x2abe6f){return new Promise(function(_0x11557a,_0x228f5d){var _0x426fb3=_0x2abe6f||client;return _0x426fb3[_0x9cdd('0x9')](_0x524114,_0x15b994)[_0x9cdd('0xa')](function(_0x259271){logger[_0x9cdd('0xb')]('Network,\x20%s,\x20%s',_0x5176e4,_0x9cdd('0xc'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5176e4,_0x9cdd('0xc'),JSON[_0x9cdd('0xd')](_0x259271));if(_0x259271[_0x9cdd('0xe')]){if(_0x259271['error']['code']===0x1f4){logger['error'](_0x9cdd('0xf'),_0x5176e4,_0x259271['error'][_0x9cdd('0x10')]);return _0x228f5d(_0x259271[_0x9cdd('0xe')][_0x9cdd('0x10')]);}logger[_0x9cdd('0xe')]('Network,\x20%s,\x20%s',_0x5176e4,_0x259271[_0x9cdd('0xe')][_0x9cdd('0x10')]);return _0x11557a(_0x259271[_0x9cdd('0xe')][_0x9cdd('0x10')]);}else{logger['info'](_0x9cdd('0xf'),_0x5176e4,_0x9cdd('0xc'));_0x11557a(_0x259271[_0x9cdd('0x11')][_0x9cdd('0x10')]);}})[_0x9cdd('0x12')](function(_0x4adb56){logger[_0x9cdd('0xe')](_0x9cdd('0xf'),_0x5176e4,_0x4adb56);_0x228f5d(_0x4adb56);});});}function respondWithResult(_0x456902,_0x37f5aa){_0x37f5aa=_0x37f5aa||0xc8;return function(_0x2d317d){if(_0x2d317d){return _0x456902[_0x9cdd('0x13')](_0x37f5aa)[_0x9cdd('0x14')](_0x2d317d);}};}function respondWithFilteredResult(_0xe23792,_0x11562a){return function(_0x27960a){if(_0x27960a){var _0xe28b45=typeof _0x11562a[_0x9cdd('0x15')]===_0x9cdd('0x16')&&typeof _0x11562a[_0x9cdd('0x17')]===_0x9cdd('0x16');var _0x13f539=_0x27960a[_0x9cdd('0x18')];var _0x32adc6=_0xe28b45?0x0:_0x11562a[_0x9cdd('0x15')];var _0x2d0620=_0xe28b45?_0x27960a[_0x9cdd('0x18')]:_0x11562a[_0x9cdd('0x15')]+_0x11562a[_0x9cdd('0x17')];var _0x3d40fd;if(_0x2d0620>=_0x13f539){_0x2d0620=_0x13f539;_0x3d40fd=0xc8;}else{_0x3d40fd=0xce;}_0xe23792[_0x9cdd('0x13')](_0x3d40fd);return _0xe23792[_0x9cdd('0x19')](_0x9cdd('0x1a'),_0x32adc6+'-'+_0x2d0620+'/'+_0x13f539)[_0x9cdd('0x14')](_0x27960a);}return null;};}function saveUpdates(_0x429b1a){return function(_0x27be4f){if(_0x27be4f){return _0x27be4f[_0x9cdd('0x1b')](_0x429b1a)[_0x9cdd('0xa')](function(_0x4d1f51){return _0x4d1f51;});}return null;};}function removeEntity(_0x3f07e6){return function(_0x3056b6){if(_0x3056b6){return _0x3056b6[_0x9cdd('0x1c')]()[_0x9cdd('0xa')](function(){_0x3f07e6[_0x9cdd('0x13')](0xcc)[_0x9cdd('0x1d')]();});}};}function handleEntityNotFound(_0x27575e){return function(_0x582b41){if(!_0x582b41){_0x27575e[_0x9cdd('0x1e')](0x194);}return _0x582b41;};}function handleError(_0x227c03,_0x51b162){_0x51b162=_0x51b162||0x1f4;return function(_0x6d3b16){logger[_0x9cdd('0xe')](_0x6d3b16['stack']);if(_0x6d3b16[_0x9cdd('0x1f')]){delete _0x6d3b16['name'];}_0x227c03[_0x9cdd('0x13')](_0x51b162)[_0x9cdd('0x20')](_0x6d3b16);};}exports[_0x9cdd('0x21')]=function(_0x368e7a,_0x4f2030){var _0x323ad1={},_0x2168b6={},_0x1167f5={'count':0x0,'rows':[]};var _0x576efd=_[_0x9cdd('0x22')](db['Network'][_0x9cdd('0x23')],function(_0x34c175){return{'name':_0x34c175[_0x9cdd('0x24')],'type':_0x34c175[_0x9cdd('0x25')][_0x9cdd('0x26')]};});_0x2168b6[_0x9cdd('0x27')]=_[_0x9cdd('0x22')](_0x576efd,_0x9cdd('0x1f'));_0x2168b6[_0x9cdd('0x28')]=_['keys'](_0x368e7a['query']);_0x2168b6[_0x9cdd('0x29')]=_[_0x9cdd('0x2a')](_0x2168b6[_0x9cdd('0x27')],_0x2168b6[_0x9cdd('0x28')]);_0x323ad1['attributes']=_[_0x9cdd('0x2a')](_0x2168b6[_0x9cdd('0x27')],qs[_0x9cdd('0x2b')](_0x368e7a[_0x9cdd('0x28')][_0x9cdd('0x2b')]));_0x323ad1[_0x9cdd('0x2c')]=_0x323ad1[_0x9cdd('0x2c')][_0x9cdd('0x2d')]?_0x323ad1[_0x9cdd('0x2c')]:_0x2168b6[_0x9cdd('0x27')];if(!_0x368e7a[_0x9cdd('0x28')][_0x9cdd('0x2e')](_0x9cdd('0x2f'))){_0x323ad1[_0x9cdd('0x17')]=qs[_0x9cdd('0x17')](_0x368e7a[_0x9cdd('0x28')][_0x9cdd('0x17')]);_0x323ad1[_0x9cdd('0x15')]=qs[_0x9cdd('0x15')](_0x368e7a['query'][_0x9cdd('0x15')]);}_0x323ad1[_0x9cdd('0x30')]=qs[_0x9cdd('0x31')](_0x368e7a['query'][_0x9cdd('0x31')]);_0x323ad1[_0x9cdd('0x32')]=qs[_0x9cdd('0x29')](_['pick'](_0x368e7a[_0x9cdd('0x28')],_0x2168b6['filters']),_0x576efd);if(_0x368e7a[_0x9cdd('0x28')][_0x9cdd('0x33')]){_0x323ad1[_0x9cdd('0x32')]=_[_0x9cdd('0x34')](_0x323ad1['where'],{'$or':_['map'](_0x576efd,function(_0x369003){if(_0x369003[_0x9cdd('0x25')]!==_0x9cdd('0x35')){var _0x408402={};_0x408402[_0x369003[_0x9cdd('0x1f')]]={'$like':'%'+_0x368e7a[_0x9cdd('0x28')]['filter']+'%'};return _0x408402;}})});}_0x323ad1=_['merge']({},_0x323ad1,_0x368e7a['options']);var _0x22c1ea={'where':_0x323ad1[_0x9cdd('0x32')]};return db[_0x9cdd('0x36')][_0x9cdd('0x18')](_0x22c1ea)[_0x9cdd('0xa')](function(_0x5017){_0x1167f5[_0x9cdd('0x18')]=_0x5017;if(_0x368e7a[_0x9cdd('0x28')][_0x9cdd('0x37')]){_0x323ad1[_0x9cdd('0x38')]=[{'all':!![]}];}return db[_0x9cdd('0x36')][_0x9cdd('0x39')](_0x323ad1);})['then'](function(_0x21ea1e){_0x1167f5[_0x9cdd('0x3a')]=_0x21ea1e;return _0x1167f5;})[_0x9cdd('0xa')](respondWithFilteredResult(_0x4f2030,_0x323ad1))[_0x9cdd('0x12')](handleError(_0x4f2030,null));};exports[_0x9cdd('0x3b')]=function(_0x361d19,_0x47a7d8){var _0x5d3c16={'raw':!![],'where':{'id':_0x361d19['params']['id']}},_0x35997b={};_0x35997b['model']=_[_0x9cdd('0x3c')](db[_0x9cdd('0x36')][_0x9cdd('0x23')]);_0x35997b['query']=_[_0x9cdd('0x3c')](_0x361d19['query']);_0x35997b[_0x9cdd('0x29')]=_[_0x9cdd('0x2a')](_0x35997b[_0x9cdd('0x27')],_0x35997b[_0x9cdd('0x28')]);_0x5d3c16[_0x9cdd('0x2c')]=_[_0x9cdd('0x2a')](_0x35997b[_0x9cdd('0x27')],qs[_0x9cdd('0x2b')](_0x361d19['query'][_0x9cdd('0x2b')]));_0x5d3c16[_0x9cdd('0x2c')]=_0x5d3c16[_0x9cdd('0x2c')][_0x9cdd('0x2d')]?_0x5d3c16[_0x9cdd('0x2c')]:_0x35997b[_0x9cdd('0x27')];if(_0x361d19[_0x9cdd('0x28')][_0x9cdd('0x37')]){_0x5d3c16['include']=[{'all':!![]}];}_0x5d3c16=_[_0x9cdd('0x34')]({},_0x5d3c16,_0x361d19[_0x9cdd('0x3d')]);return db['Network']['find'](_0x5d3c16)[_0x9cdd('0xa')](handleEntityNotFound(_0x47a7d8,null))[_0x9cdd('0xa')](respondWithResult(_0x47a7d8,null))[_0x9cdd('0x12')](handleError(_0x47a7d8,null));};exports[_0x9cdd('0x3e')]=function(_0x32564f,_0x3184a3){var _0x48894d;return db[_0x9cdd('0x36')][_0x9cdd('0x3e')](_0x32564f[_0x9cdd('0x3f')],{'raw':!![]})[_0x9cdd('0xa')](function(_0xe54639){_0x48894d=_0xe54639;return db[_0x9cdd('0x36')][_0x9cdd('0x39')]({'where':{'type':_0x32564f['body'][_0x9cdd('0x25')]},'raw':!![]});})[_0x9cdd('0xa')](function(_0x181768){if(_0x48894d[_0x9cdd('0x25')][_0x9cdd('0x40')]()=='STUN'){var _0x3da23e=fs[_0x9cdd('0x41')](path['join'](config[_0x9cdd('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x2e044e=ejs['render'](_0x3da23e,{'networks':_0x181768||[]});fs['writeFileSync'](_0x9cdd('0x43'),_0x2e044e);return respondWithRpcPromise('Reload',_0x9cdd('0x3e'),{'module':_0x9cdd('0x44')});}else if(_0x48894d[_0x9cdd('0x25')][_0x9cdd('0x40')]()=='TURN'){var _0x402d89=fs[_0x9cdd('0x41')](path['join'](config[_0x9cdd('0x42')],_0x9cdd('0x45')),_0x9cdd('0x46'));var _0x46be74=ejs[_0x9cdd('0x47')](_0x402d89,{'networks':_0x181768||[]});fs['writeFileSync'](_0x9cdd('0x48'),_0x46be74);return respondWithRpcPromise(_0x9cdd('0x49'),_0x9cdd('0x3e'),{'module':_0x9cdd('0x44')});}else{var _0x1472fd=fs[_0x9cdd('0x41')](path[_0x9cdd('0x4a')](config[_0x9cdd('0x42')],_0x9cdd('0x4b')),_0x9cdd('0x46'));var _0x1188b0=ejs[_0x9cdd('0x47')](_0x1472fd,{'networks':_0x181768||[]});fs['writeFileSync'](util[_0x9cdd('0x4c')](_0x9cdd('0x4d'),_0x32564f[_0x9cdd('0x3f')][_0x9cdd('0x25')]['toLowerCase']()),_0x1188b0);return respondWithRpcPromise(_0x9cdd('0x49'),_0x9cdd('0x3e'),{'module':_0x9cdd('0x4e')});}})[_0x9cdd('0xa')](function(){return _0x48894d;})['then'](respondWithResult(_0x3184a3,0xc9))[_0x9cdd('0x12')](handleError(_0x3184a3,null));};exports[_0x9cdd('0x1b')]=function(_0x17eaef,_0xf1a3b4){var _0x4e2d5d;return db['Network'][_0x9cdd('0x4f')]({'where':{'id':_0x17eaef['params']['id']}})[_0x9cdd('0xa')](handleEntityNotFound(_0xf1a3b4,null))[_0x9cdd('0xa')](saveUpdates(_0x17eaef[_0x9cdd('0x3f')],null))[_0x9cdd('0xa')](function(_0x218924){if(_0x218924){_0x4e2d5d=_0x218924;return db[_0x9cdd('0x36')][_0x9cdd('0x39')]({'where':{'type':_0x4e2d5d['type']},'raw':!![]});}return null;})['then'](function(_0xcabdca){if(_0x4e2d5d[_0x9cdd('0x25')][_0x9cdd('0x40')]()==_0x9cdd('0x50')){var _0x375390=fs[_0x9cdd('0x41')](path[_0x9cdd('0x4a')](config[_0x9cdd('0x42')],_0x9cdd('0x51')),_0x9cdd('0x46'));var _0x1712b5=ejs['render'](_0x375390,{'networks':_0xcabdca||[]});fs[_0x9cdd('0x52')](_0x9cdd('0x43'),_0x1712b5);return respondWithRpcPromise(_0x9cdd('0x49'),_0x9cdd('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x4e2d5d[_0x9cdd('0x25')][_0x9cdd('0x40')]()=='TURN'){var _0x4fc2ca=fs[_0x9cdd('0x41')](path['join'](config[_0x9cdd('0x42')],'server/files/templates/turn_multiple.ejs'),_0x9cdd('0x46'));var _0xbe7bb0=ejs[_0x9cdd('0x47')](_0x4fc2ca,{'networks':_0xcabdca||[]});fs['writeFileSync'](_0x9cdd('0x48'),_0xbe7bb0);return respondWithRpcPromise(_0x9cdd('0x49'),'update',{'module':_0x9cdd('0x44')});}else{var _0x57ebab=fs['readFileSync'](path[_0x9cdd('0x4a')](config[_0x9cdd('0x42')],'server/files/templates/network.ejs'),_0x9cdd('0x46'));var _0x49443c=ejs['render'](_0x57ebab,{'networks':_0xcabdca||[]});fs[_0x9cdd('0x52')](util['format'](_0x9cdd('0x4d'),_0x17eaef[_0x9cdd('0x3f')][_0x9cdd('0x25')][_0x9cdd('0x53')]()),_0x49443c);return respondWithRpcPromise('Reload',_0x9cdd('0x1b'),{'module':'chan_sip.so'});}})[_0x9cdd('0xa')](function(_0x19c63f){if(_0x19c63f){return _0x4e2d5d;}return null;})[_0x9cdd('0xa')](respondWithResult(_0xf1a3b4,null))[_0x9cdd('0x12')](handleError(_0xf1a3b4,null));};exports[_0x9cdd('0x1c')]=function(_0x544916,_0x548cfd){var _0x567884;return db['Network'][_0x9cdd('0x4f')]({'where':{'id':_0x544916['params']['id']}})[_0x9cdd('0xa')](function(_0x81d81b){_0x567884=_0x81d81b;return _0x81d81b;})[_0x9cdd('0xa')](handleEntityNotFound(_0x548cfd,null))[_0x9cdd('0xa')](removeEntity(_0x548cfd,null))[_0x9cdd('0xa')](function(){if(_0x567884){return db[_0x9cdd('0x36')][_0x9cdd('0x39')]({'where':{'type':_0x567884[_0x9cdd('0x25')]},'raw':!![]});}})[_0x9cdd('0xa')](function(_0x33a2c4){if(_0x567884[_0x9cdd('0x25')]['toUpperCase']()==_0x9cdd('0x50')){var _0x2bd029=fs[_0x9cdd('0x41')](path[_0x9cdd('0x4a')](config[_0x9cdd('0x42')],_0x9cdd('0x51')),_0x9cdd('0x46'));var _0x210711=ejs[_0x9cdd('0x47')](_0x2bd029,{'networks':_0x33a2c4||[]});fs['writeFileSync'](_0x9cdd('0x43'),_0x210711);return respondWithRpcPromise(_0x9cdd('0x49'),_0x9cdd('0x1c'),{'module':_0x9cdd('0x44')});}else if(_0x567884[_0x9cdd('0x25')][_0x9cdd('0x40')]()==_0x9cdd('0x54')){var _0x37641c=fs[_0x9cdd('0x41')](path[_0x9cdd('0x4a')](config[_0x9cdd('0x42')],_0x9cdd('0x45')),_0x9cdd('0x46'));var _0x2397aa=ejs[_0x9cdd('0x47')](_0x37641c,{'networks':_0x33a2c4||[]});fs[_0x9cdd('0x52')](_0x9cdd('0x48'),_0x2397aa);return respondWithRpcPromise(_0x9cdd('0x49'),_0x9cdd('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x3a24ea=fs[_0x9cdd('0x41')](path[_0x9cdd('0x4a')](config['root'],_0x9cdd('0x4b')),'utf8');var _0x2da43f=ejs[_0x9cdd('0x47')](_0x3a24ea,{'networks':_0x33a2c4||[]});fs[_0x9cdd('0x52')](util['format'](_0x9cdd('0x4d'),_0x567884['type'][_0x9cdd('0x53')]()),_0x2da43f);return respondWithRpcPromise(_0x9cdd('0x49'),_0x9cdd('0x1c'),{'module':_0x9cdd('0x4e')});}})[_0x9cdd('0x12')](handleError(_0x548cfd,null));}; \ No newline at end of file +var _0x7863=['body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','update','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','Network','find','create'];(function(_0x3ddb5f,_0x1a7c8c){var _0x124064=function(_0x210c0d){while(--_0x210c0d){_0x3ddb5f['push'](_0x3ddb5f['shift']());}};_0x124064(++_0x1a7c8c);}(_0x7863,0xc2));var _0x3786=function(_0x5f4ce2,_0x42c469){_0x5f4ce2=_0x5f4ce2-0x0;var _0x219b5b=_0x7863[_0x5f4ce2];return _0x219b5b;};'use strict';var util=require(_0x3786('0x0'));var path=require(_0x3786('0x1'));var ejs=require(_0x3786('0x2'));var fs=require('fs');var _=require(_0x3786('0x3'));var qs=require(_0x3786('0x4'));var logger=require(_0x3786('0x5'))('api');var config=require(_0x3786('0x6'));var db=require(_0x3786('0x7'))['db'];var jayson=require(_0x3786('0x8'));var client=jayson[_0x3786('0x9')][_0x3786('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x287f3a,_0x132a2c,_0x46b3b3,_0x459527){return new Promise(function(_0xc909cd,_0x59f24f){var _0x2489e7=_0x459527||client;return _0x2489e7[_0x3786('0xb')](_0x287f3a,_0x46b3b3)[_0x3786('0xc')](function(_0x29501f){logger['info'](_0x3786('0xd'),_0x132a2c,'request\x20sent');logger[_0x3786('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x132a2c,_0x3786('0xf'),JSON[_0x3786('0x10')](_0x29501f));if(_0x29501f[_0x3786('0x11')]){if(_0x29501f[_0x3786('0x11')]['code']===0x1f4){logger[_0x3786('0x11')](_0x3786('0xd'),_0x132a2c,_0x29501f[_0x3786('0x11')][_0x3786('0x12')]);return _0x59f24f(_0x29501f[_0x3786('0x11')]['message']);}logger[_0x3786('0x11')](_0x3786('0xd'),_0x132a2c,_0x29501f[_0x3786('0x11')][_0x3786('0x12')]);return _0xc909cd(_0x29501f[_0x3786('0x11')][_0x3786('0x12')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x132a2c,_0x3786('0xf'));_0xc909cd(_0x29501f[_0x3786('0x13')][_0x3786('0x12')]);}})[_0x3786('0x14')](function(_0x44008d){logger['error']('Network,\x20%s,\x20%s',_0x132a2c,_0x44008d);_0x59f24f(_0x44008d);});});}function respondWithResult(_0x36b714,_0x13e267){_0x13e267=_0x13e267||0xc8;return function(_0x49ac08){if(_0x49ac08){return _0x36b714[_0x3786('0x15')](_0x13e267)[_0x3786('0x16')](_0x49ac08);}};}function respondWithFilteredResult(_0x5f5373,_0x432ac2){return function(_0x2ae4bd){if(_0x2ae4bd){var _0x4d57bb=typeof _0x432ac2[_0x3786('0x17')]==='undefined'&&typeof _0x432ac2[_0x3786('0x18')]===_0x3786('0x19');var _0x247ceb=_0x2ae4bd[_0x3786('0x1a')];var _0x13695b=_0x4d57bb?0x0:_0x432ac2[_0x3786('0x17')];var _0x34554b=_0x4d57bb?_0x2ae4bd[_0x3786('0x1a')]:_0x432ac2[_0x3786('0x17')]+_0x432ac2[_0x3786('0x18')];var _0x1a4aa3;if(_0x34554b>=_0x247ceb){_0x34554b=_0x247ceb;_0x1a4aa3=0xc8;}else{_0x1a4aa3=0xce;}_0x5f5373['status'](_0x1a4aa3);return _0x5f5373[_0x3786('0x1b')](_0x3786('0x1c'),_0x13695b+'-'+_0x34554b+'/'+_0x247ceb)[_0x3786('0x16')](_0x2ae4bd);}return null;};}function saveUpdates(_0x57b836){return function(_0x49571c){if(_0x49571c){return _0x49571c['update'](_0x57b836)[_0x3786('0xc')](function(_0x7541ef){return _0x7541ef;});}return null;};}function removeEntity(_0x3dea49){return function(_0x3e4128){if(_0x3e4128){return _0x3e4128[_0x3786('0x1d')]()[_0x3786('0xc')](function(){_0x3dea49[_0x3786('0x15')](0xcc)[_0x3786('0x1e')]();});}};}function handleEntityNotFound(_0x34479d){return function(_0x5aea52){if(!_0x5aea52){_0x34479d[_0x3786('0x1f')](0x194);}return _0x5aea52;};}function handleError(_0x58f7fc,_0x88182){_0x88182=_0x88182||0x1f4;return function(_0x2ee581){logger[_0x3786('0x11')](_0x2ee581[_0x3786('0x20')]);if(_0x2ee581[_0x3786('0x21')]){delete _0x2ee581[_0x3786('0x21')];}_0x58f7fc[_0x3786('0x15')](_0x88182)[_0x3786('0x22')](_0x2ee581);};}exports[_0x3786('0x23')]=function(_0x23804d,_0x47c401){var _0x45d035={},_0x517b89={},_0x3dd880={'count':0x0,'rows':[]};var _0x2666aa=_[_0x3786('0x24')](db['Network']['rawAttributes'],function(_0x416d29){return{'name':_0x416d29[_0x3786('0x25')],'type':_0x416d29[_0x3786('0x26')][_0x3786('0x27')]};});_0x517b89[_0x3786('0x28')]=_[_0x3786('0x24')](_0x2666aa,'name');_0x517b89[_0x3786('0x29')]=_['keys'](_0x23804d[_0x3786('0x29')]);_0x517b89['filters']=_[_0x3786('0x2a')](_0x517b89['model'],_0x517b89[_0x3786('0x29')]);_0x45d035['attributes']=_[_0x3786('0x2a')](_0x517b89['model'],qs[_0x3786('0x2b')](_0x23804d[_0x3786('0x29')][_0x3786('0x2b')]));_0x45d035[_0x3786('0x2c')]=_0x45d035[_0x3786('0x2c')][_0x3786('0x2d')]?_0x45d035[_0x3786('0x2c')]:_0x517b89[_0x3786('0x28')];if(!_0x23804d[_0x3786('0x29')]['hasOwnProperty']('nolimit')){_0x45d035[_0x3786('0x18')]=qs['limit'](_0x23804d['query'][_0x3786('0x18')]);_0x45d035['offset']=qs['offset'](_0x23804d['query'][_0x3786('0x17')]);}_0x45d035[_0x3786('0x2e')]=qs[_0x3786('0x2f')](_0x23804d[_0x3786('0x29')][_0x3786('0x2f')]);_0x45d035[_0x3786('0x30')]=qs[_0x3786('0x31')](_['pick'](_0x23804d['query'],_0x517b89[_0x3786('0x31')]),_0x2666aa);if(_0x23804d[_0x3786('0x29')]['filter']){_0x45d035[_0x3786('0x30')]=_['merge'](_0x45d035['where'],{'$or':_[_0x3786('0x24')](_0x2666aa,function(_0x5cfefa){if(_0x5cfefa['type']!==_0x3786('0x32')){var _0x1b5ce0={};_0x1b5ce0[_0x5cfefa['name']]={'$like':'%'+_0x23804d['query'][_0x3786('0x33')]+'%'};return _0x1b5ce0;}})});}_0x45d035=_[_0x3786('0x34')]({},_0x45d035,_0x23804d[_0x3786('0x35')]);var _0x43b3ad={'where':_0x45d035['where']};return db['Network'][_0x3786('0x1a')](_0x43b3ad)[_0x3786('0xc')](function(_0x33c243){_0x3dd880['count']=_0x33c243;if(_0x23804d[_0x3786('0x29')][_0x3786('0x36')]){_0x45d035[_0x3786('0x37')]=[{'all':!![]}];}return db['Network'][_0x3786('0x38')](_0x45d035);})['then'](function(_0x22e979){_0x3dd880[_0x3786('0x39')]=_0x22e979;return _0x3dd880;})[_0x3786('0xc')](respondWithFilteredResult(_0x47c401,_0x45d035))['catch'](handleError(_0x47c401,null));};exports[_0x3786('0x3a')]=function(_0xc0c97f,_0x12eee6){var _0x278a86={'raw':!![],'where':{'id':_0xc0c97f[_0x3786('0x3b')]['id']}},_0x2526d8={};_0x2526d8[_0x3786('0x28')]=_[_0x3786('0x3c')](db[_0x3786('0x3d')]['rawAttributes']);_0x2526d8[_0x3786('0x29')]=_[_0x3786('0x3c')](_0xc0c97f[_0x3786('0x29')]);_0x2526d8[_0x3786('0x31')]=_[_0x3786('0x2a')](_0x2526d8['model'],_0x2526d8[_0x3786('0x29')]);_0x278a86[_0x3786('0x2c')]=_['intersection'](_0x2526d8[_0x3786('0x28')],qs['fields'](_0xc0c97f[_0x3786('0x29')][_0x3786('0x2b')]));_0x278a86[_0x3786('0x2c')]=_0x278a86[_0x3786('0x2c')]['length']?_0x278a86[_0x3786('0x2c')]:_0x2526d8[_0x3786('0x28')];if(_0xc0c97f[_0x3786('0x29')][_0x3786('0x36')]){_0x278a86['include']=[{'all':!![]}];}_0x278a86=_[_0x3786('0x34')]({},_0x278a86,_0xc0c97f[_0x3786('0x35')]);return db[_0x3786('0x3d')][_0x3786('0x3e')](_0x278a86)[_0x3786('0xc')](handleEntityNotFound(_0x12eee6,null))[_0x3786('0xc')](respondWithResult(_0x12eee6,null))[_0x3786('0x14')](handleError(_0x12eee6,null));};exports[_0x3786('0x3f')]=function(_0x46d9e1,_0x49565e){var _0x470ed1;return db['Network']['create'](_0x46d9e1[_0x3786('0x40')],{'raw':!![]})['then'](function(_0x40d163){_0x470ed1=_0x40d163;return db[_0x3786('0x3d')]['findAll']({'where':{'type':_0x46d9e1[_0x3786('0x40')][_0x3786('0x26')]},'raw':!![]});})['then'](function(_0x198593){if(_0x470ed1[_0x3786('0x26')]['toUpperCase']()==_0x3786('0x41')){var _0x70427a=fs[_0x3786('0x42')](path[_0x3786('0x43')](config[_0x3786('0x44')],_0x3786('0x45')),'utf8');var _0x178517=ejs['render'](_0x70427a,{'networks':_0x198593||[]});fs['writeFileSync'](_0x3786('0x46'),_0x178517);return respondWithRpcPromise('Reload',_0x3786('0x3f'),{'module':'res_stun_monitor.so'});}else if(_0x470ed1['type'][_0x3786('0x47')]()==_0x3786('0x48')){var _0x3ff636=fs[_0x3786('0x42')](path[_0x3786('0x43')](config[_0x3786('0x44')],_0x3786('0x49')),_0x3786('0x4a'));var _0x47e612=ejs[_0x3786('0x4b')](_0x3ff636,{'networks':_0x198593||[]});fs[_0x3786('0x4c')](_0x3786('0x4d'),_0x47e612);return respondWithRpcPromise(_0x3786('0x4e'),_0x3786('0x3f'),{'module':_0x3786('0x4f')});}else{var _0x41ffd7=fs[_0x3786('0x42')](path[_0x3786('0x43')](config[_0x3786('0x44')],_0x3786('0x50')),_0x3786('0x4a'));var _0x1008ef=ejs[_0x3786('0x4b')](_0x41ffd7,{'networks':_0x198593||[]});fs[_0x3786('0x4c')](util[_0x3786('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x46d9e1[_0x3786('0x40')][_0x3786('0x26')][_0x3786('0x52')]()),_0x1008ef);return respondWithRpcPromise(_0x3786('0x4e'),_0x3786('0x3f'),{'module':_0x3786('0x53')});}})[_0x3786('0xc')](function(){return _0x470ed1;})[_0x3786('0xc')](respondWithResult(_0x49565e,0xc9))['catch'](handleError(_0x49565e,null));};exports[_0x3786('0x54')]=function(_0x49d966,_0x39b4a9){var _0x42b8c0;return db[_0x3786('0x3d')][_0x3786('0x3e')]({'where':{'id':_0x49d966[_0x3786('0x3b')]['id']}})['then'](handleEntityNotFound(_0x39b4a9,null))[_0x3786('0xc')](saveUpdates(_0x49d966[_0x3786('0x40')],null))[_0x3786('0xc')](function(_0x504cf0){if(_0x504cf0){_0x42b8c0=_0x504cf0;return db[_0x3786('0x3d')][_0x3786('0x38')]({'where':{'type':_0x42b8c0[_0x3786('0x26')]},'raw':!![]});}return null;})[_0x3786('0xc')](function(_0x593c1e){if(_0x42b8c0['type']['toUpperCase']()==_0x3786('0x41')){var _0x472797=fs['readFileSync'](path[_0x3786('0x43')](config['root'],_0x3786('0x45')),'utf8');var _0x57b30f=ejs[_0x3786('0x4b')](_0x472797,{'networks':_0x593c1e||[]});fs[_0x3786('0x4c')](_0x3786('0x46'),_0x57b30f);return respondWithRpcPromise(_0x3786('0x4e'),'update',{'module':_0x3786('0x4f')});}else if(_0x42b8c0['type'][_0x3786('0x47')]()=='TURN'){var _0x291ff9=fs[_0x3786('0x42')](path[_0x3786('0x43')](config[_0x3786('0x44')],_0x3786('0x49')),_0x3786('0x4a'));var _0x17e2d2=ejs[_0x3786('0x4b')](_0x291ff9,{'networks':_0x593c1e||[]});fs['writeFileSync'](_0x3786('0x4d'),_0x17e2d2);return respondWithRpcPromise(_0x3786('0x4e'),_0x3786('0x54'),{'module':_0x3786('0x4f')});}else{var _0xa5082a=fs['readFileSync'](path[_0x3786('0x43')](config[_0x3786('0x44')],'server/files/templates/network.ejs'),_0x3786('0x4a'));var _0x4cfebc=ejs[_0x3786('0x4b')](_0xa5082a,{'networks':_0x593c1e||[]});fs[_0x3786('0x4c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x49d966[_0x3786('0x40')][_0x3786('0x26')][_0x3786('0x52')]()),_0x4cfebc);return respondWithRpcPromise(_0x3786('0x4e'),'update',{'module':'chan_sip.so'});}})[_0x3786('0xc')](function(_0x5983f0){if(_0x5983f0){return _0x42b8c0;}return null;})[_0x3786('0xc')](respondWithResult(_0x39b4a9,null))['catch'](handleError(_0x39b4a9,null));};exports[_0x3786('0x1d')]=function(_0x637856,_0x48ef04){var _0x2e5b63;return db[_0x3786('0x3d')][_0x3786('0x3e')]({'where':{'id':_0x637856[_0x3786('0x3b')]['id']}})[_0x3786('0xc')](function(_0x4ec643){_0x2e5b63=_0x4ec643;return _0x4ec643;})[_0x3786('0xc')](handleEntityNotFound(_0x48ef04,null))[_0x3786('0xc')](removeEntity(_0x48ef04,null))[_0x3786('0xc')](function(){if(_0x2e5b63){return db[_0x3786('0x3d')][_0x3786('0x38')]({'where':{'type':_0x2e5b63[_0x3786('0x26')]},'raw':!![]});}})[_0x3786('0xc')](function(_0x2496cb){if(_0x2e5b63[_0x3786('0x26')][_0x3786('0x47')]()=='STUN'){var _0x1c34f0=fs[_0x3786('0x42')](path[_0x3786('0x43')](config[_0x3786('0x44')],_0x3786('0x45')),_0x3786('0x4a'));var _0x4b8d60=ejs['render'](_0x1c34f0,{'networks':_0x2496cb||[]});fs[_0x3786('0x4c')]('/etc/asterisk/stun_xcally.conf',_0x4b8d60);return respondWithRpcPromise(_0x3786('0x4e'),_0x3786('0x1d'),{'module':_0x3786('0x4f')});}else if(_0x2e5b63[_0x3786('0x26')]['toUpperCase']()==_0x3786('0x48')){var _0x37f92e=fs['readFileSync'](path['join'](config[_0x3786('0x44')],_0x3786('0x49')),_0x3786('0x4a'));var _0x117bc8=ejs[_0x3786('0x4b')](_0x37f92e,{'networks':_0x2496cb||[]});fs[_0x3786('0x4c')](_0x3786('0x4d'),_0x117bc8);return respondWithRpcPromise(_0x3786('0x4e'),_0x3786('0x1d'),{'module':_0x3786('0x4f')});}else{var _0x35d686=fs['readFileSync'](path['join'](config[_0x3786('0x44')],_0x3786('0x50')),_0x3786('0x4a'));var _0x2ae2b8=ejs['render'](_0x35d686,{'networks':_0x2496cb||[]});fs[_0x3786('0x4c')](util[_0x3786('0x51')](_0x3786('0x55'),_0x2e5b63[_0x3786('0x26')][_0x3786('0x52')]()),_0x2ae2b8);return respondWithRpcPromise('Reload',_0x3786('0x1d'),{'module':'chan_sip.so'});}})[_0x3786('0x14')](handleError(_0x48ef04,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ee1dbb8..a0f052a 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 _0x4fef=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','api','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4fef,0x10f));var _0xf4fe=function(_0x21f033,_0x3b4fb){_0x21f033=_0x21f033-0x0;var _0x2a055e=_0x4fef[_0x21f033];return _0x2a055e;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var logger=require('../../config/logger')(_0xf4fe('0x2'));var moment=require('moment');var BPromise=require(_0xf4fe('0x3'));var rp=require(_0xf4fe('0x4'));var fs=require('fs');var path=require(_0xf4fe('0x5'));var rimraf=require(_0xf4fe('0x6'));var config=require(_0xf4fe('0x7'));var attributes=require(_0xf4fe('0x8'));module[_0xf4fe('0x9')]=function(_0x27c6c9,_0x522427){return _0x27c6c9[_0xf4fe('0xa')](_0xf4fe('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37f8=['Network','network','util','../../config/logger','api','moment','request-promise','define'];(function(_0x2cb28e,_0x46267e){var _0x525a9b=function(_0x3736ef){while(--_0x3736ef){_0x2cb28e['push'](_0x2cb28e['shift']());}};_0x525a9b(++_0x46267e);}(_0x37f8,0xd2));var _0x837f=function(_0x5711de,_0xcc58a2){_0x5711de=_0x5711de-0x0;var _0x341eae=_0x37f8[_0x5711de];return _0x341eae;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var logger=require(_0x837f('0x1'))(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require('bluebird');var rp=require(_0x837f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x19c939,_0x42986f){return _0x19c939[_0x837f('0x5')](_0x837f('0x6'),attributes,{'tableName':_0x837f('0x7'),'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 121b6db..9184264 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5c0fa2,_0x496f6e){_0x5c0fa2=_0x5c0fa2-0x0;var _0x55ea6a=_0x7a54[_0x5c0fa2];return _0x55ea6a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4559f3,_0x5443f5){var _0x2f0c15=function(_0x381360){while(--_0x381360){_0x4559f3['push'](_0x4559f3['shift']());}};_0x2f0c15(++_0x5443f5);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 2e7d3ba..0081867 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 _0x1c51=['../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','/:id/dispositions','addAnswer','/:id/notify','notify','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3c2b86,_0x3c16db){var _0x46649e=function(_0xa7dd77){while(--_0xa7dd77){_0x3c2b86['push'](_0x3c2b86['shift']());}};_0x46649e(++_0x3c16db);}(_0x1c51,0x82));var _0x11c5=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x1c51[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0x11c5('0x0'));var util=require(_0x11c5('0x1'));var path=require('path');var timeout=require(_0x11c5('0x2'));var express=require(_0x11c5('0x3'));var router=express[_0x11c5('0x4')]();var fs_extra=require(_0x11c5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x11c5('0x6'));var controller=require(_0x11c5('0x7'));router[_0x11c5('0x8')]('/',auth[_0x11c5('0x9')](),controller['index']);router[_0x11c5('0x8')](_0x11c5('0xa'),auth[_0x11c5('0x9')](),controller[_0x11c5('0xb')]);router[_0x11c5('0x8')]('/:id',auth[_0x11c5('0x9')](),controller['show']);router[_0x11c5('0x8')]('/:id/dispositions',auth[_0x11c5('0x9')](),controller[_0x11c5('0xc')]);router['get'](_0x11c5('0xd'),auth['isAuthenticated'](),controller[_0x11c5('0xe')]);router[_0x11c5('0x8')](_0x11c5('0xf'),auth[_0x11c5('0x9')](),controller[_0x11c5('0x10')]);router['get'](_0x11c5('0x11'),auth['isAuthenticated'](),controller[_0x11c5('0x12')]);router[_0x11c5('0x8')](_0x11c5('0x13'),auth[_0x11c5('0x9')](),controller['getAgents']);router[_0x11c5('0x14')]('/',auth[_0x11c5('0x9')](),controller[_0x11c5('0x15')]);router[_0x11c5('0x14')](_0x11c5('0x16'),auth[_0x11c5('0x9')](),controller['addDisposition']);router[_0x11c5('0x14')](_0x11c5('0xd'),auth['isAuthenticated'](),controller[_0x11c5('0x17')]);router[_0x11c5('0x14')](_0x11c5('0x18'),controller[_0x11c5('0x19')]);router[_0x11c5('0x14')](_0x11c5('0xf'),auth[_0x11c5('0x9')](),controller['addApplications']);router['post'](_0x11c5('0x13'),auth[_0x11c5('0x9')](),controller[_0x11c5('0x1a')]);router[_0x11c5('0x14')](_0x11c5('0x1b'),auth[_0x11c5('0x9')](),controller['send']);router[_0x11c5('0x1c')]('/:id',auth[_0x11c5('0x9')](),controller[_0x11c5('0x1d')]);router[_0x11c5('0x1e')]('/:id',auth[_0x11c5('0x9')](),controller[_0x11c5('0x1f')]);router[_0x11c5('0x1e')](_0x11c5('0x16'),auth['isAuthenticated'](),controller[_0x11c5('0x20')]);router[_0x11c5('0x1e')]('/:id/canned_answers',auth[_0x11c5('0x9')](),controller['removeAnswers']);router[_0x11c5('0x1e')](_0x11c5('0x13'),auth[_0x11c5('0x9')](),controller['removeAgents']);module[_0x11c5('0x21')]=router; \ No newline at end of file +var _0xe5c2=['addDisposition','addAnswer','notify','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','/:id/dispositions'];(function(_0x1b3224,_0x3351d9){var _0x5dae4f=function(_0x22894a){while(--_0x22894a){_0x1b3224['push'](_0x1b3224['shift']());}};_0x5dae4f(++_0x3351d9);}(_0xe5c2,0xf3));var _0x2e5c=function(_0xb15c8f,_0x38f632){_0xb15c8f=_0xb15c8f-0x0;var _0x35ca40=_0xe5c2[_0xb15c8f];return _0x35ca40;};'use strict';var multer=require(_0x2e5c('0x0'));var util=require(_0x2e5c('0x1'));var path=require(_0x2e5c('0x2'));var timeout=require(_0x2e5c('0x3'));var express=require(_0x2e5c('0x4'));var router=express[_0x2e5c('0x5')]();var fs_extra=require(_0x2e5c('0x6'));var auth=require(_0x2e5c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2e5c('0x8'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x2e5c('0x9')](),controller['index']);router[_0x2e5c('0xa')](_0x2e5c('0xb'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0xc')]);router[_0x2e5c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2e5c('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2e5c('0xd')]);router[_0x2e5c('0xa')](_0x2e5c('0xe'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0xf')]);router[_0x2e5c('0xa')](_0x2e5c('0x10'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x11')]);router[_0x2e5c('0xa')](_0x2e5c('0x12'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x13')]);router[_0x2e5c('0xa')]('/:id/users',auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x14')]);router[_0x2e5c('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2e5c('0x15')](_0x2e5c('0x16'),auth['isAuthenticated'](),controller[_0x2e5c('0x17')]);router[_0x2e5c('0x15')]('/:id/canned_answers',auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x18')]);router[_0x2e5c('0x15')]('/:id/notify',controller[_0x2e5c('0x19')]);router[_0x2e5c('0x15')]('/:id/applications',auth[_0x2e5c('0x9')](),controller['addApplications']);router['post'](_0x2e5c('0x1a'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x1b')]);router[_0x2e5c('0x15')](_0x2e5c('0x1c'),auth['isAuthenticated'](),controller[_0x2e5c('0x1d')]);router[_0x2e5c('0x1e')](_0x2e5c('0x1f'),auth['isAuthenticated'](),controller[_0x2e5c('0x20')]);router[_0x2e5c('0x21')](_0x2e5c('0x1f'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x22')]);router[_0x2e5c('0x21')](_0x2e5c('0x16'),auth[_0x2e5c('0x9')](),controller['removeDispositions']);router[_0x2e5c('0x21')](_0x2e5c('0xe'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x23')]);router[_0x2e5c('0x21')](_0x2e5c('0x1a'),auth[_0x2e5c('0x9')](),controller[_0x2e5c('0x24')]);module[_0x2e5c('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 78dad7e..049cacb 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 _0xaaff=['randomstring','exports','STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize'];(function(_0x39bee8,_0x22ece1){var _0x2ba0a9=function(_0x37ef10){while(--_0x37ef10){_0x39bee8['push'](_0x39bee8['shift']());}};_0x2ba0a9(++_0x22ece1);}(_0xaaff,0x77));var _0xfaaf=function(_0x539b71,_0x4daf0b){_0x539b71=_0x539b71-0x0;var _0x3d1a59=_0xaaff[_0x539b71];return _0x3d1a59;};'use strict';var Sequelize=require(_0xfaaf('0x0'));var rs=require(_0xfaaf('0x1'));module[_0xfaaf('0x2')]={'name':{'type':Sequelize[_0xfaaf('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xfaaf('0x3')]},'token':{'type':Sequelize[_0xfaaf('0x3')],'defaultValue':function(){return rs[_0xfaaf('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfaaf('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfaaf('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfaaf('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfaaf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xfaaf('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfaaf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfaaf('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfaaf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xfaaf('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xfaaf('0x6')],'defaultValue':![],'comment':_0xfaaf('0x9'),'set':function(_0x1caad9){if(!_0x1caad9)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x1caad9);}}}; \ No newline at end of file +var _0xad19=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x43073b,_0x26cd7c){var _0x5210e3=function(_0x12e176){while(--_0x12e176){_0x43073b['push'](_0x43073b['shift']());}};_0x5210e3(++_0x26cd7c);}(_0xad19,0x80));var _0x9ad1=function(_0xfc5896,_0x2fb32e){_0xfc5896=_0xfc5896-0x0;var _0x28c8d6=_0xad19[_0xfc5896];return _0x28c8d6;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9ad1('0x0')]={'name':{'type':Sequelize[_0x9ad1('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9ad1('0x1')]},'token':{'type':Sequelize[_0x9ad1('0x1')],'defaultValue':function(){return rs[_0x9ad1('0x2')]();}},'replyUri':{'type':Sequelize[_0x9ad1('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9ad1('0x3');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ad1('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ad1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9ad1('0x1')]},'queueTransfer':{'type':Sequelize[_0x9ad1('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ad1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ad1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ad1('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x9ad1('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9ad1('0x7'),'set':function(_0x45a753){if(!_0x45a753)this[_0x9ad1('0x8')](_0x9ad1('0x9'),null);this[_0x9ad1('0x8')](_0x9ad1('0xa'),_0x45a753);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index cf05450..f2de589 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 _0xcf95=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','include','findAll','rawAttributes','includeAll','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','params','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','rows','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','OpenchannelApplication','Applications','account','list','orderBy','applications','priority','Contacts','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','autoclose','close','unmanaged','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','isArray','userOpenchannelAccount:remove','getAgents','DESC','user','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5cf9('0x0'));var rimraf=require(_0x5cf9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5cf9('0x2'));var BPromise=require(_0x5cf9('0x3'));var Mustache=require(_0x5cf9('0x4'));var util=require(_0x5cf9('0x5'));var path=require('path');var sox=require(_0x5cf9('0x6'));var csv=require(_0x5cf9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cf9('0x8'));var squel=require(_0x5cf9('0x9'));var crypto=require('crypto');var jsforce=require(_0x5cf9('0xa'));var deskjs=require(_0x5cf9('0xb'));var toCsv=require(_0x5cf9('0x7'));var querystring=require(_0x5cf9('0xc'));var Papa=require(_0x5cf9('0xd'));var Redis=require(_0x5cf9('0xe'));var authService=require(_0x5cf9('0xf'));var qs=require(_0x5cf9('0x10'));var as=require(_0x5cf9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cf9('0x12'))(_0x5cf9('0x13'));var utils=require(_0x5cf9('0x14'));var config=require(_0x5cf9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5cf9('0x16'))['db'];config[_0x5cf9('0x17')]=_[_0x5cf9('0x18')](config[_0x5cf9('0x17')],{'host':_0x5cf9('0x19'),'port':0x18eb});var socket=require(_0x5cf9('0x1a'))(new Redis(config[_0x5cf9('0x17')]));require(_0x5cf9('0x1b'))['register'](socket);var jayson=require(_0x5cf9('0x1c'));var client=jayson[_0x5cf9('0x1d')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cb11d,_0x184461,_0x208884,_0x46ee98){return new BPromise(function(_0x2f4d21,_0x577969){var _0x2fe568=_0x46ee98||client;return _0x2fe568[_0x5cf9('0x1e')](_0x4cb11d,_0x208884)['then'](function(_0x48f233){logger[_0x5cf9('0x1f')](_0x5cf9('0x20'),_0x184461,_0x5cf9('0x21'));logger[_0x5cf9('0x22')](_0x5cf9('0x23'),_0x184461,'request\x20sent',JSON['stringify'](_0x48f233));if(_0x48f233[_0x5cf9('0x24')]){if(_0x48f233[_0x5cf9('0x24')][_0x5cf9('0x25')]===0x1f4){logger[_0x5cf9('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x184461,_0x48f233[_0x5cf9('0x24')][_0x5cf9('0x26')]);return _0x577969(_0x48f233[_0x5cf9('0x24')][_0x5cf9('0x26')]);}logger['error'](_0x5cf9('0x20'),_0x184461,_0x48f233[_0x5cf9('0x24')]['message']);return _0x2f4d21(_0x48f233[_0x5cf9('0x24')][_0x5cf9('0x26')]);}else{logger[_0x5cf9('0x1f')](_0x5cf9('0x20'),_0x184461,_0x5cf9('0x21'));_0x2f4d21(_0x48f233[_0x5cf9('0x27')][_0x5cf9('0x26')]);}})[_0x5cf9('0x28')](function(_0x2bc8c6){logger['error'](_0x5cf9('0x20'),_0x184461,_0x2bc8c6);_0x577969(_0x2bc8c6);});});}function respondWithStatusCode(_0x5560bd,_0x30b294){_0x30b294=_0x30b294||0xcc;return function(_0x1a976e){if(_0x1a976e){return _0x5560bd[_0x5cf9('0x29')](_0x30b294);}return _0x5560bd[_0x5cf9('0x2a')](_0x30b294)[_0x5cf9('0x2b')]();};}function respondWithResult(_0x4216eb,_0xac4c7e){_0xac4c7e=_0xac4c7e||0xc8;return function(_0x2f5871){if(_0x2f5871){return _0x4216eb['status'](_0xac4c7e)[_0x5cf9('0x2c')](_0x2f5871);}};}function respondWithFilteredResult(_0x382c62,_0x11a939){return function(_0x4e029c){if(_0x4e029c){var _0x57fde4=typeof _0x11a939[_0x5cf9('0x2d')]==='undefined'&&typeof _0x11a939[_0x5cf9('0x2e')]===_0x5cf9('0x2f');var _0x482306=_0x4e029c[_0x5cf9('0x30')];var _0x39f222=_0x57fde4?0x0:_0x11a939[_0x5cf9('0x2d')];var _0x5503ff=_0x57fde4?_0x4e029c[_0x5cf9('0x30')]:_0x11a939[_0x5cf9('0x2d')]+_0x11a939[_0x5cf9('0x2e')];var _0x38ac82;if(_0x5503ff>=_0x482306){_0x5503ff=_0x482306;_0x38ac82=0xc8;}else{_0x38ac82=0xce;}_0x382c62[_0x5cf9('0x2a')](_0x38ac82);return _0x382c62[_0x5cf9('0x31')]('Content-Range',_0x39f222+'-'+_0x5503ff+'/'+_0x482306)[_0x5cf9('0x2c')](_0x4e029c);}return null;};}function patchUpdates(_0x175259){return function(_0x52b7d9){try{jsonpatch[_0x5cf9('0x32')](_0x52b7d9,_0x175259,!![]);}catch(_0x591f69){return BPromise['reject'](_0x591f69);}return _0x52b7d9['save']();};}function saveUpdates(_0x548783,_0x3de9a6){return function(_0x204d6a){if(_0x204d6a){return _0x204d6a[_0x5cf9('0x33')](_0x548783)[_0x5cf9('0x34')](function(_0x2a2b83){return _0x2a2b83;});}return null;};}function removeEntity(_0x2bfbb6,_0x28b30d){return function(_0x21f205){if(_0x21f205){return _0x21f205[_0x5cf9('0x35')]()[_0x5cf9('0x34')](function(){var _0x1c44ad=_0x21f205['get']({'plain':!![]});var _0x2112e3=_0x5cf9('0x36');return db[_0x5cf9('0x37')][_0x5cf9('0x35')]({'where':{'type':_0x2112e3,'resourceId':_0x1c44ad['id']}})[_0x5cf9('0x34')](function(){return _0x21f205;});})['then'](function(){_0x2bfbb6[_0x5cf9('0x2a')](0xcc)[_0x5cf9('0x2b')]();});}};}function handleEntityNotFound(_0x2a2a7a,_0x292857){return function(_0x56ebd9){if(!_0x56ebd9){_0x2a2a7a[_0x5cf9('0x29')](0x194);}return _0x56ebd9;};}function handleError(_0x517c15,_0x1f8928){_0x1f8928=_0x1f8928||0x1f4;return function(_0x438ae7){logger[_0x5cf9('0x24')](_0x438ae7[_0x5cf9('0x38')]);if(_0x438ae7[_0x5cf9('0x39')]){delete _0x438ae7[_0x5cf9('0x39')];}_0x517c15[_0x5cf9('0x2a')](_0x1f8928)[_0x5cf9('0x3a')](_0x438ae7);};}exports['index']=function(_0x522b64,_0x577478){var _0x3d5abb={'include':[{'model':db[_0x5cf9('0x3b')],'as':_0x5cf9('0x3c')}]},_0x5c260a={},_0x5444b5={'count':0x0,'rows':[]};var _0x367e7a=_['map'](db[_0x5cf9('0x3d')]['rawAttributes'],function(_0x246097){return{'name':_0x246097[_0x5cf9('0x3e')],'type':_0x246097[_0x5cf9('0x3f')][_0x5cf9('0x40')]};});_0x5c260a[_0x5cf9('0x41')]=_[_0x5cf9('0x42')](_0x367e7a,_0x5cf9('0x39'));_0x5c260a['query']=_[_0x5cf9('0x43')](_0x522b64[_0x5cf9('0x44')]);_0x5c260a[_0x5cf9('0x45')]=_[_0x5cf9('0x46')](_0x5c260a[_0x5cf9('0x41')],_0x5c260a['query']);_0x3d5abb[_0x5cf9('0x47')]=_[_0x5cf9('0x46')](_0x5c260a['model'],qs['fields'](_0x522b64[_0x5cf9('0x44')][_0x5cf9('0x48')]));_0x3d5abb[_0x5cf9('0x47')]=_0x3d5abb[_0x5cf9('0x47')][_0x5cf9('0x49')]?_0x3d5abb['attributes']:_0x5c260a[_0x5cf9('0x41')];if(!_0x522b64['query'][_0x5cf9('0x4a')]('nolimit')){_0x3d5abb[_0x5cf9('0x2e')]=qs['limit'](_0x522b64[_0x5cf9('0x44')]['limit']);_0x3d5abb[_0x5cf9('0x2d')]=qs['offset'](_0x522b64[_0x5cf9('0x44')][_0x5cf9('0x2d')]);}_0x3d5abb[_0x5cf9('0x4b')]=qs[_0x5cf9('0x4c')](_0x522b64[_0x5cf9('0x44')][_0x5cf9('0x4c')]);_0x3d5abb[_0x5cf9('0x4d')]=qs[_0x5cf9('0x45')](_[_0x5cf9('0x4e')](_0x522b64[_0x5cf9('0x44')],_0x5c260a[_0x5cf9('0x45')]),_0x367e7a);if(_0x522b64[_0x5cf9('0x44')][_0x5cf9('0x4f')]){_0x3d5abb[_0x5cf9('0x4d')]=_['merge'](_0x3d5abb['where'],{'$or':_[_0x5cf9('0x42')](_0x367e7a,function(_0x13b0c7){if(_0x13b0c7[_0x5cf9('0x3f')]!==_0x5cf9('0x50')){var _0x36416c={};_0x36416c[_0x13b0c7['name']]={'$like':'%'+_0x522b64[_0x5cf9('0x44')]['filter']+'%'};return _0x36416c;}})});}_0x3d5abb=_['merge']({},_0x3d5abb,_0x522b64['options']);var _0x2390a8={'where':_0x3d5abb['where']};return db[_0x5cf9('0x3d')][_0x5cf9('0x30')](_0x2390a8)[_0x5cf9('0x34')](function(_0x56f588){_0x5444b5[_0x5cf9('0x30')]=_0x56f588;if(_0x522b64[_0x5cf9('0x44')]['includeAll']){_0x3d5abb[_0x5cf9('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x5cf9('0x52')](_0x3d5abb);})['then'](function(_0x8dd4fe){_0x5444b5['rows']=_0x8dd4fe;return _0x5444b5;})['then'](respondWithFilteredResult(_0x577478,_0x3d5abb))[_0x5cf9('0x28')](handleError(_0x577478,null));};exports['show']=function(_0x308fdd,_0x311768){var _0x2324ad={'raw':![],'where':{'id':_0x308fdd['params']['id']},'include':[{'model':db['Pause'],'as':_0x5cf9('0x3c')}]},_0xc547d1={};_0xc547d1[_0x5cf9('0x41')]=_[_0x5cf9('0x43')](db[_0x5cf9('0x3d')][_0x5cf9('0x53')]);_0xc547d1[_0x5cf9('0x44')]=_['keys'](_0x308fdd[_0x5cf9('0x44')]);_0xc547d1['filters']=_[_0x5cf9('0x46')](_0xc547d1[_0x5cf9('0x41')],_0xc547d1[_0x5cf9('0x44')]);_0x2324ad['attributes']=_[_0x5cf9('0x46')](_0xc547d1['model'],qs['fields'](_0x308fdd[_0x5cf9('0x44')][_0x5cf9('0x48')]));_0x2324ad[_0x5cf9('0x47')]=_0x2324ad[_0x5cf9('0x47')][_0x5cf9('0x49')]?_0x2324ad[_0x5cf9('0x47')]:_0xc547d1[_0x5cf9('0x41')];if(_0x308fdd['query'][_0x5cf9('0x54')]){_0x2324ad[_0x5cf9('0x51')]=[{'all':!![]}];}_0x2324ad=_[_0x5cf9('0x55')]({},_0x2324ad,_0x308fdd[_0x5cf9('0x56')]);return db['OpenchannelAccount']['find'](_0x2324ad)[_0x5cf9('0x34')](handleEntityNotFound(_0x311768,null))['then'](respondWithResult(_0x311768,null))[_0x5cf9('0x28')](handleError(_0x311768,null));};exports[_0x5cf9('0x57')]=function(_0x438edf,_0x50380a){return db['OpenchannelAccount'][_0x5cf9('0x57')](_0x438edf[_0x5cf9('0x58')],{})[_0x5cf9('0x34')](function(_0x213026){var _0x326330=_0x438edf['user'][_0x5cf9('0x59')]({'plain':!![]});if(!_0x326330)throw new Error(_0x5cf9('0x5a'));if(_0x326330[_0x5cf9('0x5b')]==='user'){var _0x2bd9d9=_0x213026[_0x5cf9('0x59')]({'plain':!![]});var _0x3d1510=_0x5cf9('0x36');return db['UserProfileSection'][_0x5cf9('0x5c')]({'where':{'name':_0x3d1510,'userProfileId':_0x326330['userProfileId']},'raw':!![]})[_0x5cf9('0x34')](function(_0x556b7e){if(_0x556b7e&&_0x556b7e[_0x5cf9('0x5d')]===0x0){return db[_0x5cf9('0x37')][_0x5cf9('0x57')]({'name':_0x2bd9d9[_0x5cf9('0x39')],'resourceId':_0x2bd9d9['id'],'type':_0x556b7e[_0x5cf9('0x39')],'sectionId':_0x556b7e['id']},{})[_0x5cf9('0x34')](function(){return _0x213026;});}else{return _0x213026;}})['catch'](function(_0x59d893){logger[_0x5cf9('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59d893);throw _0x59d893;});}return _0x213026;})['then'](respondWithResult(_0x50380a,0xc9))[_0x5cf9('0x28')](handleError(_0x50380a,null));};exports[_0x5cf9('0x33')]=function(_0x2f492a,_0x32c414){if(_0x2f492a[_0x5cf9('0x58')]['id']){delete _0x2f492a[_0x5cf9('0x58')]['id'];}return db[_0x5cf9('0x3d')][_0x5cf9('0x5c')]({'where':{'id':_0x2f492a[_0x5cf9('0x5e')]['id']},'include':[{'model':db[_0x5cf9('0x3b')],'as':_0x5cf9('0x3c')}]})[_0x5cf9('0x34')](handleEntityNotFound(_0x32c414,null))[_0x5cf9('0x34')](saveUpdates(_0x2f492a[_0x5cf9('0x58')],null))[_0x5cf9('0x34')](respondWithResult(_0x32c414,null))[_0x5cf9('0x28')](handleError(_0x32c414,null));};exports[_0x5cf9('0x35')]=function(_0x5c3fe3,_0x423780){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c3fe3['params']['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x423780,null))['then'](removeEntity(_0x423780,null))[_0x5cf9('0x28')](handleError(_0x423780,null));};exports[_0x5cf9('0x5f')]=function(_0x4adb14,_0x424b39){return db['OpenchannelAccount'][_0x5cf9('0x5f')]()['then'](respondWithResult(_0x424b39,null))[_0x5cf9('0x28')](handleError(_0x424b39,null));};exports[_0x5cf9('0x60')]=function(_0x5d01b1,_0x21eaf8,_0x2b8ea8){if(_0x5d01b1['body']['id']){delete _0x5d01b1[_0x5cf9('0x58')]['id'];}return db[_0x5cf9('0x3d')][_0x5cf9('0x5c')]({'where':{'id':_0x5d01b1[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x21eaf8,null))[_0x5cf9('0x34')](function(_0xa71b94){if(_0xa71b94){_0x5d01b1[_0x5cf9('0x58')]['OpenchannelAccountId']=_0xa71b94['id'];return db['Disposition'][_0x5cf9('0x57')](_0x5d01b1[_0x5cf9('0x58')]);}})['then'](respondWithResult(_0x21eaf8,null))[_0x5cf9('0x28')](handleError(_0x21eaf8,null));};exports[_0x5cf9('0x61')]=function(_0x10e55c,_0x26edb0,_0x1abee4){var _0x31983c={'raw':![],'where':{}};var _0x4b2a54={};var _0x2abd30={'count':0x0,'rows':[]};return db[_0x5cf9('0x3d')][_0x5cf9('0x62')]({'where':{'id':_0x10e55c[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x26edb0,null))[_0x5cf9('0x34')](function(_0x40b832){if(_0x40b832){_0x4b2a54['model']=_['keys'](db[_0x5cf9('0x63')]['rawAttributes']);_0x4b2a54[_0x5cf9('0x44')]=_[_0x5cf9('0x43')](_0x10e55c['query']);_0x4b2a54[_0x5cf9('0x45')]=_[_0x5cf9('0x46')](_0x4b2a54[_0x5cf9('0x41')],_0x4b2a54[_0x5cf9('0x44')]);_0x31983c['attributes']=_[_0x5cf9('0x46')](_0x4b2a54[_0x5cf9('0x41')],qs[_0x5cf9('0x48')](_0x10e55c[_0x5cf9('0x44')]['fields']));_0x31983c['attributes']=_0x31983c['attributes']['length']?_0x31983c[_0x5cf9('0x47')]:_0x4b2a54[_0x5cf9('0x41')];if(!_0x10e55c[_0x5cf9('0x44')][_0x5cf9('0x4a')](_0x5cf9('0x64'))){_0x31983c[_0x5cf9('0x2e')]=qs[_0x5cf9('0x2e')](_0x10e55c['query'][_0x5cf9('0x2e')]);_0x31983c[_0x5cf9('0x2d')]=qs[_0x5cf9('0x2d')](_0x10e55c[_0x5cf9('0x44')][_0x5cf9('0x2d')]);}_0x31983c[_0x5cf9('0x4b')]=qs['sort'](_0x10e55c[_0x5cf9('0x44')][_0x5cf9('0x4c')]);_0x31983c[_0x5cf9('0x4d')]=qs[_0x5cf9('0x45')](_[_0x5cf9('0x4e')](_0x10e55c[_0x5cf9('0x44')],_0x4b2a54[_0x5cf9('0x45')]));_0x31983c['where'][_0x5cf9('0x65')]=_0x40b832['id'];if(_0x10e55c['query'][_0x5cf9('0x4f')]){_0x31983c[_0x5cf9('0x4d')]=_[_0x5cf9('0x55')](_0x31983c[_0x5cf9('0x4d')],{'$or':_['map'](_0x31983c[_0x5cf9('0x47')],function(_0x4e0657){var _0x593408={};_0x593408[_0x4e0657]={'$like':'%'+_0x10e55c[_0x5cf9('0x44')][_0x5cf9('0x4f')]+'%'};return _0x593408;})});}_0x31983c=_[_0x5cf9('0x55')]({},_0x31983c,_0x10e55c[_0x5cf9('0x56')]);return db[_0x5cf9('0x63')]['count']({'where':_0x31983c['where']})[_0x5cf9('0x34')](function(_0x46cf0c){_0x2abd30[_0x5cf9('0x30')]=_0x46cf0c;if(_0x10e55c['query']['includeAll']){_0x31983c[_0x5cf9('0x51')]=[{'all':!![]}];}return db[_0x5cf9('0x63')][_0x5cf9('0x52')](_0x31983c);})[_0x5cf9('0x34')](function(_0x161ae4){_0x2abd30['rows']=_0x161ae4;return _0x2abd30;});}})['then'](respondWithFilteredResult(_0x26edb0,_0x31983c))[_0x5cf9('0x28')](handleError(_0x26edb0,null));};exports[_0x5cf9('0x66')]=function(_0x297b0f,_0x52f329,_0x43c07c){return db['OpenchannelAccount'][_0x5cf9('0x5c')]({'where':{'id':_0x297b0f[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x52f329,null))[_0x5cf9('0x34')](function(_0x59e599){if(_0x59e599){return _0x59e599['removeDispositions'](_0x297b0f[_0x5cf9('0x44')][_0x5cf9('0x67')]);}})[_0x5cf9('0x34')](respondWithStatusCode(_0x52f329,null))[_0x5cf9('0x28')](handleError(_0x52f329,null));};exports['addAnswer']=function(_0x2c577a,_0x1ff699,_0x4a87d1){if(_0x2c577a[_0x5cf9('0x58')]['id']){delete _0x2c577a[_0x5cf9('0x58')]['id'];}return db[_0x5cf9('0x3d')]['find']({'where':{'id':_0x2c577a[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x1ff699,null))['then'](function(_0x38d7cf){if(_0x38d7cf){_0x2c577a[_0x5cf9('0x58')][_0x5cf9('0x65')]=_0x38d7cf['id'];return db[_0x5cf9('0x68')][_0x5cf9('0x57')](_0x2c577a[_0x5cf9('0x58')]);}})[_0x5cf9('0x34')](respondWithResult(_0x1ff699,null))[_0x5cf9('0x28')](handleError(_0x1ff699,null));};exports['getAnswers']=function(_0x270d08,_0x3f43a2,_0x5030bd){var _0x224a7a={'raw':![],'where':{}};var _0x145fd6={};var _0x4f84bc={'count':0x0,'rows':[]};return db[_0x5cf9('0x3d')][_0x5cf9('0x62')]({'where':{'id':_0x270d08[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x3f43a2,null))[_0x5cf9('0x34')](function(_0x9a25c2){if(_0x9a25c2){_0x145fd6['model']=_[_0x5cf9('0x43')](db[_0x5cf9('0x68')][_0x5cf9('0x53')]);_0x145fd6[_0x5cf9('0x44')]=_[_0x5cf9('0x43')](_0x270d08[_0x5cf9('0x44')]);_0x145fd6[_0x5cf9('0x45')]=_[_0x5cf9('0x46')](_0x145fd6['model'],_0x145fd6[_0x5cf9('0x44')]);_0x224a7a[_0x5cf9('0x47')]=_[_0x5cf9('0x46')](_0x145fd6['model'],qs[_0x5cf9('0x48')](_0x270d08[_0x5cf9('0x44')][_0x5cf9('0x48')]));_0x224a7a[_0x5cf9('0x47')]=_0x224a7a[_0x5cf9('0x47')][_0x5cf9('0x49')]?_0x224a7a[_0x5cf9('0x47')]:_0x145fd6[_0x5cf9('0x41')];if(!_0x270d08[_0x5cf9('0x44')][_0x5cf9('0x4a')](_0x5cf9('0x64'))){_0x224a7a[_0x5cf9('0x2e')]=qs[_0x5cf9('0x2e')](_0x270d08[_0x5cf9('0x44')][_0x5cf9('0x2e')]);_0x224a7a[_0x5cf9('0x2d')]=qs['offset'](_0x270d08[_0x5cf9('0x44')][_0x5cf9('0x2d')]);}_0x224a7a[_0x5cf9('0x4b')]=qs[_0x5cf9('0x4c')](_0x270d08[_0x5cf9('0x44')]['sort']);_0x224a7a['where']=qs[_0x5cf9('0x45')](_['pick'](_0x270d08[_0x5cf9('0x44')],_0x145fd6[_0x5cf9('0x45')]));_0x224a7a[_0x5cf9('0x4d')][_0x5cf9('0x65')]=_0x9a25c2['id'];if(_0x270d08[_0x5cf9('0x44')]['filter']){_0x224a7a['where']=_['merge'](_0x224a7a[_0x5cf9('0x4d')],{'$or':_[_0x5cf9('0x42')](_0x224a7a['attributes'],function(_0x2d82b4){var _0xe883ba={};_0xe883ba[_0x2d82b4]={'$like':'%'+_0x270d08[_0x5cf9('0x44')]['filter']+'%'};return _0xe883ba;})});}_0x224a7a=_[_0x5cf9('0x55')]({},_0x224a7a,_0x270d08[_0x5cf9('0x56')]);return db[_0x5cf9('0x68')][_0x5cf9('0x30')]({'where':_0x224a7a[_0x5cf9('0x4d')]})[_0x5cf9('0x34')](function(_0x2405af){_0x4f84bc[_0x5cf9('0x30')]=_0x2405af;if(_0x270d08[_0x5cf9('0x44')][_0x5cf9('0x54')]){_0x224a7a[_0x5cf9('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5cf9('0x52')](_0x224a7a);})[_0x5cf9('0x34')](function(_0x4658e5){_0x4f84bc[_0x5cf9('0x69')]=_0x4658e5;return _0x4f84bc;});}})['then'](respondWithFilteredResult(_0x3f43a2,_0x224a7a))[_0x5cf9('0x28')](handleError(_0x3f43a2,null));};exports[_0x5cf9('0x6a')]=function(_0x3b3e1b,_0x45c832,_0x5a2adc){return db[_0x5cf9('0x3d')]['find']({'where':{'id':_0x3b3e1b[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x45c832,null))['then'](function(_0x449ce1){if(_0x449ce1){return _0x449ce1[_0x5cf9('0x6a')](_0x3b3e1b['query'][_0x5cf9('0x67')]);}})[_0x5cf9('0x34')](respondWithStatusCode(_0x45c832,null))[_0x5cf9('0x28')](handleError(_0x45c832,null));};exports['notify']=function(_0x490dae,_0x36148d,_0x520d1d){var _0xe4b21e={'body':_0x490dae[_0x5cf9('0x58')],'channel':_0x5cf9('0x6b')};var _0x1b4348=[];var _0x237dfc=[];var _0x1ec766={};var _0x254539=![];return db[_0x5cf9('0x6c')][_0x5cf9('0x5f')]()[_0x5cf9('0x34')](function(_0x3f8d93){if(!_0x3f8d93){throw new db[(_0x5cf9('0x6d'))][(_0x5cf9('0x6e'))](_0x5cf9('0x6f'));}_0x1b4348=_[_0x5cf9('0x70')](_['keys'](_0x3f8d93),[_0x5cf9('0x71'),_0x5cf9('0x72')]);_0x237dfc=_[_0x5cf9('0x70')](_[_0x5cf9('0x43')](_0x3f8d93),[_0x5cf9('0x71'),'updatedAt',_0x5cf9('0x73'),_0x5cf9('0x74')]);if(_0x490dae[_0x5cf9('0x58')]['id']){delete _0x490dae[_0x5cf9('0x58')]['id'];}if(_[_0x5cf9('0x75')](_0x490dae['body'][_0x5cf9('0x76')])){throw new db[(_0x5cf9('0x6d'))][(_0x5cf9('0x6e'))](_0x5cf9('0x77'));}if(_['isNil'](_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x58')])||_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x58')]===''){throw new db[(_0x5cf9('0x6d'))]['ValidationError'](_0x5cf9('0x78'));}if(_['isNil'](_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x79')])){throw new db[(_0x5cf9('0x6d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x237dfc);}if(!_[_0x5cf9('0x7a')](_0x237dfc,_0x490dae[_0x5cf9('0x58')]['mapKey'])){throw new db[(_0x5cf9('0x6d'))][(_0x5cf9('0x6e'))](_0x5cf9('0x7b')+_0x237dfc);}_0x1ec766[_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x79')]]=_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x76')];})[_0x5cf9('0x34')](function(){return db['OpenchannelAccount'][_0x5cf9('0x5c')]({'where':{'id':_0x490dae[_0x5cf9('0x5e')]['id']},'include':[{'model':db[_0x5cf9('0x7c')],'as':_0x5cf9('0x7d'),'include':[{'model':db[_0x5cf9('0x6c')],'as':'Contacts','where':_0x1ec766,'limit':0x1,'order':[[_0x5cf9('0x72'),'DESC']]}]},{'model':db[_0x5cf9('0x7e')],'as':_0x5cf9('0x7f')}]});})[_0x5cf9('0x34')](handleEntityNotFound(_0x36148d,null))[_0x5cf9('0x34')](function(_0x1da167){if(_0x1da167&&_0x1da167[_0x5cf9('0x7d')]){_0xe4b21e[_0x5cf9('0x80')]=_0x1da167;_0xe4b21e['applications']=_0x1da167[_0x5cf9('0x7f')];_0xe4b21e[_0x5cf9('0x81')]=_0x1da167[_0x5cf9('0x7d')];_0xe4b21e['applications']=_[_0x5cf9('0x82')](_0xe4b21e[_0x5cf9('0x83')],[_0x5cf9('0x84')],['asc']);if(_0xe4b21e['account'][_0x5cf9('0x7f')]){delete _0xe4b21e[_0x5cf9('0x80')][_0x5cf9('0x7f')];}if(_0xe4b21e[_0x5cf9('0x80')][_0x5cf9('0x7d')]&&_0xe4b21e['account'][_0x5cf9('0x7d')][_0x5cf9('0x85')]['length']){return _0xe4b21e[_0x5cf9('0x80')][_0x5cf9('0x7d')][_0x5cf9('0x85')][0x0];}var _0x537a9c=_[_0x5cf9('0x18')](_0x490dae[_0x5cf9('0x58')],{'firstName':_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x76')],'ListId':_0x1da167[_0x5cf9('0x74')]});_0x537a9c[_0x490dae['body'][_0x5cf9('0x79')]]=_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x76')];return db['CmContact']['create'](_0x537a9c,{'fields':_0x1b4348,'raw':!![]});}})[_0x5cf9('0x34')](handleEntityNotFound(_0x36148d,null))[_0x5cf9('0x34')](function(_0xdd3a4b){_0xe4b21e[_0x5cf9('0x86')]=_0xdd3a4b;if(_0xdd3a4b){var _0x28cbd0={'ContactId':_0xdd3a4b['id'],'OpenchannelAccountId':_0x490dae[_0x5cf9('0x5e')]['id'],'from':(_0xdd3a4b[_0x5cf9('0x87')]||'')+'\x20'+(_0xdd3a4b[_0x5cf9('0x88')]||'')};var _0x59315d={'OpenchannelAccountId':_0x490dae[_0x5cf9('0x5e')]['id'],'closed':![]};if(_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x89')]){_0x59315d[_0x5cf9('0x89')]=_0x490dae['body'][_0x5cf9('0x89')];return db['OpenchannelInteraction']['find']({'where':_0x59315d})[_0x5cf9('0x34')](function(_0x587a16){if(_0x587a16){return[_0x587a16,![]];}_0x28cbd0[_0x5cf9('0x89')]=_0x490dae[_0x5cf9('0x58')]['threadId'];_0x28cbd0[_0x5cf9('0x8a')]=_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x8a')];return db[_0x5cf9('0x8b')][_0x5cf9('0x57')](_0x28cbd0)[_0x5cf9('0x34')](function(_0x4de07d){return[_0x4de07d,!![]];});});}else{_0x59315d['threadId']=null;}_0x59315d[_0x5cf9('0x8c')]=_0xdd3a4b['id'];return db[_0x5cf9('0x8b')][_0x5cf9('0x5c')]({'where':_0x59315d})[_0x5cf9('0x34')](function(_0x2b7239){if(_0x2b7239){return[_0x2b7239,![]];}return db[_0x5cf9('0x8b')][_0x5cf9('0x57')](_0x28cbd0)[_0x5cf9('0x34')](function(_0x3141c3){return[_0x3141c3,!![]];});});}})[_0x5cf9('0x8d')](function(_0x40e1e7,_0x1ca38f){if(_0x40e1e7){_0x254539=_0x1ca38f;if(!_0x1ca38f){var _0x5b14f1={'from':(_0xe4b21e['contact'][_0x5cf9('0x87')]||'')+'\x20'+(_0xe4b21e[_0x5cf9('0x86')][_0x5cf9('0x88')]||'')};if(_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x89')]&&_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x8e')]&&_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x89')]!=_0x490dae['body'][_0x5cf9('0x8e')]){_0x5b14f1[_0x5cf9('0x89')]=_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x8e')];}return _0x40e1e7[_0x5cf9('0x33')](_0x5b14f1);}else{return _0x40e1e7;}}})['then'](function(_0x3ac6d3){_0xe4b21e[_0x5cf9('0x8f')]=_0x3ac6d3[_0x5cf9('0x59')]({'plain':!![]});_0xe4b21e[_0x5cf9('0x8f')]['created']=_0x254539;if(_0xe4b21e[_0x5cf9('0x8f')]['created']){if(_0xe4b21e[_0x5cf9('0x80')][_0x5cf9('0x90')]){_0xe4b21e['applications']['push']({'id':0x0,'priority':_0xe4b21e['applications']['length']+0x1,'app':_0x5cf9('0x91'),'appdata':_0x5cf9('0x92'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x5cf9('0x57')]({'body':_0x490dae[_0x5cf9('0x58')][_0x5cf9('0x58')],'OpenchannelAccountId':_0x490dae[_0x5cf9('0x5e')]['id'],'OpenchannelInteractionId':_0x3ac6d3['id'],'direction':'in','ContactId':_0xe4b21e['contact']['id'],'AttachmentId':_0x490dae['body']['AttachmentId']});})[_0x5cf9('0x34')](function(_0x5ce25d){_0xe4b21e['message']=_0x5ce25d;if(_0xe4b21e[_0x5cf9('0x8f')][_0x5cf9('0x93')]){return db[_0x5cf9('0x94')][_0x5cf9('0x5c')]({'attributes':['id',_0x5cf9('0x39')],'where':{'id':_0xe4b21e[_0x5cf9('0x8f')][_0x5cf9('0x93')]}})[_0x5cf9('0x34')](function(_0x522695){if(_0x522695){_0xe4b21e[_0x5cf9('0x83')][_0x5cf9('0x95')]({'id':0x0,'priority':0x0,'app':_0x5cf9('0x96'),'appdata':_0x522695[_0x5cf9('0x39')]+','+(_0xe4b21e[_0x5cf9('0x80')][_0x5cf9('0x97')]||0xa),'interval':'*,*,*,*'});_0xe4b21e[_0x5cf9('0x98')]=![];}return respondWithRpcPromise('Start','startRouting',_0xe4b21e);});}return respondWithRpcPromise(_0x5cf9('0x99'),_0x5cf9('0x9a'),_0xe4b21e);})[_0x5cf9('0x34')](function(_0x1e03ed){respondWithRpcPromise(_0x5cf9('0x9b'),'EventManager',{'event':'notify','message':_0x1e03ed},client9002);return _0x1e03ed;})[_0x5cf9('0x34')](respondWithResult(_0x36148d,null))['catch'](handleError(_0x36148d,null));};exports[_0x5cf9('0x9c')]=function(_0x1432b6,_0x16e142){var _0x37c2cf=_0x1432b6[_0x5cf9('0x5e')]['id'];var _0x382812=_0x1432b6['body'];var _0xf72836=0xc8;var _0x58f8d2=null;return db[_0x5cf9('0x9d')][_0x5cf9('0x9e')]({'isolationLevel':db[_0x5cf9('0x9d')]['Transaction'][_0x5cf9('0x9f')][_0x5cf9('0xa0')]},function(_0x28a805){return db[_0x5cf9('0x3d')][_0x5cf9('0x62')]({'where':{'id':_0x37c2cf},'transaction':_0x28a805})[_0x5cf9('0x34')](function(_0x549add){if(_0x549add){return db['OpenchannelApplication'][_0x5cf9('0x35')]({'where':{'OpenchannelAccountId':_0x37c2cf},'transaction':_0x28a805})['then'](function(){var _0x81ac83=_[_0x5cf9('0x42')](_0x382812,function(_0x30cb87){_0x30cb87[_0x5cf9('0x65')]=_0x37c2cf;return _0x30cb87;});return db[_0x5cf9('0x7e')]['bulkCreate'](_0x81ac83,{'transaction':_0x28a805});});}else{_0xf72836=0x194;_0x58f8d2=[];}});})['then'](function(){if(_0xf72836!==0x194){return db[_0x5cf9('0x7e')][_0x5cf9('0xa1')]({'where':{'OpenchannelAccountId':_0x37c2cf},'order':_0x5cf9('0x84')})['then'](function(_0xcae62c){_0x58f8d2=_0xcae62c;});}})[_0x5cf9('0x28')](function(_0x47becb){_0xf72836=0x1f4;logger[_0x5cf9('0x24')](_0x47becb[_0x5cf9('0x38')]);if(_0x47becb[_0x5cf9('0x39')]){delete _0x47becb['name'];}_0x58f8d2=_0x47becb;})[_0x5cf9('0xa2')](function(){if(_0x58f8d2===null){_0x16e142['sendStatus'](_0xf72836);}else{if(_0xf72836===0x1f4){_0x16e142[_0x5cf9('0x2a')](_0xf72836)[_0x5cf9('0x3a')](_0x58f8d2);}else{_0x16e142[_0x5cf9('0x2a')](_0xf72836)[_0x5cf9('0x2c')](_0x58f8d2);}}});};exports[_0x5cf9('0xa3')]=function(_0x536fdd,_0xafee2a,_0x44cf16){var _0x12dca2={};var _0x16015b={};var _0x19d403;var _0x345cb3;return db[_0x5cf9('0x3d')][_0x5cf9('0x62')]({'where':{'id':_0x536fdd['params']['id']}})['then'](handleEntityNotFound(_0xafee2a,null))[_0x5cf9('0x34')](function(_0x5285a7){if(_0x5285a7){_0x19d403=_0x5285a7;_0x16015b[_0x5cf9('0x41')]=_[_0x5cf9('0x43')](db[_0x5cf9('0x7e')][_0x5cf9('0x53')]);_0x16015b[_0x5cf9('0x44')]=_[_0x5cf9('0x43')](_0x536fdd[_0x5cf9('0x44')]);_0x16015b['filters']=_['intersection'](_0x16015b['model'],_0x16015b[_0x5cf9('0x44')]);_0x12dca2['attributes']=_['intersection'](_0x16015b['model'],qs[_0x5cf9('0x48')](_0x536fdd[_0x5cf9('0x44')]['fields']));_0x12dca2[_0x5cf9('0x47')]=_0x12dca2[_0x5cf9('0x47')]['length']?_0x12dca2['attributes']:_0x16015b[_0x5cf9('0x41')];_0x12dca2[_0x5cf9('0x4b')]=qs['sort'](_0x536fdd[_0x5cf9('0x44')][_0x5cf9('0x4c')]);_0x12dca2['where']=qs[_0x5cf9('0x45')](_['pick'](_0x536fdd[_0x5cf9('0x44')],_0x16015b[_0x5cf9('0x45')]));if(_0x536fdd[_0x5cf9('0x44')]['filter']){_0x12dca2[_0x5cf9('0x4d')]=_[_0x5cf9('0x55')](_0x12dca2['where'],{'$or':_[_0x5cf9('0x42')](_0x12dca2[_0x5cf9('0x47')],function(_0x1604fb){var _0x15849d={};_0x15849d[_0x1604fb]={'$like':'%'+_0x536fdd[_0x5cf9('0x44')][_0x5cf9('0x4f')]+'%'};return _0x15849d;})});}_0x12dca2=_[_0x5cf9('0x55')]({},_0x12dca2,_0x536fdd[_0x5cf9('0x56')]);return _0x19d403[_0x5cf9('0xa3')](_0x12dca2);}})[_0x5cf9('0x34')](function(_0x4b8d9f){if(_0x4b8d9f){_0x345cb3=_0x4b8d9f[_0x5cf9('0x49')];if(!_0x536fdd[_0x5cf9('0x44')][_0x5cf9('0x4a')](_0x5cf9('0x64'))){_0x12dca2[_0x5cf9('0x2e')]=qs['limit'](_0x536fdd[_0x5cf9('0x44')][_0x5cf9('0x2e')]);_0x12dca2[_0x5cf9('0x2d')]=qs['offset'](_0x536fdd[_0x5cf9('0x44')][_0x5cf9('0x2d')]);}return _0x19d403[_0x5cf9('0xa3')](_0x12dca2);}})[_0x5cf9('0x34')](function(_0x29307e){if(_0x29307e){return _0x29307e?{'count':_0x345cb3,'rows':_0x29307e}:null;}})[_0x5cf9('0x34')](respondWithResult(_0xafee2a,null))[_0x5cf9('0x28')](handleError(_0xafee2a,null));};exports[_0x5cf9('0xa4')]=function(_0x51c3ce,_0x267245,_0x2affc0){var _0x2c293f={'raw':![],'where':{}};var _0x2d28b8={};var _0x515612={'count':0x0,'rows':[]};return db[_0x5cf9('0x3d')][_0x5cf9('0x62')]({'where':{'id':_0x51c3ce[_0x5cf9('0x5e')]['id']}})['then'](handleEntityNotFound(_0x267245,null))[_0x5cf9('0x34')](function(_0x148f60){if(_0x148f60){_0x2d28b8['model']=_[_0x5cf9('0x43')](db['OpenchannelInteraction'][_0x5cf9('0x53')]);_0x2d28b8['query']=_[_0x5cf9('0x43')](_0x51c3ce['query']);_0x2d28b8[_0x5cf9('0x45')]=_[_0x5cf9('0x46')](_0x2d28b8['model'],_0x2d28b8[_0x5cf9('0x44')]);_0x2c293f[_0x5cf9('0x47')]=_[_0x5cf9('0x46')](_0x2d28b8['model'],qs[_0x5cf9('0x48')](_0x51c3ce['query'][_0x5cf9('0x48')]));_0x2c293f[_0x5cf9('0x47')]=_0x2c293f['attributes'][_0x5cf9('0x49')]?_0x2c293f[_0x5cf9('0x47')]:_0x2d28b8['model'];if(!_0x51c3ce[_0x5cf9('0x44')]['hasOwnProperty']('nolimit')){_0x2c293f['limit']=qs[_0x5cf9('0x2e')](_0x51c3ce[_0x5cf9('0x44')][_0x5cf9('0x2e')]);_0x2c293f[_0x5cf9('0x2d')]=qs[_0x5cf9('0x2d')](_0x51c3ce['query'][_0x5cf9('0x2d')]);}_0x2c293f[_0x5cf9('0x4b')]=qs[_0x5cf9('0x4c')](_0x51c3ce[_0x5cf9('0x44')][_0x5cf9('0x4c')]);_0x2c293f[_0x5cf9('0x4d')]=qs['filters'](_[_0x5cf9('0x4e')](_0x51c3ce[_0x5cf9('0x44')],_0x2d28b8[_0x5cf9('0x45')]));_0x2c293f[_0x5cf9('0x4d')]['OpenchannelAccountId']=_0x148f60['id'];if(_0x51c3ce[_0x5cf9('0x44')][_0x5cf9('0x4f')]){_0x2c293f['where']=_[_0x5cf9('0x55')](_0x2c293f['where'],{'$or':_['map'](_0x2c293f[_0x5cf9('0x47')],function(_0x40441e){var _0x30c943={};_0x30c943[_0x40441e]={'$like':'%'+_0x51c3ce['query'][_0x5cf9('0x4f')]+'%'};return _0x30c943;})});}_0x2c293f=_['merge']({},_0x2c293f,_0x51c3ce[_0x5cf9('0x56')]);return db[_0x5cf9('0x8b')][_0x5cf9('0x30')]({'where':_0x2c293f['where']})['then'](function(_0x2fe88e){_0x515612[_0x5cf9('0x30')]=_0x2fe88e;if(_0x51c3ce['query']['includeAll']){_0x2c293f['include']=[{'model':db[_0x5cf9('0x6c')],'as':'Contact','required':![]},{'model':db[_0x5cf9('0x94')],'as':_0x5cf9('0xa5'),'attributes':['name',_0x5cf9('0xa6'),_0x5cf9('0xa7')],'required':![]},{'model':db[_0x5cf9('0xa8')],'as':_0x5cf9('0xa9'),'attributes':['id',_0x5cf9('0x39'),_0x5cf9('0xaa')],'where':_0x51c3ce[_0x5cf9('0x44')][_0x5cf9('0xab')]?{'id':_0x51c3ce[_0x5cf9('0x44')]['tag']}:undefined,'required':_0x51c3ce[_0x5cf9('0x44')][_0x5cf9('0xab')]?!![]:![]}];}return db[_0x5cf9('0x8b')][_0x5cf9('0x52')](_0x2c293f);})['then'](function(_0x46f1f7){_0x515612[_0x5cf9('0x69')]=_0x46f1f7;return _0x515612;});}})['then'](respondWithFilteredResult(_0x267245,_0x2c293f))[_0x5cf9('0x28')](handleError(_0x267245,null));};exports[_0x5cf9('0xac')]=function(_0x338e62,_0x165f57,_0x1f2fe0){return db['OpenchannelAccount'][_0x5cf9('0x5c')]({'where':{'id':_0x338e62[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x165f57,null))[_0x5cf9('0x34')](function(_0xaa396){if(_0xaa396){return _0xaa396['addAgents'](_0x338e62[_0x5cf9('0x58')][_0x5cf9('0x67')],_[_0x5cf9('0xad')](_0x338e62[_0x5cf9('0x58')],[_0x5cf9('0x67'),'id'])||{})[_0x5cf9('0x8d')](function(_0x2d9e21){for(var _0x3fc6f5=0x0;_0x3fc6f5<_0x338e62[_0x5cf9('0x58')]['ids'][_0x5cf9('0x49')];_0x3fc6f5+=0x1){socket[_0x5cf9('0xae')]('userOpenchannelAccount:save',{'UserId':Number(_0x338e62[_0x5cf9('0x58')][_0x5cf9('0x67')][_0x3fc6f5]),'OpenchannelAccountId':Number(_0x338e62[_0x5cf9('0x5e')]['id'])});}return _0x2d9e21;});}})[_0x5cf9('0x34')](respondWithResult(_0x165f57,null))[_0x5cf9('0x28')](handleError(_0x165f57,null));};exports['removeAgents']=function(_0x2257ff,_0x41dae5,_0x4e791a){return db['OpenchannelAccount'][_0x5cf9('0x5c')]({'where':{'id':_0x2257ff[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x41dae5,null))['then'](function(_0x55d61b){if(_0x55d61b){return _0x55d61b['removeAgents'](_0x2257ff[_0x5cf9('0x44')]['ids'])['then'](function(){if(_[_0x5cf9('0xaf')](_0x2257ff['query'][_0x5cf9('0x67')])){for(var _0x42cb78=0x0;_0x42cb78<_0x2257ff['query'][_0x5cf9('0x67')][_0x5cf9('0x49')];_0x42cb78+=0x1){socket['emit'](_0x5cf9('0xb0'),{'UserId':Number(_0x2257ff[_0x5cf9('0x44')][_0x5cf9('0x67')][_0x42cb78]),'OpenchannelAccountId':Number(_0x2257ff[_0x5cf9('0x5e')]['id'])});}}else{socket['emit'](_0x5cf9('0xb0'),{'UserId':Number(_0x2257ff[_0x5cf9('0x44')][_0x5cf9('0x67')]),'OpenchannelAccountId':Number(_0x2257ff[_0x5cf9('0x5e')]['id'])});}});}})[_0x5cf9('0x34')](respondWithStatusCode(_0x41dae5,null))[_0x5cf9('0x28')](handleError(_0x41dae5,null));};exports[_0x5cf9('0xb1')]=function(_0xf91a30,_0x492772,_0xb74fb2){var _0x491a6c={};var _0x5266eb={};var _0xbfe977;var _0xb81350;return db['OpenchannelAccount'][_0x5cf9('0x62')]({'where':{'id':_0xf91a30[_0x5cf9('0x5e')]['id']}})['then'](handleEntityNotFound(_0x492772,null))['then'](function(_0xccfe68){if(_0xccfe68){_0xbfe977=_0xccfe68;_0x5266eb[_0x5cf9('0x41')]=_['keys'](db['User']['rawAttributes']);_0x5266eb[_0x5cf9('0x44')]=_['keys'](_0xf91a30[_0x5cf9('0x44')]);_0x5266eb[_0x5cf9('0x45')]=_[_0x5cf9('0x46')](_0x5266eb['model'],_0x5266eb['query']);_0x491a6c['attributes']=_[_0x5cf9('0x46')](_0x5266eb[_0x5cf9('0x41')],qs[_0x5cf9('0x48')](_0xf91a30[_0x5cf9('0x44')][_0x5cf9('0x48')]));_0x491a6c[_0x5cf9('0x47')]=_0x491a6c[_0x5cf9('0x47')][_0x5cf9('0x49')]?_0x491a6c['attributes']:_0x5266eb[_0x5cf9('0x41')];_0x491a6c[_0x5cf9('0x4b')]=qs[_0x5cf9('0x4c')](_0xf91a30[_0x5cf9('0x44')][_0x5cf9('0x4c')]);_0x491a6c[_0x5cf9('0x4d')]=qs[_0x5cf9('0x45')](_[_0x5cf9('0x4e')](_0xf91a30['query'],_0x5266eb[_0x5cf9('0x45')]));if(_0xf91a30[_0x5cf9('0x44')]['filter']){_0x491a6c[_0x5cf9('0x4d')]=_['merge'](_0x491a6c[_0x5cf9('0x4d')],{'$or':_[_0x5cf9('0x42')](_0x491a6c[_0x5cf9('0x47')],function(_0x1b30a1){var _0x42e6e5={};_0x42e6e5[_0x1b30a1]={'$like':'%'+_0xf91a30[_0x5cf9('0x44')][_0x5cf9('0x4f')]+'%'};return _0x42e6e5;})});}_0x491a6c=_[_0x5cf9('0x55')]({},_0x491a6c,_0xf91a30[_0x5cf9('0x56')]);return _0xbfe977[_0x5cf9('0xb1')](_0x491a6c);}})[_0x5cf9('0x34')](function(_0x5e467f){if(_0x5e467f){_0xb81350=_0x5e467f[_0x5cf9('0x49')];if(!_0xf91a30['query'][_0x5cf9('0x4a')](_0x5cf9('0x64'))){_0x491a6c[_0x5cf9('0x2e')]=qs[_0x5cf9('0x2e')](_0xf91a30['query']['limit']);_0x491a6c[_0x5cf9('0x2d')]=qs[_0x5cf9('0x2d')](_0xf91a30['query'][_0x5cf9('0x2d')]);}return _0xbfe977[_0x5cf9('0xb1')](_0x491a6c);}})[_0x5cf9('0x34')](function(_0x326eaa){if(_0x326eaa){return _0x326eaa?{'count':_0xb81350,'rows':_0x326eaa}:null;}})[_0x5cf9('0x34')](respondWithResult(_0x492772,null))[_0x5cf9('0x28')](handleError(_0x492772,null));};exports[_0x5cf9('0x3a')]=function(_0xd20445,_0x161a48,_0x429013){var _0x5e250b,_0x3af4da,_0x3e1ae3;if(_[_0x5cf9('0x75')](_0xd20445[_0x5cf9('0x58')][_0x5cf9('0x58')])||_0xd20445[_0x5cf9('0x58')][_0x5cf9('0x58')]===''){throw new db[(_0x5cf9('0x6d'))][(_0x5cf9('0x6e'))](_0x5cf9('0x78'));}if(_[_0x5cf9('0x75')](_0xd20445['body']['to'])){}_0x5e250b=_0xd20445['body']['to'];return db[_0x5cf9('0x3d')]['findOne']({'where':{'id':_0xd20445[_0x5cf9('0x5e')]['id']}})[_0x5cf9('0x34')](handleEntityNotFound(_0x161a48,null))[_0x5cf9('0x34')](function(_0x18a68a){if(_0x18a68a){return db[_0x5cf9('0x3d')][_0x5cf9('0x5c')]({'where':{'id':_0x18a68a['id']},'include':[{'model':db[_0x5cf9('0x7c')],'as':_0x5cf9('0x7d'),'include':[{'model':db[_0x5cf9('0x6c')],'as':_0x5cf9('0x85'),'where':{[_0x18a68a[_0x5cf9('0x79')]]:_0x5e250b},'limit':0x1,'order':[[_0x5cf9('0x72'),_0x5cf9('0xb2')]]}]}]})['then'](handleEntityNotFound(_0x161a48,null))['then'](function(_0x5b846e){if(_0x5b846e&&_0x5b846e['List']){_0x3af4da=_0x5b846e['get']({'plain':!![]});if(_0x3af4da['List']&&_0x3af4da[_0x5cf9('0x7d')][_0x5cf9('0x85')][_0x5cf9('0x49')]){return _0x3af4da[_0x5cf9('0x7d')]['Contacts'][0x0];}return db[_0x5cf9('0x6c')][_0x5cf9('0x57')](_[_0x5cf9('0x18')](_0xd20445[_0x5cf9('0x58')],{'firstName':_0x5e250b,[_0x5b846e[_0x5cf9('0x79')]]:_0x5e250b,'phone':_0x5e250b,'ListId':_0x3af4da[_0x5cf9('0x74')]}));}})[_0x5cf9('0x34')](handleEntityNotFound(_0x161a48,null))[_0x5cf9('0x34')](function(_0x246b69){if(_0x246b69){_0x3e1ae3=_0x246b69;return db[_0x5cf9('0x8b')][_0x5cf9('0x5c')]({'where':{'ContactId':_0x3e1ae3['id'],'closed':![],'OpenchannelAccountId':_0x3af4da['id']}})[_0x5cf9('0x34')](function(_0x217742){if(_0x217742){return[_0x217742,![]];}return db['OpenchannelInteraction'][_0x5cf9('0x57')]({'UserId':_0xd20445[_0x5cf9('0xb3')]['id'],'ContactId':_0x3e1ae3['id'],'OpenchannelAccountId':_0x3af4da['id'],'lastMsgDirection':'out','firstMsgDirection':_0x5cf9('0xb4'),'Messages':[_['merge'](_0xd20445[_0x5cf9('0x58')],{'read':![],'body':_0xd20445[_0x5cf9('0x58')][_0x5cf9('0x58')],'OpenchannelAccountId':_0x3af4da['id'],'UserId':_0xd20445[_0x5cf9('0xb3')]['id'],'ContactId':_0x3e1ae3['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x5cf9('0x34')](function(_0xe92cfb){return[_0xe92cfb,!![]];});});}})[_0x5cf9('0x8d')](function(_0x5ef2d4,_0x5cf869){if(_0x5cf869){return _0x5ef2d4;}return db[_0x5cf9('0xb5')][_0x5cf9('0x57')](_['merge'](_0xd20445[_0x5cf9('0x58')],{'read':![],'body':_0xd20445['body']['body'],'OpenchannelAccountId':_0x3af4da['id'],'OpenchannelInteractionId':_0x5ef2d4['id'],'UserId':_0xd20445['user']['id'],'ContactId':_0x3e1ae3['id']}))[_0x5cf9('0x34')](function(_0x5cab14){_0x5ef2d4[_0x5cf9('0xb6')]['Messages']=[];_0x5ef2d4[_0x5cf9('0xb6')][_0x5cf9('0xb7')]['push'](_0x5cab14[_0x5cf9('0xb6')]);return _0x5ef2d4;});});}})['then'](respondWithResult(_0x161a48,null))[_0x5cf9('0x28')](handleError(_0x161a48,null));}; \ No newline at end of file +var _0xf39b=['list','applications','orderBy','priority','asc','Applications','Contacts','defaults','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','sendStatus','json','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','addAgents','ids','omit','spread','emit','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','includeAll','rows','show','keys','intersection','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','findAll','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','OpenchannelApplication','account'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xf39b,0x100));var _0xbf39=function(_0x2896a7,_0x576192){_0x2896a7=_0x2896a7-0x0;var _0xbd20e=_0xf39b[_0x2896a7];return _0xbd20e;};'use strict';var emlformat=require(_0xbf39('0x0'));var rimraf=require(_0xbf39('0x1'));var zipdir=require(_0xbf39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf39('0x3'));var moment=require(_0xbf39('0x4'));var BPromise=require(_0xbf39('0x5'));var Mustache=require(_0xbf39('0x6'));var util=require(_0xbf39('0x7'));var path=require(_0xbf39('0x8'));var sox=require('sox');var csv=require(_0xbf39('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf39('0xa'));var squel=require('squel');var crypto=require(_0xbf39('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf39('0x9'));var querystring=require(_0xbf39('0xc'));var Papa=require(_0xbf39('0xd'));var Redis=require(_0xbf39('0xe'));var authService=require(_0xbf39('0xf'));var qs=require(_0xbf39('0x10'));var as=require(_0xbf39('0x11'));var hardwareService=require(_0xbf39('0x12'));var logger=require(_0xbf39('0x13'))('api');var utils=require(_0xbf39('0x14'));var config=require(_0xbf39('0x15'));var licenseUtil=require(_0xbf39('0x16'));var db=require(_0xbf39('0x17'))['db'];config[_0xbf39('0x18')]=_['defaults'](config[_0xbf39('0x18')],{'host':_0xbf39('0x19'),'port':0x18eb});var socket=require(_0xbf39('0x1a'))(new Redis(config[_0xbf39('0x18')]));require(_0xbf39('0x1b'))[_0xbf39('0x1c')](socket);var jayson=require(_0xbf39('0x1d'));var client=jayson[_0xbf39('0x1e')][_0xbf39('0x1f')]({'port':0x232c});var client9002=jayson[_0xbf39('0x1e')][_0xbf39('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2fc734,_0xc99365,_0x43a849,_0x5ee5b1){return new BPromise(function(_0x5aa9cc,_0xb7d14){var _0x2f12f7=_0x5ee5b1||client;return _0x2f12f7[_0xbf39('0x20')](_0x2fc734,_0x43a849)[_0xbf39('0x21')](function(_0x4274d8){logger[_0xbf39('0x22')](_0xbf39('0x23'),_0xc99365,'request\x20sent');logger[_0xbf39('0x24')](_0xbf39('0x25'),_0xc99365,'request\x20sent',JSON['stringify'](_0x4274d8));if(_0x4274d8[_0xbf39('0x26')]){if(_0x4274d8[_0xbf39('0x26')]['code']===0x1f4){logger[_0xbf39('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0xc99365,_0x4274d8[_0xbf39('0x26')]['message']);return _0xb7d14(_0x4274d8[_0xbf39('0x26')][_0xbf39('0x27')]);}logger[_0xbf39('0x26')](_0xbf39('0x23'),_0xc99365,_0x4274d8[_0xbf39('0x26')][_0xbf39('0x27')]);return _0x5aa9cc(_0x4274d8[_0xbf39('0x26')][_0xbf39('0x27')]);}else{logger[_0xbf39('0x22')](_0xbf39('0x23'),_0xc99365,_0xbf39('0x28'));_0x5aa9cc(_0x4274d8['result']['message']);}})['catch'](function(_0x267037){logger[_0xbf39('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0xc99365,_0x267037);_0xb7d14(_0x267037);});});}function respondWithStatusCode(_0x13b80d,_0x45e454){_0x45e454=_0x45e454||0xcc;return function(_0x489945){if(_0x489945){return _0x13b80d['sendStatus'](_0x45e454);}return _0x13b80d['status'](_0x45e454)[_0xbf39('0x29')]();};}function respondWithResult(_0x176a85,_0x592720){_0x592720=_0x592720||0xc8;return function(_0x203f37){if(_0x203f37){return _0x176a85[_0xbf39('0x2a')](_0x592720)['json'](_0x203f37);}};}function respondWithFilteredResult(_0x29e341,_0x53bec5){return function(_0x5d08b1){if(_0x5d08b1){var _0x4104a4=typeof _0x53bec5[_0xbf39('0x2b')]===_0xbf39('0x2c')&&typeof _0x53bec5[_0xbf39('0x2d')]===_0xbf39('0x2c');var _0x305928=_0x5d08b1[_0xbf39('0x2e')];var _0x1a5767=_0x4104a4?0x0:_0x53bec5['offset'];var _0x5c2737=_0x4104a4?_0x5d08b1[_0xbf39('0x2e')]:_0x53bec5['offset']+_0x53bec5[_0xbf39('0x2d')];var _0x71ad20;if(_0x5c2737>=_0x305928){_0x5c2737=_0x305928;_0x71ad20=0xc8;}else{_0x71ad20=0xce;}_0x29e341['status'](_0x71ad20);return _0x29e341[_0xbf39('0x2f')](_0xbf39('0x30'),_0x1a5767+'-'+_0x5c2737+'/'+_0x305928)['json'](_0x5d08b1);}return null;};}function patchUpdates(_0x30431c){return function(_0x3aa0b2){try{jsonpatch[_0xbf39('0x31')](_0x3aa0b2,_0x30431c,!![]);}catch(_0x3f5bcb){return BPromise['reject'](_0x3f5bcb);}return _0x3aa0b2[_0xbf39('0x32')]();};}function saveUpdates(_0x296be5,_0x3b3bcd){return function(_0x3db9f1){if(_0x3db9f1){return _0x3db9f1[_0xbf39('0x33')](_0x296be5)[_0xbf39('0x21')](function(_0x48f306){return _0x48f306;});}return null;};}function removeEntity(_0x251a80,_0x280907){return function(_0x44e27b){if(_0x44e27b){return _0x44e27b[_0xbf39('0x34')]()[_0xbf39('0x21')](function(){var _0x1f2e18=_0x44e27b[_0xbf39('0x35')]({'plain':!![]});var _0x4c9008=_0xbf39('0x36');return db[_0xbf39('0x37')][_0xbf39('0x34')]({'where':{'type':_0x4c9008,'resourceId':_0x1f2e18['id']}})[_0xbf39('0x21')](function(){return _0x44e27b;});})[_0xbf39('0x21')](function(){_0x251a80['status'](0xcc)[_0xbf39('0x29')]();});}};}function handleEntityNotFound(_0x5efa41,_0x3e60a7){return function(_0x1ff26e){if(!_0x1ff26e){_0x5efa41['sendStatus'](0x194);}return _0x1ff26e;};}function handleError(_0x55773c,_0x22e6b8){_0x22e6b8=_0x22e6b8||0x1f4;return function(_0xa16257){logger['error'](_0xa16257[_0xbf39('0x38')]);if(_0xa16257[_0xbf39('0x39')]){delete _0xa16257[_0xbf39('0x39')];}_0x55773c[_0xbf39('0x2a')](_0x22e6b8)[_0xbf39('0x3a')](_0xa16257);};}exports[_0xbf39('0x3b')]=function(_0x19a212,_0x5e5729){var _0x332655={'include':[{'model':db['Pause'],'as':_0xbf39('0x3c')}]},_0x2bc010={},_0x263571={'count':0x0,'rows':[]};var _0x561131=_[_0xbf39('0x3d')](db[_0xbf39('0x3e')][_0xbf39('0x3f')],function(_0x22bf68){return{'name':_0x22bf68[_0xbf39('0x40')],'type':_0x22bf68['type'][_0xbf39('0x41')]};});_0x2bc010[_0xbf39('0x42')]=_[_0xbf39('0x3d')](_0x561131,_0xbf39('0x39'));_0x2bc010[_0xbf39('0x43')]=_['keys'](_0x19a212['query']);_0x2bc010[_0xbf39('0x44')]=_['intersection'](_0x2bc010[_0xbf39('0x42')],_0x2bc010[_0xbf39('0x43')]);_0x332655[_0xbf39('0x45')]=_['intersection'](_0x2bc010[_0xbf39('0x42')],qs[_0xbf39('0x46')](_0x19a212[_0xbf39('0x43')][_0xbf39('0x46')]));_0x332655['attributes']=_0x332655[_0xbf39('0x45')][_0xbf39('0x47')]?_0x332655[_0xbf39('0x45')]:_0x2bc010[_0xbf39('0x42')];if(!_0x19a212[_0xbf39('0x43')][_0xbf39('0x48')](_0xbf39('0x49'))){_0x332655['limit']=qs[_0xbf39('0x2d')](_0x19a212[_0xbf39('0x43')]['limit']);_0x332655['offset']=qs[_0xbf39('0x2b')](_0x19a212['query'][_0xbf39('0x2b')]);}_0x332655[_0xbf39('0x4a')]=qs['sort'](_0x19a212[_0xbf39('0x43')][_0xbf39('0x4b')]);_0x332655['where']=qs[_0xbf39('0x44')](_[_0xbf39('0x4c')](_0x19a212[_0xbf39('0x43')],_0x2bc010[_0xbf39('0x44')]),_0x561131);if(_0x19a212[_0xbf39('0x43')][_0xbf39('0x4d')]){_0x332655[_0xbf39('0x4e')]=_[_0xbf39('0x4f')](_0x332655[_0xbf39('0x4e')],{'$or':_[_0xbf39('0x3d')](_0x561131,function(_0xf5d65a){if(_0xf5d65a[_0xbf39('0x50')]!=='VIRTUAL'){var _0x13fc61={};_0x13fc61[_0xf5d65a['name']]={'$like':'%'+_0x19a212[_0xbf39('0x43')]['filter']+'%'};return _0x13fc61;}})});}_0x332655=_['merge']({},_0x332655,_0x19a212['options']);var _0xda4bc9={'where':_0x332655[_0xbf39('0x4e')]};return db[_0xbf39('0x3e')]['count'](_0xda4bc9)[_0xbf39('0x21')](function(_0x552868){_0x263571[_0xbf39('0x2e')]=_0x552868;if(_0x19a212[_0xbf39('0x43')][_0xbf39('0x51')]){_0x332655['include']=[{'all':!![]}];}return db[_0xbf39('0x3e')]['findAll'](_0x332655);})[_0xbf39('0x21')](function(_0x215244){_0x263571[_0xbf39('0x52')]=_0x215244;return _0x263571;})[_0xbf39('0x21')](respondWithFilteredResult(_0x5e5729,_0x332655))['catch'](handleError(_0x5e5729,null));};exports[_0xbf39('0x53')]=function(_0x2ad572,_0x5c5b3b){var _0x13fb87={'raw':![],'where':{'id':_0x2ad572['params']['id']},'include':[{'model':db['Pause'],'as':_0xbf39('0x3c')}]},_0x5989fc={};_0x5989fc['model']=_[_0xbf39('0x54')](db[_0xbf39('0x3e')][_0xbf39('0x3f')]);_0x5989fc[_0xbf39('0x43')]=_[_0xbf39('0x54')](_0x2ad572['query']);_0x5989fc[_0xbf39('0x44')]=_[_0xbf39('0x55')](_0x5989fc[_0xbf39('0x42')],_0x5989fc['query']);_0x13fb87[_0xbf39('0x45')]=_[_0xbf39('0x55')](_0x5989fc['model'],qs[_0xbf39('0x46')](_0x2ad572[_0xbf39('0x43')][_0xbf39('0x46')]));_0x13fb87[_0xbf39('0x45')]=_0x13fb87[_0xbf39('0x45')][_0xbf39('0x47')]?_0x13fb87['attributes']:_0x5989fc['model'];if(_0x2ad572['query'][_0xbf39('0x51')]){_0x13fb87[_0xbf39('0x56')]=[{'all':!![]}];}_0x13fb87=_[_0xbf39('0x4f')]({},_0x13fb87,_0x2ad572[_0xbf39('0x57')]);return db['OpenchannelAccount'][_0xbf39('0x58')](_0x13fb87)[_0xbf39('0x21')](handleEntityNotFound(_0x5c5b3b,null))[_0xbf39('0x21')](respondWithResult(_0x5c5b3b,null))[_0xbf39('0x59')](handleError(_0x5c5b3b,null));};exports[_0xbf39('0x5a')]=function(_0x15bdb2,_0x416c89){return db[_0xbf39('0x3e')][_0xbf39('0x5a')](_0x15bdb2[_0xbf39('0x5b')],{})[_0xbf39('0x21')](function(_0x2c4d9b){var _0x820fa0=_0x15bdb2[_0xbf39('0x5c')][_0xbf39('0x35')]({'plain':!![]});if(!_0x820fa0)throw new Error(_0xbf39('0x5d'));if(_0x820fa0[_0xbf39('0x5e')]===_0xbf39('0x5c')){var _0x3a0055=_0x2c4d9b[_0xbf39('0x35')]({'plain':!![]});var _0x18d14f='OpenchannelAccounts';return db[_0xbf39('0x5f')][_0xbf39('0x58')]({'where':{'name':_0x18d14f,'userProfileId':_0x820fa0[_0xbf39('0x60')]},'raw':!![]})[_0xbf39('0x21')](function(_0x4348d4){if(_0x4348d4&&_0x4348d4['autoAssociation']===0x0){return db[_0xbf39('0x37')][_0xbf39('0x5a')]({'name':_0x3a0055['name'],'resourceId':_0x3a0055['id'],'type':_0x4348d4[_0xbf39('0x39')],'sectionId':_0x4348d4['id']},{})[_0xbf39('0x21')](function(){return _0x2c4d9b;});}else{return _0x2c4d9b;}})[_0xbf39('0x59')](function(_0x4ae647){logger['error'](_0xbf39('0x61'),_0x4ae647);throw _0x4ae647;});}return _0x2c4d9b;})[_0xbf39('0x21')](respondWithResult(_0x416c89,0xc9))['catch'](handleError(_0x416c89,null));};exports[_0xbf39('0x33')]=function(_0x1cfe6a,_0x39f024){if(_0x1cfe6a['body']['id']){delete _0x1cfe6a[_0xbf39('0x5b')]['id'];}return db[_0xbf39('0x3e')][_0xbf39('0x58')]({'where':{'id':_0x1cfe6a[_0xbf39('0x62')]['id']},'include':[{'model':db[_0xbf39('0x63')],'as':_0xbf39('0x3c')}]})['then'](handleEntityNotFound(_0x39f024,null))[_0xbf39('0x21')](saveUpdates(_0x1cfe6a[_0xbf39('0x5b')],null))[_0xbf39('0x21')](respondWithResult(_0x39f024,null))[_0xbf39('0x59')](handleError(_0x39f024,null));};exports[_0xbf39('0x34')]=function(_0x1f76ed,_0x5b5a54){return db['OpenchannelAccount']['find']({'where':{'id':_0x1f76ed['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x5b5a54,null))['then'](removeEntity(_0x5b5a54,null))[_0xbf39('0x59')](handleError(_0x5b5a54,null));};exports[_0xbf39('0x64')]=function(_0x53a38a,_0x8cd425){return db[_0xbf39('0x3e')][_0xbf39('0x64')]()[_0xbf39('0x21')](respondWithResult(_0x8cd425,null))[_0xbf39('0x59')](handleError(_0x8cd425,null));};exports[_0xbf39('0x65')]=function(_0x174d13,_0x176a96,_0xa31839){if(_0x174d13[_0xbf39('0x5b')]['id']){delete _0x174d13['body']['id'];}return db[_0xbf39('0x3e')]['find']({'where':{'id':_0x174d13[_0xbf39('0x62')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x176a96,null))[_0xbf39('0x21')](function(_0x333fb3){if(_0x333fb3){_0x174d13[_0xbf39('0x5b')][_0xbf39('0x66')]=_0x333fb3['id'];return db[_0xbf39('0x67')]['create'](_0x174d13[_0xbf39('0x5b')]);}})[_0xbf39('0x21')](respondWithResult(_0x176a96,null))[_0xbf39('0x59')](handleError(_0x176a96,null));};exports[_0xbf39('0x68')]=function(_0x4d761c,_0x38e6ff,_0x21ddc2){var _0x45a825={'raw':![],'where':{}};var _0x543c70={};var _0x4335ac={'count':0x0,'rows':[]};return db[_0xbf39('0x3e')][_0xbf39('0x69')]({'where':{'id':_0x4d761c[_0xbf39('0x62')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x38e6ff,null))[_0xbf39('0x21')](function(_0x20d2a7){if(_0x20d2a7){_0x543c70[_0xbf39('0x42')]=_[_0xbf39('0x54')](db['Disposition'][_0xbf39('0x3f')]);_0x543c70[_0xbf39('0x43')]=_[_0xbf39('0x54')](_0x4d761c['query']);_0x543c70['filters']=_['intersection'](_0x543c70['model'],_0x543c70[_0xbf39('0x43')]);_0x45a825['attributes']=_[_0xbf39('0x55')](_0x543c70[_0xbf39('0x42')],qs['fields'](_0x4d761c[_0xbf39('0x43')][_0xbf39('0x46')]));_0x45a825[_0xbf39('0x45')]=_0x45a825[_0xbf39('0x45')]['length']?_0x45a825[_0xbf39('0x45')]:_0x543c70['model'];if(!_0x4d761c[_0xbf39('0x43')][_0xbf39('0x48')](_0xbf39('0x49'))){_0x45a825[_0xbf39('0x2d')]=qs[_0xbf39('0x2d')](_0x4d761c[_0xbf39('0x43')]['limit']);_0x45a825[_0xbf39('0x2b')]=qs['offset'](_0x4d761c['query'][_0xbf39('0x2b')]);}_0x45a825['order']=qs[_0xbf39('0x4b')](_0x4d761c['query'][_0xbf39('0x4b')]);_0x45a825[_0xbf39('0x4e')]=qs[_0xbf39('0x44')](_['pick'](_0x4d761c[_0xbf39('0x43')],_0x543c70[_0xbf39('0x44')]));_0x45a825['where']['OpenchannelAccountId']=_0x20d2a7['id'];if(_0x4d761c[_0xbf39('0x43')][_0xbf39('0x4d')]){_0x45a825[_0xbf39('0x4e')]=_[_0xbf39('0x4f')](_0x45a825[_0xbf39('0x4e')],{'$or':_['map'](_0x45a825[_0xbf39('0x45')],function(_0x500c27){var _0xe942a3={};_0xe942a3[_0x500c27]={'$like':'%'+_0x4d761c['query']['filter']+'%'};return _0xe942a3;})});}_0x45a825=_[_0xbf39('0x4f')]({},_0x45a825,_0x4d761c['options']);return db[_0xbf39('0x67')][_0xbf39('0x2e')]({'where':_0x45a825[_0xbf39('0x4e')]})[_0xbf39('0x21')](function(_0x3c721c){_0x4335ac['count']=_0x3c721c;if(_0x4d761c[_0xbf39('0x43')]['includeAll']){_0x45a825[_0xbf39('0x56')]=[{'all':!![]}];}return db[_0xbf39('0x67')]['findAll'](_0x45a825);})[_0xbf39('0x21')](function(_0x3f7682){_0x4335ac[_0xbf39('0x52')]=_0x3f7682;return _0x4335ac;});}})[_0xbf39('0x21')](respondWithFilteredResult(_0x38e6ff,_0x45a825))[_0xbf39('0x59')](handleError(_0x38e6ff,null));};exports['removeDispositions']=function(_0x102197,_0x25c510,_0x5c6746){return db[_0xbf39('0x3e')][_0xbf39('0x58')]({'where':{'id':_0x102197[_0xbf39('0x62')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x25c510,null))[_0xbf39('0x21')](function(_0x17172c){if(_0x17172c){return _0x17172c[_0xbf39('0x6a')](_0x102197[_0xbf39('0x43')]['ids']);}})[_0xbf39('0x21')](respondWithStatusCode(_0x25c510,null))['catch'](handleError(_0x25c510,null));};exports['addAnswer']=function(_0xf4995d,_0x5d8ef7,_0x3ef3b2){if(_0xf4995d[_0xbf39('0x5b')]['id']){delete _0xf4995d[_0xbf39('0x5b')]['id'];}return db[_0xbf39('0x3e')][_0xbf39('0x58')]({'where':{'id':_0xf4995d['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x5d8ef7,null))[_0xbf39('0x21')](function(_0x28a6ed){if(_0x28a6ed){_0xf4995d['body'][_0xbf39('0x66')]=_0x28a6ed['id'];return db['CannedAnswer'][_0xbf39('0x5a')](_0xf4995d[_0xbf39('0x5b')]);}})[_0xbf39('0x21')](respondWithResult(_0x5d8ef7,null))[_0xbf39('0x59')](handleError(_0x5d8ef7,null));};exports['getAnswers']=function(_0x5d002f,_0x18eb47,_0x2e6b2d){var _0x401b22={'raw':![],'where':{}};var _0xe70455={};var _0x1b287c={'count':0x0,'rows':[]};return db[_0xbf39('0x3e')][_0xbf39('0x69')]({'where':{'id':_0x5d002f[_0xbf39('0x62')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x18eb47,null))[_0xbf39('0x21')](function(_0x4a8154){if(_0x4a8154){_0xe70455['model']=_[_0xbf39('0x54')](db[_0xbf39('0x6b')][_0xbf39('0x3f')]);_0xe70455[_0xbf39('0x43')]=_[_0xbf39('0x54')](_0x5d002f['query']);_0xe70455[_0xbf39('0x44')]=_[_0xbf39('0x55')](_0xe70455[_0xbf39('0x42')],_0xe70455[_0xbf39('0x43')]);_0x401b22[_0xbf39('0x45')]=_[_0xbf39('0x55')](_0xe70455[_0xbf39('0x42')],qs[_0xbf39('0x46')](_0x5d002f['query'][_0xbf39('0x46')]));_0x401b22[_0xbf39('0x45')]=_0x401b22['attributes'][_0xbf39('0x47')]?_0x401b22[_0xbf39('0x45')]:_0xe70455['model'];if(!_0x5d002f['query'][_0xbf39('0x48')](_0xbf39('0x49'))){_0x401b22[_0xbf39('0x2d')]=qs[_0xbf39('0x2d')](_0x5d002f[_0xbf39('0x43')][_0xbf39('0x2d')]);_0x401b22[_0xbf39('0x2b')]=qs['offset'](_0x5d002f['query'][_0xbf39('0x2b')]);}_0x401b22['order']=qs[_0xbf39('0x4b')](_0x5d002f[_0xbf39('0x43')]['sort']);_0x401b22[_0xbf39('0x4e')]=qs['filters'](_['pick'](_0x5d002f['query'],_0xe70455['filters']));_0x401b22[_0xbf39('0x4e')][_0xbf39('0x66')]=_0x4a8154['id'];if(_0x5d002f['query'][_0xbf39('0x4d')]){_0x401b22[_0xbf39('0x4e')]=_[_0xbf39('0x4f')](_0x401b22['where'],{'$or':_[_0xbf39('0x3d')](_0x401b22['attributes'],function(_0x59b49e){var _0xee4951={};_0xee4951[_0x59b49e]={'$like':'%'+_0x5d002f[_0xbf39('0x43')][_0xbf39('0x4d')]+'%'};return _0xee4951;})});}_0x401b22=_['merge']({},_0x401b22,_0x5d002f[_0xbf39('0x57')]);return db[_0xbf39('0x6b')][_0xbf39('0x2e')]({'where':_0x401b22[_0xbf39('0x4e')]})[_0xbf39('0x21')](function(_0x2ce58b){_0x1b287c[_0xbf39('0x2e')]=_0x2ce58b;if(_0x5d002f[_0xbf39('0x43')][_0xbf39('0x51')]){_0x401b22[_0xbf39('0x56')]=[{'all':!![]}];}return db[_0xbf39('0x6b')][_0xbf39('0x6c')](_0x401b22);})[_0xbf39('0x21')](function(_0x5e240b){_0x1b287c[_0xbf39('0x52')]=_0x5e240b;return _0x1b287c;});}})[_0xbf39('0x21')](respondWithFilteredResult(_0x18eb47,_0x401b22))[_0xbf39('0x59')](handleError(_0x18eb47,null));};exports[_0xbf39('0x6d')]=function(_0x440fb4,_0xb95e71,_0x4331df){return db[_0xbf39('0x3e')][_0xbf39('0x58')]({'where':{'id':_0x440fb4[_0xbf39('0x62')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0xb95e71,null))[_0xbf39('0x21')](function(_0xb4fa7d){if(_0xb4fa7d){return _0xb4fa7d['removeAnswers'](_0x440fb4[_0xbf39('0x43')]['ids']);}})[_0xbf39('0x21')](respondWithStatusCode(_0xb95e71,null))['catch'](handleError(_0xb95e71,null));};exports[_0xbf39('0x6e')]=function(_0x3cfaba,_0x3af531,_0x10b26f){var _0x739bb3={'body':_0x3cfaba['body'],'channel':_0xbf39('0x6f')};var _0x29b5bb=[];var _0x10d681=[];var _0x521acc={};var _0x38361a=![];return db[_0xbf39('0x70')]['describe']()['then'](function(_0x34c524){if(!_0x34c524){throw new db[(_0xbf39('0x71'))][(_0xbf39('0x72'))]('no\x20available\x20attributes');}_0x29b5bb=_[_0xbf39('0x73')](_[_0xbf39('0x54')](_0x34c524),[_0xbf39('0x74'),_0xbf39('0x75')]);_0x10d681=_[_0xbf39('0x73')](_['keys'](_0x34c524),[_0xbf39('0x74'),'updatedAt','CompanyId',_0xbf39('0x76')]);if(_0x3cfaba[_0xbf39('0x5b')]['id']){delete _0x3cfaba['body']['id'];}if(_['isNil'](_0x3cfaba['body'][_0xbf39('0x77')])){throw new db[(_0xbf39('0x71'))][(_0xbf39('0x72'))](_0xbf39('0x78'));}if(_['isNil'](_0x3cfaba['body'][_0xbf39('0x5b')])||_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x5b')]===''){throw new db[(_0xbf39('0x71'))][(_0xbf39('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbf39('0x79')](_0x3cfaba[_0xbf39('0x5b')]['mapKey'])){throw new db[(_0xbf39('0x71'))]['ValidationError'](_0xbf39('0x7a')+_0x10d681);}if(!_['includes'](_0x10d681,_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x7b')])){throw new db[(_0xbf39('0x71'))][(_0xbf39('0x72'))](_0xbf39('0x7c')+_0x10d681);}_0x521acc[_0x3cfaba['body'][_0xbf39('0x7b')]]=_0x3cfaba['body'][_0xbf39('0x77')];})['then'](function(){return db[_0xbf39('0x3e')][_0xbf39('0x58')]({'where':{'id':_0x3cfaba[_0xbf39('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0xbf39('0x7d'),'include':[{'model':db[_0xbf39('0x70')],'as':'Contacts','where':_0x521acc,'limit':0x1,'order':[[_0xbf39('0x75'),'DESC']]}]},{'model':db[_0xbf39('0x7e')],'as':'Applications'}]});})[_0xbf39('0x21')](handleEntityNotFound(_0x3af531,null))[_0xbf39('0x21')](function(_0x45d46e){if(_0x45d46e&&_0x45d46e['List']){_0x739bb3[_0xbf39('0x7f')]=_0x45d46e;_0x739bb3['applications']=_0x45d46e['Applications'];_0x739bb3[_0xbf39('0x80')]=_0x45d46e['List'];_0x739bb3[_0xbf39('0x81')]=_[_0xbf39('0x82')](_0x739bb3[_0xbf39('0x81')],[_0xbf39('0x83')],[_0xbf39('0x84')]);if(_0x739bb3[_0xbf39('0x7f')][_0xbf39('0x85')]){delete _0x739bb3[_0xbf39('0x7f')][_0xbf39('0x85')];}if(_0x739bb3[_0xbf39('0x7f')][_0xbf39('0x7d')]&&_0x739bb3[_0xbf39('0x7f')][_0xbf39('0x7d')][_0xbf39('0x86')][_0xbf39('0x47')]){return _0x739bb3[_0xbf39('0x7f')]['List'][_0xbf39('0x86')][0x0];}var _0x346774=_[_0xbf39('0x87')](_0x3cfaba[_0xbf39('0x5b')],{'firstName':_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x77')],'ListId':_0x45d46e['ListId']});_0x346774[_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x7b')]]=_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x77')];return db[_0xbf39('0x70')][_0xbf39('0x5a')](_0x346774,{'fields':_0x29b5bb,'raw':!![]});}})[_0xbf39('0x21')](handleEntityNotFound(_0x3af531,null))[_0xbf39('0x21')](function(_0x2b9e4e){_0x739bb3[_0xbf39('0x88')]=_0x2b9e4e;if(_0x2b9e4e){var _0x3eb3cb={'ContactId':_0x2b9e4e['id'],'OpenchannelAccountId':_0x3cfaba['params']['id'],'from':(_0x2b9e4e['firstName']||'')+'\x20'+(_0x2b9e4e[_0xbf39('0x89')]||'')};var _0x33b0be={'OpenchannelAccountId':_0x3cfaba['params']['id'],'closed':![]};if(_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x8a')]){_0x33b0be[_0xbf39('0x8a')]=_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x8a')];return db[_0xbf39('0x8b')][_0xbf39('0x58')]({'where':_0x33b0be})[_0xbf39('0x21')](function(_0x42157f){if(_0x42157f){return[_0x42157f,![]];}_0x3eb3cb['threadId']=_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x8a')];_0x3eb3cb[_0xbf39('0x8c')]=_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x8c')];return db['OpenchannelInteraction']['create'](_0x3eb3cb)[_0xbf39('0x21')](function(_0x1d2fd3){return[_0x1d2fd3,!![]];});});}else{_0x33b0be['threadId']=null;}_0x33b0be[_0xbf39('0x8d')]=_0x2b9e4e['id'];return db[_0xbf39('0x8b')]['find']({'where':_0x33b0be})[_0xbf39('0x21')](function(_0x30e4e8){if(_0x30e4e8){return[_0x30e4e8,![]];}return db[_0xbf39('0x8b')]['create'](_0x3eb3cb)['then'](function(_0x21bc0e){return[_0x21bc0e,!![]];});});}})['spread'](function(_0x526a69,_0x523da1){if(_0x526a69){_0x38361a=_0x523da1;if(!_0x523da1){var _0xa75284={'from':(_0x739bb3[_0xbf39('0x88')][_0xbf39('0x8e')]||'')+'\x20'+(_0x739bb3[_0xbf39('0x88')][_0xbf39('0x89')]||'')};if(_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x8a')]&&_0x3cfaba['body']['messageId']&&_0x3cfaba['body']['threadId']!=_0x3cfaba['body'][_0xbf39('0x8f')]){_0xa75284[_0xbf39('0x8a')]=_0x3cfaba['body']['messageId'];}return _0x526a69[_0xbf39('0x33')](_0xa75284);}else{return _0x526a69;}}})[_0xbf39('0x21')](function(_0x43dc3e){_0x739bb3[_0xbf39('0x90')]=_0x43dc3e[_0xbf39('0x35')]({'plain':!![]});_0x739bb3[_0xbf39('0x90')]['created']=_0x38361a;if(_0x739bb3[_0xbf39('0x90')][_0xbf39('0x91')]){if(_0x739bb3[_0xbf39('0x7f')]['autoclose']){_0x739bb3['applications']['push']({'id':0x0,'priority':_0x739bb3[_0xbf39('0x81')]['length']+0x1,'app':_0xbf39('0x92'),'appdata':_0xbf39('0x93'),'interval':_0xbf39('0x94')});}}return db[_0xbf39('0x95')][_0xbf39('0x5a')]({'body':_0x3cfaba['body'][_0xbf39('0x5b')],'OpenchannelAccountId':_0x3cfaba['params']['id'],'OpenchannelInteractionId':_0x43dc3e['id'],'direction':'in','ContactId':_0x739bb3[_0xbf39('0x88')]['id'],'AttachmentId':_0x3cfaba[_0xbf39('0x5b')][_0xbf39('0x96')]});})['then'](function(_0x44e296){_0x739bb3[_0xbf39('0x27')]=_0x44e296;if(_0x739bb3['interaction'][_0xbf39('0x97')]){return db[_0xbf39('0x98')][_0xbf39('0x58')]({'attributes':['id',_0xbf39('0x39')],'where':{'id':_0x739bb3[_0xbf39('0x90')]['UserId']}})['then'](function(_0x2fe912){if(_0x2fe912){_0x739bb3[_0xbf39('0x81')][_0xbf39('0x99')]({'id':0x0,'priority':0x0,'app':_0xbf39('0x9a'),'appdata':_0x2fe912['name']+','+(_0x739bb3[_0xbf39('0x7f')][_0xbf39('0x9b')]||0xa),'interval':'*,*,*,*'});_0x739bb3[_0xbf39('0x9c')]=![];}return respondWithRpcPromise(_0xbf39('0x9d'),_0xbf39('0x9e'),_0x739bb3);});}return respondWithRpcPromise('Start','startRouting',_0x739bb3);})[_0xbf39('0x21')](function(_0x51b7b6){respondWithRpcPromise('EventManager',_0xbf39('0x9f'),{'event':_0xbf39('0x6e'),'message':_0x51b7b6},client9002);return _0x51b7b6;})[_0xbf39('0x21')](respondWithResult(_0x3af531,null))[_0xbf39('0x59')](handleError(_0x3af531,null));};exports[_0xbf39('0xa0')]=function(_0x33d78e,_0xbf1027){var _0x293494=_0x33d78e[_0xbf39('0x62')]['id'];var _0x17d12c=_0x33d78e[_0xbf39('0x5b')];var _0x394ba7=0xc8;var _0x8e534d=null;return db[_0xbf39('0xa1')][_0xbf39('0xa2')]({'isolationLevel':db[_0xbf39('0xa1')][_0xbf39('0xa3')][_0xbf39('0xa4')][_0xbf39('0xa5')]},function(_0x2c8edb){return db[_0xbf39('0x3e')][_0xbf39('0x69')]({'where':{'id':_0x293494},'transaction':_0x2c8edb})[_0xbf39('0x21')](function(_0x20f235){if(_0x20f235){return db[_0xbf39('0x7e')][_0xbf39('0x34')]({'where':{'OpenchannelAccountId':_0x293494},'transaction':_0x2c8edb})['then'](function(){var _0x3d42f2=_['map'](_0x17d12c,function(_0x4cfc58){_0x4cfc58['OpenchannelAccountId']=_0x293494;return _0x4cfc58;});return db[_0xbf39('0x7e')][_0xbf39('0xa6')](_0x3d42f2,{'transaction':_0x2c8edb});});}else{_0x394ba7=0x194;_0x8e534d=[];}});})[_0xbf39('0x21')](function(){if(_0x394ba7!==0x194){return db[_0xbf39('0x7e')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x293494},'order':_0xbf39('0x83')})['then'](function(_0x41d6f5){_0x8e534d=_0x41d6f5;});}})['catch'](function(_0x70beff){_0x394ba7=0x1f4;logger[_0xbf39('0x26')](_0x70beff[_0xbf39('0x38')]);if(_0x70beff[_0xbf39('0x39')]){delete _0x70beff[_0xbf39('0x39')];}_0x8e534d=_0x70beff;})[_0xbf39('0xa7')](function(){if(_0x8e534d===null){_0xbf1027[_0xbf39('0xa8')](_0x394ba7);}else{if(_0x394ba7===0x1f4){_0xbf1027[_0xbf39('0x2a')](_0x394ba7)['send'](_0x8e534d);}else{_0xbf1027[_0xbf39('0x2a')](_0x394ba7)[_0xbf39('0xa9')](_0x8e534d);}}});};exports['getApplications']=function(_0x328c4c,_0x10aeb6,_0x54e8f8){var _0x3ae6d4={};var _0x18d64f={};var _0x1e88ff;var _0x51a130;return db[_0xbf39('0x3e')][_0xbf39('0x69')]({'where':{'id':_0x328c4c['params']['id']}})['then'](handleEntityNotFound(_0x10aeb6,null))[_0xbf39('0x21')](function(_0x483146){if(_0x483146){_0x1e88ff=_0x483146;_0x18d64f['model']=_[_0xbf39('0x54')](db['OpenchannelApplication'][_0xbf39('0x3f')]);_0x18d64f['query']=_[_0xbf39('0x54')](_0x328c4c[_0xbf39('0x43')]);_0x18d64f[_0xbf39('0x44')]=_[_0xbf39('0x55')](_0x18d64f[_0xbf39('0x42')],_0x18d64f['query']);_0x3ae6d4['attributes']=_[_0xbf39('0x55')](_0x18d64f[_0xbf39('0x42')],qs[_0xbf39('0x46')](_0x328c4c[_0xbf39('0x43')]['fields']));_0x3ae6d4[_0xbf39('0x45')]=_0x3ae6d4[_0xbf39('0x45')]['length']?_0x3ae6d4['attributes']:_0x18d64f[_0xbf39('0x42')];_0x3ae6d4[_0xbf39('0x4a')]=qs['sort'](_0x328c4c[_0xbf39('0x43')]['sort']);_0x3ae6d4[_0xbf39('0x4e')]=qs[_0xbf39('0x44')](_[_0xbf39('0x4c')](_0x328c4c[_0xbf39('0x43')],_0x18d64f[_0xbf39('0x44')]));if(_0x328c4c['query']['filter']){_0x3ae6d4['where']=_[_0xbf39('0x4f')](_0x3ae6d4['where'],{'$or':_[_0xbf39('0x3d')](_0x3ae6d4[_0xbf39('0x45')],function(_0x2430fd){var _0x2fa98c={};_0x2fa98c[_0x2430fd]={'$like':'%'+_0x328c4c[_0xbf39('0x43')][_0xbf39('0x4d')]+'%'};return _0x2fa98c;})});}_0x3ae6d4=_[_0xbf39('0x4f')]({},_0x3ae6d4,_0x328c4c[_0xbf39('0x57')]);return _0x1e88ff[_0xbf39('0xaa')](_0x3ae6d4);}})[_0xbf39('0x21')](function(_0x1182eb){if(_0x1182eb){_0x51a130=_0x1182eb[_0xbf39('0x47')];if(!_0x328c4c[_0xbf39('0x43')]['hasOwnProperty'](_0xbf39('0x49'))){_0x3ae6d4[_0xbf39('0x2d')]=qs[_0xbf39('0x2d')](_0x328c4c['query'][_0xbf39('0x2d')]);_0x3ae6d4[_0xbf39('0x2b')]=qs[_0xbf39('0x2b')](_0x328c4c['query'][_0xbf39('0x2b')]);}return _0x1e88ff['getApplications'](_0x3ae6d4);}})['then'](function(_0x1ba536){if(_0x1ba536){return _0x1ba536?{'count':_0x51a130,'rows':_0x1ba536}:null;}})['then'](respondWithResult(_0x10aeb6,null))[_0xbf39('0x59')](handleError(_0x10aeb6,null));};exports[_0xbf39('0xab')]=function(_0x37fde0,_0x3d388a,_0x2a306d){var _0x4c2de6={'raw':![],'where':{}};var _0x18c21b={};var _0x4c5b5f={'count':0x0,'rows':[]};return db[_0xbf39('0x3e')][_0xbf39('0x69')]({'where':{'id':_0x37fde0[_0xbf39('0x62')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x3d388a,null))[_0xbf39('0x21')](function(_0x25d7bc){if(_0x25d7bc){_0x18c21b[_0xbf39('0x42')]=_[_0xbf39('0x54')](db[_0xbf39('0x8b')][_0xbf39('0x3f')]);_0x18c21b[_0xbf39('0x43')]=_['keys'](_0x37fde0[_0xbf39('0x43')]);_0x18c21b[_0xbf39('0x44')]=_[_0xbf39('0x55')](_0x18c21b[_0xbf39('0x42')],_0x18c21b[_0xbf39('0x43')]);_0x4c2de6[_0xbf39('0x45')]=_[_0xbf39('0x55')](_0x18c21b[_0xbf39('0x42')],qs['fields'](_0x37fde0[_0xbf39('0x43')][_0xbf39('0x46')]));_0x4c2de6[_0xbf39('0x45')]=_0x4c2de6[_0xbf39('0x45')][_0xbf39('0x47')]?_0x4c2de6[_0xbf39('0x45')]:_0x18c21b['model'];if(!_0x37fde0['query']['hasOwnProperty'](_0xbf39('0x49'))){_0x4c2de6[_0xbf39('0x2d')]=qs[_0xbf39('0x2d')](_0x37fde0[_0xbf39('0x43')][_0xbf39('0x2d')]);_0x4c2de6[_0xbf39('0x2b')]=qs[_0xbf39('0x2b')](_0x37fde0['query'][_0xbf39('0x2b')]);}_0x4c2de6[_0xbf39('0x4a')]=qs[_0xbf39('0x4b')](_0x37fde0[_0xbf39('0x43')]['sort']);_0x4c2de6[_0xbf39('0x4e')]=qs[_0xbf39('0x44')](_[_0xbf39('0x4c')](_0x37fde0[_0xbf39('0x43')],_0x18c21b['filters']));_0x4c2de6[_0xbf39('0x4e')]['OpenchannelAccountId']=_0x25d7bc['id'];if(_0x37fde0['query'][_0xbf39('0x4d')]){_0x4c2de6[_0xbf39('0x4e')]=_[_0xbf39('0x4f')](_0x4c2de6['where'],{'$or':_['map'](_0x4c2de6[_0xbf39('0x45')],function(_0x1af19c){var _0x3580a9={};_0x3580a9[_0x1af19c]={'$like':'%'+_0x37fde0[_0xbf39('0x43')][_0xbf39('0x4d')]+'%'};return _0x3580a9;})});}_0x4c2de6=_[_0xbf39('0x4f')]({},_0x4c2de6,_0x37fde0[_0xbf39('0x57')]);return db['OpenchannelInteraction'][_0xbf39('0x2e')]({'where':_0x4c2de6[_0xbf39('0x4e')]})[_0xbf39('0x21')](function(_0x567171){_0x4c5b5f['count']=_0x567171;if(_0x37fde0['query'][_0xbf39('0x51')]){_0x4c2de6['include']=[{'model':db[_0xbf39('0x70')],'as':_0xbf39('0xac'),'required':![]},{'model':db[_0xbf39('0x98')],'as':_0xbf39('0xad'),'attributes':[_0xbf39('0x39'),_0xbf39('0xae'),'internal'],'required':![]},{'model':db[_0xbf39('0xaf')],'as':'Tags','attributes':['id','name',_0xbf39('0xb0')],'where':_0x37fde0[_0xbf39('0x43')][_0xbf39('0xb1')]?{'id':_0x37fde0[_0xbf39('0x43')][_0xbf39('0xb1')]}:undefined,'required':_0x37fde0['query'][_0xbf39('0xb1')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xbf39('0x6c')](_0x4c2de6);})[_0xbf39('0x21')](function(_0x17d6f2){_0x4c5b5f['rows']=_0x17d6f2;return _0x4c5b5f;});}})[_0xbf39('0x21')](respondWithFilteredResult(_0x3d388a,_0x4c2de6))['catch'](handleError(_0x3d388a,null));};exports['addAgents']=function(_0x35abe1,_0x2a2eb1,_0x12b20d){return db['OpenchannelAccount'][_0xbf39('0x58')]({'where':{'id':_0x35abe1['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x2a2eb1,null))[_0xbf39('0x21')](function(_0x47fe44){if(_0x47fe44){return _0x47fe44[_0xbf39('0xb2')](_0x35abe1[_0xbf39('0x5b')][_0xbf39('0xb3')],_[_0xbf39('0xb4')](_0x35abe1['body'],[_0xbf39('0xb3'),'id'])||{})[_0xbf39('0xb5')](function(_0x590116){for(var _0x22eab3=0x0;_0x22eab3<_0x35abe1[_0xbf39('0x5b')]['ids']['length'];_0x22eab3+=0x1){socket[_0xbf39('0xb6')]('userOpenchannelAccount:save',{'UserId':Number(_0x35abe1['body'][_0xbf39('0xb3')][_0x22eab3]),'OpenchannelAccountId':Number(_0x35abe1['params']['id'])});}return _0x590116;});}})[_0xbf39('0x21')](respondWithResult(_0x2a2eb1,null))[_0xbf39('0x59')](handleError(_0x2a2eb1,null));};exports[_0xbf39('0xb7')]=function(_0x2f1c03,_0x1618d9,_0x567289){return db['OpenchannelAccount']['find']({'where':{'id':_0x2f1c03['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x1618d9,null))['then'](function(_0x217d04){if(_0x217d04){return _0x217d04[_0xbf39('0xb7')](_0x2f1c03['query'][_0xbf39('0xb3')])[_0xbf39('0x21')](function(){if(_['isArray'](_0x2f1c03[_0xbf39('0x43')][_0xbf39('0xb3')])){for(var _0x38eeb2=0x0;_0x38eeb2<_0x2f1c03['query']['ids'][_0xbf39('0x47')];_0x38eeb2+=0x1){socket[_0xbf39('0xb6')](_0xbf39('0xb8'),{'UserId':Number(_0x2f1c03[_0xbf39('0x43')][_0xbf39('0xb3')][_0x38eeb2]),'OpenchannelAccountId':Number(_0x2f1c03[_0xbf39('0x62')]['id'])});}}else{socket[_0xbf39('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2f1c03[_0xbf39('0x43')][_0xbf39('0xb3')]),'OpenchannelAccountId':Number(_0x2f1c03[_0xbf39('0x62')]['id'])});}});}})[_0xbf39('0x21')](respondWithStatusCode(_0x1618d9,null))[_0xbf39('0x59')](handleError(_0x1618d9,null));};exports['getAgents']=function(_0x461fe9,_0x5457ce,_0xd4074f){var _0x5499d2={};var _0x7f1399={};var _0x1ae9e7;var _0x3da5b5;return db[_0xbf39('0x3e')][_0xbf39('0x69')]({'where':{'id':_0x461fe9['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x5457ce,null))[_0xbf39('0x21')](function(_0x470f2f){if(_0x470f2f){_0x1ae9e7=_0x470f2f;_0x7f1399['model']=_[_0xbf39('0x54')](db[_0xbf39('0x98')][_0xbf39('0x3f')]);_0x7f1399[_0xbf39('0x43')]=_[_0xbf39('0x54')](_0x461fe9[_0xbf39('0x43')]);_0x7f1399[_0xbf39('0x44')]=_[_0xbf39('0x55')](_0x7f1399[_0xbf39('0x42')],_0x7f1399[_0xbf39('0x43')]);_0x5499d2[_0xbf39('0x45')]=_['intersection'](_0x7f1399[_0xbf39('0x42')],qs['fields'](_0x461fe9[_0xbf39('0x43')][_0xbf39('0x46')]));_0x5499d2[_0xbf39('0x45')]=_0x5499d2['attributes'][_0xbf39('0x47')]?_0x5499d2[_0xbf39('0x45')]:_0x7f1399[_0xbf39('0x42')];_0x5499d2['order']=qs[_0xbf39('0x4b')](_0x461fe9['query'][_0xbf39('0x4b')]);_0x5499d2['where']=qs['filters'](_[_0xbf39('0x4c')](_0x461fe9[_0xbf39('0x43')],_0x7f1399[_0xbf39('0x44')]));if(_0x461fe9[_0xbf39('0x43')][_0xbf39('0x4d')]){_0x5499d2[_0xbf39('0x4e')]=_['merge'](_0x5499d2[_0xbf39('0x4e')],{'$or':_[_0xbf39('0x3d')](_0x5499d2[_0xbf39('0x45')],function(_0x410eb0){var _0xe51229={};_0xe51229[_0x410eb0]={'$like':'%'+_0x461fe9[_0xbf39('0x43')]['filter']+'%'};return _0xe51229;})});}_0x5499d2=_[_0xbf39('0x4f')]({},_0x5499d2,_0x461fe9[_0xbf39('0x57')]);return _0x1ae9e7['getAgents'](_0x5499d2);}})[_0xbf39('0x21')](function(_0x26c09f){if(_0x26c09f){_0x3da5b5=_0x26c09f['length'];if(!_0x461fe9[_0xbf39('0x43')]['hasOwnProperty']('nolimit')){_0x5499d2[_0xbf39('0x2d')]=qs['limit'](_0x461fe9[_0xbf39('0x43')]['limit']);_0x5499d2[_0xbf39('0x2b')]=qs['offset'](_0x461fe9['query'][_0xbf39('0x2b')]);}return _0x1ae9e7[_0xbf39('0xb9')](_0x5499d2);}})['then'](function(_0x484283){if(_0x484283){return _0x484283?{'count':_0x3da5b5,'rows':_0x484283}:null;}})[_0xbf39('0x21')](respondWithResult(_0x5457ce,null))[_0xbf39('0x59')](handleError(_0x5457ce,null));};exports[_0xbf39('0x3a')]=function(_0x42516b,_0x331a8d,_0x52f4a5){var _0x2a9946,_0x3e09f7,_0x2b74e5;if(_[_0xbf39('0x79')](_0x42516b[_0xbf39('0x5b')][_0xbf39('0x5b')])||_0x42516b['body'][_0xbf39('0x5b')]===''){throw new db[(_0xbf39('0x71'))][(_0xbf39('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbf39('0x79')](_0x42516b[_0xbf39('0x5b')]['to'])){}_0x2a9946=_0x42516b[_0xbf39('0x5b')]['to'];return db['OpenchannelAccount'][_0xbf39('0x69')]({'where':{'id':_0x42516b[_0xbf39('0x62')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x331a8d,null))[_0xbf39('0x21')](function(_0x19ed70){if(_0x19ed70){return db[_0xbf39('0x3e')][_0xbf39('0x58')]({'where':{'id':_0x19ed70['id']},'include':[{'model':db[_0xbf39('0xba')],'as':'List','include':[{'model':db[_0xbf39('0x70')],'as':'Contacts','where':{[_0x19ed70[_0xbf39('0x7b')]]:_0x2a9946},'limit':0x1,'order':[[_0xbf39('0x75'),_0xbf39('0xbb')]]}]}]})[_0xbf39('0x21')](handleEntityNotFound(_0x331a8d,null))['then'](function(_0x5741be){if(_0x5741be&&_0x5741be[_0xbf39('0x7d')]){_0x3e09f7=_0x5741be[_0xbf39('0x35')]({'plain':!![]});if(_0x3e09f7['List']&&_0x3e09f7[_0xbf39('0x7d')][_0xbf39('0x86')][_0xbf39('0x47')]){return _0x3e09f7[_0xbf39('0x7d')][_0xbf39('0x86')][0x0];}return db[_0xbf39('0x70')][_0xbf39('0x5a')](_[_0xbf39('0x87')](_0x42516b[_0xbf39('0x5b')],{'firstName':_0x2a9946,[_0x5741be[_0xbf39('0x7b')]]:_0x2a9946,'phone':_0x2a9946,'ListId':_0x3e09f7['ListId']}));}})[_0xbf39('0x21')](handleEntityNotFound(_0x331a8d,null))[_0xbf39('0x21')](function(_0x1d74c9){if(_0x1d74c9){_0x2b74e5=_0x1d74c9;return db[_0xbf39('0x8b')]['find']({'where':{'ContactId':_0x2b74e5['id'],'closed':![],'OpenchannelAccountId':_0x3e09f7['id']}})[_0xbf39('0x21')](function(_0x5eacc8){if(_0x5eacc8){return[_0x5eacc8,![]];}return db[_0xbf39('0x8b')][_0xbf39('0x5a')]({'UserId':_0x42516b[_0xbf39('0x5c')]['id'],'ContactId':_0x2b74e5['id'],'OpenchannelAccountId':_0x3e09f7['id'],'lastMsgDirection':_0xbf39('0xbc'),'firstMsgDirection':_0xbf39('0xbc'),'Messages':[_[_0xbf39('0x4f')](_0x42516b['body'],{'read':![],'body':_0x42516b[_0xbf39('0x5b')]['body'],'OpenchannelAccountId':_0x3e09f7['id'],'UserId':_0x42516b[_0xbf39('0x5c')]['id'],'ContactId':_0x2b74e5['id']})]},{'include':[{'model':db[_0xbf39('0x95')],'as':'Messages'}]})[_0xbf39('0x21')](function(_0x5b3abb){return[_0x5b3abb,!![]];});});}})['spread'](function(_0x5d61fb,_0x5fb04e){if(_0x5fb04e){return _0x5d61fb;}return db[_0xbf39('0x95')]['create'](_[_0xbf39('0x4f')](_0x42516b[_0xbf39('0x5b')],{'read':![],'body':_0x42516b['body']['body'],'OpenchannelAccountId':_0x3e09f7['id'],'OpenchannelInteractionId':_0x5d61fb['id'],'UserId':_0x42516b[_0xbf39('0x5c')]['id'],'ContactId':_0x2b74e5['id']}))['then'](function(_0xcf57c0){_0x5d61fb[_0xbf39('0xbd')][_0xbf39('0xbe')]=[];_0x5d61fb['dataValues'][_0xbf39('0xbe')][_0xbf39('0xbf')](_0xcf57c0['dataValues']);return _0x5d61fb;});});}})[_0xbf39('0x21')](respondWithResult(_0x331a8d,null))[_0xbf39('0x59')](handleError(_0x331a8d,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a839df8..bb33254 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 _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb903,0x185));var _0x3b90=function(_0x4b7bc6,_0xd2fcb2){_0x4b7bc6=_0x4b7bc6-0x0;var _0x476970=_0xb903[_0x4b7bc6];return _0x476970;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x2d4c36,_0x52ab5f){var _0x100f8f=function(_0x137a08){while(--_0x137a08){_0x2d4c36['push'](_0x2d4c36['shift']());}};_0x100f8f(++_0x52ab5f);}(_0x1be1,0x192));var _0x11be=function(_0x35bf15,_0x18256a){_0x35bf15=_0x35bf15-0x0;var _0x19f4fe=_0x1be1[_0x35bf15];return _0x19f4fe;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8a2796e..88588ec 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(_0xd517d,_0x49b471){var _0x29e362=function(_0x585e43){while(--_0x585e43){_0xd517d['push'](_0xd517d['shift']());}};_0x29e362(++_0x49b471);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x5408b6,_0x48c3bb){var _0x3308ad=function(_0x542cf6){while(--_0x542cf6){_0x5408b6['push'](_0x5408b6['shift']());}};_0x3308ad(++_0x48c3bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 2bb3621..3968be3 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request'];(function(_0x1bc874,_0x608847){var _0x2f255d=function(_0x387627){while(--_0x387627){_0x1bc874['push'](_0x1bc874['shift']());}};_0x2f255d(++_0x608847);}(_0x9c00,0x1a0));var _0x09c0=function(_0x382a1c,_0x99b604){_0x382a1c=_0x382a1c-0x0;var _0x5f517d=_0x9c00[_0x382a1c];return _0x5f517d;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x09c0('0x9')]=_[_0x09c0('0xa')](config[_0x09c0('0x9')],{'host':_0x09c0('0xb'),'port':0x18eb});var socket=require(_0x09c0('0xc'))(new Redis(config['redis']));require(_0x09c0('0xd'))[_0x09c0('0xe')](socket);function respondWithRpcPromise(_0xa20b5c,_0x1feb1d,_0x27a33c){return new BPromise(function(_0x1e16f4,_0x1fec4f){return client[_0x09c0('0xf')](_0xa20b5c,_0x27a33c)[_0x09c0('0x10')](function(_0x4523ea){logger[_0x09c0('0x11')](_0x09c0('0x12'),_0x1feb1d,_0x09c0('0x13'));logger[_0x09c0('0x14')](_0x09c0('0x15'),_0x1feb1d,_0x09c0('0x13'),JSON[_0x09c0('0x16')](_0x4523ea));if(_0x4523ea[_0x09c0('0x17')]){if(_0x4523ea[_0x09c0('0x17')][_0x09c0('0x18')]===0x1f4){logger[_0x09c0('0x17')](_0x09c0('0x12'),_0x1feb1d,_0x4523ea[_0x09c0('0x17')][_0x09c0('0x19')]);return _0x1fec4f(_0x4523ea[_0x09c0('0x17')][_0x09c0('0x19')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1feb1d,_0x4523ea['error'][_0x09c0('0x19')]);return _0x1e16f4(_0x4523ea[_0x09c0('0x17')][_0x09c0('0x19')]);}else{logger[_0x09c0('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x1feb1d,_0x09c0('0x13'));_0x1e16f4(_0x4523ea['result']['message']);}})[_0x09c0('0x1a')](function(_0x50fccc){logger[_0x09c0('0x17')](_0x09c0('0x12'),_0x1feb1d,_0x50fccc);_0x1fec4f(_0x50fccc);});});} \ No newline at end of file +var _0xd139=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','register','request','then','request\x20sent'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0xd139,0x14e));var _0x9d13=function(_0x28018b,_0x185648){_0x28018b=_0x28018b-0x0;var _0x5d65a4=_0xd139[_0x28018b];return _0x5d65a4;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x2'));var fs=require('fs');var Redis=require(_0x9d13('0x3'));var db=require(_0x9d13('0x4'))['db'];var utils=require(_0x9d13('0x5'));var logger=require(_0x9d13('0x6'))(_0x9d13('0x7'));var config=require(_0x9d13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d13('0x9')][_0x9d13('0xa')]({'port':0x232a});config['redis']=_[_0x9d13('0xb')](config['redis'],{'host':_0x9d13('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x9d13('0xd')](socket);function respondWithRpcPromise(_0xba5caa,_0x41eef2,_0x51ac36){return new BPromise(function(_0x135232,_0x5aa0c8){return client[_0x9d13('0xe')](_0xba5caa,_0x51ac36)[_0x9d13('0xf')](function(_0x43a3cc){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x41eef2,_0x9d13('0x10'));logger[_0x9d13('0x11')](_0x9d13('0x12'),_0x41eef2,_0x9d13('0x10'),JSON[_0x9d13('0x13')](_0x43a3cc));if(_0x43a3cc['error']){if(_0x43a3cc['error'][_0x9d13('0x14')]===0x1f4){logger[_0x9d13('0x15')](_0x9d13('0x16'),_0x41eef2,_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);return _0x5aa0c8(_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);}logger['error'](_0x9d13('0x16'),_0x41eef2,_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);return _0x135232(_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);}else{logger[_0x9d13('0x18')](_0x9d13('0x16'),_0x41eef2,_0x9d13('0x10'));_0x135232(_0x43a3cc[_0x9d13('0x19')][_0x9d13('0x17')]);}})[_0x9d13('0x1a')](function(_0x38acaf){logger[_0x9d13('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x41eef2,_0x38acaf);_0x5aa0c8(_0x38acaf);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8e1b258..c0e06b4 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 _0xab3a=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xab3a,0x1d3));var _0xaab3=function(_0x88a98e,_0x56668b){_0x88a98e=_0x88a98e-0x0;var _0x23eede=_0xab3a[_0x88a98e];return _0x23eede;};'use strict';var OpenchannelAccountEvents=require(_0xaab3('0x0'));var events=[_0xaab3('0x1'),_0xaab3('0x2'),_0xaab3('0x3')];function createListener(_0x191b07,_0x19399d){return function(_0x4065be){_0x19399d[_0xaab3('0x4')](_0x191b07,_0x4065be);};}function removeListener(_0x5d0e1c,_0xd15ecb){return function(){OpenchannelAccountEvents[_0xaab3('0x5')](_0x5d0e1c,_0xd15ecb);};}exports[_0xaab3('0x6')]=function(_0x3c7162){for(var _0x4c5d04=0x0,_0x5760e8=events[_0xaab3('0x7')];_0x4c5d04<_0x5760e8;_0x4c5d04++){var _0x1fd19f=events[_0x4c5d04];var _0x146453=createListener(_0xaab3('0x8')+_0x1fd19f,_0x3c7162);OpenchannelAccountEvents['on'](_0x1fd19f,_0x146453);}}; \ No newline at end of file +var _0xa699=['removeListener','register','length','./openchannelAccount.events','save','remove','update','emit'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xa699,0x6b));var _0x9a69=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0xa699[_0x4629ee];return _0x47fb5b;};'use strict';var OpenchannelAccountEvents=require(_0x9a69('0x0'));var events=[_0x9a69('0x1'),_0x9a69('0x2'),_0x9a69('0x3')];function createListener(_0x22c4fa,_0xe12857){return function(_0x19916a){_0xe12857[_0x9a69('0x4')](_0x22c4fa,_0x19916a);};}function removeListener(_0xadacc9,_0x3edccc){return function(){OpenchannelAccountEvents[_0x9a69('0x5')](_0xadacc9,_0x3edccc);};}exports[_0x9a69('0x6')]=function(_0x15f2fc){for(var _0x58eb4d=0x0,_0x26b842=events[_0x9a69('0x7')];_0x58eb4d<_0x26b842;_0x58eb4d++){var _0x3bb021=events[_0x58eb4d];var _0x4665a9=createListener('openchannelAccount:'+_0x3bb021,_0x15f2fc);OpenchannelAccountEvents['on'](_0x3bb021,_0x4665a9);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 17f74f4..f713d10 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 _0x337f=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x137ef8,_0x3384dc){var _0x3b7d28=function(_0x291891){while(--_0x291891){_0x137ef8['push'](_0x137ef8['shift']());}};_0x3b7d28(++_0x3384dc);}(_0x337f,0xef));var _0xf337=function(_0x3f1f4b,_0x3e899e){_0x3f1f4b=_0x3f1f4b-0x0;var _0x135845=_0x337f[_0x3f1f4b];return _0x135845;};'use strict';var multer=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var path=require(_0xf337('0x2'));var timeout=require(_0xf337('0x3'));var express=require(_0xf337('0x4'));var router=express[_0xf337('0x5')]();var fs_extra=require(_0xf337('0x6'));var auth=require(_0xf337('0x7'));var interaction=require(_0xf337('0x8'));var config=require(_0xf337('0x9'));var controller=require(_0xf337('0xa'));router[_0xf337('0xb')]('/',auth[_0xf337('0xc')](),controller[_0xf337('0xd')]);router['get'](_0xf337('0xe'),auth[_0xf337('0xc')](),controller['show']);router[_0xf337('0xf')]('/',auth[_0xf337('0xc')](),controller[_0xf337('0x10')]);router['put'](_0xf337('0xe'),auth[_0xf337('0xc')](),controller[_0xf337('0x11')]);router[_0xf337('0x12')](_0xf337('0xe'),auth[_0xf337('0xc')](),controller[_0xf337('0x13')]);module[_0xf337('0x14')]=router; \ No newline at end of file +var _0x54bc=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','create','destroy','exports'];(function(_0x21f70b,_0x47501e){var _0x153b64=function(_0x30694d){while(--_0x30694d){_0x21f70b['push'](_0x21f70b['shift']());}};_0x153b64(++_0x47501e);}(_0x54bc,0x1a9));var _0xc54b=function(_0x5c3072,_0x2ab957){_0x5c3072=_0x5c3072-0x0;var _0x447fc8=_0x54bc[_0x5c3072];return _0x447fc8;};'use strict';var multer=require(_0xc54b('0x0'));var util=require(_0xc54b('0x1'));var path=require(_0xc54b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc54b('0x3'));var router=express[_0xc54b('0x4')]();var fs_extra=require(_0xc54b('0x5'));var auth=require(_0xc54b('0x6'));var interaction=require(_0xc54b('0x7'));var config=require('../../config/environment');var controller=require(_0xc54b('0x8'));router['get']('/',auth[_0xc54b('0x9')](),controller[_0xc54b('0xa')]);router['get'](_0xc54b('0xb'),auth[_0xc54b('0x9')](),controller[_0xc54b('0xc')]);router[_0xc54b('0xd')]('/',auth[_0xc54b('0x9')](),controller[_0xc54b('0xe')]);router['put']('/:id',auth[_0xc54b('0x9')](),controller['update']);router['delete'](_0xc54b('0xb'),auth[_0xc54b('0x9')](),controller[_0xc54b('0xf')]);module[_0xc54b('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 6bec299..06f1625 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 _0x72ba=['*,*,*,*','exports','TEXT','STRING'];(function(_0x438077,_0x52fb7d){var _0xf86493=function(_0x5479e8){while(--_0x5479e8){_0x438077['push'](_0x438077['shift']());}};_0xf86493(++_0x52fb7d);}(_0x72ba,0xf5));var _0xa72b=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x72ba[_0x3b96cf];return _0x2e315a;};'use strict';var Sequelize=require('sequelize');module[_0xa72b('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa72b('0x1')]()},'description':{'type':Sequelize[_0xa72b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa72b('0x3')}}; \ No newline at end of file +var _0x64b5=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x64b5,0x15a));var _0x564b=function(_0x65aa90,_0x39ff7c){_0x65aa90=_0x65aa90-0x0;var _0x130664=_0x64b5[_0x65aa90];return _0x130664;};'use strict';var Sequelize=require(_0x564b('0x0'));module[_0x564b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x564b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x564b('0x3')]()},'description':{'type':Sequelize[_0x564b('0x2')]},'interval':{'type':Sequelize[_0x564b('0x2')],'defaultValue':_0x564b('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 5e2312d..09e633d 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 _0xb41a=['show','params','keys','length','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','OpenchannelApplication','rawAttributes','type','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xb41a,0x1e9));var _0xab41=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xb41a[_0x8af54b];return _0x27d8f0;};'use strict';var emlformat=require(_0xab41('0x0'));var rimraf=require(_0xab41('0x1'));var zipdir=require(_0xab41('0x2'));var jsonpatch=require(_0xab41('0x3'));var rp=require('request-promise');var moment=require(_0xab41('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab41('0x5'));var util=require('util');var path=require(_0xab41('0x6'));var sox=require(_0xab41('0x7'));var csv=require(_0xab41('0x8'));var ejs=require(_0xab41('0x9'));var fs=require('fs');var fs_extra=require(_0xab41('0xa'));var _=require(_0xab41('0xb'));var squel=require(_0xab41('0xc'));var crypto=require(_0xab41('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xab41('0x8'));var querystring=require(_0xab41('0xe'));var Papa=require(_0xab41('0xf'));var Redis=require(_0xab41('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab41('0x11'));var hardwareService=require(_0xab41('0x12'));var logger=require('../../config/logger')(_0xab41('0x13'));var utils=require(_0xab41('0x14'));var config=require(_0xab41('0x15'));var licenseUtil=require(_0xab41('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55f59a,_0x4be326){_0x4be326=_0x4be326||0xcc;return function(_0x2f33c4){if(_0x2f33c4){return _0x55f59a['sendStatus'](_0x4be326);}return _0x55f59a[_0xab41('0x17')](_0x4be326)[_0xab41('0x18')]();};}function respondWithResult(_0x442842,_0x1b4607){_0x1b4607=_0x1b4607||0xc8;return function(_0xed1646){if(_0xed1646){return _0x442842[_0xab41('0x17')](_0x1b4607)[_0xab41('0x19')](_0xed1646);}};}function respondWithFilteredResult(_0x25036e,_0x45906a){return function(_0x34be3f){if(_0x34be3f){var _0x4684a4=typeof _0x45906a[_0xab41('0x1a')]==='undefined'&&typeof _0x45906a[_0xab41('0x1b')]==='undefined';var _0x4a8388=_0x34be3f['count'];var _0x38eb74=_0x4684a4?0x0:_0x45906a['offset'];var _0x1d8fa2=_0x4684a4?_0x34be3f['count']:_0x45906a['offset']+_0x45906a[_0xab41('0x1b')];var _0x4197c5;if(_0x1d8fa2>=_0x4a8388){_0x1d8fa2=_0x4a8388;_0x4197c5=0xc8;}else{_0x4197c5=0xce;}_0x25036e[_0xab41('0x17')](_0x4197c5);return _0x25036e[_0xab41('0x1c')](_0xab41('0x1d'),_0x38eb74+'-'+_0x1d8fa2+'/'+_0x4a8388)[_0xab41('0x19')](_0x34be3f);}return null;};}function patchUpdates(_0xbc0ffa){return function(_0x5423db){try{jsonpatch[_0xab41('0x1e')](_0x5423db,_0xbc0ffa,!![]);}catch(_0x5e326d){return BPromise[_0xab41('0x1f')](_0x5e326d);}return _0x5423db[_0xab41('0x20')]();};}function saveUpdates(_0x310e3c,_0xfd4a12){return function(_0xf52e6d){if(_0xf52e6d){return _0xf52e6d[_0xab41('0x21')](_0x310e3c)[_0xab41('0x22')](function(_0x248e96){return _0x248e96;});}return null;};}function removeEntity(_0x4c8a72,_0x5dbea2){return function(_0xb8c522){if(_0xb8c522){return _0xb8c522[_0xab41('0x23')]()['then'](function(){_0x4c8a72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x460234,_0x5337b5){return function(_0x4f4f4c){if(!_0x4f4f4c){_0x460234[_0xab41('0x24')](0x194);}return _0x4f4f4c;};}function handleError(_0x360db7,_0x35cedf){_0x35cedf=_0x35cedf||0x1f4;return function(_0x16195e){logger[_0xab41('0x25')](_0x16195e['stack']);if(_0x16195e['name']){delete _0x16195e[_0xab41('0x26')];}_0x360db7[_0xab41('0x17')](_0x35cedf)['send'](_0x16195e);};}exports[_0xab41('0x27')]=function(_0xad109b,_0x3e6e2e){var _0x5388d7={},_0xd5ec78={},_0x16f40e={'count':0x0,'rows':[]};var _0x4b870d=_[_0xab41('0x28')](db[_0xab41('0x29')][_0xab41('0x2a')],function(_0x52bbe2){return{'name':_0x52bbe2['fieldName'],'type':_0x52bbe2[_0xab41('0x2b')]['key']};});_0xd5ec78[_0xab41('0x2c')]=_[_0xab41('0x28')](_0x4b870d,_0xab41('0x26'));_0xd5ec78[_0xab41('0x2d')]=_['keys'](_0xad109b[_0xab41('0x2d')]);_0xd5ec78['filters']=_[_0xab41('0x2e')](_0xd5ec78[_0xab41('0x2c')],_0xd5ec78[_0xab41('0x2d')]);_0x5388d7[_0xab41('0x2f')]=_['intersection'](_0xd5ec78[_0xab41('0x2c')],qs[_0xab41('0x30')](_0xad109b[_0xab41('0x2d')]['fields']));_0x5388d7[_0xab41('0x2f')]=_0x5388d7[_0xab41('0x2f')]['length']?_0x5388d7[_0xab41('0x2f')]:_0xd5ec78[_0xab41('0x2c')];if(!_0xad109b[_0xab41('0x2d')][_0xab41('0x31')]('nolimit')){_0x5388d7[_0xab41('0x1b')]=qs[_0xab41('0x1b')](_0xad109b[_0xab41('0x2d')][_0xab41('0x1b')]);_0x5388d7['offset']=qs[_0xab41('0x1a')](_0xad109b[_0xab41('0x2d')][_0xab41('0x1a')]);}_0x5388d7[_0xab41('0x32')]=qs[_0xab41('0x33')](_0xad109b[_0xab41('0x2d')][_0xab41('0x33')]);_0x5388d7[_0xab41('0x34')]=qs[_0xab41('0x35')](_[_0xab41('0x36')](_0xad109b[_0xab41('0x2d')],_0xd5ec78[_0xab41('0x35')]),_0x4b870d);if(_0xad109b[_0xab41('0x2d')]['filter']){_0x5388d7[_0xab41('0x34')]=_[_0xab41('0x37')](_0x5388d7[_0xab41('0x34')],{'$or':_[_0xab41('0x28')](_0x4b870d,function(_0x3ee187){if(_0x3ee187[_0xab41('0x2b')]!==_0xab41('0x38')){var _0x141ee8={};_0x141ee8[_0x3ee187['name']]={'$like':'%'+_0xad109b[_0xab41('0x2d')]['filter']+'%'};return _0x141ee8;}})});}_0x5388d7=_[_0xab41('0x37')]({},_0x5388d7,_0xad109b[_0xab41('0x39')]);var _0x487cb7={'where':_0x5388d7[_0xab41('0x34')]};return db[_0xab41('0x29')][_0xab41('0x3a')](_0x487cb7)[_0xab41('0x22')](function(_0x475e9b){_0x16f40e[_0xab41('0x3a')]=_0x475e9b;if(_0xad109b[_0xab41('0x2d')][_0xab41('0x3b')]){_0x5388d7['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xab41('0x3c')](_0x5388d7);})['then'](function(_0x32010f){_0x16f40e[_0xab41('0x3d')]=_0x32010f;return _0x16f40e;})[_0xab41('0x22')](respondWithFilteredResult(_0x3e6e2e,_0x5388d7))[_0xab41('0x3e')](handleError(_0x3e6e2e,null));};exports[_0xab41('0x3f')]=function(_0x4ae888,_0x5973e6){var _0x308e91={'raw':!![],'where':{'id':_0x4ae888[_0xab41('0x40')]['id']}},_0x4b340e={};_0x4b340e[_0xab41('0x2c')]=_[_0xab41('0x41')](db[_0xab41('0x29')][_0xab41('0x2a')]);_0x4b340e[_0xab41('0x2d')]=_[_0xab41('0x41')](_0x4ae888[_0xab41('0x2d')]);_0x4b340e[_0xab41('0x35')]=_['intersection'](_0x4b340e[_0xab41('0x2c')],_0x4b340e['query']);_0x308e91[_0xab41('0x2f')]=_[_0xab41('0x2e')](_0x4b340e[_0xab41('0x2c')],qs[_0xab41('0x30')](_0x4ae888[_0xab41('0x2d')][_0xab41('0x30')]));_0x308e91[_0xab41('0x2f')]=_0x308e91[_0xab41('0x2f')][_0xab41('0x42')]?_0x308e91[_0xab41('0x2f')]:_0x4b340e['model'];if(_0x4ae888[_0xab41('0x2d')]['includeAll']){_0x308e91['include']=[{'all':!![]}];}_0x308e91=_[_0xab41('0x37')]({},_0x308e91,_0x4ae888[_0xab41('0x39')]);return db[_0xab41('0x29')]['find'](_0x308e91)[_0xab41('0x22')](handleEntityNotFound(_0x5973e6,null))[_0xab41('0x22')](respondWithResult(_0x5973e6,null))[_0xab41('0x3e')](handleError(_0x5973e6,null));};exports['create']=function(_0x111fdf,_0x3d56c7){return db[_0xab41('0x29')]['create'](_0x111fdf[_0xab41('0x43')],{})[_0xab41('0x22')](respondWithResult(_0x3d56c7,0xc9))['catch'](handleError(_0x3d56c7,null));};exports[_0xab41('0x21')]=function(_0x3883bb,_0x2a7149){if(_0x3883bb[_0xab41('0x43')]['id']){delete _0x3883bb[_0xab41('0x43')]['id'];}return db[_0xab41('0x29')][_0xab41('0x44')]({'where':{'id':_0x3883bb[_0xab41('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a7149,null))[_0xab41('0x22')](saveUpdates(_0x3883bb['body'],null))['then'](respondWithResult(_0x2a7149,null))[_0xab41('0x3e')](handleError(_0x2a7149,null));};exports[_0xab41('0x23')]=function(_0x54afbf,_0x367990){return db[_0xab41('0x29')][_0xab41('0x44')]({'where':{'id':_0x54afbf[_0xab41('0x40')]['id']}})['then'](handleEntityNotFound(_0x367990,null))['then'](removeEntity(_0x367990,null))[_0xab41('0x3e')](handleError(_0x367990,null));}; \ No newline at end of file +var _0xdd90=['desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','OpenchannelApplication','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0xdd90,0x89));var _0x0dd9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdd90[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x0dd9('0x0'));var rimraf=require(_0x0dd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dd9('0x2'));var rp=require('request-promise');var moment=require(_0x0dd9('0x3'));var BPromise=require(_0x0dd9('0x4'));var Mustache=require(_0x0dd9('0x5'));var util=require(_0x0dd9('0x6'));var path=require('path');var sox=require(_0x0dd9('0x7'));var csv=require(_0x0dd9('0x8'));var ejs=require(_0x0dd9('0x9'));var fs=require('fs');var fs_extra=require(_0x0dd9('0xa'));var _=require(_0x0dd9('0xb'));var squel=require(_0x0dd9('0xc'));var crypto=require(_0x0dd9('0xd'));var jsforce=require(_0x0dd9('0xe'));var deskjs=require(_0x0dd9('0xf'));var toCsv=require(_0x0dd9('0x8'));var querystring=require(_0x0dd9('0x10'));var Papa=require('papaparse');var Redis=require(_0x0dd9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0dd9('0x12'));var as=require(_0x0dd9('0x13'));var hardwareService=require(_0x0dd9('0x14'));var logger=require(_0x0dd9('0x15'))(_0x0dd9('0x16'));var utils=require(_0x0dd9('0x17'));var config=require(_0x0dd9('0x18'));var licenseUtil=require(_0x0dd9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4471ca,_0x17bbe9){_0x17bbe9=_0x17bbe9||0xcc;return function(_0x402f7c){if(_0x402f7c){return _0x4471ca['sendStatus'](_0x17bbe9);}return _0x4471ca['status'](_0x17bbe9)[_0x0dd9('0x1a')]();};}function respondWithResult(_0x139df9,_0x20e474){_0x20e474=_0x20e474||0xc8;return function(_0x572a0e){if(_0x572a0e){return _0x139df9[_0x0dd9('0x1b')](_0x20e474)[_0x0dd9('0x1c')](_0x572a0e);}};}function respondWithFilteredResult(_0x38a1e3,_0xdd9fb3){return function(_0xd98009){if(_0xd98009){var _0x477e46=typeof _0xdd9fb3['offset']===_0x0dd9('0x1d')&&typeof _0xdd9fb3[_0x0dd9('0x1e')]===_0x0dd9('0x1d');var _0x45de1d=_0xd98009['count'];var _0x56bd06=_0x477e46?0x0:_0xdd9fb3[_0x0dd9('0x1f')];var _0x2bff08=_0x477e46?_0xd98009['count']:_0xdd9fb3[_0x0dd9('0x1f')]+_0xdd9fb3[_0x0dd9('0x1e')];var _0x1da81f;if(_0x2bff08>=_0x45de1d){_0x2bff08=_0x45de1d;_0x1da81f=0xc8;}else{_0x1da81f=0xce;}_0x38a1e3[_0x0dd9('0x1b')](_0x1da81f);return _0x38a1e3[_0x0dd9('0x20')](_0x0dd9('0x21'),_0x56bd06+'-'+_0x2bff08+'/'+_0x45de1d)[_0x0dd9('0x1c')](_0xd98009);}return null;};}function patchUpdates(_0x191982){return function(_0x497704){try{jsonpatch['apply'](_0x497704,_0x191982,!![]);}catch(_0x3a436d){return BPromise[_0x0dd9('0x22')](_0x3a436d);}return _0x497704[_0x0dd9('0x23')]();};}function saveUpdates(_0x397ab8,_0x2f13ae){return function(_0x10e519){if(_0x10e519){return _0x10e519[_0x0dd9('0x24')](_0x397ab8)[_0x0dd9('0x25')](function(_0x286900){return _0x286900;});}return null;};}function removeEntity(_0x15725f,_0x303541){return function(_0x1a6cec){if(_0x1a6cec){return _0x1a6cec[_0x0dd9('0x26')]()[_0x0dd9('0x25')](function(){_0x15725f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a6c1,_0x58ecc5){return function(_0x3ba563){if(!_0x3ba563){_0x39a6c1[_0x0dd9('0x27')](0x194);}return _0x3ba563;};}function handleError(_0x2486d1,_0x4a841f){_0x4a841f=_0x4a841f||0x1f4;return function(_0x54804b){logger['error'](_0x54804b[_0x0dd9('0x28')]);if(_0x54804b['name']){delete _0x54804b[_0x0dd9('0x29')];}_0x2486d1['status'](_0x4a841f)[_0x0dd9('0x2a')](_0x54804b);};}exports[_0x0dd9('0x2b')]=function(_0x28ef28,_0x442d3e){var _0x11fc95={},_0x531b1a={},_0x4a3c13={'count':0x0,'rows':[]};var _0xb81948=_[_0x0dd9('0x2c')](db['OpenchannelApplication'][_0x0dd9('0x2d')],function(_0x8417eb){return{'name':_0x8417eb['fieldName'],'type':_0x8417eb['type'][_0x0dd9('0x2e')]};});_0x531b1a[_0x0dd9('0x2f')]=_[_0x0dd9('0x2c')](_0xb81948,_0x0dd9('0x29'));_0x531b1a['query']=_[_0x0dd9('0x30')](_0x28ef28[_0x0dd9('0x31')]);_0x531b1a[_0x0dd9('0x32')]=_['intersection'](_0x531b1a['model'],_0x531b1a[_0x0dd9('0x31')]);_0x11fc95[_0x0dd9('0x33')]=_[_0x0dd9('0x34')](_0x531b1a[_0x0dd9('0x2f')],qs[_0x0dd9('0x35')](_0x28ef28[_0x0dd9('0x31')][_0x0dd9('0x35')]));_0x11fc95[_0x0dd9('0x33')]=_0x11fc95[_0x0dd9('0x33')]['length']?_0x11fc95['attributes']:_0x531b1a['model'];if(!_0x28ef28[_0x0dd9('0x31')][_0x0dd9('0x36')]('nolimit')){_0x11fc95[_0x0dd9('0x1e')]=qs[_0x0dd9('0x1e')](_0x28ef28[_0x0dd9('0x31')][_0x0dd9('0x1e')]);_0x11fc95[_0x0dd9('0x1f')]=qs[_0x0dd9('0x1f')](_0x28ef28['query']['offset']);}_0x11fc95[_0x0dd9('0x37')]=qs[_0x0dd9('0x38')](_0x28ef28[_0x0dd9('0x31')][_0x0dd9('0x38')]);_0x11fc95[_0x0dd9('0x39')]=qs[_0x0dd9('0x32')](_['pick'](_0x28ef28[_0x0dd9('0x31')],_0x531b1a[_0x0dd9('0x32')]),_0xb81948);if(_0x28ef28[_0x0dd9('0x31')][_0x0dd9('0x3a')]){_0x11fc95[_0x0dd9('0x39')]=_['merge'](_0x11fc95[_0x0dd9('0x39')],{'$or':_[_0x0dd9('0x2c')](_0xb81948,function(_0x3b7462){if(_0x3b7462[_0x0dd9('0x3b')]!==_0x0dd9('0x3c')){var _0x5e69e8={};_0x5e69e8[_0x3b7462['name']]={'$like':'%'+_0x28ef28[_0x0dd9('0x31')][_0x0dd9('0x3a')]+'%'};return _0x5e69e8;}})});}_0x11fc95=_[_0x0dd9('0x3d')]({},_0x11fc95,_0x28ef28[_0x0dd9('0x3e')]);var _0x564d81={'where':_0x11fc95['where']};return db[_0x0dd9('0x3f')]['count'](_0x564d81)[_0x0dd9('0x25')](function(_0x1796cc){_0x4a3c13[_0x0dd9('0x40')]=_0x1796cc;if(_0x28ef28[_0x0dd9('0x31')][_0x0dd9('0x41')]){_0x11fc95[_0x0dd9('0x42')]=[{'all':!![]}];}return db[_0x0dd9('0x3f')][_0x0dd9('0x43')](_0x11fc95);})[_0x0dd9('0x25')](function(_0xc0ebf2){_0x4a3c13[_0x0dd9('0x44')]=_0xc0ebf2;return _0x4a3c13;})['then'](respondWithFilteredResult(_0x442d3e,_0x11fc95))['catch'](handleError(_0x442d3e,null));};exports[_0x0dd9('0x45')]=function(_0x3458e9,_0x2571d0){var _0x5848db={'raw':!![],'where':{'id':_0x3458e9[_0x0dd9('0x46')]['id']}},_0x1249b0={};_0x1249b0['model']=_['keys'](db['OpenchannelApplication'][_0x0dd9('0x2d')]);_0x1249b0[_0x0dd9('0x31')]=_[_0x0dd9('0x30')](_0x3458e9[_0x0dd9('0x31')]);_0x1249b0[_0x0dd9('0x32')]=_[_0x0dd9('0x34')](_0x1249b0[_0x0dd9('0x2f')],_0x1249b0['query']);_0x5848db[_0x0dd9('0x33')]=_[_0x0dd9('0x34')](_0x1249b0['model'],qs['fields'](_0x3458e9[_0x0dd9('0x31')][_0x0dd9('0x35')]));_0x5848db[_0x0dd9('0x33')]=_0x5848db[_0x0dd9('0x33')][_0x0dd9('0x47')]?_0x5848db['attributes']:_0x1249b0[_0x0dd9('0x2f')];if(_0x3458e9['query']['includeAll']){_0x5848db[_0x0dd9('0x42')]=[{'all':!![]}];}_0x5848db=_['merge']({},_0x5848db,_0x3458e9[_0x0dd9('0x3e')]);return db[_0x0dd9('0x3f')][_0x0dd9('0x48')](_0x5848db)['then'](handleEntityNotFound(_0x2571d0,null))['then'](respondWithResult(_0x2571d0,null))[_0x0dd9('0x49')](handleError(_0x2571d0,null));};exports[_0x0dd9('0x4a')]=function(_0x22360b,_0x58ae0d){return db[_0x0dd9('0x3f')][_0x0dd9('0x4a')](_0x22360b[_0x0dd9('0x4b')],{})[_0x0dd9('0x25')](respondWithResult(_0x58ae0d,0xc9))[_0x0dd9('0x49')](handleError(_0x58ae0d,null));};exports[_0x0dd9('0x24')]=function(_0x5a5fce,_0x83e47a){if(_0x5a5fce['body']['id']){delete _0x5a5fce[_0x0dd9('0x4b')]['id'];}return db[_0x0dd9('0x3f')][_0x0dd9('0x48')]({'where':{'id':_0x5a5fce['params']['id']}})[_0x0dd9('0x25')](handleEntityNotFound(_0x83e47a,null))[_0x0dd9('0x25')](saveUpdates(_0x5a5fce[_0x0dd9('0x4b')],null))[_0x0dd9('0x25')](respondWithResult(_0x83e47a,null))[_0x0dd9('0x49')](handleError(_0x83e47a,null));};exports[_0x0dd9('0x26')]=function(_0x2d10ec,_0x3e6e05){return db['OpenchannelApplication']['find']({'where':{'id':_0x2d10ec[_0x0dd9('0x46')]['id']}})[_0x0dd9('0x25')](handleEntityNotFound(_0x3e6e05,null))[_0x0dd9('0x25')](removeEntity(_0x3e6e05,null))['catch'](handleError(_0x3e6e05,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e801c3f..3a57236 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 _0x1c09=['util','../../config/logger','moment','request-promise','path','../../config/environment','OpenchannelApplication','utf8mb4_unicode_ci','lodash'];(function(_0x313939,_0x4263c5){var _0x311056=function(_0x220d85){while(--_0x220d85){_0x313939['push'](_0x313939['shift']());}};_0x311056(++_0x4263c5);}(_0x1c09,0x155));var _0x91c0=function(_0x4db95e,_0x19629d){_0x4db95e=_0x4db95e-0x0;var _0x22d137=_0x1c09[_0x4db95e];return _0x22d137;};'use strict';var _=require(_0x91c0('0x0'));var util=require(_0x91c0('0x1'));var logger=require(_0x91c0('0x2'))('api');var moment=require(_0x91c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x91c0('0x4'));var fs=require('fs');var path=require(_0x91c0('0x5'));var rimraf=require('rimraf');var config=require(_0x91c0('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x193ff8,_0x19e034){return _0x193ff8['define'](_0x91c0('0x7'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x91c0('0x8')});}; \ No newline at end of file +var _0x4c03=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x58b1ba,_0x432be8){var _0x128616=function(_0x41caf8){while(--_0x41caf8){_0x58b1ba['push'](_0x58b1ba['shift']());}};_0x128616(++_0x432be8);}(_0x4c03,0x72));var _0x34c0=function(_0x1b7a29,_0x39470d){_0x1b7a29=_0x1b7a29-0x0;var _0x3beb3a=_0x4c03[_0x1b7a29];return _0x3beb3a;};'use strict';var _=require(_0x34c0('0x0'));var util=require(_0x34c0('0x1'));var logger=require(_0x34c0('0x2'))('api');var moment=require(_0x34c0('0x3'));var BPromise=require(_0x34c0('0x4'));var rp=require(_0x34c0('0x5'));var fs=require('fs');var path=require(_0x34c0('0x6'));var rimraf=require(_0x34c0('0x7'));var config=require(_0x34c0('0x8'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x284eb4,_0x500797){return _0x284eb4[_0x34c0('0x9')](_0x34c0('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x34c0('0xb'),'collate':_0x34c0('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 624395d..405733f 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 _0xc080=['request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','stringify','catch','lodash','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x504163,_0x227959){var _0x21e8ce=function(_0x48a6c1){while(--_0x48a6c1){_0x504163['push'](_0x504163['shift']());}};_0x21e8ce(++_0x227959);}(_0xc080,0x8d));var _0x0c08=function(_0x26ef23,_0x15c586){_0x26ef23=_0x26ef23-0x0;var _0x5c4610=_0xc080[_0x26ef23];return _0x5c4610;};'use strict';var _=require(_0x0c08('0x0'));var util=require('util');var moment=require(_0x0c08('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c08('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c08('0x3'));var logger=require('../../config/logger')(_0x0c08('0x4'));var config=require(_0x0c08('0x5'));var jayson=require(_0x0c08('0x6'));var client=jayson[_0x0c08('0x7')][_0x0c08('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x528c65,_0x1225aa,_0x2a8589){return new BPromise(function(_0x195214,_0x87b30){return client[_0x0c08('0x9')](_0x528c65,_0x2a8589)[_0x0c08('0xa')](function(_0x2487ad){logger[_0x0c08('0xb')](_0x0c08('0xc'),_0x1225aa,_0x0c08('0xd'));logger[_0x0c08('0xe')](_0x0c08('0xf'),_0x1225aa,'request\x20sent',JSON['stringify'](_0x2487ad));if(_0x2487ad[_0x0c08('0x10')]){if(_0x2487ad['error'][_0x0c08('0x11')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1225aa,_0x2487ad[_0x0c08('0x10')][_0x0c08('0x12')]);return _0x87b30(_0x2487ad[_0x0c08('0x10')]['message']);}logger[_0x0c08('0x10')](_0x0c08('0xc'),_0x1225aa,_0x2487ad[_0x0c08('0x10')][_0x0c08('0x12')]);return _0x195214(_0x2487ad['error'][_0x0c08('0x12')]);}else{logger['info'](_0x0c08('0xc'),_0x1225aa,_0x0c08('0xd'));_0x195214(_0x2487ad['result'][_0x0c08('0x12')]);}})['catch'](function(_0x2fa60b){logger[_0x0c08('0x10')](_0x0c08('0xc'),_0x1225aa,_0x2fa60b);_0x87b30(_0x2fa60b);});});}exports[_0x0c08('0x13')]=function(_0x582baf){var _0x3f5e4e=this;return new Promise(function(_0x2fe36c,_0x5ac461){return db[_0x0c08('0x14')][_0x0c08('0x15')](_0x582baf[_0x0c08('0x16')],{'raw':_0x582baf[_0x0c08('0x17')]?_0x582baf['options'][_0x0c08('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x582baf[_0x0c08('0x17')]?_0x582baf['options'][_0x0c08('0x19')]||null:null,'attributes':_0x582baf[_0x0c08('0x17')]?_0x582baf['options'][_0x0c08('0x1a')]||null:null,'limit':_0x582baf[_0x0c08('0x17')]?_0x582baf[_0x0c08('0x17')][_0x0c08('0x1b')]||null:null})[_0x0c08('0xa')](function(_0x17aaf7){logger[_0x0c08('0xb')](_0x0c08('0x13'),_0x582baf);logger['debug'](_0x0c08('0x13'),_0x582baf,JSON[_0x0c08('0x1c')](_0x17aaf7));_0x2fe36c(_0x17aaf7);})[_0x0c08('0x1d')](function(_0x45d7fc){logger['error']('UpdateOpenchannelApplication',_0x45d7fc[_0x0c08('0x12')],_0x582baf);_0x5ac461(_0x3f5e4e[_0x0c08('0x10')](0x1f4,_0x45d7fc[_0x0c08('0x12')]));});});}; \ No newline at end of file +var _0xbd2e=['body','options','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x249df2,_0x1e7467){var _0x7cedd0=function(_0x3a5e6c){while(--_0x3a5e6c){_0x249df2['push'](_0x249df2['shift']());}};_0x7cedd0(++_0x1e7467);}(_0xbd2e,0x19b));var _0xebd2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbd2e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xebd2('0x0'));var util=require(_0xebd2('0x1'));var moment=require(_0xebd2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebd2('0x3'));var db=require(_0xebd2('0x4'))['db'];var utils=require(_0xebd2('0x5'));var logger=require('../../config/logger')(_0xebd2('0x6'));var config=require('../../config/environment');var jayson=require(_0xebd2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x109110,_0x57c30d,_0x236369){return new BPromise(function(_0x429e8a,_0x570f7d){return client['request'](_0x109110,_0x236369)['then'](function(_0x19751b){logger[_0xebd2('0x8')](_0xebd2('0x9'),_0x57c30d,_0xebd2('0xa'));logger[_0xebd2('0xb')](_0xebd2('0xc'),_0x57c30d,_0xebd2('0xa'),JSON[_0xebd2('0xd')](_0x19751b));if(_0x19751b[_0xebd2('0xe')]){if(_0x19751b[_0xebd2('0xe')][_0xebd2('0xf')]===0x1f4){logger[_0xebd2('0xe')](_0xebd2('0x9'),_0x57c30d,_0x19751b['error'][_0xebd2('0x10')]);return _0x570f7d(_0x19751b[_0xebd2('0xe')][_0xebd2('0x10')]);}logger[_0xebd2('0xe')](_0xebd2('0x9'),_0x57c30d,_0x19751b['error']['message']);return _0x429e8a(_0x19751b['error'][_0xebd2('0x10')]);}else{logger[_0xebd2('0x8')](_0xebd2('0x9'),_0x57c30d,'request\x20sent');_0x429e8a(_0x19751b[_0xebd2('0x11')][_0xebd2('0x10')]);}})[_0xebd2('0x12')](function(_0x2bc1d7){logger[_0xebd2('0xe')](_0xebd2('0x9'),_0x57c30d,_0x2bc1d7);_0x570f7d(_0x2bc1d7);});});}exports[_0xebd2('0x13')]=function(_0x4d5c38){var _0x5566b3=this;return new Promise(function(_0x32bc24,_0x3c679b){return db[_0xebd2('0x14')]['update'](_0x4d5c38[_0xebd2('0x15')],{'raw':_0x4d5c38[_0xebd2('0x16')]?_0x4d5c38[_0xebd2('0x16')][_0xebd2('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d5c38[_0xebd2('0x16')]?_0x4d5c38['options'][_0xebd2('0x18')]||null:null,'attributes':_0x4d5c38[_0xebd2('0x16')]?_0x4d5c38[_0xebd2('0x16')][_0xebd2('0x19')]||null:null,'limit':_0x4d5c38[_0xebd2('0x16')]?_0x4d5c38[_0xebd2('0x16')][_0xebd2('0x1a')]||null:null})['then'](function(_0x25db43){logger[_0xebd2('0x8')](_0xebd2('0x13'),_0x4d5c38);logger[_0xebd2('0xb')](_0xebd2('0x13'),_0x4d5c38,JSON[_0xebd2('0xd')](_0x25db43));_0x32bc24(_0x25db43);})[_0xebd2('0x12')](function(_0x3a2a63){logger[_0xebd2('0xe')](_0xebd2('0x13'),_0x3a2a63[_0xebd2('0x10')],_0x4d5c38);_0x3c679b(_0x5566b3[_0xebd2('0xe')](0x1f4,_0x3a2a63[_0xebd2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4d33419..6883aa3 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 _0x1382=['create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','getMessages','/:id/download','download','post'];(function(_0x596065,_0x2a53c7){var _0x281207=function(_0x3d719e){while(--_0x3d719e){_0x596065['push'](_0x596065['shift']());}};_0x281207(++_0x2a53c7);}(_0x1382,0x18d));var _0x2138=function(_0x30213a,_0x14d9c1){_0x30213a=_0x30213a-0x0;var _0x2a111f=_0x1382[_0x30213a];return _0x2a111f;};'use strict';var multer=require(_0x2138('0x0'));var util=require(_0x2138('0x1'));var path=require(_0x2138('0x2'));var timeout=require(_0x2138('0x3'));var express=require(_0x2138('0x4'));var router=express['Router']();var fs_extra=require(_0x2138('0x5'));var auth=require(_0x2138('0x6'));var interaction=require(_0x2138('0x7'));var config=require(_0x2138('0x8'));var controller=require(_0x2138('0x9'));router[_0x2138('0xa')]('/',auth[_0x2138('0xb')](),controller[_0x2138('0xc')]);router['get']('/describe',auth[_0x2138('0xb')](),controller[_0x2138('0xd')]);router[_0x2138('0xa')](_0x2138('0xe'),auth[_0x2138('0xb')](),controller['show']);router[_0x2138('0xa')]('/:id/messages',auth[_0x2138('0xb')](),controller[_0x2138('0xf')]);router[_0x2138('0xa')](_0x2138('0x10'),auth['isAuthenticated'](),controller[_0x2138('0x11')]);router[_0x2138('0x12')]('/',auth[_0x2138('0xb')](),controller[_0x2138('0x13')]);router['post']('/:id/messages',auth[_0x2138('0xb')](),controller[_0x2138('0x14')]);router[_0x2138('0x12')](_0x2138('0x15'),auth[_0x2138('0xb')](),interaction[_0x2138('0x16')]('openchannel',_0x2138('0x17')),controller[_0x2138('0x18')]);router[_0x2138('0x19')](_0x2138('0xe'),auth[_0x2138('0xb')](),interaction[_0x2138('0x16')](_0x2138('0x1a'),'openchannelinteraction:update'),controller[_0x2138('0x1b')]);router[_0x2138('0x1c')](_0x2138('0xe'),auth[_0x2138('0xb')](),interaction['tracked'](_0x2138('0x1a'),_0x2138('0x1d')),controller['destroy']);router['delete'](_0x2138('0x15'),auth[_0x2138('0xb')](),controller[_0x2138('0x1e')]);module[_0x2138('0x1f')]=router; \ No newline at end of file +var _0x8f7d=['/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/messages','getMessages','/:id/download','post','create','addMessage'];(function(_0x12b1a6,_0x22df2d){var _0x5813d3=function(_0x57773e){while(--_0x57773e){_0x12b1a6['push'](_0x12b1a6['shift']());}};_0x5813d3(++_0x22df2d);}(_0x8f7d,0x155));var _0xd8f7=function(_0x3f17d5,_0x4ac52b){_0x3f17d5=_0x3f17d5-0x0;var _0x27e094=_0x8f7d[_0x3f17d5];return _0x27e094;};'use strict';var multer=require(_0xd8f7('0x0'));var util=require('util');var path=require(_0xd8f7('0x1'));var timeout=require(_0xd8f7('0x2'));var express=require(_0xd8f7('0x3'));var router=express[_0xd8f7('0x4')]();var fs_extra=require(_0xd8f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd8f7('0x6'));var config=require(_0xd8f7('0x7'));var controller=require(_0xd8f7('0x8'));router['get']('/',auth[_0xd8f7('0x9')](),controller[_0xd8f7('0xa')]);router['get'](_0xd8f7('0xb'),auth[_0xd8f7('0x9')](),controller[_0xd8f7('0xc')]);router['get'](_0xd8f7('0xd'),auth[_0xd8f7('0x9')](),controller[_0xd8f7('0xe')]);router[_0xd8f7('0xf')](_0xd8f7('0x10'),auth[_0xd8f7('0x9')](),controller[_0xd8f7('0x11')]);router[_0xd8f7('0xf')](_0xd8f7('0x12'),auth[_0xd8f7('0x9')](),controller['download']);router[_0xd8f7('0x13')]('/',auth[_0xd8f7('0x9')](),controller[_0xd8f7('0x14')]);router[_0xd8f7('0x13')]('/:id/messages',auth[_0xd8f7('0x9')](),controller[_0xd8f7('0x15')]);router[_0xd8f7('0x13')](_0xd8f7('0x16'),auth[_0xd8f7('0x9')](),interaction[_0xd8f7('0x17')](_0xd8f7('0x18'),_0xd8f7('0x19')),controller[_0xd8f7('0x1a')]);router['put'](_0xd8f7('0xd'),auth[_0xd8f7('0x9')](),interaction[_0xd8f7('0x17')]('openchannel',_0xd8f7('0x1b')),controller[_0xd8f7('0x1c')]);router[_0xd8f7('0x1d')](_0xd8f7('0xd'),auth[_0xd8f7('0x9')](),interaction[_0xd8f7('0x17')](_0xd8f7('0x18'),_0xd8f7('0x1e')),controller[_0xd8f7('0x1f')]);router['delete'](_0xd8f7('0x16'),auth[_0xd8f7('0x9')](),controller[_0xd8f7('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5a5bb83..515f8bb 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 _0x0a12=['STRING','DATE','ENUM','out','exports'];(function(_0x1029ef,_0x46f4f0){var _0x425175=function(_0x1a6f99){while(--_0x1a6f99){_0x1029ef['push'](_0x1029ef['shift']());}};_0x425175(++_0x46f4f0);}(_0x0a12,0xb8));var _0x20a1=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x0a12[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require('sequelize');module[_0x20a1('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x20a1('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x20a1('0x1')]},'read1stAt':{'type':Sequelize[_0x20a1('0x2')]},'threadId':{'type':Sequelize[_0x20a1('0x1')]},'externalUrl':{'type':Sequelize[_0x20a1('0x1')]},'lastMsgAt':{'type':Sequelize[_0x20a1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x20a1('0x3')]('in',_0x20a1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x20a1('0x1')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x684d=['STRING','out','exports','BOOLEAN','DATE'];(function(_0x142f9b,_0x904a81){var _0x57eba6=function(_0xcfe723){while(--_0xcfe723){_0x142f9b['push'](_0x142f9b['shift']());}};_0x57eba6(++_0x904a81);}(_0x684d,0x174));var _0xd684=function(_0xbd1d72,_0x303091){_0xbd1d72=_0xbd1d72-0x0;var _0x227378=_0x684d[_0xbd1d72];return _0x227378;};'use strict';var Sequelize=require('sequelize');module[_0xd684('0x0')]={'closed':{'type':Sequelize[_0xd684('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd684('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd684('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd684('0x3')]},'read1stAt':{'type':Sequelize[_0xd684('0x2')]},'threadId':{'type':Sequelize[_0xd684('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xd684('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd684('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd684('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd684('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd684('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e6f0d89..5bfb95f 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 _0xf084=['$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','include','merge','create','describe','addMessage','OpenchannelMessage','omit','ids','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','findAll','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','CmContact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','format','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','lastName','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','Users','fullname','TagIds','Tags','forEach','catch','answered','unmanaged','total','closed','UserId','waiting','talking','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator'];(function(_0x242fbe,_0x2411b3){var _0x74010b=function(_0x20041d){while(--_0x20041d){_0x242fbe['push'](_0x242fbe['shift']());}};_0x74010b(++_0x2411b3);}(_0xf084,0x179));var _0x4f08=function(_0x5e730e,_0x89937a){_0x5e730e=_0x5e730e-0x0;var _0x117aef=_0xf084[_0x5e730e];return _0x117aef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f08('0x0'));var zipdir=require(_0x4f08('0x1'));var jsonpatch=require(_0x4f08('0x2'));var rp=require(_0x4f08('0x3'));var moment=require(_0x4f08('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f08('0x5'));var util=require(_0x4f08('0x6'));var path=require(_0x4f08('0x7'));var sox=require(_0x4f08('0x8'));var csv=require(_0x4f08('0x9'));var ejs=require(_0x4f08('0xa'));var fs=require('fs');var fs_extra=require(_0x4f08('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f08('0xc'));var deskjs=require(_0x4f08('0xd'));var toCsv=require(_0x4f08('0x9'));var querystring=require(_0x4f08('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4f08('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4f08('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x4f08('0x11'));var logger=require(_0x4f08('0x12'))(_0x4f08('0x13'));var utils=require(_0x4f08('0x14'));var config=require(_0x4f08('0x15'));var licenseUtil=require(_0x4f08('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4f08('0x17')],{'host':_0x4f08('0x18'),'port':0x18eb});var socket=require(_0x4f08('0x19'))(new Redis(config[_0x4f08('0x17')]));require(_0x4f08('0x1a'))[_0x4f08('0x1b')](socket);function respondWithStatusCode(_0x5998c3,_0x17cdfe){_0x17cdfe=_0x17cdfe||0xcc;return function(_0x121c09){if(_0x121c09){return _0x5998c3[_0x4f08('0x1c')](_0x17cdfe);}return _0x5998c3[_0x4f08('0x1d')](_0x17cdfe)[_0x4f08('0x1e')]();};}function respondWithResult(_0x1820b1,_0x32d20c){_0x32d20c=_0x32d20c||0xc8;return function(_0x3f1e90){if(_0x3f1e90){return _0x1820b1[_0x4f08('0x1d')](_0x32d20c)[_0x4f08('0x1f')](_0x3f1e90);}};}function respondWithFilteredResult(_0x4a8708,_0x4df961){return function(_0x134115){if(_0x134115){var _0x1111fe=typeof _0x4df961['offset']===_0x4f08('0x20')&&typeof _0x4df961[_0x4f08('0x21')]===_0x4f08('0x20');var _0x5c0113=_0x134115[_0x4f08('0x22')];var _0x1bcc96=_0x1111fe?0x0:_0x4df961[_0x4f08('0x23')];var _0x17e334=_0x1111fe?_0x134115[_0x4f08('0x22')]:_0x4df961[_0x4f08('0x23')]+_0x4df961[_0x4f08('0x21')];var _0x159121;if(_0x17e334>=_0x5c0113){_0x17e334=_0x5c0113;_0x159121=0xc8;}else{_0x159121=0xce;}_0x4a8708[_0x4f08('0x1d')](_0x159121);return _0x4a8708[_0x4f08('0x24')](_0x4f08('0x25'),_0x1bcc96+'-'+_0x17e334+'/'+_0x5c0113)[_0x4f08('0x1f')](_0x134115);}return null;};}function patchUpdates(_0x44838b){return function(_0x1803d2){try{jsonpatch['apply'](_0x1803d2,_0x44838b,!![]);}catch(_0x3acc73){return BPromise['reject'](_0x3acc73);}return _0x1803d2[_0x4f08('0x26')]();};}function saveUpdates(_0x42f6cf,_0x50c3fd){return function(_0x23c64f){if(_0x23c64f){return _0x23c64f[_0x4f08('0x27')](_0x42f6cf)[_0x4f08('0x28')](function(_0x583e08){return _0x583e08;});}return null;};}function removeEntity(_0x19f0de,_0x1cd403){return function(_0x131fa4){if(_0x131fa4){return _0x131fa4[_0x4f08('0x29')]()['then'](function(){_0x19f0de[_0x4f08('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1af1,_0x169a57){return function(_0x3918dc){if(!_0x3918dc){_0x4a1af1[_0x4f08('0x1c')](0x194);}return _0x3918dc;};}function handleError(_0x1d8098,_0x1ed7fd){_0x1ed7fd=_0x1ed7fd||0x1f4;return function(_0xbc38a9){logger[_0x4f08('0x2a')](_0xbc38a9[_0x4f08('0x2b')]);if(_0xbc38a9[_0x4f08('0x2c')]){delete _0xbc38a9['name'];}_0x1d8098[_0x4f08('0x1d')](_0x1ed7fd)['send'](_0xbc38a9);};}function getInteractionUsers(_0x2dbcb6,_0x1384e2){return new BPromise(function(_0x1501fb,_0x37b663){try{if(_0x1384e2[_0x2dbcb6['id']]){_0x2dbcb6[_0x4f08('0x2d')]=_['map'](_0x1384e2[_0x2dbcb6['id']],function(_0xe38217){return{'id':_0xe38217['id'],'fullname':_0xe38217[_0x4f08('0x2e')]};});}}catch(_0x1a5893){_0x37b663(_0x1a5893);}_0x1501fb(_0x2dbcb6);});}function getInteractionTags(_0x1938a1,_0x23cb4c){return new BPromise(function(_0x4c227e,_0x13dd4f){try{if(_0x1938a1[_0x4f08('0x2f')]){_0x1938a1[_0x4f08('0x30')]=[];_0x1938a1[_0x4f08('0x2f')]['split'](',')[_0x4f08('0x31')](function(_0x37c4b0){_0x1938a1['Tags']['push'](_0x23cb4c[_0x37c4b0]);});}delete _0x1938a1[_0x4f08('0x2f')];}catch(_0x1459eb){_0x13dd4f(_0x1459eb);}_0x4c227e(_0x1938a1);});}function updateOpenchannelInteraction(_0x335339,_0x34c405,_0xe18c98){return new BPromise(function(_0x2d54a8,_0x52d773){return getInteractionUsers(_0x335339,_0xe18c98)[_0x4f08('0x28')](function(_0x1c0e1b){return getInteractionTags(_0x1c0e1b,_0x34c405);})['then'](function(_0x3e2fe8){return getStateInteraction(_0x3e2fe8);})['then'](function(_0x4003d6){_0x2d54a8(_0x4003d6);})[_0x4f08('0x32')](function(_0x430da7){_0x52d773(_0x430da7);});});}function getStateInteraction(_0x42d0df){return new BPromise(function(_0x18d313){_0x42d0df['waiting']=0x0;_0x42d0df['talking']=0x0;_0x42d0df[_0x4f08('0x33')]=0x0;_0x42d0df[_0x4f08('0x34')]=0x0;_0x42d0df[_0x4f08('0x35')]=0x0;if(!_0x42d0df[_0x4f08('0x36')]&&!_0x42d0df[_0x4f08('0x37')]){_0x42d0df[_0x4f08('0x38')]+=0x1;}if(!_0x42d0df[_0x4f08('0x36')]&&_0x42d0df[_0x4f08('0x37')]){_0x42d0df['talking']+=0x1;if(_0x42d0df[_0x4f08('0x38')]){_0x42d0df[_0x4f08('0x38')]-=0x1;}}if(_0x42d0df[_0x4f08('0x36')]&&_0x42d0df[_0x4f08('0x37')]){_0x42d0df[_0x4f08('0x33')]+=0x1;if(_0x42d0df[_0x4f08('0x39')]){_0x42d0df[_0x4f08('0x39')]-=0x1;}}if(_0x42d0df[_0x4f08('0x36')]&&!_0x42d0df[_0x4f08('0x37')]){_0x42d0df[_0x4f08('0x34')]+=0x1;if(_0x42d0df['waiting']){_0x42d0df[_0x4f08('0x38')]-=0x1;}}_0x42d0df[_0x4f08('0x35')]+=0x1;_0x18d313(_0x42d0df);});}exports[_0x4f08('0x3a')]=function(_0x322866,_0x350ad5){var _0x441984={},_0x40d14e={},_0x12162f={'count':0x0,'rows':[]};var _0x1d9411=_[_0x4f08('0x3b')](db[_0x4f08('0x3c')][_0x4f08('0x3d')],function(_0x24c94f){return{'name':_0x24c94f[_0x4f08('0x3e')],'type':_0x24c94f[_0x4f08('0x3f')][_0x4f08('0x40')]};});_0x40d14e[_0x4f08('0x41')]=_[_0x4f08('0x3b')](_0x1d9411,'name');_0x40d14e['query']=_[_0x4f08('0x42')](_0x322866[_0x4f08('0x43')]);_0x40d14e['filters']=_[_0x4f08('0x44')](_0x40d14e[_0x4f08('0x41')],_0x40d14e[_0x4f08('0x43')]);_0x441984['attributes']=_[_0x4f08('0x44')](_0x40d14e[_0x4f08('0x41')],qs[_0x4f08('0x45')](_0x322866[_0x4f08('0x43')][_0x4f08('0x45')]));_0x441984[_0x4f08('0x46')]=_0x441984['attributes'][_0x4f08('0x47')]?_0x441984[_0x4f08('0x46')]:_0x40d14e[_0x4f08('0x41')];if(!_0x322866['query'][_0x4f08('0x48')](_0x4f08('0x49'))){_0x441984[_0x4f08('0x21')]=qs['limit'](_0x322866['query'][_0x4f08('0x21')]);_0x441984[_0x4f08('0x23')]=qs[_0x4f08('0x23')](_0x322866[_0x4f08('0x43')][_0x4f08('0x23')]);}_0x441984[_0x4f08('0x4a')]=qs[_0x4f08('0x4b')](_0x322866[_0x4f08('0x43')]['sort']);_0x441984[_0x4f08('0x4c')]=qs[_0x4f08('0x4d')](_[_0x4f08('0x4e')](_0x322866[_0x4f08('0x43')],_0x40d14e['filters']),_0x1d9411);var _0x219554=[];var _0x3a9827=squel[_0x4f08('0x4f')]()[_0x4f08('0x50')]('id')[_0x4f08('0x50')](_0x4f08('0x2c'))['field']('color')[_0x4f08('0x51')](_0x4f08('0x52'));var _0xf4c41=squel[_0x4f08('0x4f')]()['field'](_0x4f08('0x53'))[_0x4f08('0x50')](_0x4f08('0x54'))[_0x4f08('0x50')]('ui.OpenchannelInteractionId')[_0x4f08('0x51')](_0x4f08('0x55'),'ui')[_0x4f08('0x56')](_0x4f08('0x57'),'u',_0x4f08('0x58'));var _0x2475dd=squel['select']()['from']('openchannel_interactions','i')[_0x4f08('0x56')](_0x4f08('0x59'),'c',_0x4f08('0x5a'))['left_join'](_0x4f08('0x57'),'o',_0x4f08('0x5b'))[_0x4f08('0x56')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0x4f08('0x5c'),'me',_0x4f08('0x5d'))['left_join'](_0x4f08('0x5e'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x4f08('0x52'),'t',_0x4f08('0x5f'));var _0x363216=squel[_0x4f08('0x60')]();var _0x241962=[];var _0x5d86d6=squel[_0x4f08('0x60')]();var _0x6f7738;if(_0x322866[_0x4f08('0x43')][_0x4f08('0x61')]){_0x6f7738=as['parseSearch'](_0x322866[_0x4f08('0x43')][_0x4f08('0x61')]);var _0x167f2f=_0x6f7738['sqlOperator'];for(var _0x5f065b=0x0;_0x5f065b<_0x6f7738[_0x4f08('0x62')]['length'];_0x5f065b++){var _0x31397d=_0x6f7738[_0x4f08('0x62')][_0x5f065b];var _0x29da31='i';var _0x13433c=_[_0x4f08('0x63')](_0x1d9411,[_0x4f08('0x2c'),_0x31397d[_0x4f08('0x50')]]);if(!_0x13433c){switch(_0x31397d[_0x4f08('0x50')]){case _0x4f08('0x64'):if(_0x31397d[_0x4f08('0x65')]==0x1){_0x2475dd[_0x4f08('0x66')]('`'+_0x31397d[_0x4f08('0x50')]+_0x4f08('0x67'));}else{_0x2475dd[_0x4f08('0x66')]('`'+_0x31397d[_0x4f08('0x50')]+_0x4f08('0x68'));}break;case _0x4f08('0x69'):if(_0x31397d[_0x4f08('0x6a')]===_0x4f08('0x6b')){if(_0x31397d[_0x4f08('0x65')][_0x4f08('0x6c')]('\x20')[_0x4f08('0x47')]>0x1){_0x363216[_0x167f2f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x31397d['value']),null);}else{var _0x3bb867='%'+_0x31397d[_0x4f08('0x65')]+'%';_0x363216[_0x167f2f](_0x4f08('0x6d'),_0x3bb867,_0x3bb867,_0x3bb867);}}else{_0x13433c=_[_0x4f08('0x63')](_0x1d9411,[_0x4f08('0x2c'),_0x4f08('0x6e')]);_0x31397d[_0x4f08('0x50')]=_0x4f08('0x6e');_0x397817=as[_0x4f08('0x6f')](_0x29da31,_0x13433c[_0x4f08('0x3f')],_0x31397d);_0x363216[_0x167f2f](_0x397817[_0x4f08('0x70')],_0x397817[_0x4f08('0x65')][_0x4f08('0x71')],_0x397817['value'][_0x4f08('0x1e')]);}break;case'Tag':var _0xc03035=_0x31397d[_0x4f08('0x65')][_0x4f08('0x6c')](',')[_0x4f08('0x3b')](function(_0x3fd009){return Number(_0x3fd009);});_0xc03035['forEach'](function(_0x4ecf8b){_0x5d86d6['or'](_0x4f08('0x72'),'%,'+_0x4ecf8b+',%');});_0x241962=_[_0x4f08('0x73')](_0x241962,_0xc03035);break;case _0x4f08('0x74'):if(_0x31397d[_0x4f08('0x6a')]===_0x4f08('0x6b')){_0x363216[_0x167f2f](_0x4f08('0x75'),'%'+_0x31397d[_0x4f08('0x65')]+'%',null);}else{_0x13433c=_[_0x4f08('0x63')](_0x1d9411,[_0x4f08('0x2c'),_0x4f08('0x37')]);_0x31397d['field']=_0x4f08('0x37');_0x397817=as[_0x4f08('0x6f')](_0x29da31,_0x13433c[_0x4f08('0x3f')],_0x31397d);_0x363216[_0x167f2f](_0x397817['text'],_0x397817[_0x4f08('0x65')][_0x4f08('0x71')],_0x397817['value'][_0x4f08('0x1e')]);}break;case _0x4f08('0x76'):_0x397817=as['buildExpression']('me',null,_0x31397d);_0x363216[_0x167f2f](_0x397817[_0x4f08('0x70')],_0x397817['value'][_0x4f08('0x71')],_0x397817['value'][_0x4f08('0x1e')]);break;}}else{var _0x397817=as[_0x4f08('0x6f')](_0x29da31,_0x13433c[_0x4f08('0x3f')],_0x31397d);_0x363216[_0x167f2f](_0x397817[_0x4f08('0x70')],_0x397817[_0x4f08('0x65')][_0x4f08('0x71')],_0x397817['value'][_0x4f08('0x1e')]);}}}else{var _0x56e495=_(_0x322866[_0x4f08('0x43')])[_0x4f08('0x42')]()[_0x4f08('0x3b')](function(_0x264b66){return _[_0x4f08('0x77')](_0x1d9411,['name',_0x264b66])?_0x264b66:undefined;})['compact']()[_0x4f08('0x65')]();if(!_['isEmpty'](_0x56e495)){_0x56e495[_0x4f08('0x31')](function(_0x1b1ce3){if(_0x1b1ce3==='OpenchannelAccountId'){_0x2475dd[_0x4f08('0x4c')](_0x4f08('0x78'),[]['concat'](_0x322866[_0x4f08('0x43')][_0x1b1ce3]));}else if(_0x1b1ce3===_0x4f08('0x79')){var _0x1f2c1f=JSON[_0x4f08('0x7a')](_0x322866[_0x4f08('0x43')][_0x1b1ce3])[_0x4f08('0x7b')];var _0x1f2368=JSON[_0x4f08('0x7a')](_0x322866['query'][_0x1b1ce3])[_0x4f08('0x7c')];_0x2475dd[_0x4f08('0x4c')](_0x4f08('0x7d'),_0x1f2c1f,_0x1f2368);}else{if(_0x322866['query'][_0x1b1ce3]===_0x4f08('0x7e')){_0x2475dd['where']('i.'+_0x1b1ce3+_0x4f08('0x7f'));}else{_0x2475dd[_0x4f08('0x4c')]('i.'+_0x1b1ce3+_0x4f08('0x80'),_0x322866[_0x4f08('0x43')][_0x1b1ce3]);}}});}if(_0x322866[_0x4f08('0x43')][_0x4f08('0x81')]){if(_0x322866[_0x4f08('0x43')][_0x4f08('0x81')]==0x1){_0x2475dd[_0x4f08('0x66')]('`unreadMessages`\x20=\x200');}else{_0x2475dd[_0x4f08('0x66')](_0x4f08('0x82'));}}if(_0x322866[_0x4f08('0x43')][_0x4f08('0x83')]){_0x241962=_[_0x4f08('0x84')](_0x322866[_0x4f08('0x43')]['tag'])?_0x322866['query'][_0x4f08('0x83')]:new Array(_0x322866[_0x4f08('0x43')][_0x4f08('0x83')]);_0x241962[_0x4f08('0x31')](function(_0x429e43){_0x5d86d6['or'](_0x4f08('0x72'),'%,'+_0x429e43+',%');});}if(_0x322866[_0x4f08('0x43')][_0x4f08('0x85')]){var _0x131cdc=_0x322866[_0x4f08('0x43')][_0x4f08('0x85')]['replace']('\x5c','\x5c\x5c')[_0x4f08('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x131cdc)){_0x363216['or'](_0x4f08('0x87'),_0x131cdc+'%');}else{_0x363216['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x131cdc))['or'](_0x4f08('0x88'),_0x131cdc+'%')['or'](_0x4f08('0x89'),_0x131cdc+'%');}}}_0x2475dd[_0x4f08('0x4c')](_0x363216);_0x2475dd[_0x4f08('0x8a')]('i.id');var _0x3a9b32={'type':db[_0x4f08('0x8b')][_0x4f08('0x8c')][_0x4f08('0x8d')],'raw':!![]};var _0x4ecd00=_0x2475dd[_0x4f08('0x8e')]();_0x4ecd00[_0x4f08('0x50')](_0x4f08('0x8f'));_0x4ecd00[_0x4f08('0x50')](_0x4f08('0x90'),_0x4f08('0x64'));if(_0x441984[_0x4f08('0x4a')]){_0x441984[_0x4f08('0x4a')]['forEach'](function(_0xf04682){var _0x26c7a0=_0xf04682[0x0]===_0x4f08('0x91')?_0xf04682[0x0]:'i.'+_0xf04682[0x0];_0x2475dd[_0x4f08('0x4a')](_0x26c7a0,_0xf04682[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4f08('0x92')](_0x241962)){_0x2475dd['having'](_0x5d86d6);_0x4ecd00[_0x4f08('0x4c')](_0x4f08('0x93'),_0x241962);}BPromise[_0x4f08('0x94')]()[_0x4f08('0x28')](function(){if(!_0x6f7738){if(_0x322866[_0x4f08('0x43')][_0x4f08('0x95')])return;_0x4ecd00[_0x4f08('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2475dd[_0x4f08('0x4c')](_0x4f08('0x96'));return;}if(_0x322866[_0x4f08('0x97')]['role']!==_0x4f08('0x98'))return;return _0x322866[_0x4f08('0x97')][_0x4f08('0x99')]({'attributes':['id'],'raw':!![]})[_0x4f08('0x28')](function(_0x1156d0){if(_[_0x4f08('0x92')](_0x1156d0)){_0x4ecd00['where'](_0x4f08('0x9a'));_0x2475dd[_0x4f08('0x4c')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x4ecd00[_0x4f08('0x4c')](_0x4f08('0x78'),_['map'](_0x1156d0,'id'));_0x2475dd[_0x4f08('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x4f08('0x3b')](_0x1156d0,'id'));}});})[_0x4f08('0x28')](function(){if(_0x322866[_0x4f08('0x97')]['role']===_0x4f08('0x98')&&!_0x6f7738&&!_0x322866[_0x4f08('0x43')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x4f08('0x43')](_0x4ecd00[_0x4f08('0x9b')](),_0x3a9b32);})['then'](function(_0x5407e5){_0x12162f[_0x4f08('0x22')]=_0x5407e5[_0x4f08('0x47')];if(_0x12162f['count']===0x0)return[];return db[_0x4f08('0x9c')][_0x4f08('0x43')](_0x3a9827['toString'](),_0x3a9b32)[_0x4f08('0x28')](function(_0x336917){_0x219554=_['keyBy'](_0x336917,'id');_0x3a9b32=_['merge'](_0x3a9b32,{'model':db[_0x4f08('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x322866['query'][_0x4f08('0x45')]){_0x441984[_0x4f08('0x46')][_0x4f08('0x31')](function(_0x4621){_0x2475dd['field']('i.'+_0x4621);});}else{_0x2475dd[_0x4f08('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4f08('0x64'));_0x2475dd[_0x4f08('0x50')](_0x4f08('0x9d'),'Account.key');_0x2475dd[_0x4f08('0x50')](_0x4f08('0x9e'),_0x4f08('0x9f'));_0x2475dd[_0x4f08('0x50')](_0x4f08('0xa0'),_0x4f08('0x91'));_0x2475dd[_0x4f08('0x50')](_0x4f08('0xa1'));_0x2475dd['field'](_0x4f08('0xa2'),_0x4f08('0xa3'));_0x2475dd[_0x4f08('0x50')]('c.lastName','Contact.lastName');_0x2475dd[_0x4f08('0x50')]('c.email','Contact.email');_0x2475dd[_0x4f08('0x50')](_0x4f08('0xa4'),_0x4f08('0xa5'));_0x2475dd['field'](_0x4f08('0xa6'),_0x4f08('0xa7'));_0x2475dd[_0x4f08('0x50')](_0x4f08('0xa8'),_0x4f08('0xa9'));_0x2475dd[_0x4f08('0x50')]('o.fullname',_0x4f08('0xaa'));_0x2475dd[_0x4f08('0x50')](_0x4f08('0xab'),_0x4f08('0xac'));_0x2475dd[_0x4f08('0x50')](_0x4f08('0xad'),_0x4f08('0x2f'));}if(_0x441984[_0x4f08('0x21')])_0x2475dd['limit'](_0x441984['limit']);if(_0x441984['offset'])_0x2475dd[_0x4f08('0x23')](_0x441984[_0x4f08('0x23')]);return db[_0x4f08('0x9c')][_0x4f08('0x43')](_0x2475dd[_0x4f08('0x9b')](),_0x3a9b32);})[_0x4f08('0x28')](function(_0xc169bb){if(_0xc169bb[_0x4f08('0x47')]>0x0)_0xf4c41['where'](_0x4f08('0xae'),_[_0x4f08('0x3b')](_0xc169bb,'id'));return db['sequelize']['query'](_0xf4c41[_0x4f08('0x9b')](),_0x3a9b32)['then'](function(_0x3771a1){var _0x419f15=_[_0x4f08('0xaf')](_0x3771a1,_0x4f08('0xb0'));var _0x5ce302=[];_0xc169bb[_0x4f08('0x31')](function(_0x45b8a3){_0x5ce302['push'](updateOpenchannelInteraction(_0x45b8a3,_0x219554,_0x419f15));});return BPromise['all'](_0x5ce302);});});})['then'](function(_0xe114da){_0x12162f[_0x4f08('0xb1')]=_0xe114da;return _0x12162f;})['then'](respondWithFilteredResult(_0x350ad5,_0x441984))[_0x4f08('0x32')](handleError(_0x350ad5,null));};exports[_0x4f08('0xb2')]=function(_0x4e47f9,_0x11a210){var _0x875cc={};if(_0x4e47f9['query'][_0x4f08('0x3f')]&&_0x4e47f9[_0x4f08('0x43')][_0x4f08('0x3f')]==='from'){_0x875cc[_0x4f08('0x51')]=_0x4e47f9[_0x4f08('0xb3')]['id'];}else{_0x875cc['id']=_0x4e47f9[_0x4f08('0xb3')]['id'];}var _0x4dc4be={'raw':![],'where':_0x875cc},_0x409c6b={};_0x409c6b[_0x4f08('0x41')]=_['keys'](db[_0x4f08('0x3c')][_0x4f08('0x3d')]);_0x409c6b[_0x4f08('0x43')]=_['keys'](_0x4e47f9[_0x4f08('0x43')]);_0x409c6b[_0x4f08('0x4d')]=_[_0x4f08('0x44')](_0x409c6b[_0x4f08('0x41')],_0x409c6b[_0x4f08('0x43')]);_0x4dc4be[_0x4f08('0x46')]=_['intersection'](_0x409c6b[_0x4f08('0x41')],qs[_0x4f08('0x45')](_0x4e47f9[_0x4f08('0x43')][_0x4f08('0x45')]));_0x4dc4be[_0x4f08('0x46')]=_0x4dc4be[_0x4f08('0x46')][_0x4f08('0x47')]?_0x4dc4be[_0x4f08('0x46')]:_0x409c6b[_0x4f08('0x41')];if(_0x4e47f9['query'][_0x4f08('0xb4')]){_0x4dc4be[_0x4f08('0xb5')]=[{'all':!![]}];}_0x4dc4be=_[_0x4f08('0xb6')]({},_0x4dc4be,_0x4e47f9['options']);return db[_0x4f08('0x3c')][_0x4f08('0x63')](_0x4dc4be)['then'](handleEntityNotFound(_0x11a210,null))['then'](respondWithResult(_0x11a210,null))[_0x4f08('0x32')](handleError(_0x11a210,null));};exports[_0x4f08('0xb7')]=function(_0x39bc44,_0x1e813b){return db[_0x4f08('0x3c')][_0x4f08('0xb7')](_0x39bc44[_0x4f08('0x76')],{})[_0x4f08('0x28')](respondWithResult(_0x1e813b,0xc9))[_0x4f08('0x32')](handleError(_0x1e813b,null));};exports[_0x4f08('0x27')]=function(_0x8b92c8,_0x90d0bc){if(_0x8b92c8[_0x4f08('0x76')]['id']){delete _0x8b92c8['body']['id'];}return db[_0x4f08('0x3c')][_0x4f08('0x63')]({'where':{'id':_0x8b92c8[_0x4f08('0xb3')]['id']}})[_0x4f08('0x28')](handleEntityNotFound(_0x90d0bc,null))[_0x4f08('0x28')](saveUpdates(_0x8b92c8[_0x4f08('0x76')],null))[_0x4f08('0x28')](respondWithResult(_0x90d0bc,null))[_0x4f08('0x32')](handleError(_0x90d0bc,null));};exports[_0x4f08('0x29')]=function(_0x1acbbf,_0x219b0c){return db[_0x4f08('0x3c')]['find']({'where':{'id':_0x1acbbf[_0x4f08('0xb3')]['id']}})[_0x4f08('0x28')](handleEntityNotFound(_0x219b0c,null))['then'](removeEntity(_0x219b0c,null))[_0x4f08('0x32')](handleError(_0x219b0c,null));};exports[_0x4f08('0xb8')]=function(_0x263d73,_0x452a6b){return db[_0x4f08('0x3c')][_0x4f08('0xb8')]()['then'](respondWithResult(_0x452a6b,null))[_0x4f08('0x32')](handleError(_0x452a6b,null));};exports[_0x4f08('0xb9')]=function(_0xac805c,_0x2a5b64,_0x4f0a2c){return db[_0x4f08('0xba')]['find']({'where':{'id':_0xac805c[_0x4f08('0xb3')]['id']}})[_0x4f08('0x28')](handleEntityNotFound(_0x2a5b64,null))[_0x4f08('0x28')](function(_0x474fa7){if(_0x474fa7){return _0x474fa7[_0x4f08('0xb9')](_0xac805c['body']['ids'],_[_0x4f08('0xbb')](_0xac805c['body'],[_0x4f08('0xbc'),'id'])||{});}})[_0x4f08('0x28')](respondWithResult(_0x2a5b64,null))[_0x4f08('0x32')](handleError(_0x2a5b64,null));};exports['getMessages']=function(_0xbf9c8d,_0x557141,_0x38b669){var _0x222475={'raw':![],'where':{}};var _0x1c340b={};var _0xb4cdc4={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0xbf9c8d[_0x4f08('0xb3')]['id']}})[_0x4f08('0x28')](handleEntityNotFound(_0x557141,null))[_0x4f08('0x28')](function(_0x1e8acf){if(_0x1e8acf){_0x1c340b[_0x4f08('0x41')]=_[_0x4f08('0x42')](db[_0x4f08('0xba')]['rawAttributes']);_0x1c340b[_0x4f08('0x43')]=_[_0x4f08('0x42')](_0xbf9c8d[_0x4f08('0x43')]);_0x1c340b[_0x4f08('0x4d')]=_[_0x4f08('0x44')](_0x1c340b[_0x4f08('0x41')],_0x1c340b[_0x4f08('0x43')]);_0x222475['attributes']=_[_0x4f08('0x44')](_0x1c340b[_0x4f08('0x41')],qs[_0x4f08('0x45')](_0xbf9c8d[_0x4f08('0x43')]['fields']));_0x222475[_0x4f08('0x46')]=_0x222475[_0x4f08('0x46')][_0x4f08('0x47')]?_0x222475['attributes']:_0x1c340b['model'];if(!_0xbf9c8d[_0x4f08('0x43')][_0x4f08('0x48')]('nolimit')){_0x222475[_0x4f08('0x21')]=qs[_0x4f08('0x21')](_0xbf9c8d[_0x4f08('0x43')][_0x4f08('0x21')]);_0x222475[_0x4f08('0x23')]=qs[_0x4f08('0x23')](_0xbf9c8d[_0x4f08('0x43')][_0x4f08('0x23')]);}_0x222475[_0x4f08('0x4a')]=qs[_0x4f08('0x4b')](_0xbf9c8d['query'][_0x4f08('0x4b')]);_0x222475[_0x4f08('0x4c')]=qs[_0x4f08('0x4d')](_[_0x4f08('0x4e')](_0xbf9c8d[_0x4f08('0x43')],_0x1c340b[_0x4f08('0x4d')]));_0x222475[_0x4f08('0x4c')][_0x4f08('0xb0')]=_0x1e8acf['id'];if(_0xbf9c8d[_0x4f08('0x43')][_0x4f08('0x85')]){_0x222475[_0x4f08('0x4c')]=_[_0x4f08('0xb6')](_0x222475[_0x4f08('0x4c')],{'$or':_[_0x4f08('0x3b')](_0x222475[_0x4f08('0x46')],function(_0xa43ef9){var _0x59ee63={};_0x59ee63[_0xa43ef9]={'$like':'%'+_0xbf9c8d['query'][_0x4f08('0x85')]+'%'};return _0x59ee63;})});}if(_0xbf9c8d[_0x4f08('0x43')][_0x4f08('0x7b')]){var _0x47d6e0=_0xbf9c8d['query'][_0x4f08('0x7b')][_0x4f08('0x6c')](',');var _0x2d5194={};_0x2d5194[_0x47d6e0[0x0]]={'$gte':moment(_0x47d6e0[0x1])['format'](_0x4f08('0xbd'))};_0x222475[_0x4f08('0x4c')]=_['merge'](_0x222475['where'],_0x2d5194);}_0x222475=_[_0x4f08('0xb6')]({},_0x222475,_0xbf9c8d['options']);return db[_0x4f08('0xba')][_0x4f08('0x22')]({'where':_0x222475[_0x4f08('0x4c')]})[_0x4f08('0x28')](function(_0x113515){_0xb4cdc4[_0x4f08('0x22')]=_0x113515;if(_0xbf9c8d[_0x4f08('0x43')][_0x4f08('0xb4')]){_0x222475[_0x4f08('0xb5')]=[{'all':!![]}];}return db[_0x4f08('0xba')]['findAll'](_0x222475);})['then'](function(_0x213875){_0xb4cdc4[_0x4f08('0xb1')]=_0x213875;return _0xb4cdc4;});}})[_0x4f08('0x28')](respondWithFilteredResult(_0x557141,_0x222475))[_0x4f08('0x32')](handleError(_0x557141,null));};exports['addTags']=function(_0x48a074,_0x1acae8,_0x3f8a66){return db[_0x4f08('0x3c')][_0x4f08('0x63')]({'where':{'id':_0x48a074[_0x4f08('0xb3')]['id']}})['then'](handleEntityNotFound(_0x1acae8,null))['then'](function(_0x40eb62){if(_0x40eb62){return _0x40eb62[_0x4f08('0xbe')](_0x48a074[_0x4f08('0x76')]['ids'],_[_0x4f08('0xbb')](_0x48a074[_0x4f08('0x76')],[_0x4f08('0xbc'),'id'])||{})[_0x4f08('0xbf')](function(){return db[_0x4f08('0xc0')][_0x4f08('0xc1')]({'attributes':['id','name',_0x4f08('0xc2')],'where':{'id':_0x48a074[_0x4f08('0x76')][_0x4f08('0xbc')]}});})[_0x4f08('0x28')](function(_0x39f0ab){socket[_0x4f08('0xc3')](_0x4f08('0xc4'),{'id':Number(_0x48a074[_0x4f08('0xb3')]['id']),'tags':_0x39f0ab||[]});return{'id':Number(_0x48a074['params']['id']),'tags':_0x39f0ab||[]};});}})[_0x4f08('0x28')](respondWithResult(_0x1acae8,null))[_0x4f08('0x32')](handleError(_0x1acae8,null));};exports['removeTags']=function(_0x3fdaa2,_0x1a9815,_0x49cc7){return db[_0x4f08('0x3c')][_0x4f08('0x63')]({'where':{'id':_0x3fdaa2[_0x4f08('0xb3')]['id']}})[_0x4f08('0x28')](handleEntityNotFound(_0x1a9815,null))[_0x4f08('0x28')](function(_0x2ace16){if(_0x2ace16){return _0x2ace16[_0x4f08('0xc5')](_0x3fdaa2[_0x4f08('0x43')]['ids']);}})[_0x4f08('0x28')](respondWithStatusCode(_0x1a9815,null))[_0x4f08('0x32')](handleError(_0x1a9815,null));};exports[_0x4f08('0xc6')]=function(_0x28b359,_0x5b91ed){var _0xbd0d2e=moment()[_0x4f08('0xc7')]()[_0x4f08('0x9b')]();var _0x3e096e=path[_0x4f08('0xc8')](config[_0x4f08('0xc9')],_0x4f08('0xca'),_0x4f08('0xcb'),_0x4f08('0xcc'));var _0x3bad5c=path[_0x4f08('0xc8')](config[_0x4f08('0xc9')],'server',_0x4f08('0xcb'),_0x4f08('0xcd'));var _0x216f92=path[_0x4f08('0xc8')](_0x3e096e,_0xbd0d2e);var _0x5f5c4a=util['format'](_0x4f08('0xce'),_0x28b359['params']['id'],_0xbd0d2e);var _0x2915de=path[_0x4f08('0xc8')](_0x3e096e,_0x5f5c4a);var _0x416620=[];_0x416620[_0x4f08('0xcf')]({'model':db[_0x4f08('0x74')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x416620[_0x4f08('0xcf')]({'model':db[_0x4f08('0xd0')],'as':_0x4f08('0x69'),'attributes':['id',_0x4f08('0xd1'),'lastName'],'raw':!![]});if(_0x28b359[_0x4f08('0x43')][_0x4f08('0xcd')]){_0x416620[_0x4f08('0xcf')]({'model':db[_0x4f08('0xd2')],'as':_0x4f08('0xd2'),'raw':!![]});}var _0x45c8af=[{'model':db[_0x4f08('0xba')],'as':_0x4f08('0xd3'),'attributes':['id',_0x4f08('0x76'),'createdAt',_0x4f08('0xd4'),_0x4f08('0xd5'),_0x4f08('0x81')],'include':_0x416620}];_0x45c8af[_0x4f08('0xcf')]({'model':db[_0x4f08('0xd6')],'as':_0x4f08('0xd7'),'attributes':['id',_0x4f08('0x2c')]});_0x45c8af[_0x4f08('0xcf')]({'model':db[_0x4f08('0x74')],'as':_0x4f08('0xd8'),'attributes':['id',_0x4f08('0x2e')]});return db['OpenchannelInteraction'][_0x4f08('0x63')]({'where':{'id':_0x28b359[_0x4f08('0xb3')]['id']},'include':_0x45c8af})['then'](handleEntityNotFound(_0x5b91ed,null))[_0x4f08('0x28')](function(_0x3880ff){if(_0x3880ff){var _0x38e041=_0x3880ff[_0x4f08('0xd9')]({'plain':!![]});fs[_0x4f08('0xda')](_0x216f92);var _0x50db91={'channel':_0x4f08('0xdb'),'account':_0x38e041[_0x4f08('0xd7')][_0x4f08('0x2c')],'agent':_0x38e041[_0x4f08('0xd8')]?_0x38e041[_0x4f08('0xd8')][_0x4f08('0x2e')]:_0x4f08('0xdc'),'createdAt':moment(_0x38e041['createdAt'])['format'](_0x4f08('0xbd'))[_0x4f08('0x9b')](),'closedAt':_0x38e041[_0x4f08('0x36')]?moment(_0x38e041[_0x4f08('0xdd')])[_0x4f08('0xde')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x38e041[_0x4f08('0xdf')],'visibility':_0x38e041[_0x4f08('0xe0')]?_0x4f08('0xe1'):_0x4f08('0xe2'),'messages':_(_0x38e041[_0x4f08('0xd3')])[_0x4f08('0x85')]({'secret':![]})[_0x4f08('0x3b')](function(_0x1a25ca){if(_0x1a25ca['Attachment']){var _0x355a7f=path[_0x4f08('0xc8')](_0x3bad5c,_0x1a25ca[_0x4f08('0xd2')][_0x4f08('0xe3')]);if(fs[_0x4f08('0xe4')](_0x355a7f)){fs[_0x4f08('0xe5')](_0x355a7f)[_0x4f08('0xe6')](fs[_0x4f08('0xe7')](path[_0x4f08('0xc8')](_0x216f92,_0x1a25ca[_0x4f08('0xd2')][_0x4f08('0xe3')])));}}return{'date':moment(_0x1a25ca[_0x4f08('0x79')])[_0x4f08('0xde')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1a25ca[_0x4f08('0xd4')]===_0x4f08('0xe8')?_0x1a25ca[_0x4f08('0x74')]?_0x1a25ca[_0x4f08('0x74')][_0x4f08('0x2e')]:'System':_0x1a25ca['Contact'][_0x4f08('0xd1')]+(_0x1a25ca['Contact'][_0x4f08('0xe9')]?'\x20'+_0x1a25ca[_0x4f08('0x69')]['lastName']:''),'body':_0x1a25ca[_0x4f08('0xd2')]?_0x1a25ca[_0x4f08('0xd2')][_0x4f08('0xe3')]:_0x1a25ca['body'],'direction':_0x1a25ca[_0x4f08('0xd4')]===_0x4f08('0xe8')?'A':'C','secret':_0x1a25ca['secret'],'read':_0x1a25ca['read'],'attachment':_0x1a25ca[_0x4f08('0xd2')]};})[_0x4f08('0x65')]()};return ejs[_0x4f08('0xea')](path[_0x4f08('0xc8')](config['root'],_0x4f08('0xca'),_0x4f08('0xeb'),_0x4f08('0xec')),{'interaction':_0x50db91})['then'](function(_0x4fa0ff){var _0x4c0a77=path['join'](_0x216f92,_0x4f08('0xed')+_0x38e041['id']+'-'+_0xbd0d2e+'.pdf');var _0x6eb17={'path':_0x4c0a77,'channel':_0x4f08('0xdb'),'interactionId':_0x38e041['id']};return pdf[_0x4f08('0xee')](_0x4fa0ff,_0x6eb17);})[_0x4f08('0x28')](function(){return new BPromise(function(_0x12e3b6,_0x3070d8){zipdir(_0x216f92,{'saveTo':_0x2915de},function(_0x1bac77,_0x265ea8){if(_0x1bac77)return _0x3070d8(_0x1bac77);return _0x12e3b6(_0x265ea8);});})['then'](function(){return new BPromise(function(_0x449def,_0x187aed){rimraf(_0x216f92,function(_0x5407f2){if(_0x5407f2)_0x187aed(_0x5407f2);return _0x449def();});});})[_0x4f08('0x28')](function(){return _0x5b91ed[_0x4f08('0xc6')](_0x2915de,_0x5f5c4a,function(_0x1745c8){if(_0x1745c8){console[_0x4f08('0xef')](_0x4f08('0xf0'),_0x1745c8);}else{fs[_0x4f08('0xf1')](_0x2915de);}});});});}else{return _0x5b91ed[_0x4f08('0x1c')](0xc8);}})[_0x4f08('0x32')](handleError(_0x5b91ed,null));}; \ No newline at end of file +var _0xcc5f=['out','server','downloadInteraction.ejs','.pdf','Openchannel','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','offset','count','apply','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','talking','answered','unmanaged','closed','UserId','waiting','total','OpenchannelInteraction','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','select','tools_tags','field','left_join','users','u.id\x20=\x20ui.UserId','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','find','body','some','compact','isEmpty','OpenchannelAccountId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','from','params','includeAll','merge','create','describe','OpenchannelMessage','addMessage','omit','ids','findOne','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','findAll','removeTags','download','root','files','join','attachments','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','N.A.','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System'];(function(_0x4ef05e,_0x18b00a){var _0x241f30=function(_0x5440db){while(--_0x5440db){_0x4ef05e['push'](_0x4ef05e['shift']());}};_0x241f30(++_0x18b00a);}(_0xcc5f,0x1d2));var _0xfcc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc5f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfcc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcc5('0x1'));var jsonpatch=require(_0xfcc5('0x2'));var rp=require(_0xfcc5('0x3'));var moment=require('moment');var BPromise=require(_0xfcc5('0x4'));var Mustache=require(_0xfcc5('0x5'));var util=require(_0xfcc5('0x6'));var path=require(_0xfcc5('0x7'));var sox=require('sox');var csv=require(_0xfcc5('0x8'));var ejs=require(_0xfcc5('0x9'));var fs=require('fs');var fs_extra=require(_0xfcc5('0xa'));var _=require(_0xfcc5('0xb'));var squel=require(_0xfcc5('0xc'));var crypto=require(_0xfcc5('0xd'));var jsforce=require(_0xfcc5('0xe'));var deskjs=require(_0xfcc5('0xf'));var toCsv=require(_0xfcc5('0x8'));var querystring=require('querystring');var Papa=require(_0xfcc5('0x10'));var Redis=require(_0xfcc5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfcc5('0x12'));var as=require(_0xfcc5('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcc5('0x14'))(_0xfcc5('0x15'));var utils=require(_0xfcc5('0x16'));var config=require(_0xfcc5('0x17'));var licenseUtil=require(_0xfcc5('0x18'));var db=require('../../mysqldb')['db'];config[_0xfcc5('0x19')]=_[_0xfcc5('0x1a')](config['redis'],{'host':_0xfcc5('0x1b'),'port':0x18eb});var socket=require(_0xfcc5('0x1c'))(new Redis(config[_0xfcc5('0x19')]));require(_0xfcc5('0x1d'))['register'](socket);function respondWithStatusCode(_0x2745b3,_0x577692){_0x577692=_0x577692||0xcc;return function(_0x38cef0){if(_0x38cef0){return _0x2745b3[_0xfcc5('0x1e')](_0x577692);}return _0x2745b3[_0xfcc5('0x1f')](_0x577692)[_0xfcc5('0x20')]();};}function respondWithResult(_0x40c381,_0x452728){_0x452728=_0x452728||0xc8;return function(_0x1c88a3){if(_0x1c88a3){return _0x40c381['status'](_0x452728)[_0xfcc5('0x21')](_0x1c88a3);}};}function respondWithFilteredResult(_0x2d838d,_0x7dc01d){return function(_0x1f755c){if(_0x1f755c){var _0x5d2c9a=typeof _0x7dc01d[_0xfcc5('0x22')]==='undefined'&&typeof _0x7dc01d['limit']==='undefined';var _0x542946=_0x1f755c['count'];var _0x19f121=_0x5d2c9a?0x0:_0x7dc01d[_0xfcc5('0x22')];var _0x2cb747=_0x5d2c9a?_0x1f755c[_0xfcc5('0x23')]:_0x7dc01d[_0xfcc5('0x22')]+_0x7dc01d['limit'];var _0x380974;if(_0x2cb747>=_0x542946){_0x2cb747=_0x542946;_0x380974=0xc8;}else{_0x380974=0xce;}_0x2d838d['status'](_0x380974);return _0x2d838d['set']('Content-Range',_0x19f121+'-'+_0x2cb747+'/'+_0x542946)[_0xfcc5('0x21')](_0x1f755c);}return null;};}function patchUpdates(_0x5a6e3f){return function(_0xfb8110){try{jsonpatch[_0xfcc5('0x24')](_0xfb8110,_0x5a6e3f,!![]);}catch(_0x34d070){return BPromise['reject'](_0x34d070);}return _0xfb8110['save']();};}function saveUpdates(_0x43be4b,_0x26a239){return function(_0x2ae308){if(_0x2ae308){return _0x2ae308[_0xfcc5('0x25')](_0x43be4b)[_0xfcc5('0x26')](function(_0x17fbba){return _0x17fbba;});}return null;};}function removeEntity(_0x5d2ae0,_0x498ae7){return function(_0x5122a4){if(_0x5122a4){return _0x5122a4[_0xfcc5('0x27')]()[_0xfcc5('0x26')](function(){_0x5d2ae0[_0xfcc5('0x1f')](0xcc)[_0xfcc5('0x20')]();});}};}function handleEntityNotFound(_0x239d42,_0x40d894){return function(_0x240736){if(!_0x240736){_0x239d42['sendStatus'](0x194);}return _0x240736;};}function handleError(_0xdc93dc,_0x29a172){_0x29a172=_0x29a172||0x1f4;return function(_0x44d50e){logger[_0xfcc5('0x28')](_0x44d50e[_0xfcc5('0x29')]);if(_0x44d50e[_0xfcc5('0x2a')]){delete _0x44d50e[_0xfcc5('0x2a')];}_0xdc93dc[_0xfcc5('0x1f')](_0x29a172)['send'](_0x44d50e);};}function getInteractionUsers(_0x56d035,_0x57012c){return new BPromise(function(_0x24b43f,_0x6caae8){try{if(_0x57012c[_0x56d035['id']]){_0x56d035[_0xfcc5('0x2b')]=_[_0xfcc5('0x2c')](_0x57012c[_0x56d035['id']],function(_0x2e51c6){return{'id':_0x2e51c6['id'],'fullname':_0x2e51c6[_0xfcc5('0x2d')]};});}}catch(_0x539201){_0x6caae8(_0x539201);}_0x24b43f(_0x56d035);});}function getInteractionTags(_0x299a9b,_0x559445){return new BPromise(function(_0xb111b6,_0x346f23){try{if(_0x299a9b[_0xfcc5('0x2e')]){_0x299a9b[_0xfcc5('0x2f')]=[];_0x299a9b['TagIds'][_0xfcc5('0x30')](',')[_0xfcc5('0x31')](function(_0x1e25cc){_0x299a9b[_0xfcc5('0x2f')]['push'](_0x559445[_0x1e25cc]);});}delete _0x299a9b[_0xfcc5('0x2e')];}catch(_0x39574d){_0x346f23(_0x39574d);}_0xb111b6(_0x299a9b);});}function updateOpenchannelInteraction(_0x5207b6,_0x5b8cc9,_0x43d9ef){return new BPromise(function(_0x2cbdf0,_0x3a19f5){return getInteractionUsers(_0x5207b6,_0x43d9ef)[_0xfcc5('0x26')](function(_0x35ba63){return getInteractionTags(_0x35ba63,_0x5b8cc9);})[_0xfcc5('0x26')](function(_0x15bb90){return getStateInteraction(_0x15bb90);})[_0xfcc5('0x26')](function(_0x20898d){_0x2cbdf0(_0x20898d);})[_0xfcc5('0x32')](function(_0x1cdf9b){_0x3a19f5(_0x1cdf9b);});});}function getStateInteraction(_0x1cb664){return new BPromise(function(_0x3cefaa){_0x1cb664['waiting']=0x0;_0x1cb664[_0xfcc5('0x33')]=0x0;_0x1cb664[_0xfcc5('0x34')]=0x0;_0x1cb664[_0xfcc5('0x35')]=0x0;_0x1cb664['total']=0x0;if(!_0x1cb664[_0xfcc5('0x36')]&&!_0x1cb664[_0xfcc5('0x37')]){_0x1cb664[_0xfcc5('0x38')]+=0x1;}if(!_0x1cb664['closed']&&_0x1cb664[_0xfcc5('0x37')]){_0x1cb664[_0xfcc5('0x33')]+=0x1;if(_0x1cb664[_0xfcc5('0x38')]){_0x1cb664['waiting']-=0x1;}}if(_0x1cb664['closed']&&_0x1cb664[_0xfcc5('0x37')]){_0x1cb664[_0xfcc5('0x34')]+=0x1;if(_0x1cb664[_0xfcc5('0x33')]){_0x1cb664[_0xfcc5('0x33')]-=0x1;}}if(_0x1cb664['closed']&&!_0x1cb664[_0xfcc5('0x37')]){_0x1cb664['unmanaged']+=0x1;if(_0x1cb664['waiting']){_0x1cb664[_0xfcc5('0x38')]-=0x1;}}_0x1cb664[_0xfcc5('0x39')]+=0x1;_0x3cefaa(_0x1cb664);});}exports['index']=function(_0x4ebe5a,_0x3992a5){var _0x16e79e={},_0x1df864={},_0x14d013={'count':0x0,'rows':[]};var _0x549537=_[_0xfcc5('0x2c')](db[_0xfcc5('0x3a')][_0xfcc5('0x3b')],function(_0x4ee18c){return{'name':_0x4ee18c[_0xfcc5('0x3c')],'type':_0x4ee18c[_0xfcc5('0x3d')]['key']};});_0x1df864['model']=_['map'](_0x549537,'name');_0x1df864['query']=_[_0xfcc5('0x3e')](_0x4ebe5a[_0xfcc5('0x3f')]);_0x1df864[_0xfcc5('0x40')]=_['intersection'](_0x1df864[_0xfcc5('0x41')],_0x1df864[_0xfcc5('0x3f')]);_0x16e79e['attributes']=_[_0xfcc5('0x42')](_0x1df864[_0xfcc5('0x41')],qs[_0xfcc5('0x43')](_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x43')]));_0x16e79e[_0xfcc5('0x44')]=_0x16e79e[_0xfcc5('0x44')][_0xfcc5('0x45')]?_0x16e79e[_0xfcc5('0x44')]:_0x1df864[_0xfcc5('0x41')];if(!_0x4ebe5a['query'][_0xfcc5('0x46')](_0xfcc5('0x47'))){_0x16e79e[_0xfcc5('0x48')]=qs['limit'](_0x4ebe5a[_0xfcc5('0x3f')]['limit']);_0x16e79e[_0xfcc5('0x22')]=qs[_0xfcc5('0x22')](_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x22')]);}_0x16e79e[_0xfcc5('0x49')]=qs[_0xfcc5('0x4a')](_0x4ebe5a['query'][_0xfcc5('0x4a')]);_0x16e79e['where']=qs[_0xfcc5('0x40')](_[_0xfcc5('0x4b')](_0x4ebe5a[_0xfcc5('0x3f')],_0x1df864[_0xfcc5('0x40')]),_0x549537);var _0xda5996=[];var _0x5c8a82=squel[_0xfcc5('0x4c')]()['field']('id')['field'](_0xfcc5('0x2a'))['field']('color')['from'](_0xfcc5('0x4d'));var _0x1f7559=squel[_0xfcc5('0x4c')]()['field']('u.id')[_0xfcc5('0x4e')]('u.fullname')[_0xfcc5('0x4e')]('ui.OpenchannelInteractionId')['from']('user_has_openchannel_interactions','ui')[_0xfcc5('0x4f')](_0xfcc5('0x50'),'u',_0xfcc5('0x51'));var _0x40e529=squel[_0xfcc5('0x4c')]()['from']('openchannel_interactions','i')[_0xfcc5('0x4f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xfcc5('0x4f')]('users','o',_0xfcc5('0x52'))[_0xfcc5('0x4f')](_0xfcc5('0x53'),'a',_0xfcc5('0x54'))[_0xfcc5('0x4f')](_0xfcc5('0x55'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xfcc5('0x4f')](_0xfcc5('0x56'),'it',_0xfcc5('0x57'))['left_join'](_0xfcc5('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x36e6f1=squel['expr']();var _0x30cc89=[];var _0x5b9603=squel[_0xfcc5('0x58')]();var _0x3ef268;if(_0x4ebe5a['query'][_0xfcc5('0x59')]){_0x3ef268=as[_0xfcc5('0x5a')](_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x59')]);var _0x144f08=_0x3ef268[_0xfcc5('0x5b')];for(var _0x273ce5=0x0;_0x273ce5<_0x3ef268[_0xfcc5('0x5c')][_0xfcc5('0x45')];_0x273ce5++){var _0x4a6be2=_0x3ef268['conditions'][_0x273ce5];var _0x441f4e='i';var _0x5c5abc=_['find'](_0x549537,[_0xfcc5('0x2a'),_0x4a6be2[_0xfcc5('0x4e')]]);if(!_0x5c5abc){switch(_0x4a6be2[_0xfcc5('0x4e')]){case _0xfcc5('0x5d'):if(_0x4a6be2[_0xfcc5('0x5e')]==0x1){_0x40e529['having']('`'+_0x4a6be2[_0xfcc5('0x4e')]+'`\x20=\x200');}else{_0x40e529[_0xfcc5('0x5f')]('`'+_0x4a6be2[_0xfcc5('0x4e')]+_0xfcc5('0x60'));}break;case _0xfcc5('0x61'):if(_0x4a6be2[_0xfcc5('0x62')]===_0xfcc5('0x63')){if(_0x4a6be2['value']['split']('\x20')[_0xfcc5('0x45')]>0x1){_0x36e6f1[_0x144f08](_0xfcc5('0x64'),qs[_0xfcc5('0x65')](_0x4a6be2[_0xfcc5('0x5e')]),null);}else{var _0x9266c9='%'+_0x4a6be2[_0xfcc5('0x5e')]+'%';_0x36e6f1[_0x144f08](_0xfcc5('0x66'),_0x9266c9,_0x9266c9,_0x9266c9);}}else{_0x5c5abc=_['find'](_0x549537,[_0xfcc5('0x2a'),_0xfcc5('0x67')]);_0x4a6be2[_0xfcc5('0x4e')]=_0xfcc5('0x67');_0x1454a8=as[_0xfcc5('0x68')](_0x441f4e,_0x5c5abc[_0xfcc5('0x3d')],_0x4a6be2);_0x36e6f1[_0x144f08](_0x1454a8[_0xfcc5('0x69')],_0x1454a8[_0xfcc5('0x5e')][_0xfcc5('0x6a')],_0x1454a8[_0xfcc5('0x5e')][_0xfcc5('0x20')]);}break;case _0xfcc5('0x6b'):var _0x174c54=_0x4a6be2[_0xfcc5('0x5e')][_0xfcc5('0x30')](',')['map'](function(_0x20564f){return Number(_0x20564f);});_0x174c54[_0xfcc5('0x31')](function(_0x9e3d6d){_0x5b9603['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x9e3d6d+',%');});_0x30cc89=_[_0xfcc5('0x6c')](_0x30cc89,_0x174c54);break;case _0xfcc5('0x6d'):if(_0x4a6be2[_0xfcc5('0x62')]===_0xfcc5('0x63')){_0x36e6f1[_0x144f08]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4a6be2['value']+'%',null);}else{_0x5c5abc=_[_0xfcc5('0x6e')](_0x549537,['name',_0xfcc5('0x37')]);_0x4a6be2[_0xfcc5('0x4e')]='UserId';_0x1454a8=as['buildExpression'](_0x441f4e,_0x5c5abc[_0xfcc5('0x3d')],_0x4a6be2);_0x36e6f1[_0x144f08](_0x1454a8[_0xfcc5('0x69')],_0x1454a8[_0xfcc5('0x5e')][_0xfcc5('0x6a')],_0x1454a8[_0xfcc5('0x5e')][_0xfcc5('0x20')]);}break;case _0xfcc5('0x6f'):_0x1454a8=as[_0xfcc5('0x68')]('me',null,_0x4a6be2);_0x36e6f1[_0x144f08](_0x1454a8[_0xfcc5('0x69')],_0x1454a8['value'][_0xfcc5('0x6a')],_0x1454a8[_0xfcc5('0x5e')]['end']);break;}}else{var _0x1454a8=as[_0xfcc5('0x68')](_0x441f4e,_0x5c5abc['type'],_0x4a6be2);_0x36e6f1[_0x144f08](_0x1454a8['text'],_0x1454a8[_0xfcc5('0x5e')][_0xfcc5('0x6a')],_0x1454a8[_0xfcc5('0x5e')][_0xfcc5('0x20')]);}}}else{var _0x3f5e11=_(_0x4ebe5a[_0xfcc5('0x3f')])['keys']()[_0xfcc5('0x2c')](function(_0x267815){return _[_0xfcc5('0x70')](_0x549537,[_0xfcc5('0x2a'),_0x267815])?_0x267815:undefined;})[_0xfcc5('0x71')]()[_0xfcc5('0x5e')]();if(!_[_0xfcc5('0x72')](_0x3f5e11)){_0x3f5e11[_0xfcc5('0x31')](function(_0x16ffb6){if(_0x16ffb6===_0xfcc5('0x73')){_0x40e529[_0xfcc5('0x74')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xfcc5('0x75')](_0x4ebe5a[_0xfcc5('0x3f')][_0x16ffb6]));}else if(_0x16ffb6===_0xfcc5('0x76')){var _0x2b68b6=JSON[_0xfcc5('0x77')](_0x4ebe5a['query'][_0x16ffb6])['$gte'];var _0x53c3ef=JSON[_0xfcc5('0x77')](_0x4ebe5a[_0xfcc5('0x3f')][_0x16ffb6])[_0xfcc5('0x78')];_0x40e529[_0xfcc5('0x74')](_0xfcc5('0x79'),_0x2b68b6,_0x53c3ef);}else{if(_0x4ebe5a[_0xfcc5('0x3f')][_0x16ffb6]===_0xfcc5('0x7a')){_0x40e529['where']('i.'+_0x16ffb6+'\x20IS\x20NULL');}else{_0x40e529[_0xfcc5('0x74')]('i.'+_0x16ffb6+_0xfcc5('0x7b'),_0x4ebe5a[_0xfcc5('0x3f')][_0x16ffb6]);}}});}if(_0x4ebe5a['query'][_0xfcc5('0x7c')]){if(_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x7c')]==0x1){_0x40e529[_0xfcc5('0x5f')](_0xfcc5('0x7d'));}else{_0x40e529[_0xfcc5('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x4ebe5a['query'][_0xfcc5('0x7e')]){_0x30cc89=_['isArray'](_0x4ebe5a[_0xfcc5('0x3f')]['tag'])?_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x7e')]:new Array(_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x7e')]);_0x30cc89['forEach'](function(_0x2dbac6){_0x5b9603['or'](_0xfcc5('0x7f'),'%,'+_0x2dbac6+',%');});}if(_0x4ebe5a[_0xfcc5('0x3f')]['filter']){var _0x2cec8c=_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x80')][_0xfcc5('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xfcc5('0x82')](_0x2cec8c)){_0x36e6f1['or']('i.id\x20LIKE\x20?',_0x2cec8c+'%');}else{_0x36e6f1['or'](_0xfcc5('0x83'),qs['getFullTextValue'](_0x2cec8c))['or'](_0xfcc5('0x84'),_0x2cec8c+'%')['or'](_0xfcc5('0x85'),_0x2cec8c+'%');}}}_0x40e529[_0xfcc5('0x74')](_0x36e6f1);_0x40e529[_0xfcc5('0x86')](_0xfcc5('0x87'));var _0x77e98c={'type':db[_0xfcc5('0x88')][_0xfcc5('0x89')]['SELECT'],'raw':!![]};var _0x2eb008=_0x40e529[_0xfcc5('0x8a')]();_0x2eb008[_0xfcc5('0x4e')](_0xfcc5('0x87'));_0x2eb008[_0xfcc5('0x4e')](_0xfcc5('0x8b'),_0xfcc5('0x5d'));if(_0x16e79e[_0xfcc5('0x49')]){_0x16e79e[_0xfcc5('0x49')][_0xfcc5('0x31')](function(_0x28cb97){var _0x419b0e=_0x28cb97[0x0]==='contactName'?_0x28cb97[0x0]:'i.'+_0x28cb97[0x0];_0x40e529[_0xfcc5('0x49')](_0x419b0e,_0x28cb97[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfcc5('0x72')](_0x30cc89)){_0x40e529['having'](_0x5b9603);_0x2eb008[_0xfcc5('0x74')](_0xfcc5('0x8c'),_0x30cc89);}BPromise['resolve']()[_0xfcc5('0x26')](function(){if(!_0x3ef268){if(_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x73')])return;_0x2eb008[_0xfcc5('0x74')](_0xfcc5('0x8d'));_0x40e529[_0xfcc5('0x74')](_0xfcc5('0x8d'));return;}if(_0x4ebe5a[_0xfcc5('0x8e')]['role']!=='agent')return;return _0x4ebe5a[_0xfcc5('0x8e')][_0xfcc5('0x8f')]({'attributes':['id'],'raw':!![]})[_0xfcc5('0x26')](function(_0x2a9af3){if(_[_0xfcc5('0x72')](_0x2a9af3)){_0x2eb008[_0xfcc5('0x74')](_0xfcc5('0x90'));_0x40e529[_0xfcc5('0x74')](_0xfcc5('0x90'));}else{_0x2eb008[_0xfcc5('0x74')](_0xfcc5('0x91'),_[_0xfcc5('0x2c')](_0x2a9af3,'id'));_0x40e529[_0xfcc5('0x74')](_0xfcc5('0x91'),_[_0xfcc5('0x2c')](_0x2a9af3,'id'));}});})['then'](function(){if(_0x4ebe5a['user']['role']===_0xfcc5('0x92')&&!_0x3ef268&&!_0x4ebe5a[_0xfcc5('0x3f')][_0xfcc5('0x73')])return[];return db[_0xfcc5('0x93')][_0xfcc5('0x3f')](_0x2eb008[_0xfcc5('0x94')](),_0x77e98c);})[_0xfcc5('0x26')](function(_0x116c77){_0x14d013['count']=_0x116c77[_0xfcc5('0x45')];if(_0x14d013[_0xfcc5('0x23')]===0x0)return[];return db[_0xfcc5('0x93')]['query'](_0x5c8a82['toString'](),_0x77e98c)['then'](function(_0x3cda06){_0xda5996=_[_0xfcc5('0x95')](_0x3cda06,'id');_0x77e98c=_['merge'](_0x77e98c,{'model':db[_0xfcc5('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ebe5a['query']['fields']){_0x16e79e['attributes'][_0xfcc5('0x31')](function(_0x5686f0){_0x40e529[_0xfcc5('0x4e')]('i.'+_0x5686f0);});}else{_0x40e529[_0xfcc5('0x4e')](_0xfcc5('0x8b'),_0xfcc5('0x5d'));_0x40e529['field'](_0xfcc5('0x96'),'Account.key');_0x40e529[_0xfcc5('0x4e')](_0xfcc5('0x97'),'Account.mandatoryDisposition');_0x40e529[_0xfcc5('0x4e')](_0xfcc5('0x98'),_0xfcc5('0x99'));_0x40e529[_0xfcc5('0x4e')](_0xfcc5('0x9a'));_0x40e529[_0xfcc5('0x4e')]('c.firstName',_0xfcc5('0x9b'));_0x40e529[_0xfcc5('0x4e')]('c.lastName','Contact.lastName');_0x40e529[_0xfcc5('0x4e')](_0xfcc5('0x9c'),_0xfcc5('0x9d'));_0x40e529[_0xfcc5('0x4e')](_0xfcc5('0x9e'),_0xfcc5('0x9f'));_0x40e529['field'](_0xfcc5('0xa0'),'Contact.mobile');_0x40e529[_0xfcc5('0x4e')]('c.fax','Contact.fax');_0x40e529['field'](_0xfcc5('0xa1'),_0xfcc5('0xa2'));_0x40e529['field'](_0xfcc5('0xa3'),_0xfcc5('0xa4'));_0x40e529[_0xfcc5('0x4e')](_0xfcc5('0xa5'),_0xfcc5('0x2e'));}if(_0x16e79e[_0xfcc5('0x48')])_0x40e529[_0xfcc5('0x48')](_0x16e79e[_0xfcc5('0x48')]);if(_0x16e79e[_0xfcc5('0x22')])_0x40e529['offset'](_0x16e79e[_0xfcc5('0x22')]);return db['sequelize'][_0xfcc5('0x3f')](_0x40e529['toString'](),_0x77e98c);})['then'](function(_0x490d43){if(_0x490d43[_0xfcc5('0x45')]>0x0)_0x1f7559['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xfcc5('0x2c')](_0x490d43,'id'));return db[_0xfcc5('0x93')][_0xfcc5('0x3f')](_0x1f7559['toString'](),_0x77e98c)['then'](function(_0x50a610){var _0x535186=_[_0xfcc5('0xa6')](_0x50a610,'OpenchannelInteractionId');var _0x8c77ff=[];_0x490d43[_0xfcc5('0x31')](function(_0x3743b5){_0x8c77ff['push'](updateOpenchannelInteraction(_0x3743b5,_0xda5996,_0x535186));});return BPromise[_0xfcc5('0xa7')](_0x8c77ff);});});})['then'](function(_0x43e5eb){_0x14d013[_0xfcc5('0xa8')]=_0x43e5eb;return _0x14d013;})[_0xfcc5('0x26')](respondWithFilteredResult(_0x3992a5,_0x16e79e))['catch'](handleError(_0x3992a5,null));};exports[_0xfcc5('0xa9')]=function(_0x204025,_0x54b703){var _0x37f7da={};if(_0x204025[_0xfcc5('0x3f')][_0xfcc5('0x3d')]&&_0x204025[_0xfcc5('0x3f')][_0xfcc5('0x3d')]===_0xfcc5('0xaa')){_0x37f7da[_0xfcc5('0xaa')]=_0x204025[_0xfcc5('0xab')]['id'];}else{_0x37f7da['id']=_0x204025[_0xfcc5('0xab')]['id'];}var _0x1f4e99={'raw':![],'where':_0x37f7da},_0x5573e1={};_0x5573e1['model']=_[_0xfcc5('0x3e')](db[_0xfcc5('0x3a')]['rawAttributes']);_0x5573e1[_0xfcc5('0x3f')]=_[_0xfcc5('0x3e')](_0x204025[_0xfcc5('0x3f')]);_0x5573e1[_0xfcc5('0x40')]=_['intersection'](_0x5573e1[_0xfcc5('0x41')],_0x5573e1[_0xfcc5('0x3f')]);_0x1f4e99[_0xfcc5('0x44')]=_[_0xfcc5('0x42')](_0x5573e1[_0xfcc5('0x41')],qs['fields'](_0x204025[_0xfcc5('0x3f')][_0xfcc5('0x43')]));_0x1f4e99[_0xfcc5('0x44')]=_0x1f4e99[_0xfcc5('0x44')][_0xfcc5('0x45')]?_0x1f4e99[_0xfcc5('0x44')]:_0x5573e1[_0xfcc5('0x41')];if(_0x204025[_0xfcc5('0x3f')][_0xfcc5('0xac')]){_0x1f4e99['include']=[{'all':!![]}];}_0x1f4e99=_[_0xfcc5('0xad')]({},_0x1f4e99,_0x204025['options']);return db['OpenchannelInteraction'][_0xfcc5('0x6e')](_0x1f4e99)[_0xfcc5('0x26')](handleEntityNotFound(_0x54b703,null))[_0xfcc5('0x26')](respondWithResult(_0x54b703,null))[_0xfcc5('0x32')](handleError(_0x54b703,null));};exports['create']=function(_0x33d523,_0x294a78){return db[_0xfcc5('0x3a')][_0xfcc5('0xae')](_0x33d523[_0xfcc5('0x6f')],{})['then'](respondWithResult(_0x294a78,0xc9))['catch'](handleError(_0x294a78,null));};exports[_0xfcc5('0x25')]=function(_0xd2fd1a,_0x257443){if(_0xd2fd1a[_0xfcc5('0x6f')]['id']){delete _0xd2fd1a[_0xfcc5('0x6f')]['id'];}return db[_0xfcc5('0x3a')][_0xfcc5('0x6e')]({'where':{'id':_0xd2fd1a[_0xfcc5('0xab')]['id']}})[_0xfcc5('0x26')](handleEntityNotFound(_0x257443,null))['then'](saveUpdates(_0xd2fd1a[_0xfcc5('0x6f')],null))['then'](respondWithResult(_0x257443,null))[_0xfcc5('0x32')](handleError(_0x257443,null));};exports['destroy']=function(_0x3773b1,_0x1d914b){return db[_0xfcc5('0x3a')][_0xfcc5('0x6e')]({'where':{'id':_0x3773b1[_0xfcc5('0xab')]['id']}})[_0xfcc5('0x26')](handleEntityNotFound(_0x1d914b,null))[_0xfcc5('0x26')](removeEntity(_0x1d914b,null))[_0xfcc5('0x32')](handleError(_0x1d914b,null));};exports[_0xfcc5('0xaf')]=function(_0x2e6af1,_0xe4089d){return db[_0xfcc5('0x3a')][_0xfcc5('0xaf')]()[_0xfcc5('0x26')](respondWithResult(_0xe4089d,null))[_0xfcc5('0x32')](handleError(_0xe4089d,null));};exports['addMessage']=function(_0x4f9220,_0x4c3595,_0x29f46d){return db[_0xfcc5('0xb0')]['find']({'where':{'id':_0x4f9220['params']['id']}})[_0xfcc5('0x26')](handleEntityNotFound(_0x4c3595,null))[_0xfcc5('0x26')](function(_0x5d1cb7){if(_0x5d1cb7){return _0x5d1cb7[_0xfcc5('0xb1')](_0x4f9220[_0xfcc5('0x6f')]['ids'],_[_0xfcc5('0xb2')](_0x4f9220[_0xfcc5('0x6f')],[_0xfcc5('0xb3'),'id'])||{});}})[_0xfcc5('0x26')](respondWithResult(_0x4c3595,null))[_0xfcc5('0x32')](handleError(_0x4c3595,null));};exports['getMessages']=function(_0x24bf46,_0x3325c7,_0x3b4a4d){var _0x32cd80={'raw':![],'where':{}};var _0x18921b={};var _0x1a29dc={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xfcc5('0xb4')]({'where':{'id':_0x24bf46['params']['id']}})[_0xfcc5('0x26')](handleEntityNotFound(_0x3325c7,null))[_0xfcc5('0x26')](function(_0x498890){if(_0x498890){_0x18921b[_0xfcc5('0x41')]=_[_0xfcc5('0x3e')](db['OpenchannelMessage']['rawAttributes']);_0x18921b['query']=_[_0xfcc5('0x3e')](_0x24bf46[_0xfcc5('0x3f')]);_0x18921b[_0xfcc5('0x40')]=_['intersection'](_0x18921b[_0xfcc5('0x41')],_0x18921b['query']);_0x32cd80[_0xfcc5('0x44')]=_[_0xfcc5('0x42')](_0x18921b['model'],qs[_0xfcc5('0x43')](_0x24bf46[_0xfcc5('0x3f')][_0xfcc5('0x43')]));_0x32cd80['attributes']=_0x32cd80[_0xfcc5('0x44')][_0xfcc5('0x45')]?_0x32cd80['attributes']:_0x18921b[_0xfcc5('0x41')];if(!_0x24bf46[_0xfcc5('0x3f')][_0xfcc5('0x46')](_0xfcc5('0x47'))){_0x32cd80[_0xfcc5('0x48')]=qs['limit'](_0x24bf46['query'][_0xfcc5('0x48')]);_0x32cd80[_0xfcc5('0x22')]=qs[_0xfcc5('0x22')](_0x24bf46[_0xfcc5('0x3f')][_0xfcc5('0x22')]);}_0x32cd80[_0xfcc5('0x49')]=qs['sort'](_0x24bf46['query']['sort']);_0x32cd80[_0xfcc5('0x74')]=qs['filters'](_[_0xfcc5('0x4b')](_0x24bf46[_0xfcc5('0x3f')],_0x18921b['filters']));_0x32cd80[_0xfcc5('0x74')][_0xfcc5('0xb5')]=_0x498890['id'];if(_0x24bf46['query'][_0xfcc5('0x80')]){_0x32cd80[_0xfcc5('0x74')]=_[_0xfcc5('0xad')](_0x32cd80['where'],{'$or':_[_0xfcc5('0x2c')](_0x32cd80[_0xfcc5('0x44')],function(_0x4dbbe9){var _0x1ef6f6={};_0x1ef6f6[_0x4dbbe9]={'$like':'%'+_0x24bf46[_0xfcc5('0x3f')][_0xfcc5('0x80')]+'%'};return _0x1ef6f6;})});}if(_0x24bf46[_0xfcc5('0x3f')][_0xfcc5('0xb6')]){var _0x208a9d=_0x24bf46['query']['$gte'][_0xfcc5('0x30')](',');var _0x331f6c={};_0x331f6c[_0x208a9d[0x0]]={'$gte':moment(_0x208a9d[0x1])[_0xfcc5('0xb7')](_0xfcc5('0xb8'))};_0x32cd80[_0xfcc5('0x74')]=_[_0xfcc5('0xad')](_0x32cd80[_0xfcc5('0x74')],_0x331f6c);}_0x32cd80=_['merge']({},_0x32cd80,_0x24bf46['options']);return db[_0xfcc5('0xb0')][_0xfcc5('0x23')]({'where':_0x32cd80[_0xfcc5('0x74')]})[_0xfcc5('0x26')](function(_0x13f830){_0x1a29dc[_0xfcc5('0x23')]=_0x13f830;if(_0x24bf46['query'][_0xfcc5('0xac')]){_0x32cd80[_0xfcc5('0xb9')]=[{'all':!![]}];}return db[_0xfcc5('0xb0')]['findAll'](_0x32cd80);})[_0xfcc5('0x26')](function(_0x4b7c09){_0x1a29dc[_0xfcc5('0xa8')]=_0x4b7c09;return _0x1a29dc;});}})[_0xfcc5('0x26')](respondWithFilteredResult(_0x3325c7,_0x32cd80))[_0xfcc5('0x32')](handleError(_0x3325c7,null));};exports[_0xfcc5('0xba')]=function(_0x283cf1,_0x1596b1,_0x144e4d){return db[_0xfcc5('0x3a')][_0xfcc5('0x6e')]({'where':{'id':_0x283cf1['params']['id']}})[_0xfcc5('0x26')](handleEntityNotFound(_0x1596b1,null))[_0xfcc5('0x26')](function(_0x5c1fce){if(_0x5c1fce){return _0x5c1fce[_0xfcc5('0xbb')](_0x283cf1[_0xfcc5('0x6f')][_0xfcc5('0xb3')],_['omit'](_0x283cf1[_0xfcc5('0x6f')],[_0xfcc5('0xb3'),'id'])||{})[_0xfcc5('0xbc')](function(){return db['Tag'][_0xfcc5('0xbd')]({'attributes':['id',_0xfcc5('0x2a'),'color'],'where':{'id':_0x283cf1['body'][_0xfcc5('0xb3')]}});})[_0xfcc5('0x26')](function(_0x294fc6){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x283cf1[_0xfcc5('0xab')]['id']),'tags':_0x294fc6||[]});return{'id':Number(_0x283cf1[_0xfcc5('0xab')]['id']),'tags':_0x294fc6||[]};});}})[_0xfcc5('0x26')](respondWithResult(_0x1596b1,null))['catch'](handleError(_0x1596b1,null));};exports['removeTags']=function(_0x3a7c8c,_0xb0b296,_0x3e9001){return db['OpenchannelInteraction'][_0xfcc5('0x6e')]({'where':{'id':_0x3a7c8c[_0xfcc5('0xab')]['id']}})[_0xfcc5('0x26')](handleEntityNotFound(_0xb0b296,null))['then'](function(_0x15558f){if(_0x15558f){return _0x15558f[_0xfcc5('0xbe')](_0x3a7c8c[_0xfcc5('0x3f')][_0xfcc5('0xb3')]);}})[_0xfcc5('0x26')](respondWithStatusCode(_0xb0b296,null))[_0xfcc5('0x32')](handleError(_0xb0b296,null));};exports[_0xfcc5('0xbf')]=function(_0x1185dc,_0x2a36b1){var _0x3f0145=moment()['unix']()[_0xfcc5('0x94')]();var _0x577085=path['join'](config[_0xfcc5('0xc0')],'server',_0xfcc5('0xc1'),'tmp');var _0x408af0=path[_0xfcc5('0xc2')](config['root'],'server',_0xfcc5('0xc1'),_0xfcc5('0xc3'));var _0x1d3373=path[_0xfcc5('0xc2')](_0x577085,_0x3f0145);var _0x2fb152=util['format'](_0xfcc5('0xc4'),_0x1185dc[_0xfcc5('0xab')]['id'],_0x3f0145);var _0x4b944c=path[_0xfcc5('0xc2')](_0x577085,_0x2fb152);var _0x32e175=[];_0x32e175[_0xfcc5('0xc5')]({'model':db[_0xfcc5('0x6d')],'as':_0xfcc5('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0x32e175[_0xfcc5('0xc5')]({'model':db[_0xfcc5('0xc6')],'as':_0xfcc5('0x61'),'attributes':['id',_0xfcc5('0xc7'),_0xfcc5('0xc8')],'raw':!![]});if(_0x1185dc['query'][_0xfcc5('0xc3')]){_0x32e175[_0xfcc5('0xc5')]({'model':db['Attachment'],'as':_0xfcc5('0xc9'),'raw':!![]});}var _0x333bfd=[{'model':db[_0xfcc5('0xb0')],'as':'Messages','attributes':['id',_0xfcc5('0x6f'),_0xfcc5('0x76'),_0xfcc5('0xca'),_0xfcc5('0xcb'),_0xfcc5('0x7c')],'include':_0x32e175}];_0x333bfd['push']({'model':db[_0xfcc5('0xcc')],'as':_0xfcc5('0xcd'),'attributes':['id',_0xfcc5('0x2a')]});_0x333bfd['push']({'model':db['User'],'as':_0xfcc5('0xce'),'attributes':['id','fullname']});return db[_0xfcc5('0x3a')][_0xfcc5('0x6e')]({'where':{'id':_0x1185dc[_0xfcc5('0xab')]['id']},'include':_0x333bfd})['then'](handleEntityNotFound(_0x2a36b1,null))[_0xfcc5('0x26')](function(_0xdc9714){if(_0xdc9714){var _0x1871d1=_0xdc9714['get']({'plain':!![]});fs[_0xfcc5('0xcf')](_0x1d3373);var _0x20ad0b={'channel':'Openchannel','account':_0x1871d1['Account'][_0xfcc5('0x2a')],'agent':_0x1871d1['Owner']?_0x1871d1[_0xfcc5('0xce')][_0xfcc5('0x2d')]:_0xfcc5('0xd0'),'createdAt':moment(_0x1871d1[_0xfcc5('0x76')])['format'](_0xfcc5('0xb8'))[_0xfcc5('0x94')](),'closedAt':_0x1871d1[_0xfcc5('0x36')]?moment(_0x1871d1[_0xfcc5('0xd1')])['format'](_0xfcc5('0xb8'))['toString']():'','disposition':_0x1871d1[_0xfcc5('0xd2')],'visibility':_0x1871d1[_0xfcc5('0xd3')]?_0xfcc5('0xd4'):_0xfcc5('0xd5'),'messages':_(_0x1871d1[_0xfcc5('0xd6')])[_0xfcc5('0x80')]({'secret':![]})['map'](function(_0x32c305){if(_0x32c305[_0xfcc5('0xc9')]){var _0x4e7c00=path['join'](_0x408af0,_0x32c305['Attachment'][_0xfcc5('0xd7')]);if(fs[_0xfcc5('0xd8')](_0x4e7c00)){fs[_0xfcc5('0xd9')](_0x4e7c00)[_0xfcc5('0xda')](fs[_0xfcc5('0xdb')](path[_0xfcc5('0xc2')](_0x1d3373,_0x32c305['Attachment'][_0xfcc5('0xd7')])));}}return{'date':moment(_0x32c305['createdAt'])[_0xfcc5('0xb7')](_0xfcc5('0xb8'))[_0xfcc5('0x94')](),'sender':_0x32c305[_0xfcc5('0xca')]==='out'?_0x32c305[_0xfcc5('0x6d')]?_0x32c305[_0xfcc5('0x6d')][_0xfcc5('0x2d')]:_0xfcc5('0xdc'):_0x32c305[_0xfcc5('0x61')][_0xfcc5('0xc7')]+(_0x32c305[_0xfcc5('0x61')][_0xfcc5('0xc8')]?'\x20'+_0x32c305[_0xfcc5('0x61')]['lastName']:''),'body':_0x32c305['Attachment']?_0x32c305[_0xfcc5('0xc9')]['basename']:_0x32c305[_0xfcc5('0x6f')],'direction':_0x32c305['direction']===_0xfcc5('0xdd')?'A':'C','secret':_0x32c305[_0xfcc5('0xcb')],'read':_0x32c305[_0xfcc5('0x7c')],'attachment':_0x32c305[_0xfcc5('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xfcc5('0xc2')](config['root'],_0xfcc5('0xde'),'views',_0xfcc5('0xdf')),{'interaction':_0x20ad0b})[_0xfcc5('0x26')](function(_0x315557){var _0xdedf5f=path[_0xfcc5('0xc2')](_0x1d3373,'transcript-'+_0x1871d1['id']+'-'+_0x3f0145+_0xfcc5('0xe0'));var _0x525712={'path':_0xdedf5f,'channel':_0xfcc5('0xe1'),'interactionId':_0x1871d1['id']};return pdf['createPdfFromHTML'](_0x315557,_0x525712);})[_0xfcc5('0x26')](function(){return new BPromise(function(_0x3dd739,_0x43fcc6){zipdir(_0x1d3373,{'saveTo':_0x4b944c},function(_0x3adf29,_0x3f737a){if(_0x3adf29)return _0x43fcc6(_0x3adf29);return _0x3dd739(_0x3f737a);});})[_0xfcc5('0x26')](function(){return new BPromise(function(_0x39c6e0,_0x3e3e11){rimraf(_0x1d3373,function(_0x4aadcc){if(_0x4aadcc)_0x3e3e11(_0x4aadcc);return _0x39c6e0();});});})[_0xfcc5('0x26')](function(){return _0x2a36b1[_0xfcc5('0xbf')](_0x4b944c,_0x2fb152,function(_0x1c0aea){if(_0x1c0aea){console[_0xfcc5('0xe2')](_0xfcc5('0xe3'),_0x1c0aea);}else{fs[_0xfcc5('0xe4')](_0x4b944c);}});});});}else{return _0x2a36b1[_0xfcc5('0x1e')](0xc8);}})[_0xfcc5('0x32')](handleError(_0x2a36b1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f611833..a3ac6dc 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 _0x902e=['remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x1a198d,_0x1954ae){var _0x292672=function(_0x3f1926){while(--_0x3f1926){_0x1a198d['push'](_0x1a198d['shift']());}};_0x292672(++_0x1954ae);}(_0x902e,0xd5));var _0xe902=function(_0x1a7454,_0x150771){_0x1a7454=_0x1a7454-0x0;var _0x564cc9=_0x902e[_0x1a7454];return _0x564cc9;};'use strict';var EventEmitter=require(_0xe902('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xe902('0x1')];var OpenchannelMessage=require(_0xe902('0x2'))['db'][_0xe902('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe902('0x4')](0x0);var events={'afterCreate':_0xe902('0x5'),'afterUpdate':_0xe902('0x6'),'afterDestroy':_0xe902('0x7')};function emitEvent(_0x53601d){return function(_0x258079,_0x430550,_0x2edea4){_0x258079[_0xe902('0x8')]({'attributes':['id'],'raw':!![]})[_0xe902('0x9')](function(_0x55a72a){_0x258079['setDataValue'](_0xe902('0xa'),_0x55a72a[_0xe902('0xb')](function(_0x1e6445){return{'id':_0x1e6445['id']};}));return OpenchannelMessage[_0xe902('0xc')]({'where':{'OpenchannelInteractionId':_0x258079['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51733f){_0x258079[_0xe902('0xd')](_0xe902('0xe'),_0x51733f[_0xe902('0xf')]);OpenchannelInteractionEvents[_0xe902('0x10')](_0x53601d+':'+_0x258079['id'],_0x258079);OpenchannelInteractionEvents['emit'](_0x53601d,_0x258079);_0x2edea4(null);})['catch'](_0x2edea4(null));};}for(var e in events){if(events[_0xe902('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xe902('0x12')](e,emitEvent(event));}}module[_0xe902('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2ad9=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove'];(function(_0x3d8861,_0x3e70f1){var _0x2603a1=function(_0x2d1b2c){while(--_0x2d1b2c){_0x3d8861['push'](_0x3d8861['shift']());}};_0x2603a1(++_0x3e70f1);}(_0x2ad9,0x1d9));var _0x92ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ad9[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x92ad('0x0'));var OpenchannelInteraction=require(_0x92ad('0x1'))['db'][_0x92ad('0x2')];var OpenchannelMessage=require(_0x92ad('0x1'))['db'][_0x92ad('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x92ad('0x4'),'afterUpdate':_0x92ad('0x5'),'afterDestroy':_0x92ad('0x6')};function emitEvent(_0x53aedb){return function(_0x3d236b,_0x25ecb1,_0x3bef10){_0x3d236b[_0x92ad('0x7')]({'attributes':['id'],'raw':!![]})[_0x92ad('0x8')](function(_0x5e8249){_0x3d236b[_0x92ad('0x9')](_0x92ad('0xa'),_0x5e8249[_0x92ad('0xb')](function(_0x98981a){return{'id':_0x98981a['id']};}));return OpenchannelMessage[_0x92ad('0xc')]({'where':{'OpenchannelInteractionId':_0x3d236b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x92ad('0x8')](function(_0x40942a){_0x3d236b['setDataValue'](_0x92ad('0xd'),_0x40942a[_0x92ad('0xe')]);OpenchannelInteractionEvents[_0x92ad('0xf')](_0x53aedb+':'+_0x3d236b['id'],_0x3d236b);OpenchannelInteractionEvents[_0x92ad('0xf')](_0x53aedb,_0x3d236b);_0x3bef10(null);})[_0x92ad('0x10')](_0x3bef10(null));};}for(var e in events){if(events[_0x92ad('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x92ad('0x12')](e,emitEvent(event));}}module[_0x92ad('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ed4383d..8c78ef8 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 _0x62ce=['utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x62ce,0x1a6));var _0xe62c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x62ce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xe62c('0x0'));var logger=require(_0xe62c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe62c('0x2'));var rp=require(_0xe62c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe62c('0x4'));var config=require(_0xe62c('0x5'));var attributes=require(_0xe62c('0x6'));module[_0xe62c('0x7')]=function(_0x3cb7d3,_0x167e52){return _0x3cb7d3[_0xe62c('0x8')](_0xe62c('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe62c('0xa'),'hooks':{'beforeUpdate':function(_0x1b7a1a,_0x32fba8,_0xa8585){if(_0x1b7a1a[_0xe62c('0xb')](_0xe62c('0xc'))){_0x1b7a1a[_0xe62c('0xd')]=moment()[_0xe62c('0xe')](_0xe62c('0xf'));}_0xa8585(null,_0x1b7a1a);}}});}; \ No newline at end of file +var _0xd072=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2ad1a3,_0x4ba21b){var _0x4fa250=function(_0x209cf3){while(--_0x209cf3){_0x2ad1a3['push'](_0x2ad1a3['shift']());}};_0x4fa250(++_0x4ba21b);}(_0xd072,0x132));var _0x2d07=function(_0x288c4d,_0x1d16f2){_0x288c4d=_0x288c4d-0x0;var _0x3599ea=_0xd072[_0x288c4d];return _0x3599ea;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var logger=require(_0x2d07('0x2'))(_0x2d07('0x3'));var moment=require(_0x2d07('0x4'));var BPromise=require(_0x2d07('0x5'));var rp=require(_0x2d07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d07('0x7'));var config=require(_0x2d07('0x8'));var attributes=require(_0x2d07('0x9'));module[_0x2d07('0xa')]=function(_0x34731c,_0x51aae0){return _0x34731c[_0x2d07('0xb')](_0x2d07('0xc'),attributes,{'tableName':_0x2d07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d07('0xe'),'collate':_0x2d07('0xf'),'hooks':{'beforeUpdate':function(_0xec3bc6,_0x3e7446,_0x4bcba8){if(_0xec3bc6[_0x2d07('0x10')](_0x2d07('0x11'))){_0xec3bc6[_0x2d07('0x12')]=moment()[_0x2d07('0x13')](_0x2d07('0x14'));}_0x4bcba8(null,_0xec3bc6);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 36285fe..726773d 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 _0xe1bc=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','info','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','attributes','then','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','ids','spread','AddTags','lodash','moment','bluebird'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0xe1bc,0xbb));var _0xce1b=function(_0x3a6840,_0x17be3d){_0x3a6840=_0x3a6840-0x0;var _0xbfe92d=_0xe1bc[_0x3a6840];return _0xbfe92d;};'use strict';var _=require(_0xce1b('0x0'));var util=require('util');var moment=require(_0xce1b('0x1'));var BPromise=require(_0xce1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce1b('0x3'));var logger=require(_0xce1b('0x4'))(_0xce1b('0x5'));var config=require(_0xce1b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xce1b('0x7')][_0xce1b('0x8')]({'port':0x232a});config[_0xce1b('0x9')]=_['defaults'](config[_0xce1b('0x9')],{'host':_0xce1b('0xa'),'port':0x18eb});var socket=require(_0xce1b('0xb'))(new Redis(config['redis']));require(_0xce1b('0xc'))['register'](socket);function respondWithRpcPromise(_0x281430,_0x471adb,_0x4b0a0a){return new BPromise(function(_0x2905e9,_0x214907){return client['request'](_0x281430,_0x4b0a0a)['then'](function(_0x3d5b45){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x471adb,_0xce1b('0xd'));logger[_0xce1b('0xe')](_0xce1b('0xf'),_0x471adb,'request\x20sent',JSON[_0xce1b('0x10')](_0x3d5b45));if(_0x3d5b45[_0xce1b('0x11')]){if(_0x3d5b45[_0xce1b('0x11')][_0xce1b('0x12')]===0x1f4){logger[_0xce1b('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x471adb,_0x3d5b45['error'][_0xce1b('0x13')]);return _0x214907(_0x3d5b45[_0xce1b('0x11')][_0xce1b('0x13')]);}logger[_0xce1b('0x11')](_0xce1b('0x14'),_0x471adb,_0x3d5b45['error']['message']);return _0x2905e9(_0x3d5b45[_0xce1b('0x11')][_0xce1b('0x13')]);}else{logger[_0xce1b('0x15')](_0xce1b('0x14'),_0x471adb,_0xce1b('0xd'));_0x2905e9(_0x3d5b45[_0xce1b('0x16')][_0xce1b('0x13')]);}})[_0xce1b('0x17')](function(_0x155e00){logger[_0xce1b('0x11')](_0xce1b('0x14'),_0x471adb,_0x155e00);_0x214907(_0x155e00);});});}exports[_0xce1b('0x18')]=function(_0xbd6a34){var _0x1c2cbe=this;return new Promise(function(_0xfd4121,_0x42e1f1){return db['OpenchannelInteraction'][_0xce1b('0x19')](_0xbd6a34[_0xce1b('0x1a')],{'raw':_0xbd6a34[_0xce1b('0x1b')]?_0xbd6a34[_0xce1b('0x1b')][_0xce1b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbd6a34[_0xce1b('0x1b')]?_0xbd6a34[_0xce1b('0x1b')]['where']||null:null,'attributes':_0xbd6a34[_0xce1b('0x1b')]?_0xbd6a34[_0xce1b('0x1b')][_0xce1b('0x1d')]||null:null,'limit':_0xbd6a34[_0xce1b('0x1b')]?_0xbd6a34[_0xce1b('0x1b')]['limit']||null:null})[_0xce1b('0x1e')](function(_0x34a585){logger[_0xce1b('0x15')]('UpdateOpenchannelInteraction',_0xbd6a34);logger[_0xce1b('0xe')]('UpdateOpenchannelInteraction',_0xbd6a34,JSON[_0xce1b('0x10')](_0x34a585));_0xfd4121(_0x34a585);})[_0xce1b('0x17')](function(_0x4e8e86){logger[_0xce1b('0x11')]('UpdateOpenchannelInteraction',_0x4e8e86[_0xce1b('0x13')],_0xbd6a34);_0x42e1f1(_0x1c2cbe[_0xce1b('0x11')](0x1f4,_0x4e8e86['message']));});});};exports[_0xce1b('0x1f')]=function(_0x1e05d6){return new Promise(function(_0x1ecbc2,_0x569d86){return db[_0xce1b('0x20')][_0xce1b('0x21')]({'where':_0x1e05d6[_0xce1b('0x1b')]?_0x1e05d6[_0xce1b('0x1b')][_0xce1b('0x22')]||null:null})[_0xce1b('0x1e')](function(_0x3fa445){if(_0x3fa445){return _0x3fa445['addTags'](_0x1e05d6[_0xce1b('0x1a')]['ids'],_['omit'](_0x1e05d6[_0xce1b('0x1a')],[_0xce1b('0x23'),'id'])||{});}})[_0xce1b('0x24')](function(_0x2a8f0e){logger[_0xce1b('0x15')](_0xce1b('0x25'),_0x1e05d6);logger['debug'](_0xce1b('0x25'),_0x1e05d6,JSON[_0xce1b('0x10')](_0x2a8f0e));_0x1ecbc2(_0x2a8f0e);})[_0xce1b('0x17')](function(_0x4db038){logger[_0xce1b('0x11')](_0xce1b('0x25'),_0x4db038[_0xce1b('0x13')],_0x1e05d6);_0x569d86(_this[_0xce1b('0x11')](0x1f4,_0x4db038[_0xce1b('0x13')]));});});}; \ No newline at end of file +var _0x5e35=['find','addTags','ids','omit','spread','AddTags','debug','stringify','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','OpenchannelInteraction','options','raw','where','attributes','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5e35,0x1ac));var _0x55e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5e35[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x55e3('0x0'));var moment=require('moment');var BPromise=require(_0x55e3('0x1'));var rs=require(_0x55e3('0x2'));var fs=require('fs');var Redis=require(_0x55e3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x55e3('0x4'));var logger=require(_0x55e3('0x5'))(_0x55e3('0x6'));var config=require(_0x55e3('0x7'));var jayson=require(_0x55e3('0x8'));var client=jayson[_0x55e3('0x9')][_0x55e3('0xa')]({'port':0x232a});config[_0x55e3('0xb')]=_[_0x55e3('0xc')](config[_0x55e3('0xb')],{'host':_0x55e3('0xd'),'port':0x18eb});var socket=require(_0x55e3('0xe'))(new Redis(config[_0x55e3('0xb')]));require(_0x55e3('0xf'))[_0x55e3('0x10')](socket);function respondWithRpcPromise(_0x57087d,_0x32d6fc,_0x78e77e){return new BPromise(function(_0x5dde42,_0x578d2d){return client['request'](_0x57087d,_0x78e77e)[_0x55e3('0x11')](function(_0x11bc32){logger[_0x55e3('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x32d6fc,'request\x20sent');logger['debug'](_0x55e3('0x13'),_0x32d6fc,_0x55e3('0x14'),JSON['stringify'](_0x11bc32));if(_0x11bc32[_0x55e3('0x15')]){if(_0x11bc32['error'][_0x55e3('0x16')]===0x1f4){logger[_0x55e3('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x32d6fc,_0x11bc32[_0x55e3('0x15')][_0x55e3('0x17')]);return _0x578d2d(_0x11bc32[_0x55e3('0x15')]['message']);}logger[_0x55e3('0x15')](_0x55e3('0x18'),_0x32d6fc,_0x11bc32[_0x55e3('0x15')][_0x55e3('0x17')]);return _0x5dde42(_0x11bc32[_0x55e3('0x15')]['message']);}else{logger['info'](_0x55e3('0x18'),_0x32d6fc,_0x55e3('0x14'));_0x5dde42(_0x11bc32[_0x55e3('0x19')][_0x55e3('0x17')]);}})[_0x55e3('0x1a')](function(_0x2c3bad){logger[_0x55e3('0x15')](_0x55e3('0x18'),_0x32d6fc,_0x2c3bad);_0x578d2d(_0x2c3bad);});});}exports['UpdateOpenchannelInteraction']=function(_0xe65e3d){var _0x3273d2=this;return new Promise(function(_0x128187,_0x13ed28){return db[_0x55e3('0x1b')]['update'](_0xe65e3d['body'],{'raw':_0xe65e3d[_0x55e3('0x1c')]?_0xe65e3d[_0x55e3('0x1c')][_0x55e3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe65e3d[_0x55e3('0x1c')]?_0xe65e3d[_0x55e3('0x1c')][_0x55e3('0x1e')]||null:null,'attributes':_0xe65e3d['options']?_0xe65e3d['options'][_0x55e3('0x1f')]||null:null,'limit':_0xe65e3d[_0x55e3('0x1c')]?_0xe65e3d['options']['limit']||null:null})[_0x55e3('0x11')](function(_0x2a385a){logger[_0x55e3('0x12')](_0x55e3('0x20'),_0xe65e3d);logger['debug'](_0x55e3('0x20'),_0xe65e3d,JSON['stringify'](_0x2a385a));_0x128187(_0x2a385a);})[_0x55e3('0x1a')](function(_0x32bfd7){logger[_0x55e3('0x15')](_0x55e3('0x20'),_0x32bfd7[_0x55e3('0x17')],_0xe65e3d);_0x13ed28(_0x3273d2[_0x55e3('0x15')](0x1f4,_0x32bfd7['message']));});});};exports[_0x55e3('0x21')]=function(_0x2b0401){return new Promise(function(_0x5c1b53,_0x49d01e){return db['OpenchannelInteraction'][_0x55e3('0x22')]({'where':_0x2b0401[_0x55e3('0x1c')]?_0x2b0401[_0x55e3('0x1c')][_0x55e3('0x1e')]||null:null})[_0x55e3('0x11')](function(_0x125935){if(_0x125935){return _0x125935[_0x55e3('0x23')](_0x2b0401['body'][_0x55e3('0x24')],_[_0x55e3('0x25')](_0x2b0401['body'],[_0x55e3('0x24'),'id'])||{});}})[_0x55e3('0x26')](function(_0x1c3798){logger[_0x55e3('0x12')](_0x55e3('0x27'),_0x2b0401);logger[_0x55e3('0x28')](_0x55e3('0x27'),_0x2b0401,JSON[_0x55e3('0x29')](_0x1c3798));_0x5c1b53(_0x1c3798);})['catch'](function(_0x6b2739){logger['error'](_0x55e3('0x27'),_0x6b2739['message'],_0x2b0401);_0x49d01e(_this['error'](0x1f4,_0x6b2739[_0x55e3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 469191e..3dc9a6d 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 _0xe76e=['remove','update','register','openchannelInteraction:','save'];(function(_0x433001,_0x4180ba){var _0x3016d5=function(_0x923978){while(--_0x923978){_0x433001['push'](_0x433001['shift']());}};_0x3016d5(++_0x4180ba);}(_0xe76e,0x77));var _0xee76=function(_0x5c3235,_0x607958){_0x5c3235=_0x5c3235-0x0;var _0x4696d2=_0xe76e[_0x5c3235];return _0x4696d2;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xee76('0x0'),_0xee76('0x1'),_0xee76('0x2')];function createListener(_0x91afe1,_0x1acc49){return function(_0x31c6ca){_0x1acc49['emit'](_0x91afe1,_0x31c6ca);};}function removeListener(_0x53f71f,_0x186f11){return function(){OpenchannelInteractionEvents['removeListener'](_0x53f71f,_0x186f11);};}exports[_0xee76('0x3')]=function(_0x5ac92b){for(var _0x42c815=0x0,_0xec6573=events['length'];_0x42c815<_0xec6573;_0x42c815++){var _0x305783=events[_0x42c815];var _0x32f393=createListener(_0xee76('0x4')+_0x305783,_0x5ac92b);OpenchannelInteractionEvents['on'](_0x305783,_0x32f393);}}; \ No newline at end of file +var _0x00e0=['register','length','./openchannelInteraction.events','save','remove','update'];(function(_0x54afd9,_0x474494){var _0x5e6b4c=function(_0x2cfcaf){while(--_0x2cfcaf){_0x54afd9['push'](_0x54afd9['shift']());}};_0x5e6b4c(++_0x474494);}(_0x00e0,0x152));var _0x000e=function(_0x2e42c8,_0x4de46a){_0x2e42c8=_0x2e42c8-0x0;var _0x10ad51=_0x00e0[_0x2e42c8];return _0x10ad51;};'use strict';var OpenchannelInteractionEvents=require(_0x000e('0x0'));var events=[_0x000e('0x1'),_0x000e('0x2'),_0x000e('0x3')];function createListener(_0x5d6cbb,_0x44a4f0){return function(_0x281b13){_0x44a4f0['emit'](_0x5d6cbb,_0x281b13);};}function removeListener(_0x3e0a72,_0x15ee72){return function(){OpenchannelInteractionEvents['removeListener'](_0x3e0a72,_0x15ee72);};}exports[_0x000e('0x4')]=function(_0x196793){for(var _0x12cbcf=0x0,_0x4edd04=events[_0x000e('0x5')];_0x12cbcf<_0x4edd04;_0x12cbcf++){var _0x1fd2f4=events[_0x12cbcf];var _0x297688=createListener('openchannelInteraction:'+_0x1fd2f4,_0x196793);OpenchannelInteractionEvents['on'](_0x1fd2f4,_0x297688);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9335ad3..1ed6b06 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x262734,_0x6a7eb2){var _0x52c6c8=function(_0x3719c4){while(--_0x3719c4){_0x262734['push'](_0x262734['shift']());}};_0x52c6c8(++_0x6a7eb2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x127b52,_0x5ef4e4){var _0x49025b=function(_0x5e6d30){while(--_0x5e6d30){_0x127b52['push'](_0x127b52['shift']());}};_0x49025b(++_0x5ef4e4);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f54bcb5..2ebe4ba 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 _0x61d0=['STRING','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x2bdd9b,_0x3df1bc){var _0x103e81=function(_0x26184b){while(--_0x26184b){_0x2bdd9b['push'](_0x2bdd9b['shift']());}};_0x103e81(++_0x3df1bc);}(_0x61d0,0x187));var _0x061d=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x61d0[_0xfb0cfd];return _0x2fd8aa;};'use strict';var Sequelize=require(_0x061d('0x0'));module['exports']={'body':{'type':Sequelize[_0x061d('0x1')](_0x061d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x061d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x061d('0x4')),'defaultValue':_0x061d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x061d('0x5')]},'providerResponse':{'type':Sequelize[_0x061d('0x1')]}}; \ No newline at end of file +var _0x83e1=['BOOLEAN','out','DATE','sequelize','exports','medium'];(function(_0x407855,_0x1544c4){var _0x5c7578=function(_0x488ae7){while(--_0x488ae7){_0x407855['push'](_0x407855['shift']());}};_0x5c7578(++_0x1544c4);}(_0x83e1,0x1ad));var _0x183e=function(_0x2ad178,_0x24d83e){_0x2ad178=_0x2ad178-0x0;var _0x33c674=_0x83e1[_0x2ad178];return _0x33c674;};'use strict';var Sequelize=require(_0x183e('0x0'));module[_0x183e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x183e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x183e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x183e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x183e('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d08e595..f0c6a54 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 _0x22a5=['result','catch','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','create','body','destroy','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','update','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x29fc92,_0x588038){var _0x12804f=function(_0x549bdf){while(--_0x549bdf){_0x29fc92['push'](_0x29fc92['shift']());}};_0x12804f(++_0x588038);}(_0x22a5,0xe4));var _0x522a=function(_0x7c6109,_0x6167a9){_0x7c6109=_0x7c6109-0x0;var _0x3cdfbf=_0x22a5[_0x7c6109];return _0x3cdfbf;};'use strict';var emlformat=require(_0x522a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x522a('0x1'));var jsonpatch=require(_0x522a('0x2'));var rp=require('request-promise');var moment=require(_0x522a('0x3'));var BPromise=require(_0x522a('0x4'));var Mustache=require('mustache');var util=require(_0x522a('0x5'));var path=require(_0x522a('0x6'));var sox=require('sox');var csv=require(_0x522a('0x7'));var ejs=require(_0x522a('0x8'));var fs=require('fs');var fs_extra=require(_0x522a('0x9'));var _=require('lodash');var squel=require(_0x522a('0xa'));var crypto=require(_0x522a('0xb'));var jsforce=require(_0x522a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x522a('0x7'));var querystring=require(_0x522a('0xd'));var Papa=require(_0x522a('0xe'));var Redis=require(_0x522a('0xf'));var authService=require(_0x522a('0x10'));var qs=require(_0x522a('0x11'));var as=require(_0x522a('0x12'));var hardwareService=require(_0x522a('0x13'));var logger=require('../../config/logger')(_0x522a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x522a('0x15'));var db=require(_0x522a('0x16'))['db'];config['redis']=_[_0x522a('0x17')](config[_0x522a('0x18')],{'host':_0x522a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x522a('0x18')]));require(_0x522a('0x1a'))['register'](socket);var jayson=require(_0x522a('0x1b'));var client=jayson[_0x522a('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x522a('0x1c')][_0x522a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x57a2a1,_0x4d1cd7,_0x1c6e94,_0x5be5e4){return new BPromise(function(_0x3ec8cf,_0x7c8760){var _0x144498=_0x5be5e4||client;return _0x144498[_0x522a('0x1e')](_0x57a2a1,_0x1c6e94)['then'](function(_0x5bd62c){logger['info'](_0x522a('0x1f'),_0x4d1cd7,_0x522a('0x20'));logger[_0x522a('0x21')](_0x522a('0x22'),_0x4d1cd7,_0x522a('0x20'),JSON[_0x522a('0x23')](_0x5bd62c));if(_0x5bd62c[_0x522a('0x24')]){if(_0x5bd62c[_0x522a('0x24')][_0x522a('0x25')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4d1cd7,_0x5bd62c[_0x522a('0x24')][_0x522a('0x26')]);return _0x7c8760(_0x5bd62c[_0x522a('0x24')][_0x522a('0x26')]);}logger['error'](_0x522a('0x1f'),_0x4d1cd7,_0x5bd62c[_0x522a('0x24')]['message']);return _0x3ec8cf(_0x5bd62c[_0x522a('0x24')][_0x522a('0x26')]);}else{logger[_0x522a('0x27')](_0x522a('0x1f'),_0x4d1cd7,'request\x20sent');_0x3ec8cf(_0x5bd62c[_0x522a('0x28')][_0x522a('0x26')]);}})[_0x522a('0x29')](function(_0x56f8d2){logger[_0x522a('0x24')](_0x522a('0x1f'),_0x4d1cd7,_0x56f8d2);_0x7c8760(_0x56f8d2);});});}function respondWithStatusCode(_0x3a8815,_0x9850ed){_0x9850ed=_0x9850ed||0xcc;return function(_0x5dc2fc){if(_0x5dc2fc){return _0x3a8815[_0x522a('0x2a')](_0x9850ed);}return _0x3a8815[_0x522a('0x2b')](_0x9850ed)[_0x522a('0x2c')]();};}function respondWithResult(_0x256218,_0xaa1395){_0xaa1395=_0xaa1395||0xc8;return function(_0x341472){if(_0x341472){return _0x256218[_0x522a('0x2b')](_0xaa1395)[_0x522a('0x2d')](_0x341472);}};}function respondWithFilteredResult(_0x30e2c1,_0x1a293c){return function(_0x225e31){if(_0x225e31){var _0x8039d5=typeof _0x1a293c['offset']===_0x522a('0x2e')&&typeof _0x1a293c[_0x522a('0x2f')]==='undefined';var _0x41d3f7=_0x225e31['count'];var _0x539b14=_0x8039d5?0x0:_0x1a293c[_0x522a('0x30')];var _0x48ef28=_0x8039d5?_0x225e31[_0x522a('0x31')]:_0x1a293c[_0x522a('0x30')]+_0x1a293c['limit'];var _0x16f256;if(_0x48ef28>=_0x41d3f7){_0x48ef28=_0x41d3f7;_0x16f256=0xc8;}else{_0x16f256=0xce;}_0x30e2c1[_0x522a('0x2b')](_0x16f256);return _0x30e2c1['set'](_0x522a('0x32'),_0x539b14+'-'+_0x48ef28+'/'+_0x41d3f7)['json'](_0x225e31);}return null;};}function patchUpdates(_0x636774){return function(_0x1c31db){try{jsonpatch[_0x522a('0x33')](_0x1c31db,_0x636774,!![]);}catch(_0x4f44df){return BPromise[_0x522a('0x34')](_0x4f44df);}return _0x1c31db[_0x522a('0x35')]();};}function saveUpdates(_0x1567c2,_0x2f61da){return function(_0x34984c){if(_0x34984c){return _0x34984c['update'](_0x1567c2)[_0x522a('0x36')](function(_0x5b11bb){return _0x5b11bb;});}return null;};}function removeEntity(_0xbdcddd,_0x484baf){return function(_0x528e6b){if(_0x528e6b){return _0x528e6b['destroy']()[_0x522a('0x36')](function(){_0xbdcddd[_0x522a('0x2b')](0xcc)[_0x522a('0x2c')]();});}};}function handleEntityNotFound(_0x4ec6db,_0x55bc9e){return function(_0x21d03d){if(!_0x21d03d){_0x4ec6db[_0x522a('0x2a')](0x194);}return _0x21d03d;};}function handleError(_0xc71c34,_0x51f710){_0x51f710=_0x51f710||0x1f4;return function(_0x750c98){logger['error'](_0x750c98[_0x522a('0x37')]);if(_0x750c98[_0x522a('0x38')]){delete _0x750c98['name'];}_0xc71c34['status'](_0x51f710)[_0x522a('0x39')](_0x750c98);};}exports['index']=function(_0x2e63ca,_0x4de4e5){var _0x3eb437={},_0x332588={},_0x598dcf={'count':0x0,'rows':[]};var _0x1c0e42=_[_0x522a('0x3a')](db[_0x522a('0x3b')][_0x522a('0x3c')],function(_0x2973dd){return{'name':_0x2973dd[_0x522a('0x3d')],'type':_0x2973dd[_0x522a('0x3e')][_0x522a('0x3f')]};});_0x332588['model']=_[_0x522a('0x3a')](_0x1c0e42,_0x522a('0x38'));_0x332588[_0x522a('0x40')]=_['keys'](_0x2e63ca[_0x522a('0x40')]);_0x332588[_0x522a('0x41')]=_[_0x522a('0x42')](_0x332588[_0x522a('0x43')],_0x332588[_0x522a('0x40')]);_0x3eb437[_0x522a('0x44')]=_['intersection'](_0x332588[_0x522a('0x43')],qs[_0x522a('0x45')](_0x2e63ca[_0x522a('0x40')][_0x522a('0x45')]));_0x3eb437[_0x522a('0x44')]=_0x3eb437['attributes'][_0x522a('0x46')]?_0x3eb437[_0x522a('0x44')]:_0x332588[_0x522a('0x43')];if(!_0x2e63ca[_0x522a('0x40')][_0x522a('0x47')]('nolimit')){_0x3eb437[_0x522a('0x2f')]=qs[_0x522a('0x2f')](_0x2e63ca['query'][_0x522a('0x2f')]);_0x3eb437['offset']=qs[_0x522a('0x30')](_0x2e63ca[_0x522a('0x40')][_0x522a('0x30')]);}_0x3eb437[_0x522a('0x48')]=qs[_0x522a('0x49')](_0x2e63ca[_0x522a('0x40')][_0x522a('0x49')]);_0x3eb437[_0x522a('0x4a')]=qs[_0x522a('0x41')](_[_0x522a('0x4b')](_0x2e63ca[_0x522a('0x40')],_0x332588['filters']),_0x1c0e42);if(_0x2e63ca[_0x522a('0x40')][_0x522a('0x4c')]){_0x3eb437[_0x522a('0x4a')]=_[_0x522a('0x4d')](_0x3eb437[_0x522a('0x4a')],{'$or':_[_0x522a('0x3a')](_0x1c0e42,function(_0x2083f3){if(_0x2083f3['type']!==_0x522a('0x4e')){var _0x3671a7={};_0x3671a7[_0x2083f3['name']]={'$like':'%'+_0x2e63ca['query']['filter']+'%'};return _0x3671a7;}})});}_0x3eb437=_[_0x522a('0x4d')]({},_0x3eb437,_0x2e63ca[_0x522a('0x4f')]);var _0x2ff2f3={'where':_0x3eb437[_0x522a('0x4a')]};return db[_0x522a('0x3b')][_0x522a('0x31')](_0x2ff2f3)[_0x522a('0x36')](function(_0x6db575){_0x598dcf[_0x522a('0x31')]=_0x6db575;if(_0x2e63ca[_0x522a('0x40')][_0x522a('0x50')]){_0x3eb437['include']=[{'all':!![]}];}return db[_0x522a('0x3b')][_0x522a('0x51')](_0x3eb437);})[_0x522a('0x36')](function(_0x525de3){_0x598dcf[_0x522a('0x52')]=_0x525de3;return _0x598dcf;})['then'](respondWithFilteredResult(_0x4de4e5,_0x3eb437))[_0x522a('0x29')](handleError(_0x4de4e5,null));};exports['show']=function(_0x16e49e,_0x12db69){var _0x43d9c3={'raw':!![],'where':{'id':_0x16e49e[_0x522a('0x53')]['id']}},_0x49f6c6={};_0x49f6c6[_0x522a('0x43')]=_[_0x522a('0x54')](db['OpenchannelMessage'][_0x522a('0x3c')]);_0x49f6c6[_0x522a('0x40')]=_['keys'](_0x16e49e[_0x522a('0x40')]);_0x49f6c6[_0x522a('0x41')]=_[_0x522a('0x42')](_0x49f6c6[_0x522a('0x43')],_0x49f6c6[_0x522a('0x40')]);_0x43d9c3[_0x522a('0x44')]=_[_0x522a('0x42')](_0x49f6c6[_0x522a('0x43')],qs[_0x522a('0x45')](_0x16e49e[_0x522a('0x40')]['fields']));_0x43d9c3[_0x522a('0x44')]=_0x43d9c3[_0x522a('0x44')][_0x522a('0x46')]?_0x43d9c3[_0x522a('0x44')]:_0x49f6c6[_0x522a('0x43')];if(_0x16e49e[_0x522a('0x40')][_0x522a('0x50')]){_0x43d9c3[_0x522a('0x55')]=[{'all':!![]}];}_0x43d9c3=_[_0x522a('0x4d')]({},_0x43d9c3,_0x16e49e['options']);return db[_0x522a('0x3b')][_0x522a('0x56')](_0x43d9c3)[_0x522a('0x36')](handleEntityNotFound(_0x12db69,null))[_0x522a('0x36')](respondWithResult(_0x12db69,null))[_0x522a('0x29')](handleError(_0x12db69,null));};exports[_0x522a('0x57')]=function(_0x48d249,_0x5ea8cb){return db[_0x522a('0x3b')][_0x522a('0x57')](_0x48d249[_0x522a('0x58')],{})[_0x522a('0x36')](respondWithResult(_0x5ea8cb,0xc9))[_0x522a('0x29')](handleError(_0x5ea8cb,null));};exports['update']=function(_0x22e1a7,_0x1f0aed){if(_0x22e1a7[_0x522a('0x58')]['id']){delete _0x22e1a7[_0x522a('0x58')]['id'];}return db[_0x522a('0x3b')]['find']({'where':{'id':_0x22e1a7[_0x522a('0x53')]['id']}})[_0x522a('0x36')](handleEntityNotFound(_0x1f0aed,null))[_0x522a('0x36')](saveUpdates(_0x22e1a7['body'],null))[_0x522a('0x36')](respondWithResult(_0x1f0aed,null))[_0x522a('0x29')](handleError(_0x1f0aed,null));};exports[_0x522a('0x59')]=function(_0x40b767,_0x5851fd){return db['OpenchannelMessage'][_0x522a('0x56')]({'where':{'id':_0x40b767[_0x522a('0x53')]['id']}})[_0x522a('0x36')](handleEntityNotFound(_0x5851fd,null))[_0x522a('0x36')](removeEntity(_0x5851fd,null))['catch'](handleError(_0x5851fd,null));};exports[_0x522a('0x5a')]=function(_0x3d7682,_0x2a4a57){return db[_0x522a('0x3b')]['describe']()[_0x522a('0x36')](respondWithResult(_0x2a4a57,null))['catch'](handleError(_0x2a4a57,null));};var interaction_log=require('../../config/logger')(_0x522a('0x5b'));exports[_0x522a('0x5c')]=function(_0x1ecfcf,_0x31eb18,_0x1f5311){var _0x18e2d7={'agent':{},'channel':'openchannel'};if(_0x1ecfcf[_0x522a('0x58')]['id']){delete _0x1ecfcf['body']['id'];}_0x1ecfcf['body'][_0x522a('0x5d')]=!![];_0x1ecfcf[_0x522a('0x58')][_0x522a('0x5e')]=moment()['format'](_0x522a('0x5f'));_0x1ecfcf[_0x522a('0x58')][_0x522a('0x60')]=_0x1ecfcf['body']['UserId']||_0x1ecfcf[_0x522a('0x61')]['id'];_0x18e2d7['agent']['id']=_0x1ecfcf[_0x522a('0x58')]['UserId'];return db[_0x522a('0x3b')][_0x522a('0x56')]({'where':{'id':_0x1ecfcf[_0x522a('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31eb18,null))['then'](saveUpdates(_0x1ecfcf['body'],null))[_0x522a('0x36')](function(_0x1dbc15){if(_0x1dbc15){_0x18e2d7['message']=_0x1dbc15[_0x522a('0x62')]({'plain':!![]});return db[_0x522a('0x63')]['find']({'where':{'id':_0x1dbc15[_0x522a('0x64')]}});}return null;})[_0x522a('0x36')](handleEntityNotFound(_0x31eb18,null))[_0x522a('0x36')](function(_0x1c35ae){if(_0x1c35ae){return _0x1c35ae[_0x522a('0x65')]({'UserId':_0x1ecfcf['body']['UserId'],'read1stAt':_['isNil'](_0x1c35ae[_0x522a('0x66')])?moment()[_0x522a('0x67')](_0x522a('0x5f')):undefined});}return null;})[_0x522a('0x36')](function(_0x3b37d0){if(_0x3b37d0){_0x18e2d7[_0x522a('0x68')]=_0x3b37d0[_0x522a('0x62')]({'plain':!![]});interaction_log[_0x522a('0x27')](_0x522a('0x69'),_0x1ecfcf[_0x522a('0x61')]['id'],_0x1ecfcf[_0x522a('0x61')][_0x522a('0x38')],_0x1ecfcf[_0x522a('0x61')][_0x522a('0x6a')],_0x18e2d7['interaction']['id'],_0x1ecfcf['body']?JSON['stringify'](_0x1ecfcf['body']):_0x522a('0x6b'));return respondWithRpcPromise(_0x522a('0x6c'),_0x522a('0x6d'),_0x18e2d7);}return null;})[_0x522a('0x36')](function(_0x25d0d5){var _0x79fab6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25d0d5[_0x522a('0x26')][_0x522a('0x6e')];return db[_0x522a('0x6f')]['query'](_0x79fab6,{'type':db[_0x522a('0x70')][_0x522a('0x71')][_0x522a('0x72')],'raw':!![]})[_0x522a('0x36')](function(_0x3f7ed9){return _0x3f7ed9;});})[_0x522a('0x36')](function(_0x410f67){if(_0x410f67){_0x18e2d7[_0x522a('0x26')][_0x522a('0x73')]=_0x410f67[0x0];if(!_0x1ecfcf[_0x522a('0x58')][_0x522a('0x60')])return;return db[_0x522a('0x74')][_0x522a('0x56')]({'where':{'id':_0x1ecfcf['body'][_0x522a('0x60')],'role':_0x522a('0x75')},'attributes':['id',_0x522a('0x38'),_0x522a('0x76'),_0x522a('0x77'),_0x522a('0x78')],'raw':!![]});}return null;})[_0x522a('0x36')](function(_0x5decc2){if(!_0x5decc2)return null;_0x18e2d7[_0x522a('0x26')]['agent']=_0x5decc2;return _0x18e2d7;})['then'](function(_0x11453d){if(_0x11453d){if(_0x1ecfcf['body'][_0x522a('0x79')]){_0x18e2d7[_0x522a('0x26')][_0x522a('0x7a')]=util[_0x522a('0x67')]('SIP/%s',_0x1ecfcf[_0x522a('0x61')]['name']);_0x18e2d7['message'][_0x522a('0x7b')]=_0x18e2d7[_0x522a('0x7b')];_0x18e2d7['message'][_0x522a('0x7c')]=_0x18e2d7['channel'];_0x18e2d7[_0x522a('0x26')]['event']='accept';return respondWithRpcPromise(_0x522a('0x7d'),_0x522a('0x7d'),{'event':_0x522a('0x7e'),'message':_0x18e2d7[_0x522a('0x26')]},client9002)[_0x522a('0x36')](function(){return _0x18e2d7;});}return _0x18e2d7;}return null;})['then'](respondWithResult(_0x31eb18,null))[_0x522a('0x29')](handleError(_0x31eb18,null));};var interaction_log=require('../../config/logger')(_0x522a('0x5b'));exports['reject']=function(_0x26c953,_0x3bd684,_0x48ca83){var _0xd8a348={'agent':{},'channel':_0x522a('0x7f')};if(_0x26c953[_0x522a('0x58')]['id']){delete _0x26c953[_0x522a('0x58')]['id'];}_0x26c953[_0x522a('0x58')][_0x522a('0x60')]=_0x26c953[_0x522a('0x58')][_0x522a('0x60')]||_0x26c953[_0x522a('0x61')]['id'];_0xd8a348[_0x522a('0x75')]['id']=_0x26c953['body'][_0x522a('0x60')];return db[_0x522a('0x3b')][_0x522a('0x56')]({'where':{'id':_0x26c953[_0x522a('0x53')]['id'],'UserId':null}})[_0x522a('0x36')](handleEntityNotFound(_0x3bd684,null))['then'](function(_0x3be51f){if(_0x3be51f){_0xd8a348[_0x522a('0x26')]=_0x3be51f['get']({'plain':!![]});return db[_0x522a('0x63')][_0x522a('0x56')]({'where':{'id':_0x3be51f[_0x522a('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3bd684,null))[_0x522a('0x36')](function(_0x1eac6d){if(_0x1eac6d){_0xd8a348[_0x522a('0x68')]=_0x1eac6d[_0x522a('0x62')]({'plain':!![]});interaction_log[_0x522a('0x27')](_0x522a('0x80'),_0x26c953[_0x522a('0x61')]['id'],_0x26c953[_0x522a('0x61')][_0x522a('0x38')],_0x26c953['user'][_0x522a('0x6a')],_0xd8a348[_0x522a('0x68')]['id'],_0x26c953['body']?JSON[_0x522a('0x23')](_0x26c953[_0x522a('0x58')]):_0x522a('0x6b'));return respondWithRpcPromise(_0x522a('0x81'),_0x522a('0x82'),_0xd8a348);}return null;})[_0x522a('0x36')](function(_0x136a3c){var _0x172730=_0x522a('0x83')+_0x136a3c['message'][_0x522a('0x6e')];return db[_0x522a('0x6f')][_0x522a('0x40')](_0x172730,{'type':db[_0x522a('0x70')]['QueryTypes'][_0x522a('0x72')],'raw':!![]})['then'](function(_0x3b55a8){return _0x3b55a8;});})[_0x522a('0x36')](function(_0x52c9bc){if(_0x52c9bc){_0xd8a348[_0x522a('0x26')]['contact']=_0x52c9bc[0x0];if(!_0x26c953[_0x522a('0x58')][_0x522a('0x60')])return;return db[_0x522a('0x74')]['find']({'where':{'id':_0x26c953['body'][_0x522a('0x60')],'role':_0x522a('0x75')},'attributes':['id',_0x522a('0x38'),'fullname',_0x522a('0x77'),_0x522a('0x78')],'raw':!![]});}return null;})[_0x522a('0x36')](function(_0x1fe1bc){if(!_0x1fe1bc)return null;_0xd8a348[_0x522a('0x26')]['agent']=_0x1fe1bc;return _0xd8a348;})['then'](function(_0x39f275){if(_0x39f275){_0x39f275[_0x522a('0x26')][_0x522a('0x7a')]=util[_0x522a('0x67')](_0x522a('0x84'),_0x26c953['user']['name']);_0x39f275[_0x522a('0x26')][_0x522a('0x7b')]=_0xd8a348['channel'];_0x39f275[_0x522a('0x26')][_0x522a('0x7c')]=_0xd8a348['channel'];_0x39f275['message']['event']=_0x522a('0x34');respondWithRpcPromise(_0x522a('0x7d'),_0x522a('0x7d'),{'event':_0x522a('0x85'),'message':_0x39f275['message']},client9002);return _0xd8a348;}return null;})[_0x522a('0x36')](respondWithResult(_0x3bd684,null))[_0x522a('0x29')](handleError(_0x3bd684,null));}; \ No newline at end of file +var _0xcda9=['findAll','show','params','rawAttributes','length','includeAll','include','find','body','update','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[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','QueryTypes','SELECT','contact','fullname','interface','motionChannel','event','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','email','internal','SIP/%s','channel','rejectmessage','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0xcda9,0xb2));var _0x9cda=function(_0x505bb2,_0x5d7637){_0x505bb2=_0x505bb2-0x0;var _0x342e85=_0xcda9[_0x505bb2];return _0x342e85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cda('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cda('0x1'));var rp=require(_0x9cda('0x2'));var moment=require(_0x9cda('0x3'));var BPromise=require(_0x9cda('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cda('0x5'));var csv=require(_0x9cda('0x6'));var ejs=require(_0x9cda('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9cda('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9cda('0x9'));var toCsv=require(_0x9cda('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cda('0xa'));var authService=require(_0x9cda('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x9cda('0xc'));var hardwareService=require(_0x9cda('0xd'));var logger=require(_0x9cda('0xe'))(_0x9cda('0xf'));var utils=require('../../config/utils');var config=require(_0x9cda('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x9cda('0x11'))['db'];config[_0x9cda('0x12')]=_[_0x9cda('0x13')](config[_0x9cda('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x9cda('0x14'))(new Redis(config['redis']));require(_0x9cda('0x15'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9cda('0x16')][_0x9cda('0x17')]({'port':0x232c});var client9002=jayson[_0x9cda('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47dafc,_0x4b5f34,_0xf7110c,_0x324641){return new BPromise(function(_0x58b05c,_0x471d71){var _0x19ae87=_0x324641||client;return _0x19ae87[_0x9cda('0x18')](_0x47dafc,_0xf7110c)[_0x9cda('0x19')](function(_0x47fd3d){logger['info'](_0x9cda('0x1a'),_0x4b5f34,_0x9cda('0x1b'));logger[_0x9cda('0x1c')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4b5f34,_0x9cda('0x1b'),JSON[_0x9cda('0x1d')](_0x47fd3d));if(_0x47fd3d[_0x9cda('0x1e')]){if(_0x47fd3d[_0x9cda('0x1e')][_0x9cda('0x1f')]===0x1f4){logger[_0x9cda('0x1e')](_0x9cda('0x1a'),_0x4b5f34,_0x47fd3d[_0x9cda('0x1e')][_0x9cda('0x20')]);return _0x471d71(_0x47fd3d['error'][_0x9cda('0x20')]);}logger[_0x9cda('0x1e')](_0x9cda('0x1a'),_0x4b5f34,_0x47fd3d[_0x9cda('0x1e')][_0x9cda('0x20')]);return _0x58b05c(_0x47fd3d['error'][_0x9cda('0x20')]);}else{logger[_0x9cda('0x21')](_0x9cda('0x1a'),_0x4b5f34,_0x9cda('0x1b'));_0x58b05c(_0x47fd3d['result'][_0x9cda('0x20')]);}})[_0x9cda('0x22')](function(_0x45557c){logger['error'](_0x9cda('0x1a'),_0x4b5f34,_0x45557c);_0x471d71(_0x45557c);});});}function respondWithStatusCode(_0x8f68ed,_0x1502f7){_0x1502f7=_0x1502f7||0xcc;return function(_0x2b99eb){if(_0x2b99eb){return _0x8f68ed[_0x9cda('0x23')](_0x1502f7);}return _0x8f68ed[_0x9cda('0x24')](_0x1502f7)[_0x9cda('0x25')]();};}function respondWithResult(_0x2f3ce8,_0x34160e){_0x34160e=_0x34160e||0xc8;return function(_0x3d3be6){if(_0x3d3be6){return _0x2f3ce8[_0x9cda('0x24')](_0x34160e)[_0x9cda('0x26')](_0x3d3be6);}};}function respondWithFilteredResult(_0x53de34,_0x237567){return function(_0x1f927a){if(_0x1f927a){var _0x526b58=typeof _0x237567['offset']===_0x9cda('0x27')&&typeof _0x237567[_0x9cda('0x28')]===_0x9cda('0x27');var _0x19e9cb=_0x1f927a['count'];var _0x281746=_0x526b58?0x0:_0x237567['offset'];var _0x15dccb=_0x526b58?_0x1f927a[_0x9cda('0x29')]:_0x237567[_0x9cda('0x2a')]+_0x237567[_0x9cda('0x28')];var _0x498d4c;if(_0x15dccb>=_0x19e9cb){_0x15dccb=_0x19e9cb;_0x498d4c=0xc8;}else{_0x498d4c=0xce;}_0x53de34[_0x9cda('0x24')](_0x498d4c);return _0x53de34[_0x9cda('0x2b')]('Content-Range',_0x281746+'-'+_0x15dccb+'/'+_0x19e9cb)[_0x9cda('0x26')](_0x1f927a);}return null;};}function patchUpdates(_0x3cb0ac){return function(_0x47c834){try{jsonpatch[_0x9cda('0x2c')](_0x47c834,_0x3cb0ac,!![]);}catch(_0x467cbd){return BPromise['reject'](_0x467cbd);}return _0x47c834[_0x9cda('0x2d')]();};}function saveUpdates(_0x28cb56,_0x4544c2){return function(_0x38b9b7){if(_0x38b9b7){return _0x38b9b7['update'](_0x28cb56)[_0x9cda('0x19')](function(_0x33af1f){return _0x33af1f;});}return null;};}function removeEntity(_0x238337,_0x456271){return function(_0x4562e2){if(_0x4562e2){return _0x4562e2[_0x9cda('0x2e')]()[_0x9cda('0x19')](function(){_0x238337[_0x9cda('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21874d,_0x5325f1){return function(_0x224a61){if(!_0x224a61){_0x21874d[_0x9cda('0x23')](0x194);}return _0x224a61;};}function handleError(_0x5395c7,_0xdd3714){_0xdd3714=_0xdd3714||0x1f4;return function(_0x595b34){logger[_0x9cda('0x1e')](_0x595b34[_0x9cda('0x2f')]);if(_0x595b34[_0x9cda('0x30')]){delete _0x595b34['name'];}_0x5395c7['status'](_0xdd3714)[_0x9cda('0x31')](_0x595b34);};}exports[_0x9cda('0x32')]=function(_0x28d80d,_0xbbb0b6){var _0xe2844a={},_0x4bfee0={},_0x2724af={'count':0x0,'rows':[]};var _0x4a35b4=_[_0x9cda('0x33')](db[_0x9cda('0x34')]['rawAttributes'],function(_0x7ca2f2){return{'name':_0x7ca2f2[_0x9cda('0x35')],'type':_0x7ca2f2[_0x9cda('0x36')]['key']};});_0x4bfee0['model']=_[_0x9cda('0x33')](_0x4a35b4,_0x9cda('0x30'));_0x4bfee0[_0x9cda('0x37')]=_[_0x9cda('0x38')](_0x28d80d[_0x9cda('0x37')]);_0x4bfee0[_0x9cda('0x39')]=_[_0x9cda('0x3a')](_0x4bfee0[_0x9cda('0x3b')],_0x4bfee0[_0x9cda('0x37')]);_0xe2844a[_0x9cda('0x3c')]=_[_0x9cda('0x3a')](_0x4bfee0[_0x9cda('0x3b')],qs[_0x9cda('0x3d')](_0x28d80d['query']['fields']));_0xe2844a[_0x9cda('0x3c')]=_0xe2844a['attributes']['length']?_0xe2844a['attributes']:_0x4bfee0[_0x9cda('0x3b')];if(!_0x28d80d['query'][_0x9cda('0x3e')](_0x9cda('0x3f'))){_0xe2844a[_0x9cda('0x28')]=qs[_0x9cda('0x28')](_0x28d80d[_0x9cda('0x37')]['limit']);_0xe2844a[_0x9cda('0x2a')]=qs[_0x9cda('0x2a')](_0x28d80d[_0x9cda('0x37')][_0x9cda('0x2a')]);}_0xe2844a[_0x9cda('0x40')]=qs[_0x9cda('0x41')](_0x28d80d[_0x9cda('0x37')][_0x9cda('0x41')]);_0xe2844a[_0x9cda('0x42')]=qs[_0x9cda('0x39')](_[_0x9cda('0x43')](_0x28d80d[_0x9cda('0x37')],_0x4bfee0['filters']),_0x4a35b4);if(_0x28d80d[_0x9cda('0x37')]['filter']){_0xe2844a[_0x9cda('0x42')]=_[_0x9cda('0x44')](_0xe2844a[_0x9cda('0x42')],{'$or':_[_0x9cda('0x33')](_0x4a35b4,function(_0x1081f3){if(_0x1081f3[_0x9cda('0x36')]!==_0x9cda('0x45')){var _0x33b355={};_0x33b355[_0x1081f3[_0x9cda('0x30')]]={'$like':'%'+_0x28d80d[_0x9cda('0x37')][_0x9cda('0x46')]+'%'};return _0x33b355;}})});}_0xe2844a=_[_0x9cda('0x44')]({},_0xe2844a,_0x28d80d[_0x9cda('0x47')]);var _0x3e7eda={'where':_0xe2844a[_0x9cda('0x42')]};return db[_0x9cda('0x34')]['count'](_0x3e7eda)[_0x9cda('0x19')](function(_0x26b2ac){_0x2724af[_0x9cda('0x29')]=_0x26b2ac;if(_0x28d80d[_0x9cda('0x37')]['includeAll']){_0xe2844a['include']=[{'all':!![]}];}return db[_0x9cda('0x34')][_0x9cda('0x48')](_0xe2844a);})[_0x9cda('0x19')](function(_0x301327){_0x2724af['rows']=_0x301327;return _0x2724af;})[_0x9cda('0x19')](respondWithFilteredResult(_0xbbb0b6,_0xe2844a))[_0x9cda('0x22')](handleError(_0xbbb0b6,null));};exports[_0x9cda('0x49')]=function(_0x4aaed4,_0x360b2f){var _0x4ac383={'raw':!![],'where':{'id':_0x4aaed4[_0x9cda('0x4a')]['id']}},_0x1af40e={};_0x1af40e[_0x9cda('0x3b')]=_['keys'](db[_0x9cda('0x34')][_0x9cda('0x4b')]);_0x1af40e[_0x9cda('0x37')]=_['keys'](_0x4aaed4['query']);_0x1af40e['filters']=_[_0x9cda('0x3a')](_0x1af40e[_0x9cda('0x3b')],_0x1af40e[_0x9cda('0x37')]);_0x4ac383['attributes']=_[_0x9cda('0x3a')](_0x1af40e[_0x9cda('0x3b')],qs['fields'](_0x4aaed4[_0x9cda('0x37')][_0x9cda('0x3d')]));_0x4ac383[_0x9cda('0x3c')]=_0x4ac383['attributes'][_0x9cda('0x4c')]?_0x4ac383['attributes']:_0x1af40e[_0x9cda('0x3b')];if(_0x4aaed4[_0x9cda('0x37')][_0x9cda('0x4d')]){_0x4ac383[_0x9cda('0x4e')]=[{'all':!![]}];}_0x4ac383=_[_0x9cda('0x44')]({},_0x4ac383,_0x4aaed4[_0x9cda('0x47')]);return db[_0x9cda('0x34')][_0x9cda('0x4f')](_0x4ac383)[_0x9cda('0x19')](handleEntityNotFound(_0x360b2f,null))['then'](respondWithResult(_0x360b2f,null))['catch'](handleError(_0x360b2f,null));};exports['create']=function(_0xd572bb,_0x9f0c41){return db[_0x9cda('0x34')]['create'](_0xd572bb[_0x9cda('0x50')],{})[_0x9cda('0x19')](respondWithResult(_0x9f0c41,0xc9))[_0x9cda('0x22')](handleError(_0x9f0c41,null));};exports[_0x9cda('0x51')]=function(_0x196905,_0x24919e){if(_0x196905[_0x9cda('0x50')]['id']){delete _0x196905['body']['id'];}return db['OpenchannelMessage'][_0x9cda('0x4f')]({'where':{'id':_0x196905['params']['id']}})[_0x9cda('0x19')](handleEntityNotFound(_0x24919e,null))[_0x9cda('0x19')](saveUpdates(_0x196905[_0x9cda('0x50')],null))[_0x9cda('0x19')](respondWithResult(_0x24919e,null))['catch'](handleError(_0x24919e,null));};exports[_0x9cda('0x2e')]=function(_0x1faaa9,_0x517476){return db[_0x9cda('0x34')][_0x9cda('0x4f')]({'where':{'id':_0x1faaa9['params']['id']}})[_0x9cda('0x19')](handleEntityNotFound(_0x517476,null))[_0x9cda('0x19')](removeEntity(_0x517476,null))[_0x9cda('0x22')](handleError(_0x517476,null));};exports[_0x9cda('0x52')]=function(_0x3909c5,_0x507fcc){return db[_0x9cda('0x34')][_0x9cda('0x52')]()[_0x9cda('0x19')](respondWithResult(_0x507fcc,null))['catch'](handleError(_0x507fcc,null));};var interaction_log=require(_0x9cda('0xe'))(_0x9cda('0x53'));exports[_0x9cda('0x54')]=function(_0x342aaf,_0x4430db,_0x592461){var _0xe640c8={'agent':{},'channel':_0x9cda('0x55')};if(_0x342aaf[_0x9cda('0x50')]['id']){delete _0x342aaf[_0x9cda('0x50')]['id'];}_0x342aaf[_0x9cda('0x50')][_0x9cda('0x56')]=!![];_0x342aaf[_0x9cda('0x50')][_0x9cda('0x57')]=moment()[_0x9cda('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x342aaf['body'][_0x9cda('0x59')]=_0x342aaf[_0x9cda('0x50')]['UserId']||_0x342aaf[_0x9cda('0x5a')]['id'];_0xe640c8[_0x9cda('0x5b')]['id']=_0x342aaf[_0x9cda('0x50')][_0x9cda('0x59')];return db[_0x9cda('0x34')][_0x9cda('0x4f')]({'where':{'id':_0x342aaf[_0x9cda('0x4a')]['id'],'UserId':null}})[_0x9cda('0x19')](handleEntityNotFound(_0x4430db,null))['then'](saveUpdates(_0x342aaf['body'],null))[_0x9cda('0x19')](function(_0x2ea012){if(_0x2ea012){_0xe640c8[_0x9cda('0x20')]=_0x2ea012[_0x9cda('0x5c')]({'plain':!![]});return db['OpenchannelInteraction'][_0x9cda('0x4f')]({'where':{'id':_0x2ea012[_0x9cda('0x5d')]}});}return null;})[_0x9cda('0x19')](handleEntityNotFound(_0x4430db,null))[_0x9cda('0x19')](function(_0x3ab994){if(_0x3ab994){return _0x3ab994['update']({'UserId':_0x342aaf['body'][_0x9cda('0x59')],'read1stAt':_[_0x9cda('0x5e')](_0x3ab994[_0x9cda('0x5f')])?moment()[_0x9cda('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9cda('0x19')](function(_0x5744f7){if(_0x5744f7){_0xe640c8[_0x9cda('0x60')]=_0x5744f7[_0x9cda('0x5c')]({'plain':!![]});interaction_log[_0x9cda('0x21')](_0x9cda('0x61'),_0x342aaf[_0x9cda('0x5a')]['id'],_0x342aaf[_0x9cda('0x5a')]['name'],_0x342aaf[_0x9cda('0x5a')][_0x9cda('0x62')],_0xe640c8[_0x9cda('0x60')]['id'],_0x342aaf[_0x9cda('0x50')]?JSON['stringify'](_0x342aaf[_0x9cda('0x50')]):_0x9cda('0x63'));return respondWithRpcPromise(_0x9cda('0x64'),_0x9cda('0x65'),_0xe640c8);}return null;})[_0x9cda('0x19')](function(_0x490ed5){var _0x19e771=_0x9cda('0x66')+_0x490ed5['message'][_0x9cda('0x67')];return db[_0x9cda('0x68')][_0x9cda('0x37')](_0x19e771,{'type':db[_0x9cda('0x69')][_0x9cda('0x6a')][_0x9cda('0x6b')],'raw':!![]})[_0x9cda('0x19')](function(_0x4c8363){return _0x4c8363;});})[_0x9cda('0x19')](function(_0x3026f8){if(_0x3026f8){_0xe640c8['message'][_0x9cda('0x6c')]=_0x3026f8[0x0];if(!_0x342aaf['body'][_0x9cda('0x59')])return;return db['User']['find']({'where':{'id':_0x342aaf['body'][_0x9cda('0x59')],'role':_0x9cda('0x5b')},'attributes':['id',_0x9cda('0x30'),_0x9cda('0x6d'),'email','internal'],'raw':!![]});}return null;})[_0x9cda('0x19')](function(_0x5c8729){if(!_0x5c8729)return null;_0xe640c8['message'][_0x9cda('0x5b')]=_0x5c8729;return _0xe640c8;})['then'](function(_0x30ff3e){if(_0x30ff3e){if(_0x342aaf['body']['manual']){_0xe640c8[_0x9cda('0x20')][_0x9cda('0x6e')]=util[_0x9cda('0x58')]('SIP/%s',_0x342aaf[_0x9cda('0x5a')][_0x9cda('0x30')]);_0xe640c8['message']['channel']=_0xe640c8['channel'];_0xe640c8[_0x9cda('0x20')][_0x9cda('0x6f')]=_0xe640c8['channel'];_0xe640c8[_0x9cda('0x20')][_0x9cda('0x70')]=_0x9cda('0x54');return respondWithRpcPromise(_0x9cda('0x71'),'EventManager',{'event':_0x9cda('0x72'),'message':_0xe640c8[_0x9cda('0x20')]},client9002)['then'](function(){return _0xe640c8;});}return _0xe640c8;}return null;})[_0x9cda('0x19')](respondWithResult(_0x4430db,null))[_0x9cda('0x22')](handleError(_0x4430db,null));};var interaction_log=require('../../config/logger')(_0x9cda('0x53'));exports[_0x9cda('0x73')]=function(_0x7d5141,_0x3b1984,_0x143417){var _0x372641={'agent':{},'channel':_0x9cda('0x55')};if(_0x7d5141[_0x9cda('0x50')]['id']){delete _0x7d5141[_0x9cda('0x50')]['id'];}_0x7d5141['body'][_0x9cda('0x59')]=_0x7d5141[_0x9cda('0x50')][_0x9cda('0x59')]||_0x7d5141[_0x9cda('0x5a')]['id'];_0x372641[_0x9cda('0x5b')]['id']=_0x7d5141[_0x9cda('0x50')][_0x9cda('0x59')];return db[_0x9cda('0x34')][_0x9cda('0x4f')]({'where':{'id':_0x7d5141['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b1984,null))['then'](function(_0x882151){if(_0x882151){_0x372641['message']=_0x882151['get']({'plain':!![]});return db[_0x9cda('0x74')][_0x9cda('0x4f')]({'where':{'id':_0x882151[_0x9cda('0x5d')]}});}return null;})[_0x9cda('0x19')](handleEntityNotFound(_0x3b1984,null))['then'](function(_0x77267d){if(_0x77267d){_0x372641['interaction']=_0x77267d[_0x9cda('0x5c')]({'plain':!![]});interaction_log[_0x9cda('0x21')](_0x9cda('0x75'),_0x7d5141[_0x9cda('0x5a')]['id'],_0x7d5141[_0x9cda('0x5a')][_0x9cda('0x30')],_0x7d5141['user'][_0x9cda('0x62')],_0x372641['interaction']['id'],_0x7d5141[_0x9cda('0x50')]?JSON['stringify'](_0x7d5141[_0x9cda('0x50')]):'null');return respondWithRpcPromise(_0x9cda('0x76'),'rejectMessage',_0x372641);}return null;})['then'](function(_0x484c60){var _0x272edf=_0x9cda('0x66')+_0x484c60[_0x9cda('0x20')]['ContactId'];return db['sequelize'][_0x9cda('0x37')](_0x272edf,{'type':db[_0x9cda('0x69')][_0x9cda('0x6a')][_0x9cda('0x6b')],'raw':!![]})[_0x9cda('0x19')](function(_0x4b9510){return _0x4b9510;});})[_0x9cda('0x19')](function(_0x348832){if(_0x348832){_0x372641[_0x9cda('0x20')][_0x9cda('0x6c')]=_0x348832[0x0];if(!_0x7d5141[_0x9cda('0x50')]['UserId'])return;return db[_0x9cda('0x77')]['find']({'where':{'id':_0x7d5141[_0x9cda('0x50')][_0x9cda('0x59')],'role':'agent'},'attributes':['id',_0x9cda('0x30'),_0x9cda('0x6d'),_0x9cda('0x78'),_0x9cda('0x79')],'raw':!![]});}return null;})[_0x9cda('0x19')](function(_0x3059ac){if(!_0x3059ac)return null;_0x372641[_0x9cda('0x20')][_0x9cda('0x5b')]=_0x3059ac;return _0x372641;})[_0x9cda('0x19')](function(_0x34dcde){if(_0x34dcde){_0x34dcde['message'][_0x9cda('0x6e')]=util[_0x9cda('0x58')](_0x9cda('0x7a'),_0x7d5141['user']['name']);_0x34dcde[_0x9cda('0x20')][_0x9cda('0x7b')]=_0x372641[_0x9cda('0x7b')];_0x34dcde[_0x9cda('0x20')]['motionChannel']=_0x372641[_0x9cda('0x7b')];_0x34dcde['message']['event']=_0x9cda('0x73');respondWithRpcPromise(_0x9cda('0x71'),_0x9cda('0x71'),{'event':_0x9cda('0x7c'),'message':_0x34dcde[_0x9cda('0x20')]},client9002);return _0x372641;}return null;})[_0x9cda('0x19')](respondWithResult(_0x3b1984,null))[_0x9cda('0x22')](handleError(_0x3b1984,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 2f67c3e..345cdc5 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 _0xcc60=['save','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x5e5c64,_0x19b9fb){var _0x1bf287=function(_0x19fb98){while(--_0x19fb98){_0x5e5c64['push'](_0x5e5c64['shift']());}};_0x1bf287(++_0x19b9fb);}(_0xcc60,0xec));var _0x0cc6=function(_0x1cc48f,_0x4d3b1f){_0x1cc48f=_0x1cc48f-0x0;var _0x3cf906=_0xcc60[_0x1cc48f];return _0x3cf906;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x0cc6('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0cc6('0x1')](0x0);var events={'afterCreate':_0x0cc6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5922ef){return function(_0x55bfab,_0x26a1d6,_0x581198){OpenchannelMessageEvents[_0x0cc6('0x3')](_0x5922ef+':'+_0x55bfab['id'],_0x55bfab);OpenchannelMessageEvents[_0x0cc6('0x3')](_0x5922ef,_0x55bfab);_0x581198(null);};}for(var e in events){if(events[_0x0cc6('0x4')](e)){var event=events[e];OpenchannelMessage[_0x0cc6('0x5')](e,emitEvent(event));}}module[_0x0cc6('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x03d7=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03d7,0x18a));var _0x703d=function(_0x551bb8,_0x3939b1){_0x551bb8=_0x551bb8-0x0;var _0x42b574=_0x03d7[_0x551bb8];return _0x42b574;};'use strict';var EventEmitter=require(_0x703d('0x0'));var OpenchannelMessage=require(_0x703d('0x1'))['db'][_0x703d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x703d('0x3')](0x0);var events={'afterCreate':_0x703d('0x4'),'afterUpdate':_0x703d('0x5'),'afterDestroy':_0x703d('0x6')};function emitEvent(_0xf8ba28){return function(_0x4ac534,_0x3ed731,_0x14f818){OpenchannelMessageEvents['emit'](_0xf8ba28+':'+_0x4ac534['id'],_0x4ac534);OpenchannelMessageEvents[_0x703d('0x7')](_0xf8ba28,_0x4ac534);_0x14f818(null);};}for(var e in events){if(events[_0x703d('0x8')](e)){var event=events[e];OpenchannelMessage[_0x703d('0x9')](e,emitEvent(event));}}module[_0x703d('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index fe4e5d3..6ff85ae 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 _0x01e7=['body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interaction','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x01e7,0x126));var _0x701e=function(_0x4ef3d0,_0x13dc48){_0x4ef3d0=_0x4ef3d0-0x0;var _0x344014=_0x01e7[_0x4ef3d0];return _0x344014;};'use strict';var _=require(_0x701e('0x0'));var util=require(_0x701e('0x1'));var logger=require(_0x701e('0x2'))(_0x701e('0x3'));var moment=require(_0x701e('0x4'));var BPromise=require('bluebird');var rp=require(_0x701e('0x5'));var fs=require('fs');var path=require(_0x701e('0x6'));var rimraf=require(_0x701e('0x7'));var config=require('../../config/environment');var attributes=require(_0x701e('0x8'));module['exports']=function(_0x27cd64,_0x233b47){return _0x27cd64[_0x701e('0x9')](_0x701e('0xa'),attributes,{'tableName':_0x701e('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x701e('0xc')],'type':_0x701e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20c2c6,_0x13a101,_0x22cb36){var _0x18d4aa=_0x27cd64['models'];var _0x37e00c=_0x20c2c6[_0x701e('0xe')]({'plain':!![]});if(_0x37e00c[_0x701e('0xf')][_0x701e('0x10')]()==='in'||_0x37e00c[_0x701e('0xf')][_0x701e('0x10')]()===_0x701e('0x11')&&!_0x37e00c[_0x701e('0x12')]&&!_[_0x701e('0x13')](_0x37e00c[_0x701e('0x14')])){_0x18d4aa[_0x701e('0x15')][_0x701e('0x16')]({'where':{'id':_0x37e00c[_0x701e('0x17')]}})['then'](function(_0x2eb61e){if(_0x2eb61e){_0x2eb61e[_0x701e('0x18')]({'lastMsgAt':_0x37e00c[_0x701e('0x19')],'lastMsgDirection':_0x37e00c[_0x701e('0xf')]['toLowerCase']()});}})['catch'](function(_0x5f40c6){console[_0x701e('0x1a')](_0x5f40c6);});}if(_0x37e00c[_0x701e('0xf')]===_0x701e('0x11')&&!_0x37e00c[_0x701e('0x12')]){var _0x9a69a7;_0x18d4aa['CmContact'][_0x701e('0x1b')]()[_0x701e('0x1c')](function(_0x1aea88){return _0x18d4aa[_0x701e('0x1d')]['find']({'where':{'id':_0x37e00c[_0x701e('0x1e')]},'include':[{'model':_0x18d4aa[_0x701e('0x15')],'as':_0x701e('0x1f'),'where':{'id':_0x37e00c[_0x701e('0x17')]},'limit':0x1,'include':[{'model':_0x18d4aa[_0x701e('0x20')],'as':_0x701e('0x21'),'attributes':_[_0x701e('0x22')](_0x1aea88)}]}]});})[_0x701e('0x1c')](function(_0x5557c9){_0x9a69a7=_0x5557c9['get']({'plain':!![]});if(_0x9a69a7&&_0x9a69a7['replyUri']){logger[_0x701e('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x701e('0x24'),util[_0x701e('0x25')](_0x701e('0x26'),_0x37e00c['id'],_0x9a69a7[_0x701e('0x27')]));if(_0x9a69a7[_0x701e('0x1f')]&&_0x9a69a7[_0x701e('0x1f')]['length']){_0x37e00c[_0x701e('0x28')]=_[_0x701e('0x29')](_0x9a69a7[_0x701e('0x1f')][0x0],_0x701e('0x21'));_0x37e00c[_0x701e('0x21')]=_0x9a69a7[_0x701e('0x1f')][0x0][_0x701e('0x21')];}var _0x13a101={'method':_0x701e('0x2a'),'uri':encodeURI(_0x9a69a7[_0x701e('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x13a101[_0x701e('0x2b')]){case _0x701e('0x2c'):_0x13a101['qs']=_0x37e00c;break;case _0x701e('0x2a'):_0x13a101['body']=_0x37e00c;break;}return rp(_0x13a101)[_0x701e('0x1c')](function(_0x4779b3){logger[_0x701e('0x23')](_0x701e('0x2d'),_0x701e('0x24'),util[_0x701e('0x25')](_0x701e('0x2e'),_0x37e00c['id'],_0x9a69a7[_0x701e('0x27')]));if(_0x4779b3[_0x701e('0xc')][_0x701e('0x2f')]&&_0x4779b3[_0x701e('0xc')][_0x701e('0x2f')]!=_0x37e00c['Interaction'][_0x701e('0x2f')]){return _0x18d4aa[_0x701e('0x15')][_0x701e('0x18')]({'threadId':_0x4779b3[_0x701e('0xc')][_0x701e('0x2f')]},{'where':{'id':_0x37e00c[_0x701e('0x28')]['id']}});}else{return;}})[_0x701e('0x1c')](function(){return _0x20c2c6[_0x701e('0x18')]({'read':!![]});})['catch'](function(_0x390c09){logger[_0x701e('0x1a')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x701e('0x30')](_0x390c09,{'showHidden':![],'depth':null}));_0x22cb36();});}else{_0x22cb36();}})[_0x701e('0x31')](function(){_0x22cb36();});}else{_0x22cb36();}}},'charset':'utf8mb4','collate':_0x701e('0x32')});}; \ No newline at end of file +var _0xb512=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','method','threadId','error','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','findOne','then','update','createdAt','catch','secret','CmContact','describe','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x582c75,_0x9c9a1a){var _0xdccc1d=function(_0x3f25c8){while(--_0x3f25c8){_0x582c75['push'](_0x582c75['shift']());}};_0xdccc1d(++_0x9c9a1a);}(_0xb512,0x1be));var _0x2b51=function(_0x4a2cf1,_0x16a8dd){_0x4a2cf1=_0x4a2cf1-0x0;var _0xf3c60c=_0xb512[_0x4a2cf1];return _0xf3c60c;};'use strict';var _=require(_0x2b51('0x0'));var util=require(_0x2b51('0x1'));var logger=require(_0x2b51('0x2'))(_0x2b51('0x3'));var moment=require(_0x2b51('0x4'));var BPromise=require(_0x2b51('0x5'));var rp=require(_0x2b51('0x6'));var fs=require('fs');var path=require(_0x2b51('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b51('0x8'));module[_0x2b51('0x9')]=function(_0x132905,_0x5ba343){return _0x132905['define']('OpenchannelMessage',attributes,{'tableName':_0x2b51('0xa'),'paranoid':![],'indexes':[{'name':_0x2b51('0xb'),'fields':[_0x2b51('0xc')],'type':_0x2b51('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fd1bd,_0x4b8f58,_0x4d7fb7){var _0x3e0dd2=_0x132905[_0x2b51('0xe')];var _0x284db3=_0x3fd1bd[_0x2b51('0xf')]({'plain':!![]});if(_0x284db3['direction'][_0x2b51('0x10')]()==='in'||_0x284db3[_0x2b51('0x11')][_0x2b51('0x10')]()===_0x2b51('0x12')&&!_0x284db3['secret']&&!_[_0x2b51('0x13')](_0x284db3['UserId'])){_0x3e0dd2['OpenchannelInteraction'][_0x2b51('0x14')]({'where':{'id':_0x284db3['OpenchannelInteractionId']}})[_0x2b51('0x15')](function(_0x54da82){if(_0x54da82){_0x54da82[_0x2b51('0x16')]({'lastMsgAt':_0x284db3[_0x2b51('0x17')],'lastMsgDirection':_0x284db3[_0x2b51('0x11')][_0x2b51('0x10')]()});}})[_0x2b51('0x18')](function(_0x3f22e1){console['error'](_0x3f22e1);});}if(_0x284db3['direction']==='out'&&!_0x284db3[_0x2b51('0x19')]){var _0x40fa47;_0x3e0dd2[_0x2b51('0x1a')][_0x2b51('0x1b')]()[_0x2b51('0x15')](function(_0x51a3f1){return _0x3e0dd2['OpenchannelAccount'][_0x2b51('0x1c')]({'where':{'id':_0x284db3[_0x2b51('0x1d')]},'include':[{'model':_0x3e0dd2[_0x2b51('0x1e')],'as':_0x2b51('0x1f'),'where':{'id':_0x284db3['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3e0dd2[_0x2b51('0x1a')],'as':'Contact','attributes':_['keys'](_0x51a3f1)}]}]});})[_0x2b51('0x15')](function(_0x2a099e){_0x40fa47=_0x2a099e[_0x2b51('0xf')]({'plain':!![]});if(_0x40fa47&&_0x40fa47['replyUri']){logger[_0x2b51('0x20')](_0x2b51('0x21'),_0x2b51('0x22'),util[_0x2b51('0x23')](_0x2b51('0x24'),_0x284db3['id'],_0x40fa47[_0x2b51('0x25')]));if(_0x40fa47['Interactions']&&_0x40fa47[_0x2b51('0x1f')][_0x2b51('0x26')]){_0x284db3[_0x2b51('0x27')]=_[_0x2b51('0x28')](_0x40fa47['Interactions'][0x0],_0x2b51('0x29'));_0x284db3[_0x2b51('0x29')]=_0x40fa47['Interactions'][0x0]['Contact'];}var _0x4b8f58={'method':_0x2b51('0x2a'),'uri':encodeURI(_0x40fa47[_0x2b51('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4b8f58[_0x2b51('0x2b')]){case'GET':_0x4b8f58['qs']=_0x284db3;break;case _0x2b51('0x2a'):_0x4b8f58[_0x2b51('0xc')]=_0x284db3;break;}return rp(_0x4b8f58)[_0x2b51('0x15')](function(_0x3b4fd1){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2b51('0x22'),util[_0x2b51('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x284db3['id'],_0x40fa47[_0x2b51('0x25')]));if(_0x3b4fd1['body']['threadId']&&_0x3b4fd1[_0x2b51('0xc')][_0x2b51('0x2c')]!=_0x284db3[_0x2b51('0x27')]['threadId']){return _0x3e0dd2[_0x2b51('0x1e')][_0x2b51('0x16')]({'threadId':_0x3b4fd1[_0x2b51('0xc')][_0x2b51('0x2c')]},{'where':{'id':_0x284db3['Interaction']['id']}});}else{return;}})[_0x2b51('0x15')](function(){return _0x3fd1bd['update']({'read':!![]});})[_0x2b51('0x18')](function(_0x3be636){logger[_0x2b51('0x2d')](_0x2b51('0x21'),_0x2b51('0x22'),util['inspect'](_0x3be636,{'showHidden':![],'depth':null}));_0x4d7fb7();});}else{_0x4d7fb7();}})[_0x2b51('0x2e')](function(){_0x4d7fb7();});}else{_0x4d7fb7();}}},'charset':'utf8mb4','collate':_0x2b51('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 002967b..4ae1c1b 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x5b0cee,_0x4f8539){var _0x1ff7d7=function(_0x1af308){while(--_0x1af308){_0x5b0cee['push'](_0x5b0cee['shift']());}};_0x1ff7d7(++_0x4f8539);}(_0x2ef3,0xba));var _0x32ef=function(_0x38b3bc,_0x14859c){_0x38b3bc=_0x38b3bc-0x0;var _0x5067d8=_0x2ef3[_0x38b3bc];return _0x5067d8;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b92c3,_0x23be84){var _0x57d180=function(_0x17f35e){while(--_0x17f35e){_0x4b92c3['push'](_0x4b92c3['shift']());}};_0x57d180(++_0x23be84);}(_0x1261,0x144));var _0x1126=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x1261[_0x117f4c];return _0x2b24e9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e661458..3d2aa75 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 _0x0f36=['save','remove','update','emit','removeListener','register','./openchannelMessage.events'];(function(_0x271e57,_0x233f2a){var _0x27eb8c=function(_0x2935b4){while(--_0x2935b4){_0x271e57['push'](_0x271e57['shift']());}};_0x27eb8c(++_0x233f2a);}(_0x0f36,0x8b));var _0x60f3=function(_0x240c9a,_0x100d6d){_0x240c9a=_0x240c9a-0x0;var _0xb239e9=_0x0f36[_0x240c9a];return _0xb239e9;};'use strict';var OpenchannelMessageEvents=require(_0x60f3('0x0'));var events=[_0x60f3('0x1'),_0x60f3('0x2'),_0x60f3('0x3')];function createListener(_0x131132,_0x441424){return function(_0x160cd1){_0x441424[_0x60f3('0x4')](_0x131132,_0x160cd1);};}function removeListener(_0x362894,_0xb6e678){return function(){OpenchannelMessageEvents[_0x60f3('0x5')](_0x362894,_0xb6e678);};}exports[_0x60f3('0x6')]=function(_0x91491d){for(var _0x157f09=0x0,_0xd8fc9d=events['length'];_0x157f09<_0xd8fc9d;_0x157f09++){var _0x6b5250=events[_0x157f09];var _0x1a4402=createListener('openchannelMessage:'+_0x6b5250,_0x91491d);OpenchannelMessageEvents['on'](_0x6b5250,_0x1a4402);}}; \ No newline at end of file +var _0xe567=['remove','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xe567,0xa6));var _0x7e56=function(_0x33e75b,_0x2eb46d){_0x33e75b=_0x33e75b-0x0;var _0xb2e323=_0xe567[_0x33e75b];return _0xb2e323;};'use strict';var OpenchannelMessageEvents=require(_0x7e56('0x0'));var events=[_0x7e56('0x1'),_0x7e56('0x2'),'update'];function createListener(_0x5910d9,_0x5c11a0){return function(_0x2fac63){_0x5c11a0['emit'](_0x5910d9,_0x2fac63);};}function removeListener(_0x27ebcc,_0x5d0ca0){return function(){OpenchannelMessageEvents[_0x7e56('0x3')](_0x27ebcc,_0x5d0ca0);};}exports[_0x7e56('0x4')]=function(_0x1b40ed){for(var _0x5f2cfe=0x0,_0x2cd4f0=events[_0x7e56('0x5')];_0x5f2cfe<_0x2cd4f0;_0x5f2cfe++){var _0x147cb8=events[_0x5f2cfe];var _0x1aa50d=createListener(_0x7e56('0x6')+_0x147cb8,_0x1b40ed);OpenchannelMessageEvents['on'](_0x147cb8,_0x1aa50d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 39cc8b0..960b12e 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 _0xc692=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated'];(function(_0x11f07f,_0x562e91){var _0x20c0b2=function(_0x550698){while(--_0x550698){_0x11f07f['push'](_0x11f07f['shift']());}};_0x20c0b2(++_0x562e91);}(_0xc692,0x1f2));var _0x2c69=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc692[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var path=require(_0x2c69('0x2'));var timeout=require(_0x2c69('0x3'));var express=require(_0x2c69('0x4'));var router=express['Router']();var fs_extra=require(_0x2c69('0x5'));var auth=require(_0x2c69('0x6'));var interaction=require(_0x2c69('0x7'));var config=require(_0x2c69('0x8'));var controller=require(_0x2c69('0x9'));router[_0x2c69('0xa')]('/',auth['isAuthenticated'](),controller[_0x2c69('0xb')]);router[_0x2c69('0xa')](_0x2c69('0xc'),auth[_0x2c69('0xd')](),controller[_0x2c69('0xe')]);router['get'](_0x2c69('0xf'),auth['isAuthenticated'](),controller[_0x2c69('0x10')]);router[_0x2c69('0xa')](_0x2c69('0x11'),auth['isAuthenticated'](),controller[_0x2c69('0x12')]);router['get'](_0x2c69('0x13'),auth[_0x2c69('0xd')](),controller['getTeams']);router[_0x2c69('0xa')]('/:id/users',auth[_0x2c69('0xd')](),controller[_0x2c69('0x14')]);router[_0x2c69('0x15')]('/',auth[_0x2c69('0xd')](),controller[_0x2c69('0x16')]);router['post']('/:id/teams',auth[_0x2c69('0xd')](),controller[_0x2c69('0x17')]);router[_0x2c69('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c69('0x18')]);router[_0x2c69('0x19')](_0x2c69('0xf'),auth[_0x2c69('0xd')](),controller[_0x2c69('0x1a')]);router[_0x2c69('0x1b')](_0x2c69('0xf'),auth[_0x2c69('0xd')](),controller[_0x2c69('0x1c')]);router[_0x2c69('0x1b')]('/:id/teams',auth[_0x2c69('0xd')](),controller[_0x2c69('0x1d')]);router[_0x2c69('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c69('0x1e')]);module[_0x2c69('0x1f')]=router; \ No newline at end of file +var _0xa527=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','destroy','delete','removeTeams','multer','util','connect-timeout','express','Router','./openchannelQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members'];(function(_0x459a49,_0x1ff7b3){var _0x3a3133=function(_0x44992e){while(--_0x44992e){_0x459a49['push'](_0x459a49['shift']());}};_0x3a3133(++_0x1ff7b3);}(_0xa527,0xfb));var _0x7a52=function(_0x1bb161,_0x25b93c){_0x1bb161=_0x1bb161-0x0;var _0x2d4246=_0xa527[_0x1bb161];return _0x2d4246;};'use strict';var multer=require(_0x7a52('0x0'));var util=require(_0x7a52('0x1'));var path=require('path');var timeout=require(_0x7a52('0x2'));var express=require(_0x7a52('0x3'));var router=express[_0x7a52('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(_0x7a52('0x5'));router[_0x7a52('0x6')]('/',auth['isAuthenticated'](),controller[_0x7a52('0x7')]);router['get'](_0x7a52('0x8'),auth[_0x7a52('0x9')](),controller['describe']);router[_0x7a52('0x6')](_0x7a52('0xa'),auth[_0x7a52('0x9')](),controller[_0x7a52('0xb')]);router['get'](_0x7a52('0xc'),auth[_0x7a52('0x9')](),controller['getMembers']);router[_0x7a52('0x6')](_0x7a52('0xd'),auth[_0x7a52('0x9')](),controller[_0x7a52('0xe')]);router['get'](_0x7a52('0xf'),auth[_0x7a52('0x9')](),controller[_0x7a52('0x10')]);router[_0x7a52('0x11')]('/',auth[_0x7a52('0x9')](),controller[_0x7a52('0x12')]);router[_0x7a52('0x11')](_0x7a52('0xd'),auth[_0x7a52('0x9')](),controller['addTeams']);router[_0x7a52('0x11')](_0x7a52('0xf'),auth[_0x7a52('0x9')](),controller[_0x7a52('0x13')]);router[_0x7a52('0x14')](_0x7a52('0xa'),auth[_0x7a52('0x9')](),controller['update']);router['delete'](_0x7a52('0xa'),auth[_0x7a52('0x9')](),controller[_0x7a52('0x15')]);router[_0x7a52('0x16')](_0x7a52('0xd'),auth[_0x7a52('0x9')](),controller[_0x7a52('0x17')]);router[_0x7a52('0x16')](_0x7a52('0xf'),auth[_0x7a52('0x9')](),controller['removeAgents']);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 39ef356..14dbe96 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 _0xaf1c=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf1c,0xaa));var _0xcaf1=function(_0x4164f0,_0x3e1fdb){_0x4164f0=_0x4164f0-0x0;var _0x5b777e=_0xaf1c[_0x4164f0];return _0x5b777e;};'use strict';var Sequelize=require(_0xcaf1('0x0'));module[_0xcaf1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcaf1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcaf1('0x3')]},'timeout':{'type':Sequelize[_0xcaf1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaf1('0x5')]('rrmemory',_0xcaf1('0x6'),_0xcaf1('0x7'))}}; \ No newline at end of file +var _0x4e60=['STRING','name','INTEGER','rrmemory','roundrobin','exports'];(function(_0x2a65ee,_0x53f4b2){var _0xda9e7=function(_0x475ba0){while(--_0x475ba0){_0x2a65ee['push'](_0x2a65ee['shift']());}};_0xda9e7(++_0x53f4b2);}(_0x4e60,0xcb));var _0x04e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e60[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x04e6('0x0')]={'name':{'type':Sequelize[_0x04e6('0x1')],'unique':_0x04e6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x04e6('0x1')]},'timeout':{'type':Sequelize[_0x04e6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x04e6('0x4'),'beepall',_0x04e6('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 5a06f78..ca046f4 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 _0x4895=['UserId','agent','updatedAt','rows','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','every','includes','transaction','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','then','OpenchannelQueues','UserProfileResource','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','OpenchannelQueue','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','OpenchannelQueueId','findAll','User'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4895,0x1c7));var _0x5489=function(_0x3867de,_0x29986d){_0x3867de=_0x3867de-0x0;var _0x14029a=_0x4895[_0x3867de];return _0x14029a;};'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(_0x5489('0x7'));var util=require(_0x5489('0x8'));var path=require('path');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('squel');var crypto=require('crypto');var jsforce=require(_0x5489('0xe'));var deskjs=require(_0x5489('0xf'));var toCsv=require(_0x5489('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5489('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5489('0x11'));var as=require(_0x5489('0x12'));var hardwareService=require(_0x5489('0x13'));var logger=require(_0x5489('0x14'))('api');var utils=require(_0x5489('0x15'));var config=require(_0x5489('0x16'));var licenseUtil=require(_0x5489('0x17'));var db=require(_0x5489('0x18'))['db'];config[_0x5489('0x19')]=_['defaults'](config[_0x5489('0x19')],{'host':_0x5489('0x1a'),'port':0x18eb});var socket=require(_0x5489('0x1b'))(new Redis(config[_0x5489('0x19')]));require(_0x5489('0x1c'))['register'](socket);function respondWithStatusCode(_0x3640d3,_0x5e6989){_0x5e6989=_0x5e6989||0xcc;return function(_0xb20038){if(_0xb20038){return _0x3640d3[_0x5489('0x1d')](_0x5e6989);}return _0x3640d3[_0x5489('0x1e')](_0x5e6989)['end']();};}function respondWithResult(_0x46cffa,_0x12c953){_0x12c953=_0x12c953||0xc8;return function(_0x1d60cb){if(_0x1d60cb){return _0x46cffa['status'](_0x12c953)[_0x5489('0x1f')](_0x1d60cb);}};}function respondWithFilteredResult(_0x8f9c5f,_0x2adbf5){return function(_0x3c70c0){if(_0x3c70c0){var _0x287699=typeof _0x2adbf5['offset']===_0x5489('0x20')&&typeof _0x2adbf5[_0x5489('0x21')]===_0x5489('0x20');var _0x5bf84a=_0x3c70c0[_0x5489('0x22')];var _0xe186fe=_0x287699?0x0:_0x2adbf5[_0x5489('0x23')];var _0x2d0169=_0x287699?_0x3c70c0[_0x5489('0x22')]:_0x2adbf5[_0x5489('0x23')]+_0x2adbf5[_0x5489('0x21')];var _0x220f94;if(_0x2d0169>=_0x5bf84a){_0x2d0169=_0x5bf84a;_0x220f94=0xc8;}else{_0x220f94=0xce;}_0x8f9c5f['status'](_0x220f94);return _0x8f9c5f[_0x5489('0x24')]('Content-Range',_0xe186fe+'-'+_0x2d0169+'/'+_0x5bf84a)[_0x5489('0x1f')](_0x3c70c0);}return null;};}function patchUpdates(_0x3bd334){return function(_0x1bb9d9){try{jsonpatch[_0x5489('0x25')](_0x1bb9d9,_0x3bd334,!![]);}catch(_0x2d06cf){return BPromise[_0x5489('0x26')](_0x2d06cf);}return _0x1bb9d9[_0x5489('0x27')]();};}function saveUpdates(_0x32a48c,_0x1fbe84){return function(_0x13d75b){if(_0x13d75b){return _0x13d75b['update'](_0x32a48c)[_0x5489('0x28')](function(_0x682004){return _0x682004;});}return null;};}function removeEntity(_0x1754ba,_0x13ea91){return function(_0x488686){if(_0x488686){return _0x488686['destroy']()[_0x5489('0x28')](function(){var _0x10a41d=_0x488686['get']({'plain':!![]});var _0x2cbbd1=_0x5489('0x29');return db[_0x5489('0x2a')][_0x5489('0x2b')]({'where':{'type':_0x2cbbd1,'resourceId':_0x10a41d['id']}})[_0x5489('0x28')](function(){return _0x488686;});})[_0x5489('0x28')](function(){_0x1754ba['status'](0xcc)[_0x5489('0x2c')]();});}};}function handleEntityNotFound(_0x4f6891,_0x3acf15){return function(_0x5a827f){if(!_0x5a827f){_0x4f6891[_0x5489('0x1d')](0x194);}return _0x5a827f;};}function handleError(_0x1a50ce,_0x3c308d){_0x3c308d=_0x3c308d||0x1f4;return function(_0x4fba7d){logger['error'](_0x4fba7d[_0x5489('0x2d')]);if(_0x4fba7d['name']){delete _0x4fba7d[_0x5489('0x2e')];}_0x1a50ce['status'](_0x3c308d)[_0x5489('0x2f')](_0x4fba7d);};}exports['index']=function(_0x5f5745,_0x5e06a6){var _0x2c0d8e={},_0x8544c1={},_0xd07252={'count':0x0,'rows':[]};var _0x586611=_[_0x5489('0x30')](db['OpenchannelQueue'][_0x5489('0x31')],function(_0x4b914e){return{'name':_0x4b914e[_0x5489('0x32')],'type':_0x4b914e[_0x5489('0x33')][_0x5489('0x34')]};});_0x8544c1[_0x5489('0x35')]=_['map'](_0x586611,'name');_0x8544c1[_0x5489('0x36')]=_[_0x5489('0x37')](_0x5f5745['query']);_0x8544c1['filters']=_[_0x5489('0x38')](_0x8544c1[_0x5489('0x35')],_0x8544c1[_0x5489('0x36')]);_0x2c0d8e[_0x5489('0x39')]=_[_0x5489('0x38')](_0x8544c1[_0x5489('0x35')],qs[_0x5489('0x3a')](_0x5f5745[_0x5489('0x36')][_0x5489('0x3a')]));_0x2c0d8e[_0x5489('0x39')]=_0x2c0d8e[_0x5489('0x39')][_0x5489('0x3b')]?_0x2c0d8e[_0x5489('0x39')]:_0x8544c1['model'];if(!_0x5f5745[_0x5489('0x36')][_0x5489('0x3c')](_0x5489('0x3d'))){_0x2c0d8e['limit']=qs['limit'](_0x5f5745['query']['limit']);_0x2c0d8e[_0x5489('0x23')]=qs[_0x5489('0x23')](_0x5f5745[_0x5489('0x36')][_0x5489('0x23')]);}_0x2c0d8e[_0x5489('0x3e')]=qs[_0x5489('0x3f')](_0x5f5745[_0x5489('0x36')]['sort']);_0x2c0d8e[_0x5489('0x40')]=qs[_0x5489('0x41')](_[_0x5489('0x42')](_0x5f5745[_0x5489('0x36')],_0x8544c1[_0x5489('0x41')]),_0x586611);if(_0x5f5745[_0x5489('0x36')][_0x5489('0x43')]){_0x2c0d8e[_0x5489('0x40')]=_[_0x5489('0x44')](_0x2c0d8e[_0x5489('0x40')],{'$or':_['map'](_0x586611,function(_0x24666b){if(_0x24666b['type']!=='VIRTUAL'){var _0x5bf00e={};_0x5bf00e[_0x24666b[_0x5489('0x2e')]]={'$like':'%'+_0x5f5745[_0x5489('0x36')]['filter']+'%'};return _0x5bf00e;}})});}_0x2c0d8e=_[_0x5489('0x44')]({},_0x2c0d8e,_0x5f5745[_0x5489('0x45')]);var _0x3d6c4c={'where':_0x2c0d8e[_0x5489('0x40')]};return db['OpenchannelQueue']['count'](_0x3d6c4c)['then'](function(_0x3607e2){_0xd07252['count']=_0x3607e2;if(_0x5f5745[_0x5489('0x36')][_0x5489('0x46')]){_0x2c0d8e[_0x5489('0x47')]=[{'all':!![]}];}return db[_0x5489('0x48')]['findAll'](_0x2c0d8e);})['then'](function(_0x3e5186){_0xd07252['rows']=_0x3e5186;return _0xd07252;})['then'](respondWithFilteredResult(_0x5e06a6,_0x2c0d8e))[_0x5489('0x49')](handleError(_0x5e06a6,null));};exports['show']=function(_0x4b5d69,_0x2980a8){var _0x75cfc3={'raw':!![],'where':{'id':_0x4b5d69[_0x5489('0x4a')]['id']}},_0x5381b6={};_0x5381b6[_0x5489('0x35')]=_['keys'](db[_0x5489('0x48')][_0x5489('0x31')]);_0x5381b6[_0x5489('0x36')]=_['keys'](_0x4b5d69[_0x5489('0x36')]);_0x5381b6[_0x5489('0x41')]=_[_0x5489('0x38')](_0x5381b6[_0x5489('0x35')],_0x5381b6[_0x5489('0x36')]);_0x75cfc3['attributes']=_['intersection'](_0x5381b6[_0x5489('0x35')],qs['fields'](_0x4b5d69[_0x5489('0x36')][_0x5489('0x3a')]));_0x75cfc3[_0x5489('0x39')]=_0x75cfc3[_0x5489('0x39')][_0x5489('0x3b')]?_0x75cfc3[_0x5489('0x39')]:_0x5381b6[_0x5489('0x35')];if(_0x4b5d69['query'][_0x5489('0x46')]){_0x75cfc3[_0x5489('0x47')]=[{'all':!![]}];}_0x75cfc3=_['merge']({},_0x75cfc3,_0x4b5d69[_0x5489('0x45')]);return db[_0x5489('0x48')][_0x5489('0x4b')](_0x75cfc3)['then'](handleEntityNotFound(_0x2980a8,null))[_0x5489('0x28')](respondWithResult(_0x2980a8,null))[_0x5489('0x49')](handleError(_0x2980a8,null));};exports[_0x5489('0x4c')]=function(_0x6287f6,_0x2aaa9a){return db[_0x5489('0x48')]['create'](_0x6287f6[_0x5489('0x4d')],{})['then'](function(_0x436e0a){var _0x21f4f3=_0x6287f6[_0x5489('0x4e')][_0x5489('0x4f')]({'plain':!![]});if(!_0x21f4f3)throw new Error(_0x5489('0x50'));if(_0x21f4f3[_0x5489('0x51')]==='user'){var _0x35db4b=_0x436e0a[_0x5489('0x4f')]({'plain':!![]});var _0x29a768=_0x5489('0x29');return db[_0x5489('0x52')][_0x5489('0x4b')]({'where':{'name':_0x29a768,'userProfileId':_0x21f4f3[_0x5489('0x53')]},'raw':!![]})[_0x5489('0x28')](function(_0x48c7ee){if(_0x48c7ee&&_0x48c7ee['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35db4b[_0x5489('0x2e')],'resourceId':_0x35db4b['id'],'type':_0x48c7ee[_0x5489('0x2e')],'sectionId':_0x48c7ee['id']},{})[_0x5489('0x28')](function(){return _0x436e0a;});}else{return _0x436e0a;}})[_0x5489('0x49')](function(_0x39db0e){logger[_0x5489('0x54')](_0x5489('0x55'),_0x39db0e);throw _0x39db0e;});}return _0x436e0a;})['then'](respondWithResult(_0x2aaa9a,0xc9))[_0x5489('0x49')](handleError(_0x2aaa9a,null));};exports[_0x5489('0x56')]=function(_0x1035a4,_0x2fda03){if(_0x1035a4[_0x5489('0x4d')]['id']){delete _0x1035a4['body']['id'];}return db['OpenchannelQueue'][_0x5489('0x4b')]({'where':{'id':_0x1035a4[_0x5489('0x4a')]['id']}})[_0x5489('0x28')](handleEntityNotFound(_0x2fda03,null))[_0x5489('0x28')](saveUpdates(_0x1035a4['body'],null))[_0x5489('0x28')](respondWithResult(_0x2fda03,null))[_0x5489('0x49')](handleError(_0x2fda03,null));};exports[_0x5489('0x2b')]=function(_0x19d5fb,_0x268eeb){return db['OpenchannelQueue']['find']({'where':{'id':_0x19d5fb[_0x5489('0x4a')]['id']}})[_0x5489('0x28')](handleEntityNotFound(_0x268eeb,null))[_0x5489('0x28')](removeEntity(_0x268eeb,null))[_0x5489('0x49')](handleError(_0x268eeb,null));};exports['describe']=function(_0x63cbdf,_0x4154c1){return db[_0x5489('0x48')][_0x5489('0x57')]()['then'](respondWithResult(_0x4154c1,null))['catch'](handleError(_0x4154c1,null));};exports[_0x5489('0x58')]=function(_0x35e023,_0x511ee4,_0x426ebb){var _0x530480={'raw':!![],'where':{}},_0x20dd53={},_0x51bc32;return db[_0x5489('0x48')][_0x5489('0x59')]({'where':{'id':_0x35e023[_0x5489('0x4a')]['id']}})['then'](handleEntityNotFound(_0x511ee4,null))['then'](function(_0x26f2d8){if(_0x26f2d8){_0x51bc32=_0x26f2d8[_0x5489('0x4f')]({'plain':!![]});_0x20dd53[_0x5489('0x35')]=_[_0x5489('0x37')](db['UserOpenchannelQueue']['rawAttributes']);_0x20dd53[_0x5489('0x36')]=_[_0x5489('0x37')](_0x35e023[_0x5489('0x36')]);_0x20dd53['filters']=_[_0x5489('0x38')](_0x20dd53[_0x5489('0x35')],_0x20dd53[_0x5489('0x36')]);_0x530480['attributes']=_['intersection'](_0x20dd53['model'],qs[_0x5489('0x3a')](_0x35e023[_0x5489('0x36')][_0x5489('0x3a')]));_0x530480['attributes']=_0x530480[_0x5489('0x39')][_0x5489('0x3b')]?_0x530480[_0x5489('0x39')]:_0x20dd53[_0x5489('0x35')];if(!_0x35e023['query']['hasOwnProperty']('nolimit')){_0x530480[_0x5489('0x21')]=qs[_0x5489('0x21')](_0x35e023[_0x5489('0x36')][_0x5489('0x21')]);_0x530480[_0x5489('0x23')]=qs['offset'](_0x35e023[_0x5489('0x36')][_0x5489('0x23')]);}_0x530480[_0x5489('0x3e')]=qs[_0x5489('0x3f')](_0x35e023[_0x5489('0x36')][_0x5489('0x3f')]);_0x530480[_0x5489('0x40')]=qs[_0x5489('0x41')](_[_0x5489('0x42')](_0x35e023[_0x5489('0x36')],_0x20dd53['filters']));_0x530480[_0x5489('0x40')][_0x5489('0x5a')]=_0x26f2d8['id'];if(_0x35e023['query'][_0x5489('0x43')]){_0x530480[_0x5489('0x40')]=_[_0x5489('0x44')](_0x530480[_0x5489('0x40')],{'$or':_[_0x5489('0x30')](_0x530480[_0x5489('0x39')],function(_0x5a2200){var _0x4e2c74={};_0x4e2c74[_0x5a2200]={'$like':'%'+_0x35e023[_0x5489('0x36')][_0x5489('0x43')]+'%'};return _0x4e2c74;})});}_0x530480=_[_0x5489('0x44')]({},_0x530480,_0x35e023['options']);return db['UserOpenchannelQueue'][_0x5489('0x5b')](_0x530480);}})[_0x5489('0x28')](function(_0x18ee90){if(_0x18ee90){return db[_0x5489('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x18ee90,_0x5489('0x5d')),'role':_0x5489('0x5e')},'attributes':['id',_0x5489('0x2e'),'openchannelPause',_0x5489('0x5f'),'createdAt']});}})['then'](function(_0x438f64){if(_0x438f64){return{'count':_0x438f64[_0x5489('0x22')],'rows':_['map'](_0x438f64[_0x5489('0x60')],function(_0x5b95aa){return{'membername':_0x5b95aa['name'],'UserId':_0x5b95aa['id'],'queue_name':_0x51bc32[_0x5489('0x2e')],'OpenchannelQueueId':_0x51bc32['id'],'interface':util['format'](_0x5489('0x61'),_0x5489('0x62'),_0x5b95aa['name']),'penalty':0x0,'paused':_0x5b95aa['openchannelPause'],'createdAt':_0x5b95aa[_0x5489('0x63')],'updatedAt':_0x5b95aa[_0x5489('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5489('0x28')](respondWithFilteredResult(_0x511ee4,_0x530480))['catch'](handleError(_0x511ee4,null));};exports[_0x5489('0x64')]=function(_0x152cc3,_0x5dc863,_0x284925){var _0x436a8e={};var _0x586dee={};var _0x3e4cdc;var _0x1f2723;return db[_0x5489('0x48')][_0x5489('0x59')]({'where':{'id':_0x152cc3[_0x5489('0x4a')]['id']}})[_0x5489('0x28')](handleEntityNotFound(_0x5dc863,null))['then'](function(_0x13eb72){if(_0x13eb72){_0x3e4cdc=_0x13eb72;_0x586dee['model']=_['keys'](db[_0x5489('0x65')][_0x5489('0x31')]);_0x586dee[_0x5489('0x36')]=_['keys'](_0x152cc3[_0x5489('0x36')]);_0x586dee[_0x5489('0x41')]=_[_0x5489('0x38')](_0x586dee[_0x5489('0x35')],_0x586dee[_0x5489('0x36')]);_0x436a8e[_0x5489('0x39')]=_[_0x5489('0x38')](_0x586dee[_0x5489('0x35')],qs['fields'](_0x152cc3[_0x5489('0x36')]['fields']));_0x436a8e['attributes']=_0x436a8e[_0x5489('0x39')]['length']?_0x436a8e['attributes']:_0x586dee[_0x5489('0x35')];_0x436a8e[_0x5489('0x3e')]=qs[_0x5489('0x3f')](_0x152cc3['query'][_0x5489('0x3f')]);_0x436a8e[_0x5489('0x40')]=qs[_0x5489('0x41')](_['pick'](_0x152cc3[_0x5489('0x36')],_0x586dee[_0x5489('0x41')]));if(_0x152cc3[_0x5489('0x36')][_0x5489('0x43')]){_0x436a8e[_0x5489('0x40')]=_[_0x5489('0x44')](_0x436a8e[_0x5489('0x40')],{'$or':_['map'](_0x436a8e[_0x5489('0x39')],function(_0x4cd8cb){var _0x15a6e5={};_0x15a6e5[_0x4cd8cb]={'$like':'%'+_0x152cc3[_0x5489('0x36')][_0x5489('0x43')]+'%'};return _0x15a6e5;})});}_0x436a8e=_[_0x5489('0x44')]({},_0x436a8e,_0x152cc3[_0x5489('0x45')]);return _0x3e4cdc[_0x5489('0x64')](_0x436a8e);}})['then'](function(_0x13195f){if(_0x13195f){_0x1f2723=_0x13195f['length'];if(!_0x152cc3[_0x5489('0x36')][_0x5489('0x3c')](_0x5489('0x3d'))){_0x436a8e['limit']=qs[_0x5489('0x21')](_0x152cc3[_0x5489('0x36')]['limit']);_0x436a8e['offset']=qs[_0x5489('0x23')](_0x152cc3['query'][_0x5489('0x23')]);}return _0x3e4cdc[_0x5489('0x64')](_0x436a8e);}})['then'](function(_0x5796f6){if(_0x5796f6){return _0x5796f6?{'count':_0x1f2723,'rows':_0x5796f6}:null;}})['then'](respondWithResult(_0x5dc863,null))['catch'](handleError(_0x5dc863,null));};exports[_0x5489('0x66')]=function(_0x2937d3,_0x1355e8,_0x19a6b3){var _0x525bb3=_0x2937d3[_0x5489('0x4d')][_0x5489('0x67')];return db[_0x5489('0x65')]['findAll']({'where':{'id':_0x525bb3},'attributes':['id'],'include':[{'model':db[_0x5489('0x5c')],'as':_0x5489('0x68'),'attributes':['id',_0x5489('0x2e'),_0x5489('0x69'),_0x5489('0x6a'),_0x5489('0x6b')],'raw':!![]}]})[_0x5489('0x28')](function(_0x5412df){if(_0x5412df){var _0x2bc8b5=_[_0x5489('0x6c')](_0x5412df,function(_0x10f6ef){var _0x383319=_0x10f6ef[_0x5489('0x4f')]({'plain':!![]});return _0x383319[_0x5489('0x68')];});return db[_0x5489('0x48')][_0x5489('0x4b')]({'where':{'id':_0x2937d3['params']['id']}})['then'](function(_0x21edfd){return db[_0x5489('0x6d')]['transaction'](function(_0x185d40){return _0x21edfd[_0x5489('0x66')](_0x525bb3,{'transaction':_0x185d40})[_0x5489('0x28')](function(){return BPromise[_0x5489('0x6e')](_0x2bc8b5,function(_0x5bd821){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x5bd821['id'],'OpenchannelQueueId':_0x2937d3['params']['id']},'transaction':_0x185d40});});})[_0x5489('0x28')](function(){_0x2bc8b5[_0x5489('0x6f')](function(_0x39a0e4){socket[_0x5489('0x70')]('userOpenchannelQueue:save',{'UserId':_0x39a0e4['id'],'OpenchannelQueueId':_0x21edfd['id']});});});});});}})[_0x5489('0x28')](respondWithStatusCode(_0x1355e8,null))[_0x5489('0x49')](handleError(_0x1355e8,null));};exports[_0x5489('0x71')]=function(_0x3ecd2c,_0x4d064a,_0x3a3217){return db[_0x5489('0x65')]['findAll']({'where':{'id':_0x3ecd2c[_0x5489('0x36')][_0x5489('0x67')]},'attributes':['id'],'include':[{'model':db[_0x5489('0x5c')],'as':_0x5489('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5489('0x28')](handleEntityNotFound(_0x4d064a,null))[_0x5489('0x28')](function(_0x46691d){var _0x2f8315=_[_0x5489('0x30')](_0x46691d,'id');var _0x30425f=[];var _0x50a3cc=[];var _0x23b103=squel[_0x5489('0x72')]();_0x23b103[_0x5489('0x73')](_0x5489('0x74'))[_0x5489('0x75')](_0x5489('0x76'),'tq')[_0x5489('0x77')](_0x5489('0x78'),'ut',_0x5489('0x79'))['where'](_0x5489('0x7a'),_0x3ecd2c[_0x5489('0x4a')]['id']);for(var _0xbeb2a0=0x0;_0xbeb2a0<_0x46691d['length'];_0xbeb2a0+=0x1){let _0x1efd51=_0x46691d[_0xbeb2a0];for(var _0x77d28f=0x0;_0x77d28f<_0x1efd51[_0x5489('0x68')][_0x5489('0x3b')];_0x77d28f+=0x1){let _0x106da0=_0x1efd51['Agents'][_0x77d28f];var _0x113b58=_0x23b103[_0x5489('0x7b')]();_0x113b58[_0x5489('0x40')]('ut.UserId\x20=\x20?',_0x106da0['id']);_0x50a3cc[_0x5489('0x7c')](db[_0x5489('0x6d')][_0x5489('0x36')](_0x113b58[_0x5489('0x7d')](),{'type':db[_0x5489('0x6d')]['QueryTypes']['SELECT']})[_0x5489('0x28')](function(_0x5b19dc){if(_0x5b19dc[_0x5489('0x3b')]===0x1){return _0x106da0['id'];}else{var _0xc96d0c=_[_0x5489('0x7e')](_[_0x5489('0x30')](_0x5b19dc,'TeamId'),function(_0x54813a){return _[_0x5489('0x7f')](_0x2f8315,_0x54813a);});if(_0xc96d0c){return _0x106da0['id'];}}}));}}return BPromise['all'](_0x50a3cc)[_0x5489('0x28')](function(_0x2b7138){_0x30425f=_(_0x30425f)['union'](_0x2b7138)['compact']()['value']();return db['OpenchannelQueue'][_0x5489('0x4b')]({'where':{'id':_0x3ecd2c[_0x5489('0x4a')]['id']}})[_0x5489('0x28')](function(_0x8ae9b5){return db[_0x5489('0x6d')][_0x5489('0x80')](function(_0x4fc9eb){return _0x8ae9b5[_0x5489('0x71')](_0x3ecd2c[_0x5489('0x36')][_0x5489('0x67')],{'transaction':_0x4fc9eb})[_0x5489('0x28')](function(){if(!_['isEmpty'](_0x30425f)){return _0x8ae9b5[_0x5489('0x81')](_0x30425f,{'transaction':_0x4fc9eb});}})[_0x5489('0x28')](function(){_0x30425f['forEach'](function(_0xd14525){socket[_0x5489('0x70')](_0x5489('0x82'),{'UserId':_0xd14525,'OpenchannelQueueId':_0x8ae9b5['id']});});});});});});})[_0x5489('0x28')](respondWithStatusCode(_0x4d064a,null))[_0x5489('0x49')](handleError(_0x4d064a,null));};exports[_0x5489('0x83')]=function(_0x405096,_0x4968cb,_0x34ea94){return db['OpenchannelQueue'][_0x5489('0x4b')]({'where':{'id':_0x405096[_0x5489('0x4a')]['id']}})[_0x5489('0x28')](handleEntityNotFound(_0x4968cb,null))[_0x5489('0x28')](function(_0x2c7b6d){if(_0x2c7b6d){return _0x2c7b6d['addAgents'](_0x405096[_0x5489('0x4d')][_0x5489('0x67')],_[_0x5489('0x84')](_0x405096[_0x5489('0x4d')],['ids','id'])||{})[_0x5489('0x85')](function(_0x1b92e7){for(var _0x3055a2=0x0;_0x3055a2<_0x405096[_0x5489('0x4d')][_0x5489('0x67')][_0x5489('0x3b')];_0x3055a2+=0x1){socket['emit'](_0x5489('0x86'),{'UserId':Number(_0x405096[_0x5489('0x4d')][_0x5489('0x67')][_0x3055a2]),'OpenchannelQueueId':Number(_0x405096['params']['id'])});}return _0x1b92e7;});}})[_0x5489('0x28')](respondWithResult(_0x4968cb,null))[_0x5489('0x49')](handleError(_0x4968cb,null));};exports[_0x5489('0x81')]=function(_0x43f495,_0x176f6d,_0x50e292){return db[_0x5489('0x48')][_0x5489('0x4b')]({'where':{'id':_0x43f495['params']['id']}})['then'](handleEntityNotFound(_0x176f6d,null))[_0x5489('0x28')](function(_0x4677df){if(_0x4677df){return _0x4677df[_0x5489('0x81')](_0x43f495[_0x5489('0x36')]['ids'])['then'](function(){if(_[_0x5489('0x87')](_0x43f495[_0x5489('0x36')][_0x5489('0x67')])){for(var _0x2fbc24=0x0;_0x2fbc24<_0x43f495[_0x5489('0x36')]['ids']['length'];_0x2fbc24+=0x1){socket[_0x5489('0x70')](_0x5489('0x82'),{'UserId':Number(_0x43f495['query'][_0x5489('0x67')][_0x2fbc24]),'OpenchannelQueueId':Number(_0x43f495[_0x5489('0x4a')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x43f495[_0x5489('0x36')]['ids']),'OpenchannelQueueId':Number(_0x43f495[_0x5489('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x176f6d,null))[_0x5489('0x49')](handleError(_0x176f6d,null));};exports[_0x5489('0x88')]=function(_0x239666,_0x2dacd4,_0xf4faa){var _0x786dee={};var _0x1d109e={};var _0x403adf;var _0x198656;return db[_0x5489('0x48')][_0x5489('0x59')]({'where':{'id':_0x239666[_0x5489('0x4a')]['id']}})[_0x5489('0x28')](handleEntityNotFound(_0x2dacd4,null))[_0x5489('0x28')](function(_0x956439){if(_0x956439){_0x403adf=_0x956439;_0x1d109e['model']=_[_0x5489('0x37')](db[_0x5489('0x5c')][_0x5489('0x31')]);_0x1d109e[_0x5489('0x36')]=_['keys'](_0x239666[_0x5489('0x36')]);_0x1d109e['filters']=_[_0x5489('0x38')](_0x1d109e[_0x5489('0x35')],_0x1d109e[_0x5489('0x36')]);_0x786dee['attributes']=_[_0x5489('0x38')](_0x1d109e[_0x5489('0x35')],qs[_0x5489('0x3a')](_0x239666['query'][_0x5489('0x3a')]));_0x786dee[_0x5489('0x39')]=_0x786dee[_0x5489('0x39')][_0x5489('0x3b')]?_0x786dee[_0x5489('0x39')]:_0x1d109e['model'];_0x786dee[_0x5489('0x3e')]=qs['sort'](_0x239666['query'][_0x5489('0x3f')]);_0x786dee[_0x5489('0x40')]=qs[_0x5489('0x41')](_[_0x5489('0x42')](_0x239666['query'],_0x1d109e[_0x5489('0x41')]));if(_0x239666[_0x5489('0x36')]['filter']){_0x786dee[_0x5489('0x40')]=_[_0x5489('0x44')](_0x786dee[_0x5489('0x40')],{'$or':_[_0x5489('0x30')](_0x786dee['attributes'],function(_0x44ecb1){var _0x561566={};_0x561566[_0x44ecb1]={'$like':'%'+_0x239666[_0x5489('0x36')][_0x5489('0x43')]+'%'};return _0x561566;})});}_0x786dee=_[_0x5489('0x44')]({},_0x786dee,_0x239666['options']);return _0x403adf['getAgents'](_0x786dee);}})[_0x5489('0x28')](function(_0x67c5c7){if(_0x67c5c7){_0x198656=_0x67c5c7[_0x5489('0x3b')];if(!_0x239666[_0x5489('0x36')][_0x5489('0x3c')](_0x5489('0x3d'))){_0x786dee[_0x5489('0x21')]=qs[_0x5489('0x21')](_0x239666[_0x5489('0x36')][_0x5489('0x21')]);_0x786dee[_0x5489('0x23')]=qs[_0x5489('0x23')](_0x239666[_0x5489('0x36')][_0x5489('0x23')]);}return _0x403adf[_0x5489('0x88')](_0x786dee);}})[_0x5489('0x28')](function(_0x205a53){if(_0x205a53){return _0x205a53?{'count':_0x198656,'rows':_0x205a53}:null;}})['then'](respondWithResult(_0x2dacd4,null))[_0x5489('0x49')](handleError(_0x2dacd4,null));}; \ No newline at end of file +var _0x7677=['../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','name','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','OpenchannelQueue','includeAll','include','findAll','rows','catch','show','rawAttributes','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','params','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','transaction','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','union','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4d7a8b,_0x3afdcd){var _0x9b5113=function(_0x1a529f){while(--_0x1a529f){_0x4d7a8b['push'](_0x4d7a8b['shift']());}};_0x9b5113(++_0x3afdcd);}(_0x7677,0xf7));var _0x7767=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7677[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7767('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7767('0x1'));var rp=require(_0x7767('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7767('0x3'));var path=require('path');var sox=require(_0x7767('0x4'));var csv=require(_0x7767('0x5'));var ejs=require(_0x7767('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7767('0x7'));var crypto=require(_0x7767('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7767('0x5'));var querystring=require(_0x7767('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7767('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x7767('0xb'));var hardwareService=require(_0x7767('0xc'));var logger=require(_0x7767('0xd'))('api');var utils=require(_0x7767('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0x7767('0xf'));var db=require(_0x7767('0x10'))['db'];config['redis']=_['defaults'](config[_0x7767('0x11')],{'host':_0x7767('0x12'),'port':0x18eb});var socket=require(_0x7767('0x13'))(new Redis(config[_0x7767('0x11')]));require(_0x7767('0x14'))['register'](socket);function respondWithStatusCode(_0x406ff0,_0x24553a){_0x24553a=_0x24553a||0xcc;return function(_0x595a75){if(_0x595a75){return _0x406ff0['sendStatus'](_0x24553a);}return _0x406ff0[_0x7767('0x15')](_0x24553a)[_0x7767('0x16')]();};}function respondWithResult(_0x4022a9,_0x12d049){_0x12d049=_0x12d049||0xc8;return function(_0x5111a4){if(_0x5111a4){return _0x4022a9[_0x7767('0x15')](_0x12d049)[_0x7767('0x17')](_0x5111a4);}};}function respondWithFilteredResult(_0x51380a,_0x5cd633){return function(_0x2e842e){if(_0x2e842e){var _0x25ba31=typeof _0x5cd633[_0x7767('0x18')]===_0x7767('0x19')&&typeof _0x5cd633[_0x7767('0x1a')]===_0x7767('0x19');var _0xe8bd7f=_0x2e842e[_0x7767('0x1b')];var _0x4ca427=_0x25ba31?0x0:_0x5cd633[_0x7767('0x18')];var _0x330d3c=_0x25ba31?_0x2e842e[_0x7767('0x1b')]:_0x5cd633[_0x7767('0x18')]+_0x5cd633[_0x7767('0x1a')];var _0x2a860d;if(_0x330d3c>=_0xe8bd7f){_0x330d3c=_0xe8bd7f;_0x2a860d=0xc8;}else{_0x2a860d=0xce;}_0x51380a['status'](_0x2a860d);return _0x51380a[_0x7767('0x1c')](_0x7767('0x1d'),_0x4ca427+'-'+_0x330d3c+'/'+_0xe8bd7f)[_0x7767('0x17')](_0x2e842e);}return null;};}function patchUpdates(_0x3efeb6){return function(_0x2b87dd){try{jsonpatch[_0x7767('0x1e')](_0x2b87dd,_0x3efeb6,!![]);}catch(_0x215c81){return BPromise[_0x7767('0x1f')](_0x215c81);}return _0x2b87dd[_0x7767('0x20')]();};}function saveUpdates(_0x2b8f6d,_0x2e1745){return function(_0x3d8da3){if(_0x3d8da3){return _0x3d8da3[_0x7767('0x21')](_0x2b8f6d)[_0x7767('0x22')](function(_0x15f80f){return _0x15f80f;});}return null;};}function removeEntity(_0x4f4d38,_0x23c4ec){return function(_0x188f99){if(_0x188f99){return _0x188f99[_0x7767('0x23')]()[_0x7767('0x22')](function(){var _0x3c0715=_0x188f99[_0x7767('0x24')]({'plain':!![]});var _0x313a75=_0x7767('0x25');return db[_0x7767('0x26')]['destroy']({'where':{'type':_0x313a75,'resourceId':_0x3c0715['id']}})[_0x7767('0x22')](function(){return _0x188f99;});})[_0x7767('0x22')](function(){_0x4f4d38['status'](0xcc)[_0x7767('0x16')]();});}};}function handleEntityNotFound(_0x4a857e,_0x473e5a){return function(_0x2bd427){if(!_0x2bd427){_0x4a857e[_0x7767('0x27')](0x194);}return _0x2bd427;};}function handleError(_0x1c986a,_0x41355c){_0x41355c=_0x41355c||0x1f4;return function(_0x5d1502){logger[_0x7767('0x28')](_0x5d1502['stack']);if(_0x5d1502[_0x7767('0x29')]){delete _0x5d1502[_0x7767('0x29')];}_0x1c986a[_0x7767('0x15')](_0x41355c)['send'](_0x5d1502);};}exports['index']=function(_0x34175c,_0x9ff92b){var _0xb02816={},_0x194527={},_0x1c1f19={'count':0x0,'rows':[]};var _0x5a2451=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x27dda0){return{'name':_0x27dda0['fieldName'],'type':_0x27dda0['type'][_0x7767('0x2a')]};});_0x194527['model']=_[_0x7767('0x2b')](_0x5a2451,'name');_0x194527[_0x7767('0x2c')]=_[_0x7767('0x2d')](_0x34175c[_0x7767('0x2c')]);_0x194527[_0x7767('0x2e')]=_[_0x7767('0x2f')](_0x194527[_0x7767('0x30')],_0x194527[_0x7767('0x2c')]);_0xb02816[_0x7767('0x31')]=_[_0x7767('0x2f')](_0x194527[_0x7767('0x30')],qs[_0x7767('0x32')](_0x34175c['query'][_0x7767('0x32')]));_0xb02816[_0x7767('0x31')]=_0xb02816[_0x7767('0x31')][_0x7767('0x33')]?_0xb02816['attributes']:_0x194527[_0x7767('0x30')];if(!_0x34175c[_0x7767('0x2c')][_0x7767('0x34')](_0x7767('0x35'))){_0xb02816[_0x7767('0x1a')]=qs['limit'](_0x34175c[_0x7767('0x2c')][_0x7767('0x1a')]);_0xb02816[_0x7767('0x18')]=qs[_0x7767('0x18')](_0x34175c[_0x7767('0x2c')][_0x7767('0x18')]);}_0xb02816[_0x7767('0x36')]=qs['sort'](_0x34175c[_0x7767('0x2c')][_0x7767('0x37')]);_0xb02816[_0x7767('0x38')]=qs['filters'](_[_0x7767('0x39')](_0x34175c[_0x7767('0x2c')],_0x194527['filters']),_0x5a2451);if(_0x34175c[_0x7767('0x2c')][_0x7767('0x3a')]){_0xb02816[_0x7767('0x38')]=_['merge'](_0xb02816[_0x7767('0x38')],{'$or':_['map'](_0x5a2451,function(_0x92be68){if(_0x92be68[_0x7767('0x3b')]!==_0x7767('0x3c')){var _0x2d96a7={};_0x2d96a7[_0x92be68[_0x7767('0x29')]]={'$like':'%'+_0x34175c[_0x7767('0x2c')]['filter']+'%'};return _0x2d96a7;}})});}_0xb02816=_[_0x7767('0x3d')]({},_0xb02816,_0x34175c[_0x7767('0x3e')]);var _0x788a7e={'where':_0xb02816['where']};return db[_0x7767('0x3f')]['count'](_0x788a7e)[_0x7767('0x22')](function(_0x29cfd2){_0x1c1f19[_0x7767('0x1b')]=_0x29cfd2;if(_0x34175c['query'][_0x7767('0x40')]){_0xb02816[_0x7767('0x41')]=[{'all':!![]}];}return db[_0x7767('0x3f')][_0x7767('0x42')](_0xb02816);})[_0x7767('0x22')](function(_0x2feed5){_0x1c1f19[_0x7767('0x43')]=_0x2feed5;return _0x1c1f19;})['then'](respondWithFilteredResult(_0x9ff92b,_0xb02816))[_0x7767('0x44')](handleError(_0x9ff92b,null));};exports[_0x7767('0x45')]=function(_0x26ba43,_0x224ce1){var _0x2b242d={'raw':!![],'where':{'id':_0x26ba43['params']['id']}},_0x7564e0={};_0x7564e0['model']=_[_0x7767('0x2d')](db[_0x7767('0x3f')][_0x7767('0x46')]);_0x7564e0['query']=_['keys'](_0x26ba43[_0x7767('0x2c')]);_0x7564e0[_0x7767('0x2e')]=_[_0x7767('0x2f')](_0x7564e0[_0x7767('0x30')],_0x7564e0[_0x7767('0x2c')]);_0x2b242d['attributes']=_[_0x7767('0x2f')](_0x7564e0['model'],qs[_0x7767('0x32')](_0x26ba43[_0x7767('0x2c')][_0x7767('0x32')]));_0x2b242d[_0x7767('0x31')]=_0x2b242d['attributes'][_0x7767('0x33')]?_0x2b242d['attributes']:_0x7564e0['model'];if(_0x26ba43[_0x7767('0x2c')][_0x7767('0x40')]){_0x2b242d[_0x7767('0x41')]=[{'all':!![]}];}_0x2b242d=_[_0x7767('0x3d')]({},_0x2b242d,_0x26ba43[_0x7767('0x3e')]);return db[_0x7767('0x3f')][_0x7767('0x47')](_0x2b242d)[_0x7767('0x22')](handleEntityNotFound(_0x224ce1,null))[_0x7767('0x22')](respondWithResult(_0x224ce1,null))[_0x7767('0x44')](handleError(_0x224ce1,null));};exports[_0x7767('0x48')]=function(_0x370229,_0x45a365){return db[_0x7767('0x3f')][_0x7767('0x48')](_0x370229[_0x7767('0x49')],{})['then'](function(_0x32bcdc){var _0x2a6657=_0x370229[_0x7767('0x4a')][_0x7767('0x24')]({'plain':!![]});if(!_0x2a6657)throw new Error(_0x7767('0x4b'));if(_0x2a6657[_0x7767('0x4c')]===_0x7767('0x4a')){var _0x381b05=_0x32bcdc['get']({'plain':!![]});var _0x5dd574='OpenchannelQueues';return db[_0x7767('0x4d')][_0x7767('0x47')]({'where':{'name':_0x5dd574,'userProfileId':_0x2a6657[_0x7767('0x4e')]},'raw':!![]})['then'](function(_0x3691fa){if(_0x3691fa&&_0x3691fa[_0x7767('0x4f')]===0x0){return db[_0x7767('0x26')][_0x7767('0x48')]({'name':_0x381b05[_0x7767('0x29')],'resourceId':_0x381b05['id'],'type':_0x3691fa[_0x7767('0x29')],'sectionId':_0x3691fa['id']},{})[_0x7767('0x22')](function(){return _0x32bcdc;});}else{return _0x32bcdc;}})['catch'](function(_0x9adc41){logger['error'](_0x7767('0x50'),_0x9adc41);throw _0x9adc41;});}return _0x32bcdc;})['then'](respondWithResult(_0x45a365,0xc9))['catch'](handleError(_0x45a365,null));};exports[_0x7767('0x21')]=function(_0x2bc43b,_0x2c8c14){if(_0x2bc43b[_0x7767('0x49')]['id']){delete _0x2bc43b[_0x7767('0x49')]['id'];}return db[_0x7767('0x3f')][_0x7767('0x47')]({'where':{'id':_0x2bc43b[_0x7767('0x51')]['id']}})[_0x7767('0x22')](handleEntityNotFound(_0x2c8c14,null))[_0x7767('0x22')](saveUpdates(_0x2bc43b['body'],null))[_0x7767('0x22')](respondWithResult(_0x2c8c14,null))[_0x7767('0x44')](handleError(_0x2c8c14,null));};exports[_0x7767('0x23')]=function(_0x54fe7d,_0x51773b){return db[_0x7767('0x3f')][_0x7767('0x47')]({'where':{'id':_0x54fe7d[_0x7767('0x51')]['id']}})['then'](handleEntityNotFound(_0x51773b,null))[_0x7767('0x22')](removeEntity(_0x51773b,null))['catch'](handleError(_0x51773b,null));};exports[_0x7767('0x52')]=function(_0x236531,_0x5578bd){return db[_0x7767('0x3f')][_0x7767('0x52')]()[_0x7767('0x22')](respondWithResult(_0x5578bd,null))['catch'](handleError(_0x5578bd,null));};exports[_0x7767('0x53')]=function(_0x34aa01,_0x2a331e,_0x217eb2){var _0x26f059={'raw':!![],'where':{}},_0x9b006d={},_0x39701c;return db[_0x7767('0x3f')][_0x7767('0x54')]({'where':{'id':_0x34aa01[_0x7767('0x51')]['id']}})['then'](handleEntityNotFound(_0x2a331e,null))['then'](function(_0x4d71ee){if(_0x4d71ee){_0x39701c=_0x4d71ee[_0x7767('0x24')]({'plain':!![]});_0x9b006d[_0x7767('0x30')]=_['keys'](db['UserOpenchannelQueue'][_0x7767('0x46')]);_0x9b006d[_0x7767('0x2c')]=_[_0x7767('0x2d')](_0x34aa01[_0x7767('0x2c')]);_0x9b006d[_0x7767('0x2e')]=_[_0x7767('0x2f')](_0x9b006d[_0x7767('0x30')],_0x9b006d[_0x7767('0x2c')]);_0x26f059[_0x7767('0x31')]=_['intersection'](_0x9b006d[_0x7767('0x30')],qs[_0x7767('0x32')](_0x34aa01[_0x7767('0x2c')][_0x7767('0x32')]));_0x26f059[_0x7767('0x31')]=_0x26f059[_0x7767('0x31')][_0x7767('0x33')]?_0x26f059[_0x7767('0x31')]:_0x9b006d[_0x7767('0x30')];if(!_0x34aa01['query']['hasOwnProperty'](_0x7767('0x35'))){_0x26f059[_0x7767('0x1a')]=qs[_0x7767('0x1a')](_0x34aa01[_0x7767('0x2c')]['limit']);_0x26f059[_0x7767('0x18')]=qs[_0x7767('0x18')](_0x34aa01[_0x7767('0x2c')]['offset']);}_0x26f059['order']=qs[_0x7767('0x37')](_0x34aa01[_0x7767('0x2c')][_0x7767('0x37')]);_0x26f059[_0x7767('0x38')]=qs[_0x7767('0x2e')](_[_0x7767('0x39')](_0x34aa01['query'],_0x9b006d[_0x7767('0x2e')]));_0x26f059['where'][_0x7767('0x55')]=_0x4d71ee['id'];if(_0x34aa01[_0x7767('0x2c')][_0x7767('0x3a')]){_0x26f059[_0x7767('0x38')]=_['merge'](_0x26f059[_0x7767('0x38')],{'$or':_[_0x7767('0x2b')](_0x26f059['attributes'],function(_0x1c81dc){var _0x3f0956={};_0x3f0956[_0x1c81dc]={'$like':'%'+_0x34aa01['query'][_0x7767('0x3a')]+'%'};return _0x3f0956;})});}_0x26f059=_[_0x7767('0x3d')]({},_0x26f059,_0x34aa01[_0x7767('0x3e')]);return db[_0x7767('0x56')][_0x7767('0x42')](_0x26f059);}})['then'](function(_0x2202e7){if(_0x2202e7){return db[_0x7767('0x57')][_0x7767('0x58')]({'where':{'id':_[_0x7767('0x2b')](_0x2202e7,'UserId'),'role':_0x7767('0x59')},'attributes':['id','name',_0x7767('0x5a'),_0x7767('0x5b'),_0x7767('0x5c')]});}})['then'](function(_0x539284){if(_0x539284){return{'count':_0x539284['count'],'rows':_[_0x7767('0x2b')](_0x539284[_0x7767('0x43')],function(_0xb16222){return{'membername':_0xb16222[_0x7767('0x29')],'UserId':_0xb16222['id'],'queue_name':_0x39701c[_0x7767('0x29')],'OpenchannelQueueId':_0x39701c['id'],'interface':util[_0x7767('0x5d')]('%s/%s',_0x7767('0x5e'),_0xb16222[_0x7767('0x29')]),'penalty':0x0,'paused':_0xb16222['openchannelPause'],'createdAt':_0xb16222[_0x7767('0x5c')],'updatedAt':_0xb16222[_0x7767('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2a331e,_0x26f059))[_0x7767('0x44')](handleError(_0x2a331e,null));};exports[_0x7767('0x5f')]=function(_0x229431,_0x53feab,_0x57cfb6){var _0x23439c={};var _0x11ea7a={};var _0x1e6a65;var _0x11e960;return db[_0x7767('0x3f')][_0x7767('0x54')]({'where':{'id':_0x229431['params']['id']}})[_0x7767('0x22')](handleEntityNotFound(_0x53feab,null))[_0x7767('0x22')](function(_0x5bbfdd){if(_0x5bbfdd){_0x1e6a65=_0x5bbfdd;_0x11ea7a[_0x7767('0x30')]=_['keys'](db[_0x7767('0x60')]['rawAttributes']);_0x11ea7a[_0x7767('0x2c')]=_[_0x7767('0x2d')](_0x229431[_0x7767('0x2c')]);_0x11ea7a[_0x7767('0x2e')]=_[_0x7767('0x2f')](_0x11ea7a['model'],_0x11ea7a[_0x7767('0x2c')]);_0x23439c[_0x7767('0x31')]=_[_0x7767('0x2f')](_0x11ea7a[_0x7767('0x30')],qs[_0x7767('0x32')](_0x229431[_0x7767('0x2c')][_0x7767('0x32')]));_0x23439c[_0x7767('0x31')]=_0x23439c['attributes'][_0x7767('0x33')]?_0x23439c[_0x7767('0x31')]:_0x11ea7a[_0x7767('0x30')];_0x23439c[_0x7767('0x36')]=qs['sort'](_0x229431[_0x7767('0x2c')]['sort']);_0x23439c[_0x7767('0x38')]=qs[_0x7767('0x2e')](_[_0x7767('0x39')](_0x229431[_0x7767('0x2c')],_0x11ea7a[_0x7767('0x2e')]));if(_0x229431[_0x7767('0x2c')][_0x7767('0x3a')]){_0x23439c[_0x7767('0x38')]=_[_0x7767('0x3d')](_0x23439c[_0x7767('0x38')],{'$or':_['map'](_0x23439c['attributes'],function(_0x325d9d){var _0xb6760c={};_0xb6760c[_0x325d9d]={'$like':'%'+_0x229431[_0x7767('0x2c')][_0x7767('0x3a')]+'%'};return _0xb6760c;})});}_0x23439c=_[_0x7767('0x3d')]({},_0x23439c,_0x229431['options']);return _0x1e6a65['getTeams'](_0x23439c);}})[_0x7767('0x22')](function(_0x310642){if(_0x310642){_0x11e960=_0x310642[_0x7767('0x33')];if(!_0x229431['query'][_0x7767('0x34')]('nolimit')){_0x23439c[_0x7767('0x1a')]=qs['limit'](_0x229431[_0x7767('0x2c')][_0x7767('0x1a')]);_0x23439c[_0x7767('0x18')]=qs[_0x7767('0x18')](_0x229431[_0x7767('0x2c')]['offset']);}return _0x1e6a65['getTeams'](_0x23439c);}})[_0x7767('0x22')](function(_0x19b230){if(_0x19b230){return _0x19b230?{'count':_0x11e960,'rows':_0x19b230}:null;}})[_0x7767('0x22')](respondWithResult(_0x53feab,null))['catch'](handleError(_0x53feab,null));};exports[_0x7767('0x61')]=function(_0x5cf391,_0x2a6a15,_0x2ec5a2){var _0xbcfda4=_0x5cf391[_0x7767('0x49')][_0x7767('0x62')];return db[_0x7767('0x60')]['findAll']({'where':{'id':_0xbcfda4},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7767('0x29'),_0x7767('0x63'),_0x7767('0x64'),'interface'],'raw':!![]}]})['then'](function(_0x311654){if(_0x311654){var _0x14da5e=_[_0x7767('0x65')](_0x311654,function(_0x19339f){var _0x6e69fe=_0x19339f['get']({'plain':!![]});return _0x6e69fe[_0x7767('0x66')];});return db[_0x7767('0x3f')][_0x7767('0x47')]({'where':{'id':_0x5cf391['params']['id']}})[_0x7767('0x22')](function(_0x385060){return db['sequelize'][_0x7767('0x67')](function(_0xfd2b6e){return _0x385060[_0x7767('0x61')](_0xbcfda4,{'transaction':_0xfd2b6e})[_0x7767('0x22')](function(){return BPromise['each'](_0x14da5e,function(_0x1142ed){return db[_0x7767('0x56')][_0x7767('0x68')]({'where':{'UserId':_0x1142ed['id'],'OpenchannelQueueId':_0x5cf391['params']['id']},'transaction':_0xfd2b6e});});})[_0x7767('0x22')](function(){_0x14da5e[_0x7767('0x69')](function(_0x54387c){socket['emit'](_0x7767('0x6a'),{'UserId':_0x54387c['id'],'OpenchannelQueueId':_0x385060['id']});});});});});}})[_0x7767('0x22')](respondWithStatusCode(_0x2a6a15,null))['catch'](handleError(_0x2a6a15,null));};exports[_0x7767('0x6b')]=function(_0x355569,_0x329ad7,_0x35b102){return db['Team'][_0x7767('0x42')]({'where':{'id':_0x355569[_0x7767('0x2c')][_0x7767('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7767('0x22')](handleEntityNotFound(_0x329ad7,null))[_0x7767('0x22')](function(_0x5bad44){var _0x1fd03d=_[_0x7767('0x2b')](_0x5bad44,'id');var _0x562089=[];var _0x38f85a=[];var _0x49958a=squel[_0x7767('0x6c')]();_0x49958a['field'](_0x7767('0x6d'))['from']('team_has_openchannel_queues','tq')[_0x7767('0x6e')](_0x7767('0x6f'),'ut',_0x7767('0x70'))[_0x7767('0x38')](_0x7767('0x71'),_0x355569[_0x7767('0x51')]['id']);for(var _0x3fabd7=0x0;_0x3fabd7<_0x5bad44[_0x7767('0x33')];_0x3fabd7+=0x1){let _0x2bd254=_0x5bad44[_0x3fabd7];for(var _0x483184=0x0;_0x483184<_0x2bd254[_0x7767('0x66')][_0x7767('0x33')];_0x483184+=0x1){let _0x39ff49=_0x2bd254['Agents'][_0x483184];var _0x22b5b3=_0x49958a[_0x7767('0x72')]();_0x22b5b3[_0x7767('0x38')](_0x7767('0x73'),_0x39ff49['id']);_0x38f85a[_0x7767('0x74')](db[_0x7767('0x75')][_0x7767('0x2c')](_0x22b5b3[_0x7767('0x76')](),{'type':db[_0x7767('0x75')][_0x7767('0x77')][_0x7767('0x78')]})[_0x7767('0x22')](function(_0x45df34){if(_0x45df34[_0x7767('0x33')]===0x1){return _0x39ff49['id'];}else{var _0x24ab01=_[_0x7767('0x79')](_[_0x7767('0x2b')](_0x45df34,'TeamId'),function(_0x24a8ed){return _[_0x7767('0x7a')](_0x1fd03d,_0x24a8ed);});if(_0x24ab01){return _0x39ff49['id'];}}}));}}return BPromise['all'](_0x38f85a)['then'](function(_0x52328a){_0x562089=_(_0x562089)[_0x7767('0x7b')](_0x52328a)['compact']()['value']();return db[_0x7767('0x3f')][_0x7767('0x47')]({'where':{'id':_0x355569['params']['id']}})['then'](function(_0x420562){return db['sequelize'][_0x7767('0x67')](function(_0x41312a){return _0x420562[_0x7767('0x6b')](_0x355569[_0x7767('0x2c')][_0x7767('0x62')],{'transaction':_0x41312a})[_0x7767('0x22')](function(){if(!_['isEmpty'](_0x562089)){return _0x420562['removeAgents'](_0x562089,{'transaction':_0x41312a});}})[_0x7767('0x22')](function(){_0x562089['forEach'](function(_0x2e6300){socket[_0x7767('0x7c')](_0x7767('0x7d'),{'UserId':_0x2e6300,'OpenchannelQueueId':_0x420562['id']});});});});});});})[_0x7767('0x22')](respondWithStatusCode(_0x329ad7,null))['catch'](handleError(_0x329ad7,null));};exports[_0x7767('0x7e')]=function(_0x29c594,_0x3d3b81,_0x3a1bf8){return db['OpenchannelQueue'][_0x7767('0x47')]({'where':{'id':_0x29c594['params']['id']}})['then'](handleEntityNotFound(_0x3d3b81,null))[_0x7767('0x22')](function(_0xf639a4){if(_0xf639a4){return _0xf639a4['addAgents'](_0x29c594['body'][_0x7767('0x62')],_[_0x7767('0x7f')](_0x29c594[_0x7767('0x49')],[_0x7767('0x62'),'id'])||{})[_0x7767('0x80')](function(_0xcaa9d5){for(var _0x5dd395=0x0;_0x5dd395<_0x29c594['body'][_0x7767('0x62')][_0x7767('0x33')];_0x5dd395+=0x1){socket[_0x7767('0x7c')]('userOpenchannelQueue:save',{'UserId':Number(_0x29c594['body'][_0x7767('0x62')][_0x5dd395]),'OpenchannelQueueId':Number(_0x29c594[_0x7767('0x51')]['id'])});}return _0xcaa9d5;});}})[_0x7767('0x22')](respondWithResult(_0x3d3b81,null))[_0x7767('0x44')](handleError(_0x3d3b81,null));};exports['removeAgents']=function(_0x4c038a,_0x3773da,_0x4deb10){return db[_0x7767('0x3f')]['find']({'where':{'id':_0x4c038a[_0x7767('0x51')]['id']}})[_0x7767('0x22')](handleEntityNotFound(_0x3773da,null))['then'](function(_0x24ab77){if(_0x24ab77){return _0x24ab77['removeAgents'](_0x4c038a[_0x7767('0x2c')][_0x7767('0x62')])[_0x7767('0x22')](function(){if(_[_0x7767('0x81')](_0x4c038a['query'][_0x7767('0x62')])){for(var _0x20579c=0x0;_0x20579c<_0x4c038a[_0x7767('0x2c')][_0x7767('0x62')][_0x7767('0x33')];_0x20579c+=0x1){socket[_0x7767('0x7c')](_0x7767('0x7d'),{'UserId':Number(_0x4c038a[_0x7767('0x2c')][_0x7767('0x62')][_0x20579c]),'OpenchannelQueueId':Number(_0x4c038a['params']['id'])});}}else{socket[_0x7767('0x7c')](_0x7767('0x7d'),{'UserId':Number(_0x4c038a[_0x7767('0x2c')][_0x7767('0x62')]),'OpenchannelQueueId':Number(_0x4c038a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3773da,null))[_0x7767('0x44')](handleError(_0x3773da,null));};exports[_0x7767('0x82')]=function(_0x598731,_0x5ca55a,_0x1e1a9b){var _0x4b827e={};var _0x387a9d={};var _0x17895d;var _0x5be7fc;return db[_0x7767('0x3f')][_0x7767('0x54')]({'where':{'id':_0x598731[_0x7767('0x51')]['id']}})[_0x7767('0x22')](handleEntityNotFound(_0x5ca55a,null))[_0x7767('0x22')](function(_0x5f4fbd){if(_0x5f4fbd){_0x17895d=_0x5f4fbd;_0x387a9d['model']=_[_0x7767('0x2d')](db['User'][_0x7767('0x46')]);_0x387a9d['query']=_[_0x7767('0x2d')](_0x598731['query']);_0x387a9d[_0x7767('0x2e')]=_['intersection'](_0x387a9d[_0x7767('0x30')],_0x387a9d[_0x7767('0x2c')]);_0x4b827e[_0x7767('0x31')]=_['intersection'](_0x387a9d[_0x7767('0x30')],qs[_0x7767('0x32')](_0x598731[_0x7767('0x2c')][_0x7767('0x32')]));_0x4b827e[_0x7767('0x31')]=_0x4b827e[_0x7767('0x31')][_0x7767('0x33')]?_0x4b827e[_0x7767('0x31')]:_0x387a9d[_0x7767('0x30')];_0x4b827e[_0x7767('0x36')]=qs[_0x7767('0x37')](_0x598731[_0x7767('0x2c')][_0x7767('0x37')]);_0x4b827e['where']=qs[_0x7767('0x2e')](_[_0x7767('0x39')](_0x598731[_0x7767('0x2c')],_0x387a9d[_0x7767('0x2e')]));if(_0x598731['query'][_0x7767('0x3a')]){_0x4b827e['where']=_[_0x7767('0x3d')](_0x4b827e[_0x7767('0x38')],{'$or':_[_0x7767('0x2b')](_0x4b827e[_0x7767('0x31')],function(_0x447ac8){var _0x345a98={};_0x345a98[_0x447ac8]={'$like':'%'+_0x598731[_0x7767('0x2c')][_0x7767('0x3a')]+'%'};return _0x345a98;})});}_0x4b827e=_[_0x7767('0x3d')]({},_0x4b827e,_0x598731['options']);return _0x17895d[_0x7767('0x82')](_0x4b827e);}})['then'](function(_0x3d1021){if(_0x3d1021){_0x5be7fc=_0x3d1021[_0x7767('0x33')];if(!_0x598731['query'][_0x7767('0x34')]('nolimit')){_0x4b827e['limit']=qs[_0x7767('0x1a')](_0x598731[_0x7767('0x2c')][_0x7767('0x1a')]);_0x4b827e[_0x7767('0x18')]=qs['offset'](_0x598731[_0x7767('0x2c')][_0x7767('0x18')]);}return _0x17895d[_0x7767('0x82')](_0x4b827e);}})['then'](function(_0xb2ce1c){if(_0xb2ce1c){return _0xb2ce1c?{'count':_0x5be7fc,'rows':_0xb2ce1c}:null;}})['then'](respondWithResult(_0x5ca55a,null))[_0x7767('0x44')](handleError(_0x5ca55a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6383d77..645df8e 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 _0x8428=['hook','exports','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x8428,0x175));var _0x8842=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8428[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x8842('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8842('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8842('0x2'),'afterDestroy':_0x8842('0x3')};function emitEvent(_0x253338){return function(_0x4fa59e,_0x288c91,_0x443246){OpenchannelQueueEvents['emit'](_0x253338+':'+_0x4fa59e['id'],_0x4fa59e);OpenchannelQueueEvents[_0x8842('0x4')](_0x253338,_0x4fa59e);_0x443246(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x8842('0x5')](e,emitEvent(event));}}module[_0x8842('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9738=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2880de,_0xcc87a1){var _0x145aeb=function(_0x389632){while(--_0x389632){_0x2880de['push'](_0x2880de['shift']());}};_0x145aeb(++_0xcc87a1);}(_0x9738,0xb4));var _0x8973=function(_0x482a54,_0xf63e6d){_0x482a54=_0x482a54-0x0;var _0x460b84=_0x9738[_0x482a54];return _0x460b84;};'use strict';var EventEmitter=require(_0x8973('0x0'));var OpenchannelQueue=require(_0x8973('0x1'))['db'][_0x8973('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8973('0x3')](0x0);var events={'afterCreate':_0x8973('0x4'),'afterUpdate':'update','afterDestroy':_0x8973('0x5')};function emitEvent(_0x2cab7d){return function(_0x377f65,_0x540e51,_0x3c7a6a){OpenchannelQueueEvents[_0x8973('0x6')](_0x2cab7d+':'+_0x377f65['id'],_0x377f65);OpenchannelQueueEvents[_0x8973('0x6')](_0x2cab7d,_0x377f65);_0x3c7a6a(null);};}for(var e in events){if(events[_0x8973('0x7')](e)){var event=events[e];OpenchannelQueue[_0x8973('0x8')](e,emitEvent(event));}}module[_0x8973('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 7e03fec..1c7001d 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 _0x6c33=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0x6c33,0x9c));var _0x36c3=function(_0x38bbd2,_0x709b0a){_0x38bbd2=_0x38bbd2-0x0;var _0x32c72c=_0x6c33[_0x38bbd2];return _0x32c72c;};'use strict';var _=require(_0x36c3('0x0'));var util=require('util');var logger=require(_0x36c3('0x1'))(_0x36c3('0x2'));var moment=require('moment');var BPromise=require(_0x36c3('0x3'));var rp=require(_0x36c3('0x4'));var fs=require('fs');var path=require(_0x36c3('0x5'));var rimraf=require('rimraf');var config=require(_0x36c3('0x6'));var attributes=require(_0x36c3('0x7'));module[_0x36c3('0x8')]=function(_0x2c0580,_0x5a65ca){return _0x2c0580[_0x36c3('0x9')](_0x36c3('0xa'),attributes,{'tableName':_0x36c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ab8=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7ab8,0x152));var _0x87ab=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7ab8[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x87ab('0x0'));var util=require(_0x87ab('0x1'));var logger=require(_0x87ab('0x2'))(_0x87ab('0x3'));var moment=require(_0x87ab('0x4'));var BPromise=require(_0x87ab('0x5'));var rp=require(_0x87ab('0x6'));var fs=require('fs');var path=require(_0x87ab('0x7'));var rimraf=require(_0x87ab('0x8'));var config=require(_0x87ab('0x9'));var attributes=require(_0x87ab('0xa'));module[_0x87ab('0xb')]=function(_0x1e32e6,_0x181ad6){return _0x1e32e6[_0x87ab('0xc')](_0x87ab('0xd'),attributes,{'tableName':_0x87ab('0xe'),'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 d124819..decb593 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 _0x9aa6=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','where','lodash'];(function(_0x19f897,_0x541200){var _0x181c01=function(_0x411af7){while(--_0x411af7){_0x19f897['push'](_0x19f897['shift']());}};_0x181c01(++_0x541200);}(_0x9aa6,0x155));var _0x69aa=function(_0x326bb9,_0x4e81be){_0x326bb9=_0x326bb9-0x0;var _0x5543da=_0x9aa6[_0x326bb9];return _0x5543da;};'use strict';var _=require(_0x69aa('0x0'));var util=require(_0x69aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x69aa('0x2'));var fs=require('fs');var Redis=require(_0x69aa('0x3'));var db=require(_0x69aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x69aa('0x5'))(_0x69aa('0x6'));var config=require(_0x69aa('0x7'));var jayson=require(_0x69aa('0x8'));var client=jayson['client'][_0x69aa('0x9')]({'port':0x232a});config[_0x69aa('0xa')]=_[_0x69aa('0xb')](config[_0x69aa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x69aa('0xc'))(new Redis(config[_0x69aa('0xa')]));require('./openchannelQueue.socket')[_0x69aa('0xd')](socket);function respondWithRpcPromise(_0x43afeb,_0x388d66,_0x58ff41){return new BPromise(function(_0x1e7586,_0x1c6fb2){return client['request'](_0x43afeb,_0x58ff41)[_0x69aa('0xe')](function(_0x110da5){logger[_0x69aa('0xf')](_0x69aa('0x10'),_0x388d66,_0x69aa('0x11'));logger[_0x69aa('0x12')](_0x69aa('0x13'),_0x388d66,_0x69aa('0x11'),JSON[_0x69aa('0x14')](_0x110da5));if(_0x110da5[_0x69aa('0x15')]){if(_0x110da5[_0x69aa('0x15')][_0x69aa('0x16')]===0x1f4){logger[_0x69aa('0x15')](_0x69aa('0x10'),_0x388d66,_0x110da5[_0x69aa('0x15')][_0x69aa('0x17')]);return _0x1c6fb2(_0x110da5[_0x69aa('0x15')][_0x69aa('0x17')]);}logger[_0x69aa('0x15')](_0x69aa('0x10'),_0x388d66,_0x110da5[_0x69aa('0x15')][_0x69aa('0x17')]);return _0x1e7586(_0x110da5[_0x69aa('0x15')][_0x69aa('0x17')]);}else{logger[_0x69aa('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x388d66,_0x69aa('0x11'));_0x1e7586(_0x110da5[_0x69aa('0x18')][_0x69aa('0x17')]);}})[_0x69aa('0x19')](function(_0x8f92df){logger[_0x69aa('0x15')](_0x69aa('0x10'),_0x388d66,_0x8f92df);_0x1c6fb2(_0x8f92df);});});}exports['GetOpenchannelQueue']=function(_0x1fd6f8){var _0x5ebb82=this;return new Promise(function(_0x125211,_0x17038c){return db[_0x69aa('0x1a')][_0x69aa('0x1b')]({'raw':_0x1fd6f8['options']?_0x1fd6f8[_0x69aa('0x1c')][_0x69aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fd6f8[_0x69aa('0x1c')]?_0x1fd6f8[_0x69aa('0x1c')]['where']||null:null,'attributes':_0x1fd6f8[_0x69aa('0x1c')]?_0x1fd6f8[_0x69aa('0x1c')][_0x69aa('0x1e')]||null:null,'limit':_0x1fd6f8[_0x69aa('0x1c')]?_0x1fd6f8[_0x69aa('0x1c')][_0x69aa('0x1f')]||null:null,'include':_0x1fd6f8[_0x69aa('0x1c')]?_0x1fd6f8[_0x69aa('0x1c')][_0x69aa('0x20')]?_[_0x69aa('0x21')](_0x1fd6f8[_0x69aa('0x1c')][_0x69aa('0x20')],function(_0x52d057){return{'model':db[_0x52d057[_0x69aa('0x22')]],'as':_0x52d057['as'],'attributes':_0x52d057[_0x69aa('0x1e')],'include':_0x52d057[_0x69aa('0x20')]?_[_0x69aa('0x21')](_0x52d057['include'],function(_0xc61fd2){return{'model':db[_0xc61fd2[_0x69aa('0x22')]],'as':_0xc61fd2['as'],'attributes':_0xc61fd2['attributes'],'include':_0xc61fd2[_0x69aa('0x20')]?_[_0x69aa('0x21')](_0xc61fd2[_0x69aa('0x20')],function(_0x5647a1){return{'model':db[_0x5647a1[_0x69aa('0x22')]],'as':_0x5647a1['as'],'attributes':_0x5647a1['attributes']};}):[]};}):[]};}):[]:[]})[_0x69aa('0xe')](function(_0x55c355){logger[_0x69aa('0xf')]('GetOpenchannelQueue',_0x1fd6f8);logger['debug'](_0x69aa('0x23'),_0x1fd6f8,JSON['stringify'](_0x55c355));_0x125211(_0x55c355);})[_0x69aa('0x19')](function(_0x3f34fb){logger[_0x69aa('0x15')]('GetOpenchannelQueue',_0x3f34fb[_0x69aa('0x17')],_0x1fd6f8);_0x17038c(_0x5ebb82[_0x69aa('0x15')](0x1f4,_0x3f34fb[_0x69aa('0x17')]));});});};exports[_0x69aa('0x24')]=function(_0x370697){var _0x7f76=this;return new Promise(function(_0x6487b3,_0x16aa66){return db['OpenchannelQueue']['find']({'raw':_0x370697['options']?_0x370697[_0x69aa('0x1c')][_0x69aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x370697[_0x69aa('0x1c')]?_0x370697[_0x69aa('0x1c')][_0x69aa('0x25')]||null:null,'attributes':_0x370697[_0x69aa('0x1c')]?_0x370697[_0x69aa('0x1c')][_0x69aa('0x1e')]||null:null,'include':_0x370697['options']?_0x370697[_0x69aa('0x1c')]['include']?_['map'](_0x370697[_0x69aa('0x1c')]['include'],function(_0x16f2bd){return{'model':db[_0x16f2bd[_0x69aa('0x22')]],'as':_0x16f2bd['as'],'attributes':_0x16f2bd[_0x69aa('0x1e')],'include':_0x16f2bd['include']?_[_0x69aa('0x21')](_0x16f2bd['include'],function(_0x4dab28){return{'model':db[_0x4dab28['model']],'as':_0x4dab28['as'],'attributes':_0x4dab28['attributes'],'include':_0x4dab28['include']?_[_0x69aa('0x21')](_0x4dab28['include'],function(_0x478857){return{'model':db[_0x478857[_0x69aa('0x22')]],'as':_0x478857['as'],'attributes':_0x478857[_0x69aa('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a19c2){logger[_0x69aa('0xf')](_0x69aa('0x24'),_0x370697);logger[_0x69aa('0x12')](_0x69aa('0x24'),_0x370697,JSON['stringify'](_0x2a19c2));_0x6487b3(_0x2a19c2);})[_0x69aa('0x19')](function(_0xd1fdf8){logger[_0x69aa('0x15')]('ShowOpenchannelQueue',_0xd1fdf8[_0x69aa('0x17')],_0x370697);_0x16aa66(_0x7f76[_0x69aa('0x15')](0x1f4,_0xd1fdf8[_0x69aa('0x17')]));});});}; \ No newline at end of file +var _0xe4e8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','OpenchannelQueue,\x20%s,\x20%s','catch','GetOpenchannelQueue','OpenchannelQueue','raw','options','where','limit','include','map','attributes','model','stringify','ShowOpenchannelQueue','find','util','moment','bluebird','randomstring'];(function(_0xf18977,_0x87ecc4){var _0x360bb8=function(_0x58a178){while(--_0x58a178){_0xf18977['push'](_0xf18977['shift']());}};_0x360bb8(++_0x87ecc4);}(_0xe4e8,0x71));var _0x8e4e=function(_0x463924,_0xe2d6fd){_0x463924=_0x463924-0x0;var _0x4a8f1=_0xe4e8[_0x463924];return _0x4a8f1;};'use strict';var _=require('lodash');var util=require(_0x8e4e('0x0'));var moment=require(_0x8e4e('0x1'));var BPromise=require(_0x8e4e('0x2'));var rs=require(_0x8e4e('0x3'));var fs=require('fs');var Redis=require(_0x8e4e('0x4'));var db=require(_0x8e4e('0x5'))['db'];var utils=require(_0x8e4e('0x6'));var logger=require(_0x8e4e('0x7'))(_0x8e4e('0x8'));var config=require('../../config/environment');var jayson=require(_0x8e4e('0x9'));var client=jayson['client'][_0x8e4e('0xa')]({'port':0x232a});config[_0x8e4e('0xb')]=_['defaults'](config[_0x8e4e('0xb')],{'host':_0x8e4e('0xc'),'port':0x18eb});var socket=require(_0x8e4e('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x8e4e('0xe')](socket);function respondWithRpcPromise(_0x51bd78,_0x18be4e,_0x53f334){return new BPromise(function(_0x330363,_0x95264f){return client[_0x8e4e('0xf')](_0x51bd78,_0x53f334)[_0x8e4e('0x10')](function(_0x2490b5){logger[_0x8e4e('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x18be4e,'request\x20sent');logger[_0x8e4e('0x12')](_0x8e4e('0x13'),_0x18be4e,_0x8e4e('0x14'),JSON['stringify'](_0x2490b5));if(_0x2490b5[_0x8e4e('0x15')]){if(_0x2490b5['error'][_0x8e4e('0x16')]===0x1f4){logger[_0x8e4e('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x18be4e,_0x2490b5[_0x8e4e('0x15')][_0x8e4e('0x17')]);return _0x95264f(_0x2490b5[_0x8e4e('0x15')][_0x8e4e('0x17')]);}logger['error'](_0x8e4e('0x18'),_0x18be4e,_0x2490b5[_0x8e4e('0x15')][_0x8e4e('0x17')]);return _0x330363(_0x2490b5[_0x8e4e('0x15')][_0x8e4e('0x17')]);}else{logger[_0x8e4e('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x18be4e,_0x8e4e('0x14'));_0x330363(_0x2490b5['result'][_0x8e4e('0x17')]);}})[_0x8e4e('0x19')](function(_0x2f93d5){logger[_0x8e4e('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x18be4e,_0x2f93d5);_0x95264f(_0x2f93d5);});});}exports[_0x8e4e('0x1a')]=function(_0x2c848e){var _0x23cb9f=this;return new Promise(function(_0x10bdec,_0xebce9e){return db[_0x8e4e('0x1b')]['findAll']({'raw':_0x2c848e['options']?_0x2c848e['options'][_0x8e4e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c848e[_0x8e4e('0x1d')]?_0x2c848e[_0x8e4e('0x1d')][_0x8e4e('0x1e')]||null:null,'attributes':_0x2c848e['options']?_0x2c848e['options']['attributes']||null:null,'limit':_0x2c848e['options']?_0x2c848e[_0x8e4e('0x1d')][_0x8e4e('0x1f')]||null:null,'include':_0x2c848e[_0x8e4e('0x1d')]?_0x2c848e[_0x8e4e('0x1d')][_0x8e4e('0x20')]?_[_0x8e4e('0x21')](_0x2c848e[_0x8e4e('0x1d')][_0x8e4e('0x20')],function(_0x579b0d){return{'model':db[_0x579b0d['model']],'as':_0x579b0d['as'],'attributes':_0x579b0d[_0x8e4e('0x22')],'include':_0x579b0d[_0x8e4e('0x20')]?_[_0x8e4e('0x21')](_0x579b0d[_0x8e4e('0x20')],function(_0x14f4c7){return{'model':db[_0x14f4c7[_0x8e4e('0x23')]],'as':_0x14f4c7['as'],'attributes':_0x14f4c7[_0x8e4e('0x22')],'include':_0x14f4c7[_0x8e4e('0x20')]?_[_0x8e4e('0x21')](_0x14f4c7[_0x8e4e('0x20')],function(_0x1f8eae){return{'model':db[_0x1f8eae[_0x8e4e('0x23')]],'as':_0x1f8eae['as'],'attributes':_0x1f8eae['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ae351){logger[_0x8e4e('0x11')](_0x8e4e('0x1a'),_0x2c848e);logger['debug']('GetOpenchannelQueue',_0x2c848e,JSON[_0x8e4e('0x24')](_0x5ae351));_0x10bdec(_0x5ae351);})[_0x8e4e('0x19')](function(_0x574d53){logger[_0x8e4e('0x15')](_0x8e4e('0x1a'),_0x574d53[_0x8e4e('0x17')],_0x2c848e);_0xebce9e(_0x23cb9f[_0x8e4e('0x15')](0x1f4,_0x574d53[_0x8e4e('0x17')]));});});};exports[_0x8e4e('0x25')]=function(_0x5e4ec3){var _0x59c6b0=this;return new Promise(function(_0x508486,_0x393e2c){return db['OpenchannelQueue'][_0x8e4e('0x26')]({'raw':_0x5e4ec3[_0x8e4e('0x1d')]?_0x5e4ec3[_0x8e4e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5e4ec3['options']?_0x5e4ec3['options']['where']||null:null,'attributes':_0x5e4ec3[_0x8e4e('0x1d')]?_0x5e4ec3['options'][_0x8e4e('0x22')]||null:null,'include':_0x5e4ec3[_0x8e4e('0x1d')]?_0x5e4ec3[_0x8e4e('0x1d')][_0x8e4e('0x20')]?_[_0x8e4e('0x21')](_0x5e4ec3[_0x8e4e('0x1d')]['include'],function(_0x52d135){return{'model':db[_0x52d135[_0x8e4e('0x23')]],'as':_0x52d135['as'],'attributes':_0x52d135[_0x8e4e('0x22')],'include':_0x52d135[_0x8e4e('0x20')]?_['map'](_0x52d135[_0x8e4e('0x20')],function(_0x3c6f79){return{'model':db[_0x3c6f79['model']],'as':_0x3c6f79['as'],'attributes':_0x3c6f79['attributes'],'include':_0x3c6f79[_0x8e4e('0x20')]?_[_0x8e4e('0x21')](_0x3c6f79[_0x8e4e('0x20')],function(_0x2a906b){return{'model':db[_0x2a906b['model']],'as':_0x2a906b['as'],'attributes':_0x2a906b[_0x8e4e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8e4e('0x10')](function(_0x41dbef){logger['info'](_0x8e4e('0x25'),_0x5e4ec3);logger[_0x8e4e('0x12')](_0x8e4e('0x25'),_0x5e4ec3,JSON[_0x8e4e('0x24')](_0x41dbef));_0x508486(_0x41dbef);})['catch'](function(_0x16d0e7){logger[_0x8e4e('0x15')]('ShowOpenchannelQueue',_0x16d0e7[_0x8e4e('0x17')],_0x5e4ec3);_0x393e2c(_0x59c6b0[_0x8e4e('0x15')](0x1f4,_0x16d0e7[_0x8e4e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 78d9606..2506ddd 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 _0xf096=['remove','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xf096,0x185));var _0x6f09=function(_0x5f1ccd,_0x3921cf){_0x5f1ccd=_0x5f1ccd-0x0;var _0x55db13=_0xf096[_0x5f1ccd];return _0x55db13;};'use strict';var OpenchannelQueueEvents=require(_0x6f09('0x0'));var events=['save',_0x6f09('0x1'),'update'];function createListener(_0x49cbac,_0x16ff81){return function(_0x29138c){_0x16ff81[_0x6f09('0x2')](_0x49cbac,_0x29138c);};}function removeListener(_0x13a2ad,_0x1d2bef){return function(){OpenchannelQueueEvents[_0x6f09('0x3')](_0x13a2ad,_0x1d2bef);};}exports['register']=function(_0x21f3ec){for(var _0x338dec=0x0,_0x2ba1a5=events[_0x6f09('0x4')];_0x338dec<_0x2ba1a5;_0x338dec++){var _0x9a1a52=events[_0x338dec];var _0x565ac7=createListener(_0x6f09('0x5')+_0x9a1a52,_0x21f3ec);OpenchannelQueueEvents['on'](_0x9a1a52,_0x565ac7);}}; \ No newline at end of file +var _0xa00b=['remove','update','register','length','./openchannelQueue.events'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa00b,0x1da));var _0xba00=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa00b[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelQueueEvents=require(_0xba00('0x0'));var events=['save',_0xba00('0x1'),_0xba00('0x2')];function createListener(_0x131020,_0x23a18b){return function(_0x19aa04){_0x23a18b['emit'](_0x131020,_0x19aa04);};}function removeListener(_0x1cc848,_0x3964bb){return function(){OpenchannelQueueEvents['removeListener'](_0x1cc848,_0x3964bb);};}exports[_0xba00('0x3')]=function(_0x10d62c){for(var _0x261c0d=0x0,_0x3b1129=events[_0xba00('0x4')];_0x261c0d<_0x3b1129;_0x261c0d++){var _0x1ebb8d=events[_0x261c0d];var _0x3cdd42=createListener('openchannelQueue:'+_0x1ebb8d,_0x10d62c);OpenchannelQueueEvents['on'](_0x1ebb8d,_0x3cdd42);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index dd6bf03..7801e79 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 _0x7033=['get','/describe','isAuthenticated','describe','post','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7033,0x99));var _0x3703=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7033[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require(_0x3703('0x0'));var path=require(_0x3703('0x1'));var timeout=require(_0x3703('0x2'));var express=require('express');var router=express[_0x3703('0x3')]();var fs_extra=require(_0x3703('0x4'));var auth=require(_0x3703('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3703('0x6'));var controller=require(_0x3703('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3703('0x8')]);router[_0x3703('0x9')](_0x3703('0xa'),auth[_0x3703('0xb')](),controller[_0x3703('0xc')]);router[_0x3703('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3703('0xd')]('/',auth[_0x3703('0xb')](),controller['create']);router['put'](_0x3703('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x3703('0xf')](_0x3703('0xe'),auth[_0x3703('0xb')](),controller[_0x3703('0x10')]);module[_0x3703('0x11')]=router; \ No newline at end of file +var _0xfbf7=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xfbf7,0x73));var _0x7fbf=function(_0xb9a01c,_0x3f5dab){_0xb9a01c=_0xb9a01c-0x0;var _0x3c7b03=_0xfbf7[_0xb9a01c];return _0x3c7b03;};'use strict';var multer=require(_0x7fbf('0x0'));var util=require(_0x7fbf('0x1'));var path=require(_0x7fbf('0x2'));var timeout=require('connect-timeout');var express=require(_0x7fbf('0x3'));var router=express[_0x7fbf('0x4')]();var fs_extra=require(_0x7fbf('0x5'));var auth=require(_0x7fbf('0x6'));var interaction=require(_0x7fbf('0x7'));var config=require('../../config/environment');var controller=require(_0x7fbf('0x8'));router[_0x7fbf('0x9')]('/',auth[_0x7fbf('0xa')](),controller['index']);router['get'](_0x7fbf('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7fbf('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7fbf('0xc')]);router[_0x7fbf('0xd')]('/',auth[_0x7fbf('0xa')](),controller[_0x7fbf('0xe')]);router[_0x7fbf('0xf')](_0x7fbf('0x10'),auth[_0x7fbf('0xa')](),controller[_0x7fbf('0x11')]);router[_0x7fbf('0x12')](_0x7fbf('0x10'),auth['isAuthenticated'](),controller[_0x7fbf('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index a886924..daef78e 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 _0x0a52=['moment','sequelize','STRING','DATE'];(function(_0x2de4e8,_0x3de149){var _0x261241=function(_0x33b3c4){while(--_0x33b3c4){_0x2de4e8['push'](_0x2de4e8['shift']());}};_0x261241(++_0x3de149);}(_0x0a52,0xe4));var _0x20a5=function(_0x330f4d,_0x243b9){_0x330f4d=_0x330f4d-0x0;var _0x3651e4=_0x0a52[_0x330f4d];return _0x3651e4;};'use strict';var moment=require(_0x20a5('0x0'));var Sequelize=require(_0x20a5('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x20a5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x20a5('0x2')]},'joinAt':{'type':Sequelize[_0x20a5('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x20a5('0x3')]},'exitAt':{'type':Sequelize[_0x20a5('0x3')]},'reason':{'type':Sequelize[_0x20a5('0x2')]}}; \ No newline at end of file +var _0x457e=['exports','STRING','DATE'];(function(_0x3f56a3,_0x58fa76){var _0x454509=function(_0x53561e){while(--_0x53561e){_0x3f56a3['push'](_0x3f56a3['shift']());}};_0x454509(++_0x58fa76);}(_0x457e,0x15f));var _0xe457=function(_0x4872f1,_0x5596c1){_0x4872f1=_0x4872f1-0x0;var _0x894531=_0x457e[_0x4872f1];return _0x894531;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe457('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe457('0x1')]},'joinAt':{'type':Sequelize[_0xe457('0x2')]},'leaveAt':{'type':Sequelize[_0xe457('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe457('0x2')]},'reason':{'type':Sequelize[_0xe457('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 493a37c..897a232 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 _0x1931=['fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','save','update','then','end','error','name','send','index','map','OpenchannelQueueReport','rawAttributes'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x1931,0x191));var _0x1193=function(_0x10510c,_0x42fcc2){_0x10510c=_0x10510c-0x0;var _0x1c3273=_0x1931[_0x10510c];return _0x1c3273;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1193('0x0'));var zipdir=require(_0x1193('0x1'));var jsonpatch=require(_0x1193('0x2'));var rp=require(_0x1193('0x3'));var moment=require('moment');var BPromise=require(_0x1193('0x4'));var Mustache=require(_0x1193('0x5'));var util=require(_0x1193('0x6'));var path=require(_0x1193('0x7'));var sox=require(_0x1193('0x8'));var csv=require(_0x1193('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1193('0xa'));var squel=require(_0x1193('0xb'));var crypto=require(_0x1193('0xc'));var jsforce=require(_0x1193('0xd'));var deskjs=require(_0x1193('0xe'));var toCsv=require(_0x1193('0x9'));var querystring=require('querystring');var Papa=require(_0x1193('0xf'));var Redis=require(_0x1193('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1193('0x11'));var as=require(_0x1193('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1193('0x13'))(_0x1193('0x14'));var utils=require(_0x1193('0x15'));var config=require(_0x1193('0x16'));var licenseUtil=require(_0x1193('0x17'));var db=require(_0x1193('0x18'))['db'];function respondWithStatusCode(_0x12aff5,_0x218d80){_0x218d80=_0x218d80||0xcc;return function(_0xa4b78b){if(_0xa4b78b){return _0x12aff5[_0x1193('0x19')](_0x218d80);}return _0x12aff5[_0x1193('0x1a')](_0x218d80)['end']();};}function respondWithResult(_0x4a63f3,_0x31c0fa){_0x31c0fa=_0x31c0fa||0xc8;return function(_0x7197f9){if(_0x7197f9){return _0x4a63f3[_0x1193('0x1a')](_0x31c0fa)['json'](_0x7197f9);}};}function respondWithFilteredResult(_0x591354,_0x1a4a51){return function(_0x2b1299){if(_0x2b1299){var _0x18e862=typeof _0x1a4a51[_0x1193('0x1b')]===_0x1193('0x1c')&&typeof _0x1a4a51[_0x1193('0x1d')]===_0x1193('0x1c');var _0x3ac11c=_0x2b1299[_0x1193('0x1e')];var _0x56ce6b=_0x18e862?0x0:_0x1a4a51[_0x1193('0x1b')];var _0xf7c7ea=_0x18e862?_0x2b1299[_0x1193('0x1e')]:_0x1a4a51[_0x1193('0x1b')]+_0x1a4a51['limit'];var _0x2586b1;if(_0xf7c7ea>=_0x3ac11c){_0xf7c7ea=_0x3ac11c;_0x2586b1=0xc8;}else{_0x2586b1=0xce;}_0x591354[_0x1193('0x1a')](_0x2586b1);return _0x591354['set']('Content-Range',_0x56ce6b+'-'+_0xf7c7ea+'/'+_0x3ac11c)[_0x1193('0x1f')](_0x2b1299);}return null;};}function patchUpdates(_0x25416d){return function(_0x179ec9){try{jsonpatch['apply'](_0x179ec9,_0x25416d,!![]);}catch(_0x1b3f71){return BPromise['reject'](_0x1b3f71);}return _0x179ec9[_0x1193('0x20')]();};}function saveUpdates(_0x254241,_0x4b95a7){return function(_0xd068a6){if(_0xd068a6){return _0xd068a6[_0x1193('0x21')](_0x254241)[_0x1193('0x22')](function(_0x213003){return _0x213003;});}return null;};}function removeEntity(_0x428ea4,_0x2921d4){return function(_0x3755e2){if(_0x3755e2){return _0x3755e2['destroy']()['then'](function(){_0x428ea4[_0x1193('0x1a')](0xcc)[_0x1193('0x23')]();});}};}function handleEntityNotFound(_0x487933,_0x4b2dc8){return function(_0x7419fb){if(!_0x7419fb){_0x487933[_0x1193('0x19')](0x194);}return _0x7419fb;};}function handleError(_0x24f3fc,_0x296b79){_0x296b79=_0x296b79||0x1f4;return function(_0x13c4aa){logger[_0x1193('0x24')](_0x13c4aa['stack']);if(_0x13c4aa['name']){delete _0x13c4aa[_0x1193('0x25')];}_0x24f3fc[_0x1193('0x1a')](_0x296b79)[_0x1193('0x26')](_0x13c4aa);};}exports[_0x1193('0x27')]=function(_0x2fa241,_0x1817c0){var _0x6fdcd5={},_0x31b4e5={},_0x51aec3={'count':0x0,'rows':[]};var _0x20f9ce=_[_0x1193('0x28')](db[_0x1193('0x29')][_0x1193('0x2a')],function(_0x4639b5){return{'name':_0x4639b5[_0x1193('0x2b')],'type':_0x4639b5[_0x1193('0x2c')][_0x1193('0x2d')]};});_0x31b4e5['model']=_[_0x1193('0x28')](_0x20f9ce,_0x1193('0x25'));_0x31b4e5[_0x1193('0x2e')]=_[_0x1193('0x2f')](_0x2fa241[_0x1193('0x2e')]);_0x31b4e5['filters']=_[_0x1193('0x30')](_0x31b4e5[_0x1193('0x31')],_0x31b4e5[_0x1193('0x2e')]);_0x6fdcd5[_0x1193('0x32')]=_['intersection'](_0x31b4e5[_0x1193('0x31')],qs['fields'](_0x2fa241['query'][_0x1193('0x33')]));_0x6fdcd5['attributes']=_0x6fdcd5[_0x1193('0x32')][_0x1193('0x34')]?_0x6fdcd5[_0x1193('0x32')]:_0x31b4e5[_0x1193('0x31')];if(!_0x2fa241[_0x1193('0x2e')][_0x1193('0x35')](_0x1193('0x36'))){_0x6fdcd5[_0x1193('0x1d')]=qs[_0x1193('0x1d')](_0x2fa241['query']['limit']);_0x6fdcd5[_0x1193('0x1b')]=qs['offset'](_0x2fa241[_0x1193('0x2e')][_0x1193('0x1b')]);}_0x6fdcd5[_0x1193('0x37')]=qs[_0x1193('0x38')](_0x2fa241[_0x1193('0x2e')][_0x1193('0x38')]);_0x6fdcd5['where']=qs[_0x1193('0x39')](_[_0x1193('0x3a')](_0x2fa241[_0x1193('0x2e')],_0x31b4e5[_0x1193('0x39')]),_0x20f9ce);if(_0x2fa241[_0x1193('0x2e')][_0x1193('0x3b')]){_0x6fdcd5['where']=_[_0x1193('0x3c')](_0x6fdcd5['where'],{'$or':_[_0x1193('0x28')](_0x20f9ce,function(_0x4593c1){if(_0x4593c1[_0x1193('0x2c')]!==_0x1193('0x3d')){var _0x1f5834={};_0x1f5834[_0x4593c1['name']]={'$like':'%'+_0x2fa241[_0x1193('0x2e')][_0x1193('0x3b')]+'%'};return _0x1f5834;}})});}_0x6fdcd5=_['merge']({},_0x6fdcd5,_0x2fa241[_0x1193('0x3e')]);var _0x569398={'where':_0x6fdcd5['where']};return db['OpenchannelQueueReport']['count'](_0x569398)[_0x1193('0x22')](function(_0x13de0b){_0x51aec3[_0x1193('0x1e')]=_0x13de0b;if(_0x2fa241[_0x1193('0x2e')][_0x1193('0x3f')]){_0x6fdcd5[_0x1193('0x40')]=[{'all':!![]}];}return db[_0x1193('0x29')][_0x1193('0x41')](_0x6fdcd5);})[_0x1193('0x22')](function(_0x12911b){_0x51aec3[_0x1193('0x42')]=_0x12911b;return _0x51aec3;})[_0x1193('0x22')](respondWithFilteredResult(_0x1817c0,_0x6fdcd5))[_0x1193('0x43')](handleError(_0x1817c0,null));};exports['show']=function(_0x2159e6,_0x42b5fe){var _0x230b9b={'raw':!![],'where':{'id':_0x2159e6[_0x1193('0x44')]['id']}},_0x3f3caa={};_0x3f3caa[_0x1193('0x31')]=_[_0x1193('0x2f')](db[_0x1193('0x29')][_0x1193('0x2a')]);_0x3f3caa[_0x1193('0x2e')]=_[_0x1193('0x2f')](_0x2159e6[_0x1193('0x2e')]);_0x3f3caa[_0x1193('0x39')]=_[_0x1193('0x30')](_0x3f3caa[_0x1193('0x31')],_0x3f3caa[_0x1193('0x2e')]);_0x230b9b[_0x1193('0x32')]=_[_0x1193('0x30')](_0x3f3caa[_0x1193('0x31')],qs[_0x1193('0x33')](_0x2159e6[_0x1193('0x2e')][_0x1193('0x33')]));_0x230b9b[_0x1193('0x32')]=_0x230b9b['attributes'][_0x1193('0x34')]?_0x230b9b[_0x1193('0x32')]:_0x3f3caa[_0x1193('0x31')];if(_0x2159e6[_0x1193('0x2e')]['includeAll']){_0x230b9b[_0x1193('0x40')]=[{'all':!![]}];}_0x230b9b=_[_0x1193('0x3c')]({},_0x230b9b,_0x2159e6[_0x1193('0x3e')]);return db['OpenchannelQueueReport'][_0x1193('0x45')](_0x230b9b)['then'](handleEntityNotFound(_0x42b5fe,null))[_0x1193('0x22')](respondWithResult(_0x42b5fe,null))[_0x1193('0x43')](handleError(_0x42b5fe,null));};exports[_0x1193('0x46')]=function(_0x269bb3,_0xd91674){return db['OpenchannelQueueReport'][_0x1193('0x46')](_0x269bb3[_0x1193('0x47')],{})[_0x1193('0x22')](respondWithResult(_0xd91674,0xc9))[_0x1193('0x43')](handleError(_0xd91674,null));};exports[_0x1193('0x21')]=function(_0x433cc3,_0x570b4e){if(_0x433cc3[_0x1193('0x47')]['id']){delete _0x433cc3[_0x1193('0x47')]['id'];}return db[_0x1193('0x29')][_0x1193('0x45')]({'where':{'id':_0x433cc3['params']['id']}})[_0x1193('0x22')](handleEntityNotFound(_0x570b4e,null))[_0x1193('0x22')](saveUpdates(_0x433cc3[_0x1193('0x47')],null))[_0x1193('0x22')](respondWithResult(_0x570b4e,null))[_0x1193('0x43')](handleError(_0x570b4e,null));};exports[_0x1193('0x48')]=function(_0x58385f,_0x1e3fc7){return db[_0x1193('0x29')]['find']({'where':{'id':_0x58385f[_0x1193('0x44')]['id']}})[_0x1193('0x22')](handleEntityNotFound(_0x1e3fc7,null))['then'](removeEntity(_0x1e3fc7,null))[_0x1193('0x43')](handleError(_0x1e3fc7,null));};exports[_0x1193('0x49')]=function(_0x556e58,_0x5a77e5){return db[_0x1193('0x29')][_0x1193('0x49')]()['then'](respondWithResult(_0x5a77e5,null))[_0x1193('0x43')](handleError(_0x5a77e5,null));}; \ No newline at end of file +var _0x5f3d=['destroy','params','eml-format','fast-json-patch','moment','bluebird','mustache','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','../../config/license/util','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','end','sendStatus','error','stack','name','map','OpenchannelQueueReport','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','find','create','body'];(function(_0x6f50b5,_0x2655cd){var _0x1cf2da=function(_0x27414f){while(--_0x27414f){_0x6f50b5['push'](_0x6f50b5['shift']());}};_0x1cf2da(++_0x2655cd);}(_0x5f3d,0x16a));var _0xd5f3=function(_0x3da528,_0x5b5755){_0x3da528=_0x3da528-0x0;var _0x15f838=_0x5f3d[_0x3da528];return _0x15f838;};'use strict';var emlformat=require(_0xd5f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd5f3('0x1'));var rp=require('request-promise');var moment=require(_0xd5f3('0x2'));var BPromise=require(_0xd5f3('0x3'));var Mustache=require(_0xd5f3('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd5f3('0x5'));var csv=require(_0xd5f3('0x6'));var ejs=require(_0xd5f3('0x7'));var fs=require('fs');var fs_extra=require(_0xd5f3('0x8'));var _=require(_0xd5f3('0x9'));var squel=require('squel');var crypto=require(_0xd5f3('0xa'));var jsforce=require(_0xd5f3('0xb'));var deskjs=require(_0xd5f3('0xc'));var toCsv=require(_0xd5f3('0x6'));var querystring=require(_0xd5f3('0xd'));var Papa=require(_0xd5f3('0xe'));var Redis=require(_0xd5f3('0xf'));var authService=require(_0xd5f3('0x10'));var qs=require(_0xd5f3('0x11'));var as=require(_0xd5f3('0x12'));var hardwareService=require(_0xd5f3('0x13'));var logger=require(_0xd5f3('0x14'))(_0xd5f3('0x15'));var utils=require('../../config/utils');var config=require(_0xd5f3('0x16'));var licenseUtil=require(_0xd5f3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f86b1,_0x40a62c){_0x40a62c=_0x40a62c||0xcc;return function(_0x3d1c48){if(_0x3d1c48){return _0x1f86b1['sendStatus'](_0x40a62c);}return _0x1f86b1['status'](_0x40a62c)['end']();};}function respondWithResult(_0x538681,_0x301b3c){_0x301b3c=_0x301b3c||0xc8;return function(_0x14bbc2){if(_0x14bbc2){return _0x538681[_0xd5f3('0x18')](_0x301b3c)[_0xd5f3('0x19')](_0x14bbc2);}};}function respondWithFilteredResult(_0x41fd63,_0x8e4c92){return function(_0x528809){if(_0x528809){var _0x3eb847=typeof _0x8e4c92['offset']===_0xd5f3('0x1a')&&typeof _0x8e4c92['limit']===_0xd5f3('0x1a');var _0x46e02e=_0x528809[_0xd5f3('0x1b')];var _0x48366c=_0x3eb847?0x0:_0x8e4c92[_0xd5f3('0x1c')];var _0x142531=_0x3eb847?_0x528809['count']:_0x8e4c92['offset']+_0x8e4c92[_0xd5f3('0x1d')];var _0x2ab435;if(_0x142531>=_0x46e02e){_0x142531=_0x46e02e;_0x2ab435=0xc8;}else{_0x2ab435=0xce;}_0x41fd63[_0xd5f3('0x18')](_0x2ab435);return _0x41fd63[_0xd5f3('0x1e')](_0xd5f3('0x1f'),_0x48366c+'-'+_0x142531+'/'+_0x46e02e)['json'](_0x528809);}return null;};}function patchUpdates(_0x5242ee){return function(_0x1747f3){try{jsonpatch['apply'](_0x1747f3,_0x5242ee,!![]);}catch(_0x12e6f6){return BPromise[_0xd5f3('0x20')](_0x12e6f6);}return _0x1747f3[_0xd5f3('0x21')]();};}function saveUpdates(_0x3f034b,_0x4e2c73){return function(_0x5ba50c){if(_0x5ba50c){return _0x5ba50c[_0xd5f3('0x22')](_0x3f034b)['then'](function(_0xc722c3){return _0xc722c3;});}return null;};}function removeEntity(_0x706e01,_0x12ee48){return function(_0xc2c926){if(_0xc2c926){return _0xc2c926['destroy']()['then'](function(){_0x706e01['status'](0xcc)[_0xd5f3('0x23')]();});}};}function handleEntityNotFound(_0xcda129,_0x40c609){return function(_0x436ec5){if(!_0x436ec5){_0xcda129[_0xd5f3('0x24')](0x194);}return _0x436ec5;};}function handleError(_0x44c247,_0x4995a0){_0x4995a0=_0x4995a0||0x1f4;return function(_0x3c9797){logger[_0xd5f3('0x25')](_0x3c9797[_0xd5f3('0x26')]);if(_0x3c9797[_0xd5f3('0x27')]){delete _0x3c9797['name'];}_0x44c247[_0xd5f3('0x18')](_0x4995a0)['send'](_0x3c9797);};}exports['index']=function(_0x8692a5,_0x44d80a){var _0x1ebed2={},_0x27cdd0={},_0xc124ed={'count':0x0,'rows':[]};var _0x3c4dc2=_[_0xd5f3('0x28')](db[_0xd5f3('0x29')][_0xd5f3('0x2a')],function(_0x8b0712){return{'name':_0x8b0712['fieldName'],'type':_0x8b0712[_0xd5f3('0x2b')][_0xd5f3('0x2c')]};});_0x27cdd0['model']=_[_0xd5f3('0x28')](_0x3c4dc2,'name');_0x27cdd0['query']=_[_0xd5f3('0x2d')](_0x8692a5[_0xd5f3('0x2e')]);_0x27cdd0[_0xd5f3('0x2f')]=_[_0xd5f3('0x30')](_0x27cdd0[_0xd5f3('0x31')],_0x27cdd0[_0xd5f3('0x2e')]);_0x1ebed2[_0xd5f3('0x32')]=_[_0xd5f3('0x30')](_0x27cdd0[_0xd5f3('0x31')],qs[_0xd5f3('0x33')](_0x8692a5[_0xd5f3('0x2e')][_0xd5f3('0x33')]));_0x1ebed2[_0xd5f3('0x32')]=_0x1ebed2['attributes'][_0xd5f3('0x34')]?_0x1ebed2[_0xd5f3('0x32')]:_0x27cdd0['model'];if(!_0x8692a5[_0xd5f3('0x2e')]['hasOwnProperty'](_0xd5f3('0x35'))){_0x1ebed2['limit']=qs[_0xd5f3('0x1d')](_0x8692a5[_0xd5f3('0x2e')][_0xd5f3('0x1d')]);_0x1ebed2[_0xd5f3('0x1c')]=qs['offset'](_0x8692a5['query']['offset']);}_0x1ebed2[_0xd5f3('0x36')]=qs[_0xd5f3('0x37')](_0x8692a5[_0xd5f3('0x2e')][_0xd5f3('0x37')]);_0x1ebed2[_0xd5f3('0x38')]=qs['filters'](_[_0xd5f3('0x39')](_0x8692a5[_0xd5f3('0x2e')],_0x27cdd0['filters']),_0x3c4dc2);if(_0x8692a5['query']['filter']){_0x1ebed2[_0xd5f3('0x38')]=_[_0xd5f3('0x3a')](_0x1ebed2[_0xd5f3('0x38')],{'$or':_[_0xd5f3('0x28')](_0x3c4dc2,function(_0x4d033a){if(_0x4d033a['type']!==_0xd5f3('0x3b')){var _0x2fac3f={};_0x2fac3f[_0x4d033a[_0xd5f3('0x27')]]={'$like':'%'+_0x8692a5['query']['filter']+'%'};return _0x2fac3f;}})});}_0x1ebed2=_[_0xd5f3('0x3a')]({},_0x1ebed2,_0x8692a5[_0xd5f3('0x3c')]);var _0x1abe43={'where':_0x1ebed2[_0xd5f3('0x38')]};return db['OpenchannelQueueReport'][_0xd5f3('0x1b')](_0x1abe43)[_0xd5f3('0x3d')](function(_0x424da){_0xc124ed['count']=_0x424da;if(_0x8692a5[_0xd5f3('0x2e')][_0xd5f3('0x3e')]){_0x1ebed2[_0xd5f3('0x3f')]=[{'all':!![]}];}return db[_0xd5f3('0x29')][_0xd5f3('0x40')](_0x1ebed2);})[_0xd5f3('0x3d')](function(_0x2c7bd1){_0xc124ed[_0xd5f3('0x41')]=_0x2c7bd1;return _0xc124ed;})[_0xd5f3('0x3d')](respondWithFilteredResult(_0x44d80a,_0x1ebed2))[_0xd5f3('0x42')](handleError(_0x44d80a,null));};exports['show']=function(_0x42a183,_0x4bee60){var _0x29253e={'raw':!![],'where':{'id':_0x42a183['params']['id']}},_0x1dedb6={};_0x1dedb6['model']=_['keys'](db[_0xd5f3('0x29')]['rawAttributes']);_0x1dedb6[_0xd5f3('0x2e')]=_[_0xd5f3('0x2d')](_0x42a183[_0xd5f3('0x2e')]);_0x1dedb6[_0xd5f3('0x2f')]=_[_0xd5f3('0x30')](_0x1dedb6[_0xd5f3('0x31')],_0x1dedb6[_0xd5f3('0x2e')]);_0x29253e[_0xd5f3('0x32')]=_[_0xd5f3('0x30')](_0x1dedb6['model'],qs[_0xd5f3('0x33')](_0x42a183[_0xd5f3('0x2e')]['fields']));_0x29253e[_0xd5f3('0x32')]=_0x29253e[_0xd5f3('0x32')][_0xd5f3('0x34')]?_0x29253e[_0xd5f3('0x32')]:_0x1dedb6[_0xd5f3('0x31')];if(_0x42a183[_0xd5f3('0x2e')][_0xd5f3('0x3e')]){_0x29253e[_0xd5f3('0x3f')]=[{'all':!![]}];}_0x29253e=_['merge']({},_0x29253e,_0x42a183[_0xd5f3('0x3c')]);return db[_0xd5f3('0x29')][_0xd5f3('0x43')](_0x29253e)[_0xd5f3('0x3d')](handleEntityNotFound(_0x4bee60,null))[_0xd5f3('0x3d')](respondWithResult(_0x4bee60,null))[_0xd5f3('0x42')](handleError(_0x4bee60,null));};exports[_0xd5f3('0x44')]=function(_0x36702c,_0x575ce6){return db[_0xd5f3('0x29')][_0xd5f3('0x44')](_0x36702c['body'],{})[_0xd5f3('0x3d')](respondWithResult(_0x575ce6,0xc9))[_0xd5f3('0x42')](handleError(_0x575ce6,null));};exports['update']=function(_0x1edcae,_0x323d8){if(_0x1edcae[_0xd5f3('0x45')]['id']){delete _0x1edcae[_0xd5f3('0x45')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x1edcae['params']['id']}})['then'](handleEntityNotFound(_0x323d8,null))[_0xd5f3('0x3d')](saveUpdates(_0x1edcae['body'],null))['then'](respondWithResult(_0x323d8,null))['catch'](handleError(_0x323d8,null));};exports[_0xd5f3('0x46')]=function(_0x57b13b,_0x214990){return db[_0xd5f3('0x29')][_0xd5f3('0x43')]({'where':{'id':_0x57b13b[_0xd5f3('0x47')]['id']}})[_0xd5f3('0x3d')](handleEntityNotFound(_0x214990,null))[_0xd5f3('0x3d')](removeEntity(_0x214990,null))[_0xd5f3('0x42')](handleError(_0x214990,null));};exports['describe']=function(_0x246ebc,_0x5ed084){return db['OpenchannelQueueReport']['describe']()[_0xd5f3('0x3d')](respondWithResult(_0x5ed084,null))['catch'](handleError(_0x5ed084,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 53b52a3..ab660f6 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x338950,_0x893967){var _0x2575fd=function(_0x4baea3){while(--_0x4baea3){_0x338950['push'](_0x338950['shift']());}};_0x2575fd(++_0x893967);}(_0x1261,0x144));var _0x1126=function(_0x5a42d9,_0x2d397e){_0x5a42d9=_0x5a42d9-0x0;var _0x190cf2=_0x1261[_0x5a42d9];return _0x190cf2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x2a4a0e,_0xba3cc9){var _0x505ed0=function(_0x9b6d9a){while(--_0x9b6d9a){_0x2a4a0e['push'](_0x2a4a0e['shift']());}};_0x505ed0(++_0xba3cc9);}(_0x326f,0xd1));var _0xf326=function(_0x1e171b,_0x340891){_0x1e171b=_0x1e171b-0x0;var _0xdcfe84=_0x326f[_0x1e171b];return _0xdcfe84;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'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 fe21fd3..b7fb747 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 _0xaa64=['attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where'];(function(_0x3f5ec2,_0xcbefc6){var _0xea24c2=function(_0x1b686c){while(--_0x1b686c){_0x3f5ec2['push'](_0x3f5ec2['shift']());}};_0xea24c2(++_0xcbefc6);}(_0xaa64,0xf7));var _0x4aa6=function(_0xdc009e,_0x10b501){_0xdc009e=_0xdc009e-0x0;var _0x499d0f=_0xaa64[_0xdc009e];return _0x499d0f;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var moment=require('moment');var BPromise=require(_0x4aa6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4aa6('0x3'));var db=require(_0x4aa6('0x4'))['db'];var utils=require(_0x4aa6('0x5'));var logger=require('../../config/logger')(_0x4aa6('0x6'));var config=require(_0x4aa6('0x7'));var jayson=require(_0x4aa6('0x8'));var client=jayson[_0x4aa6('0x9')][_0x4aa6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7dd83d,_0x39c4b5,_0x49e174){return new BPromise(function(_0x529c89,_0xee21ba){return client[_0x4aa6('0xb')](_0x7dd83d,_0x49e174)['then'](function(_0x26619c){logger['info'](_0x4aa6('0xc'),_0x39c4b5,_0x4aa6('0xd'));logger[_0x4aa6('0xe')](_0x4aa6('0xf'),_0x39c4b5,'request\x20sent',JSON[_0x4aa6('0x10')](_0x26619c));if(_0x26619c[_0x4aa6('0x11')]){if(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x12')]===0x1f4){logger[_0x4aa6('0x11')](_0x4aa6('0xc'),_0x39c4b5,_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);return _0xee21ba(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);}logger['error'](_0x4aa6('0xc'),_0x39c4b5,_0x26619c['error']['message']);return _0x529c89(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);}else{logger[_0x4aa6('0x14')](_0x4aa6('0xc'),_0x39c4b5,_0x4aa6('0xd'));_0x529c89(_0x26619c[_0x4aa6('0x15')][_0x4aa6('0x13')]);}})[_0x4aa6('0x16')](function(_0x530ed0){logger[_0x4aa6('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39c4b5,_0x530ed0);_0xee21ba(_0x530ed0);});});}exports[_0x4aa6('0x17')]=function(_0x5c6d3c){var _0x54a6d8=this;return new Promise(function(_0x266707,_0x15f5e6){return db[_0x4aa6('0x18')][_0x4aa6('0x19')](_0x5c6d3c[_0x4aa6('0x1a')],{'raw':_0x5c6d3c[_0x4aa6('0x1b')]?_0x5c6d3c[_0x4aa6('0x1b')][_0x4aa6('0x1c')]===undefined?!![]:![]:!![]})[_0x4aa6('0x1d')](function(_0x4c9159){logger[_0x4aa6('0x14')](_0x4aa6('0x17'),_0x5c6d3c);logger[_0x4aa6('0xe')](_0x4aa6('0x17'),_0x5c6d3c,JSON[_0x4aa6('0x10')](_0x4c9159));_0x266707(_0x4c9159);})[_0x4aa6('0x16')](function(_0x594665){logger[_0x4aa6('0x11')](_0x4aa6('0x17'),_0x594665[_0x4aa6('0x13')],_0x5c6d3c);_0x15f5e6(_0x54a6d8[_0x4aa6('0x11')](0x1f4,_0x594665[_0x4aa6('0x13')]));});});};exports[_0x4aa6('0x1e')]=function(_0x568a5c){var _0x2f4943=this;return new Promise(function(_0x91373f,_0x47b285){return db['OpenchannelQueueReport'][_0x4aa6('0x1f')](_0x568a5c[_0x4aa6('0x1a')],{'raw':_0x568a5c[_0x4aa6('0x1b')]?_0x568a5c[_0x4aa6('0x1b')][_0x4aa6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568a5c['options']?_0x568a5c[_0x4aa6('0x1b')][_0x4aa6('0x20')]||null:null,'attributes':_0x568a5c[_0x4aa6('0x1b')]?_0x568a5c[_0x4aa6('0x1b')][_0x4aa6('0x21')]||null:null,'limit':_0x568a5c[_0x4aa6('0x1b')]?_0x568a5c['options'][_0x4aa6('0x22')]||null:null})[_0x4aa6('0x1d')](function(_0x5bc756){logger[_0x4aa6('0x14')](_0x4aa6('0x1e'),_0x568a5c);logger[_0x4aa6('0xe')](_0x4aa6('0x1e'),_0x568a5c,JSON['stringify'](_0x5bc756));_0x91373f(_0x5bc756);})[_0x4aa6('0x16')](function(_0x625df8){logger[_0x4aa6('0x11')]('UpdateOpenchannelQueueReport',_0x625df8[_0x4aa6('0x13')],_0x568a5c);_0x47b285(_0x2f4943[_0x4aa6('0x11')](0x1f4,_0x625df8[_0x4aa6('0x13')]));});});}; \ No newline at end of file +var _0x1eba=['jayson/promise','client','http','then','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','catch','UpdateOpenchannelQueueReport','update','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397000,_0x150728){var _0x1c4592=function(_0x28b4af){while(--_0x28b4af){_0x397000['push'](_0x397000['shift']());}};_0x1c4592(++_0x150728);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x1eba[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});}exports[_0xa1eb('0x15')]=function(_0x33c4e3){var _0x1a5d2c=this;return new Promise(function(_0x49bfaa,_0x1dd621){return db[_0xa1eb('0x16')][_0xa1eb('0x17')](_0x33c4e3[_0xa1eb('0x18')],{'raw':_0x33c4e3[_0xa1eb('0x19')]?_0x33c4e3[_0xa1eb('0x19')][_0xa1eb('0x1a')]===undefined?!![]:![]:!![]})[_0xa1eb('0xc')](function(_0x4fc14a){logger[_0xa1eb('0xd')]('CreateOpenchannelQueueReport',_0x33c4e3);logger[_0xa1eb('0x1b')](_0xa1eb('0x15'),_0x33c4e3,JSON[_0xa1eb('0x10')](_0x4fc14a));_0x49bfaa(_0x4fc14a);})[_0xa1eb('0x1c')](function(_0x5e7a34){logger['error'](_0xa1eb('0x15'),_0x5e7a34[_0xa1eb('0x13')],_0x33c4e3);_0x1dd621(_0x1a5d2c['error'](0x1f4,_0x5e7a34[_0xa1eb('0x13')]));});});};exports[_0xa1eb('0x1d')]=function(_0x258d3a){var _0xa6b20c=this;return new Promise(function(_0x23b49e,_0x1c59e1){return db[_0xa1eb('0x16')][_0xa1eb('0x1e')](_0x258d3a[_0xa1eb('0x18')],{'raw':_0x258d3a[_0xa1eb('0x19')]?_0x258d3a[_0xa1eb('0x19')][_0xa1eb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258d3a['options']?_0x258d3a[_0xa1eb('0x19')][_0xa1eb('0x1f')]||null:null,'attributes':_0x258d3a['options']?_0x258d3a[_0xa1eb('0x19')]['attributes']||null:null,'limit':_0x258d3a[_0xa1eb('0x19')]?_0x258d3a[_0xa1eb('0x19')]['limit']||null:null})[_0xa1eb('0xc')](function(_0x1581ee){logger[_0xa1eb('0xd')]('UpdateOpenchannelQueueReport',_0x258d3a);logger[_0xa1eb('0x1b')](_0xa1eb('0x1d'),_0x258d3a,JSON['stringify'](_0x1581ee));_0x23b49e(_0x1581ee);})[_0xa1eb('0x1c')](function(_0xb27bf9){logger[_0xa1eb('0x11')](_0xa1eb('0x1d'),_0xb27bf9[_0xa1eb('0x13')],_0x258d3a);_0x1c59e1(_0xa6b20c['error'](0x1f4,_0xb27bf9[_0xa1eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 73256c9..41a72af 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 _0x73dc=['create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','show','post'];(function(_0x5ef600,_0x1b3b37){var _0x219643=function(_0x2f043b){while(--_0x2f043b){_0x5ef600['push'](_0x5ef600['shift']());}};_0x219643(++_0x1b3b37);}(_0x73dc,0x117));var _0xc73d=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x73dc[_0x2aee2f];return _0x19337f;};'use strict';var multer=require(_0xc73d('0x0'));var util=require(_0xc73d('0x1'));var path=require(_0xc73d('0x2'));var timeout=require(_0xc73d('0x3'));var express=require(_0xc73d('0x4'));var router=express[_0xc73d('0x5')]();var fs_extra=require(_0xc73d('0x6'));var auth=require(_0xc73d('0x7'));var interaction=require(_0xc73d('0x8'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xc73d('0x9')](),controller[_0xc73d('0xa')]);router[_0xc73d('0xb')](_0xc73d('0xc'),auth[_0xc73d('0x9')](),controller['describe']);router[_0xc73d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc73d('0xd')]);router[_0xc73d('0xe')]('/',auth['isAuthenticated'](),controller[_0xc73d('0xf')]);router['put'](_0xc73d('0x10'),auth[_0xc73d('0x9')](),controller[_0xc73d('0x11')]);router[_0xc73d('0x12')](_0xc73d('0x10'),auth['isAuthenticated'](),controller[_0xc73d('0x13')]);module[_0xc73d('0x14')]=router; \ No newline at end of file +var _0x876b=['delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x696adb,_0x309ac9){var _0xa20c19=function(_0x1f03d2){while(--_0x1f03d2){_0x696adb['push'](_0x696adb['shift']());}};_0xa20c19(++_0x309ac9);}(_0x876b,0x1ac));var _0xb876=function(_0x45d293,_0x45458b){_0x45d293=_0x45d293-0x0;var _0x3d0d57=_0x876b[_0x45d293];return _0x3d0d57;};'use strict';var multer=require(_0xb876('0x0'));var util=require(_0xb876('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb876('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb876('0x3'));var interaction=require(_0xb876('0x4'));var config=require('../../config/environment');var controller=require(_0xb876('0x5'));router['get']('/',auth[_0xb876('0x6')](),controller[_0xb876('0x7')]);router[_0xb876('0x8')](_0xb876('0x9'),auth[_0xb876('0x6')](),controller['describe']);router['get'](_0xb876('0xa'),auth[_0xb876('0x6')](),controller[_0xb876('0xb')]);router['post']('/',auth[_0xb876('0x6')](),controller[_0xb876('0xc')]);router[_0xb876('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb876('0xe')](_0xb876('0xa'),auth[_0xb876('0x6')](),controller[_0xb876('0xf')]);module[_0xb876('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ed6274d..c3ecc6d 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x116b94,_0x35f48f){var _0x2a9f2d=function(_0x3fadc3){while(--_0x3fadc3){_0x116b94['push'](_0x116b94['shift']());}};_0x2a9f2d(++_0x35f48f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xae9024,_0x17f58e){_0xae9024=_0xae9024-0x0;var _0x23e7d3=_0xf3cd[_0xae9024];return _0x23e7d3;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x29cf0a,_0x59b641){var _0x1913cd=function(_0x43ca5c){while(--_0x43ca5c){_0x29cf0a['push'](_0x29cf0a['shift']());}};_0x1913cd(++_0x59b641);}(_0xe706,0xa3));var _0x6e70=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0xe706[_0xa9eaa0];return _0x30897a;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b07798a..517845d 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 _0x7522=['to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','offset','count','limit','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x535230,_0x47e557){var _0x2dfe8b=function(_0x56cb48){while(--_0x56cb48){_0x535230['push'](_0x535230['shift']());}};_0x2dfe8b(++_0x47e557);}(_0x7522,0x1b3));var _0x2752=function(_0x53f98a,_0x43c442){_0x53f98a=_0x53f98a-0x0;var _0x1171ab=_0x7522[_0x53f98a];return _0x1171ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2752('0x0'));var zipdir=require(_0x2752('0x1'));var jsonpatch=require(_0x2752('0x2'));var rp=require(_0x2752('0x3'));var moment=require(_0x2752('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2752('0x5'));var util=require(_0x2752('0x6'));var path=require(_0x2752('0x7'));var sox=require(_0x2752('0x8'));var csv=require(_0x2752('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2752('0xa'));var crypto=require(_0x2752('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2752('0xc'));var toCsv=require(_0x2752('0x9'));var querystring=require(_0x2752('0xd'));var Papa=require(_0x2752('0xe'));var Redis=require(_0x2752('0xf'));var authService=require(_0x2752('0x10'));var qs=require(_0x2752('0x11'));var as=require(_0x2752('0x12'));var hardwareService=require(_0x2752('0x13'));var logger=require(_0x2752('0x14'))('api');var utils=require(_0x2752('0x15'));var config=require(_0x2752('0x16'));var licenseUtil=require(_0x2752('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ee1fa,_0x510acf){_0x510acf=_0x510acf||0xcc;return function(_0x22ea8d){if(_0x22ea8d){return _0x4ee1fa['sendStatus'](_0x510acf);}return _0x4ee1fa[_0x2752('0x18')](_0x510acf)['end']();};}function respondWithResult(_0x26f515,_0x155983){_0x155983=_0x155983||0xc8;return function(_0x2ffae4){if(_0x2ffae4){return _0x26f515['status'](_0x155983)[_0x2752('0x19')](_0x2ffae4);}};}function respondWithFilteredResult(_0x780016,_0x5b3c84){return function(_0x2a26e4){if(_0x2a26e4){var _0x449c58=typeof _0x5b3c84['offset']===_0x2752('0x1a')&&typeof _0x5b3c84['limit']==='undefined';var _0x47fdfb=_0x2a26e4['count'];var _0x4c1397=_0x449c58?0x0:_0x5b3c84[_0x2752('0x1b')];var _0x2a7407=_0x449c58?_0x2a26e4[_0x2752('0x1c')]:_0x5b3c84[_0x2752('0x1b')]+_0x5b3c84[_0x2752('0x1d')];var _0x534b35;if(_0x2a7407>=_0x47fdfb){_0x2a7407=_0x47fdfb;_0x534b35=0xc8;}else{_0x534b35=0xce;}_0x780016[_0x2752('0x18')](_0x534b35);return _0x780016[_0x2752('0x1e')](_0x2752('0x1f'),_0x4c1397+'-'+_0x2a7407+'/'+_0x47fdfb)[_0x2752('0x19')](_0x2a26e4);}return null;};}function patchUpdates(_0x2ce511){return function(_0x293756){try{jsonpatch['apply'](_0x293756,_0x2ce511,!![]);}catch(_0x12f801){return BPromise[_0x2752('0x20')](_0x12f801);}return _0x293756['save']();};}function saveUpdates(_0x570166,_0x115c98){return function(_0x53dd4b){if(_0x53dd4b){return _0x53dd4b['update'](_0x570166)[_0x2752('0x21')](function(_0x40cdcd){return _0x40cdcd;});}return null;};}function removeEntity(_0x580944,_0x5baff0){return function(_0x3421f3){if(_0x3421f3){return _0x3421f3[_0x2752('0x22')]()['then'](function(){_0x580944[_0x2752('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c5d3,_0x39c99c){return function(_0xcd4071){if(!_0xcd4071){_0x24c5d3[_0x2752('0x23')](0x194);}return _0xcd4071;};}function handleError(_0x105423,_0x2e416a){_0x2e416a=_0x2e416a||0x1f4;return function(_0x534a3b){logger[_0x2752('0x24')](_0x534a3b[_0x2752('0x25')]);if(_0x534a3b['name']){delete _0x534a3b[_0x2752('0x26')];}_0x105423[_0x2752('0x18')](_0x2e416a)[_0x2752('0x27')](_0x534a3b);};}exports['index']=function(_0x15f885,_0x2b4664){var _0x507769={},_0x364263={},_0x20caf9={'count':0x0,'rows':[]};var _0x3f4a1b=_[_0x2752('0x28')](db[_0x2752('0x29')][_0x2752('0x2a')],function(_0x2b20fd){return{'name':_0x2b20fd[_0x2752('0x2b')],'type':_0x2b20fd[_0x2752('0x2c')]['key']};});_0x364263[_0x2752('0x2d')]=_[_0x2752('0x28')](_0x3f4a1b,_0x2752('0x26'));_0x364263[_0x2752('0x2e')]=_[_0x2752('0x2f')](_0x15f885[_0x2752('0x2e')]);_0x364263[_0x2752('0x30')]=_[_0x2752('0x31')](_0x364263[_0x2752('0x2d')],_0x364263['query']);_0x507769[_0x2752('0x32')]=_['intersection'](_0x364263[_0x2752('0x2d')],qs[_0x2752('0x33')](_0x15f885[_0x2752('0x2e')]['fields']));_0x507769[_0x2752('0x32')]=_0x507769[_0x2752('0x32')][_0x2752('0x34')]?_0x507769[_0x2752('0x32')]:_0x364263[_0x2752('0x2d')];if(!_0x15f885[_0x2752('0x2e')][_0x2752('0x35')](_0x2752('0x36'))){_0x507769[_0x2752('0x1d')]=qs[_0x2752('0x1d')](_0x15f885[_0x2752('0x2e')]['limit']);_0x507769[_0x2752('0x1b')]=qs[_0x2752('0x1b')](_0x15f885[_0x2752('0x2e')]['offset']);}_0x507769[_0x2752('0x37')]=qs[_0x2752('0x38')](_0x15f885[_0x2752('0x2e')]['sort']);_0x507769[_0x2752('0x39')]=qs[_0x2752('0x30')](_['pick'](_0x15f885['query'],_0x364263['filters']),_0x3f4a1b);if(_0x15f885[_0x2752('0x2e')][_0x2752('0x3a')]){_0x507769[_0x2752('0x39')]=_['merge'](_0x507769[_0x2752('0x39')],{'$or':_[_0x2752('0x28')](_0x3f4a1b,function(_0x2ac505){if(_0x2ac505[_0x2752('0x2c')]!==_0x2752('0x3b')){var _0x2ce2f7={};_0x2ce2f7[_0x2ac505[_0x2752('0x26')]]={'$like':'%'+_0x15f885[_0x2752('0x2e')][_0x2752('0x3a')]+'%'};return _0x2ce2f7;}})});}_0x507769=_[_0x2752('0x3c')]({},_0x507769,_0x15f885[_0x2752('0x3d')]);var _0x19d6f4={'where':_0x507769['where']};return db[_0x2752('0x29')][_0x2752('0x1c')](_0x19d6f4)[_0x2752('0x21')](function(_0x52d109){_0x20caf9['count']=_0x52d109;if(_0x15f885['query'][_0x2752('0x3e')]){_0x507769[_0x2752('0x3f')]=[{'all':!![]}];}return db[_0x2752('0x29')][_0x2752('0x40')](_0x507769);})['then'](function(_0x4a4a1c){_0x20caf9[_0x2752('0x41')]=_0x4a4a1c;return _0x20caf9;})['then'](respondWithFilteredResult(_0x2b4664,_0x507769))['catch'](handleError(_0x2b4664,null));};exports[_0x2752('0x42')]=function(_0x47b4c6,_0x3768c6){var _0x2b0e21={'raw':!![],'where':{'id':_0x47b4c6[_0x2752('0x43')]['id']}},_0x5d0e36={};_0x5d0e36[_0x2752('0x2d')]=_[_0x2752('0x2f')](db[_0x2752('0x29')][_0x2752('0x2a')]);_0x5d0e36[_0x2752('0x2e')]=_[_0x2752('0x2f')](_0x47b4c6[_0x2752('0x2e')]);_0x5d0e36[_0x2752('0x30')]=_[_0x2752('0x31')](_0x5d0e36[_0x2752('0x2d')],_0x5d0e36[_0x2752('0x2e')]);_0x2b0e21[_0x2752('0x32')]=_[_0x2752('0x31')](_0x5d0e36[_0x2752('0x2d')],qs[_0x2752('0x33')](_0x47b4c6['query']['fields']));_0x2b0e21['attributes']=_0x2b0e21[_0x2752('0x32')][_0x2752('0x34')]?_0x2b0e21['attributes']:_0x5d0e36['model'];if(_0x47b4c6[_0x2752('0x2e')][_0x2752('0x3e')]){_0x2b0e21[_0x2752('0x3f')]=[{'all':!![]}];}_0x2b0e21=_[_0x2752('0x3c')]({},_0x2b0e21,_0x47b4c6[_0x2752('0x3d')]);return db[_0x2752('0x29')][_0x2752('0x44')](_0x2b0e21)[_0x2752('0x21')](handleEntityNotFound(_0x3768c6,null))[_0x2752('0x21')](respondWithResult(_0x3768c6,null))[_0x2752('0x45')](handleError(_0x3768c6,null));};exports[_0x2752('0x46')]=function(_0x80f360,_0x394f19){return db[_0x2752('0x29')][_0x2752('0x46')](_0x80f360[_0x2752('0x47')],{})[_0x2752('0x21')](respondWithResult(_0x394f19,0xc9))[_0x2752('0x45')](handleError(_0x394f19,null));};exports[_0x2752('0x48')]=function(_0xe98e89,_0x47d99a){if(_0xe98e89[_0x2752('0x47')]['id']){delete _0xe98e89[_0x2752('0x47')]['id'];}return db[_0x2752('0x29')][_0x2752('0x44')]({'where':{'id':_0xe98e89[_0x2752('0x43')]['id']}})[_0x2752('0x21')](handleEntityNotFound(_0x47d99a,null))[_0x2752('0x21')](saveUpdates(_0xe98e89[_0x2752('0x47')],null))['then'](respondWithResult(_0x47d99a,null))[_0x2752('0x45')](handleError(_0x47d99a,null));};exports['destroy']=function(_0x37a75a,_0x31510d){return db[_0x2752('0x29')]['find']({'where':{'id':_0x37a75a['params']['id']}})[_0x2752('0x21')](handleEntityNotFound(_0x31510d,null))['then'](removeEntity(_0x31510d,null))[_0x2752('0x45')](handleError(_0x31510d,null));};exports['describe']=function(_0x147ceb,_0x3638b2){return db['OpenchannelTransferReport'][_0x2752('0x49')]()['then'](respondWithResult(_0x3638b2,null))['catch'](handleError(_0x3638b2,null));}; \ No newline at end of file +var _0x2b88=['params','rawAttributes','find','create','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x13b948,_0x2a5a86){var _0x2f0044=function(_0xc63313){while(--_0xc63313){_0x13b948['push'](_0x13b948['shift']());}};_0x2f0044(++_0x2a5a86);}(_0x2b88,0x1c1));var _0x82b8=function(_0x3c50cf,_0x98e708){_0x3c50cf=_0x3c50cf-0x0;var _0x10214a=_0x2b88[_0x3c50cf];return _0x10214a;};'use strict';var emlformat=require(_0x82b8('0x0'));var rimraf=require(_0x82b8('0x1'));var zipdir=require(_0x82b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82b8('0x3'));var moment=require('moment');var BPromise=require(_0x82b8('0x4'));var Mustache=require(_0x82b8('0x5'));var util=require(_0x82b8('0x6'));var path=require('path');var sox=require(_0x82b8('0x7'));var csv=require(_0x82b8('0x8'));var ejs=require(_0x82b8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82b8('0xa'));var crypto=require(_0x82b8('0xb'));var jsforce=require(_0x82b8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x82b8('0xd'));var Redis=require('ioredis');var authService=require(_0x82b8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x82b8('0xf'));var hardwareService=require(_0x82b8('0x10'));var logger=require(_0x82b8('0x11'))(_0x82b8('0x12'));var utils=require(_0x82b8('0x13'));var config=require(_0x82b8('0x14'));var licenseUtil=require(_0x82b8('0x15'));var db=require(_0x82b8('0x16'))['db'];function respondWithStatusCode(_0x5debbd,_0xc04bc0){_0xc04bc0=_0xc04bc0||0xcc;return function(_0x617cd5){if(_0x617cd5){return _0x5debbd[_0x82b8('0x17')](_0xc04bc0);}return _0x5debbd[_0x82b8('0x18')](_0xc04bc0)[_0x82b8('0x19')]();};}function respondWithResult(_0x340059,_0x255025){_0x255025=_0x255025||0xc8;return function(_0x430a51){if(_0x430a51){return _0x340059[_0x82b8('0x18')](_0x255025)[_0x82b8('0x1a')](_0x430a51);}};}function respondWithFilteredResult(_0x6e7674,_0x279cf6){return function(_0x2d84e8){if(_0x2d84e8){var _0x611471=typeof _0x279cf6[_0x82b8('0x1b')]===_0x82b8('0x1c')&&typeof _0x279cf6[_0x82b8('0x1d')]===_0x82b8('0x1c');var _0x5b9650=_0x2d84e8[_0x82b8('0x1e')];var _0x463339=_0x611471?0x0:_0x279cf6['offset'];var _0x2f5b74=_0x611471?_0x2d84e8[_0x82b8('0x1e')]:_0x279cf6['offset']+_0x279cf6[_0x82b8('0x1d')];var _0x43c37f;if(_0x2f5b74>=_0x5b9650){_0x2f5b74=_0x5b9650;_0x43c37f=0xc8;}else{_0x43c37f=0xce;}_0x6e7674[_0x82b8('0x18')](_0x43c37f);return _0x6e7674[_0x82b8('0x1f')](_0x82b8('0x20'),_0x463339+'-'+_0x2f5b74+'/'+_0x5b9650)['json'](_0x2d84e8);}return null;};}function patchUpdates(_0x252910){return function(_0x3ac741){try{jsonpatch[_0x82b8('0x21')](_0x3ac741,_0x252910,!![]);}catch(_0xa5f176){return BPromise[_0x82b8('0x22')](_0xa5f176);}return _0x3ac741[_0x82b8('0x23')]();};}function saveUpdates(_0x9e6bc1,_0xb8b63d){return function(_0x5acc6e){if(_0x5acc6e){return _0x5acc6e[_0x82b8('0x24')](_0x9e6bc1)[_0x82b8('0x25')](function(_0x31f966){return _0x31f966;});}return null;};}function removeEntity(_0x28c276,_0x6b5988){return function(_0x5c31a9){if(_0x5c31a9){return _0x5c31a9[_0x82b8('0x26')]()[_0x82b8('0x25')](function(){_0x28c276[_0x82b8('0x18')](0xcc)[_0x82b8('0x19')]();});}};}function handleEntityNotFound(_0x4a607f,_0x47207f){return function(_0x2d969a){if(!_0x2d969a){_0x4a607f[_0x82b8('0x17')](0x194);}return _0x2d969a;};}function handleError(_0xb5979,_0x329111){_0x329111=_0x329111||0x1f4;return function(_0x304715){logger['error'](_0x304715[_0x82b8('0x27')]);if(_0x304715[_0x82b8('0x28')]){delete _0x304715[_0x82b8('0x28')];}_0xb5979[_0x82b8('0x18')](_0x329111)[_0x82b8('0x29')](_0x304715);};}exports[_0x82b8('0x2a')]=function(_0x5cfa78,_0x408246){var _0x1c7380={},_0x170190={},_0x1158b0={'count':0x0,'rows':[]};var _0x289e70=_[_0x82b8('0x2b')](db[_0x82b8('0x2c')]['rawAttributes'],function(_0x34ee71){return{'name':_0x34ee71[_0x82b8('0x2d')],'type':_0x34ee71['type'][_0x82b8('0x2e')]};});_0x170190[_0x82b8('0x2f')]=_[_0x82b8('0x2b')](_0x289e70,_0x82b8('0x28'));_0x170190[_0x82b8('0x30')]=_[_0x82b8('0x31')](_0x5cfa78[_0x82b8('0x30')]);_0x170190[_0x82b8('0x32')]=_[_0x82b8('0x33')](_0x170190['model'],_0x170190[_0x82b8('0x30')]);_0x1c7380[_0x82b8('0x34')]=_[_0x82b8('0x33')](_0x170190[_0x82b8('0x2f')],qs['fields'](_0x5cfa78[_0x82b8('0x30')][_0x82b8('0x35')]));_0x1c7380['attributes']=_0x1c7380[_0x82b8('0x34')][_0x82b8('0x36')]?_0x1c7380[_0x82b8('0x34')]:_0x170190['model'];if(!_0x5cfa78[_0x82b8('0x30')][_0x82b8('0x37')](_0x82b8('0x38'))){_0x1c7380['limit']=qs[_0x82b8('0x1d')](_0x5cfa78['query'][_0x82b8('0x1d')]);_0x1c7380[_0x82b8('0x1b')]=qs[_0x82b8('0x1b')](_0x5cfa78[_0x82b8('0x30')]['offset']);}_0x1c7380['order']=qs[_0x82b8('0x39')](_0x5cfa78['query'][_0x82b8('0x39')]);_0x1c7380[_0x82b8('0x3a')]=qs[_0x82b8('0x32')](_['pick'](_0x5cfa78[_0x82b8('0x30')],_0x170190[_0x82b8('0x32')]),_0x289e70);if(_0x5cfa78[_0x82b8('0x30')][_0x82b8('0x3b')]){_0x1c7380[_0x82b8('0x3a')]=_[_0x82b8('0x3c')](_0x1c7380[_0x82b8('0x3a')],{'$or':_['map'](_0x289e70,function(_0xb51391){if(_0xb51391[_0x82b8('0x3d')]!==_0x82b8('0x3e')){var _0x359296={};_0x359296[_0xb51391['name']]={'$like':'%'+_0x5cfa78['query']['filter']+'%'};return _0x359296;}})});}_0x1c7380=_['merge']({},_0x1c7380,_0x5cfa78[_0x82b8('0x3f')]);var _0x489dbb={'where':_0x1c7380[_0x82b8('0x3a')]};return db[_0x82b8('0x2c')][_0x82b8('0x1e')](_0x489dbb)[_0x82b8('0x25')](function(_0x1d01f6){_0x1158b0[_0x82b8('0x1e')]=_0x1d01f6;if(_0x5cfa78[_0x82b8('0x30')][_0x82b8('0x40')]){_0x1c7380['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x82b8('0x41')](_0x1c7380);})['then'](function(_0x5d126a){_0x1158b0[_0x82b8('0x42')]=_0x5d126a;return _0x1158b0;})[_0x82b8('0x25')](respondWithFilteredResult(_0x408246,_0x1c7380))[_0x82b8('0x43')](handleError(_0x408246,null));};exports[_0x82b8('0x44')]=function(_0x5af510,_0x41b38d){var _0x1799a4={'raw':!![],'where':{'id':_0x5af510[_0x82b8('0x45')]['id']}},_0x8036={};_0x8036[_0x82b8('0x2f')]=_[_0x82b8('0x31')](db['OpenchannelTransferReport'][_0x82b8('0x46')]);_0x8036[_0x82b8('0x30')]=_[_0x82b8('0x31')](_0x5af510['query']);_0x8036[_0x82b8('0x32')]=_[_0x82b8('0x33')](_0x8036['model'],_0x8036[_0x82b8('0x30')]);_0x1799a4[_0x82b8('0x34')]=_[_0x82b8('0x33')](_0x8036[_0x82b8('0x2f')],qs[_0x82b8('0x35')](_0x5af510[_0x82b8('0x30')][_0x82b8('0x35')]));_0x1799a4[_0x82b8('0x34')]=_0x1799a4['attributes'][_0x82b8('0x36')]?_0x1799a4[_0x82b8('0x34')]:_0x8036[_0x82b8('0x2f')];if(_0x5af510['query']['includeAll']){_0x1799a4['include']=[{'all':!![]}];}_0x1799a4=_[_0x82b8('0x3c')]({},_0x1799a4,_0x5af510['options']);return db[_0x82b8('0x2c')][_0x82b8('0x47')](_0x1799a4)[_0x82b8('0x25')](handleEntityNotFound(_0x41b38d,null))[_0x82b8('0x25')](respondWithResult(_0x41b38d,null))[_0x82b8('0x43')](handleError(_0x41b38d,null));};exports[_0x82b8('0x48')]=function(_0x40600a,_0x320fcf){return db[_0x82b8('0x2c')][_0x82b8('0x48')](_0x40600a['body'],{})[_0x82b8('0x25')](respondWithResult(_0x320fcf,0xc9))[_0x82b8('0x43')](handleError(_0x320fcf,null));};exports[_0x82b8('0x24')]=function(_0x50fe7c,_0x475bcd){if(_0x50fe7c['body']['id']){delete _0x50fe7c['body']['id'];}return db[_0x82b8('0x2c')][_0x82b8('0x47')]({'where':{'id':_0x50fe7c[_0x82b8('0x45')]['id']}})[_0x82b8('0x25')](handleEntityNotFound(_0x475bcd,null))[_0x82b8('0x25')](saveUpdates(_0x50fe7c['body'],null))[_0x82b8('0x25')](respondWithResult(_0x475bcd,null))[_0x82b8('0x43')](handleError(_0x475bcd,null));};exports[_0x82b8('0x26')]=function(_0x14fa9a,_0xf908e7){return db[_0x82b8('0x2c')][_0x82b8('0x47')]({'where':{'id':_0x14fa9a[_0x82b8('0x45')]['id']}})[_0x82b8('0x25')](handleEntityNotFound(_0xf908e7,null))[_0x82b8('0x25')](removeEntity(_0xf908e7,null))['catch'](handleError(_0xf908e7,null));};exports[_0x82b8('0x49')]=function(_0x14fafa,_0x208dc0){return db[_0x82b8('0x2c')][_0x82b8('0x49')]()['then'](respondWithResult(_0x208dc0,null))[_0x82b8('0x43')](handleError(_0x208dc0,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 64f86e5..f9beec2 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 _0x28d4=['moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','report_openchannel_transfer','lodash','util','../../config/logger','api'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x28d4,0xcd));var _0x428d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x28d4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x428d('0x0'));var util=require(_0x428d('0x1'));var logger=require(_0x428d('0x2'))(_0x428d('0x3'));var moment=require(_0x428d('0x4'));var BPromise=require('bluebird');var rp=require(_0x428d('0x5'));var fs=require('fs');var path=require(_0x428d('0x6'));var rimraf=require(_0x428d('0x7'));var config=require(_0x428d('0x8'));var attributes=require(_0x428d('0x9'));module['exports']=function(_0x492e67,_0x1fa14b){return _0x492e67['define']('OpenchannelTransferReport',attributes,{'tableName':_0x428d('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1805=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4ea3c3,_0x7c9e1b){var _0x1042f8=function(_0x16bb12){while(--_0x16bb12){_0x4ea3c3['push'](_0x4ea3c3['shift']());}};_0x1042f8(++_0x7c9e1b);}(_0x1805,0x19a));var _0x5180=function(_0x3eb144,_0x5b5479){_0x3eb144=_0x3eb144-0x0;var _0x39708d=_0x1805[_0x3eb144];return _0x39708d;};'use strict';var _=require(_0x5180('0x0'));var util=require('util');var logger=require(_0x5180('0x1'))('api');var moment=require(_0x5180('0x2'));var BPromise=require(_0x5180('0x3'));var rp=require(_0x5180('0x4'));var fs=require('fs');var path=require(_0x5180('0x5'));var rimraf=require('rimraf');var config=require(_0x5180('0x6'));var attributes=require(_0x5180('0x7'));module[_0x5180('0x8')]=function(_0x2cd130,_0x49ba27){return _0x2cd130[_0x5180('0x9')](_0x5180('0xa'),attributes,{'tableName':_0x5180('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5180('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 48d6675..89e702b 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 _0x615a=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x615a,0x119));var _0xa615=function(_0x480f4a,_0x2ea3f8){_0x480f4a=_0x480f4a-0x0;var _0xdccb7d=_0x615a[_0x480f4a];return _0xdccb7d;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44afda,_0x389dd4,_0x2db48d){return new BPromise(function(_0x1e714d,_0x2eae10){return client['request'](_0x44afda,_0x2db48d)[_0xa615('0x9')](function(_0x52470e){logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,'request\x20sent');logger[_0xa615('0xc')](_0xa615('0xd'),_0x389dd4,_0xa615('0xe'),JSON[_0xa615('0xf')](_0x52470e));if(_0x52470e[_0xa615('0x10')]){if(_0x52470e['error']['code']===0x1f4){logger[_0xa615('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x2eae10(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x1e714d(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}else{logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,_0xa615('0xe'));_0x1e714d(_0x52470e[_0xa615('0x12')][_0xa615('0x11')]);}})[_0xa615('0x13')](function(_0xa86873){logger[_0xa615('0x10')](_0xa615('0xb'),_0x389dd4,_0xa86873);_0x2eae10(_0xa86873);});});} \ No newline at end of file +var _0xc18a=['code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x485a78,_0x2774ec){var _0x363256=function(_0x2bca55){while(--_0x2bca55){_0x485a78['push'](_0x485a78['shift']());}};_0x363256(++_0x2774ec);}(_0xc18a,0x1cf));var _0xac18=function(_0x361370,_0x3f01aa){_0x361370=_0x361370-0x0;var _0x2e4eae=_0xc18a[_0x361370];return _0x2e4eae;};'use strict';var _=require(_0xac18('0x0'));var util=require(_0xac18('0x1'));var moment=require(_0xac18('0x2'));var BPromise=require(_0xac18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac18('0x4'));var db=require(_0xac18('0x5'))['db'];var utils=require(_0xac18('0x6'));var logger=require(_0xac18('0x7'))(_0xac18('0x8'));var config=require(_0xac18('0x9'));var jayson=require(_0xac18('0xa'));var client=jayson[_0xac18('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab6cb,_0x268fa1,_0x542a9){return new BPromise(function(_0x2bf4b8,_0xd3c4bc){return client[_0xac18('0xc')](_0xab6cb,_0x542a9)[_0xac18('0xd')](function(_0x223d7f){logger[_0xac18('0xe')](_0xac18('0xf'),_0x268fa1,_0xac18('0x10'));logger[_0xac18('0x11')](_0xac18('0x12'),_0x268fa1,_0xac18('0x10'),JSON['stringify'](_0x223d7f));if(_0x223d7f[_0xac18('0x13')]){if(_0x223d7f['error'][_0xac18('0x14')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x268fa1,_0x223d7f[_0xac18('0x13')]['message']);return _0xd3c4bc(_0x223d7f['error'][_0xac18('0x15')]);}logger[_0xac18('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x268fa1,_0x223d7f[_0xac18('0x13')][_0xac18('0x15')]);return _0x2bf4b8(_0x223d7f['error'][_0xac18('0x15')]);}else{logger['info'](_0xac18('0xf'),_0x268fa1,'request\x20sent');_0x2bf4b8(_0x223d7f['result'][_0xac18('0x15')]);}})[_0xac18('0x16')](function(_0x519c07){logger['error'](_0xac18('0xf'),_0x268fa1,_0x519c07);_0xd3c4bc(_0x519c07);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f0ab86d..bd789ea 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 _0x0188=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','multer','path'];(function(_0x36d890,_0x33743d){var _0x5216ef=function(_0x33613e){while(--_0x33613e){_0x36d890['push'](_0x36d890['shift']());}};_0x5216ef(++_0x33743d);}(_0x0188,0x1a7));var _0x8018=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x0188[_0x11ce46];return _0x368a1e;};'use strict';var multer=require(_0x8018('0x0'));var util=require('util');var path=require(_0x8018('0x1'));var timeout=require('connect-timeout');var express=require(_0x8018('0x2'));var router=express[_0x8018('0x3')]();var fs_extra=require(_0x8018('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8018('0x5'));var config=require(_0x8018('0x6'));var controller=require(_0x8018('0x7'));router[_0x8018('0x8')]('/',auth[_0x8018('0x9')](),controller[_0x8018('0xa')]);router['get']('/:id',auth[_0x8018('0x9')](),controller[_0x8018('0xb')]);router[_0x8018('0xc')]('/',auth[_0x8018('0x9')](),controller['create']);router[_0x8018('0xd')](_0x8018('0xe'),auth[_0x8018('0x9')](),controller['update']);router[_0x8018('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8018('0x10')]);module['exports']=router; \ No newline at end of file +var _0x927d=['destroy','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','update','delete'];(function(_0x12b830,_0xd66540){var _0x261dc4=function(_0x57037a){while(--_0x57037a){_0x12b830['push'](_0x12b830['shift']());}};_0x261dc4(++_0xd66540);}(_0x927d,0x88));var _0xd927=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x927d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd927('0x0'));var path=require('path');var timeout=require(_0xd927('0x1'));var express=require(_0xd927('0x2'));var router=express[_0xd927('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd927('0x4'));var config=require(_0xd927('0x5'));var controller=require('./pause.controller');router[_0xd927('0x6')]('/',auth['isAuthenticated'](),controller[_0xd927('0x7')]);router['get'](_0xd927('0x8'),auth[_0xd927('0x9')](),controller[_0xd927('0xa')]);router[_0xd927('0xb')]('/',auth[_0xd927('0x9')](),controller['create']);router['put'](_0xd927('0x8'),auth['isAuthenticated'](),controller[_0xd927('0xc')]);router[_0xd927('0xd')](_0xd927('0x8'),auth[_0xd927('0x9')](),controller[_0xd927('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1ac1379..c44c34a 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 _0xac6a=['name','sequelize','exports','STRING'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xac6a,0xe1));var _0xaac6=function(_0x15a551,_0x23e034){_0x15a551=_0x15a551-0x0;var _0x2747dd=_0xac6a[_0x15a551];return _0x2747dd;};'use strict';var Sequelize=require(_0xaac6('0x0'));module[_0xaac6('0x1')]={'name':{'type':Sequelize[_0xaac6('0x2')],'unique':_0xaac6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xaac6('0x2')]}}; \ No newline at end of file +var _0x4f58=['name','sequelize','exports','STRING'];(function(_0x109df9,_0x506331){var _0x47b297=function(_0x1b44bb){while(--_0x1b44bb){_0x109df9['push'](_0x109df9['shift']());}};_0x47b297(++_0x506331);}(_0x4f58,0x71));var _0x84f5=function(_0xc30819,_0x55b378){_0xc30819=_0xc30819-0x0;var _0xbd66fb=_0x4f58[_0xc30819];return _0xbd66fb;};'use strict';var Sequelize=require(_0x84f5('0x0'));module[_0x84f5('0x1')]={'name':{'type':Sequelize[_0x84f5('0x2')],'unique':_0x84f5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x84f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 79372a8..a4bfe53 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 _0x0405=['params','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','fields','options','find','create','body','user','role','get','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x42748e,_0xd0f7e5){var _0x5023a9=function(_0xb4fa02){while(--_0xb4fa02){_0x42748e['push'](_0x42748e['shift']());}};_0x5023a9(++_0xd0f7e5);}(_0x0405,0x155));var _0x5040=function(_0x1f9b19,_0xbd8941){_0x1f9b19=_0x1f9b19-0x0;var _0x306411=_0x0405[_0x1f9b19];return _0x306411;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5040('0x0'));var zipdir=require(_0x5040('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5040('0x2'));var moment=require(_0x5040('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5040('0x4'));var path=require(_0x5040('0x5'));var sox=require(_0x5040('0x6'));var csv=require(_0x5040('0x7'));var ejs=require(_0x5040('0x8'));var fs=require('fs');var fs_extra=require(_0x5040('0x9'));var _=require(_0x5040('0xa'));var squel=require(_0x5040('0xb'));var crypto=require(_0x5040('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5040('0xd'));var toCsv=require(_0x5040('0x7'));var querystring=require(_0x5040('0xe'));var Papa=require(_0x5040('0xf'));var Redis=require(_0x5040('0x10'));var authService=require(_0x5040('0x11'));var qs=require(_0x5040('0x12'));var as=require(_0x5040('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5040('0x14'))(_0x5040('0x15'));var utils=require(_0x5040('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5040('0x17'));var db=require(_0x5040('0x18'))['db'];function respondWithStatusCode(_0x4ad406,_0x3d54cb){_0x3d54cb=_0x3d54cb||0xcc;return function(_0x2c983f){if(_0x2c983f){return _0x4ad406['sendStatus'](_0x3d54cb);}return _0x4ad406['status'](_0x3d54cb)[_0x5040('0x19')]();};}function respondWithResult(_0x16568a,_0x5aaef2){_0x5aaef2=_0x5aaef2||0xc8;return function(_0x92c499){if(_0x92c499){return _0x16568a[_0x5040('0x1a')](_0x5aaef2)[_0x5040('0x1b')](_0x92c499);}};}function respondWithFilteredResult(_0x5e4d20,_0x53345e){return function(_0x3a38db){if(_0x3a38db){var _0x28795d=typeof _0x53345e[_0x5040('0x1c')]===_0x5040('0x1d')&&typeof _0x53345e[_0x5040('0x1e')]===_0x5040('0x1d');var _0x216322=_0x3a38db[_0x5040('0x1f')];var _0x1e1685=_0x28795d?0x0:_0x53345e['offset'];var _0x1beb01=_0x28795d?_0x3a38db[_0x5040('0x1f')]:_0x53345e[_0x5040('0x1c')]+_0x53345e['limit'];var _0x4b68f0;if(_0x1beb01>=_0x216322){_0x1beb01=_0x216322;_0x4b68f0=0xc8;}else{_0x4b68f0=0xce;}_0x5e4d20['status'](_0x4b68f0);return _0x5e4d20[_0x5040('0x20')](_0x5040('0x21'),_0x1e1685+'-'+_0x1beb01+'/'+_0x216322)[_0x5040('0x1b')](_0x3a38db);}return null;};}function patchUpdates(_0x4216f3){return function(_0x53cc51){try{jsonpatch[_0x5040('0x22')](_0x53cc51,_0x4216f3,!![]);}catch(_0x3024e1){return BPromise['reject'](_0x3024e1);}return _0x53cc51[_0x5040('0x23')]();};}function saveUpdates(_0x1c96a3,_0x3173e2){return function(_0x3a2088){if(_0x3a2088){return _0x3a2088[_0x5040('0x24')](_0x1c96a3)[_0x5040('0x25')](function(_0x2e50ef){return _0x2e50ef;});}return null;};}function removeEntity(_0x96126f,_0x4af7fe){return function(_0x575ce8){if(_0x575ce8){return _0x575ce8[_0x5040('0x26')]()['then'](function(){var _0x3b8d29=_0x575ce8['get']({'plain':!![]});var _0x1e6ec9='Pauses';return db[_0x5040('0x27')][_0x5040('0x26')]({'where':{'type':_0x1e6ec9,'resourceId':_0x3b8d29['id']}})[_0x5040('0x25')](function(){return _0x575ce8;});})[_0x5040('0x25')](function(){_0x96126f['status'](0xcc)[_0x5040('0x19')]();});}};}function handleEntityNotFound(_0x38f5f6,_0x219d4a){return function(_0x3fff53){if(!_0x3fff53){_0x38f5f6['sendStatus'](0x194);}return _0x3fff53;};}function handleError(_0x113a4e,_0x259361){_0x259361=_0x259361||0x1f4;return function(_0x4709cd){logger[_0x5040('0x28')](_0x4709cd[_0x5040('0x29')]);if(_0x4709cd[_0x5040('0x2a')]){delete _0x4709cd[_0x5040('0x2a')];}_0x113a4e['status'](_0x259361)[_0x5040('0x2b')](_0x4709cd);};}exports[_0x5040('0x2c')]=function(_0x4e40b4,_0x4f4947){var _0x40d784={},_0x5f5334={},_0x51ff0d={'count':0x0,'rows':[]};var _0x4ec830=_[_0x5040('0x2d')](db[_0x5040('0x2e')][_0x5040('0x2f')],function(_0x4e008a){return{'name':_0x4e008a[_0x5040('0x30')],'type':_0x4e008a[_0x5040('0x31')][_0x5040('0x32')]};});_0x5f5334[_0x5040('0x33')]=_[_0x5040('0x2d')](_0x4ec830,'name');_0x5f5334[_0x5040('0x34')]=_[_0x5040('0x35')](_0x4e40b4[_0x5040('0x34')]);_0x5f5334[_0x5040('0x36')]=_[_0x5040('0x37')](_0x5f5334[_0x5040('0x33')],_0x5f5334[_0x5040('0x34')]);_0x40d784[_0x5040('0x38')]=_['intersection'](_0x5f5334[_0x5040('0x33')],qs['fields'](_0x4e40b4[_0x5040('0x34')]['fields']));_0x40d784[_0x5040('0x38')]=_0x40d784[_0x5040('0x38')][_0x5040('0x39')]?_0x40d784['attributes']:_0x5f5334[_0x5040('0x33')];if(!_0x4e40b4['query'][_0x5040('0x3a')]('nolimit')){_0x40d784['limit']=qs[_0x5040('0x1e')](_0x4e40b4[_0x5040('0x34')][_0x5040('0x1e')]);_0x40d784[_0x5040('0x1c')]=qs['offset'](_0x4e40b4[_0x5040('0x34')]['offset']);}_0x40d784[_0x5040('0x3b')]=qs[_0x5040('0x3c')](_0x4e40b4[_0x5040('0x34')][_0x5040('0x3c')]);_0x40d784['where']=qs[_0x5040('0x36')](_[_0x5040('0x3d')](_0x4e40b4[_0x5040('0x34')],_0x5f5334['filters']),_0x4ec830);if(_0x4e40b4[_0x5040('0x34')]['filter']){_0x40d784[_0x5040('0x3e')]=_[_0x5040('0x3f')](_0x40d784[_0x5040('0x3e')],{'$or':_[_0x5040('0x2d')](_0x4ec830,function(_0x48d9a8){if(_0x48d9a8[_0x5040('0x31')]!==_0x5040('0x40')){var _0x245b19={};_0x245b19[_0x48d9a8[_0x5040('0x2a')]]={'$like':'%'+_0x4e40b4[_0x5040('0x34')][_0x5040('0x41')]+'%'};return _0x245b19;}})});}_0x40d784=_[_0x5040('0x3f')]({},_0x40d784,_0x4e40b4['options']);var _0x3cc2b9={'where':_0x40d784['where']};return db[_0x5040('0x2e')][_0x5040('0x1f')](_0x3cc2b9)[_0x5040('0x25')](function(_0x5a1375){_0x51ff0d[_0x5040('0x1f')]=_0x5a1375;if(_0x4e40b4[_0x5040('0x34')][_0x5040('0x42')]){_0x40d784[_0x5040('0x43')]=[{'all':!![]}];}return db[_0x5040('0x2e')]['findAll'](_0x40d784);})[_0x5040('0x25')](function(_0x5e5d70){_0x51ff0d[_0x5040('0x44')]=_0x5e5d70;return _0x51ff0d;})['then'](respondWithFilteredResult(_0x4f4947,_0x40d784))[_0x5040('0x45')](handleError(_0x4f4947,null));};exports[_0x5040('0x46')]=function(_0x5b8ccd,_0x23d740){var _0x31da5d={'raw':!![],'where':{'id':_0x5b8ccd['params']['id']}},_0x578fb8={};_0x578fb8[_0x5040('0x33')]=_[_0x5040('0x35')](db[_0x5040('0x2e')][_0x5040('0x2f')]);_0x578fb8[_0x5040('0x34')]=_[_0x5040('0x35')](_0x5b8ccd[_0x5040('0x34')]);_0x578fb8[_0x5040('0x36')]=_[_0x5040('0x37')](_0x578fb8[_0x5040('0x33')],_0x578fb8[_0x5040('0x34')]);_0x31da5d[_0x5040('0x38')]=_[_0x5040('0x37')](_0x578fb8[_0x5040('0x33')],qs[_0x5040('0x47')](_0x5b8ccd[_0x5040('0x34')]['fields']));_0x31da5d[_0x5040('0x38')]=_0x31da5d['attributes']['length']?_0x31da5d[_0x5040('0x38')]:_0x578fb8[_0x5040('0x33')];if(_0x5b8ccd['query'][_0x5040('0x42')]){_0x31da5d[_0x5040('0x43')]=[{'all':!![]}];}_0x31da5d=_[_0x5040('0x3f')]({},_0x31da5d,_0x5b8ccd[_0x5040('0x48')]);return db['Pause'][_0x5040('0x49')](_0x31da5d)[_0x5040('0x25')](handleEntityNotFound(_0x23d740,null))[_0x5040('0x25')](respondWithResult(_0x23d740,null))['catch'](handleError(_0x23d740,null));};exports[_0x5040('0x4a')]=function(_0x15b4e7,_0x22dc23){return db[_0x5040('0x2e')][_0x5040('0x4a')](_0x15b4e7[_0x5040('0x4b')],{})[_0x5040('0x25')](function(_0x469156){var _0x36afb0=_0x15b4e7[_0x5040('0x4c')]['get']({'plain':!![]});if(!_0x36afb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36afb0[_0x5040('0x4d')]===_0x5040('0x4c')){var _0x2eabdf=_0x469156[_0x5040('0x4e')]({'plain':!![]});var _0x54df20=_0x5040('0x4f');return db[_0x5040('0x50')][_0x5040('0x49')]({'where':{'name':_0x54df20,'userProfileId':_0x36afb0[_0x5040('0x51')]},'raw':!![]})[_0x5040('0x25')](function(_0x4ca6f7){if(_0x4ca6f7&&_0x4ca6f7[_0x5040('0x52')]===0x0){return db[_0x5040('0x27')][_0x5040('0x4a')]({'name':_0x2eabdf['name'],'resourceId':_0x2eabdf['id'],'type':_0x4ca6f7['name'],'sectionId':_0x4ca6f7['id']},{})['then'](function(){return _0x469156;});}else{return _0x469156;}})[_0x5040('0x45')](function(_0x372b08){logger[_0x5040('0x28')](_0x5040('0x53'),_0x372b08);throw _0x372b08;});}return _0x469156;})[_0x5040('0x25')](respondWithResult(_0x22dc23,0xc9))[_0x5040('0x45')](handleError(_0x22dc23,null));};exports[_0x5040('0x24')]=function(_0x1b5657,_0x2edf47){if(_0x1b5657[_0x5040('0x4b')]['id']){delete _0x1b5657[_0x5040('0x4b')]['id'];}return db['Pause'][_0x5040('0x49')]({'where':{'id':_0x1b5657[_0x5040('0x54')]['id']}})['then'](handleEntityNotFound(_0x2edf47,null))[_0x5040('0x25')](saveUpdates(_0x1b5657[_0x5040('0x4b')],null))[_0x5040('0x25')](respondWithResult(_0x2edf47,null))['catch'](handleError(_0x2edf47,null));};exports['destroy']=function(_0x273af1,_0x1c0242){return db[_0x5040('0x2e')][_0x5040('0x49')]({'where':{'id':_0x273af1[_0x5040('0x54')]['id']}})[_0x5040('0x25')](handleEntityNotFound(_0x1c0242,null))[_0x5040('0x25')](removeEntity(_0x1c0242,null))[_0x5040('0x45')](handleError(_0x1c0242,null));}; \ No newline at end of file +var _0x3984=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','fs-extra','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','status','end','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x2065ef,_0x538148){var _0x57ebf7=function(_0x3a7e01){while(--_0x3a7e01){_0x2065ef['push'](_0x2065ef['shift']());}};_0x57ebf7(++_0x538148);}(_0x3984,0x160));var _0x4398=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x3984[_0x8af54b];return _0x27d8f0;};'use strict';var emlformat=require(_0x4398('0x0'));var rimraf=require(_0x4398('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4398('0x2'));var moment=require(_0x4398('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4398('0x4'));var util=require('util');var path=require(_0x4398('0x5'));var sox=require(_0x4398('0x6'));var csv=require(_0x4398('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4398('0x8'));var _=require(_0x4398('0x9'));var squel=require(_0x4398('0xa'));var crypto=require('crypto');var jsforce=require(_0x4398('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4398('0x7'));var querystring=require(_0x4398('0xc'));var Papa=require(_0x4398('0xd'));var Redis=require(_0x4398('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4398('0xf'));var as=require(_0x4398('0x10'));var hardwareService=require(_0x4398('0x11'));var logger=require(_0x4398('0x12'))(_0x4398('0x13'));var utils=require(_0x4398('0x14'));var config=require(_0x4398('0x15'));var licenseUtil=require(_0x4398('0x16'));var db=require(_0x4398('0x17'))['db'];function respondWithStatusCode(_0x54dff5,_0x3a2720){_0x3a2720=_0x3a2720||0xcc;return function(_0x1a2bb8){if(_0x1a2bb8){return _0x54dff5['sendStatus'](_0x3a2720);}return _0x54dff5[_0x4398('0x18')](_0x3a2720)[_0x4398('0x19')]();};}function respondWithResult(_0x21fb4d,_0x2844de){_0x2844de=_0x2844de||0xc8;return function(_0x283809){if(_0x283809){return _0x21fb4d[_0x4398('0x18')](_0x2844de)['json'](_0x283809);}};}function respondWithFilteredResult(_0x1e1386,_0x5eee6e){return function(_0xd41c70){if(_0xd41c70){var _0x2f5bb8=typeof _0x5eee6e[_0x4398('0x1a')]==='undefined'&&typeof _0x5eee6e[_0x4398('0x1b')]==='undefined';var _0x58d689=_0xd41c70['count'];var _0x130796=_0x2f5bb8?0x0:_0x5eee6e[_0x4398('0x1a')];var _0x56b954=_0x2f5bb8?_0xd41c70[_0x4398('0x1c')]:_0x5eee6e['offset']+_0x5eee6e[_0x4398('0x1b')];var _0x11fffa;if(_0x56b954>=_0x58d689){_0x56b954=_0x58d689;_0x11fffa=0xc8;}else{_0x11fffa=0xce;}_0x1e1386['status'](_0x11fffa);return _0x1e1386[_0x4398('0x1d')](_0x4398('0x1e'),_0x130796+'-'+_0x56b954+'/'+_0x58d689)[_0x4398('0x1f')](_0xd41c70);}return null;};}function patchUpdates(_0x4ab1be){return function(_0x354599){try{jsonpatch[_0x4398('0x20')](_0x354599,_0x4ab1be,!![]);}catch(_0x514c4d){return BPromise['reject'](_0x514c4d);}return _0x354599[_0x4398('0x21')]();};}function saveUpdates(_0x5c8bcd,_0x501167){return function(_0x46d8ad){if(_0x46d8ad){return _0x46d8ad[_0x4398('0x22')](_0x5c8bcd)[_0x4398('0x23')](function(_0x596355){return _0x596355;});}return null;};}function removeEntity(_0x1f7927,_0x448efd){return function(_0x2a4958){if(_0x2a4958){return _0x2a4958[_0x4398('0x24')]()[_0x4398('0x23')](function(){var _0x46e2d5=_0x2a4958[_0x4398('0x25')]({'plain':!![]});var _0x4b661a='Pauses';return db[_0x4398('0x26')][_0x4398('0x24')]({'where':{'type':_0x4b661a,'resourceId':_0x46e2d5['id']}})[_0x4398('0x23')](function(){return _0x2a4958;});})[_0x4398('0x23')](function(){_0x1f7927['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x153ab9,_0x2c19f8){return function(_0x6ac133){if(!_0x6ac133){_0x153ab9[_0x4398('0x27')](0x194);}return _0x6ac133;};}function handleError(_0x3dcf9a,_0x58eeff){_0x58eeff=_0x58eeff||0x1f4;return function(_0xbe6bee){logger['error'](_0xbe6bee['stack']);if(_0xbe6bee['name']){delete _0xbe6bee[_0x4398('0x28')];}_0x3dcf9a[_0x4398('0x18')](_0x58eeff)[_0x4398('0x29')](_0xbe6bee);};}exports[_0x4398('0x2a')]=function(_0xb74ade,_0xa587a7){var _0xed183d={},_0x3cf04a={},_0x35f37f={'count':0x0,'rows':[]};var _0xfe6fb4=_[_0x4398('0x2b')](db[_0x4398('0x2c')][_0x4398('0x2d')],function(_0x494358){return{'name':_0x494358[_0x4398('0x2e')],'type':_0x494358[_0x4398('0x2f')][_0x4398('0x30')]};});_0x3cf04a[_0x4398('0x31')]=_[_0x4398('0x2b')](_0xfe6fb4,_0x4398('0x28'));_0x3cf04a[_0x4398('0x32')]=_[_0x4398('0x33')](_0xb74ade[_0x4398('0x32')]);_0x3cf04a[_0x4398('0x34')]=_[_0x4398('0x35')](_0x3cf04a['model'],_0x3cf04a[_0x4398('0x32')]);_0xed183d['attributes']=_[_0x4398('0x35')](_0x3cf04a[_0x4398('0x31')],qs[_0x4398('0x36')](_0xb74ade[_0x4398('0x32')][_0x4398('0x36')]));_0xed183d[_0x4398('0x37')]=_0xed183d[_0x4398('0x37')][_0x4398('0x38')]?_0xed183d['attributes']:_0x3cf04a[_0x4398('0x31')];if(!_0xb74ade[_0x4398('0x32')][_0x4398('0x39')](_0x4398('0x3a'))){_0xed183d[_0x4398('0x1b')]=qs[_0x4398('0x1b')](_0xb74ade[_0x4398('0x32')][_0x4398('0x1b')]);_0xed183d[_0x4398('0x1a')]=qs[_0x4398('0x1a')](_0xb74ade[_0x4398('0x32')][_0x4398('0x1a')]);}_0xed183d['order']=qs[_0x4398('0x3b')](_0xb74ade[_0x4398('0x32')][_0x4398('0x3b')]);_0xed183d[_0x4398('0x3c')]=qs['filters'](_[_0x4398('0x3d')](_0xb74ade[_0x4398('0x32')],_0x3cf04a['filters']),_0xfe6fb4);if(_0xb74ade['query'][_0x4398('0x3e')]){_0xed183d[_0x4398('0x3c')]=_[_0x4398('0x3f')](_0xed183d[_0x4398('0x3c')],{'$or':_[_0x4398('0x2b')](_0xfe6fb4,function(_0x58a7c1){if(_0x58a7c1['type']!==_0x4398('0x40')){var _0x118aa2={};_0x118aa2[_0x58a7c1[_0x4398('0x28')]]={'$like':'%'+_0xb74ade[_0x4398('0x32')][_0x4398('0x3e')]+'%'};return _0x118aa2;}})});}_0xed183d=_[_0x4398('0x3f')]({},_0xed183d,_0xb74ade[_0x4398('0x41')]);var _0x307cd1={'where':_0xed183d['where']};return db['Pause'][_0x4398('0x1c')](_0x307cd1)[_0x4398('0x23')](function(_0x1132e2){_0x35f37f[_0x4398('0x1c')]=_0x1132e2;if(_0xb74ade['query'][_0x4398('0x42')]){_0xed183d['include']=[{'all':!![]}];}return db[_0x4398('0x2c')]['findAll'](_0xed183d);})[_0x4398('0x23')](function(_0x58b9bb){_0x35f37f[_0x4398('0x43')]=_0x58b9bb;return _0x35f37f;})[_0x4398('0x23')](respondWithFilteredResult(_0xa587a7,_0xed183d))[_0x4398('0x44')](handleError(_0xa587a7,null));};exports[_0x4398('0x45')]=function(_0x38ba7f,_0x4485fd){var _0x14f956={'raw':!![],'where':{'id':_0x38ba7f[_0x4398('0x46')]['id']}},_0xf81c00={};_0xf81c00[_0x4398('0x31')]=_[_0x4398('0x33')](db[_0x4398('0x2c')][_0x4398('0x2d')]);_0xf81c00[_0x4398('0x32')]=_[_0x4398('0x33')](_0x38ba7f['query']);_0xf81c00[_0x4398('0x34')]=_[_0x4398('0x35')](_0xf81c00['model'],_0xf81c00[_0x4398('0x32')]);_0x14f956[_0x4398('0x37')]=_['intersection'](_0xf81c00[_0x4398('0x31')],qs[_0x4398('0x36')](_0x38ba7f['query']['fields']));_0x14f956[_0x4398('0x37')]=_0x14f956[_0x4398('0x37')][_0x4398('0x38')]?_0x14f956[_0x4398('0x37')]:_0xf81c00[_0x4398('0x31')];if(_0x38ba7f[_0x4398('0x32')][_0x4398('0x42')]){_0x14f956[_0x4398('0x47')]=[{'all':!![]}];}_0x14f956=_['merge']({},_0x14f956,_0x38ba7f[_0x4398('0x41')]);return db[_0x4398('0x2c')][_0x4398('0x48')](_0x14f956)['then'](handleEntityNotFound(_0x4485fd,null))['then'](respondWithResult(_0x4485fd,null))[_0x4398('0x44')](handleError(_0x4485fd,null));};exports[_0x4398('0x49')]=function(_0x43dad2,_0x43ad60){return db['Pause'][_0x4398('0x49')](_0x43dad2[_0x4398('0x4a')],{})['then'](function(_0x3f65a4){var _0x1a3e3c=_0x43dad2[_0x4398('0x4b')]['get']({'plain':!![]});if(!_0x1a3e3c)throw new Error(_0x4398('0x4c'));if(_0x1a3e3c['role']===_0x4398('0x4b')){var _0x26a9db=_0x3f65a4['get']({'plain':!![]});var _0x52f2da=_0x4398('0x4d');return db['UserProfileSection'][_0x4398('0x48')]({'where':{'name':_0x52f2da,'userProfileId':_0x1a3e3c[_0x4398('0x4e')]},'raw':!![]})[_0x4398('0x23')](function(_0x3c42fd){if(_0x3c42fd&&_0x3c42fd[_0x4398('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x26a9db['name'],'resourceId':_0x26a9db['id'],'type':_0x3c42fd[_0x4398('0x28')],'sectionId':_0x3c42fd['id']},{})[_0x4398('0x23')](function(){return _0x3f65a4;});}else{return _0x3f65a4;}})[_0x4398('0x44')](function(_0x11b33d){logger[_0x4398('0x50')](_0x4398('0x51'),_0x11b33d);throw _0x11b33d;});}return _0x3f65a4;})[_0x4398('0x23')](respondWithResult(_0x43ad60,0xc9))[_0x4398('0x44')](handleError(_0x43ad60,null));};exports[_0x4398('0x22')]=function(_0x30ba83,_0x522d6c){if(_0x30ba83[_0x4398('0x4a')]['id']){delete _0x30ba83[_0x4398('0x4a')]['id'];}return db[_0x4398('0x2c')][_0x4398('0x48')]({'where':{'id':_0x30ba83[_0x4398('0x46')]['id']}})[_0x4398('0x23')](handleEntityNotFound(_0x522d6c,null))['then'](saveUpdates(_0x30ba83['body'],null))[_0x4398('0x23')](respondWithResult(_0x522d6c,null))[_0x4398('0x44')](handleError(_0x522d6c,null));};exports[_0x4398('0x24')]=function(_0x57e133,_0x32a5bc){return db['Pause'][_0x4398('0x48')]({'where':{'id':_0x57e133[_0x4398('0x46')]['id']}})[_0x4398('0x23')](handleEntityNotFound(_0x32a5bc,null))[_0x4398('0x23')](removeEntity(_0x32a5bc,null))[_0x4398('0x44')](handleError(_0x32a5bc,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b4bbad2..2e41245 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x41ab68,_0x3e806f){_0x41ab68=_0x41ab68-0x0;var _0x134b6c=_0x7fbe[_0x41ab68];return _0x134b6c;};'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 +var _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x2824b7,_0xe8570){var _0x6e9110=function(_0x3fec83){while(--_0x3fec83){_0x2824b7['push'](_0x2824b7['shift']());}};_0x6e9110(++_0xe8570);}(_0x5fab,0x177));var _0xb5fa=function(_0x5e6aad,_0x3cdddd){_0x5e6aad=_0x5e6aad-0x0;var _0x55deab=_0x5fab[_0x5e6aad];return _0x55deab;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'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 da5dde3..6f75fcf 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xdfbefa,_0x1df329){var _0x530677=function(_0x3db591){while(--_0x3db591){_0xdfbefa['push'](_0xdfbefa['shift']());}};_0x530677(++_0x1df329);}(_0x7a54,0x106));var _0x47a5=function(_0x2d2938,_0x4067d0){_0x2d2938=_0x2d2938-0x0;var _0x23cb68=_0x7a54[_0x2d2938];return _0x23cb68;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3c0248,_0x48410a){var _0x8d22f5=function(_0x162ded){while(--_0x162ded){_0x3c0248['push'](_0x3c0248['shift']());}};_0x8d22f5(++_0x48410a);}(_0xb10b,0x12a));var _0xbb10=function(_0x7a3bfe,_0x41fc9e){_0x7a3bfe=_0x7a3bfe-0x0;var _0x3829e4=_0xb10b[_0x7a3bfe];return _0x3829e4;};'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 98430d3..dca36c5 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 _0xc3b5=['server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','show','/:id/download','download','diskStorage','root'];(function(_0x30a956,_0x11222e){var _0x2ac17d=function(_0x3be1d2){while(--_0x3be1d2){_0x30a956['push'](_0x30a956['shift']());}};_0x2ac17d(++_0x11222e);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x227caf,_0x1ad996){_0x227caf=_0x227caf-0x0;var _0x1b507f=_0xc3b5[_0x227caf];return _0x1b507f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./plugin.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),controller[_0x5c3b('0xb')]);router[_0x5c3b('0x8')]('/:id',auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xc')]);router[_0x5c3b('0x8')](_0x5c3b('0xd'),auth['isAuthenticated'](),controller[_0x5c3b('0xe')]);var upload=multer({'storage':multer[_0x5c3b('0xf')]({'destination':function(_0x30ceca,_0x2e894a,_0x363c3d){_0x363c3d(null,path['join'](config[_0x5c3b('0x10')],_0x5c3b('0x11')));},'filename':function(_0x589c36,_0x1b2815,_0x3b953d){_0x1b2815['originalname']=_0x1b2815[_0x5c3b('0x12')][_0x5c3b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b953d(null,util[_0x5c3b('0x14')](_0x5c3b('0x15'),path[_0x5c3b('0x16')](_0x1b2815[_0x5c3b('0x12')],path[_0x5c3b('0x17')](_0x1b2815['originalname'])),Date[_0x5c3b('0x18')](),path['extname'](_0x1b2815['originalname'])));}})});router[_0x5c3b('0x19')]('/',upload[_0x5c3b('0x1a')](_0x5c3b('0x1b')),controller['upload']);router[_0x5c3b('0x19')](_0x5c3b('0xa'),controller[_0x5c3b('0x1c')]);router['put'](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller['update']);router[_0x5c3b('0x1e')](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x1e')]);module[_0x5c3b('0x1f')]=router; \ No newline at end of file +var _0x4c6d=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/webhook','/:id','isAuthenticated','/:id/download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','upload','webhookPost','put'];(function(_0x41fdcc,_0x586927){var _0x3de759=function(_0xd5d493){while(--_0xd5d493){_0x41fdcc['push'](_0x41fdcc['shift']());}};_0x3de759(++_0x586927);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x280a60,_0xc658b6){_0x280a60=_0x280a60-0x0;var _0x81d7c4=_0x4c6d[_0x280a60];return _0x81d7c4;};'use strict';var multer=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var path=require(_0xd4c6('0x2'));var timeout=require(_0xd4c6('0x3'));var express=require(_0xd4c6('0x4'));var router=express['Router']();var fs_extra=require(_0xd4c6('0x5'));var auth=require(_0xd4c6('0x6'));var interaction=require(_0xd4c6('0x7'));var config=require('../../config/environment');var controller=require(_0xd4c6('0x8'));router[_0xd4c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xd4c6('0xa')]);router[_0xd4c6('0x9')](_0xd4c6('0xb'),controller['webhookGet']);router[_0xd4c6('0x9')](_0xd4c6('0xc'),auth[_0xd4c6('0xd')](),controller['show']);router[_0xd4c6('0x9')](_0xd4c6('0xe'),auth[_0xd4c6('0xd')](),controller['download']);var upload=multer({'storage':multer[_0xd4c6('0xf')]({'destination':function(_0x38f0a6,_0x3eaa96,_0x2790e7){_0x2790e7(null,path[_0xd4c6('0x10')](config[_0xd4c6('0x11')],'server/files/plugins'));},'filename':function(_0x52bbc9,_0x35b902,_0x489171){_0x35b902[_0xd4c6('0x12')]=_0x35b902[_0xd4c6('0x12')][_0xd4c6('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x489171(null,util[_0xd4c6('0x14')](_0xd4c6('0x15'),path[_0xd4c6('0x16')](_0x35b902[_0xd4c6('0x12')],path['extname'](_0x35b902['originalname'])),Date[_0xd4c6('0x17')](),path[_0xd4c6('0x18')](_0x35b902[_0xd4c6('0x12')])));}})});router[_0xd4c6('0x19')]('/',upload[_0xd4c6('0x1a')](_0xd4c6('0x1b')),controller[_0xd4c6('0x1c')]);router['post'](_0xd4c6('0xb'),controller[_0xd4c6('0x1d')]);router[_0xd4c6('0x1e')](_0xd4c6('0xc'),auth[_0xd4c6('0xd')](),controller['update']);router[_0xd4c6('0x1f')](_0xd4c6('0xc'),auth[_0xd4c6('0xd')](),controller['delete']);module[_0xd4c6('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 7dde78a..c6a9202 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 _0x54cb=['sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x4607e1,_0x596f78){var _0x22f1b2=function(_0x122dcc){while(--_0x122dcc){_0x4607e1['push'](_0x4607e1['shift']());}};_0x22f1b2(++_0x596f78);}(_0x54cb,0x1b2));var _0xb54c=function(_0x4ec9ae,_0x4e6022){_0x4ec9ae=_0x4ec9ae-0x0;var _0x47c2cb=_0x54cb[_0x4ec9ae];return _0x47c2cb;};'use strict';var Sequelize=require(_0xb54c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb54c('0x1')]},'type':{'type':Sequelize[_0xb54c('0x2')](_0xb54c('0x3'),_0xb54c('0x4'))},'description':{'type':Sequelize[_0xb54c('0x5')]},'version':{'type':Sequelize[_0xb54c('0x5')]},'path':{'type':Sequelize[_0xb54c('0x1')],'comment':_0xb54c('0x6')},'active':{'type':Sequelize[_0xb54c('0x7')],'defaultValue':0x0,'comment':_0xb54c('0x8')},'sidebar':{'type':Sequelize[_0xb54c('0x2')](_0xb54c('0x9'),_0xb54c('0xa'),_0xb54c('0xb'),_0xb54c('0xc')),'defaultValue':'always','comment':_0xb54c('0xd')},'icon':{'type':Sequelize[_0xb54c('0x1')]},'adminUrl':{'type':Sequelize[_0xb54c('0x1')]},'agentUrl':{'type':Sequelize[_0xb54c('0x1')]},'scriptName':{'type':Sequelize[_0xb54c('0x1')]},'scriptPath':{'type':Sequelize[_0xb54c('0x1')]}}; \ No newline at end of file +var _0x9192=['exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0xb697ca,_0x2deca1){var _0x399857=function(_0x1bdf47){while(--_0x1bdf47){_0xb697ca['push'](_0xb697ca['shift']());}};_0x399857(++_0x2deca1);}(_0x9192,0xbf));var _0x2919=function(_0x4c9be7,_0x538b4d){_0x4c9be7=_0x4c9be7-0x0;var _0x5250a7=_0x9192[_0x4c9be7];return _0x5250a7;};'use strict';var Sequelize=require(_0x2919('0x0'));module[_0x2919('0x1')]={'name':{'type':Sequelize[_0x2919('0x2')]},'type':{'type':Sequelize[_0x2919('0x3')](_0x2919('0x4'),_0x2919('0x5'))},'description':{'type':Sequelize[_0x2919('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x2919('0x7')},'active':{'type':Sequelize[_0x2919('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2919('0x3')]('adminOnly',_0x2919('0x9'),_0x2919('0xa'),'never'),'defaultValue':_0x2919('0xa'),'comment':_0x2919('0xb')},'icon':{'type':Sequelize[_0x2919('0x2')]},'adminUrl':{'type':Sequelize[_0x2919('0x2')]},'agentUrl':{'type':Sequelize[_0x2919('0x2')]},'scriptName':{'type':Sequelize[_0x2919('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index fc9fe83..5bb5f88 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 _0xe238=['jsforce','desk.js','querystring','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','./plugin.socket','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','get','Plugins','end','error','name','index','Plugin','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','params','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','format','%s%s','headers','content-type','set','statusCode','webhookPost','content-length','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x40eb4f,_0x5964ba){var _0x1ff187=function(_0x4418b0){while(--_0x4418b0){_0x40eb4f['push'](_0x40eb4f['shift']());}};_0x1ff187(++_0x5964ba);}(_0xe238,0x13f));var _0x8e23=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe238[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x8e23('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e23('0x1'));var jsonpatch=require(_0x8e23('0x2'));var rp=require(_0x8e23('0x3'));var moment=require(_0x8e23('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8e23('0x5'));var util=require(_0x8e23('0x6'));var path=require(_0x8e23('0x7'));var sox=require(_0x8e23('0x8'));var csv=require(_0x8e23('0x9'));var ejs=require(_0x8e23('0xa'));var fs=require('fs');var fs_extra=require(_0x8e23('0xb'));var _=require(_0x8e23('0xc'));var squel=require(_0x8e23('0xd'));var crypto=require(_0x8e23('0xe'));var jsforce=require(_0x8e23('0xf'));var deskjs=require(_0x8e23('0x10'));var toCsv=require(_0x8e23('0x9'));var querystring=require(_0x8e23('0x11'));var Papa=require('papaparse');var extract=require(_0x8e23('0x12'));var rimraf=require(_0x8e23('0x13'));var archiver=require(_0x8e23('0x14'));var Redis=require(_0x8e23('0x15'));var authService=require(_0x8e23('0x16'));var qs=require(_0x8e23('0x17'));var as=require(_0x8e23('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e23('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x8e23('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8e23('0x1b')]=_[_0x8e23('0x1c')](config[_0x8e23('0x1b')],{'host':_0x8e23('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e23('0x1b')]));require(_0x8e23('0x1e'))['register'](socket);function respondWithStatusCode(_0x12fbff,_0x15cb2e){_0x15cb2e=_0x15cb2e||0xcc;return function(_0x315a01){if(_0x315a01){return _0x12fbff[_0x8e23('0x1f')](_0x15cb2e);}return _0x12fbff['status'](_0x15cb2e)['end']();};}function respondWithResult(_0x3b2b13,_0x4d7107){_0x4d7107=_0x4d7107||0xc8;return function(_0xe62bf4){if(_0xe62bf4){return _0x3b2b13[_0x8e23('0x20')](_0x4d7107)[_0x8e23('0x21')](_0xe62bf4);}};}function respondWithFilteredResult(_0x108cc9,_0x5e09db){return function(_0x5e88fe){if(_0x5e88fe){var _0xac0885=typeof _0x5e09db[_0x8e23('0x22')]===_0x8e23('0x23')&&typeof _0x5e09db[_0x8e23('0x24')]==='undefined';var _0x3840d0=_0x5e88fe[_0x8e23('0x25')];var _0x3190c1=_0xac0885?0x0:_0x5e09db[_0x8e23('0x22')];var _0x7dfb80=_0xac0885?_0x5e88fe[_0x8e23('0x25')]:_0x5e09db[_0x8e23('0x22')]+_0x5e09db[_0x8e23('0x24')];var _0x105a75;if(_0x7dfb80>=_0x3840d0){_0x7dfb80=_0x3840d0;_0x105a75=0xc8;}else{_0x105a75=0xce;}_0x108cc9[_0x8e23('0x20')](_0x105a75);return _0x108cc9['set']('Content-Range',_0x3190c1+'-'+_0x7dfb80+'/'+_0x3840d0)[_0x8e23('0x21')](_0x5e88fe);}return null;};}function patchUpdates(_0x38e40b){return function(_0x367101){try{jsonpatch[_0x8e23('0x26')](_0x367101,_0x38e40b,!![]);}catch(_0x3ec744){return BPromise[_0x8e23('0x27')](_0x3ec744);}return _0x367101[_0x8e23('0x28')]();};}function saveUpdates(_0x254b6a,_0x16432e){return function(_0x209b1f){if(_0x209b1f){return _0x209b1f[_0x8e23('0x29')](_0x254b6a)['then'](function(_0x428dee){return _0x428dee;});}return null;};}function removeEntity(_0x4a4367,_0x3a8e50){return function(_0x2c19c0){if(_0x2c19c0){return _0x2c19c0[_0x8e23('0x2a')]()[_0x8e23('0x2b')](function(){var _0x5e09c5=_0x2c19c0[_0x8e23('0x2c')]({'plain':!![]});var _0x4064b0=_0x8e23('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x4064b0,'resourceId':_0x5e09c5['id']}})[_0x8e23('0x2b')](function(){return _0x2c19c0;});})[_0x8e23('0x2b')](function(){_0x4a4367[_0x8e23('0x20')](0xcc)[_0x8e23('0x2e')]();});}};}function handleEntityNotFound(_0x11fe2d,_0x4adfcb){return function(_0x12ce20){if(!_0x12ce20){_0x11fe2d['sendStatus'](0x194);}return _0x12ce20;};}function handleError(_0x6f94c2,_0x5ba4ff){_0x5ba4ff=_0x5ba4ff||0x1f4;return function(_0x1b5a7e){logger[_0x8e23('0x2f')](_0x1b5a7e['stack']);if(_0x1b5a7e['name']){delete _0x1b5a7e[_0x8e23('0x30')];}_0x6f94c2['status'](_0x5ba4ff)['send'](_0x1b5a7e);};}exports[_0x8e23('0x31')]=function(_0x1c7a41,_0x1aad12){var _0x29f2e5={},_0x539afd={},_0x343c6d={'count':0x0,'rows':[]};var _0x5044a4=_['map'](db[_0x8e23('0x32')][_0x8e23('0x33')],function(_0x4f37fd){return{'name':_0x4f37fd[_0x8e23('0x34')],'type':_0x4f37fd[_0x8e23('0x35')][_0x8e23('0x36')]};});_0x539afd[_0x8e23('0x37')]=_[_0x8e23('0x38')](_0x5044a4,_0x8e23('0x30'));_0x539afd['query']=_[_0x8e23('0x39')](_0x1c7a41[_0x8e23('0x3a')]);_0x539afd[_0x8e23('0x3b')]=_['intersection'](_0x539afd['model'],_0x539afd['query']);_0x29f2e5['attributes']=_[_0x8e23('0x3c')](_0x539afd[_0x8e23('0x37')],qs['fields'](_0x1c7a41[_0x8e23('0x3a')][_0x8e23('0x3d')]));_0x29f2e5[_0x8e23('0x3e')]=_0x29f2e5['attributes']['length']?_0x29f2e5[_0x8e23('0x3e')]:_0x539afd['model'];if(!_0x1c7a41[_0x8e23('0x3a')]['hasOwnProperty'](_0x8e23('0x3f'))){_0x29f2e5[_0x8e23('0x24')]=qs['limit'](_0x1c7a41[_0x8e23('0x3a')]['limit']);_0x29f2e5[_0x8e23('0x22')]=qs[_0x8e23('0x22')](_0x1c7a41[_0x8e23('0x3a')]['offset']);}_0x29f2e5[_0x8e23('0x40')]=qs[_0x8e23('0x41')](_0x1c7a41[_0x8e23('0x3a')][_0x8e23('0x41')]);_0x29f2e5[_0x8e23('0x42')]=qs[_0x8e23('0x3b')](_['pick'](_0x1c7a41['query'],_0x539afd[_0x8e23('0x3b')]),_0x5044a4);if(_0x1c7a41[_0x8e23('0x3a')][_0x8e23('0x43')]){_0x29f2e5['where']=_[_0x8e23('0x44')](_0x29f2e5[_0x8e23('0x42')],{'$or':_[_0x8e23('0x38')](_0x5044a4,function(_0x88a14){if(_0x88a14[_0x8e23('0x35')]!==_0x8e23('0x45')){var _0x27fafb={};_0x27fafb[_0x88a14[_0x8e23('0x30')]]={'$like':'%'+_0x1c7a41[_0x8e23('0x3a')][_0x8e23('0x43')]+'%'};return _0x27fafb;}})});}_0x29f2e5=_['merge']({},_0x29f2e5,_0x1c7a41['options']);var _0xb8822e={'where':_0x29f2e5[_0x8e23('0x42')]};return db[_0x8e23('0x32')][_0x8e23('0x25')](_0xb8822e)[_0x8e23('0x2b')](function(_0x2c2a07){_0x343c6d[_0x8e23('0x25')]=_0x2c2a07;if(_0x1c7a41[_0x8e23('0x3a')][_0x8e23('0x46')]){_0x29f2e5[_0x8e23('0x47')]=[{'all':!![]}];}return db[_0x8e23('0x32')][_0x8e23('0x48')](_0x29f2e5);})[_0x8e23('0x2b')](function(_0x3931c6){_0x343c6d['rows']=_0x3931c6;return _0x343c6d;})[_0x8e23('0x2b')](respondWithFilteredResult(_0x1aad12,_0x29f2e5))[_0x8e23('0x49')](handleError(_0x1aad12,null));};exports[_0x8e23('0x4a')]=function(_0x259860,_0x338043){var _0x3e2c56={'raw':!![],'where':{'id':_0x259860['params']['id']}},_0x1087df={};_0x1087df[_0x8e23('0x37')]=_[_0x8e23('0x39')](db[_0x8e23('0x32')]['rawAttributes']);_0x1087df[_0x8e23('0x3a')]=_[_0x8e23('0x39')](_0x259860['query']);_0x1087df[_0x8e23('0x3b')]=_[_0x8e23('0x3c')](_0x1087df[_0x8e23('0x37')],_0x1087df[_0x8e23('0x3a')]);_0x3e2c56[_0x8e23('0x3e')]=_[_0x8e23('0x3c')](_0x1087df[_0x8e23('0x37')],qs[_0x8e23('0x3d')](_0x259860[_0x8e23('0x3a')][_0x8e23('0x3d')]));_0x3e2c56[_0x8e23('0x3e')]=_0x3e2c56[_0x8e23('0x3e')]['length']?_0x3e2c56[_0x8e23('0x3e')]:_0x1087df[_0x8e23('0x37')];if(_0x259860[_0x8e23('0x3a')][_0x8e23('0x46')]){_0x3e2c56['include']=[{'all':!![]}];}_0x3e2c56=_[_0x8e23('0x44')]({},_0x3e2c56,_0x259860['options']);return db[_0x8e23('0x32')][_0x8e23('0x4b')](_0x3e2c56)[_0x8e23('0x2b')](handleEntityNotFound(_0x338043,null))[_0x8e23('0x2b')](respondWithResult(_0x338043,null))[_0x8e23('0x49')](handleError(_0x338043,null));};exports[_0x8e23('0x4c')]=function(_0x3e1f3c,_0x26f8a1,_0x17311b){return db[_0x8e23('0x32')][_0x8e23('0x4b')]({'where':{'id':_0x3e1f3c['params']['id']},'attributes':[_0x8e23('0x30'),_0x8e23('0x7')],'raw':!![]})[_0x8e23('0x2b')](handleEntityNotFound(_0x26f8a1,null))[_0x8e23('0x2b')](function(_0x48119b){if(_0x48119b){var _0x43ac57=path[_0x8e23('0x4d')](config[_0x8e23('0x4e')],_0x8e23('0x4f'),util['format'](_0x8e23('0x50'),path[_0x8e23('0x51')](_0x48119b[_0x8e23('0x7')])));var _0x554c13=fs[_0x8e23('0x52')](_0x43ac57);var _0x4f7f20=archiver(_0x8e23('0x53'),{'zlib':{'level':0x9}});_0x4f7f20['on']('warning',function(_0x4335f3){if(_0x4335f3[_0x8e23('0x54')]===_0x8e23('0x55')){logger[_0x8e23('0x2f')](_0x4335f3);}else{throw new db[(_0x8e23('0x56'))][(_0x8e23('0x57'))](_0x8e23('0x58'));}});_0x4f7f20['on']('error',function(_0x2972b6){throw new db['Sequelize'][(_0x8e23('0x57'))](_0x8e23('0x58'));});_0x4f7f20['pipe'](_0x554c13);_0x4f7f20['glob'](_0x8e23('0x59'),{'cwd':path[_0x8e23('0x4d')](config[_0x8e23('0x4e')],_0x8e23('0x4f'),path[_0x8e23('0x5a')](_0x48119b[_0x8e23('0x7')])),'ignore':[path[_0x8e23('0x4d')](path[_0x8e23('0x51')](_0x48119b[_0x8e23('0x7')]),_0x8e23('0x5b')),path[_0x8e23('0x4d')](path[_0x8e23('0x51')](_0x48119b[_0x8e23('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x8e23('0x5c')]();_0x554c13['on'](_0x8e23('0x5d'),function(){if(!fs['existsSync'](_0x43ac57)){throw new db[(_0x8e23('0x56'))][(_0x8e23('0x57'))](_0x8e23('0x5e'));}return _0x26f8a1[_0x8e23('0x4c')](_0x43ac57,util['format'](_0x8e23('0x50'),path['basename'](_0x48119b[_0x8e23('0x7')])),function(_0x27f2b9){if(_0x27f2b9){throw new db[(_0x8e23('0x56'))][(_0x8e23('0x57'))](_0x8e23('0x5f'));}fs[_0x8e23('0x60')](_0x43ac57);logger['info'](_0x8e23('0x61'));logger[_0x8e23('0x62')](_0x8e23('0x63'));});});}return null;})['catch'](handleError(_0x26f8a1,null));};exports['upload']=function(_0x16193d,_0x3785f2,_0x135f37){var _0x4a557d=path[_0x8e23('0x51')](_0x16193d[_0x8e23('0x64')][_0x8e23('0x65')],path['extname'](_0x16193d['file'][_0x8e23('0x65')]));var _0x562427=path[_0x8e23('0x4d')](config[_0x8e23('0x4e')],_0x8e23('0x4f'),_0x16193d['file'][_0x8e23('0x65')]);var _0x1d0d67=path[_0x8e23('0x4d')](config[_0x8e23('0x4e')],_0x8e23('0x4f'),_0x4a557d);logger['info'](_0x8e23('0x66'),_0x562427);logger[_0x8e23('0x62')](_0x8e23('0x67'),_0x1d0d67);try{fs[_0x8e23('0x68')](_0x562427,parseInt(_0x8e23('0x69'),0x8));extract(_0x562427,{'dir':_0x1d0d67},function(_0x262697){if(_0x262697){logger[_0x8e23('0x2f')](_0x262697);handleError(_0x262697,!![]);};var _0x4aba0c=fs[_0x8e23('0x6a')](_0x1d0d67);if(_0x4aba0c[_0x8e23('0x6b')]>0x1){removeReferences(_0x562427,_0x1d0d67);logger[_0x8e23('0x2f')]('Invalid\x20plugin\x20structure');return _0x135f37(new Error(_0x8e23('0x6c')));}var _0x389cfa=fs['lstatSync'](path[_0x8e23('0x4d')](_0x1d0d67,_0x4aba0c[0x0]));if(_0x389cfa[_0x8e23('0x6d')]()){removeReferences(_0x562427,_0x1d0d67);logger[_0x8e23('0x2f')](_0x8e23('0x6c'));return _0x135f37(new Error('Invalid\x20plugin\x20structure'));}if(_0x389cfa[_0x8e23('0x6e')]()){var _0x7bf5c3=fs[_0x8e23('0x6a')](path['join'](_0x1d0d67,_0x4aba0c[0x0]));if(_0x7bf5c3['length']===0x0){removeReferences(_0x562427,_0x1d0d67);logger[_0x8e23('0x2f')](_0x8e23('0x6c'));return _0x135f37(new Error(_0x8e23('0x6c')));}var _0x59a35f=_0x7bf5c3['some'](function(_0x15118f){return _0x15118f===_0x8e23('0x6f');});if(!_0x59a35f){return _0x135f37(new Error(_0x8e23('0x70')));}var _0xa7e175=fs['readFileSync'](path['join'](_0x1d0d67,_0x4aba0c[0x0],'manifest.json'));var _0x5e3a5d=JSON[_0x8e23('0x71')](_0xa7e175);if('undefined'==typeof _0x5e3a5d['name']){return _0x135f37(new Error(_0x8e23('0x72')));}if(_0x8e23('0x23')==typeof _0x5e3a5d[_0x8e23('0x35')]){return _0x135f37(new Error(_0x8e23('0x73')));}if(_0x8e23('0x23')==typeof _0x5e3a5d[_0x8e23('0x74')]){return _0x135f37(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x8e23('0x23')==typeof _0x5e3a5d[_0x8e23('0x75')]){return _0x135f37(new Error(_0x8e23('0x76')));}if(_0x5e3a5d[_0x8e23('0x35')]===_0x8e23('0x77')){if(_0x8e23('0x23')==typeof _0x5e3a5d[_0x8e23('0x75')]['views']){return _0x135f37(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x8e23('0x23')==typeof _0x5e3a5d[_0x8e23('0x75')][_0x8e23('0x78')][_0x8e23('0x79')]&&'undefined'==typeof _0x5e3a5d[_0x8e23('0x75')][_0x8e23('0x78')][_0x8e23('0x7a')]){return _0x135f37(new Error(_0x8e23('0x7b')));}}else if(_0x5e3a5d[_0x8e23('0x35')]==='script'){if(_0x8e23('0x23')==typeof _0x5e3a5d['parameters'][_0x8e23('0x7c')]){return _0x135f37(new Error(_0x8e23('0x7d')));}if(_0x8e23('0x23')==typeof _0x5e3a5d[_0x8e23('0x75')]['scriptPath']){return _0x135f37(new Error(_0x8e23('0x7e')));}}else{return _0x135f37(new Error(_0x8e23('0x7f')));}var _0x19a408=_0x5e3a5d['name'];var _0x39a31d=_0x5e3a5d[_0x8e23('0x80')];var _0x10f455=_0x5e3a5d['type'];var _0x52f953=_0x5e3a5d[_0x8e23('0x81')]?_0x5e3a5d[_0x8e23('0x81')]:_0x8e23('0x82');var _0x4ff914=_0x5e3a5d[_0x8e23('0x83')]?_0x5e3a5d[_0x8e23('0x83')]:'icon-apps';var _0x315f9b='';var _0x14040e='';var _0x1a4f11='';var _0x46809f='';var _0x48efe3=_0x5e3a5d[_0x8e23('0x74')];if(_0x10f455==='html'){if('undefined'!=typeof _0x5e3a5d[_0x8e23('0x75')]['views'][_0x8e23('0x79')]){var _0x4e8664=_0x5e3a5d[_0x8e23('0x75')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8e23('0x84')](_0x4e8664)){_0x315f9b=path['join'](_0x8e23('0x85'),_0x4a557d,_0x4aba0c[0x0],_0x4e8664);}else{_0x315f9b=_0x4e8664;}}else{logger[_0x8e23('0x62')](_0x8e23('0x86'));}if('undefined'!=typeof _0x5e3a5d[_0x8e23('0x75')]['views']['agent']){var _0x5a0f9f=_0x5e3a5d[_0x8e23('0x75')][_0x8e23('0x78')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5a0f9f)){_0x14040e=path['join'](_0x8e23('0x85'),_0x4a557d,_0x4aba0c[0x0],_0x5a0f9f);}else{_0x14040e=_0x5a0f9f;}}else{logger['info'](_0x8e23('0x87'));}}else if(_0x10f455===_0x8e23('0x88')){_0x1a4f11=_0x5e3a5d['parameters'][_0x8e23('0x7c')];_0x46809f=_0x5e3a5d[_0x8e23('0x75')][_0x8e23('0x89')];if('undefined'!=typeof _0x5e3a5d['parameters'][_0x8e23('0x78')]){if(_0x8e23('0x23')!=typeof _0x5e3a5d[_0x8e23('0x75')][_0x8e23('0x78')][_0x8e23('0x79')]){var _0x4e8664=_0x5e3a5d[_0x8e23('0x75')]['views'][_0x8e23('0x79')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4e8664)){_0x315f9b=path[_0x8e23('0x4d')](_0x8e23('0x85'),_0x4a557d,_0x4aba0c[0x0],_0x4e8664);}else{_0x315f9b=_0x4e8664;}}if('undefined'!=typeof _0x5e3a5d['parameters'][_0x8e23('0x78')][_0x8e23('0x7a')]){var _0x5a0f9f=_0x5e3a5d[_0x8e23('0x75')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5a0f9f)){_0x14040e=path[_0x8e23('0x4d')](_0x8e23('0x85'),_0x4a557d,_0x4aba0c[0x0],_0x5a0f9f);}else{_0x14040e=_0x5a0f9f;}}}}var _0x299c90={'name':_0x19a408,'description':_0x39a31d,'path':path[_0x8e23('0x4d')](_0x4a557d,_0x4aba0c[0x0]),'type':_0x10f455,'sidebar':_0x52f953,'icon':_0x4ff914,'adminUrl':_0x315f9b,'agentUrl':_0x14040e,'scriptName':_0x1a4f11,'scriptPath':_0x46809f,'version':_0x48efe3};removeReferences(_0x562427,null);return db[_0x8e23('0x32')][_0x8e23('0x8a')](_0x299c90)['then'](function(_0x5c0f62){var _0x4f872f={'role':_0x16193d[_0x8e23('0x8b')][_0x8e23('0x8c')],'userProfileId':_0x16193d['body'][_0x8e23('0x8d')]};if(!_0x4f872f)throw new Error(_0x8e23('0x8e'));if(_0x4f872f[_0x8e23('0x8c')]===_0x8e23('0x8f')){var _0x58ef34=_0x5c0f62[_0x8e23('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0x8e23('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x4f872f[_0x8e23('0x8d')]},'raw':!![]})['then'](function(_0x2e9f0f){if(_0x2e9f0f&&_0x2e9f0f[_0x8e23('0x90')]===0x0){return db[_0x8e23('0x91')]['create']({'name':_0x58ef34[_0x8e23('0x30')],'resourceId':_0x58ef34['id'],'type':_0x2e9f0f['name'],'sectionId':_0x2e9f0f['id']},{})[_0x8e23('0x2b')](function(){return _0x5c0f62;});}else{return _0x5c0f62;}})[_0x8e23('0x49')](function(_0x29d927){logger[_0x8e23('0x2f')](_0x8e23('0x92'),_0x29d927);throw _0x29d927;});}return _0x5c0f62;})[_0x8e23('0x2b')](respondWithResult(_0x3785f2,null))[_0x8e23('0x49')](handleError(_0x3785f2,null));}});}catch(_0x12f756){_0x3785f2[_0x8e23('0x20')](0x1f4)[_0x8e23('0x93')](_0x12f756);}};function removeReferences(_0x33b0cf,_0x244509){try{if(_0x33b0cf){fs[_0x8e23('0x60')](_0x33b0cf);logger['info'](_0x8e23('0x94'));}if(_0x244509){rimraf(_0x244509,function(){});logger[_0x8e23('0x62')]('Extracted\x20folder\x20removed');}}catch(_0x1c5103){logger[_0x8e23('0x2f')](_0x1c5103);}}exports[_0x8e23('0x29')]=function(_0xc128e1,_0x545788,_0x532d6c){return db['Plugin'][_0x8e23('0x4b')]({'where':{'id':_0xc128e1[_0x8e23('0x95')]['id']}})[_0x8e23('0x2b')](handleEntityNotFound(_0x545788,null))['then'](saveUpdates(_0xc128e1[_0x8e23('0x8b')],null))[_0x8e23('0x2b')](respondWithResult(_0x545788,null))[_0x8e23('0x49')](handleError(_0x545788,null));};exports[_0x8e23('0x96')]=function(_0x8771d2,_0xa968ab,_0x21fc78){return db[_0x8e23('0x32')][_0x8e23('0x4b')]({'where':{'id':_0x8771d2['params']['id']}})[_0x8e23('0x2b')](function(_0x376258){if(_0x376258){return _0x376258[_0x8e23('0x2a')]();}})[_0x8e23('0x2b')](function(_0x410986){rimraf(path[_0x8e23('0x4d')](config['root'],_0x8e23('0x4f'),path[_0x8e23('0x5a')](_0x410986['path'])),function(){});return _0x410986;})[_0x8e23('0x2b')](handleEntityNotFound(_0xa968ab,null))[_0x8e23('0x2b')](respondWithStatusCode(_0xa968ab,null))['catch'](handleError(_0xa968ab,null));};exports[_0x8e23('0x97')]=function(_0x4e38ed,_0x3d1618,_0x56150f){return BPromise[_0x8e23('0x98')]()[_0x8e23('0x2b')](function(){if(!_0x4e38ed[_0x8e23('0x3a')][_0x8e23('0x7')]){throw new Error(_0x8e23('0x99'));}if(!_0x4e38ed[_0x8e23('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xbf5ba3=_0x4e38ed[_0x8e23('0x3a')][_0x8e23('0x9a')]?_0x4e38ed['query'][_0x8e23('0x9a')]+':'+_0x4e38ed[_0x8e23('0x3a')][_0x8e23('0x9b')]:_0x8e23('0x9c')+_0x4e38ed[_0x8e23('0x3a')][_0x8e23('0x9b')];var _0x524285=_0x4e38ed[_0x8e23('0x3a')][_0x8e23('0x21')]?_0x4e38ed['query'][_0x8e23('0x21')]:!![];var _0x52334a=_0x4e38ed[_0x8e23('0x3a')][_0x8e23('0x9d')]?_0x4e38ed[_0x8e23('0x3a')]['encoding']:null;var _0x5dc75d={'method':_0x4e38ed[_0x8e23('0x9e')],'uri':util[_0x8e23('0x9f')](_0x8e23('0xa0'),_0xbf5ba3,_0x4e38ed['query'][_0x8e23('0x7')]),'json':_0x524285,'resolveWithFullResponse':!![],'encoding':_0x52334a,'qs':_0x4e38ed[_0x8e23('0x3a')]};if(_0x4e38ed['headers']){_0x5dc75d[_0x8e23('0xa1')]=_0x4e38ed[_0x8e23('0xa1')];if(_0x5dc75d[_0x8e23('0xa1')]['content-length']){delete _0x5dc75d[_0x8e23('0xa1')]['content-length'];}}if(_0x5dc75d['headers'][_0x8e23('0xa2')]){delete _0x5dc75d['headers'][_0x8e23('0xa2')];}return rp(_0x5dc75d);})[_0x8e23('0x2b')](function(_0xd5de0e){if(_0xd5de0e){_0x3d1618[_0x8e23('0xa3')](_0xd5de0e[_0x8e23('0xa1')]);logger[_0x8e23('0x62')](_0xd5de0e[_0x8e23('0x8b')]);if(_['endsWith'](_0x4e38ed[_0x8e23('0x3a')][_0x8e23('0x7')],_0x8e23('0x4c'))&&_0xd5de0e[_0x8e23('0xa4')]==0x1f4){return _0x3d1618['sendStatus'](_0xd5de0e[_0x8e23('0xa4')]);}else{return _0x3d1618[_0x8e23('0x20')](_0xd5de0e[_0x8e23('0xa4')])[_0x8e23('0x93')](_0xd5de0e[_0x8e23('0x8b')]);}}else{return _0x3d1618[_0x8e23('0x1f')](0xc8);}})[_0x8e23('0x49')](handleError(_0x3d1618,null));};exports[_0x8e23('0xa5')]=function(_0x48c50d,_0x2f241e,_0x2d7240){return BPromise[_0x8e23('0x98')]()[_0x8e23('0x2b')](function(){if(!_0x48c50d[_0x8e23('0x3a')][_0x8e23('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x48c50d['query'][_0x8e23('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x109988=_0x48c50d[_0x8e23('0x3a')][_0x8e23('0x9a')]?_0x48c50d['query'][_0x8e23('0x9a')]+':'+_0x48c50d[_0x8e23('0x3a')][_0x8e23('0x9b')]:'http://localhost:'+_0x48c50d['query']['port'];var _0x1601fd=_0x48c50d[_0x8e23('0x3a')]['json']?_0x48c50d[_0x8e23('0x3a')]['json']:!![];var _0x4f73c8=_0x48c50d[_0x8e23('0x3a')]['encoding']?_0x48c50d[_0x8e23('0x3a')][_0x8e23('0x9d')]:null;var _0x5af7f6={'method':_0x48c50d[_0x8e23('0x9e')],'uri':util['format'](_0x8e23('0xa0'),_0x109988,_0x48c50d[_0x8e23('0x3a')][_0x8e23('0x7')]),'json':_0x1601fd,'resolveWithFullResponse':!![],'encoding':_0x4f73c8,'body':_0x48c50d[_0x8e23('0x8b')]};if(_0x48c50d[_0x8e23('0xa1')]){_0x5af7f6['headers']=_0x48c50d[_0x8e23('0xa1')];if(_0x5af7f6[_0x8e23('0xa1')][_0x8e23('0xa6')]){delete _0x5af7f6[_0x8e23('0xa1')][_0x8e23('0xa6')];}}if(_0x5af7f6[_0x8e23('0xa1')][_0x8e23('0xa2')]){delete _0x5af7f6[_0x8e23('0xa1')][_0x8e23('0xa2')];}return rp(_0x5af7f6);})[_0x8e23('0x2b')](function(_0x26baa9){if(_0x26baa9){_0x2f241e[_0x8e23('0xa3')](_0x26baa9[_0x8e23('0xa1')]);logger[_0x8e23('0x62')](_0x26baa9[_0x8e23('0x8b')]);return _0x2f241e[_0x8e23('0x20')](_0x26baa9[_0x8e23('0xa4')])['send'](_0x26baa9[_0x8e23('0x8b')]);}else{return _0x2f241e[_0x8e23('0x1f')](0xc8);}})[_0x8e23('0x49')](handleError(_0x2f241e,null));}; \ No newline at end of file +var _0xce2e=['resolve','\x27PATH\x27\x20parameter\x20not\x20specified','encoding','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','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','./plugin.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','rows','catch','find','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','finalize','Error','unlinkSync','info','upload','file','filename','extname','chmodSync','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','autoAssociation','delete','webhookGet','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','json','method','headers','content-length','content-type','statusCode','webhookPost'];(function(_0xd5c0fa,_0x4a3a44){var _0x3ce748=function(_0x8fc329){while(--_0x8fc329){_0xd5c0fa['push'](_0xd5c0fa['shift']());}};_0x3ce748(++_0x4a3a44);}(_0xce2e,0x146));var _0xece2=function(_0x29483a,_0x25ce96){_0x29483a=_0x29483a-0x0;var _0x335089=_0xce2e[_0x29483a];return _0x335089;};'use strict';var emlformat=require(_0xece2('0x0'));var rimraf=require(_0xece2('0x1'));var zipdir=require(_0xece2('0x2'));var jsonpatch=require(_0xece2('0x3'));var rp=require(_0xece2('0x4'));var moment=require(_0xece2('0x5'));var BPromise=require(_0xece2('0x6'));var Mustache=require(_0xece2('0x7'));var util=require(_0xece2('0x8'));var path=require(_0xece2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xece2('0xa'));var _=require(_0xece2('0xb'));var squel=require('squel');var crypto=require(_0xece2('0xc'));var jsforce=require(_0xece2('0xd'));var deskjs=require(_0xece2('0xe'));var toCsv=require(_0xece2('0xf'));var querystring=require(_0xece2('0x10'));var Papa=require(_0xece2('0x11'));var extract=require(_0xece2('0x12'));var rimraf=require(_0xece2('0x1'));var archiver=require(_0xece2('0x13'));var Redis=require(_0xece2('0x14'));var authService=require(_0xece2('0x15'));var qs=require(_0xece2('0x16'));var as=require(_0xece2('0x17'));var hardwareService=require(_0xece2('0x18'));var logger=require(_0xece2('0x19'))(_0xece2('0x1a'));var utils=require('../../config/utils');var config=require(_0xece2('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xece2('0x1c'))['db'];config[_0xece2('0x1d')]=_[_0xece2('0x1e')](config[_0xece2('0x1d')],{'host':_0xece2('0x1f'),'port':0x18eb});var socket=require(_0xece2('0x20'))(new Redis(config[_0xece2('0x1d')]));require(_0xece2('0x21'))['register'](socket);function respondWithStatusCode(_0xa6d9fd,_0x22eac0){_0x22eac0=_0x22eac0||0xcc;return function(_0x4c1378){if(_0x4c1378){return _0xa6d9fd[_0xece2('0x22')](_0x22eac0);}return _0xa6d9fd[_0xece2('0x23')](_0x22eac0)[_0xece2('0x24')]();};}function respondWithResult(_0x36cde3,_0x1074ee){_0x1074ee=_0x1074ee||0xc8;return function(_0x20b49e){if(_0x20b49e){return _0x36cde3['status'](_0x1074ee)['json'](_0x20b49e);}};}function respondWithFilteredResult(_0x3519c5,_0x180ff1){return function(_0x1cdd86){if(_0x1cdd86){var _0x355b07=typeof _0x180ff1[_0xece2('0x25')]===_0xece2('0x26')&&typeof _0x180ff1[_0xece2('0x27')]===_0xece2('0x26');var _0xbc5f11=_0x1cdd86[_0xece2('0x28')];var _0x9fc500=_0x355b07?0x0:_0x180ff1[_0xece2('0x25')];var _0x250af9=_0x355b07?_0x1cdd86[_0xece2('0x28')]:_0x180ff1['offset']+_0x180ff1[_0xece2('0x27')];var _0x4789ef;if(_0x250af9>=_0xbc5f11){_0x250af9=_0xbc5f11;_0x4789ef=0xc8;}else{_0x4789ef=0xce;}_0x3519c5[_0xece2('0x23')](_0x4789ef);return _0x3519c5[_0xece2('0x29')](_0xece2('0x2a'),_0x9fc500+'-'+_0x250af9+'/'+_0xbc5f11)['json'](_0x1cdd86);}return null;};}function patchUpdates(_0x45e9f2){return function(_0x332fed){try{jsonpatch['apply'](_0x332fed,_0x45e9f2,!![]);}catch(_0x40d8e5){return BPromise[_0xece2('0x2b')](_0x40d8e5);}return _0x332fed[_0xece2('0x2c')]();};}function saveUpdates(_0x2bd679,_0x320294){return function(_0x1b17a7){if(_0x1b17a7){return _0x1b17a7[_0xece2('0x2d')](_0x2bd679)[_0xece2('0x2e')](function(_0x29c861){return _0x29c861;});}return null;};}function removeEntity(_0x47f8e0,_0x5d880c){return function(_0x35a30c){if(_0x35a30c){return _0x35a30c[_0xece2('0x2f')]()[_0xece2('0x2e')](function(){var _0x5b636c=_0x35a30c[_0xece2('0x30')]({'plain':!![]});var _0x35846a='Plugins';return db[_0xece2('0x31')][_0xece2('0x2f')]({'where':{'type':_0x35846a,'resourceId':_0x5b636c['id']}})[_0xece2('0x2e')](function(){return _0x35a30c;});})[_0xece2('0x2e')](function(){_0x47f8e0[_0xece2('0x23')](0xcc)[_0xece2('0x24')]();});}};}function handleEntityNotFound(_0x38d04e,_0x16e310){return function(_0x4556ff){if(!_0x4556ff){_0x38d04e[_0xece2('0x22')](0x194);}return _0x4556ff;};}function handleError(_0x36ab4e,_0x21776c){_0x21776c=_0x21776c||0x1f4;return function(_0x2e2b75){logger[_0xece2('0x32')](_0x2e2b75[_0xece2('0x33')]);if(_0x2e2b75[_0xece2('0x34')]){delete _0x2e2b75['name'];}_0x36ab4e[_0xece2('0x23')](_0x21776c)[_0xece2('0x35')](_0x2e2b75);};}exports[_0xece2('0x36')]=function(_0xe74fc7,_0x517830){var _0x397e3a={},_0x21ccf9={},_0x4a62f6={'count':0x0,'rows':[]};var _0x1b1cb5=_[_0xece2('0x37')](db[_0xece2('0x38')][_0xece2('0x39')],function(_0x43fe6a){return{'name':_0x43fe6a[_0xece2('0x3a')],'type':_0x43fe6a[_0xece2('0x3b')]['key']};});_0x21ccf9[_0xece2('0x3c')]=_[_0xece2('0x37')](_0x1b1cb5,'name');_0x21ccf9[_0xece2('0x3d')]=_[_0xece2('0x3e')](_0xe74fc7[_0xece2('0x3d')]);_0x21ccf9[_0xece2('0x3f')]=_[_0xece2('0x40')](_0x21ccf9[_0xece2('0x3c')],_0x21ccf9['query']);_0x397e3a[_0xece2('0x41')]=_[_0xece2('0x40')](_0x21ccf9[_0xece2('0x3c')],qs[_0xece2('0x42')](_0xe74fc7[_0xece2('0x3d')][_0xece2('0x42')]));_0x397e3a[_0xece2('0x41')]=_0x397e3a[_0xece2('0x41')][_0xece2('0x43')]?_0x397e3a[_0xece2('0x41')]:_0x21ccf9['model'];if(!_0xe74fc7[_0xece2('0x3d')]['hasOwnProperty'](_0xece2('0x44'))){_0x397e3a[_0xece2('0x27')]=qs[_0xece2('0x27')](_0xe74fc7[_0xece2('0x3d')]['limit']);_0x397e3a[_0xece2('0x25')]=qs[_0xece2('0x25')](_0xe74fc7[_0xece2('0x3d')]['offset']);}_0x397e3a[_0xece2('0x45')]=qs['sort'](_0xe74fc7['query']['sort']);_0x397e3a[_0xece2('0x46')]=qs['filters'](_[_0xece2('0x47')](_0xe74fc7[_0xece2('0x3d')],_0x21ccf9[_0xece2('0x3f')]),_0x1b1cb5);if(_0xe74fc7[_0xece2('0x3d')][_0xece2('0x48')]){_0x397e3a[_0xece2('0x46')]=_['merge'](_0x397e3a[_0xece2('0x46')],{'$or':_['map'](_0x1b1cb5,function(_0x4df055){if(_0x4df055[_0xece2('0x3b')]!==_0xece2('0x49')){var _0x2f6956={};_0x2f6956[_0x4df055[_0xece2('0x34')]]={'$like':'%'+_0xe74fc7[_0xece2('0x3d')][_0xece2('0x48')]+'%'};return _0x2f6956;}})});}_0x397e3a=_['merge']({},_0x397e3a,_0xe74fc7[_0xece2('0x4a')]);var _0x4fcb4f={'where':_0x397e3a[_0xece2('0x46')]};return db[_0xece2('0x38')]['count'](_0x4fcb4f)[_0xece2('0x2e')](function(_0x5dd62b){_0x4a62f6[_0xece2('0x28')]=_0x5dd62b;if(_0xe74fc7['query'][_0xece2('0x4b')]){_0x397e3a['include']=[{'all':!![]}];}return db[_0xece2('0x38')]['findAll'](_0x397e3a);})['then'](function(_0x54f2da){_0x4a62f6[_0xece2('0x4c')]=_0x54f2da;return _0x4a62f6;})['then'](respondWithFilteredResult(_0x517830,_0x397e3a))[_0xece2('0x4d')](handleError(_0x517830,null));};exports['show']=function(_0xfafeb7,_0x440c09){var _0x5edd0c={'raw':!![],'where':{'id':_0xfafeb7['params']['id']}},_0x39fead={};_0x39fead[_0xece2('0x3c')]=_[_0xece2('0x3e')](db[_0xece2('0x38')][_0xece2('0x39')]);_0x39fead['query']=_['keys'](_0xfafeb7[_0xece2('0x3d')]);_0x39fead[_0xece2('0x3f')]=_['intersection'](_0x39fead[_0xece2('0x3c')],_0x39fead[_0xece2('0x3d')]);_0x5edd0c['attributes']=_['intersection'](_0x39fead['model'],qs['fields'](_0xfafeb7[_0xece2('0x3d')][_0xece2('0x42')]));_0x5edd0c[_0xece2('0x41')]=_0x5edd0c['attributes'][_0xece2('0x43')]?_0x5edd0c[_0xece2('0x41')]:_0x39fead[_0xece2('0x3c')];if(_0xfafeb7[_0xece2('0x3d')]['includeAll']){_0x5edd0c['include']=[{'all':!![]}];}_0x5edd0c=_['merge']({},_0x5edd0c,_0xfafeb7[_0xece2('0x4a')]);return db['Plugin'][_0xece2('0x4e')](_0x5edd0c)[_0xece2('0x2e')](handleEntityNotFound(_0x440c09,null))[_0xece2('0x2e')](respondWithResult(_0x440c09,null))[_0xece2('0x4d')](handleError(_0x440c09,null));};exports[_0xece2('0x4f')]=function(_0x66cd6e,_0x52658a,_0x161fa3){return db['Plugin']['find']({'where':{'id':_0x66cd6e[_0xece2('0x50')]['id']},'attributes':[_0xece2('0x34'),_0xece2('0x9')],'raw':!![]})['then'](handleEntityNotFound(_0x52658a,null))[_0xece2('0x2e')](function(_0x745d11){if(_0x745d11){var _0x571d57=path[_0xece2('0x51')](config[_0xece2('0x52')],_0xece2('0x53'),util[_0xece2('0x54')](_0xece2('0x55'),path[_0xece2('0x56')](_0x745d11[_0xece2('0x9')])));var _0x46d889=fs[_0xece2('0x57')](_0x571d57);var _0x3ad07b=archiver(_0xece2('0x58'),{'zlib':{'level':0x9}});_0x3ad07b['on'](_0xece2('0x59'),function(_0x37a196){if(_0x37a196[_0xece2('0x5a')]===_0xece2('0x5b')){logger[_0xece2('0x32')](_0x37a196);}else{throw new db[(_0xece2('0x5c'))]['Error'](_0xece2('0x5d'));}});_0x3ad07b['on']('error',function(_0x41519c){throw new db[(_0xece2('0x5c'))]['Error'](_0xece2('0x5d'));});_0x3ad07b[_0xece2('0x5e')](_0x46d889);_0x3ad07b['glob'](_0xece2('0x5f'),{'cwd':path[_0xece2('0x51')](config['root'],_0xece2('0x53'),path[_0xece2('0x60')](_0x745d11[_0xece2('0x9')])),'ignore':[path['join'](path[_0xece2('0x56')](_0x745d11[_0xece2('0x9')]),_0xece2('0x61')),path[_0xece2('0x51')](path['basename'](_0x745d11[_0xece2('0x9')]),'attachments/**/*')],'nodir':!![]})[_0xece2('0x62')]();_0x46d889['on']('close',function(){if(!fs['existsSync'](_0x571d57)){throw new db['Sequelize'][(_0xece2('0x63'))]('Plugin\x20not\x20found');}return _0x52658a[_0xece2('0x4f')](_0x571d57,util[_0xece2('0x54')]('%s.zip',path[_0xece2('0x56')](_0x745d11['path'])),function(_0xdd7f6){if(_0xdd7f6){throw new db[(_0xece2('0x5c'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xece2('0x64')](_0x571d57);logger['info']('Download\x20completed');logger[_0xece2('0x65')]('Temporary\x20file\x20removed');});});}return null;})[_0xece2('0x4d')](handleError(_0x52658a,null));};exports[_0xece2('0x66')]=function(_0x415859,_0x356e7c,_0x2a7cc4){var _0x4108dc=path[_0xece2('0x56')](_0x415859[_0xece2('0x67')][_0xece2('0x68')],path[_0xece2('0x69')](_0x415859[_0xece2('0x67')][_0xece2('0x68')]));var _0x2a3908=path[_0xece2('0x51')](config[_0xece2('0x52')],'server/files/plugins',_0x415859[_0xece2('0x67')][_0xece2('0x68')]);var _0x2adfeb=path[_0xece2('0x51')](config[_0xece2('0x52')],_0xece2('0x53'),_0x4108dc);logger[_0xece2('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x2a3908);logger[_0xece2('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x2adfeb);try{fs[_0xece2('0x6a')](_0x2a3908,parseInt('0777',0x8));extract(_0x2a3908,{'dir':_0x2adfeb},function(_0x7178cf){if(_0x7178cf){logger[_0xece2('0x32')](_0x7178cf);handleError(_0x7178cf,!![]);};var _0xab043e=fs['readdirSync'](_0x2adfeb);if(_0xab043e[_0xece2('0x43')]>0x1){removeReferences(_0x2a3908,_0x2adfeb);logger[_0xece2('0x32')](_0xece2('0x6b'));return _0x2a7cc4(new Error(_0xece2('0x6b')));}var _0x3b7205=fs['lstatSync'](path[_0xece2('0x51')](_0x2adfeb,_0xab043e[0x0]));if(_0x3b7205[_0xece2('0x6c')]()){removeReferences(_0x2a3908,_0x2adfeb);logger['error'](_0xece2('0x6b'));return _0x2a7cc4(new Error(_0xece2('0x6b')));}if(_0x3b7205[_0xece2('0x6d')]()){var _0x1e171a=fs[_0xece2('0x6e')](path['join'](_0x2adfeb,_0xab043e[0x0]));if(_0x1e171a[_0xece2('0x43')]===0x0){removeReferences(_0x2a3908,_0x2adfeb);logger['error'](_0xece2('0x6b'));return _0x2a7cc4(new Error(_0xece2('0x6b')));}var _0x488205=_0x1e171a[_0xece2('0x6f')](function(_0x41cc03){return _0x41cc03===_0xece2('0x70');});if(!_0x488205){return _0x2a7cc4(new Error(_0xece2('0x71')));}var _0x28852a=fs[_0xece2('0x72')](path[_0xece2('0x51')](_0x2adfeb,_0xab043e[0x0],'manifest.json'));var _0x27c78d=JSON[_0xece2('0x73')](_0x28852a);if(_0xece2('0x26')==typeof _0x27c78d[_0xece2('0x34')]){return _0x2a7cc4(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xece2('0x26')==typeof _0x27c78d[_0xece2('0x3b')]){return _0x2a7cc4(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xece2('0x26')==typeof _0x27c78d[_0xece2('0x74')]){return _0x2a7cc4(new Error(_0xece2('0x75')));}if(_0xece2('0x26')==typeof _0x27c78d['parameters']){return _0x2a7cc4(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x27c78d[_0xece2('0x3b')]===_0xece2('0x76')){if(_0xece2('0x26')==typeof _0x27c78d['parameters'][_0xece2('0x77')]){return _0x2a7cc4(new Error(_0xece2('0x78')));}if('undefined'==typeof _0x27c78d[_0xece2('0x79')][_0xece2('0x77')][_0xece2('0x7a')]&&_0xece2('0x26')==typeof _0x27c78d[_0xece2('0x79')][_0xece2('0x77')]['agent']){return _0x2a7cc4(new Error(_0xece2('0x7b')));}}else if(_0x27c78d[_0xece2('0x3b')]==='script'){if(_0xece2('0x26')==typeof _0x27c78d[_0xece2('0x79')][_0xece2('0x7c')]){return _0x2a7cc4(new Error(_0xece2('0x7d')));}if('undefined'==typeof _0x27c78d[_0xece2('0x79')][_0xece2('0x7e')]){return _0x2a7cc4(new Error(_0xece2('0x7f')));}}else{return _0x2a7cc4(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x292db7=_0x27c78d[_0xece2('0x34')];var _0x17c519=_0x27c78d[_0xece2('0x80')];var _0x35377f=_0x27c78d[_0xece2('0x3b')];var _0x35f57e=_0x27c78d[_0xece2('0x81')]?_0x27c78d[_0xece2('0x81')]:_0xece2('0x82');var _0x22d402=_0x27c78d[_0xece2('0x83')]?_0x27c78d['icon']:'icon-apps';var _0x482c25='';var _0x2bfedf='';var _0x562f02='';var _0x41e076='';var _0x2a131e=_0x27c78d[_0xece2('0x74')];if(_0x35377f===_0xece2('0x76')){if(_0xece2('0x26')!=typeof _0x27c78d[_0xece2('0x79')][_0xece2('0x77')]['admin']){var _0x5e292e=_0x27c78d[_0xece2('0x79')][_0xece2('0x77')][_0xece2('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xece2('0x84')](_0x5e292e)){_0x482c25=path[_0xece2('0x51')](_0xece2('0x85'),_0x4108dc,_0xab043e[0x0],_0x5e292e);}else{_0x482c25=_0x5e292e;}}else{logger[_0xece2('0x65')](_0xece2('0x86'));}if(_0xece2('0x26')!=typeof _0x27c78d['parameters']['views'][_0xece2('0x87')]){var _0x4355aa=_0x27c78d[_0xece2('0x79')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xece2('0x84')](_0x4355aa)){_0x2bfedf=path[_0xece2('0x51')](_0xece2('0x85'),_0x4108dc,_0xab043e[0x0],_0x4355aa);}else{_0x2bfedf=_0x4355aa;}}else{logger[_0xece2('0x65')](_0xece2('0x88'));}}else if(_0x35377f==='script'){_0x562f02=_0x27c78d['parameters'][_0xece2('0x7c')];_0x41e076=_0x27c78d[_0xece2('0x79')][_0xece2('0x7e')];if(_0xece2('0x26')!=typeof _0x27c78d[_0xece2('0x79')][_0xece2('0x77')]){if(_0xece2('0x26')!=typeof _0x27c78d[_0xece2('0x79')]['views']['admin']){var _0x5e292e=_0x27c78d[_0xece2('0x79')][_0xece2('0x77')][_0xece2('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xece2('0x84')](_0x5e292e)){_0x482c25=path['join']('plugins',_0x4108dc,_0xab043e[0x0],_0x5e292e);}else{_0x482c25=_0x5e292e;}}if(_0xece2('0x26')!=typeof _0x27c78d['parameters'][_0xece2('0x77')][_0xece2('0x87')]){var _0x4355aa=_0x27c78d[_0xece2('0x79')][_0xece2('0x77')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4355aa)){_0x2bfedf=path['join'](_0xece2('0x85'),_0x4108dc,_0xab043e[0x0],_0x4355aa);}else{_0x2bfedf=_0x4355aa;}}}}var _0x48d7cd={'name':_0x292db7,'description':_0x17c519,'path':path[_0xece2('0x51')](_0x4108dc,_0xab043e[0x0]),'type':_0x35377f,'sidebar':_0x35f57e,'icon':_0x22d402,'adminUrl':_0x482c25,'agentUrl':_0x2bfedf,'scriptName':_0x562f02,'scriptPath':_0x41e076,'version':_0x2a131e};removeReferences(_0x2a3908,null);return db['Plugin'][_0xece2('0x89')](_0x48d7cd)['then'](function(_0x41879e){var _0xf73289={'role':_0x415859[_0xece2('0x8a')]['role'],'userProfileId':_0x415859[_0xece2('0x8a')][_0xece2('0x8b')]};if(!_0xf73289)throw new Error(_0xece2('0x8c'));if(_0xf73289['role']==='user'){var _0x27d724=_0x41879e['get']({'plain':!![]});return db[_0xece2('0x8d')]['find']({'where':{'name':_0xece2('0x8e'),'userProfileId':_0xf73289[_0xece2('0x8b')]},'raw':!![]})['then'](function(_0x2ee3f7){if(_0x2ee3f7&&_0x2ee3f7[_0xece2('0x8f')]===0x0){return db[_0xece2('0x31')][_0xece2('0x89')]({'name':_0x27d724[_0xece2('0x34')],'resourceId':_0x27d724['id'],'type':_0x2ee3f7[_0xece2('0x34')],'sectionId':_0x2ee3f7['id']},{})[_0xece2('0x2e')](function(){return _0x41879e;});}else{return _0x41879e;}})[_0xece2('0x4d')](function(_0x273660){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x273660);throw _0x273660;});}return _0x41879e;})[_0xece2('0x2e')](respondWithResult(_0x356e7c,null))['catch'](handleError(_0x356e7c,null));}});}catch(_0x44db37){_0x356e7c[_0xece2('0x23')](0x1f4)[_0xece2('0x35')](_0x44db37);}};function removeReferences(_0x125449,_0x4f2498){try{if(_0x125449){fs[_0xece2('0x64')](_0x125449);logger[_0xece2('0x65')]('Zip\x20archive\x20removed');}if(_0x4f2498){rimraf(_0x4f2498,function(){});logger[_0xece2('0x65')]('Extracted\x20folder\x20removed');}}catch(_0x628b07){logger[_0xece2('0x32')](_0x628b07);}}exports[_0xece2('0x2d')]=function(_0xf89755,_0x324e6f,_0xe5104d){return db['Plugin'][_0xece2('0x4e')]({'where':{'id':_0xf89755['params']['id']}})['then'](handleEntityNotFound(_0x324e6f,null))[_0xece2('0x2e')](saveUpdates(_0xf89755[_0xece2('0x8a')],null))[_0xece2('0x2e')](respondWithResult(_0x324e6f,null))[_0xece2('0x4d')](handleError(_0x324e6f,null));};exports[_0xece2('0x90')]=function(_0x9d022b,_0x1c1cc0,_0xbcb493){return db[_0xece2('0x38')][_0xece2('0x4e')]({'where':{'id':_0x9d022b[_0xece2('0x50')]['id']}})[_0xece2('0x2e')](function(_0x346263){if(_0x346263){return _0x346263[_0xece2('0x2f')]();}})[_0xece2('0x2e')](function(_0x1ce357){rimraf(path['join'](config['root'],_0xece2('0x53'),path[_0xece2('0x60')](_0x1ce357['path'])),function(){});return _0x1ce357;})[_0xece2('0x2e')](handleEntityNotFound(_0x1c1cc0,null))[_0xece2('0x2e')](respondWithStatusCode(_0x1c1cc0,null))[_0xece2('0x4d')](handleError(_0x1c1cc0,null));};exports[_0xece2('0x91')]=function(_0x24c1f5,_0x57d462,_0x65971a){return BPromise['resolve']()[_0xece2('0x2e')](function(){if(!_0x24c1f5[_0xece2('0x3d')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x24c1f5[_0xece2('0x3d')]['port']){throw new Error(_0xece2('0x92'));}var _0x267ef7=_0x24c1f5[_0xece2('0x3d')][_0xece2('0x93')]?_0x24c1f5['query'][_0xece2('0x93')]+':'+_0x24c1f5['query'][_0xece2('0x94')]:_0xece2('0x95')+_0x24c1f5['query'][_0xece2('0x94')];var _0x144bfa=_0x24c1f5[_0xece2('0x3d')]['json']?_0x24c1f5[_0xece2('0x3d')][_0xece2('0x96')]:!![];var _0x1b30ee=_0x24c1f5[_0xece2('0x3d')]['encoding']?_0x24c1f5['query']['encoding']:null;var _0x1d4bb3={'method':_0x24c1f5[_0xece2('0x97')],'uri':util[_0xece2('0x54')]('%s%s',_0x267ef7,_0x24c1f5[_0xece2('0x3d')][_0xece2('0x9')]),'json':_0x144bfa,'resolveWithFullResponse':!![],'encoding':_0x1b30ee,'qs':_0x24c1f5[_0xece2('0x3d')]};if(_0x24c1f5[_0xece2('0x98')]){_0x1d4bb3[_0xece2('0x98')]=_0x24c1f5[_0xece2('0x98')];if(_0x1d4bb3[_0xece2('0x98')][_0xece2('0x99')]){delete _0x1d4bb3[_0xece2('0x98')]['content-length'];}}if(_0x1d4bb3[_0xece2('0x98')]['content-type']){delete _0x1d4bb3[_0xece2('0x98')][_0xece2('0x9a')];}return rp(_0x1d4bb3);})[_0xece2('0x2e')](function(_0x4a0f38){if(_0x4a0f38){_0x57d462[_0xece2('0x29')](_0x4a0f38[_0xece2('0x98')]);logger[_0xece2('0x65')](_0x4a0f38['body']);if(_['endsWith'](_0x24c1f5['query'][_0xece2('0x9')],_0xece2('0x4f'))&&_0x4a0f38[_0xece2('0x9b')]==0x1f4){return _0x57d462['sendStatus'](_0x4a0f38[_0xece2('0x9b')]);}else{return _0x57d462[_0xece2('0x23')](_0x4a0f38[_0xece2('0x9b')])[_0xece2('0x35')](_0x4a0f38[_0xece2('0x8a')]);}}else{return _0x57d462[_0xece2('0x22')](0xc8);}})[_0xece2('0x4d')](handleError(_0x57d462,null));};exports[_0xece2('0x9c')]=function(_0x11e948,_0x5ce008,_0x2eaaf0){return BPromise[_0xece2('0x9d')]()[_0xece2('0x2e')](function(){if(!_0x11e948['query'][_0xece2('0x9')]){throw new Error(_0xece2('0x9e'));}if(!_0x11e948[_0xece2('0x3d')][_0xece2('0x94')]){throw new Error(_0xece2('0x92'));}var _0xda89c7=_0x11e948[_0xece2('0x3d')][_0xece2('0x93')]?_0x11e948[_0xece2('0x3d')]['hostname']+':'+_0x11e948[_0xece2('0x3d')]['port']:_0xece2('0x95')+_0x11e948[_0xece2('0x3d')][_0xece2('0x94')];var _0x432fbe=_0x11e948[_0xece2('0x3d')]['json']?_0x11e948[_0xece2('0x3d')][_0xece2('0x96')]:!![];var _0x507b90=_0x11e948[_0xece2('0x3d')][_0xece2('0x9f')]?_0x11e948[_0xece2('0x3d')][_0xece2('0x9f')]:null;var _0x1d5a83={'method':_0x11e948[_0xece2('0x97')],'uri':util[_0xece2('0x54')](_0xece2('0xa0'),_0xda89c7,_0x11e948[_0xece2('0x3d')][_0xece2('0x9')]),'json':_0x432fbe,'resolveWithFullResponse':!![],'encoding':_0x507b90,'body':_0x11e948[_0xece2('0x8a')]};if(_0x11e948['headers']){_0x1d5a83[_0xece2('0x98')]=_0x11e948[_0xece2('0x98')];if(_0x1d5a83[_0xece2('0x98')]['content-length']){delete _0x1d5a83[_0xece2('0x98')][_0xece2('0x99')];}}if(_0x1d5a83[_0xece2('0x98')][_0xece2('0x9a')]){delete _0x1d5a83[_0xece2('0x98')][_0xece2('0x9a')];}return rp(_0x1d5a83);})['then'](function(_0xa47a4c){if(_0xa47a4c){_0x5ce008[_0xece2('0x29')](_0xa47a4c[_0xece2('0x98')]);logger['info'](_0xa47a4c[_0xece2('0x8a')]);return _0x5ce008[_0xece2('0x23')](_0xa47a4c[_0xece2('0x9b')])[_0xece2('0x35')](_0xa47a4c[_0xece2('0x8a')]);}else{return _0x5ce008[_0xece2('0x22')](0xc8);}})[_0xece2('0x4d')](handleError(_0x5ce008,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4a6bc31..a4c9c17 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 _0x0a1c=['Plugin','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x5459a0,_0x27066c){var _0x4a235c=function(_0x1af479){while(--_0x1af479){_0x5459a0['push'](_0x5459a0['shift']());}};_0x4a235c(++_0x27066c);}(_0x0a1c,0xd2));var _0xc0a1=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0x0a1c[_0xb725be];return _0x2f2424;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xc0a1('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0xc0a1('0x1')](0x0);var events={'afterCreate':_0xc0a1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e1b0a){return function(_0x411ce9,_0x108afd,_0x1df4bf){PluginEvents[_0xc0a1('0x3')](_0x3e1b0a+':'+_0x411ce9['id'],_0x411ce9);PluginEvents[_0xc0a1('0x3')](_0x3e1b0a,_0x411ce9);_0x1df4bf(null);};}for(var e in events){if(events[_0xc0a1('0x4')](e)){var event=events[e];Plugin[_0xc0a1('0x5')](e,emitEvent(event));}}module[_0xc0a1('0x6')]=PluginEvents; \ No newline at end of file +var _0x0fcd=['hasOwnProperty','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x4a60b9,_0x349632){var _0x2e53bc=function(_0x5afffd){while(--_0x5afffd){_0x4a60b9['push'](_0x4a60b9['shift']());}};_0x2e53bc(++_0x349632);}(_0x0fcd,0x129));var _0xd0fc=function(_0x4834cb,_0x53dac0){_0x4834cb=_0x4834cb-0x0;var _0x5d1ce9=_0x0fcd[_0x4834cb];return _0x5d1ce9;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xd0fc('0x0'))['db'][_0xd0fc('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xd0fc('0x2')](0x0);var events={'afterCreate':_0xd0fc('0x3'),'afterUpdate':_0xd0fc('0x4'),'afterDestroy':_0xd0fc('0x5')};function emitEvent(_0x48a182){return function(_0x46c92d,_0x3552fc,_0x156c95){PluginEvents[_0xd0fc('0x6')](_0x48a182+':'+_0x46c92d['id'],_0x46c92d);PluginEvents['emit'](_0x48a182,_0x46c92d);_0x156c95(null);};}for(var e in events){if(events[_0xd0fc('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c6834ce..78bfb4f 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 _0x9be3=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9be3,0xd2));var _0x39be=function(_0x337c7c,_0x58ee86){_0x337c7c=_0x337c7c-0x0;var _0x211b74=_0x9be3[_0x337c7c];return _0x211b74;};'use strict';var _=require(_0x39be('0x0'));var util=require(_0x39be('0x1'));var logger=require('../../config/logger')(_0x39be('0x2'));var moment=require(_0x39be('0x3'));var BPromise=require(_0x39be('0x4'));var rp=require(_0x39be('0x5'));var fs=require('fs');var path=require(_0x39be('0x6'));var rimraf=require(_0x39be('0x7'));var config=require(_0x39be('0x8'));var attributes=require(_0x39be('0x9'));module[_0x39be('0xa')]=function(_0x5cc35d,_0x20a253){return _0x5cc35d[_0x39be('0xb')](_0x39be('0xc'),attributes,{'tableName':_0x39be('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fa7=['moment','request-promise','path','../../config/environment','./plugin.attributes','exports','define','plugins','util','../../config/logger','api'];(function(_0x259d0e,_0x244f95){var _0x2de8b1=function(_0x30f477){while(--_0x30f477){_0x259d0e['push'](_0x259d0e['shift']());}};_0x2de8b1(++_0x244f95);}(_0x8fa7,0x110));var _0x78fa=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x8fa7[_0x236d24];return _0x1574cf;};'use strict';var _=require('lodash');var util=require(_0x78fa('0x0'));var logger=require(_0x78fa('0x1'))(_0x78fa('0x2'));var moment=require(_0x78fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x78fa('0x4'));var fs=require('fs');var path=require(_0x78fa('0x5'));var rimraf=require('rimraf');var config=require(_0x78fa('0x6'));var attributes=require(_0x78fa('0x7'));module[_0x78fa('0x8')]=function(_0x3514da,_0x11875b){return _0x3514da[_0x78fa('0x9')]('Plugin',attributes,{'tableName':_0x78fa('0xa'),'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 18d513a..bd49100 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 _0x0a65=['../../config/utils','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5719ee,_0x5c5e0c){var _0x527a91=function(_0x1dbb69){while(--_0x1dbb69){_0x5719ee['push'](_0x5719ee['shift']());}};_0x527a91(++_0x5c5e0c);}(_0x0a65,0x144));var _0x50a6=function(_0x215bec,_0x4faba1){_0x215bec=_0x215bec-0x0;var _0x4f561a=_0x0a65[_0x215bec];return _0x4f561a;};'use strict';var _=require(_0x50a6('0x0'));var util=require(_0x50a6('0x1'));var moment=require(_0x50a6('0x2'));var BPromise=require(_0x50a6('0x3'));var rs=require(_0x50a6('0x4'));var fs=require('fs');var Redis=require(_0x50a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x50a6('0x6'));var logger=require(_0x50a6('0x7'))(_0x50a6('0x8'));var config=require('../../config/environment');var jayson=require(_0x50a6('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x50a6('0xa')](config[_0x50a6('0xb')],{'host':_0x50a6('0xc'),'port':0x18eb});var socket=require(_0x50a6('0xd'))(new Redis(config[_0x50a6('0xb')]));require(_0x50a6('0xe'))[_0x50a6('0xf')](socket);function respondWithRpcPromise(_0x33fa94,_0x2223d4,_0x4fa8d5){return new BPromise(function(_0x337209,_0x4de989){return client['request'](_0x33fa94,_0x4fa8d5)[_0x50a6('0x10')](function(_0x58670e){logger[_0x50a6('0x11')](_0x50a6('0x12'),_0x2223d4,'request\x20sent');logger[_0x50a6('0x13')](_0x50a6('0x14'),_0x2223d4,_0x50a6('0x15'),JSON[_0x50a6('0x16')](_0x58670e));if(_0x58670e[_0x50a6('0x17')]){if(_0x58670e[_0x50a6('0x17')][_0x50a6('0x18')]===0x1f4){logger[_0x50a6('0x17')](_0x50a6('0x12'),_0x2223d4,_0x58670e[_0x50a6('0x17')][_0x50a6('0x19')]);return _0x4de989(_0x58670e[_0x50a6('0x17')][_0x50a6('0x19')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x2223d4,_0x58670e[_0x50a6('0x17')][_0x50a6('0x19')]);return _0x337209(_0x58670e['error'][_0x50a6('0x19')]);}else{logger[_0x50a6('0x11')]('Plugin,\x20%s,\x20%s',_0x2223d4,'request\x20sent');_0x337209(_0x58670e[_0x50a6('0x1a')][_0x50a6('0x19')]);}})[_0x50a6('0x1b')](function(_0x5275db){logger[_0x50a6('0x17')]('Plugin,\x20%s,\x20%s',_0x2223d4,_0x5275db);_0x4de989(_0x5275db);});});}exports[_0x50a6('0x1c')]=function(_0x5685e8){var _0x347b63=this;return new Promise(function(_0x2e923e,_0x429d15){return db['Plugin'][_0x50a6('0x1d')](_0x5685e8[_0x50a6('0x1e')],{'raw':_0x5685e8[_0x50a6('0x1f')]?_0x5685e8[_0x50a6('0x1f')][_0x50a6('0x20')]===undefined?!![]:![]:!![]})[_0x50a6('0x10')](function(_0x38f8d3){logger[_0x50a6('0x11')]('CreatePlugin',_0x5685e8);logger[_0x50a6('0x13')](_0x50a6('0x1c'),_0x5685e8,JSON['stringify'](_0x38f8d3));_0x2e923e(_0x38f8d3);})['catch'](function(_0x2ab8ea){logger[_0x50a6('0x17')]('CreatePlugin',_0x2ab8ea[_0x50a6('0x19')],_0x5685e8);_0x429d15(_0x347b63[_0x50a6('0x17')](0x1f4,_0x2ab8ea['message']));});});}; \ No newline at end of file +var _0xcf99=['register','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x1652c4,_0x182ec6){var _0x29f4d4=function(_0x36fb7b){while(--_0x36fb7b){_0x1652c4['push'](_0x1652c4['shift']());}};_0x29f4d4(++_0x182ec6);}(_0xcf99,0x151));var _0x9cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf99[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9cf9('0x0'));var util=require(_0x9cf9('0x1'));var moment=require(_0x9cf9('0x2'));var BPromise=require(_0x9cf9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cf9('0x4'));var db=require(_0x9cf9('0x5'))['db'];var utils=require(_0x9cf9('0x6'));var logger=require(_0x9cf9('0x7'))(_0x9cf9('0x8'));var config=require(_0x9cf9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9cf9('0xa')]({'port':0x232a});config[_0x9cf9('0xb')]=_[_0x9cf9('0xc')](config[_0x9cf9('0xb')],{'host':_0x9cf9('0xd'),'port':0x18eb});var socket=require(_0x9cf9('0xe'))(new Redis(config[_0x9cf9('0xb')]));require('./plugin.socket')[_0x9cf9('0xf')](socket);function respondWithRpcPromise(_0x582d95,_0x23f3b3,_0x8c630c){return new BPromise(function(_0x4b8b97,_0x475ac0){return client[_0x9cf9('0x10')](_0x582d95,_0x8c630c)['then'](function(_0x1d5ea3){logger[_0x9cf9('0x11')]('Plugin,\x20%s,\x20%s',_0x23f3b3,_0x9cf9('0x12'));logger[_0x9cf9('0x13')](_0x9cf9('0x14'),_0x23f3b3,_0x9cf9('0x12'),JSON[_0x9cf9('0x15')](_0x1d5ea3));if(_0x1d5ea3[_0x9cf9('0x16')]){if(_0x1d5ea3[_0x9cf9('0x16')]['code']===0x1f4){logger[_0x9cf9('0x16')](_0x9cf9('0x17'),_0x23f3b3,_0x1d5ea3['error'][_0x9cf9('0x18')]);return _0x475ac0(_0x1d5ea3[_0x9cf9('0x16')][_0x9cf9('0x18')]);}logger['error'](_0x9cf9('0x17'),_0x23f3b3,_0x1d5ea3['error'][_0x9cf9('0x18')]);return _0x4b8b97(_0x1d5ea3['error'][_0x9cf9('0x18')]);}else{logger[_0x9cf9('0x11')](_0x9cf9('0x17'),_0x23f3b3,'request\x20sent');_0x4b8b97(_0x1d5ea3['result'][_0x9cf9('0x18')]);}})[_0x9cf9('0x19')](function(_0x55512d){logger[_0x9cf9('0x16')]('Plugin,\x20%s,\x20%s',_0x23f3b3,_0x55512d);_0x475ac0(_0x55512d);});});}exports['CreatePlugin']=function(_0x26f02d){var _0x5d8664=this;return new Promise(function(_0x194bac,_0x423ab4){return db[_0x9cf9('0x1a')][_0x9cf9('0x1b')](_0x26f02d[_0x9cf9('0x1c')],{'raw':_0x26f02d[_0x9cf9('0x1d')]?_0x26f02d[_0x9cf9('0x1d')][_0x9cf9('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x56e41d){logger[_0x9cf9('0x11')]('CreatePlugin',_0x26f02d);logger[_0x9cf9('0x13')](_0x9cf9('0x1f'),_0x26f02d,JSON['stringify'](_0x56e41d));_0x194bac(_0x56e41d);})[_0x9cf9('0x19')](function(_0x2f10d9){logger[_0x9cf9('0x16')](_0x9cf9('0x1f'),_0x2f10d9[_0x9cf9('0x18')],_0x26f02d);_0x423ab4(_0x5d8664[_0x9cf9('0x16')](0x1f4,_0x2f10d9[_0x9cf9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ce71ed0..12c0e2b 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 _0x1669=['removeListener','register','length','plugin:','./plugin.events','save','update','emit'];(function(_0x3cf150,_0x178cb5){var _0x931f8b=function(_0x40a693){while(--_0x40a693){_0x3cf150['push'](_0x3cf150['shift']());}};_0x931f8b(++_0x178cb5);}(_0x1669,0xdc));var _0x9166=function(_0x29a02e,_0x102f88){_0x29a02e=_0x29a02e-0x0;var _0x500288=_0x1669[_0x29a02e];return _0x500288;};'use strict';var PluginEvents=require(_0x9166('0x0'));var events=[_0x9166('0x1'),'remove',_0x9166('0x2')];function createListener(_0x137571,_0x42353d){return function(_0x1e1893){_0x42353d[_0x9166('0x3')](_0x137571,_0x1e1893);};}function removeListener(_0x4a3891,_0x62d213){return function(){PluginEvents[_0x9166('0x4')](_0x4a3891,_0x62d213);};}exports[_0x9166('0x5')]=function(_0x54cb34){for(var _0x3e4c04=0x0,_0x1f83de=events[_0x9166('0x6')];_0x3e4c04<_0x1f83de;_0x3e4c04++){var _0x5367a5=events[_0x3e4c04];var _0x1a3076=createListener(_0x9166('0x7')+_0x5367a5,_0x54cb34);PluginEvents['on'](_0x5367a5,_0x1a3076);}}; \ No newline at end of file +var _0x143c=['removeListener','register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x5bea70,_0x426f52){var _0x3d7b0a=function(_0x2b41c4){while(--_0x2b41c4){_0x5bea70['push'](_0x5bea70['shift']());}};_0x3d7b0a(++_0x426f52);}(_0x143c,0x10b));var _0xc143=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0x143c[_0x2cdf41];return _0x39a70e;};'use strict';var PluginEvents=require(_0xc143('0x0'));var events=[_0xc143('0x1'),_0xc143('0x2'),_0xc143('0x3')];function createListener(_0x4f826d,_0x571171){return function(_0x42443a){_0x571171[_0xc143('0x4')](_0x4f826d,_0x42443a);};}function removeListener(_0x9b7665,_0x3adfc1){return function(){PluginEvents[_0xc143('0x5')](_0x9b7665,_0x3adfc1);};}exports[_0xc143('0x6')]=function(_0x234826){for(var _0x44ff32=0x0,_0x4b146a=events['length'];_0x44ff32<_0x4b146a;_0x44ff32++){var _0x31fef7=events[_0x44ff32];var _0x561b11=createListener(_0xc143('0x7')+_0x31fef7,_0x234826);PluginEvents['on'](_0x31fef7,_0x561b11);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 19b0651..80fb1ac 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(_0x19d151,_0x1083ef){var _0x6fed3c=function(_0x30e246){while(--_0x30e246){_0x19d151['push'](_0x19d151['shift']());}};_0x6fed3c(++_0x1083ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x54a8af,_0x17d6bb){var _0x1c6284=function(_0x553236){while(--_0x553236){_0x54a8af['push'](_0x54a8af['shift']());}};_0x1c6284(++_0x17d6bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 d0db81a..61ad1f8 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 _0x222f=['dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','describe','params','body','join','../../files/plugins','script','chdir','dirname','start'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x222f,0x1a4));var _0xf222=function(_0x19bf5f,_0x1ca6b9){_0x19bf5f=_0x19bf5f-0x0;var _0x237efa=_0x222f[_0x19bf5f];return _0x237efa;};'use strict';var _=require(_0xf222('0x0'));var pm2=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var path=require('path');var exec=require('child_process')[_0xf222('0x4')];var BPromise=require(_0xf222('0x5'));function handleEntityNotFound(_0x307791,_0x7b187d){return function(_0x59a619){if(!_0x59a619){_0x307791[_0xf222('0x6')](0x194);;}return _0x59a619;};}function respondWithResult(_0x54a758,_0x112e6d){_0x112e6d=_0x112e6d||0xc8;return function(_0x26f129){if(_0x26f129){return _0x54a758['status'](_0x112e6d)[_0xf222('0x7')](_0x26f129);}return null;};}function handleError(_0x302d7a,_0x4aceb4){_0x4aceb4=_0x4aceb4||0x1f4;return function(_0x31c027){logger[_0xf222('0x8')](_0x31c027[_0xf222('0x9')]);if(_0x31c027[_0xf222('0xa')]){delete _0x31c027[_0xf222('0xa')];}_0x302d7a[_0xf222('0xb')](_0x4aceb4)['send'](_0x31c027);};}function execChildProcess(){return new BPromise(function(_0x2e29ad,_0x405080){exec(_0xf222('0xc'),function(_0x182bc3,_0x48f740,_0x3c9b96){logger[_0xf222('0xd')](_0x48f740);logger[_0xf222('0xd')](_0x3c9b96);if(_0x182bc3){logger[_0xf222('0x8')](_0x182bc3);return _0x405080(_0x182bc3);}return _0x2e29ad(_0x48f740);});});}exports[_0xf222('0xe')]=function(_0x334017,_0x11fca0){return pm2[_0xf222('0xf')]()['then'](function(_0x5b8f97){if(_0x5b8f97){var _0x1feb86=_[_0xf222('0x10')](_0x5b8f97,function(_0x4c2314){return _0x4c2314[_0xf222('0xa')]===_0xf222('0x11')||_0x4c2314[_0xf222('0xa')]===_0xf222('0x12');});return{'rows':_0x1feb86,'count':_0x1feb86[_0xf222('0x13')]};}return null;})[_0xf222('0x14')](respondWithResult(_0x11fca0,null))[_0xf222('0x15')](handleError(_0x11fca0,null));};exports['show']=function(_0x1efa9f,_0x823314){return pm2[_0xf222('0x16')](_0x1efa9f[_0xf222('0x17')]['id'])[_0xf222('0x14')](respondWithResult(_0x823314,null))[_0xf222('0x14')](handleEntityNotFound(_0x823314,null))[_0xf222('0x15')](handleError(_0x823314,null));};exports['create']=function(_0xf26a16,_0x1bdd0a){if(_0xf26a16[_0xf222('0x18')][_0xf222('0xa')]&&_0xf26a16['body']['script']){var _0x398ff4=path[_0xf222('0x19')](__dirname,_0xf222('0x1a'),_0xf26a16[_0xf222('0x18')][_0xf222('0x1b')]);var _0x151a89=process['cwd']();process[_0xf222('0x1c')](path[_0xf222('0x1d')](_0x398ff4));return execChildProcess()[_0xf222('0x14')](function(_0x12d443){process[_0xf222('0x1c')](_0x151a89);return pm2[_0xf222('0x1e')]({'name':_0xf26a16[_0xf222('0x18')][_0xf222('0xa')],'script':_0x398ff4});})['then'](function(_0x145e2e){pm2[_0xf222('0x1f')]();return _0x145e2e[0x0];})[_0xf222('0x14')](respondWithResult(_0x1bdd0a,0xc9))[_0xf222('0x15')](handleError(_0x1bdd0a,null));}else{return _0x1bdd0a[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x21')});}};exports[_0xf222('0x22')]=function(_0x15bf4e,_0x2ec2e9){if(_0x15bf4e[_0xf222('0x18')]['id']){delete _0x15bf4e['body']['id'];}var _0x14b2b1={'online':_0xf222('0x23'),'stopped':_0xf222('0x24')};if(_0x14b2b1[_0xf222('0x25')](_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')])){return pm2[_0x14b2b1[_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')]]](_0x15bf4e[_0xf222('0x17')]['id'])['then'](respondWithResult(_0x2ec2e9,0xc8))[_0xf222('0x15')](handleError(_0x2ec2e9,null));}else{return _0x2ec2e9[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf222('0x26')]=function(_0x5d5963,_0x40c7e7){if(_0x5d5963[_0xf222('0x18')]['id']){delete _0x5d5963[_0xf222('0x18')]['id'];}if(_0x5d5963[_0xf222('0x17')]['id']){return pm2[_0xf222('0x27')](_0x5d5963[_0xf222('0x17')]['id'])[_0xf222('0x14')](function(_0x5075ad){pm2['dump']();return _0x5075ad[0x0];})[_0xf222('0x14')](respondWithResult(_0x40c7e7,null))[_0xf222('0x15')](handleError(_0x40c7e7,null));}else{return _0x40c7e7[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x28')});}}; \ No newline at end of file +var _0xb903=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','json','info','error','name','express','motion2','length','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','catch','status','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','send','Unknown\x20status','destroy','delete','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb903,0x185));var _0x3b90=function(_0x294075,_0x4dab65){_0x294075=_0x294075-0x0;var _0x155239=_0xb903[_0x294075];return _0x155239;};'use strict';var _=require(_0x3b90('0x0'));var pm2=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var path=require('path');var exec=require(_0x3b90('0x4'))[_0x3b90('0x5')];var BPromise=require(_0x3b90('0x6'));function handleEntityNotFound(_0x1cd5d8,_0x30d8db){return function(_0x40f726){if(!_0x40f726){_0x1cd5d8[_0x3b90('0x7')](0x194);;}return _0x40f726;};}function respondWithResult(_0x5acd76,_0x15b68f){_0x15b68f=_0x15b68f||0xc8;return function(_0x5e845a){if(_0x5e845a){return _0x5acd76['status'](_0x15b68f)[_0x3b90('0x8')](_0x5e845a);}return null;};}function handleError(_0x2e4c06,_0x42efe8){_0x42efe8=_0x42efe8||0x1f4;return function(_0x1b1fbf){logger['error'](_0x1b1fbf['stack']);if(_0x1b1fbf['name']){delete _0x1b1fbf['name'];}_0x2e4c06['status'](_0x42efe8)['send'](_0x1b1fbf);};}function execChildProcess(){return new BPromise(function(_0x336913,_0x5af39c){exec('npm\x20install',function(_0x30c49c,_0x233509,_0x4bb8f4){logger[_0x3b90('0x9')](_0x233509);logger[_0x3b90('0x9')](_0x4bb8f4);if(_0x30c49c){logger[_0x3b90('0xa')](_0x30c49c);return _0x5af39c(_0x30c49c);}return _0x336913(_0x233509);});});}exports['index']=function(_0x5447df,_0x58c4d1){return pm2['list']()['then'](function(_0x3a0a55){if(_0x3a0a55){var _0x2c72fb=_['reject'](_0x3a0a55,function(_0x51fb66){return _0x51fb66[_0x3b90('0xb')]===_0x3b90('0xc')||_0x51fb66[_0x3b90('0xb')]===_0x3b90('0xd');});return{'rows':_0x2c72fb,'count':_0x2c72fb[_0x3b90('0xe')]};}return null;})['then'](respondWithResult(_0x58c4d1,null))['catch'](handleError(_0x58c4d1,null));};exports[_0x3b90('0xf')]=function(_0x5420dc,_0x4e9120){return pm2[_0x3b90('0x10')](_0x5420dc[_0x3b90('0x11')]['id'])[_0x3b90('0x12')](respondWithResult(_0x4e9120,null))[_0x3b90('0x12')](handleEntityNotFound(_0x4e9120,null))['catch'](handleError(_0x4e9120,null));};exports[_0x3b90('0x13')]=function(_0x5d140f,_0xd8d873){if(_0x5d140f[_0x3b90('0x14')]['name']&&_0x5d140f[_0x3b90('0x14')][_0x3b90('0x15')]){var _0x3642c0=path[_0x3b90('0x16')](__dirname,_0x3b90('0x17'),_0x5d140f[_0x3b90('0x14')][_0x3b90('0x15')]);var _0x2f4270=process[_0x3b90('0x18')]();process[_0x3b90('0x19')](path['dirname'](_0x3642c0));return execChildProcess()[_0x3b90('0x12')](function(_0x36b93e){process[_0x3b90('0x19')](_0x2f4270);return pm2[_0x3b90('0x1a')]({'name':_0x5d140f[_0x3b90('0x14')][_0x3b90('0xb')],'script':_0x3642c0});})['then'](function(_0x4b308c){pm2[_0x3b90('0x1b')]();return _0x4b308c[0x0];})[_0x3b90('0x12')](respondWithResult(_0xd8d873,0xc9))[_0x3b90('0x1c')](handleError(_0xd8d873,null));}else{return _0xd8d873[_0x3b90('0x1d')](0x1f4)['send']({'message':_0x3b90('0x1e')});}};exports[_0x3b90('0x1f')]=function(_0x1787d1,_0x4caead){if(_0x1787d1[_0x3b90('0x14')]['id']){delete _0x1787d1[_0x3b90('0x14')]['id'];}var _0x17ec7f={'online':_0x3b90('0x20'),'stopped':_0x3b90('0x21')};if(_0x17ec7f[_0x3b90('0x22')](_0x1787d1['body'][_0x3b90('0x1d')])){return pm2[_0x17ec7f[_0x1787d1['body'][_0x3b90('0x1d')]]](_0x1787d1[_0x3b90('0x11')]['id'])[_0x3b90('0x12')](respondWithResult(_0x4caead,0xc8))[_0x3b90('0x1c')](handleError(_0x4caead,null));}else{return _0x4caead[_0x3b90('0x1d')](0x1f4)[_0x3b90('0x23')]({'message':_0x3b90('0x24')});}};exports[_0x3b90('0x25')]=function(_0x500ceb,_0x4d1f31){if(_0x500ceb[_0x3b90('0x14')]['id']){delete _0x500ceb[_0x3b90('0x14')]['id'];}if(_0x500ceb[_0x3b90('0x11')]['id']){return pm2[_0x3b90('0x26')](_0x500ceb['params']['id'])['then'](function(_0xd33ac9){pm2[_0x3b90('0x1b')]();return _0xd33ac9[0x0];})[_0x3b90('0x12')](respondWithResult(_0x4d1f31,null))['catch'](handleError(_0x4d1f31,null));}else{return _0x4d1f31[_0x3b90('0x1d')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3d32796..71d5109 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 _0x516b=['/queues','getQueues','exports','express','Router','../../components/auth/service','get','isAuthenticated','getAgents'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x516b,0x81));var _0xb516=function(_0x12e73c,_0x2cbe1d){_0x12e73c=_0x12e73c-0x0;var _0x4c41cb=_0x516b[_0x12e73c];return _0x4c41cb;};'use strict';var express=require(_0xb516('0x0'));var router=express[_0xb516('0x1')]();var auth=require(_0xb516('0x2'));var controller=require('./realtime.controller');router[_0xb516('0x3')]('/agents',auth[_0xb516('0x4')](),controller[_0xb516('0x5')]);router[_0xb516('0x3')](_0xb516('0x6'),auth[_0xb516('0x4')](),controller[_0xb516('0x7')]);module[_0xb516('0x8')]=router; \ No newline at end of file +var _0xbbbf=['./realtime.controller','get','isAuthenticated','/queues','getQueues','express','Router','../../components/auth/service'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xbbbf,0x1ed));var _0xfbbb=function(_0x57b337,_0x240fe6){_0x57b337=_0x57b337-0x0;var _0x3d1fbf=_0xbbbf[_0x57b337];return _0x3d1fbf;};'use strict';var express=require(_0xfbbb('0x0'));var router=express[_0xfbbb('0x1')]();var auth=require(_0xfbbb('0x2'));var controller=require(_0xfbbb('0x3'));router[_0xfbbb('0x4')]('/agents',auth[_0xfbbb('0x5')](),controller['getAgents']);router[_0xfbbb('0x4')](_0xfbbb('0x6'),auth['isAuthenticated'](),controller[_0xfbbb('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 0daa764..9b028a3 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 _0x29d5=['erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','find','pick','queue','some','internal','toString','talking','UserId','accountcode','online','User','Queue','Pause','findAll','QueueId','length','unknown','ringing','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','voiceStatus','idle','chatStatus','faxStatus','smsStatus','whatsappStatus','pause','mail','chat','openchannel','includes','toLowerCase','Invalid\x20channel','isArray','findOne','getAgents','all','flatten','uniq','value','split','fields','globalStatus','order','startsWith','DESC','ASC','sort','pauseType','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','join','globalQueueFilter','rawAttributes','fieldName','type','role','agent','getOptions','raw','isEmpty','where','user','userProfileId','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','lodash','jayson/promise','../../config/logger','../../mysqldb','client','http','offset','limit','undefined','count','status','set','Content-Range','error','stack','name','send','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','then','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','erlangCalls'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x29d5,0x110));var _0x529d=function(_0x97f449,_0x185368){_0x97f449=_0x97f449-0x0;var _0x398688=_0x29d5[_0x97f449];return _0x398688;};'use strict';var util=require('util');var _=require(_0x529d('0x0'));var jayson=require(_0x529d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x529d('0x2'))('api');var db=require(_0x529d('0x3'))['db'];var amiClient=jayson[_0x529d('0x4')][_0x529d('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0x529d('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x2951c1,_0x37eb36){return function(_0x1afd65){if(_0x1afd65){var _0x4a2013=typeof _0x37eb36[_0x529d('0x6')]==='undefined'&&typeof _0x37eb36[_0x529d('0x7')]===_0x529d('0x8');var _0x3eeae0=_0x1afd65[_0x529d('0x9')];var _0x4ae77d=_0x4a2013?0x0:_0x37eb36[_0x529d('0x6')];var _0x5337bb=_0x4a2013?_0x1afd65[_0x529d('0x9')]:_0x37eb36[_0x529d('0x6')]+_0x37eb36[_0x529d('0x7')];var _0x58615f;if(_0x5337bb>=_0x3eeae0){_0x5337bb=_0x3eeae0;_0x58615f=0xc8;}else{_0x58615f=0xce;}_0x2951c1[_0x529d('0xa')](_0x58615f);return _0x2951c1[_0x529d('0xb')](_0x529d('0xc'),_0x4ae77d+'-'+_0x5337bb+'/'+_0x3eeae0)['json'](_0x1afd65);}return null;};}function handleError(_0xf21522,_0x413dd3){_0x413dd3=_0x413dd3||0x1f4;return function(_0x557653){logger[_0x529d('0xd')](_0x557653[_0x529d('0xe')]);if(_0x557653[_0x529d('0xf')]){delete _0x557653[_0x529d('0xf')];}_0xf21522['status'](_0x413dd3)[_0x529d('0x10')](_0x557653);};}function getRealtimeAgents(){return new Promise(function(_0x5bd02a,_0x9c7d65){return amiClient[_0x529d('0x11')](_0x529d('0x12'),{})['then'](function(_0x52700e){if(_0x52700e[_0x529d('0xd')])throw new Error(_0x529d('0x13'));var _0x479862=_0x52700e['result'];return routingClient[_0x529d('0x11')](_0x529d('0x12'),{})['then'](function(_0x10d696){if(_0x10d696['error'])throw new Error(_0x529d('0x14'));var _0x1db859=_0x10d696[_0x529d('0x15')];return _0x5bd02a(_[_0x529d('0x16')]({},_0x479862,_0x1db859));});})[_0x529d('0x17')](function(_0x48b4ed){_0x9c7d65(_0x48b4ed);});});}function getRealtimeQueues(_0xaf5ba7,_0x459179){return new Promise(function(_0x539dce,_0x1da426){var _0x3e78a2=_0x459179===_0x529d('0x18')?amiClient:routingClient;return _0x3e78a2[_0x529d('0x11')](_[_0x529d('0x19')](_0x459179)+_0x529d('0x1a'),_0xaf5ba7)['then'](function(_0x4b3025){if(_0x4b3025[_0x529d('0xd')])throw new Error(util[_0x529d('0x1b')](_0x529d('0x1c'),_0x459179));return _0x539dce(_0x4b3025[_0x529d('0x15')]);})[_0x529d('0x17')](function(_0xa33e46){_0x1da426(_0xa33e46);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x3e5ba3,_0x29551e){return amiClient[_0x529d('0x11')](_0x529d('0x1d'),{})[_0x529d('0x1e')](function(_0x350d70){if(_0x350d70['error'])throw new Error(_0x529d('0x1f'));return _0x3e5ba3(_0x350d70[_0x529d('0x15')]);})['catch'](function(_0x37f846){_0x29551e(_0x37f846);});});}function initializeQueues(_0x34cfff,_0x511b2a,_0x58b70e,_0x4fc347){var _0x1a6921=[_0x529d('0x20'),'available',_0x529d('0x21'),'talking',_0x529d('0x22')];if(_0x58b70e===_0x529d('0x18')&&_0x4fc347===_0x529d('0x23')){_0x1a6921[_0x529d('0x24')](_0x529d('0x25'),_0x529d('0x26'),_0x529d('0x27'),_0x529d('0x28'),_0x529d('0x29'),_0x529d('0x2a'),'startPredictive','startProgressive',_0x529d('0x2b'),_0x529d('0x2c'),_0x529d('0x2d'),_0x529d('0x2e'),_0x529d('0x2f'),_0x529d('0x30'),_0x529d('0x31'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0x529d('0x32'),'predictiveIntervalDroppedCallsTimeout',_0x529d('0x33'),_0x529d('0x34'),_0x529d('0x35'));}return _0x34cfff[_0x529d('0x36')](function(_0x107055){var _0x79f069=_0x107055[_0x529d('0x37')]({'plain':!![]});_0x79f069[_0x529d('0x38')]=[];_0x79f069[_0x529d('0x22')]=0x0;_0x79f069[_0x529d('0x39')]=0x0;_0x79f069[_0x529d('0x20')]=0x0;_0x79f069['available']=0x0;_0x79f069[_0x529d('0x21')]=0x0;if(_0x58b70e===_0x529d('0x18')){_0x79f069['talking']=0x0;_0x79f069[_0x529d('0x3a')]=0x0;if(_0x4fc347===_0x529d('0x23')){_0x79f069[_0x529d('0x25')]=0x0;_0x79f069[_0x529d('0x26')]=0x0;}}var _0x44e024=_[_0x529d('0x3b')](_0x511b2a,['id',_0x79f069['id']]);if(_0x44e024)_[_0x529d('0x16')](_0x79f069,_[_0x529d('0x3c')](_0x44e024,_0x1a6921));return _0x79f069;});}function updateAgentVoiceStatus(_0x52d46f,_0x377f3c,_0x5024eb){var _0x568ed3=_['filter'](_0x5024eb,[_0x529d('0x3d'),_0x377f3c[_0x529d('0xf')]]);if(_0x568ed3['length']===0x0)return _0x52d46f[_0x529d('0x3a')]=!![];if(_[_0x529d('0x3e')](_0x568ed3,['connectedlinenum',_0x52d46f[_0x529d('0x3f')][_0x529d('0x40')]()]))return _0x52d46f[_0x529d('0x41')]=!![];if(!_0x52d46f['talking'])return _0x52d46f['busy']=!![];}function getVoiceQueueAgents(_0xddefc0,_0x470c6a,_0x3b327a,_0x2cfbd9){var _0x583022=_[_0x529d('0x3b')](_0x470c6a,['id',_0xddefc0['id']]);if(!_0x583022)return _0xddefc0;return _0x583022['getMembers']({'raw':!![]})['then'](function(_0x1f5a1f){for(var _0x488196=0x0;_0x488196<_0x1f5a1f['length'];_0x488196++){var _0x54456d=_[_0x529d('0x3b')](_0x3b327a,['id',_0x1f5a1f[_0x488196][_0x529d('0x42')]]);if(!_0x54456d){_0x54456d={'id':_0x1f5a1f[_0x488196][_0x529d('0x42')],'name':_0x1f5a1f[_0x488196][_0x529d('0x42')],'accountcode':'','online':![]};}var _0x199939={'id':_0x54456d['id'],'name':_0x54456d['name'],'internal':_0x54456d[_0x529d('0x43')],'online':Boolean(_0x54456d[_0x529d('0x44')]),'paused':Boolean(_0x1f5a1f[_0x488196][_0x529d('0x22')])};if(_0x54456d['voiceStatus']===_0x529d('0x41'))updateAgentVoiceStatus(_0x199939,_0xddefc0,_0x2cfbd9);if(_0x199939[_0x529d('0x44')])_0xddefc0[_0x529d('0x39')]++;if(_0x199939[_0x529d('0x3a')])_0xddefc0[_0x529d('0x3a')]++;if(_0x199939['paused']&&!_0x199939[_0x529d('0x3a')]&&!_0x199939[_0x529d('0x41')])_0xddefc0[_0x529d('0x22')]++;_0xddefc0[_0x529d('0x38')][_0x529d('0x24')](_0x199939);}return _0xddefc0;});}function getQueueAgents(_0x11d7d6,_0xfff2d5,_0x26a360){var _0x428f04=_0x529d('0x45')+_[_0x529d('0x19')](_0x26a360)+_0x529d('0x46');var _0x16c9ad=_0x26a360+_0x529d('0x47');return db[_0x428f04][_0x529d('0x48')]({'where':{[_['startCase'](_0x26a360)+_0x529d('0x49')]:_0x11d7d6['id']},'raw':!![]})[_0x529d('0x1e')](function(_0x2fde5d){for(var _0x4667dd=0x0;_0x4667dd<_0x2fde5d[_0x529d('0x4a')];_0x4667dd++){var _0x473baa=_[_0x529d('0x3b')](_0xfff2d5,['id',_0x2fde5d[_0x4667dd]['UserId']]);if(!_0x473baa){_0x473baa={'id':_0x2fde5d[_0x4667dd][_0x529d('0x42')],'name':_0x2fde5d[_0x4667dd][_0x529d('0x42')],'online':![],['pauseField']:![]};}var _0x27d4be={'id':_0x473baa['id'],'name':_0x473baa['name'],'online':Boolean(_0x473baa[_0x529d('0x44')]),'paused':Boolean(_0x473baa[_0x16c9ad])};if(_0x27d4be[_0x529d('0x44')])_0x11d7d6[_0x529d('0x39')]++;_0x11d7d6[_0x529d('0x38')]['push'](_0x27d4be);}return _0x11d7d6;});}function isIdle(_0x139518){return _0x139518==='idle'||_0x139518===_0x529d('0x4b')||_0x139518==='unavailable'||_0x139518===_0x529d('0x4c')||_['isNil'](_0x139518);}function isAgentPaused(_0x40ae54,_0x4bb803){var _0x42718d=[_0x40ae54[_0x529d('0x4d')],_0x40ae54[_0x529d('0x4e')],_0x40ae54[_0x529d('0x4f')],_0x40ae54[_0x529d('0x50')],_0x40ae54[_0x529d('0x51')],_0x40ae54[_0x529d('0x52')],_0x40ae54[_0x529d('0x53')]];if(!_0x4bb803)return _[_0x529d('0x54')](_0x42718d);var _0x30b84a=_[_0x529d('0x55')](_0x42718d);return _0x30b84a['length']>0x0&&_0x30b84a[_0x529d('0x4a')]<_0x42718d['length']?!![]:![];}function isAgentIdle(_0x5c0264){if(_0x5c0264[_0x529d('0x56')]!==_0x529d('0x57')&&_0x5c0264[_0x529d('0x52')]){_0x5c0264['voiceStatus']='pause';return![];}return _[_0x529d('0x54')]([_0x5c0264[_0x529d('0x58')],_0x5c0264[_0x529d('0x59')],_0x5c0264['mailStatus'],_0x5c0264['openchannelStatus'],_0x5c0264[_0x529d('0x5a')],_0x5c0264[_0x529d('0x56')],_0x5c0264[_0x529d('0x5b')]],isIdle);}function getAgentStatus(_0x322d06){var _0x9507ad='unknown';if(isAgentPaused(_0x322d06))_0x9507ad=_0x529d('0x5c');else if(isAgentPaused(_0x322d06,!![]))_0x9507ad='*pause';else if(isAgentIdle(_0x322d06))_0x9507ad=_0x529d('0x57');else _0x9507ad='busy';return _0x9507ad;}function validateChannel(_0x4f3036){var _0x144287=[_0x529d('0x5d'),_0x529d('0x5e'),'sms',_0x529d('0x5f'),'fax','whatsapp',_0x529d('0x18')];if(!_[_0x529d('0x60')](_0x144287,_0x4f3036[_0x529d('0x61')]()))throw new Error(_0x529d('0x62'));return _0x4f3036['toLowerCase']();}function getFilteredAgentIds(_0x1ac708,_0xa0c16f){var _0x4bb1b8=_[_0x529d('0x63')](_0x1ac708)?_0x1ac708:[_0x1ac708];var _0x43fd1d=_[_0x529d('0x36')](_0x4bb1b8,function(_0x1e3283){return db[_0xa0c16f][_0x529d('0x64')]({'where':{'name':_0x1e3283}})['then'](function(_0x41bf33){if(!_0x41bf33)return[];return _0x41bf33[_0x529d('0x65')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x529d('0x66')](_0x43fd1d)[_0x529d('0x1e')](function(_0x4a6b85){var _0x451e53=_(_0x4a6b85)[_0x529d('0x67')]()[_0x529d('0x36')]('id')[_0x529d('0x68')]()[_0x529d('0x69')]();return _0x451e53;});}function getUpdatedSortOptions(_0x4bad6f){var _0x19bd35={'fields':[],'order':null};var _0x459c1c=_0x4bad6f[_0x529d('0x6a')](',');_0x19bd35[_0x529d('0x6b')]=_[_0x529d('0x55')](_0x459c1c,function(_0x4a3d45){if(!_0x4a3d45[_0x529d('0x60')](_0x529d('0x6c')))return!![];_0x19bd35[_0x529d('0x6d')]=_[_0x529d('0x6e')](_0x4a3d45,'-')?_0x529d('0x6f'):_0x529d('0x70');return![];});return _0x19bd35;}function orderAgentsByStatus(_0x37300e,_0x2ab206){return _0x37300e[_0x529d('0x71')](function(_0x2e4374,_0x2abe92){if(_0x2e4374[_0x529d('0x6c')]===_0x2abe92['globalStatus']&&_0x2e4374[_0x529d('0x6c')]===_0x529d('0x5c')){if(_0x2ab206===_0x529d('0x6f'))return(_0x2e4374[_0x529d('0x72')]||'')<(_0x2abe92['pauseType']||'')?0x1:-0x1;return _0x2e4374[_0x529d('0x72')]<_0x2abe92[_0x529d('0x72')]?-0x1:0x1;}else{if(_0x2ab206==='DESC')return _0x2e4374['globalStatus']<_0x2abe92[_0x529d('0x6c')]?0x1:-0x1;return _0x2e4374[_0x529d('0x6c')]<_0x2abe92[_0x529d('0x6c')]?-0x1:0x1;}});}exports[_0x529d('0x65')]=function(_0x227bbc,_0x257bf8){var _0x5d2f76={'count':0x0,'rows':[]},_0x2a6232={},_0x284653,_0x556542,_0x30470b,_0x599ab8,_0x15971e=['userpic',_0x529d('0x44'),'lastLoginAt','lastPauseAt','pauseType','lastPauseAt',_0x529d('0x3f'),_0x529d('0x73'),_0x529d('0x4d'),_0x529d('0x50'),_0x529d('0x4f'),'smsPause',_0x529d('0x53'),'faxPause',_0x529d('0x52'),'chatCapacity',_0x529d('0x74'),_0x529d('0x75'),_0x529d('0x76'),'whatsappCapacity',_0x529d('0x77'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x529d('0x78'),'smsCurrentCapacity',_0x529d('0x79'),_0x529d('0x7a'),'chatStatus',_0x529d('0x7b'),_0x529d('0x7c'),'smsStatus','whatsappStatus',_0x529d('0x59'),'voiceStatus',_0x529d('0x7d'),_0x529d('0x7e'),_0x529d('0x7f'),'smsStatusTime',_0x529d('0x80'),'faxStatusTime',_0x529d('0x81'),_0x529d('0x3d'),_0x529d('0x82'),_0x529d('0x83'),'phoneBarEnableScreenRecordingByAgent',_0x529d('0x84'),_0x529d('0x85')],_0x324211=[_0x529d('0x4d'),_0x529d('0x50'),_0x529d('0x4f'),_0x529d('0x51'),_0x529d('0x53'),_0x529d('0x4e'),_0x529d('0x52'),_0x529d('0x44')];Promise[_0x529d('0x86')]()['then'](function(){if(_0x227bbc[_0x529d('0x87')][_0x529d('0x88')])_0x284653=validateChannel(_0x227bbc[_0x529d('0x87')][_0x529d('0x88')]);if(!_0x227bbc['query'][_0x529d('0x71')]||!_0x227bbc[_0x529d('0x87')][_0x529d('0x71')][_0x529d('0x60')](_0x529d('0x6c')))return;var _0x174b2d=getUpdatedSortOptions(_0x227bbc[_0x529d('0x87')][_0x529d('0x71')]);_0x227bbc[_0x529d('0x87')][_0x529d('0x71')]=_0x174b2d['fields'][_0x529d('0x89')](',');_0x556542=_0x174b2d['order'];})[_0x529d('0x1e')](function(){if(!_0x227bbc[_0x529d('0x87')][_0x529d('0x8a')])return[];var _0x4d5d28=_[_0x529d('0x19')](_0x284653)+_0x529d('0x46');return getFilteredAgentIds(_0x227bbc[_0x529d('0x87')][_0x529d('0x8a')],_0x4d5d28);})[_0x529d('0x1e')](function(_0x48932d){var _0xa0ee0d=_[_0x529d('0x36')](db[_0x529d('0x45')][_0x529d('0x8b')],function(_0x497103){return{'name':_0x497103[_0x529d('0x8c')],'type':_0x497103[_0x529d('0x8d')]['key']};});_0x227bbc['query'][_0x529d('0x8e')]=_0x529d('0x8f');_0x227bbc[_0x529d('0x87')][_0x529d('0x44')]=!![];_0x2a6232=qs[_0x529d('0x90')](_0xa0ee0d,_0x227bbc);_0x2a6232[_0x529d('0x91')]=!![];if(!_[_0x529d('0x92')](_0x48932d)){_0x2a6232[_0x529d('0x93')]=_[_0x529d('0x16')](_0x2a6232[_0x529d('0x93')],{'$and':[{'id':{'$in':_0x48932d}}]});}else if(!_[_0x529d('0x92')](_0x227bbc[_0x529d('0x87')][_0x529d('0x8a')])){return _0x5d2f76;}if(_0x227bbc[_0x529d('0x94')][_0x529d('0x8e')]==='user'){var _0x35e70e={'params':{'id':_0x227bbc[_0x529d('0x94')][_0x529d('0x95')]},'query':{'section':'Agents','role':_0x529d('0x8f'),'online':!![],'nolimit':_0x227bbc[_0x529d('0x87')]['nolimit'],'sort':_0x227bbc[_0x529d('0x87')][_0x529d('0x71')],'filter':_0x227bbc[_0x529d('0x87')][_0x529d('0x55')],'raw':!![],'ids':_0x48932d}};return db[_0x529d('0x96')][_0x529d('0x97')](_0x35e70e);}return db[_0x529d('0x45')][_0x529d('0x98')](_0x2a6232);})['then'](function(_0x297e7d){_0x5d2f76[_0x529d('0x9')]=_0x297e7d[_0x529d('0x9')];_0x30470b=_0x297e7d[_0x529d('0x99')];return getRealtimeAgents();})['then'](function(_0x26c978){_0x599ab8=_0x26c978['rows'];return _0x30470b[_0x529d('0x36')](function(_0x8aabb){var _0x52ebe8=_[_0x529d('0x3b')](_0x599ab8,['id',_0x8aabb['id']]);if(_0x52ebe8)_[_0x529d('0x16')](_0x8aabb,_[_0x529d('0x3c')](_[_0x529d('0x9a')](_0x52ebe8,_0x324211),_0x15971e));_0x8aabb[_0x529d('0x6c')]=getAgentStatus(_0x8aabb);return _0x8aabb;});})[_0x529d('0x1e')](function(_0x17b305){var _0xd49046;if(_0x227bbc[_0x529d('0x87')][_0x529d('0x9b')]){_0xd49046=_[_0x529d('0x55')](_0x17b305,[_0x529d('0x6c'),_0x227bbc[_0x529d('0x87')][_0x529d('0x9b')]]);if(_0x227bbc['query']['pauseTypeFilter']){_0xd49046=_[_0x529d('0x55')](_0xd49046,[_0x529d('0x72'),_0x227bbc[_0x529d('0x87')][_0x529d('0x9c')]]);}}if(_0xd49046)_0x17b305=_0xd49046;if(!_0x556542)return _0x17b305;return orderAgentsByStatus(_0x17b305,_0x556542);})[_0x529d('0x1e')](function(_0xb12329){_0x5d2f76['rows']=_0xb12329;return _0x5d2f76;})[_0x529d('0x1e')](respondWithFilteredResult(_0x257bf8,_0x2a6232))['catch'](handleError(_0x257bf8,null));};exports[_0x529d('0x9d')]=function(_0x184c3c,_0x507016){var _0x284cb1={'count':0x0,'rows':[]},_0x144159={},_0x241375,_0x727d3e,_0x4cc382,_0x18ece7,_0x106e29;Promise[_0x529d('0x86')]()[_0x529d('0x1e')](function(){if(_0x184c3c[_0x529d('0x87')][_0x529d('0x88')])_0x241375=validateChannel(_0x184c3c[_0x529d('0x87')][_0x529d('0x88')]);var _0xd9a990=_[_0x529d('0x19')](_0x241375)+_0x529d('0x46');var _0x45457a=_['map'](db[_0xd9a990][_0x529d('0x8b')],function(_0x3e8158){return{'name':_0x3e8158[_0x529d('0x8c')],'type':_0x3e8158[_0x529d('0x8d')]['key']};});_0x144159=qs[_0x529d('0x90')](_0x45457a,_0x184c3c);if(_0x184c3c['user'][_0x529d('0x8e')]===_0x529d('0x94')){var _0x4e9a63={'params':{'id':_0x184c3c[_0x529d('0x94')]['userProfileId']},'query':{'section':_0x241375===_0x529d('0x18')&&_0x184c3c[_0x529d('0x87')][_0x529d('0x8d')]===_0x529d('0x23')?'QueueCampaigns':_[_0x529d('0x19')](_0x241375)+_0x529d('0x1a'),'type':_0x184c3c[_0x529d('0x87')][_0x529d('0x8d')],'nolimit':!![],'sort':'name','filter':_0x184c3c[_0x529d('0x87')][_0x529d('0x55')]}};return db[_0x529d('0x96')]['getResources'](_0x4e9a63);}return db[_0xd9a990][_0x529d('0x98')](_0x144159);})[_0x529d('0x1e')](function(_0x3587ca){_0x284cb1[_0x529d('0x9')]=_0x3587ca['count'];_0x727d3e=_0x3587ca[_0x529d('0x99')];return getRealtimeQueues(_0x184c3c,_0x241375);})[_0x529d('0x1e')](function(_0x5f2ac6){_0x18ece7=_0x5f2ac6[_0x529d('0x99')];return getRealtimeAgents();})[_0x529d('0x1e')](function(_0x17622c){_0x4cc382=_0x17622c[_0x529d('0x99')];if(_0x241375!=_0x529d('0x18'))return;return getRealtimeVoiceQueueChannels();})[_0x529d('0x1e')](function(_0x2e0aca){_0x106e29=_0x2e0aca?_0x2e0aca['rows']:[];return initializeQueues(_0x727d3e,_0x18ece7,_0x241375,_0x184c3c[_0x529d('0x87')][_0x529d('0x8d')]);})[_0x529d('0x1e')](function(_0x2541ff){var _0x29d5fd=_0x2541ff[_0x529d('0x36')](function(_0x3386bb){if(_0x241375==='voice')return getVoiceQueueAgents(_0x3386bb,_0x727d3e,_0x4cc382,_0x106e29);else return getQueueAgents(_0x3386bb,_0x4cc382,_0x241375);});return Promise[_0x529d('0x66')](_0x29d5fd);})[_0x529d('0x1e')](function(_0x439e7e){_0x284cb1[_0x529d('0x99')]=_0x439e7e;return _0x284cb1;})[_0x529d('0x1e')](respondWithFilteredResult(_0x507016,_0x144159))[_0x529d('0x17')](handleError(_0x507016,null));}; \ No newline at end of file +var _0x3d2e=['phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','fields','join','order','globalQueueFilter','rawAttributes','fieldName','type','key','role','getOptions','isEmpty','where','user','userProfileId','agent','nolimit','UserProfile','getResources','findAndCountAll','rows','pick','omit','globalStatusFilter','pauseTypeFilter','getQueues','QueueCampaigns','Queues','all','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','paused','voice','push','pTalking','originated','message','dialMethod','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','agents','loggedInDb','busy','outbound','find','filter','queue','some','connectedlinenum','internal','toString','getMembers','length','UserId','online','voiceStatus','User','Queue','findAll','unknown','unavailable','ringing','isNil','chatPause','mailPause','voicePause','whatsappPause','every','idle','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','pause','*pause','mail','chat','openchannel','fax','whatsapp','includes','toLowerCase','isArray','map','findOne','getAgents','uniq','globalStatus','DESC','ASC','sort','pauseType','userpic','address','openchannelPause','smsPause','faxPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x3d2e,0x168));var _0xe3d2=function(_0x1cd91a,_0x2481e7){_0x1cd91a=_0x1cd91a-0x0;var _0x2bffc3=_0x3d2e[_0x1cd91a];return _0x2bffc3;};'use strict';var util=require('util');var _=require('lodash');var jayson=require(_0xe3d2('0x0'));var qs=require(_0xe3d2('0x1'));var logger=require(_0xe3d2('0x2'))(_0xe3d2('0x3'));var db=require(_0xe3d2('0x4'))['db'];var amiClient=jayson['client'][_0xe3d2('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0xe3d2('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x287e75,_0x553d0a){return function(_0x563d43){if(_0x563d43){var _0x5a66b3=typeof _0x553d0a[_0xe3d2('0x6')]===_0xe3d2('0x7')&&typeof _0x553d0a[_0xe3d2('0x8')]===_0xe3d2('0x7');var _0x3ed2ac=_0x563d43[_0xe3d2('0x9')];var _0x317f54=_0x5a66b3?0x0:_0x553d0a['offset'];var _0x14c58a=_0x5a66b3?_0x563d43[_0xe3d2('0x9')]:_0x553d0a[_0xe3d2('0x6')]+_0x553d0a['limit'];var _0x447153;if(_0x14c58a>=_0x3ed2ac){_0x14c58a=_0x3ed2ac;_0x447153=0xc8;}else{_0x447153=0xce;}_0x287e75[_0xe3d2('0xa')](_0x447153);return _0x287e75[_0xe3d2('0xb')](_0xe3d2('0xc'),_0x317f54+'-'+_0x14c58a+'/'+_0x3ed2ac)[_0xe3d2('0xd')](_0x563d43);}return null;};}function handleError(_0x5c4749,_0x482384){_0x482384=_0x482384||0x1f4;return function(_0xb8d61d){logger[_0xe3d2('0xe')](_0xb8d61d['stack']);if(_0xb8d61d[_0xe3d2('0xf')]){delete _0xb8d61d['name'];}_0x5c4749[_0xe3d2('0xa')](_0x482384)[_0xe3d2('0x10')](_0xb8d61d);};}function getRealtimeAgents(){return new Promise(function(_0x385172,_0x4bbd61){return amiClient[_0xe3d2('0x11')](_0xe3d2('0x12'),{})[_0xe3d2('0x13')](function(_0x352c0a){if(_0x352c0a[_0xe3d2('0xe')])throw new Error(_0xe3d2('0x14'));var _0x3d8015=_0x352c0a['result'];return routingClient[_0xe3d2('0x11')](_0xe3d2('0x12'),{})[_0xe3d2('0x13')](function(_0x3fba9b){if(_0x3fba9b[_0xe3d2('0xe')])throw new Error(_0xe3d2('0x15'));var _0x157cca=_0x3fba9b[_0xe3d2('0x16')];return _0x385172(_[_0xe3d2('0x17')]({},_0x3d8015,_0x157cca));});})[_0xe3d2('0x18')](function(_0x3ca81c){_0x4bbd61(_0x3ca81c);});});}function getRealtimeQueues(_0x118721,_0xde47f){return new Promise(function(_0x1f5d07,_0x4fc8e9){var _0x41bff1=_0xde47f==='voice'?amiClient:routingClient;return _0x41bff1['request'](_[_0xe3d2('0x19')](_0xde47f)+'Queues',_0x118721)[_0xe3d2('0x13')](function(_0x45c0e7){if(_0x45c0e7[_0xe3d2('0xe')])throw new Error(util[_0xe3d2('0x1a')](_0xe3d2('0x1b'),_0xde47f));return _0x1f5d07(_0x45c0e7['result']);})[_0xe3d2('0x18')](function(_0x51c202){_0x4fc8e9(_0x51c202);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x4ff36c,_0x5e86a2){return amiClient[_0xe3d2('0x11')](_0xe3d2('0x1c'),{})[_0xe3d2('0x13')](function(_0x377d66){if(_0x377d66[_0xe3d2('0xe')])throw new Error(_0xe3d2('0x1d'));return _0x4ff36c(_0x377d66[_0xe3d2('0x16')]);})[_0xe3d2('0x18')](function(_0x545416){_0x5e86a2(_0x545416);});});}function initializeQueues(_0x5bfa45,_0x3aba34,_0xeb29a,_0x369658){var _0x18c487=[_0xe3d2('0x1e'),'available',_0xe3d2('0x1f'),_0xe3d2('0x20'),_0xe3d2('0x21')];if(_0xeb29a===_0xe3d2('0x22')&&_0x369658==='outbound'){_0x18c487[_0xe3d2('0x23')](_0xe3d2('0x24'),_0xe3d2('0x25'),_0xe3d2('0x26'),'dialActive',_0xe3d2('0x27'),_0xe3d2('0x28'),'startPredictive','startProgressive',_0xe3d2('0x29'),_0xe3d2('0x2a'),_0xe3d2('0x2b'),_0xe3d2('0x2c'),_0xe3d2('0x2d'),_0xe3d2('0x2e'),'dialPredictiveIntervalMinThreshold',_0xe3d2('0x2f'),_0xe3d2('0x30'),_0xe3d2('0x31'),_0xe3d2('0x32'),_0xe3d2('0x33'),'predictiveIntervalAvgHoldtime',_0xe3d2('0x34'));}return _0x5bfa45['map'](function(_0xbbf46e){var _0x36bdec=_0xbbf46e['get']({'plain':!![]});_0x36bdec[_0xe3d2('0x35')]=[];_0x36bdec[_0xe3d2('0x21')]=0x0;_0x36bdec[_0xe3d2('0x36')]=0x0;_0x36bdec['loggedIn']=0x0;_0x36bdec['available']=0x0;_0x36bdec[_0xe3d2('0x1f')]=0x0;if(_0xeb29a==='voice'){_0x36bdec[_0xe3d2('0x20')]=0x0;_0x36bdec[_0xe3d2('0x37')]=0x0;if(_0x369658===_0xe3d2('0x38')){_0x36bdec[_0xe3d2('0x24')]=0x0;_0x36bdec[_0xe3d2('0x25')]=0x0;}}var _0x1b5277=_[_0xe3d2('0x39')](_0x3aba34,['id',_0x36bdec['id']]);if(_0x1b5277)_[_0xe3d2('0x17')](_0x36bdec,_['pick'](_0x1b5277,_0x18c487));return _0x36bdec;});}function updateAgentVoiceStatus(_0xc32450,_0x1f85a4,_0x4157a9){var _0x51bfbd=_[_0xe3d2('0x3a')](_0x4157a9,[_0xe3d2('0x3b'),_0x1f85a4[_0xe3d2('0xf')]]);if(_0x51bfbd['length']===0x0)return _0xc32450[_0xe3d2('0x37')]=!![];if(_[_0xe3d2('0x3c')](_0x51bfbd,[_0xe3d2('0x3d'),_0xc32450[_0xe3d2('0x3e')][_0xe3d2('0x3f')]()]))return _0xc32450[_0xe3d2('0x20')]=!![];if(!_0xc32450['talking'])return _0xc32450[_0xe3d2('0x37')]=!![];}function getVoiceQueueAgents(_0x1c4bb5,_0x301adb,_0x244883,_0xbff298){var _0x5b0d14=_[_0xe3d2('0x39')](_0x301adb,['id',_0x1c4bb5['id']]);if(!_0x5b0d14)return _0x1c4bb5;return _0x5b0d14[_0xe3d2('0x40')]({'raw':!![]})['then'](function(_0x391a9c){for(var _0x3799c8=0x0;_0x3799c8<_0x391a9c[_0xe3d2('0x41')];_0x3799c8++){var _0x26d756=_[_0xe3d2('0x39')](_0x244883,['id',_0x391a9c[_0x3799c8]['UserId']]);if(!_0x26d756){_0x26d756={'id':_0x391a9c[_0x3799c8]['UserId'],'name':_0x391a9c[_0x3799c8][_0xe3d2('0x42')],'accountcode':'','online':![]};}var _0xbd89a6={'id':_0x26d756['id'],'name':_0x26d756[_0xe3d2('0xf')],'internal':_0x26d756['accountcode'],'online':Boolean(_0x26d756[_0xe3d2('0x43')]),'paused':Boolean(_0x391a9c[_0x3799c8][_0xe3d2('0x21')])};if(_0x26d756[_0xe3d2('0x44')]===_0xe3d2('0x20'))updateAgentVoiceStatus(_0xbd89a6,_0x1c4bb5,_0xbff298);if(_0xbd89a6['online'])_0x1c4bb5[_0xe3d2('0x36')]++;if(_0xbd89a6['busy'])_0x1c4bb5[_0xe3d2('0x37')]++;if(_0xbd89a6[_0xe3d2('0x21')]&&!_0xbd89a6[_0xe3d2('0x37')]&&!_0xbd89a6['talking'])_0x1c4bb5['paused']++;_0x1c4bb5['agents'][_0xe3d2('0x23')](_0xbd89a6);}return _0x1c4bb5;});}function getQueueAgents(_0x14d01b,_0x3f57c4,_0x17aaef){var _0x4118f0=_0xe3d2('0x45')+_[_0xe3d2('0x19')](_0x17aaef)+_0xe3d2('0x46');var _0x15ee78=_0x17aaef+'Pause';return db[_0x4118f0][_0xe3d2('0x47')]({'where':{[_[_0xe3d2('0x19')](_0x17aaef)+'QueueId']:_0x14d01b['id']},'raw':!![]})[_0xe3d2('0x13')](function(_0x27ec1c){for(var _0x5654fe=0x0;_0x5654fe<_0x27ec1c['length'];_0x5654fe++){var _0x36e0d4=_[_0xe3d2('0x39')](_0x3f57c4,['id',_0x27ec1c[_0x5654fe][_0xe3d2('0x42')]]);if(!_0x36e0d4){_0x36e0d4={'id':_0x27ec1c[_0x5654fe][_0xe3d2('0x42')],'name':_0x27ec1c[_0x5654fe]['UserId'],'online':![],['pauseField']:![]};}var _0x4843f2={'id':_0x36e0d4['id'],'name':_0x36e0d4['name'],'online':Boolean(_0x36e0d4[_0xe3d2('0x43')]),'paused':Boolean(_0x36e0d4[_0x15ee78])};if(_0x4843f2[_0xe3d2('0x43')])_0x14d01b[_0xe3d2('0x36')]++;_0x14d01b[_0xe3d2('0x35')]['push'](_0x4843f2);}return _0x14d01b;});}function isIdle(_0x2c666c){return _0x2c666c==='idle'||_0x2c666c===_0xe3d2('0x48')||_0x2c666c===_0xe3d2('0x49')||_0x2c666c===_0xe3d2('0x4a')||_[_0xe3d2('0x4b')](_0x2c666c);}function isAgentPaused(_0x56b2fe,_0x453012){var _0x584948=[_0x56b2fe[_0xe3d2('0x4c')],_0x56b2fe['faxPause'],_0x56b2fe[_0xe3d2('0x4d')],_0x56b2fe['openchannelPause'],_0x56b2fe['smsPause'],_0x56b2fe[_0xe3d2('0x4e')],_0x56b2fe[_0xe3d2('0x4f')]];if(!_0x453012)return _[_0xe3d2('0x50')](_0x584948);var _0x26fa29=_[_0xe3d2('0x3a')](_0x584948);return _0x26fa29[_0xe3d2('0x41')]>0x0&&_0x26fa29[_0xe3d2('0x41')]<_0x584948[_0xe3d2('0x41')]?!![]:![];}function isAgentIdle(_0x7b03d3){if(_0x7b03d3[_0xe3d2('0x44')]!==_0xe3d2('0x51')&&_0x7b03d3[_0xe3d2('0x4e')]){_0x7b03d3[_0xe3d2('0x44')]='pause';return![];}return _['every']([_0x7b03d3[_0xe3d2('0x52')],_0x7b03d3[_0xe3d2('0x53')],_0x7b03d3[_0xe3d2('0x54')],_0x7b03d3[_0xe3d2('0x55')],_0x7b03d3[_0xe3d2('0x56')],_0x7b03d3[_0xe3d2('0x44')],_0x7b03d3[_0xe3d2('0x57')]],isIdle);}function getAgentStatus(_0xb232f7){var _0x4a790e=_0xe3d2('0x48');if(isAgentPaused(_0xb232f7))_0x4a790e=_0xe3d2('0x58');else if(isAgentPaused(_0xb232f7,!![]))_0x4a790e=_0xe3d2('0x59');else if(isAgentIdle(_0xb232f7))_0x4a790e='idle';else _0x4a790e='busy';return _0x4a790e;}function validateChannel(_0x577f9b){var _0x32db4d=[_0xe3d2('0x5a'),_0xe3d2('0x5b'),'sms',_0xe3d2('0x5c'),_0xe3d2('0x5d'),_0xe3d2('0x5e'),_0xe3d2('0x22')];if(!_[_0xe3d2('0x5f')](_0x32db4d,_0x577f9b['toLowerCase']()))throw new Error('Invalid\x20channel');return _0x577f9b[_0xe3d2('0x60')]();}function getFilteredAgentIds(_0x532b04,_0x502b6c){var _0x437c68=_[_0xe3d2('0x61')](_0x532b04)?_0x532b04:[_0x532b04];var _0x3d1daa=_[_0xe3d2('0x62')](_0x437c68,function(_0x570421){return db[_0x502b6c][_0xe3d2('0x63')]({'where':{'name':_0x570421}})[_0xe3d2('0x13')](function(_0x162b73){if(!_0x162b73)return[];return _0x162b73[_0xe3d2('0x64')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3d1daa)['then'](function(_0x272bad){var _0x32536f=_(_0x272bad)['flatten']()['map']('id')[_0xe3d2('0x65')]()['value']();return _0x32536f;});}function getUpdatedSortOptions(_0x107e5f){var _0x1c0230={'fields':[],'order':null};var _0xc29ea9=_0x107e5f['split'](',');_0x1c0230['fields']=_[_0xe3d2('0x3a')](_0xc29ea9,function(_0x11305d){if(!_0x11305d['includes'](_0xe3d2('0x66')))return!![];_0x1c0230['order']=_['startsWith'](_0x11305d,'-')?_0xe3d2('0x67'):_0xe3d2('0x68');return![];});return _0x1c0230;}function orderAgentsByStatus(_0x562654,_0x39f897){return _0x562654[_0xe3d2('0x69')](function(_0xd25c4c,_0x294067){if(_0xd25c4c[_0xe3d2('0x66')]===_0x294067[_0xe3d2('0x66')]&&_0xd25c4c['globalStatus']===_0xe3d2('0x58')){if(_0x39f897===_0xe3d2('0x67'))return(_0xd25c4c[_0xe3d2('0x6a')]||'')<(_0x294067[_0xe3d2('0x6a')]||'')?0x1:-0x1;return _0xd25c4c['pauseType']<_0x294067[_0xe3d2('0x6a')]?-0x1:0x1;}else{if(_0x39f897==='DESC')return _0xd25c4c[_0xe3d2('0x66')]<_0x294067[_0xe3d2('0x66')]?0x1:-0x1;return _0xd25c4c['globalStatus']<_0x294067[_0xe3d2('0x66')]?-0x1:0x1;}});}exports[_0xe3d2('0x64')]=function(_0x4ac8e5,_0x47322c){var _0x47797a={'count':0x0,'rows':[]},_0x3c1a08={},_0x4a3b0a,_0x4d6f8a,_0x5b6e02,_0x2cf0d7,_0xa5973f=[_0xe3d2('0x6b'),_0xe3d2('0x43'),'lastLoginAt','lastPauseAt',_0xe3d2('0x6a'),'lastPauseAt',_0xe3d2('0x3e'),_0xe3d2('0x6c'),'chatPause',_0xe3d2('0x6d'),_0xe3d2('0x4d'),_0xe3d2('0x6e'),_0xe3d2('0x4f'),_0xe3d2('0x6f'),_0xe3d2('0x4e'),_0xe3d2('0x70'),_0xe3d2('0x71'),_0xe3d2('0x72'),'smsCapacity',_0xe3d2('0x73'),_0xe3d2('0x74'),_0xe3d2('0x75'),_0xe3d2('0x76'),_0xe3d2('0x77'),_0xe3d2('0x78'),'whatsappCurrentCapacity',_0xe3d2('0x79'),'chatStatus',_0xe3d2('0x55'),_0xe3d2('0x54'),_0xe3d2('0x56'),'whatsappStatus',_0xe3d2('0x53'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0xe3d2('0x7a'),_0xe3d2('0x7b'),_0xe3d2('0x7c'),_0xe3d2('0x7d'),_0xe3d2('0x7e'),_0xe3d2('0x3b'),_0xe3d2('0x7f'),_0xe3d2('0x80'),_0xe3d2('0x81'),_0xe3d2('0x82'),_0xe3d2('0x83')],_0x413e6e=[_0xe3d2('0x4c'),_0xe3d2('0x6d'),_0xe3d2('0x4d'),_0xe3d2('0x6e'),'whatsappPause','faxPause',_0xe3d2('0x4e'),_0xe3d2('0x43')];Promise[_0xe3d2('0x84')]()[_0xe3d2('0x13')](function(){if(_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x86')])_0x4a3b0a=validateChannel(_0x4ac8e5[_0xe3d2('0x85')]['channel']);if(!_0x4ac8e5[_0xe3d2('0x85')]['sort']||!_0x4ac8e5['query'][_0xe3d2('0x69')][_0xe3d2('0x5f')](_0xe3d2('0x66')))return;var _0x2ec913=getUpdatedSortOptions(_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x69')]);_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x69')]=_0x2ec913[_0xe3d2('0x87')][_0xe3d2('0x88')](',');_0x4d6f8a=_0x2ec913[_0xe3d2('0x89')];})[_0xe3d2('0x13')](function(){if(!_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x8a')])return[];var _0x1dd604=_[_0xe3d2('0x19')](_0x4a3b0a)+_0xe3d2('0x46');return getFilteredAgentIds(_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x8a')],_0x1dd604);})[_0xe3d2('0x13')](function(_0x8cdc14){var _0x1bb166=_[_0xe3d2('0x62')](db[_0xe3d2('0x45')][_0xe3d2('0x8b')],function(_0x90e485){return{'name':_0x90e485[_0xe3d2('0x8c')],'type':_0x90e485[_0xe3d2('0x8d')][_0xe3d2('0x8e')]};});_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x8f')]='agent';_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x43')]=!![];_0x3c1a08=qs[_0xe3d2('0x90')](_0x1bb166,_0x4ac8e5);_0x3c1a08['raw']=!![];if(!_[_0xe3d2('0x91')](_0x8cdc14)){_0x3c1a08[_0xe3d2('0x92')]=_['merge'](_0x3c1a08[_0xe3d2('0x92')],{'$and':[{'id':{'$in':_0x8cdc14}}]});}else if(!_[_0xe3d2('0x91')](_0x4ac8e5['query'][_0xe3d2('0x8a')])){return _0x47797a;}if(_0x4ac8e5[_0xe3d2('0x93')][_0xe3d2('0x8f')]==='user'){var _0x4d0162={'params':{'id':_0x4ac8e5[_0xe3d2('0x93')][_0xe3d2('0x94')]},'query':{'section':_0xe3d2('0x12'),'role':_0xe3d2('0x95'),'online':!![],'nolimit':_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x96')],'sort':_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x69')],'filter':_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x3a')],'raw':!![],'ids':_0x8cdc14}};return db[_0xe3d2('0x97')][_0xe3d2('0x98')](_0x4d0162);}return db[_0xe3d2('0x45')][_0xe3d2('0x99')](_0x3c1a08);})[_0xe3d2('0x13')](function(_0x6ed89d){_0x47797a[_0xe3d2('0x9')]=_0x6ed89d[_0xe3d2('0x9')];_0x5b6e02=_0x6ed89d[_0xe3d2('0x9a')];return getRealtimeAgents();})[_0xe3d2('0x13')](function(_0x115324){_0x2cf0d7=_0x115324[_0xe3d2('0x9a')];return _0x5b6e02[_0xe3d2('0x62')](function(_0x26d2a0){var _0x17128a=_[_0xe3d2('0x39')](_0x2cf0d7,['id',_0x26d2a0['id']]);if(_0x17128a)_[_0xe3d2('0x17')](_0x26d2a0,_[_0xe3d2('0x9b')](_[_0xe3d2('0x9c')](_0x17128a,_0x413e6e),_0xa5973f));_0x26d2a0[_0xe3d2('0x66')]=getAgentStatus(_0x26d2a0);return _0x26d2a0;});})[_0xe3d2('0x13')](function(_0x1d2ba4){var _0x3b224f;if(_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x9d')]){_0x3b224f=_['filter'](_0x1d2ba4,[_0xe3d2('0x66'),_0x4ac8e5[_0xe3d2('0x85')]['globalStatusFilter']]);if(_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x9e')]){_0x3b224f=_['filter'](_0x3b224f,[_0xe3d2('0x6a'),_0x4ac8e5[_0xe3d2('0x85')][_0xe3d2('0x9e')]]);}}if(_0x3b224f)_0x1d2ba4=_0x3b224f;if(!_0x4d6f8a)return _0x1d2ba4;return orderAgentsByStatus(_0x1d2ba4,_0x4d6f8a);})[_0xe3d2('0x13')](function(_0x36dcfa){_0x47797a[_0xe3d2('0x9a')]=_0x36dcfa;return _0x47797a;})[_0xe3d2('0x13')](respondWithFilteredResult(_0x47322c,_0x3c1a08))[_0xe3d2('0x18')](handleError(_0x47322c,null));};exports[_0xe3d2('0x9f')]=function(_0x453df3,_0x4e40d3){var _0x5d6819={'count':0x0,'rows':[]},_0x251064={},_0x22b75b,_0x3fb7c2,_0x40c27f,_0x3aaf98,_0x212bdf;Promise[_0xe3d2('0x84')]()[_0xe3d2('0x13')](function(){if(_0x453df3['query'][_0xe3d2('0x86')])_0x22b75b=validateChannel(_0x453df3[_0xe3d2('0x85')][_0xe3d2('0x86')]);var _0x15f743=_[_0xe3d2('0x19')](_0x22b75b)+_0xe3d2('0x46');var _0x1a3d2e=_[_0xe3d2('0x62')](db[_0x15f743][_0xe3d2('0x8b')],function(_0x305f7c){return{'name':_0x305f7c[_0xe3d2('0x8c')],'type':_0x305f7c[_0xe3d2('0x8d')][_0xe3d2('0x8e')]};});_0x251064=qs[_0xe3d2('0x90')](_0x1a3d2e,_0x453df3);if(_0x453df3[_0xe3d2('0x93')][_0xe3d2('0x8f')]===_0xe3d2('0x93')){var _0x50f556={'params':{'id':_0x453df3[_0xe3d2('0x93')]['userProfileId']},'query':{'section':_0x22b75b===_0xe3d2('0x22')&&_0x453df3['query']['type']===_0xe3d2('0x38')?_0xe3d2('0xa0'):_[_0xe3d2('0x19')](_0x22b75b)+_0xe3d2('0xa1'),'type':_0x453df3[_0xe3d2('0x85')]['type'],'nolimit':!![],'sort':_0xe3d2('0xf'),'filter':_0x453df3['query'][_0xe3d2('0x3a')]}};return db[_0xe3d2('0x97')][_0xe3d2('0x98')](_0x50f556);}return db[_0x15f743]['findAndCountAll'](_0x251064);})[_0xe3d2('0x13')](function(_0x131873){_0x5d6819[_0xe3d2('0x9')]=_0x131873[_0xe3d2('0x9')];_0x3fb7c2=_0x131873[_0xe3d2('0x9a')];return getRealtimeQueues(_0x453df3,_0x22b75b);})[_0xe3d2('0x13')](function(_0x20c39e){_0x3aaf98=_0x20c39e[_0xe3d2('0x9a')];return getRealtimeAgents();})['then'](function(_0x4a926f){_0x40c27f=_0x4a926f[_0xe3d2('0x9a')];if(_0x22b75b!=_0xe3d2('0x22'))return;return getRealtimeVoiceQueueChannels();})[_0xe3d2('0x13')](function(_0x4e1a2d){_0x212bdf=_0x4e1a2d?_0x4e1a2d['rows']:[];return initializeQueues(_0x3fb7c2,_0x3aaf98,_0x22b75b,_0x453df3['query'][_0xe3d2('0x8d')]);})[_0xe3d2('0x13')](function(_0x28d17c){var _0x34747b=_0x28d17c[_0xe3d2('0x62')](function(_0x4ae4b2){if(_0x22b75b===_0xe3d2('0x22'))return getVoiceQueueAgents(_0x4ae4b2,_0x3fb7c2,_0x40c27f,_0x212bdf);else return getQueueAgents(_0x4ae4b2,_0x40c27f,_0x22b75b);});return Promise[_0xe3d2('0xa2')](_0x34747b);})[_0xe3d2('0x13')](function(_0x373399){_0x5d6819[_0xe3d2('0x9a')]=_0x373399;return _0x5d6819;})['then'](respondWithFilteredResult(_0x4e40d3,_0x251064))[_0xe3d2('0x18')](handleError(_0x4e40d3,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b9b5474..167ffac 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(_0x1be143,_0x2f58ed){var _0xaa3f65=function(_0x121eee){while(--_0x121eee){_0x1be143['push'](_0x1be143['shift']());}};_0xaa3f65(++_0x2f58ed);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1f20d6,_0x1b4431){var _0x2a7f7f=function(_0x3d4642){while(--_0x3d4642){_0x1f20d6['push'](_0x1f20d6['shift']());}};_0x2a7f7f(++_0x1b4431);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 27cc7dc..cf4d7fa 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 _0x1419=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x1419,0x127));var _0x9141=function(_0x55272c,_0x35dd92){_0x55272c=_0x55272c-0x0;var _0x566549=_0x1419[_0x55272c];return _0x566549;};'use strict';var Sequelize=require(_0x9141('0x0'));module[_0x9141('0x1')]={'state':{'type':Sequelize[_0x9141('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9141('0x3')]},'scheduledat':{'type':Sequelize[_0x9141('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x9141('0x4')]},'ringtime':{'type':Sequelize[_0x9141('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9141('0x3')]}}; \ No newline at end of file +var _0x9120=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9120,0x1b3));var _0x0912=function(_0x1ecf14,_0xe1dcd5){_0x1ecf14=_0x1ecf14-0x0;var _0x270a90=_0x9120[_0x1ecf14];return _0x270a90;};'use strict';var Sequelize=require(_0x0912('0x0'));module[_0x0912('0x1')]={'state':{'type':Sequelize[_0x0912('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0912('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0912('0x4')]},'responsetime':{'type':Sequelize[_0x0912('0x4')]},'ringtime':{'type':Sequelize[_0x0912('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0912('0x3')]},'campaigntype':{'type':Sequelize[_0x0912('0x3')]},'membername':{'type':Sequelize[_0x0912('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3aca7c5..e19a1ca 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 _0xbb77=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api'];(function(_0x210f1b,_0x3689e0){var _0x10a9c5=function(_0x29f9a4){while(--_0x29f9a4){_0x210f1b['push'](_0x210f1b['shift']());}};_0x10a9c5(++_0x3689e0);}(_0xbb77,0x13e));var _0x7bb7=function(_0x19cfaf,_0x3c1118){_0x19cfaf=_0x19cfaf-0x0;var _0x1b3abb=_0xbb77[_0x19cfaf];return _0x1b3abb;};'use strict';var _=require(_0x7bb7('0x0'));var util=require(_0x7bb7('0x1'));var logger=require(_0x7bb7('0x2'))(_0x7bb7('0x3'));var moment=require(_0x7bb7('0x4'));var BPromise=require(_0x7bb7('0x5'));var rp=require(_0x7bb7('0x6'));var fs=require('fs');var path=require(_0x7bb7('0x7'));var rimraf=require(_0x7bb7('0x8'));var config=require(_0x7bb7('0x9'));var attributes=require(_0x7bb7('0xa'));module[_0x7bb7('0xb')]=function(_0x57944f,_0x298a77){return _0x57944f[_0x7bb7('0xc')](_0x7bb7('0xd'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad1b=['api','moment','bluebird','path','rimraf','exports','define','report_agent_preview','lodash'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xad1b,0x98));var _0xbad1=function(_0x3ad37d,_0xe23097){_0x3ad37d=_0x3ad37d-0x0;var _0x31b4e6=_0xad1b[_0x3ad37d];return _0x31b4e6;};'use strict';var _=require(_0xbad1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbad1('0x1'));var moment=require(_0xbad1('0x2'));var BPromise=require(_0xbad1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbad1('0x4'));var rimraf=require(_0xbad1('0x5'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xbad1('0x6')]=function(_0x466c73,_0x572a19){return _0x466c73[_0xbad1('0x7')]('ReportAgentPreview',attributes,{'tableName':_0xbad1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index eae1031..e64ed6e 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 _0xa36d=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','body','options','raw','CreateReportAgentPreview'];(function(_0x7f80ce,_0x56e734){var _0x3c2f8e=function(_0xb635cd){while(--_0xb635cd){_0x7f80ce['push'](_0x7f80ce['shift']());}};_0x3c2f8e(++_0x56e734);}(_0xa36d,0xf9));var _0xda36=function(_0x388815,_0x2c29ad){_0x388815=_0x388815-0x0;var _0x2b8a7b=_0xa36d[_0x388815];return _0x2b8a7b;};'use strict';var _=require(_0xda36('0x0'));var util=require(_0xda36('0x1'));var moment=require(_0xda36('0x2'));var BPromise=require(_0xda36('0x3'));var rs=require(_0xda36('0x4'));var fs=require('fs');var Redis=require(_0xda36('0x5'));var db=require(_0xda36('0x6'))['db'];var utils=require(_0xda36('0x7'));var logger=require(_0xda36('0x8'))(_0xda36('0x9'));var config=require(_0xda36('0xa'));var jayson=require(_0xda36('0xb'));var client=jayson[_0xda36('0xc')][_0xda36('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x520bbd,_0x497088,_0x24c3d6){return new BPromise(function(_0xeba7d3,_0x239ca0){return client['request'](_0x520bbd,_0x24c3d6)[_0xda36('0xe')](function(_0xebf00){logger['info'](_0xda36('0xf'),_0x497088,_0xda36('0x10'));logger['debug'](_0xda36('0x11'),_0x497088,_0xda36('0x10'),JSON[_0xda36('0x12')](_0xebf00));if(_0xebf00[_0xda36('0x13')]){if(_0xebf00['error'][_0xda36('0x14')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x497088,_0xebf00[_0xda36('0x13')][_0xda36('0x15')]);return _0x239ca0(_0xebf00[_0xda36('0x13')][_0xda36('0x15')]);}logger[_0xda36('0x13')](_0xda36('0xf'),_0x497088,_0xebf00[_0xda36('0x13')]['message']);return _0xeba7d3(_0xebf00[_0xda36('0x13')]['message']);}else{logger[_0xda36('0x16')](_0xda36('0xf'),_0x497088,_0xda36('0x10'));_0xeba7d3(_0xebf00[_0xda36('0x17')][_0xda36('0x15')]);}})[_0xda36('0x18')](function(_0x4372c4){logger['error'](_0xda36('0xf'),_0x497088,_0x4372c4);_0x239ca0(_0x4372c4);});});}exports['CreateReportAgentPreview']=function(_0x3f9908){var _0x43503e=this;return new Promise(function(_0x58c08d,_0x33ef89){return db['ReportAgentPreview'][_0xda36('0x19')](_0x3f9908[_0xda36('0x1a')],{'raw':_0x3f9908[_0xda36('0x1b')]?_0x3f9908['options'][_0xda36('0x1c')]===undefined?!![]:![]:!![]})[_0xda36('0xe')](function(_0x426c0c){logger['info'](_0xda36('0x1d'),_0x3f9908);logger[_0xda36('0x1e')](_0xda36('0x1d'),_0x3f9908,JSON[_0xda36('0x12')](_0x426c0c));_0x58c08d(_0x426c0c);})['catch'](function(_0x45da0f){logger[_0xda36('0x13')](_0xda36('0x1d'),_0x45da0f['message'],_0x3f9908);_0x33ef89(_0x43503e[_0xda36('0x13')](0x1f4,_0x45da0f[_0xda36('0x15')]));});});}; \ No newline at end of file +var _0x1ded=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','moment'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1ded,0x84));var _0xd1de=function(_0x2acfee,_0x18ecb7){_0x2acfee=_0x2acfee-0x0;var _0x362c3e=_0x1ded[_0x2acfee];return _0x362c3e;};'use strict';var _=require(_0xd1de('0x0'));var util=require(_0xd1de('0x1'));var moment=require(_0xd1de('0x2'));var BPromise=require(_0xd1de('0x3'));var rs=require(_0xd1de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1de('0x5'))['db'];var utils=require(_0xd1de('0x6'));var logger=require('../../config/logger')(_0xd1de('0x7'));var config=require(_0xd1de('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd1de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ba84d,_0x1e2f40,_0x39dd45){return new BPromise(function(_0x480201,_0x5916df){return client['request'](_0x5ba84d,_0x39dd45)[_0xd1de('0xa')](function(_0x2e43c4){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1e2f40,_0xd1de('0xb'));logger[_0xd1de('0xc')](_0xd1de('0xd'),_0x1e2f40,_0xd1de('0xb'),JSON['stringify'](_0x2e43c4));if(_0x2e43c4[_0xd1de('0xe')]){if(_0x2e43c4['error']['code']===0x1f4){logger[_0xd1de('0xe')](_0xd1de('0xf'),_0x1e2f40,_0x2e43c4['error'][_0xd1de('0x10')]);return _0x5916df(_0x2e43c4[_0xd1de('0xe')][_0xd1de('0x10')]);}logger[_0xd1de('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x1e2f40,_0x2e43c4[_0xd1de('0xe')][_0xd1de('0x10')]);return _0x480201(_0x2e43c4[_0xd1de('0xe')]['message']);}else{logger[_0xd1de('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x1e2f40,'request\x20sent');_0x480201(_0x2e43c4[_0xd1de('0x12')][_0xd1de('0x10')]);}})[_0xd1de('0x13')](function(_0x4812d0){logger[_0xd1de('0xe')](_0xd1de('0xf'),_0x1e2f40,_0x4812d0);_0x5916df(_0x4812d0);});});}exports[_0xd1de('0x14')]=function(_0x2b5130){var _0x3880c2=this;return new Promise(function(_0x2bba03,_0x377f59){return db[_0xd1de('0x15')][_0xd1de('0x16')](_0x2b5130[_0xd1de('0x17')],{'raw':_0x2b5130[_0xd1de('0x18')]?_0x2b5130[_0xd1de('0x18')][_0xd1de('0x19')]===undefined?!![]:![]:!![]})[_0xd1de('0xa')](function(_0x3d3e2d){logger[_0xd1de('0x11')]('CreateReportAgentPreview',_0x2b5130);logger[_0xd1de('0xc')](_0xd1de('0x14'),_0x2b5130,JSON[_0xd1de('0x1a')](_0x3d3e2d));_0x2bba03(_0x3d3e2d);})[_0xd1de('0x13')](function(_0x2c60b7){logger['error'](_0xd1de('0x14'),_0x2c60b7[_0xd1de('0x10')],_0x2b5130);_0x377f59(_0x3880c2[_0xd1de('0xe')](0x1f4,_0x2c60b7[_0xd1de('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1474c7b..557be7c 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 _0x7f14=['get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/telephones','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','chat','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','../../components/auth/service','./rpc.controller'];(function(_0x5689a9,_0x30084f){var _0x437de2=function(_0x2f3978){while(--_0x2f3978){_0x5689a9['push'](_0x5689a9['shift']());}};_0x437de2(++_0x30084f);}(_0x7f14,0x87));var _0x47f1=function(_0x1a9e15,_0x5bc871){_0x1a9e15=_0x1a9e15-0x0;var _0x10a28f=_0x7f14[_0x1a9e15];return _0x10a28f;};'use strict';var multer=require('multer');var util=require(_0x47f1('0x0'));var path=require(_0x47f1('0x1'));var express=require(_0x47f1('0x2'));var router=express['Router']();var auth=require(_0x47f1('0x3'));var controller=require(_0x47f1('0x4'));router[_0x47f1('0x5')](_0x47f1('0x6'),auth['isAuthenticated'](),controller[_0x47f1('0x7')]);router[_0x47f1('0x5')](_0x47f1('0x8'),auth[_0x47f1('0x9')](),controller[_0x47f1('0xa')]);router[_0x47f1('0x5')](_0x47f1('0xb'),auth[_0x47f1('0x9')](),controller[_0x47f1('0xc')]);router[_0x47f1('0x5')](_0x47f1('0xd'),auth[_0x47f1('0x9')](),controller[_0x47f1('0xe')]);router[_0x47f1('0x5')](_0x47f1('0xf'),auth['isAuthenticated'](),controller[_0x47f1('0x10')]);router[_0x47f1('0x5')](_0x47f1('0x11'),auth[_0x47f1('0x9')](),controller['mailQueues']);router[_0x47f1('0x5')](_0x47f1('0x12'),auth['isAuthenticated'](),controller['mailAccounts']);router['get'](_0x47f1('0x13'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x14')]);router[_0x47f1('0x5')]('/sms/queues',auth[_0x47f1('0x9')](),controller[_0x47f1('0x15')]);router[_0x47f1('0x5')](_0x47f1('0x16'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x17')]);router[_0x47f1('0x5')]('/fax/queues',auth['isAuthenticated'](),controller[_0x47f1('0x18')]);router[_0x47f1('0x5')]('/voice/queues/preview/:id',auth[_0x47f1('0x9')](),controller[_0x47f1('0x19')]);router[_0x47f1('0x5')](_0x47f1('0x1a'),auth[_0x47f1('0x9')](),controller['voiceQueuesChannels']);router[_0x47f1('0x5')](_0x47f1('0x1b'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x1c')]);router['get'](_0x47f1('0x1d'),auth['isAuthenticated'](),controller[_0x47f1('0x1e')]);router[_0x47f1('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get'](_0x47f1('0x1f'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x20')]);router[_0x47f1('0x21')](_0x47f1('0x1f'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x22')]);router[_0x47f1('0x5')](_0x47f1('0x23'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x24')]);router['get'](_0x47f1('0x25'),auth[_0x47f1('0x9')](),controller['outboundChannels']);router[_0x47f1('0x5')](_0x47f1('0x26'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x27')]);router[_0x47f1('0x21')]('/agents/:id/capacity',auth[_0x47f1('0x9')](),controller['agentCapacity']);router[_0x47f1('0x5')](_0x47f1('0x28'),auth['isAuthenticated'](),controller['telephones']);router[_0x47f1('0x5')]('/trunks',auth[_0x47f1('0x9')](),controller['trunks']);router[_0x47f1('0x5')](_0x47f1('0x29'),auth[_0x47f1('0x9')](),controller['campaigns']);router[_0x47f1('0x5')]('/fax/accounts',auth[_0x47f1('0x9')](),controller[_0x47f1('0x2a')]);router[_0x47f1('0x5')](_0x47f1('0x2b'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x2c')]);router[_0x47f1('0x5')](_0x47f1('0x2d'),auth[_0x47f1('0x9')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x47f1('0x2e'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x47f1('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0x47f1('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x47f1('0x5')](_0x47f1('0x2f'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x30')]);router[_0x47f1('0x5')](_0x47f1('0x31'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x32')]);router['get'](_0x47f1('0x33'),auth[_0x47f1('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x47f1('0x34')](_0x47f1('0x35'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x36')]('mail'));router[_0x47f1('0x5')]('/mail/queues/:id',auth[_0x47f1('0x9')](),controller['showMailQueues']);router[_0x47f1('0x34')]('/chat/queues/:id/notify',auth[_0x47f1('0x9')](),controller[_0x47f1('0x36')](_0x47f1('0x37')));router['get']('/chat/queues/:id',auth[_0x47f1('0x9')](),controller['showChatQueues']);router[_0x47f1('0x34')](_0x47f1('0x38'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x36')](_0x47f1('0x39')));router['get'](_0x47f1('0x3a'),auth[_0x47f1('0x9')](),controller['showFaxQueues']);router[_0x47f1('0x34')]('/openchannel/queues/:id/notify',auth[_0x47f1('0x9')](),controller[_0x47f1('0x36')]('openchannel'));router[_0x47f1('0x5')](_0x47f1('0x3b'),auth[_0x47f1('0x9')](),controller[_0x47f1('0x3c')]);router['post'](_0x47f1('0x3d'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router['post'](_0x47f1('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0x47f1('0x3f')));router[_0x47f1('0x5')](_0x47f1('0x40'),auth['isAuthenticated'](),controller[_0x47f1('0x41')]);router[_0x47f1('0x5')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x47f1('0x42')]);router['post'](_0x47f1('0x43'),auth['isAuthenticated'](),controller[_0x47f1('0x44')]);module[_0x47f1('0x45')]=router; \ No newline at end of file +var _0xc6de=['/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xc6de,0x1ec));var _0xec6d=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0xc6de[_0x4e170e];return _0x338291;};'use strict';var multer=require(_0xec6d('0x0'));var util=require(_0xec6d('0x1'));var path=require(_0xec6d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xec6d('0x3'));var controller=require(_0xec6d('0x4'));router[_0xec6d('0x5')](_0xec6d('0x6'),auth[_0xec6d('0x7')](),controller['voiceChannels']);router[_0xec6d('0x5')](_0xec6d('0x8'),auth[_0xec6d('0x7')](),controller['voiceChannelMixMonitor']);router[_0xec6d('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xec6d('0x7')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xec6d('0x9'),auth[_0xec6d('0x7')](),controller[_0xec6d('0xa')]);router[_0xec6d('0x5')]('/chat/queues',auth[_0xec6d('0x7')](),controller[_0xec6d('0xb')]);router['get'](_0xec6d('0xc'),auth[_0xec6d('0x7')](),controller['mailQueues']);router[_0xec6d('0x5')]('/mail/accounts',auth[_0xec6d('0x7')](),controller[_0xec6d('0xd')]);router[_0xec6d('0x5')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0xec6d('0xe')]);router[_0xec6d('0x5')](_0xec6d('0xf'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x10')]);router[_0xec6d('0x5')](_0xec6d('0x11'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x12')]);router[_0xec6d('0x5')]('/fax/queues',auth[_0xec6d('0x7')](),controller[_0xec6d('0x13')]);router[_0xec6d('0x5')]('/voice/queues/preview/:id',auth[_0xec6d('0x7')](),controller[_0xec6d('0x14')]);router[_0xec6d('0x5')](_0xec6d('0x15'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x16')]);router['get'](_0xec6d('0x17'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x18')]);router[_0xec6d('0x5')](_0xec6d('0x19'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x1a')]);router[_0xec6d('0x5')](_0xec6d('0x1b'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x1c')]);router[_0xec6d('0x5')](_0xec6d('0x1d'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x1e')]);router['put'](_0xec6d('0x1d'),auth[_0xec6d('0x7')](),controller['updateVoiceQueue']);router[_0xec6d('0x5')](_0xec6d('0x1f'),auth[_0xec6d('0x7')](),controller['outbound']);router['get'](_0xec6d('0x20'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x21')]);router[_0xec6d('0x5')]('/agents',auth[_0xec6d('0x7')](),controller[_0xec6d('0x22')]);router[_0xec6d('0x23')]('/agents/:id/capacity',auth[_0xec6d('0x7')](),controller[_0xec6d('0x24')]);router[_0xec6d('0x5')](_0xec6d('0x25'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x26')]);router[_0xec6d('0x5')](_0xec6d('0x27'),auth['isAuthenticated'](),controller[_0xec6d('0x28')]);router['get'](_0xec6d('0x29'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x2a')]);router[_0xec6d('0x5')](_0xec6d('0x2b'),auth['isAuthenticated'](),controller[_0xec6d('0x2c')]);router[_0xec6d('0x5')](_0xec6d('0x2d'),auth['isAuthenticated'](),controller[_0xec6d('0x2e')]);router['get']('/mail/queues/waitinginteractions',auth[_0xec6d('0x7')](),controller[_0xec6d('0x2f')]);router[_0xec6d('0x5')](_0xec6d('0x30'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x31')]);router[_0xec6d('0x5')](_0xec6d('0x32'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x33')]);router[_0xec6d('0x5')](_0xec6d('0x34'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x35')]);router['get'](_0xec6d('0x36'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x37')]);router['get'](_0xec6d('0x38'),auth[_0xec6d('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xec6d('0x39'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x3a')](_0xec6d('0x3b')));router[_0xec6d('0x5')](_0xec6d('0x3c'),auth[_0xec6d('0x7')](),controller['showMailQueues']);router[_0xec6d('0x3d')](_0xec6d('0x3e'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x3a')](_0xec6d('0x3f')));router[_0xec6d('0x5')](_0xec6d('0x40'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x41')]);router[_0xec6d('0x3d')](_0xec6d('0x42'),auth['isAuthenticated'](),controller[_0xec6d('0x3a')](_0xec6d('0x43')));router['get']('/fax/queues/:id',auth[_0xec6d('0x7')](),controller['showFaxQueues']);router['post'](_0xec6d('0x44'),auth[_0xec6d('0x7')](),controller['queueNotify'](_0xec6d('0x45')));router[_0xec6d('0x5')](_0xec6d('0x46'),auth[_0xec6d('0x7')](),controller['showOpenchannelQueues']);router['post'](_0xec6d('0x47'),auth[_0xec6d('0x7')](),controller['queueNotify']('sms'));router[_0xec6d('0x3d')](_0xec6d('0x48'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x3a')](_0xec6d('0x49')));router[_0xec6d('0x5')](_0xec6d('0x4a'),auth[_0xec6d('0x7')](),controller[_0xec6d('0x4b')]);router['get'](_0xec6d('0x4c'),auth['isAuthenticated'](),controller[_0xec6d('0x4d')]);router[_0xec6d('0x3d')](_0xec6d('0x4e'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xec6d('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 276984a..aa977f9 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 _0x46ed=['send','isNil','rows','VoiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','name'];(function(_0x358557,_0x1e99c1){var _0xb23048=function(_0x32bb8e){while(--_0x32bb8e){_0x358557['push'](_0x358557['shift']());}};_0xb23048(++_0x1e99c1);}(_0x46ed,0x168));var _0xd46e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x46ed[_0x19950b];return _0x3c6b41;};'use strict';var BPromise=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var _=require('lodash');var util=require(_0xd46e('0x2'));var db=require(_0xd46e('0x3'))['db'];var logger=require(_0xd46e('0x4'))('api');var jayson=require(_0xd46e('0x5'));var amiClient=jayson[_0xd46e('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232b});var routingClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){var _0x19e4f4=_0x437ea0?_0x437ea0:amiClient;return _0x19e4f4[_0xd46e('0x8')](_0x45e680,_0x855f24)['then'](function(_0x7b2d69){if(_0x7b2d69[_0xd46e('0x9')]){if(_0x7b2d69['error'][_0xd46e('0xa')]===0x1f4){return _0x31259b(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}return _0x144687(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}else{_0x144687(_0x7b2d69[_0xd46e('0xc')]);}})['catch'](function(_0x24c54b){_0x31259b(_0x24c54b);});});}function respondWithResult(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xc8;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0xd')](_0x48550b)['json'](_0xf3048c);}return _0x5bc1da['sendStatus'](0x194);};}function handleError(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0x1f4;return function(_0x1e9aae){logger[_0xd46e('0x9')](_0x1e9aae['stack']);if(_0x1e9aae[_0xd46e('0xe')]){delete _0x1e9aae[_0xd46e('0xe')];}_0xacd799[_0xd46e('0xd')](_0x4688ae)[_0xd46e('0xf')](_0x1e9aae);};}function findById(_0x36a317){return function(_0x47fa8f){if(!_[_0xd46e('0x10')](_0x36a317)&&!_[_0xd46e('0x10')](_0x47fa8f)&&!_[_0xd46e('0x10')](_0x47fa8f['rows'])){return _['find'](_0x47fa8f[_0xd46e('0x11')],function(_0x1bd574){return _0x1bd574['id']==_0x36a317;});}return null;};}exports['voiceChannels']=function(_0x4fd1f2,_0x2d6f2c){return respondWithRpcPromise(_0xd46e('0x12'),_0x4fd1f2[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x2d6f2c,null))[_0xd46e('0x15')](handleError(_0x2d6f2c,null));};exports[_0xd46e('0x16')]=function(_0x3b5fa4,_0x327b7e){return respondWithRpcPromise(_0xd46e('0x17'),_[_0xd46e('0x18')](_0x3b5fa4[_0xd46e('0x13')],_0x3b5fa4['params']))[_0xd46e('0x14')](respondWithResult(_0x327b7e,null))[_0xd46e('0x15')](handleError(_0x327b7e,null));};exports[_0xd46e('0x19')]=function(_0x45ce0b,_0x128246){return respondWithRpcPromise(_0xd46e('0x1a'),_[_0xd46e('0x18')](_0x45ce0b[_0xd46e('0x13')],_0x45ce0b[_0xd46e('0x1b')]))['then'](respondWithResult(_0x128246,null))[_0xd46e('0x15')](handleError(_0x128246,null));};exports['voiceQueues']=function(_0x4b8f6a,_0x371054){return respondWithRpcPromise(_0xd46e('0x1c'),_0x4b8f6a[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x371054,null))[_0xd46e('0x15')](handleError(_0x371054,null));};exports[_0xd46e('0x1d')]=function(_0x1740d1,_0x4dab6a){return respondWithRpcPromise(_0xd46e('0x1c'),_0x1740d1[_0xd46e('0x13')])[_0xd46e('0x14')](findById(_0x1740d1[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4dab6a,null))[_0xd46e('0x15')](handleError(_0x4dab6a,null));};exports['updateVoiceQueue']=function(_0x465d54,_0x3a1ced){return respondWithRpcPromise(_0xd46e('0x1e'),_[_0xd46e('0x18')](_0x465d54[_0xd46e('0x1f')],_0x465d54[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x3a1ced,null))[_0xd46e('0x15')](handleError(_0x3a1ced,null));};exports[_0xd46e('0x20')]=function(_0x45ea47,_0x2ff785){return respondWithRpcPromise(_0xd46e('0x21'),_[_0xd46e('0x18')](_0x45ea47['query'],_0x45ea47[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x2ff785,null))[_0xd46e('0x15')](handleError(_0x2ff785,null));};exports[_0xd46e('0x22')]=function(_0x5ef248,_0x2eed3a){return respondWithRpcPromise(_0xd46e('0x23'),_0x5ef248['query'])[_0xd46e('0x14')](respondWithResult(_0x2eed3a,null))[_0xd46e('0x15')](handleError(_0x2eed3a,null));};exports['voiceQueuesChannel']=function(_0x306458,_0x1c15c9){return respondWithRpcPromise(_0xd46e('0x24'),_['merge'](_0x306458['query'],_0x306458[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x1c15c9,null))[_0xd46e('0x15')](handleError(_0x1c15c9,null));};exports[_0xd46e('0x25')]=function(_0x83526a,_0x423de9){return respondWithRpcPromise(_0xd46e('0x26'),_[_0xd46e('0x18')](_0x83526a['query'],_0x83526a[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x423de9,null))[_0xd46e('0x15')](handleError(_0x423de9,null));};exports[_0xd46e('0x27')]=function(_0x1fa66c,_0x1e0897){return respondWithRpcPromise(_0xd46e('0x28'),_['merge'](_0x1fa66c[_0xd46e('0x13')],_0x1fa66c[_0xd46e('0x1b')]))['then'](respondWithResult(_0x1e0897,null))[_0xd46e('0x15')](handleError(_0x1e0897,null));};exports[_0xd46e('0x29')]=function(_0x12ccf8,_0x3b6e67){return respondWithRpcPromise('Outbound',_0x12ccf8[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x3b6e67,null))[_0xd46e('0x15')](handleError(_0x3b6e67,null));};exports[_0xd46e('0x2a')]=function(_0xefe5f4,_0x1f58ad){return respondWithRpcPromise(_0xd46e('0x2b'),_0xefe5f4[_0xd46e('0x13')])['then'](respondWithResult(_0x1f58ad,null))[_0xd46e('0x15')](handleError(_0x1f58ad,null));};exports[_0xd46e('0x2c')]=function(_0xc83ea1,_0x25657a){var _0x165ce8;return respondWithRpcPromise('Agents',_0xc83ea1[_0xd46e('0x13')])['then'](function(_0x55230d){_0x165ce8=_0x55230d;return respondWithRpcPromise('Agents',_0xc83ea1['query'],routingClient);})[_0xd46e('0x14')](function(_0x54949f){return _[_0xd46e('0x18')]({},_0x54949f,_0x165ce8);})[_0xd46e('0x14')](respondWithResult(_0x25657a,null))['catch'](handleError(_0x25657a,null));};exports[_0xd46e('0x2d')]=function(_0x4114e6,_0x3bd5e9){if(_0x4114e6[_0xd46e('0x1f')]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')]&&_0x4114e6[_0xd46e('0x2f')]&&_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]){for(var _0xec367d in _0x4114e6[_0xd46e('0x1f')]['interaction']){if(_0x4114e6['body']['interaction'][_0xd46e('0x30')](_0xec367d)){db['MemberReport'][_0xd46e('0x31')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':_0xd46e('0x32'),'exitAt':null,'uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]['length']?{'$notIn':_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d]}:{'$ne':null}}})[_0xd46e('0x14')](function(_0x196e51){var _0x41a983=moment()[_0xd46e('0x33')](_0xd46e('0x34'));for(var _0x5d65ca=0x0,_0x384b6e=_0x196e51[_0xd46e('0x35')];_0x5d65ca<_0x384b6e;_0x5d65ca+=0x1){_0x196e51[_0x5d65ca][_0xd46e('0x36')]({'exitAt':_0x41a983});}});for(var _0xac268d=0x0;_0xac268d<_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d][_0xd46e('0x35')];_0xac268d+=0x1){db[_0xd46e('0x37')][_0xd46e('0x38')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':'INTERACTION','uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d][_0xac268d],'exitAt':null},'defaults':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'interface':_[_0xd46e('0x10')](_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')])?util[_0xd46e('0x33')]('SIP/%s',_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]):_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')],'type':_0xd46e('0x32'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd46e('0x3a'),'internal':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x3b')],'uniqueid':_0x4114e6['body']['interaction'][_0xec367d][_0xac268d]}});}}}}return respondWithRpcPromise(_0xd46e('0x3c'),{'id':_0x4114e6[_0xd46e('0x1b')]['id'],'capacity':_0x4114e6['body'][_0xd46e('0x3d')]},routingClient)[_0xd46e('0x14')](respondWithResult(_0x3bd5e9,null))[_0xd46e('0x15')](handleError(_0x3bd5e9,null));};exports[_0xd46e('0x3e')]=function(_0x1bd8a5,_0x34d4ca){return respondWithRpcPromise(_0xd46e('0x3f'),_0x1bd8a5[_0xd46e('0x13')])['then'](respondWithResult(_0x34d4ca,null))[_0xd46e('0x15')](handleError(_0x34d4ca,null));};exports[_0xd46e('0x40')]=function(_0x1c7f92,_0x63ee74){return respondWithRpcPromise('Trunks',_0x1c7f92['query'])[_0xd46e('0x14')](respondWithResult(_0x63ee74,null))['catch'](handleError(_0x63ee74,null));};exports[_0xd46e('0x41')]=function(_0x2af20b,_0x393cb9){return respondWithRpcPromise(_0xd46e('0x42'),_0x2af20b[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x393cb9,null))['catch'](handleError(_0x393cb9,null));};exports[_0xd46e('0x43')]=function(_0x354739,_0x51f45a){return respondWithRpcPromise('ChatQueues',_0x354739[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x51f45a,null))[_0xd46e('0x15')](handleError(_0x51f45a,null));};exports[_0xd46e('0x44')]=function(_0x1886e6,_0x2cc676){return respondWithRpcPromise(_0xd46e('0x45'),_0x1886e6[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x1886e6[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x2cc676,null))[_0xd46e('0x15')](handleError(_0x2cc676,null));};exports[_0xd46e('0x46')]=function(_0x402df2,_0x47a86c){return respondWithRpcPromise(_0xd46e('0x47'),_0x402df2[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x47a86c,null))[_0xd46e('0x15')](handleError(_0x47a86c,null));};exports['showMailQueues']=function(_0x636f15,_0x36e18a){return respondWithRpcPromise(_0xd46e('0x47'),_0x636f15[_0xd46e('0x13')],routingClient)['then'](findById(_0x636f15[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x36e18a,null))['catch'](handleError(_0x36e18a,null));};exports['mailAccounts']=function(_0x45e102,_0xd59920){return respondWithRpcPromise(_0xd46e('0x48'),_0x45e102['query'],mailClient)['then'](respondWithResult(_0xd59920,null))[_0xd46e('0x15')](handleError(_0xd59920,null));};exports[_0xd46e('0x49')]=function(_0x1f310d,_0x263425){return respondWithRpcPromise(_0xd46e('0x4a'),_0x1f310d[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x263425,null))[_0xd46e('0x15')](handleError(_0x263425,null));};exports[_0xd46e('0x4b')]=function(_0x2a172c,_0x4af44){return respondWithRpcPromise(_0xd46e('0x4a'),_0x2a172c[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2a172c[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4af44,null))['catch'](handleError(_0x4af44,null));};exports[_0xd46e('0x4c')]=function(_0x1a3771,_0x3a2dec){return respondWithRpcPromise('SmsQueues',_0x1a3771[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x3a2dec,null))['catch'](handleError(_0x3a2dec,null));};exports[_0xd46e('0x4d')]=function(_0x2c86fe,_0x1801d4){return respondWithRpcPromise('SmsQueues',_0x2c86fe[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2c86fe[_0xd46e('0x1b')]['id']))['then'](respondWithResult(_0x1801d4,null))[_0xd46e('0x15')](handleError(_0x1801d4,null));};exports['whatsappQueues']=function(_0x32eed0,_0x148187){return respondWithRpcPromise(_0xd46e('0x4e'),_0x32eed0['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x148187,null))[_0xd46e('0x15')](handleError(_0x148187,null));};exports[_0xd46e('0x4f')]=function(_0xbce76f,_0x502f37){return respondWithRpcPromise(_0xd46e('0x4e'),_0xbce76f[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0xbce76f[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x502f37,null))[_0xd46e('0x15')](handleError(_0x502f37,null));};exports[_0xd46e('0x50')]=function(_0x41057c,_0x24be84){return respondWithRpcPromise('FaxQueues',_0x41057c['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x24be84,null))[_0xd46e('0x15')](handleError(_0x24be84,null));};exports[_0xd46e('0x51')]=function(_0x2fff69,_0x249938){return respondWithRpcPromise('FaxQueues',_0x2fff69[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2fff69[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x249938,null))['catch'](handleError(_0x249938,null));};exports[_0xd46e('0x52')]=function(_0x9dd439,_0x5a36df){return respondWithRpcPromise(_0xd46e('0x53'),_0x9dd439[_0xd46e('0x13')])['then'](respondWithResult(_0x5a36df,null))[_0xd46e('0x15')](handleError(_0x5a36df,null));};exports[_0xd46e('0x54')]=function(_0x566e65,_0x44ba36){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x566e65[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x44ba36,null))['catch'](handleError(_0x44ba36,null));};exports['mailQueuesWaitingInteractions']=function(_0x475133,_0x3eb6b){return respondWithRpcPromise(_0xd46e('0x55'),_0x475133[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x3eb6b,null))[_0xd46e('0x15')](handleError(_0x3eb6b,null));};exports[_0xd46e('0x56')]=function(_0x510a1e,_0x10bcdb){return respondWithRpcPromise(_0xd46e('0x57'),_0x510a1e[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x10bcdb,null))[_0xd46e('0x15')](handleError(_0x10bcdb,null));};exports[_0xd46e('0x58')]=function(_0x21f193,_0xaf7c79){return respondWithRpcPromise(_0xd46e('0x57'),_0x21f193['query'],routingClient)[_0xd46e('0x14')](function(_0x1c1bae){if(_0x21f193['query'][_0xd46e('0x59')]!==undefined){var _0x3ba83f=_(_0x1c1bae[_0xd46e('0x11')])[_0xd46e('0x5a')]([_0x21f193[_0xd46e('0x13')][_0xd46e('0x59')],_0x21f193['params']['id']])['map'](_0xd46e('0x5b'))[_0xd46e('0x5c')]()['value']();return _0x1c1bae['rows']['filter'](function(_0x825746){return _0x3ba83f[_0xd46e('0x5d')](_0x825746[_0xd46e('0x5b')])>-0x1;});}else{return _0x1c1bae['rows'][_0xd46e('0x5a')](function(_0x69ade9){return _0x69ade9[_0xd46e('0x5b')]===parseInt(_0x21f193['params']['id']);});}})['then'](respondWithResult(_0xaf7c79,null))['catch'](handleError(_0xaf7c79,null));};exports['smsQueuesWaitingInteractions']=function(_0x2d4410,_0x5d7c51){return respondWithRpcPromise(_0xd46e('0x5e'),_0x2d4410['query'],routingClient)['then'](respondWithResult(_0x5d7c51,null))[_0xd46e('0x15')](handleError(_0x5d7c51,null));};exports[_0xd46e('0x5f')]=function(_0x3df2c2,_0x2754ff){return respondWithRpcPromise(_0xd46e('0x60'),_0x3df2c2[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x2754ff,null))['catch'](handleError(_0x2754ff,null));};exports[_0xd46e('0x61')]=function(_0x383919,_0x114f2c){return respondWithRpcPromise(_0xd46e('0x62'),_0x383919['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x114f2c,null))[_0xd46e('0x15')](handleError(_0x114f2c,null));};exports['queueNotify']=function(_0x1309b5){return function(_0x483ef1,_0x2abaee){var _0x24a2e1,_0x5b54b6;var _0x59fb83=_[_0xd46e('0x63')](_0x1309b5);var _0x2c11b8=_0x1309b5===_0xd46e('0x64')?'Website':_0xd46e('0x65');return db[_0x59fb83+_0xd46e('0x66')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x483ef1[_0xd46e('0x1b')]['id']}})[_0xd46e('0x14')](function(_0x88460a){if(_[_0xd46e('0x10')](_0x88460a)){throw new Error(_0x59fb83+_0xd46e('0x68'));}_0x24a2e1=_0x88460a;return db[_0x59fb83+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x483ef1[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x59fb83+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x59fb83+_0x2c11b8],'as':_0xd46e('0x65')}]});})[_0xd46e('0x14')](function(_0x441f73){if(_[_0xd46e('0x10')](_0x441f73)){throw new Error(_0x59fb83+'\x20Message\x20not\x20found');}_0x5b54b6=_0x441f73;return _0x441f73[_0xd46e('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3436ff={'uniqueid':_0x1309b5+'.'+_0x5b54b6['id']+'.'+_0x5b54b6[_0xd46e('0x6b')]['id'],'FromUserId':_0x483ef1['user']['id'],'type':_0xd46e('0x6d')};_0x3436ff[_0x59fb83+_0xd46e('0x6e')]=_0x5b54b6['id'];_0x3436ff[_0x59fb83+_0xd46e('0x6f')]=_0x5b54b6[_0xd46e('0x6b')]['id'];_0x3436ff[_0xd46e('0x70')+_0x59fb83+_0x2c11b8+'Id']=_0x5b54b6[_0xd46e('0x65')]['id'];_0x3436ff['To'+_0x59fb83+_0xd46e('0x71')]=_0x24a2e1['id'];return db[_0x59fb83+_0xd46e('0x72')][_0xd46e('0x73')](_0x3436ff);})[_0xd46e('0x14')](function(){return respondWithRpcPromise(_0xd46e('0x74'),{'channel':_0x1309b5,'interaction':_0x5b54b6['Interaction'],'message':_0x5b54b6,'account':_0x5b54b6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd46e('0x6d'),'appdata':_0x24a2e1[_0xd46e('0xe')]+','+(_0x5b54b6[_0xd46e('0x65')][_0xd46e('0x75')]||0x12c),'interval':_0xd46e('0x76')}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0x2abaee,null))['catch'](handleError(_0x2abaee,null));};};exports[_0xd46e('0x77')]=function(_0x127604,_0xa254f5){var _0x2c9703,_0x41443d;if(_[_0xd46e('0x10')](_0x127604['body'][_0xd46e('0x78')])){throw new Error(_0xd46e('0x79'));}var _0x59067a=_0x127604[_0xd46e('0x1f')][_0xd46e('0x78')];var _0x9e222d=_[_0xd46e('0x63')](_0x59067a);var _0x97ee80=_0x59067a===_0xd46e('0x64')?_0xd46e('0x7a'):_0xd46e('0x65');return db[_0xd46e('0x7b')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x127604[_0xd46e('0x1b')]['id'],'role':_0xd46e('0x3a')}})[_0xd46e('0x14')](function(_0x30dcfc){if(_['isNil'](_0x30dcfc)){throw new Error('Agent\x20not\x20found');}_0x2c9703=_0x30dcfc;return db[_0x9e222d+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x127604[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x9e222d+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x9e222d+_0x97ee80],'as':'Account'}]});})[_0xd46e('0x14')](function(_0x216143){if(_[_0xd46e('0x10')](_0x216143)){throw new Error(_0x9e222d+_0xd46e('0x7c'));}_0x41443d=_0x216143;return _0x216143['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd46e('0x14')](function(){var _0x191b48={'uniqueid':_0x59067a+'.'+_0x41443d['id']+'.'+_0x41443d['Interaction']['id'],'FromUserId':_0x127604[_0xd46e('0x2f')]['id'],'type':'queue','ToUserId':_0x2c9703['id']};_0x191b48[_0x9e222d+'MessageId']=_0x41443d['id'];_0x191b48[_0x9e222d+_0xd46e('0x6f')]=_0x41443d[_0xd46e('0x6b')]['id'];_0x191b48[_0xd46e('0x70')+_0x9e222d+_0x97ee80+'Id']=_0x41443d[_0xd46e('0x65')]['id'];return db[_0x9e222d+'TransferReport']['create'](_0x191b48);})[_0xd46e('0x14')](function(){return respondWithRpcPromise('Start',{'channel':_0x59067a,'interaction':_0x41443d[_0xd46e('0x6b')],'message':_0x41443d,'account':_0x41443d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2c9703[_0xd46e('0xe')]+','+(_0x41443d[_0xd46e('0x65')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0xa254f5,null))[_0xd46e('0x15')](handleError(_0xa254f5,null));}; \ No newline at end of file +var _0x038b=['\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','update','Start','agentTransferTimeout','moment','lodash','util','../../config/logger','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne'];(function(_0x399629,_0x5c70d9){var _0x4f7d02=function(_0x2026f4){while(--_0x2026f4){_0x399629['push'](_0x399629['shift']());}};_0x4f7d02(++_0x5c70d9);}(_0x038b,0x114));var _0xb038=function(_0x4ee435,_0x51fe01){_0x4ee435=_0x4ee435-0x0;var _0xe7a6ad=_0x038b[_0x4ee435];return _0xe7a6ad;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb038('0x0'));var _=require(_0xb038('0x1'));var util=require(_0xb038('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb038('0x3'))('api');var jayson=require(_0xb038('0x4'));var amiClient=jayson[_0xb038('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xb038('0x5')][_0xb038('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e3e64,_0x1b077a,_0x1534a9){return new BPromise(function(_0x4b4085,_0x48a4d7){var _0x462e8f=_0x1534a9?_0x1534a9:amiClient;return _0x462e8f[_0xb038('0x7')](_0x2e3e64,_0x1b077a)['then'](function(_0x53bcc0){if(_0x53bcc0[_0xb038('0x8')]){if(_0x53bcc0[_0xb038('0x8')]['code']===0x1f4){return _0x48a4d7(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}return _0x4b4085(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}else{_0x4b4085(_0x53bcc0[_0xb038('0xa')]);}})[_0xb038('0xb')](function(_0x1e6474){_0x48a4d7(_0x1e6474);});});}function respondWithResult(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xc8;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0xc')](_0x16e4a3)[_0xb038('0xd')](_0x57acd8);}return _0x439751[_0xb038('0xe')](0x194);};}function handleError(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0x1f4;return function(_0x13acc7){logger[_0xb038('0x8')](_0x13acc7['stack']);if(_0x13acc7[_0xb038('0xf')]){delete _0x13acc7[_0xb038('0xf')];}_0x3cc717[_0xb038('0xc')](_0x3a71a6)[_0xb038('0x10')](_0x13acc7);};}function findById(_0xdef213){return function(_0x2b4173){if(!_['isNil'](_0xdef213)&&!_[_0xb038('0x11')](_0x2b4173)&&!_[_0xb038('0x11')](_0x2b4173[_0xb038('0x12')])){return _[_0xb038('0x13')](_0x2b4173['rows'],function(_0x49b237){return _0x49b237['id']==_0xdef213;});}return null;};}exports[_0xb038('0x14')]=function(_0x3f48e6,_0x3e06ef){return respondWithRpcPromise(_0xb038('0x15'),_0x3f48e6['query'])[_0xb038('0x16')](respondWithResult(_0x3e06ef,null))[_0xb038('0xb')](handleError(_0x3e06ef,null));};exports[_0xb038('0x17')]=function(_0x33a377,_0xc6cd61){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb038('0x18')](_0x33a377[_0xb038('0x19')],_0x33a377[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0xc6cd61,null))['catch'](handleError(_0xc6cd61,null));};exports[_0xb038('0x1b')]=function(_0x1b7505,_0x4bbf38){return respondWithRpcPromise(_0xb038('0x1c'),_[_0xb038('0x18')](_0x1b7505['query'],_0x1b7505[_0xb038('0x1a')]))['then'](respondWithResult(_0x4bbf38,null))[_0xb038('0xb')](handleError(_0x4bbf38,null));};exports[_0xb038('0x1d')]=function(_0x27ff21,_0x1df7c4){return respondWithRpcPromise(_0xb038('0x1e'),_0x27ff21[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1df7c4,null))['catch'](handleError(_0x1df7c4,null));};exports[_0xb038('0x1f')]=function(_0x33cf3c,_0x226631){return respondWithRpcPromise('VoiceQueues',_0x33cf3c[_0xb038('0x19')])[_0xb038('0x16')](findById(_0x33cf3c[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x226631,null))[_0xb038('0xb')](handleError(_0x226631,null));};exports[_0xb038('0x20')]=function(_0x28a6a9,_0x12b3b6){return respondWithRpcPromise(_0xb038('0x21'),_['merge'](_0x28a6a9[_0xb038('0x22')],_0x28a6a9[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x12b3b6,null))[_0xb038('0xb')](handleError(_0x12b3b6,null));};exports[_0xb038('0x23')]=function(_0xbc8958,_0x29a0d7){return respondWithRpcPromise(_0xb038('0x24'),_[_0xb038('0x18')](_0xbc8958[_0xb038('0x19')],_0xbc8958[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x29a0d7,null))[_0xb038('0xb')](handleError(_0x29a0d7,null));};exports['voiceQueuesChannels']=function(_0x1d807a,_0x598554){return respondWithRpcPromise(_0xb038('0x25'),_0x1d807a[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x598554,null))[_0xb038('0xb')](handleError(_0x598554,null));};exports[_0xb038('0x26')]=function(_0x424b81,_0x3a393d){return respondWithRpcPromise(_0xb038('0x27'),_[_0xb038('0x18')](_0x424b81[_0xb038('0x19')],_0x424b81['params']))[_0xb038('0x16')](respondWithResult(_0x3a393d,null))[_0xb038('0xb')](handleError(_0x3a393d,null));};exports[_0xb038('0x28')]=function(_0x560342,_0x51e649){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb038('0x18')](_0x560342[_0xb038('0x19')],_0x560342[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x51e649,null))[_0xb038('0xb')](handleError(_0x51e649,null));};exports[_0xb038('0x29')]=function(_0x48f777,_0x16abea){return respondWithRpcPromise(_0xb038('0x2a'),_[_0xb038('0x18')](_0x48f777[_0xb038('0x19')],_0x48f777['params']))[_0xb038('0x16')](respondWithResult(_0x16abea,null))[_0xb038('0xb')](handleError(_0x16abea,null));};exports['outbound']=function(_0x5cb40c,_0x26c769){return respondWithRpcPromise(_0xb038('0x2b'),_0x5cb40c[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x26c769,null))[_0xb038('0xb')](handleError(_0x26c769,null));};exports['outboundChannels']=function(_0x404f82,_0x125d2a){return respondWithRpcPromise(_0xb038('0x2c'),_0x404f82[_0xb038('0x19')])['then'](respondWithResult(_0x125d2a,null))[_0xb038('0xb')](handleError(_0x125d2a,null));};exports[_0xb038('0x2d')]=function(_0x7d2f79,_0x573426){var _0x412d71;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')])[_0xb038('0x16')](function(_0x3ac1db){_0x412d71=_0x3ac1db;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')],routingClient);})[_0xb038('0x16')](function(_0x4e0533){return _['merge']({},_0x4e0533,_0x412d71);})[_0xb038('0x16')](respondWithResult(_0x573426,null))[_0xb038('0xb')](handleError(_0x573426,null));};exports[_0xb038('0x2e')]=function(_0x3c291e,_0x5ad462){if(_0x3c291e[_0xb038('0x22')]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]&&_0x3c291e[_0xb038('0x30')]&&_0x3c291e['user'][_0xb038('0xf')]){for(var _0x269c7d in _0x3c291e['body'][_0xb038('0x2f')]){if(_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]['hasOwnProperty'](_0x269c7d)){db[_0xb038('0x31')][_0xb038('0x32')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e['user']['name'],'type':_0xb038('0x33'),'exitAt':null,'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0xb038('0x34')]?{'$notIn':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]}:{'$ne':null}}})['then'](function(_0x5f0d9d){var _0x5e8383=moment()[_0xb038('0x35')](_0xb038('0x36'));for(var _0x52f0b8=0x0,_0x46a724=_0x5f0d9d[_0xb038('0x34')];_0x52f0b8<_0x46a724;_0x52f0b8+=0x1){_0x5f0d9d[_0x52f0b8][_0xb038('0x37')]({'exitAt':_0x5e8383});}});for(var _0x5f24cd=0x0;_0x5f24cd<_0x3c291e[_0xb038('0x22')]['interaction'][_0x269c7d]['length'];_0x5f24cd+=0x1){db[_0xb038('0x31')][_0xb038('0x38')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'type':_0xb038('0x33'),'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd],'exitAt':null},'defaults':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'interface':_[_0xb038('0x11')](_0x3c291e['user'][_0xb038('0x39')])?util[_0xb038('0x35')]('SIP/%s',_0x3c291e[_0xb038('0x30')][_0xb038('0xf')]):_0x3c291e['user'][_0xb038('0x39')],'type':_0xb038('0x33'),'enterAt':moment()[_0xb038('0x35')](_0xb038('0x36')),'role':_0xb038('0x3a'),'internal':_0x3c291e[_0xb038('0x30')][_0xb038('0x3b')],'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3c291e[_0xb038('0x1a')]['id'],'capacity':_0x3c291e[_0xb038('0x22')][_0xb038('0x3c')]},routingClient)[_0xb038('0x16')](respondWithResult(_0x5ad462,null))[_0xb038('0xb')](handleError(_0x5ad462,null));};exports[_0xb038('0x3d')]=function(_0x591077,_0x1f4997){return respondWithRpcPromise(_0xb038('0x3e'),_0x591077[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1f4997,null))[_0xb038('0xb')](handleError(_0x1f4997,null));};exports[_0xb038('0x3f')]=function(_0xd7a862,_0x5b82f4){return respondWithRpcPromise(_0xb038('0x40'),_0xd7a862['query'])[_0xb038('0x16')](respondWithResult(_0x5b82f4,null))[_0xb038('0xb')](handleError(_0x5b82f4,null));};exports[_0xb038('0x41')]=function(_0x998fe3,_0x1518c4){return respondWithRpcPromise('Campaigns',_0x998fe3['query'])['then'](respondWithResult(_0x1518c4,null))[_0xb038('0xb')](handleError(_0x1518c4,null));};exports[_0xb038('0x42')]=function(_0x276fac,_0x218368){return respondWithRpcPromise(_0xb038('0x43'),_0x276fac[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x218368,null))[_0xb038('0xb')](handleError(_0x218368,null));};exports[_0xb038('0x44')]=function(_0x5b2cbb,_0x5b27d3){return respondWithRpcPromise(_0xb038('0x43'),_0x5b2cbb['query'],routingClient)[_0xb038('0x16')](findById(_0x5b2cbb['params']['id']))[_0xb038('0x16')](respondWithResult(_0x5b27d3,null))[_0xb038('0xb')](handleError(_0x5b27d3,null));};exports[_0xb038('0x45')]=function(_0x4300e9,_0x4ee38b){return respondWithRpcPromise(_0xb038('0x46'),_0x4300e9[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4ee38b,null))[_0xb038('0xb')](handleError(_0x4ee38b,null));};exports[_0xb038('0x47')]=function(_0x1246c8,_0x14a553){return respondWithRpcPromise(_0xb038('0x46'),_0x1246c8[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x1246c8[_0xb038('0x1a')]['id']))[_0xb038('0x16')](respondWithResult(_0x14a553,null))['catch'](handleError(_0x14a553,null));};exports[_0xb038('0x48')]=function(_0x2fc38d,_0x438e7e){return respondWithRpcPromise(_0xb038('0x49'),_0x2fc38d[_0xb038('0x19')],mailClient)['then'](respondWithResult(_0x438e7e,null))[_0xb038('0xb')](handleError(_0x438e7e,null));};exports['openchannelQueues']=function(_0xfb3ce6,_0x170a7e){return respondWithRpcPromise('OpenchannelQueues',_0xfb3ce6[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x170a7e,null))[_0xb038('0xb')](handleError(_0x170a7e,null));};exports[_0xb038('0x4a')]=function(_0x120cc7,_0x2f01c0){return respondWithRpcPromise(_0xb038('0x4b'),_0x120cc7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x120cc7[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2f01c0,null))[_0xb038('0xb')](handleError(_0x2f01c0,null));};exports['smsQueues']=function(_0x189894,_0x37e445){return respondWithRpcPromise(_0xb038('0x4c'),_0x189894[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x37e445,null))[_0xb038('0xb')](handleError(_0x37e445,null));};exports[_0xb038('0x4d')]=function(_0x4c23b2,_0x572ad4){return respondWithRpcPromise(_0xb038('0x4c'),_0x4c23b2[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4c23b2['params']['id']))['then'](respondWithResult(_0x572ad4,null))[_0xb038('0xb')](handleError(_0x572ad4,null));};exports['whatsappQueues']=function(_0x35da9e,_0x50e078){return respondWithRpcPromise(_0xb038('0x4e'),_0x35da9e['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x50e078,null))[_0xb038('0xb')](handleError(_0x50e078,null));};exports[_0xb038('0x4f')]=function(_0x112d77,_0x2c57b9){return respondWithRpcPromise(_0xb038('0x4e'),_0x112d77['query'],routingClient)['then'](findById(_0x112d77[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2c57b9,null))[_0xb038('0xb')](handleError(_0x2c57b9,null));};exports[_0xb038('0x50')]=function(_0x2f4650,_0x538690){return respondWithRpcPromise(_0xb038('0x51'),_0x2f4650['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x538690,null))[_0xb038('0xb')](handleError(_0x538690,null));};exports[_0xb038('0x52')]=function(_0x4a417a,_0x40abb7){return respondWithRpcPromise(_0xb038('0x51'),_0x4a417a[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4a417a[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x40abb7,null))['catch'](handleError(_0x40abb7,null));};exports['faxAccounts']=function(_0x609caf,_0x4efa0f){return respondWithRpcPromise(_0xb038('0x53'),_0x609caf['query'])[_0xb038('0x16')](respondWithResult(_0x4efa0f,null))[_0xb038('0xb')](handleError(_0x4efa0f,null));};exports[_0xb038('0x54')]=function(_0x1294d7,_0x7c8d01){return respondWithRpcPromise(_0xb038('0x55'),_0x1294d7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x7c8d01,null))[_0xb038('0xb')](handleError(_0x7c8d01,null));};exports[_0xb038('0x56')]=function(_0x1db407,_0x1a5cf6){return respondWithRpcPromise(_0xb038('0x57'),_0x1db407[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1a5cf6,null))[_0xb038('0xb')](handleError(_0x1a5cf6,null));};exports[_0xb038('0x58')]=function(_0x123e31,_0x1f9a30){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x123e31[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1f9a30,null))[_0xb038('0xb')](handleError(_0x1f9a30,null));};exports[_0xb038('0x59')]=function(_0xdaacfe,_0x5ead21){return respondWithRpcPromise(_0xb038('0x5a'),_0xdaacfe[_0xb038('0x19')],routingClient)[_0xb038('0x16')](function(_0x80d720){if(_0xdaacfe[_0xb038('0x19')][_0xb038('0x5b')]!==undefined){var _0x2acbf6=_(_0x80d720[_0xb038('0x12')])[_0xb038('0x5c')]([_0xdaacfe['query']['type'],_0xdaacfe[_0xb038('0x1a')]['id']])['map'](_0xb038('0x5d'))['uniq']()['value']();return _0x80d720['rows'][_0xb038('0x5c')](function(_0x463ae6){return _0x2acbf6['indexOf'](_0x463ae6[_0xb038('0x5d')])>-0x1;});}else{return _0x80d720[_0xb038('0x12')][_0xb038('0x5c')](function(_0x31ccf7){return _0x31ccf7[_0xb038('0x5d')]===parseInt(_0xdaacfe[_0xb038('0x1a')]['id']);});}})[_0xb038('0x16')](respondWithResult(_0x5ead21,null))[_0xb038('0xb')](handleError(_0x5ead21,null));};exports[_0xb038('0x5e')]=function(_0xde487d,_0x4b15b7){return respondWithRpcPromise(_0xb038('0x5f'),_0xde487d[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4b15b7,null))[_0xb038('0xb')](handleError(_0x4b15b7,null));};exports[_0xb038('0x60')]=function(_0x222e90,_0x425854){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x222e90[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x425854,null))[_0xb038('0xb')](handleError(_0x425854,null));};exports['faxQueuesWaitingInteractions']=function(_0x551fcc,_0x2adf3b){return respondWithRpcPromise(_0xb038('0x61'),_0x551fcc[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x2adf3b,null))[_0xb038('0xb')](handleError(_0x2adf3b,null));};exports[_0xb038('0x62')]=function(_0x5b003a){return function(_0x2e6db4,_0x1d5640){var _0x240d06,_0x2a41c8;var _0x24f810=_[_0xb038('0x63')](_0x5b003a);var _0x1ea747=_0x5b003a===_0xb038('0x64')?_0xb038('0x65'):_0xb038('0x66');return db[_0x24f810+_0xb038('0x67')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x2e6db4[_0xb038('0x1a')]['id']}})[_0xb038('0x16')](function(_0x5d1410){if(_[_0xb038('0x11')](_0x5d1410)){throw new Error(_0x24f810+_0xb038('0x69'));}_0x240d06=_0x5d1410;return db[_0x24f810+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x2e6db4[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x24f810+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x24f810+_0x1ea747],'as':'Account'}]});})[_0xb038('0x16')](function(_0x3e01ce){if(_['isNil'](_0x3e01ce)){throw new Error(_0x24f810+_0xb038('0x6d'));}_0x2a41c8=_0x3e01ce;return _0x3e01ce['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x38a4d3={'uniqueid':_0x5b003a+'.'+_0x2a41c8['id']+'.'+_0x2a41c8['Interaction']['id'],'FromUserId':_0x2e6db4[_0xb038('0x30')]['id'],'type':'queue'};_0x38a4d3[_0x24f810+_0xb038('0x6e')]=_0x2a41c8['id'];_0x38a4d3[_0x24f810+_0xb038('0x6f')]=_0x2a41c8[_0xb038('0x6c')]['id'];_0x38a4d3[_0xb038('0x70')+_0x24f810+_0x1ea747+'Id']=_0x2a41c8[_0xb038('0x66')]['id'];_0x38a4d3['To'+_0x24f810+_0xb038('0x71')]=_0x240d06['id'];return db[_0x24f810+_0xb038('0x72')][_0xb038('0x73')](_0x38a4d3);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5b003a,'interaction':_0x2a41c8[_0xb038('0x6c')],'message':_0x2a41c8,'account':_0x2a41c8[_0xb038('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x74'),'appdata':_0x240d06[_0xb038('0xf')]+','+(_0x2a41c8['Account'][_0xb038('0x75')]||0x12c),'interval':_0xb038('0x76')}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x1d5640,null))[_0xb038('0xb')](handleError(_0x1d5640,null));};};exports[_0xb038('0x77')]=function(_0x139ffa,_0x208cdd){var _0x2ee9bd,_0x32ee35;if(_[_0xb038('0x11')](_0x139ffa['body']['channel'])){throw new Error(_0xb038('0x78'));}var _0xb7f025=_0x139ffa[_0xb038('0x22')][_0xb038('0x79')];var _0x3ee569=_[_0xb038('0x63')](_0xb7f025);var _0x3e129d=_0xb7f025==='chat'?_0xb038('0x65'):_0xb038('0x66');return db[_0xb038('0x7a')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x139ffa[_0xb038('0x1a')]['id'],'role':_0xb038('0x3a')}})['then'](function(_0x451fe5){if(_[_0xb038('0x11')](_0x451fe5)){throw new Error(_0xb038('0x7b'));}_0x2ee9bd=_0x451fe5;return db[_0x3ee569+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x139ffa[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x3ee569+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x3ee569+_0x3e129d],'as':_0xb038('0x66')}]});})[_0xb038('0x16')](function(_0x22e0bd){if(_[_0xb038('0x11')](_0x22e0bd)){throw new Error(_0x3ee569+_0xb038('0x6d'));}_0x32ee35=_0x22e0bd;return _0x22e0bd[_0xb038('0x7c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb038('0x16')](function(){var _0x5448e3={'uniqueid':_0xb7f025+'.'+_0x32ee35['id']+'.'+_0x32ee35['Interaction']['id'],'FromUserId':_0x139ffa[_0xb038('0x30')]['id'],'type':_0xb038('0x74'),'ToUserId':_0x2ee9bd['id']};_0x5448e3[_0x3ee569+_0xb038('0x6e')]=_0x32ee35['id'];_0x5448e3[_0x3ee569+'InteractionId']=_0x32ee35[_0xb038('0x6c')]['id'];_0x5448e3[_0xb038('0x70')+_0x3ee569+_0x3e129d+'Id']=_0x32ee35[_0xb038('0x66')]['id'];return db[_0x3ee569+_0xb038('0x72')]['create'](_0x5448e3);})['then'](function(){return respondWithRpcPromise(_0xb038('0x7d'),{'channel':_0xb7f025,'interaction':_0x32ee35[_0xb038('0x6c')],'message':_0x32ee35,'account':_0x32ee35['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x3a'),'appdata':_0x2ee9bd[_0xb038('0xf')]+','+(_0x32ee35[_0xb038('0x66')][_0xb038('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x208cdd,null))[_0xb038('0xb')](handleError(_0x208cdd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9c44d82..f4caaa2 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 _0xfa41=['../../components/auth/service','../../config/environment','./schedule.controller','isAuthenticated','get','show','/:id/run','run','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x392f18,_0x536485){var _0x46d46c=function(_0x5a9a65){while(--_0x5a9a65){_0x392f18['push'](_0x392f18['shift']());}};_0x46d46c(++_0x536485);}(_0xfa41,0x6e));var _0x1fa4=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0xfa41[_0x24cc72];return _0xd49f1e;};'use strict';var multer=require('multer');var util=require(_0x1fa4('0x0'));var path=require(_0x1fa4('0x1'));var timeout=require(_0x1fa4('0x2'));var express=require('express');var router=express[_0x1fa4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fa4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fa4('0x5'));var controller=require(_0x1fa4('0x6'));router['get']('/',auth[_0x1fa4('0x7')](),controller['index']);router[_0x1fa4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1fa4('0x9')]);router[_0x1fa4('0x8')](_0x1fa4('0xa'),auth['isAuthenticated'](),controller[_0x1fa4('0xb')]);router[_0x1fa4('0xc')]('/',auth[_0x1fa4('0x7')](),controller[_0x1fa4('0xd')]);router[_0x1fa4('0xe')](_0x1fa4('0xf'),auth[_0x1fa4('0x7')](),controller[_0x1fa4('0x10')]);router[_0x1fa4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1fa4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x831e=['run','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','show','/:id/run','isAuthenticated'];(function(_0x4f647b,_0x2ae69c){var _0x550881=function(_0x836300){while(--_0x836300){_0x4f647b['push'](_0x4f647b['shift']());}};_0x550881(++_0x2ae69c);}(_0x831e,0x15d));var _0xe831=function(_0x1155a9,_0x370456){_0x1155a9=_0x1155a9-0x0;var _0x35ac41=_0x831e[_0x1155a9];return _0x35ac41;};'use strict';var multer=require(_0xe831('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe831('0x1'));var express=require(_0xe831('0x2'));var router=express[_0xe831('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe831('0x4'));var interaction=require(_0xe831('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xe831('0x6')]('/',auth['isAuthenticated'](),controller[_0xe831('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe831('0x8')]);router[_0xe831('0x6')](_0xe831('0x9'),auth[_0xe831('0xa')](),controller[_0xe831('0xb')]);router['post']('/',auth[_0xe831('0xa')](),controller[_0xe831('0xc')]);router[_0xe831('0xd')]('/:id',auth[_0xe831('0xa')](),controller[_0xe831('0xe')]);router[_0xe831('0xf')]('/:id',auth[_0xe831('0xa')](),controller[_0xe831('0x10')]);module[_0xe831('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ec75b60..456f4f5 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 _0x4e15=['xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','weeks','days','hours','minutes','csv'];(function(_0x5ef894,_0x3754c){var _0x3f00be=function(_0x12c12c){while(--_0x12c12c){_0x5ef894['push'](_0x5ef894['shift']());}};_0x3f00be(++_0x3754c);}(_0x4e15,0x1b5));var _0x54e1=function(_0x133383,_0x229b30){_0x133383=_0x133383-0x0;var _0x46db8f=_0x4e15[_0x133383];return _0x46db8f;};'use strict';var Sequelize=require(_0x54e1('0x0'));module[_0x54e1('0x1')]={'name':{'type':Sequelize[_0x54e1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x54e1('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54e1('0x3')},'startAt':{'type':Sequelize[_0x54e1('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x54e1('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x54e1('0x5')](_0x54e1('0x6'),_0x54e1('0x7'),'months',_0x54e1('0x8'),_0x54e1('0x9'),_0x54e1('0xa'),_0x54e1('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x54e1('0x5')](_0x54e1('0xc'),'pdf',_0x54e1('0xd')),'allowNull':![],'defaultValue':_0x54e1('0xc')},'type':{'type':Sequelize['ENUM'](_0x54e1('0xe'),_0x54e1('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x54e1('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0x54e1('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x54e1('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x54e1('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb937=['csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','days','hours','minutes','pdf','xlsx'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xb937,0x194));var _0x7b93=function(_0x2053ab,_0x21fa83){_0x2053ab=_0x2053ab-0x0;var _0x2a16fd=_0xb937[_0x2053ab];return _0x2a16fd;};'use strict';var Sequelize=require(_0x7b93('0x0'));module[_0x7b93('0x1')]={'name':{'type':Sequelize[_0x7b93('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b93('0x2')]},'active':{'type':Sequelize[_0x7b93('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7b93('0x4')},'startAt':{'type':Sequelize[_0x7b93('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7b93('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7b93('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7b93('0x7')](_0x7b93('0x8'),'quarters',_0x7b93('0x9'),_0x7b93('0xa'),_0x7b93('0xb'),_0x7b93('0xc'),_0x7b93('0xd')),'allowNull':![],'defaultValue':_0x7b93('0xb')},'output':{'type':Sequelize[_0x7b93('0x7')]('csv',_0x7b93('0xe'),_0x7b93('0xf')),'allowNull':![],'defaultValue':_0x7b93('0x10')},'type':{'type':Sequelize[_0x7b93('0x7')](_0x7b93('0x11'),_0x7b93('0x12')),'allowNull':![],'defaultValue':_0x7b93('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7b93('0x2')]},'cc':{'type':Sequelize[_0x7b93('0x13')]},'bcc':{'type':Sequelize[_0x7b93('0x13')]},'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 7d18f2b..84a4626 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 _0x33a8=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','reject','update','then','get','Scheduler','UserProfileResource','end','error','name','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','Schedule','includeAll','findAll','rows','show','params','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x33a8,0x8d));var _0x833a=function(_0x32db2b,_0x918095){_0x32db2b=_0x32db2b-0x0;var _0x47661d=_0x33a8[_0x32db2b];return _0x47661d;};'use strict';var emlformat=require(_0x833a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x833a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x833a('0x2'));var moment=require(_0x833a('0x3'));var BPromise=require(_0x833a('0x4'));var Mustache=require('mustache');var util=require(_0x833a('0x5'));var path=require(_0x833a('0x6'));var sox=require(_0x833a('0x7'));var csv=require(_0x833a('0x8'));var ejs=require(_0x833a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x833a('0xa'));var squel=require(_0x833a('0xb'));var crypto=require('crypto');var jsforce=require(_0x833a('0xc'));var deskjs=require(_0x833a('0xd'));var toCsv=require(_0x833a('0x8'));var querystring=require(_0x833a('0xe'));var Papa=require('papaparse');var Redis=require(_0x833a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x833a('0x10'));var as=require(_0x833a('0x11'));var hardwareService=require(_0x833a('0x12'));var logger=require(_0x833a('0x13'))('api');var utils=require(_0x833a('0x14'));var config=require(_0x833a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x833a('0x16'))['db'];function respondWithStatusCode(_0x3d112a,_0x4ba734){_0x4ba734=_0x4ba734||0xcc;return function(_0x2208a5){if(_0x2208a5){return _0x3d112a[_0x833a('0x17')](_0x4ba734);}return _0x3d112a[_0x833a('0x18')](_0x4ba734)['end']();};}function respondWithResult(_0x4d0247,_0x2d4a1e){_0x2d4a1e=_0x2d4a1e||0xc8;return function(_0x3ce362){if(_0x3ce362){return _0x4d0247[_0x833a('0x18')](_0x2d4a1e)['json'](_0x3ce362);}};}function respondWithFilteredResult(_0x2c2f25,_0x19ef67){return function(_0xc58ba7){if(_0xc58ba7){var _0x2e48e6=typeof _0x19ef67['offset']===_0x833a('0x19')&&typeof _0x19ef67[_0x833a('0x1a')]===_0x833a('0x19');var _0x59f597=_0xc58ba7[_0x833a('0x1b')];var _0x2102aa=_0x2e48e6?0x0:_0x19ef67[_0x833a('0x1c')];var _0x79083b=_0x2e48e6?_0xc58ba7[_0x833a('0x1b')]:_0x19ef67['offset']+_0x19ef67[_0x833a('0x1a')];var _0x2bec04;if(_0x79083b>=_0x59f597){_0x79083b=_0x59f597;_0x2bec04=0xc8;}else{_0x2bec04=0xce;}_0x2c2f25[_0x833a('0x18')](_0x2bec04);return _0x2c2f25[_0x833a('0x1d')]('Content-Range',_0x2102aa+'-'+_0x79083b+'/'+_0x59f597)[_0x833a('0x1e')](_0xc58ba7);}return null;};}function patchUpdates(_0x1bc2bb){return function(_0x23d7a0){try{jsonpatch['apply'](_0x23d7a0,_0x1bc2bb,!![]);}catch(_0x1f9941){return BPromise[_0x833a('0x1f')](_0x1f9941);}return _0x23d7a0['save']();};}function saveUpdates(_0x5f2173,_0x4c2b28){return function(_0x5e4363){if(_0x5e4363){return _0x5e4363[_0x833a('0x20')](_0x5f2173)[_0x833a('0x21')](function(_0x31d435){return _0x31d435;});}return null;};}function removeEntity(_0x2fdbcf,_0x37a4d0){return function(_0x9878cd){if(_0x9878cd){return _0x9878cd['destroy']()['then'](function(){var _0x2801fc=_0x9878cd[_0x833a('0x22')]({'plain':!![]});var _0x19ed3a=_0x833a('0x23');return db[_0x833a('0x24')]['destroy']({'where':{'type':_0x19ed3a,'resourceId':_0x2801fc['id']}})[_0x833a('0x21')](function(){return _0x9878cd;});})[_0x833a('0x21')](function(){_0x2fdbcf[_0x833a('0x18')](0xcc)[_0x833a('0x25')]();});}};}function handleEntityNotFound(_0x4ce640,_0x56a20c){return function(_0x66eda){if(!_0x66eda){_0x4ce640[_0x833a('0x17')](0x194);}return _0x66eda;};}function handleError(_0x6d11b7,_0x4775a4){_0x4775a4=_0x4775a4||0x1f4;return function(_0x2cda01){logger[_0x833a('0x26')](_0x2cda01['stack']);if(_0x2cda01[_0x833a('0x27')]){delete _0x2cda01[_0x833a('0x27')];}_0x6d11b7[_0x833a('0x18')](_0x4775a4)['send'](_0x2cda01);};}exports['index']=function(_0x41cdf1,_0x49b41e){var _0x344576={},_0x54ec71={},_0xfa558c={'count':0x0,'rows':[]};var _0x2f4f3d=_['map'](db['Schedule'][_0x833a('0x28')],function(_0x12b032){return{'name':_0x12b032[_0x833a('0x29')],'type':_0x12b032[_0x833a('0x2a')][_0x833a('0x2b')]};});_0x54ec71['model']=_[_0x833a('0x2c')](_0x2f4f3d,'name');_0x54ec71[_0x833a('0x2d')]=_[_0x833a('0x2e')](_0x41cdf1[_0x833a('0x2d')]);_0x54ec71[_0x833a('0x2f')]=_['intersection'](_0x54ec71['model'],_0x54ec71[_0x833a('0x2d')]);_0x344576[_0x833a('0x30')]=_[_0x833a('0x31')](_0x54ec71[_0x833a('0x32')],qs['fields'](_0x41cdf1[_0x833a('0x2d')][_0x833a('0x33')]));_0x344576[_0x833a('0x30')]=_0x344576[_0x833a('0x30')][_0x833a('0x34')]?_0x344576[_0x833a('0x30')]:_0x54ec71[_0x833a('0x32')];if(!_0x41cdf1['query'][_0x833a('0x35')](_0x833a('0x36'))){_0x344576[_0x833a('0x1a')]=qs[_0x833a('0x1a')](_0x41cdf1[_0x833a('0x2d')]['limit']);_0x344576[_0x833a('0x1c')]=qs[_0x833a('0x1c')](_0x41cdf1[_0x833a('0x2d')]['offset']);}_0x344576[_0x833a('0x37')]=qs[_0x833a('0x38')](_0x41cdf1[_0x833a('0x2d')][_0x833a('0x38')]);_0x344576[_0x833a('0x39')]=qs[_0x833a('0x2f')](_[_0x833a('0x3a')](_0x41cdf1[_0x833a('0x2d')],_0x54ec71['filters']),_0x2f4f3d);if(_0x41cdf1[_0x833a('0x2d')]['filter']){_0x344576[_0x833a('0x39')]=_[_0x833a('0x3b')](_0x344576['where'],{'$or':_['map'](_0x2f4f3d,function(_0x239237){if(_0x239237[_0x833a('0x2a')]!=='VIRTUAL'){var _0x3d68ea={};_0x3d68ea[_0x239237[_0x833a('0x27')]]={'$like':'%'+_0x41cdf1[_0x833a('0x2d')][_0x833a('0x3c')]+'%'};return _0x3d68ea;}})});}_0x344576=_[_0x833a('0x3b')]({},_0x344576,_0x41cdf1[_0x833a('0x3d')]);var _0x16c00d={'where':_0x344576[_0x833a('0x39')]};return db[_0x833a('0x3e')][_0x833a('0x1b')](_0x16c00d)['then'](function(_0x1398da){_0xfa558c[_0x833a('0x1b')]=_0x1398da;if(_0x41cdf1[_0x833a('0x2d')][_0x833a('0x3f')]){_0x344576['include']=[{'all':!![]}];}return db[_0x833a('0x3e')][_0x833a('0x40')](_0x344576);})['then'](function(_0x3cf089){_0xfa558c[_0x833a('0x41')]=_0x3cf089;return _0xfa558c;})['then'](respondWithFilteredResult(_0x49b41e,_0x344576))['catch'](handleError(_0x49b41e,null));};exports[_0x833a('0x42')]=function(_0x4a3871,_0x6e4452){var _0x3b0ffa={'raw':![],'where':{'id':_0x4a3871[_0x833a('0x43')]['id']}},_0x2435f5={};_0x2435f5[_0x833a('0x32')]=_['keys'](db[_0x833a('0x3e')][_0x833a('0x28')]);_0x2435f5[_0x833a('0x2d')]=_['keys'](_0x4a3871[_0x833a('0x2d')]);_0x2435f5[_0x833a('0x2f')]=_[_0x833a('0x31')](_0x2435f5[_0x833a('0x32')],_0x2435f5['query']);_0x3b0ffa[_0x833a('0x30')]=_[_0x833a('0x31')](_0x2435f5['model'],qs[_0x833a('0x33')](_0x4a3871['query']['fields']));_0x3b0ffa[_0x833a('0x30')]=_0x3b0ffa[_0x833a('0x30')][_0x833a('0x34')]?_0x3b0ffa['attributes']:_0x2435f5['model'];if(_0x4a3871[_0x833a('0x2d')]['includeAll']){_0x3b0ffa[_0x833a('0x44')]=[{'all':!![]}];}_0x3b0ffa=_[_0x833a('0x3b')]({},_0x3b0ffa,_0x4a3871[_0x833a('0x3d')]);return db[_0x833a('0x3e')]['find'](_0x3b0ffa)[_0x833a('0x21')](handleEntityNotFound(_0x6e4452,null))[_0x833a('0x21')](respondWithResult(_0x6e4452,null))[_0x833a('0x45')](handleError(_0x6e4452,null));};exports[_0x833a('0x46')]=function(_0x1b8c1f,_0x2dcca4){return db['Schedule']['create'](_0x1b8c1f['body'],{})[_0x833a('0x21')](function(_0x2d69f9){var _0x340d46=_0x1b8c1f['user']['get']({'plain':!![]});if(!_0x340d46)throw new Error(_0x833a('0x47'));if(_0x340d46['role']===_0x833a('0x48')){var _0x522862=_0x2d69f9[_0x833a('0x22')]({'plain':!![]});var _0x59be31=_0x833a('0x23');return db[_0x833a('0x49')][_0x833a('0x4a')]({'where':{'name':_0x59be31,'userProfileId':_0x340d46['userProfileId']},'raw':!![]})[_0x833a('0x21')](function(_0x18ece5){if(_0x18ece5&&_0x18ece5[_0x833a('0x4b')]===0x0){return db[_0x833a('0x24')]['create']({'name':_0x522862['name'],'resourceId':_0x522862['id'],'type':_0x18ece5[_0x833a('0x27')],'sectionId':_0x18ece5['id']},{})[_0x833a('0x21')](function(){return _0x2d69f9;});}else{return _0x2d69f9;}})[_0x833a('0x45')](function(_0x3b7287){logger[_0x833a('0x26')](_0x833a('0x4c'),_0x3b7287);throw _0x3b7287;});}return _0x2d69f9;})[_0x833a('0x21')](respondWithResult(_0x2dcca4,0xc9))['catch'](handleError(_0x2dcca4,null));};exports[_0x833a('0x20')]=function(_0x1231bc,_0x41edc1){if(_0x1231bc['body']['id']){delete _0x1231bc[_0x833a('0x4d')]['id'];}return db[_0x833a('0x3e')]['find']({'where':{'id':_0x1231bc[_0x833a('0x43')]['id']}})[_0x833a('0x21')](handleEntityNotFound(_0x41edc1,null))[_0x833a('0x21')](saveUpdates(_0x1231bc['body'],null))[_0x833a('0x21')](respondWithResult(_0x41edc1,null))[_0x833a('0x45')](handleError(_0x41edc1,null));};exports['destroy']=function(_0x2aaf52,_0x570a48){return db[_0x833a('0x3e')][_0x833a('0x4a')]({'where':{'id':_0x2aaf52[_0x833a('0x43')]['id']}})[_0x833a('0x21')](handleEntityNotFound(_0x570a48,null))['then'](removeEntity(_0x570a48,null))[_0x833a('0x45')](handleError(_0x570a48,null));};exports[_0x833a('0x4e')]=function(_0x1d6467,_0xdd03da,_0x4cb561){var _0x4b6a84=require(_0x833a('0x4f'));return db[_0x833a('0x3e')][_0x833a('0x4a')]({'where':{'id':_0x1d6467['params']['id']},'raw':!![]})[_0x833a('0x21')](handleEntityNotFound(_0xdd03da,null))[_0x833a('0x21')](function(){_0x4b6a84[_0x833a('0x4e')](_0x1d6467[_0x833a('0x43')]['id']);})[_0x833a('0x21')](respondWithStatusCode(_0xdd03da,null))['catch'](handleError(_0xdd03da,null));}; \ No newline at end of file +var _0x179f=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Schedule','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','where','type','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x2fde39,_0x25f36e){var _0x1d7152=function(_0x1b14b4){while(--_0x1b14b4){_0x2fde39['push'](_0x2fde39['shift']());}};_0x1d7152(++_0x25f36e);}(_0x179f,0x128));var _0xf179=function(_0x2fc7c6,_0x4db464){_0x2fc7c6=_0x2fc7c6-0x0;var _0x10b531=_0x179f[_0x2fc7c6];return _0x10b531;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf179('0x0'));var jsonpatch=require(_0xf179('0x1'));var rp=require('request-promise');var moment=require(_0xf179('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf179('0x3'));var path=require('path');var sox=require(_0xf179('0x4'));var csv=require(_0xf179('0x5'));var ejs=require(_0xf179('0x6'));var fs=require('fs');var fs_extra=require(_0xf179('0x7'));var _=require('lodash');var squel=require(_0xf179('0x8'));var crypto=require(_0xf179('0x9'));var jsforce=require(_0xf179('0xa'));var deskjs=require(_0xf179('0xb'));var toCsv=require(_0xf179('0x5'));var querystring=require(_0xf179('0xc'));var Papa=require('papaparse');var Redis=require(_0xf179('0xd'));var authService=require(_0xf179('0xe'));var qs=require(_0xf179('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf179('0x10'));var logger=require(_0xf179('0x11'))('api');var utils=require(_0xf179('0x12'));var config=require(_0xf179('0x13'));var licenseUtil=require(_0xf179('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x83cc03,_0xcf984d){_0xcf984d=_0xcf984d||0xcc;return function(_0x263418){if(_0x263418){return _0x83cc03[_0xf179('0x15')](_0xcf984d);}return _0x83cc03[_0xf179('0x16')](_0xcf984d)[_0xf179('0x17')]();};}function respondWithResult(_0xb3da39,_0x5cc22e){_0x5cc22e=_0x5cc22e||0xc8;return function(_0x97ba09){if(_0x97ba09){return _0xb3da39['status'](_0x5cc22e)[_0xf179('0x18')](_0x97ba09);}};}function respondWithFilteredResult(_0x1ab9e5,_0x426f21){return function(_0x3020c1){if(_0x3020c1){var _0x1db05a=typeof _0x426f21[_0xf179('0x19')]===_0xf179('0x1a')&&typeof _0x426f21[_0xf179('0x1b')]===_0xf179('0x1a');var _0x32411c=_0x3020c1['count'];var _0x228afc=_0x1db05a?0x0:_0x426f21['offset'];var _0x502f74=_0x1db05a?_0x3020c1['count']:_0x426f21[_0xf179('0x19')]+_0x426f21['limit'];var _0x209f0a;if(_0x502f74>=_0x32411c){_0x502f74=_0x32411c;_0x209f0a=0xc8;}else{_0x209f0a=0xce;}_0x1ab9e5[_0xf179('0x16')](_0x209f0a);return _0x1ab9e5['set'](_0xf179('0x1c'),_0x228afc+'-'+_0x502f74+'/'+_0x32411c)[_0xf179('0x18')](_0x3020c1);}return null;};}function patchUpdates(_0x51b98d){return function(_0x314c6e){try{jsonpatch[_0xf179('0x1d')](_0x314c6e,_0x51b98d,!![]);}catch(_0x3e807c){return BPromise[_0xf179('0x1e')](_0x3e807c);}return _0x314c6e['save']();};}function saveUpdates(_0x4cb98e,_0x4edf66){return function(_0x273dc){if(_0x273dc){return _0x273dc[_0xf179('0x1f')](_0x4cb98e)[_0xf179('0x20')](function(_0x57744d){return _0x57744d;});}return null;};}function removeEntity(_0xbebc3f,_0x201509){return function(_0x44cc9a){if(_0x44cc9a){return _0x44cc9a[_0xf179('0x21')]()[_0xf179('0x20')](function(){var _0x516d1f=_0x44cc9a[_0xf179('0x22')]({'plain':!![]});var _0x11c01f='Scheduler';return db[_0xf179('0x23')][_0xf179('0x21')]({'where':{'type':_0x11c01f,'resourceId':_0x516d1f['id']}})[_0xf179('0x20')](function(){return _0x44cc9a;});})[_0xf179('0x20')](function(){_0xbebc3f[_0xf179('0x16')](0xcc)[_0xf179('0x17')]();});}};}function handleEntityNotFound(_0x5f2711,_0x3866b4){return function(_0x1e6232){if(!_0x1e6232){_0x5f2711[_0xf179('0x15')](0x194);}return _0x1e6232;};}function handleError(_0x570f44,_0x23f99c){_0x23f99c=_0x23f99c||0x1f4;return function(_0x1bf566){logger[_0xf179('0x24')](_0x1bf566['stack']);if(_0x1bf566[_0xf179('0x25')]){delete _0x1bf566[_0xf179('0x25')];}_0x570f44[_0xf179('0x16')](_0x23f99c)[_0xf179('0x26')](_0x1bf566);};}exports[_0xf179('0x27')]=function(_0x2fa10f,_0x1f1280){var _0x3af14d={},_0x28184d={},_0x31ffdb={'count':0x0,'rows':[]};var _0x4626b5=_[_0xf179('0x28')](db[_0xf179('0x29')][_0xf179('0x2a')],function(_0xd42d24){return{'name':_0xd42d24['fieldName'],'type':_0xd42d24['type']['key']};});_0x28184d[_0xf179('0x2b')]=_[_0xf179('0x28')](_0x4626b5,_0xf179('0x25'));_0x28184d[_0xf179('0x2c')]=_['keys'](_0x2fa10f[_0xf179('0x2c')]);_0x28184d[_0xf179('0x2d')]=_[_0xf179('0x2e')](_0x28184d[_0xf179('0x2b')],_0x28184d[_0xf179('0x2c')]);_0x3af14d[_0xf179('0x2f')]=_[_0xf179('0x2e')](_0x28184d[_0xf179('0x2b')],qs[_0xf179('0x30')](_0x2fa10f[_0xf179('0x2c')]['fields']));_0x3af14d[_0xf179('0x2f')]=_0x3af14d[_0xf179('0x2f')][_0xf179('0x31')]?_0x3af14d[_0xf179('0x2f')]:_0x28184d[_0xf179('0x2b')];if(!_0x2fa10f[_0xf179('0x2c')][_0xf179('0x32')]('nolimit')){_0x3af14d[_0xf179('0x1b')]=qs[_0xf179('0x1b')](_0x2fa10f[_0xf179('0x2c')][_0xf179('0x1b')]);_0x3af14d[_0xf179('0x19')]=qs[_0xf179('0x19')](_0x2fa10f[_0xf179('0x2c')][_0xf179('0x19')]);}_0x3af14d[_0xf179('0x33')]=qs['sort'](_0x2fa10f[_0xf179('0x2c')]['sort']);_0x3af14d['where']=qs[_0xf179('0x2d')](_[_0xf179('0x34')](_0x2fa10f['query'],_0x28184d['filters']),_0x4626b5);if(_0x2fa10f[_0xf179('0x2c')]['filter']){_0x3af14d['where']=_['merge'](_0x3af14d[_0xf179('0x35')],{'$or':_[_0xf179('0x28')](_0x4626b5,function(_0x20a6f8){if(_0x20a6f8[_0xf179('0x36')]!=='VIRTUAL'){var _0x133a3a={};_0x133a3a[_0x20a6f8[_0xf179('0x25')]]={'$like':'%'+_0x2fa10f[_0xf179('0x2c')][_0xf179('0x37')]+'%'};return _0x133a3a;}})});}_0x3af14d=_[_0xf179('0x38')]({},_0x3af14d,_0x2fa10f[_0xf179('0x39')]);var _0x3762c5={'where':_0x3af14d[_0xf179('0x35')]};return db[_0xf179('0x29')]['count'](_0x3762c5)['then'](function(_0x210352){_0x31ffdb[_0xf179('0x3a')]=_0x210352;if(_0x2fa10f[_0xf179('0x2c')][_0xf179('0x3b')]){_0x3af14d[_0xf179('0x3c')]=[{'all':!![]}];}return db[_0xf179('0x29')][_0xf179('0x3d')](_0x3af14d);})['then'](function(_0x33c47f){_0x31ffdb[_0xf179('0x3e')]=_0x33c47f;return _0x31ffdb;})[_0xf179('0x20')](respondWithFilteredResult(_0x1f1280,_0x3af14d))[_0xf179('0x3f')](handleError(_0x1f1280,null));};exports[_0xf179('0x40')]=function(_0x6c3cb0,_0x51f5cd){var _0x575e4a={'raw':![],'where':{'id':_0x6c3cb0[_0xf179('0x41')]['id']}},_0x158c2b={};_0x158c2b['model']=_[_0xf179('0x42')](db[_0xf179('0x29')][_0xf179('0x2a')]);_0x158c2b['query']=_['keys'](_0x6c3cb0['query']);_0x158c2b[_0xf179('0x2d')]=_[_0xf179('0x2e')](_0x158c2b[_0xf179('0x2b')],_0x158c2b[_0xf179('0x2c')]);_0x575e4a[_0xf179('0x2f')]=_[_0xf179('0x2e')](_0x158c2b[_0xf179('0x2b')],qs[_0xf179('0x30')](_0x6c3cb0[_0xf179('0x2c')][_0xf179('0x30')]));_0x575e4a[_0xf179('0x2f')]=_0x575e4a['attributes'][_0xf179('0x31')]?_0x575e4a[_0xf179('0x2f')]:_0x158c2b[_0xf179('0x2b')];if(_0x6c3cb0[_0xf179('0x2c')][_0xf179('0x3b')]){_0x575e4a[_0xf179('0x3c')]=[{'all':!![]}];}_0x575e4a=_[_0xf179('0x38')]({},_0x575e4a,_0x6c3cb0['options']);return db['Schedule'][_0xf179('0x43')](_0x575e4a)[_0xf179('0x20')](handleEntityNotFound(_0x51f5cd,null))['then'](respondWithResult(_0x51f5cd,null))[_0xf179('0x3f')](handleError(_0x51f5cd,null));};exports['create']=function(_0x252850,_0x4ae369){return db[_0xf179('0x29')][_0xf179('0x44')](_0x252850[_0xf179('0x45')],{})['then'](function(_0x3579d8){var _0x3f86ba=_0x252850[_0xf179('0x46')][_0xf179('0x22')]({'plain':!![]});if(!_0x3f86ba)throw new Error(_0xf179('0x47'));if(_0x3f86ba[_0xf179('0x48')]===_0xf179('0x46')){var _0x214458=_0x3579d8[_0xf179('0x22')]({'plain':!![]});var _0x3f0b9e=_0xf179('0x49');return db[_0xf179('0x4a')]['find']({'where':{'name':_0x3f0b9e,'userProfileId':_0x3f86ba[_0xf179('0x4b')]},'raw':!![]})[_0xf179('0x20')](function(_0x261bfa){if(_0x261bfa&&_0x261bfa['autoAssociation']===0x0){return db[_0xf179('0x23')][_0xf179('0x44')]({'name':_0x214458[_0xf179('0x25')],'resourceId':_0x214458['id'],'type':_0x261bfa[_0xf179('0x25')],'sectionId':_0x261bfa['id']},{})[_0xf179('0x20')](function(){return _0x3579d8;});}else{return _0x3579d8;}})['catch'](function(_0x20fda7){logger['error'](_0xf179('0x4c'),_0x20fda7);throw _0x20fda7;});}return _0x3579d8;})['then'](respondWithResult(_0x4ae369,0xc9))[_0xf179('0x3f')](handleError(_0x4ae369,null));};exports[_0xf179('0x1f')]=function(_0x579cd5,_0x549c93){if(_0x579cd5[_0xf179('0x45')]['id']){delete _0x579cd5[_0xf179('0x45')]['id'];}return db[_0xf179('0x29')]['find']({'where':{'id':_0x579cd5[_0xf179('0x41')]['id']}})[_0xf179('0x20')](handleEntityNotFound(_0x549c93,null))[_0xf179('0x20')](saveUpdates(_0x579cd5[_0xf179('0x45')],null))[_0xf179('0x20')](respondWithResult(_0x549c93,null))[_0xf179('0x3f')](handleError(_0x549c93,null));};exports[_0xf179('0x21')]=function(_0x2df77d,_0x54279a){return db[_0xf179('0x29')][_0xf179('0x43')]({'where':{'id':_0x2df77d['params']['id']}})['then'](handleEntityNotFound(_0x54279a,null))['then'](removeEntity(_0x54279a,null))[_0xf179('0x3f')](handleError(_0x54279a,null));};exports['run']=function(_0x3e6966,_0x591eba,_0x459569){var _0x1f6bda=require(_0xf179('0x4d'));return db[_0xf179('0x29')]['find']({'where':{'id':_0x3e6966['params']['id']},'raw':!![]})[_0xf179('0x20')](handleEntityNotFound(_0x591eba,null))[_0xf179('0x20')](function(){_0x1f6bda[_0xf179('0x4e')](_0x3e6966[_0xf179('0x41')]['id']);})[_0xf179('0x20')](respondWithStatusCode(_0x591eba,null))['catch'](handleError(_0x591eba,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3cd3b11..ca788dd 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 _0x0e7e=['../../config/logger','moment','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util'];(function(_0x1cb62a,_0x3acc22){var _0x355332=function(_0x254b08){while(--_0x254b08){_0x1cb62a['push'](_0x1cb62a['shift']());}};_0x355332(++_0x3acc22);}(_0x0e7e,0x195));var _0xe0e7=function(_0x663c3a,_0x4f4331){_0x663c3a=_0x663c3a-0x0;var _0xeb05f1=_0x0e7e[_0x663c3a];return _0xeb05f1;};'use strict';var _=require(_0xe0e7('0x0'));var util=require(_0xe0e7('0x1'));var logger=require(_0xe0e7('0x2'))('api');var moment=require(_0xe0e7('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0e7('0x4'));var fs=require('fs');var path=require(_0xe0e7('0x5'));var rimraf=require('rimraf');var config=require(_0xe0e7('0x6'));var attributes=require(_0xe0e7('0x7'));module[_0xe0e7('0x8')]=function(_0x2bc9f1,_0x222220){return _0x2bc9f1[_0xe0e7('0x9')](_0xe0e7('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc29c=['./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2fb5e5,_0x366584){var _0x2f36eb=function(_0x282c8c){while(--_0x282c8c){_0x2fb5e5['push'](_0x2fb5e5['shift']());}};_0x2f36eb(++_0x366584);}(_0xc29c,0x104));var _0xcc29=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xc29c[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xcc29('0x0'));var util=require(_0xcc29('0x1'));var logger=require(_0xcc29('0x2'))(_0xcc29('0x3'));var moment=require(_0xcc29('0x4'));var BPromise=require(_0xcc29('0x5'));var rp=require(_0xcc29('0x6'));var fs=require('fs');var path=require(_0xcc29('0x7'));var rimraf=require(_0xcc29('0x8'));var config=require(_0xcc29('0x9'));var attributes=require(_0xcc29('0xa'));module[_0xcc29('0xb')]=function(_0x3af4c3,_0x65181c){return _0x3af4c3[_0xcc29('0xc')](_0xcc29('0xd'),attributes,{'tableName':_0xcc29('0xe'),'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 dd4a129..dd84947 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 _0xc9c7=['rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b7678,_0x2cde4f){var _0x4560ef=function(_0x1de0d9){while(--_0x1de0d9){_0x3b7678['push'](_0x3b7678['shift']());}};_0x4560ef(++_0x2cde4f);}(_0xc9c7,0x148));var _0x7c9c=function(_0x1c9db4,_0x74fbe3){_0x1c9db4=_0x1c9db4-0x0;var _0x2704c4=_0xc9c7[_0x1c9db4];return _0x2704c4;};'use strict';var _=require(_0x7c9c('0x0'));var util=require(_0x7c9c('0x1'));var moment=require(_0x7c9c('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c9c('0x3'));var fs=require('fs');var Redis=require(_0x7c9c('0x4'));var db=require(_0x7c9c('0x5'))['db'];var utils=require(_0x7c9c('0x6'));var logger=require(_0x7c9c('0x7'))(_0x7c9c('0x8'));var config=require(_0x7c9c('0x9'));var jayson=require(_0x7c9c('0xa'));var client=jayson[_0x7c9c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c927e,_0x1e85a3,_0x164507){return new BPromise(function(_0x311130,_0x1cc799){return client[_0x7c9c('0xc')](_0x4c927e,_0x164507)[_0x7c9c('0xd')](function(_0x36ad96){logger[_0x7c9c('0xe')](_0x7c9c('0xf'),_0x1e85a3,_0x7c9c('0x10'));logger[_0x7c9c('0x11')](_0x7c9c('0x12'),_0x1e85a3,_0x7c9c('0x10'),JSON[_0x7c9c('0x13')](_0x36ad96));if(_0x36ad96[_0x7c9c('0x14')]){if(_0x36ad96[_0x7c9c('0x14')][_0x7c9c('0x15')]===0x1f4){logger[_0x7c9c('0x14')](_0x7c9c('0xf'),_0x1e85a3,_0x36ad96[_0x7c9c('0x14')][_0x7c9c('0x16')]);return _0x1cc799(_0x36ad96['error']['message']);}logger[_0x7c9c('0x14')](_0x7c9c('0xf'),_0x1e85a3,_0x36ad96[_0x7c9c('0x14')]['message']);return _0x311130(_0x36ad96[_0x7c9c('0x14')]['message']);}else{logger[_0x7c9c('0xe')](_0x7c9c('0xf'),_0x1e85a3,_0x7c9c('0x10'));_0x311130(_0x36ad96['result'][_0x7c9c('0x16')]);}})[_0x7c9c('0x17')](function(_0x51a375){logger[_0x7c9c('0x14')]('Schedule,\x20%s,\x20%s',_0x1e85a3,_0x51a375);_0x1cc799(_0x51a375);});});} \ No newline at end of file +var _0xd89f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x142dd9,_0x546e22){var _0x4fd66a=function(_0x22d616){while(--_0x22d616){_0x142dd9['push'](_0x142dd9['shift']());}};_0x4fd66a(++_0x546e22);}(_0xd89f,0x6d));var _0xfd89=function(_0x3f6406,_0x1944e7){_0x3f6406=_0x3f6406-0x0;var _0x865549=_0xd89f[_0x3f6406];return _0x865549;};'use strict';var _=require('lodash');var util=require(_0xfd89('0x0'));var moment=require('moment');var BPromise=require(_0xfd89('0x1'));var rs=require(_0xfd89('0x2'));var fs=require('fs');var Redis=require(_0xfd89('0x3'));var db=require(_0xfd89('0x4'))['db'];var utils=require(_0xfd89('0x5'));var logger=require(_0xfd89('0x6'))(_0xfd89('0x7'));var config=require(_0xfd89('0x8'));var jayson=require(_0xfd89('0x9'));var client=jayson[_0xfd89('0xa')][_0xfd89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x430eb1,_0x174aad,_0x475b5a){return new BPromise(function(_0x4cb155,_0x4bbae8){return client[_0xfd89('0xc')](_0x430eb1,_0x475b5a)['then'](function(_0x4e68ac){logger[_0xfd89('0xd')]('Schedule,\x20%s,\x20%s',_0x174aad,_0xfd89('0xe'));logger['debug'](_0xfd89('0xf'),_0x174aad,_0xfd89('0xe'),JSON[_0xfd89('0x10')](_0x4e68ac));if(_0x4e68ac['error']){if(_0x4e68ac[_0xfd89('0x11')][_0xfd89('0x12')]===0x1f4){logger[_0xfd89('0x11')]('Schedule,\x20%s,\x20%s',_0x174aad,_0x4e68ac[_0xfd89('0x11')][_0xfd89('0x13')]);return _0x4bbae8(_0x4e68ac[_0xfd89('0x11')][_0xfd89('0x13')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x174aad,_0x4e68ac[_0xfd89('0x11')]['message']);return _0x4cb155(_0x4e68ac[_0xfd89('0x11')]['message']);}else{logger['info'](_0xfd89('0x14'),_0x174aad,_0xfd89('0xe'));_0x4cb155(_0x4e68ac[_0xfd89('0x15')]['message']);}})[_0xfd89('0x16')](function(_0x231a3b){logger[_0xfd89('0x11')](_0xfd89('0x14'),_0x174aad,_0x231a3b);_0x4bbae8(_0x231a3b);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cd6b9a3..7f9baa1 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 _0x8441=['fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','describe','show','/:id/download','post','put','update','delete','/:id','multer','path','connect-timeout','express'];(function(_0x2ff6ce,_0x54e97e){var _0x4f18ec=function(_0x53e931){while(--_0x53e931){_0x2ff6ce['push'](_0x2ff6ce['shift']());}};_0x4f18ec(++_0x54e97e);}(_0x8441,0x1c4));var _0x1844=function(_0x10b183,_0x5f155e){_0x10b183=_0x10b183-0x0;var _0xdf206f=_0x8441[_0x10b183];return _0xdf206f;};'use strict';var multer=require(_0x1844('0x0'));var util=require('util');var path=require(_0x1844('0x1'));var timeout=require(_0x1844('0x2'));var express=require(_0x1844('0x3'));var router=express['Router']();var fs_extra=require(_0x1844('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1844('0x5'));var config=require(_0x1844('0x6'));var controller=require(_0x1844('0x7'));router[_0x1844('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1844('0x8')](_0x1844('0x9'),auth[_0x1844('0xa')](),controller[_0x1844('0xb')]);router[_0x1844('0x8')]('/:id',auth[_0x1844('0xa')](),controller[_0x1844('0xc')]);router['get'](_0x1844('0xd'),auth[_0x1844('0xa')](),controller['download']);router[_0x1844('0xe')]('/',auth[_0x1844('0xa')](),controller['create']);router[_0x1844('0xf')]('/:id',auth[_0x1844('0xa')](),controller[_0x1844('0x10')]);router[_0x1844('0x11')](_0x1844('0x12'),auth[_0x1844('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd42c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','download','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd42c,0x1c6));var _0xcd42=function(_0x13674b,_0x715ea8){_0x13674b=_0x13674b-0x0;var _0x32da90=_0xd42c[_0x13674b];return _0x32da90;};'use strict';var multer=require(_0xcd42('0x0'));var util=require(_0xcd42('0x1'));var path=require(_0xcd42('0x2'));var timeout=require(_0xcd42('0x3'));var express=require(_0xcd42('0x4'));var router=express[_0xcd42('0x5')]();var fs_extra=require(_0xcd42('0x6'));var auth=require(_0xcd42('0x7'));var interaction=require(_0xcd42('0x8'));var config=require(_0xcd42('0x9'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xcd42('0xa')](),controller['index']);router[_0xcd42('0xb')](_0xcd42('0xc'),auth['isAuthenticated'](),controller[_0xcd42('0xd')]);router[_0xcd42('0xb')]('/:id',auth[_0xcd42('0xa')](),controller[_0xcd42('0xe')]);router[_0xcd42('0xb')]('/:id/download',auth[_0xcd42('0xa')](),controller[_0xcd42('0xf')]);router[_0xcd42('0x10')]('/',auth[_0xcd42('0xa')](),controller[_0xcd42('0x11')]);router[_0xcd42('0x12')](_0xcd42('0x13'),auth[_0xcd42('0xa')](),controller[_0xcd42('0x14')]);router[_0xcd42('0x15')](_0xcd42('0x13'),auth[_0xcd42('0xa')](),controller[_0xcd42('0x16')]);module[_0xcd42('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index bf3a2df..b8d6e56 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 _0x964b=['updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','getDataValue','format','toString','MM-DD-YYYY\x20HH:mm','createdAt'];(function(_0x4a6bae,_0x215856){var _0x3f756d=function(_0x4784f5){while(--_0x4784f5){_0x4a6bae['push'](_0x4a6bae['shift']());}};_0x3f756d(++_0x215856);}(_0x964b,0x112));var _0xb964=function(_0x3f68e6,_0x1e48e8){_0x3f68e6=_0x3f68e6-0x0;var _0x682680=_0x964b[_0x3f68e6];return _0x682680;};'use strict';var Sequelize=require(_0xb964('0x0'));var moment=require(_0xb964('0x1'));var path=require('path');var config=require(_0xb964('0x2'));module[_0xb964('0x3')]={'format':{'type':Sequelize[_0xb964('0x4')],'get':function(){return this['getDataValue']('value')?path[_0xb964('0x5')](this['getDataValue'](_0xb964('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb964('0x7')]},'channel':{'type':Sequelize[_0xb964('0x7')]},'value':{'type':Sequelize[_0xb964('0x7')],'set':function(_0x204c7d){var _0xde47d5=_0x204c7d[_0xb964('0x8')](/\\/g,'/');this['setDataValue']('value',_0xde47d5);}},'rating':{'type':Sequelize[_0xb964('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x55e697){this[_0xb964('0xa')](_0xb964('0xb'),moment()[_0xb964('0xc')](_0x55e697,'ms'));this[_0xb964('0xa')](_0xb964('0xd'),moment());this[_0xb964('0xa')]('duration',_0x55e697);}},'startedAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0xb')))[_0xb964('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb964('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb964('0xd')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}},'createdAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x13')))['format'](_0xb964('0x12'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x14')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}}}; \ No newline at end of file +var _0xafcd=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','toString','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value'];(function(_0x5d9af4,_0xede285){var _0x1fadde=function(_0x4dce99){while(--_0x4dce99){_0x5d9af4['push'](_0x5d9af4['shift']());}};_0x1fadde(++_0xede285);}(_0xafcd,0x157));var _0xdafc=function(_0x2223be,_0x4e4034){_0x2223be=_0x2223be-0x0;var _0x453496=_0xafcd[_0x2223be];return _0x453496;};'use strict';var Sequelize=require(_0xdafc('0x0'));var moment=require(_0xdafc('0x1'));var path=require(_0xdafc('0x2'));var config=require(_0xdafc('0x3'));module[_0xdafc('0x4')]={'format':{'type':Sequelize[_0xdafc('0x5')],'get':function(){return this[_0xdafc('0x6')]('value')?path[_0xdafc('0x7')](this[_0xdafc('0x6')](_0xdafc('0x8'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdafc('0x9')]},'value':{'type':Sequelize[_0xdafc('0x9')],'set':function(_0x33adc9){var _0x52872c=_0x33adc9[_0xdafc('0xa')](/\\/g,'/');this[_0xdafc('0xb')](_0xdafc('0x8'),_0x52872c);}},'rating':{'type':Sequelize[_0xdafc('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdafc('0xc')],'set':function(_0x241787){this[_0xdafc('0xb')](_0xdafc('0xd'),moment()[_0xdafc('0xe')](_0x241787,'ms'));this[_0xdafc('0xb')](_0xdafc('0xf'),moment());this['setDataValue']('duration',_0x241787);}},'startedAt':{'type':Sequelize[_0xdafc('0x10')],'get':function(){return moment(this[_0xdafc('0x6')](_0xdafc('0xd')))[_0xdafc('0x11')](_0xdafc('0x12'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xdafc('0xf')))['format'](_0xdafc('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0xdafc('0x10')],'get':function(){return moment(this[_0xdafc('0x6')](_0xdafc('0x13')))[_0xdafc('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0xdafc('0x10')],'get':function(){return moment(this[_0xdafc('0x6')](_0xdafc('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0xdafc('0x15')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e925b09..5b6c0c5 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 _0x9957=['sort','pick','filter','where','merge','map','VIRTUAL','options','ScreenRecording','includeAll','include','catch','show','rawAttributes','find','create','body','duration','closedAt','params','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','filename','extname','unlink','message','ScreenRecording\x20not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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','index','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x4a5f86,_0x14452b){var _0x1733ff=function(_0x2acea3){while(--_0x2acea3){_0x4a5f86['push'](_0x4a5f86['shift']());}};_0x1733ff(++_0x14452b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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['ScreenRecording']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_['map'](_0x4253e5,'name'),[_0x7995('0x31')]);_0x456a28['query']=_[_0x7995('0x32')](_0x4b6f99[_0x7995('0x33')]);_0x456a28[_0x7995('0x34')]=_[_0x7995('0x35')](_0x456a28[_0x7995('0x2f')],_0x456a28['query']);_0x514445[_0x7995('0x36')]=_[_0x7995('0x35')](_0x456a28['model'],qs['fields'](_0x4b6f99['query'][_0x7995('0x37')]));_0x514445[_0x7995('0x36')]=_0x514445['attributes'][_0x7995('0x38')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99[_0x7995('0x33')][_0x7995('0x39')]('nolimit')){_0x514445['limit']=qs[_0x7995('0x21')](_0x4b6f99['query']['limit']);_0x514445[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x4b6f99['query'][_0x7995('0x20')]);}_0x514445[_0x7995('0x3a')]=qs[_0x7995('0x3b')](_0x4b6f99[_0x7995('0x33')][_0x7995('0x3b')]);_0x514445['where']=qs[_0x7995('0x34')](_[_0x7995('0x3c')](_0x4b6f99[_0x7995('0x33')],_0x456a28[_0x7995('0x34')]),_0x4253e5);if(_0x4b6f99['query'][_0x7995('0x3d')]){_0x514445[_0x7995('0x3e')]=_[_0x7995('0x3f')](_0x514445[_0x7995('0x3e')],{'$or':_[_0x7995('0x40')](_0x4253e5,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x41')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x33')][_0x7995('0x3d')]+'%'};return _0x3be298;}})});}_0x514445=_[_0x7995('0x3f')]({},_0x514445,_0x4b6f99[_0x7995('0x42')]);var _0x270c0e={'where':_0x514445[_0x7995('0x3e')]};return db[_0x7995('0x43')][_0x7995('0x1f')](_0x270c0e)[_0x7995('0x26')](function(_0x7b4e67){_0x3250e0['count']=_0x7b4e67;if(_0x4b6f99['query'][_0x7995('0x44')]){_0x514445[_0x7995('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x514445);})[_0x7995('0x26')](function(_0x4a9fef){_0x3250e0['rows']=_0x4a9fef;return _0x3250e0;})[_0x7995('0x26')](respondWithFilteredResult(_0x9b2a15,_0x514445))[_0x7995('0x46')](handleError(_0x9b2a15,null));};exports[_0x7995('0x47')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x32')](db[_0x7995('0x43')][_0x7995('0x48')]);_0x3993b5[_0x7995('0x33')]=_['keys'](_0x576b96[_0x7995('0x33')]);_0x3993b5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x3993b5[_0x7995('0x2f')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x35')](_0x3993b5['model'],qs[_0x7995('0x37')](_0x576b96['query'][_0x7995('0x37')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x36')][_0x7995('0x38')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x2f')];if(_0x576b96[_0x7995('0x33')][_0x7995('0x44')]){_0x5e85b9[_0x7995('0x45')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x42')]);return db[_0x7995('0x43')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x26')](respondWithResult(_0x46ac4f,null))[_0x7995('0x46')](handleError(_0x46ac4f,null));};exports[_0x7995('0x4a')]=function(_0x3d8ae3,_0x255313){return db['ScreenRecording'][_0x7995('0x4a')](_0x3d8ae3[_0x7995('0x4b')],{})['then'](respondWithResult(_0x255313,0xc9))[_0x7995('0x46')](handleError(_0x255313,null));};exports['update']=function(_0x1d87f9,_0x187735){if(_0x1d87f9[_0x7995('0x4b')]['id']){delete _0x1d87f9[_0x7995('0x4b')]['id'];}delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4c')];delete _0x1d87f9[_0x7995('0x4b')]['createdAt'];delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4d')];delete _0x1d87f9[_0x7995('0x4b')]['value'];return db[_0x7995('0x43')][_0x7995('0x49')]({'where':{'id':_0x1d87f9[_0x7995('0x4e')]['id']}})['then'](handleEntityNotFound(_0x187735,null))['then'](saveUpdates(_0x1d87f9['body'],null))[_0x7995('0x26')](respondWithResult(_0x187735,null))[_0x7995('0x46')](handleError(_0x187735,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x43')][_0x7995('0x4f')]()[_0x7995('0x26')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x50')]=function(_0x4ab09f,_0x14fe7f,_0x33c801){var _0x206d2a=require('../../components/encryptor');var _0x5e1f34=![];var _0x54e2b1={};if(_0x4ab09f['query'][_0x7995('0x2d')]&&_0x4ab09f[_0x7995('0x33')][_0x7995('0x2d')]===_0x7995('0x51')){_0x54e2b1[_0x7995('0x51')]=_0x4ab09f[_0x7995('0x4e')]['id'];}else{_0x54e2b1['id']=_0x4ab09f[_0x7995('0x4e')]['id'];}return db[_0x7995('0x43')][_0x7995('0x49')]({'where':_0x54e2b1,'attributes':['id',_0x7995('0x52')],'raw':!![]})[_0x7995('0x26')](handleEntityNotFound(_0x14fe7f,null))[_0x7995('0x26')](function(_0x3da72b){if(_0x3da72b){var _0x35bea3=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x3da72b[_0x7995('0x52')]);var _0x45e86e=util['format'](_0x7995('0x56'),_0x35bea3);if(fs[_0x7995('0x57')](_0x45e86e)){_0x5e1f34=!![];return _0x206d2a[_0x7995('0x58')](_0x45e86e,_0x35bea3,config[_0x7995('0x59')]['recording'])['then'](function(){return _0x3da72b;});}return _0x3da72b;}})[_0x7995('0x26')](function(_0x197b52){if(_0x197b52){var _0x5b9467=path[_0x7995('0x53')](config['root'],_0x7995('0x55'),_0x197b52[_0x7995('0x52')]);if(!fs[_0x7995('0x57')](_0x5b9467)){throw new db[(_0x7995('0x5a'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x197b52[_0x7995('0x5b')]){return _0x14fe7f[_0x7995('0x50')](_0x5b9467,_0x197b52[_0x7995('0x5b')]+path[_0x7995('0x5c')](_0x5b9467),function(){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}else{return _0x14fe7f[_0x7995('0x50')](_0x5b9467,function(_0x1d4689){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}}})[_0x7995('0x46')](function(_0x50caf5){if(_0x50caf5[_0x7995('0x5e')]===_0x7995('0x5f')){_0x14fe7f[_0x7995('0x1c')](0x194)[_0x7995('0x2a')]('Not\x20found');}else{return handleError(_0x14fe7f,null);}});};exports['destroy']=function(_0x3053fd,_0xebb5c8){return db['ScreenRecording'][_0x7995('0x49')]({'where':{'id':_0x3053fd[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](function(_0x57727e){if(_[_0x7995('0x60')](_0x57727e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x57727e;})[_0x7995('0x26')](function(_0x564fca){var _0x3e0a46=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x564fca[_0x7995('0x52')]);logger[_0x7995('0x61')](_0x7995('0x62'),_0x3e0a46);if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger[_0x7995('0x61')](_0x7995('0x63')+_0x3e0a46+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7995('0x64')](_0x3e0a46);}_0x3e0a46=_0x3e0a46+_0x7995('0x65');if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger['info']('File:\x20\x22'+_0x3e0a46+_0x7995('0x66'));fs[_0x7995('0x64')](_0x3e0a46);}return _0x564fca;})[_0x7995('0x26')](function(_0xae6166){if(!_0xae6166)throw new InternalError();return _0xae6166['destroy']();})[_0x7995('0x26')](function(){_0xebb5c8['status'](0xcc)['end']();})[_0x7995('0x46')](handleError(_0xebb5c8,null));}; \ No newline at end of file +var _0xa630=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','createdAt','value','describe','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','ScreenRecording\x20not\x20found','filename','extname','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa630,0xbe));var _0x0a63=function(_0x53ac4f,_0x4a9bdb){_0x53ac4f=_0x53ac4f-0x0;var _0x3ec288=_0xa630[_0x53ac4f];return _0x3ec288;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['index']=function(_0x34239b,_0xcf409){var _0x1b7bdb={},_0x145090={},_0x32a52b={'count':0x0,'rows':[]};var _0x4577b6=_[_0x0a63('0x2a')](db[_0x0a63('0x2b')]['rawAttributes'],function(_0x58cc71){return{'name':_0x58cc71['fieldName'],'type':_0x58cc71[_0x0a63('0x2c')][_0x0a63('0x2d')]};});_0x145090[_0x0a63('0x2e')]=_[_0x0a63('0x2f')](_[_0x0a63('0x2a')](_0x4577b6,'name'),[_0x0a63('0x30')]);_0x145090[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x34239b[_0x0a63('0x31')]);_0x145090['filters']=_[_0x0a63('0x33')](_0x145090[_0x0a63('0x2e')],_0x145090['query']);_0x1b7bdb['attributes']=_[_0x0a63('0x33')](_0x145090['model'],qs['fields'](_0x34239b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x1b7bdb['attributes']=_0x1b7bdb[_0x0a63('0x35')][_0x0a63('0x36')]?_0x1b7bdb[_0x0a63('0x35')]:_0x145090[_0x0a63('0x2e')];if(!_0x34239b[_0x0a63('0x31')]['hasOwnProperty']('nolimit')){_0x1b7bdb[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x34239b[_0x0a63('0x31')][_0x0a63('0x1c')]);_0x1b7bdb[_0x0a63('0x1b')]=qs[_0x0a63('0x1b')](_0x34239b['query'][_0x0a63('0x1b')]);}_0x1b7bdb[_0x0a63('0x37')]=qs['sort'](_0x34239b[_0x0a63('0x31')]['sort']);_0x1b7bdb['where']=qs[_0x0a63('0x38')](_[_0x0a63('0x39')](_0x34239b[_0x0a63('0x31')],_0x145090['filters']),_0x4577b6);if(_0x34239b[_0x0a63('0x31')][_0x0a63('0x3a')]){_0x1b7bdb[_0x0a63('0x3b')]=_[_0x0a63('0x3c')](_0x1b7bdb[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x2a')](_0x4577b6,function(_0x604a45){if(_0x604a45['type']!==_0x0a63('0x3d')){var _0x1c7e67={};_0x1c7e67[_0x604a45[_0x0a63('0x28')]]={'$like':'%'+_0x34239b['query']['filter']+'%'};return _0x1c7e67;}})});}_0x1b7bdb=_[_0x0a63('0x3c')]({},_0x1b7bdb,_0x34239b['options']);var _0x1a01f4={'where':_0x1b7bdb[_0x0a63('0x3b')]};return db[_0x0a63('0x2b')]['count'](_0x1a01f4)[_0x0a63('0x24')](function(_0x14c737){_0x32a52b[_0x0a63('0x1e')]=_0x14c737;if(_0x34239b[_0x0a63('0x31')]['includeAll']){_0x1b7bdb[_0x0a63('0x3e')]=[{'all':!![]}];}return db[_0x0a63('0x2b')][_0x0a63('0x3f')](_0x1b7bdb);})[_0x0a63('0x24')](function(_0xf18ace){_0x32a52b[_0x0a63('0x40')]=_0xf18ace;return _0x32a52b;})['then'](respondWithFilteredResult(_0xcf409,_0x1b7bdb))[_0x0a63('0x41')](handleError(_0xcf409,null));};exports[_0x0a63('0x42')]=function(_0x347a0b,_0x793502){var _0x20fa0d={'raw':![],'where':{'id':_0x347a0b[_0x0a63('0x43')]['id']}},_0x2482ca={};_0x2482ca[_0x0a63('0x2e')]=_[_0x0a63('0x32')](db[_0x0a63('0x2b')][_0x0a63('0x44')]);_0x2482ca[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x347a0b[_0x0a63('0x31')]);_0x2482ca[_0x0a63('0x38')]=_[_0x0a63('0x33')](_0x2482ca[_0x0a63('0x2e')],_0x2482ca[_0x0a63('0x31')]);_0x20fa0d['attributes']=_[_0x0a63('0x33')](_0x2482ca['model'],qs['fields'](_0x347a0b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x20fa0d[_0x0a63('0x35')]=_0x20fa0d[_0x0a63('0x35')][_0x0a63('0x36')]?_0x20fa0d[_0x0a63('0x35')]:_0x2482ca[_0x0a63('0x2e')];if(_0x347a0b[_0x0a63('0x31')][_0x0a63('0x45')]){_0x20fa0d[_0x0a63('0x3e')]=[{'all':!![]}];}_0x20fa0d=_[_0x0a63('0x3c')]({},_0x20fa0d,_0x347a0b[_0x0a63('0x46')]);return db[_0x0a63('0x2b')][_0x0a63('0x47')](_0x20fa0d)[_0x0a63('0x24')](handleEntityNotFound(_0x793502,null))[_0x0a63('0x24')](respondWithResult(_0x793502,null))[_0x0a63('0x41')](handleError(_0x793502,null));};exports[_0x0a63('0x48')]=function(_0x366887,_0x148e0a){return db['ScreenRecording'][_0x0a63('0x48')](_0x366887[_0x0a63('0x49')],{})['then'](respondWithResult(_0x148e0a,0xc9))['catch'](handleError(_0x148e0a,null));};exports['update']=function(_0x485f20,_0x36d066){if(_0x485f20[_0x0a63('0x49')]['id']){delete _0x485f20['body']['id'];}delete _0x485f20[_0x0a63('0x49')]['duration'];delete _0x485f20[_0x0a63('0x49')][_0x0a63('0x4a')];delete _0x485f20['body']['closedAt'];delete _0x485f20['body'][_0x0a63('0x4b')];return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':{'id':_0x485f20[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x36d066,null))['then'](saveUpdates(_0x485f20[_0x0a63('0x49')],null))[_0x0a63('0x24')](respondWithResult(_0x36d066,null))[_0x0a63('0x41')](handleError(_0x36d066,null));};exports[_0x0a63('0x4c')]=function(_0x3575ae,_0x4a5b6e){return db[_0x0a63('0x2b')][_0x0a63('0x4c')]()[_0x0a63('0x24')](respondWithResult(_0x4a5b6e,null))[_0x0a63('0x41')](handleError(_0x4a5b6e,null));};exports['download']=function(_0x35b688,_0x3bd10c,_0x337bef){var _0x330550=require(_0x0a63('0x4d'));var _0x258ed3=![];var _0x4d4e20={};if(_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]&&_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]==='uniqueid'){_0x4d4e20['uniqueid']=_0x35b688[_0x0a63('0x43')]['id'];}else{_0x4d4e20['id']=_0x35b688[_0x0a63('0x43')]['id'];}return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':_0x4d4e20,'attributes':['id',_0x0a63('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3bd10c,null))['then'](function(_0x58b3a8){if(_0x58b3a8){var _0x42c1bb=path['join'](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x58b3a8[_0x0a63('0x4b')]);var _0x5d77e3=util['format'](_0x0a63('0x50'),_0x42c1bb);if(fs[_0x0a63('0x51')](_0x5d77e3)){_0x258ed3=!![];return _0x330550[_0x0a63('0x52')](_0x5d77e3,_0x42c1bb,config[_0x0a63('0x53')][_0x0a63('0x54')])[_0x0a63('0x24')](function(){return _0x58b3a8;});}return _0x58b3a8;}})[_0x0a63('0x24')](function(_0xc3415c){if(_0xc3415c){var _0xe454ef=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0xc3415c[_0x0a63('0x4b')]);if(!fs[_0x0a63('0x51')](_0xe454ef)){throw new db['Sequelize']['ValidationError'](_0x0a63('0x56'));}if(_0xc3415c[_0x0a63('0x57')]){return _0x3bd10c['download'](_0xe454ef,_0xc3415c[_0x0a63('0x57')]+path[_0x0a63('0x58')](_0xe454ef),function(){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}else{return _0x3bd10c[_0x0a63('0x59')](_0xe454ef,function(_0x3053e4){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}}})['catch'](function(_0x3b395a){if(_0x3b395a[_0x0a63('0x5a')]===_0x0a63('0x56')){_0x3bd10c['status'](0x194)[_0x0a63('0x29')](_0x0a63('0x5b'));}else{return handleError(_0x3bd10c,null);}});};exports[_0x0a63('0x25')]=function(_0x284dca,_0x15fc2e){return db['ScreenRecording'][_0x0a63('0x47')]({'where':{'id':_0x284dca[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](function(_0x1fa9cd){if(_[_0x0a63('0x5c')](_0x1fa9cd)){throw new ReferenceError(_0x0a63('0x5d'));}return _0x1fa9cd;})[_0x0a63('0x24')](function(_0x57313b){var _0x4571e7=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x57313b[_0x0a63('0x4b')]);logger[_0x0a63('0x5e')](_0x0a63('0x5f'),_0x4571e7);if(!_[_0x0a63('0x5c')](_0x57313b['value'])&&fs['existsSync'](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}_0x4571e7=_0x4571e7+_0x0a63('0x63');if(!_['isNil'](_0x57313b[_0x0a63('0x4b')])&&fs[_0x0a63('0x51')](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}return _0x57313b;})[_0x0a63('0x24')](function(_0xe52dfd){if(!_0xe52dfd)throw new InternalError();return _0xe52dfd[_0x0a63('0x25')]();})[_0x0a63('0x24')](function(){_0x15fc2e[_0x0a63('0x19')](0xcc)['end']();})[_0x0a63('0x41')](handleError(_0x15fc2e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 60d83a3..03e4249 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 _0x9022=['path','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xafbcaf,_0x47c5e1){var _0x5b4a85=function(_0xbd114a){while(--_0xbd114a){_0xafbcaf['push'](_0xafbcaf['shift']());}};_0x5b4a85(++_0x47c5e1);}(_0x9022,0x159));var _0x2902=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x9022[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require(_0x2902('0x0'));var util=require(_0x2902('0x1'));var logger=require(_0x2902('0x2'))(_0x2902('0x3'));var moment=require('moment');var BPromise=require(_0x2902('0x4'));var rp=require(_0x2902('0x5'));var fs=require('fs');var path=require(_0x2902('0x6'));var rimraf=require(_0x2902('0x7'));var config=require(_0x2902('0x8'));var attributes=require(_0x2902('0x9'));module['exports']=function(_0x5c5cc5,_0x590bfc){return _0x5c5cc5['define'](_0x2902('0xa'),attributes,{'tableName':_0x2902('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x2902('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd3d=['./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x243e42,_0x5cf40a){var _0x15b7dd=function(_0x7099e2){while(--_0x7099e2){_0x243e42['push'](_0x243e42['shift']());}};_0x15b7dd(++_0x5cf40a);}(_0xfd3d,0x1b7));var _0xdfd3=function(_0x1b494c,_0x8777c1){_0x1b494c=_0x1b494c-0x0;var _0x5a26b7=_0xfd3d[_0x1b494c];return _0x5a26b7;};'use strict';var _=require(_0xdfd3('0x0'));var util=require(_0xdfd3('0x1'));var logger=require(_0xdfd3('0x2'))('api');var moment=require(_0xdfd3('0x3'));var BPromise=require(_0xdfd3('0x4'));var rp=require(_0xdfd3('0x5'));var fs=require('fs');var path=require(_0xdfd3('0x6'));var rimraf=require(_0xdfd3('0x7'));var config=require(_0xdfd3('0x8'));var attributes=require(_0xdfd3('0x9'));module[_0xdfd3('0xa')]=function(_0x3e73b8,_0x3e4e51){return _0x3e73b8[_0xdfd3('0xb')](_0xdfd3('0xc'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xdfd3('0xd'),'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 14e743f..042d576 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 _0x648d=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x648d,0x13e));var _0xd648=function(_0x539427,_0x4e1536){_0x539427=_0x539427-0x0;var _0x41cab8=_0x648d[_0x539427];return _0x41cab8;};'use strict';var _=require(_0xd648('0x0'));var util=require(_0xd648('0x1'));var moment=require(_0xd648('0x2'));var BPromise=require(_0xd648('0x3'));var rs=require(_0xd648('0x4'));var fs=require('fs');var Redis=require(_0xd648('0x5'));var db=require(_0xd648('0x6'))['db'];var utils=require(_0xd648('0x7'));var logger=require(_0xd648('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd648('0x9'));var client=jayson[_0xd648('0xa')][_0xd648('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x248af4,_0x2dda9a,_0x140196){return new BPromise(function(_0x126299,_0x3413c4){return client[_0xd648('0xc')](_0x248af4,_0x140196)[_0xd648('0xd')](function(_0x1dac97){logger[_0xd648('0xe')](_0xd648('0xf'),_0x2dda9a,_0xd648('0x10'));logger[_0xd648('0x11')](_0xd648('0x12'),_0x2dda9a,_0xd648('0x10'),JSON[_0xd648('0x13')](_0x1dac97));if(_0x1dac97[_0xd648('0x14')]){if(_0x1dac97[_0xd648('0x14')][_0xd648('0x15')]===0x1f4){logger[_0xd648('0x14')](_0xd648('0xf'),_0x2dda9a,_0x1dac97['error'][_0xd648('0x16')]);return _0x3413c4(_0x1dac97[_0xd648('0x14')][_0xd648('0x16')]);}logger[_0xd648('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x2dda9a,_0x1dac97[_0xd648('0x14')][_0xd648('0x16')]);return _0x126299(_0x1dac97[_0xd648('0x14')][_0xd648('0x16')]);}else{logger[_0xd648('0xe')](_0xd648('0xf'),_0x2dda9a,'request\x20sent');_0x126299(_0x1dac97['result'][_0xd648('0x16')]);}})[_0xd648('0x17')](function(_0x118929){logger['error'](_0xd648('0xf'),_0x2dda9a,_0x118929);_0x3413c4(_0x118929);});});} \ No newline at end of file +var _0x624d=['client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5add7e,_0x25953a){var _0x514f33=function(_0x32b899){while(--_0x32b899){_0x5add7e['push'](_0x5add7e['shift']());}};_0x514f33(++_0x25953a);}(_0x624d,0x122));var _0xd624=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x624d[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0xd624('0x0'));var util=require(_0xd624('0x1'));var moment=require(_0xd624('0x2'));var BPromise=require(_0xd624('0x3'));var rs=require(_0xd624('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd624('0x5'));var logger=require(_0xd624('0x6'))('rpc');var config=require(_0xd624('0x7'));var jayson=require(_0xd624('0x8'));var client=jayson[_0xd624('0x9')][_0xd624('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x63d9cb,_0x387022,_0x264199){return new BPromise(function(_0x31cb79,_0x313857){return client[_0xd624('0xb')](_0x63d9cb,_0x264199)[_0xd624('0xc')](function(_0x2e3607){logger['info'](_0xd624('0xd'),_0x387022,_0xd624('0xe'));logger[_0xd624('0xf')](_0xd624('0x10'),_0x387022,_0xd624('0xe'),JSON[_0xd624('0x11')](_0x2e3607));if(_0x2e3607['error']){if(_0x2e3607[_0xd624('0x12')][_0xd624('0x13')]===0x1f4){logger[_0xd624('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x387022,_0x2e3607['error'][_0xd624('0x14')]);return _0x313857(_0x2e3607[_0xd624('0x12')]['message']);}logger[_0xd624('0x12')](_0xd624('0xd'),_0x387022,_0x2e3607[_0xd624('0x12')][_0xd624('0x14')]);return _0x31cb79(_0x2e3607['error'][_0xd624('0x14')]);}else{logger[_0xd624('0x15')](_0xd624('0xd'),_0x387022,_0xd624('0xe'));_0x31cb79(_0x2e3607[_0xd624('0x16')][_0xd624('0x14')]);}})['catch'](function(_0x422f55){logger[_0xd624('0x12')](_0xd624('0xd'),_0x387022,_0x422f55);_0x313857(_0x422f55);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2f7ebfe..e34fed8 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 _0x96eb=['logologin','preferred','/:id/preferred','addPreferred','addFavicon','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./setting.controller','get','isAuthenticated','index','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','root'];(function(_0x1e4594,_0xa2fa64){var _0x1f9ff4=function(_0x5a97f7){while(--_0x5a97f7){_0x1e4594['push'](_0x1e4594['shift']());}};_0x1f9ff4(++_0xa2fa64);}(_0x96eb,0x1cb));var _0xb96e=function(_0x39d37f,_0x3fceac){_0x39d37f=_0x39d37f-0x0;var _0x470bc6=_0x96eb[_0x39d37f];return _0x470bc6;};'use strict';var multer=require(_0xb96e('0x0'));var util=require('util');var path=require(_0xb96e('0x1'));var timeout=require(_0xb96e('0x2'));var express=require(_0xb96e('0x3'));var router=express['Router']();var fs_extra=require(_0xb96e('0x4'));var auth=require(_0xb96e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb96e('0x6'));router[_0xb96e('0x7')]('/',auth[_0xb96e('0x8')](),controller[_0xb96e('0x9')]);router[_0xb96e('0x7')]('/now',controller[_0xb96e('0xa')]);router[_0xb96e('0x7')](_0xb96e('0xb'),controller[_0xb96e('0xc')]);router['get'](_0xb96e('0xd'),controller[_0xb96e('0xe')]);router[_0xb96e('0x7')]('/:id/logo_login',controller[_0xb96e('0xf')]);router[_0xb96e('0x7')](_0xb96e('0x10'),controller[_0xb96e('0x11')]);router[_0xb96e('0x7')]('/:id/preferred',controller['getPreferred']);router['get'](_0xb96e('0x12'),controller[_0xb96e('0x13')]);var upload=multer({'storage':multer[_0xb96e('0x14')]({'destination':function(_0x4d00fe,_0x119c3c,_0xaafa53){_0xaafa53(null,path[_0xb96e('0x15')](config['root'],_0xb96e('0x16')));},'filename':function(_0x51c363,_0x201eb7,_0x33149a){_0x33149a(null,util[_0xb96e('0x17')](_0xb96e('0x18'),_0xb96e('0x19'),path[_0xb96e('0x1a')](_0x201eb7[_0xb96e('0x1b')])));}})});router[_0xb96e('0x1c')](_0xb96e('0xd'),upload[_0xb96e('0x1d')](_0xb96e('0x1e')),controller[_0xb96e('0x1f')]);var upload=multer({'storage':multer[_0xb96e('0x14')]({'destination':function(_0x1aa462,_0x1699c9,_0x42f2ff){_0x42f2ff(null,path[_0xb96e('0x15')](config[_0xb96e('0x20')],'server/files/images/logos/'));},'filename':function(_0x356716,_0x468606,_0x1424df){_0x1424df(null,util[_0xb96e('0x17')]('%s%s',_0xb96e('0x21'),path[_0xb96e('0x1a')](_0x468606[_0xb96e('0x1b')])));}})});router['post']('/:id/logo_login',upload['single'](_0xb96e('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xb96e('0x14')]({'destination':function(_0x1ce23a,_0x1cd48d,_0x3581ad){_0x3581ad(null,path[_0xb96e('0x15')](config[_0xb96e('0x20')],'server/files/images/logos/'));},'filename':function(_0x13b572,_0x4c9a66,_0x164e43){_0x164e43(null,util['format']('%s%s',_0xb96e('0x22'),path['extname'](_0x4c9a66['originalname'])));}})});router['post'](_0xb96e('0x23'),upload[_0xb96e('0x1d')](_0xb96e('0x1e')),controller[_0xb96e('0x24')]);var upload=multer({'storage':multer[_0xb96e('0x14')]({'destination':function(_0x302af7,_0x4bea6e,_0x5a9d30){_0x5a9d30(null,path[_0xb96e('0x15')](config[_0xb96e('0x20')],_0xb96e('0x16')));},'filename':function(_0x5c6363,_0x1fce13,_0x4a2a19){_0x4a2a19(null,util[_0xb96e('0x17')](_0xb96e('0x18'),'favicon',path[_0xb96e('0x1a')](_0x1fce13[_0xb96e('0x1b')])));}})});router[_0xb96e('0x1c')]('/:id/favicon',upload[_0xb96e('0x1d')](_0xb96e('0x1e')),controller[_0xb96e('0x25')]);router[_0xb96e('0x26')](_0xb96e('0xb'),auth['isAuthenticated'](),controller[_0xb96e('0x27')]);module[_0xb96e('0x28')]=router; \ No newline at end of file +var _0x3f85=['root','server/files/images/logos/','%s%s','originalname','post','addLogo','diskStorage','join','format','extname','single','file','preferred','addPreferred','addFavicon','isAuthenticated','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon'];(function(_0x339cbb,_0x190acb){var _0x326b24=function(_0x3c818a){while(--_0x3c818a){_0x339cbb['push'](_0x339cbb['shift']());}};_0x326b24(++_0x190acb);}(_0x3f85,0x90));var _0x53f8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f85[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x53f8('0x0'));var util=require('util');var path=require(_0x53f8('0x1'));var timeout=require(_0x53f8('0x2'));var express=require(_0x53f8('0x3'));var router=express[_0x53f8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x53f8('0x5'));var config=require(_0x53f8('0x6'));var controller=require(_0x53f8('0x7'));router[_0x53f8('0x8')]('/',auth['isAuthenticated'](),controller[_0x53f8('0x9')]);router[_0x53f8('0x8')](_0x53f8('0xa'),controller[_0x53f8('0xb')]);router['get'](_0x53f8('0xc'),controller[_0x53f8('0xd')]);router[_0x53f8('0x8')](_0x53f8('0xe'),controller[_0x53f8('0xf')]);router[_0x53f8('0x8')](_0x53f8('0x10'),controller[_0x53f8('0x11')]);router[_0x53f8('0x8')](_0x53f8('0x12'),controller[_0x53f8('0x13')]);router[_0x53f8('0x8')](_0x53f8('0x14'),controller[_0x53f8('0x15')]);router[_0x53f8('0x8')](_0x53f8('0x16'),controller[_0x53f8('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x38aea4,_0x37caf3,_0x2bd158){_0x2bd158(null,path['join'](config[_0x53f8('0x18')],_0x53f8('0x19')));},'filename':function(_0x3df0c7,_0x3e93dc,_0x5618c3){_0x5618c3(null,util['format'](_0x53f8('0x1a'),'logo',path['extname'](_0x3e93dc[_0x53f8('0x1b')])));}})});router[_0x53f8('0x1c')](_0x53f8('0xe'),upload['single']('file'),controller[_0x53f8('0x1d')]);var upload=multer({'storage':multer[_0x53f8('0x1e')]({'destination':function(_0x5a3215,_0x4febc3,_0x71628b){_0x71628b(null,path[_0x53f8('0x1f')](config[_0x53f8('0x18')],'server/files/images/logos/'));},'filename':function(_0x453cfc,_0x197869,_0x30da94){_0x30da94(null,util[_0x53f8('0x20')](_0x53f8('0x1a'),'logologin',path[_0x53f8('0x21')](_0x197869[_0x53f8('0x1b')])));}})});router['post']('/:id/logo_login',upload[_0x53f8('0x22')](_0x53f8('0x23')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x53f8('0x1e')]({'destination':function(_0x341c00,_0x5aef1b,_0x4d1aad){_0x4d1aad(null,path[_0x53f8('0x1f')](config[_0x53f8('0x18')],_0x53f8('0x19')));},'filename':function(_0x23f1b2,_0x55c404,_0x1a6676){_0x1a6676(null,util[_0x53f8('0x20')](_0x53f8('0x1a'),_0x53f8('0x24'),path[_0x53f8('0x21')](_0x55c404['originalname'])));}})});router[_0x53f8('0x1c')](_0x53f8('0x14'),upload['single'](_0x53f8('0x23')),controller[_0x53f8('0x25')]);var upload=multer({'storage':multer[_0x53f8('0x1e')]({'destination':function(_0x375882,_0x48bb4e,_0x3e5dfd){_0x3e5dfd(null,path[_0x53f8('0x1f')](config[_0x53f8('0x18')],_0x53f8('0x19')));},'filename':function(_0x9a27b8,_0x92b64,_0x3640a7){_0x3640a7(null,util[_0x53f8('0x20')](_0x53f8('0x1a'),'favicon',path[_0x53f8('0x21')](_0x92b64[_0x53f8('0x1b')])));}})});router['post']('/:id/favicon',upload[_0x53f8('0x22')]('file'),controller[_0x53f8('0x26')]);router['put'](_0x53f8('0xc'),auth[_0x53f8('0x27')](),controller[_0x53f8('0x28')]);module[_0x53f8('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 97ac757..5236895 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(_0x5a3433,_0x2a2d38){var _0x37eb25=function(_0x278737){while(--_0x278737){_0x5a3433['push'](_0x5a3433['shift']());}};_0x37eb25(++_0x2a2d38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x214b91,_0x8c9150){var _0x5db6c1=function(_0x4a4b68){while(--_0x4a4b68){_0x214b91['push'](_0x214b91['shift']());}};_0x5db6c1(++_0x8c9150);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 779d16f..d3d8cfb 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 _0x5ce6=['squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','index','Setting','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','body','find','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x3bc82d,_0x59187f){var _0x2cfb3d=function(_0x515ac3){while(--_0x515ac3){_0x3bc82d['push'](_0x3bc82d['shift']());}};_0x2cfb3d(++_0x59187f);}(_0x5ce6,0xee));var _0x65ce=function(_0xbc6566,_0x32d463){_0xbc6566=_0xbc6566-0x0;var _0x4ed128=_0x5ce6[_0xbc6566];return _0x4ed128;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65ce('0x0'));var zipdir=require(_0x65ce('0x1'));var jsonpatch=require(_0x65ce('0x2'));var rp=require(_0x65ce('0x3'));var moment=require(_0x65ce('0x4'));var BPromise=require(_0x65ce('0x5'));var Mustache=require(_0x65ce('0x6'));var util=require('util');var path=require(_0x65ce('0x7'));var sox=require(_0x65ce('0x8'));var csv=require(_0x65ce('0x9'));var ejs=require(_0x65ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65ce('0xb'));var squel=require(_0x65ce('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x65ce('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65ce('0xe'));var Papa=require(_0x65ce('0xf'));var Redis=require('ioredis');var authService=require(_0x65ce('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x65ce('0x11'))(_0x65ce('0x12'));var utils=require(_0x65ce('0x13'));var config=require(_0x65ce('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x65ce('0x15'))['db'];var jayson=require(_0x65ce('0x16'));var client=jayson[_0x65ce('0x17')][_0x65ce('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x483744,_0x9b1a83,_0x26b897,_0x402bb5){return new BPromise(function(_0x5dc669,_0x35d8e3){var _0x27cec6=_0x402bb5||client;return _0x27cec6['request'](_0x483744,_0x26b897)[_0x65ce('0x19')](function(_0x46d483){logger[_0x65ce('0x1a')](_0x65ce('0x1b'),_0x9b1a83,'request\x20sent');logger[_0x65ce('0x1c')](_0x65ce('0x1d'),_0x9b1a83,_0x65ce('0x1e'),JSON[_0x65ce('0x1f')](_0x46d483));if(_0x46d483['error']){if(_0x46d483[_0x65ce('0x20')][_0x65ce('0x21')]===0x1f4){logger[_0x65ce('0x20')]('Setting,\x20%s,\x20%s',_0x9b1a83,_0x46d483[_0x65ce('0x20')]['message']);return _0x35d8e3(_0x46d483[_0x65ce('0x20')]['message']);}logger[_0x65ce('0x20')](_0x65ce('0x1b'),_0x9b1a83,_0x46d483[_0x65ce('0x20')][_0x65ce('0x22')]);return _0x5dc669(_0x46d483['error'][_0x65ce('0x22')]);}else{logger[_0x65ce('0x1a')]('Setting,\x20%s,\x20%s',_0x9b1a83,'request\x20sent');_0x5dc669(_0x46d483[_0x65ce('0x23')][_0x65ce('0x22')]);}})['catch'](function(_0x542b9e){logger[_0x65ce('0x20')]('Setting,\x20%s,\x20%s',_0x9b1a83,_0x542b9e);_0x35d8e3(_0x542b9e);});});}function respondWithStatusCode(_0x1180db,_0x586625){_0x586625=_0x586625||0xcc;return function(_0x27069e){if(_0x27069e){return _0x1180db[_0x65ce('0x24')](_0x586625);}return _0x1180db[_0x65ce('0x25')](_0x586625)[_0x65ce('0x26')]();};}function respondWithResult(_0x58652d,_0x3472dd){_0x3472dd=_0x3472dd||0xc8;return function(_0x242248){if(_0x242248){return _0x58652d[_0x65ce('0x25')](_0x3472dd)[_0x65ce('0x27')](_0x242248);}};}function respondWithFilteredResult(_0x1d095c,_0x362604){return function(_0xc62362){if(_0xc62362){var _0x14b3b3=typeof _0x362604['offset']==='undefined'&&typeof _0x362604[_0x65ce('0x28')]===_0x65ce('0x29');var _0x4e33bf=_0xc62362[_0x65ce('0x2a')];var _0x134b09=_0x14b3b3?0x0:_0x362604[_0x65ce('0x2b')];var _0x5adfa8=_0x14b3b3?_0xc62362[_0x65ce('0x2a')]:_0x362604['offset']+_0x362604[_0x65ce('0x28')];var _0x340bbb;if(_0x5adfa8>=_0x4e33bf){_0x5adfa8=_0x4e33bf;_0x340bbb=0xc8;}else{_0x340bbb=0xce;}_0x1d095c[_0x65ce('0x25')](_0x340bbb);return _0x1d095c['set'](_0x65ce('0x2c'),_0x134b09+'-'+_0x5adfa8+'/'+_0x4e33bf)['json'](_0xc62362);}return null;};}function patchUpdates(_0x5a7e56){return function(_0x2e23c0){try{jsonpatch[_0x65ce('0x2d')](_0x2e23c0,_0x5a7e56,!![]);}catch(_0x22336e){return BPromise[_0x65ce('0x2e')](_0x22336e);}return _0x2e23c0[_0x65ce('0x2f')]();};}function saveUpdates(_0x286fbb,_0x498d02){return function(_0x12c0f1){if(_0x12c0f1){return _0x12c0f1[_0x65ce('0x30')](_0x286fbb)[_0x65ce('0x19')](function(_0x5e8fb2){return _0x5e8fb2;});}return null;};}function removeEntity(_0x5db92b,_0x2f96c5){return function(_0x14feb6){if(_0x14feb6){return _0x14feb6[_0x65ce('0x31')]()[_0x65ce('0x19')](function(){_0x5db92b['status'](0xcc)[_0x65ce('0x26')]();});}};}function handleEntityNotFound(_0x142036,_0x2c37d5){return function(_0x1c82ba){if(!_0x1c82ba){_0x142036['sendStatus'](0x194);}return _0x1c82ba;};}function handleError(_0x1aae50,_0x54b58d){_0x54b58d=_0x54b58d||0x1f4;return function(_0x4e639a){logger[_0x65ce('0x20')](_0x4e639a[_0x65ce('0x32')]);if(_0x4e639a['name']){delete _0x4e639a[_0x65ce('0x33')];}_0x1aae50[_0x65ce('0x25')](_0x54b58d)['send'](_0x4e639a);};}exports[_0x65ce('0x34')]=function(_0x19a3ea,_0x5f1b27){var _0x4c5016={},_0x151697={},_0x4c911d={'count':0x0,'rows':[]};var _0x47828c=_['map'](db[_0x65ce('0x35')][_0x65ce('0x36')],function(_0x442c4a){return{'name':_0x442c4a[_0x65ce('0x37')],'type':_0x442c4a[_0x65ce('0x38')]['key']};});_0x151697[_0x65ce('0x39')]=_[_0x65ce('0x3a')](_0x47828c,'name');_0x151697['query']=_['keys'](_0x19a3ea[_0x65ce('0x3b')]);_0x151697['filters']=_[_0x65ce('0x3c')](_0x151697[_0x65ce('0x39')],_0x151697[_0x65ce('0x3b')]);_0x4c5016[_0x65ce('0x3d')]=_[_0x65ce('0x3c')](_0x151697['model'],qs[_0x65ce('0x3e')](_0x19a3ea[_0x65ce('0x3b')][_0x65ce('0x3e')]));_0x4c5016[_0x65ce('0x3d')]=_0x4c5016[_0x65ce('0x3d')][_0x65ce('0x3f')]?_0x4c5016['attributes']:_0x151697[_0x65ce('0x39')];if(!_0x19a3ea[_0x65ce('0x3b')][_0x65ce('0x40')](_0x65ce('0x41'))){_0x4c5016['limit']=qs[_0x65ce('0x28')](_0x19a3ea[_0x65ce('0x3b')][_0x65ce('0x28')]);_0x4c5016[_0x65ce('0x2b')]=qs[_0x65ce('0x2b')](_0x19a3ea[_0x65ce('0x3b')][_0x65ce('0x2b')]);}_0x4c5016[_0x65ce('0x42')]=qs[_0x65ce('0x43')](_0x19a3ea[_0x65ce('0x3b')][_0x65ce('0x43')]);_0x4c5016['where']=qs[_0x65ce('0x44')](_[_0x65ce('0x45')](_0x19a3ea[_0x65ce('0x3b')],_0x151697[_0x65ce('0x44')]),_0x47828c);if(_0x19a3ea[_0x65ce('0x3b')]['filter']){_0x4c5016['where']=_[_0x65ce('0x46')](_0x4c5016[_0x65ce('0x47')],{'$or':_[_0x65ce('0x3a')](_0x47828c,function(_0x263a84){if(_0x263a84[_0x65ce('0x38')]!==_0x65ce('0x48')){var _0x103f59={};_0x103f59[_0x263a84['name']]={'$like':'%'+_0x19a3ea[_0x65ce('0x3b')][_0x65ce('0x49')]+'%'};return _0x103f59;}})});}_0x4c5016=_[_0x65ce('0x46')]({},_0x4c5016,_0x19a3ea[_0x65ce('0x4a')]);var _0x9afe97={'where':_0x4c5016[_0x65ce('0x47')]};return db[_0x65ce('0x35')][_0x65ce('0x2a')](_0x9afe97)[_0x65ce('0x19')](function(_0x5b74fa){_0x4c911d[_0x65ce('0x2a')]=_0x5b74fa;if(_0x19a3ea[_0x65ce('0x3b')][_0x65ce('0x4b')]){_0x4c5016[_0x65ce('0x4c')]=[{'all':!![]}];}return db[_0x65ce('0x35')][_0x65ce('0x4d')](_0x4c5016);})['then'](function(_0x3c6ccb){_0x4c911d['rows']=_0x3c6ccb;return _0x4c911d;})[_0x65ce('0x19')](respondWithFilteredResult(_0x5f1b27,_0x4c5016))[_0x65ce('0x4e')](handleError(_0x5f1b27,null));};exports[_0x65ce('0x4f')]=function(_0x1c6336,_0x4600b2){var _0x48929e={'raw':![],'where':{'id':_0x1c6336['params']['id']}},_0x32fada={};_0x32fada['model']=_[_0x65ce('0x50')](db[_0x65ce('0x35')][_0x65ce('0x36')]);_0x32fada[_0x65ce('0x3b')]=_['keys'](_0x1c6336[_0x65ce('0x3b')]);_0x32fada['filters']=_[_0x65ce('0x3c')](_0x32fada['model'],_0x32fada[_0x65ce('0x3b')]);_0x48929e[_0x65ce('0x3d')]=_[_0x65ce('0x3c')](_0x32fada[_0x65ce('0x39')],qs[_0x65ce('0x3e')](_0x1c6336['query'][_0x65ce('0x3e')]));_0x48929e['attributes']=_0x48929e[_0x65ce('0x3d')]['length']?_0x48929e[_0x65ce('0x3d')]:_0x32fada[_0x65ce('0x39')];if(_0x1c6336[_0x65ce('0x3b')]['includeAll']){_0x48929e['include']=[{'all':!![]}];}_0x48929e=_[_0x65ce('0x46')]({},_0x48929e,_0x1c6336[_0x65ce('0x4a')]);return db[_0x65ce('0x35')]['find'](_0x48929e)[_0x65ce('0x19')](handleEntityNotFound(_0x4600b2,null))[_0x65ce('0x19')](respondWithResult(_0x4600b2,null))[_0x65ce('0x4e')](handleError(_0x4600b2,null));};exports[_0x65ce('0x30')]=function(_0x458297,_0x8e548c){if(_0x458297[_0x65ce('0x51')]['id']){delete _0x458297[_0x65ce('0x51')]['id'];}return db['Setting'][_0x65ce('0x52')]({'where':{'id':_0x458297[_0x65ce('0x53')]['id']}})['then'](handleEntityNotFound(_0x8e548c,null))['then'](saveUpdates(_0x458297[_0x65ce('0x51')],null))['then'](respondWithResult(_0x8e548c,null))[_0x65ce('0x4e')](handleError(_0x8e548c,null));};exports[_0x65ce('0x54')]=function(_0x58dd25,_0x1d3289,_0x3fc2a1){if(_0x58dd25['file']&&_0x58dd25[_0x65ce('0x55')][_0x65ce('0x56')]){_0x58dd25[_0x65ce('0x51')][_0x65ce('0x57')]=_0x58dd25[_0x65ce('0x55')][_0x65ce('0x56')];}return db[_0x65ce('0x35')][_0x65ce('0x52')]({'where':{'id':_0x58dd25[_0x65ce('0x53')]['id']}})[_0x65ce('0x19')](handleEntityNotFound(_0x1d3289,null))[_0x65ce('0x19')](saveUpdates(_0x58dd25[_0x65ce('0x51')],null))['then'](respondWithResult(_0x1d3289,null))[_0x65ce('0x4e')](handleError(_0x1d3289,null));};exports[_0x65ce('0x58')]=function(_0xdeb6f,_0x5635fb,_0x6b54ed){if(_0xdeb6f[_0x65ce('0x55')]&&_0xdeb6f[_0x65ce('0x55')][_0x65ce('0x56')]){_0xdeb6f[_0x65ce('0x51')][_0x65ce('0x59')]=_0xdeb6f['file']['filename'];}return db[_0x65ce('0x35')][_0x65ce('0x52')]({'where':{'id':_0xdeb6f[_0x65ce('0x53')]['id']}})[_0x65ce('0x19')](handleEntityNotFound(_0x5635fb,null))[_0x65ce('0x19')](saveUpdates(_0xdeb6f[_0x65ce('0x51')],null))['then'](respondWithResult(_0x5635fb,null))['catch'](handleError(_0x5635fb,null));};var utilLicense=require(_0x65ce('0x5a'));exports['getLogo']=function(_0x15c3db,_0x371bd9,_0x5e8821){var _0x599935=_0x65ce('0x5b');var _0x1693c6={'custom':![]};return utilLicense['getLicense']()[_0x65ce('0x19')](function(_0x242ca1){if(_0x242ca1){_0x1693c6=_0x242ca1;}return db['Setting'][_0x65ce('0x52')]({'where':{'id':_0x15c3db[_0x65ce('0x53')]['id']},'attributes':[_0x65ce('0x57'),_0x65ce('0x59'),_0x65ce('0x5c'),_0x65ce('0x5d'),_0x65ce('0x5e'),'defaultLoginLogo',_0x65ce('0x5f'),_0x65ce('0x60')],'raw':!![]});})[_0x65ce('0x19')](handleEntityNotFound(_0x371bd9,null))[_0x65ce('0x19')](function(_0x300a12){if(_0x300a12){var _0x264fdf=_0x300a12[_0x65ce('0x57')]&&fs[_0x65ce('0x61')](path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x599935,_['toLower'](_0x300a12['logo'])))?path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x599935,_[_0x65ce('0x64')](_0x300a12['logo'])):path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x599935,_[_0x65ce('0x64')](_0x65ce('0x65')));var _0x738ccd=_0x65ce('0x66')+_[_0x65ce('0x67')](_0x65ce('0x57'));if(_0x300a12[_0x738ccd]||!_0x1693c6[_0x65ce('0x68')]){_0x264fdf=path['join'](config[_0x65ce('0x63')],_0x599935,_[_0x65ce('0x64')](_0x65ce('0x65')));}if(!fs[_0x65ce('0x61')](_0x264fdf)){throw new db[(_0x65ce('0x69'))][(_0x65ce('0x6a'))](_[_0x65ce('0x67')]('logo')+_0x65ce('0x6b'));}return _0x371bd9[_0x65ce('0x6c')](_0x264fdf);}})[_0x65ce('0x4e')](handleError(_0x371bd9,null));};var utilLicense=require(_0x65ce('0x5a'));exports[_0x65ce('0x6d')]=function(_0x257824,_0x5025e4,_0x24b155){var _0x9cdd0f=_0x65ce('0x5b');var _0x3ef15a={'custom':![]};return utilLicense['getLicense']()[_0x65ce('0x19')](function(_0x48d271){if(_0x48d271){_0x3ef15a=_0x48d271;}return db['Setting'][_0x65ce('0x52')]({'where':{'id':_0x257824[_0x65ce('0x53')]['id']},'attributes':['logo',_0x65ce('0x59'),_0x65ce('0x5c'),_0x65ce('0x5d'),_0x65ce('0x5e'),_0x65ce('0x6e'),_0x65ce('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5025e4,null))[_0x65ce('0x19')](function(_0x1f805a){if(_0x1f805a){var _0x31bc4d=_0x1f805a[_0x65ce('0x59')]&&fs['existsSync'](path['join'](config['root'],_0x9cdd0f,_['toLower'](_0x1f805a['loginLogo'])))?path['join'](config['root'],_0x9cdd0f,_[_0x65ce('0x64')](_0x1f805a['loginLogo'])):path[_0x65ce('0x62')](config['root'],_0x9cdd0f,_[_0x65ce('0x64')]('default_loginLogo.svg'));var _0x9bf6ba='default'+_[_0x65ce('0x67')](_0x65ce('0x59'));if(_0x1f805a[_0x9bf6ba]||!_0x3ef15a[_0x65ce('0x68')]){_0x31bc4d=path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x9cdd0f,_[_0x65ce('0x64')](_0x65ce('0x6f')));}if(!fs[_0x65ce('0x61')](_0x31bc4d)){throw new db[(_0x65ce('0x69'))][(_0x65ce('0x6a'))](_[_0x65ce('0x67')](_0x65ce('0x59'))+'\x20not\x20found');}return _0x5025e4[_0x65ce('0x6c')](_0x31bc4d);}})[_0x65ce('0x4e')](handleError(_0x5025e4,null));};exports[_0x65ce('0x70')]=function(_0x3ac1a9,_0x34e7b2){return db[_0x65ce('0x35')]['find']({'where':{'id':_0x3ac1a9[_0x65ce('0x53')]['id']},'attributes':[_0x65ce('0x71')]})[_0x65ce('0x19')](respondWithResult(_0x34e7b2,null))[_0x65ce('0x4e')](handleError(_0x34e7b2,null));};exports[_0x65ce('0x72')]=function(_0x9c17dd,_0x99b575,_0xe76296){if(_0x9c17dd[_0x65ce('0x55')]&&_0x9c17dd[_0x65ce('0x55')][_0x65ce('0x56')]){_0x9c17dd['body'][_0x65ce('0x5c')]=_0x9c17dd[_0x65ce('0x55')]['filename'];}return db['Setting'][_0x65ce('0x52')]({'where':{'id':_0x9c17dd[_0x65ce('0x53')]['id']}})[_0x65ce('0x19')](handleEntityNotFound(_0x99b575,null))[_0x65ce('0x19')](saveUpdates(_0x9c17dd['body'],null))[_0x65ce('0x19')](respondWithResult(_0x99b575,null))[_0x65ce('0x4e')](handleError(_0x99b575,null));};var utilLicense=require(_0x65ce('0x5a'));exports[_0x65ce('0x73')]=function(_0x26d5de,_0x57d62d,_0xcb1c1f){var _0x6b2fe=_0x65ce('0x5b');var _0x41f958={'custom':![]};return utilLicense[_0x65ce('0x74')]()[_0x65ce('0x19')](function(_0x412332){if(_0x412332){_0x41f958=_0x412332;}return db['Setting'][_0x65ce('0x52')]({'where':{'id':_0x26d5de[_0x65ce('0x53')]['id']},'attributes':['logo',_0x65ce('0x59'),_0x65ce('0x5c'),_0x65ce('0x5d'),_0x65ce('0x5e'),_0x65ce('0x6e'),'defaultPreferred',_0x65ce('0x60')],'raw':!![]});})[_0x65ce('0x19')](handleEntityNotFound(_0x57d62d,null))[_0x65ce('0x19')](function(_0x4e6619){if(_0x4e6619){var _0x2744df=_0x4e6619[_0x65ce('0x5c')]&&fs[_0x65ce('0x61')](path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x6b2fe,_[_0x65ce('0x64')](_0x4e6619[_0x65ce('0x5c')])))?path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x6b2fe,_[_0x65ce('0x64')](_0x4e6619[_0x65ce('0x5c')])):path[_0x65ce('0x62')](config['root'],_0x6b2fe,_['toLower'](_0x65ce('0x75')));var _0x3be716=_0x65ce('0x66')+_[_0x65ce('0x67')](_0x65ce('0x5c'));if(_0x4e6619[_0x3be716]||!_0x41f958[_0x65ce('0x68')]||!_0x41f958[_0x65ce('0x5c')]){_0x2744df=path[_0x65ce('0x62')](config['root'],_0x6b2fe,_[_0x65ce('0x64')](_0x65ce('0x75')));}if(!fs[_0x65ce('0x61')](_0x2744df)){throw new db[(_0x65ce('0x69'))][(_0x65ce('0x6a'))](_['upperFirst']('preferred')+'\x20not\x20found');}return _0x57d62d[_0x65ce('0x6c')](_0x2744df);}})[_0x65ce('0x4e')](handleError(_0x57d62d,null));};exports[_0x65ce('0x76')]=function(_0x2d5010,_0x2fae64,_0x1bd02e){if(_0x2d5010[_0x65ce('0x55')]&&_0x2d5010[_0x65ce('0x55')][_0x65ce('0x56')]){_0x2d5010[_0x65ce('0x51')]['favicon']=_0x2d5010[_0x65ce('0x55')][_0x65ce('0x56')];}return db[_0x65ce('0x35')]['find']({'where':{'id':_0x2d5010['params']['id']}})['then'](handleEntityNotFound(_0x2fae64,null))[_0x65ce('0x19')](saveUpdates(_0x2d5010['body'],null))[_0x65ce('0x19')](respondWithResult(_0x2fae64,null))['catch'](handleError(_0x2fae64,null));};var utilLicense=require(_0x65ce('0x5a'));exports[_0x65ce('0x77')]=function(_0x5bb1f6,_0x132d55,_0x51c0b4){var _0x3a3822=_0x65ce('0x5b');var _0xf2e424={'custom':![]};return utilLicense[_0x65ce('0x74')]()[_0x65ce('0x19')](function(_0x35b6de){if(_0x35b6de){_0xf2e424=_0x35b6de;}return db['Setting'][_0x65ce('0x52')]({'where':{'id':_0x5bb1f6['params']['id']},'attributes':['logo',_0x65ce('0x59'),_0x65ce('0x5c'),_0x65ce('0x5d'),_0x65ce('0x5e'),_0x65ce('0x6e'),_0x65ce('0x5f'),_0x65ce('0x60')],'raw':!![]});})[_0x65ce('0x19')](handleEntityNotFound(_0x132d55,null))[_0x65ce('0x19')](function(_0x1d3f8e){if(_0x1d3f8e){var _0x20d5c7=_0x1d3f8e[_0x65ce('0x5d')]&&fs['existsSync'](path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x3a3822,_[_0x65ce('0x64')](_0x1d3f8e[_0x65ce('0x5d')])))?path[_0x65ce('0x62')](config['root'],_0x3a3822,_['toLower'](_0x1d3f8e[_0x65ce('0x5d')])):path['join'](config[_0x65ce('0x63')],_0x3a3822,_['toLower'](_0x65ce('0x78')));var _0x3fcb9f=_0x65ce('0x66')+_[_0x65ce('0x67')](_0x65ce('0x5d'));if(_0x1d3f8e[_0x3fcb9f]||!_0xf2e424[_0x65ce('0x68')]){_0x20d5c7=path[_0x65ce('0x62')](config[_0x65ce('0x63')],_0x3a3822,_[_0x65ce('0x64')]('default_favicon.ico'));}if(!fs[_0x65ce('0x61')](_0x20d5c7)){throw new db[(_0x65ce('0x69'))][(_0x65ce('0x6a'))](_[_0x65ce('0x67')](_0x65ce('0x5d'))+_0x65ce('0x6b'));}return _0x132d55[_0x65ce('0x6c')](_0x20d5c7);}})[_0x65ce('0x4e')](handleError(_0x132d55,null));};exports['getDate']=function(_0x48bb50,_0x46d53b){var _0x4c3d31={'offset':moment()[_0x65ce('0x79')]()};_0x4c3d31[_0x65ce('0x7a')]=moment()['utcOffset'](_0x4c3d31[_0x65ce('0x2b')])['format'](_0x65ce('0x7b'));return _0x46d53b['status'](0xc8)[_0x65ce('0x7c')](_0x4c3d31);}; \ No newline at end of file +var _0x1a8f=['default','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','defaultPreferred','default_loginLogo.svg','download','securePassword','getPreferred','default_preferred.png','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','Setting','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','body','file','filename','loginLogo','../../config/license/util','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','logo','join','root','toLower'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x1a8f,0x87));var _0xf1a8=function(_0x117ab9,_0x45c7b6){_0x117ab9=_0x117ab9-0x0;var _0x258a48=_0x1a8f[_0x117ab9];return _0x258a48;};'use strict';var emlformat=require(_0xf1a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1a8('0x1'));var jsonpatch=require(_0xf1a8('0x2'));var rp=require(_0xf1a8('0x3'));var moment=require(_0xf1a8('0x4'));var BPromise=require(_0xf1a8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf1a8('0x6'));var ejs=require(_0xf1a8('0x7'));var fs=require('fs');var fs_extra=require(_0xf1a8('0x8'));var _=require('lodash');var squel=require(_0xf1a8('0x9'));var crypto=require('crypto');var jsforce=require(_0xf1a8('0xa'));var deskjs=require(_0xf1a8('0xb'));var toCsv=require(_0xf1a8('0x6'));var querystring=require('querystring');var Papa=require(_0xf1a8('0xc'));var Redis=require('ioredis');var authService=require(_0xf1a8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf1a8('0xe'));var hardwareService=require(_0xf1a8('0xf'));var logger=require(_0xf1a8('0x10'))(_0xf1a8('0x11'));var utils=require('../../config/utils');var config=require(_0xf1a8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1a8('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf1a8('0x14')][_0xf1a8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0xf9f63,_0x1ad08f,_0x2d0965,_0x292f03){return new BPromise(function(_0x4fbba7,_0x3c1d43){var _0x7438a7=_0x292f03||client;return _0x7438a7['request'](_0xf9f63,_0x2d0965)[_0xf1a8('0x16')](function(_0x3efcf1){logger[_0xf1a8('0x17')](_0xf1a8('0x18'),_0x1ad08f,_0xf1a8('0x19'));logger[_0xf1a8('0x1a')](_0xf1a8('0x1b'),_0x1ad08f,_0xf1a8('0x19'),JSON[_0xf1a8('0x1c')](_0x3efcf1));if(_0x3efcf1[_0xf1a8('0x1d')]){if(_0x3efcf1[_0xf1a8('0x1d')][_0xf1a8('0x1e')]===0x1f4){logger[_0xf1a8('0x1d')]('Setting,\x20%s,\x20%s',_0x1ad08f,_0x3efcf1[_0xf1a8('0x1d')][_0xf1a8('0x1f')]);return _0x3c1d43(_0x3efcf1[_0xf1a8('0x1d')][_0xf1a8('0x1f')]);}logger[_0xf1a8('0x1d')]('Setting,\x20%s,\x20%s',_0x1ad08f,_0x3efcf1[_0xf1a8('0x1d')]['message']);return _0x4fbba7(_0x3efcf1[_0xf1a8('0x1d')][_0xf1a8('0x1f')]);}else{logger[_0xf1a8('0x17')](_0xf1a8('0x18'),_0x1ad08f,_0xf1a8('0x19'));_0x4fbba7(_0x3efcf1[_0xf1a8('0x20')][_0xf1a8('0x1f')]);}})[_0xf1a8('0x21')](function(_0x5745a5){logger[_0xf1a8('0x1d')](_0xf1a8('0x18'),_0x1ad08f,_0x5745a5);_0x3c1d43(_0x5745a5);});});}function respondWithStatusCode(_0x1fa221,_0x7ba846){_0x7ba846=_0x7ba846||0xcc;return function(_0x346701){if(_0x346701){return _0x1fa221['sendStatus'](_0x7ba846);}return _0x1fa221[_0xf1a8('0x22')](_0x7ba846)[_0xf1a8('0x23')]();};}function respondWithResult(_0x20c3b2,_0x25c04e){_0x25c04e=_0x25c04e||0xc8;return function(_0x4b90a5){if(_0x4b90a5){return _0x20c3b2[_0xf1a8('0x22')](_0x25c04e)['json'](_0x4b90a5);}};}function respondWithFilteredResult(_0x2cd602,_0xd75dfb){return function(_0x2903c8){if(_0x2903c8){var _0x5ef78e=typeof _0xd75dfb['offset']===_0xf1a8('0x24')&&typeof _0xd75dfb[_0xf1a8('0x25')]===_0xf1a8('0x24');var _0x53e500=_0x2903c8[_0xf1a8('0x26')];var _0x4deba8=_0x5ef78e?0x0:_0xd75dfb[_0xf1a8('0x27')];var _0x1acbba=_0x5ef78e?_0x2903c8['count']:_0xd75dfb[_0xf1a8('0x27')]+_0xd75dfb['limit'];var _0x504563;if(_0x1acbba>=_0x53e500){_0x1acbba=_0x53e500;_0x504563=0xc8;}else{_0x504563=0xce;}_0x2cd602[_0xf1a8('0x22')](_0x504563);return _0x2cd602[_0xf1a8('0x28')](_0xf1a8('0x29'),_0x4deba8+'-'+_0x1acbba+'/'+_0x53e500)['json'](_0x2903c8);}return null;};}function patchUpdates(_0x321a9b){return function(_0x327f16){try{jsonpatch[_0xf1a8('0x2a')](_0x327f16,_0x321a9b,!![]);}catch(_0x550b5a){return BPromise[_0xf1a8('0x2b')](_0x550b5a);}return _0x327f16[_0xf1a8('0x2c')]();};}function saveUpdates(_0x262ebb,_0x3eaca9){return function(_0x3cb923){if(_0x3cb923){return _0x3cb923[_0xf1a8('0x2d')](_0x262ebb)[_0xf1a8('0x16')](function(_0x16b753){return _0x16b753;});}return null;};}function removeEntity(_0x29d3e1,_0x2c0382){return function(_0x5e4480){if(_0x5e4480){return _0x5e4480[_0xf1a8('0x2e')]()[_0xf1a8('0x16')](function(){_0x29d3e1[_0xf1a8('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53788e,_0x12ce19){return function(_0x37826c){if(!_0x37826c){_0x53788e[_0xf1a8('0x2f')](0x194);}return _0x37826c;};}function handleError(_0x3c6aab,_0x449ac1){_0x449ac1=_0x449ac1||0x1f4;return function(_0x4c4088){logger[_0xf1a8('0x1d')](_0x4c4088['stack']);if(_0x4c4088[_0xf1a8('0x30')]){delete _0x4c4088[_0xf1a8('0x30')];}_0x3c6aab['status'](_0x449ac1)[_0xf1a8('0x31')](_0x4c4088);};}exports[_0xf1a8('0x32')]=function(_0xcafda3,_0x3442d5){var _0x27051d={},_0x3db203={},_0x5bf98c={'count':0x0,'rows':[]};var _0x245023=_[_0xf1a8('0x33')](db[_0xf1a8('0x34')]['rawAttributes'],function(_0x1282de){return{'name':_0x1282de[_0xf1a8('0x35')],'type':_0x1282de['type'][_0xf1a8('0x36')]};});_0x3db203[_0xf1a8('0x37')]=_['map'](_0x245023,_0xf1a8('0x30'));_0x3db203[_0xf1a8('0x38')]=_['keys'](_0xcafda3[_0xf1a8('0x38')]);_0x3db203[_0xf1a8('0x39')]=_[_0xf1a8('0x3a')](_0x3db203[_0xf1a8('0x37')],_0x3db203['query']);_0x27051d[_0xf1a8('0x3b')]=_[_0xf1a8('0x3a')](_0x3db203['model'],qs[_0xf1a8('0x3c')](_0xcafda3['query'][_0xf1a8('0x3c')]));_0x27051d[_0xf1a8('0x3b')]=_0x27051d['attributes'][_0xf1a8('0x3d')]?_0x27051d[_0xf1a8('0x3b')]:_0x3db203[_0xf1a8('0x37')];if(!_0xcafda3[_0xf1a8('0x38')][_0xf1a8('0x3e')](_0xf1a8('0x3f'))){_0x27051d['limit']=qs[_0xf1a8('0x25')](_0xcafda3['query'][_0xf1a8('0x25')]);_0x27051d[_0xf1a8('0x27')]=qs[_0xf1a8('0x27')](_0xcafda3['query'][_0xf1a8('0x27')]);}_0x27051d[_0xf1a8('0x40')]=qs[_0xf1a8('0x41')](_0xcafda3[_0xf1a8('0x38')][_0xf1a8('0x41')]);_0x27051d[_0xf1a8('0x42')]=qs['filters'](_[_0xf1a8('0x43')](_0xcafda3['query'],_0x3db203[_0xf1a8('0x39')]),_0x245023);if(_0xcafda3[_0xf1a8('0x38')][_0xf1a8('0x44')]){_0x27051d[_0xf1a8('0x42')]=_[_0xf1a8('0x45')](_0x27051d[_0xf1a8('0x42')],{'$or':_[_0xf1a8('0x33')](_0x245023,function(_0x4631c2){if(_0x4631c2[_0xf1a8('0x46')]!==_0xf1a8('0x47')){var _0x1436ea={};_0x1436ea[_0x4631c2[_0xf1a8('0x30')]]={'$like':'%'+_0xcafda3[_0xf1a8('0x38')][_0xf1a8('0x44')]+'%'};return _0x1436ea;}})});}_0x27051d=_[_0xf1a8('0x45')]({},_0x27051d,_0xcafda3[_0xf1a8('0x48')]);var _0x3b0996={'where':_0x27051d[_0xf1a8('0x42')]};return db[_0xf1a8('0x34')]['count'](_0x3b0996)[_0xf1a8('0x16')](function(_0x4b0ef8){_0x5bf98c[_0xf1a8('0x26')]=_0x4b0ef8;if(_0xcafda3[_0xf1a8('0x38')][_0xf1a8('0x49')]){_0x27051d[_0xf1a8('0x4a')]=[{'all':!![]}];}return db['Setting'][_0xf1a8('0x4b')](_0x27051d);})[_0xf1a8('0x16')](function(_0x2da253){_0x5bf98c['rows']=_0x2da253;return _0x5bf98c;})[_0xf1a8('0x16')](respondWithFilteredResult(_0x3442d5,_0x27051d))[_0xf1a8('0x21')](handleError(_0x3442d5,null));};exports[_0xf1a8('0x4c')]=function(_0x12e870,_0x44c330){var _0xf69e59={'raw':![],'where':{'id':_0x12e870[_0xf1a8('0x4d')]['id']}},_0x31c05b={};_0x31c05b[_0xf1a8('0x37')]=_[_0xf1a8('0x4e')](db['Setting'][_0xf1a8('0x4f')]);_0x31c05b[_0xf1a8('0x38')]=_['keys'](_0x12e870[_0xf1a8('0x38')]);_0x31c05b[_0xf1a8('0x39')]=_[_0xf1a8('0x3a')](_0x31c05b[_0xf1a8('0x37')],_0x31c05b[_0xf1a8('0x38')]);_0xf69e59[_0xf1a8('0x3b')]=_[_0xf1a8('0x3a')](_0x31c05b[_0xf1a8('0x37')],qs[_0xf1a8('0x3c')](_0x12e870['query'][_0xf1a8('0x3c')]));_0xf69e59[_0xf1a8('0x3b')]=_0xf69e59[_0xf1a8('0x3b')]['length']?_0xf69e59['attributes']:_0x31c05b['model'];if(_0x12e870['query'][_0xf1a8('0x49')]){_0xf69e59[_0xf1a8('0x4a')]=[{'all':!![]}];}_0xf69e59=_[_0xf1a8('0x45')]({},_0xf69e59,_0x12e870[_0xf1a8('0x48')]);return db[_0xf1a8('0x34')][_0xf1a8('0x50')](_0xf69e59)[_0xf1a8('0x16')](handleEntityNotFound(_0x44c330,null))[_0xf1a8('0x16')](respondWithResult(_0x44c330,null))[_0xf1a8('0x21')](handleError(_0x44c330,null));};exports['update']=function(_0x232584,_0x386ac8){if(_0x232584['body']['id']){delete _0x232584[_0xf1a8('0x51')]['id'];}return db['Setting'][_0xf1a8('0x50')]({'where':{'id':_0x232584[_0xf1a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x386ac8,null))[_0xf1a8('0x16')](saveUpdates(_0x232584[_0xf1a8('0x51')],null))[_0xf1a8('0x16')](respondWithResult(_0x386ac8,null))['catch'](handleError(_0x386ac8,null));};exports['addLogo']=function(_0x21e80b,_0x2beeb8,_0x1ddb34){if(_0x21e80b[_0xf1a8('0x52')]&&_0x21e80b[_0xf1a8('0x52')]['filename']){_0x21e80b[_0xf1a8('0x51')]['logo']=_0x21e80b[_0xf1a8('0x52')][_0xf1a8('0x53')];}return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x21e80b[_0xf1a8('0x4d')]['id']}})[_0xf1a8('0x16')](handleEntityNotFound(_0x2beeb8,null))[_0xf1a8('0x16')](saveUpdates(_0x21e80b[_0xf1a8('0x51')],null))[_0xf1a8('0x16')](respondWithResult(_0x2beeb8,null))[_0xf1a8('0x21')](handleError(_0x2beeb8,null));};exports['addLogoLogin']=function(_0x4c4bbc,_0x29e2c8,_0x17d7ee){if(_0x4c4bbc[_0xf1a8('0x52')]&&_0x4c4bbc['file']['filename']){_0x4c4bbc[_0xf1a8('0x51')][_0xf1a8('0x54')]=_0x4c4bbc[_0xf1a8('0x52')]['filename'];}return db['Setting']['find']({'where':{'id':_0x4c4bbc['params']['id']}})[_0xf1a8('0x16')](handleEntityNotFound(_0x29e2c8,null))[_0xf1a8('0x16')](saveUpdates(_0x4c4bbc[_0xf1a8('0x51')],null))['then'](respondWithResult(_0x29e2c8,null))['catch'](handleError(_0x29e2c8,null));};var utilLicense=require(_0xf1a8('0x55'));exports['getLogo']=function(_0x50b178,_0x1502c3,_0x4adc67){var _0x36dc45=_0xf1a8('0x56');var _0x513526={'custom':![]};return utilLicense[_0xf1a8('0x57')]()[_0xf1a8('0x16')](function(_0x2ccbb7){if(_0x2ccbb7){_0x513526=_0x2ccbb7;}return db['Setting']['find']({'where':{'id':_0x50b178[_0xf1a8('0x4d')]['id']},'attributes':['logo',_0xf1a8('0x54'),_0xf1a8('0x58'),_0xf1a8('0x59'),_0xf1a8('0x5a'),_0xf1a8('0x5b'),'defaultPreferred',_0xf1a8('0x5c')],'raw':!![]});})[_0xf1a8('0x16')](handleEntityNotFound(_0x1502c3,null))[_0xf1a8('0x16')](function(_0x2ee0a5){if(_0x2ee0a5){var _0x38f22f=_0x2ee0a5[_0xf1a8('0x5d')]&&fs['existsSync'](path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x36dc45,_[_0xf1a8('0x60')](_0x2ee0a5[_0xf1a8('0x5d')])))?path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x36dc45,_[_0xf1a8('0x60')](_0x2ee0a5[_0xf1a8('0x5d')])):path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x36dc45,_[_0xf1a8('0x60')]('default_logo.svg'));var _0x2df771=_0xf1a8('0x61')+_[_0xf1a8('0x62')](_0xf1a8('0x5d'));if(_0x2ee0a5[_0x2df771]||!_0x513526[_0xf1a8('0x63')]){_0x38f22f=path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x36dc45,_['toLower']('default_logo.svg'));}if(!fs[_0xf1a8('0x64')](_0x38f22f)){throw new db[(_0xf1a8('0x65'))][(_0xf1a8('0x66'))](_[_0xf1a8('0x62')](_0xf1a8('0x5d'))+_0xf1a8('0x67'));}return _0x1502c3['download'](_0x38f22f);}})['catch'](handleError(_0x1502c3,null));};var utilLicense=require(_0xf1a8('0x55'));exports[_0xf1a8('0x68')]=function(_0x5df52d,_0x212859,_0x39ee89){var _0x3cd3f2=_0xf1a8('0x56');var _0x458daf={'custom':![]};return utilLicense[_0xf1a8('0x57')]()[_0xf1a8('0x16')](function(_0x1614fb){if(_0x1614fb){_0x458daf=_0x1614fb;}return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x5df52d[_0xf1a8('0x4d')]['id']},'attributes':[_0xf1a8('0x5d'),_0xf1a8('0x54'),'preferred',_0xf1a8('0x59'),'defaultLogo','defaultLoginLogo',_0xf1a8('0x69'),_0xf1a8('0x5c')],'raw':!![]});})[_0xf1a8('0x16')](handleEntityNotFound(_0x212859,null))['then'](function(_0x1adc62){if(_0x1adc62){var _0x5588bb=_0x1adc62['loginLogo']&&fs[_0xf1a8('0x64')](path['join'](config['root'],_0x3cd3f2,_[_0xf1a8('0x60')](_0x1adc62['loginLogo'])))?path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x3cd3f2,_[_0xf1a8('0x60')](_0x1adc62[_0xf1a8('0x54')])):path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x3cd3f2,_[_0xf1a8('0x60')](_0xf1a8('0x6a')));var _0x129dc7=_0xf1a8('0x61')+_[_0xf1a8('0x62')](_0xf1a8('0x54'));if(_0x1adc62[_0x129dc7]||!_0x458daf['custom']){_0x5588bb=path['join'](config[_0xf1a8('0x5f')],_0x3cd3f2,_[_0xf1a8('0x60')](_0xf1a8('0x6a')));}if(!fs[_0xf1a8('0x64')](_0x5588bb)){throw new db[(_0xf1a8('0x65'))]['ValidationError'](_[_0xf1a8('0x62')](_0xf1a8('0x54'))+_0xf1a8('0x67'));}return _0x212859[_0xf1a8('0x6b')](_0x5588bb);}})['catch'](handleError(_0x212859,null));};exports['gdpr']=function(_0x1f3824,_0x72edba){return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x1f3824['params']['id']},'attributes':[_0xf1a8('0x6c')]})[_0xf1a8('0x16')](respondWithResult(_0x72edba,null))[_0xf1a8('0x21')](handleError(_0x72edba,null));};exports['addPreferred']=function(_0x487969,_0x62d3e1,_0xd05faf){if(_0x487969[_0xf1a8('0x52')]&&_0x487969[_0xf1a8('0x52')][_0xf1a8('0x53')]){_0x487969[_0xf1a8('0x51')][_0xf1a8('0x58')]=_0x487969['file'][_0xf1a8('0x53')];}return db['Setting'][_0xf1a8('0x50')]({'where':{'id':_0x487969[_0xf1a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x62d3e1,null))[_0xf1a8('0x16')](saveUpdates(_0x487969['body'],null))[_0xf1a8('0x16')](respondWithResult(_0x62d3e1,null))[_0xf1a8('0x21')](handleError(_0x62d3e1,null));};var utilLicense=require(_0xf1a8('0x55'));exports[_0xf1a8('0x6d')]=function(_0x15649f,_0x23cc62,_0x5965fa){var _0x3af564=_0xf1a8('0x56');var _0x9c8e04={'custom':![]};return utilLicense[_0xf1a8('0x57')]()['then'](function(_0x52da85){if(_0x52da85){_0x9c8e04=_0x52da85;}return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x15649f[_0xf1a8('0x4d')]['id']},'attributes':[_0xf1a8('0x5d'),'loginLogo',_0xf1a8('0x58'),_0xf1a8('0x59'),_0xf1a8('0x5a'),_0xf1a8('0x5b'),_0xf1a8('0x69'),_0xf1a8('0x5c')],'raw':!![]});})[_0xf1a8('0x16')](handleEntityNotFound(_0x23cc62,null))[_0xf1a8('0x16')](function(_0xf3dc67){if(_0xf3dc67){var _0x4149ed=_0xf3dc67[_0xf1a8('0x58')]&&fs['existsSync'](path['join'](config['root'],_0x3af564,_['toLower'](_0xf3dc67[_0xf1a8('0x58')])))?path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x3af564,_['toLower'](_0xf3dc67[_0xf1a8('0x58')])):path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x3af564,_[_0xf1a8('0x60')](_0xf1a8('0x6e')));var _0x52654f=_0xf1a8('0x61')+_['upperFirst'](_0xf1a8('0x58'));if(_0xf3dc67[_0x52654f]||!_0x9c8e04[_0xf1a8('0x63')]||!_0x9c8e04[_0xf1a8('0x58')]){_0x4149ed=path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x3af564,_[_0xf1a8('0x60')]('default_preferred.png'));}if(!fs['existsSync'](_0x4149ed)){throw new db[(_0xf1a8('0x65'))]['ValidationError'](_['upperFirst'](_0xf1a8('0x58'))+_0xf1a8('0x67'));}return _0x23cc62['download'](_0x4149ed);}})[_0xf1a8('0x21')](handleError(_0x23cc62,null));};exports['addFavicon']=function(_0xc5cee3,_0x5f1fff,_0x22df53){if(_0xc5cee3[_0xf1a8('0x52')]&&_0xc5cee3['file'][_0xf1a8('0x53')]){_0xc5cee3[_0xf1a8('0x51')][_0xf1a8('0x59')]=_0xc5cee3[_0xf1a8('0x52')][_0xf1a8('0x53')];}return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0xc5cee3[_0xf1a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f1fff,null))[_0xf1a8('0x16')](saveUpdates(_0xc5cee3[_0xf1a8('0x51')],null))['then'](respondWithResult(_0x5f1fff,null))[_0xf1a8('0x21')](handleError(_0x5f1fff,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x3d67b6,_0x5e00ac,_0x489230){var _0x138ba3=_0xf1a8('0x56');var _0x383ec4={'custom':![]};return utilLicense[_0xf1a8('0x57')]()[_0xf1a8('0x16')](function(_0x42e127){if(_0x42e127){_0x383ec4=_0x42e127;}return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x3d67b6[_0xf1a8('0x4d')]['id']},'attributes':[_0xf1a8('0x5d'),_0xf1a8('0x54'),_0xf1a8('0x58'),_0xf1a8('0x59'),_0xf1a8('0x5a'),'defaultLoginLogo',_0xf1a8('0x69'),_0xf1a8('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x5e00ac,null))[_0xf1a8('0x16')](function(_0x41f595){if(_0x41f595){var _0x5ab8dc=_0x41f595['favicon']&&fs[_0xf1a8('0x64')](path[_0xf1a8('0x5e')](config['root'],_0x138ba3,_['toLower'](_0x41f595[_0xf1a8('0x59')])))?path[_0xf1a8('0x5e')](config['root'],_0x138ba3,_['toLower'](_0x41f595['favicon'])):path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x138ba3,_[_0xf1a8('0x60')]('default_favicon.ico'));var _0x4aa744=_0xf1a8('0x61')+_[_0xf1a8('0x62')](_0xf1a8('0x59'));if(_0x41f595[_0x4aa744]||!_0x383ec4[_0xf1a8('0x63')]){_0x5ab8dc=path[_0xf1a8('0x5e')](config[_0xf1a8('0x5f')],_0x138ba3,_[_0xf1a8('0x60')](_0xf1a8('0x6f')));}if(!fs[_0xf1a8('0x64')](_0x5ab8dc)){throw new db[(_0xf1a8('0x65'))][(_0xf1a8('0x66'))](_[_0xf1a8('0x62')]('favicon')+_0xf1a8('0x67'));}return _0x5e00ac[_0xf1a8('0x6b')](_0x5ab8dc);}})[_0xf1a8('0x21')](handleError(_0x5e00ac,null));};exports['getDate']=function(_0x579a26,_0x4d5415){var _0x464e31={'offset':moment()[_0xf1a8('0x70')]()};_0x464e31[_0xf1a8('0x71')]=moment()[_0xf1a8('0x70')](_0x464e31['offset'])[_0xf1a8('0x72')](_0xf1a8('0x73'));return _0x4d5415[_0xf1a8('0x22')](0xc8)[_0xf1a8('0x31')](_0x464e31);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 893a47c..c6370e5 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x27664c,_0x3c179c){var _0x35b5b6=function(_0x42a0b6){while(--_0x42a0b6){_0x27664c['push'](_0x27664c['shift']());}};_0x35b5b6(++_0x3c179c);}(_0xe14b,0x93));var _0xbe14=function(_0x143aab,_0x4f71b2){_0x143aab=_0x143aab-0x0;var _0x3eecf1=_0xe14b[_0x143aab];return _0x3eecf1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x55ca,0x126));var _0xa55c=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0x55ca[_0x1709e7];return _0x402819;};'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 05f19c0..6cd6a47 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 _0x5714=['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','Setting','options','raw','attributes','include','map','model','ShowSetting','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x37b004,_0x52d4b7){var _0x180d3d=function(_0x2cbaeb){while(--_0x2cbaeb){_0x37b004['push'](_0x37b004['shift']());}};_0x180d3d(++_0x52d4b7);}(_0x5714,0x1c8));var _0x4571=function(_0x211c49,_0x34659b){_0x211c49=_0x211c49-0x0;var _0x9f9a59=_0x5714[_0x211c49];return _0x9f9a59;};'use strict';var _=require('lodash');var util=require(_0x4571('0x0'));var moment=require(_0x4571('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4571('0x2'));var db=require(_0x4571('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4571('0x4'))(_0x4571('0x5'));var config=require(_0x4571('0x6'));var jayson=require(_0x4571('0x7'));var client=jayson[_0x4571('0x8')][_0x4571('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43dcd9,_0x259e7f,_0x158fb4){return new BPromise(function(_0x573f12,_0x1c6b5b){return client[_0x4571('0xa')](_0x43dcd9,_0x158fb4)[_0x4571('0xb')](function(_0x382067){logger[_0x4571('0xc')](_0x4571('0xd'),_0x259e7f,_0x4571('0xe'));logger[_0x4571('0xf')](_0x4571('0x10'),_0x259e7f,_0x4571('0xe'),JSON[_0x4571('0x11')](_0x382067));if(_0x382067[_0x4571('0x12')]){if(_0x382067['error'][_0x4571('0x13')]===0x1f4){logger[_0x4571('0x12')](_0x4571('0xd'),_0x259e7f,_0x382067[_0x4571('0x12')]['message']);return _0x1c6b5b(_0x382067[_0x4571('0x12')][_0x4571('0x14')]);}logger[_0x4571('0x12')](_0x4571('0xd'),_0x259e7f,_0x382067['error']['message']);return _0x573f12(_0x382067[_0x4571('0x12')][_0x4571('0x14')]);}else{logger[_0x4571('0xc')](_0x4571('0xd'),_0x259e7f,_0x4571('0xe'));_0x573f12(_0x382067[_0x4571('0x15')][_0x4571('0x14')]);}})[_0x4571('0x16')](function(_0x5a14d4){logger[_0x4571('0x12')](_0x4571('0xd'),_0x259e7f,_0x5a14d4);_0x1c6b5b(_0x5a14d4);});});}exports['ShowSetting']=function(_0x3f2ab3){var _0x90b9ca=this;return new Promise(function(_0x4f6e87,_0xf9e17d){return db[_0x4571('0x17')]['find']({'raw':_0x3f2ab3[_0x4571('0x18')]?_0x3f2ab3[_0x4571('0x18')][_0x4571('0x19')]===undefined?!![]:![]:!![],'where':_0x3f2ab3[_0x4571('0x18')]?_0x3f2ab3[_0x4571('0x18')]['where']||null:null,'attributes':_0x3f2ab3[_0x4571('0x18')]?_0x3f2ab3[_0x4571('0x18')][_0x4571('0x1a')]||null:null,'include':_0x3f2ab3['options']?_0x3f2ab3['options'][_0x4571('0x1b')]?_[_0x4571('0x1c')](_0x3f2ab3[_0x4571('0x18')][_0x4571('0x1b')],function(_0x2c56e0){return{'model':db[_0x2c56e0[_0x4571('0x1d')]],'as':_0x2c56e0['as'],'attributes':_0x2c56e0[_0x4571('0x1a')],'include':_0x2c56e0[_0x4571('0x1b')]?_['map'](_0x2c56e0[_0x4571('0x1b')],function(_0x13d32d){return{'model':db[_0x13d32d[_0x4571('0x1d')]],'as':_0x13d32d['as'],'attributes':_0x13d32d[_0x4571('0x1a')],'include':_0x13d32d['include']?_[_0x4571('0x1c')](_0x13d32d[_0x4571('0x1b')],function(_0x465995){return{'model':db[_0x465995[_0x4571('0x1d')]],'as':_0x465995['as'],'attributes':_0x465995[_0x4571('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4571('0xb')](function(_0x2de20c){logger['info'](_0x4571('0x1e'),_0x3f2ab3);logger[_0x4571('0xf')](_0x4571('0x1e'),_0x3f2ab3,JSON['stringify'](_0x2de20c));_0x4f6e87(_0x2de20c);})[_0x4571('0x16')](function(_0xb0e68b){logger[_0x4571('0x12')](_0x4571('0x1e'),_0xb0e68b[_0x4571('0x14')],_0x3f2ab3);_0xf9e17d(_0x90b9ca[_0x4571('0x12')](0x1f4,_0xb0e68b[_0x4571('0x14')]));});});}; \ No newline at end of file +var _0x3f21=['model','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','catch','ShowSetting','Setting','find','options','raw','attributes','include','map'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0x3f21,0x1f2));var _0x13f2=function(_0x64276a,_0x1f663b){_0x64276a=_0x64276a-0x0;var _0x4d1ee5=_0x3f21[_0x64276a];return _0x4d1ee5;};'use strict';var _=require(_0x13f2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x13f2('0x1'));var rs=require(_0x13f2('0x2'));var fs=require('fs');var Redis=require(_0x13f2('0x3'));var db=require(_0x13f2('0x4'))['db'];var utils=require(_0x13f2('0x5'));var logger=require(_0x13f2('0x6'))(_0x13f2('0x7'));var config=require('../../config/environment');var jayson=require(_0x13f2('0x8'));var client=jayson[_0x13f2('0x9')][_0x13f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c1103,_0x52abd4,_0x1e05e4){return new BPromise(function(_0x2bc347,_0x1c47cb){return client[_0x13f2('0xb')](_0x3c1103,_0x1e05e4)['then'](function(_0x1d000f){logger[_0x13f2('0xc')]('Setting,\x20%s,\x20%s',_0x52abd4,_0x13f2('0xd'));logger['debug'](_0x13f2('0xe'),_0x52abd4,_0x13f2('0xd'),JSON[_0x13f2('0xf')](_0x1d000f));if(_0x1d000f[_0x13f2('0x10')]){if(_0x1d000f[_0x13f2('0x10')][_0x13f2('0x11')]===0x1f4){logger['error'](_0x13f2('0x12'),_0x52abd4,_0x1d000f[_0x13f2('0x10')][_0x13f2('0x13')]);return _0x1c47cb(_0x1d000f[_0x13f2('0x10')][_0x13f2('0x13')]);}logger[_0x13f2('0x10')](_0x13f2('0x12'),_0x52abd4,_0x1d000f[_0x13f2('0x10')][_0x13f2('0x13')]);return _0x2bc347(_0x1d000f['error'][_0x13f2('0x13')]);}else{logger[_0x13f2('0xc')](_0x13f2('0x12'),_0x52abd4,_0x13f2('0xd'));_0x2bc347(_0x1d000f['result'][_0x13f2('0x13')]);}})[_0x13f2('0x14')](function(_0x444b8b){logger['error'](_0x13f2('0x12'),_0x52abd4,_0x444b8b);_0x1c47cb(_0x444b8b);});});}exports[_0x13f2('0x15')]=function(_0x2202f9){var _0x16c352=this;return new Promise(function(_0x56e4f9,_0x223a1e){return db[_0x13f2('0x16')][_0x13f2('0x17')]({'raw':_0x2202f9[_0x13f2('0x18')]?_0x2202f9['options'][_0x13f2('0x19')]===undefined?!![]:![]:!![],'where':_0x2202f9[_0x13f2('0x18')]?_0x2202f9[_0x13f2('0x18')]['where']||null:null,'attributes':_0x2202f9['options']?_0x2202f9['options'][_0x13f2('0x1a')]||null:null,'include':_0x2202f9[_0x13f2('0x18')]?_0x2202f9['options'][_0x13f2('0x1b')]?_[_0x13f2('0x1c')](_0x2202f9[_0x13f2('0x18')]['include'],function(_0x28a57d){return{'model':db[_0x28a57d[_0x13f2('0x1d')]],'as':_0x28a57d['as'],'attributes':_0x28a57d[_0x13f2('0x1a')],'include':_0x28a57d[_0x13f2('0x1b')]?_[_0x13f2('0x1c')](_0x28a57d[_0x13f2('0x1b')],function(_0x22a502){return{'model':db[_0x22a502[_0x13f2('0x1d')]],'as':_0x22a502['as'],'attributes':_0x22a502['attributes'],'include':_0x22a502[_0x13f2('0x1b')]?_[_0x13f2('0x1c')](_0x22a502[_0x13f2('0x1b')],function(_0x79f134){return{'model':db[_0x79f134[_0x13f2('0x1d')]],'as':_0x79f134['as'],'attributes':_0x79f134[_0x13f2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x13f2('0x1e')](function(_0x3a5405){logger['info']('ShowSetting',_0x2202f9);logger['debug'](_0x13f2('0x15'),_0x2202f9,JSON[_0x13f2('0xf')](_0x3a5405));_0x56e4f9(_0x3a5405);})['catch'](function(_0x2419eb){logger[_0x13f2('0x10')]('ShowSetting',_0x2419eb[_0x13f2('0x13')],_0x2202f9);_0x223a1e(_0x16c352[_0x13f2('0x10')](0x1f4,_0x2419eb[_0x13f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 937e209..4eb5eb8 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7217,0x19e));var _0x7721=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7217[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x31cd79,_0x1a667a){var _0x12d5dd=function(_0x4a60e0){while(--_0x4a60e0){_0x31cd79['push'](_0x31cd79['shift']());}};_0x12d5dd(++_0x1a667a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 5513a27..fcc9bb0 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 _0x2baa=['BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','connectel','plivo','clickatell','csc','infobip','ENUM'];(function(_0x5a64f0,_0x2f411c){var _0xce181f=function(_0x1b7006){while(--_0x1b7006){_0x5a64f0['push'](_0x5a64f0['shift']());}};_0xce181f(++_0x2f411c);}(_0x2baa,0x158));var _0xa2ba=function(_0x43c040,_0x3fe3d7){_0x43c040=_0x43c040-0x0;var _0x280d9e=_0x2baa[_0x43c040];return _0x280d9e;};'use strict';var Sequelize=require(_0xa2ba('0x0'));var rs=require(_0xa2ba('0x1'));module[_0xa2ba('0x2')]={'name':{'type':Sequelize[_0xa2ba('0x3')],'unique':_0xa2ba('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa2ba('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa2ba('0x3')],'defaultValue':function(){return rs[_0xa2ba('0x5')]();}},'phone':{'type':Sequelize[_0xa2ba('0x3')]},'type':{'type':Sequelize['ENUM'](_0xa2ba('0x6'),'skebby',_0xa2ba('0x7'),'clicksend',_0xa2ba('0x8'),_0xa2ba('0x9'),'bandwidth',_0xa2ba('0xa'),_0xa2ba('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0xa2ba('0x3')]},'authId':{'type':Sequelize[_0xa2ba('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa2ba('0xc')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa2ba('0x3')]},'apiKey':{'type':Sequelize[_0xa2ba('0x3')]},'applicationId':{'type':Sequelize[_0xa2ba('0x3')]},'accountId':{'type':Sequelize[_0xa2ba('0x3')]},'senderString':{'type':Sequelize[_0xa2ba('0x3')]},'deliveryReport':{'type':Sequelize[_0xa2ba('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xa2ba('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa2ba('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa2ba('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa2ba('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa2ba('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa2ba('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa2ba('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa2ba('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa2ba('0xf')],'comment':_0xa2ba('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xa2ba('0xd')],'defaultValue':![],'comment':_0xa2ba('0x11'),'set':function(_0x4fb299){if(!_0x4fb299)this[_0xa2ba('0x12')](_0xa2ba('0x13'),null);this['setDataValue'](_0xa2ba('0x14'),_0x4fb299);}}}; \ No newline at end of file +var _0x0630=['skebby','clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','ENUM','twilio'];(function(_0x170e69,_0x5908ad){var _0x2861ed=function(_0xe73302){while(--_0xe73302){_0x170e69['push'](_0x170e69['shift']());}};_0x2861ed(++_0x5908ad);}(_0x0630,0xd6));var _0x0063=function(_0x2641cd,_0x462111){_0x2641cd=_0x2641cd-0x0;var _0x4ae59d=_0x0630[_0x2641cd];return _0x4ae59d;};'use strict';var Sequelize=require(_0x0063('0x0'));var rs=require('randomstring');module[_0x0063('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0063('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x0063('0x3')]},'type':{'type':Sequelize[_0x0063('0x4')](_0x0063('0x5'),_0x0063('0x6'),'connectel',_0x0063('0x7'),_0x0063('0x8'),_0x0063('0x9'),'bandwidth',_0x0063('0xa'),'infobip',_0x0063('0xb'))},'accountSid':{'type':Sequelize[_0x0063('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x0063('0x3')]},'smsMethod':{'type':Sequelize[_0x0063('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0063('0x3')]},'password':{'type':Sequelize[_0x0063('0x3')]},'apiKey':{'type':Sequelize[_0x0063('0x3')]},'applicationId':{'type':Sequelize[_0x0063('0x3')]},'accountId':{'type':Sequelize[_0x0063('0x3')]},'senderString':{'type':Sequelize[_0x0063('0x3')]},'deliveryReport':{'type':Sequelize[_0x0063('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0063('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0063('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0063('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0063('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0063('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0063('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0063('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0063('0x10'),'set':function(_0xe99584){if(!_0xe99584)this[_0x0063('0x11')](_0x0063('0x12'),null);this[_0x0063('0x11')](_0x0063('0x13'),_0xe99584);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e330af2..c6e9f72 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 _0xd959=['text','csc','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','SmsMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','send','\x0a','sequelize','transaction','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','fullname','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','groupName','DELIVERED','redif','connectel','error_code','DELIVERED_TO_GATEWAY','message-delivered','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','SmsAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','from','MessageSid','sender','messageId','message_id','plivo','From','Text','infobip','results'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd959,0x131));var _0x9d95=function(_0x3425d7,_0x31d553){_0x3425d7=_0x3425d7-0x0;var _0x5c382b=_0xd959[_0x3425d7];return _0x5c382b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d95('0x0'));var jsonpatch=require(_0x9d95('0x1'));var rp=require(_0x9d95('0x2'));var moment=require(_0x9d95('0x3'));var BPromise=require(_0x9d95('0x4'));var Mustache=require(_0x9d95('0x5'));var util=require(_0x9d95('0x6'));var path=require(_0x9d95('0x7'));var sox=require(_0x9d95('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d95('0x9'));var _=require(_0x9d95('0xa'));var squel=require(_0x9d95('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9d95('0xc'));var toCsv=require(_0x9d95('0xd'));var querystring=require(_0x9d95('0xe'));var Papa=require(_0x9d95('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9d95('0x10'));var as=require(_0x9d95('0x11'));var hardwareService=require(_0x9d95('0x12'));var logger=require(_0x9d95('0x13'))(_0x9d95('0x14'));var utils=require(_0x9d95('0x15'));var config=require(_0x9d95('0x16'));var licenseUtil=require(_0x9d95('0x17'));var db=require('../../mysqldb')['db'];config[_0x9d95('0x18')]=_[_0x9d95('0x19')](config[_0x9d95('0x18')],{'host':_0x9d95('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9d95('0x1b'))[_0x9d95('0x1c')](socket);var jayson=require(_0x9d95('0x1d'));var client=jayson[_0x9d95('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0xa6a9cc,_0x1186ca,_0xeba308,_0x300582){return new BPromise(function(_0x4439a0,_0x32603a){var _0x43aa51=_0x300582||client;return _0x43aa51[_0x9d95('0x1f')](_0xa6a9cc,_0xeba308)[_0x9d95('0x20')](function(_0x2f3551){logger[_0x9d95('0x21')](_0x9d95('0x22'),_0x1186ca,_0x9d95('0x23'));logger[_0x9d95('0x24')](_0x9d95('0x25'),_0x1186ca,_0x9d95('0x23'),JSON[_0x9d95('0x26')](_0x2f3551));if(_0x2f3551['error']){if(_0x2f3551[_0x9d95('0x27')][_0x9d95('0x28')]===0x1f4){logger[_0x9d95('0x27')](_0x9d95('0x22'),_0x1186ca,_0x2f3551[_0x9d95('0x27')][_0x9d95('0x29')]);return _0x32603a(_0x2f3551[_0x9d95('0x27')]['message']);}logger[_0x9d95('0x27')](_0x9d95('0x22'),_0x1186ca,_0x2f3551[_0x9d95('0x27')][_0x9d95('0x29')]);return _0x4439a0(_0x2f3551[_0x9d95('0x27')][_0x9d95('0x29')]);}else{logger[_0x9d95('0x21')](_0x9d95('0x22'),_0x1186ca,_0x9d95('0x23'));_0x4439a0(_0x2f3551['result'][_0x9d95('0x29')]);}})['catch'](function(_0x2c6630){logger['error'](_0x9d95('0x22'),_0x1186ca,_0x2c6630);_0x32603a(_0x2c6630);});});}function respondWithStatusCode(_0x58e554,_0x680045){_0x680045=_0x680045||0xcc;return function(_0x2a082f){if(_0x2a082f){return _0x58e554['sendStatus'](_0x680045);}return _0x58e554[_0x9d95('0x2a')](_0x680045)[_0x9d95('0x2b')]();};}function respondWithResult(_0x5ecb8c,_0x365646){_0x365646=_0x365646||0xc8;return function(_0x1e82cf){if(_0x1e82cf){return _0x5ecb8c[_0x9d95('0x2a')](_0x365646)[_0x9d95('0x2c')](_0x1e82cf);}};}function respondWithFilteredResult(_0x857bde,_0x33bd6b){return function(_0x1a2a75){if(_0x1a2a75){var _0x373f90=typeof _0x33bd6b[_0x9d95('0x2d')]===_0x9d95('0x2e')&&typeof _0x33bd6b[_0x9d95('0x2f')]===_0x9d95('0x2e');var _0x2f11e4=_0x1a2a75[_0x9d95('0x30')];var _0x1fb1c9=_0x373f90?0x0:_0x33bd6b[_0x9d95('0x2d')];var _0x100332=_0x373f90?_0x1a2a75[_0x9d95('0x30')]:_0x33bd6b[_0x9d95('0x2d')]+_0x33bd6b[_0x9d95('0x2f')];var _0x1d1147;if(_0x100332>=_0x2f11e4){_0x100332=_0x2f11e4;_0x1d1147=0xc8;}else{_0x1d1147=0xce;}_0x857bde[_0x9d95('0x2a')](_0x1d1147);return _0x857bde[_0x9d95('0x31')]('Content-Range',_0x1fb1c9+'-'+_0x100332+'/'+_0x2f11e4)[_0x9d95('0x2c')](_0x1a2a75);}return null;};}function patchUpdates(_0x488eb5){return function(_0x5b21d9){try{jsonpatch[_0x9d95('0x32')](_0x5b21d9,_0x488eb5,!![]);}catch(_0x5bd105){return BPromise[_0x9d95('0x33')](_0x5bd105);}return _0x5b21d9['save']();};}function saveUpdates(_0x3cfea4,_0xd2f3ce){return function(_0x4f9d79){if(_0x4f9d79){return _0x4f9d79[_0x9d95('0x34')](_0x3cfea4)[_0x9d95('0x20')](function(_0x2388ca){return _0x2388ca;});}return null;};}function removeEntity(_0x3bce88,_0xa8529b){return function(_0x12f22b){if(_0x12f22b){return _0x12f22b[_0x9d95('0x35')]()[_0x9d95('0x20')](function(){var _0x3ef21f=_0x12f22b['get']({'plain':!![]});var _0x23d921=_0x9d95('0x36');return db[_0x9d95('0x37')][_0x9d95('0x35')]({'where':{'type':_0x23d921,'resourceId':_0x3ef21f['id']}})['then'](function(){return _0x12f22b;});})[_0x9d95('0x20')](function(){_0x3bce88[_0x9d95('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19969c,_0x277b2f){return function(_0x21dccf){if(!_0x21dccf){_0x19969c[_0x9d95('0x38')](0x194);}return _0x21dccf;};}function handleError(_0x175590,_0x39903f){_0x39903f=_0x39903f||0x1f4;return function(_0x526bc6){logger[_0x9d95('0x27')](_0x526bc6[_0x9d95('0x39')]);if(_0x526bc6[_0x9d95('0x3a')]){delete _0x526bc6['name'];}_0x175590[_0x9d95('0x2a')](_0x39903f)['send'](_0x526bc6);};}exports[_0x9d95('0x3b')]=function(_0x2c4f0b,_0x2cba16){var _0x2aeef2={'include':[{'model':db[_0x9d95('0x3c')],'as':_0x9d95('0x3d')}]},_0x515e70={},_0x521e6c={'count':0x0,'rows':[]};var _0x2c7984=_[_0x9d95('0x3e')](db[_0x9d95('0x3f')]['rawAttributes'],function(_0x4ee25c){return{'name':_0x4ee25c['fieldName'],'type':_0x4ee25c[_0x9d95('0x40')][_0x9d95('0x41')]};});_0x515e70[_0x9d95('0x42')]=_[_0x9d95('0x3e')](_0x2c7984,_0x9d95('0x3a'));_0x515e70[_0x9d95('0x43')]=_[_0x9d95('0x44')](_0x2c4f0b[_0x9d95('0x43')]);_0x515e70['filters']=_[_0x9d95('0x45')](_0x515e70[_0x9d95('0x42')],_0x515e70['query']);_0x2aeef2[_0x9d95('0x46')]=_['intersection'](_0x515e70['model'],qs['fields'](_0x2c4f0b['query'][_0x9d95('0x47')]));_0x2aeef2[_0x9d95('0x46')]=_0x2aeef2[_0x9d95('0x46')][_0x9d95('0x48')]?_0x2aeef2[_0x9d95('0x46')]:_0x515e70[_0x9d95('0x42')];if(!_0x2c4f0b[_0x9d95('0x43')][_0x9d95('0x49')](_0x9d95('0x4a'))){_0x2aeef2['limit']=qs[_0x9d95('0x2f')](_0x2c4f0b['query']['limit']);_0x2aeef2['offset']=qs['offset'](_0x2c4f0b[_0x9d95('0x43')]['offset']);}_0x2aeef2[_0x9d95('0x4b')]=qs[_0x9d95('0x4c')](_0x2c4f0b['query'][_0x9d95('0x4c')]);_0x2aeef2[_0x9d95('0x4d')]=qs['filters'](_['pick'](_0x2c4f0b[_0x9d95('0x43')],_0x515e70[_0x9d95('0x4e')]),_0x2c7984);if(_0x2c4f0b[_0x9d95('0x43')][_0x9d95('0x4f')]){_0x2aeef2[_0x9d95('0x4d')]=_[_0x9d95('0x50')](_0x2aeef2[_0x9d95('0x4d')],{'$or':_['map'](_0x2c7984,function(_0x401f58){if(_0x401f58['type']!==_0x9d95('0x51')){var _0x43c88d={};_0x43c88d[_0x401f58[_0x9d95('0x3a')]]={'$like':'%'+_0x2c4f0b[_0x9d95('0x43')]['filter']+'%'};return _0x43c88d;}})});}_0x2aeef2=_[_0x9d95('0x50')]({},_0x2aeef2,_0x2c4f0b[_0x9d95('0x52')]);var _0x32f712={'where':_0x2aeef2[_0x9d95('0x4d')]};return db[_0x9d95('0x3f')]['count'](_0x32f712)[_0x9d95('0x20')](function(_0x4fc04f){_0x521e6c[_0x9d95('0x30')]=_0x4fc04f;if(_0x2c4f0b[_0x9d95('0x43')][_0x9d95('0x53')]){_0x2aeef2[_0x9d95('0x54')]=[{'all':!![]}];}return db[_0x9d95('0x3f')][_0x9d95('0x55')](_0x2aeef2);})[_0x9d95('0x20')](function(_0xcb76cc){_0x521e6c[_0x9d95('0x56')]=_0xcb76cc;return _0x521e6c;})[_0x9d95('0x20')](respondWithFilteredResult(_0x2cba16,_0x2aeef2))[_0x9d95('0x57')](handleError(_0x2cba16,null));};exports[_0x9d95('0x58')]=function(_0x53a2a8,_0x55598e){var _0x397366={'raw':![],'where':{'id':_0x53a2a8[_0x9d95('0x59')]['id']},'include':[{'model':db[_0x9d95('0x3c')],'as':_0x9d95('0x3d')}]},_0x3f01e4={};_0x3f01e4[_0x9d95('0x42')]=_[_0x9d95('0x44')](db['SmsAccount'][_0x9d95('0x5a')]);_0x3f01e4['query']=_[_0x9d95('0x44')](_0x53a2a8['query']);_0x3f01e4['filters']=_['intersection'](_0x3f01e4[_0x9d95('0x42')],_0x3f01e4[_0x9d95('0x43')]);_0x397366[_0x9d95('0x46')]=_[_0x9d95('0x45')](_0x3f01e4['model'],qs[_0x9d95('0x47')](_0x53a2a8[_0x9d95('0x43')][_0x9d95('0x47')]));_0x397366[_0x9d95('0x46')]=_0x397366[_0x9d95('0x46')]['length']?_0x397366[_0x9d95('0x46')]:_0x3f01e4[_0x9d95('0x42')];if(_0x53a2a8[_0x9d95('0x43')]['includeAll']){_0x397366[_0x9d95('0x54')]=[{'all':!![]}];}_0x397366=_[_0x9d95('0x50')]({},_0x397366,_0x53a2a8[_0x9d95('0x52')]);return db[_0x9d95('0x3f')][_0x9d95('0x5b')](_0x397366)[_0x9d95('0x20')](handleEntityNotFound(_0x55598e,null))[_0x9d95('0x20')](respondWithResult(_0x55598e,null))[_0x9d95('0x57')](handleError(_0x55598e,null));};exports[_0x9d95('0x5c')]=function(_0x1262ef,_0x125f3e){return db[_0x9d95('0x3f')][_0x9d95('0x5c')](_0x1262ef[_0x9d95('0x5d')],{})['then'](function(_0x1ba318){var _0x4eedaa=_0x1262ef[_0x9d95('0x5e')]['get']({'plain':!![]});if(!_0x4eedaa)throw new Error(_0x9d95('0x5f'));if(_0x4eedaa['role']==='user'){var _0x19d0cd=_0x1ba318[_0x9d95('0x60')]({'plain':!![]});var _0x3facd3=_0x9d95('0x36');return db[_0x9d95('0x61')]['find']({'where':{'name':_0x3facd3,'userProfileId':_0x4eedaa[_0x9d95('0x62')]},'raw':!![]})[_0x9d95('0x20')](function(_0x34e6cd){if(_0x34e6cd&&_0x34e6cd[_0x9d95('0x63')]===0x0){return db[_0x9d95('0x37')][_0x9d95('0x5c')]({'name':_0x19d0cd[_0x9d95('0x3a')],'resourceId':_0x19d0cd['id'],'type':_0x34e6cd[_0x9d95('0x3a')],'sectionId':_0x34e6cd['id']},{})[_0x9d95('0x20')](function(){return _0x1ba318;});}else{return _0x1ba318;}})[_0x9d95('0x57')](function(_0x2a82de){logger['error'](_0x9d95('0x64'),_0x2a82de);throw _0x2a82de;});}return _0x1ba318;})[_0x9d95('0x20')](respondWithResult(_0x125f3e,0xc9))[_0x9d95('0x57')](handleError(_0x125f3e,null));};exports[_0x9d95('0x34')]=function(_0x3af238,_0x226fc9){if(_0x3af238[_0x9d95('0x5d')]['id']){delete _0x3af238[_0x9d95('0x5d')]['id'];}return db[_0x9d95('0x3f')]['find']({'where':{'id':_0x3af238['params']['id']},'include':[{'model':db[_0x9d95('0x3c')],'as':_0x9d95('0x3d')}]})[_0x9d95('0x20')](handleEntityNotFound(_0x226fc9,null))[_0x9d95('0x20')](saveUpdates(_0x3af238[_0x9d95('0x5d')],null))['then'](respondWithResult(_0x226fc9,null))[_0x9d95('0x57')](handleError(_0x226fc9,null));};exports['destroy']=function(_0x40bd65,_0x10309d){return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x40bd65[_0x9d95('0x59')]['id']}})['then'](handleEntityNotFound(_0x10309d,null))[_0x9d95('0x20')](removeEntity(_0x10309d,null))[_0x9d95('0x57')](handleError(_0x10309d,null));};exports[_0x9d95('0x65')]=function(_0x3c16a9,_0x8c7b8c){return db[_0x9d95('0x3f')]['describe']()[_0x9d95('0x20')](respondWithResult(_0x8c7b8c,null))[_0x9d95('0x57')](handleError(_0x8c7b8c,null));};exports[_0x9d95('0x66')]=function(_0x17e9a7,_0x291255,_0x155d84){if(_0x17e9a7[_0x9d95('0x5d')]['id']){delete _0x17e9a7[_0x9d95('0x5d')]['id'];}return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x17e9a7[_0x9d95('0x59')]['id']}})['then'](handleEntityNotFound(_0x291255,null))['then'](function(_0xe7726b){if(_0xe7726b){_0x17e9a7[_0x9d95('0x5d')][_0x9d95('0x67')]=_0xe7726b['id'];return db[_0x9d95('0x68')][_0x9d95('0x5c')](_0x17e9a7['body']);}})[_0x9d95('0x20')](respondWithResult(_0x291255,null))[_0x9d95('0x57')](handleError(_0x291255,null));};exports[_0x9d95('0x69')]=function(_0x3b1806,_0x16a53d,_0x2afe8c){var _0x247a67={'raw':![],'where':{}};var _0x1ba44b={};var _0x5a6b0b={'count':0x0,'rows':[]};return db[_0x9d95('0x3f')][_0x9d95('0x6a')]({'where':{'id':_0x3b1806[_0x9d95('0x59')]['id']}})[_0x9d95('0x20')](handleEntityNotFound(_0x16a53d,null))[_0x9d95('0x20')](function(_0x3b453d){if(_0x3b453d){_0x1ba44b[_0x9d95('0x42')]=_[_0x9d95('0x44')](db[_0x9d95('0x68')][_0x9d95('0x5a')]);_0x1ba44b[_0x9d95('0x43')]=_[_0x9d95('0x44')](_0x3b1806[_0x9d95('0x43')]);_0x1ba44b[_0x9d95('0x4e')]=_['intersection'](_0x1ba44b['model'],_0x1ba44b['query']);_0x247a67['attributes']=_[_0x9d95('0x45')](_0x1ba44b['model'],qs[_0x9d95('0x47')](_0x3b1806[_0x9d95('0x43')][_0x9d95('0x47')]));_0x247a67['attributes']=_0x247a67[_0x9d95('0x46')][_0x9d95('0x48')]?_0x247a67[_0x9d95('0x46')]:_0x1ba44b[_0x9d95('0x42')];if(!_0x3b1806['query'][_0x9d95('0x49')]('nolimit')){_0x247a67[_0x9d95('0x2f')]=qs['limit'](_0x3b1806[_0x9d95('0x43')][_0x9d95('0x2f')]);_0x247a67[_0x9d95('0x2d')]=qs['offset'](_0x3b1806[_0x9d95('0x43')][_0x9d95('0x2d')]);}_0x247a67['order']=qs[_0x9d95('0x4c')](_0x3b1806[_0x9d95('0x43')][_0x9d95('0x4c')]);_0x247a67['where']=qs[_0x9d95('0x4e')](_[_0x9d95('0x6b')](_0x3b1806['query'],_0x1ba44b[_0x9d95('0x4e')]));_0x247a67['where'][_0x9d95('0x67')]=_0x3b453d['id'];if(_0x3b1806[_0x9d95('0x43')]['filter']){_0x247a67[_0x9d95('0x4d')]=_[_0x9d95('0x50')](_0x247a67[_0x9d95('0x4d')],{'$or':_[_0x9d95('0x3e')](_0x247a67[_0x9d95('0x46')],function(_0x26729e){var _0x4462b9={};_0x4462b9[_0x26729e]={'$like':'%'+_0x3b1806[_0x9d95('0x43')][_0x9d95('0x4f')]+'%'};return _0x4462b9;})});}_0x247a67=_[_0x9d95('0x50')]({},_0x247a67,_0x3b1806[_0x9d95('0x52')]);return db[_0x9d95('0x68')][_0x9d95('0x30')]({'where':_0x247a67['where']})[_0x9d95('0x20')](function(_0x5906fe){_0x5a6b0b[_0x9d95('0x30')]=_0x5906fe;if(_0x3b1806[_0x9d95('0x43')][_0x9d95('0x53')]){_0x247a67[_0x9d95('0x54')]=[{'all':!![]}];}return db[_0x9d95('0x68')][_0x9d95('0x55')](_0x247a67);})['then'](function(_0x2fddc4){_0x5a6b0b[_0x9d95('0x56')]=_0x2fddc4;return _0x5a6b0b;});}})['then'](respondWithFilteredResult(_0x16a53d,_0x247a67))['catch'](handleError(_0x16a53d,null));};exports[_0x9d95('0x6c')]=function(_0x4679c1,_0x409fb7,_0x8ff97b){return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x4679c1[_0x9d95('0x59')]['id']}})['then'](handleEntityNotFound(_0x409fb7,null))[_0x9d95('0x20')](function(_0x22adc2){if(_0x22adc2){return _0x22adc2[_0x9d95('0x6c')](_0x4679c1['query'][_0x9d95('0x6d')]);}})[_0x9d95('0x20')](respondWithStatusCode(_0x409fb7,null))[_0x9d95('0x57')](handleError(_0x409fb7,null));};exports[_0x9d95('0x6e')]=function(_0x1acc5b,_0x1a6d40,_0x2b0c78){if(_0x1acc5b[_0x9d95('0x5d')]['id']){delete _0x1acc5b['body']['id'];}return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x1acc5b[_0x9d95('0x59')]['id']}})['then'](handleEntityNotFound(_0x1a6d40,null))[_0x9d95('0x20')](function(_0x440cb3){if(_0x440cb3){_0x1acc5b['body']['SmsAccountId']=_0x440cb3['id'];return db[_0x9d95('0x6f')][_0x9d95('0x5c')](_0x1acc5b[_0x9d95('0x5d')]);}})[_0x9d95('0x20')](respondWithResult(_0x1a6d40,null))[_0x9d95('0x57')](handleError(_0x1a6d40,null));};exports['getAnswers']=function(_0x1a0491,_0x1e2520,_0x243420){var _0x10ffc4={'raw':![],'where':{}};var _0x411558={};var _0x14fba6={'count':0x0,'rows':[]};return db[_0x9d95('0x3f')][_0x9d95('0x6a')]({'where':{'id':_0x1a0491[_0x9d95('0x59')]['id']}})['then'](handleEntityNotFound(_0x1e2520,null))[_0x9d95('0x20')](function(_0x10149d){if(_0x10149d){_0x411558[_0x9d95('0x42')]=_[_0x9d95('0x44')](db['CannedAnswer']['rawAttributes']);_0x411558['query']=_['keys'](_0x1a0491[_0x9d95('0x43')]);_0x411558[_0x9d95('0x4e')]=_[_0x9d95('0x45')](_0x411558[_0x9d95('0x42')],_0x411558[_0x9d95('0x43')]);_0x10ffc4[_0x9d95('0x46')]=_['intersection'](_0x411558[_0x9d95('0x42')],qs['fields'](_0x1a0491[_0x9d95('0x43')][_0x9d95('0x47')]));_0x10ffc4[_0x9d95('0x46')]=_0x10ffc4['attributes'][_0x9d95('0x48')]?_0x10ffc4[_0x9d95('0x46')]:_0x411558['model'];if(!_0x1a0491[_0x9d95('0x43')][_0x9d95('0x49')](_0x9d95('0x4a'))){_0x10ffc4[_0x9d95('0x2f')]=qs[_0x9d95('0x2f')](_0x1a0491[_0x9d95('0x43')][_0x9d95('0x2f')]);_0x10ffc4[_0x9d95('0x2d')]=qs['offset'](_0x1a0491[_0x9d95('0x43')][_0x9d95('0x2d')]);}_0x10ffc4[_0x9d95('0x4b')]=qs[_0x9d95('0x4c')](_0x1a0491[_0x9d95('0x43')][_0x9d95('0x4c')]);_0x10ffc4[_0x9d95('0x4d')]=qs[_0x9d95('0x4e')](_[_0x9d95('0x6b')](_0x1a0491[_0x9d95('0x43')],_0x411558[_0x9d95('0x4e')]));_0x10ffc4[_0x9d95('0x4d')][_0x9d95('0x67')]=_0x10149d['id'];if(_0x1a0491[_0x9d95('0x43')][_0x9d95('0x4f')]){_0x10ffc4[_0x9d95('0x4d')]=_['merge'](_0x10ffc4[_0x9d95('0x4d')],{'$or':_[_0x9d95('0x3e')](_0x10ffc4[_0x9d95('0x46')],function(_0x50f3d6){var _0x50e074={};_0x50e074[_0x50f3d6]={'$like':'%'+_0x1a0491['query'][_0x9d95('0x4f')]+'%'};return _0x50e074;})});}_0x10ffc4=_[_0x9d95('0x50')]({},_0x10ffc4,_0x1a0491['options']);return db['CannedAnswer']['count']({'where':_0x10ffc4['where']})[_0x9d95('0x20')](function(_0x154f7b){_0x14fba6[_0x9d95('0x30')]=_0x154f7b;if(_0x1a0491[_0x9d95('0x43')][_0x9d95('0x53')]){_0x10ffc4[_0x9d95('0x54')]=[{'all':!![]}];}return db[_0x9d95('0x6f')][_0x9d95('0x55')](_0x10ffc4);})[_0x9d95('0x20')](function(_0x598079){_0x14fba6['rows']=_0x598079;return _0x14fba6;});}})[_0x9d95('0x20')](respondWithFilteredResult(_0x1e2520,_0x10ffc4))['catch'](handleError(_0x1e2520,null));};exports[_0x9d95('0x70')]=function(_0x107a6b,_0x523d03,_0x3e9520){return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x107a6b[_0x9d95('0x59')]['id']}})[_0x9d95('0x20')](handleEntityNotFound(_0x523d03,null))['then'](function(_0x523cb1){if(_0x523cb1){return _0x523cb1[_0x9d95('0x70')](_0x107a6b[_0x9d95('0x43')][_0x9d95('0x6d')]);}})['then'](respondWithStatusCode(_0x523d03,null))[_0x9d95('0x57')](handleError(_0x523d03,null));};exports[_0x9d95('0x71')]=function(_0x1b0a78,_0x89d7b4,_0x26c737){var _0xce5917={'channel':'sms'};var _0xa3a1f3=[];var _0x5d568c=[];var _0x29e3ad={};return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x1b0a78[_0x9d95('0x59')]['id']},'include':[{'model':db[_0x9d95('0x72')],'as':_0x9d95('0x73')}]})[_0x9d95('0x20')](handleEntityNotFound(_0x89d7b4,null))[_0x9d95('0x20')](function(_0x2a401a){_0xce5917[_0x9d95('0x74')]=_0x2a401a;_0xce5917[_0x9d95('0x75')]=_['orderBy'](_0x2a401a[_0x9d95('0x73')],[_0x9d95('0x76')],[_0x9d95('0x77')]);if(_0xce5917[_0x9d95('0x74')][_0x9d95('0x73')]){delete _0xce5917[_0x9d95('0x74')][_0x9d95('0x73')];}return db[_0x9d95('0x78')][_0x9d95('0x65')]();})['then'](function(_0xcc0f6a){if(!_0xcc0f6a){throw new db[(_0x9d95('0x79'))]['ValidationError'](_0x9d95('0x7a'));}_0xa3a1f3=_[_0x9d95('0x7b')](_[_0x9d95('0x44')](_0xcc0f6a),['createdAt',_0x9d95('0x7c')]);_0x5d568c=_[_0x9d95('0x7b')](_[_0x9d95('0x44')](_0xcc0f6a),[_0x9d95('0x7d'),_0x9d95('0x7c'),_0x9d95('0x7e'),_0x9d95('0x7f')]);_0xce5917[_0x9d95('0x5d')]={'mapKey':'mobile'};if(_0xce5917['account'][_0x9d95('0x40')]){switch(_0xce5917[_0x9d95('0x74')][_0x9d95('0x40')]){case _0x9d95('0x80'):_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]=_0x1b0a78[_0x9d95('0x5d')]['From'];_0xce5917[_0x9d95('0x5d')][_0x9d95('0x5d')]=_0x1b0a78['body']['Body'];_0xce5917[_0x9d95('0x5d')]['messageId']=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x82')];break;case'skebby':_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]='+'+_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x83')];_0xce5917[_0x9d95('0x5d')][_0x9d95('0x5d')]=_0x1b0a78[_0x9d95('0x5d')]['text'];break;case'connectel':_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x81')];_0xce5917['body']['body']=_0x1b0a78[_0x9d95('0x5d')]['message'];break;case'clicksend':_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]=_0x1b0a78['body']['from'];_0xce5917['body']['body']=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x5d')];_0xce5917[_0x9d95('0x5d')][_0x9d95('0x84')]=_0x1b0a78['body'][_0x9d95('0x85')];break;case _0x9d95('0x86'):_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x87')];_0xce5917[_0x9d95('0x5d')][_0x9d95('0x5d')]=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x88')];_0xce5917['body'][_0x9d95('0x84')]=_0x1b0a78[_0x9d95('0x5d')]['MessageUUID'];break;case _0x9d95('0x89'):_0xce5917[_0x9d95('0x5d')]['from']='+'+_0x1b0a78['body'][_0x9d95('0x8a')][0x0][_0x9d95('0x81')];_0xce5917[_0x9d95('0x5d')]['body']=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x8a')][0x0][_0x9d95('0x8b')];_0xce5917[_0x9d95('0x5d')]['messageId']=_0x1b0a78['body'][_0x9d95('0x8a')][0x0][_0x9d95('0x84')];break;case _0x9d95('0x8c'):_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]=_0x1b0a78[_0x9d95('0x5d')]['originatingAddress'];_0xce5917['body']['body']=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x8d')][_0x9d95('0x29')];break;case _0x9d95('0x8e'):_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x8f')];_0xce5917['body']['body']=_0x1b0a78[_0x9d95('0x5d')][_0x9d95('0x8b')];_0xce5917[_0x9d95('0x5d')][_0x9d95('0x84')]=_0x1b0a78['body']['replyMessageId'];break;case _0x9d95('0x90'):_0xce5917['body'][_0x9d95('0x84')]=_0x1b0a78[_0x9d95('0x5d')][0x0]['message']['id'];_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')]=_0x1b0a78[_0x9d95('0x5d')][0x0][_0x9d95('0x29')][_0x9d95('0x81')];_0xce5917['body'][_0x9d95('0x5d')]=_0x1b0a78[_0x9d95('0x5d')][0x0][_0x9d95('0x29')][_0x9d95('0x8b')];break;case _0x9d95('0x91'):_0xce5917[_0x9d95('0x5d')]['from']=_0x1b0a78[_0x9d95('0x5d')]['from'];_0xce5917[_0x9d95('0x5d')][_0x9d95('0x5d')]=_0x1b0a78['body'][_0x9d95('0x29')];_0xce5917[_0x9d95('0x5d')]['messageId']=_0x1b0a78[_0x9d95('0x5d')]['refid'];break;}}if(_0xce5917[_0x9d95('0x5d')]['id']){delete _0xce5917[_0x9d95('0x5d')]['id'];}if(_['isNil'](_0xce5917[_0x9d95('0x5d')]['from'])){throw new db[(_0x9d95('0x79'))][(_0x9d95('0x92'))](_0x9d95('0x93'));}if(_[_0x9d95('0x94')](_0xce5917['body']['body'])||_0xce5917[_0x9d95('0x5d')]['body']===''){throw new db[(_0x9d95('0x79'))][(_0x9d95('0x92'))](_0x9d95('0x95'));}if(_[_0x9d95('0x94')](_0xce5917[_0x9d95('0x5d')][_0x9d95('0x96')])){throw new db['Sequelize']['ValidationError'](_0x9d95('0x97')+_0x5d568c);}if(!_[_0x9d95('0x98')](_0x5d568c,_0xce5917[_0x9d95('0x5d')]['mapKey'])){throw new db[(_0x9d95('0x79'))][(_0x9d95('0x92'))](_0x9d95('0x99')+_0x5d568c);}_0x29e3ad[_0xce5917['body'][_0x9d95('0x96')]]=_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')];return db[_0x9d95('0x9a')][_0x9d95('0x5b')]({'where':{'id':_0xce5917[_0x9d95('0x74')][_0x9d95('0x7f')]},'include':[{'model':db[_0x9d95('0x78')],'as':_0x9d95('0x9b'),'where':_0x29e3ad,'limit':0x1,'order':[[_0x9d95('0x7c'),_0x9d95('0x9c')]]}]});})['then'](handleEntityNotFound(_0x89d7b4,null))[_0x9d95('0x20')](function(_0x49c707){if(_0x49c707){_0xce5917[_0x9d95('0x9d')]=_[_0x9d95('0x9e')](_0x49c707,['Contacts']);if(_0x49c707[_0x9d95('0x9b')][_0x9d95('0x48')]){return _0x49c707[_0x9d95('0x9b')][0x0];}var _0x443892=_[_0x9d95('0x19')](_0xce5917[_0x9d95('0x5d')],{'firstName':_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')],'ListId':_0x49c707['id']});_0x443892[_0xce5917[_0x9d95('0x5d')][_0x9d95('0x96')]]=_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')];return db[_0x9d95('0x78')][_0x9d95('0x5c')](_0x443892,{'fields':_0xa3a1f3,'raw':!![]});}})['then'](handleEntityNotFound(_0x89d7b4,null))[_0x9d95('0x20')](function(_0x2aa178){if(_0x2aa178){_0xce5917[_0x9d95('0x9f')]=_0x2aa178;var _0x4e8418={'ContactId':_0x2aa178['id'],'phone':_0xce5917['body'][_0x9d95('0x81')],'SmsAccountId':_0x1b0a78[_0x9d95('0x59')]['id']};var _0x31c0dd={'ContactId':_0x2aa178['id'],'SmsAccountId':_0x1b0a78[_0x9d95('0x59')]['id'],'closed':![]};return db['SmsInteraction'][_0x9d95('0x5b')]({'where':_0x31c0dd})[_0x9d95('0x20')](function(_0x5b3dcb){if(_0x5b3dcb){return[_0x5b3dcb,![]];}return db[_0x9d95('0xa0')][_0x9d95('0x5c')](_0x4e8418)[_0x9d95('0x20')](function(_0x47c4ba){return[_0x47c4ba,!![]];});});}})[_0x9d95('0xa1')](function(_0x3c5fea,_0x5a71cd){_0xce5917['interaction']=_0x3c5fea[_0x9d95('0x60')]({'plain':!![]});_0xce5917[_0x9d95('0xa2')][_0x9d95('0xa3')]=![];if(_0x5a71cd){if(_0xce5917[_0x9d95('0x74')][_0x9d95('0xa4')]){_0xce5917[_0x9d95('0x75')][_0x9d95('0xa5')]({'id':0x0,'priority':_0xce5917[_0x9d95('0x75')][_0x9d95('0x48')]+0x1,'app':'close','appdata':_0x9d95('0xa6'),'interval':'*,*,*,*'});}_0xce5917[_0x9d95('0xa2')]['created']=!![];}return db[_0x9d95('0xa7')]['create']({'phone':_0xce5917[_0x9d95('0x5d')][_0x9d95('0x81')],'messageId':_0xce5917['body'][_0x9d95('0x84')],'body':_0xce5917[_0x9d95('0x5d')]['body'],'SmsAccountId':_0x1b0a78[_0x9d95('0x59')]['id'],'SmsInteractionId':_0x3c5fea['id'],'direction':'in','ContactId':_0x3c5fea['ContactId'],'AttachmentId':_0xce5917[_0x9d95('0x5d')][_0x9d95('0xa8')]});})[_0x9d95('0x20')](function(_0x56ff71){_0xce5917[_0x9d95('0x29')]=_0x56ff71;if(_0xce5917[_0x9d95('0xa2')][_0x9d95('0xa9')]){return db['User'][_0x9d95('0x5b')]({'attributes':['id',_0x9d95('0x3a')],'where':{'id':_0xce5917[_0x9d95('0xa2')]['UserId']}})[_0x9d95('0x20')](function(_0x27d83e){if(_0x27d83e){_0xce5917[_0x9d95('0x75')][_0x9d95('0xaa')]({'id':0x0,'priority':0x0,'app':_0x9d95('0xab'),'appdata':_0x27d83e['name']+','+(_0xce5917[_0x9d95('0x74')][_0x9d95('0xac')]||0xa),'interval':_0x9d95('0xad')});}return respondWithRpcPromise(_0x9d95('0xae'),_0x9d95('0xaf'),_0xce5917);});}return respondWithRpcPromise('Start',_0x9d95('0xaf'),_0xce5917);})['then'](function(_0x4e67b9){if(_0x4e67b9){var _0x2a93f6=0xc8;var _0xf931ff=_0x9d95('0xb0');logger[_0x9d95('0x21')](_0x9d95('0x25'),_0xf931ff,_0x2a93f6,_0x9d95('0xb1'));logger[_0x9d95('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xf931ff,_0x2a93f6,_0x9d95('0xb1'),JSON[_0x9d95('0x26')](_0x4e67b9));if(_0xce5917[_0x9d95('0x74')][_0x9d95('0x40')]===_0x9d95('0x80')){return _0x89d7b4[_0x9d95('0x2a')](_0x2a93f6)[_0x9d95('0x31')](_0x9d95('0xb2'),'text/xml')[_0x9d95('0xb3')](_0x9d95('0xb4'));}else{return _0x89d7b4[_0x9d95('0x2a')](_0x2a93f6)['json'](_0x4e67b9);}}})[_0x9d95('0x57')](handleError(_0x89d7b4,null));};exports['addApplications']=function(_0x1e19c1,_0x45a7e2){var _0x2f5b76=_0x1e19c1[_0x9d95('0x59')]['id'];var _0x406ca0=_0x1e19c1[_0x9d95('0x5d')];var _0x4b8632=0xc8;var _0x3a6cd9=null;return db[_0x9d95('0xb5')][_0x9d95('0xb6')]({'isolationLevel':db[_0x9d95('0xb5')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x6d63f5){return db[_0x9d95('0x3f')]['findOne']({'where':{'id':_0x2f5b76},'transaction':_0x6d63f5})[_0x9d95('0x20')](function(_0x1b2620){if(_0x1b2620){return db[_0x9d95('0x72')][_0x9d95('0x35')]({'where':{'SmsAccountId':_0x2f5b76},'transaction':_0x6d63f5})['then'](function(){var _0x508c61=_['map'](_0x406ca0,function(_0x19e4c1){_0x19e4c1[_0x9d95('0x67')]=_0x2f5b76;return _0x19e4c1;});return db[_0x9d95('0x72')][_0x9d95('0xb7')](_0x508c61,{'transaction':_0x6d63f5});});}else{_0x4b8632=0x194;_0x3a6cd9=[];}});})[_0x9d95('0x20')](function(){if(_0x4b8632!==0x194){return db['SmsApplication'][_0x9d95('0xb8')]({'where':{'SmsAccountId':_0x2f5b76},'order':_0x9d95('0x76')})[_0x9d95('0x20')](function(_0x4f68b2){_0x3a6cd9=_0x4f68b2;});}})['catch'](function(_0x172b71){_0x4b8632=0x1f4;logger[_0x9d95('0x27')](_0x172b71[_0x9d95('0x39')]);if(_0x172b71[_0x9d95('0x3a')]){delete _0x172b71[_0x9d95('0x3a')];}_0x3a6cd9=_0x172b71;})[_0x9d95('0xb9')](function(){if(_0x3a6cd9===null){_0x45a7e2[_0x9d95('0x38')](_0x4b8632);}else{if(_0x4b8632===0x1f4){_0x45a7e2[_0x9d95('0x2a')](_0x4b8632)[_0x9d95('0xb3')](_0x3a6cd9);}else{_0x45a7e2[_0x9d95('0x2a')](_0x4b8632)[_0x9d95('0x2c')](_0x3a6cd9);}}});};exports['getApplications']=function(_0x5d9adf,_0xfe6b9a,_0x2b7ad5){var _0x5db058={};var _0xa3379={};var _0x5148ef;var _0x505e7e;return db[_0x9d95('0x3f')]['findOne']({'where':{'id':_0x5d9adf[_0x9d95('0x59')]['id']}})['then'](handleEntityNotFound(_0xfe6b9a,null))[_0x9d95('0x20')](function(_0x46de67){if(_0x46de67){_0x5148ef=_0x46de67;_0xa3379[_0x9d95('0x42')]=_[_0x9d95('0x44')](db[_0x9d95('0x72')][_0x9d95('0x5a')]);_0xa3379[_0x9d95('0x43')]=_[_0x9d95('0x44')](_0x5d9adf[_0x9d95('0x43')]);_0xa3379[_0x9d95('0x4e')]=_[_0x9d95('0x45')](_0xa3379[_0x9d95('0x42')],_0xa3379[_0x9d95('0x43')]);_0x5db058[_0x9d95('0x46')]=_[_0x9d95('0x45')](_0xa3379[_0x9d95('0x42')],qs[_0x9d95('0x47')](_0x5d9adf[_0x9d95('0x43')]['fields']));_0x5db058[_0x9d95('0x46')]=_0x5db058[_0x9d95('0x46')][_0x9d95('0x48')]?_0x5db058[_0x9d95('0x46')]:_0xa3379['model'];_0x5db058[_0x9d95('0x4b')]=qs[_0x9d95('0x4c')](_0x5d9adf[_0x9d95('0x43')][_0x9d95('0x4c')]);_0x5db058[_0x9d95('0x4d')]=qs[_0x9d95('0x4e')](_[_0x9d95('0x6b')](_0x5d9adf[_0x9d95('0x43')],_0xa3379[_0x9d95('0x4e')]));if(_0x5d9adf[_0x9d95('0x43')][_0x9d95('0x4f')]){_0x5db058['where']=_['merge'](_0x5db058['where'],{'$or':_[_0x9d95('0x3e')](_0x5db058['attributes'],function(_0x58be6f){var _0x48c56a={};_0x48c56a[_0x58be6f]={'$like':'%'+_0x5d9adf[_0x9d95('0x43')]['filter']+'%'};return _0x48c56a;})});}_0x5db058=_['merge']({},_0x5db058,_0x5d9adf[_0x9d95('0x52')]);return _0x5148ef['getApplications'](_0x5db058);}})['then'](function(_0x248b60){if(_0x248b60){_0x505e7e=_0x248b60[_0x9d95('0x48')];if(!_0x5d9adf[_0x9d95('0x43')][_0x9d95('0x49')]('nolimit')){_0x5db058[_0x9d95('0x2f')]=qs[_0x9d95('0x2f')](_0x5d9adf[_0x9d95('0x43')][_0x9d95('0x2f')]);_0x5db058['offset']=qs[_0x9d95('0x2d')](_0x5d9adf['query'][_0x9d95('0x2d')]);}return _0x5148ef[_0x9d95('0xba')](_0x5db058);}})[_0x9d95('0x20')](function(_0x553bfa){if(_0x553bfa){return _0x553bfa?{'count':_0x505e7e,'rows':_0x553bfa}:null;}})[_0x9d95('0x20')](respondWithResult(_0xfe6b9a,null))[_0x9d95('0x57')](handleError(_0xfe6b9a,null));};exports[_0x9d95('0xbb')]=function(_0x58022e,_0x24c8f9,_0x331e90){var _0x63269e={'raw':![],'where':{}};var _0x3e8ca8={};var _0x437623={'count':0x0,'rows':[]};return db[_0x9d95('0x3f')]['findOne']({'where':{'id':_0x58022e[_0x9d95('0x59')]['id']}})[_0x9d95('0x20')](handleEntityNotFound(_0x24c8f9,null))[_0x9d95('0x20')](function(_0x5ad273){if(_0x5ad273){_0x3e8ca8[_0x9d95('0x42')]=_[_0x9d95('0x44')](db[_0x9d95('0xa0')][_0x9d95('0x5a')]);_0x3e8ca8[_0x9d95('0x43')]=_[_0x9d95('0x44')](_0x58022e['query']);_0x3e8ca8[_0x9d95('0x4e')]=_['intersection'](_0x3e8ca8[_0x9d95('0x42')],_0x3e8ca8[_0x9d95('0x43')]);_0x63269e[_0x9d95('0x46')]=_['intersection'](_0x3e8ca8[_0x9d95('0x42')],qs[_0x9d95('0x47')](_0x58022e[_0x9d95('0x43')][_0x9d95('0x47')]));_0x63269e[_0x9d95('0x46')]=_0x63269e[_0x9d95('0x46')]['length']?_0x63269e[_0x9d95('0x46')]:_0x3e8ca8[_0x9d95('0x42')];if(!_0x58022e[_0x9d95('0x43')][_0x9d95('0x49')]('nolimit')){_0x63269e[_0x9d95('0x2f')]=qs[_0x9d95('0x2f')](_0x58022e[_0x9d95('0x43')][_0x9d95('0x2f')]);_0x63269e[_0x9d95('0x2d')]=qs[_0x9d95('0x2d')](_0x58022e['query']['offset']);}_0x63269e[_0x9d95('0x4b')]=qs[_0x9d95('0x4c')](_0x58022e[_0x9d95('0x43')][_0x9d95('0x4c')]);_0x63269e[_0x9d95('0x4d')]=qs['filters'](_[_0x9d95('0x6b')](_0x58022e[_0x9d95('0x43')],_0x3e8ca8[_0x9d95('0x4e')]));_0x63269e[_0x9d95('0x4d')][_0x9d95('0x67')]=_0x5ad273['id'];if(_0x58022e[_0x9d95('0x43')]['filter']){_0x63269e[_0x9d95('0x4d')]=_[_0x9d95('0x50')](_0x63269e[_0x9d95('0x4d')],{'$or':_[_0x9d95('0x3e')](_0x63269e[_0x9d95('0x46')],function(_0x53f7d0){var _0x11ddf5={};_0x11ddf5[_0x53f7d0]={'$like':'%'+_0x58022e['query'][_0x9d95('0x4f')]+'%'};return _0x11ddf5;})});}_0x63269e=_[_0x9d95('0x50')]({},_0x63269e,_0x58022e[_0x9d95('0x52')]);return db[_0x9d95('0xa0')][_0x9d95('0x30')]({'where':_0x63269e[_0x9d95('0x4d')]})[_0x9d95('0x20')](function(_0xf6b7e9){_0x437623[_0x9d95('0x30')]=_0xf6b7e9;if(_0x58022e[_0x9d95('0x43')][_0x9d95('0x53')]){_0x63269e[_0x9d95('0x54')]=[{'model':db[_0x9d95('0x78')],'as':_0x9d95('0xbc'),'required':![]},{'model':db[_0x9d95('0xbd')],'as':'Owner','attributes':[_0x9d95('0x3a'),_0x9d95('0xbe'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x9d95('0xbf'),'attributes':['id',_0x9d95('0x3a'),'color'],'where':_0x58022e[_0x9d95('0x43')][_0x9d95('0xc0')]?{'id':_0x58022e[_0x9d95('0x43')][_0x9d95('0xc0')]}:undefined,'required':_0x58022e[_0x9d95('0x43')]['tag']?!![]:![]}];}return db[_0x9d95('0xa0')][_0x9d95('0x55')](_0x63269e);})['then'](function(_0x4953a5){_0x437623[_0x9d95('0x56')]=_0x4953a5;return _0x437623;});}})[_0x9d95('0x20')](respondWithFilteredResult(_0x24c8f9,_0x63269e))['catch'](handleError(_0x24c8f9,null));};exports['send']=function(_0x3faf18,_0x4c3d92,_0x3ce5fd){var _0x92a0b4,_0x3ea209,_0x31e5db;if(_[_0x9d95('0x94')](_0x3faf18[_0x9d95('0x5d')]['body'])||_0x3faf18[_0x9d95('0x5d')][_0x9d95('0x5d')]===''){throw new db[(_0x9d95('0x79'))][(_0x9d95('0x92'))](_0x9d95('0x95'));}if(_[_0x9d95('0x94')](_0x3faf18[_0x9d95('0x5d')]['to'])){throw new db['Sequelize'][(_0x9d95('0x92'))](_0x9d95('0xc1'));}_0x92a0b4=_0x3faf18[_0x9d95('0x5d')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x3faf18[_0x9d95('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9d95('0x78')],'as':'Contacts','where':{'mobile':_0x92a0b4},'limit':0x1,'order':[[_0x9d95('0x7c'),_0x9d95('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x4c3d92,null))[_0x9d95('0x20')](function(_0x2c771d){if(_0x2c771d&&_0x2c771d[_0x9d95('0xc2')]){_0x3ea209=_0x2c771d[_0x9d95('0x60')]({'plain':!![]});if(_0x3ea209[_0x9d95('0xc2')]&&_0x3ea209[_0x9d95('0xc2')]['Contacts'][_0x9d95('0x48')]){return _0x3ea209[_0x9d95('0xc2')][_0x9d95('0x9b')][0x0];}return db['CmContact'][_0x9d95('0x5c')](_[_0x9d95('0x19')](_0x3faf18[_0x9d95('0x5d')],{'firstName':_0x92a0b4,'mobile':_0x92a0b4,'phone':_0x92a0b4,'ListId':_0x3ea209[_0x9d95('0x7f')]}));}})[_0x9d95('0x20')](handleEntityNotFound(_0x4c3d92,null))['then'](function(_0x3de1a9){if(_0x3de1a9){_0x31e5db=_0x3de1a9;return db[_0x9d95('0xa0')][_0x9d95('0x5b')]({'where':{'ContactId':_0x31e5db['id'],'closed':![],'SmsAccountId':_0x3ea209['id']}})[_0x9d95('0x20')](function(_0x2e7340){if(_0x2e7340){return[_0x2e7340,![]];}return db[_0x9d95('0xa0')]['create']({'UserId':_0x3faf18[_0x9d95('0x5e')]['id'],'ContactId':_0x31e5db['id'],'SmsAccountId':_0x3ea209['id'],'phone':_0x92a0b4,'firstMsgDirection':_0x9d95('0xc3'),'Messages':[_[_0x9d95('0x50')](_0x3faf18[_0x9d95('0x5d')],{'read':![],'body':_0x3faf18['body'][_0x9d95('0x5d')],'phone':_0x92a0b4,'SmsAccountId':_0x3ea209['id'],'UserId':_0x3faf18[_0x9d95('0x5e')]['id'],'ContactId':_0x31e5db['id']})]},{'include':[{'model':db[_0x9d95('0xa7')],'as':_0x9d95('0xc4')}]})[_0x9d95('0x20')](function(_0x5222){return[_0x5222,!![]];});});}})[_0x9d95('0xa1')](function(_0x1bb3e5,_0x5d8773){if(_0x5d8773){return _0x1bb3e5;}return db[_0x9d95('0xa7')][_0x9d95('0x5c')](_[_0x9d95('0x50')](_0x3faf18[_0x9d95('0x5d')],{'read':![],'body':_0x3faf18[_0x9d95('0x5d')][_0x9d95('0x5d')],'phone':_0x92a0b4,'SmsAccountId':_0x3ea209['id'],'SmsInteractionId':_0x1bb3e5['id'],'UserId':_0x3faf18[_0x9d95('0x5e')]['id'],'ContactId':_0x31e5db['id']}))[_0x9d95('0x20')](function(_0x3b4f55){_0x1bb3e5[_0x9d95('0xc5')][_0x9d95('0xc4')]=[];_0x1bb3e5[_0x9d95('0xc5')]['Messages']['push'](_0x3b4f55['dataValues']);return _0x1bb3e5;});})[_0x9d95('0x20')](respondWithResult(_0x4c3d92,null))['catch'](handleError(_0x4c3d92,null));};exports[_0x9d95('0x2a')]=function(_0x254f65,_0xed2def,_0x3e9c4d){if(_0x254f65[_0x9d95('0x5d')]['id']){delete _0x254f65['body']['id'];}var _0x20a3d9,_0x3dd296,_0x2ebb09;return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x254f65[_0x9d95('0x59')]['id']}})['then'](handleEntityNotFound(_0xed2def,null))['then'](function(_0xae21eb){if(_0xae21eb){_0x2ebb09=_0xae21eb;logger['debug'](_0x9d95('0x25'),_0x9d95('0x2a'),'received\x20delivery\x20report\x20from',_0xae21eb[_0x9d95('0x40')],util[_0x9d95('0xc6')](_0x254f65['body'],{'showHidden':![],'depth':null}));switch(_0xae21eb[_0x9d95('0x40')]){case _0x9d95('0xc7'):if(_0x254f65[_0x9d95('0x5d')][_0x9d95('0xc8')]&&_0x254f65[_0x9d95('0x5d')][_0x9d95('0x2a')]){_0x3dd296=_0x254f65[_0x9d95('0x5d')][_0x9d95('0x2a')];return db['SmsMessage'][_0x9d95('0x5b')]({'where':{'messageId':_0x254f65['body'][_0x9d95('0xc8')]}});}break;case'connectel':if(_0x254f65[_0x9d95('0x5d')][_0x9d95('0xc9')]&&_0x254f65[_0x9d95('0x5d')][_0x9d95('0xca')]){_0x3dd296=_0x254f65[_0x9d95('0x5d')][_0x9d95('0xca')];return db[_0x9d95('0xa7')]['find']({'where':{'messageId':_0x254f65[_0x9d95('0x5d')][_0x9d95('0xc9')]}});}break;case _0x9d95('0xcb'):if(_0x254f65['body'][_0x9d95('0x85')]&&_0x254f65['body']['status_code']){_0x3dd296=_0x254f65['body']['status_code'];return db[_0x9d95('0xa7')][_0x9d95('0x5b')]({'where':{'messageId':_0x254f65[_0x9d95('0x5d')][_0x9d95('0x85')]}});}break;case _0x9d95('0x89'):var _0x472f79=_0x254f65[_0x9d95('0x5d')]['results'][0x0];if(_0x472f79[_0x9d95('0x84')]&&_0x472f79[_0x9d95('0x2a')][_0x9d95('0xcc')]===_0x9d95('0xcd')){_0x3dd296=_0x472f79[_0x9d95('0x2a')][_0x9d95('0xcc')];return db[_0x9d95('0xa7')][_0x9d95('0x5b')]({'where':{'messageId':_0x472f79[_0x9d95('0x84')]}});}break;case'clickatell':if(_0x254f65['body']['messageId']&&_0x254f65['body']['status']){_0x3dd296=_0x254f65[_0x9d95('0x5d')]['status'];return db['SmsMessage'][_0x9d95('0x5b')]({'where':{'messageId':_0x254f65[_0x9d95('0x5d')][_0x9d95('0x84')]}});}break;case _0x9d95('0x90'):if(_0x254f65[_0x9d95('0x5d')][0x0][_0x9d95('0x29')]['id']){_0x3dd296=_0x254f65[_0x9d95('0x5d')][0x0]['type'];return db['SmsMessage'][_0x9d95('0x5b')]({'where':{'messageId':_0x254f65[_0x9d95('0x5d')][0x0][_0x9d95('0x29')]['id']}});}break;case _0x9d95('0x91'):if(_0x254f65[_0x9d95('0x5d')]['redif']&&_0x254f65[_0x9d95('0x5d')][_0x9d95('0x2a')]){_0x3dd296=_0x254f65[_0x9d95('0x5d')]['status'];return db[_0x9d95('0xa7')][_0x9d95('0x5b')]({'where':{'messageId':_0x254f65[_0x9d95('0x5d')][_0x9d95('0xce')]}});}break;}}})['then'](handleEntityNotFound(_0xed2def,null))[_0x9d95('0x20')](function(_0x268a8d){if(_0x268a8d){_0x20a3d9=_0x268a8d;switch(_0x2ebb09[_0x9d95('0x40')]){case'skebby':if(_0x3dd296==='DELIVERED'){return _0x20a3d9[_0x9d95('0x34')]({'read':!![]});}else{logger[_0x9d95('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9d95('0xc7'),util[_0x9d95('0xc6')](_0x254f65['body'],{'showHidden':![],'depth':null}));}break;case _0x9d95('0xcf'):if(_0x3dd296==='1'){return _0x20a3d9[_0x9d95('0x34')]({'read':!![]});}else{logger['error'](_0x9d95('0x25'),_0x9d95('0x2a'),_0x9d95('0xc7'),util[_0x9d95('0xc6')](_0x254f65[_0x9d95('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9d95('0xcb'):if(!_0x254f65['body'][_0x9d95('0xd0')]&&_0x3dd296>=0xc8&&_0x3dd296<=0xce){return _0x20a3d9[_0x9d95('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9d95('0x2a'),'clicksend',util[_0x9d95('0xc6')](_0x254f65['body'],{'showHidden':![],'depth':null}));}break;case _0x9d95('0x89'):var _0x11bd49=_0x254f65[_0x9d95('0x5d')][_0x9d95('0x8a')][0x0];if(_0x11bd49[_0x9d95('0x2a')]['groupName']===_0x9d95('0xcd')){return _0x20a3d9[_0x9d95('0x34')]({'read':!![]});}else{logger[_0x9d95('0x27')](_0x9d95('0x25'),_0x9d95('0x2a'),'infobip',util[_0x9d95('0xc6')](_0x254f65[_0x9d95('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3dd296==_0x9d95('0xd1')||_0x3dd296=='RECEIVED_BY_RECIPIENT'){return _0x20a3d9[_0x9d95('0x34')]({'read':!![]});}else{logger[_0x9d95('0x27')](_0x9d95('0x25'),_0x9d95('0x2a'),_0x9d95('0x8e'),util[_0x9d95('0xc6')](_0x254f65[_0x9d95('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9d95('0x90'):if(_0x3dd296==_0x9d95('0xd2')){return _0x20a3d9[_0x9d95('0x34')]({'read':!![]});}else{logger['error'](_0x9d95('0x25'),_0x9d95('0x2a'),_0x9d95('0x90'),util['inspect'](_0x254f65[_0x9d95('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x9d95('0x91'):if(_0x3dd296==='DELIVRD'||_0x3dd296===_0x9d95('0xd3')){return _0x20a3d9[_0x9d95('0x34')]({'read':!![]});}else{logger['error'](_0x9d95('0x25'),_0x9d95('0x2a'),'intelepeer',util[_0x9d95('0xc6')](_0x254f65['body'],{'showHidden':![],'depth':null}));}break;}return _0x20a3d9;}})['then'](respondWithResult(_0xed2def,null))[_0x9d95('0x57')](handleError(_0xed2def,null));};exports[_0x9d95('0xd4')]=function(_0x4cd9a3,_0x3d1c77,_0x141475){var _0x12b247,_0x564241,_0x4cba6c;return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x4cd9a3[_0x9d95('0x59')]['id']}})[_0x9d95('0x20')](handleEntityNotFound(_0x3d1c77,null))[_0x9d95('0x20')](function(_0x5f1b42){if(_0x5f1b42){_0x4cba6c=_0x5f1b42;logger[_0x9d95('0x24')](_0x9d95('0x25'),'status','received\x20delivery\x20report\x20from',_0x5f1b42[_0x9d95('0x40')],util[_0x9d95('0xc6')](_0x4cd9a3[_0x9d95('0x43')],{'showHidden':![],'depth':null}));switch(_0x5f1b42[_0x9d95('0x40')]){case _0x9d95('0x8c'):if(_0x4cd9a3[_0x9d95('0x43')]['message-id']&&_0x4cd9a3[_0x9d95('0x43')][_0x9d95('0xd5')]){_0x564241=_0x4cd9a3[_0x9d95('0x43')][_0x9d95('0xd5')];return db['SmsMessage'][_0x9d95('0x5b')]({'where':{'messageId':_0x4cd9a3[_0x9d95('0x43')][_0x9d95('0xd6')]}});}break;}}})[_0x9d95('0x20')](handleEntityNotFound(_0x3d1c77,null))[_0x9d95('0x20')](function(_0x9510ca){if(_0x9510ca){_0x12b247=_0x9510ca;switch(_0x4cba6c[_0x9d95('0x40')]){case _0x9d95('0x8c'):if(_0x564241==='2'||_0x564241==='6'){return _0x12b247[_0x9d95('0x34')]({'read':!![]});}else{logger[_0x9d95('0x27')](_0x9d95('0x25'),_0x9d95('0x2a'),'csc',util[_0x9d95('0xc6')](_0x4cd9a3['query'],{'showHidden':![],'depth':null}));};break;}return _0x12b247;}})[_0x9d95('0x20')](respondWithResult(_0x3d1c77,null))[_0x9d95('0x57')](handleError(_0x3d1c77,null));};exports[_0x9d95('0xd7')]=function(_0x17b67a,_0x8a2a87,_0x4c51cd){return db[_0x9d95('0x3f')][_0x9d95('0x5b')]({'where':{'id':_0x17b67a[_0x9d95('0x59')]['id']}})[_0x9d95('0x20')](handleEntityNotFound(_0x8a2a87,null))[_0x9d95('0x20')](function(_0x406b14){if(_0x406b14){return _0x406b14[_0x9d95('0xd7')](_0x17b67a[_0x9d95('0x5d')][_0x9d95('0x6d')],_['omit'](_0x17b67a[_0x9d95('0x5d')],['ids','id'])||{})[_0x9d95('0xa1')](function(_0x40c75d){for(var _0x5b3999=0x0;_0x5b3999<_0x17b67a[_0x9d95('0x5d')][_0x9d95('0x6d')][_0x9d95('0x48')];_0x5b3999+=0x1){socket[_0x9d95('0xd8')](_0x9d95('0xd9'),{'UserId':Number(_0x17b67a['body'][_0x9d95('0x6d')][_0x5b3999]),'SmsAccountId':Number(_0x17b67a['params']['id'])});}return _0x40c75d;});}})[_0x9d95('0x20')](respondWithResult(_0x8a2a87,null))[_0x9d95('0x57')](handleError(_0x8a2a87,null));};exports[_0x9d95('0xda')]=function(_0x49a706,_0x3f796e,_0x2e0cad){return db[_0x9d95('0x3f')]['find']({'where':{'id':_0x49a706[_0x9d95('0x59')]['id']}})[_0x9d95('0x20')](handleEntityNotFound(_0x3f796e,null))['then'](function(_0x2c9815){if(_0x2c9815){return _0x2c9815[_0x9d95('0xda')](_0x49a706[_0x9d95('0x43')][_0x9d95('0x6d')])['then'](function(){if(_[_0x9d95('0xdb')](_0x49a706[_0x9d95('0x43')]['ids'])){for(var _0xd521ff=0x0;_0xd521ff<_0x49a706['query']['ids'][_0x9d95('0x48')];_0xd521ff+=0x1){socket['emit'](_0x9d95('0xdc'),{'UserId':Number(_0x49a706[_0x9d95('0x43')][_0x9d95('0x6d')][_0xd521ff]),'SmsAccountId':Number(_0x49a706[_0x9d95('0x59')]['id'])});}}else{socket[_0x9d95('0xd8')](_0x9d95('0xdc'),{'UserId':Number(_0x49a706['query']['ids']),'SmsAccountId':Number(_0x49a706['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3f796e,null))[_0x9d95('0x57')](handleError(_0x3f796e,null));};exports[_0x9d95('0xdd')]=function(_0x292e5f,_0x31aa13,_0xb325d3){var _0x171dc2={};var _0x2afb32={};var _0x3fffb1;var _0x197326;return db[_0x9d95('0x3f')][_0x9d95('0x6a')]({'where':{'id':_0x292e5f[_0x9d95('0x59')]['id']}})[_0x9d95('0x20')](handleEntityNotFound(_0x31aa13,null))[_0x9d95('0x20')](function(_0x4c64b7){if(_0x4c64b7){_0x3fffb1=_0x4c64b7;_0x2afb32[_0x9d95('0x42')]=_[_0x9d95('0x44')](db['User'][_0x9d95('0x5a')]);_0x2afb32[_0x9d95('0x43')]=_['keys'](_0x292e5f[_0x9d95('0x43')]);_0x2afb32[_0x9d95('0x4e')]=_['intersection'](_0x2afb32[_0x9d95('0x42')],_0x2afb32[_0x9d95('0x43')]);_0x171dc2[_0x9d95('0x46')]=_[_0x9d95('0x45')](_0x2afb32[_0x9d95('0x42')],qs[_0x9d95('0x47')](_0x292e5f[_0x9d95('0x43')][_0x9d95('0x47')]));_0x171dc2[_0x9d95('0x46')]=_0x171dc2[_0x9d95('0x46')][_0x9d95('0x48')]?_0x171dc2[_0x9d95('0x46')]:_0x2afb32[_0x9d95('0x42')];_0x171dc2[_0x9d95('0x4b')]=qs['sort'](_0x292e5f[_0x9d95('0x43')][_0x9d95('0x4c')]);_0x171dc2['where']=qs['filters'](_[_0x9d95('0x6b')](_0x292e5f['query'],_0x2afb32['filters']));if(_0x292e5f[_0x9d95('0x43')][_0x9d95('0x4f')]){_0x171dc2['where']=_[_0x9d95('0x50')](_0x171dc2[_0x9d95('0x4d')],{'$or':_[_0x9d95('0x3e')](_0x171dc2[_0x9d95('0x46')],function(_0x3640a2){var _0x2abf9a={};_0x2abf9a[_0x3640a2]={'$like':'%'+_0x292e5f[_0x9d95('0x43')][_0x9d95('0x4f')]+'%'};return _0x2abf9a;})});}_0x171dc2=_[_0x9d95('0x50')]({},_0x171dc2,_0x292e5f[_0x9d95('0x52')]);return _0x3fffb1[_0x9d95('0xdd')](_0x171dc2);}})[_0x9d95('0x20')](function(_0x28db1f){if(_0x28db1f){_0x197326=_0x28db1f[_0x9d95('0x48')];if(!_0x292e5f['query'][_0x9d95('0x49')](_0x9d95('0x4a'))){_0x171dc2[_0x9d95('0x2f')]=qs[_0x9d95('0x2f')](_0x292e5f[_0x9d95('0x43')][_0x9d95('0x2f')]);_0x171dc2[_0x9d95('0x2d')]=qs[_0x9d95('0x2d')](_0x292e5f['query'][_0x9d95('0x2d')]);}return _0x3fffb1[_0x9d95('0xdd')](_0x171dc2);}})['then'](function(_0x1d10ab){if(_0x1d10ab){return _0x1d10ab?{'count':_0x197326,'rows':_0x1d10ab}:null;}})[_0x9d95('0x20')](respondWithResult(_0x31aa13,null))[_0x9d95('0x57')](handleError(_0x31aa13,null));}; \ No newline at end of file +var _0x85fc=['model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filters','merge','filter','include','rows','show','params','rawAttributes','includeAll','find','create','body','user','UserProfileSection','userProfileId','Pause','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','nolimit','options','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','twilio','From','Body','MessageSid','skebby','from','sender','text','connectel','clicksend','messageId','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','clickatell','redif','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','name','send','index','map','SmsAccount','fieldName','type','key','query','keys','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85fc,0x180));var _0xc85f=function(_0x141bb7,_0x70b2ad){_0x141bb7=_0x141bb7-0x0;var _0x377848=_0x85fc[_0x141bb7];return _0x377848;};'use strict';var emlformat=require(_0xc85f('0x0'));var rimraf=require(_0xc85f('0x1'));var zipdir=require(_0xc85f('0x2'));var jsonpatch=require(_0xc85f('0x3'));var rp=require(_0xc85f('0x4'));var moment=require(_0xc85f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc85f('0x6'));var util=require(_0xc85f('0x7'));var path=require(_0xc85f('0x8'));var sox=require(_0xc85f('0x9'));var csv=require(_0xc85f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc85f('0xb'));var _=require(_0xc85f('0xc'));var squel=require('squel');var crypto=require(_0xc85f('0xd'));var jsforce=require(_0xc85f('0xe'));var deskjs=require(_0xc85f('0xf'));var toCsv=require(_0xc85f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc85f('0x10'));var qs=require(_0xc85f('0x11'));var as=require(_0xc85f('0x12'));var hardwareService=require(_0xc85f('0x13'));var logger=require(_0xc85f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc85f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc85f('0x16')]=_[_0xc85f('0x17')](config[_0xc85f('0x16')],{'host':_0xc85f('0x18'),'port':0x18eb});var socket=require(_0xc85f('0x19'))(new Redis(config['redis']));require(_0xc85f('0x1a'))['register'](socket);var jayson=require(_0xc85f('0x1b'));var client=jayson[_0xc85f('0x1c')][_0xc85f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3100f0,_0x50a5cf,_0x1e6679,_0x4ae4ff){return new BPromise(function(_0x1961f8,_0x3e7a27){var _0x53f8bc=_0x4ae4ff||client;return _0x53f8bc[_0xc85f('0x1e')](_0x3100f0,_0x1e6679)['then'](function(_0x52e7fa){logger[_0xc85f('0x1f')](_0xc85f('0x20'),_0x50a5cf,_0xc85f('0x21'));logger['debug'](_0xc85f('0x22'),_0x50a5cf,_0xc85f('0x21'),JSON[_0xc85f('0x23')](_0x52e7fa));if(_0x52e7fa[_0xc85f('0x24')]){if(_0x52e7fa[_0xc85f('0x24')][_0xc85f('0x25')]===0x1f4){logger[_0xc85f('0x24')](_0xc85f('0x20'),_0x50a5cf,_0x52e7fa['error'][_0xc85f('0x26')]);return _0x3e7a27(_0x52e7fa[_0xc85f('0x24')][_0xc85f('0x26')]);}logger[_0xc85f('0x24')](_0xc85f('0x20'),_0x50a5cf,_0x52e7fa[_0xc85f('0x24')]['message']);return _0x1961f8(_0x52e7fa['error'][_0xc85f('0x26')]);}else{logger[_0xc85f('0x1f')](_0xc85f('0x20'),_0x50a5cf,_0xc85f('0x21'));_0x1961f8(_0x52e7fa[_0xc85f('0x27')][_0xc85f('0x26')]);}})[_0xc85f('0x28')](function(_0x28538f){logger[_0xc85f('0x24')]('SmsAccount,\x20%s,\x20%s',_0x50a5cf,_0x28538f);_0x3e7a27(_0x28538f);});});}function respondWithStatusCode(_0x466b70,_0x42b09f){_0x42b09f=_0x42b09f||0xcc;return function(_0x10a089){if(_0x10a089){return _0x466b70[_0xc85f('0x29')](_0x42b09f);}return _0x466b70[_0xc85f('0x2a')](_0x42b09f)[_0xc85f('0x2b')]();};}function respondWithResult(_0x5ecaa4,_0x2582a1){_0x2582a1=_0x2582a1||0xc8;return function(_0x3d94ed){if(_0x3d94ed){return _0x5ecaa4['status'](_0x2582a1)[_0xc85f('0x2c')](_0x3d94ed);}};}function respondWithFilteredResult(_0x36a12e,_0x5d0ad5){return function(_0x2d4b3d){if(_0x2d4b3d){var _0x4830db=typeof _0x5d0ad5['offset']==='undefined'&&typeof _0x5d0ad5[_0xc85f('0x2d')]===_0xc85f('0x2e');var _0x1197f8=_0x2d4b3d[_0xc85f('0x2f')];var _0x4c79bb=_0x4830db?0x0:_0x5d0ad5['offset'];var _0x279a41=_0x4830db?_0x2d4b3d[_0xc85f('0x2f')]:_0x5d0ad5['offset']+_0x5d0ad5['limit'];var _0x3d73b7;if(_0x279a41>=_0x1197f8){_0x279a41=_0x1197f8;_0x3d73b7=0xc8;}else{_0x3d73b7=0xce;}_0x36a12e[_0xc85f('0x2a')](_0x3d73b7);return _0x36a12e[_0xc85f('0x30')](_0xc85f('0x31'),_0x4c79bb+'-'+_0x279a41+'/'+_0x1197f8)[_0xc85f('0x2c')](_0x2d4b3d);}return null;};}function patchUpdates(_0x10899f){return function(_0x56fb90){try{jsonpatch[_0xc85f('0x32')](_0x56fb90,_0x10899f,!![]);}catch(_0x1170e8){return BPromise[_0xc85f('0x33')](_0x1170e8);}return _0x56fb90[_0xc85f('0x34')]();};}function saveUpdates(_0x7624e4,_0x50c136){return function(_0x508026){if(_0x508026){return _0x508026[_0xc85f('0x35')](_0x7624e4)[_0xc85f('0x36')](function(_0x5b0ce8){return _0x5b0ce8;});}return null;};}function removeEntity(_0x5f5c3c,_0x433da6){return function(_0x135722){if(_0x135722){return _0x135722[_0xc85f('0x37')]()[_0xc85f('0x36')](function(){var _0x50d304=_0x135722[_0xc85f('0x38')]({'plain':!![]});var _0xc7765b=_0xc85f('0x39');return db[_0xc85f('0x3a')][_0xc85f('0x37')]({'where':{'type':_0xc7765b,'resourceId':_0x50d304['id']}})[_0xc85f('0x36')](function(){return _0x135722;});})[_0xc85f('0x36')](function(){_0x5f5c3c['status'](0xcc)[_0xc85f('0x2b')]();});}};}function handleEntityNotFound(_0x8b22a3,_0x36c5a7){return function(_0x48d773){if(!_0x48d773){_0x8b22a3['sendStatus'](0x194);}return _0x48d773;};}function handleError(_0x4f3237,_0x555d67){_0x555d67=_0x555d67||0x1f4;return function(_0x29e5a9){logger['error'](_0x29e5a9['stack']);if(_0x29e5a9['name']){delete _0x29e5a9[_0xc85f('0x3b')];}_0x4f3237[_0xc85f('0x2a')](_0x555d67)[_0xc85f('0x3c')](_0x29e5a9);};}exports[_0xc85f('0x3d')]=function(_0x553ec0,_0x9e59c8){var _0x21ac30={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x121605={},_0x571b3d={'count':0x0,'rows':[]};var _0x292dec=_[_0xc85f('0x3e')](db[_0xc85f('0x3f')]['rawAttributes'],function(_0x336c85){return{'name':_0x336c85[_0xc85f('0x40')],'type':_0x336c85[_0xc85f('0x41')][_0xc85f('0x42')]};});_0x121605['model']=_[_0xc85f('0x3e')](_0x292dec,_0xc85f('0x3b'));_0x121605[_0xc85f('0x43')]=_[_0xc85f('0x44')](_0x553ec0['query']);_0x121605['filters']=_[_0xc85f('0x45')](_0x121605[_0xc85f('0x46')],_0x121605[_0xc85f('0x43')]);_0x21ac30[_0xc85f('0x47')]=_[_0xc85f('0x45')](_0x121605[_0xc85f('0x46')],qs[_0xc85f('0x48')](_0x553ec0[_0xc85f('0x43')][_0xc85f('0x48')]));_0x21ac30[_0xc85f('0x47')]=_0x21ac30[_0xc85f('0x47')][_0xc85f('0x49')]?_0x21ac30[_0xc85f('0x47')]:_0x121605['model'];if(!_0x553ec0['query'][_0xc85f('0x4a')]('nolimit')){_0x21ac30[_0xc85f('0x2d')]=qs[_0xc85f('0x2d')](_0x553ec0[_0xc85f('0x43')][_0xc85f('0x2d')]);_0x21ac30[_0xc85f('0x4b')]=qs[_0xc85f('0x4b')](_0x553ec0[_0xc85f('0x43')][_0xc85f('0x4b')]);}_0x21ac30[_0xc85f('0x4c')]=qs[_0xc85f('0x4d')](_0x553ec0[_0xc85f('0x43')][_0xc85f('0x4d')]);_0x21ac30[_0xc85f('0x4e')]=qs['filters'](_[_0xc85f('0x4f')](_0x553ec0[_0xc85f('0x43')],_0x121605[_0xc85f('0x50')]),_0x292dec);if(_0x553ec0[_0xc85f('0x43')]['filter']){_0x21ac30[_0xc85f('0x4e')]=_[_0xc85f('0x51')](_0x21ac30[_0xc85f('0x4e')],{'$or':_[_0xc85f('0x3e')](_0x292dec,function(_0x365a37){if(_0x365a37[_0xc85f('0x41')]!=='VIRTUAL'){var _0x2ab802={};_0x2ab802[_0x365a37[_0xc85f('0x3b')]]={'$like':'%'+_0x553ec0['query'][_0xc85f('0x52')]+'%'};return _0x2ab802;}})});}_0x21ac30=_[_0xc85f('0x51')]({},_0x21ac30,_0x553ec0['options']);var _0xcba818={'where':_0x21ac30[_0xc85f('0x4e')]};return db['SmsAccount'][_0xc85f('0x2f')](_0xcba818)[_0xc85f('0x36')](function(_0x1fc58f){_0x571b3d[_0xc85f('0x2f')]=_0x1fc58f;if(_0x553ec0[_0xc85f('0x43')]['includeAll']){_0x21ac30[_0xc85f('0x53')]=[{'all':!![]}];}return db[_0xc85f('0x3f')]['findAll'](_0x21ac30);})[_0xc85f('0x36')](function(_0x2efce8){_0x571b3d[_0xc85f('0x54')]=_0x2efce8;return _0x571b3d;})[_0xc85f('0x36')](respondWithFilteredResult(_0x9e59c8,_0x21ac30))[_0xc85f('0x28')](handleError(_0x9e59c8,null));};exports[_0xc85f('0x55')]=function(_0x4bd772,_0x50ddda){var _0x50f726={'raw':![],'where':{'id':_0x4bd772[_0xc85f('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4a8743={};_0x4a8743[_0xc85f('0x46')]=_[_0xc85f('0x44')](db[_0xc85f('0x3f')][_0xc85f('0x57')]);_0x4a8743[_0xc85f('0x43')]=_['keys'](_0x4bd772[_0xc85f('0x43')]);_0x4a8743[_0xc85f('0x50')]=_[_0xc85f('0x45')](_0x4a8743['model'],_0x4a8743[_0xc85f('0x43')]);_0x50f726[_0xc85f('0x47')]=_[_0xc85f('0x45')](_0x4a8743[_0xc85f('0x46')],qs[_0xc85f('0x48')](_0x4bd772[_0xc85f('0x43')][_0xc85f('0x48')]));_0x50f726[_0xc85f('0x47')]=_0x50f726[_0xc85f('0x47')]['length']?_0x50f726[_0xc85f('0x47')]:_0x4a8743[_0xc85f('0x46')];if(_0x4bd772['query'][_0xc85f('0x58')]){_0x50f726['include']=[{'all':!![]}];}_0x50f726=_[_0xc85f('0x51')]({},_0x50f726,_0x4bd772['options']);return db['SmsAccount'][_0xc85f('0x59')](_0x50f726)['then'](handleEntityNotFound(_0x50ddda,null))[_0xc85f('0x36')](respondWithResult(_0x50ddda,null))['catch'](handleError(_0x50ddda,null));};exports[_0xc85f('0x5a')]=function(_0x2b2415,_0x31c2c2){return db['SmsAccount'][_0xc85f('0x5a')](_0x2b2415[_0xc85f('0x5b')],{})['then'](function(_0x4a4a0d){var _0x3f55e7=_0x2b2415[_0xc85f('0x5c')][_0xc85f('0x38')]({'plain':!![]});if(!_0x3f55e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f55e7['role']===_0xc85f('0x5c')){var _0x1ae86a=_0x4a4a0d[_0xc85f('0x38')]({'plain':!![]});var _0x438e87=_0xc85f('0x39');return db[_0xc85f('0x5d')]['find']({'where':{'name':_0x438e87,'userProfileId':_0x3f55e7[_0xc85f('0x5e')]},'raw':!![]})[_0xc85f('0x36')](function(_0x2e8673){if(_0x2e8673&&_0x2e8673['autoAssociation']===0x0){return db[_0xc85f('0x3a')]['create']({'name':_0x1ae86a[_0xc85f('0x3b')],'resourceId':_0x1ae86a['id'],'type':_0x2e8673[_0xc85f('0x3b')],'sectionId':_0x2e8673['id']},{})[_0xc85f('0x36')](function(){return _0x4a4a0d;});}else{return _0x4a4a0d;}})[_0xc85f('0x28')](function(_0x3587fc){logger[_0xc85f('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3587fc);throw _0x3587fc;});}return _0x4a4a0d;})[_0xc85f('0x36')](respondWithResult(_0x31c2c2,0xc9))[_0xc85f('0x28')](handleError(_0x31c2c2,null));};exports[_0xc85f('0x35')]=function(_0x5bc54c,_0xfb9df2){if(_0x5bc54c[_0xc85f('0x5b')]['id']){delete _0x5bc54c[_0xc85f('0x5b')]['id'];}return db[_0xc85f('0x3f')]['find']({'where':{'id':_0x5bc54c['params']['id']},'include':[{'model':db[_0xc85f('0x5f')],'as':'mandatoryDispositionPause'}]})[_0xc85f('0x36')](handleEntityNotFound(_0xfb9df2,null))[_0xc85f('0x36')](saveUpdates(_0x5bc54c[_0xc85f('0x5b')],null))[_0xc85f('0x36')](respondWithResult(_0xfb9df2,null))[_0xc85f('0x28')](handleError(_0xfb9df2,null));};exports['destroy']=function(_0x392b18,_0x44d358){return db[_0xc85f('0x3f')][_0xc85f('0x59')]({'where':{'id':_0x392b18[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x44d358,null))[_0xc85f('0x36')](removeEntity(_0x44d358,null))[_0xc85f('0x28')](handleError(_0x44d358,null));};exports[_0xc85f('0x60')]=function(_0x51887c,_0xd00346){return db['SmsAccount'][_0xc85f('0x60')]()['then'](respondWithResult(_0xd00346,null))['catch'](handleError(_0xd00346,null));};exports[_0xc85f('0x61')]=function(_0x356f4a,_0x11fb9c,_0x3822bb){if(_0x356f4a[_0xc85f('0x5b')]['id']){delete _0x356f4a[_0xc85f('0x5b')]['id'];}return db[_0xc85f('0x3f')]['find']({'where':{'id':_0x356f4a['params']['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x11fb9c,null))['then'](function(_0x3fa5a5){if(_0x3fa5a5){_0x356f4a[_0xc85f('0x5b')][_0xc85f('0x62')]=_0x3fa5a5['id'];return db['Disposition'][_0xc85f('0x5a')](_0x356f4a[_0xc85f('0x5b')]);}})[_0xc85f('0x36')](respondWithResult(_0x11fb9c,null))['catch'](handleError(_0x11fb9c,null));};exports[_0xc85f('0x63')]=function(_0x37fe27,_0x48cfc9,_0x18be84){var _0x3d7661={'raw':![],'where':{}};var _0x412946={};var _0x1e18e8={'count':0x0,'rows':[]};return db[_0xc85f('0x3f')][_0xc85f('0x64')]({'where':{'id':_0x37fe27['params']['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x48cfc9,null))[_0xc85f('0x36')](function(_0x3421fa){if(_0x3421fa){_0x412946['model']=_[_0xc85f('0x44')](db[_0xc85f('0x65')][_0xc85f('0x57')]);_0x412946[_0xc85f('0x43')]=_[_0xc85f('0x44')](_0x37fe27[_0xc85f('0x43')]);_0x412946[_0xc85f('0x50')]=_[_0xc85f('0x45')](_0x412946['model'],_0x412946[_0xc85f('0x43')]);_0x3d7661[_0xc85f('0x47')]=_[_0xc85f('0x45')](_0x412946['model'],qs[_0xc85f('0x48')](_0x37fe27['query'][_0xc85f('0x48')]));_0x3d7661['attributes']=_0x3d7661[_0xc85f('0x47')][_0xc85f('0x49')]?_0x3d7661[_0xc85f('0x47')]:_0x412946['model'];if(!_0x37fe27[_0xc85f('0x43')][_0xc85f('0x4a')](_0xc85f('0x66'))){_0x3d7661['limit']=qs['limit'](_0x37fe27['query']['limit']);_0x3d7661[_0xc85f('0x4b')]=qs[_0xc85f('0x4b')](_0x37fe27['query']['offset']);}_0x3d7661['order']=qs[_0xc85f('0x4d')](_0x37fe27['query'][_0xc85f('0x4d')]);_0x3d7661[_0xc85f('0x4e')]=qs['filters'](_[_0xc85f('0x4f')](_0x37fe27[_0xc85f('0x43')],_0x412946[_0xc85f('0x50')]));_0x3d7661[_0xc85f('0x4e')][_0xc85f('0x62')]=_0x3421fa['id'];if(_0x37fe27['query'][_0xc85f('0x52')]){_0x3d7661[_0xc85f('0x4e')]=_[_0xc85f('0x51')](_0x3d7661[_0xc85f('0x4e')],{'$or':_['map'](_0x3d7661[_0xc85f('0x47')],function(_0x6d6ced){var _0x10c28d={};_0x10c28d[_0x6d6ced]={'$like':'%'+_0x37fe27['query'][_0xc85f('0x52')]+'%'};return _0x10c28d;})});}_0x3d7661=_[_0xc85f('0x51')]({},_0x3d7661,_0x37fe27[_0xc85f('0x67')]);return db[_0xc85f('0x65')]['count']({'where':_0x3d7661[_0xc85f('0x4e')]})[_0xc85f('0x36')](function(_0x47eaf2){_0x1e18e8['count']=_0x47eaf2;if(_0x37fe27[_0xc85f('0x43')]['includeAll']){_0x3d7661[_0xc85f('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xc85f('0x68')](_0x3d7661);})[_0xc85f('0x36')](function(_0x2b021){_0x1e18e8[_0xc85f('0x54')]=_0x2b021;return _0x1e18e8;});}})[_0xc85f('0x36')](respondWithFilteredResult(_0x48cfc9,_0x3d7661))[_0xc85f('0x28')](handleError(_0x48cfc9,null));};exports[_0xc85f('0x69')]=function(_0x23721a,_0x5b139c,_0x482c50){return db['SmsAccount'][_0xc85f('0x59')]({'where':{'id':_0x23721a[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x5b139c,null))[_0xc85f('0x36')](function(_0x36e9f9){if(_0x36e9f9){return _0x36e9f9['removeDispositions'](_0x23721a[_0xc85f('0x43')]['ids']);}})[_0xc85f('0x36')](respondWithStatusCode(_0x5b139c,null))[_0xc85f('0x28')](handleError(_0x5b139c,null));};exports[_0xc85f('0x6a')]=function(_0xed353c,_0x3e6bd8,_0x5134c1){if(_0xed353c['body']['id']){delete _0xed353c[_0xc85f('0x5b')]['id'];}return db[_0xc85f('0x3f')]['find']({'where':{'id':_0xed353c['params']['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x3e6bd8,null))[_0xc85f('0x36')](function(_0x5e0780){if(_0x5e0780){_0xed353c[_0xc85f('0x5b')][_0xc85f('0x62')]=_0x5e0780['id'];return db[_0xc85f('0x6b')][_0xc85f('0x5a')](_0xed353c['body']);}})[_0xc85f('0x36')](respondWithResult(_0x3e6bd8,null))[_0xc85f('0x28')](handleError(_0x3e6bd8,null));};exports[_0xc85f('0x6c')]=function(_0x3c457b,_0x42394a,_0x391bb2){var _0x477d8f={'raw':![],'where':{}};var _0x3f32ee={};var _0x5b665e={'count':0x0,'rows':[]};return db[_0xc85f('0x3f')][_0xc85f('0x64')]({'where':{'id':_0x3c457b[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x42394a,null))['then'](function(_0x691bbb){if(_0x691bbb){_0x3f32ee['model']=_[_0xc85f('0x44')](db[_0xc85f('0x6b')][_0xc85f('0x57')]);_0x3f32ee[_0xc85f('0x43')]=_[_0xc85f('0x44')](_0x3c457b['query']);_0x3f32ee[_0xc85f('0x50')]=_[_0xc85f('0x45')](_0x3f32ee[_0xc85f('0x46')],_0x3f32ee[_0xc85f('0x43')]);_0x477d8f[_0xc85f('0x47')]=_[_0xc85f('0x45')](_0x3f32ee['model'],qs[_0xc85f('0x48')](_0x3c457b[_0xc85f('0x43')]['fields']));_0x477d8f['attributes']=_0x477d8f[_0xc85f('0x47')][_0xc85f('0x49')]?_0x477d8f[_0xc85f('0x47')]:_0x3f32ee[_0xc85f('0x46')];if(!_0x3c457b['query']['hasOwnProperty'](_0xc85f('0x66'))){_0x477d8f['limit']=qs[_0xc85f('0x2d')](_0x3c457b[_0xc85f('0x43')][_0xc85f('0x2d')]);_0x477d8f[_0xc85f('0x4b')]=qs['offset'](_0x3c457b['query']['offset']);}_0x477d8f['order']=qs[_0xc85f('0x4d')](_0x3c457b[_0xc85f('0x43')]['sort']);_0x477d8f[_0xc85f('0x4e')]=qs[_0xc85f('0x50')](_[_0xc85f('0x4f')](_0x3c457b['query'],_0x3f32ee[_0xc85f('0x50')]));_0x477d8f['where'][_0xc85f('0x62')]=_0x691bbb['id'];if(_0x3c457b[_0xc85f('0x43')]['filter']){_0x477d8f[_0xc85f('0x4e')]=_[_0xc85f('0x51')](_0x477d8f[_0xc85f('0x4e')],{'$or':_[_0xc85f('0x3e')](_0x477d8f[_0xc85f('0x47')],function(_0x12ff9f){var _0x33e0a0={};_0x33e0a0[_0x12ff9f]={'$like':'%'+_0x3c457b[_0xc85f('0x43')]['filter']+'%'};return _0x33e0a0;})});}_0x477d8f=_[_0xc85f('0x51')]({},_0x477d8f,_0x3c457b[_0xc85f('0x67')]);return db[_0xc85f('0x6b')][_0xc85f('0x2f')]({'where':_0x477d8f[_0xc85f('0x4e')]})[_0xc85f('0x36')](function(_0x58c1c1){_0x5b665e[_0xc85f('0x2f')]=_0x58c1c1;if(_0x3c457b[_0xc85f('0x43')]['includeAll']){_0x477d8f[_0xc85f('0x53')]=[{'all':!![]}];}return db[_0xc85f('0x6b')][_0xc85f('0x68')](_0x477d8f);})[_0xc85f('0x36')](function(_0x237c31){_0x5b665e['rows']=_0x237c31;return _0x5b665e;});}})[_0xc85f('0x36')](respondWithFilteredResult(_0x42394a,_0x477d8f))[_0xc85f('0x28')](handleError(_0x42394a,null));};exports['removeAnswers']=function(_0x2b0ac4,_0x20eb03,_0x53b010){return db[_0xc85f('0x3f')][_0xc85f('0x59')]({'where':{'id':_0x2b0ac4[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x20eb03,null))['then'](function(_0x2720b8){if(_0x2720b8){return _0x2720b8['removeAnswers'](_0x2b0ac4[_0xc85f('0x43')][_0xc85f('0x6d')]);}})[_0xc85f('0x36')](respondWithStatusCode(_0x20eb03,null))[_0xc85f('0x28')](handleError(_0x20eb03,null));};exports['notify']=function(_0x2d602d,_0x119779,_0x36674b){var _0x3bb99c={'channel':_0xc85f('0x6e')};var _0x6f96bf=[];var _0x5d62b6=[];var _0x339d1f={};return db[_0xc85f('0x3f')][_0xc85f('0x59')]({'where':{'id':_0x2d602d['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xc85f('0x6f')}]})['then'](handleEntityNotFound(_0x119779,null))[_0xc85f('0x36')](function(_0x14e5b1){_0x3bb99c[_0xc85f('0x70')]=_0x14e5b1;_0x3bb99c[_0xc85f('0x71')]=_[_0xc85f('0x72')](_0x14e5b1[_0xc85f('0x6f')],[_0xc85f('0x73')],[_0xc85f('0x74')]);if(_0x3bb99c[_0xc85f('0x70')][_0xc85f('0x6f')]){delete _0x3bb99c[_0xc85f('0x70')][_0xc85f('0x6f')];}return db[_0xc85f('0x75')][_0xc85f('0x60')]();})[_0xc85f('0x36')](function(_0x34cac7){if(!_0x34cac7){throw new db[(_0xc85f('0x76'))][(_0xc85f('0x77'))]('no\x20available\x20attributes');}_0x6f96bf=_['difference'](_['keys'](_0x34cac7),[_0xc85f('0x78'),_0xc85f('0x79')]);_0x5d62b6=_['difference'](_[_0xc85f('0x44')](_0x34cac7),['createdAt','updatedAt',_0xc85f('0x7a'),_0xc85f('0x7b')]);_0x3bb99c[_0xc85f('0x5b')]={'mapKey':'mobile'};if(_0x3bb99c['account'][_0xc85f('0x41')]){switch(_0x3bb99c['account'][_0xc85f('0x41')]){case _0xc85f('0x7c'):_0x3bb99c[_0xc85f('0x5b')]['from']=_0x2d602d['body'][_0xc85f('0x7d')];_0x3bb99c['body'][_0xc85f('0x5b')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x7e')];_0x3bb99c[_0xc85f('0x5b')]['messageId']=_0x2d602d['body'][_0xc85f('0x7f')];break;case _0xc85f('0x80'):_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')]='+'+_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x82')];_0x3bb99c[_0xc85f('0x5b')]['body']=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x83')];break;case _0xc85f('0x84'):_0x3bb99c['body'][_0xc85f('0x81')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x81')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x5b')]=_0x2d602d[_0xc85f('0x5b')]['message'];break;case _0xc85f('0x85'):_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')]=_0x2d602d[_0xc85f('0x5b')]['from'];_0x3bb99c[_0xc85f('0x5b')]['body']=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x5b')];_0x3bb99c['body'][_0xc85f('0x86')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x87')];break;case _0xc85f('0x88'):_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')]=_0x2d602d['body']['From'];_0x3bb99c['body'][_0xc85f('0x5b')]=_0x2d602d[_0xc85f('0x5b')]['Text'];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x86')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x89')];break;case _0xc85f('0x8a'):_0x3bb99c[_0xc85f('0x5b')]['from']='+'+_0x2d602d['body'][_0xc85f('0x8b')][0x0][_0xc85f('0x81')];_0x3bb99c['body']['body']=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x8b')][0x0][_0xc85f('0x83')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x86')]=_0x2d602d[_0xc85f('0x5b')]['results'][0x0][_0xc85f('0x86')];break;case _0xc85f('0x8c'):_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')]=_0x2d602d['body'][_0xc85f('0x8d')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x5b')]=_0x2d602d['body'][_0xc85f('0x8e')][_0xc85f('0x26')];break;case'clickatell':_0x3bb99c['body'][_0xc85f('0x81')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x8f')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x5b')]=_0x2d602d['body'][_0xc85f('0x83')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x86')]=_0x2d602d['body']['replyMessageId'];break;case _0xc85f('0x90'):_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x86')]=_0x2d602d[_0xc85f('0x5b')][0x0][_0xc85f('0x26')]['id'];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')]=_0x2d602d[_0xc85f('0x5b')][0x0][_0xc85f('0x26')][_0xc85f('0x81')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x5b')]=_0x2d602d[_0xc85f('0x5b')][0x0][_0xc85f('0x26')]['text'];break;case _0xc85f('0x91'):_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x81')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x5b')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x26')];_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x86')]=_0x2d602d[_0xc85f('0x5b')][_0xc85f('0x92')];break;}}if(_0x3bb99c[_0xc85f('0x5b')]['id']){delete _0x3bb99c['body']['id'];}if(_[_0xc85f('0x93')](_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')])){throw new db[(_0xc85f('0x76'))]['ValidationError'](_0xc85f('0x94'));}if(_[_0xc85f('0x93')](_0x3bb99c['body'][_0xc85f('0x5b')])||_0x3bb99c[_0xc85f('0x5b')]['body']===''){throw new db['Sequelize'][(_0xc85f('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc85f('0x93')](_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x95')])){throw new db[(_0xc85f('0x76'))][(_0xc85f('0x77'))](_0xc85f('0x96')+_0x5d62b6);}if(!_[_0xc85f('0x97')](_0x5d62b6,_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x95')])){throw new db[(_0xc85f('0x76'))]['ValidationError'](_0xc85f('0x98')+_0x5d62b6);}_0x339d1f[_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x95')]]=_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')];return db[_0xc85f('0x99')][_0xc85f('0x59')]({'where':{'id':_0x3bb99c['account'][_0xc85f('0x7b')]},'include':[{'model':db[_0xc85f('0x75')],'as':_0xc85f('0x9a'),'where':_0x339d1f,'limit':0x1,'order':[[_0xc85f('0x79'),_0xc85f('0x9b')]]}]});})[_0xc85f('0x36')](handleEntityNotFound(_0x119779,null))[_0xc85f('0x36')](function(_0x385649){if(_0x385649){_0x3bb99c[_0xc85f('0x9c')]=_['omit'](_0x385649,['Contacts']);if(_0x385649[_0xc85f('0x9a')][_0xc85f('0x49')]){return _0x385649[_0xc85f('0x9a')][0x0];}var _0x895c8f=_[_0xc85f('0x17')](_0x3bb99c['body'],{'firstName':_0x3bb99c[_0xc85f('0x5b')]['from'],'ListId':_0x385649['id']});_0x895c8f[_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x95')]]=_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')];return db['CmContact']['create'](_0x895c8f,{'fields':_0x6f96bf,'raw':!![]});}})[_0xc85f('0x36')](handleEntityNotFound(_0x119779,null))[_0xc85f('0x36')](function(_0x351487){if(_0x351487){_0x3bb99c[_0xc85f('0x9d')]=_0x351487;var _0x51d0e4={'ContactId':_0x351487['id'],'phone':_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')],'SmsAccountId':_0x2d602d[_0xc85f('0x56')]['id']};var _0x13f8ad={'ContactId':_0x351487['id'],'SmsAccountId':_0x2d602d[_0xc85f('0x56')]['id'],'closed':![]};return db[_0xc85f('0x9e')][_0xc85f('0x59')]({'where':_0x13f8ad})[_0xc85f('0x36')](function(_0x11c295){if(_0x11c295){return[_0x11c295,![]];}return db['SmsInteraction'][_0xc85f('0x5a')](_0x51d0e4)[_0xc85f('0x36')](function(_0x4957cd){return[_0x4957cd,!![]];});});}})[_0xc85f('0x9f')](function(_0x3b85d8,_0x301b00){_0x3bb99c[_0xc85f('0xa0')]=_0x3b85d8[_0xc85f('0x38')]({'plain':!![]});_0x3bb99c[_0xc85f('0xa0')][_0xc85f('0xa1')]=![];if(_0x301b00){if(_0x3bb99c['account']['autoclose']){_0x3bb99c[_0xc85f('0x71')][_0xc85f('0xa2')]({'id':0x0,'priority':_0x3bb99c[_0xc85f('0x71')][_0xc85f('0x49')]+0x1,'app':_0xc85f('0xa3'),'appdata':_0xc85f('0xa4'),'interval':_0xc85f('0xa5')});}_0x3bb99c[_0xc85f('0xa0')][_0xc85f('0xa1')]=!![];}return db[_0xc85f('0xa6')][_0xc85f('0x5a')]({'phone':_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x81')],'messageId':_0x3bb99c[_0xc85f('0x5b')][_0xc85f('0x86')],'body':_0x3bb99c['body'][_0xc85f('0x5b')],'SmsAccountId':_0x2d602d['params']['id'],'SmsInteractionId':_0x3b85d8['id'],'direction':'in','ContactId':_0x3b85d8[_0xc85f('0xa7')],'AttachmentId':_0x3bb99c[_0xc85f('0x5b')]['AttachmentId']});})[_0xc85f('0x36')](function(_0x399c83){_0x3bb99c['message']=_0x399c83;if(_0x3bb99c[_0xc85f('0xa0')][_0xc85f('0xa8')]){return db[_0xc85f('0xa9')][_0xc85f('0x59')]({'attributes':['id',_0xc85f('0x3b')],'where':{'id':_0x3bb99c[_0xc85f('0xa0')][_0xc85f('0xa8')]}})[_0xc85f('0x36')](function(_0x398223){if(_0x398223){_0x3bb99c[_0xc85f('0x71')][_0xc85f('0xaa')]({'id':0x0,'priority':0x0,'app':_0xc85f('0xab'),'appdata':_0x398223[_0xc85f('0x3b')]+','+(_0x3bb99c['account']['waitForTheAssignedAgent']||0xa),'interval':_0xc85f('0xa5')});}return respondWithRpcPromise('Start','startRouting',_0x3bb99c);});}return respondWithRpcPromise('Start',_0xc85f('0xac'),_0x3bb99c);})['then'](function(_0x11d6be){if(_0x11d6be){var _0x132164=0xc8;var _0x2b8ca9=_0xc85f('0xad');logger[_0xc85f('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2b8ca9,_0x132164,'entity\x20found');logger[_0xc85f('0xae')](_0xc85f('0xaf'),_0x2b8ca9,_0x132164,_0xc85f('0xb0'),JSON['stringify'](_0x11d6be));if(_0x3bb99c[_0xc85f('0x70')][_0xc85f('0x41')]===_0xc85f('0x7c')){return _0x119779[_0xc85f('0x2a')](_0x132164)[_0xc85f('0x30')](_0xc85f('0xb1'),_0xc85f('0xb2'))[_0xc85f('0x3c')](_0xc85f('0xb3'));}else{return _0x119779[_0xc85f('0x2a')](_0x132164)[_0xc85f('0x2c')](_0x11d6be);}}})[_0xc85f('0x28')](handleError(_0x119779,null));};exports['addApplications']=function(_0x3aef07,_0x3ce7ab){var _0x34ccf5=_0x3aef07[_0xc85f('0x56')]['id'];var _0x4ddd1f=_0x3aef07[_0xc85f('0x5b')];var _0x5468c4=0xc8;var _0x56645c=null;return db[_0xc85f('0xb4')][_0xc85f('0xb5')]({'isolationLevel':db[_0xc85f('0xb4')][_0xc85f('0xb6')]['ISOLATION_LEVELS'][_0xc85f('0xb7')]},function(_0x311ee4){return db[_0xc85f('0x3f')][_0xc85f('0x64')]({'where':{'id':_0x34ccf5},'transaction':_0x311ee4})[_0xc85f('0x36')](function(_0x156766){if(_0x156766){return db[_0xc85f('0xb8')][_0xc85f('0x37')]({'where':{'SmsAccountId':_0x34ccf5},'transaction':_0x311ee4})[_0xc85f('0x36')](function(){var _0x581c55=_[_0xc85f('0x3e')](_0x4ddd1f,function(_0x2e79f5){_0x2e79f5[_0xc85f('0x62')]=_0x34ccf5;return _0x2e79f5;});return db[_0xc85f('0xb8')][_0xc85f('0xb9')](_0x581c55,{'transaction':_0x311ee4});});}else{_0x5468c4=0x194;_0x56645c=[];}});})['then'](function(){if(_0x5468c4!==0x194){return db[_0xc85f('0xb8')][_0xc85f('0xba')]({'where':{'SmsAccountId':_0x34ccf5},'order':_0xc85f('0x73')})['then'](function(_0x5de796){_0x56645c=_0x5de796;});}})['catch'](function(_0x5f5876){_0x5468c4=0x1f4;logger[_0xc85f('0x24')](_0x5f5876[_0xc85f('0xbb')]);if(_0x5f5876[_0xc85f('0x3b')]){delete _0x5f5876[_0xc85f('0x3b')];}_0x56645c=_0x5f5876;})[_0xc85f('0xbc')](function(){if(_0x56645c===null){_0x3ce7ab['sendStatus'](_0x5468c4);}else{if(_0x5468c4===0x1f4){_0x3ce7ab[_0xc85f('0x2a')](_0x5468c4)[_0xc85f('0x3c')](_0x56645c);}else{_0x3ce7ab[_0xc85f('0x2a')](_0x5468c4)[_0xc85f('0x2c')](_0x56645c);}}});};exports[_0xc85f('0xbd')]=function(_0x4c5061,_0x14c6f3,_0x4dadc8){var _0x5778bc={};var _0x1a7762={};var _0x39ad5f;var _0x4c97bc;return db[_0xc85f('0x3f')]['findOne']({'where':{'id':_0x4c5061[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x14c6f3,null))['then'](function(_0x116de6){if(_0x116de6){_0x39ad5f=_0x116de6;_0x1a7762[_0xc85f('0x46')]=_['keys'](db[_0xc85f('0xb8')][_0xc85f('0x57')]);_0x1a7762[_0xc85f('0x43')]=_['keys'](_0x4c5061[_0xc85f('0x43')]);_0x1a7762[_0xc85f('0x50')]=_[_0xc85f('0x45')](_0x1a7762[_0xc85f('0x46')],_0x1a7762[_0xc85f('0x43')]);_0x5778bc[_0xc85f('0x47')]=_['intersection'](_0x1a7762['model'],qs[_0xc85f('0x48')](_0x4c5061[_0xc85f('0x43')]['fields']));_0x5778bc[_0xc85f('0x47')]=_0x5778bc[_0xc85f('0x47')]['length']?_0x5778bc[_0xc85f('0x47')]:_0x1a7762['model'];_0x5778bc[_0xc85f('0x4c')]=qs[_0xc85f('0x4d')](_0x4c5061[_0xc85f('0x43')][_0xc85f('0x4d')]);_0x5778bc[_0xc85f('0x4e')]=qs[_0xc85f('0x50')](_['pick'](_0x4c5061[_0xc85f('0x43')],_0x1a7762[_0xc85f('0x50')]));if(_0x4c5061['query'][_0xc85f('0x52')]){_0x5778bc[_0xc85f('0x4e')]=_[_0xc85f('0x51')](_0x5778bc[_0xc85f('0x4e')],{'$or':_[_0xc85f('0x3e')](_0x5778bc['attributes'],function(_0x368c7e){var _0x2f741a={};_0x2f741a[_0x368c7e]={'$like':'%'+_0x4c5061['query'][_0xc85f('0x52')]+'%'};return _0x2f741a;})});}_0x5778bc=_[_0xc85f('0x51')]({},_0x5778bc,_0x4c5061[_0xc85f('0x67')]);return _0x39ad5f[_0xc85f('0xbd')](_0x5778bc);}})[_0xc85f('0x36')](function(_0x47280c){if(_0x47280c){_0x4c97bc=_0x47280c['length'];if(!_0x4c5061[_0xc85f('0x43')][_0xc85f('0x4a')]('nolimit')){_0x5778bc[_0xc85f('0x2d')]=qs[_0xc85f('0x2d')](_0x4c5061[_0xc85f('0x43')]['limit']);_0x5778bc['offset']=qs[_0xc85f('0x4b')](_0x4c5061[_0xc85f('0x43')][_0xc85f('0x4b')]);}return _0x39ad5f[_0xc85f('0xbd')](_0x5778bc);}})[_0xc85f('0x36')](function(_0x23bcea){if(_0x23bcea){return _0x23bcea?{'count':_0x4c97bc,'rows':_0x23bcea}:null;}})[_0xc85f('0x36')](respondWithResult(_0x14c6f3,null))['catch'](handleError(_0x14c6f3,null));};exports[_0xc85f('0xbe')]=function(_0x2a9000,_0x4982a3,_0x1ae41e){var _0x169943={'raw':![],'where':{}};var _0x329c58={};var _0x3c9261={'count':0x0,'rows':[]};return db[_0xc85f('0x3f')][_0xc85f('0x64')]({'where':{'id':_0x2a9000[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x4982a3,null))[_0xc85f('0x36')](function(_0x2c737e){if(_0x2c737e){_0x329c58[_0xc85f('0x46')]=_['keys'](db[_0xc85f('0x9e')]['rawAttributes']);_0x329c58[_0xc85f('0x43')]=_['keys'](_0x2a9000[_0xc85f('0x43')]);_0x329c58[_0xc85f('0x50')]=_['intersection'](_0x329c58[_0xc85f('0x46')],_0x329c58[_0xc85f('0x43')]);_0x169943[_0xc85f('0x47')]=_['intersection'](_0x329c58['model'],qs['fields'](_0x2a9000[_0xc85f('0x43')][_0xc85f('0x48')]));_0x169943[_0xc85f('0x47')]=_0x169943[_0xc85f('0x47')][_0xc85f('0x49')]?_0x169943[_0xc85f('0x47')]:_0x329c58[_0xc85f('0x46')];if(!_0x2a9000[_0xc85f('0x43')][_0xc85f('0x4a')]('nolimit')){_0x169943[_0xc85f('0x2d')]=qs[_0xc85f('0x2d')](_0x2a9000[_0xc85f('0x43')][_0xc85f('0x2d')]);_0x169943['offset']=qs['offset'](_0x2a9000[_0xc85f('0x43')]['offset']);}_0x169943[_0xc85f('0x4c')]=qs[_0xc85f('0x4d')](_0x2a9000[_0xc85f('0x43')][_0xc85f('0x4d')]);_0x169943['where']=qs[_0xc85f('0x50')](_[_0xc85f('0x4f')](_0x2a9000[_0xc85f('0x43')],_0x329c58['filters']));_0x169943[_0xc85f('0x4e')]['SmsAccountId']=_0x2c737e['id'];if(_0x2a9000[_0xc85f('0x43')][_0xc85f('0x52')]){_0x169943[_0xc85f('0x4e')]=_[_0xc85f('0x51')](_0x169943[_0xc85f('0x4e')],{'$or':_[_0xc85f('0x3e')](_0x169943[_0xc85f('0x47')],function(_0x4fcd42){var _0x1dd418={};_0x1dd418[_0x4fcd42]={'$like':'%'+_0x2a9000[_0xc85f('0x43')]['filter']+'%'};return _0x1dd418;})});}_0x169943=_[_0xc85f('0x51')]({},_0x169943,_0x2a9000[_0xc85f('0x67')]);return db[_0xc85f('0x9e')][_0xc85f('0x2f')]({'where':_0x169943[_0xc85f('0x4e')]})['then'](function(_0x488d9c){_0x3c9261[_0xc85f('0x2f')]=_0x488d9c;if(_0x2a9000[_0xc85f('0x43')][_0xc85f('0x58')]){_0x169943[_0xc85f('0x53')]=[{'model':db['CmContact'],'as':_0xc85f('0xbf'),'required':![]},{'model':db[_0xc85f('0xa9')],'as':_0xc85f('0xc0'),'attributes':['name',_0xc85f('0xc1'),_0xc85f('0xc2')],'required':![]},{'model':db[_0xc85f('0xc3')],'as':'Tags','attributes':['id',_0xc85f('0x3b'),'color'],'where':_0x2a9000[_0xc85f('0x43')][_0xc85f('0xc4')]?{'id':_0x2a9000['query']['tag']}:undefined,'required':_0x2a9000[_0xc85f('0x43')][_0xc85f('0xc4')]?!![]:![]}];}return db['SmsInteraction'][_0xc85f('0x68')](_0x169943);})['then'](function(_0x15b977){_0x3c9261[_0xc85f('0x54')]=_0x15b977;return _0x3c9261;});}})[_0xc85f('0x36')](respondWithFilteredResult(_0x4982a3,_0x169943))['catch'](handleError(_0x4982a3,null));};exports[_0xc85f('0x3c')]=function(_0x3ed9c1,_0x5f4955,_0x25ad0f){var _0x2605aa,_0x35d635,_0x1e45db;if(_[_0xc85f('0x93')](_0x3ed9c1['body']['body'])||_0x3ed9c1[_0xc85f('0x5b')][_0xc85f('0x5b')]===''){throw new db[(_0xc85f('0x76'))][(_0xc85f('0x77'))](_0xc85f('0xc5'));}if(_[_0xc85f('0x93')](_0x3ed9c1[_0xc85f('0x5b')]['to'])){throw new db['Sequelize'][(_0xc85f('0x77'))]('to\x20is\x20mandatory');}_0x2605aa=_0x3ed9c1[_0xc85f('0x5b')]['to'];return db[_0xc85f('0x3f')][_0xc85f('0x59')]({'where':{'id':_0x3ed9c1['params']['id']},'include':[{'model':db[_0xc85f('0x99')],'as':_0xc85f('0xc6'),'include':[{'model':db[_0xc85f('0x75')],'as':'Contacts','where':{'mobile':_0x2605aa},'limit':0x1,'order':[[_0xc85f('0x79'),_0xc85f('0x9b')]]}]}]})[_0xc85f('0x36')](handleEntityNotFound(_0x5f4955,null))[_0xc85f('0x36')](function(_0x5270e9){if(_0x5270e9&&_0x5270e9[_0xc85f('0xc6')]){_0x35d635=_0x5270e9['get']({'plain':!![]});if(_0x35d635['List']&&_0x35d635[_0xc85f('0xc6')][_0xc85f('0x9a')]['length']){return _0x35d635[_0xc85f('0xc6')][_0xc85f('0x9a')][0x0];}return db[_0xc85f('0x75')][_0xc85f('0x5a')](_[_0xc85f('0x17')](_0x3ed9c1[_0xc85f('0x5b')],{'firstName':_0x2605aa,'mobile':_0x2605aa,'phone':_0x2605aa,'ListId':_0x35d635['ListId']}));}})[_0xc85f('0x36')](handleEntityNotFound(_0x5f4955,null))[_0xc85f('0x36')](function(_0x1bcc8d){if(_0x1bcc8d){_0x1e45db=_0x1bcc8d;return db[_0xc85f('0x9e')]['find']({'where':{'ContactId':_0x1e45db['id'],'closed':![],'SmsAccountId':_0x35d635['id']}})[_0xc85f('0x36')](function(_0x450267){if(_0x450267){return[_0x450267,![]];}return db[_0xc85f('0x9e')][_0xc85f('0x5a')]({'UserId':_0x3ed9c1[_0xc85f('0x5c')]['id'],'ContactId':_0x1e45db['id'],'SmsAccountId':_0x35d635['id'],'phone':_0x2605aa,'firstMsgDirection':_0xc85f('0xc7'),'Messages':[_[_0xc85f('0x51')](_0x3ed9c1['body'],{'read':![],'body':_0x3ed9c1[_0xc85f('0x5b')][_0xc85f('0x5b')],'phone':_0x2605aa,'SmsAccountId':_0x35d635['id'],'UserId':_0x3ed9c1[_0xc85f('0x5c')]['id'],'ContactId':_0x1e45db['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xc85f('0xc8')}]})['then'](function(_0x59837c){return[_0x59837c,!![]];});});}})[_0xc85f('0x9f')](function(_0x174295,_0xc9301a){if(_0xc9301a){return _0x174295;}return db['SmsMessage']['create'](_[_0xc85f('0x51')](_0x3ed9c1[_0xc85f('0x5b')],{'read':![],'body':_0x3ed9c1[_0xc85f('0x5b')][_0xc85f('0x5b')],'phone':_0x2605aa,'SmsAccountId':_0x35d635['id'],'SmsInteractionId':_0x174295['id'],'UserId':_0x3ed9c1[_0xc85f('0x5c')]['id'],'ContactId':_0x1e45db['id']}))[_0xc85f('0x36')](function(_0x11a192){_0x174295[_0xc85f('0xc9')][_0xc85f('0xc8')]=[];_0x174295[_0xc85f('0xc9')][_0xc85f('0xc8')][_0xc85f('0xa2')](_0x11a192[_0xc85f('0xc9')]);return _0x174295;});})[_0xc85f('0x36')](respondWithResult(_0x5f4955,null))['catch'](handleError(_0x5f4955,null));};exports[_0xc85f('0x2a')]=function(_0x2d4621,_0x1953c4,_0x2b343c){if(_0x2d4621['body']['id']){delete _0x2d4621[_0xc85f('0x5b')]['id'];}var _0x5ca4de,_0x17dde3,_0x3734c9;return db[_0xc85f('0x3f')][_0xc85f('0x59')]({'where':{'id':_0x2d4621[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x1953c4,null))[_0xc85f('0x36')](function(_0xd3076a){if(_0xd3076a){_0x3734c9=_0xd3076a;logger[_0xc85f('0xae')](_0xc85f('0x22'),_0xc85f('0x2a'),'received\x20delivery\x20report\x20from',_0xd3076a['type'],util[_0xc85f('0xca')](_0x2d4621[_0xc85f('0x5b')],{'showHidden':![],'depth':null}));switch(_0xd3076a[_0xc85f('0x41')]){case _0xc85f('0x80'):if(_0x2d4621[_0xc85f('0x5b')][_0xc85f('0xcb')]&&_0x2d4621[_0xc85f('0x5b')]['status']){_0x17dde3=_0x2d4621[_0xc85f('0x5b')]['status'];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x2d4621[_0xc85f('0x5b')][_0xc85f('0xcb')]}});}break;case'connectel':if(_0x2d4621[_0xc85f('0x5b')][_0xc85f('0xcc')]&&_0x2d4621[_0xc85f('0x5b')][_0xc85f('0xcd')]){_0x17dde3=_0x2d4621['body'][_0xc85f('0xcd')];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x2d4621[_0xc85f('0x5b')][_0xc85f('0xcc')]}});}break;case'clicksend':if(_0x2d4621[_0xc85f('0x5b')]['message_id']&&_0x2d4621['body'][_0xc85f('0xce')]){_0x17dde3=_0x2d4621[_0xc85f('0x5b')]['status_code'];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x2d4621[_0xc85f('0x5b')][_0xc85f('0x87')]}});}break;case _0xc85f('0x8a'):var _0x29ee7c=_0x2d4621[_0xc85f('0x5b')]['results'][0x0];if(_0x29ee7c[_0xc85f('0x86')]&&_0x29ee7c[_0xc85f('0x2a')]['groupName']===_0xc85f('0xcf')){_0x17dde3=_0x29ee7c['status']['groupName'];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x29ee7c[_0xc85f('0x86')]}});}break;case _0xc85f('0xd0'):if(_0x2d4621[_0xc85f('0x5b')]['messageId']&&_0x2d4621[_0xc85f('0x5b')][_0xc85f('0x2a')]){_0x17dde3=_0x2d4621[_0xc85f('0x5b')]['status'];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x2d4621[_0xc85f('0x5b')][_0xc85f('0x86')]}});}break;case'bandwidth':if(_0x2d4621['body'][0x0]['message']['id']){_0x17dde3=_0x2d4621[_0xc85f('0x5b')][0x0][_0xc85f('0x41')];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x2d4621[_0xc85f('0x5b')][0x0]['message']['id']}});}break;case _0xc85f('0x91'):if(_0x2d4621['body'][_0xc85f('0xd1')]&&_0x2d4621[_0xc85f('0x5b')][_0xc85f('0x2a')]){_0x17dde3=_0x2d4621[_0xc85f('0x5b')][_0xc85f('0x2a')];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x2d4621[_0xc85f('0x5b')]['redif']}});}break;}}})[_0xc85f('0x36')](handleEntityNotFound(_0x1953c4,null))[_0xc85f('0x36')](function(_0x53a155){if(_0x53a155){_0x5ca4de=_0x53a155;switch(_0x3734c9[_0xc85f('0x41')]){case _0xc85f('0x80'):if(_0x17dde3===_0xc85f('0xcf')){return _0x5ca4de[_0xc85f('0x35')]({'read':!![]});}else{logger[_0xc85f('0x24')](_0xc85f('0x22'),_0xc85f('0x2a'),_0xc85f('0x80'),util[_0xc85f('0xca')](_0x2d4621['body'],{'showHidden':![],'depth':null}));}break;case _0xc85f('0x84'):if(_0x17dde3==='1'){return _0x5ca4de[_0xc85f('0x35')]({'read':!![]});}else{logger['error'](_0xc85f('0x22'),_0xc85f('0x2a'),_0xc85f('0x80'),util[_0xc85f('0xca')](_0x2d4621[_0xc85f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc85f('0x85'):if(!_0x2d4621[_0xc85f('0x5b')][_0xc85f('0xd2')]&&_0x17dde3>=0xc8&&_0x17dde3<=0xce){return _0x5ca4de['update']({'read':!![]});}else{logger['error'](_0xc85f('0x22'),_0xc85f('0x2a'),'clicksend',util['inspect'](_0x2d4621[_0xc85f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc85f('0x8a'):var _0x135901=_0x2d4621[_0xc85f('0x5b')]['results'][0x0];if(_0x135901[_0xc85f('0x2a')][_0xc85f('0xd3')]===_0xc85f('0xcf')){return _0x5ca4de['update']({'read':!![]});}else{logger[_0xc85f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xc85f('0x8a'),util[_0xc85f('0xca')](_0x2d4621[_0xc85f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc85f('0xd0'):if(_0x17dde3==_0xc85f('0xd4')||_0x17dde3==_0xc85f('0xd5')){return _0x5ca4de['update']({'read':!![]});}else{logger['error'](_0xc85f('0x22'),'status',_0xc85f('0xd0'),util['inspect'](_0x2d4621[_0xc85f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc85f('0x90'):if(_0x17dde3=='message-delivered'){return _0x5ca4de[_0xc85f('0x35')]({'read':!![]});}else{logger[_0xc85f('0x24')](_0xc85f('0x22'),'status',_0xc85f('0x90'),util['inspect'](_0x2d4621[_0xc85f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc85f('0x91'):if(_0x17dde3===_0xc85f('0xd6')||_0x17dde3===_0xc85f('0xd7')){return _0x5ca4de[_0xc85f('0x35')]({'read':!![]});}else{logger[_0xc85f('0x24')](_0xc85f('0x22'),_0xc85f('0x2a'),_0xc85f('0x91'),util[_0xc85f('0xca')](_0x2d4621[_0xc85f('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5ca4de;}})[_0xc85f('0x36')](respondWithResult(_0x1953c4,null))[_0xc85f('0x28')](handleError(_0x1953c4,null));};exports[_0xc85f('0xd8')]=function(_0x3bb970,_0x349231,_0x30ae8c){var _0x2691ee,_0x112c2e,_0x1c063a;return db[_0xc85f('0x3f')][_0xc85f('0x59')]({'where':{'id':_0x3bb970['params']['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x349231,null))[_0xc85f('0x36')](function(_0x148c80){if(_0x148c80){_0x1c063a=_0x148c80;logger[_0xc85f('0xae')](_0xc85f('0x22'),_0xc85f('0x2a'),'received\x20delivery\x20report\x20from',_0x148c80[_0xc85f('0x41')],util[_0xc85f('0xca')](_0x3bb970[_0xc85f('0x43')],{'showHidden':![],'depth':null}));switch(_0x148c80[_0xc85f('0x41')]){case _0xc85f('0x8c'):if(_0x3bb970[_0xc85f('0x43')][_0xc85f('0xd9')]&&_0x3bb970[_0xc85f('0x43')][_0xc85f('0xda')]){_0x112c2e=_0x3bb970['query'][_0xc85f('0xda')];return db[_0xc85f('0xa6')][_0xc85f('0x59')]({'where':{'messageId':_0x3bb970[_0xc85f('0x43')][_0xc85f('0xd9')]}});}break;}}})[_0xc85f('0x36')](handleEntityNotFound(_0x349231,null))[_0xc85f('0x36')](function(_0x3d1281){if(_0x3d1281){_0x2691ee=_0x3d1281;switch(_0x1c063a['type']){case'csc':if(_0x112c2e==='2'||_0x112c2e==='6'){return _0x2691ee[_0xc85f('0x35')]({'read':!![]});}else{logger['error'](_0xc85f('0x22'),_0xc85f('0x2a'),_0xc85f('0x8c'),util[_0xc85f('0xca')](_0x3bb970[_0xc85f('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x2691ee;}})['then'](respondWithResult(_0x349231,null))[_0xc85f('0x28')](handleError(_0x349231,null));};exports[_0xc85f('0xdb')]=function(_0x2aa6ba,_0x290885,_0x31ea98){return db[_0xc85f('0x3f')]['find']({'where':{'id':_0x2aa6ba['params']['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x290885,null))[_0xc85f('0x36')](function(_0x26ceec){if(_0x26ceec){return _0x26ceec[_0xc85f('0xdb')](_0x2aa6ba[_0xc85f('0x5b')][_0xc85f('0x6d')],_[_0xc85f('0xdc')](_0x2aa6ba[_0xc85f('0x5b')],[_0xc85f('0x6d'),'id'])||{})[_0xc85f('0x9f')](function(_0x120d9f){for(var _0x5307fb=0x0;_0x5307fb<_0x2aa6ba['body'][_0xc85f('0x6d')][_0xc85f('0x49')];_0x5307fb+=0x1){socket[_0xc85f('0xdd')](_0xc85f('0xde'),{'UserId':Number(_0x2aa6ba[_0xc85f('0x5b')][_0xc85f('0x6d')][_0x5307fb]),'SmsAccountId':Number(_0x2aa6ba[_0xc85f('0x56')]['id'])});}return _0x120d9f;});}})['then'](respondWithResult(_0x290885,null))[_0xc85f('0x28')](handleError(_0x290885,null));};exports[_0xc85f('0xdf')]=function(_0x5d2f0d,_0x598b65,_0x2daf06){return db[_0xc85f('0x3f')][_0xc85f('0x59')]({'where':{'id':_0x5d2f0d[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x598b65,null))[_0xc85f('0x36')](function(_0x379505){if(_0x379505){return _0x379505['removeAgents'](_0x5d2f0d[_0xc85f('0x43')][_0xc85f('0x6d')])['then'](function(){if(_[_0xc85f('0xe0')](_0x5d2f0d[_0xc85f('0x43')][_0xc85f('0x6d')])){for(var _0xdcf9a1=0x0;_0xdcf9a1<_0x5d2f0d[_0xc85f('0x43')][_0xc85f('0x6d')][_0xc85f('0x49')];_0xdcf9a1+=0x1){socket[_0xc85f('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0x5d2f0d[_0xc85f('0x43')][_0xc85f('0x6d')][_0xdcf9a1]),'SmsAccountId':Number(_0x5d2f0d[_0xc85f('0x56')]['id'])});}}else{socket[_0xc85f('0xdd')](_0xc85f('0xe1'),{'UserId':Number(_0x5d2f0d['query'][_0xc85f('0x6d')]),'SmsAccountId':Number(_0x5d2f0d[_0xc85f('0x56')]['id'])});}});}})[_0xc85f('0x36')](respondWithStatusCode(_0x598b65,null))[_0xc85f('0x28')](handleError(_0x598b65,null));};exports[_0xc85f('0xe2')]=function(_0x474f33,_0x348ec5,_0xdbd935){var _0x4aaa1e={};var _0x3911db={};var _0x23abbc;var _0x4d214e;return db['SmsAccount']['findOne']({'where':{'id':_0x474f33[_0xc85f('0x56')]['id']}})[_0xc85f('0x36')](handleEntityNotFound(_0x348ec5,null))[_0xc85f('0x36')](function(_0x1e813e){if(_0x1e813e){_0x23abbc=_0x1e813e;_0x3911db[_0xc85f('0x46')]=_['keys'](db[_0xc85f('0xa9')][_0xc85f('0x57')]);_0x3911db[_0xc85f('0x43')]=_[_0xc85f('0x44')](_0x474f33[_0xc85f('0x43')]);_0x3911db[_0xc85f('0x50')]=_[_0xc85f('0x45')](_0x3911db[_0xc85f('0x46')],_0x3911db[_0xc85f('0x43')]);_0x4aaa1e['attributes']=_['intersection'](_0x3911db['model'],qs['fields'](_0x474f33[_0xc85f('0x43')][_0xc85f('0x48')]));_0x4aaa1e[_0xc85f('0x47')]=_0x4aaa1e[_0xc85f('0x47')][_0xc85f('0x49')]?_0x4aaa1e[_0xc85f('0x47')]:_0x3911db[_0xc85f('0x46')];_0x4aaa1e['order']=qs[_0xc85f('0x4d')](_0x474f33['query'][_0xc85f('0x4d')]);_0x4aaa1e['where']=qs['filters'](_[_0xc85f('0x4f')](_0x474f33[_0xc85f('0x43')],_0x3911db[_0xc85f('0x50')]));if(_0x474f33[_0xc85f('0x43')][_0xc85f('0x52')]){_0x4aaa1e[_0xc85f('0x4e')]=_['merge'](_0x4aaa1e[_0xc85f('0x4e')],{'$or':_['map'](_0x4aaa1e[_0xc85f('0x47')],function(_0x3bf90a){var _0x5c1d0e={};_0x5c1d0e[_0x3bf90a]={'$like':'%'+_0x474f33[_0xc85f('0x43')]['filter']+'%'};return _0x5c1d0e;})});}_0x4aaa1e=_['merge']({},_0x4aaa1e,_0x474f33[_0xc85f('0x67')]);return _0x23abbc[_0xc85f('0xe2')](_0x4aaa1e);}})[_0xc85f('0x36')](function(_0x2309a5){if(_0x2309a5){_0x4d214e=_0x2309a5[_0xc85f('0x49')];if(!_0x474f33['query'][_0xc85f('0x4a')](_0xc85f('0x66'))){_0x4aaa1e[_0xc85f('0x2d')]=qs[_0xc85f('0x2d')](_0x474f33[_0xc85f('0x43')][_0xc85f('0x2d')]);_0x4aaa1e[_0xc85f('0x4b')]=qs[_0xc85f('0x4b')](_0x474f33[_0xc85f('0x43')]['offset']);}return _0x23abbc[_0xc85f('0xe2')](_0x4aaa1e);}})[_0xc85f('0x36')](function(_0x214c9f){if(_0x214c9f){return _0x214c9f?{'count':_0x4d214e,'rows':_0x214c9f}:null;}})['then'](respondWithResult(_0x348ec5,null))[_0xc85f('0x28')](handleError(_0x348ec5,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 39cda17..a17353f 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 _0xada0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x2ca8d7,_0x4779a4){var _0x4cb86f=function(_0xf142da){while(--_0xf142da){_0x2ca8d7['push'](_0x2ca8d7['shift']());}};_0x4cb86f(++_0x4779a4);}(_0xada0,0xc2));var _0x0ada=function(_0x38c3aa,_0x5d1fb3){_0x38c3aa=_0x38c3aa-0x0;var _0x584565=_0xada0[_0x38c3aa];return _0x584565;};'use strict';var EventEmitter=require(_0x0ada('0x0'));var SmsAccount=require(_0x0ada('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0ada('0x2')](0x0);var events={'afterCreate':_0x0ada('0x3'),'afterUpdate':_0x0ada('0x4'),'afterDestroy':_0x0ada('0x5')};function emitEvent(_0x32648a){return function(_0x37d1ae,_0x70f85e,_0x23c525){SmsAccountEvents[_0x0ada('0x6')](_0x32648a+':'+_0x37d1ae['id'],_0x37d1ae);SmsAccountEvents[_0x0ada('0x6')](_0x32648a,_0x37d1ae);_0x23c525(null);};}for(var e in events){if(events[_0x0ada('0x7')](e)){var event=events[e];SmsAccount[_0x0ada('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xf239=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xf239,0x91));var _0x9f23=function(_0x4bad92,_0x3fb493){_0x4bad92=_0x4bad92-0x0;var _0x4bb5c8=_0xf239[_0x4bad92];return _0x4bb5c8;};'use strict';var EventEmitter=require(_0x9f23('0x0'));var SmsAccount=require(_0x9f23('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9f23('0x2')](0x0);var events={'afterCreate':_0x9f23('0x3'),'afterUpdate':_0x9f23('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54d202){return function(_0x2f9b13,_0x2ae796,_0x2b7b05){SmsAccountEvents[_0x9f23('0x5')](_0x54d202+':'+_0x2f9b13['id'],_0x2f9b13);SmsAccountEvents[_0x9f23('0x5')](_0x54d202,_0x2f9b13);_0x2b7b05(null);};}for(var e in events){if(events[_0x9f23('0x6')](e)){var event=events[e];SmsAccount[_0x9f23('0x7')](e,emitEvent(event));}}module[_0x9f23('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9835453..89e47f4 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 _0x6958=['bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','lodash','../../config/logger'];(function(_0x3dc2cc,_0x3a13a8){var _0x298a92=function(_0xb63594){while(--_0xb63594){_0x3dc2cc['push'](_0x3dc2cc['shift']());}};_0x298a92(++_0x3a13a8);}(_0x6958,0x16f));var _0x8695=function(_0x1631b8,_0x47dc52){_0x1631b8=_0x1631b8-0x0;var _0x4afa04=_0x6958[_0x1631b8];return _0x4afa04;};'use strict';var _=require(_0x8695('0x0'));var util=require('util');var logger=require(_0x8695('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8695('0x2'));var rp=require(_0x8695('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8695('0x4'));var config=require(_0x8695('0x5'));var attributes=require(_0x8695('0x6'));module[_0x8695('0x7')]=function(_0x192406,_0x3b4174){return _0x192406[_0x8695('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd876=['./smsAccount.attributes','exports','define','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x4d3b1b,_0x1b1049){var _0x521593=function(_0xfac6cb){while(--_0xfac6cb){_0x4d3b1b['push'](_0x4d3b1b['shift']());}};_0x521593(++_0x1b1049);}(_0xd876,0x11b));var _0x6d87=function(_0x1a7ee0,_0x2071cd){_0x1a7ee0=_0x1a7ee0-0x0;var _0x569697=_0xd876[_0x1a7ee0];return _0x569697;};'use strict';var _=require(_0x6d87('0x0'));var util=require('util');var logger=require(_0x6d87('0x1'))(_0x6d87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6d87('0x3'));var fs=require('fs');var path=require(_0x6d87('0x4'));var rimraf=require(_0x6d87('0x5'));var config=require(_0x6d87('0x6'));var attributes=require(_0x6d87('0x7'));module[_0x6d87('0x8')]=function(_0xfafc2c,_0xabcbe6){return _0xfafc2c[_0x6d87('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index eee1c70..9e8e500 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 _0x9d75=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','then','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x3fe1ba,_0x1a33c5){var _0x5df1b4=function(_0x55d7c3){while(--_0x55d7c3){_0x3fe1ba['push'](_0x3fe1ba['shift']());}};_0x5df1b4(++_0x1a33c5);}(_0x9d75,0x16a));var _0x59d7=function(_0xeaf11a,_0xb7a89d){_0xeaf11a=_0xeaf11a-0x0;var _0x4c233d=_0x9d75[_0xeaf11a];return _0x4c233d;};'use strict';var _=require(_0x59d7('0x0'));var util=require(_0x59d7('0x1'));var moment=require(_0x59d7('0x2'));var BPromise=require(_0x59d7('0x3'));var rs=require(_0x59d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x59d7('0x5'));var logger=require('../../config/logger')(_0x59d7('0x6'));var config=require(_0x59d7('0x7'));var jayson=require(_0x59d7('0x8'));var client=jayson[_0x59d7('0x9')]['http']({'port':0x232a});config[_0x59d7('0xa')]=_[_0x59d7('0xb')](config['redis'],{'host':_0x59d7('0xc'),'port':0x18eb});var socket=require(_0x59d7('0xd'))(new Redis(config[_0x59d7('0xa')]));require(_0x59d7('0xe'))[_0x59d7('0xf')](socket);function respondWithRpcPromise(_0x31113d,_0x8069a5,_0x34d06f){return new BPromise(function(_0x241a9a,_0x4fba04){return client['request'](_0x31113d,_0x34d06f)['then'](function(_0x2a251d){logger['info'](_0x59d7('0x10'),_0x8069a5,'request\x20sent');logger[_0x59d7('0x11')](_0x59d7('0x12'),_0x8069a5,_0x59d7('0x13'),JSON[_0x59d7('0x14')](_0x2a251d));if(_0x2a251d['error']){if(_0x2a251d['error'][_0x59d7('0x15')]===0x1f4){logger[_0x59d7('0x16')](_0x59d7('0x10'),_0x8069a5,_0x2a251d['error']['message']);return _0x4fba04(_0x2a251d[_0x59d7('0x16')][_0x59d7('0x17')]);}logger[_0x59d7('0x16')]('SmsAccount,\x20%s,\x20%s',_0x8069a5,_0x2a251d[_0x59d7('0x16')][_0x59d7('0x17')]);return _0x241a9a(_0x2a251d['error'][_0x59d7('0x17')]);}else{logger[_0x59d7('0x18')]('SmsAccount,\x20%s,\x20%s',_0x8069a5,'request\x20sent');_0x241a9a(_0x2a251d[_0x59d7('0x19')][_0x59d7('0x17')]);}})['catch'](function(_0x57cef0){logger[_0x59d7('0x16')](_0x59d7('0x10'),_0x8069a5,_0x57cef0);_0x4fba04(_0x57cef0);});});}exports[_0x59d7('0x1a')]=function(_0x538353){var _0x359950=this;return new Promise(function(_0x5ba454,_0x31789c){return db[_0x59d7('0x1b')][_0x59d7('0x1c')]({'raw':_0x538353['options']?_0x538353[_0x59d7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x538353[_0x59d7('0x1d')]?_0x538353[_0x59d7('0x1d')][_0x59d7('0x1e')]||null:null,'attributes':_0x538353[_0x59d7('0x1d')]?_0x538353[_0x59d7('0x1d')][_0x59d7('0x1f')]||null:null,'include':_0x538353[_0x59d7('0x1d')]?_0x538353[_0x59d7('0x1d')][_0x59d7('0x20')]?_[_0x59d7('0x21')](_0x538353[_0x59d7('0x1d')][_0x59d7('0x20')],function(_0x40b085){return{'model':db[_0x40b085[_0x59d7('0x22')]],'as':_0x40b085['as'],'attributes':_0x40b085['attributes'],'include':_0x40b085[_0x59d7('0x20')]?_[_0x59d7('0x21')](_0x40b085[_0x59d7('0x20')],function(_0x928fa){return{'model':db[_0x928fa[_0x59d7('0x22')]],'as':_0x928fa['as'],'attributes':_0x928fa[_0x59d7('0x1f')],'include':_0x928fa[_0x59d7('0x20')]?_['map'](_0x928fa['include'],function(_0x2741d0){return{'model':db[_0x2741d0['model']],'as':_0x2741d0['as'],'attributes':_0x2741d0[_0x59d7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x59d7('0x23')](function(_0x4cba39){logger[_0x59d7('0x18')](_0x59d7('0x1a'),_0x538353);logger[_0x59d7('0x11')]('ShowSmsAccount',_0x538353,JSON[_0x59d7('0x14')](_0x4cba39));_0x5ba454(_0x4cba39);})[_0x59d7('0x24')](function(_0x3c93cd){logger[_0x59d7('0x16')](_0x59d7('0x1a'),_0x3c93cd[_0x59d7('0x17')],_0x538353);_0x31789c(_0x359950['error'](0x1f4,_0x3c93cd[_0x59d7('0x17')]));});});}; \ No newline at end of file +var _0x09e5=['message','result','ShowSmsAccount','SmsAccount','find','options','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3a4624,_0x5d9a5f){var _0x220146=function(_0x301eea){while(--_0x301eea){_0x3a4624['push'](_0x3a4624['shift']());}};_0x220146(++_0x5d9a5f);}(_0x09e5,0x1a3));var _0x509e=function(_0x536d01,_0x315baa){_0x536d01=_0x536d01-0x0;var _0x1549e5=_0x09e5[_0x536d01];return _0x1549e5;};'use strict';var _=require(_0x509e('0x0'));var util=require(_0x509e('0x1'));var moment=require(_0x509e('0x2'));var BPromise=require(_0x509e('0x3'));var rs=require(_0x509e('0x4'));var fs=require('fs');var Redis=require(_0x509e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x509e('0x6'));var config=require(_0x509e('0x7'));var jayson=require(_0x509e('0x8'));var client=jayson[_0x509e('0x9')]['http']({'port':0x232a});config[_0x509e('0xa')]=_[_0x509e('0xb')](config[_0x509e('0xa')],{'host':_0x509e('0xc'),'port':0x18eb});var socket=require(_0x509e('0xd'))(new Redis(config[_0x509e('0xa')]));require(_0x509e('0xe'))['register'](socket);function respondWithRpcPromise(_0x1344e6,_0x44ec26,_0x1020d2){return new BPromise(function(_0x561d50,_0x23abb0){return client[_0x509e('0xf')](_0x1344e6,_0x1020d2)[_0x509e('0x10')](function(_0x5e9a81){logger[_0x509e('0x11')](_0x509e('0x12'),_0x44ec26,_0x509e('0x13'));logger[_0x509e('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x44ec26,_0x509e('0x13'),JSON[_0x509e('0x15')](_0x5e9a81));if(_0x5e9a81[_0x509e('0x16')]){if(_0x5e9a81[_0x509e('0x16')]['code']===0x1f4){logger[_0x509e('0x16')](_0x509e('0x12'),_0x44ec26,_0x5e9a81[_0x509e('0x16')]['message']);return _0x23abb0(_0x5e9a81['error'][_0x509e('0x17')]);}logger['error'](_0x509e('0x12'),_0x44ec26,_0x5e9a81[_0x509e('0x16')]['message']);return _0x561d50(_0x5e9a81['error'][_0x509e('0x17')]);}else{logger['info'](_0x509e('0x12'),_0x44ec26,_0x509e('0x13'));_0x561d50(_0x5e9a81[_0x509e('0x18')][_0x509e('0x17')]);}})['catch'](function(_0x5f0956){logger['error'](_0x509e('0x12'),_0x44ec26,_0x5f0956);_0x23abb0(_0x5f0956);});});}exports[_0x509e('0x19')]=function(_0x4b336a){var _0x4a8345=this;return new Promise(function(_0x38f34d,_0x4a28eb){return db[_0x509e('0x1a')][_0x509e('0x1b')]({'raw':_0x4b336a[_0x509e('0x1c')]?_0x4b336a['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b336a[_0x509e('0x1c')]?_0x4b336a['options']['where']||null:null,'attributes':_0x4b336a[_0x509e('0x1c')]?_0x4b336a['options'][_0x509e('0x1d')]||null:null,'include':_0x4b336a[_0x509e('0x1c')]?_0x4b336a[_0x509e('0x1c')][_0x509e('0x1e')]?_['map'](_0x4b336a['options'][_0x509e('0x1e')],function(_0x1e87b9){return{'model':db[_0x1e87b9[_0x509e('0x1f')]],'as':_0x1e87b9['as'],'attributes':_0x1e87b9[_0x509e('0x1d')],'include':_0x1e87b9[_0x509e('0x1e')]?_['map'](_0x1e87b9[_0x509e('0x1e')],function(_0x7c76){return{'model':db[_0x7c76[_0x509e('0x1f')]],'as':_0x7c76['as'],'attributes':_0x7c76['attributes'],'include':_0x7c76[_0x509e('0x1e')]?_[_0x509e('0x20')](_0x7c76['include'],function(_0x435ecf){return{'model':db[_0x435ecf[_0x509e('0x1f')]],'as':_0x435ecf['as'],'attributes':_0x435ecf[_0x509e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x509e('0x10')](function(_0x4d86d3){logger[_0x509e('0x11')](_0x509e('0x19'),_0x4b336a);logger[_0x509e('0x14')](_0x509e('0x19'),_0x4b336a,JSON[_0x509e('0x15')](_0x4d86d3));_0x38f34d(_0x4d86d3);})[_0x509e('0x21')](function(_0x32bd5e){logger[_0x509e('0x16')](_0x509e('0x19'),_0x32bd5e[_0x509e('0x17')],_0x4b336a);_0x4a28eb(_0x4a8345['error'](0x1f4,_0x32bd5e[_0x509e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 45990c1..a6537d2 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 ecaa979..8b34163 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x1cdb4f,_0x38b5e0){var _0x3e9476=function(_0x46e600){while(--_0x46e600){_0x1cdb4f['push'](_0x1cdb4f['shift']());}};_0x3e9476(++_0x38b5e0);}(_0xe14b,0x93));var _0xbe14=function(_0x493d61,_0x67f009){_0x493d61=_0x493d61-0x0;var _0x147baa=_0xe14b[_0x493d61];return _0x147baa;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1a3356,_0xab6830){var _0x342bdf=function(_0x519916){while(--_0x519916){_0x1a3356['push'](_0x1a3356['shift']());}};_0x342bdf(++_0xab6830);}(_0x7217,0x19e));var _0x7721=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7217[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 0f56fa2..e2cbed1 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 _0x0a4d=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2cb99a,_0x512933){var _0x3a1881=function(_0x305584){while(--_0x305584){_0x2cb99a['push'](_0x2cb99a['shift']());}};_0x3a1881(++_0x512933);}(_0x0a4d,0xdc));var _0xd0a4=function(_0x5bd78a,_0x4f2c71){_0x5bd78a=_0x5bd78a-0x0;var _0x134c75=_0x0a4d[_0x5bd78a];return _0x134c75;};'use strict';var Sequelize=require(_0xd0a4('0x0'));module[_0xd0a4('0x1')]={'priority':{'type':Sequelize[_0xd0a4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd0a4('0x3')],'allowNull':![],'defaultValue':_0xd0a4('0x4')},'appdata':{'type':Sequelize[_0xd0a4('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd0a4('0x3')],'defaultValue':_0xd0a4('0x6')}}; \ No newline at end of file +var _0xa1c3=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x202fa0,_0x5e688e){var _0x2089ad=function(_0x45384f){while(--_0x45384f){_0x202fa0['push'](_0x202fa0['shift']());}};_0x2089ad(++_0x5e688e);}(_0xa1c3,0x1a2));var _0x3a1c=function(_0x33898d,_0x2ec079){_0x33898d=_0x33898d-0x0;var _0x330c08=_0xa1c3[_0x33898d];return _0x330c08;};'use strict';var Sequelize=require('sequelize');module[_0x3a1c('0x0')]={'priority':{'type':Sequelize[_0x3a1c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3a1c('0x2')],'allowNull':![],'defaultValue':_0x3a1c('0x3')},'appdata':{'type':Sequelize[_0x3a1c('0x4')]()},'description':{'type':Sequelize[_0x3a1c('0x2')]},'interval':{'type':Sequelize[_0x3a1c('0x2')],'defaultValue':_0x3a1c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2d1ba08..44317db 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 _0x785a=['filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','type','key','model','query','keys'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x785a,0x67));var _0xa785=function(_0x43b734,_0xfefcf1){_0x43b734=_0x43b734-0x0;var _0x43e591=_0x785a[_0x43b734];return _0x43e591;};'use strict';var emlformat=require(_0xa785('0x0'));var rimraf=require(_0xa785('0x1'));var zipdir=require(_0xa785('0x2'));var jsonpatch=require(_0xa785('0x3'));var rp=require(_0xa785('0x4'));var moment=require(_0xa785('0x5'));var BPromise=require(_0xa785('0x6'));var Mustache=require(_0xa785('0x7'));var util=require(_0xa785('0x8'));var path=require(_0xa785('0x9'));var sox=require(_0xa785('0xa'));var csv=require(_0xa785('0xb'));var ejs=require(_0xa785('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa785('0xd'));var squel=require('squel');var crypto=require(_0xa785('0xe'));var jsforce=require(_0xa785('0xf'));var deskjs=require(_0xa785('0x10'));var toCsv=require(_0xa785('0xb'));var querystring=require(_0xa785('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa785('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa785('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa785('0x14'))('api');var utils=require(_0xa785('0x15'));var config=require(_0xa785('0x16'));var licenseUtil=require(_0xa785('0x17'));var db=require(_0xa785('0x18'))['db'];function respondWithStatusCode(_0x4fc00b,_0x200a8e){_0x200a8e=_0x200a8e||0xcc;return function(_0x324853){if(_0x324853){return _0x4fc00b[_0xa785('0x19')](_0x200a8e);}return _0x4fc00b['status'](_0x200a8e)[_0xa785('0x1a')]();};}function respondWithResult(_0x439c43,_0x285dcc){_0x285dcc=_0x285dcc||0xc8;return function(_0x4d3362){if(_0x4d3362){return _0x439c43[_0xa785('0x1b')](_0x285dcc)[_0xa785('0x1c')](_0x4d3362);}};}function respondWithFilteredResult(_0x4c91f4,_0x3d3cdc){return function(_0x1ec9a8){if(_0x1ec9a8){var _0x2d03a3=typeof _0x3d3cdc[_0xa785('0x1d')]==='undefined'&&typeof _0x3d3cdc[_0xa785('0x1e')]===_0xa785('0x1f');var _0x17f2dc=_0x1ec9a8[_0xa785('0x20')];var _0x2137d4=_0x2d03a3?0x0:_0x3d3cdc['offset'];var _0x40a9cd=_0x2d03a3?_0x1ec9a8['count']:_0x3d3cdc['offset']+_0x3d3cdc[_0xa785('0x1e')];var _0x3cae74;if(_0x40a9cd>=_0x17f2dc){_0x40a9cd=_0x17f2dc;_0x3cae74=0xc8;}else{_0x3cae74=0xce;}_0x4c91f4[_0xa785('0x1b')](_0x3cae74);return _0x4c91f4[_0xa785('0x21')](_0xa785('0x22'),_0x2137d4+'-'+_0x40a9cd+'/'+_0x17f2dc)[_0xa785('0x1c')](_0x1ec9a8);}return null;};}function patchUpdates(_0x378fd9){return function(_0x1b78a4){try{jsonpatch[_0xa785('0x23')](_0x1b78a4,_0x378fd9,!![]);}catch(_0x376988){return BPromise[_0xa785('0x24')](_0x376988);}return _0x1b78a4[_0xa785('0x25')]();};}function saveUpdates(_0x34d72b,_0xecb2ab){return function(_0x4dbe47){if(_0x4dbe47){return _0x4dbe47[_0xa785('0x26')](_0x34d72b)[_0xa785('0x27')](function(_0x4eed01){return _0x4eed01;});}return null;};}function removeEntity(_0x52e240,_0x95d574){return function(_0x3fff34){if(_0x3fff34){return _0x3fff34[_0xa785('0x28')]()['then'](function(){_0x52e240[_0xa785('0x1b')](0xcc)[_0xa785('0x1a')]();});}};}function handleEntityNotFound(_0x31d36f,_0x39e725){return function(_0x51651d){if(!_0x51651d){_0x31d36f[_0xa785('0x19')](0x194);}return _0x51651d;};}function handleError(_0x13bd55,_0x2b465f){_0x2b465f=_0x2b465f||0x1f4;return function(_0x3d0648){logger[_0xa785('0x29')](_0x3d0648[_0xa785('0x2a')]);if(_0x3d0648[_0xa785('0x2b')]){delete _0x3d0648['name'];}_0x13bd55[_0xa785('0x1b')](_0x2b465f)[_0xa785('0x2c')](_0x3d0648);};}exports[_0xa785('0x2d')]=function(_0x289be5,_0x5c4a83){var _0x345933={},_0x274cec={},_0x461e7f={'count':0x0,'rows':[]};var _0x27e497=_[_0xa785('0x2e')](db[_0xa785('0x2f')]['rawAttributes'],function(_0x37dae0){return{'name':_0x37dae0['fieldName'],'type':_0x37dae0[_0xa785('0x30')][_0xa785('0x31')]};});_0x274cec[_0xa785('0x32')]=_[_0xa785('0x2e')](_0x27e497,_0xa785('0x2b'));_0x274cec[_0xa785('0x33')]=_[_0xa785('0x34')](_0x289be5[_0xa785('0x33')]);_0x274cec[_0xa785('0x35')]=_['intersection'](_0x274cec['model'],_0x274cec[_0xa785('0x33')]);_0x345933[_0xa785('0x36')]=_['intersection'](_0x274cec[_0xa785('0x32')],qs[_0xa785('0x37')](_0x289be5[_0xa785('0x33')][_0xa785('0x37')]));_0x345933[_0xa785('0x36')]=_0x345933[_0xa785('0x36')][_0xa785('0x38')]?_0x345933['attributes']:_0x274cec[_0xa785('0x32')];if(!_0x289be5[_0xa785('0x33')][_0xa785('0x39')](_0xa785('0x3a'))){_0x345933[_0xa785('0x1e')]=qs[_0xa785('0x1e')](_0x289be5[_0xa785('0x33')][_0xa785('0x1e')]);_0x345933[_0xa785('0x1d')]=qs[_0xa785('0x1d')](_0x289be5['query'][_0xa785('0x1d')]);}_0x345933[_0xa785('0x3b')]=qs['sort'](_0x289be5['query'][_0xa785('0x3c')]);_0x345933[_0xa785('0x3d')]=qs[_0xa785('0x35')](_[_0xa785('0x3e')](_0x289be5['query'],_0x274cec['filters']),_0x27e497);if(_0x289be5[_0xa785('0x33')][_0xa785('0x3f')]){_0x345933[_0xa785('0x3d')]=_['merge'](_0x345933[_0xa785('0x3d')],{'$or':_[_0xa785('0x2e')](_0x27e497,function(_0x584f4d){if(_0x584f4d[_0xa785('0x30')]!=='VIRTUAL'){var _0x27ecee={};_0x27ecee[_0x584f4d[_0xa785('0x2b')]]={'$like':'%'+_0x289be5[_0xa785('0x33')][_0xa785('0x3f')]+'%'};return _0x27ecee;}})});}_0x345933=_['merge']({},_0x345933,_0x289be5[_0xa785('0x40')]);var _0x11ac9a={'where':_0x345933[_0xa785('0x3d')]};return db['SmsApplication'][_0xa785('0x20')](_0x11ac9a)[_0xa785('0x27')](function(_0x25c045){_0x461e7f[_0xa785('0x20')]=_0x25c045;if(_0x289be5[_0xa785('0x33')][_0xa785('0x41')]){_0x345933[_0xa785('0x42')]=[{'all':!![]}];}return db[_0xa785('0x2f')][_0xa785('0x43')](_0x345933);})['then'](function(_0x580efd){_0x461e7f[_0xa785('0x44')]=_0x580efd;return _0x461e7f;})[_0xa785('0x27')](respondWithFilteredResult(_0x5c4a83,_0x345933))[_0xa785('0x45')](handleError(_0x5c4a83,null));};exports[_0xa785('0x46')]=function(_0x2de5e0,_0x32a5f3){var _0x532f34={'raw':!![],'where':{'id':_0x2de5e0[_0xa785('0x47')]['id']}},_0x4a162f={};_0x4a162f[_0xa785('0x32')]=_[_0xa785('0x34')](db[_0xa785('0x2f')][_0xa785('0x48')]);_0x4a162f[_0xa785('0x33')]=_['keys'](_0x2de5e0['query']);_0x4a162f['filters']=_[_0xa785('0x49')](_0x4a162f[_0xa785('0x32')],_0x4a162f[_0xa785('0x33')]);_0x532f34[_0xa785('0x36')]=_[_0xa785('0x49')](_0x4a162f[_0xa785('0x32')],qs[_0xa785('0x37')](_0x2de5e0['query'][_0xa785('0x37')]));_0x532f34[_0xa785('0x36')]=_0x532f34[_0xa785('0x36')][_0xa785('0x38')]?_0x532f34[_0xa785('0x36')]:_0x4a162f['model'];if(_0x2de5e0['query'][_0xa785('0x41')]){_0x532f34[_0xa785('0x42')]=[{'all':!![]}];}_0x532f34=_[_0xa785('0x4a')]({},_0x532f34,_0x2de5e0[_0xa785('0x40')]);return db['SmsApplication'][_0xa785('0x4b')](_0x532f34)[_0xa785('0x27')](handleEntityNotFound(_0x32a5f3,null))[_0xa785('0x27')](respondWithResult(_0x32a5f3,null))['catch'](handleError(_0x32a5f3,null));};exports[_0xa785('0x4c')]=function(_0x3ece74,_0x211ab0){return db[_0xa785('0x2f')]['create'](_0x3ece74[_0xa785('0x4d')],{})[_0xa785('0x27')](respondWithResult(_0x211ab0,0xc9))[_0xa785('0x45')](handleError(_0x211ab0,null));};exports['update']=function(_0x7117db,_0x1b2c61){if(_0x7117db[_0xa785('0x4d')]['id']){delete _0x7117db[_0xa785('0x4d')]['id'];}return db[_0xa785('0x2f')][_0xa785('0x4b')]({'where':{'id':_0x7117db[_0xa785('0x47')]['id']}})[_0xa785('0x27')](handleEntityNotFound(_0x1b2c61,null))[_0xa785('0x27')](saveUpdates(_0x7117db[_0xa785('0x4d')],null))['then'](respondWithResult(_0x1b2c61,null))[_0xa785('0x45')](handleError(_0x1b2c61,null));};exports[_0xa785('0x28')]=function(_0x325710,_0x31b915){return db[_0xa785('0x2f')][_0xa785('0x4b')]({'where':{'id':_0x325710[_0xa785('0x47')]['id']}})[_0xa785('0x27')](handleEntityNotFound(_0x31b915,null))[_0xa785('0x27')](removeEntity(_0x31b915,null))[_0xa785('0x45')](handleError(_0x31b915,null));}; \ No newline at end of file +var _0xfdc1=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','params','find','create','catch','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0xfdc1,0x141));var _0x1fdc=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xfdc1[_0x36de10];return _0x58100f;};'use strict';var emlformat=require(_0x1fdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fdc('0x1'));var jsonpatch=require(_0x1fdc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1fdc('0x3'));var Mustache=require(_0x1fdc('0x4'));var util=require(_0x1fdc('0x5'));var path=require(_0x1fdc('0x6'));var sox=require('sox');var csv=require(_0x1fdc('0x7'));var ejs=require(_0x1fdc('0x8'));var fs=require('fs');var fs_extra=require(_0x1fdc('0x9'));var _=require('lodash');var squel=require(_0x1fdc('0xa'));var crypto=require(_0x1fdc('0xb'));var jsforce=require(_0x1fdc('0xc'));var deskjs=require(_0x1fdc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1fdc('0xe'));var Papa=require(_0x1fdc('0xf'));var Redis=require('ioredis');var authService=require(_0x1fdc('0x10'));var qs=require(_0x1fdc('0x11'));var as=require(_0x1fdc('0x12'));var hardwareService=require(_0x1fdc('0x13'));var logger=require(_0x1fdc('0x14'))(_0x1fdc('0x15'));var utils=require('../../config/utils');var config=require(_0x1fdc('0x16'));var licenseUtil=require(_0x1fdc('0x17'));var db=require(_0x1fdc('0x18'))['db'];function respondWithStatusCode(_0x5dbc99,_0x27a483){_0x27a483=_0x27a483||0xcc;return function(_0xf1c181){if(_0xf1c181){return _0x5dbc99[_0x1fdc('0x19')](_0x27a483);}return _0x5dbc99[_0x1fdc('0x1a')](_0x27a483)[_0x1fdc('0x1b')]();};}function respondWithResult(_0x3bd5fd,_0x2643cc){_0x2643cc=_0x2643cc||0xc8;return function(_0x38d24f){if(_0x38d24f){return _0x3bd5fd['status'](_0x2643cc)['json'](_0x38d24f);}};}function respondWithFilteredResult(_0x52c37d,_0x53a50d){return function(_0x5c58f5){if(_0x5c58f5){var _0x1be264=typeof _0x53a50d[_0x1fdc('0x1c')]===_0x1fdc('0x1d')&&typeof _0x53a50d[_0x1fdc('0x1e')]===_0x1fdc('0x1d');var _0x51964a=_0x5c58f5[_0x1fdc('0x1f')];var _0x248a8f=_0x1be264?0x0:_0x53a50d[_0x1fdc('0x1c')];var _0x4a3f8a=_0x1be264?_0x5c58f5[_0x1fdc('0x1f')]:_0x53a50d[_0x1fdc('0x1c')]+_0x53a50d[_0x1fdc('0x1e')];var _0x4bbe7a;if(_0x4a3f8a>=_0x51964a){_0x4a3f8a=_0x51964a;_0x4bbe7a=0xc8;}else{_0x4bbe7a=0xce;}_0x52c37d[_0x1fdc('0x1a')](_0x4bbe7a);return _0x52c37d[_0x1fdc('0x20')](_0x1fdc('0x21'),_0x248a8f+'-'+_0x4a3f8a+'/'+_0x51964a)[_0x1fdc('0x22')](_0x5c58f5);}return null;};}function patchUpdates(_0xef633b){return function(_0x3c608b){try{jsonpatch[_0x1fdc('0x23')](_0x3c608b,_0xef633b,!![]);}catch(_0x2dcfa3){return BPromise[_0x1fdc('0x24')](_0x2dcfa3);}return _0x3c608b[_0x1fdc('0x25')]();};}function saveUpdates(_0x862e28,_0x3e10e4){return function(_0x540d97){if(_0x540d97){return _0x540d97[_0x1fdc('0x26')](_0x862e28)[_0x1fdc('0x27')](function(_0x58af09){return _0x58af09;});}return null;};}function removeEntity(_0x467f11,_0x5b4052){return function(_0x4a14d5){if(_0x4a14d5){return _0x4a14d5[_0x1fdc('0x28')]()[_0x1fdc('0x27')](function(){_0x467f11[_0x1fdc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfda524,_0x21e123){return function(_0xb2994b){if(!_0xb2994b){_0xfda524[_0x1fdc('0x19')](0x194);}return _0xb2994b;};}function handleError(_0x3c5db7,_0x1344fc){_0x1344fc=_0x1344fc||0x1f4;return function(_0x121880){logger['error'](_0x121880[_0x1fdc('0x29')]);if(_0x121880[_0x1fdc('0x2a')]){delete _0x121880[_0x1fdc('0x2a')];}_0x3c5db7['status'](_0x1344fc)[_0x1fdc('0x2b')](_0x121880);};}exports[_0x1fdc('0x2c')]=function(_0x5d61a9,_0x6ac0c3){var _0x362305={},_0x5a228f={},_0x19d53b={'count':0x0,'rows':[]};var _0x437f77=_[_0x1fdc('0x2d')](db[_0x1fdc('0x2e')][_0x1fdc('0x2f')],function(_0x4c5269){return{'name':_0x4c5269[_0x1fdc('0x30')],'type':_0x4c5269['type']['key']};});_0x5a228f[_0x1fdc('0x31')]=_[_0x1fdc('0x2d')](_0x437f77,_0x1fdc('0x2a'));_0x5a228f[_0x1fdc('0x32')]=_[_0x1fdc('0x33')](_0x5d61a9[_0x1fdc('0x32')]);_0x5a228f[_0x1fdc('0x34')]=_[_0x1fdc('0x35')](_0x5a228f['model'],_0x5a228f[_0x1fdc('0x32')]);_0x362305['attributes']=_[_0x1fdc('0x35')](_0x5a228f['model'],qs['fields'](_0x5d61a9['query'][_0x1fdc('0x36')]));_0x362305[_0x1fdc('0x37')]=_0x362305[_0x1fdc('0x37')][_0x1fdc('0x38')]?_0x362305[_0x1fdc('0x37')]:_0x5a228f[_0x1fdc('0x31')];if(!_0x5d61a9[_0x1fdc('0x32')][_0x1fdc('0x39')](_0x1fdc('0x3a'))){_0x362305[_0x1fdc('0x1e')]=qs[_0x1fdc('0x1e')](_0x5d61a9['query'][_0x1fdc('0x1e')]);_0x362305[_0x1fdc('0x1c')]=qs['offset'](_0x5d61a9['query'][_0x1fdc('0x1c')]);}_0x362305['order']=qs[_0x1fdc('0x3b')](_0x5d61a9[_0x1fdc('0x32')][_0x1fdc('0x3b')]);_0x362305['where']=qs['filters'](_[_0x1fdc('0x3c')](_0x5d61a9[_0x1fdc('0x32')],_0x5a228f[_0x1fdc('0x34')]),_0x437f77);if(_0x5d61a9[_0x1fdc('0x32')][_0x1fdc('0x3d')]){_0x362305[_0x1fdc('0x3e')]=_[_0x1fdc('0x3f')](_0x362305[_0x1fdc('0x3e')],{'$or':_[_0x1fdc('0x2d')](_0x437f77,function(_0x54d710){if(_0x54d710[_0x1fdc('0x40')]!==_0x1fdc('0x41')){var _0x2a4019={};_0x2a4019[_0x54d710[_0x1fdc('0x2a')]]={'$like':'%'+_0x5d61a9[_0x1fdc('0x32')][_0x1fdc('0x3d')]+'%'};return _0x2a4019;}})});}_0x362305=_[_0x1fdc('0x3f')]({},_0x362305,_0x5d61a9['options']);var _0x353e42={'where':_0x362305['where']};return db['SmsApplication'][_0x1fdc('0x1f')](_0x353e42)[_0x1fdc('0x27')](function(_0x1432cd){_0x19d53b[_0x1fdc('0x1f')]=_0x1432cd;if(_0x5d61a9['query'][_0x1fdc('0x42')]){_0x362305[_0x1fdc('0x43')]=[{'all':!![]}];}return db[_0x1fdc('0x2e')]['findAll'](_0x362305);})[_0x1fdc('0x27')](function(_0x34acdb){_0x19d53b[_0x1fdc('0x44')]=_0x34acdb;return _0x19d53b;})[_0x1fdc('0x27')](respondWithFilteredResult(_0x6ac0c3,_0x362305))['catch'](handleError(_0x6ac0c3,null));};exports['show']=function(_0x59ada9,_0x19e167){var _0x2b1fab={'raw':!![],'where':{'id':_0x59ada9[_0x1fdc('0x45')]['id']}},_0x511285={};_0x511285['model']=_[_0x1fdc('0x33')](db[_0x1fdc('0x2e')][_0x1fdc('0x2f')]);_0x511285[_0x1fdc('0x32')]=_[_0x1fdc('0x33')](_0x59ada9['query']);_0x511285['filters']=_[_0x1fdc('0x35')](_0x511285[_0x1fdc('0x31')],_0x511285[_0x1fdc('0x32')]);_0x2b1fab['attributes']=_['intersection'](_0x511285['model'],qs[_0x1fdc('0x36')](_0x59ada9['query']['fields']));_0x2b1fab[_0x1fdc('0x37')]=_0x2b1fab['attributes'][_0x1fdc('0x38')]?_0x2b1fab[_0x1fdc('0x37')]:_0x511285[_0x1fdc('0x31')];if(_0x59ada9['query'][_0x1fdc('0x42')]){_0x2b1fab['include']=[{'all':!![]}];}_0x2b1fab=_[_0x1fdc('0x3f')]({},_0x2b1fab,_0x59ada9['options']);return db[_0x1fdc('0x2e')][_0x1fdc('0x46')](_0x2b1fab)['then'](handleEntityNotFound(_0x19e167,null))['then'](respondWithResult(_0x19e167,null))['catch'](handleError(_0x19e167,null));};exports['create']=function(_0x32393b,_0x45a9ad){return db[_0x1fdc('0x2e')][_0x1fdc('0x47')](_0x32393b['body'],{})['then'](respondWithResult(_0x45a9ad,0xc9))[_0x1fdc('0x48')](handleError(_0x45a9ad,null));};exports['update']=function(_0x2e01eb,_0x3d9638){if(_0x2e01eb[_0x1fdc('0x49')]['id']){delete _0x2e01eb['body']['id'];}return db[_0x1fdc('0x2e')]['find']({'where':{'id':_0x2e01eb[_0x1fdc('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d9638,null))['then'](saveUpdates(_0x2e01eb[_0x1fdc('0x49')],null))[_0x1fdc('0x27')](respondWithResult(_0x3d9638,null))[_0x1fdc('0x48')](handleError(_0x3d9638,null));};exports[_0x1fdc('0x28')]=function(_0x555911,_0x1384c1){return db[_0x1fdc('0x2e')][_0x1fdc('0x46')]({'where':{'id':_0x555911[_0x1fdc('0x45')]['id']}})[_0x1fdc('0x27')](handleEntityNotFound(_0x1384c1,null))[_0x1fdc('0x27')](removeEntity(_0x1384c1,null))[_0x1fdc('0x48')](handleError(_0x1384c1,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 81dcca7..1ea539a 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 _0x65e6=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','lodash'];(function(_0x1f823b,_0x483bee){var _0x302ebf=function(_0x215919){while(--_0x215919){_0x1f823b['push'](_0x1f823b['shift']());}};_0x302ebf(++_0x483bee);}(_0x65e6,0x1eb));var _0x665e=function(_0x286b04,_0x3860e6){_0x286b04=_0x286b04-0x0;var _0x4ac0e2=_0x65e6[_0x286b04];return _0x4ac0e2;};'use strict';var _=require(_0x665e('0x0'));var util=require(_0x665e('0x1'));var logger=require(_0x665e('0x2'))(_0x665e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x665e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x665e('0x5'));var config=require(_0x665e('0x6'));var attributes=require(_0x665e('0x7'));module[_0x665e('0x8')]=function(_0x149ec2,_0x3fcc09){return _0x149ec2['define'](_0x665e('0x9'),attributes,{'tableName':_0x665e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x665e('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf23b=['sms_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','SmsApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf23b,0x1d6));var _0xbf23=function(_0x220f8b,_0x57e3d2){_0x220f8b=_0x220f8b-0x0;var _0x1e9fa4=_0xf23b[_0x220f8b];return _0x1e9fa4;};'use strict';var _=require('lodash');var util=require(_0xbf23('0x0'));var logger=require(_0xbf23('0x1'))(_0xbf23('0x2'));var moment=require(_0xbf23('0x3'));var BPromise=require(_0xbf23('0x4'));var rp=require(_0xbf23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbf23('0x6'));var attributes=require('./smsApplication.attributes');module[_0xbf23('0x7')]=function(_0x4a90a7,_0x2e1147){return _0x4a90a7[_0xbf23('0x8')](_0xbf23('0x9'),attributes,{'tableName':_0xbf23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbf23('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index d84ca4d..2729feb 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 _0xd481=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4ba33a,_0x1abd42){var _0x368475=function(_0x305020){while(--_0x305020){_0x4ba33a['push'](_0x4ba33a['shift']());}};_0x368475(++_0x1abd42);}(_0xd481,0x1e4));var _0x1d48=function(_0xffdb13,_0x18a68d){_0xffdb13=_0xffdb13-0x0;var _0x5095e4=_0xd481[_0xffdb13];return _0x5095e4;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var moment=require(_0x1d48('0x1'));var BPromise=require(_0x1d48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d48('0x3'));var db=require(_0x1d48('0x4'))['db'];var utils=require(_0x1d48('0x5'));var logger=require('../../config/logger')(_0x1d48('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d48('0x7'));var client=jayson[_0x1d48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472584,_0x3099cc,_0x3b8bd4){return new BPromise(function(_0x27c383,_0x1fc969){return client[_0x1d48('0x9')](_0x472584,_0x3b8bd4)[_0x1d48('0xa')](function(_0x303dce){logger[_0x1d48('0xb')](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));logger[_0x1d48('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3099cc,_0x1d48('0xd'),JSON[_0x1d48('0xf')](_0x303dce));if(_0x303dce[_0x1d48('0x10')]){if(_0x303dce[_0x1d48('0x10')][_0x1d48('0x11')]===0x1f4){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x1fc969(_0x303dce[_0x1d48('0x10')]['message']);}logger[_0x1d48('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x27c383(_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);}else{logger['info'](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));_0x27c383(_0x303dce[_0x1d48('0x13')]['message']);}})[_0x1d48('0x14')](function(_0x433c92){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x433c92);_0x1fc969(_0x433c92);});});} \ No newline at end of file +var _0xfb11=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xfb11[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6b637b7..fa91ad4 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 _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x5955e1,_0x5024c6){var _0x4d2fe2=function(_0x4c4fb2){while(--_0x4c4fb2){_0x5955e1['push'](_0x5955e1['shift']());}};_0x4d2fe2(++_0x5024c6);}(_0xea28,0x13a));var _0x8ea2=function(_0x5f3f48,_0x12d271){_0x5f3f48=_0x5f3f48-0x0;var _0x31c591=_0xea28[_0x5f3f48];return _0x31c591;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5c00,0x17e));var _0x05c0=function(_0x14afda,_0x512394){_0x14afda=_0x14afda-0x0;var _0x1923af=_0x5c00[_0x14afda];return _0x1923af;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 585fa74..82048ad 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 _0xea1c=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x187bd0,_0x358402){var _0x3f57c9=function(_0xf44d49){while(--_0xf44d49){_0x187bd0['push'](_0x187bd0['shift']());}};_0x3f57c9(++_0x358402);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xcea1('0x0')]={'closed':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcea1('0x2')]},'disposition':{'type':Sequelize[_0xcea1('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcea1('0x3')]},'note':{'type':Sequelize[_0xcea1('0x3')]},'phone':{'type':Sequelize[_0xcea1('0x3')]},'read1stAt':{'type':Sequelize[_0xcea1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcea1('0x4')]('in',_0xcea1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcea1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xcea1('0x4')]('in',_0xcea1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xa2c8=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x5a60d0,_0x107932){var _0x3e0b71=function(_0x2d6cd6){while(--_0x2d6cd6){_0x5a60d0['push'](_0x5a60d0['shift']());}};_0x3e0b71(++_0x107932);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8a2c('0x0'));var moment=require(_0x8a2c('0x1'));module[_0x8a2c('0x2')]={'closed':{'type':Sequelize[_0x8a2c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a2c('0x4')]},'disposition':{'type':Sequelize[_0x8a2c('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8a2c('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8a2c('0x6')]('in',_0x8a2c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a2c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8a2c('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8a2c('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 f795bf0..bdd3283 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 _0x85b2=['show','params','includeAll','include','options','create','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','pick','format','addTags','removeTags','download','unix','root','server','files','join','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','createdAt','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','direction','System','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','answered','UserId','waiting','closed','talking','total','SmsInteraction','rawAttributes','fieldName','key','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','contactName','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all'];(function(_0x31a961,_0xe193c3){var _0xd09142=function(_0x326531){while(--_0x326531){_0x31a961['push'](_0x31a961['shift']());}};_0xd09142(++_0xe193c3);}(_0x85b2,0x11a));var _0x285b=function(_0x786cad,_0x2cb916){_0x786cad=_0x786cad-0x0;var _0xc8ca5f=_0x85b2[_0x786cad];return _0xc8ca5f;};'use strict';var emlformat=require(_0x285b('0x0'));var rimraf=require(_0x285b('0x1'));var zipdir=require(_0x285b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x285b('0x3'));var moment=require(_0x285b('0x4'));var BPromise=require(_0x285b('0x5'));var Mustache=require(_0x285b('0x6'));var util=require(_0x285b('0x7'));var path=require(_0x285b('0x8'));var sox=require(_0x285b('0x9'));var csv=require(_0x285b('0xa'));var ejs=require(_0x285b('0xb'));var fs=require('fs');var fs_extra=require(_0x285b('0xc'));var _=require('lodash');var squel=require(_0x285b('0xd'));var crypto=require('crypto');var jsforce=require(_0x285b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x285b('0xa'));var querystring=require(_0x285b('0xf'));var Papa=require(_0x285b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x285b('0x11'));var as=require(_0x285b('0x12'));var pdf=require(_0x285b('0x13'));var hardwareService=require(_0x285b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x285b('0x15'));var licenseUtil=require(_0x285b('0x16'));var db=require(_0x285b('0x17'))['db'];config[_0x285b('0x18')]=_['defaults'](config['redis'],{'host':_0x285b('0x19'),'port':0x18eb});var socket=require(_0x285b('0x1a'))(new Redis(config['redis']));require(_0x285b('0x1b'))[_0x285b('0x1c')](socket);function respondWithStatusCode(_0x3adabb,_0x215f01){_0x215f01=_0x215f01||0xcc;return function(_0x34805f){if(_0x34805f){return _0x3adabb[_0x285b('0x1d')](_0x215f01);}return _0x3adabb[_0x285b('0x1e')](_0x215f01)[_0x285b('0x1f')]();};}function respondWithResult(_0x2e8f20,_0x27f849){_0x27f849=_0x27f849||0xc8;return function(_0x1ed562){if(_0x1ed562){return _0x2e8f20['status'](_0x27f849)[_0x285b('0x20')](_0x1ed562);}};}function respondWithFilteredResult(_0x1747e4,_0x46df50){return function(_0x5c4d0d){if(_0x5c4d0d){var _0x3c91f4=typeof _0x46df50[_0x285b('0x21')]===_0x285b('0x22')&&typeof _0x46df50[_0x285b('0x23')]===_0x285b('0x22');var _0x31c4ed=_0x5c4d0d[_0x285b('0x24')];var _0x115c5d=_0x3c91f4?0x0:_0x46df50[_0x285b('0x21')];var _0xa42e50=_0x3c91f4?_0x5c4d0d[_0x285b('0x24')]:_0x46df50[_0x285b('0x21')]+_0x46df50[_0x285b('0x23')];var _0x1b14fc;if(_0xa42e50>=_0x31c4ed){_0xa42e50=_0x31c4ed;_0x1b14fc=0xc8;}else{_0x1b14fc=0xce;}_0x1747e4['status'](_0x1b14fc);return _0x1747e4['set'](_0x285b('0x25'),_0x115c5d+'-'+_0xa42e50+'/'+_0x31c4ed)[_0x285b('0x20')](_0x5c4d0d);}return null;};}function patchUpdates(_0x9810aa){return function(_0x25e1fa){try{jsonpatch[_0x285b('0x26')](_0x25e1fa,_0x9810aa,!![]);}catch(_0x3330da){return BPromise[_0x285b('0x27')](_0x3330da);}return _0x25e1fa[_0x285b('0x28')]();};}function saveUpdates(_0x5824c0,_0x56c767){return function(_0x62838c){if(_0x62838c){return _0x62838c[_0x285b('0x29')](_0x5824c0)[_0x285b('0x2a')](function(_0x4c05af){return _0x4c05af;});}return null;};}function removeEntity(_0x414b10,_0x27141b){return function(_0x1b467d){if(_0x1b467d){return _0x1b467d['destroy']()[_0x285b('0x2a')](function(){_0x414b10[_0x285b('0x1e')](0xcc)[_0x285b('0x1f')]();});}};}function handleEntityNotFound(_0x1abf6,_0x410c6a){return function(_0x47c7ee){if(!_0x47c7ee){_0x1abf6[_0x285b('0x1d')](0x194);}return _0x47c7ee;};}function handleError(_0x1d6674,_0x201095){_0x201095=_0x201095||0x1f4;return function(_0x587ebf){logger['error'](_0x587ebf[_0x285b('0x2b')]);if(_0x587ebf[_0x285b('0x2c')]){delete _0x587ebf[_0x285b('0x2c')];}_0x1d6674[_0x285b('0x1e')](_0x201095)['send'](_0x587ebf);};}function getInteractionUsers(_0x28bb1b,_0x54cbf0){return new BPromise(function(_0xc70d7b,_0x433968){try{if(_0x54cbf0[_0x28bb1b['id']]){_0x28bb1b[_0x285b('0x2d')]=_[_0x285b('0x2e')](_0x54cbf0[_0x28bb1b['id']],function(_0x43972f){return{'id':_0x43972f['id'],'fullname':_0x43972f[_0x285b('0x2f')]};});}}catch(_0x3ea941){_0x433968(_0x3ea941);}_0xc70d7b(_0x28bb1b);});}function getInteractionTags(_0x377d65,_0x52e8d6){return new BPromise(function(_0x22c2ae,_0x29d984){try{if(_0x377d65[_0x285b('0x30')]){_0x377d65[_0x285b('0x31')]=[];_0x377d65[_0x285b('0x30')][_0x285b('0x32')](',')[_0x285b('0x33')](function(_0x45b06c){_0x377d65['Tags'][_0x285b('0x34')](_0x52e8d6[_0x45b06c]);});}delete _0x377d65['TagIds'];}catch(_0x3edba1){_0x29d984(_0x3edba1);}_0x22c2ae(_0x377d65);});}function updateSmsInteraction(_0x4d4aa8,_0x5e10d8,_0x24826d){return new BPromise(function(_0x3689d9,_0x27e468){return getInteractionUsers(_0x4d4aa8,_0x24826d)[_0x285b('0x2a')](function(_0x1e6902){return getInteractionTags(_0x1e6902,_0x5e10d8);})[_0x285b('0x2a')](function(_0x117c9c){return getStateInteraction(_0x117c9c);})['then'](function(_0x5744d6){_0x3689d9(_0x5744d6);})[_0x285b('0x35')](function(_0x4fec46){_0x27e468(_0x4fec46);});});}function getStateInteraction(_0x50a698){return new BPromise(function(_0x4cef75){_0x50a698['waiting']=0x0;_0x50a698['talking']=0x0;_0x50a698[_0x285b('0x36')]=0x0;_0x50a698['unmanaged']=0x0;_0x50a698['total']=0x0;if(!_0x50a698['closed']&&!_0x50a698[_0x285b('0x37')]){_0x50a698[_0x285b('0x38')]+=0x1;}if(!_0x50a698[_0x285b('0x39')]&&_0x50a698['UserId']){_0x50a698[_0x285b('0x3a')]+=0x1;if(_0x50a698[_0x285b('0x38')]){_0x50a698[_0x285b('0x38')]-=0x1;}}if(_0x50a698[_0x285b('0x39')]&&_0x50a698[_0x285b('0x37')]){_0x50a698[_0x285b('0x36')]+=0x1;if(_0x50a698[_0x285b('0x3a')]){_0x50a698[_0x285b('0x3a')]-=0x1;}}if(_0x50a698[_0x285b('0x39')]&&!_0x50a698[_0x285b('0x37')]){_0x50a698['unmanaged']+=0x1;if(_0x50a698[_0x285b('0x38')]){_0x50a698[_0x285b('0x38')]-=0x1;}}_0x50a698[_0x285b('0x3b')]+=0x1;_0x4cef75(_0x50a698);});}exports['index']=function(_0x9e3fa,_0x2810e1){var _0x99ce4d={},_0x17649b={},_0x20143d={'count':0x0,'rows':[]};var _0x304bd0=_[_0x285b('0x2e')](db[_0x285b('0x3c')][_0x285b('0x3d')],function(_0x5aec63){return{'name':_0x5aec63[_0x285b('0x3e')],'type':_0x5aec63['type'][_0x285b('0x3f')]};});_0x17649b['model']=_[_0x285b('0x2e')](_0x304bd0,_0x285b('0x2c'));_0x17649b['query']=_[_0x285b('0x40')](_0x9e3fa['query']);_0x17649b['filters']=_[_0x285b('0x41')](_0x17649b[_0x285b('0x42')],_0x17649b[_0x285b('0x43')]);_0x99ce4d['attributes']=_[_0x285b('0x41')](_0x17649b['model'],qs['fields'](_0x9e3fa[_0x285b('0x43')][_0x285b('0x44')]));_0x99ce4d[_0x285b('0x45')]=_0x99ce4d[_0x285b('0x45')][_0x285b('0x46')]?_0x99ce4d[_0x285b('0x45')]:_0x17649b[_0x285b('0x42')];if(!_0x9e3fa['query'][_0x285b('0x47')]('nolimit')){_0x99ce4d[_0x285b('0x23')]=qs[_0x285b('0x23')](_0x9e3fa[_0x285b('0x43')][_0x285b('0x23')]);_0x99ce4d[_0x285b('0x21')]=qs[_0x285b('0x21')](_0x9e3fa[_0x285b('0x43')]['offset']);}_0x99ce4d[_0x285b('0x48')]=qs[_0x285b('0x49')](_0x9e3fa['query'][_0x285b('0x49')]);_0x99ce4d[_0x285b('0x4a')]=qs[_0x285b('0x4b')](_['pick'](_0x9e3fa[_0x285b('0x43')],_0x17649b[_0x285b('0x4b')]),_0x304bd0);var _0x413fa1=[];var _0x288b81=squel[_0x285b('0x4c')]()[_0x285b('0x4d')]('id')[_0x285b('0x4d')](_0x285b('0x2c'))[_0x285b('0x4d')](_0x285b('0x4e'))[_0x285b('0x4f')](_0x285b('0x50'));var _0x42e581=squel[_0x285b('0x4c')]()[_0x285b('0x4d')](_0x285b('0x51'))[_0x285b('0x4d')]('u.fullname')[_0x285b('0x4d')](_0x285b('0x52'))['from'](_0x285b('0x53'),'ui')[_0x285b('0x54')](_0x285b('0x55'),'u',_0x285b('0x56'));var _0x1a5029=squel['select']()[_0x285b('0x4f')]('sms_interactions','i')[_0x285b('0x54')](_0x285b('0x57'),'c',_0x285b('0x58'))[_0x285b('0x54')](_0x285b('0x55'),'o',_0x285b('0x59'))[_0x285b('0x54')](_0x285b('0x5a'),'a',_0x285b('0x5b'))[_0x285b('0x54')](_0x285b('0x5c'),'me','me.SmsInteractionId\x20=\x20i.id')['left_join'](_0x285b('0x5d'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x285b('0x54')]('tools_tags','t',_0x285b('0x5e'));var _0x481738=squel['expr']();var _0x390b6a=[];var _0xb18577=squel[_0x285b('0x5f')]();var _0x487e73;if(_0x9e3fa['query'][_0x285b('0x60')]){_0x487e73=as[_0x285b('0x61')](_0x9e3fa['query'][_0x285b('0x60')]);var _0x3aa4a3=_0x487e73[_0x285b('0x62')];for(var _0x43d8ef=0x0;_0x43d8ef<_0x487e73['conditions'][_0x285b('0x46')];_0x43d8ef++){var _0x40f88b=_0x487e73[_0x285b('0x63')][_0x43d8ef];var _0x3de03d='i';var _0x38d6c9=_[_0x285b('0x64')](_0x304bd0,[_0x285b('0x2c'),_0x40f88b[_0x285b('0x4d')]]);if(!_0x38d6c9){switch(_0x40f88b[_0x285b('0x4d')]){case _0x285b('0x65'):if(_0x40f88b['value']==0x1){_0x1a5029[_0x285b('0x66')]('`'+_0x40f88b[_0x285b('0x4d')]+_0x285b('0x67'));}else{_0x1a5029['having']('`'+_0x40f88b[_0x285b('0x4d')]+_0x285b('0x68'));}break;case _0x285b('0x69'):if(_0x40f88b[_0x285b('0x6a')]===_0x285b('0x6b')){if(_0x40f88b[_0x285b('0x6c')][_0x285b('0x32')]('\x20')[_0x285b('0x46')]>0x1){_0x481738[_0x3aa4a3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x285b('0x6d')](_0x40f88b[_0x285b('0x6c')]),null);}else{var _0x4b8429='%'+_0x40f88b[_0x285b('0x6c')]+'%';_0x481738[_0x3aa4a3](_0x285b('0x6e'),_0x4b8429,_0x4b8429,_0x4b8429);}}else{_0x38d6c9=_[_0x285b('0x64')](_0x304bd0,[_0x285b('0x2c'),'ContactId']);_0x40f88b[_0x285b('0x4d')]=_0x285b('0x6f');_0x4a26a2=as[_0x285b('0x70')](_0x3de03d,_0x38d6c9[_0x285b('0x71')],_0x40f88b);_0x481738[_0x3aa4a3](_0x4a26a2['text'],_0x4a26a2[_0x285b('0x6c')]['start'],_0x4a26a2[_0x285b('0x6c')][_0x285b('0x1f')]);}break;case _0x285b('0x72'):var _0x165350=_0x40f88b[_0x285b('0x6c')][_0x285b('0x32')](',')[_0x285b('0x2e')](function(_0x2b15a1){return Number(_0x2b15a1);});_0x165350[_0x285b('0x33')](function(_0x1f5bd4){_0xb18577['or'](_0x285b('0x73'),'%,'+_0x1f5bd4+',%');});_0x390b6a=_[_0x285b('0x74')](_0x390b6a,_0x165350);break;case _0x285b('0x75'):if(_0x40f88b[_0x285b('0x6a')]===_0x285b('0x6b')){_0x481738[_0x3aa4a3](_0x285b('0x76'),'%'+_0x40f88b[_0x285b('0x6c')]+'%',null);}else{_0x38d6c9=_[_0x285b('0x64')](_0x304bd0,['name',_0x285b('0x37')]);_0x40f88b['field']='UserId';_0x4a26a2=as[_0x285b('0x70')](_0x3de03d,_0x38d6c9[_0x285b('0x71')],_0x40f88b);_0x481738[_0x3aa4a3](_0x4a26a2[_0x285b('0x77')],_0x4a26a2[_0x285b('0x6c')][_0x285b('0x78')],_0x4a26a2[_0x285b('0x6c')][_0x285b('0x1f')]);}break;case _0x285b('0x79'):_0x4a26a2=as[_0x285b('0x70')]('me',null,_0x40f88b);_0x481738[_0x3aa4a3](_0x4a26a2['text'],_0x4a26a2['value'][_0x285b('0x78')],_0x4a26a2[_0x285b('0x6c')][_0x285b('0x1f')]);break;}}else{var _0x4a26a2=as[_0x285b('0x70')](_0x3de03d,_0x38d6c9[_0x285b('0x71')],_0x40f88b);_0x481738[_0x3aa4a3](_0x4a26a2[_0x285b('0x77')],_0x4a26a2[_0x285b('0x6c')][_0x285b('0x78')],_0x4a26a2[_0x285b('0x6c')]['end']);}}}else{var _0x2310ee=_(_0x9e3fa[_0x285b('0x43')])[_0x285b('0x40')]()['map'](function(_0x27d9b6){return _[_0x285b('0x7a')](_0x304bd0,['name',_0x27d9b6])?_0x27d9b6:undefined;})['compact']()[_0x285b('0x6c')]();if(!_[_0x285b('0x7b')](_0x2310ee)){_0x2310ee[_0x285b('0x33')](function(_0x34e833){if(_0x34e833===_0x285b('0x7c')){_0x1a5029['where'](_0x285b('0x7d'),[][_0x285b('0x7e')](_0x9e3fa[_0x285b('0x43')][_0x34e833]));}else if(_0x34e833==='createdAt'){var _0x3ce1db=JSON[_0x285b('0x7f')](_0x9e3fa['query'][_0x34e833])[_0x285b('0x80')];var _0x139858=JSON[_0x285b('0x7f')](_0x9e3fa[_0x285b('0x43')][_0x34e833])[_0x285b('0x81')];_0x1a5029[_0x285b('0x4a')](_0x285b('0x82'),_0x3ce1db,_0x139858);}else{if(_0x9e3fa[_0x285b('0x43')][_0x34e833]==='null'){_0x1a5029[_0x285b('0x4a')]('i.'+_0x34e833+_0x285b('0x83'));}else{_0x1a5029[_0x285b('0x4a')]('i.'+_0x34e833+_0x285b('0x84'),_0x9e3fa[_0x285b('0x43')][_0x34e833]);}}});}if(_0x9e3fa[_0x285b('0x43')][_0x285b('0x85')]){if(_0x9e3fa[_0x285b('0x43')][_0x285b('0x85')]==0x1){_0x1a5029[_0x285b('0x66')]('`unreadMessages`\x20=\x200');}else{_0x1a5029[_0x285b('0x66')](_0x285b('0x86'));}}if(_0x9e3fa[_0x285b('0x43')][_0x285b('0x87')]){_0x390b6a=_[_0x285b('0x88')](_0x9e3fa[_0x285b('0x43')][_0x285b('0x87')])?_0x9e3fa[_0x285b('0x43')]['tag']:new Array(_0x9e3fa[_0x285b('0x43')][_0x285b('0x87')]);_0x390b6a[_0x285b('0x33')](function(_0x24ce97){_0xb18577['or'](_0x285b('0x73'),'%,'+_0x24ce97+',%');});}if(_0x9e3fa[_0x285b('0x43')][_0x285b('0x89')]){var _0x5e76c3=_0x9e3fa[_0x285b('0x43')][_0x285b('0x89')][_0x285b('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x285b('0x8b')](_0x5e76c3)){_0x481738['or'](_0x285b('0x8c'),_0x5e76c3+'%')['or'](_0x285b('0x8d'),_0x5e76c3+'%');}else{_0x481738['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x285b('0x6d')](_0x5e76c3))['or'](_0x285b('0x8e'),_0x5e76c3+'%');}}}_0x1a5029[_0x285b('0x4a')](_0x481738);_0x1a5029['group'](_0x285b('0x8f'));var _0xe5fa74={'type':db[_0x285b('0x90')][_0x285b('0x91')][_0x285b('0x92')],'raw':!![]};var _0x516057=_0x1a5029['clone']();_0x516057[_0x285b('0x4d')]('i.id');_0x516057[_0x285b('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x285b('0x65'));if(_0x99ce4d[_0x285b('0x48')]){_0x99ce4d['order'][_0x285b('0x33')](function(_0x5bd354){var _0x57798b=_0x5bd354[0x0]===_0x285b('0x93')?_0x5bd354[0x0]:'i.'+_0x5bd354[0x0];_0x1a5029[_0x285b('0x48')](_0x57798b,_0x5bd354[0x1]==='DESC'?![]:!![]);});}if(!_[_0x285b('0x7b')](_0x390b6a)){_0x1a5029[_0x285b('0x66')](_0xb18577);_0x516057[_0x285b('0x4a')]('t.id\x20IN\x20?',_0x390b6a);}BPromise['resolve']()[_0x285b('0x2a')](function(){if(!_0x487e73){if(_0x9e3fa[_0x285b('0x43')][_0x285b('0x7c')])return;_0x516057[_0x285b('0x4a')](_0x285b('0x94'));_0x1a5029['where'](_0x285b('0x94'));return;}if(_0x9e3fa[_0x285b('0x95')]['role']!=='agent')return;return _0x9e3fa[_0x285b('0x95')][_0x285b('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1899c4){if(_[_0x285b('0x7b')](_0x1899c4)){_0x516057[_0x285b('0x4a')](_0x285b('0x97'));_0x1a5029['where'](_0x285b('0x97'));}else{_0x516057[_0x285b('0x4a')](_0x285b('0x7d'),_['map'](_0x1899c4,'id'));_0x1a5029[_0x285b('0x4a')](_0x285b('0x7d'),_[_0x285b('0x2e')](_0x1899c4,'id'));}});})[_0x285b('0x2a')](function(){if(_0x9e3fa[_0x285b('0x95')][_0x285b('0x98')]===_0x285b('0x99')&&!_0x487e73&&!_0x9e3fa[_0x285b('0x43')][_0x285b('0x7c')])return[];return db[_0x285b('0x9a')][_0x285b('0x43')](_0x516057[_0x285b('0x9b')](),_0xe5fa74);})[_0x285b('0x2a')](function(_0x2ec348){_0x20143d['count']=_0x2ec348['length'];if(_0x20143d[_0x285b('0x24')]===0x0)return[];return db[_0x285b('0x9a')][_0x285b('0x43')](_0x288b81[_0x285b('0x9b')](),_0xe5fa74)[_0x285b('0x2a')](function(_0x5d172e){_0x413fa1=_[_0x285b('0x9c')](_0x5d172e,'id');_0xe5fa74=_[_0x285b('0x9d')](_0xe5fa74,{'model':db[_0x285b('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9e3fa[_0x285b('0x43')][_0x285b('0x44')]){_0x99ce4d[_0x285b('0x45')][_0x285b('0x33')](function(_0x1c5a68){_0x1a5029[_0x285b('0x4d')]('i.'+_0x1c5a68);});}else{_0x1a5029[_0x285b('0x4d')](_0x285b('0x9e'),'unreadMessages');_0x1a5029[_0x285b('0x4d')](_0x285b('0x9f'),'Account.key');_0x1a5029[_0x285b('0x4d')](_0x285b('0xa0'),_0x285b('0xa1'));_0x1a5029[_0x285b('0x4d')]('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',_0x285b('0x93'));_0x1a5029[_0x285b('0x4d')](_0x285b('0xa2'));_0x1a5029[_0x285b('0x4d')](_0x285b('0xa3'),_0x285b('0xa4'));_0x1a5029[_0x285b('0x4d')](_0x285b('0xa5'),_0x285b('0xa6'));_0x1a5029[_0x285b('0x4d')](_0x285b('0xa7'),'Contact.email');_0x1a5029[_0x285b('0x4d')](_0x285b('0xa8'),_0x285b('0xa9'));_0x1a5029[_0x285b('0x4d')](_0x285b('0xaa'),_0x285b('0xab'));_0x1a5029[_0x285b('0x4d')](_0x285b('0xac'),'Contact.fax');_0x1a5029[_0x285b('0x4d')]('o.fullname',_0x285b('0xad'));_0x1a5029[_0x285b('0x4d')](_0x285b('0xae'),_0x285b('0xaf'));_0x1a5029[_0x285b('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x285b('0x30'));}if(_0x99ce4d[_0x285b('0x23')])_0x1a5029[_0x285b('0x23')](_0x99ce4d[_0x285b('0x23')]);if(_0x99ce4d[_0x285b('0x21')])_0x1a5029[_0x285b('0x21')](_0x99ce4d[_0x285b('0x21')]);return db[_0x285b('0x9a')][_0x285b('0x43')](_0x1a5029[_0x285b('0x9b')](),_0xe5fa74);})[_0x285b('0x2a')](function(_0x234f9e){if(_0x234f9e[_0x285b('0x46')]>0x0)_0x42e581['where'](_0x285b('0xb0'),_['map'](_0x234f9e,'id'));return db[_0x285b('0x9a')][_0x285b('0x43')](_0x42e581[_0x285b('0x9b')](),_0xe5fa74)[_0x285b('0x2a')](function(_0x938974){var _0x4d20a1=_[_0x285b('0xb1')](_0x938974,_0x285b('0xb2'));var _0x1754e9=[];_0x234f9e['forEach'](function(_0x3c4de7){_0x1754e9[_0x285b('0x34')](updateSmsInteraction(_0x3c4de7,_0x413fa1,_0x4d20a1));});return BPromise[_0x285b('0xb3')](_0x1754e9);});});})['then'](function(_0xeab7d3){_0x20143d['rows']=_0xeab7d3;return _0x20143d;})[_0x285b('0x2a')](respondWithFilteredResult(_0x2810e1,_0x99ce4d))['catch'](handleError(_0x2810e1,null));};exports[_0x285b('0xb4')]=function(_0x29bac6,_0xf225dd){var _0x5c5519={'raw':![],'where':{'id':_0x29bac6[_0x285b('0xb5')]['id']}},_0xf2c0c0={};_0xf2c0c0['model']=_['keys'](db[_0x285b('0x3c')]['rawAttributes']);_0xf2c0c0[_0x285b('0x43')]=_['keys'](_0x29bac6[_0x285b('0x43')]);_0xf2c0c0['filters']=_[_0x285b('0x41')](_0xf2c0c0[_0x285b('0x42')],_0xf2c0c0['query']);_0x5c5519['attributes']=_[_0x285b('0x41')](_0xf2c0c0['model'],qs['fields'](_0x29bac6[_0x285b('0x43')][_0x285b('0x44')]));_0x5c5519[_0x285b('0x45')]=_0x5c5519[_0x285b('0x45')][_0x285b('0x46')]?_0x5c5519[_0x285b('0x45')]:_0xf2c0c0[_0x285b('0x42')];if(_0x29bac6['query'][_0x285b('0xb6')]){_0x5c5519[_0x285b('0xb7')]=[{'all':!![]}];}_0x5c5519=_[_0x285b('0x9d')]({},_0x5c5519,_0x29bac6[_0x285b('0xb8')]);return db[_0x285b('0x3c')]['find'](_0x5c5519)[_0x285b('0x2a')](handleEntityNotFound(_0xf225dd,null))[_0x285b('0x2a')](respondWithResult(_0xf225dd,null))['catch'](handleError(_0xf225dd,null));};exports[_0x285b('0xb9')]=function(_0x531229,_0x1bac49){return db['SmsInteraction'][_0x285b('0xb9')](_0x531229['body'],{})[_0x285b('0x2a')](respondWithResult(_0x1bac49,0xc9))[_0x285b('0x35')](handleError(_0x1bac49,null));};exports[_0x285b('0x29')]=function(_0x345237,_0x3eca6f){if(_0x345237[_0x285b('0x79')]['id']){delete _0x345237['body']['id'];}return db[_0x285b('0x3c')][_0x285b('0x64')]({'where':{'id':_0x345237[_0x285b('0xb5')]['id']}})[_0x285b('0x2a')](handleEntityNotFound(_0x3eca6f,null))[_0x285b('0x2a')](saveUpdates(_0x345237[_0x285b('0x79')],null))['then'](respondWithResult(_0x3eca6f,null))[_0x285b('0x35')](handleError(_0x3eca6f,null));};exports['destroy']=function(_0x2abd15,_0x4cdd31){return db[_0x285b('0x3c')]['find']({'where':{'id':_0x2abd15[_0x285b('0xb5')]['id']}})['then'](handleEntityNotFound(_0x4cdd31,null))['then'](removeEntity(_0x4cdd31,null))[_0x285b('0x35')](handleError(_0x4cdd31,null));};exports[_0x285b('0xba')]=function(_0x33be8a,_0x4fd719){return db[_0x285b('0x3c')]['describe']()[_0x285b('0x2a')](respondWithResult(_0x4fd719,null))[_0x285b('0x35')](handleError(_0x4fd719,null));};exports['addMessage']=function(_0x49b541,_0x13174a,_0x475ac8){return db[_0x285b('0xbb')][_0x285b('0x64')]({'where':{'id':_0x49b541[_0x285b('0xb5')]['id']}})[_0x285b('0x2a')](handleEntityNotFound(_0x13174a,null))[_0x285b('0x2a')](function(_0xf2f75d){if(_0xf2f75d){return _0xf2f75d[_0x285b('0xbc')](_0x49b541[_0x285b('0x79')][_0x285b('0xbd')],_[_0x285b('0xbe')](_0x49b541[_0x285b('0x79')],[_0x285b('0xbd'),'id'])||{});}})[_0x285b('0x2a')](respondWithResult(_0x13174a,null))[_0x285b('0x35')](handleError(_0x13174a,null));};exports[_0x285b('0xbf')]=function(_0x47d80b,_0x1ad853,_0x3efe3f){var _0x46a832={'raw':![],'where':{}};var _0x3d9f02={};var _0x13585f={'count':0x0,'rows':[]};return db[_0x285b('0x3c')][_0x285b('0xc0')]({'where':{'id':_0x47d80b['params']['id']}})['then'](handleEntityNotFound(_0x1ad853,null))[_0x285b('0x2a')](function(_0x8d8202){if(_0x8d8202){_0x3d9f02['model']=_[_0x285b('0x40')](db[_0x285b('0xbb')][_0x285b('0x3d')]);_0x3d9f02[_0x285b('0x43')]=_[_0x285b('0x40')](_0x47d80b[_0x285b('0x43')]);_0x3d9f02[_0x285b('0x4b')]=_['intersection'](_0x3d9f02[_0x285b('0x42')],_0x3d9f02[_0x285b('0x43')]);_0x46a832[_0x285b('0x45')]=_[_0x285b('0x41')](_0x3d9f02[_0x285b('0x42')],qs[_0x285b('0x44')](_0x47d80b[_0x285b('0x43')][_0x285b('0x44')]));_0x46a832[_0x285b('0x45')]=_0x46a832[_0x285b('0x45')][_0x285b('0x46')]?_0x46a832[_0x285b('0x45')]:_0x3d9f02[_0x285b('0x42')];if(!_0x47d80b[_0x285b('0x43')][_0x285b('0x47')]('nolimit')){_0x46a832[_0x285b('0x23')]=qs[_0x285b('0x23')](_0x47d80b['query'][_0x285b('0x23')]);_0x46a832[_0x285b('0x21')]=qs[_0x285b('0x21')](_0x47d80b['query'][_0x285b('0x21')]);}_0x46a832[_0x285b('0x48')]=qs[_0x285b('0x49')](_0x47d80b[_0x285b('0x43')][_0x285b('0x49')]);_0x46a832[_0x285b('0x4a')]=qs[_0x285b('0x4b')](_[_0x285b('0xc1')](_0x47d80b[_0x285b('0x43')],_0x3d9f02[_0x285b('0x4b')]));_0x46a832['where'][_0x285b('0xb2')]=_0x8d8202['id'];if(_0x47d80b['query'][_0x285b('0x89')]){_0x46a832['where']=_['merge'](_0x46a832[_0x285b('0x4a')],{'$or':_[_0x285b('0x2e')](_0x46a832[_0x285b('0x45')],function(_0x550ccb){var _0x1f244a={};_0x1f244a[_0x550ccb]={'$like':'%'+_0x47d80b[_0x285b('0x43')][_0x285b('0x89')]+'%'};return _0x1f244a;})});}if(_0x47d80b[_0x285b('0x43')][_0x285b('0x80')]){var _0x4e0090=_0x47d80b[_0x285b('0x43')][_0x285b('0x80')]['split'](',');var _0x51d7ab={};_0x51d7ab[_0x4e0090[0x0]]={'$gte':moment(_0x4e0090[0x1])[_0x285b('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x46a832[_0x285b('0x4a')]=_[_0x285b('0x9d')](_0x46a832[_0x285b('0x4a')],_0x51d7ab);}_0x46a832=_[_0x285b('0x9d')]({},_0x46a832,_0x47d80b[_0x285b('0xb8')]);return db[_0x285b('0xbb')][_0x285b('0x24')]({'where':_0x46a832['where']})[_0x285b('0x2a')](function(_0x59294d){_0x13585f[_0x285b('0x24')]=_0x59294d;if(_0x47d80b['query'][_0x285b('0xb6')]){_0x46a832['include']=[{'all':!![]}];}return db[_0x285b('0xbb')]['findAll'](_0x46a832);})['then'](function(_0x1ce5f1){_0x13585f['rows']=_0x1ce5f1;return _0x13585f;});}})[_0x285b('0x2a')](respondWithFilteredResult(_0x1ad853,_0x46a832))[_0x285b('0x35')](handleError(_0x1ad853,null));};exports[_0x285b('0xc3')]=function(_0x13a9b7,_0x3a115a,_0xdc0652){return db['SmsInteraction']['find']({'where':{'id':_0x13a9b7[_0x285b('0xb5')]['id']}})[_0x285b('0x2a')](handleEntityNotFound(_0x3a115a,null))[_0x285b('0x2a')](function(_0x16b93f){if(_0x16b93f){return _0x16b93f['setTags'](_0x13a9b7[_0x285b('0x79')][_0x285b('0xbd')],_[_0x285b('0xbe')](_0x13a9b7[_0x285b('0x79')],['ids','id'])||{})['spread'](function(){return db[_0x285b('0x72')]['findAll']({'attributes':['id',_0x285b('0x2c'),_0x285b('0x4e')],'where':{'id':_0x13a9b7[_0x285b('0x79')][_0x285b('0xbd')]}});})['then'](function(_0x3b412f){socket['emit']('smsInteractionTags:save',{'id':Number(_0x13a9b7['params']['id']),'tags':_0x3b412f||[]});return{'id':Number(_0x13a9b7[_0x285b('0xb5')]['id']),'tags':_0x3b412f||[]};});}})['then'](respondWithResult(_0x3a115a,null))[_0x285b('0x35')](handleError(_0x3a115a,null));};exports[_0x285b('0xc4')]=function(_0x341682,_0x4dfd20,_0x41299d){return db[_0x285b('0x3c')]['find']({'where':{'id':_0x341682[_0x285b('0xb5')]['id']}})[_0x285b('0x2a')](handleEntityNotFound(_0x4dfd20,null))[_0x285b('0x2a')](function(_0x36e29c){if(_0x36e29c){return _0x36e29c[_0x285b('0xc4')](_0x341682['query'][_0x285b('0xbd')]);}})[_0x285b('0x2a')](respondWithStatusCode(_0x4dfd20,null))['catch'](handleError(_0x4dfd20,null));};exports[_0x285b('0xc5')]=function(_0x164e3f,_0x320d82){var _0xc0dee4=moment()[_0x285b('0xc6')]()['toString']();var _0x3d73ee=path['join'](config[_0x285b('0xc7')],_0x285b('0xc8'),_0x285b('0xc9'),'tmp');var _0x5db169=path[_0x285b('0xca')](config[_0x285b('0xc7')],_0x285b('0xc8'),'files',_0x285b('0xcb'));var _0x4071ea=path[_0x285b('0xca')](_0x3d73ee,_0xc0dee4);var _0x28e5fd=util['format'](_0x285b('0xcc'),_0x164e3f['params']['id'],_0xc0dee4);var _0x28e4d2=path[_0x285b('0xca')](_0x3d73ee,_0x28e5fd);var _0x21b607=[];_0x21b607[_0x285b('0x34')]({'model':db[_0x285b('0x75')],'as':'User','attributes':['id',_0x285b('0x2f')],'raw':!![]});_0x21b607['push']({'model':db[_0x285b('0xcd')],'as':_0x285b('0x69'),'attributes':['id',_0x285b('0xce'),_0x285b('0xcf')],'raw':!![]});var _0x49e223=[{'model':db[_0x285b('0xbb')],'as':_0x285b('0xd0'),'attributes':['id','body',_0x285b('0xd1'),'direction',_0x285b('0xd2'),'read'],'include':_0x21b607}];_0x49e223[_0x285b('0x34')]({'model':db[_0x285b('0xd3')],'as':_0x285b('0xd4'),'attributes':['id','name']});_0x49e223[_0x285b('0x34')]({'model':db[_0x285b('0x75')],'as':_0x285b('0xd5'),'attributes':['id',_0x285b('0x2f')]});return db['SmsInteraction'][_0x285b('0x64')]({'where':{'id':_0x164e3f[_0x285b('0xb5')]['id']},'include':_0x49e223})[_0x285b('0x2a')](handleEntityNotFound(_0x320d82,null))[_0x285b('0x2a')](function(_0x267758){if(_0x267758){var _0x4f2995=_0x267758[_0x285b('0xd6')]({'plain':!![]});fs[_0x285b('0xd7')](_0x4071ea);var _0x5018dc={'channel':_0x285b('0xd8'),'account':_0x4f2995[_0x285b('0xd4')][_0x285b('0x2c')],'agent':_0x4f2995[_0x285b('0xd5')]?_0x4f2995[_0x285b('0xd5')][_0x285b('0x2f')]:_0x285b('0xd9'),'createdAt':moment(_0x4f2995[_0x285b('0xd1')])['format'](_0x285b('0xda'))[_0x285b('0x9b')](),'closedAt':_0x4f2995[_0x285b('0x39')]?moment(_0x4f2995[_0x285b('0xdb')])['format'](_0x285b('0xda'))[_0x285b('0x9b')]():'','disposition':_0x4f2995[_0x285b('0xdc')],'messages':_(_0x4f2995[_0x285b('0xd0')])[_0x285b('0x89')]({'secret':![]})[_0x285b('0x2e')](function(_0x9b18d6){return{'date':moment(_0x9b18d6[_0x285b('0xd1')])[_0x285b('0xc2')](_0x285b('0xda'))[_0x285b('0x9b')](),'sender':_0x9b18d6[_0x285b('0xdd')]==='out'?_0x9b18d6[_0x285b('0x75')]?_0x9b18d6[_0x285b('0x75')][_0x285b('0x2f')]:_0x285b('0xde'):_0x9b18d6[_0x285b('0x69')]['firstName']+(_0x9b18d6['Contact']['lastName']?'\x20'+_0x9b18d6[_0x285b('0x69')][_0x285b('0xcf')]:''),'body':_0x9b18d6[_0x285b('0x79')],'direction':_0x9b18d6[_0x285b('0xdd')]===_0x285b('0xdf')?'A':'C','secret':_0x9b18d6[_0x285b('0xd2')],'read':_0x9b18d6[_0x285b('0x85')]};})[_0x285b('0x6c')]()};return ejs[_0x285b('0xe0')](path[_0x285b('0xca')](config[_0x285b('0xc7')],_0x285b('0xc8'),'views',_0x285b('0xe1')),{'interaction':_0x5018dc})[_0x285b('0x2a')](function(_0x73c580){var _0x1f49d8=path['join'](_0x4071ea,_0x285b('0xe2')+_0x4f2995['id']+'-'+_0xc0dee4+_0x285b('0xe3'));var _0x4c0d01={'path':_0x1f49d8,'channel':_0x285b('0xd8'),'interactionId':_0x4f2995['id']};return pdf[_0x285b('0xe4')](_0x73c580,_0x4c0d01);})[_0x285b('0x2a')](function(){return new BPromise(function(_0x26384f,_0x122494){zipdir(_0x4071ea,{'saveTo':_0x28e4d2},function(_0xf13ef,_0x49aacd){if(_0xf13ef)return _0x122494(_0xf13ef);return _0x26384f(_0x49aacd);});})[_0x285b('0x2a')](function(){return new BPromise(function(_0x38bca0,_0x2e4c71){rimraf(_0x4071ea,function(_0x9eaf33){if(_0x9eaf33)_0x2e4c71(_0x9eaf33);return _0x38bca0();});});})[_0x285b('0x2a')](function(){return _0x320d82[_0x285b('0xc5')](_0x28e4d2,_0x28e5fd,function(_0x35b901){if(_0x35b901){console['log'](_0x285b('0xe5'),_0x35b901);}else{fs[_0x285b('0xe6')](_0x28e4d2);}});});});}else{return _0x320d82[_0x285b('0x1d')](0xc8);}})['catch'](handleError(_0x320d82,null));}; \ No newline at end of file +var _0x0896=['o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','show','params','options','create','update','destroy','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','sort','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','Sms','disposition','User','System','out','renderFile','views','.pdf','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','error','stack','name','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','talking','answered','total','closed','UserId','waiting','unmanaged','index','SmsInteraction','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','select','field','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','value','having','`\x20=\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','text','some','compact','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','role','toString','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax'];(function(_0x1887e6,_0x577cbd){var _0x4160e2=function(_0x292f34){while(--_0x292f34){_0x1887e6['push'](_0x1887e6['shift']());}};_0x4160e2(++_0x577cbd);}(_0x0896,0x12a));var _0x6089=function(_0x35a24d,_0x46a455){_0x35a24d=_0x35a24d-0x0;var _0x3c02a6=_0x0896[_0x35a24d];return _0x3c02a6;};'use strict';var emlformat=require(_0x6089('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6089('0x1'));var jsonpatch=require(_0x6089('0x2'));var rp=require('request-promise');var moment=require(_0x6089('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6089('0x4'));var path=require(_0x6089('0x5'));var sox=require(_0x6089('0x6'));var csv=require('to-csv');var ejs=require(_0x6089('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6089('0x8'));var crypto=require(_0x6089('0x9'));var jsforce=require(_0x6089('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6089('0xb'));var querystring=require(_0x6089('0xc'));var Papa=require(_0x6089('0xd'));var Redis=require('ioredis');var authService=require(_0x6089('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x6089('0xf'));var logger=require('../../config/logger')(_0x6089('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6089('0x11'));var db=require(_0x6089('0x12'))['db'];config[_0x6089('0x13')]=_[_0x6089('0x14')](config[_0x6089('0x13')],{'host':_0x6089('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6089('0x13')]));require(_0x6089('0x16'))[_0x6089('0x17')](socket);function respondWithStatusCode(_0xd46753,_0x205461){_0x205461=_0x205461||0xcc;return function(_0x27e913){if(_0x27e913){return _0xd46753[_0x6089('0x18')](_0x205461);}return _0xd46753[_0x6089('0x19')](_0x205461)[_0x6089('0x1a')]();};}function respondWithResult(_0x123630,_0x189d8d){_0x189d8d=_0x189d8d||0xc8;return function(_0x2207e9){if(_0x2207e9){return _0x123630[_0x6089('0x19')](_0x189d8d)['json'](_0x2207e9);}};}function respondWithFilteredResult(_0x10624f,_0x3b06a){return function(_0x59317f){if(_0x59317f){var _0x146246=typeof _0x3b06a[_0x6089('0x1b')]===_0x6089('0x1c')&&typeof _0x3b06a[_0x6089('0x1d')]==='undefined';var _0x20e4ea=_0x59317f['count'];var _0x13950a=_0x146246?0x0:_0x3b06a[_0x6089('0x1b')];var _0x3203bf=_0x146246?_0x59317f[_0x6089('0x1e')]:_0x3b06a[_0x6089('0x1b')]+_0x3b06a[_0x6089('0x1d')];var _0x218554;if(_0x3203bf>=_0x20e4ea){_0x3203bf=_0x20e4ea;_0x218554=0xc8;}else{_0x218554=0xce;}_0x10624f[_0x6089('0x19')](_0x218554);return _0x10624f['set'](_0x6089('0x1f'),_0x13950a+'-'+_0x3203bf+'/'+_0x20e4ea)[_0x6089('0x20')](_0x59317f);}return null;};}function patchUpdates(_0x1f1691){return function(_0x593803){try{jsonpatch[_0x6089('0x21')](_0x593803,_0x1f1691,!![]);}catch(_0x2653e4){return BPromise[_0x6089('0x22')](_0x2653e4);}return _0x593803['save']();};}function saveUpdates(_0x47e18f,_0x32e3f1){return function(_0x22fa25){if(_0x22fa25){return _0x22fa25['update'](_0x47e18f)[_0x6089('0x23')](function(_0x1bda9c){return _0x1bda9c;});}return null;};}function removeEntity(_0x48626,_0x561407){return function(_0x2a0919){if(_0x2a0919){return _0x2a0919['destroy']()[_0x6089('0x23')](function(){_0x48626['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23425f,_0x57b682){return function(_0x59c350){if(!_0x59c350){_0x23425f['sendStatus'](0x194);}return _0x59c350;};}function handleError(_0x2346e2,_0x2b2fee){_0x2b2fee=_0x2b2fee||0x1f4;return function(_0x369085){logger[_0x6089('0x24')](_0x369085[_0x6089('0x25')]);if(_0x369085[_0x6089('0x26')]){delete _0x369085[_0x6089('0x26')];}_0x2346e2[_0x6089('0x19')](_0x2b2fee)['send'](_0x369085);};}function getInteractionUsers(_0x3c7bf8,_0x14ba25){return new BPromise(function(_0x20a255,_0x2d9f05){try{if(_0x14ba25[_0x3c7bf8['id']]){_0x3c7bf8[_0x6089('0x27')]=_[_0x6089('0x28')](_0x14ba25[_0x3c7bf8['id']],function(_0x1fec32){return{'id':_0x1fec32['id'],'fullname':_0x1fec32[_0x6089('0x29')]};});}}catch(_0x192b11){_0x2d9f05(_0x192b11);}_0x20a255(_0x3c7bf8);});}function getInteractionTags(_0x4046b1,_0x4e5640){return new BPromise(function(_0x28fac7,_0x406fda){try{if(_0x4046b1['TagIds']){_0x4046b1[_0x6089('0x2a')]=[];_0x4046b1[_0x6089('0x2b')][_0x6089('0x2c')](',')[_0x6089('0x2d')](function(_0x564d02){_0x4046b1['Tags'][_0x6089('0x2e')](_0x4e5640[_0x564d02]);});}delete _0x4046b1[_0x6089('0x2b')];}catch(_0x37c347){_0x406fda(_0x37c347);}_0x28fac7(_0x4046b1);});}function updateSmsInteraction(_0x1e0944,_0x1d2a3f,_0x4d1a89){return new BPromise(function(_0x297dc6,_0x3964a6){return getInteractionUsers(_0x1e0944,_0x4d1a89)[_0x6089('0x23')](function(_0x59c705){return getInteractionTags(_0x59c705,_0x1d2a3f);})[_0x6089('0x23')](function(_0x18a64a){return getStateInteraction(_0x18a64a);})[_0x6089('0x23')](function(_0x5e6746){_0x297dc6(_0x5e6746);})[_0x6089('0x2f')](function(_0x16a889){_0x3964a6(_0x16a889);});});}function getStateInteraction(_0x596d64){return new BPromise(function(_0x27849c){_0x596d64['waiting']=0x0;_0x596d64[_0x6089('0x30')]=0x0;_0x596d64[_0x6089('0x31')]=0x0;_0x596d64['unmanaged']=0x0;_0x596d64[_0x6089('0x32')]=0x0;if(!_0x596d64[_0x6089('0x33')]&&!_0x596d64[_0x6089('0x34')]){_0x596d64[_0x6089('0x35')]+=0x1;}if(!_0x596d64['closed']&&_0x596d64[_0x6089('0x34')]){_0x596d64['talking']+=0x1;if(_0x596d64[_0x6089('0x35')]){_0x596d64[_0x6089('0x35')]-=0x1;}}if(_0x596d64[_0x6089('0x33')]&&_0x596d64[_0x6089('0x34')]){_0x596d64[_0x6089('0x31')]+=0x1;if(_0x596d64['talking']){_0x596d64[_0x6089('0x30')]-=0x1;}}if(_0x596d64['closed']&&!_0x596d64[_0x6089('0x34')]){_0x596d64[_0x6089('0x36')]+=0x1;if(_0x596d64[_0x6089('0x35')]){_0x596d64['waiting']-=0x1;}}_0x596d64[_0x6089('0x32')]+=0x1;_0x27849c(_0x596d64);});}exports[_0x6089('0x37')]=function(_0x580421,_0x32ac7b){var _0x340129={},_0x117970={},_0xcb9e96={'count':0x0,'rows':[]};var _0x52eaa5=_[_0x6089('0x28')](db[_0x6089('0x38')][_0x6089('0x39')],function(_0x506050){return{'name':_0x506050[_0x6089('0x3a')],'type':_0x506050[_0x6089('0x3b')][_0x6089('0x3c')]};});_0x117970[_0x6089('0x3d')]=_['map'](_0x52eaa5,'name');_0x117970['query']=_[_0x6089('0x3e')](_0x580421['query']);_0x117970[_0x6089('0x3f')]=_[_0x6089('0x40')](_0x117970['model'],_0x117970[_0x6089('0x41')]);_0x340129[_0x6089('0x42')]=_[_0x6089('0x40')](_0x117970['model'],qs[_0x6089('0x43')](_0x580421[_0x6089('0x41')][_0x6089('0x43')]));_0x340129['attributes']=_0x340129[_0x6089('0x42')]['length']?_0x340129['attributes']:_0x117970['model'];if(!_0x580421[_0x6089('0x41')][_0x6089('0x44')](_0x6089('0x45'))){_0x340129['limit']=qs[_0x6089('0x1d')](_0x580421[_0x6089('0x41')]['limit']);_0x340129[_0x6089('0x1b')]=qs[_0x6089('0x1b')](_0x580421[_0x6089('0x41')]['offset']);}_0x340129[_0x6089('0x46')]=qs['sort'](_0x580421[_0x6089('0x41')]['sort']);_0x340129[_0x6089('0x47')]=qs[_0x6089('0x3f')](_['pick'](_0x580421[_0x6089('0x41')],_0x117970[_0x6089('0x3f')]),_0x52eaa5);var _0x1dcbf8=[];var _0x5dbddd=squel[_0x6089('0x48')]()[_0x6089('0x49')]('id')[_0x6089('0x49')](_0x6089('0x26'))['field']('color')['from']('tools_tags');var _0x88136e=squel[_0x6089('0x48')]()['field'](_0x6089('0x4a'))[_0x6089('0x49')](_0x6089('0x4b'))[_0x6089('0x49')](_0x6089('0x4c'))[_0x6089('0x4d')](_0x6089('0x4e'),'ui')[_0x6089('0x4f')](_0x6089('0x50'),'u',_0x6089('0x51'));var _0x22e6b4=squel['select']()['from'](_0x6089('0x52'),'i')[_0x6089('0x4f')](_0x6089('0x53'),'c',_0x6089('0x54'))[_0x6089('0x4f')](_0x6089('0x50'),'o','o.id\x20=\x20i.UserId')[_0x6089('0x4f')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0x6089('0x4f')](_0x6089('0x55'),'me',_0x6089('0x56'))[_0x6089('0x4f')](_0x6089('0x57'),'it',_0x6089('0x58'))[_0x6089('0x4f')](_0x6089('0x59'),'t',_0x6089('0x5a'));var _0x4582d5=squel[_0x6089('0x5b')]();var _0x220411=[];var _0x2f7ecc=squel[_0x6089('0x5b')]();var _0x145d74;if(_0x580421[_0x6089('0x41')]['search']){_0x145d74=as[_0x6089('0x5c')](_0x580421[_0x6089('0x41')][_0x6089('0x5d')]);var _0x31319c=_0x145d74[_0x6089('0x5e')];for(var _0x5042e5=0x0;_0x5042e5<_0x145d74[_0x6089('0x5f')][_0x6089('0x60')];_0x5042e5++){var _0x17a669=_0x145d74[_0x6089('0x5f')][_0x5042e5];var _0x5d910f='i';var _0x1f3d8c=_[_0x6089('0x61')](_0x52eaa5,[_0x6089('0x26'),_0x17a669[_0x6089('0x49')]]);if(!_0x1f3d8c){switch(_0x17a669[_0x6089('0x49')]){case'unreadMessages':if(_0x17a669[_0x6089('0x62')]==0x1){_0x22e6b4[_0x6089('0x63')]('`'+_0x17a669['field']+_0x6089('0x64'));}else{_0x22e6b4[_0x6089('0x63')]('`'+_0x17a669['field']+'`\x20>\x200');}break;case _0x6089('0x65'):if(_0x17a669['operator']==='$substring'){if(_0x17a669[_0x6089('0x62')][_0x6089('0x2c')]('\x20')['length']>0x1){_0x4582d5[_0x31319c](_0x6089('0x66'),qs[_0x6089('0x67')](_0x17a669[_0x6089('0x62')]),null);}else{var _0xa3486='%'+_0x17a669[_0x6089('0x62')]+'%';_0x4582d5[_0x31319c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xa3486,_0xa3486,_0xa3486);}}else{_0x1f3d8c=_[_0x6089('0x61')](_0x52eaa5,[_0x6089('0x26'),_0x6089('0x68')]);_0x17a669['field']=_0x6089('0x68');_0x41e899=as[_0x6089('0x69')](_0x5d910f,_0x1f3d8c['type'],_0x17a669);_0x4582d5[_0x31319c](_0x41e899['text'],_0x41e899[_0x6089('0x62')][_0x6089('0x6a')],_0x41e899[_0x6089('0x62')][_0x6089('0x1a')]);}break;case _0x6089('0x6b'):var _0x41a8f9=_0x17a669[_0x6089('0x62')]['split'](',')[_0x6089('0x28')](function(_0x38e366){return Number(_0x38e366);});_0x41a8f9['forEach'](function(_0x1677a3){_0x2f7ecc['or'](_0x6089('0x6c'),'%,'+_0x1677a3+',%');});_0x220411=_[_0x6089('0x6d')](_0x220411,_0x41a8f9);break;case'User':if(_0x17a669[_0x6089('0x6e')]===_0x6089('0x6f')){_0x4582d5[_0x31319c](_0x6089('0x70'),'%'+_0x17a669[_0x6089('0x62')]+'%',null);}else{_0x1f3d8c=_[_0x6089('0x61')](_0x52eaa5,[_0x6089('0x26'),_0x6089('0x34')]);_0x17a669[_0x6089('0x49')]=_0x6089('0x34');_0x41e899=as[_0x6089('0x69')](_0x5d910f,_0x1f3d8c[_0x6089('0x3b')],_0x17a669);_0x4582d5[_0x31319c](_0x41e899['text'],_0x41e899['value']['start'],_0x41e899[_0x6089('0x62')][_0x6089('0x1a')]);}break;case _0x6089('0x71'):_0x41e899=as[_0x6089('0x69')]('me',null,_0x17a669);_0x4582d5[_0x31319c](_0x41e899['text'],_0x41e899[_0x6089('0x62')]['start'],_0x41e899[_0x6089('0x62')][_0x6089('0x1a')]);break;}}else{var _0x41e899=as[_0x6089('0x69')](_0x5d910f,_0x1f3d8c[_0x6089('0x3b')],_0x17a669);_0x4582d5[_0x31319c](_0x41e899[_0x6089('0x72')],_0x41e899[_0x6089('0x62')][_0x6089('0x6a')],_0x41e899[_0x6089('0x62')][_0x6089('0x1a')]);}}}else{var _0xbb3901=_(_0x580421['query'])[_0x6089('0x3e')]()[_0x6089('0x28')](function(_0x44d5cc){return _[_0x6089('0x73')](_0x52eaa5,['name',_0x44d5cc])?_0x44d5cc:undefined;})[_0x6089('0x74')]()[_0x6089('0x62')]();if(!_['isEmpty'](_0xbb3901)){_0xbb3901[_0x6089('0x2d')](function(_0x52565d){if(_0x52565d===_0x6089('0x75')){_0x22e6b4['where']('i.SmsAccountId\x20IN\x20?',[][_0x6089('0x76')](_0x580421['query'][_0x52565d]));}else if(_0x52565d===_0x6089('0x77')){var _0x10d72f=JSON[_0x6089('0x78')](_0x580421[_0x6089('0x41')][_0x52565d])[_0x6089('0x79')];var _0x28b984=JSON['parse'](_0x580421[_0x6089('0x41')][_0x52565d])[_0x6089('0x7a')];_0x22e6b4['where'](_0x6089('0x7b'),_0x10d72f,_0x28b984);}else{if(_0x580421[_0x6089('0x41')][_0x52565d]==='null'){_0x22e6b4['where']('i.'+_0x52565d+_0x6089('0x7c'));}else{_0x22e6b4[_0x6089('0x47')]('i.'+_0x52565d+'\x20=\x20?',_0x580421[_0x6089('0x41')][_0x52565d]);}}});}if(_0x580421[_0x6089('0x41')][_0x6089('0x7d')]){if(_0x580421['query'][_0x6089('0x7d')]==0x1){_0x22e6b4[_0x6089('0x63')](_0x6089('0x7e'));}else{_0x22e6b4[_0x6089('0x63')](_0x6089('0x7f'));}}if(_0x580421[_0x6089('0x41')]['tag']){_0x220411=_['isArray'](_0x580421[_0x6089('0x41')][_0x6089('0x80')])?_0x580421[_0x6089('0x41')][_0x6089('0x80')]:new Array(_0x580421['query'][_0x6089('0x80')]);_0x220411['forEach'](function(_0x3e0c02){_0x2f7ecc['or'](_0x6089('0x6c'),'%,'+_0x3e0c02+',%');});}if(_0x580421[_0x6089('0x41')][_0x6089('0x81')]){var _0x4ac8e9=_0x580421[_0x6089('0x41')][_0x6089('0x81')]['replace']('\x5c','\x5c\x5c')[_0x6089('0x82')](/'/g,'\x27\x27');if(qs[_0x6089('0x83')](_0x4ac8e9)){_0x4582d5['or'](_0x6089('0x84'),_0x4ac8e9+'%')['or']('i.phone\x20LIKE\x20?',_0x4ac8e9+'%');}else{_0x4582d5['or'](_0x6089('0x85'),qs[_0x6089('0x67')](_0x4ac8e9))['or'](_0x6089('0x86'),_0x4ac8e9+'%');}}}_0x22e6b4[_0x6089('0x47')](_0x4582d5);_0x22e6b4[_0x6089('0x87')](_0x6089('0x88'));var _0x53f3c1={'type':db[_0x6089('0x89')][_0x6089('0x8a')][_0x6089('0x8b')],'raw':!![]};var _0x327529=_0x22e6b4[_0x6089('0x8c')]();_0x327529[_0x6089('0x49')]('i.id');_0x327529['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6089('0x8d'));if(_0x340129[_0x6089('0x46')]){_0x340129[_0x6089('0x46')][_0x6089('0x2d')](function(_0x3cd99d){var _0x2c5c5e=_0x3cd99d[0x0]===_0x6089('0x8e')?_0x3cd99d[0x0]:'i.'+_0x3cd99d[0x0];_0x22e6b4[_0x6089('0x46')](_0x2c5c5e,_0x3cd99d[0x1]===_0x6089('0x8f')?![]:!![]);});}if(!_[_0x6089('0x90')](_0x220411)){_0x22e6b4[_0x6089('0x63')](_0x2f7ecc);_0x327529['where'](_0x6089('0x91'),_0x220411);}BPromise['resolve']()[_0x6089('0x23')](function(){if(!_0x145d74){if(_0x580421[_0x6089('0x41')][_0x6089('0x75')])return;_0x327529[_0x6089('0x47')](_0x6089('0x92'));_0x22e6b4[_0x6089('0x47')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x580421[_0x6089('0x93')]['role']!==_0x6089('0x94'))return;return _0x580421['user'][_0x6089('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5dd1e6){if(_[_0x6089('0x90')](_0x5dd1e6)){_0x327529[_0x6089('0x47')]('i.SmsAccountId\x20IS\x20NULL');_0x22e6b4[_0x6089('0x47')](_0x6089('0x96'));}else{_0x327529[_0x6089('0x47')](_0x6089('0x97'),_[_0x6089('0x28')](_0x5dd1e6,'id'));_0x22e6b4[_0x6089('0x47')](_0x6089('0x97'),_[_0x6089('0x28')](_0x5dd1e6,'id'));}});})['then'](function(){if(_0x580421[_0x6089('0x93')][_0x6089('0x98')]==='agent'&&!_0x145d74&&!_0x580421[_0x6089('0x41')][_0x6089('0x75')])return[];return db['sequelize'][_0x6089('0x41')](_0x327529[_0x6089('0x99')](),_0x53f3c1);})[_0x6089('0x23')](function(_0x3a63e3){_0xcb9e96[_0x6089('0x1e')]=_0x3a63e3['length'];if(_0xcb9e96[_0x6089('0x1e')]===0x0)return[];return db[_0x6089('0x9a')][_0x6089('0x41')](_0x5dbddd['toString'](),_0x53f3c1)[_0x6089('0x23')](function(_0x273b0b){_0x1dcbf8=_[_0x6089('0x9b')](_0x273b0b,'id');_0x53f3c1=_[_0x6089('0x9c')](_0x53f3c1,{'model':db[_0x6089('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x580421[_0x6089('0x41')][_0x6089('0x43')]){_0x340129['attributes']['forEach'](function(_0x5eea3a){_0x22e6b4[_0x6089('0x49')]('i.'+_0x5eea3a);});}else{_0x22e6b4[_0x6089('0x49')](_0x6089('0x9d'),_0x6089('0x8d'));_0x22e6b4[_0x6089('0x49')](_0x6089('0x9e'),_0x6089('0x9f'));_0x22e6b4[_0x6089('0x49')]('a.mandatoryDisposition',_0x6089('0xa0'));_0x22e6b4[_0x6089('0x49')](_0x6089('0xa1'),_0x6089('0x8e'));_0x22e6b4[_0x6089('0x49')](_0x6089('0xa2'));_0x22e6b4[_0x6089('0x49')](_0x6089('0xa3'),'Contact.firstName');_0x22e6b4['field'](_0x6089('0xa4'),_0x6089('0xa5'));_0x22e6b4[_0x6089('0x49')]('c.email','Contact.email');_0x22e6b4[_0x6089('0x49')](_0x6089('0xa6'),_0x6089('0xa7'));_0x22e6b4[_0x6089('0x49')](_0x6089('0xa8'),_0x6089('0xa9'));_0x22e6b4[_0x6089('0x49')](_0x6089('0xaa'),_0x6089('0xab'));_0x22e6b4[_0x6089('0x49')](_0x6089('0xac'),_0x6089('0xad'));_0x22e6b4['field'](_0x6089('0xae'),_0x6089('0xaf'));_0x22e6b4['field'](_0x6089('0xb0'),_0x6089('0x2b'));}if(_0x340129[_0x6089('0x1d')])_0x22e6b4[_0x6089('0x1d')](_0x340129[_0x6089('0x1d')]);if(_0x340129[_0x6089('0x1b')])_0x22e6b4['offset'](_0x340129[_0x6089('0x1b')]);return db[_0x6089('0x9a')][_0x6089('0x41')](_0x22e6b4[_0x6089('0x99')](),_0x53f3c1);})[_0x6089('0x23')](function(_0x1b769c){if(_0x1b769c[_0x6089('0x60')]>0x0)_0x88136e[_0x6089('0x47')]('ui.SmsInteractionId\x20IN\x20?',_[_0x6089('0x28')](_0x1b769c,'id'));return db['sequelize'][_0x6089('0x41')](_0x88136e[_0x6089('0x99')](),_0x53f3c1)['then'](function(_0x256fc2){var _0x18109d=_[_0x6089('0xb1')](_0x256fc2,_0x6089('0xb2'));var _0x2bb3a1=[];_0x1b769c[_0x6089('0x2d')](function(_0x917504){_0x2bb3a1['push'](updateSmsInteraction(_0x917504,_0x1dcbf8,_0x18109d));});return BPromise[_0x6089('0xb3')](_0x2bb3a1);});});})[_0x6089('0x23')](function(_0x3c7be2){_0xcb9e96[_0x6089('0xb4')]=_0x3c7be2;return _0xcb9e96;})[_0x6089('0x23')](respondWithFilteredResult(_0x32ac7b,_0x340129))['catch'](handleError(_0x32ac7b,null));};exports[_0x6089('0xb5')]=function(_0x4383d0,_0x1db2b2){var _0x275c30={'raw':![],'where':{'id':_0x4383d0[_0x6089('0xb6')]['id']}},_0x5a68d5={};_0x5a68d5[_0x6089('0x3d')]=_[_0x6089('0x3e')](db[_0x6089('0x38')][_0x6089('0x39')]);_0x5a68d5[_0x6089('0x41')]=_[_0x6089('0x3e')](_0x4383d0[_0x6089('0x41')]);_0x5a68d5[_0x6089('0x3f')]=_[_0x6089('0x40')](_0x5a68d5[_0x6089('0x3d')],_0x5a68d5[_0x6089('0x41')]);_0x275c30[_0x6089('0x42')]=_[_0x6089('0x40')](_0x5a68d5[_0x6089('0x3d')],qs[_0x6089('0x43')](_0x4383d0[_0x6089('0x41')][_0x6089('0x43')]));_0x275c30[_0x6089('0x42')]=_0x275c30[_0x6089('0x42')][_0x6089('0x60')]?_0x275c30[_0x6089('0x42')]:_0x5a68d5[_0x6089('0x3d')];if(_0x4383d0['query']['includeAll']){_0x275c30['include']=[{'all':!![]}];}_0x275c30=_[_0x6089('0x9c')]({},_0x275c30,_0x4383d0[_0x6089('0xb7')]);return db[_0x6089('0x38')][_0x6089('0x61')](_0x275c30)[_0x6089('0x23')](handleEntityNotFound(_0x1db2b2,null))[_0x6089('0x23')](respondWithResult(_0x1db2b2,null))[_0x6089('0x2f')](handleError(_0x1db2b2,null));};exports[_0x6089('0xb8')]=function(_0x3bc3d1,_0x3bd180){return db[_0x6089('0x38')]['create'](_0x3bc3d1['body'],{})[_0x6089('0x23')](respondWithResult(_0x3bd180,0xc9))[_0x6089('0x2f')](handleError(_0x3bd180,null));};exports[_0x6089('0xb9')]=function(_0x3b073a,_0x3c4247){if(_0x3b073a[_0x6089('0x71')]['id']){delete _0x3b073a[_0x6089('0x71')]['id'];}return db[_0x6089('0x38')][_0x6089('0x61')]({'where':{'id':_0x3b073a[_0x6089('0xb6')]['id']}})[_0x6089('0x23')](handleEntityNotFound(_0x3c4247,null))[_0x6089('0x23')](saveUpdates(_0x3b073a['body'],null))[_0x6089('0x23')](respondWithResult(_0x3c4247,null))['catch'](handleError(_0x3c4247,null));};exports[_0x6089('0xba')]=function(_0x3b76c8,_0x11b434){return db['SmsInteraction'][_0x6089('0x61')]({'where':{'id':_0x3b76c8[_0x6089('0xb6')]['id']}})[_0x6089('0x23')](handleEntityNotFound(_0x11b434,null))[_0x6089('0x23')](removeEntity(_0x11b434,null))[_0x6089('0x2f')](handleError(_0x11b434,null));};exports[_0x6089('0xbb')]=function(_0xc11585,_0x2aa704){return db[_0x6089('0x38')][_0x6089('0xbb')]()[_0x6089('0x23')](respondWithResult(_0x2aa704,null))[_0x6089('0x2f')](handleError(_0x2aa704,null));};exports['addMessage']=function(_0x5559fa,_0x423903,_0x3a2424){return db[_0x6089('0xbc')]['find']({'where':{'id':_0x5559fa[_0x6089('0xb6')]['id']}})[_0x6089('0x23')](handleEntityNotFound(_0x423903,null))[_0x6089('0x23')](function(_0x54fee1){if(_0x54fee1){return _0x54fee1[_0x6089('0xbd')](_0x5559fa[_0x6089('0x71')][_0x6089('0xbe')],_[_0x6089('0xbf')](_0x5559fa['body'],[_0x6089('0xbe'),'id'])||{});}})[_0x6089('0x23')](respondWithResult(_0x423903,null))['catch'](handleError(_0x423903,null));};exports[_0x6089('0xc0')]=function(_0x56c0c3,_0x47a198,_0x5ecd65){var _0x211cfe={'raw':![],'where':{}};var _0x544dee={};var _0x22dbae={'count':0x0,'rows':[]};return db[_0x6089('0x38')][_0x6089('0xc1')]({'where':{'id':_0x56c0c3['params']['id']}})['then'](handleEntityNotFound(_0x47a198,null))['then'](function(_0xf2e131){if(_0xf2e131){_0x544dee[_0x6089('0x3d')]=_[_0x6089('0x3e')](db['SmsMessage'][_0x6089('0x39')]);_0x544dee[_0x6089('0x41')]=_['keys'](_0x56c0c3['query']);_0x544dee[_0x6089('0x3f')]=_['intersection'](_0x544dee[_0x6089('0x3d')],_0x544dee[_0x6089('0x41')]);_0x211cfe[_0x6089('0x42')]=_[_0x6089('0x40')](_0x544dee[_0x6089('0x3d')],qs[_0x6089('0x43')](_0x56c0c3[_0x6089('0x41')][_0x6089('0x43')]));_0x211cfe[_0x6089('0x42')]=_0x211cfe[_0x6089('0x42')][_0x6089('0x60')]?_0x211cfe[_0x6089('0x42')]:_0x544dee[_0x6089('0x3d')];if(!_0x56c0c3[_0x6089('0x41')][_0x6089('0x44')](_0x6089('0x45'))){_0x211cfe[_0x6089('0x1d')]=qs[_0x6089('0x1d')](_0x56c0c3[_0x6089('0x41')][_0x6089('0x1d')]);_0x211cfe[_0x6089('0x1b')]=qs[_0x6089('0x1b')](_0x56c0c3[_0x6089('0x41')]['offset']);}_0x211cfe[_0x6089('0x46')]=qs[_0x6089('0xc2')](_0x56c0c3[_0x6089('0x41')][_0x6089('0xc2')]);_0x211cfe[_0x6089('0x47')]=qs[_0x6089('0x3f')](_[_0x6089('0xc3')](_0x56c0c3[_0x6089('0x41')],_0x544dee[_0x6089('0x3f')]));_0x211cfe['where'][_0x6089('0xb2')]=_0xf2e131['id'];if(_0x56c0c3[_0x6089('0x41')][_0x6089('0x81')]){_0x211cfe[_0x6089('0x47')]=_[_0x6089('0x9c')](_0x211cfe[_0x6089('0x47')],{'$or':_[_0x6089('0x28')](_0x211cfe[_0x6089('0x42')],function(_0x12f5e8){var _0x34a515={};_0x34a515[_0x12f5e8]={'$like':'%'+_0x56c0c3[_0x6089('0x41')][_0x6089('0x81')]+'%'};return _0x34a515;})});}if(_0x56c0c3['query'][_0x6089('0x79')]){var _0x5eda27=_0x56c0c3[_0x6089('0x41')][_0x6089('0x79')]['split'](',');var _0x1fd055={};_0x1fd055[_0x5eda27[0x0]]={'$gte':moment(_0x5eda27[0x1])[_0x6089('0xc4')](_0x6089('0xc5'))};_0x211cfe['where']=_['merge'](_0x211cfe[_0x6089('0x47')],_0x1fd055);}_0x211cfe=_['merge']({},_0x211cfe,_0x56c0c3[_0x6089('0xb7')]);return db['SmsMessage'][_0x6089('0x1e')]({'where':_0x211cfe[_0x6089('0x47')]})[_0x6089('0x23')](function(_0xe351bd){_0x22dbae[_0x6089('0x1e')]=_0xe351bd;if(_0x56c0c3[_0x6089('0x41')][_0x6089('0xc6')]){_0x211cfe[_0x6089('0xc7')]=[{'all':!![]}];}return db['SmsMessage'][_0x6089('0xc8')](_0x211cfe);})['then'](function(_0x3c79a7){_0x22dbae[_0x6089('0xb4')]=_0x3c79a7;return _0x22dbae;});}})[_0x6089('0x23')](respondWithFilteredResult(_0x47a198,_0x211cfe))[_0x6089('0x2f')](handleError(_0x47a198,null));};exports[_0x6089('0xc9')]=function(_0x55cde8,_0x39c600,_0x26782f){return db['SmsInteraction'][_0x6089('0x61')]({'where':{'id':_0x55cde8[_0x6089('0xb6')]['id']}})[_0x6089('0x23')](handleEntityNotFound(_0x39c600,null))[_0x6089('0x23')](function(_0x4881a7){if(_0x4881a7){return _0x4881a7[_0x6089('0xca')](_0x55cde8[_0x6089('0x71')]['ids'],_[_0x6089('0xbf')](_0x55cde8[_0x6089('0x71')],[_0x6089('0xbe'),'id'])||{})[_0x6089('0xcb')](function(){return db['Tag'][_0x6089('0xc8')]({'attributes':['id','name',_0x6089('0xcc')],'where':{'id':_0x55cde8[_0x6089('0x71')]['ids']}});})[_0x6089('0x23')](function(_0x453858){socket[_0x6089('0xcd')](_0x6089('0xce'),{'id':Number(_0x55cde8[_0x6089('0xb6')]['id']),'tags':_0x453858||[]});return{'id':Number(_0x55cde8[_0x6089('0xb6')]['id']),'tags':_0x453858||[]};});}})[_0x6089('0x23')](respondWithResult(_0x39c600,null))[_0x6089('0x2f')](handleError(_0x39c600,null));};exports['removeTags']=function(_0x377bfb,_0x427835,_0x1e6d6c){return db[_0x6089('0x38')][_0x6089('0x61')]({'where':{'id':_0x377bfb['params']['id']}})['then'](handleEntityNotFound(_0x427835,null))[_0x6089('0x23')](function(_0x594716){if(_0x594716){return _0x594716[_0x6089('0xcf')](_0x377bfb['query'][_0x6089('0xbe')]);}})[_0x6089('0x23')](respondWithStatusCode(_0x427835,null))['catch'](handleError(_0x427835,null));};exports[_0x6089('0xd0')]=function(_0x148192,_0x3056ae){var _0x4ba7eb=moment()[_0x6089('0xd1')]()[_0x6089('0x99')]();var _0x4da6d4=path[_0x6089('0xd2')](config[_0x6089('0xd3')],'server',_0x6089('0xd4'),_0x6089('0xd5'));var _0x5550fa=path[_0x6089('0xd2')](config[_0x6089('0xd3')],_0x6089('0xd6'),_0x6089('0xd4'),_0x6089('0xd7'));var _0x1eb167=path[_0x6089('0xd2')](_0x4da6d4,_0x4ba7eb);var _0x3bb072=util[_0x6089('0xc4')]('transcript-%d-%s.zip',_0x148192[_0x6089('0xb6')]['id'],_0x4ba7eb);var _0x46eb42=path[_0x6089('0xd2')](_0x4da6d4,_0x3bb072);var _0x44f467=[];_0x44f467[_0x6089('0x2e')]({'model':db['User'],'as':'User','attributes':['id',_0x6089('0x29')],'raw':!![]});_0x44f467[_0x6089('0x2e')]({'model':db[_0x6089('0xd8')],'as':_0x6089('0x65'),'attributes':['id',_0x6089('0xd9'),_0x6089('0xda')],'raw':!![]});var _0x54cc64=[{'model':db['SmsMessage'],'as':_0x6089('0xdb'),'attributes':['id','body',_0x6089('0x77'),_0x6089('0xdc'),_0x6089('0xdd'),_0x6089('0x7d')],'include':_0x44f467}];_0x54cc64[_0x6089('0x2e')]({'model':db[_0x6089('0xde')],'as':_0x6089('0xdf'),'attributes':['id','name']});_0x54cc64[_0x6089('0x2e')]({'model':db['User'],'as':_0x6089('0xe0'),'attributes':['id',_0x6089('0x29')]});return db[_0x6089('0x38')][_0x6089('0x61')]({'where':{'id':_0x148192[_0x6089('0xb6')]['id']},'include':_0x54cc64})[_0x6089('0x23')](handleEntityNotFound(_0x3056ae,null))[_0x6089('0x23')](function(_0x5133a2){if(_0x5133a2){var _0x1d517e=_0x5133a2['get']({'plain':!![]});fs['mkdirSync'](_0x1eb167);var _0x421f6d={'channel':_0x6089('0xe1'),'account':_0x1d517e[_0x6089('0xdf')][_0x6089('0x26')],'agent':_0x1d517e[_0x6089('0xe0')]?_0x1d517e[_0x6089('0xe0')][_0x6089('0x29')]:'N.A.','createdAt':moment(_0x1d517e['createdAt'])['format'](_0x6089('0xc5'))[_0x6089('0x99')](),'closedAt':_0x1d517e[_0x6089('0x33')]?moment(_0x1d517e['closedAt'])[_0x6089('0xc4')](_0x6089('0xc5'))[_0x6089('0x99')]():'','disposition':_0x1d517e[_0x6089('0xe2')],'messages':_(_0x1d517e['Messages'])[_0x6089('0x81')]({'secret':![]})[_0x6089('0x28')](function(_0x2cc526){return{'date':moment(_0x2cc526[_0x6089('0x77')])[_0x6089('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6089('0x99')](),'sender':_0x2cc526[_0x6089('0xdc')]==='out'?_0x2cc526[_0x6089('0xe3')]?_0x2cc526['User'][_0x6089('0x29')]:_0x6089('0xe4'):_0x2cc526[_0x6089('0x65')]['firstName']+(_0x2cc526[_0x6089('0x65')][_0x6089('0xda')]?'\x20'+_0x2cc526[_0x6089('0x65')][_0x6089('0xda')]:''),'body':_0x2cc526[_0x6089('0x71')],'direction':_0x2cc526[_0x6089('0xdc')]===_0x6089('0xe5')?'A':'C','secret':_0x2cc526['secret'],'read':_0x2cc526[_0x6089('0x7d')]};})[_0x6089('0x62')]()};return ejs[_0x6089('0xe6')](path[_0x6089('0xd2')](config[_0x6089('0xd3')],_0x6089('0xd6'),_0x6089('0xe7'),'downloadInteraction.ejs'),{'interaction':_0x421f6d})['then'](function(_0xf0ec76){var _0x2ffa52=path[_0x6089('0xd2')](_0x1eb167,'transcript-'+_0x1d517e['id']+'-'+_0x4ba7eb+_0x6089('0xe8'));var _0xd0837={'path':_0x2ffa52,'channel':_0x6089('0xe1'),'interactionId':_0x1d517e['id']};return pdf['createPdfFromHTML'](_0xf0ec76,_0xd0837);})['then'](function(){return new BPromise(function(_0x45b78d,_0x40f3b0){zipdir(_0x1eb167,{'saveTo':_0x46eb42},function(_0x325118,_0x299c58){if(_0x325118)return _0x40f3b0(_0x325118);return _0x45b78d(_0x299c58);});})[_0x6089('0x23')](function(){return new BPromise(function(_0x4a7be4,_0x4d27df){rimraf(_0x1eb167,function(_0x84122d){if(_0x84122d)_0x4d27df(_0x84122d);return _0x4a7be4();});});})[_0x6089('0x23')](function(){return _0x3056ae[_0x6089('0xd0')](_0x46eb42,_0x3bb072,function(_0x9b11c5){if(_0x9b11c5){console['log'](_0x6089('0xe9'),_0x9b11c5);}else{fs[_0x6089('0xea')](_0x46eb42);}});});});}else{return _0x3056ae[_0x6089('0x18')](0xc8);}})['catch'](handleError(_0x3056ae,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d60571a..d225da0 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 _0x7708=['hook','exports','events','../../mysqldb','remove','getUsers','then','setDataValue','Users','map','length','emit','catch'];(function(_0x1905cc,_0x99e86f){var _0x15f952=function(_0x4471c0){while(--_0x4471c0){_0x1905cc['push'](_0x1905cc['shift']());}};_0x15f952(++_0x99e86f);}(_0x7708,0x188));var _0x8770=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x7708[_0x41bdd4];return _0x5c03a6;};'use strict';var EventEmitter=require(_0x8770('0x0'));var SmsInteraction=require(_0x8770('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8770('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8770('0x2')};function emitEvent(_0x1a796d){return function(_0x577b13,_0x40d401,_0x50bab7){_0x577b13[_0x8770('0x3')]({'attributes':['id'],'raw':!![]})[_0x8770('0x4')](function(_0x2b0295){_0x577b13[_0x8770('0x5')](_0x8770('0x6'),_0x2b0295[_0x8770('0x7')](function(_0x2d4a1d){return{'id':_0x2d4a1d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x577b13['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8770('0x4')](function(_0x2ca830){_0x577b13[_0x8770('0x5')]('unreadMessages',_0x2ca830[_0x8770('0x8')]);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d+':'+_0x577b13['id'],_0x577b13);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d,_0x577b13);_0x50bab7(null);})[_0x8770('0xa')](_0x50bab7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x8770('0xb')](e,emitEvent(event));}}module[_0x8770('0xc')]=SmsInteractionEvents; \ No newline at end of file +var _0x7d25=['SmsMessage','setMaxListeners','save','update','then','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction'];(function(_0x289952,_0x28790f){var _0x5a8a0b=function(_0x40bb0c){while(--_0x40bb0c){_0x289952['push'](_0x289952['shift']());}};_0x5a8a0b(++_0x28790f);}(_0x7d25,0x8a));var _0x57d2=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7d25[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x57d2('0x0'))['db'][_0x57d2('0x1')];var SmsMessage=require(_0x57d2('0x0'))['db'][_0x57d2('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x57d2('0x3')](0x0);var events={'afterCreate':_0x57d2('0x4'),'afterUpdate':_0x57d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5337ca){return function(_0x52a4f4,_0x5dea84,_0x3c5511){_0x52a4f4['getUsers']({'attributes':['id'],'raw':!![]})[_0x57d2('0x6')](function(_0x263d35){_0x52a4f4[_0x57d2('0x7')]('Users',_0x263d35['map'](function(_0xeb8b91){return{'id':_0xeb8b91['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x52a4f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57d2('0x6')](function(_0x5153c2){_0x52a4f4[_0x57d2('0x7')]('unreadMessages',_0x5153c2[_0x57d2('0x8')]);SmsInteractionEvents[_0x57d2('0x9')](_0x5337ca+':'+_0x52a4f4['id'],_0x52a4f4);SmsInteractionEvents[_0x57d2('0x9')](_0x5337ca,_0x52a4f4);_0x3c5511(null);})[_0x57d2('0xa')](_0x3c5511(null));};}for(var e in events){if(events[_0x57d2('0xb')](e)){var event=events[e];SmsInteraction[_0x57d2('0xc')](e,emitEvent(event));}}module[_0x57d2('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b19bc60..09a4be8 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 _0xf352=['request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x36c534,_0x21890b){var _0x5d78a1=function(_0x43fe83){while(--_0x43fe83){_0x36c534['push'](_0x36c534['shift']());}};_0x5d78a1(++_0x21890b);}(_0xf352,0xa5));var _0x2f35=function(_0x5798bc,_0x482dd4){_0x5798bc=_0x5798bc-0x0;var _0x3d595a=_0xf352[_0x5798bc];return _0x3d595a;};'use strict';var _=require(_0x2f35('0x0'));var util=require(_0x2f35('0x1'));var logger=require(_0x2f35('0x2'))(_0x2f35('0x3'));var moment=require(_0x2f35('0x4'));var BPromise=require(_0x2f35('0x5'));var rp=require(_0x2f35('0x6'));var fs=require('fs');var path=require(_0x2f35('0x7'));var rimraf=require(_0x2f35('0x8'));var config=require(_0x2f35('0x9'));var attributes=require(_0x2f35('0xa'));module[_0x2f35('0xb')]=function(_0x186344,_0x1501bd){return _0x186344[_0x2f35('0xc')](_0x2f35('0xd'),attributes,{'tableName':_0x2f35('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23a359,_0xe3db05,_0x1d0e16){if(_0x23a359[_0x2f35('0xf')](_0x2f35('0x10'))){_0x23a359[_0x2f35('0x11')]=moment()[_0x2f35('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1d0e16(null,_0x23a359);}}});}; \ No newline at end of file +var _0x38f3=['bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','lodash','util','../../config/logger','moment'];(function(_0x3e0e78,_0x1d587b){var _0x35104f=function(_0x42c49b){while(--_0x42c49b){_0x3e0e78['push'](_0x3e0e78['shift']());}};_0x35104f(++_0x1d587b);}(_0x38f3,0x1a0));var _0x338f=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0x38f3[_0x48e86c];return _0x54fa11;};'use strict';var _=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var logger=require(_0x338f('0x2'))('api');var moment=require(_0x338f('0x3'));var BPromise=require(_0x338f('0x4'));var rp=require(_0x338f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x338f('0x6'));var config=require(_0x338f('0x7'));var attributes=require(_0x338f('0x8'));module[_0x338f('0x9')]=function(_0x3c37ad,_0x4cbe40){return _0x3c37ad[_0x338f('0xa')](_0x338f('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19b0ca,_0x18687a,_0x2a2d64){if(_0x19b0ca[_0x338f('0xc')](_0x338f('0xd'))){_0x19b0ca[_0x338f('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2a2d64(null,_0x19b0ca);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 80de0f9..a9ad435 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 _0xab44=['code','error','SmsInteraction,\x20%s,\x20%s','result','message','UpdateSmsInteraction','update','body','raw','options','attributes','limit','then','debug','catch','AddTagsToSmsInteraction','SmsInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','register','request','info','request\x20sent','stringify'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0xab44,0xe9));var _0x4ab4=function(_0xc2f824,_0x5521e4){_0xc2f824=_0xc2f824-0x0;var _0x2a601e=_0xab44[_0xc2f824];return _0x2a601e;};'use strict';var _=require(_0x4ab4('0x0'));var util=require(_0x4ab4('0x1'));var moment=require(_0x4ab4('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ab4('0x3'));var fs=require('fs');var Redis=require(_0x4ab4('0x4'));var db=require(_0x4ab4('0x5'))['db'];var utils=require(_0x4ab4('0x6'));var logger=require(_0x4ab4('0x7'))('rpc');var config=require(_0x4ab4('0x8'));var jayson=require(_0x4ab4('0x9'));var client=jayson[_0x4ab4('0xa')][_0x4ab4('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x4ab4('0xc'),'port':0x18eb});var socket=require(_0x4ab4('0xd'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x4ab4('0xe')](socket);function respondWithRpcPromise(_0x3fbd54,_0x263d00,_0x5c1bae){return new BPromise(function(_0x26f0a6,_0x193c7c){return client[_0x4ab4('0xf')](_0x3fbd54,_0x5c1bae)['then'](function(_0x1732d4){logger[_0x4ab4('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x263d00,_0x4ab4('0x11'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x263d00,_0x4ab4('0x11'),JSON[_0x4ab4('0x12')](_0x1732d4));if(_0x1732d4['error']){if(_0x1732d4['error'][_0x4ab4('0x13')]===0x1f4){logger[_0x4ab4('0x14')](_0x4ab4('0x15'),_0x263d00,_0x1732d4[_0x4ab4('0x14')]['message']);return _0x193c7c(_0x1732d4['error']['message']);}logger[_0x4ab4('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x263d00,_0x1732d4[_0x4ab4('0x14')]['message']);return _0x26f0a6(_0x1732d4['error']['message']);}else{logger[_0x4ab4('0x10')](_0x4ab4('0x15'),_0x263d00,_0x4ab4('0x11'));_0x26f0a6(_0x1732d4[_0x4ab4('0x16')][_0x4ab4('0x17')]);}})['catch'](function(_0x3bde85){logger[_0x4ab4('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x263d00,_0x3bde85);_0x193c7c(_0x3bde85);});});}exports[_0x4ab4('0x18')]=function(_0x36105f){var _0x27b94b=this;return new Promise(function(_0x2e8f45,_0x4931ab){return db['SmsInteraction'][_0x4ab4('0x19')](_0x36105f[_0x4ab4('0x1a')],{'raw':_0x36105f['options']?_0x36105f['options'][_0x4ab4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36105f[_0x4ab4('0x1c')]?_0x36105f['options']['where']||null:null,'attributes':_0x36105f[_0x4ab4('0x1c')]?_0x36105f[_0x4ab4('0x1c')][_0x4ab4('0x1d')]||null:null,'limit':_0x36105f[_0x4ab4('0x1c')]?_0x36105f['options'][_0x4ab4('0x1e')]||null:null})[_0x4ab4('0x1f')](function(_0x4b23de){logger[_0x4ab4('0x10')](_0x4ab4('0x18'),_0x36105f);logger[_0x4ab4('0x20')]('UpdateSmsInteraction',_0x36105f,JSON[_0x4ab4('0x12')](_0x4b23de));_0x2e8f45(_0x4b23de);})[_0x4ab4('0x21')](function(_0x246629){logger[_0x4ab4('0x14')](_0x4ab4('0x18'),_0x246629['message'],_0x36105f);_0x4931ab(_0x27b94b[_0x4ab4('0x14')](0x1f4,_0x246629['message']));});});};exports[_0x4ab4('0x22')]=function(_0x28cf37){return new Promise(function(_0x59d12c,_0x5a7e96){return db[_0x4ab4('0x23')][_0x4ab4('0x24')]({'where':_0x28cf37[_0x4ab4('0x1c')]?_0x28cf37['options'][_0x4ab4('0x25')]||null:null})[_0x4ab4('0x1f')](function(_0x42ed8f){if(_0x42ed8f){return _0x42ed8f['addTags'](_0x28cf37[_0x4ab4('0x1a')][_0x4ab4('0x26')],_[_0x4ab4('0x27')](_0x28cf37[_0x4ab4('0x1a')],[_0x4ab4('0x26'),'id'])||{});}})[_0x4ab4('0x28')](function(_0x1c0e67){logger['info']('AddTags',_0x28cf37);logger[_0x4ab4('0x20')](_0x4ab4('0x29'),_0x28cf37,JSON[_0x4ab4('0x12')](_0x1c0e67));_0x59d12c(_0x1c0e67);})['catch'](function(_0x40e709){logger['error']('AddTags',_0x40e709[_0x4ab4('0x17')],_0x28cf37);_0x5a7e96(_this['error'](0x1f4,_0x40e709[_0x4ab4('0x17')]));});});}; \ No newline at end of file +var _0xebbf=['find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','AddTagsToSmsInteraction'];(function(_0x2c239c,_0x2b8c87){var _0x4f0342=function(_0x3dc564){while(--_0x3dc564){_0x2c239c['push'](_0x2c239c['shift']());}};_0x4f0342(++_0x2b8c87);}(_0xebbf,0x71));var _0xfebb=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0xebbf[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0xfebb('0x0'));var util=require('util');var moment=require(_0xfebb('0x1'));var BPromise=require(_0xfebb('0x2'));var rs=require(_0xfebb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfebb('0x4'));var logger=require(_0xfebb('0x5'))(_0xfebb('0x6'));var config=require('../../config/environment');var jayson=require(_0xfebb('0x7'));var client=jayson[_0xfebb('0x8')]['http']({'port':0x232a});config[_0xfebb('0x9')]=_[_0xfebb('0xa')](config[_0xfebb('0x9')],{'host':_0xfebb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfebb('0x9')]));require(_0xfebb('0xc'))[_0xfebb('0xd')](socket);function respondWithRpcPromise(_0x8ca3c7,_0x23ffea,_0x53b01e){return new BPromise(function(_0x39288f,_0xe59ab7){return client['request'](_0x8ca3c7,_0x53b01e)[_0xfebb('0xe')](function(_0x424d32){logger[_0xfebb('0xf')](_0xfebb('0x10'),_0x23ffea,'request\x20sent');logger[_0xfebb('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x23ffea,_0xfebb('0x12'),JSON[_0xfebb('0x13')](_0x424d32));if(_0x424d32[_0xfebb('0x14')]){if(_0x424d32['error'][_0xfebb('0x15')]===0x1f4){logger[_0xfebb('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x23ffea,_0x424d32[_0xfebb('0x14')][_0xfebb('0x16')]);return _0xe59ab7(_0x424d32[_0xfebb('0x14')][_0xfebb('0x16')]);}logger[_0xfebb('0x14')](_0xfebb('0x10'),_0x23ffea,_0x424d32['error'][_0xfebb('0x16')]);return _0x39288f(_0x424d32[_0xfebb('0x14')]['message']);}else{logger['info'](_0xfebb('0x10'),_0x23ffea,_0xfebb('0x12'));_0x39288f(_0x424d32['result']['message']);}})['catch'](function(_0x2b3837){logger[_0xfebb('0x14')](_0xfebb('0x10'),_0x23ffea,_0x2b3837);_0xe59ab7(_0x2b3837);});});}exports[_0xfebb('0x17')]=function(_0x34703f){var _0xef3fb=this;return new Promise(function(_0x4822c0,_0x171127){return db[_0xfebb('0x18')][_0xfebb('0x19')](_0x34703f[_0xfebb('0x1a')],{'raw':_0x34703f[_0xfebb('0x1b')]?_0x34703f[_0xfebb('0x1b')][_0xfebb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34703f[_0xfebb('0x1b')]?_0x34703f[_0xfebb('0x1b')][_0xfebb('0x1d')]||null:null,'attributes':_0x34703f[_0xfebb('0x1b')]?_0x34703f[_0xfebb('0x1b')]['attributes']||null:null,'limit':_0x34703f[_0xfebb('0x1b')]?_0x34703f[_0xfebb('0x1b')]['limit']||null:null})[_0xfebb('0xe')](function(_0x42f0c6){logger[_0xfebb('0xf')](_0xfebb('0x17'),_0x34703f);logger[_0xfebb('0x11')](_0xfebb('0x17'),_0x34703f,JSON[_0xfebb('0x13')](_0x42f0c6));_0x4822c0(_0x42f0c6);})['catch'](function(_0x504a5a){logger[_0xfebb('0x14')](_0xfebb('0x17'),_0x504a5a['message'],_0x34703f);_0x171127(_0xef3fb[_0xfebb('0x14')](0x1f4,_0x504a5a[_0xfebb('0x16')]));});});};exports[_0xfebb('0x1e')]=function(_0x168fbf){return new Promise(function(_0x321552,_0x49f8a5){return db[_0xfebb('0x18')][_0xfebb('0x1f')]({'where':_0x168fbf[_0xfebb('0x1b')]?_0x168fbf['options']['where']||null:null})[_0xfebb('0xe')](function(_0x492bfd){if(_0x492bfd){return _0x492bfd[_0xfebb('0x20')](_0x168fbf[_0xfebb('0x1a')][_0xfebb('0x21')],_['omit'](_0x168fbf[_0xfebb('0x1a')],[_0xfebb('0x21'),'id'])||{});}})[_0xfebb('0x22')](function(_0x4b89db){logger[_0xfebb('0xf')]('AddTags',_0x168fbf);logger[_0xfebb('0x11')](_0xfebb('0x23'),_0x168fbf,JSON[_0xfebb('0x13')](_0x4b89db));_0x321552(_0x4b89db);})['catch'](function(_0x2a95e1){logger['error'](_0xfebb('0x23'),_0x2a95e1[_0xfebb('0x16')],_0x168fbf);_0x49f8a5(_this[_0xfebb('0x14')](0x1f4,_0x2a95e1[_0xfebb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 92c5be4..08edcb2 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 _0xf58c=['register','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xf58c,0x122));var _0xcf58=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0xf58c[_0xc36d01];return _0xecb231;};'use strict';var SmsInteractionEvents=require(_0xcf58('0x0'));var events=[_0xcf58('0x1'),_0xcf58('0x2'),_0xcf58('0x3')];function createListener(_0x1e215a,_0x5ad350){return function(_0x14ba91){_0x5ad350[_0xcf58('0x4')](_0x1e215a,_0x14ba91);};}function removeListener(_0x410f4b,_0x296e70){return function(){SmsInteractionEvents[_0xcf58('0x5')](_0x410f4b,_0x296e70);};}exports[_0xcf58('0x6')]=function(_0x12962a){for(var _0x1cf1e5=0x0,_0x439406=events['length'];_0x1cf1e5<_0x439406;_0x1cf1e5++){var _0x2cfd5c=events[_0x1cf1e5];var _0x10140c=createListener(_0xcf58('0x7')+_0x2cfd5c,_0x12962a);SmsInteractionEvents['on'](_0x2cfd5c,_0x10140c);}}; \ No newline at end of file +var _0x8f1b=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x11f47f,_0x3a03b0){var _0x5568b0=function(_0x5c75f3){while(--_0x5c75f3){_0x11f47f['push'](_0x11f47f['shift']());}};_0x5568b0(++_0x3a03b0);}(_0x8f1b,0x199));var _0xb8f1=function(_0x3002c9,_0x5ce071){_0x3002c9=_0x3002c9-0x0;var _0x5f11ab=_0x8f1b[_0x3002c9];return _0x5f11ab;};'use strict';var SmsInteractionEvents=require(_0xb8f1('0x0'));var events=[_0xb8f1('0x1'),_0xb8f1('0x2'),_0xb8f1('0x3')];function createListener(_0x181369,_0xe52dbd){return function(_0x11724f){_0xe52dbd[_0xb8f1('0x4')](_0x181369,_0x11724f);};}function removeListener(_0x2b64be,_0x6ee0fb){return function(){SmsInteractionEvents[_0xb8f1('0x5')](_0x2b64be,_0x6ee0fb);};}exports['register']=function(_0x68a0d6){for(var _0xadf851=0x0,_0x1e7af6=events[_0xb8f1('0x6')];_0xadf851<_0x1e7af6;_0xadf851++){var _0x3f81d6=events[_0xadf851];var _0x595bd9=createListener(_0xb8f1('0x7')+_0x3f81d6,_0x68a0d6);SmsInteractionEvents['on'](_0x3f81d6,_0x595bd9);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 19f8879..d14a6a4 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 _0x06a3=['/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','describe','/:id','post','tracked','sms','smsmessage:create','create'];(function(_0x3a847b,_0x20136f){var _0x1e7cdb=function(_0x29b306){while(--_0x29b306){_0x3a847b['push'](_0x3a847b['shift']());}};_0x1e7cdb(++_0x20136f);}(_0x06a3,0xa0));var _0x306a=function(_0x447127,_0xbe4ade){_0x447127=_0x447127-0x0;var _0x358a25=_0x06a3[_0x447127];return _0x358a25;};'use strict';var multer=require(_0x306a('0x0'));var util=require(_0x306a('0x1'));var path=require('path');var timeout=require(_0x306a('0x2'));var express=require(_0x306a('0x3'));var router=express[_0x306a('0x4')]();var fs_extra=require(_0x306a('0x5'));var auth=require(_0x306a('0x6'));var interaction=require(_0x306a('0x7'));var config=require(_0x306a('0x8'));var controller=require(_0x306a('0x9'));router[_0x306a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x306a('0xb'),auth[_0x306a('0xc')](),controller[_0x306a('0xd')]);router[_0x306a('0xa')](_0x306a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x306a('0xf')]('/',auth[_0x306a('0xc')](),interaction[_0x306a('0x10')](_0x306a('0x11'),_0x306a('0x12')),controller[_0x306a('0x13')]);router[_0x306a('0xf')](_0x306a('0x14'),controller['status']);router[_0x306a('0x15')](_0x306a('0xe'),auth['isAuthenticated'](),controller[_0x306a('0x16')]);router[_0x306a('0x15')](_0x306a('0x17'),auth[_0x306a('0xc')](),controller[_0x306a('0x18')]);router[_0x306a('0x15')](_0x306a('0x19'),auth[_0x306a('0xc')](),controller[_0x306a('0x1a')]);router[_0x306a('0x1b')](_0x306a('0xe'),auth[_0x306a('0xc')](),controller[_0x306a('0x1c')]);module[_0x306a('0x1d')]=router; \ No newline at end of file +var _0x609a=['express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x609a,0x1ec));var _0xa609=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x609a[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var path=require(_0xa609('0x2'));var timeout=require(_0xa609('0x3'));var express=require(_0xa609('0x4'));var router=express[_0xa609('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa609('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa609('0x7'));var controller=require(_0xa609('0x8'));router[_0xa609('0x9')]('/',auth[_0xa609('0xa')](),controller[_0xa609('0xb')]);router[_0xa609('0x9')](_0xa609('0xc'),auth[_0xa609('0xa')](),controller[_0xa609('0xd')]);router[_0xa609('0x9')](_0xa609('0xe'),auth[_0xa609('0xa')](),controller['show']);router[_0xa609('0xf')]('/',auth['isAuthenticated'](),interaction[_0xa609('0x10')](_0xa609('0x11'),_0xa609('0x12')),controller[_0xa609('0x13')]);router['post'](_0xa609('0x14'),controller[_0xa609('0x15')]);router[_0xa609('0x16')]('/:id',auth[_0xa609('0xa')](),controller[_0xa609('0x17')]);router[_0xa609('0x16')](_0xa609('0x18'),auth[_0xa609('0xa')](),controller[_0xa609('0x19')]);router[_0xa609('0x16')](_0xa609('0x1a'),auth[_0xa609('0xa')](),controller[_0xa609('0x1b')]);router[_0xa609('0x1c')]('/:id',auth[_0xa609('0xa')](),controller[_0xa609('0x1d')]);module[_0xa609('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d3fc4f1..6c58116 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 _0x51f2=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x51f2,0xeb));var _0x251f=function(_0x487ac1,_0x3546c9){_0x487ac1=_0x487ac1-0x0;var _0x16e36e=_0x51f2[_0x487ac1];return _0x16e36e;};'use strict';var Sequelize=require(_0x251f('0x0'));module[_0x251f('0x1')]={'body':{'type':Sequelize[_0x251f('0x2')](_0x251f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x251f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x251f('0x5')]('in',_0x251f('0x6')),'defaultValue':_0x251f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x251f('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x251f('0x8')]},'secret':{'type':Sequelize[_0x251f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x251f('0x7')]},'providerResponse':{'type':Sequelize[_0x251f('0x2')]}}; \ No newline at end of file +var _0xd8cc=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0xd8cc,0x14c));var _0xcd8c=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0xd8cc[_0x1b02bb];return _0x131245;};'use strict';var Sequelize=require(_0xcd8c('0x0'));module[_0xcd8c('0x1')]={'body':{'type':Sequelize[_0xcd8c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcd8c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd8c('0x4')]('in',_0xcd8c('0x5')),'defaultValue':_0xcd8c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcd8c('0x6')](0xbe)},'phone':{'type':Sequelize[_0xcd8c('0x6')]},'readAt':{'type':Sequelize[_0xcd8c('0x7')]},'secret':{'type':Sequelize[_0xcd8c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcd8c('0x6')]},'providerResponse':{'type':Sequelize[_0xcd8c('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c37eecf..24249c3 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 _0xf496=['acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SELECT','User','email','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsMessage','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','sms-interactions','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','[SMSMESSAGE: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','QueryTypes','contact','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager'];(function(_0x428b9f,_0x1c062d){var _0x34428a=function(_0x2c5b12){while(--_0x2c5b12){_0x428b9f['push'](_0x428b9f['shift']());}};_0x34428a(++_0x1c062d);}(_0xf496,0x1c7));var _0x6f49=function(_0x20dfad,_0x503f65){_0x20dfad=_0x20dfad-0x0;var _0x45250b=_0xf496[_0x20dfad];return _0x45250b;};'use strict';var emlformat=require(_0x6f49('0x0'));var rimraf=require(_0x6f49('0x1'));var zipdir=require(_0x6f49('0x2'));var jsonpatch=require(_0x6f49('0x3'));var rp=require(_0x6f49('0x4'));var moment=require('moment');var BPromise=require(_0x6f49('0x5'));var Mustache=require(_0x6f49('0x6'));var util=require('util');var path=require(_0x6f49('0x7'));var sox=require(_0x6f49('0x8'));var csv=require(_0x6f49('0x9'));var ejs=require(_0x6f49('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f49('0xb'));var squel=require(_0x6f49('0xc'));var crypto=require(_0x6f49('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f49('0x9'));var querystring=require('querystring');var Papa=require(_0x6f49('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f49('0xf'));var logger=require(_0x6f49('0x10'))('api');var utils=require(_0x6f49('0x11'));var config=require(_0x6f49('0x12'));var licenseUtil=require(_0x6f49('0x13'));var db=require(_0x6f49('0x14'))['db'];config[_0x6f49('0x15')]=_[_0x6f49('0x16')](config[_0x6f49('0x15')],{'host':_0x6f49('0x17'),'port':0x18eb});var socket=require(_0x6f49('0x18'))(new Redis(config['redis']));require(_0x6f49('0x19'))[_0x6f49('0x1a')](socket);var jayson=require(_0x6f49('0x1b'));var client=jayson['client'][_0x6f49('0x1c')]({'port':0x232c});var client9002=jayson[_0x6f49('0x1d')][_0x6f49('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3a628e,_0x7575ca,_0x9c5cf2,_0x327ec6){return new BPromise(function(_0x515dc6,_0x449b20){var _0x2627f4=_0x327ec6||client;return _0x2627f4[_0x6f49('0x1e')](_0x3a628e,_0x9c5cf2)[_0x6f49('0x1f')](function(_0x143363){logger[_0x6f49('0x20')](_0x6f49('0x21'),_0x7575ca,'request\x20sent');logger[_0x6f49('0x22')](_0x6f49('0x23'),_0x7575ca,'request\x20sent',JSON[_0x6f49('0x24')](_0x143363));if(_0x143363[_0x6f49('0x25')]){if(_0x143363[_0x6f49('0x25')][_0x6f49('0x26')]===0x1f4){logger[_0x6f49('0x25')](_0x6f49('0x21'),_0x7575ca,_0x143363['error'][_0x6f49('0x27')]);return _0x449b20(_0x143363['error'][_0x6f49('0x27')]);}logger[_0x6f49('0x25')]('SmsMessage,\x20%s,\x20%s',_0x7575ca,_0x143363['error']['message']);return _0x515dc6(_0x143363[_0x6f49('0x25')][_0x6f49('0x27')]);}else{logger[_0x6f49('0x20')]('SmsMessage,\x20%s,\x20%s',_0x7575ca,_0x6f49('0x28'));_0x515dc6(_0x143363[_0x6f49('0x29')][_0x6f49('0x27')]);}})['catch'](function(_0x2d81d0){logger[_0x6f49('0x25')](_0x6f49('0x21'),_0x7575ca,_0x2d81d0);_0x449b20(_0x2d81d0);});});}function respondWithStatusCode(_0x2f60ec,_0x4fd233){_0x4fd233=_0x4fd233||0xcc;return function(_0x3d68f3){if(_0x3d68f3){return _0x2f60ec[_0x6f49('0x2a')](_0x4fd233);}return _0x2f60ec[_0x6f49('0x2b')](_0x4fd233)[_0x6f49('0x2c')]();};}function respondWithResult(_0x24a52c,_0x2e99d7){_0x2e99d7=_0x2e99d7||0xc8;return function(_0x5aee44){if(_0x5aee44){return _0x24a52c[_0x6f49('0x2b')](_0x2e99d7)[_0x6f49('0x2d')](_0x5aee44);}};}function respondWithFilteredResult(_0x1e560e,_0x9e4045){return function(_0x11c755){if(_0x11c755){var _0x9afad8=typeof _0x9e4045['offset']===_0x6f49('0x2e')&&typeof _0x9e4045[_0x6f49('0x2f')]==='undefined';var _0x3e5984=_0x11c755[_0x6f49('0x30')];var _0x31745c=_0x9afad8?0x0:_0x9e4045['offset'];var _0x4e03a2=_0x9afad8?_0x11c755[_0x6f49('0x30')]:_0x9e4045[_0x6f49('0x31')]+_0x9e4045[_0x6f49('0x2f')];var _0x14c231;if(_0x4e03a2>=_0x3e5984){_0x4e03a2=_0x3e5984;_0x14c231=0xc8;}else{_0x14c231=0xce;}_0x1e560e[_0x6f49('0x2b')](_0x14c231);return _0x1e560e[_0x6f49('0x32')](_0x6f49('0x33'),_0x31745c+'-'+_0x4e03a2+'/'+_0x3e5984)['json'](_0x11c755);}return null;};}function patchUpdates(_0x548d2e){return function(_0x31e2cd){try{jsonpatch[_0x6f49('0x34')](_0x31e2cd,_0x548d2e,!![]);}catch(_0x275760){return BPromise['reject'](_0x275760);}return _0x31e2cd['save']();};}function saveUpdates(_0x397212,_0x18831f){return function(_0x264c4d){if(_0x264c4d){return _0x264c4d[_0x6f49('0x35')](_0x397212)['then'](function(_0x1b65fc){return _0x1b65fc;});}return null;};}function removeEntity(_0x5bf2d5,_0x70aa98){return function(_0x212f22){if(_0x212f22){return _0x212f22[_0x6f49('0x36')]()[_0x6f49('0x1f')](function(){_0x5bf2d5[_0x6f49('0x2b')](0xcc)[_0x6f49('0x2c')]();});}};}function handleEntityNotFound(_0x4fd0ec,_0x33e0f6){return function(_0x3b555f){if(!_0x3b555f){_0x4fd0ec[_0x6f49('0x2a')](0x194);}return _0x3b555f;};}function handleError(_0x98e9b1,_0x246260){_0x246260=_0x246260||0x1f4;return function(_0x5db024){logger['error'](_0x5db024[_0x6f49('0x37')]);if(_0x5db024[_0x6f49('0x38')]){delete _0x5db024[_0x6f49('0x38')];}_0x98e9b1['status'](_0x246260)['send'](_0x5db024);};}exports[_0x6f49('0x39')]=function(_0x50e063,_0x109560){var _0x157726={},_0x425367={},_0x4db30e={'count':0x0,'rows':[]};var _0x3ea8ee=_[_0x6f49('0x3a')](db['SmsMessage'][_0x6f49('0x3b')],function(_0x29fb0e){return{'name':_0x29fb0e[_0x6f49('0x3c')],'type':_0x29fb0e[_0x6f49('0x3d')][_0x6f49('0x3e')]};});_0x425367[_0x6f49('0x3f')]=_['map'](_0x3ea8ee,_0x6f49('0x38'));_0x425367[_0x6f49('0x40')]=_[_0x6f49('0x41')](_0x50e063[_0x6f49('0x40')]);_0x425367[_0x6f49('0x42')]=_[_0x6f49('0x43')](_0x425367[_0x6f49('0x3f')],_0x425367[_0x6f49('0x40')]);_0x157726[_0x6f49('0x44')]=_[_0x6f49('0x43')](_0x425367[_0x6f49('0x3f')],qs[_0x6f49('0x45')](_0x50e063[_0x6f49('0x40')][_0x6f49('0x45')]));_0x157726[_0x6f49('0x44')]=_0x157726[_0x6f49('0x44')][_0x6f49('0x46')]?_0x157726['attributes']:_0x425367[_0x6f49('0x3f')];if(!_0x50e063['query'][_0x6f49('0x47')](_0x6f49('0x48'))){_0x157726['limit']=qs[_0x6f49('0x2f')](_0x50e063[_0x6f49('0x40')][_0x6f49('0x2f')]);_0x157726[_0x6f49('0x31')]=qs[_0x6f49('0x31')](_0x50e063[_0x6f49('0x40')][_0x6f49('0x31')]);}_0x157726[_0x6f49('0x49')]=qs[_0x6f49('0x4a')](_0x50e063[_0x6f49('0x40')][_0x6f49('0x4a')]);_0x157726[_0x6f49('0x4b')]=qs[_0x6f49('0x42')](_[_0x6f49('0x4c')](_0x50e063[_0x6f49('0x40')],_0x425367[_0x6f49('0x42')]),_0x3ea8ee);if(_0x50e063['query'][_0x6f49('0x4d')]){_0x157726[_0x6f49('0x4b')]=_[_0x6f49('0x4e')](_0x157726[_0x6f49('0x4b')],{'$or':_[_0x6f49('0x3a')](_0x3ea8ee,function(_0x44943f){if(_0x44943f[_0x6f49('0x3d')]!==_0x6f49('0x4f')){var _0xfd5c53={};_0xfd5c53[_0x44943f[_0x6f49('0x38')]]={'$like':'%'+_0x50e063[_0x6f49('0x40')][_0x6f49('0x4d')]+'%'};return _0xfd5c53;}})});}_0x157726=_[_0x6f49('0x4e')]({},_0x157726,_0x50e063[_0x6f49('0x50')]);var _0x2c468b={'where':_0x157726[_0x6f49('0x4b')]};return db[_0x6f49('0x51')]['count'](_0x2c468b)[_0x6f49('0x1f')](function(_0x42ed74){_0x4db30e['count']=_0x42ed74;if(_0x50e063[_0x6f49('0x40')]['includeAll']){_0x157726[_0x6f49('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x6f49('0x53')](_0x157726);})[_0x6f49('0x1f')](function(_0x5c8972){_0x4db30e[_0x6f49('0x54')]=_0x5c8972;return _0x4db30e;})[_0x6f49('0x1f')](respondWithFilteredResult(_0x109560,_0x157726))[_0x6f49('0x55')](handleError(_0x109560,null));};exports[_0x6f49('0x56')]=function(_0x11b2ec,_0x5be6d6){var _0x4ac2bf={'raw':!![],'where':{'id':_0x11b2ec[_0x6f49('0x57')]['id']}},_0x9a84b7={};_0x9a84b7[_0x6f49('0x3f')]=_[_0x6f49('0x41')](db[_0x6f49('0x51')]['rawAttributes']);_0x9a84b7['query']=_[_0x6f49('0x41')](_0x11b2ec['query']);_0x9a84b7['filters']=_[_0x6f49('0x43')](_0x9a84b7[_0x6f49('0x3f')],_0x9a84b7[_0x6f49('0x40')]);_0x4ac2bf[_0x6f49('0x44')]=_['intersection'](_0x9a84b7[_0x6f49('0x3f')],qs[_0x6f49('0x45')](_0x11b2ec[_0x6f49('0x40')][_0x6f49('0x45')]));_0x4ac2bf[_0x6f49('0x44')]=_0x4ac2bf[_0x6f49('0x44')]['length']?_0x4ac2bf['attributes']:_0x9a84b7['model'];if(_0x11b2ec[_0x6f49('0x40')][_0x6f49('0x58')]){_0x4ac2bf['include']=[{'all':!![]}];}_0x4ac2bf=_[_0x6f49('0x4e')]({},_0x4ac2bf,_0x11b2ec[_0x6f49('0x50')]);return db[_0x6f49('0x51')]['find'](_0x4ac2bf)[_0x6f49('0x1f')](handleEntityNotFound(_0x5be6d6,null))[_0x6f49('0x1f')](respondWithResult(_0x5be6d6,null))[_0x6f49('0x55')](handleError(_0x5be6d6,null));};exports['create']=function(_0x151ed8,_0x43adc7){return db[_0x6f49('0x51')][_0x6f49('0x59')](_0x151ed8[_0x6f49('0x5a')],{})[_0x6f49('0x1f')](respondWithResult(_0x43adc7,0xc9))[_0x6f49('0x55')](handleError(_0x43adc7,null));};exports[_0x6f49('0x35')]=function(_0x7092df,_0x42a136){if(_0x7092df[_0x6f49('0x5a')]['id']){delete _0x7092df['body']['id'];}return db[_0x6f49('0x51')][_0x6f49('0x5b')]({'where':{'id':_0x7092df[_0x6f49('0x57')]['id']}})['then'](handleEntityNotFound(_0x42a136,null))['then'](saveUpdates(_0x7092df['body'],null))[_0x6f49('0x1f')](respondWithResult(_0x42a136,null))[_0x6f49('0x55')](handleError(_0x42a136,null));};exports[_0x6f49('0x36')]=function(_0x253be0,_0x57dd20){return db[_0x6f49('0x51')]['find']({'where':{'id':_0x253be0['params']['id']}})[_0x6f49('0x1f')](handleEntityNotFound(_0x57dd20,null))[_0x6f49('0x1f')](removeEntity(_0x57dd20,null))[_0x6f49('0x55')](handleError(_0x57dd20,null));};exports['describe']=function(_0x5b717f,_0x2f3bc4){return db[_0x6f49('0x51')][_0x6f49('0x5c')]()['then'](respondWithResult(_0x2f3bc4,null))['catch'](handleError(_0x2f3bc4,null));};var interaction_log=require(_0x6f49('0x10'))(_0x6f49('0x5d'));exports['accept']=function(_0x211be3,_0x85dedf,_0x1889a6){var _0x46cf81={'agent':{},'channel':_0x6f49('0x5e')};if(_0x211be3[_0x6f49('0x5a')]['id']){delete _0x211be3['body']['id'];}_0x211be3['body']['read']=!![];_0x211be3['body']['readAt']=moment()[_0x6f49('0x5f')](_0x6f49('0x60'));_0x211be3[_0x6f49('0x5a')][_0x6f49('0x61')]=_0x211be3[_0x6f49('0x5a')][_0x6f49('0x61')]||_0x211be3[_0x6f49('0x62')]['id'];_0x46cf81['agent']['id']=_0x211be3[_0x6f49('0x5a')]['UserId'];return db[_0x6f49('0x51')]['find']({'where':{'id':_0x211be3['params']['id'],'UserId':null}})[_0x6f49('0x1f')](handleEntityNotFound(_0x85dedf,null))[_0x6f49('0x1f')](saveUpdates(_0x211be3[_0x6f49('0x5a')],null))[_0x6f49('0x1f')](function(_0x35660c){if(_0x35660c){_0x46cf81[_0x6f49('0x27')]=_0x35660c[_0x6f49('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x6f49('0x5b')]({'where':{'id':_0x35660c['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x85dedf,null))[_0x6f49('0x1f')](function(_0x44b336){if(_0x44b336){return _0x44b336[_0x6f49('0x35')]({'UserId':_0x211be3[_0x6f49('0x5a')]['UserId'],'read1stAt':_[_0x6f49('0x64')](_0x44b336[_0x6f49('0x65')])?moment()[_0x6f49('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4c76fe){if(_0x4c76fe){_0x46cf81['interaction']=_0x4c76fe[_0x6f49('0x63')]({'plain':!![]});interaction_log[_0x6f49('0x20')](_0x6f49('0x66'),_0x211be3[_0x6f49('0x62')]['id'],_0x211be3['user'][_0x6f49('0x38')],_0x211be3['user']['role'],_0x46cf81['interaction']['id'],_0x211be3[_0x6f49('0x5a')]?JSON['stringify'](_0x211be3[_0x6f49('0x5a')]):_0x6f49('0x67'));return respondWithRpcPromise(_0x6f49('0x68'),'acceptMessage',_0x46cf81);}return null;})[_0x6f49('0x1f')](function(_0x55995e){var _0x269ede=_0x6f49('0x69')+_0x55995e[_0x6f49('0x27')][_0x6f49('0x6a')];return db[_0x6f49('0x6b')]['query'](_0x269ede,{'type':db[_0x6f49('0x6c')][_0x6f49('0x6d')]['SELECT'],'raw':!![]})['then'](function(_0x129d2b){return _0x129d2b;});})['then'](function(_0x156578){if(_0x156578){_0x46cf81['message'][_0x6f49('0x6e')]=_0x156578[0x0];if(!_0x211be3['body'][_0x6f49('0x61')])return;return db['User'][_0x6f49('0x5b')]({'where':{'id':_0x211be3['body'][_0x6f49('0x61')],'role':_0x6f49('0x6f')},'attributes':['id',_0x6f49('0x38'),_0x6f49('0x70'),'email',_0x6f49('0x71')],'raw':!![]});}return null;})[_0x6f49('0x1f')](function(_0xe90f97){if(!_0xe90f97)return null;_0x46cf81[_0x6f49('0x27')][_0x6f49('0x6f')]=_0xe90f97;return _0x46cf81;})[_0x6f49('0x1f')](function(_0x5ca68a){if(_0x5ca68a){if(_0x211be3['body'][_0x6f49('0x72')]){_0x46cf81['message'][_0x6f49('0x73')]=util[_0x6f49('0x5f')](_0x6f49('0x74'),_0x211be3[_0x6f49('0x62')][_0x6f49('0x38')]);_0x46cf81['message'][_0x6f49('0x75')]=_0x46cf81[_0x6f49('0x75')];_0x46cf81['message'][_0x6f49('0x76')]=_0x46cf81[_0x6f49('0x75')];_0x46cf81['message'][_0x6f49('0x77')]='accept';return respondWithRpcPromise(_0x6f49('0x78'),_0x6f49('0x78'),{'event':_0x6f49('0x79'),'message':_0x46cf81['message']},client9002)[_0x6f49('0x1f')](function(){return _0x46cf81;});}return _0x46cf81;}return null;})[_0x6f49('0x1f')](respondWithResult(_0x85dedf,null))[_0x6f49('0x55')](handleError(_0x85dedf,null));};var interaction_log=require(_0x6f49('0x10'))(_0x6f49('0x5d'));exports[_0x6f49('0x7a')]=function(_0x247577,_0x15ba98,_0x3f147c){var _0x45973b={'agent':{},'channel':_0x6f49('0x5e')};if(_0x247577[_0x6f49('0x5a')]['id']){delete _0x247577[_0x6f49('0x5a')]['id'];}_0x247577['body'][_0x6f49('0x61')]=_0x247577[_0x6f49('0x5a')][_0x6f49('0x61')]||_0x247577[_0x6f49('0x62')]['id'];_0x45973b[_0x6f49('0x6f')]['id']=_0x247577[_0x6f49('0x5a')]['UserId'];return db[_0x6f49('0x51')]['find']({'where':{'id':_0x247577[_0x6f49('0x57')]['id'],'UserId':null}})[_0x6f49('0x1f')](handleEntityNotFound(_0x15ba98,null))[_0x6f49('0x1f')](function(_0x5db849){if(_0x5db849){_0x45973b[_0x6f49('0x27')]=_0x5db849[_0x6f49('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x6f49('0x5b')]({'where':{'id':_0x5db849['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x15ba98,null))[_0x6f49('0x1f')](function(_0x2c7990){if(_0x2c7990){_0x45973b['interaction']=_0x2c7990[_0x6f49('0x63')]({'plain':!![]});interaction_log[_0x6f49('0x20')](_0x6f49('0x7b'),_0x247577[_0x6f49('0x62')]['id'],_0x247577[_0x6f49('0x62')]['name'],_0x247577[_0x6f49('0x62')][_0x6f49('0x7c')],_0x45973b['interaction']['id'],_0x247577[_0x6f49('0x5a')]?JSON[_0x6f49('0x24')](_0x247577['body']):_0x6f49('0x67'));return respondWithRpcPromise(_0x6f49('0x7d'),'rejectMessage',_0x45973b);}return null;})[_0x6f49('0x1f')](function(_0x3feda4){var _0x50a7d7=_0x6f49('0x69')+_0x3feda4[_0x6f49('0x27')][_0x6f49('0x6a')];return db[_0x6f49('0x6b')][_0x6f49('0x40')](_0x50a7d7,{'type':db[_0x6f49('0x6c')][_0x6f49('0x6d')][_0x6f49('0x7e')],'raw':!![]})['then'](function(_0x5e67ce){return _0x5e67ce;});})[_0x6f49('0x1f')](function(_0x17304e){if(_0x17304e){_0x45973b[_0x6f49('0x27')][_0x6f49('0x6e')]=_0x17304e[0x0];if(!_0x247577[_0x6f49('0x5a')][_0x6f49('0x61')])return;return db[_0x6f49('0x7f')][_0x6f49('0x5b')]({'where':{'id':_0x247577[_0x6f49('0x5a')][_0x6f49('0x61')],'role':'agent'},'attributes':['id','name','fullname',_0x6f49('0x80'),_0x6f49('0x71')],'raw':!![]});}return null;})[_0x6f49('0x1f')](function(_0x4f7f39){if(!_0x4f7f39)return null;_0x45973b[_0x6f49('0x27')][_0x6f49('0x6f')]=_0x4f7f39;return _0x45973b;})['then'](function(_0x29e230){if(_0x29e230){_0x29e230[_0x6f49('0x27')][_0x6f49('0x73')]=util[_0x6f49('0x5f')](_0x6f49('0x74'),_0x247577[_0x6f49('0x62')][_0x6f49('0x38')]);_0x29e230[_0x6f49('0x27')][_0x6f49('0x75')]=_0x45973b[_0x6f49('0x75')];_0x29e230[_0x6f49('0x27')]['motionChannel']=_0x45973b['channel'];_0x29e230[_0x6f49('0x27')][_0x6f49('0x77')]=_0x6f49('0x7a');respondWithRpcPromise(_0x6f49('0x78'),_0x6f49('0x78'),{'event':'rejectmessage','message':_0x29e230['message']},client9002);return _0x45973b;}return null;})[_0x6f49('0x1f')](respondWithResult(_0x15ba98,null))[_0x6f49('0x55')](handleError(_0x15ba98,null));};exports['status']=function(_0x588350,_0x13ac2b,_0x27dfa8){if(_0x588350['body']['id']){delete _0x588350['body']['id'];}var _0x3a0b8f;return db[_0x6f49('0x51')][_0x6f49('0x5b')]({'where':{'id':_0x588350['params']['id']}})[_0x6f49('0x1f')](handleEntityNotFound(_0x13ac2b,null))[_0x6f49('0x1f')](function(_0x54fa2f){if(_0x54fa2f){_0x3a0b8f=_0x54fa2f;return db[_0x6f49('0x81')][_0x6f49('0x5b')]({'where':{'id':_0x54fa2f['SmsAccountId']}});}})[_0x6f49('0x1f')](handleEntityNotFound(_0x13ac2b,null))[_0x6f49('0x1f')](function(_0x49ca99){if(_0x49ca99){logger[_0x6f49('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x6f49('0x82'),_0x49ca99[_0x6f49('0x3d')],util[_0x6f49('0x83')](_0x588350['body'],{'showHidden':![],'depth':null}));switch(_0x49ca99[_0x6f49('0x3d')]){case _0x6f49('0x84'):if(_0x588350[_0x6f49('0x5a')][_0x6f49('0x85')]&&_0x588350[_0x6f49('0x5a')][_0x6f49('0x85')]===_0x3a0b8f[_0x6f49('0x86')]){return _0x3a0b8f[_0x6f49('0x35')]({'read':!![]});}else{logger['error'](_0x6f49('0x87'),_0x6f49('0x2b'),_0x6f49('0x84'),util[_0x6f49('0x83')](_0x588350['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x588350[_0x6f49('0x5a')][_0x6f49('0x88')]&&_0x588350['body'][_0x6f49('0x88')]===_0x3a0b8f[_0x6f49('0x86')]&&_[_0x6f49('0x89')](['sent',_0x6f49('0x8a')],_0x588350[_0x6f49('0x5a')][_0x6f49('0x8b')])>=0x0){return _0x3a0b8f[_0x6f49('0x35')]({'read':!![]});}else{logger['error'](_0x6f49('0x87'),_0x6f49('0x2b'),'plivio',util[_0x6f49('0x83')](_0x588350[_0x6f49('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6f49('0x8c'):var _0x52f1fe=_0x588350[_0x6f49('0x5a')][_0x6f49('0x8d')][0x0];if(_0x52f1fe[_0x6f49('0x2b')][_0x6f49('0x8e')]===_0x6f49('0x8f')){return _0x3a0b8f['update']({'read':!![]});}else{logger['error'](_0x6f49('0x87'),_0x6f49('0x2b'),_0x6f49('0x8c'),util[_0x6f49('0x83')](_0x588350[_0x6f49('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3a0b8f;}})[_0x6f49('0x1f')](respondWithResult(_0x13ac2b,null))[_0x6f49('0x55')](handleError(_0x13ac2b,null));}; \ No newline at end of file +var _0xb422=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','length','find','create','body','update','destroy','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','interaction','[SMSMESSAGE: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','contact','agent','fullname','internal','interface','channel','event','EventManager','../../config/logger','SmsInteractionId','stringify','RejectMessage','rejectMessage','SELECT','User','email','SIP/%s','motionChannel','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','results','DELIVERED','fast-json-patch','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x3b325a,_0x354699){var _0xd384fb=function(_0xcbf724){while(--_0xcbf724){_0x3b325a['push'](_0x3b325a['shift']());}};_0xd384fb(++_0x354699);}(_0xb422,0x85));var _0x2b42=function(_0x91709,_0x536a5c){_0x91709=_0x91709-0x0;var _0x29157c=_0xb422[_0x91709];return _0x29157c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b42('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b42('0x1'));var Mustache=require('mustache');var util=require(_0x2b42('0x2'));var path=require('path');var sox=require(_0x2b42('0x3'));var csv=require('to-csv');var ejs=require(_0x2b42('0x4'));var fs=require('fs');var fs_extra=require(_0x2b42('0x5'));var _=require(_0x2b42('0x6'));var squel=require('squel');var crypto=require(_0x2b42('0x7'));var jsforce=require(_0x2b42('0x8'));var deskjs=require(_0x2b42('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b42('0xa'));var Redis=require('ioredis');var authService=require(_0x2b42('0xb'));var qs=require(_0x2b42('0xc'));var as=require(_0x2b42('0xd'));var hardwareService=require(_0x2b42('0xe'));var logger=require('../../config/logger')(_0x2b42('0xf'));var utils=require(_0x2b42('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2b42('0x11'));var db=require(_0x2b42('0x12'))['db'];config[_0x2b42('0x13')]=_[_0x2b42('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2b42('0x15'))(new Redis(config[_0x2b42('0x13')]));require('./smsMessage.socket')[_0x2b42('0x16')](socket);var jayson=require(_0x2b42('0x17'));var client=jayson[_0x2b42('0x18')][_0x2b42('0x19')]({'port':0x232c});var client9002=jayson[_0x2b42('0x18')][_0x2b42('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x84b092,_0x1b93d5,_0x61d64c,_0x1f7e7a){return new BPromise(function(_0x4897d8,_0x1dea8b){var _0x11fdec=_0x1f7e7a||client;return _0x11fdec[_0x2b42('0x1a')](_0x84b092,_0x61d64c)[_0x2b42('0x1b')](function(_0x27419d){logger[_0x2b42('0x1c')](_0x2b42('0x1d'),_0x1b93d5,_0x2b42('0x1e'));logger['debug'](_0x2b42('0x1f'),_0x1b93d5,_0x2b42('0x1e'),JSON['stringify'](_0x27419d));if(_0x27419d[_0x2b42('0x20')]){if(_0x27419d['error'][_0x2b42('0x21')]===0x1f4){logger[_0x2b42('0x20')](_0x2b42('0x1d'),_0x1b93d5,_0x27419d['error']['message']);return _0x1dea8b(_0x27419d[_0x2b42('0x20')][_0x2b42('0x22')]);}logger[_0x2b42('0x20')](_0x2b42('0x1d'),_0x1b93d5,_0x27419d['error'][_0x2b42('0x22')]);return _0x4897d8(_0x27419d[_0x2b42('0x20')]['message']);}else{logger[_0x2b42('0x1c')](_0x2b42('0x1d'),_0x1b93d5,_0x2b42('0x1e'));_0x4897d8(_0x27419d[_0x2b42('0x23')][_0x2b42('0x22')]);}})[_0x2b42('0x24')](function(_0x5367f0){logger[_0x2b42('0x20')](_0x2b42('0x1d'),_0x1b93d5,_0x5367f0);_0x1dea8b(_0x5367f0);});});}function respondWithStatusCode(_0x477e97,_0x256fc9){_0x256fc9=_0x256fc9||0xcc;return function(_0x1d37b9){if(_0x1d37b9){return _0x477e97[_0x2b42('0x25')](_0x256fc9);}return _0x477e97[_0x2b42('0x26')](_0x256fc9)[_0x2b42('0x27')]();};}function respondWithResult(_0x2db5d7,_0xe32cdc){_0xe32cdc=_0xe32cdc||0xc8;return function(_0x1afb89){if(_0x1afb89){return _0x2db5d7['status'](_0xe32cdc)['json'](_0x1afb89);}};}function respondWithFilteredResult(_0x162efa,_0xcb30f5){return function(_0x8293e2){if(_0x8293e2){var _0x352ef7=typeof _0xcb30f5['offset']===_0x2b42('0x28')&&typeof _0xcb30f5[_0x2b42('0x29')]===_0x2b42('0x28');var _0x5ba827=_0x8293e2['count'];var _0x39e32e=_0x352ef7?0x0:_0xcb30f5[_0x2b42('0x2a')];var _0x41d4ef=_0x352ef7?_0x8293e2[_0x2b42('0x2b')]:_0xcb30f5['offset']+_0xcb30f5[_0x2b42('0x29')];var _0x38148e;if(_0x41d4ef>=_0x5ba827){_0x41d4ef=_0x5ba827;_0x38148e=0xc8;}else{_0x38148e=0xce;}_0x162efa[_0x2b42('0x26')](_0x38148e);return _0x162efa['set'](_0x2b42('0x2c'),_0x39e32e+'-'+_0x41d4ef+'/'+_0x5ba827)[_0x2b42('0x2d')](_0x8293e2);}return null;};}function patchUpdates(_0x3e029d){return function(_0x2dd942){try{jsonpatch[_0x2b42('0x2e')](_0x2dd942,_0x3e029d,!![]);}catch(_0x32a2d2){return BPromise[_0x2b42('0x2f')](_0x32a2d2);}return _0x2dd942[_0x2b42('0x30')]();};}function saveUpdates(_0x4305bb,_0x15ebd4){return function(_0x68a33e){if(_0x68a33e){return _0x68a33e['update'](_0x4305bb)[_0x2b42('0x1b')](function(_0x4b574a){return _0x4b574a;});}return null;};}function removeEntity(_0x49447d,_0x4506e1){return function(_0x75f09){if(_0x75f09){return _0x75f09['destroy']()['then'](function(){_0x49447d['status'](0xcc)[_0x2b42('0x27')]();});}};}function handleEntityNotFound(_0x339b9f,_0x14d7d4){return function(_0x4ba982){if(!_0x4ba982){_0x339b9f[_0x2b42('0x25')](0x194);}return _0x4ba982;};}function handleError(_0x8c7703,_0x5b538d){_0x5b538d=_0x5b538d||0x1f4;return function(_0x4dda76){logger[_0x2b42('0x20')](_0x4dda76[_0x2b42('0x31')]);if(_0x4dda76[_0x2b42('0x32')]){delete _0x4dda76['name'];}_0x8c7703[_0x2b42('0x26')](_0x5b538d)[_0x2b42('0x33')](_0x4dda76);};}exports[_0x2b42('0x34')]=function(_0x45d4ab,_0x175367){var _0x48d362={},_0x388def={},_0xa9a830={'count':0x0,'rows':[]};var _0x21bd6d=_[_0x2b42('0x35')](db[_0x2b42('0x36')][_0x2b42('0x37')],function(_0x45fb9f){return{'name':_0x45fb9f[_0x2b42('0x38')],'type':_0x45fb9f[_0x2b42('0x39')][_0x2b42('0x3a')]};});_0x388def['model']=_['map'](_0x21bd6d,_0x2b42('0x32'));_0x388def[_0x2b42('0x3b')]=_[_0x2b42('0x3c')](_0x45d4ab[_0x2b42('0x3b')]);_0x388def['filters']=_[_0x2b42('0x3d')](_0x388def[_0x2b42('0x3e')],_0x388def[_0x2b42('0x3b')]);_0x48d362[_0x2b42('0x3f')]=_[_0x2b42('0x3d')](_0x388def['model'],qs[_0x2b42('0x40')](_0x45d4ab['query'][_0x2b42('0x40')]));_0x48d362[_0x2b42('0x3f')]=_0x48d362['attributes']['length']?_0x48d362[_0x2b42('0x3f')]:_0x388def[_0x2b42('0x3e')];if(!_0x45d4ab['query']['hasOwnProperty'](_0x2b42('0x41'))){_0x48d362[_0x2b42('0x29')]=qs[_0x2b42('0x29')](_0x45d4ab[_0x2b42('0x3b')][_0x2b42('0x29')]);_0x48d362[_0x2b42('0x2a')]=qs['offset'](_0x45d4ab[_0x2b42('0x3b')][_0x2b42('0x2a')]);}_0x48d362['order']=qs[_0x2b42('0x42')](_0x45d4ab[_0x2b42('0x3b')][_0x2b42('0x42')]);_0x48d362[_0x2b42('0x43')]=qs[_0x2b42('0x44')](_[_0x2b42('0x45')](_0x45d4ab[_0x2b42('0x3b')],_0x388def[_0x2b42('0x44')]),_0x21bd6d);if(_0x45d4ab[_0x2b42('0x3b')][_0x2b42('0x46')]){_0x48d362[_0x2b42('0x43')]=_[_0x2b42('0x47')](_0x48d362[_0x2b42('0x43')],{'$or':_[_0x2b42('0x35')](_0x21bd6d,function(_0x296a8a){if(_0x296a8a['type']!=='VIRTUAL'){var _0x5c9c32={};_0x5c9c32[_0x296a8a[_0x2b42('0x32')]]={'$like':'%'+_0x45d4ab[_0x2b42('0x3b')][_0x2b42('0x46')]+'%'};return _0x5c9c32;}})});}_0x48d362=_[_0x2b42('0x47')]({},_0x48d362,_0x45d4ab[_0x2b42('0x48')]);var _0x8a60dc={'where':_0x48d362['where']};return db[_0x2b42('0x36')][_0x2b42('0x2b')](_0x8a60dc)['then'](function(_0x2c1859){_0xa9a830['count']=_0x2c1859;if(_0x45d4ab[_0x2b42('0x3b')][_0x2b42('0x49')]){_0x48d362[_0x2b42('0x4a')]=[{'all':!![]}];}return db[_0x2b42('0x36')][_0x2b42('0x4b')](_0x48d362);})[_0x2b42('0x1b')](function(_0x9f223b){_0xa9a830[_0x2b42('0x4c')]=_0x9f223b;return _0xa9a830;})['then'](respondWithFilteredResult(_0x175367,_0x48d362))[_0x2b42('0x24')](handleError(_0x175367,null));};exports['show']=function(_0x452bb8,_0x2139ae){var _0x452f8c={'raw':!![],'where':{'id':_0x452bb8[_0x2b42('0x4d')]['id']}},_0x4d8b8e={};_0x4d8b8e[_0x2b42('0x3e')]=_[_0x2b42('0x3c')](db[_0x2b42('0x36')]['rawAttributes']);_0x4d8b8e['query']=_[_0x2b42('0x3c')](_0x452bb8[_0x2b42('0x3b')]);_0x4d8b8e[_0x2b42('0x44')]=_[_0x2b42('0x3d')](_0x4d8b8e['model'],_0x4d8b8e[_0x2b42('0x3b')]);_0x452f8c[_0x2b42('0x3f')]=_[_0x2b42('0x3d')](_0x4d8b8e[_0x2b42('0x3e')],qs[_0x2b42('0x40')](_0x452bb8['query'][_0x2b42('0x40')]));_0x452f8c[_0x2b42('0x3f')]=_0x452f8c[_0x2b42('0x3f')][_0x2b42('0x4e')]?_0x452f8c[_0x2b42('0x3f')]:_0x4d8b8e[_0x2b42('0x3e')];if(_0x452bb8[_0x2b42('0x3b')][_0x2b42('0x49')]){_0x452f8c[_0x2b42('0x4a')]=[{'all':!![]}];}_0x452f8c=_['merge']({},_0x452f8c,_0x452bb8[_0x2b42('0x48')]);return db[_0x2b42('0x36')][_0x2b42('0x4f')](_0x452f8c)[_0x2b42('0x1b')](handleEntityNotFound(_0x2139ae,null))['then'](respondWithResult(_0x2139ae,null))['catch'](handleError(_0x2139ae,null));};exports[_0x2b42('0x50')]=function(_0x346fb1,_0x20cf3a){return db[_0x2b42('0x36')][_0x2b42('0x50')](_0x346fb1[_0x2b42('0x51')],{})[_0x2b42('0x1b')](respondWithResult(_0x20cf3a,0xc9))[_0x2b42('0x24')](handleError(_0x20cf3a,null));};exports[_0x2b42('0x52')]=function(_0x546bf4,_0x436a29){if(_0x546bf4['body']['id']){delete _0x546bf4[_0x2b42('0x51')]['id'];}return db[_0x2b42('0x36')][_0x2b42('0x4f')]({'where':{'id':_0x546bf4['params']['id']}})['then'](handleEntityNotFound(_0x436a29,null))['then'](saveUpdates(_0x546bf4[_0x2b42('0x51')],null))[_0x2b42('0x1b')](respondWithResult(_0x436a29,null))['catch'](handleError(_0x436a29,null));};exports[_0x2b42('0x53')]=function(_0x2c1e86,_0x3e3aeb){return db[_0x2b42('0x36')]['find']({'where':{'id':_0x2c1e86[_0x2b42('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e3aeb,null))[_0x2b42('0x1b')](removeEntity(_0x3e3aeb,null))['catch'](handleError(_0x3e3aeb,null));};exports[_0x2b42('0x54')]=function(_0x69131f,_0x5a5dc8){return db[_0x2b42('0x36')][_0x2b42('0x54')]()[_0x2b42('0x1b')](respondWithResult(_0x5a5dc8,null))[_0x2b42('0x24')](handleError(_0x5a5dc8,null));};var interaction_log=require('../../config/logger')(_0x2b42('0x55'));exports[_0x2b42('0x56')]=function(_0x2a1850,_0x3ad603,_0x571ade){var _0x6cefc0={'agent':{},'channel':_0x2b42('0x57')};if(_0x2a1850[_0x2b42('0x51')]['id']){delete _0x2a1850[_0x2b42('0x51')]['id'];}_0x2a1850['body'][_0x2b42('0x58')]=!![];_0x2a1850[_0x2b42('0x51')]['readAt']=moment()[_0x2b42('0x59')](_0x2b42('0x5a'));_0x2a1850[_0x2b42('0x51')][_0x2b42('0x5b')]=_0x2a1850[_0x2b42('0x51')][_0x2b42('0x5b')]||_0x2a1850[_0x2b42('0x5c')]['id'];_0x6cefc0['agent']['id']=_0x2a1850[_0x2b42('0x51')][_0x2b42('0x5b')];return db[_0x2b42('0x36')][_0x2b42('0x4f')]({'where':{'id':_0x2a1850[_0x2b42('0x4d')]['id'],'UserId':null}})[_0x2b42('0x1b')](handleEntityNotFound(_0x3ad603,null))[_0x2b42('0x1b')](saveUpdates(_0x2a1850[_0x2b42('0x51')],null))[_0x2b42('0x1b')](function(_0x4b945e){if(_0x4b945e){_0x6cefc0[_0x2b42('0x22')]=_0x4b945e[_0x2b42('0x5d')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x4b945e['SmsInteractionId']}});}return null;})[_0x2b42('0x1b')](handleEntityNotFound(_0x3ad603,null))[_0x2b42('0x1b')](function(_0x55fb3e){if(_0x55fb3e){return _0x55fb3e[_0x2b42('0x52')]({'UserId':_0x2a1850[_0x2b42('0x51')][_0x2b42('0x5b')],'read1stAt':_[_0x2b42('0x5e')](_0x55fb3e[_0x2b42('0x5f')])?moment()[_0x2b42('0x59')](_0x2b42('0x5a')):undefined});}return null;})[_0x2b42('0x1b')](function(_0x38c98f){if(_0x38c98f){_0x6cefc0[_0x2b42('0x60')]=_0x38c98f[_0x2b42('0x5d')]({'plain':!![]});interaction_log[_0x2b42('0x1c')](_0x2b42('0x61'),_0x2a1850[_0x2b42('0x5c')]['id'],_0x2a1850[_0x2b42('0x5c')][_0x2b42('0x32')],_0x2a1850[_0x2b42('0x5c')][_0x2b42('0x62')],_0x6cefc0[_0x2b42('0x60')]['id'],_0x2a1850['body']?JSON['stringify'](_0x2a1850[_0x2b42('0x51')]):_0x2b42('0x63'));return respondWithRpcPromise(_0x2b42('0x64'),_0x2b42('0x65'),_0x6cefc0);}return null;})[_0x2b42('0x1b')](function(_0x17e196){var _0x5a5071=_0x2b42('0x66')+_0x17e196[_0x2b42('0x22')][_0x2b42('0x67')];return db[_0x2b42('0x68')][_0x2b42('0x3b')](_0x5a5071,{'type':db[_0x2b42('0x69')][_0x2b42('0x6a')]['SELECT'],'raw':!![]})[_0x2b42('0x1b')](function(_0x28d7c9){return _0x28d7c9;});})['then'](function(_0x596e40){if(_0x596e40){_0x6cefc0[_0x2b42('0x22')][_0x2b42('0x6b')]=_0x596e40[0x0];if(!_0x2a1850[_0x2b42('0x51')]['UserId'])return;return db['User'][_0x2b42('0x4f')]({'where':{'id':_0x2a1850[_0x2b42('0x51')][_0x2b42('0x5b')],'role':_0x2b42('0x6c')},'attributes':['id',_0x2b42('0x32'),_0x2b42('0x6d'),'email',_0x2b42('0x6e')],'raw':!![]});}return null;})[_0x2b42('0x1b')](function(_0xf998b8){if(!_0xf998b8)return null;_0x6cefc0[_0x2b42('0x22')][_0x2b42('0x6c')]=_0xf998b8;return _0x6cefc0;})[_0x2b42('0x1b')](function(_0x149bcc){if(_0x149bcc){if(_0x2a1850[_0x2b42('0x51')]['manual']){_0x6cefc0[_0x2b42('0x22')][_0x2b42('0x6f')]=util['format']('SIP/%s',_0x2a1850['user']['name']);_0x6cefc0[_0x2b42('0x22')][_0x2b42('0x70')]=_0x6cefc0[_0x2b42('0x70')];_0x6cefc0['message']['motionChannel']=_0x6cefc0[_0x2b42('0x70')];_0x6cefc0[_0x2b42('0x22')][_0x2b42('0x71')]=_0x2b42('0x56');return respondWithRpcPromise('EventManager',_0x2b42('0x72'),{'event':'acceptmessage','message':_0x6cefc0['message']},client9002)[_0x2b42('0x1b')](function(){return _0x6cefc0;});}return _0x6cefc0;}return null;})[_0x2b42('0x1b')](respondWithResult(_0x3ad603,null))[_0x2b42('0x24')](handleError(_0x3ad603,null));};var interaction_log=require(_0x2b42('0x73'))(_0x2b42('0x55'));exports[_0x2b42('0x2f')]=function(_0x89d15c,_0x5ea692,_0xe07b31){var _0x311c62={'agent':{},'channel':'sms'};if(_0x89d15c['body']['id']){delete _0x89d15c[_0x2b42('0x51')]['id'];}_0x89d15c[_0x2b42('0x51')]['UserId']=_0x89d15c[_0x2b42('0x51')][_0x2b42('0x5b')]||_0x89d15c[_0x2b42('0x5c')]['id'];_0x311c62['agent']['id']=_0x89d15c[_0x2b42('0x51')][_0x2b42('0x5b')];return db[_0x2b42('0x36')][_0x2b42('0x4f')]({'where':{'id':_0x89d15c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ea692,null))[_0x2b42('0x1b')](function(_0x1b8f0b){if(_0x1b8f0b){_0x311c62[_0x2b42('0x22')]=_0x1b8f0b[_0x2b42('0x5d')]({'plain':!![]});return db['SmsInteraction'][_0x2b42('0x4f')]({'where':{'id':_0x1b8f0b[_0x2b42('0x74')]}});}return null;})['then'](handleEntityNotFound(_0x5ea692,null))[_0x2b42('0x1b')](function(_0x4ab077){if(_0x4ab077){_0x311c62[_0x2b42('0x60')]=_0x4ab077[_0x2b42('0x5d')]({'plain':!![]});interaction_log[_0x2b42('0x1c')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x89d15c['user']['id'],_0x89d15c[_0x2b42('0x5c')][_0x2b42('0x32')],_0x89d15c[_0x2b42('0x5c')][_0x2b42('0x62')],_0x311c62[_0x2b42('0x60')]['id'],_0x89d15c[_0x2b42('0x51')]?JSON[_0x2b42('0x75')](_0x89d15c[_0x2b42('0x51')]):_0x2b42('0x63'));return respondWithRpcPromise(_0x2b42('0x76'),_0x2b42('0x77'),_0x311c62);}return null;})[_0x2b42('0x1b')](function(_0x6d8f45){var _0x4def59=_0x2b42('0x66')+_0x6d8f45[_0x2b42('0x22')][_0x2b42('0x67')];return db[_0x2b42('0x68')][_0x2b42('0x3b')](_0x4def59,{'type':db['Sequelize'][_0x2b42('0x6a')][_0x2b42('0x78')],'raw':!![]})[_0x2b42('0x1b')](function(_0x252e6a){return _0x252e6a;});})[_0x2b42('0x1b')](function(_0x3d0a03){if(_0x3d0a03){_0x311c62['message'][_0x2b42('0x6b')]=_0x3d0a03[0x0];if(!_0x89d15c[_0x2b42('0x51')]['UserId'])return;return db[_0x2b42('0x79')][_0x2b42('0x4f')]({'where':{'id':_0x89d15c['body'][_0x2b42('0x5b')],'role':_0x2b42('0x6c')},'attributes':['id',_0x2b42('0x32'),'fullname',_0x2b42('0x7a'),_0x2b42('0x6e')],'raw':!![]});}return null;})['then'](function(_0x62662){if(!_0x62662)return null;_0x311c62['message'][_0x2b42('0x6c')]=_0x62662;return _0x311c62;})[_0x2b42('0x1b')](function(_0x5f1f47){if(_0x5f1f47){_0x5f1f47[_0x2b42('0x22')][_0x2b42('0x6f')]=util[_0x2b42('0x59')](_0x2b42('0x7b'),_0x89d15c['user'][_0x2b42('0x32')]);_0x5f1f47[_0x2b42('0x22')][_0x2b42('0x70')]=_0x311c62[_0x2b42('0x70')];_0x5f1f47[_0x2b42('0x22')][_0x2b42('0x7c')]=_0x311c62[_0x2b42('0x70')];_0x5f1f47['message']['event']=_0x2b42('0x2f');respondWithRpcPromise(_0x2b42('0x72'),_0x2b42('0x72'),{'event':'rejectmessage','message':_0x5f1f47[_0x2b42('0x22')]},client9002);return _0x311c62;}return null;})[_0x2b42('0x1b')](respondWithResult(_0x5ea692,null))[_0x2b42('0x24')](handleError(_0x5ea692,null));};exports['status']=function(_0x50c140,_0x371738,_0x4adfd5){if(_0x50c140['body']['id']){delete _0x50c140[_0x2b42('0x51')]['id'];}var _0x5c1099;return db['SmsMessage']['find']({'where':{'id':_0x50c140[_0x2b42('0x4d')]['id']}})[_0x2b42('0x1b')](handleEntityNotFound(_0x371738,null))[_0x2b42('0x1b')](function(_0x356842){if(_0x356842){_0x5c1099=_0x356842;return db[_0x2b42('0x7d')]['find']({'where':{'id':_0x356842[_0x2b42('0x7e')]}});}})[_0x2b42('0x1b')](handleEntityNotFound(_0x371738,null))[_0x2b42('0x1b')](function(_0x2cb857){if(_0x2cb857){logger[_0x2b42('0x7f')](_0x2b42('0x1f'),'status',_0x2b42('0x80'),_0x2cb857[_0x2b42('0x39')],util[_0x2b42('0x81')](_0x50c140[_0x2b42('0x51')],{'showHidden':![],'depth':null}));switch(_0x2cb857['type']){case _0x2b42('0x82'):if(_0x50c140[_0x2b42('0x51')][_0x2b42('0x83')]&&_0x50c140['body']['MessageSid']===_0x5c1099[_0x2b42('0x84')]){return _0x5c1099[_0x2b42('0x52')]({'read':!![]});}else{logger[_0x2b42('0x20')](_0x2b42('0x85'),_0x2b42('0x26'),_0x2b42('0x82'),util[_0x2b42('0x81')](_0x50c140[_0x2b42('0x51')],{'showHidden':![],'depth':null}));}break;case _0x2b42('0x86'):if(_0x50c140[_0x2b42('0x51')][_0x2b42('0x87')]&&_0x50c140['body']['MessageUUID']===_0x5c1099[_0x2b42('0x84')]&&_[_0x2b42('0x88')](['sent',_0x2b42('0x89')],_0x50c140[_0x2b42('0x51')][_0x2b42('0x8a')])>=0x0){return _0x5c1099[_0x2b42('0x52')]({'read':!![]});}else{logger[_0x2b42('0x20')](_0x2b42('0x85'),_0x2b42('0x26'),_0x2b42('0x8b'),util['inspect'](_0x50c140[_0x2b42('0x51')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4fd7af=_0x50c140[_0x2b42('0x51')][_0x2b42('0x8c')][0x0];if(_0x4fd7af[_0x2b42('0x26')]['groupName']===_0x2b42('0x8d')){return _0x5c1099['update']({'read':!![]});}else{logger['error'](_0x2b42('0x85'),'status','infobip',util[_0x2b42('0x81')](_0x50c140[_0x2b42('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x5c1099;}})[_0x2b42('0x1b')](respondWithResult(_0x371738,null))[_0x2b42('0x24')](handleError(_0x371738,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 55cfd65..717910b 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 _0x9302=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','save','update','remove'];(function(_0x33e482,_0x4b4dbf){var _0x5ac900=function(_0x4f9035){while(--_0x4f9035){_0x33e482['push'](_0x33e482['shift']());}};_0x5ac900(++_0x4b4dbf);}(_0x9302,0x108));var _0x2930=function(_0x5368e5,_0x4c59de){_0x5368e5=_0x5368e5-0x0;var _0x172879=_0x9302[_0x5368e5];return _0x172879;};'use strict';var EventEmitter=require(_0x2930('0x0'));var SmsMessage=require(_0x2930('0x1'))['db'][_0x2930('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2930('0x3'),'afterUpdate':_0x2930('0x4'),'afterDestroy':_0x2930('0x5')};function emitEvent(_0x298e95){return function(_0x3ff4fb,_0x1fdf43,_0x147c21){SmsMessageEvents[_0x2930('0x6')](_0x298e95+':'+_0x3ff4fb['id'],_0x3ff4fb);SmsMessageEvents['emit'](_0x298e95,_0x3ff4fb);_0x147c21(null);};}for(var e in events){if(events[_0x2930('0x7')](e)){var event=events[e];SmsMessage[_0x2930('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x83ce=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x1956f2,_0x52ce03){var _0x1e79cc=function(_0x2ad5ec){while(--_0x2ad5ec){_0x1956f2['push'](_0x1956f2['shift']());}};_0x1e79cc(++_0x52ce03);}(_0x83ce,0xec));var _0xe83c=function(_0x291998,_0x3791cb){_0x291998=_0x291998-0x0;var _0x101c24=_0x83ce[_0x291998];return _0x101c24;};'use strict';var EventEmitter=require(_0xe83c('0x0'));var SmsMessage=require(_0xe83c('0x1'))['db'][_0xe83c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe83c('0x3')](0x0);var events={'afterCreate':_0xe83c('0x4'),'afterUpdate':_0xe83c('0x5'),'afterDestroy':_0xe83c('0x6')};function emitEvent(_0x596294){return function(_0x5991ea,_0x251b39,_0x490a68){SmsMessageEvents[_0xe83c('0x7')](_0x596294+':'+_0x5991ea['id'],_0x5991ea);SmsMessageEvents[_0xe83c('0x7')](_0x596294,_0x5991ea);_0x490a68(null);};}for(var e in events){if(events[_0xe83c('0x8')](e)){var event=events[e];SmsMessage[_0xe83c('0x9')](e,emitEvent(event));}}module[_0xe83c('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index de37041..99e53dd 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 _0xaa96=['apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','/messages','bandwidth','intelepeer','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','sms','total_sent','read','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','deliveryReport','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','login','text','keys','sort','apiKey','createHash','md5','digest','hex','signature=','id_sms','csc','https://platform.clickatell.com/messages','uuid','UTF-8'];(function(_0x2df246,_0x1df74a){var _0x33081a=function(_0x5e9f70){while(--_0x5e9f70){_0x2df246['push'](_0x2df246['shift']());}};_0x33081a(++_0x1df74a);}(_0xaa96,0x101));var _0x6aa9=function(_0x20add8,_0x29e5f6){_0x20add8=_0x20add8-0x0;var _0x22655e=_0xaa96[_0x20add8];return _0x22655e;};'use strict';var _=require(_0x6aa9('0x0'));var util=require(_0x6aa9('0x1'));var logger=require(_0x6aa9('0x2'))(_0x6aa9('0x3'));var moment=require('moment');var BPromise=require(_0x6aa9('0x4'));var rp=require(_0x6aa9('0x5'));var fs=require('fs');var path=require(_0x6aa9('0x6'));var rimraf=require(_0x6aa9('0x7'));var config=require(_0x6aa9('0x8'));var attributes=require(_0x6aa9('0x9'));module[_0x6aa9('0xa')]=function(_0x5cde50,_0x106711){return _0x5cde50[_0x6aa9('0xb')]('SmsMessage',attributes,{'tableName':_0x6aa9('0xc'),'paranoid':![],'indexes':[{'name':_0x6aa9('0xd'),'fields':[_0x6aa9('0xd')]},{'name':_0x6aa9('0xe'),'fields':[_0x6aa9('0xf')],'type':_0x6aa9('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfef00,_0x338aa2,_0xdaaaa1){var _0x31bd75=_0x5cde50[_0x6aa9('0x11')];var _0x4345c7=_0xfef00[_0x6aa9('0x12')]({'plain':!![]});if(_0x4345c7[_0x6aa9('0x13')][_0x6aa9('0x14')]()==='in'||_0x4345c7[_0x6aa9('0x13')]['toLowerCase']()===_0x6aa9('0x15')&&!_0x4345c7[_0x6aa9('0x16')]&&!_[_0x6aa9('0x17')](_0x4345c7[_0x6aa9('0x18')])&&!_[_0x6aa9('0x17')](_0x4345c7[_0x6aa9('0x19')])){_0x31bd75[_0x6aa9('0x1a')][_0x6aa9('0x1b')]({'where':{'id':_0x4345c7[_0x6aa9('0x19')]}})['then'](function(_0x40895e){if(_0x40895e){_0x40895e['update']({'lastMsgAt':_0x4345c7[_0x6aa9('0x1c')],'lastMsgDirection':_0x4345c7[_0x6aa9('0x13')][_0x6aa9('0x14')]()});}})[_0x6aa9('0x1d')](function(_0x979e88){console[_0x6aa9('0x1e')](_0x979e88);});}if(_0x4345c7['direction']==='out'&&!_0x4345c7[_0x6aa9('0x16')]){var _0x42ebff;_0x31bd75[_0x6aa9('0x1f')][_0x6aa9('0x20')]({'where':{'id':_0x4345c7[_0x6aa9('0x21')]},'raw':!![]})[_0x6aa9('0x22')](function(_0x1da8b5){_0x42ebff=_0x1da8b5;if(_0x42ebff&&_0x42ebff[_0x6aa9('0x23')]){switch(_0x42ebff[_0x6aa9('0x23')]){case _0x6aa9('0x24'):var _0x355087=require(_0x6aa9('0x24'));if(_0x42ebff[_0x6aa9('0x25')]&&_0x42ebff[_0x6aa9('0x26')]&&_0x42ebff[_0x6aa9('0x27')]){var _0x4d6c12=new _0x355087(_0x42ebff['accountSid'],_0x42ebff['authToken']);_0x4d6c12[_0x6aa9('0x28')][_0x6aa9('0x29')]({'body':_0x4345c7['body'],'to':_0x4345c7[_0x6aa9('0x27')],'from':_0x42ebff[_0x6aa9('0x27')],'statusCallback':_0x42ebff[_0x6aa9('0x2a')]+_0x6aa9('0x2b')+_0x4345c7['id']+_0x6aa9('0x2c')+_0x42ebff[_0x6aa9('0x2d')]})['then'](function(_0x49bfe1){if(_0x49bfe1[_0x6aa9('0x2e')]){return _0xfef00[_0x6aa9('0x2f')]({'messageId':_0x49bfe1[_0x6aa9('0x2e')]});}})['catch'](function(_0x14ed75){logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x24'),util[_0x6aa9('0x32')](_0x14ed75,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x24'),_0x6aa9('0x33'));}break;case _0x6aa9('0x34'):var _0x5ab39e=_0x6aa9('0x35');if(_0x42ebff['username']&&_0x42ebff[_0x6aa9('0x36')]){var _0x46b2bc={'recipient':[_0x4345c7[_0x6aa9('0x27')]],'message':_0x4345c7[_0x6aa9('0xf')],'message_type':_0x42ebff[_0x6aa9('0x37')]};if(_0x42ebff[_0x6aa9('0x37')]&&_0x42ebff[_0x6aa9('0x37')]!=='SI'){_0x46b2bc[_0x6aa9('0x38')]=_0x42ebff['phone'];}var _0x2e81ac={'url':_0x5ab39e+_0x6aa9('0x39')+_0x42ebff[_0x6aa9('0x3a')]+_0x6aa9('0x3b')+_0x42ebff[_0x6aa9('0x36')],'method':_0x6aa9('0x3c')};rp(_0x2e81ac)['then'](function(_0x21ecc2){var _0x3e7211=_0x21ecc2['split'](';');var _0x17c8fe={'user_key':_0x3e7211[0x0],'session_key':_0x3e7211[0x1]};_0x2e81ac={'url':_0x5ab39e+_0x6aa9('0x3d'),'method':'POST','headers':{'user_key':_0x17c8fe['user_key'],'Session_key':_0x17c8fe['session_key']},'json':!![],'body':_0x46b2bc};return rp(_0x2e81ac);})[_0x6aa9('0x22')](function(_0x1b080b){if(_0x1b080b[_0x6aa9('0x3e')]>=0x1){var _0x2af48f={'messageId':_0x1b080b['internal_order_id']};if(_0x42ebff[_0x6aa9('0x37')]!=='GP'||!_0x42ebff['deliveryReport']){_0x2af48f[_0x6aa9('0x3f')]=!![];}return _0xfef00['update'](_0x2af48f);}else{return logger[_0x6aa9('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6aa9('0x34'),util['inspect'](_0x1b080b,{'showHidden':![],'depth':null}));}})[_0x6aa9('0x1d')](function(_0x4e5590){return logger['error'](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x34'),util[_0x6aa9('0x32')](_0x4e5590,{'showHidden':![],'depth':null}));});}else{logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x34'),_0x6aa9('0x40'));}break;case _0x6aa9('0x41'):if(_0x42ebff[_0x6aa9('0x26')]){var _0x342b88={'recipient':_0x4345c7[_0x6aa9('0x27')],'message':_0x4345c7[_0x6aa9('0xf')],'sender':_0x42ebff['senderString']||_0x42ebff[_0x6aa9('0x27')],'authorization':_0x42ebff[_0x6aa9('0x26')]};var _0x338aa2={'method':_0x6aa9('0x42'),'uri':_0x6aa9('0x43'),'body':_0x342b88,'json':!![]};rp(_0x338aa2)['then'](function(_0x57ecac){var _0x2d0067={'messageId':_0x57ecac['requestid']};if(!_0x42ebff[_0x6aa9('0x44')]){_0x2d0067[_0x6aa9('0x3f')]=!![];}return _0xfef00['update'](_0x2d0067);})['catch'](function(_0x5c8cf1){logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),'afterCreate','connectel',util[_0x6aa9('0x32')](_0x5c8cf1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6aa9('0x30'),_0x6aa9('0x31'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x42ebff[_0x6aa9('0x3a')]&&_0x42ebff[_0x6aa9('0x36')]){var _0x342b88={'messages':[{'source':_0x6aa9('0x45'),'to':_0x4345c7[_0x6aa9('0x27')],'body':_0x4345c7[_0x6aa9('0xf')],'from':_0x42ebff[_0x6aa9('0x46')]||_0x42ebff[_0x6aa9('0x27')]}]};var _0x24847d=util[_0x6aa9('0x47')](_0x6aa9('0x48'),_0x42ebff[_0x6aa9('0x3a')],_0x42ebff[_0x6aa9('0x36')]);var _0x338aa2={'method':_0x6aa9('0x42'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x342b88,'headers':{'Authorization':util['format'](_0x6aa9('0x49'),new Buffer(_0x24847d)[_0x6aa9('0x4a')](_0x6aa9('0x4b')))},'json':!![]};rp(_0x338aa2)['then'](function(_0x268b5c){if(_0x268b5c[_0x6aa9('0x4c')]>=0xc8&&_0x268b5c[_0x6aa9('0x4c')]<=0xce){if(_0x268b5c[_0x6aa9('0x4d')]&&_0x268b5c['data'][_0x6aa9('0x4e')]>0x0){var _0x56f94f=_['head'](_0x268b5c[_0x6aa9('0x4d')]['messages']);var _0x34e3ed={'messageId':_0x56f94f['message_id']};if(!_0x42ebff[_0x6aa9('0x44')]){_0x34e3ed[_0x6aa9('0x3f')]=!![];}return _0xfef00[_0x6aa9('0x2f')](_0x34e3ed);}else{logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x4f'),util['inspect'](_0x268b5c,{'showHidden':![],'depth':null}));}}else{logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),'clickSend',util['inspect'](_0x268b5c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x54437c){logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x4f'),util[_0x6aa9('0x32')](_0x54437c,{'showHidden':![],'depth':null}));});}else{logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),'clickSend',_0x6aa9('0x40'));}break;case _0x6aa9('0x50'):if(_0x42ebff[_0x6aa9('0x51')]&&_0x42ebff[_0x6aa9('0x26')]){var _0x342b88={'dst':_0x4345c7[_0x6aa9('0x27')],'text':_0x4345c7[_0x6aa9('0xf')],'src':_0x42ebff[_0x6aa9('0x46')]||_0x42ebff[_0x6aa9('0x27')],'url':_0x42ebff[_0x6aa9('0x2a')]+_0x6aa9('0x2b')+_0x4345c7['id']+_0x6aa9('0x2c')+_0x42ebff['token']};var _0x24847d=util[_0x6aa9('0x47')]('%s:%s',_0x42ebff[_0x6aa9('0x51')],_0x42ebff['authToken']);var _0x338aa2={'method':_0x6aa9('0x42'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x42ebff[_0x6aa9('0x51')]),'body':_0x342b88,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x24847d)[_0x6aa9('0x4a')](_0x6aa9('0x4b')))},'json':!![]};rp(_0x338aa2)[_0x6aa9('0x22')](function(_0x70d7d8){var _0x289a60={'messageId':_0x70d7d8[_0x6aa9('0x52')][0x0]};return _0xfef00[_0x6aa9('0x2f')](_0x289a60);})[_0x6aa9('0x1d')](function(_0x49cc1b){logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),'plivo',util[_0x6aa9('0x32')](_0x49cc1b,{'showHidden':![],'depth':null}));});}else{logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x50'),_0x6aa9('0x53'));}break;case _0x6aa9('0x54'):if(_0x42ebff[_0x6aa9('0x3a')]&&_0x42ebff[_0x6aa9('0x36')]){if(_0x42ebff[_0x6aa9('0x55')]){var _0x38d544={'method':_0x6aa9('0x42'),'uri':_0x42ebff[_0x6aa9('0x55')]+_0x6aa9('0x56'),'body':{'username':_0x42ebff[_0x6aa9('0x3a')],'password':_0x42ebff[_0x6aa9('0x36')]},'json':!![]};return rp(_0x38d544)[_0x6aa9('0x22')](function(_0x2d878f){var _0x48f48a={'method':'POST','uri':_0x42ebff['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x42ebff[_0x6aa9('0x27')],'destinations':[{'to':_0x4345c7['phone']}],'text':_0x4345c7[_0x6aa9('0xf')],'notifyUrl':_0x42ebff[_0x6aa9('0x2a')]+_0x6aa9('0x2b')+_0x4345c7['id']+_0x6aa9('0x2c')+_0x42ebff[_0x6aa9('0x2d')],'notifyContentType':_0x6aa9('0x57'),'callbackData':_0x42ebff[_0x6aa9('0x27')]+';'+_0x4345c7[_0x6aa9('0xf')]}]},'headers':{'Authorization':_0x6aa9('0x58')+_0x2d878f[_0x6aa9('0x2d')]},'json':!![]};return rp(_0x48f48a)['then'](function(_0x1c513a){if(_0x1c513a[_0x6aa9('0x28')]){var _0x3e8df9={'messageId':_0x1c513a[_0x6aa9('0x28')][0x0][_0x6aa9('0xd')]};if(!_0x42ebff[_0x6aa9('0x44')]){_0x3e8df9[_0x6aa9('0x3f')]=!![];}return _0xfef00['update'](_0x3e8df9);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6aa9('0x31'),_0x6aa9('0x54'),util[_0x6aa9('0x32')](_0x1c513a,{'showHidden':![],'depth':null}));}});})[_0x6aa9('0x1d')](function(_0x2c8af2){return logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),'afterCreate','infobip',util[_0x6aa9('0x32')](_0x2c8af2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6aa9('0x54'),_0x6aa9('0x59'));}}else{logger[_0x6aa9('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6aa9('0x31'),_0x6aa9('0x54'),_0x6aa9('0x40'));}break;case'csc':var _0x51c930=require(_0x6aa9('0x5a'));if(_0x42ebff['apiKey']){var _0x489d66={};_0x489d66[_0x6aa9('0x5b')]=_0x42ebff['username'];_0x489d66['phone']=_0x4345c7[_0x6aa9('0x27')];_0x489d66[_0x6aa9('0x38')]=_0x42ebff[_0x6aa9('0x27')];_0x489d66[_0x6aa9('0x5c')]=_0x4345c7[_0x6aa9('0xf')];_0x489d66['timestamp']=+new Date();var _0x40ec17='';var _0x219b75='';var _0xe539c4=Object[_0x6aa9('0x5d')](_0x489d66);_0xe539c4[_0x6aa9('0x5e')]();for(var _0xaeaef7=0x0;_0xaeaef7<_0xe539c4['length'];_0xaeaef7++){if(_0x40ec17!=''){_0x40ec17+='&';}_0x40ec17+=_0xe539c4[_0xaeaef7]+'='+encodeURIComponent(_0x489d66[_0xe539c4[_0xaeaef7]]);_0x219b75+=_0x489d66[_0xe539c4[_0xaeaef7]];}_0x219b75+=_0x42ebff[_0x6aa9('0x5f')];_0x219b75=_0x51c930[_0x6aa9('0x60')](_0x6aa9('0x61'))[_0x6aa9('0x2f')](_0x219b75)[_0x6aa9('0x62')](_0x6aa9('0x63'));if(_0x40ec17!==''){_0x40ec17+='&';}_0x40ec17+=_0x6aa9('0x64')+_0x219b75;var _0x2e81ac={'method':_0x6aa9('0x3c'),'uri':_0x42ebff[_0x6aa9('0x55')]+'/external/get/send.php?'+_0x40ec17,'json':!![]};return rp(_0x2e81ac)[_0x6aa9('0x22')](function(_0x44d574){var _0x3ca585=Object['keys'](_0x44d574);if(_0x44d574[_0x3ca585[0x0]][_0x6aa9('0x1e')]&&parseInt(_0x44d574[_0x3ca585[0x0]][_0x6aa9('0x1e')])===0x0){var _0x270b49={'messageId':_0x44d574[_0x3ca585[0x0]][_0x6aa9('0x65')]};if(!_0x42ebff[_0x6aa9('0x44')]){_0x270b49[_0x6aa9('0x3f')]=!![];}return _0xfef00[_0x6aa9('0x2f')](_0x270b49);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6aa9('0x31'),'csc',util[_0x6aa9('0x32')](_0x44d574[_0x6aa9('0x1e')],{'showHidden':![],'depth':null}));}})[_0x6aa9('0x1d')](function(_0x5e076b){return logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),'afterCreate',_0x6aa9('0x66'),util[_0x6aa9('0x32')](_0x5e076b,{'showHidden':![],'depth':null}));});}else{logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x66'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x42ebff[_0x6aa9('0x5f')]){var _0x45bc68={'method':_0x6aa9('0x42'),'uri':_0x6aa9('0x67'),'headers':{'Authorization':_0x42ebff[_0x6aa9('0x5f')]},'body':{'content':_0x4345c7['body'],'to':[_0x4345c7['phone']],'from':_0x42ebff[_0x6aa9('0x27')],'binary':![],'clientMessageId':_0x6aa9('0x68'),'charset':_0x6aa9('0x69')},'json':!![]};rp(_0x45bc68)[_0x6aa9('0x22')](function(_0x310013){if(!_0x310013[_0x6aa9('0x1e')]){var _0x7ed10f={'messageId':_0x310013[_0x6aa9('0x28')][0x0][_0x6aa9('0x6a')]};if(!_0x42ebff['deliveryReport']){_0x7ed10f['read']=!![];}return _0xfef00[_0x6aa9('0x2f')](_0x7ed10f);}else{return logger['error'](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x6b'),util['inspect'](_0x310013[_0x6aa9('0x1e')],{'showHidden':![],'depth':null}));}})[_0x6aa9('0x1d')](function(_0x4e2e45){return logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x6b'),util['inspect'](_0x4e2e45,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x6b'),_0x6aa9('0x6c'));}break;case'bandwidth':if(_0x42ebff[_0x6aa9('0x3a')]&&_0x42ebff[_0x6aa9('0x36')]){var _0x24847d=util[_0x6aa9('0x47')](_0x6aa9('0x48'),_0x42ebff['username'],_0x42ebff[_0x6aa9('0x36')]);var _0x338aa2={'method':_0x6aa9('0x42'),'uri':_0x6aa9('0x6d')+_0x42ebff['accountId']+_0x6aa9('0x6e'),'body':{'to':[_0x4345c7[_0x6aa9('0x27')]],'text':_0x4345c7[_0x6aa9('0xf')],'from':_0x42ebff[_0x6aa9('0x27')],'applicationId':_0x42ebff['applicationId']},'headers':{'Authorization':util[_0x6aa9('0x47')]('Basic\x20%s',new Buffer(_0x24847d)[_0x6aa9('0x4a')](_0x6aa9('0x4b')))},'json':!![]};rp(_0x338aa2)[_0x6aa9('0x22')](function(_0x431b69){if(_0x431b69['id']){var _0x520ee0={'messageId':_0x431b69['id']};return _0xfef00[_0x6aa9('0x2f')](_0x520ee0);}else{logger['error'](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x6f'),util[_0x6aa9('0x32')](_0x431b69,{'showHidden':![],'depth':null}));}})[_0x6aa9('0x1d')](function(_0x20e0b2){logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x6f'),util[_0x6aa9('0x32')](_0x20e0b2,{'showHidden':![],'depth':null}));});}else{logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x6f'),_0x6aa9('0x40'));}break;case _0x6aa9('0x70'):if(_0x42ebff[_0x6aa9('0x5f')]){var _0x26e631={};var _0x2e81ac={'method':_0x6aa9('0x42'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x6aa9('0x71')+_0x42ebff[_0x6aa9('0x5f')],'Content-Type':_0x6aa9('0x57')},'body':{'from':_0x42ebff[_0x6aa9('0x27')],'to':_0x4345c7[_0x6aa9('0x27')],'text':_0x4345c7[_0x6aa9('0xf')]},'json':!![]};return rp(_0x2e81ac)[_0x6aa9('0x22')](function(_0x588c08){if(_0x588c08['code']==0xca){_0x26e631[_0x6aa9('0x72')]=_0x588c08;var _0xd70473={'method':_0x6aa9('0x42'),'uri':_0x6aa9('0x73'),'headers':{'Authorization':_0x6aa9('0x71')+_0x42ebff[_0x6aa9('0x5f')],'Content-Type':_0x6aa9('0x57')},'body':{'refid':_0x26e631[_0x6aa9('0x72')]['refid']},'json':!![]};return rp(_0xd70473)['then'](function(_0x13c465){_0x26e631[_0x6aa9('0x74')]=_0x13c465;var _0x52bb83={'messageId':_0x26e631[_0x6aa9('0x72')][_0x6aa9('0x75')],'read':!![]};return _0xfef00[_0x6aa9('0x2f')](_0x52bb83);});}else{return logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),'intelepeer',util['inspect'](_0x588c08,{'showHidden':![],'depth':null}));}})[_0x6aa9('0x1d')](function(_0x57fea5){return logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),_0x6aa9('0x31'),_0x6aa9('0x70'),util['inspect'](_0x57fea5,{'showHidden':![],'depth':null}));});}else{return logger[_0x6aa9('0x1e')](_0x6aa9('0x30'),'afterCreate',_0x6aa9('0x70'),'Token\x20not\x20received');}break;}}})[_0x6aa9('0x76')](function(){_0xdaaaa1();});}else{_0xdaaaa1();}}},'charset':_0x6aa9('0x77'),'collate':_0x6aa9('0x78')});}; \ No newline at end of file +var _0x77db=['user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','senderString','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/api/sms/messages/','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','./smsMessage.attributes','exports','SmsMessage','messageId','fti_sms_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','password','GET','split','sms','POST'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x77db,0xc0));var _0xb77d=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x77db[_0x2cc594];return _0x4abff7;};'use strict';var _=require('lodash');var util=require(_0xb77d('0x0'));var logger=require(_0xb77d('0x1'))('api');var moment=require(_0xb77d('0x2'));var BPromise=require(_0xb77d('0x3'));var rp=require(_0xb77d('0x4'));var fs=require('fs');var path=require(_0xb77d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb77d('0x6'));module[_0xb77d('0x7')]=function(_0x645857,_0x6e37b4){return _0x645857['define'](_0xb77d('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xb77d('0x9'),'fields':['messageId']},{'name':_0xb77d('0xa'),'fields':[_0xb77d('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32b927,_0x59b128,_0x46c336){var _0x1cbbc4=_0x645857[_0xb77d('0xc')];var _0x3b6830=_0x32b927['get']({'plain':!![]});if(_0x3b6830[_0xb77d('0xd')][_0xb77d('0xe')]()==='in'||_0x3b6830['direction'][_0xb77d('0xe')]()===_0xb77d('0xf')&&!_0x3b6830[_0xb77d('0x10')]&&!_[_0xb77d('0x11')](_0x3b6830[_0xb77d('0x12')])&&!_[_0xb77d('0x11')](_0x3b6830[_0xb77d('0x13')])){_0x1cbbc4[_0xb77d('0x14')][_0xb77d('0x15')]({'where':{'id':_0x3b6830[_0xb77d('0x13')]}})[_0xb77d('0x16')](function(_0x3ba541){if(_0x3ba541){_0x3ba541[_0xb77d('0x17')]({'lastMsgAt':_0x3b6830[_0xb77d('0x18')],'lastMsgDirection':_0x3b6830[_0xb77d('0xd')][_0xb77d('0xe')]()});}})['catch'](function(_0x5ddfcf){console[_0xb77d('0x19')](_0x5ddfcf);});}if(_0x3b6830[_0xb77d('0xd')]===_0xb77d('0xf')&&!_0x3b6830[_0xb77d('0x10')]){var _0xafbb0f;_0x1cbbc4[_0xb77d('0x1a')][_0xb77d('0x1b')]({'where':{'id':_0x3b6830[_0xb77d('0x1c')]},'raw':!![]})[_0xb77d('0x16')](function(_0x348703){_0xafbb0f=_0x348703;if(_0xafbb0f&&_0xafbb0f[_0xb77d('0x1d')]){switch(_0xafbb0f['type']){case _0xb77d('0x1e'):var _0xf1ffcb=require('twilio');if(_0xafbb0f[_0xb77d('0x1f')]&&_0xafbb0f[_0xb77d('0x20')]&&_0xafbb0f[_0xb77d('0x21')]){var _0x3c7398=new _0xf1ffcb(_0xafbb0f[_0xb77d('0x1f')],_0xafbb0f[_0xb77d('0x20')]);_0x3c7398[_0xb77d('0x22')][_0xb77d('0x23')]({'body':_0x3b6830[_0xb77d('0xb')],'to':_0x3b6830['phone'],'from':_0xafbb0f[_0xb77d('0x21')],'statusCallback':_0xafbb0f[_0xb77d('0x24')]+'/api/sms/messages/'+_0x3b6830['id']+_0xb77d('0x25')+_0xafbb0f[_0xb77d('0x26')]})['then'](function(_0x22286f){if(_0x22286f[_0xb77d('0x27')]){return _0x32b927['update']({'messageId':_0x22286f[_0xb77d('0x27')]});}})[_0xb77d('0x28')](function(_0x5ca7bb){logger[_0xb77d('0x19')](_0xb77d('0x29'),'afterCreate',_0xb77d('0x1e'),util['inspect'](_0x5ca7bb,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x1e'),_0xb77d('0x2b'));}break;case _0xb77d('0x2c'):var _0x51c273='https://api.skebby.it/API/v1.0/REST/';if(_0xafbb0f[_0xb77d('0x2d')]&&_0xafbb0f['password']){var _0x5862d4={'recipient':[_0x3b6830[_0xb77d('0x21')]],'message':_0x3b6830[_0xb77d('0xb')],'message_type':_0xafbb0f[_0xb77d('0x2e')]};if(_0xafbb0f['smsMethod']&&_0xafbb0f[_0xb77d('0x2e')]!=='SI'){_0x5862d4[_0xb77d('0x2f')]=_0xafbb0f['phone'];}var _0x5067f5={'url':_0x51c273+_0xb77d('0x30')+_0xafbb0f['username']+'&password='+_0xafbb0f[_0xb77d('0x31')],'method':_0xb77d('0x32')};rp(_0x5067f5)[_0xb77d('0x16')](function(_0xaa0c1c){var _0x55ad1e=_0xaa0c1c[_0xb77d('0x33')](';');var _0x7e6759={'user_key':_0x55ad1e[0x0],'session_key':_0x55ad1e[0x1]};_0x5067f5={'url':_0x51c273+_0xb77d('0x34'),'method':_0xb77d('0x35'),'headers':{'user_key':_0x7e6759[_0xb77d('0x36')],'Session_key':_0x7e6759[_0xb77d('0x37')]},'json':!![],'body':_0x5862d4};return rp(_0x5067f5);})[_0xb77d('0x16')](function(_0x375d69){if(_0x375d69[_0xb77d('0x38')]>=0x1){var _0x51157b={'messageId':_0x375d69[_0xb77d('0x39')]};if(_0xafbb0f[_0xb77d('0x2e')]!=='GP'||!_0xafbb0f[_0xb77d('0x3a')]){_0x51157b[_0xb77d('0x3b')]=!![];}return _0x32b927[_0xb77d('0x17')](_0x51157b);}else{return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),'skebby',util[_0xb77d('0x3c')](_0x375d69,{'showHidden':![],'depth':null}));}})[_0xb77d('0x28')](function(_0x250cd4){return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x2c'),util[_0xb77d('0x3c')](_0x250cd4,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x2c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xb77d('0x3d'):if(_0xafbb0f[_0xb77d('0x20')]){var _0x2a4876={'recipient':_0x3b6830[_0xb77d('0x21')],'message':_0x3b6830['body'],'sender':_0xafbb0f['senderString']||_0xafbb0f[_0xb77d('0x21')],'authorization':_0xafbb0f[_0xb77d('0x20')]};var _0x59b128={'method':'POST','uri':_0xb77d('0x3e'),'body':_0x2a4876,'json':!![]};rp(_0x59b128)[_0xb77d('0x16')](function(_0x3e2a7c){var _0x2b7020={'messageId':_0x3e2a7c[_0xb77d('0x3f')]};if(!_0xafbb0f['deliveryReport']){_0x2b7020[_0xb77d('0x3b')]=!![];}return _0x32b927[_0xb77d('0x17')](_0x2b7020);})[_0xb77d('0x28')](function(_0x15ee32){logger['error'](_0xb77d('0x29'),_0xb77d('0x2a'),'connectel',util[_0xb77d('0x3c')](_0x15ee32,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb77d('0x2a'),'connectel',_0xb77d('0x40'));}break;case _0xb77d('0x41'):if(_0xafbb0f[_0xb77d('0x2d')]&&_0xafbb0f[_0xb77d('0x31')]){var _0x2a4876={'messages':[{'source':_0xb77d('0x42'),'to':_0x3b6830[_0xb77d('0x21')],'body':_0x3b6830[_0xb77d('0xb')],'from':_0xafbb0f['senderString']||_0xafbb0f[_0xb77d('0x21')]}]};var _0xd92838=util[_0xb77d('0x43')]('%s:%s',_0xafbb0f[_0xb77d('0x2d')],_0xafbb0f[_0xb77d('0x31')]);var _0x59b128={'method':_0xb77d('0x35'),'uri':_0xb77d('0x44'),'body':_0x2a4876,'headers':{'Authorization':util[_0xb77d('0x43')](_0xb77d('0x45'),new Buffer(_0xd92838)['toString'](_0xb77d('0x46')))},'json':!![]};rp(_0x59b128)[_0xb77d('0x16')](function(_0x370bac){if(_0x370bac['http_code']>=0xc8&&_0x370bac['http_code']<=0xce){if(_0x370bac['data']&&_0x370bac[_0xb77d('0x47')]['queued_count']>0x0){var _0x30a2fb=_[_0xb77d('0x48')](_0x370bac[_0xb77d('0x47')]['messages']);var _0x170948={'messageId':_0x30a2fb[_0xb77d('0x49')]};if(!_0xafbb0f[_0xb77d('0x3a')]){_0x170948[_0xb77d('0x3b')]=!![];}return _0x32b927[_0xb77d('0x17')](_0x170948);}else{logger['error'](_0xb77d('0x29'),_0xb77d('0x2a'),'clickSend',util[_0xb77d('0x3c')](_0x370bac,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x4a'),util[_0xb77d('0x3c')](_0x370bac,{'showHidden':![],'depth':null}));}})[_0xb77d('0x28')](function(_0x3462f5){logger[_0xb77d('0x19')](_0xb77d('0x29'),'afterCreate',_0xb77d('0x4a'),util[_0xb77d('0x3c')](_0x3462f5,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x4a'),_0xb77d('0x4b'));}break;case _0xb77d('0x4c'):if(_0xafbb0f[_0xb77d('0x4d')]&&_0xafbb0f['authToken']){var _0x2a4876={'dst':_0x3b6830['phone'],'text':_0x3b6830[_0xb77d('0xb')],'src':_0xafbb0f[_0xb77d('0x4e')]||_0xafbb0f[_0xb77d('0x21')],'url':_0xafbb0f[_0xb77d('0x24')]+'/api/sms/messages/'+_0x3b6830['id']+_0xb77d('0x25')+_0xafbb0f['token']};var _0xd92838=util['format'](_0xb77d('0x4f'),_0xafbb0f[_0xb77d('0x4d')],_0xafbb0f[_0xb77d('0x20')]);var _0x59b128={'method':_0xb77d('0x35'),'uri':util[_0xb77d('0x43')](_0xb77d('0x50'),_0xafbb0f[_0xb77d('0x4d')]),'body':_0x2a4876,'headers':{'Authorization':util['format'](_0xb77d('0x45'),new Buffer(_0xd92838)[_0xb77d('0x51')](_0xb77d('0x46')))},'json':!![]};rp(_0x59b128)['then'](function(_0x5e053f){var _0x578e0a={'messageId':_0x5e053f[_0xb77d('0x52')][0x0]};return _0x32b927[_0xb77d('0x17')](_0x578e0a);})[_0xb77d('0x28')](function(_0x29b843){logger[_0xb77d('0x19')](_0xb77d('0x29'),'afterCreate',_0xb77d('0x4c'),util['inspect'](_0x29b843,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),'plivo',_0xb77d('0x53'));}break;case _0xb77d('0x54'):if(_0xafbb0f[_0xb77d('0x2d')]&&_0xafbb0f[_0xb77d('0x31')]){if(_0xafbb0f[_0xb77d('0x55')]){var _0x3c7a38={'method':_0xb77d('0x35'),'uri':_0xafbb0f['baseUrl']+_0xb77d('0x56'),'body':{'username':_0xafbb0f[_0xb77d('0x2d')],'password':_0xafbb0f[_0xb77d('0x31')]},'json':!![]};return rp(_0x3c7a38)[_0xb77d('0x16')](function(_0x4632d2){var _0x2b7ba2={'method':_0xb77d('0x35'),'uri':_0xafbb0f[_0xb77d('0x55')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0xafbb0f[_0xb77d('0x21')],'destinations':[{'to':_0x3b6830[_0xb77d('0x21')]}],'text':_0x3b6830[_0xb77d('0xb')],'notifyUrl':_0xafbb0f[_0xb77d('0x24')]+_0xb77d('0x57')+_0x3b6830['id']+_0xb77d('0x25')+_0xafbb0f['token'],'notifyContentType':_0xb77d('0x58'),'callbackData':_0xafbb0f[_0xb77d('0x21')]+';'+_0x3b6830['body']}]},'headers':{'Authorization':_0xb77d('0x59')+_0x4632d2['token']},'json':!![]};return rp(_0x2b7ba2)[_0xb77d('0x16')](function(_0x2b5bbd){if(_0x2b5bbd[_0xb77d('0x22')]){var _0x527d14={'messageId':_0x2b5bbd['messages'][0x0]['messageId']};if(!_0xafbb0f[_0xb77d('0x3a')]){_0x527d14[_0xb77d('0x3b')]=!![];}return _0x32b927[_0xb77d('0x17')](_0x527d14);}else{return logger[_0xb77d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb77d('0x2a'),_0xb77d('0x54'),util[_0xb77d('0x3c')](_0x2b5bbd,{'showHidden':![],'depth':null}));}});})[_0xb77d('0x28')](function(_0xb96797){return logger['error'](_0xb77d('0x29'),'afterCreate',_0xb77d('0x54'),util[_0xb77d('0x3c')](_0xb96797,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),'afterCreate',_0xb77d('0x54'),_0xb77d('0x5a'));}}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x54'),_0xb77d('0x4b'));}break;case _0xb77d('0x5b'):var _0x152302=require('crypto');if(_0xafbb0f[_0xb77d('0x5c')]){var _0x2efed0={};_0x2efed0['login']=_0xafbb0f[_0xb77d('0x2d')];_0x2efed0['phone']=_0x3b6830[_0xb77d('0x21')];_0x2efed0['sender']=_0xafbb0f['phone'];_0x2efed0[_0xb77d('0x5d')]=_0x3b6830[_0xb77d('0xb')];_0x2efed0[_0xb77d('0x5e')]=+new Date();var _0x5ca6ca='';var _0x1c353e='';var _0x2ee1e2=Object[_0xb77d('0x5f')](_0x2efed0);_0x2ee1e2[_0xb77d('0x60')]();for(var _0x44e1a1=0x0;_0x44e1a1<_0x2ee1e2[_0xb77d('0x61')];_0x44e1a1++){if(_0x5ca6ca!=''){_0x5ca6ca+='&';}_0x5ca6ca+=_0x2ee1e2[_0x44e1a1]+'='+encodeURIComponent(_0x2efed0[_0x2ee1e2[_0x44e1a1]]);_0x1c353e+=_0x2efed0[_0x2ee1e2[_0x44e1a1]];}_0x1c353e+=_0xafbb0f[_0xb77d('0x5c')];_0x1c353e=_0x152302[_0xb77d('0x62')](_0xb77d('0x63'))[_0xb77d('0x17')](_0x1c353e)[_0xb77d('0x64')](_0xb77d('0x65'));if(_0x5ca6ca!==''){_0x5ca6ca+='&';}_0x5ca6ca+=_0xb77d('0x66')+_0x1c353e;var _0x5067f5={'method':_0xb77d('0x32'),'uri':_0xafbb0f[_0xb77d('0x55')]+_0xb77d('0x67')+_0x5ca6ca,'json':!![]};return rp(_0x5067f5)['then'](function(_0xe63bad){var _0x2c3921=Object[_0xb77d('0x5f')](_0xe63bad);if(_0xe63bad[_0x2c3921[0x0]][_0xb77d('0x19')]&&parseInt(_0xe63bad[_0x2c3921[0x0]][_0xb77d('0x19')])===0x0){var _0x480ef9={'messageId':_0xe63bad[_0x2c3921[0x0]][_0xb77d('0x68')]};if(!_0xafbb0f[_0xb77d('0x3a')]){_0x480ef9[_0xb77d('0x3b')]=!![];}return _0x32b927[_0xb77d('0x17')](_0x480ef9);}else{return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x5b'),util['inspect'](_0xe63bad[_0xb77d('0x19')],{'showHidden':![],'depth':null}));}})[_0xb77d('0x28')](function(_0x1bcde4){return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x5b'),util['inspect'](_0x1bcde4,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x5b'),_0xb77d('0x69'));}break;case _0xb77d('0x6a'):if(_0xafbb0f[_0xb77d('0x5c')]){var _0x8c6167={'method':_0xb77d('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xafbb0f[_0xb77d('0x5c')]},'body':{'content':_0x3b6830[_0xb77d('0xb')],'to':[_0x3b6830[_0xb77d('0x21')]],'from':_0xafbb0f['phone'],'binary':![],'clientMessageId':_0xb77d('0x6b'),'charset':_0xb77d('0x6c')},'json':!![]};rp(_0x8c6167)[_0xb77d('0x16')](function(_0x37e398){if(!_0x37e398[_0xb77d('0x19')]){var _0x38a342={'messageId':_0x37e398['messages'][0x0]['apiMessageId']};if(!_0xafbb0f[_0xb77d('0x3a')]){_0x38a342['read']=!![];}return _0x32b927['update'](_0x38a342);}else{return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x6a'),util[_0xb77d('0x3c')](_0x37e398[_0xb77d('0x19')],{'showHidden':![],'depth':null}));}})[_0xb77d('0x28')](function(_0x3b5aed){return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),'clickatell',util[_0xb77d('0x3c')](_0x3b5aed,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),'afterCreate',_0xb77d('0x6a'),_0xb77d('0x69'));}break;case _0xb77d('0x6d'):if(_0xafbb0f['username']&&_0xafbb0f[_0xb77d('0x31')]){var _0xd92838=util[_0xb77d('0x43')](_0xb77d('0x4f'),_0xafbb0f['username'],_0xafbb0f['password']);var _0x59b128={'method':'POST','uri':_0xb77d('0x6e')+_0xafbb0f[_0xb77d('0x6f')]+'/messages','body':{'to':[_0x3b6830[_0xb77d('0x21')]],'text':_0x3b6830['body'],'from':_0xafbb0f[_0xb77d('0x21')],'applicationId':_0xafbb0f[_0xb77d('0x70')]},'headers':{'Authorization':util['format'](_0xb77d('0x45'),new Buffer(_0xd92838)[_0xb77d('0x51')]('base64'))},'json':!![]};rp(_0x59b128)[_0xb77d('0x16')](function(_0x4f95ac){if(_0x4f95ac['id']){var _0x2fddeb={'messageId':_0x4f95ac['id']};return _0x32b927[_0xb77d('0x17')](_0x2fddeb);}else{logger['error'](_0xb77d('0x29'),_0xb77d('0x2a'),'bandwidth',util[_0xb77d('0x3c')](_0x4f95ac,{'showHidden':![],'depth':null}));}})[_0xb77d('0x28')](function(_0x4f8d87){logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x6d'),util[_0xb77d('0x3c')](_0x4f8d87,{'showHidden':![],'depth':null}));});}else{logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0xafbb0f[_0xb77d('0x5c')]){var _0xa3a8ad={};var _0x5067f5={'method':_0xb77d('0x35'),'uri':_0xb77d('0x71'),'headers':{'Authorization':_0xb77d('0x72')+_0xafbb0f['apiKey'],'Content-Type':_0xb77d('0x58')},'body':{'from':_0xafbb0f[_0xb77d('0x21')],'to':_0x3b6830[_0xb77d('0x21')],'text':_0x3b6830[_0xb77d('0xb')]},'json':!![]};return rp(_0x5067f5)[_0xb77d('0x16')](function(_0x5bf145){if(_0x5bf145['code']==0xca){_0xa3a8ad[_0xb77d('0x73')]=_0x5bf145;var _0x227287={'method':_0xb77d('0x35'),'uri':_0xb77d('0x74'),'headers':{'Authorization':'Bearer\x20'+_0xafbb0f['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0xa3a8ad[_0xb77d('0x73')][_0xb77d('0x75')]},'json':!![]};return rp(_0x227287)[_0xb77d('0x16')](function(_0x53a6bb){_0xa3a8ad[_0xb77d('0x76')]=_0x53a6bb;var _0x54d91b={'messageId':_0xa3a8ad[_0xb77d('0x73')][_0xb77d('0x75')],'read':!![]};return _0x32b927['update'](_0x54d91b);});}else{return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x77'),util[_0xb77d('0x3c')](_0x5bf145,{'showHidden':![],'depth':null}));}})[_0xb77d('0x28')](function(_0x575e68){return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x77'),util[_0xb77d('0x3c')](_0x575e68,{'showHidden':![],'depth':null}));});}else{return logger[_0xb77d('0x19')](_0xb77d('0x29'),_0xb77d('0x2a'),_0xb77d('0x77'),'Token\x20not\x20received');}break;}}})[_0xb77d('0x78')](function(){_0x46c336();});}else{_0x46c336();}}},'charset':_0xb77d('0x79'),'collate':_0xb77d('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4a51169..b5d0cfc 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 _0x6473=['./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x6473,0xd0));var _0x3647=function(_0x96b7cb,_0x457d8d){_0x96b7cb=_0x96b7cb-0x0;var _0x481745=_0x6473[_0x96b7cb];return _0x481745;};'use strict';var _=require(_0x3647('0x0'));var util=require(_0x3647('0x1'));var moment=require(_0x3647('0x2'));var BPromise=require(_0x3647('0x3'));var rs=require(_0x3647('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3647('0x5'));var logger=require(_0x3647('0x6'))(_0x3647('0x7'));var config=require(_0x3647('0x8'));var jayson=require(_0x3647('0x9'));var client=jayson[_0x3647('0xa')][_0x3647('0xb')]({'port':0x232a});config['redis']=_[_0x3647('0xc')](config['redis'],{'host':_0x3647('0xd'),'port':0x18eb});var socket=require(_0x3647('0xe'))(new Redis(config[_0x3647('0xf')]));require(_0x3647('0x10'))[_0x3647('0x11')](socket);function respondWithRpcPromise(_0x95936e,_0x5884df,_0x545675){return new BPromise(function(_0x1833af,_0x279a6a){return client['request'](_0x95936e,_0x545675)[_0x3647('0x12')](function(_0x216fc5){logger['info'](_0x3647('0x13'),_0x5884df,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5884df,_0x3647('0x14'),JSON[_0x3647('0x15')](_0x216fc5));if(_0x216fc5[_0x3647('0x16')]){if(_0x216fc5[_0x3647('0x16')]['code']===0x1f4){logger[_0x3647('0x16')](_0x3647('0x13'),_0x5884df,_0x216fc5[_0x3647('0x16')][_0x3647('0x17')]);return _0x279a6a(_0x216fc5[_0x3647('0x16')][_0x3647('0x17')]);}logger[_0x3647('0x16')](_0x3647('0x13'),_0x5884df,_0x216fc5[_0x3647('0x16')][_0x3647('0x17')]);return _0x1833af(_0x216fc5[_0x3647('0x16')]['message']);}else{logger['info'](_0x3647('0x13'),_0x5884df,_0x3647('0x14'));_0x1833af(_0x216fc5[_0x3647('0x18')][_0x3647('0x17')]);}})[_0x3647('0x19')](function(_0x444423){logger[_0x3647('0x16')](_0x3647('0x13'),_0x5884df,_0x444423);_0x279a6a(_0x444423);});});}exports[_0x3647('0x1a')]=function(_0x29f8fb){var _0x50f55d=this;return new Promise(function(_0x4b3b26,_0x4f85d8){return db[_0x3647('0x1b')][_0x3647('0x1c')](_0x29f8fb[_0x3647('0x1d')],{'raw':_0x29f8fb[_0x3647('0x1e')]?_0x29f8fb[_0x3647('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x3647('0x12')](function(_0x4440ad){logger[_0x3647('0x1f')](_0x3647('0x1a'),_0x29f8fb);logger['debug']('CreateSmsMessage',_0x29f8fb,JSON['stringify'](_0x4440ad));_0x4b3b26(_0x4440ad);})[_0x3647('0x19')](function(_0x519c0f){logger[_0x3647('0x16')](_0x3647('0x1a'),_0x519c0f[_0x3647('0x17')],_0x29f8fb);_0x4f85d8(_0x50f55d['error'](0x1f4,_0x519c0f[_0x3647('0x17')]));});});}; \ No newline at end of file +var _0xf2d3=['body','options','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xf2d3,0x1ec));var _0x3f2d=function(_0xa6cbd0,_0x5949d9){_0xa6cbd0=_0xa6cbd0-0x0;var _0x2173db=_0xf2d3[_0xa6cbd0];return _0x2173db;};'use strict';var _=require(_0x3f2d('0x0'));var util=require(_0x3f2d('0x1'));var moment=require(_0x3f2d('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f2d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f2d('0x4'))['db'];var utils=require(_0x3f2d('0x5'));var logger=require(_0x3f2d('0x6'))(_0x3f2d('0x7'));var config=require(_0x3f2d('0x8'));var jayson=require(_0x3f2d('0x9'));var client=jayson[_0x3f2d('0xa')][_0x3f2d('0xb')]({'port':0x232a});config[_0x3f2d('0xc')]=_[_0x3f2d('0xd')](config['redis'],{'host':_0x3f2d('0xe'),'port':0x18eb});var socket=require(_0x3f2d('0xf'))(new Redis(config[_0x3f2d('0xc')]));require(_0x3f2d('0x10'))[_0x3f2d('0x11')](socket);function respondWithRpcPromise(_0x1827b7,_0x463a3f,_0x1726b4){return new BPromise(function(_0x2d1682,_0x5907f4){return client[_0x3f2d('0x12')](_0x1827b7,_0x1726b4)[_0x3f2d('0x13')](function(_0x4d04f3){logger[_0x3f2d('0x14')](_0x3f2d('0x15'),_0x463a3f,_0x3f2d('0x16'));logger[_0x3f2d('0x17')](_0x3f2d('0x18'),_0x463a3f,_0x3f2d('0x16'),JSON[_0x3f2d('0x19')](_0x4d04f3));if(_0x4d04f3[_0x3f2d('0x1a')]){if(_0x4d04f3[_0x3f2d('0x1a')][_0x3f2d('0x1b')]===0x1f4){logger['error'](_0x3f2d('0x15'),_0x463a3f,_0x4d04f3['error'][_0x3f2d('0x1c')]);return _0x5907f4(_0x4d04f3[_0x3f2d('0x1a')][_0x3f2d('0x1c')]);}logger[_0x3f2d('0x1a')](_0x3f2d('0x15'),_0x463a3f,_0x4d04f3[_0x3f2d('0x1a')][_0x3f2d('0x1c')]);return _0x2d1682(_0x4d04f3['error'][_0x3f2d('0x1c')]);}else{logger['info'](_0x3f2d('0x15'),_0x463a3f,'request\x20sent');_0x2d1682(_0x4d04f3[_0x3f2d('0x1d')][_0x3f2d('0x1c')]);}})['catch'](function(_0x336490){logger[_0x3f2d('0x1a')]('SmsMessage,\x20%s,\x20%s',_0x463a3f,_0x336490);_0x5907f4(_0x336490);});});}exports[_0x3f2d('0x1e')]=function(_0x356040){var _0x2bd084=this;return new Promise(function(_0x31538a,_0x204f7e){return db[_0x3f2d('0x1f')][_0x3f2d('0x20')](_0x356040[_0x3f2d('0x21')],{'raw':_0x356040[_0x3f2d('0x22')]?_0x356040[_0x3f2d('0x22')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x8fa114){logger[_0x3f2d('0x14')](_0x3f2d('0x1e'),_0x356040);logger[_0x3f2d('0x17')](_0x3f2d('0x1e'),_0x356040,JSON[_0x3f2d('0x19')](_0x8fa114));_0x31538a(_0x8fa114);})['catch'](function(_0x20061a){logger['error']('CreateSmsMessage',_0x20061a[_0x3f2d('0x1c')],_0x356040);_0x204f7e(_0x2bd084[_0x3f2d('0x1a')](0x1f4,_0x20061a[_0x3f2d('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7cdc5ed..b09730f 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 _0x29d2=['length','smsMessage:','./smsMessage.events','save','update','register'];(function(_0x4fac82,_0x4545ce){var _0x4648b6=function(_0x69729a){while(--_0x69729a){_0x4fac82['push'](_0x4fac82['shift']());}};_0x4648b6(++_0x4545ce);}(_0x29d2,0x80));var _0x229d=function(_0x2d7f58,_0x4d5c28){_0x2d7f58=_0x2d7f58-0x0;var _0x174c16=_0x29d2[_0x2d7f58];return _0x174c16;};'use strict';var SmsMessageEvents=require(_0x229d('0x0'));var events=[_0x229d('0x1'),'remove',_0x229d('0x2')];function createListener(_0x510aa5,_0x337438){return function(_0xe4fe87){_0x337438['emit'](_0x510aa5,_0xe4fe87);};}function removeListener(_0xf836b9,_0x2282c9){return function(){SmsMessageEvents['removeListener'](_0xf836b9,_0x2282c9);};}exports[_0x229d('0x3')]=function(_0x1b426a){for(var _0x640a83=0x0,_0x306ef5=events[_0x229d('0x4')];_0x640a83<_0x306ef5;_0x640a83++){var _0x5dc30e=events[_0x640a83];var _0x566954=createListener(_0x229d('0x5')+_0x5dc30e,_0x1b426a);SmsMessageEvents['on'](_0x5dc30e,_0x566954);}}; \ No newline at end of file +var _0xe493=['save','remove','update','emit','length','smsMessage:','./smsMessage.events'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xe493,0x19c));var _0x3e49=function(_0x13c64d,_0x62ee2d){_0x13c64d=_0x13c64d-0x0;var _0xadc94=_0xe493[_0x13c64d];return _0xadc94;};'use strict';var SmsMessageEvents=require(_0x3e49('0x0'));var events=[_0x3e49('0x1'),_0x3e49('0x2'),_0x3e49('0x3')];function createListener(_0x17e702,_0x3beb85){return function(_0x3d36b5){_0x3beb85[_0x3e49('0x4')](_0x17e702,_0x3d36b5);};}function removeListener(_0x112774,_0x4361f8){return function(){SmsMessageEvents['removeListener'](_0x112774,_0x4361f8);};}exports['register']=function(_0x244727){for(var _0x2e2b2f=0x0,_0x3fe7b8=events[_0x3e49('0x5')];_0x2e2b2f<_0x3fe7b8;_0x2e2b2f++){var _0x3cb8df=events[_0x2e2b2f];var _0x353be7=createListener(_0x3e49('0x6')+_0x3cb8df,_0x244727);SmsMessageEvents['on'](_0x3cb8df,_0x353be7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0dca7be..6077e35 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 _0xaecf=['index','describe','show','/:id/members','post','addTeams','/:id/users','addAgents','put','/:id','update','/:id/teams','removeTeams','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x26fb65,_0x2a4e62){var _0x1e9960=function(_0x4715fa){while(--_0x4715fa){_0x26fb65['push'](_0x26fb65['shift']());}};_0x1e9960(++_0x2a4e62);}(_0xaecf,0x9f));var _0xfaec=function(_0xc19dc2,_0x179ff0){_0xc19dc2=_0xc19dc2-0x0;var _0x122a46=_0xaecf[_0xc19dc2];return _0x122a46;};'use strict';var multer=require(_0xfaec('0x0'));var util=require(_0xfaec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfaec('0x2'));var router=express[_0xfaec('0x3')]();var fs_extra=require(_0xfaec('0x4'));var auth=require(_0xfaec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfaec('0x6'));var controller=require('./smsQueue.controller');router[_0xfaec('0x7')]('/',auth[_0xfaec('0x8')](),controller[_0xfaec('0x9')]);router['get']('/describe',auth[_0xfaec('0x8')](),controller[_0xfaec('0xa')]);router[_0xfaec('0x7')]('/:id',auth[_0xfaec('0x8')](),controller[_0xfaec('0xb')]);router['get'](_0xfaec('0xc'),auth[_0xfaec('0x8')](),controller['getMembers']);router[_0xfaec('0x7')]('/:id/teams',auth[_0xfaec('0x8')](),controller['getTeams']);router[_0xfaec('0x7')]('/:id/users',auth[_0xfaec('0x8')](),controller['getAgents']);router[_0xfaec('0xd')]('/',auth[_0xfaec('0x8')](),controller['create']);router[_0xfaec('0xd')]('/:id/teams',auth[_0xfaec('0x8')](),controller[_0xfaec('0xe')]);router['post'](_0xfaec('0xf'),auth[_0xfaec('0x8')](),controller[_0xfaec('0x10')]);router[_0xfaec('0x11')](_0xfaec('0x12'),auth[_0xfaec('0x8')](),controller[_0xfaec('0x13')]);router['delete'](_0xfaec('0x12'),auth[_0xfaec('0x8')](),controller['destroy']);router['delete'](_0xfaec('0x14'),auth[_0xfaec('0x8')](),controller[_0xfaec('0x15')]);router[_0xfaec('0x16')](_0xfaec('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfaec('0x17')]=router; \ No newline at end of file +var _0xba00=['show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','/describe','/:id'];(function(_0x6bad64,_0x2c07ed){var _0x324cb7=function(_0x529c0c){while(--_0x529c0c){_0x6bad64['push'](_0x6bad64['shift']());}};_0x324cb7(++_0x2c07ed);}(_0xba00,0xbd));var _0x0ba0=function(_0x19ef5c,_0x565a91){_0x19ef5c=_0x19ef5c-0x0;var _0x2b01aa=_0xba00[_0x19ef5c];return _0x2b01aa;};'use strict';var multer=require(_0x0ba0('0x0'));var util=require(_0x0ba0('0x1'));var path=require(_0x0ba0('0x2'));var timeout=require(_0x0ba0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0ba0('0x4'));var interaction=require(_0x0ba0('0x5'));var config=require('../../config/environment');var controller=require(_0x0ba0('0x6'));router[_0x0ba0('0x7')]('/',auth[_0x0ba0('0x8')](),controller['index']);router[_0x0ba0('0x7')](_0x0ba0('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x0ba0('0x7')](_0x0ba0('0xa'),auth['isAuthenticated'](),controller[_0x0ba0('0xb')]);router[_0x0ba0('0x7')]('/:id/members',auth[_0x0ba0('0x8')](),controller[_0x0ba0('0xc')]);router['get'](_0x0ba0('0xd'),auth[_0x0ba0('0x8')](),controller[_0x0ba0('0xe')]);router[_0x0ba0('0x7')](_0x0ba0('0xf'),auth[_0x0ba0('0x8')](),controller[_0x0ba0('0x10')]);router[_0x0ba0('0x11')]('/',auth[_0x0ba0('0x8')](),controller['create']);router[_0x0ba0('0x11')](_0x0ba0('0xd'),auth[_0x0ba0('0x8')](),controller[_0x0ba0('0x12')]);router['post']('/:id/users',auth[_0x0ba0('0x8')](),controller[_0x0ba0('0x13')]);router['put'](_0x0ba0('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x0ba0('0x14')](_0x0ba0('0xa'),auth[_0x0ba0('0x8')](),controller[_0x0ba0('0x15')]);router[_0x0ba0('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0ba0('0x16')]);router[_0x0ba0('0x14')](_0x0ba0('0xf'),auth[_0x0ba0('0x8')](),controller[_0x0ba0('0x17')]);module[_0x0ba0('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 3a43ad5..58e82f5 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 _0xa19f=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa19f,0x1d2));var _0xfa19=function(_0x3f3811,_0x28b0c7){_0x3f3811=_0x3f3811-0x0;var _0x1cf977=_0xa19f[_0x3f3811];return _0x1cf977;};'use strict';var Sequelize=require(_0xfa19('0x0'));module[_0xfa19('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfa19('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfa19('0x3')]},'timeout':{'type':Sequelize[_0xfa19('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfa19('0x5'),_0xfa19('0x6'),_0xfa19('0x7'))}}; \ No newline at end of file +var _0xb152=['name','INTEGER','ENUM','beepall','roundrobin','STRING'];(function(_0x2b6357,_0x1d1ce2){var _0x5634bc=function(_0x4bc139){while(--_0x4bc139){_0x2b6357['push'](_0x2b6357['shift']());}};_0x5634bc(++_0x1d1ce2);}(_0xb152,0x161));var _0x2b15=function(_0xadf212,_0x53c4d8){_0xadf212=_0xadf212-0x0;var _0x40433f=_0xb152[_0xadf212];return _0x40433f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2b15('0x0')],'unique':_0x2b15('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2b15('0x0')]},'timeout':{'type':Sequelize[_0x2b15('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2b15('0x3')]('rrmemory',_0x2b15('0x4'),_0x2b15('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index beafe22..caf5cd9 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 _0xc8fc=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','SmsQueues','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','options','create','body','user','role','UserProfileSection','userProfileId','find','describe','findOne','UserSmsQueue','filters','SmsQueueId','findAndCountAll','UserId','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','findAll','User','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','emit','userSmsQueue:save','removeTeams','ids','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2e8822,_0x24b72b){var _0xa21a50=function(_0x54efe3){while(--_0x54efe3){_0x2e8822['push'](_0x2e8822['shift']());}};_0xa21a50(++_0x24b72b);}(_0xc8fc,0x118));var _0xcc8f=function(_0x3e8d78,_0xef4524){_0x3e8d78=_0x3e8d78-0x0;var _0x50532d=_0xc8fc[_0x3e8d78];return _0x50532d;};'use strict';var emlformat=require(_0xcc8f('0x0'));var rimraf=require(_0xcc8f('0x1'));var zipdir=require(_0xcc8f('0x2'));var jsonpatch=require(_0xcc8f('0x3'));var rp=require('request-promise');var moment=require(_0xcc8f('0x4'));var BPromise=require(_0xcc8f('0x5'));var Mustache=require(_0xcc8f('0x6'));var util=require(_0xcc8f('0x7'));var path=require(_0xcc8f('0x8'));var sox=require(_0xcc8f('0x9'));var csv=require(_0xcc8f('0xa'));var ejs=require(_0xcc8f('0xb'));var fs=require('fs');var fs_extra=require(_0xcc8f('0xc'));var _=require(_0xcc8f('0xd'));var squel=require(_0xcc8f('0xe'));var crypto=require(_0xcc8f('0xf'));var jsforce=require(_0xcc8f('0x10'));var deskjs=require(_0xcc8f('0x11'));var toCsv=require(_0xcc8f('0xa'));var querystring=require(_0xcc8f('0x12'));var Papa=require(_0xcc8f('0x13'));var Redis=require('ioredis');var authService=require(_0xcc8f('0x14'));var qs=require(_0xcc8f('0x15'));var as=require(_0xcc8f('0x16'));var hardwareService=require(_0xcc8f('0x17'));var logger=require(_0xcc8f('0x18'))(_0xcc8f('0x19'));var utils=require(_0xcc8f('0x1a'));var config=require(_0xcc8f('0x1b'));var licenseUtil=require(_0xcc8f('0x1c'));var db=require('../../mysqldb')['db'];config[_0xcc8f('0x1d')]=_[_0xcc8f('0x1e')](config['redis'],{'host':_0xcc8f('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc8f('0x1d')]));require(_0xcc8f('0x20'))['register'](socket);function respondWithStatusCode(_0x1c78c1,_0x1087fa){_0x1087fa=_0x1087fa||0xcc;return function(_0x1808c1){if(_0x1808c1){return _0x1c78c1[_0xcc8f('0x21')](_0x1087fa);}return _0x1c78c1['status'](_0x1087fa)[_0xcc8f('0x22')]();};}function respondWithResult(_0x5a0023,_0x3ac3cc){_0x3ac3cc=_0x3ac3cc||0xc8;return function(_0x1990a0){if(_0x1990a0){return _0x5a0023[_0xcc8f('0x23')](_0x3ac3cc)[_0xcc8f('0x24')](_0x1990a0);}};}function respondWithFilteredResult(_0x44d547,_0x395800){return function(_0x2f30c9){if(_0x2f30c9){var _0x143f47=typeof _0x395800[_0xcc8f('0x25')]===_0xcc8f('0x26')&&typeof _0x395800[_0xcc8f('0x27')]===_0xcc8f('0x26');var _0x56b930=_0x2f30c9[_0xcc8f('0x28')];var _0x406d5a=_0x143f47?0x0:_0x395800[_0xcc8f('0x25')];var _0xa6a15f=_0x143f47?_0x2f30c9[_0xcc8f('0x28')]:_0x395800[_0xcc8f('0x25')]+_0x395800['limit'];var _0x21576f;if(_0xa6a15f>=_0x56b930){_0xa6a15f=_0x56b930;_0x21576f=0xc8;}else{_0x21576f=0xce;}_0x44d547['status'](_0x21576f);return _0x44d547[_0xcc8f('0x29')](_0xcc8f('0x2a'),_0x406d5a+'-'+_0xa6a15f+'/'+_0x56b930)[_0xcc8f('0x24')](_0x2f30c9);}return null;};}function patchUpdates(_0x32edef){return function(_0x2e9e1f){try{jsonpatch['apply'](_0x2e9e1f,_0x32edef,!![]);}catch(_0x22b0b9){return BPromise[_0xcc8f('0x2b')](_0x22b0b9);}return _0x2e9e1f[_0xcc8f('0x2c')]();};}function saveUpdates(_0x98a915,_0x4bde7d){return function(_0x333f23){if(_0x333f23){return _0x333f23[_0xcc8f('0x2d')](_0x98a915)[_0xcc8f('0x2e')](function(_0xf090b6){return _0xf090b6;});}return null;};}function removeEntity(_0x3875ae,_0x2b5739){return function(_0x575187){if(_0x575187){return _0x575187['destroy']()['then'](function(){var _0x100dcf=_0x575187[_0xcc8f('0x2f')]({'plain':!![]});var _0xaa4d2b=_0xcc8f('0x30');return db['UserProfileResource'][_0xcc8f('0x31')]({'where':{'type':_0xaa4d2b,'resourceId':_0x100dcf['id']}})[_0xcc8f('0x2e')](function(){return _0x575187;});})['then'](function(){_0x3875ae[_0xcc8f('0x23')](0xcc)[_0xcc8f('0x22')]();});}};}function handleEntityNotFound(_0x60b08,_0x5e3939){return function(_0x57e2e7){if(!_0x57e2e7){_0x60b08[_0xcc8f('0x21')](0x194);}return _0x57e2e7;};}function handleError(_0x4e6674,_0x4bd057){_0x4bd057=_0x4bd057||0x1f4;return function(_0x3f21d1){logger[_0xcc8f('0x32')](_0x3f21d1[_0xcc8f('0x33')]);if(_0x3f21d1[_0xcc8f('0x34')]){delete _0x3f21d1[_0xcc8f('0x34')];}_0x4e6674['status'](_0x4bd057)[_0xcc8f('0x35')](_0x3f21d1);};}exports[_0xcc8f('0x36')]=function(_0x26b1fc,_0x3c6da2){var _0x44f222={},_0x4e7b68={},_0x21bc0f={'count':0x0,'rows':[]};var _0x580cb4=_[_0xcc8f('0x37')](db[_0xcc8f('0x38')][_0xcc8f('0x39')],function(_0x47d3f4){return{'name':_0x47d3f4[_0xcc8f('0x3a')],'type':_0x47d3f4[_0xcc8f('0x3b')][_0xcc8f('0x3c')]};});_0x4e7b68['model']=_[_0xcc8f('0x37')](_0x580cb4,_0xcc8f('0x34'));_0x4e7b68[_0xcc8f('0x3d')]=_[_0xcc8f('0x3e')](_0x26b1fc[_0xcc8f('0x3d')]);_0x4e7b68['filters']=_[_0xcc8f('0x3f')](_0x4e7b68[_0xcc8f('0x40')],_0x4e7b68[_0xcc8f('0x3d')]);_0x44f222[_0xcc8f('0x41')]=_['intersection'](_0x4e7b68[_0xcc8f('0x40')],qs['fields'](_0x26b1fc[_0xcc8f('0x3d')][_0xcc8f('0x42')]));_0x44f222[_0xcc8f('0x41')]=_0x44f222[_0xcc8f('0x41')][_0xcc8f('0x43')]?_0x44f222[_0xcc8f('0x41')]:_0x4e7b68[_0xcc8f('0x40')];if(!_0x26b1fc['query'][_0xcc8f('0x44')](_0xcc8f('0x45'))){_0x44f222['limit']=qs[_0xcc8f('0x27')](_0x26b1fc[_0xcc8f('0x3d')][_0xcc8f('0x27')]);_0x44f222[_0xcc8f('0x25')]=qs[_0xcc8f('0x25')](_0x26b1fc[_0xcc8f('0x3d')][_0xcc8f('0x25')]);}_0x44f222[_0xcc8f('0x46')]=qs[_0xcc8f('0x47')](_0x26b1fc[_0xcc8f('0x3d')]['sort']);_0x44f222[_0xcc8f('0x48')]=qs['filters'](_[_0xcc8f('0x49')](_0x26b1fc[_0xcc8f('0x3d')],_0x4e7b68['filters']),_0x580cb4);if(_0x26b1fc['query'][_0xcc8f('0x4a')]){_0x44f222[_0xcc8f('0x48')]=_[_0xcc8f('0x4b')](_0x44f222[_0xcc8f('0x48')],{'$or':_[_0xcc8f('0x37')](_0x580cb4,function(_0x2b0126){if(_0x2b0126[_0xcc8f('0x3b')]!==_0xcc8f('0x4c')){var _0x464046={};_0x464046[_0x2b0126[_0xcc8f('0x34')]]={'$like':'%'+_0x26b1fc[_0xcc8f('0x3d')][_0xcc8f('0x4a')]+'%'};return _0x464046;}})});}_0x44f222=_[_0xcc8f('0x4b')]({},_0x44f222,_0x26b1fc['options']);var _0x2b0dfe={'where':_0x44f222[_0xcc8f('0x48')]};return db[_0xcc8f('0x38')]['count'](_0x2b0dfe)[_0xcc8f('0x2e')](function(_0x25ba73){_0x21bc0f[_0xcc8f('0x28')]=_0x25ba73;if(_0x26b1fc[_0xcc8f('0x3d')][_0xcc8f('0x4d')]){_0x44f222[_0xcc8f('0x4e')]=[{'all':!![]}];}return db[_0xcc8f('0x38')]['findAll'](_0x44f222);})[_0xcc8f('0x2e')](function(_0x2f2201){_0x21bc0f[_0xcc8f('0x4f')]=_0x2f2201;return _0x21bc0f;})[_0xcc8f('0x2e')](respondWithFilteredResult(_0x3c6da2,_0x44f222))[_0xcc8f('0x50')](handleError(_0x3c6da2,null));};exports['show']=function(_0x3743d7,_0x28b642){var _0x57e9a3={'raw':!![],'where':{'id':_0x3743d7[_0xcc8f('0x51')]['id']}},_0x45bf27={};_0x45bf27[_0xcc8f('0x40')]=_[_0xcc8f('0x3e')](db[_0xcc8f('0x38')][_0xcc8f('0x39')]);_0x45bf27[_0xcc8f('0x3d')]=_[_0xcc8f('0x3e')](_0x3743d7['query']);_0x45bf27['filters']=_['intersection'](_0x45bf27[_0xcc8f('0x40')],_0x45bf27[_0xcc8f('0x3d')]);_0x57e9a3['attributes']=_[_0xcc8f('0x3f')](_0x45bf27[_0xcc8f('0x40')],qs[_0xcc8f('0x42')](_0x3743d7['query'][_0xcc8f('0x42')]));_0x57e9a3[_0xcc8f('0x41')]=_0x57e9a3['attributes'][_0xcc8f('0x43')]?_0x57e9a3[_0xcc8f('0x41')]:_0x45bf27[_0xcc8f('0x40')];if(_0x3743d7[_0xcc8f('0x3d')]['includeAll']){_0x57e9a3[_0xcc8f('0x4e')]=[{'all':!![]}];}_0x57e9a3=_['merge']({},_0x57e9a3,_0x3743d7[_0xcc8f('0x52')]);return db[_0xcc8f('0x38')]['find'](_0x57e9a3)[_0xcc8f('0x2e')](handleEntityNotFound(_0x28b642,null))[_0xcc8f('0x2e')](respondWithResult(_0x28b642,null))[_0xcc8f('0x50')](handleError(_0x28b642,null));};exports[_0xcc8f('0x53')]=function(_0x172fab,_0x3a44fd){return db[_0xcc8f('0x38')]['create'](_0x172fab[_0xcc8f('0x54')],{})['then'](function(_0x163b77){var _0x1d9687=_0x172fab[_0xcc8f('0x55')][_0xcc8f('0x2f')]({'plain':!![]});if(!_0x1d9687)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d9687[_0xcc8f('0x56')]===_0xcc8f('0x55')){var _0x3ee2ff=_0x163b77[_0xcc8f('0x2f')]({'plain':!![]});var _0x38698e=_0xcc8f('0x30');return db[_0xcc8f('0x57')]['find']({'where':{'name':_0x38698e,'userProfileId':_0x1d9687[_0xcc8f('0x58')]},'raw':!![]})['then'](function(_0x1cf852){if(_0x1cf852&&_0x1cf852['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ee2ff[_0xcc8f('0x34')],'resourceId':_0x3ee2ff['id'],'type':_0x1cf852[_0xcc8f('0x34')],'sectionId':_0x1cf852['id']},{})[_0xcc8f('0x2e')](function(){return _0x163b77;});}else{return _0x163b77;}})['catch'](function(_0x42c0da){logger[_0xcc8f('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42c0da);throw _0x42c0da;});}return _0x163b77;})[_0xcc8f('0x2e')](respondWithResult(_0x3a44fd,0xc9))[_0xcc8f('0x50')](handleError(_0x3a44fd,null));};exports[_0xcc8f('0x2d')]=function(_0x6a10d3,_0x3f9168){if(_0x6a10d3[_0xcc8f('0x54')]['id']){delete _0x6a10d3['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x6a10d3[_0xcc8f('0x51')]['id']}})[_0xcc8f('0x2e')](handleEntityNotFound(_0x3f9168,null))[_0xcc8f('0x2e')](saveUpdates(_0x6a10d3[_0xcc8f('0x54')],null))[_0xcc8f('0x2e')](respondWithResult(_0x3f9168,null))['catch'](handleError(_0x3f9168,null));};exports['destroy']=function(_0x35872c,_0x4177bc){return db['SmsQueue'][_0xcc8f('0x59')]({'where':{'id':_0x35872c['params']['id']}})[_0xcc8f('0x2e')](handleEntityNotFound(_0x4177bc,null))['then'](removeEntity(_0x4177bc,null))[_0xcc8f('0x50')](handleError(_0x4177bc,null));};exports[_0xcc8f('0x5a')]=function(_0x1bbf8a,_0x3e8204){return db['SmsQueue'][_0xcc8f('0x5a')]()[_0xcc8f('0x2e')](respondWithResult(_0x3e8204,null))[_0xcc8f('0x50')](handleError(_0x3e8204,null));};exports['getMembers']=function(_0x55dd32,_0x5bf99b,_0x44b24f){var _0x3ab08c={'raw':!![],'where':{}},_0x3090e7={},_0x1b21b0;return db['SmsQueue'][_0xcc8f('0x5b')]({'where':{'id':_0x55dd32[_0xcc8f('0x51')]['id']}})[_0xcc8f('0x2e')](handleEntityNotFound(_0x5bf99b,null))[_0xcc8f('0x2e')](function(_0x5f1c75){if(_0x5f1c75){_0x1b21b0=_0x5f1c75[_0xcc8f('0x2f')]({'plain':!![]});_0x3090e7[_0xcc8f('0x40')]=_[_0xcc8f('0x3e')](db[_0xcc8f('0x5c')]['rawAttributes']);_0x3090e7['query']=_[_0xcc8f('0x3e')](_0x55dd32[_0xcc8f('0x3d')]);_0x3090e7[_0xcc8f('0x5d')]=_['intersection'](_0x3090e7['model'],_0x3090e7[_0xcc8f('0x3d')]);_0x3ab08c['attributes']=_[_0xcc8f('0x3f')](_0x3090e7[_0xcc8f('0x40')],qs[_0xcc8f('0x42')](_0x55dd32['query'][_0xcc8f('0x42')]));_0x3ab08c['attributes']=_0x3ab08c[_0xcc8f('0x41')][_0xcc8f('0x43')]?_0x3ab08c[_0xcc8f('0x41')]:_0x3090e7[_0xcc8f('0x40')];if(!_0x55dd32[_0xcc8f('0x3d')][_0xcc8f('0x44')](_0xcc8f('0x45'))){_0x3ab08c[_0xcc8f('0x27')]=qs['limit'](_0x55dd32[_0xcc8f('0x3d')][_0xcc8f('0x27')]);_0x3ab08c[_0xcc8f('0x25')]=qs['offset'](_0x55dd32[_0xcc8f('0x3d')][_0xcc8f('0x25')]);}_0x3ab08c['order']=qs['sort'](_0x55dd32[_0xcc8f('0x3d')][_0xcc8f('0x47')]);_0x3ab08c[_0xcc8f('0x48')]=qs['filters'](_[_0xcc8f('0x49')](_0x55dd32['query'],_0x3090e7[_0xcc8f('0x5d')]));_0x3ab08c['where'][_0xcc8f('0x5e')]=_0x5f1c75['id'];if(_0x55dd32[_0xcc8f('0x3d')][_0xcc8f('0x4a')]){_0x3ab08c['where']=_['merge'](_0x3ab08c[_0xcc8f('0x48')],{'$or':_[_0xcc8f('0x37')](_0x3ab08c[_0xcc8f('0x41')],function(_0x2522ae){var _0x1b56a7={};_0x1b56a7[_0x2522ae]={'$like':'%'+_0x55dd32[_0xcc8f('0x3d')][_0xcc8f('0x4a')]+'%'};return _0x1b56a7;})});}_0x3ab08c=_[_0xcc8f('0x4b')]({},_0x3ab08c,_0x55dd32[_0xcc8f('0x52')]);return db[_0xcc8f('0x5c')]['findAll'](_0x3ab08c);}})[_0xcc8f('0x2e')](function(_0x5457b2){if(_0x5457b2){return db['User'][_0xcc8f('0x5f')]({'where':{'id':_[_0xcc8f('0x37')](_0x5457b2,_0xcc8f('0x60')),'role':_0xcc8f('0x61')},'attributes':['id',_0xcc8f('0x34'),_0xcc8f('0x62'),'updatedAt',_0xcc8f('0x63')]});}})['then'](function(_0x5ecda4){if(_0x5ecda4){return{'count':_0x5ecda4['count'],'rows':_['map'](_0x5ecda4['rows'],function(_0x94e62f){return{'membername':_0x94e62f[_0xcc8f('0x34')],'UserId':_0x94e62f['id'],'queue_name':_0x1b21b0['name'],'SmsQueueId':_0x1b21b0['id'],'interface':util[_0xcc8f('0x64')](_0xcc8f('0x65'),_0xcc8f('0x66'),_0x94e62f[_0xcc8f('0x34')]),'penalty':0x0,'paused':_0x94e62f[_0xcc8f('0x62')],'createdAt':_0x94e62f[_0xcc8f('0x63')],'updatedAt':_0x94e62f[_0xcc8f('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5bf99b,_0x3ab08c))[_0xcc8f('0x50')](handleError(_0x5bf99b,null));};exports[_0xcc8f('0x68')]=function(_0x18d4be,_0x1e0cd9,_0x11b693){var _0x5439dd={};var _0x27522b={};var _0x4e5750;var _0x2c46bb;return db['SmsQueue']['findOne']({'where':{'id':_0x18d4be[_0xcc8f('0x51')]['id']}})[_0xcc8f('0x2e')](handleEntityNotFound(_0x1e0cd9,null))['then'](function(_0x306705){if(_0x306705){_0x4e5750=_0x306705;_0x27522b[_0xcc8f('0x40')]=_[_0xcc8f('0x3e')](db[_0xcc8f('0x69')][_0xcc8f('0x39')]);_0x27522b[_0xcc8f('0x3d')]=_['keys'](_0x18d4be[_0xcc8f('0x3d')]);_0x27522b[_0xcc8f('0x5d')]=_[_0xcc8f('0x3f')](_0x27522b[_0xcc8f('0x40')],_0x27522b['query']);_0x5439dd[_0xcc8f('0x41')]=_[_0xcc8f('0x3f')](_0x27522b[_0xcc8f('0x40')],qs[_0xcc8f('0x42')](_0x18d4be[_0xcc8f('0x3d')][_0xcc8f('0x42')]));_0x5439dd['attributes']=_0x5439dd[_0xcc8f('0x41')]['length']?_0x5439dd[_0xcc8f('0x41')]:_0x27522b[_0xcc8f('0x40')];_0x5439dd[_0xcc8f('0x46')]=qs[_0xcc8f('0x47')](_0x18d4be[_0xcc8f('0x3d')][_0xcc8f('0x47')]);_0x5439dd['where']=qs[_0xcc8f('0x5d')](_['pick'](_0x18d4be[_0xcc8f('0x3d')],_0x27522b[_0xcc8f('0x5d')]));if(_0x18d4be[_0xcc8f('0x3d')][_0xcc8f('0x4a')]){_0x5439dd['where']=_['merge'](_0x5439dd['where'],{'$or':_[_0xcc8f('0x37')](_0x5439dd[_0xcc8f('0x41')],function(_0x403f48){var _0x40d757={};_0x40d757[_0x403f48]={'$like':'%'+_0x18d4be[_0xcc8f('0x3d')][_0xcc8f('0x4a')]+'%'};return _0x40d757;})});}_0x5439dd=_['merge']({},_0x5439dd,_0x18d4be['options']);return _0x4e5750[_0xcc8f('0x68')](_0x5439dd);}})[_0xcc8f('0x2e')](function(_0x5ba8d8){if(_0x5ba8d8){_0x2c46bb=_0x5ba8d8[_0xcc8f('0x43')];if(!_0x18d4be['query']['hasOwnProperty']('nolimit')){_0x5439dd['limit']=qs[_0xcc8f('0x27')](_0x18d4be[_0xcc8f('0x3d')]['limit']);_0x5439dd[_0xcc8f('0x25')]=qs['offset'](_0x18d4be[_0xcc8f('0x3d')]['offset']);}return _0x4e5750[_0xcc8f('0x68')](_0x5439dd);}})[_0xcc8f('0x2e')](function(_0x3c38d5){if(_0x3c38d5){return _0x3c38d5?{'count':_0x2c46bb,'rows':_0x3c38d5}:null;}})[_0xcc8f('0x2e')](respondWithResult(_0x1e0cd9,null))[_0xcc8f('0x50')](handleError(_0x1e0cd9,null));};exports['addTeams']=function(_0x4aaa51,_0x300af7,_0x1571a8){var _0x59efd5=_0x4aaa51[_0xcc8f('0x54')]['ids'];return db[_0xcc8f('0x69')][_0xcc8f('0x6a')]({'where':{'id':_0x59efd5},'attributes':['id'],'include':[{'model':db[_0xcc8f('0x6b')],'as':_0xcc8f('0x6c'),'attributes':['id','name',_0xcc8f('0x6d'),'voicePause',_0xcc8f('0x6e')],'raw':!![]}]})[_0xcc8f('0x2e')](function(_0x3cbbdc){if(_0x3cbbdc){var _0x15672c=_[_0xcc8f('0x6f')](_0x3cbbdc,function(_0x1af412){var _0xfc5d28=_0x1af412['get']({'plain':!![]});return _0xfc5d28[_0xcc8f('0x6c')];});return db[_0xcc8f('0x38')][_0xcc8f('0x59')]({'where':{'id':_0x4aaa51[_0xcc8f('0x51')]['id']}})[_0xcc8f('0x2e')](function(_0x43303d){return db[_0xcc8f('0x70')][_0xcc8f('0x71')](function(_0x39f22c){return _0x43303d[_0xcc8f('0x72')](_0x59efd5,{'transaction':_0x39f22c})[_0xcc8f('0x2e')](function(){return BPromise[_0xcc8f('0x73')](_0x15672c,function(_0x5b1f19){return db[_0xcc8f('0x5c')]['findOrCreate']({'where':{'UserId':_0x5b1f19['id'],'SmsQueueId':_0x4aaa51[_0xcc8f('0x51')]['id']},'transaction':_0x39f22c});});})['then'](function(){_0x15672c['forEach'](function(_0x2a955b){socket[_0xcc8f('0x74')](_0xcc8f('0x75'),{'UserId':_0x2a955b['id'],'SmsQueueId':_0x43303d['id']});});});});});}})['then'](respondWithStatusCode(_0x300af7,null))[_0xcc8f('0x50')](handleError(_0x300af7,null));};exports[_0xcc8f('0x76')]=function(_0x417acd,_0x45e3ee,_0x584d24){return db[_0xcc8f('0x69')]['findAll']({'where':{'id':_0x417acd[_0xcc8f('0x3d')][_0xcc8f('0x77')]},'attributes':['id'],'include':[{'model':db[_0xcc8f('0x6b')],'as':_0xcc8f('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xcc8f('0x2e')](handleEntityNotFound(_0x45e3ee,null))['then'](function(_0x40a5e4){var _0x221ee2=_['map'](_0x40a5e4,'id');var _0x1a50db=[];var _0x17791e=[];var _0xdc22d7=squel['select']();_0xdc22d7['field'](_0xcc8f('0x78'))[_0xcc8f('0x79')](_0xcc8f('0x7a'),'tq')[_0xcc8f('0x7b')](_0xcc8f('0x7c'),'ut',_0xcc8f('0x7d'))[_0xcc8f('0x48')](_0xcc8f('0x7e'),_0x417acd['params']['id']);for(var _0xc07b4b=0x0;_0xc07b4b<_0x40a5e4[_0xcc8f('0x43')];_0xc07b4b+=0x1){let _0x4132a2=_0x40a5e4[_0xc07b4b];for(var _0x18ffc2=0x0;_0x18ffc2<_0x4132a2[_0xcc8f('0x6c')][_0xcc8f('0x43')];_0x18ffc2+=0x1){let _0x58d43b=_0x4132a2[_0xcc8f('0x6c')][_0x18ffc2];var _0x12cb7d=_0xdc22d7[_0xcc8f('0x7f')]();_0x12cb7d[_0xcc8f('0x48')](_0xcc8f('0x80'),_0x58d43b['id']);_0x17791e[_0xcc8f('0x81')](db[_0xcc8f('0x70')]['query'](_0x12cb7d[_0xcc8f('0x82')](),{'type':db[_0xcc8f('0x70')][_0xcc8f('0x83')][_0xcc8f('0x84')]})[_0xcc8f('0x2e')](function(_0x258937){if(_0x258937['length']===0x1){return _0x58d43b['id'];}else{var _0x4a551e=_['every'](_[_0xcc8f('0x37')](_0x258937,_0xcc8f('0x85')),function(_0x3c8584){return _[_0xcc8f('0x86')](_0x221ee2,_0x3c8584);});if(_0x4a551e){return _0x58d43b['id'];}}}));}}return BPromise[_0xcc8f('0x87')](_0x17791e)[_0xcc8f('0x2e')](function(_0x2d54df){_0x1a50db=_(_0x1a50db)['union'](_0x2d54df)['compact']()[_0xcc8f('0x88')]();return db[_0xcc8f('0x38')][_0xcc8f('0x59')]({'where':{'id':_0x417acd[_0xcc8f('0x51')]['id']}})[_0xcc8f('0x2e')](function(_0x56ef3e){return db[_0xcc8f('0x70')][_0xcc8f('0x71')](function(_0x11f2a6){return _0x56ef3e['removeTeams'](_0x417acd[_0xcc8f('0x3d')]['ids'],{'transaction':_0x11f2a6})['then'](function(){if(!_[_0xcc8f('0x89')](_0x1a50db)){return _0x56ef3e[_0xcc8f('0x8a')](_0x1a50db,{'transaction':_0x11f2a6});}})[_0xcc8f('0x2e')](function(){_0x1a50db['forEach'](function(_0x351f54){socket[_0xcc8f('0x74')](_0xcc8f('0x8b'),{'UserId':_0x351f54,'SmsQueueId':_0x56ef3e['id']});});});});});});})[_0xcc8f('0x2e')](respondWithStatusCode(_0x45e3ee,null))[_0xcc8f('0x50')](handleError(_0x45e3ee,null));};exports[_0xcc8f('0x8c')]=function(_0x26afce,_0x17ee47,_0x3f27f5){return db[_0xcc8f('0x38')][_0xcc8f('0x59')]({'where':{'id':_0x26afce['params']['id']}})[_0xcc8f('0x2e')](handleEntityNotFound(_0x17ee47,null))[_0xcc8f('0x2e')](function(_0x5c3a6e){if(_0x5c3a6e){return _0x5c3a6e[_0xcc8f('0x8c')](_0x26afce[_0xcc8f('0x54')][_0xcc8f('0x77')],_['omit'](_0x26afce[_0xcc8f('0x54')],[_0xcc8f('0x77'),'id'])||{})['spread'](function(_0x581c38){for(var _0x2704d4=0x0;_0x2704d4<_0x26afce[_0xcc8f('0x54')][_0xcc8f('0x77')][_0xcc8f('0x43')];_0x2704d4+=0x1){socket[_0xcc8f('0x74')]('userSmsQueue:save',{'UserId':Number(_0x26afce[_0xcc8f('0x54')]['ids'][_0x2704d4]),'SmsQueueId':Number(_0x26afce[_0xcc8f('0x51')]['id'])});}return _0x581c38;});}})['then'](respondWithResult(_0x17ee47,null))[_0xcc8f('0x50')](handleError(_0x17ee47,null));};exports['removeAgents']=function(_0x2cb5dc,_0x10d28b,_0x5648d1){return db[_0xcc8f('0x38')]['find']({'where':{'id':_0x2cb5dc[_0xcc8f('0x51')]['id']}})[_0xcc8f('0x2e')](handleEntityNotFound(_0x10d28b,null))[_0xcc8f('0x2e')](function(_0x3b4c12){if(_0x3b4c12){return _0x3b4c12[_0xcc8f('0x8a')](_0x2cb5dc[_0xcc8f('0x3d')][_0xcc8f('0x77')])['then'](function(){if(_[_0xcc8f('0x8d')](_0x2cb5dc[_0xcc8f('0x3d')][_0xcc8f('0x77')])){for(var _0x1bdcbb=0x0;_0x1bdcbb<_0x2cb5dc[_0xcc8f('0x3d')][_0xcc8f('0x77')][_0xcc8f('0x43')];_0x1bdcbb+=0x1){socket[_0xcc8f('0x74')]('userSmsQueue:remove',{'UserId':Number(_0x2cb5dc[_0xcc8f('0x3d')]['ids'][_0x1bdcbb]),'SmsQueueId':Number(_0x2cb5dc[_0xcc8f('0x51')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x2cb5dc['query'][_0xcc8f('0x77')]),'SmsQueueId':Number(_0x2cb5dc[_0xcc8f('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x10d28b,null))[_0xcc8f('0x50')](handleError(_0x10d28b,null));};exports['getAgents']=function(_0xcd59fd,_0x4dd17a,_0x462953){var _0x5dd5e7={};var _0x13acce={};var _0x106d3f;var _0x55aa52;return db['SmsQueue']['findOne']({'where':{'id':_0xcd59fd[_0xcc8f('0x51')]['id']}})[_0xcc8f('0x2e')](handleEntityNotFound(_0x4dd17a,null))[_0xcc8f('0x2e')](function(_0x318c6f){if(_0x318c6f){_0x106d3f=_0x318c6f;_0x13acce[_0xcc8f('0x40')]=_[_0xcc8f('0x3e')](db['User'][_0xcc8f('0x39')]);_0x13acce[_0xcc8f('0x3d')]=_['keys'](_0xcd59fd['query']);_0x13acce[_0xcc8f('0x5d')]=_[_0xcc8f('0x3f')](_0x13acce[_0xcc8f('0x40')],_0x13acce[_0xcc8f('0x3d')]);_0x5dd5e7['attributes']=_[_0xcc8f('0x3f')](_0x13acce['model'],qs[_0xcc8f('0x42')](_0xcd59fd['query'][_0xcc8f('0x42')]));_0x5dd5e7[_0xcc8f('0x41')]=_0x5dd5e7[_0xcc8f('0x41')][_0xcc8f('0x43')]?_0x5dd5e7['attributes']:_0x13acce[_0xcc8f('0x40')];_0x5dd5e7[_0xcc8f('0x46')]=qs[_0xcc8f('0x47')](_0xcd59fd[_0xcc8f('0x3d')]['sort']);_0x5dd5e7[_0xcc8f('0x48')]=qs[_0xcc8f('0x5d')](_[_0xcc8f('0x49')](_0xcd59fd['query'],_0x13acce[_0xcc8f('0x5d')]));if(_0xcd59fd['query'][_0xcc8f('0x4a')]){_0x5dd5e7[_0xcc8f('0x48')]=_['merge'](_0x5dd5e7[_0xcc8f('0x48')],{'$or':_[_0xcc8f('0x37')](_0x5dd5e7[_0xcc8f('0x41')],function(_0x33d5a7){var _0x25e57f={};_0x25e57f[_0x33d5a7]={'$like':'%'+_0xcd59fd[_0xcc8f('0x3d')][_0xcc8f('0x4a')]+'%'};return _0x25e57f;})});}_0x5dd5e7=_[_0xcc8f('0x4b')]({},_0x5dd5e7,_0xcd59fd[_0xcc8f('0x52')]);return _0x106d3f[_0xcc8f('0x8e')](_0x5dd5e7);}})[_0xcc8f('0x2e')](function(_0x50e27c){if(_0x50e27c){_0x55aa52=_0x50e27c[_0xcc8f('0x43')];if(!_0xcd59fd['query']['hasOwnProperty'](_0xcc8f('0x45'))){_0x5dd5e7[_0xcc8f('0x27')]=qs[_0xcc8f('0x27')](_0xcd59fd[_0xcc8f('0x3d')][_0xcc8f('0x27')]);_0x5dd5e7[_0xcc8f('0x25')]=qs[_0xcc8f('0x25')](_0xcd59fd[_0xcc8f('0x3d')]['offset']);}return _0x106d3f[_0xcc8f('0x8e')](_0x5dd5e7);}})[_0xcc8f('0x2e')](function(_0x200a22){if(_0x200a22){return _0x200a22?{'count':_0x55aa52,'rows':_0x200a22}:null;}})[_0xcc8f('0x2e')](respondWithResult(_0x4dd17a,null))[_0xcc8f('0x50')](handleError(_0x4dd17a,null));}; \ No newline at end of file +var _0x7dd1=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','intersection','length','include','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','SmsQueueId','UserSmsQueue','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','select','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','end','stack','index','map','SmsQueue','type','model','name','query','keys','fields','attributes'];(function(_0x28b6e8,_0x4c1e95){var _0x4a0673=function(_0x2ef9bc){while(--_0x2ef9bc){_0x28b6e8['push'](_0x28b6e8['shift']());}};_0x4a0673(++_0x4c1e95);}(_0x7dd1,0x169));var _0x17dd=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x7dd1[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0x17dd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x17dd('0x1'));var rp=require(_0x17dd('0x2'));var moment=require(_0x17dd('0x3'));var BPromise=require(_0x17dd('0x4'));var Mustache=require(_0x17dd('0x5'));var util=require(_0x17dd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x17dd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17dd('0x8'));var _=require(_0x17dd('0x9'));var squel=require('squel');var crypto=require(_0x17dd('0xa'));var jsforce=require(_0x17dd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x17dd('0x7'));var querystring=require('querystring');var Papa=require(_0x17dd('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x17dd('0xd'));var as=require(_0x17dd('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17dd('0xf'))(_0x17dd('0x10'));var utils=require(_0x17dd('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x17dd('0x12'))['db'];config['redis']=_[_0x17dd('0x13')](config[_0x17dd('0x14')],{'host':_0x17dd('0x15'),'port':0x18eb});var socket=require(_0x17dd('0x16'))(new Redis(config[_0x17dd('0x14')]));require('./smsQueue.socket')[_0x17dd('0x17')](socket);function respondWithStatusCode(_0x456445,_0x26c2f5){_0x26c2f5=_0x26c2f5||0xcc;return function(_0xb8b2c1){if(_0xb8b2c1){return _0x456445[_0x17dd('0x18')](_0x26c2f5);}return _0x456445[_0x17dd('0x19')](_0x26c2f5)['end']();};}function respondWithResult(_0x2a3d79,_0x490b13){_0x490b13=_0x490b13||0xc8;return function(_0x572abf){if(_0x572abf){return _0x2a3d79[_0x17dd('0x19')](_0x490b13)[_0x17dd('0x1a')](_0x572abf);}};}function respondWithFilteredResult(_0x47fe0c,_0x3652fc){return function(_0x3345c5){if(_0x3345c5){var _0x5c0342=typeof _0x3652fc[_0x17dd('0x1b')]===_0x17dd('0x1c')&&typeof _0x3652fc[_0x17dd('0x1d')]===_0x17dd('0x1c');var _0x2eaaf3=_0x3345c5[_0x17dd('0x1e')];var _0x26907a=_0x5c0342?0x0:_0x3652fc[_0x17dd('0x1b')];var _0x53cc4c=_0x5c0342?_0x3345c5[_0x17dd('0x1e')]:_0x3652fc[_0x17dd('0x1b')]+_0x3652fc['limit'];var _0x4056b2;if(_0x53cc4c>=_0x2eaaf3){_0x53cc4c=_0x2eaaf3;_0x4056b2=0xc8;}else{_0x4056b2=0xce;}_0x47fe0c[_0x17dd('0x19')](_0x4056b2);return _0x47fe0c[_0x17dd('0x1f')](_0x17dd('0x20'),_0x26907a+'-'+_0x53cc4c+'/'+_0x2eaaf3)[_0x17dd('0x1a')](_0x3345c5);}return null;};}function patchUpdates(_0x72eb05){return function(_0x5ed51a){try{jsonpatch[_0x17dd('0x21')](_0x5ed51a,_0x72eb05,!![]);}catch(_0xb8dd73){return BPromise[_0x17dd('0x22')](_0xb8dd73);}return _0x5ed51a[_0x17dd('0x23')]();};}function saveUpdates(_0x3c5af6,_0x3f08bc){return function(_0x3abba4){if(_0x3abba4){return _0x3abba4['update'](_0x3c5af6)[_0x17dd('0x24')](function(_0x3da60c){return _0x3da60c;});}return null;};}function removeEntity(_0xfe3b76,_0x2a1439){return function(_0x245ad6){if(_0x245ad6){return _0x245ad6[_0x17dd('0x25')]()[_0x17dd('0x24')](function(){var _0xca2ef8=_0x245ad6[_0x17dd('0x26')]({'plain':!![]});var _0x33b41b=_0x17dd('0x27');return db[_0x17dd('0x28')][_0x17dd('0x25')]({'where':{'type':_0x33b41b,'resourceId':_0xca2ef8['id']}})['then'](function(){return _0x245ad6;});})[_0x17dd('0x24')](function(){_0xfe3b76[_0x17dd('0x19')](0xcc)[_0x17dd('0x29')]();});}};}function handleEntityNotFound(_0x908e81,_0x2910c7){return function(_0x46a872){if(!_0x46a872){_0x908e81[_0x17dd('0x18')](0x194);}return _0x46a872;};}function handleError(_0x24a85f,_0x16fa95){_0x16fa95=_0x16fa95||0x1f4;return function(_0x3736ad){logger['error'](_0x3736ad[_0x17dd('0x2a')]);if(_0x3736ad['name']){delete _0x3736ad['name'];}_0x24a85f[_0x17dd('0x19')](_0x16fa95)['send'](_0x3736ad);};}exports[_0x17dd('0x2b')]=function(_0x3cf661,_0x5344f3){var _0x3b88ac={},_0x5afa6f={},_0x163bdb={'count':0x0,'rows':[]};var _0x457f64=_[_0x17dd('0x2c')](db[_0x17dd('0x2d')]['rawAttributes'],function(_0x13651e){return{'name':_0x13651e['fieldName'],'type':_0x13651e[_0x17dd('0x2e')]['key']};});_0x5afa6f[_0x17dd('0x2f')]=_[_0x17dd('0x2c')](_0x457f64,_0x17dd('0x30'));_0x5afa6f[_0x17dd('0x31')]=_[_0x17dd('0x32')](_0x3cf661[_0x17dd('0x31')]);_0x5afa6f['filters']=_['intersection'](_0x5afa6f[_0x17dd('0x2f')],_0x5afa6f[_0x17dd('0x31')]);_0x3b88ac['attributes']=_['intersection'](_0x5afa6f[_0x17dd('0x2f')],qs[_0x17dd('0x33')](_0x3cf661['query'][_0x17dd('0x33')]));_0x3b88ac[_0x17dd('0x34')]=_0x3b88ac[_0x17dd('0x34')]['length']?_0x3b88ac[_0x17dd('0x34')]:_0x5afa6f[_0x17dd('0x2f')];if(!_0x3cf661[_0x17dd('0x31')][_0x17dd('0x35')](_0x17dd('0x36'))){_0x3b88ac[_0x17dd('0x1d')]=qs[_0x17dd('0x1d')](_0x3cf661[_0x17dd('0x31')][_0x17dd('0x1d')]);_0x3b88ac[_0x17dd('0x1b')]=qs[_0x17dd('0x1b')](_0x3cf661['query'][_0x17dd('0x1b')]);}_0x3b88ac[_0x17dd('0x37')]=qs[_0x17dd('0x38')](_0x3cf661[_0x17dd('0x31')][_0x17dd('0x38')]);_0x3b88ac[_0x17dd('0x39')]=qs[_0x17dd('0x3a')](_[_0x17dd('0x3b')](_0x3cf661[_0x17dd('0x31')],_0x5afa6f['filters']),_0x457f64);if(_0x3cf661[_0x17dd('0x31')][_0x17dd('0x3c')]){_0x3b88ac['where']=_['merge'](_0x3b88ac[_0x17dd('0x39')],{'$or':_['map'](_0x457f64,function(_0x2d0f2a){if(_0x2d0f2a[_0x17dd('0x2e')]!==_0x17dd('0x3d')){var _0x218f67={};_0x218f67[_0x2d0f2a[_0x17dd('0x30')]]={'$like':'%'+_0x3cf661[_0x17dd('0x31')][_0x17dd('0x3c')]+'%'};return _0x218f67;}})});}_0x3b88ac=_['merge']({},_0x3b88ac,_0x3cf661[_0x17dd('0x3e')]);var _0x3e79c0={'where':_0x3b88ac[_0x17dd('0x39')]};return db[_0x17dd('0x2d')][_0x17dd('0x1e')](_0x3e79c0)['then'](function(_0x1f55c0){_0x163bdb[_0x17dd('0x1e')]=_0x1f55c0;if(_0x3cf661['query'][_0x17dd('0x3f')]){_0x3b88ac['include']=[{'all':!![]}];}return db['SmsQueue'][_0x17dd('0x40')](_0x3b88ac);})[_0x17dd('0x24')](function(_0x375ff0){_0x163bdb[_0x17dd('0x41')]=_0x375ff0;return _0x163bdb;})['then'](respondWithFilteredResult(_0x5344f3,_0x3b88ac))[_0x17dd('0x42')](handleError(_0x5344f3,null));};exports['show']=function(_0xb1fc50,_0x4c7df3){var _0x51609a={'raw':!![],'where':{'id':_0xb1fc50[_0x17dd('0x43')]['id']}},_0x54eb46={};_0x54eb46[_0x17dd('0x2f')]=_[_0x17dd('0x32')](db[_0x17dd('0x2d')][_0x17dd('0x44')]);_0x54eb46['query']=_[_0x17dd('0x32')](_0xb1fc50[_0x17dd('0x31')]);_0x54eb46[_0x17dd('0x3a')]=_[_0x17dd('0x45')](_0x54eb46[_0x17dd('0x2f')],_0x54eb46[_0x17dd('0x31')]);_0x51609a[_0x17dd('0x34')]=_[_0x17dd('0x45')](_0x54eb46[_0x17dd('0x2f')],qs['fields'](_0xb1fc50[_0x17dd('0x31')][_0x17dd('0x33')]));_0x51609a[_0x17dd('0x34')]=_0x51609a[_0x17dd('0x34')][_0x17dd('0x46')]?_0x51609a[_0x17dd('0x34')]:_0x54eb46[_0x17dd('0x2f')];if(_0xb1fc50['query'][_0x17dd('0x3f')]){_0x51609a[_0x17dd('0x47')]=[{'all':!![]}];}_0x51609a=_[_0x17dd('0x48')]({},_0x51609a,_0xb1fc50['options']);return db[_0x17dd('0x2d')]['find'](_0x51609a)['then'](handleEntityNotFound(_0x4c7df3,null))['then'](respondWithResult(_0x4c7df3,null))[_0x17dd('0x42')](handleError(_0x4c7df3,null));};exports[_0x17dd('0x49')]=function(_0x12ea0a,_0x2edfe1){return db[_0x17dd('0x2d')][_0x17dd('0x49')](_0x12ea0a[_0x17dd('0x4a')],{})[_0x17dd('0x24')](function(_0x353ca5){var _0x1758ea=_0x12ea0a['user'][_0x17dd('0x26')]({'plain':!![]});if(!_0x1758ea)throw new Error(_0x17dd('0x4b'));if(_0x1758ea[_0x17dd('0x4c')]===_0x17dd('0x4d')){var _0x214d6d=_0x353ca5['get']({'plain':!![]});var _0x11651f='SmsQueues';return db[_0x17dd('0x4e')][_0x17dd('0x4f')]({'where':{'name':_0x11651f,'userProfileId':_0x1758ea[_0x17dd('0x50')]},'raw':!![]})[_0x17dd('0x24')](function(_0x494064){if(_0x494064&&_0x494064['autoAssociation']===0x0){return db[_0x17dd('0x28')]['create']({'name':_0x214d6d[_0x17dd('0x30')],'resourceId':_0x214d6d['id'],'type':_0x494064[_0x17dd('0x30')],'sectionId':_0x494064['id']},{})[_0x17dd('0x24')](function(){return _0x353ca5;});}else{return _0x353ca5;}})[_0x17dd('0x42')](function(_0x42bf02){logger[_0x17dd('0x51')](_0x17dd('0x52'),_0x42bf02);throw _0x42bf02;});}return _0x353ca5;})[_0x17dd('0x24')](respondWithResult(_0x2edfe1,0xc9))[_0x17dd('0x42')](handleError(_0x2edfe1,null));};exports[_0x17dd('0x53')]=function(_0xa76363,_0x2a8dde){if(_0xa76363[_0x17dd('0x4a')]['id']){delete _0xa76363['body']['id'];}return db[_0x17dd('0x2d')]['find']({'where':{'id':_0xa76363[_0x17dd('0x43')]['id']}})[_0x17dd('0x24')](handleEntityNotFound(_0x2a8dde,null))[_0x17dd('0x24')](saveUpdates(_0xa76363['body'],null))[_0x17dd('0x24')](respondWithResult(_0x2a8dde,null))[_0x17dd('0x42')](handleError(_0x2a8dde,null));};exports[_0x17dd('0x25')]=function(_0x479347,_0x88119d){return db[_0x17dd('0x2d')][_0x17dd('0x4f')]({'where':{'id':_0x479347['params']['id']}})[_0x17dd('0x24')](handleEntityNotFound(_0x88119d,null))['then'](removeEntity(_0x88119d,null))[_0x17dd('0x42')](handleError(_0x88119d,null));};exports['describe']=function(_0x2da2ef,_0x477cb8){return db['SmsQueue'][_0x17dd('0x54')]()[_0x17dd('0x24')](respondWithResult(_0x477cb8,null))[_0x17dd('0x42')](handleError(_0x477cb8,null));};exports[_0x17dd('0x55')]=function(_0x588bd4,_0x1cedc0,_0xa7804b){var _0x364a72={'raw':!![],'where':{}},_0xce66ae={},_0x1f2aeb;return db[_0x17dd('0x2d')][_0x17dd('0x56')]({'where':{'id':_0x588bd4[_0x17dd('0x43')]['id']}})['then'](handleEntityNotFound(_0x1cedc0,null))['then'](function(_0x2ac7fe){if(_0x2ac7fe){_0x1f2aeb=_0x2ac7fe[_0x17dd('0x26')]({'plain':!![]});_0xce66ae[_0x17dd('0x2f')]=_[_0x17dd('0x32')](db['UserSmsQueue'][_0x17dd('0x44')]);_0xce66ae[_0x17dd('0x31')]=_[_0x17dd('0x32')](_0x588bd4['query']);_0xce66ae['filters']=_[_0x17dd('0x45')](_0xce66ae[_0x17dd('0x2f')],_0xce66ae[_0x17dd('0x31')]);_0x364a72[_0x17dd('0x34')]=_[_0x17dd('0x45')](_0xce66ae['model'],qs[_0x17dd('0x33')](_0x588bd4['query'][_0x17dd('0x33')]));_0x364a72['attributes']=_0x364a72[_0x17dd('0x34')]['length']?_0x364a72[_0x17dd('0x34')]:_0xce66ae[_0x17dd('0x2f')];if(!_0x588bd4[_0x17dd('0x31')][_0x17dd('0x35')](_0x17dd('0x36'))){_0x364a72[_0x17dd('0x1d')]=qs[_0x17dd('0x1d')](_0x588bd4[_0x17dd('0x31')][_0x17dd('0x1d')]);_0x364a72[_0x17dd('0x1b')]=qs['offset'](_0x588bd4['query']['offset']);}_0x364a72[_0x17dd('0x37')]=qs[_0x17dd('0x38')](_0x588bd4['query'][_0x17dd('0x38')]);_0x364a72[_0x17dd('0x39')]=qs[_0x17dd('0x3a')](_['pick'](_0x588bd4[_0x17dd('0x31')],_0xce66ae['filters']));_0x364a72[_0x17dd('0x39')][_0x17dd('0x57')]=_0x2ac7fe['id'];if(_0x588bd4[_0x17dd('0x31')][_0x17dd('0x3c')]){_0x364a72[_0x17dd('0x39')]=_['merge'](_0x364a72[_0x17dd('0x39')],{'$or':_[_0x17dd('0x2c')](_0x364a72['attributes'],function(_0x35c3e4){var _0x4f1a19={};_0x4f1a19[_0x35c3e4]={'$like':'%'+_0x588bd4['query'][_0x17dd('0x3c')]+'%'};return _0x4f1a19;})});}_0x364a72=_[_0x17dd('0x48')]({},_0x364a72,_0x588bd4[_0x17dd('0x3e')]);return db[_0x17dd('0x58')][_0x17dd('0x40')](_0x364a72);}})[_0x17dd('0x24')](function(_0x16dba8){if(_0x16dba8){return db[_0x17dd('0x59')]['findAndCountAll']({'where':{'id':_[_0x17dd('0x2c')](_0x16dba8,_0x17dd('0x5a')),'role':_0x17dd('0x5b')},'attributes':['id',_0x17dd('0x30'),'smsPause',_0x17dd('0x5c'),_0x17dd('0x5d')]});}})[_0x17dd('0x24')](function(_0x1e77ad){if(_0x1e77ad){return{'count':_0x1e77ad['count'],'rows':_['map'](_0x1e77ad['rows'],function(_0x551ebd){return{'membername':_0x551ebd[_0x17dd('0x30')],'UserId':_0x551ebd['id'],'queue_name':_0x1f2aeb[_0x17dd('0x30')],'SmsQueueId':_0x1f2aeb['id'],'interface':util[_0x17dd('0x5e')](_0x17dd('0x5f'),_0x17dd('0x60'),_0x551ebd[_0x17dd('0x30')]),'penalty':0x0,'paused':_0x551ebd[_0x17dd('0x61')],'createdAt':_0x551ebd[_0x17dd('0x5d')],'updatedAt':_0x551ebd[_0x17dd('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x17dd('0x24')](respondWithFilteredResult(_0x1cedc0,_0x364a72))[_0x17dd('0x42')](handleError(_0x1cedc0,null));};exports[_0x17dd('0x62')]=function(_0x30b655,_0x565f59,_0x3977ca){var _0x5292c7={};var _0x26d324={};var _0x16f4d3;var _0x4e8a69;return db[_0x17dd('0x2d')][_0x17dd('0x56')]({'where':{'id':_0x30b655[_0x17dd('0x43')]['id']}})[_0x17dd('0x24')](handleEntityNotFound(_0x565f59,null))[_0x17dd('0x24')](function(_0x26465e){if(_0x26465e){_0x16f4d3=_0x26465e;_0x26d324[_0x17dd('0x2f')]=_[_0x17dd('0x32')](db['Team'][_0x17dd('0x44')]);_0x26d324[_0x17dd('0x31')]=_[_0x17dd('0x32')](_0x30b655['query']);_0x26d324[_0x17dd('0x3a')]=_[_0x17dd('0x45')](_0x26d324[_0x17dd('0x2f')],_0x26d324[_0x17dd('0x31')]);_0x5292c7['attributes']=_[_0x17dd('0x45')](_0x26d324[_0x17dd('0x2f')],qs[_0x17dd('0x33')](_0x30b655[_0x17dd('0x31')][_0x17dd('0x33')]));_0x5292c7['attributes']=_0x5292c7[_0x17dd('0x34')]['length']?_0x5292c7[_0x17dd('0x34')]:_0x26d324[_0x17dd('0x2f')];_0x5292c7[_0x17dd('0x37')]=qs[_0x17dd('0x38')](_0x30b655[_0x17dd('0x31')][_0x17dd('0x38')]);_0x5292c7['where']=qs[_0x17dd('0x3a')](_[_0x17dd('0x3b')](_0x30b655[_0x17dd('0x31')],_0x26d324['filters']));if(_0x30b655[_0x17dd('0x31')][_0x17dd('0x3c')]){_0x5292c7[_0x17dd('0x39')]=_['merge'](_0x5292c7['where'],{'$or':_['map'](_0x5292c7[_0x17dd('0x34')],function(_0x33cb2c){var _0x84947c={};_0x84947c[_0x33cb2c]={'$like':'%'+_0x30b655[_0x17dd('0x31')]['filter']+'%'};return _0x84947c;})});}_0x5292c7=_[_0x17dd('0x48')]({},_0x5292c7,_0x30b655[_0x17dd('0x3e')]);return _0x16f4d3[_0x17dd('0x62')](_0x5292c7);}})['then'](function(_0x188c0c){if(_0x188c0c){_0x4e8a69=_0x188c0c[_0x17dd('0x46')];if(!_0x30b655[_0x17dd('0x31')][_0x17dd('0x35')](_0x17dd('0x36'))){_0x5292c7[_0x17dd('0x1d')]=qs[_0x17dd('0x1d')](_0x30b655[_0x17dd('0x31')]['limit']);_0x5292c7[_0x17dd('0x1b')]=qs[_0x17dd('0x1b')](_0x30b655[_0x17dd('0x31')][_0x17dd('0x1b')]);}return _0x16f4d3[_0x17dd('0x62')](_0x5292c7);}})['then'](function(_0x1aed5b){if(_0x1aed5b){return _0x1aed5b?{'count':_0x4e8a69,'rows':_0x1aed5b}:null;}})[_0x17dd('0x24')](respondWithResult(_0x565f59,null))['catch'](handleError(_0x565f59,null));};exports['addTeams']=function(_0xeac07c,_0x18e032,_0x8c5c71){var _0x37cf0f=_0xeac07c['body'][_0x17dd('0x63')];return db[_0x17dd('0x64')]['findAll']({'where':{'id':_0x37cf0f},'attributes':['id'],'include':[{'model':db[_0x17dd('0x59')],'as':_0x17dd('0x65'),'attributes':['id',_0x17dd('0x30'),_0x17dd('0x66'),_0x17dd('0x67'),_0x17dd('0x68')],'raw':!![]}]})[_0x17dd('0x24')](function(_0x5bd4b2){if(_0x5bd4b2){var _0x2767da=_[_0x17dd('0x69')](_0x5bd4b2,function(_0x1d06b0){var _0x467ae5=_0x1d06b0[_0x17dd('0x26')]({'plain':!![]});return _0x467ae5['Agents'];});return db['SmsQueue'][_0x17dd('0x4f')]({'where':{'id':_0xeac07c[_0x17dd('0x43')]['id']}})[_0x17dd('0x24')](function(_0x2063d2){return db[_0x17dd('0x6a')][_0x17dd('0x6b')](function(_0x5be5c9){return _0x2063d2[_0x17dd('0x6c')](_0x37cf0f,{'transaction':_0x5be5c9})[_0x17dd('0x24')](function(){return BPromise[_0x17dd('0x6d')](_0x2767da,function(_0x265d6c){return db[_0x17dd('0x58')][_0x17dd('0x6e')]({'where':{'UserId':_0x265d6c['id'],'SmsQueueId':_0xeac07c[_0x17dd('0x43')]['id']},'transaction':_0x5be5c9});});})[_0x17dd('0x24')](function(){_0x2767da[_0x17dd('0x6f')](function(_0x250b20){socket[_0x17dd('0x70')]('userSmsQueue:save',{'UserId':_0x250b20['id'],'SmsQueueId':_0x2063d2['id']});});});});});}})[_0x17dd('0x24')](respondWithStatusCode(_0x18e032,null))[_0x17dd('0x42')](handleError(_0x18e032,null));};exports['removeTeams']=function(_0xc7ed84,_0x3e0597,_0x1a92a5){return db[_0x17dd('0x64')]['findAll']({'where':{'id':_0xc7ed84['query'][_0x17dd('0x63')]},'attributes':['id'],'include':[{'model':db[_0x17dd('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x17dd('0x24')](handleEntityNotFound(_0x3e0597,null))[_0x17dd('0x24')](function(_0x41c4ba){var _0x25b658=_[_0x17dd('0x2c')](_0x41c4ba,'id');var _0x3c2dbf=[];var _0x160570=[];var _0x4e5bec=squel[_0x17dd('0x71')]();_0x4e5bec['field']('tq.TeamId')['from']('team_has_sms_queues','tq')[_0x17dd('0x72')](_0x17dd('0x73'),'ut',_0x17dd('0x74'))[_0x17dd('0x39')](_0x17dd('0x75'),_0xc7ed84[_0x17dd('0x43')]['id']);for(var _0x4969b1=0x0;_0x4969b1<_0x41c4ba['length'];_0x4969b1+=0x1){let _0x464b57=_0x41c4ba[_0x4969b1];for(var _0xd0c151=0x0;_0xd0c151<_0x464b57[_0x17dd('0x65')][_0x17dd('0x46')];_0xd0c151+=0x1){let _0x1bb7a9=_0x464b57[_0x17dd('0x65')][_0xd0c151];var _0x49af70=_0x4e5bec[_0x17dd('0x76')]();_0x49af70[_0x17dd('0x39')](_0x17dd('0x77'),_0x1bb7a9['id']);_0x160570['push'](db[_0x17dd('0x6a')][_0x17dd('0x31')](_0x49af70[_0x17dd('0x78')](),{'type':db[_0x17dd('0x6a')][_0x17dd('0x79')][_0x17dd('0x7a')]})[_0x17dd('0x24')](function(_0x6da03d){if(_0x6da03d['length']===0x1){return _0x1bb7a9['id'];}else{var _0x1af03f=_[_0x17dd('0x7b')](_[_0x17dd('0x2c')](_0x6da03d,'TeamId'),function(_0x95349){return _[_0x17dd('0x7c')](_0x25b658,_0x95349);});if(_0x1af03f){return _0x1bb7a9['id'];}}}));}}return BPromise[_0x17dd('0x7d')](_0x160570)[_0x17dd('0x24')](function(_0x5547d9){_0x3c2dbf=_(_0x3c2dbf)[_0x17dd('0x7e')](_0x5547d9)[_0x17dd('0x7f')]()[_0x17dd('0x80')]();return db['SmsQueue'][_0x17dd('0x4f')]({'where':{'id':_0xc7ed84[_0x17dd('0x43')]['id']}})['then'](function(_0x56b13d){return db[_0x17dd('0x6a')][_0x17dd('0x6b')](function(_0x151196){return _0x56b13d[_0x17dd('0x81')](_0xc7ed84['query']['ids'],{'transaction':_0x151196})[_0x17dd('0x24')](function(){if(!_['isEmpty'](_0x3c2dbf)){return _0x56b13d[_0x17dd('0x82')](_0x3c2dbf,{'transaction':_0x151196});}})[_0x17dd('0x24')](function(){_0x3c2dbf[_0x17dd('0x6f')](function(_0x31ce71){socket[_0x17dd('0x70')](_0x17dd('0x83'),{'UserId':_0x31ce71,'SmsQueueId':_0x56b13d['id']});});});});});});})[_0x17dd('0x24')](respondWithStatusCode(_0x3e0597,null))[_0x17dd('0x42')](handleError(_0x3e0597,null));};exports[_0x17dd('0x84')]=function(_0x2ac4a1,_0x60c6bc,_0x392601){return db[_0x17dd('0x2d')][_0x17dd('0x4f')]({'where':{'id':_0x2ac4a1['params']['id']}})['then'](handleEntityNotFound(_0x60c6bc,null))[_0x17dd('0x24')](function(_0x2847cf){if(_0x2847cf){return _0x2847cf['addAgents'](_0x2ac4a1[_0x17dd('0x4a')][_0x17dd('0x63')],_[_0x17dd('0x85')](_0x2ac4a1[_0x17dd('0x4a')],[_0x17dd('0x63'),'id'])||{})[_0x17dd('0x86')](function(_0x63e0dc){for(var _0x5b4c89=0x0;_0x5b4c89<_0x2ac4a1[_0x17dd('0x4a')][_0x17dd('0x63')][_0x17dd('0x46')];_0x5b4c89+=0x1){socket[_0x17dd('0x70')](_0x17dd('0x87'),{'UserId':Number(_0x2ac4a1[_0x17dd('0x4a')][_0x17dd('0x63')][_0x5b4c89]),'SmsQueueId':Number(_0x2ac4a1['params']['id'])});}return _0x63e0dc;});}})['then'](respondWithResult(_0x60c6bc,null))[_0x17dd('0x42')](handleError(_0x60c6bc,null));};exports['removeAgents']=function(_0x5a0e19,_0x3d3841,_0x5d6f37){return db[_0x17dd('0x2d')][_0x17dd('0x4f')]({'where':{'id':_0x5a0e19[_0x17dd('0x43')]['id']}})[_0x17dd('0x24')](handleEntityNotFound(_0x3d3841,null))[_0x17dd('0x24')](function(_0x16bf24){if(_0x16bf24){return _0x16bf24[_0x17dd('0x82')](_0x5a0e19[_0x17dd('0x31')]['ids'])[_0x17dd('0x24')](function(){if(_[_0x17dd('0x88')](_0x5a0e19['query'][_0x17dd('0x63')])){for(var _0x32b492=0x0;_0x32b492<_0x5a0e19['query']['ids'][_0x17dd('0x46')];_0x32b492+=0x1){socket[_0x17dd('0x70')](_0x17dd('0x83'),{'UserId':Number(_0x5a0e19[_0x17dd('0x31')][_0x17dd('0x63')][_0x32b492]),'SmsQueueId':Number(_0x5a0e19[_0x17dd('0x43')]['id'])});}}else{socket[_0x17dd('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x5a0e19[_0x17dd('0x31')]['ids']),'SmsQueueId':Number(_0x5a0e19['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3d3841,null))[_0x17dd('0x42')](handleError(_0x3d3841,null));};exports[_0x17dd('0x89')]=function(_0x4135f2,_0x3d89f9,_0x5adca5){var _0x4aee35={};var _0x548f8b={};var _0x2132e7;var _0x518566;return db[_0x17dd('0x2d')][_0x17dd('0x56')]({'where':{'id':_0x4135f2[_0x17dd('0x43')]['id']}})[_0x17dd('0x24')](handleEntityNotFound(_0x3d89f9,null))[_0x17dd('0x24')](function(_0x57861b){if(_0x57861b){_0x2132e7=_0x57861b;_0x548f8b[_0x17dd('0x2f')]=_[_0x17dd('0x32')](db['User']['rawAttributes']);_0x548f8b[_0x17dd('0x31')]=_[_0x17dd('0x32')](_0x4135f2[_0x17dd('0x31')]);_0x548f8b[_0x17dd('0x3a')]=_[_0x17dd('0x45')](_0x548f8b[_0x17dd('0x2f')],_0x548f8b[_0x17dd('0x31')]);_0x4aee35['attributes']=_[_0x17dd('0x45')](_0x548f8b[_0x17dd('0x2f')],qs['fields'](_0x4135f2[_0x17dd('0x31')][_0x17dd('0x33')]));_0x4aee35['attributes']=_0x4aee35[_0x17dd('0x34')][_0x17dd('0x46')]?_0x4aee35[_0x17dd('0x34')]:_0x548f8b[_0x17dd('0x2f')];_0x4aee35[_0x17dd('0x37')]=qs[_0x17dd('0x38')](_0x4135f2[_0x17dd('0x31')][_0x17dd('0x38')]);_0x4aee35['where']=qs[_0x17dd('0x3a')](_['pick'](_0x4135f2[_0x17dd('0x31')],_0x548f8b[_0x17dd('0x3a')]));if(_0x4135f2['query'][_0x17dd('0x3c')]){_0x4aee35[_0x17dd('0x39')]=_['merge'](_0x4aee35[_0x17dd('0x39')],{'$or':_[_0x17dd('0x2c')](_0x4aee35[_0x17dd('0x34')],function(_0x4d67a7){var _0x2c0a1a={};_0x2c0a1a[_0x4d67a7]={'$like':'%'+_0x4135f2[_0x17dd('0x31')][_0x17dd('0x3c')]+'%'};return _0x2c0a1a;})});}_0x4aee35=_[_0x17dd('0x48')]({},_0x4aee35,_0x4135f2[_0x17dd('0x3e')]);return _0x2132e7[_0x17dd('0x89')](_0x4aee35);}})[_0x17dd('0x24')](function(_0x233419){if(_0x233419){_0x518566=_0x233419['length'];if(!_0x4135f2[_0x17dd('0x31')][_0x17dd('0x35')]('nolimit')){_0x4aee35[_0x17dd('0x1d')]=qs['limit'](_0x4135f2['query'][_0x17dd('0x1d')]);_0x4aee35[_0x17dd('0x1b')]=qs[_0x17dd('0x1b')](_0x4135f2[_0x17dd('0x31')][_0x17dd('0x1b')]);}return _0x2132e7['getAgents'](_0x4aee35);}})[_0x17dd('0x24')](function(_0x24bb7f){if(_0x24bb7f){return _0x24bb7f?{'count':_0x518566,'rows':_0x24bb7f}:null;}})[_0x17dd('0x24')](respondWithResult(_0x3d89f9,null))['catch'](handleError(_0x3d89f9,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a5376ea..be39f2b 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 _0x6fa4=['../../mysqldb','SmsQueue','save','emit','hasOwnProperty','exports','events'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x6fa4,0x15d));var _0x46fa=function(_0x3c8e45,_0x46ad0f){_0x3c8e45=_0x3c8e45-0x0;var _0x48aac3=_0x6fa4[_0x3c8e45];return _0x48aac3;};'use strict';var EventEmitter=require(_0x46fa('0x0'));var SmsQueue=require(_0x46fa('0x1'))['db'][_0x46fa('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46fa('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x83aa1e){return function(_0x20d560,_0x19ad5e,_0x3c0b31){SmsQueueEvents[_0x46fa('0x4')](_0x83aa1e+':'+_0x20d560['id'],_0x20d560);SmsQueueEvents[_0x46fa('0x4')](_0x83aa1e,_0x20d560);_0x3c0b31(null);};}for(var e in events){if(events[_0x46fa('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x46fa('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x87d6=['setMaxListeners','update','emit','hook','exports','../../mysqldb','SmsQueue'];(function(_0x26e9e7,_0x408980){var _0x59a310=function(_0x4c4550){while(--_0x4c4550){_0x26e9e7['push'](_0x26e9e7['shift']());}};_0x59a310(++_0x408980);}(_0x87d6,0x194));var _0x687d=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x87d6[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x687d('0x0'))['db'][_0x687d('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x687d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x687d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x760924){return function(_0x10fcb6,_0x1a37d7,_0x448a0f){SmsQueueEvents['emit'](_0x760924+':'+_0x10fcb6['id'],_0x10fcb6);SmsQueueEvents[_0x687d('0x4')](_0x760924,_0x10fcb6);_0x448a0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x687d('0x5')](e,emitEvent(event));}}module[_0x687d('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 2b23f4a..ba3432c 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 _0x044f=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','util','../../config/logger','api','bluebird','request-promise'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x044f,0x7f));var _0xf044=function(_0x1aefea,_0x39e5fa){_0x1aefea=_0x1aefea-0x0;var _0x33a7a1=_0x044f[_0x1aefea];return _0x33a7a1;};'use strict';var _=require('lodash');var util=require(_0xf044('0x0'));var logger=require(_0xf044('0x1'))(_0xf044('0x2'));var moment=require('moment');var BPromise=require(_0xf044('0x3'));var rp=require(_0xf044('0x4'));var fs=require('fs');var path=require(_0xf044('0x5'));var rimraf=require(_0xf044('0x6'));var config=require(_0xf044('0x7'));var attributes=require(_0xf044('0x8'));module[_0xf044('0x9')]=function(_0x1680b4,_0x113281){return _0x1680b4[_0xf044('0xa')](_0xf044('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f9c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsQueue','lodash','util','moment'];(function(_0x3c74f5,_0x1f3ccd){var _0x692d7b=function(_0x528c8c){while(--_0x528c8c){_0x3c74f5['push'](_0x3c74f5['shift']());}};_0x692d7b(++_0x1f3ccd);}(_0x6f9c,0x1ab));var _0xc6f9=function(_0x5b628b,_0x258320){_0x5b628b=_0x5b628b-0x0;var _0x1426d7=_0x6f9c[_0x5b628b];return _0x1426d7;};'use strict';var _=require(_0xc6f9('0x0'));var util=require(_0xc6f9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc6f9('0x2'));var BPromise=require(_0xc6f9('0x3'));var rp=require(_0xc6f9('0x4'));var fs=require('fs');var path=require(_0xc6f9('0x5'));var rimraf=require(_0xc6f9('0x6'));var config=require(_0xc6f9('0x7'));var attributes=require('./smsQueue.attributes');module[_0xc6f9('0x8')]=function(_0x5ccbdf,_0x153ead){return _0x5ccbdf['define'](_0xc6f9('0x9'),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 9deeafc..16c4394 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 _0x7de8=['model','then','GetSmsQueue','stringify','SmsQueue','ShowSmsQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','findAll','raw','options','where','attributes','map','include'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x7de8,0x9e));var _0x87de=function(_0x2801cb,_0x305650){_0x2801cb=_0x2801cb-0x0;var _0x28f692=_0x7de8[_0x2801cb];return _0x28f692;};'use strict';var _=require(_0x87de('0x0'));var util=require('util');var moment=require(_0x87de('0x1'));var BPromise=require(_0x87de('0x2'));var rs=require(_0x87de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x87de('0x5'))('rpc');var config=require(_0x87de('0x6'));var jayson=require(_0x87de('0x7'));var client=jayson[_0x87de('0x8')][_0x87de('0x9')]({'port':0x232a});config[_0x87de('0xa')]=_[_0x87de('0xb')](config['redis'],{'host':_0x87de('0xc'),'port':0x18eb});var socket=require(_0x87de('0xd'))(new Redis(config[_0x87de('0xa')]));require(_0x87de('0xe'))[_0x87de('0xf')](socket);function respondWithRpcPromise(_0xc8f947,_0x4ef8b3,_0x36dd73){return new BPromise(function(_0x30598b,_0x41f470){return client[_0x87de('0x10')](_0xc8f947,_0x36dd73)['then'](function(_0x346e65){logger['info'](_0x87de('0x11'),_0x4ef8b3,_0x87de('0x12'));logger[_0x87de('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4ef8b3,'request\x20sent',JSON['stringify'](_0x346e65));if(_0x346e65[_0x87de('0x14')]){if(_0x346e65[_0x87de('0x14')]['code']===0x1f4){logger[_0x87de('0x14')]('SmsQueue,\x20%s,\x20%s',_0x4ef8b3,_0x346e65[_0x87de('0x14')][_0x87de('0x15')]);return _0x41f470(_0x346e65[_0x87de('0x14')][_0x87de('0x15')]);}logger[_0x87de('0x14')](_0x87de('0x11'),_0x4ef8b3,_0x346e65['error'][_0x87de('0x15')]);return _0x30598b(_0x346e65[_0x87de('0x14')][_0x87de('0x15')]);}else{logger[_0x87de('0x16')](_0x87de('0x11'),_0x4ef8b3,_0x87de('0x12'));_0x30598b(_0x346e65[_0x87de('0x17')][_0x87de('0x15')]);}})[_0x87de('0x18')](function(_0xad71e8){logger[_0x87de('0x14')](_0x87de('0x11'),_0x4ef8b3,_0xad71e8);_0x41f470(_0xad71e8);});});}exports['GetSmsQueue']=function(_0x20e4f9){var _0x10953d=this;return new Promise(function(_0x4affd5,_0x1a00af){return db['SmsQueue'][_0x87de('0x19')]({'raw':_0x20e4f9['options']?_0x20e4f9['options'][_0x87de('0x1a')]===undefined?!![]:![]:!![],'where':_0x20e4f9[_0x87de('0x1b')]?_0x20e4f9['options'][_0x87de('0x1c')]||null:null,'attributes':_0x20e4f9['options']?_0x20e4f9[_0x87de('0x1b')][_0x87de('0x1d')]||null:null,'limit':_0x20e4f9[_0x87de('0x1b')]?_0x20e4f9[_0x87de('0x1b')]['limit']||null:null,'include':_0x20e4f9['options']?_0x20e4f9['options']['include']?_[_0x87de('0x1e')](_0x20e4f9[_0x87de('0x1b')][_0x87de('0x1f')],function(_0x4e2e19){return{'model':db[_0x4e2e19[_0x87de('0x20')]],'as':_0x4e2e19['as'],'attributes':_0x4e2e19[_0x87de('0x1d')],'include':_0x4e2e19[_0x87de('0x1f')]?_[_0x87de('0x1e')](_0x4e2e19['include'],function(_0x29cb04){return{'model':db[_0x29cb04[_0x87de('0x20')]],'as':_0x29cb04['as'],'attributes':_0x29cb04[_0x87de('0x1d')],'include':_0x29cb04[_0x87de('0x1f')]?_[_0x87de('0x1e')](_0x29cb04[_0x87de('0x1f')],function(_0x16a4b2){return{'model':db[_0x16a4b2['model']],'as':_0x16a4b2['as'],'attributes':_0x16a4b2[_0x87de('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x87de('0x21')](function(_0xc6ac0){logger[_0x87de('0x16')](_0x87de('0x22'),_0x20e4f9);logger['debug'](_0x87de('0x22'),_0x20e4f9,JSON[_0x87de('0x23')](_0xc6ac0));_0x4affd5(_0xc6ac0);})[_0x87de('0x18')](function(_0x5c2f1b){logger[_0x87de('0x14')](_0x87de('0x22'),_0x5c2f1b[_0x87de('0x15')],_0x20e4f9);_0x1a00af(_0x10953d[_0x87de('0x14')](0x1f4,_0x5c2f1b[_0x87de('0x15')]));});});};exports['ShowSmsQueue']=function(_0xbe4819){var _0x51d9a7=this;return new Promise(function(_0x2b8265,_0x2d7a36){return db[_0x87de('0x24')]['find']({'raw':_0xbe4819[_0x87de('0x1b')]?_0xbe4819[_0x87de('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xbe4819[_0x87de('0x1b')]?_0xbe4819['options'][_0x87de('0x1c')]||null:null,'attributes':_0xbe4819[_0x87de('0x1b')]?_0xbe4819[_0x87de('0x1b')]['attributes']||null:null,'include':_0xbe4819[_0x87de('0x1b')]?_0xbe4819[_0x87de('0x1b')][_0x87de('0x1f')]?_[_0x87de('0x1e')](_0xbe4819[_0x87de('0x1b')][_0x87de('0x1f')],function(_0x289253){return{'model':db[_0x289253[_0x87de('0x20')]],'as':_0x289253['as'],'attributes':_0x289253[_0x87de('0x1d')],'include':_0x289253[_0x87de('0x1f')]?_[_0x87de('0x1e')](_0x289253[_0x87de('0x1f')],function(_0x2e1a92){return{'model':db[_0x2e1a92[_0x87de('0x20')]],'as':_0x2e1a92['as'],'attributes':_0x2e1a92[_0x87de('0x1d')],'include':_0x2e1a92[_0x87de('0x1f')]?_[_0x87de('0x1e')](_0x2e1a92[_0x87de('0x1f')],function(_0x185d9c){return{'model':db[_0x185d9c['model']],'as':_0x185d9c['as'],'attributes':_0x185d9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x87de('0x21')](function(_0x5d0b1c){logger[_0x87de('0x16')](_0x87de('0x25'),_0xbe4819);logger[_0x87de('0x13')]('ShowSmsQueue',_0xbe4819,JSON['stringify'](_0x5d0b1c));_0x2b8265(_0x5d0b1c);})[_0x87de('0x18')](function(_0x42d26d){logger[_0x87de('0x14')](_0x87de('0x25'),_0x42d26d[_0x87de('0x15')],_0xbe4819);_0x2d7a36(_0x51d9a7[_0x87de('0x14')](0x1f4,_0x42d26d[_0x87de('0x15')]));});});}; \ No newline at end of file +var _0x2e65=['http','redis','localhost','socket.io-emitter','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','attributes','include','model','map','then','ShowSmsQueue','raw','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x4ffc5b,_0xd7c4a3){var _0x13646f=function(_0x254fde){while(--_0x254fde){_0x4ffc5b['push'](_0x4ffc5b['shift']());}};_0x13646f(++_0xd7c4a3);}(_0x2e65,0x1e3));var _0x52e6=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x2e65[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x52e6('0x0'));var moment=require(_0x52e6('0x1'));var BPromise=require(_0x52e6('0x2'));var rs=require(_0x52e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52e6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52e6('0x5'))(_0x52e6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x52e6('0x7')]({'port':0x232a});config[_0x52e6('0x8')]=_['defaults'](config['redis'],{'host':_0x52e6('0x9'),'port':0x18eb});var socket=require(_0x52e6('0xa'))(new Redis(config[_0x52e6('0x8')]));require('./smsQueue.socket')[_0x52e6('0xb')](socket);function respondWithRpcPromise(_0x3f7bf1,_0x3be8ea,_0x12d4f7){return new BPromise(function(_0x5ed3c5,_0x269d1a){return client[_0x52e6('0xc')](_0x3f7bf1,_0x12d4f7)['then'](function(_0x60fbff){logger[_0x52e6('0xd')](_0x52e6('0xe'),_0x3be8ea,_0x52e6('0xf'));logger[_0x52e6('0x10')](_0x52e6('0x11'),_0x3be8ea,'request\x20sent',JSON[_0x52e6('0x12')](_0x60fbff));if(_0x60fbff['error']){if(_0x60fbff[_0x52e6('0x13')][_0x52e6('0x14')]===0x1f4){logger[_0x52e6('0x13')]('SmsQueue,\x20%s,\x20%s',_0x3be8ea,_0x60fbff[_0x52e6('0x13')][_0x52e6('0x15')]);return _0x269d1a(_0x60fbff['error'][_0x52e6('0x15')]);}logger[_0x52e6('0x13')]('SmsQueue,\x20%s,\x20%s',_0x3be8ea,_0x60fbff['error'][_0x52e6('0x15')]);return _0x5ed3c5(_0x60fbff['error']['message']);}else{logger['info'](_0x52e6('0xe'),_0x3be8ea,'request\x20sent');_0x5ed3c5(_0x60fbff['result'][_0x52e6('0x15')]);}})[_0x52e6('0x16')](function(_0x594fe7){logger[_0x52e6('0x13')](_0x52e6('0xe'),_0x3be8ea,_0x594fe7);_0x269d1a(_0x594fe7);});});}exports[_0x52e6('0x17')]=function(_0x18fe07){var _0x488228=this;return new Promise(function(_0x23ba56,_0x38f274){return db[_0x52e6('0x18')][_0x52e6('0x19')]({'raw':_0x18fe07[_0x52e6('0x1a')]?_0x18fe07['options']['raw']===undefined?!![]:![]:!![],'where':_0x18fe07[_0x52e6('0x1a')]?_0x18fe07['options']['where']||null:null,'attributes':_0x18fe07['options']?_0x18fe07[_0x52e6('0x1a')][_0x52e6('0x1b')]||null:null,'limit':_0x18fe07[_0x52e6('0x1a')]?_0x18fe07[_0x52e6('0x1a')]['limit']||null:null,'include':_0x18fe07[_0x52e6('0x1a')]?_0x18fe07['options']['include']?_['map'](_0x18fe07[_0x52e6('0x1a')][_0x52e6('0x1c')],function(_0x310afa){return{'model':db[_0x310afa[_0x52e6('0x1d')]],'as':_0x310afa['as'],'attributes':_0x310afa['attributes'],'include':_0x310afa['include']?_[_0x52e6('0x1e')](_0x310afa['include'],function(_0x2cc977){return{'model':db[_0x2cc977[_0x52e6('0x1d')]],'as':_0x2cc977['as'],'attributes':_0x2cc977[_0x52e6('0x1b')],'include':_0x2cc977[_0x52e6('0x1c')]?_[_0x52e6('0x1e')](_0x2cc977[_0x52e6('0x1c')],function(_0x184a0a){return{'model':db[_0x184a0a[_0x52e6('0x1d')]],'as':_0x184a0a['as'],'attributes':_0x184a0a[_0x52e6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x52e6('0x1f')](function(_0x34f67e){logger[_0x52e6('0xd')](_0x52e6('0x17'),_0x18fe07);logger[_0x52e6('0x10')](_0x52e6('0x17'),_0x18fe07,JSON[_0x52e6('0x12')](_0x34f67e));_0x23ba56(_0x34f67e);})[_0x52e6('0x16')](function(_0x24a8bb){logger[_0x52e6('0x13')]('GetSmsQueue',_0x24a8bb[_0x52e6('0x15')],_0x18fe07);_0x38f274(_0x488228[_0x52e6('0x13')](0x1f4,_0x24a8bb['message']));});});};exports[_0x52e6('0x20')]=function(_0x1f1eda){var _0x5edcb3=this;return new Promise(function(_0x458d0a,_0x294d94){return db[_0x52e6('0x18')]['find']({'raw':_0x1f1eda[_0x52e6('0x1a')]?_0x1f1eda[_0x52e6('0x1a')][_0x52e6('0x21')]===undefined?!![]:![]:!![],'where':_0x1f1eda[_0x52e6('0x1a')]?_0x1f1eda[_0x52e6('0x1a')][_0x52e6('0x22')]||null:null,'attributes':_0x1f1eda[_0x52e6('0x1a')]?_0x1f1eda[_0x52e6('0x1a')][_0x52e6('0x1b')]||null:null,'include':_0x1f1eda[_0x52e6('0x1a')]?_0x1f1eda[_0x52e6('0x1a')][_0x52e6('0x1c')]?_[_0x52e6('0x1e')](_0x1f1eda[_0x52e6('0x1a')][_0x52e6('0x1c')],function(_0x40df32){return{'model':db[_0x40df32['model']],'as':_0x40df32['as'],'attributes':_0x40df32[_0x52e6('0x1b')],'include':_0x40df32['include']?_[_0x52e6('0x1e')](_0x40df32['include'],function(_0x2adb80){return{'model':db[_0x2adb80['model']],'as':_0x2adb80['as'],'attributes':_0x2adb80[_0x52e6('0x1b')],'include':_0x2adb80['include']?_['map'](_0x2adb80[_0x52e6('0x1c')],function(_0x24d743){return{'model':db[_0x24d743[_0x52e6('0x1d')]],'as':_0x24d743['as'],'attributes':_0x24d743['attributes']};}):[]};}):[]};}):[]:[]})[_0x52e6('0x1f')](function(_0x4ea98d){logger[_0x52e6('0xd')](_0x52e6('0x20'),_0x1f1eda);logger['debug'](_0x52e6('0x20'),_0x1f1eda,JSON[_0x52e6('0x12')](_0x4ea98d));_0x458d0a(_0x4ea98d);})[_0x52e6('0x16')](function(_0x774e75){logger[_0x52e6('0x13')]('ShowSmsQueue',_0x774e75[_0x52e6('0x15')],_0x1f1eda);_0x294d94(_0x5edcb3[_0x52e6('0x13')](0x1f4,_0x774e75[_0x52e6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 23dc575..d5c9fb9 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 _0xb847=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x5950bc,_0x40c1cb){var _0x6980b7=function(_0x796527){while(--_0x796527){_0x5950bc['push'](_0x5950bc['shift']());}};_0x6980b7(++_0x40c1cb);}(_0xb847,0x1b8));var _0x7b84=function(_0x5ddb91,_0x50a3c6){_0x5ddb91=_0x5ddb91-0x0;var _0x222f31=_0xb847[_0x5ddb91];return _0x222f31;};'use strict';var SmsQueueEvents=require(_0x7b84('0x0'));var events=[_0x7b84('0x1'),_0x7b84('0x2'),_0x7b84('0x3')];function createListener(_0x57a39f,_0x3699a1){return function(_0x59d97e){_0x3699a1[_0x7b84('0x4')](_0x57a39f,_0x59d97e);};}function removeListener(_0x40b62b,_0x4a5350){return function(){SmsQueueEvents[_0x7b84('0x5')](_0x40b62b,_0x4a5350);};}exports[_0x7b84('0x6')]=function(_0x1fac9d){for(var _0x167ed5=0x0,_0x39d9a2=events[_0x7b84('0x7')];_0x167ed5<_0x39d9a2;_0x167ed5++){var _0x4e129f=events[_0x167ed5];var _0x5bbd23=createListener(_0x7b84('0x8')+_0x4e129f,_0x1fac9d);SmsQueueEvents['on'](_0x4e129f,_0x5bbd23);}}; \ No newline at end of file +var _0xb90b=['length','save','update','emit','removeListener','register'];(function(_0x327fb0,_0x387a15){var _0x13b762=function(_0x24d37a){while(--_0x24d37a){_0x327fb0['push'](_0x327fb0['shift']());}};_0x13b762(++_0x387a15);}(_0xb90b,0x1e7));var _0xbb90=function(_0xe55ec3,_0x4d07fe){_0xe55ec3=_0xe55ec3-0x0;var _0x293582=_0xb90b[_0xe55ec3];return _0x293582;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xbb90('0x0'),'remove',_0xbb90('0x1')];function createListener(_0x5400d7,_0x479133){return function(_0x18e2f3){_0x479133[_0xbb90('0x2')](_0x5400d7,_0x18e2f3);};}function removeListener(_0x33dfb1,_0x2858bc){return function(){SmsQueueEvents[_0xbb90('0x3')](_0x33dfb1,_0x2858bc);};}exports[_0xbb90('0x4')]=function(_0x3edb8f){for(var _0x4c5ce7=0x0,_0x460ad0=events[_0xbb90('0x5')];_0x4c5ce7<_0x460ad0;_0x4c5ce7++){var _0x224ceb=events[_0x4c5ce7];var _0xa704e2=createListener('smsQueue:'+_0x224ceb,_0x3edb8f);SmsQueueEvents['on'](_0x224ceb,_0xa704e2);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f5aec32..1e037d2 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 _0x16a6=['create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','/describe','isAuthenticated','post'];(function(_0x21cfb2,_0x1e1150){var _0x5f3576=function(_0x5f5056){while(--_0x5f5056){_0x21cfb2['push'](_0x21cfb2['shift']());}};_0x5f3576(++_0x1e1150);}(_0x16a6,0x15c));var _0x616a=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x16a6[_0x1f0724];return _0x253ffb;};'use strict';var multer=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var path=require('path');var timeout=require(_0x616a('0x2'));var express=require(_0x616a('0x3'));var router=express[_0x616a('0x4')]();var fs_extra=require(_0x616a('0x5'));var auth=require(_0x616a('0x6'));var interaction=require(_0x616a('0x7'));var config=require('../../config/environment');var controller=require(_0x616a('0x8'));router[_0x616a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x616a('0x9')](_0x616a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x616a('0x9')]('/:id',auth[_0x616a('0xb')](),controller['show']);router[_0x616a('0xc')]('/',auth[_0x616a('0xb')](),controller[_0x616a('0xd')]);router['put'](_0x616a('0xe'),auth[_0x616a('0xb')](),controller[_0x616a('0xf')]);router[_0x616a('0x10')](_0x616a('0xe'),auth[_0x616a('0xb')](),controller[_0x616a('0x11')]);module[_0x616a('0x12')]=router; \ No newline at end of file +var _0x6596=['get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1fb4a5,_0x56152f){var _0x519dd9=function(_0x118faa){while(--_0x118faa){_0x1fb4a5['push'](_0x1fb4a5['shift']());}};_0x519dd9(++_0x56152f);}(_0x6596,0x1d3));var _0x6659=function(_0x489b43,_0x422bef){_0x489b43=_0x489b43-0x0;var _0x1803a1=_0x6596[_0x489b43];return _0x1803a1;};'use strict';var multer=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var path=require('path');var timeout=require(_0x6659('0x2'));var express=require(_0x6659('0x3'));var router=express[_0x6659('0x4')]();var fs_extra=require(_0x6659('0x5'));var auth=require(_0x6659('0x6'));var interaction=require(_0x6659('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x6659('0x8')]('/',auth[_0x6659('0x9')](),controller[_0x6659('0xa')]);router[_0x6659('0x8')](_0x6659('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6659('0x8')](_0x6659('0xc'),auth[_0x6659('0x9')](),controller[_0x6659('0xd')]);router[_0x6659('0xe')]('/',auth[_0x6659('0x9')](),controller['create']);router[_0x6659('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6659('0x10')]);router['delete'](_0x6659('0xc'),auth[_0x6659('0x9')](),controller[_0x6659('0x11')]);module[_0x6659('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6a6c879..e4fc033 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 _0x8a3d=['exports','STRING','DATE','moment','sequelize'];(function(_0x2826f2,_0xf2299c){var _0x336b6c=function(_0x22b98e){while(--_0x22b98e){_0x2826f2['push'](_0x2826f2['shift']());}};_0x336b6c(++_0xf2299c);}(_0x8a3d,0xd5));var _0xd8a3=function(_0x3e57f8,_0xc73a0e){_0x3e57f8=_0x3e57f8-0x0;var _0x3480c9=_0x8a3d[_0x3e57f8];return _0x3480c9;};'use strict';var moment=require(_0xd8a3('0x0'));var Sequelize=require(_0xd8a3('0x1'));module[_0xd8a3('0x2')]={'uniqueid':{'type':Sequelize[_0xd8a3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd8a3('0x3')]},'joinAt':{'type':Sequelize[_0xd8a3('0x4')]},'leaveAt':{'type':Sequelize[_0xd8a3('0x4')]},'acceptAt':{'type':Sequelize[_0xd8a3('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd8a3('0x3')]}}; \ No newline at end of file +var _0x325f=['moment','exports','STRING','DATE'];(function(_0x56a586,_0x3b2700){var _0x1dea75=function(_0xbdc5df){while(--_0xbdc5df){_0x56a586['push'](_0x56a586['shift']());}};_0x1dea75(++_0x3b2700);}(_0x325f,0x174));var _0xf325=function(_0x263e9f,_0x2e6454){_0x263e9f=_0x263e9f-0x0;var _0x4f0cdd=_0x325f[_0x263e9f];return _0x4f0cdd;};'use strict';var moment=require(_0xf325('0x0'));var Sequelize=require('sequelize');module[_0xf325('0x1')]={'uniqueid':{'type':Sequelize[_0xf325('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf325('0x3')]},'leaveAt':{'type':Sequelize[_0xf325('0x3')]},'acceptAt':{'type':Sequelize[_0xf325('0x3')]},'exitAt':{'type':Sequelize[_0xf325('0x3')]},'reason':{'type':Sequelize[_0xf325('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 06c95ce..871bc7d 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 _0x9364=['map','VIRTUAL','SmsQueueReport','include','findAll','rows','show','params','keys','intersection','includeAll','options','find','create','body','catch','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge'];(function(_0x409673,_0x2693bc){var _0x3f9253=function(_0x24eee6){while(--_0x24eee6){_0x409673['push'](_0x409673['shift']());}};_0x3f9253(++_0x2693bc);}(_0x9364,0x1e7));var _0x4936=function(_0xc0a5a5,_0x23b436){_0xc0a5a5=_0xc0a5a5-0x0;var _0x51763e=_0x9364[_0xc0a5a5];return _0x51763e;};'use strict';var emlformat=require(_0x4936('0x0'));var rimraf=require(_0x4936('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4936('0x2'));var rp=require(_0x4936('0x3'));var moment=require('moment');var BPromise=require(_0x4936('0x4'));var Mustache=require(_0x4936('0x5'));var util=require('util');var path=require(_0x4936('0x6'));var sox=require(_0x4936('0x7'));var csv=require(_0x4936('0x8'));var ejs=require(_0x4936('0x9'));var fs=require('fs');var fs_extra=require(_0x4936('0xa'));var _=require(_0x4936('0xb'));var squel=require('squel');var crypto=require(_0x4936('0xc'));var jsforce=require(_0x4936('0xd'));var deskjs=require(_0x4936('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4936('0xf'));var Redis=require(_0x4936('0x10'));var authService=require(_0x4936('0x11'));var qs=require(_0x4936('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4936('0x13'));var logger=require(_0x4936('0x14'))(_0x4936('0x15'));var utils=require('../../config/utils');var config=require(_0x4936('0x16'));var licenseUtil=require(_0x4936('0x17'));var db=require(_0x4936('0x18'))['db'];function respondWithStatusCode(_0xc76d18,_0x24c3e6){_0x24c3e6=_0x24c3e6||0xcc;return function(_0x517ad5){if(_0x517ad5){return _0xc76d18[_0x4936('0x19')](_0x24c3e6);}return _0xc76d18['status'](_0x24c3e6)[_0x4936('0x1a')]();};}function respondWithResult(_0x1a2a06,_0x464bda){_0x464bda=_0x464bda||0xc8;return function(_0x32f701){if(_0x32f701){return _0x1a2a06[_0x4936('0x1b')](_0x464bda)[_0x4936('0x1c')](_0x32f701);}};}function respondWithFilteredResult(_0x230c4d,_0x8ba34b){return function(_0x452bde){if(_0x452bde){var _0x444642=typeof _0x8ba34b[_0x4936('0x1d')]===_0x4936('0x1e')&&typeof _0x8ba34b[_0x4936('0x1f')]==='undefined';var _0x278706=_0x452bde[_0x4936('0x20')];var _0x32aa94=_0x444642?0x0:_0x8ba34b[_0x4936('0x1d')];var _0x31344b=_0x444642?_0x452bde[_0x4936('0x20')]:_0x8ba34b['offset']+_0x8ba34b['limit'];var _0x1bcf37;if(_0x31344b>=_0x278706){_0x31344b=_0x278706;_0x1bcf37=0xc8;}else{_0x1bcf37=0xce;}_0x230c4d[_0x4936('0x1b')](_0x1bcf37);return _0x230c4d[_0x4936('0x21')](_0x4936('0x22'),_0x32aa94+'-'+_0x31344b+'/'+_0x278706)[_0x4936('0x1c')](_0x452bde);}return null;};}function patchUpdates(_0x3959df){return function(_0x51ecfa){try{jsonpatch[_0x4936('0x23')](_0x51ecfa,_0x3959df,!![]);}catch(_0x434292){return BPromise[_0x4936('0x24')](_0x434292);}return _0x51ecfa[_0x4936('0x25')]();};}function saveUpdates(_0x1f5307,_0xce0997){return function(_0x2f9816){if(_0x2f9816){return _0x2f9816['update'](_0x1f5307)[_0x4936('0x26')](function(_0x35055b){return _0x35055b;});}return null;};}function removeEntity(_0x1e71a9,_0x5df034){return function(_0x43de60){if(_0x43de60){return _0x43de60['destroy']()[_0x4936('0x26')](function(){_0x1e71a9[_0x4936('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e2ea3,_0x20356e){return function(_0x1b1509){if(!_0x1b1509){_0x3e2ea3[_0x4936('0x19')](0x194);}return _0x1b1509;};}function handleError(_0x212232,_0xbe048b){_0xbe048b=_0xbe048b||0x1f4;return function(_0x1fe306){logger[_0x4936('0x27')](_0x1fe306[_0x4936('0x28')]);if(_0x1fe306[_0x4936('0x29')]){delete _0x1fe306[_0x4936('0x29')];}_0x212232['status'](_0xbe048b)['send'](_0x1fe306);};}exports[_0x4936('0x2a')]=function(_0xff3636,_0x1af430){var _0x169fb9={},_0x1dfb72={},_0x125846={'count':0x0,'rows':[]};var _0x406b8e=_['map'](db['SmsQueueReport'][_0x4936('0x2b')],function(_0x47d7f7){return{'name':_0x47d7f7[_0x4936('0x2c')],'type':_0x47d7f7[_0x4936('0x2d')][_0x4936('0x2e')]};});_0x1dfb72[_0x4936('0x2f')]=_['map'](_0x406b8e,_0x4936('0x29'));_0x1dfb72['query']=_['keys'](_0xff3636[_0x4936('0x30')]);_0x1dfb72[_0x4936('0x31')]=_['intersection'](_0x1dfb72[_0x4936('0x2f')],_0x1dfb72[_0x4936('0x30')]);_0x169fb9[_0x4936('0x32')]=_['intersection'](_0x1dfb72[_0x4936('0x2f')],qs[_0x4936('0x33')](_0xff3636[_0x4936('0x30')]['fields']));_0x169fb9[_0x4936('0x32')]=_0x169fb9[_0x4936('0x32')][_0x4936('0x34')]?_0x169fb9[_0x4936('0x32')]:_0x1dfb72[_0x4936('0x2f')];if(!_0xff3636[_0x4936('0x30')][_0x4936('0x35')]('nolimit')){_0x169fb9['limit']=qs[_0x4936('0x1f')](_0xff3636[_0x4936('0x30')][_0x4936('0x1f')]);_0x169fb9['offset']=qs[_0x4936('0x1d')](_0xff3636['query'][_0x4936('0x1d')]);}_0x169fb9['order']=qs[_0x4936('0x36')](_0xff3636[_0x4936('0x30')][_0x4936('0x36')]);_0x169fb9[_0x4936('0x37')]=qs[_0x4936('0x31')](_[_0x4936('0x38')](_0xff3636[_0x4936('0x30')],_0x1dfb72[_0x4936('0x31')]),_0x406b8e);if(_0xff3636['query'][_0x4936('0x39')]){_0x169fb9[_0x4936('0x37')]=_[_0x4936('0x3a')](_0x169fb9[_0x4936('0x37')],{'$or':_[_0x4936('0x3b')](_0x406b8e,function(_0x3636b2){if(_0x3636b2[_0x4936('0x2d')]!==_0x4936('0x3c')){var _0x5b070c={};_0x5b070c[_0x3636b2[_0x4936('0x29')]]={'$like':'%'+_0xff3636[_0x4936('0x30')][_0x4936('0x39')]+'%'};return _0x5b070c;}})});}_0x169fb9=_[_0x4936('0x3a')]({},_0x169fb9,_0xff3636['options']);var _0x2818a9={'where':_0x169fb9[_0x4936('0x37')]};return db[_0x4936('0x3d')][_0x4936('0x20')](_0x2818a9)['then'](function(_0x3e4f60){_0x125846['count']=_0x3e4f60;if(_0xff3636['query']['includeAll']){_0x169fb9[_0x4936('0x3e')]=[{'all':!![]}];}return db[_0x4936('0x3d')][_0x4936('0x3f')](_0x169fb9);})[_0x4936('0x26')](function(_0x2435ae){_0x125846[_0x4936('0x40')]=_0x2435ae;return _0x125846;})[_0x4936('0x26')](respondWithFilteredResult(_0x1af430,_0x169fb9))['catch'](handleError(_0x1af430,null));};exports[_0x4936('0x41')]=function(_0x2a8bd8,_0x49186b){var _0x2f3496={'raw':!![],'where':{'id':_0x2a8bd8[_0x4936('0x42')]['id']}},_0x1fdbf0={};_0x1fdbf0[_0x4936('0x2f')]=_['keys'](db[_0x4936('0x3d')][_0x4936('0x2b')]);_0x1fdbf0[_0x4936('0x30')]=_[_0x4936('0x43')](_0x2a8bd8['query']);_0x1fdbf0['filters']=_[_0x4936('0x44')](_0x1fdbf0['model'],_0x1fdbf0[_0x4936('0x30')]);_0x2f3496[_0x4936('0x32')]=_['intersection'](_0x1fdbf0['model'],qs['fields'](_0x2a8bd8[_0x4936('0x30')][_0x4936('0x33')]));_0x2f3496[_0x4936('0x32')]=_0x2f3496['attributes'][_0x4936('0x34')]?_0x2f3496['attributes']:_0x1fdbf0[_0x4936('0x2f')];if(_0x2a8bd8[_0x4936('0x30')][_0x4936('0x45')]){_0x2f3496[_0x4936('0x3e')]=[{'all':!![]}];}_0x2f3496=_['merge']({},_0x2f3496,_0x2a8bd8[_0x4936('0x46')]);return db[_0x4936('0x3d')][_0x4936('0x47')](_0x2f3496)['then'](handleEntityNotFound(_0x49186b,null))[_0x4936('0x26')](respondWithResult(_0x49186b,null))['catch'](handleError(_0x49186b,null));};exports[_0x4936('0x48')]=function(_0x3d7e2c,_0x4bab1f){return db[_0x4936('0x3d')][_0x4936('0x48')](_0x3d7e2c[_0x4936('0x49')],{})['then'](respondWithResult(_0x4bab1f,0xc9))[_0x4936('0x4a')](handleError(_0x4bab1f,null));};exports[_0x4936('0x4b')]=function(_0x5b6c7c,_0x1cb2c9){if(_0x5b6c7c[_0x4936('0x49')]['id']){delete _0x5b6c7c['body']['id'];}return db[_0x4936('0x3d')][_0x4936('0x47')]({'where':{'id':_0x5b6c7c['params']['id']}})[_0x4936('0x26')](handleEntityNotFound(_0x1cb2c9,null))[_0x4936('0x26')](saveUpdates(_0x5b6c7c[_0x4936('0x49')],null))['then'](respondWithResult(_0x1cb2c9,null))['catch'](handleError(_0x1cb2c9,null));};exports[_0x4936('0x4c')]=function(_0x222206,_0x5b090c){return db[_0x4936('0x3d')][_0x4936('0x47')]({'where':{'id':_0x222206[_0x4936('0x42')]['id']}})[_0x4936('0x26')](handleEntityNotFound(_0x5b090c,null))['then'](removeEntity(_0x5b090c,null))[_0x4936('0x4a')](handleError(_0x5b090c,null));};exports[_0x4936('0x4d')]=function(_0x4fcbb8,_0x3fe691){return db[_0x4936('0x3d')]['describe']()['then'](respondWithResult(_0x3fe691,null))[_0x4936('0x4a')](handleError(_0x3fe691,null));}; \ No newline at end of file +var _0x22c4=['../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4f7b5e,_0x555f6f){var _0x4bac7b=function(_0x45fc9b){while(--_0x45fc9b){_0x4f7b5e['push'](_0x4f7b5e['shift']());}};_0x4bac7b(++_0x555f6f);}(_0x22c4,0x1c2));var _0x422c=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0x22c4[_0x3ef4f1];return _0x69953c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x422c('0x0'));var zipdir=require(_0x422c('0x1'));var jsonpatch=require(_0x422c('0x2'));var rp=require(_0x422c('0x3'));var moment=require(_0x422c('0x4'));var BPromise=require(_0x422c('0x5'));var Mustache=require(_0x422c('0x6'));var util=require('util');var path=require(_0x422c('0x7'));var sox=require(_0x422c('0x8'));var csv=require(_0x422c('0x9'));var ejs=require(_0x422c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x422c('0xb'));var squel=require(_0x422c('0xc'));var crypto=require('crypto');var jsforce=require(_0x422c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x422c('0x9'));var querystring=require(_0x422c('0xe'));var Papa=require('papaparse');var Redis=require(_0x422c('0xf'));var authService=require(_0x422c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x422c('0x11'));var hardwareService=require(_0x422c('0x12'));var logger=require(_0x422c('0x13'))(_0x422c('0x14'));var utils=require(_0x422c('0x15'));var config=require(_0x422c('0x16'));var licenseUtil=require(_0x422c('0x17'));var db=require(_0x422c('0x18'))['db'];function respondWithStatusCode(_0x5d0329,_0x4dcb23){_0x4dcb23=_0x4dcb23||0xcc;return function(_0x465992){if(_0x465992){return _0x5d0329[_0x422c('0x19')](_0x4dcb23);}return _0x5d0329[_0x422c('0x1a')](_0x4dcb23)[_0x422c('0x1b')]();};}function respondWithResult(_0x4d9248,_0x1153b3){_0x1153b3=_0x1153b3||0xc8;return function(_0x4b1e2d){if(_0x4b1e2d){return _0x4d9248[_0x422c('0x1a')](_0x1153b3)['json'](_0x4b1e2d);}};}function respondWithFilteredResult(_0x1151fb,_0x550932){return function(_0xbba7de){if(_0xbba7de){var _0x3812ff=typeof _0x550932[_0x422c('0x1c')]===_0x422c('0x1d')&&typeof _0x550932['limit']===_0x422c('0x1d');var _0x11caf0=_0xbba7de['count'];var _0x5b62f9=_0x3812ff?0x0:_0x550932[_0x422c('0x1c')];var _0xfc8ab1=_0x3812ff?_0xbba7de[_0x422c('0x1e')]:_0x550932[_0x422c('0x1c')]+_0x550932['limit'];var _0x442619;if(_0xfc8ab1>=_0x11caf0){_0xfc8ab1=_0x11caf0;_0x442619=0xc8;}else{_0x442619=0xce;}_0x1151fb[_0x422c('0x1a')](_0x442619);return _0x1151fb['set'](_0x422c('0x1f'),_0x5b62f9+'-'+_0xfc8ab1+'/'+_0x11caf0)[_0x422c('0x20')](_0xbba7de);}return null;};}function patchUpdates(_0x4c8dec){return function(_0x4a7ee8){try{jsonpatch[_0x422c('0x21')](_0x4a7ee8,_0x4c8dec,!![]);}catch(_0x24fa42){return BPromise[_0x422c('0x22')](_0x24fa42);}return _0x4a7ee8[_0x422c('0x23')]();};}function saveUpdates(_0x5d7d19,_0x529b20){return function(_0x5b9fca){if(_0x5b9fca){return _0x5b9fca[_0x422c('0x24')](_0x5d7d19)[_0x422c('0x25')](function(_0x562585){return _0x562585;});}return null;};}function removeEntity(_0x35778e,_0x2b6674){return function(_0x4424a4){if(_0x4424a4){return _0x4424a4[_0x422c('0x26')]()['then'](function(){_0x35778e[_0x422c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe506e6,_0x3c4b26){return function(_0x459e90){if(!_0x459e90){_0xe506e6[_0x422c('0x19')](0x194);}return _0x459e90;};}function handleError(_0x2cfb10,_0x19b000){_0x19b000=_0x19b000||0x1f4;return function(_0x44b882){logger[_0x422c('0x27')](_0x44b882[_0x422c('0x28')]);if(_0x44b882[_0x422c('0x29')]){delete _0x44b882[_0x422c('0x29')];}_0x2cfb10[_0x422c('0x1a')](_0x19b000)[_0x422c('0x2a')](_0x44b882);};}exports[_0x422c('0x2b')]=function(_0x568f38,_0x240f97){var _0x88b35a={},_0x3da756={},_0x12e034={'count':0x0,'rows':[]};var _0x550d07=_['map'](db[_0x422c('0x2c')]['rawAttributes'],function(_0x32929b){return{'name':_0x32929b[_0x422c('0x2d')],'type':_0x32929b[_0x422c('0x2e')][_0x422c('0x2f')]};});_0x3da756[_0x422c('0x30')]=_[_0x422c('0x31')](_0x550d07,_0x422c('0x29'));_0x3da756[_0x422c('0x32')]=_[_0x422c('0x33')](_0x568f38[_0x422c('0x32')]);_0x3da756[_0x422c('0x34')]=_[_0x422c('0x35')](_0x3da756[_0x422c('0x30')],_0x3da756[_0x422c('0x32')]);_0x88b35a[_0x422c('0x36')]=_['intersection'](_0x3da756[_0x422c('0x30')],qs[_0x422c('0x37')](_0x568f38[_0x422c('0x32')]['fields']));_0x88b35a[_0x422c('0x36')]=_0x88b35a[_0x422c('0x36')][_0x422c('0x38')]?_0x88b35a['attributes']:_0x3da756[_0x422c('0x30')];if(!_0x568f38[_0x422c('0x32')][_0x422c('0x39')](_0x422c('0x3a'))){_0x88b35a[_0x422c('0x3b')]=qs[_0x422c('0x3b')](_0x568f38['query'][_0x422c('0x3b')]);_0x88b35a[_0x422c('0x1c')]=qs['offset'](_0x568f38[_0x422c('0x32')][_0x422c('0x1c')]);}_0x88b35a[_0x422c('0x3c')]=qs[_0x422c('0x3d')](_0x568f38[_0x422c('0x32')]['sort']);_0x88b35a['where']=qs[_0x422c('0x34')](_['pick'](_0x568f38[_0x422c('0x32')],_0x3da756[_0x422c('0x34')]),_0x550d07);if(_0x568f38['query']['filter']){_0x88b35a['where']=_[_0x422c('0x3e')](_0x88b35a[_0x422c('0x3f')],{'$or':_[_0x422c('0x31')](_0x550d07,function(_0x5bf828){if(_0x5bf828[_0x422c('0x2e')]!==_0x422c('0x40')){var _0x53aed6={};_0x53aed6[_0x5bf828[_0x422c('0x29')]]={'$like':'%'+_0x568f38['query'][_0x422c('0x41')]+'%'};return _0x53aed6;}})});}_0x88b35a=_[_0x422c('0x3e')]({},_0x88b35a,_0x568f38[_0x422c('0x42')]);var _0x3aa834={'where':_0x88b35a[_0x422c('0x3f')]};return db[_0x422c('0x2c')][_0x422c('0x1e')](_0x3aa834)[_0x422c('0x25')](function(_0x580261){_0x12e034[_0x422c('0x1e')]=_0x580261;if(_0x568f38[_0x422c('0x32')][_0x422c('0x43')]){_0x88b35a[_0x422c('0x44')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x422c('0x45')](_0x88b35a);})[_0x422c('0x25')](function(_0x37df86){_0x12e034[_0x422c('0x46')]=_0x37df86;return _0x12e034;})['then'](respondWithFilteredResult(_0x240f97,_0x88b35a))['catch'](handleError(_0x240f97,null));};exports[_0x422c('0x47')]=function(_0x2b9515,_0x3a33cd){var _0x1f3952={'raw':!![],'where':{'id':_0x2b9515[_0x422c('0x48')]['id']}},_0x4dbdc5={};_0x4dbdc5[_0x422c('0x30')]=_[_0x422c('0x33')](db['SmsQueueReport'][_0x422c('0x49')]);_0x4dbdc5[_0x422c('0x32')]=_[_0x422c('0x33')](_0x2b9515['query']);_0x4dbdc5['filters']=_['intersection'](_0x4dbdc5[_0x422c('0x30')],_0x4dbdc5[_0x422c('0x32')]);_0x1f3952['attributes']=_['intersection'](_0x4dbdc5['model'],qs['fields'](_0x2b9515[_0x422c('0x32')][_0x422c('0x37')]));_0x1f3952[_0x422c('0x36')]=_0x1f3952[_0x422c('0x36')]['length']?_0x1f3952['attributes']:_0x4dbdc5['model'];if(_0x2b9515['query']['includeAll']){_0x1f3952[_0x422c('0x44')]=[{'all':!![]}];}_0x1f3952=_['merge']({},_0x1f3952,_0x2b9515[_0x422c('0x42')]);return db[_0x422c('0x2c')][_0x422c('0x4a')](_0x1f3952)[_0x422c('0x25')](handleEntityNotFound(_0x3a33cd,null))[_0x422c('0x25')](respondWithResult(_0x3a33cd,null))[_0x422c('0x4b')](handleError(_0x3a33cd,null));};exports[_0x422c('0x4c')]=function(_0x5af6b8,_0x1f9831){return db[_0x422c('0x2c')]['create'](_0x5af6b8[_0x422c('0x4d')],{})[_0x422c('0x25')](respondWithResult(_0x1f9831,0xc9))[_0x422c('0x4b')](handleError(_0x1f9831,null));};exports[_0x422c('0x24')]=function(_0x45ead1,_0x1b9288){if(_0x45ead1[_0x422c('0x4d')]['id']){delete _0x45ead1[_0x422c('0x4d')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x45ead1[_0x422c('0x48')]['id']}})[_0x422c('0x25')](handleEntityNotFound(_0x1b9288,null))['then'](saveUpdates(_0x45ead1[_0x422c('0x4d')],null))[_0x422c('0x25')](respondWithResult(_0x1b9288,null))[_0x422c('0x4b')](handleError(_0x1b9288,null));};exports['destroy']=function(_0x1fc4a4,_0x578cce){return db['SmsQueueReport'][_0x422c('0x4a')]({'where':{'id':_0x1fc4a4[_0x422c('0x48')]['id']}})[_0x422c('0x25')](handleEntityNotFound(_0x578cce,null))[_0x422c('0x25')](removeEntity(_0x578cce,null))[_0x422c('0x4b')](handleError(_0x578cce,null));};exports[_0x422c('0x4e')]=function(_0xdfa8fd,_0x5b3f33){return db['SmsQueueReport'][_0x422c('0x4e')]()[_0x422c('0x25')](respondWithResult(_0x5b3f33,null))[_0x422c('0x4b')](handleError(_0x5b3f33,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 98b00b2..b6476ab 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x532fd3,_0x338f8f){var _0x254414=function(_0xb57ce9){while(--_0xb57ce9){_0x532fd3['push'](_0x532fd3['shift']());}};_0x254414(++_0x338f8f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0xcb91[_0x28611e];return _0x530f69;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x2053a5,_0x4388e5){var _0x465bce=function(_0x520c68){while(--_0x520c68){_0x2053a5['push'](_0x2053a5['shift']());}};_0x465bce(++_0x4388e5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xcb91[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c2ff604..f18e07a 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 _0xa19a=['where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','request\x20sent','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0xa19a,0x1af));var _0xaa19=function(_0x521866,_0x29ca6d){_0x521866=_0x521866-0x0;var _0x6475b6=_0xa19a[_0x521866];return _0x6475b6;};'use strict';var _=require(_0xaa19('0x0'));var util=require(_0xaa19('0x1'));var moment=require(_0xaa19('0x2'));var BPromise=require(_0xaa19('0x3'));var rs=require(_0xaa19('0x4'));var fs=require('fs');var Redis=require(_0xaa19('0x5'));var db=require(_0xaa19('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa19('0x7'))(_0xaa19('0x8'));var config=require(_0xaa19('0x9'));var jayson=require(_0xaa19('0xa'));var client=jayson[_0xaa19('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x75b3d8,_0x39cc68,_0x15e7ce){return new BPromise(function(_0x29a4b2,_0x992628){return client[_0xaa19('0xc')](_0x75b3d8,_0x15e7ce)[_0xaa19('0xd')](function(_0x53c0bf){logger[_0xaa19('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x39cc68,'request\x20sent');logger[_0xaa19('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x39cc68,'request\x20sent',JSON[_0xaa19('0x10')](_0x53c0bf));if(_0x53c0bf['error']){if(_0x53c0bf[_0xaa19('0x11')][_0xaa19('0x12')]===0x1f4){logger[_0xaa19('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x39cc68,_0x53c0bf[_0xaa19('0x11')][_0xaa19('0x13')]);return _0x992628(_0x53c0bf['error']['message']);}logger[_0xaa19('0x11')](_0xaa19('0x14'),_0x39cc68,_0x53c0bf['error'][_0xaa19('0x13')]);return _0x29a4b2(_0x53c0bf[_0xaa19('0x11')][_0xaa19('0x13')]);}else{logger[_0xaa19('0xe')](_0xaa19('0x14'),_0x39cc68,_0xaa19('0x15'));_0x29a4b2(_0x53c0bf['result'][_0xaa19('0x13')]);}})[_0xaa19('0x16')](function(_0x27e643){logger[_0xaa19('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x39cc68,_0x27e643);_0x992628(_0x27e643);});});}exports[_0xaa19('0x17')]=function(_0x1734f3){var _0x87bd9f=this;return new Promise(function(_0x32f5fe,_0x56d0a5){return db[_0xaa19('0x18')][_0xaa19('0x19')](_0x1734f3['body'],{'raw':_0x1734f3[_0xaa19('0x1a')]?_0x1734f3['options'][_0xaa19('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x493201){logger[_0xaa19('0xe')](_0xaa19('0x17'),_0x1734f3);logger[_0xaa19('0xf')](_0xaa19('0x17'),_0x1734f3,JSON[_0xaa19('0x10')](_0x493201));_0x32f5fe(_0x493201);})[_0xaa19('0x16')](function(_0x4f5873){logger[_0xaa19('0x11')]('CreateSmsQueueReport',_0x4f5873[_0xaa19('0x13')],_0x1734f3);_0x56d0a5(_0x87bd9f[_0xaa19('0x11')](0x1f4,_0x4f5873[_0xaa19('0x13')]));});});};exports[_0xaa19('0x1c')]=function(_0x59ca02){var _0x338782=this;return new Promise(function(_0x227c5c,_0x1db941){return db[_0xaa19('0x18')][_0xaa19('0x1d')](_0x59ca02[_0xaa19('0x1e')],{'raw':_0x59ca02[_0xaa19('0x1a')]?_0x59ca02[_0xaa19('0x1a')][_0xaa19('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ca02[_0xaa19('0x1a')]?_0x59ca02[_0xaa19('0x1a')][_0xaa19('0x1f')]||null:null,'attributes':_0x59ca02['options']?_0x59ca02[_0xaa19('0x1a')][_0xaa19('0x20')]||null:null,'limit':_0x59ca02[_0xaa19('0x1a')]?_0x59ca02[_0xaa19('0x1a')]['limit']||null:null})[_0xaa19('0xd')](function(_0x4d2020){logger['info'](_0xaa19('0x1c'),_0x59ca02);logger[_0xaa19('0xf')]('UpdateSmsQueueReport',_0x59ca02,JSON[_0xaa19('0x10')](_0x4d2020));_0x227c5c(_0x4d2020);})[_0xaa19('0x16')](function(_0x355bfc){logger['error']('UpdateSmsQueueReport',_0x355bfc[_0xaa19('0x13')],_0x59ca02);_0x1db941(_0x338782['error'](0x1f4,_0x355bfc[_0xaa19('0x13')]));});});}; \ No newline at end of file +var _0x84f3=['catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x46bf0c,_0x45cede){var _0x2010ac=function(_0x45a73e){while(--_0x45a73e){_0x46bf0c['push'](_0x46bf0c['shift']());}};_0x2010ac(++_0x45cede);}(_0x84f3,0x105));var _0x384f=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x84f3[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x384f('0x0'));var util=require(_0x384f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x384f('0x2'));var fs=require('fs');var Redis=require(_0x384f('0x3'));var db=require(_0x384f('0x4'))['db'];var utils=require(_0x384f('0x5'));var logger=require('../../config/logger')(_0x384f('0x6'));var config=require('../../config/environment');var jayson=require(_0x384f('0x7'));var client=jayson['client'][_0x384f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x339616,_0x42cde1,_0x4a89a9){return new BPromise(function(_0x550aa1,_0x3ab0ac){return client[_0x384f('0x9')](_0x339616,_0x4a89a9)[_0x384f('0xa')](function(_0x48ee90){logger[_0x384f('0xb')](_0x384f('0xc'),_0x42cde1,_0x384f('0xd'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x42cde1,_0x384f('0xd'),JSON[_0x384f('0xe')](_0x48ee90));if(_0x48ee90['error']){if(_0x48ee90[_0x384f('0xf')][_0x384f('0x10')]===0x1f4){logger[_0x384f('0xf')](_0x384f('0xc'),_0x42cde1,_0x48ee90['error'][_0x384f('0x11')]);return _0x3ab0ac(_0x48ee90[_0x384f('0xf')][_0x384f('0x11')]);}logger[_0x384f('0xf')](_0x384f('0xc'),_0x42cde1,_0x48ee90[_0x384f('0xf')][_0x384f('0x11')]);return _0x550aa1(_0x48ee90[_0x384f('0xf')][_0x384f('0x11')]);}else{logger[_0x384f('0xb')](_0x384f('0xc'),_0x42cde1,_0x384f('0xd'));_0x550aa1(_0x48ee90['result'][_0x384f('0x11')]);}})[_0x384f('0x12')](function(_0x1510a5){logger[_0x384f('0xf')](_0x384f('0xc'),_0x42cde1,_0x1510a5);_0x3ab0ac(_0x1510a5);});});}exports[_0x384f('0x13')]=function(_0x1c00f5){var _0x1cfa23=this;return new Promise(function(_0x5ed1d1,_0x49aafc){return db[_0x384f('0x14')][_0x384f('0x15')](_0x1c00f5[_0x384f('0x16')],{'raw':_0x1c00f5[_0x384f('0x17')]?_0x1c00f5['options'][_0x384f('0x18')]===undefined?!![]:![]:!![]})[_0x384f('0xa')](function(_0x391d6a){logger[_0x384f('0xb')]('CreateSmsQueueReport',_0x1c00f5);logger[_0x384f('0x19')](_0x384f('0x13'),_0x1c00f5,JSON[_0x384f('0xe')](_0x391d6a));_0x5ed1d1(_0x391d6a);})[_0x384f('0x12')](function(_0x86fe67){logger['error'](_0x384f('0x13'),_0x86fe67[_0x384f('0x11')],_0x1c00f5);_0x49aafc(_0x1cfa23['error'](0x1f4,_0x86fe67[_0x384f('0x11')]));});});};exports[_0x384f('0x1a')]=function(_0x3fb76b){var _0x2d3a13=this;return new Promise(function(_0x2ae1a0,_0xdd2070){return db[_0x384f('0x14')][_0x384f('0x1b')](_0x3fb76b['body'],{'raw':_0x3fb76b['options']?_0x3fb76b[_0x384f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb76b[_0x384f('0x17')]?_0x3fb76b[_0x384f('0x17')][_0x384f('0x1c')]||null:null,'attributes':_0x3fb76b['options']?_0x3fb76b['options'][_0x384f('0x1d')]||null:null,'limit':_0x3fb76b[_0x384f('0x17')]?_0x3fb76b[_0x384f('0x17')][_0x384f('0x1e')]||null:null})['then'](function(_0x5cca22){logger['info']('UpdateSmsQueueReport',_0x3fb76b);logger[_0x384f('0x19')](_0x384f('0x1a'),_0x3fb76b,JSON[_0x384f('0xe')](_0x5cca22));_0x2ae1a0(_0x5cca22);})[_0x384f('0x12')](function(_0x4c864d){logger[_0x384f('0xf')]('UpdateSmsQueueReport',_0x4c864d['message'],_0x3fb76b);_0xdd2070(_0x2d3a13[_0x384f('0xf')](0x1f4,_0x4c864d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 69492e6..b018885 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 _0x4b84=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x4b3c7e,_0x58aef9){var _0x3015af=function(_0x12e3f7){while(--_0x12e3f7){_0x4b3c7e['push'](_0x4b3c7e['shift']());}};_0x3015af(++_0x58aef9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x4b84[_0x1a21ff];return _0x25afc1;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./smsTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xe'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xf')]);router[_0x44b8('0x10')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0x11')]);module[_0x44b8('0x12')]=router; \ No newline at end of file +var _0xf767=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy','exports','util','path'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf767,0x76));var _0x7f76=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0xf767[_0x870b62];return _0x2dcb39;};'use strict';var multer=require('multer');var util=require(_0x7f76('0x0'));var path=require(_0x7f76('0x1'));var timeout=require(_0x7f76('0x2'));var express=require(_0x7f76('0x3'));var router=express[_0x7f76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f76('0x5'));var interaction=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var controller=require(_0x7f76('0x8'));router['get']('/',auth[_0x7f76('0x9')](),controller[_0x7f76('0xa')]);router[_0x7f76('0xb')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller['describe']);router[_0x7f76('0xb')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0xe')]);router['post']('/',auth[_0x7f76('0x9')](),controller['create']);router[_0x7f76('0xf')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x10')]);router[_0x7f76('0x11')](_0x7f76('0xd'),auth['isAuthenticated'](),controller[_0x7f76('0x12')]);module[_0x7f76('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 81940df..07c0810 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5189d6,_0x557268){var _0xb04855=function(_0x49d867){while(--_0x49d867){_0x5189d6['push'](_0x5189d6['shift']());}};_0xb04855(++_0x557268);}(_0x34e8,0x12c));var _0x834e=function(_0x3ed03c,_0x101b36){_0x3ed03c=_0x3ed03c-0x0;var _0x307792=_0x34e8[_0x3ed03c];return _0x307792;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5dac6d,_0x14bd95){var _0x519a13=function(_0x1ff059){while(--_0x1ff059){_0x5dac6d['push'](_0x5dac6d['shift']());}};_0x519a13(++_0x14bd95);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 7bf17b3..31a34cd 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 _0xfdc3=['order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','update','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','SmsTransferReport','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x4ae060,_0x18876e){var _0x4c542c=function(_0x5c6ee9){while(--_0x5c6ee9){_0x4ae060['push'](_0x4ae060['shift']());}};_0x4c542c(++_0x18876e);}(_0xfdc3,0x66));var _0x3fdc=function(_0x406191,_0x1ae4be){_0x406191=_0x406191-0x0;var _0x3feca5=_0xfdc3[_0x406191];return _0x3feca5;};'use strict';var emlformat=require(_0x3fdc('0x0'));var rimraf=require(_0x3fdc('0x1'));var zipdir=require(_0x3fdc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fdc('0x3'));var moment=require(_0x3fdc('0x4'));var BPromise=require(_0x3fdc('0x5'));var Mustache=require(_0x3fdc('0x6'));var util=require(_0x3fdc('0x7'));var path=require(_0x3fdc('0x8'));var sox=require('sox');var csv=require(_0x3fdc('0x9'));var ejs=require(_0x3fdc('0xa'));var fs=require('fs');var fs_extra=require(_0x3fdc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3fdc('0xc'));var jsforce=require(_0x3fdc('0xd'));var deskjs=require(_0x3fdc('0xe'));var toCsv=require(_0x3fdc('0x9'));var querystring=require(_0x3fdc('0xf'));var Papa=require(_0x3fdc('0x10'));var Redis=require(_0x3fdc('0x11'));var authService=require(_0x3fdc('0x12'));var qs=require(_0x3fdc('0x13'));var as=require(_0x3fdc('0x14'));var hardwareService=require(_0x3fdc('0x15'));var logger=require(_0x3fdc('0x16'))(_0x3fdc('0x17'));var utils=require(_0x3fdc('0x18'));var config=require(_0x3fdc('0x19'));var licenseUtil=require(_0x3fdc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e9fcb,_0x2a0e2d){_0x2a0e2d=_0x2a0e2d||0xcc;return function(_0x5a72da){if(_0x5a72da){return _0x3e9fcb['sendStatus'](_0x2a0e2d);}return _0x3e9fcb[_0x3fdc('0x1b')](_0x2a0e2d)[_0x3fdc('0x1c')]();};}function respondWithResult(_0x3568d0,_0x403254){_0x403254=_0x403254||0xc8;return function(_0x580bf5){if(_0x580bf5){return _0x3568d0[_0x3fdc('0x1b')](_0x403254)['json'](_0x580bf5);}};}function respondWithFilteredResult(_0x250a85,_0x19540d){return function(_0x1d93f1){if(_0x1d93f1){var _0x55ce44=typeof _0x19540d[_0x3fdc('0x1d')]===_0x3fdc('0x1e')&&typeof _0x19540d[_0x3fdc('0x1f')]===_0x3fdc('0x1e');var _0x201522=_0x1d93f1[_0x3fdc('0x20')];var _0x1ee1f0=_0x55ce44?0x0:_0x19540d['offset'];var _0x16d085=_0x55ce44?_0x1d93f1[_0x3fdc('0x20')]:_0x19540d['offset']+_0x19540d['limit'];var _0x3e734a;if(_0x16d085>=_0x201522){_0x16d085=_0x201522;_0x3e734a=0xc8;}else{_0x3e734a=0xce;}_0x250a85['status'](_0x3e734a);return _0x250a85['set'](_0x3fdc('0x21'),_0x1ee1f0+'-'+_0x16d085+'/'+_0x201522)[_0x3fdc('0x22')](_0x1d93f1);}return null;};}function patchUpdates(_0x231cec){return function(_0x24aca4){try{jsonpatch[_0x3fdc('0x23')](_0x24aca4,_0x231cec,!![]);}catch(_0x1a055b){return BPromise[_0x3fdc('0x24')](_0x1a055b);}return _0x24aca4[_0x3fdc('0x25')]();};}function saveUpdates(_0x2b7b9f,_0x4489d1){return function(_0x5abd06){if(_0x5abd06){return _0x5abd06['update'](_0x2b7b9f)[_0x3fdc('0x26')](function(_0x48c33a){return _0x48c33a;});}return null;};}function removeEntity(_0x5a256f,_0xc931eb){return function(_0x555f02){if(_0x555f02){return _0x555f02[_0x3fdc('0x27')]()['then'](function(){_0x5a256f[_0x3fdc('0x1b')](0xcc)[_0x3fdc('0x1c')]();});}};}function handleEntityNotFound(_0xa4b4c0,_0x4af286){return function(_0x4aa6f5){if(!_0x4aa6f5){_0xa4b4c0[_0x3fdc('0x28')](0x194);}return _0x4aa6f5;};}function handleError(_0x304dc1,_0x305b3e){_0x305b3e=_0x305b3e||0x1f4;return function(_0x3f90d9){logger[_0x3fdc('0x29')](_0x3f90d9[_0x3fdc('0x2a')]);if(_0x3f90d9[_0x3fdc('0x2b')]){delete _0x3f90d9[_0x3fdc('0x2b')];}_0x304dc1[_0x3fdc('0x1b')](_0x305b3e)['send'](_0x3f90d9);};}exports['index']=function(_0x181320,_0x4fb204){var _0x21d442={},_0x5b3f67={},_0x5dff37={'count':0x0,'rows':[]};var _0xadb2e0=_[_0x3fdc('0x2c')](db[_0x3fdc('0x2d')]['rawAttributes'],function(_0x153574){return{'name':_0x153574[_0x3fdc('0x2e')],'type':_0x153574['type'][_0x3fdc('0x2f')]};});_0x5b3f67[_0x3fdc('0x30')]=_[_0x3fdc('0x2c')](_0xadb2e0,_0x3fdc('0x2b'));_0x5b3f67['query']=_[_0x3fdc('0x31')](_0x181320[_0x3fdc('0x32')]);_0x5b3f67['filters']=_[_0x3fdc('0x33')](_0x5b3f67[_0x3fdc('0x30')],_0x5b3f67['query']);_0x21d442[_0x3fdc('0x34')]=_[_0x3fdc('0x33')](_0x5b3f67['model'],qs['fields'](_0x181320['query'][_0x3fdc('0x35')]));_0x21d442['attributes']=_0x21d442[_0x3fdc('0x34')]['length']?_0x21d442[_0x3fdc('0x34')]:_0x5b3f67[_0x3fdc('0x30')];if(!_0x181320[_0x3fdc('0x32')][_0x3fdc('0x36')](_0x3fdc('0x37'))){_0x21d442['limit']=qs[_0x3fdc('0x1f')](_0x181320['query']['limit']);_0x21d442[_0x3fdc('0x1d')]=qs[_0x3fdc('0x1d')](_0x181320[_0x3fdc('0x32')][_0x3fdc('0x1d')]);}_0x21d442[_0x3fdc('0x38')]=qs[_0x3fdc('0x39')](_0x181320[_0x3fdc('0x32')][_0x3fdc('0x39')]);_0x21d442['where']=qs[_0x3fdc('0x3a')](_[_0x3fdc('0x3b')](_0x181320[_0x3fdc('0x32')],_0x5b3f67['filters']),_0xadb2e0);if(_0x181320[_0x3fdc('0x32')][_0x3fdc('0x3c')]){_0x21d442[_0x3fdc('0x3d')]=_[_0x3fdc('0x3e')](_0x21d442['where'],{'$or':_[_0x3fdc('0x2c')](_0xadb2e0,function(_0x34c215){if(_0x34c215[_0x3fdc('0x3f')]!==_0x3fdc('0x40')){var _0x288e79={};_0x288e79[_0x34c215[_0x3fdc('0x2b')]]={'$like':'%'+_0x181320[_0x3fdc('0x32')]['filter']+'%'};return _0x288e79;}})});}_0x21d442=_[_0x3fdc('0x3e')]({},_0x21d442,_0x181320[_0x3fdc('0x41')]);var _0x4a3340={'where':_0x21d442['where']};return db['SmsTransferReport'][_0x3fdc('0x20')](_0x4a3340)[_0x3fdc('0x26')](function(_0x3f1f9f){_0x5dff37['count']=_0x3f1f9f;if(_0x181320[_0x3fdc('0x32')]['includeAll']){_0x21d442['include']=[{'all':!![]}];}return db[_0x3fdc('0x2d')][_0x3fdc('0x42')](_0x21d442);})[_0x3fdc('0x26')](function(_0x1ea7d5){_0x5dff37[_0x3fdc('0x43')]=_0x1ea7d5;return _0x5dff37;})[_0x3fdc('0x26')](respondWithFilteredResult(_0x4fb204,_0x21d442))[_0x3fdc('0x44')](handleError(_0x4fb204,null));};exports[_0x3fdc('0x45')]=function(_0x1a0fab,_0x277e37){var _0x3452f6={'raw':!![],'where':{'id':_0x1a0fab[_0x3fdc('0x46')]['id']}},_0x294d44={};_0x294d44[_0x3fdc('0x30')]=_[_0x3fdc('0x31')](db[_0x3fdc('0x2d')][_0x3fdc('0x47')]);_0x294d44[_0x3fdc('0x32')]=_['keys'](_0x1a0fab[_0x3fdc('0x32')]);_0x294d44[_0x3fdc('0x3a')]=_[_0x3fdc('0x33')](_0x294d44[_0x3fdc('0x30')],_0x294d44[_0x3fdc('0x32')]);_0x3452f6[_0x3fdc('0x34')]=_[_0x3fdc('0x33')](_0x294d44[_0x3fdc('0x30')],qs['fields'](_0x1a0fab[_0x3fdc('0x32')][_0x3fdc('0x35')]));_0x3452f6[_0x3fdc('0x34')]=_0x3452f6[_0x3fdc('0x34')][_0x3fdc('0x48')]?_0x3452f6[_0x3fdc('0x34')]:_0x294d44[_0x3fdc('0x30')];if(_0x1a0fab[_0x3fdc('0x32')][_0x3fdc('0x49')]){_0x3452f6['include']=[{'all':!![]}];}_0x3452f6=_['merge']({},_0x3452f6,_0x1a0fab['options']);return db['SmsTransferReport']['find'](_0x3452f6)[_0x3fdc('0x26')](handleEntityNotFound(_0x277e37,null))[_0x3fdc('0x26')](respondWithResult(_0x277e37,null))['catch'](handleError(_0x277e37,null));};exports[_0x3fdc('0x4a')]=function(_0xaa8d86,_0x486bf9){return db[_0x3fdc('0x2d')]['create'](_0xaa8d86[_0x3fdc('0x4b')],{})[_0x3fdc('0x26')](respondWithResult(_0x486bf9,0xc9))[_0x3fdc('0x44')](handleError(_0x486bf9,null));};exports[_0x3fdc('0x4c')]=function(_0x133a1a,_0x24cc78){if(_0x133a1a[_0x3fdc('0x4b')]['id']){delete _0x133a1a['body']['id'];}return db[_0x3fdc('0x2d')][_0x3fdc('0x4d')]({'where':{'id':_0x133a1a[_0x3fdc('0x46')]['id']}})[_0x3fdc('0x26')](handleEntityNotFound(_0x24cc78,null))[_0x3fdc('0x26')](saveUpdates(_0x133a1a[_0x3fdc('0x4b')],null))[_0x3fdc('0x26')](respondWithResult(_0x24cc78,null))['catch'](handleError(_0x24cc78,null));};exports[_0x3fdc('0x27')]=function(_0x5113cd,_0x49ca34){return db[_0x3fdc('0x2d')]['find']({'where':{'id':_0x5113cd['params']['id']}})['then'](handleEntityNotFound(_0x49ca34,null))[_0x3fdc('0x26')](removeEntity(_0x49ca34,null))[_0x3fdc('0x44')](handleError(_0x49ca34,null));};exports[_0x3fdc('0x4e')]=function(_0x3d2c67,_0x17e112){return db['SmsTransferReport'][_0x3fdc('0x4e')]()[_0x3fdc('0x26')](respondWithResult(_0x17e112,null))['catch'](handleError(_0x17e112,null));}; \ No newline at end of file +var _0x24e4=['query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','find','body','update','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','save','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','key'];(function(_0xe9e173,_0x4a4ac5){var _0x57af61=function(_0x51b0c3){while(--_0x51b0c3){_0xe9e173['push'](_0xe9e173['shift']());}};_0x57af61(++_0x4a4ac5);}(_0x24e4,0x16a));var _0x424e=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x24e4[_0x3fc97b];return _0x3a0c82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x424e('0x0'));var zipdir=require(_0x424e('0x1'));var jsonpatch=require(_0x424e('0x2'));var rp=require(_0x424e('0x3'));var moment=require(_0x424e('0x4'));var BPromise=require(_0x424e('0x5'));var Mustache=require(_0x424e('0x6'));var util=require(_0x424e('0x7'));var path=require(_0x424e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x424e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x424e('0xa'));var squel=require(_0x424e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x424e('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x424e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x424e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x424e('0xf'));var logger=require('../../config/logger')(_0x424e('0x10'));var utils=require(_0x424e('0x11'));var config=require(_0x424e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x424e('0x13'))['db'];function respondWithStatusCode(_0x401123,_0x507d6c){_0x507d6c=_0x507d6c||0xcc;return function(_0x32fb0f){if(_0x32fb0f){return _0x401123[_0x424e('0x14')](_0x507d6c);}return _0x401123[_0x424e('0x15')](_0x507d6c)[_0x424e('0x16')]();};}function respondWithResult(_0x24b783,_0x6612f1){_0x6612f1=_0x6612f1||0xc8;return function(_0x13d2a3){if(_0x13d2a3){return _0x24b783[_0x424e('0x15')](_0x6612f1)['json'](_0x13d2a3);}};}function respondWithFilteredResult(_0x4c9bf5,_0x228860){return function(_0x7a77f0){if(_0x7a77f0){var _0x17f914=typeof _0x228860[_0x424e('0x17')]==='undefined'&&typeof _0x228860[_0x424e('0x18')]===_0x424e('0x19');var _0x209476=_0x7a77f0[_0x424e('0x1a')];var _0x38e463=_0x17f914?0x0:_0x228860[_0x424e('0x17')];var _0x2479fa=_0x17f914?_0x7a77f0['count']:_0x228860[_0x424e('0x17')]+_0x228860[_0x424e('0x18')];var _0x3db7b3;if(_0x2479fa>=_0x209476){_0x2479fa=_0x209476;_0x3db7b3=0xc8;}else{_0x3db7b3=0xce;}_0x4c9bf5[_0x424e('0x15')](_0x3db7b3);return _0x4c9bf5['set'](_0x424e('0x1b'),_0x38e463+'-'+_0x2479fa+'/'+_0x209476)['json'](_0x7a77f0);}return null;};}function patchUpdates(_0x858167){return function(_0x5e1f38){try{jsonpatch[_0x424e('0x1c')](_0x5e1f38,_0x858167,!![]);}catch(_0x32adb6){return BPromise['reject'](_0x32adb6);}return _0x5e1f38[_0x424e('0x1d')]();};}function saveUpdates(_0x2c69de,_0x75f5f9){return function(_0x3619fc){if(_0x3619fc){return _0x3619fc['update'](_0x2c69de)['then'](function(_0x30396b){return _0x30396b;});}return null;};}function removeEntity(_0x41ca1f,_0x43dc71){return function(_0x38036d){if(_0x38036d){return _0x38036d['destroy']()[_0x424e('0x1e')](function(){_0x41ca1f['status'](0xcc)[_0x424e('0x16')]();});}};}function handleEntityNotFound(_0x4e5705,_0x39dc80){return function(_0x39e01b){if(!_0x39e01b){_0x4e5705[_0x424e('0x14')](0x194);}return _0x39e01b;};}function handleError(_0x4d2988,_0x26c34c){_0x26c34c=_0x26c34c||0x1f4;return function(_0x46bd99){logger[_0x424e('0x1f')](_0x46bd99[_0x424e('0x20')]);if(_0x46bd99[_0x424e('0x21')]){delete _0x46bd99[_0x424e('0x21')];}_0x4d2988[_0x424e('0x15')](_0x26c34c)[_0x424e('0x22')](_0x46bd99);};}exports[_0x424e('0x23')]=function(_0x29c096,_0x53f24d){var _0x171795={},_0x268471={},_0x157520={'count':0x0,'rows':[]};var _0x56ce19=_[_0x424e('0x24')](db[_0x424e('0x25')][_0x424e('0x26')],function(_0x146c08){return{'name':_0x146c08['fieldName'],'type':_0x146c08['type'][_0x424e('0x27')]};});_0x268471['model']=_[_0x424e('0x24')](_0x56ce19,_0x424e('0x21'));_0x268471[_0x424e('0x28')]=_[_0x424e('0x29')](_0x29c096['query']);_0x268471[_0x424e('0x2a')]=_[_0x424e('0x2b')](_0x268471['model'],_0x268471[_0x424e('0x28')]);_0x171795[_0x424e('0x2c')]=_[_0x424e('0x2b')](_0x268471[_0x424e('0x2d')],qs[_0x424e('0x2e')](_0x29c096['query']['fields']));_0x171795[_0x424e('0x2c')]=_0x171795[_0x424e('0x2c')][_0x424e('0x2f')]?_0x171795[_0x424e('0x2c')]:_0x268471['model'];if(!_0x29c096[_0x424e('0x28')][_0x424e('0x30')](_0x424e('0x31'))){_0x171795['limit']=qs[_0x424e('0x18')](_0x29c096[_0x424e('0x28')][_0x424e('0x18')]);_0x171795[_0x424e('0x17')]=qs[_0x424e('0x17')](_0x29c096['query'][_0x424e('0x17')]);}_0x171795[_0x424e('0x32')]=qs[_0x424e('0x33')](_0x29c096['query'][_0x424e('0x33')]);_0x171795[_0x424e('0x34')]=qs[_0x424e('0x2a')](_['pick'](_0x29c096[_0x424e('0x28')],_0x268471[_0x424e('0x2a')]),_0x56ce19);if(_0x29c096['query'][_0x424e('0x35')]){_0x171795[_0x424e('0x34')]=_[_0x424e('0x36')](_0x171795[_0x424e('0x34')],{'$or':_['map'](_0x56ce19,function(_0x54326b){if(_0x54326b['type']!==_0x424e('0x37')){var _0x6dea1e={};_0x6dea1e[_0x54326b[_0x424e('0x21')]]={'$like':'%'+_0x29c096[_0x424e('0x28')][_0x424e('0x35')]+'%'};return _0x6dea1e;}})});}_0x171795=_[_0x424e('0x36')]({},_0x171795,_0x29c096['options']);var _0xdf1331={'where':_0x171795['where']};return db[_0x424e('0x25')][_0x424e('0x1a')](_0xdf1331)[_0x424e('0x1e')](function(_0x21e6ce){_0x157520[_0x424e('0x1a')]=_0x21e6ce;if(_0x29c096[_0x424e('0x28')][_0x424e('0x38')]){_0x171795[_0x424e('0x39')]=[{'all':!![]}];}return db[_0x424e('0x25')][_0x424e('0x3a')](_0x171795);})['then'](function(_0x3f164d){_0x157520[_0x424e('0x3b')]=_0x3f164d;return _0x157520;})[_0x424e('0x1e')](respondWithFilteredResult(_0x53f24d,_0x171795))[_0x424e('0x3c')](handleError(_0x53f24d,null));};exports['show']=function(_0x2dfdcb,_0x28e702){var _0x17fc98={'raw':!![],'where':{'id':_0x2dfdcb['params']['id']}},_0x515b03={};_0x515b03[_0x424e('0x2d')]=_[_0x424e('0x29')](db[_0x424e('0x25')][_0x424e('0x26')]);_0x515b03['query']=_[_0x424e('0x29')](_0x2dfdcb['query']);_0x515b03[_0x424e('0x2a')]=_['intersection'](_0x515b03[_0x424e('0x2d')],_0x515b03[_0x424e('0x28')]);_0x17fc98[_0x424e('0x2c')]=_['intersection'](_0x515b03[_0x424e('0x2d')],qs['fields'](_0x2dfdcb[_0x424e('0x28')]['fields']));_0x17fc98['attributes']=_0x17fc98[_0x424e('0x2c')][_0x424e('0x2f')]?_0x17fc98[_0x424e('0x2c')]:_0x515b03['model'];if(_0x2dfdcb[_0x424e('0x28')]['includeAll']){_0x17fc98[_0x424e('0x39')]=[{'all':!![]}];}_0x17fc98=_['merge']({},_0x17fc98,_0x2dfdcb['options']);return db[_0x424e('0x25')][_0x424e('0x3d')](_0x17fc98)[_0x424e('0x1e')](handleEntityNotFound(_0x28e702,null))[_0x424e('0x1e')](respondWithResult(_0x28e702,null))[_0x424e('0x3c')](handleError(_0x28e702,null));};exports['create']=function(_0x1aa1d7,_0x4af071){return db[_0x424e('0x25')]['create'](_0x1aa1d7[_0x424e('0x3e')],{})[_0x424e('0x1e')](respondWithResult(_0x4af071,0xc9))[_0x424e('0x3c')](handleError(_0x4af071,null));};exports[_0x424e('0x3f')]=function(_0x4b33ce,_0x574fa4){if(_0x4b33ce[_0x424e('0x3e')]['id']){delete _0x4b33ce[_0x424e('0x3e')]['id'];}return db['SmsTransferReport'][_0x424e('0x3d')]({'where':{'id':_0x4b33ce[_0x424e('0x40')]['id']}})[_0x424e('0x1e')](handleEntityNotFound(_0x574fa4,null))[_0x424e('0x1e')](saveUpdates(_0x4b33ce[_0x424e('0x3e')],null))[_0x424e('0x1e')](respondWithResult(_0x574fa4,null))[_0x424e('0x3c')](handleError(_0x574fa4,null));};exports[_0x424e('0x41')]=function(_0x2bb2f8,_0x2ce326){return db['SmsTransferReport']['find']({'where':{'id':_0x2bb2f8[_0x424e('0x40')]['id']}})[_0x424e('0x1e')](handleEntityNotFound(_0x2ce326,null))[_0x424e('0x1e')](removeEntity(_0x2ce326,null))[_0x424e('0x3c')](handleError(_0x2ce326,null));};exports['describe']=function(_0x2289fe,_0x27a8c8){return db[_0x424e('0x25')][_0x424e('0x42')]()[_0x424e('0x1e')](respondWithResult(_0x27a8c8,null))[_0x424e('0x3c')](handleError(_0x27a8c8,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4911282..09f4fd5 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 _0xc2b0=['request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','api','moment'];(function(_0x1dee6f,_0x5d9b63){var _0x312c61=function(_0x1bbdc8){while(--_0x1bbdc8){_0x1dee6f['push'](_0x1dee6f['shift']());}};_0x312c61(++_0x5d9b63);}(_0xc2b0,0x13c));var _0x0c2b=function(_0x2601c2,_0x16bec){_0x2601c2=_0x2601c2-0x0;var _0x499fcb=_0xc2b0[_0x2601c2];return _0x499fcb;};'use strict';var _=require(_0x0c2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0c2b('0x1'));var moment=require(_0x0c2b('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c2b('0x3'));var fs=require('fs');var path=require(_0x0c2b('0x4'));var rimraf=require(_0x0c2b('0x5'));var config=require(_0x0c2b('0x6'));var attributes=require(_0x0c2b('0x7'));module['exports']=function(_0xcda589,_0x4c95e4){return _0xcda589[_0x0c2b('0x8')]('SmsTransferReport',attributes,{'tableName':_0x0c2b('0x9'),'paranoid':![],'indexes':[{'name':_0x0c2b('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd51f=['api','moment','request-promise','path','../../config/environment','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0xd51f,0xf0));var _0xfd51=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd51f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var logger=require('../../config/logger')(_0xfd51('0x2'));var moment=require(_0xfd51('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd51('0x4'));var fs=require('fs');var path=require(_0xfd51('0x5'));var rimraf=require('rimraf');var config=require(_0xfd51('0x6'));var attributes=require(_0xfd51('0x7'));module['exports']=function(_0x3e3517,_0x3a2cd4){return _0x3e3517['define'](_0xfd51('0x8'),attributes,{'tableName':_0xfd51('0x9'),'paranoid':![],'indexes':[{'name':_0xfd51('0xa'),'fields':[_0xfd51('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 7091cd0..2fdbac8 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 _0xceae=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xceae,0x122));var _0xecea=function(_0x5cc450,_0xbc6fa8){_0x5cc450=_0x5cc450-0x0;var _0x781ec6=_0xceae[_0x5cc450];return _0x781ec6;};'use strict';var _=require(_0xecea('0x0'));var util=require(_0xecea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecea('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecea('0x3'))(_0xecea('0x4'));var config=require(_0xecea('0x5'));var jayson=require(_0xecea('0x6'));var client=jayson[_0xecea('0x7')][_0xecea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a3f5b,_0x242ea0,_0x1663e2){return new BPromise(function(_0x46bb33,_0x4b973b){return client[_0xecea('0x9')](_0x2a3f5b,_0x1663e2)['then'](function(_0x379b2c){logger[_0xecea('0xa')](_0xecea('0xb'),_0x242ea0,_0xecea('0xc'));logger[_0xecea('0xd')](_0xecea('0xe'),_0x242ea0,_0xecea('0xc'),JSON[_0xecea('0xf')](_0x379b2c));if(_0x379b2c[_0xecea('0x10')]){if(_0x379b2c[_0xecea('0x10')][_0xecea('0x11')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x242ea0,_0x379b2c['error'][_0xecea('0x12')]);return _0x4b973b(_0x379b2c['error'][_0xecea('0x12')]);}logger[_0xecea('0x10')](_0xecea('0xb'),_0x242ea0,_0x379b2c[_0xecea('0x10')][_0xecea('0x12')]);return _0x46bb33(_0x379b2c[_0xecea('0x10')]['message']);}else{logger[_0xecea('0xa')](_0xecea('0xb'),_0x242ea0,_0xecea('0xc'));_0x46bb33(_0x379b2c['result'][_0xecea('0x12')]);}})['catch'](function(_0x308efc){logger['error'](_0xecea('0xb'),_0x242ea0,_0x308efc);_0x4b973b(_0x308efc);});});} \ No newline at end of file +var _0x7a59=['debug','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x7a59,0x16e));var _0x97a5=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x7a59[_0x119280];return _0x481797;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97a5('0x1'));var rs=require(_0x97a5('0x2'));var fs=require('fs');var Redis=require(_0x97a5('0x3'));var db=require(_0x97a5('0x4'))['db'];var utils=require(_0x97a5('0x5'));var logger=require('../../config/logger')(_0x97a5('0x6'));var config=require(_0x97a5('0x7'));var jayson=require(_0x97a5('0x8'));var client=jayson['client'][_0x97a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d32f,_0x2663b9,_0x2c0efa){return new BPromise(function(_0x27e8a6,_0x156789){return client[_0x97a5('0xa')](_0x52d32f,_0x2c0efa)['then'](function(_0x4f34e8){logger[_0x97a5('0xb')](_0x97a5('0xc'),_0x2663b9,_0x97a5('0xd'));logger[_0x97a5('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2663b9,'request\x20sent',JSON[_0x97a5('0xf')](_0x4f34e8));if(_0x4f34e8[_0x97a5('0x10')]){if(_0x4f34e8[_0x97a5('0x10')]['code']===0x1f4){logger[_0x97a5('0x10')](_0x97a5('0xc'),_0x2663b9,_0x4f34e8['error']['message']);return _0x156789(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x2663b9,_0x4f34e8['error']['message']);return _0x27e8a6(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}else{logger[_0x97a5('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x2663b9,_0x97a5('0xd'));_0x27e8a6(_0x4f34e8[_0x97a5('0x12')]['message']);}})[_0x97a5('0x13')](function(_0x5ee8ca){logger[_0x97a5('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x2663b9,_0x5ee8ca);_0x156789(_0x5ee8ca);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 15dda92..4495dc2 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 _0xf125=['basename','now','extname','post','single','file','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/download','download','join','root','originalname'];(function(_0x3566ea,_0x50e87d){var _0x24c0b9=function(_0x1f22a5){while(--_0x1f22a5){_0x3566ea['push'](_0x3566ea['shift']());}};_0x24c0b9(++_0x50e87d);}(_0xf125,0x134));var _0x5f12=function(_0x423ee2,_0x275202){_0x423ee2=_0x423ee2-0x0;var _0x2f1560=_0xf125[_0x423ee2];return _0x2f1560;};'use strict';var multer=require('multer');var util=require(_0x5f12('0x0'));var path=require(_0x5f12('0x1'));var timeout=require(_0x5f12('0x2'));var express=require(_0x5f12('0x3'));var router=express[_0x5f12('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5f12('0x5'));var config=require(_0x5f12('0x6'));var controller=require('./sound.controller');router['get']('/',auth[_0x5f12('0x7')](),controller[_0x5f12('0x8')]);router[_0x5f12('0x9')]('/:id',auth[_0x5f12('0x7')](),controller[_0x5f12('0xa')]);router[_0x5f12('0x9')](_0x5f12('0xb'),auth[_0x5f12('0x7')](),controller[_0x5f12('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x309b50,_0x1f0d51,_0x224ce4){_0x224ce4(null,path[_0x5f12('0xd')](config[_0x5f12('0xe')],'server/files/sounds/original/'));},'filename':function(_0x3f4a99,_0x147388,_0x2f412d){_0x147388[_0x5f12('0xf')]=_0x147388[_0x5f12('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f412d(null,util['format']('%s-%s%s',path[_0x5f12('0x10')](_0x147388[_0x5f12('0xf')],path['extname'](_0x147388[_0x5f12('0xf')])),Date[_0x5f12('0x11')](),path[_0x5f12('0x12')](_0x147388[_0x5f12('0xf')])));}})});router[_0x5f12('0x13')]('/',upload[_0x5f12('0x14')](_0x5f12('0x15')),controller[_0x5f12('0x16')]);router[_0x5f12('0x17')](_0x5f12('0x18'),auth[_0x5f12('0x7')](),controller['update']);router[_0x5f12('0x19')]('/:id',auth[_0x5f12('0x7')](),controller[_0x5f12('0x19')]);module[_0x5f12('0x1a')]=router; \ No newline at end of file +var _0xa66e=['%s-%s%s','basename','now','extname','single','file','create','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','diskStorage','root','originalname','replace','format'];(function(_0x5c98a7,_0x2067c6){var _0x182007=function(_0x2ed226){while(--_0x2ed226){_0x5c98a7['push'](_0x5c98a7['shift']());}};_0x182007(++_0x2067c6);}(_0xa66e,0x103));var _0xea66=function(_0x29d9cb,_0x86fd64){_0x29d9cb=_0x29d9cb-0x0;var _0x87a908=_0xa66e[_0x29d9cb];return _0x87a908;};'use strict';var multer=require(_0xea66('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea66('0x1'));var express=require(_0xea66('0x2'));var router=express[_0xea66('0x3')]();var fs_extra=require(_0xea66('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xea66('0x5'));var config=require(_0xea66('0x6'));var controller=require('./sound.controller');router[_0xea66('0x7')]('/',auth[_0xea66('0x8')](),controller[_0xea66('0x9')]);router['get'](_0xea66('0xa'),auth[_0xea66('0x8')](),controller['show']);router[_0xea66('0x7')]('/:id/download',auth[_0xea66('0x8')](),controller['download']);var upload=multer({'storage':multer[_0xea66('0xb')]({'destination':function(_0x4e895a,_0x4605ac,_0x887e58){_0x887e58(null,path['join'](config[_0xea66('0xc')],'server/files/sounds/original/'));},'filename':function(_0x5d7e8c,_0x493dc9,_0x96f1a){_0x493dc9[_0xea66('0xd')]=_0x493dc9[_0xea66('0xd')][_0xea66('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x96f1a(null,util[_0xea66('0xf')](_0xea66('0x10'),path[_0xea66('0x11')](_0x493dc9[_0xea66('0xd')],path['extname'](_0x493dc9[_0xea66('0xd')])),Date[_0xea66('0x12')](),path[_0xea66('0x13')](_0x493dc9['originalname'])));}})});router['post']('/',upload[_0xea66('0x14')](_0xea66('0x15')),controller[_0xea66('0x16')]);router['put']('/:id',auth[_0xea66('0x8')](),controller[_0xea66('0x17')]);router[_0xea66('0x18')](_0xea66('0xa'),auth[_0xea66('0x8')](),controller[_0xea66('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dd8431d..38ca844 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 _0xdce1=['INTEGER','sequelize','exports','name','STRING','FLOAT','BIGINT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdce1,0x143));var _0x1dce=function(_0x7ad49b,_0x4185d7){_0x7ad49b=_0x7ad49b-0x0;var _0x3d5a43=_0xdce1[_0x7ad49b];return _0x3d5a43;};'use strict';var Sequelize=require(_0x1dce('0x0'));module[_0x1dce('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1dce('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1dce('0x3')]},'display_name':{'type':Sequelize[_0x1dce('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x1dce('0x3')]},'original_format':{'type':Sequelize[_0x1dce('0x3')]},'original_duration':{'type':Sequelize[_0x1dce('0x4')]},'original_sampleCount':{'type':Sequelize[_0x1dce('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x1dce('0x3')]},'converted_duration':{'type':Sequelize[_0x1dce('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x1dce('0x5')]},'converted_channelCount':{'type':Sequelize[_0x1dce('0x6')]},'converted_bitRate':{'type':Sequelize[_0x1dce('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x1dce('0x6')]}}; \ No newline at end of file +var _0xf426=['STRING','name','FLOAT','INTEGER','BIGINT','sequelize','exports'];(function(_0x29712d,_0x2eecec){var _0x30ca20=function(_0x327b3d){while(--_0x327b3d){_0x29712d['push'](_0x29712d['shift']());}};_0x30ca20(++_0x2eecec);}(_0xf426,0xfa));var _0x6f42=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xf426[_0x1e6659];return _0x4d16e4;};'use strict';var Sequelize=require(_0x6f42('0x0'));module[_0x6f42('0x1')]={'name':{'type':Sequelize[_0x6f42('0x2')],'unique':_0x6f42('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x6f42('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x6f42('0x2')]},'original_format':{'type':Sequelize[_0x6f42('0x2')]},'original_duration':{'type':Sequelize[_0x6f42('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x6f42('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x6f42('0x5')]},'converted_format':{'type':Sequelize[_0x6f42('0x2')]},'converted_duration':{'type':Sequelize[_0x6f42('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x6f42('0x6')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x6f42('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 356e94c..dcad4b5 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 _0xac4e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x3d1f32,_0x31dae0){var _0xb105f2=function(_0x15652d){while(--_0x15652d){_0x3d1f32['push'](_0x3d1f32['shift']());}};_0xb105f2(++_0x31dae0);}(_0xac4e,0xf4));var _0xeac4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xac4e[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeac4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeac4('0x1'));var moment=require(_0xeac4('0x2'));var BPromise=require(_0xeac4('0x3'));var Mustache=require('mustache');var util=require(_0xeac4('0x4'));var path=require(_0xeac4('0x5'));var sox=require(_0xeac4('0x6'));var csv=require('to-csv');var ejs=require(_0xeac4('0x7'));var fs=require('fs');var fs_extra=require(_0xeac4('0x8'));var _=require(_0xeac4('0x9'));var squel=require(_0xeac4('0xa'));var crypto=require(_0xeac4('0xb'));var jsforce=require(_0xeac4('0xc'));var deskjs=require(_0xeac4('0xd'));var toCsv=require(_0xeac4('0xe'));var querystring=require('querystring');var Papa=require(_0xeac4('0xf'));var Redis=require(_0xeac4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeac4('0x11'));var hardwareService=require(_0xeac4('0x12'));var logger=require(_0xeac4('0x13'))('api');var utils=require(_0xeac4('0x14'));var config=require(_0xeac4('0x15'));var licenseUtil=require(_0xeac4('0x16'));var db=require(_0xeac4('0x17'))['db'];function respondWithStatusCode(_0x3232a6,_0x34824e){_0x34824e=_0x34824e||0xcc;return function(_0x11bf3b){if(_0x11bf3b){return _0x3232a6[_0xeac4('0x18')](_0x34824e);}return _0x3232a6[_0xeac4('0x19')](_0x34824e)[_0xeac4('0x1a')]();};}function respondWithResult(_0x5781e0,_0xb9479b){_0xb9479b=_0xb9479b||0xc8;return function(_0xb732e7){if(_0xb732e7){return _0x5781e0['status'](_0xb9479b)[_0xeac4('0x1b')](_0xb732e7);}};}function respondWithFilteredResult(_0x34bfcd,_0x20f8e5){return function(_0x5be720){if(_0x5be720){var _0x4edbf1=typeof _0x20f8e5[_0xeac4('0x1c')]==='undefined'&&typeof _0x20f8e5[_0xeac4('0x1d')]===_0xeac4('0x1e');var _0x1d0b47=_0x5be720[_0xeac4('0x1f')];var _0x34ad53=_0x4edbf1?0x0:_0x20f8e5[_0xeac4('0x1c')];var _0x154e78=_0x4edbf1?_0x5be720[_0xeac4('0x1f')]:_0x20f8e5['offset']+_0x20f8e5[_0xeac4('0x1d')];var _0x152f49;if(_0x154e78>=_0x1d0b47){_0x154e78=_0x1d0b47;_0x152f49=0xc8;}else{_0x152f49=0xce;}_0x34bfcd[_0xeac4('0x19')](_0x152f49);return _0x34bfcd[_0xeac4('0x20')](_0xeac4('0x21'),_0x34ad53+'-'+_0x154e78+'/'+_0x1d0b47)[_0xeac4('0x1b')](_0x5be720);}return null;};}function patchUpdates(_0x4d0b38){return function(_0x38d462){try{jsonpatch[_0xeac4('0x22')](_0x38d462,_0x4d0b38,!![]);}catch(_0x53dc0c){return BPromise[_0xeac4('0x23')](_0x53dc0c);}return _0x38d462[_0xeac4('0x24')]();};}function saveUpdates(_0x262f17,_0x3b3b83){return function(_0xd5ddbb){if(_0xd5ddbb){return _0xd5ddbb[_0xeac4('0x25')](_0x262f17)[_0xeac4('0x26')](function(_0x24de29){return _0x24de29;});}return null;};}function removeEntity(_0x5d8280,_0x595400){return function(_0x11d580){if(_0x11d580){return _0x11d580[_0xeac4('0x27')]()[_0xeac4('0x26')](function(){var _0x19fbe5=_0x11d580[_0xeac4('0x28')]({'plain':!![]});var _0x231cad=_0xeac4('0x29');return db[_0xeac4('0x2a')][_0xeac4('0x27')]({'where':{'type':_0x231cad,'resourceId':_0x19fbe5['id']}})[_0xeac4('0x26')](function(){return _0x11d580;});})[_0xeac4('0x26')](function(){_0x5d8280[_0xeac4('0x19')](0xcc)[_0xeac4('0x1a')]();});}};}function handleEntityNotFound(_0x1f824d,_0x4b3c3d){return function(_0x1fd62a){if(!_0x1fd62a){_0x1f824d['sendStatus'](0x194);}return _0x1fd62a;};}function handleError(_0x69bfcc,_0x2c921d){_0x2c921d=_0x2c921d||0x1f4;return function(_0x38ea3e){logger[_0xeac4('0x2b')](_0x38ea3e[_0xeac4('0x2c')]);if(_0x38ea3e[_0xeac4('0x2d')]){delete _0x38ea3e[_0xeac4('0x2d')];}_0x69bfcc['status'](_0x2c921d)[_0xeac4('0x2e')](_0x38ea3e);};}exports['index']=function(_0x5ef3c2,_0x3d5241){var _0x42c00b={},_0x217563={},_0x43830e={'count':0x0,'rows':[]};var _0x5245a1=_[_0xeac4('0x2f')](db[_0xeac4('0x30')][_0xeac4('0x31')],function(_0x1f5dc0){return{'name':_0x1f5dc0[_0xeac4('0x32')],'type':_0x1f5dc0[_0xeac4('0x33')][_0xeac4('0x34')]};});_0x217563[_0xeac4('0x35')]=_[_0xeac4('0x2f')](_0x5245a1,_0xeac4('0x2d'));_0x217563['query']=_[_0xeac4('0x36')](_0x5ef3c2[_0xeac4('0x37')]);_0x217563[_0xeac4('0x38')]=_[_0xeac4('0x39')](_0x217563[_0xeac4('0x35')],_0x217563[_0xeac4('0x37')]);_0x42c00b['attributes']=_['intersection'](_0x217563[_0xeac4('0x35')],qs[_0xeac4('0x3a')](_0x5ef3c2[_0xeac4('0x37')][_0xeac4('0x3a')]));_0x42c00b[_0xeac4('0x3b')]=_0x42c00b[_0xeac4('0x3b')][_0xeac4('0x3c')]?_0x42c00b['attributes']:_0x217563['model'];if(!_0x5ef3c2[_0xeac4('0x37')][_0xeac4('0x3d')](_0xeac4('0x3e'))){_0x42c00b[_0xeac4('0x1d')]=qs['limit'](_0x5ef3c2[_0xeac4('0x37')][_0xeac4('0x1d')]);_0x42c00b[_0xeac4('0x1c')]=qs['offset'](_0x5ef3c2[_0xeac4('0x37')][_0xeac4('0x1c')]);}_0x42c00b[_0xeac4('0x3f')]=qs[_0xeac4('0x40')](_0x5ef3c2[_0xeac4('0x37')][_0xeac4('0x40')]);_0x42c00b[_0xeac4('0x41')]=qs[_0xeac4('0x38')](_[_0xeac4('0x42')](_0x5ef3c2[_0xeac4('0x37')],_0x217563[_0xeac4('0x38')]),_0x5245a1);if(_0x5ef3c2['query'][_0xeac4('0x43')]){_0x42c00b[_0xeac4('0x41')]=_[_0xeac4('0x44')](_0x42c00b['where'],{'$or':_[_0xeac4('0x2f')](_0x5245a1,function(_0x59b059){if(_0x59b059[_0xeac4('0x33')]!=='VIRTUAL'){var _0x6d7cde={};_0x6d7cde[_0x59b059['name']]={'$like':'%'+_0x5ef3c2[_0xeac4('0x37')][_0xeac4('0x43')]+'%'};return _0x6d7cde;}})});}_0x42c00b=_[_0xeac4('0x44')]({},_0x42c00b,_0x5ef3c2['options']);var _0x329845={'where':_0x42c00b['where']};return db[_0xeac4('0x30')][_0xeac4('0x1f')](_0x329845)[_0xeac4('0x26')](function(_0x390340){_0x43830e[_0xeac4('0x1f')]=_0x390340;if(_0x5ef3c2[_0xeac4('0x37')][_0xeac4('0x45')]){_0x42c00b[_0xeac4('0x46')]=[{'all':!![]}];}return db[_0xeac4('0x30')][_0xeac4('0x47')](_0x42c00b);})['then'](function(_0x14f168){_0x43830e[_0xeac4('0x48')]=_0x14f168;return _0x43830e;})[_0xeac4('0x26')](respondWithFilteredResult(_0x3d5241,_0x42c00b))[_0xeac4('0x49')](handleError(_0x3d5241,null));};exports[_0xeac4('0x4a')]=function(_0x5156e6,_0x456350){var _0x2f4de8={'raw':!![],'where':{'id':_0x5156e6[_0xeac4('0x4b')]['id']}},_0x4af467={};_0x4af467[_0xeac4('0x35')]=_['keys'](db[_0xeac4('0x30')][_0xeac4('0x31')]);_0x4af467[_0xeac4('0x37')]=_[_0xeac4('0x36')](_0x5156e6[_0xeac4('0x37')]);_0x4af467[_0xeac4('0x38')]=_['intersection'](_0x4af467['model'],_0x4af467[_0xeac4('0x37')]);_0x2f4de8[_0xeac4('0x3b')]=_[_0xeac4('0x39')](_0x4af467[_0xeac4('0x35')],qs['fields'](_0x5156e6['query']['fields']));_0x2f4de8[_0xeac4('0x3b')]=_0x2f4de8[_0xeac4('0x3b')]['length']?_0x2f4de8[_0xeac4('0x3b')]:_0x4af467[_0xeac4('0x35')];if(_0x5156e6[_0xeac4('0x37')][_0xeac4('0x45')]){_0x2f4de8[_0xeac4('0x46')]=[{'all':!![]}];}_0x2f4de8=_['merge']({},_0x2f4de8,_0x5156e6[_0xeac4('0x4c')]);return db[_0xeac4('0x30')][_0xeac4('0x4d')](_0x2f4de8)['then'](handleEntityNotFound(_0x456350,null))[_0xeac4('0x26')](respondWithResult(_0x456350,null))[_0xeac4('0x49')](handleError(_0x456350,null));};exports[_0xeac4('0x4e')]=function(_0x3e864b,_0x340a8d,_0x39b11f){return db[_0xeac4('0x30')]['find']({'where':{'id':_0x3e864b[_0xeac4('0x4b')]['id']},'attributes':[_0xeac4('0x2d'),_0xeac4('0x4f'),_0xeac4('0x50')],'raw':!![]})[_0xeac4('0x26')](handleEntityNotFound(_0x340a8d,null))['then'](function(_0x4cd32f){if(_0x4cd32f){if(!fs[_0xeac4('0x51')](path[_0xeac4('0x52')](config[_0xeac4('0x53')],_0xeac4('0x54'),_0x4cd32f[_0xeac4('0x4f')]+'.'+_0x4cd32f[_0xeac4('0x50')]))){throw new db[(_0xeac4('0x55'))][(_0xeac4('0x56'))](_0xeac4('0x57'));}return _0x340a8d['download'](path['join'](config['root'],_0xeac4('0x54'),util['format'](_0xeac4('0x58'),_0x4cd32f[_0xeac4('0x4f')],_0x4cd32f['converted_format'])),util[_0xeac4('0x59')](_0xeac4('0x58'),_0x4cd32f[_0xeac4('0x2d')],_0x4cd32f['converted_format']));}return null;})[_0xeac4('0x49')](handleError(_0x340a8d,null));};exports[_0xeac4('0x5a')]=function(_0x5359fe,_0x1baa1c,_0xd8d4e9){var _0x3c6db9={'name':path['basename'](_0x5359fe[_0xeac4('0x5b')][_0xeac4('0x5c')],path[_0xeac4('0x5d')](_0x5359fe[_0xeac4('0x5b')][_0xeac4('0x5c')])),'save_name':path[_0xeac4('0x5e')](_0x5359fe['file'][_0xeac4('0x5f')],path[_0xeac4('0x5d')](_0x5359fe[_0xeac4('0x5b')][_0xeac4('0x5f')])),'original_format':path[_0xeac4('0x5d')](_0x5359fe[_0xeac4('0x5b')][_0xeac4('0x5c')])[_0xeac4('0x60')](0x1),'converted_format':_0xeac4('0x61')};var _0x298860=path[_0xeac4('0x52')](config[_0xeac4('0x53')],_0xeac4('0x62'),_0x5359fe[_0xeac4('0x5b')][_0xeac4('0x5f')]);var _0x5f0604=path[_0xeac4('0x52')](config[_0xeac4('0x53')],_0xeac4('0x54'),util[_0xeac4('0x59')](_0xeac4('0x58'),path[_0xeac4('0x5e')](_0x5359fe['file']['filename'],path['extname'](_0x5359fe[_0xeac4('0x5b')][_0xeac4('0x5f')])),_0x3c6db9[_0xeac4('0x50')]));logger['info'](_0xeac4('0x63'),_0x298860);logger[_0xeac4('0x64')](_0xeac4('0x65'),_0x5f0604);try{fs['chmodSync'](_0x298860,parseInt('0777',0x8));var _0x21a88d=sox[_0xeac4('0x66')](_0x298860,_0x5f0604,{'sampleRate':0x1f40,'format':_0xeac4('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21a88d['on'](_0xeac4('0x2b'),function(_0x3dc4bc){fs[_0xeac4('0x67')](_0x298860);_0x1baa1c[_0xeac4('0x19')](0x1f4)[_0xeac4('0x2e')](_0x3dc4bc);});_0x21a88d['on'](_0xeac4('0x68'),function(_0x32cf21){_0x3c6db9[_0xeac4('0x69')]=isNaN(_0x32cf21[_0xeac4('0x6a')])?null:_0x32cf21[_0xeac4('0x6a')]*0x3e8;_0x3c6db9['original_sampleCount']=isNaN(_0x32cf21['sampleCount'])?null:_0x32cf21[_0xeac4('0x6b')];_0x3c6db9[_0xeac4('0x6c')]=isNaN(_0x32cf21[_0xeac4('0x6d')])?null:_0x32cf21['channelCount'];_0x3c6db9[_0xeac4('0x6e')]=isNaN(_0x32cf21[_0xeac4('0x6f')])?null:_0x32cf21[_0xeac4('0x6f')];_0x3c6db9[_0xeac4('0x70')]=isNaN(_0x32cf21[_0xeac4('0x71')])?null:_0x32cf21[_0xeac4('0x71')];});_0x21a88d['on'](_0xeac4('0x72'),function(_0x5c0d98){_0x3c6db9[_0xeac4('0x73')]=isNaN(_0x5c0d98[_0xeac4('0x6a')])?null:_0x5c0d98['duration']*0x3e8;_0x3c6db9[_0xeac4('0x74')]=isNaN(_0x5c0d98[_0xeac4('0x6b')])?null:_0x5c0d98[_0xeac4('0x6b')];_0x3c6db9['converted_channelCount']=isNaN(_0x5c0d98[_0xeac4('0x6d')])?null:_0x5c0d98[_0xeac4('0x6d')];_0x3c6db9[_0xeac4('0x75')]=isNaN(_0x5c0d98[_0xeac4('0x6f')])?null:_0x5c0d98[_0xeac4('0x6f')];_0x3c6db9[_0xeac4('0x76')]=isNaN(_0x5c0d98[_0xeac4('0x71')])?null:_0x5c0d98[_0xeac4('0x71')];});_0x21a88d['on'](_0xeac4('0x1a'),function(){fs[_0xeac4('0x77')](_0x5f0604,parseInt(_0xeac4('0x78'),0x8));return db[_0xeac4('0x30')][_0xeac4('0x5a')](_0x3c6db9)[_0xeac4('0x26')](function(_0x37333a){var _0x15e1f7={'role':_0x5359fe[_0xeac4('0x79')][_0xeac4('0x7a')],'userProfileId':_0x5359fe['body'][_0xeac4('0x7b')]};if(!_0x15e1f7)throw new Error(_0xeac4('0x7c'));if(_0x15e1f7[_0xeac4('0x7a')]===_0xeac4('0x7d')){var _0x216b72=_0x37333a[_0xeac4('0x28')]({'plain':!![]});return db[_0xeac4('0x7e')]['find']({'where':{'name':_0xeac4('0x29'),'userProfileId':_0x15e1f7['userProfileId']},'raw':!![]})[_0xeac4('0x26')](function(_0x3b3905){if(_0x3b3905&&_0x3b3905[_0xeac4('0x7f')]===0x0){return db[_0xeac4('0x2a')][_0xeac4('0x5a')]({'name':_0x216b72[_0xeac4('0x2d')],'resourceId':_0x216b72['id'],'type':_0x3b3905[_0xeac4('0x2d')],'sectionId':_0x3b3905['id']},{})['then'](function(){return _0x37333a;});}else{return _0x37333a;}})[_0xeac4('0x49')](function(_0x7b0235){logger[_0xeac4('0x2b')](_0xeac4('0x80'),_0x7b0235);throw _0x7b0235;});}return _0x37333a;})[_0xeac4('0x26')](respondWithResult(_0x1baa1c,null))[_0xeac4('0x49')](handleError(_0x1baa1c,null));});_0x21a88d[_0xeac4('0x81')]();}catch(_0x55ff31){_0x1baa1c[_0xeac4('0x19')](0x1f4)[_0xeac4('0x2e')](_0x55ff31);}};exports['update']=function(_0xd4d6f9,_0x3edbec,_0x2ceaae){return db[_0xeac4('0x30')][_0xeac4('0x4d')]({'where':{'id':_0xd4d6f9[_0xeac4('0x4b')]['id']}})[_0xeac4('0x26')](handleEntityNotFound(_0x3edbec,null))[_0xeac4('0x26')](saveUpdates(_[_0xeac4('0x42')](_0xd4d6f9[_0xeac4('0x79')],[_0xeac4('0x2d'),_0xeac4('0x82')]),null))['then'](respondWithResult(_0x3edbec,null))[_0xeac4('0x49')](handleError(_0x3edbec,null));};exports[_0xeac4('0x83')]=function(_0x5760da,_0x4abd3e,_0x3e3b49){return db['Sound'][_0xeac4('0x4d')]({'where':{'id':_0x5760da[_0xeac4('0x4b')]['id']}})[_0xeac4('0x26')](function(_0x3ab010){if(_0x3ab010){return _0x3ab010[_0xeac4('0x27')]();}})[_0xeac4('0x26')](function(_0x10121f){var _0x5ebdab=path[_0xeac4('0x52')](config['root'],'server/files/sounds/original',util[_0xeac4('0x59')](_0xeac4('0x58'),_0x10121f['save_name'],_0x10121f[_0xeac4('0x84')]));var _0x1a907e=path[_0xeac4('0x52')](config[_0xeac4('0x53')],_0xeac4('0x54'),util['format'](_0xeac4('0x58'),_0x10121f[_0xeac4('0x4f')],_0x10121f[_0xeac4('0x50')]));fs[_0xeac4('0x67')](_0x5ebdab);fs['unlinkSync'](_0x1a907e);return _0x10121f;})[_0xeac4('0x26')](function(_0x361d79){if(_0x361d79){return _0x4abd3e[_0xeac4('0x19')](0xcc)[_0xeac4('0x1a')]();}})[_0xeac4('0x26')](handleEntityNotFound(_0x4abd3e,null))[_0xeac4('0x49')](handleError(_0x4abd3e,null));}; \ No newline at end of file +var _0xb77c=['limit','count','Content-Range','reject','save','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','extname','originalname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x497d0b,_0x3f8e74){var _0x5ebe3a=function(_0x436de2){while(--_0x436de2){_0x497d0b['push'](_0x497d0b['shift']());}};_0x5ebe3a(++_0x3f8e74);}(_0xb77c,0x14f));var _0xcb77=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xb77c[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0xcb77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb77('0x1'));var jsonpatch=require(_0xcb77('0x2'));var rp=require(_0xcb77('0x3'));var moment=require(_0xcb77('0x4'));var BPromise=require(_0xcb77('0x5'));var Mustache=require('mustache');var util=require(_0xcb77('0x6'));var path=require(_0xcb77('0x7'));var sox=require(_0xcb77('0x8'));var csv=require(_0xcb77('0x9'));var ejs=require(_0xcb77('0xa'));var fs=require('fs');var fs_extra=require(_0xcb77('0xb'));var _=require(_0xcb77('0xc'));var squel=require(_0xcb77('0xd'));var crypto=require('crypto');var jsforce=require(_0xcb77('0xe'));var deskjs=require(_0xcb77('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcb77('0x10'));var Papa=require('papaparse');var Redis=require(_0xcb77('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb77('0x12'));var logger=require(_0xcb77('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcb77('0x14'));var licenseUtil=require(_0xcb77('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452f4d,_0x215fa9){_0x215fa9=_0x215fa9||0xcc;return function(_0x11778f){if(_0x11778f){return _0x452f4d[_0xcb77('0x16')](_0x215fa9);}return _0x452f4d[_0xcb77('0x17')](_0x215fa9)[_0xcb77('0x18')]();};}function respondWithResult(_0x3c28c1,_0x594134){_0x594134=_0x594134||0xc8;return function(_0x5470a3){if(_0x5470a3){return _0x3c28c1[_0xcb77('0x17')](_0x594134)[_0xcb77('0x19')](_0x5470a3);}};}function respondWithFilteredResult(_0x432a8a,_0x1bcef2){return function(_0x3280c1){if(_0x3280c1){var _0x5eaf90=typeof _0x1bcef2[_0xcb77('0x1a')]===_0xcb77('0x1b')&&typeof _0x1bcef2[_0xcb77('0x1c')]==='undefined';var _0x444de7=_0x3280c1[_0xcb77('0x1d')];var _0x221580=_0x5eaf90?0x0:_0x1bcef2[_0xcb77('0x1a')];var _0x2c1f92=_0x5eaf90?_0x3280c1['count']:_0x1bcef2['offset']+_0x1bcef2['limit'];var _0x39356b;if(_0x2c1f92>=_0x444de7){_0x2c1f92=_0x444de7;_0x39356b=0xc8;}else{_0x39356b=0xce;}_0x432a8a[_0xcb77('0x17')](_0x39356b);return _0x432a8a['set'](_0xcb77('0x1e'),_0x221580+'-'+_0x2c1f92+'/'+_0x444de7)['json'](_0x3280c1);}return null;};}function patchUpdates(_0x45de93){return function(_0x484f18){try{jsonpatch['apply'](_0x484f18,_0x45de93,!![]);}catch(_0x4b2c0d){return BPromise[_0xcb77('0x1f')](_0x4b2c0d);}return _0x484f18[_0xcb77('0x20')]();};}function saveUpdates(_0x54cee5,_0x598ac8){return function(_0x29bff4){if(_0x29bff4){return _0x29bff4['update'](_0x54cee5)[_0xcb77('0x21')](function(_0x45dd9e){return _0x45dd9e;});}return null;};}function removeEntity(_0x2c63b8,_0x507bb8){return function(_0xc51877){if(_0xc51877){return _0xc51877[_0xcb77('0x22')]()[_0xcb77('0x21')](function(){var _0x1eb42e=_0xc51877[_0xcb77('0x23')]({'plain':!![]});var _0x23e237=_0xcb77('0x24');return db[_0xcb77('0x25')][_0xcb77('0x22')]({'where':{'type':_0x23e237,'resourceId':_0x1eb42e['id']}})['then'](function(){return _0xc51877;});})[_0xcb77('0x21')](function(){_0x2c63b8[_0xcb77('0x17')](0xcc)[_0xcb77('0x18')]();});}};}function handleEntityNotFound(_0x1f4249,_0x1569dd){return function(_0x22a9c2){if(!_0x22a9c2){_0x1f4249[_0xcb77('0x16')](0x194);}return _0x22a9c2;};}function handleError(_0x112fec,_0x29c737){_0x29c737=_0x29c737||0x1f4;return function(_0x410ab9){logger[_0xcb77('0x26')](_0x410ab9[_0xcb77('0x27')]);if(_0x410ab9[_0xcb77('0x28')]){delete _0x410ab9[_0xcb77('0x28')];}_0x112fec[_0xcb77('0x17')](_0x29c737)[_0xcb77('0x29')](_0x410ab9);};}exports[_0xcb77('0x2a')]=function(_0x58364c,_0x31e8eb){var _0x44aa55={},_0x340418={},_0x4e73b5={'count':0x0,'rows':[]};var _0x4a34cb=_[_0xcb77('0x2b')](db[_0xcb77('0x2c')][_0xcb77('0x2d')],function(_0x3eaa32){return{'name':_0x3eaa32[_0xcb77('0x2e')],'type':_0x3eaa32[_0xcb77('0x2f')]['key']};});_0x340418[_0xcb77('0x30')]=_[_0xcb77('0x2b')](_0x4a34cb,_0xcb77('0x28'));_0x340418[_0xcb77('0x31')]=_['keys'](_0x58364c[_0xcb77('0x31')]);_0x340418[_0xcb77('0x32')]=_['intersection'](_0x340418[_0xcb77('0x30')],_0x340418[_0xcb77('0x31')]);_0x44aa55['attributes']=_[_0xcb77('0x33')](_0x340418[_0xcb77('0x30')],qs[_0xcb77('0x34')](_0x58364c[_0xcb77('0x31')][_0xcb77('0x34')]));_0x44aa55['attributes']=_0x44aa55[_0xcb77('0x35')][_0xcb77('0x36')]?_0x44aa55[_0xcb77('0x35')]:_0x340418['model'];if(!_0x58364c['query']['hasOwnProperty'](_0xcb77('0x37'))){_0x44aa55[_0xcb77('0x1c')]=qs[_0xcb77('0x1c')](_0x58364c[_0xcb77('0x31')][_0xcb77('0x1c')]);_0x44aa55[_0xcb77('0x1a')]=qs[_0xcb77('0x1a')](_0x58364c[_0xcb77('0x31')][_0xcb77('0x1a')]);}_0x44aa55['order']=qs[_0xcb77('0x38')](_0x58364c[_0xcb77('0x31')][_0xcb77('0x38')]);_0x44aa55[_0xcb77('0x39')]=qs['filters'](_[_0xcb77('0x3a')](_0x58364c[_0xcb77('0x31')],_0x340418[_0xcb77('0x32')]),_0x4a34cb);if(_0x58364c['query']['filter']){_0x44aa55[_0xcb77('0x39')]=_[_0xcb77('0x3b')](_0x44aa55['where'],{'$or':_[_0xcb77('0x2b')](_0x4a34cb,function(_0x1d46f8){if(_0x1d46f8['type']!=='VIRTUAL'){var _0x38effd={};_0x38effd[_0x1d46f8[_0xcb77('0x28')]]={'$like':'%'+_0x58364c[_0xcb77('0x31')][_0xcb77('0x3c')]+'%'};return _0x38effd;}})});}_0x44aa55=_['merge']({},_0x44aa55,_0x58364c[_0xcb77('0x3d')]);var _0x256124={'where':_0x44aa55[_0xcb77('0x39')]};return db['Sound']['count'](_0x256124)[_0xcb77('0x21')](function(_0x1b209c){_0x4e73b5[_0xcb77('0x1d')]=_0x1b209c;if(_0x58364c['query'][_0xcb77('0x3e')]){_0x44aa55[_0xcb77('0x3f')]=[{'all':!![]}];}return db['Sound'][_0xcb77('0x40')](_0x44aa55);})[_0xcb77('0x21')](function(_0x446557){_0x4e73b5[_0xcb77('0x41')]=_0x446557;return _0x4e73b5;})[_0xcb77('0x21')](respondWithFilteredResult(_0x31e8eb,_0x44aa55))[_0xcb77('0x42')](handleError(_0x31e8eb,null));};exports[_0xcb77('0x43')]=function(_0x9b6a76,_0x2ce6ce){var _0x43b448={'raw':!![],'where':{'id':_0x9b6a76[_0xcb77('0x44')]['id']}},_0x4b5514={};_0x4b5514[_0xcb77('0x30')]=_[_0xcb77('0x45')](db[_0xcb77('0x2c')]['rawAttributes']);_0x4b5514['query']=_[_0xcb77('0x45')](_0x9b6a76[_0xcb77('0x31')]);_0x4b5514['filters']=_['intersection'](_0x4b5514[_0xcb77('0x30')],_0x4b5514[_0xcb77('0x31')]);_0x43b448[_0xcb77('0x35')]=_['intersection'](_0x4b5514[_0xcb77('0x30')],qs[_0xcb77('0x34')](_0x9b6a76[_0xcb77('0x31')]['fields']));_0x43b448['attributes']=_0x43b448[_0xcb77('0x35')][_0xcb77('0x36')]?_0x43b448[_0xcb77('0x35')]:_0x4b5514['model'];if(_0x9b6a76[_0xcb77('0x31')][_0xcb77('0x3e')]){_0x43b448['include']=[{'all':!![]}];}_0x43b448=_[_0xcb77('0x3b')]({},_0x43b448,_0x9b6a76['options']);return db[_0xcb77('0x2c')][_0xcb77('0x46')](_0x43b448)[_0xcb77('0x21')](handleEntityNotFound(_0x2ce6ce,null))[_0xcb77('0x21')](respondWithResult(_0x2ce6ce,null))[_0xcb77('0x42')](handleError(_0x2ce6ce,null));};exports[_0xcb77('0x47')]=function(_0x14ee17,_0x38dd05,_0x45defb){return db[_0xcb77('0x2c')][_0xcb77('0x46')]({'where':{'id':_0x14ee17['params']['id']},'attributes':['name',_0xcb77('0x48'),_0xcb77('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x38dd05,null))[_0xcb77('0x21')](function(_0x144e94){if(_0x144e94){if(!fs[_0xcb77('0x4a')](path[_0xcb77('0x4b')](config[_0xcb77('0x4c')],_0xcb77('0x4d'),_0x144e94[_0xcb77('0x48')]+'.'+_0x144e94[_0xcb77('0x49')]))){throw new db[(_0xcb77('0x4e'))][(_0xcb77('0x4f'))](_0xcb77('0x50'));}return _0x38dd05[_0xcb77('0x47')](path['join'](config[_0xcb77('0x4c')],_0xcb77('0x4d'),util['format']('%s.%s',_0x144e94[_0xcb77('0x48')],_0x144e94[_0xcb77('0x49')])),util[_0xcb77('0x51')](_0xcb77('0x52'),_0x144e94[_0xcb77('0x28')],_0x144e94[_0xcb77('0x49')]));}return null;})[_0xcb77('0x42')](handleError(_0x38dd05,null));};exports['create']=function(_0x5ad5b6,_0x1fc00f,_0x1fbabc){var _0x944005={'name':path['basename'](_0x5ad5b6[_0xcb77('0x53')]['originalname'],path[_0xcb77('0x54')](_0x5ad5b6['file'][_0xcb77('0x55')])),'save_name':path[_0xcb77('0x56')](_0x5ad5b6['file'][_0xcb77('0x57')],path['extname'](_0x5ad5b6[_0xcb77('0x53')][_0xcb77('0x57')])),'original_format':path[_0xcb77('0x54')](_0x5ad5b6[_0xcb77('0x53')][_0xcb77('0x55')])[_0xcb77('0x58')](0x1),'converted_format':_0xcb77('0x59')};var _0x92a6df=path['join'](config[_0xcb77('0x4c')],_0xcb77('0x5a'),_0x5ad5b6[_0xcb77('0x53')][_0xcb77('0x57')]);var _0x461034=path[_0xcb77('0x4b')](config['root'],'server/files/sounds/converted',util[_0xcb77('0x51')](_0xcb77('0x52'),path[_0xcb77('0x56')](_0x5ad5b6['file'][_0xcb77('0x57')],path[_0xcb77('0x54')](_0x5ad5b6[_0xcb77('0x53')][_0xcb77('0x57')])),_0x944005[_0xcb77('0x49')]));logger[_0xcb77('0x5b')]('Sound\x20upload\x20filepath:\x20%s',_0x92a6df);logger[_0xcb77('0x5b')](_0xcb77('0x5c'),_0x461034);try{fs[_0xcb77('0x5d')](_0x92a6df,parseInt(_0xcb77('0x5e'),0x8));var _0x6dca47=sox[_0xcb77('0x5f')](_0x92a6df,_0x461034,{'sampleRate':0x1f40,'format':_0xcb77('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6dca47['on'](_0xcb77('0x26'),function(_0x425103){fs[_0xcb77('0x60')](_0x92a6df);_0x1fc00f[_0xcb77('0x17')](0x1f4)[_0xcb77('0x29')](_0x425103);});_0x6dca47['on']('src',function(_0x3a03a3){_0x944005[_0xcb77('0x61')]=isNaN(_0x3a03a3[_0xcb77('0x62')])?null:_0x3a03a3['duration']*0x3e8;_0x944005[_0xcb77('0x63')]=isNaN(_0x3a03a3[_0xcb77('0x64')])?null:_0x3a03a3['sampleCount'];_0x944005[_0xcb77('0x65')]=isNaN(_0x3a03a3[_0xcb77('0x66')])?null:_0x3a03a3[_0xcb77('0x66')];_0x944005[_0xcb77('0x67')]=isNaN(_0x3a03a3[_0xcb77('0x68')])?null:_0x3a03a3[_0xcb77('0x68')];_0x944005['original_sampleRate']=isNaN(_0x3a03a3[_0xcb77('0x69')])?null:_0x3a03a3['sampleRate'];});_0x6dca47['on']('dest',function(_0x4b5497){_0x944005[_0xcb77('0x6a')]=isNaN(_0x4b5497[_0xcb77('0x62')])?null:_0x4b5497[_0xcb77('0x62')]*0x3e8;_0x944005['converted_sampleCount']=isNaN(_0x4b5497[_0xcb77('0x64')])?null:_0x4b5497[_0xcb77('0x64')];_0x944005[_0xcb77('0x6b')]=isNaN(_0x4b5497['channelCount'])?null:_0x4b5497[_0xcb77('0x66')];_0x944005[_0xcb77('0x6c')]=isNaN(_0x4b5497['bitRate'])?null:_0x4b5497[_0xcb77('0x68')];_0x944005[_0xcb77('0x6d')]=isNaN(_0x4b5497[_0xcb77('0x69')])?null:_0x4b5497[_0xcb77('0x69')];});_0x6dca47['on']('end',function(){fs[_0xcb77('0x5d')](_0x461034,parseInt(_0xcb77('0x5e'),0x8));return db[_0xcb77('0x2c')]['create'](_0x944005)[_0xcb77('0x21')](function(_0x26ec88){var _0x4f6894={'role':_0x5ad5b6[_0xcb77('0x6e')][_0xcb77('0x6f')],'userProfileId':_0x5ad5b6[_0xcb77('0x6e')][_0xcb77('0x70')]};if(!_0x4f6894)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f6894[_0xcb77('0x6f')]===_0xcb77('0x71')){var _0x17fc61=_0x26ec88[_0xcb77('0x23')]({'plain':!![]});return db[_0xcb77('0x72')][_0xcb77('0x46')]({'where':{'name':_0xcb77('0x24'),'userProfileId':_0x4f6894[_0xcb77('0x70')]},'raw':!![]})['then'](function(_0x16cbd5){if(_0x16cbd5&&_0x16cbd5[_0xcb77('0x73')]===0x0){return db[_0xcb77('0x25')][_0xcb77('0x74')]({'name':_0x17fc61[_0xcb77('0x28')],'resourceId':_0x17fc61['id'],'type':_0x16cbd5[_0xcb77('0x28')],'sectionId':_0x16cbd5['id']},{})[_0xcb77('0x21')](function(){return _0x26ec88;});}else{return _0x26ec88;}})[_0xcb77('0x42')](function(_0xbfa97a){logger[_0xcb77('0x26')](_0xcb77('0x75'),_0xbfa97a);throw _0xbfa97a;});}return _0x26ec88;})[_0xcb77('0x21')](respondWithResult(_0x1fc00f,null))['catch'](handleError(_0x1fc00f,null));});_0x6dca47[_0xcb77('0x76')]();}catch(_0x55c7d4){_0x1fc00f[_0xcb77('0x17')](0x1f4)['send'](_0x55c7d4);}};exports['update']=function(_0x4c80d0,_0x284cce,_0x5431e8){return db[_0xcb77('0x2c')][_0xcb77('0x46')]({'where':{'id':_0x4c80d0['params']['id']}})[_0xcb77('0x21')](handleEntityNotFound(_0x284cce,null))['then'](saveUpdates(_['pick'](_0x4c80d0['body'],[_0xcb77('0x28'),_0xcb77('0x77')]),null))[_0xcb77('0x21')](respondWithResult(_0x284cce,null))[_0xcb77('0x42')](handleError(_0x284cce,null));};exports[_0xcb77('0x78')]=function(_0x1cf887,_0x532462,_0x2beb27){return db[_0xcb77('0x2c')]['find']({'where':{'id':_0x1cf887['params']['id']}})[_0xcb77('0x21')](function(_0x467683){if(_0x467683){return _0x467683[_0xcb77('0x22')]();}})['then'](function(_0x3020a3){var _0x498bb4=path[_0xcb77('0x4b')](config['root'],_0xcb77('0x5a'),util[_0xcb77('0x51')](_0xcb77('0x52'),_0x3020a3[_0xcb77('0x48')],_0x3020a3['original_format']));var _0x32af2a=path[_0xcb77('0x4b')](config[_0xcb77('0x4c')],_0xcb77('0x4d'),util['format']('%s.%s',_0x3020a3[_0xcb77('0x48')],_0x3020a3[_0xcb77('0x49')]));fs[_0xcb77('0x60')](_0x498bb4);fs[_0xcb77('0x60')](_0x32af2a);return _0x3020a3;})[_0xcb77('0x21')](function(_0x4490e7){if(_0x4490e7){return _0x532462[_0xcb77('0x17')](0xcc)[_0xcb77('0x18')]();}})[_0xcb77('0x21')](handleEntityNotFound(_0x532462,null))[_0xcb77('0x42')](handleError(_0x532462,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6787991..d52df27 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 _0x481c=['bluebird','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger'];(function(_0x590114,_0x2ca735){var _0x149e50=function(_0x3275fc){while(--_0x3275fc){_0x590114['push'](_0x590114['shift']());}};_0x149e50(++_0x2ca735);}(_0x481c,0xae));var _0xc481=function(_0x12402f,_0x218029){_0x12402f=_0x12402f-0x0;var _0xa0e25c=_0x481c[_0x12402f];return _0xa0e25c;};'use strict';var _=require('lodash');var util=require(_0xc481('0x0'));var logger=require(_0xc481('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc481('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc481('0x3'));var rimraf=require(_0xc481('0x4'));var config=require(_0xc481('0x5'));var attributes=require(_0xc481('0x6'));module[_0xc481('0x7')]=function(_0x15edea,_0x55fe68){return _0x15edea[_0xc481('0x8')](_0xc481('0x9'),attributes,{'tableName':_0xc481('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb906=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0xb906,0x67));var _0x6b90=function(_0x5b46a8,_0x3890ac){_0x5b46a8=_0x5b46a8-0x0;var _0x486494=_0xb906[_0x5b46a8];return _0x486494;};'use strict';var _=require(_0x6b90('0x0'));var util=require(_0x6b90('0x1'));var logger=require(_0x6b90('0x2'))(_0x6b90('0x3'));var moment=require(_0x6b90('0x4'));var BPromise=require(_0x6b90('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b90('0x6'));var rimraf=require(_0x6b90('0x7'));var config=require(_0x6b90('0x8'));var attributes=require(_0x6b90('0x9'));module[_0x6b90('0xa')]=function(_0x20fc37,_0x32bb32){return _0x20fc37[_0x6b90('0xb')](_0x6b90('0xc'),attributes,{'tableName':_0x6b90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index b39728a..548da25 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 _0xcece=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','ShowSound','Sound','find','options','raw','where','map','model','include','then','stringify'];(function(_0x25fc72,_0x1df053){var _0x3f2323=function(_0x1e1088){while(--_0x1e1088){_0x25fc72['push'](_0x25fc72['shift']());}};_0x3f2323(++_0x1df053);}(_0xcece,0x1ba));var _0xecec=function(_0x48e32a,_0x4a3ace){_0x48e32a=_0x48e32a-0x0;var _0x40a7f7=_0xcece[_0x48e32a];return _0x40a7f7;};'use strict';var _=require(_0xecec('0x0'));var util=require(_0xecec('0x1'));var moment=require(_0xecec('0x2'));var BPromise=require(_0xecec('0x3'));var rs=require(_0xecec('0x4'));var fs=require('fs');var Redis=require(_0xecec('0x5'));var db=require(_0xecec('0x6'))['db'];var utils=require(_0xecec('0x7'));var logger=require(_0xecec('0x8'))(_0xecec('0x9'));var config=require(_0xecec('0xa'));var jayson=require(_0xecec('0xb'));var client=jayson[_0xecec('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc53c1,_0x57ad23,_0x3bff6a){return new BPromise(function(_0x2ff838,_0x15196c){return client[_0xecec('0xd')](_0xbc53c1,_0x3bff6a)['then'](function(_0x443b40){logger['info'](_0xecec('0xe'),_0x57ad23,'request\x20sent');logger[_0xecec('0xf')](_0xecec('0x10'),_0x57ad23,_0xecec('0x11'),JSON['stringify'](_0x443b40));if(_0x443b40[_0xecec('0x12')]){if(_0x443b40[_0xecec('0x12')][_0xecec('0x13')]===0x1f4){logger['error'](_0xecec('0xe'),_0x57ad23,_0x443b40[_0xecec('0x12')][_0xecec('0x14')]);return _0x15196c(_0x443b40[_0xecec('0x12')][_0xecec('0x14')]);}logger['error'](_0xecec('0xe'),_0x57ad23,_0x443b40[_0xecec('0x12')][_0xecec('0x14')]);return _0x2ff838(_0x443b40[_0xecec('0x12')][_0xecec('0x14')]);}else{logger[_0xecec('0x15')](_0xecec('0xe'),_0x57ad23,'request\x20sent');_0x2ff838(_0x443b40['result'][_0xecec('0x14')]);}})[_0xecec('0x16')](function(_0x3f4776){logger[_0xecec('0x12')](_0xecec('0xe'),_0x57ad23,_0x3f4776);_0x15196c(_0x3f4776);});});}exports[_0xecec('0x17')]=function(_0x38566f){var _0x47eb2a=this;return new Promise(function(_0x207666,_0x4db338){return db[_0xecec('0x18')][_0xecec('0x19')]({'raw':_0x38566f['options']?_0x38566f[_0xecec('0x1a')][_0xecec('0x1b')]===undefined?!![]:![]:!![],'where':_0x38566f[_0xecec('0x1a')]?_0x38566f[_0xecec('0x1a')][_0xecec('0x1c')]||null:null,'attributes':_0x38566f[_0xecec('0x1a')]?_0x38566f['options']['attributes']||null:null,'include':_0x38566f[_0xecec('0x1a')]?_0x38566f[_0xecec('0x1a')]['include']?_[_0xecec('0x1d')](_0x38566f[_0xecec('0x1a')]['include'],function(_0xdba352){return{'model':db[_0xdba352[_0xecec('0x1e')]],'as':_0xdba352['as'],'attributes':_0xdba352['attributes'],'include':_0xdba352['include']?_[_0xecec('0x1d')](_0xdba352[_0xecec('0x1f')],function(_0x4b6141){return{'model':db[_0x4b6141[_0xecec('0x1e')]],'as':_0x4b6141['as'],'attributes':_0x4b6141['attributes'],'include':_0x4b6141[_0xecec('0x1f')]?_[_0xecec('0x1d')](_0x4b6141[_0xecec('0x1f')],function(_0x377909){return{'model':db[_0x377909[_0xecec('0x1e')]],'as':_0x377909['as'],'attributes':_0x377909['attributes']};}):[]};}):[]};}):[]:[]})[_0xecec('0x20')](function(_0x5cd7ae){logger[_0xecec('0x15')]('ShowSound',_0x38566f);logger[_0xecec('0xf')](_0xecec('0x17'),_0x38566f,JSON[_0xecec('0x21')](_0x5cd7ae));_0x207666(_0x5cd7ae);})['catch'](function(_0x186007){logger[_0xecec('0x12')]('ShowSound',_0x186007[_0xecec('0x14')],_0x38566f);_0x4db338(_0x47eb2a[_0xecec('0x12')](0x1f4,_0x186007[_0xecec('0x14')]));});});}; \ No newline at end of file +var _0xe6fa=['stringify','error','message','result','catch','ShowSound','Sound','find','options','map','model','attributes','include','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x479453,_0x58f6a7){var _0x27c32d=function(_0x13aba4){while(--_0x13aba4){_0x479453['push'](_0x479453['shift']());}};_0x27c32d(++_0x58f6a7);}(_0xe6fa,0x112));var _0xae6f=function(_0x4d23dc,_0x30def6){_0x4d23dc=_0x4d23dc-0x0;var _0x1ffc30=_0xe6fa[_0x4d23dc];return _0x1ffc30;};'use strict';var _=require(_0xae6f('0x0'));var util=require('util');var moment=require(_0xae6f('0x1'));var BPromise=require(_0xae6f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae6f('0x3'))['db'];var utils=require(_0xae6f('0x4'));var logger=require('../../config/logger')(_0xae6f('0x5'));var config=require(_0xae6f('0x6'));var jayson=require(_0xae6f('0x7'));var client=jayson[_0xae6f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x149cb1,_0x244682,_0x42d4f){return new BPromise(function(_0x4005b3,_0x2807c9){return client[_0xae6f('0x9')](_0x149cb1,_0x42d4f)[_0xae6f('0xa')](function(_0x1afa48){logger[_0xae6f('0xb')](_0xae6f('0xc'),_0x244682,'request\x20sent');logger[_0xae6f('0xd')](_0xae6f('0xe'),_0x244682,_0xae6f('0xf'),JSON[_0xae6f('0x10')](_0x1afa48));if(_0x1afa48[_0xae6f('0x11')]){if(_0x1afa48[_0xae6f('0x11')]['code']===0x1f4){logger['error'](_0xae6f('0xc'),_0x244682,_0x1afa48[_0xae6f('0x11')][_0xae6f('0x12')]);return _0x2807c9(_0x1afa48[_0xae6f('0x11')][_0xae6f('0x12')]);}logger[_0xae6f('0x11')](_0xae6f('0xc'),_0x244682,_0x1afa48[_0xae6f('0x11')]['message']);return _0x4005b3(_0x1afa48['error'][_0xae6f('0x12')]);}else{logger[_0xae6f('0xb')](_0xae6f('0xc'),_0x244682,_0xae6f('0xf'));_0x4005b3(_0x1afa48[_0xae6f('0x13')][_0xae6f('0x12')]);}})[_0xae6f('0x14')](function(_0x21b39b){logger[_0xae6f('0x11')]('Sound,\x20%s,\x20%s',_0x244682,_0x21b39b);_0x2807c9(_0x21b39b);});});}exports[_0xae6f('0x15')]=function(_0x2b310e){var _0x195fac=this;return new Promise(function(_0x18b286,_0x542e5b){return db[_0xae6f('0x16')][_0xae6f('0x17')]({'raw':_0x2b310e[_0xae6f('0x18')]?_0x2b310e[_0xae6f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2b310e[_0xae6f('0x18')]?_0x2b310e['options']['where']||null:null,'attributes':_0x2b310e['options']?_0x2b310e[_0xae6f('0x18')]['attributes']||null:null,'include':_0x2b310e[_0xae6f('0x18')]?_0x2b310e['options']['include']?_[_0xae6f('0x19')](_0x2b310e['options']['include'],function(_0x25ec40){return{'model':db[_0x25ec40[_0xae6f('0x1a')]],'as':_0x25ec40['as'],'attributes':_0x25ec40[_0xae6f('0x1b')],'include':_0x25ec40['include']?_[_0xae6f('0x19')](_0x25ec40['include'],function(_0x13e476){return{'model':db[_0x13e476[_0xae6f('0x1a')]],'as':_0x13e476['as'],'attributes':_0x13e476['attributes'],'include':_0x13e476[_0xae6f('0x1c')]?_[_0xae6f('0x19')](_0x13e476['include'],function(_0x573ee8){return{'model':db[_0x573ee8[_0xae6f('0x1a')]],'as':_0x573ee8['as'],'attributes':_0x573ee8[_0xae6f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae6f('0xa')](function(_0x15d669){logger['info'](_0xae6f('0x15'),_0x2b310e);logger[_0xae6f('0xd')](_0xae6f('0x15'),_0x2b310e,JSON['stringify'](_0x15d669));_0x18b286(_0x15d669);})[_0xae6f('0x14')](function(_0x27d01b){logger[_0xae6f('0x11')](_0xae6f('0x15'),_0x27d01b[_0xae6f('0x12')],_0x2b310e);_0x542e5b(_0x195fac[_0xae6f('0x11')](0x1f4,_0x27d01b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 59eb5dd..f61a7af 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x103c05,_0xd9c7dc){var _0x4ac7df=function(_0x298420){while(--_0x298420){_0x103c05['push'](_0x103c05['shift']());}};_0x4ac7df(++_0xd9c7dc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'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('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0x4fc2,0x111));var _0x24fc=function(_0x341c44,_0x2e1057){_0x341c44=_0x341c44-0x0;var _0x2bda72=_0x4fc2[_0x341c44];return _0x2bda72;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('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 57a7aa4..34ddceb 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 _0x5449=['medium','out','sequelize','exports','STRING','TEXT'];(function(_0x14cc34,_0x3b22cd){var _0x3a5734=function(_0x1e055a){while(--_0x1e055a){_0x14cc34['push'](_0x14cc34['shift']());}};_0x3a5734(++_0x3b22cd);}(_0x5449,0x194));var _0x9544=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x5449[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require(_0x9544('0x0'));module[_0x9544('0x1')]={'uniqueid':{'type':Sequelize[_0x9544('0x2')]},'body':{'type':Sequelize[_0x9544('0x3')](_0x9544('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9544('0x5')),'defaultValue':_0x9544('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9544('0x3')]}}; \ No newline at end of file +var _0x3ee8=['medium','out','STRING','TEXT'];(function(_0x5ca60b,_0x197b58){var _0x3a1883=function(_0x15e331){while(--_0x15e331){_0x5ca60b['push'](_0x5ca60b['shift']());}};_0x3a1883(++_0x197b58);}(_0x3ee8,0x16f));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x83ee('0x0')](_0x83ee('0x1')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x83ee('0x2')),'defaultValue':_0x83ee('0x2'),'allowNull':![]},'providerName':{'type':Sequelize[_0x83ee('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2b86006..87814fc 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 _0x5f4d=['body','eml-format','rimraf','zip-dir','request-promise','moment','util','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','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0x5f4d,0x91));var _0xd5f4=function(_0x4956e7,_0x17fe2c){_0x4956e7=_0x4956e7-0x0;var _0x1f33e9=_0x5f4d[_0x4956e7];return _0x1f33e9;};'use strict';var emlformat=require(_0xd5f4('0x0'));var rimraf=require(_0xd5f4('0x1'));var zipdir=require(_0xd5f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5f4('0x3'));var moment=require(_0xd5f4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd5f4('0x5'));var path=require('path');var sox=require(_0xd5f4('0x6'));var csv=require(_0xd5f4('0x7'));var ejs=require(_0xd5f4('0x8'));var fs=require('fs');var fs_extra=require(_0xd5f4('0x9'));var _=require(_0xd5f4('0xa'));var squel=require(_0xd5f4('0xb'));var crypto=require(_0xd5f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd5f4('0xd'));var toCsv=require(_0xd5f4('0x7'));var querystring=require(_0xd5f4('0xe'));var Papa=require(_0xd5f4('0xf'));var Redis=require('ioredis');var authService=require(_0xd5f4('0x10'));var qs=require(_0xd5f4('0x11'));var as=require(_0xd5f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5f4('0x13'))(_0xd5f4('0x14'));var utils=require(_0xd5f4('0x15'));var config=require(_0xd5f4('0x16'));var licenseUtil=require(_0xd5f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23f551,_0x42b25d){_0x42b25d=_0x42b25d||0xcc;return function(_0x2c1ec1){if(_0x2c1ec1){return _0x23f551[_0xd5f4('0x18')](_0x42b25d);}return _0x23f551[_0xd5f4('0x19')](_0x42b25d)['end']();};}function respondWithResult(_0x503909,_0x46f403){_0x46f403=_0x46f403||0xc8;return function(_0x1273b6){if(_0x1273b6){return _0x503909[_0xd5f4('0x19')](_0x46f403)[_0xd5f4('0x1a')](_0x1273b6);}};}function respondWithFilteredResult(_0xf2ac4d,_0x277f8e){return function(_0x1082ea){if(_0x1082ea){var _0x4dca10=typeof _0x277f8e[_0xd5f4('0x1b')]==='undefined'&&typeof _0x277f8e[_0xd5f4('0x1c')]==='undefined';var _0x4b9fcf=_0x1082ea[_0xd5f4('0x1d')];var _0x5845b7=_0x4dca10?0x0:_0x277f8e['offset'];var _0x17a9ad=_0x4dca10?_0x1082ea['count']:_0x277f8e[_0xd5f4('0x1b')]+_0x277f8e[_0xd5f4('0x1c')];var _0x33b7d3;if(_0x17a9ad>=_0x4b9fcf){_0x17a9ad=_0x4b9fcf;_0x33b7d3=0xc8;}else{_0x33b7d3=0xce;}_0xf2ac4d['status'](_0x33b7d3);return _0xf2ac4d[_0xd5f4('0x1e')](_0xd5f4('0x1f'),_0x5845b7+'-'+_0x17a9ad+'/'+_0x4b9fcf)[_0xd5f4('0x1a')](_0x1082ea);}return null;};}function patchUpdates(_0xe86d89){return function(_0x164552){try{jsonpatch['apply'](_0x164552,_0xe86d89,!![]);}catch(_0x187177){return BPromise[_0xd5f4('0x20')](_0x187177);}return _0x164552[_0xd5f4('0x21')]();};}function saveUpdates(_0x3b1560,_0xab182c){return function(_0x265299){if(_0x265299){return _0x265299[_0xd5f4('0x22')](_0x3b1560)[_0xd5f4('0x23')](function(_0x5e43b7){return _0x5e43b7;});}return null;};}function removeEntity(_0x1e601e,_0x1356a5){return function(_0x5cd927){if(_0x5cd927){return _0x5cd927['destroy']()['then'](function(){_0x1e601e['status'](0xcc)[_0xd5f4('0x24')]();});}};}function handleEntityNotFound(_0x7e1494,_0x29f9e4){return function(_0x1b811c){if(!_0x1b811c){_0x7e1494[_0xd5f4('0x18')](0x194);}return _0x1b811c;};}function handleError(_0x247e92,_0x471dd6){_0x471dd6=_0x471dd6||0x1f4;return function(_0x58fd9c){logger[_0xd5f4('0x25')](_0x58fd9c[_0xd5f4('0x26')]);if(_0x58fd9c[_0xd5f4('0x27')]){delete _0x58fd9c[_0xd5f4('0x27')];}_0x247e92[_0xd5f4('0x19')](_0x471dd6)[_0xd5f4('0x28')](_0x58fd9c);};}exports[_0xd5f4('0x29')]=function(_0x16223c,_0x53fb69){var _0x2bf553={},_0x4e3742={},_0x3e10ff={'count':0x0,'rows':[]};var _0x114023=_[_0xd5f4('0x2a')](db[_0xd5f4('0x2b')][_0xd5f4('0x2c')],function(_0x36ba7c){return{'name':_0x36ba7c[_0xd5f4('0x2d')],'type':_0x36ba7c['type'][_0xd5f4('0x2e')]};});_0x4e3742['model']=_[_0xd5f4('0x2a')](_0x114023,_0xd5f4('0x27'));_0x4e3742[_0xd5f4('0x2f')]=_[_0xd5f4('0x30')](_0x16223c[_0xd5f4('0x2f')]);_0x4e3742[_0xd5f4('0x31')]=_[_0xd5f4('0x32')](_0x4e3742[_0xd5f4('0x33')],_0x4e3742['query']);_0x2bf553[_0xd5f4('0x34')]=_[_0xd5f4('0x32')](_0x4e3742[_0xd5f4('0x33')],qs['fields'](_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x35')]));_0x2bf553[_0xd5f4('0x34')]=_0x2bf553[_0xd5f4('0x34')][_0xd5f4('0x36')]?_0x2bf553[_0xd5f4('0x34')]:_0x4e3742[_0xd5f4('0x33')];if(!_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x37')]('nolimit')){_0x2bf553['limit']=qs[_0xd5f4('0x1c')](_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x1c')]);_0x2bf553['offset']=qs[_0xd5f4('0x1b')](_0x16223c['query'][_0xd5f4('0x1b')]);}_0x2bf553[_0xd5f4('0x38')]=qs[_0xd5f4('0x39')](_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x39')]);_0x2bf553[_0xd5f4('0x3a')]=qs[_0xd5f4('0x31')](_[_0xd5f4('0x3b')](_0x16223c['query'],_0x4e3742[_0xd5f4('0x31')]),_0x114023);if(_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x3c')]){_0x2bf553['where']=_['merge'](_0x2bf553[_0xd5f4('0x3a')],{'$or':_['map'](_0x114023,function(_0x395044){if(_0x395044['type']!==_0xd5f4('0x3d')){var _0xe94da8={};_0xe94da8[_0x395044[_0xd5f4('0x27')]]={'$like':'%'+_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x3c')]+'%'};return _0xe94da8;}})});}_0x2bf553=_[_0xd5f4('0x3e')]({},_0x2bf553,_0x16223c[_0xd5f4('0x3f')]);var _0x3856cd={'where':_0x2bf553[_0xd5f4('0x3a')]};return db[_0xd5f4('0x2b')][_0xd5f4('0x1d')](_0x3856cd)[_0xd5f4('0x23')](function(_0xed93cf){_0x3e10ff[_0xd5f4('0x1d')]=_0xed93cf;if(_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x40')]){_0x2bf553[_0xd5f4('0x41')]=[{'all':!![]}];}return db[_0xd5f4('0x2b')]['findAll'](_0x2bf553);})[_0xd5f4('0x23')](function(_0x5c89ed){_0x3e10ff[_0xd5f4('0x42')]=_0x5c89ed;return _0x3e10ff;})[_0xd5f4('0x23')](respondWithFilteredResult(_0x53fb69,_0x2bf553))[_0xd5f4('0x43')](handleError(_0x53fb69,null));};exports['show']=function(_0x427ce1,_0xde04b3){var _0x2c829a={'raw':!![],'where':{'id':_0x427ce1[_0xd5f4('0x44')]['id']}},_0x4a7455={};_0x4a7455['model']=_[_0xd5f4('0x30')](db[_0xd5f4('0x2b')]['rawAttributes']);_0x4a7455[_0xd5f4('0x2f')]=_[_0xd5f4('0x30')](_0x427ce1[_0xd5f4('0x2f')]);_0x4a7455[_0xd5f4('0x31')]=_[_0xd5f4('0x32')](_0x4a7455[_0xd5f4('0x33')],_0x4a7455[_0xd5f4('0x2f')]);_0x2c829a['attributes']=_['intersection'](_0x4a7455[_0xd5f4('0x33')],qs[_0xd5f4('0x35')](_0x427ce1[_0xd5f4('0x2f')]['fields']));_0x2c829a[_0xd5f4('0x34')]=_0x2c829a['attributes'][_0xd5f4('0x36')]?_0x2c829a['attributes']:_0x4a7455['model'];if(_0x427ce1['query'][_0xd5f4('0x40')]){_0x2c829a['include']=[{'all':!![]}];}_0x2c829a=_['merge']({},_0x2c829a,_0x427ce1['options']);return db[_0xd5f4('0x2b')][_0xd5f4('0x45')](_0x2c829a)[_0xd5f4('0x23')](handleEntityNotFound(_0xde04b3,null))['then'](respondWithResult(_0xde04b3,null))[_0xd5f4('0x43')](handleError(_0xde04b3,null));};exports[_0xd5f4('0x46')]=function(_0x3bc05a,_0x21dc98){return db[_0xd5f4('0x2b')][_0xd5f4('0x46')](_0x3bc05a['body'],{})['then'](respondWithResult(_0x21dc98,0xc9))[_0xd5f4('0x43')](handleError(_0x21dc98,null));};exports['update']=function(_0x237ecd,_0x2de58e){if(_0x237ecd['body']['id']){delete _0x237ecd[_0xd5f4('0x47')]['id'];}return db['SquareMessage'][_0xd5f4('0x45')]({'where':{'id':_0x237ecd['params']['id']}})[_0xd5f4('0x23')](handleEntityNotFound(_0x2de58e,null))[_0xd5f4('0x23')](saveUpdates(_0x237ecd[_0xd5f4('0x47')],null))['then'](respondWithResult(_0x2de58e,null))[_0xd5f4('0x43')](handleError(_0x2de58e,null));};exports['destroy']=function(_0x523988,_0x51ffb9){return db[_0xd5f4('0x2b')]['find']({'where':{'id':_0x523988[_0xd5f4('0x44')]['id']}})[_0xd5f4('0x23')](handleEntityNotFound(_0x51ffb9,null))[_0xd5f4('0x23')](removeEntity(_0x51ffb9,null))['catch'](handleError(_0x51ffb9,null));}; \ No newline at end of file +var _0xa0a3=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','include','catch','params','rawAttributes','create','body','find','rimraf','zip-dir','request-promise'];(function(_0x3cffd6,_0x58339d){var _0x3dbb05=function(_0xf6eb42){while(--_0xf6eb42){_0x3cffd6['push'](_0x3cffd6['shift']());}};_0x3dbb05(++_0x58339d);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x23024d,_0xbeee8c){_0x23024d=_0x23024d-0x0;var _0x3bd95b=_0xa0a3[_0x23024d];return _0x3bd95b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a0a('0x0'));var zipdir=require(_0x3a0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a0a('0x2'));var moment=require(_0x3a0a('0x3'));var BPromise=require(_0x3a0a('0x4'));var Mustache=require(_0x3a0a('0x5'));var util=require(_0x3a0a('0x6'));var path=require(_0x3a0a('0x7'));var sox=require(_0x3a0a('0x8'));var csv=require(_0x3a0a('0x9'));var ejs=require(_0x3a0a('0xa'));var fs=require('fs');var fs_extra=require(_0x3a0a('0xb'));var _=require(_0x3a0a('0xc'));var squel=require(_0x3a0a('0xd'));var crypto=require(_0x3a0a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3a0a('0x9'));var querystring=require(_0x3a0a('0xf'));var Papa=require(_0x3a0a('0x10'));var Redis=require(_0x3a0a('0x11'));var authService=require(_0x3a0a('0x12'));var qs=require(_0x3a0a('0x13'));var as=require(_0x3a0a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3a0a('0x15'));var utils=require(_0x3a0a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a0a('0x17'))['db'];function respondWithStatusCode(_0x1db53c,_0x52cb58){_0x52cb58=_0x52cb58||0xcc;return function(_0x2243d2){if(_0x2243d2){return _0x1db53c[_0x3a0a('0x18')](_0x52cb58);}return _0x1db53c[_0x3a0a('0x19')](_0x52cb58)[_0x3a0a('0x1a')]();};}function respondWithResult(_0x977120,_0x303dc7){_0x303dc7=_0x303dc7||0xc8;return function(_0x350d58){if(_0x350d58){return _0x977120[_0x3a0a('0x19')](_0x303dc7)[_0x3a0a('0x1b')](_0x350d58);}};}function respondWithFilteredResult(_0x21e0f7,_0x11eeee){return function(_0x22a60e){if(_0x22a60e){var _0x52f629=typeof _0x11eeee[_0x3a0a('0x1c')]==='undefined'&&typeof _0x11eeee[_0x3a0a('0x1d')]==='undefined';var _0x2f5e77=_0x22a60e[_0x3a0a('0x1e')];var _0x36582f=_0x52f629?0x0:_0x11eeee['offset'];var _0x104679=_0x52f629?_0x22a60e[_0x3a0a('0x1e')]:_0x11eeee['offset']+_0x11eeee[_0x3a0a('0x1d')];var _0x26f7bb;if(_0x104679>=_0x2f5e77){_0x104679=_0x2f5e77;_0x26f7bb=0xc8;}else{_0x26f7bb=0xce;}_0x21e0f7[_0x3a0a('0x19')](_0x26f7bb);return _0x21e0f7[_0x3a0a('0x1f')](_0x3a0a('0x20'),_0x36582f+'-'+_0x104679+'/'+_0x2f5e77)[_0x3a0a('0x1b')](_0x22a60e);}return null;};}function patchUpdates(_0x3e99f9){return function(_0x231541){try{jsonpatch[_0x3a0a('0x21')](_0x231541,_0x3e99f9,!![]);}catch(_0x430509){return BPromise['reject'](_0x430509);}return _0x231541['save']();};}function saveUpdates(_0x483039,_0x33560b){return function(_0x6681b2){if(_0x6681b2){return _0x6681b2[_0x3a0a('0x22')](_0x483039)[_0x3a0a('0x23')](function(_0x1468a9){return _0x1468a9;});}return null;};}function removeEntity(_0x49d60d,_0x280022){return function(_0x1d2eac){if(_0x1d2eac){return _0x1d2eac[_0x3a0a('0x24')]()['then'](function(){_0x49d60d[_0x3a0a('0x19')](0xcc)[_0x3a0a('0x1a')]();});}};}function handleEntityNotFound(_0x496348,_0x5aae8c){return function(_0x16e93d){if(!_0x16e93d){_0x496348[_0x3a0a('0x18')](0x194);}return _0x16e93d;};}function handleError(_0x370f91,_0x57b1b2){_0x57b1b2=_0x57b1b2||0x1f4;return function(_0x1de069){logger[_0x3a0a('0x25')](_0x1de069[_0x3a0a('0x26')]);if(_0x1de069[_0x3a0a('0x27')]){delete _0x1de069[_0x3a0a('0x27')];}_0x370f91['status'](_0x57b1b2)['send'](_0x1de069);};}exports[_0x3a0a('0x28')]=function(_0x3d01d8,_0x4eab2e){var _0x4aa1b5={},_0x2b45dd={},_0x2e7481={'count':0x0,'rows':[]};var _0x3a4eb8=_[_0x3a0a('0x29')](db['SquareMessage']['rawAttributes'],function(_0x38aaa0){return{'name':_0x38aaa0[_0x3a0a('0x2a')],'type':_0x38aaa0[_0x3a0a('0x2b')]['key']};});_0x2b45dd[_0x3a0a('0x2c')]=_[_0x3a0a('0x29')](_0x3a4eb8,_0x3a0a('0x27'));_0x2b45dd[_0x3a0a('0x2d')]=_[_0x3a0a('0x2e')](_0x3d01d8[_0x3a0a('0x2d')]);_0x2b45dd[_0x3a0a('0x2f')]=_[_0x3a0a('0x30')](_0x2b45dd[_0x3a0a('0x2c')],_0x2b45dd['query']);_0x4aa1b5[_0x3a0a('0x31')]=_[_0x3a0a('0x30')](_0x2b45dd[_0x3a0a('0x2c')],qs[_0x3a0a('0x32')](_0x3d01d8[_0x3a0a('0x2d')]['fields']));_0x4aa1b5[_0x3a0a('0x31')]=_0x4aa1b5[_0x3a0a('0x31')][_0x3a0a('0x33')]?_0x4aa1b5[_0x3a0a('0x31')]:_0x2b45dd[_0x3a0a('0x2c')];if(!_0x3d01d8[_0x3a0a('0x2d')]['hasOwnProperty'](_0x3a0a('0x34'))){_0x4aa1b5[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x3d01d8[_0x3a0a('0x2d')][_0x3a0a('0x1d')]);_0x4aa1b5[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x3d01d8[_0x3a0a('0x2d')]['offset']);}_0x4aa1b5[_0x3a0a('0x35')]=qs[_0x3a0a('0x36')](_0x3d01d8[_0x3a0a('0x2d')][_0x3a0a('0x36')]);_0x4aa1b5[_0x3a0a('0x37')]=qs[_0x3a0a('0x2f')](_[_0x3a0a('0x38')](_0x3d01d8[_0x3a0a('0x2d')],_0x2b45dd['filters']),_0x3a4eb8);if(_0x3d01d8[_0x3a0a('0x2d')][_0x3a0a('0x39')]){_0x4aa1b5[_0x3a0a('0x37')]=_[_0x3a0a('0x3a')](_0x4aa1b5[_0x3a0a('0x37')],{'$or':_[_0x3a0a('0x29')](_0x3a4eb8,function(_0x160eda){if(_0x160eda[_0x3a0a('0x2b')]!==_0x3a0a('0x3b')){var _0x491e66={};_0x491e66[_0x160eda[_0x3a0a('0x27')]]={'$like':'%'+_0x3d01d8['query'][_0x3a0a('0x39')]+'%'};return _0x491e66;}})});}_0x4aa1b5=_[_0x3a0a('0x3a')]({},_0x4aa1b5,_0x3d01d8[_0x3a0a('0x3c')]);var _0x350805={'where':_0x4aa1b5['where']};return db[_0x3a0a('0x3d')]['count'](_0x350805)[_0x3a0a('0x23')](function(_0x45199c){_0x2e7481[_0x3a0a('0x1e')]=_0x45199c;if(_0x3d01d8[_0x3a0a('0x2d')]['includeAll']){_0x4aa1b5[_0x3a0a('0x3e')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x4aa1b5);})[_0x3a0a('0x23')](function(_0x4f9b60){_0x2e7481['rows']=_0x4f9b60;return _0x2e7481;})[_0x3a0a('0x23')](respondWithFilteredResult(_0x4eab2e,_0x4aa1b5))[_0x3a0a('0x3f')](handleError(_0x4eab2e,null));};exports['show']=function(_0x371484,_0x42cc5a){var _0x3ec666={'raw':!![],'where':{'id':_0x371484[_0x3a0a('0x40')]['id']}},_0xd16d0={};_0xd16d0['model']=_[_0x3a0a('0x2e')](db[_0x3a0a('0x3d')][_0x3a0a('0x41')]);_0xd16d0[_0x3a0a('0x2d')]=_[_0x3a0a('0x2e')](_0x371484[_0x3a0a('0x2d')]);_0xd16d0[_0x3a0a('0x2f')]=_[_0x3a0a('0x30')](_0xd16d0['model'],_0xd16d0['query']);_0x3ec666[_0x3a0a('0x31')]=_[_0x3a0a('0x30')](_0xd16d0[_0x3a0a('0x2c')],qs['fields'](_0x371484[_0x3a0a('0x2d')][_0x3a0a('0x32')]));_0x3ec666[_0x3a0a('0x31')]=_0x3ec666[_0x3a0a('0x31')]['length']?_0x3ec666[_0x3a0a('0x31')]:_0xd16d0['model'];if(_0x371484[_0x3a0a('0x2d')]['includeAll']){_0x3ec666[_0x3a0a('0x3e')]=[{'all':!![]}];}_0x3ec666=_['merge']({},_0x3ec666,_0x371484[_0x3a0a('0x3c')]);return db[_0x3a0a('0x3d')]['find'](_0x3ec666)['then'](handleEntityNotFound(_0x42cc5a,null))[_0x3a0a('0x23')](respondWithResult(_0x42cc5a,null))[_0x3a0a('0x3f')](handleError(_0x42cc5a,null));};exports[_0x3a0a('0x42')]=function(_0x98023a,_0x403980){return db[_0x3a0a('0x3d')]['create'](_0x98023a['body'],{})[_0x3a0a('0x23')](respondWithResult(_0x403980,0xc9))[_0x3a0a('0x3f')](handleError(_0x403980,null));};exports['update']=function(_0x48aa92,_0x1ef695){if(_0x48aa92['body']['id']){delete _0x48aa92[_0x3a0a('0x43')]['id'];}return db[_0x3a0a('0x3d')][_0x3a0a('0x44')]({'where':{'id':_0x48aa92[_0x3a0a('0x40')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x1ef695,null))[_0x3a0a('0x23')](saveUpdates(_0x48aa92['body'],null))['then'](respondWithResult(_0x1ef695,null))[_0x3a0a('0x3f')](handleError(_0x1ef695,null));};exports[_0x3a0a('0x24')]=function(_0x201dca,_0x1bb605){return db[_0x3a0a('0x3d')]['find']({'where':{'id':_0x201dca[_0x3a0a('0x40')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x1bb605,null))['then'](removeEntity(_0x1bb605,null))['catch'](handleError(_0x1bb605,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6e86796..05c4ab6 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 _0x4190=['request-promise','path','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','api','moment'];(function(_0x17dee0,_0x32dcc2){var _0x12dd10=function(_0x1da54a){while(--_0x1da54a){_0x17dee0['push'](_0x17dee0['shift']());}};_0x12dd10(++_0x32dcc2);}(_0x4190,0x13b));var _0x0419=function(_0x544362,_0xc31c04){_0x544362=_0x544362-0x0;var _0x5c12f9=_0x4190[_0x544362];return _0x5c12f9;};'use strict';var _=require(_0x0419('0x0'));var util=require(_0x0419('0x1'));var logger=require('../../config/logger')(_0x0419('0x2'));var moment=require(_0x0419('0x3'));var BPromise=require('bluebird');var rp=require(_0x0419('0x4'));var fs=require('fs');var path=require(_0x0419('0x5'));var rimraf=require('rimraf');var config=require(_0x0419('0x6'));var attributes=require(_0x0419('0x7'));module[_0x0419('0x8')]=function(_0x4aeba2,_0x2ad2a1){return _0x4aeba2['define'](_0x0419('0x9'),attributes,{'tableName':_0x0419('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ebb=['SquareMessage','square_messages','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x253d20,_0x5428de){var _0x4d294d=function(_0x58a896){while(--_0x58a896){_0x253d20['push'](_0x253d20['shift']());}};_0x4d294d(++_0x5428de);}(_0x1ebb,0x192));var _0xb1eb=function(_0x19f25a,_0x300162){_0x19f25a=_0x19f25a-0x0;var _0x431e54=_0x1ebb[_0x19f25a];return _0x431e54;};'use strict';var _=require(_0xb1eb('0x0'));var util=require(_0xb1eb('0x1'));var logger=require(_0xb1eb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb1eb('0x3'));var rp=require(_0xb1eb('0x4'));var fs=require('fs');var path=require(_0xb1eb('0x5'));var rimraf=require(_0xb1eb('0x6'));var config=require(_0xb1eb('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x4e1833,_0x594597){return _0x4e1833['define'](_0xb1eb('0x8'),attributes,{'tableName':_0xb1eb('0x9'),'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 705b8ca..dfd076c 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 _0x4c84=['../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x318841,_0x4992c5){var _0x399a00=function(_0xbf4b61){while(--_0xbf4b61){_0x318841['push'](_0x318841['shift']());}};_0x399a00(++_0x4992c5);}(_0x4c84,0x1e8));var _0x44c8=function(_0x3c141c,_0x1a390b){_0x3c141c=_0x3c141c-0x0;var _0x31522c=_0x4c84[_0x3c141c];return _0x31522c;};'use strict';var _=require(_0x44c8('0x0'));var util=require('util');var moment=require(_0x44c8('0x1'));var BPromise=require('bluebird');var rs=require(_0x44c8('0x2'));var fs=require('fs');var Redis=require(_0x44c8('0x3'));var db=require(_0x44c8('0x4'))['db'];var utils=require(_0x44c8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x44c8('0x6'));var jayson=require(_0x44c8('0x7'));var client=jayson[_0x44c8('0x8')][_0x44c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x440812,_0x478da4,_0x59c667){return new BPromise(function(_0x53da33,_0x225ace){return client[_0x44c8('0xa')](_0x440812,_0x59c667)['then'](function(_0x1efb5f){logger[_0x44c8('0xb')](_0x44c8('0xc'),_0x478da4,_0x44c8('0xd'));logger[_0x44c8('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x478da4,_0x44c8('0xd'),JSON[_0x44c8('0xf')](_0x1efb5f));if(_0x1efb5f['error']){if(_0x1efb5f[_0x44c8('0x10')][_0x44c8('0x11')]===0x1f4){logger[_0x44c8('0x10')](_0x44c8('0xc'),_0x478da4,_0x1efb5f[_0x44c8('0x10')]['message']);return _0x225ace(_0x1efb5f[_0x44c8('0x10')][_0x44c8('0x12')]);}logger['error'](_0x44c8('0xc'),_0x478da4,_0x1efb5f[_0x44c8('0x10')][_0x44c8('0x12')]);return _0x53da33(_0x1efb5f[_0x44c8('0x10')][_0x44c8('0x12')]);}else{logger['info'](_0x44c8('0xc'),_0x478da4,'request\x20sent');_0x53da33(_0x1efb5f['result']['message']);}})['catch'](function(_0x25c19c){logger[_0x44c8('0x10')](_0x44c8('0xc'),_0x478da4,_0x25c19c);_0x225ace(_0x25c19c);});});}exports[_0x44c8('0x13')]=function(_0x137f2c){var _0x148cb9=this;return new Promise(function(_0x352cde,_0x27538c){return db[_0x44c8('0x14')][_0x44c8('0x15')](_0x137f2c[_0x44c8('0x16')],{'raw':_0x137f2c['options']?_0x137f2c[_0x44c8('0x17')][_0x44c8('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x23d10d){logger[_0x44c8('0xb')](_0x44c8('0x13'),_0x137f2c);logger['debug'](_0x44c8('0x13'),_0x137f2c,JSON[_0x44c8('0xf')](_0x23d10d));_0x352cde(_0x23d10d);})[_0x44c8('0x19')](function(_0x4f6ca6){logger[_0x44c8('0x10')]('CreateSquareMessage',_0x4f6ca6[_0x44c8('0x12')],_0x137f2c);_0x27538c(_0x148cb9[_0x44c8('0x10')](0x1f4,_0x4f6ca6['message']));});});}; \ No newline at end of file +var _0x9a61=['error','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9a61,0x158));var _0x19a6=function(_0x599e27,_0x48576a){_0x599e27=_0x599e27-0x0;var _0x56322e=_0x9a61[_0x599e27];return _0x56322e;};'use strict';var _=require(_0x19a6('0x0'));var util=require('util');var moment=require(_0x19a6('0x1'));var BPromise=require(_0x19a6('0x2'));var rs=require(_0x19a6('0x3'));var fs=require('fs');var Redis=require(_0x19a6('0x4'));var db=require(_0x19a6('0x5'))['db'];var utils=require(_0x19a6('0x6'));var logger=require(_0x19a6('0x7'))(_0x19a6('0x8'));var config=require(_0x19a6('0x9'));var jayson=require(_0x19a6('0xa'));var client=jayson[_0x19a6('0xb')][_0x19a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x357010,_0x16fda5,_0x5c37ff){return new BPromise(function(_0x4542fb,_0x3e04d4){return client[_0x19a6('0xd')](_0x357010,_0x5c37ff)[_0x19a6('0xe')](function(_0x28f661){logger[_0x19a6('0xf')]('SquareMessage,\x20%s,\x20%s',_0x16fda5,_0x19a6('0x10'));logger[_0x19a6('0x11')](_0x19a6('0x12'),_0x16fda5,_0x19a6('0x10'),JSON[_0x19a6('0x13')](_0x28f661));if(_0x28f661[_0x19a6('0x14')]){if(_0x28f661['error']['code']===0x1f4){logger[_0x19a6('0x14')](_0x19a6('0x15'),_0x16fda5,_0x28f661[_0x19a6('0x14')][_0x19a6('0x16')]);return _0x3e04d4(_0x28f661['error'][_0x19a6('0x16')]);}logger[_0x19a6('0x14')](_0x19a6('0x15'),_0x16fda5,_0x28f661[_0x19a6('0x14')][_0x19a6('0x16')]);return _0x4542fb(_0x28f661[_0x19a6('0x14')][_0x19a6('0x16')]);}else{logger[_0x19a6('0xf')]('SquareMessage,\x20%s,\x20%s',_0x16fda5,'request\x20sent');_0x4542fb(_0x28f661[_0x19a6('0x17')][_0x19a6('0x16')]);}})[_0x19a6('0x18')](function(_0x4e25c4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x16fda5,_0x4e25c4);_0x3e04d4(_0x4e25c4);});});}exports[_0x19a6('0x19')]=function(_0x15b036){var _0x108022=this;return new Promise(function(_0x10f2b3,_0x318fc5){return db['SquareMessage']['create'](_0x15b036['body'],{'raw':_0x15b036[_0x19a6('0x1a')]?_0x15b036[_0x19a6('0x1a')][_0x19a6('0x1b')]===undefined?!![]:![]:!![]})[_0x19a6('0xe')](function(_0x325c32){logger[_0x19a6('0xf')]('CreateSquareMessage',_0x15b036);logger['debug']('CreateSquareMessage',_0x15b036,JSON['stringify'](_0x325c32));_0x10f2b3(_0x325c32);})[_0x19a6('0x18')](function(_0x50fc7){logger[_0x19a6('0x14')]('CreateSquareMessage',_0x50fc7[_0x19a6('0x16')],_0x15b036);_0x318fc5(_0x108022[_0x19a6('0x14')](0x1f4,_0x50fc7[_0x19a6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b34656e..9257b0d 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 _0x33b9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','/:id/test','15s','test','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x47d225,_0x5269a2){var _0x7ea77c=function(_0xbf4170){while(--_0xbf4170){_0x47d225['push'](_0x47d225['shift']());}};_0x7ea77c(++_0x5269a2);}(_0x33b9,0x1f4));var _0x933b=function(_0x58c5e1,_0x12c82d){_0x58c5e1=_0x58c5e1-0x0;var _0x3e4c80=_0x33b9[_0x58c5e1];return _0x3e4c80;};'use strict';var multer=require(_0x933b('0x0'));var util=require(_0x933b('0x1'));var path=require(_0x933b('0x2'));var timeout=require('connect-timeout');var express=require(_0x933b('0x3'));var router=express[_0x933b('0x4')]();var fs_extra=require(_0x933b('0x5'));var auth=require(_0x933b('0x6'));var interaction=require(_0x933b('0x7'));var config=require(_0x933b('0x8'));var controller=require(_0x933b('0x9'));router['get']('/',auth[_0x933b('0xa')](),controller[_0x933b('0xb')]);router[_0x933b('0xc')](_0x933b('0xd'),auth[_0x933b('0xa')](),controller['show']);router[_0x933b('0xc')](_0x933b('0xe'),auth[_0x933b('0xa')](),timeout(_0x933b('0xf')),controller[_0x933b('0x10')]);router[_0x933b('0x11')]('/',auth[_0x933b('0xa')](),controller[_0x933b('0x12')]);router[_0x933b('0x13')](_0x933b('0xd'),auth[_0x933b('0xa')](),controller['update']);router[_0x933b('0x14')](_0x933b('0xd'),auth[_0x933b('0xa')](),controller[_0x933b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2fb0=['show','/:id/test','test','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0x2c03cf,_0x3b0341){var _0x21b177=function(_0x5531e8){while(--_0x5531e8){_0x2c03cf['push'](_0x2c03cf['shift']());}};_0x21b177(++_0x3b0341);}(_0x2fb0,0x107));var _0x02fb=function(_0x4f39fd,_0x36d85f){_0x4f39fd=_0x4f39fd-0x0;var _0x4ef809=_0x2fb0[_0x4f39fd];return _0x4ef809;};'use strict';var multer=require('multer');var util=require(_0x02fb('0x0'));var path=require(_0x02fb('0x1'));var timeout=require(_0x02fb('0x2'));var express=require(_0x02fb('0x3'));var router=express[_0x02fb('0x4')]();var fs_extra=require(_0x02fb('0x5'));var auth=require(_0x02fb('0x6'));var interaction=require(_0x02fb('0x7'));var config=require('../../config/environment');var controller=require(_0x02fb('0x8'));router[_0x02fb('0x9')]('/',auth[_0x02fb('0xa')](),controller[_0x02fb('0xb')]);router[_0x02fb('0x9')](_0x02fb('0xc'),auth['isAuthenticated'](),controller[_0x02fb('0xd')]);router[_0x02fb('0x9')](_0x02fb('0xe'),auth[_0x02fb('0xa')](),timeout('15s'),controller[_0x02fb('0xf')]);router[_0x02fb('0x10')]('/',auth[_0x02fb('0xa')](),controller[_0x02fb('0x11')]);router[_0x02fb('0x12')](_0x02fb('0xc'),auth['isAuthenticated'](),controller[_0x02fb('0x13')]);router[_0x02fb('0x14')](_0x02fb('0xc'),auth[_0x02fb('0xa')](),controller[_0x02fb('0x15')]);module[_0x02fb('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d620db2..6fddb33 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 _0x31dd=['STRING','sequelize','name'];(function(_0x4d27f9,_0x1190dc){var _0x15bd0c=function(_0x29f2a6){while(--_0x29f2a6){_0x4d27f9['push'](_0x4d27f9['shift']());}};_0x15bd0c(++_0x1190dc);}(_0x31dd,0x12a));var _0xd31d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x31dd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd31d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd31d('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd31d('0x2')]},'description':{'type':Sequelize[_0xd31d('0x2')]}}; \ No newline at end of file +var _0x81da=['name','sequelize','exports','STRING'];(function(_0x317ca8,_0x3bbe9c){var _0x39a33e=function(_0x174783){while(--_0x174783){_0x317ca8['push'](_0x317ca8['shift']());}};_0x39a33e(++_0x3bbe9c);}(_0x81da,0x81));var _0xa81d=function(_0x228cf1,_0x743a18){_0x228cf1=_0x228cf1-0x0;var _0x52596c=_0x81da[_0x228cf1];return _0x52596c;};'use strict';var Sequelize=require(_0xa81d('0x0'));module[_0xa81d('0x1')]={'name':{'type':Sequelize[_0xa81d('0x2')],'unique':_0xa81d('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa81d('0x2')]},'description':{'type':Sequelize[_0xa81d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2352013..a4e6a57 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 _0xa2a4=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','name','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','rawAttributes','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x5a7d6d,_0xd9f4c6){var _0x830b1f=function(_0x47510f){while(--_0x47510f){_0x5a7d6d['push'](_0x5a7d6d['shift']());}};_0x830b1f(++_0xd9f4c6);}(_0xa2a4,0x18d));var _0x4a2a=function(_0x26599d,_0x3b837b){_0x26599d=_0x26599d-0x0;var _0x351724=_0xa2a4[_0x26599d];return _0x351724;};'use strict';var emlformat=require(_0x4a2a('0x0'));var rimraf=require(_0x4a2a('0x1'));var zipdir=require(_0x4a2a('0x2'));var jsonpatch=require(_0x4a2a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4a2a('0x4'));var sox=require(_0x4a2a('0x5'));var csv=require(_0x4a2a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a2a('0x7'));var _=require(_0x4a2a('0x8'));var squel=require(_0x4a2a('0x9'));var crypto=require(_0x4a2a('0xa'));var jsforce=require(_0x4a2a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4a2a('0xc'));var Papa=require(_0x4a2a('0xd'));var Redis=require(_0x4a2a('0xe'));var authService=require(_0x4a2a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a2a('0x10'));var logger=require(_0x4a2a('0x11'))(_0x4a2a('0x12'));var utils=require(_0x4a2a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4a2a('0x14'));var db=require(_0x4a2a('0x15'))['db'];function respondWithStatusCode(_0x49ab07,_0x16efa0){_0x16efa0=_0x16efa0||0xcc;return function(_0x484c07){if(_0x484c07){return _0x49ab07[_0x4a2a('0x16')](_0x16efa0);}return _0x49ab07[_0x4a2a('0x17')](_0x16efa0)[_0x4a2a('0x18')]();};}function respondWithResult(_0xeb8b53,_0x649000){_0x649000=_0x649000||0xc8;return function(_0x31f381){if(_0x31f381){return _0xeb8b53[_0x4a2a('0x17')](_0x649000)[_0x4a2a('0x19')](_0x31f381);}};}function respondWithFilteredResult(_0x5c8907,_0x1775a3){return function(_0x2a401c){if(_0x2a401c){var _0x51091c=typeof _0x1775a3[_0x4a2a('0x1a')]===_0x4a2a('0x1b')&&typeof _0x1775a3[_0x4a2a('0x1c')]==='undefined';var _0x45de44=_0x2a401c[_0x4a2a('0x1d')];var _0x3d3121=_0x51091c?0x0:_0x1775a3[_0x4a2a('0x1a')];var _0x1e486c=_0x51091c?_0x2a401c[_0x4a2a('0x1d')]:_0x1775a3[_0x4a2a('0x1a')]+_0x1775a3['limit'];var _0x4ec904;if(_0x1e486c>=_0x45de44){_0x1e486c=_0x45de44;_0x4ec904=0xc8;}else{_0x4ec904=0xce;}_0x5c8907[_0x4a2a('0x17')](_0x4ec904);return _0x5c8907[_0x4a2a('0x1e')](_0x4a2a('0x1f'),_0x3d3121+'-'+_0x1e486c+'/'+_0x45de44)['json'](_0x2a401c);}return null;};}function patchUpdates(_0x3667a1){return function(_0x414d9d){try{jsonpatch[_0x4a2a('0x20')](_0x414d9d,_0x3667a1,!![]);}catch(_0x25bfb7){return BPromise[_0x4a2a('0x21')](_0x25bfb7);}return _0x414d9d[_0x4a2a('0x22')]();};}function saveUpdates(_0x9ae48a,_0x53c7b3){return function(_0x2e4e53){if(_0x2e4e53){return _0x2e4e53['update'](_0x9ae48a)[_0x4a2a('0x23')](function(_0x281896){return _0x281896;});}return null;};}function removeEntity(_0x20d287,_0x5209de){return function(_0x4f0062){if(_0x4f0062){return _0x4f0062[_0x4a2a('0x24')]()[_0x4a2a('0x23')](function(){var _0x3b1cf2=_0x4f0062[_0x4a2a('0x25')]({'plain':!![]});var _0x245615=_0x4a2a('0x26');return db[_0x4a2a('0x27')]['destroy']({'where':{'type':_0x245615,'resourceId':_0x3b1cf2['id']}})[_0x4a2a('0x23')](function(){return _0x4f0062;});})[_0x4a2a('0x23')](function(){_0x20d287[_0x4a2a('0x17')](0xcc)[_0x4a2a('0x18')]();});}};}function handleEntityNotFound(_0x1c5724,_0x1d7def){return function(_0x48e872){if(!_0x48e872){_0x1c5724['sendStatus'](0x194);}return _0x48e872;};}function handleError(_0x92478e,_0x3755c0){_0x3755c0=_0x3755c0||0x1f4;return function(_0x56a6af){logger['error'](_0x56a6af['stack']);if(_0x56a6af[_0x4a2a('0x28')]){delete _0x56a6af[_0x4a2a('0x28')];}_0x92478e[_0x4a2a('0x17')](_0x3755c0)['send'](_0x56a6af);};}exports['index']=function(_0xbf195d,_0x9f7f8b){var _0x16f894={},_0x18780a={},_0x437515={'count':0x0,'rows':[]};var _0x18d0ae=_[_0x4a2a('0x29')](db[_0x4a2a('0x2a')]['rawAttributes'],function(_0x5c8bc0){return{'name':_0x5c8bc0[_0x4a2a('0x2b')],'type':_0x5c8bc0[_0x4a2a('0x2c')][_0x4a2a('0x2d')]};});_0x18780a[_0x4a2a('0x2e')]=_['map'](_0x18d0ae,'name');_0x18780a[_0x4a2a('0x2f')]=_['keys'](_0xbf195d[_0x4a2a('0x2f')]);_0x18780a[_0x4a2a('0x30')]=_[_0x4a2a('0x31')](_0x18780a[_0x4a2a('0x2e')],_0x18780a[_0x4a2a('0x2f')]);_0x16f894['attributes']=_[_0x4a2a('0x31')](_0x18780a[_0x4a2a('0x2e')],qs['fields'](_0xbf195d['query'][_0x4a2a('0x32')]));_0x16f894[_0x4a2a('0x33')]=_0x16f894['attributes']['length']?_0x16f894[_0x4a2a('0x33')]:_0x18780a[_0x4a2a('0x2e')];if(!_0xbf195d[_0x4a2a('0x2f')][_0x4a2a('0x34')](_0x4a2a('0x35'))){_0x16f894[_0x4a2a('0x1c')]=qs[_0x4a2a('0x1c')](_0xbf195d['query']['limit']);_0x16f894[_0x4a2a('0x1a')]=qs[_0x4a2a('0x1a')](_0xbf195d[_0x4a2a('0x2f')]['offset']);}_0x16f894[_0x4a2a('0x36')]=qs[_0x4a2a('0x37')](_0xbf195d[_0x4a2a('0x2f')][_0x4a2a('0x37')]);_0x16f894['where']=qs[_0x4a2a('0x30')](_[_0x4a2a('0x38')](_0xbf195d[_0x4a2a('0x2f')],_0x18780a['filters']),_0x18d0ae);if(_0xbf195d[_0x4a2a('0x2f')][_0x4a2a('0x39')]){_0x16f894[_0x4a2a('0x3a')]=_[_0x4a2a('0x3b')](_0x16f894[_0x4a2a('0x3a')],{'$or':_[_0x4a2a('0x29')](_0x18d0ae,function(_0x23029){if(_0x23029['type']!==_0x4a2a('0x3c')){var _0x4ad296={};_0x4ad296[_0x23029['name']]={'$like':'%'+_0xbf195d[_0x4a2a('0x2f')][_0x4a2a('0x39')]+'%'};return _0x4ad296;}})});}_0x16f894=_[_0x4a2a('0x3b')]({},_0x16f894,_0xbf195d[_0x4a2a('0x3d')]);var _0x10d41f={'where':_0x16f894[_0x4a2a('0x3a')]};return db[_0x4a2a('0x2a')][_0x4a2a('0x1d')](_0x10d41f)['then'](function(_0x126da6){_0x437515[_0x4a2a('0x1d')]=_0x126da6;if(_0xbf195d[_0x4a2a('0x2f')][_0x4a2a('0x3e')]){_0x16f894[_0x4a2a('0x3f')]=[{'all':!![]}];}return db[_0x4a2a('0x2a')][_0x4a2a('0x40')](_0x16f894);})[_0x4a2a('0x23')](function(_0xa87def){_0x437515[_0x4a2a('0x41')]=_0xa87def;return _0x437515;})[_0x4a2a('0x23')](respondWithFilteredResult(_0x9f7f8b,_0x16f894))['catch'](handleError(_0x9f7f8b,null));};exports[_0x4a2a('0x42')]=function(_0x2ffc59,_0x50a3b2){var _0x12824f={'raw':!![],'where':{'id':_0x2ffc59['params']['id']}},_0x5a996a={};_0x5a996a[_0x4a2a('0x2e')]=_[_0x4a2a('0x43')](db[_0x4a2a('0x2a')][_0x4a2a('0x44')]);_0x5a996a[_0x4a2a('0x2f')]=_[_0x4a2a('0x43')](_0x2ffc59[_0x4a2a('0x2f')]);_0x5a996a[_0x4a2a('0x30')]=_[_0x4a2a('0x31')](_0x5a996a[_0x4a2a('0x2e')],_0x5a996a[_0x4a2a('0x2f')]);_0x12824f[_0x4a2a('0x33')]=_[_0x4a2a('0x31')](_0x5a996a[_0x4a2a('0x2e')],qs[_0x4a2a('0x32')](_0x2ffc59[_0x4a2a('0x2f')]['fields']));_0x12824f['attributes']=_0x12824f['attributes']['length']?_0x12824f[_0x4a2a('0x33')]:_0x5a996a[_0x4a2a('0x2e')];if(_0x2ffc59[_0x4a2a('0x2f')][_0x4a2a('0x3e')]){_0x12824f['include']=[{'all':!![]}];}_0x12824f=_[_0x4a2a('0x3b')]({},_0x12824f,_0x2ffc59['options']);return db['SquareOdbc']['find'](_0x12824f)[_0x4a2a('0x23')](handleEntityNotFound(_0x50a3b2,null))[_0x4a2a('0x23')](respondWithResult(_0x50a3b2,null))[_0x4a2a('0x45')](handleError(_0x50a3b2,null));};exports[_0x4a2a('0x46')]=function(_0x21dba8,_0x559552){return db['SquareOdbc']['create'](_0x21dba8['body'],{})[_0x4a2a('0x23')](function(_0x4da718){var _0xbe714=_0x21dba8['user'][_0x4a2a('0x25')]({'plain':!![]});if(!_0xbe714)throw new Error(_0x4a2a('0x47'));if(_0xbe714[_0x4a2a('0x48')]===_0x4a2a('0x49')){var _0x24a435=_0x4da718[_0x4a2a('0x25')]({'plain':!![]});var _0x5d6a34=_0x4a2a('0x26');return db['UserProfileSection'][_0x4a2a('0x4a')]({'where':{'name':_0x5d6a34,'userProfileId':_0xbe714['userProfileId']},'raw':!![]})[_0x4a2a('0x23')](function(_0x408b11){if(_0x408b11&&_0x408b11[_0x4a2a('0x4b')]===0x0){return db[_0x4a2a('0x27')][_0x4a2a('0x46')]({'name':_0x24a435['name'],'resourceId':_0x24a435['id'],'type':_0x408b11['name'],'sectionId':_0x408b11['id']},{})['then'](function(){return _0x4da718;});}else{return _0x4da718;}})[_0x4a2a('0x45')](function(_0x6d7e72){logger[_0x4a2a('0x4c')](_0x4a2a('0x4d'),_0x6d7e72);throw _0x6d7e72;});}return _0x4da718;})[_0x4a2a('0x23')](respondWithResult(_0x559552,0xc9))[_0x4a2a('0x45')](handleError(_0x559552,null));};exports[_0x4a2a('0x4e')]=function(_0x572e20,_0x41709c){if(_0x572e20[_0x4a2a('0x4f')]['id']){delete _0x572e20[_0x4a2a('0x4f')]['id'];}return db[_0x4a2a('0x2a')][_0x4a2a('0x4a')]({'where':{'id':_0x572e20['params']['id']}})[_0x4a2a('0x23')](handleEntityNotFound(_0x41709c,null))[_0x4a2a('0x23')](saveUpdates(_0x572e20[_0x4a2a('0x4f')],null))[_0x4a2a('0x23')](respondWithResult(_0x41709c,null))[_0x4a2a('0x45')](handleError(_0x41709c,null));};exports['destroy']=function(_0x1e6f4e,_0x59b9fc){return db[_0x4a2a('0x2a')][_0x4a2a('0x4a')]({'where':{'id':_0x1e6f4e[_0x4a2a('0x50')]['id']}})[_0x4a2a('0x23')](handleEntityNotFound(_0x59b9fc,null))['then'](removeEntity(_0x59b9fc,null))['catch'](handleError(_0x59b9fc,null));};exports['test']=function(_0x445ac8,_0x244632,_0xd85d6e){var _0x2816f3;return db['SquareOdbc'][_0x4a2a('0x4a')]({'where':{'id':_0x445ac8[_0x4a2a('0x50')]['id']},'attributes':['id','dsn']})[_0x4a2a('0x23')](handleEntityNotFound(_0x244632,null))[_0x4a2a('0x23')](function(_0x13fcdb){if(_0x13fcdb){var _0x2267b5=require('odbc')();_0x2267b5['openSync'](_0x13fcdb[_0x4a2a('0x51')]);_0x2267b5[_0x4a2a('0x52')]();return _0x13fcdb;}})[_0x4a2a('0x23')](respondWithResult(_0x244632,null))[_0x4a2a('0x45')](handleError(_0x244632,null));}; \ No newline at end of file +var _0xe74d=['show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','SquareOdbc','findAll','rows','catch'];(function(_0x14c6c2,_0x214c5c){var _0x3e53c2=function(_0x3c5e34){while(--_0x3c5e34){_0x14c6c2['push'](_0x14c6c2['shift']());}};_0x3e53c2(++_0x214c5c);}(_0xe74d,0xb5));var _0xde74=function(_0x52ca59,_0x279dda){_0x52ca59=_0x52ca59-0x0;var _0x1ab7e5=_0xe74d[_0x52ca59];return _0x1ab7e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde74('0x0'));var zipdir=require(_0xde74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde74('0x2'));var moment=require(_0xde74('0x3'));var BPromise=require(_0xde74('0x4'));var Mustache=require(_0xde74('0x5'));var util=require('util');var path=require('path');var sox=require(_0xde74('0x6'));var csv=require(_0xde74('0x7'));var ejs=require(_0xde74('0x8'));var fs=require('fs');var fs_extra=require(_0xde74('0x9'));var _=require('lodash');var squel=require(_0xde74('0xa'));var crypto=require(_0xde74('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xde74('0xc'));var toCsv=require(_0xde74('0x7'));var querystring=require(_0xde74('0xd'));var Papa=require(_0xde74('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde74('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde74('0x10'));var logger=require(_0xde74('0x11'))(_0xde74('0x12'));var utils=require(_0xde74('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xde74('0x14'))['db'];function respondWithStatusCode(_0x5e9229,_0x432200){_0x432200=_0x432200||0xcc;return function(_0x2eaa73){if(_0x2eaa73){return _0x5e9229[_0xde74('0x15')](_0x432200);}return _0x5e9229[_0xde74('0x16')](_0x432200)[_0xde74('0x17')]();};}function respondWithResult(_0x123784,_0xe01f2d){_0xe01f2d=_0xe01f2d||0xc8;return function(_0x43bbb5){if(_0x43bbb5){return _0x123784[_0xde74('0x16')](_0xe01f2d)[_0xde74('0x18')](_0x43bbb5);}};}function respondWithFilteredResult(_0x382bac,_0x2ac62c){return function(_0x94b59b){if(_0x94b59b){var _0x59dcb6=typeof _0x2ac62c[_0xde74('0x19')]==='undefined'&&typeof _0x2ac62c[_0xde74('0x1a')]===_0xde74('0x1b');var _0x53bd8f=_0x94b59b[_0xde74('0x1c')];var _0x1d61c0=_0x59dcb6?0x0:_0x2ac62c[_0xde74('0x19')];var _0x50fdca=_0x59dcb6?_0x94b59b[_0xde74('0x1c')]:_0x2ac62c[_0xde74('0x19')]+_0x2ac62c['limit'];var _0x4a187c;if(_0x50fdca>=_0x53bd8f){_0x50fdca=_0x53bd8f;_0x4a187c=0xc8;}else{_0x4a187c=0xce;}_0x382bac[_0xde74('0x16')](_0x4a187c);return _0x382bac[_0xde74('0x1d')](_0xde74('0x1e'),_0x1d61c0+'-'+_0x50fdca+'/'+_0x53bd8f)['json'](_0x94b59b);}return null;};}function patchUpdates(_0x1634b2){return function(_0x63a6aa){try{jsonpatch[_0xde74('0x1f')](_0x63a6aa,_0x1634b2,!![]);}catch(_0x33f964){return BPromise[_0xde74('0x20')](_0x33f964);}return _0x63a6aa[_0xde74('0x21')]();};}function saveUpdates(_0x39b46e,_0x15ddfb){return function(_0x5631a7){if(_0x5631a7){return _0x5631a7[_0xde74('0x22')](_0x39b46e)[_0xde74('0x23')](function(_0x4f3edc){return _0x4f3edc;});}return null;};}function removeEntity(_0x441b00,_0x440d59){return function(_0x3d046f){if(_0x3d046f){return _0x3d046f[_0xde74('0x24')]()['then'](function(){var _0x1a8c8c=_0x3d046f[_0xde74('0x25')]({'plain':!![]});var _0x190b68=_0xde74('0x26');return db[_0xde74('0x27')][_0xde74('0x24')]({'where':{'type':_0x190b68,'resourceId':_0x1a8c8c['id']}})[_0xde74('0x23')](function(){return _0x3d046f;});})[_0xde74('0x23')](function(){_0x441b00['status'](0xcc)[_0xde74('0x17')]();});}};}function handleEntityNotFound(_0x2d5275,_0x1d554b){return function(_0xadf5d8){if(!_0xadf5d8){_0x2d5275[_0xde74('0x15')](0x194);}return _0xadf5d8;};}function handleError(_0x53464c,_0x2d8e0){_0x2d8e0=_0x2d8e0||0x1f4;return function(_0x3e855d){logger[_0xde74('0x28')](_0x3e855d['stack']);if(_0x3e855d[_0xde74('0x29')]){delete _0x3e855d[_0xde74('0x29')];}_0x53464c['status'](_0x2d8e0)['send'](_0x3e855d);};}exports[_0xde74('0x2a')]=function(_0x5960ce,_0x7cfa6b){var _0x3fc153={},_0x423e05={},_0x4f3222={'count':0x0,'rows':[]};var _0x5a05fb=_['map'](db['SquareOdbc'][_0xde74('0x2b')],function(_0x22da88){return{'name':_0x22da88[_0xde74('0x2c')],'type':_0x22da88[_0xde74('0x2d')][_0xde74('0x2e')]};});_0x423e05['model']=_[_0xde74('0x2f')](_0x5a05fb,'name');_0x423e05[_0xde74('0x30')]=_[_0xde74('0x31')](_0x5960ce[_0xde74('0x30')]);_0x423e05[_0xde74('0x32')]=_[_0xde74('0x33')](_0x423e05['model'],_0x423e05[_0xde74('0x30')]);_0x3fc153[_0xde74('0x34')]=_[_0xde74('0x33')](_0x423e05['model'],qs['fields'](_0x5960ce[_0xde74('0x30')][_0xde74('0x35')]));_0x3fc153[_0xde74('0x34')]=_0x3fc153['attributes'][_0xde74('0x36')]?_0x3fc153[_0xde74('0x34')]:_0x423e05[_0xde74('0x37')];if(!_0x5960ce[_0xde74('0x30')][_0xde74('0x38')]('nolimit')){_0x3fc153[_0xde74('0x1a')]=qs['limit'](_0x5960ce['query'][_0xde74('0x1a')]);_0x3fc153['offset']=qs['offset'](_0x5960ce['query'][_0xde74('0x19')]);}_0x3fc153[_0xde74('0x39')]=qs['sort'](_0x5960ce[_0xde74('0x30')]['sort']);_0x3fc153[_0xde74('0x3a')]=qs[_0xde74('0x32')](_['pick'](_0x5960ce[_0xde74('0x30')],_0x423e05['filters']),_0x5a05fb);if(_0x5960ce[_0xde74('0x30')][_0xde74('0x3b')]){_0x3fc153['where']=_[_0xde74('0x3c')](_0x3fc153['where'],{'$or':_[_0xde74('0x2f')](_0x5a05fb,function(_0x5fb855){if(_0x5fb855[_0xde74('0x2d')]!==_0xde74('0x3d')){var _0x3ccd07={};_0x3ccd07[_0x5fb855[_0xde74('0x29')]]={'$like':'%'+_0x5960ce[_0xde74('0x30')][_0xde74('0x3b')]+'%'};return _0x3ccd07;}})});}_0x3fc153=_['merge']({},_0x3fc153,_0x5960ce[_0xde74('0x3e')]);var _0x17d86b={'where':_0x3fc153[_0xde74('0x3a')]};return db['SquareOdbc'][_0xde74('0x1c')](_0x17d86b)[_0xde74('0x23')](function(_0x2cef21){_0x4f3222[_0xde74('0x1c')]=_0x2cef21;if(_0x5960ce[_0xde74('0x30')][_0xde74('0x3f')]){_0x3fc153['include']=[{'all':!![]}];}return db[_0xde74('0x40')][_0xde74('0x41')](_0x3fc153);})[_0xde74('0x23')](function(_0x839823){_0x4f3222[_0xde74('0x42')]=_0x839823;return _0x4f3222;})['then'](respondWithFilteredResult(_0x7cfa6b,_0x3fc153))[_0xde74('0x43')](handleError(_0x7cfa6b,null));};exports[_0xde74('0x44')]=function(_0x337394,_0x4fa54e){var _0x9749a7={'raw':!![],'where':{'id':_0x337394[_0xde74('0x45')]['id']}},_0x2c42e6={};_0x2c42e6[_0xde74('0x37')]=_[_0xde74('0x31')](db[_0xde74('0x40')][_0xde74('0x2b')]);_0x2c42e6[_0xde74('0x30')]=_[_0xde74('0x31')](_0x337394[_0xde74('0x30')]);_0x2c42e6[_0xde74('0x32')]=_[_0xde74('0x33')](_0x2c42e6[_0xde74('0x37')],_0x2c42e6[_0xde74('0x30')]);_0x9749a7[_0xde74('0x34')]=_['intersection'](_0x2c42e6['model'],qs[_0xde74('0x35')](_0x337394[_0xde74('0x30')]['fields']));_0x9749a7[_0xde74('0x34')]=_0x9749a7[_0xde74('0x34')][_0xde74('0x36')]?_0x9749a7[_0xde74('0x34')]:_0x2c42e6['model'];if(_0x337394[_0xde74('0x30')][_0xde74('0x3f')]){_0x9749a7['include']=[{'all':!![]}];}_0x9749a7=_[_0xde74('0x3c')]({},_0x9749a7,_0x337394[_0xde74('0x3e')]);return db[_0xde74('0x40')][_0xde74('0x46')](_0x9749a7)[_0xde74('0x23')](handleEntityNotFound(_0x4fa54e,null))[_0xde74('0x23')](respondWithResult(_0x4fa54e,null))[_0xde74('0x43')](handleError(_0x4fa54e,null));};exports[_0xde74('0x47')]=function(_0x551254,_0x6660d5){return db[_0xde74('0x40')][_0xde74('0x47')](_0x551254['body'],{})[_0xde74('0x23')](function(_0x3fedd6){var _0x37fb29=_0x551254['user'][_0xde74('0x25')]({'plain':!![]});if(!_0x37fb29)throw new Error(_0xde74('0x48'));if(_0x37fb29[_0xde74('0x49')]==='user'){var _0x31a1d3=_0x3fedd6['get']({'plain':!![]});var _0x3f26a4=_0xde74('0x26');return db[_0xde74('0x4a')][_0xde74('0x46')]({'where':{'name':_0x3f26a4,'userProfileId':_0x37fb29['userProfileId']},'raw':!![]})['then'](function(_0x40fb62){if(_0x40fb62&&_0x40fb62[_0xde74('0x4b')]===0x0){return db[_0xde74('0x27')][_0xde74('0x47')]({'name':_0x31a1d3['name'],'resourceId':_0x31a1d3['id'],'type':_0x40fb62[_0xde74('0x29')],'sectionId':_0x40fb62['id']},{})['then'](function(){return _0x3fedd6;});}else{return _0x3fedd6;}})[_0xde74('0x43')](function(_0x367d1b){logger['error'](_0xde74('0x4c'),_0x367d1b);throw _0x367d1b;});}return _0x3fedd6;})['then'](respondWithResult(_0x6660d5,0xc9))[_0xde74('0x43')](handleError(_0x6660d5,null));};exports[_0xde74('0x22')]=function(_0xf56b38,_0x1415e5){if(_0xf56b38['body']['id']){delete _0xf56b38[_0xde74('0x4d')]['id'];}return db[_0xde74('0x40')][_0xde74('0x46')]({'where':{'id':_0xf56b38[_0xde74('0x45')]['id']}})[_0xde74('0x23')](handleEntityNotFound(_0x1415e5,null))['then'](saveUpdates(_0xf56b38[_0xde74('0x4d')],null))[_0xde74('0x23')](respondWithResult(_0x1415e5,null))[_0xde74('0x43')](handleError(_0x1415e5,null));};exports[_0xde74('0x24')]=function(_0x5bae3a,_0x2ea6b3){return db[_0xde74('0x40')][_0xde74('0x46')]({'where':{'id':_0x5bae3a[_0xde74('0x45')]['id']}})[_0xde74('0x23')](handleEntityNotFound(_0x2ea6b3,null))[_0xde74('0x23')](removeEntity(_0x2ea6b3,null))['catch'](handleError(_0x2ea6b3,null));};exports[_0xde74('0x4e')]=function(_0x54cc6b,_0x43d9f1,_0x1c5ed5){var _0x387843;return db[_0xde74('0x40')][_0xde74('0x46')]({'where':{'id':_0x54cc6b[_0xde74('0x45')]['id']},'attributes':['id',_0xde74('0x4f')]})[_0xde74('0x23')](handleEntityNotFound(_0x43d9f1,null))['then'](function(_0x151fb2){if(_0x151fb2){var _0x15f6a7=require(_0xde74('0x50'))();_0x15f6a7[_0xde74('0x51')](_0x151fb2[_0xde74('0x4f')]);_0x15f6a7[_0xde74('0x52')]();return _0x151fb2;}})[_0xde74('0x23')](respondWithResult(_0x43d9f1,null))[_0xde74('0x43')](handleError(_0x43d9f1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e628dca..bf9f3ca 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 _0x9d65=['./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4174af,_0x5a3f60){var _0x3c0c25=function(_0x420125){while(--_0x420125){_0x4174af['push'](_0x4174af['shift']());}};_0x3c0c25(++_0x5a3f60);}(_0x9d65,0x143));var _0x59d6=function(_0x527176,_0x3b423f){_0x527176=_0x527176-0x0;var _0x2be726=_0x9d65[_0x527176];return _0x2be726;};'use strict';var _=require(_0x59d6('0x0'));var util=require(_0x59d6('0x1'));var logger=require('../../config/logger')(_0x59d6('0x2'));var moment=require(_0x59d6('0x3'));var BPromise=require(_0x59d6('0x4'));var rp=require(_0x59d6('0x5'));var fs=require('fs');var path=require(_0x59d6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x59d6('0x7'));module['exports']=function(_0x3c9b18,_0x2a48f0){return _0x3c9b18[_0x59d6('0x8')](_0x59d6('0x9'),attributes,{'tableName':_0x59d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69b1=['bluebird','request-promise','path','../../config/environment','exports','lodash','util','../../config/logger','api','moment'];(function(_0x5bd50e,_0x4dee56){var _0x42f9e5=function(_0x354f91){while(--_0x354f91){_0x5bd50e['push'](_0x5bd50e['shift']());}};_0x42f9e5(++_0x4dee56);}(_0x69b1,0x11d));var _0x169b=function(_0x446d07,_0x46c665){_0x446d07=_0x446d07-0x0;var _0x279a6d=_0x69b1[_0x446d07];return _0x279a6d;};'use strict';var _=require(_0x169b('0x0'));var util=require(_0x169b('0x1'));var logger=require(_0x169b('0x2'))(_0x169b('0x3'));var moment=require(_0x169b('0x4'));var BPromise=require(_0x169b('0x5'));var rp=require(_0x169b('0x6'));var fs=require('fs');var path=require(_0x169b('0x7'));var rimraf=require('rimraf');var config=require(_0x169b('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x169b('0x9')]=function(_0x40f887,_0x283ef4){return _0x40f887['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 667b7a8..821c291 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 _0x1de3=['options','where','attributes','include','model','map','then','ShowSquareOdbc','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','find'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1de3,0x65));var _0x31de=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x1de3[_0x3a7634];return _0x23bbe9;};'use strict';var _=require(_0x31de('0x0'));var util=require(_0x31de('0x1'));var moment=require('moment');var BPromise=require(_0x31de('0x2'));var rs=require(_0x31de('0x3'));var fs=require('fs');var Redis=require(_0x31de('0x4'));var db=require(_0x31de('0x5'))['db'];var utils=require(_0x31de('0x6'));var logger=require('../../config/logger')(_0x31de('0x7'));var config=require(_0x31de('0x8'));var jayson=require(_0x31de('0x9'));var client=jayson[_0x31de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b810d,_0x5a62fa,_0xa38882){return new BPromise(function(_0xdfc647,_0x333ac0){return client[_0x31de('0xb')](_0x5b810d,_0xa38882)['then'](function(_0x58bb8a){logger[_0x31de('0xc')](_0x31de('0xd'),_0x5a62fa,_0x31de('0xe'));logger[_0x31de('0xf')](_0x31de('0x10'),_0x5a62fa,_0x31de('0xe'),JSON[_0x31de('0x11')](_0x58bb8a));if(_0x58bb8a[_0x31de('0x12')]){if(_0x58bb8a['error']['code']===0x1f4){logger[_0x31de('0x12')](_0x31de('0xd'),_0x5a62fa,_0x58bb8a[_0x31de('0x12')][_0x31de('0x13')]);return _0x333ac0(_0x58bb8a[_0x31de('0x12')]['message']);}logger['error'](_0x31de('0xd'),_0x5a62fa,_0x58bb8a['error'][_0x31de('0x13')]);return _0xdfc647(_0x58bb8a[_0x31de('0x12')][_0x31de('0x13')]);}else{logger[_0x31de('0xc')](_0x31de('0xd'),_0x5a62fa,_0x31de('0xe'));_0xdfc647(_0x58bb8a[_0x31de('0x14')][_0x31de('0x13')]);}})[_0x31de('0x15')](function(_0x250305){logger['error'](_0x31de('0xd'),_0x5a62fa,_0x250305);_0x333ac0(_0x250305);});});}exports['ShowSquareOdbc']=function(_0x5b9a01){var _0x1f1a07=this;return new Promise(function(_0x328980,_0x318878){return db['SquareOdbc'][_0x31de('0x16')]({'raw':_0x5b9a01[_0x31de('0x17')]?_0x5b9a01[_0x31de('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5b9a01[_0x31de('0x17')]?_0x5b9a01[_0x31de('0x17')][_0x31de('0x18')]||null:null,'attributes':_0x5b9a01['options']?_0x5b9a01['options'][_0x31de('0x19')]||null:null,'include':_0x5b9a01[_0x31de('0x17')]?_0x5b9a01[_0x31de('0x17')][_0x31de('0x1a')]?_['map'](_0x5b9a01[_0x31de('0x17')]['include'],function(_0x1861f3){return{'model':db[_0x1861f3[_0x31de('0x1b')]],'as':_0x1861f3['as'],'attributes':_0x1861f3[_0x31de('0x19')],'include':_0x1861f3[_0x31de('0x1a')]?_[_0x31de('0x1c')](_0x1861f3[_0x31de('0x1a')],function(_0x595380){return{'model':db[_0x595380[_0x31de('0x1b')]],'as':_0x595380['as'],'attributes':_0x595380[_0x31de('0x19')],'include':_0x595380[_0x31de('0x1a')]?_[_0x31de('0x1c')](_0x595380['include'],function(_0x43fe4b){return{'model':db[_0x43fe4b[_0x31de('0x1b')]],'as':_0x43fe4b['as'],'attributes':_0x43fe4b['attributes']};}):[]};}):[]};}):[]:[]})[_0x31de('0x1d')](function(_0x1113e1){logger[_0x31de('0xc')](_0x31de('0x1e'),_0x5b9a01);logger[_0x31de('0xf')](_0x31de('0x1e'),_0x5b9a01,JSON[_0x31de('0x11')](_0x1113e1));_0x328980(_0x1113e1);})[_0x31de('0x15')](function(_0x3fd633){logger['error'](_0x31de('0x1e'),_0x3fd633['message'],_0x5b9a01);_0x318878(_0x1f1a07[_0x31de('0x12')](0x1f4,_0x3fd633[_0x31de('0x13')]));});});}; \ No newline at end of file +var _0xf365=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSquareOdbc','options','raw','where','attributes','include','map','model','then','util','moment','bluebird','randomstring','ioredis'];(function(_0xe550b3,_0x5aa5b3){var _0x5c980b=function(_0x96d0d8){while(--_0x96d0d8){_0xe550b3['push'](_0xe550b3['shift']());}};_0x5c980b(++_0x5aa5b3);}(_0xf365,0x181));var _0x5f36=function(_0x486df7,_0x5f803a){_0x486df7=_0x486df7-0x0;var _0x3c0d43=_0xf365[_0x486df7];return _0x3c0d43;};'use strict';var _=require('lodash');var util=require(_0x5f36('0x0'));var moment=require(_0x5f36('0x1'));var BPromise=require(_0x5f36('0x2'));var rs=require(_0x5f36('0x3'));var fs=require('fs');var Redis=require(_0x5f36('0x4'));var db=require(_0x5f36('0x5'))['db'];var utils=require(_0x5f36('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f36('0x7'));var jayson=require(_0x5f36('0x8'));var client=jayson[_0x5f36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x464493,_0xdd5ab5,_0x1c164f){return new BPromise(function(_0x34008b,_0x54840b){return client[_0x5f36('0xa')](_0x464493,_0x1c164f)['then'](function(_0x1d3082){logger[_0x5f36('0xb')](_0x5f36('0xc'),_0xdd5ab5,_0x5f36('0xd'));logger[_0x5f36('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0xdd5ab5,_0x5f36('0xd'),JSON[_0x5f36('0xf')](_0x1d3082));if(_0x1d3082[_0x5f36('0x10')]){if(_0x1d3082['error'][_0x5f36('0x11')]===0x1f4){logger['error'](_0x5f36('0xc'),_0xdd5ab5,_0x1d3082[_0x5f36('0x10')][_0x5f36('0x12')]);return _0x54840b(_0x1d3082[_0x5f36('0x10')]['message']);}logger[_0x5f36('0x10')](_0x5f36('0xc'),_0xdd5ab5,_0x1d3082[_0x5f36('0x10')][_0x5f36('0x12')]);return _0x34008b(_0x1d3082[_0x5f36('0x10')][_0x5f36('0x12')]);}else{logger[_0x5f36('0xb')](_0x5f36('0xc'),_0xdd5ab5,_0x5f36('0xd'));_0x34008b(_0x1d3082[_0x5f36('0x13')]['message']);}})[_0x5f36('0x14')](function(_0x4c76be){logger['error'](_0x5f36('0xc'),_0xdd5ab5,_0x4c76be);_0x54840b(_0x4c76be);});});}exports[_0x5f36('0x15')]=function(_0x349f81){var _0x39922d=this;return new Promise(function(_0x3d3377,_0x49a194){return db['SquareOdbc']['find']({'raw':_0x349f81['options']?_0x349f81[_0x5f36('0x16')][_0x5f36('0x17')]===undefined?!![]:![]:!![],'where':_0x349f81[_0x5f36('0x16')]?_0x349f81[_0x5f36('0x16')][_0x5f36('0x18')]||null:null,'attributes':_0x349f81[_0x5f36('0x16')]?_0x349f81['options'][_0x5f36('0x19')]||null:null,'include':_0x349f81[_0x5f36('0x16')]?_0x349f81['options'][_0x5f36('0x1a')]?_[_0x5f36('0x1b')](_0x349f81[_0x5f36('0x16')][_0x5f36('0x1a')],function(_0x332f14){return{'model':db[_0x332f14[_0x5f36('0x1c')]],'as':_0x332f14['as'],'attributes':_0x332f14[_0x5f36('0x19')],'include':_0x332f14[_0x5f36('0x1a')]?_[_0x5f36('0x1b')](_0x332f14[_0x5f36('0x1a')],function(_0x13d213){return{'model':db[_0x13d213[_0x5f36('0x1c')]],'as':_0x13d213['as'],'attributes':_0x13d213['attributes'],'include':_0x13d213[_0x5f36('0x1a')]?_['map'](_0x13d213[_0x5f36('0x1a')],function(_0x14d811){return{'model':db[_0x14d811[_0x5f36('0x1c')]],'as':_0x14d811['as'],'attributes':_0x14d811['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f36('0x1d')](function(_0x2f69b2){logger[_0x5f36('0xb')](_0x5f36('0x15'),_0x349f81);logger[_0x5f36('0xe')](_0x5f36('0x15'),_0x349f81,JSON['stringify'](_0x2f69b2));_0x3d3377(_0x2f69b2);})['catch'](function(_0x3a9134){logger[_0x5f36('0x10')](_0x5f36('0x15'),_0x3a9134[_0x5f36('0x12')],_0x349f81);_0x49a194(_0x39922d[_0x5f36('0x10')](0x1f4,_0x3a9134[_0x5f36('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 108a4b3..bb85fac 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 _0x6d4b=['isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x5ebd7b,_0x1ce5ca){_0x5ebd7b=_0x5ebd7b-0x0;var _0xad4a5c=_0x6d4b[_0x5ebd7b];return _0xad4a5c;};'use strict';var multer=require(_0xb6d4('0x0'));var util=require(_0xb6d4('0x1'));var path=require(_0xb6d4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6d4('0x3'));var router=express[_0xb6d4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb6d4('0x5'));var config=require(_0xb6d4('0x6'));var controller=require(_0xb6d4('0x7'));router[_0xb6d4('0x8')]('/',auth[_0xb6d4('0x9')](),controller[_0xb6d4('0xa')]);router[_0xb6d4('0x8')](_0xb6d4('0xb'),auth['isAuthenticated'](),controller[_0xb6d4('0xc')]);router[_0xb6d4('0x8')](_0xb6d4('0xd'),auth[_0xb6d4('0x9')](),controller[_0xb6d4('0xe')]);router[_0xb6d4('0xf')]('/',auth[_0xb6d4('0x9')](),controller[_0xb6d4('0x10')]);router[_0xb6d4('0xf')](_0xb6d4('0xd'),auth['isAuthenticated'](),controller['addUsers']);router['put']('/:id',auth[_0xb6d4('0x9')](),controller['update']);router[_0xb6d4('0x11')](_0xb6d4('0xb'),auth[_0xb6d4('0x9')](),controller[_0xb6d4('0x12')]);router['delete'](_0xb6d4('0xd'),auth[_0xb6d4('0x9')](),controller['removeUsers']);module[_0xb6d4('0x13')]=router; \ No newline at end of file +var _0x13ae=['post','create','/:id/users','addUsers','put','update','delete','destroy','removeUsers','exports','express','Router','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers'];(function(_0x5b98a7,_0x1f718a){var _0x41f02f=function(_0x472ae7){while(--_0x472ae7){_0x5b98a7['push'](_0x5b98a7['shift']());}};_0x41f02f(++_0x1f718a);}(_0x13ae,0xe6));var _0xe13a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x13ae[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe13a('0x0'));var router=express[_0xe13a('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe13a('0x2'));var config=require('../../config/environment');var controller=require(_0xe13a('0x3'));router[_0xe13a('0x4')]('/',auth[_0xe13a('0x5')](),controller[_0xe13a('0x6')]);router[_0xe13a('0x4')](_0xe13a('0x7'),auth[_0xe13a('0x5')](),controller[_0xe13a('0x8')]);router['get']('/:id/users',auth[_0xe13a('0x5')](),controller[_0xe13a('0x9')]);router[_0xe13a('0xa')]('/',auth[_0xe13a('0x5')](),controller[_0xe13a('0xb')]);router['post'](_0xe13a('0xc'),auth[_0xe13a('0x5')](),controller[_0xe13a('0xd')]);router[_0xe13a('0xe')](_0xe13a('0x7'),auth[_0xe13a('0x5')](),controller[_0xe13a('0xf')]);router[_0xe13a('0x10')]('/:id',auth[_0xe13a('0x5')](),controller[_0xe13a('0x11')]);router[_0xe13a('0x10')](_0xe13a('0xc'),auth[_0xe13a('0x5')](),controller[_0xe13a('0x12')]);module[_0xe13a('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9a0312a..df037d6 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 _0xa77e=['exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x1e93d4,_0xda7863){var _0x3b38b4=function(_0x303bcf){while(--_0x303bcf){_0x1e93d4['push'](_0x1e93d4['shift']());}};_0x3b38b4(++_0xda7863);}(_0xa77e,0x197));var _0xea77=function(_0x397495,_0x56a065){_0x397495=_0x397495-0x0;var _0x4468f9=_0xa77e[_0x397495];return _0x4468f9;};'use strict';var Sequelize=require(_0xea77('0x0'));module[_0xea77('0x1')]={'name':{'type':Sequelize[_0xea77('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xea77('0x2')]},'notes':{'type':Sequelize[_0xea77('0x3')]},'preproduction':{'type':Sequelize[_0xea77('0x4')](_0xea77('0x5')),'get':function(){if(this[_0xea77('0x6')](_0xea77('0x7'))){return this[_0xea77('0x6')]('preproduction')[_0xea77('0x8')](_0xea77('0x9'));}}},'production':{'type':Sequelize[_0xea77('0x4')]('long'),'get':function(){if(this[_0xea77('0x6')]('production')){return this[_0xea77('0x6')](_0xea77('0xa'))['toString'](_0xea77('0x9'));}}},'savedAt':{'type':Sequelize[_0xea77('0xb')]},'publishedAt':{'type':Sequelize[_0xea77('0xb')]}}; \ No newline at end of file +var _0x4fdb=['long','preproduction','getDataValue','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x4fdb,0xa3));var _0xb4fd=function(_0x9dc902,_0x44259e){_0x9dc902=_0x9dc902-0x0;var _0x41f4d5=_0x4fdb[_0x9dc902];return _0x41f4d5;};'use strict';var Sequelize=require(_0xb4fd('0x0'));module[_0xb4fd('0x1')]={'name':{'type':Sequelize[_0xb4fd('0x2')],'unique':_0xb4fd('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xb4fd('0x4')]},'preproduction':{'type':Sequelize[_0xb4fd('0x5')](_0xb4fd('0x6')),'get':function(){if(this['getDataValue'](_0xb4fd('0x7'))){return this[_0xb4fd('0x8')](_0xb4fd('0x7'))[_0xb4fd('0x9')](_0xb4fd('0xa'));}}},'production':{'type':Sequelize[_0xb4fd('0x5')](_0xb4fd('0x6')),'get':function(){if(this['getDataValue']('production')){return this[_0xb4fd('0x8')](_0xb4fd('0xb'))[_0xb4fd('0x9')](_0xb4fd('0xa'));}}},'savedAt':{'type':Sequelize[_0xb4fd('0xc')]},'publishedAt':{'type':Sequelize[_0xb4fd('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 674a13a..1390f0f 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 _0xc1c6=['../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','SquareProjects','then','publish','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','SquareProject','includeAll','include','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','lodash','ioredis'];(function(_0x282a26,_0x334186){var _0xf4e926=function(_0x553b4e){while(--_0x553b4e){_0x282a26['push'](_0x282a26['shift']());}};_0xf4e926(++_0x334186);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x588681,_0x4eb5c8){_0x588681=_0x588681-0x0;var _0x3a914c=_0xc1c6[_0x588681];return _0x3a914c;};'use strict';var _=require(_0x6c1c('0x0'));var Redis=require(_0x6c1c('0x1'));var qs=require(_0x6c1c('0x2'));var logger=require('../../config/logger')(_0x6c1c('0x3'));var config=require('../../config/environment');var db=require(_0x6c1c('0x4'))['db'];config[_0x6c1c('0x5')]=_[_0x6c1c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c1c('0x7'))(new Redis(config['redis']));require(_0x6c1c('0x8'))['register'](socket);function respondWithStatusCode(_0xe510ca,_0x2eb1ba){_0x2eb1ba=_0x2eb1ba||0xcc;return function(_0x38369d){if(_0x38369d){return _0xe510ca[_0x6c1c('0x9')](_0x2eb1ba);}return _0xe510ca['status'](_0x2eb1ba)[_0x6c1c('0xa')]();};}function respondWithResult(_0x3ca985,_0x524d21){_0x524d21=_0x524d21||0xc8;return function(_0x147c7b){if(_0x147c7b){return _0x3ca985[_0x6c1c('0xb')](_0x524d21)[_0x6c1c('0xc')](_0x147c7b);}};}function respondWithFilteredResult(_0x1137e8,_0x49fb01){return function(_0x3a25a2){if(_0x3a25a2){var _0x2a4fd4=typeof _0x49fb01[_0x6c1c('0xd')]==='undefined'&&typeof _0x49fb01[_0x6c1c('0xe')]===_0x6c1c('0xf');var _0x2067bd=_0x3a25a2['count'];var _0x2e82e9=_0x2a4fd4?0x0:_0x49fb01['offset'];var _0x357370=_0x2a4fd4?_0x3a25a2[_0x6c1c('0x10')]:_0x49fb01[_0x6c1c('0xd')]+_0x49fb01[_0x6c1c('0xe')];var _0x350e6f;if(_0x357370>=_0x2067bd){_0x357370=_0x2067bd;_0x350e6f=0xc8;}else{_0x350e6f=0xce;}_0x1137e8[_0x6c1c('0xb')](_0x350e6f);return _0x1137e8[_0x6c1c('0x11')](_0x6c1c('0x12'),_0x2e82e9+'-'+_0x357370+'/'+_0x2067bd)[_0x6c1c('0xc')](_0x3a25a2);}return null;};}function saveUpdates(_0x5f3758){return function(_0x3df1b7){if(_0x3df1b7){return _0x3df1b7[_0x6c1c('0x13')](_0x5f3758)['then'](function(_0x3a2d32){return _0x3a2d32;});}return null;};}function removeEntity(_0x237cac){return function(_0x494ffc){if(_0x494ffc){return _0x494ffc[_0x6c1c('0x14')]()['then'](function(){var _0x338dc2=_0x494ffc[_0x6c1c('0x15')]({'plain':!![]});var _0x5a3bb7=_0x6c1c('0x16');return db['UserProfileResource'][_0x6c1c('0x14')]({'where':{'type':_0x5a3bb7,'resourceId':_0x338dc2['id']}})[_0x6c1c('0x17')](function(){return _0x494ffc;});})[_0x6c1c('0x17')](function(){var _0x211f49=new Redis(config[_0x6c1c('0x5')]);_0x211f49[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON[_0x6c1c('0x1a')]({'id':_0x494ffc['id'],'deleted':!![]}));})[_0x6c1c('0x17')](function(){_0x237cac[_0x6c1c('0xb')](0xcc)[_0x6c1c('0xa')]();});}};}function handleEntityNotFound(_0x450b1f){return function(_0x2382c0){if(!_0x2382c0){_0x450b1f[_0x6c1c('0x9')](0x194);}return _0x2382c0;};}function handleError(_0x31fed2,_0x19c269){_0x19c269=_0x19c269||0x1f4;return function(_0x2319d3){logger[_0x6c1c('0x1b')](_0x2319d3[_0x6c1c('0x1c')]);if(_0x2319d3[_0x6c1c('0x1d')]){delete _0x2319d3[_0x6c1c('0x1d')];}_0x31fed2[_0x6c1c('0xb')](_0x19c269)[_0x6c1c('0x1e')](_0x2319d3);};}exports[_0x6c1c('0x1f')]=function(_0x18452d,_0x80bc05){var _0x3b7cc1={},_0x1b9d7d={},_0x2feaf4={'count':0x0,'rows':[]};var _0x5f4568=_[_0x6c1c('0x20')](db['SquareProject'][_0x6c1c('0x21')],function(_0x4c23f8){return{'name':_0x4c23f8[_0x6c1c('0x22')],'type':_0x4c23f8['type'][_0x6c1c('0x23')]};});_0x1b9d7d[_0x6c1c('0x24')]=_['map'](_0x5f4568,_0x6c1c('0x1d'));_0x1b9d7d[_0x6c1c('0x25')]=_['keys'](_0x18452d[_0x6c1c('0x25')]);_0x1b9d7d[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],_0x1b9d7d['query']);_0x3b7cc1['attributes']=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x28')]));_0x3b7cc1[_0x6c1c('0x29')]=_0x3b7cc1['attributes'][_0x6c1c('0x2a')]?_0x3b7cc1[_0x6c1c('0x29')]:_0x1b9d7d['model'];if(!_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2b')](_0x6c1c('0x2c'))){_0x3b7cc1[_0x6c1c('0xe')]=qs['limit'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0xe')]);_0x3b7cc1[_0x6c1c('0xd')]=qs['offset'](_0x18452d[_0x6c1c('0x25')]['offset']);}_0x3b7cc1[_0x6c1c('0x2d')]=qs['sort'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2e')]);_0x3b7cc1[_0x6c1c('0x2f')]=qs['filters'](_['pick'](_0x18452d[_0x6c1c('0x25')],_0x1b9d7d[_0x6c1c('0x26')]),_0x5f4568);if(_0x18452d[_0x6c1c('0x25')]['filter']){_0x3b7cc1[_0x6c1c('0x2f')]=_['merge'](_0x3b7cc1['where'],{'$or':_[_0x6c1c('0x20')](_0x5f4568,function(_0xbafcb3){if(_0xbafcb3[_0x6c1c('0x30')]!==_0x6c1c('0x31')){var _0x4bed10={};_0x4bed10[_0xbafcb3[_0x6c1c('0x1d')]]={'$like':'%'+_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4bed10;}})});}_0x3b7cc1=_[_0x6c1c('0x33')]({},_0x3b7cc1,_0x18452d[_0x6c1c('0x34')]);var _0x398e95={'where':_0x3b7cc1[_0x6c1c('0x2f')]};return db[_0x6c1c('0x35')][_0x6c1c('0x10')](_0x398e95)[_0x6c1c('0x17')](function(_0x47d75e){_0x2feaf4[_0x6c1c('0x10')]=_0x47d75e;if(_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x36')]){_0x3b7cc1[_0x6c1c('0x37')]=[{'all':!![]}];}return db[_0x6c1c('0x35')]['findAll'](_0x3b7cc1);})['then'](function(_0x549db1){_0x2feaf4[_0x6c1c('0x38')]=_0x549db1;return _0x2feaf4;})['then'](respondWithFilteredResult(_0x80bc05,_0x3b7cc1))['catch'](handleError(_0x80bc05,null));};exports[_0x6c1c('0x39')]=function(_0x37244e,_0x5f3f3e){var _0x2b2ae5={'raw':![],'where':{'id':_0x37244e[_0x6c1c('0x3a')]['id']}},_0x40645f={};_0x40645f['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x35')]['rawAttributes']);_0x40645f[_0x6c1c('0x25')]=_['keys'](_0x37244e[_0x6c1c('0x25')]);_0x40645f[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],_0x40645f[_0x6c1c('0x25')]);_0x2b2ae5['attributes']=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x37244e['query'][_0x6c1c('0x28')]));_0x2b2ae5[_0x6c1c('0x29')]=_0x2b2ae5[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x2b2ae5[_0x6c1c('0x29')]:_0x40645f['model'];if(_0x37244e[_0x6c1c('0x25')]['includeAll']){_0x2b2ae5['include']=[{'all':!![]}];}_0x2b2ae5=_['merge']({},_0x2b2ae5,_0x37244e[_0x6c1c('0x34')]);return db[_0x6c1c('0x35')][_0x6c1c('0x3c')](_0x2b2ae5)[_0x6c1c('0x17')](handleEntityNotFound(_0x5f3f3e,null))[_0x6c1c('0x17')](respondWithResult(_0x5f3f3e,null))[_0x6c1c('0x3d')](handleError(_0x5f3f3e,null));};exports[_0x6c1c('0x3e')]=function(_0x167f3b,_0x5ed2d7){return db[_0x6c1c('0x35')][_0x6c1c('0x3e')](_0x167f3b['body'],{})[_0x6c1c('0x17')](function(_0x5518f6){var _0x39e741=_0x167f3b[_0x6c1c('0x3f')][_0x6c1c('0x15')]({'plain':!![]});if(!_0x39e741)throw new Error(_0x6c1c('0x40'));if(_0x39e741[_0x6c1c('0x41')]==='user'){var _0x1fe6e8=_0x5518f6['get']({'plain':!![]});var _0x2a59bc=_0x6c1c('0x16');return db[_0x6c1c('0x42')][_0x6c1c('0x3c')]({'where':{'name':_0x2a59bc,'userProfileId':_0x39e741[_0x6c1c('0x43')]},'raw':!![]})[_0x6c1c('0x17')](function(_0x52c14d){if(_0x52c14d&&_0x52c14d[_0x6c1c('0x44')]===0x0){return db[_0x6c1c('0x45')]['create']({'name':_0x1fe6e8[_0x6c1c('0x1d')],'resourceId':_0x1fe6e8['id'],'type':_0x52c14d[_0x6c1c('0x1d')],'sectionId':_0x52c14d['id']},{})[_0x6c1c('0x17')](function(){return _0x5518f6;});}else{return _0x5518f6;}})[_0x6c1c('0x3d')](function(_0x5badb4){logger[_0x6c1c('0x1b')](_0x6c1c('0x46'),_0x5badb4);throw _0x5badb4;});}return _0x5518f6;})[_0x6c1c('0x17')](respondWithResult(_0x5ed2d7,0xc9))['catch'](handleError(_0x5ed2d7,null));};exports['update']=function(_0x56b367,_0x5714a6){if(_0x56b367['body']['id']){delete _0x56b367[_0x6c1c('0x47')]['id'];}return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x56b367[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x17')](saveUpdates(_0x56b367['body'],null))['then'](function(_0x28bd68){if(!_0x28bd68)return;var _0xd5936=_0x28bd68['get']({'plain':!![]});return _0xd5936;})[_0x6c1c('0x17')](function(_0x25dda9){var _0x3f4303=new Redis(config[_0x6c1c('0x5')]);_0x3f4303[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON['stringify'](_[_0x6c1c('0x48')](_0x25dda9,['id',_0x6c1c('0x1d'),'production'])));return _0x25dda9;})['then'](respondWithResult(_0x5714a6,null))[_0x6c1c('0x3d')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x14')]=function(_0x3a2fef,_0x58ac8d){return db[_0x6c1c('0x35')][_0x6c1c('0x3c')]({'where':{'id':_0x3a2fef[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x58ac8d,null))['then'](removeEntity(_0x58ac8d,null))['catch'](handleError(_0x58ac8d,null));};exports[_0x6c1c('0x49')]=function(_0x1ac7e4,_0x1a8e19){return db['SquareProject']['find']({'where':{'id':_0x1ac7e4[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x1a8e19,null))['then'](function(_0x2a334b){if(_0x2a334b){return _0x2a334b[_0x6c1c('0x49')](_0x1ac7e4[_0x6c1c('0x47')][_0x6c1c('0x4a')],_[_0x6c1c('0x4b')](_0x1ac7e4[_0x6c1c('0x47')],['ids','id'])||{});}})[_0x6c1c('0x17')](respondWithResult(_0x1a8e19,null))['catch'](handleError(_0x1a8e19,null));};exports[_0x6c1c('0x4c')]=function(_0x1930ea,_0x117240){return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x1930ea['params']['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x117240,null))[_0x6c1c('0x17')](function(_0x612be2){if(_0x612be2){return _0x612be2['removeUsers'](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])[_0x6c1c('0x17')](function(){if(_[_0x6c1c('0x4d')](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])){for(var _0xed095f=0x0;_0xed095f<_0x1930ea['query'][_0x6c1c('0x4a')]['length'];_0xed095f+=0x1){socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')][_0xed095f]),'SquareProjectId':Number(_0x1930ea['params']['id'])});}}else{socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')]),'SquareProjectId':Number(_0x1930ea[_0x6c1c('0x3a')]['id'])});}});}})[_0x6c1c('0x17')](respondWithStatusCode(_0x117240,null))[_0x6c1c('0x3d')](handleError(_0x117240,null));};exports[_0x6c1c('0x50')]=function(_0x2d248c,_0x13963a){var _0x26ee48={};var _0x4fa646={};var _0x43d379;var _0x6b05c7;return db[_0x6c1c('0x35')][_0x6c1c('0x51')]({'where':{'id':_0x2d248c[_0x6c1c('0x3a')]['id']}})['then'](handleEntityNotFound(_0x13963a,null))[_0x6c1c('0x17')](function(_0x39636a){if(_0x39636a){_0x43d379=_0x39636a;_0x4fa646['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x52')][_0x6c1c('0x21')]);_0x4fa646['query']=_[_0x6c1c('0x3b')](_0x2d248c[_0x6c1c('0x25')]);_0x4fa646[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x4fa646[_0x6c1c('0x24')],_0x4fa646[_0x6c1c('0x25')]);_0x26ee48['attributes']=_['intersection'](_0x4fa646[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x2d248c['query']['fields']));_0x26ee48['attributes']=_0x26ee48[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x26ee48[_0x6c1c('0x29')]:_0x4fa646[_0x6c1c('0x24')];_0x26ee48['order']=qs[_0x6c1c('0x2e')](_0x2d248c['query']['sort']);_0x26ee48['where']=qs[_0x6c1c('0x26')](_[_0x6c1c('0x48')](_0x2d248c[_0x6c1c('0x25')],_0x4fa646[_0x6c1c('0x26')]));if(_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]){_0x26ee48['where']=_[_0x6c1c('0x33')](_0x26ee48[_0x6c1c('0x2f')],{'$or':_[_0x6c1c('0x20')](_0x26ee48['attributes'],function(_0x585a42){var _0x4ea97d={};_0x4ea97d[_0x585a42]={'$like':'%'+_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4ea97d;})});}_0x26ee48=_['merge']({},_0x26ee48,_0x2d248c[_0x6c1c('0x34')]);return _0x43d379['getUsers'](_0x26ee48);}})[_0x6c1c('0x17')](function(_0x1fc46f){if(_0x1fc46f){_0x6b05c7=_0x1fc46f[_0x6c1c('0x2a')];if(!_0x2d248c[_0x6c1c('0x25')]['hasOwnProperty'](_0x6c1c('0x2c'))){_0x26ee48[_0x6c1c('0xe')]=qs['limit'](_0x2d248c['query'][_0x6c1c('0xe')]);_0x26ee48[_0x6c1c('0xd')]=qs[_0x6c1c('0xd')](_0x2d248c['query'][_0x6c1c('0xd')]);}return _0x43d379[_0x6c1c('0x50')](_0x26ee48);}})['then'](function(_0x4a730a){if(_0x4a730a){return _0x4a730a?{'count':_0x6b05c7,'rows':_0x4a730a}:null;}})['then'](respondWithResult(_0x13963a,null))['catch'](handleError(_0x13963a,null));}; \ No newline at end of file +var _0x4c60=['include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','role','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','localhost','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SquareProjects','agi','stringify','name','send','index','map','SquareProject','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options'];(function(_0x49ec8c,_0x3435ea){var _0x35a5cf=function(_0xb80084){while(--_0xb80084){_0x49ec8c['push'](_0x49ec8c['shift']());}};_0x35a5cf(++_0x3435ea);}(_0x4c60,0xc1));var _0x04c6=function(_0x456c93,_0x217748){_0x456c93=_0x456c93-0x0;var _0x368b5f=_0x4c60[_0x456c93];return _0x368b5f;};'use strict';var _=require(_0x04c6('0x0'));var Redis=require(_0x04c6('0x1'));var qs=require(_0x04c6('0x2'));var logger=require(_0x04c6('0x3'))('api');var config=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x04c6('0x5'),'port':0x18eb});var socket=require(_0x04c6('0x6'))(new Redis(config[_0x04c6('0x7')]));require(_0x04c6('0x8'))[_0x04c6('0x9')](socket);function respondWithStatusCode(_0x39be2d,_0x8f9b13){_0x8f9b13=_0x8f9b13||0xcc;return function(_0x530a48){if(_0x530a48){return _0x39be2d[_0x04c6('0xa')](_0x8f9b13);}return _0x39be2d[_0x04c6('0xb')](_0x8f9b13)[_0x04c6('0xc')]();};}function respondWithResult(_0x30b901,_0x52a9af){_0x52a9af=_0x52a9af||0xc8;return function(_0x59a98c){if(_0x59a98c){return _0x30b901['status'](_0x52a9af)[_0x04c6('0xd')](_0x59a98c);}};}function respondWithFilteredResult(_0x5584cd,_0x15d31a){return function(_0x2772fa){if(_0x2772fa){var _0x5236c8=typeof _0x15d31a[_0x04c6('0xe')]===_0x04c6('0xf')&&typeof _0x15d31a[_0x04c6('0x10')]===_0x04c6('0xf');var _0x52cdcf=_0x2772fa[_0x04c6('0x11')];var _0x453342=_0x5236c8?0x0:_0x15d31a[_0x04c6('0xe')];var _0x56422a=_0x5236c8?_0x2772fa[_0x04c6('0x11')]:_0x15d31a[_0x04c6('0xe')]+_0x15d31a[_0x04c6('0x10')];var _0x3e80a6;if(_0x56422a>=_0x52cdcf){_0x56422a=_0x52cdcf;_0x3e80a6=0xc8;}else{_0x3e80a6=0xce;}_0x5584cd[_0x04c6('0xb')](_0x3e80a6);return _0x5584cd[_0x04c6('0x12')](_0x04c6('0x13'),_0x453342+'-'+_0x56422a+'/'+_0x52cdcf)[_0x04c6('0xd')](_0x2772fa);}return null;};}function saveUpdates(_0x5a5a66){return function(_0x31edf9){if(_0x31edf9){return _0x31edf9[_0x04c6('0x14')](_0x5a5a66)[_0x04c6('0x15')](function(_0x2bc754){return _0x2bc754;});}return null;};}function removeEntity(_0x43596a){return function(_0xfb4db5){if(_0xfb4db5){return _0xfb4db5[_0x04c6('0x16')]()[_0x04c6('0x15')](function(){var _0x47f400=_0xfb4db5[_0x04c6('0x17')]({'plain':!![]});var _0x13e472=_0x04c6('0x18');return db['UserProfileResource']['destroy']({'where':{'type':_0x13e472,'resourceId':_0x47f400['id']}})['then'](function(){return _0xfb4db5;});})[_0x04c6('0x15')](function(){var _0xb997e0=new Redis(config['redis']);_0xb997e0['publish'](_0x04c6('0x19'),JSON[_0x04c6('0x1a')]({'id':_0xfb4db5['id'],'deleted':!![]}));})[_0x04c6('0x15')](function(){_0x43596a['status'](0xcc)[_0x04c6('0xc')]();});}};}function handleEntityNotFound(_0x13f2dc){return function(_0x9d41f8){if(!_0x9d41f8){_0x13f2dc['sendStatus'](0x194);}return _0x9d41f8;};}function handleError(_0x2d3277,_0x41e29f){_0x41e29f=_0x41e29f||0x1f4;return function(_0x562491){logger['error'](_0x562491['stack']);if(_0x562491[_0x04c6('0x1b')]){delete _0x562491[_0x04c6('0x1b')];}_0x2d3277[_0x04c6('0xb')](_0x41e29f)[_0x04c6('0x1c')](_0x562491);};}exports[_0x04c6('0x1d')]=function(_0x52e5f5,_0x562952){var _0x383435={},_0x2ab1d2={},_0x9acfa={'count':0x0,'rows':[]};var _0x3233d7=_[_0x04c6('0x1e')](db[_0x04c6('0x1f')]['rawAttributes'],function(_0x1d0d3f){return{'name':_0x1d0d3f[_0x04c6('0x20')],'type':_0x1d0d3f['type'][_0x04c6('0x21')]};});_0x2ab1d2[_0x04c6('0x22')]=_['map'](_0x3233d7,'name');_0x2ab1d2[_0x04c6('0x23')]=_[_0x04c6('0x24')](_0x52e5f5[_0x04c6('0x23')]);_0x2ab1d2[_0x04c6('0x25')]=_[_0x04c6('0x26')](_0x2ab1d2[_0x04c6('0x22')],_0x2ab1d2['query']);_0x383435['attributes']=_['intersection'](_0x2ab1d2[_0x04c6('0x22')],qs['fields'](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0x27')]));_0x383435['attributes']=_0x383435[_0x04c6('0x28')][_0x04c6('0x29')]?_0x383435[_0x04c6('0x28')]:_0x2ab1d2[_0x04c6('0x22')];if(!_0x52e5f5['query'][_0x04c6('0x2a')](_0x04c6('0x2b'))){_0x383435[_0x04c6('0x10')]=qs[_0x04c6('0x10')](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0x10')]);_0x383435[_0x04c6('0xe')]=qs[_0x04c6('0xe')](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0xe')]);}_0x383435[_0x04c6('0x2c')]=qs[_0x04c6('0x2d')](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0x2d')]);_0x383435[_0x04c6('0x2e')]=qs['filters'](_[_0x04c6('0x2f')](_0x52e5f5[_0x04c6('0x23')],_0x2ab1d2[_0x04c6('0x25')]),_0x3233d7);if(_0x52e5f5[_0x04c6('0x23')]['filter']){_0x383435[_0x04c6('0x2e')]=_[_0x04c6('0x30')](_0x383435['where'],{'$or':_['map'](_0x3233d7,function(_0x4aac49){if(_0x4aac49[_0x04c6('0x31')]!==_0x04c6('0x32')){var _0x4f9a6c={};_0x4f9a6c[_0x4aac49[_0x04c6('0x1b')]]={'$like':'%'+_0x52e5f5['query'][_0x04c6('0x33')]+'%'};return _0x4f9a6c;}})});}_0x383435=_[_0x04c6('0x30')]({},_0x383435,_0x52e5f5[_0x04c6('0x34')]);var _0x2b28cd={'where':_0x383435['where']};return db['SquareProject'][_0x04c6('0x11')](_0x2b28cd)[_0x04c6('0x15')](function(_0x50041f){_0x9acfa[_0x04c6('0x11')]=_0x50041f;if(_0x52e5f5['query']['includeAll']){_0x383435[_0x04c6('0x35')]=[{'all':!![]}];}return db['SquareProject'][_0x04c6('0x36')](_0x383435);})[_0x04c6('0x15')](function(_0x59ca18){_0x9acfa[_0x04c6('0x37')]=_0x59ca18;return _0x9acfa;})['then'](respondWithFilteredResult(_0x562952,_0x383435))[_0x04c6('0x38')](handleError(_0x562952,null));};exports[_0x04c6('0x39')]=function(_0x2d83eb,_0x120238){var _0x679718={'raw':![],'where':{'id':_0x2d83eb[_0x04c6('0x3a')]['id']}},_0x57ed53={};_0x57ed53['model']=_[_0x04c6('0x24')](db['SquareProject'][_0x04c6('0x3b')]);_0x57ed53[_0x04c6('0x23')]=_[_0x04c6('0x24')](_0x2d83eb[_0x04c6('0x23')]);_0x57ed53[_0x04c6('0x25')]=_[_0x04c6('0x26')](_0x57ed53[_0x04c6('0x22')],_0x57ed53['query']);_0x679718[_0x04c6('0x28')]=_['intersection'](_0x57ed53[_0x04c6('0x22')],qs['fields'](_0x2d83eb['query'][_0x04c6('0x27')]));_0x679718['attributes']=_0x679718[_0x04c6('0x28')][_0x04c6('0x29')]?_0x679718[_0x04c6('0x28')]:_0x57ed53['model'];if(_0x2d83eb[_0x04c6('0x23')][_0x04c6('0x3c')]){_0x679718[_0x04c6('0x35')]=[{'all':!![]}];}_0x679718=_[_0x04c6('0x30')]({},_0x679718,_0x2d83eb[_0x04c6('0x34')]);return db[_0x04c6('0x1f')][_0x04c6('0x3d')](_0x679718)['then'](handleEntityNotFound(_0x120238,null))['then'](respondWithResult(_0x120238,null))[_0x04c6('0x38')](handleError(_0x120238,null));};exports[_0x04c6('0x3e')]=function(_0x417cb7,_0x5d6726){return db[_0x04c6('0x1f')][_0x04c6('0x3e')](_0x417cb7[_0x04c6('0x3f')],{})['then'](function(_0x4c9942){var _0x56c7e6=_0x417cb7[_0x04c6('0x40')][_0x04c6('0x17')]({'plain':!![]});if(!_0x56c7e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56c7e6[_0x04c6('0x41')]===_0x04c6('0x40')){var _0x2bd045=_0x4c9942['get']({'plain':!![]});var _0x392983=_0x04c6('0x18');return db['UserProfileSection'][_0x04c6('0x3d')]({'where':{'name':_0x392983,'userProfileId':_0x56c7e6[_0x04c6('0x42')]},'raw':!![]})[_0x04c6('0x15')](function(_0xee2822){if(_0xee2822&&_0xee2822['autoAssociation']===0x0){return db[_0x04c6('0x43')][_0x04c6('0x3e')]({'name':_0x2bd045[_0x04c6('0x1b')],'resourceId':_0x2bd045['id'],'type':_0xee2822[_0x04c6('0x1b')],'sectionId':_0xee2822['id']},{})['then'](function(){return _0x4c9942;});}else{return _0x4c9942;}})[_0x04c6('0x38')](function(_0x17824f){logger[_0x04c6('0x44')](_0x04c6('0x45'),_0x17824f);throw _0x17824f;});}return _0x4c9942;})['then'](respondWithResult(_0x5d6726,0xc9))[_0x04c6('0x38')](handleError(_0x5d6726,null));};exports[_0x04c6('0x14')]=function(_0x15ec61,_0x489361){if(_0x15ec61[_0x04c6('0x3f')]['id']){delete _0x15ec61[_0x04c6('0x3f')]['id'];}return db[_0x04c6('0x1f')][_0x04c6('0x3d')]({'where':{'id':_0x15ec61[_0x04c6('0x3a')]['id']}})[_0x04c6('0x15')](handleEntityNotFound(_0x489361,null))[_0x04c6('0x15')](saveUpdates(_0x15ec61[_0x04c6('0x3f')],null))[_0x04c6('0x15')](function(_0x12f2c6){if(!_0x12f2c6)return;var _0x27e805=_0x12f2c6[_0x04c6('0x17')]({'plain':!![]});return _0x27e805;})[_0x04c6('0x15')](function(_0x54e577){var _0x3a80f6=new Redis(config[_0x04c6('0x7')]);_0x3a80f6[_0x04c6('0x46')](_0x04c6('0x19'),JSON[_0x04c6('0x1a')](_['pick'](_0x54e577,['id',_0x04c6('0x1b'),_0x04c6('0x47')])));return _0x54e577;})[_0x04c6('0x15')](respondWithResult(_0x489361,null))[_0x04c6('0x38')](handleError(_0x489361,null));};exports[_0x04c6('0x16')]=function(_0x45fbd5,_0x111364){return db[_0x04c6('0x1f')][_0x04c6('0x3d')]({'where':{'id':_0x45fbd5[_0x04c6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x111364,null))['then'](removeEntity(_0x111364,null))['catch'](handleError(_0x111364,null));};exports['addUsers']=function(_0x3be262,_0x4dce86){return db[_0x04c6('0x1f')]['find']({'where':{'id':_0x3be262[_0x04c6('0x3a')]['id']}})[_0x04c6('0x15')](handleEntityNotFound(_0x4dce86,null))['then'](function(_0x4dd6bb){if(_0x4dd6bb){return _0x4dd6bb[_0x04c6('0x48')](_0x3be262[_0x04c6('0x3f')][_0x04c6('0x49')],_[_0x04c6('0x4a')](_0x3be262['body'],[_0x04c6('0x49'),'id'])||{});}})[_0x04c6('0x15')](respondWithResult(_0x4dce86,null))[_0x04c6('0x38')](handleError(_0x4dce86,null));};exports[_0x04c6('0x4b')]=function(_0x24c5be,_0x29c72f){return db[_0x04c6('0x1f')]['find']({'where':{'id':_0x24c5be[_0x04c6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x29c72f,null))[_0x04c6('0x15')](function(_0x3bbd8b){if(_0x3bbd8b){return _0x3bbd8b['removeUsers'](_0x24c5be[_0x04c6('0x23')][_0x04c6('0x49')])[_0x04c6('0x15')](function(){if(_[_0x04c6('0x4c')](_0x24c5be[_0x04c6('0x23')][_0x04c6('0x49')])){for(var _0xf073a8=0x0;_0xf073a8<_0x24c5be[_0x04c6('0x23')]['ids'][_0x04c6('0x29')];_0xf073a8+=0x1){socket['emit'](_0x04c6('0x4d'),{'UserId':Number(_0x24c5be[_0x04c6('0x23')]['ids'][_0xf073a8]),'SquareProjectId':Number(_0x24c5be['params']['id'])});}}else{socket[_0x04c6('0x4e')]('userSquareProject:remove',{'UserId':Number(_0x24c5be[_0x04c6('0x23')][_0x04c6('0x49')]),'SquareProjectId':Number(_0x24c5be['params']['id'])});}});}})[_0x04c6('0x15')](respondWithStatusCode(_0x29c72f,null))[_0x04c6('0x38')](handleError(_0x29c72f,null));};exports[_0x04c6('0x4f')]=function(_0x1cc1a1,_0x2be139){var _0xd12535={};var _0x3e5a53={};var _0x35ca98;var _0x243bc4;return db[_0x04c6('0x1f')][_0x04c6('0x50')]({'where':{'id':_0x1cc1a1['params']['id']}})[_0x04c6('0x15')](handleEntityNotFound(_0x2be139,null))[_0x04c6('0x15')](function(_0x289612){if(_0x289612){_0x35ca98=_0x289612;_0x3e5a53[_0x04c6('0x22')]=_['keys'](db[_0x04c6('0x51')][_0x04c6('0x3b')]);_0x3e5a53[_0x04c6('0x23')]=_['keys'](_0x1cc1a1['query']);_0x3e5a53[_0x04c6('0x25')]=_[_0x04c6('0x26')](_0x3e5a53[_0x04c6('0x22')],_0x3e5a53[_0x04c6('0x23')]);_0xd12535[_0x04c6('0x28')]=_[_0x04c6('0x26')](_0x3e5a53['model'],qs[_0x04c6('0x27')](_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0x27')]));_0xd12535['attributes']=_0xd12535['attributes'][_0x04c6('0x29')]?_0xd12535[_0x04c6('0x28')]:_0x3e5a53[_0x04c6('0x22')];_0xd12535[_0x04c6('0x2c')]=qs['sort'](_0x1cc1a1[_0x04c6('0x23')]['sort']);_0xd12535['where']=qs[_0x04c6('0x25')](_[_0x04c6('0x2f')](_0x1cc1a1[_0x04c6('0x23')],_0x3e5a53[_0x04c6('0x25')]));if(_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0x33')]){_0xd12535[_0x04c6('0x2e')]=_['merge'](_0xd12535[_0x04c6('0x2e')],{'$or':_[_0x04c6('0x1e')](_0xd12535[_0x04c6('0x28')],function(_0x329c82){var _0x1c2e79={};_0x1c2e79[_0x329c82]={'$like':'%'+_0x1cc1a1['query']['filter']+'%'};return _0x1c2e79;})});}_0xd12535=_[_0x04c6('0x30')]({},_0xd12535,_0x1cc1a1[_0x04c6('0x34')]);return _0x35ca98[_0x04c6('0x4f')](_0xd12535);}})['then'](function(_0x38bd2e){if(_0x38bd2e){_0x243bc4=_0x38bd2e[_0x04c6('0x29')];if(!_0x1cc1a1['query'][_0x04c6('0x2a')](_0x04c6('0x2b'))){_0xd12535[_0x04c6('0x10')]=qs[_0x04c6('0x10')](_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0x10')]);_0xd12535[_0x04c6('0xe')]=qs[_0x04c6('0xe')](_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0xe')]);}return _0x35ca98[_0x04c6('0x4f')](_0xd12535);}})[_0x04c6('0x15')](function(_0x38900b){if(_0x38900b){return _0x38900b?{'count':_0x243bc4,'rows':_0x38900b}:null;}})['then'](respondWithResult(_0x2be139,null))[_0x04c6('0x38')](handleError(_0x2be139,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 431ca71..0cfbd73 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 _0x61b3=['emit','hook','events','../../mysqldb','update','remove'];(function(_0x7f287d,_0xe3b36e){var _0x21514f=function(_0x2e392e){while(--_0x2e392e){_0x7f287d['push'](_0x7f287d['shift']());}};_0x21514f(++_0xe3b36e);}(_0x61b3,0x122));var _0x361b=function(_0x2a9302,_0x34ecd5){_0x2a9302=_0x2a9302-0x0;var _0x3dbabc=_0x61b3[_0x2a9302];return _0x3dbabc;};'use strict';var EventEmitter=require(_0x361b('0x0'));var SquareProject=require(_0x361b('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x361b('0x2'),'afterDestroy':_0x361b('0x3')};function emitEvent(_0x301f01){return function(_0x38f0c1,_0x2fc6f0,_0x44a6af){SquareProjectEvents[_0x361b('0x4')](_0x301f01+':'+_0x38f0c1['id'],_0x38f0c1);SquareProjectEvents['emit'](_0x301f01,_0x38f0c1);_0x44a6af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x361b('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xeba5=['../../mysqldb','update','remove','emit','hook','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xeba5,0x1b6));var _0x5eba=function(_0x42d517,_0x3441e0){_0x42d517=_0x42d517-0x0;var _0x3c210f=_0xeba5[_0x42d517];return _0x3c210f;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x5eba('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5eba('0x1'),'afterDestroy':_0x5eba('0x2')};function emitEvent(_0x5d55a3){return function(_0x5b711d,_0x2a13f4,_0xacc7b1){SquareProjectEvents['emit'](_0x5d55a3+':'+_0x5b711d['id'],_0x5b711d);SquareProjectEvents[_0x5eba('0x3')](_0x5d55a3,_0x5b711d);_0xacc7b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x5eba('0x4')](e,emitEvent(event));}}module[_0x5eba('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3762f59..c21117c 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 _0x683e=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','production'];(function(_0x59359b,_0x2daa60){var _0x4d4623=function(_0x5345db){while(--_0x5345db){_0x59359b['push'](_0x59359b['shift']());}};_0x4d4623(++_0x2daa60);}(_0x683e,0x190));var _0xe683=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x683e[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0xe683('0x0'));var util=require('util');var logger=require(_0xe683('0x1'))(_0xe683('0x2'));var moment=require(_0xe683('0x3'));var BPromise=require(_0xe683('0x4'));var rp=require(_0xe683('0x5'));var fs=require('fs');var path=require(_0xe683('0x6'));var rimraf=require('rimraf');var config=require(_0xe683('0x7'));var attributes=require('./squareProject.attributes');module[_0xe683('0x8')]=function(_0x1cdcc2,_0x54b4eb){return _0x1cdcc2['define'](_0xe683('0x9'),attributes,{'tableName':_0xe683('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xac9c35,_0x8cdc1a,_0x3a01be){if(_0xac9c35[_0xe683('0xb')](_0xe683('0xc'))){_0xac9c35[_0xe683('0xd')]=moment()[_0xe683('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xac9c35[_0xe683('0xb')](_0xe683('0xf'))){_0xac9c35['publishedAt']=moment()[_0xe683('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3a01be(null,_0xac9c35);}}});}; \ No newline at end of file +var _0xa417=['define','changed','savedAt','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports'];(function(_0x6522bf,_0x16cdd0){var _0x4e96de=function(_0x2642cc){while(--_0x2642cc){_0x6522bf['push'](_0x6522bf['shift']());}};_0x4e96de(++_0x16cdd0);}(_0xa417,0x146));var _0x7a41=function(_0x5f4c4b,_0x331938){_0x5f4c4b=_0x5f4c4b-0x0;var _0x5ead9c=_0xa417[_0x5f4c4b];return _0x5ead9c;};'use strict';var _=require(_0x7a41('0x0'));var util=require(_0x7a41('0x1'));var logger=require(_0x7a41('0x2'))(_0x7a41('0x3'));var moment=require(_0x7a41('0x4'));var BPromise=require(_0x7a41('0x5'));var rp=require(_0x7a41('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a41('0x7'));var config=require('../../config/environment');var attributes=require(_0x7a41('0x8'));module[_0x7a41('0x9')]=function(_0x446566,_0x2bc282){return _0x446566[_0x7a41('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15adaf,_0x34562f,_0x5c49eb){if(_0x15adaf[_0x7a41('0xb')]('preproduction')){_0x15adaf[_0x7a41('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x15adaf[_0x7a41('0xb')](_0x7a41('0xd'))){_0x15adaf[_0x7a41('0xe')]=moment()['format'](_0x7a41('0xf'));}_0x5c49eb(null,_0x15adaf);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 24b0778..ae18c1d 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 _0x327e=['then','info','GetSquareProjects','debug','stringify','error','message','ShowSquareProject','find','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x327e,0xdc));var _0xe327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x327e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe327('0x0'));var Redis=require(_0xe327('0x1'));var db=require(_0xe327('0x2'))['db'];var logger=require(_0xe327('0x3'))(_0xe327('0x4'));var config=require(_0xe327('0x5'));config[_0xe327('0x6')]=_[_0xe327('0x7')](config[_0xe327('0x6')],{'host':_0xe327('0x8'),'port':0x18eb});var socket=require(_0xe327('0x9'))(new Redis(config[_0xe327('0x6')]));require('./squareProject.socket')[_0xe327('0xa')](socket);exports['GetSquareProjects']=function(_0x550290){var _0x581e2f=this;return new Promise(function(_0x1c6a3c,_0x17217a){return db['SquareProject'][_0xe327('0xb')]({'raw':_0x550290[_0xe327('0xc')]?_0x550290[_0xe327('0xc')][_0xe327('0xd')]===undefined?!![]:![]:!![],'where':_0x550290['options']?_0x550290[_0xe327('0xc')][_0xe327('0xe')]||null:null,'attributes':_0x550290[_0xe327('0xc')]?_0x550290[_0xe327('0xc')][_0xe327('0xf')]||null:null,'limit':_0x550290[_0xe327('0xc')]?_0x550290[_0xe327('0xc')][_0xe327('0x10')]||null:null,'include':_0x550290[_0xe327('0xc')]?_0x550290[_0xe327('0xc')][_0xe327('0x11')]?_[_0xe327('0x12')](_0x550290[_0xe327('0xc')][_0xe327('0x11')],function(_0x393a50){return{'model':db[_0x393a50[_0xe327('0x13')]],'as':_0x393a50['as'],'attributes':_0x393a50[_0xe327('0xf')],'include':_0x393a50[_0xe327('0x11')]?_['map'](_0x393a50[_0xe327('0x11')],function(_0x35fc4b){return{'model':db[_0x35fc4b[_0xe327('0x13')]],'as':_0x35fc4b['as'],'attributes':_0x35fc4b[_0xe327('0xf')],'include':_0x35fc4b[_0xe327('0x11')]?_['map'](_0x35fc4b[_0xe327('0x11')],function(_0x24cac8){return{'model':db[_0x24cac8['model']],'as':_0x24cac8['as'],'attributes':_0x24cac8[_0xe327('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe327('0x14')](function(_0x2449a2){logger[_0xe327('0x15')](_0xe327('0x16'),_0x550290);logger[_0xe327('0x17')](_0xe327('0x16'),_0x550290,JSON[_0xe327('0x18')](_0x2449a2));_0x1c6a3c(_0x2449a2);})['catch'](function(_0x39d8f8){logger[_0xe327('0x19')](_0xe327('0x16'),_0x39d8f8[_0xe327('0x1a')],_0x550290);_0x17217a(_0x581e2f['error'](0x1f4,_0x39d8f8[_0xe327('0x1a')]));});});};exports[_0xe327('0x1b')]=function(_0x524cf4){var _0x240e0d=this;return new Promise(function(_0x3b8605,_0x2e4d00){return db['SquareProject'][_0xe327('0x1c')]({'raw':_0x524cf4[_0xe327('0xc')]?_0x524cf4[_0xe327('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x524cf4['options']?_0x524cf4[_0xe327('0xc')][_0xe327('0xe')]||null:null,'attributes':_0x524cf4[_0xe327('0xc')]?_0x524cf4[_0xe327('0xc')]['attributes']||null:null,'include':_0x524cf4[_0xe327('0xc')]?_0x524cf4[_0xe327('0xc')][_0xe327('0x11')]?_[_0xe327('0x12')](_0x524cf4[_0xe327('0xc')]['include'],function(_0x1e9068){return{'model':db[_0x1e9068[_0xe327('0x13')]],'as':_0x1e9068['as'],'attributes':_0x1e9068[_0xe327('0xf')],'include':_0x1e9068['include']?_[_0xe327('0x12')](_0x1e9068[_0xe327('0x11')],function(_0x52b819){return{'model':db[_0x52b819[_0xe327('0x13')]],'as':_0x52b819['as'],'attributes':_0x52b819['attributes'],'include':_0x52b819['include']?_[_0xe327('0x12')](_0x52b819[_0xe327('0x11')],function(_0x1badfd){return{'model':db[_0x1badfd[_0xe327('0x13')]],'as':_0x1badfd['as'],'attributes':_0x1badfd[_0xe327('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33d1c4){logger[_0xe327('0x15')](_0xe327('0x1b'),_0x524cf4);logger[_0xe327('0x17')](_0xe327('0x1b'),_0x524cf4,JSON[_0xe327('0x18')](_0x33d1c4));_0x3b8605(_0x33d1c4);})[_0xe327('0x1d')](function(_0x51854e){logger[_0xe327('0x19')](_0xe327('0x1b'),_0x51854e[_0xe327('0x1a')],_0x524cf4);_0x2e4d00(_0x240e0d[_0xe327('0x19')](0x1f4,_0x51854e['message']));});});}; \ No newline at end of file +var _0x6706=['../../config/logger','rpc','../../config/environment','redis','localhost','./squareProject.socket','register','SquareProject','raw','options','where','attributes','map','include','model','then','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','info','lodash','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6706,0x150));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6670('0x0'));var Redis=require(_0x6670('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x6670('0x2'))(_0x6670('0x3'));var config=require(_0x6670('0x4'));config[_0x6670('0x5')]=_['defaults'](config[_0x6670('0x5')],{'host':_0x6670('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6670('0x7'))[_0x6670('0x8')](socket);exports['GetSquareProjects']=function(_0xcca1fc){var _0x8a34a4=this;return new Promise(function(_0x565ea9,_0x5d54ff){return db[_0x6670('0x9')]['findAll']({'raw':_0xcca1fc['options']?_0xcca1fc['options'][_0x6670('0xa')]===undefined?!![]:![]:!![],'where':_0xcca1fc[_0x6670('0xb')]?_0xcca1fc['options'][_0x6670('0xc')]||null:null,'attributes':_0xcca1fc[_0x6670('0xb')]?_0xcca1fc[_0x6670('0xb')][_0x6670('0xd')]||null:null,'limit':_0xcca1fc['options']?_0xcca1fc[_0x6670('0xb')]['limit']||null:null,'include':_0xcca1fc[_0x6670('0xb')]?_0xcca1fc['options']['include']?_[_0x6670('0xe')](_0xcca1fc[_0x6670('0xb')][_0x6670('0xf')],function(_0x297486){return{'model':db[_0x297486[_0x6670('0x10')]],'as':_0x297486['as'],'attributes':_0x297486[_0x6670('0xd')],'include':_0x297486[_0x6670('0xf')]?_[_0x6670('0xe')](_0x297486[_0x6670('0xf')],function(_0x5b1b5f){return{'model':db[_0x5b1b5f[_0x6670('0x10')]],'as':_0x5b1b5f['as'],'attributes':_0x5b1b5f[_0x6670('0xd')],'include':_0x5b1b5f[_0x6670('0xf')]?_[_0x6670('0xe')](_0x5b1b5f['include'],function(_0x221342){return{'model':db[_0x221342[_0x6670('0x10')]],'as':_0x221342['as'],'attributes':_0x221342[_0x6670('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6670('0x11')](function(_0x2fdf6c){logger['info'](_0x6670('0x12'),_0xcca1fc);logger[_0x6670('0x13')](_0x6670('0x12'),_0xcca1fc,JSON[_0x6670('0x14')](_0x2fdf6c));_0x565ea9(_0x2fdf6c);})[_0x6670('0x15')](function(_0x7fab6c){logger[_0x6670('0x16')](_0x6670('0x12'),_0x7fab6c[_0x6670('0x17')],_0xcca1fc);_0x5d54ff(_0x8a34a4[_0x6670('0x16')](0x1f4,_0x7fab6c[_0x6670('0x17')]));});});};exports[_0x6670('0x18')]=function(_0x502961){var _0x44e379=this;return new Promise(function(_0x37f1e1,_0x5cce75){return db[_0x6670('0x9')]['find']({'raw':_0x502961[_0x6670('0xb')]?_0x502961[_0x6670('0xb')][_0x6670('0xa')]===undefined?!![]:![]:!![],'where':_0x502961[_0x6670('0xb')]?_0x502961[_0x6670('0xb')][_0x6670('0xc')]||null:null,'attributes':_0x502961[_0x6670('0xb')]?_0x502961[_0x6670('0xb')][_0x6670('0xd')]||null:null,'include':_0x502961[_0x6670('0xb')]?_0x502961[_0x6670('0xb')][_0x6670('0xf')]?_[_0x6670('0xe')](_0x502961[_0x6670('0xb')]['include'],function(_0x4deb6d){return{'model':db[_0x4deb6d['model']],'as':_0x4deb6d['as'],'attributes':_0x4deb6d[_0x6670('0xd')],'include':_0x4deb6d[_0x6670('0xf')]?_[_0x6670('0xe')](_0x4deb6d[_0x6670('0xf')],function(_0x2ba4ca){return{'model':db[_0x2ba4ca[_0x6670('0x10')]],'as':_0x2ba4ca['as'],'attributes':_0x2ba4ca['attributes'],'include':_0x2ba4ca[_0x6670('0xf')]?_[_0x6670('0xe')](_0x2ba4ca[_0x6670('0xf')],function(_0x33b54b){return{'model':db[_0x33b54b[_0x6670('0x10')]],'as':_0x33b54b['as'],'attributes':_0x33b54b['attributes']};}):[]};}):[]};}):[]:[]})[_0x6670('0x11')](function(_0x481acd){logger[_0x6670('0x19')]('ShowSquareProject',_0x502961);logger[_0x6670('0x13')]('ShowSquareProject',_0x502961,JSON[_0x6670('0x14')](_0x481acd));_0x37f1e1(_0x481acd);})[_0x6670('0x15')](function(_0x5b81f7){logger[_0x6670('0x16')](_0x6670('0x18'),_0x5b81f7[_0x6670('0x17')],_0x502961);_0x5cce75(_0x44e379[_0x6670('0x16')](0x1f4,_0x5b81f7[_0x6670('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4df2322..3b1365a 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 _0xa1a6=['remove','update','removeListener','squareProject:','./squareProject.events','save'];(function(_0x50fcf6,_0x4c39ba){var _0x44c8a6=function(_0x258dcf){while(--_0x258dcf){_0x50fcf6['push'](_0x50fcf6['shift']());}};_0x44c8a6(++_0x4c39ba);}(_0xa1a6,0x100));var _0x6a1a=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0xa1a6[_0x55677b];return _0x104b88;};'use strict';var SquareProjectEvents=require(_0x6a1a('0x0'));var events=[_0x6a1a('0x1'),_0x6a1a('0x2'),_0x6a1a('0x3')];function createListener(_0x434460,_0x4498f2){return function(_0x21c5c5){_0x4498f2['emit'](_0x434460,_0x21c5c5);};}function removeListener(_0x4dc470,_0xe4fbf1){return function(){SquareProjectEvents[_0x6a1a('0x4')](_0x4dc470,_0xe4fbf1);};}exports['register']=function(_0x293b5a){for(var _0x2c2a52=0x0,_0x48a851=events['length'];_0x2c2a52<_0x48a851;_0x2c2a52++){var _0x3b966f=events[_0x2c2a52];var _0x41e5df=createListener(_0x6a1a('0x5')+_0x3b966f,_0x293b5a);SquareProjectEvents['on'](_0x3b966f,_0x41e5df);}}; \ No newline at end of file +var _0xa9ba=['save','remove','emit','length','squareProject:','./squareProject.events'];(function(_0x2f1f08,_0x158f35){var _0x32f365=function(_0x2cc60e){while(--_0x2cc60e){_0x2f1f08['push'](_0x2f1f08['shift']());}};_0x32f365(++_0x158f35);}(_0xa9ba,0xd1));var _0xaa9b=function(_0x50ce34,_0x162598){_0x50ce34=_0x50ce34-0x0;var _0x1d6fa0=_0xa9ba[_0x50ce34];return _0x1d6fa0;};'use strict';var SquareProjectEvents=require(_0xaa9b('0x0'));var events=[_0xaa9b('0x1'),_0xaa9b('0x2'),'update'];function createListener(_0x1e7125,_0x3204e9){return function(_0xf15400){_0x3204e9[_0xaa9b('0x3')](_0x1e7125,_0xf15400);};}function removeListener(_0x118db0,_0x1ab478){return function(){SquareProjectEvents['removeListener'](_0x118db0,_0x1ab478);};}exports['register']=function(_0x13b46e){for(var _0x5e2f99=0x0,_0x3f0059=events[_0xaa9b('0x4')];_0x5e2f99<_0x3f0059;_0x5e2f99++){var _0x153949=events[_0x5e2f99];var _0x396ce9=createListener(_0xaa9b('0x5')+_0x153949,_0x13b46e);SquareProjectEvents['on'](_0x153949,_0x396ce9);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d37dfe8..515c97f 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x366ef2,_0x16e62f){var _0x51a5f3=function(_0x2d32ea){while(--_0x2d32ea){_0x366ef2['push'](_0x366ef2['shift']());}};_0x51a5f3(++_0x16e62f);}(_0x326f,0xd1));var _0xf326=function(_0x3eda55,_0x3f1522){_0x3eda55=_0x3eda55-0x0;var _0x4fe92d=_0x326f[_0x3eda55];return _0x4fe92d;};'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')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x553b11,_0x2a821f){var _0x345b36=function(_0x24b1eb){while(--_0x24b1eb){_0x553b11['push'](_0x553b11['shift']());}};_0x345b36(++_0x2a821f);}(_0x53ec,0x192));var _0xc53e=function(_0x577f24,_0x415e8c){_0x577f24=_0x577f24-0x0;var _0x4b82f7=_0x53ec[_0x577f24];return _0x4b82f7;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 175790a..7fa5308 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 _0xb4c7=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x5895af,_0x3cfa9c){var _0x30ea6d=function(_0x207827){while(--_0x207827){_0x5895af['push'](_0x5895af['shift']());}};_0x30ea6d(++_0x3cfa9c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xff0448,_0x473c6c){_0xff0448=_0xff0448-0x0;var _0x2e8550=_0xb4c7[_0xff0448];return _0x2e8550;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'callerid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize[_0x7b4c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize[_0x7b4c('0x2')]},'dnid':{'type':Sequelize[_0x7b4c('0x2')]},'projectName':{'type':Sequelize[_0x7b4c('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7b4c('0x2')]},'savePath':{'type':Sequelize[_0x7b4c('0x2')]},'format':{'type':Sequelize[_0x7b4c('0x3')],'get':function(){var _0x4bf85d='';var _0x2d7b7e=this[_0x7b4c('0x4')]('savePath');if(_0x2d7b7e){_0x4bf85d=_0x2d7b7e[_0x7b4c('0x5')](_0x2d7b7e[_0x7b4c('0x6')]('.'));}return _0x4bf85d;}}}; \ No newline at end of file +var _0xeff8=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x341248,_0x2b3c9a){var _0x5f0bda=function(_0x1bd244){while(--_0x1bd244){_0x341248['push'](_0x341248['shift']());}};_0x5f0bda(++_0x2b3c9a);}(_0xeff8,0x186));var _0x8eff=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xeff8[_0x5e6cb8];return _0x3faeb3;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'context':{'type':Sequelize[_0x8eff('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize[_0x8eff('0x2')]},'dnid':{'type':Sequelize[_0x8eff('0x2')]},'projectName':{'type':Sequelize[_0x8eff('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8eff('0x2')]},'savePath':{'type':Sequelize[_0x8eff('0x2')]},'format':{'type':Sequelize[_0x8eff('0x3')],'get':function(){var _0x323b2='';var _0x491f01=this[_0x8eff('0x4')](_0x8eff('0x5'));if(_0x491f01){_0x323b2=_0x491f01[_0x8eff('0x6')](_0x491f01[_0x8eff('0x7')]('.'));}return _0x323b2;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 0cee39b..a34d844 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 _0x6ee5=['attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareRecording','includeAll','findAll','rows','include','catch','create','body','find','download','../../components/encryptor','uniqueid','params','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x6ee5,0xe9));var _0x56ee=function(_0x37ff1d,_0x455c85){_0x37ff1d=_0x37ff1d-0x0;var _0x5f41bd=_0x6ee5[_0x37ff1d];return _0x5f41bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56ee('0x0'));var zipdir=require(_0x56ee('0x1'));var jsonpatch=require(_0x56ee('0x2'));var rp=require(_0x56ee('0x3'));var moment=require(_0x56ee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x56ee('0x5'));var util=require(_0x56ee('0x6'));var path=require('path');var sox=require(_0x56ee('0x7'));var csv=require(_0x56ee('0x8'));var ejs=require(_0x56ee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56ee('0xa'));var squel=require(_0x56ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x56ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x56ee('0x8'));var querystring=require('querystring');var Papa=require(_0x56ee('0xd'));var Redis=require(_0x56ee('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56ee('0xf'));var logger=require('../../config/logger')(_0x56ee('0x10'));var utils=require(_0x56ee('0x11'));var config=require(_0x56ee('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x56ee('0x13'))['db'];function respondWithStatusCode(_0x50db39,_0x2118c6){_0x2118c6=_0x2118c6||0xcc;return function(_0x1b663a){if(_0x1b663a){return _0x50db39[_0x56ee('0x14')](_0x2118c6);}return _0x50db39[_0x56ee('0x15')](_0x2118c6)['end']();};}function respondWithResult(_0x2a0561,_0x5e8033){_0x5e8033=_0x5e8033||0xc8;return function(_0x248df3){if(_0x248df3){return _0x2a0561[_0x56ee('0x15')](_0x5e8033)[_0x56ee('0x16')](_0x248df3);}};}function respondWithFilteredResult(_0xb98106,_0x518ec0){return function(_0xe38d92){if(_0xe38d92){var _0x94ce07=typeof _0x518ec0[_0x56ee('0x17')]===_0x56ee('0x18')&&typeof _0x518ec0[_0x56ee('0x19')]==='undefined';var _0x4ac9c7=_0xe38d92['count'];var _0x3895b8=_0x94ce07?0x0:_0x518ec0['offset'];var _0x12a96c=_0x94ce07?_0xe38d92[_0x56ee('0x1a')]:_0x518ec0['offset']+_0x518ec0['limit'];var _0x24a382;if(_0x12a96c>=_0x4ac9c7){_0x12a96c=_0x4ac9c7;_0x24a382=0xc8;}else{_0x24a382=0xce;}_0xb98106['status'](_0x24a382);return _0xb98106[_0x56ee('0x1b')]('Content-Range',_0x3895b8+'-'+_0x12a96c+'/'+_0x4ac9c7)[_0x56ee('0x16')](_0xe38d92);}return null;};}function patchUpdates(_0x2ba918){return function(_0x1d5c66){try{jsonpatch['apply'](_0x1d5c66,_0x2ba918,!![]);}catch(_0x5a54aa){return BPromise[_0x56ee('0x1c')](_0x5a54aa);}return _0x1d5c66[_0x56ee('0x1d')]();};}function saveUpdates(_0x275219,_0x184f35){return function(_0x20ce63){if(_0x20ce63){return _0x20ce63[_0x56ee('0x1e')](_0x275219)[_0x56ee('0x1f')](function(_0x3499b1){return _0x3499b1;});}return null;};}function removeEntity(_0x1500c6,_0x30db08){return function(_0x4f80e9){if(_0x4f80e9){return _0x4f80e9[_0x56ee('0x20')]()[_0x56ee('0x1f')](function(){_0x1500c6['status'](0xcc)[_0x56ee('0x21')]();});}};}function handleEntityNotFound(_0x49b9e5,_0x24ff2c){return function(_0x16f0d0){if(!_0x16f0d0){_0x49b9e5['sendStatus'](0x194);}return _0x16f0d0;};}function handleError(_0x2714b3,_0x3a65da){_0x3a65da=_0x3a65da||0x1f4;return function(_0x3fcfd8){logger[_0x56ee('0x22')](_0x3fcfd8[_0x56ee('0x23')]);if(_0x3fcfd8['name']){delete _0x3fcfd8[_0x56ee('0x24')];}_0x2714b3[_0x56ee('0x15')](_0x3a65da)[_0x56ee('0x25')](_0x3fcfd8);};}exports[_0x56ee('0x26')]=function(_0x47dd41,_0x3a294c){var _0x2be793={},_0x9bd4ba={},_0x967a40={'count':0x0,'rows':[]};var _0xeae5c0=_[_0x56ee('0x27')](db['SquareRecording'][_0x56ee('0x28')],function(_0x75a2f){return{'name':_0x75a2f['fieldName'],'type':_0x75a2f[_0x56ee('0x29')][_0x56ee('0x2a')]};});_0x9bd4ba['model']=_['map'](_0xeae5c0,'name');_0x9bd4ba[_0x56ee('0x2b')]=_[_0x56ee('0x2c')](_0x47dd41['query']);_0x9bd4ba[_0x56ee('0x2d')]=_[_0x56ee('0x2e')](_0x9bd4ba[_0x56ee('0x2f')],_0x9bd4ba[_0x56ee('0x2b')]);_0x2be793['attributes']=_[_0x56ee('0x2e')](_0x9bd4ba[_0x56ee('0x2f')],qs[_0x56ee('0x30')](_0x47dd41[_0x56ee('0x2b')]['fields']));_0x2be793[_0x56ee('0x31')]=_0x2be793[_0x56ee('0x31')][_0x56ee('0x32')]?_0x2be793['attributes']:_0x9bd4ba['model'];if(!_0x47dd41[_0x56ee('0x2b')]['hasOwnProperty'](_0x56ee('0x33'))){_0x2be793['limit']=qs[_0x56ee('0x19')](_0x47dd41[_0x56ee('0x2b')][_0x56ee('0x19')]);_0x2be793['offset']=qs[_0x56ee('0x17')](_0x47dd41[_0x56ee('0x2b')][_0x56ee('0x17')]);}_0x2be793[_0x56ee('0x34')]=qs[_0x56ee('0x35')](_0x47dd41[_0x56ee('0x2b')][_0x56ee('0x35')]);_0x2be793['where']=qs[_0x56ee('0x2d')](_[_0x56ee('0x36')](_0x47dd41[_0x56ee('0x2b')],_0x9bd4ba[_0x56ee('0x2d')]),_0xeae5c0);if(_0x47dd41['query'][_0x56ee('0x37')]){_0x2be793[_0x56ee('0x38')]=_[_0x56ee('0x39')](_0x2be793[_0x56ee('0x38')],{'$or':_[_0x56ee('0x27')](_0xeae5c0,function(_0x3c9e8c){if(_0x3c9e8c['type']!==_0x56ee('0x3a')){var _0x525087={};_0x525087[_0x3c9e8c[_0x56ee('0x24')]]={'$like':'%'+_0x47dd41['query'][_0x56ee('0x37')]+'%'};return _0x525087;}})});}_0x2be793=_[_0x56ee('0x39')]({},_0x2be793,_0x47dd41[_0x56ee('0x3b')]);var _0x5e00d3={'where':_0x2be793[_0x56ee('0x38')]};return db[_0x56ee('0x3c')]['count'](_0x5e00d3)[_0x56ee('0x1f')](function(_0x4ecd26){_0x967a40[_0x56ee('0x1a')]=_0x4ecd26;if(_0x47dd41[_0x56ee('0x2b')][_0x56ee('0x3d')]){_0x2be793['include']=[{'all':!![]}];}return db['SquareRecording'][_0x56ee('0x3e')](_0x2be793);})[_0x56ee('0x1f')](function(_0x90028d){_0x967a40[_0x56ee('0x3f')]=_0x90028d;return _0x967a40;})[_0x56ee('0x1f')](respondWithFilteredResult(_0x3a294c,_0x2be793))['catch'](handleError(_0x3a294c,null));};exports['show']=function(_0x4d2522,_0x3ad41f){var _0x34fd9b={'raw':!![],'where':{'id':_0x4d2522['params']['id']}},_0x588355={};_0x588355[_0x56ee('0x2f')]=_[_0x56ee('0x2c')](db['SquareRecording'][_0x56ee('0x28')]);_0x588355[_0x56ee('0x2b')]=_['keys'](_0x4d2522[_0x56ee('0x2b')]);_0x588355[_0x56ee('0x2d')]=_[_0x56ee('0x2e')](_0x588355[_0x56ee('0x2f')],_0x588355['query']);_0x34fd9b[_0x56ee('0x31')]=_['intersection'](_0x588355['model'],qs[_0x56ee('0x30')](_0x4d2522['query'][_0x56ee('0x30')]));_0x34fd9b['attributes']=_0x34fd9b[_0x56ee('0x31')][_0x56ee('0x32')]?_0x34fd9b['attributes']:_0x588355[_0x56ee('0x2f')];if(_0x4d2522[_0x56ee('0x2b')][_0x56ee('0x3d')]){_0x34fd9b[_0x56ee('0x40')]=[{'all':!![]}];}_0x34fd9b=_['merge']({},_0x34fd9b,_0x4d2522[_0x56ee('0x3b')]);return db[_0x56ee('0x3c')]['find'](_0x34fd9b)['then'](handleEntityNotFound(_0x3ad41f,null))[_0x56ee('0x1f')](respondWithResult(_0x3ad41f,null))[_0x56ee('0x41')](handleError(_0x3ad41f,null));};exports['create']=function(_0x129676,_0x506b6d){return db[_0x56ee('0x3c')][_0x56ee('0x42')](_0x129676[_0x56ee('0x43')],{})['then'](respondWithResult(_0x506b6d,0xc9))[_0x56ee('0x41')](handleError(_0x506b6d,null));};exports['update']=function(_0x43697e,_0x10cbc9){if(_0x43697e['body']['id']){delete _0x43697e[_0x56ee('0x43')]['id'];}return db['SquareRecording'][_0x56ee('0x44')]({'where':{'id':_0x43697e['params']['id']}})[_0x56ee('0x1f')](handleEntityNotFound(_0x10cbc9,null))[_0x56ee('0x1f')](saveUpdates(_0x43697e[_0x56ee('0x43')],null))[_0x56ee('0x1f')](respondWithResult(_0x10cbc9,null))[_0x56ee('0x41')](handleError(_0x10cbc9,null));};exports[_0x56ee('0x45')]=function(_0xca7e90,_0x369f0f,_0x45d0da){var _0x1ec200=require(_0x56ee('0x46'));var _0x3196ff=![];var _0x348779={};if(_0xca7e90['query'][_0x56ee('0x29')]&&_0xca7e90['query'][_0x56ee('0x29')]==='uniqueid'){_0x348779[_0x56ee('0x47')]=_0xca7e90[_0x56ee('0x48')]['id'];}else{_0x348779['id']=_0xca7e90[_0x56ee('0x48')]['id'];}return db['SquareRecording'][_0x56ee('0x44')]({'where':_0x348779,'attributes':['id',_0x56ee('0x49'),_0x56ee('0x4a')],'raw':!![]})[_0x56ee('0x1f')](handleEntityNotFound(_0x369f0f,null))['then'](function(_0x402d31){if(_0x402d31){var _0x1c2a24=_0x402d31[_0x56ee('0x49')];var _0x4ed8fd=util[_0x56ee('0x4b')](_0x56ee('0x4c'),_0x1c2a24);if(fs[_0x56ee('0x4d')](_0x4ed8fd)){_0x3196ff=!![];return _0x1ec200[_0x56ee('0x4e')](_0x4ed8fd,_0x1c2a24,config[_0x56ee('0x4f')]['recording'])[_0x56ee('0x1f')](function(){return _0x402d31;});}return _0x402d31;}})['then'](function(_0x297f9c){if(_0x297f9c){var _0x2a370a=_0x297f9c[_0x56ee('0x49')];if(!fs[_0x56ee('0x4d')](_0x2a370a)){throw new db[(_0x56ee('0x50'))]['ValidationError'](_0x56ee('0x51'));}if(_0x297f9c[_0x56ee('0x4a')]){return _0x369f0f['download'](_0x2a370a,_0x297f9c['filename']+path[_0x56ee('0x52')](_0x2a370a),function(){if(_0x3196ff){fs['unlink'](_0x2a370a);}});}else{return _0x369f0f[_0x56ee('0x45')](_0x2a370a,function(_0x3d1449){if(_0x3196ff){fs[_0x56ee('0x53')](_0x2a370a);}});}}})['catch'](function(_0x57a1c4){if(_0x57a1c4[_0x56ee('0x54')]==='SquareRecording\x20not\x20found'){_0x369f0f['status'](0x194)[_0x56ee('0x25')](_0x56ee('0x55'));}else{return handleError(_0x369f0f,null);}});};exports['destroy']=function(_0x20633e,_0x42b940){return db['SquareRecording'][_0x56ee('0x44')]({'where':{'id':_0x20633e[_0x56ee('0x48')]['id']}})[_0x56ee('0x1f')](function(_0x207d86){if(_[_0x56ee('0x56')](_0x207d86)){throw new ReferenceError(_0x56ee('0x57'));}return _0x207d86;})['then'](function(_0x30f779){var _0x36e501=_0x30f779[_0x56ee('0x49')];logger['info'](_0x56ee('0x58'),_0x36e501);if(!_[_0x56ee('0x56')](_0x30f779[_0x56ee('0x49')])&&fs[_0x56ee('0x4d')](_0x36e501)){logger[_0x56ee('0x59')](_0x56ee('0x5a')+_0x36e501+_0x56ee('0x5b'));fs[_0x56ee('0x5c')](_0x36e501);}_0x36e501=_0x36e501+_0x56ee('0x5d');if(!_[_0x56ee('0x56')](_0x30f779['savePath'])&&fs[_0x56ee('0x4d')](_0x36e501)){logger[_0x56ee('0x59')]('File:\x20\x22'+_0x36e501+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x56ee('0x5c')](_0x36e501);}return _0x30f779;})['then'](function(_0x4dab02){if(!_0x4dab02)throw new InternalError();return _0x4dab02[_0x56ee('0x20')]();})[_0x56ee('0x1f')](function(){_0x42b940['status'](0xcc)[_0x56ee('0x21')]();})['catch'](handleError(_0x42b940,null));}; \ No newline at end of file +var _0xa39c=['Content-Range','apply','reject','save','update','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','where','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','then','rows','catch','keys','length','find','body','params','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','eml-format','rimraf','zip-dir','fast-json-patch','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/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set'];(function(_0x2a0112,_0x436e56){var _0x6a9b10=function(_0x98d869){while(--_0x98d869){_0x2a0112['push'](_0x2a0112['shift']());}};_0x6a9b10(++_0x436e56);}(_0xa39c,0xfa));var _0xca39=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa39c[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xca39('0x0'));var rimraf=require(_0xca39('0x1'));var zipdir=require(_0xca39('0x2'));var jsonpatch=require(_0xca39('0x3'));var rp=require('request-promise');var moment=require(_0xca39('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xca39('0x5'));var util=require(_0xca39('0x6'));var path=require(_0xca39('0x7'));var sox=require(_0xca39('0x8'));var csv=require(_0xca39('0x9'));var ejs=require(_0xca39('0xa'));var fs=require('fs');var fs_extra=require(_0xca39('0xb'));var _=require(_0xca39('0xc'));var squel=require(_0xca39('0xd'));var crypto=require(_0xca39('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xca39('0xf'));var toCsv=require(_0xca39('0x9'));var querystring=require(_0xca39('0x10'));var Papa=require(_0xca39('0x11'));var Redis=require(_0xca39('0x12'));var authService=require(_0xca39('0x13'));var qs=require(_0xca39('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca39('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xca39('0x16'));var config=require(_0xca39('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xca39('0x18'))['db'];function respondWithStatusCode(_0x1b78d6,_0x5a07bc){_0x5a07bc=_0x5a07bc||0xcc;return function(_0x1c4da2){if(_0x1c4da2){return _0x1b78d6[_0xca39('0x19')](_0x5a07bc);}return _0x1b78d6[_0xca39('0x1a')](_0x5a07bc)['end']();};}function respondWithResult(_0x291519,_0xe21464){_0xe21464=_0xe21464||0xc8;return function(_0x4cab72){if(_0x4cab72){return _0x291519['status'](_0xe21464)['json'](_0x4cab72);}};}function respondWithFilteredResult(_0x46d511,_0x3ca22c){return function(_0x5c0bc){if(_0x5c0bc){var _0x5d12bd=typeof _0x3ca22c[_0xca39('0x1b')]===_0xca39('0x1c')&&typeof _0x3ca22c[_0xca39('0x1d')]==='undefined';var _0x112dd0=_0x5c0bc[_0xca39('0x1e')];var _0x16319c=_0x5d12bd?0x0:_0x3ca22c['offset'];var _0x431ba3=_0x5d12bd?_0x5c0bc['count']:_0x3ca22c[_0xca39('0x1b')]+_0x3ca22c['limit'];var _0x3ddaf3;if(_0x431ba3>=_0x112dd0){_0x431ba3=_0x112dd0;_0x3ddaf3=0xc8;}else{_0x3ddaf3=0xce;}_0x46d511[_0xca39('0x1a')](_0x3ddaf3);return _0x46d511[_0xca39('0x1f')](_0xca39('0x20'),_0x16319c+'-'+_0x431ba3+'/'+_0x112dd0)['json'](_0x5c0bc);}return null;};}function patchUpdates(_0x1c4683){return function(_0x2a193c){try{jsonpatch[_0xca39('0x21')](_0x2a193c,_0x1c4683,!![]);}catch(_0x21a488){return BPromise[_0xca39('0x22')](_0x21a488);}return _0x2a193c[_0xca39('0x23')]();};}function saveUpdates(_0xcae756,_0x1c7e55){return function(_0x23a736){if(_0x23a736){return _0x23a736[_0xca39('0x24')](_0xcae756)['then'](function(_0x252afc){return _0x252afc;});}return null;};}function removeEntity(_0x3ad0c3,_0x113e17){return function(_0x3c8032){if(_0x3c8032){return _0x3c8032['destroy']()['then'](function(){_0x3ad0c3[_0xca39('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6e36,_0x35f3f8){return function(_0x5bae7a){if(!_0x5bae7a){_0x5e6e36[_0xca39('0x19')](0x194);}return _0x5bae7a;};}function handleError(_0x5c0b91,_0x3683bf){_0x3683bf=_0x3683bf||0x1f4;return function(_0x51923b){logger[_0xca39('0x25')](_0x51923b[_0xca39('0x26')]);if(_0x51923b[_0xca39('0x27')]){delete _0x51923b[_0xca39('0x27')];}_0x5c0b91[_0xca39('0x1a')](_0x3683bf)['send'](_0x51923b);};}exports[_0xca39('0x28')]=function(_0x4959bc,_0x1e261f){var _0x39bb0b={},_0x516818={},_0x4af274={'count':0x0,'rows':[]};var _0x38c22e=_[_0xca39('0x29')](db['SquareRecording'][_0xca39('0x2a')],function(_0x2d369d){return{'name':_0x2d369d[_0xca39('0x2b')],'type':_0x2d369d[_0xca39('0x2c')][_0xca39('0x2d')]};});_0x516818[_0xca39('0x2e')]=_[_0xca39('0x29')](_0x38c22e,'name');_0x516818[_0xca39('0x2f')]=_['keys'](_0x4959bc[_0xca39('0x2f')]);_0x516818[_0xca39('0x30')]=_[_0xca39('0x31')](_0x516818[_0xca39('0x2e')],_0x516818[_0xca39('0x2f')]);_0x39bb0b['attributes']=_[_0xca39('0x31')](_0x516818[_0xca39('0x2e')],qs[_0xca39('0x32')](_0x4959bc[_0xca39('0x2f')]['fields']));_0x39bb0b[_0xca39('0x33')]=_0x39bb0b['attributes']['length']?_0x39bb0b[_0xca39('0x33')]:_0x516818[_0xca39('0x2e')];if(!_0x4959bc['query']['hasOwnProperty']('nolimit')){_0x39bb0b['limit']=qs[_0xca39('0x1d')](_0x4959bc[_0xca39('0x2f')][_0xca39('0x1d')]);_0x39bb0b['offset']=qs[_0xca39('0x1b')](_0x4959bc[_0xca39('0x2f')][_0xca39('0x1b')]);}_0x39bb0b[_0xca39('0x34')]=qs['sort'](_0x4959bc['query'][_0xca39('0x35')]);_0x39bb0b[_0xca39('0x36')]=qs[_0xca39('0x30')](_['pick'](_0x4959bc['query'],_0x516818['filters']),_0x38c22e);if(_0x4959bc[_0xca39('0x2f')][_0xca39('0x37')]){_0x39bb0b['where']=_[_0xca39('0x38')](_0x39bb0b[_0xca39('0x36')],{'$or':_[_0xca39('0x29')](_0x38c22e,function(_0x323199){if(_0x323199[_0xca39('0x2c')]!==_0xca39('0x39')){var _0x164647={};_0x164647[_0x323199[_0xca39('0x27')]]={'$like':'%'+_0x4959bc[_0xca39('0x2f')]['filter']+'%'};return _0x164647;}})});}_0x39bb0b=_[_0xca39('0x38')]({},_0x39bb0b,_0x4959bc[_0xca39('0x3a')]);var _0x5a25bd={'where':_0x39bb0b[_0xca39('0x36')]};return db[_0xca39('0x3b')][_0xca39('0x1e')](_0x5a25bd)['then'](function(_0x2c47d6){_0x4af274['count']=_0x2c47d6;if(_0x4959bc['query'][_0xca39('0x3c')]){_0x39bb0b[_0xca39('0x3d')]=[{'all':!![]}];}return db[_0xca39('0x3b')][_0xca39('0x3e')](_0x39bb0b);})[_0xca39('0x3f')](function(_0x853a1c){_0x4af274[_0xca39('0x40')]=_0x853a1c;return _0x4af274;})[_0xca39('0x3f')](respondWithFilteredResult(_0x1e261f,_0x39bb0b))[_0xca39('0x41')](handleError(_0x1e261f,null));};exports['show']=function(_0x1f7f5d,_0x5cf298){var _0x51cc3f={'raw':!![],'where':{'id':_0x1f7f5d['params']['id']}},_0x468b98={};_0x468b98[_0xca39('0x2e')]=_[_0xca39('0x42')](db[_0xca39('0x3b')][_0xca39('0x2a')]);_0x468b98[_0xca39('0x2f')]=_[_0xca39('0x42')](_0x1f7f5d[_0xca39('0x2f')]);_0x468b98[_0xca39('0x30')]=_[_0xca39('0x31')](_0x468b98[_0xca39('0x2e')],_0x468b98[_0xca39('0x2f')]);_0x51cc3f[_0xca39('0x33')]=_[_0xca39('0x31')](_0x468b98['model'],qs['fields'](_0x1f7f5d[_0xca39('0x2f')][_0xca39('0x32')]));_0x51cc3f['attributes']=_0x51cc3f[_0xca39('0x33')][_0xca39('0x43')]?_0x51cc3f[_0xca39('0x33')]:_0x468b98[_0xca39('0x2e')];if(_0x1f7f5d[_0xca39('0x2f')][_0xca39('0x3c')]){_0x51cc3f[_0xca39('0x3d')]=[{'all':!![]}];}_0x51cc3f=_[_0xca39('0x38')]({},_0x51cc3f,_0x1f7f5d[_0xca39('0x3a')]);return db[_0xca39('0x3b')][_0xca39('0x44')](_0x51cc3f)[_0xca39('0x3f')](handleEntityNotFound(_0x5cf298,null))['then'](respondWithResult(_0x5cf298,null))[_0xca39('0x41')](handleError(_0x5cf298,null));};exports['create']=function(_0x47f4ef,_0x47b048){return db[_0xca39('0x3b')]['create'](_0x47f4ef[_0xca39('0x45')],{})['then'](respondWithResult(_0x47b048,0xc9))[_0xca39('0x41')](handleError(_0x47b048,null));};exports[_0xca39('0x24')]=function(_0x332ad6,_0x498911){if(_0x332ad6[_0xca39('0x45')]['id']){delete _0x332ad6[_0xca39('0x45')]['id'];}return db[_0xca39('0x3b')][_0xca39('0x44')]({'where':{'id':_0x332ad6[_0xca39('0x46')]['id']}})['then'](handleEntityNotFound(_0x498911,null))[_0xca39('0x3f')](saveUpdates(_0x332ad6['body'],null))[_0xca39('0x3f')](respondWithResult(_0x498911,null))[_0xca39('0x41')](handleError(_0x498911,null));};exports[_0xca39('0x47')]=function(_0xa04d87,_0x1e5ed9,_0x3ee43f){var _0x2e92fa=require(_0xca39('0x48'));var _0x2130d4=![];var _0x1947d8={};if(_0xa04d87[_0xca39('0x2f')]['type']&&_0xa04d87['query'][_0xca39('0x2c')]===_0xca39('0x49')){_0x1947d8[_0xca39('0x49')]=_0xa04d87[_0xca39('0x46')]['id'];}else{_0x1947d8['id']=_0xa04d87[_0xca39('0x46')]['id'];}return db[_0xca39('0x3b')][_0xca39('0x44')]({'where':_0x1947d8,'attributes':['id',_0xca39('0x4a'),_0xca39('0x4b')],'raw':!![]})[_0xca39('0x3f')](handleEntityNotFound(_0x1e5ed9,null))[_0xca39('0x3f')](function(_0x4db58b){if(_0x4db58b){var _0x5555f4=_0x4db58b[_0xca39('0x4a')];var _0x21bc22=util['format'](_0xca39('0x4c'),_0x5555f4);if(fs[_0xca39('0x4d')](_0x21bc22)){_0x2130d4=!![];return _0x2e92fa[_0xca39('0x4e')](_0x21bc22,_0x5555f4,config[_0xca39('0x4f')]['recording'])[_0xca39('0x3f')](function(){return _0x4db58b;});}return _0x4db58b;}})[_0xca39('0x3f')](function(_0x97f986){if(_0x97f986){var _0x2160dc=_0x97f986[_0xca39('0x4a')];if(!fs[_0xca39('0x4d')](_0x2160dc)){throw new db['Sequelize']['ValidationError'](_0xca39('0x50'));}if(_0x97f986['filename']){return _0x1e5ed9[_0xca39('0x47')](_0x2160dc,_0x97f986['filename']+path[_0xca39('0x51')](_0x2160dc),function(){if(_0x2130d4){fs[_0xca39('0x52')](_0x2160dc);}});}else{return _0x1e5ed9[_0xca39('0x47')](_0x2160dc,function(_0x90bab){if(_0x2130d4){fs['unlink'](_0x2160dc);}});}}})[_0xca39('0x41')](function(_0x48dc31){if(_0x48dc31[_0xca39('0x53')]===_0xca39('0x50')){_0x1e5ed9[_0xca39('0x1a')](0x194)['send'](_0xca39('0x54'));}else{return handleError(_0x1e5ed9,null);}});};exports[_0xca39('0x55')]=function(_0x408ec3,_0x58a267){return db['SquareRecording'][_0xca39('0x44')]({'where':{'id':_0x408ec3[_0xca39('0x46')]['id']}})[_0xca39('0x3f')](function(_0x194ca8){if(_[_0xca39('0x56')](_0x194ca8)){throw new ReferenceError(_0xca39('0x57'));}return _0x194ca8;})['then'](function(_0x2763c4){var _0x3b5ac0=_0x2763c4['savePath'];logger[_0xca39('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x3b5ac0);if(!_[_0xca39('0x56')](_0x2763c4['savePath'])&&fs[_0xca39('0x4d')](_0x3b5ac0)){logger[_0xca39('0x58')](_0xca39('0x59')+_0x3b5ac0+_0xca39('0x5a'));fs[_0xca39('0x5b')](_0x3b5ac0);}_0x3b5ac0=_0x3b5ac0+_0xca39('0x5c');if(!_[_0xca39('0x56')](_0x2763c4[_0xca39('0x4a')])&&fs[_0xca39('0x4d')](_0x3b5ac0)){logger['info'](_0xca39('0x59')+_0x3b5ac0+_0xca39('0x5a'));fs[_0xca39('0x5b')](_0x3b5ac0);}return _0x2763c4;})[_0xca39('0x3f')](function(_0x37b69a){if(!_0x37b69a)throw new InternalError();return _0x37b69a[_0xca39('0x55')]();})[_0xca39('0x3f')](function(){_0x58a267[_0xca39('0x1a')](0xcc)[_0xca39('0x5d')]();})[_0xca39('0x41')](handleError(_0x58a267,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 703e50a..f77c68e 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 _0x1b9b=['SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4e717c,_0x50ae70){var _0x117161=function(_0x2843d2){while(--_0x2843d2){_0x4e717c['push'](_0x4e717c['shift']());}};_0x117161(++_0x50ae70);}(_0x1b9b,0x89));var _0xb1b9=function(_0xaa94f6,_0x561d69){_0xaa94f6=_0xaa94f6-0x0;var _0x3b0bc9=_0x1b9b[_0xaa94f6];return _0x3b0bc9;};'use strict';var _=require(_0xb1b9('0x0'));var util=require('util');var logger=require(_0xb1b9('0x1'))(_0xb1b9('0x2'));var moment=require(_0xb1b9('0x3'));var BPromise=require(_0xb1b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1b9('0x5'));var rimraf=require(_0xb1b9('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x442466,_0x334ccf){return _0x442466['define'](_0xb1b9('0x7'),attributes,{'tableName':_0xb1b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e83=['lodash','../../config/logger','api','moment','bluebird','request-promise','exports','define','SquareRecording','square_recordings'];(function(_0x5573a1,_0x17d9a2){var _0x5aea4c=function(_0x59812a){while(--_0x59812a){_0x5573a1['push'](_0x5573a1['shift']());}};_0x5aea4c(++_0x17d9a2);}(_0x4e83,0x1ae));var _0x34e8=function(_0x420f22,_0x16b6ea){_0x420f22=_0x420f22-0x0;var _0x573bc9=_0x4e83[_0x420f22];return _0x573bc9;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var logger=require(_0x34e8('0x1'))(_0x34e8('0x2'));var moment=require(_0x34e8('0x3'));var BPromise=require(_0x34e8('0x4'));var rp=require(_0x34e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x34e8('0x6')]=function(_0x3ec7cb,_0x559726){return _0x3ec7cb[_0x34e8('0x7')](_0x34e8('0x8'),attributes,{'tableName':_0x34e8('0x9'),'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 2f7bb68..29ab2f1 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 _0x858c=['stringify','error','SquareRecording,\x20%s,\x20%s','message','info','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x772734,_0xc3333a){var _0x20ad5f=function(_0x5227f1){while(--_0x5227f1){_0x772734['push'](_0x772734['shift']());}};_0x20ad5f(++_0xc3333a);}(_0x858c,0x100));var _0xc858=function(_0x148840,_0x35771e){_0x148840=_0x148840-0x0;var _0x4be113=_0x858c[_0x148840];return _0x4be113;};'use strict';var _=require('lodash');var util=require(_0xc858('0x0'));var moment=require(_0xc858('0x1'));var BPromise=require(_0xc858('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc858('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc858('0x4'));var logger=require(_0xc858('0x5'))('rpc');var config=require(_0xc858('0x6'));var jayson=require(_0xc858('0x7'));var client=jayson[_0xc858('0x8')][_0xc858('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x398f21,_0x5b7ff5,_0x59efbf){return new BPromise(function(_0x14b74b,_0x3b7300){return client[_0xc858('0xa')](_0x398f21,_0x59efbf)['then'](function(_0x372d68){logger['info']('SquareRecording,\x20%s,\x20%s',_0x5b7ff5,_0xc858('0xb'));logger[_0xc858('0xc')](_0xc858('0xd'),_0x5b7ff5,'request\x20sent',JSON[_0xc858('0xe')](_0x372d68));if(_0x372d68[_0xc858('0xf')]){if(_0x372d68['error']['code']===0x1f4){logger[_0xc858('0xf')](_0xc858('0x10'),_0x5b7ff5,_0x372d68[_0xc858('0xf')]['message']);return _0x3b7300(_0x372d68[_0xc858('0xf')][_0xc858('0x11')]);}logger['error'](_0xc858('0x10'),_0x5b7ff5,_0x372d68[_0xc858('0xf')][_0xc858('0x11')]);return _0x14b74b(_0x372d68[_0xc858('0xf')]['message']);}else{logger[_0xc858('0x12')](_0xc858('0x10'),_0x5b7ff5,_0xc858('0xb'));_0x14b74b(_0x372d68[_0xc858('0x13')][_0xc858('0x11')]);}})[_0xc858('0x14')](function(_0x289431){logger[_0xc858('0xf')](_0xc858('0x10'),_0x5b7ff5,_0x289431);_0x3b7300(_0x289431);});});}exports[_0xc858('0x15')]=function(_0x366dca){var _0x126a17=this;return new Promise(function(_0x27fd58,_0x31c02c){return db[_0xc858('0x16')][_0xc858('0x17')](_0x366dca['body'],{'raw':_0x366dca['options']?_0x366dca[_0xc858('0x18')][_0xc858('0x19')]===undefined?!![]:![]:!![]})[_0xc858('0x1a')](function(_0x5afa64){logger[_0xc858('0x12')]('CreateSquareRecording',_0x366dca);logger['debug'](_0xc858('0x15'),_0x366dca,JSON[_0xc858('0xe')](_0x5afa64));_0x27fd58(_0x5afa64);})[_0xc858('0x14')](function(_0xb1719c){logger[_0xc858('0xf')](_0xc858('0x15'),_0xb1719c[_0xc858('0x11')],_0x366dca);_0x31c02c(_0x126a17[_0xc858('0xf')](0x1f4,_0xb1719c[_0xc858('0x11')]));});});}; \ No newline at end of file +var _0x8466=['catch','SquareRecording','create','body','options','debug','CreateSquareRecording','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x37862a,_0x2bc98e){var _0x5b0104=function(_0x391413){while(--_0x391413){_0x37862a['push'](_0x37862a['shift']());}};_0x5b0104(++_0x2bc98e);}(_0x8466,0xe7));var _0x6846=function(_0x3411a8,_0x1df7a2){_0x3411a8=_0x3411a8-0x0;var _0x1f0056=_0x8466[_0x3411a8];return _0x1f0056;};'use strict';var _=require(_0x6846('0x0'));var util=require(_0x6846('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6846('0x2'));var fs=require('fs');var Redis=require(_0x6846('0x3'));var db=require(_0x6846('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6846('0x5'))(_0x6846('0x6'));var config=require(_0x6846('0x7'));var jayson=require(_0x6846('0x8'));var client=jayson[_0x6846('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13382f,_0x4684ea,_0x38239f){return new BPromise(function(_0x1cb53a,_0x63a89a){return client[_0x6846('0xa')](_0x13382f,_0x38239f)[_0x6846('0xb')](function(_0x343d92){logger['info'](_0x6846('0xc'),_0x4684ea,_0x6846('0xd'));logger['debug'](_0x6846('0xe'),_0x4684ea,'request\x20sent',JSON[_0x6846('0xf')](_0x343d92));if(_0x343d92[_0x6846('0x10')]){if(_0x343d92['error'][_0x6846('0x11')]===0x1f4){logger['error'](_0x6846('0xc'),_0x4684ea,_0x343d92['error']['message']);return _0x63a89a(_0x343d92[_0x6846('0x10')][_0x6846('0x12')]);}logger[_0x6846('0x10')](_0x6846('0xc'),_0x4684ea,_0x343d92[_0x6846('0x10')][_0x6846('0x12')]);return _0x1cb53a(_0x343d92[_0x6846('0x10')][_0x6846('0x12')]);}else{logger[_0x6846('0x13')](_0x6846('0xc'),_0x4684ea,'request\x20sent');_0x1cb53a(_0x343d92[_0x6846('0x14')][_0x6846('0x12')]);}})[_0x6846('0x15')](function(_0x51f2a1){logger[_0x6846('0x10')](_0x6846('0xc'),_0x4684ea,_0x51f2a1);_0x63a89a(_0x51f2a1);});});}exports['CreateSquareRecording']=function(_0x2017e1){var _0x222817=this;return new Promise(function(_0xf66f4d,_0x15dafc){return db[_0x6846('0x16')][_0x6846('0x17')](_0x2017e1[_0x6846('0x18')],{'raw':_0x2017e1[_0x6846('0x19')]?_0x2017e1[_0x6846('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6846('0xb')](function(_0x27b0a2){logger['info']('CreateSquareRecording',_0x2017e1);logger[_0x6846('0x1a')](_0x6846('0x1b'),_0x2017e1,JSON[_0x6846('0xf')](_0x27b0a2));_0xf66f4d(_0x27b0a2);})['catch'](function(_0xc80e5d){logger[_0x6846('0x10')](_0x6846('0x1b'),_0xc80e5d[_0x6846('0x12')],_0x2017e1);_0x15dafc(_0x222817[_0x6846('0x10')](0x1f4,_0xc80e5d[_0x6846('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a3bbd86..b226ae9 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x40d586,_0x4bfce1){var _0x110509=function(_0x15ba2f){while(--_0x15ba2f){_0x40d586['push'](_0x40d586['shift']());}};_0x110509(++_0x4bfce1);}(_0xe706,0xa3));var _0x6e70=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0xe706[_0x77d286];return _0x5446a5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3be5b7,_0x3172c8){var _0x1d8aed=function(_0x236b36){while(--_0x236b36){_0x3be5b7['push'](_0x3be5b7['shift']());}};_0x1d8aed(++_0x3172c8);}(_0xe706,0xa3));var _0x6e70=function(_0x2724ab,_0x4890a8){_0x2724ab=_0x2724ab-0x0;var _0x3e05d8=_0xe706[_0x2724ab];return _0x3e05d8;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 443f2f4..05bae0c 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 _0x6447=['DATE','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6447,0xb5));var _0x7644=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x6447[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require('sequelize');module[_0x7644('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7644('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7644('0x1')]},'uniqueid':{'type':Sequelize[_0x7644('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7644('0x1')]},'callingpres':{'type':Sequelize[_0x7644('0x1')]},'callingani2':{'type':Sequelize[_0x7644('0x1')]},'callington':{'type':Sequelize[_0x7644('0x1')]},'callingtns':{'type':Sequelize[_0x7644('0x1')]},'dnid':{'type':Sequelize[_0x7644('0x1')]},'rdnis':{'type':Sequelize[_0x7644('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7644('0x1')]},'priority':{'type':Sequelize[_0x7644('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x7644('0x1')]},'project_name':{'type':Sequelize[_0x7644('0x1')]},'joinAt':{'type':Sequelize[_0x7644('0x2')]},'leaveAt':{'type':Sequelize[_0x7644('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9306=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x3012c6,_0x515591){var _0xbcae2d=function(_0xf5cd09){while(--_0xf5cd09){_0x3012c6['push'](_0x3012c6['shift']());}};_0xbcae2d(++_0x515591);}(_0x9306,0xf1));var _0x6930=function(_0x30c12e,_0x21bc9c){_0x30c12e=_0x30c12e-0x0;var _0x53d257=_0x9306[_0x30c12e];return _0x53d257;};'use strict';var Sequelize=require(_0x6930('0x0'));module[_0x6930('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x6930('0x2')]},'request':{'type':Sequelize[_0x6930('0x2')]},'channel':{'type':Sequelize[_0x6930('0x2')]},'language':{'type':Sequelize[_0x6930('0x2')]},'type':{'type':Sequelize[_0x6930('0x2')]},'uniqueid':{'type':Sequelize[_0x6930('0x2')]},'version':{'type':Sequelize[_0x6930('0x2')]},'callerid':{'type':Sequelize[_0x6930('0x2')]},'calleridname':{'type':Sequelize[_0x6930('0x2')]},'callingpres':{'type':Sequelize[_0x6930('0x2')]},'callingani2':{'type':Sequelize[_0x6930('0x2')]},'callington':{'type':Sequelize[_0x6930('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6930('0x2')]},'rdnis':{'type':Sequelize[_0x6930('0x2')]},'context':{'type':Sequelize[_0x6930('0x2')]},'extension':{'type':Sequelize[_0x6930('0x2')]},'priority':{'type':Sequelize[_0x6930('0x2')]},'enhanced':{'type':Sequelize[_0x6930('0x2')]},'accountcode':{'type':Sequelize[_0x6930('0x2')]},'threadid':{'type':Sequelize[_0x6930('0x2')]},'project_name':{'type':Sequelize[_0x6930('0x2')]},'joinAt':{'type':Sequelize[_0x6930('0x3')]},'leaveAt':{'type':Sequelize[_0x6930('0x3')]},'bot':{'type':Sequelize[_0x6930('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 480b7ed..686e566 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 _0x040e=['sort','where','filter','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','describe','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','SquareReport','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x040e,0x1b5));var _0xe040=function(_0xf8c44,_0xfddd4c){_0xf8c44=_0xf8c44-0x0;var _0x1b3eb7=_0x040e[_0xf8c44];return _0x1b3eb7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe040('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe040('0x1'));var BPromise=require(_0xe040('0x2'));var Mustache=require(_0xe040('0x3'));var util=require(_0xe040('0x4'));var path=require(_0xe040('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe040('0x6'));var fs=require('fs');var fs_extra=require(_0xe040('0x7'));var _=require(_0xe040('0x8'));var squel=require(_0xe040('0x9'));var crypto=require(_0xe040('0xa'));var jsforce=require(_0xe040('0xb'));var deskjs=require(_0xe040('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe040('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe040('0xe'));var qs=require(_0xe040('0xf'));var as=require(_0xe040('0x10'));var hardwareService=require(_0xe040('0x11'));var logger=require('../../config/logger')(_0xe040('0x12'));var utils=require(_0xe040('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25f570,_0x1996ce){_0x1996ce=_0x1996ce||0xcc;return function(_0x1c0a46){if(_0x1c0a46){return _0x25f570[_0xe040('0x14')](_0x1996ce);}return _0x25f570[_0xe040('0x15')](_0x1996ce)[_0xe040('0x16')]();};}function respondWithResult(_0x51b9ae,_0x1f2541){_0x1f2541=_0x1f2541||0xc8;return function(_0x567e1e){if(_0x567e1e){return _0x51b9ae['status'](_0x1f2541)[_0xe040('0x17')](_0x567e1e);}};}function respondWithFilteredResult(_0x299793,_0x10c8ea){return function(_0x26ad62){if(_0x26ad62){var _0x3fd069=typeof _0x10c8ea[_0xe040('0x18')]==='undefined'&&typeof _0x10c8ea[_0xe040('0x19')]===_0xe040('0x1a');var _0x42f575=_0x26ad62['count'];var _0x442049=_0x3fd069?0x0:_0x10c8ea['offset'];var _0x2ab6f5=_0x3fd069?_0x26ad62[_0xe040('0x1b')]:_0x10c8ea[_0xe040('0x18')]+_0x10c8ea[_0xe040('0x19')];var _0x2f9bb2;if(_0x2ab6f5>=_0x42f575){_0x2ab6f5=_0x42f575;_0x2f9bb2=0xc8;}else{_0x2f9bb2=0xce;}_0x299793[_0xe040('0x15')](_0x2f9bb2);return _0x299793[_0xe040('0x1c')](_0xe040('0x1d'),_0x442049+'-'+_0x2ab6f5+'/'+_0x42f575)['json'](_0x26ad62);}return null;};}function patchUpdates(_0x5c2ae1){return function(_0x10d025){try{jsonpatch[_0xe040('0x1e')](_0x10d025,_0x5c2ae1,!![]);}catch(_0x2fd047){return BPromise[_0xe040('0x1f')](_0x2fd047);}return _0x10d025[_0xe040('0x20')]();};}function saveUpdates(_0x55aabb,_0x11d5b4){return function(_0x5d99a7){if(_0x5d99a7){return _0x5d99a7[_0xe040('0x21')](_0x55aabb)[_0xe040('0x22')](function(_0x52412d){return _0x52412d;});}return null;};}function removeEntity(_0x5a9330,_0x354e4e){return function(_0x43fbc1){if(_0x43fbc1){return _0x43fbc1[_0xe040('0x23')]()[_0xe040('0x22')](function(){_0x5a9330['status'](0xcc)[_0xe040('0x16')]();});}};}function handleEntityNotFound(_0x234a6f,_0x5565da){return function(_0x51ad98){if(!_0x51ad98){_0x234a6f['sendStatus'](0x194);}return _0x51ad98;};}function handleError(_0x4e5d7f,_0x2e46e2){_0x2e46e2=_0x2e46e2||0x1f4;return function(_0x1981db){logger['error'](_0x1981db[_0xe040('0x24')]);if(_0x1981db[_0xe040('0x25')]){delete _0x1981db['name'];}_0x4e5d7f[_0xe040('0x15')](_0x2e46e2)['send'](_0x1981db);};}exports[_0xe040('0x26')]=function(_0x50b9b8,_0x5cd625){var _0x2705f8={},_0x2f4d12={},_0x558841={'count':0x0,'rows':[]};var _0x8eb2d6=_['map'](db[_0xe040('0x27')]['rawAttributes'],function(_0x2fefc0){return{'name':_0x2fefc0[_0xe040('0x28')],'type':_0x2fefc0['type'][_0xe040('0x29')]};});_0x2f4d12[_0xe040('0x2a')]=_[_0xe040('0x2b')](_0x8eb2d6,'name');_0x2f4d12[_0xe040('0x2c')]=_[_0xe040('0x2d')](_0x50b9b8['query']);_0x2f4d12[_0xe040('0x2e')]=_['intersection'](_0x2f4d12[_0xe040('0x2a')],_0x2f4d12[_0xe040('0x2c')]);_0x2705f8[_0xe040('0x2f')]=_[_0xe040('0x30')](_0x2f4d12[_0xe040('0x2a')],qs[_0xe040('0x31')](_0x50b9b8[_0xe040('0x2c')][_0xe040('0x31')]));_0x2705f8['attributes']=_0x2705f8['attributes'][_0xe040('0x32')]?_0x2705f8['attributes']:_0x2f4d12[_0xe040('0x2a')];if(!_0x50b9b8['query'][_0xe040('0x33')](_0xe040('0x34'))){_0x2705f8[_0xe040('0x19')]=qs['limit'](_0x50b9b8[_0xe040('0x2c')][_0xe040('0x19')]);_0x2705f8[_0xe040('0x18')]=qs[_0xe040('0x18')](_0x50b9b8[_0xe040('0x2c')]['offset']);}_0x2705f8['order']=qs[_0xe040('0x35')](_0x50b9b8[_0xe040('0x2c')][_0xe040('0x35')]);_0x2705f8[_0xe040('0x36')]=qs[_0xe040('0x2e')](_['pick'](_0x50b9b8[_0xe040('0x2c')],_0x2f4d12[_0xe040('0x2e')]),_0x8eb2d6);if(_0x50b9b8[_0xe040('0x2c')][_0xe040('0x37')]){_0x2705f8[_0xe040('0x36')]=_['merge'](_0x2705f8[_0xe040('0x36')],{'$or':_[_0xe040('0x2b')](_0x8eb2d6,function(_0xea8f50){if(_0xea8f50[_0xe040('0x38')]!=='VIRTUAL'){var _0xea69fc={};_0xea69fc[_0xea8f50[_0xe040('0x25')]]={'$like':'%'+_0x50b9b8['query'][_0xe040('0x37')]+'%'};return _0xea69fc;}})});}_0x2705f8=_['merge']({},_0x2705f8,_0x50b9b8[_0xe040('0x39')]);var _0x26f2bb={'where':_0x2705f8[_0xe040('0x36')]};return db[_0xe040('0x27')][_0xe040('0x1b')](_0x26f2bb)['then'](function(_0x73241f){_0x558841['count']=_0x73241f;if(_0x50b9b8[_0xe040('0x2c')][_0xe040('0x3a')]){_0x2705f8[_0xe040('0x3b')]=[{'all':!![]}];}return db[_0xe040('0x27')][_0xe040('0x3c')](_0x2705f8);})['then'](function(_0x5f0f7d){_0x558841[_0xe040('0x3d')]=_0x5f0f7d;return _0x558841;})[_0xe040('0x22')](respondWithFilteredResult(_0x5cd625,_0x2705f8))[_0xe040('0x3e')](handleError(_0x5cd625,null));};exports['show']=function(_0x50e32e,_0x16a3b1){var _0x1c7749={'raw':!![],'where':{'id':_0x50e32e[_0xe040('0x3f')]['id']}},_0x18ccdd={};_0x18ccdd[_0xe040('0x2a')]=_[_0xe040('0x2d')](db[_0xe040('0x27')][_0xe040('0x40')]);_0x18ccdd[_0xe040('0x2c')]=_[_0xe040('0x2d')](_0x50e32e[_0xe040('0x2c')]);_0x18ccdd[_0xe040('0x2e')]=_[_0xe040('0x30')](_0x18ccdd['model'],_0x18ccdd['query']);_0x1c7749['attributes']=_[_0xe040('0x30')](_0x18ccdd[_0xe040('0x2a')],qs[_0xe040('0x31')](_0x50e32e[_0xe040('0x2c')][_0xe040('0x31')]));_0x1c7749[_0xe040('0x2f')]=_0x1c7749[_0xe040('0x2f')]['length']?_0x1c7749[_0xe040('0x2f')]:_0x18ccdd[_0xe040('0x2a')];if(_0x50e32e['query']['includeAll']){_0x1c7749[_0xe040('0x3b')]=[{'all':!![]}];}_0x1c7749=_[_0xe040('0x41')]({},_0x1c7749,_0x50e32e[_0xe040('0x39')]);return db[_0xe040('0x27')][_0xe040('0x42')](_0x1c7749)[_0xe040('0x22')](handleEntityNotFound(_0x16a3b1,null))['then'](respondWithResult(_0x16a3b1,null))[_0xe040('0x3e')](handleError(_0x16a3b1,null));};exports['create']=function(_0x274ad4,_0x1b8eff){return db[_0xe040('0x27')][_0xe040('0x43')](_0x274ad4[_0xe040('0x44')],{})['then'](respondWithResult(_0x1b8eff,0xc9))[_0xe040('0x3e')](handleError(_0x1b8eff,null));};exports[_0xe040('0x21')]=function(_0x124d0f,_0x564f78){if(_0x124d0f[_0xe040('0x44')]['id']){delete _0x124d0f['body']['id'];}return db[_0xe040('0x27')][_0xe040('0x42')]({'where':{'id':_0x124d0f[_0xe040('0x3f')]['id']}})[_0xe040('0x22')](handleEntityNotFound(_0x564f78,null))[_0xe040('0x22')](saveUpdates(_0x124d0f[_0xe040('0x44')],null))[_0xe040('0x22')](respondWithResult(_0x564f78,null))[_0xe040('0x3e')](handleError(_0x564f78,null));};exports[_0xe040('0x23')]=function(_0x5904a4,_0x1f88a7){return db['SquareReport'][_0xe040('0x42')]({'where':{'id':_0x5904a4[_0xe040('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1f88a7,null))[_0xe040('0x22')](removeEntity(_0x1f88a7,null))['catch'](handleError(_0x1f88a7,null));};exports['describe']=function(_0x26be54,_0x4b67b9){return db[_0xe040('0x27')][_0xe040('0x45')]()[_0xe040('0x22')](respondWithResult(_0x4b67b9,null))[_0xe040('0x3e')](handleError(_0x4b67b9,null));}; \ No newline at end of file +var _0x5c18=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','params','merge','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','end','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x244548,_0x47db36){var _0x129c0c=function(_0x2577b3){while(--_0x2577b3){_0x244548['push'](_0x244548['shift']());}};_0x129c0c(++_0x47db36);}(_0x5c18,0xf8));var _0x85c1=function(_0x1d7b7f,_0x442104){_0x1d7b7f=_0x1d7b7f-0x0;var _0x3c5cf1=_0x5c18[_0x1d7b7f];return _0x3c5cf1;};'use strict';var emlformat=require(_0x85c1('0x0'));var rimraf=require(_0x85c1('0x1'));var zipdir=require(_0x85c1('0x2'));var jsonpatch=require(_0x85c1('0x3'));var rp=require(_0x85c1('0x4'));var moment=require(_0x85c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x85c1('0x6'));var util=require(_0x85c1('0x7'));var path=require('path');var sox=require(_0x85c1('0x8'));var csv=require(_0x85c1('0x9'));var ejs=require(_0x85c1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85c1('0xb'));var squel=require(_0x85c1('0xc'));var crypto=require(_0x85c1('0xd'));var jsforce=require(_0x85c1('0xe'));var deskjs=require(_0x85c1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x85c1('0x10'));var Redis=require(_0x85c1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x85c1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85c1('0x13'));var logger=require(_0x85c1('0x14'))(_0x85c1('0x15'));var utils=require(_0x85c1('0x16'));var config=require(_0x85c1('0x17'));var licenseUtil=require(_0x85c1('0x18'));var db=require(_0x85c1('0x19'))['db'];function respondWithStatusCode(_0x4d28bf,_0x5c29dd){_0x5c29dd=_0x5c29dd||0xcc;return function(_0x20f130){if(_0x20f130){return _0x4d28bf[_0x85c1('0x1a')](_0x5c29dd);}return _0x4d28bf[_0x85c1('0x1b')](_0x5c29dd)['end']();};}function respondWithResult(_0x7b0bba,_0x15bbca){_0x15bbca=_0x15bbca||0xc8;return function(_0x2db2ee){if(_0x2db2ee){return _0x7b0bba[_0x85c1('0x1b')](_0x15bbca)['json'](_0x2db2ee);}};}function respondWithFilteredResult(_0x525442,_0xc21e6b){return function(_0x4739ed){if(_0x4739ed){var _0xd1baaf=typeof _0xc21e6b[_0x85c1('0x1c')]===_0x85c1('0x1d')&&typeof _0xc21e6b['limit']===_0x85c1('0x1d');var _0x4ed0cd=_0x4739ed[_0x85c1('0x1e')];var _0xb2a47c=_0xd1baaf?0x0:_0xc21e6b['offset'];var _0x5e6f4c=_0xd1baaf?_0x4739ed[_0x85c1('0x1e')]:_0xc21e6b[_0x85c1('0x1c')]+_0xc21e6b[_0x85c1('0x1f')];var _0x457af5;if(_0x5e6f4c>=_0x4ed0cd){_0x5e6f4c=_0x4ed0cd;_0x457af5=0xc8;}else{_0x457af5=0xce;}_0x525442[_0x85c1('0x1b')](_0x457af5);return _0x525442[_0x85c1('0x20')](_0x85c1('0x21'),_0xb2a47c+'-'+_0x5e6f4c+'/'+_0x4ed0cd)[_0x85c1('0x22')](_0x4739ed);}return null;};}function patchUpdates(_0x3abd2a){return function(_0x169332){try{jsonpatch[_0x85c1('0x23')](_0x169332,_0x3abd2a,!![]);}catch(_0x28940f){return BPromise[_0x85c1('0x24')](_0x28940f);}return _0x169332['save']();};}function saveUpdates(_0x33ded5,_0x3ee9fa){return function(_0x38799f){if(_0x38799f){return _0x38799f[_0x85c1('0x25')](_0x33ded5)[_0x85c1('0x26')](function(_0x1b12a3){return _0x1b12a3;});}return null;};}function removeEntity(_0x11cbb2,_0x20e404){return function(_0x1e08cd){if(_0x1e08cd){return _0x1e08cd['destroy']()['then'](function(){_0x11cbb2[_0x85c1('0x1b')](0xcc)[_0x85c1('0x27')]();});}};}function handleEntityNotFound(_0x25b28d,_0x3091f7){return function(_0x1d0e77){if(!_0x1d0e77){_0x25b28d[_0x85c1('0x1a')](0x194);}return _0x1d0e77;};}function handleError(_0x896ae8,_0x28e867){_0x28e867=_0x28e867||0x1f4;return function(_0x35bc46){logger[_0x85c1('0x28')](_0x35bc46['stack']);if(_0x35bc46['name']){delete _0x35bc46[_0x85c1('0x29')];}_0x896ae8[_0x85c1('0x1b')](_0x28e867)[_0x85c1('0x2a')](_0x35bc46);};}exports[_0x85c1('0x2b')]=function(_0x6eab3d,_0x193ad9){var _0x5c07ff={},_0x1f07cb={},_0x1c51d5={'count':0x0,'rows':[]};var _0x346caa=_[_0x85c1('0x2c')](db[_0x85c1('0x2d')][_0x85c1('0x2e')],function(_0x303cd3){return{'name':_0x303cd3[_0x85c1('0x2f')],'type':_0x303cd3[_0x85c1('0x30')][_0x85c1('0x31')]};});_0x1f07cb[_0x85c1('0x32')]=_[_0x85c1('0x2c')](_0x346caa,_0x85c1('0x29'));_0x1f07cb[_0x85c1('0x33')]=_[_0x85c1('0x34')](_0x6eab3d[_0x85c1('0x33')]);_0x1f07cb[_0x85c1('0x35')]=_[_0x85c1('0x36')](_0x1f07cb['model'],_0x1f07cb[_0x85c1('0x33')]);_0x5c07ff[_0x85c1('0x37')]=_[_0x85c1('0x36')](_0x1f07cb[_0x85c1('0x32')],qs[_0x85c1('0x38')](_0x6eab3d['query'][_0x85c1('0x38')]));_0x5c07ff[_0x85c1('0x37')]=_0x5c07ff[_0x85c1('0x37')]['length']?_0x5c07ff['attributes']:_0x1f07cb[_0x85c1('0x32')];if(!_0x6eab3d[_0x85c1('0x33')][_0x85c1('0x39')](_0x85c1('0x3a'))){_0x5c07ff[_0x85c1('0x1f')]=qs[_0x85c1('0x1f')](_0x6eab3d['query'][_0x85c1('0x1f')]);_0x5c07ff['offset']=qs[_0x85c1('0x1c')](_0x6eab3d['query'][_0x85c1('0x1c')]);}_0x5c07ff[_0x85c1('0x3b')]=qs['sort'](_0x6eab3d[_0x85c1('0x33')][_0x85c1('0x3c')]);_0x5c07ff[_0x85c1('0x3d')]=qs['filters'](_[_0x85c1('0x3e')](_0x6eab3d['query'],_0x1f07cb[_0x85c1('0x35')]),_0x346caa);if(_0x6eab3d[_0x85c1('0x33')][_0x85c1('0x3f')]){_0x5c07ff['where']=_['merge'](_0x5c07ff[_0x85c1('0x3d')],{'$or':_[_0x85c1('0x2c')](_0x346caa,function(_0x4447e2){if(_0x4447e2[_0x85c1('0x30')]!==_0x85c1('0x40')){var _0x394b6f={};_0x394b6f[_0x4447e2[_0x85c1('0x29')]]={'$like':'%'+_0x6eab3d[_0x85c1('0x33')][_0x85c1('0x3f')]+'%'};return _0x394b6f;}})});}_0x5c07ff=_['merge']({},_0x5c07ff,_0x6eab3d['options']);var _0x2c2f25={'where':_0x5c07ff['where']};return db[_0x85c1('0x2d')]['count'](_0x2c2f25)['then'](function(_0x328f0c){_0x1c51d5['count']=_0x328f0c;if(_0x6eab3d['query'][_0x85c1('0x41')]){_0x5c07ff[_0x85c1('0x42')]=[{'all':!![]}];}return db[_0x85c1('0x2d')][_0x85c1('0x43')](_0x5c07ff);})[_0x85c1('0x26')](function(_0x35678b){_0x1c51d5[_0x85c1('0x44')]=_0x35678b;return _0x1c51d5;})[_0x85c1('0x26')](respondWithFilteredResult(_0x193ad9,_0x5c07ff))[_0x85c1('0x45')](handleError(_0x193ad9,null));};exports['show']=function(_0x54522c,_0x35ea3e){var _0x48de4b={'raw':!![],'where':{'id':_0x54522c[_0x85c1('0x46')]['id']}},_0x165ec2={};_0x165ec2[_0x85c1('0x32')]=_[_0x85c1('0x34')](db['SquareReport'][_0x85c1('0x2e')]);_0x165ec2['query']=_[_0x85c1('0x34')](_0x54522c[_0x85c1('0x33')]);_0x165ec2[_0x85c1('0x35')]=_[_0x85c1('0x36')](_0x165ec2[_0x85c1('0x32')],_0x165ec2['query']);_0x48de4b['attributes']=_[_0x85c1('0x36')](_0x165ec2['model'],qs['fields'](_0x54522c[_0x85c1('0x33')]['fields']));_0x48de4b[_0x85c1('0x37')]=_0x48de4b[_0x85c1('0x37')]['length']?_0x48de4b[_0x85c1('0x37')]:_0x165ec2['model'];if(_0x54522c['query'][_0x85c1('0x41')]){_0x48de4b[_0x85c1('0x42')]=[{'all':!![]}];}_0x48de4b=_[_0x85c1('0x47')]({},_0x48de4b,_0x54522c['options']);return db[_0x85c1('0x2d')]['find'](_0x48de4b)[_0x85c1('0x26')](handleEntityNotFound(_0x35ea3e,null))['then'](respondWithResult(_0x35ea3e,null))['catch'](handleError(_0x35ea3e,null));};exports[_0x85c1('0x48')]=function(_0x266c49,_0x430e1b){return db[_0x85c1('0x2d')][_0x85c1('0x48')](_0x266c49[_0x85c1('0x49')],{})[_0x85c1('0x26')](respondWithResult(_0x430e1b,0xc9))[_0x85c1('0x45')](handleError(_0x430e1b,null));};exports[_0x85c1('0x25')]=function(_0x448772,_0x18b076){if(_0x448772['body']['id']){delete _0x448772[_0x85c1('0x49')]['id'];}return db[_0x85c1('0x2d')][_0x85c1('0x4a')]({'where':{'id':_0x448772[_0x85c1('0x46')]['id']}})[_0x85c1('0x26')](handleEntityNotFound(_0x18b076,null))[_0x85c1('0x26')](saveUpdates(_0x448772[_0x85c1('0x49')],null))[_0x85c1('0x26')](respondWithResult(_0x18b076,null))[_0x85c1('0x45')](handleError(_0x18b076,null));};exports['destroy']=function(_0x3c2026,_0xc60e37){return db[_0x85c1('0x2d')]['find']({'where':{'id':_0x3c2026['params']['id']}})[_0x85c1('0x26')](handleEntityNotFound(_0xc60e37,null))[_0x85c1('0x26')](removeEntity(_0xc60e37,null))[_0x85c1('0x45')](handleError(_0xc60e37,null));};exports[_0x85c1('0x4b')]=function(_0x41a9b0,_0x1bceb5){return db[_0x85c1('0x2d')][_0x85c1('0x4b')]()[_0x85c1('0x26')](respondWithResult(_0x1bceb5,null))[_0x85c1('0x45')](handleError(_0x1bceb5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 627579c..3302e09 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 _0x3ea1=['util','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uniqueid','project_name','leaveAt','lodash'];(function(_0x2c63ac,_0x1df97a){var _0xdf3040=function(_0x4c8f63){while(--_0x4c8f63){_0x2c63ac['push'](_0x2c63ac['shift']());}};_0xdf3040(++_0x1df97a);}(_0x3ea1,0x176));var _0x13ea=function(_0x35b353,_0x22d8c0){_0x35b353=_0x35b353-0x0;var _0x5436a6=_0x3ea1[_0x35b353];return _0x5436a6;};'use strict';var _=require(_0x13ea('0x0'));var util=require(_0x13ea('0x1'));var logger=require('../../config/logger')(_0x13ea('0x2'));var moment=require(_0x13ea('0x3'));var BPromise=require(_0x13ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13ea('0x5'));var rimraf=require(_0x13ea('0x6'));var config=require(_0x13ea('0x7'));var attributes=require(_0x13ea('0x8'));module[_0x13ea('0x9')]=function(_0x228c17,_0x41eeea){return _0x228c17[_0x13ea('0xa')]('SquareReport',attributes,{'tableName':_0x13ea('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x13ea('0xc'),_0x13ea('0xd')]},{'name':_0x13ea('0xe'),'fields':[_0x13ea('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02e5=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x50d49d,_0x18db51){var _0x48e107=function(_0xc35a8d){while(--_0xc35a8d){_0x50d49d['push'](_0x50d49d['shift']());}};_0x48e107(++_0x18db51);}(_0x02e5,0x132));var _0x502e=function(_0x122d3f,_0x260324){_0x122d3f=_0x122d3f-0x0;var _0x4b662a=_0x02e5[_0x122d3f];return _0x4b662a;};'use strict';var _=require(_0x502e('0x0'));var util=require(_0x502e('0x1'));var logger=require(_0x502e('0x2'))('api');var moment=require(_0x502e('0x3'));var BPromise=require(_0x502e('0x4'));var rp=require(_0x502e('0x5'));var fs=require('fs');var path=require(_0x502e('0x6'));var rimraf=require(_0x502e('0x7'));var config=require(_0x502e('0x8'));var attributes=require(_0x502e('0x9'));module[_0x502e('0xa')]=function(_0x96e2c,_0x302e2c){return _0x96e2c[_0x502e('0xb')](_0x502e('0xc'),attributes,{'tableName':_0x502e('0xd'),'paranoid':![],'indexes':[{'name':_0x502e('0xe'),'fields':[_0x502e('0xf'),_0x502e('0x10')]},{'name':_0x502e('0x11'),'fields':[_0x502e('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 1e41313..39d0bda 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 _0x0360=['../../config/logger','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareReport','options','raw','stringify','UpdateSquareReport','where','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x567c4d,_0x5a605d){var _0x53d894=function(_0x5775ad){while(--_0x5775ad){_0x567c4d['push'](_0x567c4d['shift']());}};_0x53d894(++_0x5a605d);}(_0x0360,0xda));var _0x0036=function(_0x51a032,_0x43ab93){_0x51a032=_0x51a032-0x0;var _0x59b1f0=_0x0360[_0x51a032];return _0x59b1f0;};'use strict';var _=require('lodash');var util=require(_0x0036('0x0'));var moment=require(_0x0036('0x1'));var BPromise=require(_0x0036('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0036('0x3'));var db=require(_0x0036('0x4'))['db'];var utils=require(_0x0036('0x5'));var logger=require(_0x0036('0x6'))('rpc');var config=require(_0x0036('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0036('0x8')][_0x0036('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f1cf6,_0x5ee804,_0x426426){return new BPromise(function(_0x58d8ac,_0xefa7df){return client[_0x0036('0xa')](_0x5f1cf6,_0x426426)[_0x0036('0xb')](function(_0x3042cb){logger[_0x0036('0xc')](_0x0036('0xd'),_0x5ee804,_0x0036('0xe'));logger[_0x0036('0xf')](_0x0036('0x10'),_0x5ee804,'request\x20sent',JSON['stringify'](_0x3042cb));if(_0x3042cb[_0x0036('0x11')]){if(_0x3042cb[_0x0036('0x11')]['code']===0x1f4){logger[_0x0036('0x11')](_0x0036('0xd'),_0x5ee804,_0x3042cb['error'][_0x0036('0x12')]);return _0xefa7df(_0x3042cb[_0x0036('0x11')][_0x0036('0x12')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x5ee804,_0x3042cb[_0x0036('0x11')][_0x0036('0x12')]);return _0x58d8ac(_0x3042cb[_0x0036('0x11')][_0x0036('0x12')]);}else{logger[_0x0036('0xc')]('SquareReport,\x20%s,\x20%s',_0x5ee804,_0x0036('0xe'));_0x58d8ac(_0x3042cb[_0x0036('0x13')][_0x0036('0x12')]);}})[_0x0036('0x14')](function(_0x4b90a7){logger[_0x0036('0x11')]('SquareReport,\x20%s,\x20%s',_0x5ee804,_0x4b90a7);_0xefa7df(_0x4b90a7);});});}exports[_0x0036('0x15')]=function(_0x416fe3){var _0x1723d3=this;return new Promise(function(_0x413d95,_0x6032aa){return db['SquareReport']['create'](_0x416fe3['body'],{'raw':_0x416fe3[_0x0036('0x16')]?_0x416fe3[_0x0036('0x16')][_0x0036('0x17')]===undefined?!![]:![]:!![]})[_0x0036('0xb')](function(_0x3e1dff){logger[_0x0036('0xc')](_0x0036('0x15'),_0x416fe3);logger[_0x0036('0xf')](_0x0036('0x15'),_0x416fe3,JSON[_0x0036('0x18')](_0x3e1dff));_0x413d95(_0x3e1dff);})[_0x0036('0x14')](function(_0x4f4190){logger[_0x0036('0x11')]('CreateSquareReport',_0x4f4190[_0x0036('0x12')],_0x416fe3);_0x6032aa(_0x1723d3[_0x0036('0x11')](0x1f4,_0x4f4190[_0x0036('0x12')]));});});};exports[_0x0036('0x19')]=function(_0x291101){var _0x425cc0=this;return new Promise(function(_0x1e3599,_0x35c8f8){return db['SquareReport']['update'](_0x291101['body'],{'raw':_0x291101['options']?_0x291101['options'][_0x0036('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291101[_0x0036('0x16')]?_0x291101[_0x0036('0x16')][_0x0036('0x1a')]||null:null,'attributes':_0x291101[_0x0036('0x16')]?_0x291101['options']['attributes']||null:null,'limit':_0x291101['options']?_0x291101[_0x0036('0x16')][_0x0036('0x1b')]||null:null})[_0x0036('0xb')](function(_0x3d3f90){logger[_0x0036('0xc')](_0x0036('0x19'),_0x291101);logger[_0x0036('0xf')](_0x0036('0x19'),_0x291101,JSON[_0x0036('0x18')](_0x3d3f90));_0x1e3599(_0x3d3f90);})[_0x0036('0x14')](function(_0x28a524){logger[_0x0036('0x11')](_0x0036('0x19'),_0x28a524['message'],_0x291101);_0x35c8f8(_0x425cc0[_0x0036('0x11')](0x1f4,_0x28a524[_0x0036('0x12')]));});});}; \ No newline at end of file +var _0xc69e=['error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch','SquareReport','create','body','options','CreateSquareReport','debug','where','attributes','then','UpdateSquareReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request\x20sent','stringify'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc69e,0x1a7));var _0xec69=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc69e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xec69('0x0'));var util=require(_0xec69('0x1'));var moment=require(_0xec69('0x2'));var BPromise=require('bluebird');var rs=require(_0xec69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec69('0x4'))['db'];var utils=require(_0xec69('0x5'));var logger=require(_0xec69('0x6'))('rpc');var config=require(_0xec69('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xec69('0x8')][_0xec69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8ba7f,_0x2f31d6,_0x5c3869){return new BPromise(function(_0x111e09,_0x593258){return client['request'](_0x8ba7f,_0x5c3869)['then'](function(_0x26eb15){logger['info']('SquareReport,\x20%s,\x20%s',_0x2f31d6,_0xec69('0xa'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x2f31d6,_0xec69('0xa'),JSON[_0xec69('0xb')](_0x26eb15));if(_0x26eb15[_0xec69('0xc')]){if(_0x26eb15[_0xec69('0xc')][_0xec69('0xd')]===0x1f4){logger['error'](_0xec69('0xe'),_0x2f31d6,_0x26eb15[_0xec69('0xc')][_0xec69('0xf')]);return _0x593258(_0x26eb15[_0xec69('0xc')][_0xec69('0xf')]);}logger[_0xec69('0xc')](_0xec69('0xe'),_0x2f31d6,_0x26eb15[_0xec69('0xc')][_0xec69('0xf')]);return _0x111e09(_0x26eb15['error'][_0xec69('0xf')]);}else{logger[_0xec69('0x10')](_0xec69('0xe'),_0x2f31d6,'request\x20sent');_0x111e09(_0x26eb15[_0xec69('0x11')][_0xec69('0xf')]);}})[_0xec69('0x12')](function(_0x28a713){logger['error'](_0xec69('0xe'),_0x2f31d6,_0x28a713);_0x593258(_0x28a713);});});}exports['CreateSquareReport']=function(_0xec603c){var _0x56c22a=this;return new Promise(function(_0x52d006,_0x4306fc){return db[_0xec69('0x13')][_0xec69('0x14')](_0xec603c[_0xec69('0x15')],{'raw':_0xec603c[_0xec69('0x16')]?_0xec603c[_0xec69('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b948d){logger[_0xec69('0x10')](_0xec69('0x17'),_0xec603c);logger[_0xec69('0x18')]('CreateSquareReport',_0xec603c,JSON[_0xec69('0xb')](_0x4b948d));_0x52d006(_0x4b948d);})['catch'](function(_0x15cec5){logger[_0xec69('0xc')](_0xec69('0x17'),_0x15cec5['message'],_0xec603c);_0x4306fc(_0x56c22a['error'](0x1f4,_0x15cec5[_0xec69('0xf')]));});});};exports['UpdateSquareReport']=function(_0x6db816){var _0x5c7fc0=this;return new Promise(function(_0x51e264,_0x2975f0){return db[_0xec69('0x13')]['update'](_0x6db816[_0xec69('0x15')],{'raw':_0x6db816[_0xec69('0x16')]?_0x6db816[_0xec69('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6db816[_0xec69('0x16')]?_0x6db816[_0xec69('0x16')][_0xec69('0x19')]||null:null,'attributes':_0x6db816[_0xec69('0x16')]?_0x6db816['options'][_0xec69('0x1a')]||null:null,'limit':_0x6db816['options']?_0x6db816[_0xec69('0x16')]['limit']||null:null})[_0xec69('0x1b')](function(_0x5a3d14){logger[_0xec69('0x10')](_0xec69('0x1c'),_0x6db816);logger[_0xec69('0x18')](_0xec69('0x1c'),_0x6db816,JSON[_0xec69('0xb')](_0x5a3d14));_0x51e264(_0x5a3d14);})[_0xec69('0x12')](function(_0x38c43e){logger[_0xec69('0xc')]('UpdateSquareReport',_0x38c43e[_0xec69('0xf')],_0x6db816);_0x2975f0(_0x5c7fc0[_0xec69('0xc')](0x1f4,_0x38c43e[_0xec69('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a40b61a..e737443 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 _0x54cd=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','destroy','exports','util'];(function(_0x302d33,_0x47eba8){var _0x4e46ac=function(_0x5e1256){while(--_0x5e1256){_0x302d33['push'](_0x302d33['shift']());}};_0x4e46ac(++_0x47eba8);}(_0x54cd,0xe3));var _0xd54c=function(_0x32226d,_0x5607c2){_0x32226d=_0x32226d-0x0;var _0x488a33=_0x54cd[_0x32226d];return _0x488a33;};'use strict';var multer=require('multer');var util=require(_0xd54c('0x0'));var path=require(_0xd54c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd54c('0x2')]();var fs_extra=require(_0xd54c('0x3'));var auth=require(_0xd54c('0x4'));var interaction=require(_0xd54c('0x5'));var config=require(_0xd54c('0x6'));var controller=require(_0xd54c('0x7'));router[_0xd54c('0x8')]('/',auth[_0xd54c('0x9')](),controller[_0xd54c('0xa')]);router[_0xd54c('0x8')](_0xd54c('0xb'),auth['isAuthenticated'](),controller[_0xd54c('0xc')]);router[_0xd54c('0x8')](_0xd54c('0xd'),auth[_0xd54c('0x9')](),controller['show']);router[_0xd54c('0xe')]('/',auth[_0xd54c('0x9')](),controller['create']);router[_0xd54c('0xf')](_0xd54c('0xd'),auth[_0xd54c('0x9')](),controller[_0xd54c('0x10')]);router['delete'](_0xd54c('0xd'),auth[_0xd54c('0x9')](),controller[_0xd54c('0x11')]);module[_0xd54c('0x12')]=router; \ No newline at end of file +var _0xe5f0=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','create','put'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xe5f0,0x124));var _0x0e5f=function(_0x5aeeb7,_0x3e8055){_0x5aeeb7=_0x5aeeb7-0x0;var _0x3a274a=_0xe5f0[_0x5aeeb7];return _0x3a274a;};'use strict';var multer=require(_0x0e5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e5f('0x1'));var express=require(_0x0e5f('0x2'));var router=express[_0x0e5f('0x3')]();var fs_extra=require(_0x0e5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e5f('0x5'));var config=require(_0x0e5f('0x6'));var controller=require('./squareReportDetail.controller');router[_0x0e5f('0x7')]('/',auth[_0x0e5f('0x8')](),controller[_0x0e5f('0x9')]);router[_0x0e5f('0x7')]('/describe',auth[_0x0e5f('0x8')](),controller[_0x0e5f('0xa')]);router['get'](_0x0e5f('0xb'),auth[_0x0e5f('0x8')](),controller['show']);router['post']('/',auth[_0x0e5f('0x8')](),controller[_0x0e5f('0xc')]);router[_0x0e5f('0xd')]('/:id',auth[_0x0e5f('0x8')](),controller[_0x0e5f('0xe')]);router[_0x0e5f('0xf')]('/:id',auth[_0x0e5f('0x8')](),controller[_0x0e5f('0x10')]);module[_0x0e5f('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c7b4bb5..3f9ba7e 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 _0x1526=['exports','STRING','TEXT'];(function(_0xe271e9,_0x5c1f99){var _0x462c95=function(_0x2ba68f){while(--_0x2ba68f){_0xe271e9['push'](_0xe271e9['shift']());}};_0x462c95(++_0x5c1f99);}(_0x1526,0x10b));var _0x6152=function(_0x8d659b,_0x250e94){_0x8d659b=_0x8d659b-0x0;var _0x2c9720=_0x1526[_0x8d659b];return _0x2c9720;};'use strict';var Sequelize=require('sequelize');module[_0x6152('0x0')]={'uniqueid':{'type':Sequelize[_0x6152('0x1')]},'node':{'type':Sequelize[_0x6152('0x1')]},'application':{'type':Sequelize[_0x6152('0x1')]},'data':{'type':Sequelize[_0x6152('0x2')]},'project_name':{'type':Sequelize[_0x6152('0x1')]},'callerid':{'type':Sequelize[_0x6152('0x1')]}}; \ No newline at end of file +var _0x1b40=['TEXT','sequelize','exports','STRING'];(function(_0x586cff,_0xf99df9){var _0x5967f4=function(_0x3bc9bc){while(--_0x3bc9bc){_0x586cff['push'](_0x586cff['shift']());}};_0x5967f4(++_0xf99df9);}(_0x1b40,0x111));var _0x01b4=function(_0x203271,_0x542139){_0x203271=_0x203271-0x0;var _0x37b0dd=_0x1b40[_0x203271];return _0x37b0dd;};'use strict';var Sequelize=require(_0x01b4('0x0'));module[_0x01b4('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x01b4('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x01b4('0x3')]},'project_name':{'type':Sequelize[_0x01b4('0x2')]},'callerid':{'type':Sequelize[_0x01b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 49a65d4..1c2ea3a 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 _0x692a=['sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','catch','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','status','error','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x20187f,_0xbf67c9){var _0x398db5=function(_0x3b7ac2){while(--_0x3b7ac2){_0x20187f['push'](_0x20187f['shift']());}};_0x398db5(++_0xbf67c9);}(_0x692a,0xf0));var _0xa692=function(_0x3f46d4,_0x124c37){_0x3f46d4=_0x3f46d4-0x0;var _0x26c60b=_0x692a[_0x3f46d4];return _0x26c60b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa692('0x0'));var jsonpatch=require(_0xa692('0x1'));var rp=require('request-promise');var moment=require(_0xa692('0x2'));var BPromise=require(_0xa692('0x3'));var Mustache=require('mustache');var util=require(_0xa692('0x4'));var path=require(_0xa692('0x5'));var sox=require('sox');var csv=require(_0xa692('0x6'));var ejs=require(_0xa692('0x7'));var fs=require('fs');var fs_extra=require(_0xa692('0x8'));var _=require('lodash');var squel=require(_0xa692('0x9'));var crypto=require(_0xa692('0xa'));var jsforce=require(_0xa692('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa692('0x6'));var querystring=require(_0xa692('0xc'));var Papa=require(_0xa692('0xd'));var Redis=require(_0xa692('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa692('0xf'));var as=require(_0xa692('0x10'));var hardwareService=require(_0xa692('0x11'));var logger=require(_0xa692('0x12'))(_0xa692('0x13'));var utils=require(_0xa692('0x14'));var config=require(_0xa692('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa692('0x16'))['db'];function respondWithStatusCode(_0x561e75,_0x286c23){_0x286c23=_0x286c23||0xcc;return function(_0x541aad){if(_0x541aad){return _0x561e75[_0xa692('0x17')](_0x286c23);}return _0x561e75['status'](_0x286c23)[_0xa692('0x18')]();};}function respondWithResult(_0x350be8,_0x221e59){_0x221e59=_0x221e59||0xc8;return function(_0x2e6d72){if(_0x2e6d72){return _0x350be8['status'](_0x221e59)[_0xa692('0x19')](_0x2e6d72);}};}function respondWithFilteredResult(_0x269677,_0x59ba39){return function(_0x28626f){if(_0x28626f){var _0x450719=typeof _0x59ba39[_0xa692('0x1a')]===_0xa692('0x1b')&&typeof _0x59ba39[_0xa692('0x1c')]===_0xa692('0x1b');var _0x28e23c=_0x28626f['count'];var _0x579703=_0x450719?0x0:_0x59ba39[_0xa692('0x1a')];var _0x85a74b=_0x450719?_0x28626f[_0xa692('0x1d')]:_0x59ba39['offset']+_0x59ba39[_0xa692('0x1c')];var _0x25db02;if(_0x85a74b>=_0x28e23c){_0x85a74b=_0x28e23c;_0x25db02=0xc8;}else{_0x25db02=0xce;}_0x269677['status'](_0x25db02);return _0x269677[_0xa692('0x1e')](_0xa692('0x1f'),_0x579703+'-'+_0x85a74b+'/'+_0x28e23c)[_0xa692('0x19')](_0x28626f);}return null;};}function patchUpdates(_0x909916){return function(_0x416b4d){try{jsonpatch[_0xa692('0x20')](_0x416b4d,_0x909916,!![]);}catch(_0x2bf9ee){return BPromise['reject'](_0x2bf9ee);}return _0x416b4d[_0xa692('0x21')]();};}function saveUpdates(_0x57ba3e,_0xfb8c11){return function(_0x120f65){if(_0x120f65){return _0x120f65[_0xa692('0x22')](_0x57ba3e)[_0xa692('0x23')](function(_0x1dc0f7){return _0x1dc0f7;});}return null;};}function removeEntity(_0x2f795f,_0x38f21c){return function(_0xe3a116){if(_0xe3a116){return _0xe3a116[_0xa692('0x24')]()[_0xa692('0x23')](function(){_0x2f795f[_0xa692('0x25')](0xcc)[_0xa692('0x18')]();});}};}function handleEntityNotFound(_0x24f1c5,_0x26d5fc){return function(_0x7f65ea){if(!_0x7f65ea){_0x24f1c5[_0xa692('0x17')](0x194);}return _0x7f65ea;};}function handleError(_0x46a3a4,_0x5d9689){_0x5d9689=_0x5d9689||0x1f4;return function(_0x581936){logger[_0xa692('0x26')](_0x581936['stack']);if(_0x581936[_0xa692('0x27')]){delete _0x581936[_0xa692('0x27')];}_0x46a3a4[_0xa692('0x25')](_0x5d9689)[_0xa692('0x28')](_0x581936);};}exports[_0xa692('0x29')]=function(_0x1e324c,_0x85c37e){var _0x2f11fa={},_0x10d5a5={},_0x4365e7={'count':0x0,'rows':[]};var _0x87928d=_[_0xa692('0x2a')](db[_0xa692('0x2b')]['rawAttributes'],function(_0x492cbc){return{'name':_0x492cbc[_0xa692('0x2c')],'type':_0x492cbc[_0xa692('0x2d')][_0xa692('0x2e')]};});_0x10d5a5[_0xa692('0x2f')]=_[_0xa692('0x2a')](_0x87928d,'name');_0x10d5a5[_0xa692('0x30')]=_['keys'](_0x1e324c['query']);_0x10d5a5[_0xa692('0x31')]=_[_0xa692('0x32')](_0x10d5a5[_0xa692('0x2f')],_0x10d5a5['query']);_0x2f11fa[_0xa692('0x33')]=_['intersection'](_0x10d5a5[_0xa692('0x2f')],qs[_0xa692('0x34')](_0x1e324c[_0xa692('0x30')]['fields']));_0x2f11fa[_0xa692('0x33')]=_0x2f11fa[_0xa692('0x33')][_0xa692('0x35')]?_0x2f11fa[_0xa692('0x33')]:_0x10d5a5[_0xa692('0x2f')];if(!_0x1e324c['query']['hasOwnProperty'](_0xa692('0x36'))){_0x2f11fa[_0xa692('0x1c')]=qs[_0xa692('0x1c')](_0x1e324c[_0xa692('0x30')][_0xa692('0x1c')]);_0x2f11fa['offset']=qs['offset'](_0x1e324c[_0xa692('0x30')]['offset']);}_0x2f11fa[_0xa692('0x37')]=qs['sort'](_0x1e324c[_0xa692('0x30')][_0xa692('0x38')]);_0x2f11fa[_0xa692('0x39')]=qs[_0xa692('0x31')](_[_0xa692('0x3a')](_0x1e324c[_0xa692('0x30')],_0x10d5a5[_0xa692('0x31')]),_0x87928d);if(_0x1e324c['query'][_0xa692('0x3b')]){_0x2f11fa[_0xa692('0x39')]=_[_0xa692('0x3c')](_0x2f11fa[_0xa692('0x39')],{'$or':_[_0xa692('0x2a')](_0x87928d,function(_0x4a0e12){if(_0x4a0e12[_0xa692('0x2d')]!=='VIRTUAL'){var _0x5ab4cf={};_0x5ab4cf[_0x4a0e12[_0xa692('0x27')]]={'$like':'%'+_0x1e324c['query'][_0xa692('0x3b')]+'%'};return _0x5ab4cf;}})});}_0x2f11fa=_[_0xa692('0x3c')]({},_0x2f11fa,_0x1e324c[_0xa692('0x3d')]);var _0x4c62ae={'where':_0x2f11fa['where']};return db['SquareDetailsReport'][_0xa692('0x1d')](_0x4c62ae)[_0xa692('0x23')](function(_0x51f12d){_0x4365e7[_0xa692('0x1d')]=_0x51f12d;if(_0x1e324c[_0xa692('0x30')][_0xa692('0x3e')]){_0x2f11fa[_0xa692('0x3f')]=[{'all':!![]}];}return db[_0xa692('0x2b')][_0xa692('0x40')](_0x2f11fa);})['then'](function(_0x5b1b7b){_0x4365e7['rows']=_0x5b1b7b;return _0x4365e7;})['then'](respondWithFilteredResult(_0x85c37e,_0x2f11fa))['catch'](handleError(_0x85c37e,null));};exports[_0xa692('0x41')]=function(_0x283d3c,_0x57b311){var _0x4f0762={'raw':!![],'where':{'id':_0x283d3c[_0xa692('0x42')]['id']}},_0x4e0d8b={};_0x4e0d8b[_0xa692('0x2f')]=_[_0xa692('0x43')](db[_0xa692('0x2b')][_0xa692('0x44')]);_0x4e0d8b[_0xa692('0x30')]=_['keys'](_0x283d3c['query']);_0x4e0d8b[_0xa692('0x31')]=_[_0xa692('0x32')](_0x4e0d8b['model'],_0x4e0d8b['query']);_0x4f0762[_0xa692('0x33')]=_['intersection'](_0x4e0d8b[_0xa692('0x2f')],qs['fields'](_0x283d3c['query'][_0xa692('0x34')]));_0x4f0762[_0xa692('0x33')]=_0x4f0762[_0xa692('0x33')][_0xa692('0x35')]?_0x4f0762[_0xa692('0x33')]:_0x4e0d8b['model'];if(_0x283d3c[_0xa692('0x30')]['includeAll']){_0x4f0762[_0xa692('0x3f')]=[{'all':!![]}];}_0x4f0762=_['merge']({},_0x4f0762,_0x283d3c[_0xa692('0x3d')]);return db[_0xa692('0x2b')][_0xa692('0x45')](_0x4f0762)[_0xa692('0x23')](handleEntityNotFound(_0x57b311,null))[_0xa692('0x23')](respondWithResult(_0x57b311,null))[_0xa692('0x46')](handleError(_0x57b311,null));};exports[_0xa692('0x47')]=function(_0x791c75,_0x317be4){return db[_0xa692('0x2b')][_0xa692('0x47')](_0x791c75[_0xa692('0x48')],{})[_0xa692('0x23')](respondWithResult(_0x317be4,0xc9))['catch'](handleError(_0x317be4,null));};exports[_0xa692('0x22')]=function(_0x155fd6,_0x4f9345){if(_0x155fd6[_0xa692('0x48')]['id']){delete _0x155fd6[_0xa692('0x48')]['id'];}return db[_0xa692('0x2b')][_0xa692('0x45')]({'where':{'id':_0x155fd6[_0xa692('0x42')]['id']}})[_0xa692('0x23')](handleEntityNotFound(_0x4f9345,null))[_0xa692('0x23')](saveUpdates(_0x155fd6['body'],null))[_0xa692('0x23')](respondWithResult(_0x4f9345,null))['catch'](handleError(_0x4f9345,null));};exports[_0xa692('0x24')]=function(_0x206884,_0x144203){return db['SquareDetailsReport'][_0xa692('0x45')]({'where':{'id':_0x206884[_0xa692('0x42')]['id']}})['then'](handleEntityNotFound(_0x144203,null))[_0xa692('0x23')](removeEntity(_0x144203,null))[_0xa692('0x46')](handleError(_0x144203,null));};exports[_0xa692('0x49')]=function(_0x587722,_0x36eb3d){return db[_0xa692('0x2b')][_0xa692('0x49')]()[_0xa692('0x23')](respondWithResult(_0x36eb3d,null))[_0xa692('0x46')](handleError(_0x36eb3d,null));}; \ No newline at end of file +var _0x1a08=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x55ffdb,_0x4e6ef1){var _0x5dfa2b=function(_0x4010d1){while(--_0x4010d1){_0x55ffdb['push'](_0x55ffdb['shift']());}};_0x5dfa2b(++_0x4e6ef1);}(_0x1a08,0x111));var _0x81a0=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x1a08[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0x81a0('0x0'));var rimraf=require(_0x81a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81a0('0x2'));var rp=require(_0x81a0('0x3'));var moment=require(_0x81a0('0x4'));var BPromise=require(_0x81a0('0x5'));var Mustache=require(_0x81a0('0x6'));var util=require('util');var path=require(_0x81a0('0x7'));var sox=require(_0x81a0('0x8'));var csv=require(_0x81a0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81a0('0xa'));var _=require(_0x81a0('0xb'));var squel=require(_0x81a0('0xc'));var crypto=require(_0x81a0('0xd'));var jsforce=require(_0x81a0('0xe'));var deskjs=require(_0x81a0('0xf'));var toCsv=require(_0x81a0('0x9'));var querystring=require(_0x81a0('0x10'));var Papa=require(_0x81a0('0x11'));var Redis=require('ioredis');var authService=require(_0x81a0('0x12'));var qs=require(_0x81a0('0x13'));var as=require(_0x81a0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81a0('0x15'))('api');var utils=require(_0x81a0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x126046,_0xd85458){_0xd85458=_0xd85458||0xcc;return function(_0x646872){if(_0x646872){return _0x126046[_0x81a0('0x17')](_0xd85458);}return _0x126046[_0x81a0('0x18')](_0xd85458)[_0x81a0('0x19')]();};}function respondWithResult(_0x17e159,_0x36ca4b){_0x36ca4b=_0x36ca4b||0xc8;return function(_0x597ba4){if(_0x597ba4){return _0x17e159['status'](_0x36ca4b)['json'](_0x597ba4);}};}function respondWithFilteredResult(_0x275c17,_0xede4cb){return function(_0x3712ba){if(_0x3712ba){var _0x41c450=typeof _0xede4cb[_0x81a0('0x1a')]==='undefined'&&typeof _0xede4cb[_0x81a0('0x1b')]===_0x81a0('0x1c');var _0x2b728f=_0x3712ba['count'];var _0x10f11a=_0x41c450?0x0:_0xede4cb['offset'];var _0x1fe8f6=_0x41c450?_0x3712ba[_0x81a0('0x1d')]:_0xede4cb[_0x81a0('0x1a')]+_0xede4cb[_0x81a0('0x1b')];var _0x11e904;if(_0x1fe8f6>=_0x2b728f){_0x1fe8f6=_0x2b728f;_0x11e904=0xc8;}else{_0x11e904=0xce;}_0x275c17['status'](_0x11e904);return _0x275c17[_0x81a0('0x1e')](_0x81a0('0x1f'),_0x10f11a+'-'+_0x1fe8f6+'/'+_0x2b728f)[_0x81a0('0x20')](_0x3712ba);}return null;};}function patchUpdates(_0x2b561d){return function(_0x98a7d4){try{jsonpatch[_0x81a0('0x21')](_0x98a7d4,_0x2b561d,!![]);}catch(_0x50e3f6){return BPromise[_0x81a0('0x22')](_0x50e3f6);}return _0x98a7d4['save']();};}function saveUpdates(_0x1f991d,_0x5220e0){return function(_0x3c9c28){if(_0x3c9c28){return _0x3c9c28[_0x81a0('0x23')](_0x1f991d)[_0x81a0('0x24')](function(_0x169b7a){return _0x169b7a;});}return null;};}function removeEntity(_0x48cd00,_0x7e215){return function(_0x5a3ce3){if(_0x5a3ce3){return _0x5a3ce3[_0x81a0('0x25')]()[_0x81a0('0x24')](function(){_0x48cd00[_0x81a0('0x18')](0xcc)[_0x81a0('0x19')]();});}};}function handleEntityNotFound(_0x2d294d,_0x4bf05e){return function(_0x238620){if(!_0x238620){_0x2d294d[_0x81a0('0x17')](0x194);}return _0x238620;};}function handleError(_0x2d7081,_0x121019){_0x121019=_0x121019||0x1f4;return function(_0x4780b3){logger['error'](_0x4780b3['stack']);if(_0x4780b3[_0x81a0('0x26')]){delete _0x4780b3[_0x81a0('0x26')];}_0x2d7081[_0x81a0('0x18')](_0x121019)['send'](_0x4780b3);};}exports[_0x81a0('0x27')]=function(_0x53a442,_0x46e3b5){var _0x56cf91={},_0x2e99f6={},_0x42336a={'count':0x0,'rows':[]};var _0xe5406f=_[_0x81a0('0x28')](db[_0x81a0('0x29')][_0x81a0('0x2a')],function(_0x28d0ee){return{'name':_0x28d0ee[_0x81a0('0x2b')],'type':_0x28d0ee['type'][_0x81a0('0x2c')]};});_0x2e99f6['model']=_['map'](_0xe5406f,_0x81a0('0x26'));_0x2e99f6[_0x81a0('0x2d')]=_[_0x81a0('0x2e')](_0x53a442[_0x81a0('0x2d')]);_0x2e99f6[_0x81a0('0x2f')]=_[_0x81a0('0x30')](_0x2e99f6[_0x81a0('0x31')],_0x2e99f6['query']);_0x56cf91[_0x81a0('0x32')]=_['intersection'](_0x2e99f6['model'],qs['fields'](_0x53a442[_0x81a0('0x2d')][_0x81a0('0x33')]));_0x56cf91[_0x81a0('0x32')]=_0x56cf91['attributes'][_0x81a0('0x34')]?_0x56cf91[_0x81a0('0x32')]:_0x2e99f6[_0x81a0('0x31')];if(!_0x53a442[_0x81a0('0x2d')][_0x81a0('0x35')](_0x81a0('0x36'))){_0x56cf91[_0x81a0('0x1b')]=qs[_0x81a0('0x1b')](_0x53a442[_0x81a0('0x2d')]['limit']);_0x56cf91['offset']=qs[_0x81a0('0x1a')](_0x53a442[_0x81a0('0x2d')]['offset']);}_0x56cf91[_0x81a0('0x37')]=qs[_0x81a0('0x38')](_0x53a442['query'][_0x81a0('0x38')]);_0x56cf91['where']=qs[_0x81a0('0x2f')](_[_0x81a0('0x39')](_0x53a442[_0x81a0('0x2d')],_0x2e99f6[_0x81a0('0x2f')]),_0xe5406f);if(_0x53a442[_0x81a0('0x2d')][_0x81a0('0x3a')]){_0x56cf91[_0x81a0('0x3b')]=_[_0x81a0('0x3c')](_0x56cf91[_0x81a0('0x3b')],{'$or':_[_0x81a0('0x28')](_0xe5406f,function(_0x381c13){if(_0x381c13[_0x81a0('0x3d')]!=='VIRTUAL'){var _0x52cee0={};_0x52cee0[_0x381c13[_0x81a0('0x26')]]={'$like':'%'+_0x53a442[_0x81a0('0x2d')][_0x81a0('0x3a')]+'%'};return _0x52cee0;}})});}_0x56cf91=_['merge']({},_0x56cf91,_0x53a442[_0x81a0('0x3e')]);var _0x4338de={'where':_0x56cf91[_0x81a0('0x3b')]};return db['SquareDetailsReport'][_0x81a0('0x1d')](_0x4338de)[_0x81a0('0x24')](function(_0x5b3dc1){_0x42336a['count']=_0x5b3dc1;if(_0x53a442[_0x81a0('0x2d')][_0x81a0('0x3f')]){_0x56cf91[_0x81a0('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x56cf91);})[_0x81a0('0x24')](function(_0x52f27e){_0x42336a['rows']=_0x52f27e;return _0x42336a;})[_0x81a0('0x24')](respondWithFilteredResult(_0x46e3b5,_0x56cf91))[_0x81a0('0x41')](handleError(_0x46e3b5,null));};exports[_0x81a0('0x42')]=function(_0x285c63,_0x232c9b){var _0x112068={'raw':!![],'where':{'id':_0x285c63[_0x81a0('0x43')]['id']}},_0x27edcd={};_0x27edcd[_0x81a0('0x31')]=_['keys'](db[_0x81a0('0x29')][_0x81a0('0x2a')]);_0x27edcd[_0x81a0('0x2d')]=_[_0x81a0('0x2e')](_0x285c63[_0x81a0('0x2d')]);_0x27edcd[_0x81a0('0x2f')]=_[_0x81a0('0x30')](_0x27edcd[_0x81a0('0x31')],_0x27edcd[_0x81a0('0x2d')]);_0x112068[_0x81a0('0x32')]=_['intersection'](_0x27edcd[_0x81a0('0x31')],qs[_0x81a0('0x33')](_0x285c63[_0x81a0('0x2d')][_0x81a0('0x33')]));_0x112068['attributes']=_0x112068[_0x81a0('0x32')][_0x81a0('0x34')]?_0x112068[_0x81a0('0x32')]:_0x27edcd[_0x81a0('0x31')];if(_0x285c63[_0x81a0('0x2d')][_0x81a0('0x3f')]){_0x112068[_0x81a0('0x40')]=[{'all':!![]}];}_0x112068=_[_0x81a0('0x3c')]({},_0x112068,_0x285c63[_0x81a0('0x3e')]);return db['SquareDetailsReport'][_0x81a0('0x44')](_0x112068)['then'](handleEntityNotFound(_0x232c9b,null))['then'](respondWithResult(_0x232c9b,null))['catch'](handleError(_0x232c9b,null));};exports[_0x81a0('0x45')]=function(_0x41e162,_0x44d35e){return db['SquareDetailsReport'][_0x81a0('0x45')](_0x41e162[_0x81a0('0x46')],{})[_0x81a0('0x24')](respondWithResult(_0x44d35e,0xc9))['catch'](handleError(_0x44d35e,null));};exports[_0x81a0('0x23')]=function(_0x4ec1aa,_0x467218){if(_0x4ec1aa[_0x81a0('0x46')]['id']){delete _0x4ec1aa[_0x81a0('0x46')]['id'];}return db[_0x81a0('0x29')]['find']({'where':{'id':_0x4ec1aa[_0x81a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x467218,null))[_0x81a0('0x24')](saveUpdates(_0x4ec1aa['body'],null))[_0x81a0('0x24')](respondWithResult(_0x467218,null))[_0x81a0('0x41')](handleError(_0x467218,null));};exports['destroy']=function(_0x9c104e,_0x45a88a){return db[_0x81a0('0x29')][_0x81a0('0x44')]({'where':{'id':_0x9c104e[_0x81a0('0x43')]['id']}})[_0x81a0('0x24')](handleEntityNotFound(_0x45a88a,null))['then'](removeEntity(_0x45a88a,null))[_0x81a0('0x41')](handleError(_0x45a88a,null));};exports[_0x81a0('0x47')]=function(_0x153742,_0x3f4b44){return db['SquareDetailsReport'][_0x81a0('0x47')]()[_0x81a0('0x24')](respondWithResult(_0x3f4b44,null))[_0x81a0('0x41')](handleError(_0x3f4b44,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 377d642..c804559 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 _0x42b9=['report_square_details','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./squareReportDetail.attributes','SquareDetailsReport'];(function(_0x19de6b,_0x4b8505){var _0x1d35e7=function(_0x115a90){while(--_0x115a90){_0x19de6b['push'](_0x19de6b['shift']());}};_0x1d35e7(++_0x4b8505);}(_0x42b9,0xa3));var _0x942b=function(_0x596ec8,_0xec6243){_0x596ec8=_0x596ec8-0x0;var _0x5d7e79=_0x42b9[_0x596ec8];return _0x5d7e79;};'use strict';var _=require(_0x942b('0x0'));var util=require('util');var logger=require(_0x942b('0x1'))('api');var moment=require(_0x942b('0x2'));var BPromise=require(_0x942b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x942b('0x4'));var config=require(_0x942b('0x5'));var attributes=require(_0x942b('0x6'));module['exports']=function(_0x5f05a7,_0x29b4b4){return _0x5f05a7['define'](_0x942b('0x7'),attributes,{'tableName':_0x942b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf8f=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','report_square_details','../../config/logger'];(function(_0x2d47e2,_0x343c53){var _0x2ba3cf=function(_0x4830c6){while(--_0x4830c6){_0x2d47e2['push'](_0x2d47e2['shift']());}};_0x2ba3cf(++_0x343c53);}(_0xaf8f,0x11f));var _0xfaf8=function(_0x341a17,_0x2a5857){_0x341a17=_0x341a17-0x0;var _0x205e03=_0xaf8f[_0x341a17];return _0x205e03;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfaf8('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfaf8('0x1'));var rp=require(_0xfaf8('0x2'));var fs=require('fs');var path=require(_0xfaf8('0x3'));var rimraf=require(_0xfaf8('0x4'));var config=require(_0xfaf8('0x5'));var attributes=require(_0xfaf8('0x6'));module['exports']=function(_0x17166d,_0x1801a1){return _0x17166d[_0xfaf8('0x7')]('SquareDetailsReport',attributes,{'tableName':_0xfaf8('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 5434b9d..444967a 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 _0x8caf=['../../config/environment','jayson/promise','client','http','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x387f10,_0x4999d9){var _0x13ea24=function(_0x316d3b){while(--_0x316d3b){_0x387f10['push'](_0x387f10['shift']());}};_0x13ea24(++_0x4999d9);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x5c1f07,_0x35d59e){_0x5c1f07=_0x5c1f07-0x0;var _0x22c4d3=_0x8caf[_0x5c1f07];return _0x22c4d3;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var moment=require(_0xf8ca('0x1'));var BPromise=require(_0xf8ca('0x2'));var rs=require(_0xf8ca('0x3'));var fs=require('fs');var Redis=require(_0xf8ca('0x4'));var db=require(_0xf8ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8ca('0x6'))(_0xf8ca('0x7'));var config=require(_0xf8ca('0x8'));var jayson=require(_0xf8ca('0x9'));var client=jayson[_0xf8ca('0xa')][_0xf8ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562eea,_0x773b9f,_0x3abd58){return new BPromise(function(_0x3a91d3,_0x31300c){return client['request'](_0x562eea,_0x3abd58)['then'](function(_0x3a9674){logger['info'](_0xf8ca('0xc'),_0x773b9f,_0xf8ca('0xd'));logger[_0xf8ca('0xe')](_0xf8ca('0xf'),_0x773b9f,'request\x20sent',JSON[_0xf8ca('0x10')](_0x3a9674));if(_0x3a9674[_0xf8ca('0x11')]){if(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x12')]===0x1f4){logger['error'](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')]['message']);return _0x31300c(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);return _0x3a91d3(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}else{logger[_0xf8ca('0x14')](_0xf8ca('0xc'),_0x773b9f,'request\x20sent');_0x3a91d3(_0x3a9674[_0xf8ca('0x15')][_0xf8ca('0x13')]);}})[_0xf8ca('0x16')](function(_0x12e8f0){logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x12e8f0);_0x31300c(_0x12e8f0);});});}exports[_0xf8ca('0x17')]=function(_0x127119){var _0x50e805=this;return new Promise(function(_0x237f44,_0x3b5400){return db[_0xf8ca('0x18')][_0xf8ca('0x19')](_0x127119['body'],{'raw':_0x127119[_0xf8ca('0x1a')]?_0x127119[_0xf8ca('0x1a')][_0xf8ca('0x1b')]===undefined?!![]:![]:!![]})[_0xf8ca('0x1c')](function(_0x18e8da){logger[_0xf8ca('0x14')]('CreateSquareDetailsReport',_0x127119);logger[_0xf8ca('0xe')]('CreateSquareDetailsReport',_0x127119,JSON[_0xf8ca('0x10')](_0x18e8da));_0x237f44(_0x18e8da);})[_0xf8ca('0x16')](function(_0x179a48){logger[_0xf8ca('0x11')](_0xf8ca('0x17'),_0x179a48[_0xf8ca('0x13')],_0x127119);_0x3b5400(_0x50e805['error'](0x1f4,_0x179a48['message']));});});}; \ No newline at end of file +var _0xd5fc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateSquareDetailsReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd5fc,0xae));var _0xcd5f=function(_0x563764,_0x8432a3){_0x563764=_0x563764-0x0;var _0x3c2356=_0xd5fc[_0x563764];return _0x3c2356;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateSquareDetailsReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['SquareDetailsReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateSquareDetailsReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 01566b0..531b62f 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 _0x4324=['killProcess','exports','express','../../components/auth/service','./system.controller','isAuthenticated','get','/process/:pid/kill'];(function(_0x51d0af,_0x50c99c){var _0x4b9d94=function(_0x37687d){while(--_0x37687d){_0x51d0af['push'](_0x51d0af['shift']());}};_0x4b9d94(++_0x50c99c);}(_0x4324,0xa2));var _0x4432=function(_0xe2ebaa,_0x138483){_0xe2ebaa=_0xe2ebaa-0x0;var _0x563838=_0x4324[_0xe2ebaa];return _0x563838;};'use strict';var express=require(_0x4432('0x0'));var router=express['Router']();var auth=require(_0x4432('0x1'));var controller=require(_0x4432('0x2'));router['get']('/',auth[_0x4432('0x3')](),controller['index']);router[_0x4432('0x4')](_0x4432('0x5'),auth[_0x4432('0x3')](),controller[_0x4432('0x6')]);module[_0x4432('0x7')]=router; \ No newline at end of file +var _0x3730=['exports','express','Router','../../components/auth/service','get','isAuthenticated','killProcess'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x3730,0x9b));var _0x0373=function(_0x1f13a3,_0x3cfebd){_0x1f13a3=_0x1f13a3-0x0;var _0x33eda2=_0x3730[_0x1f13a3];return _0x33eda2;};'use strict';var express=require(_0x0373('0x0'));var router=express[_0x0373('0x1')]();var auth=require(_0x0373('0x2'));var controller=require('./system.controller');router[_0x0373('0x3')]('/',auth[_0x0373('0x4')](),controller['index']);router['get']('/process/:pid/kill',auth[_0x0373('0x4')](),controller[_0x0373('0x5')]);module[_0x0373('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 ee4e401..7394f00 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 _0xae06=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','bluebird','lodash','error','inspect','name','status','send','index','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid'];(function(_0x1ae7db,_0x250b31){var _0x4dd02c=function(_0x121111){while(--_0x121111){_0x1ae7db['push'](_0x1ae7db['shift']());}};_0x4dd02c(++_0x250b31);}(_0xae06,0x72));var _0x6ae0=function(_0x1d773c,_0xb5a290){_0x1d773c=_0x1d773c-0x0;var _0x2a3e70=_0xae06[_0x1d773c];return _0x2a3e70;};'use strict';var info=require(_0x6ae0('0x0'));var exec=require(_0x6ae0('0x1'))[_0x6ae0('0x2')];var logger=require(_0x6ae0('0x3'))('api');var util=require('util');var BPromise=require(_0x6ae0('0x4'));var _=require(_0x6ae0('0x5'));function handleError(_0x417a70,_0x3e6d25,_0xb6d9c5){_0x3e6d25=_0x3e6d25||0x1f4;return function(_0x100ae7){logger[_0x6ae0('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0xb6d9c5,_0x3e6d25,util[_0x6ae0('0x7')](_0x100ae7,{'showHidden':![],'depth':null}));delete _0x100ae7[_0x6ae0('0x8')];_0x417a70[_0x6ae0('0x9')](_0x3e6d25)[_0x6ae0('0xa')](_0x100ae7);};}exports[_0x6ae0('0xb')]=function(_0x148f91,_0x38f121){return info[_0x6ae0('0xc')]()[_0x6ae0('0xd')](function(_0x402367){return _0x38f121[_0x6ae0('0x9')](0xc8)['json'](_0x402367);})[_0x6ae0('0xe')](function(_0x346c27){return _0x38f121[_0x6ae0('0x9')](0x1f4)[_0x6ae0('0xf')](_0x346c27);});};exports[_0x6ae0('0x10')]=function(_0x252485,_0x405690){var _0x4ed37b=[_0x6ae0('0x11')];return new BPromise(function(_0x1af8fa,_0x33c0a4){return exec(util[_0x6ae0('0x12')](_0x6ae0('0x13'),_0x252485['params']['pid']),function(_0x48df8e,_0x767c9e,_0x3cae51){if(_0x48df8e){return _0x33c0a4(_0x48df8e);}return _0x1af8fa(_0x767c9e);});})[_0x6ae0('0xd')](function(_0x577e62){var _0x3d4ee4=![];var _0x294b26=_0x577e62[_0x6ae0('0x14')](/\n/);for(var _0x20d03e=0x0,_0x20ec3e=_0x4ed37b[_0x6ae0('0x15')];_0x20d03e<_0x20ec3e,_0x3d4ee4===![];_0x20d03e+=0x1){if(_0x577e62[_0x6ae0('0x16')](_0x4ed37b[_0x20d03e])>=0x0){_0x3d4ee4=!![];}}if(!_0x3d4ee4){throw new Error(util[_0x6ae0('0x12')](_0x6ae0('0x17'),_0x252485[_0x6ae0('0x18')][_0x6ae0('0x19')]));}process['kill'](_0x252485[_0x6ae0('0x18')]['pid'],_0x6ae0('0x1a'));return _0x405690[_0x6ae0('0x9')](0xc8)[_0x6ae0('0xf')]({'message':util['format'](_0x6ae0('0x1b'),_0x252485['params']['pid'])});})['catch'](handleError(_0x405690,null,_0x6ae0('0x10')));}; \ No newline at end of file +var _0x8429=['pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','inspect','name','status','send','index','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params'];(function(_0x8014d8,_0x134a36){var _0x581b7b=function(_0x45c7ce){while(--_0x45c7ce){_0x8014d8['push'](_0x8014d8['shift']());}};_0x581b7b(++_0x134a36);}(_0x8429,0x154));var _0x9842=function(_0x224d7e,_0x2f2af8){_0x224d7e=_0x224d7e-0x0;var _0x48f5d1=_0x8429[_0x224d7e];return _0x48f5d1;};'use strict';var info=require(_0x9842('0x0'));var exec=require(_0x9842('0x1'))[_0x9842('0x2')];var logger=require(_0x9842('0x3'))(_0x9842('0x4'));var util=require(_0x9842('0x5'));var BPromise=require(_0x9842('0x6'));var _=require(_0x9842('0x7'));function handleError(_0x233e22,_0x341a77,_0x162fcc){_0x341a77=_0x341a77||0x1f4;return function(_0x514391){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x162fcc,_0x341a77,util[_0x9842('0x8')](_0x514391,{'showHidden':![],'depth':null}));delete _0x514391[_0x9842('0x9')];_0x233e22[_0x9842('0xa')](_0x341a77)[_0x9842('0xb')](_0x514391);};}exports[_0x9842('0xc')]=function(_0xb3a36,_0x194eea){return info['getAllData']()[_0x9842('0xd')](function(_0x5e7c50){return _0x194eea[_0x9842('0xa')](0xc8)['json'](_0x5e7c50);})[_0x9842('0xe')](function(_0x7e39ca){return _0x194eea[_0x9842('0xa')](0x1f4)[_0x9842('0xf')](_0x7e39ca);});};exports[_0x9842('0x10')]=function(_0x385795,_0x1b4cda){var _0x128b82=[_0x9842('0x11')];return new BPromise(function(_0x5158a3,_0x38ff00){return exec(util[_0x9842('0x12')](_0x9842('0x13'),_0x385795['params']['pid']),function(_0x153280,_0x4ab5aa,_0x3f3ae9){if(_0x153280){return _0x38ff00(_0x153280);}return _0x5158a3(_0x4ab5aa);});})['then'](function(_0x56d38e){var _0x889b62=![];var _0x5e0e7d=_0x56d38e['split'](/\n/);for(var _0x47431a=0x0,_0x1b0732=_0x128b82[_0x9842('0x14')];_0x47431a<_0x1b0732,_0x889b62===![];_0x47431a+=0x1){if(_0x56d38e[_0x9842('0x15')](_0x128b82[_0x47431a])>=0x0){_0x889b62=!![];}}if(!_0x889b62){throw new Error(util[_0x9842('0x12')](_0x9842('0x16'),_0x385795[_0x9842('0x17')][_0x9842('0x18')]));}process[_0x9842('0x19')](_0x385795[_0x9842('0x17')][_0x9842('0x18')],_0x9842('0x1a'));return _0x1b4cda[_0x9842('0xa')](0xc8)[_0x9842('0xf')]({'message':util[_0x9842('0x12')](_0x9842('0x1b'),_0x385795[_0x9842('0x17')][_0x9842('0x18')])});})[_0x9842('0xe')](handleError(_0x1b4cda,null,_0x9842('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 11ffd37..921fec4 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 _0xe8f9=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete'];(function(_0x2f5ea1,_0x348b7c){var _0x27c214=function(_0x5da609){while(--_0x5da609){_0x2f5ea1['push'](_0x2f5ea1['shift']());}};_0x27c214(++_0x348b7c);}(_0xe8f9,0x73));var _0x9e8f=function(_0x545033,_0x1bc4ac){_0x545033=_0x545033-0x0;var _0x161638=_0xe8f9[_0x545033];return _0x161638;};'use strict';var multer=require('multer');var util=require(_0x9e8f('0x0'));var path=require(_0x9e8f('0x1'));var timeout=require(_0x9e8f('0x2'));var express=require(_0x9e8f('0x3'));var router=express[_0x9e8f('0x4')]();var fs_extra=require(_0x9e8f('0x5'));var auth=require(_0x9e8f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e8f('0x7'));var controller=require(_0x9e8f('0x8'));router['get']('/',auth[_0x9e8f('0x9')](),controller[_0x9e8f('0xa')]);router[_0x9e8f('0xb')](_0x9e8f('0xc'),auth['isAuthenticated'](),controller[_0x9e8f('0xd')]);router[_0x9e8f('0xe')]('/',auth[_0x9e8f('0x9')](),controller[_0x9e8f('0xf')]);router['put'](_0x9e8f('0xc'),auth[_0x9e8f('0x9')](),controller[_0x9e8f('0x10')]);router[_0x9e8f('0x11')](_0x9e8f('0xc'),auth[_0x9e8f('0x9')](),controller['destroy']);module[_0x9e8f('0x12')]=router; \ No newline at end of file +var _0xf75d=['index','/:id','show','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./tag.controller','get'];(function(_0x1f8d1b,_0x174cff){var _0x29130e=function(_0x13cb43){while(--_0x13cb43){_0x1f8d1b['push'](_0x1f8d1b['shift']());}};_0x29130e(++_0x174cff);}(_0xf75d,0xa7));var _0xdf75=function(_0x10cfc2,_0x88b59d){_0x10cfc2=_0x10cfc2-0x0;var _0x25b436=_0xf75d[_0x10cfc2];return _0x25b436;};'use strict';var multer=require(_0xdf75('0x0'));var util=require(_0xdf75('0x1'));var path=require(_0xdf75('0x2'));var timeout=require(_0xdf75('0x3'));var express=require(_0xdf75('0x4'));var router=express[_0xdf75('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdf75('0x6'));var config=require('../../config/environment');var controller=require(_0xdf75('0x7'));router[_0xdf75('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf75('0x9')]);router[_0xdf75('0x8')](_0xdf75('0xa'),auth['isAuthenticated'](),controller[_0xdf75('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xdf75('0xa'),auth[_0xdf75('0xc')](),controller[_0xdf75('0xd')]);router['delete'](_0xdf75('0xa'),auth[_0xdf75('0xc')](),controller[_0xdf75('0xe')]);module[_0xdf75('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index bda84c9..452da2b 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 _0x49db=['name','sequelize','exports','STRING'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x49db,0xc5));var _0xb49d=function(_0x44ab37,_0x40def9){_0x44ab37=_0x44ab37-0x0;var _0x44c4c1=_0x49db[_0x44ab37];return _0x44c4c1;};'use strict';var Sequelize=require(_0xb49d('0x0'));module[_0xb49d('0x1')]={'name':{'type':Sequelize[_0xb49d('0x2')],'unique':_0xb49d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb49d('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb49d('0x2')]}}; \ No newline at end of file +var _0xe890=['name','#0091EA','STRING'];(function(_0x2ed4f6,_0x27d5d){var _0x48817e=function(_0x1c532a){while(--_0x1c532a){_0x2ed4f6['push'](_0x2ed4f6['shift']());}};_0x48817e(++_0x27d5d);}(_0xe890,0x1a6));var _0x0e89=function(_0x231d49,_0x195352){_0x231d49=_0x231d49-0x0;var _0x40ad78=_0xe890[_0x231d49];return _0x40ad78;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0e89('0x0')],'unique':_0x0e89('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0e89('0x0')],'defaultValue':_0x0e89('0x2')},'description':{'type':Sequelize[_0x0e89('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 04b2710..5e861e0 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 _0xe644=['type','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4e64('0x0'));var rimraf=require(_0x4e64('0x1'));var zipdir=require(_0x4e64('0x2'));var jsonpatch=require(_0x4e64('0x3'));var rp=require(_0x4e64('0x4'));var moment=require(_0x4e64('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4e64('0x6'));var util=require(_0x4e64('0x7'));var path=require(_0x4e64('0x8'));var sox=require(_0x4e64('0x9'));var csv=require(_0x4e64('0xa'));var ejs=require(_0x4e64('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e64('0xc'));var squel=require(_0x4e64('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e64('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e64('0xf'));var Redis=require(_0x4e64('0x10'));var authService=require(_0x4e64('0x11'));var qs=require(_0x4e64('0x12'));var as=require(_0x4e64('0x13'));var hardwareService=require(_0x4e64('0x14'));var logger=require('../../config/logger')(_0x4e64('0x15'));var utils=require(_0x4e64('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4e64('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7ce0,_0x573e67){_0x573e67=_0x573e67||0xcc;return function(_0x4c1cf3){if(_0x4c1cf3){return _0x4c7ce0[_0x4e64('0x18')](_0x573e67);}return _0x4c7ce0[_0x4e64('0x19')](_0x573e67)[_0x4e64('0x1a')]();};}function respondWithResult(_0x2aa800,_0x352eca){_0x352eca=_0x352eca||0xc8;return function(_0xb36502){if(_0xb36502){return _0x2aa800[_0x4e64('0x19')](_0x352eca)['json'](_0xb36502);}};}function respondWithFilteredResult(_0x1d274c,_0x5573af){return function(_0x78cdc6){if(_0x78cdc6){var _0x5b35b0=typeof _0x5573af[_0x4e64('0x1b')]===_0x4e64('0x1c')&&typeof _0x5573af[_0x4e64('0x1d')]===_0x4e64('0x1c');var _0x2bbaaa=_0x78cdc6[_0x4e64('0x1e')];var _0x135ffb=_0x5b35b0?0x0:_0x5573af[_0x4e64('0x1b')];var _0x1be196=_0x5b35b0?_0x78cdc6[_0x4e64('0x1e')]:_0x5573af['offset']+_0x5573af[_0x4e64('0x1d')];var _0x112797;if(_0x1be196>=_0x2bbaaa){_0x1be196=_0x2bbaaa;_0x112797=0xc8;}else{_0x112797=0xce;}_0x1d274c['status'](_0x112797);return _0x1d274c[_0x4e64('0x1f')]('Content-Range',_0x135ffb+'-'+_0x1be196+'/'+_0x2bbaaa)['json'](_0x78cdc6);}return null;};}function patchUpdates(_0x18a1d3){return function(_0x120f14){try{jsonpatch[_0x4e64('0x20')](_0x120f14,_0x18a1d3,!![]);}catch(_0x4a97a4){return BPromise[_0x4e64('0x21')](_0x4a97a4);}return _0x120f14['save']();};}function saveUpdates(_0x30e356,_0x336c53){return function(_0x2df7a0){if(_0x2df7a0){return _0x2df7a0['update'](_0x30e356)[_0x4e64('0x22')](function(_0x58ea85){return _0x58ea85;});}return null;};}function removeEntity(_0x2431eb,_0x27d33e){return function(_0x445864){if(_0x445864){return _0x445864[_0x4e64('0x23')]()[_0x4e64('0x22')](function(){var _0x5abddb=_0x445864[_0x4e64('0x24')]({'plain':!![]});var _0x29b4f8=_0x4e64('0x25');return db['UserProfileResource'][_0x4e64('0x23')]({'where':{'type':_0x29b4f8,'resourceId':_0x5abddb['id']}})[_0x4e64('0x22')](function(){return _0x445864;});})[_0x4e64('0x22')](function(){_0x2431eb[_0x4e64('0x19')](0xcc)[_0x4e64('0x1a')]();});}};}function handleEntityNotFound(_0x5f0d42,_0x3185ba){return function(_0x2b1f2b){if(!_0x2b1f2b){_0x5f0d42[_0x4e64('0x18')](0x194);}return _0x2b1f2b;};}function handleError(_0x194f33,_0x39e5ed){_0x39e5ed=_0x39e5ed||0x1f4;return function(_0x1057d0){logger[_0x4e64('0x26')](_0x1057d0[_0x4e64('0x27')]);if(_0x1057d0['name']){delete _0x1057d0[_0x4e64('0x28')];}_0x194f33[_0x4e64('0x19')](_0x39e5ed)[_0x4e64('0x29')](_0x1057d0);};}exports[_0x4e64('0x2a')]=function(_0x3f00d5,_0x3b1f16){var _0x439b2f={},_0x4c4559={},_0x67698d={'count':0x0,'rows':[]};var _0x13c3e2=_[_0x4e64('0x2b')](db[_0x4e64('0x2c')][_0x4e64('0x2d')],function(_0x3d6cec){return{'name':_0x3d6cec[_0x4e64('0x2e')],'type':_0x3d6cec['type'][_0x4e64('0x2f')]};});_0x4c4559[_0x4e64('0x30')]=_[_0x4e64('0x2b')](_0x13c3e2,'name');_0x4c4559[_0x4e64('0x31')]=_['keys'](_0x3f00d5[_0x4e64('0x31')]);_0x4c4559[_0x4e64('0x32')]=_['intersection'](_0x4c4559['model'],_0x4c4559['query']);_0x439b2f[_0x4e64('0x33')]=_['intersection'](_0x4c4559[_0x4e64('0x30')],qs[_0x4e64('0x34')](_0x3f00d5[_0x4e64('0x31')][_0x4e64('0x34')]));_0x439b2f[_0x4e64('0x33')]=_0x439b2f[_0x4e64('0x33')][_0x4e64('0x35')]?_0x439b2f['attributes']:_0x4c4559[_0x4e64('0x30')];if(!_0x3f00d5['query'][_0x4e64('0x36')]('nolimit')){_0x439b2f['limit']=qs['limit'](_0x3f00d5[_0x4e64('0x31')]['limit']);_0x439b2f['offset']=qs[_0x4e64('0x1b')](_0x3f00d5[_0x4e64('0x31')][_0x4e64('0x1b')]);}_0x439b2f[_0x4e64('0x37')]=qs[_0x4e64('0x38')](_0x3f00d5[_0x4e64('0x31')][_0x4e64('0x38')]);_0x439b2f['where']=qs['filters'](_['pick'](_0x3f00d5[_0x4e64('0x31')],_0x4c4559[_0x4e64('0x32')]),_0x13c3e2);if(_0x3f00d5[_0x4e64('0x31')][_0x4e64('0x39')]){_0x439b2f['where']=_[_0x4e64('0x3a')](_0x439b2f[_0x4e64('0x3b')],{'$or':_[_0x4e64('0x2b')](_0x13c3e2,function(_0x2cea0f){if(_0x2cea0f[_0x4e64('0x3c')]!=='VIRTUAL'){var _0x4faf59={};_0x4faf59[_0x2cea0f[_0x4e64('0x28')]]={'$like':'%'+_0x3f00d5['query'][_0x4e64('0x39')]+'%'};return _0x4faf59;}})});}_0x439b2f=_[_0x4e64('0x3a')]({},_0x439b2f,_0x3f00d5[_0x4e64('0x3d')]);var _0x24e863={'where':_0x439b2f[_0x4e64('0x3b')]};return db[_0x4e64('0x2c')][_0x4e64('0x1e')](_0x24e863)['then'](function(_0x15ca67){_0x67698d[_0x4e64('0x1e')]=_0x15ca67;if(_0x3f00d5[_0x4e64('0x31')][_0x4e64('0x3e')]){_0x439b2f[_0x4e64('0x3f')]=[{'all':!![]}];}return db[_0x4e64('0x2c')][_0x4e64('0x40')](_0x439b2f);})[_0x4e64('0x22')](function(_0x496e6f){_0x67698d[_0x4e64('0x41')]=_0x496e6f;return _0x67698d;})[_0x4e64('0x22')](respondWithFilteredResult(_0x3b1f16,_0x439b2f))['catch'](handleError(_0x3b1f16,null));};exports[_0x4e64('0x42')]=function(_0x306b4d,_0x497f98){var _0xab75={'raw':!![],'where':{'id':_0x306b4d[_0x4e64('0x43')]['id']}},_0x1ddcf2={};_0x1ddcf2[_0x4e64('0x30')]=_[_0x4e64('0x44')](db['Tag'][_0x4e64('0x2d')]);_0x1ddcf2[_0x4e64('0x31')]=_[_0x4e64('0x44')](_0x306b4d[_0x4e64('0x31')]);_0x1ddcf2[_0x4e64('0x32')]=_[_0x4e64('0x45')](_0x1ddcf2[_0x4e64('0x30')],_0x1ddcf2[_0x4e64('0x31')]);_0xab75['attributes']=_['intersection'](_0x1ddcf2[_0x4e64('0x30')],qs[_0x4e64('0x34')](_0x306b4d[_0x4e64('0x31')]['fields']));_0xab75[_0x4e64('0x33')]=_0xab75[_0x4e64('0x33')][_0x4e64('0x35')]?_0xab75[_0x4e64('0x33')]:_0x1ddcf2[_0x4e64('0x30')];if(_0x306b4d['query'][_0x4e64('0x3e')]){_0xab75['include']=[{'all':!![]}];}_0xab75=_[_0x4e64('0x3a')]({},_0xab75,_0x306b4d[_0x4e64('0x3d')]);return db[_0x4e64('0x2c')][_0x4e64('0x46')](_0xab75)['then'](handleEntityNotFound(_0x497f98,null))[_0x4e64('0x22')](respondWithResult(_0x497f98,null))[_0x4e64('0x47')](handleError(_0x497f98,null));};exports[_0x4e64('0x48')]=function(_0x38a885,_0x32db0b){return db['Tag'][_0x4e64('0x48')](_0x38a885[_0x4e64('0x49')],{})[_0x4e64('0x22')](function(_0x1be224){var _0x2249fa=_0x38a885[_0x4e64('0x4a')]['get']({'plain':!![]});if(!_0x2249fa)throw new Error(_0x4e64('0x4b'));if(_0x2249fa[_0x4e64('0x4c')]===_0x4e64('0x4a')){var _0x4c2948=_0x1be224[_0x4e64('0x24')]({'plain':!![]});var _0x3cee8c='Tags';return db[_0x4e64('0x4d')]['find']({'where':{'name':_0x3cee8c,'userProfileId':_0x2249fa[_0x4e64('0x4e')]},'raw':!![]})['then'](function(_0x16d6fa){if(_0x16d6fa&&_0x16d6fa['autoAssociation']===0x0){return db[_0x4e64('0x4f')][_0x4e64('0x48')]({'name':_0x4c2948[_0x4e64('0x28')],'resourceId':_0x4c2948['id'],'type':_0x16d6fa[_0x4e64('0x28')],'sectionId':_0x16d6fa['id']},{})[_0x4e64('0x22')](function(){return _0x1be224;});}else{return _0x1be224;}})[_0x4e64('0x47')](function(_0x2d8682){logger['error'](_0x4e64('0x50'),_0x2d8682);throw _0x2d8682;});}return _0x1be224;})[_0x4e64('0x22')](respondWithResult(_0x32db0b,0xc9))[_0x4e64('0x47')](handleError(_0x32db0b,null));};exports['update']=function(_0x50cd6a,_0x9ddc22){if(_0x50cd6a['body']['id']){delete _0x50cd6a[_0x4e64('0x49')]['id'];}return db[_0x4e64('0x2c')][_0x4e64('0x46')]({'where':{'id':_0x50cd6a[_0x4e64('0x43')]['id']}})[_0x4e64('0x22')](handleEntityNotFound(_0x9ddc22,null))['then'](saveUpdates(_0x50cd6a['body'],null))[_0x4e64('0x22')](respondWithResult(_0x9ddc22,null))[_0x4e64('0x47')](handleError(_0x9ddc22,null));};exports[_0x4e64('0x23')]=function(_0x1a9dba,_0x3def87){return db[_0x4e64('0x2c')][_0x4e64('0x46')]({'where':{'id':_0x1a9dba[_0x4e64('0x43')]['id']}})['then'](handleEntityNotFound(_0x3def87,null))[_0x4e64('0x22')](removeEntity(_0x3def87,null))[_0x4e64('0x47')](handleError(_0x3def87,null));}; \ No newline at end of file +var _0x54f3=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','get','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x509038,_0x42b3e7){var _0xc58036=function(_0x451cd2){while(--_0x451cd2){_0x509038['push'](_0x509038['shift']());}};_0xc58036(++_0x42b3e7);}(_0x54f3,0x120));var _0x354f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x54f3[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){var _0x519d66=_0x273603['get']({'plain':!![]});var _0x22594b='Tags';return db['UserProfileResource'][_0x354f('0x22')]({'where':{'type':_0x22594b,'resourceId':_0x519d66['id']}})['then'](function(){return _0x273603;});})[_0x354f('0x21')](function(){_0xc0d4ca[_0x354f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73c95e,_0x3c5c38){return function(_0x1467e7){if(!_0x1467e7){_0x73c95e['sendStatus'](0x194);}return _0x1467e7;};}function handleError(_0x1a968d,_0x503b2d){_0x503b2d=_0x503b2d||0x1f4;return function(_0x227d9b){logger[_0x354f('0x23')](_0x227d9b[_0x354f('0x24')]);if(_0x227d9b[_0x354f('0x25')]){delete _0x227d9b['name'];}_0x1a968d[_0x354f('0x16')](_0x503b2d)[_0x354f('0x26')](_0x227d9b);};}exports[_0x354f('0x27')]=function(_0x34a498,_0x223464){var _0x55afe1={},_0x5a8208={},_0x42caa2={'count':0x0,'rows':[]};var _0x156dba=_[_0x354f('0x28')](db[_0x354f('0x29')]['rawAttributes'],function(_0x576a95){return{'name':_0x576a95[_0x354f('0x2a')],'type':_0x576a95[_0x354f('0x2b')][_0x354f('0x2c')]};});_0x5a8208[_0x354f('0x2d')]=_['map'](_0x156dba,_0x354f('0x25'));_0x5a8208[_0x354f('0x2e')]=_[_0x354f('0x2f')](_0x34a498[_0x354f('0x2e')]);_0x5a8208['filters']=_['intersection'](_0x5a8208[_0x354f('0x2d')],_0x5a8208[_0x354f('0x2e')]);_0x55afe1[_0x354f('0x30')]=_[_0x354f('0x31')](_0x5a8208[_0x354f('0x2d')],qs[_0x354f('0x32')](_0x34a498[_0x354f('0x2e')][_0x354f('0x32')]));_0x55afe1[_0x354f('0x30')]=_0x55afe1[_0x354f('0x30')][_0x354f('0x33')]?_0x55afe1['attributes']:_0x5a8208[_0x354f('0x2d')];if(!_0x34a498['query'][_0x354f('0x34')](_0x354f('0x35'))){_0x55afe1[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x34a498[_0x354f('0x2e')][_0x354f('0x19')]);_0x55afe1['offset']=qs[_0x354f('0x1b')](_0x34a498[_0x354f('0x2e')]['offset']);}_0x55afe1[_0x354f('0x36')]=qs[_0x354f('0x37')](_0x34a498[_0x354f('0x2e')]['sort']);_0x55afe1[_0x354f('0x38')]=qs[_0x354f('0x39')](_[_0x354f('0x3a')](_0x34a498[_0x354f('0x2e')],_0x5a8208['filters']),_0x156dba);if(_0x34a498[_0x354f('0x2e')]['filter']){_0x55afe1[_0x354f('0x38')]=_[_0x354f('0x3b')](_0x55afe1[_0x354f('0x38')],{'$or':_[_0x354f('0x28')](_0x156dba,function(_0x27c208){if(_0x27c208['type']!=='VIRTUAL'){var _0x162a10={};_0x162a10[_0x27c208[_0x354f('0x25')]]={'$like':'%'+_0x34a498[_0x354f('0x2e')][_0x354f('0x3c')]+'%'};return _0x162a10;}})});}_0x55afe1=_[_0x354f('0x3b')]({},_0x55afe1,_0x34a498[_0x354f('0x3d')]);var _0x58ae82={'where':_0x55afe1[_0x354f('0x38')]};return db[_0x354f('0x29')][_0x354f('0x1a')](_0x58ae82)[_0x354f('0x21')](function(_0x512592){_0x42caa2[_0x354f('0x1a')]=_0x512592;if(_0x34a498[_0x354f('0x2e')][_0x354f('0x3e')]){_0x55afe1[_0x354f('0x3f')]=[{'all':!![]}];}return db[_0x354f('0x29')][_0x354f('0x40')](_0x55afe1);})['then'](function(_0x66b4cc){_0x42caa2[_0x354f('0x41')]=_0x66b4cc;return _0x42caa2;})[_0x354f('0x21')](respondWithFilteredResult(_0x223464,_0x55afe1))['catch'](handleError(_0x223464,null));};exports['show']=function(_0x7835a0,_0x433ff0){var _0xff4402={'raw':!![],'where':{'id':_0x7835a0[_0x354f('0x42')]['id']}},_0x3b34ca={};_0x3b34ca[_0x354f('0x2d')]=_[_0x354f('0x2f')](db[_0x354f('0x29')]['rawAttributes']);_0x3b34ca[_0x354f('0x2e')]=_[_0x354f('0x2f')](_0x7835a0[_0x354f('0x2e')]);_0x3b34ca[_0x354f('0x39')]=_[_0x354f('0x31')](_0x3b34ca[_0x354f('0x2d')],_0x3b34ca[_0x354f('0x2e')]);_0xff4402[_0x354f('0x30')]=_[_0x354f('0x31')](_0x3b34ca['model'],qs[_0x354f('0x32')](_0x7835a0[_0x354f('0x2e')]['fields']));_0xff4402['attributes']=_0xff4402[_0x354f('0x30')][_0x354f('0x33')]?_0xff4402[_0x354f('0x30')]:_0x3b34ca[_0x354f('0x2d')];if(_0x7835a0[_0x354f('0x2e')][_0x354f('0x3e')]){_0xff4402['include']=[{'all':!![]}];}_0xff4402=_['merge']({},_0xff4402,_0x7835a0[_0x354f('0x3d')]);return db[_0x354f('0x29')][_0x354f('0x43')](_0xff4402)[_0x354f('0x21')](handleEntityNotFound(_0x433ff0,null))[_0x354f('0x21')](respondWithResult(_0x433ff0,null))[_0x354f('0x44')](handleError(_0x433ff0,null));};exports['create']=function(_0x55f2c9,_0x6b7a2c){return db['Tag'][_0x354f('0x45')](_0x55f2c9[_0x354f('0x46')],{})[_0x354f('0x21')](function(_0x4e270d){var _0x59963e=_0x55f2c9[_0x354f('0x47')][_0x354f('0x48')]({'plain':!![]});if(!_0x59963e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59963e[_0x354f('0x49')]===_0x354f('0x47')){var _0xf71a4f=_0x4e270d[_0x354f('0x48')]({'plain':!![]});var _0xf46a61=_0x354f('0x4a');return db[_0x354f('0x4b')]['find']({'where':{'name':_0xf46a61,'userProfileId':_0x59963e[_0x354f('0x4c')]},'raw':!![]})[_0x354f('0x21')](function(_0x9ccdaa){if(_0x9ccdaa&&_0x9ccdaa[_0x354f('0x4d')]===0x0){return db[_0x354f('0x4e')]['create']({'name':_0xf71a4f[_0x354f('0x25')],'resourceId':_0xf71a4f['id'],'type':_0x9ccdaa[_0x354f('0x25')],'sectionId':_0x9ccdaa['id']},{})['then'](function(){return _0x4e270d;});}else{return _0x4e270d;}})['catch'](function(_0x44495b){logger[_0x354f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44495b);throw _0x44495b;});}return _0x4e270d;})['then'](respondWithResult(_0x6b7a2c,0xc9))[_0x354f('0x44')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x20')]=function(_0x4df08f,_0x43a0b1){if(_0x4df08f[_0x354f('0x46')]['id']){delete _0x4df08f[_0x354f('0x46')]['id'];}return db[_0x354f('0x29')][_0x354f('0x43')]({'where':{'id':_0x4df08f[_0x354f('0x42')]['id']}})[_0x354f('0x21')](handleEntityNotFound(_0x43a0b1,null))['then'](saveUpdates(_0x4df08f[_0x354f('0x46')],null))[_0x354f('0x21')](respondWithResult(_0x43a0b1,null))[_0x354f('0x44')](handleError(_0x43a0b1,null));};exports[_0x354f('0x22')]=function(_0x5a6baf,_0x2edb7c){return db[_0x354f('0x29')][_0x354f('0x43')]({'where':{'id':_0x5a6baf[_0x354f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2edb7c,null))[_0x354f('0x21')](removeEntity(_0x2edb7c,null))[_0x354f('0x44')](handleError(_0x2edb7c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4278b8c..84cfc0d 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 _0x9461=['tools_tags','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag'];(function(_0x31d0ae,_0x5099ea){var _0x3039c2=function(_0x312b9e){while(--_0x312b9e){_0x31d0ae['push'](_0x31d0ae['shift']());}};_0x3039c2(++_0x5099ea);}(_0x9461,0x85));var _0x1946=function(_0x18ba1b,_0x45fcf9){_0x18ba1b=_0x18ba1b-0x0;var _0x477cb2=_0x9461[_0x18ba1b];return _0x477cb2;};'use strict';var _=require('lodash');var util=require(_0x1946('0x0'));var logger=require(_0x1946('0x1'))(_0x1946('0x2'));var moment=require('moment');var BPromise=require(_0x1946('0x3'));var rp=require(_0x1946('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1946('0x5'));var config=require(_0x1946('0x6'));var attributes=require(_0x1946('0x7'));module[_0x1946('0x8')]=function(_0x515b5c,_0x2e2b5c){return _0x515b5c[_0x1946('0x9')](_0x1946('0xa'),attributes,{'tableName':_0x1946('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe936=['define','Tag','tools_tags','lodash','util','../../config/logger','bluebird','path','rimraf','./tag.attributes'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0xe936,0x157));var _0x6e93=function(_0xaaf29f,_0x1639e2){_0xaaf29f=_0xaaf29f-0x0;var _0x387bdf=_0xe936[_0xaaf29f];return _0x387bdf;};'use strict';var _=require(_0x6e93('0x0'));var util=require(_0x6e93('0x1'));var logger=require(_0x6e93('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6e93('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e93('0x4'));var rimraf=require(_0x6e93('0x5'));var config=require('../../config/environment');var attributes=require(_0x6e93('0x6'));module['exports']=function(_0x1f60c4,_0x6fd512){return _0x1f60c4[_0x6e93('0x7')](_0x6e93('0x8'),attributes,{'tableName':_0x6e93('0x9'),'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 d89874d..b057285 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 _0xae79=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x23422a,_0x935f75){var _0x80ae59=function(_0x2ee8b4){while(--_0x2ee8b4){_0x23422a['push'](_0x23422a['shift']());}};_0x80ae59(++_0x935f75);}(_0xae79,0x1d3));var _0x9ae7=function(_0x2275fa,_0x5ce09f){_0x2275fa=_0x2275fa-0x0;var _0x391bb3=_0xae79[_0x2275fa];return _0x391bb3;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var moment=require(_0x9ae7('0x2'));var BPromise=require(_0x9ae7('0x3'));var rs=require(_0x9ae7('0x4'));var fs=require('fs');var Redis=require(_0x9ae7('0x5'));var db=require(_0x9ae7('0x6'))['db'];var utils=require(_0x9ae7('0x7'));var logger=require(_0x9ae7('0x8'))(_0x9ae7('0x9'));var config=require(_0x9ae7('0xa'));var jayson=require(_0x9ae7('0xb'));var client=jayson[_0x9ae7('0xc')][_0x9ae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x57114d,_0x2761c2){return new BPromise(function(_0x47774e,_0x3c7738){return client[_0x9ae7('0xe')](_0x409d34,_0x2761c2)[_0x9ae7('0xf')](function(_0xc023d2){logger['info'](_0x9ae7('0x10'),_0x57114d,'request\x20sent');logger[_0x9ae7('0x11')](_0x9ae7('0x12'),_0x57114d,_0x9ae7('0x13'),JSON[_0x9ae7('0x14')](_0xc023d2));if(_0xc023d2[_0x9ae7('0x15')]){if(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x16')]===0x1f4){logger['error'](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')]['message']);return _0x3c7738(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);}logger[_0x9ae7('0x15')](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);return _0x47774e(_0xc023d2[_0x9ae7('0x15')]['message']);}else{logger[_0x9ae7('0x18')](_0x9ae7('0x10'),_0x57114d,_0x9ae7('0x13'));_0x47774e(_0xc023d2[_0x9ae7('0x19')]['message']);}})[_0x9ae7('0x1a')](function(_0xe1a2d1){logger[_0x9ae7('0x15')]('Tag,\x20%s,\x20%s',_0x57114d,_0xe1a2d1);_0x3c7738(_0xe1a2d1);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x568b5d,_0x91c5b3){var _0x5a6e9a=function(_0x3bd860){while(--_0x3bd860){_0x568b5d['push'](_0x568b5d['shift']());}};_0x5a6e9a(++_0x91c5b3);}(_0x6aa7,0x178));var _0x76aa=function(_0x3a796f,_0x55789e){_0x3a796f=_0x3a796f-0x0;var _0x1d4181=_0x6aa7[_0x3a796f];return _0x1d4181;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b3a30ba..8116f33 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 f0f8722..b881e6b 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0xecb365,_0x2b3012){var _0x1dea4e=function(_0x9dfb01){while(--_0x9dfb01){_0xecb365['push'](_0xecb365['shift']());}};_0x1dea4e(++_0x2b3012);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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/team/team.controller.js b/server/api/team/team.controller.js index a5762b9..05a6b72 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 _0xd7c4=['type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','keys','options','find','create','body','role','user','get','Teams','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','destroy','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','send','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','ids','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','QueueId','penalty','User','findOrCreate','emit','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','spread','Queue:remove','UserVoiceQueueRt','removeAgents','VoicePrefixId','getAgents','order','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','stack','name','index','map','Team','rawAttributes'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0xd7c4,0x69));var _0x4d7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4d7c('0x0'));var rimraf=require(_0x4d7c('0x1'));var zipdir=require(_0x4d7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d7c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4d7c('0x4'));var sox=require(_0x4d7c('0x5'));var csv=require(_0x4d7c('0x6'));var ejs=require(_0x4d7c('0x7'));var fs=require('fs');var fs_extra=require(_0x4d7c('0x8'));var _=require(_0x4d7c('0x9'));var squel=require(_0x4d7c('0xa'));var crypto=require(_0x4d7c('0xb'));var jsforce=require(_0x4d7c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4d7c('0x6'));var querystring=require(_0x4d7c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4d7c('0xe'));var qs=require(_0x4d7c('0xf'));var as=require(_0x4d7c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4d7c('0x11'));var utils=require(_0x4d7c('0x12'));var config=require(_0x4d7c('0x13'));var licenseUtil=require(_0x4d7c('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4d7c('0x15')](config[_0x4d7c('0x16')],{'host':_0x4d7c('0x17'),'port':0x18eb});var socket=require(_0x4d7c('0x18'))(new Redis(config['redis']));require(_0x4d7c('0x19'))['register'](socket);function respondWithStatusCode(_0x4db253,_0x4f0d6a){_0x4f0d6a=_0x4f0d6a||0xcc;return function(_0x21622a){if(_0x21622a){return _0x4db253[_0x4d7c('0x1a')](_0x4f0d6a);}return _0x4db253[_0x4d7c('0x1b')](_0x4f0d6a)['end']();};}function respondWithResult(_0x531b28,_0xa5b12b){_0xa5b12b=_0xa5b12b||0xc8;return function(_0x428e86){if(_0x428e86){return _0x531b28['status'](_0xa5b12b)[_0x4d7c('0x1c')](_0x428e86);}};}function respondWithFilteredResult(_0x22d10b,_0x3fddc0){return function(_0x2b8221){if(_0x2b8221){var _0x25cc27=typeof _0x3fddc0['offset']===_0x4d7c('0x1d')&&typeof _0x3fddc0['limit']==='undefined';var _0x3ef6b9=_0x2b8221[_0x4d7c('0x1e')];var _0x131378=_0x25cc27?0x0:_0x3fddc0[_0x4d7c('0x1f')];var _0x522920=_0x25cc27?_0x2b8221['count']:_0x3fddc0[_0x4d7c('0x1f')]+_0x3fddc0[_0x4d7c('0x20')];var _0x1bc01e;if(_0x522920>=_0x3ef6b9){_0x522920=_0x3ef6b9;_0x1bc01e=0xc8;}else{_0x1bc01e=0xce;}_0x22d10b[_0x4d7c('0x1b')](_0x1bc01e);return _0x22d10b[_0x4d7c('0x21')](_0x4d7c('0x22'),_0x131378+'-'+_0x522920+'/'+_0x3ef6b9)[_0x4d7c('0x1c')](_0x2b8221);}return null;};}function patchUpdates(_0x1566d9){return function(_0xe2db99){try{jsonpatch['apply'](_0xe2db99,_0x1566d9,!![]);}catch(_0x7e0a9e){return BPromise[_0x4d7c('0x23')](_0x7e0a9e);}return _0xe2db99[_0x4d7c('0x24')]();};}function saveUpdates(_0x22a180,_0x255621){return function(_0x535f36){if(_0x535f36){return _0x535f36['update'](_0x22a180)[_0x4d7c('0x25')](function(_0x2b7336){return _0x2b7336;});}return null;};}function handleEntityNotFound(_0x182fc4,_0x37b62b){return function(_0x3dcdd6){if(!_0x3dcdd6){_0x182fc4[_0x4d7c('0x1a')](0x194);}return _0x3dcdd6;};}function handleError(_0x46c804,_0x30168b){_0x30168b=_0x30168b||0x1f4;return function(_0x25ea59){logger['error'](_0x25ea59[_0x4d7c('0x26')]);if(_0x25ea59[_0x4d7c('0x27')]){delete _0x25ea59[_0x4d7c('0x27')];}_0x46c804[_0x4d7c('0x1b')](_0x30168b)['send'](_0x25ea59);};}exports[_0x4d7c('0x28')]=function(_0x34a667,_0xf4e4c0){var _0xce518f={},_0x3e22e5={},_0x42109b={'count':0x0,'rows':[]};var _0x261cec=_[_0x4d7c('0x29')](db[_0x4d7c('0x2a')][_0x4d7c('0x2b')],function(_0x5d846d){return{'name':_0x5d846d['fieldName'],'type':_0x5d846d[_0x4d7c('0x2c')][_0x4d7c('0x2d')]};});_0x3e22e5['model']=_[_0x4d7c('0x29')](_0x261cec,_0x4d7c('0x27'));_0x3e22e5[_0x4d7c('0x2e')]=_['keys'](_0x34a667[_0x4d7c('0x2e')]);_0x3e22e5[_0x4d7c('0x2f')]=_['intersection'](_0x3e22e5['model'],_0x3e22e5[_0x4d7c('0x2e')]);_0xce518f['attributes']=_[_0x4d7c('0x30')](_0x3e22e5[_0x4d7c('0x31')],qs[_0x4d7c('0x32')](_0x34a667[_0x4d7c('0x2e')][_0x4d7c('0x32')]));_0xce518f[_0x4d7c('0x33')]=_0xce518f[_0x4d7c('0x33')][_0x4d7c('0x34')]?_0xce518f['attributes']:_0x3e22e5['model'];if(!_0x34a667[_0x4d7c('0x2e')][_0x4d7c('0x35')](_0x4d7c('0x36'))){_0xce518f[_0x4d7c('0x20')]=qs[_0x4d7c('0x20')](_0x34a667[_0x4d7c('0x2e')][_0x4d7c('0x20')]);_0xce518f[_0x4d7c('0x1f')]=qs[_0x4d7c('0x1f')](_0x34a667['query']['offset']);}_0xce518f['order']=qs[_0x4d7c('0x37')](_0x34a667[_0x4d7c('0x2e')][_0x4d7c('0x37')]);_0xce518f[_0x4d7c('0x38')]=qs[_0x4d7c('0x2f')](_[_0x4d7c('0x39')](_0x34a667[_0x4d7c('0x2e')],_0x3e22e5[_0x4d7c('0x2f')]),_0x261cec);if(_0x34a667[_0x4d7c('0x2e')][_0x4d7c('0x3a')]){_0xce518f[_0x4d7c('0x38')]=_[_0x4d7c('0x3b')](_0xce518f[_0x4d7c('0x38')],{'$or':_[_0x4d7c('0x29')](_0x261cec,function(_0x5eb214){if(_0x5eb214[_0x4d7c('0x2c')]!==_0x4d7c('0x3c')){var _0x512a08={};_0x512a08[_0x5eb214[_0x4d7c('0x27')]]={'$like':'%'+_0x34a667[_0x4d7c('0x2e')]['filter']+'%'};return _0x512a08;}})});}_0xce518f=_[_0x4d7c('0x3b')]({},_0xce518f,_0x34a667['options']);var _0x13b5bb={'where':_0xce518f['where']};return db[_0x4d7c('0x2a')][_0x4d7c('0x1e')](_0x13b5bb)['then'](function(_0x260b44){_0x42109b[_0x4d7c('0x1e')]=_0x260b44;if(_0x34a667[_0x4d7c('0x2e')][_0x4d7c('0x3d')]){_0xce518f[_0x4d7c('0x3e')]=[{'all':!![]}];}return db[_0x4d7c('0x2a')][_0x4d7c('0x3f')](_0xce518f);})['then'](function(_0x5e6e81){_0x42109b['rows']=_0x5e6e81;return _0x42109b;})['then'](respondWithFilteredResult(_0xf4e4c0,_0xce518f))[_0x4d7c('0x40')](handleError(_0xf4e4c0,null));};exports['show']=function(_0x2f19f6,_0x5a292c){var _0x634a10={'raw':![],'where':{'id':_0x2f19f6[_0x4d7c('0x41')]['id']}},_0x1b4336={};_0x1b4336[_0x4d7c('0x31')]=_[_0x4d7c('0x42')](db[_0x4d7c('0x2a')][_0x4d7c('0x2b')]);_0x1b4336[_0x4d7c('0x2e')]=_['keys'](_0x2f19f6[_0x4d7c('0x2e')]);_0x1b4336[_0x4d7c('0x2f')]=_['intersection'](_0x1b4336[_0x4d7c('0x31')],_0x1b4336[_0x4d7c('0x2e')]);_0x634a10['attributes']=_['intersection'](_0x1b4336['model'],qs[_0x4d7c('0x32')](_0x2f19f6[_0x4d7c('0x2e')][_0x4d7c('0x32')]));_0x634a10['attributes']=_0x634a10[_0x4d7c('0x33')]['length']?_0x634a10[_0x4d7c('0x33')]:_0x1b4336['model'];if(_0x2f19f6[_0x4d7c('0x2e')][_0x4d7c('0x3d')]){_0x634a10[_0x4d7c('0x3e')]=[{'all':!![]}];}_0x634a10=_[_0x4d7c('0x3b')]({},_0x634a10,_0x2f19f6[_0x4d7c('0x43')]);return db[_0x4d7c('0x2a')][_0x4d7c('0x44')](_0x634a10)[_0x4d7c('0x25')](handleEntityNotFound(_0x5a292c,null))[_0x4d7c('0x25')](respondWithResult(_0x5a292c,null))['catch'](handleError(_0x5a292c,null));};exports[_0x4d7c('0x45')]=function(_0x198e78,_0x2a9945){return db[_0x4d7c('0x2a')][_0x4d7c('0x45')](_0x198e78[_0x4d7c('0x46')],{})[_0x4d7c('0x25')](function(_0x294990){var _0x4f1474=_0x198e78['user']['get']({'plain':!![]});if(!_0x4f1474)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f1474[_0x4d7c('0x47')]===_0x4d7c('0x48')){var _0x49a429=_0x294990[_0x4d7c('0x49')]({'plain':!![]});var _0x373449=_0x4d7c('0x4a');return db[_0x4d7c('0x4b')]['find']({'where':{'name':_0x373449,'userProfileId':_0x4f1474['userProfileId']},'raw':!![]})[_0x4d7c('0x25')](function(_0xb01b16){if(_0xb01b16&&_0xb01b16[_0x4d7c('0x4c')]===0x0){return db[_0x4d7c('0x4d')]['create']({'name':_0x49a429[_0x4d7c('0x27')],'resourceId':_0x49a429['id'],'type':_0xb01b16[_0x4d7c('0x27')],'sectionId':_0xb01b16['id']},{})[_0x4d7c('0x25')](function(){return _0x294990;});}else{return _0x294990;}})['catch'](function(_0x5f1ba4){logger[_0x4d7c('0x4e')](_0x4d7c('0x4f'),_0x5f1ba4);throw _0x5f1ba4;});}return _0x294990;})['then'](respondWithResult(_0x2a9945,0xc9))[_0x4d7c('0x40')](handleError(_0x2a9945,null));};exports['update']=function(_0x498659,_0x4e290f){if(_0x498659['body']['id']){delete _0x498659[_0x4d7c('0x46')]['id'];}return db[_0x4d7c('0x2a')]['find']({'where':{'id':_0x498659[_0x4d7c('0x41')]['id']}})[_0x4d7c('0x25')](handleEntityNotFound(_0x4e290f,null))[_0x4d7c('0x25')](saveUpdates(_0x498659[_0x4d7c('0x46')],null))[_0x4d7c('0x25')](respondWithResult(_0x4e290f,null))[_0x4d7c('0x40')](handleError(_0x4e290f,null));};exports['destroy']=function(_0x214b12,_0x232dca){var _0x52e06e=_0x214b12[_0x4d7c('0x41')]['id'];var _0x4a80e7=[];return db[_0x4d7c('0x50')][_0x4d7c('0x51')](function(_0x16ade5){var _0x5492d7='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x52e06e;return db[_0x4d7c('0x50')][_0x4d7c('0x2e')](_0x5492d7,{'type':db[_0x4d7c('0x52')]['QueryTypes'][_0x4d7c('0x53')],'raw':!![],'transaction':_0x16ade5})['then'](function(_0x52f050){_0x4a80e7=_[_0x4d7c('0x29')](_0x52f050,function(_0x4e7d50){return Number(_0x4e7d50[_0x4d7c('0x54')]);});})[_0x4d7c('0x25')](function(){var _0x23456e=_0x4d7c('0x55')+_0x52e06e;return db[_0x4d7c('0x50')]['query'](_0x23456e,{'type':db[_0x4d7c('0x52')][_0x4d7c('0x56')][_0x4d7c('0x53')],'raw':!![],'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(_0x5c6af5){var _0xe3c971=_[_0x4d7c('0x29')](_0x5c6af5,function(_0x362d36){return Number(_0x362d36[_0x4d7c('0x57')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x4a80e7},'VoiceQueueId':{'$in':_0xe3c971}},'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(){var _0x32f3bf=_0x4d7c('0x58')+_0x52e06e;return db[_0x4d7c('0x50')]['query'](_0x32f3bf,{'type':db[_0x4d7c('0x52')][_0x4d7c('0x56')]['SELECT'],'raw':!![],'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(_0x3bec85){var _0x3f4738=_[_0x4d7c('0x29')](_0x3bec85,function(_0x4662b9){return Number(_0x4662b9[_0x4d7c('0x59')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x4a80e7},'MailQueueId':{'$in':_0x3f4738}},'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(){var _0x2c33f1=_0x4d7c('0x5a')+_0x52e06e;return db['sequelize']['query'](_0x2c33f1,{'type':db[_0x4d7c('0x52')][_0x4d7c('0x56')]['SELECT'],'raw':!![],'transaction':_0x16ade5});})['then'](function(_0x516dbb){var _0x5caf63=_[_0x4d7c('0x29')](_0x516dbb,function(_0x3f893c){return Number(_0x3f893c[_0x4d7c('0x5b')]);});return db['UserSmsQueue'][_0x4d7c('0x5c')]({'where':{'UserId':{'$in':_0x4a80e7},'SmsQueueId':{'$in':_0x5caf63}},'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(){var _0x1582ca=_0x4d7c('0x5d')+_0x52e06e;return db[_0x4d7c('0x50')][_0x4d7c('0x2e')](_0x1582ca,{'type':db[_0x4d7c('0x52')][_0x4d7c('0x56')][_0x4d7c('0x53')],'raw':!![],'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(_0x23045a){var _0x1e34cc=_[_0x4d7c('0x29')](_0x23045a,function(_0x1fa329){return Number(_0x1fa329[_0x4d7c('0x5e')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x4a80e7},'ChatQueueId':{'$in':_0x1e34cc}},'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(){var _0x4195aa=_0x4d7c('0x5f')+_0x52e06e;return db[_0x4d7c('0x50')]['query'](_0x4195aa,{'type':db['Sequelize'][_0x4d7c('0x56')][_0x4d7c('0x53')],'raw':!![],'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(_0x4e5f6e){var _0x40806b=_['map'](_0x4e5f6e,function(_0x3a42bb){return Number(_0x3a42bb[_0x4d7c('0x60')]);});return db[_0x4d7c('0x61')][_0x4d7c('0x5c')]({'where':{'UserId':{'$in':_0x4a80e7},'FaxQueueId':{'$in':_0x40806b}},'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(){var _0x17f6c1=_0x4d7c('0x62')+_0x52e06e;return db[_0x4d7c('0x50')]['query'](_0x17f6c1,{'type':db[_0x4d7c('0x52')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(_0x26d8f1){var _0x1babea=_[_0x4d7c('0x29')](_0x26d8f1,function(_0x3c586e){return Number(_0x3c586e[_0x4d7c('0x63')]);});return db[_0x4d7c('0x64')][_0x4d7c('0x5c')]({'where':{'UserId':{'$in':_0x4a80e7},'OpenchannelQueueId':{'$in':_0x1babea}},'transaction':_0x16ade5});})['then'](function(){var _0x3f0cdc=_0x4d7c('0x65')+_0x52e06e;return db['sequelize'][_0x4d7c('0x2e')](_0x3f0cdc,{'type':db[_0x4d7c('0x52')][_0x4d7c('0x56')][_0x4d7c('0x53')],'raw':!![],'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(_0xc343c9){var _0x1c3eb2=_[_0x4d7c('0x29')](_0xc343c9,function(_0x2b6450){return Number(_0x2b6450[_0x4d7c('0x66')]);});return db[_0x4d7c('0x67')]['destroy']({'where':{'UserId':{'$in':_0x4a80e7},'WhatsappQueueId':{'$in':_0x1c3eb2}},'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(){return db[_0x4d7c('0x68')]['find']({'where':{'TeamId':_0x52e06e}});})[_0x4d7c('0x25')](function(_0x3acfd7){if(_0x3acfd7===null){return;}return db[_0x4d7c('0x69')][_0x4d7c('0x5c')]({'where':{'UserId':{'$in':_0x4a80e7},'VoicePrefixId':_0x3acfd7['VoicePrefixId']},'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(){return db[_0x4d7c('0x2a')][_0x4d7c('0x5c')]({'where':{'id':_0x52e06e},'cascade':!![],'transaction':_0x16ade5});})[_0x4d7c('0x25')](function(_0x5cba7d){if(_0x5cba7d===0x0){_0x232dca['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x4d7c('0x5c')]({'where':{'type':_0x4d7c('0x4a'),'resourceId':_0x52e06e},'cascade':!![],'transaction':_0x16ade5})['then'](function(){_0x232dca[_0x4d7c('0x1b')](0xcc)['end']();});}})[_0x4d7c('0x40')](function(_0x5c88af){_0x232dca[_0x4d7c('0x1b')](0x1f4)[_0x4d7c('0x6a')](_0x5c88af);});});};exports['getQueues']=function(_0x564ce5,_0x4ff949,_0x3e341d){return db[_0x4d7c('0x2a')][_0x4d7c('0x6b')]({'where':{'id':_0x564ce5[_0x4d7c('0x41')]['id']}})[_0x4d7c('0x25')](handleEntityNotFound(_0x4ff949,null))[_0x4d7c('0x25')](function(_0x18731a){if(!_0x564ce5[_0x4d7c('0x2e')]['channel']||!utils[_0x4d7c('0x6c')](_0x564ce5[_0x4d7c('0x2e')][_0x4d7c('0x6d')])){throw new db[(_0x4d7c('0x52'))][(_0x4d7c('0x6e'))](_0x4d7c('0x6f'));}var _0x5162e4={};var _0x3962cc={};_0x3962cc[_0x4d7c('0x31')]=_[_0x4d7c('0x42')](db[_[_0x4d7c('0x70')](_0x564ce5['query'][_0x4d7c('0x6d')][_0x4d7c('0x71')]())+_0x4d7c('0x72')][_0x4d7c('0x2b')]);_0x3962cc[_0x4d7c('0x2e')]=_[_0x4d7c('0x42')](_0x564ce5['query']);_0x3962cc[_0x4d7c('0x2f')]=_[_0x4d7c('0x30')](_0x3962cc[_0x4d7c('0x31')],_0x3962cc[_0x4d7c('0x2e')]);_0x5162e4['attributes']=_[_0x4d7c('0x30')](_0x3962cc[_0x4d7c('0x31')],qs['fields'](_0x564ce5[_0x4d7c('0x2e')][_0x4d7c('0x32')]));_0x5162e4[_0x4d7c('0x33')]=_0x5162e4[_0x4d7c('0x33')][_0x4d7c('0x34')]?_0x5162e4['attributes']:_0x3962cc[_0x4d7c('0x31')];_0x5162e4[_0x4d7c('0x20')]=qs[_0x4d7c('0x20')](_0x564ce5['query']['limit']);_0x5162e4[_0x4d7c('0x1f')]=qs[_0x4d7c('0x1f')](_0x564ce5['query'][_0x4d7c('0x1f')]);_0x5162e4['order']=qs[_0x4d7c('0x37')](_0x564ce5[_0x4d7c('0x2e')][_0x4d7c('0x37')]);_0x5162e4[_0x4d7c('0x38')]=qs[_0x4d7c('0x2f')](_['pick'](_0x564ce5[_0x4d7c('0x2e')],_0x3962cc[_0x4d7c('0x2f')]));_0x5162e4=_[_0x4d7c('0x3b')]({},_0x5162e4,_0x564ce5['options']);return _0x18731a[_0x4d7c('0x49')+_[_0x4d7c('0x70')](_0x564ce5[_0x4d7c('0x2e')]['channel'][_0x4d7c('0x71')]())+'Queues'](_0x5162e4);})['then'](respondWithResult(_0x4ff949,null))[_0x4d7c('0x40')](handleError(_0x4ff949,null));};exports[_0x4d7c('0x73')]=function(_0x3b74be,_0x458691,_0x9d65af){return db[_0x4d7c('0x2a')][_0x4d7c('0x6b')]({'where':{'id':_0x3b74be[_0x4d7c('0x41')]['id']}})[_0x4d7c('0x25')](function(_0x3495d5){if(_0x3495d5){if(!_0x3b74be[_0x4d7c('0x46')][_0x4d7c('0x6d')]||!utils[_0x4d7c('0x6c')](_0x3b74be['body'][_0x4d7c('0x6d')])){throw new db[(_0x4d7c('0x52'))][(_0x4d7c('0x6e'))](_0x4d7c('0x6f'));}return _0x3495d5[_0x4d7c('0x74')+_[_0x4d7c('0x70')](_0x3b74be[_0x4d7c('0x46')][_0x4d7c('0x6d')][_0x4d7c('0x71')]())+_0x4d7c('0x75')](_0x3b74be[_0x4d7c('0x46')][_0x4d7c('0x76')]);}return null;})[_0x4d7c('0x25')](handleEntityNotFound(_0x458691,null))[_0x4d7c('0x25')](respondWithStatusCode(_0x458691,null))[_0x4d7c('0x40')](handleError(_0x458691,null));};exports['removeQueues']=function(_0x5488b4,_0x1486e2,_0x1396fa){return db[_0x4d7c('0x2a')][_0x4d7c('0x6b')]({'where':{'id':_0x5488b4['params']['id']}})[_0x4d7c('0x25')](function(_0x3dbaea){if(_0x3dbaea){if(!_0x5488b4[_0x4d7c('0x2e')][_0x4d7c('0x6d')]||!utils['isValidChannel'](_0x5488b4[_0x4d7c('0x2e')]['channel'])){throw new db[(_0x4d7c('0x52'))][(_0x4d7c('0x6e'))](_0x4d7c('0x6f'));}return _0x3dbaea[_0x4d7c('0x77')+_[_0x4d7c('0x70')](_0x5488b4[_0x4d7c('0x2e')]['channel'][_0x4d7c('0x71')]())+_0x4d7c('0x75')](_0x5488b4['query'][_0x4d7c('0x76')]);}return null;})['then'](handleEntityNotFound(_0x1486e2,null))[_0x4d7c('0x25')](respondWithStatusCode(_0x1486e2,null))[_0x4d7c('0x40')](handleError(_0x1486e2,null));};exports[_0x4d7c('0x78')]=function(_0x18db55,_0x1efbc3){var _0x4e2809=_[_0x4d7c('0x79')](_0x18db55[_0x4d7c('0x46')]['ids'])?_0x18db55[_0x4d7c('0x46')][_0x4d7c('0x76')]:[_0x18db55[_0x4d7c('0x46')][_0x4d7c('0x76')]];var _0x19a902=_0x18db55[_0x4d7c('0x41')]['id'];return db[_0x4d7c('0x2a')][_0x4d7c('0x44')]({'where':{'id':_0x19a902}})[_0x4d7c('0x25')](handleEntityNotFound(_0x1efbc3,null))[_0x4d7c('0x25')](function(_0x3edc8d){if(_0x3edc8d){var _0x589b82=[_0x4d7c('0x7a'),_0x4d7c('0x7b'),_0x4d7c('0x7c'),_0x4d7c('0x7d'),_0x4d7c('0x7e'),'Openchannel',_0x4d7c('0x7f')];return db[_0x4d7c('0x50')]['transaction'](function(_0x1c78c6){var _0x9c00d0=_[_0x4d7c('0x29')](_0x589b82,function(_0x3774e7){var _0x2290f6={'attributes':['id',_0x4d7c('0x27')]};if(_0x3774e7==='Voice'){_0x2290f6['through']={'attributes':['penalty']};}return _0x3edc8d['get'+_0x3774e7+_0x4d7c('0x75')](_0x2290f6)[_0x4d7c('0x25')](function(_0x40d319){var _0x48d6e5=_[_0x4d7c('0x29')](_0x40d319,function(_0x29eb45){var _0x175165=_[_0x4d7c('0x29')](_0x4e2809,function(_0x1d9512){var _0x22c998={'where':{'UserId':_0x1d9512,[_0x3774e7+_0x4d7c('0x80')]:_0x29eb45['id']},'transaction':_0x1c78c6};if(_0x3774e7===_0x4d7c('0x7a')){_0x22c998['defaults']={'penalty':_0x29eb45['TeamVoiceQueue'][_0x4d7c('0x81')]};}return db[_0x4d7c('0x82')+_0x3774e7+_0x4d7c('0x72')][_0x4d7c('0x83')](_0x22c998)[_0x4d7c('0x25')](function(){socket[_0x4d7c('0x84')](_0x4d7c('0x48')+_0x3774e7+'Queue:save',{'UserId':_0x1d9512,[_0x3774e7+_0x4d7c('0x80')]:_0x29eb45['id']});if(_0x3774e7!==_0x4d7c('0x7a')){return;}return db[_0x4d7c('0x82')][_0x4d7c('0x3f')]({'where':{'id':_0x4e2809,'online':0x1},'attributes':['id',_0x4d7c('0x27'),_0x4d7c('0x85'),_0x4d7c('0x86'),_0x4d7c('0x87')],'raw':!![]})[_0x4d7c('0x25')](function(_0x5e4155){var _0x178f72=_['map'](_0x5e4155,function(_0xbfc77d){return db['UserVoiceQueueRt'][_0x4d7c('0x88')]({'membername':_0xbfc77d[_0x4d7c('0x27')],'UserId':_0xbfc77d['id'],'queue_name':_0x29eb45[_0x4d7c('0x27')],'VoiceQueueId':_0x29eb45['id'],'interface':_[_0x4d7c('0x89')](_0xbfc77d[_0x4d7c('0x87')])?util[_0x4d7c('0x8a')](_0x4d7c('0x8b'),_0xbfc77d[_0x4d7c('0x27')]):_0xbfc77d['interface'],'paused':_0xbfc77d['voicePause']||![],'penalty':_0x29eb45[_0x4d7c('0x8c')]['penalty']},{'transaction':_0x1c78c6});});return Promise['all'](_0x178f72);});});});return Promise[_0x4d7c('0x8d')](_0x175165);});return Promise[_0x4d7c('0x8d')](_0x48d6e5);})['then'](function(){return db[_0x4d7c('0x68')][_0x4d7c('0x6b')]({'where':{'teamId':_0x19a902}})[_0x4d7c('0x25')](function(_0x2bc9d2){if(_0x2bc9d2){var _0xe5afac=_[_0x4d7c('0x29')](_0x4e2809,function(_0x28d560){db[_0x4d7c('0x69')][_0x4d7c('0x88')]({'UserId':_0x28d560,'VoicePrefixId':_0x2bc9d2['VoicePrefixId']});});return Promise[_0x4d7c('0x8d')](_0xe5afac);}});});});return Promise[_0x4d7c('0x8d')](_0x9c00d0)[_0x4d7c('0x25')](function(){return _0x3edc8d[_0x4d7c('0x78')](_0x4e2809,{'transaction':_0x1c78c6})[_0x4d7c('0x8e')](function(_0x41a9a1){return _0x41a9a1;});});});}})['then'](respondWithResult(_0x1efbc3,null))[_0x4d7c('0x40')](handleError(_0x1efbc3,null));};exports['removeAgents']=function(_0x40fc1c,_0x4a1e15){var _0xe24404=_[_0x4d7c('0x79')](_0x40fc1c[_0x4d7c('0x2e')][_0x4d7c('0x76')])?_0x40fc1c[_0x4d7c('0x2e')][_0x4d7c('0x76')]:[_0x40fc1c['query'][_0x4d7c('0x76')]];var _0x1494f2=_0x40fc1c['params']['id'];return db[_0x4d7c('0x2a')][_0x4d7c('0x44')]({'where':{'id':_0x1494f2}})[_0x4d7c('0x25')](handleEntityNotFound(_0x4a1e15,null))[_0x4d7c('0x25')](function(_0x40d8a9){if(_0x40d8a9){var _0x244815=[_0x4d7c('0x7a'),_0x4d7c('0x7b'),_0x4d7c('0x7c'),_0x4d7c('0x7d'),_0x4d7c('0x7e'),'Openchannel','Whatsapp'];return db[_0x4d7c('0x50')][_0x4d7c('0x51')](function(_0x221780){var _0x598a69=_[_0x4d7c('0x29')](_0x244815,function(_0xa94af5){var _0x5512d2={'attributes':['id',_0x4d7c('0x27')]};return _0x40d8a9['get'+_0xa94af5+_0x4d7c('0x75')](_0x5512d2)[_0x4d7c('0x25')](function(_0xd0dcc6){var _0x5b5daf=_[_0x4d7c('0x29')](_0xd0dcc6,function(_0x1046b3){return _0x1046b3['removeAgents'](_0xe24404,{'transaction':_0x221780})[_0x4d7c('0x25')](function(){var _0x1b0c32=_[_0x4d7c('0x29')](_0xe24404,function(_0x5c9ac6){socket[_0x4d7c('0x84')](_0x4d7c('0x48')+_0xa94af5+_0x4d7c('0x8f'),{'UserId':Number(_0x5c9ac6),[_0xa94af5+_0x4d7c('0x80')]:_0x1046b3['id']});if(_0xa94af5!==_0x4d7c('0x7a')){return;}return db[_0x4d7c('0x90')][_0x4d7c('0x5c')]({'where':{'VoiceQueueId':_0x1046b3['id'],'UserId':_0x5c9ac6},'transaction':_0x221780});});return Promise['all'](_0x1b0c32);});});return Promise['all'](_0x5b5daf);});});return Promise[_0x4d7c('0x8d')](_0x598a69)[_0x4d7c('0x25')](function(){return _0x40d8a9[_0x4d7c('0x91')](_0xe24404,{'transaction':_0x221780});})[_0x4d7c('0x25')](function(){return db['TeamVoicePrefix'][_0x4d7c('0x6b')]({'where':{'teamId':_0x1494f2}})[_0x4d7c('0x25')](function(_0x26cd84){if(_0x26cd84){var _0x2ef98f=_[_0x4d7c('0x29')](_0xe24404,function(_0x1bfdec){db[_0x4d7c('0x69')][_0x4d7c('0x5c')]({'where':{'UserId':_0x1bfdec,'VoicePrefixId':_0x26cd84[_0x4d7c('0x92')]}});});return Promise[_0x4d7c('0x8d')](_0x2ef98f);}});});});}})[_0x4d7c('0x25')](respondWithStatusCode(_0x4a1e15,null))['catch'](handleError(_0x4a1e15,null));};exports[_0x4d7c('0x93')]=function(_0x83e463,_0x41abb5,_0x180dc7){var _0x317263={};var _0x47b684={};var _0x22dd10;var _0x4d5db4;return db['Team'][_0x4d7c('0x6b')]({'where':{'id':_0x83e463[_0x4d7c('0x41')]['id']}})[_0x4d7c('0x25')](handleEntityNotFound(_0x41abb5,null))[_0x4d7c('0x25')](function(_0x17a080){if(_0x17a080){_0x22dd10=_0x17a080;_0x47b684[_0x4d7c('0x31')]=_[_0x4d7c('0x42')](db[_0x4d7c('0x82')][_0x4d7c('0x2b')]);_0x47b684[_0x4d7c('0x2e')]=_[_0x4d7c('0x42')](_0x83e463[_0x4d7c('0x2e')]);_0x47b684['filters']=_[_0x4d7c('0x30')](_0x47b684[_0x4d7c('0x31')],_0x47b684[_0x4d7c('0x2e')]);_0x317263['attributes']=_[_0x4d7c('0x30')](_0x47b684[_0x4d7c('0x31')],qs['fields'](_0x83e463[_0x4d7c('0x2e')][_0x4d7c('0x32')]));_0x317263['attributes']=_0x317263[_0x4d7c('0x33')][_0x4d7c('0x34')]?_0x317263[_0x4d7c('0x33')]:_0x47b684[_0x4d7c('0x31')];_0x317263[_0x4d7c('0x94')]=qs[_0x4d7c('0x37')](_0x83e463[_0x4d7c('0x2e')][_0x4d7c('0x37')]);_0x317263['where']=qs[_0x4d7c('0x2f')](_[_0x4d7c('0x39')](_0x83e463['query'],_0x47b684[_0x4d7c('0x2f')]));if(_0x83e463[_0x4d7c('0x2e')]['filter']){_0x317263['where']=_['merge'](_0x317263[_0x4d7c('0x38')],{'$or':_[_0x4d7c('0x29')](_0x317263[_0x4d7c('0x33')],function(_0x3a8115){var _0x3cdfc2={};_0x3cdfc2[_0x3a8115]={'$like':'%'+_0x83e463['query'][_0x4d7c('0x3a')]+'%'};return _0x3cdfc2;})});}_0x317263=_['merge']({},_0x317263,_0x83e463['options']);return _0x22dd10[_0x4d7c('0x93')](_0x317263);}})['then'](function(_0xbc4a96){if(_0xbc4a96){_0x4d5db4=_0xbc4a96[_0x4d7c('0x34')];if(!_0x83e463[_0x4d7c('0x2e')]['hasOwnProperty']('nolimit')){_0x317263['limit']=qs[_0x4d7c('0x20')](_0x83e463[_0x4d7c('0x2e')][_0x4d7c('0x20')]);_0x317263[_0x4d7c('0x1f')]=qs[_0x4d7c('0x1f')](_0x83e463[_0x4d7c('0x2e')]['offset']);}return _0x22dd10[_0x4d7c('0x93')](_0x317263);}})['then'](function(_0x8b1fa2){if(_0x8b1fa2){return _0x8b1fa2?{'count':_0x4d5db4,'rows':_0x8b1fa2}:null;}})['then'](respondWithResult(_0x41abb5,null))[_0x4d7c('0x40')](handleError(_0x41abb5,null));}; \ No newline at end of file +var _0x5ad9=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','Team','include','findAll','then','rows','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','Queue','pick','toLowerCase','Queues','addQueues','add','ids','removeQueues','remove','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','addAgents','spread','removeAgents','getAgents','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','stack','name','send','index','map','rawAttributes'];(function(_0xdb974d,_0xad937e){var _0x3f6929=function(_0x15908f){while(--_0x15908f){_0xdb974d['push'](_0xdb974d['shift']());}};_0x3f6929(++_0xad937e);}(_0x5ad9,0x1a4));var _0x95ad=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5ad9[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x95ad('0x0'));var rimraf=require(_0x95ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ad('0x2'));var rp=require(_0x95ad('0x3'));var moment=require(_0x95ad('0x4'));var BPromise=require(_0x95ad('0x5'));var Mustache=require(_0x95ad('0x6'));var util=require(_0x95ad('0x7'));var path=require(_0x95ad('0x8'));var sox=require('sox');var csv=require(_0x95ad('0x9'));var ejs=require(_0x95ad('0xa'));var fs=require('fs');var fs_extra=require(_0x95ad('0xb'));var _=require(_0x95ad('0xc'));var squel=require(_0x95ad('0xd'));var crypto=require(_0x95ad('0xe'));var jsforce=require(_0x95ad('0xf'));var deskjs=require(_0x95ad('0x10'));var toCsv=require(_0x95ad('0x9'));var querystring=require(_0x95ad('0x11'));var Papa=require(_0x95ad('0x12'));var Redis=require(_0x95ad('0x13'));var authService=require(_0x95ad('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x95ad('0x15'));var hardwareService=require(_0x95ad('0x16'));var logger=require(_0x95ad('0x17'))('api');var utils=require(_0x95ad('0x18'));var config=require(_0x95ad('0x19'));var licenseUtil=require(_0x95ad('0x1a'));var db=require(_0x95ad('0x1b'))['db'];config[_0x95ad('0x1c')]=_[_0x95ad('0x1d')](config['redis'],{'host':_0x95ad('0x1e'),'port':0x18eb});var socket=require(_0x95ad('0x1f'))(new Redis(config[_0x95ad('0x1c')]));require(_0x95ad('0x20'))['register'](socket);function respondWithStatusCode(_0x65c175,_0x1a92ca){_0x1a92ca=_0x1a92ca||0xcc;return function(_0x497ed8){if(_0x497ed8){return _0x65c175[_0x95ad('0x21')](_0x1a92ca);}return _0x65c175[_0x95ad('0x22')](_0x1a92ca)[_0x95ad('0x23')]();};}function respondWithResult(_0x1e0e0d,_0x1a6ade){_0x1a6ade=_0x1a6ade||0xc8;return function(_0x5ee145){if(_0x5ee145){return _0x1e0e0d['status'](_0x1a6ade)[_0x95ad('0x24')](_0x5ee145);}};}function respondWithFilteredResult(_0x384856,_0x43f3c7){return function(_0x27fc36){if(_0x27fc36){var _0x163adb=typeof _0x43f3c7[_0x95ad('0x25')]==='undefined'&&typeof _0x43f3c7[_0x95ad('0x26')]===_0x95ad('0x27');var _0x69191=_0x27fc36[_0x95ad('0x28')];var _0x33fc62=_0x163adb?0x0:_0x43f3c7[_0x95ad('0x25')];var _0x25e4c0=_0x163adb?_0x27fc36['count']:_0x43f3c7[_0x95ad('0x25')]+_0x43f3c7[_0x95ad('0x26')];var _0x2f11aa;if(_0x25e4c0>=_0x69191){_0x25e4c0=_0x69191;_0x2f11aa=0xc8;}else{_0x2f11aa=0xce;}_0x384856[_0x95ad('0x22')](_0x2f11aa);return _0x384856[_0x95ad('0x29')](_0x95ad('0x2a'),_0x33fc62+'-'+_0x25e4c0+'/'+_0x69191)['json'](_0x27fc36);}return null;};}function patchUpdates(_0x1957e3){return function(_0x2ae3cc){try{jsonpatch[_0x95ad('0x2b')](_0x2ae3cc,_0x1957e3,!![]);}catch(_0x13d943){return BPromise['reject'](_0x13d943);}return _0x2ae3cc['save']();};}function saveUpdates(_0x50f770,_0x5df262){return function(_0x141e44){if(_0x141e44){return _0x141e44[_0x95ad('0x2c')](_0x50f770)['then'](function(_0x369e72){return _0x369e72;});}return null;};}function handleEntityNotFound(_0xba6f6f,_0x45aa4d){return function(_0x280ef2){if(!_0x280ef2){_0xba6f6f['sendStatus'](0x194);}return _0x280ef2;};}function handleError(_0x69180d,_0x37edbf){_0x37edbf=_0x37edbf||0x1f4;return function(_0x311b60){logger['error'](_0x311b60[_0x95ad('0x2d')]);if(_0x311b60[_0x95ad('0x2e')]){delete _0x311b60[_0x95ad('0x2e')];}_0x69180d['status'](_0x37edbf)[_0x95ad('0x2f')](_0x311b60);};}exports[_0x95ad('0x30')]=function(_0x3ce9bd,_0xaed44f){var _0x47c0fd={},_0x3de117={},_0x28d2b3={'count':0x0,'rows':[]};var _0x9dbe0=_[_0x95ad('0x31')](db['Team'][_0x95ad('0x32')],function(_0x2b8b82){return{'name':_0x2b8b82[_0x95ad('0x33')],'type':_0x2b8b82[_0x95ad('0x34')][_0x95ad('0x35')]};});_0x3de117[_0x95ad('0x36')]=_[_0x95ad('0x31')](_0x9dbe0,'name');_0x3de117[_0x95ad('0x37')]=_[_0x95ad('0x38')](_0x3ce9bd[_0x95ad('0x37')]);_0x3de117[_0x95ad('0x39')]=_[_0x95ad('0x3a')](_0x3de117['model'],_0x3de117[_0x95ad('0x37')]);_0x47c0fd[_0x95ad('0x3b')]=_[_0x95ad('0x3a')](_0x3de117[_0x95ad('0x36')],qs[_0x95ad('0x3c')](_0x3ce9bd[_0x95ad('0x37')][_0x95ad('0x3c')]));_0x47c0fd[_0x95ad('0x3b')]=_0x47c0fd[_0x95ad('0x3b')]['length']?_0x47c0fd['attributes']:_0x3de117[_0x95ad('0x36')];if(!_0x3ce9bd['query'][_0x95ad('0x3d')]('nolimit')){_0x47c0fd[_0x95ad('0x26')]=qs[_0x95ad('0x26')](_0x3ce9bd[_0x95ad('0x37')][_0x95ad('0x26')]);_0x47c0fd['offset']=qs[_0x95ad('0x25')](_0x3ce9bd['query']['offset']);}_0x47c0fd[_0x95ad('0x3e')]=qs['sort'](_0x3ce9bd[_0x95ad('0x37')][_0x95ad('0x3f')]);_0x47c0fd[_0x95ad('0x40')]=qs[_0x95ad('0x39')](_['pick'](_0x3ce9bd[_0x95ad('0x37')],_0x3de117['filters']),_0x9dbe0);if(_0x3ce9bd[_0x95ad('0x37')][_0x95ad('0x41')]){_0x47c0fd[_0x95ad('0x40')]=_[_0x95ad('0x42')](_0x47c0fd['where'],{'$or':_[_0x95ad('0x31')](_0x9dbe0,function(_0x3c3120){if(_0x3c3120['type']!=='VIRTUAL'){var _0x2008e8={};_0x2008e8[_0x3c3120[_0x95ad('0x2e')]]={'$like':'%'+_0x3ce9bd[_0x95ad('0x37')][_0x95ad('0x41')]+'%'};return _0x2008e8;}})});}_0x47c0fd=_[_0x95ad('0x42')]({},_0x47c0fd,_0x3ce9bd[_0x95ad('0x43')]);var _0x4ba979={'where':_0x47c0fd[_0x95ad('0x40')]};return db[_0x95ad('0x44')][_0x95ad('0x28')](_0x4ba979)['then'](function(_0x19d2a1){_0x28d2b3[_0x95ad('0x28')]=_0x19d2a1;if(_0x3ce9bd[_0x95ad('0x37')]['includeAll']){_0x47c0fd[_0x95ad('0x45')]=[{'all':!![]}];}return db['Team'][_0x95ad('0x46')](_0x47c0fd);})[_0x95ad('0x47')](function(_0x2e9523){_0x28d2b3[_0x95ad('0x48')]=_0x2e9523;return _0x28d2b3;})['then'](respondWithFilteredResult(_0xaed44f,_0x47c0fd))['catch'](handleError(_0xaed44f,null));};exports['show']=function(_0x1f0af2,_0x528427){var _0x233235={'raw':![],'where':{'id':_0x1f0af2['params']['id']}},_0x573c33={};_0x573c33[_0x95ad('0x36')]=_['keys'](db[_0x95ad('0x44')][_0x95ad('0x32')]);_0x573c33[_0x95ad('0x37')]=_[_0x95ad('0x38')](_0x1f0af2['query']);_0x573c33[_0x95ad('0x39')]=_['intersection'](_0x573c33[_0x95ad('0x36')],_0x573c33[_0x95ad('0x37')]);_0x233235[_0x95ad('0x3b')]=_['intersection'](_0x573c33['model'],qs[_0x95ad('0x3c')](_0x1f0af2['query']['fields']));_0x233235[_0x95ad('0x3b')]=_0x233235[_0x95ad('0x3b')][_0x95ad('0x49')]?_0x233235[_0x95ad('0x3b')]:_0x573c33['model'];if(_0x1f0af2[_0x95ad('0x37')]['includeAll']){_0x233235[_0x95ad('0x45')]=[{'all':!![]}];}_0x233235=_[_0x95ad('0x42')]({},_0x233235,_0x1f0af2[_0x95ad('0x43')]);return db[_0x95ad('0x44')][_0x95ad('0x4a')](_0x233235)[_0x95ad('0x47')](handleEntityNotFound(_0x528427,null))[_0x95ad('0x47')](respondWithResult(_0x528427,null))[_0x95ad('0x4b')](handleError(_0x528427,null));};exports[_0x95ad('0x4c')]=function(_0xf18997,_0xff69df){return db[_0x95ad('0x44')][_0x95ad('0x4c')](_0xf18997[_0x95ad('0x4d')],{})[_0x95ad('0x47')](function(_0x2c30a5){var _0xda1a8d=_0xf18997[_0x95ad('0x4e')][_0x95ad('0x4f')]({'plain':!![]});if(!_0xda1a8d)throw new Error(_0x95ad('0x50'));if(_0xda1a8d['role']===_0x95ad('0x4e')){var _0x3cc6dc=_0x2c30a5[_0x95ad('0x4f')]({'plain':!![]});var _0x4c3246=_0x95ad('0x51');return db[_0x95ad('0x52')]['find']({'where':{'name':_0x4c3246,'userProfileId':_0xda1a8d[_0x95ad('0x53')]},'raw':!![]})[_0x95ad('0x47')](function(_0x14b328){if(_0x14b328&&_0x14b328['autoAssociation']===0x0){return db[_0x95ad('0x54')][_0x95ad('0x4c')]({'name':_0x3cc6dc[_0x95ad('0x2e')],'resourceId':_0x3cc6dc['id'],'type':_0x14b328[_0x95ad('0x2e')],'sectionId':_0x14b328['id']},{})[_0x95ad('0x47')](function(){return _0x2c30a5;});}else{return _0x2c30a5;}})[_0x95ad('0x4b')](function(_0x29f4d2){logger['error'](_0x95ad('0x55'),_0x29f4d2);throw _0x29f4d2;});}return _0x2c30a5;})[_0x95ad('0x47')](respondWithResult(_0xff69df,0xc9))[_0x95ad('0x4b')](handleError(_0xff69df,null));};exports[_0x95ad('0x2c')]=function(_0xa1822f,_0x569485){if(_0xa1822f['body']['id']){delete _0xa1822f['body']['id'];}return db[_0x95ad('0x44')]['find']({'where':{'id':_0xa1822f[_0x95ad('0x56')]['id']}})[_0x95ad('0x47')](handleEntityNotFound(_0x569485,null))[_0x95ad('0x47')](saveUpdates(_0xa1822f['body'],null))[_0x95ad('0x47')](respondWithResult(_0x569485,null))[_0x95ad('0x4b')](handleError(_0x569485,null));};exports[_0x95ad('0x57')]=function(_0x8e9266,_0x2f0c37){var _0x4d9d18=_0x8e9266[_0x95ad('0x56')]['id'];var _0x4113b3=[];return db[_0x95ad('0x58')][_0x95ad('0x59')](function(_0x33ad3d){var _0x42e3d1=_0x95ad('0x5a')+_0x4d9d18;return db[_0x95ad('0x58')]['query'](_0x42e3d1,{'type':db[_0x95ad('0x5b')][_0x95ad('0x5c')][_0x95ad('0x5d')],'raw':!![],'transaction':_0x33ad3d})[_0x95ad('0x47')](function(_0xf90115){_0x4113b3=_[_0x95ad('0x31')](_0xf90115,function(_0xe1b6f8){return Number(_0xe1b6f8[_0x95ad('0x5e')]);});})[_0x95ad('0x47')](function(){var _0x2468c6=_0x95ad('0x5f')+_0x4d9d18;return db[_0x95ad('0x58')]['query'](_0x2468c6,{'type':db[_0x95ad('0x5b')]['QueryTypes'][_0x95ad('0x5d')],'raw':!![],'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(_0xdb9023){var _0x269fac=_[_0x95ad('0x31')](_0xdb9023,function(_0xb829b0){return Number(_0xb829b0['VoiceQueueId']);});return db[_0x95ad('0x60')][_0x95ad('0x57')]({'where':{'UserId':{'$in':_0x4113b3},'VoiceQueueId':{'$in':_0x269fac}},'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(){var _0x144ded=_0x95ad('0x61')+_0x4d9d18;return db[_0x95ad('0x58')][_0x95ad('0x37')](_0x144ded,{'type':db[_0x95ad('0x5b')][_0x95ad('0x5c')][_0x95ad('0x5d')],'raw':!![],'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(_0x3cf698){var _0xf877c3=_[_0x95ad('0x31')](_0x3cf698,function(_0x563594){return Number(_0x563594[_0x95ad('0x62')]);});return db[_0x95ad('0x63')]['destroy']({'where':{'UserId':{'$in':_0x4113b3},'MailQueueId':{'$in':_0xf877c3}},'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(){var _0xc1376e=_0x95ad('0x64')+_0x4d9d18;return db[_0x95ad('0x58')]['query'](_0xc1376e,{'type':db[_0x95ad('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(_0x2cd4fd){var _0x11ef31=_[_0x95ad('0x31')](_0x2cd4fd,function(_0x5aa5af){return Number(_0x5aa5af[_0x95ad('0x65')]);});return db[_0x95ad('0x66')][_0x95ad('0x57')]({'where':{'UserId':{'$in':_0x4113b3},'SmsQueueId':{'$in':_0x11ef31}},'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(){var _0x118747=_0x95ad('0x67')+_0x4d9d18;return db[_0x95ad('0x58')][_0x95ad('0x37')](_0x118747,{'type':db[_0x95ad('0x5b')][_0x95ad('0x5c')][_0x95ad('0x5d')],'raw':!![],'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(_0x3a2044){var _0x24e37e=_['map'](_0x3a2044,function(_0x31d8cf){return Number(_0x31d8cf[_0x95ad('0x68')]);});return db[_0x95ad('0x69')]['destroy']({'where':{'UserId':{'$in':_0x4113b3},'ChatQueueId':{'$in':_0x24e37e}},'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(){var _0x1110d0=_0x95ad('0x6a')+_0x4d9d18;return db[_0x95ad('0x58')]['query'](_0x1110d0,{'type':db[_0x95ad('0x5b')][_0x95ad('0x5c')][_0x95ad('0x5d')],'raw':!![],'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(_0x244451){var _0x475380=_[_0x95ad('0x31')](_0x244451,function(_0x537331){return Number(_0x537331['FaxQueueId']);});return db[_0x95ad('0x6b')][_0x95ad('0x57')]({'where':{'UserId':{'$in':_0x4113b3},'FaxQueueId':{'$in':_0x475380}},'transaction':_0x33ad3d});})['then'](function(){var _0x47e3a9='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4d9d18;return db['sequelize'][_0x95ad('0x37')](_0x47e3a9,{'type':db[_0x95ad('0x5b')][_0x95ad('0x5c')][_0x95ad('0x5d')],'raw':!![],'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(_0x44c800){var _0x1bd48d=_[_0x95ad('0x31')](_0x44c800,function(_0x2d7f19){return Number(_0x2d7f19[_0x95ad('0x6c')]);});return db[_0x95ad('0x6d')][_0x95ad('0x57')]({'where':{'UserId':{'$in':_0x4113b3},'OpenchannelQueueId':{'$in':_0x1bd48d}},'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(){var _0x238ebe='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4d9d18;return db[_0x95ad('0x58')][_0x95ad('0x37')](_0x238ebe,{'type':db[_0x95ad('0x5b')][_0x95ad('0x5c')][_0x95ad('0x5d')],'raw':!![],'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(_0xe04b23){var _0x162699=_[_0x95ad('0x31')](_0xe04b23,function(_0x1e70fa){return Number(_0x1e70fa[_0x95ad('0x6e')]);});return db[_0x95ad('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x4113b3},'WhatsappQueueId':{'$in':_0x162699}},'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(){return db[_0x95ad('0x70')][_0x95ad('0x4a')]({'where':{'TeamId':_0x4d9d18}});})['then'](function(_0x341fc6){if(_0x341fc6===null){return;}return db[_0x95ad('0x71')]['destroy']({'where':{'UserId':{'$in':_0x4113b3},'VoicePrefixId':_0x341fc6[_0x95ad('0x72')]},'transaction':_0x33ad3d});})[_0x95ad('0x47')](function(){return db[_0x95ad('0x44')]['destroy']({'where':{'id':_0x4d9d18},'cascade':!![],'transaction':_0x33ad3d});})['then'](function(_0x7c1829){if(_0x7c1829===0x0){_0x2f0c37[_0x95ad('0x21')](0x194);}else{return db[_0x95ad('0x54')][_0x95ad('0x57')]({'where':{'type':'Teams','resourceId':_0x4d9d18},'cascade':!![],'transaction':_0x33ad3d})[_0x95ad('0x47')](function(){_0x2f0c37[_0x95ad('0x22')](0xcc)[_0x95ad('0x23')]();});}})[_0x95ad('0x4b')](function(_0x5d9790){_0x2f0c37[_0x95ad('0x22')](0x1f4)[_0x95ad('0x2f')](_0x5d9790);});});};exports[_0x95ad('0x73')]=function(_0x111500,_0x1e8fe4,_0x49f637){return db[_0x95ad('0x44')][_0x95ad('0x74')]({'where':{'id':_0x111500[_0x95ad('0x56')]['id']}})[_0x95ad('0x47')](handleEntityNotFound(_0x1e8fe4,null))[_0x95ad('0x47')](function(_0x3543fa){if(!_0x111500[_0x95ad('0x37')][_0x95ad('0x75')]||!utils[_0x95ad('0x76')](_0x111500[_0x95ad('0x37')][_0x95ad('0x75')])){throw new db[(_0x95ad('0x5b'))][(_0x95ad('0x77'))]('Unknown\x20channel');}var _0x2bb754={};var _0x20bd05={};_0x20bd05['model']=_[_0x95ad('0x38')](db[_[_0x95ad('0x78')](_0x111500[_0x95ad('0x37')][_0x95ad('0x75')]['toLowerCase']())+_0x95ad('0x79')][_0x95ad('0x32')]);_0x20bd05['query']=_['keys'](_0x111500['query']);_0x20bd05['filters']=_[_0x95ad('0x3a')](_0x20bd05[_0x95ad('0x36')],_0x20bd05[_0x95ad('0x37')]);_0x2bb754[_0x95ad('0x3b')]=_[_0x95ad('0x3a')](_0x20bd05[_0x95ad('0x36')],qs[_0x95ad('0x3c')](_0x111500['query'][_0x95ad('0x3c')]));_0x2bb754[_0x95ad('0x3b')]=_0x2bb754['attributes']['length']?_0x2bb754[_0x95ad('0x3b')]:_0x20bd05[_0x95ad('0x36')];_0x2bb754[_0x95ad('0x26')]=qs[_0x95ad('0x26')](_0x111500[_0x95ad('0x37')][_0x95ad('0x26')]);_0x2bb754['offset']=qs['offset'](_0x111500['query']['offset']);_0x2bb754[_0x95ad('0x3e')]=qs[_0x95ad('0x3f')](_0x111500[_0x95ad('0x37')][_0x95ad('0x3f')]);_0x2bb754[_0x95ad('0x40')]=qs['filters'](_[_0x95ad('0x7a')](_0x111500[_0x95ad('0x37')],_0x20bd05['filters']));_0x2bb754=_[_0x95ad('0x42')]({},_0x2bb754,_0x111500[_0x95ad('0x43')]);return _0x3543fa[_0x95ad('0x4f')+_[_0x95ad('0x78')](_0x111500[_0x95ad('0x37')][_0x95ad('0x75')][_0x95ad('0x7b')]())+_0x95ad('0x7c')](_0x2bb754);})[_0x95ad('0x47')](respondWithResult(_0x1e8fe4,null))['catch'](handleError(_0x1e8fe4,null));};exports[_0x95ad('0x7d')]=function(_0x4ba9df,_0x1b23f3,_0x174a89){return db[_0x95ad('0x44')][_0x95ad('0x74')]({'where':{'id':_0x4ba9df[_0x95ad('0x56')]['id']}})['then'](function(_0x356218){if(_0x356218){if(!_0x4ba9df[_0x95ad('0x4d')]['channel']||!utils[_0x95ad('0x76')](_0x4ba9df[_0x95ad('0x4d')][_0x95ad('0x75')])){throw new db[(_0x95ad('0x5b'))][(_0x95ad('0x77'))]('Unknown\x20channel');}return _0x356218[_0x95ad('0x7e')+_['capitalize'](_0x4ba9df['body']['channel'][_0x95ad('0x7b')]())+'Queues'](_0x4ba9df[_0x95ad('0x4d')][_0x95ad('0x7f')]);}return null;})[_0x95ad('0x47')](handleEntityNotFound(_0x1b23f3,null))[_0x95ad('0x47')](respondWithStatusCode(_0x1b23f3,null))[_0x95ad('0x4b')](handleError(_0x1b23f3,null));};exports[_0x95ad('0x80')]=function(_0xc25a9f,_0x4d67ae,_0x32492b){return db[_0x95ad('0x44')][_0x95ad('0x74')]({'where':{'id':_0xc25a9f[_0x95ad('0x56')]['id']}})[_0x95ad('0x47')](function(_0x5aa04e){if(_0x5aa04e){if(!_0xc25a9f[_0x95ad('0x37')][_0x95ad('0x75')]||!utils['isValidChannel'](_0xc25a9f[_0x95ad('0x37')][_0x95ad('0x75')])){throw new db[(_0x95ad('0x5b'))][(_0x95ad('0x77'))]('Unknown\x20channel');}return _0x5aa04e[_0x95ad('0x81')+_[_0x95ad('0x78')](_0xc25a9f['query'][_0x95ad('0x75')][_0x95ad('0x7b')]())+_0x95ad('0x7c')](_0xc25a9f[_0x95ad('0x37')][_0x95ad('0x7f')]);}return null;})['then'](handleEntityNotFound(_0x4d67ae,null))['then'](respondWithStatusCode(_0x4d67ae,null))[_0x95ad('0x4b')](handleError(_0x4d67ae,null));};exports['addAgents']=function(_0x51f654,_0x1526ab){var _0x438534=_['isArray'](_0x51f654[_0x95ad('0x4d')][_0x95ad('0x7f')])?_0x51f654[_0x95ad('0x4d')]['ids']:[_0x51f654['body']['ids']];var _0x3bc670=_0x51f654[_0x95ad('0x56')]['id'];return db[_0x95ad('0x44')][_0x95ad('0x4a')]({'where':{'id':_0x3bc670}})['then'](handleEntityNotFound(_0x1526ab,null))[_0x95ad('0x47')](function(_0x2ef2a9){if(_0x2ef2a9){var _0x340770=[_0x95ad('0x82'),_0x95ad('0x83'),_0x95ad('0x84'),_0x95ad('0x85'),_0x95ad('0x86'),_0x95ad('0x87'),_0x95ad('0x88')];return db['sequelize'][_0x95ad('0x59')](function(_0x51732c){var _0x1de4c7=_[_0x95ad('0x31')](_0x340770,function(_0x184f0c){var _0x3dcb0e={'attributes':['id',_0x95ad('0x2e')]};if(_0x184f0c==='Voice'){_0x3dcb0e['through']={'attributes':[_0x95ad('0x89')]};}return _0x2ef2a9[_0x95ad('0x4f')+_0x184f0c+'Queues'](_0x3dcb0e)[_0x95ad('0x47')](function(_0x54ef6b){var _0x3f249a=_[_0x95ad('0x31')](_0x54ef6b,function(_0x515f5b){var _0x137f1e=_[_0x95ad('0x31')](_0x438534,function(_0x435699){var _0x3003f3={'where':{'UserId':_0x435699,[_0x184f0c+_0x95ad('0x8a')]:_0x515f5b['id']},'transaction':_0x51732c};if(_0x184f0c===_0x95ad('0x82')){_0x3003f3[_0x95ad('0x1d')]={'penalty':_0x515f5b[_0x95ad('0x8b')]['penalty']};}return db[_0x95ad('0x8c')+_0x184f0c+_0x95ad('0x79')][_0x95ad('0x8d')](_0x3003f3)[_0x95ad('0x47')](function(){socket[_0x95ad('0x8e')](_0x95ad('0x4e')+_0x184f0c+'Queue:save',{'UserId':_0x435699,[_0x184f0c+_0x95ad('0x8a')]:_0x515f5b['id']});if(_0x184f0c!==_0x95ad('0x82')){return;}return db[_0x95ad('0x8c')][_0x95ad('0x46')]({'where':{'id':_0x438534,'online':0x1},'attributes':['id','name',_0x95ad('0x8f'),'voicePause',_0x95ad('0x90')],'raw':!![]})['then'](function(_0x409aa7){var _0x36099a=_['map'](_0x409aa7,function(_0x18d741){return db[_0x95ad('0x91')][_0x95ad('0x92')]({'membername':_0x18d741[_0x95ad('0x2e')],'UserId':_0x18d741['id'],'queue_name':_0x515f5b[_0x95ad('0x2e')],'VoiceQueueId':_0x515f5b['id'],'interface':_[_0x95ad('0x93')](_0x18d741[_0x95ad('0x90')])?util[_0x95ad('0x94')](_0x95ad('0x95'),_0x18d741[_0x95ad('0x2e')]):_0x18d741[_0x95ad('0x90')],'paused':_0x18d741[_0x95ad('0x96')]||![],'penalty':_0x515f5b['TeamVoiceQueue']['penalty']},{'transaction':_0x51732c});});return Promise['all'](_0x36099a);});});});return Promise[_0x95ad('0x97')](_0x137f1e);});return Promise[_0x95ad('0x97')](_0x3f249a);})[_0x95ad('0x47')](function(){return db[_0x95ad('0x70')]['findOne']({'where':{'teamId':_0x3bc670}})[_0x95ad('0x47')](function(_0x4da091){if(_0x4da091){var _0x36de85=_['map'](_0x438534,function(_0x4f24f9){db['UserVoicePrefix'][_0x95ad('0x92')]({'UserId':_0x4f24f9,'VoicePrefixId':_0x4da091[_0x95ad('0x72')]});});return Promise['all'](_0x36de85);}});});});return Promise[_0x95ad('0x97')](_0x1de4c7)['then'](function(){return _0x2ef2a9[_0x95ad('0x98')](_0x438534,{'transaction':_0x51732c})[_0x95ad('0x99')](function(_0x8ce00a){return _0x8ce00a;});});});}})[_0x95ad('0x47')](respondWithResult(_0x1526ab,null))['catch'](handleError(_0x1526ab,null));};exports[_0x95ad('0x9a')]=function(_0x5e7392,_0xe7a84e){var _0x13a26b=_['isArray'](_0x5e7392[_0x95ad('0x37')][_0x95ad('0x7f')])?_0x5e7392[_0x95ad('0x37')][_0x95ad('0x7f')]:[_0x5e7392[_0x95ad('0x37')][_0x95ad('0x7f')]];var _0x1af1f8=_0x5e7392[_0x95ad('0x56')]['id'];return db[_0x95ad('0x44')][_0x95ad('0x4a')]({'where':{'id':_0x1af1f8}})[_0x95ad('0x47')](handleEntityNotFound(_0xe7a84e,null))['then'](function(_0x4c6c9e){if(_0x4c6c9e){var _0x2a8396=['Voice',_0x95ad('0x83'),_0x95ad('0x84'),_0x95ad('0x85'),_0x95ad('0x86'),_0x95ad('0x87'),_0x95ad('0x88')];return db[_0x95ad('0x58')][_0x95ad('0x59')](function(_0x33c7b4){var _0x53f824=_[_0x95ad('0x31')](_0x2a8396,function(_0x46c523){var _0x1e94e={'attributes':['id',_0x95ad('0x2e')]};return _0x4c6c9e['get'+_0x46c523+_0x95ad('0x7c')](_0x1e94e)[_0x95ad('0x47')](function(_0x547717){var _0x10fe2d=_['map'](_0x547717,function(_0x4fa301){return _0x4fa301[_0x95ad('0x9a')](_0x13a26b,{'transaction':_0x33c7b4})[_0x95ad('0x47')](function(){var _0x43eabb=_['map'](_0x13a26b,function(_0x16950f){socket[_0x95ad('0x8e')](_0x95ad('0x4e')+_0x46c523+'Queue:remove',{'UserId':Number(_0x16950f),[_0x46c523+'QueueId']:_0x4fa301['id']});if(_0x46c523!==_0x95ad('0x82')){return;}return db[_0x95ad('0x91')][_0x95ad('0x57')]({'where':{'VoiceQueueId':_0x4fa301['id'],'UserId':_0x16950f},'transaction':_0x33c7b4});});return Promise['all'](_0x43eabb);});});return Promise['all'](_0x10fe2d);});});return Promise[_0x95ad('0x97')](_0x53f824)['then'](function(){return _0x4c6c9e[_0x95ad('0x9a')](_0x13a26b,{'transaction':_0x33c7b4});})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1af1f8}})[_0x95ad('0x47')](function(_0xadb55e){if(_0xadb55e){var _0x32c87f=_[_0x95ad('0x31')](_0x13a26b,function(_0x4aecc2){db['UserVoicePrefix'][_0x95ad('0x57')]({'where':{'UserId':_0x4aecc2,'VoicePrefixId':_0xadb55e[_0x95ad('0x72')]}});});return Promise[_0x95ad('0x97')](_0x32c87f);}});});});}})['then'](respondWithStatusCode(_0xe7a84e,null))['catch'](handleError(_0xe7a84e,null));};exports[_0x95ad('0x9b')]=function(_0x59ddda,_0x893caf,_0x16de40){var _0xdb2e94={};var _0x526a4b={};var _0x38b53c;var _0x4dd862;return db[_0x95ad('0x44')][_0x95ad('0x74')]({'where':{'id':_0x59ddda[_0x95ad('0x56')]['id']}})[_0x95ad('0x47')](handleEntityNotFound(_0x893caf,null))[_0x95ad('0x47')](function(_0xc347c){if(_0xc347c){_0x38b53c=_0xc347c;_0x526a4b[_0x95ad('0x36')]=_[_0x95ad('0x38')](db[_0x95ad('0x8c')]['rawAttributes']);_0x526a4b['query']=_['keys'](_0x59ddda[_0x95ad('0x37')]);_0x526a4b[_0x95ad('0x39')]=_[_0x95ad('0x3a')](_0x526a4b[_0x95ad('0x36')],_0x526a4b[_0x95ad('0x37')]);_0xdb2e94[_0x95ad('0x3b')]=_['intersection'](_0x526a4b[_0x95ad('0x36')],qs[_0x95ad('0x3c')](_0x59ddda[_0x95ad('0x37')][_0x95ad('0x3c')]));_0xdb2e94[_0x95ad('0x3b')]=_0xdb2e94['attributes'][_0x95ad('0x49')]?_0xdb2e94[_0x95ad('0x3b')]:_0x526a4b[_0x95ad('0x36')];_0xdb2e94[_0x95ad('0x3e')]=qs['sort'](_0x59ddda['query'][_0x95ad('0x3f')]);_0xdb2e94[_0x95ad('0x40')]=qs[_0x95ad('0x39')](_[_0x95ad('0x7a')](_0x59ddda[_0x95ad('0x37')],_0x526a4b[_0x95ad('0x39')]));if(_0x59ddda[_0x95ad('0x37')]['filter']){_0xdb2e94['where']=_['merge'](_0xdb2e94[_0x95ad('0x40')],{'$or':_[_0x95ad('0x31')](_0xdb2e94[_0x95ad('0x3b')],function(_0x42cc54){var _0x530c40={};_0x530c40[_0x42cc54]={'$like':'%'+_0x59ddda['query'][_0x95ad('0x41')]+'%'};return _0x530c40;})});}_0xdb2e94=_[_0x95ad('0x42')]({},_0xdb2e94,_0x59ddda['options']);return _0x38b53c[_0x95ad('0x9b')](_0xdb2e94);}})[_0x95ad('0x47')](function(_0x5bc1f2){if(_0x5bc1f2){_0x4dd862=_0x5bc1f2[_0x95ad('0x49')];if(!_0x59ddda[_0x95ad('0x37')][_0x95ad('0x3d')](_0x95ad('0x9c'))){_0xdb2e94[_0x95ad('0x26')]=qs[_0x95ad('0x26')](_0x59ddda[_0x95ad('0x37')][_0x95ad('0x26')]);_0xdb2e94[_0x95ad('0x25')]=qs[_0x95ad('0x25')](_0x59ddda[_0x95ad('0x37')][_0x95ad('0x25')]);}return _0x38b53c[_0x95ad('0x9b')](_0xdb2e94);}})[_0x95ad('0x47')](function(_0x47f377){if(_0x47f377){return _0x47f377?{'count':_0x4dd862,'rows':_0x47f377}:null;}})[_0x95ad('0x47')](respondWithResult(_0x893caf,null))[_0x95ad('0x4b')](handleError(_0x893caf,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e352da0..ae3f402 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 _0x1709=['setMaxListeners','update','remove','hasOwnProperty','exports','Team'];(function(_0x30aa56,_0x383c7d){var _0x5e3748=function(_0x328725){while(--_0x328725){_0x30aa56['push'](_0x30aa56['shift']());}};_0x5e3748(++_0x383c7d);}(_0x1709,0xfb));var _0x9170=function(_0x187e82,_0x5254eb){_0x187e82=_0x187e82-0x0;var _0x58625e=_0x1709[_0x187e82];return _0x58625e;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x9170('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x9170('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9170('0x2'),'afterDestroy':_0x9170('0x3')};function emitEvent(_0x3000d5){return function(_0x4d9458,_0x29c30e,_0x827de7){TeamEvents['emit'](_0x3000d5+':'+_0x4d9458['id'],_0x4d9458);TeamEvents['emit'](_0x3000d5,_0x4d9458);_0x827de7(null);};}for(var e in events){if(events[_0x9170('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x9170('0x5')]=TeamEvents; \ No newline at end of file +var _0xa2d1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xa2d1,0x184));var _0x1a2d=function(_0x37222f,_0x25a5ab){_0x37222f=_0x37222f-0x0;var _0x5c5a6d=_0xa2d1[_0x37222f];return _0x5c5a6d;};'use strict';var EventEmitter=require('events');var Team=require(_0x1a2d('0x0'))['db'][_0x1a2d('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x1a2d('0x2')](0x0);var events={'afterCreate':_0x1a2d('0x3'),'afterUpdate':_0x1a2d('0x4'),'afterDestroy':_0x1a2d('0x5')};function emitEvent(_0x18ae96){return function(_0x4595c0,_0x204f67,_0xa1e4d0){TeamEvents['emit'](_0x18ae96+':'+_0x4595c0['id'],_0x4595c0);TeamEvents[_0x1a2d('0x6')](_0x18ae96,_0x4595c0);_0xa1e4d0(null);};}for(var e in events){if(events[_0x1a2d('0x7')](e)){var event=events[e];Team[_0x1a2d('0x8')](e,emitEvent(event));}}module[_0x1a2d('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d4c2774..055222c 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 _0x9057=['all','lodash','./team.attributes','get','Queues','then','setDataValue','catch','exports','define','teams','Chat','Mail','Openchannel','Voice','Whatsapp','resolve'];(function(_0x1b1215,_0x3fae48){var _0x2eadaf=function(_0x1ce233){while(--_0x1ce233){_0x1b1215['push'](_0x1b1215['shift']());}};_0x2eadaf(++_0x3fae48);}(_0x9057,0x144));var _0x7905=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0x9057[_0x511b76];return _0x5424ff;};'use strict';var _=require(_0x7905('0x0'));var attributes=require(_0x7905('0x1'));function getQueuesByChannel(_0x173b58,_0x33731d){var _0x536c0d=_0x7905('0x2')+_0x33731d+_0x7905('0x3');return _0x173b58[_0x536c0d]()[_0x7905('0x4')](function(_0x4cb6a5){return _['map'](_0x4cb6a5,function(_0x418810){_0x418810[_0x7905('0x5')]('channel',_0x33731d);return _0x418810;});})[_0x7905('0x6')](function(_0x4f5691){throw _0x4f5691;});}module[_0x7905('0x7')]=function(_0x123fff){return _0x123fff[_0x7905('0x8')]('Team',attributes,{'tableName':_0x7905('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x459628=this;var _0x2ff390=[_0x7905('0xa'),'Fax',_0x7905('0xb'),_0x7905('0xc'),'Sms',_0x7905('0xd'),_0x7905('0xe')];return Promise[_0x7905('0xf')]()['then'](function(){var _0x2dcf3e=_['map'](_0x2ff390,function(_0x87c55){return getQueuesByChannel(_0x459628,_0x87c55);});return Promise[_0x7905('0x10')](_0x2dcf3e);})[_0x7905('0x6')](function(_0x40d764){throw _0x40d764;});}}});}; \ No newline at end of file +var _0xf2cb=['./team.attributes','get','Queues','map','setDataValue','catch','exports','define','Team','teams','Chat','Openchannel','Sms','Voice','Whatsapp','resolve','all'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf2cb,0x198));var _0xbf2c=function(_0x2085c8,_0x3b5a5c){_0x2085c8=_0x2085c8-0x0;var _0x58ddfb=_0xf2cb[_0x2085c8];return _0x58ddfb;};'use strict';var _=require('lodash');var attributes=require(_0xbf2c('0x0'));function getQueuesByChannel(_0x2758f1,_0x5c47e7){var _0x11f14f=_0xbf2c('0x1')+_0x5c47e7+_0xbf2c('0x2');return _0x2758f1[_0x11f14f]()['then'](function(_0x2da4c7){return _[_0xbf2c('0x3')](_0x2da4c7,function(_0x1ccc48){_0x1ccc48[_0xbf2c('0x4')]('channel',_0x5c47e7);return _0x1ccc48;});})[_0xbf2c('0x5')](function(_0x5c38bc){throw _0x5c38bc;});}module[_0xbf2c('0x6')]=function(_0x52c222){return _0x52c222[_0xbf2c('0x7')](_0xbf2c('0x8'),attributes,{'tableName':_0xbf2c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4076d9=this;var _0x41530d=[_0xbf2c('0xa'),'Fax','Mail',_0xbf2c('0xb'),_0xbf2c('0xc'),_0xbf2c('0xd'),_0xbf2c('0xe')];return Promise[_0xbf2c('0xf')]()['then'](function(){var _0x3f4117=_[_0xbf2c('0x3')](_0x41530d,function(_0x164d02){return getQueuesByChannel(_0x4076d9,_0x164d02);});return Promise[_0xbf2c('0x10')](_0x3f4117);})[_0xbf2c('0x5')](function(_0x49f8f0){throw _0x49f8f0;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b3e80f0..686a0b2 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 _0x1118=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error'];(function(_0x5f36aa,_0x55da43){var _0x3dae2e=function(_0x528022){while(--_0x528022){_0x5f36aa['push'](_0x5f36aa['shift']());}};_0x3dae2e(++_0x55da43);}(_0x1118,0x1c6));var _0x8111=function(_0x31f8cf,_0x25555f){_0x31f8cf=_0x31f8cf-0x0;var _0xdb54bb=_0x1118[_0x31f8cf];return _0xdb54bb;};'use strict';var _=require(_0x8111('0x0'));var util=require(_0x8111('0x1'));var moment=require(_0x8111('0x2'));var BPromise=require(_0x8111('0x3'));var rs=require(_0x8111('0x4'));var fs=require('fs');var Redis=require(_0x8111('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8111('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8111('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8111('0x8')][_0x8111('0x9')]({'port':0x232a});config[_0x8111('0xa')]=_[_0x8111('0xb')](config[_0x8111('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8111('0xc'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x4a55c6,_0x4fb497,_0x30c08e){return new BPromise(function(_0x3a1e12,_0x513db3){return client[_0x8111('0xd')](_0x4a55c6,_0x30c08e)[_0x8111('0xe')](function(_0x57fbd2){logger[_0x8111('0xf')](_0x8111('0x10'),_0x4fb497,_0x8111('0x11'));logger[_0x8111('0x12')](_0x8111('0x13'),_0x4fb497,'request\x20sent',JSON['stringify'](_0x57fbd2));if(_0x57fbd2[_0x8111('0x14')]){if(_0x57fbd2['error'][_0x8111('0x15')]===0x1f4){logger[_0x8111('0x14')](_0x8111('0x10'),_0x4fb497,_0x57fbd2[_0x8111('0x14')][_0x8111('0x16')]);return _0x513db3(_0x57fbd2[_0x8111('0x14')][_0x8111('0x16')]);}logger[_0x8111('0x14')](_0x8111('0x10'),_0x4fb497,_0x57fbd2[_0x8111('0x14')][_0x8111('0x16')]);return _0x3a1e12(_0x57fbd2['error'][_0x8111('0x16')]);}else{logger[_0x8111('0xf')](_0x8111('0x10'),_0x4fb497,'request\x20sent');_0x3a1e12(_0x57fbd2[_0x8111('0x17')][_0x8111('0x16')]);}})[_0x8111('0x18')](function(_0x436533){logger[_0x8111('0x14')](_0x8111('0x10'),_0x4fb497,_0x436533);_0x513db3(_0x436533);});});} \ No newline at end of file +var _0xf69d=['../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Team,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0xf69d,0x76));var _0xdf69=function(_0x6efc2c,_0x1ee10e){_0x6efc2c=_0x6efc2c-0x0;var _0x1313f3=_0xf69d[_0x6efc2c];return _0x1313f3;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf69('0x3'));var fs=require('fs');var Redis=require(_0xdf69('0x4'));var db=require(_0xdf69('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf69('0x6'));var config=require(_0xdf69('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf69('0x8')]['http']({'port':0x232a});config['redis']=_[_0xdf69('0x9')](config[_0xdf69('0xa')],{'host':_0xdf69('0xb'),'port':0x18eb});var socket=require(_0xdf69('0xc'))(new Redis(config[_0xdf69('0xa')]));require('./team.socket')[_0xdf69('0xd')](socket);function respondWithRpcPromise(_0x2533e4,_0x2d676f,_0x169627){return new BPromise(function(_0x573121,_0x2a3610){return client[_0xdf69('0xe')](_0x2533e4,_0x169627)[_0xdf69('0xf')](function(_0x40a37e){logger['info']('Team,\x20%s,\x20%s',_0x2d676f,_0xdf69('0x10'));logger['debug'](_0xdf69('0x11'),_0x2d676f,_0xdf69('0x10'),JSON[_0xdf69('0x12')](_0x40a37e));if(_0x40a37e[_0xdf69('0x13')]){if(_0x40a37e[_0xdf69('0x13')]['code']===0x1f4){logger[_0xdf69('0x13')]('Team,\x20%s,\x20%s',_0x2d676f,_0x40a37e[_0xdf69('0x13')][_0xdf69('0x14')]);return _0x2a3610(_0x40a37e[_0xdf69('0x13')][_0xdf69('0x14')]);}logger[_0xdf69('0x13')]('Team,\x20%s,\x20%s',_0x2d676f,_0x40a37e[_0xdf69('0x13')][_0xdf69('0x14')]);return _0x573121(_0x40a37e[_0xdf69('0x13')]['message']);}else{logger[_0xdf69('0x15')]('Team,\x20%s,\x20%s',_0x2d676f,_0xdf69('0x10'));_0x573121(_0x40a37e[_0xdf69('0x16')]['message']);}})[_0xdf69('0x17')](function(_0xc9f2c3){logger[_0xdf69('0x13')](_0xdf69('0x18'),_0x2d676f,_0xc9f2c3);_0x2a3610(_0xc9f2c3);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8f9d78f..1569cbf 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 _0x49ce=['removeListener','register','save','remove','update','emit'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x49ce,0x116));var _0xe49c=function(_0x47848c,_0x1c52f3){_0x47848c=_0x47848c-0x0;var _0x520324=_0x49ce[_0x47848c];return _0x520324;};'use strict';var TeamEvents=require('./team.events');var events=[_0xe49c('0x0'),_0xe49c('0x1'),_0xe49c('0x2')];function createListener(_0x3a08e7,_0x4e7a6b){return function(_0x29d21d){_0x4e7a6b[_0xe49c('0x3')](_0x3a08e7,_0x29d21d);};}function removeListener(_0x32fbe6,_0x32c1f4){return function(){TeamEvents[_0xe49c('0x4')](_0x32fbe6,_0x32c1f4);};}exports[_0xe49c('0x5')]=function(_0x1d5d24){for(var _0x192e0e=0x0,_0x19bd1e=events['length'];_0x192e0e<_0x19bd1e;_0x192e0e++){var _0x189e74=events[_0x192e0e];var _0x40f138=createListener('team:'+_0x189e74,_0x1d5d24);TeamEvents['on'](_0x189e74,_0x40f138);}}; \ No newline at end of file +var _0x6de8=['register','team:','./team.events','remove','update','emit','removeListener'];(function(_0x8f4ca2,_0xc4ac52){var _0x126663=function(_0x1eebee){while(--_0x1eebee){_0x8f4ca2['push'](_0x8f4ca2['shift']());}};_0x126663(++_0xc4ac52);}(_0x6de8,0x183));var _0x86de=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x6de8[_0x4f4c2a];return _0xd15be6;};'use strict';var TeamEvents=require(_0x86de('0x0'));var events=['save',_0x86de('0x1'),_0x86de('0x2')];function createListener(_0x3faa12,_0x5721be){return function(_0x57361e){_0x5721be[_0x86de('0x3')](_0x3faa12,_0x57361e);};}function removeListener(_0x319bde,_0x3eb915){return function(){TeamEvents[_0x86de('0x4')](_0x319bde,_0x3eb915);};}exports[_0x86de('0x5')]=function(_0x3ee3c3){for(var _0x409bb5=0x0,_0x1c0b62=events['length'];_0x409bb5<_0x1c0b62;_0x409bb5++){var _0x49abd4=events[_0x409bb5];var _0x2613fd=createListener(_0x86de('0x6')+_0x49abd4,_0x3ee3c3);TeamEvents['on'](_0x49abd4,_0x2613fd);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index cf9ba8b..4e61458 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 _0xf43e=['sequelize','exports','INTEGER'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xf43e,0x75));var _0xef43=function(_0x265407,_0xa6e592){_0x265407=_0x265407-0x0;var _0x4c461a=_0xf43e[_0x265407];return _0x4c461a;};'use strict';var Sequelize=require(_0xef43('0x0'));module[_0xef43('0x1')]={'TeamId':{'type':Sequelize[_0xef43('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xef43('0x2')]}}; \ No newline at end of file +var _0x9099=['sequelize','INTEGER'];(function(_0x564029,_0x1c16ce){var _0x35ca7a=function(_0x191333){while(--_0x191333){_0x564029['push'](_0x564029['shift']());}};_0x35ca7a(++_0x1c16ce);}(_0x9099,0x1ac));var _0x9909=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x9099[_0x1cd674];return _0x27928f;};'use strict';var Sequelize=require(_0x9909('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x9909('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x9909('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 963c269..f705295 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 _0xc7ea=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x231761,_0x340450){var _0x344666=function(_0x576fb1){while(--_0x576fb1){_0x231761['push'](_0x231761['shift']());}};_0x344666(++_0x340450);}(_0xc7ea,0x171));var _0xac7e=function(_0x70d9b3,_0x33bb56){_0x70d9b3=_0x70d9b3-0x0;var _0x4d6eda=_0xc7ea[_0x70d9b3];return _0x4d6eda;};'use strict';var _=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var logger=require('../../config/logger')(_0xac7e('0x2'));var moment=require(_0xac7e('0x3'));var BPromise=require(_0xac7e('0x4'));var rp=require(_0xac7e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac7e('0x6'));var config=require(_0xac7e('0x7'));var attributes=require(_0xac7e('0x8'));module[_0xac7e('0x9')]=function(_0x26b1c5,_0x45e73f){return _0x26b1c5[_0xac7e('0xa')](_0xac7e('0xb'),attributes,{'tableName':_0xac7e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe820=['exports','define','TeamVoicePrefix','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x213ec1,_0x190462){var _0x1146bf=function(_0x55fc3e){while(--_0x55fc3e){_0x213ec1['push'](_0x213ec1['shift']());}};_0x1146bf(++_0x190462);}(_0xe820,0xd2));var _0x0e82=function(_0x5a123b,_0x2cf01b){_0x5a123b=_0x5a123b-0x0;var _0x2f71ca=_0xe820[_0x5a123b];return _0x2f71ca;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2863357..89a7fb9 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x29b3ed,_0x3aacd0){var _0x3a694b=function(_0x37dedb){while(--_0x37dedb){_0x29b3ed['push'](_0x29b3ed['shift']());}};_0x3a694b(++_0x3aacd0);}(_0x70e0,0x17b));var _0x070e=function(_0x5f293b,_0x3532ff){_0x5f293b=_0x5f293b-0x0;var _0x453b19=_0x70e0[_0x5f293b];return _0x453b19;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4a6060,_0x44ac31){var _0x506c5f=function(_0x530f3e){while(--_0x530f3e){_0x4a6060['push'](_0x4a6060['shift']());}};_0x506c5f(++_0x44ac31);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xcb91[_0x54edc9];return _0x2ae7a9;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 693c1a5..1b19aa9 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 _0x5ba9=['exports','INTEGER','sequelize'];(function(_0x9b719e,_0x306add){var _0x7f70d0=function(_0x4d8391){while(--_0x4d8391){_0x9b719e['push'](_0x9b719e['shift']());}};_0x7f70d0(++_0x306add);}(_0x5ba9,0x77));var _0x95ba=function(_0x271353,_0x543445){_0x271353=_0x271353-0x0;var _0x379934=_0x5ba9[_0x271353];return _0x379934;};'use strict';var Sequelize=require(_0x95ba('0x0'));module[_0x95ba('0x1')]={'penalty':{'type':Sequelize[_0x95ba('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf938=['INTEGER','sequelize','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf938,0x106));var _0x8f93=function(_0x440030,_0xaeec43){_0x440030=_0x440030-0x0;var _0x40d6b4=_0xf938[_0x440030];return _0x40d6b4;};'use strict';var Sequelize=require(_0x8f93('0x0'));module[_0x8f93('0x1')]={'penalty':{'type':Sequelize[_0x8f93('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 3e30d9d..9dd3e0a 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 _0x3d9c=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','../../config/logger','api','moment'];(function(_0x33b4e0,_0xb97f9){var _0x1855cd=function(_0x1404b6){while(--_0x1404b6){_0x33b4e0['push'](_0x33b4e0['shift']());}};_0x1855cd(++_0xb97f9);}(_0x3d9c,0x134));var _0xc3d9=function(_0x557e2d,_0x35a00b){_0x557e2d=_0x557e2d-0x0;var _0x537139=_0x3d9c[_0x557e2d];return _0x537139;};'use strict';var _=require(_0xc3d9('0x0'));var util=require('util');var logger=require(_0xc3d9('0x1'))(_0xc3d9('0x2'));var moment=require(_0xc3d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3d9('0x4'));var fs=require('fs');var path=require(_0xc3d9('0x5'));var rimraf=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var attributes=require(_0xc3d9('0x8'));module[_0xc3d9('0x9')]=function(_0x137aaf,_0x492577){return _0x137aaf[_0xc3d9('0xa')](_0xc3d9('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x032e=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x2e1af3,_0x2a077b){var _0x4150cd=function(_0x1e08f3){while(--_0x1e08f3){_0x2e1af3['push'](_0x2e1af3['shift']());}};_0x4150cd(++_0x2a077b);}(_0x032e,0x124));var _0xe032=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x032e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));module[_0xe032('0x8')]=function(_0x2ba8a0,_0x33ad0b){return _0x2ba8a0[_0xe032('0x9')](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'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 ab2fbdd..08d7b28 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 _0xdeb3=['../../config/utils','../../config/logger','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36e8f5,_0x4f257d){var _0x47ec7d=function(_0x39a764){while(--_0x39a764){_0x36e8f5['push'](_0x36e8f5['shift']());}};_0x47ec7d(++_0x4f257d);}(_0xdeb3,0xeb));var _0x3deb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdeb3[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var moment=require(_0x3deb('0x2'));var BPromise=require(_0x3deb('0x3'));var rs=require(_0x3deb('0x4'));var fs=require('fs');var Redis=require(_0x3deb('0x5'));var db=require(_0x3deb('0x6'))['db'];var utils=require(_0x3deb('0x7'));var logger=require(_0x3deb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x9')][_0x3deb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c8e43,_0x14846f,_0xcaaef7){return new BPromise(function(_0x5ecf47,_0x571adc){return client[_0x3deb('0xb')](_0x3c8e43,_0xcaaef7)[_0x3deb('0xc')](function(_0x30bb01){logger[_0x3deb('0xd')](_0x3deb('0xe'),_0x14846f,_0x3deb('0xf'));logger[_0x3deb('0x10')](_0x3deb('0x11'),_0x14846f,'request\x20sent',JSON['stringify'](_0x30bb01));if(_0x30bb01['error']){if(_0x30bb01[_0x3deb('0x12')]['code']===0x1f4){logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x571adc(_0x30bb01['error'][_0x3deb('0x13')]);}logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x5ecf47(_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);}else{logger[_0x3deb('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x14846f,_0x3deb('0xf'));_0x5ecf47(_0x30bb01[_0x3deb('0x14')]['message']);}})[_0x3deb('0x15')](function(_0x35923e){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x14846f,_0x35923e);_0x571adc(_0x35923e);});});} \ No newline at end of file +var _0x01ab=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2fb645,_0x1fca5c){var _0x3adb7e=function(_0x382c2b){while(--_0x382c2b){_0x2fb645['push'](_0x2fb645['shift']());}};_0x3adb7e(++_0x1fca5c);}(_0x01ab,0xaa));var _0xb01a=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0x01ab[_0x11fbaa];return _0x1831fd;};'use strict';var _=require(_0xb01a('0x0'));var util=require(_0xb01a('0x1'));var moment=require(_0xb01a('0x2'));var BPromise=require('bluebird');var rs=require(_0xb01a('0x3'));var fs=require('fs');var Redis=require(_0xb01a('0x4'));var db=require(_0xb01a('0x5'))['db'];var utils=require(_0xb01a('0x6'));var logger=require(_0xb01a('0x7'))(_0xb01a('0x8'));var config=require(_0xb01a('0x9'));var jayson=require(_0xb01a('0xa'));var client=jayson[_0xb01a('0xb')][_0xb01a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e4e7d,_0x3c498f,_0x48d7ad){return new BPromise(function(_0x30b9e0,_0x3ae6eb){return client[_0xb01a('0xd')](_0x3e4e7d,_0x48d7ad)['then'](function(_0x10a697){logger[_0xb01a('0xe')](_0xb01a('0xf'),_0x3c498f,_0xb01a('0x10'));logger[_0xb01a('0x11')](_0xb01a('0x12'),_0x3c498f,_0xb01a('0x10'),JSON[_0xb01a('0x13')](_0x10a697));if(_0x10a697[_0xb01a('0x14')]){if(_0x10a697[_0xb01a('0x14')]['code']===0x1f4){logger[_0xb01a('0x14')](_0xb01a('0xf'),_0x3c498f,_0x10a697[_0xb01a('0x14')][_0xb01a('0x15')]);return _0x3ae6eb(_0x10a697['error'][_0xb01a('0x15')]);}logger[_0xb01a('0x14')](_0xb01a('0xf'),_0x3c498f,_0x10a697[_0xb01a('0x14')]['message']);return _0x30b9e0(_0x10a697[_0xb01a('0x14')][_0xb01a('0x15')]);}else{logger[_0xb01a('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3c498f,'request\x20sent');_0x30b9e0(_0x10a697[_0xb01a('0x16')][_0xb01a('0x15')]);}})[_0xb01a('0x17')](function(_0x60f47e){logger['error'](_0xb01a('0xf'),_0x3c498f,_0x60f47e);_0x3ae6eb(_0x60f47e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 1383eff..ad152ed 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 _0x8b52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x3bf957,_0x168c65){var _0x551cc=function(_0x5368e8){while(--_0x5368e8){_0x3bf957['push'](_0x3bf957['shift']());}};_0x551cc(++_0x168c65);}(_0x8b52,0x151));var _0x28b5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8b52[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x28b5('0x0'));var util=require(_0x28b5('0x1'));var path=require(_0x28b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x28b5('0x3'));var router=express[_0x28b5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28b5('0x5'));var interaction=require(_0x28b5('0x6'));var config=require(_0x28b5('0x7'));var controller=require(_0x28b5('0x8'));router[_0x28b5('0x9')]('/',auth[_0x28b5('0xa')](),controller[_0x28b5('0xb')]);router[_0x28b5('0x9')](_0x28b5('0xc'),auth['isAuthenticated'](),controller[_0x28b5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x28b5('0xe')]);router[_0x28b5('0xf')]('/:id',auth[_0x28b5('0xa')](),controller[_0x28b5('0x10')]);router['delete'](_0x28b5('0xc'),auth[_0x28b5('0xa')](),controller[_0x28b5('0x11')]);module[_0x28b5('0x12')]=router; \ No newline at end of file +var _0xccef=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xccef,0x1d4));var _0xfcce=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xccef[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xfcce('0x0'));var path=require('path');var timeout=require(_0xfcce('0x1'));var express=require(_0xfcce('0x2'));var router=express[_0xfcce('0x3')]();var fs_extra=require(_0xfcce('0x4'));var auth=require(_0xfcce('0x5'));var interaction=require(_0xfcce('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0xfcce('0x7')]('/',auth['isAuthenticated'](),controller[_0xfcce('0x8')]);router[_0xfcce('0x7')](_0xfcce('0x9'),auth[_0xfcce('0xa')](),controller[_0xfcce('0xb')]);router[_0xfcce('0xc')]('/',auth[_0xfcce('0xa')](),controller['create']);router[_0xfcce('0xd')](_0xfcce('0x9'),auth[_0xfcce('0xa')](),controller[_0xfcce('0xe')]);router[_0xfcce('0xf')](_0xfcce('0x9'),auth[_0xfcce('0xa')](),controller[_0xfcce('0x10')]);module[_0xfcce('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c26735a..0e92c9d 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 _0x4c6c=['exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4c6c,0x1c0));var _0xc4c6=function(_0x4ffc3f,_0x499d86){_0x4ffc3f=_0x4ffc3f-0x0;var _0x5b74ae=_0x4c6c[_0x4ffc3f];return _0x5b74ae;};'use strict';var Sequelize=require('sequelize');module[_0xc4c6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3e38=['TEXT','exports','STRING'];(function(_0x6f4f1d,_0x47fdbe){var _0x285671=function(_0x10e4e3){while(--_0x10e4e3){_0x6f4f1d['push'](_0x6f4f1d['shift']());}};_0x285671(++_0x47fdbe);}(_0x3e38,0xd9));var _0x83e3=function(_0x288f75,_0x1a6a33){_0x288f75=_0x288f75-0x0;var _0x3fe27d=_0x3e38[_0x288f75];return _0x3fe27d;};'use strict';var Sequelize=require('sequelize');module[_0x83e3('0x0')]={'name':{'type':Sequelize[_0x83e3('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x83e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 36b1122..a25a654 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 _0x4f7d=['get','Templates','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','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','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x492b77,_0x460251){var _0x43e8b4=function(_0x1ee93a){while(--_0x1ee93a){_0x492b77['push'](_0x492b77['shift']());}};_0x43e8b4(++_0x460251);}(_0x4f7d,0x190));var _0xd4f7=function(_0x1e316b,_0x10e1bc){_0x1e316b=_0x1e316b-0x0;var _0x52630d=_0x4f7d[_0x1e316b];return _0x52630d;};'use strict';var emlformat=require(_0xd4f7('0x0'));var rimraf=require(_0xd4f7('0x1'));var zipdir=require(_0xd4f7('0x2'));var jsonpatch=require(_0xd4f7('0x3'));var rp=require(_0xd4f7('0x4'));var moment=require(_0xd4f7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4f7('0x6'));var util=require(_0xd4f7('0x7'));var path=require(_0xd4f7('0x8'));var sox=require(_0xd4f7('0x9'));var csv=require(_0xd4f7('0xa'));var ejs=require(_0xd4f7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd4f7('0xc'));var crypto=require(_0xd4f7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd4f7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd4f7('0xf'));var Papa=require(_0xd4f7('0x10'));var Redis=require(_0xd4f7('0x11'));var authService=require(_0xd4f7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd4f7('0x13'));var hardwareService=require(_0xd4f7('0x14'));var logger=require('../../config/logger')(_0xd4f7('0x15'));var utils=require(_0xd4f7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd4f7('0x17'));var db=require(_0xd4f7('0x18'))['db'];function respondWithStatusCode(_0x33b895,_0x368a85){_0x368a85=_0x368a85||0xcc;return function(_0x28f659){if(_0x28f659){return _0x33b895[_0xd4f7('0x19')](_0x368a85);}return _0x33b895[_0xd4f7('0x1a')](_0x368a85)[_0xd4f7('0x1b')]();};}function respondWithResult(_0x5a4734,_0x5998ad){_0x5998ad=_0x5998ad||0xc8;return function(_0x286a87){if(_0x286a87){return _0x5a4734[_0xd4f7('0x1a')](_0x5998ad)[_0xd4f7('0x1c')](_0x286a87);}};}function respondWithFilteredResult(_0x323d75,_0x1c37a4){return function(_0x1ac563){if(_0x1ac563){var _0x3b2349=typeof _0x1c37a4[_0xd4f7('0x1d')]===_0xd4f7('0x1e')&&typeof _0x1c37a4[_0xd4f7('0x1f')]===_0xd4f7('0x1e');var _0x5ab9bc=_0x1ac563[_0xd4f7('0x20')];var _0x338a7d=_0x3b2349?0x0:_0x1c37a4['offset'];var _0x286b21=_0x3b2349?_0x1ac563[_0xd4f7('0x20')]:_0x1c37a4[_0xd4f7('0x1d')]+_0x1c37a4['limit'];var _0x11a13f;if(_0x286b21>=_0x5ab9bc){_0x286b21=_0x5ab9bc;_0x11a13f=0xc8;}else{_0x11a13f=0xce;}_0x323d75[_0xd4f7('0x1a')](_0x11a13f);return _0x323d75[_0xd4f7('0x21')](_0xd4f7('0x22'),_0x338a7d+'-'+_0x286b21+'/'+_0x5ab9bc)['json'](_0x1ac563);}return null;};}function patchUpdates(_0x5a59c5){return function(_0x3da21d){try{jsonpatch[_0xd4f7('0x23')](_0x3da21d,_0x5a59c5,!![]);}catch(_0x471dd3){return BPromise[_0xd4f7('0x24')](_0x471dd3);}return _0x3da21d['save']();};}function saveUpdates(_0x4ac32c,_0x1c74c6){return function(_0x27ca17){if(_0x27ca17){return _0x27ca17[_0xd4f7('0x25')](_0x4ac32c)[_0xd4f7('0x26')](function(_0x44cd48){return _0x44cd48;});}return null;};}function removeEntity(_0x1b1c86,_0x147204){return function(_0x5964a5){if(_0x5964a5){return _0x5964a5[_0xd4f7('0x27')]()[_0xd4f7('0x26')](function(){var _0x1d6233=_0x5964a5[_0xd4f7('0x28')]({'plain':!![]});var _0x4d7377=_0xd4f7('0x29');return db[_0xd4f7('0x2a')]['destroy']({'where':{'type':_0x4d7377,'resourceId':_0x1d6233['id']}})[_0xd4f7('0x26')](function(){return _0x5964a5;});})[_0xd4f7('0x26')](function(){_0x1b1c86[_0xd4f7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d31e,_0x230c44){return function(_0x2d7b6b){if(!_0x2d7b6b){_0x13d31e[_0xd4f7('0x19')](0x194);}return _0x2d7b6b;};}function handleError(_0x72dfd7,_0x5078c9){_0x5078c9=_0x5078c9||0x1f4;return function(_0x59bbaa){logger[_0xd4f7('0x2b')](_0x59bbaa[_0xd4f7('0x2c')]);if(_0x59bbaa[_0xd4f7('0x2d')]){delete _0x59bbaa['name'];}_0x72dfd7[_0xd4f7('0x1a')](_0x5078c9)[_0xd4f7('0x2e')](_0x59bbaa);};}exports[_0xd4f7('0x2f')]=function(_0x2a723a,_0x1c8a29){var _0x5e26b9={},_0xb5783d={},_0x10cd7a={'count':0x0,'rows':[]};var _0x304c00=_['map'](db[_0xd4f7('0x30')][_0xd4f7('0x31')],function(_0x106126){return{'name':_0x106126[_0xd4f7('0x32')],'type':_0x106126[_0xd4f7('0x33')][_0xd4f7('0x34')]};});_0xb5783d[_0xd4f7('0x35')]=_[_0xd4f7('0x36')](_0x304c00,_0xd4f7('0x2d'));_0xb5783d[_0xd4f7('0x37')]=_[_0xd4f7('0x38')](_0x2a723a[_0xd4f7('0x37')]);_0xb5783d[_0xd4f7('0x39')]=_[_0xd4f7('0x3a')](_0xb5783d[_0xd4f7('0x35')],_0xb5783d[_0xd4f7('0x37')]);_0x5e26b9[_0xd4f7('0x3b')]=_[_0xd4f7('0x3a')](_0xb5783d[_0xd4f7('0x35')],qs['fields'](_0x2a723a[_0xd4f7('0x37')][_0xd4f7('0x3c')]));_0x5e26b9[_0xd4f7('0x3b')]=_0x5e26b9[_0xd4f7('0x3b')]['length']?_0x5e26b9[_0xd4f7('0x3b')]:_0xb5783d[_0xd4f7('0x35')];if(!_0x2a723a[_0xd4f7('0x37')][_0xd4f7('0x3d')](_0xd4f7('0x3e'))){_0x5e26b9[_0xd4f7('0x1f')]=qs[_0xd4f7('0x1f')](_0x2a723a[_0xd4f7('0x37')][_0xd4f7('0x1f')]);_0x5e26b9[_0xd4f7('0x1d')]=qs[_0xd4f7('0x1d')](_0x2a723a[_0xd4f7('0x37')][_0xd4f7('0x1d')]);}_0x5e26b9['order']=qs[_0xd4f7('0x3f')](_0x2a723a['query'][_0xd4f7('0x3f')]);_0x5e26b9[_0xd4f7('0x40')]=qs['filters'](_[_0xd4f7('0x41')](_0x2a723a[_0xd4f7('0x37')],_0xb5783d[_0xd4f7('0x39')]),_0x304c00);if(_0x2a723a[_0xd4f7('0x37')][_0xd4f7('0x42')]){_0x5e26b9[_0xd4f7('0x40')]=_[_0xd4f7('0x43')](_0x5e26b9['where'],{'$or':_[_0xd4f7('0x36')](_0x304c00,function(_0x3c5abb){if(_0x3c5abb['type']!==_0xd4f7('0x44')){var _0x4e44f6={};_0x4e44f6[_0x3c5abb[_0xd4f7('0x2d')]]={'$like':'%'+_0x2a723a[_0xd4f7('0x37')]['filter']+'%'};return _0x4e44f6;}})});}_0x5e26b9=_[_0xd4f7('0x43')]({},_0x5e26b9,_0x2a723a[_0xd4f7('0x45')]);var _0xf631e1={'where':_0x5e26b9[_0xd4f7('0x40')]};return db[_0xd4f7('0x30')][_0xd4f7('0x20')](_0xf631e1)[_0xd4f7('0x26')](function(_0x309a9b){_0x10cd7a[_0xd4f7('0x20')]=_0x309a9b;if(_0x2a723a[_0xd4f7('0x37')][_0xd4f7('0x46')]){_0x5e26b9[_0xd4f7('0x47')]=[{'all':!![]}];}return db[_0xd4f7('0x30')][_0xd4f7('0x48')](_0x5e26b9);})[_0xd4f7('0x26')](function(_0x1e6079){_0x10cd7a[_0xd4f7('0x49')]=_0x1e6079;return _0x10cd7a;})[_0xd4f7('0x26')](respondWithFilteredResult(_0x1c8a29,_0x5e26b9))[_0xd4f7('0x4a')](handleError(_0x1c8a29,null));};exports[_0xd4f7('0x4b')]=function(_0x25f1db,_0x5f0bd0){var _0x3889b0={'raw':!![],'where':{'id':_0x25f1db['params']['id']}},_0x5e94f5={};_0x5e94f5['model']=_[_0xd4f7('0x38')](db[_0xd4f7('0x30')][_0xd4f7('0x31')]);_0x5e94f5[_0xd4f7('0x37')]=_[_0xd4f7('0x38')](_0x25f1db['query']);_0x5e94f5['filters']=_[_0xd4f7('0x3a')](_0x5e94f5[_0xd4f7('0x35')],_0x5e94f5['query']);_0x3889b0[_0xd4f7('0x3b')]=_['intersection'](_0x5e94f5[_0xd4f7('0x35')],qs[_0xd4f7('0x3c')](_0x25f1db[_0xd4f7('0x37')]['fields']));_0x3889b0[_0xd4f7('0x3b')]=_0x3889b0[_0xd4f7('0x3b')][_0xd4f7('0x4c')]?_0x3889b0['attributes']:_0x5e94f5[_0xd4f7('0x35')];if(_0x25f1db[_0xd4f7('0x37')]['includeAll']){_0x3889b0['include']=[{'all':!![]}];}_0x3889b0=_[_0xd4f7('0x43')]({},_0x3889b0,_0x25f1db['options']);return db[_0xd4f7('0x30')][_0xd4f7('0x4d')](_0x3889b0)[_0xd4f7('0x26')](handleEntityNotFound(_0x5f0bd0,null))[_0xd4f7('0x26')](respondWithResult(_0x5f0bd0,null))['catch'](handleError(_0x5f0bd0,null));};exports[_0xd4f7('0x4e')]=function(_0x3af748,_0x3970e8){return db[_0xd4f7('0x30')][_0xd4f7('0x4e')](_0x3af748[_0xd4f7('0x4f')],{})[_0xd4f7('0x26')](function(_0x1dc21a){var _0x15988e=_0x3af748[_0xd4f7('0x50')]['get']({'plain':!![]});if(!_0x15988e)throw new Error(_0xd4f7('0x51'));if(_0x15988e[_0xd4f7('0x52')]===_0xd4f7('0x50')){var _0x215c46=_0x1dc21a[_0xd4f7('0x28')]({'plain':!![]});var _0x3cdb79=_0xd4f7('0x29');return db[_0xd4f7('0x53')][_0xd4f7('0x4d')]({'where':{'name':_0x3cdb79,'userProfileId':_0x15988e[_0xd4f7('0x54')]},'raw':!![]})[_0xd4f7('0x26')](function(_0x42c946){if(_0x42c946&&_0x42c946[_0xd4f7('0x55')]===0x0){return db[_0xd4f7('0x2a')][_0xd4f7('0x4e')]({'name':_0x215c46[_0xd4f7('0x2d')],'resourceId':_0x215c46['id'],'type':_0x42c946[_0xd4f7('0x2d')],'sectionId':_0x42c946['id']},{})[_0xd4f7('0x26')](function(){return _0x1dc21a;});}else{return _0x1dc21a;}})[_0xd4f7('0x4a')](function(_0x4af247){logger['error'](_0xd4f7('0x56'),_0x4af247);throw _0x4af247;});}return _0x1dc21a;})[_0xd4f7('0x26')](respondWithResult(_0x3970e8,0xc9))['catch'](handleError(_0x3970e8,null));};exports[_0xd4f7('0x25')]=function(_0x8539e9,_0x5c3e67){if(_0x8539e9['body']['id']){delete _0x8539e9[_0xd4f7('0x4f')]['id'];}return db[_0xd4f7('0x30')]['find']({'where':{'id':_0x8539e9[_0xd4f7('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c3e67,null))['then'](saveUpdates(_0x8539e9['body'],null))['then'](respondWithResult(_0x5c3e67,null))[_0xd4f7('0x4a')](handleError(_0x5c3e67,null));};exports[_0xd4f7('0x27')]=function(_0x3fe9fa,_0x5af2d1){return db[_0xd4f7('0x30')]['find']({'where':{'id':_0x3fe9fa[_0xd4f7('0x57')]['id']}})[_0xd4f7('0x26')](handleEntityNotFound(_0x5af2d1,null))['then'](removeEntity(_0x5af2d1,null))[_0xd4f7('0x4a')](handleError(_0x5af2d1,null));}; \ No newline at end of file +var _0xea08=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','Template','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x308607,_0x536396){var _0x4daa5f=function(_0xd0533d){while(--_0xd0533d){_0x308607['push'](_0x308607['shift']());}};_0x4daa5f(++_0x536396);}(_0xea08,0x144));var _0x8ea0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xea08[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x8ea0('0x0'));var rimraf=require(_0x8ea0('0x1'));var zipdir=require(_0x8ea0('0x2'));var jsonpatch=require(_0x8ea0('0x3'));var rp=require(_0x8ea0('0x4'));var moment=require(_0x8ea0('0x5'));var BPromise=require(_0x8ea0('0x6'));var Mustache=require(_0x8ea0('0x7'));var util=require(_0x8ea0('0x8'));var path=require(_0x8ea0('0x9'));var sox=require(_0x8ea0('0xa'));var csv=require(_0x8ea0('0xb'));var ejs=require(_0x8ea0('0xc'));var fs=require('fs');var fs_extra=require(_0x8ea0('0xd'));var _=require(_0x8ea0('0xe'));var squel=require(_0x8ea0('0xf'));var crypto=require('crypto');var jsforce=require(_0x8ea0('0x10'));var deskjs=require(_0x8ea0('0x11'));var toCsv=require(_0x8ea0('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ea0('0x12'));var authService=require(_0x8ea0('0x13'));var qs=require(_0x8ea0('0x14'));var as=require(_0x8ea0('0x15'));var hardwareService=require(_0x8ea0('0x16'));var logger=require(_0x8ea0('0x17'))(_0x8ea0('0x18'));var utils=require(_0x8ea0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea0('0x1a'));var db=require(_0x8ea0('0x1b'))['db'];function respondWithStatusCode(_0x533a82,_0x488eac){_0x488eac=_0x488eac||0xcc;return function(_0x47050b){if(_0x47050b){return _0x533a82[_0x8ea0('0x1c')](_0x488eac);}return _0x533a82['status'](_0x488eac)[_0x8ea0('0x1d')]();};}function respondWithResult(_0x50e9b9,_0x28a442){_0x28a442=_0x28a442||0xc8;return function(_0x33603b){if(_0x33603b){return _0x50e9b9[_0x8ea0('0x1e')](_0x28a442)[_0x8ea0('0x1f')](_0x33603b);}};}function respondWithFilteredResult(_0x30f927,_0x27ef73){return function(_0x45bb76){if(_0x45bb76){var _0x59a3f2=typeof _0x27ef73['offset']==='undefined'&&typeof _0x27ef73[_0x8ea0('0x20')]===_0x8ea0('0x21');var _0x15ebac=_0x45bb76[_0x8ea0('0x22')];var _0x3e8353=_0x59a3f2?0x0:_0x27ef73[_0x8ea0('0x23')];var _0x3742f2=_0x59a3f2?_0x45bb76[_0x8ea0('0x22')]:_0x27ef73['offset']+_0x27ef73[_0x8ea0('0x20')];var _0x41ff89;if(_0x3742f2>=_0x15ebac){_0x3742f2=_0x15ebac;_0x41ff89=0xc8;}else{_0x41ff89=0xce;}_0x30f927[_0x8ea0('0x1e')](_0x41ff89);return _0x30f927[_0x8ea0('0x24')](_0x8ea0('0x25'),_0x3e8353+'-'+_0x3742f2+'/'+_0x15ebac)[_0x8ea0('0x1f')](_0x45bb76);}return null;};}function patchUpdates(_0x472d14){return function(_0x2d958c){try{jsonpatch[_0x8ea0('0x26')](_0x2d958c,_0x472d14,!![]);}catch(_0x1fd077){return BPromise['reject'](_0x1fd077);}return _0x2d958c[_0x8ea0('0x27')]();};}function saveUpdates(_0x161138,_0x3013fb){return function(_0x285ce1){if(_0x285ce1){return _0x285ce1[_0x8ea0('0x28')](_0x161138)[_0x8ea0('0x29')](function(_0x5371f8){return _0x5371f8;});}return null;};}function removeEntity(_0x416cee,_0x187b80){return function(_0x3dee93){if(_0x3dee93){return _0x3dee93[_0x8ea0('0x2a')]()[_0x8ea0('0x29')](function(){var _0x1454b7=_0x3dee93[_0x8ea0('0x2b')]({'plain':!![]});var _0x3e7db3=_0x8ea0('0x2c');return db[_0x8ea0('0x2d')][_0x8ea0('0x2a')]({'where':{'type':_0x3e7db3,'resourceId':_0x1454b7['id']}})['then'](function(){return _0x3dee93;});})[_0x8ea0('0x29')](function(){_0x416cee[_0x8ea0('0x1e')](0xcc)[_0x8ea0('0x1d')]();});}};}function handleEntityNotFound(_0x788623,_0x1a7292){return function(_0x468c3d){if(!_0x468c3d){_0x788623[_0x8ea0('0x1c')](0x194);}return _0x468c3d;};}function handleError(_0x1f90bc,_0x1cf0ed){_0x1cf0ed=_0x1cf0ed||0x1f4;return function(_0x50fbde){logger[_0x8ea0('0x2e')](_0x50fbde[_0x8ea0('0x2f')]);if(_0x50fbde['name']){delete _0x50fbde[_0x8ea0('0x30')];}_0x1f90bc[_0x8ea0('0x1e')](_0x1cf0ed)[_0x8ea0('0x31')](_0x50fbde);};}exports[_0x8ea0('0x32')]=function(_0x193a6,_0x18b12f){var _0x5db676={},_0x5d1deb={},_0x4b23b6={'count':0x0,'rows':[]};var _0x27e406=_['map'](db[_0x8ea0('0x33')]['rawAttributes'],function(_0x5e72fd){return{'name':_0x5e72fd[_0x8ea0('0x34')],'type':_0x5e72fd[_0x8ea0('0x35')][_0x8ea0('0x36')]};});_0x5d1deb['model']=_[_0x8ea0('0x37')](_0x27e406,'name');_0x5d1deb[_0x8ea0('0x38')]=_[_0x8ea0('0x39')](_0x193a6[_0x8ea0('0x38')]);_0x5d1deb[_0x8ea0('0x3a')]=_[_0x8ea0('0x3b')](_0x5d1deb[_0x8ea0('0x3c')],_0x5d1deb['query']);_0x5db676['attributes']=_[_0x8ea0('0x3b')](_0x5d1deb[_0x8ea0('0x3c')],qs[_0x8ea0('0x3d')](_0x193a6[_0x8ea0('0x38')][_0x8ea0('0x3d')]));_0x5db676[_0x8ea0('0x3e')]=_0x5db676[_0x8ea0('0x3e')][_0x8ea0('0x3f')]?_0x5db676[_0x8ea0('0x3e')]:_0x5d1deb['model'];if(!_0x193a6[_0x8ea0('0x38')]['hasOwnProperty'](_0x8ea0('0x40'))){_0x5db676[_0x8ea0('0x20')]=qs[_0x8ea0('0x20')](_0x193a6['query'][_0x8ea0('0x20')]);_0x5db676[_0x8ea0('0x23')]=qs[_0x8ea0('0x23')](_0x193a6[_0x8ea0('0x38')]['offset']);}_0x5db676[_0x8ea0('0x41')]=qs['sort'](_0x193a6[_0x8ea0('0x38')][_0x8ea0('0x42')]);_0x5db676[_0x8ea0('0x43')]=qs[_0x8ea0('0x3a')](_[_0x8ea0('0x44')](_0x193a6[_0x8ea0('0x38')],_0x5d1deb['filters']),_0x27e406);if(_0x193a6[_0x8ea0('0x38')][_0x8ea0('0x45')]){_0x5db676[_0x8ea0('0x43')]=_[_0x8ea0('0x46')](_0x5db676[_0x8ea0('0x43')],{'$or':_['map'](_0x27e406,function(_0x3a218b){if(_0x3a218b['type']!=='VIRTUAL'){var _0x4a7370={};_0x4a7370[_0x3a218b[_0x8ea0('0x30')]]={'$like':'%'+_0x193a6['query'][_0x8ea0('0x45')]+'%'};return _0x4a7370;}})});}_0x5db676=_[_0x8ea0('0x46')]({},_0x5db676,_0x193a6[_0x8ea0('0x47')]);var _0xddbbcc={'where':_0x5db676[_0x8ea0('0x43')]};return db[_0x8ea0('0x33')][_0x8ea0('0x22')](_0xddbbcc)[_0x8ea0('0x29')](function(_0x1756d3){_0x4b23b6[_0x8ea0('0x22')]=_0x1756d3;if(_0x193a6[_0x8ea0('0x38')][_0x8ea0('0x48')]){_0x5db676[_0x8ea0('0x49')]=[{'all':!![]}];}return db['Template'][_0x8ea0('0x4a')](_0x5db676);})[_0x8ea0('0x29')](function(_0x5b354e){_0x4b23b6['rows']=_0x5b354e;return _0x4b23b6;})[_0x8ea0('0x29')](respondWithFilteredResult(_0x18b12f,_0x5db676))[_0x8ea0('0x4b')](handleError(_0x18b12f,null));};exports[_0x8ea0('0x4c')]=function(_0x916b8f,_0x597d60){var _0x56a01b={'raw':!![],'where':{'id':_0x916b8f[_0x8ea0('0x4d')]['id']}},_0x2b9e1f={};_0x2b9e1f[_0x8ea0('0x3c')]=_[_0x8ea0('0x39')](db[_0x8ea0('0x33')][_0x8ea0('0x4e')]);_0x2b9e1f['query']=_[_0x8ea0('0x39')](_0x916b8f[_0x8ea0('0x38')]);_0x2b9e1f[_0x8ea0('0x3a')]=_[_0x8ea0('0x3b')](_0x2b9e1f[_0x8ea0('0x3c')],_0x2b9e1f[_0x8ea0('0x38')]);_0x56a01b[_0x8ea0('0x3e')]=_[_0x8ea0('0x3b')](_0x2b9e1f['model'],qs[_0x8ea0('0x3d')](_0x916b8f['query'][_0x8ea0('0x3d')]));_0x56a01b[_0x8ea0('0x3e')]=_0x56a01b[_0x8ea0('0x3e')][_0x8ea0('0x3f')]?_0x56a01b[_0x8ea0('0x3e')]:_0x2b9e1f[_0x8ea0('0x3c')];if(_0x916b8f['query'][_0x8ea0('0x48')]){_0x56a01b[_0x8ea0('0x49')]=[{'all':!![]}];}_0x56a01b=_['merge']({},_0x56a01b,_0x916b8f[_0x8ea0('0x47')]);return db[_0x8ea0('0x33')][_0x8ea0('0x4f')](_0x56a01b)['then'](handleEntityNotFound(_0x597d60,null))['then'](respondWithResult(_0x597d60,null))[_0x8ea0('0x4b')](handleError(_0x597d60,null));};exports['create']=function(_0x3bc9ac,_0x3fc846){return db[_0x8ea0('0x33')]['create'](_0x3bc9ac['body'],{})[_0x8ea0('0x29')](function(_0x2894b9){var _0x2c50b3=_0x3bc9ac[_0x8ea0('0x50')][_0x8ea0('0x2b')]({'plain':!![]});if(!_0x2c50b3)throw new Error(_0x8ea0('0x51'));if(_0x2c50b3[_0x8ea0('0x52')]===_0x8ea0('0x50')){var _0x1cefd0=_0x2894b9[_0x8ea0('0x2b')]({'plain':!![]});var _0x49b2e1=_0x8ea0('0x2c');return db[_0x8ea0('0x53')][_0x8ea0('0x4f')]({'where':{'name':_0x49b2e1,'userProfileId':_0x2c50b3['userProfileId']},'raw':!![]})[_0x8ea0('0x29')](function(_0x1e3fe6){if(_0x1e3fe6&&_0x1e3fe6[_0x8ea0('0x54')]===0x0){return db[_0x8ea0('0x2d')]['create']({'name':_0x1cefd0[_0x8ea0('0x30')],'resourceId':_0x1cefd0['id'],'type':_0x1e3fe6[_0x8ea0('0x30')],'sectionId':_0x1e3fe6['id']},{})[_0x8ea0('0x29')](function(){return _0x2894b9;});}else{return _0x2894b9;}})[_0x8ea0('0x4b')](function(_0x4af33d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4af33d);throw _0x4af33d;});}return _0x2894b9;})[_0x8ea0('0x29')](respondWithResult(_0x3fc846,0xc9))[_0x8ea0('0x4b')](handleError(_0x3fc846,null));};exports['update']=function(_0x402ff6,_0xe63353){if(_0x402ff6['body']['id']){delete _0x402ff6['body']['id'];}return db[_0x8ea0('0x33')][_0x8ea0('0x4f')]({'where':{'id':_0x402ff6[_0x8ea0('0x4d')]['id']}})[_0x8ea0('0x29')](handleEntityNotFound(_0xe63353,null))[_0x8ea0('0x29')](saveUpdates(_0x402ff6[_0x8ea0('0x55')],null))[_0x8ea0('0x29')](respondWithResult(_0xe63353,null))[_0x8ea0('0x4b')](handleError(_0xe63353,null));};exports[_0x8ea0('0x2a')]=function(_0x5adc6c,_0x94e1){return db[_0x8ea0('0x33')]['find']({'where':{'id':_0x5adc6c[_0x8ea0('0x4d')]['id']}})[_0x8ea0('0x29')](handleEntityNotFound(_0x94e1,null))[_0x8ea0('0x29')](removeEntity(_0x94e1,null))[_0x8ea0('0x4b')](handleError(_0x94e1,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 703f1ce..a80f4e8 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 _0x76b1=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','util','../../config/logger','api','moment'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x76b1,0x10d));var _0x176b=function(_0x1938a6,_0x5955e3){_0x1938a6=_0x1938a6-0x0;var _0xccd1ae=_0x76b1[_0x1938a6];return _0xccd1ae;};'use strict';var _=require('lodash');var util=require(_0x176b('0x0'));var logger=require(_0x176b('0x1'))(_0x176b('0x2'));var moment=require(_0x176b('0x3'));var BPromise=require(_0x176b('0x4'));var rp=require(_0x176b('0x5'));var fs=require('fs');var path=require(_0x176b('0x6'));var rimraf=require(_0x176b('0x7'));var config=require(_0x176b('0x8'));var attributes=require(_0x176b('0x9'));module[_0x176b('0xa')]=function(_0x3076ea,_0x3d715e){return _0x3076ea['define'](_0x176b('0xb'),attributes,{'tableName':_0x176b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ed=['../../config/environment','./template.attributes','define','Template','tools_templates','util','request-promise','path','rimraf'];(function(_0x3240dd,_0x56dca2){var _0x1fcbb8=function(_0x38bdf7){while(--_0x38bdf7){_0x3240dd['push'](_0x3240dd['shift']());}};_0x1fcbb8(++_0x56dca2);}(_0xb9ed,0x152));var _0xdb9e=function(_0x4f4af2,_0x4c86f6){_0x4f4af2=_0x4f4af2-0x0;var _0x37aa51=_0xb9ed[_0x4f4af2];return _0x37aa51;};'use strict';var _=require('lodash');var util=require(_0xdb9e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb9e('0x1'));var fs=require('fs');var path=require(_0xdb9e('0x2'));var rimraf=require(_0xdb9e('0x3'));var config=require(_0xdb9e('0x4'));var attributes=require(_0xdb9e('0x5'));module['exports']=function(_0x3ed49d,_0x21da54){return _0x3ed49d[_0xdb9e('0x6')](_0xdb9e('0x7'),attributes,{'tableName':_0xdb9e('0x8'),'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 d1e5ccf..25de794 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 _0x78ce=['message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2e5c60,_0x145aa0){var _0x50eeb9=function(_0x3689ec){while(--_0x3689ec){_0x2e5c60['push'](_0x2e5c60['shift']());}};_0x50eeb9(++_0x145aa0);}(_0x78ce,0x158));var _0xe78c=function(_0x2c04d9,_0x59ec65){_0x2c04d9=_0x2c04d9-0x0;var _0x5ad09a=_0x78ce[_0x2c04d9];return _0x5ad09a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe78c('0x0'));var rs=require(_0xe78c('0x1'));var fs=require('fs');var Redis=require(_0xe78c('0x2'));var db=require(_0xe78c('0x3'))['db'];var utils=require(_0xe78c('0x4'));var logger=require(_0xe78c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe78c('0x6'));var client=jayson[_0xe78c('0x7')][_0xe78c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45d0f9,_0x165133,_0x72ec90){return new BPromise(function(_0x2ac46b,_0x1ba1a2){return client['request'](_0x45d0f9,_0x72ec90)[_0xe78c('0x9')](function(_0x49f5f5){logger[_0xe78c('0xa')](_0xe78c('0xb'),_0x165133,_0xe78c('0xc'));logger[_0xe78c('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x165133,'request\x20sent',JSON[_0xe78c('0xe')](_0x49f5f5));if(_0x49f5f5[_0xe78c('0xf')]){if(_0x49f5f5['error']['code']===0x1f4){logger[_0xe78c('0xf')]('Template,\x20%s,\x20%s',_0x165133,_0x49f5f5[_0xe78c('0xf')][_0xe78c('0x10')]);return _0x1ba1a2(_0x49f5f5[_0xe78c('0xf')][_0xe78c('0x10')]);}logger[_0xe78c('0xf')](_0xe78c('0xb'),_0x165133,_0x49f5f5['error'][_0xe78c('0x10')]);return _0x2ac46b(_0x49f5f5[_0xe78c('0xf')][_0xe78c('0x10')]);}else{logger[_0xe78c('0xa')](_0xe78c('0xb'),_0x165133,_0xe78c('0xc'));_0x2ac46b(_0x49f5f5[_0xe78c('0x11')][_0xe78c('0x10')]);}})[_0xe78c('0x12')](function(_0x1d80fd){logger['error'](_0xe78c('0xb'),_0x165133,_0x1d80fd);_0x1ba1a2(_0x1d80fd);});});}exports[_0xe78c('0x13')]=function(_0x4f25f0){var _0x4f693f=this;return new Promise(function(_0x3198cf,_0x333aca){return db[_0xe78c('0x14')][_0xe78c('0x15')]({'raw':_0x4f25f0[_0xe78c('0x16')]?_0x4f25f0[_0xe78c('0x16')][_0xe78c('0x17')]===undefined?!![]:![]:!![],'where':_0x4f25f0[_0xe78c('0x16')]?_0x4f25f0['options'][_0xe78c('0x18')]||null:null,'attributes':_0x4f25f0[_0xe78c('0x16')]?_0x4f25f0[_0xe78c('0x16')][_0xe78c('0x19')]||null:null,'limit':_0x4f25f0['options']?_0x4f25f0['options'][_0xe78c('0x1a')]||null:null,'include':_0x4f25f0[_0xe78c('0x16')]?_0x4f25f0[_0xe78c('0x16')][_0xe78c('0x1b')]?_['map'](_0x4f25f0[_0xe78c('0x16')][_0xe78c('0x1b')],function(_0x4911cd){return{'model':db[_0x4911cd[_0xe78c('0x1c')]],'as':_0x4911cd['as'],'attributes':_0x4911cd[_0xe78c('0x19')],'include':_0x4911cd['include']?_[_0xe78c('0x1d')](_0x4911cd['include'],function(_0x1c034f){return{'model':db[_0x1c034f[_0xe78c('0x1c')]],'as':_0x1c034f['as'],'attributes':_0x1c034f[_0xe78c('0x19')],'include':_0x1c034f[_0xe78c('0x1b')]?_[_0xe78c('0x1d')](_0x1c034f[_0xe78c('0x1b')],function(_0x9c0508){return{'model':db[_0x9c0508['model']],'as':_0x9c0508['as'],'attributes':_0x9c0508[_0xe78c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe78c('0x9')](function(_0x32443b){logger[_0xe78c('0xa')]('GetTemplate',_0x4f25f0);logger['debug'](_0xe78c('0x13'),_0x4f25f0,JSON['stringify'](_0x32443b));_0x3198cf(_0x32443b);})['catch'](function(_0x367623){logger[_0xe78c('0xf')](_0xe78c('0x13'),_0x367623[_0xe78c('0x10')],_0x4f25f0);_0x333aca(_0x4f693f[_0xe78c('0xf')](0x1f4,_0x367623[_0xe78c('0x10')]));});});}; \ No newline at end of file +var _0x46a8=['request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Template','findAll','options','raw','attributes','limit','include','map','model','GetTemplate','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Template,\x20%s,\x20%s'];(function(_0x40ff4b,_0x2f3936){var _0x2080c2=function(_0xd5ddee){while(--_0xd5ddee){_0x40ff4b['push'](_0x40ff4b['shift']());}};_0x2080c2(++_0x2f3936);}(_0x46a8,0x1c4));var _0x846a=function(_0x8a6b46,_0xdcb30f){_0x8a6b46=_0x8a6b46-0x0;var _0x2f0bf2=_0x46a8[_0x8a6b46];return _0x2f0bf2;};'use strict';var _=require(_0x846a('0x0'));var util=require(_0x846a('0x1'));var moment=require(_0x846a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x846a('0x3'));var db=require(_0x846a('0x4'))['db'];var utils=require(_0x846a('0x5'));var logger=require(_0x846a('0x6'))(_0x846a('0x7'));var config=require(_0x846a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x846a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9cc27d,_0x4b9c67,_0x30a483){return new BPromise(function(_0x3e4a8f,_0x5a0e46){return client['request'](_0x9cc27d,_0x30a483)[_0x846a('0xa')](function(_0x594afc){logger[_0x846a('0xb')](_0x846a('0xc'),_0x4b9c67,_0x846a('0xd'));logger['debug'](_0x846a('0xe'),_0x4b9c67,_0x846a('0xd'),JSON[_0x846a('0xf')](_0x594afc));if(_0x594afc[_0x846a('0x10')]){if(_0x594afc[_0x846a('0x10')][_0x846a('0x11')]===0x1f4){logger[_0x846a('0x10')](_0x846a('0xc'),_0x4b9c67,_0x594afc[_0x846a('0x10')]['message']);return _0x5a0e46(_0x594afc[_0x846a('0x10')][_0x846a('0x12')]);}logger['error'](_0x846a('0xc'),_0x4b9c67,_0x594afc[_0x846a('0x10')]['message']);return _0x3e4a8f(_0x594afc[_0x846a('0x10')]['message']);}else{logger[_0x846a('0xb')](_0x846a('0xc'),_0x4b9c67,_0x846a('0xd'));_0x3e4a8f(_0x594afc['result'][_0x846a('0x12')]);}})[_0x846a('0x13')](function(_0x260feb){logger[_0x846a('0x10')]('Template,\x20%s,\x20%s',_0x4b9c67,_0x260feb);_0x5a0e46(_0x260feb);});});}exports['GetTemplate']=function(_0x232336){var _0x310d78=this;return new Promise(function(_0x1f5782,_0x3d14a2){return db[_0x846a('0x14')][_0x846a('0x15')]({'raw':_0x232336[_0x846a('0x16')]?_0x232336['options'][_0x846a('0x17')]===undefined?!![]:![]:!![],'where':_0x232336[_0x846a('0x16')]?_0x232336[_0x846a('0x16')]['where']||null:null,'attributes':_0x232336[_0x846a('0x16')]?_0x232336[_0x846a('0x16')][_0x846a('0x18')]||null:null,'limit':_0x232336['options']?_0x232336[_0x846a('0x16')][_0x846a('0x19')]||null:null,'include':_0x232336[_0x846a('0x16')]?_0x232336[_0x846a('0x16')][_0x846a('0x1a')]?_[_0x846a('0x1b')](_0x232336[_0x846a('0x16')][_0x846a('0x1a')],function(_0x53ebfb){return{'model':db[_0x53ebfb[_0x846a('0x1c')]],'as':_0x53ebfb['as'],'attributes':_0x53ebfb[_0x846a('0x18')],'include':_0x53ebfb[_0x846a('0x1a')]?_[_0x846a('0x1b')](_0x53ebfb['include'],function(_0xbab9){return{'model':db[_0xbab9[_0x846a('0x1c')]],'as':_0xbab9['as'],'attributes':_0xbab9[_0x846a('0x18')],'include':_0xbab9['include']?_[_0x846a('0x1b')](_0xbab9['include'],function(_0x2952ce){return{'model':db[_0x2952ce[_0x846a('0x1c')]],'as':_0x2952ce['as'],'attributes':_0x2952ce[_0x846a('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f8d95){logger['info'](_0x846a('0x1d'),_0x232336);logger[_0x846a('0x1e')](_0x846a('0x1d'),_0x232336,JSON['stringify'](_0x3f8d95));_0x1f5782(_0x3f8d95);})[_0x846a('0x13')](function(_0x29d7cd){logger[_0x846a('0x10')](_0x846a('0x1d'),_0x29d7cd['message'],_0x232336);_0x3d14a2(_0x310d78['error'](0x1f4,_0x29d7cd[_0x846a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 2228bdc..cabd966 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 _0xce41=['/:id/all_conditions','addAllCondition','addAction','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','getAllConditions','getAnyConditions','/:id/actions','getActions','post'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xce41,0x1c0));var _0x1ce4=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0xce41[_0x21bfab];return _0x4db318;};'use strict';var multer=require(_0x1ce4('0x0'));var util=require('util');var path=require(_0x1ce4('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ce4('0x2'));var router=express[_0x1ce4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ce4('0x4'));var interaction=require(_0x1ce4('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x1ce4('0x6')]('/',auth[_0x1ce4('0x7')](),controller['index']);router[_0x1ce4('0x6')](_0x1ce4('0x8'),auth[_0x1ce4('0x7')](),controller['show']);router[_0x1ce4('0x6')]('/:id/all_conditions',auth[_0x1ce4('0x7')](),controller[_0x1ce4('0x9')]);router[_0x1ce4('0x6')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x1ce4('0xa')]);router[_0x1ce4('0x6')](_0x1ce4('0xb'),auth['isAuthenticated'](),controller[_0x1ce4('0xc')]);router[_0x1ce4('0xd')]('/',auth[_0x1ce4('0x7')](),controller['create']);router['post'](_0x1ce4('0xe'),auth[_0x1ce4('0x7')](),controller[_0x1ce4('0xf')]);router[_0x1ce4('0xd')]('/:id/any_conditions',auth[_0x1ce4('0x7')](),controller['addAnyCondition']);router[_0x1ce4('0xd')](_0x1ce4('0xb'),auth[_0x1ce4('0x7')](),controller[_0x1ce4('0x10')]);router['put'](_0x1ce4('0x8'),auth[_0x1ce4('0x7')](),controller[_0x1ce4('0x11')]);router[_0x1ce4('0x12')]('/:id',auth[_0x1ce4('0x7')](),controller[_0x1ce4('0x13')]);module[_0x1ce4('0x14')]=router; \ No newline at end of file +var _0x64e7=['/:id/actions','update','delete','destroy','exports','multer','express','Router','fs-extra','../../config/environment','./trigger.controller','index','/:id','show','get','/:id/all_conditions','isAuthenticated','getAnyConditions','getActions','addAllCondition','post','/:id/any_conditions','addAnyCondition'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x64e7,0x119));var _0x764e=function(_0x215889,_0xee88fb){_0x215889=_0x215889-0x0;var _0x1b0d81=_0x64e7[_0x215889];return _0x1b0d81;};'use strict';var multer=require(_0x764e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x764e('0x1'));var router=express[_0x764e('0x2')]();var fs_extra=require(_0x764e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x764e('0x4'));var controller=require(_0x764e('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x764e('0x6')]);router['get'](_0x764e('0x7'),auth['isAuthenticated'](),controller[_0x764e('0x8')]);router[_0x764e('0x9')](_0x764e('0xa'),auth[_0x764e('0xb')](),controller['getAllConditions']);router[_0x764e('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x764e('0xc')]);router[_0x764e('0x9')]('/:id/actions',auth[_0x764e('0xb')](),controller[_0x764e('0xd')]);router['post']('/',auth[_0x764e('0xb')](),controller['create']);router['post'](_0x764e('0xa'),auth[_0x764e('0xb')](),controller[_0x764e('0xe')]);router[_0x764e('0xf')](_0x764e('0x10'),auth[_0x764e('0xb')](),controller[_0x764e('0x11')]);router[_0x764e('0xf')](_0x764e('0x12'),auth['isAuthenticated'](),controller['addAction']);router['put'](_0x764e('0x7'),auth[_0x764e('0xb')](),controller[_0x764e('0x13')]);router[_0x764e('0x14')](_0x764e('0x7'),auth[_0x764e('0xb')](),controller[_0x764e('0x15')]);module[_0x764e('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 15aad76..aa6b67b 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 _0xc4eb=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4a2ecd,_0x352dbe){var _0x474b98=function(_0x5aec81){while(--_0x5aec81){_0x4a2ecd['push'](_0x4a2ecd['shift']());}};_0x474b98(++_0x352dbe);}(_0xc4eb,0x1d8));var _0xbc4e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc4eb[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xbc4e('0x0'));module[_0xbc4e('0x1')]={'name':{'type':Sequelize[_0xbc4e('0x2')]},'channel':{'type':Sequelize[_0xbc4e('0x2')]},'description':{'type':Sequelize[_0xbc4e('0x2')]},'status':{'type':Sequelize[_0xbc4e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9f5e=['STRING','sequelize','exports'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x9f5e,0x67));var _0xe9f5=function(_0x349962,_0x41b1ec){_0x349962=_0x349962-0x0;var _0x5b0dda=_0x9f5e[_0x349962];return _0x5b0dda;};'use strict';var Sequelize=require(_0xe9f5('0x0'));module[_0xe9f5('0x1')]={'name':{'type':Sequelize[_0xe9f5('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe9f5('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 14221c4..b752e80 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 _0x0f92=['UserProfileSection','autoAssociation','error','params','addAllCondition','TriggerAllId','addAnyCondition','getAllConditions','findOne','Condition','pick','hasOwnProperty','getAnyConditions','addAction','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','Trigger','rawAttributes','model','query','keys','filters','fields','length','attributes','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','catch','show','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x0f92,0x18c));var _0x20f9=function(_0x235135,_0x1d3b5f){_0x235135=_0x235135-0x0;var _0x472b47=_0x0f92[_0x235135];return _0x472b47;};'use strict';var emlformat=require(_0x20f9('0x0'));var rimraf=require(_0x20f9('0x1'));var zipdir=require(_0x20f9('0x2'));var jsonpatch=require(_0x20f9('0x3'));var rp=require(_0x20f9('0x4'));var moment=require('moment');var BPromise=require(_0x20f9('0x5'));var Mustache=require(_0x20f9('0x6'));var util=require(_0x20f9('0x7'));var path=require(_0x20f9('0x8'));var sox=require(_0x20f9('0x9'));var csv=require(_0x20f9('0xa'));var ejs=require(_0x20f9('0xb'));var fs=require('fs');var fs_extra=require(_0x20f9('0xc'));var _=require('lodash');var squel=require(_0x20f9('0xd'));var crypto=require(_0x20f9('0xe'));var jsforce=require(_0x20f9('0xf'));var deskjs=require(_0x20f9('0x10'));var toCsv=require(_0x20f9('0xa'));var querystring=require(_0x20f9('0x11'));var Papa=require(_0x20f9('0x12'));var Redis=require(_0x20f9('0x13'));var authService=require(_0x20f9('0x14'));var qs=require(_0x20f9('0x15'));var as=require(_0x20f9('0x16'));var hardwareService=require(_0x20f9('0x17'));var logger=require('../../config/logger')(_0x20f9('0x18'));var utils=require(_0x20f9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x20f9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28be14,_0x128afc){_0x128afc=_0x128afc||0xcc;return function(_0xef492b){if(_0xef492b){return _0x28be14['sendStatus'](_0x128afc);}return _0x28be14[_0x20f9('0x1b')](_0x128afc)[_0x20f9('0x1c')]();};}function respondWithResult(_0x1d760a,_0x31ba28){_0x31ba28=_0x31ba28||0xc8;return function(_0x522444){if(_0x522444){return _0x1d760a[_0x20f9('0x1b')](_0x31ba28)['json'](_0x522444);}};}function respondWithFilteredResult(_0x240777,_0x50ee95){return function(_0x7fd1c3){if(_0x7fd1c3){var _0x461507=typeof _0x50ee95[_0x20f9('0x1d')]===_0x20f9('0x1e')&&typeof _0x50ee95[_0x20f9('0x1f')]==='undefined';var _0x1bfa2d=_0x7fd1c3[_0x20f9('0x20')];var _0x17642c=_0x461507?0x0:_0x50ee95['offset'];var _0x557ce4=_0x461507?_0x7fd1c3[_0x20f9('0x20')]:_0x50ee95[_0x20f9('0x1d')]+_0x50ee95[_0x20f9('0x1f')];var _0x113306;if(_0x557ce4>=_0x1bfa2d){_0x557ce4=_0x1bfa2d;_0x113306=0xc8;}else{_0x113306=0xce;}_0x240777['status'](_0x113306);return _0x240777[_0x20f9('0x21')](_0x20f9('0x22'),_0x17642c+'-'+_0x557ce4+'/'+_0x1bfa2d)[_0x20f9('0x23')](_0x7fd1c3);}return null;};}function patchUpdates(_0x5aace3){return function(_0x14a0a0){try{jsonpatch['apply'](_0x14a0a0,_0x5aace3,!![]);}catch(_0x1fd078){return BPromise[_0x20f9('0x24')](_0x1fd078);}return _0x14a0a0[_0x20f9('0x25')]();};}function saveUpdates(_0x4d08a5,_0x3b50a6){return function(_0x2c6568){if(_0x2c6568){return _0x2c6568[_0x20f9('0x26')](_0x4d08a5)[_0x20f9('0x27')](function(_0x165522){return _0x165522;});}return null;};}function removeEntity(_0x1adc38,_0x1e8d31){return function(_0x6aa7e5){if(_0x6aa7e5){return _0x6aa7e5[_0x20f9('0x28')]()[_0x20f9('0x27')](function(){var _0xa64337=_0x6aa7e5[_0x20f9('0x29')]({'plain':!![]});var _0x49555b='Triggers';return db[_0x20f9('0x2a')][_0x20f9('0x28')]({'where':{'type':_0x49555b,'resourceId':_0xa64337['id']}})[_0x20f9('0x27')](function(){return _0x6aa7e5;});})[_0x20f9('0x27')](function(){_0x1adc38[_0x20f9('0x1b')](0xcc)[_0x20f9('0x1c')]();});}};}function handleEntityNotFound(_0x5a8eaf,_0x1e2a46){return function(_0x187e13){if(!_0x187e13){_0x5a8eaf[_0x20f9('0x2b')](0x194);}return _0x187e13;};}function handleError(_0x2a3089,_0x386073){_0x386073=_0x386073||0x1f4;return function(_0x4e79cc){logger['error'](_0x4e79cc[_0x20f9('0x2c')]);if(_0x4e79cc['name']){delete _0x4e79cc[_0x20f9('0x2d')];}_0x2a3089['status'](_0x386073)[_0x20f9('0x2e')](_0x4e79cc);};}exports[_0x20f9('0x2f')]=function(_0x287669,_0x1fa62f){var _0x3dd8b6={},_0x4de41c={},_0x23ad59={'count':0x0,'rows':[]};var _0x487fc4=_[_0x20f9('0x30')](db[_0x20f9('0x31')][_0x20f9('0x32')],function(_0xd5b94c){return{'name':_0xd5b94c['fieldName'],'type':_0xd5b94c['type']['key']};});_0x4de41c[_0x20f9('0x33')]=_[_0x20f9('0x30')](_0x487fc4,_0x20f9('0x2d'));_0x4de41c[_0x20f9('0x34')]=_[_0x20f9('0x35')](_0x287669[_0x20f9('0x34')]);_0x4de41c[_0x20f9('0x36')]=_['intersection'](_0x4de41c[_0x20f9('0x33')],_0x4de41c['query']);_0x3dd8b6['attributes']=_['intersection'](_0x4de41c['model'],qs['fields'](_0x287669[_0x20f9('0x34')][_0x20f9('0x37')]));_0x3dd8b6['attributes']=_0x3dd8b6['attributes'][_0x20f9('0x38')]?_0x3dd8b6[_0x20f9('0x39')]:_0x4de41c[_0x20f9('0x33')];if(!_0x287669[_0x20f9('0x34')]['hasOwnProperty'](_0x20f9('0x3a'))){_0x3dd8b6[_0x20f9('0x1f')]=qs[_0x20f9('0x1f')](_0x287669[_0x20f9('0x34')]['limit']);_0x3dd8b6[_0x20f9('0x1d')]=qs['offset'](_0x287669['query'][_0x20f9('0x1d')]);}_0x3dd8b6[_0x20f9('0x3b')]=qs['sort'](_0x287669[_0x20f9('0x34')][_0x20f9('0x3c')]);_0x3dd8b6[_0x20f9('0x3d')]=qs[_0x20f9('0x36')](_['pick'](_0x287669[_0x20f9('0x34')],_0x4de41c[_0x20f9('0x36')]),_0x487fc4);if(_0x287669[_0x20f9('0x34')][_0x20f9('0x3e')]){_0x3dd8b6['where']=_['merge'](_0x3dd8b6[_0x20f9('0x3d')],{'$or':_[_0x20f9('0x30')](_0x487fc4,function(_0x2b047b){if(_0x2b047b[_0x20f9('0x3f')]!=='VIRTUAL'){var _0x15f249={};_0x15f249[_0x2b047b['name']]={'$like':'%'+_0x287669[_0x20f9('0x34')][_0x20f9('0x3e')]+'%'};return _0x15f249;}})});}_0x3dd8b6=_[_0x20f9('0x40')]({},_0x3dd8b6,_0x287669[_0x20f9('0x41')]);var _0x75660b={'where':_0x3dd8b6[_0x20f9('0x3d')]};return db[_0x20f9('0x31')][_0x20f9('0x20')](_0x75660b)['then'](function(_0x41ca61){_0x23ad59[_0x20f9('0x20')]=_0x41ca61;if(_0x287669[_0x20f9('0x34')][_0x20f9('0x42')]){_0x3dd8b6[_0x20f9('0x43')]=[{'all':!![]}];}return db['Trigger'][_0x20f9('0x44')](_0x3dd8b6);})[_0x20f9('0x27')](function(_0x1beab2){_0x23ad59['rows']=_0x1beab2;return _0x23ad59;})[_0x20f9('0x27')](respondWithFilteredResult(_0x1fa62f,_0x3dd8b6))[_0x20f9('0x45')](handleError(_0x1fa62f,null));};exports[_0x20f9('0x46')]=function(_0x47a3ea,_0x49bba4){var _0x16cf7e={'raw':![],'where':{'id':_0x47a3ea['params']['id']}},_0x2ab2e4={};_0x2ab2e4[_0x20f9('0x33')]=_[_0x20f9('0x35')](db[_0x20f9('0x31')]['rawAttributes']);_0x2ab2e4[_0x20f9('0x34')]=_['keys'](_0x47a3ea[_0x20f9('0x34')]);_0x2ab2e4[_0x20f9('0x36')]=_[_0x20f9('0x47')](_0x2ab2e4[_0x20f9('0x33')],_0x2ab2e4[_0x20f9('0x34')]);_0x16cf7e[_0x20f9('0x39')]=_[_0x20f9('0x47')](_0x2ab2e4[_0x20f9('0x33')],qs['fields'](_0x47a3ea[_0x20f9('0x34')][_0x20f9('0x37')]));_0x16cf7e[_0x20f9('0x39')]=_0x16cf7e[_0x20f9('0x39')]['length']?_0x16cf7e[_0x20f9('0x39')]:_0x2ab2e4[_0x20f9('0x33')];if(_0x47a3ea['query'][_0x20f9('0x42')]){_0x16cf7e[_0x20f9('0x43')]=[{'all':!![]}];}_0x16cf7e=_['merge']({},_0x16cf7e,_0x47a3ea[_0x20f9('0x41')]);return db[_0x20f9('0x31')][_0x20f9('0x48')](_0x16cf7e)['then'](handleEntityNotFound(_0x49bba4,null))[_0x20f9('0x27')](respondWithResult(_0x49bba4,null))[_0x20f9('0x45')](handleError(_0x49bba4,null));};exports[_0x20f9('0x49')]=function(_0x826c68,_0x1d2116){return db['Trigger']['create'](_0x826c68[_0x20f9('0x4a')],{})[_0x20f9('0x27')](function(_0x3c6658){var _0x43e0c4=_0x826c68['user'][_0x20f9('0x29')]({'plain':!![]});if(!_0x43e0c4)throw new Error(_0x20f9('0x4b'));if(_0x43e0c4[_0x20f9('0x4c')]===_0x20f9('0x4d')){var _0x3556ea=_0x3c6658[_0x20f9('0x29')]({'plain':!![]});var _0x53396a=_0x20f9('0x4e');return db[_0x20f9('0x4f')]['find']({'where':{'name':_0x53396a,'userProfileId':_0x43e0c4['userProfileId']},'raw':!![]})[_0x20f9('0x27')](function(_0x21d04c){if(_0x21d04c&&_0x21d04c[_0x20f9('0x50')]===0x0){return db[_0x20f9('0x2a')][_0x20f9('0x49')]({'name':_0x3556ea[_0x20f9('0x2d')],'resourceId':_0x3556ea['id'],'type':_0x21d04c[_0x20f9('0x2d')],'sectionId':_0x21d04c['id']},{})[_0x20f9('0x27')](function(){return _0x3c6658;});}else{return _0x3c6658;}})[_0x20f9('0x45')](function(_0x3afec5){logger[_0x20f9('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3afec5);throw _0x3afec5;});}return _0x3c6658;})[_0x20f9('0x27')](respondWithResult(_0x1d2116,0xc9))[_0x20f9('0x45')](handleError(_0x1d2116,null));};exports['update']=function(_0x36ee5b,_0x2e8bb5){if(_0x36ee5b['body']['id']){delete _0x36ee5b['body']['id'];}return db[_0x20f9('0x31')]['find']({'where':{'id':_0x36ee5b[_0x20f9('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e8bb5,null))['then'](saveUpdates(_0x36ee5b[_0x20f9('0x4a')],null))[_0x20f9('0x27')](respondWithResult(_0x2e8bb5,null))[_0x20f9('0x45')](handleError(_0x2e8bb5,null));};exports[_0x20f9('0x28')]=function(_0x457cf2,_0x21c0ca){return db[_0x20f9('0x31')][_0x20f9('0x48')]({'where':{'id':_0x457cf2[_0x20f9('0x52')]['id']}})[_0x20f9('0x27')](handleEntityNotFound(_0x21c0ca,null))[_0x20f9('0x27')](removeEntity(_0x21c0ca,null))[_0x20f9('0x45')](handleError(_0x21c0ca,null));};exports[_0x20f9('0x53')]=function(_0x51145b,_0x1c78f3,_0xd39fc0){if(_0x51145b[_0x20f9('0x4a')]['id']){delete _0x51145b[_0x20f9('0x4a')]['id'];}return db[_0x20f9('0x31')][_0x20f9('0x48')]({'where':{'id':_0x51145b['params']['id']}})[_0x20f9('0x27')](handleEntityNotFound(_0x1c78f3,null))['then'](function(_0xb54908){if(_0xb54908){_0x51145b[_0x20f9('0x4a')][_0x20f9('0x54')]=_0xb54908['id'];return db['Condition']['create'](_0x51145b[_0x20f9('0x4a')]);}})[_0x20f9('0x27')](respondWithResult(_0x1c78f3,null))[_0x20f9('0x45')](handleError(_0x1c78f3,null));};exports[_0x20f9('0x55')]=function(_0x392cdb,_0x4b79e8,_0x73bbb3){if(_0x392cdb[_0x20f9('0x4a')]['id']){delete _0x392cdb[_0x20f9('0x4a')]['id'];}return db[_0x20f9('0x31')][_0x20f9('0x48')]({'where':{'id':_0x392cdb['params']['id']}})[_0x20f9('0x27')](handleEntityNotFound(_0x4b79e8,null))[_0x20f9('0x27')](function(_0x161cec){if(_0x161cec){_0x392cdb[_0x20f9('0x4a')]['TriggerAnyId']=_0x161cec['id'];return db['Condition'][_0x20f9('0x49')](_0x392cdb[_0x20f9('0x4a')]);}})[_0x20f9('0x27')](respondWithResult(_0x4b79e8,null))[_0x20f9('0x45')](handleError(_0x4b79e8,null));};exports[_0x20f9('0x56')]=function(_0x7b2852,_0x398207,_0x5ea6bf){var _0x15c465={};var _0x3b6f17={};var _0x1b8f3c;var _0x2b363e;return db[_0x20f9('0x31')][_0x20f9('0x57')]({'where':{'id':_0x7b2852[_0x20f9('0x52')]['id']}})[_0x20f9('0x27')](handleEntityNotFound(_0x398207,null))[_0x20f9('0x27')](function(_0x1785d6){if(_0x1785d6){_0x1b8f3c=_0x1785d6;_0x3b6f17[_0x20f9('0x33')]=_[_0x20f9('0x35')](db[_0x20f9('0x58')]['rawAttributes']);_0x3b6f17[_0x20f9('0x34')]=_[_0x20f9('0x35')](_0x7b2852[_0x20f9('0x34')]);_0x3b6f17[_0x20f9('0x36')]=_[_0x20f9('0x47')](_0x3b6f17[_0x20f9('0x33')],_0x3b6f17[_0x20f9('0x34')]);_0x15c465[_0x20f9('0x39')]=_['intersection'](_0x3b6f17[_0x20f9('0x33')],qs[_0x20f9('0x37')](_0x7b2852['query'][_0x20f9('0x37')]));_0x15c465[_0x20f9('0x39')]=_0x15c465['attributes'][_0x20f9('0x38')]?_0x15c465['attributes']:_0x3b6f17['model'];_0x15c465[_0x20f9('0x3b')]=qs[_0x20f9('0x3c')](_0x7b2852[_0x20f9('0x34')]['sort']);_0x15c465[_0x20f9('0x3d')]=qs['filters'](_[_0x20f9('0x59')](_0x7b2852[_0x20f9('0x34')],_0x3b6f17[_0x20f9('0x36')]));if(_0x7b2852[_0x20f9('0x34')][_0x20f9('0x3e')]){_0x15c465[_0x20f9('0x3d')]=_[_0x20f9('0x40')](_0x15c465[_0x20f9('0x3d')],{'$or':_[_0x20f9('0x30')](_0x15c465['attributes'],function(_0x34012d){var _0x4097fe={};_0x4097fe[_0x34012d]={'$like':'%'+_0x7b2852['query'][_0x20f9('0x3e')]+'%'};return _0x4097fe;})});}_0x15c465=_[_0x20f9('0x40')]({},_0x15c465,_0x7b2852[_0x20f9('0x41')]);return _0x1b8f3c['getAllConditions'](_0x15c465);}})[_0x20f9('0x27')](function(_0x2da3c2){if(_0x2da3c2){_0x2b363e=_0x2da3c2[_0x20f9('0x38')];if(!_0x7b2852[_0x20f9('0x34')][_0x20f9('0x5a')](_0x20f9('0x3a'))){_0x15c465[_0x20f9('0x1f')]=qs[_0x20f9('0x1f')](_0x7b2852['query'][_0x20f9('0x1f')]);_0x15c465[_0x20f9('0x1d')]=qs[_0x20f9('0x1d')](_0x7b2852[_0x20f9('0x34')][_0x20f9('0x1d')]);}return _0x1b8f3c[_0x20f9('0x56')](_0x15c465);}})['then'](function(_0xea6bc9){if(_0xea6bc9){return _0xea6bc9?{'count':_0x2b363e,'rows':_0xea6bc9}:null;}})['then'](respondWithResult(_0x398207,null))['catch'](handleError(_0x398207,null));};exports[_0x20f9('0x5b')]=function(_0x2c06d6,_0x585a34,_0x193aa3){var _0x505b37={};var _0x1e742c={};var _0x12e2f1;var _0xd55744;return db[_0x20f9('0x31')][_0x20f9('0x57')]({'where':{'id':_0x2c06d6[_0x20f9('0x52')]['id']}})['then'](handleEntityNotFound(_0x585a34,null))[_0x20f9('0x27')](function(_0x5a986d){if(_0x5a986d){_0x12e2f1=_0x5a986d;_0x1e742c[_0x20f9('0x33')]=_['keys'](db[_0x20f9('0x58')]['rawAttributes']);_0x1e742c['query']=_[_0x20f9('0x35')](_0x2c06d6[_0x20f9('0x34')]);_0x1e742c[_0x20f9('0x36')]=_[_0x20f9('0x47')](_0x1e742c[_0x20f9('0x33')],_0x1e742c[_0x20f9('0x34')]);_0x505b37[_0x20f9('0x39')]=_['intersection'](_0x1e742c['model'],qs[_0x20f9('0x37')](_0x2c06d6[_0x20f9('0x34')][_0x20f9('0x37')]));_0x505b37['attributes']=_0x505b37[_0x20f9('0x39')][_0x20f9('0x38')]?_0x505b37['attributes']:_0x1e742c[_0x20f9('0x33')];_0x505b37[_0x20f9('0x3b')]=qs['sort'](_0x2c06d6[_0x20f9('0x34')]['sort']);_0x505b37[_0x20f9('0x3d')]=qs[_0x20f9('0x36')](_[_0x20f9('0x59')](_0x2c06d6[_0x20f9('0x34')],_0x1e742c[_0x20f9('0x36')]));if(_0x2c06d6[_0x20f9('0x34')]['filter']){_0x505b37[_0x20f9('0x3d')]=_[_0x20f9('0x40')](_0x505b37[_0x20f9('0x3d')],{'$or':_[_0x20f9('0x30')](_0x505b37['attributes'],function(_0x1048ff){var _0x42355c={};_0x42355c[_0x1048ff]={'$like':'%'+_0x2c06d6[_0x20f9('0x34')][_0x20f9('0x3e')]+'%'};return _0x42355c;})});}_0x505b37=_[_0x20f9('0x40')]({},_0x505b37,_0x2c06d6[_0x20f9('0x41')]);return _0x12e2f1[_0x20f9('0x5b')](_0x505b37);}})[_0x20f9('0x27')](function(_0x442dbe){if(_0x442dbe){_0xd55744=_0x442dbe[_0x20f9('0x38')];if(!_0x2c06d6[_0x20f9('0x34')][_0x20f9('0x5a')](_0x20f9('0x3a'))){_0x505b37[_0x20f9('0x1f')]=qs[_0x20f9('0x1f')](_0x2c06d6[_0x20f9('0x34')][_0x20f9('0x1f')]);_0x505b37[_0x20f9('0x1d')]=qs[_0x20f9('0x1d')](_0x2c06d6['query']['offset']);}return _0x12e2f1[_0x20f9('0x5b')](_0x505b37);}})[_0x20f9('0x27')](function(_0x12c258){if(_0x12c258){return _0x12c258?{'count':_0xd55744,'rows':_0x12c258}:null;}})[_0x20f9('0x27')](respondWithResult(_0x585a34,null))['catch'](handleError(_0x585a34,null));};exports[_0x20f9('0x5c')]=function(_0x67b636,_0x1f1020,_0x1094e3){if(_0x67b636['body']['id']){delete _0x67b636[_0x20f9('0x4a')]['id'];}return db[_0x20f9('0x31')]['find']({'where':{'id':_0x67b636[_0x20f9('0x52')]['id']}})[_0x20f9('0x27')](handleEntityNotFound(_0x1f1020,null))[_0x20f9('0x27')](function(_0x293616){if(_0x293616){_0x67b636['body']['TriggerId']=_0x293616['id'];return db['Action']['create'](_0x67b636[_0x20f9('0x4a')]);}})[_0x20f9('0x27')](respondWithResult(_0x1f1020,null))['catch'](handleError(_0x1f1020,null));};exports[_0x20f9('0x5d')]=function(_0x2b7dcf,_0x295f83,_0x4e6dde){var _0x144fa5={};var _0x985b31={};var _0x335340;var _0x428590;return db[_0x20f9('0x31')][_0x20f9('0x57')]({'where':{'id':_0x2b7dcf[_0x20f9('0x52')]['id']}})[_0x20f9('0x27')](handleEntityNotFound(_0x295f83,null))['then'](function(_0x276a4e){if(_0x276a4e){_0x335340=_0x276a4e;_0x985b31['model']=_['keys'](db[_0x20f9('0x5e')]['rawAttributes']);_0x985b31[_0x20f9('0x34')]=_[_0x20f9('0x35')](_0x2b7dcf[_0x20f9('0x34')]);_0x985b31[_0x20f9('0x36')]=_['intersection'](_0x985b31['model'],_0x985b31['query']);_0x144fa5['attributes']=_['intersection'](_0x985b31['model'],qs[_0x20f9('0x37')](_0x2b7dcf[_0x20f9('0x34')][_0x20f9('0x37')]));_0x144fa5[_0x20f9('0x39')]=_0x144fa5[_0x20f9('0x39')][_0x20f9('0x38')]?_0x144fa5[_0x20f9('0x39')]:_0x985b31[_0x20f9('0x33')];_0x144fa5[_0x20f9('0x3b')]=qs[_0x20f9('0x3c')](_0x2b7dcf[_0x20f9('0x34')][_0x20f9('0x3c')]);_0x144fa5[_0x20f9('0x3d')]=qs[_0x20f9('0x36')](_[_0x20f9('0x59')](_0x2b7dcf[_0x20f9('0x34')],_0x985b31[_0x20f9('0x36')]));if(_0x2b7dcf[_0x20f9('0x34')][_0x20f9('0x3e')]){_0x144fa5['where']=_[_0x20f9('0x40')](_0x144fa5['where'],{'$or':_[_0x20f9('0x30')](_0x144fa5[_0x20f9('0x39')],function(_0x1fd58b){var _0x2fae21={};_0x2fae21[_0x1fd58b]={'$like':'%'+_0x2b7dcf[_0x20f9('0x34')][_0x20f9('0x3e')]+'%'};return _0x2fae21;})});}_0x144fa5=_['merge']({},_0x144fa5,_0x2b7dcf[_0x20f9('0x41')]);return _0x335340[_0x20f9('0x5d')](_0x144fa5);}})['then'](function(_0x49ac1b){if(_0x49ac1b){_0x428590=_0x49ac1b[_0x20f9('0x38')];if(!_0x2b7dcf['query']['hasOwnProperty'](_0x20f9('0x3a'))){_0x144fa5[_0x20f9('0x1f')]=qs[_0x20f9('0x1f')](_0x2b7dcf['query'][_0x20f9('0x1f')]);_0x144fa5[_0x20f9('0x1d')]=qs[_0x20f9('0x1d')](_0x2b7dcf[_0x20f9('0x34')]['offset']);}return _0x335340[_0x20f9('0x5d')](_0x144fa5);}})[_0x20f9('0x27')](function(_0x4b8033){if(_0x4b8033){return _0x4b8033?{'count':_0x428590,'rows':_0x4b8033}:null;}})['then'](respondWithResult(_0x295f83,null))[_0x20f9('0x45')](handleError(_0x295f83,null));}; \ No newline at end of file +var _0xcf11=['addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','name','send','index','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Trigger','findAll','rows','catch','show','params','keys','rawAttributes','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4c9be7,_0x538b4d){var _0x5250a7=function(_0x4a71a0){while(--_0x4a71a0){_0x4c9be7['push'](_0x4c9be7['shift']());}};_0x5250a7(++_0x538b4d);}(_0xcf11,0x1c7));var _0x1cf1=function(_0x2dfe1c,_0x52165a){_0x2dfe1c=_0x2dfe1c-0x0;var _0x251ca2=_0xcf11[_0x2dfe1c];return _0x251ca2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cf1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cf1('0x1'));var rp=require(_0x1cf1('0x2'));var moment=require(_0x1cf1('0x3'));var BPromise=require(_0x1cf1('0x4'));var Mustache=require(_0x1cf1('0x5'));var util=require('util');var path=require(_0x1cf1('0x6'));var sox=require(_0x1cf1('0x7'));var csv=require('to-csv');var ejs=require(_0x1cf1('0x8'));var fs=require('fs');var fs_extra=require(_0x1cf1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1cf1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1cf1('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1cf1('0xc'));var Papa=require(_0x1cf1('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1cf1('0xe'));var hardwareService=require(_0x1cf1('0xf'));var logger=require('../../config/logger')(_0x1cf1('0x10'));var utils=require(_0x1cf1('0x11'));var config=require(_0x1cf1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2193c0,_0x3eaad3){_0x3eaad3=_0x3eaad3||0xcc;return function(_0x50f942){if(_0x50f942){return _0x2193c0[_0x1cf1('0x13')](_0x3eaad3);}return _0x2193c0['status'](_0x3eaad3)[_0x1cf1('0x14')]();};}function respondWithResult(_0x457553,_0x81e72c){_0x81e72c=_0x81e72c||0xc8;return function(_0x9beaf4){if(_0x9beaf4){return _0x457553[_0x1cf1('0x15')](_0x81e72c)[_0x1cf1('0x16')](_0x9beaf4);}};}function respondWithFilteredResult(_0x15cad2,_0x712af3){return function(_0x596c04){if(_0x596c04){var _0x20f987=typeof _0x712af3[_0x1cf1('0x17')]==='undefined'&&typeof _0x712af3['limit']===_0x1cf1('0x18');var _0x5c1f27=_0x596c04['count'];var _0x4ee672=_0x20f987?0x0:_0x712af3[_0x1cf1('0x17')];var _0xe7a045=_0x20f987?_0x596c04[_0x1cf1('0x19')]:_0x712af3[_0x1cf1('0x17')]+_0x712af3[_0x1cf1('0x1a')];var _0x323b23;if(_0xe7a045>=_0x5c1f27){_0xe7a045=_0x5c1f27;_0x323b23=0xc8;}else{_0x323b23=0xce;}_0x15cad2[_0x1cf1('0x15')](_0x323b23);return _0x15cad2[_0x1cf1('0x1b')](_0x1cf1('0x1c'),_0x4ee672+'-'+_0xe7a045+'/'+_0x5c1f27)[_0x1cf1('0x16')](_0x596c04);}return null;};}function patchUpdates(_0x3da95e){return function(_0x2e2131){try{jsonpatch['apply'](_0x2e2131,_0x3da95e,!![]);}catch(_0x195b30){return BPromise[_0x1cf1('0x1d')](_0x195b30);}return _0x2e2131['save']();};}function saveUpdates(_0x2ae6b5,_0x228613){return function(_0x557d03){if(_0x557d03){return _0x557d03[_0x1cf1('0x1e')](_0x2ae6b5)[_0x1cf1('0x1f')](function(_0x4a4a6f){return _0x4a4a6f;});}return null;};}function removeEntity(_0x20dece,_0xde7dab){return function(_0x1d2e57){if(_0x1d2e57){return _0x1d2e57[_0x1cf1('0x20')]()[_0x1cf1('0x1f')](function(){var _0x2629a3=_0x1d2e57[_0x1cf1('0x21')]({'plain':!![]});var _0x1149b4='Triggers';return db[_0x1cf1('0x22')]['destroy']({'where':{'type':_0x1149b4,'resourceId':_0x2629a3['id']}})[_0x1cf1('0x1f')](function(){return _0x1d2e57;});})[_0x1cf1('0x1f')](function(){_0x20dece[_0x1cf1('0x15')](0xcc)[_0x1cf1('0x14')]();});}};}function handleEntityNotFound(_0x56f4cc,_0x3a93b1){return function(_0x26733d){if(!_0x26733d){_0x56f4cc[_0x1cf1('0x13')](0x194);}return _0x26733d;};}function handleError(_0x71f678,_0x26f9bf){_0x26f9bf=_0x26f9bf||0x1f4;return function(_0x666a8f){logger['error'](_0x666a8f['stack']);if(_0x666a8f[_0x1cf1('0x23')]){delete _0x666a8f[_0x1cf1('0x23')];}_0x71f678['status'](_0x26f9bf)[_0x1cf1('0x24')](_0x666a8f);};}exports[_0x1cf1('0x25')]=function(_0x1efc60,_0x503452){var _0x2d5ea7={},_0xe8b024={},_0x337cf8={'count':0x0,'rows':[]};var _0x1493b0=_['map'](db['Trigger']['rawAttributes'],function(_0x2e7a85){return{'name':_0x2e7a85[_0x1cf1('0x26')],'type':_0x2e7a85[_0x1cf1('0x27')][_0x1cf1('0x28')]};});_0xe8b024[_0x1cf1('0x29')]=_[_0x1cf1('0x2a')](_0x1493b0,'name');_0xe8b024['query']=_['keys'](_0x1efc60[_0x1cf1('0x2b')]);_0xe8b024[_0x1cf1('0x2c')]=_['intersection'](_0xe8b024[_0x1cf1('0x29')],_0xe8b024['query']);_0x2d5ea7[_0x1cf1('0x2d')]=_['intersection'](_0xe8b024[_0x1cf1('0x29')],qs[_0x1cf1('0x2e')](_0x1efc60[_0x1cf1('0x2b')][_0x1cf1('0x2e')]));_0x2d5ea7[_0x1cf1('0x2d')]=_0x2d5ea7[_0x1cf1('0x2d')][_0x1cf1('0x2f')]?_0x2d5ea7[_0x1cf1('0x2d')]:_0xe8b024[_0x1cf1('0x29')];if(!_0x1efc60['query'][_0x1cf1('0x30')](_0x1cf1('0x31'))){_0x2d5ea7[_0x1cf1('0x1a')]=qs[_0x1cf1('0x1a')](_0x1efc60[_0x1cf1('0x2b')][_0x1cf1('0x1a')]);_0x2d5ea7[_0x1cf1('0x17')]=qs['offset'](_0x1efc60[_0x1cf1('0x2b')][_0x1cf1('0x17')]);}_0x2d5ea7[_0x1cf1('0x32')]=qs[_0x1cf1('0x33')](_0x1efc60[_0x1cf1('0x2b')][_0x1cf1('0x33')]);_0x2d5ea7[_0x1cf1('0x34')]=qs['filters'](_[_0x1cf1('0x35')](_0x1efc60[_0x1cf1('0x2b')],_0xe8b024[_0x1cf1('0x2c')]),_0x1493b0);if(_0x1efc60['query'][_0x1cf1('0x36')]){_0x2d5ea7[_0x1cf1('0x34')]=_[_0x1cf1('0x37')](_0x2d5ea7[_0x1cf1('0x34')],{'$or':_[_0x1cf1('0x2a')](_0x1493b0,function(_0x50f8b7){if(_0x50f8b7['type']!==_0x1cf1('0x38')){var _0x2545bd={};_0x2545bd[_0x50f8b7['name']]={'$like':'%'+_0x1efc60['query'][_0x1cf1('0x36')]+'%'};return _0x2545bd;}})});}_0x2d5ea7=_[_0x1cf1('0x37')]({},_0x2d5ea7,_0x1efc60[_0x1cf1('0x39')]);var _0x116758={'where':_0x2d5ea7[_0x1cf1('0x34')]};return db['Trigger']['count'](_0x116758)[_0x1cf1('0x1f')](function(_0x50acd7){_0x337cf8[_0x1cf1('0x19')]=_0x50acd7;if(_0x1efc60['query'][_0x1cf1('0x3a')]){_0x2d5ea7['include']=[{'all':!![]}];}return db[_0x1cf1('0x3b')][_0x1cf1('0x3c')](_0x2d5ea7);})[_0x1cf1('0x1f')](function(_0x48b056){_0x337cf8[_0x1cf1('0x3d')]=_0x48b056;return _0x337cf8;})[_0x1cf1('0x1f')](respondWithFilteredResult(_0x503452,_0x2d5ea7))[_0x1cf1('0x3e')](handleError(_0x503452,null));};exports[_0x1cf1('0x3f')]=function(_0x4318b5,_0x4d3edf){var _0x24bea1={'raw':![],'where':{'id':_0x4318b5[_0x1cf1('0x40')]['id']}},_0x54259f={};_0x54259f[_0x1cf1('0x29')]=_[_0x1cf1('0x41')](db[_0x1cf1('0x3b')][_0x1cf1('0x42')]);_0x54259f['query']=_[_0x1cf1('0x41')](_0x4318b5['query']);_0x54259f['filters']=_[_0x1cf1('0x43')](_0x54259f[_0x1cf1('0x29')],_0x54259f[_0x1cf1('0x2b')]);_0x24bea1[_0x1cf1('0x2d')]=_['intersection'](_0x54259f[_0x1cf1('0x29')],qs[_0x1cf1('0x2e')](_0x4318b5['query'][_0x1cf1('0x2e')]));_0x24bea1['attributes']=_0x24bea1[_0x1cf1('0x2d')]['length']?_0x24bea1[_0x1cf1('0x2d')]:_0x54259f[_0x1cf1('0x29')];if(_0x4318b5['query']['includeAll']){_0x24bea1['include']=[{'all':!![]}];}_0x24bea1=_[_0x1cf1('0x37')]({},_0x24bea1,_0x4318b5[_0x1cf1('0x39')]);return db[_0x1cf1('0x3b')][_0x1cf1('0x44')](_0x24bea1)[_0x1cf1('0x1f')](handleEntityNotFound(_0x4d3edf,null))[_0x1cf1('0x1f')](respondWithResult(_0x4d3edf,null))[_0x1cf1('0x3e')](handleError(_0x4d3edf,null));};exports['create']=function(_0x1ce8c5,_0x206bdb){return db[_0x1cf1('0x3b')]['create'](_0x1ce8c5[_0x1cf1('0x45')],{})[_0x1cf1('0x1f')](function(_0x3a7c08){var _0x22fb6b=_0x1ce8c5[_0x1cf1('0x46')][_0x1cf1('0x21')]({'plain':!![]});if(!_0x22fb6b)throw new Error(_0x1cf1('0x47'));if(_0x22fb6b[_0x1cf1('0x48')]===_0x1cf1('0x46')){var _0x4b09bb=_0x3a7c08[_0x1cf1('0x21')]({'plain':!![]});var _0x519b13=_0x1cf1('0x49');return db['UserProfileSection'][_0x1cf1('0x44')]({'where':{'name':_0x519b13,'userProfileId':_0x22fb6b[_0x1cf1('0x4a')]},'raw':!![]})[_0x1cf1('0x1f')](function(_0x140d7b){if(_0x140d7b&&_0x140d7b[_0x1cf1('0x4b')]===0x0){return db[_0x1cf1('0x22')][_0x1cf1('0x4c')]({'name':_0x4b09bb[_0x1cf1('0x23')],'resourceId':_0x4b09bb['id'],'type':_0x140d7b[_0x1cf1('0x23')],'sectionId':_0x140d7b['id']},{})[_0x1cf1('0x1f')](function(){return _0x3a7c08;});}else{return _0x3a7c08;}})[_0x1cf1('0x3e')](function(_0x2263e6){logger[_0x1cf1('0x4d')](_0x1cf1('0x4e'),_0x2263e6);throw _0x2263e6;});}return _0x3a7c08;})['then'](respondWithResult(_0x206bdb,0xc9))[_0x1cf1('0x3e')](handleError(_0x206bdb,null));};exports[_0x1cf1('0x1e')]=function(_0x1d2f70,_0x30f37f){if(_0x1d2f70['body']['id']){delete _0x1d2f70[_0x1cf1('0x45')]['id'];}return db[_0x1cf1('0x3b')][_0x1cf1('0x44')]({'where':{'id':_0x1d2f70[_0x1cf1('0x40')]['id']}})['then'](handleEntityNotFound(_0x30f37f,null))['then'](saveUpdates(_0x1d2f70[_0x1cf1('0x45')],null))[_0x1cf1('0x1f')](respondWithResult(_0x30f37f,null))[_0x1cf1('0x3e')](handleError(_0x30f37f,null));};exports[_0x1cf1('0x20')]=function(_0x51dfef,_0x200f78){return db['Trigger'][_0x1cf1('0x44')]({'where':{'id':_0x51dfef[_0x1cf1('0x40')]['id']}})[_0x1cf1('0x1f')](handleEntityNotFound(_0x200f78,null))[_0x1cf1('0x1f')](removeEntity(_0x200f78,null))[_0x1cf1('0x3e')](handleError(_0x200f78,null));};exports[_0x1cf1('0x4f')]=function(_0x57faca,_0x3c8fff,_0x4b36eb){if(_0x57faca[_0x1cf1('0x45')]['id']){delete _0x57faca[_0x1cf1('0x45')]['id'];}return db[_0x1cf1('0x3b')][_0x1cf1('0x44')]({'where':{'id':_0x57faca[_0x1cf1('0x40')]['id']}})[_0x1cf1('0x1f')](handleEntityNotFound(_0x3c8fff,null))[_0x1cf1('0x1f')](function(_0x12e943){if(_0x12e943){_0x57faca[_0x1cf1('0x45')][_0x1cf1('0x50')]=_0x12e943['id'];return db['Condition'][_0x1cf1('0x4c')](_0x57faca[_0x1cf1('0x45')]);}})['then'](respondWithResult(_0x3c8fff,null))['catch'](handleError(_0x3c8fff,null));};exports[_0x1cf1('0x51')]=function(_0xd73ecb,_0x3b5ae4,_0x18bf3b){if(_0xd73ecb[_0x1cf1('0x45')]['id']){delete _0xd73ecb[_0x1cf1('0x45')]['id'];}return db['Trigger']['find']({'where':{'id':_0xd73ecb[_0x1cf1('0x40')]['id']}})[_0x1cf1('0x1f')](handleEntityNotFound(_0x3b5ae4,null))['then'](function(_0x43062a){if(_0x43062a){_0xd73ecb[_0x1cf1('0x45')][_0x1cf1('0x52')]=_0x43062a['id'];return db[_0x1cf1('0x53')][_0x1cf1('0x4c')](_0xd73ecb['body']);}})[_0x1cf1('0x1f')](respondWithResult(_0x3b5ae4,null))[_0x1cf1('0x3e')](handleError(_0x3b5ae4,null));};exports[_0x1cf1('0x54')]=function(_0x13b596,_0x303b4a,_0x580734){var _0x3111c9={};var _0x1c15f1={};var _0x5a3087;var _0x3ca829;return db['Trigger']['findOne']({'where':{'id':_0x13b596[_0x1cf1('0x40')]['id']}})[_0x1cf1('0x1f')](handleEntityNotFound(_0x303b4a,null))[_0x1cf1('0x1f')](function(_0x12d473){if(_0x12d473){_0x5a3087=_0x12d473;_0x1c15f1['model']=_[_0x1cf1('0x41')](db[_0x1cf1('0x53')][_0x1cf1('0x42')]);_0x1c15f1[_0x1cf1('0x2b')]=_[_0x1cf1('0x41')](_0x13b596[_0x1cf1('0x2b')]);_0x1c15f1[_0x1cf1('0x2c')]=_[_0x1cf1('0x43')](_0x1c15f1[_0x1cf1('0x29')],_0x1c15f1[_0x1cf1('0x2b')]);_0x3111c9[_0x1cf1('0x2d')]=_['intersection'](_0x1c15f1[_0x1cf1('0x29')],qs['fields'](_0x13b596['query'][_0x1cf1('0x2e')]));_0x3111c9['attributes']=_0x3111c9['attributes'][_0x1cf1('0x2f')]?_0x3111c9[_0x1cf1('0x2d')]:_0x1c15f1['model'];_0x3111c9[_0x1cf1('0x32')]=qs[_0x1cf1('0x33')](_0x13b596['query'][_0x1cf1('0x33')]);_0x3111c9[_0x1cf1('0x34')]=qs[_0x1cf1('0x2c')](_[_0x1cf1('0x35')](_0x13b596[_0x1cf1('0x2b')],_0x1c15f1[_0x1cf1('0x2c')]));if(_0x13b596[_0x1cf1('0x2b')][_0x1cf1('0x36')]){_0x3111c9['where']=_[_0x1cf1('0x37')](_0x3111c9[_0x1cf1('0x34')],{'$or':_[_0x1cf1('0x2a')](_0x3111c9[_0x1cf1('0x2d')],function(_0x222447){var _0x229a80={};_0x229a80[_0x222447]={'$like':'%'+_0x13b596[_0x1cf1('0x2b')][_0x1cf1('0x36')]+'%'};return _0x229a80;})});}_0x3111c9=_['merge']({},_0x3111c9,_0x13b596['options']);return _0x5a3087['getAllConditions'](_0x3111c9);}})[_0x1cf1('0x1f')](function(_0x39dd36){if(_0x39dd36){_0x3ca829=_0x39dd36[_0x1cf1('0x2f')];if(!_0x13b596[_0x1cf1('0x2b')][_0x1cf1('0x30')](_0x1cf1('0x31'))){_0x3111c9[_0x1cf1('0x1a')]=qs[_0x1cf1('0x1a')](_0x13b596[_0x1cf1('0x2b')][_0x1cf1('0x1a')]);_0x3111c9[_0x1cf1('0x17')]=qs[_0x1cf1('0x17')](_0x13b596[_0x1cf1('0x2b')]['offset']);}return _0x5a3087[_0x1cf1('0x54')](_0x3111c9);}})[_0x1cf1('0x1f')](function(_0x45903e){if(_0x45903e){return _0x45903e?{'count':_0x3ca829,'rows':_0x45903e}:null;}})[_0x1cf1('0x1f')](respondWithResult(_0x303b4a,null))[_0x1cf1('0x3e')](handleError(_0x303b4a,null));};exports['getAnyConditions']=function(_0x8c4c4,_0x35f088,_0x1ec691){var _0x589c3b={};var _0xa31d8e={};var _0x5e4565;var _0x364eda;return db[_0x1cf1('0x3b')]['findOne']({'where':{'id':_0x8c4c4[_0x1cf1('0x40')]['id']}})[_0x1cf1('0x1f')](handleEntityNotFound(_0x35f088,null))['then'](function(_0xfa6cb7){if(_0xfa6cb7){_0x5e4565=_0xfa6cb7;_0xa31d8e[_0x1cf1('0x29')]=_['keys'](db[_0x1cf1('0x53')][_0x1cf1('0x42')]);_0xa31d8e['query']=_[_0x1cf1('0x41')](_0x8c4c4[_0x1cf1('0x2b')]);_0xa31d8e[_0x1cf1('0x2c')]=_[_0x1cf1('0x43')](_0xa31d8e[_0x1cf1('0x29')],_0xa31d8e['query']);_0x589c3b['attributes']=_[_0x1cf1('0x43')](_0xa31d8e[_0x1cf1('0x29')],qs[_0x1cf1('0x2e')](_0x8c4c4[_0x1cf1('0x2b')][_0x1cf1('0x2e')]));_0x589c3b[_0x1cf1('0x2d')]=_0x589c3b[_0x1cf1('0x2d')][_0x1cf1('0x2f')]?_0x589c3b['attributes']:_0xa31d8e[_0x1cf1('0x29')];_0x589c3b[_0x1cf1('0x32')]=qs[_0x1cf1('0x33')](_0x8c4c4[_0x1cf1('0x2b')][_0x1cf1('0x33')]);_0x589c3b[_0x1cf1('0x34')]=qs[_0x1cf1('0x2c')](_[_0x1cf1('0x35')](_0x8c4c4[_0x1cf1('0x2b')],_0xa31d8e[_0x1cf1('0x2c')]));if(_0x8c4c4[_0x1cf1('0x2b')][_0x1cf1('0x36')]){_0x589c3b[_0x1cf1('0x34')]=_['merge'](_0x589c3b[_0x1cf1('0x34')],{'$or':_['map'](_0x589c3b[_0x1cf1('0x2d')],function(_0x1373a3){var _0x342aef={};_0x342aef[_0x1373a3]={'$like':'%'+_0x8c4c4[_0x1cf1('0x2b')][_0x1cf1('0x36')]+'%'};return _0x342aef;})});}_0x589c3b=_[_0x1cf1('0x37')]({},_0x589c3b,_0x8c4c4[_0x1cf1('0x39')]);return _0x5e4565[_0x1cf1('0x55')](_0x589c3b);}})[_0x1cf1('0x1f')](function(_0x2f59b7){if(_0x2f59b7){_0x364eda=_0x2f59b7[_0x1cf1('0x2f')];if(!_0x8c4c4[_0x1cf1('0x2b')][_0x1cf1('0x30')](_0x1cf1('0x31'))){_0x589c3b['limit']=qs[_0x1cf1('0x1a')](_0x8c4c4[_0x1cf1('0x2b')][_0x1cf1('0x1a')]);_0x589c3b['offset']=qs[_0x1cf1('0x17')](_0x8c4c4[_0x1cf1('0x2b')][_0x1cf1('0x17')]);}return _0x5e4565[_0x1cf1('0x55')](_0x589c3b);}})[_0x1cf1('0x1f')](function(_0x2cd490){if(_0x2cd490){return _0x2cd490?{'count':_0x364eda,'rows':_0x2cd490}:null;}})['then'](respondWithResult(_0x35f088,null))['catch'](handleError(_0x35f088,null));};exports[_0x1cf1('0x56')]=function(_0x161397,_0x1f0603,_0x5d589f){if(_0x161397['body']['id']){delete _0x161397['body']['id'];}return db['Trigger'][_0x1cf1('0x44')]({'where':{'id':_0x161397[_0x1cf1('0x40')]['id']}})[_0x1cf1('0x1f')](handleEntityNotFound(_0x1f0603,null))[_0x1cf1('0x1f')](function(_0x5cdc83){if(_0x5cdc83){_0x161397[_0x1cf1('0x45')][_0x1cf1('0x57')]=_0x5cdc83['id'];return db['Action'][_0x1cf1('0x4c')](_0x161397['body']);}})['then'](respondWithResult(_0x1f0603,null))[_0x1cf1('0x3e')](handleError(_0x1f0603,null));};exports[_0x1cf1('0x58')]=function(_0x10d90a,_0x34af6a,_0x3d1993){var _0x373ce1={};var _0xe6c7c={};var _0x208904;var _0x4e9cdc;return db[_0x1cf1('0x3b')]['findOne']({'where':{'id':_0x10d90a[_0x1cf1('0x40')]['id']}})[_0x1cf1('0x1f')](handleEntityNotFound(_0x34af6a,null))[_0x1cf1('0x1f')](function(_0x37c8db){if(_0x37c8db){_0x208904=_0x37c8db;_0xe6c7c['model']=_['keys'](db['Action'][_0x1cf1('0x42')]);_0xe6c7c['query']=_[_0x1cf1('0x41')](_0x10d90a[_0x1cf1('0x2b')]);_0xe6c7c['filters']=_[_0x1cf1('0x43')](_0xe6c7c[_0x1cf1('0x29')],_0xe6c7c['query']);_0x373ce1['attributes']=_['intersection'](_0xe6c7c[_0x1cf1('0x29')],qs[_0x1cf1('0x2e')](_0x10d90a['query'][_0x1cf1('0x2e')]));_0x373ce1[_0x1cf1('0x2d')]=_0x373ce1['attributes'][_0x1cf1('0x2f')]?_0x373ce1['attributes']:_0xe6c7c[_0x1cf1('0x29')];_0x373ce1[_0x1cf1('0x32')]=qs[_0x1cf1('0x33')](_0x10d90a[_0x1cf1('0x2b')][_0x1cf1('0x33')]);_0x373ce1[_0x1cf1('0x34')]=qs[_0x1cf1('0x2c')](_[_0x1cf1('0x35')](_0x10d90a[_0x1cf1('0x2b')],_0xe6c7c['filters']));if(_0x10d90a[_0x1cf1('0x2b')][_0x1cf1('0x36')]){_0x373ce1[_0x1cf1('0x34')]=_['merge'](_0x373ce1[_0x1cf1('0x34')],{'$or':_[_0x1cf1('0x2a')](_0x373ce1['attributes'],function(_0x59186c){var _0x3dc781={};_0x3dc781[_0x59186c]={'$like':'%'+_0x10d90a[_0x1cf1('0x2b')][_0x1cf1('0x36')]+'%'};return _0x3dc781;})});}_0x373ce1=_[_0x1cf1('0x37')]({},_0x373ce1,_0x10d90a[_0x1cf1('0x39')]);return _0x208904[_0x1cf1('0x58')](_0x373ce1);}})[_0x1cf1('0x1f')](function(_0x163616){if(_0x163616){_0x4e9cdc=_0x163616[_0x1cf1('0x2f')];if(!_0x10d90a[_0x1cf1('0x2b')][_0x1cf1('0x30')](_0x1cf1('0x31'))){_0x373ce1[_0x1cf1('0x1a')]=qs['limit'](_0x10d90a[_0x1cf1('0x2b')]['limit']);_0x373ce1['offset']=qs[_0x1cf1('0x17')](_0x10d90a[_0x1cf1('0x2b')]['offset']);}return _0x208904[_0x1cf1('0x58')](_0x373ce1);}})[_0x1cf1('0x1f')](function(_0x56c9b4){if(_0x56c9b4){return _0x56c9b4?{'count':_0x4e9cdc,'rows':_0x56c9b4}:null;}})[_0x1cf1('0x1f')](respondWithResult(_0x34af6a,null))[_0x1cf1('0x3e')](handleError(_0x34af6a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ccaddd3..f0e0b56 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 _0xd2ce=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Trigger','util','api','moment'];(function(_0x4e5ee8,_0x37da51){var _0x24494d=function(_0x16118e){while(--_0x16118e){_0x4e5ee8['push'](_0x4e5ee8['shift']());}};_0x24494d(++_0x37da51);}(_0xd2ce,0x13c));var _0xed2c=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xd2ce[_0x3e112d];return _0x531c31;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var logger=require('../../config/logger')(_0xed2c('0x1'));var moment=require(_0xed2c('0x2'));var BPromise=require(_0xed2c('0x3'));var rp=require(_0xed2c('0x4'));var fs=require('fs');var path=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var attributes=require('./trigger.attributes');module[_0xed2c('0x8')]=function(_0x5b6ccb,_0x38aa25){return _0x5b6ccb[_0xed2c('0x9')](_0xed2c('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c6f=['request-promise','path','rimraf','../../config/environment','./trigger.attributes','Trigger','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x30918b,_0x52081d){_0x30918b=_0x30918b-0x0;var _0x443f5d=_0x6c6f[_0x30918b];return _0x443f5d;};'use strict';var _=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var logger=require(_0xf6c6('0x2'))(_0xf6c6('0x3'));var moment=require(_0xf6c6('0x4'));var BPromise=require(_0xf6c6('0x5'));var rp=require(_0xf6c6('0x6'));var fs=require('fs');var path=require(_0xf6c6('0x7'));var rimraf=require(_0xf6c6('0x8'));var config=require(_0xf6c6('0x9'));var attributes=require(_0xf6c6('0xa'));module['exports']=function(_0x3b4e7b,_0x4f8e34){return _0x3b4e7b['define'](_0xf6c6('0xb'),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 b475216..bb6258e 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 _0x8913=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','findAll','options','raw','where','attributes','include','map','model','GetTrigger','find','ShowTrigger','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x8913,0xd8));var _0x3891=function(_0x5a6907,_0x486c94){_0x5a6907=_0x5a6907-0x0;var _0x4f6b47=_0x8913[_0x5a6907];return _0x4f6b47;};'use strict';var _=require(_0x3891('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3891('0x1'));var rs=require(_0x3891('0x2'));var fs=require('fs');var Redis=require(_0x3891('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3891('0x4'))(_0x3891('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3891('0x6')][_0x3891('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b583,_0x129849,_0x148d91){return new BPromise(function(_0x302347,_0x5d001a){return client['request'](_0x15b583,_0x148d91)[_0x3891('0x8')](function(_0x1824f6){logger[_0x3891('0x9')](_0x3891('0xa'),_0x129849,_0x3891('0xb'));logger[_0x3891('0xc')](_0x3891('0xd'),_0x129849,_0x3891('0xb'),JSON[_0x3891('0xe')](_0x1824f6));if(_0x1824f6[_0x3891('0xf')]){if(_0x1824f6[_0x3891('0xf')][_0x3891('0x10')]===0x1f4){logger[_0x3891('0xf')](_0x3891('0xa'),_0x129849,_0x1824f6[_0x3891('0xf')][_0x3891('0x11')]);return _0x5d001a(_0x1824f6[_0x3891('0xf')][_0x3891('0x11')]);}logger[_0x3891('0xf')](_0x3891('0xa'),_0x129849,_0x1824f6[_0x3891('0xf')][_0x3891('0x11')]);return _0x302347(_0x1824f6['error'][_0x3891('0x11')]);}else{logger[_0x3891('0x9')](_0x3891('0xa'),_0x129849,_0x3891('0xb'));_0x302347(_0x1824f6[_0x3891('0x12')][_0x3891('0x11')]);}})[_0x3891('0x13')](function(_0xc8f34c){logger[_0x3891('0xf')](_0x3891('0xa'),_0x129849,_0xc8f34c);_0x5d001a(_0xc8f34c);});});}exports['GetTrigger']=function(_0x4c8f6d){var _0x558a87=this;return new Promise(function(_0x57b9c7,_0x12ca33){return db[_0x3891('0x14')][_0x3891('0x15')]({'raw':_0x4c8f6d[_0x3891('0x16')]?_0x4c8f6d[_0x3891('0x16')][_0x3891('0x17')]===undefined?!![]:![]:!![],'where':_0x4c8f6d[_0x3891('0x16')]?_0x4c8f6d['options'][_0x3891('0x18')]||null:null,'attributes':_0x4c8f6d['options']?_0x4c8f6d['options'][_0x3891('0x19')]||null:null,'limit':_0x4c8f6d[_0x3891('0x16')]?_0x4c8f6d['options']['limit']||null:null,'include':_0x4c8f6d[_0x3891('0x16')]?_0x4c8f6d[_0x3891('0x16')][_0x3891('0x1a')]?_[_0x3891('0x1b')](_0x4c8f6d[_0x3891('0x16')]['include'],function(_0x2995e5){return{'model':db[_0x2995e5[_0x3891('0x1c')]],'as':_0x2995e5['as'],'attributes':_0x2995e5[_0x3891('0x19')],'include':_0x2995e5['include']?_['map'](_0x2995e5['include'],function(_0x473d0e){return{'model':db[_0x473d0e[_0x3891('0x1c')]],'as':_0x473d0e['as'],'attributes':_0x473d0e['attributes'],'include':_0x473d0e[_0x3891('0x1a')]?_[_0x3891('0x1b')](_0x473d0e[_0x3891('0x1a')],function(_0x43ea30){return{'model':db[_0x43ea30['model']],'as':_0x43ea30['as'],'attributes':_0x43ea30[_0x3891('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3891('0x8')](function(_0x5f278a){logger['info'](_0x3891('0x1d'),_0x4c8f6d);logger[_0x3891('0xc')](_0x3891('0x1d'),_0x4c8f6d,JSON['stringify'](_0x5f278a));_0x57b9c7(_0x5f278a);})[_0x3891('0x13')](function(_0x3d306d){logger[_0x3891('0xf')](_0x3891('0x1d'),_0x3d306d[_0x3891('0x11')],_0x4c8f6d);_0x12ca33(_0x558a87[_0x3891('0xf')](0x1f4,_0x3d306d['message']));});});};exports['ShowTrigger']=function(_0x3dcc5c){var _0x4f17bd=this;return new Promise(function(_0x45c754,_0x33cf80){return db[_0x3891('0x14')][_0x3891('0x1e')]({'raw':_0x3dcc5c[_0x3891('0x16')]?_0x3dcc5c[_0x3891('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3dcc5c[_0x3891('0x16')]?_0x3dcc5c[_0x3891('0x16')][_0x3891('0x18')]||null:null,'attributes':_0x3dcc5c[_0x3891('0x16')]?_0x3dcc5c[_0x3891('0x16')][_0x3891('0x19')]||null:null,'include':_0x3dcc5c[_0x3891('0x16')]?_0x3dcc5c['options'][_0x3891('0x1a')]?_[_0x3891('0x1b')](_0x3dcc5c[_0x3891('0x16')]['include'],function(_0x486551){return{'model':db[_0x486551[_0x3891('0x1c')]],'as':_0x486551['as'],'attributes':_0x486551['attributes'],'include':_0x486551[_0x3891('0x1a')]?_[_0x3891('0x1b')](_0x486551[_0x3891('0x1a')],function(_0xf69a6d){return{'model':db[_0xf69a6d[_0x3891('0x1c')]],'as':_0xf69a6d['as'],'attributes':_0xf69a6d[_0x3891('0x19')],'include':_0xf69a6d['include']?_[_0x3891('0x1b')](_0xf69a6d['include'],function(_0x32c35f){return{'model':db[_0x32c35f[_0x3891('0x1c')]],'as':_0x32c35f['as'],'attributes':_0x32c35f[_0x3891('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3891('0x8')](function(_0x27d9b3){logger[_0x3891('0x9')]('ShowTrigger',_0x3dcc5c);logger[_0x3891('0xc')](_0x3891('0x1f'),_0x3dcc5c,JSON['stringify'](_0x27d9b3));_0x45c754(_0x27d9b3);})[_0x3891('0x13')](function(_0x287f6c){logger[_0x3891('0xf')]('ShowTrigger',_0x287f6c[_0x3891('0x11')],_0x3dcc5c);_0x33cf80(_0x4f17bd[_0x3891('0xf')](0x1f4,_0x287f6c[_0x3891('0x11')]));});});}; \ No newline at end of file +var _0xafc8=['request\x20sent','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','map','include','model','ShowTrigger','find','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xafc8,0x7a));var _0x8afc=function(_0x52fb3f,_0x161793){_0x52fb3f=_0x52fb3f-0x0;var _0x341903=_0xafc8[_0x52fb3f];return _0x341903;};'use strict';var _=require(_0x8afc('0x0'));var util=require('util');var moment=require(_0x8afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x8afc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8afc('0x3'))['db'];var utils=require(_0x8afc('0x4'));var logger=require(_0x8afc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8afc('0x6'));var client=jayson[_0x8afc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x131ead,_0x44a27e,_0x3a1850){return new BPromise(function(_0x4fe751,_0x23d286){return client[_0x8afc('0x8')](_0x131ead,_0x3a1850)[_0x8afc('0x9')](function(_0x1ac9c2){logger[_0x8afc('0xa')](_0x8afc('0xb'),_0x44a27e,'request\x20sent');logger[_0x8afc('0xc')](_0x8afc('0xd'),_0x44a27e,_0x8afc('0xe'),JSON[_0x8afc('0xf')](_0x1ac9c2));if(_0x1ac9c2['error']){if(_0x1ac9c2[_0x8afc('0x10')][_0x8afc('0x11')]===0x1f4){logger[_0x8afc('0x10')](_0x8afc('0xb'),_0x44a27e,_0x1ac9c2['error'][_0x8afc('0x12')]);return _0x23d286(_0x1ac9c2[_0x8afc('0x10')][_0x8afc('0x12')]);}logger[_0x8afc('0x10')](_0x8afc('0xb'),_0x44a27e,_0x1ac9c2[_0x8afc('0x10')]['message']);return _0x4fe751(_0x1ac9c2[_0x8afc('0x10')][_0x8afc('0x12')]);}else{logger[_0x8afc('0xa')](_0x8afc('0xb'),_0x44a27e,_0x8afc('0xe'));_0x4fe751(_0x1ac9c2[_0x8afc('0x13')][_0x8afc('0x12')]);}})[_0x8afc('0x14')](function(_0x51e5f5){logger[_0x8afc('0x10')]('Trigger,\x20%s,\x20%s',_0x44a27e,_0x51e5f5);_0x23d286(_0x51e5f5);});});}exports[_0x8afc('0x15')]=function(_0x2e7503){var _0x389393=this;return new Promise(function(_0x12cafb,_0x28b1ac){return db[_0x8afc('0x16')][_0x8afc('0x17')]({'raw':_0x2e7503['options']?_0x2e7503[_0x8afc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7503[_0x8afc('0x18')]?_0x2e7503[_0x8afc('0x18')][_0x8afc('0x19')]||null:null,'attributes':_0x2e7503[_0x8afc('0x18')]?_0x2e7503[_0x8afc('0x18')][_0x8afc('0x1a')]||null:null,'limit':_0x2e7503[_0x8afc('0x18')]?_0x2e7503['options'][_0x8afc('0x1b')]||null:null,'include':_0x2e7503[_0x8afc('0x18')]?_0x2e7503[_0x8afc('0x18')]['include']?_[_0x8afc('0x1c')](_0x2e7503[_0x8afc('0x18')][_0x8afc('0x1d')],function(_0x2688eb){return{'model':db[_0x2688eb['model']],'as':_0x2688eb['as'],'attributes':_0x2688eb[_0x8afc('0x1a')],'include':_0x2688eb[_0x8afc('0x1d')]?_[_0x8afc('0x1c')](_0x2688eb['include'],function(_0x224bfa){return{'model':db[_0x224bfa[_0x8afc('0x1e')]],'as':_0x224bfa['as'],'attributes':_0x224bfa[_0x8afc('0x1a')],'include':_0x224bfa[_0x8afc('0x1d')]?_[_0x8afc('0x1c')](_0x224bfa[_0x8afc('0x1d')],function(_0x538ace){return{'model':db[_0x538ace['model']],'as':_0x538ace['as'],'attributes':_0x538ace[_0x8afc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8afc('0x9')](function(_0x55124d){logger['info'](_0x8afc('0x15'),_0x2e7503);logger[_0x8afc('0xc')](_0x8afc('0x15'),_0x2e7503,JSON[_0x8afc('0xf')](_0x55124d));_0x12cafb(_0x55124d);})[_0x8afc('0x14')](function(_0x672f80){logger[_0x8afc('0x10')](_0x8afc('0x15'),_0x672f80[_0x8afc('0x12')],_0x2e7503);_0x28b1ac(_0x389393[_0x8afc('0x10')](0x1f4,_0x672f80['message']));});});};exports[_0x8afc('0x1f')]=function(_0x3db914){var _0x36a6dc=this;return new Promise(function(_0xb292dd,_0x599fd5){return db[_0x8afc('0x16')][_0x8afc('0x20')]({'raw':_0x3db914[_0x8afc('0x18')]?_0x3db914[_0x8afc('0x18')][_0x8afc('0x21')]===undefined?!![]:![]:!![],'where':_0x3db914[_0x8afc('0x18')]?_0x3db914[_0x8afc('0x18')][_0x8afc('0x19')]||null:null,'attributes':_0x3db914[_0x8afc('0x18')]?_0x3db914[_0x8afc('0x18')][_0x8afc('0x1a')]||null:null,'include':_0x3db914['options']?_0x3db914[_0x8afc('0x18')][_0x8afc('0x1d')]?_[_0x8afc('0x1c')](_0x3db914[_0x8afc('0x18')][_0x8afc('0x1d')],function(_0x1af493){return{'model':db[_0x1af493[_0x8afc('0x1e')]],'as':_0x1af493['as'],'attributes':_0x1af493[_0x8afc('0x1a')],'include':_0x1af493[_0x8afc('0x1d')]?_[_0x8afc('0x1c')](_0x1af493[_0x8afc('0x1d')],function(_0x88e51f){return{'model':db[_0x88e51f[_0x8afc('0x1e')]],'as':_0x88e51f['as'],'attributes':_0x88e51f[_0x8afc('0x1a')],'include':_0x88e51f['include']?_[_0x8afc('0x1c')](_0x88e51f[_0x8afc('0x1d')],function(_0x49e5df){return{'model':db[_0x49e5df[_0x8afc('0x1e')]],'as':_0x49e5df['as'],'attributes':_0x49e5df['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35c56c){logger[_0x8afc('0xa')](_0x8afc('0x1f'),_0x3db914);logger[_0x8afc('0xc')](_0x8afc('0x1f'),_0x3db914,JSON[_0x8afc('0xf')](_0x35c56c));_0xb292dd(_0x35c56c);})[_0x8afc('0x14')](function(_0x2239aa){logger[_0x8afc('0x10')](_0x8afc('0x1f'),_0x2239aa[_0x8afc('0x12')],_0x3db914);_0x599fd5(_0x36a6dc[_0x8afc('0x10')](0x1f4,_0x2239aa['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 794e840..ff8f745 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 _0xa285=['/:id/clone','create','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xa285,0x110));var _0x5a28=function(_0x340885,_0x566e57){_0x340885=_0x340885-0x0;var _0x527f54=_0xa285[_0x340885];return _0x527f54;};'use strict';var multer=require(_0x5a28('0x0'));var util=require(_0x5a28('0x1'));var path=require('path');var timeout=require(_0x5a28('0x2'));var express=require('express');var router=express[_0x5a28('0x3')]();var fs_extra=require(_0x5a28('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5a28('0x5'));var config=require(_0x5a28('0x6'));var controller=require('./trunk.controller');router[_0x5a28('0x7')]('/',auth[_0x5a28('0x8')](),controller[_0x5a28('0x9')]);router[_0x5a28('0x7')](_0x5a28('0xa'),auth[_0x5a28('0x8')](),controller[_0x5a28('0xb')]);router[_0x5a28('0xc')](_0x5a28('0xd'),auth[_0x5a28('0x8')](),controller['clone']);router[_0x5a28('0xc')]('/',auth[_0x5a28('0x8')](),controller[_0x5a28('0xe')]);router[_0x5a28('0xf')](_0x5a28('0xa'),auth['isAuthenticated'](),controller[_0x5a28('0x10')]);router[_0x5a28('0x11')](_0x5a28('0xa'),auth[_0x5a28('0x8')](),controller[_0x5a28('0x12')]);module['exports']=router; \ No newline at end of file +var _0x94b0=['index','show','post','/:id/clone','create','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5dbaa7,_0x1f6d4a){var _0x481319=function(_0x116e27){while(--_0x116e27){_0x5dbaa7['push'](_0x5dbaa7['shift']());}};_0x481319(++_0x1f6d4a);}(_0x94b0,0xa9));var _0x094b=function(_0x286006,_0x49086b){_0x286006=_0x286006-0x0;var _0x25be33=_0x94b0[_0x286006];return _0x25be33;};'use strict';var multer=require(_0x094b('0x0'));var util=require(_0x094b('0x1'));var path=require(_0x094b('0x2'));var timeout=require('connect-timeout');var express=require(_0x094b('0x3'));var router=express[_0x094b('0x4')]();var fs_extra=require(_0x094b('0x5'));var auth=require(_0x094b('0x6'));var interaction=require(_0x094b('0x7'));var config=require(_0x094b('0x8'));var controller=require('./trunk.controller');router[_0x094b('0x9')]('/',auth[_0x094b('0xa')](),controller[_0x094b('0xb')]);router[_0x094b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x094b('0xc')]);router[_0x094b('0xd')](_0x094b('0xe'),auth[_0x094b('0xa')](),controller['clone']);router[_0x094b('0xd')]('/',auth[_0x094b('0xa')](),controller[_0x094b('0xf')]);router['put'](_0x094b('0x10'),auth[_0x094b('0xa')](),controller[_0x094b('0x11')]);router[_0x094b('0x12')](_0x094b('0x10'),auth['isAuthenticated'](),controller[_0x094b('0x13')]);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 be38741..896c78c 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 _0x908f=['join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','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','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x908f,0x12d));var _0xf908=function(_0x3b1764,_0x23f2ca){_0x3b1764=_0x3b1764-0x0;var _0xf6693e=_0x908f[_0x3b1764];return _0xf6693e;};'use strict';var Sequelize=require(_0xf908('0x0'));module[_0xf908('0x1')]={'name':{'type':Sequelize[_0xf908('0x2')],'allowNull':![],'unique':_0xf908('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x5'),_0xf908('0x6'),_0xf908('0x7')),'allowNull':![],'defaultValue':_0xf908('0x5')},'context':{'type':Sequelize[_0xf908('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xf908('0x8'),'ALLOWED_PASSED_SCREEN',_0xf908('0x9'),_0xf908('0xa'),_0xf908('0xb'),_0xf908('0xc'),'PROHIB_FAILED_SCREEN',_0xf908('0xd'))},'deny':{'type':Sequelize[_0xf908('0x2')]},'permit':{'type':Sequelize[_0xf908('0x2')]},'secret':{'type':Sequelize[_0xf908('0x2')]},'md5secret':{'type':Sequelize[_0xf908('0x2')]},'remotesecret':{'type':Sequelize[_0xf908('0x2')]},'transport':{'type':Sequelize[_0xf908('0x2')],'defaultValue':_0xf908('0xe'),'set':function(_0x13924e){this[_0xf908('0xf')](_0xf908('0x10'),_0x13924e?_0x13924e[_0xf908('0x11')](','):null);},'get':function(){return this[_0xf908('0x12')](_0xf908('0x10'))?this['getDataValue']('transport')[_0xf908('0x13')](','):null;},'comment':_0xf908('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf908('0x15'),_0xf908('0x16'),'shortinfo',_0xf908('0x17'),_0xf908('0x18')),'defaultValue':_0xf908('0x15')},'directmedia':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no','nonat',_0xf908('0x1a'),_0xf908('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xf908('0x2')]},'nat':{'type':Sequelize[_0xf908('0x2')],'defaultValue':_0xf908('0x1c'),'set':function(_0xefbbdc){this[_0xf908('0xf')]('nat',_0xefbbdc?_0xefbbdc[_0xf908('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xf908('0x1d'))?this[_0xf908('0x12')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xf908('0x2')]},'namedcallgroup':{'type':Sequelize[_0xf908('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf908('0x2')]},'language':{'type':Sequelize[_0xf908('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf908('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf908('0x1e'),'set':function(_0x23b963){this['setDataValue'](_0xf908('0x1f'),_0x23b963?_0x23b963[_0xf908('0x11')](';'):_0xf908('0x1e'));},'get':function(){return this[_0xf908('0x12')](_0xf908('0x1f'))?this[_0xf908('0x12')]('allow')[_0xf908('0x13')](';'):null;},'comment':_0xf908('0x20')},'autoframing':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xf908('0x21'),'set':function(_0x47d407){this['setDataValue'](_0xf908('0x22'),_0x47d407?_0x47d407[_0xf908('0x11')](','):null);},'get':function(){return this[_0xf908('0x12')]('insecure')?this['getDataValue']('insecure')[_0xf908('0x13')](','):null;},'comment':_0xf908('0x23')},'trustrpid':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf908('0x4')]('yes','no',_0xf908('0x24'))},'promiscredir':{'type':Sequelize[_0xf908('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0xf908('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0xf908('0x25')](0xb)},'setvar':{'type':Sequelize[_0xf908('0x2')]},'callerid':{'type':Sequelize[_0xf908('0x2')],'defaultValue':_0xf908('0x26')},'amaflags':{'type':Sequelize[_0xf908('0x2')]},'callcounter':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf908('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xf908('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xf908('0x2')]},'template':{'type':Sequelize[_0xf908('0x2')]},'videosupport':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no',_0xf908('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf908('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x28'),_0xf908('0x29'),_0xf908('0x2a'))},'session_expires':{'type':Sequelize[_0xf908('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xf908('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xf908('0x4')]('uac',_0xf908('0x2b')),'defaultValue':_0xf908('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xf908('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xf908('0x2')]},'fromuser':{'type':Sequelize[_0xf908('0x2')]},'port':{'type':Sequelize[_0xf908('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf908('0x19'),'no'),'defaultValue':_0xf908('0x19')},'keepalive':{'type':Sequelize[_0xf908('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xf908('0x2')]},'defaultuser':{'type':Sequelize[_0xf908('0x2')]},'rtptimeout':{'type':Sequelize[_0xf908('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf908('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf908('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xf908('0x4')]('yes','no',_0xf908('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf908('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xf908('0x25')](0xb)},'timerb':{'type':Sequelize[_0xf908('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf908('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xf908('0x2')]},'contactdeny':{'type':Sequelize[_0xf908('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xf908('0x2')]},'maxforwards':{'type':Sequelize[_0xf908('0x25')](0xb)},'encryption':{'type':Sequelize[_0xf908('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf908('0x4')]('yes','no',_0xf908('0x2d'),_0xf908('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xf908('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf908('0x2')]},'dtlscipher':{'type':Sequelize[_0xf908('0x2')]},'dtlscafile':{'type':Sequelize[_0xf908('0x2')]},'dtlscapath':{'type':Sequelize[_0xf908('0x2')]},'dtlssetup':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x2f'),_0xf908('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf908('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xf908('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf908('0x2')]},'recordofffeature':{'type':Sequelize[_0xf908('0x2')]},'call_limit':{'type':Sequelize[_0xf908('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xf908('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xf908('0x2')]},'mohinterpret':{'type':Sequelize[_0xf908('0x2')]},'mohsuggest':{'type':Sequelize[_0xf908('0x2')]},'parkinglot':{'type':Sequelize[_0xf908('0x2')]},'description':{'type':Sequelize[_0xf908('0x2')]},'host':{'type':Sequelize[_0xf908('0x2')],'defaultValue':_0xf908('0x31')},'canreinvite':{'type':Sequelize[_0xf908('0x4')](_0xf908('0x19'),'no',_0xf908('0x32'),_0xf908('0x1a'),_0xf908('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf908('0x2')]},'otherFields':{'type':Sequelize[_0xf908('0x2')]},'active':{'type':Sequelize[_0xf908('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf908('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x17f7=['passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','pai','certificate'];(function(_0x4bc6f4,_0x2c9ad0){var _0x1ab7e5=function(_0x3d78b9){while(--_0x3d78b9){_0x4bc6f4['push'](_0x4bc6f4['shift']());}};_0x1ab7e5(++_0x2c9ad0);}(_0x17f7,0x1d9));var _0x717f=function(_0x5561fb,_0x38f898){_0x5561fb=_0x5561fb-0x0;var _0x2a6b6a=_0x17f7[_0x5561fb];return _0x2a6b6a;};'use strict';var Sequelize=require(_0x717f('0x0'));module[_0x717f('0x1')]={'name':{'type':Sequelize[_0x717f('0x2')],'allowNull':![],'unique':_0x717f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x5'),_0x717f('0x6'),_0x717f('0x7')),'allowNull':![],'defaultValue':_0x717f('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x717f('0x8')},'callingpres':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x9'),_0x717f('0xa'),'ALLOWED_FAILED_SCREEN',_0x717f('0xb'),'PROHIB_NOT_SCREENED',_0x717f('0xc'),_0x717f('0xd'),_0x717f('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x717f('0x2')]},'remotesecret':{'type':Sequelize[_0x717f('0x2')]},'transport':{'type':Sequelize[_0x717f('0x2')],'defaultValue':'udp','set':function(_0x44ea1b){this['setDataValue'](_0x717f('0xf'),_0x44ea1b?_0x44ea1b[_0x717f('0x10')](','):null);},'get':function(){return this[_0x717f('0x11')](_0x717f('0xf'))?this[_0x717f('0x11')](_0x717f('0xf'))['split'](','):null;},'comment':_0x717f('0x12')},'dtmfmode':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x13'),_0x717f('0x14'),_0x717f('0x15'),_0x717f('0x16'),_0x717f('0x17')),'defaultValue':_0x717f('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x717f('0x18'),'no',_0x717f('0x19'),_0x717f('0x1a'),_0x717f('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x717f('0x2')]},'directmediadeny':{'type':Sequelize[_0x717f('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x717f('0x1c'),'set':function(_0x11be40){this[_0x717f('0x1d')](_0x717f('0x1e'),_0x11be40?_0x11be40[_0x717f('0x10')](','):null);},'get':function(){return this[_0x717f('0x11')](_0x717f('0x1e'))?this[_0x717f('0x11')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x717f('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x717f('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x717f('0x2')],'defaultValue':_0x717f('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x249e19){this[_0x717f('0x1d')](_0x717f('0x20'),_0x249e19?_0x249e19[_0x717f('0x10')](';'):_0x717f('0x21'));},'get':function(){return this[_0x717f('0x11')](_0x717f('0x20'))?this[_0x717f('0x11')]('allow')['split'](';'):null;},'comment':_0x717f('0x22')},'autoframing':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x404813){this[_0x717f('0x1d')]('insecure',_0x404813?_0x404813['join'](','):null);},'get':function(){return this['getDataValue'](_0x717f('0x23'))?this['getDataValue'](_0x717f('0x23'))[_0x717f('0x24')](','):null;},'comment':_0x717f('0x25')},'trustrpid':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no',_0x717f('0x26'))},'promiscredir':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x717f('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x717f('0x27')](0xb)},'setvar':{'type':Sequelize[_0x717f('0x2')]},'callerid':{'type':Sequelize[_0x717f('0x2')],'defaultValue':_0x717f('0x28')},'amaflags':{'type':Sequelize[_0x717f('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x717f('0x18'),'no'),'defaultValue':_0x717f('0x18')},'busylevel':{'type':Sequelize[_0x717f('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x717f('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x717f('0x2')]},'videosupport':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x717f('0x29'),'refuse',_0x717f('0x2a'))},'session_expires':{'type':Sequelize[_0x717f('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x717f('0x27')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x717f('0x2b'),_0x717f('0x2c')),'defaultValue':_0x717f('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x717f('0x2')]},'regexten':{'type':Sequelize[_0x717f('0x2')]},'fromdomain':{'type':Sequelize[_0x717f('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x717f('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x717f('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x717f('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x717f('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no',_0x717f('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x717f('0x2')]},'callbackextension':{'type':Sequelize[_0x717f('0x2')]},'timert1':{'type':Sequelize[_0x717f('0x27')](0xb)},'timerb':{'type':Sequelize[_0x717f('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x717f('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x717f('0x2')]},'contactdeny':{'type':Sequelize[_0x717f('0x2')]},'contactacl':{'type':Sequelize[_0x717f('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x717f('0x2')]},'use_q850_reason':{'type':Sequelize[_0x717f('0x2')]},'maxforwards':{'type':Sequelize[_0x717f('0x27')](0xb)},'encryption':{'type':Sequelize[_0x717f('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'force_avp':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'icesupport':{'type':Sequelize[_0x717f('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x717f('0x18'),'no','fingerprint',_0x717f('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x717f('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x717f('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x717f('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x717f('0x2')]},'dtlscapath':{'type':Sequelize[_0x717f('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x717f('0x2f'),_0x717f('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x717f('0x2')]},'usereqphone':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x717f('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x717f('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no')},'vmexten':{'type':Sequelize[_0x717f('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x717f('0x2')]},'parkinglot':{'type':Sequelize[_0x717f('0x2')]},'description':{'type':Sequelize[_0x717f('0x2')]},'host':{'type':Sequelize[_0x717f('0x2')],'defaultValue':_0x717f('0x31')},'canreinvite':{'type':Sequelize[_0x717f('0x4')](_0x717f('0x18'),'no',_0x717f('0x19'),_0x717f('0x1a'),_0x717f('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x717f('0x2')]},'otherFields':{'type':Sequelize[_0x717f('0x2')]},'active':{'type':Sequelize[_0x717f('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x717f('0x2')],'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 f26985b..5a6e9dd 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(_0x2a3d41,_0x5da053){var _0x2856a0=function(_0x566c00){while(--_0x566c00){_0x2a3d41['push'](_0x2a3d41['shift']());}};_0x2856a0(++_0x5da053);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3ccc44,_0x207b0c){_0x3ccc44=_0x3ccc44-0x0;var _0x5d74bb=_0xf3cd[_0x3ccc44];return _0x5d74bb;};'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 _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x31de76,_0x32cdc7){var _0x3a5d82=function(_0x574e01){while(--_0x574e01){_0x31de76['push'](_0x31de76['shift']());}};_0x3a5d82(++_0x32cdc7);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x480691,_0x4de5ce){_0x480691=_0x480691-0x0;var _0x27c853=_0x8d0e[_0x480691];return _0x27c853;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 28b2fe3..6be3375 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 _0x26c1=['api','moment','bluebird','request-promise','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x420a02,_0x91fee){var _0x46ad48=function(_0x5411e4){while(--_0x5411e4){_0x420a02['push'](_0x420a02['shift']());}};_0x46ad48(++_0x91fee);}(_0x26c1,0x8c));var _0x126c=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x26c1[_0x5280f4];return _0xba93e7;};'use strict';var _=require(_0x126c('0x0'));var util=require(_0x126c('0x1'));var logger=require(_0x126c('0x2'))(_0x126c('0x3'));var moment=require(_0x126c('0x4'));var BPromise=require(_0x126c('0x5'));var rp=require(_0x126c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x126c('0x7'));var config=require('../../config/environment');var attributes=require(_0x126c('0x8'));module[_0x126c('0x9')]=function(_0x163184,_0x4f2fc1){return _0x163184[_0x126c('0xa')](_0x126c('0xb'),attributes,{'tableName':_0x126c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdac4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','lodash','util','../../config/logger'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0xdac4,0x169));var _0x4dac=function(_0x380f49,_0x3747c8){_0x380f49=_0x380f49-0x0;var _0x4b5b64=_0xdac4[_0x380f49];return _0x4b5b64;};'use strict';var _=require(_0x4dac('0x0'));var util=require(_0x4dac('0x1'));var logger=require(_0x4dac('0x2'))(_0x4dac('0x3'));var moment=require(_0x4dac('0x4'));var BPromise=require(_0x4dac('0x5'));var rp=require(_0x4dac('0x6'));var fs=require('fs');var path=require(_0x4dac('0x7'));var rimraf=require(_0x4dac('0x8'));var config=require(_0x4dac('0x9'));var attributes=require(_0x4dac('0xa'));module[_0x4dac('0xb')]=function(_0x3c6ba5,_0x34413e){return _0x3c6ba5['define'](_0x4dac('0xc'),attributes,{'tableName':'tools_trunks','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 0a360a8..f6690ce 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 _0x4291=['message','info','result','catch','Trunk','findAll','options','raw','where','limit','include','model','attributes','map','ShowTrunk','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x26355d,_0x2d9a27){var _0x429ec7=function(_0x232a8d){while(--_0x232a8d){_0x26355d['push'](_0x26355d['shift']());}};_0x429ec7(++_0x2d9a27);}(_0x4291,0x1b3));var _0x1429=function(_0x3e4a13,_0x377dd2){_0x3e4a13=_0x3e4a13-0x0;var _0x479175=_0x4291[_0x3e4a13];return _0x479175;};'use strict';var _=require(_0x1429('0x0'));var util=require(_0x1429('0x1'));var moment=require('moment');var BPromise=require(_0x1429('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1429('0x3'));var db=require(_0x1429('0x4'))['db'];var utils=require(_0x1429('0x5'));var logger=require(_0x1429('0x6'))(_0x1429('0x7'));var config=require(_0x1429('0x8'));var jayson=require(_0x1429('0x9'));var client=jayson[_0x1429('0xa')][_0x1429('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x480c16,_0x39e4cb,_0x540820){return new BPromise(function(_0x5dcce6,_0x3cbe13){return client[_0x1429('0xc')](_0x480c16,_0x540820)[_0x1429('0xd')](function(_0x1b7a40){logger['info'](_0x1429('0xe'),_0x39e4cb,_0x1429('0xf'));logger[_0x1429('0x10')](_0x1429('0x11'),_0x39e4cb,'request\x20sent',JSON[_0x1429('0x12')](_0x1b7a40));if(_0x1b7a40['error']){if(_0x1b7a40[_0x1429('0x13')]['code']===0x1f4){logger[_0x1429('0x13')](_0x1429('0xe'),_0x39e4cb,_0x1b7a40['error']['message']);return _0x3cbe13(_0x1b7a40[_0x1429('0x13')]['message']);}logger[_0x1429('0x13')](_0x1429('0xe'),_0x39e4cb,_0x1b7a40['error'][_0x1429('0x14')]);return _0x5dcce6(_0x1b7a40[_0x1429('0x13')][_0x1429('0x14')]);}else{logger[_0x1429('0x15')](_0x1429('0xe'),_0x39e4cb,_0x1429('0xf'));_0x5dcce6(_0x1b7a40[_0x1429('0x16')][_0x1429('0x14')]);}})[_0x1429('0x17')](function(_0x37773a){logger[_0x1429('0x13')](_0x1429('0xe'),_0x39e4cb,_0x37773a);_0x3cbe13(_0x37773a);});});}exports['GetTrunk']=function(_0x593bb3){var _0x61c3ca=this;return new Promise(function(_0x539fcc,_0x16035f){return db[_0x1429('0x18')][_0x1429('0x19')]({'raw':_0x593bb3[_0x1429('0x1a')]?_0x593bb3[_0x1429('0x1a')][_0x1429('0x1b')]===undefined?!![]:![]:!![],'where':_0x593bb3[_0x1429('0x1a')]?_0x593bb3['options'][_0x1429('0x1c')]||null:null,'attributes':_0x593bb3[_0x1429('0x1a')]?_0x593bb3[_0x1429('0x1a')]['attributes']||null:null,'limit':_0x593bb3[_0x1429('0x1a')]?_0x593bb3[_0x1429('0x1a')][_0x1429('0x1d')]||null:null,'include':_0x593bb3[_0x1429('0x1a')]?_0x593bb3[_0x1429('0x1a')][_0x1429('0x1e')]?_['map'](_0x593bb3[_0x1429('0x1a')][_0x1429('0x1e')],function(_0x91c917){return{'model':db[_0x91c917[_0x1429('0x1f')]],'as':_0x91c917['as'],'attributes':_0x91c917[_0x1429('0x20')],'include':_0x91c917[_0x1429('0x1e')]?_['map'](_0x91c917[_0x1429('0x1e')],function(_0x3d4826){return{'model':db[_0x3d4826[_0x1429('0x1f')]],'as':_0x3d4826['as'],'attributes':_0x3d4826[_0x1429('0x20')],'include':_0x3d4826['include']?_[_0x1429('0x21')](_0x3d4826[_0x1429('0x1e')],function(_0x2c71e3){return{'model':db[_0x2c71e3[_0x1429('0x1f')]],'as':_0x2c71e3['as'],'attributes':_0x2c71e3[_0x1429('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1429('0xd')](function(_0x4f5c50){logger[_0x1429('0x15')]('GetTrunk',_0x593bb3);logger[_0x1429('0x10')]('GetTrunk',_0x593bb3,JSON['stringify'](_0x4f5c50));_0x539fcc(_0x4f5c50);})[_0x1429('0x17')](function(_0x17aff9){logger[_0x1429('0x13')]('GetTrunk',_0x17aff9[_0x1429('0x14')],_0x593bb3);_0x16035f(_0x61c3ca['error'](0x1f4,_0x17aff9[_0x1429('0x14')]));});});};exports[_0x1429('0x22')]=function(_0x35f473){var _0x4b9e7b=this;return new Promise(function(_0x4e2992,_0x547105){return db[_0x1429('0x18')]['find']({'raw':_0x35f473['options']?_0x35f473[_0x1429('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x35f473[_0x1429('0x1a')]?_0x35f473['options'][_0x1429('0x1c')]||null:null,'attributes':_0x35f473[_0x1429('0x1a')]?_0x35f473[_0x1429('0x1a')]['attributes']||null:null,'include':_0x35f473[_0x1429('0x1a')]?_0x35f473[_0x1429('0x1a')][_0x1429('0x1e')]?_[_0x1429('0x21')](_0x35f473[_0x1429('0x1a')][_0x1429('0x1e')],function(_0x1675f0){return{'model':db[_0x1675f0[_0x1429('0x1f')]],'as':_0x1675f0['as'],'attributes':_0x1675f0['attributes'],'include':_0x1675f0['include']?_[_0x1429('0x21')](_0x1675f0['include'],function(_0x535a24){return{'model':db[_0x535a24[_0x1429('0x1f')]],'as':_0x535a24['as'],'attributes':_0x535a24[_0x1429('0x20')],'include':_0x535a24['include']?_['map'](_0x535a24['include'],function(_0x455efc){return{'model':db[_0x455efc[_0x1429('0x1f')]],'as':_0x455efc['as'],'attributes':_0x455efc[_0x1429('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1429('0xd')](function(_0x52f536){logger['info'](_0x1429('0x22'),_0x35f473);logger['debug'](_0x1429('0x22'),_0x35f473,JSON['stringify'](_0x52f536));_0x4e2992(_0x52f536);})[_0x1429('0x17')](function(_0x488596){logger[_0x1429('0x13')](_0x1429('0x22'),_0x488596[_0x1429('0x14')],_0x35f473);_0x547105(_0x4b9e7b['error'](0x1f4,_0x488596[_0x1429('0x14')]));});});}; \ No newline at end of file +var _0xed73=['info','result','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','find','ShowTrunk','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xed73,0x1ec));var _0x3ed7=function(_0x4a42e1,_0x960995){_0x4a42e1=_0x4a42e1-0x0;var _0x51f536=_0xed73[_0x4a42e1];return _0x51f536;};'use strict';var _=require(_0x3ed7('0x0'));var util=require(_0x3ed7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ed7('0x2'));var fs=require('fs');var Redis=require(_0x3ed7('0x3'));var db=require(_0x3ed7('0x4'))['db'];var utils=require(_0x3ed7('0x5'));var logger=require('../../config/logger')(_0x3ed7('0x6'));var config=require('../../config/environment');var jayson=require(_0x3ed7('0x7'));var client=jayson[_0x3ed7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3913a4,_0x3a2bdd,_0x4a3eb5){return new BPromise(function(_0x3d9efc,_0x35b269){return client[_0x3ed7('0x9')](_0x3913a4,_0x4a3eb5)[_0x3ed7('0xa')](function(_0x50bde7){logger['info'](_0x3ed7('0xb'),_0x3a2bdd,'request\x20sent');logger[_0x3ed7('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3a2bdd,_0x3ed7('0xd'),JSON[_0x3ed7('0xe')](_0x50bde7));if(_0x50bde7['error']){if(_0x50bde7[_0x3ed7('0xf')][_0x3ed7('0x10')]===0x1f4){logger[_0x3ed7('0xf')](_0x3ed7('0xb'),_0x3a2bdd,_0x50bde7['error']['message']);return _0x35b269(_0x50bde7[_0x3ed7('0xf')][_0x3ed7('0x11')]);}logger[_0x3ed7('0xf')]('Trunk,\x20%s,\x20%s',_0x3a2bdd,_0x50bde7['error'][_0x3ed7('0x11')]);return _0x3d9efc(_0x50bde7[_0x3ed7('0xf')]['message']);}else{logger[_0x3ed7('0x12')](_0x3ed7('0xb'),_0x3a2bdd,_0x3ed7('0xd'));_0x3d9efc(_0x50bde7[_0x3ed7('0x13')]['message']);}})[_0x3ed7('0x14')](function(_0x6654c7){logger[_0x3ed7('0xf')](_0x3ed7('0xb'),_0x3a2bdd,_0x6654c7);_0x35b269(_0x6654c7);});});}exports['GetTrunk']=function(_0xcca2fb){var _0xc4f053=this;return new Promise(function(_0x4722d6,_0x4d0a40){return db[_0x3ed7('0x15')][_0x3ed7('0x16')]({'raw':_0xcca2fb['options']?_0xcca2fb[_0x3ed7('0x17')][_0x3ed7('0x18')]===undefined?!![]:![]:!![],'where':_0xcca2fb['options']?_0xcca2fb[_0x3ed7('0x17')][_0x3ed7('0x19')]||null:null,'attributes':_0xcca2fb[_0x3ed7('0x17')]?_0xcca2fb[_0x3ed7('0x17')][_0x3ed7('0x1a')]||null:null,'limit':_0xcca2fb[_0x3ed7('0x17')]?_0xcca2fb[_0x3ed7('0x17')][_0x3ed7('0x1b')]||null:null,'include':_0xcca2fb['options']?_0xcca2fb['options'][_0x3ed7('0x1c')]?_[_0x3ed7('0x1d')](_0xcca2fb[_0x3ed7('0x17')][_0x3ed7('0x1c')],function(_0x8d90ac){return{'model':db[_0x8d90ac[_0x3ed7('0x1e')]],'as':_0x8d90ac['as'],'attributes':_0x8d90ac[_0x3ed7('0x1a')],'include':_0x8d90ac[_0x3ed7('0x1c')]?_[_0x3ed7('0x1d')](_0x8d90ac[_0x3ed7('0x1c')],function(_0x3f0828){return{'model':db[_0x3f0828[_0x3ed7('0x1e')]],'as':_0x3f0828['as'],'attributes':_0x3f0828[_0x3ed7('0x1a')],'include':_0x3f0828[_0x3ed7('0x1c')]?_[_0x3ed7('0x1d')](_0x3f0828[_0x3ed7('0x1c')],function(_0x1bed0a){return{'model':db[_0x1bed0a['model']],'as':_0x1bed0a['as'],'attributes':_0x1bed0a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ed7('0xa')](function(_0x428048){logger[_0x3ed7('0x12')](_0x3ed7('0x1f'),_0xcca2fb);logger['debug']('GetTrunk',_0xcca2fb,JSON[_0x3ed7('0xe')](_0x428048));_0x4722d6(_0x428048);})[_0x3ed7('0x14')](function(_0x72e645){logger[_0x3ed7('0xf')](_0x3ed7('0x1f'),_0x72e645['message'],_0xcca2fb);_0x4d0a40(_0xc4f053[_0x3ed7('0xf')](0x1f4,_0x72e645[_0x3ed7('0x11')]));});});};exports['ShowTrunk']=function(_0x3fee4c){var _0x78c1db=this;return new Promise(function(_0x47f760,_0x535070){return db[_0x3ed7('0x15')][_0x3ed7('0x20')]({'raw':_0x3fee4c['options']?_0x3fee4c[_0x3ed7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3fee4c['options']?_0x3fee4c['options'][_0x3ed7('0x19')]||null:null,'attributes':_0x3fee4c['options']?_0x3fee4c[_0x3ed7('0x17')][_0x3ed7('0x1a')]||null:null,'include':_0x3fee4c[_0x3ed7('0x17')]?_0x3fee4c[_0x3ed7('0x17')][_0x3ed7('0x1c')]?_['map'](_0x3fee4c[_0x3ed7('0x17')][_0x3ed7('0x1c')],function(_0x20ca33){return{'model':db[_0x20ca33[_0x3ed7('0x1e')]],'as':_0x20ca33['as'],'attributes':_0x20ca33['attributes'],'include':_0x20ca33['include']?_[_0x3ed7('0x1d')](_0x20ca33['include'],function(_0x25bed5){return{'model':db[_0x25bed5['model']],'as':_0x25bed5['as'],'attributes':_0x25bed5[_0x3ed7('0x1a')],'include':_0x25bed5[_0x3ed7('0x1c')]?_[_0x3ed7('0x1d')](_0x25bed5['include'],function(_0x1d875d){return{'model':db[_0x1d875d[_0x3ed7('0x1e')]],'as':_0x1d875d['as'],'attributes':_0x1d875d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ed7('0xa')](function(_0x21abda){logger['info'](_0x3ed7('0x21'),_0x3fee4c);logger[_0x3ed7('0xc')]('ShowTrunk',_0x3fee4c,JSON[_0x3ed7('0xe')](_0x21abda));_0x47f760(_0x21abda);})[_0x3ed7('0x14')](function(_0x17ec79){logger[_0x3ed7('0xf')](_0x3ed7('0x21'),_0x17ec79[_0x3ed7('0x11')],_0x3fee4c);_0x535070(_0x78c1db[_0x3ed7('0xf')](0x1f4,_0x17ec79[_0x3ed7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 806d8f2..55e87ea 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 _0xe14f=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0xa763f0,_0x9690a7){var _0x2e89a3=function(_0xfb7b6f){while(--_0xfb7b6f){_0xa763f0['push'](_0xa763f0['shift']());}};_0x2e89a3(++_0x9690a7);}(_0xe14f,0xc7));var _0xfe14=function(_0x2fea20,_0x3f2d53){_0x2fea20=_0x2fea20-0x0;var _0x19bdfa=_0xe14f[_0x2fea20];return _0x19bdfa;};'use strict';var express=require(_0xfe14('0x0'));var router=express['Router']();var auth=require(_0xfe14('0x1'));var controller=require(_0xfe14('0x2'));router[_0xfe14('0x3')](_0xfe14('0x4'),auth[_0xfe14('0x5')](),controller[_0xfe14('0x6')]);module[_0xfe14('0x7')]=router; \ No newline at end of file +var _0xe175=['./user-setting.controller','put','/:id','update','express','Router','../../components/auth/service'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xe175,0x12a));var _0x5e17=function(_0x4a0bd2,_0x15c43d){_0x4a0bd2=_0x4a0bd2-0x0;var _0x5b0d30=_0xe175[_0x4a0bd2];return _0x5b0d30;};'use strict';var express=require(_0x5e17('0x0'));var router=express[_0x5e17('0x1')]();var auth=require(_0x5e17('0x2'));var controller=require(_0x5e17('0x3'));router[_0x5e17('0x4')](_0x5e17('0x5'),auth['isAuthenticated'](),controller[_0x5e17('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 45b9528..0206b90 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 _0x2e6e=['DATE','INTEGER','UserId','sequelize','error','debug','BOOLEAN','TEXT'];(function(_0x558225,_0x1c8339){var _0x2656ad=function(_0x26b3c9){while(--_0x26b3c9){_0x558225['push'](_0x558225['shift']());}};_0x2656ad(++_0x1c8339);}(_0x2e6e,0xf3));var _0xe2e6=function(_0x5cd65a,_0x301f8f){_0x5cd65a=_0x5cd65a-0x0;var _0x1606f8=_0x2e6e[_0x5cd65a];return _0x1606f8;};'use strict';var Sequelize=require(_0xe2e6('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xe2e6('0x1'),'warning','info',_0xe2e6('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xe2e6('0x3')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe2e6('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xe2e6('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe2e6('0x6')],'unique':_0xe2e6('0x7')}}; \ No newline at end of file +var _0xa380=['exports','DATE','INTEGER','UserId','sequelize','error','warning','info'];(function(_0x5b97ba,_0x5e68fd){var _0x31b0b0=function(_0x3c795a){while(--_0x3c795a){_0x5b97ba['push'](_0x5b97ba['shift']());}};_0x31b0b0(++_0x5e68fd);}(_0xa380,0x74));var _0x0a38=function(_0x89e871,_0x15353a){_0x89e871=_0x89e871-0x0;var _0xae5878=_0xa380[_0x89e871];return _0xae5878;};'use strict';var Sequelize=require(_0x0a38('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a38('0x1'),_0x0a38('0x2'),_0x0a38('0x3'),'debug'];module[_0x0a38('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a38('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a38('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x0a38('0x6')],'unique':_0x0a38('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index d135243..a9671de 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 _0x5d55=['role','admin','Unauthorized','params','UserSetting','find','ioredis','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send'];(function(_0x19c5dd,_0x2a35f5){var _0x40218d=function(_0x1a07ad){while(--_0x1a07ad){_0x19c5dd['push'](_0x19c5dd['shift']());}};_0x40218d(++_0x2a35f5);}(_0x5d55,0x1a4));var _0x55d5=function(_0x4dc64c,_0x26f33a){_0x4dc64c=_0x4dc64c-0x0;var _0x1fa63f=_0x5d55[_0x4dc64c];return _0x1fa63f;};'use strict';var _=require('lodash');var Redis=require(_0x55d5('0x0'));var logger=require('../../config/logger')(_0x55d5('0x1'));var config=require(_0x55d5('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0x55d5('0x3'))(new Redis(config[_0x55d5('0x4')]));require(_0x55d5('0x5'))['register'](socket);config[_0x55d5('0x4')]=_[_0x55d5('0x6')](config[_0x55d5('0x4')],{'host':_0x55d5('0x7'),'port':0x18eb});function respondWithResult(_0x16d364,_0x2f854a){_0x2f854a=_0x2f854a||0xc8;return function(_0x454144){if(_0x454144){return _0x16d364[_0x55d5('0x8')](_0x2f854a)[_0x55d5('0x9')](_0x454144);}};}function saveUpdates(_0x583c39){return function(_0x2cdf6a){if(_0x2cdf6a){return _0x2cdf6a[_0x55d5('0xa')](_0x583c39)[_0x55d5('0xb')](function(_0x64f70a){return _0x64f70a;});}return null;};}function handleEntityNotFound(_0xdac85){return function(_0x4db860){if(!_0x4db860){_0xdac85[_0x55d5('0xc')](0x194);}return _0x4db860;};}function handleError(_0x5d97d3,_0x2b02b2){_0x2b02b2=_0x2b02b2||0x1f4;return function(_0x21d7c0){logger[_0x55d5('0xd')](_0x21d7c0[_0x55d5('0xe')]);if(_0x21d7c0[_0x55d5('0xf')]){delete _0x21d7c0['name'];}_0x5d97d3[_0x55d5('0x8')](_0x2b02b2)[_0x55d5('0x10')](_0x21d7c0);};}exports[_0x55d5('0xa')]=function(_0x49ee90,_0x1140cc){if(_0x49ee90['user'][_0x55d5('0x11')]!==_0x55d5('0x12'))throw new Error(_0x55d5('0x13'));if(isNaN(Number(_0x49ee90[_0x55d5('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x55d5('0x15')][_0x55d5('0x16')]({'where':{'id':_0x49ee90[_0x55d5('0x14')]['id']}})['then'](handleEntityNotFound(_0x1140cc,null))[_0x55d5('0xb')](saveUpdates(_0x49ee90['body'],null))[_0x55d5('0xb')](respondWithResult(_0x1140cc,null))['catch'](handleError(_0x1140cc,null));}; \ No newline at end of file +var _0xe77f=['../../config/environment','socket.io-emitter','redis','register','defaults','localhost','status','json','update','sendStatus','error','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','lodash','ioredis','api'];(function(_0x5d1902,_0x2c2f61){var _0x2d83aa=function(_0x23975c){while(--_0x23975c){_0x5d1902['push'](_0x5d1902['shift']());}};_0x2d83aa(++_0x2c2f61);}(_0xe77f,0xba));var _0xfe77=function(_0x282693,_0x4d044b){_0x282693=_0x282693-0x0;var _0x5eaa96=_0xe77f[_0x282693];return _0x5eaa96;};'use strict';var _=require(_0xfe77('0x0'));var Redis=require(_0xfe77('0x1'));var logger=require('../../config/logger')(_0xfe77('0x2'));var config=require(_0xfe77('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xfe77('0x4'))(new Redis(config[_0xfe77('0x5')]));require('./user-setting.socket')[_0xfe77('0x6')](socket);config[_0xfe77('0x5')]=_[_0xfe77('0x7')](config[_0xfe77('0x5')],{'host':_0xfe77('0x8'),'port':0x18eb});function respondWithResult(_0x51d137,_0x5ecf79){_0x5ecf79=_0x5ecf79||0xc8;return function(_0x1a65af){if(_0x1a65af){return _0x51d137[_0xfe77('0x9')](_0x5ecf79)[_0xfe77('0xa')](_0x1a65af);}};}function saveUpdates(_0x1a2809){return function(_0x394bc0){if(_0x394bc0){return _0x394bc0[_0xfe77('0xb')](_0x1a2809)['then'](function(_0x54015b){return _0x54015b;});}return null;};}function handleEntityNotFound(_0x42740a){return function(_0x1b2f58){if(!_0x1b2f58){_0x42740a[_0xfe77('0xc')](0x194);}return _0x1b2f58;};}function handleError(_0x36292e,_0x5d19a8){_0x5d19a8=_0x5d19a8||0x1f4;return function(_0xa95c2c){logger[_0xfe77('0xd')](_0xa95c2c[_0xfe77('0xe')]);if(_0xa95c2c[_0xfe77('0xf')]){delete _0xa95c2c['name'];}_0x36292e[_0xfe77('0x9')](_0x5d19a8)[_0xfe77('0x10')](_0xa95c2c);};}exports[_0xfe77('0xb')]=function(_0x5b2271,_0x2f4c5f){if(_0x5b2271[_0xfe77('0x11')]['role']!==_0xfe77('0x12'))throw new Error(_0xfe77('0x13'));if(isNaN(Number(_0x5b2271[_0xfe77('0x14')]['id'])))throw new Error(_0xfe77('0x15'));return db[_0xfe77('0x16')][_0xfe77('0x17')]({'where':{'id':_0x5b2271[_0xfe77('0x14')]['id']}})[_0xfe77('0x18')](handleEntityNotFound(_0x2f4c5f,null))[_0xfe77('0x18')](saveUpdates(_0x5b2271[_0xfe77('0x19')],null))[_0xfe77('0x18')](respondWithResult(_0x2f4c5f,null))[_0xfe77('0x1a')](handleError(_0x2f4c5f,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 b9f1b10..a1e40f6 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 _0x7ff1=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','UserSetting'];(function(_0x4a1d81,_0x1a88c6){var _0x2f0a38=function(_0x28d94f){while(--_0x28d94f){_0x4a1d81['push'](_0x4a1d81['shift']());}};_0x2f0a38(++_0x1a88c6);}(_0x7ff1,0xb2));var _0x17ff=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x7ff1[_0x158da6];return _0x429c30;};'use strict';var EventEmitter=require(_0x17ff('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x17ff('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x17ff('0x2')](0x0);var events={'afterCreate':_0x17ff('0x3'),'afterUpdate':_0x17ff('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20947f){return function(_0x5df80e,_0xe0cb47,_0x5061ec){UserSettingEvents['emit'](_0x20947f+':'+_0x5df80e['id'],_0x5df80e);UserSettingEvents[_0x17ff('0x5')](_0x20947f,_0x5df80e);_0x5061ec(null);};}for(var e in events){if(events[_0x17ff('0x6')](e)){var event=events[e];UserSetting[_0x17ff('0x7')](e,emitEvent(event));}}module[_0x17ff('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x1d3f=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserSetting'];(function(_0x5c1b05,_0x213768){var _0x1a65e7=function(_0x2845d7){while(--_0x2845d7){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x1a65e7(++_0x213768);}(_0x1d3f,0xbd));var _0xf1d3=function(_0x53f010,_0x4bda85){_0x53f010=_0x53f010-0x0;var _0x3092fd=_0x1d3f[_0x53f010];return _0x3092fd;};'use strict';var EventEmitter=require(_0xf1d3('0x0'));var UserSetting=require(_0xf1d3('0x1'))['db'][_0xf1d3('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf1d3('0x3'),'afterDestroy':_0xf1d3('0x4')};function emitEvent(_0x48b9b3){return function(_0x3e7f58,_0xd2a3cd,_0x568dee){UserSettingEvents[_0xf1d3('0x5')](_0x48b9b3+':'+_0x3e7f58['id'],_0x3e7f58);UserSettingEvents[_0xf1d3('0x5')](_0x48b9b3,_0x3e7f58);_0x568dee(null);};}for(var e in events){if(events[_0xf1d3('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xf1d3('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 dff029b..f24bedb 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 _0x23a3=['clientSideLoggingEnabledSince','define','user_settings','clientSideLoggingEnabled'];(function(_0x1e2344,_0x1f141f){var _0x2f46ed=function(_0x5aaa27){while(--_0x5aaa27){_0x1e2344['push'](_0x1e2344['shift']());}};_0x2f46ed(++_0x1f141f);}(_0x23a3,0x131));var _0x323a=function(_0x2003db,_0x4d687f){_0x2003db=_0x2003db-0x0;var _0x3f8b4d=_0x23a3[_0x2003db];return _0x3f8b4d;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x5e2477){return _0x5e2477[_0x323a('0x0')]('UserSetting',attributes,{'tableName':_0x323a('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bec8d){if(!_0x1bec8d[_0x323a('0x2')])_0x1bec8d[_0x323a('0x3')]=null;else if(_0x1bec8d[_0x323a('0x3')]===null)_0x1bec8d[_0x323a('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x3c0d=['clientSideLoggingEnabledSince','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x2cbc47,_0x2daf86){var _0x2b429e=function(_0x2e5582){while(--_0x2e5582){_0x2cbc47['push'](_0x2cbc47['shift']());}};_0x2b429e(++_0x2daf86);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x44d49a,_0x2215b8){_0x44d49a=_0x44d49a-0x0;var _0x5b0f9d=_0x3c0d[_0x44d49a];return _0x5b0f9d;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x592115){return _0x592115[_0xd3c0('0x0')](_0xd3c0('0x1'),attributes,{'tableName':_0xd3c0('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc520eb){if(!_0xc520eb[_0xd3c0('0x3')])_0xc520eb[_0xd3c0('0x4')]=null;else if(_0xc520eb[_0xd3c0('0x4')]===null)_0xc520eb[_0xd3c0('0x4')]=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 7129c2f..511d8a1 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 _0x1392=['register','save','remove','update','emit','user-setting:update:user-','UserId'];(function(_0x2912b9,_0x55e6e1){var _0x154da8=function(_0x503667){while(--_0x503667){_0x2912b9['push'](_0x2912b9['shift']());}};_0x154da8(++_0x55e6e1);}(_0x1392,0xe8));var _0x2139=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0x1392[_0x2f32c4];return _0x95b5dc;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x2139('0x0'),_0x2139('0x1'),_0x2139('0x2')];function createListener(_0x11be4d,_0x4de902){return function(_0x3870c1){_0x4de902[_0x2139('0x3')](_0x11be4d,_0x3870c1);if(_0x11be4d==='user-setting:update'){_0x4de902['emit'](_0x2139('0x4')+_0x3870c1[_0x2139('0x5')],_0x3870c1);}};}exports[_0x2139('0x6')]=function(_0x1484e7){for(var _0x3a4e0b=0x0,_0x131d3e=events['length'];_0x3a4e0b<_0x131d3e;_0x3a4e0b++){var _0x5bcf3b=events[_0x3a4e0b];var _0x7996c2=createListener('user-setting:'+_0x5bcf3b,_0x1484e7);UserSettingEvents['on'](_0x5bcf3b,_0x7996c2);}}; \ No newline at end of file +var _0x4456=['remove','update','emit','user-setting:update','user-setting:update:user-','register','length','save'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4456,0xb7));var _0x6445=function(_0x107ef3,_0x1ab8a7){_0x107ef3=_0x107ef3-0x0;var _0x5b81da=_0x4456[_0x107ef3];return _0x5b81da;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x6445('0x0'),_0x6445('0x1'),_0x6445('0x2')];function createListener(_0x5e3082,_0x4d431b){return function(_0x24c4ab){_0x4d431b[_0x6445('0x3')](_0x5e3082,_0x24c4ab);if(_0x5e3082===_0x6445('0x4')){_0x4d431b[_0x6445('0x3')](_0x6445('0x5')+_0x24c4ab['UserId'],_0x24c4ab);}};}exports[_0x6445('0x6')]=function(_0x2ef3a0){for(var _0x52b8a3=0x0,_0x12632e=events[_0x6445('0x7')];_0x52b8a3<_0x12632e;_0x52b8a3++){var _0x41b084=events[_0x52b8a3];var _0x3628f1=createListener('user-setting:'+_0x41b084,_0x2ef3a0);UserSettingEvents['on'](_0x41b084,_0x3628f1);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c4268b9..d88f5bf 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 _0xba34=['update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','bulkCreate','addQueues','diskStorage','root','server/files/images/','%s-%s','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put'];(function(_0x45de10,_0x59f7f9){var _0x3c4712=function(_0x2ae990){while(--_0x2ae990){_0x45de10['push'](_0x45de10['shift']());}};_0x3c4712(++_0x59f7f9);}(_0xba34,0x102));var _0x4ba3=function(_0x64ecfd,_0x149e09){_0x64ecfd=_0x64ecfd-0x0;var _0x19ddd3=_0xba34[_0x64ecfd];return _0x19ddd3;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ba3('0x3'));var router=express[_0x4ba3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4ba3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth['isAuthenticated'](),controller['getPresence']);router[_0x4ba3('0x8')](_0x4ba3('0xf'),auth['isAuthenticated'](),controller[_0x4ba3('0x10')]);router[_0x4ba3('0x8')](_0x4ba3('0x11'),controller['getAvatar']);router['get'](_0x4ba3('0x12'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x13')]);router[_0x4ba3('0x8')](_0x4ba3('0x14'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x15')]);router[_0x4ba3('0x8')](_0x4ba3('0x16'),auth[_0x4ba3('0x9')](),controller['getQueues']);router['get'](_0x4ba3('0x17'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x18')]);router[_0x4ba3('0x8')](_0x4ba3('0x19'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x1a')]);router[_0x4ba3('0x8')](_0x4ba3('0x1b'),auth[_0x4ba3('0x9')](),controller['getRecordings']);router['get'](_0x4ba3('0x1c'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x1d')]);router[_0x4ba3('0x8')](_0x4ba3('0x1e'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x1f')]);router[_0x4ba3('0x8')]('/:id/openchannel/interactions',auth[_0x4ba3('0x9')](),controller['getOpenchannelInteractions']);router[_0x4ba3('0x8')](_0x4ba3('0x20'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x21')]);router[_0x4ba3('0x8')](_0x4ba3('0x22'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x23')]);router[_0x4ba3('0x8')](_0x4ba3('0x24'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x25')]);router[_0x4ba3('0x8')](_0x4ba3('0x26'),auth[_0x4ba3('0x9')](),controller['getWhatsappInteractions']);router['get'](_0x4ba3('0x27'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x28')]);router[_0x4ba3('0x8')](_0x4ba3('0x29'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x2a')]);router[_0x4ba3('0x8')](_0x4ba3('0x2b'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x2c')]);router[_0x4ba3('0x8')](_0x4ba3('0x2d'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x4ba3('0x8')](_0x4ba3('0x2e'),auth['isAuthenticated'](),controller[_0x4ba3('0x2f')]);router['get'](_0x4ba3('0x30'),auth['isAuthenticated'](),controller[_0x4ba3('0x31')]);router['get'](_0x4ba3('0x32'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x33')]);router['get'](_0x4ba3('0x34'),auth['isAuthenticated'](),controller[_0x4ba3('0x35')]);router['get']('/:id/whatsapp_accounts',auth[_0x4ba3('0x9')](),controller['getWhatsappAccounts']);router[_0x4ba3('0x8')]('/:id/square_projects',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x36')]);router[_0x4ba3('0x8')](_0x4ba3('0x37'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x38')]);router[_0x4ba3('0x8')](_0x4ba3('0x39'),auth[_0x4ba3('0x9')](),controller['getApiKey']);router[_0x4ba3('0x3a')](_0x4ba3('0x14'),auth['isAuthenticated'](),controller[_0x4ba3('0x3b')]);router['post']('/',auth[_0x4ba3('0x9')](),controller['create']);router[_0x4ba3('0x3a')]('/create_many',auth['isAuthenticated'](),controller[_0x4ba3('0x3c')]);router[_0x4ba3('0x3a')](_0x4ba3('0x16'),auth['isAuthenticated'](),controller[_0x4ba3('0x3d')]);var upload=multer({'storage':multer[_0x4ba3('0x3e')]({'destination':function(_0x284fa4,_0x5b53ec,_0x4658b1){_0x4658b1(null,path['join'](config[_0x4ba3('0x3f')],_0x4ba3('0x40')));},'filename':function(_0x4f9973,_0x5a57eb,_0x29ed39){_0x29ed39(null,util['format'](_0x4ba3('0x41'),Date['now'](),_0x5a57eb[_0x4ba3('0x42')]));}})});router[_0x4ba3('0x3a')](_0x4ba3('0x11'),upload[_0x4ba3('0x43')](_0x4ba3('0x44')),controller['addAvatar']);router[_0x4ba3('0x3a')](_0x4ba3('0x45'),auth['isAuthenticated'](),controller[_0x4ba3('0x46')]);router[_0x4ba3('0x3a')](_0x4ba3('0x47'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x48')]);router[_0x4ba3('0x3a')](_0x4ba3('0x49'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x4a')]);router[_0x4ba3('0x3a')](_0x4ba3('0x4b'),auth[_0x4ba3('0x9')](),controller['unpause']);router['post'](_0x4ba3('0x27'),auth['isAuthenticated'](),controller[_0x4ba3('0x4c')]);router[_0x4ba3('0x3a')](_0x4ba3('0x4d'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x4e')]);router[_0x4ba3('0x3a')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x4ba3('0x4f')]);router[_0x4ba3('0x3a')](_0x4ba3('0x50'),auth['isAuthenticated'](),controller[_0x4ba3('0x51')]);router[_0x4ba3('0x3a')]('/:id/sms_interactions',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x52')]);router[_0x4ba3('0x3a')](_0x4ba3('0x53'),auth[_0x4ba3('0x9')](),controller['addOpenchannelInteractions']);router[_0x4ba3('0x3a')](_0x4ba3('0x54'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x55')]);router[_0x4ba3('0x3a')](_0x4ba3('0x56'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x57')]);router[_0x4ba3('0x3a')](_0x4ba3('0x2e'),auth['isAuthenticated'](),controller[_0x4ba3('0x58')]);router[_0x4ba3('0x3a')]('/:id/openchannel_accounts',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x59')]);router[_0x4ba3('0x3a')]('/:id/sms_accounts',auth[_0x4ba3('0x9')](),controller['addSmsAccounts']);router[_0x4ba3('0x3a')](_0x4ba3('0x34'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x5a')]);router[_0x4ba3('0x3a')](_0x4ba3('0x5b'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x5c')]);router[_0x4ba3('0x3a')](_0x4ba3('0x5d'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x5e')]);router[_0x4ba3('0x3a')](_0x4ba3('0x39'),auth[_0x4ba3('0x9')](),controller['createApiKey']);router[_0x4ba3('0x5f')](_0x4ba3('0xf'),auth['isAuthenticated'](),controller[_0x4ba3('0x60')]);router['put'](_0x4ba3('0x61'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x62')]);router[_0x4ba3('0x63')]('/:id/queues',auth['isAuthenticated'](),controller[_0x4ba3('0x64')]);router['delete']('/:id/teams',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x65')]);router[_0x4ba3('0x63')]('/:id',auth['isAuthenticated'](),controller[_0x4ba3('0x66')]);router[_0x4ba3('0x63')](_0x4ba3('0x4d'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x67')]);router[_0x4ba3('0x63')](_0x4ba3('0x68'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x69')]);router[_0x4ba3('0x63')](_0x4ba3('0x50'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x6a')]);router[_0x4ba3('0x63')](_0x4ba3('0x6b'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x6c')]);router[_0x4ba3('0x63')](_0x4ba3('0x53'),auth['isAuthenticated'](),controller[_0x4ba3('0x6d')]);router['delete'](_0x4ba3('0x54'),auth['isAuthenticated'](),controller[_0x4ba3('0x6e')]);router[_0x4ba3('0x63')]('/:id/fax_accounts',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x6f')]);router['delete'](_0x4ba3('0x2e'),auth[_0x4ba3('0x9')](),controller['removeMailAccounts']);router['delete'](_0x4ba3('0x30'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x70')]);router[_0x4ba3('0x63')](_0x4ba3('0x34'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x71')]);router[_0x4ba3('0x63')](_0x4ba3('0x5b'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x72')]);router['delete']('/:id/square_projects',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x73')]);router[_0x4ba3('0x63')]('/:id/api_key',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x74')]);module[_0x4ba3('0x75')]=router; \ No newline at end of file +var _0x9182=['removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','/:id/contacts','/:id/queues','getVoiceQueuesRt','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/api_key','getApiKey','post','create','/create_many','addQueues','join','root','server/files/images/','%s-%s','now','file','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','/:id','/:id/password','delete'];(function(_0x32917a,_0x3559ea){var _0x1881e1=function(_0x56730d){while(--_0x56730d){_0x32917a['push'](_0x32917a['shift']());}};_0x1881e1(++_0x3559ea);}(_0x9182,0xe6));var _0x2918=function(_0x57be54,_0x37b6e3){_0x57be54=_0x57be54-0x0;var _0x2512b1=_0x9182[_0x57be54];return _0x2512b1;};'use strict';var multer=require(_0x2918('0x0'));var util=require(_0x2918('0x1'));var path=require(_0x2918('0x2'));var timeout=require('connect-timeout');var express=require(_0x2918('0x3'));var router=express[_0x2918('0x4')]();var fs_extra=require(_0x2918('0x5'));var auth=require(_0x2918('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2918('0x7'));var controller=require(_0x2918('0x8'));router[_0x2918('0x9')]('/',auth[_0x2918('0xa')](),controller[_0x2918('0xb')]);router[_0x2918('0x9')](_0x2918('0xc'),auth[_0x2918('0xa')](),controller['describe']);router[_0x2918('0x9')](_0x2918('0xd'),auth[_0x2918('0xa')](),controller[_0x2918('0xe')]);router[_0x2918('0x9')](_0x2918('0xf'),auth[_0x2918('0xa')](),controller[_0x2918('0x10')]);router[_0x2918('0x9')]('/:id',auth[_0x2918('0xa')](),controller[_0x2918('0x11')]);router[_0x2918('0x9')](_0x2918('0x12'),controller['getAvatar']);router['get']('/:id/open_tabs',auth[_0x2918('0xa')](),controller['getOpenTabs']);router['get'](_0x2918('0x13'),auth[_0x2918('0xa')](),controller['getContacts']);router[_0x2918('0x9')](_0x2918('0x14'),auth[_0x2918('0xa')](),controller['getQueues']);router['get']('/:id/queues_rt',auth[_0x2918('0xa')](),controller[_0x2918('0x15')]);router[_0x2918('0x9')]('/:id/groups',auth[_0x2918('0xa')](),controller[_0x2918('0x16')]);router[_0x2918('0x9')]('/:id/recordings',auth[_0x2918('0xa')](),controller['getRecordings']);router[_0x2918('0x9')](_0x2918('0x17'),auth[_0x2918('0xa')](),controller[_0x2918('0x18')]);router[_0x2918('0x9')](_0x2918('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x2918('0x9')](_0x2918('0x1a'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x2918('0x9')](_0x2918('0x1b'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x2918('0x9')](_0x2918('0x1c'),auth[_0x2918('0xa')](),controller['getSmsInteractions']);router['get'](_0x2918('0x1d'),auth[_0x2918('0xa')](),controller[_0x2918('0x1e')]);router[_0x2918('0x9')](_0x2918('0x1f'),auth[_0x2918('0xa')](),controller[_0x2918('0x20')]);router[_0x2918('0x9')](_0x2918('0x21'),auth[_0x2918('0xa')](),controller[_0x2918('0x22')]);router['get'](_0x2918('0x23'),auth[_0x2918('0xa')](),controller[_0x2918('0x24')]);router[_0x2918('0x9')](_0x2918('0x25'),auth[_0x2918('0xa')](),controller[_0x2918('0x26')]);router['get']('/:id/prefixes',auth[_0x2918('0xa')](),controller[_0x2918('0x27')]);router['get'](_0x2918('0x28'),auth[_0x2918('0xa')](),controller[_0x2918('0x29')]);router[_0x2918('0x9')](_0x2918('0x2a'),auth[_0x2918('0xa')](),controller['getMailAccounts']);router[_0x2918('0x9')]('/:id/openchannel_accounts',auth[_0x2918('0xa')](),controller[_0x2918('0x2b')]);router['get']('/:id/sms_accounts',auth[_0x2918('0xa')](),controller[_0x2918('0x2c')]);router[_0x2918('0x9')]('/:id/chat_websites',auth[_0x2918('0xa')](),controller[_0x2918('0x2d')]);router[_0x2918('0x9')]('/:id/whatsapp_accounts',auth[_0x2918('0xa')](),controller[_0x2918('0x2e')]);router[_0x2918('0x9')]('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x2918('0x9')]('/:id/scheduled_calls',auth[_0x2918('0xa')](),controller['getScheduledCalls']);router[_0x2918('0x9')](_0x2918('0x2f'),auth[_0x2918('0xa')](),controller[_0x2918('0x30')]);router[_0x2918('0x31')](_0x2918('0x13'),auth['isAuthenticated'](),controller['addContacts']);router[_0x2918('0x31')]('/',auth[_0x2918('0xa')](),controller[_0x2918('0x32')]);router['post'](_0x2918('0x33'),auth[_0x2918('0xa')](),controller['bulkCreate']);router[_0x2918('0x31')](_0x2918('0x14'),auth['isAuthenticated'](),controller[_0x2918('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x17b4bf,_0x4a0e68,_0xb1f3dd){_0xb1f3dd(null,path[_0x2918('0x35')](config[_0x2918('0x36')],_0x2918('0x37')));},'filename':function(_0x26bdd8,_0x45921e,_0x370302){_0x370302(null,util['format'](_0x2918('0x38'),Date[_0x2918('0x39')](),_0x45921e['originalname']));}})});router['post'](_0x2918('0x12'),upload['single'](_0x2918('0x3a')),controller['addAvatar']);router[_0x2918('0x31')]('/:id/login',auth[_0x2918('0xa')](),controller[_0x2918('0x3b')]);router[_0x2918('0x31')](_0x2918('0x3c'),auth[_0x2918('0xa')](),controller[_0x2918('0x3d')]);router[_0x2918('0x31')](_0x2918('0x3e'),auth[_0x2918('0xa')](),controller['pause']);router[_0x2918('0x31')](_0x2918('0x3f'),auth[_0x2918('0xa')](),controller[_0x2918('0x40')]);router[_0x2918('0x31')](_0x2918('0x21'),auth[_0x2918('0xa')](),controller[_0x2918('0x41')]);router['post']('/:id/chat_interactions',auth[_0x2918('0xa')](),controller[_0x2918('0x42')]);router['post'](_0x2918('0x43'),auth[_0x2918('0xa')](),controller[_0x2918('0x44')]);router[_0x2918('0x31')](_0x2918('0x45'),auth[_0x2918('0xa')](),controller[_0x2918('0x46')]);router[_0x2918('0x31')](_0x2918('0x47'),auth[_0x2918('0xa')](),controller[_0x2918('0x48')]);router[_0x2918('0x31')]('/:id/openchannel_interactions',auth[_0x2918('0xa')](),controller[_0x2918('0x49')]);router['post'](_0x2918('0x4a'),auth[_0x2918('0xa')](),controller[_0x2918('0x4b')]);router[_0x2918('0x31')](_0x2918('0x28'),auth[_0x2918('0xa')](),controller[_0x2918('0x4c')]);router[_0x2918('0x31')]('/:id/mail_accounts',auth[_0x2918('0xa')](),controller['addMailAccounts']);router[_0x2918('0x31')](_0x2918('0x4d'),auth[_0x2918('0xa')](),controller[_0x2918('0x4e')]);router[_0x2918('0x31')](_0x2918('0x4f'),auth[_0x2918('0xa')](),controller[_0x2918('0x50')]);router[_0x2918('0x31')](_0x2918('0x51'),auth[_0x2918('0xa')](),controller[_0x2918('0x52')]);router[_0x2918('0x31')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x2918('0x53')]);router[_0x2918('0x31')](_0x2918('0x54'),auth['isAuthenticated'](),controller[_0x2918('0x55')]);router[_0x2918('0x31')](_0x2918('0x2f'),auth['isAuthenticated'](),controller[_0x2918('0x56')]);router[_0x2918('0x57')](_0x2918('0x58'),auth[_0x2918('0xa')](),controller['update']);router['put'](_0x2918('0x59'),auth[_0x2918('0xa')](),controller['changePassword']);router[_0x2918('0x5a')](_0x2918('0x14'),auth['isAuthenticated'](),controller[_0x2918('0x5b')]);router['delete'](_0x2918('0x21'),auth[_0x2918('0xa')](),controller[_0x2918('0x5c')]);router[_0x2918('0x5a')](_0x2918('0x58'),auth[_0x2918('0xa')](),controller[_0x2918('0x5d')]);router['delete'](_0x2918('0x5e'),auth[_0x2918('0xa')](),controller[_0x2918('0x5f')]);router[_0x2918('0x5a')](_0x2918('0x43'),auth[_0x2918('0xa')](),controller[_0x2918('0x60')]);router[_0x2918('0x5a')]('/:id/fax_interactions',auth[_0x2918('0xa')](),controller['removeFaxInteractions']);router[_0x2918('0x5a')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x2918('0x5a')](_0x2918('0x61'),auth[_0x2918('0xa')](),controller[_0x2918('0x62')]);router[_0x2918('0x5a')](_0x2918('0x4a'),auth[_0x2918('0xa')](),controller[_0x2918('0x63')]);router[_0x2918('0x5a')](_0x2918('0x28'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x2918('0x5a')](_0x2918('0x2a'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x2918('0x5a')](_0x2918('0x4d'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0x2918('0x4f'),auth['isAuthenticated'](),controller[_0x2918('0x64')]);router[_0x2918('0x5a')](_0x2918('0x51'),auth[_0x2918('0xa')](),controller[_0x2918('0x65')]);router[_0x2918('0x5a')](_0x2918('0x66'),auth[_0x2918('0xa')](),controller[_0x2918('0x67')]);router[_0x2918('0x5a')](_0x2918('0x54'),auth[_0x2918('0xa')](),controller[_0x2918('0x68')]);router[_0x2918('0x5a')](_0x2918('0x2f'),auth[_0x2918('0xa')](),controller[_0x2918('0x69')]);module[_0x2918('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 783bf66..445bfe1 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x81e7cf,_0x2afddb){var _0x70aa04=function(_0x1cf7f1){while(--_0x1cf7f1){_0x81e7cf['push'](_0x81e7cf['shift']());}};_0x70aa04(++_0x2afddb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xcb91[_0x50a004];return _0x5e9992;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x3e7dcf,_0x4ae455){var _0x5ba271=function(_0x28d544){while(--_0x28d544){_0x3e7dcf['push'](_0x3e7dcf['shift']());}};_0x5ba271(++_0x4ae455);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xcb91[_0x3e25c1];return _0x52e7f2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'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 2f5ca2b..a68bf6a 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 _0x7139=['addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','omit','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','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$overlap','$contains','$contained','firstName','lastName','dialActive','getApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','removeApiKey','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','isEmpty','flatten','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','result','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','select','InteractionId','field','user_has_','_interactions','OpenTabs','bluebird','util','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','http','request','then','User,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','info','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','userNotification:recalc:','destroy','get','role','admin','Users','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','send','rawAttributes','type','key','salt','User','query','include','userSetting','true','UserSetting','attributes','findAll','rows','openTabs','length','push','chat','dataValues','fax','openchannel','whatsapp','all','show','model','differenceBy','keys','password','filters','intersection','fields','includeAll','options','sms','mail','update','body','params','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','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','SELECT','from','voicemail','mailbox','fullname','email','agent','permissions','101','102','113','110','105','106','107','108','109','100','111','114','115','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','VoiceMail','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','oldPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','addQueues','channel','online','interface','add','capitalize','Queues','penalty','spread','toLowerCase','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','each','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','Unknown\x20channel','emit','userpic','file','filename','getAvatar','join','root','existsSync','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WHATSAPP','concat','getContacts','order','sort','where','merge','CmList','List','Tag','Tags','color','tag','hasOwnProperty','getQueues','pick','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','%s%s','Pause','manual','Team','getTeams','addTeams','resolve','User\x20with\x20id\x20%s\x20not\x20found','transaction','flattenDeep'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7139,0x7b));var _0x9713=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7139[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var BPromise=require(_0x9713('0x0'));var util=require(_0x9713('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x9713('0x2'));var squel=require(_0x9713('0x3'));var jayson=require(_0x9713('0x4'));var Redis=require(_0x9713('0x5'));var authService=require(_0x9713('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x9713('0x7'))(_0x9713('0x8'));var utils=require(_0x9713('0x9'));var config=require('../../config/environment');var licenseUtil=require(_0x9713('0xa'));var APIBadRequestError=require(_0x9713('0xb'))[_0x9713('0xc')];var APINotFoundError=require('../../errors/api')[_0x9713('0xd')];var APIHandleError=require(_0x9713('0xb'))[_0x9713('0xe')];var db=require(_0x9713('0xf'))['db'];var socket=require(_0x9713('0x10'))(new Redis(config['redis']));require(_0x9713('0x11'))[_0x9713('0x12')](socket);config[_0x9713('0x13')]=_[_0x9713('0x14')](config[_0x9713('0x13')],{'host':'localhost','port':0x18eb});var client=jayson['client'][_0x9713('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4993e4,_0x525e39,_0x11466d,_0x4d5235){return new BPromise(function(_0x283885,_0x4f6d23){var _0x5d8b7c=_0x4d5235||client;return _0x5d8b7c[_0x9713('0x16')](_0x4993e4,_0x11466d)[_0x9713('0x17')](function(_0x34a694){logger['info'](_0x9713('0x18'),_0x525e39,_0x9713('0x19'));logger[_0x9713('0x1a')]('User,\x20%s,\x20%s,\x20%s',_0x525e39,'request\x20sent',JSON[_0x9713('0x1b')](_0x34a694));if(_0x34a694['error']){if(_0x34a694['error']['code']===0x1f4){logger['error'](_0x9713('0x18'),_0x525e39,_0x34a694['error'][_0x9713('0x1c')]);return _0x4f6d23(_0x34a694[_0x9713('0x1d')][_0x9713('0x1c')]);}logger[_0x9713('0x1d')](_0x9713('0x18'),_0x525e39,_0x34a694['error']['message']);return _0x283885(_0x34a694[_0x9713('0x1d')][_0x9713('0x1c')]);}else{logger[_0x9713('0x1e')]('User,\x20%s,\x20%s',_0x525e39,_0x9713('0x19'));_0x283885(_0x34a694['result'][_0x9713('0x1c')]);}})[_0x9713('0x1f')](function(_0x4171ff){logger[_0x9713('0x1d')](_0x9713('0x18'),_0x525e39,_0x4171ff);_0x4f6d23(_0x4171ff);});});}function respondWithStatusCode(_0x1f4720,_0x3c0d98){_0x3c0d98=_0x3c0d98||0xcc;return function(_0x2b184b){if(_0x2b184b){return _0x1f4720[_0x9713('0x20')](_0x3c0d98);}return _0x1f4720['status'](_0x3c0d98)[_0x9713('0x21')]();};}function respondWithResult(_0x838a35,_0x40bf3a){_0x40bf3a=_0x40bf3a||0xc8;return function(_0x16d9d4){if(_0x16d9d4){return _0x838a35[_0x9713('0x22')](_0x40bf3a)[_0x9713('0x23')](_0x16d9d4);}};}function respondWithFilteredResult(_0x1acc2b,_0x579f3c){return function(_0x31eb14){if(_0x31eb14){var _0x28a392=typeof _0x579f3c[_0x9713('0x24')]===_0x9713('0x25')&&typeof _0x579f3c[_0x9713('0x26')]===_0x9713('0x25');var _0x10905f=_0x31eb14['count'];var _0x8a09fe=_0x28a392?0x0:_0x579f3c[_0x9713('0x24')];var _0x1ce41a=_0x28a392?_0x31eb14[_0x9713('0x27')]:_0x579f3c[_0x9713('0x24')]+_0x579f3c[_0x9713('0x26')];var _0x10bd15;if(_0x1ce41a>=_0x10905f){_0x1ce41a=_0x10905f;_0x10bd15=0xc8;}else{_0x10bd15=0xce;}_0x1acc2b[_0x9713('0x22')](_0x10bd15);return _0x1acc2b[_0x9713('0x28')](_0x9713('0x29'),_0x8a09fe+'-'+_0x1ce41a+'/'+_0x10905f)[_0x9713('0x23')](_0x31eb14);}return null;};}function saveUpdates(_0x115502){return function(_0x192b75){if(_0x192b75){return _0x192b75['update'](_0x115502)['then'](function(_0xc9a5e1){socket['emit'](_0x9713('0x2a')+_0xc9a5e1['id'],{});return _0xc9a5e1;});}return null;};}function removeEntity(_0x551fa0){return function(_0xd3de79){if(_0xd3de79){return _0xd3de79[_0x9713('0x2b')]()[_0x9713('0x17')](function(){var _0x224f35=_0xd3de79[_0x9713('0x2c')]({'plain':!![]});if(_0x224f35[_0x9713('0x2d')]===_0x9713('0x2e'))return;var _0x15b94e=[{'name':_0x9713('0x2f'),'value':'user','ignore':!![]},{'name':_0x9713('0x30'),'value':'agent','ignore':![]},{'name':_0x9713('0x31'),'value':_0x9713('0x32'),'ignore':![]}];var _0x1dd0e3=_(_0x15b94e)[_0x9713('0x33')](_0x9713('0x34'))[_0x9713('0x35')](_0x9713('0x36'))[_0x9713('0x36')]();if(_[_0x9713('0x37')](_0x1dd0e3,_0x224f35[_0x9713('0x2d')])){return;}var _0x32b8a8=_[_0x9713('0x38')](_0x15b94e,[_0x9713('0x36'),_0x224f35[_0x9713('0x2d')]])[_0x9713('0x39')];return db[_0x9713('0x3a')][_0x9713('0x2b')]({'where':{'type':_0x32b8a8,'resourceId':_0x224f35['id']}})[_0x9713('0x17')](function(){return _0xd3de79;});})['then'](function(){_0x551fa0[_0x9713('0x22')](0xcc)[_0x9713('0x21')]();});}};}function handleEntityNotFound(_0x30e573){return function(_0x4128b9){if(!_0x4128b9){_0x30e573['sendStatus'](0x194);}return _0x4128b9;};}function handleError(_0x5419da,_0x415cc1){_0x415cc1=_0x415cc1||0x1f4;return function(_0x183973){logger[_0x9713('0x1d')](_0x183973['stack']);if(_0x183973['name']){delete _0x183973[_0x9713('0x39')];}_0x5419da[_0x9713('0x22')](_0x415cc1)[_0x9713('0x3b')](_0x183973);};}exports['index']=function(_0x5b48ec,_0x2a3830){var _0x1b1079={},_0x1cbe8b={'count':0x0,'rows':[]};var _0x3e433d=_(db['User'][_0x9713('0x3c')])[_0x9713('0x35')](function(_0x3e005b){return{'name':_0x3e005b['fieldName'],'type':_0x3e005b[_0x9713('0x3d')][_0x9713('0x3e')]};})['filter'](function(_0x495912){return!_[_0x9713('0x37')](['password',_0x9713('0x3f')],_0x495912[_0x9713('0x39')]);})[_0x9713('0x36')]();_0x1b1079=qs['getOptions'](_0x3e433d,_0x5b48ec);var _0x921633={'where':_0x1b1079['where']};return db[_0x9713('0x40')]['count'](_0x921633)[_0x9713('0x17')](function(_0x98d527){_0x1cbe8b[_0x9713('0x27')]=_0x98d527;if(_0x5b48ec[_0x9713('0x41')]['includeAll']){_0x1b1079[_0x9713('0x42')]=[{'all':!![]}];}if(_0x5b48ec['query'][_0x9713('0x43')]===_0x9713('0x44')){_0x1b1079[_0x9713('0x42')]=[{'model':db[_0x9713('0x45')],'as':_0x9713('0x43')}];}if(!_[_0x9713('0x37')](_0x1b1079[_0x9713('0x46')],'id')){_0x1b1079[_0x9713('0x46')]['push']('id');}return db[_0x9713('0x40')][_0x9713('0x47')](_0x1b1079);})[_0x9713('0x17')](function(_0x33284d){_0x1cbe8b[_0x9713('0x48')]=_0x33284d;if(_0x5b48ec[_0x9713('0x41')][_0x9713('0x49')]===_0x9713('0x44')){var _0x2fa830=[];for(var _0x4a9dc4=0x0;_0x4a9dc4<_0x1cbe8b[_0x9713('0x48')][_0x9713('0x4a')];_0x4a9dc4++){_0x2fa830[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4c'),_0x1cbe8b[_0x9713('0x48')][_0x4a9dc4][_0x9713('0x4d')]));_0x2fa830[_0x9713('0x4b')](get_open_tabs('sms',_0x1cbe8b[_0x9713('0x48')][_0x4a9dc4][_0x9713('0x4d')]));_0x2fa830[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4e'),_0x1cbe8b[_0x9713('0x48')][_0x4a9dc4][_0x9713('0x4d')]));_0x2fa830[_0x9713('0x4b')](get_open_tabs('mail',_0x1cbe8b[_0x9713('0x48')][_0x4a9dc4][_0x9713('0x4d')]));_0x2fa830[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4f'),_0x1cbe8b['rows'][_0x4a9dc4][_0x9713('0x4d')]));_0x2fa830[_0x9713('0x4b')](get_open_tabs(_0x9713('0x50'),_0x1cbe8b[_0x9713('0x48')][_0x4a9dc4]['dataValues']));}return BPromise[_0x9713('0x51')](_0x2fa830)[_0x9713('0x17')](function(){return _0x1cbe8b;});}else{return _0x1cbe8b;}})[_0x9713('0x17')](respondWithFilteredResult(_0x2a3830,_0x1b1079))[_0x9713('0x1f')](handleError(_0x2a3830,null));};exports[_0x9713('0x52')]=function(_0x39287f,_0x19a0f6){var _0x46e23a={'raw':![],'where':{'id':_0x39287f['params']['id']}},_0x4571f8={};_0x4571f8[_0x9713('0x53')]=_[_0x9713('0x54')](_[_0x9713('0x55')](db[_0x9713('0x40')][_0x9713('0x3c')]),[_0x9713('0x56'),_0x9713('0x3f')]);_0x4571f8[_0x9713('0x41')]=_['keys'](_0x39287f[_0x9713('0x41')]);_0x4571f8[_0x9713('0x57')]=_[_0x9713('0x58')](_0x4571f8['model'],_0x4571f8['query']);_0x46e23a[_0x9713('0x46')]=_[_0x9713('0x58')](_0x4571f8[_0x9713('0x53')],qs['fields'](_0x39287f[_0x9713('0x41')][_0x9713('0x59')]));_0x46e23a['attributes']=_0x46e23a[_0x9713('0x46')]['length']?_0x46e23a[_0x9713('0x46')]:_0x4571f8[_0x9713('0x53')];if(_0x39287f['query'][_0x9713('0x5a')]){_0x46e23a[_0x9713('0x42')]=[{'all':!![]}];}if(_0x39287f['query']['userSetting']===_0x9713('0x44')){_0x46e23a[_0x9713('0x42')]=[{'model':db[_0x9713('0x45')],'as':_0x9713('0x43')}];}_0x46e23a=_['merge']({},_0x46e23a,_0x39287f[_0x9713('0x5b')]);if(!_[_0x9713('0x37')](_0x46e23a[_0x9713('0x46')],'id')){_0x46e23a[_0x9713('0x46')][_0x9713('0x4b')]('id');}return db[_0x9713('0x40')][_0x9713('0x38')](_0x46e23a)['then'](handleEntityNotFound(_0x19a0f6,null))['then'](function(_0x1e2822){var _0x43211a=[];values=_0x1e2822;if(_0x39287f['query'][_0x9713('0x49')]===_0x9713('0x44')){_0x43211a[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4c'),_0x1e2822[_0x9713('0x4d')]));_0x43211a['push'](get_open_tabs(_0x9713('0x5c'),_0x1e2822[_0x9713('0x4d')]));_0x43211a[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4f'),_0x1e2822[_0x9713('0x4d')]));_0x43211a['push'](get_open_tabs(_0x9713('0x50'),_0x1e2822[_0x9713('0x4d')]));_0x43211a[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4e'),_0x1e2822[_0x9713('0x4d')]));_0x43211a[_0x9713('0x4b')](get_open_tabs(_0x9713('0x5d'),_0x1e2822['dataValues']));return BPromise['all'](_0x43211a);}else{return values;}})[_0x9713('0x17')](function(){return values;})[_0x9713('0x17')](respondWithResult(_0x19a0f6,null))[_0x9713('0x1f')](handleError(_0x19a0f6,null));};exports[_0x9713('0x5e')]=function(_0x3f5f1e,_0x1e4b18){if(_0x3f5f1e[_0x9713('0x5f')]['id']){delete _0x3f5f1e[_0x9713('0x5f')]['id'];}delete _0x3f5f1e[_0x9713('0x5f')][_0x9713('0x2d')];return db[_0x9713('0x40')][_0x9713('0x38')]({'where':{'id':_0x3f5f1e[_0x9713('0x60')]['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x1e4b18,null))[_0x9713('0x17')](saveUpdates(_0x3f5f1e[_0x9713('0x5f')],null))[_0x9713('0x17')](respondWithResult(_0x1e4b18,null))[_0x9713('0x1f')](handleError(_0x1e4b18,null));};exports[_0x9713('0x61')]=function(_0x33ee59,_0xdc3142){return db[_0x9713('0x40')][_0x9713('0x61')]()[_0x9713('0x17')](respondWithResult(_0xdc3142,null))[_0x9713('0x1f')](handleError(_0xdc3142,null));};exports[_0x9713('0x62')]=function(_0x539165,_0x5b3598){return db[_0x9713('0x40')]['find']({'where':{'id':_0x539165['params']['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x5b3598,null))[_0x9713('0x17')](function(_0x4df752){if(_0x4df752){return _0x4df752['addContacts'](_0x539165[_0x9713('0x5f')][_0x9713('0x63')],_['omit'](_0x539165[_0x9713('0x5f')],['ids','id'])||{});}})['then'](respondWithResult(_0x5b3598,null))['catch'](handleError(_0x5b3598,null));};function validateUser(_0x10b7ad){return new BPromise(function(_0x34c5a3,_0x1e6532){if(_0x10b7ad[_0x9713('0x64')])return _0x34c5a3(_0x10b7ad);return db[_0x9713('0x65')][_0x9713('0x66')](0x1)['then'](function(_0x55684c){if(_0x55684c[_0x9713('0x67')])authService[_0x9713('0x68')](_0x10b7ad['password']);db[_0x9713('0x40')]['max'](_0x9713('0x64'))[_0x9713('0x17')](function(_0x16057b){if(_[_0x9713('0x69')](_0x16057b)){_0x10b7ad['internal']=_0x55684c[_0x9713('0x6a')]||0x1;return;}if(_['isNil'](_0x55684c['min_internal'])||_0x55684c[_0x9713('0x6a')]===_0x16057b){_0x10b7ad['internal']=_0x16057b+0x1;return;}if(_0x55684c[_0x9713('0x6a')]>_0x16057b){_0x10b7ad[_0x9713('0x64')]=_0x55684c[_0x9713('0x6a')];return;}return db['sequelize'][_0x9713('0x41')](_0x9713('0x6b'),{'type':db[_0x9713('0x6c')][_0x9713('0x6d')][_0x9713('0x6e')]})['then'](function(_0x52915c){if(_0x52915c&&_0x52915c[_0x9713('0x4a')]){for(var _0x2bebae=0x0,_0x28bb36=_0x52915c[_0x9713('0x4a')];_0x2bebae<_0x28bb36&&_[_0x9713('0x69')](_0x10b7ad[_0x9713('0x64')]);_0x2bebae++){if(_0x55684c['min_internal']<=_0x52915c[_0x2bebae][_0x9713('0x6f')]){_0x10b7ad[_0x9713('0x64')]=_0x52915c[_0x2bebae]['from'];}else if(_0x55684c['min_internal']>_0x52915c[_0x2bebae]['from']&&_0x55684c[_0x9713('0x6a')]<=_0x52915c[_0x2bebae]['to']){_0x10b7ad[_0x9713('0x64')]=_0x55684c['min_internal'];}}}if(_[_0x9713('0x69')](_0x10b7ad[_0x9713('0x64')])){_0x10b7ad[_0x9713('0x64')]=_0x16057b+0x1;}return _0x34c5a3(_0x10b7ad);});});})['catch'](function(_0x479dde){_0x1e6532(_0x479dde);});});}function updateUser(_0x689b9){return new BPromise(function(_0x6e2635,_0x7a1ceb){try{if(_0x689b9[_0x9713('0x70')]){_0x689b9[_0x9713('0x71')]=_0x689b9['internal'];_0x689b9['VoiceMail']={'mailbox':_0x689b9[_0x9713('0x64')],'password':_0x689b9[_0x9713('0x56')],'fullname':_0x689b9[_0x9713('0x72')],'email':_0x689b9[_0x9713('0x73')]};}if(_0x689b9[_0x9713('0x2d')]===_0x9713('0x74')){if(!_0x689b9[_0x9713('0x75')])_0x689b9['permissions']=[_0x9713('0x76'),_0x9713('0x77'),'103',_0x9713('0x78'),_0x9713('0x79'),'104',_0x9713('0x7a'),_0x9713('0x7b'),_0x9713('0x7c'),_0x9713('0x7d'),_0x9713('0x7e'),_0x9713('0x7f'),_0x9713('0x80'),_0x9713('0x81'),_0x9713('0x82')];}_0x6e2635(_0x689b9);}catch(_0x5e37ba){_0x7a1ceb(_0x5e37ba);}});}exports['create']=function(_0x5b2367,_0x380109){if(_0x5b2367[_0x9713('0x83')][_0x9713('0x2d')]===_0x9713('0x74'))throw new Error('Unauthorized');if(_0x5b2367[_0x9713('0x5f')]['role']===_0x9713('0x83')&&_0x5b2367[_0x9713('0x83')][_0x9713('0x2d')]!==_0x9713('0x2e')){throw new Error(_0x9713('0x84'));}if(_0x5b2367[_0x9713('0x5f')]['role']===_0x9713('0x2e')&&_0x5b2367[_0x9713('0x83')][_0x9713('0x2d')]!==_0x9713('0x2e')){throw new Error(_0x9713('0x85'));}return licenseUtil[_0x9713('0x86')]([_0x5b2367[_0x9713('0x5f')]])[_0x9713('0x17')](function(){return validateUser(_0x5b2367[_0x9713('0x5f')]);})[_0x9713('0x17')](function(_0x3018cd){return updateUser(_0x3018cd)[_0x9713('0x17')](function(_0x1e3353){if(_0x1e3353[_0x9713('0x2d')]==='admin'){_0x1e3353[_0x9713('0x87')]=_0x5b2367[_0x9713('0x83')][_0x9713('0x87')];delete _0x1e3353['userProfileId'];}return _0x1e3353;});})[_0x9713('0x17')](function(_0x356b84){return db[_0x9713('0x40')]['create'](_0x356b84,{'include':[{'model':db[_0x9713('0x88')],'as':_0x9713('0x88')}]});})[_0x9713('0x17')](function(_0x333c73){if(_0x5b2367[_0x9713('0x5f')][_0x9713('0x2d')]===_0x9713('0x83'))return _0x333c73;if(_0x5b2367[_0x9713('0x83')][_0x9713('0x2d')]!==_0x9713('0x83'))return _0x333c73;return db[_0x9713('0x89')][_0x9713('0x38')]({'where':{'name':_0x333c73['role']===_0x9713('0x74')?_0x9713('0x30'):'Telephones','userProfileId':_0x5b2367['user'][_0x9713('0x8a')]},'raw':!![]})['then'](function(_0x13ac87){if(!_0x13ac87||_0x13ac87[_0x9713('0x8b')]!=0x0)return _0x333c73;return db[_0x9713('0x3a')][_0x9713('0x8c')]({'name':_0x333c73[_0x9713('0x39')],'resourceId':_0x333c73['id'],'type':_0x13ac87[_0x9713('0x39')],'sectionId':_0x13ac87['id']},{})['then'](function(){return _0x333c73;});})[_0x9713('0x1f')](function(_0x23f8b8){logger[_0x9713('0x1d')](_0x9713('0x8d'),_0x23f8b8);throw _0x23f8b8;});})[_0x9713('0x17')](respondWithResult(_0x380109,0xc9))['catch'](handleError(_0x380109,null));};exports['bulkCreate']=function(_0x293457,_0x315aef){var _0xc6a7d8=_0x293457[_0x9713('0x5f')];var _0x1fba91=[];if(_0x293457[_0x9713('0x83')][_0x9713('0x2d')]===_0x9713('0x74'))throw new Error(_0x9713('0x8e'));if(_[_0x9713('0x8f')](_0xc6a7d8,[_0x9713('0x2d'),_0x9713('0x83')])&&_0x293457['user'][_0x9713('0x2d')]!==_0x9713('0x2e')){throw new Error(_0x9713('0x84'));}if(_[_0x9713('0x8f')](_0xc6a7d8,[_0x9713('0x2d'),_0x9713('0x2e')])&&_0x293457['user'][_0x9713('0x2d')]!==_0x9713('0x2e')){throw new Error(_0x9713('0x90'));}return licenseUtil[_0x9713('0x86')](_0xc6a7d8)[_0x9713('0x17')](function(){return validateUser(_0xc6a7d8[0x0]);})['then'](function(){for(var _0xd59759=0x1;_0xd59759<_0xc6a7d8[_0x9713('0x4a')];_0xd59759++){var _0x50df0d=_0xc6a7d8[_0xd59759-0x1][_0x9713('0x64')];if(!_0xc6a7d8[_0xd59759][_0x9713('0x64')])_0xc6a7d8[_0xd59759][_0x9713('0x64')]=_0x50df0d+0x1;_0x1fba91[_0x9713('0x4b')](validateUser(_0xc6a7d8[_0xd59759]));}return BPromise[_0x9713('0x51')](_0x1fba91);})[_0x9713('0x17')](function(){_0x1fba91=[];for(var _0x3ef09e=0x0;_0x3ef09e<_0xc6a7d8[_0x9713('0x4a')];_0x3ef09e++){_0x1fba91[_0x9713('0x4b')](updateUser(_0xc6a7d8[_0x3ef09e]));}return BPromise[_0x9713('0x51')](_0x1fba91);})[_0x9713('0x17')](function(){return BPromise['each'](_0xc6a7d8,function(_0xca1cea){return db[_0x9713('0x40')][_0x9713('0x8c')](_0xca1cea,{'include':[{'model':db[_0x9713('0x88')],'as':_0x9713('0x88')}]})[_0x9713('0x17')](function(_0x513c99){_0xca1cea['id']=_0x513c99['id'];return _0xca1cea;});});})[_0x9713('0x17')](function(_0x5a4edf){if(_0x293457[_0x9713('0x5f')]['role']===_0x9713('0x83'))return _0x5a4edf;if(_0x293457[_0x9713('0x83')][_0x9713('0x2d')]!==_0x9713('0x83'))return _0x5a4edf;var _0x10c274=_['some'](_0x5a4edf,function(_0x148069){return _0x148069[_0x9713('0x2d')]===_0x9713('0x74')||_0x148069[_0x9713('0x2d')]==='telephone';});if(!_0x10c274)return _0x5a4edf;return db['UserProfileSection'][_0x9713('0x47')]({'where':{'name':{'$or':[_0x9713('0x30'),_0x9713('0x31')]},'userProfileId':_0x293457[_0x9713('0x83')][_0x9713('0x8a')]},'raw':!![]})[_0x9713('0x17')](function(_0x19424d){if(_['isEmpty'](_0x19424d)||!_[_0x9713('0x8f')](_0x19424d,[_0x9713('0x8b'),0x0]))return _0x5a4edf;_0x1fba91=[];var _0x63d789=_(_0x19424d)[_0x9713('0x35')](function(_0xd919e9){if(_0xd919e9[_0x9713('0x8b')]===0x1)return;return _0xd919e9[_0x9713('0x39')]===_0x9713('0x30')?'agent':_0x9713('0x32');})['compact']()[_0x9713('0x36')]();for(var _0x2ffdc5=0x0;_0x2ffdc5<_0x5a4edf[_0x9713('0x4a')];_0x2ffdc5++){if(!_[_0x9713('0x37')](_0x63d789,_0x5a4edf[_0x2ffdc5][_0x9713('0x2d')]))return;var _0x3fe1de=_0x5a4edf[_0x2ffdc5][_0x9713('0x2d')]===_0x9713('0x74')?'Agents':_0x9713('0x31');_0x1fba91['push'](db[_0x9713('0x3a')][_0x9713('0x8c')]({'name':_0x5a4edf[_0x2ffdc5]['name'],'resourceId':_0x5a4edf[_0x2ffdc5]['id'],'type':_0x3fe1de,'sectionId':_[_0x9713('0x38')](_0x19424d,[_0x9713('0x39'),_0x3fe1de])['id']},{}));}return BPromise[_0x9713('0x51')](_0x1fba91);});})[_0x9713('0x17')](respondWithResult(_0x315aef,0xc9))['catch'](handleError(_0x315aef,null));};exports['changePassword']=function(_0x574621,_0x28d5c4){if(_0x574621[_0x9713('0x5f')]['id']){delete _0x574621[_0x9713('0x5f')]['id'];}return db[_0x9713('0x40')][_0x9713('0x38')]({'where':{'id':_0x574621['params']['id']}})[_0x9713('0x17')](function(_0x9eea24){if(!_0x9eea24)return null;if(_0x9eea24['id']===_0x574621[_0x9713('0x83')]['id']){if(!_0x574621[_0x9713('0x5f')][_0x9713('0x91')]||!_0x574621[_0x9713('0x5f')]['newPassword']){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x9eea24[_0x9713('0x94')](_0x574621[_0x9713('0x5f')][_0x9713('0x91')])){throw new db['Sequelize'][(_0x9713('0x93'))](_0x9713('0x95'));}if(_0x574621[_0x9713('0x5f')][_0x9713('0x91')]===_0x574621[_0x9713('0x5f')][_0x9713('0x96')]){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))](_0x9713('0x97'));}}else if(_0x574621[_0x9713('0x83')][_0x9713('0x2d')]===_0x9713('0x2e')){if(!_0x574621[_0x9713('0x5f')][_0x9713('0x96')]){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))](_0x9713('0x98'));}}else if(_0x574621['user'][_0x9713('0x2d')]===_0x9713('0x83')){if(!_0x574621['body']['newPassword']){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x9eea24['role']!==_0x9713('0x74')){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))]('Unauthorized');}}else{throw new db[(_0x9713('0x92'))]['ValidationError'](_0x9713('0x8e'));}return _0x9eea24;})[_0x9713('0x17')](handleEntityNotFound(_0x28d5c4,null))[_0x9713('0x17')](function(_0x1d6778){return db[_0x9713('0x65')][_0x9713('0x99')]({'attributes':['id',_0x9713('0x67'),_0x9713('0x9a'),_0x9713('0x9b')]})[_0x9713('0x17')](function(_0x3c26f4){if(_0x3c26f4[_0x9713('0x67')])authService[_0x9713('0x68')](_0x574621[_0x9713('0x5f')]['newPassword']);if(!_0x3c26f4[_0x9713('0x9a')]||!_0x1d6778[_0x9713('0x9c')])return _0x1d6778;authService[_0x9713('0x9d')](_0x574621[_0x9713('0x5f')][_0x9713('0x96')],_0x1d6778[_0x9713('0x9c')],_0x3c26f4[_0x9713('0x9b')]);return _0x1d6778;})[_0x9713('0x17')](saveUpdates({'password':_0x574621[_0x9713('0x5f')]['newPassword'],'passwordResetAt':_0x574621[_0x9713('0x83')]['id']==_0x574621['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x574621[_0x9713('0x5f')][_0x9713('0x96')],_0x1d6778[_0x9713('0x9c')])},null));})['then'](respondWithResult(_0x28d5c4,null))[_0x9713('0x1f')](handleError(_0x28d5c4,null));};exports[_0x9713('0x9e')]=function(_0x4bc25e,_0x474b0c){var _0x2baeaf=_0x4bc25e[_0x9713('0x5f')][_0x9713('0x9f')];return db[_0x9713('0x40')]['find']({'where':{'id':_0x4bc25e[_0x9713('0x60')]['id']},'attributes':['id','name','role',_0x9713('0xa0'),'loginInPause','voicePause',_0x9713('0xa1')]})[_0x9713('0x17')](handleEntityNotFound(_0x474b0c,null))[_0x9713('0x17')](function(_0xfd0c91){if(_0xfd0c91){if(!utils['isValidChannel'](_0x2baeaf)){throw new db[(_0x9713('0x92'))]['ValidationError']('Unknown\x20channel');}return _0xfd0c91[_0x9713('0xa2')+_[_0x9713('0xa3')](_0x2baeaf['toLowerCase']())+_0x9713('0xa4')](_0x4bc25e[_0x9713('0x5f')][_0x9713('0x63')],{'penalty':_0x4bc25e[_0x9713('0x5f')][_0x9713('0xa5')]||0x0})[_0x9713('0xa6')](function(_0xbbf27e){for(var _0x1b6572=0x0;_0x1b6572<_0x4bc25e[_0x9713('0x5f')][_0x9713('0x63')][_0x9713('0x4a')];_0x1b6572+=0x1){var _0x27b9b1={'UserId':Number(_0x4bc25e['params']['id'])};_0x27b9b1[_[_0x9713('0xa3')](_0x2baeaf[_0x9713('0xa7')]())+_0x9713('0xa8')]=Number(_0x4bc25e[_0x9713('0x5f')][_0x9713('0x63')][_0x1b6572]);socket['emit'](_0x9713('0x83')+_['capitalize'](_0x2baeaf[_0x9713('0xa7')]())+_0x9713('0xa9'),_0x27b9b1);}return _0xbbf27e;})[_0x9713('0x17')](function(){if(_0x2baeaf===_0x9713('0xaa')){return db[_0x9713('0xab')]['findAll']({'where':{'id':_0x4bc25e['body']['ids']||[]},'raw':!![],'attributes':['id',_0x9713('0x39')]});}})[_0x9713('0x17')](function(_0x15fce0){var _0x6692f=_0xfd0c91['get']({'plain':!![]});var _0x195e30=[];if(_0x2baeaf===_0x9713('0xaa')&&_0x6692f[_0x9713('0x2d')]===_0x9713('0x74')&&_0x6692f[_0x9713('0xa0')]){for(var _0x20fac8=0x0;_0x20fac8<_0x15fce0[_0x9713('0x4a')];_0x20fac8+=0x1){_0x195e30[_0x9713('0x4b')]({'membername':_0x6692f['name'],'UserId':_0x6692f['id'],'queue_name':_0x15fce0[_0x20fac8]['name'],'VoiceQueueId':_0x15fce0[_0x20fac8]['id'],'interface':_[_0x9713('0x69')](_0x6692f[_0x9713('0xa1')])?util[_0x9713('0xac')](_0x9713('0xad'),_0x6692f[_0x9713('0x39')]):_0x6692f[_0x9713('0xa1')],'paused':_0x6692f[_0x9713('0xae')]||![],'penalty':_0x4bc25e[_0x9713('0x5f')][_0x9713('0xa5')]||0x0});}return BPromise[_0x9713('0xaf')](_0x195e30,function(_0x104c85){return db[_0x9713('0xb0')][_0x9713('0xb1')](_0x104c85);});}return _0xfd0c91;});}})[_0x9713('0x17')](respondWithStatusCode(_0x474b0c,null))[_0x9713('0x1f')](handleError(_0x474b0c,null));};exports[_0x9713('0xb2')]=function(_0x16898b,_0x11b1de){var _0xa8df1,_0x4186c1;return db[_0x9713('0x40')][_0x9713('0x38')]({'where':{'id':_0x16898b[_0x9713('0x60')]['id']},'attributes':['id',_0x9713('0x39'),_0x9713('0x2d')]})['then'](handleEntityNotFound(_0x11b1de,null))[_0x9713('0x17')](function(_0x1b8940){if(_0x1b8940){_0xa8df1=_0x1b8940;if(!_0x16898b[_0x9713('0x41')][_0x9713('0x9f')]||!utils[_0x9713('0xb3')](_0x16898b[_0x9713('0x41')]['channel'])){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))](_0x9713('0xb4'));}return _0x1b8940['remove'+_[_0x9713('0xa3')](_0x16898b[_0x9713('0x41')]['channel']['toLowerCase']())+_0x9713('0xa4')](_0x16898b[_0x9713('0x41')][_0x9713('0x63')]);}})[_0x9713('0x17')](function(_0xe7f02a){if(_['isArray'](_0x16898b['query'][_0x9713('0x63')])){for(var _0x352f7d=0x0;_0x352f7d<_0x16898b[_0x9713('0x41')][_0x9713('0x63')]['length'];_0x352f7d+=0x1){_0x4186c1={'UserId':Number(_0x16898b[_0x9713('0x60')]['id'])};_0x4186c1[_['capitalize'](_0x16898b[_0x9713('0x41')][_0x9713('0x9f')][_0x9713('0xa7')]())+_0x9713('0xa8')]=Number(_0x16898b[_0x9713('0x41')]['ids'][_0x352f7d]);socket['emit'](_0x9713('0x83')+_[_0x9713('0xa3')](_0x16898b[_0x9713('0x41')][_0x9713('0x9f')][_0x9713('0xa7')]())+'Queue:remove',_0x4186c1);}}else{_0x4186c1={'UserId':Number(_0x16898b[_0x9713('0x60')]['id'])};_0x4186c1[_['capitalize'](_0x16898b[_0x9713('0x41')][_0x9713('0x9f')]['toLowerCase']())+_0x9713('0xa8')]=Number(_0x16898b[_0x9713('0x41')][_0x9713('0x63')]);socket[_0x9713('0xb5')](_0x9713('0x83')+_['capitalize'](_0x16898b[_0x9713('0x41')][_0x9713('0x9f')][_0x9713('0xa7')]())+'Queue:remove',_0x4186c1);}return _0xe7f02a;})['then'](function(){if(_0x16898b[_0x9713('0x41')]['channel']===_0x9713('0xaa')){return db[_0x9713('0xb0')][_0x9713('0x2b')]({'where':{'UserId':_0x16898b[_0x9713('0x60')]['id'],'VoiceQueueId':_0x16898b[_0x9713('0x41')][_0x9713('0x63')]},'individualHooks':!![]})['then'](function(){return _0xa8df1;});}return _0xa8df1;})[_0x9713('0x17')](respondWithStatusCode(_0x11b1de,null))['catch'](handleError(_0x11b1de,null));};exports['addAvatar']=function(_0x57b4dc,_0x18954b){_0x57b4dc['body'][_0x9713('0xb6')]=_0x57b4dc[_0x9713('0xb7')][_0x9713('0xb8')];return db[_0x9713('0x40')][_0x9713('0x38')]({'where':{'id':_0x57b4dc[_0x9713('0x60')]['id']}})['then'](handleEntityNotFound(_0x18954b,null))[_0x9713('0x17')](saveUpdates(_0x57b4dc[_0x9713('0x5f')],null))[_0x9713('0x17')](respondWithResult(_0x18954b,null))[_0x9713('0x1f')](handleError(_0x18954b,null));};exports[_0x9713('0xb9')]=function(_0x116f3b,_0x17f2e6){var _0x3ed13b=path[_0x9713('0xba')](config[_0x9713('0xbb')],'server/files/images/logos/default_profile.png');return db[_0x9713('0x40')][_0x9713('0x38')]({'where':{'id':_0x116f3b[_0x9713('0x60')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9713('0x17')](handleEntityNotFound(_0x17f2e6,null))[_0x9713('0x17')](function(_0x3ca444){if(_0x3ca444){if(_['isNil'](_0x3ca444['userpic'])){return _0x17f2e6['download'](_0x3ed13b);}else{if(!fs[_0x9713('0xbc')](path['join'](config[_0x9713('0xbb')],_0x9713('0xbd'),_0x3ca444[_0x9713('0xb6')]))){return _0x17f2e6[_0x9713('0xbe')](_0x3ed13b);}return _0x17f2e6[_0x9713('0xbe')](path[_0x9713('0xba')](config[_0x9713('0xbb')],_0x9713('0xbd'),_0x3ca444[_0x9713('0xb6')]));}}})[_0x9713('0x1f')](handleError(_0x17f2e6,null));};exports[_0x9713('0xbf')]=function(_0x5cf732,_0x41f454){return db[_0x9713('0x40')][_0x9713('0x38')]({'where':{'id':_0x5cf732[_0x9713('0x60')]['id']},'attributes':['id']})[_0x9713('0x17')](handleEntityNotFound(_0x41f454,null))[_0x9713('0x17')](function(_0x140875){var _0x3771d0=[];values=_0x140875['dataValues'];_0x3771d0[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4c'),_0x140875[_0x9713('0x4d')]));_0x3771d0[_0x9713('0x4b')](get_open_tabs('sms',_0x140875['dataValues']));_0x3771d0['push'](get_open_tabs('openchannel',_0x140875[_0x9713('0x4d')]));_0x3771d0[_0x9713('0x4b')](get_open_tabs(_0x9713('0x50'),_0x140875[_0x9713('0x4d')]));_0x3771d0[_0x9713('0x4b')](get_open_tabs(_0x9713('0x4e'),_0x140875[_0x9713('0x4d')]));_0x3771d0[_0x9713('0x4b')](get_open_tabs(_0x9713('0x5d'),_0x140875[_0x9713('0x4d')]));return BPromise[_0x9713('0x51')](_0x3771d0);})[_0x9713('0x17')](function(_0x5f1d64){if(_0x5f1d64){var _0x12adc7=_['map'](values[_0x9713('0xc0')],function(_0x5b6392){return{'channel':_0x9713('0xc1'),'id':_0x5b6392['id'],'createdAt':_0x5b6392[_0x9713('0xc2')]};});var _0x1831dd=_['map'](values[_0x9713('0xc3')],function(_0x5df391){return{'channel':_0x9713('0xc4'),'id':_0x5df391['id'],'createdAt':_0x5df391[_0x9713('0xc2')]};});var _0x4aee1f=_[_0x9713('0x35')](values[_0x9713('0xc5')],function(_0x582d55){return{'channel':_0x9713('0xc6'),'id':_0x582d55['id'],'createdAt':_0x582d55['createdAt']};});var _0x49dd49=_[_0x9713('0x35')](values[_0x9713('0xc7')],function(_0x3db307){return{'channel':_0x9713('0xc8'),'id':_0x3db307['id'],'createdAt':_0x3db307[_0x9713('0xc2')]};});var _0x2a06b9=_[_0x9713('0x35')](values['SmsOpenTabs'],function(_0x32cbcf){return{'channel':_0x9713('0xc9'),'id':_0x32cbcf['id'],'createdAt':_0x32cbcf[_0x9713('0xc2')]};});var _0xd2f367=_[_0x9713('0x35')](values['WhatsappOpenTabs'],function(_0x3ba1e5){return{'channel':_0x9713('0xca'),'id':_0x3ba1e5['id'],'createdAt':_0x3ba1e5['createdAt']};});var _0x633347=_[_0x9713('0xcb')](_0x12adc7,_0x1831dd,_0x4aee1f,_0x49dd49,_0x2a06b9,_0xd2f367);var _0x18bddf={'count':_0x633347[_0x9713('0x4a')],'rows':_0x633347};return _0x18bddf;}else return null;})[_0x9713('0x17')](respondWithResult(_0x41f454,null))[_0x9713('0x1f')](handleError(_0x41f454,null));};exports[_0x9713('0xcc')]=function(_0x3ba705,_0x2a0e89){var _0x321c01={};var _0x406e51={};var _0x1bd353;var _0x3f7f1a;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x3ba705['params']['id']}})['then'](handleEntityNotFound(_0x2a0e89,null))['then'](function(_0x49a782){if(_0x49a782){_0x1bd353=_0x49a782;_0x406e51[_0x9713('0x53')]=_[_0x9713('0x55')](db['CmContact'][_0x9713('0x3c')]);_0x406e51['query']=_['keys'](_0x3ba705[_0x9713('0x41')]);_0x406e51[_0x9713('0x57')]=_[_0x9713('0x58')](_0x406e51[_0x9713('0x53')],_0x406e51[_0x9713('0x41')]);_0x321c01[_0x9713('0x46')]=_[_0x9713('0x58')](_0x406e51['model'],qs['fields'](_0x3ba705['query']['fields']));_0x321c01[_0x9713('0x46')]=_0x321c01[_0x9713('0x46')]['length']?_0x321c01[_0x9713('0x46')]:_0x406e51[_0x9713('0x53')];_0x321c01[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x3ba705[_0x9713('0x41')][_0x9713('0xce')]);_0x321c01[_0x9713('0xcf')]=qs[_0x9713('0x57')](_['pick'](_0x3ba705[_0x9713('0x41')],_0x406e51['filters']));if(_0x3ba705[_0x9713('0x41')][_0x9713('0x33')]){_0x321c01[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0x321c01[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x321c01[_0x9713('0x46')],function(_0x41a868){var _0x17d8bf={};_0x17d8bf[_0x41a868]={'$like':'%'+_0x3ba705[_0x9713('0x41')]['filter']+'%'};return _0x17d8bf;})});}_0x321c01=_[_0x9713('0xd0')]({},_0x321c01,_0x3ba705[_0x9713('0x5b')]);return _0x1bd353[_0x9713('0xcc')](_0x321c01);}})[_0x9713('0x17')](function(_0x213633){if(_0x213633){_0x3f7f1a=_0x213633[_0x9713('0x4a')];if(_0x3ba705[_0x9713('0x41')]['hasOwnProperty'](_0x9713('0x5a'))){_0x321c01[_0x9713('0x42')]=[{'model':db[_0x9713('0xd1')],'as':_0x9713('0xd2'),'required':![]},{'model':db[_0x9713('0xd3')],'as':_0x9713('0xd4'),'attributes':['id',_0x9713('0x39'),_0x9713('0xd5')],'where':_0x3ba705[_0x9713('0x41')]['tag']?{'id':_0x3ba705[_0x9713('0x41')][_0x9713('0xd6')]}:undefined,'required':_0x3ba705[_0x9713('0x41')][_0x9713('0xd6')]?!![]:![]}];}if(!_0x3ba705[_0x9713('0x41')][_0x9713('0xd7')]('nolimit')){_0x321c01['limit']=qs[_0x9713('0x26')](_0x3ba705['query'][_0x9713('0x26')]);_0x321c01['offset']=qs[_0x9713('0x24')](_0x3ba705[_0x9713('0x41')][_0x9713('0x24')]);}return _0x1bd353[_0x9713('0xcc')](_0x321c01);}})[_0x9713('0x17')](function(_0x423e3e){if(_0x423e3e){return _0x423e3e?{'count':_0x3f7f1a,'rows':_0x423e3e}:null;}})['then'](respondWithResult(_0x2a0e89,null))[_0x9713('0x1f')](handleError(_0x2a0e89,null));};exports[_0x9713('0xd8')]=function(_0x2f3efb,_0x54217d){var _0x36c99f;var _0x92bffa={};var _0x1b528d;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x2f3efb[_0x9713('0x60')]['id']},'attributes':['id',_0x9713('0x39'),_0x9713('0x2d')]})[_0x9713('0x17')](handleEntityNotFound(_0x54217d,null))[_0x9713('0x17')](function(_0x50fc6e){if(!utils['isValidChannel'](_0x2f3efb[_0x9713('0x41')]['channel'])){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))]('Unknown\x20channel');}_0x36c99f=_0x50fc6e;var _0x4c685a={};_0x4c685a[_0x9713('0x53')]=_['keys'](db[_[_0x9713('0xa3')](_0x2f3efb[_0x9713('0x41')][_0x9713('0x9f')])+'Queue'][_0x9713('0x3c')]);_0x4c685a[_0x9713('0x41')]=_[_0x9713('0x55')](_0x2f3efb[_0x9713('0x41')]);_0x4c685a[_0x9713('0x57')]=_[_0x9713('0x58')](_0x4c685a['model'],_0x4c685a['query']);_0x92bffa['attributes']=_[_0x9713('0x58')](_0x4c685a[_0x9713('0x53')],qs[_0x9713('0x59')](_0x2f3efb['query']['fields']));_0x92bffa['attributes']=_0x92bffa['attributes'][_0x9713('0x4a')]?_0x92bffa[_0x9713('0x46')]:_0x4c685a[_0x9713('0x53')];_0x92bffa[_0x9713('0xcd')]=qs['sort'](_0x2f3efb[_0x9713('0x41')][_0x9713('0xce')]);_0x92bffa[_0x9713('0xcf')]=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x2f3efb[_0x9713('0x41')],_0x4c685a[_0x9713('0x57')]));if(_0x2f3efb[_0x9713('0x41')][_0x9713('0x33')]){_0x92bffa[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0x92bffa[_0x9713('0xcf')],{'$or':_['map'](_0x92bffa[_0x9713('0x46')],function(_0x587484){var _0x2e09f={};_0x2e09f[_0x587484]={'$like':'%'+_0x2f3efb[_0x9713('0x41')][_0x9713('0x33')]+'%'};return _0x2e09f;})});}_0x92bffa=_['merge']({},_0x92bffa,_0x2f3efb[_0x9713('0x5b')]);switch(_0x36c99f[_0x9713('0x2d')]){case'admin':return db[_['capitalize'](_0x2f3efb[_0x9713('0x41')][_0x9713('0x9f')])+_0x9713('0xda')][_0x9713('0x47')](_0x92bffa);case _0x9713('0x83'):case _0x9713('0x74'):return _0x36c99f[_0x9713('0x2c')+_[_0x9713('0xa3')](_0x2f3efb[_0x9713('0x41')][_0x9713('0x9f')])+_0x9713('0xa4')](_0x92bffa);default:throw new db[(_0x9713('0x92'))]['ValidationError'](_0x9713('0xdb'));}})[_0x9713('0x17')](function(_0x45a448){_0x1b528d=_0x45a448[_0x9713('0x4a')];if(!_0x2f3efb['query'][_0x9713('0xd7')](_0x9713('0xdc'))){_0x92bffa[_0x9713('0x26')]=qs[_0x9713('0x26')](_0x2f3efb[_0x9713('0x41')][_0x9713('0x26')]);_0x92bffa[_0x9713('0x24')]=qs[_0x9713('0x24')](_0x2f3efb[_0x9713('0x41')]['offset']);}switch(_0x36c99f[_0x9713('0x2d')]){case'admin':return db[_[_0x9713('0xa3')](_0x2f3efb['query'][_0x9713('0x9f')])+_0x9713('0xda')][_0x9713('0x47')](_0x92bffa);case _0x9713('0x83'):case'agent':return _0x36c99f[_0x9713('0x2c')+_[_0x9713('0xa3')](_0x2f3efb[_0x9713('0x41')]['channel'])+_0x9713('0xa4')](_0x92bffa);}})[_0x9713('0x17')](function(_0x14657b){return{'count':_0x1b528d,'rows':_0x14657b};})[_0x9713('0x17')](respondWithResult(_0x54217d,null))[_0x9713('0x1f')](handleError(_0x54217d,null));};exports['getVoiceQueuesRt']=function(_0x81567d,_0x24cd5e){var _0x4a25fb={};var _0x2f75f5={};var _0x192234;var _0x2e0d40;return db[_0x9713('0x40')]['findOne']({'where':{'id':_0x81567d[_0x9713('0x60')]['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x24cd5e,null))[_0x9713('0x17')](function(_0x441cd3){if(_0x441cd3){_0x192234=_0x441cd3;_0x2f75f5[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0xb0')][_0x9713('0x3c')]);_0x2f75f5[_0x9713('0x41')]=_['keys'](_0x81567d['query']);_0x2f75f5[_0x9713('0x57')]=_['intersection'](_0x2f75f5[_0x9713('0x53')],_0x2f75f5[_0x9713('0x41')]);_0x4a25fb['attributes']=_['intersection'](_0x2f75f5[_0x9713('0x53')],qs[_0x9713('0x59')](_0x81567d[_0x9713('0x41')][_0x9713('0x59')]));_0x4a25fb[_0x9713('0x46')]=_0x4a25fb['attributes'][_0x9713('0x4a')]?_0x4a25fb[_0x9713('0x46')]:_0x2f75f5['model'];_0x4a25fb[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x81567d[_0x9713('0x41')][_0x9713('0xce')]);_0x4a25fb[_0x9713('0xcf')]=qs['filters'](_[_0x9713('0xd9')](_0x81567d[_0x9713('0x41')],_0x2f75f5[_0x9713('0x57')]));if(_0x81567d[_0x9713('0x41')][_0x9713('0x33')]){_0x4a25fb[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0x4a25fb[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x4a25fb[_0x9713('0x46')],function(_0x10fc9f){var _0x19cd0e={};_0x19cd0e[_0x10fc9f]={'$like':'%'+_0x81567d['query'][_0x9713('0x33')]+'%'};return _0x19cd0e;})});}_0x4a25fb=_[_0x9713('0xd0')]({},_0x4a25fb,_0x81567d[_0x9713('0x5b')]);return _0x192234[_0x9713('0xdd')](_0x4a25fb);}})[_0x9713('0x17')](function(_0xa2ab4){if(_0xa2ab4){_0x2e0d40=_0xa2ab4[_0x9713('0x4a')];if(!_0x81567d[_0x9713('0x41')][_0x9713('0xd7')](_0x9713('0xdc'))){_0x4a25fb['limit']=qs['limit'](_0x81567d[_0x9713('0x41')]['limit']);_0x4a25fb[_0x9713('0x24')]=qs['offset'](_0x81567d['query'][_0x9713('0x24')]);}return _0x192234[_0x9713('0xdd')](_0x4a25fb);}})['then'](function(_0x1b3ee4){if(_0x1b3ee4){return _0x1b3ee4?{'count':_0x2e0d40,'rows':_0x1b3ee4}:null;}})['then'](respondWithResult(_0x24cd5e,null))[_0x9713('0x1f')](handleError(_0x24cd5e,null));};exports[_0x9713('0xde')]=function(_0x3a991f,_0x4f152f){var _0x1ced13={};var _0xf03fb6={};var _0x3af006;var _0x565dd4;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x3a991f['params']['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x4f152f,null))['then'](function(_0x3ad632){if(_0x3ad632){_0x3af006=_0x3ad632;_0xf03fb6[_0x9713('0x53')]=_['keys'](db['ChatGroup']['rawAttributes']);_0xf03fb6[_0x9713('0x41')]=_['keys'](_0x3a991f[_0x9713('0x41')]);_0xf03fb6['filters']=_[_0x9713('0x58')](_0xf03fb6[_0x9713('0x53')],_0xf03fb6[_0x9713('0x41')]);_0x1ced13['attributes']=_[_0x9713('0x58')](_0xf03fb6[_0x9713('0x53')],qs[_0x9713('0x59')](_0x3a991f[_0x9713('0x41')][_0x9713('0x59')]));_0x1ced13[_0x9713('0x46')]=_0x1ced13[_0x9713('0x46')][_0x9713('0x4a')]?_0x1ced13[_0x9713('0x46')]:_0xf03fb6['model'];_0x1ced13[_0x9713('0xcd')]=qs['sort'](_0x3a991f[_0x9713('0x41')][_0x9713('0xce')]);_0x1ced13['where']=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x3a991f[_0x9713('0x41')],_0xf03fb6[_0x9713('0x57')]));if(_0x3a991f[_0x9713('0x41')][_0x9713('0x33')]){_0x1ced13['where']=_[_0x9713('0xd0')](_0x1ced13[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x1ced13['attributes'],function(_0x458232){var _0x12b8bd={};_0x12b8bd[_0x458232]={'$like':'%'+_0x3a991f[_0x9713('0x41')][_0x9713('0x33')]+'%'};return _0x12b8bd;})});}_0x1ced13=_[_0x9713('0xd0')]({},_0x1ced13,_0x3a991f[_0x9713('0x5b')]);return _0x3af006[_0x9713('0xde')](_0x1ced13);}})[_0x9713('0x17')](function(_0x584574){if(_0x584574){_0x565dd4=_0x584574[_0x9713('0x4a')];if(!_0x3a991f['query']['hasOwnProperty'](_0x9713('0xdc'))){_0x1ced13[_0x9713('0x26')]=qs[_0x9713('0x26')](_0x3a991f[_0x9713('0x41')][_0x9713('0x26')]);_0x1ced13[_0x9713('0x24')]=qs[_0x9713('0x24')](_0x3a991f[_0x9713('0x41')]['offset']);}return _0x3af006[_0x9713('0xde')](_0x1ced13);}})[_0x9713('0x17')](function(_0x1e638f){if(_0x1e638f){return _0x1e638f?{'count':_0x565dd4,'rows':_0x1e638f}:null;}})[_0x9713('0x17')](respondWithResult(_0x4f152f,null))['catch'](handleError(_0x4f152f,null));};exports['getRecordings']=function(_0x31f72b,_0x3ef4e1){var _0x18803f={'raw':!![],'where':{}};var _0x259e3e={};var _0x4b671d={'count':0x0,'rows':[]};return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x31f72b[_0x9713('0x60')]['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x3ef4e1,null))[_0x9713('0x17')](function(_0x503efb){if(_0x503efb){_0x259e3e[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0xdf')][_0x9713('0x3c')]);_0x259e3e[_0x9713('0x41')]=_['keys'](_0x31f72b[_0x9713('0x41')]);_0x259e3e[_0x9713('0x57')]=_[_0x9713('0x58')](_0x259e3e[_0x9713('0x53')],_0x259e3e[_0x9713('0x41')]);_0x18803f[_0x9713('0x46')]=_[_0x9713('0x58')](_0x259e3e['model'],qs[_0x9713('0x59')](_0x31f72b[_0x9713('0x41')]['fields']));_0x18803f[_0x9713('0x46')]=_0x18803f[_0x9713('0x46')][_0x9713('0x4a')]?_0x18803f['attributes']:_0x259e3e['model'];if(!_0x31f72b[_0x9713('0x41')]['hasOwnProperty']('nolimit')){_0x18803f[_0x9713('0x26')]=qs['limit'](_0x31f72b[_0x9713('0x41')][_0x9713('0x26')]);_0x18803f['offset']=qs[_0x9713('0x24')](_0x31f72b['query'][_0x9713('0x24')]);}_0x18803f[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x31f72b['query'][_0x9713('0xce')]);_0x18803f[_0x9713('0xcf')]=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x31f72b[_0x9713('0x41')],_0x259e3e[_0x9713('0x57')]));_0x18803f[_0x9713('0xcf')][_0x9713('0xe0')]=_0x503efb['id'];if(_0x31f72b[_0x9713('0x41')][_0x9713('0x33')]){_0x18803f['where']=_[_0x9713('0xd0')](_0x18803f[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x18803f[_0x9713('0x46')],function(_0x13cc17){var _0x25e35a={};_0x25e35a[_0x13cc17]={'$like':'%'+_0x31f72b[_0x9713('0x41')][_0x9713('0x33')]+'%'};return _0x25e35a;})});}_0x18803f=_[_0x9713('0xd0')]({},_0x18803f,_0x31f72b[_0x9713('0x5b')]);return db[_0x9713('0xdf')][_0x9713('0x27')]({'where':_0x18803f[_0x9713('0xcf')]})[_0x9713('0x17')](function(_0x13bccb){_0x4b671d[_0x9713('0x27')]=_0x13bccb;if(_0x31f72b[_0x9713('0x41')][_0x9713('0x5a')]){_0x18803f[_0x9713('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x9713('0x47')](_0x18803f);})[_0x9713('0x17')](function(_0x44970c){_0x4b671d[_0x9713('0x48')]=_0x44970c;return _0x4b671d;});}})[_0x9713('0x17')](respondWithFilteredResult(_0x3ef4e1,_0x18803f))[_0x9713('0x1f')](handleError(_0x3ef4e1,null));};exports[_0x9713('0xe1')]=function(_0x520b8d,_0x2a25af){var _0xec3af={'raw':!![],'where':{}};var _0x5a5405={};var _0x1a3574={'count':0x0,'rows':[]};return db['User'][_0x9713('0x99')]({'where':{'id':_0x520b8d[_0x9713('0x60')]['id']}})['then'](handleEntityNotFound(_0x2a25af,null))[_0x9713('0x17')](function(_0x4785a8){if(_0x4785a8){_0x5a5405['model']=_[_0x9713('0x55')](db[_0x9713('0xe2')][_0x9713('0x3c')]);_0x5a5405[_0x9713('0x41')]=_[_0x9713('0x55')](_0x520b8d[_0x9713('0x41')]);_0x5a5405[_0x9713('0x57')]=_[_0x9713('0x58')](_0x5a5405['model'],_0x5a5405[_0x9713('0x41')]);_0xec3af[_0x9713('0x46')]=_[_0x9713('0x58')](_0x5a5405['model'],qs['fields'](_0x520b8d[_0x9713('0x41')][_0x9713('0x59')]));_0xec3af[_0x9713('0x46')]=_0xec3af['attributes'][_0x9713('0x4a')]?_0xec3af[_0x9713('0x46')]:_0x5a5405[_0x9713('0x53')];if(!_0x520b8d[_0x9713('0x41')][_0x9713('0xd7')](_0x9713('0xdc'))){_0xec3af[_0x9713('0x26')]=qs[_0x9713('0x26')](_0x520b8d[_0x9713('0x41')][_0x9713('0x26')]);_0xec3af[_0x9713('0x24')]=qs[_0x9713('0x24')](_0x520b8d['query']['offset']);}_0xec3af['order']=qs[_0x9713('0xce')](_0x520b8d[_0x9713('0x41')]['sort']);_0xec3af[_0x9713('0xcf')]=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x520b8d['query'],_0x5a5405[_0x9713('0x57')]));_0xec3af['where']['UserId']=_0x4785a8['id'];if(_0x520b8d[_0x9713('0x41')][_0x9713('0x33')]){_0xec3af[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0xec3af[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0xec3af[_0x9713('0x46')],function(_0x446619){var _0xa7cf92={};_0xa7cf92[_0x446619]={'$like':'%'+_0x520b8d[_0x9713('0x41')]['filter']+'%'};return _0xa7cf92;})});}_0xec3af=_[_0x9713('0xd0')]({},_0xec3af,_0x520b8d['options']);return db['ScreenRecording']['count']({'where':_0xec3af['where']})['then'](function(_0x235863){_0x1a3574['count']=_0x235863;if(_0x520b8d[_0x9713('0x41')][_0x9713('0x5a')]){_0xec3af[_0x9713('0x42')]=[{'all':!![]}];}return db[_0x9713('0xe2')]['findAll'](_0xec3af);})[_0x9713('0x17')](function(_0x5546ec){_0x1a3574['rows']=_0x5546ec;return _0x1a3574;});}})[_0x9713('0x17')](respondWithFilteredResult(_0x2a25af,_0xec3af))['catch'](handleError(_0x2a25af,null));};exports[_0x9713('0xe3')]=function(_0x5e5747,_0x1de886){var _0x4524b7={};var _0x127ba4={};var _0x592b5f;var _0x20a37d;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x5e5747[_0x9713('0x60')]['id']}})['then'](handleEntityNotFound(_0x1de886,null))[_0x9713('0x17')](function(_0x32f117){if(_0x32f117){_0x592b5f=_0x32f117;_0x127ba4[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0xe4')]['rawAttributes']);_0x127ba4['query']=_[_0x9713('0x55')](_0x5e5747[_0x9713('0x41')]);_0x127ba4[_0x9713('0x57')]=_[_0x9713('0x58')](_0x127ba4[_0x9713('0x53')],_0x127ba4[_0x9713('0x41')]);_0x4524b7[_0x9713('0x46')]=_[_0x9713('0x58')](_0x127ba4[_0x9713('0x53')],qs[_0x9713('0x59')](_0x5e5747['query'][_0x9713('0x59')]));_0x4524b7[_0x9713('0x46')]=_0x4524b7[_0x9713('0x46')]['length']?_0x4524b7['attributes']:_0x127ba4[_0x9713('0x53')];_0x4524b7[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x5e5747[_0x9713('0x41')][_0x9713('0xce')]);_0x4524b7[_0x9713('0xcf')]=qs[_0x9713('0x57')](_['pick'](_0x5e5747[_0x9713('0x41')],_0x127ba4['filters']));if(_0x5e5747['query'][_0x9713('0x33')]){_0x4524b7[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0x4524b7[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x4524b7[_0x9713('0x46')],function(_0x565ae4){var _0x8d604a={};_0x8d604a[_0x565ae4]={'$like':'%'+_0x5e5747[_0x9713('0x41')][_0x9713('0x33')]+'%'};return _0x8d604a;})});}_0x4524b7=_[_0x9713('0xd0')]({},_0x4524b7,_0x5e5747[_0x9713('0x5b')]);return _0x592b5f[_0x9713('0xe3')](_0x4524b7);}})['then'](function(_0x1ca576){if(_0x1ca576){_0x20a37d=_0x1ca576[_0x9713('0x4a')];if(!_0x5e5747[_0x9713('0x41')][_0x9713('0xd7')]('nolimit')){_0x4524b7[_0x9713('0x26')]=qs[_0x9713('0x26')](_0x5e5747['query'][_0x9713('0x26')]);_0x4524b7['offset']=qs[_0x9713('0x24')](_0x5e5747[_0x9713('0x41')][_0x9713('0x24')]);}return _0x592b5f[_0x9713('0xe3')](_0x4524b7);}})['then'](function(_0x2ad756){if(_0x2ad756){return _0x2ad756?{'count':_0x20a37d,'rows':_0x2ad756}:null;}})[_0x9713('0x17')](respondWithResult(_0x1de886,null))['catch'](handleError(_0x1de886,null));};exports[_0x9713('0xe5')]=function(_0x2f70b0,_0x44d7d1){var _0x5889e6={};var _0x2096f0={};var _0x2b56d2;var _0x46807e;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x2f70b0[_0x9713('0x60')]['id']}})['then'](handleEntityNotFound(_0x44d7d1,null))[_0x9713('0x17')](function(_0xb6e477){if(_0xb6e477){_0x2b56d2=_0xb6e477;_0x2096f0[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0xe6')][_0x9713('0x3c')]);_0x2096f0[_0x9713('0x41')]=_[_0x9713('0x55')](_0x2f70b0[_0x9713('0x41')]);_0x2096f0[_0x9713('0x57')]=_[_0x9713('0x58')](_0x2096f0['model'],_0x2096f0[_0x9713('0x41')]);_0x5889e6[_0x9713('0x46')]=_[_0x9713('0x58')](_0x2096f0[_0x9713('0x53')],qs['fields'](_0x2f70b0[_0x9713('0x41')][_0x9713('0x59')]));_0x5889e6[_0x9713('0x46')]=_0x5889e6[_0x9713('0x46')][_0x9713('0x4a')]?_0x5889e6[_0x9713('0x46')]:_0x2096f0[_0x9713('0x53')];_0x5889e6[_0x9713('0xcd')]=qs['sort'](_0x2f70b0['query'][_0x9713('0xce')]);_0x5889e6[_0x9713('0xcf')]=qs['filters'](_['pick'](_0x2f70b0[_0x9713('0x41')],_0x2096f0['filters']));if(_0x2f70b0[_0x9713('0x41')][_0x9713('0x33')]){_0x5889e6[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0x5889e6[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x5889e6['attributes'],function(_0x182b9b){var _0xbf0ac1={};_0xbf0ac1[_0x182b9b]={'$like':'%'+_0x2f70b0[_0x9713('0x41')][_0x9713('0x33')]+'%'};return _0xbf0ac1;})});}_0x5889e6=_[_0x9713('0xd0')]({},_0x5889e6,_0x2f70b0['options']);return _0x2b56d2['getOpenchannelInteractions'](_0x5889e6);}})[_0x9713('0x17')](function(_0x40f155){if(_0x40f155){_0x46807e=_0x40f155[_0x9713('0x4a')];if(!_0x2f70b0[_0x9713('0x41')]['hasOwnProperty'](_0x9713('0xdc'))){_0x5889e6[_0x9713('0x26')]=qs[_0x9713('0x26')](_0x2f70b0[_0x9713('0x41')][_0x9713('0x26')]);_0x5889e6['offset']=qs[_0x9713('0x24')](_0x2f70b0[_0x9713('0x41')]['offset']);}return _0x2b56d2['getOpenchannelInteractions'](_0x5889e6);}})[_0x9713('0x17')](function(_0x399ba3){if(_0x399ba3){return _0x399ba3?{'count':_0x46807e,'rows':_0x399ba3}:null;}})['then'](respondWithResult(_0x44d7d1,null))[_0x9713('0x1f')](handleError(_0x44d7d1,null));};exports[_0x9713('0xe7')]=function(_0x2d286c,_0x58dc5f){var _0x4a5a51={'raw':!![],'where':{}};var _0x156b18={};var _0xde75ad={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x2d286c[_0x9713('0x60')]['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x58dc5f,null))['then'](function(_0x47ee5d){if(_0x47ee5d){_0x156b18['model']=_[_0x9713('0x55')](db[_0x9713('0xe8')][_0x9713('0x3c')]);_0x156b18[_0x9713('0x41')]=_[_0x9713('0x55')](_0x2d286c[_0x9713('0x41')]);_0x156b18[_0x9713('0x57')]=_[_0x9713('0x58')](_0x156b18['model'],_0x156b18[_0x9713('0x41')]);_0x4a5a51[_0x9713('0x46')]=_[_0x9713('0x58')](_0x156b18[_0x9713('0x53')],qs[_0x9713('0x59')](_0x2d286c['query'][_0x9713('0x59')]));_0x4a5a51[_0x9713('0x46')]=_0x4a5a51[_0x9713('0x46')]['length']?_0x4a5a51[_0x9713('0x46')]:_0x156b18[_0x9713('0x53')];if(!_0x2d286c['query']['hasOwnProperty'](_0x9713('0xdc'))){_0x4a5a51[_0x9713('0x26')]=qs['limit'](_0x2d286c[_0x9713('0x41')][_0x9713('0x26')]);_0x4a5a51[_0x9713('0x24')]=qs[_0x9713('0x24')](_0x2d286c['query'][_0x9713('0x24')]);}_0x4a5a51[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x2d286c[_0x9713('0x41')][_0x9713('0xce')]);_0x4a5a51[_0x9713('0xcf')]=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x2d286c[_0x9713('0x41')],_0x156b18[_0x9713('0x57')]));_0x4a5a51[_0x9713('0xcf')][_0x9713('0xe0')]=_0x47ee5d['id'];if(_0x2d286c[_0x9713('0x41')][_0x9713('0x33')]){_0x4a5a51[_0x9713('0xcf')]=_['merge'](_0x4a5a51[_0x9713('0xcf')],{'$or':_['map'](_0x4a5a51['attributes'],function(_0x2a0ac0){var _0x19b03a={};_0x19b03a[_0x2a0ac0]={'$like':'%'+_0x2d286c[_0x9713('0x41')]['filter']+'%'};return _0x19b03a;})});}_0x4a5a51=_[_0x9713('0xd0')]({},_0x4a5a51,_0x2d286c[_0x9713('0x5b')]);return db[_0x9713('0xe8')][_0x9713('0x27')]({'where':_0x4a5a51['where']})[_0x9713('0x17')](function(_0x1e3fd9){_0xde75ad[_0x9713('0x27')]=_0x1e3fd9;if(_0x2d286c['query']['includeAll']){_0x4a5a51[_0x9713('0x42')]=[{'all':!![]}];}return db[_0x9713('0xe8')][_0x9713('0x47')](_0x4a5a51);})[_0x9713('0x17')](function(_0x3ef44f){_0xde75ad[_0x9713('0x48')]=_0x3ef44f;return _0xde75ad;});}})['then'](respondWithFilteredResult(_0x58dc5f,_0x4a5a51))['catch'](handleError(_0x58dc5f,null));};exports[_0x9713('0xe9')]=function(_0x10c4d5,_0x16a7a5){var _0x28d0c9={};var _0x2c51d7={};var _0xe96f41;var _0x5a1665;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x10c4d5['params']['id']}})['then'](handleEntityNotFound(_0x16a7a5,null))[_0x9713('0x17')](function(_0x29f8aa){if(_0x29f8aa){_0xe96f41=_0x29f8aa;_0x2c51d7[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0xea')][_0x9713('0x3c')]);_0x2c51d7[_0x9713('0x41')]=_[_0x9713('0x55')](_0x10c4d5[_0x9713('0x41')]);_0x2c51d7[_0x9713('0x57')]=_[_0x9713('0x58')](_0x2c51d7[_0x9713('0x53')],_0x2c51d7[_0x9713('0x41')]);_0x28d0c9['attributes']=_[_0x9713('0x58')](_0x2c51d7[_0x9713('0x53')],qs[_0x9713('0x59')](_0x10c4d5['query'][_0x9713('0x59')]));_0x28d0c9['attributes']=_0x28d0c9[_0x9713('0x46')][_0x9713('0x4a')]?_0x28d0c9[_0x9713('0x46')]:_0x2c51d7[_0x9713('0x53')];_0x28d0c9['order']=qs[_0x9713('0xce')](_0x10c4d5[_0x9713('0x41')][_0x9713('0xce')]);_0x28d0c9[_0x9713('0xcf')]=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x10c4d5['query'],_0x2c51d7[_0x9713('0x57')]));if(_0x10c4d5[_0x9713('0x41')]['filter']){_0x28d0c9[_0x9713('0xcf')]=_['merge'](_0x28d0c9[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x28d0c9[_0x9713('0x46')],function(_0x21fff1){var _0x216272={};_0x216272[_0x21fff1]={'$like':'%'+_0x10c4d5['query'][_0x9713('0x33')]+'%'};return _0x216272;})});}_0x28d0c9=_[_0x9713('0xd0')]({},_0x28d0c9,_0x10c4d5[_0x9713('0x5b')]);return _0xe96f41[_0x9713('0xe9')](_0x28d0c9);}})[_0x9713('0x17')](function(_0x2f1cc3){if(_0x2f1cc3){_0x5a1665=_0x2f1cc3[_0x9713('0x4a')];if(!_0x10c4d5[_0x9713('0x41')][_0x9713('0xd7')](_0x9713('0xdc'))){_0x28d0c9[_0x9713('0x26')]=qs[_0x9713('0x26')](_0x10c4d5[_0x9713('0x41')][_0x9713('0x26')]);_0x28d0c9[_0x9713('0x24')]=qs['offset'](_0x10c4d5['query'][_0x9713('0x24')]);}return _0xe96f41[_0x9713('0xe9')](_0x28d0c9);}})['then'](function(_0xee3ba7){if(_0xee3ba7){return _0xee3ba7?{'count':_0x5a1665,'rows':_0xee3ba7}:null;}})[_0x9713('0x17')](respondWithResult(_0x16a7a5,null))[_0x9713('0x1f')](handleError(_0x16a7a5,null));};exports[_0x9713('0xeb')]=function(_0x4e1105,_0x41bd69){var _0x1f6924={};var _0x7f57c7={};var _0x3ebba8;var _0x157e33;return db['User'][_0x9713('0x99')]({'where':{'id':_0x4e1105[_0x9713('0x60')]['id']}})['then'](handleEntityNotFound(_0x41bd69,null))[_0x9713('0x17')](function(_0x4ba307){if(_0x4ba307){_0x3ebba8=_0x4ba307;_0x7f57c7[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0xec')][_0x9713('0x3c')]);_0x7f57c7[_0x9713('0x41')]=_[_0x9713('0x55')](_0x4e1105[_0x9713('0x41')]);_0x7f57c7[_0x9713('0x57')]=_[_0x9713('0x58')](_0x7f57c7[_0x9713('0x53')],_0x7f57c7['query']);_0x1f6924[_0x9713('0x46')]=_['intersection'](_0x7f57c7[_0x9713('0x53')],qs[_0x9713('0x59')](_0x4e1105[_0x9713('0x41')]['fields']));_0x1f6924[_0x9713('0x46')]=_0x1f6924[_0x9713('0x46')][_0x9713('0x4a')]?_0x1f6924[_0x9713('0x46')]:_0x7f57c7[_0x9713('0x53')];_0x1f6924[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x4e1105[_0x9713('0x41')][_0x9713('0xce')]);_0x1f6924[_0x9713('0xcf')]=qs[_0x9713('0x57')](_['pick'](_0x4e1105[_0x9713('0x41')],_0x7f57c7[_0x9713('0x57')]));if(_0x4e1105[_0x9713('0x41')][_0x9713('0x33')]){_0x1f6924[_0x9713('0xcf')]=_['merge'](_0x1f6924[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x1f6924[_0x9713('0x46')],function(_0x4d14e2){var _0x446779={};_0x446779[_0x4d14e2]={'$like':'%'+_0x4e1105[_0x9713('0x41')]['filter']+'%'};return _0x446779;})});}_0x1f6924=_[_0x9713('0xd0')]({},_0x1f6924,_0x4e1105[_0x9713('0x5b')]);return _0x3ebba8['getFaxInteractions'](_0x1f6924);}})['then'](function(_0x361b8e){if(_0x361b8e){_0x157e33=_0x361b8e['length'];if(!_0x4e1105['query'][_0x9713('0xd7')](_0x9713('0xdc'))){_0x1f6924['limit']=qs[_0x9713('0x26')](_0x4e1105[_0x9713('0x41')][_0x9713('0x26')]);_0x1f6924[_0x9713('0x24')]=qs[_0x9713('0x24')](_0x4e1105['query'][_0x9713('0x24')]);}return _0x3ebba8['getFaxInteractions'](_0x1f6924);}})['then'](function(_0x3af522){if(_0x3af522){return _0x3af522?{'count':_0x157e33,'rows':_0x3af522}:null;}})[_0x9713('0x17')](respondWithResult(_0x41bd69,null))[_0x9713('0x1f')](handleError(_0x41bd69,null));};exports[_0x9713('0xed')]=function(_0x420002,_0x118fd8){var _0x206a1f={};var _0x166365={};var _0xa42aec;var _0x2477b1;return db[_0x9713('0x40')]['findOne']({'where':{'id':_0x420002['params']['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x118fd8,null))[_0x9713('0x17')](function(_0x2087e2){if(_0x2087e2){_0xa42aec=_0x2087e2;_0x166365[_0x9713('0x53')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x166365[_0x9713('0x41')]=_[_0x9713('0x55')](_0x420002[_0x9713('0x41')]);_0x166365[_0x9713('0x57')]=_[_0x9713('0x58')](_0x166365[_0x9713('0x53')],_0x166365[_0x9713('0x41')]);_0x206a1f[_0x9713('0x46')]=_[_0x9713('0x58')](_0x166365[_0x9713('0x53')],qs[_0x9713('0x59')](_0x420002['query'][_0x9713('0x59')]));_0x206a1f['attributes']=_0x206a1f[_0x9713('0x46')][_0x9713('0x4a')]?_0x206a1f[_0x9713('0x46')]:_0x166365['model'];_0x206a1f['order']=qs['sort'](_0x420002[_0x9713('0x41')][_0x9713('0xce')]);_0x206a1f[_0x9713('0xcf')]=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x420002[_0x9713('0x41')],_0x166365['filters']));if(_0x420002['query']['filter']){_0x206a1f[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0x206a1f[_0x9713('0xcf')],{'$or':_['map'](_0x206a1f[_0x9713('0x46')],function(_0x38a4cf){var _0x3da100={};_0x3da100[_0x38a4cf]={'$like':'%'+_0x420002['query'][_0x9713('0x33')]+'%'};return _0x3da100;})});}_0x206a1f=_[_0x9713('0xd0')]({},_0x206a1f,_0x420002[_0x9713('0x5b')]);return _0xa42aec['getWhatsappInteractions'](_0x206a1f);}})[_0x9713('0x17')](function(_0x20e238){if(_0x20e238){_0x2477b1=_0x20e238[_0x9713('0x4a')];if(!_0x420002[_0x9713('0x41')]['hasOwnProperty']('nolimit')){_0x206a1f['limit']=qs[_0x9713('0x26')](_0x420002['query'][_0x9713('0x26')]);_0x206a1f[_0x9713('0x24')]=qs[_0x9713('0x24')](_0x420002[_0x9713('0x41')]['offset']);}return _0xa42aec[_0x9713('0xed')](_0x206a1f);}})[_0x9713('0x17')](function(_0x4be36a){if(_0x4be36a){return _0x4be36a?{'count':_0x2477b1,'rows':_0x4be36a}:null;}})[_0x9713('0x17')](respondWithResult(_0x118fd8,null))['catch'](handleError(_0x118fd8,null));};exports['login']=function(_0x41a270,_0x49640e,_0x172468){var _0x127d93;var _0x329b9e;var _0x11222e;var _0x60eaae=!_[_0x9713('0x69')](_0x41a270[_0x9713('0x60')]['id'])?_0x41a270[_0x9713('0x60')]['id']:!_[_0x9713('0x69')](_0x41a270[_0x9713('0x83')]['id'])?_0x41a270['user']['id']:null;return db['User'][_0x9713('0x38')]({'where':{'id':_0x60eaae,'role':{'$or':[_0x9713('0x2e'),_0x9713('0x83'),_0x9713('0x74')]}},'attributes':['id',_0x9713('0x39'),_0x9713('0xee'),_0x9713('0xef'),'role',_0x9713('0x64'),_0x9713('0xf0')]})['then'](function(_0x44a0ea){if(_0x44a0ea){if(_0x44a0ea[_0x9713('0x2d')]==='agent'){_0x127d93=_0x44a0ea;if(_0x41a270[_0x9713('0x5f')]['interface']){_0x11222e=util[_0x9713('0xac')](_0x9713('0xf1'),_0x127d93[_0x41a270[_0x9713('0x5f')][_0x9713('0xa1')]]);}else if(_0x41a270[_0x9713('0x5f')][_0x9713('0xf2')]){_0x11222e=util[_0x9713('0xac')]('SIP/%s',_0x41a270[_0x9713('0x5f')]['intrf']);}else{_0x11222e=util[_0x9713('0xac')](_0x9713('0xad'),_0x127d93['name']);}socket['to'](util['format']('user:%s',_0x127d93[_0x9713('0x39')]))[_0x9713('0xb5')](_0x9713('0xf3'),{'user':{'id':_0x127d93['id'],'name':_0x127d93[_0x9713('0x39')]},'ip':_0x41a270['headers'][_0x9713('0xf4')]||_0x41a270[_0x9713('0xf5')][_0x9713('0xf6')]||_0x41a270[_0x9713('0xf7')]['remoteAddress']||_0x41a270[_0x9713('0xf5')][_0x9713('0xf7')][_0x9713('0xf6')]});return db[_0x9713('0xb0')]['destroy']({'where':{'membername':_0x127d93[_0x9713('0x39')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x9713('0x93'))](_0x9713('0xf8'));}})[_0x9713('0x17')](function(){if(_0x127d93){return _0x127d93[_0x9713('0xf9')]({'raw':!![]});}})['then'](function(_0x3f9705){if(_0x127d93){var _0x57c79f=[];if(_0x3f9705){_0x329b9e=_0x3f9705;if(_0x329b9e[_0x9713('0x4a')]){for(var _0x418391=0x0;_0x418391<_0x329b9e['length'];_0x418391++){_0x57c79f[_0x9713('0x4b')]({'membername':_0x127d93[_0x9713('0x39')],'UserId':_0x127d93['id'],'queue_name':_0x329b9e[_0x418391]['name'],'VoiceQueueId':_0x329b9e[_0x418391]['id'],'interface':_0x11222e,'paused':_0x127d93[_0x9713('0xf0')]||![],'penalty':_0x329b9e[_0x418391][_0x9713('0xfa')]||0x0});}return BPromise[_0x9713('0xaf')](_0x57c79f,function(_0x1fd6b2){return db[_0x9713('0xb0')][_0x9713('0xb1')](_0x1fd6b2);});}}}})['then'](function(){if(_0x127d93){return db[_0x9713('0xfb')][_0x9713('0x47')]({'where':{'membername':_0x127d93[_0x9713('0x39')],'exitAt':null}});}})['then'](function(_0xa2f18a){if(_0x127d93){var _0x3874dc=[];_0xa2f18a[_0x9713('0xfc')](function(_0x40713d){_0x3874dc[_0x9713('0x4b')](_0x40713d[_0x9713('0x5e')]({'exitAt':moment()[_0x9713('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9713('0x51')](_0x3874dc);}})[_0x9713('0x17')](function(){if(_0x127d93){var _0x1a3bb4=[];var _0x22c35c=[];var _0x54a980=utils['getChannels']();var _0x261ebf={'membername':_0x127d93[_0x9713('0x39')],'interface':_0x11222e,'enterAt':moment()[_0x9713('0xac')](_0x9713('0xfd')),'role':_0x127d93[_0x9713('0x2d')],'internal':_0x127d93[_0x9713('0x64')]};_0x54a980[_0x9713('0xfc')](function(_0x5d2345){_0x1a3bb4[_0x9713('0x4b')](_[_0x9713('0xd0')]({'channel':_0x5d2345,'type':_0x9713('0xfe'),'data1':_0x41a270[_0x9713('0x5f')][_0x9713('0xff')],'data2':_0x11222e},_0x261ebf));if(_0x127d93[_0x9713('0xf0')]){_0x22c35c[_0x9713('0x4b')](_[_0x9713('0xd0')]({'channel':_0x5d2345,'type':_0x9713('0x100'),'data1':_0x9713('0x101')},_0x261ebf));}});return db[_0x9713('0xfb')][_0x9713('0x102')](_0x1a3bb4[_0x9713('0xcb')](_0x22c35c),{'individualHooks':!![]});}})[_0x9713('0x17')](function(){if(_0x127d93){return _0x127d93[_0x9713('0x5e')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x127d93[_0x9713('0xf0')]||![],'mailPause':_0x127d93[_0x9713('0xf0')]||![],'chatPause':_0x127d93[_0x9713('0xf0')]||![],'faxPause':_0x127d93[_0x9713('0xf0')]||![],'smsPause':_0x127d93[_0x9713('0xf0')]||![],'openchannelPause':_0x127d93['loginInPause']||![],'whatsappPause':_0x127d93[_0x9713('0xf0')]||![],'pauseType':_0x127d93['loginInPause']?_0x9713('0x101'):null,'interface':_0x11222e,'lastPauseAt':moment()[_0x9713('0xac')](_0x9713('0xfd'))});}})[_0x9713('0x17')](function(_0x1e55a9){if(_0x41a270[_0x9713('0x103')]){return _0x172468();}else{return BPromise['resolve'](_0x1e55a9)['then'](respondWithResult(_0x49640e,null));}})[_0x9713('0x1f')](handleError(_0x49640e,null));};exports['logout']=function(_0x3d8a83,_0x4fceea){var _0x4df052;return db['User']['find']({'where':{'id':_0x3d8a83[_0x9713('0x60')]['id'],'role':_0x9713('0x74')},'attributes':['id','name',_0x9713('0x2d')]})[_0x9713('0x17')](handleEntityNotFound(_0x4fceea,null))[_0x9713('0x17')](function(_0x438b20){if(_0x438b20){_0x4df052=_0x438b20;return db[_0x9713('0xb0')][_0x9713('0x2b')]({'where':{'membername':_0x4df052[_0x9713('0x39')]},'individualHooks':!![]});}})[_0x9713('0x17')](function(){return db[_0x9713('0xfb')]['findAll']({'where':{'membername':_0x4df052[_0x9713('0x39')],'exitAt':null}});})['then'](function(_0x4295e0){var _0x8dd0b1=[];_0x4295e0[_0x9713('0xfc')](function(_0x4c4586){_0x8dd0b1[_0x9713('0x4b')](_0x4c4586['update']({'exitAt':moment()[_0x9713('0xac')](_0x9713('0xfd'))}));});return BPromise['all'](_0x8dd0b1);})['then'](function(){return _0x4df052[_0x9713('0x5e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9713('0x17')](respondWithResult(_0x4fceea,null))[_0x9713('0x1f')](handleError(_0x4fceea,null));};exports[_0x9713('0x104')]=function(_0x468999,_0x696792){var _0x4fa7a2;return db[_0x9713('0xb0')][_0x9713('0x5e')]({'paused':0x1},{'where':{'UserId':_0x468999[_0x9713('0x60')]['id']},'individualHooks':!![]})[_0x9713('0x17')](function(){return db['User'][_0x9713('0x38')]({'where':{'id':_0x468999[_0x9713('0x60')]['id'],'role':_0x9713('0x74')},'attributes':['id',_0x9713('0x39'),_0x9713('0x2d'),_0x9713('0x64'),_0x9713('0xa1')]});})[_0x9713('0x17')](handleEntityNotFound(_0x696792,null))[_0x9713('0x17')](function(_0x50426d){if(_0x50426d){_0x4fa7a2=_0x50426d;return respondWithRpcPromise(_0x9713('0x105'),_0x9713('0x104'),{'id':_0x4fa7a2['id'],'name':_0x4fa7a2[_0x9713('0x39')],'pause':!![]});}})[_0x9713('0x17')](function(){if(_0x4fa7a2){return db[_0x9713('0xfb')][_0x9713('0x47')]({'where':{'membername':_0x4fa7a2[_0x9713('0x39')],'type':_0x9713('0x100'),'exitAt':null}});}})[_0x9713('0x17')](function(_0x5053b7){if(_0x5053b7[_0x9713('0x4a')]){var _0x4e3c06=moment()['format'](_0x9713('0xfd'));for(var _0x95d98f=0x0,_0x3d4c75=_0x5053b7[_0x9713('0x4a')];_0x95d98f<_0x3d4c75;_0x95d98f++){_0x5053b7[_0x95d98f][_0x9713('0x106')]({'exitAt':_0x4e3c06});}}})[_0x9713('0x17')](function(){var _0x5686c3=[];var _0x4223c0=utils[_0x9713('0x107')]();_0x4223c0[_0x9713('0xfc')](function(_0x16d519){_0x5686c3[_0x9713('0x4b')]({'channel':_0x16d519,'membername':_0x4fa7a2[_0x9713('0x39')],'interface':_[_0x9713('0x69')](_0x4fa7a2[_0x9713('0xa1')])?util['format']('SIP/%s',_0x4fa7a2[_0x9713('0x39')]):_0x4fa7a2[_0x9713('0xa1')],'type':_0x9713('0x100'),'enterAt':moment()[_0x9713('0xac')](_0x9713('0xfd')),'data1':_0x468999[_0x9713('0x5f')]['type']||'DEFAULT\x20PAUSE','role':_0x4fa7a2[_0x9713('0x2d')],'internal':_0x4fa7a2[_0x9713('0x64')]});});return db[_0x9713('0xfb')][_0x9713('0x102')](_0x5686c3,{'individualHooks':!![]});})['then'](function(){return _0x4fa7a2['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x468999['body'][_0x9713('0x3d')]||_0x9713('0x108'),'lastPauseAt':moment()[_0x9713('0xac')](_0x9713('0xfd'))});})[_0x9713('0x17')](respondWithResult(_0x696792,null))[_0x9713('0x1f')](handleError(_0x696792,null));};exports[_0x9713('0x109')]=function(_0x53bacd,_0x1b7f26){var _0x459b20;return db[_0x9713('0x40')]['find']({'where':{'id':_0x53bacd['params']['id']},'attributes':['id',_0x9713('0x39'),_0x9713('0x2d'),_0x9713('0xae'),_0x9713('0x10a'),'chatPause',_0x9713('0x10b'),_0x9713('0x10c'),_0x9713('0x10d'),'whatsapppause',_0x9713('0x10e'),_0x9713('0x10f')]})[_0x9713('0x17')](handleEntityNotFound(_0x1b7f26,null))[_0x9713('0x17')](function(_0x1a842a){if(_0x1a842a){_0x459b20=_0x1a842a;if(_0x53bacd['body']['channel']&&!utils['isValidChannel'](_0x53bacd[_0x9713('0x5f')][_0x9713('0x9f')])){throw new db[(_0x9713('0x92'))][(_0x9713('0x93'))](_0x9713('0xb4'));}switch(_0x53bacd[_0x9713('0x5f')][_0x9713('0x9f')]){case _0x9713('0xaa'):return respondWithRpcPromise(_0x9713('0x105'),_0x9713('0x109'),{'id':_0x459b20['id'],'name':_0x459b20[_0x9713('0x39')],'pause':![]})['then'](function(){return db[_0x9713('0xb0')][_0x9713('0x5e')]({'paused':0x0},{'where':{'UserId':_0x459b20['id']},'individualHooks':!![]});})[_0x9713('0x17')](function(){return db[_0x9713('0xfb')][_0x9713('0x38')]({'where':{'channel':_0x53bacd[_0x9713('0x5f')][_0x9713('0x9f')],'membername':_0x459b20[_0x9713('0x39')],'type':_0x9713('0x100'),'exitAt':null}});})['then'](function(_0x4b448f){if(_0x4b448f){return _0x4b448f['update']({'exitAt':moment()[_0x9713('0xac')](_0x9713('0xfd')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9713('0x17')](function(){return _0x459b20[_0x9713('0x5e')]({'voicePause':![]});});case _0x9713('0x5d'):case _0x9713('0x4c'):case'fax':case _0x9713('0x5c'):case'whatsapp':case _0x9713('0x4f'):return db[_0x9713('0xfb')][_0x9713('0x38')]({'where':{'channel':_0x53bacd[_0x9713('0x5f')]['channel'],'membername':_0x459b20[_0x9713('0x39')],'type':_0x9713('0x100'),'exitAt':null}})['then'](function(_0x56e709){if(_0x56e709){return _0x56e709['update']({'exitAt':moment()[_0x9713('0xac')](_0x9713('0xfd')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9713('0x17')](function(){var _0x1c47f8={};_[_0x9713('0x28')](_0x1c47f8,util[_0x9713('0xac')](_0x9713('0x110'),_0x53bacd[_0x9713('0x5f')][_0x9713('0x9f')],_0x9713('0x111')),![]);return _0x459b20[_0x9713('0x5e')](_0x1c47f8);});default:return respondWithRpcPromise(_0x9713('0x105'),_0x9713('0x109'),{'id':_0x459b20['id'],'name':_0x459b20[_0x9713('0x39')],'pause':![]})[_0x9713('0x17')](function(){return db[_0x9713('0xb0')][_0x9713('0x5e')]({'paused':0x0},{'where':{'UserId':_0x459b20['id']}});})[_0x9713('0x17')](function(){return db[_0x9713('0xfb')][_0x9713('0x47')]({'where':{'membername':_0x459b20[_0x9713('0x39')],'type':_0x9713('0x100'),'exitAt':null}});})[_0x9713('0x17')](function(_0x21a95f){var _0x4a5103=[];_0x21a95f[_0x9713('0xfc')](function(_0x28f507){_0x4a5103[_0x9713('0x4b')](_0x28f507[_0x9713('0x5e')]({'exitAt':moment()[_0x9713('0xac')](_0x9713('0xfd')),'data2':_0x9713('0x112')}));});return BPromise[_0x9713('0x51')](_0x4a5103);})[_0x9713('0x17')](function(){return _0x459b20[_0x9713('0x5e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9713('0x17')](respondWithResult(_0x1b7f26,null))[_0x9713('0x1f')](handleError(_0x1b7f26,null));};exports['getTeams']=function(_0x2b9932,_0x42db6b){var _0x29c199={};var _0x307985={};var _0x5cb79a;var _0x284dfc;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x2b9932['params']['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x42db6b,null))[_0x9713('0x17')](function(_0x45db1f){if(_0x45db1f){_0x5cb79a=_0x45db1f;_0x307985[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0x113')]['rawAttributes']);_0x307985[_0x9713('0x41')]=_[_0x9713('0x55')](_0x2b9932[_0x9713('0x41')]);_0x307985['filters']=_['intersection'](_0x307985[_0x9713('0x53')],_0x307985[_0x9713('0x41')]);_0x29c199[_0x9713('0x46')]=_[_0x9713('0x58')](_0x307985['model'],qs[_0x9713('0x59')](_0x2b9932[_0x9713('0x41')]['fields']));_0x29c199['attributes']=_0x29c199[_0x9713('0x46')][_0x9713('0x4a')]?_0x29c199[_0x9713('0x46')]:_0x307985[_0x9713('0x53')];_0x29c199[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x2b9932['query']['sort']);_0x29c199[_0x9713('0xcf')]=qs[_0x9713('0x57')](_[_0x9713('0xd9')](_0x2b9932[_0x9713('0x41')],_0x307985[_0x9713('0x57')]));if(_0x2b9932['query'][_0x9713('0x33')]){_0x29c199[_0x9713('0xcf')]=_['merge'](_0x29c199[_0x9713('0xcf')],{'$or':_['map'](_0x29c199[_0x9713('0x46')],function(_0xd732d8){var _0x32bd95={};_0x32bd95[_0xd732d8]={'$like':'%'+_0x2b9932[_0x9713('0x41')]['filter']+'%'};return _0x32bd95;})});}_0x29c199=_[_0x9713('0xd0')]({},_0x29c199,_0x2b9932[_0x9713('0x5b')]);return _0x5cb79a[_0x9713('0x114')](_0x29c199);}})[_0x9713('0x17')](function(_0xb670fd){if(_0xb670fd){_0x284dfc=_0xb670fd[_0x9713('0x4a')];if(!_0x2b9932[_0x9713('0x41')]['hasOwnProperty'](_0x9713('0xdc'))){_0x29c199['limit']=qs[_0x9713('0x26')](_0x2b9932[_0x9713('0x41')][_0x9713('0x26')]);_0x29c199['offset']=qs[_0x9713('0x24')](_0x2b9932[_0x9713('0x41')][_0x9713('0x24')]);}return _0x5cb79a['getTeams'](_0x29c199);}})[_0x9713('0x17')](function(_0x8c93db){if(_0x8c93db){return _0x8c93db?{'count':_0x284dfc,'rows':_0x8c93db}:null;}})[_0x9713('0x17')](respondWithResult(_0x42db6b,null))[_0x9713('0x1f')](handleError(_0x42db6b,null));};exports[_0x9713('0x115')]=function(_0x1edc40,_0x4b3734){var _0x39289a=_0x1edc40[_0x9713('0x60')]['id'];var _0x12a1ab=_0x1edc40['body']?_0x1edc40['body'][_0x9713('0x63')]:null;var _0x17d384=[];return Promise[_0x9713('0x116')]()[_0x9713('0x17')](function(){if(!_0x12a1ab)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x39289a}});})[_0x9713('0x17')](function(_0x34d88f){if(!_0x34d88f)throw new APINotFoundError(util[_0x9713('0xac')](_0x9713('0x117'),_0x1edc40[_0x9713('0x60')]['id']));return db[_0x9713('0x6c')][_0x9713('0x118')](function(_0x2979ab){return _0x34d88f['addTeams'](_0x12a1ab,{'transaction':_0x2979ab})[_0x9713('0x17')](function(){return db[_0x9713('0x113')][_0x9713('0x47')]({'where':{'id':{'$in':_0x12a1ab}}});})[_0x9713('0x17')](function(_0x73e0a4){var _0x262c9c=_[_0x9713('0x35')](_0x73e0a4,function(_0xf73176){return _0xf73176['getAssociatedQueues']();});return Promise['all'](_0x262c9c);})[_0x9713('0x17')](function(_0x28cc61){_0x17d384=_[_0x9713('0x119')](_0x28cc61);var _0xd71685=_['map'](_0x17d384,function(_0xd859f1){return _0xd859f1[_0x9713('0x11a')](_0x34d88f['id'],{'transaction':_0x2979ab});});return Promise['all'](_0xd71685);})['then'](function(){if(!_0x34d88f[_0x9713('0xa0')])return;var _0x41ec01=_['filter'](_0x17d384,function(_0x56eb39){return _0x56eb39[_0x9713('0x11b')](_0x9713('0x9f'))===_0x9713('0x11c');});var _0x535027=_['map'](_0x41ec01,function(_0x4ab144){return db[_0x9713('0xb0')][_0x9713('0xb1')]({'membername':_0x34d88f[_0x9713('0x39')],'UserId':_0x34d88f['id'],'queue_name':_0x4ab144[_0x9713('0x39')],'VoiceQueueId':_0x4ab144['id'],'interface':_['isNil'](_0x34d88f[_0x9713('0xa1')])?util['format'](_0x9713('0xad'),_0x34d88f[_0x9713('0x39')]):_0x34d88f[_0x9713('0xa1')],'paused':_0x34d88f[_0x9713('0xae')]||![],'penalty':_0x34d88f[_0x9713('0xa5')]},{'transaction':_0x2979ab});});return Promise[_0x9713('0x51')](_0x535027);})[_0x9713('0x17')](function(){return db[_0x9713('0x11d')][_0x9713('0x47')]({'where':{'teamId':{'$in':_0x12a1ab}}});})[_0x9713('0x17')](function(_0x99a2ce){var _0x5d67eb=_['map'](_0x99a2ce,function(_0x590eb6){return db[_0x9713('0x11e')][_0x9713('0x8c')]({'UserId':_0x34d88f['id'],'VoicePrefixId':_0x590eb6[_0x9713('0x11f')]},{'transaction':_0x2979ab});});return Promise[_0x9713('0x51')](_0x5d67eb);});});})[_0x9713('0x17')](function(){for(var _0x2f7772=0x0;_0x2f7772<_0x17d384[_0x9713('0x4a')];_0x2f7772++){var _0x24ee23=_0x17d384[_0x2f7772]['getDataValue'](_0x9713('0x9f'));var _0x5751ea=_0x24ee23+_0x9713('0xa8');socket['emit'](_0x9713('0x83')+_0x24ee23+_0x9713('0xa9'),{'UserId':_0x39289a,['queueField']:_0x17d384[_0x2f7772]['id']});}})[_0x9713('0x17')](respondWithStatusCode(_0x4b3734,null))[_0x9713('0x1f')](APIHandleError(_0x4b3734));};exports[_0x9713('0x120')]=function(_0x19d23c,_0x248a8b){var _0x3bcdb2=_0x19d23c[_0x9713('0x60')]['id'];var _0x3dc68b=null;if(_0x19d23c[_0x9713('0x41')]['ids']){_0x3dc68b=_[_0x9713('0x121')](_0x19d23c[_0x9713('0x41')]['ids'])?_0x19d23c[_0x9713('0x41')][_0x9713('0x63')]:[_0x19d23c[_0x9713('0x41')][_0x9713('0x63')]];}var _0x186a33=[];return Promise['resolve']()[_0x9713('0x17')](function(){if(!_0x3dc68b)throw new APIBadRequestError(_0x9713('0x122'));})['then'](function(){return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x3bcdb2}});})[_0x9713('0x17')](function(_0x5340aa){if(!_0x5340aa)throw new APINotFoundError(util[_0x9713('0xac')](_0x9713('0x117'),_0x19d23c[_0x9713('0x60')]['id']));return db[_0x9713('0x6c')][_0x9713('0x118')](function(_0x161837){return _0x5340aa[_0x9713('0x120')](_0x3dc68b,{'transaction':_0x161837})['then'](function(){return db[_0x9713('0x113')][_0x9713('0x47')]({'where':{'id':{'$in':_0x3dc68b}}});})[_0x9713('0x17')](function(_0x189086){var _0x398d93=_['map'](_0x189086,function(_0x102cba){return _0x102cba[_0x9713('0x123')]();});return Promise[_0x9713('0x51')](_0x398d93);})[_0x9713('0x17')](function(_0x3657b6){_0x186a33=_[_0x9713('0x119')](_0x3657b6);var _0x537db6=_[_0x9713('0x35')](_0x186a33,function(_0x1840c8){return _0x1840c8[_0x9713('0x124')](_0x5340aa['id'],{'transaction':_0x161837});});return Promise[_0x9713('0x51')](_0x537db6);})[_0x9713('0x17')](function(){if(!_0x5340aa['online'])return;var _0x2abcca=_[_0x9713('0x33')](_0x186a33,function(_0xe1f435){return _0xe1f435['getDataValue'](_0x9713('0x9f'))===_0x9713('0x11c');});var _0x2847c8=_['map'](_0x2abcca,function(_0x3ab89e){return db[_0x9713('0xb0')][_0x9713('0x2b')]({'where':{'VoiceQueueId':_0x3ab89e['id'],'UserId':_0x5340aa['id']},'transaction':_0x161837});});return Promise[_0x9713('0x51')](_0x2847c8);})['then'](function(){return db[_0x9713('0x11d')][_0x9713('0x47')]({'where':{'teamId':{'$in':_0x3dc68b}}});})['then'](function(_0x406165){var _0x515341=_[_0x9713('0x35')](_0x406165,function(_0x39372e){return db[_0x9713('0x11e')][_0x9713('0x2b')]({'where':{'UserId':_0x5340aa['id'],'VoicePrefixId':_0x39372e['VoicePrefixId']}},{'transaction':_0x161837});});return Promise['all'](_0x515341);});});})[_0x9713('0x17')](function(){for(var _0x3f62de=0x0;_0x3f62de<_0x186a33[_0x9713('0x4a')];_0x3f62de++){var _0x4ff718=_0x186a33[_0x3f62de]['getDataValue']('channel');var _0x2df41a=_0x4ff718+'QueueId';socket[_0x9713('0xb5')](_0x9713('0x83')+_0x4ff718+'Queue:remove',{'UserId':_0x3bcdb2,['queueField']:_0x186a33[_0x3f62de]['id']});}})[_0x9713('0x17')](respondWithStatusCode(_0x248a8b,null))[_0x9713('0x1f')](APIHandleError(_0x248a8b));};exports[_0x9713('0x125')]=function(_0x486776,_0x2de924){var _0x16a26b={};var _0x30ce42={};var _0x4c60df;var _0x5ce531;return db[_0x9713('0x40')]['findOne']({'where':{'id':_0x486776[_0x9713('0x60')]['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x2de924,null))['then'](function(_0xaa1801){if(_0xaa1801){_0x4c60df=_0xaa1801;_0x30ce42[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0xd1')][_0x9713('0x3c')]);_0x30ce42[_0x9713('0x41')]=_[_0x9713('0x55')](_0x486776[_0x9713('0x41')]);_0x30ce42[_0x9713('0x57')]=_['intersection'](_0x30ce42['model'],_0x30ce42['query']);_0x16a26b['attributes']=_[_0x9713('0x58')](_0x30ce42['model'],qs['fields'](_0x486776[_0x9713('0x41')][_0x9713('0x59')]));_0x16a26b[_0x9713('0x46')]=_0x16a26b[_0x9713('0x46')][_0x9713('0x4a')]?_0x16a26b[_0x9713('0x46')]:_0x30ce42[_0x9713('0x53')];_0x16a26b[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x486776[_0x9713('0x41')]['sort']);_0x16a26b['where']=qs[_0x9713('0x57')](_['pick'](_0x486776[_0x9713('0x41')],_0x30ce42['filters']));if(_0x486776['query'][_0x9713('0x33')]){_0x16a26b[_0x9713('0xcf')]=_[_0x9713('0xd0')](_0x16a26b['where'],{'$or':_[_0x9713('0x35')](_0x16a26b['attributes'],function(_0x4f91d3){var _0x5246d5={};_0x5246d5[_0x4f91d3]={'$like':'%'+_0x486776[_0x9713('0x41')][_0x9713('0x33')]+'%'};return _0x5246d5;})});}_0x16a26b=_[_0x9713('0xd0')]({},_0x16a26b,_0x486776[_0x9713('0x5b')]);return _0x4c60df[_0x9713('0x125')](_0x16a26b);}})['then'](function(_0x13431c){if(_0x13431c){_0x5ce531=_0x13431c[_0x9713('0x4a')];if(!_0x486776[_0x9713('0x41')][_0x9713('0xd7')](_0x9713('0xdc'))){_0x16a26b[_0x9713('0x26')]=qs[_0x9713('0x26')](_0x486776[_0x9713('0x41')][_0x9713('0x26')]);_0x16a26b[_0x9713('0x24')]=qs['offset'](_0x486776[_0x9713('0x41')]['offset']);}return _0x4c60df['getLists'](_0x16a26b);}})[_0x9713('0x17')](function(_0x356c7b){if(_0x356c7b){return _0x356c7b?{'count':_0x5ce531,'rows':_0x356c7b}:null;}})[_0x9713('0x17')](respondWithResult(_0x2de924,null))[_0x9713('0x1f')](handleError(_0x2de924,null));};exports[_0x9713('0x126')]=function(_0x5de67b,_0x3be4bb){var _0x3abe02={};var _0x47a270={};var _0x4465df;return db[_0x9713('0x40')][_0x9713('0x99')]({'where':{'id':_0x5de67b[_0x9713('0x60')]['id']}})[_0x9713('0x17')](handleEntityNotFound(_0x3be4bb,null))[_0x9713('0x17')](function(_0xa13aa0){if(_0xa13aa0){_0x4465df=_0xa13aa0;_0x47a270[_0x9713('0x53')]=_[_0x9713('0x55')](db[_0x9713('0x40')][_0x9713('0x3c')]);_0x47a270[_0x9713('0x41')]=_[_0x9713('0x55')](_0x5de67b['query']);_0x47a270[_0x9713('0x57')]=_[_0x9713('0x58')](_0x47a270['model'],_0x47a270[_0x9713('0x41')]);_0x3abe02[_0x9713('0x46')]=_[_0x9713('0x58')](_0x47a270[_0x9713('0x53')],qs[_0x9713('0x59')](_0x5de67b[_0x9713('0x41')][_0x9713('0x59')]));_0x3abe02['attributes']=_0x3abe02['attributes'][_0x9713('0x4a')]?_0x3abe02[_0x9713('0x46')]:_0x47a270[_0x9713('0x53')];_0x3abe02[_0x9713('0xcd')]=qs[_0x9713('0xce')](_0x5de67b[_0x9713('0x41')][_0x9713('0xce')]);_0x3abe02[_0x9713('0xcf')]=qs['filters'](_[_0x9713('0xd9')](_0x5de67b[_0x9713('0x41')],_0x47a270['filters']));if(_0x5de67b['query'][_0x9713('0x33')]){_0x3abe02[_0x9713('0xcf')]=_['merge'](_0x3abe02[_0x9713('0xcf')],{'$or':_[_0x9713('0x35')](_0x3abe02['attributes'],function(_0x432edb){var _0x10b54a={};_0x10b54a[_0x432edb]={'$like':'%'+_0x5de67b[_0x9713('0x41')]['filter']+'%'};return _0x10b54a;})});}_0x3abe02[_0x9713('0x53')]=db[_0x9713('0x40')];_0x3abe02['as']=_0x9713('0x30');_0x3abe02=_[_0x9713('0xd0')]({},_0x3abe02,_0x5de67b['options']);return _0x4465df[_0x9713('0xf9')]({'include':[_0x3abe02]});}})[_0x9713('0x17')](function(_0x35c5ba){if(_0x35c5ba){var _0x1c779d={},_0x52e310=[];for(var _0x585cea=0x0;_0x585cea<_0x35c5ba[_0x9713('0x4a')];_0x585cea+=0x1){for(var _0x401064=0x0,_0x1bd164;_0x401064<_0x35c5ba[_0x585cea][_0x9713('0x30')][_0x9713('0x4a')];_0x401064+=0x1){_0x1bd164=_0x35c5ba[_0x585cea][_0x9713('0x30')][_0x401064][_0x9713('0x2c')]({'plain':!![]});_0x1c779d[_0x1bd164['id']]=_0x1bd164;}}_0x1c779d=_[_0x9713('0x127')](_0x1c779d);for(var _0x14d70a=qs[_0x9713('0x24')](_0x5de67b['query'][_0x9713('0x24')]);_0x14d70a<_0x1c779d[_0x9713('0x4a')]&&_0x52e310['length']=_0x445b15){_0x1ead01=_0x445b15;_0xd20a9f=0xc8;}else{_0xd20a9f=0xce;}_0x539623[_0xc7a9('0x22')](_0xd20a9f);return _0x539623[_0xc7a9('0x29')](_0xc7a9('0x2a'),_0x574424+'-'+_0x1ead01+'/'+_0x445b15)[_0xc7a9('0x24')](_0x10fe2a);}return null;};}function saveUpdates(_0x5815b4){return function(_0x1ebe4d){if(_0x1ebe4d){return _0x1ebe4d[_0xc7a9('0x2b')](_0x5815b4)['then'](function(_0x1b559d){socket['emit'](_0xc7a9('0x2c')+_0x1b559d['id'],{});return _0x1b559d;});}return null;};}function removeEntity(_0x474a00){return function(_0x2f6845){if(_0x2f6845){return _0x2f6845[_0xc7a9('0x2d')]()[_0xc7a9('0x15')](function(){var _0x562375=_0x2f6845[_0xc7a9('0x2e')]({'plain':!![]});if(_0x562375[_0xc7a9('0x2f')]===_0xc7a9('0x30'))return;var _0x40f98c=[{'name':'Users','value':_0xc7a9('0x31'),'ignore':!![]},{'name':_0xc7a9('0x32'),'value':_0xc7a9('0x33'),'ignore':![]},{'name':_0xc7a9('0x34'),'value':'telephone','ignore':![]}];var _0x2b00be=_(_0x40f98c)['filter'](_0xc7a9('0x35'))[_0xc7a9('0x36')](_0xc7a9('0x37'))[_0xc7a9('0x37')]();if(_[_0xc7a9('0x38')](_0x2b00be,_0x562375[_0xc7a9('0x2f')])){return;}var _0x5e44ff=_['find'](_0x40f98c,[_0xc7a9('0x37'),_0x562375[_0xc7a9('0x2f')]])['name'];return db[_0xc7a9('0x39')][_0xc7a9('0x2d')]({'where':{'type':_0x5e44ff,'resourceId':_0x562375['id']}})[_0xc7a9('0x15')](function(){return _0x2f6845;});})[_0xc7a9('0x15')](function(){_0x474a00[_0xc7a9('0x22')](0xcc)[_0xc7a9('0x23')]();});}};}function handleEntityNotFound(_0x2f4090){return function(_0x377abb){if(!_0x377abb){_0x2f4090[_0xc7a9('0x21')](0x194);}return _0x377abb;};}function handleError(_0x46ac40,_0x57357f){_0x57357f=_0x57357f||0x1f4;return function(_0x54120e){logger[_0xc7a9('0x1b')](_0x54120e[_0xc7a9('0x3a')]);if(_0x54120e[_0xc7a9('0x3b')]){delete _0x54120e['name'];}_0x46ac40['status'](_0x57357f)[_0xc7a9('0x3c')](_0x54120e);};}exports[_0xc7a9('0x3d')]=function(_0x55b08d,_0x493713){var _0x41d71a={},_0x988240={'count':0x0,'rows':[]};var _0x44dc7f=_(db[_0xc7a9('0x3e')][_0xc7a9('0x3f')])[_0xc7a9('0x36')](function(_0x5c1727){return{'name':_0x5c1727['fieldName'],'type':_0x5c1727['type'][_0xc7a9('0x40')]};})[_0xc7a9('0x41')](function(_0x18808b){return!_[_0xc7a9('0x38')]([_0xc7a9('0x42'),_0xc7a9('0x43')],_0x18808b['name']);})['value']();_0x41d71a=qs[_0xc7a9('0x44')](_0x44dc7f,_0x55b08d);var _0x59dfaa={'where':_0x41d71a['where']};return db['User'][_0xc7a9('0x27')](_0x59dfaa)[_0xc7a9('0x15')](function(_0x2961b4){_0x988240['count']=_0x2961b4;if(_0x55b08d['query'][_0xc7a9('0x45')]){_0x41d71a[_0xc7a9('0x46')]=[{'all':!![]}];}if(_0x55b08d[_0xc7a9('0x47')]['userSetting']===_0xc7a9('0x48')){_0x41d71a['include']=[{'model':db['UserSetting'],'as':_0xc7a9('0x49')}];}if(!_['includes'](_0x41d71a[_0xc7a9('0x4a')],'id')){_0x41d71a[_0xc7a9('0x4a')]['push']('id');}return db[_0xc7a9('0x3e')]['findAll'](_0x41d71a);})['then'](function(_0x3a0507){_0x988240[_0xc7a9('0x4b')]=_0x3a0507;if(_0x55b08d[_0xc7a9('0x47')][_0xc7a9('0x4c')]===_0xc7a9('0x48')){var _0x55dcdb=[];for(var _0x447561=0x0;_0x447561<_0x988240[_0xc7a9('0x4b')][_0xc7a9('0x4d')];_0x447561++){_0x55dcdb[_0xc7a9('0x4e')](get_open_tabs('chat',_0x988240['rows'][_0x447561]['dataValues']));_0x55dcdb[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x4f'),_0x988240[_0xc7a9('0x4b')][_0x447561][_0xc7a9('0x50')]));_0x55dcdb[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x51'),_0x988240[_0xc7a9('0x4b')][_0x447561][_0xc7a9('0x50')]));_0x55dcdb['push'](get_open_tabs(_0xc7a9('0x52'),_0x988240[_0xc7a9('0x4b')][_0x447561][_0xc7a9('0x50')]));_0x55dcdb[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x53'),_0x988240[_0xc7a9('0x4b')][_0x447561][_0xc7a9('0x50')]));_0x55dcdb['push'](get_open_tabs(_0xc7a9('0x54'),_0x988240[_0xc7a9('0x4b')][_0x447561][_0xc7a9('0x50')]));}return BPromise['all'](_0x55dcdb)[_0xc7a9('0x15')](function(){return _0x988240;});}else{return _0x988240;}})[_0xc7a9('0x15')](respondWithFilteredResult(_0x493713,_0x41d71a))['catch'](handleError(_0x493713,null));};exports[_0xc7a9('0x55')]=function(_0x11ca1e,_0x54466b){var _0x11795f={'raw':![],'where':{'id':_0x11ca1e[_0xc7a9('0x56')]['id']}},_0x19480c={};_0x19480c[_0xc7a9('0x57')]=_[_0xc7a9('0x58')](_[_0xc7a9('0x59')](db[_0xc7a9('0x3e')]['rawAttributes']),['password',_0xc7a9('0x43')]);_0x19480c[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0x11ca1e[_0xc7a9('0x47')]);_0x19480c[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x19480c[_0xc7a9('0x57')],_0x19480c[_0xc7a9('0x47')]);_0x11795f[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x19480c['model'],qs[_0xc7a9('0x5c')](_0x11ca1e[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x11795f[_0xc7a9('0x4a')]=_0x11795f['attributes']['length']?_0x11795f['attributes']:_0x19480c[_0xc7a9('0x57')];if(_0x11ca1e[_0xc7a9('0x47')][_0xc7a9('0x45')]){_0x11795f['include']=[{'all':!![]}];}if(_0x11ca1e[_0xc7a9('0x47')]['userSetting']===_0xc7a9('0x48')){_0x11795f[_0xc7a9('0x46')]=[{'model':db[_0xc7a9('0x5d')],'as':_0xc7a9('0x49')}];}_0x11795f=_[_0xc7a9('0x5e')]({},_0x11795f,_0x11ca1e[_0xc7a9('0x5f')]);if(!_[_0xc7a9('0x38')](_0x11795f[_0xc7a9('0x4a')],'id')){_0x11795f['attributes'][_0xc7a9('0x4e')]('id');}return db['User']['find'](_0x11795f)[_0xc7a9('0x15')](handleEntityNotFound(_0x54466b,null))[_0xc7a9('0x15')](function(_0x3b30bc){var _0x10b3df=[];values=_0x3b30bc;if(_0x11ca1e['query'][_0xc7a9('0x4c')]===_0xc7a9('0x48')){_0x10b3df['push'](get_open_tabs('chat',_0x3b30bc['dataValues']));_0x10b3df[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x4f'),_0x3b30bc['dataValues']));_0x10b3df[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x53'),_0x3b30bc[_0xc7a9('0x50')]));_0x10b3df[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x54'),_0x3b30bc['dataValues']));_0x10b3df[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x51'),_0x3b30bc[_0xc7a9('0x50')]));_0x10b3df[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x52'),_0x3b30bc['dataValues']));return BPromise[_0xc7a9('0x60')](_0x10b3df);}else{return values;}})['then'](function(){return values;})[_0xc7a9('0x15')](respondWithResult(_0x54466b,null))['catch'](handleError(_0x54466b,null));};exports[_0xc7a9('0x2b')]=function(_0x34e4ac,_0x206f3c){if(_0x34e4ac[_0xc7a9('0x61')]['id']){delete _0x34e4ac['body']['id'];}delete _0x34e4ac[_0xc7a9('0x61')][_0xc7a9('0x2f')];return db[_0xc7a9('0x3e')]['find']({'where':{'id':_0x34e4ac['params']['id']}})['then'](handleEntityNotFound(_0x206f3c,null))[_0xc7a9('0x15')](saveUpdates(_0x34e4ac['body'],null))[_0xc7a9('0x15')](respondWithResult(_0x206f3c,null))['catch'](handleError(_0x206f3c,null));};exports[_0xc7a9('0x62')]=function(_0x3b04bf,_0x24e936){return db[_0xc7a9('0x3e')][_0xc7a9('0x62')]()['then'](respondWithResult(_0x24e936,null))[_0xc7a9('0x20')](handleError(_0x24e936,null));};exports[_0xc7a9('0x63')]=function(_0x16aa32,_0xc8cda5){return db[_0xc7a9('0x3e')][_0xc7a9('0x64')]({'where':{'id':_0x16aa32[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0xc8cda5,null))[_0xc7a9('0x15')](function(_0x3302ee){if(_0x3302ee){return _0x3302ee[_0xc7a9('0x63')](_0x16aa32[_0xc7a9('0x61')][_0xc7a9('0x65')],_[_0xc7a9('0x66')](_0x16aa32['body'],['ids','id'])||{});}})[_0xc7a9('0x15')](respondWithResult(_0xc8cda5,null))['catch'](handleError(_0xc8cda5,null));};function validateUser(_0x5df9d1){return new BPromise(function(_0x273edf,_0x3756fc){if(_0x5df9d1[_0xc7a9('0x67')])return _0x273edf(_0x5df9d1);return db[_0xc7a9('0x68')][_0xc7a9('0x69')](0x1)['then'](function(_0x749256){if(_0x749256[_0xc7a9('0x6a')])authService[_0xc7a9('0x6b')](_0x5df9d1[_0xc7a9('0x42')]);db[_0xc7a9('0x3e')]['max'](_0xc7a9('0x67'))[_0xc7a9('0x15')](function(_0x99ea65){if(_[_0xc7a9('0x6c')](_0x99ea65)){_0x5df9d1[_0xc7a9('0x67')]=_0x749256[_0xc7a9('0x6d')]||0x1;return;}if(_['isNil'](_0x749256[_0xc7a9('0x6d')])||_0x749256[_0xc7a9('0x6d')]===_0x99ea65){_0x5df9d1['internal']=_0x99ea65+0x1;return;}if(_0x749256[_0xc7a9('0x6d')]>_0x99ea65){_0x5df9d1[_0xc7a9('0x67')]=_0x749256[_0xc7a9('0x6d')];return;}return db['sequelize'][_0xc7a9('0x47')](_0xc7a9('0x6e'),{'type':db[_0xc7a9('0x6f')][_0xc7a9('0x70')][_0xc7a9('0x71')]})[_0xc7a9('0x15')](function(_0x1b03f9){if(_0x1b03f9&&_0x1b03f9[_0xc7a9('0x4d')]){for(var _0x17e774=0x0,_0x12c6ab=_0x1b03f9[_0xc7a9('0x4d')];_0x17e774<_0x12c6ab&&_[_0xc7a9('0x6c')](_0x5df9d1[_0xc7a9('0x67')]);_0x17e774++){if(_0x749256[_0xc7a9('0x6d')]<=_0x1b03f9[_0x17e774][_0xc7a9('0x72')]){_0x5df9d1[_0xc7a9('0x67')]=_0x1b03f9[_0x17e774][_0xc7a9('0x72')];}else if(_0x749256[_0xc7a9('0x6d')]>_0x1b03f9[_0x17e774][_0xc7a9('0x72')]&&_0x749256[_0xc7a9('0x6d')]<=_0x1b03f9[_0x17e774]['to']){_0x5df9d1[_0xc7a9('0x67')]=_0x749256[_0xc7a9('0x6d')];}}}if(_[_0xc7a9('0x6c')](_0x5df9d1[_0xc7a9('0x67')])){_0x5df9d1[_0xc7a9('0x67')]=_0x99ea65+0x1;}return _0x273edf(_0x5df9d1);});});})[_0xc7a9('0x20')](function(_0x164039){_0x3756fc(_0x164039);});});}function updateUser(_0x1f588c){return new BPromise(function(_0x14d825,_0x4c1b6c){try{if(_0x1f588c[_0xc7a9('0x73')]){_0x1f588c[_0xc7a9('0x74')]=_0x1f588c[_0xc7a9('0x67')];_0x1f588c[_0xc7a9('0x75')]={'mailbox':_0x1f588c['internal'],'password':_0x1f588c[_0xc7a9('0x42')],'fullname':_0x1f588c[_0xc7a9('0x76')],'email':_0x1f588c[_0xc7a9('0x77')]};}if(_0x1f588c['role']===_0xc7a9('0x33')){if(!_0x1f588c[_0xc7a9('0x78')])_0x1f588c['permissions']=[_0xc7a9('0x79'),_0xc7a9('0x7a'),_0xc7a9('0x7b'),_0xc7a9('0x7c'),_0xc7a9('0x7d'),_0xc7a9('0x7e'),'105',_0xc7a9('0x7f'),_0xc7a9('0x80'),_0xc7a9('0x81'),_0xc7a9('0x82'),'100',_0xc7a9('0x83'),_0xc7a9('0x84'),'115'];}_0x14d825(_0x1f588c);}catch(_0x509ee3){_0x4c1b6c(_0x509ee3);}});}exports[_0xc7a9('0x85')]=function(_0xee8b0c,_0x13dfa9){if(_0xee8b0c[_0xc7a9('0x31')]['role']==='agent')throw new Error(_0xc7a9('0x86'));if(_0xee8b0c[_0xc7a9('0x61')][_0xc7a9('0x2f')]===_0xc7a9('0x31')&&_0xee8b0c['user']['role']!=='admin'){throw new Error(_0xc7a9('0x87'));}if(_0xee8b0c[_0xc7a9('0x61')]['role']===_0xc7a9('0x30')&&_0xee8b0c[_0xc7a9('0x31')]['role']!==_0xc7a9('0x30')){throw new Error(_0xc7a9('0x88'));}return licenseUtil[_0xc7a9('0x89')]([_0xee8b0c['body']])[_0xc7a9('0x15')](function(){return validateUser(_0xee8b0c[_0xc7a9('0x61')]);})[_0xc7a9('0x15')](function(_0x56d685){return updateUser(_0x56d685)['then'](function(_0xc590f2){if(_0xc590f2[_0xc7a9('0x2f')]===_0xc7a9('0x30')){_0xc590f2['settingsEnabled']=_0xee8b0c[_0xc7a9('0x31')][_0xc7a9('0x8a')];delete _0xc590f2[_0xc7a9('0x8b')];}return _0xc590f2;});})['then'](function(_0x2a6638){return db[_0xc7a9('0x3e')][_0xc7a9('0x85')](_0x2a6638,{'include':[{'model':db[_0xc7a9('0x75')],'as':_0xc7a9('0x75')}]});})[_0xc7a9('0x15')](function(_0x1c8dbd){if(_0xee8b0c[_0xc7a9('0x61')][_0xc7a9('0x2f')]==='user')return _0x1c8dbd;if(_0xee8b0c[_0xc7a9('0x31')][_0xc7a9('0x2f')]!=='user')return _0x1c8dbd;return db['UserProfileSection'][_0xc7a9('0x64')]({'where':{'name':_0x1c8dbd[_0xc7a9('0x2f')]===_0xc7a9('0x33')?'Agents':_0xc7a9('0x34'),'userProfileId':_0xee8b0c['user'][_0xc7a9('0x8b')]},'raw':!![]})[_0xc7a9('0x15')](function(_0x534dd4){if(!_0x534dd4||_0x534dd4[_0xc7a9('0x8c')]!=0x0)return _0x1c8dbd;return db[_0xc7a9('0x39')][_0xc7a9('0x85')]({'name':_0x1c8dbd[_0xc7a9('0x3b')],'resourceId':_0x1c8dbd['id'],'type':_0x534dd4[_0xc7a9('0x3b')],'sectionId':_0x534dd4['id']},{})['then'](function(){return _0x1c8dbd;});})[_0xc7a9('0x20')](function(_0x1d6824){logger[_0xc7a9('0x1b')](_0xc7a9('0x8d'),_0x1d6824);throw _0x1d6824;});})[_0xc7a9('0x15')](respondWithResult(_0x13dfa9,0xc9))['catch'](handleError(_0x13dfa9,null));};exports[_0xc7a9('0x8e')]=function(_0x195aad,_0x44e429){var _0x400509=_0x195aad[_0xc7a9('0x61')];var _0x24d090=[];if(_0x195aad[_0xc7a9('0x31')]['role']===_0xc7a9('0x33'))throw new Error(_0xc7a9('0x86'));if(_[_0xc7a9('0x8f')](_0x400509,[_0xc7a9('0x2f'),_0xc7a9('0x31')])&&_0x195aad['user'][_0xc7a9('0x2f')]!==_0xc7a9('0x30')){throw new Error(_0xc7a9('0x87'));}if(_[_0xc7a9('0x8f')](_0x400509,[_0xc7a9('0x2f'),'admin'])&&_0x195aad['user'][_0xc7a9('0x2f')]!==_0xc7a9('0x30')){throw new Error(_0xc7a9('0x90'));}return licenseUtil['checkUserLimits'](_0x400509)[_0xc7a9('0x15')](function(){return validateUser(_0x400509[0x0]);})[_0xc7a9('0x15')](function(){for(var _0x36f38e=0x1;_0x36f38e<_0x400509['length'];_0x36f38e++){var _0x44130a=_0x400509[_0x36f38e-0x1]['internal'];if(!_0x400509[_0x36f38e][_0xc7a9('0x67')])_0x400509[_0x36f38e][_0xc7a9('0x67')]=_0x44130a+0x1;_0x24d090[_0xc7a9('0x4e')](validateUser(_0x400509[_0x36f38e]));}return BPromise[_0xc7a9('0x60')](_0x24d090);})[_0xc7a9('0x15')](function(){_0x24d090=[];for(var _0x78cbdc=0x0;_0x78cbdc<_0x400509[_0xc7a9('0x4d')];_0x78cbdc++){_0x24d090[_0xc7a9('0x4e')](updateUser(_0x400509[_0x78cbdc]));}return BPromise['all'](_0x24d090);})[_0xc7a9('0x15')](function(){return BPromise[_0xc7a9('0x91')](_0x400509,function(_0x495970){return db['User']['create'](_0x495970,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0xc7a9('0x15')](function(_0x4b063e){_0x495970['id']=_0x4b063e['id'];return _0x495970;});});})[_0xc7a9('0x15')](function(_0x1a6431){if(_0x195aad[_0xc7a9('0x61')][_0xc7a9('0x2f')]===_0xc7a9('0x31'))return _0x1a6431;if(_0x195aad['user'][_0xc7a9('0x2f')]!=='user')return _0x1a6431;var _0x2372c5=_['some'](_0x1a6431,function(_0x1ab4d5){return _0x1ab4d5['role']===_0xc7a9('0x33')||_0x1ab4d5[_0xc7a9('0x2f')]===_0xc7a9('0x92');});if(!_0x2372c5)return _0x1a6431;return db[_0xc7a9('0x93')]['findAll']({'where':{'name':{'$or':[_0xc7a9('0x32'),_0xc7a9('0x34')]},'userProfileId':_0x195aad[_0xc7a9('0x31')][_0xc7a9('0x8b')]},'raw':!![]})['then'](function(_0x142856){if(_[_0xc7a9('0x94')](_0x142856)||!_[_0xc7a9('0x8f')](_0x142856,['autoAssociation',0x0]))return _0x1a6431;_0x24d090=[];var _0x43e689=_(_0x142856)[_0xc7a9('0x36')](function(_0x1d403a){if(_0x1d403a[_0xc7a9('0x8c')]===0x1)return;return _0x1d403a[_0xc7a9('0x3b')]===_0xc7a9('0x32')?_0xc7a9('0x33'):'telephone';})[_0xc7a9('0x95')]()['value']();for(var _0x2c868=0x0;_0x2c868<_0x1a6431['length'];_0x2c868++){if(!_[_0xc7a9('0x38')](_0x43e689,_0x1a6431[_0x2c868][_0xc7a9('0x2f')]))return;var _0x70bca2=_0x1a6431[_0x2c868][_0xc7a9('0x2f')]===_0xc7a9('0x33')?_0xc7a9('0x32'):'Telephones';_0x24d090[_0xc7a9('0x4e')](db['UserProfileResource']['create']({'name':_0x1a6431[_0x2c868][_0xc7a9('0x3b')],'resourceId':_0x1a6431[_0x2c868]['id'],'type':_0x70bca2,'sectionId':_['find'](_0x142856,[_0xc7a9('0x3b'),_0x70bca2])['id']},{}));}return BPromise['all'](_0x24d090);});})[_0xc7a9('0x15')](respondWithResult(_0x44e429,0xc9))['catch'](handleError(_0x44e429,null));};exports['changePassword']=function(_0x593a39,_0x5cf306){if(_0x593a39[_0xc7a9('0x61')]['id']){delete _0x593a39[_0xc7a9('0x61')]['id'];}return db['User'][_0xc7a9('0x64')]({'where':{'id':_0x593a39[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](function(_0x3f5b3b){if(!_0x3f5b3b)return null;if(_0x3f5b3b['id']===_0x593a39[_0xc7a9('0x31')]['id']){if(!_0x593a39['body'][_0xc7a9('0x96')]||!_0x593a39[_0xc7a9('0x61')][_0xc7a9('0x97')]){throw new db[(_0xc7a9('0x98'))][(_0xc7a9('0x99'))](_0xc7a9('0x9a'));}if(!_0x3f5b3b[_0xc7a9('0x9b')](_0x593a39[_0xc7a9('0x61')][_0xc7a9('0x96')])){throw new db[(_0xc7a9('0x98'))][(_0xc7a9('0x99'))](_0xc7a9('0x9c'));}if(_0x593a39['body'][_0xc7a9('0x96')]===_0x593a39[_0xc7a9('0x61')]['newPassword']){throw new db[(_0xc7a9('0x98'))][(_0xc7a9('0x99'))](_0xc7a9('0x9d'));}}else if(_0x593a39['user']['role']===_0xc7a9('0x30')){if(!_0x593a39[_0xc7a9('0x61')][_0xc7a9('0x97')]){throw new db[(_0xc7a9('0x98'))][(_0xc7a9('0x99'))](_0xc7a9('0x9e'));}}else if(_0x593a39[_0xc7a9('0x31')][_0xc7a9('0x2f')]===_0xc7a9('0x31')){if(!_0x593a39[_0xc7a9('0x61')][_0xc7a9('0x97')]){throw new db['Sequelize'][(_0xc7a9('0x99'))](_0xc7a9('0x9e'));}if(_0x3f5b3b[_0xc7a9('0x2f')]!=='agent'){throw new db['Sequelize'][(_0xc7a9('0x99'))](_0xc7a9('0x86'));}}else{throw new db['Sequelize'][(_0xc7a9('0x99'))](_0xc7a9('0x86'));}return _0x3f5b3b;})['then'](handleEntityNotFound(_0x5cf306,null))['then'](function(_0x4aab65){return db[_0xc7a9('0x68')][_0xc7a9('0x9f')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x51cbb9){if(_0x51cbb9[_0xc7a9('0x6a')])authService[_0xc7a9('0x6b')](_0x593a39['body'][_0xc7a9('0x97')]);if(!_0x51cbb9[_0xc7a9('0xa0')]||!_0x4aab65[_0xc7a9('0xa1')])return _0x4aab65;authService[_0xc7a9('0xa2')](_0x593a39['body'][_0xc7a9('0x97')],_0x4aab65['previousPasswords'],_0x51cbb9[_0xc7a9('0xa3')]);return _0x4aab65;})['then'](saveUpdates({'password':_0x593a39[_0xc7a9('0x61')][_0xc7a9('0x97')],'passwordResetAt':_0x593a39[_0xc7a9('0x31')]['id']==_0x593a39[_0xc7a9('0x56')]['id']?moment():null,'previousPasswords':authService[_0xc7a9('0xa4')](_0x593a39['body'][_0xc7a9('0x97')],_0x4aab65['previousPasswords'])},null));})[_0xc7a9('0x15')](respondWithResult(_0x5cf306,null))[_0xc7a9('0x20')](handleError(_0x5cf306,null));};exports[_0xc7a9('0xa5')]=function(_0x4d41df,_0x315ebc){var _0x3594ec=_0x4d41df[_0xc7a9('0x61')][_0xc7a9('0xa6')];return db[_0xc7a9('0x3e')][_0xc7a9('0x64')]({'where':{'id':_0x4d41df['params']['id']},'attributes':['id','name','role',_0xc7a9('0xa7'),'loginInPause',_0xc7a9('0xa8'),_0xc7a9('0xa9')]})[_0xc7a9('0x15')](handleEntityNotFound(_0x315ebc,null))[_0xc7a9('0x15')](function(_0x22c01c){if(_0x22c01c){if(!utils[_0xc7a9('0xaa')](_0x3594ec)){throw new db[(_0xc7a9('0x98'))]['ValidationError'](_0xc7a9('0xab'));}return _0x22c01c[_0xc7a9('0xac')+_[_0xc7a9('0xad')](_0x3594ec['toLowerCase']())+'Queues'](_0x4d41df['body']['ids'],{'penalty':_0x4d41df[_0xc7a9('0x61')][_0xc7a9('0xae')]||0x0})[_0xc7a9('0xaf')](function(_0x497bd8){for(var _0x1f705b=0x0;_0x1f705b<_0x4d41df[_0xc7a9('0x61')]['ids']['length'];_0x1f705b+=0x1){var _0x12cfa0={'UserId':Number(_0x4d41df[_0xc7a9('0x56')]['id'])};_0x12cfa0[_[_0xc7a9('0xad')](_0x3594ec[_0xc7a9('0xb0')]())+_0xc7a9('0xb1')]=Number(_0x4d41df['body'][_0xc7a9('0x65')][_0x1f705b]);socket[_0xc7a9('0xb2')](_0xc7a9('0x31')+_['capitalize'](_0x3594ec[_0xc7a9('0xb0')]())+_0xc7a9('0xb3'),_0x12cfa0);}return _0x497bd8;})[_0xc7a9('0x15')](function(){if(_0x3594ec==='voice'){return db[_0xc7a9('0xb4')]['findAll']({'where':{'id':_0x4d41df['body'][_0xc7a9('0x65')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xc7a9('0x15')](function(_0x149e16){var _0x58d199=_0x22c01c[_0xc7a9('0x2e')]({'plain':!![]});var _0x1d334f=[];if(_0x3594ec===_0xc7a9('0xb5')&&_0x58d199[_0xc7a9('0x2f')]===_0xc7a9('0x33')&&_0x58d199[_0xc7a9('0xa7')]){for(var _0x5be058=0x0;_0x5be058<_0x149e16[_0xc7a9('0x4d')];_0x5be058+=0x1){_0x1d334f['push']({'membername':_0x58d199[_0xc7a9('0x3b')],'UserId':_0x58d199['id'],'queue_name':_0x149e16[_0x5be058]['name'],'VoiceQueueId':_0x149e16[_0x5be058]['id'],'interface':_[_0xc7a9('0x6c')](_0x58d199[_0xc7a9('0xa9')])?util[_0xc7a9('0xb6')](_0xc7a9('0xb7'),_0x58d199[_0xc7a9('0x3b')]):_0x58d199[_0xc7a9('0xa9')],'paused':_0x58d199[_0xc7a9('0xa8')]||![],'penalty':_0x4d41df[_0xc7a9('0x61')]['penalty']||0x0});}return BPromise[_0xc7a9('0x91')](_0x1d334f,function(_0x14454f){return db[_0xc7a9('0xb8')][_0xc7a9('0xb9')](_0x14454f);});}return _0x22c01c;});}})[_0xc7a9('0x15')](respondWithStatusCode(_0x315ebc,null))[_0xc7a9('0x20')](handleError(_0x315ebc,null));};exports[_0xc7a9('0xba')]=function(_0x3bf639,_0x597f8e){var _0xcc7ec7,_0x177b95;return db[_0xc7a9('0x3e')]['find']({'where':{'id':_0x3bf639['params']['id']},'attributes':['id',_0xc7a9('0x3b'),_0xc7a9('0x2f')]})[_0xc7a9('0x15')](handleEntityNotFound(_0x597f8e,null))[_0xc7a9('0x15')](function(_0x74fe63){if(_0x74fe63){_0xcc7ec7=_0x74fe63;if(!_0x3bf639[_0xc7a9('0x47')]['channel']||!utils[_0xc7a9('0xaa')](_0x3bf639['query'][_0xc7a9('0xa6')])){throw new db[(_0xc7a9('0x98'))][(_0xc7a9('0x99'))](_0xc7a9('0xab'));}return _0x74fe63[_0xc7a9('0xbb')+_[_0xc7a9('0xad')](_0x3bf639[_0xc7a9('0x47')]['channel'][_0xc7a9('0xb0')]())+'Queues'](_0x3bf639[_0xc7a9('0x47')][_0xc7a9('0x65')]);}})[_0xc7a9('0x15')](function(_0x5f22b8){if(_['isArray'](_0x3bf639[_0xc7a9('0x47')]['ids'])){for(var _0x2dffd0=0x0;_0x2dffd0<_0x3bf639['query'][_0xc7a9('0x65')][_0xc7a9('0x4d')];_0x2dffd0+=0x1){_0x177b95={'UserId':Number(_0x3bf639['params']['id'])};_0x177b95[_['capitalize'](_0x3bf639[_0xc7a9('0x47')][_0xc7a9('0xa6')][_0xc7a9('0xb0')]())+_0xc7a9('0xb1')]=Number(_0x3bf639[_0xc7a9('0x47')]['ids'][_0x2dffd0]);socket[_0xc7a9('0xb2')](_0xc7a9('0x31')+_[_0xc7a9('0xad')](_0x3bf639[_0xc7a9('0x47')][_0xc7a9('0xa6')]['toLowerCase']())+_0xc7a9('0xbc'),_0x177b95);}}else{_0x177b95={'UserId':Number(_0x3bf639[_0xc7a9('0x56')]['id'])};_0x177b95[_['capitalize'](_0x3bf639['query'][_0xc7a9('0xa6')][_0xc7a9('0xb0')]())+_0xc7a9('0xb1')]=Number(_0x3bf639[_0xc7a9('0x47')][_0xc7a9('0x65')]);socket['emit'](_0xc7a9('0x31')+_[_0xc7a9('0xad')](_0x3bf639[_0xc7a9('0x47')]['channel'][_0xc7a9('0xb0')]())+_0xc7a9('0xbc'),_0x177b95);}return _0x5f22b8;})['then'](function(){if(_0x3bf639['query']['channel']===_0xc7a9('0xb5')){return db[_0xc7a9('0xb8')][_0xc7a9('0x2d')]({'where':{'UserId':_0x3bf639['params']['id'],'VoiceQueueId':_0x3bf639[_0xc7a9('0x47')][_0xc7a9('0x65')]},'individualHooks':!![]})['then'](function(){return _0xcc7ec7;});}return _0xcc7ec7;})[_0xc7a9('0x15')](respondWithStatusCode(_0x597f8e,null))[_0xc7a9('0x20')](handleError(_0x597f8e,null));};exports[_0xc7a9('0xbd')]=function(_0x2bc96e,_0xbb8f8d){_0x2bc96e[_0xc7a9('0x61')][_0xc7a9('0xbe')]=_0x2bc96e[_0xc7a9('0xbf')][_0xc7a9('0xc0')];return db['User']['find']({'where':{'id':_0x2bc96e[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0xbb8f8d,null))['then'](saveUpdates(_0x2bc96e['body'],null))[_0xc7a9('0x15')](respondWithResult(_0xbb8f8d,null))[_0xc7a9('0x20')](handleError(_0xbb8f8d,null));};exports[_0xc7a9('0xc1')]=function(_0x54cbc5,_0x350a9d){var _0x65b2c2=path['join'](config[_0xc7a9('0xc2')],_0xc7a9('0xc3'));return db['User']['find']({'where':{'id':_0x54cbc5[_0xc7a9('0x56')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xc7a9('0x15')](handleEntityNotFound(_0x350a9d,null))[_0xc7a9('0x15')](function(_0x21f966){if(_0x21f966){if(_['isNil'](_0x21f966[_0xc7a9('0xbe')])){return _0x350a9d[_0xc7a9('0xc4')](_0x65b2c2);}else{if(!fs[_0xc7a9('0xc5')](path[_0xc7a9('0xc6')](config[_0xc7a9('0xc2')],_0xc7a9('0xc7'),_0x21f966['userpic']))){return _0x350a9d[_0xc7a9('0xc4')](_0x65b2c2);}return _0x350a9d[_0xc7a9('0xc4')](path[_0xc7a9('0xc6')](config['root'],'server/files/images/',_0x21f966['userpic']));}}})['catch'](handleError(_0x350a9d,null));};exports[_0xc7a9('0xc8')]=function(_0x362581,_0x119ee2){return db[_0xc7a9('0x3e')][_0xc7a9('0x64')]({'where':{'id':_0x362581[_0xc7a9('0x56')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x119ee2,null))[_0xc7a9('0x15')](function(_0x5327ac){var _0x21d74b=[];values=_0x5327ac['dataValues'];_0x21d74b[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0xc9'),_0x5327ac[_0xc7a9('0x50')]));_0x21d74b['push'](get_open_tabs(_0xc7a9('0x4f'),_0x5327ac['dataValues']));_0x21d74b[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x53'),_0x5327ac[_0xc7a9('0x50')]));_0x21d74b['push'](get_open_tabs(_0xc7a9('0x54'),_0x5327ac[_0xc7a9('0x50')]));_0x21d74b[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x51'),_0x5327ac[_0xc7a9('0x50')]));_0x21d74b[_0xc7a9('0x4e')](get_open_tabs(_0xc7a9('0x52'),_0x5327ac['dataValues']));return BPromise[_0xc7a9('0x60')](_0x21d74b);})[_0xc7a9('0x15')](function(_0x9020f2){if(_0x9020f2){var _0x2cc53c=_[_0xc7a9('0x36')](values[_0xc7a9('0xca')],function(_0x5b184c){return{'channel':_0xc7a9('0xcb'),'id':_0x5b184c['id'],'createdAt':_0x5b184c[_0xc7a9('0xcc')]};});var _0x7a33e7=_[_0xc7a9('0x36')](values[_0xc7a9('0xcd')],function(_0x5517bf){return{'channel':'FAX','id':_0x5517bf['id'],'createdAt':_0x5517bf[_0xc7a9('0xcc')]};});var _0x30fc14=_[_0xc7a9('0x36')](values[_0xc7a9('0xce')],function(_0x518a57){return{'channel':_0xc7a9('0xcf'),'id':_0x518a57['id'],'createdAt':_0x518a57[_0xc7a9('0xcc')]};});var _0x50dff6=_[_0xc7a9('0x36')](values[_0xc7a9('0xd0')],function(_0xf88647){return{'channel':'MAIL','id':_0xf88647['id'],'createdAt':_0xf88647['createdAt']};});var _0x5b253e=_[_0xc7a9('0x36')](values[_0xc7a9('0xd1')],function(_0x360cf3){return{'channel':_0xc7a9('0xd2'),'id':_0x360cf3['id'],'createdAt':_0x360cf3[_0xc7a9('0xcc')]};});var _0x3b8009=_[_0xc7a9('0x36')](values[_0xc7a9('0xd3')],function(_0x1cf5f6){return{'channel':_0xc7a9('0xd4'),'id':_0x1cf5f6['id'],'createdAt':_0x1cf5f6[_0xc7a9('0xcc')]};});var _0x287b36=_[_0xc7a9('0xd5')](_0x2cc53c,_0x7a33e7,_0x30fc14,_0x50dff6,_0x5b253e,_0x3b8009);var _0x26a231={'count':_0x287b36['length'],'rows':_0x287b36};return _0x26a231;}else return null;})['then'](respondWithResult(_0x119ee2,null))[_0xc7a9('0x20')](handleError(_0x119ee2,null));};exports[_0xc7a9('0xd6')]=function(_0x13a5ae,_0x4ea6cf){var _0x534832={};var _0x22e882={};var _0x45344e;var _0x510823;return db[_0xc7a9('0x3e')]['findOne']({'where':{'id':_0x13a5ae[_0xc7a9('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ea6cf,null))[_0xc7a9('0x15')](function(_0x51613c){if(_0x51613c){_0x45344e=_0x51613c;_0x22e882['model']=_[_0xc7a9('0x59')](db['CmContact'][_0xc7a9('0x3f')]);_0x22e882['query']=_[_0xc7a9('0x59')](_0x13a5ae[_0xc7a9('0x47')]);_0x22e882[_0xc7a9('0x5a')]=_['intersection'](_0x22e882['model'],_0x22e882[_0xc7a9('0x47')]);_0x534832[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x22e882[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x13a5ae['query'][_0xc7a9('0x5c')]));_0x534832['attributes']=_0x534832['attributes'][_0xc7a9('0x4d')]?_0x534832[_0xc7a9('0x4a')]:_0x22e882[_0xc7a9('0x57')];_0x534832['order']=qs[_0xc7a9('0xd7')](_0x13a5ae['query'][_0xc7a9('0xd7')]);_0x534832['where']=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x13a5ae[_0xc7a9('0x47')],_0x22e882['filters']));if(_0x13a5ae[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x534832[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x534832['where'],{'$or':_[_0xc7a9('0x36')](_0x534832['attributes'],function(_0x4f61b3){var _0x117814={};_0x117814[_0x4f61b3]={'$like':'%'+_0x13a5ae['query'][_0xc7a9('0x41')]+'%'};return _0x117814;})});}_0x534832=_[_0xc7a9('0x5e')]({},_0x534832,_0x13a5ae[_0xc7a9('0x5f')]);return _0x45344e[_0xc7a9('0xd6')](_0x534832);}})[_0xc7a9('0x15')](function(_0x40a568){if(_0x40a568){_0x510823=_0x40a568[_0xc7a9('0x4d')];if(_0x13a5ae[_0xc7a9('0x47')]['hasOwnProperty'](_0xc7a9('0x45'))){_0x534832[_0xc7a9('0x46')]=[{'model':db['CmList'],'as':_0xc7a9('0xda'),'required':![]},{'model':db[_0xc7a9('0xdb')],'as':'Tags','attributes':['id',_0xc7a9('0x3b'),'color'],'where':_0x13a5ae[_0xc7a9('0x47')][_0xc7a9('0xdc')]?{'id':_0x13a5ae[_0xc7a9('0x47')][_0xc7a9('0xdc')]}:undefined,'required':_0x13a5ae[_0xc7a9('0x47')][_0xc7a9('0xdc')]?!![]:![]}];}if(!_0x13a5ae['query'][_0xc7a9('0xdd')](_0xc7a9('0xde'))){_0x534832[_0xc7a9('0x26')]=qs['limit'](_0x13a5ae[_0xc7a9('0x47')][_0xc7a9('0x26')]);_0x534832[_0xc7a9('0x28')]=qs['offset'](_0x13a5ae[_0xc7a9('0x47')]['offset']);}return _0x45344e['getContacts'](_0x534832);}})['then'](function(_0x39bd44){if(_0x39bd44){return _0x39bd44?{'count':_0x510823,'rows':_0x39bd44}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x4ea6cf,null))[_0xc7a9('0x20')](handleError(_0x4ea6cf,null));};exports[_0xc7a9('0xdf')]=function(_0x4486b1,_0x1d74cb){var _0x5de54f;var _0x4becc5={};var _0x4c12d2;return db[_0xc7a9('0x3e')]['findOne']({'where':{'id':_0x4486b1[_0xc7a9('0x56')]['id']},'attributes':['id',_0xc7a9('0x3b'),_0xc7a9('0x2f')]})[_0xc7a9('0x15')](handleEntityNotFound(_0x1d74cb,null))[_0xc7a9('0x15')](function(_0xdcdc5d){if(!utils[_0xc7a9('0xaa')](_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0xa6')])){throw new db[(_0xc7a9('0x98'))]['ValidationError']('Unknown\x20channel');}_0x5de54f=_0xdcdc5d;var _0x202615={};_0x202615[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_[_0xc7a9('0xad')](_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0xa6')])+'Queue'][_0xc7a9('0x3f')]);_0x202615[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0x4486b1[_0xc7a9('0x47')]);_0x202615[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x202615[_0xc7a9('0x57')],_0x202615[_0xc7a9('0x47')]);_0x4becc5[_0xc7a9('0x4a')]=_['intersection'](_0x202615[_0xc7a9('0x57')],qs['fields'](_0x4486b1[_0xc7a9('0x47')]['fields']));_0x4becc5['attributes']=_0x4becc5[_0xc7a9('0x4a')][_0xc7a9('0x4d')]?_0x4becc5[_0xc7a9('0x4a')]:_0x202615[_0xc7a9('0x57')];_0x4becc5[_0xc7a9('0xe0')]=qs['sort'](_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0x4becc5['where']=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x4486b1[_0xc7a9('0x47')],_0x202615[_0xc7a9('0x5a')]));if(_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x4becc5[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x4becc5[_0xc7a9('0xd9')],{'$or':_[_0xc7a9('0x36')](_0x4becc5[_0xc7a9('0x4a')],function(_0x5e6791){var _0x5956aa={};_0x5956aa[_0x5e6791]={'$like':'%'+_0x4486b1['query'][_0xc7a9('0x41')]+'%'};return _0x5956aa;})});}_0x4becc5=_['merge']({},_0x4becc5,_0x4486b1[_0xc7a9('0x5f')]);switch(_0x5de54f[_0xc7a9('0x2f')]){case'admin':return db[_['capitalize'](_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0xa6')])+_0xc7a9('0xe1')]['findAll'](_0x4becc5);case _0xc7a9('0x31'):case _0xc7a9('0x33'):return _0x5de54f[_0xc7a9('0x2e')+_[_0xc7a9('0xad')](_0x4486b1[_0xc7a9('0x47')]['channel'])+_0xc7a9('0xe2')](_0x4becc5);default:throw new db[(_0xc7a9('0x98'))][(_0xc7a9('0x99'))](_0xc7a9('0xe3'));}})['then'](function(_0x4a3f42){_0x4c12d2=_0x4a3f42[_0xc7a9('0x4d')];if(!_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0xdd')](_0xc7a9('0xde'))){_0x4becc5[_0xc7a9('0x26')]=qs[_0xc7a9('0x26')](_0x4486b1['query'][_0xc7a9('0x26')]);_0x4becc5[_0xc7a9('0x28')]=qs['offset'](_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0x28')]);}switch(_0x5de54f['role']){case'admin':return db[_[_0xc7a9('0xad')](_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0xa6')])+_0xc7a9('0xe1')][_0xc7a9('0xe4')](_0x4becc5);case _0xc7a9('0x31'):case _0xc7a9('0x33'):return _0x5de54f[_0xc7a9('0x2e')+_[_0xc7a9('0xad')](_0x4486b1[_0xc7a9('0x47')][_0xc7a9('0xa6')])+_0xc7a9('0xe2')](_0x4becc5);}})[_0xc7a9('0x15')](function(_0x431fa4){return{'count':_0x4c12d2,'rows':_0x431fa4};})[_0xc7a9('0x15')](respondWithResult(_0x1d74cb,null))[_0xc7a9('0x20')](handleError(_0x1d74cb,null));};exports['getVoiceQueuesRt']=function(_0x487f78,_0x5389f2){var _0x41a6a0={};var _0x2c37ab={};var _0x116e2b;var _0x28a3d5;return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0x487f78['params']['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x5389f2,null))['then'](function(_0x3345a5){if(_0x3345a5){_0x116e2b=_0x3345a5;_0x2c37ab[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_0xc7a9('0xb8')][_0xc7a9('0x3f')]);_0x2c37ab[_0xc7a9('0x47')]=_['keys'](_0x487f78[_0xc7a9('0x47')]);_0x2c37ab[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x2c37ab[_0xc7a9('0x57')],_0x2c37ab[_0xc7a9('0x47')]);_0x41a6a0['attributes']=_[_0xc7a9('0x5b')](_0x2c37ab[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x487f78[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x41a6a0[_0xc7a9('0x4a')]=_0x41a6a0[_0xc7a9('0x4a')][_0xc7a9('0x4d')]?_0x41a6a0['attributes']:_0x2c37ab[_0xc7a9('0x57')];_0x41a6a0[_0xc7a9('0xe0')]=qs['sort'](_0x487f78[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0x41a6a0[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_['pick'](_0x487f78[_0xc7a9('0x47')],_0x2c37ab['filters']));if(_0x487f78[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x41a6a0[_0xc7a9('0xd9')]=_['merge'](_0x41a6a0[_0xc7a9('0xd9')],{'$or':_[_0xc7a9('0x36')](_0x41a6a0['attributes'],function(_0xe3f541){var _0x17cb86={};_0x17cb86[_0xe3f541]={'$like':'%'+_0x487f78[_0xc7a9('0x47')]['filter']+'%'};return _0x17cb86;})});}_0x41a6a0=_[_0xc7a9('0x5e')]({},_0x41a6a0,_0x487f78[_0xc7a9('0x5f')]);return _0x116e2b['getVoiceQueuesRt'](_0x41a6a0);}})[_0xc7a9('0x15')](function(_0x3f15e3){if(_0x3f15e3){_0x28a3d5=_0x3f15e3['length'];if(!_0x487f78[_0xc7a9('0x47')][_0xc7a9('0xdd')](_0xc7a9('0xde'))){_0x41a6a0[_0xc7a9('0x26')]=qs[_0xc7a9('0x26')](_0x487f78[_0xc7a9('0x47')][_0xc7a9('0x26')]);_0x41a6a0[_0xc7a9('0x28')]=qs['offset'](_0x487f78[_0xc7a9('0x47')][_0xc7a9('0x28')]);}return _0x116e2b[_0xc7a9('0xe5')](_0x41a6a0);}})['then'](function(_0x1e7376){if(_0x1e7376){return _0x1e7376?{'count':_0x28a3d5,'rows':_0x1e7376}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x5389f2,null))[_0xc7a9('0x20')](handleError(_0x5389f2,null));};exports[_0xc7a9('0xe6')]=function(_0x4575ac,_0x2d8f0c){var _0x599e40={};var _0x49c849={};var _0x5adc9e;var _0x36bd6c;return db[_0xc7a9('0x3e')]['findOne']({'where':{'id':_0x4575ac['params']['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x2d8f0c,null))[_0xc7a9('0x15')](function(_0x105614){if(_0x105614){_0x5adc9e=_0x105614;_0x49c849[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_0xc7a9('0xe7')]['rawAttributes']);_0x49c849[_0xc7a9('0x47')]=_['keys'](_0x4575ac['query']);_0x49c849[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x49c849[_0xc7a9('0x57')],_0x49c849[_0xc7a9('0x47')]);_0x599e40[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x49c849[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x4575ac['query'][_0xc7a9('0x5c')]));_0x599e40[_0xc7a9('0x4a')]=_0x599e40[_0xc7a9('0x4a')][_0xc7a9('0x4d')]?_0x599e40['attributes']:_0x49c849[_0xc7a9('0x57')];_0x599e40[_0xc7a9('0xe0')]=qs[_0xc7a9('0xd7')](_0x4575ac[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0x599e40[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x4575ac[_0xc7a9('0x47')],_0x49c849[_0xc7a9('0x5a')]));if(_0x4575ac[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x599e40[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x599e40['where'],{'$or':_[_0xc7a9('0x36')](_0x599e40[_0xc7a9('0x4a')],function(_0x2592a0){var _0x5f4fd3={};_0x5f4fd3[_0x2592a0]={'$like':'%'+_0x4575ac[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x5f4fd3;})});}_0x599e40=_['merge']({},_0x599e40,_0x4575ac[_0xc7a9('0x5f')]);return _0x5adc9e['getGroups'](_0x599e40);}})[_0xc7a9('0x15')](function(_0x3b8b78){if(_0x3b8b78){_0x36bd6c=_0x3b8b78[_0xc7a9('0x4d')];if(!_0x4575ac['query'][_0xc7a9('0xdd')](_0xc7a9('0xde'))){_0x599e40['limit']=qs[_0xc7a9('0x26')](_0x4575ac[_0xc7a9('0x47')]['limit']);_0x599e40[_0xc7a9('0x28')]=qs['offset'](_0x4575ac[_0xc7a9('0x47')][_0xc7a9('0x28')]);}return _0x5adc9e[_0xc7a9('0xe6')](_0x599e40);}})['then'](function(_0x53e974){if(_0x53e974){return _0x53e974?{'count':_0x36bd6c,'rows':_0x53e974}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x2d8f0c,null))[_0xc7a9('0x20')](handleError(_0x2d8f0c,null));};exports[_0xc7a9('0xe8')]=function(_0x111e7d,_0x353726){var _0x4669e2={'raw':!![],'where':{}};var _0x358a6d={};var _0x442054={'count':0x0,'rows':[]};return db['User'][_0xc7a9('0x9f')]({'where':{'id':_0x111e7d[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x353726,null))[_0xc7a9('0x15')](function(_0x4480d0){if(_0x4480d0){_0x358a6d[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_0xc7a9('0xe9')][_0xc7a9('0x3f')]);_0x358a6d[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0x111e7d[_0xc7a9('0x47')]);_0x358a6d[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x358a6d['model'],_0x358a6d['query']);_0x4669e2[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x358a6d[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x111e7d[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x4669e2[_0xc7a9('0x4a')]=_0x4669e2['attributes'][_0xc7a9('0x4d')]?_0x4669e2[_0xc7a9('0x4a')]:_0x358a6d[_0xc7a9('0x57')];if(!_0x111e7d[_0xc7a9('0x47')][_0xc7a9('0xdd')]('nolimit')){_0x4669e2['limit']=qs[_0xc7a9('0x26')](_0x111e7d[_0xc7a9('0x47')][_0xc7a9('0x26')]);_0x4669e2['offset']=qs[_0xc7a9('0x28')](_0x111e7d['query'][_0xc7a9('0x28')]);}_0x4669e2[_0xc7a9('0xe0')]=qs[_0xc7a9('0xd7')](_0x111e7d[_0xc7a9('0x47')]['sort']);_0x4669e2[_0xc7a9('0xd9')]=qs['filters'](_['pick'](_0x111e7d[_0xc7a9('0x47')],_0x358a6d[_0xc7a9('0x5a')]));_0x4669e2['where'][_0xc7a9('0xea')]=_0x4480d0['id'];if(_0x111e7d[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x4669e2[_0xc7a9('0xd9')]=_['merge'](_0x4669e2[_0xc7a9('0xd9')],{'$or':_['map'](_0x4669e2['attributes'],function(_0x2fdaec){var _0x97d3b0={};_0x97d3b0[_0x2fdaec]={'$like':'%'+_0x111e7d[_0xc7a9('0x47')]['filter']+'%'};return _0x97d3b0;})});}_0x4669e2=_[_0xc7a9('0x5e')]({},_0x4669e2,_0x111e7d[_0xc7a9('0x5f')]);return db['VoiceRecording'][_0xc7a9('0x27')]({'where':_0x4669e2[_0xc7a9('0xd9')]})[_0xc7a9('0x15')](function(_0x154948){_0x442054['count']=_0x154948;if(_0x111e7d[_0xc7a9('0x47')][_0xc7a9('0x45')]){_0x4669e2['include']=[{'all':!![]}];}return db[_0xc7a9('0xe9')][_0xc7a9('0xe4')](_0x4669e2);})[_0xc7a9('0x15')](function(_0x1c6209){_0x442054['rows']=_0x1c6209;return _0x442054;});}})[_0xc7a9('0x15')](respondWithFilteredResult(_0x353726,_0x4669e2))[_0xc7a9('0x20')](handleError(_0x353726,null));};exports[_0xc7a9('0xeb')]=function(_0x22df99,_0x2ac378){var _0xee1adc={'raw':!![],'where':{}};var _0x2aa58e={};var _0x1bf877={'count':0x0,'rows':[]};return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0x22df99[_0xc7a9('0x56')]['id']}})['then'](handleEntityNotFound(_0x2ac378,null))[_0xc7a9('0x15')](function(_0x8b2db2){if(_0x8b2db2){_0x2aa58e[_0xc7a9('0x57')]=_['keys'](db[_0xc7a9('0xec')][_0xc7a9('0x3f')]);_0x2aa58e[_0xc7a9('0x47')]=_['keys'](_0x22df99[_0xc7a9('0x47')]);_0x2aa58e[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x2aa58e['model'],_0x2aa58e[_0xc7a9('0x47')]);_0xee1adc[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x2aa58e[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x22df99[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0xee1adc['attributes']=_0xee1adc[_0xc7a9('0x4a')][_0xc7a9('0x4d')]?_0xee1adc[_0xc7a9('0x4a')]:_0x2aa58e[_0xc7a9('0x57')];if(!_0x22df99[_0xc7a9('0x47')][_0xc7a9('0xdd')]('nolimit')){_0xee1adc[_0xc7a9('0x26')]=qs[_0xc7a9('0x26')](_0x22df99['query'][_0xc7a9('0x26')]);_0xee1adc[_0xc7a9('0x28')]=qs['offset'](_0x22df99[_0xc7a9('0x47')][_0xc7a9('0x28')]);}_0xee1adc[_0xc7a9('0xe0')]=qs['sort'](_0x22df99[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0xee1adc[_0xc7a9('0xd9')]=qs['filters'](_[_0xc7a9('0xd8')](_0x22df99[_0xc7a9('0x47')],_0x2aa58e[_0xc7a9('0x5a')]));_0xee1adc[_0xc7a9('0xd9')][_0xc7a9('0xea')]=_0x8b2db2['id'];if(_0x22df99[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0xee1adc[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0xee1adc[_0xc7a9('0xd9')],{'$or':_['map'](_0xee1adc[_0xc7a9('0x4a')],function(_0x245f76){var _0x580435={};_0x580435[_0x245f76]={'$like':'%'+_0x22df99[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x580435;})});}_0xee1adc=_[_0xc7a9('0x5e')]({},_0xee1adc,_0x22df99[_0xc7a9('0x5f')]);return db['ScreenRecording'][_0xc7a9('0x27')]({'where':_0xee1adc['where']})[_0xc7a9('0x15')](function(_0x7f8271){_0x1bf877[_0xc7a9('0x27')]=_0x7f8271;if(_0x22df99['query'][_0xc7a9('0x45')]){_0xee1adc['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0xee1adc);})[_0xc7a9('0x15')](function(_0x450a7e){_0x1bf877['rows']=_0x450a7e;return _0x1bf877;});}})['then'](respondWithFilteredResult(_0x2ac378,_0xee1adc))[_0xc7a9('0x20')](handleError(_0x2ac378,null));};exports[_0xc7a9('0xed')]=function(_0x2fcfb2,_0x1721c6){var _0x4325d3={};var _0xa1cf91={};var _0x59c333;var _0x391a9b;return db[_0xc7a9('0x3e')]['findOne']({'where':{'id':_0x2fcfb2[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x1721c6,null))['then'](function(_0x3e1033){if(_0x3e1033){_0x59c333=_0x3e1033;_0xa1cf91['model']=_[_0xc7a9('0x59')](db[_0xc7a9('0xee')][_0xc7a9('0x3f')]);_0xa1cf91['query']=_[_0xc7a9('0x59')](_0x2fcfb2[_0xc7a9('0x47')]);_0xa1cf91[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0xa1cf91[_0xc7a9('0x57')],_0xa1cf91[_0xc7a9('0x47')]);_0x4325d3['attributes']=_[_0xc7a9('0x5b')](_0xa1cf91[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x2fcfb2[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x4325d3[_0xc7a9('0x4a')]=_0x4325d3[_0xc7a9('0x4a')][_0xc7a9('0x4d')]?_0x4325d3['attributes']:_0xa1cf91[_0xc7a9('0x57')];_0x4325d3['order']=qs[_0xc7a9('0xd7')](_0x2fcfb2[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0x4325d3[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x2fcfb2[_0xc7a9('0x47')],_0xa1cf91['filters']));if(_0x2fcfb2['query'][_0xc7a9('0x41')]){_0x4325d3[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x4325d3[_0xc7a9('0xd9')],{'$or':_[_0xc7a9('0x36')](_0x4325d3[_0xc7a9('0x4a')],function(_0xcdb4c4){var _0x5291cd={};_0x5291cd[_0xcdb4c4]={'$like':'%'+_0x2fcfb2[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x5291cd;})});}_0x4325d3=_[_0xc7a9('0x5e')]({},_0x4325d3,_0x2fcfb2['options']);return _0x59c333['getChatInteractions'](_0x4325d3);}})[_0xc7a9('0x15')](function(_0x31d6db){if(_0x31d6db){_0x391a9b=_0x31d6db['length'];if(!_0x2fcfb2[_0xc7a9('0x47')][_0xc7a9('0xdd')](_0xc7a9('0xde'))){_0x4325d3['limit']=qs[_0xc7a9('0x26')](_0x2fcfb2[_0xc7a9('0x47')][_0xc7a9('0x26')]);_0x4325d3[_0xc7a9('0x28')]=qs[_0xc7a9('0x28')](_0x2fcfb2[_0xc7a9('0x47')][_0xc7a9('0x28')]);}return _0x59c333[_0xc7a9('0xed')](_0x4325d3);}})['then'](function(_0x4fe64a){if(_0x4fe64a){return _0x4fe64a?{'count':_0x391a9b,'rows':_0x4fe64a}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x1721c6,null))[_0xc7a9('0x20')](handleError(_0x1721c6,null));};exports[_0xc7a9('0xef')]=function(_0xc15a39,_0x1a45bf){var _0x3a8902={};var _0x482c89={};var _0x1413a7;var _0x5d687;return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0xc15a39['params']['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x1a45bf,null))[_0xc7a9('0x15')](function(_0x5d1f4e){if(_0x5d1f4e){_0x1413a7=_0x5d1f4e;_0x482c89[_0xc7a9('0x57')]=_['keys'](db[_0xc7a9('0xf0')][_0xc7a9('0x3f')]);_0x482c89[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0xc15a39[_0xc7a9('0x47')]);_0x482c89[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x482c89['model'],_0x482c89[_0xc7a9('0x47')]);_0x3a8902[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x482c89['model'],qs[_0xc7a9('0x5c')](_0xc15a39[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x3a8902['attributes']=_0x3a8902['attributes'][_0xc7a9('0x4d')]?_0x3a8902['attributes']:_0x482c89[_0xc7a9('0x57')];_0x3a8902[_0xc7a9('0xe0')]=qs[_0xc7a9('0xd7')](_0xc15a39['query'][_0xc7a9('0xd7')]);_0x3a8902[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0xc15a39[_0xc7a9('0x47')],_0x482c89[_0xc7a9('0x5a')]));if(_0xc15a39[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x3a8902[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x3a8902[_0xc7a9('0xd9')],{'$or':_['map'](_0x3a8902[_0xc7a9('0x4a')],function(_0x128bea){var _0x2cb34a={};_0x2cb34a[_0x128bea]={'$like':'%'+_0xc15a39[_0xc7a9('0x47')]['filter']+'%'};return _0x2cb34a;})});}_0x3a8902=_[_0xc7a9('0x5e')]({},_0x3a8902,_0xc15a39[_0xc7a9('0x5f')]);return _0x1413a7[_0xc7a9('0xef')](_0x3a8902);}})[_0xc7a9('0x15')](function(_0x569999){if(_0x569999){_0x5d687=_0x569999[_0xc7a9('0x4d')];if(!_0xc15a39[_0xc7a9('0x47')]['hasOwnProperty']('nolimit')){_0x3a8902[_0xc7a9('0x26')]=qs['limit'](_0xc15a39['query'][_0xc7a9('0x26')]);_0x3a8902[_0xc7a9('0x28')]=qs[_0xc7a9('0x28')](_0xc15a39[_0xc7a9('0x47')][_0xc7a9('0x28')]);}return _0x1413a7[_0xc7a9('0xef')](_0x3a8902);}})['then'](function(_0x7fee57){if(_0x7fee57){return _0x7fee57?{'count':_0x5d687,'rows':_0x7fee57}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x1a45bf,null))[_0xc7a9('0x20')](handleError(_0x1a45bf,null));};exports[_0xc7a9('0xf1')]=function(_0x30825e,_0x4445a8){var _0x27f64d={'raw':!![],'where':{}};var _0x4706e0={};var _0x37ad55={'count':0x0,'rows':[]};return db[_0xc7a9('0x3e')]['findOne']({'where':{'id':_0x30825e[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x4445a8,null))[_0xc7a9('0x15')](function(_0x3a4d51){if(_0x3a4d51){_0x4706e0['model']=_[_0xc7a9('0x59')](db[_0xc7a9('0xf2')][_0xc7a9('0x3f')]);_0x4706e0['query']=_[_0xc7a9('0x59')](_0x30825e[_0xc7a9('0x47')]);_0x4706e0['filters']=_[_0xc7a9('0x5b')](_0x4706e0[_0xc7a9('0x57')],_0x4706e0[_0xc7a9('0x47')]);_0x27f64d[_0xc7a9('0x4a')]=_['intersection'](_0x4706e0[_0xc7a9('0x57')],qs['fields'](_0x30825e[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x27f64d[_0xc7a9('0x4a')]=_0x27f64d[_0xc7a9('0x4a')]['length']?_0x27f64d[_0xc7a9('0x4a')]:_0x4706e0[_0xc7a9('0x57')];if(!_0x30825e[_0xc7a9('0x47')][_0xc7a9('0xdd')](_0xc7a9('0xde'))){_0x27f64d['limit']=qs[_0xc7a9('0x26')](_0x30825e['query']['limit']);_0x27f64d['offset']=qs[_0xc7a9('0x28')](_0x30825e[_0xc7a9('0x47')][_0xc7a9('0x28')]);}_0x27f64d[_0xc7a9('0xe0')]=qs[_0xc7a9('0xd7')](_0x30825e[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0x27f64d[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x30825e[_0xc7a9('0x47')],_0x4706e0[_0xc7a9('0x5a')]));_0x27f64d['where']['UserId']=_0x3a4d51['id'];if(_0x30825e[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x27f64d[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x27f64d['where'],{'$or':_[_0xc7a9('0x36')](_0x27f64d[_0xc7a9('0x4a')],function(_0x53354e){var _0x306c6f={};_0x306c6f[_0x53354e]={'$like':'%'+_0x30825e[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x306c6f;})});}_0x27f64d=_[_0xc7a9('0x5e')]({},_0x27f64d,_0x30825e[_0xc7a9('0x5f')]);return db['MailInteraction'][_0xc7a9('0x27')]({'where':_0x27f64d[_0xc7a9('0xd9')]})[_0xc7a9('0x15')](function(_0x107b74){_0x37ad55[_0xc7a9('0x27')]=_0x107b74;if(_0x30825e['query']['includeAll']){_0x27f64d['include']=[{'all':!![]}];}return db[_0xc7a9('0xf2')][_0xc7a9('0xe4')](_0x27f64d);})[_0xc7a9('0x15')](function(_0x22180d){_0x37ad55[_0xc7a9('0x4b')]=_0x22180d;return _0x37ad55;});}})[_0xc7a9('0x15')](respondWithFilteredResult(_0x4445a8,_0x27f64d))['catch'](handleError(_0x4445a8,null));};exports[_0xc7a9('0xf3')]=function(_0x10bca3,_0x432358){var _0x41f4f0={};var _0x54be77={};var _0x5146da;var _0x1c8e67;return db['User']['findOne']({'where':{'id':_0x10bca3[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x432358,null))[_0xc7a9('0x15')](function(_0x49233f){if(_0x49233f){_0x5146da=_0x49233f;_0x54be77[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db['SmsInteraction'][_0xc7a9('0x3f')]);_0x54be77[_0xc7a9('0x47')]=_['keys'](_0x10bca3[_0xc7a9('0x47')]);_0x54be77[_0xc7a9('0x5a')]=_['intersection'](_0x54be77[_0xc7a9('0x57')],_0x54be77[_0xc7a9('0x47')]);_0x41f4f0[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x54be77['model'],qs[_0xc7a9('0x5c')](_0x10bca3[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x41f4f0['attributes']=_0x41f4f0[_0xc7a9('0x4a')]['length']?_0x41f4f0[_0xc7a9('0x4a')]:_0x54be77[_0xc7a9('0x57')];_0x41f4f0[_0xc7a9('0xe0')]=qs['sort'](_0x10bca3['query'][_0xc7a9('0xd7')]);_0x41f4f0[_0xc7a9('0xd9')]=qs['filters'](_[_0xc7a9('0xd8')](_0x10bca3[_0xc7a9('0x47')],_0x54be77[_0xc7a9('0x5a')]));if(_0x10bca3[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x41f4f0['where']=_[_0xc7a9('0x5e')](_0x41f4f0[_0xc7a9('0xd9')],{'$or':_[_0xc7a9('0x36')](_0x41f4f0[_0xc7a9('0x4a')],function(_0x133e88){var _0x50c7f8={};_0x50c7f8[_0x133e88]={'$like':'%'+_0x10bca3[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x50c7f8;})});}_0x41f4f0=_[_0xc7a9('0x5e')]({},_0x41f4f0,_0x10bca3['options']);return _0x5146da[_0xc7a9('0xf3')](_0x41f4f0);}})[_0xc7a9('0x15')](function(_0x5917eb){if(_0x5917eb){_0x1c8e67=_0x5917eb[_0xc7a9('0x4d')];if(!_0x10bca3[_0xc7a9('0x47')]['hasOwnProperty']('nolimit')){_0x41f4f0[_0xc7a9('0x26')]=qs['limit'](_0x10bca3['query']['limit']);_0x41f4f0['offset']=qs[_0xc7a9('0x28')](_0x10bca3[_0xc7a9('0x47')][_0xc7a9('0x28')]);}return _0x5146da[_0xc7a9('0xf3')](_0x41f4f0);}})[_0xc7a9('0x15')](function(_0x467620){if(_0x467620){return _0x467620?{'count':_0x1c8e67,'rows':_0x467620}:null;}})['then'](respondWithResult(_0x432358,null))[_0xc7a9('0x20')](handleError(_0x432358,null));};exports[_0xc7a9('0xf4')]=function(_0x137ad5,_0x1e96ef){var _0x2dc976={};var _0x21d864={};var _0x5c42bf;var _0x5aa8cf;return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0x137ad5[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x1e96ef,null))[_0xc7a9('0x15')](function(_0x2cd0ea){if(_0x2cd0ea){_0x5c42bf=_0x2cd0ea;_0x21d864[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_0xc7a9('0xf5')][_0xc7a9('0x3f')]);_0x21d864[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0x137ad5[_0xc7a9('0x47')]);_0x21d864[_0xc7a9('0x5a')]=_['intersection'](_0x21d864[_0xc7a9('0x57')],_0x21d864[_0xc7a9('0x47')]);_0x2dc976[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x21d864[_0xc7a9('0x57')],qs['fields'](_0x137ad5[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x2dc976[_0xc7a9('0x4a')]=_0x2dc976[_0xc7a9('0x4a')][_0xc7a9('0x4d')]?_0x2dc976[_0xc7a9('0x4a')]:_0x21d864[_0xc7a9('0x57')];_0x2dc976[_0xc7a9('0xe0')]=qs[_0xc7a9('0xd7')](_0x137ad5[_0xc7a9('0x47')]['sort']);_0x2dc976[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x137ad5[_0xc7a9('0x47')],_0x21d864['filters']));if(_0x137ad5[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x2dc976['where']=_[_0xc7a9('0x5e')](_0x2dc976['where'],{'$or':_[_0xc7a9('0x36')](_0x2dc976[_0xc7a9('0x4a')],function(_0x477ba3){var _0x4de776={};_0x4de776[_0x477ba3]={'$like':'%'+_0x137ad5[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x4de776;})});}_0x2dc976=_[_0xc7a9('0x5e')]({},_0x2dc976,_0x137ad5[_0xc7a9('0x5f')]);return _0x5c42bf['getFaxInteractions'](_0x2dc976);}})['then'](function(_0x3373a8){if(_0x3373a8){_0x5aa8cf=_0x3373a8[_0xc7a9('0x4d')];if(!_0x137ad5[_0xc7a9('0x47')]['hasOwnProperty']('nolimit')){_0x2dc976['limit']=qs[_0xc7a9('0x26')](_0x137ad5[_0xc7a9('0x47')][_0xc7a9('0x26')]);_0x2dc976[_0xc7a9('0x28')]=qs[_0xc7a9('0x28')](_0x137ad5['query'][_0xc7a9('0x28')]);}return _0x5c42bf[_0xc7a9('0xf4')](_0x2dc976);}})['then'](function(_0x279957){if(_0x279957){return _0x279957?{'count':_0x5aa8cf,'rows':_0x279957}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x1e96ef,null))['catch'](handleError(_0x1e96ef,null));};exports[_0xc7a9('0xf6')]=function(_0x48ae0d,_0x7420af){var _0x1396ff={};var _0x234240={};var _0x34ecb5;var _0x1b4b83;return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0x48ae0d[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x7420af,null))[_0xc7a9('0x15')](function(_0x4aff7e){if(_0x4aff7e){_0x34ecb5=_0x4aff7e;_0x234240[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_0xc7a9('0xf7')][_0xc7a9('0x3f')]);_0x234240['query']=_[_0xc7a9('0x59')](_0x48ae0d[_0xc7a9('0x47')]);_0x234240[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x234240[_0xc7a9('0x57')],_0x234240[_0xc7a9('0x47')]);_0x1396ff['attributes']=_[_0xc7a9('0x5b')](_0x234240[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x48ae0d['query'][_0xc7a9('0x5c')]));_0x1396ff[_0xc7a9('0x4a')]=_0x1396ff[_0xc7a9('0x4a')]['length']?_0x1396ff[_0xc7a9('0x4a')]:_0x234240[_0xc7a9('0x57')];_0x1396ff[_0xc7a9('0xe0')]=qs[_0xc7a9('0xd7')](_0x48ae0d[_0xc7a9('0x47')]['sort']);_0x1396ff[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x48ae0d[_0xc7a9('0x47')],_0x234240[_0xc7a9('0x5a')]));if(_0x48ae0d[_0xc7a9('0x47')]['filter']){_0x1396ff[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x1396ff['where'],{'$or':_[_0xc7a9('0x36')](_0x1396ff[_0xc7a9('0x4a')],function(_0x4f95e9){var _0x397e05={};_0x397e05[_0x4f95e9]={'$like':'%'+_0x48ae0d[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x397e05;})});}_0x1396ff=_[_0xc7a9('0x5e')]({},_0x1396ff,_0x48ae0d[_0xc7a9('0x5f')]);return _0x34ecb5['getWhatsappInteractions'](_0x1396ff);}})[_0xc7a9('0x15')](function(_0x33785f){if(_0x33785f){_0x1b4b83=_0x33785f[_0xc7a9('0x4d')];if(!_0x48ae0d[_0xc7a9('0x47')]['hasOwnProperty'](_0xc7a9('0xde'))){_0x1396ff[_0xc7a9('0x26')]=qs[_0xc7a9('0x26')](_0x48ae0d['query'][_0xc7a9('0x26')]);_0x1396ff['offset']=qs[_0xc7a9('0x28')](_0x48ae0d['query'][_0xc7a9('0x28')]);}return _0x34ecb5['getWhatsappInteractions'](_0x1396ff);}})['then'](function(_0x361d4f){if(_0x361d4f){return _0x361d4f?{'count':_0x1b4b83,'rows':_0x361d4f}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x7420af,null))['catch'](handleError(_0x7420af,null));};exports['login']=function(_0x12d569,_0xc5f120,_0x210d83){var _0x38cf35;var _0x17285f;var _0x461454;var _0x154131=!_[_0xc7a9('0x6c')](_0x12d569[_0xc7a9('0x56')]['id'])?_0x12d569[_0xc7a9('0x56')]['id']:!_[_0xc7a9('0x6c')](_0x12d569[_0xc7a9('0x31')]['id'])?_0x12d569['user']['id']:null;return db[_0xc7a9('0x3e')][_0xc7a9('0x64')]({'where':{'id':_0x154131,'role':{'$or':[_0xc7a9('0x30'),'user',_0xc7a9('0x33')]}},'attributes':['id','name',_0xc7a9('0xf8'),_0xc7a9('0xf9'),_0xc7a9('0x2f'),_0xc7a9('0x67'),_0xc7a9('0xfa')]})[_0xc7a9('0x15')](function(_0x222df1){if(_0x222df1){if(_0x222df1['role']===_0xc7a9('0x33')){_0x38cf35=_0x222df1;if(_0x12d569['body'][_0xc7a9('0xa9')]){_0x461454=util['format'](_0xc7a9('0xfb'),_0x38cf35[_0x12d569['body']['interface']]);}else if(_0x12d569[_0xc7a9('0x61')][_0xc7a9('0xfc')]){_0x461454=util['format'](_0xc7a9('0xb7'),_0x12d569[_0xc7a9('0x61')][_0xc7a9('0xfc')]);}else{_0x461454=util[_0xc7a9('0xb6')](_0xc7a9('0xb7'),_0x38cf35[_0xc7a9('0x3b')]);}socket['to'](util[_0xc7a9('0xb6')](_0xc7a9('0xfd'),_0x38cf35[_0xc7a9('0x3b')]))[_0xc7a9('0xb2')](_0xc7a9('0xfe'),{'user':{'id':_0x38cf35['id'],'name':_0x38cf35[_0xc7a9('0x3b')]},'ip':_0x12d569[_0xc7a9('0xff')][_0xc7a9('0x100')]||_0x12d569['connection'][_0xc7a9('0x101')]||_0x12d569['socket'][_0xc7a9('0x101')]||_0x12d569[_0xc7a9('0x102')][_0xc7a9('0x103')][_0xc7a9('0x101')]});return db[_0xc7a9('0xb8')]['destroy']({'where':{'membername':_0x38cf35[_0xc7a9('0x3b')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xc7a9('0x99'))](_0xc7a9('0x104'));}})['then'](function(){if(_0x38cf35){return _0x38cf35[_0xc7a9('0x105')]({'raw':!![]});}})[_0xc7a9('0x15')](function(_0x186984){if(_0x38cf35){var _0x464ea1=[];if(_0x186984){_0x17285f=_0x186984;if(_0x17285f['length']){for(var _0x414e75=0x0;_0x414e75<_0x17285f[_0xc7a9('0x4d')];_0x414e75++){_0x464ea1[_0xc7a9('0x4e')]({'membername':_0x38cf35['name'],'UserId':_0x38cf35['id'],'queue_name':_0x17285f[_0x414e75][_0xc7a9('0x3b')],'VoiceQueueId':_0x17285f[_0x414e75]['id'],'interface':_0x461454,'paused':_0x38cf35[_0xc7a9('0xfa')]||![],'penalty':_0x17285f[_0x414e75]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x464ea1,function(_0x5e4c8b){return db[_0xc7a9('0xb8')][_0xc7a9('0xb9')](_0x5e4c8b);});}}}})[_0xc7a9('0x15')](function(){if(_0x38cf35){return db[_0xc7a9('0x106')][_0xc7a9('0xe4')]({'where':{'membername':_0x38cf35[_0xc7a9('0x3b')],'exitAt':null}});}})[_0xc7a9('0x15')](function(_0x371b92){if(_0x38cf35){var _0x470531=[];_0x371b92[_0xc7a9('0x107')](function(_0x1febb8){_0x470531[_0xc7a9('0x4e')](_0x1febb8['update']({'exitAt':moment()[_0xc7a9('0xb6')](_0xc7a9('0x108'))}));});return BPromise['all'](_0x470531);}})[_0xc7a9('0x15')](function(){if(_0x38cf35){var _0x1425d2=[];var _0x4ee725=[];var _0x4469a8=utils['getChannels']();var _0x189eb5={'membername':_0x38cf35[_0xc7a9('0x3b')],'interface':_0x461454,'enterAt':moment()[_0xc7a9('0xb6')](_0xc7a9('0x108')),'role':_0x38cf35['role'],'internal':_0x38cf35[_0xc7a9('0x67')]};_0x4469a8[_0xc7a9('0x107')](function(_0x17d7d9){_0x1425d2['push'](_[_0xc7a9('0x5e')]({'channel':_0x17d7d9,'type':_0xc7a9('0x109'),'data1':_0x12d569['body'][_0xc7a9('0x10a')],'data2':_0x461454},_0x189eb5));if(_0x38cf35['loginInPause']){_0x4ee725[_0xc7a9('0x4e')](_[_0xc7a9('0x5e')]({'channel':_0x17d7d9,'type':'PAUSE','data1':'LOGININPAUSE'},_0x189eb5));}});return db[_0xc7a9('0x106')][_0xc7a9('0x8e')](_0x1425d2[_0xc7a9('0xd5')](_0x4ee725),{'individualHooks':!![]});}})[_0xc7a9('0x15')](function(){if(_0x38cf35){return _0x38cf35['update']({'online':!![],'lastLoginAt':moment()['format'](_0xc7a9('0x108')),'voicePause':_0x38cf35[_0xc7a9('0xfa')]||![],'mailPause':_0x38cf35['loginInPause']||![],'chatPause':_0x38cf35[_0xc7a9('0xfa')]||![],'faxPause':_0x38cf35[_0xc7a9('0xfa')]||![],'smsPause':_0x38cf35[_0xc7a9('0xfa')]||![],'openchannelPause':_0x38cf35[_0xc7a9('0xfa')]||![],'whatsappPause':_0x38cf35['loginInPause']||![],'pauseType':_0x38cf35[_0xc7a9('0xfa')]?_0xc7a9('0x10b'):null,'interface':_0x461454,'lastPauseAt':moment()['format'](_0xc7a9('0x108'))});}})['then'](function(_0x44a457){if(_0x12d569[_0xc7a9('0x10c')]){return _0x210d83();}else{return BPromise[_0xc7a9('0x10d')](_0x44a457)[_0xc7a9('0x15')](respondWithResult(_0xc5f120,null));}})['catch'](handleError(_0xc5f120,null));};exports[_0xc7a9('0x10e')]=function(_0x362e10,_0x47f58b){var _0x33c4c9;return db[_0xc7a9('0x3e')][_0xc7a9('0x64')]({'where':{'id':_0x362e10['params']['id'],'role':_0xc7a9('0x33')},'attributes':['id',_0xc7a9('0x3b'),'role']})[_0xc7a9('0x15')](handleEntityNotFound(_0x47f58b,null))[_0xc7a9('0x15')](function(_0x1f112a){if(_0x1f112a){_0x33c4c9=_0x1f112a;return db[_0xc7a9('0xb8')][_0xc7a9('0x2d')]({'where':{'membername':_0x33c4c9[_0xc7a9('0x3b')]},'individualHooks':!![]});}})[_0xc7a9('0x15')](function(){return db[_0xc7a9('0x106')][_0xc7a9('0xe4')]({'where':{'membername':_0x33c4c9['name'],'exitAt':null}});})[_0xc7a9('0x15')](function(_0x563bf0){var _0x1f516d=[];_0x563bf0[_0xc7a9('0x107')](function(_0xbc7090){_0x1f516d[_0xc7a9('0x4e')](_0xbc7090['update']({'exitAt':moment()[_0xc7a9('0xb6')](_0xc7a9('0x108'))}));});return BPromise[_0xc7a9('0x60')](_0x1f516d);})[_0xc7a9('0x15')](function(){return _0x33c4c9[_0xc7a9('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xc7a9('0x15')](respondWithResult(_0x47f58b,null))[_0xc7a9('0x20')](handleError(_0x47f58b,null));};exports[_0xc7a9('0x10f')]=function(_0x3c873d,_0x5cf393){var _0x204e4c;return db[_0xc7a9('0xb8')][_0xc7a9('0x2b')]({'paused':0x1},{'where':{'UserId':_0x3c873d['params']['id']},'individualHooks':!![]})[_0xc7a9('0x15')](function(){return db['User'][_0xc7a9('0x64')]({'where':{'id':_0x3c873d[_0xc7a9('0x56')]['id'],'role':'agent'},'attributes':['id',_0xc7a9('0x3b'),_0xc7a9('0x2f'),_0xc7a9('0x67'),_0xc7a9('0xa9')]});})[_0xc7a9('0x15')](handleEntityNotFound(_0x5cf393,null))['then'](function(_0x38df16){if(_0x38df16){_0x204e4c=_0x38df16;return respondWithRpcPromise(_0xc7a9('0x110'),_0xc7a9('0x10f'),{'id':_0x204e4c['id'],'name':_0x204e4c[_0xc7a9('0x3b')],'pause':!![]});}})[_0xc7a9('0x15')](function(){if(_0x204e4c){return db[_0xc7a9('0x106')][_0xc7a9('0xe4')]({'where':{'membername':_0x204e4c['name'],'type':_0xc7a9('0x111'),'exitAt':null}});}})[_0xc7a9('0x15')](function(_0x135bdd){if(_0x135bdd[_0xc7a9('0x4d')]){var _0x105c26=moment()[_0xc7a9('0xb6')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x58fbe2=0x0,_0xb6c1c9=_0x135bdd[_0xc7a9('0x4d')];_0x58fbe2<_0xb6c1c9;_0x58fbe2++){_0x135bdd[_0x58fbe2][_0xc7a9('0x112')]({'exitAt':_0x105c26});}}})[_0xc7a9('0x15')](function(){var _0x251890=[];var _0x4eeb2f=utils[_0xc7a9('0x113')]();_0x4eeb2f['forEach'](function(_0x585d84){_0x251890['push']({'channel':_0x585d84,'membername':_0x204e4c[_0xc7a9('0x3b')],'interface':_[_0xc7a9('0x6c')](_0x204e4c[_0xc7a9('0xa9')])?util[_0xc7a9('0xb6')](_0xc7a9('0xb7'),_0x204e4c[_0xc7a9('0x3b')]):_0x204e4c[_0xc7a9('0xa9')],'type':_0xc7a9('0x111'),'enterAt':moment()[_0xc7a9('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3c873d[_0xc7a9('0x61')][_0xc7a9('0x114')]||_0xc7a9('0x115'),'role':_0x204e4c['role'],'internal':_0x204e4c[_0xc7a9('0x67')]});});return db[_0xc7a9('0x106')][_0xc7a9('0x8e')](_0x251890,{'individualHooks':!![]});})['then'](function(){return _0x204e4c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3c873d['body'][_0xc7a9('0x114')]||_0xc7a9('0x115'),'lastPauseAt':moment()['format'](_0xc7a9('0x108'))});})[_0xc7a9('0x15')](respondWithResult(_0x5cf393,null))[_0xc7a9('0x20')](handleError(_0x5cf393,null));};exports[_0xc7a9('0x116')]=function(_0xcd7a44,_0x254812){var _0x2f4670;return db[_0xc7a9('0x3e')]['find']({'where':{'id':_0xcd7a44[_0xc7a9('0x56')]['id']},'attributes':['id',_0xc7a9('0x3b'),'role',_0xc7a9('0xa8'),_0xc7a9('0x117'),'chatPause',_0xc7a9('0x118'),_0xc7a9('0x119'),_0xc7a9('0x11a'),_0xc7a9('0x11b'),_0xc7a9('0x11c'),_0xc7a9('0x11d')]})[_0xc7a9('0x15')](handleEntityNotFound(_0x254812,null))[_0xc7a9('0x15')](function(_0x39a228){if(_0x39a228){_0x2f4670=_0x39a228;if(_0xcd7a44[_0xc7a9('0x61')][_0xc7a9('0xa6')]&&!utils[_0xc7a9('0xaa')](_0xcd7a44[_0xc7a9('0x61')][_0xc7a9('0xa6')])){throw new db[(_0xc7a9('0x98'))][(_0xc7a9('0x99'))](_0xc7a9('0xab'));}switch(_0xcd7a44[_0xc7a9('0x61')][_0xc7a9('0xa6')]){case _0xc7a9('0xb5'):return respondWithRpcPromise(_0xc7a9('0x110'),_0xc7a9('0x116'),{'id':_0x2f4670['id'],'name':_0x2f4670['name'],'pause':![]})[_0xc7a9('0x15')](function(){return db[_0xc7a9('0xb8')][_0xc7a9('0x2b')]({'paused':0x0},{'where':{'UserId':_0x2f4670['id']},'individualHooks':!![]});})[_0xc7a9('0x15')](function(){return db[_0xc7a9('0x106')][_0xc7a9('0x64')]({'where':{'channel':_0xcd7a44[_0xc7a9('0x61')][_0xc7a9('0xa6')],'membername':_0x2f4670[_0xc7a9('0x3b')],'type':_0xc7a9('0x111'),'exitAt':null}});})[_0xc7a9('0x15')](function(_0x1e5279){if(_0x1e5279){return _0x1e5279[_0xc7a9('0x2b')]({'exitAt':moment()[_0xc7a9('0xb6')](_0xc7a9('0x108')),'data2':_0xc7a9('0x11e')},{'individualHooks':!![]});}return null;})[_0xc7a9('0x15')](function(){return _0x2f4670['update']({'voicePause':![]});});case'mail':case _0xc7a9('0xc9'):case _0xc7a9('0x51'):case'sms':case _0xc7a9('0x54'):case'openchannel':return db[_0xc7a9('0x106')][_0xc7a9('0x64')]({'where':{'channel':_0xcd7a44[_0xc7a9('0x61')][_0xc7a9('0xa6')],'membername':_0x2f4670['name'],'type':_0xc7a9('0x111'),'exitAt':null}})['then'](function(_0x43edfa){if(_0x43edfa){return _0x43edfa[_0xc7a9('0x2b')]({'exitAt':moment()[_0xc7a9('0xb6')](_0xc7a9('0x108')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xc7a9('0x15')](function(){var _0x51b903={};_[_0xc7a9('0x29')](_0x51b903,util[_0xc7a9('0xb6')](_0xc7a9('0x11f'),_0xcd7a44[_0xc7a9('0x61')][_0xc7a9('0xa6')],'Pause'),![]);return _0x2f4670[_0xc7a9('0x2b')](_0x51b903);});default:return respondWithRpcPromise(_0xc7a9('0x110'),_0xc7a9('0x116'),{'id':_0x2f4670['id'],'name':_0x2f4670[_0xc7a9('0x3b')],'pause':![]})[_0xc7a9('0x15')](function(){return db['UserVoiceQueueRt'][_0xc7a9('0x2b')]({'paused':0x0},{'where':{'UserId':_0x2f4670['id']}});})['then'](function(){return db[_0xc7a9('0x106')][_0xc7a9('0xe4')]({'where':{'membername':_0x2f4670[_0xc7a9('0x3b')],'type':_0xc7a9('0x111'),'exitAt':null}});})[_0xc7a9('0x15')](function(_0x5ec988){var _0x6b29bd=[];_0x5ec988[_0xc7a9('0x107')](function(_0x654f3){_0x6b29bd[_0xc7a9('0x4e')](_0x654f3['update']({'exitAt':moment()[_0xc7a9('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise[_0xc7a9('0x60')](_0x6b29bd);})[_0xc7a9('0x15')](function(){return _0x2f4670[_0xc7a9('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xc7a9('0x15')](respondWithResult(_0x254812,null))[_0xc7a9('0x20')](handleError(_0x254812,null));};exports[_0xc7a9('0x120')]=function(_0x4075ef,_0x4274c7){var _0x1b1264={};var _0x3dca21={};var _0x53872c;var _0x244f41;return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0x4075ef[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x4274c7,null))[_0xc7a9('0x15')](function(_0xd417fc){if(_0xd417fc){_0x53872c=_0xd417fc;_0x3dca21[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_0xc7a9('0x121')][_0xc7a9('0x3f')]);_0x3dca21[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0x4075ef[_0xc7a9('0x47')]);_0x3dca21['filters']=_[_0xc7a9('0x5b')](_0x3dca21[_0xc7a9('0x57')],_0x3dca21[_0xc7a9('0x47')]);_0x1b1264[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x3dca21[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x4075ef[_0xc7a9('0x47')][_0xc7a9('0x5c')]));_0x1b1264[_0xc7a9('0x4a')]=_0x1b1264[_0xc7a9('0x4a')]['length']?_0x1b1264['attributes']:_0x3dca21[_0xc7a9('0x57')];_0x1b1264[_0xc7a9('0xe0')]=qs['sort'](_0x4075ef[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0x1b1264[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_[_0xc7a9('0xd8')](_0x4075ef['query'],_0x3dca21[_0xc7a9('0x5a')]));if(_0x4075ef[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x1b1264[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x1b1264[_0xc7a9('0xd9')],{'$or':_[_0xc7a9('0x36')](_0x1b1264[_0xc7a9('0x4a')],function(_0x305ca8){var _0x2e6418={};_0x2e6418[_0x305ca8]={'$like':'%'+_0x4075ef['query'][_0xc7a9('0x41')]+'%'};return _0x2e6418;})});}_0x1b1264=_[_0xc7a9('0x5e')]({},_0x1b1264,_0x4075ef[_0xc7a9('0x5f')]);return _0x53872c['getTeams'](_0x1b1264);}})[_0xc7a9('0x15')](function(_0x1f050b){if(_0x1f050b){_0x244f41=_0x1f050b[_0xc7a9('0x4d')];if(!_0x4075ef[_0xc7a9('0x47')][_0xc7a9('0xdd')]('nolimit')){_0x1b1264[_0xc7a9('0x26')]=qs['limit'](_0x4075ef[_0xc7a9('0x47')][_0xc7a9('0x26')]);_0x1b1264[_0xc7a9('0x28')]=qs[_0xc7a9('0x28')](_0x4075ef['query'][_0xc7a9('0x28')]);}return _0x53872c[_0xc7a9('0x120')](_0x1b1264);}})[_0xc7a9('0x15')](function(_0x5dfd2d){if(_0x5dfd2d){return _0x5dfd2d?{'count':_0x244f41,'rows':_0x5dfd2d}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x4274c7,null))[_0xc7a9('0x20')](handleError(_0x4274c7,null));};exports[_0xc7a9('0x122')]=function(_0x5166e2,_0x182151){var _0x42ea3b=_0x5166e2[_0xc7a9('0x56')]['id'];var _0x164622=_0x5166e2[_0xc7a9('0x61')]?_0x5166e2[_0xc7a9('0x61')][_0xc7a9('0x65')]:null;var _0x9aec2d=[];return Promise[_0xc7a9('0x10d')]()[_0xc7a9('0x15')](function(){if(!_0x164622)throw new APIBadRequestError(_0xc7a9('0x123'));})[_0xc7a9('0x15')](function(){return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0x42ea3b}});})['then'](function(_0x4f085f){if(!_0x4f085f)throw new APINotFoundError(util[_0xc7a9('0xb6')](_0xc7a9('0x124'),_0x5166e2[_0xc7a9('0x56')]['id']));return db[_0xc7a9('0x6f')][_0xc7a9('0x125')](function(_0x1c8fd1){return _0x4f085f['addTeams'](_0x164622,{'transaction':_0x1c8fd1})[_0xc7a9('0x15')](function(){return db['Team'][_0xc7a9('0xe4')]({'where':{'id':{'$in':_0x164622}}});})[_0xc7a9('0x15')](function(_0x42efe7){var _0x5d1bd3=_['map'](_0x42efe7,function(_0x44fe74){return _0x44fe74[_0xc7a9('0x126')]();});return Promise[_0xc7a9('0x60')](_0x5d1bd3);})[_0xc7a9('0x15')](function(_0x37d377){_0x9aec2d=_[_0xc7a9('0x127')](_0x37d377);var _0x4fbce3=_[_0xc7a9('0x36')](_0x9aec2d,function(_0x15049f){return _0x15049f[_0xc7a9('0x128')](_0x4f085f['id'],{'transaction':_0x1c8fd1});});return Promise[_0xc7a9('0x60')](_0x4fbce3);})['then'](function(){if(!_0x4f085f[_0xc7a9('0xa7')])return;var _0x1c6805=_['filter'](_0x9aec2d,function(_0x1d4301){return _0x1d4301['getDataValue'](_0xc7a9('0xa6'))==='Voice';});var _0x5a6b75=_[_0xc7a9('0x36')](_0x1c6805,function(_0x5c901b){return db[_0xc7a9('0xb8')][_0xc7a9('0xb9')]({'membername':_0x4f085f['name'],'UserId':_0x4f085f['id'],'queue_name':_0x5c901b['name'],'VoiceQueueId':_0x5c901b['id'],'interface':_[_0xc7a9('0x6c')](_0x4f085f[_0xc7a9('0xa9')])?util[_0xc7a9('0xb6')]('SIP/%s',_0x4f085f[_0xc7a9('0x3b')]):_0x4f085f[_0xc7a9('0xa9')],'paused':_0x4f085f[_0xc7a9('0xa8')]||![],'penalty':_0x4f085f[_0xc7a9('0xae')]},{'transaction':_0x1c8fd1});});return Promise['all'](_0x5a6b75);})['then'](function(){return db[_0xc7a9('0x129')]['findAll']({'where':{'teamId':{'$in':_0x164622}}});})[_0xc7a9('0x15')](function(_0x296c38){var _0x45dd72=_[_0xc7a9('0x36')](_0x296c38,function(_0x3e288f){return db[_0xc7a9('0x12a')]['create']({'UserId':_0x4f085f['id'],'VoicePrefixId':_0x3e288f[_0xc7a9('0x12b')]},{'transaction':_0x1c8fd1});});return Promise['all'](_0x45dd72);});});})[_0xc7a9('0x15')](function(){for(var _0x828b1c=0x0;_0x828b1c<_0x9aec2d[_0xc7a9('0x4d')];_0x828b1c++){var _0x3d722a=_0x9aec2d[_0x828b1c]['getDataValue']('channel');var _0x308e67=_0x3d722a+_0xc7a9('0xb1');socket[_0xc7a9('0xb2')](_0xc7a9('0x31')+_0x3d722a+_0xc7a9('0xb3'),{'UserId':_0x42ea3b,['queueField']:_0x9aec2d[_0x828b1c]['id']});}})[_0xc7a9('0x15')](respondWithStatusCode(_0x182151,null))[_0xc7a9('0x20')](APIHandleError(_0x182151));};exports[_0xc7a9('0x12c')]=function(_0x226742,_0x5854f4){var _0x24988f=_0x226742[_0xc7a9('0x56')]['id'];var _0x4c6b38=null;if(_0x226742[_0xc7a9('0x47')][_0xc7a9('0x65')]){_0x4c6b38=_[_0xc7a9('0x12d')](_0x226742['query'][_0xc7a9('0x65')])?_0x226742[_0xc7a9('0x47')][_0xc7a9('0x65')]:[_0x226742['query']['ids']];}var _0x1564f0=[];return Promise['resolve']()[_0xc7a9('0x15')](function(){if(!_0x4c6b38)throw new APIBadRequestError(_0xc7a9('0x12e'));})[_0xc7a9('0x15')](function(){return db[_0xc7a9('0x3e')][_0xc7a9('0x9f')]({'where':{'id':_0x24988f}});})['then'](function(_0x56859f){if(!_0x56859f)throw new APINotFoundError(util[_0xc7a9('0xb6')](_0xc7a9('0x124'),_0x226742[_0xc7a9('0x56')]['id']));return db[_0xc7a9('0x6f')][_0xc7a9('0x125')](function(_0x3f2f0a){return _0x56859f[_0xc7a9('0x12c')](_0x4c6b38,{'transaction':_0x3f2f0a})[_0xc7a9('0x15')](function(){return db[_0xc7a9('0x121')][_0xc7a9('0xe4')]({'where':{'id':{'$in':_0x4c6b38}}});})[_0xc7a9('0x15')](function(_0x1d3eb4){var _0x1d0f11=_['map'](_0x1d3eb4,function(_0x4d61c0){return _0x4d61c0[_0xc7a9('0x126')]();});return Promise['all'](_0x1d0f11);})['then'](function(_0x1b8c92){_0x1564f0=_[_0xc7a9('0x127')](_0x1b8c92);var _0x3d0002=_[_0xc7a9('0x36')](_0x1564f0,function(_0x47dc53){return _0x47dc53[_0xc7a9('0x12f')](_0x56859f['id'],{'transaction':_0x3f2f0a});});return Promise[_0xc7a9('0x60')](_0x3d0002);})[_0xc7a9('0x15')](function(){if(!_0x56859f[_0xc7a9('0xa7')])return;var _0x47325d=_[_0xc7a9('0x41')](_0x1564f0,function(_0x7b45e6){return _0x7b45e6[_0xc7a9('0x130')](_0xc7a9('0xa6'))===_0xc7a9('0x131');});var _0x5c7cd5=_[_0xc7a9('0x36')](_0x47325d,function(_0x175fe8){return db[_0xc7a9('0xb8')][_0xc7a9('0x2d')]({'where':{'VoiceQueueId':_0x175fe8['id'],'UserId':_0x56859f['id']},'transaction':_0x3f2f0a});});return Promise[_0xc7a9('0x60')](_0x5c7cd5);})[_0xc7a9('0x15')](function(){return db['TeamVoicePrefix'][_0xc7a9('0xe4')]({'where':{'teamId':{'$in':_0x4c6b38}}});})['then'](function(_0x14262e){var _0x1d3b60=_['map'](_0x14262e,function(_0x4e413a){return db[_0xc7a9('0x12a')][_0xc7a9('0x2d')]({'where':{'UserId':_0x56859f['id'],'VoicePrefixId':_0x4e413a[_0xc7a9('0x12b')]}},{'transaction':_0x3f2f0a});});return Promise[_0xc7a9('0x60')](_0x1d3b60);});});})[_0xc7a9('0x15')](function(){for(var _0x257d42=0x0;_0x257d42<_0x1564f0['length'];_0x257d42++){var _0x477fc8=_0x1564f0[_0x257d42][_0xc7a9('0x130')](_0xc7a9('0xa6'));var _0xe877d3=_0x477fc8+'QueueId';socket['emit'](_0xc7a9('0x31')+_0x477fc8+_0xc7a9('0xbc'),{'UserId':_0x24988f,['queueField']:_0x1564f0[_0x257d42]['id']});}})[_0xc7a9('0x15')](respondWithStatusCode(_0x5854f4,null))['catch'](APIHandleError(_0x5854f4));};exports['getLists']=function(_0x1732ac,_0x194e65){var _0x4d8952={};var _0x2e3155={};var _0x2f7e0d;var _0x3749c8;return db['User']['findOne']({'where':{'id':_0x1732ac[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x194e65,null))[_0xc7a9('0x15')](function(_0x5f1cd4){if(_0x5f1cd4){_0x2f7e0d=_0x5f1cd4;_0x2e3155[_0xc7a9('0x57')]=_[_0xc7a9('0x59')](db[_0xc7a9('0x132')][_0xc7a9('0x3f')]);_0x2e3155[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0x1732ac['query']);_0x2e3155[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x2e3155['model'],_0x2e3155[_0xc7a9('0x47')]);_0x4d8952[_0xc7a9('0x4a')]=_[_0xc7a9('0x5b')](_0x2e3155[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x1732ac[_0xc7a9('0x47')]['fields']));_0x4d8952['attributes']=_0x4d8952[_0xc7a9('0x4a')][_0xc7a9('0x4d')]?_0x4d8952[_0xc7a9('0x4a')]:_0x2e3155['model'];_0x4d8952[_0xc7a9('0xe0')]=qs[_0xc7a9('0xd7')](_0x1732ac['query'][_0xc7a9('0xd7')]);_0x4d8952['where']=qs[_0xc7a9('0x5a')](_['pick'](_0x1732ac[_0xc7a9('0x47')],_0x2e3155[_0xc7a9('0x5a')]));if(_0x1732ac[_0xc7a9('0x47')][_0xc7a9('0x41')]){_0x4d8952[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x4d8952[_0xc7a9('0xd9')],{'$or':_[_0xc7a9('0x36')](_0x4d8952[_0xc7a9('0x4a')],function(_0x255667){var _0x4b0a0f={};_0x4b0a0f[_0x255667]={'$like':'%'+_0x1732ac[_0xc7a9('0x47')][_0xc7a9('0x41')]+'%'};return _0x4b0a0f;})});}_0x4d8952=_[_0xc7a9('0x5e')]({},_0x4d8952,_0x1732ac[_0xc7a9('0x5f')]);return _0x2f7e0d['getLists'](_0x4d8952);}})[_0xc7a9('0x15')](function(_0x3e3405){if(_0x3e3405){_0x3749c8=_0x3e3405[_0xc7a9('0x4d')];if(!_0x1732ac['query'][_0xc7a9('0xdd')](_0xc7a9('0xde'))){_0x4d8952[_0xc7a9('0x26')]=qs[_0xc7a9('0x26')](_0x1732ac[_0xc7a9('0x47')][_0xc7a9('0x26')]);_0x4d8952['offset']=qs['offset'](_0x1732ac[_0xc7a9('0x47')][_0xc7a9('0x28')]);}return _0x2f7e0d['getLists'](_0x4d8952);}})['then'](function(_0x212cf8){if(_0x212cf8){return _0x212cf8?{'count':_0x3749c8,'rows':_0x212cf8}:null;}})[_0xc7a9('0x15')](respondWithResult(_0x194e65,null))['catch'](handleError(_0x194e65,null));};exports[_0xc7a9('0x133')]=function(_0x20a31f,_0x262028){var _0x1ae40b={};var _0x38f070={};var _0x343347;return db[_0xc7a9('0x3e')]['findOne']({'where':{'id':_0x20a31f[_0xc7a9('0x56')]['id']}})[_0xc7a9('0x15')](handleEntityNotFound(_0x262028,null))[_0xc7a9('0x15')](function(_0x1529f1){if(_0x1529f1){_0x343347=_0x1529f1;_0x38f070[_0xc7a9('0x57')]=_['keys'](db[_0xc7a9('0x3e')]['rawAttributes']);_0x38f070[_0xc7a9('0x47')]=_[_0xc7a9('0x59')](_0x20a31f[_0xc7a9('0x47')]);_0x38f070[_0xc7a9('0x5a')]=_[_0xc7a9('0x5b')](_0x38f070[_0xc7a9('0x57')],_0x38f070[_0xc7a9('0x47')]);_0x1ae40b['attributes']=_[_0xc7a9('0x5b')](_0x38f070[_0xc7a9('0x57')],qs[_0xc7a9('0x5c')](_0x20a31f['query'][_0xc7a9('0x5c')]));_0x1ae40b[_0xc7a9('0x4a')]=_0x1ae40b['attributes'][_0xc7a9('0x4d')]?_0x1ae40b[_0xc7a9('0x4a')]:_0x38f070[_0xc7a9('0x57')];_0x1ae40b['order']=qs[_0xc7a9('0xd7')](_0x20a31f[_0xc7a9('0x47')][_0xc7a9('0xd7')]);_0x1ae40b[_0xc7a9('0xd9')]=qs[_0xc7a9('0x5a')](_['pick'](_0x20a31f[_0xc7a9('0x47')],_0x38f070['filters']));if(_0x20a31f[_0xc7a9('0x47')]['filter']){_0x1ae40b[_0xc7a9('0xd9')]=_[_0xc7a9('0x5e')](_0x1ae40b[_0xc7a9('0xd9')],{'$or':_['map'](_0x1ae40b[_0xc7a9('0x4a')],function(_0x18b4fa){var _0x3926a5={};_0x3926a5[_0x18b4fa]={'$like':'%'+_0x20a31f['query'][_0xc7a9('0x41')]+'%'};return _0x3926a5;})});}_0x1ae40b[_0xc7a9('0x57')]=db['User'];_0x1ae40b['as']=_0xc7a9('0x32');_0x1ae40b=_[_0xc7a9('0x5e')]({},_0x1ae40b,_0x20a31f[_0xc7a9('0x5f')]);return _0x343347[_0xc7a9('0x105')]({'include':[_0x1ae40b]});}})[_0xc7a9('0x15')](function(_0x203902){if(_0x203902){var _0x51b7ec={},_0x13cdf0=[];for(var _0x3a54e6=0x0;_0x3a54e6<_0x203902[_0xc7a9('0x4d')];_0x3a54e6+=0x1){for(var _0x21e135=0x0,_0x506298;_0x21e135<_0x203902[_0x3a54e6][_0xc7a9('0x32')][_0xc7a9('0x4d')];_0x21e135+=0x1){_0x506298=_0x203902[_0x3a54e6][_0xc7a9('0x32')][_0x21e135][_0xc7a9('0x2e')]({'plain':!![]});_0x51b7ec[_0x506298['id']]=_0x506298;}}_0x51b7ec=_['values'](_0x51b7ec);for(var _0x3131ba=qs['offset'](_0x20a31f['query']['offset']);_0x3131ba<_0x51b7ec[_0xc7a9('0x4d')]&&_0x13cdf0[_0xc7a9('0x4d')]=_0x298b32[_0x4140('0x53')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x4140('0x11')](function(){if(_0x2b58f9){return db[_0x4140('0x41')][_0x4140('0x4c')]({'where':{'membername':_0x2b58f9[_0x4140('0x29')]},'individualHooks':!![]});}})[_0x4140('0x11')](function(){if(_0x2b58f9){return _0x2b58f9[_0x4140('0x54')]({'raw':!![]});}})['then'](function(_0x514329){if(_0x2b58f9){if(_0x514329){var _0x1e66cd=[];_0x42375e=_0x514329;if(_0x42375e[_0x4140('0x30')]){for(var _0x1918d0=0x0;_0x1918d0<_0x42375e[_0x4140('0x30')];_0x1918d0++){_0x1e66cd[_0x4140('0x34')](db['UserVoiceQueueRt'][_0x4140('0x55')]({'membername':_0x2b58f9[_0x4140('0x29')],'UserId':_0x2b58f9['id'],'queue_name':_0x42375e[_0x1918d0][_0x4140('0x29')],'VoiceQueueId':_0x42375e[_0x1918d0]['id'],'interface':_0x18ff76,'paused':_0x2b58f9[_0x4140('0x4e')]||![],'penalty':_0x42375e[_0x1918d0][_0x4140('0x56')]||0x0}));}return BPromise[_0x4140('0x4a')](_0x1e66cd);}}}})['then'](function(){if(_0x2b58f9){return db['MemberReport'][_0x4140('0x1e')]({'where':{'membername':_0x2b58f9[_0x4140('0x29')],'exitAt':null}});}})[_0x4140('0x11')](function(_0x4c4359){if(_0x2b58f9){if(_0x4c4359&&_0x4c4359[_0x4140('0x30')]){var _0x50625d=[];_0x4c4359[_0x4140('0x33')](function(_0x2f1eb5){_0x50625d['push'](_0x2f1eb5['update']({'exitAt':moment()[_0x4140('0x31')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4140('0x4a')](_0x50625d);}}})[_0x4140('0x11')](function(_0x5702b3){if(_0x2b58f9){var _0x326b94=[];var _0x17baeb=[];var _0xf0dfbd=utils['getChannels']();var _0x29ed5f={'membername':_0x2b58f9['name'],'interface':_0x18ff76,'enterAt':moment()[_0x4140('0x31')](_0x4140('0x32')),'role':_0x2b58f9[_0x4140('0x2a')],'internal':_0x2b58f9[_0x4140('0x2b')]};_0xf0dfbd['forEach'](function(_0x40d7c8){_0x326b94[_0x4140('0x34')](_['merge']({'channel':_0x40d7c8,'type':_0x4140('0x57'),'data1':_0x4140('0x58'),'data2':_0x18ff76},_0x29ed5f));if(_0x2b58f9[_0x4140('0x4e')]){_0x17baeb[_0x4140('0x34')](_[_0x4140('0x59')]({'channel':_0x40d7c8,'type':_0x4140('0x2f'),'data1':_0x4140('0x5a')},_0x29ed5f));}});return db[_0x4140('0x2e')][_0x4140('0x3b')](_0x326b94[_0x4140('0x5b')](_0x17baeb),{'individualHooks':!![]});}})[_0x4140('0x11')](function(){if(_0x2b58f9){return _0x2b58f9[_0x4140('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x4140('0x31')](_0x4140('0x32')),'voicePause':_0x2b58f9['loginInPause']||![],'mailPause':_0x2b58f9['loginInPause']||![],'chatPause':_0x2b58f9[_0x4140('0x4e')]||![],'faxPause':_0x2b58f9['loginInPause']||![],'smsPause':_0x2b58f9[_0x4140('0x4e')]||![],'openchannelPause':_0x2b58f9['loginInPause']||![],'pauseType':_0x2b58f9[_0x4140('0x4e')]?_0x4140('0x5a'):null,'lastPauseAt':moment()[_0x4140('0x31')](_0x4140('0x32')),'interface':_0x18ff76});}})['then'](function(_0x133fe6){_0x271b9f(_0x133fe6);})[_0x4140('0x1b')](function(_0x1e5eee){_0x2a1227(_0x257ee1[_0x4140('0x17')](0x1f4,_0x1e5eee[_0x4140('0x18')]));});});}; \ No newline at end of file +var _0x43a2=['limit','include','map','model','ShowUser','find','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','format','length','updateAttributes','getChannels','push','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','voice','mail','chat','fax','openchannel','set','%s%s','Pause','forEach','all','LogoutUser','destroy','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','defaults','redis','./user.socket','register','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetUser','User','findAll','options','where','attributes'];(function(_0x29b60d,_0x504278){var _0x3c4a33=function(_0x1f71ef){while(--_0x1f71ef){_0x29b60d['push'](_0x29b60d['shift']());}};_0x3c4a33(++_0x504278);}(_0x43a2,0x95));var _0x243a=function(_0x54cc8e,_0x50f0bc){_0x54cc8e=_0x54cc8e-0x0;var _0x7d80cd=_0x43a2[_0x54cc8e];return _0x7d80cd;};'use strict';var _=require(_0x243a('0x0'));var util=require(_0x243a('0x1'));var moment=require('moment');var BPromise=require(_0x243a('0x2'));var rs=require(_0x243a('0x3'));var fs=require('fs');var Redis=require(_0x243a('0x4'));var db=require(_0x243a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x243a('0x6'))(_0x243a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x243a('0x8')]({'port':0x232a});config['redis']=_[_0x243a('0x9')](config[_0x243a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x243a('0xa')]));require(_0x243a('0xb'))[_0x243a('0xc')](socket);function respondWithRpcPromise(_0x3b3c40,_0x5ed411,_0x350d03){return new BPromise(function(_0x138925,_0x36b351){return client['request'](_0x3b3c40,_0x350d03)[_0x243a('0xd')](function(_0x3639ef){logger[_0x243a('0xe')](_0x243a('0xf'),_0x5ed411,'request\x20sent');logger[_0x243a('0x10')](_0x243a('0x11'),_0x5ed411,_0x243a('0x12'),JSON[_0x243a('0x13')](_0x3639ef));if(_0x3639ef['error']){if(_0x3639ef[_0x243a('0x14')][_0x243a('0x15')]===0x1f4){logger[_0x243a('0x14')]('User,\x20%s,\x20%s',_0x5ed411,_0x3639ef[_0x243a('0x14')][_0x243a('0x16')]);return _0x36b351(_0x3639ef[_0x243a('0x14')][_0x243a('0x16')]);}logger['error'](_0x243a('0xf'),_0x5ed411,_0x3639ef['error'][_0x243a('0x16')]);return _0x138925(_0x3639ef[_0x243a('0x14')][_0x243a('0x16')]);}else{logger[_0x243a('0xe')]('User,\x20%s,\x20%s',_0x5ed411,_0x243a('0x12'));_0x138925(_0x3639ef[_0x243a('0x17')][_0x243a('0x16')]);}})[_0x243a('0x18')](function(_0x1c3f3b){logger[_0x243a('0x14')](_0x243a('0xf'),_0x5ed411,_0x1c3f3b);_0x36b351(_0x1c3f3b);});});}exports[_0x243a('0x19')]=function(_0x3f8f22){var _0xad6fb0=this;return new Promise(function(_0x198bb4,_0x2ba69a){return db[_0x243a('0x1a')][_0x243a('0x1b')]({'raw':_0x3f8f22[_0x243a('0x1c')]?_0x3f8f22[_0x243a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3f8f22['options']?_0x3f8f22[_0x243a('0x1c')][_0x243a('0x1d')]||null:null,'attributes':_0x3f8f22['options']?_0x3f8f22[_0x243a('0x1c')][_0x243a('0x1e')]||null:null,'limit':_0x3f8f22[_0x243a('0x1c')]?_0x3f8f22[_0x243a('0x1c')][_0x243a('0x1f')]||null:null,'include':_0x3f8f22[_0x243a('0x1c')]?_0x3f8f22[_0x243a('0x1c')][_0x243a('0x20')]?_[_0x243a('0x21')](_0x3f8f22[_0x243a('0x1c')][_0x243a('0x20')],function(_0x15c56a){return{'model':db[_0x15c56a[_0x243a('0x22')]],'as':_0x15c56a['as'],'attributes':_0x15c56a[_0x243a('0x1e')],'include':_0x15c56a[_0x243a('0x20')]?_['map'](_0x15c56a[_0x243a('0x20')],function(_0x209b15){return{'model':db[_0x209b15[_0x243a('0x22')]],'as':_0x209b15['as'],'attributes':_0x209b15[_0x243a('0x1e')],'include':_0x209b15[_0x243a('0x20')]?_[_0x243a('0x21')](_0x209b15[_0x243a('0x20')],function(_0x589b0e){return{'model':db[_0x589b0e[_0x243a('0x22')]],'as':_0x589b0e['as'],'attributes':_0x589b0e[_0x243a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfb5bc6){logger['info'](_0x243a('0x19'),_0x3f8f22);logger['debug'](_0x243a('0x19'),_0x3f8f22,JSON['stringify'](_0xfb5bc6));_0x198bb4(_0xfb5bc6);})[_0x243a('0x18')](function(_0x33e513){logger[_0x243a('0x14')](_0x243a('0x19'),_0x33e513[_0x243a('0x16')],_0x3f8f22);_0x2ba69a(_0xad6fb0[_0x243a('0x14')](0x1f4,_0x33e513[_0x243a('0x16')]));});});};exports[_0x243a('0x23')]=function(_0xd7733d){var _0xe2728c=this;return new Promise(function(_0x21022c,_0x10bee4){return db[_0x243a('0x1a')][_0x243a('0x24')]({'raw':_0xd7733d['options']?_0xd7733d[_0x243a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd7733d[_0x243a('0x1c')]?_0xd7733d[_0x243a('0x1c')]['where']||null:null,'attributes':_0xd7733d['options']?_0xd7733d[_0x243a('0x1c')][_0x243a('0x1e')]||null:null,'include':_0xd7733d['options']?_0xd7733d[_0x243a('0x1c')][_0x243a('0x20')]?_['map'](_0xd7733d[_0x243a('0x1c')][_0x243a('0x20')],function(_0x472d0c){return{'model':db[_0x472d0c[_0x243a('0x22')]],'as':_0x472d0c['as'],'attributes':_0x472d0c[_0x243a('0x1e')],'include':_0x472d0c[_0x243a('0x20')]?_['map'](_0x472d0c[_0x243a('0x20')],function(_0x35720f){return{'model':db[_0x35720f[_0x243a('0x22')]],'as':_0x35720f['as'],'attributes':_0x35720f[_0x243a('0x1e')],'include':_0x35720f[_0x243a('0x20')]?_[_0x243a('0x21')](_0x35720f[_0x243a('0x20')],function(_0xadd4f9){return{'model':db[_0xadd4f9['model']],'as':_0xadd4f9['as'],'attributes':_0xadd4f9[_0x243a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x420a50){logger['info'](_0x243a('0x23'),_0xd7733d);logger['debug'](_0x243a('0x23'),_0xd7733d,JSON['stringify'](_0x420a50));_0x21022c(_0x420a50);})['catch'](function(_0xf3b52e){logger[_0x243a('0x14')](_0x243a('0x23'),_0xf3b52e[_0x243a('0x16')],_0xd7733d);_0x10bee4(_0xe2728c[_0x243a('0x14')](0x1f4,_0xf3b52e[_0x243a('0x16')]));});});};exports[_0x243a('0x25')]=function(_0xf5164c){var _0x5011ca=this;return new Promise(function(_0xd7a13d,_0x362f2d){var _0xfc34c;return db[_0x243a('0x1a')][_0x243a('0x24')]({'where':_0xf5164c[_0x243a('0x1c')][_0x243a('0x1d')]||{},'attributes':['id',_0x243a('0x26'),_0x243a('0x27'),_0x243a('0x28'),_0x243a('0x29')]})['then'](function(_0x48c5fa){if(_0x48c5fa){_0xfc34c=_0x48c5fa;return db[_0x243a('0x2a')][_0x243a('0x2b')]({'paused':0x1},{'where':{'UserId':_0xfc34c['id']},'individualHooks':!![]});}})[_0x243a('0xd')](function(){if(_0xfc34c){return db[_0x243a('0x2c')][_0x243a('0x1b')]({'where':{'membername':_0xfc34c[_0x243a('0x26')],'type':_0x243a('0x2d'),'exitAt':null}});}})[_0x243a('0xd')](function(_0x4b2275){if(_0xfc34c){if(_0x4b2275&&_0x4b2275['length']){var _0x2b241e=moment()[_0x243a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x159a7c=0x0,_0xd80c30=_0x4b2275[_0x243a('0x2f')];_0x159a7c<_0xd80c30;_0x159a7c++){_0x4b2275[_0x159a7c][_0x243a('0x30')]({'exitAt':_0x2b241e});}}}})[_0x243a('0xd')](function(){if(_0xfc34c){var _0x43161c=[];var _0x4aa0fa=utils[_0x243a('0x31')]();_0x4aa0fa['forEach'](function(_0x47462e){_0x43161c[_0x243a('0x32')]({'channel':_0x47462e,'membername':_0xfc34c[_0x243a('0x26')],'interface':_[_0x243a('0x33')](_0xfc34c[_0x243a('0x29')])?util[_0x243a('0x2e')](_0x243a('0x34'),_0xfc34c['name']):_0xfc34c[_0x243a('0x29')],'type':_0x243a('0x2d'),'enterAt':moment()[_0x243a('0x2e')](_0x243a('0x35')),'data1':_0xf5164c[_0x243a('0x36')][_0x243a('0x37')]||'DEFAULT\x20PAUSE','role':_0xfc34c['role'],'internal':_0xfc34c[_0x243a('0x28')],'uniqueid':_0xf5164c[_0x243a('0x36')][_0x243a('0x38')]||null});});return db['MemberReport'][_0x243a('0x39')](_0x43161c,{'individualHooks':!![]});}})[_0x243a('0xd')](function(){if(_0xfc34c){return _0xfc34c[_0x243a('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xf5164c[_0x243a('0x36')][_0x243a('0x37')]||_0x243a('0x3a'),'lastPauseAt':moment()['format'](_0x243a('0x35'))});}})[_0x243a('0xd')](function(_0x555b6a){_0xd7a13d(_0x555b6a);})[_0x243a('0x18')](function(_0x21549b){_0x362f2d(_0x5011ca[_0x243a('0x14')](0x1f4,_0x21549b['message']));});});};exports[_0x243a('0x3b')]=function(_0x4c49fd){var _0x5e69d2=this;return new Promise(function(_0x1c3dc4,_0xda66e1){var _0x1bf216;return db['User'][_0x243a('0x3c')]({'where':_0x4c49fd[_0x243a('0x1c')][_0x243a('0x1d')]||{},'attributes':['id',_0x243a('0x26')]})['then'](function(_0xfd6171){if(_0xfd6171){_0x1bf216=_0xfd6171;if(_0x4c49fd[_0x243a('0x36')][_0x243a('0x3d')]&&!utils[_0x243a('0x3e')](_0x4c49fd[_0x243a('0x36')][_0x243a('0x3d')])){throw new Error('Unknown\x20channel');}switch(_0x4c49fd['body'][_0x243a('0x3d')]){case _0x243a('0x3f'):return db[_0x243a('0x2a')][_0x243a('0x2b')]({'paused':0x0},{'where':{'UserId':_0x1bf216['id']}})[_0x243a('0xd')](function(){return db[_0x243a('0x2c')][_0x243a('0x24')]({'where':{'channel':_0x4c49fd[_0x243a('0x36')]['channel'],'membername':_0x1bf216['name'],'type':'PAUSE','exitAt':null}});})[_0x243a('0xd')](function(_0x6481f3){if(_0x6481f3){return _0x6481f3[_0x243a('0x2b')]({'exitAt':moment()[_0x243a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x243a('0xd')](function(){return _0x1bf216[_0x243a('0x2b')]({'voicePause':![]});});case _0x243a('0x40'):case _0x243a('0x41'):case _0x243a('0x42'):case'sms':case _0x243a('0x43'):case'whatsapp':return db['MemberReport'][_0x243a('0x24')]({'where':{'channel':_0x4c49fd[_0x243a('0x36')][_0x243a('0x3d')],'membername':_0x1bf216['name'],'type':_0x243a('0x2d'),'exitAt':null}})['then'](function(_0x2a5432){return _0x2a5432['update']({'exitAt':moment()[_0x243a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0x243a('0xd')](function(){var _0x17141e={};_[_0x243a('0x44')](_0x17141e,util[_0x243a('0x2e')](_0x243a('0x45'),_0x4c49fd[_0x243a('0x36')]['channel'],_0x243a('0x46')),![]);return _0x1bf216[_0x243a('0x2b')](_0x17141e);});default:return db['UserVoiceQueueRt'][_0x243a('0x2b')]({'paused':0x0},{'where':{'UserId':_0x1bf216['id']}})[_0x243a('0xd')](function(){return db[_0x243a('0x2c')][_0x243a('0x1b')]({'where':{'membername':_0x1bf216[_0x243a('0x26')],'type':'PAUSE','exitAt':null}});})['then'](function(_0xff1bd8){var _0x5e45c7=[];_0xff1bd8[_0x243a('0x47')](function(_0x21450f){_0x5e45c7[_0x243a('0x32')](_0x21450f[_0x243a('0x2b')]({'exitAt':moment()[_0x243a('0x2e')](_0x243a('0x35')),'data2':'system'}));});return BPromise[_0x243a('0x48')](_0x5e45c7);})[_0x243a('0xd')](function(){return _0x1bf216[_0x243a('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x243a('0xd')](function(_0x31ebe){_0x1c3dc4(_0x31ebe);})['catch'](function(_0x5e3dbb){_0xda66e1(_0x5e69d2['error'](0x1f4,_0x5e3dbb[_0x243a('0x16')]));});});};exports[_0x243a('0x49')]=function(_0x750683){var _0x1324db=this;return new Promise(function(_0x50be82,_0x2fca35){var _0x4885c9;return db[_0x243a('0x1a')][_0x243a('0x3c')]({'where':_0x750683['options'][_0x243a('0x1d')]||{},'attributes':['id',_0x243a('0x26')]})[_0x243a('0xd')](function(_0x64cfe3){if(_0x64cfe3){_0x4885c9=_0x64cfe3;return db['UserVoiceQueueRt'][_0x243a('0x4a')]({'where':{'membername':_0x4885c9[_0x243a('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x4885c9){return db[_0x243a('0x2c')][_0x243a('0x1b')]({'where':{'membername':_0x4885c9[_0x243a('0x26')],'exitAt':null}});}})[_0x243a('0xd')](function(_0x728c8b){if(_0x4885c9){if(_0x728c8b&&_0x728c8b[_0x243a('0x2f')]){var _0x504981=[];_0x728c8b[_0x243a('0x47')](function(_0x2d63ba){_0x504981[_0x243a('0x32')](_0x2d63ba[_0x243a('0x2b')]({'exitAt':moment()['format'](_0x243a('0x35'))}));});return BPromise[_0x243a('0x48')](_0x504981);}}})[_0x243a('0xd')](function(){if(_0x4885c9){return _0x4885c9[_0x243a('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x243a('0xd')](function(_0x1e2d1a){_0x50be82(_0x1e2d1a);})[_0x243a('0x18')](function(_0x9ef77b){_0x2fca35(_0x1324db[_0x243a('0x14')](0x1f4,_0x9ef77b[_0x243a('0x16')]));});});};exports['LoginUser']=function(_0x1dd626){var _0x3966da=this;return new Promise(function(_0x30735b,_0x9dc5a9){var _0x1840fa;var _0x2432d2;var _0x128819;var _0x429fff;return db[_0x243a('0x1a')][_0x243a('0x3c')]({'where':_0x1dd626[_0x243a('0x1c')][_0x243a('0x1d')]||{},'attributes':['id',_0x243a('0x26'),_0x243a('0x27'),_0x243a('0x4b'),_0x243a('0x4c'),_0x243a('0x28'),_0x243a('0x4d'),_0x243a('0x29')]})[_0x243a('0xd')](function(_0x2f389e){if(_0x2f389e){_0x1840fa=_0x2f389e;_0x429fff=_0x1dd626[_0x243a('0x36')][_0x243a('0x29')]?_0x1dd626['body'][_0x243a('0x29')]:util['format'](_0x243a('0x34'),_0x1840fa[_0x243a('0x26')]);return db[_0x243a('0x1a')][_0x243a('0x4e')]({'where':{'role':_0x243a('0x4f'),'online':!![],'id':{'$ne':_0x1840fa['id']}}});}})[_0x243a('0xd')](function(_0x55527f){if(_0x55527f){_0x128819=_0x55527f;return require(_0x243a('0x50'))[_0x243a('0x51')]();}})[_0x243a('0xd')](function(_0x2c6d4c){if(_0x2c6d4c&&_0x2c6d4c[_0x243a('0x52')]&&_0x128819>=_0x2c6d4c[_0x243a('0x52')]){throw new Error(_0x243a('0x53'));}})['then'](function(){if(_0x1840fa){return db[_0x243a('0x2a')][_0x243a('0x4a')]({'where':{'membername':_0x1840fa['name']},'individualHooks':!![]});}})['then'](function(){if(_0x1840fa){return _0x1840fa[_0x243a('0x54')]({'raw':!![]});}})['then'](function(_0x43d705){if(_0x1840fa){if(_0x43d705){var _0x5e61e5=[];_0x2432d2=_0x43d705;if(_0x2432d2[_0x243a('0x2f')]){for(var _0x1313d5=0x0;_0x1313d5<_0x2432d2[_0x243a('0x2f')];_0x1313d5++){_0x5e61e5['push'](db[_0x243a('0x2a')]['upsert']({'membername':_0x1840fa[_0x243a('0x26')],'UserId':_0x1840fa['id'],'queue_name':_0x2432d2[_0x1313d5][_0x243a('0x26')],'VoiceQueueId':_0x2432d2[_0x1313d5]['id'],'interface':_0x429fff,'paused':_0x1840fa['loginInPause']||![],'penalty':_0x2432d2[_0x1313d5][_0x243a('0x55')]||0x0}));}return BPromise[_0x243a('0x48')](_0x5e61e5);}}}})[_0x243a('0xd')](function(){if(_0x1840fa){return db['MemberReport'][_0x243a('0x1b')]({'where':{'membername':_0x1840fa[_0x243a('0x26')],'exitAt':null}});}})[_0x243a('0xd')](function(_0x57ff6b){if(_0x1840fa){if(_0x57ff6b&&_0x57ff6b[_0x243a('0x2f')]){var _0x10a018=[];_0x57ff6b[_0x243a('0x47')](function(_0x3a2916){_0x10a018[_0x243a('0x32')](_0x3a2916[_0x243a('0x2b')]({'exitAt':moment()[_0x243a('0x2e')](_0x243a('0x35'))}));});return BPromise[_0x243a('0x48')](_0x10a018);}}})[_0x243a('0xd')](function(_0x54ba2d){if(_0x1840fa){var _0x339fc9=[];var _0x464f75=[];var _0x5d1f49=utils['getChannels']();var _0x4b8df5={'membername':_0x1840fa[_0x243a('0x26')],'interface':_0x429fff,'enterAt':moment()[_0x243a('0x2e')](_0x243a('0x35')),'role':_0x1840fa[_0x243a('0x27')],'internal':_0x1840fa['internal']};_0x5d1f49['forEach'](function(_0x377ddd){_0x339fc9[_0x243a('0x32')](_[_0x243a('0x56')]({'channel':_0x377ddd,'type':_0x243a('0x57'),'data1':'callysquare','data2':_0x429fff},_0x4b8df5));if(_0x1840fa[_0x243a('0x4d')]){_0x464f75[_0x243a('0x32')](_['merge']({'channel':_0x377ddd,'type':'PAUSE','data1':_0x243a('0x58')},_0x4b8df5));}});return db[_0x243a('0x2c')][_0x243a('0x39')](_0x339fc9[_0x243a('0x59')](_0x464f75),{'individualHooks':!![]});}})[_0x243a('0xd')](function(){if(_0x1840fa){return _0x1840fa[_0x243a('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x243a('0x2e')](_0x243a('0x35')),'voicePause':_0x1840fa['loginInPause']||![],'mailPause':_0x1840fa[_0x243a('0x4d')]||![],'chatPause':_0x1840fa[_0x243a('0x4d')]||![],'faxPause':_0x1840fa[_0x243a('0x4d')]||![],'smsPause':_0x1840fa[_0x243a('0x4d')]||![],'openchannelPause':_0x1840fa['loginInPause']||![],'pauseType':_0x1840fa[_0x243a('0x4d')]?_0x243a('0x58'):null,'lastPauseAt':moment()[_0x243a('0x2e')](_0x243a('0x35')),'interface':_0x429fff});}})['then'](function(_0x11fd2a){_0x30735b(_0x11fd2a);})['catch'](function(_0x4f5395){_0x9dc5a9(_0x3966da['error'](0x1f4,_0x4f5395[_0x243a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 81a4bb5..f1a5995 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 _0xde9e=['register','length','remove'];(function(_0x1486ce,_0x133a36){var _0x236fd4=function(_0x1c04dd){while(--_0x1c04dd){_0x1486ce['push'](_0x1486ce['shift']());}};_0x236fd4(++_0x133a36);}(_0xde9e,0xbf));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xede9('0x0'),'update'];function createListener(_0x354064,_0x1b530a){return function(_0x412789){_0x1b530a['emit'](_0x354064,_0x412789);};}function removeListener(_0x50fcf5,_0x156f10){return function(){UserEvents['removeListener'](_0x50fcf5,_0x156f10);};}exports[_0xede9('0x1')]=function(_0x5429d0){for(var _0x41c07e=0x0,_0x27c421=events[_0xede9('0x2')];_0x41c07e<_0x27c421;_0x41c07e++){var _0x1376ee=events[_0x41c07e];var _0x340be5=createListener('user:'+_0x1376ee,_0x5429d0);UserEvents['on'](_0x1376ee,_0x340be5);}}; \ No newline at end of file +var _0x8d5c=['user:','remove','update','emit','removeListener','register','length'];(function(_0x55cb9f,_0x64654d){var _0x272a75=function(_0x2d4f90){while(--_0x2d4f90){_0x55cb9f['push'](_0x55cb9f['shift']());}};_0x272a75(++_0x64654d);}(_0x8d5c,0x12e));var _0xc8d5=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0x8d5c[_0x3a5648];return _0x34126d;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xc8d5('0x0'),_0xc8d5('0x1')];function createListener(_0x371a3d,_0x34c243){return function(_0x4243dc){_0x34c243[_0xc8d5('0x2')](_0x371a3d,_0x4243dc);};}function removeListener(_0x490004,_0x2c9c35){return function(){UserEvents[_0xc8d5('0x3')](_0x490004,_0x2c9c35);};}exports[_0xc8d5('0x4')]=function(_0x22cfcd){for(var _0x483f9e=0x0,_0x3ccc51=events[_0xc8d5('0x5')];_0x483f9e<_0x3ccc51;_0x483f9e++){var _0x3d39a3=events[_0x483f9e];var _0x6e1280=createListener(_0xc8d5('0x6')+_0x3d39a3,_0x22cfcd);UserEvents['on'](_0x3d39a3,_0x6e1280);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 78137c9..f560ee2 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(_0x6919cf,_0x435c2c){var _0x220d05=function(_0x48476a){while(--_0x48476a){_0x6919cf['push'](_0x6919cf['shift']());}};_0x220d05(++_0x435c2c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x305be7,_0x527c99){var _0x122e11=function(_0x24ab5a){while(--_0x24ab5a){_0x305be7['push'](_0x305be7['shift']());}};_0x122e11(++_0x527c99);}(_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'));module[_0x0a9e('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 b56d369..8cb164e 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 _0x0447=['sequelize','exports','INTEGER'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x0447,0x141));var _0x7044=function(_0x18fe0a,_0x2c9a7f){_0x18fe0a=_0x18fe0a-0x0;var _0x5b9862=_0x0447[_0x18fe0a];return _0x5b9862;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'penalty':{'type':Sequelize[_0x7044('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf50b=['sequelize','exports'];(function(_0xd82c94,_0x44798f){var _0x4a494d=function(_0x355a14){while(--_0x355a14){_0xd82c94['push'](_0xd82c94['shift']());}};_0x4a494d(++_0x44798f);}(_0xf50b,0xc8));var _0xbf50=function(_0x44f2e9,_0x47b9f2){_0x44f2e9=_0x44f2e9-0x0;var _0x4d0e06=_0xf50b[_0x44f2e9];return _0x4d0e06;};'use strict';var Sequelize=require(_0xbf50('0x0'));module[_0xbf50('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 1509ed2..ca67fe1 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 _0xaa5d=['../../config/environment','./userChatQueue.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x190102,_0x367983){var _0x3462c5=function(_0x329fbc){while(--_0x329fbc){_0x190102['push'](_0x190102['shift']());}};_0x3462c5(++_0x367983);}(_0xaa5d,0x1a8));var _0xdaa5=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0xaa5d[_0x453e2b];return _0x50f306;};'use strict';var _=require(_0xdaa5('0x0'));var util=require(_0xdaa5('0x1'));var logger=require(_0xdaa5('0x2'))('api');var moment=require(_0xdaa5('0x3'));var BPromise=require(_0xdaa5('0x4'));var rp=require(_0xdaa5('0x5'));var fs=require('fs');var path=require(_0xdaa5('0x6'));var rimraf=require(_0xdaa5('0x7'));var config=require(_0xdaa5('0x8'));var attributes=require(_0xdaa5('0x9'));module[_0xdaa5('0xa')]=function(_0x306927,_0xd687e2){return _0x306927[_0xdaa5('0xb')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ad5=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x3d8b04,_0x5547d7){var _0x15e19a=function(_0x10cbb3){while(--_0x10cbb3){_0x3d8b04['push'](_0x3d8b04['shift']());}};_0x15e19a(++_0x5547d7);}(_0x8ad5,0x170));var _0x58ad=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x8ad5[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x58ad('0x0'));var util=require(_0x58ad('0x1'));var logger=require(_0x58ad('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58ad('0x3'));var fs=require('fs');var path=require(_0x58ad('0x4'));var rimraf=require(_0x58ad('0x5'));var config=require('../../config/environment');var attributes=require(_0x58ad('0x6'));module[_0x58ad('0x7')]=function(_0x5a48bd,_0x4bd10d){return _0x5a48bd[_0x58ad('0x8')](_0x58ad('0x9'),attributes,{'tableName':_0x58ad('0xa'),'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 5e92487..0e32736 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 _0x4ca1=['../../config/logger','rpc','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../config/utils'];(function(_0x7b88b6,_0x189bdd){var _0x35f2e8=function(_0x1552fc){while(--_0x1552fc){_0x7b88b6['push'](_0x7b88b6['shift']());}};_0x35f2e8(++_0x189bdd);}(_0x4ca1,0xc4));var _0x14ca=function(_0x476392,_0x43d678){_0x476392=_0x476392-0x0;var _0x25d9f4=_0x4ca1[_0x476392];return _0x25d9f4;};'use strict';var _=require(_0x14ca('0x0'));var util=require('util');var moment=require(_0x14ca('0x1'));var BPromise=require(_0x14ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x14ca('0x3'));var logger=require(_0x14ca('0x4'))(_0x14ca('0x5'));var config=require('../../config/environment');var jayson=require(_0x14ca('0x6'));var client=jayson[_0x14ca('0x7')][_0x14ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7cbfa0,_0x286d2f,_0x170135){return new BPromise(function(_0x1f43dd,_0x1922e4){return client[_0x14ca('0x9')](_0x7cbfa0,_0x170135)['then'](function(_0x2b8813){logger[_0x14ca('0xa')](_0x14ca('0xb'),_0x286d2f,_0x14ca('0xc'));logger[_0x14ca('0xd')](_0x14ca('0xe'),_0x286d2f,_0x14ca('0xc'),JSON[_0x14ca('0xf')](_0x2b8813));if(_0x2b8813[_0x14ca('0x10')]){if(_0x2b8813[_0x14ca('0x10')][_0x14ca('0x11')]===0x1f4){logger[_0x14ca('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x286d2f,_0x2b8813['error'][_0x14ca('0x12')]);return _0x1922e4(_0x2b8813[_0x14ca('0x10')][_0x14ca('0x12')]);}logger['error'](_0x14ca('0xb'),_0x286d2f,_0x2b8813['error']['message']);return _0x1f43dd(_0x2b8813[_0x14ca('0x10')][_0x14ca('0x12')]);}else{logger[_0x14ca('0xa')](_0x14ca('0xb'),_0x286d2f,_0x14ca('0xc'));_0x1f43dd(_0x2b8813['result'][_0x14ca('0x12')]);}})[_0x14ca('0x13')](function(_0x29acd5){logger['error'](_0x14ca('0xb'),_0x286d2f,_0x29acd5);_0x1922e4(_0x29acd5);});});} \ No newline at end of file +var _0xdb5d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xefac6b,_0x3ab4a6){var _0x52aa5e=function(_0x2ffe69){while(--_0x2ffe69){_0xefac6b['push'](_0xefac6b['shift']());}};_0x52aa5e(++_0x3ab4a6);}(_0xdb5d,0xf7));var _0xddb5=function(_0x3c12ac,_0x3d96fb){_0x3c12ac=_0x3c12ac-0x0;var _0x14f403=_0xdb5d[_0x3c12ac];return _0x14f403;};'use strict';var _=require(_0xddb5('0x0'));var util=require(_0xddb5('0x1'));var moment=require(_0xddb5('0x2'));var BPromise=require('bluebird');var rs=require(_0xddb5('0x3'));var fs=require('fs');var Redis=require(_0xddb5('0x4'));var db=require(_0xddb5('0x5'))['db'];var utils=require(_0xddb5('0x6'));var logger=require(_0xddb5('0x7'))(_0xddb5('0x8'));var config=require(_0xddb5('0x9'));var jayson=require(_0xddb5('0xa'));var client=jayson[_0xddb5('0xb')][_0xddb5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x501bff,_0x19a648,_0x4c49c1){return new BPromise(function(_0x459c71,_0x2e0f5a){return client[_0xddb5('0xd')](_0x501bff,_0x4c49c1)['then'](function(_0x180554){logger[_0xddb5('0xe')](_0xddb5('0xf'),_0x19a648,'request\x20sent');logger[_0xddb5('0x10')](_0xddb5('0x11'),_0x19a648,_0xddb5('0x12'),JSON['stringify'](_0x180554));if(_0x180554[_0xddb5('0x13')]){if(_0x180554['error'][_0xddb5('0x14')]===0x1f4){logger[_0xddb5('0x13')](_0xddb5('0xf'),_0x19a648,_0x180554[_0xddb5('0x13')][_0xddb5('0x15')]);return _0x2e0f5a(_0x180554[_0xddb5('0x13')][_0xddb5('0x15')]);}logger[_0xddb5('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x19a648,_0x180554[_0xddb5('0x13')]['message']);return _0x459c71(_0x180554[_0xddb5('0x13')][_0xddb5('0x15')]);}else{logger[_0xddb5('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x19a648,_0xddb5('0x12'));_0x459c71(_0x180554[_0xddb5('0x16')][_0xddb5('0x15')]);}})['catch'](function(_0x109882){logger[_0xddb5('0x13')](_0xddb5('0xf'),_0x19a648,_0x109882);_0x2e0f5a(_0x109882);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3540a0d..1bd8999 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x31ce25,_0x1c1ba4){var _0x357513=function(_0x8f226c){while(--_0x8f226c){_0x31ce25['push'](_0x31ce25['shift']());}};_0x357513(++_0x1c1ba4);}(_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(_0xbbd596,_0x586f0d){var _0x502bfb=function(_0xa9c63f){while(--_0xa9c63f){_0xbbd596['push'](_0xbbd596['shift']());}};_0x502bfb(++_0x586f0d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6ca47e0..6f63168 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 _0x3109=['INTEGER','sequelize','exports'];(function(_0x41abdf,_0x4feda5){var _0x3ab243=function(_0x121d32){while(--_0x121d32){_0x41abdf['push'](_0x41abdf['shift']());}};_0x3ab243(++_0x4feda5);}(_0x3109,0xf4));var _0x9310=function(_0x1577ba,_0x20e393){_0x1577ba=_0x1577ba-0x0;var _0x549577=_0x3109[_0x1577ba];return _0x549577;};'use strict';var Sequelize=require(_0x9310('0x0'));module[_0x9310('0x1')]={'penalty':{'type':Sequelize[_0x9310('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9310('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7b54=['STRING','sequelize','exports','INTEGER'];(function(_0x51c1eb,_0x49b621){var _0x17d9e7=function(_0x39c438){while(--_0x39c438){_0x51c1eb['push'](_0x51c1eb['shift']());}};_0x17d9e7(++_0x49b621);}(_0x7b54,0x135));var _0x47b5=function(_0x57fd40,_0x9de24f){_0x57fd40=_0x57fd40-0x0;var _0x52bb76=_0x7b54[_0x57fd40];return _0x52bb76;};'use strict';var Sequelize=require(_0x47b5('0x0'));module[_0x47b5('0x1')]={'penalty':{'type':Sequelize[_0x47b5('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x47b5('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x47b5('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1014046..5368eb8 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 _0xe28c=['rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','bluebird','path'];(function(_0x407b91,_0x35620f){var _0xa63737=function(_0x3790cd){while(--_0x3790cd){_0x407b91['push'](_0x407b91['shift']());}};_0xa63737(++_0x35620f);}(_0xe28c,0xed));var _0xce28=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0xe28c[_0x543429];return _0x112a46;};'use strict';var _=require(_0xce28('0x0'));var util=require(_0xce28('0x1'));var logger=require(_0xce28('0x2'))('api');var moment=require('moment');var BPromise=require(_0xce28('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce28('0x4'));var rimraf=require(_0xce28('0x5'));var config=require(_0xce28('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xce28('0x7')]=function(_0x4517f0,_0xcc9ae3){return _0x4517f0[_0xce28('0x8')](_0xce28('0x9'),attributes,{'tableName':_0xce28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd311=['../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0x509e15,_0x3a8597){var _0x35d8f0=function(_0x5e8c62){while(--_0x5e8c62){_0x509e15['push'](_0x509e15['shift']());}};_0x35d8f0(++_0x3a8597);}(_0xd311,0x109));var _0x1d31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd311[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d31('0x0'));var util=require(_0x1d31('0x1'));var logger=require(_0x1d31('0x2'))('api');var moment=require(_0x1d31('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d31('0x5'));var attributes=require(_0x1d31('0x6'));module[_0x1d31('0x7')]=function(_0x412774,_0x52a3ea){return _0x412774[_0x1d31('0x8')]('UserFaxQueue',attributes,{'tableName':_0x1d31('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index df716b5..bcef361 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 _0xedf6=['jayson/promise','request','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4fbe46,_0x2c0e02){var _0x1edbb6=function(_0x265984){while(--_0x265984){_0x4fbe46['push'](_0x4fbe46['shift']());}};_0x1edbb6(++_0x2c0e02);}(_0xedf6,0x8b));var _0x6edf=function(_0x2dc81b,_0x2063ae){_0x2dc81b=_0x2dc81b-0x0;var _0x3a2946=_0xedf6[_0x2dc81b];return _0x3a2946;};'use strict';var _=require(_0x6edf('0x0'));var util=require(_0x6edf('0x1'));var moment=require(_0x6edf('0x2'));var BPromise=require(_0x6edf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6edf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6edf('0x5'));var logger=require(_0x6edf('0x6'))(_0x6edf('0x7'));var config=require('../../config/environment');var jayson=require(_0x6edf('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4484f7,_0x10c5f8,_0x359b8a){return new BPromise(function(_0x58d39b,_0x54ec79){return client[_0x6edf('0x9')](_0x4484f7,_0x359b8a)['then'](function(_0x3eb86f){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x10c5f8,_0x6edf('0xa'));logger[_0x6edf('0xb')](_0x6edf('0xc'),_0x10c5f8,_0x6edf('0xa'),JSON[_0x6edf('0xd')](_0x3eb86f));if(_0x3eb86f[_0x6edf('0xe')]){if(_0x3eb86f[_0x6edf('0xe')][_0x6edf('0xf')]===0x1f4){logger['error'](_0x6edf('0x10'),_0x10c5f8,_0x3eb86f[_0x6edf('0xe')]['message']);return _0x54ec79(_0x3eb86f[_0x6edf('0xe')][_0x6edf('0x11')]);}logger[_0x6edf('0xe')](_0x6edf('0x10'),_0x10c5f8,_0x3eb86f[_0x6edf('0xe')][_0x6edf('0x11')]);return _0x58d39b(_0x3eb86f['error'][_0x6edf('0x11')]);}else{logger[_0x6edf('0x12')](_0x6edf('0x10'),_0x10c5f8,_0x6edf('0xa'));_0x58d39b(_0x3eb86f[_0x6edf('0x13')]['message']);}})[_0x6edf('0x14')](function(_0x56e658){logger[_0x6edf('0xe')](_0x6edf('0x10'),_0x10c5f8,_0x56e658);_0x54ec79(_0x56e658);});});} \ No newline at end of file +var _0x80ae=['util','moment','randomstring','rpc','client','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x1d7a7a,_0x25c51e){var _0xc84d48=function(_0x38c85d){while(--_0x38c85d){_0x1d7a7a['push'](_0x1d7a7a['shift']());}};_0xc84d48(++_0x25c51e);}(_0x80ae,0xf0));var _0xe80a=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x80ae[_0x49d19d];return _0x4ebef1;};'use strict';var _=require('lodash');var util=require(_0xe80a('0x0'));var moment=require(_0xe80a('0x1'));var BPromise=require('bluebird');var rs=require(_0xe80a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe80a('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe80a('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9a42,_0x5b906e,_0x38b7ed){return new BPromise(function(_0xf3b3b2,_0x52f102){return client['request'](_0x4c9a42,_0x38b7ed)['then'](function(_0x38f521){logger[_0xe80a('0x5')]('UserFaxQueue,\x20%s,\x20%s',_0x5b906e,_0xe80a('0x6'));logger[_0xe80a('0x7')](_0xe80a('0x8'),_0x5b906e,_0xe80a('0x6'),JSON[_0xe80a('0x9')](_0x38f521));if(_0x38f521[_0xe80a('0xa')]){if(_0x38f521[_0xe80a('0xa')][_0xe80a('0xb')]===0x1f4){logger[_0xe80a('0xa')](_0xe80a('0xc'),_0x5b906e,_0x38f521[_0xe80a('0xa')][_0xe80a('0xd')]);return _0x52f102(_0x38f521[_0xe80a('0xa')][_0xe80a('0xd')]);}logger['error'](_0xe80a('0xc'),_0x5b906e,_0x38f521[_0xe80a('0xa')][_0xe80a('0xd')]);return _0xf3b3b2(_0x38f521[_0xe80a('0xa')][_0xe80a('0xd')]);}else{logger[_0xe80a('0x5')](_0xe80a('0xc'),_0x5b906e,_0xe80a('0x6'));_0xf3b3b2(_0x38f521[_0xe80a('0xe')]['message']);}})[_0xe80a('0xf')](function(_0xe493b6){logger[_0xe80a('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x5b906e,_0xe493b6);_0x52f102(_0xe493b6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a9a4f4c..ee585ba 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x28be7f,_0x57fe9a){var _0x5afb85=function(_0x2c1a52){while(--_0x2c1a52){_0x28be7f['push'](_0x28be7f['shift']());}};_0x5afb85(++_0x57fe9a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0xcb91[_0x7538c5];return _0x8b56be;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x50901f,_0x1f8e96){var _0x486142=function(_0x3186db){while(--_0x3186db){_0x50901f['push'](_0x50901f['shift']());}};_0x486142(++_0x1f8e96);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xcb91[_0x263f4c];return _0x3a78d3;};'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 9a140ee..c05ea88 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 _0xf2b0=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2b0,0x1d5));var _0x0f2b=function(_0x58cc37,_0x51105a){_0x58cc37=_0x58cc37-0x0;var _0x494320=_0xf2b0[_0x58cc37];return _0x494320;};'use strict';var Sequelize=require(_0x0f2b('0x0'));module[_0x0f2b('0x1')]={'penalty':{'type':Sequelize[_0x0f2b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2029=['exports'];(function(_0x283f1a,_0x271f9a){var _0x3eeb4c=function(_0x3c2780){while(--_0x3c2780){_0x283f1a['push'](_0x283f1a['shift']());}};_0x3eeb4c(++_0x271f9a);}(_0x2029,0xb5));var _0x9202=function(_0x680da9,_0x49a356){_0x680da9=_0x680da9-0x0;var _0x2c46c3=_0x2029[_0x680da9];return _0x2c46c3;};'use strict';var Sequelize=require('sequelize');module[_0x9202('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index f5f0f90..55ed26f 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 _0x8f78=['bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x8f78,0x183));var _0x88f7=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8f78[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x88f7('0x0'));var util=require(_0x88f7('0x1'));var logger=require(_0x88f7('0x2'))(_0x88f7('0x3'));var moment=require(_0x88f7('0x4'));var BPromise=require(_0x88f7('0x5'));var rp=require(_0x88f7('0x6'));var fs=require('fs');var path=require(_0x88f7('0x7'));var rimraf=require(_0x88f7('0x8'));var config=require(_0x88f7('0x9'));var attributes=require(_0x88f7('0xa'));module[_0x88f7('0xb')]=function(_0x5e8e03,_0x5d684c){return _0x5e8e03[_0x88f7('0xc')]('UserMailQueue',attributes,{'tableName':_0x88f7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75e0=['define','user_has_mail_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x4a7597,_0x14753b){var _0x5d8b09=function(_0x51daed){while(--_0x51daed){_0x4a7597['push'](_0x4a7597['shift']());}};_0x5d8b09(++_0x14753b);}(_0x75e0,0xe8));var _0x075e=function(_0x5b9178,_0xf5037e){_0x5b9178=_0x5b9178-0x0;var _0x44a60d=_0x75e0[_0x5b9178];return _0x44a60d;};'use strict';var _=require(_0x075e('0x0'));var util=require(_0x075e('0x1'));var logger=require('../../config/logger')(_0x075e('0x2'));var moment=require(_0x075e('0x3'));var BPromise=require('bluebird');var rp=require(_0x075e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x075e('0x5'));var config=require(_0x075e('0x6'));var attributes=require(_0x075e('0x7'));module['exports']=function(_0x2cc9f8,_0x491b08){return _0x2cc9f8[_0x075e('0x8')]('UserMailQueue',attributes,{'tableName':_0x075e('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 b4c5b8a..7df23e5 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x317602,_0x22c553){var _0x815d69=function(_0x4a535c){while(--_0x4a535c){_0x317602['push'](_0x317602['shift']());}};_0x815d69(++_0x22c553);}(_0x55ca,0x126));var _0xa55c=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x55ca[_0x1fc18b];return _0x16a351;};'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')]('UserMailQueue,\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')]('UserMailQueue,\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);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ac2a3,_0x450d9f){var _0xe08b08=function(_0x3bfcc6){while(--_0x3bfcc6){_0x1ac2a3['push'](_0x1ac2a3['shift']());}};_0xe08b08(++_0x450d9f);}(_0x6aa7,0x178));var _0x76aa=function(_0x24c582,_0x3a1493){_0x24c582=_0x24c582-0x0;var _0x1cacd7=_0x6aa7[_0x24c582];return _0x1cacd7;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 2d64df9..0f5ed4d 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 _0x9c78=['multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','exports'];(function(_0x18b362,_0x122db7){var _0x4930c5=function(_0x5be6b1){while(--_0x5be6b1){_0x18b362['push'](_0x18b362['shift']());}};_0x4930c5(++_0x122db7);}(_0x9c78,0x132));var _0x89c7=function(_0x2947bf,_0x8afe83){_0x2947bf=_0x2947bf-0x0;var _0x56c5c8=_0x9c78[_0x2947bf];return _0x56c5c8;};'use strict';var multer=require(_0x89c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x89c7('0x1'));var router=express[_0x89c7('0x2')]();var fs_extra=require(_0x89c7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x89c7('0x4'));var config=require(_0x89c7('0x5'));var controller=require(_0x89c7('0x6'));router['post']('/',auth[_0x89c7('0x7')](),controller['sendUserNotification']);module[_0x89c7('0x8')]=router; \ No newline at end of file +var _0xe03d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path'];(function(_0x44a3a3,_0x4ab595){var _0x23fdc6=function(_0x4c6c15){while(--_0x4c6c15){_0x44a3a3['push'](_0x44a3a3['shift']());}};_0x23fdc6(++_0x4ab595);}(_0xe03d,0x1a2));var _0xde03=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0xe03d[_0x2906e6];return _0x12517a;};'use strict';var multer=require(_0xde03('0x0'));var util=require('util');var path=require(_0xde03('0x1'));var timeout=require(_0xde03('0x2'));var express=require(_0xde03('0x3'));var router=express[_0xde03('0x4')]();var fs_extra=require(_0xde03('0x5'));var auth=require(_0xde03('0x6'));var interaction=require(_0xde03('0x7'));var config=require(_0xde03('0x8'));var controller=require(_0xde03('0x9'));router[_0xde03('0xa')]('/',auth[_0xde03('0xb')](),controller[_0xde03('0xc')]);module[_0xde03('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index bf89cb9..ab7db09 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 _0x92b3=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x51d0b1,_0x2519cd){var _0x478d30=function(_0x131702){while(--_0x131702){_0x51d0b1['push'](_0x51d0b1['shift']());}};_0x478d30(++_0x2519cd);}(_0x92b3,0x113));var _0x392b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x92b3[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x392b('0x0'));module[_0x392b('0x1')]={'body':{'type':Sequelize[_0x392b('0x2')]},'senderName':{'type':Sequelize[_0x392b('0x3')]},'recipientsId':{'type':Sequelize[_0x392b('0x2')]},'recipientsDescription':{'type':Sequelize[_0x392b('0x3')]},'beep':{'type':Sequelize[_0x392b('0x4')]}}; \ No newline at end of file +var _0x81f8=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x2cf683,_0x3213de){var _0x5cddff=function(_0x454eed){while(--_0x454eed){_0x2cf683['push'](_0x2cf683['shift']());}};_0x5cddff(++_0x3213de);}(_0x81f8,0x106));var _0x881f=function(_0x384ee4,_0x2e22f0){_0x384ee4=_0x384ee4-0x0;var _0x35f7ca=_0x81f8[_0x384ee4];return _0x35f7ca;};'use strict';var Sequelize=require(_0x881f('0x0'));module[_0x881f('0x1')]={'body':{'type':Sequelize[_0x881f('0x2')]},'senderName':{'type':Sequelize[_0x881f('0x3')]},'recipientsId':{'type':Sequelize[_0x881f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x881f('0x3')]},'beep':{'type':Sequelize[_0x881f('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ccd79fc..952b0ef 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 _0xadde=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./userNotification.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','save','update','then','stack','name','send','text','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','includes','replace','queue','Queue','push','all','getAgents'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0xadde,0xc6));var _0xeadd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadde[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeadd('0x0'));var zipdir=require(_0xeadd('0x1'));var jsonpatch=require(_0xeadd('0x2'));var rp=require('request-promise');var moment=require(_0xeadd('0x3'));var BPromise=require(_0xeadd('0x4'));var Mustache=require(_0xeadd('0x5'));var util=require('util');var path=require('path');var sox=require(_0xeadd('0x6'));var csv=require('to-csv');var ejs=require(_0xeadd('0x7'));var fs=require('fs');var fs_extra=require(_0xeadd('0x8'));var _=require('lodash');var squel=require(_0xeadd('0x9'));var crypto=require(_0xeadd('0xa'));var jsforce=require(_0xeadd('0xb'));var deskjs=require(_0xeadd('0xc'));var toCsv=require(_0xeadd('0xd'));var querystring=require(_0xeadd('0xe'));var Papa=require(_0xeadd('0xf'));var Redis=require(_0xeadd('0x10'));var authService=require(_0xeadd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeadd('0x12'));var hardwareService=require(_0xeadd('0x13'));var logger=require(_0xeadd('0x14'))(_0xeadd('0x15'));var utils=require(_0xeadd('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeadd('0x17'))['db'];config[_0xeadd('0x18')]=_[_0xeadd('0x19')](config['redis'],{'host':_0xeadd('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeadd('0x18')]));require(_0xeadd('0x1b'))['register'](socket);function respondWithStatusCode(_0xaaa860,_0x8b8e32){_0x8b8e32=_0x8b8e32||0xcc;return function(_0x33f652){if(_0x33f652){return _0xaaa860[_0xeadd('0x1c')](_0x8b8e32);}return _0xaaa860[_0xeadd('0x1d')](_0x8b8e32)[_0xeadd('0x1e')]();};}function respondWithResult(_0x5b1aea,_0x293f1e){_0x293f1e=_0x293f1e||0xc8;return function(_0x2fa77a){if(_0x2fa77a){return _0x5b1aea[_0xeadd('0x1d')](_0x293f1e)[_0xeadd('0x1f')](_0x2fa77a);}};}function respondWithFilteredResult(_0x30270d,_0x52008f){return function(_0x2fe857){if(_0x2fe857){var _0x4760c7=typeof _0x52008f['offset']===_0xeadd('0x20')&&typeof _0x52008f[_0xeadd('0x21')]===_0xeadd('0x20');var _0x45d1df=_0x2fe857['count'];var _0x360e83=_0x4760c7?0x0:_0x52008f[_0xeadd('0x22')];var _0x36771b=_0x4760c7?_0x2fe857[_0xeadd('0x23')]:_0x52008f[_0xeadd('0x22')]+_0x52008f[_0xeadd('0x21')];var _0x21eeb7;if(_0x36771b>=_0x45d1df){_0x36771b=_0x45d1df;_0x21eeb7=0xc8;}else{_0x21eeb7=0xce;}_0x30270d['status'](_0x21eeb7);return _0x30270d[_0xeadd('0x24')]('Content-Range',_0x360e83+'-'+_0x36771b+'/'+_0x45d1df)[_0xeadd('0x1f')](_0x2fe857);}return null;};}function patchUpdates(_0x5975d9){return function(_0xfbd61d){try{jsonpatch['apply'](_0xfbd61d,_0x5975d9,!![]);}catch(_0x475c08){return BPromise[_0xeadd('0x25')](_0x475c08);}return _0xfbd61d[_0xeadd('0x26')]();};}function saveUpdates(_0x2dcf0b,_0x1a3600){return function(_0x5fcb5d){if(_0x5fcb5d){return _0x5fcb5d[_0xeadd('0x27')](_0x2dcf0b)[_0xeadd('0x28')](function(_0x2fcefe){return _0x2fcefe;});}return null;};}function removeEntity(_0x4985ba,_0x57c633){return function(_0x1117f5){if(_0x1117f5){return _0x1117f5['destroy']()[_0xeadd('0x28')](function(){_0x4985ba[_0xeadd('0x1d')](0xcc)[_0xeadd('0x1e')]();});}};}function handleEntityNotFound(_0x434805,_0x2de565){return function(_0x4cc930){if(!_0x4cc930){_0x434805[_0xeadd('0x1c')](0x194);}return _0x4cc930;};}function handleError(_0x3d6400,_0x40b00b){_0x40b00b=_0x40b00b||0x1f4;return function(_0x532a09){logger['error'](_0x532a09[_0xeadd('0x29')]);if(_0x532a09[_0xeadd('0x2a')]){delete _0x532a09[_0xeadd('0x2a')];}_0x3d6400[_0xeadd('0x1d')](_0x40b00b)[_0xeadd('0x2b')](_0x532a09);};}exports['sendUserNotification']=function(_0x546d4b,_0x5a6820,_0x5132fb){if(!_0x546d4b['body']['hasOwnProperty'](_0xeadd('0x2c'))&&!_0x546d4b[_0xeadd('0x2d')][_0xeadd('0x2e')]('TemplateId')){throw new db[(_0xeadd('0x2f'))][(_0xeadd('0x30'))](_0xeadd('0x31'));}else{if(_0x546d4b['body'][_0xeadd('0x2e')]('TemplateId')&&!_0x546d4b[_0xeadd('0x2d')][_0xeadd('0x2e')](_0xeadd('0x32'))){throw new db[(_0xeadd('0x2f'))][(_0xeadd('0x30'))](_0xeadd('0x33'));}if(!_0x546d4b[_0xeadd('0x2d')]['hasOwnProperty'](_0xeadd('0x34'))){throw new db[(_0xeadd('0x2f'))][(_0xeadd('0x30'))](_0xeadd('0x35'));}else{try{var _0x55399c=JSON[_0xeadd('0x36')](_0x546d4b[_0xeadd('0x2d')][_0xeadd('0x34')]);}catch(_0x58a070){logger[_0xeadd('0x37')](_0x58a070);throw new db[(_0xeadd('0x2f'))][(_0xeadd('0x30'))](_0xeadd('0x38'));}var _0x385173=[_0xeadd('0x39'),'faxqueue','mailqueue',_0xeadd('0x3a'),'smsqueue',_0xeadd('0x3b'),_0xeadd('0x3c'),_0xeadd('0x3d'),'user'];if(_[_0xeadd('0x3e')](_0x55399c,function(_0x553652){return!_['includes'](_0x385173,_0x553652['model'][_0xeadd('0x3f')]());})){throw new db[(_0xeadd('0x2f'))][(_0xeadd('0x30'))](_0xeadd('0x40'));}}}var _0x2aa6cd={};_0x2aa6cd[_0xeadd('0x41')]=_0x546d4b['body'][_0xeadd('0x2e')](_0xeadd('0x41'))?_0x546d4b['body']['senderName']:_0x546d4b[_0xeadd('0x42')]['fullname'];_0x2aa6cd[_0xeadd('0x43')]=_[_0xeadd('0x44')](_0x546d4b[_0xeadd('0x2d')][_0xeadd('0x43')])?null:_0x546d4b[_0xeadd('0x2d')]['recipientsDescription'];_0x2aa6cd[_0xeadd('0x45')]=_0x546d4b['body'][_0xeadd('0x45')]||![];_0x2aa6cd[_0xeadd('0x46')]=_0x546d4b['user']['id'];return getContent(_0x546d4b[_0xeadd('0x2d')])[_0xeadd('0x28')](function(_0x1830a8){_0x2aa6cd[_0xeadd('0x2d')]=_0x1830a8;return getRecipients(_0x55399c);})[_0xeadd('0x28')](function(_0x58fbc3){_0x2aa6cd[_0xeadd('0x47')]=_[_0xeadd('0x48')](_0x58fbc3)[_0xeadd('0x49')](',');return db[_0xeadd('0x4a')][_0xeadd('0x4b')](function(_0x167031){return db['UserNotification'][_0xeadd('0x4c')](_0x2aa6cd,{'raw':!![],'transaction':_0x167031})[_0xeadd('0x28')](function(_0x322ff0){var _0x507d15={'sender':_0x2aa6cd[_0xeadd('0x41')],'description':_0x2aa6cd['recipientsDescription'],'content':_0x2aa6cd['body'],'beep':_0x2aa6cd[_0xeadd('0x45')]};_0x58fbc3[_0xeadd('0x4d')](function(_0x2670e3){_0x507d15[_0xeadd('0x4e')]=_0x2670e3;socket[_0xeadd('0x4f')](_0xeadd('0x50'),_0x507d15);});return _0x322ff0;});});})[_0xeadd('0x28')](respondWithResult(_0x5a6820,0xc9))[_0xeadd('0x51')](handleError(_0x5a6820,null));};function getContent(_0x41280e){return new BPromise(function(_0x26c261,_0x5bef14){if(_0x41280e[_0xeadd('0x2c')]){_0x26c261(_0x41280e[_0xeadd('0x2c')]);return;}return db[_0xeadd('0x52')][_0xeadd('0x53')]({'attributes':[_0xeadd('0x54')],'where':{'id':_0x41280e[_0xeadd('0x55')]},'raw':!![]})['then'](function(_0x2dcfc3){if(!_0x2dcfc3)throw new db[(_0xeadd('0x2f'))][(_0xeadd('0x30'))](_0xeadd('0x56'));var _0x296a2b=Mustache[_0xeadd('0x57')](_0x2dcfc3[_0xeadd('0x54')],_0x41280e[_0xeadd('0x32')]);_0x26c261(_0x296a2b);})[_0xeadd('0x51')](function(_0x507519){_0x5bef14(_0x507519);});});}function getRecipients(_0x3c6980){return new BPromise(function(_0x35e9ef,_0x5ad4cd){var _0x54dd43=[];var _0x545786=[];_0x3c6980[_0xeadd('0x4d')](function(_0x2c57d2){var _0x2c02ce=_[_0xeadd('0x58')](_0x2c57d2['model'][_0xeadd('0x3f')]());if(_0x2c02ce===_0xeadd('0x59')){_0x54dd43=_[_0xeadd('0x5a')](_0x54dd43,_0x2c57d2[_0xeadd('0x5b')]);}else{if(_[_0xeadd('0x5c')](_0x2c02ce,'queue'))_0x2c02ce=_0x2c02ce[_0xeadd('0x5d')](_0xeadd('0x5e'),_0xeadd('0x5f'));_0x2c57d2[_0xeadd('0x5b')][_0xeadd('0x4d')](function(_0x34fb8d){_0x545786[_0xeadd('0x60')](getAgents(_0x2c02ce,_0x34fb8d));});}});return BPromise[_0xeadd('0x61')](_0x545786)[_0xeadd('0x28')](function(_0xafb20d){_0x54dd43=_[_0xeadd('0x5a')](_0x54dd43,_['flatten'](_0xafb20d));_0x35e9ef(_0x54dd43);})[_0xeadd('0x51')](function(_0x9a4b91){_0x5ad4cd(_0x9a4b91);});});}function getAgents(_0x27f3a9,_0x5aa0c9){return new BPromise(function(_0x2c7bdc,_0x14f36a){return db[_0x27f3a9][_0xeadd('0x53')]({'where':{'id':_0x5aa0c9}})[_0xeadd('0x28')](function(_0x12a397){return _0x12a397[_0xeadd('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3a4e33){var _0x30ae63=_['map'](_0x3a4e33,'id');_0x2c7bdc(_0x30ae63);});})[_0xeadd('0x51')](function(_0x3b8b60){_0x14f36a(_0x3b8b60);});});} \ No newline at end of file +var _0x4b6c=['reject','then','error','stack','name','send','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','toLowerCase','union','ids','queue','Queue','push','all','flatten','getAgents','map','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','limit','count','status','set','Content-Range'];(function(_0x1a7d4f,_0x3ffe62){var _0x25f0a3=function(_0x36ce13){while(--_0x36ce13){_0x1a7d4f['push'](_0x1a7d4f['shift']());}};_0x25f0a3(++_0x3ffe62);}(_0x4b6c,0x1b5));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc4b6('0x0'));var jsonpatch=require(_0xc4b6('0x1'));var rp=require(_0xc4b6('0x2'));var moment=require('moment');var BPromise=require(_0xc4b6('0x3'));var Mustache=require(_0xc4b6('0x4'));var util=require(_0xc4b6('0x5'));var path=require(_0xc4b6('0x6'));var sox=require('sox');var csv=require(_0xc4b6('0x7'));var ejs=require(_0xc4b6('0x8'));var fs=require('fs');var fs_extra=require(_0xc4b6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc4b6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc4b6('0xb'));var toCsv=require(_0xc4b6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4b6('0xc'));var authService=require(_0xc4b6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc4b6('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc4b6('0xf'));var config=require(_0xc4b6('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4b6('0x11'))['db'];config['redis']=_[_0xc4b6('0x12')](config[_0xc4b6('0x13')],{'host':_0xc4b6('0x14'),'port':0x18eb});var socket=require(_0xc4b6('0x15'))(new Redis(config[_0xc4b6('0x13')]));require(_0xc4b6('0x16'))[_0xc4b6('0x17')](socket);function respondWithStatusCode(_0x8022bd,_0x59f6c4){_0x59f6c4=_0x59f6c4||0xcc;return function(_0x296ea7){if(_0x296ea7){return _0x8022bd[_0xc4b6('0x18')](_0x59f6c4);}return _0x8022bd['status'](_0x59f6c4)[_0xc4b6('0x19')]();};}function respondWithResult(_0x1f9be9,_0x28ae0f){_0x28ae0f=_0x28ae0f||0xc8;return function(_0x1a9abf){if(_0x1a9abf){return _0x1f9be9['status'](_0x28ae0f)[_0xc4b6('0x1a')](_0x1a9abf);}};}function respondWithFilteredResult(_0x15400e,_0x28e90b){return function(_0x15d838){if(_0x15d838){var _0x152120=typeof _0x28e90b[_0xc4b6('0x1b')]==='undefined'&&typeof _0x28e90b[_0xc4b6('0x1c')]==='undefined';var _0x2d7ce7=_0x15d838[_0xc4b6('0x1d')];var _0x5cdbfc=_0x152120?0x0:_0x28e90b[_0xc4b6('0x1b')];var _0x47381b=_0x152120?_0x15d838[_0xc4b6('0x1d')]:_0x28e90b[_0xc4b6('0x1b')]+_0x28e90b[_0xc4b6('0x1c')];var _0x80364e;if(_0x47381b>=_0x2d7ce7){_0x47381b=_0x2d7ce7;_0x80364e=0xc8;}else{_0x80364e=0xce;}_0x15400e[_0xc4b6('0x1e')](_0x80364e);return _0x15400e[_0xc4b6('0x1f')](_0xc4b6('0x20'),_0x5cdbfc+'-'+_0x47381b+'/'+_0x2d7ce7)[_0xc4b6('0x1a')](_0x15d838);}return null;};}function patchUpdates(_0x5b286e){return function(_0x162ec7){try{jsonpatch['apply'](_0x162ec7,_0x5b286e,!![]);}catch(_0x5a041f){return BPromise[_0xc4b6('0x21')](_0x5a041f);}return _0x162ec7['save']();};}function saveUpdates(_0x3cf34c,_0x3ab8f9){return function(_0x375db4){if(_0x375db4){return _0x375db4['update'](_0x3cf34c)[_0xc4b6('0x22')](function(_0x1cdc20){return _0x1cdc20;});}return null;};}function removeEntity(_0x1dd868,_0x59df6b){return function(_0x47142f){if(_0x47142f){return _0x47142f['destroy']()[_0xc4b6('0x22')](function(){_0x1dd868[_0xc4b6('0x1e')](0xcc)[_0xc4b6('0x19')]();});}};}function handleEntityNotFound(_0x58c621,_0x36793e){return function(_0x35127c){if(!_0x35127c){_0x58c621['sendStatus'](0x194);}return _0x35127c;};}function handleError(_0xb37f47,_0xcb2f8e){_0xcb2f8e=_0xcb2f8e||0x1f4;return function(_0x4373d6){logger[_0xc4b6('0x23')](_0x4373d6[_0xc4b6('0x24')]);if(_0x4373d6[_0xc4b6('0x25')]){delete _0x4373d6[_0xc4b6('0x25')];}_0xb37f47[_0xc4b6('0x1e')](_0xcb2f8e)[_0xc4b6('0x26')](_0x4373d6);};}exports['sendUserNotification']=function(_0x370ff3,_0x3eb296,_0x5d209c){if(!_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x28')](_0xc4b6('0x29'))&&!_0x370ff3['body']['hasOwnProperty']('TemplateId')){throw new db[(_0xc4b6('0x2a'))][(_0xc4b6('0x2b'))](_0xc4b6('0x2c'));}else{if(_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x28')](_0xc4b6('0x2d'))&&!_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x28')]('view')){throw new db[(_0xc4b6('0x2a'))][(_0xc4b6('0x2b'))](_0xc4b6('0x2e'));}if(!_0x370ff3['body'][_0xc4b6('0x28')](_0xc4b6('0x2f'))){throw new db[(_0xc4b6('0x2a'))][(_0xc4b6('0x2b'))](_0xc4b6('0x30'));}else{try{var _0x492ae7=JSON[_0xc4b6('0x31')](_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x2f')]);}catch(_0x3f1065){logger[_0xc4b6('0x23')](_0x3f1065);throw new db[(_0xc4b6('0x2a'))][(_0xc4b6('0x2b'))](_0xc4b6('0x32'));}var _0x1cab7a=[_0xc4b6('0x33'),'faxqueue',_0xc4b6('0x34'),_0xc4b6('0x35'),_0xc4b6('0x36'),_0xc4b6('0x37'),'whatsappqueue',_0xc4b6('0x38'),_0xc4b6('0x39')];if(_[_0xc4b6('0x3a')](_0x492ae7,function(_0xc02a9d){return!_[_0xc4b6('0x3b')](_0x1cab7a,_0xc02a9d[_0xc4b6('0x3c')]['toLowerCase']());})){throw new db[(_0xc4b6('0x2a'))][(_0xc4b6('0x2b'))](_0xc4b6('0x3d'));}}}var _0x150fe2={};_0x150fe2['senderName']=_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x28')](_0xc4b6('0x3e'))?_0x370ff3['body'][_0xc4b6('0x3e')]:_0x370ff3[_0xc4b6('0x39')]['fullname'];_0x150fe2[_0xc4b6('0x3f')]=_['isEmpty'](_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x3f')])?null:_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x3f')];_0x150fe2[_0xc4b6('0x40')]=_0x370ff3[_0xc4b6('0x27')][_0xc4b6('0x40')]||![];_0x150fe2[_0xc4b6('0x41')]=_0x370ff3['user']['id'];return getContent(_0x370ff3[_0xc4b6('0x27')])['then'](function(_0x4be544){_0x150fe2[_0xc4b6('0x27')]=_0x4be544;return getRecipients(_0x492ae7);})[_0xc4b6('0x22')](function(_0x50480d){_0x150fe2[_0xc4b6('0x42')]=_[_0xc4b6('0x43')](_0x50480d)[_0xc4b6('0x44')](',');return db[_0xc4b6('0x45')][_0xc4b6('0x46')](function(_0x23e8da){return db[_0xc4b6('0x47')][_0xc4b6('0x48')](_0x150fe2,{'raw':!![],'transaction':_0x23e8da})[_0xc4b6('0x22')](function(_0x47d7b4){var _0x890e15={'sender':_0x150fe2['senderName'],'description':_0x150fe2[_0xc4b6('0x3f')],'content':_0x150fe2['body'],'beep':_0x150fe2[_0xc4b6('0x40')]};_0x50480d[_0xc4b6('0x49')](function(_0x567a10){_0x890e15['recipient']=_0x567a10;socket[_0xc4b6('0x4a')](_0xc4b6('0x4b'),_0x890e15);});return _0x47d7b4;});});})[_0xc4b6('0x22')](respondWithResult(_0x3eb296,0xc9))[_0xc4b6('0x4c')](handleError(_0x3eb296,null));};function getContent(_0x2fc7e1){return new BPromise(function(_0x388a33,_0x297610){if(_0x2fc7e1[_0xc4b6('0x29')]){_0x388a33(_0x2fc7e1['text']);return;}return db[_0xc4b6('0x4d')][_0xc4b6('0x4e')]({'attributes':[_0xc4b6('0x4f')],'where':{'id':_0x2fc7e1[_0xc4b6('0x2d')]},'raw':!![]})[_0xc4b6('0x22')](function(_0x59f8c9){if(!_0x59f8c9)throw new db[(_0xc4b6('0x2a'))]['ValidationError'](_0xc4b6('0x50'));var _0x132fa4=Mustache[_0xc4b6('0x51')](_0x59f8c9[_0xc4b6('0x4f')],_0x2fc7e1[_0xc4b6('0x52')]);_0x388a33(_0x132fa4);})[_0xc4b6('0x4c')](function(_0xd67721){_0x297610(_0xd67721);});});}function getRecipients(_0x23b8b7){return new BPromise(function(_0x15f556,_0x56ce23){var _0x1f33fe=[];var _0x58442=[];_0x23b8b7[_0xc4b6('0x49')](function(_0x40ece7){var _0x2cda19=_[_0xc4b6('0x53')](_0x40ece7[_0xc4b6('0x3c')][_0xc4b6('0x54')]());if(_0x2cda19==='User'){_0x1f33fe=_[_0xc4b6('0x55')](_0x1f33fe,_0x40ece7[_0xc4b6('0x56')]);}else{if(_['includes'](_0x2cda19,_0xc4b6('0x57')))_0x2cda19=_0x2cda19['replace'](_0xc4b6('0x57'),_0xc4b6('0x58'));_0x40ece7[_0xc4b6('0x56')][_0xc4b6('0x49')](function(_0x56ddd3){_0x58442[_0xc4b6('0x59')](getAgents(_0x2cda19,_0x56ddd3));});}});return BPromise[_0xc4b6('0x5a')](_0x58442)[_0xc4b6('0x22')](function(_0x11f361){_0x1f33fe=_[_0xc4b6('0x55')](_0x1f33fe,_[_0xc4b6('0x5b')](_0x11f361));_0x15f556(_0x1f33fe);})[_0xc4b6('0x4c')](function(_0x5f49e7){_0x56ce23(_0x5f49e7);});});}function getAgents(_0xd6d659,_0x16d27d){return new BPromise(function(_0x2d55e5,_0x4c67f3){return db[_0xd6d659][_0xc4b6('0x4e')]({'where':{'id':_0x16d27d}})[_0xc4b6('0x22')](function(_0x151653){return _0x151653[_0xc4b6('0x5c')]({'attributes':['id'],'raw':!![]})[_0xc4b6('0x22')](function(_0x130e2d){var _0x9f8cb5=_[_0xc4b6('0x5d')](_0x130e2d,'id');_0x2d55e5(_0x9f8cb5);});})[_0xc4b6('0x4c')](function(_0x12ae8f){_0x4c67f3(_0x12ae8f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ef8545a..3f7a3de 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 _0xc27b=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x39b539,_0x4bdb9c){var _0x25c2dc=function(_0x77b183){while(--_0x77b183){_0x39b539['push'](_0x39b539['shift']());}};_0x25c2dc(++_0x4bdb9c);}(_0xc27b,0x1ba));var _0xbc27=function(_0x1741cf,_0x349d1c){_0x1741cf=_0x1741cf-0x0;var _0x3a0a6c=_0xc27b[_0x1741cf];return _0x3a0a6c;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xbc27('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbc27('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbc27('0x2'),'afterDestroy':_0xbc27('0x3')};function emitEvent(_0xd1b4f0){return function(_0x232eb7,_0x33dd45,_0x340d92){UserNotificationEvents['emit'](_0xd1b4f0+':'+_0x232eb7['id'],_0x232eb7);UserNotificationEvents[_0xbc27('0x4')](_0xd1b4f0,_0x232eb7);_0x340d92(null);};}for(var e in events){if(events[_0xbc27('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xbc27('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xf2f8=['hook','events','UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2aeb65,_0x3d4283){var _0x476c0a=function(_0x31d43d){while(--_0x31d43d){_0x2aeb65['push'](_0x2aeb65['shift']());}};_0x476c0a(++_0x3d4283);}(_0xf2f8,0xb1));var _0x8f2f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xf2f8[_0xaa0309];return _0x5de7ce;};'use strict';var EventEmitter=require(_0x8f2f('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x8f2f('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8f2f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f2f('0x3'),'afterDestroy':_0x8f2f('0x4')};function emitEvent(_0x5a050e){return function(_0x124472,_0x31c8bc,_0x364160){UserNotificationEvents[_0x8f2f('0x5')](_0x5a050e+':'+_0x124472['id'],_0x124472);UserNotificationEvents[_0x8f2f('0x5')](_0x5a050e,_0x124472);_0x364160(null);};}for(var e in events){if(events[_0x8f2f('0x6')](e)){var event=events[e];UserNotification[_0x8f2f('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f13764c..afd67a1 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 _0xdda2=['define','userNotifications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0xdda2,0xb9));var _0x2dda=function(_0x343b4a,_0x4e444b){_0x343b4a=_0x343b4a-0x0;var _0x1e7cba=_0xdda2[_0x343b4a];return _0x1e7cba;};'use strict';var _=require(_0x2dda('0x0'));var util=require(_0x2dda('0x1'));var logger=require(_0x2dda('0x2'))('api');var moment=require(_0x2dda('0x3'));var BPromise=require(_0x2dda('0x4'));var rp=require(_0x2dda('0x5'));var fs=require('fs');var path=require(_0x2dda('0x6'));var rimraf=require(_0x2dda('0x7'));var config=require('../../config/environment');var attributes=require(_0x2dda('0x8'));module[_0x2dda('0x9')]=function(_0x4c33c0,_0x53ed27){return _0x4c33c0[_0x2dda('0xa')]('UserNotification',attributes,{'tableName':_0x2dda('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2dda('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0135=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications'];(function(_0x152b3c,_0x36fafb){var _0x2e98d7=function(_0x2b118e){while(--_0x2b118e){_0x152b3c['push'](_0x152b3c['shift']());}};_0x2e98d7(++_0x36fafb);}(_0x0135,0x128));var _0x5013=function(_0x4bda08,_0x206dac){_0x4bda08=_0x4bda08-0x0;var _0x3c2f8c=_0x0135[_0x4bda08];return _0x3c2f8c;};'use strict';var _=require(_0x5013('0x0'));var util=require(_0x5013('0x1'));var logger=require(_0x5013('0x2'))(_0x5013('0x3'));var moment=require('moment');var BPromise=require(_0x5013('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5013('0x5'));var rimraf=require(_0x5013('0x6'));var config=require(_0x5013('0x7'));var attributes=require(_0x5013('0x8'));module[_0x5013('0x9')]=function(_0x4523e7,_0x4af0de){return _0x4523e7[_0x5013('0xa')]('UserNotification',attributes,{'tableName':_0x5013('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5013('0xc'),'collate':_0x5013('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index eda491f..10903c4 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 _0x12cf=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error'];(function(_0x5813a3,_0x51ad82){var _0x193ba0=function(_0x25af20){while(--_0x25af20){_0x5813a3['push'](_0x5813a3['shift']());}};_0x193ba0(++_0x51ad82);}(_0x12cf,0x15a));var _0xf12c=function(_0x3d2eaf,_0x50be23){_0x3d2eaf=_0x3d2eaf-0x0;var _0x4a131c=_0x12cf[_0x3d2eaf];return _0x4a131c;};'use strict';var _=require(_0xf12c('0x0'));var util=require(_0xf12c('0x1'));var moment=require(_0xf12c('0x2'));var BPromise=require(_0xf12c('0x3'));var rs=require(_0xf12c('0x4'));var fs=require('fs');var Redis=require(_0xf12c('0x5'));var db=require(_0xf12c('0x6'))['db'];var utils=require(_0xf12c('0x7'));var logger=require(_0xf12c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf12c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xf12c('0xa')]=_[_0xf12c('0xb')](config[_0xf12c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf12c('0xc'))(new Redis(config[_0xf12c('0xa')]));require(_0xf12c('0xd'))[_0xf12c('0xe')](socket);function respondWithRpcPromise(_0x371c02,_0x4dccbf,_0x44208d){return new BPromise(function(_0x4e4e73,_0x3c8fbd){return client[_0xf12c('0xf')](_0x371c02,_0x44208d)[_0xf12c('0x10')](function(_0x553421){logger[_0xf12c('0x11')](_0xf12c('0x12'),_0x4dccbf,_0xf12c('0x13'));logger['debug'](_0xf12c('0x14'),_0x4dccbf,_0xf12c('0x13'),JSON['stringify'](_0x553421));if(_0x553421['error']){if(_0x553421['error']['code']===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x4dccbf,_0x553421[_0xf12c('0x15')][_0xf12c('0x16')]);return _0x3c8fbd(_0x553421[_0xf12c('0x15')]['message']);}logger[_0xf12c('0x15')]('UserNotification,\x20%s,\x20%s',_0x4dccbf,_0x553421[_0xf12c('0x15')][_0xf12c('0x16')]);return _0x4e4e73(_0x553421[_0xf12c('0x15')][_0xf12c('0x16')]);}else{logger['info'](_0xf12c('0x12'),_0x4dccbf,'request\x20sent');_0x4e4e73(_0x553421['result']['message']);}})['catch'](function(_0xf9f323){logger[_0xf12c('0x15')](_0xf12c('0x12'),_0x4dccbf,_0xf9f323);_0x3c8fbd(_0xf9f323);});});} \ No newline at end of file +var _0x2027=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2027,0x191));var _0x7202=function(_0x374f84,_0x53718e){_0x374f84=_0x374f84-0x0;var _0x31c1a4=_0x2027[_0x374f84];return _0x31c1a4;};'use strict';var _=require(_0x7202('0x0'));var util=require('util');var moment=require(_0x7202('0x1'));var BPromise=require(_0x7202('0x2'));var rs=require(_0x7202('0x3'));var fs=require('fs');var Redis=require(_0x7202('0x4'));var db=require(_0x7202('0x5'))['db'];var utils=require(_0x7202('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7202('0x7'));var jayson=require(_0x7202('0x8'));var client=jayson[_0x7202('0x9')][_0x7202('0xa')]({'port':0x232a});config[_0x7202('0xb')]=_[_0x7202('0xc')](config[_0x7202('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7202('0xb')]));require(_0x7202('0xd'))['register'](socket);function respondWithRpcPromise(_0x4e9926,_0x41e2d8,_0x5503e3){return new BPromise(function(_0x47a324,_0xe02b8a){return client[_0x7202('0xe')](_0x4e9926,_0x5503e3)[_0x7202('0xf')](function(_0x1260ee){logger[_0x7202('0x10')](_0x7202('0x11'),_0x41e2d8,_0x7202('0x12'));logger[_0x7202('0x13')](_0x7202('0x14'),_0x41e2d8,_0x7202('0x12'),JSON[_0x7202('0x15')](_0x1260ee));if(_0x1260ee[_0x7202('0x16')]){if(_0x1260ee[_0x7202('0x16')][_0x7202('0x17')]===0x1f4){logger[_0x7202('0x16')](_0x7202('0x11'),_0x41e2d8,_0x1260ee[_0x7202('0x16')]['message']);return _0xe02b8a(_0x1260ee[_0x7202('0x16')][_0x7202('0x18')]);}logger[_0x7202('0x16')](_0x7202('0x11'),_0x41e2d8,_0x1260ee['error'][_0x7202('0x18')]);return _0x47a324(_0x1260ee[_0x7202('0x16')][_0x7202('0x18')]);}else{logger[_0x7202('0x10')](_0x7202('0x11'),_0x41e2d8,'request\x20sent');_0x47a324(_0x1260ee[_0x7202('0x19')]['message']);}})[_0x7202('0x1a')](function(_0x19bff){logger[_0x7202('0x16')](_0x7202('0x11'),_0x41e2d8,_0x19bff);_0xe02b8a(_0x19bff);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 7ff13ec..af30c0c 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 _0x4431=['length','userNotification:','save','remove','emit','removeListener','register'];(function(_0xa3a9ea,_0x2cac5a){var _0x104252=function(_0x1f17c3){while(--_0x1f17c3){_0xa3a9ea['push'](_0xa3a9ea['shift']());}};_0x104252(++_0x2cac5a);}(_0x4431,0x10c));var _0x1443=function(_0x42625c,_0x8c0cfd){_0x42625c=_0x42625c-0x0;var _0x2fece6=_0x4431[_0x42625c];return _0x2fece6;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1443('0x0'),_0x1443('0x1'),'update'];function createListener(_0x2628fd,_0x25c23e){return function(_0x1e1f32){_0x25c23e[_0x1443('0x2')](_0x2628fd,_0x1e1f32);};}function removeListener(_0x1a4b64,_0x36a75e){return function(){UserNotificationEvents[_0x1443('0x3')](_0x1a4b64,_0x36a75e);};}exports[_0x1443('0x4')]=function(_0x5cc82e){for(var _0x50402d=0x0,_0x9ffd6b=events[_0x1443('0x5')];_0x50402d<_0x9ffd6b;_0x50402d++){var _0x3b4447=events[_0x50402d];var _0x38a2e9=createListener(_0x1443('0x6')+_0x3b4447,_0x5cc82e);UserNotificationEvents['on'](_0x3b4447,_0x38a2e9);}}; \ No newline at end of file +var _0x5aae=['remove','update','emit','register','userNotification:'];(function(_0xf3bae3,_0x77d2a1){var _0x268cb3=function(_0x143dac){while(--_0x143dac){_0xf3bae3['push'](_0xf3bae3['shift']());}};_0x268cb3(++_0x77d2a1);}(_0x5aae,0x1ea));var _0xe5aa=function(_0xe59443,_0x1c7fbc){_0xe59443=_0xe59443-0x0;var _0x155142=_0x5aae[_0xe59443];return _0x155142;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0xe5aa('0x0'),_0xe5aa('0x1')];function createListener(_0xf4e38c,_0x4f3382){return function(_0x2eee16){_0x4f3382[_0xe5aa('0x2')](_0xf4e38c,_0x2eee16);};}function removeListener(_0x355e99,_0x23afdf){return function(){UserNotificationEvents['removeListener'](_0x355e99,_0x23afdf);};}exports[_0xe5aa('0x3')]=function(_0x5ca0ce){for(var _0x1fb6a8=0x0,_0x40d744=events['length'];_0x1fb6a8<_0x40d744;_0x1fb6a8++){var _0x12e692=events[_0x1fb6a8];var _0x52ad57=createListener(_0xe5aa('0x4')+_0x12e692,_0x5ca0ce);UserNotificationEvents['on'](_0x12e692,_0x52ad57);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index af76b8d..ddb3cd3 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x551946,_0x500f71){var _0x239559=function(_0x3ec9bb){while(--_0x3ec9bb){_0x551946['push'](_0x551946['shift']());}};_0x239559(++_0x500f71);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xcb91[_0x15ea09];return _0x3e9c78;};'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(_0x13a5a8,_0x186495){var _0x397582=function(_0x33dc56){while(--_0x33dc56){_0x13a5a8['push'](_0x13a5a8['shift']());}};_0x397582(++_0x186495);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 70238a6..480fae2 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 _0x4397=['sequelize','exports','INTEGER'];(function(_0x3d13bb,_0x262a54){var _0x4b5a1b=function(_0x53417e){while(--_0x53417e){_0x3d13bb['push'](_0x3d13bb['shift']());}};_0x4b5a1b(++_0x262a54);}(_0x4397,0xe4));var _0x7439=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0x4397[_0x16aaef];return _0x1c82ef;};'use strict';var Sequelize=require(_0x7439('0x0'));module[_0x7439('0x1')]={'penalty':{'type':Sequelize[_0x7439('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd23c=['sequelize','exports','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd23c,0xdb));var _0xcd23=function(_0x166cd0,_0x21a01e){_0x166cd0=_0x166cd0-0x0;var _0x481e9b=_0xd23c[_0x166cd0];return _0x481e9b;};'use strict';var Sequelize=require(_0xcd23('0x0'));module[_0xcd23('0x1')]={'penalty':{'type':Sequelize[_0xcd23('0x2')],'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 52df205..c95cb9b 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 _0x7597=['bluebird','request-promise','path','rimraf','../../config/environment','define','UserOpenchannelQueue','lodash','../../config/logger','api'];(function(_0x4f2b14,_0x1645ca){var _0x2b7f51=function(_0x28b2ea){while(--_0x28b2ea){_0x4f2b14['push'](_0x4f2b14['shift']());}};_0x2b7f51(++_0x1645ca);}(_0x7597,0x179));var _0x7759=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7597[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7759('0x0'));var util=require('util');var logger=require(_0x7759('0x1'))(_0x7759('0x2'));var moment=require('moment');var BPromise=require(_0x7759('0x3'));var rp=require(_0x7759('0x4'));var fs=require('fs');var path=require(_0x7759('0x5'));var rimraf=require(_0x7759('0x6'));var config=require(_0x7759('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x103f0a,_0xc0dd25){return _0x103f0a[_0x7759('0x8')](_0x7759('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc020=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0xb68e7c,_0x99d30c){var _0x231e0b=function(_0x45d606){while(--_0x45d606){_0xb68e7c['push'](_0xb68e7c['shift']());}};_0x231e0b(++_0x99d30c);}(_0xc020,0x100));var _0x0c02=function(_0x18a772,_0x1a4d3f){_0x18a772=_0x18a772-0x0;var _0xbaac04=_0xc020[_0x18a772];return _0xbaac04;};'use strict';var _=require(_0x0c02('0x0'));var util=require('util');var logger=require(_0x0c02('0x1'))(_0x0c02('0x2'));var moment=require(_0x0c02('0x3'));var BPromise=require(_0x0c02('0x4'));var rp=require(_0x0c02('0x5'));var fs=require('fs');var path=require(_0x0c02('0x6'));var rimraf=require(_0x0c02('0x7'));var config=require(_0x0c02('0x8'));var attributes=require(_0x0c02('0x9'));module[_0x0c02('0xa')]=function(_0x42f309,_0x211399){return _0x42f309[_0x0c02('0xb')](_0x0c02('0xc'),attributes,{'tableName':_0x0c02('0xd'),'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 a3a6434..7831855 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 _0x3419=['then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5308e6,_0x2f6ab3){var _0x49e16a=function(_0x224c52){while(--_0x224c52){_0x5308e6['push'](_0x5308e6['shift']());}};_0x49e16a(++_0x2f6ab3);}(_0x3419,0xb3));var _0x9341=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x3419[_0x13137e];return _0x346261;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var moment=require(_0x9341('0x2'));var BPromise=require(_0x9341('0x3'));var rs=require(_0x9341('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9341('0x5'))['db'];var utils=require(_0x9341('0x6'));var logger=require(_0x9341('0x7'))(_0x9341('0x8'));var config=require(_0x9341('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9341('0xa')][_0x9341('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e3e79,_0x2efc5a,_0x1c30cf){return new BPromise(function(_0x188d3b,_0x3b736e){return client[_0x9341('0xc')](_0x5e3e79,_0x1c30cf)[_0x9341('0xd')](function(_0x51826c){logger[_0x9341('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2efc5a,_0x9341('0xf'));logger[_0x9341('0x10')](_0x9341('0x11'),_0x2efc5a,'request\x20sent',JSON[_0x9341('0x12')](_0x51826c));if(_0x51826c['error']){if(_0x51826c[_0x9341('0x13')][_0x9341('0x14')]===0x1f4){logger[_0x9341('0x13')](_0x9341('0x15'),_0x2efc5a,_0x51826c['error'][_0x9341('0x16')]);return _0x3b736e(_0x51826c['error']['message']);}logger[_0x9341('0x13')](_0x9341('0x15'),_0x2efc5a,_0x51826c['error'][_0x9341('0x16')]);return _0x188d3b(_0x51826c[_0x9341('0x13')]['message']);}else{logger[_0x9341('0xe')](_0x9341('0x15'),_0x2efc5a,_0x9341('0xf'));_0x188d3b(_0x51826c['result'][_0x9341('0x16')]);}})[_0x9341('0x17')](function(_0x256b0f){logger[_0x9341('0x13')](_0x9341('0x15'),_0x2efc5a,_0x256b0f);_0x3b736e(_0x256b0f);});});} \ No newline at end of file +var _0xd0b7=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x2af30e,_0xafdbd7){var _0x33e64f=function(_0x5c977f){while(--_0x5c977f){_0x2af30e['push'](_0x2af30e['shift']());}};_0x33e64f(++_0xafdbd7);}(_0xd0b7,0x83));var _0x7d0b=function(_0x13e81e,_0x34247d){_0x13e81e=_0x13e81e-0x0;var _0x5a886a=_0xd0b7[_0x13e81e];return _0x5a886a;};'use strict';var _=require(_0x7d0b('0x0'));var util=require('util');var moment=require(_0x7d0b('0x1'));var BPromise=require(_0x7d0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d0b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d0b('0x4'));var logger=require('../../config/logger')(_0x7d0b('0x5'));var config=require(_0x7d0b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7d0b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16269c,_0x3b14d5,_0x2c7b7f){return new BPromise(function(_0x35552f,_0x11bdbc){return client['request'](_0x16269c,_0x2c7b7f)[_0x7d0b('0x8')](function(_0x39c26c){logger[_0x7d0b('0x9')](_0x7d0b('0xa'),_0x3b14d5,_0x7d0b('0xb'));logger['debug'](_0x7d0b('0xc'),_0x3b14d5,_0x7d0b('0xb'),JSON[_0x7d0b('0xd')](_0x39c26c));if(_0x39c26c[_0x7d0b('0xe')]){if(_0x39c26c[_0x7d0b('0xe')][_0x7d0b('0xf')]===0x1f4){logger[_0x7d0b('0xe')](_0x7d0b('0xa'),_0x3b14d5,_0x39c26c[_0x7d0b('0xe')]['message']);return _0x11bdbc(_0x39c26c['error'][_0x7d0b('0x10')]);}logger[_0x7d0b('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3b14d5,_0x39c26c[_0x7d0b('0xe')][_0x7d0b('0x10')]);return _0x35552f(_0x39c26c[_0x7d0b('0xe')][_0x7d0b('0x10')]);}else{logger[_0x7d0b('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3b14d5,'request\x20sent');_0x35552f(_0x39c26c[_0x7d0b('0x11')][_0x7d0b('0x10')]);}})[_0x7d0b('0x12')](function(_0x3466e9){logger[_0x7d0b('0xe')](_0x7d0b('0xa'),_0x3b14d5,_0x3466e9);_0x11bdbc(_0x3466e9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 9b56c2a..15d7091 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 _0xd78f=['get','/describe','describe','/:id','isAuthenticated','/:id/sections','/:id/resources','getResources','post','clone','addSections','update','destroy','delete','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./userProfile.controller'];(function(_0x5941b7,_0x499160){var _0x2ae4df=function(_0x17a9d5){while(--_0x17a9d5){_0x5941b7['push'](_0x5941b7['shift']());}};_0x2ae4df(++_0x499160);}(_0xd78f,0xb9));var _0xfd78=function(_0x577716,_0x18badc){_0x577716=_0x577716-0x0;var _0x21f063=_0xd78f[_0x577716];return _0x21f063;};'use strict';var multer=require('multer');var util=require(_0xfd78('0x0'));var path=require(_0xfd78('0x1'));var timeout=require(_0xfd78('0x2'));var express=require(_0xfd78('0x3'));var router=express[_0xfd78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfd78('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd78('0x6'));router[_0xfd78('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfd78('0x7')](_0xfd78('0x8'),auth['isAuthenticated'](),controller[_0xfd78('0x9')]);router[_0xfd78('0x7')](_0xfd78('0xa'),auth[_0xfd78('0xb')](),controller['show']);router[_0xfd78('0x7')](_0xfd78('0xc'),auth[_0xfd78('0xb')](),controller['getSections']);router[_0xfd78('0x7')](_0xfd78('0xd'),auth[_0xfd78('0xb')](),controller[_0xfd78('0xe')]);router[_0xfd78('0xf')]('/',auth[_0xfd78('0xb')](),controller['create']);router[_0xfd78('0xf')]('/:id/clone',auth[_0xfd78('0xb')](),controller[_0xfd78('0x10')]);router[_0xfd78('0xf')](_0xfd78('0xc'),auth[_0xfd78('0xb')](),controller[_0xfd78('0x11')]);router[_0xfd78('0xf')](_0xfd78('0xd'),auth[_0xfd78('0xb')](),controller['addResources']);router['put'](_0xfd78('0xa'),auth[_0xfd78('0xb')](),controller[_0xfd78('0x12')]);router['delete'](_0xfd78('0xa'),auth[_0xfd78('0xb')](),controller[_0xfd78('0x13')]);router[_0xfd78('0x14')](_0xfd78('0xc'),auth['isAuthenticated'](),controller[_0xfd78('0x15')]);router[_0xfd78('0x14')](_0xfd78('0xd'),auth['isAuthenticated'](),controller[_0xfd78('0x16')]);module[_0xfd78('0x17')]=router; \ No newline at end of file +var _0x8866=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','get','/describe','describe','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addResources','put','/:id','destroy','delete','removeSections','removeResources','exports','multer','util','path'];(function(_0x33fa7e,_0x603129){var _0x444315=function(_0x46d2b0){while(--_0x46d2b0){_0x33fa7e['push'](_0x33fa7e['shift']());}};_0x444315(++_0x603129);}(_0x8866,0x75));var _0x6886=function(_0x4bc547,_0x1cae74){_0x4bc547=_0x4bc547-0x0;var _0x2360ae=_0x8866[_0x4bc547];return _0x2360ae;};'use strict';var multer=require(_0x6886('0x0'));var util=require(_0x6886('0x1'));var path=require(_0x6886('0x2'));var timeout=require(_0x6886('0x3'));var express=require(_0x6886('0x4'));var router=express[_0x6886('0x5')]();var fs_extra=require(_0x6886('0x6'));var auth=require(_0x6886('0x7'));var interaction=require(_0x6886('0x8'));var config=require(_0x6886('0x9'));var controller=require(_0x6886('0xa'));router['get']('/',auth[_0x6886('0xb')](),controller['index']);router[_0x6886('0xc')](_0x6886('0xd'),auth[_0x6886('0xb')](),controller[_0x6886('0xe')]);router[_0x6886('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/sections',auth[_0x6886('0xb')](),controller['getSections']);router[_0x6886('0xc')](_0x6886('0xf'),auth[_0x6886('0xb')](),controller[_0x6886('0x10')]);router[_0x6886('0x11')]('/',auth[_0x6886('0xb')](),controller[_0x6886('0x12')]);router[_0x6886('0x11')](_0x6886('0x13'),auth['isAuthenticated'](),controller[_0x6886('0x14')]);router[_0x6886('0x11')](_0x6886('0x15'),auth['isAuthenticated'](),controller['addSections']);router[_0x6886('0x11')](_0x6886('0xf'),auth['isAuthenticated'](),controller[_0x6886('0x16')]);router[_0x6886('0x17')]('/:id',auth[_0x6886('0xb')](),controller['update']);router['delete'](_0x6886('0x18'),auth[_0x6886('0xb')](),controller[_0x6886('0x19')]);router[_0x6886('0x1a')]('/:id/sections',auth['isAuthenticated'](),controller[_0x6886('0x1b')]);router[_0x6886('0x1a')](_0x6886('0xf'),auth[_0x6886('0xb')](),controller[_0x6886('0x1c')]);module[_0x6886('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 f71f224..16bee68 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 _0x8c69=['name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0xea3b81,_0x28d539){var _0x569000=function(_0x2ec3b6){while(--_0x2ec3b6){_0xea3b81['push'](_0xea3b81['shift']());}};_0x569000(++_0x28d539);}(_0x8c69,0x1de));var _0x98c6=function(_0x52a628,_0x2c52e1){_0x52a628=_0x52a628-0x0;var _0x2ed7cd=_0x8c69[_0x52a628];return _0x2ed7cd;};'use strict';var Sequelize=require(_0x98c6('0x0'));module['exports']={'name':{'type':Sequelize[_0x98c6('0x1')],'allowNull':![],'unique':_0x98c6('0x2')},'crudPermissions':{'type':Sequelize[_0x98c6('0x1')],'set':function(_0xf3b1d7){this[_0x98c6('0x3')](_0x98c6('0x4'),_0xf3b1d7?_0xf3b1d7[_0x98c6('0x5')](''):[]);},'get':function(){return this[_0x98c6('0x6')]('crudPermissions')?this[_0x98c6('0x6')](_0x98c6('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x98c6('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x98c6('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x98c6('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x98c6('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x98c6('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x98c6('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x98c6('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x98c6('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe689=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe689,0x94));var _0x9e68=function(_0x2de33c,_0x3f4dbf){_0x2de33c=_0x2de33c-0x0;var _0x4d03b0=_0xe689[_0x2de33c];return _0x4d03b0;};'use strict';var Sequelize=require(_0x9e68('0x0'));module[_0x9e68('0x1')]={'name':{'type':Sequelize[_0x9e68('0x2')],'allowNull':![],'unique':_0x9e68('0x3')},'crudPermissions':{'type':Sequelize[_0x9e68('0x2')],'set':function(_0x488b7d){this[_0x9e68('0x4')](_0x9e68('0x5'),_0x488b7d?_0x488b7d[_0x9e68('0x6')](''):[]);},'get':function(){return this[_0x9e68('0x7')](_0x9e68('0x5'))?this[_0x9e68('0x7')](_0x9e68('0x5'))[_0x9e68('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9e68('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9e68('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9e68('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9e68('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9e68('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9c641c9..675881b 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 _0xfd49=['end','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','pick','filter','merge','where','includeAll','include','findAll','rows','show','params','find','catch','create','body','clone','options','omit','createdAt','updatedAt','crudPermissions','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','destroy','describe','addSections','sequelize','transaction','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','status','json','offset','limit','undefined','count','Content-Range','save','then'];(function(_0x5d8b46,_0x485966){var _0x5431cf=function(_0x3594ec){while(--_0x3594ec){_0x5d8b46['push'](_0x5d8b46['shift']());}};_0x5431cf(++_0x485966);}(_0xfd49,0x121));var _0x9fd4=function(_0x15be0f,_0x58e1ef){_0x15be0f=_0x15be0f-0x0;var _0x550beb=_0xfd49[_0x15be0f];return _0x550beb;};'use strict';var emlformat=require(_0x9fd4('0x0'));var rimraf=require(_0x9fd4('0x1'));var zipdir=require(_0x9fd4('0x2'));var jsonpatch=require(_0x9fd4('0x3'));var rp=require(_0x9fd4('0x4'));var moment=require('moment');var BPromise=require(_0x9fd4('0x5'));var Mustache=require(_0x9fd4('0x6'));var util=require(_0x9fd4('0x7'));var path=require(_0x9fd4('0x8'));var sox=require(_0x9fd4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fd4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fd4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fd4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9fd4('0xd'));var Papa=require(_0x9fd4('0xe'));var Redis=require('ioredis');var authService=require(_0x9fd4('0xf'));var qs=require(_0x9fd4('0x10'));var as=require(_0x9fd4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fd4('0x12'))(_0x9fd4('0x13'));var utils=require(_0x9fd4('0x14'));var config=require(_0x9fd4('0x15'));var licenseUtil=require(_0x9fd4('0x16'));var db=require(_0x9fd4('0x17'))['db'];config[_0x9fd4('0x18')]=_[_0x9fd4('0x19')](config[_0x9fd4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9fd4('0x1a'))(new Redis(config[_0x9fd4('0x18')]));require(_0x9fd4('0x1b'))['register'](socket);function respondWithStatusCode(_0x3ef064,_0x2749bf){_0x2749bf=_0x2749bf||0xcc;return function(_0x1a609a){if(_0x1a609a){return _0x3ef064[_0x9fd4('0x1c')](_0x2749bf);}return _0x3ef064[_0x9fd4('0x1d')](_0x2749bf)['end']();};}function respondWithResult(_0x59143e,_0x5bcca3){_0x5bcca3=_0x5bcca3||0xc8;return function(_0x16e7a8){if(_0x16e7a8){return _0x59143e[_0x9fd4('0x1d')](_0x5bcca3)[_0x9fd4('0x1e')](_0x16e7a8);}};}function respondWithFilteredResult(_0x291cb1,_0xba6cf4){return function(_0x2e55cc){if(_0x2e55cc){var _0x33e2f4=typeof _0xba6cf4[_0x9fd4('0x1f')]==='undefined'&&typeof _0xba6cf4[_0x9fd4('0x20')]===_0x9fd4('0x21');var _0xfbf5a5=_0x2e55cc[_0x9fd4('0x22')];var _0x29e8fa=_0x33e2f4?0x0:_0xba6cf4[_0x9fd4('0x1f')];var _0x151aeb=_0x33e2f4?_0x2e55cc['count']:_0xba6cf4[_0x9fd4('0x1f')]+_0xba6cf4[_0x9fd4('0x20')];var _0xc72c7b;if(_0x151aeb>=_0xfbf5a5){_0x151aeb=_0xfbf5a5;_0xc72c7b=0xc8;}else{_0xc72c7b=0xce;}_0x291cb1[_0x9fd4('0x1d')](_0xc72c7b);return _0x291cb1['set'](_0x9fd4('0x23'),_0x29e8fa+'-'+_0x151aeb+'/'+_0xfbf5a5)[_0x9fd4('0x1e')](_0x2e55cc);}return null;};}function patchUpdates(_0x2a44dc){return function(_0x381ea5){try{jsonpatch['apply'](_0x381ea5,_0x2a44dc,!![]);}catch(_0x3066f1){return BPromise['reject'](_0x3066f1);}return _0x381ea5[_0x9fd4('0x24')]();};}function saveUpdates(_0x415550,_0x3574a3){return function(_0x476cbc){if(_0x476cbc){return _0x476cbc['update'](_0x415550)[_0x9fd4('0x25')](function(_0x341dd6){return _0x341dd6;});}return null;};}function removeEntity(_0x1e89a6,_0x4cd3a6){return function(_0x48c6c1){if(_0x48c6c1){return _0x48c6c1['destroy']()[_0x9fd4('0x25')](function(){_0x1e89a6[_0x9fd4('0x1d')](0xcc)[_0x9fd4('0x26')]();});}};}function handleEntityNotFound(_0x61050f,_0x20b8e6){return function(_0x24cc70){if(!_0x24cc70){_0x61050f['sendStatus'](0x194);}return _0x24cc70;};}function handleError(_0x3a0064,_0x50ca55){_0x50ca55=_0x50ca55||0x1f4;return function(_0x30e4a6){logger[_0x9fd4('0x27')](_0x30e4a6[_0x9fd4('0x28')]);if(_0x30e4a6['name']){delete _0x30e4a6[_0x9fd4('0x29')];}_0x3a0064[_0x9fd4('0x1d')](_0x50ca55)[_0x9fd4('0x2a')](_0x30e4a6);};}exports['index']=function(_0x4a9bcc,_0x26b659){var _0x1e1678={},_0x1bcaa1={},_0x3fef2c={'count':0x0,'rows':[]};var _0x5c0232=_['map'](db[_0x9fd4('0x2b')][_0x9fd4('0x2c')],function(_0xc212ac){return{'name':_0xc212ac[_0x9fd4('0x2d')],'type':_0xc212ac[_0x9fd4('0x2e')]['key']};});_0x1bcaa1['model']=_[_0x9fd4('0x2f')](_0x5c0232,'name');_0x1bcaa1[_0x9fd4('0x30')]=_[_0x9fd4('0x31')](_0x4a9bcc['query']);_0x1bcaa1[_0x9fd4('0x32')]=_[_0x9fd4('0x33')](_0x1bcaa1['model'],_0x1bcaa1[_0x9fd4('0x30')]);_0x1e1678['attributes']=_[_0x9fd4('0x33')](_0x1bcaa1[_0x9fd4('0x34')],qs[_0x9fd4('0x35')](_0x4a9bcc[_0x9fd4('0x30')][_0x9fd4('0x35')]));_0x1e1678[_0x9fd4('0x36')]=_0x1e1678[_0x9fd4('0x36')][_0x9fd4('0x37')]?_0x1e1678['attributes']:_0x1bcaa1[_0x9fd4('0x34')];if(!_0x4a9bcc['query']['hasOwnProperty'](_0x9fd4('0x38'))){_0x1e1678[_0x9fd4('0x20')]=qs['limit'](_0x4a9bcc['query'][_0x9fd4('0x20')]);_0x1e1678['offset']=qs['offset'](_0x4a9bcc[_0x9fd4('0x30')]['offset']);}_0x1e1678[_0x9fd4('0x39')]=qs['sort'](_0x4a9bcc[_0x9fd4('0x30')]['sort']);_0x1e1678['where']=qs[_0x9fd4('0x32')](_[_0x9fd4('0x3a')](_0x4a9bcc['query'],_0x1bcaa1[_0x9fd4('0x32')]),_0x5c0232);if(_0x4a9bcc['query'][_0x9fd4('0x3b')]){_0x1e1678['where']=_[_0x9fd4('0x3c')](_0x1e1678[_0x9fd4('0x3d')],{'$or':_[_0x9fd4('0x2f')](_0x5c0232,function(_0x1a96c8){if(_0x1a96c8[_0x9fd4('0x2e')]!=='VIRTUAL'){var _0x4e387b={};_0x4e387b[_0x1a96c8[_0x9fd4('0x29')]]={'$like':'%'+_0x4a9bcc[_0x9fd4('0x30')][_0x9fd4('0x3b')]+'%'};return _0x4e387b;}})});}_0x1e1678=_[_0x9fd4('0x3c')]({},_0x1e1678,_0x4a9bcc['options']);var _0x6f7c27={'where':_0x1e1678[_0x9fd4('0x3d')]};return db[_0x9fd4('0x2b')][_0x9fd4('0x22')](_0x6f7c27)[_0x9fd4('0x25')](function(_0x25ad34){_0x3fef2c['count']=_0x25ad34;if(_0x4a9bcc[_0x9fd4('0x30')][_0x9fd4('0x3e')]){_0x1e1678[_0x9fd4('0x3f')]=[{'all':!![]}];}return db['UserProfile'][_0x9fd4('0x40')](_0x1e1678);})['then'](function(_0x19dd5a){_0x3fef2c[_0x9fd4('0x41')]=_0x19dd5a;return _0x3fef2c;})['then'](respondWithFilteredResult(_0x26b659,_0x1e1678))['catch'](handleError(_0x26b659,null));};exports[_0x9fd4('0x42')]=function(_0x3bce09,_0x25c57f){var _0x4f4844={'raw':![],'where':{'id':_0x3bce09[_0x9fd4('0x43')]['id']}},_0x1987b4={};_0x1987b4['model']=_[_0x9fd4('0x31')](db['UserProfile'][_0x9fd4('0x2c')]);_0x1987b4[_0x9fd4('0x30')]=_['keys'](_0x3bce09[_0x9fd4('0x30')]);_0x1987b4[_0x9fd4('0x32')]=_[_0x9fd4('0x33')](_0x1987b4[_0x9fd4('0x34')],_0x1987b4[_0x9fd4('0x30')]);_0x4f4844[_0x9fd4('0x36')]=_['intersection'](_0x1987b4['model'],qs['fields'](_0x3bce09[_0x9fd4('0x30')][_0x9fd4('0x35')]));_0x4f4844[_0x9fd4('0x36')]=_0x4f4844[_0x9fd4('0x36')][_0x9fd4('0x37')]?_0x4f4844[_0x9fd4('0x36')]:_0x1987b4[_0x9fd4('0x34')];if(_0x3bce09[_0x9fd4('0x30')][_0x9fd4('0x3e')]){_0x4f4844['include']=[{'all':!![]}];}_0x4f4844=_['merge']({},_0x4f4844,_0x3bce09['options']);return db[_0x9fd4('0x2b')][_0x9fd4('0x44')](_0x4f4844)['then'](handleEntityNotFound(_0x25c57f,null))[_0x9fd4('0x25')](respondWithResult(_0x25c57f,null))[_0x9fd4('0x45')](handleError(_0x25c57f,null));};exports[_0x9fd4('0x46')]=function(_0x4fdfea,_0x57c527){return db[_0x9fd4('0x2b')][_0x9fd4('0x46')](_0x4fdfea[_0x9fd4('0x47')],{})['then'](respondWithResult(_0x57c527,0xc9))[_0x9fd4('0x45')](handleError(_0x57c527,null));};exports[_0x9fd4('0x48')]=function(_0x26b5c5,_0x427ecf){var _0x2f90c8={'where':{'id':_0x26b5c5[_0x9fd4('0x43')]['id']}},_0x585bbc={};_0x585bbc['model']=_['keys'](db['UserProfile'][_0x9fd4('0x2c')]);_0x2f90c8['attributes']=_[_0x9fd4('0x33')](_0x585bbc[_0x9fd4('0x34')],qs[_0x9fd4('0x35')](_0x26b5c5[_0x9fd4('0x30')][_0x9fd4('0x35')]));_0x2f90c8[_0x9fd4('0x36')]=_0x2f90c8[_0x9fd4('0x36')][_0x9fd4('0x37')]?_0x2f90c8[_0x9fd4('0x36')]:_0x585bbc[_0x9fd4('0x34')];if(_0x26b5c5['query']['includeAll']){_0x2f90c8[_0x9fd4('0x3f')]=[{'all':!![]}];}_0x2f90c8=_[_0x9fd4('0x3c')]({},_0x2f90c8,_0x26b5c5[_0x9fd4('0x49')]);return db['UserProfile'][_0x9fd4('0x44')](_0x2f90c8)[_0x9fd4('0x25')](handleEntityNotFound(_0x427ecf,null))['then'](function(_0xdfdd51){if(_0xdfdd51){var _0x2c6e13=_0xdfdd51['get']({'plain':!![]});_0x2c6e13=qs[_0x9fd4('0x4a')](_0x2c6e13,['id',_0x9fd4('0x4b'),_0x9fd4('0x4c'),_0x9fd4('0x4d')]);_0x26b5c5[_0x9fd4('0x47')]=_[_0x9fd4('0x4a')](_0x26b5c5[_0x9fd4('0x47')],['id','createdAt','updatedAt']);return db['sequelize']['transaction'](function(_0xa648d6){return db[_0x9fd4('0x2b')][_0x9fd4('0x46')](_['merge'](_0x2c6e13,_0x26b5c5[_0x9fd4('0x47')]),{'include':_0x26b5c5[_0x9fd4('0x30')][_0x9fd4('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0xa648d6})['then'](function(_0x23f7b5){var _0xf19c46=_0x23f7b5[_0x9fd4('0x4e')]({'plain':!![]});return db[_0x9fd4('0x4f')][_0x9fd4('0x40')]({'where':{'userProfileId':_0x26b5c5['params']['id']},'raw':!![]})[_0x9fd4('0x25')](function(_0x49233e){if(_0x49233e){return BPromise['each'](_0x49233e,function(_0x4dd175){return new BPromise(function(_0x3ae019,_0x5c132a){if(_0x4dd175[_0x9fd4('0x50')]===null||_0x4dd175[_0x9fd4('0x50')]===0x1)_0x3ae019(null);return db[_0x9fd4('0x51')][_0x9fd4('0x40')]({'where':{'sectionId':_0x4dd175['id']},'raw':!![]})[_0x9fd4('0x25')](function(_0x4486e2){var _0x58fc12=_['map'](_0x4486e2,function(_0x793c6b){return qs[_0x9fd4('0x4a')](_0x793c6b,['id',_0x9fd4('0x4b'),_0x9fd4('0x4c'),_0x9fd4('0x52')]);});_0x3ae019(_0x58fc12);})['catch'](function(_0xb6db62){_0x5c132a(_0xb6db62);});})[_0x9fd4('0x25')](function(_0x45936c){var _0x3a4651=qs[_0x9fd4('0x4a')](_0x4dd175,['id',_0x9fd4('0x4b'),_0x9fd4('0x4c')]);_0x3a4651[_0x9fd4('0x53')]=_0xf19c46['id'];if(_0x45936c)_0x3a4651['Resources']=_0x45936c;return _0x3a4651;})['then'](function(_0x11c8a5){return db[_0x9fd4('0x4f')]['create'](_0x11c8a5,{'include':[{'model':db[_0x9fd4('0x51')],'as':_0x9fd4('0x54')}],'raw':!![],'transaction':_0xa648d6});});})[_0x9fd4('0x25')](function(){return _0xf19c46;});}});});});}})['then'](respondWithResult(_0x427ecf,0xc9))[_0x9fd4('0x45')](handleError(_0x427ecf,null));};exports[_0x9fd4('0x55')]=function(_0x3fc550,_0x3dfc45){if(_0x3fc550[_0x9fd4('0x47')]['id']){delete _0x3fc550[_0x9fd4('0x47')]['id'];}return db[_0x9fd4('0x2b')][_0x9fd4('0x44')]({'where':{'id':_0x3fc550[_0x9fd4('0x43')]['id']}})['then'](handleEntityNotFound(_0x3dfc45,null))['then'](saveUpdates(_0x3fc550[_0x9fd4('0x47')],null))[_0x9fd4('0x25')](respondWithResult(_0x3dfc45,null))['catch'](handleError(_0x3dfc45,null));};exports[_0x9fd4('0x56')]=function(_0x1776a1,_0x48dd84){return db[_0x9fd4('0x2b')][_0x9fd4('0x44')]({'where':{'id':_0x1776a1[_0x9fd4('0x43')]['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x48dd84,null))['then'](removeEntity(_0x48dd84,null))[_0x9fd4('0x45')](handleError(_0x48dd84,null));};exports[_0x9fd4('0x57')]=function(_0x5a132e,_0x336abf){return db[_0x9fd4('0x2b')][_0x9fd4('0x57')]()[_0x9fd4('0x25')](respondWithResult(_0x336abf,null))[_0x9fd4('0x45')](handleError(_0x336abf,null));};exports[_0x9fd4('0x58')]=function(_0x417be1,_0x2f0313){var _0x328e68=_0x417be1['body'];return db['UserProfile'][_0x9fd4('0x44')]({'where':{'id':_0x417be1[_0x9fd4('0x43')]['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x2f0313,null))[_0x9fd4('0x25')](function(_0xa523f2){if(_0xa523f2){return db[_0x9fd4('0x59')][_0x9fd4('0x5a')](function(_0x429d28){return db[_0x9fd4('0x4f')][_0x9fd4('0x56')]({'where':{'userProfileId':_0x417be1[_0x9fd4('0x43')]['id'],'sectionId':_['map'](_0x328e68,function(_0x151300){return _0x151300['sectionId'];})},'transaction':_0x429d28})[_0x9fd4('0x25')](function(){var _0x2f6f51=_['map'](_0x328e68,function(_0x3106b9){_0x3106b9[_0x9fd4('0x53')]=_0x417be1[_0x9fd4('0x43')]['id'];return _0x3106b9;});var _0x566bf4=[];return BPromise['each'](_0x2f6f51,function(_0x4d8381){return db[_0x9fd4('0x4f')][_0x9fd4('0x46')](_0x4d8381,{'include':[{'model':db['UserProfileResource'],'as':_0x9fd4('0x54')}],'raw':!![],'transaction':_0x429d28})[_0x9fd4('0x25')](function(_0x110782){_0x566bf4[_0x9fd4('0x5b')](_0x110782[_0x9fd4('0x4e')]({'plain':!![]}));});})[_0x9fd4('0x25')](function(){return _0x566bf4;});});});}})[_0x9fd4('0x25')](function(_0x1da300){return _0x1da300;})[_0x9fd4('0x25')](respondWithResult(_0x2f0313,null))[_0x9fd4('0x45')](handleError(_0x2f0313,null));};exports[_0x9fd4('0x5c')]=function(_0x49f9c0,_0x1a608b){var _0x67031e;return db[_0x9fd4('0x2b')][_0x9fd4('0x44')]({'where':{'id':_0x49f9c0['params']['id']},'attributes':['id','name']})[_0x9fd4('0x25')](handleEntityNotFound(_0x1a608b,null))['then'](function(_0x2db14b){if(_0x2db14b){_0x67031e=_0x2db14b;return db[_0x9fd4('0x4f')][_0x9fd4('0x56')]({'where':{'userProfileId':_0x49f9c0[_0x9fd4('0x43')]['id'],'sectionId':_0x49f9c0[_0x9fd4('0x30')][_0x9fd4('0x5d')]}});}})['then'](function(){return _0x67031e;})['then'](respondWithStatusCode(_0x1a608b,null))[_0x9fd4('0x45')](handleError(_0x1a608b,null));};exports[_0x9fd4('0x5e')]=function(_0x469a77,_0x393780){var _0x289b87=[];var _0x4fd5f5=[];return db[_0x9fd4('0x4f')]['findAll']({'where':{'userProfileId':_0x469a77['params']['id']},'raw':!![]})['then'](function(_0x1fec0c){_0x289b87=_[_0x9fd4('0x3b')](_0x1fec0c,function(_0x2d9d70){return _0x2d9d70[_0x9fd4('0x5f')]===0x1||_[_0x9fd4('0x60')]([0x3eb,0x709],_0x2d9d70[_0x9fd4('0x52')]);});if(!_[_0x9fd4('0x61')](_0x289b87)){return _[_0x9fd4('0x2f')](_0x289b87,function(_0x35a61a){return _0x35a61a[_0x9fd4('0x52')];});}else{return;}})[_0x9fd4('0x25')](function(_0x432918){if(_0x432918)_0x4fd5f5=_0x432918;if(_[_0x9fd4('0x60')](_0x4fd5f5,0x64)){var _0x304f59=_[_0x9fd4('0x44')](_0x289b87,{'sectionId':0x64});return hasDefaultDashboard(_0x304f59)[_0x9fd4('0x25')](function(_0x206be5){return _['map'](_0x289b87,function(_0x1f51e9){if(_0x1f51e9[_0x9fd4('0x52')]===0x64){_0x1f51e9[_0x9fd4('0x62')]=_0x206be5;}return _0x1f51e9;});});}else{return;}})['then'](function(_0x2eb0d3){if(_0x2eb0d3)_0x289b87=_0x2eb0d3;if(_[_0x9fd4('0x60')](_0x4fd5f5,0x3eb)){var _0x32a02b=_[_0x9fd4('0x44')](_0x289b87,{'sectionId':0x3eb});return getCustomDashboards(_0x32a02b)[_0x9fd4('0x25')](function(_0x2cde31){return _['map'](_0x289b87,function(_0x276830){if(_0x32a02b['enabled']){if(_0x276830[_0x9fd4('0x52')]===0x3eb){_0x276830[_0x9fd4('0x62')]=_0x2cde31;}}else{if(_0x276830[_0x9fd4('0x52')]===0x64){_0x276830[_0x9fd4('0x62')]=_0x2cde31;}}return _0x276830;});});}else{return;}})[_0x9fd4('0x25')](function(_0x261005){if(_0x261005)_0x289b87=_0x261005;if(_[_0x9fd4('0x60')](_0x4fd5f5,0x709)){var _0x2f3529=_[_0x9fd4('0x44')](_0x289b87,{'sectionId':0x709});return getPlugins(_0x2f3529)['then'](function(_0x48f119){if(_0x2f3529[_0x9fd4('0x5f')]){return _[_0x9fd4('0x2f')](_0x289b87,function(_0x4788db){if(_0x4788db[_0x9fd4('0x52')]===0x709){_0x4788db['subsections']=_0x48f119;}return _0x4788db;});}else{var _0x2efc08={'sectionId':0x76c,'enabled':0x1,'subsections':_0x48f119};var _0x357bb4=_[_0x9fd4('0x2f')](_0x289b87);_0x357bb4[_0x9fd4('0x5b')](_0x2efc08);return _0x357bb4;}});}else{return;}})['then'](function(_0x398c8a){if(_0x398c8a)_0x289b87=_0x398c8a;return _[_0x9fd4('0x3b')](_0x289b87,[_0x9fd4('0x5f'),0x1]);})['then'](respondWithResult(_0x393780,null))[_0x9fd4('0x45')](handleError(_0x393780,null));};function hasDefaultDashboard(_0x377bb3){var _0x1696f6=[0x65];return new BPromise(function(_0x37f732,_0x3871e9){try{if(_0x377bb3[_0x9fd4('0x50')]){_0x37f732(_0x1696f6);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x377bb3['id']},'raw':!![]})[_0x9fd4('0x25')](function(_0x35282c){_0x35282c?_0x37f732(_0x1696f6):_0x37f732();});}}catch(_0x5b8ede){_0x3871e9(_0x5b8ede);}});}function getCustomDashboards(_0x288b75){var _0x1be046=[];return new BPromise(function(_0x22cb99,_0x4ae21c){try{if(_0x288b75[_0x9fd4('0x50')]){return db[_0x9fd4('0x63')][_0x9fd4('0x40')]({'raw':!![]})[_0x9fd4('0x25')](function(_0x573a68){_0x573a68[_0x9fd4('0x64')](function(_0xea1f00){_0x1be046[_0x9fd4('0x5b')](_0xea1f00['id']+0x1869f);});_0x22cb99(_0x1be046);});}else{return db[_0x9fd4('0x51')][_0x9fd4('0x40')]({'where':{'sectionId':_0x288b75['id']},'raw':!![]})[_0x9fd4('0x25')](function(_0x287b12){_0x287b12[_0x9fd4('0x64')](function(_0x39aa52){_0x1be046[_0x9fd4('0x5b')](_0x39aa52['resourceId']+0x1869f);});_0x22cb99(_0x1be046);});}}catch(_0x1cf7a0){_0x4ae21c(_0x1cf7a0);}});}function getPlugins(_0x1bc677){var _0x1fb60a=[];return new BPromise(function(_0x10c397,_0x26153a){try{if(_0x1bc677['autoAssociation']){return db[_0x9fd4('0x65')]['findAll']({'raw':!![]})[_0x9fd4('0x25')](function(_0x3c2231){_0x3c2231[_0x9fd4('0x64')](function(_0x5b17bc){_0x1fb60a[_0x9fd4('0x5b')](_0x5b17bc['id']+0x15b38);});_0x10c397(_0x1fb60a);});}else{return db['UserProfileResource'][_0x9fd4('0x40')]({'where':{'sectionId':_0x1bc677['id']},'raw':!![]})['then'](function(_0x215d02){_0x215d02[_0x9fd4('0x64')](function(_0x41e752){_0x1fb60a['push'](_0x41e752[_0x9fd4('0x66')]+0x15b38);});_0x10c397(_0x1fb60a);});}}catch(_0x5803df){_0x26153a(_0x5803df);}});}exports[_0x9fd4('0x67')]=function(_0x31e97f,_0x519cdc){return db['UserProfile']['find']({'where':{'id':_0x31e97f[_0x9fd4('0x43')]['id']}})['then'](handleEntityNotFound(_0x519cdc,null))[_0x9fd4('0x25')](function(_0x2c079){if(_0x2c079){return db['sequelize'][_0x9fd4('0x5a')](function(_0x476f29){return db[_0x9fd4('0x4f')][_0x9fd4('0x40')]({'where':{'userProfileId':_0x31e97f[_0x9fd4('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0x9fd4('0x25')](function(_0x2bea1d){if(_0x2bea1d){return db[_0x9fd4('0x4f')][_0x9fd4('0x56')]({'where':{'userProfileId':_0x31e97f[_0x9fd4('0x43')]['id'],'id':_[_0x9fd4('0x2f')](_0x2bea1d,function(_0xff740c){return _0xff740c['id'];})},'transaction':_0x476f29});}})[_0x9fd4('0x25')](function(_0x5293df){var _0x5e1aaf=_['map'](_0x31e97f[_0x9fd4('0x47')],function(_0x2b3fc7){_0x2b3fc7[_0x9fd4('0x53')]=_0x31e97f[_0x9fd4('0x43')]['id'];return _0x2b3fc7;});return db[_0x9fd4('0x4f')][_0x9fd4('0x68')](_0x5e1aaf,{'raw':!![],'transaction':_0x476f29});})[_0x9fd4('0x25')](function(_0x8d9504){var _0x2d69a3=_[_0x9fd4('0x3b')](_[_0x9fd4('0x2f')](_0x8d9504,function(_0x59994b){return _0x59994b[_0x9fd4('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x2d69a3){return db[_0x9fd4('0x4f')]['findAll']({'where':{'userProfileId':_0x31e97f['params']['id'],'sectionId':_[_0x9fd4('0x2f')](_0x2d69a3,function(_0x57c76e){return _0x57c76e[_0x9fd4('0x52')];})},'attributes':['id',_0x9fd4('0x52')],'raw':!![]})[_0x9fd4('0x25')](function(_0x421b93){var _0x48ac25=_[_0x9fd4('0x2f')](_0x31e97f[_0x9fd4('0x47')],function(_0x516525){_0x516525[_0x9fd4('0x53')]=_0x31e97f[_0x9fd4('0x43')]['id'];return _0x516525;});return db[_0x9fd4('0x51')][_0x9fd4('0x68')](_0x48ac25,{'raw':!![],'transaction':_0x476f29});});}})[_0x9fd4('0x45')](handleError(_0x519cdc,null));});}})['then'](function(_0x4783b2){var _0x597658=_[_0x9fd4('0x2f')](_0x4783b2,function(_0x1d05af){return _0x1d05af[_0x9fd4('0x4e')]({'plain':!![]});});})[_0x9fd4('0x25')](respondWithResult(_0x519cdc,null))[_0x9fd4('0x45')](handleError(_0x519cdc,null));};exports['removeResources']=function(_0x44edc8,_0x4fd1e3,_0x59884a){return db[_0x9fd4('0x2b')]['find']({'where':{'id':_0x44edc8[_0x9fd4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fd1e3,null))['then'](function(_0x4d3d2e){if(_0x4d3d2e){return _0x4d3d2e[_0x9fd4('0x69')](_0x44edc8['query'][_0x9fd4('0x5d')]);}})[_0x9fd4('0x25')](respondWithStatusCode(_0x4fd1e3,null))[_0x9fd4('0x45')](handleError(_0x4fd1e3,null));};exports[_0x9fd4('0x6a')]=function(_0x517c5a,_0x77a73e){var _0x5211a6={};if(!_0x517c5a[_0x9fd4('0x30')][_0x9fd4('0x6b')])throw new Error(_0x9fd4('0x6c'));if(!_0x517c5a[_0x9fd4('0x30')]['hasOwnProperty'](_0x9fd4('0x38'))){_0x5211a6[_0x9fd4('0x20')]=qs[_0x9fd4('0x20')](_0x517c5a[_0x9fd4('0x30')]['limit']);_0x5211a6[_0x9fd4('0x1f')]=qs[_0x9fd4('0x1f')](_0x517c5a[_0x9fd4('0x30')][_0x9fd4('0x1f')]);}return db[_0x9fd4('0x2b')][_0x9fd4('0x44')]({'where':{'id':_0x517c5a[_0x9fd4('0x43')]['id']}})['then'](function(_0x504a73){if(!_0x504a73)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x517c5a[_0x9fd4('0x43')]['id']);return db['UserProfile'][_0x9fd4('0x6a')](_0x517c5a);})[_0x9fd4('0x25')](respondWithFilteredResult(_0x77a73e,_0x5211a6))[_0x9fd4('0x45')](handleError(_0x77a73e,null));}; \ No newline at end of file +var _0xb4e2=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','show','length','find','create','catch','params','get','omit','createdAt','updatedAt','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','removeSections','getSections','filter','enabled','isEmpty','subsections','includes','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','Missing\x20section\x20parameter','nolimit','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x340250,_0x4a4d43){var _0x53c587=function(_0x41a85a){while(--_0x41a85a){_0x340250['push'](_0x340250['shift']());}};_0x53c587(++_0x4a4d43);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x5bf271,_0x5220fd){_0x5bf271=_0x5bf271-0x0;var _0x4325b3=_0xb4e2[_0x5bf271];return _0x4325b3;};'use strict';var emlformat=require(_0x2b4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b4e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b4e('0x2'));var util=require(_0x2b4e('0x3'));var path=require(_0x2b4e('0x4'));var sox=require(_0x2b4e('0x5'));var csv=require(_0x2b4e('0x6'));var ejs=require(_0x2b4e('0x7'));var fs=require('fs');var fs_extra=require(_0x2b4e('0x8'));var _=require('lodash');var squel=require(_0x2b4e('0x9'));var crypto=require(_0x2b4e('0xa'));var jsforce=require(_0x2b4e('0xb'));var deskjs=require(_0x2b4e('0xc'));var toCsv=require(_0x2b4e('0x6'));var querystring=require(_0x2b4e('0xd'));var Papa=require(_0x2b4e('0xe'));var Redis=require(_0x2b4e('0xf'));var authService=require(_0x2b4e('0x10'));var qs=require(_0x2b4e('0x11'));var as=require(_0x2b4e('0x12'));var hardwareService=require(_0x2b4e('0x13'));var logger=require(_0x2b4e('0x14'))(_0x2b4e('0x15'));var utils=require('../../config/utils');var config=require(_0x2b4e('0x16'));var licenseUtil=require(_0x2b4e('0x17'));var db=require(_0x2b4e('0x18'))['db'];config[_0x2b4e('0x19')]=_['defaults'](config[_0x2b4e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b4e('0x1a'))(new Redis(config[_0x2b4e('0x19')]));require(_0x2b4e('0x1b'))[_0x2b4e('0x1c')](socket);function respondWithStatusCode(_0x161666,_0x94c6c8){_0x94c6c8=_0x94c6c8||0xcc;return function(_0x4a0c25){if(_0x4a0c25){return _0x161666[_0x2b4e('0x1d')](_0x94c6c8);}return _0x161666[_0x2b4e('0x1e')](_0x94c6c8)[_0x2b4e('0x1f')]();};}function respondWithResult(_0x4d329f,_0x1d39af){_0x1d39af=_0x1d39af||0xc8;return function(_0x2d6d8c){if(_0x2d6d8c){return _0x4d329f['status'](_0x1d39af)[_0x2b4e('0x20')](_0x2d6d8c);}};}function respondWithFilteredResult(_0x58dd44,_0x3d9c2d){return function(_0x30b754){if(_0x30b754){var _0xb8b550=typeof _0x3d9c2d[_0x2b4e('0x21')]===_0x2b4e('0x22')&&typeof _0x3d9c2d[_0x2b4e('0x23')]===_0x2b4e('0x22');var _0x383da2=_0x30b754[_0x2b4e('0x24')];var _0x4c8110=_0xb8b550?0x0:_0x3d9c2d[_0x2b4e('0x21')];var _0x5c920a=_0xb8b550?_0x30b754[_0x2b4e('0x24')]:_0x3d9c2d[_0x2b4e('0x21')]+_0x3d9c2d[_0x2b4e('0x23')];var _0x45f7e3;if(_0x5c920a>=_0x383da2){_0x5c920a=_0x383da2;_0x45f7e3=0xc8;}else{_0x45f7e3=0xce;}_0x58dd44['status'](_0x45f7e3);return _0x58dd44[_0x2b4e('0x25')](_0x2b4e('0x26'),_0x4c8110+'-'+_0x5c920a+'/'+_0x383da2)[_0x2b4e('0x20')](_0x30b754);}return null;};}function patchUpdates(_0x4ce70f){return function(_0x1b0b8f){try{jsonpatch[_0x2b4e('0x27')](_0x1b0b8f,_0x4ce70f,!![]);}catch(_0x487a3d){return BPromise[_0x2b4e('0x28')](_0x487a3d);}return _0x1b0b8f['save']();};}function saveUpdates(_0x26c36a,_0x3462cd){return function(_0x4911d6){if(_0x4911d6){return _0x4911d6['update'](_0x26c36a)[_0x2b4e('0x29')](function(_0x258090){return _0x258090;});}return null;};}function removeEntity(_0x2eb2e2,_0x47b641){return function(_0x327555){if(_0x327555){return _0x327555[_0x2b4e('0x2a')]()[_0x2b4e('0x29')](function(){_0x2eb2e2[_0x2b4e('0x1e')](0xcc)[_0x2b4e('0x1f')]();});}};}function handleEntityNotFound(_0x435926,_0x37c9f0){return function(_0x18289b){if(!_0x18289b){_0x435926[_0x2b4e('0x1d')](0x194);}return _0x18289b;};}function handleError(_0x54384b,_0x3daddb){_0x3daddb=_0x3daddb||0x1f4;return function(_0x2776fb){logger[_0x2b4e('0x2b')](_0x2776fb[_0x2b4e('0x2c')]);if(_0x2776fb['name']){delete _0x2776fb['name'];}_0x54384b['status'](_0x3daddb)[_0x2b4e('0x2d')](_0x2776fb);};}exports[_0x2b4e('0x2e')]=function(_0x3ada5d,_0x5377fc){var _0x1feebb={},_0x5771d7={},_0x596fb6={'count':0x0,'rows':[]};var _0x31fc89=_[_0x2b4e('0x2f')](db[_0x2b4e('0x30')][_0x2b4e('0x31')],function(_0x3ba601){return{'name':_0x3ba601[_0x2b4e('0x32')],'type':_0x3ba601[_0x2b4e('0x33')]['key']};});_0x5771d7[_0x2b4e('0x34')]=_[_0x2b4e('0x2f')](_0x31fc89,_0x2b4e('0x35'));_0x5771d7[_0x2b4e('0x36')]=_[_0x2b4e('0x37')](_0x3ada5d['query']);_0x5771d7[_0x2b4e('0x38')]=_[_0x2b4e('0x39')](_0x5771d7[_0x2b4e('0x34')],_0x5771d7[_0x2b4e('0x36')]);_0x1feebb['attributes']=_[_0x2b4e('0x39')](_0x5771d7[_0x2b4e('0x34')],qs['fields'](_0x3ada5d['query'][_0x2b4e('0x3a')]));_0x1feebb[_0x2b4e('0x3b')]=_0x1feebb[_0x2b4e('0x3b')]['length']?_0x1feebb[_0x2b4e('0x3b')]:_0x5771d7[_0x2b4e('0x34')];if(!_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x3c')]('nolimit')){_0x1feebb['limit']=qs[_0x2b4e('0x23')](_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x23')]);_0x1feebb[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x21')]);}_0x1feebb['order']=qs['sort'](_0x3ada5d['query'][_0x2b4e('0x3d')]);_0x1feebb[_0x2b4e('0x3e')]=qs[_0x2b4e('0x38')](_[_0x2b4e('0x3f')](_0x3ada5d[_0x2b4e('0x36')],_0x5771d7[_0x2b4e('0x38')]),_0x31fc89);if(_0x3ada5d['query']['filter']){_0x1feebb[_0x2b4e('0x3e')]=_['merge'](_0x1feebb[_0x2b4e('0x3e')],{'$or':_[_0x2b4e('0x2f')](_0x31fc89,function(_0x1bd74f){if(_0x1bd74f[_0x2b4e('0x33')]!==_0x2b4e('0x40')){var _0x4eb0e1={};_0x4eb0e1[_0x1bd74f[_0x2b4e('0x35')]]={'$like':'%'+_0x3ada5d[_0x2b4e('0x36')]['filter']+'%'};return _0x4eb0e1;}})});}_0x1feebb=_[_0x2b4e('0x41')]({},_0x1feebb,_0x3ada5d[_0x2b4e('0x42')]);var _0xa427b1={'where':_0x1feebb[_0x2b4e('0x3e')]};return db[_0x2b4e('0x30')][_0x2b4e('0x24')](_0xa427b1)['then'](function(_0xc07f2b){_0x596fb6['count']=_0xc07f2b;if(_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x43')]){_0x1feebb[_0x2b4e('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x2b4e('0x45')](_0x1feebb);})[_0x2b4e('0x29')](function(_0x29cd22){_0x596fb6['rows']=_0x29cd22;return _0x596fb6;})[_0x2b4e('0x29')](respondWithFilteredResult(_0x5377fc,_0x1feebb))['catch'](handleError(_0x5377fc,null));};exports[_0x2b4e('0x46')]=function(_0x544212,_0x59d439){var _0x29a143={'raw':![],'where':{'id':_0x544212['params']['id']}},_0x43f0d2={};_0x43f0d2['model']=_[_0x2b4e('0x37')](db[_0x2b4e('0x30')][_0x2b4e('0x31')]);_0x43f0d2[_0x2b4e('0x36')]=_[_0x2b4e('0x37')](_0x544212[_0x2b4e('0x36')]);_0x43f0d2[_0x2b4e('0x38')]=_[_0x2b4e('0x39')](_0x43f0d2[_0x2b4e('0x34')],_0x43f0d2[_0x2b4e('0x36')]);_0x29a143[_0x2b4e('0x3b')]=_[_0x2b4e('0x39')](_0x43f0d2[_0x2b4e('0x34')],qs[_0x2b4e('0x3a')](_0x544212['query']['fields']));_0x29a143[_0x2b4e('0x3b')]=_0x29a143[_0x2b4e('0x3b')][_0x2b4e('0x47')]?_0x29a143[_0x2b4e('0x3b')]:_0x43f0d2[_0x2b4e('0x34')];if(_0x544212[_0x2b4e('0x36')]['includeAll']){_0x29a143[_0x2b4e('0x44')]=[{'all':!![]}];}_0x29a143=_[_0x2b4e('0x41')]({},_0x29a143,_0x544212['options']);return db['UserProfile'][_0x2b4e('0x48')](_0x29a143)[_0x2b4e('0x29')](handleEntityNotFound(_0x59d439,null))[_0x2b4e('0x29')](respondWithResult(_0x59d439,null))['catch'](handleError(_0x59d439,null));};exports[_0x2b4e('0x49')]=function(_0x25aa50,_0x4c5ce1){return db[_0x2b4e('0x30')]['create'](_0x25aa50['body'],{})[_0x2b4e('0x29')](respondWithResult(_0x4c5ce1,0xc9))[_0x2b4e('0x4a')](handleError(_0x4c5ce1,null));};exports['clone']=function(_0x1f125a,_0x354c4c){var _0x24df80={'where':{'id':_0x1f125a[_0x2b4e('0x4b')]['id']}},_0x2648c4={};_0x2648c4['model']=_[_0x2b4e('0x37')](db[_0x2b4e('0x30')]['rawAttributes']);_0x24df80[_0x2b4e('0x3b')]=_['intersection'](_0x2648c4[_0x2b4e('0x34')],qs[_0x2b4e('0x3a')](_0x1f125a[_0x2b4e('0x36')][_0x2b4e('0x3a')]));_0x24df80['attributes']=_0x24df80['attributes'][_0x2b4e('0x47')]?_0x24df80[_0x2b4e('0x3b')]:_0x2648c4[_0x2b4e('0x34')];if(_0x1f125a[_0x2b4e('0x36')]['includeAll']){_0x24df80[_0x2b4e('0x44')]=[{'all':!![]}];}_0x24df80=_[_0x2b4e('0x41')]({},_0x24df80,_0x1f125a[_0x2b4e('0x42')]);return db[_0x2b4e('0x30')][_0x2b4e('0x48')](_0x24df80)[_0x2b4e('0x29')](handleEntityNotFound(_0x354c4c,null))[_0x2b4e('0x29')](function(_0x19c058){if(_0x19c058){var _0x5ba01c=_0x19c058[_0x2b4e('0x4c')]({'plain':!![]});_0x5ba01c=qs[_0x2b4e('0x4d')](_0x5ba01c,['id',_0x2b4e('0x4e'),_0x2b4e('0x4f'),'crudPermissions']);_0x1f125a[_0x2b4e('0x50')]=_['omit'](_0x1f125a[_0x2b4e('0x50')],['id','createdAt',_0x2b4e('0x4f')]);return db[_0x2b4e('0x51')][_0x2b4e('0x52')](function(_0x57d430){return db[_0x2b4e('0x30')][_0x2b4e('0x49')](_[_0x2b4e('0x41')](_0x5ba01c,_0x1f125a['body']),{'include':_0x1f125a[_0x2b4e('0x36')][_0x2b4e('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x57d430})[_0x2b4e('0x29')](function(_0x13304e){var _0xb3784f=_0x13304e[_0x2b4e('0x4c')]({'plain':!![]});return db[_0x2b4e('0x53')][_0x2b4e('0x45')]({'where':{'userProfileId':_0x1f125a[_0x2b4e('0x4b')]['id']},'raw':!![]})['then'](function(_0x2687f8){if(_0x2687f8){return BPromise[_0x2b4e('0x54')](_0x2687f8,function(_0xb535c5){return new BPromise(function(_0x28be71,_0x12c517){if(_0xb535c5[_0x2b4e('0x55')]===null||_0xb535c5[_0x2b4e('0x55')]===0x1)_0x28be71(null);return db[_0x2b4e('0x56')][_0x2b4e('0x45')]({'where':{'sectionId':_0xb535c5['id']},'raw':!![]})['then'](function(_0x1be990){var _0x4f2369=_[_0x2b4e('0x2f')](_0x1be990,function(_0x38748a){return qs[_0x2b4e('0x4d')](_0x38748a,['id',_0x2b4e('0x4e'),_0x2b4e('0x4f'),_0x2b4e('0x57')]);});_0x28be71(_0x4f2369);})[_0x2b4e('0x4a')](function(_0x514500){_0x12c517(_0x514500);});})['then'](function(_0x43df80){var _0x53ae6e=qs[_0x2b4e('0x4d')](_0xb535c5,['id',_0x2b4e('0x4e'),_0x2b4e('0x4f')]);_0x53ae6e['userProfileId']=_0xb3784f['id'];if(_0x43df80)_0x53ae6e[_0x2b4e('0x58')]=_0x43df80;return _0x53ae6e;})['then'](function(_0x38c305){return db['UserProfileSection'][_0x2b4e('0x49')](_0x38c305,{'include':[{'model':db[_0x2b4e('0x56')],'as':_0x2b4e('0x58')}],'raw':!![],'transaction':_0x57d430});});})[_0x2b4e('0x29')](function(){return _0xb3784f;});}});});});}})[_0x2b4e('0x29')](respondWithResult(_0x354c4c,0xc9))['catch'](handleError(_0x354c4c,null));};exports['update']=function(_0x51e7ec,_0x563d0a){if(_0x51e7ec[_0x2b4e('0x50')]['id']){delete _0x51e7ec[_0x2b4e('0x50')]['id'];}return db[_0x2b4e('0x30')][_0x2b4e('0x48')]({'where':{'id':_0x51e7ec[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x563d0a,null))[_0x2b4e('0x29')](saveUpdates(_0x51e7ec[_0x2b4e('0x50')],null))['then'](respondWithResult(_0x563d0a,null))[_0x2b4e('0x4a')](handleError(_0x563d0a,null));};exports['destroy']=function(_0x36f454,_0x6982fa){return db[_0x2b4e('0x30')]['find']({'where':{'id':_0x36f454['params']['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x6982fa,null))[_0x2b4e('0x29')](removeEntity(_0x6982fa,null))['catch'](handleError(_0x6982fa,null));};exports[_0x2b4e('0x59')]=function(_0x92c680,_0x49d1f0){return db[_0x2b4e('0x30')]['describe']()['then'](respondWithResult(_0x49d1f0,null))[_0x2b4e('0x4a')](handleError(_0x49d1f0,null));};exports[_0x2b4e('0x5a')]=function(_0x139370,_0x93cb19){var _0x99ff6c=_0x139370[_0x2b4e('0x50')];return db[_0x2b4e('0x30')][_0x2b4e('0x48')]({'where':{'id':_0x139370[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x93cb19,null))['then'](function(_0x233cff){if(_0x233cff){return db[_0x2b4e('0x51')][_0x2b4e('0x52')](function(_0x4192f7){return db[_0x2b4e('0x53')][_0x2b4e('0x2a')]({'where':{'userProfileId':_0x139370[_0x2b4e('0x4b')]['id'],'sectionId':_[_0x2b4e('0x2f')](_0x99ff6c,function(_0xf64a84){return _0xf64a84[_0x2b4e('0x57')];})},'transaction':_0x4192f7})['then'](function(){var _0x35ecd4=_[_0x2b4e('0x2f')](_0x99ff6c,function(_0x13b678){_0x13b678[_0x2b4e('0x5b')]=_0x139370[_0x2b4e('0x4b')]['id'];return _0x13b678;});var _0x567c56=[];return BPromise[_0x2b4e('0x54')](_0x35ecd4,function(_0x3f31b8){return db[_0x2b4e('0x53')][_0x2b4e('0x49')](_0x3f31b8,{'include':[{'model':db[_0x2b4e('0x56')],'as':_0x2b4e('0x58')}],'raw':!![],'transaction':_0x4192f7})[_0x2b4e('0x29')](function(_0x403549){_0x567c56[_0x2b4e('0x5c')](_0x403549['get']({'plain':!![]}));});})[_0x2b4e('0x29')](function(){return _0x567c56;});});});}})[_0x2b4e('0x29')](function(_0x6c6663){return _0x6c6663;})[_0x2b4e('0x29')](respondWithResult(_0x93cb19,null))['catch'](handleError(_0x93cb19,null));};exports[_0x2b4e('0x5d')]=function(_0xd7e1ec,_0x4906e2){var _0x28f27b;return db['UserProfile'][_0x2b4e('0x48')]({'where':{'id':_0xd7e1ec[_0x2b4e('0x4b')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x4906e2,null))['then'](function(_0x42feff){if(_0x42feff){_0x28f27b=_0x42feff;return db[_0x2b4e('0x53')][_0x2b4e('0x2a')]({'where':{'userProfileId':_0xd7e1ec['params']['id'],'sectionId':_0xd7e1ec[_0x2b4e('0x36')]['ids']}});}})[_0x2b4e('0x29')](function(){return _0x28f27b;})[_0x2b4e('0x29')](respondWithStatusCode(_0x4906e2,null))[_0x2b4e('0x4a')](handleError(_0x4906e2,null));};exports[_0x2b4e('0x5e')]=function(_0xb8c785,_0x5f9503){var _0xc0c6f7=[];var _0x49b2ff=[];return db[_0x2b4e('0x53')][_0x2b4e('0x45')]({'where':{'userProfileId':_0xb8c785[_0x2b4e('0x4b')]['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x191a93){_0xc0c6f7=_[_0x2b4e('0x5f')](_0x191a93,function(_0x195606){return _0x195606[_0x2b4e('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x195606[_0x2b4e('0x57')]);});if(!_[_0x2b4e('0x61')](_0xc0c6f7)){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0xd3f0f){return _0xd3f0f[_0x2b4e('0x57')];});}else{return;}})[_0x2b4e('0x29')](function(_0x192ab1){if(_0x192ab1)_0x49b2ff=_0x192ab1;if(_['includes'](_0x49b2ff,0x64)){var _0x3e9b79=_[_0x2b4e('0x48')](_0xc0c6f7,{'sectionId':0x64});return hasDefaultDashboard(_0x3e9b79)[_0x2b4e('0x29')](function(_0x70ac26){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0x4e3e6d){if(_0x4e3e6d[_0x2b4e('0x57')]===0x64){_0x4e3e6d[_0x2b4e('0x62')]=_0x70ac26;}return _0x4e3e6d;});});}else{return;}})['then'](function(_0x542b65){if(_0x542b65)_0xc0c6f7=_0x542b65;if(_[_0x2b4e('0x63')](_0x49b2ff,0x3eb)){var _0x1fd2f2=_['find'](_0xc0c6f7,{'sectionId':0x3eb});return getCustomDashboards(_0x1fd2f2)['then'](function(_0xd65ff5){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0x5467c1){if(_0x1fd2f2['enabled']){if(_0x5467c1['sectionId']===0x3eb){_0x5467c1[_0x2b4e('0x62')]=_0xd65ff5;}}else{if(_0x5467c1[_0x2b4e('0x57')]===0x64){_0x5467c1[_0x2b4e('0x62')]=_0xd65ff5;}}return _0x5467c1;});});}else{return;}})[_0x2b4e('0x29')](function(_0x3a0bc2){if(_0x3a0bc2)_0xc0c6f7=_0x3a0bc2;if(_[_0x2b4e('0x63')](_0x49b2ff,0x709)){var _0xc0c6ce=_['find'](_0xc0c6f7,{'sectionId':0x709});return getPlugins(_0xc0c6ce)[_0x2b4e('0x29')](function(_0x5ef40b){if(_0xc0c6ce['enabled']){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0x9633b8){if(_0x9633b8[_0x2b4e('0x57')]===0x709){_0x9633b8['subsections']=_0x5ef40b;}return _0x9633b8;});}else{var _0x29767c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5ef40b};var _0x339bce=_[_0x2b4e('0x2f')](_0xc0c6f7);_0x339bce[_0x2b4e('0x5c')](_0x29767c);return _0x339bce;}});}else{return;}})[_0x2b4e('0x29')](function(_0x57df69){if(_0x57df69)_0xc0c6f7=_0x57df69;return _[_0x2b4e('0x5f')](_0xc0c6f7,['enabled',0x1]);})[_0x2b4e('0x29')](respondWithResult(_0x5f9503,null))[_0x2b4e('0x4a')](handleError(_0x5f9503,null));};function hasDefaultDashboard(_0x1320a5){var _0x5ec08b=[0x65];return new BPromise(function(_0x4b74e2,_0x3b2a2a){try{if(_0x1320a5['autoAssociation']){_0x4b74e2(_0x5ec08b);}else{return db['UserProfileResource'][_0x2b4e('0x64')]({'where':{'sectionId':_0x1320a5['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x66cf9){_0x66cf9?_0x4b74e2(_0x5ec08b):_0x4b74e2();});}}catch(_0x26b3b1){_0x3b2a2a(_0x26b3b1);}});}function getCustomDashboards(_0x2bee97){var _0x410e7f=[];return new BPromise(function(_0x437ca3,_0x3f29dd){try{if(_0x2bee97[_0x2b4e('0x55')]){return db[_0x2b4e('0x65')][_0x2b4e('0x45')]({'raw':!![]})[_0x2b4e('0x29')](function(_0x9ce521){_0x9ce521[_0x2b4e('0x66')](function(_0x841450){_0x410e7f[_0x2b4e('0x5c')](_0x841450['id']+0x1869f);});_0x437ca3(_0x410e7f);});}else{return db['UserProfileResource'][_0x2b4e('0x45')]({'where':{'sectionId':_0x2bee97['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x4aff4c){_0x4aff4c[_0x2b4e('0x66')](function(_0x24a738){_0x410e7f['push'](_0x24a738[_0x2b4e('0x67')]+0x1869f);});_0x437ca3(_0x410e7f);});}}catch(_0x21e104){_0x3f29dd(_0x21e104);}});}function getPlugins(_0x2d05cb){var _0x35d7b8=[];return new BPromise(function(_0x339fe6,_0x3f4009){try{if(_0x2d05cb[_0x2b4e('0x55')]){return db[_0x2b4e('0x68')][_0x2b4e('0x45')]({'raw':!![]})['then'](function(_0x541636){_0x541636['forEach'](function(_0x26ccfe){_0x35d7b8[_0x2b4e('0x5c')](_0x26ccfe['id']+0x15b38);});_0x339fe6(_0x35d7b8);});}else{return db[_0x2b4e('0x56')][_0x2b4e('0x45')]({'where':{'sectionId':_0x2d05cb['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x445688){_0x445688['forEach'](function(_0x1ad7d8){_0x35d7b8[_0x2b4e('0x5c')](_0x1ad7d8[_0x2b4e('0x67')]+0x15b38);});_0x339fe6(_0x35d7b8);});}}catch(_0x2adc7f){_0x3f4009(_0x2adc7f);}});}exports['addResources']=function(_0x116166,_0x1a9baf){return db['UserProfile']['find']({'where':{'id':_0x116166['params']['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x1a9baf,null))[_0x2b4e('0x29')](function(_0x40297f){if(_0x40297f){return db[_0x2b4e('0x51')]['transaction'](function(_0x54e40a){return db['UserProfileSection'][_0x2b4e('0x45')]({'where':{'userProfileId':_0x116166['params']['id']},'attributes':['id'],'raw':!![]})[_0x2b4e('0x29')](function(_0x4b030e){if(_0x4b030e){return db[_0x2b4e('0x53')]['destroy']({'where':{'userProfileId':_0x116166[_0x2b4e('0x4b')]['id'],'id':_[_0x2b4e('0x2f')](_0x4b030e,function(_0x20a03e){return _0x20a03e['id'];})},'transaction':_0x54e40a});}})['then'](function(_0x41a287){var _0xceb353=_[_0x2b4e('0x2f')](_0x116166[_0x2b4e('0x50')],function(_0x5f3381){_0x5f3381['userProfileId']=_0x116166[_0x2b4e('0x4b')]['id'];return _0x5f3381;});return db[_0x2b4e('0x53')][_0x2b4e('0x69')](_0xceb353,{'raw':!![],'transaction':_0x54e40a});})[_0x2b4e('0x29')](function(_0x3764aa){var _0x24761b=_[_0x2b4e('0x5f')](_['map'](_0x3764aa,function(_0x449c81){return _0x449c81['get']({'plain':!![]});}),{'includeAll':![]});if(_0x24761b){return db[_0x2b4e('0x53')][_0x2b4e('0x45')]({'where':{'userProfileId':_0x116166['params']['id'],'sectionId':_[_0x2b4e('0x2f')](_0x24761b,function(_0x22ba98){return _0x22ba98['sectionId'];})},'attributes':['id',_0x2b4e('0x57')],'raw':!![]})[_0x2b4e('0x29')](function(_0x52bac9){var _0x2b25c2=_[_0x2b4e('0x2f')](_0x116166[_0x2b4e('0x50')],function(_0x4690fa){_0x4690fa[_0x2b4e('0x5b')]=_0x116166['params']['id'];return _0x4690fa;});return db[_0x2b4e('0x56')][_0x2b4e('0x69')](_0x2b25c2,{'raw':!![],'transaction':_0x54e40a});});}})[_0x2b4e('0x4a')](handleError(_0x1a9baf,null));});}})[_0x2b4e('0x29')](function(_0x44c9dd){var _0x5ef212=_['map'](_0x44c9dd,function(_0x67bd37){return _0x67bd37[_0x2b4e('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x1a9baf,null))[_0x2b4e('0x4a')](handleError(_0x1a9baf,null));};exports[_0x2b4e('0x6a')]=function(_0xa41d6b,_0x412b17,_0x2aa3fa){return db['UserProfile'][_0x2b4e('0x48')]({'where':{'id':_0xa41d6b[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x412b17,null))[_0x2b4e('0x29')](function(_0x5ab8fe){if(_0x5ab8fe){return _0x5ab8fe[_0x2b4e('0x6a')](_0xa41d6b[_0x2b4e('0x36')][_0x2b4e('0x6b')]);}})[_0x2b4e('0x29')](respondWithStatusCode(_0x412b17,null))['catch'](handleError(_0x412b17,null));};exports[_0x2b4e('0x6c')]=function(_0x5920f1,_0x3711a9){var _0x1b83f4={};if(!_0x5920f1[_0x2b4e('0x36')]['section'])throw new Error(_0x2b4e('0x6d'));if(!_0x5920f1[_0x2b4e('0x36')][_0x2b4e('0x3c')](_0x2b4e('0x6e'))){_0x1b83f4[_0x2b4e('0x23')]=qs[_0x2b4e('0x23')](_0x5920f1[_0x2b4e('0x36')][_0x2b4e('0x23')]);_0x1b83f4[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x5920f1['query'][_0x2b4e('0x21')]);}return db['UserProfile'][_0x2b4e('0x48')]({'where':{'id':_0x5920f1[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](function(_0x5f3559){if(!_0x5f3559)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5920f1[_0x2b4e('0x4b')]['id']);return db[_0x2b4e('0x30')][_0x2b4e('0x6c')](_0x5920f1);})[_0x2b4e('0x29')](respondWithFilteredResult(_0x3711a9,_0x1b83f4))[_0x2b4e('0x4a')](handleError(_0x3711a9,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c0dea21..b4530ec 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 _0xba34=['hook','events','../../mysqldb','UserProfile','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2ffd1a,_0x46e2fc){var _0x15b97a=function(_0x3f21e7){while(--_0x3f21e7){_0x2ffd1a['push'](_0x2ffd1a['shift']());}};_0x15b97a(++_0x46e2fc);}(_0xba34,0x119));var _0x4ba3=function(_0x47a976,_0x4a6668){_0x47a976=_0x47a976-0x0;var _0x52d42c=_0xba34[_0x47a976];return _0x52d42c;};'use strict';var EventEmitter=require(_0x4ba3('0x0'));var UserProfile=require(_0x4ba3('0x1'))['db'][_0x4ba3('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4ba3('0x3')](0x0);var events={'afterCreate':_0x4ba3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49ed2a){return function(_0x4592fc,_0x2947f2,_0x278101){UserProfileEvents[_0x4ba3('0x5')](_0x49ed2a+':'+_0x4592fc['id'],_0x4592fc);UserProfileEvents[_0x4ba3('0x5')](_0x49ed2a,_0x4592fc);_0x278101(null);};}for(var e in events){if(events[_0x4ba3('0x6')](e)){var event=events[e];UserProfile[_0x4ba3('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xc43c=['hook','exports','events','../../mysqldb','UserProfile','remove','emit'];(function(_0x6acde0,_0x497054){var _0x112c59=function(_0x3cb757){while(--_0x3cb757){_0x6acde0['push'](_0x6acde0['shift']());}};_0x112c59(++_0x497054);}(_0xc43c,0xd4));var _0xcc43=function(_0x3ed369,_0x2185ba){_0x3ed369=_0x3ed369-0x0;var _0x1f72a3=_0xc43c[_0x3ed369];return _0x1f72a3;};'use strict';var EventEmitter=require(_0xcc43('0x0'));var UserProfile=require(_0xcc43('0x1'))['db'][_0xcc43('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcc43('0x3')};function emitEvent(_0x482ebc){return function(_0x484b53,_0x4c59cc,_0x37e84f){UserProfileEvents[_0xcc43('0x4')](_0x482ebc+':'+_0x484b53['id'],_0x484b53);UserProfileEvents[_0xcc43('0x4')](_0x482ebc,_0x484b53);_0x37e84f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcc43('0x5')](e,emitEvent(event));}}module[_0xcc43('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a1a0d0b..7be5f1e 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 _0x2a07=['VoicePrefix','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','VoiceQueues','users','agents','telephones','admin','user','Agents','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Pause','scheduler','Schedule','sounds','Sound','Template','triggers','Trigger','Variable','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.createdAt','from','user_has_','where','sequelize','query','OpenTabs','define','user_profiles','raw','Invalid\x20section\x20\x27','length','UserProfileSection','find','ignore','isEmpty','union','push','all','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','sort','pick','filters','merge','key','AnalyticExtractedReport','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','ids','count','Tag','color','ThroughTags','tag','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','role','agent','Telephones','membername','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','chanspies','VoiceChanSpy','voiceprefixes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a07,0x74));var _0x72a0=function(_0x1c8491,_0x335e02){_0x1c8491=_0x1c8491-0x0;var _0x2a9aae=_0x2a07[_0x1c8491];return _0x2a9aae;};'use strict';var _=require(_0x72a0('0x0'));var attributes=require(_0x72a0('0x1'));var qs=require(_0x72a0('0x2'));var squel=require(_0x72a0('0x3'));module[_0x72a0('0x4')]=function(_0x548164){var _0x335b7c=_0x548164[_0x72a0('0x5')];function _0x135982(_0x45b155,_0x431f65){return new Promise(function(_0xce74c,_0x3ccf6d){if(!_0x431f65)return _0xce74c(null);var _0x20dab9=_0x431f65[_0x72a0('0x6')]?{[_0x431f65[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x431f65[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x45b155][_0x72a0('0x9')]({'where':_0x20dab9,'raw':!![]})[_0x72a0('0xa')](function(_0x2bc45b){_0x431f65['associatedResources']=_[_0x72a0('0xb')](_0x2bc45b,'id');_0xce74c(_0x431f65);})[_0x72a0('0xc')](function(_0x54abf6){_0x3ccf6d(_0x54abf6);});});}function _0x46fb8a(_0x194488,_0x1b85b1){return new Promise(function(_0x44d7cf,_0x975c27){var _0x516c08=_0x194488[_0x72a0('0x6')]?{[_0x194488[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x194488[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x194488[_0x72a0('0xd')]][_0x72a0('0x9')]({'where':_0x516c08,'raw':!![]})['then'](function(_0x4930c5){_0x1b85b1[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x4930c5,function(_0x19eaf9){return _0x19eaf9[_0x72a0('0xf')];});_0x44d7cf(_0x1b85b1);})[_0x72a0('0xc')](function(_0x3f3d62){_0x975c27(_0x3f3d62);});});}function _0x4ab55e(_0x30248e,_0x2e7552,_0x16ac70){if(!_0x2e7552)return Promise[_0x72a0('0x10')](null);return new Promise(function(_0x2d1e95,_0x54495e){return _0x335b7c[_0x72a0('0x11')][_0x72a0('0x9')]({'where':{'sectionId':_0x2e7552['id']},'raw':!![]})[_0x72a0('0xa')](function(_0x5b63c8){if(_0x30248e[_0x72a0('0x7')]&&_0x30248e[_0x72a0('0x7')]!=='id'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x5437df){return _0x5437df[_0x30248e[_0x72a0('0x7')]];});}else{if(_0x16ac70==='AnalyticExtractedReport'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0xde058c){return{'id':_0xde058c['resourceId'],'type':_0xde058c[_0x72a0('0x12')]};});}else{_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x3d1965){return _0x3d1965['resourceId'];});}}_0x2d1e95(_0x2e7552);})[_0x72a0('0xc')](function(_0x390464){_0x54495e(_0x390464);});});}function _0x1ddd54(_0x23b918,_0x3022b0){var _0x174b1b={'parentSections':[]};switch(_0x23b918['toLowerCase']()){case'squareprojects':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x14');break;case _0x72a0('0x15'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x16');break;case _0x72a0('0x17'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x18');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x1a'),'field':'name','foreignKey':_0x72a0('0x1b')}];break;case _0x72a0('0x1c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1d');break;case _0x72a0('0x1e'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1f');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x20'),'field':'id','foreignKey':_0x72a0('0x21')}];break;case'lists':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x22');break;case _0x72a0('0x23'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x24');break;case _0x72a0('0x25'):_0x174b1b[_0x72a0('0x13')]='CmCustomField';break;case _0x72a0('0x26'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x27');break;case _0x72a0('0x28'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x29');break;case _0x72a0('0x2a'):_0x174b1b[_0x72a0('0x13')]='FaxQueue';break;case _0x72a0('0x2b'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2c');break;case'inboundroutes':case _0x72a0('0x2d'):case'outboundroutes':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2e');break;case _0x72a0('0x2f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x30');break;case _0x72a0('0x31'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x32');break;case _0x72a0('0x33'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x34');_0x174b1b[_0x72a0('0x19')]=[{'name':'Agents','field':_0x72a0('0xf'),'foreignKey':'membername','model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x37')]}},{'name':_0x72a0('0x38'),'field':_0x72a0('0xf'),'foreignKey':_0x72a0('0x39'),'model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x3a')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':_0x72a0('0x12'),'value':[_0x72a0('0x3d')]}},{'name':_0x72a0('0x3e'),'field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':'type','value':[_0x72a0('0x3f')]}}];break;case'musiconholds':_0x174b1b['childModel']='VoiceMusicOnHold';break;case _0x72a0('0x40'):_0x174b1b['childModel']=_0x72a0('0x41');break;case _0x72a0('0x42'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x43');break;case'ivrcampaigns':_0x174b1b['childModel']='Campaign';break;case'mailqueues':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x44');break;case'mailaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x45');break;case'mailsubstatuses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x46');break;case _0x72a0('0x47'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x48');break;case _0x72a0('0x49'):_0x174b1b['childModel']=_0x72a0('0x4a');break;case'smsqueues':_0x174b1b[_0x72a0('0x13')]='SmsQueue';break;case _0x72a0('0x4b'):_0x174b1b[_0x72a0('0x13')]='SmsAccount';break;case _0x72a0('0x4c'):_0x174b1b['childModel']=_0x72a0('0x4d');break;case _0x72a0('0x4e'):_0x174b1b[_0x72a0('0x13')]='WhatsappAccount';break;case _0x72a0('0x4f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x50');break;case'voicequeues':case'queuecampaigns':_0x174b1b[_0x72a0('0x13')]='VoiceQueue';if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x51')},{'name':_0x72a0('0x3e')}];}break;case _0x72a0('0x52'):case _0x72a0('0x53'):case _0x72a0('0x54'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x35');if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':'Users','filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x55'),_0x72a0('0x56')]},'ignore':!![]},{'name':_0x72a0('0x57')},{'name':_0x72a0('0x38')}];}break;case _0x72a0('0x58'):_0x174b1b[_0x72a0('0x13')]='ZendeskAccount';break;case'salesforceaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x59');break;case _0x72a0('0x5a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5b');break;case _0x72a0('0x5c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5d');break;case _0x72a0('0x5e'):_0x174b1b[_0x72a0('0x13')]='DeskAccount';break;case _0x72a0('0x5f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x60');break;case _0x72a0('0x61'):_0x174b1b[_0x72a0('0x13')]='User';break;case _0x72a0('0x62'):_0x174b1b['childModel']='CannedAnswer';break;case _0x72a0('0x63'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x64');break;case _0x72a0('0x65'):_0x174b1b[_0x72a0('0x13')]='Dashboard';break;case _0x72a0('0x66'):_0x174b1b[_0x72a0('0x13')]='Interval';break;case'pauses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x67');break;case _0x72a0('0x68'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x69');break;case _0x72a0('0x6a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6b');break;case'tags':_0x174b1b[_0x72a0('0x13')]='Tag';break;case'templates':_0x174b1b['childModel']=_0x72a0('0x6c');break;case _0x72a0('0x6d'):_0x174b1b['childModel']=_0x72a0('0x6e');break;case'trunks':_0x174b1b[_0x72a0('0x13')]='Trunk';break;case'variables':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6f');break;case'plugins':_0x174b1b[_0x72a0('0x13')]='Plugin';break;case _0x72a0('0x70'):_0x174b1b['childModel']='AnalyticExtractedReport';_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x71'),'field':'id','foreignKey':_0x72a0('0x72')}];break;case'metrics':_0x174b1b['childModel']=_0x72a0('0x73');break;}return _0x174b1b;}function _0x48f178(_0x44b171,_0x36d604){var _0x1cea02=_0x44b171[_0x72a0('0x74')](0x0)[_0x72a0('0x75')]()+_0x44b171[_0x72a0('0x76')](0x1);var _0x41f7f6={'type':_0x335b7c[_0x72a0('0x77')][_0x72a0('0x78')][_0x72a0('0x79')],'raw':!![]};return new Promise(function(_0x32a0bb,_0x43ec4b){var _0x4d0774=squel[_0x72a0('0x7a')]()['field']('ui.'+_0x1cea02+'InteractionId','id')['field'](_0x72a0('0x7b'))[_0x72a0('0x7c')](_0x72a0('0x7d')+_0x44b171+'_interactions','ui')[_0x72a0('0x7e')]('ui.UserId\x20=\x20?',_0x36d604['id']);return _0x335b7c[_0x72a0('0x7f')][_0x72a0('0x80')](_0x4d0774['toString'](),_0x41f7f6)[_0x72a0('0xa')](function(_0x24e211){_0x36d604[_0x1cea02+_0x72a0('0x81')]=_0x24e211;_0x32a0bb(_0x24e211);})[_0x72a0('0xc')](function(_0x5e47c4){_0x43ec4b(_0x5e47c4);});});}return _0x548164[_0x72a0('0x82')]('UserProfile',attributes,{'tableName':_0x72a0('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2cb292){var _0x1df6fc={'raw':_0x2cb292['query'][_0x72a0('0x84')],'where':{}};var _0x3eb3b5={};var _0x1b8a72={'count':0x0,'rows':[]};var _0x154c9d=_0x2cb292[_0x72a0('0x80')]['section'];var _0x5707e9=_0x2cb292[_0x72a0('0x80')]['mergeResources']||![];var _0x421c35=_0x1ddd54(_0x154c9d,_0x5707e9);if(!_0x421c35['childModel'])throw new Error(_0x72a0('0x85')+_0x154c9d+'\x27');var _0xd9ae1a=[{'name':_0x154c9d}];if(!_['isEmpty'](_0x421c35[_0x72a0('0x19')]))_0xd9ae1a=_0x421c35[_0x72a0('0x19')];var _0x83ebf6=[];for(var _0x55b301=0x0;_0x55b301<_0xd9ae1a[_0x72a0('0x86')];_0x55b301++){_0x83ebf6['push'](_0x335b7c[_0x72a0('0x87')][_0x72a0('0x88')]({'where':{'userProfileId':_0x2cb292['params']['id'],'name':_0xd9ae1a[_0x55b301][_0x72a0('0xf')]},'raw':!![]}));}return Promise['all'](_0x83ebf6)['then'](function(_0x5142de){var _0x28969a=_['filter'](_0x5142de,function(_0x115ba8){return _0x115ba8?_0x115ba8:undefined;});var _0x5520b8=_[_0x72a0('0x6')](_0xd9ae1a,[_0x72a0('0x89'),!![]]);var _0x143ebf=_['isEmpty'](_0x28969a)&&_[_0x72a0('0x8a')](_0x5520b8)?null:_[_0x72a0('0x8b')](_0x5520b8,_0x28969a);if(!_0x143ebf)return null;var _0x275e45=[];for(var _0x28551a=0x0;_0x28551a<_0x143ebf[_0x72a0('0x86')];_0x28551a++){var _0x58ef97=_[_0x72a0('0x88')](_0xd9ae1a,function(_0x2d431d){return _0x143ebf[_0x28551a]?_0x2d431d[_0x72a0('0xf')]===_0x143ebf[_0x28551a][_0x72a0('0xf')]:null;});if(_0x58ef97){if(_0x143ebf[_0x28551a]['ignore']){_0x275e45[_0x72a0('0x8c')](_0x135982(_0x421c35[_0x72a0('0x13')],_0x143ebf[_0x28551a]));}else{if(!_0x143ebf[_0x28551a]['autoAssociation']){_0x275e45[_0x72a0('0x8c')](_0x4ab55e(_0x58ef97,_0x143ebf[_0x28551a],_0x421c35['childModel']));}else{if(_0x58ef97[_0x72a0('0xd')]){_0x275e45[_0x72a0('0x8c')](_0x46fb8a(_0x58ef97,_0x143ebf[_0x28551a]));}}}}}return Promise[_0x72a0('0x8d')](_0x275e45);})[_0x72a0('0xa')](function(_0x14f61a){var _0x1e23e9=_0x14f61a;var _0x7450c7=null;if(_0x1e23e9){_0x7450c7=_0x1e23e9['length']===0x1?_0x1e23e9[0x0]:null;}if(!_0x7450c7&&!_0x1e23e9)return _0x1b8a72;var _0x5b0dfd=_0x335b7c[_0x421c35['childModel']][_0x72a0('0x8e')];_0x3eb3b5[_0x72a0('0xd')]=_[_0x72a0('0x8f')](_0x5b0dfd);_0x3eb3b5[_0x72a0('0x80')]=_[_0x72a0('0x8f')](_0x2cb292[_0x72a0('0x80')]);_0x3eb3b5['filters']=_[_0x72a0('0x90')](_0x3eb3b5[_0x72a0('0xd')],_0x3eb3b5[_0x72a0('0x80')]);_0x1df6fc[_0x72a0('0x91')]=_[_0x72a0('0x90')](_0x3eb3b5[_0x72a0('0xd')],qs[_0x72a0('0x92')](_0x2cb292['query'][_0x72a0('0x92')]));_0x1df6fc[_0x72a0('0x91')]=_0x1df6fc[_0x72a0('0x91')][_0x72a0('0x86')]?_0x1df6fc[_0x72a0('0x91')]:_0x3eb3b5[_0x72a0('0xd')];if(!_0x2cb292['query'][_0x72a0('0x93')]('nolimit')){_0x1df6fc[_0x72a0('0x94')]=qs[_0x72a0('0x94')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x94')]);_0x1df6fc[_0x72a0('0x95')]=qs['offset'](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x95')]);}_0x1df6fc['order']=qs[_0x72a0('0x96')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x96')]);_0x1df6fc[_0x72a0('0x7e')]=qs['filters'](_[_0x72a0('0x97')](_0x2cb292[_0x72a0('0x80')],_0x3eb3b5[_0x72a0('0x98')]));if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x99')](_0x1df6fc[_0x72a0('0x7e')],{'$or':_[_0x72a0('0xb')](_0x5b0dfd,function(_0x3d02e6){if(_0x3d02e6[_0x72a0('0x12')][_0x72a0('0x9a')]!=='VIRTUAL'){var _0x18dc1b={};_0x18dc1b[_0x3d02e6[_0x72a0('0x7')]]={'$like':'%'+_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]+'%'};return _0x18dc1b;}})});}var _0xada6ad=[];var _0x3a0bd6=null;var _0x20281b={};if(_0x7450c7){_0x3a0bd6=_[_0x72a0('0x88')](_0xd9ae1a,['name',_0x7450c7[_0x72a0('0xf')]]);if(_0x3a0bd6['field']){_0x20281b={};if(_0x421c35['childModel']===_0x72a0('0x9b')){_0x20281b[_0x3a0bd6['foreignKey']]=_['map'](_0x7450c7[_0x72a0('0xe')],'id');}else{_0x20281b[_0x3a0bd6['foreignKey']]=_0x7450c7[_0x72a0('0xe')];}_0xada6ad[_0x72a0('0x8c')](_0x20281b);}else{_0x1df6fc[_0x72a0('0x7e')]['id']=_0x7450c7['associatedResources'];}}else{for(var _0x344a69=0x0;_0x344a69<_0x1e23e9[_0x72a0('0x86')];_0x344a69++){_0x3a0bd6=_[_0x72a0('0x88')](_0xd9ae1a,[_0x72a0('0xf'),_0x1e23e9[_0x344a69][_0x72a0('0xf')]]);if(_0x3a0bd6['field']){_0x20281b={};_0x20281b[_0x3a0bd6[_0x72a0('0x9c')]]=_0x1e23e9[_0x344a69][_0x72a0('0xe')];_0xada6ad[_0x72a0('0x8c')](_0x20281b);}else{if(!_0x1df6fc['where']['id'])_0x1df6fc[_0x72a0('0x7e')]['id']=[];_0x1e23e9[_0x344a69][_0x72a0('0xe')][_0x72a0('0x9d')](function(_0x56104e){_0x1df6fc[_0x72a0('0x7e')]['id'][_0x72a0('0x8c')](_0x56104e);});}}}if(!_[_0x72a0('0x8a')](_0xada6ad)){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x99')](_0x1df6fc[_0x72a0('0x7e')],{'$and':{'$or':_0xada6ad}});}_0x1df6fc=_[_0x72a0('0x99')]({},_0x1df6fc,_0x2cb292[_0x72a0('0x9e')]);if(_0x7450c7&&!_0x7450c7[_0x72a0('0x9f')]&&_0x421c35['childModel']===_0x72a0('0x9b')){if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa0')]){_0x1df6fc[_0x72a0('0xa1')]=[{'all':!![]}];}return _0x335b7c[_0x421c35[_0x72a0('0x13')]]['findAll'](_0x1df6fc)[_0x72a0('0xa')](function(_0x2c72fd){var _0x1c95fc=[];_0x2c72fd[_0x72a0('0x9d')](function(_0x5a995e){var _0x36d8b9;switch(_0x5a995e[_0x72a0('0xa2')]){case _0x72a0('0xa3'):_0x36d8b9=_['find'](_0x7450c7['associatedResources'],function(_0x3e23e4){return _0x3e23e4['id']===_0x5a995e[_0x72a0('0x72')]&&_0x3e23e4[_0x72a0('0x12')]===_0x72a0('0xa4');});break;case _0x72a0('0xa5'):_0x36d8b9=_['find'](_0x7450c7['associatedResources'],function(_0x5c4170){return _0x5c4170['id']===_0x5a995e[_0x72a0('0x72')]&&_0x5c4170['type']===_0x72a0('0xa6');});break;}if(_0x36d8b9)_0x1c95fc['push'](_0x5a995e);});_0x1b8a72['count']=_0x1c95fc['length'];_0x1b8a72['rows']=_0x1c95fc;return _0x1b8a72;});}else{if(!_[_0x72a0('0x8a')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa7')])){_0x1df6fc[_0x72a0('0x7e')]['id']=_0x1df6fc['where']['id']?_[_0x72a0('0x90')](_0x1df6fc[_0x72a0('0x7e')]['id'],_0x2cb292['query'][_0x72a0('0xa7')]):_0x2cb292[_0x72a0('0x80')]['ids'];}return _0x335b7c[_0x421c35[_0x72a0('0x13')]][_0x72a0('0xa8')]({'where':_0x1df6fc[_0x72a0('0x7e')]})[_0x72a0('0xa')](function(_0x5e1638){_0x1b8a72['count']=_0x5e1638;if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa0')]){if(_0x421c35[_0x72a0('0x13')]===_0x72a0('0x1f')){_0x1df6fc[_0x72a0('0xa1')]=[{'model':_0x335b7c[_0x72a0('0xa9')],'as':'Tags','attributes':['id','name',_0x72a0('0xaa')],'required':_0x2cb292[_0x72a0('0x80')]['tag']?!![]:![]},{'model':_0x335b7c[_0x72a0('0xa9')],'as':_0x72a0('0xab'),'attributes':['id',_0x72a0('0xf'),_0x72a0('0xaa')],'through':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xac')]?{'attributes':[],'where':{'TagId':_0x2cb292[_0x72a0('0x80')]['tag']||undefined}}:{},'required':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xac')]?!![]:![]}];}else{_0x1df6fc[_0x72a0('0xa1')]=[{'all':!![]}];}}return _0x335b7c[_0x421c35['childModel']][_0x72a0('0x9')](_0x1df6fc);})[_0x72a0('0xa')](function(_0x346e03){_0x1b8a72[_0x72a0('0xad')]=_0x346e03;if(_0x154c9d===_0x72a0('0x57')&&_0x2cb292['query'][_0x72a0('0xae')]===_0x72a0('0xaf')){var _0x1f6d7d=[];for(var _0x417ac4=0x0;_0x417ac4<_0x1b8a72[_0x72a0('0xad')][_0x72a0('0x86')];_0x417ac4++){_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb0'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb2'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb3'),_0x1b8a72['rows'][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb4'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb5'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4]['dataValues']));_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb6'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));}return Promise[_0x72a0('0x8d')](_0x1f6d7d)[_0x72a0('0xa')](function(){return _0x1b8a72;});}return _0x1b8a72;});}});}}});}; \ No newline at end of file +var _0xf4f4=['attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filters','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','ids','CmContact','Tags','tag','ThroughTags','color','openTabs','rows','dataValues','all','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','findAll','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','Lists','lists','CmList','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','Schedule','sounds','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','Reports','reportId','AnalyticMetric','charAt','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','user_profiles','raw','section','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','keys','intersection'];(function(_0x528ab4,_0x52f76d){var _0x1f08c7=function(_0x100c8c){while(--_0x100c8c){_0x528ab4['push'](_0x528ab4['shift']());}};_0x1f08c7(++_0x52f76d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x924254,_0x48b83e){_0x924254=_0x924254-0x0;var _0x23d567=_0xf4f4[_0x924254];return _0x23d567;};'use strict';var _=require(_0x4f4f('0x0'));var attributes=require(_0x4f4f('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x4f4f('0x2'));module[_0x4f4f('0x3')]=function(_0x19aa05){var _0xfff808=_0x19aa05[_0x4f4f('0x4')];function _0x510b24(_0x5a752b,_0x593952){return new Promise(function(_0x3f274d,_0x132d5c){if(!_0x593952)return _0x3f274d(null);var _0x20ee6e=_0x593952[_0x4f4f('0x5')]?{[_0x593952[_0x4f4f('0x5')][_0x4f4f('0x6')]]:_0x593952[_0x4f4f('0x5')][_0x4f4f('0x7')]}:undefined;return _0xfff808[_0x5a752b]['findAll']({'where':_0x20ee6e,'raw':!![]})[_0x4f4f('0x8')](function(_0x38d110){_0x593952[_0x4f4f('0x9')]=_[_0x4f4f('0xa')](_0x38d110,'id');_0x3f274d(_0x593952);})[_0x4f4f('0xb')](function(_0x11940f){_0x132d5c(_0x11940f);});});}function _0x87a9a2(_0x7a0036,_0x49b9cf){return new Promise(function(_0x5956c6,_0x855e49){var _0x78c1c4=_0x7a0036[_0x4f4f('0x5')]?{[_0x7a0036[_0x4f4f('0x5')][_0x4f4f('0x6')]]:_0x7a0036[_0x4f4f('0x5')]['value']}:undefined;return _0xfff808[_0x7a0036[_0x4f4f('0xc')]]['findAll']({'where':_0x78c1c4,'raw':!![]})[_0x4f4f('0x8')](function(_0xe7c2d5){_0x49b9cf[_0x4f4f('0x9')]=_[_0x4f4f('0xa')](_0xe7c2d5,function(_0x4c849f){return _0x4c849f[_0x4f4f('0xd')];});_0x5956c6(_0x49b9cf);})['catch'](function(_0x47ab66){_0x855e49(_0x47ab66);});});}function _0x58de77(_0x422894,_0x8d65a2,_0x2d21ed){if(!_0x8d65a2)return Promise[_0x4f4f('0xe')](null);return new Promise(function(_0x2d5e5d,_0x1777eb){return _0xfff808[_0x4f4f('0xf')][_0x4f4f('0x10')]({'where':{'sectionId':_0x8d65a2['id']},'raw':!![]})[_0x4f4f('0x8')](function(_0x2f9397){if(_0x422894[_0x4f4f('0x6')]&&_0x422894[_0x4f4f('0x6')]!=='id'){_0x8d65a2['associatedResources']=_[_0x4f4f('0xa')](_0x2f9397,function(_0x4622c2){return _0x4622c2[_0x422894[_0x4f4f('0x6')]];});}else{if(_0x2d21ed===_0x4f4f('0x11')){_0x8d65a2[_0x4f4f('0x9')]=_[_0x4f4f('0xa')](_0x2f9397,function(_0x2eedcc){return{'id':_0x2eedcc[_0x4f4f('0x12')],'type':_0x2eedcc[_0x4f4f('0x13')]};});}else{_0x8d65a2[_0x4f4f('0x9')]=_[_0x4f4f('0xa')](_0x2f9397,function(_0x17832f){return _0x17832f[_0x4f4f('0x12')];});}}_0x2d5e5d(_0x8d65a2);})[_0x4f4f('0xb')](function(_0x5bda88){_0x1777eb(_0x5bda88);});});}function _0x4f7261(_0x525529,_0x272125){var _0x43e661={'parentSections':[]};switch(_0x525529['toLowerCase']()){case _0x4f4f('0x14'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x16');break;case _0x4f4f('0x17'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x18');break;case _0x4f4f('0x19'):_0x43e661['childModel']=_0x4f4f('0x1a');_0x43e661[_0x4f4f('0x1b')]=[{'name':_0x4f4f('0x1c'),'field':_0x4f4f('0xd'),'foreignKey':_0x4f4f('0x1d')}];break;case'projects':_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x1e');break;case _0x4f4f('0x1f'):_0x43e661['childModel']='CmContact';_0x43e661['parentSections']=[{'name':_0x4f4f('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0x4f4f('0x21'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x22');break;case'companies':_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x23');break;case'globalcustomfields':_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x24');break;case _0x4f4f('0x25'):_0x43e661['childModel']=_0x4f4f('0x26');break;case _0x4f4f('0x27'):_0x43e661['childModel']='ChatWebsite';break;case _0x4f4f('0x28'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x29');break;case _0x4f4f('0x2a'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x2b');break;case _0x4f4f('0x2c'):case _0x4f4f('0x2d'):case _0x4f4f('0x2e'):_0x43e661[_0x4f4f('0x15')]='VoiceExtension';break;case'contexts':_0x43e661[_0x4f4f('0x15')]='VoiceContext';break;case _0x4f4f('0x2f'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x30');break;case _0x4f4f('0x31'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x32');_0x43e661[_0x4f4f('0x1b')]=[{'name':_0x4f4f('0x33'),'field':_0x4f4f('0xd'),'foreignKey':_0x4f4f('0x34'),'model':_0x4f4f('0x35'),'filter':{'field':_0x4f4f('0x36'),'value':['agent']}},{'name':_0x4f4f('0x37'),'field':_0x4f4f('0xd'),'foreignKey':_0x4f4f('0x34'),'model':_0x4f4f('0x35'),'filter':{'field':_0x4f4f('0x36'),'value':[_0x4f4f('0x38')]}},{'name':_0x4f4f('0x39'),'field':_0x4f4f('0xd'),'foreignKey':_0x4f4f('0x3a'),'model':'VoiceQueue','filter':{'field':_0x4f4f('0x13'),'value':[_0x4f4f('0x3b')]}},{'name':_0x4f4f('0x3c'),'field':'name','foreignKey':'queue','model':_0x4f4f('0x3d'),'filter':{'field':_0x4f4f('0x13'),'value':[_0x4f4f('0x3e')]}}];break;case _0x4f4f('0x3f'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x40');break;case _0x4f4f('0x41'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x42');break;case _0x4f4f('0x43'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x44');break;case'ivrcampaigns':_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x45');break;case _0x4f4f('0x46'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x47');break;case'mailaccounts':_0x43e661['childModel']=_0x4f4f('0x48');break;case _0x4f4f('0x49'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x4a');break;case'openchannelqueues':_0x43e661[_0x4f4f('0x15')]='OpenchannelQueue';break;case _0x4f4f('0x4b'):_0x43e661['childModel']='OpenchannelAccount';break;case _0x4f4f('0x4c'):_0x43e661['childModel']=_0x4f4f('0x4d');break;case _0x4f4f('0x4e'):_0x43e661['childModel']=_0x4f4f('0x4f');break;case _0x4f4f('0x50'):_0x43e661['childModel']=_0x4f4f('0x51');break;case _0x4f4f('0x52'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x53');break;case _0x4f4f('0x54'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x55');break;case _0x4f4f('0x56'):case _0x4f4f('0x57'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x3d');if(_0x272125){_0x43e661[_0x4f4f('0x1b')]=[{'name':_0x4f4f('0x39')},{'name':_0x4f4f('0x3c')}];}break;case _0x4f4f('0x58'):case'agents':case _0x4f4f('0x59'):_0x43e661['childModel']='User';if(_0x272125){_0x43e661[_0x4f4f('0x1b')]=[{'name':_0x4f4f('0x5a'),'filter':{'field':'role','value':[_0x4f4f('0x5b'),_0x4f4f('0x5c')]},'ignore':!![]},{'name':_0x4f4f('0x33')},{'name':_0x4f4f('0x37')}];}break;case _0x4f4f('0x5d'):_0x43e661['childModel']=_0x4f4f('0x5e');break;case _0x4f4f('0x5f'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x60');break;case _0x4f4f('0x61'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x62');break;case _0x4f4f('0x63'):_0x43e661[_0x4f4f('0x15')]='SugarcrmAccount';break;case _0x4f4f('0x64'):_0x43e661[_0x4f4f('0x15')]='DeskAccount';break;case'zohoaccounts':_0x43e661['childModel']=_0x4f4f('0x65');break;case _0x4f4f('0x66'):_0x43e661[_0x4f4f('0x15')]='User';break;case _0x4f4f('0x67'):_0x43e661['childModel']=_0x4f4f('0x68');break;case _0x4f4f('0x69'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x6a');break;case _0x4f4f('0x6b'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x6c');break;case _0x4f4f('0x6d'):_0x43e661[_0x4f4f('0x15')]='Interval';break;case'pauses':_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x6e');break;case'scheduler':_0x43e661['childModel']=_0x4f4f('0x6f');break;case _0x4f4f('0x70'):_0x43e661[_0x4f4f('0x15')]='Sound';break;case'tags':_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x71');break;case _0x4f4f('0x72'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x73');break;case _0x4f4f('0x74'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x75');break;case _0x4f4f('0x76'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x77');break;case'variables':_0x43e661['childModel']=_0x4f4f('0x78');break;case _0x4f4f('0x79'):_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x7a');break;case'extractedreports':_0x43e661[_0x4f4f('0x15')]='AnalyticExtractedReport';_0x43e661[_0x4f4f('0x1b')]=[{'name':_0x4f4f('0x7b'),'field':'id','foreignKey':_0x4f4f('0x7c')}];break;case'metrics':_0x43e661[_0x4f4f('0x15')]=_0x4f4f('0x7d');break;}return _0x43e661;}function _0x23e9a9(_0x4f26af,_0x182633){var _0x324179=_0x4f26af[_0x4f4f('0x7e')](0x0)['toUpperCase']()+_0x4f26af[_0x4f4f('0x7f')](0x1);var _0x16f162={'type':_0xfff808[_0x4f4f('0x80')]['QueryTypes'][_0x4f4f('0x81')],'raw':!![]};return new Promise(function(_0x5418cd,_0x35701d){var _0x3b637d=squel[_0x4f4f('0x82')]()[_0x4f4f('0x6')](_0x4f4f('0x83')+_0x324179+_0x4f4f('0x84'),'id')[_0x4f4f('0x6')](_0x4f4f('0x85'))[_0x4f4f('0x86')](_0x4f4f('0x87')+_0x4f26af+_0x4f4f('0x88'),'ui')['where'](_0x4f4f('0x89'),_0x182633['id']);return _0xfff808[_0x4f4f('0x8a')][_0x4f4f('0x8b')](_0x3b637d['toString'](),_0x16f162)[_0x4f4f('0x8')](function(_0x43908e){_0x182633[_0x324179+_0x4f4f('0x8c')]=_0x43908e;_0x5418cd(_0x43908e);})[_0x4f4f('0xb')](function(_0x561411){_0x35701d(_0x561411);});});}return _0x19aa05[_0x4f4f('0x8d')](_0x4f4f('0x8e'),attributes,{'tableName':_0x4f4f('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x24928a){var _0x157af6={'raw':_0x24928a['query'][_0x4f4f('0x90')],'where':{}};var _0x484ae2={};var _0x19f927={'count':0x0,'rows':[]};var _0x320fd3=_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0x91')];var _0x132b97=_0x24928a[_0x4f4f('0x8b')]['mergeResources']||![];var _0x50590c=_0x4f7261(_0x320fd3,_0x132b97);if(!_0x50590c[_0x4f4f('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x320fd3+'\x27');var _0x4252fa=[{'name':_0x320fd3}];if(!_[_0x4f4f('0x92')](_0x50590c[_0x4f4f('0x1b')]))_0x4252fa=_0x50590c[_0x4f4f('0x1b')];var _0x468782=[];for(var _0x211fbb=0x0;_0x211fbb<_0x4252fa[_0x4f4f('0x93')];_0x211fbb++){_0x468782[_0x4f4f('0x94')](_0xfff808[_0x4f4f('0x95')][_0x4f4f('0x96')]({'where':{'userProfileId':_0x24928a[_0x4f4f('0x97')]['id'],'name':_0x4252fa[_0x211fbb]['name']},'raw':!![]}));}return Promise['all'](_0x468782)['then'](function(_0x3849ee){var _0x210e74=_['filter'](_0x3849ee,function(_0x21f344){return _0x21f344?_0x21f344:undefined;});var _0x3dfcdb=_[_0x4f4f('0x5')](_0x4252fa,[_0x4f4f('0x98'),!![]]);var _0x12523f=_[_0x4f4f('0x92')](_0x210e74)&&_['isEmpty'](_0x3dfcdb)?null:_[_0x4f4f('0x99')](_0x3dfcdb,_0x210e74);if(!_0x12523f)return null;var _0x12597f=[];for(var _0x434bcd=0x0;_0x434bcd<_0x12523f[_0x4f4f('0x93')];_0x434bcd++){var _0x33f4fd=_[_0x4f4f('0x96')](_0x4252fa,function(_0x1d756b){return _0x12523f[_0x434bcd]?_0x1d756b[_0x4f4f('0xd')]===_0x12523f[_0x434bcd]['name']:null;});if(_0x33f4fd){if(_0x12523f[_0x434bcd][_0x4f4f('0x98')]){_0x12597f[_0x4f4f('0x94')](_0x510b24(_0x50590c[_0x4f4f('0x15')],_0x12523f[_0x434bcd]));}else{if(!_0x12523f[_0x434bcd][_0x4f4f('0x9a')]){_0x12597f['push'](_0x58de77(_0x33f4fd,_0x12523f[_0x434bcd],_0x50590c[_0x4f4f('0x15')]));}else{if(_0x33f4fd['model']){_0x12597f[_0x4f4f('0x94')](_0x87a9a2(_0x33f4fd,_0x12523f[_0x434bcd]));}}}}}return Promise['all'](_0x12597f);})['then'](function(_0x8ca9a9){var _0xa19f8f=_0x8ca9a9;var _0x3cc272=null;if(_0xa19f8f){_0x3cc272=_0xa19f8f[_0x4f4f('0x93')]===0x1?_0xa19f8f[0x0]:null;}if(!_0x3cc272&&!_0xa19f8f)return _0x19f927;var _0x4f7d9f=_0xfff808[_0x50590c[_0x4f4f('0x15')]]['rawAttributes'];_0x484ae2[_0x4f4f('0xc')]=_['keys'](_0x4f7d9f);_0x484ae2[_0x4f4f('0x8b')]=_[_0x4f4f('0x9b')](_0x24928a[_0x4f4f('0x8b')]);_0x484ae2['filters']=_[_0x4f4f('0x9c')](_0x484ae2['model'],_0x484ae2[_0x4f4f('0x8b')]);_0x157af6[_0x4f4f('0x9d')]=_[_0x4f4f('0x9c')](_0x484ae2[_0x4f4f('0xc')],qs[_0x4f4f('0x9e')](_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0x9e')]));_0x157af6[_0x4f4f('0x9d')]=_0x157af6[_0x4f4f('0x9d')]['length']?_0x157af6[_0x4f4f('0x9d')]:_0x484ae2[_0x4f4f('0xc')];if(!_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0x9f')](_0x4f4f('0xa0'))){_0x157af6[_0x4f4f('0xa1')]=qs['limit'](_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xa1')]);_0x157af6[_0x4f4f('0xa2')]=qs[_0x4f4f('0xa2')](_0x24928a['query'][_0x4f4f('0xa2')]);}_0x157af6[_0x4f4f('0xa3')]=qs[_0x4f4f('0xa4')](_0x24928a['query'][_0x4f4f('0xa4')]);_0x157af6[_0x4f4f('0xa5')]=qs['filters'](_[_0x4f4f('0xa6')](_0x24928a[_0x4f4f('0x8b')],_0x484ae2[_0x4f4f('0xa7')]));if(_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0x5')]){_0x157af6[_0x4f4f('0xa5')]=_['merge'](_0x157af6[_0x4f4f('0xa5')],{'$or':_[_0x4f4f('0xa')](_0x4f7d9f,function(_0x28a6cd){if(_0x28a6cd[_0x4f4f('0x13')][_0x4f4f('0xa8')]!==_0x4f4f('0xa9')){var _0x5b6633={};_0x5b6633[_0x28a6cd[_0x4f4f('0x6')]]={'$like':'%'+_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0x5')]+'%'};return _0x5b6633;}})});}var _0x49b86a=[];var _0x3e46a0=null;var _0x29cec2={};if(_0x3cc272){_0x3e46a0=_[_0x4f4f('0x96')](_0x4252fa,[_0x4f4f('0xd'),_0x3cc272[_0x4f4f('0xd')]]);if(_0x3e46a0['field']){_0x29cec2={};if(_0x50590c[_0x4f4f('0x15')]==='AnalyticExtractedReport'){_0x29cec2[_0x3e46a0['foreignKey']]=_[_0x4f4f('0xa')](_0x3cc272[_0x4f4f('0x9')],'id');}else{_0x29cec2[_0x3e46a0[_0x4f4f('0xaa')]]=_0x3cc272[_0x4f4f('0x9')];}_0x49b86a[_0x4f4f('0x94')](_0x29cec2);}else{_0x157af6[_0x4f4f('0xa5')]['id']=_0x3cc272[_0x4f4f('0x9')];}}else{for(var _0x19e743=0x0;_0x19e743<_0xa19f8f[_0x4f4f('0x93')];_0x19e743++){_0x3e46a0=_['find'](_0x4252fa,[_0x4f4f('0xd'),_0xa19f8f[_0x19e743]['name']]);if(_0x3e46a0[_0x4f4f('0x6')]){_0x29cec2={};_0x29cec2[_0x3e46a0[_0x4f4f('0xaa')]]=_0xa19f8f[_0x19e743]['associatedResources'];_0x49b86a[_0x4f4f('0x94')](_0x29cec2);}else{if(!_0x157af6[_0x4f4f('0xa5')]['id'])_0x157af6[_0x4f4f('0xa5')]['id']=[];_0xa19f8f[_0x19e743][_0x4f4f('0x9')][_0x4f4f('0xab')](function(_0x6dfb3b){_0x157af6[_0x4f4f('0xa5')]['id'][_0x4f4f('0x94')](_0x6dfb3b);});}}}if(!_['isEmpty'](_0x49b86a)){_0x157af6[_0x4f4f('0xa5')]=_[_0x4f4f('0xac')](_0x157af6[_0x4f4f('0xa5')],{'$and':{'$or':_0x49b86a}});}_0x157af6=_['merge']({},_0x157af6,_0x24928a[_0x4f4f('0xad')]);if(_0x3cc272&&!_0x3cc272['autoAssociation']&&_0x50590c['childModel']===_0x4f4f('0x11')){if(_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xae')]){_0x157af6[_0x4f4f('0xaf')]=[{'all':!![]}];}return _0xfff808[_0x50590c['childModel']][_0x4f4f('0x10')](_0x157af6)['then'](function(_0xe6f06f){var _0x625d74=[];_0xe6f06f[_0x4f4f('0xab')](function(_0x2511be){var _0x2179f4;switch(_0x2511be[_0x4f4f('0xb0')]){case _0x4f4f('0xb1'):_0x2179f4=_[_0x4f4f('0x96')](_0x3cc272[_0x4f4f('0x9')],function(_0x53cc6c){return _0x53cc6c['id']===_0x2511be['reportId']&&_0x53cc6c['type']===_0x4f4f('0xb2');});break;case _0x4f4f('0xb3'):_0x2179f4=_[_0x4f4f('0x96')](_0x3cc272[_0x4f4f('0x9')],function(_0x515d05){return _0x515d05['id']===_0x2511be['reportId']&&_0x515d05[_0x4f4f('0x13')]===_0x4f4f('0xb4');});break;}if(_0x2179f4)_0x625d74[_0x4f4f('0x94')](_0x2511be);});_0x19f927[_0x4f4f('0xb5')]=_0x625d74[_0x4f4f('0x93')];_0x19f927['rows']=_0x625d74;return _0x19f927;});}else{if(!_[_0x4f4f('0x92')](_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xb6')])){_0x157af6[_0x4f4f('0xa5')]['id']=_0x157af6[_0x4f4f('0xa5')]['id']?_['intersection'](_0x157af6[_0x4f4f('0xa5')]['id'],_0x24928a['query']['ids']):_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xb6')];}return _0xfff808[_0x50590c[_0x4f4f('0x15')]]['count']({'where':_0x157af6[_0x4f4f('0xa5')]})[_0x4f4f('0x8')](function(_0x56015c){_0x19f927[_0x4f4f('0xb5')]=_0x56015c;if(_0x24928a[_0x4f4f('0x8b')]['includeAll']){if(_0x50590c[_0x4f4f('0x15')]===_0x4f4f('0xb7')){_0x157af6[_0x4f4f('0xaf')]=[{'model':_0xfff808[_0x4f4f('0x71')],'as':_0x4f4f('0xb8'),'attributes':['id',_0x4f4f('0xd'),'color'],'required':_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xb9')]?!![]:![]},{'model':_0xfff808[_0x4f4f('0x71')],'as':_0x4f4f('0xba'),'attributes':['id',_0x4f4f('0xd'),_0x4f4f('0xbb')],'through':_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xb9')]?{'attributes':[],'where':{'TagId':_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xb9')]||undefined}}:{},'required':_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xb9')]?!![]:![]}];}else{_0x157af6[_0x4f4f('0xaf')]=[{'all':!![]}];}}return _0xfff808[_0x50590c[_0x4f4f('0x15')]][_0x4f4f('0x10')](_0x157af6);})['then'](function(_0x261678){_0x19f927['rows']=_0x261678;if(_0x320fd3===_0x4f4f('0x33')&&_0x24928a[_0x4f4f('0x8b')][_0x4f4f('0xbc')]==='true'){var _0x3493db=[];for(var _0x183974=0x0;_0x183974<_0x19f927[_0x4f4f('0xbd')][_0x4f4f('0x93')];_0x183974++){_0x3493db[_0x4f4f('0x94')](_0x23e9a9('chat',_0x19f927[_0x4f4f('0xbd')][_0x183974][_0x4f4f('0xbe')]));_0x3493db[_0x4f4f('0x94')](_0x23e9a9('sms',_0x19f927[_0x4f4f('0xbd')][_0x183974][_0x4f4f('0xbe')]));_0x3493db[_0x4f4f('0x94')](_0x23e9a9('fax',_0x19f927[_0x4f4f('0xbd')][_0x183974]['dataValues']));_0x3493db[_0x4f4f('0x94')](_0x23e9a9('mail',_0x19f927['rows'][_0x183974]['dataValues']));_0x3493db['push'](_0x23e9a9('openchannel',_0x19f927[_0x4f4f('0xbd')][_0x183974][_0x4f4f('0xbe')]));_0x3493db['push'](_0x23e9a9('whatsapp',_0x19f927[_0x4f4f('0xbd')][_0x183974][_0x4f4f('0xbe')]));}return Promise[_0x4f4f('0xbf')](_0x3493db)['then'](function(){return _0x19f927;});}return _0x19f927;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6542387..6fb4a55 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 _0xb145=['http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4ca9ea,_0x6a1242){var _0x1a45d8=function(_0x383366){while(--_0x383366){_0x4ca9ea['push'](_0x4ca9ea['shift']());}};_0x1a45d8(++_0x6a1242);}(_0xb145,0xa3));var _0x5b14=function(_0x587bb5,_0x89c515){_0x587bb5=_0x587bb5-0x0;var _0x20684a=_0xb145[_0x587bb5];return _0x20684a;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});config['redis']=_[_0x5b14('0xc')](config[_0x5b14('0xd')],{'host':_0x5b14('0xe'),'port':0x18eb});var socket=require(_0x5b14('0xf'))(new Redis(config[_0x5b14('0xd')]));require('./userProfile.socket')[_0x5b14('0x10')](socket);function respondWithRpcPromise(_0x3bdb54,_0x4a4557,_0x1d8b5f){return new BPromise(function(_0x17047f,_0x1ecffb){return client[_0x5b14('0x11')](_0x3bdb54,_0x1d8b5f)[_0x5b14('0x12')](function(_0x4fb6da){logger[_0x5b14('0x13')]('UserProfile,\x20%s,\x20%s',_0x4a4557,_0x5b14('0x14'));logger[_0x5b14('0x15')](_0x5b14('0x16'),_0x4a4557,_0x5b14('0x14'),JSON[_0x5b14('0x17')](_0x4fb6da));if(_0x4fb6da[_0x5b14('0x18')]){if(_0x4fb6da['error'][_0x5b14('0x19')]===0x1f4){logger[_0x5b14('0x18')](_0x5b14('0x1a'),_0x4a4557,_0x4fb6da[_0x5b14('0x18')][_0x5b14('0x1b')]);return _0x1ecffb(_0x4fb6da[_0x5b14('0x18')][_0x5b14('0x1b')]);}logger[_0x5b14('0x18')](_0x5b14('0x1a'),_0x4a4557,_0x4fb6da[_0x5b14('0x18')][_0x5b14('0x1b')]);return _0x17047f(_0x4fb6da[_0x5b14('0x18')]['message']);}else{logger[_0x5b14('0x13')]('UserProfile,\x20%s,\x20%s',_0x4a4557,'request\x20sent');_0x17047f(_0x4fb6da['result'][_0x5b14('0x1b')]);}})[_0x5b14('0x1c')](function(_0x3662a7){logger[_0x5b14('0x18')](_0x5b14('0x1a'),_0x4a4557,_0x3662a7);_0x1ecffb(_0x3662a7);});});} \ No newline at end of file +var _0xd2f5=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x12bf1f,_0x339a57){var _0x5418e9=function(_0x31446f){while(--_0x31446f){_0x12bf1f['push'](_0x12bf1f['shift']());}};_0x5418e9(++_0x339a57);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x47f599,_0x1102b5){_0x47f599=_0x47f599-0x0;var _0x2eb63a=_0xd2f5[_0x47f599];return _0x2eb63a;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d2f('0x8')][_0x5d2f('0x9')]({'port':0x232a});config[_0x5d2f('0xa')]=_['defaults'](config[_0x5d2f('0xa')],{'host':_0x5d2f('0xb'),'port':0x18eb});var socket=require(_0x5d2f('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0x5d2f('0xd')](socket);function respondWithRpcPromise(_0x133332,_0x575f72,_0x1ee975){return new BPromise(function(_0x35f701,_0x5d7327){return client['request'](_0x133332,_0x1ee975)[_0x5d2f('0xe')](function(_0x458f43){logger['info'](_0x5d2f('0xf'),_0x575f72,_0x5d2f('0x10'));logger[_0x5d2f('0x11')](_0x5d2f('0x12'),_0x575f72,_0x5d2f('0x10'),JSON[_0x5d2f('0x13')](_0x458f43));if(_0x458f43[_0x5d2f('0x14')]){if(_0x458f43['error']['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x575f72,_0x458f43[_0x5d2f('0x14')]['message']);return _0x5d7327(_0x458f43[_0x5d2f('0x14')][_0x5d2f('0x15')]);}logger[_0x5d2f('0x14')](_0x5d2f('0xf'),_0x575f72,_0x458f43['error'][_0x5d2f('0x15')]);return _0x35f701(_0x458f43[_0x5d2f('0x14')]['message']);}else{logger[_0x5d2f('0x16')](_0x5d2f('0xf'),_0x575f72,_0x5d2f('0x10'));_0x35f701(_0x458f43[_0x5d2f('0x17')][_0x5d2f('0x15')]);}})[_0x5d2f('0x18')](function(_0x12c3e3){logger[_0x5d2f('0x14')](_0x5d2f('0xf'),_0x575f72,_0x12c3e3);_0x5d7327(_0x12c3e3);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d231da1..93ea276 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 _0x0afc=['./userProfile.events','save','remove','update','removeListener','length','userProfile:'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x0afc,0x150));var _0xc0af=function(_0x25a99e,_0x574f6a){_0x25a99e=_0x25a99e-0x0;var _0x5bde0b=_0x0afc[_0x25a99e];return _0x5bde0b;};'use strict';var UserProfileEvents=require(_0xc0af('0x0'));var events=[_0xc0af('0x1'),_0xc0af('0x2'),_0xc0af('0x3')];function createListener(_0x48f810,_0x4649e2){return function(_0x56d563){_0x4649e2['emit'](_0x48f810,_0x56d563);};}function removeListener(_0x139ad7,_0x3bd627){return function(){UserProfileEvents[_0xc0af('0x4')](_0x139ad7,_0x3bd627);};}exports['register']=function(_0x2d3ebf){for(var _0x132ebd=0x0,_0x10e4b6=events[_0xc0af('0x5')];_0x132ebd<_0x10e4b6;_0x132ebd++){var _0x4563ce=events[_0x132ebd];var _0x1a7372=createListener(_0xc0af('0x6')+_0x4563ce,_0x2d3ebf);UserProfileEvents['on'](_0x4563ce,_0x1a7372);}}; \ No newline at end of file +var _0xd8d1=['emit','register','userProfile:','./userProfile.events','remove','update'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0xd8d1,0x7b));var _0x1d8d=function(_0x490f14,_0x59a323){_0x490f14=_0x490f14-0x0;var _0x435f6f=_0xd8d1[_0x490f14];return _0x435f6f;};'use strict';var UserProfileEvents=require(_0x1d8d('0x0'));var events=['save',_0x1d8d('0x1'),_0x1d8d('0x2')];function createListener(_0xe41013,_0x484a1f){return function(_0x28e4e2){_0x484a1f[_0x1d8d('0x3')](_0xe41013,_0x28e4e2);};}function removeListener(_0x5764c4,_0x354656){return function(){UserProfileEvents['removeListener'](_0x5764c4,_0x354656);};}exports[_0x1d8d('0x4')]=function(_0x4c832c){for(var _0x3bcedc=0x0,_0x2f5797=events['length'];_0x3bcedc<_0x2f5797;_0x3bcedc++){var _0x5468de=events[_0x3bcedc];var _0x2922ae=createListener(_0x1d8d('0x5')+_0x5468de,_0x4c832c);UserProfileEvents['on'](_0x5468de,_0x2922ae);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bf460f1..abc1818 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 _0x58df=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','destroy','exports','multer','path'];(function(_0x342cb9,_0x42ba68){var _0x9456bc=function(_0xade2e0){while(--_0xade2e0){_0x342cb9['push'](_0x342cb9['shift']());}};_0x9456bc(++_0x42ba68);}(_0x58df,0xb2));var _0xf58d=function(_0x5c3b95,_0xb8ad2f){_0x5c3b95=_0x5c3b95-0x0;var _0x318175=_0x58df[_0x5c3b95];return _0x318175;};'use strict';var multer=require(_0xf58d('0x0'));var util=require('util');var path=require(_0xf58d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf58d('0x2')]();var fs_extra=require(_0xf58d('0x3'));var auth=require(_0xf58d('0x4'));var interaction=require(_0xf58d('0x5'));var config=require(_0xf58d('0x6'));var controller=require(_0xf58d('0x7'));router[_0xf58d('0x8')]('/',auth[_0xf58d('0x9')](),controller[_0xf58d('0xa')]);router['get']('/describe',auth[_0xf58d('0x9')](),controller[_0xf58d('0xb')]);router[_0xf58d('0x8')]('/:id',auth[_0xf58d('0x9')](),controller[_0xf58d('0xc')]);router[_0xf58d('0xd')]('/',auth['isAuthenticated'](),controller[_0xf58d('0xe')]);router[_0xf58d('0xf')](_0xf58d('0x10'),auth[_0xf58d('0x9')](),controller[_0xf58d('0x11')]);router['delete'](_0xf58d('0x10'),auth[_0xf58d('0x9')](),controller[_0xf58d('0x12')]);module[_0xf58d('0x13')]=router; \ No newline at end of file +var _0x87a2=['get','/describe','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x87a2,0x14a));var _0x287a=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x87a2[_0x2fd160];return _0x5c2031;};'use strict';var multer=require(_0x287a('0x0'));var util=require(_0x287a('0x1'));var path=require(_0x287a('0x2'));var timeout=require('connect-timeout');var express=require(_0x287a('0x3'));var router=express[_0x287a('0x4')]();var fs_extra=require(_0x287a('0x5'));var auth=require(_0x287a('0x6'));var interaction=require(_0x287a('0x7'));var config=require(_0x287a('0x8'));var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x287a('0x9')]);router[_0x287a('0xa')](_0x287a('0xb'),auth[_0x287a('0xc')](),controller['describe']);router['get']('/:id',auth[_0x287a('0xc')](),controller[_0x287a('0xd')]);router[_0x287a('0xe')]('/',auth['isAuthenticated'](),controller[_0x287a('0xf')]);router[_0x287a('0x10')]('/:id',auth[_0x287a('0xc')](),controller[_0x287a('0x11')]);router['delete']('/:id',auth[_0x287a('0xc')](),controller[_0x287a('0x12')]);module[_0x287a('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index eb644ec..f13c88b 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 _0x5b07=['INTEGER','sequelize','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5b07,0x1ad));var _0x75b0=function(_0x4d81ba,_0x370e4f){_0x4d81ba=_0x4d81ba-0x0;var _0xfe2031=_0x5b07[_0x4d81ba];return _0xfe2031;};'use strict';var Sequelize=require(_0x75b0('0x0'));module[_0x75b0('0x1')]={'name':{'type':Sequelize[_0x75b0('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x75b0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x75b0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xac17=['STRING','INTEGER','sequelize','exports'];(function(_0x24ae03,_0x334660){var _0x38a29e=function(_0x25e64b){while(--_0x25e64b){_0x24ae03['push'](_0x24ae03['shift']());}};_0x38a29e(++_0x334660);}(_0xac17,0x11e));var _0x7ac1=function(_0x4ee3df,_0x1939e5){_0x4ee3df=_0x4ee3df-0x0;var _0x10a525=_0xac17[_0x4ee3df];return _0x10a525;};'use strict';var Sequelize=require(_0x7ac1('0x0'));module[_0x7ac1('0x1')]={'name':{'type':Sequelize[_0x7ac1('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7ac1('0x3')],'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 690abc4..793f987 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 _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6d38[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['UserProfileResource'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file +var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xba34,0x119));var _0x4ba3=function(_0x120aea,_0x3967ff){_0x120aea=_0x120aea-0x0;var _0x38d4ae=_0xba34[_0x120aea];return _0x38d4ae;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6006dc0..221f320 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 _0x04cd=['../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2dd5bc,_0x166078){var _0x15304d=function(_0x542796){while(--_0x542796){_0x2dd5bc['push'](_0x2dd5bc['shift']());}};_0x15304d(++_0x166078);}(_0x04cd,0x103));var _0xd04c=function(_0x29988d,_0x288cfc){_0x29988d=_0x29988d-0x0;var _0x4263a6=_0x04cd[_0x29988d];return _0x4263a6;};'use strict';var _=require('lodash');var util=require(_0xd04c('0x0'));var logger=require(_0xd04c('0x1'))(_0xd04c('0x2'));var moment=require('moment');var BPromise=require(_0xd04c('0x3'));var rp=require(_0xd04c('0x4'));var fs=require('fs');var path=require(_0xd04c('0x5'));var rimraf=require(_0xd04c('0x6'));var config=require(_0xd04c('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xd04c('0x8')]=function(_0x350a93,_0x53c3ee){return _0x350a93[_0xd04c('0x9')](_0xd04c('0xa'),attributes,{'tableName':_0xd04c('0xb'),'paranoid':![],'indexes':[{'name':_0xd04c('0xc'),'fields':['resourceId',_0xd04c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99cb=['exports','UserProfileResource','compositeIndex','sectionId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x99cb,0x7c));var _0xb99c=function(_0x2c5583,_0x4acf14){_0x2c5583=_0x2c5583-0x0;var _0x3f2b90=_0x99cb[_0x2c5583];return _0x3f2b90;};'use strict';var _=require(_0xb99c('0x0'));var util=require('util');var logger=require(_0xb99c('0x1'))('api');var moment=require(_0xb99c('0x2'));var BPromise=require(_0xb99c('0x3'));var rp=require(_0xb99c('0x4'));var fs=require('fs');var path=require(_0xb99c('0x5'));var rimraf=require(_0xb99c('0x6'));var config=require(_0xb99c('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xb99c('0x8')]=function(_0x275def,_0x47a9e2){return _0x275def['define'](_0xb99c('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xb99c('0xa'),'fields':['resourceId',_0xb99c('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 8b48395..7f579af 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 _0x6bc7=['result','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','http','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message'];(function(_0x4ee45e,_0x35337e){var _0x576864=function(_0x1bc470){while(--_0x1bc470){_0x4ee45e['push'](_0x4ee45e['shift']());}};_0x576864(++_0x35337e);}(_0x6bc7,0x1aa));var _0x76bc=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0x6bc7[_0x2cdcf9];return _0x39412d;};'use strict';var _=require('lodash');var util=require(_0x76bc('0x0'));var moment=require(_0x76bc('0x1'));var BPromise=require(_0x76bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x76bc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x76bc('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76bc('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xffdc4d,_0x34f812,_0x603b13){return new BPromise(function(_0x4cf836,_0x52bb14){return client['request'](_0xffdc4d,_0x603b13)[_0x76bc('0x7')](function(_0x6e7d9f){logger[_0x76bc('0x8')]('UserProfileResource,\x20%s,\x20%s',_0x34f812,_0x76bc('0x9'));logger['debug'](_0x76bc('0xa'),_0x34f812,_0x76bc('0x9'),JSON[_0x76bc('0xb')](_0x6e7d9f));if(_0x6e7d9f[_0x76bc('0xc')]){if(_0x6e7d9f[_0x76bc('0xc')][_0x76bc('0xd')]===0x1f4){logger[_0x76bc('0xc')](_0x76bc('0xe'),_0x34f812,_0x6e7d9f[_0x76bc('0xc')]['message']);return _0x52bb14(_0x6e7d9f[_0x76bc('0xc')][_0x76bc('0xf')]);}logger['error'](_0x76bc('0xe'),_0x34f812,_0x6e7d9f[_0x76bc('0xc')][_0x76bc('0xf')]);return _0x4cf836(_0x6e7d9f['error'][_0x76bc('0xf')]);}else{logger['info'](_0x76bc('0xe'),_0x34f812,_0x76bc('0x9'));_0x4cf836(_0x6e7d9f[_0x76bc('0x10')]['message']);}})['catch'](function(_0x35d08e){logger['error'](_0x76bc('0xe'),_0x34f812,_0x35d08e);_0x52bb14(_0x35d08e);});});} \ No newline at end of file +var _0xc640=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x41e988,_0x375a48){var _0x1d8e23=function(_0x3dc552){while(--_0x3dc552){_0x41e988['push'](_0x41e988['shift']());}};_0x1d8e23(++_0x375a48);}(_0xc640,0x1a5));var _0x0c64=function(_0x51b02c,_0x240b6d){_0x51b02c=_0x51b02c-0x0;var _0x17ee4c=_0xc640[_0x51b02c];return _0x17ee4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c64('0x0'));var BPromise=require(_0x0c64('0x1'));var rs=require(_0x0c64('0x2'));var fs=require('fs');var Redis=require(_0x0c64('0x3'));var db=require(_0x0c64('0x4'))['db'];var utils=require(_0x0c64('0x5'));var logger=require(_0x0c64('0x6'))('rpc');var config=require(_0x0c64('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c64('0x8')][_0x0c64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4925de,_0x48c576,_0x53b6f9){return new BPromise(function(_0x421b0b,_0x32d09f){return client['request'](_0x4925de,_0x53b6f9)[_0x0c64('0xa')](function(_0x44f385){logger[_0x0c64('0xb')](_0x0c64('0xc'),_0x48c576,_0x0c64('0xd'));logger['debug'](_0x0c64('0xe'),_0x48c576,'request\x20sent',JSON[_0x0c64('0xf')](_0x44f385));if(_0x44f385[_0x0c64('0x10')]){if(_0x44f385[_0x0c64('0x10')][_0x0c64('0x11')]===0x1f4){logger[_0x0c64('0x10')](_0x0c64('0xc'),_0x48c576,_0x44f385[_0x0c64('0x10')]['message']);return _0x32d09f(_0x44f385['error'][_0x0c64('0x12')]);}logger[_0x0c64('0x10')](_0x0c64('0xc'),_0x48c576,_0x44f385[_0x0c64('0x10')][_0x0c64('0x12')]);return _0x421b0b(_0x44f385[_0x0c64('0x10')][_0x0c64('0x12')]);}else{logger[_0x0c64('0xb')](_0x0c64('0xc'),_0x48c576,_0x0c64('0xd'));_0x421b0b(_0x44f385[_0x0c64('0x13')][_0x0c64('0x12')]);}})[_0x0c64('0x14')](function(_0x54b79e){logger[_0x0c64('0x10')](_0x0c64('0xc'),_0x48c576,_0x54b79e);_0x32d09f(_0x54b79e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index f780f5a..e6a3c5d 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 _0xb13b=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb13b,0x11e));var _0xbb13=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb13b[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var path=require('path');var timeout=require(_0xbb13('0x2'));var express=require('express');var router=express[_0xbb13('0x3')]();var fs_extra=require(_0xbb13('0x4'));var auth=require(_0xbb13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbb13('0x6'));var controller=require(_0xbb13('0x7'));router[_0xbb13('0x8')]('/',auth[_0xbb13('0x9')](),controller[_0xbb13('0xa')]);router['get'](_0xbb13('0xb'),auth[_0xbb13('0x9')](),controller[_0xbb13('0xc')]);router['get'](_0xbb13('0xd'),auth[_0xbb13('0x9')](),controller['show']);router[_0xbb13('0xe')]('/',auth[_0xbb13('0x9')](),controller[_0xbb13('0xf')]);router['put'](_0xbb13('0xd'),auth[_0xbb13('0x9')](),controller[_0xbb13('0x10')]);router['delete'](_0xbb13('0xd'),auth[_0xbb13('0x9')](),controller[_0xbb13('0x11')]);module[_0xbb13('0x12')]=router; \ No newline at end of file +var _0x18a1=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x18a1,0x116));var _0x118a=function(_0x5bff12,_0xa7f539){_0x5bff12=_0x5bff12-0x0;var _0x22c426=_0x18a1[_0x5bff12];return _0x22c426;};'use strict';var multer=require(_0x118a('0x0'));var util=require(_0x118a('0x1'));var path=require(_0x118a('0x2'));var timeout=require(_0x118a('0x3'));var express=require(_0x118a('0x4'));var router=express[_0x118a('0x5')]();var fs_extra=require(_0x118a('0x6'));var auth=require(_0x118a('0x7'));var interaction=require(_0x118a('0x8'));var config=require(_0x118a('0x9'));var controller=require('./userProfileSection.controller');router[_0x118a('0xa')]('/',auth[_0x118a('0xb')](),controller[_0x118a('0xc')]);router[_0x118a('0xa')](_0x118a('0xd'),auth[_0x118a('0xb')](),controller[_0x118a('0xe')]);router[_0x118a('0xa')](_0x118a('0xf'),auth[_0x118a('0xb')](),controller[_0x118a('0x10')]);router[_0x118a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x118a('0x12')](_0x118a('0xf'),auth[_0x118a('0xb')](),controller[_0x118a('0x13')]);router[_0x118a('0x14')](_0x118a('0xf'),auth['isAuthenticated'](),controller[_0x118a('0x15')]);module[_0x118a('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8f5f866..a49d7f9 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 _0x1c9a=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split'];(function(_0x9b98de,_0x15b574){var _0xbb0ea1=function(_0x1dd1b7){while(--_0x1dd1b7){_0x9b98de['push'](_0x9b98de['shift']());}};_0xbb0ea1(++_0x15b574);}(_0x1c9a,0x98));var _0xa1c9=function(_0x1f646b,_0x421bd7){_0x1f646b=_0x1f646b-0x0;var _0x3d5a25=_0x1c9a[_0x1f646b];return _0x3d5a25;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x21c0fc){this[_0xa1c9('0x4')](_0xa1c9('0x5'),_0x21c0fc?_0x21c0fc[_0xa1c9('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa1c9('0x5'))?this['getDataValue'](_0xa1c9('0x5'))[_0xa1c9('0x7')](''):[];}}}; \ No newline at end of file +var _0xa5fa=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x4f7fe0,_0x18201f){_0x4f7fe0=_0x4f7fe0-0x0;var _0x1e2851=_0xa5fa[_0x4f7fe0];return _0x1e2851;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'name':{'type':Sequelize[_0xaa5f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xaa5f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa5f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa5f('0x1')],'set':function(_0x4d1c8b){this[_0xaa5f('0x4')](_0xaa5f('0x5'),_0x4d1c8b?_0x4d1c8b[_0xaa5f('0x6')](''):[]);},'get':function(){return this[_0xaa5f('0x7')](_0xaa5f('0x5'))?this[_0xaa5f('0x7')](_0xaa5f('0x5'))[_0xaa5f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 451bfb1..d5a83e2 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 _0x963a=['intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','UserProfileSection','findAll','catch','params','keys','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x963a,0x176));var _0xa963=function(_0x308391,_0x5965ff){_0x308391=_0x308391-0x0;var _0x40a4a0=_0x963a[_0x308391];return _0x40a4a0;};'use strict';var emlformat=require(_0xa963('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa963('0x1'));var jsonpatch=require(_0xa963('0x2'));var rp=require(_0xa963('0x3'));var moment=require(_0xa963('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa963('0x5'));var util=require(_0xa963('0x6'));var path=require(_0xa963('0x7'));var sox=require(_0xa963('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa963('0x9'));var _=require('lodash');var squel=require(_0xa963('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa963('0xb'));var Papa=require(_0xa963('0xc'));var Redis=require('ioredis');var authService=require(_0xa963('0xd'));var qs=require(_0xa963('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa963('0xf'))(_0xa963('0x10'));var utils=require(_0xa963('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa963('0x12'));var db=require(_0xa963('0x13'))['db'];function respondWithStatusCode(_0x5cadb4,_0x226604){_0x226604=_0x226604||0xcc;return function(_0x4ce690){if(_0x4ce690){return _0x5cadb4[_0xa963('0x14')](_0x226604);}return _0x5cadb4[_0xa963('0x15')](_0x226604)[_0xa963('0x16')]();};}function respondWithResult(_0xe93110,_0x5a9d67){_0x5a9d67=_0x5a9d67||0xc8;return function(_0x1d1389){if(_0x1d1389){return _0xe93110[_0xa963('0x15')](_0x5a9d67)[_0xa963('0x17')](_0x1d1389);}};}function respondWithFilteredResult(_0x5df26f,_0x489273){return function(_0x4a65a5){if(_0x4a65a5){var _0xea40d4=typeof _0x489273[_0xa963('0x18')]===_0xa963('0x19')&&typeof _0x489273[_0xa963('0x1a')]===_0xa963('0x19');var _0x5fb1dc=_0x4a65a5['count'];var _0x82595f=_0xea40d4?0x0:_0x489273[_0xa963('0x18')];var _0x3655c1=_0xea40d4?_0x4a65a5['count']:_0x489273[_0xa963('0x18')]+_0x489273[_0xa963('0x1a')];var _0x335176;if(_0x3655c1>=_0x5fb1dc){_0x3655c1=_0x5fb1dc;_0x335176=0xc8;}else{_0x335176=0xce;}_0x5df26f['status'](_0x335176);return _0x5df26f[_0xa963('0x1b')]('Content-Range',_0x82595f+'-'+_0x3655c1+'/'+_0x5fb1dc)['json'](_0x4a65a5);}return null;};}function patchUpdates(_0x3c35e6){return function(_0x1770c6){try{jsonpatch[_0xa963('0x1c')](_0x1770c6,_0x3c35e6,!![]);}catch(_0x5ad61e){return BPromise[_0xa963('0x1d')](_0x5ad61e);}return _0x1770c6[_0xa963('0x1e')]();};}function saveUpdates(_0x4c482b,_0x2c53dd){return function(_0x3f8881){if(_0x3f8881){return _0x3f8881[_0xa963('0x1f')](_0x4c482b)[_0xa963('0x20')](function(_0x508610){return _0x508610;});}return null;};}function removeEntity(_0x42d0d9,_0x572cc7){return function(_0x21b8f4){if(_0x21b8f4){return _0x21b8f4[_0xa963('0x21')]()[_0xa963('0x20')](function(){_0x42d0d9[_0xa963('0x15')](0xcc)[_0xa963('0x16')]();});}};}function handleEntityNotFound(_0x3a0eb6,_0x3693af){return function(_0x20e952){if(!_0x20e952){_0x3a0eb6[_0xa963('0x14')](0x194);}return _0x20e952;};}function handleError(_0x47c6a0,_0x16e561){_0x16e561=_0x16e561||0x1f4;return function(_0x293f22){logger[_0xa963('0x22')](_0x293f22[_0xa963('0x23')]);if(_0x293f22[_0xa963('0x24')]){delete _0x293f22[_0xa963('0x24')];}_0x47c6a0[_0xa963('0x15')](_0x16e561)[_0xa963('0x25')](_0x293f22);};}exports[_0xa963('0x26')]=function(_0x1681b7,_0x57efe0){var _0x35edb0={},_0x3f906d={},_0x51ef2e={'count':0x0,'rows':[]};var _0x5d439e=_[_0xa963('0x27')](db['UserProfileSection'][_0xa963('0x28')],function(_0x80cd1a){return{'name':_0x80cd1a[_0xa963('0x29')],'type':_0x80cd1a['type'][_0xa963('0x2a')]};});_0x3f906d[_0xa963('0x2b')]=_[_0xa963('0x27')](_0x5d439e,_0xa963('0x24'));_0x3f906d[_0xa963('0x2c')]=_['keys'](_0x1681b7[_0xa963('0x2c')]);_0x3f906d[_0xa963('0x2d')]=_[_0xa963('0x2e')](_0x3f906d[_0xa963('0x2b')],_0x3f906d['query']);_0x35edb0['attributes']=_[_0xa963('0x2e')](_0x3f906d[_0xa963('0x2b')],qs['fields'](_0x1681b7[_0xa963('0x2c')]['fields']));_0x35edb0['attributes']=_0x35edb0[_0xa963('0x2f')]['length']?_0x35edb0[_0xa963('0x2f')]:_0x3f906d[_0xa963('0x2b')];if(!_0x1681b7[_0xa963('0x2c')][_0xa963('0x30')](_0xa963('0x31'))){_0x35edb0[_0xa963('0x1a')]=qs[_0xa963('0x1a')](_0x1681b7[_0xa963('0x2c')][_0xa963('0x1a')]);_0x35edb0[_0xa963('0x18')]=qs[_0xa963('0x18')](_0x1681b7[_0xa963('0x2c')][_0xa963('0x18')]);}_0x35edb0[_0xa963('0x32')]=qs[_0xa963('0x33')](_0x1681b7[_0xa963('0x2c')][_0xa963('0x33')]);_0x35edb0[_0xa963('0x34')]=qs[_0xa963('0x2d')](_[_0xa963('0x35')](_0x1681b7['query'],_0x3f906d[_0xa963('0x2d')]),_0x5d439e);if(_0x1681b7['query'][_0xa963('0x36')]){_0x35edb0['where']=_['merge'](_0x35edb0['where'],{'$or':_[_0xa963('0x27')](_0x5d439e,function(_0x11c495){if(_0x11c495['type']!=='VIRTUAL'){var _0xb906d7={};_0xb906d7[_0x11c495[_0xa963('0x24')]]={'$like':'%'+_0x1681b7['query'][_0xa963('0x36')]+'%'};return _0xb906d7;}})});}_0x35edb0=_[_0xa963('0x37')]({},_0x35edb0,_0x1681b7[_0xa963('0x38')]);var _0x1e6180={'where':_0x35edb0[_0xa963('0x34')]};return db['UserProfileSection']['count'](_0x1e6180)['then'](function(_0x545f34){_0x51ef2e[_0xa963('0x39')]=_0x545f34;if(_0x1681b7[_0xa963('0x2c')][_0xa963('0x3a')]){_0x35edb0[_0xa963('0x3b')]=[{'all':!![]}];}return db[_0xa963('0x3c')][_0xa963('0x3d')](_0x35edb0);})[_0xa963('0x20')](function(_0x3dd2a8){_0x51ef2e['rows']=_0x3dd2a8;return _0x51ef2e;})[_0xa963('0x20')](respondWithFilteredResult(_0x57efe0,_0x35edb0))[_0xa963('0x3e')](handleError(_0x57efe0,null));};exports['show']=function(_0x41a0b2,_0x404743){var _0xf6616a={'raw':![],'where':{'id':_0x41a0b2[_0xa963('0x3f')]['id']}},_0x4e00d9={};_0x4e00d9[_0xa963('0x2b')]=_[_0xa963('0x40')](db['UserProfileSection']['rawAttributes']);_0x4e00d9[_0xa963('0x2c')]=_[_0xa963('0x40')](_0x41a0b2[_0xa963('0x2c')]);_0x4e00d9[_0xa963('0x2d')]=_[_0xa963('0x2e')](_0x4e00d9[_0xa963('0x2b')],_0x4e00d9[_0xa963('0x2c')]);_0xf6616a[_0xa963('0x2f')]=_[_0xa963('0x2e')](_0x4e00d9[_0xa963('0x2b')],qs[_0xa963('0x41')](_0x41a0b2[_0xa963('0x2c')][_0xa963('0x41')]));_0xf6616a[_0xa963('0x2f')]=_0xf6616a[_0xa963('0x2f')]['length']?_0xf6616a[_0xa963('0x2f')]:_0x4e00d9[_0xa963('0x2b')];if(_0x41a0b2['query'][_0xa963('0x3a')]){_0xf6616a[_0xa963('0x3b')]=[{'all':!![]}];}_0xf6616a=_[_0xa963('0x37')]({},_0xf6616a,_0x41a0b2['options']);return db['UserProfileSection'][_0xa963('0x42')](_0xf6616a)[_0xa963('0x20')](handleEntityNotFound(_0x404743,null))['then'](respondWithResult(_0x404743,null))[_0xa963('0x3e')](handleError(_0x404743,null));};exports[_0xa963('0x43')]=function(_0x1c0a88,_0x5e6b55){return db[_0xa963('0x3c')][_0xa963('0x43')](_0x1c0a88[_0xa963('0x44')],{})['then'](respondWithResult(_0x5e6b55,0xc9))[_0xa963('0x3e')](handleError(_0x5e6b55,null));};exports[_0xa963('0x1f')]=function(_0x188bf8,_0x17831d){if(_0x188bf8[_0xa963('0x44')]['id']){delete _0x188bf8[_0xa963('0x44')]['id'];}return db[_0xa963('0x3c')][_0xa963('0x42')]({'where':{'id':_0x188bf8['params']['id']}})[_0xa963('0x20')](handleEntityNotFound(_0x17831d,null))['then'](saveUpdates(_0x188bf8[_0xa963('0x44')],null))[_0xa963('0x20')](respondWithResult(_0x17831d,null))['catch'](handleError(_0x17831d,null));};exports[_0xa963('0x21')]=function(_0x4a992a,_0x44495f){return db[_0xa963('0x3c')][_0xa963('0x42')]({'where':{'id':_0x4a992a['params']['id']}})['then'](handleEntityNotFound(_0x44495f,null))[_0xa963('0x20')](removeEntity(_0x44495f,null))[_0xa963('0x3e')](handleError(_0x44495f,null));};exports['describe']=function(_0x176a03,_0x3c502f){return db['UserProfileSection'][_0xa963('0x45')]()[_0xa963('0x20')](respondWithResult(_0x3c502f,null))[_0xa963('0x3e')](handleError(_0x3c502f,null));}; \ No newline at end of file +var _0x0abc=['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','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','UserProfileSection','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','catch','show','params','rawAttributes','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x1f999a,_0x538ee8){var _0x48ae2f=function(_0xc65083){while(--_0xc65083){_0x1f999a['push'](_0x1f999a['shift']());}};_0x48ae2f(++_0x538ee8);}(_0x0abc,0x8e));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc0ab('0x0'));var rimraf=require(_0xc0ab('0x1'));var zipdir=require(_0xc0ab('0x2'));var jsonpatch=require(_0xc0ab('0x3'));var rp=require(_0xc0ab('0x4'));var moment=require(_0xc0ab('0x5'));var BPromise=require(_0xc0ab('0x6'));var Mustache=require(_0xc0ab('0x7'));var util=require('util');var path=require(_0xc0ab('0x8'));var sox=require('sox');var csv=require(_0xc0ab('0x9'));var ejs=require(_0xc0ab('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0ab('0xb'));var squel=require(_0xc0ab('0xc'));var crypto=require(_0xc0ab('0xd'));var jsforce=require(_0xc0ab('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc0ab('0x9'));var querystring=require(_0xc0ab('0xf'));var Papa=require(_0xc0ab('0x10'));var Redis=require('ioredis');var authService=require(_0xc0ab('0x11'));var qs=require(_0xc0ab('0x12'));var as=require(_0xc0ab('0x13'));var hardwareService=require(_0xc0ab('0x14'));var logger=require(_0xc0ab('0x15'))(_0xc0ab('0x16'));var utils=require(_0xc0ab('0x17'));var config=require(_0xc0ab('0x18'));var licenseUtil=require(_0xc0ab('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x434f5b,_0x10bf5b){_0x10bf5b=_0x10bf5b||0xcc;return function(_0x544afd){if(_0x544afd){return _0x434f5b['sendStatus'](_0x10bf5b);}return _0x434f5b[_0xc0ab('0x1a')](_0x10bf5b)[_0xc0ab('0x1b')]();};}function respondWithResult(_0x5e12e1,_0x22e138){_0x22e138=_0x22e138||0xc8;return function(_0x1d91fa){if(_0x1d91fa){return _0x5e12e1[_0xc0ab('0x1a')](_0x22e138)[_0xc0ab('0x1c')](_0x1d91fa);}};}function respondWithFilteredResult(_0x3c2678,_0xfc1f56){return function(_0xb2e4d4){if(_0xb2e4d4){var _0x4a6082=typeof _0xfc1f56[_0xc0ab('0x1d')]==='undefined'&&typeof _0xfc1f56[_0xc0ab('0x1e')]===_0xc0ab('0x1f');var _0x1f29b1=_0xb2e4d4['count'];var _0x480d00=_0x4a6082?0x0:_0xfc1f56[_0xc0ab('0x1d')];var _0x3f9a20=_0x4a6082?_0xb2e4d4[_0xc0ab('0x20')]:_0xfc1f56[_0xc0ab('0x1d')]+_0xfc1f56[_0xc0ab('0x1e')];var _0x1bf385;if(_0x3f9a20>=_0x1f29b1){_0x3f9a20=_0x1f29b1;_0x1bf385=0xc8;}else{_0x1bf385=0xce;}_0x3c2678['status'](_0x1bf385);return _0x3c2678[_0xc0ab('0x21')](_0xc0ab('0x22'),_0x480d00+'-'+_0x3f9a20+'/'+_0x1f29b1)['json'](_0xb2e4d4);}return null;};}function patchUpdates(_0x2c5e5d){return function(_0x16a8c4){try{jsonpatch['apply'](_0x16a8c4,_0x2c5e5d,!![]);}catch(_0x33cdfc){return BPromise[_0xc0ab('0x23')](_0x33cdfc);}return _0x16a8c4[_0xc0ab('0x24')]();};}function saveUpdates(_0x2831ec,_0x5323ee){return function(_0xba1a5e){if(_0xba1a5e){return _0xba1a5e[_0xc0ab('0x25')](_0x2831ec)[_0xc0ab('0x26')](function(_0x313964){return _0x313964;});}return null;};}function removeEntity(_0x2347ea,_0x4ba503){return function(_0x551d29){if(_0x551d29){return _0x551d29[_0xc0ab('0x27')]()[_0xc0ab('0x26')](function(){_0x2347ea['status'](0xcc)[_0xc0ab('0x1b')]();});}};}function handleEntityNotFound(_0x3d7082,_0x13910e){return function(_0x1248b6){if(!_0x1248b6){_0x3d7082[_0xc0ab('0x28')](0x194);}return _0x1248b6;};}function handleError(_0x3e7992,_0x18f155){_0x18f155=_0x18f155||0x1f4;return function(_0x5af9ce){logger[_0xc0ab('0x29')](_0x5af9ce[_0xc0ab('0x2a')]);if(_0x5af9ce['name']){delete _0x5af9ce['name'];}_0x3e7992[_0xc0ab('0x1a')](_0x18f155)[_0xc0ab('0x2b')](_0x5af9ce);};}exports[_0xc0ab('0x2c')]=function(_0x7c17e8,_0x26c6a2){var _0xee857a={},_0xa6f940={},_0x5f463f={'count':0x0,'rows':[]};var _0x27af30=_[_0xc0ab('0x2d')](db[_0xc0ab('0x2e')]['rawAttributes'],function(_0x28cfb5){return{'name':_0x28cfb5[_0xc0ab('0x2f')],'type':_0x28cfb5[_0xc0ab('0x30')][_0xc0ab('0x31')]};});_0xa6f940[_0xc0ab('0x32')]=_[_0xc0ab('0x2d')](_0x27af30,_0xc0ab('0x33'));_0xa6f940['query']=_[_0xc0ab('0x34')](_0x7c17e8[_0xc0ab('0x35')]);_0xa6f940[_0xc0ab('0x36')]=_['intersection'](_0xa6f940[_0xc0ab('0x32')],_0xa6f940[_0xc0ab('0x35')]);_0xee857a['attributes']=_[_0xc0ab('0x37')](_0xa6f940[_0xc0ab('0x32')],qs[_0xc0ab('0x38')](_0x7c17e8['query'][_0xc0ab('0x38')]));_0xee857a[_0xc0ab('0x39')]=_0xee857a[_0xc0ab('0x39')]['length']?_0xee857a[_0xc0ab('0x39')]:_0xa6f940[_0xc0ab('0x32')];if(!_0x7c17e8[_0xc0ab('0x35')]['hasOwnProperty'](_0xc0ab('0x3a'))){_0xee857a['limit']=qs[_0xc0ab('0x1e')](_0x7c17e8[_0xc0ab('0x35')]['limit']);_0xee857a[_0xc0ab('0x1d')]=qs[_0xc0ab('0x1d')](_0x7c17e8['query'][_0xc0ab('0x1d')]);}_0xee857a[_0xc0ab('0x3b')]=qs[_0xc0ab('0x3c')](_0x7c17e8[_0xc0ab('0x35')][_0xc0ab('0x3c')]);_0xee857a[_0xc0ab('0x3d')]=qs[_0xc0ab('0x36')](_[_0xc0ab('0x3e')](_0x7c17e8[_0xc0ab('0x35')],_0xa6f940[_0xc0ab('0x36')]),_0x27af30);if(_0x7c17e8[_0xc0ab('0x35')][_0xc0ab('0x3f')]){_0xee857a['where']=_['merge'](_0xee857a['where'],{'$or':_['map'](_0x27af30,function(_0x8cc12d){if(_0x8cc12d['type']!==_0xc0ab('0x40')){var _0x5ca500={};_0x5ca500[_0x8cc12d[_0xc0ab('0x33')]]={'$like':'%'+_0x7c17e8['query'][_0xc0ab('0x3f')]+'%'};return _0x5ca500;}})});}_0xee857a=_[_0xc0ab('0x41')]({},_0xee857a,_0x7c17e8[_0xc0ab('0x42')]);var _0x26c612={'where':_0xee857a['where']};return db[_0xc0ab('0x2e')][_0xc0ab('0x20')](_0x26c612)['then'](function(_0x41ce19){_0x5f463f[_0xc0ab('0x20')]=_0x41ce19;if(_0x7c17e8[_0xc0ab('0x35')]['includeAll']){_0xee857a[_0xc0ab('0x43')]=[{'all':!![]}];}return db[_0xc0ab('0x2e')]['findAll'](_0xee857a);})['then'](function(_0x4f74a8){_0x5f463f['rows']=_0x4f74a8;return _0x5f463f;})[_0xc0ab('0x26')](respondWithFilteredResult(_0x26c6a2,_0xee857a))[_0xc0ab('0x44')](handleError(_0x26c6a2,null));};exports[_0xc0ab('0x45')]=function(_0x1978a8,_0x4286c9){var _0x544eaf={'raw':![],'where':{'id':_0x1978a8[_0xc0ab('0x46')]['id']}},_0x49535c={};_0x49535c[_0xc0ab('0x32')]=_[_0xc0ab('0x34')](db[_0xc0ab('0x2e')][_0xc0ab('0x47')]);_0x49535c[_0xc0ab('0x35')]=_['keys'](_0x1978a8[_0xc0ab('0x35')]);_0x49535c[_0xc0ab('0x36')]=_['intersection'](_0x49535c[_0xc0ab('0x32')],_0x49535c[_0xc0ab('0x35')]);_0x544eaf[_0xc0ab('0x39')]=_['intersection'](_0x49535c[_0xc0ab('0x32')],qs[_0xc0ab('0x38')](_0x1978a8[_0xc0ab('0x35')][_0xc0ab('0x38')]));_0x544eaf[_0xc0ab('0x39')]=_0x544eaf[_0xc0ab('0x39')][_0xc0ab('0x48')]?_0x544eaf[_0xc0ab('0x39')]:_0x49535c['model'];if(_0x1978a8['query'][_0xc0ab('0x49')]){_0x544eaf[_0xc0ab('0x43')]=[{'all':!![]}];}_0x544eaf=_[_0xc0ab('0x41')]({},_0x544eaf,_0x1978a8[_0xc0ab('0x42')]);return db[_0xc0ab('0x2e')]['find'](_0x544eaf)['then'](handleEntityNotFound(_0x4286c9,null))[_0xc0ab('0x26')](respondWithResult(_0x4286c9,null))[_0xc0ab('0x44')](handleError(_0x4286c9,null));};exports[_0xc0ab('0x4a')]=function(_0x3aefb3,_0x598898){return db[_0xc0ab('0x2e')]['create'](_0x3aefb3[_0xc0ab('0x4b')],{})[_0xc0ab('0x26')](respondWithResult(_0x598898,0xc9))[_0xc0ab('0x44')](handleError(_0x598898,null));};exports['update']=function(_0x43e813,_0x1098c6){if(_0x43e813[_0xc0ab('0x4b')]['id']){delete _0x43e813[_0xc0ab('0x4b')]['id'];}return db[_0xc0ab('0x2e')][_0xc0ab('0x4c')]({'where':{'id':_0x43e813['params']['id']}})['then'](handleEntityNotFound(_0x1098c6,null))[_0xc0ab('0x26')](saveUpdates(_0x43e813[_0xc0ab('0x4b')],null))[_0xc0ab('0x26')](respondWithResult(_0x1098c6,null))[_0xc0ab('0x44')](handleError(_0x1098c6,null));};exports[_0xc0ab('0x27')]=function(_0x83c421,_0x518dc9){return db[_0xc0ab('0x2e')][_0xc0ab('0x4c')]({'where':{'id':_0x83c421[_0xc0ab('0x46')]['id']}})[_0xc0ab('0x26')](handleEntityNotFound(_0x518dc9,null))['then'](removeEntity(_0x518dc9,null))[_0xc0ab('0x44')](handleError(_0x518dc9,null));};exports[_0xc0ab('0x4d')]=function(_0x5b5d6f,_0x21cca7){return db['UserProfileSection'][_0xc0ab('0x4d')]()[_0xc0ab('0x26')](respondWithResult(_0x21cca7,null))['catch'](handleError(_0x21cca7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2d95cfb..04af213 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 _0x43b3=['sectionId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x59eda6,_0x58e34c){var _0x1a33ad=function(_0x45d190){while(--_0x45d190){_0x59eda6['push'](_0x59eda6['shift']());}};_0x1a33ad(++_0x58e34c);}(_0x43b3,0x1a5));var _0x343b=function(_0x1d4d04,_0x56adb1){_0x1d4d04=_0x1d4d04-0x0;var _0xbb88b6=_0x43b3[_0x1d4d04];return _0xbb88b6;};'use strict';var _=require(_0x343b('0x0'));var util=require(_0x343b('0x1'));var logger=require('../../config/logger')(_0x343b('0x2'));var moment=require(_0x343b('0x3'));var BPromise=require(_0x343b('0x4'));var rp=require(_0x343b('0x5'));var fs=require('fs');var path=require(_0x343b('0x6'));var rimraf=require(_0x343b('0x7'));var config=require(_0x343b('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x343b('0x9')]=function(_0x5605b3,_0x326a56){return _0x5605b3[_0x343b('0xa')](_0x343b('0xb'),attributes,{'tableName':_0x343b('0xc'),'paranoid':![],'indexes':[{'name':_0x343b('0xd'),'fields':[_0x343b('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed65=['user_profile_has_sections','compositeIndex','sectionId','lodash','api','moment','bluebird','path','rimraf','./userProfileSection.attributes','UserProfileSection'];(function(_0x5147b9,_0x531fc8){var _0x18c5c9=function(_0x149d76){while(--_0x149d76){_0x5147b9['push'](_0x5147b9['shift']());}};_0x18c5c9(++_0x531fc8);}(_0xed65,0x1e7));var _0x5ed6=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0xed65[_0x4704dc];return _0x254d81;};'use strict';var _=require(_0x5ed6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ed6('0x1'));var moment=require(_0x5ed6('0x2'));var BPromise=require(_0x5ed6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ed6('0x4'));var rimraf=require(_0x5ed6('0x5'));var config=require('../../config/environment');var attributes=require(_0x5ed6('0x6'));module['exports']=function(_0x288053,_0x434f6f){return _0x288053['define'](_0x5ed6('0x7'),attributes,{'tableName':_0x5ed6('0x8'),'paranoid':![],'indexes':[{'name':_0x5ed6('0x9'),'fields':[_0x5ed6('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ae6988b..1059ae3 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 _0x359b=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x359b,0x7a));var _0xb359=function(_0x1d9dfd,_0x2da812){_0x1d9dfd=_0x1d9dfd-0x0;var _0x53406c=_0x359b[_0x1d9dfd];return _0x53406c;};'use strict';var _=require(_0xb359('0x0'));var util=require(_0xb359('0x1'));var moment=require(_0xb359('0x2'));var BPromise=require(_0xb359('0x3'));var rs=require(_0xb359('0x4'));var fs=require('fs');var Redis=require(_0xb359('0x5'));var db=require(_0xb359('0x6'))['db'];var utils=require(_0xb359('0x7'));var logger=require('../../config/logger')(_0xb359('0x8'));var config=require('../../config/environment');var jayson=require(_0xb359('0x9'));var client=jayson[_0xb359('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eeac8,_0x537b34,_0x339fa1){return new BPromise(function(_0x46bd8e,_0x5c841a){return client[_0xb359('0xb')](_0x2eeac8,_0x339fa1)['then'](function(_0x47cfec){logger[_0xb359('0xc')](_0xb359('0xd'),_0x537b34,_0xb359('0xe'));logger[_0xb359('0xf')](_0xb359('0x10'),_0x537b34,_0xb359('0xe'),JSON[_0xb359('0x11')](_0x47cfec));if(_0x47cfec[_0xb359('0x12')]){if(_0x47cfec[_0xb359('0x12')][_0xb359('0x13')]===0x1f4){logger[_0xb359('0x12')](_0xb359('0xd'),_0x537b34,_0x47cfec['error'][_0xb359('0x14')]);return _0x5c841a(_0x47cfec[_0xb359('0x12')][_0xb359('0x14')]);}logger[_0xb359('0x12')](_0xb359('0xd'),_0x537b34,_0x47cfec['error'][_0xb359('0x14')]);return _0x46bd8e(_0x47cfec[_0xb359('0x12')][_0xb359('0x14')]);}else{logger[_0xb359('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x537b34,'request\x20sent');_0x46bd8e(_0x47cfec[_0xb359('0x15')]['message']);}})[_0xb359('0x16')](function(_0x57f737){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x537b34,_0x57f737);_0x5c841a(_0x57f737);});});} \ No newline at end of file +var _0x7bee=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x39d177,_0x5efb5d){var _0x29f1b8=function(_0x130ce0){while(--_0x130ce0){_0x39d177['push'](_0x39d177['shift']());}};_0x29f1b8(++_0x5efb5d);}(_0x7bee,0x13d));var _0xe7be=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7bee[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xe7be('0x0'));var moment=require(_0xe7be('0x1'));var BPromise=require(_0xe7be('0x2'));var rs=require(_0xe7be('0x3'));var fs=require('fs');var Redis=require(_0xe7be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7be('0x5'));var logger=require(_0xe7be('0x6'))('rpc');var config=require(_0xe7be('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe7be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x554764,_0x1ff6c6,_0x595be3){return new BPromise(function(_0x1d5cff,_0x360bf1){return client[_0xe7be('0x9')](_0x554764,_0x595be3)[_0xe7be('0xa')](function(_0x6c7a34){logger[_0xe7be('0xb')](_0xe7be('0xc'),_0x1ff6c6,_0xe7be('0xd'));logger[_0xe7be('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1ff6c6,'request\x20sent',JSON[_0xe7be('0xf')](_0x6c7a34));if(_0x6c7a34[_0xe7be('0x10')]){if(_0x6c7a34[_0xe7be('0x10')][_0xe7be('0x11')]===0x1f4){logger['error'](_0xe7be('0xc'),_0x1ff6c6,_0x6c7a34[_0xe7be('0x10')][_0xe7be('0x12')]);return _0x360bf1(_0x6c7a34[_0xe7be('0x10')]['message']);}logger[_0xe7be('0x10')](_0xe7be('0xc'),_0x1ff6c6,_0x6c7a34['error'][_0xe7be('0x12')]);return _0x1d5cff(_0x6c7a34[_0xe7be('0x10')][_0xe7be('0x12')]);}else{logger[_0xe7be('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x1ff6c6,'request\x20sent');_0x1d5cff(_0x6c7a34[_0xe7be('0x13')][_0xe7be('0x12')]);}})['catch'](function(_0x1b866b){logger[_0xe7be('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x1ff6c6,_0x1b866b);_0x360bf1(_0x1b866b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d613135..c00054b 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x90d801,_0x5e10e5){var _0x136d39=function(_0x5b723c){while(--_0x5b723c){_0x90d801['push'](_0x90d801['shift']());}};_0x136d39(++_0x5e10e5);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5cae27,_0x460e3b){var _0x43a864=function(_0x281247){while(--_0x281247){_0x5cae27['push'](_0x5cae27['shift']());}};_0x43a864(++_0x460e3b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xcb91[_0xf79bae];return _0x5d2cb7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index df164ed..1e8924c 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 _0x95f4=['INTEGER','sequelize','exports'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x95f4,0xf1));var _0x495f=function(_0x19d113,_0x5c29e6){_0x19d113=_0x19d113-0x0;var _0x3bad18=_0x95f4[_0x19d113];return _0x3bad18;};'use strict';var Sequelize=require(_0x495f('0x0'));module[_0x495f('0x1')]={'penalty':{'type':Sequelize[_0x495f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc27=['sequelize','INTEGER'];(function(_0x20777f,_0x37b3b1){var _0x486b0f=function(_0x587c12){while(--_0x587c12){_0x20777f['push'](_0x20777f['shift']());}};_0x486b0f(++_0x37b3b1);}(_0xfc27,0x158));var _0x7fc2=function(_0x52da45,_0x1029e0){_0x52da45=_0x52da45-0x0;var _0x3236b1=_0xfc27[_0x52da45];return _0x3236b1;};'use strict';var Sequelize=require(_0x7fc2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7fc2('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 dc2c916..1c58dd7 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 _0x11e5=['path','../../config/environment','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x57e857,_0x122042){var _0x14a065=function(_0x547f46){while(--_0x547f46){_0x57e857['push'](_0x57e857['shift']());}};_0x14a065(++_0x122042);}(_0x11e5,0x8b));var _0x511e=function(_0x31a7b5,_0x307d8a){_0x31a7b5=_0x31a7b5-0x0;var _0x3ed7c5=_0x11e5[_0x31a7b5];return _0x3ed7c5;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2bc=['./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x515cc0,_0x248d5c){var _0x59e40e=function(_0x33eb79){while(--_0x33eb79){_0x515cc0['push'](_0x515cc0['shift']());}};_0x59e40e(++_0x248d5c);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe2bc[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var logger=require(_0xce2b('0x1'))('api');var moment=require(_0xce2b('0x2'));var BPromise=require(_0xce2b('0x3'));var rp=require(_0xce2b('0x4'));var fs=require('fs');var path=require(_0xce2b('0x5'));var rimraf=require(_0xce2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xce2b('0x7'));module[_0xce2b('0x8')]=function(_0x3c15d3,_0x343373){return _0x3c15d3[_0xce2b('0x9')]('UserSmsQueue',attributes,{'tableName':_0xce2b('0xa'),'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 5a5d544..d548330 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 _0xd63e=['http','request','request\x20sent','debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xd63e,0x12a));var _0xed63=function(_0x22d673,_0x60bede){_0x22d673=_0x22d673-0x0;var _0x6dea81=_0xd63e[_0x22d673];return _0x6dea81;};'use strict';var _=require(_0xed63('0x0'));var util=require('util');var moment=require(_0xed63('0x1'));var BPromise=require(_0xed63('0x2'));var rs=require(_0xed63('0x3'));var fs=require('fs');var Redis=require(_0xed63('0x4'));var db=require(_0xed63('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed63('0x6'))('rpc');var config=require(_0xed63('0x7'));var jayson=require(_0xed63('0x8'));var client=jayson[_0xed63('0x9')][_0xed63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc200,_0x40031a,_0x2d17f9){return new BPromise(function(_0x530582,_0x4f1ab9){return client[_0xed63('0xb')](_0x1dc200,_0x2d17f9)['then'](function(_0x525bad){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x40031a,_0xed63('0xc'));logger[_0xed63('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x40031a,_0xed63('0xc'),JSON[_0xed63('0xe')](_0x525bad));if(_0x525bad['error']){if(_0x525bad[_0xed63('0xf')][_0xed63('0x10')]===0x1f4){logger[_0xed63('0xf')](_0xed63('0x11'),_0x40031a,_0x525bad[_0xed63('0xf')][_0xed63('0x12')]);return _0x4f1ab9(_0x525bad[_0xed63('0xf')][_0xed63('0x12')]);}logger[_0xed63('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x40031a,_0x525bad['error'][_0xed63('0x12')]);return _0x530582(_0x525bad['error'][_0xed63('0x12')]);}else{logger[_0xed63('0x13')](_0xed63('0x11'),_0x40031a,_0xed63('0xc'));_0x530582(_0x525bad[_0xed63('0x14')]['message']);}})[_0xed63('0x15')](function(_0x3488c1){logger[_0xed63('0xf')](_0xed63('0x11'),_0x40031a,_0x3488c1);_0x4f1ab9(_0x3488c1);});});} \ No newline at end of file +var _0x0fec=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','debug'];(function(_0x4def98,_0x421f3f){var _0x40f8cc=function(_0x2377a4){while(--_0x2377a4){_0x4def98['push'](_0x4def98['shift']());}};_0x40f8cc(++_0x421f3f);}(_0x0fec,0x105));var _0xc0fe=function(_0x2bda7e,_0x21fccd){_0x2bda7e=_0x2bda7e-0x0;var _0x533565=_0x0fec[_0x2bda7e];return _0x533565;};'use strict';var _=require(_0xc0fe('0x0'));var util=require(_0xc0fe('0x1'));var moment=require(_0xc0fe('0x2'));var BPromise=require(_0xc0fe('0x3'));var rs=require(_0xc0fe('0x4'));var fs=require('fs');var Redis=require(_0xc0fe('0x5'));var db=require(_0xc0fe('0x6'))['db'];var utils=require(_0xc0fe('0x7'));var logger=require(_0xc0fe('0x8'))('rpc');var config=require(_0xc0fe('0x9'));var jayson=require(_0xc0fe('0xa'));var client=jayson['client'][_0xc0fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594cea,_0xab86f5,_0xa3f1f0){return new BPromise(function(_0x57340b,_0xb6c86e){return client['request'](_0x594cea,_0xa3f1f0)['then'](function(_0x456320){logger[_0xc0fe('0xc')](_0xc0fe('0xd'),_0xab86f5,'request\x20sent');logger[_0xc0fe('0xe')](_0xc0fe('0xf'),_0xab86f5,'request\x20sent',JSON[_0xc0fe('0x10')](_0x456320));if(_0x456320[_0xc0fe('0x11')]){if(_0x456320[_0xc0fe('0x11')][_0xc0fe('0x12')]===0x1f4){logger[_0xc0fe('0x11')](_0xc0fe('0xd'),_0xab86f5,_0x456320[_0xc0fe('0x11')][_0xc0fe('0x13')]);return _0xb6c86e(_0x456320['error'][_0xc0fe('0x13')]);}logger[_0xc0fe('0x11')](_0xc0fe('0xd'),_0xab86f5,_0x456320[_0xc0fe('0x11')][_0xc0fe('0x13')]);return _0x57340b(_0x456320[_0xc0fe('0x11')]['message']);}else{logger['info'](_0xc0fe('0xd'),_0xab86f5,_0xc0fe('0x14'));_0x57340b(_0x456320[_0xc0fe('0x15')][_0xc0fe('0x13')]);}})[_0xc0fe('0x16')](function(_0x464685){logger[_0xc0fe('0x11')](_0xc0fe('0xd'),_0xab86f5,_0x464685);_0xb6c86e(_0x464685);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 34af679..fc19f15 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 _0x0b57=['sequelize','exports'];(function(_0x1aba37,_0xa3e970){var _0x5e5458=function(_0x5be75f){while(--_0x5be75f){_0x1aba37['push'](_0x1aba37['shift']());}};_0x5e5458(++_0xa3e970);}(_0x0b57,0x8a));var _0x70b5=function(_0x2c0557,_0x4314fd){_0x2c0557=_0x2c0557-0x0;var _0x2878cd=_0x0b57[_0x2c0557];return _0x2878cd;};'use strict';var Sequelize=require(_0x70b5('0x0'));module[_0x70b5('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7bb5=['exports','INTEGER','sequelize'];(function(_0x4d1dc5,_0xb201db){var _0x2948f8=function(_0x21f19f){while(--_0x21f19f){_0x4d1dc5['push'](_0x4d1dc5['shift']());}};_0x2948f8(++_0xb201db);}(_0x7bb5,0x152));var _0x57bb=function(_0x50816a,_0x3c53e1){_0x50816a=_0x50816a-0x0;var _0x1efc3c=_0x7bb5[_0x50816a];return _0x1efc3c;};'use strict';var Sequelize=require(_0x57bb('0x0'));module[_0x57bb('0x1')]={'UserId':{'type':Sequelize[_0x57bb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x57bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3f4cc3c..2112dce 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(_0x1a2e62,_0x46f069){var _0x10aea1=function(_0x32d3db){while(--_0x32d3db){_0x1a2e62['push'](_0x1a2e62['shift']());}};_0x10aea1(++_0x46f069);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4d40de,_0x26bb4e){var _0x1c64fc=function(_0x38193f){while(--_0x38193f){_0x4d40de['push'](_0x4d40de['shift']());}};_0x1c64fc(++_0x26bb4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 2bc4f9e..51a3c95 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x573c9e,_0xd4ab71){var _0x5d0714=function(_0x127a2a){while(--_0x127a2a){_0x573c9e['push'](_0x573c9e['shift']());}};_0x5d0714(++_0xd4ab71);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3e8675,_0x19e1af){var _0x2789e9=function(_0x4971ac){while(--_0x4971ac){_0x3e8675['push'](_0x3e8675['shift']());}};_0x2789e9(++_0x19e1af);}(_0x70e0,0x17b));var _0x070e=function(_0xec9ae9,_0x388c82){_0xec9ae9=_0xec9ae9-0x0;var _0xe17ecb=_0x70e0[_0xec9ae9];return _0xe17ecb;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2520138..ef9031c 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 _0x0fd4=['exports','INTEGER','sequelize'];(function(_0xda21e8,_0x19d184){var _0x28904b=function(_0x10c833){while(--_0x10c833){_0xda21e8['push'](_0xda21e8['shift']());}};_0x28904b(++_0x19d184);}(_0x0fd4,0xa1));var _0x40fd=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x0fd4[_0x8af54b];return _0x27d8f0;};'use strict';var Sequelize=require(_0x40fd('0x0'));module[_0x40fd('0x1')]={'penalty':{'type':Sequelize[_0x40fd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6746=['exports','INTEGER','sequelize'];(function(_0xf488c1,_0x110fb4){var _0x467ba6=function(_0x538550){while(--_0x538550){_0xf488c1['push'](_0xf488c1['shift']());}};_0x467ba6(++_0x110fb4);}(_0x6746,0xb9));var _0x6674=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0x6746[_0x5c6ceb];return _0x28821b;};'use strict';var Sequelize=require(_0x6674('0x0'));module[_0x6674('0x1')]={'penalty':{'type':Sequelize[_0x6674('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8838d83..eae6248 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 _0xb305=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util'];(function(_0x40b225,_0x45a898){var _0x3974c2=function(_0x698d29){while(--_0x698d29){_0x40b225['push'](_0x40b225['shift']());}};_0x3974c2(++_0x45a898);}(_0xb305,0x11b));var _0x5b30=function(_0x22ca53,_0x30e1a9){_0x22ca53=_0x22ca53-0x0;var _0x80aacf=_0xb305[_0x22ca53];return _0x80aacf;};'use strict';var _=require(_0x5b30('0x0'));var util=require(_0x5b30('0x1'));var logger=require(_0x5b30('0x2'))(_0x5b30('0x3'));var moment=require(_0x5b30('0x4'));var BPromise=require(_0x5b30('0x5'));var rp=require(_0x5b30('0x6'));var fs=require('fs');var path=require(_0x5b30('0x7'));var rimraf=require(_0x5b30('0x8'));var config=require(_0x5b30('0x9'));var attributes=require(_0x5b30('0xa'));module[_0x5b30('0xb')]=function(_0x5020d1,_0x1e833b){return _0x5020d1[_0x5b30('0xc')](_0x5b30('0xd'),attributes,{'tableName':_0x5b30('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d0=['../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','util','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83d0,0x1ef));var _0x083d=function(_0x2e59ab,_0x51c04e){_0x2e59ab=_0x2e59ab-0x0;var _0x2f5381=_0x83d0[_0x2e59ab];return _0x2f5381;};'use strict';var _=require('lodash');var util=require(_0x083d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x083d('0x1'));var BPromise=require(_0x083d('0x2'));var rp=require(_0x083d('0x3'));var fs=require('fs');var path=require(_0x083d('0x4'));var rimraf=require('rimraf');var config=require(_0x083d('0x5'));var attributes=require(_0x083d('0x6'));module['exports']=function(_0x5896eb,_0x4d95b9){return _0x5896eb[_0x083d('0x7')](_0x083d('0x8'),attributes,{'tableName':_0x083d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index f41ef13..7f3418d 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 _0x722f=['then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x4a3201,_0x15f7e3){var _0x14cff1=function(_0x209681){while(--_0x209681){_0x4a3201['push'](_0x4a3201['shift']());}};_0x14cff1(++_0x15f7e3);}(_0x722f,0xbf));var _0xf722=function(_0x32e90a,_0x565578){_0x32e90a=_0x32e90a-0x0;var _0x1a3daa=_0x722f[_0x32e90a];return _0x1a3daa;};'use strict';var _=require('lodash');var util=require(_0xf722('0x0'));var moment=require(_0xf722('0x1'));var BPromise=require(_0xf722('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf722('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf722('0x4'))('rpc');var config=require(_0xf722('0x5'));var jayson=require(_0xf722('0x6'));var client=jayson[_0xf722('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dd1bf,_0xcf7c19,_0x419436){return new BPromise(function(_0x3cf2de,_0x1d456f){return client[_0xf722('0x8')](_0x3dd1bf,_0x419436)[_0xf722('0x9')](function(_0x557161){logger[_0xf722('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0xcf7c19,_0xf722('0xb'));logger['debug'](_0xf722('0xc'),_0xcf7c19,'request\x20sent',JSON[_0xf722('0xd')](_0x557161));if(_0x557161['error']){if(_0x557161[_0xf722('0xe')][_0xf722('0xf')]===0x1f4){logger[_0xf722('0xe')](_0xf722('0x10'),_0xcf7c19,_0x557161[_0xf722('0xe')][_0xf722('0x11')]);return _0x1d456f(_0x557161[_0xf722('0xe')]['message']);}logger['error'](_0xf722('0x10'),_0xcf7c19,_0x557161[_0xf722('0xe')]['message']);return _0x3cf2de(_0x557161[_0xf722('0xe')][_0xf722('0x11')]);}else{logger[_0xf722('0xa')](_0xf722('0x10'),_0xcf7c19,'request\x20sent');_0x3cf2de(_0x557161[_0xf722('0x12')][_0xf722('0x11')]);}})[_0xf722('0x13')](function(_0x54e2fa){logger[_0xf722('0xe')](_0xf722('0x10'),_0xcf7c19,_0x54e2fa);_0x1d456f(_0x54e2fa);});});} \ No newline at end of file +var _0xa6c5=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result'];(function(_0x5a0b62,_0x14d1df){var _0x6b8d63=function(_0x414687){while(--_0x414687){_0x5a0b62['push'](_0x5a0b62['shift']());}};_0x6b8d63(++_0x14d1df);}(_0xa6c5,0x171));var _0x5a6c=function(_0x51e1d5,_0x399588){_0x51e1d5=_0x51e1d5-0x0;var _0x105666=_0xa6c5[_0x51e1d5];return _0x105666;};'use strict';var _=require(_0x5a6c('0x0'));var util=require(_0x5a6c('0x1'));var moment=require('moment');var BPromise=require(_0x5a6c('0x2'));var rs=require(_0x5a6c('0x3'));var fs=require('fs');var Redis=require(_0x5a6c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a6c('0x5'));var logger=require(_0x5a6c('0x6'))('rpc');var config=require(_0x5a6c('0x7'));var jayson=require(_0x5a6c('0x8'));var client=jayson[_0x5a6c('0x9')][_0x5a6c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b8e02,_0x31e59a,_0x2bca3b){return new BPromise(function(_0x37d798,_0xd9c27a){return client[_0x5a6c('0xb')](_0x4b8e02,_0x2bca3b)[_0x5a6c('0xc')](function(_0x1b2322){logger['info'](_0x5a6c('0xd'),_0x31e59a,'request\x20sent');logger[_0x5a6c('0xe')](_0x5a6c('0xf'),_0x31e59a,'request\x20sent',JSON[_0x5a6c('0x10')](_0x1b2322));if(_0x1b2322[_0x5a6c('0x11')]){if(_0x1b2322[_0x5a6c('0x11')]['code']===0x1f4){logger[_0x5a6c('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x31e59a,_0x1b2322[_0x5a6c('0x11')]['message']);return _0xd9c27a(_0x1b2322[_0x5a6c('0x11')]['message']);}logger[_0x5a6c('0x11')](_0x5a6c('0xd'),_0x31e59a,_0x1b2322[_0x5a6c('0x11')][_0x5a6c('0x12')]);return _0x37d798(_0x1b2322[_0x5a6c('0x11')][_0x5a6c('0x12')]);}else{logger[_0x5a6c('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x31e59a,_0x5a6c('0x14'));_0x37d798(_0x1b2322[_0x5a6c('0x15')][_0x5a6c('0x12')]);}})[_0x5a6c('0x16')](function(_0x279ee9){logger[_0x5a6c('0x11')](_0x5a6c('0xd'),_0x31e59a,_0x279ee9);_0xd9c27a(_0x279ee9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 076632e..db86943 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x9dca01,_0x1f41d7){var _0x59487a=function(_0x29079f){while(--_0x29079f){_0x9dca01['push'](_0x9dca01['shift']());}};_0x59487a(++_0x1f41d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3322ef,_0x2b0120){var _0x31b25f=function(_0x35cefd){while(--_0x35cefd){_0x3322ef['push'](_0x3322ef['shift']());}};_0x31b25f(++_0x2b0120);}(_0xedd9,0xfc));var _0x9edd=function(_0x425f06,_0x13c226){_0x425f06=_0x425f06-0x0;var _0xb67fc7=_0xedd9[_0x425f06];return _0xb67fc7;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0eb7352..15845e3 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 _0xf688=['queue_interface','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x30a956,_0x11222e){var _0x2ac17d=function(_0x3be1d2){while(--_0x3be1d2){_0x30a956['push'](_0x30a956['shift']());}};_0x2ac17d(++_0x11222e);}(_0xf688,0x10d));var _0x8f68=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf688[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8f68('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x8f68('0x1')],'allowNull':![],'comment':_0x8f68('0x2')},'UserId':{'type':Sequelize[_0x8f68('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8f68('0x1')],'allowNull':![],'unique':_0x8f68('0x3'),'comment':_0x8f68('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8f68('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x8f68('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0x8f68('0x2')},'penalty':{'type':Sequelize[_0x8f68('0x0')](0xb),'defaultValue':0x0,'comment':_0x8f68('0x2')},'paused':{'type':Sequelize[_0x8f68('0x0')](0xb),'defaultValue':0x0,'comment':_0x8f68('0x2')}}; \ No newline at end of file +var _0x266b=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x5844c3,_0x13fc8c){var _0x3a4d56=function(_0x24328e){while(--_0x24328e){_0x5844c3['push'](_0x5844c3['shift']());}};_0x3a4d56(++_0x13fc8c);}(_0x266b,0x1e3));var _0xb266=function(_0x4a5040,_0x524207){_0x4a5040=_0x4a5040-0x0;var _0x193dfc=_0x266b[_0x4a5040];return _0x193dfc;};'use strict';var Sequelize=require(_0xb266('0x0'));module[_0xb266('0x1')]={'uniqueid':{'type':Sequelize[_0xb266('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb266('0x3')},'membername':{'type':Sequelize[_0xb266('0x4')],'allowNull':![],'comment':_0xb266('0x3')},'UserId':{'type':Sequelize[_0xb266('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb266('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xb266('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb266('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb266('0x5'),'comment':_0xb266('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb266('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 18e9832..9c7320e 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 _0x5488=['emit','hasOwnProperty','hook','events','UserVoiceQueueRt','update','remove'];(function(_0x455bf9,_0x37e324){var _0x544b40=function(_0x3ba43e){while(--_0x3ba43e){_0x455bf9['push'](_0x455bf9['shift']());}};_0x544b40(++_0x37e324);}(_0x5488,0x114));var _0x8548=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x5488[_0x1098db];return _0x14f090;};'use strict';var EventEmitter=require(_0x8548('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x8548('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8548('0x2'),'afterDestroy':_0x8548('0x3')};function emitEvent(_0x21923f){return function(_0x5afd4b,_0x3e49b9,_0x4590c2){UserVoiceQueueRtEvents[_0x8548('0x4')](_0x21923f+':'+_0x5afd4b['id'],_0x5afd4b);UserVoiceQueueRtEvents[_0x8548('0x4')](_0x21923f,_0x5afd4b);_0x4590c2(null);};}for(var e in events){if(events[_0x8548('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x8548('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0a9f=['events','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x946387,_0x111168){var _0x3ac2a7=function(_0x540b92){while(--_0x540b92){_0x946387['push'](_0x946387['shift']());}};_0x3ac2a7(++_0x111168);}(_0x0a9f,0x188));var _0xf0a9=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x0a9f[_0x31ced5];return _0x10d9e5;};'use strict';var EventEmitter=require(_0xf0a9('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf0a9('0x1')](0x0);var events={'afterCreate':_0xf0a9('0x2'),'afterUpdate':_0xf0a9('0x3'),'afterDestroy':_0xf0a9('0x4')};function emitEvent(_0x4a9f69){return function(_0x4a87bc,_0x279e26,_0x345645){UserVoiceQueueRtEvents['emit'](_0x4a9f69+':'+_0x4a87bc['id'],_0x4a87bc);UserVoiceQueueRtEvents[_0xf0a9('0x5')](_0x4a9f69,_0x4a87bc);_0x345645(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xf0a9('0x6')](e,emitEvent(event));}}module[_0xf0a9('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 812fc99..0f6dc54 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 _0xb88d=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4322d9,_0x41dd96){var _0x1f574b=function(_0x293b16){while(--_0x293b16){_0x4322d9['push'](_0x4322d9['shift']());}};_0x1f574b(++_0x41dd96);}(_0xb88d,0x73));var _0xdb88=function(_0xeed874,_0x2683ab){_0xeed874=_0xeed874-0x0;var _0x407398=_0xb88d[_0xeed874];return _0x407398;};'use strict';var _=require(_0xdb88('0x0'));var util=require(_0xdb88('0x1'));var logger=require(_0xdb88('0x2'))('api');var moment=require(_0xdb88('0x3'));var BPromise=require(_0xdb88('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb88('0x5'));var attributes=require(_0xdb88('0x6'));module[_0xdb88('0x7')]=function(_0x1c3846,_0x3181c2){return _0x1c3846[_0xdb88('0x8')](_0xdb88('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1f4=['moment','bluebird','request-promise','path','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd1f4,0x1de));var _0x4d1f=function(_0x1c7bca,_0x299d6e){_0x1c7bca=_0x1c7bca-0x0;var _0x553a8b=_0xd1f4[_0x1c7bca];return _0x553a8b;};'use strict';var _=require(_0x4d1f('0x0'));var util=require(_0x4d1f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d1f('0x2'));var BPromise=require(_0x4d1f('0x3'));var rp=require(_0x4d1f('0x4'));var fs=require('fs');var path=require(_0x4d1f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4d1f('0x6'));module['exports']=function(_0x5c3684,_0x539639){return _0x5c3684[_0x4d1f('0x7')](_0x4d1f('0x8'),attributes,{'tableName':_0x4d1f('0x9'),'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 0a83b19..439efd5 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 _0xcaa8=['request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x491082,_0x28f78b){var _0x5797d9=function(_0x20d0ba){while(--_0x20d0ba){_0x491082['push'](_0x491082['shift']());}};_0x5797d9(++_0x28f78b);}(_0xcaa8,0x15f));var _0x8caa=function(_0x2e288a,_0x3135c2){_0x2e288a=_0x2e288a-0x0;var _0x210a12=_0xcaa8[_0x2e288a];return _0x210a12;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8caa('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8caa('0x1'));var db=require(_0x8caa('0x2'))['db'];var utils=require(_0x8caa('0x3'));var logger=require('../../config/logger')(_0x8caa('0x4'));var config=require(_0x8caa('0x5'));var jayson=require(_0x8caa('0x6'));var client=jayson[_0x8caa('0x7')]['http']({'port':0x232a});config[_0x8caa('0x8')]=_[_0x8caa('0x9')](config['redis'],{'host':_0x8caa('0xa'),'port':0x18eb});var socket=require(_0x8caa('0xb'))(new Redis(config[_0x8caa('0x8')]));require(_0x8caa('0xc'))['register'](socket);function respondWithRpcPromise(_0x16cb57,_0x2ada6a,_0x2bc087){return new BPromise(function(_0x45ee0e,_0xc523f5){return client[_0x8caa('0xd')](_0x16cb57,_0x2bc087)[_0x8caa('0xe')](function(_0x3ad48e){logger[_0x8caa('0xf')](_0x8caa('0x10'),_0x2ada6a,'request\x20sent');logger[_0x8caa('0x11')](_0x8caa('0x12'),_0x2ada6a,_0x8caa('0x13'),JSON[_0x8caa('0x14')](_0x3ad48e));if(_0x3ad48e[_0x8caa('0x15')]){if(_0x3ad48e[_0x8caa('0x15')][_0x8caa('0x16')]===0x1f4){logger[_0x8caa('0x15')](_0x8caa('0x10'),_0x2ada6a,_0x3ad48e[_0x8caa('0x15')][_0x8caa('0x17')]);return _0xc523f5(_0x3ad48e[_0x8caa('0x15')][_0x8caa('0x17')]);}logger['error'](_0x8caa('0x10'),_0x2ada6a,_0x3ad48e[_0x8caa('0x15')]['message']);return _0x45ee0e(_0x3ad48e[_0x8caa('0x15')][_0x8caa('0x17')]);}else{logger[_0x8caa('0xf')](_0x8caa('0x10'),_0x2ada6a,'request\x20sent');_0x45ee0e(_0x3ad48e[_0x8caa('0x18')][_0x8caa('0x17')]);}})[_0x8caa('0x19')](function(_0x1e01b6){logger[_0x8caa('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2ada6a,_0x1e01b6);_0xc523f5(_0x1e01b6);});});}exports[_0x8caa('0x1a')]=function(_0x4a7860){var _0x5127e1=this;return new Promise(function(_0x2cc187,_0x4b5adf){return db[_0x8caa('0x1b')][_0x8caa('0x1c')]({'raw':_0x4a7860[_0x8caa('0x1d')]?_0x4a7860[_0x8caa('0x1d')][_0x8caa('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a7860['options']?_0x4a7860[_0x8caa('0x1d')][_0x8caa('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8caa('0x20'),db[_0x8caa('0x21')]['fn']('IF',db['sequelize'][_0x8caa('0x22')](_0x8caa('0x23')))),_0x8caa('0x24')]]})[_0x8caa('0xe')](function(_0x5510c2){logger[_0x8caa('0xf')]('GetVoiceQueueRtPauses',_0x4a7860);logger[_0x8caa('0x11')](_0x8caa('0x1a'),_0x4a7860,JSON[_0x8caa('0x14')](_0x5510c2));_0x2cc187(_0x5510c2);})[_0x8caa('0x19')](function(_0x27aca7){logger[_0x8caa('0x15')](_0x8caa('0x1a'),_0x27aca7[_0x8caa('0x17')],_0x4a7860);_0x4b5adf(_0x5127e1[_0x8caa('0x15')](0x1f4,_0x27aca7['message']));});});}; \ No newline at end of file +var _0x5e56=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UserVoiceQueueRt,\x20%s,\x20%s','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x5e56,0x160));var _0x65e5=function(_0x542e22,_0x4885d){_0x542e22=_0x542e22-0x0;var _0x59fc0=_0x5e56[_0x542e22];return _0x59fc0;};'use strict';var _=require(_0x65e5('0x0'));var util=require(_0x65e5('0x1'));var moment=require(_0x65e5('0x2'));var BPromise=require(_0x65e5('0x3'));var rs=require(_0x65e5('0x4'));var fs=require('fs');var Redis=require(_0x65e5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x65e5('0x6'));var logger=require(_0x65e5('0x7'))(_0x65e5('0x8'));var config=require('../../config/environment');var jayson=require(_0x65e5('0x9'));var client=jayson['client'][_0x65e5('0xa')]({'port':0x232a});config[_0x65e5('0xb')]=_[_0x65e5('0xc')](config[_0x65e5('0xb')],{'host':_0x65e5('0xd'),'port':0x18eb});var socket=require(_0x65e5('0xe'))(new Redis(config[_0x65e5('0xb')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0xedbda9,_0x271930,_0x3b6382){return new BPromise(function(_0x18f4cd,_0x49811a){return client[_0x65e5('0xf')](_0xedbda9,_0x3b6382)[_0x65e5('0x10')](function(_0x4bd431){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x271930,_0x65e5('0x11'));logger[_0x65e5('0x12')](_0x65e5('0x13'),_0x271930,_0x65e5('0x11'),JSON[_0x65e5('0x14')](_0x4bd431));if(_0x4bd431[_0x65e5('0x15')]){if(_0x4bd431['error'][_0x65e5('0x16')]===0x1f4){logger[_0x65e5('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x271930,_0x4bd431[_0x65e5('0x15')]['message']);return _0x49811a(_0x4bd431['error'][_0x65e5('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x271930,_0x4bd431[_0x65e5('0x15')]['message']);return _0x18f4cd(_0x4bd431['error'][_0x65e5('0x17')]);}else{logger[_0x65e5('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x271930,_0x65e5('0x11'));_0x18f4cd(_0x4bd431['result'][_0x65e5('0x17')]);}})[_0x65e5('0x19')](function(_0x3dcd9d){logger[_0x65e5('0x15')](_0x65e5('0x1a'),_0x271930,_0x3dcd9d);_0x49811a(_0x3dcd9d);});});}exports['GetVoiceQueueRtPauses']=function(_0x253217){var _0x17ee69=this;return new Promise(function(_0x1317e2,_0xb59b8b){return db['UserVoiceQueueRt'][_0x65e5('0x1b')]({'raw':_0x253217[_0x65e5('0x1c')]?_0x253217[_0x65e5('0x1c')][_0x65e5('0x1d')]===undefined?!![]:![]:!![],'where':_0x253217[_0x65e5('0x1c')]?_0x253217[_0x65e5('0x1c')][_0x65e5('0x1e')]||null:null,'attributes':[[db[_0x65e5('0x1f')]['fn'](_0x65e5('0x20'),db[_0x65e5('0x1f')]['fn']('IF',db[_0x65e5('0x1f')][_0x65e5('0x21')](_0x65e5('0x22')))),_0x65e5('0x23')]]})['then'](function(_0x47ff15){logger[_0x65e5('0x18')](_0x65e5('0x24'),_0x253217);logger['debug'](_0x65e5('0x24'),_0x253217,JSON[_0x65e5('0x14')](_0x47ff15));_0x1317e2(_0x47ff15);})[_0x65e5('0x19')](function(_0x324f14){logger['error'](_0x65e5('0x24'),_0x324f14[_0x65e5('0x17')],_0x253217);_0xb59b8b(_0x17ee69['error'](0x1f4,_0x324f14['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 9f79b27..68313ea 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 _0x448a=['removeListener','register','length','save','remove','emit'];(function(_0x24a56a,_0x550eb7){var _0x4175c0=function(_0x1bc188){while(--_0x1bc188){_0x24a56a['push'](_0x24a56a['shift']());}};_0x4175c0(++_0x550eb7);}(_0x448a,0x1ef));var _0xa448=function(_0x25e296,_0x172c5e){_0x25e296=_0x25e296-0x0;var _0x3cd140=_0x448a[_0x25e296];return _0x3cd140;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa448('0x0'),_0xa448('0x1'),'update'];function createListener(_0x3f08b0,_0x47909c){return function(_0x5ea7f4){_0x47909c[_0xa448('0x2')](_0x3f08b0,_0x5ea7f4);};}function removeListener(_0x3206fd,_0x57e1ea){return function(){UserVoiceQueueRtEvents[_0xa448('0x3')](_0x3206fd,_0x57e1ea);};}exports[_0xa448('0x4')]=function(_0x343b79){for(var _0x2c16e3=0x0,_0x12b0e2=events[_0xa448('0x5')];_0x2c16e3<_0x12b0e2;_0x2c16e3++){var _0x1ec2d8=events[_0x2c16e3];var _0x54bdb0=createListener('userVoiceQueueRt:'+_0x1ec2d8,_0x343b79);UserVoiceQueueRtEvents['on'](_0x1ec2d8,_0x54bdb0);}}; \ No newline at end of file +var _0x82c4=['removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x1d1458,_0x39d055){var _0x3a8697=function(_0x3b5f86){while(--_0x3b5f86){_0x1d1458['push'](_0x1d1458['shift']());}};_0x3a8697(++_0x39d055);}(_0x82c4,0x1ca));var _0x482c=function(_0x191f9d,_0x21976f){_0x191f9d=_0x191f9d-0x0;var _0x58e60d=_0x82c4[_0x191f9d];return _0x58e60d;};'use strict';var UserVoiceQueueRtEvents=require(_0x482c('0x0'));var events=[_0x482c('0x1'),_0x482c('0x2'),_0x482c('0x3')];function createListener(_0x18d056,_0x69706f){return function(_0x863ea9){_0x69706f['emit'](_0x18d056,_0x863ea9);};}function removeListener(_0x16b0f8,_0x5f4dee){return function(){UserVoiceQueueRtEvents[_0x482c('0x4')](_0x16b0f8,_0x5f4dee);};}exports['register']=function(_0x477cf4){for(var _0x5d7c76=0x0,_0xfdb92=events[_0x482c('0x5')];_0x5d7c76<_0xfdb92;_0x5d7c76++){var _0x35cdab=events[_0x5d7c76];var _0x1c10f2=createListener(_0x482c('0x6')+_0x35cdab,_0x477cf4);UserVoiceQueueRtEvents['on'](_0x35cdab,_0x1c10f2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f1203e7..9a44d62 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e9535,_0x3b71b4){var _0x263e98=function(_0x4919fd){while(--_0x4919fd){_0x4e9535['push'](_0x4e9535['shift']());}};_0x263e98(++_0x3b71b4);}(_0xe706,0xa3));var _0x6e70=function(_0x150bff,_0x1fb61a){_0x150bff=_0x150bff-0x0;var _0x296f9a=_0xe706[_0x150bff];return _0x296f9a;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4c88c7,_0x32bb1c){var _0x536995=function(_0x368051){while(--_0x368051){_0x4c88c7['push'](_0x4c88c7['shift']());}};_0x536995(++_0x32bb1c);}(_0xe706,0xa3));var _0x6e70=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xe706[_0x16539a];return _0x200796;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5529721..9b073b3 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 _0x5909=['INTEGER','exports'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x5909,0x131));var _0x9590=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x5909[_0x2b5b44];return _0x32cb66;};'use strict';var Sequelize=require('sequelize');module[_0x9590('0x0')]={'penalty':{'type':Sequelize[_0x9590('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x15c9=['sequelize','exports','INTEGER'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0x15c9,0x13e));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x915c('0x0'));module[_0x915c('0x1')]={'penalty':{'type':Sequelize[_0x915c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 84af94d..564d4ac 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 _0x2190=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x2190,0x150));var _0x0219=function(_0xda5128,_0x5c54e0){_0xda5128=_0xda5128-0x0;var _0x16fb58=_0x2190[_0xda5128];return _0x16fb58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0219('0x0'))(_0x0219('0x1'));var moment=require(_0x0219('0x2'));var BPromise=require(_0x0219('0x3'));var rp=require(_0x0219('0x4'));var fs=require('fs');var path=require(_0x0219('0x5'));var rimraf=require(_0x0219('0x6'));var config=require('../../config/environment');var attributes=require(_0x0219('0x7'));module[_0x0219('0x8')]=function(_0x123f50,_0x46da6f){return _0x123f50[_0x0219('0x9')](_0x0219('0xa'),attributes,{'tableName':_0x0219('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b1=['request-promise','path','../../config/environment','define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api','moment','bluebird'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xf5b1,0xf6));var _0x1f5b=function(_0x1cf35e,_0x410ffb){_0x1cf35e=_0x1cf35e-0x0;var _0x56a30a=_0xf5b1[_0x1cf35e];return _0x56a30a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f5b('0x0'))(_0x1f5b('0x1'));var moment=require(_0x1f5b('0x2'));var BPromise=require(_0x1f5b('0x3'));var rp=require(_0x1f5b('0x4'));var fs=require('fs');var path=require(_0x1f5b('0x5'));var rimraf=require('rimraf');var config=require(_0x1f5b('0x6'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x48b57c,_0x1f7116){return _0x48b57c[_0x1f5b('0x7')](_0x1f5b('0x8'),attributes,{'tableName':_0x1f5b('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 1732168..4f68ca7 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 _0xa8da=['client','request','then','request\x20sent','debug','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x559cf2,_0x443a3a){var _0x15aaa7=function(_0x596f0f){while(--_0x596f0f){_0x559cf2['push'](_0x559cf2['shift']());}};_0x15aaa7(++_0x443a3a);}(_0xa8da,0xfe));var _0xaa8d=function(_0x503848,_0xb66260){_0x503848=_0x503848-0x0;var _0x36f501=_0xa8da[_0x503848];return _0x36f501;};'use strict';var _=require(_0xaa8d('0x0'));var util=require(_0xaa8d('0x1'));var moment=require(_0xaa8d('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa8d('0x3'));var fs=require('fs');var Redis=require(_0xaa8d('0x4'));var db=require(_0xaa8d('0x5'))['db'];var utils=require(_0xaa8d('0x6'));var logger=require(_0xaa8d('0x7'))(_0xaa8d('0x8'));var config=require(_0xaa8d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa8d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c9938,_0x416525,_0x2141df){return new BPromise(function(_0x53de88,_0x240f3c){return client[_0xaa8d('0xb')](_0x3c9938,_0x2141df)[_0xaa8d('0xc')](function(_0x55dbad){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x416525,_0xaa8d('0xd'));logger[_0xaa8d('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x416525,'request\x20sent',JSON[_0xaa8d('0xf')](_0x55dbad));if(_0x55dbad[_0xaa8d('0x10')]){if(_0x55dbad[_0xaa8d('0x10')]['code']===0x1f4){logger[_0xaa8d('0x10')](_0xaa8d('0x11'),_0x416525,_0x55dbad['error'][_0xaa8d('0x12')]);return _0x240f3c(_0x55dbad[_0xaa8d('0x10')][_0xaa8d('0x12')]);}logger[_0xaa8d('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x416525,_0x55dbad['error']['message']);return _0x53de88(_0x55dbad[_0xaa8d('0x10')]['message']);}else{logger[_0xaa8d('0x13')](_0xaa8d('0x11'),_0x416525,_0xaa8d('0xd'));_0x53de88(_0x55dbad[_0xaa8d('0x14')]['message']);}})[_0xaa8d('0x15')](function(_0x3c1cf6){logger[_0xaa8d('0x10')](_0xaa8d('0x11'),_0x416525,_0x3c1cf6);_0x240f3c(_0x3c1cf6);});});} \ No newline at end of file +var _0x3958=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x39cccc,_0x470467){var _0x59735e=function(_0x34d508){while(--_0x34d508){_0x39cccc['push'](_0x39cccc['shift']());}};_0x59735e(++_0x470467);}(_0x3958,0xfe));var _0x8395=function(_0x35a3cc,_0x4d79d4){_0x35a3cc=_0x35a3cc-0x0;var _0x4ec849=_0x3958[_0x35a3cc];return _0x4ec849;};'use strict';var _=require('lodash');var util=require(_0x8395('0x0'));var moment=require(_0x8395('0x1'));var BPromise=require(_0x8395('0x2'));var rs=require(_0x8395('0x3'));var fs=require('fs');var Redis=require(_0x8395('0x4'));var db=require(_0x8395('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8395('0x6'))('rpc');var config=require(_0x8395('0x7'));var jayson=require(_0x8395('0x8'));var client=jayson[_0x8395('0x9')][_0x8395('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x812e0e,_0x4e25d9,_0x65a8b2){return new BPromise(function(_0x5e81f1,_0x15f973){return client[_0x8395('0xb')](_0x812e0e,_0x65a8b2)[_0x8395('0xc')](function(_0x4126af){logger[_0x8395('0xd')](_0x8395('0xe'),_0x4e25d9,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4e25d9,'request\x20sent',JSON['stringify'](_0x4126af));if(_0x4126af[_0x8395('0xf')]){if(_0x4126af[_0x8395('0xf')]['code']===0x1f4){logger[_0x8395('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4e25d9,_0x4126af[_0x8395('0xf')][_0x8395('0x10')]);return _0x15f973(_0x4126af[_0x8395('0xf')][_0x8395('0x10')]);}logger[_0x8395('0xf')](_0x8395('0xe'),_0x4e25d9,_0x4126af[_0x8395('0xf')][_0x8395('0x10')]);return _0x5e81f1(_0x4126af[_0x8395('0xf')][_0x8395('0x10')]);}else{logger[_0x8395('0xd')](_0x8395('0xe'),_0x4e25d9,_0x8395('0x11'));_0x5e81f1(_0x4126af[_0x8395('0x12')][_0x8395('0x10')]);}})[_0x8395('0x13')](function(_0x574c3c){logger['error'](_0x8395('0xe'),_0x4e25d9,_0x574c3c);_0x15f973(_0x574c3c);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ed7a3fe..4e6ab25 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 _0x894f=['show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./variable.controller','get','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x894f,0x14d));var _0xf894=function(_0x1d3649,_0x49a5e8){_0x1d3649=_0x1d3649-0x0;var _0x15fffd=_0x894f[_0x1d3649];return _0x15fffd;};'use strict';var multer=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var path=require(_0xf894('0x2'));var timeout=require(_0xf894('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf894('0x4'));var auth=require(_0xf894('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf894('0x6'));router[_0xf894('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf894('0x7')](_0xf894('0x8'),auth['isAuthenticated'](),controller[_0xf894('0x9')]);router[_0xf894('0xa')]('/',auth[_0xf894('0xb')](),controller[_0xf894('0xc')]);router[_0xf894('0xd')](_0xf894('0x8'),auth[_0xf894('0xb')](),controller[_0xf894('0xe')]);router[_0xf894('0xf')](_0xf894('0x8'),auth[_0xf894('0xb')](),controller[_0xf894('0x10')]);module[_0xf894('0x11')]=router; \ No newline at end of file +var _0xc524=['index','show','post','create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x49d278,_0x147dd6){var _0x2a0601=function(_0x3b5d0e){while(--_0x3b5d0e){_0x49d278['push'](_0x49d278['shift']());}};_0x2a0601(++_0x147dd6);}(_0xc524,0x1bf));var _0x4c52=function(_0x1b268b,_0x27b463){_0x1b268b=_0x1b268b-0x0;var _0x2b8a70=_0xc524[_0x1b268b];return _0x2b8a70;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4c52('0x0'));var timeout=require(_0x4c52('0x1'));var express=require(_0x4c52('0x2'));var router=express[_0x4c52('0x3')]();var fs_extra=require(_0x4c52('0x4'));var auth=require(_0x4c52('0x5'));var interaction=require(_0x4c52('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x4c52('0x7')]('/',auth[_0x4c52('0x8')](),controller[_0x4c52('0x9')]);router[_0x4c52('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4c52('0xa')]);router[_0x4c52('0xb')]('/',auth['isAuthenticated'](),controller[_0x4c52('0xc')]);router[_0x4c52('0xd')]('/:id',auth[_0x4c52('0x8')](),controller[_0x4c52('0xe')]);router[_0x4c52('0xf')](_0x4c52('0x10'),auth[_0x4c52('0x8')](),controller[_0x4c52('0x11')]);module[_0x4c52('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 614c867..fe5c699 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 _0x8d9c=['name','sequelize','exports','STRING'];(function(_0x548382,_0xb4748d){var _0x2afd47=function(_0x7ff27a){while(--_0x7ff27a){_0x548382['push'](_0x548382['shift']());}};_0x2afd47(++_0xb4748d);}(_0x8d9c,0x71));var _0xc8d9=function(_0x4f541d,_0x59751e){_0x4f541d=_0x4f541d-0x0;var _0x58ce17=_0x8d9c[_0x4f541d];return _0x58ce17;};'use strict';var Sequelize=require(_0xc8d9('0x0'));module[_0xc8d9('0x1')]={'name':{'type':Sequelize[_0xc8d9('0x2')],'unique':_0xc8d9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc8d9('0x2')]}}; \ No newline at end of file +var _0xd698=['STRING','name','sequelize','exports'];(function(_0x1c222f,_0x269ffb){var _0x5928f8=function(_0x79249f){while(--_0x79249f){_0x1c222f['push'](_0x1c222f['shift']());}};_0x5928f8(++_0x269ffb);}(_0xd698,0xe2));var _0x8d69=function(_0x3d904e,_0x2d819f){_0x3d904e=_0x3d904e-0x0;var _0x656fb2=_0xd698[_0x3d904e];return _0x656fb2;};'use strict';var Sequelize=require(_0x8d69('0x0'));module[_0x8d69('0x1')]={'name':{'type':Sequelize[_0x8d69('0x2')],'unique':_0x8d69('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8d69('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index fd54f8d..a388b12 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 _0xe7e1=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','type','key','query','keys','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x287521,_0x4d9e0c){var _0x161392=function(_0x22b8f1){while(--_0x22b8f1){_0x287521['push'](_0x287521['shift']());}};_0x161392(++_0x4d9e0c);}(_0xe7e1,0x8b));var _0x1e7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xe7e1[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require(_0x1e7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e7e('0x1'));var jsonpatch=require(_0x1e7e('0x2'));var rp=require(_0x1e7e('0x3'));var moment=require('moment');var BPromise=require(_0x1e7e('0x4'));var Mustache=require(_0x1e7e('0x5'));var util=require(_0x1e7e('0x6'));var path=require(_0x1e7e('0x7'));var sox=require(_0x1e7e('0x8'));var csv=require(_0x1e7e('0x9'));var ejs=require(_0x1e7e('0xa'));var fs=require('fs');var fs_extra=require(_0x1e7e('0xb'));var _=require(_0x1e7e('0xc'));var squel=require(_0x1e7e('0xd'));var crypto=require(_0x1e7e('0xe'));var jsforce=require(_0x1e7e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1e7e('0x9'));var querystring=require('querystring');var Papa=require(_0x1e7e('0x10'));var Redis=require(_0x1e7e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1e7e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e7e('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e7e('0x14'));var db=require(_0x1e7e('0x15'))['db'];function respondWithStatusCode(_0x211c3c,_0x881682){_0x881682=_0x881682||0xcc;return function(_0x23ee6d){if(_0x23ee6d){return _0x211c3c[_0x1e7e('0x16')](_0x881682);}return _0x211c3c[_0x1e7e('0x17')](_0x881682)[_0x1e7e('0x18')]();};}function respondWithResult(_0x341bc3,_0x358498){_0x358498=_0x358498||0xc8;return function(_0x2f3dfe){if(_0x2f3dfe){return _0x341bc3[_0x1e7e('0x17')](_0x358498)[_0x1e7e('0x19')](_0x2f3dfe);}};}function respondWithFilteredResult(_0x2e5adb,_0xb39f1c){return function(_0x38d406){if(_0x38d406){var _0x2cf3f3=typeof _0xb39f1c[_0x1e7e('0x1a')]===_0x1e7e('0x1b')&&typeof _0xb39f1c[_0x1e7e('0x1c')]===_0x1e7e('0x1b');var _0x3a1eb5=_0x38d406[_0x1e7e('0x1d')];var _0x334836=_0x2cf3f3?0x0:_0xb39f1c[_0x1e7e('0x1a')];var _0x55b0c8=_0x2cf3f3?_0x38d406[_0x1e7e('0x1d')]:_0xb39f1c[_0x1e7e('0x1a')]+_0xb39f1c[_0x1e7e('0x1c')];var _0x111a75;if(_0x55b0c8>=_0x3a1eb5){_0x55b0c8=_0x3a1eb5;_0x111a75=0xc8;}else{_0x111a75=0xce;}_0x2e5adb[_0x1e7e('0x17')](_0x111a75);return _0x2e5adb[_0x1e7e('0x1e')](_0x1e7e('0x1f'),_0x334836+'-'+_0x55b0c8+'/'+_0x3a1eb5)[_0x1e7e('0x19')](_0x38d406);}return null;};}function patchUpdates(_0x5763b6){return function(_0x2d6395){try{jsonpatch[_0x1e7e('0x20')](_0x2d6395,_0x5763b6,!![]);}catch(_0x1803f3){return BPromise[_0x1e7e('0x21')](_0x1803f3);}return _0x2d6395['save']();};}function saveUpdates(_0x2cf64d,_0x4be920){return function(_0x576e42){if(_0x576e42){return _0x576e42[_0x1e7e('0x22')](_0x2cf64d)[_0x1e7e('0x23')](function(_0x287cfb){return _0x287cfb;});}return null;};}function removeEntity(_0x132924,_0x3c8c93){return function(_0x46aebc){if(_0x46aebc){return _0x46aebc[_0x1e7e('0x24')]()[_0x1e7e('0x23')](function(){var _0x508616=_0x46aebc[_0x1e7e('0x25')]({'plain':!![]});var _0x304ae0=_0x1e7e('0x26');return db[_0x1e7e('0x27')]['destroy']({'where':{'type':_0x304ae0,'resourceId':_0x508616['id']}})['then'](function(){return _0x46aebc;});})[_0x1e7e('0x23')](function(){_0x132924[_0x1e7e('0x17')](0xcc)[_0x1e7e('0x18')]();});}};}function handleEntityNotFound(_0x13ccde,_0x559a67){return function(_0x529267){if(!_0x529267){_0x13ccde[_0x1e7e('0x16')](0x194);}return _0x529267;};}function handleError(_0x1a7633,_0x2f40b1){_0x2f40b1=_0x2f40b1||0x1f4;return function(_0x343da5){logger[_0x1e7e('0x28')](_0x343da5[_0x1e7e('0x29')]);if(_0x343da5[_0x1e7e('0x2a')]){delete _0x343da5[_0x1e7e('0x2a')];}_0x1a7633['status'](_0x2f40b1)[_0x1e7e('0x2b')](_0x343da5);};}exports[_0x1e7e('0x2c')]=function(_0x270f41,_0x40eef0){var _0x5a9567={},_0x4740f9={},_0x4ce19d={'count':0x0,'rows':[]};var _0x5cfdf3=_[_0x1e7e('0x2d')](db[_0x1e7e('0x2e')][_0x1e7e('0x2f')],function(_0x5862d3){return{'name':_0x5862d3['fieldName'],'type':_0x5862d3[_0x1e7e('0x30')][_0x1e7e('0x31')]};});_0x4740f9['model']=_[_0x1e7e('0x2d')](_0x5cfdf3,_0x1e7e('0x2a'));_0x4740f9[_0x1e7e('0x32')]=_[_0x1e7e('0x33')](_0x270f41[_0x1e7e('0x32')]);_0x4740f9['filters']=_['intersection'](_0x4740f9[_0x1e7e('0x34')],_0x4740f9[_0x1e7e('0x32')]);_0x5a9567[_0x1e7e('0x35')]=_['intersection'](_0x4740f9[_0x1e7e('0x34')],qs[_0x1e7e('0x36')](_0x270f41[_0x1e7e('0x32')][_0x1e7e('0x36')]));_0x5a9567[_0x1e7e('0x35')]=_0x5a9567[_0x1e7e('0x35')][_0x1e7e('0x37')]?_0x5a9567['attributes']:_0x4740f9['model'];if(!_0x270f41[_0x1e7e('0x32')]['hasOwnProperty'](_0x1e7e('0x38'))){_0x5a9567['limit']=qs[_0x1e7e('0x1c')](_0x270f41[_0x1e7e('0x32')][_0x1e7e('0x1c')]);_0x5a9567[_0x1e7e('0x1a')]=qs[_0x1e7e('0x1a')](_0x270f41[_0x1e7e('0x32')][_0x1e7e('0x1a')]);}_0x5a9567[_0x1e7e('0x39')]=qs[_0x1e7e('0x3a')](_0x270f41[_0x1e7e('0x32')]['sort']);_0x5a9567[_0x1e7e('0x3b')]=qs['filters'](_['pick'](_0x270f41['query'],_0x4740f9[_0x1e7e('0x3c')]),_0x5cfdf3);if(_0x270f41[_0x1e7e('0x32')][_0x1e7e('0x3d')]){_0x5a9567[_0x1e7e('0x3b')]=_[_0x1e7e('0x3e')](_0x5a9567[_0x1e7e('0x3b')],{'$or':_['map'](_0x5cfdf3,function(_0x4ad033){if(_0x4ad033['type']!==_0x1e7e('0x3f')){var _0x568904={};_0x568904[_0x4ad033[_0x1e7e('0x2a')]]={'$like':'%'+_0x270f41[_0x1e7e('0x32')]['filter']+'%'};return _0x568904;}})});}_0x5a9567=_[_0x1e7e('0x3e')]({},_0x5a9567,_0x270f41[_0x1e7e('0x40')]);var _0x5ad98d={'where':_0x5a9567[_0x1e7e('0x3b')]};return db[_0x1e7e('0x2e')][_0x1e7e('0x1d')](_0x5ad98d)[_0x1e7e('0x23')](function(_0x4c3592){_0x4ce19d[_0x1e7e('0x1d')]=_0x4c3592;if(_0x270f41[_0x1e7e('0x32')][_0x1e7e('0x41')]){_0x5a9567[_0x1e7e('0x42')]=[{'all':!![]}];}return db[_0x1e7e('0x2e')]['findAll'](_0x5a9567);})[_0x1e7e('0x23')](function(_0x23feb0){_0x4ce19d['rows']=_0x23feb0;return _0x4ce19d;})[_0x1e7e('0x23')](respondWithFilteredResult(_0x40eef0,_0x5a9567))[_0x1e7e('0x43')](handleError(_0x40eef0,null));};exports[_0x1e7e('0x44')]=function(_0x36faa5,_0x37c804){var _0x4b1f54={'raw':!![],'where':{'id':_0x36faa5[_0x1e7e('0x45')]['id']}},_0x45bc16={};_0x45bc16[_0x1e7e('0x34')]=_[_0x1e7e('0x33')](db[_0x1e7e('0x2e')][_0x1e7e('0x2f')]);_0x45bc16[_0x1e7e('0x32')]=_['keys'](_0x36faa5[_0x1e7e('0x32')]);_0x45bc16[_0x1e7e('0x3c')]=_[_0x1e7e('0x46')](_0x45bc16[_0x1e7e('0x34')],_0x45bc16[_0x1e7e('0x32')]);_0x4b1f54[_0x1e7e('0x35')]=_[_0x1e7e('0x46')](_0x45bc16['model'],qs['fields'](_0x36faa5[_0x1e7e('0x32')]['fields']));_0x4b1f54[_0x1e7e('0x35')]=_0x4b1f54[_0x1e7e('0x35')][_0x1e7e('0x37')]?_0x4b1f54[_0x1e7e('0x35')]:_0x45bc16[_0x1e7e('0x34')];if(_0x36faa5[_0x1e7e('0x32')]['includeAll']){_0x4b1f54[_0x1e7e('0x42')]=[{'all':!![]}];}_0x4b1f54=_[_0x1e7e('0x3e')]({},_0x4b1f54,_0x36faa5[_0x1e7e('0x40')]);return db[_0x1e7e('0x2e')][_0x1e7e('0x47')](_0x4b1f54)['then'](handleEntityNotFound(_0x37c804,null))[_0x1e7e('0x23')](respondWithResult(_0x37c804,null))[_0x1e7e('0x43')](handleError(_0x37c804,null));};exports[_0x1e7e('0x48')]=function(_0x506791,_0x5b89cb){return db[_0x1e7e('0x2e')]['create'](_0x506791[_0x1e7e('0x49')],{})[_0x1e7e('0x23')](function(_0x3f0238){var _0x361c35=_0x506791[_0x1e7e('0x4a')][_0x1e7e('0x25')]({'plain':!![]});if(!_0x361c35)throw new Error(_0x1e7e('0x4b'));if(_0x361c35[_0x1e7e('0x4c')]===_0x1e7e('0x4a')){var _0x46dbf3=_0x3f0238[_0x1e7e('0x25')]({'plain':!![]});var _0x245a38=_0x1e7e('0x26');return db[_0x1e7e('0x4d')][_0x1e7e('0x47')]({'where':{'name':_0x245a38,'userProfileId':_0x361c35['userProfileId']},'raw':!![]})[_0x1e7e('0x23')](function(_0x4305b5){if(_0x4305b5&&_0x4305b5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x46dbf3[_0x1e7e('0x2a')],'resourceId':_0x46dbf3['id'],'type':_0x4305b5[_0x1e7e('0x2a')],'sectionId':_0x4305b5['id']},{})['then'](function(){return _0x3f0238;});}else{return _0x3f0238;}})[_0x1e7e('0x43')](function(_0x222e29){logger[_0x1e7e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x222e29);throw _0x222e29;});}return _0x3f0238;})[_0x1e7e('0x23')](respondWithResult(_0x5b89cb,0xc9))[_0x1e7e('0x43')](handleError(_0x5b89cb,null));};exports[_0x1e7e('0x22')]=function(_0x57bf0f,_0x5d4626){if(_0x57bf0f['body']['id']){delete _0x57bf0f[_0x1e7e('0x49')]['id'];}return db[_0x1e7e('0x2e')][_0x1e7e('0x47')]({'where':{'id':_0x57bf0f['params']['id']}})['then'](handleEntityNotFound(_0x5d4626,null))[_0x1e7e('0x23')](saveUpdates(_0x57bf0f[_0x1e7e('0x49')],null))[_0x1e7e('0x23')](respondWithResult(_0x5d4626,null))['catch'](handleError(_0x5d4626,null));};exports['destroy']=function(_0x5b06e3,_0x3e7311){return db[_0x1e7e('0x2e')][_0x1e7e('0x47')]({'where':{'id':_0x5b06e3['params']['id']}})[_0x1e7e('0x23')](handleEntityNotFound(_0x3e7311,null))[_0x1e7e('0x23')](removeEntity(_0x3e7311,null))[_0x1e7e('0x43')](handleError(_0x3e7311,null));}; \ No newline at end of file +var _0xbf29=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','get','Variables','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','Variable','rows','catch','params','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x4cc9e8,_0x5bf087){var _0x58323c=function(_0x36ddcb){while(--_0x36ddcb){_0x4cc9e8['push'](_0x4cc9e8['shift']());}};_0x58323c(++_0x5bf087);}(_0xbf29,0x17e));var _0x9bf2=function(_0x551ee7,_0x47a30f){_0x551ee7=_0x551ee7-0x0;var _0x50720a=_0xbf29[_0x551ee7];return _0x50720a;};'use strict';var emlformat=require(_0x9bf2('0x0'));var rimraf=require(_0x9bf2('0x1'));var zipdir=require(_0x9bf2('0x2'));var jsonpatch=require(_0x9bf2('0x3'));var rp=require('request-promise');var moment=require(_0x9bf2('0x4'));var BPromise=require(_0x9bf2('0x5'));var Mustache=require(_0x9bf2('0x6'));var util=require('util');var path=require(_0x9bf2('0x7'));var sox=require('sox');var csv=require(_0x9bf2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bf2('0x9'));var _=require(_0x9bf2('0xa'));var squel=require(_0x9bf2('0xb'));var crypto=require('crypto');var jsforce=require(_0x9bf2('0xc'));var deskjs=require(_0x9bf2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9bf2('0xe'));var Papa=require(_0x9bf2('0xf'));var Redis=require(_0x9bf2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9bf2('0x11'));var hardwareService=require(_0x9bf2('0x12'));var logger=require(_0x9bf2('0x13'))('api');var utils=require(_0x9bf2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9bf2('0x15'));var db=require(_0x9bf2('0x16'))['db'];function respondWithStatusCode(_0x82728a,_0x3a96da){_0x3a96da=_0x3a96da||0xcc;return function(_0x27e718){if(_0x27e718){return _0x82728a[_0x9bf2('0x17')](_0x3a96da);}return _0x82728a['status'](_0x3a96da)[_0x9bf2('0x18')]();};}function respondWithResult(_0x1177ea,_0x51378a){_0x51378a=_0x51378a||0xc8;return function(_0x4930bb){if(_0x4930bb){return _0x1177ea['status'](_0x51378a)[_0x9bf2('0x19')](_0x4930bb);}};}function respondWithFilteredResult(_0x16a7ef,_0x3d9389){return function(_0x3730df){if(_0x3730df){var _0x3405f5=typeof _0x3d9389[_0x9bf2('0x1a')]===_0x9bf2('0x1b')&&typeof _0x3d9389[_0x9bf2('0x1c')]===_0x9bf2('0x1b');var _0x1b14d3=_0x3730df[_0x9bf2('0x1d')];var _0x247e6f=_0x3405f5?0x0:_0x3d9389[_0x9bf2('0x1a')];var _0x2eddd1=_0x3405f5?_0x3730df['count']:_0x3d9389[_0x9bf2('0x1a')]+_0x3d9389['limit'];var _0x57485b;if(_0x2eddd1>=_0x1b14d3){_0x2eddd1=_0x1b14d3;_0x57485b=0xc8;}else{_0x57485b=0xce;}_0x16a7ef[_0x9bf2('0x1e')](_0x57485b);return _0x16a7ef['set'](_0x9bf2('0x1f'),_0x247e6f+'-'+_0x2eddd1+'/'+_0x1b14d3)[_0x9bf2('0x19')](_0x3730df);}return null;};}function patchUpdates(_0x2bb1f9){return function(_0x4bba36){try{jsonpatch[_0x9bf2('0x20')](_0x4bba36,_0x2bb1f9,!![]);}catch(_0x4fe84b){return BPromise[_0x9bf2('0x21')](_0x4fe84b);}return _0x4bba36[_0x9bf2('0x22')]();};}function saveUpdates(_0x579b38,_0x3119ff){return function(_0x148299){if(_0x148299){return _0x148299['update'](_0x579b38)[_0x9bf2('0x23')](function(_0x34b5a0){return _0x34b5a0;});}return null;};}function removeEntity(_0x18c1a1,_0x55cb2e){return function(_0x344c18){if(_0x344c18){return _0x344c18['destroy']()[_0x9bf2('0x23')](function(){var _0x3fa3d6=_0x344c18[_0x9bf2('0x24')]({'plain':!![]});var _0x46b0c2=_0x9bf2('0x25');return db[_0x9bf2('0x26')][_0x9bf2('0x27')]({'where':{'type':_0x46b0c2,'resourceId':_0x3fa3d6['id']}})[_0x9bf2('0x23')](function(){return _0x344c18;});})['then'](function(){_0x18c1a1[_0x9bf2('0x1e')](0xcc)[_0x9bf2('0x18')]();});}};}function handleEntityNotFound(_0x3d70ef,_0x291d7d){return function(_0x43b7c8){if(!_0x43b7c8){_0x3d70ef['sendStatus'](0x194);}return _0x43b7c8;};}function handleError(_0x44849e,_0x5eb786){_0x5eb786=_0x5eb786||0x1f4;return function(_0x12613f){logger[_0x9bf2('0x28')](_0x12613f['stack']);if(_0x12613f[_0x9bf2('0x29')]){delete _0x12613f[_0x9bf2('0x29')];}_0x44849e[_0x9bf2('0x1e')](_0x5eb786)[_0x9bf2('0x2a')](_0x12613f);};}exports[_0x9bf2('0x2b')]=function(_0x49d2ab,_0x45ed11){var _0x521601={},_0x1099bc={},_0x1e7637={'count':0x0,'rows':[]};var _0x1eb6f9=_[_0x9bf2('0x2c')](db['Variable'][_0x9bf2('0x2d')],function(_0x24c37a){return{'name':_0x24c37a[_0x9bf2('0x2e')],'type':_0x24c37a[_0x9bf2('0x2f')][_0x9bf2('0x30')]};});_0x1099bc[_0x9bf2('0x31')]=_['map'](_0x1eb6f9,'name');_0x1099bc[_0x9bf2('0x32')]=_[_0x9bf2('0x33')](_0x49d2ab['query']);_0x1099bc[_0x9bf2('0x34')]=_['intersection'](_0x1099bc[_0x9bf2('0x31')],_0x1099bc['query']);_0x521601[_0x9bf2('0x35')]=_[_0x9bf2('0x36')](_0x1099bc['model'],qs[_0x9bf2('0x37')](_0x49d2ab[_0x9bf2('0x32')][_0x9bf2('0x37')]));_0x521601[_0x9bf2('0x35')]=_0x521601['attributes'][_0x9bf2('0x38')]?_0x521601['attributes']:_0x1099bc[_0x9bf2('0x31')];if(!_0x49d2ab['query'][_0x9bf2('0x39')](_0x9bf2('0x3a'))){_0x521601['limit']=qs[_0x9bf2('0x1c')](_0x49d2ab[_0x9bf2('0x32')]['limit']);_0x521601[_0x9bf2('0x1a')]=qs['offset'](_0x49d2ab[_0x9bf2('0x32')]['offset']);}_0x521601[_0x9bf2('0x3b')]=qs['sort'](_0x49d2ab[_0x9bf2('0x32')]['sort']);_0x521601[_0x9bf2('0x3c')]=qs[_0x9bf2('0x34')](_[_0x9bf2('0x3d')](_0x49d2ab[_0x9bf2('0x32')],_0x1099bc['filters']),_0x1eb6f9);if(_0x49d2ab[_0x9bf2('0x32')][_0x9bf2('0x3e')]){_0x521601[_0x9bf2('0x3c')]=_[_0x9bf2('0x3f')](_0x521601[_0x9bf2('0x3c')],{'$or':_[_0x9bf2('0x2c')](_0x1eb6f9,function(_0x3deea1){if(_0x3deea1[_0x9bf2('0x2f')]!=='VIRTUAL'){var _0x212ba5={};_0x212ba5[_0x3deea1['name']]={'$like':'%'+_0x49d2ab['query']['filter']+'%'};return _0x212ba5;}})});}_0x521601=_[_0x9bf2('0x3f')]({},_0x521601,_0x49d2ab[_0x9bf2('0x40')]);var _0x5dbd18={'where':_0x521601[_0x9bf2('0x3c')]};return db['Variable'][_0x9bf2('0x1d')](_0x5dbd18)[_0x9bf2('0x23')](function(_0x5d980e){_0x1e7637['count']=_0x5d980e;if(_0x49d2ab[_0x9bf2('0x32')][_0x9bf2('0x41')]){_0x521601[_0x9bf2('0x42')]=[{'all':!![]}];}return db[_0x9bf2('0x43')]['findAll'](_0x521601);})[_0x9bf2('0x23')](function(_0x36347d){_0x1e7637[_0x9bf2('0x44')]=_0x36347d;return _0x1e7637;})['then'](respondWithFilteredResult(_0x45ed11,_0x521601))[_0x9bf2('0x45')](handleError(_0x45ed11,null));};exports['show']=function(_0x4cfc56,_0x1359d2){var _0x34030a={'raw':!![],'where':{'id':_0x4cfc56[_0x9bf2('0x46')]['id']}},_0xf005dd={};_0xf005dd[_0x9bf2('0x31')]=_['keys'](db['Variable'][_0x9bf2('0x2d')]);_0xf005dd[_0x9bf2('0x32')]=_[_0x9bf2('0x33')](_0x4cfc56[_0x9bf2('0x32')]);_0xf005dd['filters']=_[_0x9bf2('0x36')](_0xf005dd[_0x9bf2('0x31')],_0xf005dd[_0x9bf2('0x32')]);_0x34030a[_0x9bf2('0x35')]=_[_0x9bf2('0x36')](_0xf005dd[_0x9bf2('0x31')],qs[_0x9bf2('0x37')](_0x4cfc56[_0x9bf2('0x32')][_0x9bf2('0x37')]));_0x34030a[_0x9bf2('0x35')]=_0x34030a['attributes'][_0x9bf2('0x38')]?_0x34030a[_0x9bf2('0x35')]:_0xf005dd[_0x9bf2('0x31')];if(_0x4cfc56[_0x9bf2('0x32')][_0x9bf2('0x41')]){_0x34030a[_0x9bf2('0x42')]=[{'all':!![]}];}_0x34030a=_[_0x9bf2('0x3f')]({},_0x34030a,_0x4cfc56[_0x9bf2('0x40')]);return db[_0x9bf2('0x43')][_0x9bf2('0x47')](_0x34030a)[_0x9bf2('0x23')](handleEntityNotFound(_0x1359d2,null))[_0x9bf2('0x23')](respondWithResult(_0x1359d2,null))[_0x9bf2('0x45')](handleError(_0x1359d2,null));};exports['create']=function(_0x2ec665,_0x443a35){return db['Variable'][_0x9bf2('0x48')](_0x2ec665[_0x9bf2('0x49')],{})[_0x9bf2('0x23')](function(_0x1aa6bf){var _0x48b2aa=_0x2ec665['user'][_0x9bf2('0x24')]({'plain':!![]});if(!_0x48b2aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48b2aa[_0x9bf2('0x4a')]==='user'){var _0x1ea6ba=_0x1aa6bf[_0x9bf2('0x24')]({'plain':!![]});var _0x237dc9=_0x9bf2('0x25');return db[_0x9bf2('0x4b')][_0x9bf2('0x47')]({'where':{'name':_0x237dc9,'userProfileId':_0x48b2aa[_0x9bf2('0x4c')]},'raw':!![]})[_0x9bf2('0x23')](function(_0x406ca3){if(_0x406ca3&&_0x406ca3[_0x9bf2('0x4d')]===0x0){return db[_0x9bf2('0x26')][_0x9bf2('0x48')]({'name':_0x1ea6ba[_0x9bf2('0x29')],'resourceId':_0x1ea6ba['id'],'type':_0x406ca3[_0x9bf2('0x29')],'sectionId':_0x406ca3['id']},{})[_0x9bf2('0x23')](function(){return _0x1aa6bf;});}else{return _0x1aa6bf;}})['catch'](function(_0x416e49){logger[_0x9bf2('0x28')](_0x9bf2('0x4e'),_0x416e49);throw _0x416e49;});}return _0x1aa6bf;})[_0x9bf2('0x23')](respondWithResult(_0x443a35,0xc9))[_0x9bf2('0x45')](handleError(_0x443a35,null));};exports[_0x9bf2('0x4f')]=function(_0x4100b8,_0x5e1c88){if(_0x4100b8['body']['id']){delete _0x4100b8['body']['id'];}return db[_0x9bf2('0x43')]['find']({'where':{'id':_0x4100b8['params']['id']}})[_0x9bf2('0x23')](handleEntityNotFound(_0x5e1c88,null))[_0x9bf2('0x23')](saveUpdates(_0x4100b8[_0x9bf2('0x49')],null))[_0x9bf2('0x23')](respondWithResult(_0x5e1c88,null))['catch'](handleError(_0x5e1c88,null));};exports['destroy']=function(_0xb44163,_0x5d7215){return db[_0x9bf2('0x43')]['find']({'where':{'id':_0xb44163[_0x9bf2('0x46')]['id']}})[_0x9bf2('0x23')](handleEntityNotFound(_0x5d7215,null))[_0x9bf2('0x23')](removeEntity(_0x5d7215,null))[_0x9bf2('0x45')](handleError(_0x5d7215,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c88ca84..c9e2bea 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 _0x9290=['api','moment','bluebird','request-promise','path','./variable.attributes','define','Variable','tools_variables','lodash','util'];(function(_0x4e80fa,_0x3a2f38){var _0x28c936=function(_0x8e12f3){while(--_0x8e12f3){_0x4e80fa['push'](_0x4e80fa['shift']());}};_0x28c936(++_0x3a2f38);}(_0x9290,0x111));var _0x0929=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0x9290[_0x32efcb];return _0x1dae88;};'use strict';var _=require(_0x0929('0x0'));var util=require(_0x0929('0x1'));var logger=require('../../config/logger')(_0x0929('0x2'));var moment=require(_0x0929('0x3'));var BPromise=require(_0x0929('0x4'));var rp=require(_0x0929('0x5'));var fs=require('fs');var path=require(_0x0929('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0929('0x7'));module['exports']=function(_0x5a84c4,_0x2fcf05){return _0x5a84c4[_0x0929('0x8')](_0x0929('0x9'),attributes,{'tableName':_0x0929('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf82a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables'];(function(_0x222256,_0x319a91){var _0x3bf899=function(_0x2dea62){while(--_0x2dea62){_0x222256['push'](_0x222256['shift']());}};_0x3bf899(++_0x319a91);}(_0xf82a,0x9a));var _0xaf82=function(_0x3bd730,_0x152856){_0x3bd730=_0x3bd730-0x0;var _0x207b5d=_0xf82a[_0x3bd730];return _0x207b5d;};'use strict';var _=require(_0xaf82('0x0'));var util=require(_0xaf82('0x1'));var logger=require(_0xaf82('0x2'))(_0xaf82('0x3'));var moment=require(_0xaf82('0x4'));var BPromise=require(_0xaf82('0x5'));var rp=require(_0xaf82('0x6'));var fs=require('fs');var path=require(_0xaf82('0x7'));var rimraf=require(_0xaf82('0x8'));var config=require(_0xaf82('0x9'));var attributes=require(_0xaf82('0xa'));module[_0xaf82('0xb')]=function(_0x676d27,_0x3a82e1){return _0x676d27['define'](_0xaf82('0xc'),attributes,{'tableName':_0xaf82('0xd'),'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 f88f806..7835706 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x5501d2,_0xac28c9){var _0x3e0f30=function(_0x1565f3){while(--_0x1565f3){_0x5501d2['push'](_0x5501d2['shift']());}};_0x3e0f30(++_0xac28c9);}(_0xabce,0x103));var _0xeabc=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xabce[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x3afa15,_0x139a5d){var _0x48bbca=function(_0x1db20e){while(--_0x1db20e){_0x3afa15['push'](_0x3afa15['shift']());}};_0x48bbca(++_0x139a5d);}(_0xabce,0x103));var _0xeabc=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xabce[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index df1b4ae..3973202 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 _0x959a=['/migrations','migrations','exports','express','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart'];(function(_0x10d87c,_0x457a8a){var _0xe2cbf5=function(_0x306041){while(--_0x306041){_0x10d87c['push'](_0x10d87c['shift']());}};_0xe2cbf5(++_0x457a8a);}(_0x959a,0x16b));var _0xa959=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x959a[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0xa959('0x0'));var router=express['Router']();var auth=require(_0xa959('0x1'));var controller=require('./version.controller');router[_0xa959('0x2')]('/',controller[_0xa959('0x3')]);router[_0xa959('0x2')](_0xa959('0x4'),auth[_0xa959('0x5')](),auth[_0xa959('0x6')](),controller[_0xa959('0x7')]);router['get'](_0xa959('0x8'),auth[_0xa959('0x5')](),auth['canUpdate'](),controller[_0xa959('0x9')]);router[_0xa959('0x2')](_0xa959('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller['pull']);router[_0xa959('0x2')](_0xa959('0xb'),auth[_0xa959('0x5')](),controller['restart']);router[_0xa959('0x2')](_0xa959('0xc'),controller[_0xa959('0xd')]);module[_0xa959('0xe')]=router; \ No newline at end of file +var _0xb9ef=['/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb9ef,0x75));var _0xfb9e=function(_0x2cdf44,_0x36a26f){_0x2cdf44=_0x2cdf44-0x0;var _0x3ac74b=_0xb9ef[_0x2cdf44];return _0x3ac74b;};'use strict';var express=require(_0xfb9e('0x0'));var router=express[_0xfb9e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfb9e('0x2'));router[_0xfb9e('0x3')]('/',controller[_0xfb9e('0x4')]);router[_0xfb9e('0x3')](_0xfb9e('0x5'),auth[_0xfb9e('0x6')](),auth[_0xfb9e('0x7')](),controller[_0xfb9e('0x8')]);router['get'](_0xfb9e('0x9'),auth[_0xfb9e('0x6')](),auth['canUpdate'](),controller[_0xfb9e('0xa')]);router[_0xfb9e('0x3')](_0xfb9e('0xb'),auth[_0xfb9e('0x6')](),auth[_0xfb9e('0x7')](),controller[_0xfb9e('0xc')]);router[_0xfb9e('0x3')](_0xfb9e('0xd'),auth[_0xfb9e('0x6')](),controller[_0xfb9e('0xe')]);router[_0xfb9e('0x3')](_0xfb9e('0xf'),controller[_0xfb9e('0x10')]);module[_0xfb9e('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a77b3a3..fab4597 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 _0xa795=['git\x20fetch','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','server','migrations','replace','.js','length','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','query','fetch','tags','latest','2.0.0','json','status','origin','info'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0xa795,0x85));var _0x5a79=function(_0x59db48,_0xe2798){_0x59db48=_0x59db48-0x0;var _0xe15da0=_0xa795[_0x59db48];return _0xe15da0;};'use strict';var Umzug=require(_0x5a79('0x0'));var path=require(_0x5a79('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x5a79('0x2'))(module,_0x5a79('0x3'));var compareVersions=require(_0x5a79('0x4'));var exec=require(_0x5a79('0x5'))[_0x5a79('0x6')];var db=require(_0x5a79('0x7'))['db'];var config=require(_0x5a79('0x8'));var pm2=require(_0x5a79('0x9'));var logger=require(_0x5a79('0xa'))(_0x5a79('0xb'));var git=require('simple-git')(config[_0x5a79('0xc')]);exports['index']=function(_0xe2bb0d,_0x50c3a4){var _0x1f069c={'current':module[_0x5a79('0xd')][_0x5a79('0x3')],'phonebar':0x2};if(_0xe2bb0d['query']&&_0xe2bb0d[_0x5a79('0xe')]['latest']){return git[_0x5a79('0xf')]()[_0x5a79('0x10')](function(_0x593e18,_0x2f5a58){_0x1f069c[_0x5a79('0x11')]=(_0x593e18?module['exports'][_0x5a79('0x3')]:_0x2f5a58[_0x5a79('0x11')])||_0x5a79('0x12');return _0x50c3a4['status'](0xc8)[_0x5a79('0x13')](_0x1f069c);});}else{return _0x50c3a4[_0x5a79('0x14')](0xc8)[_0x5a79('0x13')](_0x1f069c);}};exports[_0x5a79('0xf')]=function(_0x374790,_0x233d89){return git['fetch']([_0x5a79('0x15'),'master'],function(_0x3585b0){if(_0x3585b0){logger['error'](_0x3585b0);return _0x233d89['status'](0x1f4)[_0x5a79('0x13')](_0x3585b0);}logger[_0x5a79('0x16')](_0x5a79('0x17'));return _0x233d89['status'](0xc8)[_0x5a79('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x5a79('0x18')]=function(_0x1cdac1,_0x5729cc){return git['reset']([_0x5a79('0x19'),_0x5a79('0x1a')],function(_0x240d0e){if(_0x240d0e){logger[_0x5a79('0x1b')](_0x240d0e);return _0x5729cc['status'](0x1f4)['json'](_0x240d0e);}logger[_0x5a79('0x16')](_0x5a79('0x1c'));return _0x5729cc[_0x5a79('0x14')](0xc8)[_0x5a79('0x13')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x39e618,_0x113e34){exec('npm\x20install\x20--production',function(_0x352f84,_0x56ed7e,_0xe628d4){logger['info'](_0x56ed7e);logger[_0x5a79('0x16')](_0xe628d4);if(_0x352f84){logger[_0x5a79('0x1b')](_0x352f84);return _0x113e34[_0x5a79('0x14')](0x1f4)[_0x5a79('0x13')](_0x352f84);}return _0x113e34[_0x5a79('0x14')](0xc8)[_0x5a79('0x13')]({'output':_0x56ed7e});});};exports[_0x5a79('0x1d')]=function(_0x3ec93b,_0x2289e4){return pm2[_0x5a79('0x1d')](_0x5a79('0x1e'))['then'](function(_0x44ba40){logger[_0x5a79('0x16')](_0x5a79('0x1f'),_0x44ba40);return _0x2289e4[_0x5a79('0x14')](0xc8)[_0x5a79('0x13')]({'output':_0x5a79('0x20')});})['catch'](function(_0x1fb27e){logger[_0x5a79('0x1b')](_0x1fb27e);return _0x2289e4['status'](0x1f4)[_0x5a79('0x13')](_0x1fb27e);});};exports['migrations']=function(_0x85f15a,_0xf039f6){var _0x2f0472=fs[_0x5a79('0x21')](path[_0x5a79('0x22')](config['root'],_0x5a79('0x23'),_0x5a79('0x24')));var _0x80428b=[];for(var _0x32ace0=0x0;_0x32ace0<_0x2f0472['length'];_0x32ace0++){var _0x56dc0b=_0x2f0472[_0x32ace0][_0x5a79('0x25')](_0x5a79('0x26'),'');if(compareVersions(module[_0x5a79('0xd')][_0x5a79('0x3')],_0x56dc0b)===-0x1){_0x80428b['push'](_0x56dc0b);}}if(_0x80428b[_0x5a79('0x27')]){var _0x12ff0f=_0x80428b[_0x5a79('0x28')](compareVersions);var _0xa86bbd=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x5a79('0x29'),'columnName':'version'},'migrations':{'params':[db[_0x5a79('0x2a')]['getQueryInterface'](),db[_0x5a79('0x2a')][_0x5a79('0x2b')],function(){throw new Error(_0x5a79('0x2c'));}],'path':path[_0x5a79('0x22')](config[_0x5a79('0xc')],'server',_0x5a79('0x24')),'pattern':/\.js$/}});_0xa86bbd['up']({'migrations':_[_0x5a79('0x2d')](_0x12ff0f,function(_0x3516df){return _0x3516df+_0x5a79('0x26');})})['then'](function(){return _0xf039f6[_0x5a79('0x14')](0xc8)[_0x5a79('0x13')]({'output':_0x5a79('0x2e')+module[_0x5a79('0xd')][_0x5a79('0x3')]+_0x5a79('0x2f')+_[_0x5a79('0x30')](_0x12ff0f),'migrations':_['join'](_0x12ff0f)});})[_0x5a79('0x31')](function(_0x104412){if(_0x104412 instanceof db[_0x5a79('0x2a')][_0x5a79('0x32')]){return _0xf039f6[_0x5a79('0x14')](0xc8)[_0x5a79('0x13')]({'output':_0x5a79('0x33')});}else{return _0xf039f6[_0x5a79('0x14')](0x1f4)['json'](_0x104412);}});}else{return _0xf039f6['status'](0xc8)[_0x5a79('0x13')]({'output':_0x5a79('0x33')});}}; \ No newline at end of file +var _0xb8da=['Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','child_process','../../config/pm2','../../config/logger','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','catch','migrations','root','server','length','replace','.js','push','sort','sequelize'];(function(_0x61ed0b,_0x596886){var _0x51f582=function(_0x19ee4b){while(--_0x19ee4b){_0x61ed0b['push'](_0x61ed0b['shift']());}};_0x51f582(++_0x596886);}(_0xb8da,0xd7));var _0xab8d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb8da[_0x2c91e9];return _0x13f0ff;};'use strict';var Umzug=require(_0xab8d('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xab8d('0x1'))(module,_0xab8d('0x2'));var compareVersions=require(_0xab8d('0x3'));var exec=require(_0xab8d('0x4'))['exec'];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xab8d('0x5'));var logger=require(_0xab8d('0x6'))('update');var git=require(_0xab8d('0x7'))(config['root']);exports[_0xab8d('0x8')]=function(_0x50e3b7,_0x2a25f8){var _0x2c22a2={'current':module[_0xab8d('0x9')][_0xab8d('0x2')],'phonebar':0x2};if(_0x50e3b7[_0xab8d('0xa')]&&_0x50e3b7[_0xab8d('0xa')][_0xab8d('0xb')]){return git[_0xab8d('0xc')]()[_0xab8d('0xd')](function(_0xba89e4,_0x5efccf){_0x2c22a2[_0xab8d('0xb')]=(_0xba89e4?module[_0xab8d('0x9')][_0xab8d('0x2')]:_0x5efccf[_0xab8d('0xb')])||_0xab8d('0xe');return _0x2a25f8[_0xab8d('0xf')](0xc8)[_0xab8d('0x10')](_0x2c22a2);});}else{return _0x2a25f8['status'](0xc8)['json'](_0x2c22a2);}};exports[_0xab8d('0xc')]=function(_0x168e3d,_0x11513e){return git[_0xab8d('0xc')]([_0xab8d('0x11'),_0xab8d('0x12')],function(_0x41a4a6){if(_0x41a4a6){logger[_0xab8d('0x13')](_0x41a4a6);return _0x11513e[_0xab8d('0xf')](0x1f4)[_0xab8d('0x10')](_0x41a4a6);}logger['info'](_0xab8d('0x14'));return _0x11513e[_0xab8d('0xf')](0xc8)[_0xab8d('0x10')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xab8d('0x15')]=function(_0x554a0e,_0x49f34e){return git['reset']([_0xab8d('0x16'),_0xab8d('0x17')],function(_0x3e1d5a){if(_0x3e1d5a){logger[_0xab8d('0x13')](_0x3e1d5a);return _0x49f34e[_0xab8d('0xf')](0x1f4)[_0xab8d('0x10')](_0x3e1d5a);}logger[_0xab8d('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x49f34e[_0xab8d('0xf')](0xc8)[_0xab8d('0x10')]({'output':'git\x20reset\x20--hard'});});};exports[_0xab8d('0x19')]=function(_0x5abe9d,_0x33bcba){exec(_0xab8d('0x1a'),function(_0x5d6452,_0xd2bc3e,_0xc5d0e3){logger['info'](_0xd2bc3e);logger[_0xab8d('0x18')](_0xc5d0e3);if(_0x5d6452){logger[_0xab8d('0x13')](_0x5d6452);return _0x33bcba[_0xab8d('0xf')](0x1f4)[_0xab8d('0x10')](_0x5d6452);}return _0x33bcba[_0xab8d('0xf')](0xc8)['json']({'output':_0xd2bc3e});});};exports[_0xab8d('0x1b')]=function(_0x3417b5,_0x59c528){return pm2[_0xab8d('0x1b')](_0xab8d('0x1c'))['then'](function(_0x31c687){logger[_0xab8d('0x18')](_0xab8d('0x1d'),_0x31c687);return _0x59c528[_0xab8d('0xf')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xab8d('0x1e')](function(_0x278920){logger[_0xab8d('0x13')](_0x278920);return _0x59c528['status'](0x1f4)[_0xab8d('0x10')](_0x278920);});};exports[_0xab8d('0x1f')]=function(_0x495e09,_0x7a5c2b){var _0x498c8d=fs['readdirSync'](path['join'](config[_0xab8d('0x20')],_0xab8d('0x21'),'migrations'));var _0xddf291=[];for(var _0x2d76a5=0x0;_0x2d76a5<_0x498c8d[_0xab8d('0x22')];_0x2d76a5++){var _0x894157=_0x498c8d[_0x2d76a5][_0xab8d('0x23')](_0xab8d('0x24'),'');if(compareVersions(module['exports'][_0xab8d('0x2')],_0x894157)===-0x1){_0xddf291[_0xab8d('0x25')](_0x894157);}}if(_0xddf291['length']){var _0x68d2b2=_0xddf291[_0xab8d('0x26')](compareVersions);var _0x53b2e9=new Umzug({'storage':_0xab8d('0x27'),'storageOptions':{'model':db['Migration'],'modelName':_0xab8d('0x28'),'columnName':_0xab8d('0x2')},'migrations':{'params':[db[_0xab8d('0x27')][_0xab8d('0x29')](),db[_0xab8d('0x27')][_0xab8d('0x2a')],function(){throw new Error(_0xab8d('0x2b'));}],'path':path['join'](config[_0xab8d('0x20')],_0xab8d('0x21'),_0xab8d('0x1f')),'pattern':/\.js$/}});_0x53b2e9['up']({'migrations':_['map'](_0x68d2b2,function(_0x5cbec4){return _0x5cbec4+'.js';})})[_0xab8d('0x2c')](function(){return _0x7a5c2b[_0xab8d('0xf')](0xc8)['json']({'output':_0xab8d('0x2d')+module[_0xab8d('0x9')][_0xab8d('0x2')]+_0xab8d('0x2e')+_[_0xab8d('0x2f')](_0x68d2b2),'migrations':_[_0xab8d('0x30')](_0x68d2b2)});})['catch'](function(_0x11da1a){if(_0x11da1a instanceof db[_0xab8d('0x27')][_0xab8d('0x31')]){return _0x7a5c2b[_0xab8d('0xf')](0xc8)['json']({'output':_0xab8d('0x32')});}else{return _0x7a5c2b[_0xab8d('0xf')](0x1f4)['json'](_0x11da1a);}});}else{return _0x7a5c2b['status'](0xc8)[_0xab8d('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 169bb21..ac2637d 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 _0x43ef=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','post','create','/:id','update','delete','destroy'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x43ef,0x98));var _0xf43e=function(_0x37df58,_0xb7237){_0x37df58=_0x37df58-0x0;var _0x415538=_0x43ef[_0x37df58];return _0x415538;};'use strict';var multer=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var path=require(_0xf43e('0x2'));var timeout=require(_0xf43e('0x3'));var express=require('express');var router=express[_0xf43e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf43e('0x5'));var interaction=require(_0xf43e('0x6'));var config=require(_0xf43e('0x7'));var controller=require(_0xf43e('0x8'));router[_0xf43e('0x9')]('/',auth[_0xf43e('0xa')](),controller[_0xf43e('0xb')]);router[_0xf43e('0x9')](_0xf43e('0xc'),auth[_0xf43e('0xa')](),controller['describe']);router[_0xf43e('0x9')]('/:id',auth[_0xf43e('0xa')](),controller['show']);router[_0xf43e('0xd')]('/',auth[_0xf43e('0xa')](),controller[_0xf43e('0xe')]);router['put'](_0xf43e('0xf'),auth['isAuthenticated'](),controller[_0xf43e('0x10')]);router[_0xf43e('0x11')](_0xf43e('0xf'),auth['isAuthenticated'](),controller[_0xf43e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9ba8=['exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','update','delete'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x9ba8,0x1e1));var _0x89ba=function(_0x21dc70,_0x287214){_0x21dc70=_0x21dc70-0x0;var _0x47e638=_0x9ba8[_0x21dc70];return _0x47e638;};'use strict';var multer=require('multer');var util=require(_0x89ba('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x89ba('0x1'));var router=express['Router']();var fs_extra=require(_0x89ba('0x2'));var auth=require(_0x89ba('0x3'));var interaction=require(_0x89ba('0x4'));var config=require(_0x89ba('0x5'));var controller=require(_0x89ba('0x6'));router[_0x89ba('0x7')]('/',auth[_0x89ba('0x8')](),controller[_0x89ba('0x9')]);router[_0x89ba('0x7')](_0x89ba('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x89ba('0x7')](_0x89ba('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x89ba('0x8')](),controller['create']);router['put'](_0x89ba('0xb'),auth[_0x89ba('0x8')](),controller[_0x89ba('0xc')]);router[_0x89ba('0xd')](_0x89ba('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x89ba('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index dec7362..7f5398b 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 _0xd4a2=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xd4a2,0x173));var _0x2d4a=function(_0x56e336,_0x16b438){_0x56e336=_0x56e336-0x0;var _0x172a06=_0xd4a2[_0x56e336];return _0x172a06;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2d4a('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2d4a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentconnectAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentdumpAt':{'type':Sequelize[_0x2d4a('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2d4a('0x4')]},'agentacw':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2d4a('0x4')]},'reason':{'type':Sequelize[_0x2d4a('0x1')]},'lastevent':{'type':Sequelize[_0x2d4a('0x1')]},'channel':{'type':Sequelize[_0x2d4a('0x1')]},'channelstate':{'type':Sequelize[_0x2d4a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2d4a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2d4a('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2d4a('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2d4a('0x1')]},'priority':{'type':Sequelize[_0x2d4a('0x1')]},'destchannel':{'type':Sequelize[_0x2d4a('0x1')]},'destchannelstate':{'type':Sequelize[_0x2d4a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2d4a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2d4a('0x1')]},'destcalleridname':{'type':Sequelize[_0x2d4a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2d4a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2d4a('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2d4a('0x1')]},'destpriority':{'type':Sequelize[_0x2d4a('0x1')]},'destuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2d4a('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'agententerreason':{'type':Sequelize[_0x2d4a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4a2=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd4a2,0x173));var _0x2d4a=function(_0x35d182,_0x11360e){_0x35d182=_0x35d182-0x0;var _0x4604aa=_0xd4a2[_0x35d182];return _0x4604aa;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2d4a('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2d4a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentconnectAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentdumpAt':{'type':Sequelize[_0x2d4a('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2d4a('0x4')]},'agentacw':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2d4a('0x4')]},'reason':{'type':Sequelize[_0x2d4a('0x1')]},'lastevent':{'type':Sequelize[_0x2d4a('0x1')]},'channel':{'type':Sequelize[_0x2d4a('0x1')]},'channelstate':{'type':Sequelize[_0x2d4a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2d4a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2d4a('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2d4a('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2d4a('0x1')]},'priority':{'type':Sequelize[_0x2d4a('0x1')]},'destchannel':{'type':Sequelize[_0x2d4a('0x1')]},'destchannelstate':{'type':Sequelize[_0x2d4a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2d4a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2d4a('0x1')]},'destcalleridname':{'type':Sequelize[_0x2d4a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2d4a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2d4a('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2d4a('0x1')]},'destpriority':{'type':Sequelize[_0x2d4a('0x1')]},'destuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2d4a('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'agententerreason':{'type':Sequelize[_0x2d4a('0x4')],'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 a5606bd..3bdd485 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(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 9b1e52d..86bd693 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 _0x47c7=['api','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x47c7,0x1ab));var _0x747c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x47c7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x747c('0x0'));var util=require('util');var logger=require(_0x747c('0x1'))(_0x747c('0x2'));var moment=require('moment');var BPromise=require(_0x747c('0x3'));var rp=require(_0x747c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x747c('0x5'));var config=require(_0x747c('0x6'));var attributes=require(_0x747c('0x7'));module[_0x747c('0x8')]=function(_0x5e991e,_0xa1148a){return _0x5e991e['define'](_0x747c('0x9'),attributes,{'tableName':_0x747c('0xa'),'paranoid':![],'indexes':[{'fields':[_0x747c('0xb'),_0x747c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc23a=['util','../../config/logger','api','bluebird','rimraf','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid'];(function(_0x1488ee,_0x3010a5){var _0x36f42a=function(_0x2afa44){while(--_0x2afa44){_0x1488ee['push'](_0x1488ee['shift']());}};_0x36f42a(++_0x3010a5);}(_0xc23a,0xd2));var _0xac23=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xc23a[_0xc8a931];return _0x28bd27;};'use strict';var _=require('lodash');var util=require(_0xac23('0x0'));var logger=require(_0xac23('0x1'))(_0xac23('0x2'));var moment=require('moment');var BPromise=require(_0xac23('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac23('0x4'));var config=require('../../config/environment');var attributes=require(_0xac23('0x5'));module[_0xac23('0x6')]=function(_0xc71a6d,_0x4c1482){return _0xc71a6d['define'](_0xac23('0x7'),attributes,{'tableName':_0xac23('0x8'),'paranoid':![],'indexes':[{'fields':[_0xac23('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d25544c..fa9975a 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 _0xedd7=['message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','body','where','attributes','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x357e20,_0x3ee791){var _0x57190c=function(_0x18da21){while(--_0x18da21){_0x357e20['push'](_0x357e20['shift']());}};_0x57190c(++_0x3ee791);}(_0xedd7,0x142));var _0x7edd=function(_0x5bb736,_0x32c198){_0x5bb736=_0x5bb736-0x0;var _0x483aad=_0xedd7[_0x5bb736];return _0x483aad;};'use strict';var _=require('lodash');var util=require(_0x7edd('0x0'));var moment=require('moment');var BPromise=require(_0x7edd('0x1'));var rs=require(_0x7edd('0x2'));var fs=require('fs');var Redis=require(_0x7edd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7edd('0x4'));var logger=require(_0x7edd('0x5'))(_0x7edd('0x6'));var config=require(_0x7edd('0x7'));var jayson=require(_0x7edd('0x8'));var client=jayson[_0x7edd('0x9')][_0x7edd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52123d,_0x297318,_0x4d7d02){return new BPromise(function(_0x54a59a,_0x1122ae){return client['request'](_0x52123d,_0x4d7d02)[_0x7edd('0xb')](function(_0x38e0c6){logger[_0x7edd('0xc')](_0x7edd('0xd'),_0x297318,_0x7edd('0xe'));logger[_0x7edd('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x297318,_0x7edd('0xe'),JSON[_0x7edd('0x10')](_0x38e0c6));if(_0x38e0c6[_0x7edd('0x11')]){if(_0x38e0c6[_0x7edd('0x11')][_0x7edd('0x12')]===0x1f4){logger[_0x7edd('0x11')](_0x7edd('0xd'),_0x297318,_0x38e0c6['error'][_0x7edd('0x13')]);return _0x1122ae(_0x38e0c6['error'][_0x7edd('0x13')]);}logger[_0x7edd('0x11')](_0x7edd('0xd'),_0x297318,_0x38e0c6[_0x7edd('0x11')][_0x7edd('0x13')]);return _0x54a59a(_0x38e0c6['error'][_0x7edd('0x13')]);}else{logger[_0x7edd('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x297318,_0x7edd('0xe'));_0x54a59a(_0x38e0c6[_0x7edd('0x14')]['message']);}})[_0x7edd('0x15')](function(_0x51a72b){logger[_0x7edd('0x11')](_0x7edd('0xd'),_0x297318,_0x51a72b);_0x1122ae(_0x51a72b);});});}exports[_0x7edd('0x16')]=function(_0x481d4a){var _0xf179e2=this;return new Promise(function(_0x51e361,_0x100cbe){return db[_0x7edd('0x17')][_0x7edd('0x18')](_0x481d4a['body'],{'raw':_0x481d4a[_0x7edd('0x19')]?_0x481d4a[_0x7edd('0x19')][_0x7edd('0x1a')]===undefined?!![]:![]:!![]})[_0x7edd('0xb')](function(_0x30e41e){logger[_0x7edd('0xc')](_0x7edd('0x16'),_0x481d4a);logger[_0x7edd('0xf')](_0x7edd('0x16'),_0x481d4a,JSON['stringify'](_0x30e41e));_0x51e361(_0x30e41e);})[_0x7edd('0x15')](function(_0x2dafdb){logger[_0x7edd('0x11')]('CreateVoiceAgentReport',_0x2dafdb[_0x7edd('0x13')],_0x481d4a);_0x100cbe(_0xf179e2[_0x7edd('0x11')](0x1f4,_0x2dafdb[_0x7edd('0x13')]));});});};exports[_0x7edd('0x1b')]=function(_0x336507){var _0x3b4379=this;return new Promise(function(_0x1cfdd3,_0x2c1ce4){return db[_0x7edd('0x17')]['update'](_0x336507[_0x7edd('0x1c')],{'raw':_0x336507[_0x7edd('0x19')]?_0x336507[_0x7edd('0x19')][_0x7edd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x336507[_0x7edd('0x19')]?_0x336507[_0x7edd('0x19')][_0x7edd('0x1d')]||null:null,'attributes':_0x336507['options']?_0x336507['options'][_0x7edd('0x1e')]||null:null,'limit':_0x336507[_0x7edd('0x19')]?_0x336507[_0x7edd('0x19')]['limit']||null:null})['then'](function(_0x3b018e){logger[_0x7edd('0xc')](_0x7edd('0x1b'),_0x336507);logger[_0x7edd('0xf')](_0x7edd('0x1b'),_0x336507,JSON[_0x7edd('0x10')](_0x3b018e));_0x1cfdd3(_0x3b018e);})[_0x7edd('0x15')](function(_0x97f704){logger['error'](_0x7edd('0x1b'),_0x97f704[_0x7edd('0x13')],_0x336507);_0x2c1ce4(_0x3b4379[_0x7edd('0x11')](0x1f4,_0x97f704[_0x7edd('0x13')]));});});}; \ No newline at end of file +var _0xa1eb=['rpc','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','UpdateVoiceAgentReport','raw','where','attributes','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x189cf2,_0x41e8f5){var _0x271945=function(_0xd9510b){while(--_0xd9510b){_0x189cf2['push'](_0x189cf2['shift']());}};_0x271945(++_0x41e8f5);}(_0xa1eb,0x1ba));var _0xba1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba1e('0x0'));var util=require(_0xba1e('0x1'));var moment=require(_0xba1e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba1e('0x4'));var logger=require(_0xba1e('0x5'))(_0xba1e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xba1e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dfbfd,_0x1e0627,_0xbe82a1){return new BPromise(function(_0x32e975,_0x34a07a){return client[_0xba1e('0x8')](_0x1dfbfd,_0xbe82a1)[_0xba1e('0x9')](function(_0x27173b){logger[_0xba1e('0xa')](_0xba1e('0xb'),_0x1e0627,_0xba1e('0xc'));logger[_0xba1e('0xd')](_0xba1e('0xe'),_0x1e0627,_0xba1e('0xc'),JSON[_0xba1e('0xf')](_0x27173b));if(_0x27173b['error']){if(_0x27173b[_0xba1e('0x10')]['code']===0x1f4){logger[_0xba1e('0x10')](_0xba1e('0xb'),_0x1e0627,_0x27173b[_0xba1e('0x10')][_0xba1e('0x11')]);return _0x34a07a(_0x27173b[_0xba1e('0x10')][_0xba1e('0x11')]);}logger[_0xba1e('0x10')](_0xba1e('0xb'),_0x1e0627,_0x27173b[_0xba1e('0x10')][_0xba1e('0x11')]);return _0x32e975(_0x27173b['error'][_0xba1e('0x11')]);}else{logger[_0xba1e('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x1e0627,_0xba1e('0xc'));_0x32e975(_0x27173b['result']['message']);}})[_0xba1e('0x12')](function(_0x292e0a){logger[_0xba1e('0x10')](_0xba1e('0xb'),_0x1e0627,_0x292e0a);_0x34a07a(_0x292e0a);});});}exports[_0xba1e('0x13')]=function(_0x2b0fd7){var _0x36e2a6=this;return new Promise(function(_0x567188,_0x560fce){return db[_0xba1e('0x14')]['create'](_0x2b0fd7[_0xba1e('0x15')],{'raw':_0x2b0fd7[_0xba1e('0x16')]?_0x2b0fd7[_0xba1e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xba1e('0x9')](function(_0x59739f){logger[_0xba1e('0xa')](_0xba1e('0x13'),_0x2b0fd7);logger[_0xba1e('0xd')](_0xba1e('0x13'),_0x2b0fd7,JSON[_0xba1e('0xf')](_0x59739f));_0x567188(_0x59739f);})[_0xba1e('0x12')](function(_0x38d19a){logger['error'](_0xba1e('0x13'),_0x38d19a[_0xba1e('0x11')],_0x2b0fd7);_0x560fce(_0x36e2a6[_0xba1e('0x10')](0x1f4,_0x38d19a['message']));});});};exports[_0xba1e('0x17')]=function(_0x55141e){var _0x5a709=this;return new Promise(function(_0xf0794d,_0x408dcc){return db[_0xba1e('0x14')]['update'](_0x55141e[_0xba1e('0x15')],{'raw':_0x55141e['options']?_0x55141e['options'][_0xba1e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55141e[_0xba1e('0x16')]?_0x55141e['options'][_0xba1e('0x19')]||null:null,'attributes':_0x55141e['options']?_0x55141e[_0xba1e('0x16')][_0xba1e('0x1a')]||null:null,'limit':_0x55141e[_0xba1e('0x16')]?_0x55141e[_0xba1e('0x16')][_0xba1e('0x1b')]||null:null})[_0xba1e('0x9')](function(_0x1374c1){logger[_0xba1e('0xa')](_0xba1e('0x17'),_0x55141e);logger[_0xba1e('0xd')]('UpdateVoiceAgentReport',_0x55141e,JSON[_0xba1e('0xf')](_0x1374c1));_0xf0794d(_0x1374c1);})[_0xba1e('0x12')](function(_0xb99c4){logger[_0xba1e('0x10')]('UpdateVoiceAgentReport',_0xb99c4[_0xba1e('0x11')],_0x55141e);_0x408dcc(_0x5a709[_0xba1e('0x10')](0x1f4,_0xb99c4[_0xba1e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3686648..c7305d8 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 _0x7217=['../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x7217,0x19e));var _0x7721=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x7217[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','post','create','put','update','delete','exports','multer','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6aa7,0x178));var _0x76aa=function(_0x37e961,_0x4e8da0){_0x37e961=_0x37e961-0x0;var _0x2c518c=_0x6aa7[_0x37e961];return _0x2c518c;};'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('./voiceCallReport.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('0xc')]('/',auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0xe')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x10')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['destroy']);module[_0x76aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c67fa7e..3fa073a 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 _0xfdad=['STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','outbound','inbound-fax','outbound-fax'];(function(_0x6162d5,_0x39fc62){var _0x4f36e4=function(_0x108643){while(--_0x108643){_0x6162d5['push'](_0x6162d5['shift']());}};_0x4f36e4(++_0x39fc62);}(_0xfdad,0x164));var _0xdfda=function(_0x4387c2,_0x2b8a24){_0x4387c2=_0x4387c2-0x0;var _0x55a9f4=_0xfdad[_0x4387c2];return _0x55a9f4;};'use strict';var Sequelize=require(_0xdfda('0x0'));module[_0xdfda('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdfda('0x2')](_0xdfda('0x3'),'internal',_0xdfda('0x4'),_0xdfda('0x5'),_0xdfda('0x6'),'dialer')},'tag':{'type':Sequelize[_0xdfda('0x7')]},'accountcode':{'type':Sequelize[_0xdfda('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xdfda('0x7')]},'destinationcontext':{'type':Sequelize[_0xdfda('0x7')]},'callerid':{'type':Sequelize[_0xdfda('0x7')]},'channel':{'type':Sequelize[_0xdfda('0x7')]},'destinationchannel':{'type':Sequelize[_0xdfda('0x7')]},'lastapplication':{'type':Sequelize[_0xdfda('0x7')]},'lastdata':{'type':Sequelize[_0xdfda('0x8')]},'starttime':{'type':Sequelize[_0xdfda('0x9')]},'systemanswertime':{'type':Sequelize[_0xdfda('0x9')]},'answertime':{'type':Sequelize[_0xdfda('0x9')]},'endtime':{'type':Sequelize[_0xdfda('0x9')]},'duration':{'type':Sequelize[_0xdfda('0xa')]},'billableseconds':{'type':Sequelize[_0xdfda('0xa')]},'mohtime':{'type':Sequelize[_0xdfda('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdfda('0x7')]},'amaflags':{'type':Sequelize[_0xdfda('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xdfda('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xdfda('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xdfda('0x7')]},'note':{'type':Sequelize[_0xdfda('0x7')]},'prefix':{'type':Sequelize[_0xdfda('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xdfda('0x7')]}}; \ No newline at end of file +var _0xa4ad=['ENUM','inbound','internal','outbound','inbound-fax','TEXT','DATE','INTEGER','sequelize','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa4ad,0x80));var _0xda4a=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0xa4ad[_0x30abff];return _0x4c571e;};'use strict';var Sequelize=require(_0xda4a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xda4a('0x1')]},'type':{'type':Sequelize[_0xda4a('0x2')](_0xda4a('0x3'),_0xda4a('0x4'),_0xda4a('0x5'),_0xda4a('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xda4a('0x1')]},'accountcode':{'type':Sequelize[_0xda4a('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xda4a('0x1')]},'callerid':{'type':Sequelize[_0xda4a('0x1')]},'channel':{'type':Sequelize[_0xda4a('0x1')]},'destinationchannel':{'type':Sequelize[_0xda4a('0x1')]},'lastapplication':{'type':Sequelize[_0xda4a('0x1')]},'lastdata':{'type':Sequelize[_0xda4a('0x7')]},'starttime':{'type':Sequelize[_0xda4a('0x8')]},'systemanswertime':{'type':Sequelize[_0xda4a('0x8')]},'answertime':{'type':Sequelize[_0xda4a('0x8')]},'endtime':{'type':Sequelize[_0xda4a('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xda4a('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xda4a('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xda4a('0x1')]},'userDisposition':{'type':Sequelize[_0xda4a('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xda4a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xda4a('0x1')]},'note':{'type':Sequelize[_0xda4a('0x1')]},'prefix':{'type':Sequelize[_0xda4a('0x1')]},'routeid':{'type':Sequelize[_0xda4a('0x9')]},'sipcallid':{'type':Sequelize[_0xda4a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2e24a60..8d10287 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xadb5,0xad));var _0x5adb=function(_0xd9edf3,_0x5a72d5){_0xd9edf3=_0xd9edf3-0x0;var _0x3e9113=_0xadb5[_0xd9edf3];return _0x3e9113;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x399f68,_0x598a83){var _0x12ba5c=function(_0x2bfb9e){while(--_0x2bfb9e){_0x399f68['push'](_0x399f68['shift']());}};_0x12ba5c(++_0x598a83);}(_0xb10b,0x12a));var _0xbb10=function(_0x332d5c,_0x4a2336){_0x332d5c=_0x332d5c-0x0;var _0x47448d=_0xb10b[_0x332d5c];return _0x47448d;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 88991e7..9bc3423 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 _0x9db3=['rimraf','./voiceCallReport.attributes','define','report_call','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xd797b2,_0x5cb24b){var _0x355acb=function(_0x509298){while(--_0x509298){_0xd797b2['push'](_0xd797b2['shift']());}};_0x355acb(++_0x5cb24b);}(_0x9db3,0xe0));var _0x39db=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x9db3[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0x39db('0x0'));var logger=require(_0x39db('0x1'))(_0x39db('0x2'));var moment=require(_0x39db('0x3'));var BPromise=require(_0x39db('0x4'));var rp=require(_0x39db('0x5'));var fs=require('fs');var path=require(_0x39db('0x6'));var rimraf=require(_0x39db('0x7'));var config=require('../../config/environment');var attributes=require(_0x39db('0x8'));module['exports']=function(_0x5b5340,_0x514087){return _0x5b5340[_0x39db('0x9')]('VoiceCallReport',attributes,{'tableName':_0x39db('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe15a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','VoiceCallReport','report_call','uniqueid'];(function(_0x2bec07,_0x1056c1){var _0x1dc901=function(_0x495277){while(--_0x495277){_0x2bec07['push'](_0x2bec07['shift']());}};_0x1dc901(++_0x1056c1);}(_0xe15a,0x180));var _0xae15=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xe15a[_0x1347f8];return _0x218368;};'use strict';var _=require(_0xae15('0x0'));var util=require(_0xae15('0x1'));var logger=require(_0xae15('0x2'))(_0xae15('0x3'));var moment=require(_0xae15('0x4'));var BPromise=require(_0xae15('0x5'));var rp=require(_0xae15('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae15('0x7'));var config=require(_0xae15('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x3be291,_0x24a679){return _0x3be291['define'](_0xae15('0x9'),attributes,{'tableName':_0xae15('0xa'),'paranoid':![],'indexes':[{'fields':[_0xae15('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 35c63af..b85b242 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 _0xe963=['http','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4ca376,_0x50d3e7){var _0x358ae5=function(_0x5e2dda){while(--_0x5e2dda){_0x4ca376['push'](_0x4ca376['shift']());}};_0x358ae5(++_0x50d3e7);}(_0xe963,0xfa));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3e96('0x0'));var moment=require(_0x3e96('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e96('0x2'));var db=require(_0x3e96('0x3'))['db'];var utils=require(_0x3e96('0x4'));var logger=require(_0x3e96('0x5'))(_0x3e96('0x6'));var config=require(_0x3e96('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e96('0x8')][_0x3e96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40c61f,_0x20923c,_0x4536fa){return new BPromise(function(_0x37bd3c,_0x11cf2a){return client['request'](_0x40c61f,_0x4536fa)[_0x3e96('0xa')](function(_0x307f28){logger[_0x3e96('0xb')](_0x3e96('0xc'),_0x20923c,'request\x20sent');logger[_0x3e96('0xd')](_0x3e96('0xe'),_0x20923c,'request\x20sent',JSON[_0x3e96('0xf')](_0x307f28));if(_0x307f28[_0x3e96('0x10')]){if(_0x307f28['error'][_0x3e96('0x11')]===0x1f4){logger[_0x3e96('0x10')](_0x3e96('0xc'),_0x20923c,_0x307f28[_0x3e96('0x10')][_0x3e96('0x12')]);return _0x11cf2a(_0x307f28['error'][_0x3e96('0x12')]);}logger[_0x3e96('0x10')](_0x3e96('0xc'),_0x20923c,_0x307f28[_0x3e96('0x10')][_0x3e96('0x12')]);return _0x37bd3c(_0x307f28[_0x3e96('0x10')][_0x3e96('0x12')]);}else{logger[_0x3e96('0xb')](_0x3e96('0xc'),_0x20923c,'request\x20sent');_0x37bd3c(_0x307f28[_0x3e96('0x13')][_0x3e96('0x12')]);}})[_0x3e96('0x14')](function(_0x401dbc){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x20923c,_0x401dbc);_0x11cf2a(_0x401dbc);});});}exports[_0x3e96('0x15')]=function(_0x2bcf71){var _0x157b67=this;return new Promise(function(_0x591c59,_0x51b675){return db[_0x3e96('0x16')][_0x3e96('0x17')]({'raw':_0x2bcf71['options']?_0x2bcf71['options']['raw']===undefined?!![]:![]:!![],'where':_0x2bcf71[_0x3e96('0x18')]?_0x2bcf71['options'][_0x3e96('0x19')]||null:null,'attributes':_0x2bcf71[_0x3e96('0x18')]?_0x2bcf71['options'][_0x3e96('0x1a')]||null:null,'limit':_0x2bcf71[_0x3e96('0x18')]?_0x2bcf71[_0x3e96('0x18')][_0x3e96('0x1b')]||null:null,'include':_0x2bcf71[_0x3e96('0x18')]?_0x2bcf71[_0x3e96('0x18')][_0x3e96('0x1c')]?_[_0x3e96('0x1d')](_0x2bcf71[_0x3e96('0x18')]['include'],function(_0x2d283a){return{'model':db[_0x2d283a[_0x3e96('0x1e')]],'as':_0x2d283a['as'],'attributes':_0x2d283a[_0x3e96('0x1a')],'include':_0x2d283a[_0x3e96('0x1c')]?_[_0x3e96('0x1d')](_0x2d283a[_0x3e96('0x1c')],function(_0x2657fc){return{'model':db[_0x2657fc['model']],'as':_0x2657fc['as'],'attributes':_0x2657fc[_0x3e96('0x1a')],'include':_0x2657fc[_0x3e96('0x1c')]?_[_0x3e96('0x1d')](_0x2657fc[_0x3e96('0x1c')],function(_0x3c1fcd){return{'model':db[_0x3c1fcd[_0x3e96('0x1e')]],'as':_0x3c1fcd['as'],'attributes':_0x3c1fcd[_0x3e96('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3e96('0xa')](function(_0x190898){logger[_0x3e96('0xb')](_0x3e96('0x15'),_0x2bcf71);logger[_0x3e96('0xd')](_0x3e96('0x15'),_0x2bcf71,JSON['stringify'](_0x190898));_0x591c59(_0x190898);})[_0x3e96('0x14')](function(_0x5317a7){logger[_0x3e96('0x10')](_0x3e96('0x15'),_0x5317a7[_0x3e96('0x12')],_0x2bcf71);_0x51b675(_0x157b67[_0x3e96('0x10')](0x1f4,_0x5317a7['message']));});});};exports['CreateVoiceCallReport']=function(_0x52fc21){var _0x47937d=this;return new Promise(function(_0x373f94,_0x58d9ea){return db[_0x3e96('0x16')][_0x3e96('0x1f')](_0x52fc21[_0x3e96('0x20')],{'raw':_0x52fc21['options']?_0x52fc21[_0x3e96('0x18')][_0x3e96('0x21')]===undefined?!![]:![]:!![]})[_0x3e96('0xa')](function(_0x482447){logger[_0x3e96('0xb')]('CreateVoiceCallReport',_0x52fc21);logger[_0x3e96('0xd')](_0x3e96('0x22'),_0x52fc21,JSON[_0x3e96('0xf')](_0x482447));_0x373f94(_0x482447);})[_0x3e96('0x14')](function(_0x1c8525){logger[_0x3e96('0x10')](_0x3e96('0x22'),_0x1c8525[_0x3e96('0x12')],_0x52fc21);_0x58d9ea(_0x47937d[_0x3e96('0x10')](0x1f4,_0x1c8525[_0x3e96('0x12')]));});});};exports[_0x3e96('0x23')]=function(_0x13d887){var _0x547b58=this;return new Promise(function(_0x121893,_0x3c0f89){return db[_0x3e96('0x16')][_0x3e96('0x24')](_0x13d887['body'],{'raw':_0x13d887[_0x3e96('0x18')]?_0x13d887['options'][_0x3e96('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13d887[_0x3e96('0x18')]?_0x13d887[_0x3e96('0x18')][_0x3e96('0x19')]||null:null,'attributes':_0x13d887['options']?_0x13d887[_0x3e96('0x18')][_0x3e96('0x1a')]||null:null,'limit':_0x13d887[_0x3e96('0x18')]?_0x13d887[_0x3e96('0x18')]['limit']||null:null})[_0x3e96('0xa')](function(_0x1457f9){logger['info'](_0x3e96('0x23'),_0x13d887);logger['debug'](_0x3e96('0x23'),_0x13d887,JSON[_0x3e96('0xf')](_0x1457f9));_0x121893(_0x1457f9);})[_0x3e96('0x14')](function(_0x3008c9){logger[_0x3e96('0x10')]('UpdateVoiceCallReport',_0x3008c9['message'],_0x13d887);_0x3c0f89(_0x547b58[_0x3e96('0x10')](0x1f4,_0x3008c9[_0x3e96('0x12')]));});});}; \ No newline at end of file +var _0xd323=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','model','include','map','info','stringify','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','update','util','moment','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd323,0xd5));var _0x3d32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd323[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x3d32('0x0'));var moment=require(_0x3d32('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d32('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d32('0x3'));var config=require(_0x3d32('0x4'));var jayson=require(_0x3d32('0x5'));var client=jayson[_0x3d32('0x6')][_0x3d32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d46d8,_0x161c7f,_0x1f5d4a){return new BPromise(function(_0x58ea4a,_0x514732){return client[_0x3d32('0x8')](_0x5d46d8,_0x1f5d4a)[_0x3d32('0x9')](function(_0x5202b1){logger['info'](_0x3d32('0xa'),_0x161c7f,'request\x20sent');logger[_0x3d32('0xb')](_0x3d32('0xc'),_0x161c7f,'request\x20sent',JSON['stringify'](_0x5202b1));if(_0x5202b1[_0x3d32('0xd')]){if(_0x5202b1[_0x3d32('0xd')][_0x3d32('0xe')]===0x1f4){logger[_0x3d32('0xd')](_0x3d32('0xa'),_0x161c7f,_0x5202b1[_0x3d32('0xd')]['message']);return _0x514732(_0x5202b1[_0x3d32('0xd')]['message']);}logger[_0x3d32('0xd')](_0x3d32('0xa'),_0x161c7f,_0x5202b1['error'][_0x3d32('0xf')]);return _0x58ea4a(_0x5202b1[_0x3d32('0xd')][_0x3d32('0xf')]);}else{logger['info'](_0x3d32('0xa'),_0x161c7f,_0x3d32('0x10'));_0x58ea4a(_0x5202b1[_0x3d32('0x11')][_0x3d32('0xf')]);}})[_0x3d32('0x12')](function(_0x15bbce){logger[_0x3d32('0xd')](_0x3d32('0xa'),_0x161c7f,_0x15bbce);_0x514732(_0x15bbce);});});}exports[_0x3d32('0x13')]=function(_0x209b34){var _0x1acba5=this;return new Promise(function(_0x3fe8e7,_0xae3679){return db[_0x3d32('0x14')][_0x3d32('0x15')]({'raw':_0x209b34[_0x3d32('0x16')]?_0x209b34['options']['raw']===undefined?!![]:![]:!![],'where':_0x209b34[_0x3d32('0x16')]?_0x209b34['options'][_0x3d32('0x17')]||null:null,'attributes':_0x209b34[_0x3d32('0x16')]?_0x209b34['options'][_0x3d32('0x18')]||null:null,'limit':_0x209b34[_0x3d32('0x16')]?_0x209b34[_0x3d32('0x16')][_0x3d32('0x19')]||null:null,'include':_0x209b34['options']?_0x209b34['options']['include']?_['map'](_0x209b34['options']['include'],function(_0x51a2fe){return{'model':db[_0x51a2fe[_0x3d32('0x1a')]],'as':_0x51a2fe['as'],'attributes':_0x51a2fe[_0x3d32('0x18')],'include':_0x51a2fe[_0x3d32('0x1b')]?_['map'](_0x51a2fe[_0x3d32('0x1b')],function(_0x3ada72){return{'model':db[_0x3ada72[_0x3d32('0x1a')]],'as':_0x3ada72['as'],'attributes':_0x3ada72[_0x3d32('0x18')],'include':_0x3ada72[_0x3d32('0x1b')]?_[_0x3d32('0x1c')](_0x3ada72[_0x3d32('0x1b')],function(_0x3f2d2c){return{'model':db[_0x3f2d2c[_0x3d32('0x1a')]],'as':_0x3f2d2c['as'],'attributes':_0x3f2d2c[_0x3d32('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3d32('0x9')](function(_0x1a021f){logger[_0x3d32('0x1d')](_0x3d32('0x13'),_0x209b34);logger['debug']('GetVoiceCallReport',_0x209b34,JSON[_0x3d32('0x1e')](_0x1a021f));_0x3fe8e7(_0x1a021f);})[_0x3d32('0x12')](function(_0x1a4f7f){logger[_0x3d32('0xd')](_0x3d32('0x13'),_0x1a4f7f[_0x3d32('0xf')],_0x209b34);_0xae3679(_0x1acba5[_0x3d32('0xd')](0x1f4,_0x1a4f7f[_0x3d32('0xf')]));});});};exports[_0x3d32('0x1f')]=function(_0x3d119e){var _0x4dda8e=this;return new Promise(function(_0x2d56a5,_0x3757a1){return db[_0x3d32('0x14')]['create'](_0x3d119e[_0x3d32('0x20')],{'raw':_0x3d119e['options']?_0x3d119e[_0x3d32('0x16')][_0x3d32('0x21')]===undefined?!![]:![]:!![]})[_0x3d32('0x9')](function(_0xf0c762){logger['info'](_0x3d32('0x1f'),_0x3d119e);logger[_0x3d32('0xb')](_0x3d32('0x1f'),_0x3d119e,JSON['stringify'](_0xf0c762));_0x2d56a5(_0xf0c762);})[_0x3d32('0x12')](function(_0x5ebc1d){logger['error']('CreateVoiceCallReport',_0x5ebc1d[_0x3d32('0xf')],_0x3d119e);_0x3757a1(_0x4dda8e[_0x3d32('0xd')](0x1f4,_0x5ebc1d['message']));});});};exports[_0x3d32('0x22')]=function(_0x408a93){var _0x25ccfc=this;return new Promise(function(_0x248969,_0x3528e7){return db['VoiceCallReport'][_0x3d32('0x23')](_0x408a93[_0x3d32('0x20')],{'raw':_0x408a93[_0x3d32('0x16')]?_0x408a93[_0x3d32('0x16')][_0x3d32('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408a93[_0x3d32('0x16')]?_0x408a93[_0x3d32('0x16')][_0x3d32('0x17')]||null:null,'attributes':_0x408a93[_0x3d32('0x16')]?_0x408a93[_0x3d32('0x16')][_0x3d32('0x18')]||null:null,'limit':_0x408a93[_0x3d32('0x16')]?_0x408a93[_0x3d32('0x16')][_0x3d32('0x19')]||null:null})['then'](function(_0x45e460){logger[_0x3d32('0x1d')](_0x3d32('0x22'),_0x408a93);logger[_0x3d32('0xb')](_0x3d32('0x22'),_0x408a93,JSON[_0x3d32('0x1e')](_0x45e460));_0x248969(_0x45e460);})[_0x3d32('0x12')](function(_0x3d093a){logger[_0x3d32('0xd')](_0x3d32('0x22'),_0x3d093a['message'],_0x408a93);_0x3528e7(_0x25ccfc[_0x3d32('0xd')](0x1f4,_0x3d093a[_0x3d32('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7805f2e..8f03f59 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 _0xd49b=['destroy','util','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd49b,0xd3));var _0xbd49=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0xd49b[_0x53bcc3];return _0x47c959;};'use strict';var multer=require('multer');var util=require(_0xbd49('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbd49('0x1'));var router=express[_0xbd49('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbd49('0x3'));var config=require(_0xbd49('0x4'));var controller=require(_0xbd49('0x5'));router[_0xbd49('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbd49('0x6')](_0xbd49('0x7'),auth[_0xbd49('0x8')](),controller[_0xbd49('0x9')]);router[_0xbd49('0xa')]('/',auth[_0xbd49('0x8')](),controller['create']);router[_0xbd49('0xb')](_0xbd49('0x7'),auth[_0xbd49('0x8')](),controller[_0xbd49('0xc')]);router[_0xbd49('0xd')](_0xbd49('0x7'),auth[_0xbd49('0x8')](),controller[_0xbd49('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5bc5=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x191c7b,_0x404a9d){var _0x570980=function(_0x36d58e){while(--_0x36d58e){_0x191c7b['push'](_0x191c7b['shift']());}};_0x570980(++_0x404a9d);}(_0x5bc5,0x1bc));var _0x55bc=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x5bc5[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0x55bc('0x0'));var util=require('util');var path=require(_0x55bc('0x1'));var timeout=require(_0x55bc('0x2'));var express=require(_0x55bc('0x3'));var router=express['Router']();var fs_extra=require(_0x55bc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x55bc('0x5'));var config=require(_0x55bc('0x6'));var controller=require(_0x55bc('0x7'));router[_0x55bc('0x8')]('/',auth[_0x55bc('0x9')](),controller['index']);router[_0x55bc('0x8')](_0x55bc('0xa'),auth['isAuthenticated'](),controller[_0x55bc('0xb')]);router[_0x55bc('0xc')]('/',auth[_0x55bc('0x9')](),controller[_0x55bc('0xd')]);router[_0x55bc('0xe')]('/:id',auth[_0x55bc('0x9')](),controller[_0x55bc('0xf')]);router[_0x55bc('0x10')](_0x55bc('0xa'),auth[_0x55bc('0x9')](),controller[_0x55bc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index dfe5aa3..9913013 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 _0x4330=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4330,0x1f3));var _0x0433=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4330[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0433('0x0'));module[_0x0433('0x1')]={'name':{'type':Sequelize[_0x0433('0x2')]},'prefix':{'type':Sequelize[_0x0433('0x2')],'unique':_0x0433('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0433('0x2')],'set':function(_0x2a5804){this[_0x0433('0x4')]('options',_0x2a5804?_0x2a5804['join'](''):[]);},'get':function(){return this[_0x0433('0x5')](_0x0433('0x6'))?this[_0x0433('0x5')]('options')[_0x0433('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0433('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x0433('0x2')]},'record':{'type':Sequelize[_0x0433('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0433('0x2')]},'description':{'type':Sequelize[_0x0433('0x2')]}}; \ No newline at end of file +var _0x7f13=['sequelize','exports','STRING','name','options','getDataValue','split','BOOLEAN'];(function(_0x439eb9,_0xf81ea6){var _0x1d0752=function(_0x1d6a49){while(--_0x1d6a49){_0x439eb9['push'](_0x439eb9['shift']());}};_0x1d0752(++_0xf81ea6);}(_0x7f13,0xf0));var _0x37f1=function(_0x50b62b,_0xeb3d67){_0x50b62b=_0x50b62b-0x0;var _0x4cc02c=_0x7f13[_0x50b62b];return _0x4cc02c;};'use strict';var Sequelize=require(_0x37f1('0x0'));module[_0x37f1('0x1')]={'name':{'type':Sequelize[_0x37f1('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x37f1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x37f1('0x2')],'set':function(_0x43f25b){this['setDataValue'](_0x37f1('0x4'),_0x43f25b?_0x43f25b['join'](''):[]);},'get':function(){return this[_0x37f1('0x5')](_0x37f1('0x4'))?this[_0x37f1('0x5')](_0x37f1('0x4'))[_0x37f1('0x6')](''):[];}},'auth':{'type':Sequelize[_0x37f1('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x37f1('0x2')]},'record':{'type':Sequelize[_0x37f1('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x37f1('0x2')]},'description':{'type':Sequelize[_0x37f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d3237a6..e66f9de 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 _0xf0cc=['rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','offset','count','limit','set','Content-Range','json','reject','update','then','get','ChanSpies','error','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x3a1f9b,_0x1e25da){_0x3a1f9b=_0x3a1f9b-0x0;var _0x5589f2=_0xf0cc[_0x3a1f9b];return _0x5589f2;};'use strict';var emlformat=require(_0xcf0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf0c('0x2'));var Mustache=require(_0xcf0c('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcf0c('0x4'));var csv=require(_0xcf0c('0x5'));var ejs=require(_0xcf0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf0c('0x7'));var squel=require(_0xcf0c('0x8'));var crypto=require(_0xcf0c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf0c('0x5'));var querystring=require('querystring');var Papa=require(_0xcf0c('0xa'));var Redis=require('ioredis');var authService=require(_0xcf0c('0xb'));var qs=require(_0xcf0c('0xc'));var as=require(_0xcf0c('0xd'));var hardwareService=require(_0xcf0c('0xe'));var logger=require(_0xcf0c('0xf'))(_0xcf0c('0x10'));var utils=require(_0xcf0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcf0c('0x12'));var db=require(_0xcf0c('0x13'))['db'];function respondWithStatusCode(_0x6dde21,_0x34f74f){_0x34f74f=_0x34f74f||0xcc;return function(_0x327f65){if(_0x327f65){return _0x6dde21['sendStatus'](_0x34f74f);}return _0x6dde21[_0xcf0c('0x14')](_0x34f74f)[_0xcf0c('0x15')]();};}function respondWithResult(_0x26fc43,_0x4fd482){_0x4fd482=_0x4fd482||0xc8;return function(_0x52038a){if(_0x52038a){return _0x26fc43[_0xcf0c('0x14')](_0x4fd482)['json'](_0x52038a);}};}function respondWithFilteredResult(_0x1f7a47,_0x8ed57d){return function(_0x5362ef){if(_0x5362ef){var _0x58f9ab=typeof _0x8ed57d['offset']===_0xcf0c('0x16')&&typeof _0x8ed57d['limit']===_0xcf0c('0x16');var _0xee0e66=_0x5362ef['count'];var _0x48766e=_0x58f9ab?0x0:_0x8ed57d[_0xcf0c('0x17')];var _0x3c43e5=_0x58f9ab?_0x5362ef[_0xcf0c('0x18')]:_0x8ed57d['offset']+_0x8ed57d[_0xcf0c('0x19')];var _0x134ecb;if(_0x3c43e5>=_0xee0e66){_0x3c43e5=_0xee0e66;_0x134ecb=0xc8;}else{_0x134ecb=0xce;}_0x1f7a47[_0xcf0c('0x14')](_0x134ecb);return _0x1f7a47[_0xcf0c('0x1a')](_0xcf0c('0x1b'),_0x48766e+'-'+_0x3c43e5+'/'+_0xee0e66)[_0xcf0c('0x1c')](_0x5362ef);}return null;};}function patchUpdates(_0x29bb2b){return function(_0xcfb5bd){try{jsonpatch['apply'](_0xcfb5bd,_0x29bb2b,!![]);}catch(_0x203da7){return BPromise[_0xcf0c('0x1d')](_0x203da7);}return _0xcfb5bd['save']();};}function saveUpdates(_0x4832d2,_0x39b1ed){return function(_0x20b8f3){if(_0x20b8f3){return _0x20b8f3[_0xcf0c('0x1e')](_0x4832d2)[_0xcf0c('0x1f')](function(_0x1ceea0){return _0x1ceea0;});}return null;};}function removeEntity(_0x8c4978,_0xbdf266){return function(_0x33628d){if(_0x33628d){return _0x33628d['destroy']()[_0xcf0c('0x1f')](function(){var _0x5466f4=_0x33628d[_0xcf0c('0x20')]({'plain':!![]});var _0x39f5e0=_0xcf0c('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x39f5e0,'resourceId':_0x5466f4['id']}})[_0xcf0c('0x1f')](function(){return _0x33628d;});})[_0xcf0c('0x1f')](function(){_0x8c4978[_0xcf0c('0x14')](0xcc)[_0xcf0c('0x15')]();});}};}function handleEntityNotFound(_0x9b0174,_0x36c637){return function(_0x3b38d9){if(!_0x3b38d9){_0x9b0174['sendStatus'](0x194);}return _0x3b38d9;};}function handleError(_0x1d9501,_0x1ce8d4){_0x1ce8d4=_0x1ce8d4||0x1f4;return function(_0x2bd2e3){logger[_0xcf0c('0x22')](_0x2bd2e3['stack']);if(_0x2bd2e3['name']){delete _0x2bd2e3['name'];}_0x1d9501['status'](_0x1ce8d4)[_0xcf0c('0x23')](_0x2bd2e3);};}exports[_0xcf0c('0x24')]=function(_0x3bdfd0,_0x34db17){var _0x3da4df={},_0x3fa73f={},_0x358e43={'count':0x0,'rows':[]};var _0x249d54=_[_0xcf0c('0x25')](db['VoiceChanSpy'][_0xcf0c('0x26')],function(_0x4f5ee2){return{'name':_0x4f5ee2[_0xcf0c('0x27')],'type':_0x4f5ee2[_0xcf0c('0x28')][_0xcf0c('0x29')]};});_0x3fa73f['model']=_['map'](_0x249d54,_0xcf0c('0x2a'));_0x3fa73f['query']=_[_0xcf0c('0x2b')](_0x3bdfd0[_0xcf0c('0x2c')]);_0x3fa73f[_0xcf0c('0x2d')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],_0x3fa73f['query']);_0x3da4df[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x3bdfd0['query'][_0xcf0c('0x31')]));_0x3da4df[_0xcf0c('0x30')]=_0x3da4df[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x3da4df['attributes']:_0x3fa73f[_0xcf0c('0x2f')];if(!_0x3bdfd0[_0xcf0c('0x2c')]['hasOwnProperty'](_0xcf0c('0x33'))){_0x3da4df[_0xcf0c('0x19')]=qs[_0xcf0c('0x19')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x19')]);_0x3da4df[_0xcf0c('0x17')]=qs[_0xcf0c('0x17')](_0x3bdfd0['query'][_0xcf0c('0x17')]);}_0x3da4df['order']=qs[_0xcf0c('0x34')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x34')]);_0x3da4df[_0xcf0c('0x35')]=qs[_0xcf0c('0x2d')](_['pick'](_0x3bdfd0['query'],_0x3fa73f[_0xcf0c('0x2d')]),_0x249d54);if(_0x3bdfd0['query'][_0xcf0c('0x36')]){_0x3da4df[_0xcf0c('0x35')]=_[_0xcf0c('0x37')](_0x3da4df[_0xcf0c('0x35')],{'$or':_[_0xcf0c('0x25')](_0x249d54,function(_0x532b2a){if(_0x532b2a[_0xcf0c('0x28')]!==_0xcf0c('0x38')){var _0xc1d73e={};_0xc1d73e[_0x532b2a[_0xcf0c('0x2a')]]={'$like':'%'+_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x36')]+'%'};return _0xc1d73e;}})});}_0x3da4df=_[_0xcf0c('0x37')]({},_0x3da4df,_0x3bdfd0[_0xcf0c('0x39')]);var _0x12b43f={'where':_0x3da4df[_0xcf0c('0x35')]};return db[_0xcf0c('0x3a')]['count'](_0x12b43f)['then'](function(_0xf39dea){_0x358e43[_0xcf0c('0x18')]=_0xf39dea;if(_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x3da4df[_0xcf0c('0x3c')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3da4df);})[_0xcf0c('0x1f')](function(_0x24f4bd){_0x358e43[_0xcf0c('0x3d')]=_0x24f4bd;return _0x358e43;})['then'](respondWithFilteredResult(_0x34db17,_0x3da4df))[_0xcf0c('0x3e')](handleError(_0x34db17,null));};exports[_0xcf0c('0x3f')]=function(_0x2c8fa2,_0x1e688e){var _0x53af37={'raw':![],'where':{'id':_0x2c8fa2['params']['id']}},_0x681778={};_0x681778[_0xcf0c('0x2f')]=_['keys'](db[_0xcf0c('0x3a')]['rawAttributes']);_0x681778[_0xcf0c('0x2c')]=_[_0xcf0c('0x2b')](_0x2c8fa2['query']);_0x681778['filters']=_['intersection'](_0x681778[_0xcf0c('0x2f')],_0x681778[_0xcf0c('0x2c')]);_0x53af37[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x681778[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x31')]));_0x53af37[_0xcf0c('0x30')]=_0x53af37[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x53af37[_0xcf0c('0x30')]:_0x681778['model'];if(_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x53af37[_0xcf0c('0x3c')]=[{'all':!![]}];}_0x53af37=_[_0xcf0c('0x37')]({},_0x53af37,_0x2c8fa2[_0xcf0c('0x39')]);return db['VoiceChanSpy']['find'](_0x53af37)[_0xcf0c('0x1f')](handleEntityNotFound(_0x1e688e,null))[_0xcf0c('0x1f')](respondWithResult(_0x1e688e,null))['catch'](handleError(_0x1e688e,null));};exports[_0xcf0c('0x40')]=function(_0x1f9728,_0x87e6d4){return db[_0xcf0c('0x3a')][_0xcf0c('0x40')](_0x1f9728[_0xcf0c('0x41')],{})[_0xcf0c('0x1f')](function(_0xe9f843){var _0x2fca4a=_0x1f9728[_0xcf0c('0x42')][_0xcf0c('0x20')]({'plain':!![]});if(!_0x2fca4a)throw new Error(_0xcf0c('0x43'));if(_0x2fca4a[_0xcf0c('0x44')]===_0xcf0c('0x42')){var _0x11558c=_0xe9f843[_0xcf0c('0x20')]({'plain':!![]});var _0x5563be=_0xcf0c('0x21');return db['UserProfileSection'][_0xcf0c('0x45')]({'where':{'name':_0x5563be,'userProfileId':_0x2fca4a[_0xcf0c('0x46')]},'raw':!![]})[_0xcf0c('0x1f')](function(_0x5103ff){if(_0x5103ff&&_0x5103ff[_0xcf0c('0x47')]===0x0){return db[_0xcf0c('0x48')][_0xcf0c('0x40')]({'name':_0x11558c[_0xcf0c('0x2a')],'resourceId':_0x11558c['id'],'type':_0x5103ff[_0xcf0c('0x2a')],'sectionId':_0x5103ff['id']},{})[_0xcf0c('0x1f')](function(){return _0xe9f843;});}else{return _0xe9f843;}})['catch'](function(_0x20b133){logger['error'](_0xcf0c('0x49'),_0x20b133);throw _0x20b133;});}return _0xe9f843;})[_0xcf0c('0x1f')](respondWithResult(_0x87e6d4,0xc9))[_0xcf0c('0x3e')](handleError(_0x87e6d4,null));};exports[_0xcf0c('0x1e')]=function(_0x543d75,_0x19782d){if(_0x543d75[_0xcf0c('0x41')]['id']){delete _0x543d75[_0xcf0c('0x41')]['id'];}return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x543d75[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x19782d,null))['then'](saveUpdates(_0x543d75[_0xcf0c('0x41')],null))[_0xcf0c('0x1f')](respondWithResult(_0x19782d,null))[_0xcf0c('0x3e')](handleError(_0x19782d,null));};exports[_0xcf0c('0x4b')]=function(_0x3f9edd,_0x53a2c8){return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x3f9edd[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x53a2c8,null))[_0xcf0c('0x1f')](removeEntity(_0x53a2c8,null))['catch'](handleError(_0x53a2c8,null));}; \ No newline at end of file +var _0xae79=['attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','set','json','apply','reject','save','then','destroy','get','ChanSpies','error','stack','name','index','map','VoiceChanSpy','rawAttributes','key','model','query','keys','filters','intersection'];(function(_0x2c4831,_0x4f36f9){var _0x3dce74=function(_0x20beaf){while(--_0x20beaf){_0x2c4831['push'](_0x2c4831['shift']());}};_0x3dce74(++_0x4f36f9);}(_0xae79,0x1d3));var _0x9ae7=function(_0x272fb8,_0x5ef73e){_0x272fb8=_0x272fb8-0x0;var _0x2f4209=_0xae79[_0x272fb8];return _0x2f4209;};'use strict';var emlformat=require(_0x9ae7('0x0'));var rimraf=require(_0x9ae7('0x1'));var zipdir=require(_0x9ae7('0x2'));var jsonpatch=require(_0x9ae7('0x3'));var rp=require(_0x9ae7('0x4'));var moment=require(_0x9ae7('0x5'));var BPromise=require(_0x9ae7('0x6'));var Mustache=require(_0x9ae7('0x7'));var util=require(_0x9ae7('0x8'));var path=require(_0x9ae7('0x9'));var sox=require(_0x9ae7('0xa'));var csv=require(_0x9ae7('0xb'));var ejs=require(_0x9ae7('0xc'));var fs=require('fs');var fs_extra=require(_0x9ae7('0xd'));var _=require(_0x9ae7('0xe'));var squel=require('squel');var crypto=require(_0x9ae7('0xf'));var jsforce=require(_0x9ae7('0x10'));var deskjs=require(_0x9ae7('0x11'));var toCsv=require(_0x9ae7('0xb'));var querystring=require(_0x9ae7('0x12'));var Papa=require(_0x9ae7('0x13'));var Redis=require('ioredis');var authService=require(_0x9ae7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9ae7('0x15'));var hardwareService=require(_0x9ae7('0x16'));var logger=require(_0x9ae7('0x17'))(_0x9ae7('0x18'));var utils=require(_0x9ae7('0x19'));var config=require(_0x9ae7('0x1a'));var licenseUtil=require(_0x9ae7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf0ddd1,_0x41a773){_0x41a773=_0x41a773||0xcc;return function(_0x4fec37){if(_0x4fec37){return _0xf0ddd1[_0x9ae7('0x1c')](_0x41a773);}return _0xf0ddd1[_0x9ae7('0x1d')](_0x41a773)[_0x9ae7('0x1e')]();};}function respondWithResult(_0x18ff9d,_0x1bc8a1){_0x1bc8a1=_0x1bc8a1||0xc8;return function(_0x39ac53){if(_0x39ac53){return _0x18ff9d[_0x9ae7('0x1d')](_0x1bc8a1)['json'](_0x39ac53);}};}function respondWithFilteredResult(_0x1b9b21,_0x3f8a2d){return function(_0x1f8008){if(_0x1f8008){var _0x44c0bc=typeof _0x3f8a2d['offset']===_0x9ae7('0x1f')&&typeof _0x3f8a2d[_0x9ae7('0x20')]===_0x9ae7('0x1f');var _0x490d26=_0x1f8008['count'];var _0x2c7643=_0x44c0bc?0x0:_0x3f8a2d['offset'];var _0x5d6ad1=_0x44c0bc?_0x1f8008['count']:_0x3f8a2d['offset']+_0x3f8a2d[_0x9ae7('0x20')];var _0x1366cd;if(_0x5d6ad1>=_0x490d26){_0x5d6ad1=_0x490d26;_0x1366cd=0xc8;}else{_0x1366cd=0xce;}_0x1b9b21[_0x9ae7('0x1d')](_0x1366cd);return _0x1b9b21[_0x9ae7('0x21')]('Content-Range',_0x2c7643+'-'+_0x5d6ad1+'/'+_0x490d26)[_0x9ae7('0x22')](_0x1f8008);}return null;};}function patchUpdates(_0x1d94fb){return function(_0x481e47){try{jsonpatch[_0x9ae7('0x23')](_0x481e47,_0x1d94fb,!![]);}catch(_0x48eb76){return BPromise[_0x9ae7('0x24')](_0x48eb76);}return _0x481e47[_0x9ae7('0x25')]();};}function saveUpdates(_0x583937,_0x356559){return function(_0x550e52){if(_0x550e52){return _0x550e52['update'](_0x583937)[_0x9ae7('0x26')](function(_0x1abf16){return _0x1abf16;});}return null;};}function removeEntity(_0x1798d5,_0x1159a0){return function(_0x5aad24){if(_0x5aad24){return _0x5aad24[_0x9ae7('0x27')]()[_0x9ae7('0x26')](function(){var _0x30ddfd=_0x5aad24[_0x9ae7('0x28')]({'plain':!![]});var _0x5da136=_0x9ae7('0x29');return db['UserProfileResource'][_0x9ae7('0x27')]({'where':{'type':_0x5da136,'resourceId':_0x30ddfd['id']}})[_0x9ae7('0x26')](function(){return _0x5aad24;});})['then'](function(){_0x1798d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49123b,_0x43f2c9){return function(_0x26680c){if(!_0x26680c){_0x49123b['sendStatus'](0x194);}return _0x26680c;};}function handleError(_0x23cca8,_0xf3bdcb){_0xf3bdcb=_0xf3bdcb||0x1f4;return function(_0x41e4a8){logger[_0x9ae7('0x2a')](_0x41e4a8[_0x9ae7('0x2b')]);if(_0x41e4a8[_0x9ae7('0x2c')]){delete _0x41e4a8['name'];}_0x23cca8[_0x9ae7('0x1d')](_0xf3bdcb)['send'](_0x41e4a8);};}exports[_0x9ae7('0x2d')]=function(_0x1d43fd,_0x51dcc4){var _0xfe666d={},_0x23a65e={},_0x182d2c={'count':0x0,'rows':[]};var _0x5879cf=_[_0x9ae7('0x2e')](db[_0x9ae7('0x2f')][_0x9ae7('0x30')],function(_0x801b9e){return{'name':_0x801b9e['fieldName'],'type':_0x801b9e['type'][_0x9ae7('0x31')]};});_0x23a65e[_0x9ae7('0x32')]=_[_0x9ae7('0x2e')](_0x5879cf,_0x9ae7('0x2c'));_0x23a65e[_0x9ae7('0x33')]=_[_0x9ae7('0x34')](_0x1d43fd[_0x9ae7('0x33')]);_0x23a65e[_0x9ae7('0x35')]=_[_0x9ae7('0x36')](_0x23a65e['model'],_0x23a65e[_0x9ae7('0x33')]);_0xfe666d[_0x9ae7('0x37')]=_['intersection'](_0x23a65e[_0x9ae7('0x32')],qs[_0x9ae7('0x38')](_0x1d43fd['query']['fields']));_0xfe666d['attributes']=_0xfe666d[_0x9ae7('0x37')]['length']?_0xfe666d[_0x9ae7('0x37')]:_0x23a65e[_0x9ae7('0x32')];if(!_0x1d43fd[_0x9ae7('0x33')][_0x9ae7('0x39')](_0x9ae7('0x3a'))){_0xfe666d[_0x9ae7('0x20')]=qs[_0x9ae7('0x20')](_0x1d43fd[_0x9ae7('0x33')][_0x9ae7('0x20')]);_0xfe666d['offset']=qs[_0x9ae7('0x3b')](_0x1d43fd[_0x9ae7('0x33')]['offset']);}_0xfe666d[_0x9ae7('0x3c')]=qs['sort'](_0x1d43fd[_0x9ae7('0x33')][_0x9ae7('0x3d')]);_0xfe666d[_0x9ae7('0x3e')]=qs[_0x9ae7('0x35')](_[_0x9ae7('0x3f')](_0x1d43fd['query'],_0x23a65e[_0x9ae7('0x35')]),_0x5879cf);if(_0x1d43fd[_0x9ae7('0x33')][_0x9ae7('0x40')]){_0xfe666d[_0x9ae7('0x3e')]=_['merge'](_0xfe666d[_0x9ae7('0x3e')],{'$or':_[_0x9ae7('0x2e')](_0x5879cf,function(_0x1b1fc9){if(_0x1b1fc9['type']!==_0x9ae7('0x41')){var _0x4b36ad={};_0x4b36ad[_0x1b1fc9[_0x9ae7('0x2c')]]={'$like':'%'+_0x1d43fd[_0x9ae7('0x33')][_0x9ae7('0x40')]+'%'};return _0x4b36ad;}})});}_0xfe666d=_[_0x9ae7('0x42')]({},_0xfe666d,_0x1d43fd[_0x9ae7('0x43')]);var _0x17fe0c={'where':_0xfe666d[_0x9ae7('0x3e')]};return db[_0x9ae7('0x2f')]['count'](_0x17fe0c)['then'](function(_0x220056){_0x182d2c[_0x9ae7('0x44')]=_0x220056;if(_0x1d43fd[_0x9ae7('0x33')][_0x9ae7('0x45')]){_0xfe666d['include']=[{'all':!![]}];}return db[_0x9ae7('0x2f')]['findAll'](_0xfe666d);})[_0x9ae7('0x26')](function(_0x1d978d){_0x182d2c[_0x9ae7('0x46')]=_0x1d978d;return _0x182d2c;})[_0x9ae7('0x26')](respondWithFilteredResult(_0x51dcc4,_0xfe666d))[_0x9ae7('0x47')](handleError(_0x51dcc4,null));};exports[_0x9ae7('0x48')]=function(_0x3ed5b3,_0x3ad781){var _0x25e90e={'raw':![],'where':{'id':_0x3ed5b3[_0x9ae7('0x49')]['id']}},_0x525185={};_0x525185[_0x9ae7('0x32')]=_['keys'](db[_0x9ae7('0x2f')]['rawAttributes']);_0x525185[_0x9ae7('0x33')]=_['keys'](_0x3ed5b3[_0x9ae7('0x33')]);_0x525185[_0x9ae7('0x35')]=_[_0x9ae7('0x36')](_0x525185[_0x9ae7('0x32')],_0x525185[_0x9ae7('0x33')]);_0x25e90e[_0x9ae7('0x37')]=_['intersection'](_0x525185[_0x9ae7('0x32')],qs['fields'](_0x3ed5b3[_0x9ae7('0x33')][_0x9ae7('0x38')]));_0x25e90e[_0x9ae7('0x37')]=_0x25e90e[_0x9ae7('0x37')][_0x9ae7('0x4a')]?_0x25e90e[_0x9ae7('0x37')]:_0x525185['model'];if(_0x3ed5b3[_0x9ae7('0x33')][_0x9ae7('0x45')]){_0x25e90e[_0x9ae7('0x4b')]=[{'all':!![]}];}_0x25e90e=_[_0x9ae7('0x42')]({},_0x25e90e,_0x3ed5b3[_0x9ae7('0x43')]);return db[_0x9ae7('0x2f')][_0x9ae7('0x4c')](_0x25e90e)['then'](handleEntityNotFound(_0x3ad781,null))[_0x9ae7('0x26')](respondWithResult(_0x3ad781,null))[_0x9ae7('0x47')](handleError(_0x3ad781,null));};exports['create']=function(_0x59bd8b,_0x573c3c){return db[_0x9ae7('0x2f')][_0x9ae7('0x4d')](_0x59bd8b[_0x9ae7('0x4e')],{})[_0x9ae7('0x26')](function(_0x38c496){var _0x4ac375=_0x59bd8b[_0x9ae7('0x4f')][_0x9ae7('0x28')]({'plain':!![]});if(!_0x4ac375)throw new Error(_0x9ae7('0x50'));if(_0x4ac375[_0x9ae7('0x51')]==='user'){var _0x54dc5d=_0x38c496[_0x9ae7('0x28')]({'plain':!![]});var _0x429c70=_0x9ae7('0x29');return db[_0x9ae7('0x52')][_0x9ae7('0x4c')]({'where':{'name':_0x429c70,'userProfileId':_0x4ac375[_0x9ae7('0x53')]},'raw':!![]})[_0x9ae7('0x26')](function(_0x562a2f){if(_0x562a2f&&_0x562a2f[_0x9ae7('0x54')]===0x0){return db[_0x9ae7('0x55')][_0x9ae7('0x4d')]({'name':_0x54dc5d[_0x9ae7('0x2c')],'resourceId':_0x54dc5d['id'],'type':_0x562a2f[_0x9ae7('0x2c')],'sectionId':_0x562a2f['id']},{})[_0x9ae7('0x26')](function(){return _0x38c496;});}else{return _0x38c496;}})[_0x9ae7('0x47')](function(_0x50aab5){logger[_0x9ae7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50aab5);throw _0x50aab5;});}return _0x38c496;})['then'](respondWithResult(_0x573c3c,0xc9))['catch'](handleError(_0x573c3c,null));};exports[_0x9ae7('0x56')]=function(_0x4c3c8c,_0x2f6e54){if(_0x4c3c8c[_0x9ae7('0x4e')]['id']){delete _0x4c3c8c[_0x9ae7('0x4e')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x4c3c8c[_0x9ae7('0x49')]['id']}})[_0x9ae7('0x26')](handleEntityNotFound(_0x2f6e54,null))[_0x9ae7('0x26')](saveUpdates(_0x4c3c8c[_0x9ae7('0x4e')],null))[_0x9ae7('0x26')](respondWithResult(_0x2f6e54,null))[_0x9ae7('0x47')](handleError(_0x2f6e54,null));};exports[_0x9ae7('0x27')]=function(_0xae8f7d,_0x45296f){return db['VoiceChanSpy']['find']({'where':{'id':_0xae8f7d[_0x9ae7('0x49')]['id']}})[_0x9ae7('0x26')](handleEntityNotFound(_0x45296f,null))[_0x9ae7('0x26')](removeEntity(_0x45296f,null))[_0x9ae7('0x47')](handleError(_0x45296f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c3c1309..f0da597 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 _0xcbec=['VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','catch','util','./voiceChanSpy.attributes','context','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','length','internal','concat','findAll','exports','models','define'];(function(_0x3b070d,_0x484502){var _0x3be1f8=function(_0x305173){while(--_0x305173){_0x3b070d['push'](_0x3b070d['shift']());}};_0x3be1f8(++_0x484502);}(_0xcbec,0x93));var _0xccbe=function(_0xf01fad,_0x3d092d){_0xf01fad=_0xf01fad-0x0;var _0x20326d=_0xcbec[_0xf01fad];return _0x20326d;};'use strict';var _=require('lodash');var util=require(_0xccbe('0x0'));var BPromise=require('bluebird');var attributes=require(_0xccbe('0x1'));var getUserApplications=function(_0x1ea146,_0x1c4e13,_0x1b4251){var _0x5aab05=0x1;var _0x4aec03=[];var _0x2acb35={'context':_0x1c4e13[_0xccbe('0x2')]||'from-sip','exten':util[_0xccbe('0x3')](_0xccbe('0x4'),_0x1ea146[_0xccbe('0x5')],_0x1b4251),'type':'system','isApp':![],'ChanSpyId':_0x1ea146['id'],'UserId':_0x1c4e13['id']};_0x4aec03[_0xccbe('0x6')](_[_0xccbe('0x7')]({'app':_0xccbe('0x8'),'appdata':util[_0xccbe('0x3')](_0xccbe('0x9'),_0xccbe('0xa')),'priority':_0x5aab05++},_0x2acb35));if(_0x1ea146[_0xccbe('0xb')]){_0x4aec03['push'](_[_0xccbe('0x7')]({'app':_0xccbe('0xc'),'appdata':util[_0xccbe('0x3')](_0xccbe('0xd'),_0x1ea146[_0xccbe('0xe')]),'priority':_0x5aab05++},_0x2acb35));}if(_0x1ea146['auth']){_0x4aec03[_0xccbe('0x6')](_[_0xccbe('0x7')]({'app':_0xccbe('0xf'),'appdata':_0x1ea146[_0xccbe('0x10')],'priority':_0x5aab05++},_0x2acb35));}_0x4aec03[_0xccbe('0x6')](_[_0xccbe('0x7')]({'app':_0xccbe('0x11'),'appdata':util[_0xccbe('0x3')](_0xccbe('0x12'),_0x1c4e13[_0xccbe('0x13')],_0x1ea146['options']?_0x1ea146['options']['join'](''):''),'priority':_0x5aab05++},_0x2acb35));if(_0x1ea146['record']){_0x4aec03[_0xccbe('0x6')](_['merge']({'app':_0xccbe('0x14'),'priority':_0x5aab05++},_0x2acb35));}return _0x4aec03;};var getChanSpyApplications=function(_0x1d2af8,_0x15e4fb){var _0x36a307=[];for(var _0x555f41=0x0,_0x7b28f4=0x1;_0x555f41<_0x15e4fb[_0xccbe('0x15')];_0x555f41++,_0x7b28f4=0x1){_0x36a307=_0x36a307['concat'](getUserApplications(_0x1d2af8,_0x15e4fb[_0x555f41],_0x15e4fb[_0x555f41][_0xccbe('0x16')]));if(_0x15e4fb[_0x555f41][_0xccbe('0x16')]!=_0x15e4fb[_0x555f41][_0xccbe('0x13')]){_0x36a307=_0x36a307[_0xccbe('0x17')](getUserApplications(_0x1d2af8,_0x15e4fb[_0x555f41],_0x15e4fb[_0x555f41][_0xccbe('0x13')]));}}return _0x36a307;};var getChanSpyPromise=function(_0x30b400,_0x519bac){return new BPromise(function(_0x26b9da,_0x305e49){return _0x30b400['User'][_0xccbe('0x18')]({'attributes':['id',_0xccbe('0x13'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x5753f6){if(_0x5753f6){return _0x26b9da(getChanSpyApplications(_0x519bac,_0x5753f6));}return _0x26b9da([]);})['catch'](function(_0xd48fc2){_0x305e49(_0xd48fc2);});});};module[_0xccbe('0x19')]=function(_0x56bd76,_0xca495b){var _0x4ad39e=_0x56bd76[_0xccbe('0x1a')];return _0x56bd76[_0xccbe('0x1b')](_0xccbe('0x1c'),attributes,{'tableName':_0xccbe('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x34f3db,_0xfe93e7,_0x55bb9b){return getChanSpyPromise(_0x4ad39e,_0x34f3db)[_0xccbe('0x1e')](function(_0x72934){if(_0x72934&&_0x72934[_0xccbe('0x15')]){return _0x4ad39e[_0xccbe('0x1f')]['bulkCreate'](_0x72934);}})[_0xccbe('0x1e')](function(){_0x55bb9b();})['catch'](function(_0x1da448){_0x55bb9b(_0x1da448);});},'afterUpdate':function(_0x3b2167,_0x5831af,_0x147cb6){return _0x4ad39e[_0xccbe('0x1f')][_0xccbe('0x20')]({'where':{'ChanSpyId':_0x3b2167['id']}})[_0xccbe('0x1e')](function(){return getChanSpyPromise(_0x4ad39e,_0x3b2167);})[_0xccbe('0x1e')](function(_0x3b0625){if(_0x3b0625&&_0x3b0625[_0xccbe('0x15')]){return _0x4ad39e['VoiceExtension'][_0xccbe('0x21')](_0x3b0625);}})[_0xccbe('0x1e')](function(){_0x147cb6();})[_0xccbe('0x22')](function(_0x316561){_0x147cb6(_0x316561);});},'afterDestroy':function(_0x3d6040,_0x2b7cd2,_0x551221){return _0x4ad39e['VoiceExtension'][_0xccbe('0x20')]({'where':{'ChanSpyId':_0x3d6040['id']}})[_0xccbe('0x1e')](function(){_0x551221();})['catch'](function(_0x1a27f0){_0x551221(_0x1a27f0);});}}});}; \ No newline at end of file +var _0x6c87=['auth','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','format','%s%s','system','push','Set','CDR(type)=%s','record','merge','${UNIQUEID}.%s,a'];(function(_0x10ba4f,_0x1c8310){var _0xfe6474=function(_0xd315ca){while(--_0xd315ca){_0x10ba4f['push'](_0x10ba4f['shift']());}};_0xfe6474(++_0x1c8310);}(_0x6c87,0xf5));var _0x76c8=function(_0x2073f8,_0x34a29d){_0x2073f8=_0x2073f8-0x0;var _0x11c069=_0x6c87[_0x2073f8];return _0x11c069;};'use strict';var _=require(_0x76c8('0x0'));var util=require('util');var BPromise=require(_0x76c8('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5ed126,_0x5c7b41,_0x2aede8){var _0x980fa6=0x1;var _0x5dad22=[];var _0x24540a={'context':_0x5c7b41['context']||'from-sip','exten':util[_0x76c8('0x2')](_0x76c8('0x3'),_0x5ed126['prefix'],_0x2aede8),'type':_0x76c8('0x4'),'isApp':![],'ChanSpyId':_0x5ed126['id'],'UserId':_0x5c7b41['id']};_0x5dad22[_0x76c8('0x5')](_['merge']({'app':_0x76c8('0x6'),'appdata':util[_0x76c8('0x2')](_0x76c8('0x7'),'chanspy'),'priority':_0x980fa6++},_0x24540a));if(_0x5ed126[_0x76c8('0x8')]){_0x5dad22[_0x76c8('0x5')](_[_0x76c8('0x9')]({'app':'MixMonitor','appdata':util[_0x76c8('0x2')](_0x76c8('0xa'),_0x5ed126['recordingFormat']),'priority':_0x980fa6++},_0x24540a));}if(_0x5ed126[_0x76c8('0xb')]){_0x5dad22[_0x76c8('0x5')](_[_0x76c8('0x9')]({'app':'Authenticate','appdata':_0x5ed126[_0x76c8('0xc')],'priority':_0x980fa6++},_0x24540a));}_0x5dad22[_0x76c8('0x5')](_['merge']({'app':'ChanSpy','appdata':util[_0x76c8('0x2')](_0x76c8('0xd'),_0x5c7b41[_0x76c8('0xe')],_0x5ed126[_0x76c8('0xf')]?_0x5ed126[_0x76c8('0xf')][_0x76c8('0x10')](''):''),'priority':_0x980fa6++},_0x24540a));if(_0x5ed126[_0x76c8('0x8')]){_0x5dad22[_0x76c8('0x5')](_[_0x76c8('0x9')]({'app':_0x76c8('0x11'),'priority':_0x980fa6++},_0x24540a));}return _0x5dad22;};var getChanSpyApplications=function(_0x40e6a3,_0x258dd7){var _0x5e92c6=[];for(var _0x316b5d=0x0,_0x169244=0x1;_0x316b5d<_0x258dd7[_0x76c8('0x12')];_0x316b5d++,_0x169244=0x1){_0x5e92c6=_0x5e92c6[_0x76c8('0x13')](getUserApplications(_0x40e6a3,_0x258dd7[_0x316b5d],_0x258dd7[_0x316b5d]['internal']));if(_0x258dd7[_0x316b5d][_0x76c8('0x14')]!=_0x258dd7[_0x316b5d]['name']){_0x5e92c6=_0x5e92c6[_0x76c8('0x13')](getUserApplications(_0x40e6a3,_0x258dd7[_0x316b5d],_0x258dd7[_0x316b5d]['name']));}}return _0x5e92c6;};var getChanSpyPromise=function(_0x385d86,_0x556e64){return new BPromise(function(_0x2107e2,_0x1e8498){return _0x385d86['User'][_0x76c8('0x15')]({'attributes':['id',_0x76c8('0xe'),_0x76c8('0x14')],'where':{'role':_0x76c8('0x16'),'chanspy':!![]},'raw':!![]})[_0x76c8('0x17')](function(_0x29fed0){if(_0x29fed0){return _0x2107e2(getChanSpyApplications(_0x556e64,_0x29fed0));}return _0x2107e2([]);})[_0x76c8('0x18')](function(_0x2a4793){_0x1e8498(_0x2a4793);});});};module[_0x76c8('0x19')]=function(_0x2aa959,_0x34fe9b){var _0x36729e=_0x2aa959[_0x76c8('0x1a')];return _0x2aa959[_0x76c8('0x1b')](_0x76c8('0x1c'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d85f1,_0x14cc54,_0xb7074e){return getChanSpyPromise(_0x36729e,_0x4d85f1)[_0x76c8('0x17')](function(_0x30e968){if(_0x30e968&&_0x30e968[_0x76c8('0x12')]){return _0x36729e[_0x76c8('0x1d')][_0x76c8('0x1e')](_0x30e968);}})[_0x76c8('0x17')](function(){_0xb7074e();})[_0x76c8('0x18')](function(_0x125030){_0xb7074e(_0x125030);});},'afterUpdate':function(_0x4fb86b,_0x58ef69,_0x5d651d){return _0x36729e[_0x76c8('0x1d')]['destroy']({'where':{'ChanSpyId':_0x4fb86b['id']}})[_0x76c8('0x17')](function(){return getChanSpyPromise(_0x36729e,_0x4fb86b);})[_0x76c8('0x17')](function(_0x9211ea){if(_0x9211ea&&_0x9211ea[_0x76c8('0x12')]){return _0x36729e[_0x76c8('0x1d')][_0x76c8('0x1e')](_0x9211ea);}})[_0x76c8('0x17')](function(){_0x5d651d();})[_0x76c8('0x18')](function(_0x3e952c){_0x5d651d(_0x3e952c);});},'afterDestroy':function(_0x56b65f,_0x22369a,_0x47f156){return _0x36729e[_0x76c8('0x1d')][_0x76c8('0x1f')]({'where':{'ChanSpyId':_0x56b65f['id']}})[_0x76c8('0x17')](function(){_0x47f156();})['catch'](function(_0x14134b){_0x47f156(_0x14134b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 515985f..e1b0400 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 _0xb921=['info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2626ab,_0x493048){var _0x2b5c3d=function(_0xe13683){while(--_0xe13683){_0x2626ab['push'](_0x2626ab['shift']());}};_0x2b5c3d(++_0x493048);}(_0xb921,0x16a));var _0x1b92=function(_0x4569fd,_0x4f2e82){_0x4569fd=_0x4569fd-0x0;var _0x10fca7=_0xb921[_0x4569fd];return _0x10fca7;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});} \ No newline at end of file +var _0xd87e=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x21f28f,_0x3be6b8){var _0x180f21=function(_0x4be8ac){while(--_0x4be8ac){_0x21f28f['push'](_0x21f28f['shift']());}};_0x180f21(++_0x3be6b8);}(_0xd87e,0x1bf));var _0xed87=function(_0x1613d9,_0x2f583e){_0x1613d9=_0x1613d9-0x0;var _0x1ab5e0=_0xd87e[_0x1613d9];return _0x1ab5e0;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da793,_0xa33c67,_0x42fef6){return new BPromise(function(_0x33e1c1,_0x2f348a){return client['request'](_0x5da793,_0x42fef6)[_0xed87('0x9')](function(_0x3dce4b){logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));logger[_0xed87('0xd')](_0xed87('0xe'),_0xa33c67,'request\x20sent',JSON[_0xed87('0xf')](_0x3dce4b));if(_0x3dce4b[_0xed87('0x10')]){if(_0x3dce4b['error'][_0xed87('0x11')]===0x1f4){logger[_0xed87('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0xa33c67,_0x3dce4b['error'][_0xed87('0x12')]);return _0x2f348a(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}logger[_0xed87('0x10')](_0xed87('0xb'),_0xa33c67,_0x3dce4b[_0xed87('0x10')]['message']);return _0x33e1c1(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}else{logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));_0x33e1c1(_0x3dce4b[_0xed87('0x13')][_0xed87('0x12')]);}})[_0xed87('0x14')](function(_0x385859){logger['error'](_0xed87('0xb'),_0xa33c67,_0x385859);_0x2f348a(_0x385859);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8d931f2..ebe7453 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 _0x6d95=['index','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1293da,_0x10a34c){var _0x17e307=function(_0x24a1c2){while(--_0x24a1c2){_0x1293da['push'](_0x1293da['shift']());}};_0x17e307(++_0x10a34c);}(_0x6d95,0x1e3));var _0x56d9=function(_0x49e4d7,_0x2457f5){_0x49e4d7=_0x49e4d7-0x0;var _0x393edc=_0x6d95[_0x49e4d7];return _0x393edc;};'use strict';var multer=require(_0x56d9('0x0'));var util=require(_0x56d9('0x1'));var path=require('path');var timeout=require(_0x56d9('0x2'));var express=require(_0x56d9('0x3'));var router=express[_0x56d9('0x4')]();var fs_extra=require(_0x56d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x56d9('0x6'));var config=require(_0x56d9('0x7'));var controller=require('./voiceContext.controller');router[_0x56d9('0x8')]('/',auth[_0x56d9('0x9')](),controller[_0x56d9('0xa')]);router[_0x56d9('0x8')](_0x56d9('0xb'),auth['isAuthenticated'](),controller[_0x56d9('0xc')]);router[_0x56d9('0xd')]('/',auth[_0x56d9('0x9')](),controller[_0x56d9('0xe')]);router['put']('/:id',auth[_0x56d9('0x9')](),controller['update']);router[_0x56d9('0xf')](_0x56d9('0xb'),auth[_0x56d9('0x9')](),controller['destroy']);module[_0x56d9('0x10')]=router; \ No newline at end of file +var _0x5593=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','update'];(function(_0x126dfb,_0x4e1bdd){var _0x487792=function(_0x47079d){while(--_0x47079d){_0x126dfb['push'](_0x126dfb['shift']());}};_0x487792(++_0x4e1bdd);}(_0x5593,0xb7));var _0x3559=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5593[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x3559('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3559('0x1'));var express=require(_0x3559('0x2'));var router=express[_0x3559('0x3')]();var fs_extra=require(_0x3559('0x4'));var auth=require(_0x3559('0x5'));var interaction=require(_0x3559('0x6'));var config=require(_0x3559('0x7'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x3559('0x8')](),controller[_0x3559('0x9')]);router[_0x3559('0xa')]('/:id',auth[_0x3559('0x8')](),controller[_0x3559('0xb')]);router[_0x3559('0xc')]('/',auth[_0x3559('0x8')](),controller[_0x3559('0xd')]);router[_0x3559('0xe')](_0x3559('0xf'),auth['isAuthenticated'](),controller[_0x3559('0x10')]);router[_0x3559('0x11')](_0x3559('0xf'),auth[_0x3559('0x8')](),controller[_0x3559('0x12')]);module[_0x3559('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index afb1e6e..fd8d961 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 _0x48ae=['STRING','name','BOOLEAN','sequelize'];(function(_0x57a97b,_0xc46c70){var _0x3e8f2c=function(_0x23ff42){while(--_0x23ff42){_0x57a97b['push'](_0x57a97b['shift']());}};_0x3e8f2c(++_0xc46c70);}(_0x48ae,0xa3));var _0xe48a=function(_0x1b7929,_0x77c934){_0x1b7929=_0x1b7929-0x0;var _0x4c3cc0=_0x48ae[_0x1b7929];return _0x4c3cc0;};'use strict';var Sequelize=require(_0xe48a('0x0'));module['exports']={'name':{'type':Sequelize[_0xe48a('0x1')],'unique':_0xe48a('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe48a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x709b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x709b,0x7a));var _0xb709=function(_0x32e06e,_0x21a3e9){_0x32e06e=_0x32e06e-0x0;var _0x166647=_0x709b[_0x32e06e];return _0x166647;};'use strict';var Sequelize=require(_0xb709('0x0'));module[_0xb709('0x1')]={'name':{'type':Sequelize[_0xb709('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xb709('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb709('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 6e2d4bb..8848540 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 _0x3711=['apply','reject','update','then','destroy','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findAll','Reload','eml-format','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range'];(function(_0x181865,_0x2d5de0){var _0x5518c5=function(_0x16ccce){while(--_0x16ccce){_0x181865['push'](_0x181865['shift']());}};_0x5518c5(++_0x2d5de0);}(_0x3711,0x113));var _0x1371=function(_0x1b475c,_0x187300){_0x1b475c=_0x1b475c-0x0;var _0xa249f4=_0x3711[_0x1b475c];return _0xa249f4;};'use strict';var emlformat=require(_0x1371('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1371('0x1'));var jsonpatch=require(_0x1371('0x2'));var rp=require('request-promise');var moment=require(_0x1371('0x3'));var BPromise=require(_0x1371('0x4'));var Mustache=require(_0x1371('0x5'));var util=require(_0x1371('0x6'));var path=require(_0x1371('0x7'));var sox=require(_0x1371('0x8'));var csv=require(_0x1371('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1371('0xa'));var _=require(_0x1371('0xb'));var squel=require(_0x1371('0xc'));var crypto=require(_0x1371('0xd'));var jsforce=require(_0x1371('0xe'));var deskjs=require(_0x1371('0xf'));var toCsv=require(_0x1371('0x9'));var querystring=require(_0x1371('0x10'));var Papa=require(_0x1371('0x11'));var Redis=require(_0x1371('0x12'));var authService=require(_0x1371('0x13'));var qs=require(_0x1371('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1371('0x15'))('api');var utils=require(_0x1371('0x16'));var config=require(_0x1371('0x17'));var licenseUtil=require(_0x1371('0x18'));var db=require(_0x1371('0x19'))['db'];var jayson=require(_0x1371('0x1a'));var client=jayson[_0x1371('0x1b')][_0x1371('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d84d4,_0x545fe2,_0x21d6c9,_0x11cb56){return new BPromise(function(_0x4c6219,_0x355fe9){var _0x4ee9b0=_0x11cb56||client;return _0x4ee9b0[_0x1371('0x1d')](_0x5d84d4,_0x21d6c9)['then'](function(_0x204173){logger[_0x1371('0x1e')](_0x1371('0x1f'),_0x545fe2,_0x1371('0x20'));logger[_0x1371('0x21')](_0x1371('0x22'),_0x545fe2,'request\x20sent',JSON[_0x1371('0x23')](_0x204173));if(_0x204173[_0x1371('0x24')]){if(_0x204173[_0x1371('0x24')][_0x1371('0x25')]===0x1f4){logger[_0x1371('0x24')](_0x1371('0x1f'),_0x545fe2,_0x204173[_0x1371('0x24')][_0x1371('0x26')]);return _0x355fe9(_0x204173[_0x1371('0x24')][_0x1371('0x26')]);}logger[_0x1371('0x24')](_0x1371('0x1f'),_0x545fe2,_0x204173[_0x1371('0x24')][_0x1371('0x26')]);return _0x4c6219(_0x204173[_0x1371('0x24')][_0x1371('0x26')]);}else{logger[_0x1371('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x545fe2,_0x1371('0x20'));_0x4c6219(_0x204173[_0x1371('0x27')][_0x1371('0x26')]);}})['catch'](function(_0x17a30d){logger['error'](_0x1371('0x1f'),_0x545fe2,_0x17a30d);_0x355fe9(_0x17a30d);});});}function respondWithStatusCode(_0x1b1acf,_0x3e2bf5){_0x3e2bf5=_0x3e2bf5||0xcc;return function(_0x41bd29){if(_0x41bd29){return _0x1b1acf[_0x1371('0x28')](_0x3e2bf5);}return _0x1b1acf[_0x1371('0x29')](_0x3e2bf5)[_0x1371('0x2a')]();};}function respondWithResult(_0x589b7f,_0x3c7857){_0x3c7857=_0x3c7857||0xc8;return function(_0x5df2ce){if(_0x5df2ce){return _0x589b7f[_0x1371('0x29')](_0x3c7857)[_0x1371('0x2b')](_0x5df2ce);}};}function respondWithFilteredResult(_0x263067,_0x387d67){return function(_0x35eaaf){if(_0x35eaaf){var _0x2b2685=typeof _0x387d67[_0x1371('0x2c')]===_0x1371('0x2d')&&typeof _0x387d67['limit']===_0x1371('0x2d');var _0x4d693b=_0x35eaaf[_0x1371('0x2e')];var _0x53835f=_0x2b2685?0x0:_0x387d67[_0x1371('0x2c')];var _0x58b0e3=_0x2b2685?_0x35eaaf[_0x1371('0x2e')]:_0x387d67[_0x1371('0x2c')]+_0x387d67[_0x1371('0x2f')];var _0x24c1b6;if(_0x58b0e3>=_0x4d693b){_0x58b0e3=_0x4d693b;_0x24c1b6=0xc8;}else{_0x24c1b6=0xce;}_0x263067[_0x1371('0x29')](_0x24c1b6);return _0x263067['set'](_0x1371('0x30'),_0x53835f+'-'+_0x58b0e3+'/'+_0x4d693b)[_0x1371('0x2b')](_0x35eaaf);}return null;};}function patchUpdates(_0x2d4ff6){return function(_0x4d1616){try{jsonpatch[_0x1371('0x31')](_0x4d1616,_0x2d4ff6,!![]);}catch(_0x927feb){return BPromise[_0x1371('0x32')](_0x927feb);}return _0x4d1616['save']();};}function saveUpdates(_0x3180aa,_0x196665){return function(_0x15d818){if(_0x15d818){return _0x15d818[_0x1371('0x33')](_0x3180aa)[_0x1371('0x34')](function(_0x49faeb){return _0x49faeb;});}return null;};}function removeEntity(_0x1aa68a,_0x56d9c3){return function(_0x5de254){if(_0x5de254){return _0x5de254[_0x1371('0x35')]()[_0x1371('0x34')](function(){var _0x437ef0=_0x5de254['get']({'plain':!![]});var _0x12344a=_0x1371('0x36');return db[_0x1371('0x37')]['destroy']({'where':{'type':_0x12344a,'resourceId':_0x437ef0['id']}})[_0x1371('0x34')](function(){return _0x5de254;});})[_0x1371('0x34')](function(){_0x1aa68a[_0x1371('0x29')](0xcc)[_0x1371('0x2a')]();});}};}function handleEntityNotFound(_0x4b5ae8,_0x3bfb45){return function(_0x6b3fdc){if(!_0x6b3fdc){_0x4b5ae8[_0x1371('0x28')](0x194);}return _0x6b3fdc;};}function handleError(_0x1bfc95,_0x596438){_0x596438=_0x596438||0x1f4;return function(_0x4d9602){logger['error'](_0x4d9602[_0x1371('0x38')]);if(_0x4d9602['name']){delete _0x4d9602[_0x1371('0x39')];}_0x1bfc95[_0x1371('0x29')](_0x596438)[_0x1371('0x3a')](_0x4d9602);};}exports[_0x1371('0x3b')]=function(_0x61ca25,_0x49ebc3){var _0x3abf18={},_0x1cbe38={},_0x2bce96={'count':0x0,'rows':[]};var _0x2c683a=_[_0x1371('0x3c')](db[_0x1371('0x3d')][_0x1371('0x3e')],function(_0xa50814){return{'name':_0xa50814[_0x1371('0x3f')],'type':_0xa50814[_0x1371('0x40')][_0x1371('0x41')]};});_0x1cbe38[_0x1371('0x42')]=_['map'](_0x2c683a,_0x1371('0x39'));_0x1cbe38[_0x1371('0x43')]=_['keys'](_0x61ca25['query']);_0x1cbe38[_0x1371('0x44')]=_[_0x1371('0x45')](_0x1cbe38['model'],_0x1cbe38[_0x1371('0x43')]);_0x3abf18[_0x1371('0x46')]=_[_0x1371('0x45')](_0x1cbe38[_0x1371('0x42')],qs['fields'](_0x61ca25['query'][_0x1371('0x47')]));_0x3abf18[_0x1371('0x46')]=_0x3abf18[_0x1371('0x46')][_0x1371('0x48')]?_0x3abf18[_0x1371('0x46')]:_0x1cbe38[_0x1371('0x42')];if(!_0x61ca25[_0x1371('0x43')]['hasOwnProperty'](_0x1371('0x49'))){_0x3abf18['limit']=qs[_0x1371('0x2f')](_0x61ca25['query']['limit']);_0x3abf18[_0x1371('0x2c')]=qs[_0x1371('0x2c')](_0x61ca25[_0x1371('0x43')]['offset']);}_0x3abf18[_0x1371('0x4a')]=qs[_0x1371('0x4b')](_0x61ca25[_0x1371('0x43')]['sort']);_0x3abf18[_0x1371('0x4c')]=qs['filters'](_[_0x1371('0x4d')](_0x61ca25[_0x1371('0x43')],_0x1cbe38['filters']),_0x2c683a);if(_0x61ca25[_0x1371('0x43')][_0x1371('0x4e')]){_0x3abf18['where']=_[_0x1371('0x4f')](_0x3abf18[_0x1371('0x4c')],{'$or':_[_0x1371('0x3c')](_0x2c683a,function(_0x2ab38b){if(_0x2ab38b[_0x1371('0x40')]!==_0x1371('0x50')){var _0x511eb2={};_0x511eb2[_0x2ab38b[_0x1371('0x39')]]={'$like':'%'+_0x61ca25['query'][_0x1371('0x4e')]+'%'};return _0x511eb2;}})});}_0x3abf18=_[_0x1371('0x4f')]({},_0x3abf18,_0x61ca25[_0x1371('0x51')]);var _0x11b386={'where':_0x3abf18['where']};return db[_0x1371('0x3d')]['count'](_0x11b386)[_0x1371('0x34')](function(_0x505461){_0x2bce96[_0x1371('0x2e')]=_0x505461;if(_0x61ca25[_0x1371('0x43')][_0x1371('0x52')]){_0x3abf18[_0x1371('0x53')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x3abf18);})[_0x1371('0x34')](function(_0x180f0a){_0x2bce96[_0x1371('0x54')]=_0x180f0a;return _0x2bce96;})[_0x1371('0x34')](respondWithFilteredResult(_0x49ebc3,_0x3abf18))['catch'](handleError(_0x49ebc3,null));};exports[_0x1371('0x55')]=function(_0x2a7d79,_0x1d0af5){var _0x24f274={'raw':![],'where':{'id':_0x2a7d79[_0x1371('0x56')]['id']}},_0x12b2cb={};_0x12b2cb[_0x1371('0x42')]=_[_0x1371('0x57')](db['VoiceContext'][_0x1371('0x3e')]);_0x12b2cb[_0x1371('0x43')]=_[_0x1371('0x57')](_0x2a7d79[_0x1371('0x43')]);_0x12b2cb['filters']=_[_0x1371('0x45')](_0x12b2cb['model'],_0x12b2cb[_0x1371('0x43')]);_0x24f274[_0x1371('0x46')]=_[_0x1371('0x45')](_0x12b2cb['model'],qs[_0x1371('0x47')](_0x2a7d79[_0x1371('0x43')][_0x1371('0x47')]));_0x24f274[_0x1371('0x46')]=_0x24f274[_0x1371('0x46')][_0x1371('0x48')]?_0x24f274[_0x1371('0x46')]:_0x12b2cb['model'];if(_0x2a7d79[_0x1371('0x43')][_0x1371('0x52')]){_0x24f274['include']=[{'all':!![]}];}_0x24f274=_[_0x1371('0x4f')]({},_0x24f274,_0x2a7d79[_0x1371('0x51')]);return db[_0x1371('0x3d')][_0x1371('0x58')](_0x24f274)['then'](handleEntityNotFound(_0x1d0af5,null))[_0x1371('0x34')](respondWithResult(_0x1d0af5,null))[_0x1371('0x59')](handleError(_0x1d0af5,null));};exports['create']=function(_0x604c38,_0x26d30c,_0x2fe3f2){var _0x165f89;return db[_0x1371('0x3d')][_0x1371('0x5a')](_0x604c38['body'],{'raw':!![]})[_0x1371('0x34')](function(_0x2be7c8){_0x165f89=_0x2be7c8;return db[_0x1371('0x3d')]['findAll']({'raw':!![]});})[_0x1371('0x34')](function(_0x16fccb){var _0x22e3df=fs[_0x1371('0x5b')](path[_0x1371('0x5c')](config[_0x1371('0x5d')],_0x1371('0x5e')),_0x1371('0x5f'));var _0x142702=ejs[_0x1371('0x60')](_0x22e3df,{'contexts':_0x16fccb||[]});fs[_0x1371('0x61')](_0x1371('0x62'),_0x142702);})[_0x1371('0x34')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x1371('0x63')});})[_0x1371('0x34')](function(){var _0x1f84a9=_0x604c38['user']['get']({'plain':!![]});if(!_0x1f84a9)throw new Error(_0x1371('0x64'));if(_0x1f84a9['role']===_0x1371('0x65')){var _0x57ec3f=_0x165f89['get']({'plain':!![]});return db[_0x1371('0x66')]['find']({'where':{'name':_0x1371('0x36'),'userProfileId':_0x1f84a9['userProfileId']},'raw':!![]})[_0x1371('0x34')](function(_0x861182){if(_0x861182&&_0x861182[_0x1371('0x67')]===0x0){return db[_0x1371('0x37')][_0x1371('0x5a')]({'name':_0x57ec3f[_0x1371('0x39')],'resourceId':_0x57ec3f['id'],'type':_0x861182[_0x1371('0x39')],'sectionId':_0x861182['id']},{})[_0x1371('0x34')](function(){return _0x165f89;});}else{return _0x165f89;}})[_0x1371('0x59')](function(_0x2b88e4){logger[_0x1371('0x24')](_0x1371('0x68'),_0x2b88e4);throw _0x2b88e4;});}return _0x165f89;})[_0x1371('0x34')](respondWithResult(_0x26d30c,0xc9))[_0x1371('0x59')](handleError(_0x26d30c,null));};exports['update']=function(_0x39fa2e,_0x251261,_0xe201ad){var _0x4e0dd8;return db['VoiceContext'][_0x1371('0x58')]({'where':{'id':_0x39fa2e[_0x1371('0x56')]['id']}})['then'](handleEntityNotFound(_0x251261,null))[_0x1371('0x34')](saveUpdates(_0x39fa2e[_0x1371('0x69')],null))[_0x1371('0x34')](function(_0x257e1f){if(_0x257e1f){_0x4e0dd8=_0x257e1f;return db[_0x1371('0x3d')][_0x1371('0x6a')]({'raw':!![]});}})['then'](function(_0x2693e0){var _0x4bc6ac=fs['readFileSync'](path[_0x1371('0x5c')](config['root'],_0x1371('0x5e')),_0x1371('0x5f'));var _0x2da11e=ejs['render'](_0x4bc6ac,{'contexts':_0x2693e0||[]});fs[_0x1371('0x61')](_0x1371('0x62'),_0x2da11e);})[_0x1371('0x34')](function(){return respondWithRpcPromise(_0x1371('0x6b'),_0x1371('0x33'),{'module':_0x1371('0x63')});})[_0x1371('0x34')](function(){return _0x4e0dd8;})[_0x1371('0x34')](respondWithResult(_0x251261,null))[_0x1371('0x59')](handleError(_0x251261,null));};exports[_0x1371('0x35')]=function(_0x5b764e,_0x2379b8,_0x46f853){var _0x30c884;return db['VoiceContext'][_0x1371('0x58')]({'where':{'id':_0x5b764e['params']['id']}})['then'](handleEntityNotFound(_0x2379b8,null))['then'](removeEntity(_0x2379b8,null))[_0x1371('0x34')](function(){return db[_0x1371('0x3d')][_0x1371('0x6a')]({'raw':!![]});})[_0x1371('0x34')](function(_0xa205e7){var _0x543fb6=fs[_0x1371('0x5b')](path[_0x1371('0x5c')](config[_0x1371('0x5d')],_0x1371('0x5e')),_0x1371('0x5f'));var _0x34be4e=ejs[_0x1371('0x60')](_0x543fb6,{'contexts':_0xa205e7});fs[_0x1371('0x61')](_0x1371('0x62'),_0x34be4e);return respondWithRpcPromise('Reload',_0x1371('0x35'),{'module':_0x1371('0x63')});})[_0x1371('0x59')](handleError(_0x2379b8,null));}; \ No newline at end of file +var _0x6e92=['sort','where','pick','filter','merge','options','count','includeAll','findAll','show','params','include','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','set','Content-Range','apply','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x6e92,0x155));var _0x26e9=function(_0x33aefe,_0x371ccd){_0x33aefe=_0x33aefe-0x0;var _0x471d19=_0x6e92[_0x33aefe];return _0x471d19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26e9('0x0'));var zipdir=require(_0x26e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26e9('0x2'));var moment=require(_0x26e9('0x3'));var BPromise=require(_0x26e9('0x4'));var Mustache=require(_0x26e9('0x5'));var util=require('util');var path=require(_0x26e9('0x6'));var sox=require(_0x26e9('0x7'));var csv=require(_0x26e9('0x8'));var ejs=require(_0x26e9('0x9'));var fs=require('fs');var fs_extra=require(_0x26e9('0xa'));var _=require(_0x26e9('0xb'));var squel=require('squel');var crypto=require(_0x26e9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x26e9('0xd'));var toCsv=require(_0x26e9('0x8'));var querystring=require(_0x26e9('0xe'));var Papa=require(_0x26e9('0xf'));var Redis=require(_0x26e9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x26e9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26e9('0x12'))(_0x26e9('0x13'));var utils=require(_0x26e9('0x14'));var config=require(_0x26e9('0x15'));var licenseUtil=require(_0x26e9('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x26e9('0x17'));var client=jayson[_0x26e9('0x18')][_0x26e9('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5f247c,_0x81a355,_0x12f702,_0xf222de){return new BPromise(function(_0x4480dd,_0x3b669d){var _0x35344c=_0xf222de||client;return _0x35344c['request'](_0x5f247c,_0x12f702)[_0x26e9('0x1a')](function(_0x11998c){logger[_0x26e9('0x1b')](_0x26e9('0x1c'),_0x81a355,_0x26e9('0x1d'));logger[_0x26e9('0x1e')](_0x26e9('0x1f'),_0x81a355,_0x26e9('0x1d'),JSON[_0x26e9('0x20')](_0x11998c));if(_0x11998c[_0x26e9('0x21')]){if(_0x11998c['error'][_0x26e9('0x22')]===0x1f4){logger[_0x26e9('0x21')](_0x26e9('0x1c'),_0x81a355,_0x11998c['error'][_0x26e9('0x23')]);return _0x3b669d(_0x11998c[_0x26e9('0x21')][_0x26e9('0x23')]);}logger[_0x26e9('0x21')](_0x26e9('0x1c'),_0x81a355,_0x11998c['error'][_0x26e9('0x23')]);return _0x4480dd(_0x11998c[_0x26e9('0x21')]['message']);}else{logger[_0x26e9('0x1b')](_0x26e9('0x1c'),_0x81a355,_0x26e9('0x1d'));_0x4480dd(_0x11998c[_0x26e9('0x24')]['message']);}})[_0x26e9('0x25')](function(_0x3e06d7){logger['error'](_0x26e9('0x1c'),_0x81a355,_0x3e06d7);_0x3b669d(_0x3e06d7);});});}function respondWithStatusCode(_0x258efd,_0x4f2f1){_0x4f2f1=_0x4f2f1||0xcc;return function(_0x404037){if(_0x404037){return _0x258efd[_0x26e9('0x26')](_0x4f2f1);}return _0x258efd[_0x26e9('0x27')](_0x4f2f1)['end']();};}function respondWithResult(_0x4ace5d,_0x5f3b59){_0x5f3b59=_0x5f3b59||0xc8;return function(_0x15bbac){if(_0x15bbac){return _0x4ace5d['status'](_0x5f3b59)[_0x26e9('0x28')](_0x15bbac);}};}function respondWithFilteredResult(_0x349e47,_0x1655ce){return function(_0x337b57){if(_0x337b57){var _0x12f2ed=typeof _0x1655ce['offset']===_0x26e9('0x29')&&typeof _0x1655ce[_0x26e9('0x2a')]===_0x26e9('0x29');var _0x51d238=_0x337b57['count'];var _0x3b76bf=_0x12f2ed?0x0:_0x1655ce['offset'];var _0x51d1a0=_0x12f2ed?_0x337b57['count']:_0x1655ce['offset']+_0x1655ce[_0x26e9('0x2a')];var _0x152867;if(_0x51d1a0>=_0x51d238){_0x51d1a0=_0x51d238;_0x152867=0xc8;}else{_0x152867=0xce;}_0x349e47[_0x26e9('0x27')](_0x152867);return _0x349e47[_0x26e9('0x2b')](_0x26e9('0x2c'),_0x3b76bf+'-'+_0x51d1a0+'/'+_0x51d238)[_0x26e9('0x28')](_0x337b57);}return null;};}function patchUpdates(_0x2e2c73){return function(_0x30aeb0){try{jsonpatch[_0x26e9('0x2d')](_0x30aeb0,_0x2e2c73,!![]);}catch(_0x28dea0){return BPromise['reject'](_0x28dea0);}return _0x30aeb0['save']();};}function saveUpdates(_0x358055,_0x5b23a0){return function(_0x13d86b){if(_0x13d86b){return _0x13d86b['update'](_0x358055)[_0x26e9('0x1a')](function(_0x50c5d5){return _0x50c5d5;});}return null;};}function removeEntity(_0x4df8a2,_0x283053){return function(_0x23149e){if(_0x23149e){return _0x23149e[_0x26e9('0x2e')]()['then'](function(){var _0x5f1006=_0x23149e[_0x26e9('0x2f')]({'plain':!![]});var _0x2b5339=_0x26e9('0x30');return db[_0x26e9('0x31')][_0x26e9('0x2e')]({'where':{'type':_0x2b5339,'resourceId':_0x5f1006['id']}})[_0x26e9('0x1a')](function(){return _0x23149e;});})[_0x26e9('0x1a')](function(){_0x4df8a2[_0x26e9('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5284b7,_0xf300a7){return function(_0x5a0fe6){if(!_0x5a0fe6){_0x5284b7['sendStatus'](0x194);}return _0x5a0fe6;};}function handleError(_0x5998a3,_0x232935){_0x232935=_0x232935||0x1f4;return function(_0x5db804){logger[_0x26e9('0x21')](_0x5db804['stack']);if(_0x5db804[_0x26e9('0x32')]){delete _0x5db804[_0x26e9('0x32')];}_0x5998a3[_0x26e9('0x27')](_0x232935)[_0x26e9('0x33')](_0x5db804);};}exports[_0x26e9('0x34')]=function(_0xbe299f,_0x23abea){var _0x5857a5={},_0x173412={},_0x2a7e73={'count':0x0,'rows':[]};var _0x3fe724=_[_0x26e9('0x35')](db[_0x26e9('0x36')][_0x26e9('0x37')],function(_0x16254d){return{'name':_0x16254d[_0x26e9('0x38')],'type':_0x16254d[_0x26e9('0x39')][_0x26e9('0x3a')]};});_0x173412['model']=_[_0x26e9('0x35')](_0x3fe724,_0x26e9('0x32'));_0x173412[_0x26e9('0x3b')]=_[_0x26e9('0x3c')](_0xbe299f['query']);_0x173412[_0x26e9('0x3d')]=_['intersection'](_0x173412[_0x26e9('0x3e')],_0x173412['query']);_0x5857a5[_0x26e9('0x3f')]=_[_0x26e9('0x40')](_0x173412[_0x26e9('0x3e')],qs[_0x26e9('0x41')](_0xbe299f[_0x26e9('0x3b')][_0x26e9('0x41')]));_0x5857a5[_0x26e9('0x3f')]=_0x5857a5['attributes'][_0x26e9('0x42')]?_0x5857a5[_0x26e9('0x3f')]:_0x173412[_0x26e9('0x3e')];if(!_0xbe299f[_0x26e9('0x3b')][_0x26e9('0x43')](_0x26e9('0x44'))){_0x5857a5[_0x26e9('0x2a')]=qs[_0x26e9('0x2a')](_0xbe299f[_0x26e9('0x3b')][_0x26e9('0x2a')]);_0x5857a5[_0x26e9('0x45')]=qs['offset'](_0xbe299f[_0x26e9('0x3b')][_0x26e9('0x45')]);}_0x5857a5[_0x26e9('0x46')]=qs['sort'](_0xbe299f['query'][_0x26e9('0x47')]);_0x5857a5[_0x26e9('0x48')]=qs['filters'](_[_0x26e9('0x49')](_0xbe299f[_0x26e9('0x3b')],_0x173412['filters']),_0x3fe724);if(_0xbe299f[_0x26e9('0x3b')][_0x26e9('0x4a')]){_0x5857a5[_0x26e9('0x48')]=_[_0x26e9('0x4b')](_0x5857a5[_0x26e9('0x48')],{'$or':_[_0x26e9('0x35')](_0x3fe724,function(_0xed45ad){if(_0xed45ad[_0x26e9('0x39')]!=='VIRTUAL'){var _0x4ece06={};_0x4ece06[_0xed45ad['name']]={'$like':'%'+_0xbe299f[_0x26e9('0x3b')][_0x26e9('0x4a')]+'%'};return _0x4ece06;}})});}_0x5857a5=_[_0x26e9('0x4b')]({},_0x5857a5,_0xbe299f[_0x26e9('0x4c')]);var _0x1dea61={'where':_0x5857a5['where']};return db['VoiceContext'][_0x26e9('0x4d')](_0x1dea61)[_0x26e9('0x1a')](function(_0x293405){_0x2a7e73[_0x26e9('0x4d')]=_0x293405;if(_0xbe299f[_0x26e9('0x3b')][_0x26e9('0x4e')]){_0x5857a5['include']=[{'all':!![]}];}return db[_0x26e9('0x36')][_0x26e9('0x4f')](_0x5857a5);})['then'](function(_0x6fb13d){_0x2a7e73['rows']=_0x6fb13d;return _0x2a7e73;})[_0x26e9('0x1a')](respondWithFilteredResult(_0x23abea,_0x5857a5))[_0x26e9('0x25')](handleError(_0x23abea,null));};exports[_0x26e9('0x50')]=function(_0x587548,_0xc47dbf){var _0x3b7cc2={'raw':![],'where':{'id':_0x587548[_0x26e9('0x51')]['id']}},_0x576a20={};_0x576a20[_0x26e9('0x3e')]=_[_0x26e9('0x3c')](db[_0x26e9('0x36')][_0x26e9('0x37')]);_0x576a20[_0x26e9('0x3b')]=_[_0x26e9('0x3c')](_0x587548['query']);_0x576a20[_0x26e9('0x3d')]=_['intersection'](_0x576a20[_0x26e9('0x3e')],_0x576a20['query']);_0x3b7cc2[_0x26e9('0x3f')]=_[_0x26e9('0x40')](_0x576a20[_0x26e9('0x3e')],qs[_0x26e9('0x41')](_0x587548[_0x26e9('0x3b')]['fields']));_0x3b7cc2['attributes']=_0x3b7cc2[_0x26e9('0x3f')][_0x26e9('0x42')]?_0x3b7cc2[_0x26e9('0x3f')]:_0x576a20[_0x26e9('0x3e')];if(_0x587548[_0x26e9('0x3b')][_0x26e9('0x4e')]){_0x3b7cc2[_0x26e9('0x52')]=[{'all':!![]}];}_0x3b7cc2=_[_0x26e9('0x4b')]({},_0x3b7cc2,_0x587548[_0x26e9('0x4c')]);return db['VoiceContext'][_0x26e9('0x53')](_0x3b7cc2)[_0x26e9('0x1a')](handleEntityNotFound(_0xc47dbf,null))[_0x26e9('0x1a')](respondWithResult(_0xc47dbf,null))['catch'](handleError(_0xc47dbf,null));};exports['create']=function(_0xc3d628,_0x2b2454,_0x41c875){var _0x2b655a;return db[_0x26e9('0x36')][_0x26e9('0x54')](_0xc3d628['body'],{'raw':!![]})[_0x26e9('0x1a')](function(_0x146a00){_0x2b655a=_0x146a00;return db['VoiceContext'][_0x26e9('0x4f')]({'raw':!![]});})[_0x26e9('0x1a')](function(_0x44a92a){var _0x5e1409=fs[_0x26e9('0x55')](path[_0x26e9('0x56')](config[_0x26e9('0x57')],_0x26e9('0x58')),_0x26e9('0x59'));var _0x14590b=ejs[_0x26e9('0x5a')](_0x5e1409,{'contexts':_0x44a92a||[]});fs[_0x26e9('0x5b')](_0x26e9('0x5c'),_0x14590b);})[_0x26e9('0x1a')](function(){return respondWithRpcPromise(_0x26e9('0x5d'),_0x26e9('0x54'),{'module':_0x26e9('0x5e')});})[_0x26e9('0x1a')](function(){var _0x1d4c8c=_0xc3d628[_0x26e9('0x5f')][_0x26e9('0x2f')]({'plain':!![]});if(!_0x1d4c8c)throw new Error(_0x26e9('0x60'));if(_0x1d4c8c[_0x26e9('0x61')]===_0x26e9('0x5f')){var _0x5cc628=_0x2b655a[_0x26e9('0x2f')]({'plain':!![]});return db[_0x26e9('0x62')][_0x26e9('0x53')]({'where':{'name':_0x26e9('0x30'),'userProfileId':_0x1d4c8c[_0x26e9('0x63')]},'raw':!![]})['then'](function(_0x4478a4){if(_0x4478a4&&_0x4478a4['autoAssociation']===0x0){return db['UserProfileResource'][_0x26e9('0x54')]({'name':_0x5cc628[_0x26e9('0x32')],'resourceId':_0x5cc628['id'],'type':_0x4478a4[_0x26e9('0x32')],'sectionId':_0x4478a4['id']},{})['then'](function(){return _0x2b655a;});}else{return _0x2b655a;}})[_0x26e9('0x25')](function(_0x246f8c){logger[_0x26e9('0x21')](_0x26e9('0x64'),_0x246f8c);throw _0x246f8c;});}return _0x2b655a;})[_0x26e9('0x1a')](respondWithResult(_0x2b2454,0xc9))[_0x26e9('0x25')](handleError(_0x2b2454,null));};exports[_0x26e9('0x65')]=function(_0x38a4cb,_0x5ccffe,_0x4f4863){var _0x5a640b;return db[_0x26e9('0x36')][_0x26e9('0x53')]({'where':{'id':_0x38a4cb['params']['id']}})[_0x26e9('0x1a')](handleEntityNotFound(_0x5ccffe,null))[_0x26e9('0x1a')](saveUpdates(_0x38a4cb[_0x26e9('0x66')],null))[_0x26e9('0x1a')](function(_0x2dcc36){if(_0x2dcc36){_0x5a640b=_0x2dcc36;return db['VoiceContext'][_0x26e9('0x4f')]({'raw':!![]});}})[_0x26e9('0x1a')](function(_0x5c596f){var _0x1ae2b0=fs[_0x26e9('0x55')](path[_0x26e9('0x56')](config['root'],_0x26e9('0x58')),_0x26e9('0x59'));var _0x531776=ejs[_0x26e9('0x5a')](_0x1ae2b0,{'contexts':_0x5c596f||[]});fs['writeFileSync'](_0x26e9('0x5c'),_0x531776);})['then'](function(){return respondWithRpcPromise(_0x26e9('0x5d'),_0x26e9('0x65'),{'module':'chan_sip.so'});})['then'](function(){return _0x5a640b;})[_0x26e9('0x1a')](respondWithResult(_0x5ccffe,null))[_0x26e9('0x25')](handleError(_0x5ccffe,null));};exports[_0x26e9('0x2e')]=function(_0x4991a6,_0x5e2e04,_0x3991a1){var _0x227afd;return db['VoiceContext'][_0x26e9('0x53')]({'where':{'id':_0x4991a6[_0x26e9('0x51')]['id']}})[_0x26e9('0x1a')](handleEntityNotFound(_0x5e2e04,null))[_0x26e9('0x1a')](removeEntity(_0x5e2e04,null))[_0x26e9('0x1a')](function(){return db[_0x26e9('0x36')]['findAll']({'raw':!![]});})[_0x26e9('0x1a')](function(_0x35e472){var _0x4b943b=fs['readFileSync'](path[_0x26e9('0x56')](config[_0x26e9('0x57')],_0x26e9('0x58')),_0x26e9('0x59'));var _0x884d7e=ejs['render'](_0x4b943b,{'contexts':_0x35e472});fs[_0x26e9('0x5b')](_0x26e9('0x5c'),_0x884d7e);return respondWithRpcPromise(_0x26e9('0x5d'),_0x26e9('0x2e'),{'module':_0x26e9('0x5e')});})[_0x26e9('0x25')](handleError(_0x5e2e04,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index b7d46b6..763e0ca 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 _0xd709=['../../config/logger','api','bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x13cf95,_0x48768a){var _0xd2ecf7=function(_0x231ba2){while(--_0x231ba2){_0x13cf95['push'](_0x13cf95['shift']());}};_0xd2ecf7(++_0x48768a);}(_0xd709,0x104));var _0x9d70=function(_0x537bd8,_0x2b1156){_0x537bd8=_0x537bd8-0x0;var _0x5bcee8=_0xd709[_0x537bd8];return _0x5bcee8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d70('0x0'))(_0x9d70('0x1'));var moment=require('moment');var BPromise=require(_0x9d70('0x2'));var rp=require(_0x9d70('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9d70('0x4'));var attributes=require(_0x9d70('0x5'));module[_0x9d70('0x6')]=function(_0x3babb0,_0x144270){return _0x3babb0[_0x9d70('0x7')](_0x9d70('0x8'),attributes,{'tableName':_0x9d70('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1ba=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf1ba,0x144));var _0xaf1b=function(_0x49d06a,_0x103da8){_0x49d06a=_0x49d06a-0x0;var _0x4476d7=_0xf1ba[_0x49d06a];return _0x4476d7;};'use strict';var _=require(_0xaf1b('0x0'));var util=require(_0xaf1b('0x1'));var logger=require(_0xaf1b('0x2'))(_0xaf1b('0x3'));var moment=require(_0xaf1b('0x4'));var BPromise=require(_0xaf1b('0x5'));var rp=require(_0xaf1b('0x6'));var fs=require('fs');var path=require(_0xaf1b('0x7'));var rimraf=require(_0xaf1b('0x8'));var config=require(_0xaf1b('0x9'));var attributes=require(_0xaf1b('0xa'));module['exports']=function(_0x479515,_0xd74a8f){return _0x479515[_0xaf1b('0xb')](_0xaf1b('0xc'),attributes,{'tableName':_0xaf1b('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 95e4d96..54ec8bb 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 _0x594d=['VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceContext,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x594d,0x92));var _0xd594=function(_0x1c71b5,_0x40b8b9){_0x1c71b5=_0x1c71b5-0x0;var _0x31071c=_0x594d[_0x1c71b5];return _0x31071c;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1c64,_0x446711,_0xeedad0){return new BPromise(function(_0x20325a,_0x20718a){return client[_0xd594('0x9')](_0x3b1c64,_0xeedad0)[_0xd594('0xa')](function(_0xf3043e){logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');logger[_0xd594('0xd')](_0xd594('0xe'),_0x446711,_0xd594('0xf'),JSON['stringify'](_0xf3043e));if(_0xf3043e[_0xd594('0x10')]){if(_0xf3043e[_0xd594('0x10')][_0xd594('0x11')]===0x1f4){logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e[_0xd594('0x10')][_0xd594('0x12')]);return _0x20718a(_0xf3043e['error']['message']);}logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e['error'][_0xd594('0x12')]);return _0x20325a(_0xf3043e['error'][_0xd594('0x12')]);}else{logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');_0x20325a(_0xf3043e[_0xd594('0x13')]['message']);}})['catch'](function(_0x2a5f17){logger[_0xd594('0x10')]('VoiceContext,\x20%s,\x20%s',_0x446711,_0x2a5f17);_0x20718a(_0x2a5f17);});});} \ No newline at end of file +var _0x1123=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x398f35,_0xa920e4){var _0xe4aee8=function(_0x2a1237){while(--_0x2a1237){_0x398f35['push'](_0x398f35['shift']());}};_0xe4aee8(++_0xa920e4);}(_0x1123,0x118));var _0x3112=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1123[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3112('0x0'));var BPromise=require('bluebird');var rs=require(_0x3112('0x1'));var fs=require('fs');var Redis=require(_0x3112('0x2'));var db=require(_0x3112('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3112('0x4'));var config=require(_0x3112('0x5'));var jayson=require(_0x3112('0x6'));var client=jayson[_0x3112('0x7')][_0x3112('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e2b5c,_0x3bee38,_0x3f7ae4){return new BPromise(function(_0x3cd83c,_0x4849f9){return client[_0x3112('0x9')](_0x3e2b5c,_0x3f7ae4)[_0x3112('0xa')](function(_0x39b75b){logger[_0x3112('0xb')](_0x3112('0xc'),_0x3bee38,_0x3112('0xd'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'),JSON[_0x3112('0xe')](_0x39b75b));if(_0x39b75b[_0x3112('0xf')]){if(_0x39b75b[_0x3112('0xf')][_0x3112('0x10')]===0x1f4){logger['error'](_0x3112('0xc'),_0x3bee38,_0x39b75b['error']['message']);return _0x4849f9(_0x39b75b[_0x3112('0xf')][_0x3112('0x11')]);}logger[_0x3112('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3bee38,_0x39b75b['error'][_0x3112('0x11')]);return _0x3cd83c(_0x39b75b['error'][_0x3112('0x11')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'));_0x3cd83c(_0x39b75b[_0x3112('0x12')]['message']);}})[_0x3112('0x13')](function(_0x3f5cfd){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3bee38,_0x3f5cfd);_0x4849f9(_0x3f5cfd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b04dd1d..a48a39f 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 _0xfa20=['get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','/describe','describe'];(function(_0x27d124,_0x36b048){var _0x34360e=function(_0x5ecab3){while(--_0x5ecab3){_0x27d124['push'](_0x27d124['shift']());}};_0x34360e(++_0x36b048);}(_0xfa20,0x141));var _0x0fa2=function(_0x2adfbd,_0x486dc0){_0x2adfbd=_0x2adfbd-0x0;var _0x22620c=_0xfa20[_0x2adfbd];return _0x22620c;};'use strict';var multer=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var path=require(_0x0fa2('0x2'));var timeout=require(_0x0fa2('0x3'));var express=require(_0x0fa2('0x4'));var router=express[_0x0fa2('0x5')]();var fs_extra=require(_0x0fa2('0x6'));var auth=require(_0x0fa2('0x7'));var interaction=require(_0x0fa2('0x8'));var config=require(_0x0fa2('0x9'));var controller=require(_0x0fa2('0xa'));router['get']('/',auth[_0x0fa2('0xb')](),controller[_0x0fa2('0xc')]);router['get'](_0x0fa2('0xd'),auth[_0x0fa2('0xb')](),controller[_0x0fa2('0xe')]);router[_0x0fa2('0xf')](_0x0fa2('0x10'),auth[_0x0fa2('0xb')](),controller[_0x0fa2('0x11')]);router[_0x0fa2('0x12')]('/',auth[_0x0fa2('0xb')](),controller[_0x0fa2('0x13')]);router['put'](_0x0fa2('0x10'),auth[_0x0fa2('0xb')](),controller[_0x0fa2('0x14')]);router[_0x0fa2('0x15')](_0x0fa2('0x10'),auth[_0x0fa2('0xb')](),controller[_0x0fa2('0x16')]);module[_0x0fa2('0x17')]=router; \ No newline at end of file +var _0xd20f=['put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xd20f,0xbf));var _0xfd20=function(_0x41794f,_0x5b69df){_0x41794f=_0x41794f-0x0;var _0x450f91=_0xd20f[_0x41794f];return _0x450f91;};'use strict';var multer=require(_0xfd20('0x0'));var util=require(_0xfd20('0x1'));var path=require('path');var timeout=require(_0xfd20('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfd20('0x3'));var auth=require(_0xfd20('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xfd20('0x5')](),controller[_0xfd20('0x6')]);router[_0xfd20('0x7')](_0xfd20('0x8'),auth[_0xfd20('0x5')](),controller[_0xfd20('0x9')]);router[_0xfd20('0x7')](_0xfd20('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfd20('0xb')]('/',auth[_0xfd20('0x5')](),controller[_0xfd20('0xc')]);router[_0xfd20('0xd')](_0xfd20('0xa'),auth[_0xfd20('0x5')](),controller['update']);router[_0xfd20('0xe')](_0xfd20('0xa'),auth[_0xfd20('0x5')](),controller[_0xfd20('0xf')]);module[_0xfd20('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0c265bc..4da7d9f 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 _0xe14d=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x2d0953,_0x30bcf9){var _0x1e824a=function(_0x4ec9f1){while(--_0x4ec9f1){_0x2d0953['push'](_0x2d0953['shift']());}};_0x1e824a(++_0x30bcf9);}(_0xe14d,0x1ee));var _0xde14=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe14d[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'privilege':{'type':Sequelize[_0xde14('0x2')]},'channel':{'type':Sequelize[_0xde14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'calleridnum':{'type':Sequelize[_0xde14('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'connectedlinename':{'type':Sequelize[_0xde14('0x2')]},'language':{'type':Sequelize[_0xde14('0x2')]},'accountcode':{'type':Sequelize[_0xde14('0x2')]},'context':{'type':Sequelize[_0xde14('0x2')]},'exten':{'type':Sequelize[_0xde14('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xde14('0x2')]},'destchannel':{'type':Sequelize[_0xde14('0x2')]},'destchannelstate':{'type':Sequelize[_0xde14('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xde14('0x2')]},'destcalleridname':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xde14('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xde14('0x2')]},'destcontext':{'type':Sequelize[_0xde14('0x2')]},'destexten':{'type':Sequelize[_0xde14('0x2')]},'destpriority':{'type':Sequelize[_0xde14('0x3')]},'destuniqueid':{'type':Sequelize[_0xde14('0x2')]},'destlinkedid':{'type':Sequelize[_0xde14('0x2')]},'dialstring':{'type':Sequelize[_0xde14('0x2')]},'dialstatus':{'type':Sequelize[_0xde14('0x2')]},'starttime':{'type':Sequelize[_0xde14('0x4')]},'answertime':{'type':Sequelize[_0xde14('0x4')]},'endtime':{'type':Sequelize[_0xde14('0x4')]},'lastevent':{'type':Sequelize[_0xde14('0x2')],'comment':_0xde14('0x5')},'routeId':{'type':Sequelize[_0xde14('0x3')]},'duration':{'type':Sequelize[_0xde14('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x34ecbf,_0x210898){var _0x115f8a=function(_0x559567){while(--_0x559567){_0x34ecbf['push'](_0x34ecbf['shift']());}};_0x115f8a(++_0x210898);}(_0x8ef6,0xf2));var _0x68ef=function(_0x47bb69,_0x4a2ea1){_0x47bb69=_0x47bb69-0x0;var _0x485ba8=_0x8ef6[_0x47bb69];return _0x485ba8;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5b9abec..2b8c6d0 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 _0xed0c=['then','destroy','end','stack','index','map','VoiceDialReport','rawAttributes','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xed0c,0xbe));var _0xced0=function(_0xc1fc49,_0x31601c){_0xc1fc49=_0xc1fc49-0x0;var _0x6c4f23=_0xed0c[_0xc1fc49];return _0x6c4f23;};'use strict';var emlformat=require(_0xced0('0x0'));var rimraf=require(_0xced0('0x1'));var zipdir=require(_0xced0('0x2'));var jsonpatch=require(_0xced0('0x3'));var rp=require(_0xced0('0x4'));var moment=require(_0xced0('0x5'));var BPromise=require(_0xced0('0x6'));var Mustache=require(_0xced0('0x7'));var util=require(_0xced0('0x8'));var path=require('path');var sox=require(_0xced0('0x9'));var csv=require(_0xced0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xced0('0xb'));var _=require('lodash');var squel=require(_0xced0('0xc'));var crypto=require(_0xced0('0xd'));var jsforce=require(_0xced0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xced0('0xa'));var querystring=require(_0xced0('0xf'));var Papa=require(_0xced0('0x10'));var Redis=require(_0xced0('0x11'));var authService=require(_0xced0('0x12'));var qs=require(_0xced0('0x13'));var as=require(_0xced0('0x14'));var hardwareService=require(_0xced0('0x15'));var logger=require('../../config/logger')(_0xced0('0x16'));var utils=require(_0xced0('0x17'));var config=require(_0xced0('0x18'));var licenseUtil=require(_0xced0('0x19'));var db=require(_0xced0('0x1a'))['db'];function respondWithStatusCode(_0x5611f0,_0x3e18bd){_0x3e18bd=_0x3e18bd||0xcc;return function(_0x554b9a){if(_0x554b9a){return _0x5611f0[_0xced0('0x1b')](_0x3e18bd);}return _0x5611f0[_0xced0('0x1c')](_0x3e18bd)['end']();};}function respondWithResult(_0x1be8c9,_0x418749){_0x418749=_0x418749||0xc8;return function(_0x27b686){if(_0x27b686){return _0x1be8c9[_0xced0('0x1c')](_0x418749)[_0xced0('0x1d')](_0x27b686);}};}function respondWithFilteredResult(_0x2db4ae,_0x10bcac){return function(_0x494cec){if(_0x494cec){var _0x4e4463=typeof _0x10bcac[_0xced0('0x1e')]===_0xced0('0x1f')&&typeof _0x10bcac[_0xced0('0x20')]==='undefined';var _0x278114=_0x494cec['count'];var _0x177c69=_0x4e4463?0x0:_0x10bcac[_0xced0('0x1e')];var _0x298d76=_0x4e4463?_0x494cec[_0xced0('0x21')]:_0x10bcac['offset']+_0x10bcac[_0xced0('0x20')];var _0x278373;if(_0x298d76>=_0x278114){_0x298d76=_0x278114;_0x278373=0xc8;}else{_0x278373=0xce;}_0x2db4ae[_0xced0('0x1c')](_0x278373);return _0x2db4ae[_0xced0('0x22')](_0xced0('0x23'),_0x177c69+'-'+_0x298d76+'/'+_0x278114)[_0xced0('0x1d')](_0x494cec);}return null;};}function patchUpdates(_0x173486){return function(_0x1af389){try{jsonpatch[_0xced0('0x24')](_0x1af389,_0x173486,!![]);}catch(_0x284eae){return BPromise['reject'](_0x284eae);}return _0x1af389['save']();};}function saveUpdates(_0x3533e7,_0x2a5cfe){return function(_0x401930){if(_0x401930){return _0x401930[_0xced0('0x25')](_0x3533e7)[_0xced0('0x26')](function(_0x193458){return _0x193458;});}return null;};}function removeEntity(_0x599747,_0x51db86){return function(_0xa40eee){if(_0xa40eee){return _0xa40eee[_0xced0('0x27')]()['then'](function(){_0x599747[_0xced0('0x1c')](0xcc)[_0xced0('0x28')]();});}};}function handleEntityNotFound(_0x418d31,_0x45a8a7){return function(_0x40ca91){if(!_0x40ca91){_0x418d31[_0xced0('0x1b')](0x194);}return _0x40ca91;};}function handleError(_0x2eac0c,_0x142f45){_0x142f45=_0x142f45||0x1f4;return function(_0x41c3a0){logger['error'](_0x41c3a0[_0xced0('0x29')]);if(_0x41c3a0['name']){delete _0x41c3a0['name'];}_0x2eac0c['status'](_0x142f45)['send'](_0x41c3a0);};}exports[_0xced0('0x2a')]=function(_0xa9fa6a,_0x344b5f){var _0x5ecd88={},_0x1235fa={},_0x130881={'count':0x0,'rows':[]};var _0x357428=_[_0xced0('0x2b')](db[_0xced0('0x2c')][_0xced0('0x2d')],function(_0x4d8c8b){return{'name':_0x4d8c8b['fieldName'],'type':_0x4d8c8b[_0xced0('0x2e')][_0xced0('0x2f')]};});_0x1235fa[_0xced0('0x30')]=_[_0xced0('0x2b')](_0x357428,_0xced0('0x31'));_0x1235fa[_0xced0('0x32')]=_[_0xced0('0x33')](_0xa9fa6a[_0xced0('0x32')]);_0x1235fa['filters']=_[_0xced0('0x34')](_0x1235fa[_0xced0('0x30')],_0x1235fa[_0xced0('0x32')]);_0x5ecd88[_0xced0('0x35')]=_[_0xced0('0x34')](_0x1235fa['model'],qs['fields'](_0xa9fa6a[_0xced0('0x32')][_0xced0('0x36')]));_0x5ecd88[_0xced0('0x35')]=_0x5ecd88[_0xced0('0x35')][_0xced0('0x37')]?_0x5ecd88[_0xced0('0x35')]:_0x1235fa[_0xced0('0x30')];if(!_0xa9fa6a[_0xced0('0x32')][_0xced0('0x38')](_0xced0('0x39'))){_0x5ecd88[_0xced0('0x20')]=qs[_0xced0('0x20')](_0xa9fa6a[_0xced0('0x32')][_0xced0('0x20')]);_0x5ecd88[_0xced0('0x1e')]=qs[_0xced0('0x1e')](_0xa9fa6a[_0xced0('0x32')][_0xced0('0x1e')]);}_0x5ecd88['order']=qs[_0xced0('0x3a')](_0xa9fa6a[_0xced0('0x32')][_0xced0('0x3a')]);_0x5ecd88[_0xced0('0x3b')]=qs[_0xced0('0x3c')](_[_0xced0('0x3d')](_0xa9fa6a[_0xced0('0x32')],_0x1235fa[_0xced0('0x3c')]),_0x357428);if(_0xa9fa6a[_0xced0('0x32')][_0xced0('0x3e')]){_0x5ecd88[_0xced0('0x3b')]=_[_0xced0('0x3f')](_0x5ecd88[_0xced0('0x3b')],{'$or':_[_0xced0('0x2b')](_0x357428,function(_0x13da0f){if(_0x13da0f[_0xced0('0x2e')]!==_0xced0('0x40')){var _0x15208b={};_0x15208b[_0x13da0f[_0xced0('0x31')]]={'$like':'%'+_0xa9fa6a['query'][_0xced0('0x3e')]+'%'};return _0x15208b;}})});}_0x5ecd88=_[_0xced0('0x3f')]({},_0x5ecd88,_0xa9fa6a[_0xced0('0x41')]);var _0x388acd={'where':_0x5ecd88[_0xced0('0x3b')]};return db[_0xced0('0x2c')][_0xced0('0x21')](_0x388acd)[_0xced0('0x26')](function(_0x38c810){_0x130881[_0xced0('0x21')]=_0x38c810;if(_0xa9fa6a[_0xced0('0x32')][_0xced0('0x42')]){_0x5ecd88[_0xced0('0x43')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xced0('0x44')](_0x5ecd88);})[_0xced0('0x26')](function(_0xef9ac1){_0x130881[_0xced0('0x45')]=_0xef9ac1;return _0x130881;})[_0xced0('0x26')](respondWithFilteredResult(_0x344b5f,_0x5ecd88))[_0xced0('0x46')](handleError(_0x344b5f,null));};exports['show']=function(_0x400d28,_0x4a4385){var _0x5f3d29={'raw':!![],'where':{'id':_0x400d28[_0xced0('0x47')]['id']}},_0x8a9355={};_0x8a9355[_0xced0('0x30')]=_[_0xced0('0x33')](db[_0xced0('0x2c')][_0xced0('0x2d')]);_0x8a9355[_0xced0('0x32')]=_['keys'](_0x400d28['query']);_0x8a9355[_0xced0('0x3c')]=_[_0xced0('0x34')](_0x8a9355[_0xced0('0x30')],_0x8a9355['query']);_0x5f3d29[_0xced0('0x35')]=_[_0xced0('0x34')](_0x8a9355[_0xced0('0x30')],qs[_0xced0('0x36')](_0x400d28[_0xced0('0x32')][_0xced0('0x36')]));_0x5f3d29[_0xced0('0x35')]=_0x5f3d29[_0xced0('0x35')][_0xced0('0x37')]?_0x5f3d29['attributes']:_0x8a9355[_0xced0('0x30')];if(_0x400d28[_0xced0('0x32')][_0xced0('0x42')]){_0x5f3d29[_0xced0('0x43')]=[{'all':!![]}];}_0x5f3d29=_['merge']({},_0x5f3d29,_0x400d28[_0xced0('0x41')]);return db[_0xced0('0x2c')][_0xced0('0x48')](_0x5f3d29)['then'](handleEntityNotFound(_0x4a4385,null))[_0xced0('0x26')](respondWithResult(_0x4a4385,null))[_0xced0('0x46')](handleError(_0x4a4385,null));};exports[_0xced0('0x49')]=function(_0x552326,_0xaeaedd){return db['VoiceDialReport']['create'](_0x552326['body'],{})[_0xced0('0x26')](respondWithResult(_0xaeaedd,0xc9))[_0xced0('0x46')](handleError(_0xaeaedd,null));};exports[_0xced0('0x25')]=function(_0x28c285,_0x568bdc){if(_0x28c285[_0xced0('0x4a')]['id']){delete _0x28c285[_0xced0('0x4a')]['id'];}return db[_0xced0('0x2c')][_0xced0('0x48')]({'where':{'id':_0x28c285['params']['id']}})[_0xced0('0x26')](handleEntityNotFound(_0x568bdc,null))[_0xced0('0x26')](saveUpdates(_0x28c285[_0xced0('0x4a')],null))[_0xced0('0x26')](respondWithResult(_0x568bdc,null))[_0xced0('0x46')](handleError(_0x568bdc,null));};exports[_0xced0('0x27')]=function(_0x379497,_0x2bd109){return db[_0xced0('0x2c')]['find']({'where':{'id':_0x379497[_0xced0('0x47')]['id']}})[_0xced0('0x26')](handleEntityNotFound(_0x2bd109,null))[_0xced0('0x26')](removeEntity(_0x2bd109,null))[_0xced0('0x46')](handleError(_0x2bd109,null));};exports[_0xced0('0x4b')]=function(_0x1afc01,_0x5d1cfd){return db['VoiceDialReport']['describe']()[_0xced0('0x26')](respondWithResult(_0x5d1cfd,null))[_0xced0('0x46')](handleError(_0x5d1cfd,null));}; \ No newline at end of file +var _0x3a86=['body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','keys','includeAll','catch','create'];(function(_0x594ef7,_0x43bad7){var _0x598688=function(_0x11f300){while(--_0x11f300){_0x594ef7['push'](_0x594ef7['shift']());}};_0x598688(++_0x43bad7);}(_0x3a86,0x13b));var _0x63a8=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a86[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x63a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x63a8('0x1'));var jsonpatch=require(_0x63a8('0x2'));var rp=require(_0x63a8('0x3'));var moment=require(_0x63a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x63a8('0x5'));var util=require(_0x63a8('0x6'));var path=require(_0x63a8('0x7'));var sox=require(_0x63a8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63a8('0x9'));var _=require('lodash');var squel=require(_0x63a8('0xa'));var crypto=require(_0x63a8('0xb'));var jsforce=require(_0x63a8('0xc'));var deskjs=require(_0x63a8('0xd'));var toCsv=require(_0x63a8('0xe'));var querystring=require('querystring');var Papa=require(_0x63a8('0xf'));var Redis=require(_0x63a8('0x10'));var authService=require(_0x63a8('0x11'));var qs=require(_0x63a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63a8('0x13'));var logger=require(_0x63a8('0x14'))(_0x63a8('0x15'));var utils=require('../../config/utils');var config=require(_0x63a8('0x16'));var licenseUtil=require(_0x63a8('0x17'));var db=require(_0x63a8('0x18'))['db'];function respondWithStatusCode(_0xc4de63,_0x1a90cb){_0x1a90cb=_0x1a90cb||0xcc;return function(_0x346f87){if(_0x346f87){return _0xc4de63[_0x63a8('0x19')](_0x1a90cb);}return _0xc4de63[_0x63a8('0x1a')](_0x1a90cb)[_0x63a8('0x1b')]();};}function respondWithResult(_0x22d14b,_0x14ac5d){_0x14ac5d=_0x14ac5d||0xc8;return function(_0x3cc941){if(_0x3cc941){return _0x22d14b['status'](_0x14ac5d)[_0x63a8('0x1c')](_0x3cc941);}};}function respondWithFilteredResult(_0x5aff8b,_0x181a25){return function(_0x8ba907){if(_0x8ba907){var _0x2c8d52=typeof _0x181a25['offset']===_0x63a8('0x1d')&&typeof _0x181a25[_0x63a8('0x1e')]==='undefined';var _0x37f417=_0x8ba907[_0x63a8('0x1f')];var _0x32abe8=_0x2c8d52?0x0:_0x181a25[_0x63a8('0x20')];var _0x4e02e0=_0x2c8d52?_0x8ba907[_0x63a8('0x1f')]:_0x181a25['offset']+_0x181a25['limit'];var _0xb7f9bd;if(_0x4e02e0>=_0x37f417){_0x4e02e0=_0x37f417;_0xb7f9bd=0xc8;}else{_0xb7f9bd=0xce;}_0x5aff8b['status'](_0xb7f9bd);return _0x5aff8b[_0x63a8('0x21')](_0x63a8('0x22'),_0x32abe8+'-'+_0x4e02e0+'/'+_0x37f417)['json'](_0x8ba907);}return null;};}function patchUpdates(_0x2e3b79){return function(_0x28f221){try{jsonpatch[_0x63a8('0x23')](_0x28f221,_0x2e3b79,!![]);}catch(_0x206cd9){return BPromise['reject'](_0x206cd9);}return _0x28f221[_0x63a8('0x24')]();};}function saveUpdates(_0x4e8ea0,_0x3a2a78){return function(_0x190f04){if(_0x190f04){return _0x190f04[_0x63a8('0x25')](_0x4e8ea0)[_0x63a8('0x26')](function(_0x300224){return _0x300224;});}return null;};}function removeEntity(_0x421102,_0xf5bd85){return function(_0x35e454){if(_0x35e454){return _0x35e454[_0x63a8('0x27')]()[_0x63a8('0x26')](function(){_0x421102[_0x63a8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b4e1,_0x1ec47f){return function(_0x41a8d2){if(!_0x41a8d2){_0x51b4e1[_0x63a8('0x19')](0x194);}return _0x41a8d2;};}function handleError(_0x64cd3a,_0x317abc){_0x317abc=_0x317abc||0x1f4;return function(_0x3faa6a){logger[_0x63a8('0x28')](_0x3faa6a[_0x63a8('0x29')]);if(_0x3faa6a[_0x63a8('0x2a')]){delete _0x3faa6a[_0x63a8('0x2a')];}_0x64cd3a[_0x63a8('0x1a')](_0x317abc)[_0x63a8('0x2b')](_0x3faa6a);};}exports[_0x63a8('0x2c')]=function(_0x2eb1b0,_0x48c978){var _0x3a9426={},_0x475b0d={},_0x16d8f5={'count':0x0,'rows':[]};var _0x386124=_[_0x63a8('0x2d')](db[_0x63a8('0x2e')]['rawAttributes'],function(_0x1e3f26){return{'name':_0x1e3f26[_0x63a8('0x2f')],'type':_0x1e3f26[_0x63a8('0x30')][_0x63a8('0x31')]};});_0x475b0d[_0x63a8('0x32')]=_['map'](_0x386124,'name');_0x475b0d['query']=_['keys'](_0x2eb1b0[_0x63a8('0x33')]);_0x475b0d['filters']=_['intersection'](_0x475b0d[_0x63a8('0x32')],_0x475b0d[_0x63a8('0x33')]);_0x3a9426[_0x63a8('0x34')]=_[_0x63a8('0x35')](_0x475b0d[_0x63a8('0x32')],qs[_0x63a8('0x36')](_0x2eb1b0[_0x63a8('0x33')][_0x63a8('0x36')]));_0x3a9426[_0x63a8('0x34')]=_0x3a9426[_0x63a8('0x34')][_0x63a8('0x37')]?_0x3a9426['attributes']:_0x475b0d['model'];if(!_0x2eb1b0[_0x63a8('0x33')][_0x63a8('0x38')](_0x63a8('0x39'))){_0x3a9426[_0x63a8('0x1e')]=qs[_0x63a8('0x1e')](_0x2eb1b0['query'][_0x63a8('0x1e')]);_0x3a9426['offset']=qs[_0x63a8('0x20')](_0x2eb1b0[_0x63a8('0x33')]['offset']);}_0x3a9426[_0x63a8('0x3a')]=qs[_0x63a8('0x3b')](_0x2eb1b0['query'][_0x63a8('0x3b')]);_0x3a9426[_0x63a8('0x3c')]=qs[_0x63a8('0x3d')](_[_0x63a8('0x3e')](_0x2eb1b0[_0x63a8('0x33')],_0x475b0d[_0x63a8('0x3d')]),_0x386124);if(_0x2eb1b0[_0x63a8('0x33')][_0x63a8('0x3f')]){_0x3a9426[_0x63a8('0x3c')]=_['merge'](_0x3a9426[_0x63a8('0x3c')],{'$or':_[_0x63a8('0x2d')](_0x386124,function(_0x8f03d8){if(_0x8f03d8[_0x63a8('0x30')]!==_0x63a8('0x40')){var _0x658d5e={};_0x658d5e[_0x8f03d8['name']]={'$like':'%'+_0x2eb1b0[_0x63a8('0x33')][_0x63a8('0x3f')]+'%'};return _0x658d5e;}})});}_0x3a9426=_[_0x63a8('0x41')]({},_0x3a9426,_0x2eb1b0[_0x63a8('0x42')]);var _0x398afe={'where':_0x3a9426['where']};return db[_0x63a8('0x2e')]['count'](_0x398afe)[_0x63a8('0x26')](function(_0x62506e){_0x16d8f5[_0x63a8('0x1f')]=_0x62506e;if(_0x2eb1b0[_0x63a8('0x33')]['includeAll']){_0x3a9426[_0x63a8('0x43')]=[{'all':!![]}];}return db[_0x63a8('0x2e')][_0x63a8('0x44')](_0x3a9426);})[_0x63a8('0x26')](function(_0x5c9abc){_0x16d8f5['rows']=_0x5c9abc;return _0x16d8f5;})[_0x63a8('0x26')](respondWithFilteredResult(_0x48c978,_0x3a9426))['catch'](handleError(_0x48c978,null));};exports[_0x63a8('0x45')]=function(_0x1133e5,_0x1fe306){var _0x37cb10={'raw':!![],'where':{'id':_0x1133e5[_0x63a8('0x46')]['id']}},_0x2ae62a={};_0x2ae62a[_0x63a8('0x32')]=_[_0x63a8('0x47')](db['VoiceDialReport']['rawAttributes']);_0x2ae62a['query']=_[_0x63a8('0x47')](_0x1133e5[_0x63a8('0x33')]);_0x2ae62a['filters']=_[_0x63a8('0x35')](_0x2ae62a['model'],_0x2ae62a['query']);_0x37cb10[_0x63a8('0x34')]=_[_0x63a8('0x35')](_0x2ae62a[_0x63a8('0x32')],qs[_0x63a8('0x36')](_0x1133e5[_0x63a8('0x33')][_0x63a8('0x36')]));_0x37cb10[_0x63a8('0x34')]=_0x37cb10[_0x63a8('0x34')][_0x63a8('0x37')]?_0x37cb10['attributes']:_0x2ae62a[_0x63a8('0x32')];if(_0x1133e5[_0x63a8('0x33')][_0x63a8('0x48')]){_0x37cb10['include']=[{'all':!![]}];}_0x37cb10=_[_0x63a8('0x41')]({},_0x37cb10,_0x1133e5['options']);return db['VoiceDialReport']['find'](_0x37cb10)[_0x63a8('0x26')](handleEntityNotFound(_0x1fe306,null))['then'](respondWithResult(_0x1fe306,null))[_0x63a8('0x49')](handleError(_0x1fe306,null));};exports['create']=function(_0x2c9757,_0x1251d1){return db[_0x63a8('0x2e')][_0x63a8('0x4a')](_0x2c9757['body'],{})[_0x63a8('0x26')](respondWithResult(_0x1251d1,0xc9))['catch'](handleError(_0x1251d1,null));};exports['update']=function(_0x225743,_0x2001d0){if(_0x225743[_0x63a8('0x4b')]['id']){delete _0x225743['body']['id'];}return db['VoiceDialReport'][_0x63a8('0x4c')]({'where':{'id':_0x225743[_0x63a8('0x46')]['id']}})[_0x63a8('0x26')](handleEntityNotFound(_0x2001d0,null))[_0x63a8('0x26')](saveUpdates(_0x225743[_0x63a8('0x4b')],null))[_0x63a8('0x26')](respondWithResult(_0x2001d0,null))['catch'](handleError(_0x2001d0,null));};exports[_0x63a8('0x27')]=function(_0x31b78,_0x5082ff){return db[_0x63a8('0x2e')][_0x63a8('0x4c')]({'where':{'id':_0x31b78[_0x63a8('0x46')]['id']}})[_0x63a8('0x26')](handleEntityNotFound(_0x5082ff,null))[_0x63a8('0x26')](removeEntity(_0x5082ff,null))[_0x63a8('0x49')](handleError(_0x5082ff,null));};exports[_0x63a8('0x4d')]=function(_0x214411,_0x13e5de){return db[_0x63a8('0x2e')]['describe']()['then'](respondWithResult(_0x13e5de,null))[_0x63a8('0x49')](handleError(_0x13e5de,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 4416663..59153f6 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 _0xc8d3=['api','moment','request-promise','path','rimraf','./voiceDialReport.attributes','exports','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x1eff3f,_0x235e4f){var _0x2efb24=function(_0x2b6fd1){while(--_0x2b6fd1){_0x1eff3f['push'](_0x1eff3f['shift']());}};_0x2efb24(++_0x235e4f);}(_0xc8d3,0x1dd));var _0x3c8d=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xc8d3[_0x54b283];return _0x2462b3;};'use strict';var _=require(_0x3c8d('0x0'));var util=require(_0x3c8d('0x1'));var logger=require(_0x3c8d('0x2'))(_0x3c8d('0x3'));var moment=require(_0x3c8d('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c8d('0x5'));var fs=require('fs');var path=require(_0x3c8d('0x6'));var rimraf=require(_0x3c8d('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c8d('0x8'));module[_0x3c8d('0x9')]=function(_0x4f79e5,_0x1c635b){return _0x4f79e5['define']('VoiceDialReport',attributes,{'tableName':_0x3c8d('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3c8d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00a8=['moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x00a8,0xb3));var _0x800a=function(_0x1e5245,_0x1bdd41){_0x1e5245=_0x1e5245-0x0;var _0xc6cecd=_0x00a8[_0x1e5245];return _0xc6cecd;};'use strict';var _=require(_0x800a('0x0'));var util=require('util');var logger=require(_0x800a('0x1'))(_0x800a('0x2'));var moment=require(_0x800a('0x3'));var BPromise=require('bluebird');var rp=require(_0x800a('0x4'));var fs=require('fs');var path=require(_0x800a('0x5'));var rimraf=require(_0x800a('0x6'));var config=require(_0x800a('0x7'));var attributes=require(_0x800a('0x8'));module[_0x800a('0x9')]=function(_0x19e8cf,_0x29a085){return _0x19e8cf[_0x800a('0xa')](_0x800a('0xb'),attributes,{'tableName':_0x800a('0xc'),'paranoid':![],'indexes':[{'fields':[_0x800a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 16074e3..d9434e0 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 _0xc191=['CreateVoiceDialReport','debug','stringify','UpdateVoiceDialReport','update','raw','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options'];(function(_0x4b3a5f,_0x320938){var _0x247b4c=function(_0x1a1365){while(--_0x1a1365){_0x4b3a5f['push'](_0x4b3a5f['shift']());}};_0x247b4c(++_0x320938);}(_0xc191,0x19b));var _0x1c19=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xc191[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x1c19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1c19('0x1'));var rs=require(_0x1c19('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c19('0x3'))['db'];var utils=require(_0x1c19('0x4'));var logger=require(_0x1c19('0x5'))('rpc');var config=require(_0x1c19('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1c19('0x7')][_0x1c19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f9f99,_0x2c94f8,_0x551d2b){return new BPromise(function(_0x24bd87,_0x3c48c4){return client[_0x1c19('0x9')](_0x2f9f99,_0x551d2b)[_0x1c19('0xa')](function(_0x3b601c){logger[_0x1c19('0xb')](_0x1c19('0xc'),_0x2c94f8,_0x1c19('0xd'));logger['debug'](_0x1c19('0xe'),_0x2c94f8,_0x1c19('0xd'),JSON['stringify'](_0x3b601c));if(_0x3b601c[_0x1c19('0xf')]){if(_0x3b601c[_0x1c19('0xf')][_0x1c19('0x10')]===0x1f4){logger[_0x1c19('0xf')](_0x1c19('0xc'),_0x2c94f8,_0x3b601c[_0x1c19('0xf')][_0x1c19('0x11')]);return _0x3c48c4(_0x3b601c[_0x1c19('0xf')][_0x1c19('0x11')]);}logger['error'](_0x1c19('0xc'),_0x2c94f8,_0x3b601c[_0x1c19('0xf')][_0x1c19('0x11')]);return _0x24bd87(_0x3b601c[_0x1c19('0xf')][_0x1c19('0x11')]);}else{logger[_0x1c19('0xb')](_0x1c19('0xc'),_0x2c94f8,_0x1c19('0xd'));_0x24bd87(_0x3b601c[_0x1c19('0x12')]['message']);}})[_0x1c19('0x13')](function(_0x3ddae5){logger[_0x1c19('0xf')](_0x1c19('0xc'),_0x2c94f8,_0x3ddae5);_0x3c48c4(_0x3ddae5);});});}exports['CreateVoiceDialReport']=function(_0x3d4ac1){var _0x2d1dfa=this;return new Promise(function(_0x5bec70,_0x255b7c){return db['VoiceDialReport'][_0x1c19('0x14')](_0x3d4ac1[_0x1c19('0x15')],{'raw':_0x3d4ac1[_0x1c19('0x16')]?_0x3d4ac1[_0x1c19('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1c19('0xa')](function(_0x598650){logger[_0x1c19('0xb')](_0x1c19('0x17'),_0x3d4ac1);logger[_0x1c19('0x18')](_0x1c19('0x17'),_0x3d4ac1,JSON[_0x1c19('0x19')](_0x598650));_0x5bec70(_0x598650);})['catch'](function(_0x3cee1f){logger[_0x1c19('0xf')](_0x1c19('0x17'),_0x3cee1f[_0x1c19('0x11')],_0x3d4ac1);_0x255b7c(_0x2d1dfa[_0x1c19('0xf')](0x1f4,_0x3cee1f[_0x1c19('0x11')]));});});};exports[_0x1c19('0x1a')]=function(_0x4bc090){var _0x5d7bdf=this;return new Promise(function(_0x4524a0,_0x48e7ea){return db['VoiceDialReport'][_0x1c19('0x1b')](_0x4bc090['body'],{'raw':_0x4bc090['options']?_0x4bc090['options'][_0x1c19('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bc090[_0x1c19('0x16')]?_0x4bc090[_0x1c19('0x16')]['where']||null:null,'attributes':_0x4bc090[_0x1c19('0x16')]?_0x4bc090['options'][_0x1c19('0x1d')]||null:null,'limit':_0x4bc090[_0x1c19('0x16')]?_0x4bc090[_0x1c19('0x16')][_0x1c19('0x1e')]||null:null})['then'](function(_0x31d1b4){logger['info'](_0x1c19('0x1a'),_0x4bc090);logger[_0x1c19('0x18')](_0x1c19('0x1a'),_0x4bc090,JSON[_0x1c19('0x19')](_0x31d1b4));_0x4524a0(_0x31d1b4);})[_0x1c19('0x13')](function(_0x52766b){logger[_0x1c19('0xf')](_0x1c19('0x1a'),_0x52766b[_0x1c19('0x11')],_0x4bc090);_0x48e7ea(_0x5d7bdf[_0x1c19('0xf')](0x1f4,_0x52766b['message']));});});}; \ No newline at end of file +var _0x3c09=['then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','update','where','limit','UpdateVoiceDialReport','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c09,0x1c3));var _0x93c0=function(_0x172baa,_0x33b7f6){_0x172baa=_0x172baa-0x0;var _0x3f5836=_0x3c09[_0x172baa];return _0x3f5836;};'use strict';var _=require(_0x93c0('0x0'));var util=require(_0x93c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93c0('0x2'));var fs=require('fs');var Redis=require(_0x93c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93c0('0x4'));var logger=require(_0x93c0('0x5'))(_0x93c0('0x6'));var config=require(_0x93c0('0x7'));var jayson=require(_0x93c0('0x8'));var client=jayson[_0x93c0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bbf96,_0x1d75a8,_0x515204){return new BPromise(function(_0x925745,_0x4e6276){return client[_0x93c0('0xa')](_0x1bbf96,_0x515204)[_0x93c0('0xb')](function(_0x36096f){logger['info'](_0x93c0('0xc'),_0x1d75a8,_0x93c0('0xd'));logger[_0x93c0('0xe')](_0x93c0('0xf'),_0x1d75a8,_0x93c0('0xd'),JSON[_0x93c0('0x10')](_0x36096f));if(_0x36096f['error']){if(_0x36096f[_0x93c0('0x11')][_0x93c0('0x12')]===0x1f4){logger[_0x93c0('0x11')](_0x93c0('0xc'),_0x1d75a8,_0x36096f[_0x93c0('0x11')][_0x93c0('0x13')]);return _0x4e6276(_0x36096f[_0x93c0('0x11')][_0x93c0('0x13')]);}logger['error'](_0x93c0('0xc'),_0x1d75a8,_0x36096f[_0x93c0('0x11')][_0x93c0('0x13')]);return _0x925745(_0x36096f[_0x93c0('0x11')]['message']);}else{logger[_0x93c0('0x14')](_0x93c0('0xc'),_0x1d75a8,_0x93c0('0xd'));_0x925745(_0x36096f[_0x93c0('0x15')][_0x93c0('0x13')]);}})[_0x93c0('0x16')](function(_0x53e889){logger['error'](_0x93c0('0xc'),_0x1d75a8,_0x53e889);_0x4e6276(_0x53e889);});});}exports[_0x93c0('0x17')]=function(_0x1dc44e){var _0x4330e4=this;return new Promise(function(_0x479586,_0x3a59d7){return db[_0x93c0('0x18')][_0x93c0('0x19')](_0x1dc44e[_0x93c0('0x1a')],{'raw':_0x1dc44e[_0x93c0('0x1b')]?_0x1dc44e[_0x93c0('0x1b')][_0x93c0('0x1c')]===undefined?!![]:![]:!![]})[_0x93c0('0xb')](function(_0x48c8c4){logger[_0x93c0('0x14')](_0x93c0('0x17'),_0x1dc44e);logger['debug'](_0x93c0('0x17'),_0x1dc44e,JSON[_0x93c0('0x10')](_0x48c8c4));_0x479586(_0x48c8c4);})['catch'](function(_0x206b08){logger[_0x93c0('0x11')]('CreateVoiceDialReport',_0x206b08['message'],_0x1dc44e);_0x3a59d7(_0x4330e4[_0x93c0('0x11')](0x1f4,_0x206b08['message']));});});};exports['UpdateVoiceDialReport']=function(_0x513cd9){var _0x18ef87=this;return new Promise(function(_0x13e850,_0x2dd9c1){return db['VoiceDialReport'][_0x93c0('0x1d')](_0x513cd9[_0x93c0('0x1a')],{'raw':_0x513cd9['options']?_0x513cd9[_0x93c0('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513cd9[_0x93c0('0x1b')]?_0x513cd9[_0x93c0('0x1b')][_0x93c0('0x1e')]||null:null,'attributes':_0x513cd9[_0x93c0('0x1b')]?_0x513cd9[_0x93c0('0x1b')]['attributes']||null:null,'limit':_0x513cd9[_0x93c0('0x1b')]?_0x513cd9[_0x93c0('0x1b')][_0x93c0('0x1f')]||null:null})[_0x93c0('0xb')](function(_0x1fd2f3){logger[_0x93c0('0x14')](_0x93c0('0x20'),_0x513cd9);logger['debug'](_0x93c0('0x20'),_0x513cd9,JSON['stringify'](_0x1fd2f3));_0x13e850(_0x1fd2f3);})['catch'](function(_0x2c598b){logger[_0x93c0('0x11')](_0x93c0('0x20'),_0x2c598b[_0x93c0('0x13')],_0x513cd9);_0x2dd9c1(_0x18ef87[_0x93c0('0x11')](0x1f4,_0x2c598b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1f18bec..05e1340 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 _0x5cac=['get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x2d7484,_0x1b8083){var _0x8d13bc=function(_0x3d76b2){while(--_0x3d76b2){_0x2d7484['push'](_0x2d7484['shift']());}};_0x8d13bc(++_0x1b8083);}(_0x5cac,0x123));var _0xc5ca=function(_0x59fc6a,_0x5e7ed1){_0x59fc6a=_0x59fc6a-0x0;var _0x1c4e01=_0x5cac[_0x59fc6a];return _0x1c4e01;};'use strict';var multer=require(_0xc5ca('0x0'));var util=require(_0xc5ca('0x1'));var path=require(_0xc5ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5ca('0x3'));var router=express['Router']();var fs_extra=require(_0xc5ca('0x4'));var auth=require(_0xc5ca('0x5'));var interaction=require(_0xc5ca('0x6'));var config=require(_0xc5ca('0x7'));var controller=require(_0xc5ca('0x8'));router[_0xc5ca('0x9')]('/',auth[_0xc5ca('0xa')](),controller[_0xc5ca('0xb')]);router[_0xc5ca('0x9')](_0xc5ca('0xc'),auth[_0xc5ca('0xa')](),controller[_0xc5ca('0xd')]);router[_0xc5ca('0xe')]('/',auth[_0xc5ca('0xa')](),controller[_0xc5ca('0xf')]);router[_0xc5ca('0xe')](_0xc5ca('0x10'),auth[_0xc5ca('0xa')](),controller[_0xc5ca('0x11')]);router[_0xc5ca('0x12')](_0xc5ca('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xc5ca('0xa')](),controller['destroy']);module[_0xc5ca('0x13')]=router; \ No newline at end of file +var _0x0612=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','post','addApplications','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x4bb515,_0x3fce8f){var _0x2ef749=function(_0x102df4){while(--_0x102df4){_0x4bb515['push'](_0x4bb515['shift']());}};_0x2ef749(++_0x3fce8f);}(_0x0612,0x151));var _0x2061=function(_0x262612,_0x188f7f){_0x262612=_0x262612-0x0;var _0x59ba35=_0x0612[_0x262612];return _0x59ba35;};'use strict';var multer=require('multer');var util=require(_0x2061('0x0'));var path=require(_0x2061('0x1'));var timeout=require(_0x2061('0x2'));var express=require(_0x2061('0x3'));var router=express['Router']();var fs_extra=require(_0x2061('0x4'));var auth=require(_0x2061('0x5'));var interaction=require(_0x2061('0x6'));var config=require(_0x2061('0x7'));var controller=require(_0x2061('0x8'));router[_0x2061('0x9')]('/',auth['isAuthenticated'](),controller[_0x2061('0xa')]);router[_0x2061('0x9')](_0x2061('0xb'),auth[_0x2061('0xc')](),controller['show']);router[_0x2061('0xd')]('/',auth[_0x2061('0xc')](),controller['create']);router[_0x2061('0xd')]('/:id/applications',auth[_0x2061('0xc')](),controller[_0x2061('0xe')]);router[_0x2061('0xf')](_0x2061('0xb'),auth['isAuthenticated'](),controller[_0x2061('0x10')]);router['delete'](_0x2061('0xb'),auth['isAuthenticated'](),controller[_0x2061('0x11')]);module[_0x2061('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 04739f9..2a115f6 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 _0xeb82=['inbound','outbound','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','exports','compositeIndex','STRING','NoOp','ENUM'];(function(_0x5baf29,_0x521e50){var _0x2d6553=function(_0x4340c5){while(--_0x4340c5){_0x5baf29['push'](_0x5baf29['shift']());}};_0x2d6553(++_0x521e50);}(_0xeb82,0x1cb));var _0x2eb8=function(_0x5ea0c7,_0x4896b6){_0x5ea0c7=_0x5ea0c7-0x0;var _0x1d32a2=_0xeb82[_0x5ea0c7];return _0x1d32a2;};'use strict';var Sequelize=require('sequelize');module[_0x2eb8('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2eb8('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2eb8('0x2')],'allowNull':![],'unique':_0x2eb8('0x1')},'priority':{'type':Sequelize[_0x2eb8('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x2eb8('0x1')},'tag':{'type':Sequelize[_0x2eb8('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2eb8('0x2')],'allowNull':![],'defaultValue':_0x2eb8('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x2eb8('0x4')](_0x2eb8('0x5'),_0x2eb8('0x6'),'internal','inbound-fax',_0x2eb8('0x7'),_0x2eb8('0x8'),_0x2eb8('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x2eb8('0x2')]},'interval':{'type':Sequelize[_0x2eb8('0x2')],'allowNull':![],'defaultValue':_0x2eb8('0xa')},'IntervalId':{'type':Sequelize[_0x2eb8('0xb')]},'isApp':{'type':Sequelize[_0x2eb8('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x2eb8('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x2eb8('0x2')],'defaultValue':_0x2eb8('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x2eb8('0xe')],'get':function(_0x28e410){return this['getDataValue'](_0x2eb8('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7113=['compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','STRING'];(function(_0x4834c9,_0xb013e0){var _0x2c1b01=function(_0x27812b){while(--_0x27812b){_0x4834c9['push'](_0x4834c9['shift']());}};_0x2c1b01(++_0xb013e0);}(_0x7113,0xfd));var _0x3711=function(_0x481ee0,_0x3697e5){_0x481ee0=_0x481ee0-0x0;var _0x15fbe2=_0x7113[_0x481ee0];return _0x15fbe2;};'use strict';var Sequelize=require(_0x3711('0x0'));module['exports']={'context':{'type':Sequelize[_0x3711('0x1')],'allowNull':![],'unique':_0x3711('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3711('0x1')],'allowNull':![],'unique':_0x3711('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x3711('0x2')},'tag':{'type':Sequelize[_0x3711('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3711('0x1')],'allowNull':![],'defaultValue':_0x3711('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3711('0x4')](_0x3711('0x5'),_0x3711('0x6'),_0x3711('0x7'),_0x3711('0x8'),_0x3711('0x9'),'system',_0x3711('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3711('0x1')]},'interval':{'type':Sequelize[_0x3711('0x1')],'allowNull':![],'defaultValue':_0x3711('0xb')},'IntervalId':{'type':Sequelize[_0x3711('0xc')]},'isApp':{'type':Sequelize[_0x3711('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3711('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3711('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x3711('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3711('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x3711('0xe')},'answer':{'type':Sequelize[_0x3711('0xd')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x38633c){return this[_0x3711('0xf')](_0x3711('0x10'));}},'alias':{'type':Sequelize[_0x3711('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a4bd2f6..6275b10 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 _0xbd1c=['InternalRoutes','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','catch','show','length','find','params','create','body','outbound','startsWith','exten','concat','user','get','inbound','UserProfileSection','userProfileId','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','destroy','then','OutboundRoutes'];(function(_0x58fcda,_0x1c3d13){var _0x8e4b88=function(_0x1da88a){while(--_0x1da88a){_0x58fcda['push'](_0x58fcda['shift']());}};_0x8e4b88(++_0x1c3d13);}(_0xbd1c,0xa2));var _0xcbd1=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xbd1c[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xcbd1('0x0'));var Redis=require(_0xcbd1('0x1'));var qs=require(_0xcbd1('0x2'));var logger=require(_0xcbd1('0x3'))(_0xcbd1('0x4'));var config=require(_0xcbd1('0x5'));var db=require(_0xcbd1('0x6'))['db'];config[_0xcbd1('0x7')]=_[_0xcbd1('0x8')](config['redis'],{'host':_0xcbd1('0x9'),'port':0x18eb});var socket=require(_0xcbd1('0xa'))(new Redis(config[_0xcbd1('0x7')]));require(_0xcbd1('0xb'))[_0xcbd1('0xc')](socket);function respondWithStatusCode(_0x39d2f0,_0x5217a3){_0x5217a3=_0x5217a3||0xcc;return function(_0x31da65){if(_0x31da65){return _0x39d2f0[_0xcbd1('0xd')](_0x5217a3);}return _0x39d2f0[_0xcbd1('0xe')](_0x5217a3)[_0xcbd1('0xf')]();};}function respondWithResult(_0x4d83d1,_0x46ada7){_0x46ada7=_0x46ada7||0xc8;return function(_0x3f76d0){if(_0x3f76d0){return _0x4d83d1['status'](_0x46ada7)['json'](_0x3f76d0);}};}function respondWithFilteredResult(_0x29869e,_0x1c3aa2){return function(_0x37eafd){if(_0x37eafd){var _0xbbaec9=typeof _0x1c3aa2[_0xcbd1('0x10')]===_0xcbd1('0x11')&&typeof _0x1c3aa2[_0xcbd1('0x12')]==='undefined';var _0x38f021=_0x37eafd[_0xcbd1('0x13')];var _0xb78c61=_0xbbaec9?0x0:_0x1c3aa2[_0xcbd1('0x10')];var _0xf041dd=_0xbbaec9?_0x37eafd[_0xcbd1('0x13')]:_0x1c3aa2[_0xcbd1('0x10')]+_0x1c3aa2[_0xcbd1('0x12')];var _0x27de34;if(_0xf041dd>=_0x38f021){_0xf041dd=_0x38f021;_0x27de34=0xc8;}else{_0x27de34=0xce;}_0x29869e[_0xcbd1('0xe')](_0x27de34);return _0x29869e['set']('Content-Range',_0xb78c61+'-'+_0xf041dd+'/'+_0x38f021)[_0xcbd1('0x14')](_0x37eafd);}return null;};}function removeEntity(_0x1f9fd9){return function(_0x1de37f){if(_0x1de37f){return _0x1de37f[_0xcbd1('0x15')]()[_0xcbd1('0x16')](function(){var _0x224b2b=_0x1de37f['get']({'plain':!![]});var _0x9f3e88=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xcbd1('0x17'),'value':'outbound','ignore':![]},{'name':_0xcbd1('0x18'),'value':_0xcbd1('0x19'),'ignore':![]}];var _0x2c9a67=_(_0x9f3e88)[_0xcbd1('0x1a')](_0xcbd1('0x1b'))[_0xcbd1('0x1c')](_0xcbd1('0x1d'))[_0xcbd1('0x1d')]();if(_[_0xcbd1('0x1e')](_0x2c9a67,_0x224b2b[_0xcbd1('0x1f')])){return;}var _0x10c18a=_['find'](_0x9f3e88,['value',_0x224b2b[_0xcbd1('0x1f')]])[_0xcbd1('0x20')];return db[_0xcbd1('0x21')][_0xcbd1('0x15')]({'where':{'type':_0x10c18a,'resourceId':_0x224b2b['id']}})[_0xcbd1('0x16')](function(){return _0x1de37f;});})[_0xcbd1('0x16')](function(){_0x1f9fd9['status'](0xcc)[_0xcbd1('0xf')]();});}};}function handleEntityNotFound(_0x1cb1bc){return function(_0x4f119d){if(!_0x4f119d){_0x1cb1bc[_0xcbd1('0xd')](0x194);}return _0x4f119d;};}function handleError(_0x3324bb,_0x5c7fc8){_0x5c7fc8=_0x5c7fc8||0x1f4;return function(_0x1d2820){logger[_0xcbd1('0x22')](_0x1d2820[_0xcbd1('0x23')]);if(_0x1d2820[_0xcbd1('0x20')]){delete _0x1d2820[_0xcbd1('0x20')];}_0x3324bb['status'](_0x5c7fc8)[_0xcbd1('0x24')](_0x1d2820);};}exports[_0xcbd1('0x25')]=function(_0x12639c,_0x58b6f1){var _0x5a87a6={},_0x494e83={},_0x516bc4={'count':0x0,'rows':[]};var _0x40d898=_[_0xcbd1('0x1c')](db[_0xcbd1('0x26')][_0xcbd1('0x27')],function(_0x3cbe54){return{'name':_0x3cbe54[_0xcbd1('0x28')],'type':_0x3cbe54[_0xcbd1('0x1f')]['key']};});_0x494e83[_0xcbd1('0x29')]=_['map'](_0x40d898,_0xcbd1('0x20'));_0x494e83[_0xcbd1('0x2a')]=_[_0xcbd1('0x2b')](_0x12639c[_0xcbd1('0x2a')]);_0x494e83[_0xcbd1('0x2c')]=_[_0xcbd1('0x2d')](_0x494e83[_0xcbd1('0x29')],_0x494e83[_0xcbd1('0x2a')]);_0x5a87a6[_0xcbd1('0x2e')]=_[_0xcbd1('0x2d')](_0x494e83[_0xcbd1('0x29')],qs[_0xcbd1('0x2f')](_0x12639c[_0xcbd1('0x2a')][_0xcbd1('0x2f')]));_0x5a87a6[_0xcbd1('0x2e')]=_0x5a87a6[_0xcbd1('0x2e')]['length']?_0x5a87a6[_0xcbd1('0x2e')]:_0x494e83['model'];if(!_0x12639c[_0xcbd1('0x2a')][_0xcbd1('0x30')](_0xcbd1('0x31'))){_0x5a87a6[_0xcbd1('0x12')]=qs['limit'](_0x12639c[_0xcbd1('0x2a')]['limit']);_0x5a87a6[_0xcbd1('0x10')]=qs[_0xcbd1('0x10')](_0x12639c[_0xcbd1('0x2a')][_0xcbd1('0x10')]);}_0x5a87a6[_0xcbd1('0x32')]=qs['sort'](_0x12639c[_0xcbd1('0x2a')][_0xcbd1('0x33')]);_0x5a87a6[_0xcbd1('0x34')]=qs['filters'](_[_0xcbd1('0x35')](_0x12639c['query'],_0x494e83[_0xcbd1('0x2c')]),_0x40d898);if(_0x12639c[_0xcbd1('0x2a')][_0xcbd1('0x1a')]){_0x5a87a6['where']=_[_0xcbd1('0x36')](_0x5a87a6[_0xcbd1('0x34')],{'$or':_[_0xcbd1('0x1c')](_0x40d898,function(_0x391101){if(_0x391101[_0xcbd1('0x1f')]!=='VIRTUAL'){var _0x2b3940={};_0x2b3940[_0x391101[_0xcbd1('0x20')]]={'$like':'%'+_0x12639c[_0xcbd1('0x2a')][_0xcbd1('0x1a')]+'%'};return _0x2b3940;}})});}_0x5a87a6=_[_0xcbd1('0x36')]({},_0x5a87a6,_0x12639c[_0xcbd1('0x37')]);var _0x3134a9={'where':_0x5a87a6['where']};return db[_0xcbd1('0x26')][_0xcbd1('0x13')](_0x3134a9)[_0xcbd1('0x16')](function(_0x2d02ec){_0x516bc4[_0xcbd1('0x13')]=_0x2d02ec;if(_0x12639c[_0xcbd1('0x2a')][_0xcbd1('0x38')]){_0x5a87a6['include']=[{'all':!![]}];}return db[_0xcbd1('0x26')][_0xcbd1('0x39')](_0x5a87a6);})[_0xcbd1('0x16')](function(_0x49773b){_0x516bc4['rows']=_0x49773b;return _0x516bc4;})[_0xcbd1('0x16')](respondWithFilteredResult(_0x58b6f1,_0x5a87a6))[_0xcbd1('0x3a')](handleError(_0x58b6f1,null));};exports[_0xcbd1('0x3b')]=function(_0xe3d462,_0xda654f){var _0x3c3fa1={'raw':![],'where':{'id':_0xe3d462['params']['id']}},_0x54eb73={};_0x54eb73[_0xcbd1('0x29')]=_[_0xcbd1('0x2b')](db[_0xcbd1('0x26')][_0xcbd1('0x27')]);_0x54eb73[_0xcbd1('0x2a')]=_[_0xcbd1('0x2b')](_0xe3d462[_0xcbd1('0x2a')]);_0x54eb73[_0xcbd1('0x2c')]=_[_0xcbd1('0x2d')](_0x54eb73[_0xcbd1('0x29')],_0x54eb73[_0xcbd1('0x2a')]);_0x3c3fa1[_0xcbd1('0x2e')]=_[_0xcbd1('0x2d')](_0x54eb73[_0xcbd1('0x29')],qs['fields'](_0xe3d462[_0xcbd1('0x2a')]['fields']));_0x3c3fa1['attributes']=_0x3c3fa1['attributes'][_0xcbd1('0x3c')]?_0x3c3fa1['attributes']:_0x54eb73['model'];if(_0xe3d462[_0xcbd1('0x2a')][_0xcbd1('0x38')]){_0x3c3fa1['include']=[{'all':!![]}];}_0x3c3fa1=_[_0xcbd1('0x36')]({},_0x3c3fa1,_0xe3d462['options']);return db['VoiceExtension'][_0xcbd1('0x3d')](_0x3c3fa1)[_0xcbd1('0x16')](handleEntityNotFound(_0xda654f,null))[_0xcbd1('0x16')](respondWithResult(_0xda654f,null))['catch'](handleError(_0xda654f,null));};exports[_0xcbd1('0x15')]=function(_0x2c1b63,_0x15bf82){return db[_0xcbd1('0x26')]['find']({'where':{'id':_0x2c1b63[_0xcbd1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x15bf82,null))['then'](removeEntity(_0x15bf82,null))[_0xcbd1('0x3a')](handleError(_0x15bf82,null));};exports[_0xcbd1('0x3f')]=function(_0x4a3b2c,_0x405fa1){if(_0x4a3b2c[_0xcbd1('0x40')][_0xcbd1('0x1f')]===_0xcbd1('0x41')&&!_[_0xcbd1('0x42')](_0x4a3b2c['body'][_0xcbd1('0x43')],'_')){_0x4a3b2c[_0xcbd1('0x40')][_0xcbd1('0x43')]='_'[_0xcbd1('0x44')](_0x4a3b2c[_0xcbd1('0x40')]['exten']);}return db[_0xcbd1('0x26')][_0xcbd1('0x3f')](_0x4a3b2c[_0xcbd1('0x40')],{'raw':![]})[_0xcbd1('0x16')](function(_0x1d621a){var _0x318323=_0x4a3b2c[_0xcbd1('0x45')][_0xcbd1('0x46')]({'plain':!![]});if(!_0x318323)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x318323['role']===_0xcbd1('0x45')){var _0xc54c9e=_0x1d621a[_0xcbd1('0x46')]({'plain':!![]});var _0x468ccd=[{'name':'InboundRoutes','value':_0xcbd1('0x47')},{'name':_0xcbd1('0x17'),'value':'outbound'},{'name':_0xcbd1('0x18'),'value':_0xcbd1('0x19')}];var _0x587fa=_['find'](_0x468ccd,[_0xcbd1('0x1d'),_0xc54c9e[_0xcbd1('0x1f')]])[_0xcbd1('0x20')];return db[_0xcbd1('0x48')][_0xcbd1('0x3d')]({'where':{'name':_0x587fa,'userProfileId':_0x318323[_0xcbd1('0x49')]},'raw':!![]})[_0xcbd1('0x16')](function(_0x5263e1){if(_0x5263e1&&_0x5263e1[_0xcbd1('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0xc54c9e[_0xcbd1('0x20')],'resourceId':_0xc54c9e['id'],'type':_0x5263e1[_0xcbd1('0x20')],'sectionId':_0x5263e1['id']},{})[_0xcbd1('0x16')](function(){return _0x1d621a;});}else{return _0x1d621a;}})[_0xcbd1('0x3a')](function(_0x41ea03){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41ea03);throw _0x41ea03;});}return _0x1d621a;})[_0xcbd1('0x16')](respondWithResult(_0x405fa1,0xc9))[_0xcbd1('0x3a')](handleError(_0x405fa1,null));};exports[_0xcbd1('0x4b')]=function(_0x3af918,_0x208a55){if(_0x3af918[_0xcbd1('0x40')]['id']){delete _0x3af918['body']['id'];}return db[_0xcbd1('0x26')][_0xcbd1('0x3d')]({'where':{'id':_0x3af918[_0xcbd1('0x3e')]['id']}})[_0xcbd1('0x16')](handleEntityNotFound(_0x208a55,null))[_0xcbd1('0x16')](function(_0x45bc3e){if(_0x45bc3e){return db[_0xcbd1('0x26')]['update'](_[_0xcbd1('0x35')](_0x3af918[_0xcbd1('0x40')],[_0xcbd1('0x43'),_0xcbd1('0x4c'),_0xcbd1('0x4d'),_0xcbd1('0x4e'),_0xcbd1('0x4f'),_0xcbd1('0x50'),_0xcbd1('0x51')]),{'where':{'context':_0x45bc3e[_0xcbd1('0x4c')],'exten':_0x45bc3e[_0xcbd1('0x43')]},'individualHooks':!![]})[_0xcbd1('0x16')](function(_0x43b68a){return _0x43b68a;});}return null;})[_0xcbd1('0x16')](respondWithStatusCode(_0x208a55,null))[_0xcbd1('0x3a')](handleError(_0x208a55,null));};exports['addApplications']=function(_0x1ea47e,_0x44ed4f){var _0xeba8b4=_0x1ea47e[_0xcbd1('0x3e')]['id'];var _0x12b52d=_0x1ea47e['body'];var _0x4529fa=0xc8;var _0x1ce9a5=null;return db[_0xcbd1('0x52')][_0xcbd1('0x53')]({'isolationLevel':db['sequelize'][_0xcbd1('0x54')][_0xcbd1('0x55')]['READ_COMMITTED']},function(_0x524615){return db[_0xcbd1('0x26')][_0xcbd1('0x56')]({'where':{'id':_0xeba8b4},'transaction':_0x524615})[_0xcbd1('0x16')](function(_0x4d22c9){if(_0x4d22c9){return db[_0xcbd1('0x26')][_0xcbd1('0x15')]({'where':{'VoiceExtensionId':_0xeba8b4},'transaction':_0x524615})[_0xcbd1('0x16')](function(){var _0x420a4a=_['map'](_0x12b52d,function(_0x5d8ce7){_0x5d8ce7[_0xcbd1('0x57')]=_0xeba8b4;_0x5d8ce7[_0xcbd1('0x58')]=!![];return _0x5d8ce7;});return _0x4d22c9['createRouting'](_0x420a4a);})[_0xcbd1('0x16')](function(_0x2d74b3){return db[_0xcbd1('0x26')][_0xcbd1('0x59')](_0x2d74b3,{'transaction':_0x524615});});}else{_0x4529fa=0x194;_0x1ce9a5=[];}});})[_0xcbd1('0x16')](function(){if(_0x4529fa!==0x194){return db[_0xcbd1('0x26')][_0xcbd1('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0xeba8b4},'order':_0xcbd1('0x5b')})[_0xcbd1('0x16')](function(_0x2ba049){_0x1ce9a5=_0x2ba049;});}})[_0xcbd1('0x3a')](function(_0x1c6e77){_0x4529fa=0x1f4;logger['error'](_0x1c6e77['stack']);if(_0x1c6e77[_0xcbd1('0x20')]){delete _0x1c6e77[_0xcbd1('0x20')];}_0x1ce9a5=_0x1c6e77;})[_0xcbd1('0x5c')](function(){if(_0x1ce9a5===null){_0x44ed4f[_0xcbd1('0xd')](_0x4529fa);}else{if(_0x4529fa===0x1f4){_0x44ed4f[_0xcbd1('0xe')](_0x4529fa)['send'](_0x1ce9a5);}else{_0x44ed4f[_0xcbd1('0xe')](_0x4529fa)['json'](_0x1ce9a5);}}});}; \ No newline at end of file +var _0x7b73=['alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','InternalRoutes','internal','filter','ignore','map','value','find','name','UserProfileResource','error','stack','send','VoiceExtension','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','params','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition'];(function(_0x29f364,_0x422e00){var _0x3d78d0=function(_0x5a4c9a){while(--_0x5a4c9a){_0x29f364['push'](_0x29f364['shift']());}};_0x3d78d0(++_0x422e00);}(_0x7b73,0x6b));var _0x37b7=function(_0x49ccaa,_0x5944f2){_0x49ccaa=_0x49ccaa-0x0;var _0x2c1ae1=_0x7b73[_0x49ccaa];return _0x2c1ae1;};'use strict';var _=require(_0x37b7('0x0'));var Redis=require(_0x37b7('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x37b7('0x2'))(_0x37b7('0x3'));var config=require(_0x37b7('0x4'));var db=require(_0x37b7('0x5'))['db'];config[_0x37b7('0x6')]=_[_0x37b7('0x7')](config[_0x37b7('0x6')],{'host':_0x37b7('0x8'),'port':0x18eb});var socket=require(_0x37b7('0x9'))(new Redis(config[_0x37b7('0x6')]));require(_0x37b7('0xa'))[_0x37b7('0xb')](socket);function respondWithStatusCode(_0x14dcc,_0x2d5482){_0x2d5482=_0x2d5482||0xcc;return function(_0xbd1358){if(_0xbd1358){return _0x14dcc[_0x37b7('0xc')](_0x2d5482);}return _0x14dcc[_0x37b7('0xd')](_0x2d5482)[_0x37b7('0xe')]();};}function respondWithResult(_0x43158c,_0x3f6353){_0x3f6353=_0x3f6353||0xc8;return function(_0x295030){if(_0x295030){return _0x43158c[_0x37b7('0xd')](_0x3f6353)[_0x37b7('0xf')](_0x295030);}};}function respondWithFilteredResult(_0x4f877e,_0x29f4cd){return function(_0x190b36){if(_0x190b36){var _0x410826=typeof _0x29f4cd[_0x37b7('0x10')]===_0x37b7('0x11')&&typeof _0x29f4cd[_0x37b7('0x12')]==='undefined';var _0x7b6e43=_0x190b36[_0x37b7('0x13')];var _0x67f3b=_0x410826?0x0:_0x29f4cd[_0x37b7('0x10')];var _0x3968b1=_0x410826?_0x190b36['count']:_0x29f4cd[_0x37b7('0x10')]+_0x29f4cd[_0x37b7('0x12')];var _0x2d4396;if(_0x3968b1>=_0x7b6e43){_0x3968b1=_0x7b6e43;_0x2d4396=0xc8;}else{_0x2d4396=0xce;}_0x4f877e[_0x37b7('0xd')](_0x2d4396);return _0x4f877e[_0x37b7('0x14')](_0x37b7('0x15'),_0x67f3b+'-'+_0x3968b1+'/'+_0x7b6e43)['json'](_0x190b36);}return null;};}function removeEntity(_0x18f652){return function(_0x4086b7){if(_0x4086b7){return _0x4086b7[_0x37b7('0x16')]()[_0x37b7('0x17')](function(){var _0x2672e7=_0x4086b7[_0x37b7('0x18')]({'plain':!![]});var _0x1c4d10=[{'name':_0x37b7('0x19'),'value':_0x37b7('0x1a'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x37b7('0x1b'),'value':_0x37b7('0x1c'),'ignore':![]}];var _0x12959f=_(_0x1c4d10)[_0x37b7('0x1d')](_0x37b7('0x1e'))[_0x37b7('0x1f')](_0x37b7('0x20'))[_0x37b7('0x20')]();if(_['includes'](_0x12959f,_0x2672e7['type'])){return;}var _0x331b6e=_[_0x37b7('0x21')](_0x1c4d10,[_0x37b7('0x20'),_0x2672e7['type']])[_0x37b7('0x22')];return db[_0x37b7('0x23')][_0x37b7('0x16')]({'where':{'type':_0x331b6e,'resourceId':_0x2672e7['id']}})[_0x37b7('0x17')](function(){return _0x4086b7;});})[_0x37b7('0x17')](function(){_0x18f652[_0x37b7('0xd')](0xcc)[_0x37b7('0xe')]();});}};}function handleEntityNotFound(_0x2c3d7e){return function(_0x147b34){if(!_0x147b34){_0x2c3d7e[_0x37b7('0xc')](0x194);}return _0x147b34;};}function handleError(_0x479f4f,_0x10114c){_0x10114c=_0x10114c||0x1f4;return function(_0x399f9c){logger[_0x37b7('0x24')](_0x399f9c[_0x37b7('0x25')]);if(_0x399f9c[_0x37b7('0x22')]){delete _0x399f9c['name'];}_0x479f4f[_0x37b7('0xd')](_0x10114c)[_0x37b7('0x26')](_0x399f9c);};}exports['index']=function(_0x1580c3,_0x31d189){var _0x2c4449={},_0x3a8f4f={},_0x58d714={'count':0x0,'rows':[]};var _0x4a6183=_[_0x37b7('0x1f')](db[_0x37b7('0x27')][_0x37b7('0x28')],function(_0x16dd7f){return{'name':_0x16dd7f[_0x37b7('0x29')],'type':_0x16dd7f[_0x37b7('0x2a')][_0x37b7('0x2b')]};});_0x3a8f4f[_0x37b7('0x2c')]=_['map'](_0x4a6183,_0x37b7('0x22'));_0x3a8f4f['query']=_[_0x37b7('0x2d')](_0x1580c3['query']);_0x3a8f4f[_0x37b7('0x2e')]=_[_0x37b7('0x2f')](_0x3a8f4f['model'],_0x3a8f4f['query']);_0x2c4449[_0x37b7('0x30')]=_[_0x37b7('0x2f')](_0x3a8f4f[_0x37b7('0x2c')],qs[_0x37b7('0x31')](_0x1580c3[_0x37b7('0x32')]['fields']));_0x2c4449[_0x37b7('0x30')]=_0x2c4449[_0x37b7('0x30')][_0x37b7('0x33')]?_0x2c4449[_0x37b7('0x30')]:_0x3a8f4f[_0x37b7('0x2c')];if(!_0x1580c3['query'][_0x37b7('0x34')]('nolimit')){_0x2c4449[_0x37b7('0x12')]=qs[_0x37b7('0x12')](_0x1580c3[_0x37b7('0x32')][_0x37b7('0x12')]);_0x2c4449[_0x37b7('0x10')]=qs[_0x37b7('0x10')](_0x1580c3[_0x37b7('0x32')][_0x37b7('0x10')]);}_0x2c4449[_0x37b7('0x35')]=qs[_0x37b7('0x36')](_0x1580c3['query']['sort']);_0x2c4449[_0x37b7('0x37')]=qs[_0x37b7('0x2e')](_[_0x37b7('0x38')](_0x1580c3[_0x37b7('0x32')],_0x3a8f4f[_0x37b7('0x2e')]),_0x4a6183);if(_0x1580c3[_0x37b7('0x32')][_0x37b7('0x1d')]){_0x2c4449['where']=_[_0x37b7('0x39')](_0x2c4449[_0x37b7('0x37')],{'$or':_[_0x37b7('0x1f')](_0x4a6183,function(_0x14fc5f){if(_0x14fc5f[_0x37b7('0x2a')]!==_0x37b7('0x3a')){var _0x278475={};_0x278475[_0x14fc5f[_0x37b7('0x22')]]={'$like':'%'+_0x1580c3[_0x37b7('0x32')][_0x37b7('0x1d')]+'%'};return _0x278475;}})});}_0x2c4449=_[_0x37b7('0x39')]({},_0x2c4449,_0x1580c3[_0x37b7('0x3b')]);var _0x293b66={'where':_0x2c4449[_0x37b7('0x37')]};return db['VoiceExtension'][_0x37b7('0x13')](_0x293b66)['then'](function(_0x58af4f){_0x58d714[_0x37b7('0x13')]=_0x58af4f;if(_0x1580c3[_0x37b7('0x32')]['includeAll']){_0x2c4449[_0x37b7('0x3c')]=[{'all':!![]}];}return db[_0x37b7('0x27')][_0x37b7('0x3d')](_0x2c4449);})[_0x37b7('0x17')](function(_0x2c73a6){_0x58d714[_0x37b7('0x3e')]=_0x2c73a6;return _0x58d714;})['then'](respondWithFilteredResult(_0x31d189,_0x2c4449))[_0x37b7('0x3f')](handleError(_0x31d189,null));};exports['show']=function(_0x2d0188,_0x13b1a6){var _0x1fb331={'raw':![],'where':{'id':_0x2d0188[_0x37b7('0x40')]['id']}},_0x255e9b={};_0x255e9b[_0x37b7('0x2c')]=_[_0x37b7('0x2d')](db['VoiceExtension'][_0x37b7('0x28')]);_0x255e9b[_0x37b7('0x32')]=_[_0x37b7('0x2d')](_0x2d0188['query']);_0x255e9b[_0x37b7('0x2e')]=_[_0x37b7('0x2f')](_0x255e9b[_0x37b7('0x2c')],_0x255e9b['query']);_0x1fb331[_0x37b7('0x30')]=_[_0x37b7('0x2f')](_0x255e9b[_0x37b7('0x2c')],qs[_0x37b7('0x31')](_0x2d0188[_0x37b7('0x32')][_0x37b7('0x31')]));_0x1fb331[_0x37b7('0x30')]=_0x1fb331[_0x37b7('0x30')][_0x37b7('0x33')]?_0x1fb331[_0x37b7('0x30')]:_0x255e9b[_0x37b7('0x2c')];if(_0x2d0188[_0x37b7('0x32')]['includeAll']){_0x1fb331[_0x37b7('0x3c')]=[{'all':!![]}];}_0x1fb331=_[_0x37b7('0x39')]({},_0x1fb331,_0x2d0188[_0x37b7('0x3b')]);return db[_0x37b7('0x27')][_0x37b7('0x21')](_0x1fb331)[_0x37b7('0x17')](handleEntityNotFound(_0x13b1a6,null))[_0x37b7('0x17')](respondWithResult(_0x13b1a6,null))[_0x37b7('0x3f')](handleError(_0x13b1a6,null));};exports[_0x37b7('0x16')]=function(_0x473435,_0x43ed77){return db[_0x37b7('0x27')]['find']({'where':{'id':_0x473435['params']['id']}})[_0x37b7('0x17')](handleEntityNotFound(_0x43ed77,null))[_0x37b7('0x17')](removeEntity(_0x43ed77,null))[_0x37b7('0x3f')](handleError(_0x43ed77,null));};exports['create']=function(_0x18433b,_0x265472){if(_0x18433b[_0x37b7('0x41')][_0x37b7('0x2a')]==='outbound'&&!_['startsWith'](_0x18433b[_0x37b7('0x41')][_0x37b7('0x42')],'_')){_0x18433b[_0x37b7('0x41')][_0x37b7('0x42')]='_'[_0x37b7('0x43')](_0x18433b[_0x37b7('0x41')][_0x37b7('0x42')]);}return db['VoiceExtension'][_0x37b7('0x44')](_0x18433b[_0x37b7('0x41')],{'raw':![]})[_0x37b7('0x17')](function(_0x1b02cb){var _0x207019=_0x18433b['user']['get']({'plain':!![]});if(!_0x207019)throw new Error(_0x37b7('0x45'));if(_0x207019[_0x37b7('0x46')]==='user'){var _0x29a840=_0x1b02cb[_0x37b7('0x18')]({'plain':!![]});var _0x1e6003=[{'name':_0x37b7('0x19'),'value':_0x37b7('0x1a')},{'name':'OutboundRoutes','value':_0x37b7('0x47')},{'name':_0x37b7('0x1b'),'value':_0x37b7('0x1c')}];var _0x3d26db=_[_0x37b7('0x21')](_0x1e6003,[_0x37b7('0x20'),_0x29a840['type']])[_0x37b7('0x22')];return db['UserProfileSection']['find']({'where':{'name':_0x3d26db,'userProfileId':_0x207019[_0x37b7('0x48')]},'raw':!![]})[_0x37b7('0x17')](function(_0x3b4db3){if(_0x3b4db3&&_0x3b4db3[_0x37b7('0x49')]===0x0){return db['UserProfileResource'][_0x37b7('0x44')]({'name':_0x29a840['name'],'resourceId':_0x29a840['id'],'type':_0x3b4db3[_0x37b7('0x22')],'sectionId':_0x3b4db3['id']},{})['then'](function(){return _0x1b02cb;});}else{return _0x1b02cb;}})[_0x37b7('0x3f')](function(_0x3a9279){logger[_0x37b7('0x24')](_0x37b7('0x4a'),_0x3a9279);throw _0x3a9279;});}return _0x1b02cb;})[_0x37b7('0x17')](respondWithResult(_0x265472,0xc9))[_0x37b7('0x3f')](handleError(_0x265472,null));};exports[_0x37b7('0x4b')]=function(_0x3b32ea,_0x127b3f){if(_0x3b32ea['body']['id']){delete _0x3b32ea[_0x37b7('0x41')]['id'];}return db[_0x37b7('0x27')]['find']({'where':{'id':_0x3b32ea['params']['id']}})[_0x37b7('0x17')](handleEntityNotFound(_0x127b3f,null))[_0x37b7('0x17')](function(_0x15fec2){if(_0x15fec2){return db[_0x37b7('0x27')][_0x37b7('0x4b')](_[_0x37b7('0x38')](_0x3b32ea[_0x37b7('0x41')],[_0x37b7('0x42'),_0x37b7('0x4c'),_0x37b7('0x4d'),_0x37b7('0x4e'),_0x37b7('0x4f'),_0x37b7('0x50'),_0x37b7('0x51')]),{'where':{'context':_0x15fec2[_0x37b7('0x4c')],'exten':_0x15fec2[_0x37b7('0x42')]},'individualHooks':!![]})[_0x37b7('0x17')](function(_0x37320d){return _0x37320d;});}return null;})['then'](respondWithStatusCode(_0x127b3f,null))[_0x37b7('0x3f')](handleError(_0x127b3f,null));};exports[_0x37b7('0x52')]=function(_0x1a0acc,_0x5b81be){var _0x255ae0=_0x1a0acc['params']['id'];var _0x296bc4=_0x1a0acc[_0x37b7('0x41')];var _0x4a59c8=0xc8;var _0x316432=null;return db[_0x37b7('0x53')][_0x37b7('0x54')]({'isolationLevel':db[_0x37b7('0x53')][_0x37b7('0x55')][_0x37b7('0x56')]['READ_COMMITTED']},function(_0x38817d){return db[_0x37b7('0x27')][_0x37b7('0x57')]({'where':{'id':_0x255ae0},'transaction':_0x38817d})[_0x37b7('0x17')](function(_0x52c407){if(_0x52c407){return db[_0x37b7('0x27')][_0x37b7('0x16')]({'where':{'VoiceExtensionId':_0x255ae0},'transaction':_0x38817d})[_0x37b7('0x17')](function(){var _0x2c35a7=_[_0x37b7('0x1f')](_0x296bc4,function(_0x27a04a){_0x27a04a[_0x37b7('0x58')]=_0x255ae0;_0x27a04a[_0x37b7('0x59')]=!![];return _0x27a04a;});return _0x52c407[_0x37b7('0x5a')](_0x2c35a7);})[_0x37b7('0x17')](function(_0x4d8651){return db[_0x37b7('0x27')][_0x37b7('0x5b')](_0x4d8651,{'transaction':_0x38817d});});}else{_0x4a59c8=0x194;_0x316432=[];}});})[_0x37b7('0x17')](function(){if(_0x4a59c8!==0x194){return db[_0x37b7('0x27')][_0x37b7('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x255ae0},'order':_0x37b7('0x5d')})[_0x37b7('0x17')](function(_0x45d4ae){_0x316432=_0x45d4ae;});}})['catch'](function(_0xbaa51b){_0x4a59c8=0x1f4;logger[_0x37b7('0x24')](_0xbaa51b['stack']);if(_0xbaa51b[_0x37b7('0x22')]){delete _0xbaa51b[_0x37b7('0x22')];}_0x316432=_0xbaa51b;})['finally'](function(){if(_0x316432===null){_0x5b81be[_0x37b7('0xc')](_0x4a59c8);}else{if(_0x4a59c8===0x1f4){_0x5b81be[_0x37b7('0xd')](_0x4a59c8)[_0x37b7('0x26')](_0x316432);}else{_0x5b81be[_0x37b7('0xd')](_0x4a59c8)[_0x37b7('0xf')](_0x316432);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0f0ccf6..92020e0 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 _0xe81b=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x22a393,_0x2dcce5){var _0x29859b=function(_0x4ac5e1){while(--_0x4ac5e1){_0x22a393['push'](_0x22a393['shift']());}};_0x29859b(++_0x2dcce5);}(_0xe81b,0x12b));var _0xbe81=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe81b[_0x2235bf];return _0x4c3a64;};'use strict';var EventEmitter=require(_0xbe81('0x0'));var VoiceExtension=require(_0xbe81('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbe81('0x2')](0x0);var events={'afterCreate':_0xbe81('0x3'),'afterUpdate':_0xbe81('0x4'),'afterDestroy':_0xbe81('0x5')};function emitEvent(_0x193df3){return function(_0x5d262a,_0x1fff00,_0x164678){VoiceExtensionEvents['emit'](_0x193df3+':'+_0x5d262a['id'],_0x5d262a);VoiceExtensionEvents[_0xbe81('0x6')](_0x193df3,_0x5d262a);_0x164678(null);};}for(var e in events){if(events[_0xbe81('0x7')](e)){var event=events[e];VoiceExtension[_0xbe81('0x8')](e,emitEvent(event));}}module[_0xbe81('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x2636=['events','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2636,0xe1));var _0x6263=function(_0x3d924f,_0x2af218){_0x3d924f=_0x3d924f-0x0;var _0x5db88c=_0x2636[_0x3d924f];return _0x5db88c;};'use strict';var EventEmitter=require(_0x6263('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6263('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6263('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2e37fe){return function(_0x251d45,_0xc2fd98,_0x18c34f){VoiceExtensionEvents[_0x6263('0x3')](_0x2e37fe+':'+_0x251d45['id'],_0x251d45);VoiceExtensionEvents[_0x6263('0x3')](_0x2e37fe,_0x251d45);_0x18c34f(null);};}for(var e in events){if(events[_0x6263('0x4')](e)){var event=events[e];VoiceExtension['hook'](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 c275cd6..bd36aaf 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 _0xc5b4=['wav','timeout','options','url','length','name','trunk','param','split','phone','prefix','SIP','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0xc5b4,0x1cb));var _0x4c5b=function(_0x3385af,_0x1b6219){_0x3385af=_0x3385af-0x0;var _0x52232a=_0xc5b4[_0x3385af];return _0x52232a;};'use strict';var _=require(_0x4c5b('0x0'));var attributes=require(_0x4c5b('0x1'));module[_0x4c5b('0x2')]=function(_0x1da885){var _0x4b5219=_0x1da885[_0x4c5b('0x3')];function _0x48da66(_0x336e75){var _0x5f0720=0x2;var _0x3dfc1d=[{'type':_0x336e75[_0x4c5b('0x4')],'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x6')+_0x336e75['type'],'context':_0x336e75['context'],'exten':_0x336e75[_0x4c5b('0x7')],'priority':_0x5f0720++,'VoiceExtensionId':_0x336e75['id']},{'type':_0x336e75[_0x4c5b('0x4')],'app':_0x336e75[_0x4c5b('0x8')]?_0x4c5b('0x5'):_0x4c5b('0x9'),'appdata':_0x336e75[_0x4c5b('0x8')]?_0x4c5b('0xa')+_0x336e75['alias']:_0x4c5b('0xb'),'context':_0x336e75[_0x4c5b('0xc')],'exten':_0x336e75[_0x4c5b('0x7')],'priority':_0x5f0720++,'VoiceExtensionId':_0x336e75['id']}];if(_0x336e75[_0x4c5b('0x4')]===_0x4c5b('0xd')){_0x3dfc1d['push']({'type':_0x4c5b('0xd'),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0xe')+_0x336e75['id'],'context':_0x336e75[_0x4c5b('0xc')],'exten':_0x336e75[_0x4c5b('0x7')],'priority':_0x5f0720++,'VoiceExtensionId':_0x336e75['id']});}_0x3dfc1d[_0x4c5b('0xf')]({'type':_0x336e75[_0x4c5b('0x4')],'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x10'),'context':_0x336e75['context'],'exten':_0x336e75[_0x4c5b('0x7')],'priority':_0x5f0720++,'VoiceExtensionId':_0x336e75['id']},{'type':_0x336e75[_0x4c5b('0x4')],'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x11'),'context':_0x336e75[_0x4c5b('0xc')],'exten':_0x336e75['exten'],'priority':_0x5f0720++,'VoiceExtensionId':_0x336e75['id']},{'type':_0x336e75[_0x4c5b('0x4')],'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x12'),'context':_0x336e75[_0x4c5b('0xc')],'exten':_0x336e75[_0x4c5b('0x7')],'priority':_0x5f0720++,'VoiceExtensionId':_0x336e75['id']});return _0x3dfc1d;}function _0x3371a0(_0x34ee2f){var _0x52465d=0x2;var _0x8ba823=[{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x14'),'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x34ee2f[_0x4c5b('0x8')]?_0x4c5b('0x5'):_0x4c5b('0x9'),'appdata':_0x34ee2f[_0x4c5b('0x8')]?_0x4c5b('0xa')+_0x34ee2f[_0x4c5b('0x8')]:_0x4c5b('0xb'),'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f['exten'],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x15')+(_0x34ee2f[_0x4c5b('0x16')]?_0x4c5b('0x17')+_0x34ee2f[_0x4c5b('0x16')]+'}':_0x4c5b('0x18')),'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':'CDR(routeid)='+_0x34ee2f['id'],'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x19'),'appdata':_0x4c5b('0x1a')+(_0x52465d+0x2)+'):Goto('+(_0x52465d+0x1)+')','context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':_0x34ee2f[_0x4c5b('0x16')]?'CDR(prefix)=${EXTEN:0:'+_0x34ee2f[_0x4c5b('0x16')]+'}':_0x4c5b('0x1b'),'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x10'),'context':_0x34ee2f['context'],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x11'),'context':_0x34ee2f['context'],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':'outbound','app':'Set','appdata':_0x4c5b('0x12'),'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':'Set','appdata':'outboundrouteid='+_0x34ee2f['id'],'context':_0x34ee2f['context'],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']}];if(_0x34ee2f[_0x4c5b('0x1c')](_0x4c5b('0x1d'))&&_0x34ee2f[_0x4c5b('0x1d')]!==_0x4c5b('0x1e')){_0x8ba823[_0x4c5b('0xf')]({'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x1f'),'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f[_0x4c5b('0x7')],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']},{'type':_0x4c5b('0x13'),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x20')+_0x34ee2f[_0x4c5b('0x1d')]||_0x4c5b('0x21'),'context':_0x34ee2f[_0x4c5b('0xc')],'exten':_0x34ee2f['exten'],'priority':_0x52465d++,'VoiceExtensionId':_0x34ee2f['id']});}return _0x8ba823;}function _0x27ee75(_0x132b48,_0xc92a91){var _0x571ae6=[{'name':'trunk','param':0x0},{'name':_0x4c5b('0x22'),'param':0x1},{'name':_0x4c5b('0x23'),'param':0x2},{'name':_0x4c5b('0x24'),'param':0x3}];var _0x1b63c2={};var _0x625977=_0xc92a91['split'](',');var _0x24b6be=[];for(var _0x31ae7e=0x0;_0x31ae7e<_0x571ae6[_0x4c5b('0x25')];_0x31ae7e++){switch(_0x571ae6[_0x31ae7e][_0x4c5b('0x26')]){case'trunk':_0x1b63c2[_0x4c5b('0x27')]=_0x625977[_0x571ae6[_0x31ae7e][_0x4c5b('0x28')]][_0x4c5b('0x29')]('/')[0x1];_0x1b63c2[_0x4c5b('0x2a')]=_0x625977[_0x571ae6[_0x31ae7e][_0x4c5b('0x28')]][_0x4c5b('0x29')]('/')[0x2];_0x1b63c2['prefix']=_0x1b63c2['phone']?_0x1b63c2[_0x4c5b('0x2a')][_0x4c5b('0x29')]('$')[0x0]:undefined;_0x1b63c2[_0x4c5b('0x2a')]=_0x132b48[_0x4c5b('0x16')]?(_0x1b63c2[_0x4c5b('0x2b')]||'')+_0x4c5b('0x17')+_0x132b48[_0x4c5b('0x16')]+'}':(_0x1b63c2['prefix']||'')+'${EXTEN}';_0x24b6be[_0x571ae6[_0x31ae7e][_0x4c5b('0x28')]]=[_0x4c5b('0x2c'),_0x1b63c2[_0x4c5b('0x27')],_0x1b63c2[_0x4c5b('0x2a')]]['join']('/');break;case _0x4c5b('0x23'):_0x1b63c2['options']=_0x625977[_0x571ae6[_0x31ae7e]['param']];if(_0x132b48[_0x4c5b('0x1d')]!==_0x4c5b('0x1e')){if(_0x1b63c2[_0x4c5b('0x23')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x1b63c2[_0x4c5b('0x23')]+=_0x4c5b('0x2d');}}else{_0x1b63c2[_0x4c5b('0x23')]=_0x1b63c2[_0x4c5b('0x23')][_0x4c5b('0x2e')](_0x4c5b('0x2d'),'');}_0x24b6be[_0x571ae6[_0x31ae7e][_0x4c5b('0x28')]]=_0x1b63c2[_0x4c5b('0x23')];break;default:_0x24b6be[_0x571ae6[_0x31ae7e][_0x4c5b('0x28')]]=_0x625977[_0x571ae6[_0x31ae7e][_0x4c5b('0x28')]];}}return _0x24b6be['join'](',');}function _0x2d40c6(_0x63d1c5,_0xc56a74,_0x277bee){return new Promise(function(_0x2cdd9d,_0x146bc1){var _0x25f940=[];if(_[_0x4c5b('0x2f')](_0xc56a74))return _0x2cdd9d(_0x25f940);_0x4b5219[_0x4c5b('0x30')]['findAll']({'attributes':['id','interval',_0x4c5b('0x31')],'raw':!![]})[_0x4c5b('0x32')](function(_0x55612d){for(var _0x37beb8=0x0,_0x15b3a0=0x0;_0x37beb8<_0xc56a74[_0x4c5b('0x25')];_0x37beb8++,_0x15b3a0=0x0){var _0x5a8bb5=_0xc56a74[_0x37beb8];var _0x17c715=[];var _0x3b04c7=[];delete _0x5a8bb5['id'];if(_0x5a8bb5[_0x4c5b('0x33')]!==_0x4c5b('0x34')){_0x5a8bb5[_0x4c5b('0x35')]=[_0x5a8bb5[_0x4c5b('0x33')]];}else{_0x5a8bb5['intervals']=_0x5a8bb5[_0x4c5b('0x31')]?_[_0x4c5b('0x36')](_[_0x4c5b('0x37')](_0x55612d,{'IntervalId':_0x5a8bb5[_0x4c5b('0x31')]}),_0x4c5b('0x33')):[];}_0x5a8bb5['context']=_0x63d1c5['context'];_0x5a8bb5[_0x4c5b('0x7')]=_0x63d1c5['exten'];if(_0x5a8bb5[_0x4c5b('0x4')])_0x5a8bb5[_0x4c5b('0x4')]=_0x5a8bb5['type'][_0x4c5b('0x38')]();if(_0x63d1c5['type']==='outbound'){if(_0x5a8bb5[_0x4c5b('0x1c')](_0x4c5b('0x39'))&&_0x5a8bb5['tag']&&_0x5a8bb5[_0x4c5b('0x39')]!=='--'){_0x17c715['push']({'type':_0x5a8bb5[_0x4c5b('0x4')][_0x4c5b('0x38')](),'app':_0x4c5b('0x5'),'appdata':_0x4c5b('0x3a')+_0x5a8bb5[_0x4c5b('0x39')],'context':_0x63d1c5['context'],'exten':_0x63d1c5[_0x4c5b('0x7')],'priority':_0x5a8bb5[_0x4c5b('0x35')][_0x4c5b('0x25')]+_0x277bee+_0x15b3a0++,'VoiceExtensionId':_0x63d1c5['id']});}_0x17c715['push']({'type':_0x5a8bb5[_0x4c5b('0x4')][_0x4c5b('0x38')](),'app':_0x4c5b('0x19'),'appdata':_0x4c5b('0x3b')+(_0x5a8bb5[_0x4c5b('0x3c')]?'Set(CALLERID(all)='+_0x5a8bb5[_0x4c5b('0x3c')]+')':_0x4c5b('0x3d')),'context':_0x63d1c5['context'],'exten':_0x63d1c5['exten'],'priority':_0x5a8bb5[_0x4c5b('0x35')][_0x4c5b('0x25')]+_0x277bee+_0x15b3a0++,'VoiceExtensionId':_0x63d1c5['id']});}else{if(_0x5a8bb5[_0x4c5b('0x1c')](_0x4c5b('0x3e'))){if([_0x4c5b('0x3f'),_0x4c5b('0x40')]['includes'](_0x5a8bb5[_0x4c5b('0x41')][_0x4c5b('0x38')]())&&_0x5a8bb5[_0x4c5b('0x42')]!=='custom'){if(_0x5a8bb5[_0x4c5b('0x3e')]){_0x17c715['push']({'type':_0x5a8bb5[_0x4c5b('0x4')][_0x4c5b('0x38')](),'app':_0x4c5b('0x19'),'appdata':_0x4c5b('0x43'),'context':_0x63d1c5['context'],'exten':_0x63d1c5['exten'],'priority':_0x5a8bb5[_0x4c5b('0x35')][_0x4c5b('0x25')]+_0x277bee+_0x15b3a0++,'VoiceExtensionId':_0x63d1c5['id']});_0x17c715[_0x4c5b('0xf')]({'type':_0x5a8bb5[_0x4c5b('0x4')][_0x4c5b('0x38')](),'app':'Set','appdata':_0x4c5b('0x44'),'context':_0x63d1c5[_0x4c5b('0xc')],'exten':_0x63d1c5['exten'],'priority':_0x5a8bb5[_0x4c5b('0x35')][_0x4c5b('0x25')]+_0x277bee+_0x15b3a0++,'VoiceExtensionId':_0x63d1c5['id']});}else{_0x17c715[_0x4c5b('0xf')]({'type':_0x5a8bb5['type'][_0x4c5b('0x38')](),'app':_0x4c5b('0x19'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x63d1c5[_0x4c5b('0xc')],'exten':_0x63d1c5[_0x4c5b('0x7')],'priority':_0x5a8bb5[_0x4c5b('0x35')]['length']+_0x277bee+_0x15b3a0++,'VoiceExtensionId':_0x63d1c5['id']});_0x17c715[_0x4c5b('0xf')]({'type':_0x5a8bb5[_0x4c5b('0x4')][_0x4c5b('0x38')](),'app':_0x4c5b('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x63d1c5[_0x4c5b('0xc')],'exten':_0x63d1c5[_0x4c5b('0x7')],'priority':_0x5a8bb5[_0x4c5b('0x35')]['length']+_0x277bee+_0x15b3a0++,'VoiceExtensionId':_0x63d1c5['id']});}}}}for(var _0x1eb488=0x0;_0x1eb488<_0x5a8bb5[_0x4c5b('0x35')][_0x4c5b('0x25')];_0x1eb488++){var _0x7cc575=_0x277bee+_0x5a8bb5[_0x4c5b('0x35')]['length'];var _0x4d1bdb=_0x1eb488===_0x5a8bb5[_0x4c5b('0x35')][_0x4c5b('0x25')]-0x1?_0x277bee+_0x17c715[_0x4c5b('0x25')]+_0x3b04c7[_0x4c5b('0x25')]+0x2:_0x277bee+_0x1eb488+0x1;_0x17c715[_0x4c5b('0x45')](_0x1eb488,0x0,{'type':_0x63d1c5['type'],'app':_0x4c5b('0x46'),'appdata':_0x5a8bb5[_0x4c5b('0x35')][_0x1eb488]+'?'+_0x63d1c5[_0x4c5b('0xc')]+_0x4c5b('0x47')+_0x7cc575+':'+_0x63d1c5[_0x4c5b('0xc')]+_0x4c5b('0x47')+_0x4d1bdb,'exten':_0x63d1c5[_0x4c5b('0x7')],'context':_0x63d1c5[_0x4c5b('0xc')],'priority':_0x277bee+_0x1eb488,'VoiceExtensionId':_0x63d1c5['id']});}if(_0x5a8bb5[_0x4c5b('0x42')]===_0x4c5b('0x48'))_0x5a8bb5['appdata']=_0x27ee75(_0x63d1c5,_0x5a8bb5[_0x4c5b('0x49')]);_0x5a8bb5[_0x4c5b('0x4a')]=_0x17c715['length']?_[_0x4c5b('0x4b')](_0x17c715)[_0x4c5b('0x4a')]+0x1:_0x277bee;_0x25f940=_[_0x4c5b('0x4c')](_0x25f940,_0x17c715,[_0x5a8bb5],_0x3b04c7);_0x277bee=_[_0x4c5b('0x4b')](_0x25f940)['priority']+0x1;}return _0x2cdd9d(_0x25f940);})[_0x4c5b('0x4d')](function(_0x4fb8a7){_0x146bc1(_0x4fb8a7);});});}return _0x1da885[_0x4c5b('0x4e')]('VoiceExtension',attributes,{'tableName':_0x4c5b('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3f7846){var _0x5c5355=this[_0x4c5b('0x50')]({'plain':!![]});var _0x46b5e6=_0x5c5355[_0x4c5b('0x4')]===_0x4c5b('0x13')?_0x3371a0(_0x5c5355):_0x48da66(_0x5c5355);return _0x2d40c6(_0x5c5355,_0x3f7846,_[_0x4c5b('0x4b')](_0x46b5e6)[_0x4c5b('0x4a')]+0x1)[_0x4c5b('0x32')](function(_0x5ec675){var _0x442b57=_['concat'](_0x46b5e6,_0x5ec675);_0x442b57[_0x4c5b('0xf')]({'type':_0x5c5355[_0x4c5b('0x4')],'app':_0x4c5b('0x51'),'exten':_0x5c5355[_0x4c5b('0x7')],'context':_0x5c5355['context'],'priority':_['last'](_0x442b57)[_0x4c5b('0x4a')]+0x1,'VoiceExtensionId':_0x5c5355['id']});return _0x442b57;});}}});}; \ No newline at end of file +var _0x4074=['models','type','Set','CDR(type)=','exten','alias','NoOp','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','name','param','phone','prefix','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','length','*,*,*,*','intervals','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports'];(function(_0x568d13,_0x3acd44){var _0x1918ef=function(_0x66d2a9){while(--_0x66d2a9){_0x568d13['push'](_0x568d13['shift']());}};_0x1918ef(++_0x3acd44);}(_0x4074,0xf0));var _0x4407=function(_0x9067e7,_0x319776){_0x9067e7=_0x9067e7-0x0;var _0x3eda03=_0x4074[_0x9067e7];return _0x3eda03;};'use strict';var _=require(_0x4407('0x0'));var attributes=require(_0x4407('0x1'));module[_0x4407('0x2')]=function(_0x52977e){var _0x1021e6=_0x52977e[_0x4407('0x3')];function _0x14c0bc(_0x35ad38){var _0x188494=0x2;var _0x3c9f5c=[{'type':_0x35ad38[_0x4407('0x4')],'app':_0x4407('0x5'),'appdata':_0x4407('0x6')+_0x35ad38[_0x4407('0x4')],'context':_0x35ad38['context'],'exten':_0x35ad38[_0x4407('0x7')],'priority':_0x188494++,'VoiceExtensionId':_0x35ad38['id']},{'type':_0x35ad38['type'],'app':_0x35ad38[_0x4407('0x8')]?_0x4407('0x5'):_0x4407('0x9'),'appdata':_0x35ad38['alias']?'CDR(routeAlias)='+_0x35ad38['alias']:_0x4407('0xa'),'context':_0x35ad38[_0x4407('0xb')],'exten':_0x35ad38[_0x4407('0x7')],'priority':_0x188494++,'VoiceExtensionId':_0x35ad38['id']}];if(_0x35ad38[_0x4407('0x4')]===_0x4407('0xc')){_0x3c9f5c[_0x4407('0xd')]({'type':_0x4407('0xc'),'app':_0x4407('0x5'),'appdata':_0x4407('0xe')+_0x35ad38['id'],'context':_0x35ad38[_0x4407('0xb')],'exten':_0x35ad38[_0x4407('0x7')],'priority':_0x188494++,'VoiceExtensionId':_0x35ad38['id']});}_0x3c9f5c['push']({'type':_0x35ad38[_0x4407('0x4')],'app':_0x4407('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x35ad38[_0x4407('0xb')],'exten':_0x35ad38['exten'],'priority':_0x188494++,'VoiceExtensionId':_0x35ad38['id']},{'type':_0x35ad38[_0x4407('0x4')],'app':_0x4407('0x5'),'appdata':_0x4407('0xf'),'context':_0x35ad38[_0x4407('0xb')],'exten':_0x35ad38[_0x4407('0x7')],'priority':_0x188494++,'VoiceExtensionId':_0x35ad38['id']},{'type':_0x35ad38[_0x4407('0x4')],'app':_0x4407('0x5'),'appdata':_0x4407('0x10'),'context':_0x35ad38['context'],'exten':_0x35ad38[_0x4407('0x7')],'priority':_0x188494++,'VoiceExtensionId':_0x35ad38['id']});return _0x3c9f5c;}function _0x65b20b(_0x27af98){var _0x367d55=0x2;var _0x12952e=[{'type':'outbound','app':_0x4407('0x5'),'appdata':'CDR(type)=outbound','context':_0x27af98[_0x4407('0xb')],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':_0x4407('0x11'),'app':_0x27af98[_0x4407('0x8')]?_0x4407('0x5'):'NoOp','appdata':_0x27af98[_0x4407('0x8')]?'CDR(routeAlias)='+_0x27af98[_0x4407('0x8')]:_0x4407('0xa'),'context':_0x27af98[_0x4407('0xb')],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':'outbound','app':_0x4407('0x5'),'appdata':_0x4407('0x12')+(_0x27af98[_0x4407('0x13')]?_0x4407('0x14')+_0x27af98[_0x4407('0x13')]+'}':'${EXTEN}'),'context':_0x27af98[_0x4407('0xb')],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':_0x4407('0x11'),'app':_0x4407('0x5'),'appdata':_0x4407('0xe')+_0x27af98['id'],'context':_0x27af98['context'],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':'outbound','app':_0x4407('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x367d55+0x2)+_0x4407('0x16')+(_0x367d55+0x1)+')','context':_0x27af98['context'],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':'outbound','app':'Set','appdata':_0x27af98[_0x4407('0x13')]?_0x4407('0x17')+_0x27af98[_0x4407('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x27af98['context'],'exten':_0x27af98['exten'],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':_0x4407('0x11'),'app':_0x4407('0x5'),'appdata':_0x4407('0x18'),'context':_0x27af98[_0x4407('0xb')],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':_0x4407('0x11'),'app':_0x4407('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x27af98['context'],'exten':_0x27af98['exten'],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':_0x4407('0x11'),'app':_0x4407('0x5'),'appdata':_0x4407('0x10'),'context':_0x27af98[_0x4407('0xb')],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':_0x4407('0x11'),'app':_0x4407('0x5'),'appdata':_0x4407('0x19')+_0x27af98['id'],'context':_0x27af98[_0x4407('0xb')],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']}];if(_0x27af98['hasOwnProperty']('recordingFormat')&&_0x27af98[_0x4407('0x1a')]!==_0x4407('0x1b')){_0x12952e[_0x4407('0xd')]({'type':'outbound','app':_0x4407('0x5'),'appdata':_0x4407('0x1c'),'context':_0x27af98[_0x4407('0xb')],'exten':_0x27af98[_0x4407('0x7')],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']},{'type':_0x4407('0x11'),'app':'Set','appdata':_0x4407('0x1d')+_0x27af98['recordingFormat']||_0x4407('0x1e'),'context':_0x27af98['context'],'exten':_0x27af98['exten'],'priority':_0x367d55++,'VoiceExtensionId':_0x27af98['id']});}return _0x12952e;}function _0x18218e(_0x3d2d33,_0x3aa619){var _0x3a9537=[{'name':_0x4407('0x1f'),'param':0x0},{'name':_0x4407('0x20'),'param':0x1},{'name':_0x4407('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x28584b={};var _0x42c37f=_0x3aa619[_0x4407('0x22')](',');var _0x4e068f=[];for(var _0x49786c=0x0;_0x49786c<_0x3a9537['length'];_0x49786c++){switch(_0x3a9537[_0x49786c][_0x4407('0x23')]){case'trunk':_0x28584b[_0x4407('0x1f')]=_0x42c37f[_0x3a9537[_0x49786c][_0x4407('0x24')]][_0x4407('0x22')]('/')[0x1];_0x28584b[_0x4407('0x25')]=_0x42c37f[_0x3a9537[_0x49786c]['param']][_0x4407('0x22')]('/')[0x2];_0x28584b[_0x4407('0x26')]=_0x28584b[_0x4407('0x25')]?_0x28584b[_0x4407('0x25')][_0x4407('0x22')]('$')[0x0]:undefined;_0x28584b[_0x4407('0x25')]=_0x3d2d33[_0x4407('0x13')]?(_0x28584b[_0x4407('0x26')]||'')+_0x4407('0x14')+_0x3d2d33['cutdigits']+'}':(_0x28584b['prefix']||'')+_0x4407('0x27');_0x4e068f[_0x3a9537[_0x49786c][_0x4407('0x24')]]=[_0x4407('0x28'),_0x28584b[_0x4407('0x1f')],_0x28584b['phone']][_0x4407('0x29')]('/');break;case _0x4407('0x21'):_0x28584b[_0x4407('0x21')]=_0x42c37f[_0x3a9537[_0x49786c]['param']];if(_0x3d2d33[_0x4407('0x1a')]!=='none'){if(_0x28584b['options'][_0x4407('0x2a')](_0x4407('0x2b'))<0x0){_0x28584b[_0x4407('0x21')]+=_0x4407('0x2b');}}else{_0x28584b[_0x4407('0x21')]=_0x28584b['options'][_0x4407('0x2c')](_0x4407('0x2b'),'');}_0x4e068f[_0x3a9537[_0x49786c][_0x4407('0x24')]]=_0x28584b[_0x4407('0x21')];break;default:_0x4e068f[_0x3a9537[_0x49786c]['param']]=_0x42c37f[_0x3a9537[_0x49786c][_0x4407('0x24')]];}}return _0x4e068f[_0x4407('0x29')](',');}function _0x1a6b1e(_0x318102,_0x3c5dcc,_0x4c1c40){return new Promise(function(_0xc9953f,_0x53f2c4){var _0x51510a=[];if(_[_0x4407('0x2d')](_0x3c5dcc))return _0xc9953f(_0x51510a);_0x1021e6[_0x4407('0x2e')]['findAll']({'attributes':['id',_0x4407('0x2f'),_0x4407('0x30')],'raw':!![]})[_0x4407('0x31')](function(_0x4701c5){for(var _0x48fd70=0x0,_0x45f2a4=0x0;_0x48fd70<_0x3c5dcc[_0x4407('0x32')];_0x48fd70++,_0x45f2a4=0x0){var _0x1c80ec=_0x3c5dcc[_0x48fd70];var _0xce5e2a=[];var _0x281126=[];delete _0x1c80ec['id'];if(_0x1c80ec['interval']!==_0x4407('0x33')){_0x1c80ec[_0x4407('0x34')]=[_0x1c80ec[_0x4407('0x2f')]];}else{_0x1c80ec[_0x4407('0x34')]=_0x1c80ec[_0x4407('0x30')]?_['map'](_[_0x4407('0x35')](_0x4701c5,{'IntervalId':_0x1c80ec[_0x4407('0x30')]}),_0x4407('0x2f')):[];}_0x1c80ec[_0x4407('0xb')]=_0x318102['context'];_0x1c80ec[_0x4407('0x7')]=_0x318102[_0x4407('0x7')];if(_0x1c80ec['type'])_0x1c80ec[_0x4407('0x4')]=_0x1c80ec[_0x4407('0x4')]['toLowerCase']();if(_0x318102[_0x4407('0x4')]===_0x4407('0x11')){if(_0x1c80ec[_0x4407('0x36')]('tag')&&_0x1c80ec[_0x4407('0x37')]&&_0x1c80ec['tag']!=='--'){_0xce5e2a['push']({'type':_0x1c80ec[_0x4407('0x4')][_0x4407('0x38')](),'app':'Set','appdata':_0x4407('0x39')+_0x1c80ec[_0x4407('0x37')],'context':_0x318102[_0x4407('0xb')],'exten':_0x318102[_0x4407('0x7')],'priority':_0x1c80ec[_0x4407('0x34')]['length']+_0x4c1c40+_0x45f2a4++,'VoiceExtensionId':_0x318102['id']});}_0xce5e2a[_0x4407('0xd')]({'type':_0x1c80ec[_0x4407('0x4')][_0x4407('0x38')](),'app':_0x4407('0x15'),'appdata':_0x4407('0x3a')+(_0x1c80ec[_0x4407('0x3b')]?_0x4407('0x3c')+_0x1c80ec[_0x4407('0x3b')]+')':_0x4407('0x3d')),'context':_0x318102['context'],'exten':_0x318102[_0x4407('0x7')],'priority':_0x1c80ec['intervals'][_0x4407('0x32')]+_0x4c1c40+_0x45f2a4++,'VoiceExtensionId':_0x318102['id']});}else{if(_0x1c80ec[_0x4407('0x36')](_0x4407('0x3e'))){if([_0x4407('0x3f'),'playback']['includes'](_0x1c80ec['app'][_0x4407('0x38')]())&&_0x1c80ec[_0x4407('0x40')]!=='custom'){if(_0x1c80ec[_0x4407('0x3e')]){_0xce5e2a[_0x4407('0xd')]({'type':_0x1c80ec[_0x4407('0x4')][_0x4407('0x38')](),'app':'ExecIf','appdata':_0x4407('0x41'),'context':_0x318102[_0x4407('0xb')],'exten':_0x318102['exten'],'priority':_0x1c80ec[_0x4407('0x34')][_0x4407('0x32')]+_0x4c1c40+_0x45f2a4++,'VoiceExtensionId':_0x318102['id']});_0xce5e2a[_0x4407('0xd')]({'type':_0x1c80ec['type'][_0x4407('0x38')](),'app':_0x4407('0x5'),'appdata':_0x4407('0x42'),'context':_0x318102[_0x4407('0xb')],'exten':_0x318102[_0x4407('0x7')],'priority':_0x1c80ec[_0x4407('0x34')]['length']+_0x4c1c40+_0x45f2a4++,'VoiceExtensionId':_0x318102['id']});}else{_0xce5e2a[_0x4407('0xd')]({'type':_0x1c80ec[_0x4407('0x4')][_0x4407('0x38')](),'app':'ExecIf','appdata':_0x4407('0x43'),'context':_0x318102[_0x4407('0xb')],'exten':_0x318102[_0x4407('0x7')],'priority':_0x1c80ec[_0x4407('0x34')]['length']+_0x4c1c40+_0x45f2a4++,'VoiceExtensionId':_0x318102['id']});_0xce5e2a[_0x4407('0xd')]({'type':_0x1c80ec['type'][_0x4407('0x38')](),'app':_0x4407('0x5'),'appdata':_0x4407('0x44'),'context':_0x318102[_0x4407('0xb')],'exten':_0x318102[_0x4407('0x7')],'priority':_0x1c80ec[_0x4407('0x34')][_0x4407('0x32')]+_0x4c1c40+_0x45f2a4++,'VoiceExtensionId':_0x318102['id']});}}}}for(var _0x499940=0x0;_0x499940<_0x1c80ec[_0x4407('0x34')]['length'];_0x499940++){var _0x1c34ce=_0x4c1c40+_0x1c80ec[_0x4407('0x34')][_0x4407('0x32')];var _0x4cd15e=_0x499940===_0x1c80ec['intervals'][_0x4407('0x32')]-0x1?_0x4c1c40+_0xce5e2a[_0x4407('0x32')]+_0x281126[_0x4407('0x32')]+0x2:_0x4c1c40+_0x499940+0x1;_0xce5e2a[_0x4407('0x45')](_0x499940,0x0,{'type':_0x318102[_0x4407('0x4')],'app':'GotoIfTime','appdata':_0x1c80ec[_0x4407('0x34')][_0x499940]+'?'+_0x318102[_0x4407('0xb')]+_0x4407('0x46')+_0x1c34ce+':'+_0x318102[_0x4407('0xb')]+',${EXTEN},'+_0x4cd15e,'exten':_0x318102[_0x4407('0x7')],'context':_0x318102[_0x4407('0xb')],'priority':_0x4c1c40+_0x499940,'VoiceExtensionId':_0x318102['id']});}if(_0x1c80ec[_0x4407('0x40')]===_0x4407('0x47'))_0x1c80ec[_0x4407('0x48')]=_0x18218e(_0x318102,_0x1c80ec[_0x4407('0x48')]);_0x1c80ec[_0x4407('0x49')]=_0xce5e2a[_0x4407('0x32')]?_['last'](_0xce5e2a)[_0x4407('0x49')]+0x1:_0x4c1c40;_0x51510a=_[_0x4407('0x4a')](_0x51510a,_0xce5e2a,[_0x1c80ec],_0x281126);_0x4c1c40=_[_0x4407('0x4b')](_0x51510a)['priority']+0x1;}return _0xc9953f(_0x51510a);})[_0x4407('0x4c')](function(_0x4ce441){_0x53f2c4(_0x4ce441);});});}return _0x52977e[_0x4407('0x4d')](_0x4407('0x4e'),attributes,{'tableName':_0x4407('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x12e4fb){var _0x5e78fb=this['get']({'plain':!![]});var _0x6383c0=_0x5e78fb[_0x4407('0x4')]==='outbound'?_0x65b20b(_0x5e78fb):_0x14c0bc(_0x5e78fb);return _0x1a6b1e(_0x5e78fb,_0x12e4fb,_[_0x4407('0x4b')](_0x6383c0)[_0x4407('0x49')]+0x1)[_0x4407('0x31')](function(_0x45a90b){var _0x340339=_[_0x4407('0x4a')](_0x6383c0,_0x45a90b);_0x340339[_0x4407('0xd')]({'type':_0x5e78fb['type'],'app':_0x4407('0x50'),'exten':_0x5e78fb[_0x4407('0x7')],'context':_0x5e78fb['context'],'priority':_['last'](_0x340339)[_0x4407('0x49')]+0x1,'VoiceExtensionId':_0x5e78fb['id']});return _0x340339;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7dd31d1..2e080dd 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 _0xc838=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension','options','raw','where','include','map','model','attributes','info','debug','GetVoiceExtension','catch','lodash'];(function(_0x164ac6,_0x57330b){var _0x8af84a=function(_0xba245b){while(--_0xba245b){_0x164ac6['push'](_0x164ac6['shift']());}};_0x8af84a(++_0x57330b);}(_0xc838,0xbd));var _0x8c83=function(_0x31fe53,_0xc6efa7){_0x31fe53=_0x31fe53-0x0;var _0x4c7f1a=_0xc838[_0x31fe53];return _0x4c7f1a;};'use strict';var _=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var moment=require(_0x8c83('0x2'));var BPromise=require(_0x8c83('0x3'));var rs=require(_0x8c83('0x4'));var fs=require('fs');var Redis=require(_0x8c83('0x5'));var db=require(_0x8c83('0x6'))['db'];var utils=require(_0x8c83('0x7'));var logger=require(_0x8c83('0x8'))(_0x8c83('0x9'));var config=require(_0x8c83('0xa'));var jayson=require(_0x8c83('0xb'));var client=jayson[_0x8c83('0xc')][_0x8c83('0xd')]({'port':0x232a});config[_0x8c83('0xe')]=_['defaults'](config['redis'],{'host':_0x8c83('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c83('0xe')]));require(_0x8c83('0x10'))[_0x8c83('0x11')](socket);function respondWithRpcPromise(_0x3ce7b5,_0x452aae,_0x21442e){return new BPromise(function(_0x2e547f,_0x105a36){return client[_0x8c83('0x12')](_0x3ce7b5,_0x21442e)[_0x8c83('0x13')](function(_0x2fb6e5){logger['info'](_0x8c83('0x14'),_0x452aae,'request\x20sent');logger['debug'](_0x8c83('0x15'),_0x452aae,'request\x20sent',JSON[_0x8c83('0x16')](_0x2fb6e5));if(_0x2fb6e5[_0x8c83('0x17')]){if(_0x2fb6e5[_0x8c83('0x17')][_0x8c83('0x18')]===0x1f4){logger[_0x8c83('0x17')](_0x8c83('0x14'),_0x452aae,_0x2fb6e5[_0x8c83('0x17')][_0x8c83('0x19')]);return _0x105a36(_0x2fb6e5[_0x8c83('0x17')][_0x8c83('0x19')]);}logger['error'](_0x8c83('0x14'),_0x452aae,_0x2fb6e5[_0x8c83('0x17')]['message']);return _0x2e547f(_0x2fb6e5['error'][_0x8c83('0x19')]);}else{logger['info'](_0x8c83('0x14'),_0x452aae,'request\x20sent');_0x2e547f(_0x2fb6e5['result'][_0x8c83('0x19')]);}})['catch'](function(_0x3b0106){logger[_0x8c83('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x452aae,_0x3b0106);_0x105a36(_0x3b0106);});});}exports['GetVoiceExtension']=function(_0x406faf){var _0x10685b=this;return new Promise(function(_0x5f51f8,_0x41e629){return db[_0x8c83('0x1a')]['findAll']({'raw':_0x406faf[_0x8c83('0x1b')]?_0x406faf['options'][_0x8c83('0x1c')]===undefined?!![]:![]:!![],'where':_0x406faf[_0x8c83('0x1b')]?_0x406faf[_0x8c83('0x1b')][_0x8c83('0x1d')]||null:null,'attributes':_0x406faf[_0x8c83('0x1b')]?_0x406faf['options']['attributes']||null:null,'limit':_0x406faf[_0x8c83('0x1b')]?_0x406faf[_0x8c83('0x1b')]['limit']||null:null,'include':_0x406faf['options']?_0x406faf[_0x8c83('0x1b')][_0x8c83('0x1e')]?_[_0x8c83('0x1f')](_0x406faf['options'][_0x8c83('0x1e')],function(_0x4f7088){return{'model':db[_0x4f7088[_0x8c83('0x20')]],'as':_0x4f7088['as'],'attributes':_0x4f7088[_0x8c83('0x21')],'include':_0x4f7088[_0x8c83('0x1e')]?_[_0x8c83('0x1f')](_0x4f7088[_0x8c83('0x1e')],function(_0x5445b9){return{'model':db[_0x5445b9['model']],'as':_0x5445b9['as'],'attributes':_0x5445b9['attributes'],'include':_0x5445b9[_0x8c83('0x1e')]?_[_0x8c83('0x1f')](_0x5445b9['include'],function(_0x106f71){return{'model':db[_0x106f71[_0x8c83('0x20')]],'as':_0x106f71['as'],'attributes':_0x106f71[_0x8c83('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48a74b){logger[_0x8c83('0x22')]('GetVoiceExtension',_0x406faf);logger[_0x8c83('0x23')](_0x8c83('0x24'),_0x406faf,JSON[_0x8c83('0x16')](_0x48a74b));_0x5f51f8(_0x48a74b);})[_0x8c83('0x25')](function(_0x232ce4){logger[_0x8c83('0x17')]('GetVoiceExtension',_0x232ce4[_0x8c83('0x19')],_0x406faf);_0x41e629(_0x10685b[_0x8c83('0x17')](0x1f4,_0x232ce4[_0x8c83('0x19')]));});});}; \ No newline at end of file +var _0x6075=['limit','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','attributes'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x6075,0x191));var _0x5607=function(_0x5b6dc7,_0x336ccd){_0x5b6dc7=_0x5b6dc7-0x0;var _0x469f35=_0x6075[_0x5b6dc7];return _0x469f35;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var moment=require(_0x5607('0x1'));var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require(_0x5607('0x4'));var db=require(_0x5607('0x5'))['db'];var utils=require(_0x5607('0x6'));var logger=require(_0x5607('0x7'))(_0x5607('0x8'));var config=require('../../config/environment');var jayson=require(_0x5607('0x9'));var client=jayson[_0x5607('0xa')][_0x5607('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5607('0xc')],{'host':_0x5607('0xd'),'port':0x18eb});var socket=require(_0x5607('0xe'))(new Redis(config[_0x5607('0xc')]));require(_0x5607('0xf'))['register'](socket);function respondWithRpcPromise(_0x96549b,_0x45de00,_0xe18e86){return new BPromise(function(_0x4ea43b,_0x6e62a0){return client['request'](_0x96549b,_0xe18e86)['then'](function(_0x3eb82e){logger[_0x5607('0x10')](_0x5607('0x11'),_0x45de00,'request\x20sent');logger[_0x5607('0x12')](_0x5607('0x13'),_0x45de00,_0x5607('0x14'),JSON[_0x5607('0x15')](_0x3eb82e));if(_0x3eb82e[_0x5607('0x16')]){if(_0x3eb82e[_0x5607('0x16')][_0x5607('0x17')]===0x1f4){logger[_0x5607('0x16')](_0x5607('0x11'),_0x45de00,_0x3eb82e['error'][_0x5607('0x18')]);return _0x6e62a0(_0x3eb82e[_0x5607('0x16')][_0x5607('0x18')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x45de00,_0x3eb82e[_0x5607('0x16')]['message']);return _0x4ea43b(_0x3eb82e[_0x5607('0x16')][_0x5607('0x18')]);}else{logger[_0x5607('0x10')](_0x5607('0x11'),_0x45de00,_0x5607('0x14'));_0x4ea43b(_0x3eb82e[_0x5607('0x19')]['message']);}})[_0x5607('0x1a')](function(_0x50bd2c){logger[_0x5607('0x16')](_0x5607('0x11'),_0x45de00,_0x50bd2c);_0x6e62a0(_0x50bd2c);});});}exports[_0x5607('0x1b')]=function(_0x5f080d){var _0xffa25d=this;return new Promise(function(_0x6e4868,_0x303089){return db['VoiceExtension'][_0x5607('0x1c')]({'raw':_0x5f080d[_0x5607('0x1d')]?_0x5f080d[_0x5607('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5f080d[_0x5607('0x1d')]?_0x5f080d['options']['where']||null:null,'attributes':_0x5f080d[_0x5607('0x1d')]?_0x5f080d[_0x5607('0x1d')][_0x5607('0x1e')]||null:null,'limit':_0x5f080d[_0x5607('0x1d')]?_0x5f080d[_0x5607('0x1d')][_0x5607('0x1f')]||null:null,'include':_0x5f080d[_0x5607('0x1d')]?_0x5f080d[_0x5607('0x1d')][_0x5607('0x20')]?_[_0x5607('0x21')](_0x5f080d['options'][_0x5607('0x20')],function(_0x27e144){return{'model':db[_0x27e144['model']],'as':_0x27e144['as'],'attributes':_0x27e144[_0x5607('0x1e')],'include':_0x27e144[_0x5607('0x20')]?_[_0x5607('0x21')](_0x27e144[_0x5607('0x20')],function(_0x447042){return{'model':db[_0x447042[_0x5607('0x22')]],'as':_0x447042['as'],'attributes':_0x447042[_0x5607('0x1e')],'include':_0x447042[_0x5607('0x20')]?_['map'](_0x447042[_0x5607('0x20')],function(_0x309ede){return{'model':db[_0x309ede['model']],'as':_0x309ede['as'],'attributes':_0x309ede['attributes']};}):[]};}):[]};}):[]:[]})[_0x5607('0x23')](function(_0x40f20e){logger[_0x5607('0x10')](_0x5607('0x1b'),_0x5f080d);logger[_0x5607('0x12')]('GetVoiceExtension',_0x5f080d,JSON[_0x5607('0x15')](_0x40f20e));_0x6e4868(_0x40f20e);})['catch'](function(_0xd6c90a){logger[_0x5607('0x16')](_0x5607('0x1b'),_0xd6c90a['message'],_0x5f080d);_0x303089(_0xffa25d[_0x5607('0x16')](0x1f4,_0xd6c90a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8f90be9..5dbae10 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x5a541c,_0x32ddd8){var _0xe7b304=function(_0x456d1b){while(--_0x456d1b){_0x5a541c['push'](_0x5a541c['shift']());}};_0xe7b304(++_0x32ddd8);}(_0x2ef3,0xba));var _0x32ef=function(_0x1ac069,_0x357e61){_0x1ac069=_0x1ac069-0x0;var _0x15bd23=_0x2ef3[_0x1ac069];return _0x15bd23;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x4ea65c,_0x2ef7fb){var _0x347483=function(_0x16b60d){while(--_0x16b60d){_0x4ea65c['push'](_0x4ea65c['shift']());}};_0x347483(++_0x2ef7fb);}(_0x326f,0xd1));var _0xf326=function(_0x3b09a1,_0x389d16){_0x3b09a1=_0x3b09a1-0x0;var _0x5f0bf2=_0x326f[_0x3b09a1];return _0x5f0bf2;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4cdd8c9..a3c03a3 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 _0x9fd4=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/messages'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0x9fd4[_0x1806d4];return _0x392c2c;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/:id',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['getMessages']);router[_0x49fd('0xe')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x10')](_0x49fd('0x11'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);router['delete'](_0x49fd('0x11'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x13')]);module[_0x49fd('0x14')]=router; \ No newline at end of file +var _0xf072=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy'];(function(_0x39b316,_0x3def1e){var _0x182ab1=function(_0x3e4f10){while(--_0x3e4f10){_0x39b316['push'](_0x39b316['shift']());}};_0x182ab1(++_0x3def1e);}(_0xf072,0x1cf));var _0x2f07=function(_0x1f4bc6,_0x47e3eb){_0x1f4bc6=_0x1f4bc6-0x0;var _0x3e99f2=_0xf072[_0x1f4bc6];return _0x3e99f2;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0xf')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x10')]);router['put'](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router[_0x2f07('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2f07('0x13')]);module[_0x2f07('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 498ca79..2575f30 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 _0xbbeb=['from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING'];(function(_0x54736,_0x157c7a){var _0x26e8f6=function(_0x5f52f4){while(--_0x5f52f4){_0x54736['push'](_0x54736['shift']());}};_0x26e8f6(++_0x157c7a);}(_0xbbeb,0x11a));var _0xbbbe=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xbbeb[_0x4382bc];return _0x13c82a;};'use strict';var Sequelize=require(_0xbbbe('0x0'));module[_0xbbbe('0x1')]={'customer_id':{'type':Sequelize[_0xbbbe('0x2')]},'context':{'type':Sequelize[_0xbbbe('0x2')],'defaultValue':_0xbbbe('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xbbbe('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbbbe('0x2')],'validate':{'isEmail':!![]},'set':function(_0x14bace){this[_0xbbbe('0x5')](_0xbbbe('0x6'),typeof _0x14bace==='string'&&_0x14bace[_0xbbbe('0x7')]()?_0x14bace[_0xbbbe('0x7')]():null);}},'pager':{'type':Sequelize[_0xbbbe('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xbbbe('0x8')},'attach':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':_0xbbbe('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':_0xbbbe('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xbbbe('0x2')]},'callback':{'type':Sequelize[_0xbbbe('0x2')]},'review':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbbbe('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbbbe('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xbbbe('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xbbbe('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbbbe('0x9')](_0xbbbe('0xa'),'no'),'defaultValue':_0xbbbe('0xa'),'allowNull':![]},'stamp':{'type':_0xbbbe('0xc')},'emailsubject':{'type':Sequelize[_0xbbbe('0x2')]},'emailbody':{'type':Sequelize[_0xbbbe('0x2')]},'maxsecs':{'type':Sequelize[_0xbbbe('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbbbe('0xe')],'get':function(){return this['getDataValue'](_0xbbbe('0xf'))+_0xbbbe('0x10')+this[_0xbbbe('0x11')](_0xbbbe('0x12'));}}}; \ No newline at end of file +var _0x3ab1=['central','ENUM','yes','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ab1,0xf8));var _0x13ab=function(_0x4f489a,_0x1e33dc){_0x4f489a=_0x4f489a-0x0;var _0x46cbad=_0x3ab1[_0x4f489a];return _0x46cbad;};'use strict';var Sequelize=require(_0x13ab('0x0'));module[_0x13ab('0x1')]={'customer_id':{'type':Sequelize[_0x13ab('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x13ab('0x3'),'unique':_0x13ab('0x4')},'mailbox':{'type':Sequelize[_0x13ab('0x2')],'defaultValue':'','allowNull':![],'unique':_0x13ab('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x13ab('0x2')],'validate':{'isEmail':!![]},'set':function(_0x10e5ba){this[_0x13ab('0x5')]('email',typeof _0x10e5ba===_0x13ab('0x6')&&_0x10e5ba['trim']()?_0x10e5ba[_0x13ab('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x13ab('0x2')],'defaultValue':_0x13ab('0x8')},'attach':{'type':Sequelize[_0x13ab('0x9')](_0x13ab('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x13ab('0x9')](_0x13ab('0xa'),'no'),'defaultValue':_0x13ab('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x13ab('0x2')]},'callback':{'type':Sequelize[_0x13ab('0x2')]},'review':{'type':Sequelize[_0x13ab('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x13ab('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x13ab('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x13ab('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x13ab('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x13ab('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x13ab('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x13ab('0x9')](_0x13ab('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x13ab('0x9')](_0x13ab('0xa'),'no'),'defaultValue':_0x13ab('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x13ab('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x13ab('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x13ab('0xc')],'get':function(){return this[_0x13ab('0xd')]('fullname')+_0x13ab('0xe')+this[_0x13ab('0xd')](_0x13ab('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0703d87..638d459 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 _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0xd2dfeb,_0x51aa27){var _0x313172=function(_0x4cc2ba){while(--_0x4cc2ba){_0xd2dfeb['push'](_0xd2dfeb['shift']());}};_0x313172(++_0x51aa27);}(_0xf4eb,0xec));var _0xbf4e=function(_0x153f49,_0x307bc4){_0x153f49=_0x153f49-0x0;var _0x239cdb=_0xf4eb[_0x153f49];return _0x239cdb;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file +var _0x1c7c=['sox','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x1c7c,0x164));var _0xc1c7=function(_0x3906d7,_0x1cc25c){_0x3906d7=_0x3906d7-0x0;var _0x44695f=_0x1c7c[_0x3906d7];return _0x44695f;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){var _0x1540c1=_0x3180fd[_0xc1c7('0x29')]({'plain':!![]});var _0x363fbc=_0xc1c7('0x2a');return db[_0xc1c7('0x2b')][_0xc1c7('0x28')]({'where':{'type':_0x363fbc,'resourceId':_0x1540c1['id']}})[_0xc1c7('0x27')](function(){return _0x3180fd;});})['then'](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x2c')](_0x1b873c[_0xc1c7('0x2d')]);if(_0x1b873c[_0xc1c7('0x2e')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x2f')](_0x1b873c);};}exports[_0xc1c7('0x30')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x31')](db['VoiceMail'][_0xc1c7('0x32')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x33')],'type':_0x3cf425[_0xc1c7('0x34')][_0xc1c7('0x35')]};});_0x4968b0[_0xc1c7('0x36')]=_[_0xc1c7('0x31')](_0x125920,'name');_0x4968b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x9a0ab3[_0xc1c7('0x37')]);_0x4968b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x4968b0[_0xc1c7('0x36')],_0x4968b0[_0xc1c7('0x37')]);_0x2e35f1[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x2e35f1[_0xc1c7('0x3b')]=_0x2e35f1[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x2e35f1[_0xc1c7('0x3b')]:_0x4968b0[_0xc1c7('0x36')];if(!_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x2e35f1[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x2e35f1[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x2e35f1[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x9a0ab3[_0xc1c7('0x37')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x42')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x2e35f1[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x31')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x34')]!==_0xc1c7('0x46')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x2e')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x45')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x47')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x44')]};return db[_0xc1c7('0x48')]['count'](_0x955ba6)[_0xc1c7('0x27')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x2e35f1[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x48')][_0xc1c7('0x4b')](_0x2e35f1);})[_0xc1c7('0x27')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x4c')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x4d')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':!![],'where':{'id':_0x14b61f[_0xc1c7('0x4e')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x48')][_0xc1c7('0x32')]);_0x4c6834['query']=_[_0xc1c7('0x38')](_0x14b61f[_0xc1c7('0x37')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x37')]);_0x519665[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4c6834['model'],qs[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x37')]['fields']));_0x519665[_0xc1c7('0x3b')]=_0x519665[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x519665[_0xc1c7('0x3b')]:_0x4c6834[_0xc1c7('0x36')];if(_0x14b61f[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x519665[_0xc1c7('0x4a')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x45')]({},_0x519665,_0x14b61f[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')][_0xc1c7('0x4f')](_0x519665)[_0xc1c7('0x27')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x27')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x4d')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x50')]=function(_0x2967b7,_0x1addc8){return db['VoiceMail'][_0xc1c7('0x50')](_0x2967b7['body'],{})[_0xc1c7('0x27')](function(_0x23f42f){var _0x2840a3=_0x2967b7['user'][_0xc1c7('0x29')]({'plain':!![]});if(!_0x2840a3)throw new Error(_0xc1c7('0x51'));if(_0x2840a3['role']==='user'){var _0x5c96cc=_0x23f42f[_0xc1c7('0x29')]({'plain':!![]});var _0x415416='Voicemails';return db[_0xc1c7('0x52')][_0xc1c7('0x4f')]({'where':{'name':_0x415416,'userProfileId':_0x2840a3[_0xc1c7('0x53')]},'raw':!![]})[_0xc1c7('0x27')](function(_0x37374c){if(_0x37374c&&_0x37374c[_0xc1c7('0x54')]===0x0){return db['UserProfileResource'][_0xc1c7('0x50')]({'name':_0x5c96cc['name'],'resourceId':_0x5c96cc['id'],'type':_0x37374c[_0xc1c7('0x2e')],'sectionId':_0x37374c['id']},{})[_0xc1c7('0x27')](function(){return _0x23f42f;});}else{return _0x23f42f;}})[_0xc1c7('0x4d')](function(_0x557cb6){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x557cb6);throw _0x557cb6;});}return _0x23f42f;})[_0xc1c7('0x27')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x4d')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x26')]=function(_0x45dfa2,_0x1dc39f){if(_0x45dfa2[_0xc1c7('0x56')]['id']){delete _0x45dfa2['body']['id'];}return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x45dfa2[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1dc39f,null))['then'](saveUpdates(_0x45dfa2[_0xc1c7('0x56')],null))[_0xc1c7('0x27')](respondWithResult(_0x1dc39f,null))[_0xc1c7('0x4d')](handleError(_0x1dc39f,null));};exports['destroy']=function(_0x1c636c,_0x48304a){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1c636c[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x48304a,null))[_0xc1c7('0x27')](removeEntity(_0x48304a,null))[_0xc1c7('0x4d')](handleError(_0x48304a,null));};exports[_0xc1c7('0x57')]=function(_0x4df2f8,_0x11c116,_0x2ad2d5){return db[_0xc1c7('0x48')]['findOne']({'where':{'id':_0x4df2f8[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11c116,null))[_0xc1c7('0x27')](function(_0x528986){var _0x39d3e2;var _0x212d53={},_0x314232={};_0x314232[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db['VoiceMailMessage']['rawAttributes']);_0x314232['query']=_[_0xc1c7('0x38')](_0x4df2f8[_0xc1c7('0x37')]);_0x314232[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x314232[_0xc1c7('0x36')],_0x314232[_0xc1c7('0x37')]);_0x212d53['attributes']=_[_0xc1c7('0x3a')](_0x314232[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x4df2f8[_0xc1c7('0x37')]['fields']));_0x212d53[_0xc1c7('0x3b')]=_0x212d53[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x212d53['attributes']:_0x314232[_0xc1c7('0x36')];if(!_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x212d53['limit']=qs['limit'](_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x212d53['offset']=qs[_0xc1c7('0x22')](_0x4df2f8[_0xc1c7('0x37')]['offset']);}_0x212d53[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x4df2f8['query'][_0xc1c7('0x41')]);_0x212d53[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x4df2f8[_0xc1c7('0x37')],_0x314232[_0xc1c7('0x39')]));if(_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x212d53[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x212d53[_0xc1c7('0x44')],{'$or':_[_0xc1c7('0x31')](_0x212d53[_0xc1c7('0x3b')],function(_0x3c9ffe){var _0x342fc8={};_0x342fc8[_0x3c9ffe]={'$like':'%'+_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x342fc8;})});}_0x212d53[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x212d53[_0xc1c7('0x44')],{'mailboxuser':_0x528986[_0xc1c7('0x58')]});_0x212d53=_[_0xc1c7('0x45')]({},_0x212d53,_0x4df2f8[_0xc1c7('0x47')]);return db[_0xc1c7('0x59')][_0xc1c7('0x5a')](_0x212d53)[_0xc1c7('0x27')](respondWithFilteredResult(_0x11c116,_0x212d53));})[_0xc1c7('0x4d')](handleError(_0x11c116,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7962dcc..368990b 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 _0x63e0=['voice_voicemail','mailbox_context','mailbox','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x584b53,_0x5486d9){var _0x4fb5d1=function(_0xc77205){while(--_0xc77205){_0x584b53['push'](_0x584b53['shift']());}};_0x4fb5d1(++_0x5486d9);}(_0x63e0,0x12f));var _0x063e=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x63e0[_0x274638];return _0x5755df;};'use strict';var _=require(_0x063e('0x0'));var util=require(_0x063e('0x1'));var logger=require('../../config/logger')(_0x063e('0x2'));var moment=require(_0x063e('0x3'));var BPromise=require('bluebird');var rp=require(_0x063e('0x4'));var fs=require('fs');var path=require(_0x063e('0x5'));var rimraf=require(_0x063e('0x6'));var config=require(_0x063e('0x7'));var attributes=require(_0x063e('0x8'));module[_0x063e('0x9')]=function(_0xd2e822,_0x650ded){return _0xd2e822[_0x063e('0xa')](_0x063e('0xb'),attributes,{'tableName':_0x063e('0xc'),'paranoid':![],'indexes':[{'name':_0x063e('0xd'),'fields':[_0x063e('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf268=['request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','../../config/logger','moment'];(function(_0x18ac08,_0x8f9717){var _0x40e6f0=function(_0x1a33e4){while(--_0x1a33e4){_0x18ac08['push'](_0x18ac08['shift']());}};_0x40e6f0(++_0x8f9717);}(_0xf268,0x1ae));var _0x8f26=function(_0x1e00da,_0x4c1cf8){_0x1e00da=_0x1e00da-0x0;var _0x16e478=_0xf268[_0x1e00da];return _0x16e478;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f26('0x0'))('api');var moment=require(_0x8f26('0x1'));var BPromise=require('bluebird');var rp=require(_0x8f26('0x2'));var fs=require('fs');var path=require(_0x8f26('0x3'));var rimraf=require(_0x8f26('0x4'));var config=require('../../config/environment');var attributes=require(_0x8f26('0x5'));module[_0x8f26('0x6')]=function(_0x599e5b,_0x156bc3){return _0x599e5b[_0x8f26('0x7')](_0x8f26('0x8'),attributes,{'tableName':_0x8f26('0x9'),'paranoid':![],'indexes':[{'name':_0x8f26('0xa'),'fields':['mailbox',_0x8f26('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 54ff173..7369301 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 _0xca3e=['http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xca3e,0x1ab));var _0xeca3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xca3e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xeca3('0x0'));var util=require('util');var moment=require(_0xeca3('0x1'));var BPromise=require(_0xeca3('0x2'));var rs=require(_0xeca3('0x3'));var fs=require('fs');var Redis=require(_0xeca3('0x4'));var db=require(_0xeca3('0x5'))['db'];var utils=require(_0xeca3('0x6'));var logger=require(_0xeca3('0x7'))(_0xeca3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeca3('0x9')][_0xeca3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54acbf,_0x1b1dff,_0x707616){return new BPromise(function(_0x479099,_0x2e2069){return client[_0xeca3('0xb')](_0x54acbf,_0x707616)[_0xeca3('0xc')](function(_0x4dbcb4){logger[_0xeca3('0xd')]('VoiceMail,\x20%s,\x20%s',_0x1b1dff,_0xeca3('0xe'));logger[_0xeca3('0xf')](_0xeca3('0x10'),_0x1b1dff,_0xeca3('0xe'),JSON[_0xeca3('0x11')](_0x4dbcb4));if(_0x4dbcb4['error']){if(_0x4dbcb4[_0xeca3('0x12')]['code']===0x1f4){logger[_0xeca3('0x12')](_0xeca3('0x13'),_0x1b1dff,_0x4dbcb4['error'][_0xeca3('0x14')]);return _0x2e2069(_0x4dbcb4['error']['message']);}logger[_0xeca3('0x12')](_0xeca3('0x13'),_0x1b1dff,_0x4dbcb4[_0xeca3('0x12')]['message']);return _0x479099(_0x4dbcb4[_0xeca3('0x12')][_0xeca3('0x14')]);}else{logger[_0xeca3('0xd')](_0xeca3('0x13'),_0x1b1dff,'request\x20sent');_0x479099(_0x4dbcb4[_0xeca3('0x15')][_0xeca3('0x14')]);}})[_0xeca3('0x16')](function(_0x4f74c2){logger['error'](_0xeca3('0x13'),_0x1b1dff,_0x4f74c2);_0x2e2069(_0x4f74c2);});});} \ No newline at end of file +var _0xaa85=['client','request','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x140ef7,_0x38c3fa){var _0x446793=function(_0xe52a50){while(--_0xe52a50){_0x140ef7['push'](_0x140ef7['shift']());}};_0x446793(++_0x38c3fa);}(_0xaa85,0x19d));var _0x5aa8=function(_0x378787,_0x4759db){_0x378787=_0x378787-0x0;var _0x54a550=_0xaa85[_0x378787];return _0x54a550;};'use strict';var _=require(_0x5aa8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5aa8('0x1'));var fs=require('fs');var Redis=require(_0x5aa8('0x2'));var db=require(_0x5aa8('0x3'))['db'];var utils=require(_0x5aa8('0x4'));var logger=require(_0x5aa8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5aa8('0x6'));var client=jayson[_0x5aa8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc80567,_0x385f1b,_0xbef442){return new BPromise(function(_0x5afdf1,_0x175789){return client[_0x5aa8('0x8')](_0xc80567,_0xbef442)[_0x5aa8('0x9')](function(_0x1c7c2a){logger[_0x5aa8('0xa')]('VoiceMail,\x20%s,\x20%s',_0x385f1b,_0x5aa8('0xb'));logger['debug'](_0x5aa8('0xc'),_0x385f1b,_0x5aa8('0xb'),JSON[_0x5aa8('0xd')](_0x1c7c2a));if(_0x1c7c2a[_0x5aa8('0xe')]){if(_0x1c7c2a[_0x5aa8('0xe')][_0x5aa8('0xf')]===0x1f4){logger[_0x5aa8('0xe')](_0x5aa8('0x10'),_0x385f1b,_0x1c7c2a[_0x5aa8('0xe')][_0x5aa8('0x11')]);return _0x175789(_0x1c7c2a['error']['message']);}logger[_0x5aa8('0xe')]('VoiceMail,\x20%s,\x20%s',_0x385f1b,_0x1c7c2a['error'][_0x5aa8('0x11')]);return _0x5afdf1(_0x1c7c2a[_0x5aa8('0xe')][_0x5aa8('0x11')]);}else{logger['info'](_0x5aa8('0x10'),_0x385f1b,_0x5aa8('0xb'));_0x5afdf1(_0x1c7c2a[_0x5aa8('0x12')][_0x5aa8('0x11')]);}})[_0x5aa8('0x13')](function(_0x300788){logger[_0x5aa8('0xe')](_0x5aa8('0x10'),_0x385f1b,_0x300788);_0x175789(_0x300788);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 7a78e6d..38d94a6 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 _0x1fe9=['../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x11780c,_0x1825ff){var _0x3254b8=function(_0x143660){while(--_0x143660){_0x11780c['push'](_0x11780c['shift']());}};_0x3254b8(++_0x1825ff);}(_0x1fe9,0xaf));var _0x91fe=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1fe9[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x91fe('0x0'));var timeout=require(_0x91fe('0x1'));var express=require(_0x91fe('0x2'));var router=express[_0x91fe('0x3')]();var fs_extra=require(_0x91fe('0x4'));var auth=require(_0x91fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x91fe('0x6'));var controller=require(_0x91fe('0x7'));router[_0x91fe('0x8')]('/',auth[_0x91fe('0x9')](),controller[_0x91fe('0xa')]);router[_0x91fe('0x8')](_0x91fe('0xb'),auth[_0x91fe('0x9')](),controller['show']);router['get'](_0x91fe('0xc'),auth[_0x91fe('0x9')](),controller[_0x91fe('0xd')]);router[_0x91fe('0xe')]('/',auth[_0x91fe('0x9')](),controller['create']);router[_0x91fe('0xf')](_0x91fe('0xb'),auth[_0x91fe('0x9')](),controller[_0x91fe('0x10')]);router[_0x91fe('0x11')]('/:id',auth[_0x91fe('0x9')](),controller[_0x91fe('0x12')]);module[_0x91fe('0x13')]=router; \ No newline at end of file +var _0x817c=['post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','download'];(function(_0x206948,_0x1979c6){var _0x1c72c9=function(_0x2db6ea){while(--_0x2db6ea){_0x206948['push'](_0x206948['shift']());}};_0x1c72c9(++_0x1979c6);}(_0x817c,0x15b));var _0xc817=function(_0x23e346,_0x2ffc96){_0x23e346=_0x23e346-0x0;var _0x58fd5a=_0x817c[_0x23e346];return _0x58fd5a;};'use strict';var multer=require(_0xc817('0x0'));var util=require(_0xc817('0x1'));var path=require(_0xc817('0x2'));var timeout=require('connect-timeout');var express=require(_0xc817('0x3'));var router=express[_0xc817('0x4')]();var fs_extra=require(_0xc817('0x5'));var auth=require(_0xc817('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc817('0x7'));var controller=require(_0xc817('0x8'));router[_0xc817('0x9')]('/',auth[_0xc817('0xa')](),controller['index']);router[_0xc817('0x9')](_0xc817('0xb'),auth[_0xc817('0xa')](),controller[_0xc817('0xc')]);router[_0xc817('0x9')]('/:id/download',auth[_0xc817('0xa')](),controller[_0xc817('0xd')]);router[_0xc817('0xe')]('/',auth[_0xc817('0xa')](),controller[_0xc817('0xf')]);router['put'](_0xc817('0xb'),auth[_0xc817('0xa')](),controller[_0xc817('0x10')]);router[_0xc817('0x11')](_0xc817('0xb'),auth[_0xc817('0xa')](),controller['destroy']);module[_0xc817('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9b78da0..d500bba 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 _0xce18=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x291839,_0x57afdc){var _0x28683c=function(_0x5b0930){while(--_0x5b0930){_0x291839['push'](_0x291839['shift']());}};_0x28683c(++_0x57afdc);}(_0xce18,0x194));var _0x8ce1=function(_0x205313,_0x1172a7){_0x205313=_0x205313-0x0;var _0xfb032=_0xce18[_0x205313];return _0xfb032;};'use strict';var Sequelize=require('sequelize');module[_0x8ce1('0x0')]={'name':{'type':Sequelize[_0x8ce1('0x1')],'get':function(_0x4eefe6){return this[_0x8ce1('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x8ce1('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8ce1('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x8ce1('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8ce1('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x8ce1('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8ce1('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x8ce1('0x5')](_0x8ce1('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8ce1('0x4')],'defaultValue':''},'stamp':{'type':_0x8ce1('0x7'),'defaultValue':Sequelize[_0x8ce1('0x8')](_0x8ce1('0x9'))}}; \ No newline at end of file +var _0x6bad=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER','STRING','BLOB','TIMESTAMP','literal'];(function(_0x565ffe,_0x5ebbbe){var _0x31b86e=function(_0x3abc6d){while(--_0x3abc6d){_0x565ffe['push'](_0x565ffe['shift']());}};_0x31b86e(++_0x5ebbbe);}(_0x6bad,0x189));var _0xd6ba=function(_0x1ebbda,_0x503f7b){_0x1ebbda=_0x1ebbda-0x0;var _0x8f8830=_0x6bad[_0x1ebbda];return _0x8f8830;};'use strict';var Sequelize=require(_0xd6ba('0x0'));module[_0xd6ba('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5546c1){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xd6ba('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd6ba('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xd6ba('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd6ba('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd6ba('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd6ba('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xd6ba('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xd6ba('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd6ba('0x3')],'defaultValue':''},'stamp':{'type':_0xd6ba('0x5'),'defaultValue':Sequelize[_0xd6ba('0x6')](_0xd6ba('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 48cd908..6204f32 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 _0x5610=['index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x5610,0x86));var _0x0561=function(_0x4e557d,_0x56603a){_0x4e557d=_0x4e557d-0x0;var _0x47cacf=_0x5610[_0x4e557d];return _0x47cacf;};'use strict';var emlformat=require(_0x0561('0x0'));var rimraf=require(_0x0561('0x1'));var zipdir=require(_0x0561('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0561('0x3'));var moment=require(_0x0561('0x4'));var BPromise=require(_0x0561('0x5'));var Mustache=require(_0x0561('0x6'));var util=require(_0x0561('0x7'));var path=require(_0x0561('0x8'));var sox=require(_0x0561('0x9'));var csv=require(_0x0561('0xa'));var ejs=require(_0x0561('0xb'));var fs=require('fs');var fs_extra=require(_0x0561('0xc'));var _=require(_0x0561('0xd'));var squel=require('squel');var crypto=require(_0x0561('0xe'));var jsforce=require(_0x0561('0xf'));var deskjs=require(_0x0561('0x10'));var toCsv=require(_0x0561('0xa'));var querystring=require('querystring');var Papa=require(_0x0561('0x11'));var Redis=require('ioredis');var authService=require(_0x0561('0x12'));var qs=require(_0x0561('0x13'));var as=require(_0x0561('0x14'));var hardwareService=require(_0x0561('0x15'));var logger=require('../../config/logger')(_0x0561('0x16'));var utils=require(_0x0561('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0561('0x18'));var db=require(_0x0561('0x19'))['db'];function respondWithStatusCode(_0x5e34be,_0xc21f0a){_0xc21f0a=_0xc21f0a||0xcc;return function(_0x10ce37){if(_0x10ce37){return _0x5e34be[_0x0561('0x1a')](_0xc21f0a);}return _0x5e34be[_0x0561('0x1b')](_0xc21f0a)[_0x0561('0x1c')]();};}function respondWithResult(_0x5bc624,_0x2d26f9){_0x2d26f9=_0x2d26f9||0xc8;return function(_0x321564){if(_0x321564){return _0x5bc624[_0x0561('0x1b')](_0x2d26f9)[_0x0561('0x1d')](_0x321564);}};}function respondWithFilteredResult(_0x337c39,_0x201236){return function(_0x4e133f){if(_0x4e133f){var _0x54632c=typeof _0x201236[_0x0561('0x1e')]===_0x0561('0x1f')&&typeof _0x201236[_0x0561('0x20')]===_0x0561('0x1f');var _0x5c2aaf=_0x4e133f['count'];var _0x735daf=_0x54632c?0x0:_0x201236['offset'];var _0x2078a0=_0x54632c?_0x4e133f[_0x0561('0x21')]:_0x201236['offset']+_0x201236[_0x0561('0x20')];var _0x11758a;if(_0x2078a0>=_0x5c2aaf){_0x2078a0=_0x5c2aaf;_0x11758a=0xc8;}else{_0x11758a=0xce;}_0x337c39[_0x0561('0x1b')](_0x11758a);return _0x337c39[_0x0561('0x22')](_0x0561('0x23'),_0x735daf+'-'+_0x2078a0+'/'+_0x5c2aaf)['json'](_0x4e133f);}return null;};}function patchUpdates(_0x369e05){return function(_0x29f596){try{jsonpatch[_0x0561('0x24')](_0x29f596,_0x369e05,!![]);}catch(_0x3096b7){return BPromise[_0x0561('0x25')](_0x3096b7);}return _0x29f596[_0x0561('0x26')]();};}function saveUpdates(_0xd8602a,_0x159153){return function(_0x35ef85){if(_0x35ef85){return _0x35ef85[_0x0561('0x27')](_0xd8602a)['then'](function(_0x3d7a69){return _0x3d7a69;});}return null;};}function removeEntity(_0x2b13b8,_0x392227){return function(_0x1ac038){if(_0x1ac038){return _0x1ac038[_0x0561('0x28')]()['then'](function(){_0x2b13b8[_0x0561('0x1b')](0xcc)[_0x0561('0x1c')]();});}};}function handleEntityNotFound(_0x5ec5d6,_0x1d2a5d){return function(_0x11340c){if(!_0x11340c){_0x5ec5d6[_0x0561('0x1a')](0x194);}return _0x11340c;};}function handleError(_0x3db6ac,_0x75857e){_0x75857e=_0x75857e||0x1f4;return function(_0xe4af74){logger[_0x0561('0x29')](_0xe4af74[_0x0561('0x2a')]);if(_0xe4af74[_0x0561('0x2b')]){delete _0xe4af74['name'];}_0x3db6ac[_0x0561('0x1b')](_0x75857e)['send'](_0xe4af74);};}exports[_0x0561('0x2c')]=function(_0x1b84be,_0x1cb204){var _0x295b4b={},_0x44c048={},_0x3cccc7={'count':0x0,'rows':[]};var _0x2bdfca=_[_0x0561('0x2d')](db[_0x0561('0x2e')][_0x0561('0x2f')],function(_0x858d93){return{'name':_0x858d93[_0x0561('0x30')],'type':_0x858d93[_0x0561('0x31')][_0x0561('0x32')]};});_0x44c048[_0x0561('0x33')]=_[_0x0561('0x34')](_[_0x0561('0x2d')](_0x2bdfca,'name'),[_0x0561('0x2b')]);_0x44c048[_0x0561('0x35')]=_[_0x0561('0x36')](_0x1b84be[_0x0561('0x35')]);_0x44c048[_0x0561('0x37')]=_[_0x0561('0x38')](_0x44c048[_0x0561('0x33')],_0x44c048['query']);_0x295b4b[_0x0561('0x39')]=_[_0x0561('0x38')](_0x44c048[_0x0561('0x33')],qs['fields'](_0x1b84be['query']['fields']));_0x295b4b[_0x0561('0x39')]=_0x295b4b[_0x0561('0x39')]['length']?_0x295b4b['attributes']:_0x44c048[_0x0561('0x33')];if(!_0x1b84be[_0x0561('0x35')]['hasOwnProperty'](_0x0561('0x3a'))){_0x295b4b[_0x0561('0x20')]=qs[_0x0561('0x20')](_0x1b84be['query'][_0x0561('0x20')]);_0x295b4b['offset']=qs['offset'](_0x1b84be[_0x0561('0x35')][_0x0561('0x1e')]);}_0x295b4b[_0x0561('0x3b')]=qs[_0x0561('0x3c')](_0x1b84be['query']['sort']);_0x295b4b[_0x0561('0x3d')]=qs['filters'](_['pick'](_0x1b84be[_0x0561('0x35')],_0x44c048['filters']),_0x2bdfca);if(_0x1b84be[_0x0561('0x35')][_0x0561('0x3e')]){_0x295b4b[_0x0561('0x3d')]=_[_0x0561('0x3f')](_0x295b4b[_0x0561('0x3d')],{'$or':_[_0x0561('0x2d')](_0x2bdfca,function(_0x540f2a){if(_0x540f2a['type']!==_0x0561('0x40')){var _0x497087={};_0x497087[_0x540f2a[_0x0561('0x2b')]]={'$like':'%'+_0x1b84be['query']['filter']+'%'};return _0x497087;}})});}_0x295b4b=_[_0x0561('0x3f')]({},_0x295b4b,_0x1b84be[_0x0561('0x41')]);var _0x5806cb={'where':_0x295b4b[_0x0561('0x3d')]};return db[_0x0561('0x2e')][_0x0561('0x21')](_0x5806cb)[_0x0561('0x42')](function(_0x14ab61){_0x3cccc7[_0x0561('0x21')]=_0x14ab61;if(_0x1b84be[_0x0561('0x35')][_0x0561('0x43')]){_0x295b4b[_0x0561('0x44')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x0561('0x45')](_0x295b4b);})[_0x0561('0x42')](function(_0x47c4aa){_0x3cccc7[_0x0561('0x46')]=_0x47c4aa;return _0x3cccc7;})[_0x0561('0x42')](respondWithFilteredResult(_0x1cb204,_0x295b4b))[_0x0561('0x47')](handleError(_0x1cb204,null));};exports[_0x0561('0x48')]=function(_0x11eb3c,_0x1189ba){var _0x5d8801={'raw':!![],'where':{'id':_0x11eb3c['params']['id']}},_0x4c3434={};_0x4c3434['model']=_['keys'](db['VoiceMailMessage'][_0x0561('0x2f')]);_0x4c3434['query']=_['keys'](_0x11eb3c['query']);_0x4c3434['filters']=_[_0x0561('0x38')](_0x4c3434[_0x0561('0x33')],_0x4c3434[_0x0561('0x35')]);_0x5d8801[_0x0561('0x39')]=_[_0x0561('0x38')](_0x4c3434[_0x0561('0x33')],qs['fields'](_0x11eb3c[_0x0561('0x35')]['fields']));_0x5d8801[_0x0561('0x39')]=_0x5d8801['attributes'][_0x0561('0x49')]?_0x5d8801[_0x0561('0x39')]:_0x4c3434[_0x0561('0x33')];if(_0x11eb3c['query'][_0x0561('0x43')]){_0x5d8801['include']=[{'all':!![]}];}_0x5d8801=_[_0x0561('0x3f')]({},_0x5d8801,_0x11eb3c[_0x0561('0x41')]);return db['VoiceMailMessage']['find'](_0x5d8801)[_0x0561('0x42')](handleEntityNotFound(_0x1189ba,null))[_0x0561('0x42')](respondWithResult(_0x1189ba,null))[_0x0561('0x47')](handleError(_0x1189ba,null));};exports[_0x0561('0x4a')]=function(_0x50d583,_0x570f9c){return db[_0x0561('0x2e')][_0x0561('0x4a')](_0x50d583['body'],{})[_0x0561('0x42')](respondWithResult(_0x570f9c,0xc9))['catch'](handleError(_0x570f9c,null));};exports[_0x0561('0x27')]=function(_0x355d75,_0x20dcb4){if(_0x355d75[_0x0561('0x4b')]['id']){delete _0x355d75[_0x0561('0x4b')]['id'];}return db[_0x0561('0x2e')][_0x0561('0x4c')]({'where':{'id':_0x355d75[_0x0561('0x4d')]['id']}})['then'](handleEntityNotFound(_0x20dcb4,null))[_0x0561('0x42')](saveUpdates(_0x355d75[_0x0561('0x4b')],null))[_0x0561('0x42')](respondWithResult(_0x20dcb4,null))[_0x0561('0x47')](handleError(_0x20dcb4,null));};exports[_0x0561('0x28')]=function(_0x48d4e1,_0x5660c0){return db[_0x0561('0x2e')][_0x0561('0x4c')]({'where':{'id':_0x48d4e1[_0x0561('0x4d')]['id']}})[_0x0561('0x42')](handleEntityNotFound(_0x5660c0,null))[_0x0561('0x42')](removeEntity(_0x5660c0,null))[_0x0561('0x47')](handleError(_0x5660c0,null));};exports['download']=function(_0x467f8a,_0x15d8b7,_0x506760){return db[_0x0561('0x2e')][_0x0561('0x4c')]({'where':{'id':_0x467f8a['params']['id']},'attributes':['id',_0x0561('0x4e'),_0x0561('0x4f')]})[_0x0561('0x42')](handleEntityNotFound(_0x15d8b7,null))[_0x0561('0x42')](function(_0x388d81){if(_0x388d81){if(!_0x388d81[_0x0561('0x4e')]){throw new db[(_0x0561('0x50'))][(_0x0561('0x51'))](_0x0561('0x52'));}var _0x376dfe={'Content-Type':_0x0561('0x53'),'Content-Disposition':_0x0561('0x54')};if(_0x388d81['msg_id']){_0x376dfe[_0x0561('0x55')]=_0x0561('0x56')+_0x388d81[_0x0561('0x4f')]+_0x0561('0x57');}_0x15d8b7[_0x0561('0x22')](_0x376dfe);return _0x15d8b7[_0x0561('0x58')](new Buffer(_0x388d81[_0x0561('0x4e')]));}})[_0x0561('0x47')](handleError(_0x15d8b7,null));}; \ No newline at end of file +var _0xe392=['includeAll','findAll','rows','catch','params','find','create','body','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','model','differenceBy','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','VoiceMailMessage'];(function(_0x56d8dc,_0xf26504){var _0x26eadd=function(_0x323b94){while(--_0x323b94){_0x56d8dc['push'](_0x56d8dc['shift']());}};_0x26eadd(++_0xf26504);}(_0xe392,0x1ac));var _0x2e39=function(_0x132603,_0x392ac0){_0x132603=_0x132603-0x0;var _0x199bca=_0xe392[_0x132603];return _0x199bca;};'use strict';var emlformat=require(_0x2e39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e39('0x1'));var jsonpatch=require(_0x2e39('0x2'));var rp=require(_0x2e39('0x3'));var moment=require(_0x2e39('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e39('0x5'));var path=require(_0x2e39('0x6'));var sox=require(_0x2e39('0x7'));var csv=require(_0x2e39('0x8'));var ejs=require(_0x2e39('0x9'));var fs=require('fs');var fs_extra=require(_0x2e39('0xa'));var _=require(_0x2e39('0xb'));var squel=require(_0x2e39('0xc'));var crypto=require(_0x2e39('0xd'));var jsforce=require(_0x2e39('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2e39('0x8'));var querystring=require(_0x2e39('0xf'));var Papa=require('papaparse');var Redis=require(_0x2e39('0x10'));var authService=require(_0x2e39('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2e39('0x12'));var hardwareService=require(_0x2e39('0x13'));var logger=require('../../config/logger')(_0x2e39('0x14'));var utils=require('../../config/utils');var config=require(_0x2e39('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e39('0x16'))['db'];function respondWithStatusCode(_0x319900,_0x574a8b){_0x574a8b=_0x574a8b||0xcc;return function(_0x2021de){if(_0x2021de){return _0x319900['sendStatus'](_0x574a8b);}return _0x319900[_0x2e39('0x17')](_0x574a8b)[_0x2e39('0x18')]();};}function respondWithResult(_0x26f667,_0x14dd05){_0x14dd05=_0x14dd05||0xc8;return function(_0x4c20e2){if(_0x4c20e2){return _0x26f667[_0x2e39('0x17')](_0x14dd05)[_0x2e39('0x19')](_0x4c20e2);}};}function respondWithFilteredResult(_0xeeebec,_0x527a5){return function(_0x20cff4){if(_0x20cff4){var _0x5b22eb=typeof _0x527a5['offset']===_0x2e39('0x1a')&&typeof _0x527a5[_0x2e39('0x1b')]===_0x2e39('0x1a');var _0x225cea=_0x20cff4[_0x2e39('0x1c')];var _0x573e89=_0x5b22eb?0x0:_0x527a5['offset'];var _0xdefc4b=_0x5b22eb?_0x20cff4[_0x2e39('0x1c')]:_0x527a5[_0x2e39('0x1d')]+_0x527a5[_0x2e39('0x1b')];var _0x35a3ef;if(_0xdefc4b>=_0x225cea){_0xdefc4b=_0x225cea;_0x35a3ef=0xc8;}else{_0x35a3ef=0xce;}_0xeeebec[_0x2e39('0x17')](_0x35a3ef);return _0xeeebec[_0x2e39('0x1e')](_0x2e39('0x1f'),_0x573e89+'-'+_0xdefc4b+'/'+_0x225cea)[_0x2e39('0x19')](_0x20cff4);}return null;};}function patchUpdates(_0x48cfcb){return function(_0x3b1332){try{jsonpatch['apply'](_0x3b1332,_0x48cfcb,!![]);}catch(_0x58b035){return BPromise[_0x2e39('0x20')](_0x58b035);}return _0x3b1332[_0x2e39('0x21')]();};}function saveUpdates(_0xa4c9c6,_0x43c8f3){return function(_0x7afdea){if(_0x7afdea){return _0x7afdea[_0x2e39('0x22')](_0xa4c9c6)[_0x2e39('0x23')](function(_0xec932d){return _0xec932d;});}return null;};}function removeEntity(_0x2e6798,_0x3901d0){return function(_0x2da11d){if(_0x2da11d){return _0x2da11d[_0x2e39('0x24')]()['then'](function(){_0x2e6798[_0x2e39('0x17')](0xcc)[_0x2e39('0x18')]();});}};}function handleEntityNotFound(_0xb4c834,_0x56d569){return function(_0x25bc3a){if(!_0x25bc3a){_0xb4c834['sendStatus'](0x194);}return _0x25bc3a;};}function handleError(_0xe7bb9f,_0x5698ff){_0x5698ff=_0x5698ff||0x1f4;return function(_0x1aeacb){logger['error'](_0x1aeacb[_0x2e39('0x25')]);if(_0x1aeacb[_0x2e39('0x26')]){delete _0x1aeacb[_0x2e39('0x26')];}_0xe7bb9f[_0x2e39('0x17')](_0x5698ff)[_0x2e39('0x27')](_0x1aeacb);};}exports[_0x2e39('0x28')]=function(_0xac1fea,_0x19eee5){var _0x3c48b5={},_0x5cec74={},_0x9066d1={'count':0x0,'rows':[]};var _0x1ef680=_[_0x2e39('0x29')](db['VoiceMailMessage'][_0x2e39('0x2a')],function(_0x119c38){return{'name':_0x119c38['fieldName'],'type':_0x119c38['type'][_0x2e39('0x2b')]};});_0x5cec74[_0x2e39('0x2c')]=_[_0x2e39('0x2d')](_[_0x2e39('0x29')](_0x1ef680,'name'),[_0x2e39('0x26')]);_0x5cec74['query']=_[_0x2e39('0x2e')](_0xac1fea['query']);_0x5cec74[_0x2e39('0x2f')]=_[_0x2e39('0x30')](_0x5cec74[_0x2e39('0x2c')],_0x5cec74[_0x2e39('0x31')]);_0x3c48b5['attributes']=_[_0x2e39('0x30')](_0x5cec74['model'],qs[_0x2e39('0x32')](_0xac1fea[_0x2e39('0x31')][_0x2e39('0x32')]));_0x3c48b5[_0x2e39('0x33')]=_0x3c48b5[_0x2e39('0x33')][_0x2e39('0x34')]?_0x3c48b5[_0x2e39('0x33')]:_0x5cec74['model'];if(!_0xac1fea['query'][_0x2e39('0x35')](_0x2e39('0x36'))){_0x3c48b5[_0x2e39('0x1b')]=qs[_0x2e39('0x1b')](_0xac1fea['query'][_0x2e39('0x1b')]);_0x3c48b5[_0x2e39('0x1d')]=qs[_0x2e39('0x1d')](_0xac1fea[_0x2e39('0x31')][_0x2e39('0x1d')]);}_0x3c48b5[_0x2e39('0x37')]=qs['sort'](_0xac1fea[_0x2e39('0x31')][_0x2e39('0x38')]);_0x3c48b5[_0x2e39('0x39')]=qs['filters'](_[_0x2e39('0x3a')](_0xac1fea[_0x2e39('0x31')],_0x5cec74[_0x2e39('0x2f')]),_0x1ef680);if(_0xac1fea[_0x2e39('0x31')]['filter']){_0x3c48b5[_0x2e39('0x39')]=_[_0x2e39('0x3b')](_0x3c48b5[_0x2e39('0x39')],{'$or':_['map'](_0x1ef680,function(_0x4e657f){if(_0x4e657f[_0x2e39('0x3c')]!=='VIRTUAL'){var _0x3ed6a6={};_0x3ed6a6[_0x4e657f[_0x2e39('0x26')]]={'$like':'%'+_0xac1fea[_0x2e39('0x31')][_0x2e39('0x3d')]+'%'};return _0x3ed6a6;}})});}_0x3c48b5=_['merge']({},_0x3c48b5,_0xac1fea[_0x2e39('0x3e')]);var _0x3e32e5={'where':_0x3c48b5[_0x2e39('0x39')]};return db[_0x2e39('0x3f')][_0x2e39('0x1c')](_0x3e32e5)[_0x2e39('0x23')](function(_0x2e8508){_0x9066d1[_0x2e39('0x1c')]=_0x2e8508;if(_0xac1fea[_0x2e39('0x31')][_0x2e39('0x40')]){_0x3c48b5['include']=[{'all':!![]}];}return db[_0x2e39('0x3f')][_0x2e39('0x41')](_0x3c48b5);})[_0x2e39('0x23')](function(_0x1dc027){_0x9066d1[_0x2e39('0x42')]=_0x1dc027;return _0x9066d1;})[_0x2e39('0x23')](respondWithFilteredResult(_0x19eee5,_0x3c48b5))[_0x2e39('0x43')](handleError(_0x19eee5,null));};exports['show']=function(_0x41676f,_0x311aec){var _0x5e6bf6={'raw':!![],'where':{'id':_0x41676f[_0x2e39('0x44')]['id']}},_0x598015={};_0x598015['model']=_[_0x2e39('0x2e')](db[_0x2e39('0x3f')]['rawAttributes']);_0x598015[_0x2e39('0x31')]=_[_0x2e39('0x2e')](_0x41676f[_0x2e39('0x31')]);_0x598015[_0x2e39('0x2f')]=_[_0x2e39('0x30')](_0x598015['model'],_0x598015[_0x2e39('0x31')]);_0x5e6bf6[_0x2e39('0x33')]=_[_0x2e39('0x30')](_0x598015[_0x2e39('0x2c')],qs['fields'](_0x41676f[_0x2e39('0x31')]['fields']));_0x5e6bf6[_0x2e39('0x33')]=_0x5e6bf6[_0x2e39('0x33')][_0x2e39('0x34')]?_0x5e6bf6[_0x2e39('0x33')]:_0x598015[_0x2e39('0x2c')];if(_0x41676f[_0x2e39('0x31')]['includeAll']){_0x5e6bf6['include']=[{'all':!![]}];}_0x5e6bf6=_['merge']({},_0x5e6bf6,_0x41676f['options']);return db[_0x2e39('0x3f')][_0x2e39('0x45')](_0x5e6bf6)[_0x2e39('0x23')](handleEntityNotFound(_0x311aec,null))['then'](respondWithResult(_0x311aec,null))[_0x2e39('0x43')](handleError(_0x311aec,null));};exports[_0x2e39('0x46')]=function(_0x41c46a,_0x411d93){return db['VoiceMailMessage'][_0x2e39('0x46')](_0x41c46a['body'],{})[_0x2e39('0x23')](respondWithResult(_0x411d93,0xc9))['catch'](handleError(_0x411d93,null));};exports['update']=function(_0x248ae0,_0x1d5702){if(_0x248ae0[_0x2e39('0x47')]['id']){delete _0x248ae0[_0x2e39('0x47')]['id'];}return db[_0x2e39('0x3f')][_0x2e39('0x45')]({'where':{'id':_0x248ae0[_0x2e39('0x44')]['id']}})[_0x2e39('0x23')](handleEntityNotFound(_0x1d5702,null))[_0x2e39('0x23')](saveUpdates(_0x248ae0[_0x2e39('0x47')],null))[_0x2e39('0x23')](respondWithResult(_0x1d5702,null))[_0x2e39('0x43')](handleError(_0x1d5702,null));};exports[_0x2e39('0x24')]=function(_0x4a9f12,_0x28b391){return db['VoiceMailMessage']['find']({'where':{'id':_0x4a9f12[_0x2e39('0x44')]['id']}})[_0x2e39('0x23')](handleEntityNotFound(_0x28b391,null))[_0x2e39('0x23')](removeEntity(_0x28b391,null))[_0x2e39('0x43')](handleError(_0x28b391,null));};exports['download']=function(_0x4cf15e,_0x519789,_0x3c6078){return db[_0x2e39('0x3f')][_0x2e39('0x45')]({'where':{'id':_0x4cf15e[_0x2e39('0x44')]['id']},'attributes':['id',_0x2e39('0x48'),_0x2e39('0x49')]})[_0x2e39('0x23')](handleEntityNotFound(_0x519789,null))[_0x2e39('0x23')](function(_0x5a8ce1){if(_0x5a8ce1){if(!_0x5a8ce1[_0x2e39('0x48')]){throw new db[(_0x2e39('0x4a'))][(_0x2e39('0x4b'))](_0x2e39('0x4c'));}var _0x3d6315={'Content-Type':_0x2e39('0x4d'),'Content-Disposition':_0x2e39('0x4e')};if(_0x5a8ce1[_0x2e39('0x49')]){_0x3d6315[_0x2e39('0x4f')]=_0x2e39('0x50')+_0x5a8ce1[_0x2e39('0x49')]+_0x2e39('0x51');}_0x519789[_0x2e39('0x1e')](_0x3d6315);return _0x519789[_0x2e39('0x27')](new Buffer(_0x5a8ce1[_0x2e39('0x48')]));}})[_0x2e39('0x43')](handleError(_0x519789,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index deb66da..4065bc8 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 _0xc400=['VoiceMailMessage','dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0xc400,0x1c9));var _0x0c40=function(_0x233a8e,_0x382720){_0x233a8e=_0x233a8e-0x0;var _0x461a35=_0xc400[_0x233a8e];return _0x461a35;};'use strict';var _=require(_0x0c40('0x0'));var util=require(_0x0c40('0x1'));var logger=require('../../config/logger')(_0x0c40('0x2'));var moment=require(_0x0c40('0x3'));var BPromise=require(_0x0c40('0x4'));var rp=require(_0x0c40('0x5'));var fs=require('fs');var path=require(_0x0c40('0x6'));var rimraf=require(_0x0c40('0x7'));var config=require(_0x0c40('0x8'));var attributes=require(_0x0c40('0x9'));module[_0x0c40('0xa')]=function(_0x540759,_0x414cfa){return _0x540759['define'](_0x0c40('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0c40('0xc'),'fields':[_0x0c40('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x74d8=['request-promise','path','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird'];(function(_0xfb5b41,_0x5cbf71){var _0x53b1d1=function(_0xa5f9ad){while(--_0xa5f9ad){_0xfb5b41['push'](_0xfb5b41['shift']());}};_0x53b1d1(++_0x5cbf71);}(_0x74d8,0x1e7));var _0x874d=function(_0x43f45d,_0x4b6d54){_0x43f45d=_0x43f45d-0x0;var _0x5a6ff7=_0x74d8[_0x43f45d];return _0x5a6ff7;};'use strict';var _=require(_0x874d('0x0'));var util=require(_0x874d('0x1'));var logger=require(_0x874d('0x2'))('api');var moment=require(_0x874d('0x3'));var BPromise=require(_0x874d('0x4'));var rp=require(_0x874d('0x5'));var fs=require('fs');var path=require(_0x874d('0x6'));var rimraf=require('rimraf');var config=require(_0x874d('0x7'));var attributes=require(_0x874d('0x8'));module['exports']=function(_0x28a48f,_0x133af8){return _0x28a48f['define'](_0x874d('0x9'),attributes,{'tableName':_0x874d('0xa'),'paranoid':![],'indexes':[{'name':_0x874d('0xb'),'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 1ff9d5a..c115009 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 _0xcfac=['stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4bbbef,_0x5e3efb){var _0x15f9d7=function(_0x31179c){while(--_0x31179c){_0x4bbbef['push'](_0x4bbbef['shift']());}};_0x15f9d7(++_0x5e3efb);}(_0xcfac,0x16c));var _0xccfa=function(_0x326a37,_0x205615){_0x326a37=_0x326a37-0x0;var _0x75baa1=_0xcfac[_0x326a37];return _0x75baa1;};'use strict';var _=require(_0xccfa('0x0'));var util=require(_0xccfa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccfa('0x2'));var db=require(_0xccfa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xccfa('0x4'))(_0xccfa('0x5'));var config=require('../../config/environment');var jayson=require(_0xccfa('0x6'));var client=jayson['client'][_0xccfa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16c000,_0x205778,_0x46451e){return new BPromise(function(_0x163a0c,_0x19eb38){return client[_0xccfa('0x8')](_0x16c000,_0x46451e)[_0xccfa('0x9')](function(_0x4afeae){logger['info'](_0xccfa('0xa'),_0x205778,_0xccfa('0xb'));logger[_0xccfa('0xc')](_0xccfa('0xd'),_0x205778,_0xccfa('0xb'),JSON[_0xccfa('0xe')](_0x4afeae));if(_0x4afeae[_0xccfa('0xf')]){if(_0x4afeae[_0xccfa('0xf')][_0xccfa('0x10')]===0x1f4){logger[_0xccfa('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x205778,_0x4afeae[_0xccfa('0xf')]['message']);return _0x19eb38(_0x4afeae[_0xccfa('0xf')][_0xccfa('0x11')]);}logger[_0xccfa('0xf')](_0xccfa('0xa'),_0x205778,_0x4afeae[_0xccfa('0xf')]['message']);return _0x163a0c(_0x4afeae['error'][_0xccfa('0x11')]);}else{logger[_0xccfa('0x12')](_0xccfa('0xa'),_0x205778,_0xccfa('0xb'));_0x163a0c(_0x4afeae[_0xccfa('0x13')][_0xccfa('0x11')]);}})[_0xccfa('0x14')](function(_0x19bcb1){logger[_0xccfa('0xf')](_0xccfa('0xa'),_0x205778,_0x19bcb1);_0x19eb38(_0x19bcb1);});});} \ No newline at end of file +var _0xaad3=['VoiceMailMessage,\x20%s,\x20%s','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11d137,_0x498b8b){var _0x5e7079=function(_0x2aaea0){while(--_0x2aaea0){_0x11d137['push'](_0x11d137['shift']());}};_0x5e7079(++_0x498b8b);}(_0xaad3,0xe1));var _0x3aad=function(_0x2f8e0b,_0x307ff5){_0x2f8e0b=_0x2f8e0b-0x0;var _0x1c930c=_0xaad3[_0x2f8e0b];return _0x1c930c;};'use strict';var _=require('lodash');var util=require(_0x3aad('0x0'));var moment=require(_0x3aad('0x1'));var BPromise=require('bluebird');var rs=require(_0x3aad('0x2'));var fs=require('fs');var Redis=require(_0x3aad('0x3'));var db=require(_0x3aad('0x4'))['db'];var utils=require(_0x3aad('0x5'));var logger=require(_0x3aad('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3aad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x103284,_0x26d5cb,_0x55d12b){return new BPromise(function(_0x55870e,_0x2b2f4b){return client['request'](_0x103284,_0x55d12b)['then'](function(_0x1d0daf){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x26d5cb,_0x3aad('0x8'));logger['debug'](_0x3aad('0x9'),_0x26d5cb,_0x3aad('0x8'),JSON[_0x3aad('0xa')](_0x1d0daf));if(_0x1d0daf[_0x3aad('0xb')]){if(_0x1d0daf[_0x3aad('0xb')][_0x3aad('0xc')]===0x1f4){logger[_0x3aad('0xb')](_0x3aad('0xd'),_0x26d5cb,_0x1d0daf[_0x3aad('0xb')][_0x3aad('0xe')]);return _0x2b2f4b(_0x1d0daf[_0x3aad('0xb')][_0x3aad('0xe')]);}logger[_0x3aad('0xb')](_0x3aad('0xd'),_0x26d5cb,_0x1d0daf['error']['message']);return _0x55870e(_0x1d0daf['error']['message']);}else{logger[_0x3aad('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x26d5cb,_0x3aad('0x8'));_0x55870e(_0x1d0daf['result'][_0x3aad('0xe')]);}})[_0x3aad('0x10')](function(_0x1920b1){logger[_0x3aad('0xb')](_0x3aad('0xd'),_0x26d5cb,_0x1920b1);_0x2b2f4b(_0x1920b1);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 917a9ee..89ca24a 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 _0x2c16=['getSounds','post','create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated'];(function(_0x49282b,_0x4e2125){var _0xcb542e=function(_0x19fb29){while(--_0x19fb29){_0x49282b['push'](_0x49282b['shift']());}};_0xcb542e(++_0x4e2125);}(_0x2c16,0x17c));var _0x62c1=function(_0x5a7f90,_0x110278){_0x5a7f90=_0x5a7f90-0x0;var _0x31fa44=_0x2c16[_0x5a7f90];return _0x31fa44;};'use strict';var multer=require('multer');var util=require(_0x62c1('0x0'));var path=require(_0x62c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x62c1('0x2'));var router=express[_0x62c1('0x3')]();var fs_extra=require(_0x62c1('0x4'));var auth=require(_0x62c1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62c1('0x6'));var controller=require(_0x62c1('0x7'));router[_0x62c1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x62c1('0x8')](_0x62c1('0x9'),auth[_0x62c1('0xa')](),controller['show']);router[_0x62c1('0x8')]('/:id/sounds',auth[_0x62c1('0xa')](),controller[_0x62c1('0xb')]);router[_0x62c1('0xc')]('/',auth[_0x62c1('0xa')](),controller[_0x62c1('0xd')]);router['post'](_0x62c1('0xe'),auth[_0x62c1('0xa')](),controller[_0x62c1('0xf')]);router[_0x62c1('0x10')](_0x62c1('0x9'),auth['isAuthenticated'](),controller[_0x62c1('0x11')]);router[_0x62c1('0x12')](_0x62c1('0x9'),auth['isAuthenticated'](),controller[_0x62c1('0x13')]);router[_0x62c1('0x12')](_0x62c1('0x14'),auth[_0x62c1('0xa')](),controller[_0x62c1('0x15')]);module[_0x62c1('0x16')]=router; \ No newline at end of file +var _0xf5d8=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','express','Router'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0xf5d8,0x11a));var _0x8f5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5d8[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8f5d('0x0'));var util=require(_0x8f5d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8f5d('0x2'));var router=express[_0x8f5d('0x3')]();var fs_extra=require(_0x8f5d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8f5d('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x8f5d('0x6')]('/',auth[_0x8f5d('0x7')](),controller[_0x8f5d('0x8')]);router[_0x8f5d('0x6')](_0x8f5d('0x9'),auth['isAuthenticated'](),controller[_0x8f5d('0xa')]);router[_0x8f5d('0x6')](_0x8f5d('0xb'),auth[_0x8f5d('0x7')](),controller[_0x8f5d('0xc')]);router[_0x8f5d('0xd')]('/',auth[_0x8f5d('0x7')](),controller['create']);router[_0x8f5d('0xd')](_0x8f5d('0xb'),auth[_0x8f5d('0x7')](),controller[_0x8f5d('0xe')]);router[_0x8f5d('0xf')](_0x8f5d('0x9'),auth[_0x8f5d('0x7')](),controller[_0x8f5d('0x10')]);router[_0x8f5d('0x11')](_0x8f5d('0x9'),auth[_0x8f5d('0x7')](),controller[_0x8f5d('0x12')]);router[_0x8f5d('0x11')](_0x8f5d('0x13'),auth['isAuthenticated'](),controller[_0x8f5d('0x14')]);module[_0x8f5d('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 6f013d7..32744be 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 _0xefcd=['alpha','TIMESTAMP','sequelize','exports','name','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','STRING'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xefcd,0x86));var _0xdefc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xefcd[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xdefc('0x0'));module[_0xdefc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdefc('0x2')},'mode':{'type':Sequelize['ENUM'](_0xdefc('0x3'),'files',_0xdefc('0x4'),_0xdefc('0x5'),_0xdefc('0x6'),_0xdefc('0x7')),'allowNull':!![],'defaultValue':_0xdefc('0x8')},'directory':{'type':Sequelize[_0xdefc('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0xdefc('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0xdefc('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0xdefc('0x9')],'allowNull':!![],'defaultValue':_0xdefc('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xdefc('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf42a=['STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf42a,0x197));var _0xaf42=function(_0xef472,_0x23ad7e){_0xef472=_0xef472-0x0;var _0x4a7e04=_0xf42a[_0xef472];return _0x4a7e04;};'use strict';var Sequelize=require(_0xaf42('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf42('0x1')],'allowNull':![],'unique':_0xaf42('0x2')},'mode':{'type':Sequelize[_0xaf42('0x3')](_0xaf42('0x4'),_0xaf42('0x5'),_0xaf42('0x6'),_0xaf42('0x7'),_0xaf42('0x8'),_0xaf42('0x9')),'allowNull':!![],'defaultValue':_0xaf42('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xaf42('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xaf42('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xaf42('0x1')],'allowNull':!![],'defaultValue':_0xaf42('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xaf42('0xb')],'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 27c6a2c..42ac82a 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 _0x27e1=['order','eml-format','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','extname','format','symlinkSync','ValidationError','removeSound','id2','Sound','getSounds','keys'];(function(_0x5d917c,_0x7846a){var _0x4e850f=function(_0x5409f2){while(--_0x5409f2){_0x5d917c['push'](_0x5d917c['shift']());}};_0x4e850f(++_0x7846a);}(_0x27e1,0x1b9));var _0x127e=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x27e1[_0x231e16];return _0x570a7c;};'use strict';var emlformat=require(_0x127e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x127e('0x1'));var rp=require(_0x127e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x127e('0x3'));var util=require('util');var path=require(_0x127e('0x4'));var sox=require(_0x127e('0x5'));var csv=require('to-csv');var ejs=require(_0x127e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x127e('0x7'));var squel=require('squel');var crypto=require(_0x127e('0x8'));var jsforce=require(_0x127e('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x127e('0xa'));var Papa=require(_0x127e('0xb'));var Redis=require(_0x127e('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x127e('0xd'));var as=require(_0x127e('0xe'));var hardwareService=require(_0x127e('0xf'));var logger=require(_0x127e('0x10'))(_0x127e('0x11'));var utils=require(_0x127e('0x12'));var config=require(_0x127e('0x13'));var licenseUtil=require(_0x127e('0x14'));var db=require(_0x127e('0x15'))['db'];function respondWithStatusCode(_0x7bcad3,_0x2bdbae){_0x2bdbae=_0x2bdbae||0xcc;return function(_0x75c27e){if(_0x75c27e){return _0x7bcad3['sendStatus'](_0x2bdbae);}return _0x7bcad3[_0x127e('0x16')](_0x2bdbae)['end']();};}function respondWithResult(_0x3df1b7,_0x278073){_0x278073=_0x278073||0xc8;return function(_0x5f069d){if(_0x5f069d){return _0x3df1b7[_0x127e('0x16')](_0x278073)['json'](_0x5f069d);}};}function respondWithFilteredResult(_0x1f01b6,_0xc6c237){return function(_0x401a1c){if(_0x401a1c){var _0x695840=typeof _0xc6c237['offset']===_0x127e('0x17')&&typeof _0xc6c237['limit']===_0x127e('0x17');var _0x5c5d19=_0x401a1c[_0x127e('0x18')];var _0x5788e4=_0x695840?0x0:_0xc6c237[_0x127e('0x19')];var _0xc3b046=_0x695840?_0x401a1c['count']:_0xc6c237[_0x127e('0x19')]+_0xc6c237[_0x127e('0x1a')];var _0x202d7d;if(_0xc3b046>=_0x5c5d19){_0xc3b046=_0x5c5d19;_0x202d7d=0xc8;}else{_0x202d7d=0xce;}_0x1f01b6[_0x127e('0x16')](_0x202d7d);return _0x1f01b6[_0x127e('0x1b')](_0x127e('0x1c'),_0x5788e4+'-'+_0xc3b046+'/'+_0x5c5d19)['json'](_0x401a1c);}return null;};}function patchUpdates(_0x4f55d8){return function(_0x17ed3b){try{jsonpatch['apply'](_0x17ed3b,_0x4f55d8,!![]);}catch(_0x27f5d2){return BPromise[_0x127e('0x1d')](_0x27f5d2);}return _0x17ed3b['save']();};}function saveUpdates(_0x2422e2,_0x57e829){return function(_0x3e6542){if(_0x3e6542){return _0x3e6542[_0x127e('0x1e')](_0x2422e2)[_0x127e('0x1f')](function(_0xabd19f){return _0xabd19f;});}return null;};}function removeEntity(_0xbf4ffc,_0x3fc069){return function(_0x6cbd7f){if(_0x6cbd7f){return _0x6cbd7f['destroy']()[_0x127e('0x1f')](function(){var _0x2bd07d=_0x6cbd7f[_0x127e('0x20')]({'plain':!![]});var _0x3a7ebd=_0x127e('0x21');return db[_0x127e('0x22')][_0x127e('0x23')]({'where':{'type':_0x3a7ebd,'resourceId':_0x2bd07d['id']}})[_0x127e('0x1f')](function(){return _0x6cbd7f;});})[_0x127e('0x1f')](function(){_0xbf4ffc['status'](0xcc)[_0x127e('0x24')]();});}};}function handleEntityNotFound(_0x1523f0,_0x3b3a44){return function(_0x3f6463){if(!_0x3f6463){_0x1523f0[_0x127e('0x25')](0x194);}return _0x3f6463;};}function handleError(_0x406be6,_0x691afa){_0x691afa=_0x691afa||0x1f4;return function(_0x13b069){logger[_0x127e('0x26')](_0x13b069[_0x127e('0x27')]);if(_0x13b069[_0x127e('0x28')]){delete _0x13b069['name'];}_0x406be6[_0x127e('0x16')](_0x691afa)[_0x127e('0x29')](_0x13b069);};}exports[_0x127e('0x2a')]=function(_0x4d521c,_0x1d7bfe){var _0x5eca27={},_0x4ee35e={},_0x2a158f={'count':0x0,'rows':[]};var _0x4ff603=_['map'](db[_0x127e('0x2b')][_0x127e('0x2c')],function(_0x14fc1f){return{'name':_0x14fc1f[_0x127e('0x2d')],'type':_0x14fc1f[_0x127e('0x2e')][_0x127e('0x2f')]};});_0x4ee35e[_0x127e('0x30')]=_['map'](_0x4ff603,_0x127e('0x28'));_0x4ee35e[_0x127e('0x31')]=_['keys'](_0x4d521c[_0x127e('0x31')]);_0x4ee35e[_0x127e('0x32')]=_[_0x127e('0x33')](_0x4ee35e['model'],_0x4ee35e[_0x127e('0x31')]);_0x5eca27[_0x127e('0x34')]=_[_0x127e('0x33')](_0x4ee35e[_0x127e('0x30')],qs[_0x127e('0x35')](_0x4d521c[_0x127e('0x31')][_0x127e('0x35')]));_0x5eca27[_0x127e('0x34')]=_0x5eca27['attributes'][_0x127e('0x36')]?_0x5eca27['attributes']:_0x4ee35e[_0x127e('0x30')];if(!_0x4d521c[_0x127e('0x31')][_0x127e('0x37')](_0x127e('0x38'))){_0x5eca27[_0x127e('0x1a')]=qs['limit'](_0x4d521c[_0x127e('0x31')][_0x127e('0x1a')]);_0x5eca27[_0x127e('0x19')]=qs['offset'](_0x4d521c[_0x127e('0x31')][_0x127e('0x19')]);}_0x5eca27['order']=qs[_0x127e('0x39')](_0x4d521c[_0x127e('0x31')][_0x127e('0x39')]);delete _0x4d521c[_0x127e('0x31')]['sort'];_0x5eca27[_0x127e('0x3a')]=qs[_0x127e('0x32')](_[_0x127e('0x3b')](_0x4d521c[_0x127e('0x31')],_0x4ee35e[_0x127e('0x32')]),_0x4ff603);if(_0x4d521c[_0x127e('0x31')][_0x127e('0x3c')]){_0x5eca27[_0x127e('0x3a')]=_[_0x127e('0x3d')](_0x5eca27[_0x127e('0x3a')],{'$or':_[_0x127e('0x3e')](_0x4ff603,function(_0x394672){if(_0x394672[_0x127e('0x2e')]!==_0x127e('0x3f')){var _0x64a85e={};_0x64a85e[_0x394672['name']]={'$like':'%'+_0x4d521c[_0x127e('0x31')][_0x127e('0x3c')]+'%'};return _0x64a85e;}})});}_0x5eca27=_[_0x127e('0x3d')]({},_0x5eca27,_0x4d521c[_0x127e('0x40')]);var _0x37786d={'where':_0x5eca27['where']};return db[_0x127e('0x2b')][_0x127e('0x18')](_0x37786d)[_0x127e('0x1f')](function(_0xeba1bb){_0x2a158f[_0x127e('0x18')]=_0xeba1bb;if(_0x4d521c[_0x127e('0x31')][_0x127e('0x41')]){_0x5eca27['include']=[{'all':!![]}];}return db[_0x127e('0x2b')]['findAll'](_0x5eca27);})['then'](function(_0x4498d5){_0x2a158f[_0x127e('0x42')]=_0x4498d5;return _0x2a158f;})['then'](respondWithFilteredResult(_0x1d7bfe,_0x5eca27))[_0x127e('0x43')](handleError(_0x1d7bfe,null));};exports[_0x127e('0x44')]=function(_0x3a91bd,_0x58d7b9){var _0xe29ac9={'raw':![],'where':{'id':_0x3a91bd[_0x127e('0x45')]['id']}},_0x183595={};_0x183595[_0x127e('0x30')]=_['keys'](db[_0x127e('0x2b')][_0x127e('0x2c')]);_0x183595['query']=_['keys'](_0x3a91bd['query']);_0x183595[_0x127e('0x32')]=_[_0x127e('0x33')](_0x183595[_0x127e('0x30')],_0x183595[_0x127e('0x31')]);_0xe29ac9[_0x127e('0x34')]=_['intersection'](_0x183595[_0x127e('0x30')],qs[_0x127e('0x35')](_0x3a91bd[_0x127e('0x31')][_0x127e('0x35')]));_0xe29ac9[_0x127e('0x34')]=_0xe29ac9[_0x127e('0x34')][_0x127e('0x36')]?_0xe29ac9['attributes']:_0x183595[_0x127e('0x30')];if(_0x3a91bd['query']['includeAll']){_0xe29ac9[_0x127e('0x46')]=[{'all':!![]}];}_0xe29ac9=_[_0x127e('0x3d')]({},_0xe29ac9,_0x3a91bd['options']);return db[_0x127e('0x2b')][_0x127e('0x47')](_0xe29ac9)[_0x127e('0x1f')](handleEntityNotFound(_0x58d7b9,null))[_0x127e('0x1f')](respondWithResult(_0x58d7b9,null))[_0x127e('0x43')](handleError(_0x58d7b9,null));};exports[_0x127e('0x1e')]=function(_0x4c91c1,_0x155b05){if(_0x4c91c1['body']['id']){delete _0x4c91c1['body']['id'];}return db[_0x127e('0x2b')]['find']({'where':{'id':_0x4c91c1['params']['id']}})[_0x127e('0x1f')](handleEntityNotFound(_0x155b05,null))[_0x127e('0x1f')](saveUpdates(_0x4c91c1[_0x127e('0x48')],null))[_0x127e('0x1f')](respondWithResult(_0x155b05,null))['catch'](handleError(_0x155b05,null));};exports[_0x127e('0x49')]=function(_0x43ce25,_0x5483ea,_0x3d6c71){return db[_0x127e('0x4a')][_0x127e('0x4b')](function(_0x5d56d4){if(_0x43ce25[_0x127e('0x48')][_0x127e('0x4c')]===_0x127e('0x4d')){_0x43ce25['body'][_0x127e('0x4e')]=path[_0x127e('0x4f')](config[_0x127e('0x50')],_0x127e('0x51'),_0x43ce25[_0x127e('0x48')]['name']);}return db['VoiceMusicOnHold'][_0x127e('0x49')](_0x43ce25[_0x127e('0x48')],{'transaction':_0x5d56d4})['then'](function(_0x57b97b){if(_0x43ce25[_0x127e('0x48')]['mode']===_0x127e('0x4d')){fs[_0x127e('0x52')](_0x57b97b[_0x127e('0x4e')],parseInt(_0x127e('0x53'),0x8));}var _0x5b840e=_0x43ce25[_0x127e('0x54')][_0x127e('0x20')]({'plain':!![]});if(!_0x5b840e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b840e['role']==='user'){var _0x4df631=_0x57b97b[_0x127e('0x20')]({'plain':!![]});return db['UserProfileSection'][_0x127e('0x47')]({'where':{'name':_0x127e('0x21'),'userProfileId':_0x5b840e['userProfileId']},'raw':!![]})[_0x127e('0x1f')](function(_0x416568){if(_0x416568&&_0x416568[_0x127e('0x55')]===0x0){return db[_0x127e('0x22')][_0x127e('0x49')]({'name':_0x4df631[_0x127e('0x28')],'resourceId':_0x4df631['id'],'type':_0x416568['name'],'sectionId':_0x416568['id']},{})[_0x127e('0x1f')](function(){return _0x57b97b;});}else{return _0x57b97b;}})[_0x127e('0x43')](function(_0x5c123a){logger[_0x127e('0x26')](_0x127e('0x56'),_0x5c123a);});}return _0x57b97b;});})[_0x127e('0x1f')](respondWithResult(_0x5483ea,0xc9))[_0x127e('0x43')](handleError(_0x5483ea,null));};exports[_0x127e('0x23')]=function(_0x4281be,_0x16e804,_0x221549){var _0xe55e6c;return db[_0x127e('0x2b')]['find']({'where':{'id':_0x4281be[_0x127e('0x45')]['id']}})[_0x127e('0x1f')](function(_0x52c461){if(_0x52c461){return db['sequelize'][_0x127e('0x4b')](function(_0x1531be){return _0x52c461['destroy']({'transaction':_0x1531be,'raw':!![]})[_0x127e('0x1f')](function(_0x2ffa37){if(_0x2ffa37['directory']){fs[_0x127e('0x57')](_0x2ffa37[_0x127e('0x4e')])['forEach'](function(_0xc19cf2){fs[_0x127e('0x58')](path[_0x127e('0x4f')](_0x2ffa37[_0x127e('0x4e')],_0xc19cf2));});fs[_0x127e('0x59')](_0x2ffa37[_0x127e('0x4e')]);}return _0x2ffa37;});})[_0x127e('0x43')](function(_0x5bbf9b){throw new db[(_0x127e('0x5a'))]['ValidationError'](_0x5bbf9b[_0x127e('0x5b')]);});}})[_0x127e('0x1f')](handleEntityNotFound(_0x16e804,null))[_0x127e('0x1f')](removeEntity(_0x16e804,null))[_0x127e('0x43')](handleError(_0x16e804,null));};exports[_0x127e('0x5c')]=function(_0x34d0d9,_0x15a4f5,_0x3933d4){return db['sequelize'][_0x127e('0x4b')](function(_0x5540c3){var _0x3c563f;return db[_0x127e('0x2b')][_0x127e('0x47')]({'where':{'id':_0x34d0d9[_0x127e('0x45')]['id']}})[_0x127e('0x1f')](function(_0x4e4dd8){if(_0x4e4dd8){_0x3c563f=_0x4e4dd8;return _0x4e4dd8[_0x127e('0x5c')](_0x34d0d9['body']['id'],{'transaction':_0x5540c3});}})[_0x127e('0x1f')](function(_0x1e5799){if(_0x1e5799){return db['Sound'][_0x127e('0x5d')]({'where':{'id':_0x34d0d9[_0x127e('0x48')]['id']},'attributes':['id',_0x127e('0x28'),_0x127e('0x5e'),_0x127e('0x5f'),_0x127e('0x60')],'raw':!![]});}})[_0x127e('0x1f')](function(_0x7abce8){if(_0x7abce8){var _0x99d54a=path[_0x127e('0x4f')](config[_0x127e('0x50')],_0x127e('0x61'),util['format'](_0x127e('0x62'),path[_0x127e('0x63')](_0x7abce8[_0x127e('0x5e')],path[_0x127e('0x64')](_0x7abce8[_0x127e('0x5e')])),_0x7abce8[_0x127e('0x5f')]));var _0x408ca6=path[_0x127e('0x4f')](config[_0x127e('0x50')],'server/files/moh',_0x3c563f[_0x127e('0x28')],util[_0x127e('0x65')](_0x127e('0x62'),_0x7abce8[_0x127e('0x28')],_0x7abce8[_0x127e('0x5f')]));fs[_0x127e('0x66')](_0x99d54a,_0x408ca6);return _0x7abce8;}})[_0x127e('0x43')](function(_0x3ea702){throw new db['Sequelize'][(_0x127e('0x67'))](_0x3ea702[_0x127e('0x5b')]);});})[_0x127e('0x1f')](handleEntityNotFound(_0x15a4f5,null))['then'](respondWithResult(_0x15a4f5,0xc9))[_0x127e('0x43')](handleError(_0x15a4f5,null));};exports[_0x127e('0x68')]=function(_0x3daa75,_0x443220,_0x248083){return db[_0x127e('0x4a')][_0x127e('0x4b')](function(_0x3703a3){var _0x1804ae;return db[_0x127e('0x2b')]['findOne']({'where':{'id':_0x3daa75['params']['id']}})['then'](handleEntityNotFound(_0x443220,null))[_0x127e('0x1f')](function(_0x4e6167){if(_0x4e6167){_0x1804ae=_0x4e6167;return _0x4e6167[_0x127e('0x68')](_0x3daa75['params'][_0x127e('0x69')]);}})['then'](function(_0x2c237e){if(_0x2c237e){return db[_0x127e('0x6a')][_0x127e('0x5d')]({'where':{'id':_0x3daa75[_0x127e('0x45')][_0x127e('0x69')]},'attributes':['id',_0x127e('0x28'),_0x127e('0x5e'),_0x127e('0x5f'),_0x127e('0x60')],'raw':!![]});}})['then'](function(_0x401cee){if(_0x401cee){fs['unlinkSync'](path[_0x127e('0x4f')](_0x1804ae[_0x127e('0x4e')],util[_0x127e('0x65')](_0x127e('0x62'),_0x401cee[_0x127e('0x28')],_0x401cee[_0x127e('0x5f')])));return _0x401cee;}})[_0x127e('0x43')](function(_0xde9154){throw new db[(_0x127e('0x5a'))][(_0x127e('0x67'))](_0xde9154[_0x127e('0x5b')]);});})['then'](handleEntityNotFound(_0x443220,null))['then'](respondWithStatusCode(_0x443220,0xcc))[_0x127e('0x43')](handleError(_0x443220,null));};exports[_0x127e('0x6b')]=function(_0x58dcfb,_0x8548c7,_0x4c5462){var _0x2eacaa={};var _0x12c47e={};var _0x1422e2;var _0x16c55f;return db[_0x127e('0x2b')][_0x127e('0x5d')]({'where':{'id':_0x58dcfb[_0x127e('0x45')]['id']}})[_0x127e('0x1f')](handleEntityNotFound(_0x8548c7,null))['then'](function(_0x495b2f){if(_0x495b2f){_0x1422e2=_0x495b2f;_0x12c47e[_0x127e('0x30')]=_[_0x127e('0x6c')](db[_0x127e('0x6a')][_0x127e('0x2c')]);_0x12c47e[_0x127e('0x31')]=_[_0x127e('0x6c')](_0x58dcfb[_0x127e('0x31')]);_0x12c47e[_0x127e('0x32')]=_[_0x127e('0x33')](_0x12c47e[_0x127e('0x30')],_0x12c47e[_0x127e('0x31')]);_0x2eacaa[_0x127e('0x34')]=_[_0x127e('0x33')](_0x12c47e[_0x127e('0x30')],qs[_0x127e('0x35')](_0x58dcfb[_0x127e('0x31')][_0x127e('0x35')]));_0x2eacaa[_0x127e('0x34')]=_0x2eacaa[_0x127e('0x34')][_0x127e('0x36')]?_0x2eacaa[_0x127e('0x34')]:_0x12c47e['model'];_0x2eacaa[_0x127e('0x6d')]=qs[_0x127e('0x39')](_0x58dcfb['query'][_0x127e('0x39')]);_0x2eacaa[_0x127e('0x3a')]=qs[_0x127e('0x32')](_['pick'](_0x58dcfb[_0x127e('0x31')],_0x12c47e[_0x127e('0x32')]));if(_0x58dcfb['query']['filter']){_0x2eacaa[_0x127e('0x3a')]=_[_0x127e('0x3d')](_0x2eacaa['where'],{'$or':_['map'](_0x2eacaa[_0x127e('0x34')],function(_0x4058e7){var _0x5150ca={};_0x5150ca[_0x4058e7]={'$like':'%'+_0x58dcfb[_0x127e('0x31')]['filter']+'%'};return _0x5150ca;})});}_0x2eacaa=_[_0x127e('0x3d')]({},_0x2eacaa,_0x58dcfb[_0x127e('0x40')]);return _0x1422e2['getSounds'](_0x2eacaa);}})['then'](function(_0x537507){if(_0x537507){_0x16c55f=_0x537507[_0x127e('0x36')];if(!_0x58dcfb['query'][_0x127e('0x37')](_0x127e('0x38'))){_0x2eacaa[_0x127e('0x1a')]=qs['limit'](_0x58dcfb[_0x127e('0x31')][_0x127e('0x1a')]);_0x2eacaa[_0x127e('0x19')]=qs[_0x127e('0x19')](_0x58dcfb[_0x127e('0x31')]['offset']);}return _0x1422e2[_0x127e('0x6b')](_0x2eacaa);}})[_0x127e('0x1f')](function(_0x30c7f5){if(_0x30c7f5){return _0x30c7f5?{'count':_0x16c55f,'rows':_0x30c7f5}:null;}})[_0x127e('0x1f')](respondWithResult(_0x8548c7,null))['catch'](handleError(_0x8548c7,null));}; \ No newline at end of file +var _0x3258=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','ejs','fs-extra','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','count','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','find','body','create','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','readdirSync','unlinkSync','rmdirSync','ValidationError','addSound','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','symlinkSync','Sequelize','message','removeSound','Sound','getSounds','pick','eml-format'];(function(_0x46aa59,_0x570894){var _0x421cfb=function(_0x2efb18){while(--_0x2efb18){_0x46aa59['push'](_0x46aa59['shift']());}};_0x421cfb(++_0x570894);}(_0x3258,0x6c));var _0x8325=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3258[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8325('0x0'));var rimraf=require(_0x8325('0x1'));var zipdir=require(_0x8325('0x2'));var jsonpatch=require(_0x8325('0x3'));var rp=require(_0x8325('0x4'));var moment=require(_0x8325('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8325('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8325('0x7'));var fs=require('fs');var fs_extra=require(_0x8325('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8325('0x9'));var jsforce=require(_0x8325('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8325('0xb'));var querystring=require(_0x8325('0xc'));var Papa=require('papaparse');var Redis=require(_0x8325('0xd'));var authService=require(_0x8325('0xe'));var qs=require(_0x8325('0xf'));var as=require(_0x8325('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8325('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8325('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe06a73,_0x599a9b){_0x599a9b=_0x599a9b||0xcc;return function(_0x34d70b){if(_0x34d70b){return _0xe06a73[_0x8325('0x13')](_0x599a9b);}return _0xe06a73[_0x8325('0x14')](_0x599a9b)['end']();};}function respondWithResult(_0xd69c47,_0x4877e5){_0x4877e5=_0x4877e5||0xc8;return function(_0x2e3711){if(_0x2e3711){return _0xd69c47[_0x8325('0x14')](_0x4877e5)[_0x8325('0x15')](_0x2e3711);}};}function respondWithFilteredResult(_0xd12afc,_0x1c96b9){return function(_0x5ba70e){if(_0x5ba70e){var _0x4956f2=typeof _0x1c96b9[_0x8325('0x16')]==='undefined'&&typeof _0x1c96b9[_0x8325('0x17')]==='undefined';var _0x103103=_0x5ba70e[_0x8325('0x18')];var _0x429114=_0x4956f2?0x0:_0x1c96b9[_0x8325('0x16')];var _0x155829=_0x4956f2?_0x5ba70e['count']:_0x1c96b9[_0x8325('0x16')]+_0x1c96b9['limit'];var _0x2c95bc;if(_0x155829>=_0x103103){_0x155829=_0x103103;_0x2c95bc=0xc8;}else{_0x2c95bc=0xce;}_0xd12afc[_0x8325('0x14')](_0x2c95bc);return _0xd12afc['set']('Content-Range',_0x429114+'-'+_0x155829+'/'+_0x103103)[_0x8325('0x15')](_0x5ba70e);}return null;};}function patchUpdates(_0x204d4d){return function(_0x953dc4){try{jsonpatch[_0x8325('0x19')](_0x953dc4,_0x204d4d,!![]);}catch(_0x4228a5){return BPromise[_0x8325('0x1a')](_0x4228a5);}return _0x953dc4[_0x8325('0x1b')]();};}function saveUpdates(_0x2059ca,_0x33b795){return function(_0x601eda){if(_0x601eda){return _0x601eda[_0x8325('0x1c')](_0x2059ca)[_0x8325('0x1d')](function(_0x3a208c){return _0x3a208c;});}return null;};}function removeEntity(_0x543c0c,_0x309793){return function(_0x1d47c2){if(_0x1d47c2){return _0x1d47c2[_0x8325('0x1e')]()['then'](function(){var _0x336d79=_0x1d47c2[_0x8325('0x1f')]({'plain':!![]});var _0xe5b53c='MusicOnHolds';return db['UserProfileResource'][_0x8325('0x1e')]({'where':{'type':_0xe5b53c,'resourceId':_0x336d79['id']}})[_0x8325('0x1d')](function(){return _0x1d47c2;});})[_0x8325('0x1d')](function(){_0x543c0c['status'](0xcc)[_0x8325('0x20')]();});}};}function handleEntityNotFound(_0x108aff,_0x371f0f){return function(_0x5d7541){if(!_0x5d7541){_0x108aff['sendStatus'](0x194);}return _0x5d7541;};}function handleError(_0xe5938d,_0x4eb709){_0x4eb709=_0x4eb709||0x1f4;return function(_0x4b5580){logger[_0x8325('0x21')](_0x4b5580[_0x8325('0x22')]);if(_0x4b5580[_0x8325('0x23')]){delete _0x4b5580[_0x8325('0x23')];}_0xe5938d[_0x8325('0x14')](_0x4eb709)[_0x8325('0x24')](_0x4b5580);};}exports[_0x8325('0x25')]=function(_0x59752f,_0x12e485){var _0x5b20fb={},_0x3e9127={},_0x2ff7fb={'count':0x0,'rows':[]};var _0x32d8c2=_[_0x8325('0x26')](db['VoiceMusicOnHold'][_0x8325('0x27')],function(_0x967c6c){return{'name':_0x967c6c[_0x8325('0x28')],'type':_0x967c6c[_0x8325('0x29')][_0x8325('0x2a')]};});_0x3e9127[_0x8325('0x2b')]=_['map'](_0x32d8c2,_0x8325('0x23'));_0x3e9127['query']=_[_0x8325('0x2c')](_0x59752f[_0x8325('0x2d')]);_0x3e9127[_0x8325('0x2e')]=_[_0x8325('0x2f')](_0x3e9127[_0x8325('0x2b')],_0x3e9127[_0x8325('0x2d')]);_0x5b20fb[_0x8325('0x30')]=_['intersection'](_0x3e9127['model'],qs[_0x8325('0x31')](_0x59752f[_0x8325('0x2d')][_0x8325('0x31')]));_0x5b20fb[_0x8325('0x30')]=_0x5b20fb[_0x8325('0x30')][_0x8325('0x32')]?_0x5b20fb[_0x8325('0x30')]:_0x3e9127['model'];if(!_0x59752f[_0x8325('0x2d')][_0x8325('0x33')](_0x8325('0x34'))){_0x5b20fb[_0x8325('0x17')]=qs[_0x8325('0x17')](_0x59752f[_0x8325('0x2d')]['limit']);_0x5b20fb['offset']=qs[_0x8325('0x16')](_0x59752f[_0x8325('0x2d')][_0x8325('0x16')]);}_0x5b20fb[_0x8325('0x35')]=qs[_0x8325('0x36')](_0x59752f['query']['sort']);delete _0x59752f[_0x8325('0x2d')][_0x8325('0x36')];_0x5b20fb[_0x8325('0x37')]=qs[_0x8325('0x2e')](_['pick'](_0x59752f[_0x8325('0x2d')],_0x3e9127[_0x8325('0x2e')]),_0x32d8c2);if(_0x59752f[_0x8325('0x2d')][_0x8325('0x38')]){_0x5b20fb[_0x8325('0x37')]=_[_0x8325('0x39')](_0x5b20fb[_0x8325('0x37')],{'$or':_[_0x8325('0x26')](_0x32d8c2,function(_0x6a37){if(_0x6a37['type']!==_0x8325('0x3a')){var _0x401a4d={};_0x401a4d[_0x6a37['name']]={'$like':'%'+_0x59752f[_0x8325('0x2d')][_0x8325('0x38')]+'%'};return _0x401a4d;}})});}_0x5b20fb=_[_0x8325('0x39')]({},_0x5b20fb,_0x59752f[_0x8325('0x3b')]);var _0x4c2f5a={'where':_0x5b20fb['where']};return db[_0x8325('0x3c')]['count'](_0x4c2f5a)[_0x8325('0x1d')](function(_0x12e5ee){_0x2ff7fb[_0x8325('0x18')]=_0x12e5ee;if(_0x59752f[_0x8325('0x2d')][_0x8325('0x3d')]){_0x5b20fb['include']=[{'all':!![]}];}return db[_0x8325('0x3c')][_0x8325('0x3e')](_0x5b20fb);})[_0x8325('0x1d')](function(_0x3a1f1f){_0x2ff7fb[_0x8325('0x3f')]=_0x3a1f1f;return _0x2ff7fb;})[_0x8325('0x1d')](respondWithFilteredResult(_0x12e485,_0x5b20fb))[_0x8325('0x40')](handleError(_0x12e485,null));};exports[_0x8325('0x41')]=function(_0x32b96f,_0x33aaef){var _0x274d23={'raw':![],'where':{'id':_0x32b96f[_0x8325('0x42')]['id']}},_0x4629a9={};_0x4629a9[_0x8325('0x2b')]=_[_0x8325('0x2c')](db['VoiceMusicOnHold'][_0x8325('0x27')]);_0x4629a9[_0x8325('0x2d')]=_['keys'](_0x32b96f[_0x8325('0x2d')]);_0x4629a9[_0x8325('0x2e')]=_[_0x8325('0x2f')](_0x4629a9[_0x8325('0x2b')],_0x4629a9[_0x8325('0x2d')]);_0x274d23[_0x8325('0x30')]=_[_0x8325('0x2f')](_0x4629a9[_0x8325('0x2b')],qs['fields'](_0x32b96f['query'][_0x8325('0x31')]));_0x274d23[_0x8325('0x30')]=_0x274d23[_0x8325('0x30')][_0x8325('0x32')]?_0x274d23[_0x8325('0x30')]:_0x4629a9['model'];if(_0x32b96f[_0x8325('0x2d')]['includeAll']){_0x274d23['include']=[{'all':!![]}];}_0x274d23=_[_0x8325('0x39')]({},_0x274d23,_0x32b96f['options']);return db[_0x8325('0x3c')][_0x8325('0x43')](_0x274d23)[_0x8325('0x1d')](handleEntityNotFound(_0x33aaef,null))[_0x8325('0x1d')](respondWithResult(_0x33aaef,null))[_0x8325('0x40')](handleError(_0x33aaef,null));};exports[_0x8325('0x1c')]=function(_0x10d012,_0x1d4218){if(_0x10d012[_0x8325('0x44')]['id']){delete _0x10d012[_0x8325('0x44')]['id'];}return db[_0x8325('0x3c')][_0x8325('0x43')]({'where':{'id':_0x10d012[_0x8325('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d4218,null))[_0x8325('0x1d')](saveUpdates(_0x10d012[_0x8325('0x44')],null))[_0x8325('0x1d')](respondWithResult(_0x1d4218,null))[_0x8325('0x40')](handleError(_0x1d4218,null));};exports[_0x8325('0x45')]=function(_0x114ddf,_0x2f51f2,_0x4eb98e){return db['sequelize']['transaction'](function(_0x4073c7){if(_0x114ddf[_0x8325('0x44')][_0x8325('0x46')]===_0x8325('0x47')){_0x114ddf[_0x8325('0x44')]['directory']=path[_0x8325('0x48')](config[_0x8325('0x49')],_0x8325('0x4a'),_0x114ddf['body'][_0x8325('0x23')]);}return db[_0x8325('0x3c')][_0x8325('0x45')](_0x114ddf[_0x8325('0x44')],{'transaction':_0x4073c7})['then'](function(_0x14a2d6){if(_0x114ddf['body'][_0x8325('0x46')]===_0x8325('0x47')){fs[_0x8325('0x4b')](_0x14a2d6[_0x8325('0x4c')],parseInt(_0x8325('0x4d'),0x8));}var _0x465a5b=_0x114ddf[_0x8325('0x4e')][_0x8325('0x1f')]({'plain':!![]});if(!_0x465a5b)throw new Error(_0x8325('0x4f'));if(_0x465a5b[_0x8325('0x50')]===_0x8325('0x4e')){var _0x11391f=_0x14a2d6[_0x8325('0x1f')]({'plain':!![]});return db[_0x8325('0x51')][_0x8325('0x43')]({'where':{'name':_0x8325('0x52'),'userProfileId':_0x465a5b[_0x8325('0x53')]},'raw':!![]})[_0x8325('0x1d')](function(_0xcafb24){if(_0xcafb24&&_0xcafb24['autoAssociation']===0x0){return db[_0x8325('0x54')][_0x8325('0x45')]({'name':_0x11391f['name'],'resourceId':_0x11391f['id'],'type':_0xcafb24[_0x8325('0x23')],'sectionId':_0xcafb24['id']},{})[_0x8325('0x1d')](function(){return _0x14a2d6;});}else{return _0x14a2d6;}})[_0x8325('0x40')](function(_0x42c543){logger[_0x8325('0x21')](_0x8325('0x55'),_0x42c543);});}return _0x14a2d6;});})[_0x8325('0x1d')](respondWithResult(_0x2f51f2,0xc9))['catch'](handleError(_0x2f51f2,null));};exports[_0x8325('0x1e')]=function(_0x43df63,_0x49e1f7,_0x153fa2){var _0x32644f;return db[_0x8325('0x3c')][_0x8325('0x43')]({'where':{'id':_0x43df63['params']['id']}})[_0x8325('0x1d')](function(_0x56d271){if(_0x56d271){return db[_0x8325('0x56')][_0x8325('0x57')](function(_0x3eebfb){return _0x56d271[_0x8325('0x1e')]({'transaction':_0x3eebfb,'raw':!![]})[_0x8325('0x1d')](function(_0x3059f8){if(_0x3059f8[_0x8325('0x4c')]){fs[_0x8325('0x58')](_0x3059f8['directory'])['forEach'](function(_0x2861e9){fs[_0x8325('0x59')](path['join'](_0x3059f8[_0x8325('0x4c')],_0x2861e9));});fs[_0x8325('0x5a')](_0x3059f8[_0x8325('0x4c')]);}return _0x3059f8;});})[_0x8325('0x40')](function(_0x5157bf){throw new db['Sequelize'][(_0x8325('0x5b'))](_0x5157bf['message']);});}})[_0x8325('0x1d')](handleEntityNotFound(_0x49e1f7,null))[_0x8325('0x1d')](removeEntity(_0x49e1f7,null))[_0x8325('0x40')](handleError(_0x49e1f7,null));};exports[_0x8325('0x5c')]=function(_0x2f5a13,_0x50e55f,_0x39a4c7){return db[_0x8325('0x56')][_0x8325('0x57')](function(_0x2fe34c){var _0x16ba00;return db[_0x8325('0x3c')]['find']({'where':{'id':_0x2f5a13[_0x8325('0x42')]['id']}})[_0x8325('0x1d')](function(_0x2105af){if(_0x2105af){_0x16ba00=_0x2105af;return _0x2105af[_0x8325('0x5c')](_0x2f5a13[_0x8325('0x44')]['id'],{'transaction':_0x2fe34c});}})[_0x8325('0x1d')](function(_0x23e4b8){if(_0x23e4b8){return db['Sound'][_0x8325('0x5d')]({'where':{'id':_0x2f5a13['body']['id']},'attributes':['id',_0x8325('0x23'),'save_name',_0x8325('0x5e'),_0x8325('0x5f')],'raw':!![]});}})[_0x8325('0x1d')](function(_0x10f25f){if(_0x10f25f){var _0x5919bd=path[_0x8325('0x48')](config[_0x8325('0x49')],_0x8325('0x60'),util[_0x8325('0x61')]('%s.%s',path[_0x8325('0x62')](_0x10f25f[_0x8325('0x63')],path[_0x8325('0x64')](_0x10f25f[_0x8325('0x63')])),_0x10f25f[_0x8325('0x5e')]));var _0x3360e4=path['join'](config[_0x8325('0x49')],_0x8325('0x4a'),_0x16ba00[_0x8325('0x23')],util[_0x8325('0x61')](_0x8325('0x65'),_0x10f25f[_0x8325('0x23')],_0x10f25f['converted_format']));fs[_0x8325('0x66')](_0x5919bd,_0x3360e4);return _0x10f25f;}})[_0x8325('0x40')](function(_0x32925b){throw new db[(_0x8325('0x67'))][(_0x8325('0x5b'))](_0x32925b[_0x8325('0x68')]);});})[_0x8325('0x1d')](handleEntityNotFound(_0x50e55f,null))['then'](respondWithResult(_0x50e55f,0xc9))[_0x8325('0x40')](handleError(_0x50e55f,null));};exports['removeSound']=function(_0x3d37e1,_0x2b44c5,_0x5047b8){return db[_0x8325('0x56')]['transaction'](function(_0x4d44b5){var _0x45e4ce;return db[_0x8325('0x3c')][_0x8325('0x5d')]({'where':{'id':_0x3d37e1['params']['id']}})[_0x8325('0x1d')](handleEntityNotFound(_0x2b44c5,null))[_0x8325('0x1d')](function(_0x4e8c08){if(_0x4e8c08){_0x45e4ce=_0x4e8c08;return _0x4e8c08[_0x8325('0x69')](_0x3d37e1[_0x8325('0x42')]['id2']);}})[_0x8325('0x1d')](function(_0x1f61af){if(_0x1f61af){return db[_0x8325('0x6a')][_0x8325('0x5d')]({'where':{'id':_0x3d37e1['params']['id2']},'attributes':['id','name','save_name',_0x8325('0x5e'),'createdAt'],'raw':!![]});}})[_0x8325('0x1d')](function(_0x13fb5c){if(_0x13fb5c){fs[_0x8325('0x59')](path[_0x8325('0x48')](_0x45e4ce[_0x8325('0x4c')],util['format']('%s.%s',_0x13fb5c[_0x8325('0x23')],_0x13fb5c[_0x8325('0x5e')])));return _0x13fb5c;}})[_0x8325('0x40')](function(_0x31e58c){throw new db[(_0x8325('0x67'))][(_0x8325('0x5b'))](_0x31e58c[_0x8325('0x68')]);});})['then'](handleEntityNotFound(_0x2b44c5,null))[_0x8325('0x1d')](respondWithStatusCode(_0x2b44c5,0xcc))[_0x8325('0x40')](handleError(_0x2b44c5,null));};exports[_0x8325('0x6b')]=function(_0x5b783e,_0x4cb572,_0x49dbd1){var _0x501810={};var _0x4ba289={};var _0x3bddac;var _0x9d7491;return db[_0x8325('0x3c')]['findOne']({'where':{'id':_0x5b783e['params']['id']}})[_0x8325('0x1d')](handleEntityNotFound(_0x4cb572,null))[_0x8325('0x1d')](function(_0x260ad8){if(_0x260ad8){_0x3bddac=_0x260ad8;_0x4ba289[_0x8325('0x2b')]=_[_0x8325('0x2c')](db['Sound'][_0x8325('0x27')]);_0x4ba289[_0x8325('0x2d')]=_[_0x8325('0x2c')](_0x5b783e['query']);_0x4ba289[_0x8325('0x2e')]=_[_0x8325('0x2f')](_0x4ba289[_0x8325('0x2b')],_0x4ba289[_0x8325('0x2d')]);_0x501810[_0x8325('0x30')]=_[_0x8325('0x2f')](_0x4ba289[_0x8325('0x2b')],qs['fields'](_0x5b783e['query'][_0x8325('0x31')]));_0x501810[_0x8325('0x30')]=_0x501810[_0x8325('0x30')][_0x8325('0x32')]?_0x501810[_0x8325('0x30')]:_0x4ba289[_0x8325('0x2b')];_0x501810['order']=qs['sort'](_0x5b783e[_0x8325('0x2d')]['sort']);_0x501810[_0x8325('0x37')]=qs[_0x8325('0x2e')](_[_0x8325('0x6c')](_0x5b783e[_0x8325('0x2d')],_0x4ba289[_0x8325('0x2e')]));if(_0x5b783e[_0x8325('0x2d')][_0x8325('0x38')]){_0x501810[_0x8325('0x37')]=_[_0x8325('0x39')](_0x501810[_0x8325('0x37')],{'$or':_[_0x8325('0x26')](_0x501810['attributes'],function(_0x9ba6fc){var _0x3b2558={};_0x3b2558[_0x9ba6fc]={'$like':'%'+_0x5b783e[_0x8325('0x2d')][_0x8325('0x38')]+'%'};return _0x3b2558;})});}_0x501810=_[_0x8325('0x39')]({},_0x501810,_0x5b783e[_0x8325('0x3b')]);return _0x3bddac[_0x8325('0x6b')](_0x501810);}})[_0x8325('0x1d')](function(_0x30e43b){if(_0x30e43b){_0x9d7491=_0x30e43b[_0x8325('0x32')];if(!_0x5b783e[_0x8325('0x2d')][_0x8325('0x33')]('nolimit')){_0x501810[_0x8325('0x17')]=qs['limit'](_0x5b783e[_0x8325('0x2d')][_0x8325('0x17')]);_0x501810[_0x8325('0x16')]=qs[_0x8325('0x16')](_0x5b783e[_0x8325('0x2d')][_0x8325('0x16')]);}return _0x3bddac['getSounds'](_0x501810);}})[_0x8325('0x1d')](function(_0x137e45){if(_0x137e45){return _0x137e45?{'count':_0x9d7491,'rows':_0x137e45}:null;}})[_0x8325('0x1d')](respondWithResult(_0x4cb572,null))['catch'](handleError(_0x4cb572,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 08d7f91..08b6b4c 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 _0x3b6c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x4a3bc5,_0x394ce6){var _0x135827=function(_0x4e4286){while(--_0x4e4286){_0x4a3bc5['push'](_0x4a3bc5['shift']());}};_0x135827(++_0x394ce6);}(_0x3b6c,0x138));var _0xc3b6=function(_0x5da505,_0x3a3b0a){_0x5da505=_0x5da505-0x0;var _0x425916=_0x3b6c[_0x5da505];return _0x425916;};'use strict';var _=require(_0xc3b6('0x0'));var util=require(_0xc3b6('0x1'));var logger=require(_0xc3b6('0x2'))(_0xc3b6('0x3'));var moment=require(_0xc3b6('0x4'));var BPromise=require(_0xc3b6('0x5'));var rp=require(_0xc3b6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc3b6('0x7'));var attributes=require(_0xc3b6('0x8'));module[_0xc3b6('0x9')]=function(_0x3369df,_0x47f61d){return _0x3369df[_0xc3b6('0xa')](_0xc3b6('0xb'),attributes,{'tableName':_0xc3b6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5110=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x199bc9,_0x345a36){var _0x21aece=function(_0x203b56){while(--_0x203b56){_0x199bc9['push'](_0x199bc9['shift']());}};_0x21aece(++_0x345a36);}(_0x5110,0x19e));var _0x0511=function(_0xe3b37e,_0x14b557){_0xe3b37e=_0xe3b37e-0x0;var _0x5f9204=_0x5110[_0xe3b37e];return _0x5f9204;};'use strict';var _=require(_0x0511('0x0'));var util=require(_0x0511('0x1'));var logger=require(_0x0511('0x2'))(_0x0511('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0511('0x4'));var fs=require('fs');var path=require(_0x0511('0x5'));var rimraf=require(_0x0511('0x6'));var config=require(_0x0511('0x7'));var attributes=require(_0x0511('0x8'));module[_0x0511('0x9')]=function(_0x4479a0,_0x3e3e5c){return _0x4479a0[_0x0511('0xa')](_0x0511('0xb'),attributes,{'tableName':'voice_musiconhold','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 52b8263..7a932bc 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x55583a,_0x473b95){var _0x3e50c3=function(_0x645ce6){while(--_0x645ce6){_0x55583a['push'](_0x55583a['shift']());}};_0x3e50c3(++_0x473b95);}(_0x34e8,0x12c));var _0x834e=function(_0x52e39c,_0x34275c){_0x52e39c=_0x52e39c-0x0;var _0x304d0c=_0x34e8[_0x52e39c];return _0x304d0c;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x38099b,_0x4c38fe){var _0x13e309=function(_0xd179b3){while(--_0xd179b3){_0x38099b['push'](_0x38099b['shift']());}};_0x13e309(++_0x4c38fe);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2350eee..23635a1 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 _0x9491=['/:id/teams','addTeams','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/users','getAgents','getTeams','post','create'];(function(_0x49eb76,_0x48da95){var _0x2c9e1e=function(_0x522b8c){while(--_0x522b8c){_0x49eb76['push'](_0x49eb76['shift']());}};_0x2c9e1e(++_0x48da95);}(_0x9491,0xb6));var _0x1949=function(_0x49f85c,_0x4d988f){_0x49f85c=_0x49f85c-0x0;var _0x3d7f49=_0x9491[_0x49f85c];return _0x3d7f49;};'use strict';var multer=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var path=require(_0x1949('0x2'));var timeout=require(_0x1949('0x3'));var express=require(_0x1949('0x4'));var router=express[_0x1949('0x5')]();var fs_extra=require(_0x1949('0x6'));var auth=require(_0x1949('0x7'));var interaction=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var controller=require('./voicePrefix.controller');router[_0x1949('0xa')]('/',auth['isAuthenticated'](),controller[_0x1949('0xb')]);router[_0x1949('0xa')]('/describe',auth[_0x1949('0xc')](),controller[_0x1949('0xd')]);router[_0x1949('0xa')](_0x1949('0xe'),auth[_0x1949('0xc')](),controller[_0x1949('0xf')]);router[_0x1949('0xa')](_0x1949('0x10'),auth[_0x1949('0xc')](),controller[_0x1949('0x11')]);router[_0x1949('0xa')]('/:id/teams',auth[_0x1949('0xc')](),controller[_0x1949('0x12')]);router[_0x1949('0x13')]('/',auth[_0x1949('0xc')](),controller[_0x1949('0x14')]);router[_0x1949('0x13')]('/:id/users',auth[_0x1949('0xc')](),controller['addAgents']);router['post'](_0x1949('0x15'),auth[_0x1949('0xc')](),controller[_0x1949('0x16')]);router['put'](_0x1949('0xe'),auth[_0x1949('0xc')](),controller[_0x1949('0x17')]);router['delete']('/:id',auth[_0x1949('0xc')](),controller[_0x1949('0x18')]);router[_0x1949('0x19')]('/:id/users',auth[_0x1949('0xc')](),controller[_0x1949('0x1a')]);router['delete'](_0x1949('0x15'),auth[_0x1949('0xc')](),controller[_0x1949('0x1b')]);module[_0x1949('0x1c')]=router; \ No newline at end of file +var _0x8403=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8403,0x1a5));var _0x3840=function(_0xf273ca,_0x1ec2ed){_0xf273ca=_0xf273ca-0x0;var _0x4c32f1=_0x8403[_0xf273ca];return _0x4c32f1;};'use strict';var multer=require(_0x3840('0x0'));var util=require(_0x3840('0x1'));var path=require(_0x3840('0x2'));var timeout=require(_0x3840('0x3'));var express=require(_0x3840('0x4'));var router=express[_0x3840('0x5')]();var fs_extra=require(_0x3840('0x6'));var auth=require(_0x3840('0x7'));var interaction=require(_0x3840('0x8'));var config=require('../../config/environment');var controller=require(_0x3840('0x9'));router[_0x3840('0xa')]('/',auth[_0x3840('0xb')](),controller[_0x3840('0xc')]);router[_0x3840('0xa')](_0x3840('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x3840('0xa')](_0x3840('0xe'),auth[_0x3840('0xb')](),controller['show']);router['get'](_0x3840('0xf'),auth[_0x3840('0xb')](),controller[_0x3840('0x10')]);router[_0x3840('0xa')](_0x3840('0x11'),auth[_0x3840('0xb')](),controller[_0x3840('0x12')]);router[_0x3840('0x13')]('/',auth[_0x3840('0xb')](),controller[_0x3840('0x14')]);router['post'](_0x3840('0xf'),auth[_0x3840('0xb')](),controller[_0x3840('0x15')]);router['post'](_0x3840('0x11'),auth[_0x3840('0xb')](),controller['addTeams']);router[_0x3840('0x16')](_0x3840('0xe'),auth[_0x3840('0xb')](),controller[_0x3840('0x17')]);router[_0x3840('0x18')](_0x3840('0xe'),auth[_0x3840('0xb')](),controller[_0x3840('0x19')]);router[_0x3840('0x18')](_0x3840('0xf'),auth[_0x3840('0xb')](),controller['removeAgents']);router['delete'](_0x3840('0x11'),auth['isAuthenticated'](),controller[_0x3840('0x1a')]);module[_0x3840('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b4d097e..f9cb264 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 _0xa9cd=['name','system-','getDataValue','INTEGER','STRING'];(function(_0x7c89c7,_0x5dcf17){var _0x5892c4=function(_0x14e4d1){while(--_0x14e4d1){_0x7c89c7['push'](_0x7c89c7['shift']());}};_0x5892c4(++_0x5dcf17);}(_0xa9cd,0xf4));var _0xda9c=function(_0x258ed6,_0x46cb42){_0x258ed6=_0x258ed6-0x0;var _0x2fa360=_0xa9cd[_0x258ed6];return _0x2fa360;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xda9c('0x0')],'allowNull':![],'unique':_0xda9c('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x33726e){return _0xda9c('0x2')+this[_0xda9c('0x3')](_0xda9c('0x1'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xda9c('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0xda9c('0x4')]}}; \ No newline at end of file +var _0x7219=['system-','getDataValue','exports','STRING','name','VIRTUAL'];(function(_0x23200d,_0x15fb6e){var _0x3f8381=function(_0x3318d6){while(--_0x3318d6){_0x23200d['push'](_0x23200d['shift']());}};_0x3f8381(++_0x15fb6e);}(_0x7219,0x92));var _0x9721=function(_0x560b1b,_0x2f7161){_0x560b1b=_0x560b1b-0x0;var _0x74a97e=_0x7219[_0x560b1b];return _0x74a97e;};'use strict';var Sequelize=require('sequelize');module[_0x9721('0x0')]={'name':{'type':Sequelize[_0x9721('0x1')],'allowNull':![],'unique':_0x9721('0x2')},'prefix':{'type':Sequelize[_0x9721('0x3')],'get':function(_0x4aafb3){return _0x9721('0x4')+this[_0x9721('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x9721('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4e50473..9ef348b 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 _0x28f2=['filter','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','catch','show','params','keys','merge','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','getAgents','findOne','User','getTeams','pick','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','field','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','removeTeams','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0xa7963b,_0x376dc0){var _0x52c918=function(_0x46ba6e){while(--_0x46ba6e){_0xa7963b['push'](_0xa7963b['shift']());}};_0x52c918(++_0x376dc0);}(_0x28f2,0x193));var _0x228f=function(_0x428329,_0x109adf){_0x428329=_0x428329-0x0;var _0x10caa7=_0x28f2[_0x428329];return _0x10caa7;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];config[_0x228f('0x1a')]=_[_0x228f('0x1b')](config[_0x228f('0x1a')],{'host':_0x228f('0x1c'),'port':0x18eb});var socket=require(_0x228f('0x1d'))(new Redis(config[_0x228f('0x1a')]));require('./voicePrefix.socket')[_0x228f('0x1e')](socket);function respondWithStatusCode(_0xfb6aff,_0x14d6fc){_0x14d6fc=_0x14d6fc||0xcc;return function(_0x31dc9e){if(_0x31dc9e){return _0xfb6aff[_0x228f('0x1f')](_0x14d6fc);}return _0xfb6aff[_0x228f('0x20')](_0x14d6fc)[_0x228f('0x21')]();};}function respondWithResult(_0x5b5abb,_0x5e4d20){_0x5e4d20=_0x5e4d20||0xc8;return function(_0x4cae4a){if(_0x4cae4a){return _0x5b5abb[_0x228f('0x20')](_0x5e4d20)[_0x228f('0x22')](_0x4cae4a);}};}function respondWithFilteredResult(_0x195e65,_0x5bf5a2){return function(_0x2d4819){if(_0x2d4819){var _0x4e1968=typeof _0x5bf5a2[_0x228f('0x23')]==='undefined'&&typeof _0x5bf5a2[_0x228f('0x24')]==='undefined';var _0x5aa203=_0x2d4819[_0x228f('0x25')];var _0x52da36=_0x4e1968?0x0:_0x5bf5a2[_0x228f('0x23')];var _0x139373=_0x4e1968?_0x2d4819[_0x228f('0x25')]:_0x5bf5a2[_0x228f('0x23')]+_0x5bf5a2[_0x228f('0x24')];var _0x313cf2;if(_0x139373>=_0x5aa203){_0x139373=_0x5aa203;_0x313cf2=0xc8;}else{_0x313cf2=0xce;}_0x195e65[_0x228f('0x20')](_0x313cf2);return _0x195e65[_0x228f('0x26')](_0x228f('0x27'),_0x52da36+'-'+_0x139373+'/'+_0x5aa203)['json'](_0x2d4819);}return null;};}function patchUpdates(_0x1e96d4){return function(_0x8f7004){try{jsonpatch[_0x228f('0x28')](_0x8f7004,_0x1e96d4,!![]);}catch(_0x3c00ad){return BPromise[_0x228f('0x29')](_0x3c00ad);}return _0x8f7004[_0x228f('0x2a')]();};}function saveUpdates(_0x33e882,_0x20c111){return function(_0x2dcf68){if(_0x2dcf68){return _0x2dcf68['update'](_0x33e882)[_0x228f('0x2b')](function(_0x306928){return _0x306928;});}return null;};}function removeEntity(_0x2b3553,_0x272c7d){return function(_0x3036d4){if(_0x3036d4){return _0x3036d4['destroy']()[_0x228f('0x2b')](function(){var _0x49efe9=_0x3036d4[_0x228f('0x2c')]({'plain':!![]});var _0x5afa52='VoicePrefixes';return db[_0x228f('0x2d')][_0x228f('0x2e')]({'where':{'type':_0x5afa52,'resourceId':_0x49efe9['id']}})[_0x228f('0x2b')](function(){return _0x3036d4;});})[_0x228f('0x2b')](function(){_0x2b3553[_0x228f('0x20')](0xcc)[_0x228f('0x21')]();});}};}function handleEntityNotFound(_0x2eaf4f,_0x2511e5){return function(_0xe67c83){if(!_0xe67c83){_0x2eaf4f[_0x228f('0x1f')](0x194);}return _0xe67c83;};}function handleError(_0x2ba4f5,_0x136a9e){_0x136a9e=_0x136a9e||0x1f4;return function(_0xc25917){logger[_0x228f('0x2f')](_0xc25917[_0x228f('0x30')]);if(_0xc25917['name']){delete _0xc25917[_0x228f('0x31')];}_0x2ba4f5[_0x228f('0x20')](_0x136a9e)[_0x228f('0x32')](_0xc25917);};}exports['index']=function(_0x32e0ce,_0x41be2d){var _0x5acf64={},_0x38375d={},_0x31abd0={'count':0x0,'rows':[]};var _0x45a67a=_[_0x228f('0x33')](db['VoicePrefix'][_0x228f('0x34')],function(_0x5201ba){return{'name':_0x5201ba[_0x228f('0x35')],'type':_0x5201ba[_0x228f('0x36')][_0x228f('0x37')]};});_0x38375d[_0x228f('0x38')]=_['map'](_0x45a67a,_0x228f('0x31'));_0x38375d[_0x228f('0x39')]=_['keys'](_0x32e0ce['query']);_0x38375d['filters']=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],_0x38375d[_0x228f('0x39')]);_0x5acf64[_0x228f('0x3b')]=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x3c')]));_0x5acf64['attributes']=_0x5acf64['attributes'][_0x228f('0x3d')]?_0x5acf64[_0x228f('0x3b')]:_0x38375d[_0x228f('0x38')];if(!_0x32e0ce[_0x228f('0x39')][_0x228f('0x3e')](_0x228f('0x3f'))){_0x5acf64[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x24')]);_0x5acf64['offset']=qs['offset'](_0x32e0ce[_0x228f('0x39')][_0x228f('0x23')]);}_0x5acf64[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32e0ce['query'][_0x228f('0x41')]);_0x5acf64[_0x228f('0x42')]=qs['filters'](_['pick'](_0x32e0ce[_0x228f('0x39')],_0x38375d[_0x228f('0x43')]),_0x45a67a);if(_0x32e0ce['query'][_0x228f('0x44')]){_0x5acf64[_0x228f('0x42')]=_['merge'](_0x5acf64['where'],{'$or':_[_0x228f('0x33')](_0x45a67a,function(_0x5838e6){if(_0x5838e6[_0x228f('0x36')]!==_0x228f('0x45')){var _0x3da118={};_0x3da118[_0x5838e6[_0x228f('0x31')]]={'$like':'%'+_0x32e0ce[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0x3da118;}})});}_0x5acf64=_['merge']({},_0x5acf64,_0x32e0ce[_0x228f('0x46')]);var _0x5cdd16={'where':_0x5acf64[_0x228f('0x42')]};return db[_0x228f('0x47')][_0x228f('0x25')](_0x5cdd16)[_0x228f('0x2b')](function(_0x41cba5){_0x31abd0[_0x228f('0x25')]=_0x41cba5;if(_0x32e0ce[_0x228f('0x39')][_0x228f('0x48')]){_0x5acf64[_0x228f('0x49')]=[{'all':!![]}];}return db[_0x228f('0x47')][_0x228f('0x4a')](_0x5acf64);})[_0x228f('0x2b')](function(_0x19839d){_0x31abd0['rows']=_0x19839d;return _0x31abd0;})['then'](respondWithFilteredResult(_0x41be2d,_0x5acf64))[_0x228f('0x4b')](handleError(_0x41be2d,null));};exports[_0x228f('0x4c')]=function(_0x34cd3c,_0xbfa169){var _0x2f2b47={'raw':![],'where':{'id':_0x34cd3c[_0x228f('0x4d')]['id']}},_0x334fb1={};_0x334fb1[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x47')]['rawAttributes']);_0x334fb1[_0x228f('0x39')]=_[_0x228f('0x4e')](_0x34cd3c['query']);_0x334fb1[_0x228f('0x43')]=_['intersection'](_0x334fb1[_0x228f('0x38')],_0x334fb1['query']);_0x2f2b47[_0x228f('0x3b')]=_['intersection'](_0x334fb1[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x34cd3c[_0x228f('0x39')][_0x228f('0x3c')]));_0x2f2b47[_0x228f('0x3b')]=_0x2f2b47[_0x228f('0x3b')][_0x228f('0x3d')]?_0x2f2b47[_0x228f('0x3b')]:_0x334fb1[_0x228f('0x38')];if(_0x34cd3c[_0x228f('0x39')][_0x228f('0x48')]){_0x2f2b47[_0x228f('0x49')]=[{'all':!![]}];}_0x2f2b47=_[_0x228f('0x4f')]({},_0x2f2b47,_0x34cd3c[_0x228f('0x46')]);return db[_0x228f('0x47')][_0x228f('0x50')](_0x2f2b47)[_0x228f('0x2b')](handleEntityNotFound(_0xbfa169,null))[_0x228f('0x2b')](respondWithResult(_0xbfa169,null))[_0x228f('0x4b')](handleError(_0xbfa169,null));};exports['destroy']=function(_0x47cb21,_0xa538ce){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x47cb21['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0xa538ce,null))[_0x228f('0x2b')](removeEntity(_0xa538ce,null))[_0x228f('0x4b')](handleError(_0xa538ce,null));};exports['describe']=function(_0x559490,_0x51db80){return db[_0x228f('0x47')][_0x228f('0x51')]()[_0x228f('0x2b')](respondWithResult(_0x51db80,null))[_0x228f('0x4b')](handleError(_0x51db80,null));};exports[_0x228f('0x52')]=function(_0x292c39,_0xafd0e4){var _0x30ff69;return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x43bbd2){return db[_0x228f('0x47')]['create'](_0x292c39[_0x228f('0x55')],{'transaction':_0x43bbd2})[_0x228f('0x2b')](function(_0x472035){_0x30ff69=_0x472035[_0x228f('0x2c')]({'plain':!![]});return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x30ff69[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x4feefb){return createVoicePrefixExtensions(_0x30ff69,_0x4feefb,_0x43bbd2);});});})[_0x228f('0x2b')](function(){var _0x1c6114=_0x292c39[_0x228f('0x58')][_0x228f('0x2c')]({'plain':!![]});if(!_0x1c6114)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6114[_0x228f('0x59')]===_0x228f('0x58')){var _0x4b516e=_0x30ff69;return db[_0x228f('0x5a')][_0x228f('0x50')]({'where':{'name':_0x228f('0x5b'),'userProfileId':_0x1c6114[_0x228f('0x5c')]},'raw':!![]})[_0x228f('0x2b')](function(_0x9d7417){if(_0x9d7417&&_0x9d7417[_0x228f('0x5d')]===0x0){return db[_0x228f('0x2d')][_0x228f('0x52')]({'name':_0x4b516e[_0x228f('0x31')],'resourceId':_0x4b516e['id'],'type':_0x9d7417['name'],'sectionId':_0x9d7417['id']},{})[_0x228f('0x2b')](function(){return _0x30ff69;});}else{return _0x30ff69;}})['catch'](function(_0x331b33){logger[_0x228f('0x2f')](_0x228f('0x5e'),_0x331b33);throw _0x331b33;});}return _0x30ff69;})[_0x228f('0x2b')](respondWithResult(_0xafd0e4,null))[_0x228f('0x4b')](handleError(_0xafd0e4,null));};function Extension(_0x2860dc,_0x1c8be4,_0xadb0e6,_0x56d70f){this[_0x228f('0x5f')]=_0x228f('0x60');this[_0x228f('0x61')]=_0x2860dc;this['app']=_0xadb0e6;this[_0x228f('0x36')]='system';this[_0x228f('0x62')]=_0x228f('0x63');this['priority']=_0x1c8be4;this[_0x228f('0x64')]=_0x56d70f;}function createVoicePrefixExtensions(_0x26fe6b,_0x16318d,_0xb8200d){return new BPromise(function(_0x3a0454,_0x651060){var _0x11b481=new Extension(formatPrefixName(_0x26fe6b[_0x228f('0x65')]),0x1,_0x228f('0x66'),_0x228f('0x67'));_0x11b481[_0x228f('0x68')]=_0x26fe6b['id'];return db['VoiceExtension'][_0x228f('0x52')](_0x11b481,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x1d4203){var _0x3be1f3=_0x1d4203[_0x228f('0x2c')]({'plain':!![]});var _0x506191=_['map'](addVoicePrefixExtensions(_0x26fe6b,_0x16318d),function(_0x14a732){_0x14a732['VoiceExtensionId']=_0x3be1f3['id'];_0x14a732[_0x228f('0x68')]=_0x26fe6b['id'];return _0x14a732;});return db['VoiceExtension'][_0x228f('0x69')](_0x506191,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x53a6a5){if(!_0x53a6a5){return _0x651060(_0x228f('0x6a'));}else{return _0x3a0454(_0x53a6a5);}})[_0x228f('0x4b')](function(_0x120ae1){return _0x651060(_0x120ae1);});});;});};function addVoicePrefixExtensions(_0x392270,_0x5f0b95){var _0x42dd54=[];var _0x21f860=formatPrefixName(_0x392270[_0x228f('0x65')]);_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x2,_0x228f('0x6c'),_0x228f('0x6d')+_0x392270[_0x228f('0x31')]));if(_0x392270[_0x228f('0x6e')]){_0x42dd54['push'](new Extension(_0x21f860,0x3,_0x228f('0x6c'),_0x228f('0x6f')+_0x392270[_0x228f('0x6e')]));}else{_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x3,_0x228f('0x66'),'No\x20callerid\x20available'));}_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x4,'goto',_0x5f0b95[_0x228f('0x5f')]+','+_0x228f('0x70')+(0x8+_0x392270['name'][_0x228f('0x3d')])+'}'+','+0x1));return _0x42dd54;}function formatPrefixName(_0x11a657){var _0x260e70='_';for(var _0x5eb9ed=0x0;_0x5eb9ed<_0x11a657[_0x228f('0x3d')];_0x5eb9ed++){if(_0x11a657[_0x228f('0x71')](_0x5eb9ed)=='-'){_0x260e70+=_0x11a657[_0x228f('0x71')](_0x5eb9ed);}else{_0x260e70+='['+_0x11a657[_0x228f('0x71')](_0x5eb9ed)+']';}}_0x260e70+='.';return _0x260e70;}exports[_0x228f('0x72')]=function(_0x5990e9,_0x221b3,_0x187f84){var _0x5718e1=_0x5990e9['body'];_0x5718e1[_0x228f('0x65')]=_0x228f('0x73')+_0x5718e1[_0x228f('0x31')]+'-';return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x1162ca){return db[_0x228f('0x47')][_0x228f('0x72')](_0x5718e1,{'where':{'id':_0x5718e1['id']},'transaction':_0x1162ca})['then'](function(){return db[_0x228f('0x56')]['destroy']({'where':{'VoicePrefixId':_0x5718e1['id']},'transaction':_0x1162ca})[_0x228f('0x2b')](function(){return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x5718e1[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x32a32e){return createVoicePrefixExtensions(_0x5718e1,_0x32a32e,_0x1162ca);});});});})[_0x228f('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5718e1['id']);})[_0x228f('0x2b')](respondWithResult(_0x221b3,null))[_0x228f('0x4b')](handleError(_0x221b3,null));};exports[_0x228f('0x74')]=function(_0x16776b,_0x6854c1,_0x29446b){return db['VoicePrefix'][_0x228f('0x50')]({'where':{'id':_0x16776b[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x6854c1,null))[_0x228f('0x2b')](function(_0x3fa413){if(_0x3fa413){return _0x3fa413[_0x228f('0x74')](_0x16776b[_0x228f('0x55')][_0x228f('0x75')],_[_0x228f('0x76')](_0x16776b['body'],[_0x228f('0x75'),'id'])||{})[_0x228f('0x77')](function(_0x47fe2b){for(var _0x1abf6d=0x0;_0x1abf6d<_0x16776b[_0x228f('0x55')]['ids']['length'];_0x1abf6d+=0x1){socket['emit'](_0x228f('0x78'),{'UserId':Number(_0x16776b['body'][_0x228f('0x75')][_0x1abf6d]),'VoicePrefixId':Number(_0x16776b['params']['id'])});}return _0x47fe2b;});}})[_0x228f('0x2b')](respondWithResult(_0x6854c1,null))[_0x228f('0x4b')](handleError(_0x6854c1,null));};exports['removeAgents']=function(_0x27ffdd,_0x16430e,_0x2dadc9){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x27ffdd['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x16430e,null))[_0x228f('0x2b')](function(_0xa33189){if(_0xa33189){return _0xa33189[_0x228f('0x79')](_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')])[_0x228f('0x2b')](function(){if(_[_0x228f('0x7a')](_0x27ffdd[_0x228f('0x39')]['ids'])){for(var _0x74fe35=0x0;_0x74fe35<_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]['length'];_0x74fe35+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')]['ids'][_0x74fe35]),'VoicePrefixId':Number(_0x27ffdd[_0x228f('0x4d')]['id'])});}}else{socket[_0x228f('0x7b')]('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]),'VoicePrefixId':Number(_0x27ffdd['params']['id'])});}});}})[_0x228f('0x2b')](respondWithStatusCode(_0x16430e,null))[_0x228f('0x4b')](handleError(_0x16430e,null));};exports[_0x228f('0x7c')]=function(_0x32ea8d,_0x5b29d3,_0x268e71){var _0x3418b2={};var _0x2240de={};var _0x20f029;var _0x37ab8a;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x32ea8d[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5b29d3,null))['then'](function(_0x257aa6){if(_0x257aa6){_0x20f029=_0x257aa6;_0x2240de[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x7e')][_0x228f('0x34')]);_0x2240de['query']=_['keys'](_0x32ea8d[_0x228f('0x39')]);_0x2240de['filters']=_[_0x228f('0x3a')](_0x2240de['model'],_0x2240de[_0x228f('0x39')]);_0x3418b2['attributes']=_[_0x228f('0x3a')](_0x2240de[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x3c')]));_0x3418b2[_0x228f('0x3b')]=_0x3418b2[_0x228f('0x3b')][_0x228f('0x3d')]?_0x3418b2[_0x228f('0x3b')]:_0x2240de[_0x228f('0x38')];_0x3418b2[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x41')]);_0x3418b2[_0x228f('0x42')]=qs[_0x228f('0x43')](_['pick'](_0x32ea8d[_0x228f('0x39')],_0x2240de[_0x228f('0x43')]));if(_0x32ea8d[_0x228f('0x39')]['filter']){_0x3418b2[_0x228f('0x42')]=_['merge'](_0x3418b2['where'],{'$or':_['map'](_0x3418b2[_0x228f('0x3b')],function(_0x50ed6a){var _0x22448b={};_0x22448b[_0x50ed6a]={'$like':'%'+_0x32ea8d[_0x228f('0x39')]['filter']+'%'};return _0x22448b;})});}_0x3418b2=_[_0x228f('0x4f')]({},_0x3418b2,_0x32ea8d[_0x228f('0x46')]);return _0x20f029['getAgents'](_0x3418b2);}})[_0x228f('0x2b')](function(_0x620f5a){if(_0x620f5a){_0x37ab8a=_0x620f5a['length'];if(!_0x32ea8d['query'][_0x228f('0x3e')](_0x228f('0x3f'))){_0x3418b2[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32ea8d['query'][_0x228f('0x24')]);_0x3418b2[_0x228f('0x23')]=qs['offset'](_0x32ea8d[_0x228f('0x39')][_0x228f('0x23')]);}return _0x20f029[_0x228f('0x7c')](_0x3418b2);}})[_0x228f('0x2b')](function(_0x39aa20){if(_0x39aa20){return _0x39aa20?{'count':_0x37ab8a,'rows':_0x39aa20}:null;}})[_0x228f('0x2b')](respondWithResult(_0x5b29d3,null))[_0x228f('0x4b')](handleError(_0x5b29d3,null));};exports[_0x228f('0x7f')]=function(_0x5a1a8c,_0x5a7f73,_0x597271){var _0x548882={};var _0x47eba6={};var _0x5ac69a;var _0x182858;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x5a1a8c[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5a7f73,null))[_0x228f('0x2b')](function(_0x35aa2c){if(_0x35aa2c){_0x5ac69a=_0x35aa2c;_0x47eba6['model']=_[_0x228f('0x4e')](db['Team']['rawAttributes']);_0x47eba6['query']=_['keys'](_0x5a1a8c[_0x228f('0x39')]);_0x47eba6['filters']=_[_0x228f('0x3a')](_0x47eba6[_0x228f('0x38')],_0x47eba6[_0x228f('0x39')]);_0x548882[_0x228f('0x3b')]=_['intersection'](_0x47eba6[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x3c')]));_0x548882[_0x228f('0x3b')]=_0x548882[_0x228f('0x3b')][_0x228f('0x3d')]?_0x548882[_0x228f('0x3b')]:_0x47eba6[_0x228f('0x38')];_0x548882[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x5a1a8c['query']['sort']);_0x548882['where']=qs[_0x228f('0x43')](_[_0x228f('0x80')](_0x5a1a8c[_0x228f('0x39')],_0x47eba6[_0x228f('0x43')]));if(_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]){_0x548882[_0x228f('0x42')]=_[_0x228f('0x4f')](_0x548882['where'],{'$or':_[_0x228f('0x33')](_0x548882[_0x228f('0x3b')],function(_0x433c1f){var _0xea049c={};_0xea049c[_0x433c1f]={'$like':'%'+_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0xea049c;})});}_0x548882=_[_0x228f('0x4f')]({},_0x548882,_0x5a1a8c[_0x228f('0x46')]);return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})['then'](function(_0x2db468){if(_0x2db468){_0x182858=_0x2db468[_0x228f('0x3d')];if(!_0x5a1a8c[_0x228f('0x39')]['hasOwnProperty']('nolimit')){_0x548882[_0x228f('0x24')]=qs['limit'](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x24')]);_0x548882[_0x228f('0x23')]=qs[_0x228f('0x23')](_0x5a1a8c['query'][_0x228f('0x23')]);}return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})[_0x228f('0x2b')](function(_0x237b92){if(_0x237b92){return _0x237b92?{'count':_0x182858,'rows':_0x237b92}:null;}})['then'](respondWithResult(_0x5a7f73,null))['catch'](handleError(_0x5a7f73,null));};exports[_0x228f('0x81')]=function(_0x578762,_0x19e488,_0x48c6ee){var _0x59b34c=_0x578762['body'][_0x228f('0x75')];var _0x4865e5;return db[_0x228f('0x82')][_0x228f('0x4a')]({'where':{'id':_0x59b34c},'attributes':['id'],'include':[{'model':db[_0x228f('0x7e')],'as':_0x228f('0x83'),'attributes':['id',_0x228f('0x31'),_0x228f('0x84'),_0x228f('0x85'),_0x228f('0x86')],'raw':!![]}]})[_0x228f('0x2b')](function(_0x1e8511){if(_0x1e8511){_0x4865e5=_0x1e8511;var _0x35363e=_[_0x228f('0x87')](_0x1e8511,function(_0x2f8379){var _0x38fca3=_0x2f8379[_0x228f('0x2c')]({'plain':!![]});return _0x38fca3[_0x228f('0x83')];});return db[_0x228f('0x47')]['find']({'where':{'id':_0x578762[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](function(_0x553895){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x3a2c9c){return _0x553895[_0x228f('0x81')](_0x59b34c,{'transaction':_0x3a2c9c})['then'](function(){return BPromise[_0x228f('0x88')](_0x4865e5,function(_0x38da32){return db[_0x228f('0x89')][_0x228f('0x8a')]({'TeamId':_0x38da32['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},{'transaction':_0x3a2c9c});});})['then'](function(){return BPromise['each'](_0x35363e,function(_0x25f726){return db[_0x228f('0x8b')]['findOrCreate']({'where':{'UserId':_0x25f726['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},'transaction':_0x3a2c9c});});})[_0x228f('0x2b')](function(){_0x35363e[_0x228f('0x8c')](function(_0x525439){socket[_0x228f('0x7b')](_0x228f('0x78'),{'UserId':_0x525439['id'],'VoicePrefixId':_0x553895['id']});});});});});}})['then'](respondWithStatusCode(_0x19e488,null))[_0x228f('0x4b')](handleError(_0x19e488,null));};exports['removeTeams']=function(_0x29201c,_0x207d64,_0xff507b){return db[_0x228f('0x82')]['findAll']({'where':{'id':_0x29201c['query'][_0x228f('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x228f('0x83'),'attributes':['id'],'raw':!![]}]})[_0x228f('0x2b')](handleEntityNotFound(_0x207d64,null))[_0x228f('0x2b')](function(_0x16ebcf){var _0x21efb1=_['map'](_0x16ebcf,'id');var _0x3526b0=[];var _0x45da1f=[];var _0x69a9a5=squel['select']();_0x69a9a5[_0x228f('0x8d')]('tq.TeamId')[_0x228f('0x8e')](_0x228f('0x8f'),'tq')['join'](_0x228f('0x90'),'ut',_0x228f('0x91'))[_0x228f('0x42')](_0x228f('0x92'),_0x29201c['params']['id']);for(var _0x2b6a34=0x0;_0x2b6a34<_0x16ebcf[_0x228f('0x3d')];_0x2b6a34+=0x1){let _0x13ba88=_0x16ebcf[_0x2b6a34];for(var _0x106451=0x0;_0x106451<_0x13ba88[_0x228f('0x83')][_0x228f('0x3d')];_0x106451+=0x1){let _0x57b1d6=_0x13ba88[_0x228f('0x83')][_0x106451];var _0x22b0ff=_0x69a9a5[_0x228f('0x93')]();_0x22b0ff[_0x228f('0x42')](_0x228f('0x94'),_0x57b1d6['id']);_0x45da1f[_0x228f('0x6b')](db[_0x228f('0x53')]['query'](_0x22b0ff['toString'](),{'type':db[_0x228f('0x53')][_0x228f('0x95')][_0x228f('0x96')]})['then'](function(_0x348662){if(_0x348662[_0x228f('0x3d')]===0x1){return _0x57b1d6['id'];}else{var _0x3c83e1=_[_0x228f('0x97')](_[_0x228f('0x33')](_0x348662,_0x228f('0x98')),function(_0x437b8b){return _[_0x228f('0x99')](_0x21efb1,_0x437b8b);});if(_0x3c83e1){return _0x57b1d6['id'];}}}));}}return BPromise['all'](_0x45da1f)[_0x228f('0x2b')](function(_0x56d3ee){_0x3526b0=_(_0x3526b0)[_0x228f('0x9a')](_0x56d3ee)['compact']()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x29201c['params']['id']}})[_0x228f('0x2b')](function(_0x24a8ae){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x298c83){return _0x24a8ae[_0x228f('0x9b')](_0x29201c[_0x228f('0x39')][_0x228f('0x75')],{'transaction':_0x298c83})[_0x228f('0x2b')](function(){if(!_['isEmpty'](_0x3526b0)){return _0x24a8ae[_0x228f('0x79')](_0x3526b0,{'transaction':_0x298c83});}})['then'](function(){_0x3526b0[_0x228f('0x8c')](function(_0x5830f7){socket['emit'](_0x228f('0x9c'),{'UserId':_0x5830f7,'VoicePrefixId':_0x24a8ae['id']});});});});});});})[_0x228f('0x2b')](respondWithStatusCode(_0x207d64,null))[_0x228f('0x4b')](handleError(_0x207d64,null));}; \ No newline at end of file +var _0xab40=['PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','omit','body','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','findAll','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','error','stack','name','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','catch','params','length','find','describe','create','sequelize','transaction','get','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','system','description','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll'];(function(_0x591aad,_0x56227c){var _0x377bd1=function(_0x4aec2){while(--_0x4aec2){_0x591aad['push'](_0x591aad['shift']());}};_0x377bd1(++_0x56227c);}(_0xab40,0xcd));var _0x0ab4=function(_0x4c8f2d,_0x2e23a2){_0x4c8f2d=_0x4c8f2d-0x0;var _0xa09776=_0xab40[_0x4c8f2d];return _0xa09776;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];config[_0x0ab4('0x15')]=_[_0x0ab4('0x16')](config[_0x0ab4('0x15')],{'host':_0x0ab4('0x17'),'port':0x18eb});var socket=require(_0x0ab4('0x18'))(new Redis(config[_0x0ab4('0x15')]));require(_0x0ab4('0x19'))[_0x0ab4('0x1a')](socket);function respondWithStatusCode(_0x3cb1df,_0x2033c8){_0x2033c8=_0x2033c8||0xcc;return function(_0x216a17){if(_0x216a17){return _0x3cb1df[_0x0ab4('0x1b')](_0x2033c8);}return _0x3cb1df[_0x0ab4('0x1c')](_0x2033c8)[_0x0ab4('0x1d')]();};}function respondWithResult(_0x2a83a8,_0x2403db){_0x2403db=_0x2403db||0xc8;return function(_0x283b15){if(_0x283b15){return _0x2a83a8[_0x0ab4('0x1c')](_0x2403db)['json'](_0x283b15);}};}function respondWithFilteredResult(_0x5000d4,_0x49634f){return function(_0x17422f){if(_0x17422f){var _0x30d5df=typeof _0x49634f[_0x0ab4('0x1e')]==='undefined'&&typeof _0x49634f[_0x0ab4('0x1f')]===_0x0ab4('0x20');var _0x212ebd=_0x17422f[_0x0ab4('0x21')];var _0x4e7852=_0x30d5df?0x0:_0x49634f['offset'];var _0xdb0797=_0x30d5df?_0x17422f['count']:_0x49634f[_0x0ab4('0x1e')]+_0x49634f[_0x0ab4('0x1f')];var _0x5bb1d0;if(_0xdb0797>=_0x212ebd){_0xdb0797=_0x212ebd;_0x5bb1d0=0xc8;}else{_0x5bb1d0=0xce;}_0x5000d4[_0x0ab4('0x1c')](_0x5bb1d0);return _0x5000d4[_0x0ab4('0x22')](_0x0ab4('0x23'),_0x4e7852+'-'+_0xdb0797+'/'+_0x212ebd)[_0x0ab4('0x24')](_0x17422f);}return null;};}function patchUpdates(_0x12d06d){return function(_0x52d7d3){try{jsonpatch['apply'](_0x52d7d3,_0x12d06d,!![]);}catch(_0x24b929){return BPromise[_0x0ab4('0x25')](_0x24b929);}return _0x52d7d3[_0x0ab4('0x26')]();};}function saveUpdates(_0x13c882,_0x4e4b80){return function(_0x42d2dd){if(_0x42d2dd){return _0x42d2dd[_0x0ab4('0x27')](_0x13c882)[_0x0ab4('0x28')](function(_0x4ea9aa){return _0x4ea9aa;});}return null;};}function removeEntity(_0x4c5caf,_0x176ff1){return function(_0x1c132c){if(_0x1c132c){return _0x1c132c[_0x0ab4('0x29')]()['then'](function(){var _0x519b23=_0x1c132c['get']({'plain':!![]});var _0x19ecc6='VoicePrefixes';return db[_0x0ab4('0x2a')][_0x0ab4('0x29')]({'where':{'type':_0x19ecc6,'resourceId':_0x519b23['id']}})['then'](function(){return _0x1c132c;});})['then'](function(){_0x4c5caf['status'](0xcc)[_0x0ab4('0x1d')]();});}};}function handleEntityNotFound(_0x183bac,_0x1cfdad){return function(_0x3f61cb){if(!_0x3f61cb){_0x183bac[_0x0ab4('0x1b')](0x194);}return _0x3f61cb;};}function handleError(_0x588e0d,_0x5b55c1){_0x5b55c1=_0x5b55c1||0x1f4;return function(_0x580d56){logger[_0x0ab4('0x2b')](_0x580d56[_0x0ab4('0x2c')]);if(_0x580d56[_0x0ab4('0x2d')]){delete _0x580d56[_0x0ab4('0x2d')];}_0x588e0d[_0x0ab4('0x1c')](_0x5b55c1)['send'](_0x580d56);};}exports['index']=function(_0x285a29,_0xe6682){var _0x361f7c={},_0x4819be={},_0x48e430={'count':0x0,'rows':[]};var _0x1b19db=_['map'](db[_0x0ab4('0x2e')][_0x0ab4('0x2f')],function(_0x263e5a){return{'name':_0x263e5a[_0x0ab4('0x30')],'type':_0x263e5a[_0x0ab4('0x31')][_0x0ab4('0x32')]};});_0x4819be['model']=_[_0x0ab4('0x33')](_0x1b19db,_0x0ab4('0x2d'));_0x4819be[_0x0ab4('0x34')]=_[_0x0ab4('0x35')](_0x285a29['query']);_0x4819be['filters']=_[_0x0ab4('0x36')](_0x4819be[_0x0ab4('0x37')],_0x4819be[_0x0ab4('0x34')]);_0x361f7c['attributes']=_['intersection'](_0x4819be['model'],qs[_0x0ab4('0x38')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x361f7c['attributes']=_0x361f7c['attributes']['length']?_0x361f7c[_0x0ab4('0x39')]:_0x4819be[_0x0ab4('0x37')];if(!_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x361f7c[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x1f')]);_0x361f7c[_0x0ab4('0x1e')]=qs['offset'](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x1e')]);}_0x361f7c[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3d')](_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x3d')]);_0x361f7c[_0x0ab4('0x3e')]=qs[_0x0ab4('0x3f')](_[_0x0ab4('0x40')](_0x285a29[_0x0ab4('0x34')],_0x4819be[_0x0ab4('0x3f')]),_0x1b19db);if(_0x285a29[_0x0ab4('0x34')]['filter']){_0x361f7c[_0x0ab4('0x3e')]=_[_0x0ab4('0x41')](_0x361f7c[_0x0ab4('0x3e')],{'$or':_[_0x0ab4('0x33')](_0x1b19db,function(_0x589b46){if(_0x589b46[_0x0ab4('0x31')]!=='VIRTUAL'){var _0x43e5ba={};_0x43e5ba[_0x589b46[_0x0ab4('0x2d')]]={'$like':'%'+_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x42')]+'%'};return _0x43e5ba;}})});}_0x361f7c=_[_0x0ab4('0x41')]({},_0x361f7c,_0x285a29[_0x0ab4('0x43')]);var _0x5815d1={'where':_0x361f7c[_0x0ab4('0x3e')]};return db[_0x0ab4('0x2e')][_0x0ab4('0x21')](_0x5815d1)['then'](function(_0x395e0b){_0x48e430[_0x0ab4('0x21')]=_0x395e0b;if(_0x285a29[_0x0ab4('0x34')][_0x0ab4('0x44')]){_0x361f7c[_0x0ab4('0x45')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x361f7c);})['then'](function(_0x2f54dd){_0x48e430[_0x0ab4('0x46')]=_0x2f54dd;return _0x48e430;})['then'](respondWithFilteredResult(_0xe6682,_0x361f7c))[_0x0ab4('0x47')](handleError(_0xe6682,null));};exports['show']=function(_0x2d1d87,_0x562262){var _0x365be1={'raw':![],'where':{'id':_0x2d1d87[_0x0ab4('0x48')]['id']}},_0x300fd8={};_0x300fd8[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x2e')]['rawAttributes']);_0x300fd8[_0x0ab4('0x34')]=_[_0x0ab4('0x35')](_0x2d1d87[_0x0ab4('0x34')]);_0x300fd8[_0x0ab4('0x3f')]=_[_0x0ab4('0x36')](_0x300fd8[_0x0ab4('0x37')],_0x300fd8['query']);_0x365be1[_0x0ab4('0x39')]=_['intersection'](_0x300fd8[_0x0ab4('0x37')],qs[_0x0ab4('0x38')](_0x2d1d87[_0x0ab4('0x34')]['fields']));_0x365be1[_0x0ab4('0x39')]=_0x365be1[_0x0ab4('0x39')][_0x0ab4('0x49')]?_0x365be1[_0x0ab4('0x39')]:_0x300fd8[_0x0ab4('0x37')];if(_0x2d1d87[_0x0ab4('0x34')]['includeAll']){_0x365be1[_0x0ab4('0x45')]=[{'all':!![]}];}_0x365be1=_[_0x0ab4('0x41')]({},_0x365be1,_0x2d1d87[_0x0ab4('0x43')]);return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')](_0x365be1)[_0x0ab4('0x28')](handleEntityNotFound(_0x562262,null))[_0x0ab4('0x28')](respondWithResult(_0x562262,null))[_0x0ab4('0x47')](handleError(_0x562262,null));};exports[_0x0ab4('0x29')]=function(_0x24bb13,_0x1a9675){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x24bb13['params']['id']}})[_0x0ab4('0x28')](handleEntityNotFound(_0x1a9675,null))[_0x0ab4('0x28')](removeEntity(_0x1a9675,null))['catch'](handleError(_0x1a9675,null));};exports[_0x0ab4('0x4b')]=function(_0x48efa4,_0x53d66f){return db[_0x0ab4('0x2e')][_0x0ab4('0x4b')]()[_0x0ab4('0x28')](respondWithResult(_0x53d66f,null))['catch'](handleError(_0x53d66f,null));};exports[_0x0ab4('0x4c')]=function(_0xb3bd1e,_0xeddaa1){var _0xaed2d;return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0x1eea3b){return db['VoicePrefix'][_0x0ab4('0x4c')](_0xb3bd1e['body'],{'transaction':_0x1eea3b})[_0x0ab4('0x28')](function(_0x55c073){_0xaed2d=_0x55c073[_0x0ab4('0x4f')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xaed2d[_0x0ab4('0x50')]},'raw':!![]})[_0x0ab4('0x28')](function(_0x433346){return createVoicePrefixExtensions(_0xaed2d,_0x433346,_0x1eea3b);});});})[_0x0ab4('0x28')](function(){var _0x4e2db5=_0xb3bd1e[_0x0ab4('0x51')][_0x0ab4('0x4f')]({'plain':!![]});if(!_0x4e2db5)throw new Error(_0x0ab4('0x52'));if(_0x4e2db5[_0x0ab4('0x53')]===_0x0ab4('0x51')){var _0x2354fa=_0xaed2d;return db[_0x0ab4('0x54')][_0x0ab4('0x4a')]({'where':{'name':_0x0ab4('0x55'),'userProfileId':_0x4e2db5[_0x0ab4('0x56')]},'raw':!![]})[_0x0ab4('0x28')](function(_0x355ba8){if(_0x355ba8&&_0x355ba8[_0x0ab4('0x57')]===0x0){return db[_0x0ab4('0x2a')][_0x0ab4('0x4c')]({'name':_0x2354fa[_0x0ab4('0x2d')],'resourceId':_0x2354fa['id'],'type':_0x355ba8[_0x0ab4('0x2d')],'sectionId':_0x355ba8['id']},{})[_0x0ab4('0x28')](function(){return _0xaed2d;});}else{return _0xaed2d;}})[_0x0ab4('0x47')](function(_0x59705f){logger[_0x0ab4('0x2b')](_0x0ab4('0x58'),_0x59705f);throw _0x59705f;});}return _0xaed2d;})[_0x0ab4('0x28')](respondWithResult(_0xeddaa1,null))[_0x0ab4('0x47')](handleError(_0xeddaa1,null));};function Extension(_0x32e38c,_0x3bcb90,_0x387619,_0x251e4d){this['context']=_0x0ab4('0x59');this[_0x0ab4('0x5a')]=_0x32e38c;this['app']=_0x387619;this['type']=_0x0ab4('0x5b');this[_0x0ab4('0x5c')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3bcb90;this[_0x0ab4('0x5d')]=_0x251e4d;}function createVoicePrefixExtensions(_0x5b4bbe,_0x597d26,_0x427b51){return new BPromise(function(_0x3cdedf,_0x12dccd){var _0x42cbcb=new Extension(formatPrefixName(_0x5b4bbe[_0x0ab4('0x5e')]),0x1,_0x0ab4('0x5f'),_0x0ab4('0x60'));_0x42cbcb['VoicePrefixId']=_0x5b4bbe['id'];return db[_0x0ab4('0x61')][_0x0ab4('0x4c')](_0x42cbcb,{'transaction':_0x427b51})[_0x0ab4('0x28')](function(_0x406df2){var _0x194733=_0x406df2[_0x0ab4('0x4f')]({'plain':!![]});var _0x4f1847=_[_0x0ab4('0x33')](addVoicePrefixExtensions(_0x5b4bbe,_0x597d26),function(_0x1b7925){_0x1b7925['VoiceExtensionId']=_0x194733['id'];_0x1b7925[_0x0ab4('0x62')]=_0x5b4bbe['id'];return _0x1b7925;});return db['VoiceExtension'][_0x0ab4('0x63')](_0x4f1847,{'transaction':_0x427b51})['then'](function(_0x268b23){if(!_0x268b23){return _0x12dccd(_0x0ab4('0x64'));}else{return _0x3cdedf(_0x268b23);}})[_0x0ab4('0x47')](function(_0x2e728f){return _0x12dccd(_0x2e728f);});});;});};function addVoicePrefixExtensions(_0x509611,_0x581547){var _0x10dd5b=[];var _0x4477ba=formatPrefixName(_0x509611['prefix']);_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x2,_0x0ab4('0x66'),_0x0ab4('0x67')+_0x509611['name']));if(_0x509611[_0x0ab4('0x68')]){_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x3,_0x0ab4('0x66'),_0x0ab4('0x69')+_0x509611[_0x0ab4('0x68')]));}else{_0x10dd5b[_0x0ab4('0x65')](new Extension(_0x4477ba,0x3,_0x0ab4('0x5f'),_0x0ab4('0x6a')));}_0x10dd5b['push'](new Extension(_0x4477ba,0x4,'goto',_0x581547[_0x0ab4('0x6b')]+','+_0x0ab4('0x6c')+(0x8+_0x509611[_0x0ab4('0x2d')][_0x0ab4('0x49')])+'}'+','+0x1));return _0x10dd5b;}function formatPrefixName(_0x58c611){var _0x417926='_';for(var _0x5256d4=0x0;_0x5256d4<_0x58c611[_0x0ab4('0x49')];_0x5256d4++){if(_0x58c611[_0x0ab4('0x6d')](_0x5256d4)=='-'){_0x417926+=_0x58c611[_0x0ab4('0x6d')](_0x5256d4);}else{_0x417926+='['+_0x58c611[_0x0ab4('0x6d')](_0x5256d4)+']';}}_0x417926+='.';return _0x417926;}exports[_0x0ab4('0x27')]=function(_0x41b65f,_0x46a008,_0xf42b98){var _0x29cf79=_0x41b65f['body'];_0x29cf79[_0x0ab4('0x5e')]='system-'+_0x29cf79[_0x0ab4('0x2d')]+'-';return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0x1481b2){return db[_0x0ab4('0x2e')][_0x0ab4('0x27')](_0x29cf79,{'where':{'id':_0x29cf79['id']},'transaction':_0x1481b2})[_0x0ab4('0x28')](function(){return db[_0x0ab4('0x61')][_0x0ab4('0x29')]({'where':{'VoicePrefixId':_0x29cf79['id']},'transaction':_0x1481b2})['then'](function(){return db[_0x0ab4('0x61')][_0x0ab4('0x4a')]({'where':{'id':_0x29cf79['VoiceExtensionId']},'raw':!![]})[_0x0ab4('0x28')](function(_0x2d4921){return createVoicePrefixExtensions(_0x29cf79,_0x2d4921,_0x1481b2);});});});})[_0x0ab4('0x28')](function(){return db['VoicePrefix'][_0x0ab4('0x6e')](_0x29cf79['id']);})[_0x0ab4('0x28')](respondWithResult(_0x46a008,null))[_0x0ab4('0x47')](handleError(_0x46a008,null));};exports[_0x0ab4('0x6f')]=function(_0x531a07,_0x5bf57e,_0x398b3e){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x531a07[_0x0ab4('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bf57e,null))[_0x0ab4('0x28')](function(_0xa0f095){if(_0xa0f095){return _0xa0f095[_0x0ab4('0x6f')](_0x531a07['body']['ids'],_[_0x0ab4('0x70')](_0x531a07[_0x0ab4('0x71')],[_0x0ab4('0x72'),'id'])||{})[_0x0ab4('0x73')](function(_0x46f69a){for(var _0x1c8965=0x0;_0x1c8965<_0x531a07[_0x0ab4('0x71')]['ids'][_0x0ab4('0x49')];_0x1c8965+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x531a07[_0x0ab4('0x71')]['ids'][_0x1c8965]),'VoicePrefixId':Number(_0x531a07[_0x0ab4('0x48')]['id'])});}return _0x46f69a;});}})[_0x0ab4('0x28')](respondWithResult(_0x5bf57e,null))[_0x0ab4('0x47')](handleError(_0x5bf57e,null));};exports[_0x0ab4('0x74')]=function(_0x1eec8e,_0x4bffd4,_0x586bd6){return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x1eec8e['params']['id']}})['then'](handleEntityNotFound(_0x4bffd4,null))[_0x0ab4('0x28')](function(_0x3e3ded){if(_0x3e3ded){return _0x3e3ded['removeAgents'](_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')])[_0x0ab4('0x28')](function(){if(_['isArray'](_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')])){for(var _0x2033fc=0x0;_0x2033fc<_0x1eec8e[_0x0ab4('0x34')]['ids'][_0x0ab4('0x49')];_0x2033fc+=0x1){socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':Number(_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')][_0x2033fc]),'VoicePrefixId':Number(_0x1eec8e[_0x0ab4('0x48')]['id'])});}}else{socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':Number(_0x1eec8e[_0x0ab4('0x34')][_0x0ab4('0x72')]),'VoicePrefixId':Number(_0x1eec8e['params']['id'])});}});}})[_0x0ab4('0x28')](respondWithStatusCode(_0x4bffd4,null))[_0x0ab4('0x47')](handleError(_0x4bffd4,null));};exports[_0x0ab4('0x77')]=function(_0x78c98e,_0xb803f2,_0x5adfaa){var _0x448fcb={};var _0x88676f={};var _0xd916e0;var _0x28a722;return db[_0x0ab4('0x2e')][_0x0ab4('0x78')]({'where':{'id':_0x78c98e[_0x0ab4('0x48')]['id']}})[_0x0ab4('0x28')](handleEntityNotFound(_0xb803f2,null))[_0x0ab4('0x28')](function(_0x23968d){if(_0x23968d){_0xd916e0=_0x23968d;_0x88676f[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x79')][_0x0ab4('0x2f')]);_0x88676f['query']=_[_0x0ab4('0x35')](_0x78c98e[_0x0ab4('0x34')]);_0x88676f[_0x0ab4('0x3f')]=_[_0x0ab4('0x36')](_0x88676f['model'],_0x88676f['query']);_0x448fcb[_0x0ab4('0x39')]=_[_0x0ab4('0x36')](_0x88676f['model'],qs[_0x0ab4('0x38')](_0x78c98e[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x448fcb[_0x0ab4('0x39')]=_0x448fcb[_0x0ab4('0x39')][_0x0ab4('0x49')]?_0x448fcb[_0x0ab4('0x39')]:_0x88676f['model'];_0x448fcb[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3d')](_0x78c98e[_0x0ab4('0x34')][_0x0ab4('0x3d')]);_0x448fcb[_0x0ab4('0x3e')]=qs[_0x0ab4('0x3f')](_[_0x0ab4('0x40')](_0x78c98e[_0x0ab4('0x34')],_0x88676f[_0x0ab4('0x3f')]));if(_0x78c98e['query'][_0x0ab4('0x42')]){_0x448fcb['where']=_[_0x0ab4('0x41')](_0x448fcb[_0x0ab4('0x3e')],{'$or':_[_0x0ab4('0x33')](_0x448fcb[_0x0ab4('0x39')],function(_0x12ee59){var _0x76fa2={};_0x76fa2[_0x12ee59]={'$like':'%'+_0x78c98e['query']['filter']+'%'};return _0x76fa2;})});}_0x448fcb=_[_0x0ab4('0x41')]({},_0x448fcb,_0x78c98e[_0x0ab4('0x43')]);return _0xd916e0['getAgents'](_0x448fcb);}})['then'](function(_0x21f0a2){if(_0x21f0a2){_0x28a722=_0x21f0a2[_0x0ab4('0x49')];if(!_0x78c98e['query'][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x448fcb[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x78c98e['query'][_0x0ab4('0x1f')]);_0x448fcb['offset']=qs['offset'](_0x78c98e[_0x0ab4('0x34')]['offset']);}return _0xd916e0[_0x0ab4('0x77')](_0x448fcb);}})[_0x0ab4('0x28')](function(_0xb1cac2){if(_0xb1cac2){return _0xb1cac2?{'count':_0x28a722,'rows':_0xb1cac2}:null;}})['then'](respondWithResult(_0xb803f2,null))[_0x0ab4('0x47')](handleError(_0xb803f2,null));};exports[_0x0ab4('0x7a')]=function(_0x840fc2,_0x2282d7,_0x2bf00c){var _0x37a592={};var _0x171969={};var _0x51f02a;var _0x2a25d5;return db['VoicePrefix'][_0x0ab4('0x78')]({'where':{'id':_0x840fc2['params']['id']}})['then'](handleEntityNotFound(_0x2282d7,null))[_0x0ab4('0x28')](function(_0x7ae8b2){if(_0x7ae8b2){_0x51f02a=_0x7ae8b2;_0x171969[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](db[_0x0ab4('0x7b')]['rawAttributes']);_0x171969['query']=_[_0x0ab4('0x35')](_0x840fc2[_0x0ab4('0x34')]);_0x171969['filters']=_[_0x0ab4('0x36')](_0x171969['model'],_0x171969[_0x0ab4('0x34')]);_0x37a592[_0x0ab4('0x39')]=_['intersection'](_0x171969[_0x0ab4('0x37')],qs[_0x0ab4('0x38')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x38')]));_0x37a592['attributes']=_0x37a592['attributes'][_0x0ab4('0x49')]?_0x37a592[_0x0ab4('0x39')]:_0x171969[_0x0ab4('0x37')];_0x37a592['order']=qs[_0x0ab4('0x3d')](_0x840fc2['query'][_0x0ab4('0x3d')]);_0x37a592[_0x0ab4('0x3e')]=qs['filters'](_['pick'](_0x840fc2['query'],_0x171969[_0x0ab4('0x3f')]));if(_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x42')]){_0x37a592[_0x0ab4('0x3e')]=_[_0x0ab4('0x41')](_0x37a592['where'],{'$or':_[_0x0ab4('0x33')](_0x37a592[_0x0ab4('0x39')],function(_0x5e43fe){var _0xde4e2c={};_0xde4e2c[_0x5e43fe]={'$like':'%'+_0x840fc2[_0x0ab4('0x34')]['filter']+'%'};return _0xde4e2c;})});}_0x37a592=_[_0x0ab4('0x41')]({},_0x37a592,_0x840fc2[_0x0ab4('0x43')]);return _0x51f02a['getTeams'](_0x37a592);}})[_0x0ab4('0x28')](function(_0x213828){if(_0x213828){_0x2a25d5=_0x213828[_0x0ab4('0x49')];if(!_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x37a592[_0x0ab4('0x1f')]=qs[_0x0ab4('0x1f')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x1f')]);_0x37a592['offset']=qs[_0x0ab4('0x1e')](_0x840fc2[_0x0ab4('0x34')][_0x0ab4('0x1e')]);}return _0x51f02a[_0x0ab4('0x7a')](_0x37a592);}})[_0x0ab4('0x28')](function(_0x4a9e47){if(_0x4a9e47){return _0x4a9e47?{'count':_0x2a25d5,'rows':_0x4a9e47}:null;}})['then'](respondWithResult(_0x2282d7,null))[_0x0ab4('0x47')](handleError(_0x2282d7,null));};exports['addTeams']=function(_0x15e2f6,_0x3da0c1,_0x415e42){var _0x1effa7=_0x15e2f6['body'][_0x0ab4('0x72')];var _0x33c31a;return db[_0x0ab4('0x7b')][_0x0ab4('0x7c')]({'where':{'id':_0x1effa7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0ab4('0x7d'),'attributes':['id',_0x0ab4('0x2d'),_0x0ab4('0x7e'),_0x0ab4('0x7f'),'interface'],'raw':!![]}]})['then'](function(_0x2c6284){if(_0x2c6284){_0x33c31a=_0x2c6284;var _0x272680=_[_0x0ab4('0x80')](_0x2c6284,function(_0x4e064a){var _0x29f715=_0x4e064a['get']({'plain':!![]});return _0x29f715[_0x0ab4('0x7d')];});return db[_0x0ab4('0x2e')][_0x0ab4('0x4a')]({'where':{'id':_0x15e2f6['params']['id']}})['then'](function(_0x1d9644){return db[_0x0ab4('0x4d')][_0x0ab4('0x4e')](function(_0xa094f5){return _0x1d9644['addTeams'](_0x1effa7,{'transaction':_0xa094f5})[_0x0ab4('0x28')](function(){return BPromise[_0x0ab4('0x81')](_0x33c31a,function(_0x45d3fa){return db[_0x0ab4('0x82')][_0x0ab4('0x83')]({'TeamId':_0x45d3fa['id'],'VoicePrefixId':_0x15e2f6[_0x0ab4('0x48')]['id']},{'transaction':_0xa094f5});});})[_0x0ab4('0x28')](function(){return BPromise[_0x0ab4('0x81')](_0x272680,function(_0x1d74f9){return db[_0x0ab4('0x84')][_0x0ab4('0x85')]({'where':{'UserId':_0x1d74f9['id'],'VoicePrefixId':_0x15e2f6[_0x0ab4('0x48')]['id']},'transaction':_0xa094f5});});})[_0x0ab4('0x28')](function(){_0x272680['forEach'](function(_0x3984a2){socket[_0x0ab4('0x75')](_0x0ab4('0x86'),{'UserId':_0x3984a2['id'],'VoicePrefixId':_0x1d9644['id']});});});});});}})[_0x0ab4('0x28')](respondWithStatusCode(_0x3da0c1,null))[_0x0ab4('0x47')](handleError(_0x3da0c1,null));};exports[_0x0ab4('0x87')]=function(_0x2ad3a9,_0x29f866,_0x182dfa){return db[_0x0ab4('0x7b')][_0x0ab4('0x7c')]({'where':{'id':_0x2ad3a9['query'][_0x0ab4('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0ab4('0x79')],'as':_0x0ab4('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x0ab4('0x28')](handleEntityNotFound(_0x29f866,null))[_0x0ab4('0x28')](function(_0x50b719){var _0x2fbbec=_['map'](_0x50b719,'id');var _0x4379f1=[];var _0x175a2a=[];var _0x332b1c=squel[_0x0ab4('0x88')]();_0x332b1c[_0x0ab4('0x89')]('tq.TeamId')[_0x0ab4('0x8a')](_0x0ab4('0x8b'),'tq')[_0x0ab4('0x8c')](_0x0ab4('0x8d'),'ut',_0x0ab4('0x8e'))['where'](_0x0ab4('0x8f'),_0x2ad3a9[_0x0ab4('0x48')]['id']);for(var _0x3acf39=0x0;_0x3acf39<_0x50b719[_0x0ab4('0x49')];_0x3acf39+=0x1){let _0x28bc17=_0x50b719[_0x3acf39];for(var _0x927d5=0x0;_0x927d5<_0x28bc17[_0x0ab4('0x7d')][_0x0ab4('0x49')];_0x927d5+=0x1){let _0x43fde8=_0x28bc17[_0x0ab4('0x7d')][_0x927d5];var _0x3791e6=_0x332b1c[_0x0ab4('0x90')]();_0x3791e6[_0x0ab4('0x3e')](_0x0ab4('0x91'),_0x43fde8['id']);_0x175a2a['push'](db['sequelize']['query'](_0x3791e6['toString'](),{'type':db[_0x0ab4('0x4d')][_0x0ab4('0x92')]['SELECT']})[_0x0ab4('0x28')](function(_0x19e3f9){if(_0x19e3f9['length']===0x1){return _0x43fde8['id'];}else{var _0x58e215=_[_0x0ab4('0x93')](_['map'](_0x19e3f9,_0x0ab4('0x94')),function(_0x22fb42){return _['includes'](_0x2fbbec,_0x22fb42);});if(_0x58e215){return _0x43fde8['id'];}}}));}}return BPromise[_0x0ab4('0x95')](_0x175a2a)[_0x0ab4('0x28')](function(_0x17fed9){_0x4379f1=_(_0x4379f1)[_0x0ab4('0x96')](_0x17fed9)[_0x0ab4('0x97')]()[_0x0ab4('0x98')]();return db['VoicePrefix'][_0x0ab4('0x4a')]({'where':{'id':_0x2ad3a9[_0x0ab4('0x48')]['id']}})[_0x0ab4('0x28')](function(_0x4148dd){return db[_0x0ab4('0x4d')]['transaction'](function(_0x1a8f36){return _0x4148dd[_0x0ab4('0x87')](_0x2ad3a9['query'][_0x0ab4('0x72')],{'transaction':_0x1a8f36})[_0x0ab4('0x28')](function(){if(!_[_0x0ab4('0x99')](_0x4379f1)){return _0x4148dd[_0x0ab4('0x74')](_0x4379f1,{'transaction':_0x1a8f36});}})[_0x0ab4('0x28')](function(){_0x4379f1[_0x0ab4('0x9a')](function(_0x4bc8ff){socket[_0x0ab4('0x75')](_0x0ab4('0x76'),{'UserId':_0x4bc8ff,'VoicePrefixId':_0x4148dd['id']});});});});});});})[_0x0ab4('0x28')](respondWithStatusCode(_0x29f866,null))[_0x0ab4('0x47')](handleError(_0x29f866,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index bea6ef0..521abfb 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 _0x25f3=['emit','hasOwnProperty','hook','events','VoicePrefix','setMaxListeners','save','update'];(function(_0x3372b1,_0x526335){var _0x5ec748=function(_0x2c62b9){while(--_0x2c62b9){_0x3372b1['push'](_0x3372b1['shift']());}};_0x5ec748(++_0x526335);}(_0x25f3,0x93));var _0x325f=function(_0x5181c2,_0x306f48){_0x5181c2=_0x5181c2-0x0;var _0x3e5c9c=_0x25f3[_0x5181c2];return _0x3e5c9c;};'use strict';var EventEmitter=require(_0x325f('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x325f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x325f('0x2')](0x0);var events={'afterCreate':_0x325f('0x3'),'afterUpdate':_0x325f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38439e){return function(_0x528865,_0x4765b3,_0x3a7fdf){VoicePrefixEvents['emit'](_0x38439e+':'+_0x528865['id'],_0x528865);VoicePrefixEvents[_0x325f('0x5')](_0x38439e,_0x528865);_0x3a7fdf(null);};}for(var e in events){if(events[_0x325f('0x6')](e)){var event=events[e];VoicePrefix[_0x325f('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x77d9=['emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','save','remove'];(function(_0x56b0f0,_0x529649){var _0x1f8f53=function(_0x4e4287){while(--_0x4e4287){_0x56b0f0['push'](_0x56b0f0['shift']());}};_0x1f8f53(++_0x529649);}(_0x77d9,0x100));var _0x977d=function(_0x70f515,_0x31a8a9){_0x70f515=_0x70f515-0x0;var _0x412225=_0x77d9[_0x70f515];return _0x412225;};'use strict';var EventEmitter=require(_0x977d('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x977d('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x977d('0x2')](0x0);var events={'afterCreate':_0x977d('0x3'),'afterUpdate':'update','afterDestroy':_0x977d('0x4')};function emitEvent(_0x8b3464){return function(_0x54a9f6,_0x3592e2,_0x5e0879){VoicePrefixEvents[_0x977d('0x5')](_0x8b3464+':'+_0x54a9f6['id'],_0x54a9f6);VoicePrefixEvents[_0x977d('0x5')](_0x8b3464,_0x54a9f6);_0x5e0879(null);};}for(var e in events){if(events[_0x977d('0x6')](e)){var event=events[e];VoicePrefix[_0x977d('0x7')](e,emitEvent(event));}}module[_0x977d('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d750d5d..6db8813 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 _0xbda6=['util','../../config/logger','moment','bluebird','path','./voicePrefix.attributes','exports','define','lodash'];(function(_0x3fb8bb,_0x50e7f7){var _0x52eddc=function(_0x457ad4){while(--_0x457ad4){_0x3fb8bb['push'](_0x3fb8bb['shift']());}};_0x52eddc(++_0x50e7f7);}(_0xbda6,0x19d));var _0x6bda=function(_0xd38c,_0x6dd642){_0xd38c=_0xd38c-0x0;var _0x350abc=_0xbda6[_0xd38c];return _0x350abc;};'use strict';var _=require(_0x6bda('0x0'));var util=require(_0x6bda('0x1'));var logger=require(_0x6bda('0x2'))('api');var moment=require(_0x6bda('0x3'));var BPromise=require(_0x6bda('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bda('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6bda('0x6'));module[_0x6bda('0x7')]=function(_0x2cf08f,_0x5dcfcc){return _0x2cf08f[_0x6bda('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35e4=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','VoicePrefix','voice_prefixes'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x35e4,0x96));var _0x435e=function(_0x12ae20,_0x7500bc){_0x12ae20=_0x12ae20-0x0;var _0x1179ee=_0x35e4[_0x12ae20];return _0x1179ee;};'use strict';var _=require(_0x435e('0x0'));var util=require(_0x435e('0x1'));var logger=require(_0x435e('0x2'))(_0x435e('0x3'));var moment=require(_0x435e('0x4'));var BPromise=require(_0x435e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x435e('0x6'));var config=require(_0x435e('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x486843,_0x246ee3){return _0x486843['define'](_0x435e('0x8'),attributes,{'tableName':_0x435e('0x9'),'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 0b650fe..57a327d 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 _0x9ade=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x37afdc,_0x17e8fc){var _0x1c78e9=function(_0x3daaaa){while(--_0x3daaaa){_0x37afdc['push'](_0x37afdc['shift']());}};_0x1c78e9(++_0x17e8fc);}(_0x9ade,0x8e));var _0xe9ad=function(_0x3b3947,_0x1c5e57){_0x3b3947=_0x3b3947-0x0;var _0x4113d7=_0x9ade[_0x3b3947];return _0x4113d7;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var moment=require(_0xe9ad('0x2'));var BPromise=require(_0xe9ad('0x3'));var rs=require(_0xe9ad('0x4'));var fs=require('fs');var Redis=require(_0xe9ad('0x5'));var db=require(_0xe9ad('0x6'))['db'];var utils=require(_0xe9ad('0x7'));var logger=require(_0xe9ad('0x8'))(_0xe9ad('0x9'));var config=require('../../config/environment');var jayson=require(_0xe9ad('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xe9ad('0xb')]=_[_0xe9ad('0xc')](config[_0xe9ad('0xb')],{'host':_0xe9ad('0xd'),'port':0x18eb});var socket=require(_0xe9ad('0xe'))(new Redis(config[_0xe9ad('0xb')]));require(_0xe9ad('0xf'))[_0xe9ad('0x10')](socket);function respondWithRpcPromise(_0x3a8a47,_0x2fb264,_0x2aabf3){return new BPromise(function(_0x5c3981,_0x153f7e){return client[_0xe9ad('0x11')](_0x3a8a47,_0x2aabf3)['then'](function(_0x418e9d){logger[_0xe9ad('0x12')](_0xe9ad('0x13'),_0x2fb264,'request\x20sent');logger[_0xe9ad('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2fb264,'request\x20sent',JSON[_0xe9ad('0x15')](_0x418e9d));if(_0x418e9d[_0xe9ad('0x16')]){if(_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x17')]===0x1f4){logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x18')]);return _0x153f7e(_0x418e9d['error'][_0xe9ad('0x18')]);}logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x18')]);return _0x5c3981(_0x418e9d[_0xe9ad('0x16')]['message']);}else{logger[_0xe9ad('0x12')](_0xe9ad('0x13'),_0x2fb264,_0xe9ad('0x19'));_0x5c3981(_0x418e9d[_0xe9ad('0x1a')][_0xe9ad('0x18')]);}})[_0xe9ad('0x1b')](function(_0x25ccc4){logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x25ccc4);_0x153f7e(_0x25ccc4);});});} \ No newline at end of file +var _0x6455=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x47d274,_0x44f17b){var _0x5cedd9=function(_0x3e2cb9){while(--_0x3e2cb9){_0x47d274['push'](_0x47d274['shift']());}};_0x5cedd9(++_0x44f17b);}(_0x6455,0x97));var _0x5645=function(_0x28bbef,_0x3b5ee2){_0x28bbef=_0x28bbef-0x0;var _0x4c9478=_0x6455[_0x28bbef];return _0x4c9478;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});config[_0x5645('0xc')]=_[_0x5645('0xd')](config[_0x5645('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5645('0xc')]));require(_0x5645('0xe'))[_0x5645('0xf')](socket);function respondWithRpcPromise(_0x34fe4e,_0x7f9893,_0x16af81){return new BPromise(function(_0x587c61,_0x212e46){return client[_0x5645('0x10')](_0x34fe4e,_0x16af81)[_0x5645('0x11')](function(_0x21e32c){logger['info'](_0x5645('0x12'),_0x7f9893,'request\x20sent');logger[_0x5645('0x13')](_0x5645('0x14'),_0x7f9893,_0x5645('0x15'),JSON[_0x5645('0x16')](_0x21e32c));if(_0x21e32c[_0x5645('0x17')]){if(_0x21e32c[_0x5645('0x17')][_0x5645('0x18')]===0x1f4){logger[_0x5645('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x7f9893,_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);return _0x212e46(_0x21e32c[_0x5645('0x17')]['message']);}logger['error'](_0x5645('0x12'),_0x7f9893,_0x21e32c[_0x5645('0x17')]['message']);return _0x587c61(_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);}else{logger[_0x5645('0x1a')]('VoicePrefix,\x20%s,\x20%s',_0x7f9893,_0x5645('0x15'));_0x587c61(_0x21e32c[_0x5645('0x1b')][_0x5645('0x19')]);}})[_0x5645('0x1c')](function(_0x5ac9ee){logger[_0x5645('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x7f9893,_0x5ac9ee);_0x212e46(_0x5ac9ee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index fefada2..761368a 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 _0x345e=['./voicePrefix.events','save','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x391591,_0x4490ae){var _0x3436d6=function(_0xf2e3f){while(--_0xf2e3f){_0x391591['push'](_0x391591['shift']());}};_0x3436d6(++_0x4490ae);}(_0x345e,0x168));var _0xe345=function(_0x3cb300,_0x14eeec){_0x3cb300=_0x3cb300-0x0;var _0x38848e=_0x345e[_0x3cb300];return _0x38848e;};'use strict';var VoicePrefixEvents=require(_0xe345('0x0'));var events=[_0xe345('0x1'),'remove',_0xe345('0x2')];function createListener(_0x1216b9,_0x217c93){return function(_0x25054c){_0x217c93[_0xe345('0x3')](_0x1216b9,_0x25054c);};}function removeListener(_0x43d6fd,_0x469d06){return function(){VoicePrefixEvents[_0xe345('0x4')](_0x43d6fd,_0x469d06);};}exports[_0xe345('0x5')]=function(_0x575c38){for(var _0x4491a9=0x0,_0x38cc87=events[_0xe345('0x6')];_0x4491a9<_0x38cc87;_0x4491a9++){var _0x246b2f=events[_0x4491a9];var _0x24f14f=createListener(_0xe345('0x7')+_0x246b2f,_0x575c38);VoicePrefixEvents['on'](_0x246b2f,_0x24f14f);}}; \ No newline at end of file +var _0xffdc=['length','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xffdc,0x7f));var _0xcffd=function(_0x20ceec,_0x5d61e6){_0x20ceec=_0x20ceec-0x0;var _0x567ceb=_0xffdc[_0x20ceec];return _0x567ceb;};'use strict';var VoicePrefixEvents=require(_0xcffd('0x0'));var events=[_0xcffd('0x1'),'remove',_0xcffd('0x2')];function createListener(_0x2df854,_0x5d6a91){return function(_0x31166d){_0x5d6a91[_0xcffd('0x3')](_0x2df854,_0x31166d);};}function removeListener(_0x37c566,_0x3a2c59){return function(){VoicePrefixEvents[_0xcffd('0x4')](_0x37c566,_0x3a2c59);};}exports['register']=function(_0x1a1bce){for(var _0x963fad=0x0,_0x12e830=events[_0xcffd('0x5')];_0x963fad<_0x12e830;_0x963fad++){var _0x199df3=events[_0x963fad];var _0x463334=createListener('voicePrefix:'+_0x199df3,_0x1a1bce);VoicePrefixEvents['on'](_0x199df3,_0x463334);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 51027e2..27aff02 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(_0x546707,_0xa6618d){var _0x230a32=function(_0x1c50e8){while(--_0x1c50e8){_0x546707['push'](_0x546707['shift']());}};_0x230a32(++_0xa6618d);}(_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/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(_0xe7a827,_0x440e8c){var _0x994711=function(_0x4a4c6e){while(--_0x4a4c6e){_0xe7a827['push'](_0xe7a827['shift']());}};_0x994711(++_0x440e8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 dfd5e55..a1a5958 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 _0xa6cc=['#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','linear','wrandom','rrordered','ringall','setDataValue','rrmemory','dialMethod','getDataValue','strategy','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0xa6cc,0x167));var _0xca6c=function(_0x1cf987,_0x51a548){_0x1cf987=_0x1cf987-0x0;var _0x87ab90=_0xa6cc[_0x1cf987];return _0x87ab90;};'use strict';var Sequelize=require(_0xca6c('0x0'));module[_0xca6c('0x1')]={'name':{'type':Sequelize[_0xca6c('0x2')],'allowNull':![],'unique':_0xca6c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x5'),_0xca6c('0x6')),'allowNull':![],'defaultValue':_0xca6c('0x5')},'musiconhold':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':_0xca6c('0x7')},'announce':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0xca6c('0x8'),'fewestcalls','random','rrmemory',_0xca6c('0x9'),_0xca6c('0xa'),_0xca6c('0xb')),'allowNull':![],'defaultValue':_0xca6c('0xc'),'set':function(_0x215014){this[_0xca6c('0xd')]('strategy',_0x215014?_0x215014:_0xca6c('0xe'));},'get':function(){var _0x4d424c=this['getDataValue']('type');var _0xeea5d=this['getDataValue'](_0xca6c('0xf'));var _0x238184=this[_0xca6c('0x10')](_0xca6c('0x11'));if(_0x4d424c==='inbound'){return _0x238184;}if(_0xeea5d==='booked'&&_0x238184===_0xca6c('0xe')||_0xeea5d===_0xca6c('0x12')&&_0x238184===_0xca6c('0x13')){return _0x238184;}if(_0xeea5d===_0xca6c('0x14')||_0xeea5d===_0xca6c('0x15')||_0xeea5d==='power'){return _0x238184;}return null;}},'servicelevel':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xca6c('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xca6c('0x2')]},'weight':{'type':Sequelize[_0xca6c('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no'),'defaultValue':_0xca6c('0x17')},'autopause':{'type':Sequelize[_0xca6c('0x4')]('yes','no',_0xca6c('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xca6c('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xca6c('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xca6c('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xca6c('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xca6c('0x17'),'no',_0xca6c('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xca6c('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xca6c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xca6c('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xca6c('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xca6c('0x2')]},'queue_quantity1':{'type':Sequelize[_0xca6c('0x2')]},'queue_quantity2':{'type':Sequelize[_0xca6c('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xca6c('0x2')]},'queue_less_than':{'type':Sequelize[_0xca6c('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xa9110a){this[_0xca6c('0xd')](_0xca6c('0x1a'),_0xa9110a?_0xa9110a[_0xca6c('0x1b')](','):[]);},'get':function(){return this[_0xca6c('0x10')]('periodic_announce')?this[_0xca6c('0x10')](_0xca6c('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':_0xca6c('0x17'),'set':function(_0xb9113c){this[_0xca6c('0xd')]('joinempty',_0xb9113c?_0xb9113c[_0xca6c('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xca6c('0x1c'))?this[_0xca6c('0x10')](_0xca6c('0x1c'))[_0xca6c('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':'no','set':function(_0x14889c){this[_0xca6c('0xd')](_0xca6c('0x1e'),_0x14889c?_0x14889c[_0xca6c('0x1b')](','):undefined);},'get':function(){return this[_0xca6c('0x10')](_0xca6c('0x1e'))?this[_0xca6c('0x10')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xca6c('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xca6c('0x2')]},'description':{'type':Sequelize[_0xca6c('0x2')]},'acw':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':0x0,'set':function(_0x202c80){this[_0xca6c('0xd')](_0xca6c('0x20'),_0x202c80);if(_0x202c80){if(this[_0xca6c('0x10')](_0xca6c('0x21'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xca6c('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xca6c('0x22'),'progressive',_0xca6c('0x23'),_0xca6c('0x15'),_0xca6c('0x12')),'defaultValue':'progressive','comment':_0xca6c('0x24')},'dialLimitChannel':{'type':Sequelize[_0xca6c('0x16')](0x4)[_0xca6c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xca6c('0x16')](0x4)[_0xca6c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xca6c('0x26')},'dialPowerLevel':{'type':Sequelize[_0xca6c('0x27')](0x2)[_0xca6c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xca6c('0x28'),_0xca6c('0x29')),'defaultValue':_0xca6c('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xca6c('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xca6c('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xca6c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xca6c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xca6c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x2c')},'dialQueueProject':{'type':Sequelize[_0xca6c('0x2')],'comment':_0xca6c('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0xca6c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xca6c('0x16')](0x5)[_0xca6c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca6c('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xca6c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca6c('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'defaultValue':0x3,'comment':_0xca6c('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca6c('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xca6c('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xca6c('0x34')},'dialTimezone':{'type':Sequelize[_0xca6c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xca6c('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xca6c('0x36'),_0xca6c('0x37'),_0xca6c('0x38')),'defaultValue':_0xca6c('0x36')},'dialAMDActive':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':0x0,'comment':_0xca6c('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xca6c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xca6c('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xca6c('0x16')](0x9)[_0xca6c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xca6c('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xca6c('0x16')](0x9)[_0xca6c('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xca6c('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xca6c('0x16')](0x9)[_0xca6c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xca6c('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xca6c('0x16')](0x9)[_0xca6c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xca6c('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xca6c('0x16')](0x9)[_0xca6c('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xca6c('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xca6c('0x16')](0x9)[_0xca6c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xca6c('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xca6c('0x16')](0x5)[_0xca6c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xca6c('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xca6c('0x16')](0x9)[_0xca6c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xca6c('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xca6c('0x4')](_0xca6c('0x43'),_0xca6c('0x44')),'defaultValue':_0xca6c('0x43')},'dialQueueProject2':{'type':Sequelize[_0xca6c('0x2')],'comment':_0xca6c('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xca6c('0x45')},'dialCutDigit':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xca6c('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca6c('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xca6c('0x16')](0x5)[_0xca6c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xca6c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xca6c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xca6c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca6c('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xca6c('0x16')](0x3)[_0xca6c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca6c('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xca6c('0x16')](0x5)[_0xca6c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca6c('0x16')],'allowNull':!![],'comment':_0xca6c('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':![],'comment':_0xca6c('0x4f'),'set':function(_0x10f865){if(!_0x10f865)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xca6c('0xd')](_0xca6c('0x50'),_0x10f865);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xca6c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xca6c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xca6c('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xca6c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdf09=['STRING','ringall','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','progressive','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','default'];(function(_0x74aa3e,_0x501397){var _0x38efb8=function(_0x4602dc){while(--_0x4602dc){_0x74aa3e['push'](_0x74aa3e['shift']());}};_0x38efb8(++_0x501397);}(_0xdf09,0x94));var _0x9df0=function(_0xde2974,_0x18c275){_0xde2974=_0xde2974-0x0;var _0x54fe82=_0xdf09[_0xde2974];return _0x54fe82;};'use strict';var Sequelize=require(_0x9df0('0x0'));module[_0x9df0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9df0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x9df0('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x9df0('0x5')},'announce':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x9df0('0x7'),'leastrecent',_0x9df0('0x8'),'random',_0x9df0('0x9'),_0x9df0('0xa'),_0x9df0('0xb'),_0x9df0('0xc')),'allowNull':![],'defaultValue':_0x9df0('0x7'),'set':function(_0x15d815){this[_0x9df0('0xd')](_0x9df0('0xe'),_0x15d815?_0x15d815:_0x9df0('0x9'));},'get':function(){var _0x1d75b1=this[_0x9df0('0xf')](_0x9df0('0x10'));var _0x42690b=this[_0x9df0('0xf')]('dialMethod');var _0x2b264a=this['getDataValue'](_0x9df0('0xe'));if(_0x1d75b1===_0x9df0('0x4')){return _0x2b264a;}if(_0x42690b==='booked'&&_0x2b264a===_0x9df0('0x9')||_0x42690b==='booked'&&_0x2b264a==='roundrobin'){return _0x2b264a;}if(_0x42690b===_0x9df0('0x11')||_0x42690b===_0x9df0('0x12')||_0x42690b==='power'){return _0x2b264a;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x9df0('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9df0('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9df0('0x6')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9df0('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defaultValue':_0x9df0('0x14')},'autopause':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no',_0x9df0('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9df0('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9df0('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9df0('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9df0('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9df0('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9df0('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defaultValue':_0x9df0('0x14')},'announce_holdtime':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no',_0x9df0('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x9df0('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x9df0('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9df0('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9df0('0x6')]},'queue_youarenext':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9df0('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9df0('0x6')]},'queue_quantity1':{'type':Sequelize[_0x9df0('0x6')]},'queue_quantity2':{'type':Sequelize[_0x9df0('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x9df0('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x9df0('0x17')],'set':function(_0x147700){this['setDataValue'](_0x9df0('0x18'),_0x147700?_0x147700[_0x9df0('0x19')](','):[]);},'get':function(){return this[_0x9df0('0xf')](_0x9df0('0x18'))?this[_0x9df0('0xf')](_0x9df0('0x18'))[_0x9df0('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':_0x9df0('0x14'),'set':function(_0x2fabed){this[_0x9df0('0xd')](_0x9df0('0x1b'),_0x2fabed?_0x2fabed[_0x9df0('0x19')](','):undefined);},'get':function(){return this[_0x9df0('0xf')](_0x9df0('0x1b'))?this['getDataValue']('joinempty')[_0x9df0('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':'no','set':function(_0x2078ee){this[_0x9df0('0xd')](_0x9df0('0x1c'),_0x2078ee?_0x2078ee['join'](','):undefined);},'get':function(){return this[_0x9df0('0xf')](_0x9df0('0x1c'))?this[_0x9df0('0xf')](_0x9df0('0x1c'))[_0x9df0('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9df0('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9df0('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':0x0,'set':function(_0x35d8fc){this[_0x9df0('0xd')](_0x9df0('0x1e'),_0x35d8fc);if(_0x35d8fc){if(this[_0x9df0('0xf')](_0x9df0('0x1f'))<0x2){this[_0x9df0('0xd')](_0x9df0('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':0x0,'comment':_0x9df0('0x20')},'dialMethod':{'type':Sequelize[_0x9df0('0x3')]('preview',_0x9df0('0x11'),_0x9df0('0x21'),'predictive',_0x9df0('0x22')),'defaultValue':'progressive','comment':_0x9df0('0x23')},'dialLimitChannel':{'type':Sequelize[_0x9df0('0x13')](0x4)[_0x9df0('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9df0('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x9df0('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9df0('0x26')},'dialPowerLevel':{'type':Sequelize[_0x9df0('0x27')](0x2)[_0x9df0('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x9df0('0x28')),'defaultValue':_0x9df0('0x28'),'comment':_0x9df0('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9df0('0x27')](0x2)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9df0('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x9df0('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9df0('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9df0('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9df0('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':_0x9df0('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9df0('0x2e')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x9df0('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9df0('0x13')](0x5)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9df0('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9df0('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9df0('0x13')](0x5)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9df0('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9df0('0x33')},'dialTimezone':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':_0x9df0('0x34')},'dialPrefix':{'type':Sequelize[_0x9df0('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x35'),_0x9df0('0x36'),_0x9df0('0x37')),'defaultValue':_0x9df0('0x35')},'dialAMDActive':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9df0('0x13')](0x9)[_0x9df0('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9df0('0x38')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9df0('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9df0('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9df0('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9df0('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9df0('0x13')](0x9)[_0x9df0('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9df0('0x13')](0x9)[_0x9df0('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9df0('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9df0('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9df0('0x13')](0x9)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9df0('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9df0('0x13')](0x5)[_0x9df0('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9df0('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9df0('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9df0('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x9df0('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9df0('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x9df0('0x3')](_0x9df0('0x40'),_0x9df0('0x41')),'defaultValue':_0x9df0('0x40')},'dialQueueProject2':{'type':Sequelize[_0x9df0('0x6')],'comment':_0x9df0('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9df0('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9df0('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9df0('0x13')](0x5)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9df0('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x9df0('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9df0('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9df0('0x13')](0x5)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9df0('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9df0('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9df0('0x13')](0x5)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9df0('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9df0('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9df0('0x13')](0x5)[_0x9df0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9df0('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9df0('0x13')],'allowNull':!![],'comment':_0x9df0('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x52e470){if(!_0x52e470)this[_0x9df0('0xd')](_0x9df0('0x4b'),null);this[_0x9df0('0xd')](_0x9df0('0x4c'),_0x52e470);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9df0('0x13')](0x3)[_0x9df0('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9df0('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9df0('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 69d9bbe..619a6c8 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 _0x0af5=['sendStatus','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','VoiceQueue','include','findAll','catch','show','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','autoAssociation','getHoppers','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','rows','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','isEmpty','removeAgents','UserVoiceQueueRt','emit','addAgents','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x0af5,0x158));var _0x50af=function(_0x3854e0,_0x3a3a2c){_0x3854e0=_0x3854e0-0x0;var _0x271c10=_0x0af5[_0x3854e0];return _0x271c10;};'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'];config[_0x50af('0x17')]=_[_0x50af('0x18')](config[_0x50af('0x17')],{'host':_0x50af('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0x50af('0x1a')](socket);function respondWithStatusCode(_0x561cd2,_0x43a4cc){_0x43a4cc=_0x43a4cc||0xcc;return function(_0x160026){if(_0x160026){return _0x561cd2['sendStatus'](_0x43a4cc);}return _0x561cd2['status'](_0x43a4cc)[_0x50af('0x1b')]();};}function respondWithResult(_0x13cbf4,_0x4a3106){_0x4a3106=_0x4a3106||0xc8;return function(_0x4b0775){if(_0x4b0775){return _0x13cbf4[_0x50af('0x1c')](_0x4a3106)[_0x50af('0x1d')](_0x4b0775);}};}function respondWithFilteredResult(_0x33869f,_0x30e2ec){return function(_0x1906e6){if(_0x1906e6){var _0x3c5bf7=typeof _0x30e2ec[_0x50af('0x1e')]===_0x50af('0x1f')&&typeof _0x30e2ec[_0x50af('0x20')]===_0x50af('0x1f');var _0x5c6f8e=_0x1906e6[_0x50af('0x21')];var _0x2fbf20=_0x3c5bf7?0x0:_0x30e2ec[_0x50af('0x1e')];var _0x3cdc65=_0x3c5bf7?_0x1906e6['count']:_0x30e2ec[_0x50af('0x1e')]+_0x30e2ec[_0x50af('0x20')];var _0x4b5e21;if(_0x3cdc65>=_0x5c6f8e){_0x3cdc65=_0x5c6f8e;_0x4b5e21=0xc8;}else{_0x4b5e21=0xce;}_0x33869f[_0x50af('0x1c')](_0x4b5e21);return _0x33869f[_0x50af('0x22')](_0x50af('0x23'),_0x2fbf20+'-'+_0x3cdc65+'/'+_0x5c6f8e)[_0x50af('0x1d')](_0x1906e6);}return null;};}function patchUpdates(_0xb6de0d){return function(_0x1a122c){try{jsonpatch[_0x50af('0x24')](_0x1a122c,_0xb6de0d,!![]);}catch(_0x53e362){return BPromise[_0x50af('0x25')](_0x53e362);}return _0x1a122c[_0x50af('0x26')]();};}function saveUpdates(_0x3c6388,_0x7eeeaf){return function(_0x2f2e88){if(_0x2f2e88){return _0x2f2e88[_0x50af('0x27')](_0x3c6388)['then'](function(_0xb3c15a){return _0xb3c15a;});}return null;};}function removeEntity(_0x1550ee,_0x5e096d){return function(_0xd085ec){if(_0xd085ec){return _0xd085ec[_0x50af('0x28')]()[_0x50af('0x29')](function(){var _0x5dc58a=_0xd085ec['get']({'plain':!![]});var _0x26dbae=[{'name':_0x50af('0x2a'),'value':_0x50af('0x2b'),'ignore':![]},{'name':_0x50af('0x2c'),'value':_0x50af('0x2d'),'ignore':![]}];var _0x373756=_(_0x26dbae)[_0x50af('0x2e')](_0x50af('0x2f'))['map'](_0x50af('0x30'))[_0x50af('0x30')]();if(_[_0x50af('0x31')](_0x373756,_0x5dc58a['type'])){return;}var _0x43f1c8=_['find'](_0x26dbae,[_0x50af('0x30'),_0x5dc58a['type']])['name'];return db['UserProfileResource'][_0x50af('0x28')]({'where':{'type':_0x43f1c8,'resourceId':_0x5dc58a['id']}})[_0x50af('0x29')](function(){return _0xd085ec;});})[_0x50af('0x29')](function(){_0x1550ee[_0x50af('0x1c')](0xcc)[_0x50af('0x1b')]();});}};}function handleEntityNotFound(_0xb254bf,_0xe321f7){return function(_0x2ce608){if(!_0x2ce608){_0xb254bf[_0x50af('0x32')](0x194);}return _0x2ce608;};}function handleError(_0x27435d,_0x522982){_0x522982=_0x522982||0x1f4;return function(_0x4ad19b){logger[_0x50af('0x33')](_0x4ad19b[_0x50af('0x34')]);if(_0x4ad19b[_0x50af('0x35')]){delete _0x4ad19b[_0x50af('0x35')];}_0x27435d['status'](_0x522982)[_0x50af('0x36')](_0x4ad19b);};}exports['index']=function(_0x5ac19f,_0x5bedd9){var _0x65462f={},_0x1da181={},_0xb1ed5b={'count':0x0,'rows':[]};var _0x3e63eb=_[_0x50af('0x37')](db['VoiceQueue']['rawAttributes'],function(_0x285944){return{'name':_0x285944[_0x50af('0x38')],'type':_0x285944[_0x50af('0x39')][_0x50af('0x3a')]};});_0x1da181[_0x50af('0x3b')]=_['map'](_0x3e63eb,_0x50af('0x35'));_0x1da181[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x5ac19f[_0x50af('0x3c')]);_0x1da181['filters']=_[_0x50af('0x3e')](_0x1da181[_0x50af('0x3b')],_0x1da181[_0x50af('0x3c')]);_0x65462f[_0x50af('0x3f')]=_[_0x50af('0x3e')](_0x1da181['model'],qs['fields'](_0x5ac19f['query'][_0x50af('0x40')]));_0x65462f[_0x50af('0x3f')]=_0x65462f[_0x50af('0x3f')][_0x50af('0x41')]?_0x65462f[_0x50af('0x3f')]:_0x1da181[_0x50af('0x3b')];if(!_0x5ac19f[_0x50af('0x3c')][_0x50af('0x42')](_0x50af('0x43'))){_0x65462f[_0x50af('0x20')]=qs[_0x50af('0x20')](_0x5ac19f[_0x50af('0x3c')][_0x50af('0x20')]);_0x65462f[_0x50af('0x1e')]=qs[_0x50af('0x1e')](_0x5ac19f[_0x50af('0x3c')]['offset']);}_0x65462f[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x5ac19f[_0x50af('0x3c')]['sort']);_0x65462f['where']=qs[_0x50af('0x46')](_[_0x50af('0x47')](_0x5ac19f[_0x50af('0x3c')],_0x1da181[_0x50af('0x46')]),_0x3e63eb);if(_0x5ac19f[_0x50af('0x3c')][_0x50af('0x2e')]){_0x65462f[_0x50af('0x48')]=_[_0x50af('0x49')](_0x65462f['where'],{'$or':_['map'](_0x3e63eb,function(_0x33f6a5){if(_0x33f6a5[_0x50af('0x39')]!=='VIRTUAL'){var _0x4f5ace={};_0x4f5ace[_0x33f6a5[_0x50af('0x35')]]={'$like':'%'+_0x5ac19f[_0x50af('0x3c')][_0x50af('0x2e')]+'%'};return _0x4f5ace;}})});}_0x65462f=_['merge']({},_0x65462f,_0x5ac19f[_0x50af('0x4a')]);var _0x2f3367={'where':_0x65462f[_0x50af('0x48')]};return db[_0x50af('0x4b')][_0x50af('0x21')](_0x2f3367)[_0x50af('0x29')](function(_0xa5bf2d){_0xb1ed5b[_0x50af('0x21')]=_0xa5bf2d;if(_0x5ac19f[_0x50af('0x3c')]['includeAll']){_0x65462f[_0x50af('0x4c')]=[{'all':!![]}];}return db[_0x50af('0x4b')][_0x50af('0x4d')](_0x65462f);})[_0x50af('0x29')](function(_0x5c562c){_0xb1ed5b['rows']=_0x5c562c;return _0xb1ed5b;})['then'](respondWithFilteredResult(_0x5bedd9,_0x65462f))[_0x50af('0x4e')](handleError(_0x5bedd9,null));};exports[_0x50af('0x4f')]=function(_0x567c42,_0x274f92){var _0x9592db={'raw':![],'where':{'id':_0x567c42[_0x50af('0x50')]['id']}},_0x398dad={};_0x398dad[_0x50af('0x3b')]=_[_0x50af('0x3d')](db['VoiceQueue']['rawAttributes']);_0x398dad[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x567c42[_0x50af('0x3c')]);_0x398dad[_0x50af('0x46')]=_[_0x50af('0x3e')](_0x398dad[_0x50af('0x3b')],_0x398dad['query']);_0x9592db[_0x50af('0x3f')]=_[_0x50af('0x3e')](_0x398dad['model'],qs['fields'](_0x567c42[_0x50af('0x3c')][_0x50af('0x40')]));_0x9592db[_0x50af('0x3f')]=_0x9592db[_0x50af('0x3f')][_0x50af('0x41')]?_0x9592db[_0x50af('0x3f')]:_0x398dad[_0x50af('0x3b')];if(_0x567c42[_0x50af('0x3c')][_0x50af('0x51')]){_0x9592db[_0x50af('0x4c')]=[{'all':!![]}];}_0x9592db=_['merge']({},_0x9592db,_0x567c42[_0x50af('0x4a')]);return db[_0x50af('0x4b')][_0x50af('0x52')](_0x9592db)[_0x50af('0x29')](handleEntityNotFound(_0x274f92,null))[_0x50af('0x29')](respondWithResult(_0x274f92,null))['catch'](handleError(_0x274f92,null));};exports['create']=function(_0x55d128,_0x199eac){return db['VoiceQueue'][_0x50af('0x53')](_0x55d128[_0x50af('0x54')],{})[_0x50af('0x29')](function(_0x2b6c5d){var _0x32ffa7=_0x55d128['user'][_0x50af('0x55')]({'plain':!![]});if(!_0x32ffa7)throw new Error(_0x50af('0x56'));if(_0x32ffa7[_0x50af('0x57')]===_0x50af('0x58')){var _0x445fcc=_0x2b6c5d[_0x50af('0x55')]({'plain':!![]});var _0x1f1427=[{'name':'VoiceQueues','value':_0x50af('0x2b')},{'name':'QueueCampaigns','value':_0x50af('0x2d')}];var _0x3c70f5=_[_0x50af('0x52')](_0x1f1427,[_0x50af('0x30'),_0x445fcc['type']])[_0x50af('0x35')];return db[_0x50af('0x59')][_0x50af('0x52')]({'where':{'name':_0x3c70f5,'userProfileId':_0x32ffa7[_0x50af('0x5a')]},'raw':!![]})[_0x50af('0x29')](function(_0x27b5b7){if(_0x27b5b7&&_0x27b5b7['autoAssociation']===0x0){return db[_0x50af('0x5b')][_0x50af('0x53')]({'name':_0x445fcc[_0x50af('0x35')],'resourceId':_0x445fcc['id'],'type':_0x27b5b7[_0x50af('0x35')],'sectionId':_0x27b5b7['id']},{})[_0x50af('0x29')](function(){return _0x2b6c5d;});}else{return _0x2b6c5d;}})[_0x50af('0x4e')](function(_0x3a042a){logger[_0x50af('0x33')](_0x50af('0x5c'),_0x3a042a);throw _0x3a042a;});}return _0x2b6c5d;})[_0x50af('0x29')](respondWithResult(_0x199eac,0xc9))[_0x50af('0x4e')](handleError(_0x199eac,null));};exports['clone']=function(_0xba741a,_0x2a4d1e){var _0x25f9dc={'where':{'id':_0xba741a[_0x50af('0x50')]['id']}},_0x263abb={};_0x263abb['model']=_[_0x50af('0x3d')](db[_0x50af('0x4b')][_0x50af('0x5d')]);_0x25f9dc[_0x50af('0x3f')]=_[_0x50af('0x3e')](_0x263abb[_0x50af('0x3b')],qs[_0x50af('0x40')](_0xba741a[_0x50af('0x3c')][_0x50af('0x40')]));_0x25f9dc[_0x50af('0x3f')]=_0x25f9dc[_0x50af('0x3f')][_0x50af('0x41')]?_0x25f9dc[_0x50af('0x3f')]:_0x263abb[_0x50af('0x3b')];if(_0xba741a[_0x50af('0x3c')][_0x50af('0x51')]){_0x25f9dc[_0x50af('0x4c')]=[{'all':!![]}];}_0x25f9dc=_['merge']({},_0x25f9dc,_0xba741a[_0x50af('0x4a')]);return db[_0x50af('0x4b')][_0x50af('0x52')](_0x25f9dc)[_0x50af('0x29')](handleEntityNotFound(_0x2a4d1e,null))[_0x50af('0x29')](function(_0x1d9153){if(_0x1d9153){var _0x131d3d=_0x1d9153['get']({'plain':!![]});_0x131d3d=qs[_0x50af('0x5e')](_0x131d3d,['id',_0x50af('0x5f'),_0x50af('0x60')]);_0xba741a['body']=_[_0x50af('0x5e')](_0xba741a[_0x50af('0x54')],['id',_0x50af('0x5f'),_0x50af('0x60')]);return db['VoiceQueue'][_0x50af('0x53')](_[_0x50af('0x49')](_0x131d3d,_0xba741a[_0x50af('0x54')]),{'include':_0xba741a['query'][_0x50af('0x51')]?[{'all':!![]}]:undefined})[_0x50af('0x29')](function(_0xe02b97){var _0x15903d=_0xba741a['user'][_0x50af('0x55')]({'plain':!![]});if(!_0x15903d)throw new Error(_0x50af('0x56'));if(_0x15903d[_0x50af('0x57')]===_0x50af('0x58')){var _0x1a7a10=_0xe02b97['get']({'plain':!![]});var _0xbaf3fb=[{'name':_0x50af('0x2a'),'value':'inbound'},{'name':_0x50af('0x2c'),'value':'outbound'}];var _0x93b0af=_[_0x50af('0x52')](_0xbaf3fb,[_0x50af('0x30'),_0x1a7a10[_0x50af('0x39')]])[_0x50af('0x35')];return db[_0x50af('0x59')][_0x50af('0x52')]({'where':{'name':_0x93b0af,'userProfileId':_0x15903d[_0x50af('0x5a')]},'raw':!![]})[_0x50af('0x29')](function(_0x3b9117){if(_0x3b9117&&_0x3b9117[_0x50af('0x61')]===0x0){return db[_0x50af('0x5b')]['create']({'name':_0x1a7a10[_0x50af('0x35')],'resourceId':_0x1a7a10['id'],'type':_0x3b9117[_0x50af('0x35')],'sectionId':_0x3b9117['id']},{})[_0x50af('0x29')](function(){return _0xe02b97;});}else{return _0xe02b97;}})[_0x50af('0x4e')](function(_0x4b9ef9){logger[_0x50af('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b9ef9);throw _0x4b9ef9;});}return _0xe02b97;});}})[_0x50af('0x29')](respondWithResult(_0x2a4d1e,0xc9))[_0x50af('0x4e')](handleError(_0x2a4d1e,null));};exports[_0x50af('0x27')]=function(_0x58528a,_0x56a577){if(_0x58528a[_0x50af('0x54')]['id']){delete _0x58528a[_0x50af('0x54')]['id'];}return db[_0x50af('0x4b')]['find']({'where':{'id':_0x58528a['params']['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x56a577,null))[_0x50af('0x29')](saveUpdates(_0x58528a[_0x50af('0x54')],null))[_0x50af('0x29')](respondWithResult(_0x56a577,null))[_0x50af('0x4e')](handleError(_0x56a577,null));};exports[_0x50af('0x28')]=function(_0x2c9948,_0x120a96){return db[_0x50af('0x4b')][_0x50af('0x52')]({'where':{'id':_0x2c9948[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x120a96,null))['then'](removeEntity(_0x120a96,null))[_0x50af('0x4e')](handleError(_0x120a96,null));};exports[_0x50af('0x62')]=function(_0x5b088f,_0x271085,_0x89c947){var _0x4fa0a2={'raw':![],'where':{}};var _0x3502e0={};var _0xd97581={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5b088f[_0x50af('0x50')]['id']}})['then'](handleEntityNotFound(_0x271085,null))['then'](function(_0x208f88){if(_0x208f88){_0x3502e0['model']=_[_0x50af('0x3d')](db['CmHopper']['rawAttributes']);_0x3502e0[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x5b088f['query']);_0x3502e0[_0x50af('0x46')]=_[_0x50af('0x3e')](_0x3502e0[_0x50af('0x3b')],_0x3502e0[_0x50af('0x3c')]);_0x4fa0a2[_0x50af('0x3f')]=_['intersection'](_0x3502e0[_0x50af('0x3b')],qs[_0x50af('0x40')](_0x5b088f['query'][_0x50af('0x40')]));_0x4fa0a2[_0x50af('0x3f')]=_0x4fa0a2[_0x50af('0x3f')][_0x50af('0x41')]?_0x4fa0a2['attributes']:_0x3502e0[_0x50af('0x3b')];if(!_0x5b088f[_0x50af('0x3c')]['hasOwnProperty'](_0x50af('0x43'))){_0x4fa0a2[_0x50af('0x20')]=qs[_0x50af('0x20')](_0x5b088f[_0x50af('0x3c')]['limit']);_0x4fa0a2[_0x50af('0x1e')]=qs[_0x50af('0x1e')](_0x5b088f['query'][_0x50af('0x1e')]);}_0x4fa0a2['order']=qs[_0x50af('0x45')](_0x5b088f['query'][_0x50af('0x45')]);_0x4fa0a2[_0x50af('0x48')]=qs[_0x50af('0x46')](_[_0x50af('0x47')](_0x5b088f[_0x50af('0x3c')],_0x3502e0[_0x50af('0x46')]));_0x4fa0a2[_0x50af('0x48')][_0x50af('0x63')]=_0x208f88['id'];if(_0x5b088f[_0x50af('0x3c')][_0x50af('0x2e')]){_0x4fa0a2[_0x50af('0x48')]=_[_0x50af('0x49')](_0x4fa0a2[_0x50af('0x48')],{'$or':_['map'](_0x4fa0a2[_0x50af('0x3f')],function(_0x98b30c){var _0x50b467={};_0x50b467[_0x98b30c]={'$like':'%'+_0x5b088f[_0x50af('0x3c')][_0x50af('0x2e')]+'%'};return _0x50b467;})});}_0x4fa0a2=_[_0x50af('0x49')]({},_0x4fa0a2,_0x5b088f['options']);return db['CmHopper']['count']({'where':_0x4fa0a2['where']})[_0x50af('0x29')](function(_0x59198f){_0xd97581[_0x50af('0x21')]=_0x59198f;if(_0x5b088f[_0x50af('0x3c')][_0x50af('0x51')]){_0x4fa0a2[_0x50af('0x4c')]=[{'all':!![]}];}return db[_0x50af('0x64')][_0x50af('0x4d')](_0x4fa0a2);})[_0x50af('0x29')](function(_0x4d2c1a){_0xd97581['rows']=_0x4d2c1a;return _0xd97581;});}})['then'](respondWithFilteredResult(_0x271085,_0x4fa0a2))[_0x50af('0x4e')](handleError(_0x271085,null));};exports[_0x50af('0x65')]=function(_0x5c6d9e,_0x1d5b0e,_0x1cfb8e){var _0x39e945={'raw':!![],'where':{}};var _0x61d448={};var _0xd6053d={'count':0x0,'rows':[]};return db[_0x50af('0x4b')]['findOne']({'where':{'id':_0x5c6d9e[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x1d5b0e,null))[_0x50af('0x29')](function(_0x265acd){if(_0x265acd){_0x61d448[_0x50af('0x3b')]=_['keys'](db[_0x50af('0x66')]['rawAttributes']);_0x61d448[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x5c6d9e[_0x50af('0x3c')]);_0x61d448[_0x50af('0x46')]=_[_0x50af('0x3e')](_0x61d448[_0x50af('0x3b')],_0x61d448['query']);_0x39e945['attributes']=_[_0x50af('0x3e')](_0x61d448[_0x50af('0x3b')],qs['fields'](_0x5c6d9e[_0x50af('0x3c')][_0x50af('0x40')]));_0x39e945[_0x50af('0x3f')]=_0x39e945[_0x50af('0x3f')][_0x50af('0x41')]?_0x39e945['attributes']:_0x61d448['model'];if(!_0x5c6d9e[_0x50af('0x3c')][_0x50af('0x42')]('nolimit')){_0x39e945[_0x50af('0x20')]=qs[_0x50af('0x20')](_0x5c6d9e[_0x50af('0x3c')][_0x50af('0x20')]);_0x39e945['offset']=qs[_0x50af('0x1e')](_0x5c6d9e[_0x50af('0x3c')][_0x50af('0x1e')]);}_0x39e945[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x5c6d9e['query'][_0x50af('0x45')]);_0x39e945[_0x50af('0x48')]=qs[_0x50af('0x46')](_['pick'](_0x5c6d9e[_0x50af('0x3c')],_0x61d448[_0x50af('0x46')]));_0x39e945[_0x50af('0x48')][_0x50af('0x63')]=_0x265acd['id'];if(_0x5c6d9e['query'][_0x50af('0x2e')]){_0x39e945['where']=_[_0x50af('0x49')](_0x39e945['where'],{'$or':_['map'](_0x39e945[_0x50af('0x3f')],function(_0x382037){var _0x5fa2f8={};_0x5fa2f8[_0x382037]={'$like':'%'+_0x5c6d9e[_0x50af('0x3c')]['filter']+'%'};return _0x5fa2f8;})});}_0x39e945=_[_0x50af('0x49')]({},_0x39e945,_0x5c6d9e['options']);return db[_0x50af('0x66')][_0x50af('0x21')]({'where':_0x39e945['where']})[_0x50af('0x29')](function(_0x43e2c3){_0xd6053d[_0x50af('0x21')]=_0x43e2c3;if(_0x5c6d9e[_0x50af('0x3c')][_0x50af('0x51')]){_0x39e945[_0x50af('0x4c')]=[{'all':!![]}];}return db[_0x50af('0x66')][_0x50af('0x4d')](_0x39e945);})[_0x50af('0x29')](function(_0x5ac0b7){_0xd6053d[_0x50af('0x67')]=_0x5ac0b7;return _0xd6053d;});}})[_0x50af('0x29')](respondWithFilteredResult(_0x1d5b0e,_0x39e945))[_0x50af('0x4e')](handleError(_0x1d5b0e,null));};exports['getHopperFinals']=function(_0x368e19,_0x1fcc23,_0xf74d28){var _0xd26183={'raw':!![],'where':{}};var _0x36d9a3={};var _0x3ae264={'count':0x0,'rows':[]};return db[_0x50af('0x4b')][_0x50af('0x68')]({'where':{'id':_0x368e19['params']['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x1fcc23,null))[_0x50af('0x29')](function(_0x3b59c6){if(_0x3b59c6){_0x36d9a3[_0x50af('0x3b')]=_[_0x50af('0x3d')](db[_0x50af('0x69')]['rawAttributes']);_0x36d9a3[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x368e19['query']);_0x36d9a3[_0x50af('0x46')]=_[_0x50af('0x3e')](_0x36d9a3[_0x50af('0x3b')],_0x36d9a3[_0x50af('0x3c')]);_0xd26183['attributes']=_[_0x50af('0x3e')](_0x36d9a3[_0x50af('0x3b')],qs[_0x50af('0x40')](_0x368e19[_0x50af('0x3c')][_0x50af('0x40')]));_0xd26183[_0x50af('0x3f')]=_0xd26183[_0x50af('0x3f')]['length']?_0xd26183['attributes']:_0x36d9a3[_0x50af('0x3b')];if(!_0x368e19['query'][_0x50af('0x42')](_0x50af('0x43'))){_0xd26183['limit']=qs[_0x50af('0x20')](_0x368e19[_0x50af('0x3c')][_0x50af('0x20')]);_0xd26183['offset']=qs[_0x50af('0x1e')](_0x368e19['query'][_0x50af('0x1e')]);}_0xd26183[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x368e19[_0x50af('0x3c')][_0x50af('0x45')]);_0xd26183[_0x50af('0x48')]=qs['filters'](_[_0x50af('0x47')](_0x368e19[_0x50af('0x3c')],_0x36d9a3[_0x50af('0x46')]));_0xd26183['where'][_0x50af('0x63')]=_0x3b59c6['id'];if(_0x368e19[_0x50af('0x3c')][_0x50af('0x2e')]){_0xd26183['where']=_[_0x50af('0x49')](_0xd26183['where'],{'$or':_['map'](_0xd26183[_0x50af('0x3f')],function(_0xbfb57c){var _0x2a1166={};_0x2a1166[_0xbfb57c]={'$like':'%'+_0x368e19['query'][_0x50af('0x2e')]+'%'};return _0x2a1166;})});}_0xd26183=_[_0x50af('0x49')]({},_0xd26183,_0x368e19[_0x50af('0x4a')]);return db[_0x50af('0x69')][_0x50af('0x21')]({'where':_0xd26183[_0x50af('0x48')]})[_0x50af('0x29')](function(_0x3fb165){_0x3ae264[_0x50af('0x21')]=_0x3fb165;if(_0x368e19[_0x50af('0x3c')][_0x50af('0x51')]){_0xd26183[_0x50af('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x50af('0x4d')](_0xd26183);})[_0x50af('0x29')](function(_0xf1ae61){_0x3ae264[_0x50af('0x67')]=_0xf1ae61;return _0x3ae264;});}})[_0x50af('0x29')](respondWithFilteredResult(_0x1fcc23,_0xd26183))['catch'](handleError(_0x1fcc23,null));};exports[_0x50af('0x6a')]=function(_0x352955,_0xed38fd,_0x28e846){var _0x466410={'raw':!![],'where':{}};var _0x39ce25={};var _0x54f9a7={'count':0x0,'rows':[]};return db[_0x50af('0x4b')][_0x50af('0x68')]({'where':{'id':_0x352955[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0xed38fd,null))['then'](function(_0x401c36){if(_0x401c36){_0x39ce25[_0x50af('0x3b')]=_['keys'](db[_0x50af('0x6b')][_0x50af('0x5d')]);_0x39ce25[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x352955['query']);_0x39ce25['filters']=_[_0x50af('0x3e')](_0x39ce25[_0x50af('0x3b')],_0x39ce25['query']);_0x466410['attributes']=_[_0x50af('0x3e')](_0x39ce25[_0x50af('0x3b')],qs[_0x50af('0x40')](_0x352955[_0x50af('0x3c')][_0x50af('0x40')]));_0x466410[_0x50af('0x3f')]=_0x466410[_0x50af('0x3f')]['length']?_0x466410['attributes']:_0x39ce25[_0x50af('0x3b')];if(!_0x352955[_0x50af('0x3c')][_0x50af('0x42')]('nolimit')){_0x466410[_0x50af('0x20')]=qs[_0x50af('0x20')](_0x352955[_0x50af('0x3c')]['limit']);_0x466410[_0x50af('0x1e')]=qs[_0x50af('0x1e')](_0x352955['query'][_0x50af('0x1e')]);}_0x466410[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x352955[_0x50af('0x3c')][_0x50af('0x45')]);_0x466410[_0x50af('0x48')]=qs[_0x50af('0x46')](_['pick'](_0x352955['query'],_0x39ce25[_0x50af('0x46')]));_0x466410[_0x50af('0x48')][_0x50af('0x63')]=_0x401c36['id'];if(_0x352955['query']['filter']){_0x466410[_0x50af('0x48')]=_['merge'](_0x466410[_0x50af('0x48')],{'$or':_[_0x50af('0x37')](_0x466410['attributes'],function(_0x448f06){var _0x49a285={};_0x49a285[_0x448f06]={'$like':'%'+_0x352955[_0x50af('0x3c')][_0x50af('0x2e')]+'%'};return _0x49a285;})});}_0x466410=_[_0x50af('0x49')]({},_0x466410,_0x352955[_0x50af('0x4a')]);return db[_0x50af('0x6b')][_0x50af('0x21')]({'where':_0x466410[_0x50af('0x48')]})[_0x50af('0x29')](function(_0x2e7d5e){_0x54f9a7['count']=_0x2e7d5e;if(_0x352955[_0x50af('0x3c')][_0x50af('0x51')]){_0x466410[_0x50af('0x4c')]=[{'all':!![]}];}return db[_0x50af('0x6b')][_0x50af('0x4d')](_0x466410);})[_0x50af('0x29')](function(_0xf40af1){_0x54f9a7['rows']=_0xf40af1;return _0x54f9a7;});}})[_0x50af('0x29')](respondWithFilteredResult(_0xed38fd,_0x466410))[_0x50af('0x4e')](handleError(_0xed38fd,null));};exports[_0x50af('0x6c')]=function(_0x4d9580,_0x52733f,_0x56172a){var _0xc38771={};var _0x2c0f8c={};var _0x3da468;var _0x275174;return db[_0x50af('0x4b')][_0x50af('0x68')]({'where':{'id':_0x4d9580[_0x50af('0x50')]['id']}})['then'](handleEntityNotFound(_0x52733f,null))[_0x50af('0x29')](function(_0x58b4f0){if(_0x58b4f0){_0x3da468=_0x58b4f0;_0x2c0f8c[_0x50af('0x3b')]=_[_0x50af('0x3d')](db[_0x50af('0x6d')]['rawAttributes']);_0x2c0f8c['query']=_[_0x50af('0x3d')](_0x4d9580[_0x50af('0x3c')]);_0x2c0f8c[_0x50af('0x46')]=_['intersection'](_0x2c0f8c['model'],_0x2c0f8c[_0x50af('0x3c')]);_0xc38771[_0x50af('0x3f')]=_[_0x50af('0x3e')](_0x2c0f8c['model'],qs[_0x50af('0x40')](_0x4d9580[_0x50af('0x3c')][_0x50af('0x40')]));_0xc38771[_0x50af('0x3f')]=_0xc38771[_0x50af('0x3f')][_0x50af('0x41')]?_0xc38771['attributes']:_0x2c0f8c[_0x50af('0x3b')];_0xc38771[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x4d9580[_0x50af('0x3c')][_0x50af('0x45')]);_0xc38771[_0x50af('0x48')]=qs[_0x50af('0x46')](_[_0x50af('0x47')](_0x4d9580[_0x50af('0x3c')],_0x2c0f8c[_0x50af('0x46')]));if(_0x4d9580['query']['filter']){_0xc38771[_0x50af('0x48')]=_[_0x50af('0x49')](_0xc38771[_0x50af('0x48')],{'$or':_[_0x50af('0x37')](_0xc38771[_0x50af('0x3f')],function(_0x5bc881){var _0x16bca2={};_0x16bca2[_0x5bc881]={'$like':'%'+_0x4d9580['query'][_0x50af('0x2e')]+'%'};return _0x16bca2;})});}_0xc38771=_['merge']({},_0xc38771,_0x4d9580[_0x50af('0x4a')]);return _0x3da468['getTeams'](_0xc38771);}})['then'](function(_0x3d532f){if(_0x3d532f){_0x275174=_0x3d532f[_0x50af('0x41')];if(!_0x4d9580[_0x50af('0x3c')]['hasOwnProperty'](_0x50af('0x43'))){_0xc38771['limit']=qs['limit'](_0x4d9580[_0x50af('0x3c')][_0x50af('0x20')]);_0xc38771[_0x50af('0x1e')]=qs[_0x50af('0x1e')](_0x4d9580[_0x50af('0x3c')][_0x50af('0x1e')]);}return _0x3da468[_0x50af('0x6c')](_0xc38771);}})[_0x50af('0x29')](function(_0x51c922){if(_0x51c922){return _0x51c922?{'count':_0x275174,'rows':_0x51c922}:null;}})['then'](respondWithResult(_0x52733f,null))['catch'](handleError(_0x52733f,null));};exports['addTeams']=function(_0x5cea8c,_0x1adb3b,_0x28171b){var _0x190d2e=_0x5cea8c[_0x50af('0x54')][_0x50af('0x6e')];var _0x29299c=_['map'](_0x190d2e,'id');return db['Team']['findAll']({'where':{'id':_0x29299c},'attributes':['id'],'include':[{'model':db[_0x50af('0x6f')],'as':_0x50af('0x70'),'attributes':['id',_0x50af('0x35'),_0x50af('0x71'),_0x50af('0x72'),'interface'],'raw':!![]}]})['then'](function(_0x48004f){if(_0x48004f){var _0x224a83=_[_0x50af('0x73')](_0x48004f,function(_0x12d0ca){var _0x28dd61=_0x12d0ca[_0x50af('0x55')]({'plain':!![]});_0x28dd61[_0x50af('0x70')][_0x50af('0x74')](function(_0x41641b){_0x41641b[_0x50af('0x75')]=_[_0x50af('0x52')](_0x190d2e,{'id':_0x28dd61['id']})[_0x50af('0x75')];});return _0x28dd61['Agents'];});return db[_0x50af('0x4b')][_0x50af('0x52')]({'where':{'id':_0x5cea8c[_0x50af('0x50')]['id']}})[_0x50af('0x29')](function(_0x591a2e){return db[_0x50af('0x76')][_0x50af('0x77')](function(_0x4c5812){return _0x591a2e['addTeams'](_0x29299c,{'transaction':_0x4c5812})[_0x50af('0x29')](function(){return BPromise[_0x50af('0x78')](_0x190d2e,function(_0x59d9c1){return db[_0x50af('0x79')][_0x50af('0x7a')]({'TeamId':_0x59d9c1['id'],'VoiceQueueId':_0x5cea8c[_0x50af('0x50')]['id'],'penalty':_0x59d9c1[_0x50af('0x75')]},{'transaction':_0x4c5812});});})[_0x50af('0x29')](function(){return BPromise[_0x50af('0x78')](_0x224a83,function(_0x13d69d){return db[_0x50af('0x7b')]['findOrCreate']({'where':{'UserId':_0x13d69d['id'],'VoiceQueueId':_0x5cea8c[_0x50af('0x50')]['id']},'defaults':{'penalty':_0x13d69d[_0x50af('0x75')]},'transaction':_0x4c5812});});})['then'](function(){return BPromise['each'](_[_0x50af('0x2e')](_0x224a83,{'online':!![]}),function(_0xf8f767){return db['UserVoiceQueueRt'][_0x50af('0x7a')]({'membername':_0xf8f767[_0x50af('0x35')],'UserId':_0xf8f767['id'],'queue_name':_0x591a2e['name'],'VoiceQueueId':_0x591a2e['id'],'interface':_[_0x50af('0x7c')](_0xf8f767[_0x50af('0x7d')])?util[_0x50af('0x7e')](_0x50af('0x7f'),_0xf8f767['name']):_0xf8f767['interface'],'paused':_0xf8f767['voicePause']||![],'penalty':_0xf8f767['penalty']},{'transaction':_0x4c5812});});})['then'](function(){_0x224a83[_0x50af('0x74')](function(_0x4de85e){socket['emit'](_0x50af('0x80'),{'UserId':_0x4de85e['id'],'VoiceQueueId':_0x591a2e['id']});});});});});}})['then'](respondWithStatusCode(_0x1adb3b,null))[_0x50af('0x4e')](handleError(_0x1adb3b,null));};exports[_0x50af('0x81')]=function(_0x33fdd5,_0xf50795,_0x138e59){return db[_0x50af('0x6d')][_0x50af('0x4d')]({'where':{'id':_0x33fdd5[_0x50af('0x3c')][_0x50af('0x82')]},'attributes':['id'],'include':[{'model':db[_0x50af('0x6f')],'as':_0x50af('0x70'),'attributes':['id'],'raw':!![]}]})[_0x50af('0x29')](handleEntityNotFound(_0xf50795,null))[_0x50af('0x29')](function(_0x183d65){var _0xc1ec00=_[_0x50af('0x37')](_0x183d65,'id');var _0x34edfd=[];var _0x5cebfb=[];var _0x556e7d=squel[_0x50af('0x83')]();_0x556e7d['field'](_0x50af('0x84'))['from'](_0x50af('0x85'),'tq')['join'](_0x50af('0x86'),'ut',_0x50af('0x87'))[_0x50af('0x48')]('VoiceQueueId\x20=\x20?',_0x33fdd5[_0x50af('0x50')]['id']);for(var _0x2e8f8c=0x0;_0x2e8f8c<_0x183d65[_0x50af('0x41')];_0x2e8f8c+=0x1){let _0x9ebf6=_0x183d65[_0x2e8f8c];for(var _0x8786f5=0x0;_0x8786f5<_0x9ebf6[_0x50af('0x70')][_0x50af('0x41')];_0x8786f5+=0x1){let _0x1986ce=_0x9ebf6[_0x50af('0x70')][_0x8786f5];var _0x2de520=_0x556e7d[_0x50af('0x88')]();_0x2de520[_0x50af('0x48')](_0x50af('0x89'),_0x1986ce['id']);_0x5cebfb[_0x50af('0x8a')](db[_0x50af('0x76')][_0x50af('0x3c')](_0x2de520[_0x50af('0x8b')](),{'type':db[_0x50af('0x76')][_0x50af('0x8c')][_0x50af('0x8d')]})['then'](function(_0x550ada){if(_0x550ada['length']===0x1){return _0x1986ce['id'];}else{var _0x2609b1=_[_0x50af('0x8e')](_[_0x50af('0x37')](_0x550ada,_0x50af('0x8f')),function(_0x1e0450){return _[_0x50af('0x31')](_0xc1ec00,_0x1e0450);});if(_0x2609b1){return _0x1986ce['id'];}}}));}}return BPromise['all'](_0x5cebfb)[_0x50af('0x29')](function(_0x40e386){_0x34edfd=_(_0x34edfd)['union'](_0x40e386)['compact']()[_0x50af('0x30')]();return db[_0x50af('0x4b')][_0x50af('0x52')]({'where':{'id':_0x33fdd5[_0x50af('0x50')]['id']}})[_0x50af('0x29')](function(_0x4778bb){return db['sequelize'][_0x50af('0x77')](function(_0x8e972){return _0x4778bb[_0x50af('0x81')](_0x33fdd5[_0x50af('0x3c')][_0x50af('0x82')],{'transaction':_0x8e972})[_0x50af('0x29')](function(){if(!_[_0x50af('0x90')](_0x34edfd)){return _0x4778bb[_0x50af('0x91')](_0x34edfd,{'transaction':_0x8e972})[_0x50af('0x29')](function(){return db[_0x50af('0x92')][_0x50af('0x28')]({'where':{'VoiceQueueId':_0x33fdd5[_0x50af('0x50')]['id'],'UserId':_0x34edfd},'transaction':_0x8e972});});}})[_0x50af('0x29')](function(){_0x34edfd['forEach'](function(_0x34dc80){socket[_0x50af('0x93')]('userVoiceQueue:remove',{'UserId':_0x34dc80,'VoiceQueueId':_0x4778bb['id']});});});});});});})[_0x50af('0x29')](respondWithStatusCode(_0xf50795,null))[_0x50af('0x4e')](handleError(_0xf50795,null));};exports[_0x50af('0x94')]=function(_0x3495d1,_0x419d22,_0x4606a1){var _0x496f79,_0x16d709;return db['VoiceQueue'][_0x50af('0x52')]({'where':{'id':_0x3495d1[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x419d22,null))[_0x50af('0x29')](function(_0x58bf8a){if(_0x58bf8a){_0x16d709=_0x58bf8a;return _0x58bf8a['addAgents'](_0x3495d1[_0x50af('0x54')]['ids'],_[_0x50af('0x5e')](_0x3495d1[_0x50af('0x54')],[_0x50af('0x82'),'id'])||{})['spread'](function(_0xda14ed){for(var _0x5dda3b=0x0;_0x5dda3b<_0x3495d1[_0x50af('0x54')][_0x50af('0x82')][_0x50af('0x41')];_0x5dda3b+=0x1){socket[_0x50af('0x93')](_0x50af('0x80'),{'UserId':Number(_0x3495d1[_0x50af('0x54')]['ids'][_0x5dda3b]),'VoiceQueueId':Number(_0x3495d1['params']['id'])});}return _0xda14ed;});}})[_0x50af('0x29')](function(_0xff1721){_0x496f79=_0xff1721||[];if(_0x16d709){return db[_0x50af('0x6f')][_0x50af('0x4d')]({'where':{'id':_0x3495d1[_0x50af('0x54')]['ids']},'attributes':['id',_0x50af('0x35'),_0x50af('0x71'),_0x50af('0x72'),_0x50af('0x7d')],'raw':!![]});}})[_0x50af('0x29')](function(_0x3fa44b){if(!_[_0x50af('0x90')](_0x3fa44b)){var _0x2a8745=[];for(var _0x2763b7=0x0;_0x2763b7<_0x3fa44b[_0x50af('0x41')];_0x2763b7++){if(_0x3fa44b[_0x2763b7][_0x50af('0x71')]){_0x2a8745[_0x50af('0x8a')](db[_0x50af('0x92')][_0x50af('0x7a')]({'membername':_0x3fa44b[_0x2763b7][_0x50af('0x35')],'UserId':_0x3fa44b[_0x2763b7]['id'],'queue_name':_0x16d709['name'],'VoiceQueueId':_0x16d709['id'],'interface':_[_0x50af('0x7c')](_0x3fa44b[_0x2763b7][_0x50af('0x7d')])?util[_0x50af('0x7e')](_0x50af('0x7f'),_0x3fa44b[_0x2763b7][_0x50af('0x35')]):_0x3fa44b[_0x2763b7][_0x50af('0x7d')],'paused':_0x3fa44b[_0x2763b7][_0x50af('0x72')]||![],'penalty':_0x3495d1[_0x50af('0x54')]['penalty']||0x0}));}}return BPromise[_0x50af('0x95')](_0x2a8745);}})['then'](function(){return _0x496f79;})[_0x50af('0x29')](respondWithResult(_0x419d22,null))[_0x50af('0x4e')](handleError(_0x419d22,null));};exports[_0x50af('0x91')]=function(_0x1251fd,_0x19d883,_0x5bd11a){return db[_0x50af('0x4b')][_0x50af('0x52')]({'where':{'id':_0x1251fd['params']['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x19d883,null))[_0x50af('0x29')](function(_0x1e0587){if(_0x1e0587){return _0x1e0587['removeAgents'](_0x1251fd[_0x50af('0x3c')][_0x50af('0x82')])[_0x50af('0x29')](function(){if(_[_0x50af('0x96')](_0x1251fd[_0x50af('0x3c')][_0x50af('0x82')])){for(var _0x27c566=0x0;_0x27c566<_0x1251fd['query']['ids'][_0x50af('0x41')];_0x27c566+=0x1){socket[_0x50af('0x93')](_0x50af('0x97'),{'UserId':Number(_0x1251fd[_0x50af('0x3c')]['ids'][_0x27c566]),'VoiceQueueId':Number(_0x1251fd[_0x50af('0x50')]['id'])});}}else{socket[_0x50af('0x93')](_0x50af('0x97'),{'UserId':Number(_0x1251fd[_0x50af('0x3c')][_0x50af('0x82')]),'VoiceQueueId':Number(_0x1251fd['params']['id'])});}});}})[_0x50af('0x29')](function(_0x2fbc27){return db[_0x50af('0x92')]['destroy']({'where':{'VoiceQueueId':_0x1251fd[_0x50af('0x50')]['id'],'UserId':_0x1251fd['query'][_0x50af('0x82')]}})[_0x50af('0x29')](function(){return _0x2fbc27;});})[_0x50af('0x29')](respondWithStatusCode(_0x19d883,null))[_0x50af('0x4e')](handleError(_0x19d883,null));};exports[_0x50af('0x98')]=function(_0x9e4f44,_0x539f75,_0x221ffb){var _0x441016={};var _0x1af3f0={};var _0xad7fb0;var _0x12936c;return db['VoiceQueue']['findOne']({'where':{'id':_0x9e4f44[_0x50af('0x50')]['id']}})['then'](handleEntityNotFound(_0x539f75,null))[_0x50af('0x29')](function(_0xf7d887){if(_0xf7d887){_0xad7fb0=_0xf7d887;_0x1af3f0[_0x50af('0x3b')]=_['keys'](db['User'][_0x50af('0x5d')]);_0x1af3f0[_0x50af('0x3c')]=_['keys'](_0x9e4f44[_0x50af('0x3c')]);_0x1af3f0[_0x50af('0x46')]=_[_0x50af('0x3e')](_0x1af3f0[_0x50af('0x3b')],_0x1af3f0[_0x50af('0x3c')]);_0x441016['attributes']=_[_0x50af('0x3e')](_0x1af3f0[_0x50af('0x3b')],qs[_0x50af('0x40')](_0x9e4f44[_0x50af('0x3c')][_0x50af('0x40')]));_0x441016[_0x50af('0x3f')]=_0x441016['attributes'][_0x50af('0x41')]?_0x441016[_0x50af('0x3f')]:_0x1af3f0[_0x50af('0x3b')];_0x441016['order']=qs[_0x50af('0x45')](_0x9e4f44['query']['sort']);_0x441016[_0x50af('0x48')]=qs[_0x50af('0x46')](_['pick'](_0x9e4f44[_0x50af('0x3c')],_0x1af3f0[_0x50af('0x46')]));if(_0x9e4f44[_0x50af('0x3c')]['filter']){_0x441016[_0x50af('0x48')]=_[_0x50af('0x49')](_0x441016[_0x50af('0x48')],{'$or':_[_0x50af('0x37')](_0x441016['attributes'],function(_0x36763a){var _0x3845cb={};_0x3845cb[_0x36763a]={'$like':'%'+_0x9e4f44[_0x50af('0x3c')]['filter']+'%'};return _0x3845cb;})});}_0x441016=_[_0x50af('0x49')]({},_0x441016,_0x9e4f44[_0x50af('0x4a')]);return _0xad7fb0[_0x50af('0x98')](_0x441016);}})[_0x50af('0x29')](function(_0x428ce){if(_0x428ce){_0x12936c=_0x428ce[_0x50af('0x41')];if(!_0x9e4f44['query']['hasOwnProperty'](_0x50af('0x43'))){_0x441016['limit']=qs['limit'](_0x9e4f44[_0x50af('0x3c')][_0x50af('0x20')]);_0x441016[_0x50af('0x1e')]=qs[_0x50af('0x1e')](_0x9e4f44['query'][_0x50af('0x1e')]);}return _0xad7fb0[_0x50af('0x98')](_0x441016);}})[_0x50af('0x29')](function(_0x2b57ec){if(_0x2b57ec){return _0x2b57ec?{'count':_0x12936c,'rows':_0x2b57ec}:null;}})[_0x50af('0x29')](respondWithResult(_0x539f75,null))[_0x50af('0x4e')](handleError(_0x539f75,null));};exports[_0x50af('0x99')]=function(_0x57b2f8,_0xe909b1,_0x16ef0a){var _0x2c5f55={};var _0x2f2677={};var _0x2c8674;var _0x89a1ab;return db[_0x50af('0x4b')][_0x50af('0x68')]({'where':{'id':_0x57b2f8[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0xe909b1,null))[_0x50af('0x29')](function(_0x5ad546){if(_0x5ad546){_0x2c8674=_0x5ad546;_0x2f2677[_0x50af('0x3b')]=_['keys'](db[_0x50af('0x92')]['rawAttributes']);_0x2f2677[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x57b2f8[_0x50af('0x3c')]);_0x2f2677['filters']=_[_0x50af('0x3e')](_0x2f2677[_0x50af('0x3b')],_0x2f2677[_0x50af('0x3c')]);_0x2c5f55[_0x50af('0x3f')]=_[_0x50af('0x3e')](_0x2f2677[_0x50af('0x3b')],qs[_0x50af('0x40')](_0x57b2f8[_0x50af('0x3c')][_0x50af('0x40')]));_0x2c5f55['attributes']=_0x2c5f55[_0x50af('0x3f')][_0x50af('0x41')]?_0x2c5f55['attributes']:_0x2f2677[_0x50af('0x3b')];_0x2c5f55[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x57b2f8[_0x50af('0x3c')][_0x50af('0x45')]);_0x2c5f55[_0x50af('0x48')]=qs[_0x50af('0x46')](_[_0x50af('0x47')](_0x57b2f8[_0x50af('0x3c')],_0x2f2677[_0x50af('0x46')]));if(_0x57b2f8[_0x50af('0x3c')][_0x50af('0x2e')]){_0x2c5f55[_0x50af('0x48')]=_[_0x50af('0x49')](_0x2c5f55[_0x50af('0x48')],{'$or':_[_0x50af('0x37')](_0x2c5f55['attributes'],function(_0xd7f9de){var _0x361bad={};_0x361bad[_0xd7f9de]={'$like':'%'+_0x57b2f8['query']['filter']+'%'};return _0x361bad;})});}_0x2c5f55=_[_0x50af('0x49')]({},_0x2c5f55,_0x57b2f8['options']);return _0x2c8674[_0x50af('0x99')](_0x2c5f55);}})['then'](function(_0x33dcae){if(_0x33dcae){_0x89a1ab=_0x33dcae[_0x50af('0x41')];if(!_0x57b2f8[_0x50af('0x3c')][_0x50af('0x42')]('nolimit')){_0x2c5f55[_0x50af('0x20')]=qs[_0x50af('0x20')](_0x57b2f8['query'][_0x50af('0x20')]);_0x2c5f55[_0x50af('0x1e')]=qs['offset'](_0x57b2f8[_0x50af('0x3c')][_0x50af('0x1e')]);}return _0x2c8674[_0x50af('0x99')](_0x2c5f55);}})[_0x50af('0x29')](function(_0xd25266){return _0xd25266?{'count':_0x89a1ab,'rows':_0xd25266}:null;})[_0x50af('0x29')](respondWithResult(_0xe909b1,null))[_0x50af('0x4e')](handleError(_0xe909b1,null));};exports[_0x50af('0x9a')]=function(_0x564ecc,_0x1d8285,_0x25f216){var _0x28a51b={};var _0xdfa7c={};var _0x47fb4a;var _0x55f08f;return db[_0x50af('0x4b')][_0x50af('0x68')]({'where':{'id':_0x564ecc['params']['id']}})['then'](handleEntityNotFound(_0x1d8285,null))[_0x50af('0x29')](function(_0x1bfc07){if(_0x1bfc07){_0x47fb4a=_0x1bfc07;_0xdfa7c['model']=_[_0x50af('0x3d')](db[_0x50af('0x9b')]['rawAttributes']);_0xdfa7c['query']=_[_0x50af('0x3d')](_0x564ecc[_0x50af('0x3c')]);_0xdfa7c['filters']=_[_0x50af('0x3e')](_0xdfa7c['model'],_0xdfa7c[_0x50af('0x3c')]);_0x28a51b[_0x50af('0x3f')]=_[_0x50af('0x3e')](_0xdfa7c[_0x50af('0x3b')],qs[_0x50af('0x40')](_0x564ecc[_0x50af('0x3c')]['fields']));_0x28a51b[_0x50af('0x3f')]=_0x28a51b[_0x50af('0x3f')]['length']?_0x28a51b[_0x50af('0x3f')]:_0xdfa7c[_0x50af('0x3b')];_0x28a51b[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x564ecc[_0x50af('0x3c')][_0x50af('0x45')]);_0x28a51b[_0x50af('0x48')]=qs[_0x50af('0x46')](_[_0x50af('0x47')](_0x564ecc[_0x50af('0x3c')],_0xdfa7c[_0x50af('0x46')]));if(_0x564ecc[_0x50af('0x3c')][_0x50af('0x2e')]){_0x28a51b[_0x50af('0x48')]=_['merge'](_0x28a51b[_0x50af('0x48')],{'$or':_[_0x50af('0x37')](_0x28a51b[_0x50af('0x3f')],function(_0x3f429c){var _0x467298={};_0x467298[_0x3f429c]={'$like':'%'+_0x564ecc[_0x50af('0x3c')][_0x50af('0x2e')]+'%'};return _0x467298;})});}_0x28a51b=_[_0x50af('0x49')]({},_0x28a51b,_0x564ecc[_0x50af('0x4a')]);return _0x47fb4a[_0x50af('0x9a')](_0x28a51b);}})[_0x50af('0x29')](function(_0x198ceb){if(_0x198ceb){_0x55f08f=_0x198ceb['length'];if(!_0x564ecc[_0x50af('0x3c')]['hasOwnProperty'](_0x50af('0x43'))){_0x28a51b[_0x50af('0x20')]=qs[_0x50af('0x20')](_0x564ecc['query'][_0x50af('0x20')]);_0x28a51b[_0x50af('0x1e')]=qs['offset'](_0x564ecc[_0x50af('0x3c')][_0x50af('0x1e')]);}return _0x47fb4a[_0x50af('0x9a')](_0x28a51b);}})[_0x50af('0x29')](function(_0x2d3c5f){if(_0x2d3c5f){return _0x2d3c5f?{'count':_0x55f08f,'rows':_0x2d3c5f}:null;}})[_0x50af('0x29')](respondWithResult(_0x1d8285,null))[_0x50af('0x4e')](handleError(_0x1d8285,null));};exports[_0x50af('0x9c')]=function(_0x3aeb73,_0x5c2065,_0x31b0a1){var _0x3d908f=moment()[_0x50af('0x7e')](_0x50af('0x9d'));var _0x54d636,_0xf15b61;return db[_0x50af('0x4b')]['find']({'where':{'id':_0x3aeb73[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x5c2065,null))['then'](function(_0x273f31){if(_0x273f31){_0xf15b61=_0x273f31;return _0x273f31[_0x50af('0x9c')](_0x3aeb73[_0x50af('0x54')][_0x50af('0x82')],_[_0x50af('0x5e')](_0x3aeb73[_0x50af('0x54')],['ids','id'])||{});}return null;})[_0x50af('0x9e')](function(_0x337997){var _0x22213a;_0x54d636=_0x337997||[];var _0x522918=[];if(_0x337997){for(var _0x2f40b4=0x0;_0x2f40b4<_0x337997[_0x50af('0x41')];_0x2f40b4+=0x1){var _0x4e30ad=_0x337997[_0x2f40b4][_0x50af('0x55')]({'plain':!![]});_0xf15b61[_0x50af('0x9f')]=_0x3aeb73[_0x50af('0x54')][_0x50af('0x9f')]?_0x3aeb73[_0x50af('0x54')][_0x50af('0x9f')]:_0xf15b61[_0x50af('0x9f')];switch(_0xf15b61[_0x50af('0x9f')]){case _0x50af('0xa0'):_0x22213a=squel[_0x50af('0xa1')]()['into'](_0x50af('0xa2'))[_0x50af('0xa3')](['phone',_0x50af('0xa4'),_0x50af('0xa5'),_0x50af('0xa6'),_0x50af('0x63'),'createdAt','updatedAt'],squel[_0x50af('0x83')]()[_0x50af('0xa7')](_0x50af('0xa8'),_0x50af('0xa8'))[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27',_0x50af('0xa4'))[_0x50af('0xa7')]('id','ContactId')[_0x50af('0xa7')](_0x4e30ad[_0x50af('0xa9')][_0x50af('0x8b')](),_0x50af('0xa6'))[_0x50af('0xa7')](_0x3aeb73[_0x50af('0x50')]['id'][_0x50af('0x8b')](),_0x50af('0x63'))[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27',_0x50af('0x5f'))['field']('\x27'+_0x3d908f+'\x27',_0x50af('0x60'))[_0x50af('0xaa')](_0x50af('0xab'))[_0x50af('0x48')](_0x50af('0xac'))['where'](_0x50af('0xad'),_0x4e30ad[_0x50af('0xa9')]['toString']())[_0x50af('0x48')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x50af('0xae'),squel['select']()[_0x50af('0xa7')](_0x50af('0xaf'))[_0x50af('0xaa')](_0x50af('0xb0'))['where'](_0x50af('0xb1'),_0x3aeb73[_0x50af('0x50')]['id'][_0x50af('0x8b')]()))['where'](_0x50af('0xae'),squel[_0x50af('0x83')]()['field'](_0x50af('0xb2'))[_0x50af('0xaa')]('cm_hopper')[_0x50af('0x48')](_0x50af('0xb1'),_0x3aeb73[_0x50af('0x50')]['id'][_0x50af('0x8b')]())))['toString']();break;case _0x50af('0xb3'):_0x22213a=squel[_0x50af('0xa1')]()[_0x50af('0xb4')](_0x50af('0xa2'))[_0x50af('0xa3')]([_0x50af('0xa8'),_0x50af('0xa4'),'ContactId',_0x50af('0xa6'),_0x50af('0x63'),_0x50af('0x5f'),'updatedAt'],squel[_0x50af('0x83')]()[_0x50af('0xa7')](_0x50af('0xa8'),'phone')['field']('\x27'+_0x3d908f+'\x27',_0x50af('0xa4'))[_0x50af('0xa7')]('id','ContactId')['field'](_0x4e30ad[_0x50af('0xa9')]['toString'](),'ListId')[_0x50af('0xa7')](_0x3aeb73['params']['id'][_0x50af('0x8b')](),_0x50af('0x63'))[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27',_0x50af('0x5f'))[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27',_0x50af('0x60'))[_0x50af('0xaa')](_0x50af('0xab'))[_0x50af('0x48')](_0x50af('0xac'))[_0x50af('0x48')](_0x50af('0xad'),_0x4e30ad[_0x50af('0xa9')][_0x50af('0x8b')]())[_0x50af('0x48')](_0x50af('0xb5'))[_0x50af('0x48')](_0x50af('0xae'),squel['select']()[_0x50af('0xa7')](_0x50af('0xb2'))['from'](_0x50af('0xa2'))['where']('VoiceQueueId\x20=\x20?',_0x3aeb73[_0x50af('0x50')]['id']['toString']())))['toString']();break;default:_0x22213a=squel['insert']()[_0x50af('0xb4')](_0x50af('0xa2'))['fromQuery']([_0x50af('0xa8'),_0x50af('0xa4'),'ContactId',_0x50af('0xa6'),_0x50af('0x63'),_0x50af('0x5f'),'updatedAt'],squel[_0x50af('0x83')]()[_0x50af('0xa7')]('phone',_0x50af('0xa8'))[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27',_0x50af('0xa4'))[_0x50af('0xa7')]('id',_0x50af('0xa5'))[_0x50af('0xa7')](_0x4e30ad['CmListId'][_0x50af('0x8b')](),_0x50af('0xa6'))[_0x50af('0xa7')](_0x3aeb73[_0x50af('0x50')]['id']['toString'](),_0x50af('0x63'))[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27',_0x50af('0x5f'))['field']('\x27'+_0x3d908f+'\x27',_0x50af('0x60'))['from'](_0x50af('0xab'))[_0x50af('0x48')]('deletedAt\x20IS\x20NULL')[_0x50af('0x48')](_0x50af('0xad'),_0x4e30ad['CmListId']['toString']())[_0x50af('0x48')](_0x50af('0xb5')))[_0x50af('0x8b')]();}_0x522918['push'](db[_0x50af('0x76')][_0x50af('0x3c')](_0x22213a));}return BPromise[_0x50af('0x95')](_0x522918);}})[_0x50af('0x29')](function(){var _0x4784d7=[];var _0x48066b=squel[_0x50af('0xa1')]()[_0x50af('0xb4')](_0x50af('0xb6'))[_0x50af('0xa3')]([_0x50af('0xb7'),_0x50af('0xa8'),'OrderBy',_0x50af('0x5f'),_0x50af('0x60')],squel['select']()['field']('h.id')[_0x50af('0xa7')](_0x50af('0xb8'))[_0x50af('0xa7')](_0x50af('0xb9'))[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27','createdAt')[_0x50af('0xa7')]('\x27'+_0x3d908f+'\x27',_0x50af('0x60'))['from'](_0x50af('0xba'),'ci')[_0x50af('0xbb')]('cm_hopper','h',_0x50af('0xbc'))['where'](_0x50af('0xbd'),_0x3d908f)[_0x50af('0x48')](_0x50af('0xbe'),_0x50af('0xbf')))[_0x50af('0x8b')]();_0x4784d7[_0x50af('0x8a')](db['sequelize']['query'](_0x48066b));return BPromise[_0x50af('0x95')](_0x4784d7);})['then'](function(){return _0x54d636;})[_0x50af('0x29')](respondWithResult(_0x5c2065,null))[_0x50af('0x4e')](handleError(_0x5c2065,null));};exports[_0x50af('0xc0')]=function(_0x4c0898,_0x5de9c3,_0x41f6ad){return db[_0x50af('0x4b')][_0x50af('0x52')]({'where':{'id':_0x4c0898[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x5de9c3,null))[_0x50af('0x29')](function(_0x570016){if(_0x570016){return _0x570016[_0x50af('0xc0')](_0x4c0898[_0x50af('0x3c')][_0x50af('0x82')]);}})[_0x50af('0x29')](function(_0x285c5c){if(_0x285c5c){return db[_0x50af('0x64')][_0x50af('0x28')]({'where':{'ListId':_0x4c0898[_0x50af('0x3c')]['ids'],'VoiceQueueId':_0x4c0898[_0x50af('0x50')]['id']}})[_0x50af('0x29')](function(){return _0x285c5c;});}})[_0x50af('0x29')](respondWithStatusCode(_0x5de9c3,null))[_0x50af('0x4e')](handleError(_0x5de9c3,null));};exports[_0x50af('0xc1')]=function(_0x3b97db,_0x514f63,_0x38e1d7){var _0x1305ff={};var _0x156d4c={};var _0x593d05;var _0x5a1c28;return db['VoiceQueue'][_0x50af('0x68')]({'where':{'id':_0x3b97db[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x514f63,null))[_0x50af('0x29')](function(_0x1323a7){if(_0x1323a7){_0x593d05=_0x1323a7;_0x156d4c[_0x50af('0x3b')]=_[_0x50af('0x3d')](db[_0x50af('0x9b')][_0x50af('0x5d')]);_0x156d4c[_0x50af('0x3c')]=_[_0x50af('0x3d')](_0x3b97db[_0x50af('0x3c')]);_0x156d4c[_0x50af('0x46')]=_[_0x50af('0x3e')](_0x156d4c['model'],_0x156d4c['query']);_0x1305ff[_0x50af('0x3f')]=_[_0x50af('0x3e')](_0x156d4c[_0x50af('0x3b')],qs['fields'](_0x3b97db[_0x50af('0x3c')][_0x50af('0x40')]));_0x1305ff['attributes']=_0x1305ff[_0x50af('0x3f')][_0x50af('0x41')]?_0x1305ff['attributes']:_0x156d4c['model'];_0x1305ff[_0x50af('0x44')]=qs[_0x50af('0x45')](_0x3b97db['query']['sort']);_0x1305ff[_0x50af('0x48')]=qs[_0x50af('0x46')](_[_0x50af('0x47')](_0x3b97db['query'],_0x156d4c['filters']));if(_0x3b97db['query'][_0x50af('0x2e')]){_0x1305ff['where']=_[_0x50af('0x49')](_0x1305ff[_0x50af('0x48')],{'$or':_[_0x50af('0x37')](_0x1305ff[_0x50af('0x3f')],function(_0x3044bb){var _0x14b66a={};_0x14b66a[_0x3044bb]={'$like':'%'+_0x3b97db[_0x50af('0x3c')][_0x50af('0x2e')]+'%'};return _0x14b66a;})});}_0x1305ff=_['merge']({},_0x1305ff,_0x3b97db['options']);return _0x593d05['getBlackLists'](_0x1305ff);}})['then'](function(_0xba20d9){if(_0xba20d9){_0x5a1c28=_0xba20d9[_0x50af('0x41')];if(!_0x3b97db['query'][_0x50af('0x42')](_0x50af('0x43'))){_0x1305ff[_0x50af('0x20')]=qs[_0x50af('0x20')](_0x3b97db[_0x50af('0x3c')][_0x50af('0x20')]);_0x1305ff[_0x50af('0x1e')]=qs['offset'](_0x3b97db[_0x50af('0x3c')]['offset']);}return _0x593d05[_0x50af('0xc1')](_0x1305ff);}})[_0x50af('0x29')](function(_0x289d3c){if(_0x289d3c){return _0x289d3c?{'count':_0x5a1c28,'rows':_0x289d3c}:null;}})['then'](respondWithResult(_0x514f63,null))[_0x50af('0x4e')](handleError(_0x514f63,null));};exports['addBlackLists']=function(_0x163511,_0x3a9365,_0x14ac07){var _0x3a5cd7,_0x2b7951;return db['VoiceQueue'][_0x50af('0x52')]({'where':{'id':_0x163511[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x3a9365,null))[_0x50af('0x29')](function(_0x5f2437){if(_0x5f2437){_0x2b7951=_0x5f2437;return _0x5f2437['addBlackLists'](_0x163511[_0x50af('0x54')][_0x50af('0x82')],_[_0x50af('0x5e')](_0x163511['body'],['ids','id'])||{});}return null;})[_0x50af('0x9e')](function(_0x38cb40){var _0x5590de;_0x3a5cd7=_0x38cb40||[];var _0x2cb9b8=[];if(_0x38cb40){for(var _0x2b4dcb=0x0;_0x2b4dcb<_0x38cb40[_0x50af('0x41')];_0x2b4dcb+=0x1){var _0x54f412=_0x38cb40[_0x2b4dcb]['get']({'plain':!![]});_0x5590de=squel[_0x50af('0xa1')]()[_0x50af('0xb4')](_0x50af('0xc2'))['fromQuery']([_0x50af('0xa8'),'ContactId',_0x50af('0xa6'),'VoiceQueueId',_0x50af('0x5f'),'updatedAt'],squel[_0x50af('0x83')]()[_0x50af('0xa7')](_0x50af('0xa8'),_0x50af('0xa8'))[_0x50af('0xa7')]('id',_0x50af('0xa5'))[_0x50af('0xa7')](_0x54f412[_0x50af('0xa9')]['toString'](),_0x50af('0xa6'))[_0x50af('0xa7')](_0x163511[_0x50af('0x50')]['id'][_0x50af('0x8b')](),_0x50af('0x63'))[_0x50af('0xa7')](_0x50af('0xc3'),_0x50af('0x5f'))[_0x50af('0xa7')]('NOW()',_0x50af('0x60'))['from'](_0x50af('0xab'))[_0x50af('0x48')](_0x50af('0xac'))['where'](_0x50af('0xad'),_0x54f412[_0x50af('0xa9')][_0x50af('0x8b')]())[_0x50af('0x48')](_0x50af('0xb5')))[_0x50af('0x8b')]();_0x2cb9b8[_0x50af('0x8a')](db[_0x50af('0x76')][_0x50af('0x3c')](_0x5590de));}return BPromise[_0x50af('0x95')](_0x2cb9b8);}})[_0x50af('0x29')](function(){return _0x3a5cd7;})[_0x50af('0x29')](respondWithResult(_0x3a9365,null))[_0x50af('0x4e')](handleError(_0x3a9365,null));};exports[_0x50af('0xc4')]=function(_0x1882eb,_0x5676e2,_0xa78fa0){return db['VoiceQueue'][_0x50af('0x52')]({'where':{'id':_0x1882eb[_0x50af('0x50')]['id']}})[_0x50af('0x29')](handleEntityNotFound(_0x5676e2,null))[_0x50af('0x29')](function(_0x17b863){if(_0x17b863){return _0x17b863['removeBlackLists'](_0x1882eb[_0x50af('0x3c')][_0x50af('0x82')]);}})[_0x50af('0x29')](function(_0x5258a2){if(_0x5258a2){return db[_0x50af('0x6b')][_0x50af('0x28')]({'where':{'ListId':_0x1882eb[_0x50af('0x3c')][_0x50af('0x82')],'VoiceQueueId':_0x1882eb[_0x50af('0x50')]['id']}})[_0x50af('0x29')](function(){return _0x5258a2;});}})[_0x50af('0x29')](respondWithStatusCode(_0x5676e2,null))[_0x50af('0x4e')](handleError(_0x5676e2,null));}; \ No newline at end of file +var _0x15c6=['interface','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','ids','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','isArray','userVoiceQueue:remove','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','select','phone','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','outbound','getHoppers','findOne','CmHopper','length','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online'];(function(_0x1fcd82,_0x567878){var _0x8b9d0f=function(_0x3f7059){while(--_0x3f7059){_0x1fcd82['push'](_0x1fcd82['shift']());}};_0x8b9d0f(++_0x567878);}(_0x15c6,0x1cd));var _0x615c=function(_0x843880,_0x1516d1){_0x843880=_0x843880-0x0;var _0x49943f=_0x15c6[_0x843880];return _0x49943f;};'use strict';var emlformat=require(_0x615c('0x0'));var rimraf=require(_0x615c('0x1'));var zipdir=require(_0x615c('0x2'));var jsonpatch=require(_0x615c('0x3'));var rp=require(_0x615c('0x4'));var moment=require(_0x615c('0x5'));var BPromise=require(_0x615c('0x6'));var Mustache=require(_0x615c('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x615c('0x8'));var ejs=require(_0x615c('0x9'));var fs=require('fs');var fs_extra=require(_0x615c('0xa'));var _=require('lodash');var squel=require(_0x615c('0xb'));var crypto=require(_0x615c('0xc'));var jsforce=require(_0x615c('0xd'));var deskjs=require(_0x615c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x615c('0xf'));var Papa=require('papaparse');var Redis=require(_0x615c('0x10'));var authService=require(_0x615c('0x11'));var qs=require(_0x615c('0x12'));var as=require(_0x615c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x615c('0x14'));var utils=require(_0x615c('0x15'));var config=require(_0x615c('0x16'));var licenseUtil=require(_0x615c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x615c('0x18')](config[_0x615c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x615c('0x1a'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x615c('0x1b')](socket);function respondWithStatusCode(_0x11d751,_0x2e9dd9){_0x2e9dd9=_0x2e9dd9||0xcc;return function(_0x11e338){if(_0x11e338){return _0x11d751[_0x615c('0x1c')](_0x2e9dd9);}return _0x11d751[_0x615c('0x1d')](_0x2e9dd9)['end']();};}function respondWithResult(_0x2d10d2,_0x41dee1){_0x41dee1=_0x41dee1||0xc8;return function(_0x30205d){if(_0x30205d){return _0x2d10d2['status'](_0x41dee1)[_0x615c('0x1e')](_0x30205d);}};}function respondWithFilteredResult(_0x3953aa,_0x12dcda){return function(_0x1e0d18){if(_0x1e0d18){var _0x1badec=typeof _0x12dcda[_0x615c('0x1f')]===_0x615c('0x20')&&typeof _0x12dcda[_0x615c('0x21')]==='undefined';var _0x504e63=_0x1e0d18['count'];var _0x2cbe15=_0x1badec?0x0:_0x12dcda[_0x615c('0x1f')];var _0x348280=_0x1badec?_0x1e0d18[_0x615c('0x22')]:_0x12dcda['offset']+_0x12dcda['limit'];var _0x2f77cc;if(_0x348280>=_0x504e63){_0x348280=_0x504e63;_0x2f77cc=0xc8;}else{_0x2f77cc=0xce;}_0x3953aa['status'](_0x2f77cc);return _0x3953aa[_0x615c('0x23')]('Content-Range',_0x2cbe15+'-'+_0x348280+'/'+_0x504e63)[_0x615c('0x1e')](_0x1e0d18);}return null;};}function patchUpdates(_0x508ea5){return function(_0xcc25fb){try{jsonpatch[_0x615c('0x24')](_0xcc25fb,_0x508ea5,!![]);}catch(_0x5d148b){return BPromise['reject'](_0x5d148b);}return _0xcc25fb[_0x615c('0x25')]();};}function saveUpdates(_0x4117f5,_0x29bad0){return function(_0x42ee58){if(_0x42ee58){return _0x42ee58[_0x615c('0x26')](_0x4117f5)['then'](function(_0x32635f){return _0x32635f;});}return null;};}function removeEntity(_0x2f1959,_0x5968aa){return function(_0x49a14a){if(_0x49a14a){return _0x49a14a[_0x615c('0x27')]()[_0x615c('0x28')](function(){var _0x8671eb=_0x49a14a['get']({'plain':!![]});var _0x32ce76=[{'name':_0x615c('0x29'),'value':_0x615c('0x2a'),'ignore':![]},{'name':_0x615c('0x2b'),'value':'outbound','ignore':![]}];var _0x25101f=_(_0x32ce76)[_0x615c('0x2c')](_0x615c('0x2d'))[_0x615c('0x2e')](_0x615c('0x2f'))[_0x615c('0x2f')]();if(_[_0x615c('0x30')](_0x25101f,_0x8671eb[_0x615c('0x31')])){return;}var _0x3339d4=_[_0x615c('0x32')](_0x32ce76,[_0x615c('0x2f'),_0x8671eb[_0x615c('0x31')]])[_0x615c('0x33')];return db[_0x615c('0x34')]['destroy']({'where':{'type':_0x3339d4,'resourceId':_0x8671eb['id']}})[_0x615c('0x28')](function(){return _0x49a14a;});})[_0x615c('0x28')](function(){_0x2f1959[_0x615c('0x1d')](0xcc)[_0x615c('0x35')]();});}};}function handleEntityNotFound(_0x1daf84,_0x42f99d){return function(_0x49ed0d){if(!_0x49ed0d){_0x1daf84[_0x615c('0x1c')](0x194);}return _0x49ed0d;};}function handleError(_0x25c40a,_0x2478c2){_0x2478c2=_0x2478c2||0x1f4;return function(_0xcd2b9d){logger[_0x615c('0x36')](_0xcd2b9d['stack']);if(_0xcd2b9d[_0x615c('0x33')]){delete _0xcd2b9d['name'];}_0x25c40a[_0x615c('0x1d')](_0x2478c2)[_0x615c('0x37')](_0xcd2b9d);};}exports[_0x615c('0x38')]=function(_0x248423,_0x14926e){var _0x3d82b5={},_0x48de1b={},_0x193eed={'count':0x0,'rows':[]};var _0x84de42=_[_0x615c('0x2e')](db[_0x615c('0x39')][_0x615c('0x3a')],function(_0x2f1ac6){return{'name':_0x2f1ac6[_0x615c('0x3b')],'type':_0x2f1ac6['type'][_0x615c('0x3c')]};});_0x48de1b[_0x615c('0x3d')]=_[_0x615c('0x2e')](_0x84de42,_0x615c('0x33'));_0x48de1b['query']=_[_0x615c('0x3e')](_0x248423[_0x615c('0x3f')]);_0x48de1b[_0x615c('0x40')]=_[_0x615c('0x41')](_0x48de1b['model'],_0x48de1b['query']);_0x3d82b5[_0x615c('0x42')]=_[_0x615c('0x41')](_0x48de1b[_0x615c('0x3d')],qs['fields'](_0x248423[_0x615c('0x3f')][_0x615c('0x43')]));_0x3d82b5[_0x615c('0x42')]=_0x3d82b5[_0x615c('0x42')]['length']?_0x3d82b5['attributes']:_0x48de1b[_0x615c('0x3d')];if(!_0x248423['query'][_0x615c('0x44')](_0x615c('0x45'))){_0x3d82b5[_0x615c('0x21')]=qs['limit'](_0x248423[_0x615c('0x3f')][_0x615c('0x21')]);_0x3d82b5[_0x615c('0x1f')]=qs[_0x615c('0x1f')](_0x248423[_0x615c('0x3f')]['offset']);}_0x3d82b5[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x248423['query']['sort']);_0x3d82b5['where']=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x248423['query'],_0x48de1b['filters']),_0x84de42);if(_0x248423[_0x615c('0x3f')][_0x615c('0x2c')]){_0x3d82b5[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x3d82b5[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x84de42,function(_0x238910){if(_0x238910[_0x615c('0x31')]!==_0x615c('0x4b')){var _0x43920f={};_0x43920f[_0x238910['name']]={'$like':'%'+_0x248423[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x43920f;}})});}_0x3d82b5=_[_0x615c('0x4a')]({},_0x3d82b5,_0x248423[_0x615c('0x4c')]);var _0x50b756={'where':_0x3d82b5[_0x615c('0x49')]};return db[_0x615c('0x39')][_0x615c('0x22')](_0x50b756)[_0x615c('0x28')](function(_0x33a4b3){_0x193eed[_0x615c('0x22')]=_0x33a4b3;if(_0x248423['query'][_0x615c('0x4d')]){_0x3d82b5['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x615c('0x4e')](_0x3d82b5);})['then'](function(_0x3f6156){_0x193eed[_0x615c('0x4f')]=_0x3f6156;return _0x193eed;})[_0x615c('0x28')](respondWithFilteredResult(_0x14926e,_0x3d82b5))[_0x615c('0x50')](handleError(_0x14926e,null));};exports[_0x615c('0x51')]=function(_0x20116d,_0x251e95){var _0x540c5c={'raw':![],'where':{'id':_0x20116d[_0x615c('0x52')]['id']}},_0x38fbe0={};_0x38fbe0['model']=_[_0x615c('0x3e')](db[_0x615c('0x39')][_0x615c('0x3a')]);_0x38fbe0['query']=_[_0x615c('0x3e')](_0x20116d[_0x615c('0x3f')]);_0x38fbe0[_0x615c('0x40')]=_['intersection'](_0x38fbe0[_0x615c('0x3d')],_0x38fbe0['query']);_0x540c5c[_0x615c('0x42')]=_[_0x615c('0x41')](_0x38fbe0[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x20116d[_0x615c('0x3f')]['fields']));_0x540c5c[_0x615c('0x42')]=_0x540c5c[_0x615c('0x42')]['length']?_0x540c5c[_0x615c('0x42')]:_0x38fbe0['model'];if(_0x20116d[_0x615c('0x3f')][_0x615c('0x4d')]){_0x540c5c[_0x615c('0x53')]=[{'all':!![]}];}_0x540c5c=_[_0x615c('0x4a')]({},_0x540c5c,_0x20116d[_0x615c('0x4c')]);return db[_0x615c('0x39')][_0x615c('0x32')](_0x540c5c)[_0x615c('0x28')](handleEntityNotFound(_0x251e95,null))[_0x615c('0x28')](respondWithResult(_0x251e95,null))['catch'](handleError(_0x251e95,null));};exports[_0x615c('0x54')]=function(_0x30ef3f,_0x5bac0f){return db[_0x615c('0x39')][_0x615c('0x54')](_0x30ef3f[_0x615c('0x55')],{})[_0x615c('0x28')](function(_0x132919){var _0x51b134=_0x30ef3f['user'][_0x615c('0x56')]({'plain':!![]});if(!_0x51b134)throw new Error(_0x615c('0x57'));if(_0x51b134[_0x615c('0x58')]===_0x615c('0x59')){var _0xd02b68=_0x132919[_0x615c('0x56')]({'plain':!![]});var _0x3900ba=[{'name':_0x615c('0x29'),'value':_0x615c('0x2a')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5c3c89=_['find'](_0x3900ba,[_0x615c('0x2f'),_0xd02b68[_0x615c('0x31')]])[_0x615c('0x33')];return db[_0x615c('0x5a')][_0x615c('0x32')]({'where':{'name':_0x5c3c89,'userProfileId':_0x51b134[_0x615c('0x5b')]},'raw':!![]})[_0x615c('0x28')](function(_0x4c20f3){if(_0x4c20f3&&_0x4c20f3[_0x615c('0x5c')]===0x0){return db[_0x615c('0x34')][_0x615c('0x54')]({'name':_0xd02b68[_0x615c('0x33')],'resourceId':_0xd02b68['id'],'type':_0x4c20f3['name'],'sectionId':_0x4c20f3['id']},{})[_0x615c('0x28')](function(){return _0x132919;});}else{return _0x132919;}})['catch'](function(_0x57ebc4){logger['error'](_0x615c('0x5d'),_0x57ebc4);throw _0x57ebc4;});}return _0x132919;})[_0x615c('0x28')](respondWithResult(_0x5bac0f,0xc9))['catch'](handleError(_0x5bac0f,null));};exports[_0x615c('0x5e')]=function(_0x6ef9bb,_0x2e2346){var _0x4b13e1={'where':{'id':_0x6ef9bb[_0x615c('0x52')]['id']}},_0x119bbe={};_0x119bbe[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x39')][_0x615c('0x3a')]);_0x4b13e1[_0x615c('0x42')]=_[_0x615c('0x41')](_0x119bbe[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x6ef9bb[_0x615c('0x3f')][_0x615c('0x43')]));_0x4b13e1[_0x615c('0x42')]=_0x4b13e1[_0x615c('0x42')]['length']?_0x4b13e1['attributes']:_0x119bbe['model'];if(_0x6ef9bb['query']['includeAll']){_0x4b13e1['include']=[{'all':!![]}];}_0x4b13e1=_[_0x615c('0x4a')]({},_0x4b13e1,_0x6ef9bb['options']);return db[_0x615c('0x39')][_0x615c('0x32')](_0x4b13e1)['then'](handleEntityNotFound(_0x2e2346,null))[_0x615c('0x28')](function(_0x4df2ff){if(_0x4df2ff){var _0x3cd5c2=_0x4df2ff[_0x615c('0x56')]({'plain':!![]});_0x3cd5c2=qs[_0x615c('0x5f')](_0x3cd5c2,['id',_0x615c('0x60'),_0x615c('0x61')]);_0x6ef9bb['body']=_[_0x615c('0x5f')](_0x6ef9bb[_0x615c('0x55')],['id','createdAt','updatedAt']);return db[_0x615c('0x39')][_0x615c('0x54')](_[_0x615c('0x4a')](_0x3cd5c2,_0x6ef9bb[_0x615c('0x55')]),{'include':_0x6ef9bb['query'][_0x615c('0x4d')]?[{'all':!![]}]:undefined})[_0x615c('0x28')](function(_0x160b01){var _0xe63b0c=_0x6ef9bb['user'][_0x615c('0x56')]({'plain':!![]});if(!_0xe63b0c)throw new Error(_0x615c('0x57'));if(_0xe63b0c[_0x615c('0x58')]===_0x615c('0x59')){var _0x9b2e54=_0x160b01[_0x615c('0x56')]({'plain':!![]});var _0x4eb084=[{'name':'VoiceQueues','value':_0x615c('0x2a')},{'name':_0x615c('0x2b'),'value':_0x615c('0x62')}];var _0x29e5b7=_[_0x615c('0x32')](_0x4eb084,[_0x615c('0x2f'),_0x9b2e54[_0x615c('0x31')]])[_0x615c('0x33')];return db['UserProfileSection'][_0x615c('0x32')]({'where':{'name':_0x29e5b7,'userProfileId':_0xe63b0c['userProfileId']},'raw':!![]})[_0x615c('0x28')](function(_0x1341b2){if(_0x1341b2&&_0x1341b2['autoAssociation']===0x0){return db[_0x615c('0x34')]['create']({'name':_0x9b2e54[_0x615c('0x33')],'resourceId':_0x9b2e54['id'],'type':_0x1341b2['name'],'sectionId':_0x1341b2['id']},{})[_0x615c('0x28')](function(){return _0x160b01;});}else{return _0x160b01;}})['catch'](function(_0x85be38){logger[_0x615c('0x36')](_0x615c('0x5d'),_0x85be38);throw _0x85be38;});}return _0x160b01;});}})[_0x615c('0x28')](respondWithResult(_0x2e2346,0xc9))[_0x615c('0x50')](handleError(_0x2e2346,null));};exports['update']=function(_0x4fb4d7,_0x21aae4){if(_0x4fb4d7[_0x615c('0x55')]['id']){delete _0x4fb4d7[_0x615c('0x55')]['id'];}return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x4fb4d7[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x21aae4,null))[_0x615c('0x28')](saveUpdates(_0x4fb4d7[_0x615c('0x55')],null))['then'](respondWithResult(_0x21aae4,null))['catch'](handleError(_0x21aae4,null));};exports[_0x615c('0x27')]=function(_0x565c50,_0x98685d){return db[_0x615c('0x39')]['find']({'where':{'id':_0x565c50[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x98685d,null))[_0x615c('0x28')](removeEntity(_0x98685d,null))[_0x615c('0x50')](handleError(_0x98685d,null));};exports[_0x615c('0x63')]=function(_0x47aa28,_0x2b7fb9,_0x4d1d5f){var _0x5192cd={'raw':![],'where':{}};var _0x568ebd={};var _0x45be40={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x615c('0x64')]({'where':{'id':_0x47aa28[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x2b7fb9,null))['then'](function(_0x314ca7){if(_0x314ca7){_0x568ebd[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x65')]['rawAttributes']);_0x568ebd[_0x615c('0x3f')]=_['keys'](_0x47aa28[_0x615c('0x3f')]);_0x568ebd[_0x615c('0x40')]=_[_0x615c('0x41')](_0x568ebd[_0x615c('0x3d')],_0x568ebd[_0x615c('0x3f')]);_0x5192cd[_0x615c('0x42')]=_[_0x615c('0x41')](_0x568ebd[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x47aa28[_0x615c('0x3f')][_0x615c('0x43')]));_0x5192cd[_0x615c('0x42')]=_0x5192cd[_0x615c('0x42')][_0x615c('0x66')]?_0x5192cd['attributes']:_0x568ebd[_0x615c('0x3d')];if(!_0x47aa28[_0x615c('0x3f')]['hasOwnProperty'](_0x615c('0x45'))){_0x5192cd[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x47aa28[_0x615c('0x3f')][_0x615c('0x21')]);_0x5192cd[_0x615c('0x1f')]=qs[_0x615c('0x1f')](_0x47aa28['query']['offset']);}_0x5192cd[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x47aa28[_0x615c('0x3f')][_0x615c('0x47')]);_0x5192cd[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x47aa28[_0x615c('0x3f')],_0x568ebd['filters']));_0x5192cd[_0x615c('0x49')][_0x615c('0x67')]=_0x314ca7['id'];if(_0x47aa28[_0x615c('0x3f')][_0x615c('0x2c')]){_0x5192cd[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x5192cd[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x5192cd[_0x615c('0x42')],function(_0x17a6cf){var _0x363dd2={};_0x363dd2[_0x17a6cf]={'$like':'%'+_0x47aa28[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x363dd2;})});}_0x5192cd=_[_0x615c('0x4a')]({},_0x5192cd,_0x47aa28['options']);return db[_0x615c('0x65')][_0x615c('0x22')]({'where':_0x5192cd['where']})[_0x615c('0x28')](function(_0x3811a7){_0x45be40[_0x615c('0x22')]=_0x3811a7;if(_0x47aa28[_0x615c('0x3f')][_0x615c('0x4d')]){_0x5192cd[_0x615c('0x53')]=[{'all':!![]}];}return db['CmHopper'][_0x615c('0x4e')](_0x5192cd);})[_0x615c('0x28')](function(_0x9f5b05){_0x45be40[_0x615c('0x4f')]=_0x9f5b05;return _0x45be40;});}})['then'](respondWithFilteredResult(_0x2b7fb9,_0x5192cd))[_0x615c('0x50')](handleError(_0x2b7fb9,null));};exports[_0x615c('0x68')]=function(_0x5eb7a2,_0x49aa93,_0x3ab4cb){var _0xfd8d5a={'raw':!![],'where':{}};var _0x13a4b7={};var _0x44994e={'count':0x0,'rows':[]};return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x5eb7a2['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x49aa93,null))[_0x615c('0x28')](function(_0x328479){if(_0x328479){_0x13a4b7[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x69')][_0x615c('0x3a')]);_0x13a4b7[_0x615c('0x3f')]=_['keys'](_0x5eb7a2[_0x615c('0x3f')]);_0x13a4b7[_0x615c('0x40')]=_[_0x615c('0x41')](_0x13a4b7[_0x615c('0x3d')],_0x13a4b7['query']);_0xfd8d5a[_0x615c('0x42')]=_[_0x615c('0x41')](_0x13a4b7[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x5eb7a2['query']['fields']));_0xfd8d5a['attributes']=_0xfd8d5a[_0x615c('0x42')][_0x615c('0x66')]?_0xfd8d5a[_0x615c('0x42')]:_0x13a4b7['model'];if(!_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0xfd8d5a[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x21')]);_0xfd8d5a[_0x615c('0x1f')]=qs['offset'](_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x1f')]);}_0xfd8d5a[_0x615c('0x46')]=qs['sort'](_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x47')]);_0xfd8d5a[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x5eb7a2['query'],_0x13a4b7[_0x615c('0x40')]));_0xfd8d5a[_0x615c('0x49')][_0x615c('0x67')]=_0x328479['id'];if(_0x5eb7a2[_0x615c('0x3f')]['filter']){_0xfd8d5a[_0x615c('0x49')]=_[_0x615c('0x4a')](_0xfd8d5a[_0x615c('0x49')],{'$or':_['map'](_0xfd8d5a['attributes'],function(_0x4283e4){var _0x39d7f={};_0x39d7f[_0x4283e4]={'$like':'%'+_0x5eb7a2[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x39d7f;})});}_0xfd8d5a=_[_0x615c('0x4a')]({},_0xfd8d5a,_0x5eb7a2['options']);return db[_0x615c('0x69')][_0x615c('0x22')]({'where':_0xfd8d5a[_0x615c('0x49')]})[_0x615c('0x28')](function(_0x4c6523){_0x44994e[_0x615c('0x22')]=_0x4c6523;if(_0x5eb7a2[_0x615c('0x3f')]['includeAll']){_0xfd8d5a[_0x615c('0x53')]=[{'all':!![]}];}return db[_0x615c('0x69')][_0x615c('0x4e')](_0xfd8d5a);})[_0x615c('0x28')](function(_0x104fe9){_0x44994e[_0x615c('0x4f')]=_0x104fe9;return _0x44994e;});}})[_0x615c('0x28')](respondWithFilteredResult(_0x49aa93,_0xfd8d5a))[_0x615c('0x50')](handleError(_0x49aa93,null));};exports['getHopperFinals']=function(_0xab333e,_0x10308f,_0x207336){var _0x319aa2={'raw':!![],'where':{}};var _0x36f2e5={};var _0x345be6={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x615c('0x64')]({'where':{'id':_0xab333e[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x10308f,null))[_0x615c('0x28')](function(_0x2b6ef1){if(_0x2b6ef1){_0x36f2e5['model']=_[_0x615c('0x3e')](db[_0x615c('0x6a')]['rawAttributes']);_0x36f2e5[_0x615c('0x3f')]=_[_0x615c('0x3e')](_0xab333e[_0x615c('0x3f')]);_0x36f2e5[_0x615c('0x40')]=_[_0x615c('0x41')](_0x36f2e5[_0x615c('0x3d')],_0x36f2e5[_0x615c('0x3f')]);_0x319aa2[_0x615c('0x42')]=_['intersection'](_0x36f2e5['model'],qs[_0x615c('0x43')](_0xab333e['query'][_0x615c('0x43')]));_0x319aa2[_0x615c('0x42')]=_0x319aa2[_0x615c('0x42')][_0x615c('0x66')]?_0x319aa2[_0x615c('0x42')]:_0x36f2e5[_0x615c('0x3d')];if(!_0xab333e[_0x615c('0x3f')]['hasOwnProperty']('nolimit')){_0x319aa2[_0x615c('0x21')]=qs['limit'](_0xab333e['query'][_0x615c('0x21')]);_0x319aa2['offset']=qs[_0x615c('0x1f')](_0xab333e[_0x615c('0x3f')][_0x615c('0x1f')]);}_0x319aa2[_0x615c('0x46')]=qs[_0x615c('0x47')](_0xab333e[_0x615c('0x3f')]['sort']);_0x319aa2['where']=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0xab333e['query'],_0x36f2e5['filters']));_0x319aa2[_0x615c('0x49')][_0x615c('0x67')]=_0x2b6ef1['id'];if(_0xab333e['query'][_0x615c('0x2c')]){_0x319aa2[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x319aa2[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x319aa2[_0x615c('0x42')],function(_0x530d7f){var _0x810a60={};_0x810a60[_0x530d7f]={'$like':'%'+_0xab333e[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x810a60;})});}_0x319aa2=_['merge']({},_0x319aa2,_0xab333e[_0x615c('0x4c')]);return db[_0x615c('0x6a')][_0x615c('0x22')]({'where':_0x319aa2['where']})[_0x615c('0x28')](function(_0x478108){_0x345be6['count']=_0x478108;if(_0xab333e['query'][_0x615c('0x4d')]){_0x319aa2[_0x615c('0x53')]=[{'all':!![]}];}return db[_0x615c('0x6a')][_0x615c('0x4e')](_0x319aa2);})[_0x615c('0x28')](function(_0x974b5d){_0x345be6[_0x615c('0x4f')]=_0x974b5d;return _0x345be6;});}})['then'](respondWithFilteredResult(_0x10308f,_0x319aa2))[_0x615c('0x50')](handleError(_0x10308f,null));};exports['getHopperBlacks']=function(_0x4bc5ca,_0x198254,_0x3481e5){var _0x561a3b={'raw':!![],'where':{}};var _0x19bea4={};var _0x342a6d={'count':0x0,'rows':[]};return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x4bc5ca[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x198254,null))[_0x615c('0x28')](function(_0x16a97f){if(_0x16a97f){_0x19bea4[_0x615c('0x3d')]=_['keys'](db[_0x615c('0x6b')]['rawAttributes']);_0x19bea4[_0x615c('0x3f')]=_[_0x615c('0x3e')](_0x4bc5ca['query']);_0x19bea4[_0x615c('0x40')]=_[_0x615c('0x41')](_0x19bea4[_0x615c('0x3d')],_0x19bea4[_0x615c('0x3f')]);_0x561a3b['attributes']=_[_0x615c('0x41')](_0x19bea4['model'],qs['fields'](_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x43')]));_0x561a3b['attributes']=_0x561a3b[_0x615c('0x42')][_0x615c('0x66')]?_0x561a3b[_0x615c('0x42')]:_0x19bea4['model'];if(!_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x44')]('nolimit')){_0x561a3b[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x4bc5ca['query'][_0x615c('0x21')]);_0x561a3b[_0x615c('0x1f')]=qs['offset'](_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x1f')]);}_0x561a3b[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x4bc5ca['query'][_0x615c('0x47')]);_0x561a3b[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x4bc5ca[_0x615c('0x3f')],_0x19bea4[_0x615c('0x40')]));_0x561a3b[_0x615c('0x49')][_0x615c('0x67')]=_0x16a97f['id'];if(_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x2c')]){_0x561a3b[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x561a3b['where'],{'$or':_[_0x615c('0x2e')](_0x561a3b[_0x615c('0x42')],function(_0x5412d6){var _0x57b755={};_0x57b755[_0x5412d6]={'$like':'%'+_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x57b755;})});}_0x561a3b=_[_0x615c('0x4a')]({},_0x561a3b,_0x4bc5ca[_0x615c('0x4c')]);return db[_0x615c('0x6b')]['count']({'where':_0x561a3b[_0x615c('0x49')]})['then'](function(_0x42b8c2){_0x342a6d['count']=_0x42b8c2;if(_0x4bc5ca[_0x615c('0x3f')][_0x615c('0x4d')]){_0x561a3b[_0x615c('0x53')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x615c('0x4e')](_0x561a3b);})['then'](function(_0xe583fb){_0x342a6d[_0x615c('0x4f')]=_0xe583fb;return _0x342a6d;});}})['then'](respondWithFilteredResult(_0x198254,_0x561a3b))['catch'](handleError(_0x198254,null));};exports[_0x615c('0x6c')]=function(_0x16cec8,_0x41ba3b,_0x790c50){var _0x179561={};var _0xce7e6f={};var _0x80e1b8;var _0x2a5457;return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x16cec8['params']['id']}})['then'](handleEntityNotFound(_0x41ba3b,null))[_0x615c('0x28')](function(_0x5ac6b8){if(_0x5ac6b8){_0x80e1b8=_0x5ac6b8;_0xce7e6f[_0x615c('0x3d')]=_['keys'](db[_0x615c('0x6d')][_0x615c('0x3a')]);_0xce7e6f[_0x615c('0x3f')]=_['keys'](_0x16cec8['query']);_0xce7e6f[_0x615c('0x40')]=_[_0x615c('0x41')](_0xce7e6f[_0x615c('0x3d')],_0xce7e6f[_0x615c('0x3f')]);_0x179561[_0x615c('0x42')]=_[_0x615c('0x41')](_0xce7e6f['model'],qs['fields'](_0x16cec8[_0x615c('0x3f')][_0x615c('0x43')]));_0x179561[_0x615c('0x42')]=_0x179561['attributes'][_0x615c('0x66')]?_0x179561['attributes']:_0xce7e6f[_0x615c('0x3d')];_0x179561['order']=qs['sort'](_0x16cec8['query'][_0x615c('0x47')]);_0x179561[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x16cec8[_0x615c('0x3f')],_0xce7e6f[_0x615c('0x40')]));if(_0x16cec8[_0x615c('0x3f')][_0x615c('0x2c')]){_0x179561[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x179561[_0x615c('0x49')],{'$or':_['map'](_0x179561[_0x615c('0x42')],function(_0xce0d14){var _0x45ec7d={};_0x45ec7d[_0xce0d14]={'$like':'%'+_0x16cec8[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x45ec7d;})});}_0x179561=_['merge']({},_0x179561,_0x16cec8[_0x615c('0x4c')]);return _0x80e1b8[_0x615c('0x6c')](_0x179561);}})[_0x615c('0x28')](function(_0x42ee39){if(_0x42ee39){_0x2a5457=_0x42ee39['length'];if(!_0x16cec8[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x179561[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x16cec8[_0x615c('0x3f')]['limit']);_0x179561[_0x615c('0x1f')]=qs['offset'](_0x16cec8[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x80e1b8['getTeams'](_0x179561);}})[_0x615c('0x28')](function(_0xaa73f1){if(_0xaa73f1){return _0xaa73f1?{'count':_0x2a5457,'rows':_0xaa73f1}:null;}})[_0x615c('0x28')](respondWithResult(_0x41ba3b,null))['catch'](handleError(_0x41ba3b,null));};exports[_0x615c('0x6e')]=function(_0x58daef,_0x53d78e,_0x1991ca){var _0x48f168=_0x58daef['body'][_0x615c('0x6f')];var _0x254fb5=_[_0x615c('0x2e')](_0x48f168,'id');return db[_0x615c('0x6d')]['findAll']({'where':{'id':_0x254fb5},'attributes':['id'],'include':[{'model':db[_0x615c('0x70')],'as':_0x615c('0x71'),'attributes':['id',_0x615c('0x33'),_0x615c('0x72'),'voicePause',_0x615c('0x73')],'raw':!![]}]})[_0x615c('0x28')](function(_0x399bb2){if(_0x399bb2){var _0x4659eb=_[_0x615c('0x74')](_0x399bb2,function(_0xeb6f2d){var _0x42753c=_0xeb6f2d[_0x615c('0x56')]({'plain':!![]});_0x42753c[_0x615c('0x71')][_0x615c('0x75')](function(_0x1a3fc8){_0x1a3fc8[_0x615c('0x76')]=_[_0x615c('0x32')](_0x48f168,{'id':_0x42753c['id']})['penalty'];});return _0x42753c['Agents'];});return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x58daef[_0x615c('0x52')]['id']}})['then'](function(_0x14d245){return db['sequelize'][_0x615c('0x77')](function(_0x18797d){return _0x14d245['addTeams'](_0x254fb5,{'transaction':_0x18797d})['then'](function(){return BPromise[_0x615c('0x78')](_0x48f168,function(_0x53c9be){return db[_0x615c('0x79')]['upsert']({'TeamId':_0x53c9be['id'],'VoiceQueueId':_0x58daef[_0x615c('0x52')]['id'],'penalty':_0x53c9be[_0x615c('0x76')]},{'transaction':_0x18797d});});})[_0x615c('0x28')](function(){return BPromise[_0x615c('0x78')](_0x4659eb,function(_0x19eeb0){return db[_0x615c('0x7a')]['findOrCreate']({'where':{'UserId':_0x19eeb0['id'],'VoiceQueueId':_0x58daef[_0x615c('0x52')]['id']},'defaults':{'penalty':_0x19eeb0[_0x615c('0x76')]},'transaction':_0x18797d});});})[_0x615c('0x28')](function(){return BPromise[_0x615c('0x78')](_['filter'](_0x4659eb,{'online':!![]}),function(_0x15c69b){return db[_0x615c('0x7b')][_0x615c('0x7c')]({'membername':_0x15c69b[_0x615c('0x33')],'UserId':_0x15c69b['id'],'queue_name':_0x14d245[_0x615c('0x33')],'VoiceQueueId':_0x14d245['id'],'interface':_[_0x615c('0x7d')](_0x15c69b[_0x615c('0x73')])?util[_0x615c('0x7e')](_0x615c('0x7f'),_0x15c69b[_0x615c('0x33')]):_0x15c69b[_0x615c('0x73')],'paused':_0x15c69b[_0x615c('0x80')]||![],'penalty':_0x15c69b[_0x615c('0x76')]},{'transaction':_0x18797d});});})['then'](function(){_0x4659eb[_0x615c('0x75')](function(_0x49e3a8){socket[_0x615c('0x81')](_0x615c('0x82'),{'UserId':_0x49e3a8['id'],'VoiceQueueId':_0x14d245['id']});});});});});}})[_0x615c('0x28')](respondWithStatusCode(_0x53d78e,null))[_0x615c('0x50')](handleError(_0x53d78e,null));};exports['removeTeams']=function(_0x3c99c9,_0x837ff8,_0x327f7c){return db[_0x615c('0x6d')][_0x615c('0x4e')]({'where':{'id':_0x3c99c9['query'][_0x615c('0x83')]},'attributes':['id'],'include':[{'model':db[_0x615c('0x70')],'as':_0x615c('0x71'),'attributes':['id'],'raw':!![]}]})[_0x615c('0x28')](handleEntityNotFound(_0x837ff8,null))[_0x615c('0x28')](function(_0x2a7dd0){var _0x53b41a=_['map'](_0x2a7dd0,'id');var _0x544217=[];var _0x22435b=[];var _0x7b8b18=squel['select']();_0x7b8b18[_0x615c('0x84')]('tq.TeamId')[_0x615c('0x85')]('team_has_voice_queues','tq')[_0x615c('0x86')](_0x615c('0x87'),'ut',_0x615c('0x88'))['where'](_0x615c('0x89'),_0x3c99c9[_0x615c('0x52')]['id']);for(var _0xfac63c=0x0;_0xfac63c<_0x2a7dd0['length'];_0xfac63c+=0x1){let _0x4f5804=_0x2a7dd0[_0xfac63c];for(var _0x1379a1=0x0;_0x1379a1<_0x4f5804['Agents']['length'];_0x1379a1+=0x1){let _0x3cad70=_0x4f5804[_0x615c('0x71')][_0x1379a1];var _0x122849=_0x7b8b18[_0x615c('0x5e')]();_0x122849[_0x615c('0x49')](_0x615c('0x8a'),_0x3cad70['id']);_0x22435b[_0x615c('0x8b')](db[_0x615c('0x8c')][_0x615c('0x3f')](_0x122849[_0x615c('0x8d')](),{'type':db[_0x615c('0x8c')][_0x615c('0x8e')][_0x615c('0x8f')]})['then'](function(_0x437c0f){if(_0x437c0f[_0x615c('0x66')]===0x1){return _0x3cad70['id'];}else{var _0x20c330=_['every'](_[_0x615c('0x2e')](_0x437c0f,'TeamId'),function(_0x470a78){return _[_0x615c('0x30')](_0x53b41a,_0x470a78);});if(_0x20c330){return _0x3cad70['id'];}}}));}}return BPromise[_0x615c('0x90')](_0x22435b)['then'](function(_0x50c033){_0x544217=_(_0x544217)[_0x615c('0x91')](_0x50c033)[_0x615c('0x92')]()[_0x615c('0x2f')]();return db[_0x615c('0x39')]['find']({'where':{'id':_0x3c99c9[_0x615c('0x52')]['id']}})[_0x615c('0x28')](function(_0x59db5d){return db['sequelize'][_0x615c('0x77')](function(_0x3f238c){return _0x59db5d[_0x615c('0x93')](_0x3c99c9[_0x615c('0x3f')][_0x615c('0x83')],{'transaction':_0x3f238c})[_0x615c('0x28')](function(){if(!_[_0x615c('0x94')](_0x544217)){return _0x59db5d[_0x615c('0x95')](_0x544217,{'transaction':_0x3f238c})[_0x615c('0x28')](function(){return db[_0x615c('0x7b')][_0x615c('0x27')]({'where':{'VoiceQueueId':_0x3c99c9[_0x615c('0x52')]['id'],'UserId':_0x544217},'transaction':_0x3f238c});});}})[_0x615c('0x28')](function(){_0x544217[_0x615c('0x75')](function(_0x498cfa){socket[_0x615c('0x81')]('userVoiceQueue:remove',{'UserId':_0x498cfa,'VoiceQueueId':_0x59db5d['id']});});});});});});})[_0x615c('0x28')](respondWithStatusCode(_0x837ff8,null))[_0x615c('0x50')](handleError(_0x837ff8,null));};exports[_0x615c('0x96')]=function(_0x5a3ea2,_0xb0c74,_0x11200d){var _0x5ec289,_0x124cbc;return db[_0x615c('0x39')]['find']({'where':{'id':_0x5a3ea2[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0xb0c74,null))[_0x615c('0x28')](function(_0x5c9883){if(_0x5c9883){_0x124cbc=_0x5c9883;return _0x5c9883[_0x615c('0x96')](_0x5a3ea2[_0x615c('0x55')][_0x615c('0x83')],_[_0x615c('0x5f')](_0x5a3ea2['body'],[_0x615c('0x83'),'id'])||{})[_0x615c('0x97')](function(_0x5b3322){for(var _0x3d227e=0x0;_0x3d227e<_0x5a3ea2[_0x615c('0x55')][_0x615c('0x83')]['length'];_0x3d227e+=0x1){socket[_0x615c('0x81')]('userVoiceQueue:save',{'UserId':Number(_0x5a3ea2['body'][_0x615c('0x83')][_0x3d227e]),'VoiceQueueId':Number(_0x5a3ea2[_0x615c('0x52')]['id'])});}return _0x5b3322;});}})['then'](function(_0x27e2d7){_0x5ec289=_0x27e2d7||[];if(_0x124cbc){return db[_0x615c('0x70')][_0x615c('0x4e')]({'where':{'id':_0x5a3ea2[_0x615c('0x55')][_0x615c('0x83')]},'attributes':['id',_0x615c('0x33'),'online',_0x615c('0x80'),_0x615c('0x73')],'raw':!![]});}})[_0x615c('0x28')](function(_0x2bad16){if(!_[_0x615c('0x94')](_0x2bad16)){var _0x4647b6=[];for(var _0x3edec2=0x0;_0x3edec2<_0x2bad16['length'];_0x3edec2++){if(_0x2bad16[_0x3edec2]['online']){_0x4647b6['push'](db[_0x615c('0x7b')]['upsert']({'membername':_0x2bad16[_0x3edec2]['name'],'UserId':_0x2bad16[_0x3edec2]['id'],'queue_name':_0x124cbc[_0x615c('0x33')],'VoiceQueueId':_0x124cbc['id'],'interface':_[_0x615c('0x7d')](_0x2bad16[_0x3edec2]['interface'])?util[_0x615c('0x7e')](_0x615c('0x7f'),_0x2bad16[_0x3edec2][_0x615c('0x33')]):_0x2bad16[_0x3edec2][_0x615c('0x73')],'paused':_0x2bad16[_0x3edec2][_0x615c('0x80')]||![],'penalty':_0x5a3ea2['body'][_0x615c('0x76')]||0x0}));}}return BPromise['all'](_0x4647b6);}})['then'](function(){return _0x5ec289;})[_0x615c('0x28')](respondWithResult(_0xb0c74,null))[_0x615c('0x50')](handleError(_0xb0c74,null));};exports[_0x615c('0x95')]=function(_0x389e06,_0x370c74,_0x132e8a){return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x389e06[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x370c74,null))[_0x615c('0x28')](function(_0x30ef62){if(_0x30ef62){return _0x30ef62[_0x615c('0x95')](_0x389e06[_0x615c('0x3f')]['ids'])[_0x615c('0x28')](function(){if(_[_0x615c('0x98')](_0x389e06[_0x615c('0x3f')]['ids'])){for(var _0x5f10d8=0x0;_0x5f10d8<_0x389e06[_0x615c('0x3f')][_0x615c('0x83')][_0x615c('0x66')];_0x5f10d8+=0x1){socket[_0x615c('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x389e06[_0x615c('0x3f')][_0x615c('0x83')][_0x5f10d8]),'VoiceQueueId':Number(_0x389e06[_0x615c('0x52')]['id'])});}}else{socket['emit'](_0x615c('0x99'),{'UserId':Number(_0x389e06[_0x615c('0x3f')][_0x615c('0x83')]),'VoiceQueueId':Number(_0x389e06[_0x615c('0x52')]['id'])});}});}})[_0x615c('0x28')](function(_0x5b573f){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x389e06[_0x615c('0x52')]['id'],'UserId':_0x389e06['query'][_0x615c('0x83')]}})[_0x615c('0x28')](function(){return _0x5b573f;});})[_0x615c('0x28')](respondWithStatusCode(_0x370c74,null))['catch'](handleError(_0x370c74,null));};exports['getAgents']=function(_0x572b78,_0x480a3a,_0x4cc809){var _0xcdef2d={};var _0x147ce3={};var _0x2a6616;var _0x5d6430;return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x572b78['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x480a3a,null))[_0x615c('0x28')](function(_0x4f128a){if(_0x4f128a){_0x2a6616=_0x4f128a;_0x147ce3['model']=_[_0x615c('0x3e')](db[_0x615c('0x70')][_0x615c('0x3a')]);_0x147ce3[_0x615c('0x3f')]=_[_0x615c('0x3e')](_0x572b78[_0x615c('0x3f')]);_0x147ce3[_0x615c('0x40')]=_[_0x615c('0x41')](_0x147ce3[_0x615c('0x3d')],_0x147ce3[_0x615c('0x3f')]);_0xcdef2d['attributes']=_[_0x615c('0x41')](_0x147ce3['model'],qs[_0x615c('0x43')](_0x572b78['query']['fields']));_0xcdef2d['attributes']=_0xcdef2d[_0x615c('0x42')][_0x615c('0x66')]?_0xcdef2d['attributes']:_0x147ce3[_0x615c('0x3d')];_0xcdef2d['order']=qs['sort'](_0x572b78[_0x615c('0x3f')][_0x615c('0x47')]);_0xcdef2d[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x572b78[_0x615c('0x3f')],_0x147ce3[_0x615c('0x40')]));if(_0x572b78[_0x615c('0x3f')]['filter']){_0xcdef2d[_0x615c('0x49')]=_[_0x615c('0x4a')](_0xcdef2d['where'],{'$or':_[_0x615c('0x2e')](_0xcdef2d[_0x615c('0x42')],function(_0x4b2f0f){var _0x2ba940={};_0x2ba940[_0x4b2f0f]={'$like':'%'+_0x572b78[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x2ba940;})});}_0xcdef2d=_[_0x615c('0x4a')]({},_0xcdef2d,_0x572b78[_0x615c('0x4c')]);return _0x2a6616['getAgents'](_0xcdef2d);}})[_0x615c('0x28')](function(_0x189e85){if(_0x189e85){_0x5d6430=_0x189e85[_0x615c('0x66')];if(!_0x572b78[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0xcdef2d['limit']=qs[_0x615c('0x21')](_0x572b78[_0x615c('0x3f')]['limit']);_0xcdef2d['offset']=qs['offset'](_0x572b78[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x2a6616['getAgents'](_0xcdef2d);}})['then'](function(_0x34a077){if(_0x34a077){return _0x34a077?{'count':_0x5d6430,'rows':_0x34a077}:null;}})[_0x615c('0x28')](respondWithResult(_0x480a3a,null))['catch'](handleError(_0x480a3a,null));};exports[_0x615c('0x9a')]=function(_0x29059b,_0x3fd6d0,_0x47ab62){var _0x41f9fc={};var _0x2dbb0e={};var _0x28a6f9;var _0x300f4a;return db['VoiceQueue'][_0x615c('0x64')]({'where':{'id':_0x29059b[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x3fd6d0,null))[_0x615c('0x28')](function(_0x24c946){if(_0x24c946){_0x28a6f9=_0x24c946;_0x2dbb0e['model']=_[_0x615c('0x3e')](db[_0x615c('0x7b')]['rawAttributes']);_0x2dbb0e['query']=_[_0x615c('0x3e')](_0x29059b[_0x615c('0x3f')]);_0x2dbb0e['filters']=_[_0x615c('0x41')](_0x2dbb0e[_0x615c('0x3d')],_0x2dbb0e[_0x615c('0x3f')]);_0x41f9fc[_0x615c('0x42')]=_[_0x615c('0x41')](_0x2dbb0e['model'],qs[_0x615c('0x43')](_0x29059b['query'][_0x615c('0x43')]));_0x41f9fc[_0x615c('0x42')]=_0x41f9fc[_0x615c('0x42')][_0x615c('0x66')]?_0x41f9fc[_0x615c('0x42')]:_0x2dbb0e[_0x615c('0x3d')];_0x41f9fc[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x29059b['query']['sort']);_0x41f9fc[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x29059b['query'],_0x2dbb0e[_0x615c('0x40')]));if(_0x29059b[_0x615c('0x3f')][_0x615c('0x2c')]){_0x41f9fc[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x41f9fc[_0x615c('0x49')],{'$or':_['map'](_0x41f9fc[_0x615c('0x42')],function(_0x270913){var _0x15fa95={};_0x15fa95[_0x270913]={'$like':'%'+_0x29059b[_0x615c('0x3f')][_0x615c('0x2c')]+'%'};return _0x15fa95;})});}_0x41f9fc=_[_0x615c('0x4a')]({},_0x41f9fc,_0x29059b[_0x615c('0x4c')]);return _0x28a6f9[_0x615c('0x9a')](_0x41f9fc);}})[_0x615c('0x28')](function(_0x338b3d){if(_0x338b3d){_0x300f4a=_0x338b3d[_0x615c('0x66')];if(!_0x29059b[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x41f9fc[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x29059b['query'][_0x615c('0x21')]);_0x41f9fc['offset']=qs['offset'](_0x29059b[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x28a6f9[_0x615c('0x9a')](_0x41f9fc);}})[_0x615c('0x28')](function(_0x226989){return _0x226989?{'count':_0x300f4a,'rows':_0x226989}:null;})[_0x615c('0x28')](respondWithResult(_0x3fd6d0,null))[_0x615c('0x50')](handleError(_0x3fd6d0,null));};exports[_0x615c('0x9b')]=function(_0x240b20,_0x4e35c1,_0x570f05){var _0x44566b={};var _0x5d2942={};var _0x1677a1;var _0x12c10e;return db[_0x615c('0x39')][_0x615c('0x64')]({'where':{'id':_0x240b20[_0x615c('0x52')]['id']}})['then'](handleEntityNotFound(_0x4e35c1,null))['then'](function(_0x4a704c){if(_0x4a704c){_0x1677a1=_0x4a704c;_0x5d2942[_0x615c('0x3d')]=_[_0x615c('0x3e')](db[_0x615c('0x9c')][_0x615c('0x3a')]);_0x5d2942[_0x615c('0x3f')]=_['keys'](_0x240b20[_0x615c('0x3f')]);_0x5d2942[_0x615c('0x40')]=_['intersection'](_0x5d2942[_0x615c('0x3d')],_0x5d2942[_0x615c('0x3f')]);_0x44566b[_0x615c('0x42')]=_['intersection'](_0x5d2942[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x240b20[_0x615c('0x3f')][_0x615c('0x43')]));_0x44566b[_0x615c('0x42')]=_0x44566b[_0x615c('0x42')]['length']?_0x44566b[_0x615c('0x42')]:_0x5d2942[_0x615c('0x3d')];_0x44566b[_0x615c('0x46')]=qs[_0x615c('0x47')](_0x240b20[_0x615c('0x3f')]['sort']);_0x44566b[_0x615c('0x49')]=qs['filters'](_[_0x615c('0x48')](_0x240b20[_0x615c('0x3f')],_0x5d2942[_0x615c('0x40')]));if(_0x240b20[_0x615c('0x3f')][_0x615c('0x2c')]){_0x44566b[_0x615c('0x49')]=_[_0x615c('0x4a')](_0x44566b[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x44566b[_0x615c('0x42')],function(_0xc7d39e){var _0x11f084={};_0x11f084[_0xc7d39e]={'$like':'%'+_0x240b20['query'][_0x615c('0x2c')]+'%'};return _0x11f084;})});}_0x44566b=_[_0x615c('0x4a')]({},_0x44566b,_0x240b20[_0x615c('0x4c')]);return _0x1677a1[_0x615c('0x9b')](_0x44566b);}})[_0x615c('0x28')](function(_0x564527){if(_0x564527){_0x12c10e=_0x564527[_0x615c('0x66')];if(!_0x240b20[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x44566b[_0x615c('0x21')]=qs[_0x615c('0x21')](_0x240b20[_0x615c('0x3f')][_0x615c('0x21')]);_0x44566b[_0x615c('0x1f')]=qs[_0x615c('0x1f')](_0x240b20[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x1677a1[_0x615c('0x9b')](_0x44566b);}})[_0x615c('0x28')](function(_0x3eb222){if(_0x3eb222){return _0x3eb222?{'count':_0x12c10e,'rows':_0x3eb222}:null;}})[_0x615c('0x28')](respondWithResult(_0x4e35c1,null))[_0x615c('0x50')](handleError(_0x4e35c1,null));};exports[_0x615c('0x9d')]=function(_0x4c6007,_0x4cdd8b,_0x131626){var _0x51bca0=moment()['format'](_0x615c('0x9e'));var _0x1b71db,_0x251a9a;return db['VoiceQueue']['find']({'where':{'id':_0x4c6007[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x4cdd8b,null))[_0x615c('0x28')](function(_0x1f82b9){if(_0x1f82b9){_0x251a9a=_0x1f82b9;return _0x1f82b9[_0x615c('0x9d')](_0x4c6007[_0x615c('0x55')][_0x615c('0x83')],_[_0x615c('0x5f')](_0x4c6007['body'],['ids','id'])||{});}return null;})[_0x615c('0x97')](function(_0x5a82b2){var _0x48ce07;_0x1b71db=_0x5a82b2||[];var _0x10baad=[];if(_0x5a82b2){for(var _0x503921=0x0;_0x503921<_0x5a82b2[_0x615c('0x66')];_0x503921+=0x1){var _0x2855a7=_0x5a82b2[_0x503921]['get']({'plain':!![]});_0x251a9a[_0x615c('0x9f')]=_0x4c6007[_0x615c('0x55')]['dialCheckDuplicateType']?_0x4c6007[_0x615c('0x55')][_0x615c('0x9f')]:_0x251a9a[_0x615c('0x9f')];switch(_0x251a9a[_0x615c('0x9f')]){case _0x615c('0xa0'):_0x48ce07=squel[_0x615c('0xa1')]()[_0x615c('0xa2')]('cm_hopper')[_0x615c('0xa3')](['phone',_0x615c('0xa4'),_0x615c('0xa5'),_0x615c('0xa6'),_0x615c('0x67'),_0x615c('0x60'),'updatedAt'],squel[_0x615c('0xa7')]()['field'](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0xa4'))[_0x615c('0x84')]('id',_0x615c('0xa5'))[_0x615c('0x84')](_0x2855a7['CmListId']['toString'](),'ListId')[_0x615c('0x84')](_0x4c6007['params']['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x51bca0+'\x27',_0x615c('0x60'))['field']('\x27'+_0x51bca0+'\x27',_0x615c('0x61'))['from'](_0x615c('0xa9'))[_0x615c('0x49')](_0x615c('0xaa'))[_0x615c('0x49')](_0x615c('0xab'),_0x2855a7[_0x615c('0xac')][_0x615c('0x8d')]())[_0x615c('0x49')](_0x615c('0xad'))['where'](_0x615c('0xae'),squel['select']()[_0x615c('0x84')]('COALESCE(calleridnum,\x27\x27)')[_0x615c('0x85')](_0x615c('0xaf'))[_0x615c('0x49')](_0x615c('0x89'),_0x4c6007[_0x615c('0x52')]['id']['toString']()))[_0x615c('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x615c('0xa7')]()[_0x615c('0x84')](_0x615c('0xb0'))[_0x615c('0x85')](_0x615c('0xb1'))['where']('VoiceQueueId\x20=\x20?',_0x4c6007[_0x615c('0x52')]['id'][_0x615c('0x8d')]())))['toString']();break;case _0x615c('0xb2'):_0x48ce07=squel[_0x615c('0xa1')]()[_0x615c('0xa2')]('cm_hopper')[_0x615c('0xa3')](['phone',_0x615c('0xa4'),_0x615c('0xa5'),_0x615c('0xa6'),_0x615c('0x67'),_0x615c('0x60'),_0x615c('0x61')],squel['select']()[_0x615c('0x84')](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0xa4'))[_0x615c('0x84')]('id','ContactId')[_0x615c('0x84')](_0x2855a7[_0x615c('0xac')][_0x615c('0x8d')](),_0x615c('0xa6'))[_0x615c('0x84')](_0x4c6007['params']['id'][_0x615c('0x8d')](),_0x615c('0x67'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27','createdAt')[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0x61'))[_0x615c('0x85')]('cm_contacts')[_0x615c('0x49')]('deletedAt\x20IS\x20NULL')[_0x615c('0x49')]('ListId\x20=\x20?',_0x2855a7[_0x615c('0xac')]['toString']())[_0x615c('0x49')](_0x615c('0xad'))[_0x615c('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x615c('0xa7')]()['field']('COALESCE(phone,\x27\x27)')[_0x615c('0x85')]('cm_hopper')[_0x615c('0x49')](_0x615c('0x89'),_0x4c6007[_0x615c('0x52')]['id'][_0x615c('0x8d')]())))[_0x615c('0x8d')]();break;default:_0x48ce07=squel[_0x615c('0xa1')]()[_0x615c('0xa2')]('cm_hopper')['fromQuery'](['phone',_0x615c('0xa4'),_0x615c('0xa5'),_0x615c('0xa6'),_0x615c('0x67'),'createdAt',_0x615c('0x61')],squel[_0x615c('0xa7')]()[_0x615c('0x84')](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27','scheduledAt')[_0x615c('0x84')]('id','ContactId')[_0x615c('0x84')](_0x2855a7['CmListId']['toString'](),'ListId')[_0x615c('0x84')](_0x4c6007[_0x615c('0x52')]['id'][_0x615c('0x8d')](),'VoiceQueueId')[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0x60'))[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27','updatedAt')['from'](_0x615c('0xa9'))[_0x615c('0x49')](_0x615c('0xaa'))['where'](_0x615c('0xab'),_0x2855a7[_0x615c('0xac')][_0x615c('0x8d')]())['where'](_0x615c('0xad')))[_0x615c('0x8d')]();}_0x10baad[_0x615c('0x8b')](db[_0x615c('0x8c')]['query'](_0x48ce07));}return BPromise[_0x615c('0x90')](_0x10baad);}})[_0x615c('0x28')](function(){var _0x15e276=[];var _0x23e9a2=squel[_0x615c('0xa1')]()[_0x615c('0xa2')](_0x615c('0xb3'))[_0x615c('0xa3')]([_0x615c('0xb4'),_0x615c('0xa8'),_0x615c('0xb5'),_0x615c('0x60'),'updatedAt'],squel[_0x615c('0xa7')]()[_0x615c('0x84')]('h.id')[_0x615c('0x84')]('ci.item')['field'](_0x615c('0xb6'))['field']('\x27'+_0x51bca0+'\x27','createdAt')[_0x615c('0x84')]('\x27'+_0x51bca0+'\x27',_0x615c('0x61'))[_0x615c('0x85')](_0x615c('0xb7'),'ci')[_0x615c('0x86')]('cm_hopper','h',_0x615c('0xb8'))[_0x615c('0x49')](_0x615c('0xb9'),_0x51bca0)['where']('ci.ItemClass=?','PHONE'))[_0x615c('0x8d')]();_0x15e276['push'](db[_0x615c('0x8c')]['query'](_0x23e9a2));return BPromise[_0x615c('0x90')](_0x15e276);})[_0x615c('0x28')](function(){return _0x1b71db;})[_0x615c('0x28')](respondWithResult(_0x4cdd8b,null))[_0x615c('0x50')](handleError(_0x4cdd8b,null));};exports['removeLists']=function(_0x4acd61,_0xabda91,_0x1f394d){return db[_0x615c('0x39')]['find']({'where':{'id':_0x4acd61['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0xabda91,null))['then'](function(_0x5e55e9){if(_0x5e55e9){return _0x5e55e9[_0x615c('0xba')](_0x4acd61['query'][_0x615c('0x83')]);}})[_0x615c('0x28')](function(_0x4e2b7b){if(_0x4e2b7b){return db[_0x615c('0x65')][_0x615c('0x27')]({'where':{'ListId':_0x4acd61[_0x615c('0x3f')][_0x615c('0x83')],'VoiceQueueId':_0x4acd61['params']['id']}})['then'](function(){return _0x4e2b7b;});}})[_0x615c('0x28')](respondWithStatusCode(_0xabda91,null))[_0x615c('0x50')](handleError(_0xabda91,null));};exports[_0x615c('0xbb')]=function(_0x24741b,_0x233463,_0x2c4ffa){var _0x58c640={};var _0x36368e={};var _0x336798;var _0x543081;return db['VoiceQueue']['findOne']({'where':{'id':_0x24741b[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x233463,null))['then'](function(_0x5982fe){if(_0x5982fe){_0x336798=_0x5982fe;_0x36368e[_0x615c('0x3d')]=_['keys'](db[_0x615c('0x9c')][_0x615c('0x3a')]);_0x36368e[_0x615c('0x3f')]=_['keys'](_0x24741b[_0x615c('0x3f')]);_0x36368e[_0x615c('0x40')]=_[_0x615c('0x41')](_0x36368e['model'],_0x36368e[_0x615c('0x3f')]);_0x58c640[_0x615c('0x42')]=_[_0x615c('0x41')](_0x36368e[_0x615c('0x3d')],qs[_0x615c('0x43')](_0x24741b[_0x615c('0x3f')]['fields']));_0x58c640[_0x615c('0x42')]=_0x58c640[_0x615c('0x42')][_0x615c('0x66')]?_0x58c640[_0x615c('0x42')]:_0x36368e[_0x615c('0x3d')];_0x58c640[_0x615c('0x46')]=qs['sort'](_0x24741b[_0x615c('0x3f')]['sort']);_0x58c640[_0x615c('0x49')]=qs[_0x615c('0x40')](_[_0x615c('0x48')](_0x24741b[_0x615c('0x3f')],_0x36368e[_0x615c('0x40')]));if(_0x24741b[_0x615c('0x3f')][_0x615c('0x2c')]){_0x58c640[_0x615c('0x49')]=_['merge'](_0x58c640[_0x615c('0x49')],{'$or':_[_0x615c('0x2e')](_0x58c640[_0x615c('0x42')],function(_0x17789f){var _0x1c57fb={};_0x1c57fb[_0x17789f]={'$like':'%'+_0x24741b[_0x615c('0x3f')]['filter']+'%'};return _0x1c57fb;})});}_0x58c640=_['merge']({},_0x58c640,_0x24741b[_0x615c('0x4c')]);return _0x336798[_0x615c('0xbb')](_0x58c640);}})[_0x615c('0x28')](function(_0x41bf57){if(_0x41bf57){_0x543081=_0x41bf57[_0x615c('0x66')];if(!_0x24741b[_0x615c('0x3f')][_0x615c('0x44')](_0x615c('0x45'))){_0x58c640['limit']=qs[_0x615c('0x21')](_0x24741b[_0x615c('0x3f')]['limit']);_0x58c640['offset']=qs['offset'](_0x24741b[_0x615c('0x3f')][_0x615c('0x1f')]);}return _0x336798[_0x615c('0xbb')](_0x58c640);}})[_0x615c('0x28')](function(_0x3881f6){if(_0x3881f6){return _0x3881f6?{'count':_0x543081,'rows':_0x3881f6}:null;}})[_0x615c('0x28')](respondWithResult(_0x233463,null))[_0x615c('0x50')](handleError(_0x233463,null));};exports[_0x615c('0xbc')]=function(_0x1963c9,_0x530ccf,_0x56d890){var _0x335937,_0x3f6d1b;return db[_0x615c('0x39')][_0x615c('0x32')]({'where':{'id':_0x1963c9['params']['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x530ccf,null))[_0x615c('0x28')](function(_0x538fb2){if(_0x538fb2){_0x3f6d1b=_0x538fb2;return _0x538fb2[_0x615c('0xbc')](_0x1963c9[_0x615c('0x55')][_0x615c('0x83')],_[_0x615c('0x5f')](_0x1963c9[_0x615c('0x55')],[_0x615c('0x83'),'id'])||{});}return null;})[_0x615c('0x97')](function(_0x18e1c2){var _0x27b498;_0x335937=_0x18e1c2||[];var _0x40114c=[];if(_0x18e1c2){for(var _0x1f1af4=0x0;_0x1f1af4<_0x18e1c2[_0x615c('0x66')];_0x1f1af4+=0x1){var _0x54d714=_0x18e1c2[_0x1f1af4][_0x615c('0x56')]({'plain':!![]});_0x27b498=squel[_0x615c('0xa1')]()[_0x615c('0xa2')](_0x615c('0xbd'))[_0x615c('0xa3')]([_0x615c('0xa8'),'ContactId','ListId',_0x615c('0x67'),_0x615c('0x60'),_0x615c('0x61')],squel[_0x615c('0xa7')]()[_0x615c('0x84')](_0x615c('0xa8'),_0x615c('0xa8'))[_0x615c('0x84')]('id',_0x615c('0xa5'))[_0x615c('0x84')](_0x54d714[_0x615c('0xac')][_0x615c('0x8d')](),_0x615c('0xa6'))[_0x615c('0x84')](_0x1963c9['params']['id'][_0x615c('0x8d')](),'VoiceQueueId')[_0x615c('0x84')]('NOW()','createdAt')[_0x615c('0x84')](_0x615c('0xbe'),_0x615c('0x61'))[_0x615c('0x85')]('cm_contacts')['where'](_0x615c('0xaa'))[_0x615c('0x49')]('ListId\x20=\x20?',_0x54d714['CmListId'][_0x615c('0x8d')]())[_0x615c('0x49')](_0x615c('0xad')))[_0x615c('0x8d')]();_0x40114c[_0x615c('0x8b')](db['sequelize'][_0x615c('0x3f')](_0x27b498));}return BPromise[_0x615c('0x90')](_0x40114c);}})[_0x615c('0x28')](function(){return _0x335937;})[_0x615c('0x28')](respondWithResult(_0x530ccf,null))['catch'](handleError(_0x530ccf,null));};exports[_0x615c('0xbf')]=function(_0x333b9e,_0x437dac,_0x5a1b0f){return db['VoiceQueue']['find']({'where':{'id':_0x333b9e[_0x615c('0x52')]['id']}})[_0x615c('0x28')](handleEntityNotFound(_0x437dac,null))[_0x615c('0x28')](function(_0x363348){if(_0x363348){return _0x363348['removeBlackLists'](_0x333b9e[_0x615c('0x3f')]['ids']);}})[_0x615c('0x28')](function(_0x2f5977){if(_0x2f5977){return db[_0x615c('0x6b')][_0x615c('0x27')]({'where':{'ListId':_0x333b9e[_0x615c('0x3f')][_0x615c('0x83')],'VoiceQueueId':_0x333b9e[_0x615c('0x52')]['id']}})[_0x615c('0x28')](function(){return _0x2f5977;});}})[_0x615c('0x28')](respondWithStatusCode(_0x437dac,null))['catch'](handleError(_0x437dac,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 0aaaa63..fecd280 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 _0x849d=['../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x323b75,_0x5f46d5){var _0x2fcd9e=function(_0x16512b){while(--_0x16512b){_0x323b75['push'](_0x323b75['shift']());}};_0x2fcd9e(++_0x5f46d5);}(_0x849d,0x1d5));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd849('0x0'));var VoiceQueue=require(_0xd849('0x1'))['db'][_0xd849('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd849('0x3')](0x0);var events={'afterCreate':_0xd849('0x4'),'afterUpdate':'update','afterDestroy':_0xd849('0x5')};function emitEvent(_0x5f45bf){return function(_0x3dd943,_0x240115,_0xda0491){VoiceQueueEvents[_0xd849('0x6')](_0x5f45bf+':'+_0x3dd943['id'],_0x3dd943);VoiceQueueEvents[_0xd849('0x6')](_0x5f45bf,_0x3dd943);_0xda0491(null);};}for(var e in events){if(events[_0xd849('0x7')](e)){var event=events[e];VoiceQueue[_0xd849('0x8')](e,emitEvent(event));}}module[_0xd849('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x598b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x598b,0x1ed));var _0xb598=function(_0x4c77f3,_0x2ece5f){_0x4c77f3=_0x4c77f3-0x0;var _0x2c5022=_0x598b[_0x4c77f3];return _0x2c5022;};'use strict';var EventEmitter=require(_0xb598('0x0'));var VoiceQueue=require(_0xb598('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb598('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb598('0x3')};function emitEvent(_0x5db32a){return function(_0x2ebc1c,_0x58cdda,_0x4c5919){VoiceQueueEvents['emit'](_0x5db32a+':'+_0x2ebc1c['id'],_0x2ebc1c);VoiceQueueEvents[_0xb598('0x4')](_0x5db32a,_0x2ebc1c);_0x4c5919(null);};}for(var e in events){if(events[_0xb598('0x5')](e)){var event=events[e];VoiceQueue[_0xb598('0x6')](e,emitEvent(event));}}module[_0xb598('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4d846e5..df59c45 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x2f3790,_0x377aa7){var _0x174a8e=function(_0x5f3bbc){while(--_0x5f3bbc){_0x2f3790['push'](_0x2f3790['shift']());}};_0x174a8e(++_0x377aa7);}(_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 logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x2f7725,_0x4d913b){var _0x498fa9=function(_0x796f63){while(--_0x796f63){_0x2f7725['push'](_0x2f7725['shift']());}};_0x498fa9(++_0x4d913b);}(_0x70e0,0x17b));var _0x070e=function(_0x3badca,_0x202718){_0x3badca=_0x3badca-0x0;var _0x1a5b61=_0x70e0[_0x3badca];return _0x1a5b61;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 d460471..3cc951c 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 _0xc99b=['options','where','limit','include','model','attributes','map','debug','ShowVoiceQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll'];(function(_0x495e8f,_0x45497d){var _0x1dfcac=function(_0x28f67c){while(--_0x28f67c){_0x495e8f['push'](_0x495e8f['shift']());}};_0x1dfcac(++_0x45497d);}(_0xc99b,0x80));var _0xbc99=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0xc99b[_0x2125f0];return _0x12d6eb;};'use strict';var _=require('lodash');var util=require(_0xbc99('0x0'));var moment=require(_0xbc99('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc99('0x2'));var fs=require('fs');var Redis=require(_0xbc99('0x3'));var db=require(_0xbc99('0x4'))['db'];var utils=require(_0xbc99('0x5'));var logger=require(_0xbc99('0x6'))(_0xbc99('0x7'));var config=require(_0xbc99('0x8'));var jayson=require(_0xbc99('0x9'));var client=jayson[_0xbc99('0xa')][_0xbc99('0xb')]({'port':0x232a});config[_0xbc99('0xc')]=_['defaults'](config['redis'],{'host':_0xbc99('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc99('0xc')]));require(_0xbc99('0xe'))['register'](socket);function respondWithRpcPromise(_0x4adbd2,_0x2fe919,_0x2196a7){return new BPromise(function(_0x4cc4d0,_0x3ab9f0){return client['request'](_0x4adbd2,_0x2196a7)[_0xbc99('0xf')](function(_0x154fda){logger[_0xbc99('0x10')](_0xbc99('0x11'),_0x2fe919,_0xbc99('0x12'));logger['debug'](_0xbc99('0x13'),_0x2fe919,_0xbc99('0x12'),JSON[_0xbc99('0x14')](_0x154fda));if(_0x154fda[_0xbc99('0x15')]){if(_0x154fda['error']['code']===0x1f4){logger[_0xbc99('0x15')](_0xbc99('0x11'),_0x2fe919,_0x154fda[_0xbc99('0x15')]['message']);return _0x3ab9f0(_0x154fda[_0xbc99('0x15')][_0xbc99('0x16')]);}logger[_0xbc99('0x15')](_0xbc99('0x11'),_0x2fe919,_0x154fda[_0xbc99('0x15')][_0xbc99('0x16')]);return _0x4cc4d0(_0x154fda['error'][_0xbc99('0x16')]);}else{logger[_0xbc99('0x10')](_0xbc99('0x11'),_0x2fe919,_0xbc99('0x12'));_0x4cc4d0(_0x154fda[_0xbc99('0x17')][_0xbc99('0x16')]);}})[_0xbc99('0x18')](function(_0x4b0ed2){logger[_0xbc99('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x2fe919,_0x4b0ed2);_0x3ab9f0(_0x4b0ed2);});});}exports[_0xbc99('0x19')]=function(_0x2ce381){var _0x4dd242=this;return new Promise(function(_0x633ffb,_0x1bcd3d){return db[_0xbc99('0x1a')][_0xbc99('0x1b')]({'raw':_0x2ce381[_0xbc99('0x1c')]?_0x2ce381['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ce381[_0xbc99('0x1c')]?_0x2ce381[_0xbc99('0x1c')][_0xbc99('0x1d')]||null:null,'attributes':_0x2ce381['options']?_0x2ce381[_0xbc99('0x1c')]['attributes']||null:null,'limit':_0x2ce381[_0xbc99('0x1c')]?_0x2ce381[_0xbc99('0x1c')][_0xbc99('0x1e')]||null:null,'include':_0x2ce381[_0xbc99('0x1c')]?_0x2ce381[_0xbc99('0x1c')][_0xbc99('0x1f')]?_['map'](_0x2ce381[_0xbc99('0x1c')][_0xbc99('0x1f')],function(_0x784032){return{'model':db[_0x784032[_0xbc99('0x20')]],'as':_0x784032['as'],'attributes':_0x784032[_0xbc99('0x21')],'include':_0x784032[_0xbc99('0x1f')]?_[_0xbc99('0x22')](_0x784032[_0xbc99('0x1f')],function(_0x3ac262){return{'model':db[_0x3ac262[_0xbc99('0x20')]],'as':_0x3ac262['as'],'attributes':_0x3ac262[_0xbc99('0x21')],'include':_0x3ac262[_0xbc99('0x1f')]?_['map'](_0x3ac262[_0xbc99('0x1f')],function(_0x48f345){return{'model':db[_0x48f345[_0xbc99('0x20')]],'as':_0x48f345['as'],'attributes':_0x48f345[_0xbc99('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xde80ef){logger[_0xbc99('0x10')]('GetVoiceQueue',_0x2ce381);logger[_0xbc99('0x23')]('GetVoiceQueue',_0x2ce381,JSON[_0xbc99('0x14')](_0xde80ef));_0x633ffb(_0xde80ef);})[_0xbc99('0x18')](function(_0x3e9ea9){logger[_0xbc99('0x15')]('GetVoiceQueue',_0x3e9ea9['message'],_0x2ce381);_0x1bcd3d(_0x4dd242['error'](0x1f4,_0x3e9ea9[_0xbc99('0x16')]));});});};exports[_0xbc99('0x24')]=function(_0x451cf1){var _0x28139c=this;return new Promise(function(_0x47be37,_0x302c77){return db[_0xbc99('0x1a')][_0xbc99('0x25')]({'raw':_0x451cf1['options']?_0x451cf1[_0xbc99('0x1c')][_0xbc99('0x26')]===undefined?!![]:![]:!![],'where':_0x451cf1[_0xbc99('0x1c')]?_0x451cf1[_0xbc99('0x1c')][_0xbc99('0x1d')]||null:null,'attributes':_0x451cf1[_0xbc99('0x1c')]?_0x451cf1['options'][_0xbc99('0x21')]||null:null,'include':_0x451cf1['options']?_0x451cf1[_0xbc99('0x1c')][_0xbc99('0x1f')]?_['map'](_0x451cf1['options']['include'],function(_0x1cba4f){return{'model':db[_0x1cba4f[_0xbc99('0x20')]],'as':_0x1cba4f['as'],'attributes':_0x1cba4f[_0xbc99('0x21')],'include':_0x1cba4f['include']?_[_0xbc99('0x22')](_0x1cba4f['include'],function(_0x597339){return{'model':db[_0x597339[_0xbc99('0x20')]],'as':_0x597339['as'],'attributes':_0x597339[_0xbc99('0x21')],'include':_0x597339[_0xbc99('0x1f')]?_['map'](_0x597339[_0xbc99('0x1f')],function(_0x4d5e2e){return{'model':db[_0x4d5e2e[_0xbc99('0x20')]],'as':_0x4d5e2e['as'],'attributes':_0x4d5e2e[_0xbc99('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbc99('0xf')](function(_0x23cf2c){logger[_0xbc99('0x10')](_0xbc99('0x24'),_0x451cf1);logger[_0xbc99('0x23')](_0xbc99('0x24'),_0x451cf1,JSON[_0xbc99('0x14')](_0x23cf2c));_0x47be37(_0x23cf2c);})[_0xbc99('0x18')](function(_0x1a0575){logger[_0xbc99('0x15')](_0xbc99('0x24'),_0x1a0575[_0xbc99('0x16')],_0x451cf1);_0x302c77(_0x28139c[_0xbc99('0x15')](0x1f4,_0x1a0575['message']));});});}; \ No newline at end of file +var _0xf0f5=['message','result','catch','findAll','raw','options','where','attributes','limit','map','include','model','GetVoiceQueue','VoiceQueue','find','ShowVoiceQueue','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x5a4768,_0x1931a7){var _0x5e79f4=function(_0x539bad){while(--_0x539bad){_0x5a4768['push'](_0x5a4768['shift']());}};_0x5e79f4(++_0x1931a7);}(_0xf0f5,0x122));var _0x5f0f=function(_0x2f2315,_0x85c29e){_0x2f2315=_0x2f2315-0x0;var _0x574853=_0xf0f5[_0x2f2315];return _0x574853;};'use strict';var _=require(_0x5f0f('0x0'));var util=require('util');var moment=require(_0x5f0f('0x1'));var BPromise=require(_0x5f0f('0x2'));var rs=require(_0x5f0f('0x3'));var fs=require('fs');var Redis=require(_0x5f0f('0x4'));var db=require(_0x5f0f('0x5'))['db'];var utils=require(_0x5f0f('0x6'));var logger=require('../../config/logger')(_0x5f0f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f0f('0x8'));var client=jayson['client'][_0x5f0f('0x9')]({'port':0x232a});config[_0x5f0f('0xa')]=_['defaults'](config[_0x5f0f('0xa')],{'host':_0x5f0f('0xb'),'port':0x18eb});var socket=require(_0x5f0f('0xc'))(new Redis(config[_0x5f0f('0xa')]));require(_0x5f0f('0xd'))['register'](socket);function respondWithRpcPromise(_0x528804,_0xb1d61d,_0x4ac04b){return new BPromise(function(_0x24b572,_0x12d9d9){return client['request'](_0x528804,_0x4ac04b)[_0x5f0f('0xe')](function(_0x44ff38){logger[_0x5f0f('0xf')](_0x5f0f('0x10'),_0xb1d61d,_0x5f0f('0x11'));logger['debug'](_0x5f0f('0x12'),_0xb1d61d,'request\x20sent',JSON[_0x5f0f('0x13')](_0x44ff38));if(_0x44ff38['error']){if(_0x44ff38['error'][_0x5f0f('0x14')]===0x1f4){logger['error'](_0x5f0f('0x10'),_0xb1d61d,_0x44ff38[_0x5f0f('0x15')]['message']);return _0x12d9d9(_0x44ff38['error']['message']);}logger[_0x5f0f('0x15')](_0x5f0f('0x10'),_0xb1d61d,_0x44ff38[_0x5f0f('0x15')]['message']);return _0x24b572(_0x44ff38[_0x5f0f('0x15')][_0x5f0f('0x16')]);}else{logger['info'](_0x5f0f('0x10'),_0xb1d61d,_0x5f0f('0x11'));_0x24b572(_0x44ff38[_0x5f0f('0x17')][_0x5f0f('0x16')]);}})[_0x5f0f('0x18')](function(_0xb534f6){logger[_0x5f0f('0x15')](_0x5f0f('0x10'),_0xb1d61d,_0xb534f6);_0x12d9d9(_0xb534f6);});});}exports['GetVoiceQueue']=function(_0x1b77db){var _0xaacaae=this;return new Promise(function(_0x10fde5,_0x7d7334){return db['VoiceQueue'][_0x5f0f('0x19')]({'raw':_0x1b77db['options']?_0x1b77db['options'][_0x5f0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b77db[_0x5f0f('0x1b')]?_0x1b77db[_0x5f0f('0x1b')][_0x5f0f('0x1c')]||null:null,'attributes':_0x1b77db['options']?_0x1b77db[_0x5f0f('0x1b')][_0x5f0f('0x1d')]||null:null,'limit':_0x1b77db['options']?_0x1b77db['options'][_0x5f0f('0x1e')]||null:null,'include':_0x1b77db[_0x5f0f('0x1b')]?_0x1b77db[_0x5f0f('0x1b')]['include']?_[_0x5f0f('0x1f')](_0x1b77db[_0x5f0f('0x1b')][_0x5f0f('0x20')],function(_0x108179){return{'model':db[_0x108179['model']],'as':_0x108179['as'],'attributes':_0x108179[_0x5f0f('0x1d')],'include':_0x108179[_0x5f0f('0x20')]?_[_0x5f0f('0x1f')](_0x108179['include'],function(_0xeb8531){return{'model':db[_0xeb8531['model']],'as':_0xeb8531['as'],'attributes':_0xeb8531[_0x5f0f('0x1d')],'include':_0xeb8531[_0x5f0f('0x20')]?_[_0x5f0f('0x1f')](_0xeb8531[_0x5f0f('0x20')],function(_0x107c4e){return{'model':db[_0x107c4e[_0x5f0f('0x21')]],'as':_0x107c4e['as'],'attributes':_0x107c4e[_0x5f0f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5f0f('0xe')](function(_0x21dd72){logger['info']('GetVoiceQueue',_0x1b77db);logger['debug'](_0x5f0f('0x22'),_0x1b77db,JSON[_0x5f0f('0x13')](_0x21dd72));_0x10fde5(_0x21dd72);})['catch'](function(_0x30533f){logger[_0x5f0f('0x15')](_0x5f0f('0x22'),_0x30533f[_0x5f0f('0x16')],_0x1b77db);_0x7d7334(_0xaacaae['error'](0x1f4,_0x30533f['message']));});});};exports['ShowVoiceQueue']=function(_0x15e916){var _0x344488=this;return new Promise(function(_0x31f9dc,_0x209307){return db[_0x5f0f('0x23')][_0x5f0f('0x24')]({'raw':_0x15e916[_0x5f0f('0x1b')]?_0x15e916[_0x5f0f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x15e916[_0x5f0f('0x1b')]?_0x15e916[_0x5f0f('0x1b')][_0x5f0f('0x1c')]||null:null,'attributes':_0x15e916[_0x5f0f('0x1b')]?_0x15e916[_0x5f0f('0x1b')][_0x5f0f('0x1d')]||null:null,'include':_0x15e916[_0x5f0f('0x1b')]?_0x15e916[_0x5f0f('0x1b')][_0x5f0f('0x20')]?_['map'](_0x15e916[_0x5f0f('0x1b')][_0x5f0f('0x20')],function(_0x2aedc){return{'model':db[_0x2aedc[_0x5f0f('0x21')]],'as':_0x2aedc['as'],'attributes':_0x2aedc[_0x5f0f('0x1d')],'include':_0x2aedc[_0x5f0f('0x20')]?_[_0x5f0f('0x1f')](_0x2aedc[_0x5f0f('0x20')],function(_0x576831){return{'model':db[_0x576831[_0x5f0f('0x21')]],'as':_0x576831['as'],'attributes':_0x576831[_0x5f0f('0x1d')],'include':_0x576831[_0x5f0f('0x20')]?_[_0x5f0f('0x1f')](_0x576831['include'],function(_0x289616){return{'model':db[_0x289616[_0x5f0f('0x21')]],'as':_0x289616['as'],'attributes':_0x289616[_0x5f0f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5f0f('0xe')](function(_0x88000c){logger['info'](_0x5f0f('0x25'),_0x15e916);logger[_0x5f0f('0x26')](_0x5f0f('0x25'),_0x15e916,JSON['stringify'](_0x88000c));_0x31f9dc(_0x88000c);})['catch'](function(_0x5942fc){logger[_0x5f0f('0x15')](_0x5f0f('0x25'),_0x5942fc[_0x5f0f('0x16')],_0x15e916);_0x209307(_0x344488[_0x5f0f('0x15')](0x1f4,_0x5942fc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2e59c62..c4aa951 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 _0x4467=['emit','removeListener','length','voiceQueue:','./voiceQueue.events','remove','update'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x4467,0x1d9));var _0x7446=function(_0x9d83c1,_0x20c4e6){_0x9d83c1=_0x9d83c1-0x0;var _0x4acc75=_0x4467[_0x9d83c1];return _0x4acc75;};'use strict';var VoiceQueueEvents=require(_0x7446('0x0'));var events=['save',_0x7446('0x1'),_0x7446('0x2')];function createListener(_0x4d83bf,_0xcd68f9){return function(_0x3a730b){_0xcd68f9[_0x7446('0x3')](_0x4d83bf,_0x3a730b);};}function removeListener(_0x43ab08,_0x389bd6){return function(){VoiceQueueEvents[_0x7446('0x4')](_0x43ab08,_0x389bd6);};}exports['register']=function(_0x4f09af){for(var _0x5b6437=0x0,_0x11b2eb=events[_0x7446('0x5')];_0x5b6437<_0x11b2eb;_0x5b6437++){var _0x3fe4a4=events[_0x5b6437];var _0xcb2cb0=createListener(_0x7446('0x6')+_0x3fe4a4,_0x4f09af);VoiceQueueEvents['on'](_0x3fe4a4,_0xcb2cb0);}}; \ No newline at end of file +var _0x4b4b=['update','removeListener','register','length','voiceQueue:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b4b,0x1ef));var _0xb4b4=function(_0x3b9c92,_0x573dcb){_0x3b9c92=_0x3b9c92-0x0;var _0x1f00db=_0x4b4b[_0x3b9c92];return _0x1f00db;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xb4b4('0x0'),_0xb4b4('0x1'),_0xb4b4('0x2')];function createListener(_0x5f3021,_0x365078){return function(_0x2f1e93){_0x365078['emit'](_0x5f3021,_0x2f1e93);};}function removeListener(_0xdbdac,_0x58a07){return function(){VoiceQueueEvents[_0xb4b4('0x3')](_0xdbdac,_0x58a07);};}exports[_0xb4b4('0x4')]=function(_0x23c99a){for(var _0x6d7c91=0x0,_0x451b5e=events[_0xb4b4('0x5')];_0x6d7c91<_0x451b5e;_0x6d7c91++){var _0x4c90f0=events[_0x6d7c91];var _0x185aa7=createListener(_0xb4b4('0x6')+_0x4c90f0,_0x23c99a);VoiceQueueEvents['on'](_0x4c90f0,_0x185aa7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5f0dcf7..af1661a 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 _0x4786=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','/:id','show','post','create','put','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x27529d,_0x25a7f1){var _0x44f7d8=function(_0x568038){while(--_0x568038){_0x27529d['push'](_0x27529d['shift']());}};_0x44f7d8(++_0x25a7f1);}(_0x4786,0x118));var _0x6478=function(_0x58a38c,_0x26f95a){_0x58a38c=_0x58a38c-0x0;var _0x2a8c0a=_0x4786[_0x58a38c];return _0x2a8c0a;};'use strict';var multer=require('multer');var util=require(_0x6478('0x0'));var path=require(_0x6478('0x1'));var timeout=require('connect-timeout');var express=require(_0x6478('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6478('0x3'));var interaction=require(_0x6478('0x4'));var config=require(_0x6478('0x5'));var controller=require(_0x6478('0x6'));router[_0x6478('0x7')]('/',auth[_0x6478('0x8')](),controller[_0x6478('0x9')]);router[_0x6478('0x7')]('/describe',auth[_0x6478('0x8')](),controller['describe']);router[_0x6478('0x7')](_0x6478('0xa'),auth['isAuthenticated'](),controller[_0x6478('0xb')]);router['get'](_0x6478('0xc'),auth[_0x6478('0x8')](),controller[_0x6478('0xd')]);router[_0x6478('0xe')]('/',auth[_0x6478('0x8')](),controller[_0x6478('0xf')]);router[_0x6478('0x10')](_0x6478('0xc'),auth[_0x6478('0x8')](),controller['update']);router['delete'](_0x6478('0xc'),auth[_0x6478('0x8')](),controller[_0x6478('0x11')]);module[_0x6478('0x12')]=router; \ No newline at end of file +var _0xc351=['index','/describe','describe','get','getVoiceQueuesReport','/:id','show','post','create','put','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./voiceQueueReport.controller','isAuthenticated'];(function(_0x33705e,_0x3ae91d){var _0x3d97bd=function(_0x53ca5c){while(--_0x53ca5c){_0x33705e['push'](_0x33705e['shift']());}};_0x3d97bd(++_0x3ae91d);}(_0xc351,0x161));var _0x1c35=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xc351[_0x4ed4d2];return _0x15ae2e;};'use strict';var multer=require(_0x1c35('0x0'));var util=require('util');var path=require(_0x1c35('0x1'));var timeout=require(_0x1c35('0x2'));var express=require(_0x1c35('0x3'));var router=express['Router']();var fs_extra=require(_0x1c35('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1c35('0x5'));var controller=require(_0x1c35('0x6'));router['get']('/',auth[_0x1c35('0x7')](),controller[_0x1c35('0x8')]);router['get'](_0x1c35('0x9'),auth[_0x1c35('0x7')](),controller[_0x1c35('0xa')]);router[_0x1c35('0xb')]('/index',auth[_0x1c35('0x7')](),controller[_0x1c35('0xc')]);router[_0x1c35('0xb')](_0x1c35('0xd'),auth[_0x1c35('0x7')](),controller[_0x1c35('0xe')]);router[_0x1c35('0xf')]('/',auth[_0x1c35('0x7')](),controller[_0x1c35('0x10')]);router[_0x1c35('0x11')](_0x1c35('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1c35('0xd'),auth[_0x1c35('0x7')](),controller['destroy']);module[_0x1c35('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a216fd2..6e7e719 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 _0xc84e=['DATE','getDataValue','queuecallerjoinAt','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING'];(function(_0x57a591,_0x11679b){var _0xfb5450=function(_0x1310cd){while(--_0x1310cd){_0x57a591['push'](_0x57a591['shift']());}};_0xfb5450(++_0x11679b);}(_0xc84e,0x1bc));var _0xec84=function(_0x3369de,_0x31953d){_0x3369de=_0x3369de-0x0;var _0x3f088e=_0xc84e[_0x3369de];return _0x3f088e;};'use strict';var Sequelize=require(_0xec84('0x0'));var moment=require(_0xec84('0x1'));module[_0xec84('0x2')]={'type':{'type':Sequelize[_0xec84('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xec84('0x3')]},'calleridname':{'type':Sequelize[_0xec84('0x3')]},'queue':{'type':Sequelize[_0xec84('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xec84('0x4')],'set':function(_0x45d43f){var _0x1665ff=moment(_0x45d43f);var _0x2ac83a=moment(this[_0xec84('0x5')](_0xec84('0x6')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1ad699=_0x1665ff[_0xec84('0x7')](_0x2ac83a,_0xec84('0x8'));this[_0xec84('0x9')](_0xec84('0xa'),_0x45d43f);this[_0xec84('0x9')](_0xec84('0xb'),_0x1ad699||null);}},'position':{'type':Sequelize[_0xec84('0xc')]},'count':{'type':Sequelize[_0xec84('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xec84('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xec84('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xec84('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xec84('0x4')]},'queuecallerexit':{'type':Sequelize[_0xec84('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xec84('0x3')],'comment':_0xec84('0xe')},'originalposition':{'type':Sequelize[_0xec84('0xc')]},'channel':{'type':Sequelize[_0xec84('0x3')]},'connectedlinenum':{'type':Sequelize[_0xec84('0x3')]},'connectedlinename':{'type':Sequelize[_0xec84('0x3')]},'accountcode':{'type':Sequelize[_0xec84('0x3')]},'context':{'type':Sequelize[_0xec84('0x3')]},'exten':{'type':Sequelize[_0xec84('0x3')]},'priority':{'type':Sequelize[_0xec84('0x3')]},'holdtime':{'type':Sequelize[_0xec84('0xc')]},'mohtime':{'type':Sequelize[_0xec84('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xec84('0x3')],'comment':_0xec84('0xf')},'transferexten':{'type':Sequelize[_0xec84('0x3')]},'transferuniqueid':{'type':Sequelize[_0xec84('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xec84('0x3')]},'thirdDisposition':{'type':Sequelize[_0xec84('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b0a=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x4b0a,0xbc));var _0xa4b0=function(_0x74463,_0x191441){_0x74463=_0x74463-0x0;var _0x4c3af8=_0x4b0a[_0x74463];return _0x4c3af8;};'use strict';var Sequelize=require(_0xa4b0('0x0'));var moment=require(_0xa4b0('0x1'));module[_0xa4b0('0x2')]={'type':{'type':Sequelize[_0xa4b0('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa4b0('0x3')]},'calleridname':{'type':Sequelize[_0xa4b0('0x3')]},'queue':{'type':Sequelize[_0xa4b0('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xa4b0('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xa4b0('0x4')],'set':function(_0x5839fd){var _0x44d40b=moment(_0x5839fd);var _0xde493f=moment(this[_0xa4b0('0x5')](_0xa4b0('0x6')))[_0xa4b0('0x7')](_0xa4b0('0x8'));var _0x25f2b1=_0x44d40b[_0xa4b0('0x9')](_0xde493f,'seconds');this[_0xa4b0('0xa')](_0xa4b0('0xb'),_0x5839fd);this['setDataValue'](_0xa4b0('0xc'),_0x25f2b1||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xa4b0('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xa4b0('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa4b0('0x4')]},'queuecallerexit':{'type':Sequelize[_0xa4b0('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa4b0('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xa4b0('0xe')},'originalposition':{'type':Sequelize[_0xa4b0('0xf')]},'channel':{'type':Sequelize[_0xa4b0('0x3')]},'connectedlinenum':{'type':Sequelize[_0xa4b0('0x3')]},'connectedlinename':{'type':Sequelize[_0xa4b0('0x3')]},'accountcode':{'type':Sequelize[_0xa4b0('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa4b0('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa4b0('0xf')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa4b0('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa4b0('0x3')]},'transfer':{'type':Sequelize[_0xa4b0('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa4b0('0x3')],'comment':_0xa4b0('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xa4b0('0x3')]},'disposition':{'type':Sequelize[_0xa4b0('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa4b0('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xa4b0('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ff0a5ae..ad32219 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 _0x812b=['model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','then','include','findAll','rows','catch','show','keys','includeAll','merge','options','find','create','body','params','describe','nolimit','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection'];(function(_0x8d68ce,_0x135a7f){var _0x2e1f64=function(_0x1e8aed){while(--_0x1e8aed){_0x8d68ce['push'](_0x8d68ce['shift']());}};_0x2e1f64(++_0x135a7f);}(_0x812b,0xc4));var _0xb812=function(_0x1476fb,_0x467d01){_0x1476fb=_0x1476fb-0x0;var _0x44f57e=_0x812b[_0x1476fb];return _0x44f57e;};'use strict';var emlformat=require(_0xb812('0x0'));var rimraf=require(_0xb812('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb812('0x2'));var rp=require(_0xb812('0x3'));var moment=require(_0xb812('0x4'));var BPromise=require(_0xb812('0x5'));var Mustache=require(_0xb812('0x6'));var util=require('util');var path=require(_0xb812('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb812('0x8'));var fs=require('fs');var fs_extra=require(_0xb812('0x9'));var _=require(_0xb812('0xa'));var squel=require(_0xb812('0xb'));var crypto=require(_0xb812('0xc'));var jsforce=require(_0xb812('0xd'));var deskjs=require(_0xb812('0xe'));var toCsv=require(_0xb812('0xf'));var querystring=require(_0xb812('0x10'));var Papa=require('papaparse');var Redis=require(_0xb812('0x11'));var authService=require(_0xb812('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb812('0x13'))(_0xb812('0x14'));var utils=require(_0xb812('0x15'));var config=require(_0xb812('0x16'));var licenseUtil=require(_0xb812('0x17'));var db=require(_0xb812('0x18'))['db'];config['redis']=_[_0xb812('0x19')](config[_0xb812('0x1a')],{'host':_0xb812('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb812('0x1a')]));require(_0xb812('0x1c'))[_0xb812('0x1d')](socket);function respondWithStatusCode(_0x46b49b,_0xf2908d){_0xf2908d=_0xf2908d||0xcc;return function(_0x5cf1cd){if(_0x5cf1cd){return _0x46b49b[_0xb812('0x1e')](_0xf2908d);}return _0x46b49b[_0xb812('0x1f')](_0xf2908d)[_0xb812('0x20')]();};}function respondWithResult(_0xb971e9,_0x5760c8){_0x5760c8=_0x5760c8||0xc8;return function(_0x28866c){if(_0x28866c){return _0xb971e9['status'](_0x5760c8)[_0xb812('0x21')](_0x28866c);}};}function respondWithFilteredResult(_0x467369,_0x173166){return function(_0x23e48c){if(_0x23e48c){var _0xb82551=typeof _0x173166[_0xb812('0x22')]===_0xb812('0x23')&&typeof _0x173166[_0xb812('0x24')]===_0xb812('0x23');var _0x1fb216=_0x23e48c[_0xb812('0x25')];var _0x23b9ec=_0xb82551?0x0:_0x173166[_0xb812('0x22')];var _0x5c54e4=_0xb82551?_0x23e48c[_0xb812('0x25')]:_0x173166['offset']+_0x173166[_0xb812('0x24')];var _0x148e41;if(_0x5c54e4>=_0x1fb216){_0x5c54e4=_0x1fb216;_0x148e41=0xc8;}else{_0x148e41=0xce;}_0x467369[_0xb812('0x1f')](_0x148e41);return _0x467369[_0xb812('0x26')](_0xb812('0x27'),_0x23b9ec+'-'+_0x5c54e4+'/'+_0x1fb216)[_0xb812('0x21')](_0x23e48c);}return null;};}function patchUpdates(_0x1db338){return function(_0x55c4e0){try{jsonpatch['apply'](_0x55c4e0,_0x1db338,!![]);}catch(_0x4d5230){return BPromise['reject'](_0x4d5230);}return _0x55c4e0[_0xb812('0x28')]();};}function saveUpdates(_0x1230d6,_0x149667){return function(_0x353e95){if(_0x353e95){return _0x353e95[_0xb812('0x29')](_0x1230d6)['then'](function(_0x30f6e0){return _0x30f6e0;});}return null;};}function removeEntity(_0x42d4a5,_0x2fcb41){return function(_0x97c470){if(_0x97c470){return _0x97c470[_0xb812('0x2a')]()['then'](function(){_0x42d4a5[_0xb812('0x1f')](0xcc)[_0xb812('0x20')]();});}};}function handleEntityNotFound(_0x206611,_0xff4eb0){return function(_0x26f190){if(!_0x26f190){_0x206611[_0xb812('0x1e')](0x194);}return _0x26f190;};}function handleError(_0x4e9d14,_0x2370cf){_0x2370cf=_0x2370cf||0x1f4;return function(_0x1f33fa){logger[_0xb812('0x2b')](_0x1f33fa['stack']);if(_0x1f33fa[_0xb812('0x2c')]){delete _0x1f33fa[_0xb812('0x2c')];}_0x4e9d14['status'](_0x2370cf)[_0xb812('0x2d')](_0x1f33fa);};}exports[_0xb812('0x2e')]=function(_0x2ba56a,_0xdaff87){var _0x7de8a9={},_0x2b18f3={},_0x1b37c6={'count':0x0,'rows':[]};var _0x3d13fc=_[_0xb812('0x2f')](db[_0xb812('0x30')][_0xb812('0x31')],function(_0x4edb69){return{'name':_0x4edb69[_0xb812('0x32')],'type':_0x4edb69[_0xb812('0x33')][_0xb812('0x34')]};});_0x2b18f3['model']=_[_0xb812('0x2f')](_0x3d13fc,'name');_0x2b18f3[_0xb812('0x35')]=_['keys'](_0x2ba56a['query']);_0x2b18f3[_0xb812('0x36')]=_[_0xb812('0x37')](_0x2b18f3[_0xb812('0x38')],_0x2b18f3[_0xb812('0x35')]);_0x7de8a9['attributes']=_[_0xb812('0x37')](_0x2b18f3[_0xb812('0x38')],qs[_0xb812('0x39')](_0x2ba56a[_0xb812('0x35')]['fields']));_0x7de8a9[_0xb812('0x3a')]=_0x7de8a9[_0xb812('0x3a')][_0xb812('0x3b')]?_0x7de8a9[_0xb812('0x3a')]:_0x2b18f3['model'];if(!_0x2ba56a[_0xb812('0x35')][_0xb812('0x3c')]('nolimit')){_0x7de8a9[_0xb812('0x24')]=qs['limit'](_0x2ba56a['query'][_0xb812('0x24')]);_0x7de8a9[_0xb812('0x22')]=qs[_0xb812('0x22')](_0x2ba56a['query'][_0xb812('0x22')]);}_0x7de8a9[_0xb812('0x3d')]=qs[_0xb812('0x3e')](_0x2ba56a['query'][_0xb812('0x3e')]);_0x7de8a9['where']=qs['filters'](_[_0xb812('0x3f')](_0x2ba56a['query'],_0x2b18f3[_0xb812('0x36')]),_0x3d13fc);if(_0x2ba56a[_0xb812('0x35')][_0xb812('0x40')]){_0x7de8a9[_0xb812('0x41')]=_['merge'](_0x7de8a9[_0xb812('0x41')],{'$or':_[_0xb812('0x2f')](_0x3d13fc,function(_0x5e680e){if(_0x5e680e[_0xb812('0x33')]!==_0xb812('0x42')){var _0x3299e2={};_0x3299e2[_0x5e680e[_0xb812('0x2c')]]={'$like':'%'+_0x2ba56a[_0xb812('0x35')][_0xb812('0x40')]+'%'};return _0x3299e2;}})});}_0x7de8a9=_['merge']({},_0x7de8a9,_0x2ba56a['options']);var _0xad8b16={'where':_0x7de8a9[_0xb812('0x41')]};return db[_0xb812('0x30')][_0xb812('0x25')](_0xad8b16)[_0xb812('0x43')](function(_0x25dfc1){_0x1b37c6['count']=_0x25dfc1;if(_0x2ba56a[_0xb812('0x35')]['includeAll']){_0x7de8a9[_0xb812('0x44')]=[{'all':!![]}];}return db[_0xb812('0x30')][_0xb812('0x45')](_0x7de8a9);})[_0xb812('0x43')](function(_0x304652){_0x1b37c6[_0xb812('0x46')]=_0x304652;return _0x1b37c6;})[_0xb812('0x43')](respondWithFilteredResult(_0xdaff87,_0x7de8a9))[_0xb812('0x47')](handleError(_0xdaff87,null));};exports[_0xb812('0x48')]=function(_0x39fafe,_0x1845f1){var _0x3dcff0={'raw':![],'where':{'id':_0x39fafe['params']['id']}},_0x4e10b6={};_0x4e10b6['model']=_[_0xb812('0x49')](db[_0xb812('0x30')][_0xb812('0x31')]);_0x4e10b6[_0xb812('0x35')]=_[_0xb812('0x49')](_0x39fafe['query']);_0x4e10b6['filters']=_['intersection'](_0x4e10b6[_0xb812('0x38')],_0x4e10b6[_0xb812('0x35')]);_0x3dcff0[_0xb812('0x3a')]=_[_0xb812('0x37')](_0x4e10b6[_0xb812('0x38')],qs[_0xb812('0x39')](_0x39fafe[_0xb812('0x35')][_0xb812('0x39')]));_0x3dcff0[_0xb812('0x3a')]=_0x3dcff0['attributes'][_0xb812('0x3b')]?_0x3dcff0['attributes']:_0x4e10b6['model'];if(_0x39fafe[_0xb812('0x35')][_0xb812('0x4a')]){_0x3dcff0['include']=[{'all':!![]}];}_0x3dcff0=_[_0xb812('0x4b')]({},_0x3dcff0,_0x39fafe[_0xb812('0x4c')]);return db['VoiceQueueReport'][_0xb812('0x4d')](_0x3dcff0)[_0xb812('0x43')](handleEntityNotFound(_0x1845f1,null))[_0xb812('0x43')](respondWithResult(_0x1845f1,null))[_0xb812('0x47')](handleError(_0x1845f1,null));};exports[_0xb812('0x4e')]=function(_0x8eb088,_0x31d885){return db['VoiceQueueReport'][_0xb812('0x4e')](_0x8eb088[_0xb812('0x4f')],{})[_0xb812('0x43')](respondWithResult(_0x31d885,0xc9))[_0xb812('0x47')](handleError(_0x31d885,null));};exports[_0xb812('0x29')]=function(_0xd19941,_0x18be48){if(_0xd19941['body']['id']){delete _0xd19941[_0xb812('0x4f')]['id'];}return db[_0xb812('0x30')][_0xb812('0x4d')]({'where':{'id':_0xd19941[_0xb812('0x50')]['id']}})[_0xb812('0x43')](handleEntityNotFound(_0x18be48,null))[_0xb812('0x43')](saveUpdates(_0xd19941[_0xb812('0x4f')],null))['then'](respondWithResult(_0x18be48,null))[_0xb812('0x47')](handleError(_0x18be48,null));};exports[_0xb812('0x2a')]=function(_0x5a3aee,_0x53188b){return db['VoiceQueueReport'][_0xb812('0x4d')]({'where':{'id':_0x5a3aee[_0xb812('0x50')]['id']}})[_0xb812('0x43')](handleEntityNotFound(_0x53188b,null))[_0xb812('0x43')](removeEntity(_0x53188b,null))[_0xb812('0x47')](handleError(_0x53188b,null));};exports[_0xb812('0x51')]=function(_0x29e5f6,_0x30142f){return db['VoiceQueueReport'][_0xb812('0x51')]()['then'](respondWithResult(_0x30142f,null))['catch'](handleError(_0x30142f,null));};exports['getVoiceQueuesReport']=function(_0x25e546,_0x29fd6c){var _0x151479={},_0x2902b5={},_0x30a2ed={'count':0x0,'rows':[]};_0x2902b5[_0xb812('0x38')]=_[_0xb812('0x49')](db['VoiceQueueReport'][_0xb812('0x31')]);_0x2902b5[_0xb812('0x35')]=_[_0xb812('0x49')](_0x25e546[_0xb812('0x35')]);_0x2902b5[_0xb812('0x36')]=_['intersection'](_0x2902b5[_0xb812('0x38')],_0x2902b5[_0xb812('0x35')]);_0x151479[_0xb812('0x3a')]=_['intersection'](_0x2902b5[_0xb812('0x38')],qs['fields'](_0x25e546[_0xb812('0x35')][_0xb812('0x39')]));_0x151479[_0xb812('0x3a')]=_0x151479[_0xb812('0x3a')][_0xb812('0x3b')]?_0x151479[_0xb812('0x3a')]:_0x2902b5[_0xb812('0x38')];if(!_0x25e546[_0xb812('0x35')]['hasOwnProperty'](_0xb812('0x52'))){_0x151479[_0xb812('0x24')]=qs[_0xb812('0x24')](_0x25e546[_0xb812('0x35')]['limit']);_0x151479['offset']=qs['offset'](_0x25e546[_0xb812('0x35')][_0xb812('0x22')]);}_0x151479[_0xb812('0x3d')]=qs[_0xb812('0x3e')](_0x25e546[_0xb812('0x35')][_0xb812('0x3e')]);_0x151479[_0xb812('0x41')]=qs[_0xb812('0x36')](_['pick'](_0x25e546[_0xb812('0x35')],_0x2902b5[_0xb812('0x36')]));if(_0x25e546['query'][_0xb812('0x40')]){_0x151479[_0xb812('0x41')]=_[_0xb812('0x4b')](_0x151479[_0xb812('0x41')],{'$or':_[_0xb812('0x2f')](_0x151479[_0xb812('0x3a')],function(_0x34b38d){var _0x4259fd={};_0x4259fd[_0x34b38d]={'$like':'%'+_0x25e546['query'][_0xb812('0x40')]+'%'};return _0x4259fd;})});}_0x151479=_[_0xb812('0x4b')]({},_0x151479,_0x25e546['options']);var _0x471fdf={'where':_0x151479[_0xb812('0x41')]};return db[_0xb812('0x30')][_0xb812('0x25')](_0x471fdf)['then'](function(_0x27e518){_0x30a2ed['count']=_0x27e518;if(_0x25e546[_0xb812('0x35')][_0xb812('0x4a')]){_0x151479[_0xb812('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb812('0x45')](_0x151479);})['then'](function(_0x1283d4){_0x30a2ed[_0xb812('0x46')]=_0x1283d4;return _0x30a2ed;})[_0xb812('0x43')](respondWithFilteredResult(_0x29fd6c,_0x151479,_0xb812('0x53')))['catch'](handleError(_0x29fd6c,null,_0xb812('0x53')));}; \ No newline at end of file +var _0x146a=['fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','length','include','find','create','body','update','params','describe','rows','getVoiceQueuesReport','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','VoiceQueueReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x146a,0xb8));var _0xa146=function(_0x53972e,_0x275c){_0x53972e=_0x53972e-0x0;var _0xc48fcf=_0x146a[_0x53972e];return _0xc48fcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa146('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa146('0x1'));var rp=require(_0xa146('0x2'));var moment=require('moment');var BPromise=require(_0xa146('0x3'));var Mustache=require(_0xa146('0x4'));var util=require(_0xa146('0x5'));var path=require(_0xa146('0x6'));var sox=require(_0xa146('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa146('0x8'));var _=require(_0xa146('0x9'));var squel=require(_0xa146('0xa'));var crypto=require(_0xa146('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa146('0xc'));var toCsv=require(_0xa146('0xd'));var querystring=require(_0xa146('0xe'));var Papa=require(_0xa146('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa146('0x10'));var hardwareService=require(_0xa146('0x11'));var logger=require(_0xa146('0x12'))(_0xa146('0x13'));var utils=require(_0xa146('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa146('0x15'));var db=require(_0xa146('0x16'))['db'];config[_0xa146('0x17')]=_[_0xa146('0x18')](config[_0xa146('0x17')],{'host':_0xa146('0x19'),'port':0x18eb});var socket=require(_0xa146('0x1a'))(new Redis(config[_0xa146('0x17')]));require(_0xa146('0x1b'))[_0xa146('0x1c')](socket);function respondWithStatusCode(_0x3a48ee,_0x206bc6){_0x206bc6=_0x206bc6||0xcc;return function(_0x9d19f0){if(_0x9d19f0){return _0x3a48ee[_0xa146('0x1d')](_0x206bc6);}return _0x3a48ee[_0xa146('0x1e')](_0x206bc6)[_0xa146('0x1f')]();};}function respondWithResult(_0x8a418b,_0x282b39){_0x282b39=_0x282b39||0xc8;return function(_0x2977d4){if(_0x2977d4){return _0x8a418b['status'](_0x282b39)['json'](_0x2977d4);}};}function respondWithFilteredResult(_0x1dee43,_0x12416d){return function(_0x48f24e){if(_0x48f24e){var _0x5641e5=typeof _0x12416d[_0xa146('0x20')]===_0xa146('0x21')&&typeof _0x12416d[_0xa146('0x22')]===_0xa146('0x21');var _0x5e27be=_0x48f24e[_0xa146('0x23')];var _0x2005fb=_0x5641e5?0x0:_0x12416d['offset'];var _0x5202f7=_0x5641e5?_0x48f24e[_0xa146('0x23')]:_0x12416d[_0xa146('0x20')]+_0x12416d[_0xa146('0x22')];var _0x355396;if(_0x5202f7>=_0x5e27be){_0x5202f7=_0x5e27be;_0x355396=0xc8;}else{_0x355396=0xce;}_0x1dee43[_0xa146('0x1e')](_0x355396);return _0x1dee43['set'](_0xa146('0x24'),_0x2005fb+'-'+_0x5202f7+'/'+_0x5e27be)[_0xa146('0x25')](_0x48f24e);}return null;};}function patchUpdates(_0x2c113a){return function(_0x5aa5eb){try{jsonpatch[_0xa146('0x26')](_0x5aa5eb,_0x2c113a,!![]);}catch(_0x2b3b4e){return BPromise[_0xa146('0x27')](_0x2b3b4e);}return _0x5aa5eb[_0xa146('0x28')]();};}function saveUpdates(_0x250fab,_0x1bea71){return function(_0x1f9e69){if(_0x1f9e69){return _0x1f9e69['update'](_0x250fab)['then'](function(_0xcf5d1){return _0xcf5d1;});}return null;};}function removeEntity(_0xed00cf,_0x559e00){return function(_0x2474ad){if(_0x2474ad){return _0x2474ad[_0xa146('0x29')]()[_0xa146('0x2a')](function(){_0xed00cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x368955,_0x4cd6d0){return function(_0x3f4d1a){if(!_0x3f4d1a){_0x368955[_0xa146('0x1d')](0x194);}return _0x3f4d1a;};}function handleError(_0x52fe2f,_0x90de8d){_0x90de8d=_0x90de8d||0x1f4;return function(_0x32d205){logger[_0xa146('0x2b')](_0x32d205[_0xa146('0x2c')]);if(_0x32d205['name']){delete _0x32d205[_0xa146('0x2d')];}_0x52fe2f[_0xa146('0x1e')](_0x90de8d)['send'](_0x32d205);};}exports['index']=function(_0x1ef3e5,_0x573222){var _0x3a2e5d={},_0x147b93={},_0x2f537c={'count':0x0,'rows':[]};var _0xb6f6f8=_['map'](db[_0xa146('0x2e')][_0xa146('0x2f')],function(_0x31d2aa){return{'name':_0x31d2aa[_0xa146('0x30')],'type':_0x31d2aa['type']['key']};});_0x147b93[_0xa146('0x31')]=_[_0xa146('0x32')](_0xb6f6f8,_0xa146('0x2d'));_0x147b93[_0xa146('0x33')]=_[_0xa146('0x34')](_0x1ef3e5[_0xa146('0x33')]);_0x147b93[_0xa146('0x35')]=_[_0xa146('0x36')](_0x147b93['model'],_0x147b93['query']);_0x3a2e5d[_0xa146('0x37')]=_[_0xa146('0x36')](_0x147b93[_0xa146('0x31')],qs[_0xa146('0x38')](_0x1ef3e5[_0xa146('0x33')]['fields']));_0x3a2e5d[_0xa146('0x37')]=_0x3a2e5d[_0xa146('0x37')]['length']?_0x3a2e5d[_0xa146('0x37')]:_0x147b93['model'];if(!_0x1ef3e5[_0xa146('0x33')][_0xa146('0x39')](_0xa146('0x3a'))){_0x3a2e5d[_0xa146('0x22')]=qs[_0xa146('0x22')](_0x1ef3e5[_0xa146('0x33')][_0xa146('0x22')]);_0x3a2e5d[_0xa146('0x20')]=qs[_0xa146('0x20')](_0x1ef3e5[_0xa146('0x33')][_0xa146('0x20')]);}_0x3a2e5d['order']=qs['sort'](_0x1ef3e5[_0xa146('0x33')][_0xa146('0x3b')]);_0x3a2e5d[_0xa146('0x3c')]=qs[_0xa146('0x35')](_[_0xa146('0x3d')](_0x1ef3e5[_0xa146('0x33')],_0x147b93['filters']),_0xb6f6f8);if(_0x1ef3e5['query'][_0xa146('0x3e')]){_0x3a2e5d[_0xa146('0x3c')]=_[_0xa146('0x3f')](_0x3a2e5d['where'],{'$or':_[_0xa146('0x32')](_0xb6f6f8,function(_0x15bd4c){if(_0x15bd4c[_0xa146('0x40')]!==_0xa146('0x41')){var _0x4d6937={};_0x4d6937[_0x15bd4c['name']]={'$like':'%'+_0x1ef3e5[_0xa146('0x33')][_0xa146('0x3e')]+'%'};return _0x4d6937;}})});}_0x3a2e5d=_['merge']({},_0x3a2e5d,_0x1ef3e5[_0xa146('0x42')]);var _0x41e830={'where':_0x3a2e5d[_0xa146('0x3c')]};return db[_0xa146('0x2e')]['count'](_0x41e830)[_0xa146('0x2a')](function(_0x15e85c){_0x2f537c[_0xa146('0x23')]=_0x15e85c;if(_0x1ef3e5[_0xa146('0x33')][_0xa146('0x43')]){_0x3a2e5d['include']=[{'all':!![]}];}return db[_0xa146('0x2e')][_0xa146('0x44')](_0x3a2e5d);})['then'](function(_0x57ee82){_0x2f537c['rows']=_0x57ee82;return _0x2f537c;})['then'](respondWithFilteredResult(_0x573222,_0x3a2e5d))[_0xa146('0x45')](handleError(_0x573222,null));};exports['show']=function(_0x1e9b48,_0x5a0d9c){var _0x832e0e={'raw':![],'where':{'id':_0x1e9b48['params']['id']}},_0x89b983={};_0x89b983[_0xa146('0x31')]=_[_0xa146('0x34')](db[_0xa146('0x2e')][_0xa146('0x2f')]);_0x89b983['query']=_[_0xa146('0x34')](_0x1e9b48[_0xa146('0x33')]);_0x89b983['filters']=_[_0xa146('0x36')](_0x89b983[_0xa146('0x31')],_0x89b983[_0xa146('0x33')]);_0x832e0e[_0xa146('0x37')]=_[_0xa146('0x36')](_0x89b983[_0xa146('0x31')],qs[_0xa146('0x38')](_0x1e9b48[_0xa146('0x33')][_0xa146('0x38')]));_0x832e0e[_0xa146('0x37')]=_0x832e0e[_0xa146('0x37')][_0xa146('0x46')]?_0x832e0e['attributes']:_0x89b983['model'];if(_0x1e9b48['query'][_0xa146('0x43')]){_0x832e0e[_0xa146('0x47')]=[{'all':!![]}];}_0x832e0e=_['merge']({},_0x832e0e,_0x1e9b48['options']);return db['VoiceQueueReport'][_0xa146('0x48')](_0x832e0e)[_0xa146('0x2a')](handleEntityNotFound(_0x5a0d9c,null))['then'](respondWithResult(_0x5a0d9c,null))['catch'](handleError(_0x5a0d9c,null));};exports['create']=function(_0x27efff,_0x39ec98){return db['VoiceQueueReport'][_0xa146('0x49')](_0x27efff[_0xa146('0x4a')],{})['then'](respondWithResult(_0x39ec98,0xc9))[_0xa146('0x45')](handleError(_0x39ec98,null));};exports[_0xa146('0x4b')]=function(_0x5c6ff5,_0x1a0dce){if(_0x5c6ff5[_0xa146('0x4a')]['id']){delete _0x5c6ff5[_0xa146('0x4a')]['id'];}return db['VoiceQueueReport'][_0xa146('0x48')]({'where':{'id':_0x5c6ff5[_0xa146('0x4c')]['id']}})[_0xa146('0x2a')](handleEntityNotFound(_0x1a0dce,null))[_0xa146('0x2a')](saveUpdates(_0x5c6ff5[_0xa146('0x4a')],null))[_0xa146('0x2a')](respondWithResult(_0x1a0dce,null))[_0xa146('0x45')](handleError(_0x1a0dce,null));};exports[_0xa146('0x29')]=function(_0x168e6c,_0x55b978){return db['VoiceQueueReport']['find']({'where':{'id':_0x168e6c[_0xa146('0x4c')]['id']}})[_0xa146('0x2a')](handleEntityNotFound(_0x55b978,null))[_0xa146('0x2a')](removeEntity(_0x55b978,null))[_0xa146('0x45')](handleError(_0x55b978,null));};exports[_0xa146('0x4d')]=function(_0x192d00,_0x4f5b0f){return db[_0xa146('0x2e')][_0xa146('0x4d')]()[_0xa146('0x2a')](respondWithResult(_0x4f5b0f,null))[_0xa146('0x45')](handleError(_0x4f5b0f,null));};exports['getVoiceQueuesReport']=function(_0x450877,_0x2fa030){var _0x39ce86={},_0x5a3e12={},_0x14e682={'count':0x0,'rows':[]};_0x5a3e12[_0xa146('0x31')]=_[_0xa146('0x34')](db[_0xa146('0x2e')][_0xa146('0x2f')]);_0x5a3e12[_0xa146('0x33')]=_['keys'](_0x450877[_0xa146('0x33')]);_0x5a3e12[_0xa146('0x35')]=_['intersection'](_0x5a3e12['model'],_0x5a3e12[_0xa146('0x33')]);_0x39ce86[_0xa146('0x37')]=_[_0xa146('0x36')](_0x5a3e12[_0xa146('0x31')],qs[_0xa146('0x38')](_0x450877[_0xa146('0x33')][_0xa146('0x38')]));_0x39ce86[_0xa146('0x37')]=_0x39ce86['attributes'][_0xa146('0x46')]?_0x39ce86[_0xa146('0x37')]:_0x5a3e12[_0xa146('0x31')];if(!_0x450877[_0xa146('0x33')][_0xa146('0x39')](_0xa146('0x3a'))){_0x39ce86[_0xa146('0x22')]=qs['limit'](_0x450877[_0xa146('0x33')][_0xa146('0x22')]);_0x39ce86[_0xa146('0x20')]=qs[_0xa146('0x20')](_0x450877['query']['offset']);}_0x39ce86['order']=qs[_0xa146('0x3b')](_0x450877[_0xa146('0x33')][_0xa146('0x3b')]);_0x39ce86['where']=qs[_0xa146('0x35')](_[_0xa146('0x3d')](_0x450877['query'],_0x5a3e12['filters']));if(_0x450877['query'][_0xa146('0x3e')]){_0x39ce86[_0xa146('0x3c')]=_[_0xa146('0x3f')](_0x39ce86[_0xa146('0x3c')],{'$or':_[_0xa146('0x32')](_0x39ce86[_0xa146('0x37')],function(_0xdd6180){var _0x4d52ab={};_0x4d52ab[_0xdd6180]={'$like':'%'+_0x450877[_0xa146('0x33')][_0xa146('0x3e')]+'%'};return _0x4d52ab;})});}_0x39ce86=_['merge']({},_0x39ce86,_0x450877[_0xa146('0x42')]);var _0x42f4c7={'where':_0x39ce86[_0xa146('0x3c')]};return db[_0xa146('0x2e')][_0xa146('0x23')](_0x42f4c7)[_0xa146('0x2a')](function(_0x3068d1){_0x14e682['count']=_0x3068d1;if(_0x450877[_0xa146('0x33')][_0xa146('0x43')]){_0x39ce86['include']=[{'all':!![]}];}return db[_0xa146('0x2e')][_0xa146('0x44')](_0x39ce86);})[_0xa146('0x2a')](function(_0x4b3267){_0x14e682[_0xa146('0x4e')]=_0x4b3267;return _0x14e682;})[_0xa146('0x2a')](respondWithFilteredResult(_0x2fa030,_0x39ce86,_0xa146('0x4f')))[_0xa146('0x45')](handleError(_0x2fa030,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3e9f986..f71e538 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 _0x4410=['setMaxListeners','save','remove','emit','events'];(function(_0x51cacb,_0x36de9c){var _0x370190=function(_0x519b96){while(--_0x519b96){_0x51cacb['push'](_0x51cacb['shift']());}};_0x370190(++_0x36de9c);}(_0x4410,0xa4));var _0x0441=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x4410[_0x45fc6a];return _0x14bcfd;};'use strict';var EventEmitter=require(_0x0441('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0441('0x1')](0x0);var events={'afterCreate':_0x0441('0x2'),'afterUpdate':'update','afterDestroy':_0x0441('0x3')};function emitEvent(_0x55878c){return function(_0x212c9b,_0x52a301,_0x35dc8a){VoiceQueueReportEvents[_0x0441('0x4')](_0x55878c+':'+_0x212c9b['id'],_0x212c9b);VoiceQueueReportEvents['emit'](_0x55878c,_0x212c9b);_0x35dc8a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x7b44=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x437a2e,_0x3574d7){var _0x14a6aa=function(_0x762e0d){while(--_0x762e0d){_0x437a2e['push'](_0x437a2e['shift']());}};_0x14a6aa(++_0x3574d7);}(_0x7b44,0x16e));var _0x47b4=function(_0x410e3c,_0xd39569){_0x410e3c=_0x410e3c-0x0;var _0x1da2e9=_0x7b44[_0x410e3c];return _0x1da2e9;};'use strict';var EventEmitter=require(_0x47b4('0x0'));var VoiceQueueReport=require(_0x47b4('0x1'))['db'][_0x47b4('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x47b4('0x3')](0x0);var events={'afterCreate':_0x47b4('0x4'),'afterUpdate':'update','afterDestroy':_0x47b4('0x5')};function emitEvent(_0xc7b35){return function(_0x14b18e,_0x1ff62a,_0x4ddfc4){VoiceQueueReportEvents['emit'](_0xc7b35+':'+_0x14b18e['id'],_0x14b18e);VoiceQueueReportEvents[_0x47b4('0x6')](_0xc7b35,_0x14b18e);_0x4ddfc4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x47b4('0x7')](e,emitEvent(event));}}module[_0x47b4('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 2b9dae1..72f2e57 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 _0xd2da=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util'];(function(_0x36b686,_0x3b0e82){var _0x4d1a91=function(_0x5c0020){while(--_0x5c0020){_0x36b686['push'](_0x36b686['shift']());}};_0x4d1a91(++_0x3b0e82);}(_0xd2da,0x73));var _0xad2d=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0xd2da[_0x44e00a];return _0x2bdfba;};'use strict';var _=require(_0xad2d('0x0'));var util=require(_0xad2d('0x1'));var logger=require(_0xad2d('0x2'))(_0xad2d('0x3'));var moment=require(_0xad2d('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2d('0x5'));var fs=require('fs');var path=require(_0xad2d('0x6'));var rimraf=require(_0xad2d('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xad2d('0x8')]=function(_0x4d2fc4,_0x3cd969){return _0x4d2fc4[_0xad2d('0x9')](_0xad2d('0xa'),attributes,{'tableName':_0xad2d('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xad2d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb995=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3e00f8,_0x3eba65){var _0x5f01fc=function(_0x5b96b8){while(--_0x5b96b8){_0x3e00f8['push'](_0x3e00f8['shift']());}};_0x5f01fc(++_0x3eba65);}(_0xb995,0x163));var _0x5b99=function(_0x1a5ae8,_0x1185f2){_0x1a5ae8=_0x1a5ae8-0x0;var _0xdcfd72=_0xb995[_0x1a5ae8];return _0xdcfd72;};'use strict';var _=require(_0x5b99('0x0'));var util=require(_0x5b99('0x1'));var logger=require(_0x5b99('0x2'))(_0x5b99('0x3'));var moment=require(_0x5b99('0x4'));var BPromise=require(_0x5b99('0x5'));var rp=require(_0x5b99('0x6'));var fs=require('fs');var path=require(_0x5b99('0x7'));var rimraf=require(_0x5b99('0x8'));var config=require(_0x5b99('0x9'));var attributes=require(_0x5b99('0xa'));module[_0x5b99('0xb')]=function(_0x3f4679,_0x232b26){return _0x3f4679[_0x5b99('0xc')](_0x5b99('0xd'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5b99('0xe')]},{'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 4a85da7..efa8c71 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 _0xdc6e=['debug','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','include','model','catch','CreateVoiceQueueReport','create','update','body','raw','UpdateVoiceQueueReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2640a2,_0xea8f21){var _0x4c2413=function(_0x4871f6){while(--_0x4871f6){_0x2640a2['push'](_0x2640a2['shift']());}};_0x4c2413(++_0xea8f21);}(_0xdc6e,0x136));var _0xedc6=function(_0x78029b,_0x19ce64){_0x78029b=_0x78029b-0x0;var _0x2c1b66=_0xdc6e[_0x78029b];return _0x2c1b66;};'use strict';var _=require(_0xedc6('0x0'));var util=require('util');var moment=require(_0xedc6('0x1'));var BPromise=require(_0xedc6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedc6('0x3'));var db=require(_0xedc6('0x4'))['db'];var utils=require(_0xedc6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xedc6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xedc6('0x7')][_0xedc6('0x8')]({'port':0x232a});config[_0xedc6('0x9')]=_['defaults'](config[_0xedc6('0x9')],{'host':_0xedc6('0xa'),'port':0x18eb});var socket=require(_0xedc6('0xb'))(new Redis(config[_0xedc6('0x9')]));require(_0xedc6('0xc'))[_0xedc6('0xd')](socket);function respondWithRpcPromise(_0x2dd71f,_0x192646,_0x26c58e){return new BPromise(function(_0x13058f,_0x42c11b){return client['request'](_0x2dd71f,_0x26c58e)[_0xedc6('0xe')](function(_0x5cb2be){logger[_0xedc6('0xf')](_0xedc6('0x10'),_0x192646,_0xedc6('0x11'));logger[_0xedc6('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x192646,_0xedc6('0x11'),JSON[_0xedc6('0x13')](_0x5cb2be));if(_0x5cb2be[_0xedc6('0x14')]){if(_0x5cb2be[_0xedc6('0x14')][_0xedc6('0x15')]===0x1f4){logger[_0xedc6('0x14')](_0xedc6('0x10'),_0x192646,_0x5cb2be[_0xedc6('0x14')][_0xedc6('0x16')]);return _0x42c11b(_0x5cb2be[_0xedc6('0x14')][_0xedc6('0x16')]);}logger['error'](_0xedc6('0x10'),_0x192646,_0x5cb2be[_0xedc6('0x14')]['message']);return _0x13058f(_0x5cb2be[_0xedc6('0x14')]['message']);}else{logger['info'](_0xedc6('0x10'),_0x192646,_0xedc6('0x11'));_0x13058f(_0x5cb2be[_0xedc6('0x17')][_0xedc6('0x16')]);}})['catch'](function(_0x404b50){logger['error'](_0xedc6('0x10'),_0x192646,_0x404b50);_0x42c11b(_0x404b50);});});}exports[_0xedc6('0x18')]=function(_0x31f1c8){var _0x305eaa=this;return new Promise(function(_0x50cf0b,_0x45a9db){return db[_0xedc6('0x19')][_0xedc6('0x1a')]({'raw':_0x31f1c8[_0xedc6('0x1b')]?_0x31f1c8[_0xedc6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x31f1c8[_0xedc6('0x1b')]?_0x31f1c8['options'][_0xedc6('0x1c')]||null:null,'attributes':_0x31f1c8[_0xedc6('0x1b')]?_0x31f1c8[_0xedc6('0x1b')][_0xedc6('0x1d')]||null:null,'limit':_0x31f1c8[_0xedc6('0x1b')]?_0x31f1c8[_0xedc6('0x1b')][_0xedc6('0x1e')]||null:null,'include':_0x31f1c8[_0xedc6('0x1b')]?_0x31f1c8['options']['include']?_[_0xedc6('0x1f')](_0x31f1c8[_0xedc6('0x1b')][_0xedc6('0x20')],function(_0x52ebe3){return{'model':db[_0x52ebe3['model']],'as':_0x52ebe3['as'],'attributes':_0x52ebe3[_0xedc6('0x1d')],'include':_0x52ebe3[_0xedc6('0x20')]?_[_0xedc6('0x1f')](_0x52ebe3[_0xedc6('0x20')],function(_0x163b5d){return{'model':db[_0x163b5d[_0xedc6('0x21')]],'as':_0x163b5d['as'],'attributes':_0x163b5d['attributes'],'include':_0x163b5d[_0xedc6('0x20')]?_[_0xedc6('0x1f')](_0x163b5d[_0xedc6('0x20')],function(_0x444388){return{'model':db[_0x444388[_0xedc6('0x21')]],'as':_0x444388['as'],'attributes':_0x444388[_0xedc6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xedc6('0xe')](function(_0x3ff7dc){logger[_0xedc6('0xf')](_0xedc6('0x18'),_0x31f1c8);logger['debug']('GetVoiceQueueReport',_0x31f1c8,JSON[_0xedc6('0x13')](_0x3ff7dc));_0x50cf0b(_0x3ff7dc);})[_0xedc6('0x22')](function(_0x4be74f){logger[_0xedc6('0x14')]('GetVoiceQueueReport',_0x4be74f['message'],_0x31f1c8);_0x45a9db(_0x305eaa[_0xedc6('0x14')](0x1f4,_0x4be74f[_0xedc6('0x16')]));});});};exports[_0xedc6('0x23')]=function(_0x5c3cc8){var _0x535794=this;return new Promise(function(_0x11701b,_0x306c4f){return db[_0xedc6('0x19')][_0xedc6('0x24')](_0x5c3cc8['body'],{'raw':_0x5c3cc8[_0xedc6('0x1b')]?_0x5c3cc8['options']['raw']===undefined?!![]:![]:!![]})[_0xedc6('0xe')](function(_0x3c1be7){logger[_0xedc6('0xf')]('CreateVoiceQueueReport',_0x5c3cc8);logger[_0xedc6('0x12')]('CreateVoiceQueueReport',_0x5c3cc8,JSON['stringify'](_0x3c1be7));_0x11701b(_0x3c1be7);})[_0xedc6('0x22')](function(_0x5459eb){logger[_0xedc6('0x14')](_0xedc6('0x23'),_0x5459eb[_0xedc6('0x16')],_0x5c3cc8);_0x306c4f(_0x535794[_0xedc6('0x14')](0x1f4,_0x5459eb[_0xedc6('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x98dba5){var _0x174258=this;return new Promise(function(_0x46948b,_0x31a230){return db['VoiceQueueReport'][_0xedc6('0x25')](_0x98dba5[_0xedc6('0x26')],{'raw':_0x98dba5[_0xedc6('0x1b')]?_0x98dba5['options'][_0xedc6('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x98dba5[_0xedc6('0x1b')]?_0x98dba5[_0xedc6('0x1b')]['where']||null:null,'attributes':_0x98dba5[_0xedc6('0x1b')]?_0x98dba5[_0xedc6('0x1b')][_0xedc6('0x1d')]||null:null,'limit':_0x98dba5['options']?_0x98dba5['options'][_0xedc6('0x1e')]||null:null})[_0xedc6('0xe')](function(_0x1878be){logger[_0xedc6('0xf')](_0xedc6('0x28'),_0x98dba5);logger[_0xedc6('0x12')]('UpdateVoiceQueueReport',_0x98dba5,JSON['stringify'](_0x1878be));_0x46948b(_0x1878be);})[_0xedc6('0x22')](function(_0x3f61c7){logger[_0xedc6('0x14')]('UpdateVoiceQueueReport',_0x3f61c7[_0xedc6('0x16')],_0x98dba5);_0x31a230(_0x174258['error'](0x1f4,_0x3f61c7[_0xedc6('0x16')]));});});}; \ No newline at end of file +var _0x8f28=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','model','map','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2f9625,_0x4efdd8){var _0x56e181=function(_0x1e2151){while(--_0x1e2151){_0x2f9625['push'](_0x2f9625['shift']());}};_0x56e181(++_0x4efdd8);}(_0x8f28,0x167));var _0x88f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x88f2('0x0'));var util=require(_0x88f2('0x1'));var moment=require(_0x88f2('0x2'));var BPromise=require(_0x88f2('0x3'));var rs=require(_0x88f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88f2('0x5'))['db'];var utils=require(_0x88f2('0x6'));var logger=require('../../config/logger')(_0x88f2('0x7'));var config=require('../../config/environment');var jayson=require(_0x88f2('0x8'));var client=jayson[_0x88f2('0x9')][_0x88f2('0xa')]({'port':0x232a});config['redis']=_[_0x88f2('0xb')](config[_0x88f2('0xc')],{'host':_0x88f2('0xd'),'port':0x18eb});var socket=require(_0x88f2('0xe'))(new Redis(config[_0x88f2('0xc')]));require('./voiceQueueReport.socket')[_0x88f2('0xf')](socket);function respondWithRpcPromise(_0x40522d,_0x35c50b,_0x314014){return new BPromise(function(_0x1b0e08,_0x528a64){return client[_0x88f2('0x10')](_0x40522d,_0x314014)[_0x88f2('0x11')](function(_0xe9ba58){logger[_0x88f2('0x12')](_0x88f2('0x13'),_0x35c50b,'request\x20sent');logger[_0x88f2('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x35c50b,_0x88f2('0x15'),JSON[_0x88f2('0x16')](_0xe9ba58));if(_0xe9ba58[_0x88f2('0x17')]){if(_0xe9ba58['error'][_0x88f2('0x18')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x35c50b,_0xe9ba58['error'][_0x88f2('0x19')]);return _0x528a64(_0xe9ba58[_0x88f2('0x17')]['message']);}logger[_0x88f2('0x17')](_0x88f2('0x13'),_0x35c50b,_0xe9ba58[_0x88f2('0x17')][_0x88f2('0x19')]);return _0x1b0e08(_0xe9ba58[_0x88f2('0x17')]['message']);}else{logger[_0x88f2('0x12')](_0x88f2('0x13'),_0x35c50b,'request\x20sent');_0x1b0e08(_0xe9ba58[_0x88f2('0x1a')]['message']);}})[_0x88f2('0x1b')](function(_0x40a75b){logger[_0x88f2('0x17')](_0x88f2('0x13'),_0x35c50b,_0x40a75b);_0x528a64(_0x40a75b);});});}exports[_0x88f2('0x1c')]=function(_0x22c7f8){var _0x5b2610=this;return new Promise(function(_0x608551,_0x3c99bd){return db[_0x88f2('0x1d')][_0x88f2('0x1e')]({'raw':_0x22c7f8['options']?_0x22c7f8[_0x88f2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x22c7f8[_0x88f2('0x1f')]?_0x22c7f8[_0x88f2('0x1f')][_0x88f2('0x20')]||null:null,'attributes':_0x22c7f8[_0x88f2('0x1f')]?_0x22c7f8[_0x88f2('0x1f')][_0x88f2('0x21')]||null:null,'limit':_0x22c7f8[_0x88f2('0x1f')]?_0x22c7f8[_0x88f2('0x1f')]['limit']||null:null,'include':_0x22c7f8['options']?_0x22c7f8[_0x88f2('0x1f')][_0x88f2('0x22')]?_['map'](_0x22c7f8[_0x88f2('0x1f')][_0x88f2('0x22')],function(_0x31c296){return{'model':db[_0x31c296[_0x88f2('0x23')]],'as':_0x31c296['as'],'attributes':_0x31c296['attributes'],'include':_0x31c296[_0x88f2('0x22')]?_['map'](_0x31c296[_0x88f2('0x22')],function(_0x254646){return{'model':db[_0x254646['model']],'as':_0x254646['as'],'attributes':_0x254646['attributes'],'include':_0x254646[_0x88f2('0x22')]?_[_0x88f2('0x24')](_0x254646[_0x88f2('0x22')],function(_0x32ec65){return{'model':db[_0x32ec65[_0x88f2('0x23')]],'as':_0x32ec65['as'],'attributes':_0x32ec65[_0x88f2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x88f2('0x11')](function(_0x1c6fda){logger[_0x88f2('0x12')]('GetVoiceQueueReport',_0x22c7f8);logger[_0x88f2('0x14')](_0x88f2('0x1c'),_0x22c7f8,JSON[_0x88f2('0x16')](_0x1c6fda));_0x608551(_0x1c6fda);})['catch'](function(_0x494dbb){logger[_0x88f2('0x17')](_0x88f2('0x1c'),_0x494dbb[_0x88f2('0x19')],_0x22c7f8);_0x3c99bd(_0x5b2610['error'](0x1f4,_0x494dbb['message']));});});};exports[_0x88f2('0x25')]=function(_0x591707){var _0x2b1750=this;return new Promise(function(_0x15ba12,_0x53d73b){return db['VoiceQueueReport'][_0x88f2('0x26')](_0x591707[_0x88f2('0x27')],{'raw':_0x591707[_0x88f2('0x1f')]?_0x591707['options']['raw']===undefined?!![]:![]:!![]})[_0x88f2('0x11')](function(_0x245545){logger['info'](_0x88f2('0x25'),_0x591707);logger[_0x88f2('0x14')]('CreateVoiceQueueReport',_0x591707,JSON[_0x88f2('0x16')](_0x245545));_0x15ba12(_0x245545);})[_0x88f2('0x1b')](function(_0x560ef1){logger['error'](_0x88f2('0x25'),_0x560ef1[_0x88f2('0x19')],_0x591707);_0x53d73b(_0x2b1750[_0x88f2('0x17')](0x1f4,_0x560ef1[_0x88f2('0x19')]));});});};exports[_0x88f2('0x28')]=function(_0x3f2826){var _0xda7953=this;return new Promise(function(_0x2aa050,_0xeec907){return db[_0x88f2('0x1d')][_0x88f2('0x29')](_0x3f2826[_0x88f2('0x27')],{'raw':_0x3f2826[_0x88f2('0x1f')]?_0x3f2826[_0x88f2('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f2826[_0x88f2('0x1f')]?_0x3f2826[_0x88f2('0x1f')][_0x88f2('0x20')]||null:null,'attributes':_0x3f2826[_0x88f2('0x1f')]?_0x3f2826[_0x88f2('0x1f')][_0x88f2('0x21')]||null:null,'limit':_0x3f2826[_0x88f2('0x1f')]?_0x3f2826['options'][_0x88f2('0x2a')]||null:null})[_0x88f2('0x11')](function(_0x492b1b){logger['info'](_0x88f2('0x28'),_0x3f2826);logger[_0x88f2('0x14')](_0x88f2('0x28'),_0x3f2826,JSON[_0x88f2('0x16')](_0x492b1b));_0x2aa050(_0x492b1b);})[_0x88f2('0x1b')](function(_0x89d768){logger['error'](_0x88f2('0x28'),_0x89d768['message'],_0x3f2826);_0xeec907(_0xda7953[_0x88f2('0x17')](0x1f4,_0x89d768['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4d62308..1f723ad 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 _0x4abf=['emit','register','./voiceQueueReport.events','save','update'];(function(_0x573b76,_0x3fcca8){var _0x22e32c=function(_0xb4aa75){while(--_0xb4aa75){_0x573b76['push'](_0x573b76['shift']());}};_0x22e32c(++_0x3fcca8);}(_0x4abf,0xac));var _0xf4ab=function(_0x15e634,_0x28558e){_0x15e634=_0x15e634-0x0;var _0x4d5d95=_0x4abf[_0x15e634];return _0x4d5d95;};'use strict';var VoiceQueueReportEvents=require(_0xf4ab('0x0'));var events=[_0xf4ab('0x1'),'remove',_0xf4ab('0x2')];function createListener(_0x4f05e6,_0x486ba3){return function(_0x505988){_0x486ba3[_0xf4ab('0x3')](_0x4f05e6,_0x505988);};}function removeListener(_0x4599f6,_0x592623){return function(){VoiceQueueReportEvents['removeListener'](_0x4599f6,_0x592623);};}exports[_0xf4ab('0x4')]=function(_0x4160fb){for(var _0x2e6efe=0x0,_0x1d60fc=events['length'];_0x2e6efe<_0x1d60fc;_0x2e6efe++){var _0x230259=events[_0x2e6efe];var _0x3c7b8b=createListener('voiceQueueReport:'+_0x230259,_0x4160fb);VoiceQueueReportEvents['on'](_0x230259,_0x3c7b8b);}}; \ No newline at end of file +var _0xe9b9=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','register'];(function(_0x574bdd,_0x534f26){var _0x49d66b=function(_0x539ab0){while(--_0x539ab0){_0x574bdd['push'](_0x574bdd['shift']());}};_0x49d66b(++_0x534f26);}(_0xe9b9,0xd4));var _0x9e9b=function(_0x38e5f0,_0x4fedd8){_0x38e5f0=_0x38e5f0-0x0;var _0x5b08dc=_0xe9b9[_0x38e5f0];return _0x5b08dc;};'use strict';var VoiceQueueReportEvents=require(_0x9e9b('0x0'));var events=[_0x9e9b('0x1'),_0x9e9b('0x2'),_0x9e9b('0x3')];function createListener(_0x61a09a,_0xac5ef4){return function(_0x1893ce){_0xac5ef4['emit'](_0x61a09a,_0x1893ce);};}function removeListener(_0x3e77d3,_0x51da8b){return function(){VoiceQueueReportEvents['removeListener'](_0x3e77d3,_0x51da8b);};}exports[_0x9e9b('0x4')]=function(_0x35e077){for(var _0x49ac7c=0x0,_0x579948=events[_0x9e9b('0x5')];_0x49ac7c<_0x579948;_0x49ac7c++){var _0x4c2ba0=events[_0x49ac7c];var _0x3cc200=createListener(_0x9e9b('0x6')+_0x4c2ba0,_0x35e077);VoiceQueueReportEvents['on'](_0x4c2ba0,_0x3cc200);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0800966..fb8e4e5 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 _0x99fc=['put','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x5b1abd,_0x78921c){var _0x37a584=function(_0xbfbcbf){while(--_0xbfbcbf){_0x5b1abd['push'](_0x5b1abd['shift']());}};_0x37a584(++_0x78921c);}(_0x99fc,0x153));var _0xc99f=function(_0x5baa95,_0x20d4b1){_0x5baa95=_0x5baa95-0x0;var _0xc631d4=_0x99fc[_0x5baa95];return _0xc631d4;};'use strict';var multer=require(_0xc99f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc99f('0x1'));var express=require(_0xc99f('0x2'));var router=express[_0xc99f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc99f('0x4'));var config=require(_0xc99f('0x5'));var controller=require(_0xc99f('0x6'));router[_0xc99f('0x7')]('/',auth[_0xc99f('0x8')](),controller['index']);router[_0xc99f('0x7')](_0xc99f('0x9'),auth[_0xc99f('0x8')](),controller[_0xc99f('0xa')]);router[_0xc99f('0xb')]('/',auth['isAuthenticated'](),controller[_0xc99f('0xc')]);router[_0xc99f('0xd')](_0xc99f('0x9'),auth[_0xc99f('0x8')](),controller['update']);router['delete'](_0xc99f('0x9'),auth[_0xc99f('0x8')](),controller[_0xc99f('0xe')]);module[_0xc99f('0xf')]=router; \ No newline at end of file +var _0x3c85=['fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3cb48c,_0x387979){var _0x4e3c33=function(_0x43929a){while(--_0x43929a){_0x3cb48c['push'](_0x3cb48c['shift']());}};_0x4e3c33(++_0x387979);}(_0x3c85,0x113));var _0x53c8=function(_0x152504,_0x29303d){_0x152504=_0x152504-0x0;var _0x29f728=_0x3c85[_0x152504];return _0x29f728;};'use strict';var multer=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var path=require(_0x53c8('0x2'));var timeout=require(_0x53c8('0x3'));var express=require(_0x53c8('0x4'));var router=express['Router']();var fs_extra=require(_0x53c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x53c8('0x6'));var config=require(_0x53c8('0x7'));var controller=require(_0x53c8('0x8'));router[_0x53c8('0x9')]('/',auth[_0x53c8('0xa')](),controller['index']);router[_0x53c8('0x9')]('/:id',auth[_0x53c8('0xa')](),controller[_0x53c8('0xb')]);router[_0x53c8('0xc')]('/',auth[_0x53c8('0xa')](),controller[_0x53c8('0xd')]);router[_0x53c8('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x53c8('0xf')]);router[_0x53c8('0x10')](_0x53c8('0x11'),auth[_0x53c8('0xa')](),controller[_0x53c8('0x12')]);module[_0x53c8('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 eb550f9..f04ffb7 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 _0xf980=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0xf980,0xc3));var _0x0f98=function(_0x23fd09,_0x51c74c){_0x23fd09=_0x23fd09-0x0;var _0x5d8176=_0xf980[_0x23fd09];return _0x5d8176;};'use strict';var Sequelize=require(_0x0f98('0x0'));var moment=require(_0x0f98('0x1'));module[_0x0f98('0x2')]={'time':{'type':Sequelize[_0x0f98('0x3')]},'callid':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0f98('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0f98('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x0f98('0x5'))}}; \ No newline at end of file +var _0x6c99=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x2472a6,_0x5f2d82){var _0x5c04b9=function(_0x184f77){while(--_0x184f77){_0x2472a6['push'](_0x2472a6['shift']());}};_0x5c04b9(++_0x5f2d82);}(_0x6c99,0x9b));var _0x96c9=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x6c99[_0x1e4150];return _0x1ce3ee;};'use strict';var Sequelize=require(_0x96c9('0x0'));var moment=require('moment');module[_0x96c9('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x96c9('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x96c9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x96c9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x96c9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x96c9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x96c9('0x3')],'allowNull':![],'defaultValue':moment()[_0x96c9('0x4')](_0x96c9('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 039b5f0..f7e9d9c 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 _0x4188=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VoiceQueuesLog','includeAll','findAll','catch','params','include','find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis'];(function(_0x19deb4,_0x1b177f){var _0x2c22ab=function(_0x1871e9){while(--_0x1871e9){_0x19deb4['push'](_0x19deb4['shift']());}};_0x2c22ab(++_0x1b177f);}(_0x4188,0x19a));var _0x8418=function(_0x3476b1,_0x1df004){_0x3476b1=_0x3476b1-0x0;var _0x5e7568=_0x4188[_0x3476b1];return _0x5e7568;};'use strict';var emlformat=require(_0x8418('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8418('0x1'));var jsonpatch=require(_0x8418('0x2'));var rp=require(_0x8418('0x3'));var moment=require(_0x8418('0x4'));var BPromise=require(_0x8418('0x5'));var Mustache=require(_0x8418('0x6'));var util=require('util');var path=require(_0x8418('0x7'));var sox=require(_0x8418('0x8'));var csv=require(_0x8418('0x9'));var ejs=require(_0x8418('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8418('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8418('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8418('0xd'));var Papa=require(_0x8418('0xe'));var Redis=require(_0x8418('0xf'));var authService=require(_0x8418('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8418('0x11'));var hardwareService=require(_0x8418('0x12'));var logger=require(_0x8418('0x13'))('api');var utils=require(_0x8418('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8418('0x15'));var db=require(_0x8418('0x16'))['db'];function respondWithStatusCode(_0x53f1f6,_0x40789b){_0x40789b=_0x40789b||0xcc;return function(_0x4636d2){if(_0x4636d2){return _0x53f1f6[_0x8418('0x17')](_0x40789b);}return _0x53f1f6[_0x8418('0x18')](_0x40789b)[_0x8418('0x19')]();};}function respondWithResult(_0x3bd2e1,_0x12b03c){_0x12b03c=_0x12b03c||0xc8;return function(_0xcb6925){if(_0xcb6925){return _0x3bd2e1[_0x8418('0x18')](_0x12b03c)[_0x8418('0x1a')](_0xcb6925);}};}function respondWithFilteredResult(_0x1bfc9d,_0x3f3a1c){return function(_0x3e93c0){if(_0x3e93c0){var _0x4bd593=typeof _0x3f3a1c[_0x8418('0x1b')]===_0x8418('0x1c')&&typeof _0x3f3a1c[_0x8418('0x1d')]===_0x8418('0x1c');var _0x5f2eaf=_0x3e93c0['count'];var _0x3b4172=_0x4bd593?0x0:_0x3f3a1c['offset'];var _0x53e436=_0x4bd593?_0x3e93c0[_0x8418('0x1e')]:_0x3f3a1c['offset']+_0x3f3a1c[_0x8418('0x1d')];var _0x2c517c;if(_0x53e436>=_0x5f2eaf){_0x53e436=_0x5f2eaf;_0x2c517c=0xc8;}else{_0x2c517c=0xce;}_0x1bfc9d[_0x8418('0x18')](_0x2c517c);return _0x1bfc9d[_0x8418('0x1f')]('Content-Range',_0x3b4172+'-'+_0x53e436+'/'+_0x5f2eaf)[_0x8418('0x1a')](_0x3e93c0);}return null;};}function patchUpdates(_0x579ae9){return function(_0x3d3f67){try{jsonpatch[_0x8418('0x20')](_0x3d3f67,_0x579ae9,!![]);}catch(_0x3155bd){return BPromise[_0x8418('0x21')](_0x3155bd);}return _0x3d3f67[_0x8418('0x22')]();};}function saveUpdates(_0x2447b5,_0x59dfab){return function(_0x17b4c7){if(_0x17b4c7){return _0x17b4c7['update'](_0x2447b5)['then'](function(_0x5bd716){return _0x5bd716;});}return null;};}function removeEntity(_0xf8b5bc,_0x49e6bb){return function(_0x449bde){if(_0x449bde){return _0x449bde[_0x8418('0x23')]()[_0x8418('0x24')](function(){_0xf8b5bc['status'](0xcc)[_0x8418('0x19')]();});}};}function handleEntityNotFound(_0x5b917a,_0x1de88a){return function(_0x22a509){if(!_0x22a509){_0x5b917a['sendStatus'](0x194);}return _0x22a509;};}function handleError(_0x7ec5b8,_0x11d649){_0x11d649=_0x11d649||0x1f4;return function(_0x5a33ca){logger[_0x8418('0x25')](_0x5a33ca[_0x8418('0x26')]);if(_0x5a33ca[_0x8418('0x27')]){delete _0x5a33ca['name'];}_0x7ec5b8[_0x8418('0x18')](_0x11d649)[_0x8418('0x28')](_0x5a33ca);};}exports[_0x8418('0x29')]=function(_0x2768b9,_0x5e8a1a){var _0x55b31c={},_0x55948a={},_0x126355={'count':0x0,'rows':[]};var _0x60705e=_[_0x8418('0x2a')](db['VoiceQueuesLog']['rawAttributes'],function(_0x5cafea){return{'name':_0x5cafea[_0x8418('0x2b')],'type':_0x5cafea[_0x8418('0x2c')][_0x8418('0x2d')]};});_0x55948a[_0x8418('0x2e')]=_[_0x8418('0x2a')](_0x60705e,_0x8418('0x27'));_0x55948a['query']=_[_0x8418('0x2f')](_0x2768b9[_0x8418('0x30')]);_0x55948a[_0x8418('0x31')]=_['intersection'](_0x55948a[_0x8418('0x2e')],_0x55948a[_0x8418('0x30')]);_0x55b31c[_0x8418('0x32')]=_[_0x8418('0x33')](_0x55948a[_0x8418('0x2e')],qs[_0x8418('0x34')](_0x2768b9['query'][_0x8418('0x34')]));_0x55b31c[_0x8418('0x32')]=_0x55b31c['attributes'][_0x8418('0x35')]?_0x55b31c[_0x8418('0x32')]:_0x55948a[_0x8418('0x2e')];if(!_0x2768b9['query'][_0x8418('0x36')](_0x8418('0x37'))){_0x55b31c[_0x8418('0x1d')]=qs['limit'](_0x2768b9['query']['limit']);_0x55b31c['offset']=qs['offset'](_0x2768b9[_0x8418('0x30')][_0x8418('0x1b')]);}_0x55b31c[_0x8418('0x38')]=qs['sort'](_0x2768b9['query']['sort']);_0x55b31c[_0x8418('0x39')]=qs['filters'](_[_0x8418('0x3a')](_0x2768b9['query'],_0x55948a[_0x8418('0x31')]),_0x60705e);if(_0x2768b9[_0x8418('0x30')][_0x8418('0x3b')]){_0x55b31c[_0x8418('0x39')]=_[_0x8418('0x3c')](_0x55b31c[_0x8418('0x39')],{'$or':_['map'](_0x60705e,function(_0x51d6c5){if(_0x51d6c5[_0x8418('0x2c')]!=='VIRTUAL'){var _0x2650dc={};_0x2650dc[_0x51d6c5[_0x8418('0x27')]]={'$like':'%'+_0x2768b9[_0x8418('0x30')][_0x8418('0x3b')]+'%'};return _0x2650dc;}})});}_0x55b31c=_[_0x8418('0x3c')]({},_0x55b31c,_0x2768b9['options']);var _0x2fa00f={'where':_0x55b31c[_0x8418('0x39')]};return db[_0x8418('0x3d')][_0x8418('0x1e')](_0x2fa00f)[_0x8418('0x24')](function(_0x239809){_0x126355[_0x8418('0x1e')]=_0x239809;if(_0x2768b9[_0x8418('0x30')][_0x8418('0x3e')]){_0x55b31c['include']=[{'all':!![]}];}return db[_0x8418('0x3d')][_0x8418('0x3f')](_0x55b31c);})[_0x8418('0x24')](function(_0x2bdd41){_0x126355['rows']=_0x2bdd41;return _0x126355;})[_0x8418('0x24')](respondWithFilteredResult(_0x5e8a1a,_0x55b31c))[_0x8418('0x40')](handleError(_0x5e8a1a,null));};exports['show']=function(_0x36f5a2,_0x42f355){var _0x3253e3={'raw':!![],'where':{'id':_0x36f5a2[_0x8418('0x41')]['id']}},_0x298ef5={};_0x298ef5[_0x8418('0x2e')]=_[_0x8418('0x2f')](db[_0x8418('0x3d')]['rawAttributes']);_0x298ef5[_0x8418('0x30')]=_[_0x8418('0x2f')](_0x36f5a2[_0x8418('0x30')]);_0x298ef5[_0x8418('0x31')]=_['intersection'](_0x298ef5[_0x8418('0x2e')],_0x298ef5[_0x8418('0x30')]);_0x3253e3[_0x8418('0x32')]=_[_0x8418('0x33')](_0x298ef5[_0x8418('0x2e')],qs['fields'](_0x36f5a2[_0x8418('0x30')]['fields']));_0x3253e3[_0x8418('0x32')]=_0x3253e3[_0x8418('0x32')]['length']?_0x3253e3[_0x8418('0x32')]:_0x298ef5[_0x8418('0x2e')];if(_0x36f5a2[_0x8418('0x30')][_0x8418('0x3e')]){_0x3253e3[_0x8418('0x42')]=[{'all':!![]}];}_0x3253e3=_[_0x8418('0x3c')]({},_0x3253e3,_0x36f5a2['options']);return db[_0x8418('0x3d')][_0x8418('0x43')](_0x3253e3)[_0x8418('0x24')](handleEntityNotFound(_0x42f355,null))[_0x8418('0x24')](respondWithResult(_0x42f355,null))[_0x8418('0x40')](handleError(_0x42f355,null));};exports[_0x8418('0x44')]=function(_0x187b21,_0x2dafe6){return db[_0x8418('0x3d')][_0x8418('0x44')](_0x187b21['body'],{})[_0x8418('0x24')](respondWithResult(_0x2dafe6,0xc9))[_0x8418('0x40')](handleError(_0x2dafe6,null));};exports[_0x8418('0x45')]=function(_0x41a7c1,_0x1eaf83){if(_0x41a7c1['body']['id']){delete _0x41a7c1[_0x8418('0x46')]['id'];}return db[_0x8418('0x3d')]['find']({'where':{'id':_0x41a7c1[_0x8418('0x41')]['id']}})[_0x8418('0x24')](handleEntityNotFound(_0x1eaf83,null))[_0x8418('0x24')](saveUpdates(_0x41a7c1[_0x8418('0x46')],null))[_0x8418('0x24')](respondWithResult(_0x1eaf83,null))[_0x8418('0x40')](handleError(_0x1eaf83,null));};exports['destroy']=function(_0xbfc0f9,_0x563362){return db['VoiceQueuesLog'][_0x8418('0x43')]({'where':{'id':_0xbfc0f9[_0x8418('0x41')]['id']}})[_0x8418('0x24')](handleEntityNotFound(_0x563362,null))[_0x8418('0x24')](removeEntity(_0x563362,null))[_0x8418('0x40')](handleError(_0x563362,null));}; \ No newline at end of file +var _0x3a29=['update','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x3a29,0x1e9));var _0x93a2=function(_0x4694a0,_0x35b97f){_0x4694a0=_0x4694a0-0x0;var _0x38a2dc=_0x3a29[_0x4694a0];return _0x38a2dc;};'use strict';var emlformat=require(_0x93a2('0x0'));var rimraf=require(_0x93a2('0x1'));var zipdir=require(_0x93a2('0x2'));var jsonpatch=require(_0x93a2('0x3'));var rp=require(_0x93a2('0x4'));var moment=require(_0x93a2('0x5'));var BPromise=require(_0x93a2('0x6'));var Mustache=require(_0x93a2('0x7'));var util=require(_0x93a2('0x8'));var path=require('path');var sox=require(_0x93a2('0x9'));var csv=require(_0x93a2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93a2('0xb'));var squel=require('squel');var crypto=require(_0x93a2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x93a2('0xd'));var toCsv=require(_0x93a2('0xa'));var querystring=require('querystring');var Papa=require(_0x93a2('0xe'));var Redis=require('ioredis');var authService=require(_0x93a2('0xf'));var qs=require(_0x93a2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93a2('0x11'));var logger=require(_0x93a2('0x12'))(_0x93a2('0x13'));var utils=require(_0x93a2('0x14'));var config=require(_0x93a2('0x15'));var licenseUtil=require(_0x93a2('0x16'));var db=require(_0x93a2('0x17'))['db'];function respondWithStatusCode(_0xa2be2f,_0x584d18){_0x584d18=_0x584d18||0xcc;return function(_0x208286){if(_0x208286){return _0xa2be2f[_0x93a2('0x18')](_0x584d18);}return _0xa2be2f[_0x93a2('0x19')](_0x584d18)[_0x93a2('0x1a')]();};}function respondWithResult(_0x32a011,_0x29b899){_0x29b899=_0x29b899||0xc8;return function(_0x7f5789){if(_0x7f5789){return _0x32a011[_0x93a2('0x19')](_0x29b899)[_0x93a2('0x1b')](_0x7f5789);}};}function respondWithFilteredResult(_0x3944bc,_0x501c73){return function(_0x5ea0ab){if(_0x5ea0ab){var _0x5e2581=typeof _0x501c73[_0x93a2('0x1c')]===_0x93a2('0x1d')&&typeof _0x501c73[_0x93a2('0x1e')]===_0x93a2('0x1d');var _0x5208ee=_0x5ea0ab[_0x93a2('0x1f')];var _0x23bdec=_0x5e2581?0x0:_0x501c73[_0x93a2('0x1c')];var _0x2e5641=_0x5e2581?_0x5ea0ab[_0x93a2('0x1f')]:_0x501c73[_0x93a2('0x1c')]+_0x501c73[_0x93a2('0x1e')];var _0x3cc2cd;if(_0x2e5641>=_0x5208ee){_0x2e5641=_0x5208ee;_0x3cc2cd=0xc8;}else{_0x3cc2cd=0xce;}_0x3944bc['status'](_0x3cc2cd);return _0x3944bc[_0x93a2('0x20')]('Content-Range',_0x23bdec+'-'+_0x2e5641+'/'+_0x5208ee)['json'](_0x5ea0ab);}return null;};}function patchUpdates(_0x51dd03){return function(_0x2dd1c5){try{jsonpatch[_0x93a2('0x21')](_0x2dd1c5,_0x51dd03,!![]);}catch(_0x22e60d){return BPromise[_0x93a2('0x22')](_0x22e60d);}return _0x2dd1c5[_0x93a2('0x23')]();};}function saveUpdates(_0x5dea75,_0xded916){return function(_0x47c727){if(_0x47c727){return _0x47c727[_0x93a2('0x24')](_0x5dea75)[_0x93a2('0x25')](function(_0x243e98){return _0x243e98;});}return null;};}function removeEntity(_0xc100f,_0xd311ad){return function(_0x1e2ae0){if(_0x1e2ae0){return _0x1e2ae0['destroy']()[_0x93a2('0x25')](function(){_0xc100f['status'](0xcc)[_0x93a2('0x1a')]();});}};}function handleEntityNotFound(_0x4682e3,_0x19eaaf){return function(_0x116146){if(!_0x116146){_0x4682e3['sendStatus'](0x194);}return _0x116146;};}function handleError(_0x500352,_0x3748f9){_0x3748f9=_0x3748f9||0x1f4;return function(_0x453e86){logger[_0x93a2('0x26')](_0x453e86[_0x93a2('0x27')]);if(_0x453e86[_0x93a2('0x28')]){delete _0x453e86[_0x93a2('0x28')];}_0x500352[_0x93a2('0x19')](_0x3748f9)[_0x93a2('0x29')](_0x453e86);};}exports[_0x93a2('0x2a')]=function(_0x3a71c0,_0x470f52){var _0x1643be={},_0xb4fd8b={},_0x4ecd5f={'count':0x0,'rows':[]};var _0x5223b8=_['map'](db[_0x93a2('0x2b')][_0x93a2('0x2c')],function(_0x55ff52){return{'name':_0x55ff52[_0x93a2('0x2d')],'type':_0x55ff52[_0x93a2('0x2e')]['key']};});_0xb4fd8b[_0x93a2('0x2f')]=_[_0x93a2('0x30')](_0x5223b8,_0x93a2('0x28'));_0xb4fd8b[_0x93a2('0x31')]=_[_0x93a2('0x32')](_0x3a71c0[_0x93a2('0x31')]);_0xb4fd8b['filters']=_[_0x93a2('0x33')](_0xb4fd8b['model'],_0xb4fd8b[_0x93a2('0x31')]);_0x1643be['attributes']=_[_0x93a2('0x33')](_0xb4fd8b[_0x93a2('0x2f')],qs[_0x93a2('0x34')](_0x3a71c0[_0x93a2('0x31')][_0x93a2('0x34')]));_0x1643be[_0x93a2('0x35')]=_0x1643be[_0x93a2('0x35')][_0x93a2('0x36')]?_0x1643be[_0x93a2('0x35')]:_0xb4fd8b[_0x93a2('0x2f')];if(!_0x3a71c0[_0x93a2('0x31')][_0x93a2('0x37')]('nolimit')){_0x1643be[_0x93a2('0x1e')]=qs[_0x93a2('0x1e')](_0x3a71c0['query'][_0x93a2('0x1e')]);_0x1643be[_0x93a2('0x1c')]=qs['offset'](_0x3a71c0[_0x93a2('0x31')][_0x93a2('0x1c')]);}_0x1643be[_0x93a2('0x38')]=qs[_0x93a2('0x39')](_0x3a71c0[_0x93a2('0x31')][_0x93a2('0x39')]);_0x1643be[_0x93a2('0x3a')]=qs['filters'](_[_0x93a2('0x3b')](_0x3a71c0[_0x93a2('0x31')],_0xb4fd8b[_0x93a2('0x3c')]),_0x5223b8);if(_0x3a71c0['query'][_0x93a2('0x3d')]){_0x1643be[_0x93a2('0x3a')]=_[_0x93a2('0x3e')](_0x1643be[_0x93a2('0x3a')],{'$or':_[_0x93a2('0x30')](_0x5223b8,function(_0x553c6f){if(_0x553c6f[_0x93a2('0x2e')]!==_0x93a2('0x3f')){var _0x588097={};_0x588097[_0x553c6f[_0x93a2('0x28')]]={'$like':'%'+_0x3a71c0['query'][_0x93a2('0x3d')]+'%'};return _0x588097;}})});}_0x1643be=_[_0x93a2('0x3e')]({},_0x1643be,_0x3a71c0[_0x93a2('0x40')]);var _0x5ba827={'where':_0x1643be['where']};return db['VoiceQueuesLog'][_0x93a2('0x1f')](_0x5ba827)['then'](function(_0xa00752){_0x4ecd5f['count']=_0xa00752;if(_0x3a71c0['query'][_0x93a2('0x41')]){_0x1643be[_0x93a2('0x42')]=[{'all':!![]}];}return db[_0x93a2('0x2b')][_0x93a2('0x43')](_0x1643be);})['then'](function(_0x1cd2a9){_0x4ecd5f[_0x93a2('0x44')]=_0x1cd2a9;return _0x4ecd5f;})['then'](respondWithFilteredResult(_0x470f52,_0x1643be))[_0x93a2('0x45')](handleError(_0x470f52,null));};exports['show']=function(_0x17c074,_0x51b9c6){var _0x8a3063={'raw':!![],'where':{'id':_0x17c074[_0x93a2('0x46')]['id']}},_0x484fae={};_0x484fae[_0x93a2('0x2f')]=_[_0x93a2('0x32')](db[_0x93a2('0x2b')]['rawAttributes']);_0x484fae[_0x93a2('0x31')]=_[_0x93a2('0x32')](_0x17c074[_0x93a2('0x31')]);_0x484fae[_0x93a2('0x3c')]=_[_0x93a2('0x33')](_0x484fae['model'],_0x484fae[_0x93a2('0x31')]);_0x8a3063[_0x93a2('0x35')]=_[_0x93a2('0x33')](_0x484fae[_0x93a2('0x2f')],qs[_0x93a2('0x34')](_0x17c074[_0x93a2('0x31')][_0x93a2('0x34')]));_0x8a3063[_0x93a2('0x35')]=_0x8a3063[_0x93a2('0x35')][_0x93a2('0x36')]?_0x8a3063[_0x93a2('0x35')]:_0x484fae[_0x93a2('0x2f')];if(_0x17c074['query'][_0x93a2('0x41')]){_0x8a3063[_0x93a2('0x42')]=[{'all':!![]}];}_0x8a3063=_[_0x93a2('0x3e')]({},_0x8a3063,_0x17c074[_0x93a2('0x40')]);return db[_0x93a2('0x2b')][_0x93a2('0x47')](_0x8a3063)[_0x93a2('0x25')](handleEntityNotFound(_0x51b9c6,null))[_0x93a2('0x25')](respondWithResult(_0x51b9c6,null))[_0x93a2('0x45')](handleError(_0x51b9c6,null));};exports['create']=function(_0x7b777f,_0x51c483){return db['VoiceQueuesLog'][_0x93a2('0x48')](_0x7b777f['body'],{})[_0x93a2('0x25')](respondWithResult(_0x51c483,0xc9))['catch'](handleError(_0x51c483,null));};exports[_0x93a2('0x24')]=function(_0x16f58d,_0x5d59e7){if(_0x16f58d[_0x93a2('0x49')]['id']){delete _0x16f58d[_0x93a2('0x49')]['id'];}return db[_0x93a2('0x2b')][_0x93a2('0x47')]({'where':{'id':_0x16f58d[_0x93a2('0x46')]['id']}})[_0x93a2('0x25')](handleEntityNotFound(_0x5d59e7,null))[_0x93a2('0x25')](saveUpdates(_0x16f58d[_0x93a2('0x49')],null))[_0x93a2('0x25')](respondWithResult(_0x5d59e7,null))[_0x93a2('0x45')](handleError(_0x5d59e7,null));};exports[_0x93a2('0x4a')]=function(_0x578d12,_0x31a83e){return db['VoiceQueuesLog'][_0x93a2('0x47')]({'where':{'id':_0x578d12[_0x93a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x31a83e,null))[_0x93a2('0x25')](removeEntity(_0x31a83e,null))[_0x93a2('0x45')](handleError(_0x31a83e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a0e5f0d..edfe51b 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 _0x80fb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger'];(function(_0x4c2ac2,_0xe0548e){var _0x457533=function(_0x9aaafd){while(--_0x9aaafd){_0x4c2ac2['push'](_0x4c2ac2['shift']());}};_0x457533(++_0xe0548e);}(_0x80fb,0x11e));var _0xb80f=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x80fb[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0xb80f('0x0'));var logger=require(_0xb80f('0x1'))('api');var moment=require(_0xb80f('0x2'));var BPromise=require(_0xb80f('0x3'));var rp=require(_0xb80f('0x4'));var fs=require('fs');var path=require(_0xb80f('0x5'));var rimraf=require(_0xb80f('0x6'));var config=require(_0xb80f('0x7'));var attributes=require(_0xb80f('0x8'));module[_0xb80f('0x9')]=function(_0x52d81c,_0x1676a9){return _0x52d81c[_0xb80f('0xa')](_0xb80f('0xb'),attributes,{'tableName':_0xb80f('0xc'),'paranoid':![],'indexes':[{'name':_0xb80f('0xd'),'fields':[_0xb80f('0xe'),_0xb80f('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa588=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xa588,0xe1));var _0x8a58=function(_0x5e6ebe,_0x373752){_0x5e6ebe=_0x5e6ebe-0x0;var _0x5d80a0=_0xa588[_0x5e6ebe];return _0x5d80a0;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var moment=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var rp=require(_0x8a58('0x5'));var fs=require('fs');var path=require(_0x8a58('0x6'));var rimraf=require(_0x8a58('0x7'));var config=require(_0x8a58('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x8a58('0x9')]=function(_0x408a4a,_0x448366){return _0x408a4a[_0x8a58('0xa')](_0x8a58('0xb'),attributes,{'tableName':_0x8a58('0xc'),'paranoid':![],'indexes':[{'name':_0x8a58('0xd'),'fields':[_0x8a58('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3d935a0..5b8735d 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 _0xeb1e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment'];(function(_0x718f63,_0x13544f){var _0x3693f5=function(_0x312985){while(--_0x312985){_0x718f63['push'](_0x718f63['shift']());}};_0x3693f5(++_0x13544f);}(_0xeb1e,0x115));var _0xeeb1=function(_0x155a33,_0x1f1b1f){_0x155a33=_0x155a33-0x0;var _0x1fbab1=_0xeb1e[_0x155a33];return _0x1fbab1;};'use strict';var _=require(_0xeeb1('0x0'));var util=require(_0xeeb1('0x1'));var moment=require(_0xeeb1('0x2'));var BPromise=require(_0xeeb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeb1('0x4'));var db=require(_0xeeb1('0x5'))['db'];var utils=require(_0xeeb1('0x6'));var logger=require(_0xeeb1('0x7'))(_0xeeb1('0x8'));var config=require(_0xeeb1('0x9'));var jayson=require(_0xeeb1('0xa'));var client=jayson['client'][_0xeeb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x479455,_0x3bf77a,_0x816e64){return new BPromise(function(_0x1ddac0,_0x111b20){return client[_0xeeb1('0xc')](_0x479455,_0x816e64)['then'](function(_0x5c2ea9){logger['info'](_0xeeb1('0xd'),_0x3bf77a,_0xeeb1('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3bf77a,_0xeeb1('0xe'),JSON['stringify'](_0x5c2ea9));if(_0x5c2ea9[_0xeeb1('0xf')]){if(_0x5c2ea9[_0xeeb1('0xf')]['code']===0x1f4){logger[_0xeeb1('0xf')](_0xeeb1('0xd'),_0x3bf77a,_0x5c2ea9['error'][_0xeeb1('0x10')]);return _0x111b20(_0x5c2ea9[_0xeeb1('0xf')][_0xeeb1('0x10')]);}logger[_0xeeb1('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3bf77a,_0x5c2ea9[_0xeeb1('0xf')]['message']);return _0x1ddac0(_0x5c2ea9[_0xeeb1('0xf')][_0xeeb1('0x10')]);}else{logger[_0xeeb1('0x11')](_0xeeb1('0xd'),_0x3bf77a,_0xeeb1('0xe'));_0x1ddac0(_0x5c2ea9[_0xeeb1('0x12')][_0xeeb1('0x10')]);}})[_0xeeb1('0x13')](function(_0x55ce5b){logger[_0xeeb1('0xf')](_0xeeb1('0xd'),_0x3bf77a,_0x55ce5b);_0x111b20(_0x55ce5b);});});} \ No newline at end of file +var _0x0f45=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','then','info','debug'];(function(_0x3d718c,_0x204f5b){var _0x43355f=function(_0x3fa4bd){while(--_0x3fa4bd){_0x3d718c['push'](_0x3d718c['shift']());}};_0x43355f(++_0x204f5b);}(_0x0f45,0x7f));var _0x50f4=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x0f45[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0x50f4('0x0'));var util=require(_0x50f4('0x1'));var moment=require(_0x50f4('0x2'));var BPromise=require(_0x50f4('0x3'));var rs=require(_0x50f4('0x4'));var fs=require('fs');var Redis=require(_0x50f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x50f4('0x6'));var logger=require('../../config/logger')(_0x50f4('0x7'));var config=require('../../config/environment');var jayson=require(_0x50f4('0x8'));var client=jayson['client'][_0x50f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35d04b,_0x31d988,_0x2d7377){return new BPromise(function(_0x3a72ee,_0x1f8514){return client['request'](_0x35d04b,_0x2d7377)[_0x50f4('0xa')](function(_0xb9b914){logger[_0x50f4('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x31d988,'request\x20sent');logger[_0x50f4('0xc')](_0x50f4('0xd'),_0x31d988,_0x50f4('0xe'),JSON[_0x50f4('0xf')](_0xb9b914));if(_0xb9b914['error']){if(_0xb9b914[_0x50f4('0x10')]['code']===0x1f4){logger[_0x50f4('0x10')](_0x50f4('0x11'),_0x31d988,_0xb9b914[_0x50f4('0x10')][_0x50f4('0x12')]);return _0x1f8514(_0xb9b914[_0x50f4('0x10')][_0x50f4('0x12')]);}logger['error'](_0x50f4('0x11'),_0x31d988,_0xb9b914[_0x50f4('0x10')][_0x50f4('0x12')]);return _0x3a72ee(_0xb9b914['error'][_0x50f4('0x12')]);}else{logger[_0x50f4('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x31d988,_0x50f4('0xe'));_0x3a72ee(_0xb9b914['result'][_0x50f4('0x12')]);}})[_0x50f4('0x13')](function(_0x4d00a5){logger[_0x50f4('0x10')](_0x50f4('0x11'),_0x31d988,_0x4d00a5);_0x1f8514(_0x4d00a5);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7c84a68..b71b3cb 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 _0xad60=['delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','downloads','downloadTranscribe','post','create','/:id/transcribe','put'];(function(_0x5a07df,_0x2f855c){var _0x191ea4=function(_0x350d68){while(--_0x350d68){_0x5a07df['push'](_0x5a07df['shift']());}};_0x191ea4(++_0x2f855c);}(_0xad60,0x12d));var _0x0ad6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xad60[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x0ad6('0x0'));var util=require(_0x0ad6('0x1'));var path=require(_0x0ad6('0x2'));var timeout=require(_0x0ad6('0x3'));var express=require('express');var router=express[_0x0ad6('0x4')]();var fs_extra=require(_0x0ad6('0x5'));var auth=require(_0x0ad6('0x6'));var interaction=require(_0x0ad6('0x7'));var config=require(_0x0ad6('0x8'));var controller=require(_0x0ad6('0x9'));router[_0x0ad6('0xa')]('/',auth[_0x0ad6('0xb')](),controller[_0x0ad6('0xc')]);router[_0x0ad6('0xa')](_0x0ad6('0xd'),auth[_0x0ad6('0xb')](),controller[_0x0ad6('0xe')]);router[_0x0ad6('0xa')](_0x0ad6('0xf'),auth[_0x0ad6('0xb')](),controller[_0x0ad6('0x10')]);router[_0x0ad6('0xa')]('/:id/download',auth[_0x0ad6('0xb')](),controller[_0x0ad6('0x11')]);router[_0x0ad6('0xa')]('/:id/downloads',controller[_0x0ad6('0x12')]);router[_0x0ad6('0xa')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0ad6('0x13')]);router[_0x0ad6('0x14')]('/',auth['isAuthenticated'](),controller[_0x0ad6('0x15')]);router[_0x0ad6('0x14')](_0x0ad6('0x16'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x0ad6('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0ad6('0x18')](_0x0ad6('0xf'),auth[_0x0ad6('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x38f0=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x5a8fda,_0x5e46b7){var _0x211c09=function(_0x454539){while(--_0x454539){_0x5a8fda['push'](_0x5a8fda['shift']());}};_0x211c09(++_0x5e46b7);}(_0x38f0,0x1b1));var _0x038f=function(_0x3b04c3,_0x5a3112){_0x3b04c3=_0x3b04c3-0x0;var _0x2bc821=_0x38f0[_0x3b04c3];return _0x2bc821;};'use strict';var multer=require(_0x038f('0x0'));var util=require(_0x038f('0x1'));var path=require(_0x038f('0x2'));var timeout=require('connect-timeout');var express=require(_0x038f('0x3'));var router=express[_0x038f('0x4')]();var fs_extra=require(_0x038f('0x5'));var auth=require(_0x038f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x038f('0x7')]('/',auth[_0x038f('0x8')](),controller[_0x038f('0x9')]);router[_0x038f('0x7')](_0x038f('0xa'),auth[_0x038f('0x8')](),controller[_0x038f('0xb')]);router[_0x038f('0x7')]('/:id',auth[_0x038f('0x8')](),controller[_0x038f('0xc')]);router[_0x038f('0x7')](_0x038f('0xd'),auth[_0x038f('0x8')](),controller[_0x038f('0xe')]);router[_0x038f('0x7')](_0x038f('0xf'),controller[_0x038f('0x10')]);router[_0x038f('0x7')](_0x038f('0x11'),auth[_0x038f('0x8')](),controller[_0x038f('0x12')]);router[_0x038f('0x13')]('/',auth[_0x038f('0x8')](),controller[_0x038f('0x14')]);router[_0x038f('0x13')](_0x038f('0x11'),auth['isAuthenticated'](),controller[_0x038f('0x15')]);router[_0x038f('0x16')](_0x038f('0x17'),auth[_0x038f('0x8')](),controller[_0x038f('0x18')]);router[_0x038f('0x19')]('/:id',auth[_0x038f('0x8')](),controller[_0x038f('0x1a')]);module[_0x038f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 7cc7d70..0a58972 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(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 d50e7df..b30684e 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 _0x1c61=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','aws-sdk','uuid/v4','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','offset','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','catch','create','body','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','col','token','$and','push','ValidationError','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x1c61,0xa7));var _0x11c6=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x1c61[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require(_0x11c6('0x0'));var rimraf=require(_0x11c6('0x1'));var zipdir=require(_0x11c6('0x2'));var jsonpatch=require(_0x11c6('0x3'));var rp=require(_0x11c6('0x4'));var moment=require(_0x11c6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x11c6('0x6'));var path=require(_0x11c6('0x7'));var sox=require(_0x11c6('0x8'));var csv=require(_0x11c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11c6('0xa'));var crypto=require(_0x11c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x11c6('0xc'));var toCsv=require(_0x11c6('0x9'));var querystring=require('querystring');var Papa=require(_0x11c6('0xd'));var AWS=require(_0x11c6('0xe'));var uuidv4=require(_0x11c6('0xf'));var Redis=require(_0x11c6('0x10'));var authService=require(_0x11c6('0x11'));var qs=require(_0x11c6('0x12'));var as=require(_0x11c6('0x13'));var hardwareService=require(_0x11c6('0x14'));var logger=require('../../config/logger')(_0x11c6('0x15'));var utils=require(_0x11c6('0x16'));var config=require(_0x11c6('0x17'));var licenseUtil=require(_0x11c6('0x18'));var db=require(_0x11c6('0x19'))['db'];function respondWithStatusCode(_0x3ee56f,_0x2c6a02){_0x2c6a02=_0x2c6a02||0xcc;return function(_0x3eac15){if(_0x3eac15){return _0x3ee56f[_0x11c6('0x1a')](_0x2c6a02);}return _0x3ee56f[_0x11c6('0x1b')](_0x2c6a02)[_0x11c6('0x1c')]();};}function respondWithResult(_0x40a408,_0x324939){_0x324939=_0x324939||0xc8;return function(_0x19f2ee){if(_0x19f2ee){return _0x40a408[_0x11c6('0x1b')](_0x324939)['json'](_0x19f2ee);}};}function respondWithFilteredResult(_0x48657f,_0x4b2476){return function(_0x12312b){if(_0x12312b){var _0x4e4975=typeof _0x4b2476[_0x11c6('0x1d')]===_0x11c6('0x1e')&&typeof _0x4b2476['limit']===_0x11c6('0x1e');var _0x5a7f8c=_0x12312b[_0x11c6('0x1f')];var _0x1c2e2f=_0x4e4975?0x0:_0x4b2476[_0x11c6('0x1d')];var _0x4bf2f1=_0x4e4975?_0x12312b[_0x11c6('0x1f')]:_0x4b2476[_0x11c6('0x1d')]+_0x4b2476['limit'];var _0x432b11;if(_0x4bf2f1>=_0x5a7f8c){_0x4bf2f1=_0x5a7f8c;_0x432b11=0xc8;}else{_0x432b11=0xce;}_0x48657f['status'](_0x432b11);return _0x48657f[_0x11c6('0x20')](_0x11c6('0x21'),_0x1c2e2f+'-'+_0x4bf2f1+'/'+_0x5a7f8c)[_0x11c6('0x22')](_0x12312b);}return null;};}function patchUpdates(_0x4f8056){return function(_0x1e9735){try{jsonpatch[_0x11c6('0x23')](_0x1e9735,_0x4f8056,!![]);}catch(_0x5dd174){return BPromise['reject'](_0x5dd174);}return _0x1e9735[_0x11c6('0x24')]();};}function saveUpdates(_0x573d19,_0x3b8f92){return function(_0x30fa7f){if(_0x30fa7f){return _0x30fa7f['update'](_0x573d19)[_0x11c6('0x25')](function(_0x41ec76){return _0x41ec76;});}return null;};}function removeEntity(_0x49c8d3,_0x5ba7de){return function(_0x5082ba){if(_0x5082ba){return _0x5082ba[_0x11c6('0x26')]()[_0x11c6('0x25')](function(){_0x49c8d3[_0x11c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x169ce0,_0x575aa0){return function(_0x2d4fb8){if(!_0x2d4fb8){_0x169ce0[_0x11c6('0x1a')](0x194);}return _0x2d4fb8;};}function handleError(_0x185701,_0x3b5f66){_0x3b5f66=_0x3b5f66||0x1f4;return function(_0x20df9c){logger[_0x11c6('0x27')](_0x20df9c[_0x11c6('0x28')]);if(_0x20df9c[_0x11c6('0x29')]){delete _0x20df9c[_0x11c6('0x29')];}_0x185701[_0x11c6('0x1b')](_0x3b5f66)['send'](_0x20df9c);};}exports['index']=function(_0x1b2631,_0x252073){var _0x21cda8={},_0x2da7f1={},_0x400640={'count':0x0,'rows':[]};var _0x18f37a=_[_0x11c6('0x2a')](db[_0x11c6('0x2b')][_0x11c6('0x2c')],function(_0x227ec7){return{'name':_0x227ec7[_0x11c6('0x2d')],'type':_0x227ec7[_0x11c6('0x2e')]['key']};});_0x2da7f1[_0x11c6('0x2f')]=_[_0x11c6('0x30')](_[_0x11c6('0x2a')](_0x18f37a,_0x11c6('0x29')),[_0x11c6('0x31')]);_0x2da7f1[_0x11c6('0x32')]=_[_0x11c6('0x33')](_0x1b2631['query']);_0x2da7f1[_0x11c6('0x34')]=_[_0x11c6('0x35')](_0x2da7f1[_0x11c6('0x2f')],_0x2da7f1[_0x11c6('0x32')]);_0x21cda8[_0x11c6('0x36')]=_[_0x11c6('0x35')](_0x2da7f1['model'],qs['fields'](_0x1b2631[_0x11c6('0x32')][_0x11c6('0x37')]));_0x21cda8[_0x11c6('0x36')]=_0x21cda8[_0x11c6('0x36')][_0x11c6('0x38')]?_0x21cda8[_0x11c6('0x36')]:_0x2da7f1[_0x11c6('0x2f')];if(!_0x1b2631['query']['hasOwnProperty'](_0x11c6('0x39'))){_0x21cda8[_0x11c6('0x3a')]=qs['limit'](_0x1b2631[_0x11c6('0x32')][_0x11c6('0x3a')]);_0x21cda8[_0x11c6('0x1d')]=qs[_0x11c6('0x1d')](_0x1b2631['query']['offset']);}_0x21cda8['order']=qs[_0x11c6('0x3b')](_0x1b2631[_0x11c6('0x32')]['sort']);_0x21cda8[_0x11c6('0x3c')]=qs[_0x11c6('0x34')](_[_0x11c6('0x3d')](_0x1b2631[_0x11c6('0x32')],_0x2da7f1['filters']),_0x18f37a);if(_0x1b2631['query']['filter']){_0x21cda8[_0x11c6('0x3c')]=_[_0x11c6('0x3e')](_0x21cda8['where'],{'$or':_[_0x11c6('0x2a')](_0x18f37a,function(_0xd86f32){if(_0xd86f32[_0x11c6('0x2e')]!==_0x11c6('0x3f')){var _0x520ddc={};_0x520ddc[_0xd86f32['name']]={'$like':'%'+_0x1b2631[_0x11c6('0x32')][_0x11c6('0x40')]+'%'};return _0x520ddc;}})});}_0x21cda8=_[_0x11c6('0x3e')]({},_0x21cda8,_0x1b2631[_0x11c6('0x41')]);var _0x5a6e55={'where':_0x21cda8[_0x11c6('0x3c')]};return db[_0x11c6('0x2b')]['count'](_0x5a6e55)[_0x11c6('0x25')](function(_0x14b879){_0x400640[_0x11c6('0x1f')]=_0x14b879;if(_0x1b2631[_0x11c6('0x32')][_0x11c6('0x42')]){_0x21cda8['include']=[{'all':!![]}];}return db[_0x11c6('0x2b')]['findAll'](_0x21cda8);})['then'](function(_0x17bd28){_0x400640[_0x11c6('0x43')]=_0x17bd28;return _0x400640;})[_0x11c6('0x25')](respondWithFilteredResult(_0x252073,_0x21cda8))['catch'](handleError(_0x252073,null));};exports[_0x11c6('0x44')]=function(_0x1b645b,_0x36e7d8){var _0x1d8bf7={'raw':![],'where':{'id':_0x1b645b[_0x11c6('0x45')]['id']}},_0x336dbc={};_0x336dbc[_0x11c6('0x2f')]=_[_0x11c6('0x33')](db[_0x11c6('0x2b')][_0x11c6('0x2c')]);_0x336dbc[_0x11c6('0x32')]=_[_0x11c6('0x33')](_0x1b645b[_0x11c6('0x32')]);_0x336dbc[_0x11c6('0x34')]=_['intersection'](_0x336dbc[_0x11c6('0x2f')],_0x336dbc['query']);_0x1d8bf7['attributes']=_[_0x11c6('0x35')](_0x336dbc[_0x11c6('0x2f')],qs[_0x11c6('0x37')](_0x1b645b[_0x11c6('0x32')][_0x11c6('0x37')]));_0x1d8bf7[_0x11c6('0x36')]=_0x1d8bf7['attributes'][_0x11c6('0x38')]?_0x1d8bf7['attributes']:_0x336dbc[_0x11c6('0x2f')];if(_0x1b645b[_0x11c6('0x32')][_0x11c6('0x42')]){_0x1d8bf7[_0x11c6('0x46')]=[{'all':!![]}];}_0x1d8bf7=_[_0x11c6('0x3e')]({},_0x1d8bf7,_0x1b645b[_0x11c6('0x41')]);return db[_0x11c6('0x2b')][_0x11c6('0x47')](_0x1d8bf7)[_0x11c6('0x25')](handleEntityNotFound(_0x36e7d8,null))['then'](respondWithResult(_0x36e7d8,null))[_0x11c6('0x48')](handleError(_0x36e7d8,null));};exports[_0x11c6('0x49')]=function(_0x340fc7,_0xbdd733){return db['VoiceRecording']['create'](_0x340fc7[_0x11c6('0x4a')],{})[_0x11c6('0x25')](respondWithResult(_0xbdd733,0xc9))[_0x11c6('0x48')](handleError(_0xbdd733,null));};exports['update']=function(_0x37c84f,_0x12bdcd){if(_0x37c84f[_0x11c6('0x4a')]['id']){delete _0x37c84f['body']['id'];}return db[_0x11c6('0x2b')][_0x11c6('0x47')]({'where':{'id':_0x37c84f[_0x11c6('0x45')]['id']}})[_0x11c6('0x25')](handleEntityNotFound(_0x12bdcd,null))[_0x11c6('0x25')](saveUpdates(_0x37c84f[_0x11c6('0x4a')],null))[_0x11c6('0x25')](respondWithResult(_0x12bdcd,null))['catch'](handleError(_0x12bdcd,null));};exports['describe']=function(_0x27ff7a,_0x498580){return db[_0x11c6('0x2b')]['describe']()[_0x11c6('0x25')](respondWithResult(_0x498580,null))[_0x11c6('0x48')](handleError(_0x498580,null));};exports[_0x11c6('0x4b')]=function(_0x45b064,_0x43401f,_0x450eaf){var _0x1e52e0=require(_0x11c6('0x4c'));var _0x2b4cc4=![];var _0x43886e={};if(_0x45b064[_0x11c6('0x32')][_0x11c6('0x2e')]&&_0x45b064[_0x11c6('0x32')][_0x11c6('0x2e')]===_0x11c6('0x4d')){_0x43886e[_0x11c6('0x4d')]=_0x45b064[_0x11c6('0x45')]['id'];}else{_0x43886e['id']=_0x45b064['params']['id'];}return db['VoiceRecording'][_0x11c6('0x47')]({'where':_0x43886e,'attributes':['id',_0x11c6('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x43401f,null))['then'](function(_0x1c2d31){if(_0x1c2d31){var _0x22d276=_0x1c2d31[_0x11c6('0x4e')];var _0x317621=util[_0x11c6('0x31')](_0x11c6('0x4f'),_0x22d276);if(fs[_0x11c6('0x50')](_0x317621)){_0x2b4cc4=!![];return _0x1e52e0[_0x11c6('0x51')](_0x317621,_0x22d276,config[_0x11c6('0x52')][_0x11c6('0x53')])[_0x11c6('0x25')](function(){return _0x1c2d31;});}return _0x1c2d31;}})[_0x11c6('0x25')](function(_0x489508){if(_0x489508){var _0x2e265f=_0x489508['value'];if(!fs[_0x11c6('0x50')](_0x2e265f)){throw new db[(_0x11c6('0x54'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x489508[_0x11c6('0x55')]){return _0x43401f[_0x11c6('0x4b')](_0x2e265f,_0x489508['filename']+path[_0x11c6('0x56')](_0x2e265f),function(){if(_0x2b4cc4){fs[_0x11c6('0x57')](_0x2e265f);}});}else{return _0x43401f['download'](_0x2e265f,function(_0x3b7850){if(_0x2b4cc4){fs['unlink'](_0x2e265f);}});}}})['catch'](function(_0x4c03be){if(_0x4c03be[_0x11c6('0x58')]===_0x11c6('0x59')){_0x43401f[_0x11c6('0x1b')](0x194)[_0x11c6('0x5a')](_0x11c6('0x5b'));}else{return handleError(_0x43401f,null);}});};exports[_0x11c6('0x5c')]=function(_0x140c7d,_0x359b1c,_0xebc2e4){var _0xf889f7=require(_0x11c6('0x4c'));var _0x4bbf5a=![];var _0x33f667={'$and':[db[_0x11c6('0x5d')][_0x11c6('0x3c')](db[_0x11c6('0x5d')]['fn']('MD5',db[_0x11c6('0x5d')][_0x11c6('0x5e')](_0x11c6('0x4d'))),_0x140c7d['query'][_0x11c6('0x5f')])]};if(_0x140c7d[_0x11c6('0x32')]['type']&&_0x140c7d['query'][_0x11c6('0x2e')]===_0x11c6('0x4d')){_0x33f667['$and']['push']({'uniqueid':_0x140c7d[_0x11c6('0x45')]['id']});}else{_0x33f667[_0x11c6('0x60')][_0x11c6('0x61')]({'id':_0x140c7d[_0x11c6('0x45')]['id']});}return db['VoiceRecording'][_0x11c6('0x47')]({'where':_0x33f667,'attributes':['id',_0x11c6('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x359b1c,null))[_0x11c6('0x25')](function(_0x44de51){if(_0x44de51){var _0xdbb7ed=util[_0x11c6('0x31')]('%s.cypher',_0x44de51[_0x11c6('0x4e')]);if(fs[_0x11c6('0x50')](_0xdbb7ed)){_0x4bbf5a=!![];return _0xf889f7['decryptFile'](_0xdbb7ed,_0x44de51[_0x11c6('0x4e')],config[_0x11c6('0x52')][_0x11c6('0x53')])[_0x11c6('0x25')](function(){return _0x44de51;});}return _0x44de51;}})[_0x11c6('0x25')](function(_0x3931d4){if(_0x3931d4){if(!fs['existsSync'](_0x3931d4['value'])){throw new db['Sequelize'][(_0x11c6('0x62'))](_0x11c6('0x59'));}if(_0x3931d4[_0x11c6('0x55')]){return _0x359b1c['download'](_0x3931d4[_0x11c6('0x4e')],_0x3931d4[_0x11c6('0x55')]+path['extname'](_0x3931d4[_0x11c6('0x4e')]),function(){if(_0x4bbf5a){fs['unlink'](_0x3931d4[_0x11c6('0x4e')]);}});}else{return _0x359b1c[_0x11c6('0x4b')](_0x3931d4[_0x11c6('0x4e')],function(_0x57cb59){if(_0x4bbf5a){fs[_0x11c6('0x57')](_0x3931d4[_0x11c6('0x4e')]);}});}}})[_0x11c6('0x48')](handleError(_0x359b1c,null));};exports[_0x11c6('0x26')]=function(_0x55941c,_0x5a5ff6){return db[_0x11c6('0x2b')][_0x11c6('0x47')]({'where':{'id':_0x55941c[_0x11c6('0x45')]['id']}})[_0x11c6('0x25')](function(_0x3cf8a1){if(_['isNil'](_0x3cf8a1)){throw new ReferenceError(_0x11c6('0x63'));}return _0x3cf8a1;})[_0x11c6('0x25')](function(_0x22226f){var _0x27d7f2=_0x22226f['value'];logger[_0x11c6('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x27d7f2);if(!_[_0x11c6('0x65')](_0x22226f[_0x11c6('0x4e')])&&fs[_0x11c6('0x50')](_0x27d7f2)){logger[_0x11c6('0x64')](_0x11c6('0x66')+_0x27d7f2+_0x11c6('0x67'));fs[_0x11c6('0x68')](_0x27d7f2);}_0x27d7f2=_0x27d7f2+_0x11c6('0x69');if(!_[_0x11c6('0x65')](_0x22226f[_0x11c6('0x4e')])&&fs[_0x11c6('0x50')](_0x27d7f2)){logger[_0x11c6('0x64')](_0x11c6('0x66')+_0x27d7f2+_0x11c6('0x67'));fs[_0x11c6('0x68')](_0x27d7f2);}return _0x22226f;})[_0x11c6('0x25')](function(_0x1671e5){if(!_0x1671e5)throw new InternalError();return _0x1671e5[_0x11c6('0x26')]();})['then'](function(){_0x5a5ff6[_0x11c6('0x1b')](0xcc)[_0x11c6('0x1c')]();})[_0x11c6('0x48')](handleError(_0x5a5ff6,null));};function getBucketslist(_0x24d301,_0x29afed,_0xe3cc84){return new Promise(function(_0x4c2992,_0x24725b){var _0x2d93c9=new AWS['S3']({'accessKeyId':_0x29afed,'secretAccessKey':_0x24d301,'region':_0xe3cc84});_0x2d93c9[_0x11c6('0x6a')]({},function(_0x58855d,_0x3c861c){if(_0x58855d){return _0x24725b(_0x58855d);}else{return _0x4c2992(_0x3c861c);}});});}function createBucket(_0x13917f,_0x3fa8d4,_0x445e79,_0xb18d8b){return new Promise(function(_0x14ecbb,_0x32da8d){var _0x2e2ef2=new AWS['S3']({'accessKeyId':_0x3fa8d4,'secretAccessKey':_0x13917f,'region':_0x445e79});_0x2e2ef2[_0x11c6('0x6b')]({'Bucket':_0xb18d8b},function(_0x3608a0,_0x41d103){if(_0x3608a0){return _0x32da8d(_0x3608a0);}else{return _0x14ecbb(_0x41d103);}});});}function uploadFile(_0x53e171,_0x21c1c5,_0x494f30,_0x3da427,_0x5c09b0,_0x5682d1){return new Promise(function(_0xd253d5,_0x352c14){var _0x10793f=new AWS['S3']({'accessKeyId':_0x21c1c5,'secretAccessKey':_0x53e171,'region':_0x494f30});_0x10793f['upload']({'Bucket':_0x3da427,'Key':_0x5c09b0,'Body':_0x5682d1},function(_0x2f2911,_0x2df0b6){if(_0x2f2911){return _0x352c14(_0x2f2911);}else{return _0xd253d5(_0x2df0b6);}});});}function startTranscribe(_0x1d479e,_0x412969,_0x351967,_0x10dd64,_0x64682,_0x5c7600){return new Promise(function(_0x20fd6e,_0x4468ef){var _0x4b8d15=new AWS[(_0x11c6('0x6c'))]({'accessKeyId':_0x412969,'secretAccessKey':_0x1d479e,'region':_0x351967});_0x4b8d15[_0x11c6('0x6d')]({'TranscriptionJobName':_0x10dd64,'LanguageCode':_0x64682,'Media':{'MediaFileUri':_0x5c7600}},function(_0x4c86b8,_0x44fe2d){if(_0x4c86b8){return _0x4468ef(_0x4c86b8);}else{return _0x20fd6e(_0x44fe2d);}});});}function transcribe(_0x3fc190,_0x5ed6ff,_0x48eb70,_0x50b20e,_0x589965,_0xb5ebbe,_0x1ac0db){return new Promise(function(_0x5b5e89,_0x523b2d){var _0x135388={};logger[_0x11c6('0x64')](util[_0x11c6('0x31')](_0x11c6('0x6e'),_0x3fc190,_0x589965));return uploadFile(_0x5ed6ff,_0x48eb70,_0x50b20e,_0x589965,path[_0x11c6('0x6f')](_0xb5ebbe),fs[_0x11c6('0x70')](_0xb5ebbe))[_0x11c6('0x25')](function(_0x884794){logger[_0x11c6('0x64')](util[_0x11c6('0x31')](_0x11c6('0x71'),_0x3fc190,_0x589965,_0x884794[_0x11c6('0x72')]));_0x135388['bucket']=_0x884794[_0x11c6('0x73')];_0x135388[_0x11c6('0x74')]=_0x884794[_0x11c6('0x72')];logger[_0x11c6('0x64')](util[_0x11c6('0x31')](_0x11c6('0x75'),_0x3fc190));return startTranscribe(_0x5ed6ff,_0x48eb70,_0x50b20e,uuidv4(),_0x1ac0db,_0x884794[_0x11c6('0x72')]);})[_0x11c6('0x25')](function(_0x246d9a){logger[_0x11c6('0x64')](util[_0x11c6('0x31')](_0x11c6('0x76'),_0x3fc190,_0x246d9a[_0x11c6('0x77')][_0x11c6('0x78')]));_0x135388[_0x11c6('0x79')]=_0x246d9a[_0x11c6('0x77')][_0x11c6('0x78')];_0x135388['transcribeStatus']=_0x246d9a[_0x11c6('0x77')][_0x11c6('0x7a')];return _0x5b5e89(_0x135388);})[_0x11c6('0x48')](function(_0x171766){return _0x523b2d(_0x171766);});});}exports[_0x11c6('0x7b')]=function(_0x6aae5c,_0x133afa,_0x28b92f){var _0x2447f5;var _0x211bf8;var _0x11377c;var _0x198f41=require(_0x11c6('0x4c'));return db[_0x11c6('0x2b')]['findOne']({'where':{'id':_0x6aae5c[_0x11c6('0x45')]['id']}})[_0x11c6('0x25')](function(_0x104951){if(_0x104951){var _0x53beb3=util['format']('%s.cypher',_0x104951['value']);if(fs[_0x11c6('0x50')](_0x53beb3)){cypher=!![];return _0x198f41[_0x11c6('0x51')](_0x53beb3,_0x104951[_0x11c6('0x4e')],config['secrets'][_0x11c6('0x53')])['then'](function(){return _0x104951;});}return _0x104951;}})[_0x11c6('0x25')](function(_0x1c3cad){if(!_0x1c3cad){throw new db['Sequelize']['ValidationError'](_0x11c6('0x7c'));}_0x211bf8=_0x1c3cad;return db[_0x11c6('0x7d')][_0x11c6('0x7e')]({'where':{'id':0x1}});})[_0x11c6('0x25')](handleEntityNotFound(_0x133afa,null))[_0x11c6('0x25')](function(_0x17f53f){if(_0x17f53f){_0x2447f5=_0x17f53f;if(!_0x2447f5[_0x11c6('0x7f')]||!_0x2447f5[_0x11c6('0x80')]||!_0x2447f5[_0x11c6('0x81')]||!_0x2447f5[_0x11c6('0x82')]||!_0x2447f5[_0x11c6('0x83')]){throw new db[(_0x11c6('0x54'))][(_0x11c6('0x62'))](_0x11c6('0x84'));}if(_0x6aae5c[_0x11c6('0x4a')]['runSentiment']&&(!_0x2447f5[_0x11c6('0x85')]||!_0x2447f5[_0x11c6('0x86')]||!_0x2447f5[_0x11c6('0x87')]||!_0x2447f5[_0x11c6('0x82')]||!_0x2447f5['bucket'])){throw new db['Sequelize'][(_0x11c6('0x62'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x2447f5[_0x11c6('0x80')]}});}})[_0x11c6('0x25')](function(_0x28c2bd){if(!_0x28c2bd){throw new db[(_0x11c6('0x54'))][(_0x11c6('0x62'))](_0x11c6('0x88'));}if(!_0x28c2bd['data1']||!_0x28c2bd[_0x11c6('0x89')]){throw new db[(_0x11c6('0x54'))][(_0x11c6('0x62'))](_0x11c6('0x8a'));}_0x11377c=_0x28c2bd;return getBucketslist(_0x11377c['data1'],_0x11377c['data2'],_0x2447f5[_0x11c6('0x81')]);})[_0x11c6('0x25')](function(_0x16b333){if(_0x16b333&&_0x16b333[_0x11c6('0x8b')]){var _0x9631b1=_[_0x11c6('0x47')](_0x16b333['Buckets'],function(_0x3afbe9){return _0x3afbe9[_0x11c6('0x8c')]===_0x2447f5['bucket'];});if(!_0x9631b1){logger[_0x11c6('0x64')](util[_0x11c6('0x31')](_0x11c6('0x8d'),_0x6aae5c[_0x11c6('0x45')]['id'],_0x2447f5[_0x11c6('0x83')]));return createBucket(_0x11377c[_0x11c6('0x8e')],_0x11377c[_0x11c6('0x89')],_0x2447f5[_0x11c6('0x81')],_0x2447f5[_0x11c6('0x83')]);}logger[_0x11c6('0x64')](util['format'](_0x11c6('0x8f'),_0x6aae5c[_0x11c6('0x45')]['id'],_0x2447f5[_0x11c6('0x83')]));return;}})['then'](function(_0x5eea8d){if(_0x211bf8[_0x11c6('0x90')]==='NEW'){return transcribe(_0x6aae5c[_0x11c6('0x45')]['id'],_0x11377c[_0x11c6('0x8e')],_0x11377c[_0x11c6('0x89')],_0x2447f5[_0x11c6('0x81')],_0x2447f5[_0x11c6('0x83')],_0x211bf8['value'],_0x2447f5['language']);}else{logger[_0x11c6('0x64')](util['format'](_0x11c6('0x91'),_0x6aae5c['params']['id']));return{'transcribeStatus':_0x11c6('0x92')};}})[_0x11c6('0x25')](function(_0x27ffaf){if(_0x27ffaf){_0x27ffaf['tempSentiment']=_0x6aae5c['body'][_0x11c6('0x93')];return _0x211bf8[_0x11c6('0x94')](_0x27ffaf);}})[_0x11c6('0x25')](respondWithResult(_0x133afa,null))[_0x11c6('0x48')](handleError(_0x133afa,null));};function writeFile(_0x40f453,_0x1c4def){return new Promise(function(_0x3ec2f7,_0x1b30d5){fs[_0x11c6('0x95')](_0x1c4def,_0x40f453,function(_0x2779c3,_0x53a1b1){if(_0x2779c3){return _0x1b30d5(_0x2779c3);}else{return _0x3ec2f7(_0x53a1b1);}});});}exports[_0x11c6('0x96')]=function(_0xe00384,_0x1b0f2b,_0x34150a){return db[_0x11c6('0x2b')][_0x11c6('0x7e')]({'where':{'id':_0xe00384[_0x11c6('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b0f2b))[_0x11c6('0x25')](function(_0x3bb642){if(_0x3bb642&&_0x3bb642['fileText']){var _0xba6ba8=_0x3bb642[_0x11c6('0x97')];var _0x33b0e5=config[_0x11c6('0x98')]+_0x11c6('0x99')+_0x3bb642['id']+'.txt';if(fs[_0x11c6('0x50')](_0x33b0e5)){return _0x33b0e5;}return writeFile(_0xba6ba8,_0x33b0e5)[_0x11c6('0x25')](function(){return _0x33b0e5;});}else{throw new db[(_0x11c6('0x54'))]['ValidationError'](_0x11c6('0x9a'));}})['then'](function(_0x1e2937){return _0x1b0f2b[_0x11c6('0x4b')](_0x1e2937);})[_0x11c6('0x48')](handleError(_0x1b0f2b));}; \ No newline at end of file +var _0xb5cc=['updateAttributes','writeFile','downloadTranscribe','fileText','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','error','name','send','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','map','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','keys','length','find','catch','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','$and','push','recording','ValidationError','extname','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','tempSentiment','runSentiment'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0xb5cc,0x12d));var _0xcb5c=function(_0x22f690,_0x3b68a6){_0x22f690=_0x22f690-0x0;var _0x126198=_0xb5cc[_0x22f690];return _0x126198;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb5c('0x0'));var zipdir=require(_0xcb5c('0x1'));var jsonpatch=require(_0xcb5c('0x2'));var rp=require(_0xcb5c('0x3'));var moment=require(_0xcb5c('0x4'));var BPromise=require(_0xcb5c('0x5'));var Mustache=require(_0xcb5c('0x6'));var util=require('util');var path=require(_0xcb5c('0x7'));var sox=require(_0xcb5c('0x8'));var csv=require(_0xcb5c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb5c('0xa'));var _=require('lodash');var squel=require(_0xcb5c('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb5c('0xc'));var deskjs=require(_0xcb5c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcb5c('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xcb5c('0xf'));var Redis=require(_0xcb5c('0x10'));var authService=require(_0xcb5c('0x11'));var qs=require(_0xcb5c('0x12'));var as=require(_0xcb5c('0x13'));var hardwareService=require(_0xcb5c('0x14'));var logger=require(_0xcb5c('0x15'))(_0xcb5c('0x16'));var utils=require(_0xcb5c('0x17'));var config=require(_0xcb5c('0x18'));var licenseUtil=require(_0xcb5c('0x19'));var db=require(_0xcb5c('0x1a'))['db'];function respondWithStatusCode(_0x4c348d,_0x75de5a){_0x75de5a=_0x75de5a||0xcc;return function(_0x10996a){if(_0x10996a){return _0x4c348d[_0xcb5c('0x1b')](_0x75de5a);}return _0x4c348d[_0xcb5c('0x1c')](_0x75de5a)[_0xcb5c('0x1d')]();};}function respondWithResult(_0x509b26,_0x2a997e){_0x2a997e=_0x2a997e||0xc8;return function(_0x378b81){if(_0x378b81){return _0x509b26['status'](_0x2a997e)['json'](_0x378b81);}};}function respondWithFilteredResult(_0x58ad03,_0x295b5d){return function(_0x15c529){if(_0x15c529){var _0x42112a=typeof _0x295b5d[_0xcb5c('0x1e')]==='undefined'&&typeof _0x295b5d[_0xcb5c('0x1f')]===_0xcb5c('0x20');var _0x385d34=_0x15c529[_0xcb5c('0x21')];var _0x24c7e5=_0x42112a?0x0:_0x295b5d[_0xcb5c('0x1e')];var _0x1d32d9=_0x42112a?_0x15c529[_0xcb5c('0x21')]:_0x295b5d[_0xcb5c('0x1e')]+_0x295b5d[_0xcb5c('0x1f')];var _0x564fc0;if(_0x1d32d9>=_0x385d34){_0x1d32d9=_0x385d34;_0x564fc0=0xc8;}else{_0x564fc0=0xce;}_0x58ad03[_0xcb5c('0x1c')](_0x564fc0);return _0x58ad03[_0xcb5c('0x22')](_0xcb5c('0x23'),_0x24c7e5+'-'+_0x1d32d9+'/'+_0x385d34)[_0xcb5c('0x24')](_0x15c529);}return null;};}function patchUpdates(_0x2e7510){return function(_0x4de97e){try{jsonpatch['apply'](_0x4de97e,_0x2e7510,!![]);}catch(_0x2d919d){return BPromise[_0xcb5c('0x25')](_0x2d919d);}return _0x4de97e[_0xcb5c('0x26')]();};}function saveUpdates(_0x3ef986,_0x4baf75){return function(_0x44f35f){if(_0x44f35f){return _0x44f35f[_0xcb5c('0x27')](_0x3ef986)['then'](function(_0x1ff9f2){return _0x1ff9f2;});}return null;};}function removeEntity(_0xb789a,_0x25d3e6){return function(_0x180015){if(_0x180015){return _0x180015['destroy']()[_0xcb5c('0x28')](function(){_0xb789a[_0xcb5c('0x1c')](0xcc)[_0xcb5c('0x1d')]();});}};}function handleEntityNotFound(_0x16cd84,_0x3b68b1){return function(_0x499ce6){if(!_0x499ce6){_0x16cd84['sendStatus'](0x194);}return _0x499ce6;};}function handleError(_0x28c28a,_0x524aa1){_0x524aa1=_0x524aa1||0x1f4;return function(_0x47f5f6){logger[_0xcb5c('0x29')](_0x47f5f6['stack']);if(_0x47f5f6[_0xcb5c('0x2a')]){delete _0x47f5f6[_0xcb5c('0x2a')];}_0x28c28a[_0xcb5c('0x1c')](_0x524aa1)[_0xcb5c('0x2b')](_0x47f5f6);};}exports['index']=function(_0x5a93e1,_0x1e0140){var _0x12b24a={},_0x3532ce={},_0xecf69c={'count':0x0,'rows':[]};var _0x2dc867=_['map'](db[_0xcb5c('0x2c')][_0xcb5c('0x2d')],function(_0x4e7378){return{'name':_0x4e7378[_0xcb5c('0x2e')],'type':_0x4e7378['type'][_0xcb5c('0x2f')]};});_0x3532ce[_0xcb5c('0x30')]=_[_0xcb5c('0x31')](_['map'](_0x2dc867,_0xcb5c('0x2a')),[_0xcb5c('0x32')]);_0x3532ce[_0xcb5c('0x33')]=_['keys'](_0x5a93e1[_0xcb5c('0x33')]);_0x3532ce[_0xcb5c('0x34')]=_[_0xcb5c('0x35')](_0x3532ce[_0xcb5c('0x30')],_0x3532ce[_0xcb5c('0x33')]);_0x12b24a[_0xcb5c('0x36')]=_['intersection'](_0x3532ce[_0xcb5c('0x30')],qs['fields'](_0x5a93e1[_0xcb5c('0x33')][_0xcb5c('0x37')]));_0x12b24a[_0xcb5c('0x36')]=_0x12b24a[_0xcb5c('0x36')]['length']?_0x12b24a[_0xcb5c('0x36')]:_0x3532ce[_0xcb5c('0x30')];if(!_0x5a93e1['query'][_0xcb5c('0x38')]('nolimit')){_0x12b24a[_0xcb5c('0x1f')]=qs[_0xcb5c('0x1f')](_0x5a93e1['query']['limit']);_0x12b24a['offset']=qs[_0xcb5c('0x1e')](_0x5a93e1[_0xcb5c('0x33')][_0xcb5c('0x1e')]);}_0x12b24a[_0xcb5c('0x39')]=qs[_0xcb5c('0x3a')](_0x5a93e1[_0xcb5c('0x33')][_0xcb5c('0x3a')]);_0x12b24a['where']=qs[_0xcb5c('0x34')](_[_0xcb5c('0x3b')](_0x5a93e1[_0xcb5c('0x33')],_0x3532ce[_0xcb5c('0x34')]),_0x2dc867);if(_0x5a93e1[_0xcb5c('0x33')]['filter']){_0x12b24a[_0xcb5c('0x3c')]=_[_0xcb5c('0x3d')](_0x12b24a[_0xcb5c('0x3c')],{'$or':_[_0xcb5c('0x3e')](_0x2dc867,function(_0x489d34){if(_0x489d34[_0xcb5c('0x3f')]!==_0xcb5c('0x40')){var _0x31264e={};_0x31264e[_0x489d34[_0xcb5c('0x2a')]]={'$like':'%'+_0x5a93e1[_0xcb5c('0x33')][_0xcb5c('0x41')]+'%'};return _0x31264e;}})});}_0x12b24a=_[_0xcb5c('0x3d')]({},_0x12b24a,_0x5a93e1[_0xcb5c('0x42')]);var _0x5f8ab1={'where':_0x12b24a[_0xcb5c('0x3c')]};return db[_0xcb5c('0x2c')][_0xcb5c('0x21')](_0x5f8ab1)[_0xcb5c('0x28')](function(_0x47c326){_0xecf69c['count']=_0x47c326;if(_0x5a93e1['query'][_0xcb5c('0x43')]){_0x12b24a[_0xcb5c('0x44')]=[{'all':!![]}];}return db[_0xcb5c('0x2c')]['findAll'](_0x12b24a);})[_0xcb5c('0x28')](function(_0x417ac8){_0xecf69c[_0xcb5c('0x45')]=_0x417ac8;return _0xecf69c;})['then'](respondWithFilteredResult(_0x1e0140,_0x12b24a))['catch'](handleError(_0x1e0140,null));};exports[_0xcb5c('0x46')]=function(_0x499a57,_0x12eb6b){var _0x3fbd7d={'raw':![],'where':{'id':_0x499a57[_0xcb5c('0x47')]['id']}},_0x59f4e9={};_0x59f4e9[_0xcb5c('0x30')]=_['keys'](db['VoiceRecording'][_0xcb5c('0x2d')]);_0x59f4e9[_0xcb5c('0x33')]=_[_0xcb5c('0x48')](_0x499a57[_0xcb5c('0x33')]);_0x59f4e9['filters']=_[_0xcb5c('0x35')](_0x59f4e9[_0xcb5c('0x30')],_0x59f4e9['query']);_0x3fbd7d['attributes']=_[_0xcb5c('0x35')](_0x59f4e9[_0xcb5c('0x30')],qs['fields'](_0x499a57[_0xcb5c('0x33')]['fields']));_0x3fbd7d['attributes']=_0x3fbd7d[_0xcb5c('0x36')][_0xcb5c('0x49')]?_0x3fbd7d[_0xcb5c('0x36')]:_0x59f4e9[_0xcb5c('0x30')];if(_0x499a57[_0xcb5c('0x33')][_0xcb5c('0x43')]){_0x3fbd7d[_0xcb5c('0x44')]=[{'all':!![]}];}_0x3fbd7d=_[_0xcb5c('0x3d')]({},_0x3fbd7d,_0x499a57[_0xcb5c('0x42')]);return db[_0xcb5c('0x2c')][_0xcb5c('0x4a')](_0x3fbd7d)['then'](handleEntityNotFound(_0x12eb6b,null))[_0xcb5c('0x28')](respondWithResult(_0x12eb6b,null))[_0xcb5c('0x4b')](handleError(_0x12eb6b,null));};exports[_0xcb5c('0x4c')]=function(_0x486834,_0x56c180){return db['VoiceRecording']['create'](_0x486834['body'],{})[_0xcb5c('0x28')](respondWithResult(_0x56c180,0xc9))[_0xcb5c('0x4b')](handleError(_0x56c180,null));};exports['update']=function(_0x210a98,_0x44b872){if(_0x210a98[_0xcb5c('0x4d')]['id']){delete _0x210a98[_0xcb5c('0x4d')]['id'];}return db[_0xcb5c('0x2c')]['find']({'where':{'id':_0x210a98[_0xcb5c('0x47')]['id']}})[_0xcb5c('0x28')](handleEntityNotFound(_0x44b872,null))[_0xcb5c('0x28')](saveUpdates(_0x210a98['body'],null))[_0xcb5c('0x28')](respondWithResult(_0x44b872,null))[_0xcb5c('0x4b')](handleError(_0x44b872,null));};exports[_0xcb5c('0x4e')]=function(_0x48ff6f,_0xfccca){return db[_0xcb5c('0x2c')][_0xcb5c('0x4e')]()[_0xcb5c('0x28')](respondWithResult(_0xfccca,null))[_0xcb5c('0x4b')](handleError(_0xfccca,null));};exports[_0xcb5c('0x4f')]=function(_0x2b6c71,_0x7004ab,_0x4796d2){var _0x57fe22=require('../../components/encryptor');var _0x347d33=![];var _0x4ad255={};if(_0x2b6c71[_0xcb5c('0x33')][_0xcb5c('0x3f')]&&_0x2b6c71[_0xcb5c('0x33')]['type']===_0xcb5c('0x50')){_0x4ad255[_0xcb5c('0x50')]=_0x2b6c71['params']['id'];}else{_0x4ad255['id']=_0x2b6c71[_0xcb5c('0x47')]['id'];}return db[_0xcb5c('0x2c')][_0xcb5c('0x4a')]({'where':_0x4ad255,'attributes':['id',_0xcb5c('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x7004ab,null))[_0xcb5c('0x28')](function(_0x5fad75){if(_0x5fad75){var _0x5658b5=_0x5fad75[_0xcb5c('0x51')];var _0x21c42f=util['format'](_0xcb5c('0x52'),_0x5658b5);if(fs[_0xcb5c('0x53')](_0x21c42f)){_0x347d33=!![];return _0x57fe22[_0xcb5c('0x54')](_0x21c42f,_0x5658b5,config[_0xcb5c('0x55')]['recording'])['then'](function(){return _0x5fad75;});}return _0x5fad75;}})[_0xcb5c('0x28')](function(_0x537a6f){if(_0x537a6f){var _0x7c4522=_0x537a6f[_0xcb5c('0x51')];if(!fs['existsSync'](_0x7c4522)){throw new db[(_0xcb5c('0x56'))]['ValidationError'](_0xcb5c('0x57'));}if(_0x537a6f['filename']){return _0x7004ab['download'](_0x7c4522,_0x537a6f[_0xcb5c('0x58')]+path['extname'](_0x7c4522),function(){if(_0x347d33){fs[_0xcb5c('0x59')](_0x7c4522);}});}else{return _0x7004ab[_0xcb5c('0x4f')](_0x7c4522,function(_0x461bb5){if(_0x347d33){fs['unlink'](_0x7c4522);}});}}})[_0xcb5c('0x4b')](function(_0x41e525){if(_0x41e525[_0xcb5c('0x5a')]==='VoiceRecording\x20not\x20found'){_0x7004ab[_0xcb5c('0x1c')](0x194)['send'](_0xcb5c('0x5b'));}else{return handleError(_0x7004ab,null);}});};exports['downloads']=function(_0x5abc8b,_0x4e54ae,_0x1f8311){var _0x2fad70=require(_0xcb5c('0x5c'));var _0x1d8bcc=![];var _0x2fbe34={'$and':[db[_0xcb5c('0x5d')][_0xcb5c('0x3c')](db[_0xcb5c('0x5d')]['fn'](_0xcb5c('0x5e'),db[_0xcb5c('0x5d')][_0xcb5c('0x5f')](_0xcb5c('0x50'))),_0x5abc8b[_0xcb5c('0x33')][_0xcb5c('0x60')])]};if(_0x5abc8b[_0xcb5c('0x33')][_0xcb5c('0x3f')]&&_0x5abc8b[_0xcb5c('0x33')][_0xcb5c('0x3f')]===_0xcb5c('0x50')){_0x2fbe34[_0xcb5c('0x61')][_0xcb5c('0x62')]({'uniqueid':_0x5abc8b[_0xcb5c('0x47')]['id']});}else{_0x2fbe34[_0xcb5c('0x61')][_0xcb5c('0x62')]({'id':_0x5abc8b[_0xcb5c('0x47')]['id']});}return db['VoiceRecording']['find']({'where':_0x2fbe34,'attributes':['id',_0xcb5c('0x51')],'raw':!![]})[_0xcb5c('0x28')](handleEntityNotFound(_0x4e54ae,null))['then'](function(_0x5ea006){if(_0x5ea006){var _0x2ce4ff=util['format'](_0xcb5c('0x52'),_0x5ea006[_0xcb5c('0x51')]);if(fs['existsSync'](_0x2ce4ff)){_0x1d8bcc=!![];return _0x2fad70[_0xcb5c('0x54')](_0x2ce4ff,_0x5ea006['value'],config[_0xcb5c('0x55')][_0xcb5c('0x63')])[_0xcb5c('0x28')](function(){return _0x5ea006;});}return _0x5ea006;}})[_0xcb5c('0x28')](function(_0x522e78){if(_0x522e78){if(!fs[_0xcb5c('0x53')](_0x522e78[_0xcb5c('0x51')])){throw new db[(_0xcb5c('0x56'))][(_0xcb5c('0x64'))](_0xcb5c('0x57'));}if(_0x522e78[_0xcb5c('0x58')]){return _0x4e54ae['download'](_0x522e78[_0xcb5c('0x51')],_0x522e78[_0xcb5c('0x58')]+path[_0xcb5c('0x65')](_0x522e78['value']),function(){if(_0x1d8bcc){fs[_0xcb5c('0x59')](_0x522e78[_0xcb5c('0x51')]);}});}else{return _0x4e54ae[_0xcb5c('0x4f')](_0x522e78[_0xcb5c('0x51')],function(_0x41575f){if(_0x1d8bcc){fs[_0xcb5c('0x59')](_0x522e78[_0xcb5c('0x51')]);}});}}})['catch'](handleError(_0x4e54ae,null));};exports['destroy']=function(_0x1848a1,_0x579da7){return db[_0xcb5c('0x2c')][_0xcb5c('0x4a')]({'where':{'id':_0x1848a1[_0xcb5c('0x47')]['id']}})['then'](function(_0x312433){if(_[_0xcb5c('0x66')](_0x312433)){throw new ReferenceError(_0xcb5c('0x67'));}return _0x312433;})[_0xcb5c('0x28')](function(_0x56efc3){var _0x37d9bf=_0x56efc3['value'];logger[_0xcb5c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x37d9bf);if(!_[_0xcb5c('0x66')](_0x56efc3[_0xcb5c('0x51')])&&fs[_0xcb5c('0x53')](_0x37d9bf)){logger['info'](_0xcb5c('0x69')+_0x37d9bf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcb5c('0x6a')](_0x37d9bf);}_0x37d9bf=_0x37d9bf+_0xcb5c('0x6b');if(!_[_0xcb5c('0x66')](_0x56efc3['value'])&&fs[_0xcb5c('0x53')](_0x37d9bf)){logger[_0xcb5c('0x68')](_0xcb5c('0x69')+_0x37d9bf+_0xcb5c('0x6c'));fs[_0xcb5c('0x6a')](_0x37d9bf);}return _0x56efc3;})['then'](function(_0x2cbe5b){if(!_0x2cbe5b)throw new InternalError();return _0x2cbe5b['destroy']();})[_0xcb5c('0x28')](function(){_0x579da7['status'](0xcc)[_0xcb5c('0x1d')]();})['catch'](handleError(_0x579da7,null));};function getBucketslist(_0x108d1e,_0x25187c,_0x1d9610){return new Promise(function(_0xf436b,_0x2cf592){var _0x1d919d=new AWS['S3']({'accessKeyId':_0x25187c,'secretAccessKey':_0x108d1e,'region':_0x1d9610});_0x1d919d[_0xcb5c('0x6d')]({},function(_0x2e6541,_0x25834d){if(_0x2e6541){return _0x2cf592(_0x2e6541);}else{return _0xf436b(_0x25834d);}});});}function createBucket(_0x575821,_0x422af6,_0x513abe,_0x5c9302){return new Promise(function(_0x50ebca,_0x2cc334){var _0x19a5cd=new AWS['S3']({'accessKeyId':_0x422af6,'secretAccessKey':_0x575821,'region':_0x513abe});_0x19a5cd['createBucket']({'Bucket':_0x5c9302},function(_0x3ee748,_0x2061e4){if(_0x3ee748){return _0x2cc334(_0x3ee748);}else{return _0x50ebca(_0x2061e4);}});});}function uploadFile(_0x9f9be8,_0x156a28,_0x441414,_0x1425a4,_0x1660c4,_0x4aa434){return new Promise(function(_0x3a61b8,_0x5d1857){var _0x49ea6c=new AWS['S3']({'accessKeyId':_0x156a28,'secretAccessKey':_0x9f9be8,'region':_0x441414});_0x49ea6c[_0xcb5c('0x6e')]({'Bucket':_0x1425a4,'Key':_0x1660c4,'Body':_0x4aa434},function(_0x30f95a,_0x8dc961){if(_0x30f95a){return _0x5d1857(_0x30f95a);}else{return _0x3a61b8(_0x8dc961);}});});}function startTranscribe(_0x451351,_0x2c8967,_0x2a263d,_0x223a94,_0x22b5eb,_0x13cc01){return new Promise(function(_0x3acea7,_0x2c52d5){var _0x3f29e9=new AWS[(_0xcb5c('0x6f'))]({'accessKeyId':_0x2c8967,'secretAccessKey':_0x451351,'region':_0x2a263d});_0x3f29e9[_0xcb5c('0x70')]({'TranscriptionJobName':_0x223a94,'LanguageCode':_0x22b5eb,'Media':{'MediaFileUri':_0x13cc01}},function(_0x59584f,_0x343b2b){if(_0x59584f){return _0x2c52d5(_0x59584f);}else{return _0x3acea7(_0x343b2b);}});});}function transcribe(_0x1d1075,_0x5c0284,_0x1a38bf,_0x5e8af7,_0x3d3003,_0x5db6b8,_0x2e746c){return new Promise(function(_0x2bac06,_0x2cdd8c){var _0x300757={};logger[_0xcb5c('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1d1075,_0x3d3003));return uploadFile(_0x5c0284,_0x1a38bf,_0x5e8af7,_0x3d3003,path['basename'](_0x5db6b8),fs[_0xcb5c('0x71')](_0x5db6b8))[_0xcb5c('0x28')](function(_0x3c9a28){logger[_0xcb5c('0x68')](util[_0xcb5c('0x32')](_0xcb5c('0x72'),_0x1d1075,_0x3d3003,_0x3c9a28[_0xcb5c('0x73')]));_0x300757[_0xcb5c('0x74')]=_0x3c9a28['Bucket'];_0x300757[_0xcb5c('0x75')]=_0x3c9a28[_0xcb5c('0x73')];logger[_0xcb5c('0x68')](util[_0xcb5c('0x32')](_0xcb5c('0x76'),_0x1d1075));return startTranscribe(_0x5c0284,_0x1a38bf,_0x5e8af7,uuidv4(),_0x2e746c,_0x3c9a28[_0xcb5c('0x73')]);})[_0xcb5c('0x28')](function(_0x418fed){logger[_0xcb5c('0x68')](util['format'](_0xcb5c('0x77'),_0x1d1075,_0x418fed[_0xcb5c('0x78')]['TranscriptionJobName']));_0x300757[_0xcb5c('0x79')]=_0x418fed[_0xcb5c('0x78')][_0xcb5c('0x7a')];_0x300757[_0xcb5c('0x7b')]=_0x418fed['TranscriptionJob']['TranscriptionJobStatus'];return _0x2bac06(_0x300757);})[_0xcb5c('0x4b')](function(_0x267439){return _0x2cdd8c(_0x267439);});});}exports[_0xcb5c('0x7c')]=function(_0x5b10a1,_0x117b7d,_0x1015b7){var _0x2d0435;var _0x25ab72;var _0x2607e0;var _0x59b745=require(_0xcb5c('0x5c'));return db['VoiceRecording'][_0xcb5c('0x7d')]({'where':{'id':_0x5b10a1[_0xcb5c('0x47')]['id']}})[_0xcb5c('0x28')](function(_0x18eeb2){if(_0x18eeb2){var _0x1ab112=util[_0xcb5c('0x32')]('%s.cypher',_0x18eeb2['value']);if(fs[_0xcb5c('0x53')](_0x1ab112)){cypher=!![];return _0x59b745[_0xcb5c('0x54')](_0x1ab112,_0x18eeb2['value'],config[_0xcb5c('0x55')]['recording'])[_0xcb5c('0x28')](function(){return _0x18eeb2;});}return _0x18eeb2;}})[_0xcb5c('0x28')](function(_0x253bac){if(!_0x253bac){throw new db[(_0xcb5c('0x56'))][(_0xcb5c('0x64'))]('Voice\x20Recording\x20not\x20found');}_0x25ab72=_0x253bac;return db['Setting'][_0xcb5c('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x117b7d,null))[_0xcb5c('0x28')](function(_0xb4c8d){if(_0xb4c8d){_0x2d0435=_0xb4c8d;if(!_0x2d0435['transcribe']||!_0x2d0435[_0xcb5c('0x7e')]||!_0x2d0435[_0xcb5c('0x7f')]||!_0x2d0435[_0xcb5c('0x80')]||!_0x2d0435[_0xcb5c('0x74')]){throw new db[(_0xcb5c('0x56'))]['ValidationError'](_0xcb5c('0x81'));}if(_0x5b10a1[_0xcb5c('0x4d')]['runSentiment']&&(!_0x2d0435[_0xcb5c('0x82')]||!_0x2d0435[_0xcb5c('0x83')]||!_0x2d0435[_0xcb5c('0x84')]||!_0x2d0435[_0xcb5c('0x80')]||!_0x2d0435[_0xcb5c('0x74')])){throw new db[(_0xcb5c('0x56'))][(_0xcb5c('0x64'))](_0xcb5c('0x85'));}return db[_0xcb5c('0x86')][_0xcb5c('0x7d')]({'where':{'id':_0x2d0435[_0xcb5c('0x7e')]}});}})[_0xcb5c('0x28')](function(_0x10f5b4){if(!_0x10f5b4){throw new db[(_0xcb5c('0x56'))][(_0xcb5c('0x64'))](_0xcb5c('0x87'));}if(!_0x10f5b4[_0xcb5c('0x88')]||!_0x10f5b4[_0xcb5c('0x89')]){throw new db['Sequelize'][(_0xcb5c('0x64'))]('Cloud\x20Provider\x20not\x20configured');}_0x2607e0=_0x10f5b4;return getBucketslist(_0x2607e0['data1'],_0x2607e0[_0xcb5c('0x89')],_0x2d0435[_0xcb5c('0x7f')]);})['then'](function(_0x412027){if(_0x412027&&_0x412027[_0xcb5c('0x8a')]){var _0x4444e4=_[_0xcb5c('0x4a')](_0x412027['Buckets'],function(_0x2d1be3){return _0x2d1be3[_0xcb5c('0x8b')]===_0x2d0435[_0xcb5c('0x74')];});if(!_0x4444e4){logger[_0xcb5c('0x68')](util['format'](_0xcb5c('0x8c'),_0x5b10a1[_0xcb5c('0x47')]['id'],_0x2d0435[_0xcb5c('0x74')]));return createBucket(_0x2607e0[_0xcb5c('0x88')],_0x2607e0[_0xcb5c('0x89')],_0x2d0435[_0xcb5c('0x7f')],_0x2d0435['bucket']);}logger[_0xcb5c('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5b10a1['params']['id'],_0x2d0435[_0xcb5c('0x74')]));return;}})[_0xcb5c('0x28')](function(_0x2cc7dd){if(_0x25ab72['transcribeStatus']==='NEW'){return transcribe(_0x5b10a1[_0xcb5c('0x47')]['id'],_0x2607e0[_0xcb5c('0x88')],_0x2607e0[_0xcb5c('0x89')],_0x2d0435[_0xcb5c('0x7f')],_0x2d0435['bucket'],_0x25ab72[_0xcb5c('0x51')],_0x2d0435[_0xcb5c('0x80')]);}else{logger['info'](util[_0xcb5c('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5b10a1[_0xcb5c('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xcb5c('0x28')](function(_0x2ded9f){if(_0x2ded9f){_0x2ded9f[_0xcb5c('0x8d')]=_0x5b10a1[_0xcb5c('0x4d')][_0xcb5c('0x8e')];return _0x25ab72[_0xcb5c('0x8f')](_0x2ded9f);}})[_0xcb5c('0x28')](respondWithResult(_0x117b7d,null))[_0xcb5c('0x4b')](handleError(_0x117b7d,null));};function writeFile(_0x34ff24,_0x251c26){return new Promise(function(_0x36c2c1,_0xab6845){fs[_0xcb5c('0x90')](_0x251c26,_0x34ff24,function(_0xbe01a0,_0x64f442){if(_0xbe01a0){return _0xab6845(_0xbe01a0);}else{return _0x36c2c1(_0x64f442);}});});}exports[_0xcb5c('0x91')]=function(_0x2a64be,_0x502d1a,_0x3bea6e){return db['VoiceRecording'][_0xcb5c('0x7d')]({'where':{'id':_0x2a64be[_0xcb5c('0x47')]['id']}})[_0xcb5c('0x28')](handleEntityNotFound(_0x502d1a))[_0xcb5c('0x28')](function(_0x4e79f6){if(_0x4e79f6&&_0x4e79f6[_0xcb5c('0x92')]){var _0x1dc0a8=_0x4e79f6['fileText'];var _0x5eef96=config['root']+'/server/files/transcribes/transcribe_'+_0x4e79f6['id']+'.txt';if(fs[_0xcb5c('0x53')](_0x5eef96)){return _0x5eef96;}return writeFile(_0x1dc0a8,_0x5eef96)[_0xcb5c('0x28')](function(){return _0x5eef96;});}else{throw new db[(_0xcb5c('0x56'))][(_0xcb5c('0x64'))](_0xcb5c('0x93'));}})[_0xcb5c('0x28')](function(_0x3f8d2f){return _0x502d1a[_0xcb5c('0x4f')](_0x3f8d2f);})[_0xcb5c('0x4b')](handleError(_0x502d1a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index bcd96ea..523819c 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 _0x8aaf=['./voiceRecording.attributes','exports','VoiceRecording','uniqueid','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x50f9ab,_0x5009b4){var _0x58dda4=function(_0x5f1ff5){while(--_0x5f1ff5){_0x50f9ab['push'](_0x50f9ab['shift']());}};_0x58dda4(++_0x5009b4);}(_0x8aaf,0x93));var _0xf8aa=function(_0x36872e,_0x2d6446){_0x36872e=_0x36872e-0x0;var _0x57195e=_0x8aaf[_0x36872e];return _0x57195e;};'use strict';var _=require(_0xf8aa('0x0'));var util=require(_0xf8aa('0x1'));var logger=require('../../config/logger')(_0xf8aa('0x2'));var moment=require(_0xf8aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xf8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8aa('0x5'));var config=require(_0xf8aa('0x6'));var attributes=require(_0xf8aa('0x7'));module[_0xf8aa('0x8')]=function(_0x380d6e,_0x17e813){return _0x380d6e['define'](_0xf8aa('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf8aa('0xa'),'fields':[_0xf8aa('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8cc=['uniqueid','api','moment','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x666cc6,_0x53441b){var _0x4e6d1d=function(_0x1b26bb){while(--_0x1b26bb){_0x666cc6['push'](_0x666cc6['shift']());}};_0x4e6d1d(++_0x53441b);}(_0xe8cc,0x1cd));var _0xce8c=function(_0x1a1ad0,_0x4007da){_0x1a1ad0=_0x1a1ad0-0x0;var _0x2eaced=_0xe8cc[_0x1a1ad0];return _0x2eaced;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xce8c('0x0'));var moment=require(_0xce8c('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce8c('0x2'));var rimraf=require(_0xce8c('0x3'));var config=require('../../config/environment');var attributes=require(_0xce8c('0x4'));module[_0xce8c('0x5')]=function(_0x37f823,_0x5b2285){return _0x37f823[_0xce8c('0x6')](_0xce8c('0x7'),attributes,{'tableName':_0xce8c('0x8'),'paranoid':![],'indexes':[{'name':_0xce8c('0x9'),'fields':[_0xce8c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e1e37a1..5abba26 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 _0x955f=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','raw','where','attributes','limit','debug','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird'];(function(_0x5c46db,_0x462b20){var _0x19bb73=function(_0x15c33c){while(--_0x15c33c){_0x5c46db['push'](_0x5c46db['shift']());}};_0x19bb73(++_0x462b20);}(_0x955f,0x1eb));var _0xf955=function(_0x11e6e8,_0x5e3344){_0x11e6e8=_0x11e6e8-0x0;var _0xb8c472=_0x955f[_0x11e6e8];return _0xb8c472;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['UpdateVoiceRecording']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['VoiceRecording'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x19')]||null:null,'attributes':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb['options'][_0xf955('0x1a')]||null:null,'limit':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x1b')]||null:null})[_0xf955('0xb')](function(_0xa4ebb4){logger[_0xf955('0xc')]('UpdateVoiceRecording',_0x5ac6cb);logger[_0xf955('0x1c')](_0xf955('0x1d'),_0x5ac6cb,JSON[_0xf955('0x10')](_0xa4ebb4));_0xe6de5c(_0xa4ebb4);})[_0xf955('0x14')](function(_0x17dec2){logger[_0xf955('0x11')](_0xf955('0x1d'),_0x17dec2['message'],_0x5ac6cb);_0x3c49c0(_0x1e20d1[_0xf955('0x11')](0x1f4,_0x17dec2[_0xf955('0x12')]));});});};exports[_0xf955('0x1e')]=function(_0x406632){var _0x2dcd55=this;return new Promise(function(_0x13a86d,_0x3796f7){var _0x51f3ab=require(_0xf955('0x1f'));var _0x145098;return db[_0xf955('0x20')][_0xf955('0x21')]({'attributes':['id',_0xf955('0x22')],'where':{'id':0x1},'raw':!![]})[_0xf955('0xb')](function(_0x4d4af0){_0x145098=_0x4d4af0;return db[_0xf955('0x23')][_0xf955('0x24')](_0x406632['body']);})[_0xf955('0xb')](function(_0x2c8df1){if(_0x145098[_0xf955('0x22')]&&fs[_0xf955('0x25')](_0x2c8df1['value'])){var _0x3a951c=util['format'](_0xf955('0x26'),_0x2c8df1[_0xf955('0x27')]);return _0x51f3ab[_0xf955('0x28')](_0x2c8df1[_0xf955('0x27')],_0x3a951c,config[_0xf955('0x29')][_0xf955('0x2a')])[_0xf955('0xb')](function(){fs[_0xf955('0x2b')](_0x2c8df1['value']);logger[_0xf955('0xc')](_0xf955('0x2c'));return _0x2c8df1;});}return _0x2c8df1;})[_0xf955('0xb')](function(_0x2046c8){logger['info'](_0xf955('0x1e'),_0x406632);logger[_0xf955('0x1c')](_0xf955('0x1e'),_0x406632,JSON[_0xf955('0x10')](_0x2046c8));_0x13a86d(_0x2046c8);})[_0xf955('0x14')](function(_0x4eb2c3){logger['error']('CreateVoiceRecording',_0x4eb2c3[_0xf955('0x12')],_0x406632);_0x3796f7(_0x2dcd55[_0xf955('0x11')](0x1f4,_0x4eb2c3[_0xf955('0x12')]));});});}; \ No newline at end of file +var _0xfcf0=['request\x20sent','stringify','error','message','result','UpdateVoiceRecording','update','body','options','attributes','limit','then','catch','../../components/encryptor','findOne','callRecordingEncryption','existsSync','format','%s.cypher','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcf0,0x138));var _0x0fcf=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0xfcf0[_0x592df4];return _0x3b4fe4;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['VoiceRecording'][_0x0fcf('0x16')](_0x19cfbd[_0x0fcf('0x17')],{'raw':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19cfbd[_0x0fcf('0x18')]?_0x19cfbd[_0x0fcf('0x18')]['where']||null:null,'attributes':_0x19cfbd[_0x0fcf('0x18')]?_0x19cfbd[_0x0fcf('0x18')][_0x0fcf('0x19')]||null:null,'limit':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x18')][_0x0fcf('0x1a')]||null:null})[_0x0fcf('0x1b')](function(_0x41b20b){logger[_0x0fcf('0xd')](_0x0fcf('0x15'),_0x19cfbd);logger['debug'](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x41b20b));_0x18ea32(_0x41b20b);})[_0x0fcf('0x1c')](function(_0xd6f8b5){logger[_0x0fcf('0x12')](_0x0fcf('0x15'),_0xd6f8b5[_0x0fcf('0x13')],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0xd6f8b5[_0x0fcf('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x18965e){var _0xc107a=this;return new Promise(function(_0x41b7a2,_0x2f198b){var _0x3876ed=require(_0x0fcf('0x1d'));var _0x2730b0;return db['Setting'][_0x0fcf('0x1e')]({'attributes':['id',_0x0fcf('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x0fcf('0x1b')](function(_0x35180d){_0x2730b0=_0x35180d;return db['VoiceRecording']['create'](_0x18965e['body']);})[_0x0fcf('0x1b')](function(_0x50b7df){if(_0x2730b0[_0x0fcf('0x1f')]&&fs[_0x0fcf('0x20')](_0x50b7df['value'])){var _0xdfd3ec=util[_0x0fcf('0x21')](_0x0fcf('0x22'),_0x50b7df[_0x0fcf('0x23')]);return _0x3876ed[_0x0fcf('0x24')](_0x50b7df[_0x0fcf('0x23')],_0xdfd3ec,config['secrets'][_0x0fcf('0x25')])[_0x0fcf('0x1b')](function(){fs[_0x0fcf('0x26')](_0x50b7df[_0x0fcf('0x23')]);logger[_0x0fcf('0xd')](_0x0fcf('0x27'));return _0x50b7df;});}return _0x50b7df;})['then'](function(_0x208433){logger[_0x0fcf('0xd')](_0x0fcf('0x28'),_0x18965e);logger[_0x0fcf('0xf')](_0x0fcf('0x28'),_0x18965e,JSON[_0x0fcf('0x11')](_0x208433));_0x41b7a2(_0x208433);})[_0x0fcf('0x1c')](function(_0x344957){logger[_0x0fcf('0x12')](_0x0fcf('0x28'),_0x344957[_0x0fcf('0x13')],_0x18965e);_0x2f198b(_0xc107a[_0x0fcf('0x12')](0x1f4,_0x344957[_0x0fcf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d235a4c..0927068 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 _0x4e2d=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','describe','isAuthenticated','show','create','/:id','update','delete'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0x4e2d,0x17d));var _0xd4e2=function(_0x5eeb31,_0x313290){_0x5eeb31=_0x5eeb31-0x0;var _0x479131=_0x4e2d[_0x5eeb31];return _0x479131;};'use strict';var multer=require(_0xd4e2('0x0'));var util=require(_0xd4e2('0x1'));var path=require('path');var timeout=require(_0xd4e2('0x2'));var express=require('express');var router=express[_0xd4e2('0x3')]();var fs_extra=require(_0xd4e2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd4e2('0x5'));var config=require(_0xd4e2('0x6'));var controller=require(_0xd4e2('0x7'));router[_0xd4e2('0x8')]('/',auth['isAuthenticated'](),controller[_0xd4e2('0x9')]);router[_0xd4e2('0x8')](_0xd4e2('0xa'),auth['isAuthenticated'](),controller[_0xd4e2('0xb')]);router[_0xd4e2('0x8')]('/:id',auth[_0xd4e2('0xc')](),controller[_0xd4e2('0xd')]);router['post']('/',auth[_0xd4e2('0xc')](),controller[_0xd4e2('0xe')]);router['put'](_0xd4e2('0xf'),auth['isAuthenticated'](),controller[_0xd4e2('0x10')]);router[_0xd4e2('0x11')]('/:id',auth[_0xd4e2('0xc')](),controller['destroy']);module[_0xd4e2('0x12')]=router; \ No newline at end of file +var _0x5636=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x40738a,_0x1b8aee){var _0x1ac531=function(_0x42cdef){while(--_0x42cdef){_0x40738a['push'](_0x40738a['shift']());}};_0x1ac531(++_0x1b8aee);}(_0x5636,0x1b2));var _0x6563=function(_0x39427a,_0x579faa){_0x39427a=_0x39427a-0x0;var _0x15251e=_0x5636[_0x39427a];return _0x15251e;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require(_0x6563('0x2'));var timeout=require(_0x6563('0x3'));var express=require(_0x6563('0x4'));var router=express[_0x6563('0x5')]();var fs_extra=require(_0x6563('0x6'));var auth=require(_0x6563('0x7'));var interaction=require(_0x6563('0x8'));var config=require(_0x6563('0x9'));var controller=require(_0x6563('0xa'));router[_0x6563('0xb')]('/',auth[_0x6563('0xc')](),controller[_0x6563('0xd')]);router[_0x6563('0xb')](_0x6563('0xe'),auth[_0x6563('0xc')](),controller[_0x6563('0xf')]);router[_0x6563('0xb')](_0x6563('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x6563('0x11')]('/',auth[_0x6563('0xc')](),controller[_0x6563('0x12')]);router[_0x6563('0x13')](_0x6563('0x10'),auth[_0x6563('0xc')](),controller['update']);router[_0x6563('0x14')](_0x6563('0x10'),auth[_0x6563('0xc')](),controller['destroy']);module[_0x6563('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 03de6a5..e87ac30 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 _0x8504=['blind','attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x7dad80,_0x5aa23f){var _0x2d9b68=function(_0x37aa85){while(--_0x37aa85){_0x7dad80['push'](_0x7dad80['shift']());}};_0x2d9b68(++_0x5aa23f);}(_0x8504,0xac));var _0x4850=function(_0x295849,_0x42b3eb){_0x295849=_0x295849-0x0;var _0x27d8d4=_0x8504[_0x295849];return _0x27d8d4;};'use strict';var Sequelize=require(_0x4850('0x0'));var moment=require('moment');module[_0x4850('0x1')]={'type':{'type':Sequelize[_0x4850('0x2')](_0x4850('0x3'),_0x4850('0x4'))},'result':{'type':Sequelize[_0x4850('0x5')]},'transfererchannel':{'type':Sequelize[_0x4850('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x4850('0x5')]},'transferercalleridname':{'type':Sequelize[_0x4850('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4850('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x4850('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x4850('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x4850('0x5')]},'transfereechannel':{'type':Sequelize[_0x4850('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x4850('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x4850('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x4850('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x4850('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x4850('0x5')]},'transfereecontext':{'type':Sequelize[_0x4850('0x5')]},'transfereeexten':{'type':Sequelize[_0x4850('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x4850('0x5')]},'isexternal':{'type':Sequelize[_0x4850('0x2')](_0x4850('0x6'),'No')},'context':{'type':Sequelize[_0x4850('0x5')]},'extension':{'type':Sequelize[_0x4850('0x5')]}}; \ No newline at end of file +var _0x9ee7=['blind','STRING','Yes','sequelize','moment','exports'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0x9ee7,0xab));var _0x79ee=function(_0x30b710,_0x4477d1){_0x30b710=_0x30b710-0x0;var _0x205edf=_0x9ee7[_0x30b710];return _0x205edf;};'use strict';var Sequelize=require(_0x79ee('0x0'));var moment=require(_0x79ee('0x1'));module[_0x79ee('0x2')]={'type':{'type':Sequelize['ENUM'](_0x79ee('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x79ee('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x79ee('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x79ee('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x79ee('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x79ee('0x4')]},'transfereechannel':{'type':Sequelize[_0x79ee('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x79ee('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x79ee('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x79ee('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x79ee('0x4')]},'transfereeexten':{'type':Sequelize[_0x79ee('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x79ee('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x79ee('0x5'),'No')},'context':{'type':Sequelize[_0x79ee('0x4')]},'extension':{'type':Sequelize[_0x79ee('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5ecc820..a3b79fe 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 _0x3658=['model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','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','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','type','query','filters','intersection'];(function(_0x1758dc,_0x2a24a8){var _0x4ba456=function(_0x197ec8){while(--_0x197ec8){_0x1758dc['push'](_0x1758dc['shift']());}};_0x4ba456(++_0x2a24a8);}(_0x3658,0xec));var _0x8365=function(_0x11c2e8,_0x3fa2bd){_0x11c2e8=_0x11c2e8-0x0;var _0xf53160=_0x3658[_0x11c2e8];return _0xf53160;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8365('0x0'));var zipdir=require(_0x8365('0x1'));var jsonpatch=require(_0x8365('0x2'));var rp=require(_0x8365('0x3'));var moment=require('moment');var BPromise=require(_0x8365('0x4'));var Mustache=require(_0x8365('0x5'));var util=require('util');var path=require(_0x8365('0x6'));var sox=require('sox');var csv=require(_0x8365('0x7'));var ejs=require(_0x8365('0x8'));var fs=require('fs');var fs_extra=require(_0x8365('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8365('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8365('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8365('0xc'));var Papa=require('papaparse');var Redis=require(_0x8365('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8365('0xe'));var as=require(_0x8365('0xf'));var hardwareService=require(_0x8365('0x10'));var logger=require(_0x8365('0x11'))(_0x8365('0x12'));var utils=require(_0x8365('0x13'));var config=require(_0x8365('0x14'));var licenseUtil=require(_0x8365('0x15'));var db=require(_0x8365('0x16'))['db'];function respondWithStatusCode(_0x36ee4f,_0x353111){_0x353111=_0x353111||0xcc;return function(_0x3076bc){if(_0x3076bc){return _0x36ee4f[_0x8365('0x17')](_0x353111);}return _0x36ee4f[_0x8365('0x18')](_0x353111)['end']();};}function respondWithResult(_0x1e7ed0,_0x1eaf01){_0x1eaf01=_0x1eaf01||0xc8;return function(_0x34d1bc){if(_0x34d1bc){return _0x1e7ed0[_0x8365('0x18')](_0x1eaf01)[_0x8365('0x19')](_0x34d1bc);}};}function respondWithFilteredResult(_0x7e13ed,_0x20fe7a){return function(_0x41037e){if(_0x41037e){var _0x6cac83=typeof _0x20fe7a[_0x8365('0x1a')]==='undefined'&&typeof _0x20fe7a['limit']===_0x8365('0x1b');var _0x939973=_0x41037e[_0x8365('0x1c')];var _0x333d21=_0x6cac83?0x0:_0x20fe7a[_0x8365('0x1a')];var _0x5c761a=_0x6cac83?_0x41037e[_0x8365('0x1c')]:_0x20fe7a[_0x8365('0x1a')]+_0x20fe7a[_0x8365('0x1d')];var _0x12f82c;if(_0x5c761a>=_0x939973){_0x5c761a=_0x939973;_0x12f82c=0xc8;}else{_0x12f82c=0xce;}_0x7e13ed[_0x8365('0x18')](_0x12f82c);return _0x7e13ed[_0x8365('0x1e')](_0x8365('0x1f'),_0x333d21+'-'+_0x5c761a+'/'+_0x939973)[_0x8365('0x19')](_0x41037e);}return null;};}function patchUpdates(_0xaf0b8){return function(_0x1d1140){try{jsonpatch[_0x8365('0x20')](_0x1d1140,_0xaf0b8,!![]);}catch(_0x223ec4){return BPromise[_0x8365('0x21')](_0x223ec4);}return _0x1d1140[_0x8365('0x22')]();};}function saveUpdates(_0x419cb5,_0x1bb1dc){return function(_0x3ab0e5){if(_0x3ab0e5){return _0x3ab0e5['update'](_0x419cb5)[_0x8365('0x23')](function(_0x4f6215){return _0x4f6215;});}return null;};}function removeEntity(_0x171909,_0x461b5e){return function(_0x3c67a2){if(_0x3c67a2){return _0x3c67a2[_0x8365('0x24')]()['then'](function(){_0x171909[_0x8365('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e70dd,_0x29ad5b){return function(_0x504832){if(!_0x504832){_0x4e70dd[_0x8365('0x17')](0x194);}return _0x504832;};}function handleError(_0x25c151,_0x1fde3d){_0x1fde3d=_0x1fde3d||0x1f4;return function(_0x1f2aac){logger[_0x8365('0x25')](_0x1f2aac['stack']);if(_0x1f2aac['name']){delete _0x1f2aac[_0x8365('0x26')];}_0x25c151[_0x8365('0x18')](_0x1fde3d)[_0x8365('0x27')](_0x1f2aac);};}exports[_0x8365('0x28')]=function(_0x30bc42,_0x220c9a){var _0xf62c1a={},_0xeccaa7={},_0x3c71cb={'count':0x0,'rows':[]};var _0x2ddf42=_[_0x8365('0x29')](db[_0x8365('0x2a')][_0x8365('0x2b')],function(_0x4ac158){return{'name':_0x4ac158['fieldName'],'type':_0x4ac158[_0x8365('0x2c')]['key']};});_0xeccaa7['model']=_['map'](_0x2ddf42,_0x8365('0x26'));_0xeccaa7[_0x8365('0x2d')]=_['keys'](_0x30bc42[_0x8365('0x2d')]);_0xeccaa7[_0x8365('0x2e')]=_[_0x8365('0x2f')](_0xeccaa7[_0x8365('0x30')],_0xeccaa7[_0x8365('0x2d')]);_0xf62c1a['attributes']=_[_0x8365('0x2f')](_0xeccaa7[_0x8365('0x30')],qs[_0x8365('0x31')](_0x30bc42[_0x8365('0x2d')][_0x8365('0x31')]));_0xf62c1a[_0x8365('0x32')]=_0xf62c1a['attributes'][_0x8365('0x33')]?_0xf62c1a[_0x8365('0x32')]:_0xeccaa7['model'];if(!_0x30bc42['query'][_0x8365('0x34')](_0x8365('0x35'))){_0xf62c1a[_0x8365('0x1d')]=qs[_0x8365('0x1d')](_0x30bc42[_0x8365('0x2d')]['limit']);_0xf62c1a[_0x8365('0x1a')]=qs[_0x8365('0x1a')](_0x30bc42[_0x8365('0x2d')][_0x8365('0x1a')]);}_0xf62c1a['order']=qs[_0x8365('0x36')](_0x30bc42['query'][_0x8365('0x36')]);_0xf62c1a[_0x8365('0x37')]=qs[_0x8365('0x2e')](_['pick'](_0x30bc42[_0x8365('0x2d')],_0xeccaa7[_0x8365('0x2e')]),_0x2ddf42);if(_0x30bc42['query'][_0x8365('0x38')]){_0xf62c1a[_0x8365('0x37')]=_[_0x8365('0x39')](_0xf62c1a[_0x8365('0x37')],{'$or':_['map'](_0x2ddf42,function(_0x19a0f1){if(_0x19a0f1['type']!=='VIRTUAL'){var _0x2c89ab={};_0x2c89ab[_0x19a0f1[_0x8365('0x26')]]={'$like':'%'+_0x30bc42['query'][_0x8365('0x38')]+'%'};return _0x2c89ab;}})});}_0xf62c1a=_[_0x8365('0x39')]({},_0xf62c1a,_0x30bc42[_0x8365('0x3a')]);var _0x2829c0={'where':_0xf62c1a[_0x8365('0x37')]};return db['VoiceTransferReport'][_0x8365('0x1c')](_0x2829c0)['then'](function(_0x195742){_0x3c71cb[_0x8365('0x1c')]=_0x195742;if(_0x30bc42[_0x8365('0x2d')]['includeAll']){_0xf62c1a[_0x8365('0x3b')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x8365('0x3c')](_0xf62c1a);})[_0x8365('0x23')](function(_0x8e1846){_0x3c71cb[_0x8365('0x3d')]=_0x8e1846;return _0x3c71cb;})['then'](respondWithFilteredResult(_0x220c9a,_0xf62c1a))[_0x8365('0x3e')](handleError(_0x220c9a,null));};exports[_0x8365('0x3f')]=function(_0x381a46,_0x1920c0){var _0x1d8afc={'raw':!![],'where':{'id':_0x381a46[_0x8365('0x40')]['id']}},_0x2e6b00={};_0x2e6b00[_0x8365('0x30')]=_['keys'](db[_0x8365('0x2a')][_0x8365('0x2b')]);_0x2e6b00[_0x8365('0x2d')]=_[_0x8365('0x41')](_0x381a46[_0x8365('0x2d')]);_0x2e6b00['filters']=_[_0x8365('0x2f')](_0x2e6b00[_0x8365('0x30')],_0x2e6b00[_0x8365('0x2d')]);_0x1d8afc[_0x8365('0x32')]=_['intersection'](_0x2e6b00[_0x8365('0x30')],qs[_0x8365('0x31')](_0x381a46[_0x8365('0x2d')][_0x8365('0x31')]));_0x1d8afc['attributes']=_0x1d8afc['attributes']['length']?_0x1d8afc['attributes']:_0x2e6b00[_0x8365('0x30')];if(_0x381a46[_0x8365('0x2d')][_0x8365('0x42')]){_0x1d8afc[_0x8365('0x3b')]=[{'all':!![]}];}_0x1d8afc=_[_0x8365('0x39')]({},_0x1d8afc,_0x381a46[_0x8365('0x3a')]);return db[_0x8365('0x2a')]['find'](_0x1d8afc)[_0x8365('0x23')](handleEntityNotFound(_0x1920c0,null))['then'](respondWithResult(_0x1920c0,null))[_0x8365('0x3e')](handleError(_0x1920c0,null));};exports[_0x8365('0x43')]=function(_0x49e01b,_0x17f554){return db[_0x8365('0x2a')][_0x8365('0x43')](_0x49e01b[_0x8365('0x44')],{})['then'](respondWithResult(_0x17f554,0xc9))[_0x8365('0x3e')](handleError(_0x17f554,null));};exports['update']=function(_0x2b4c3b,_0x464291){if(_0x2b4c3b['body']['id']){delete _0x2b4c3b[_0x8365('0x44')]['id'];}return db[_0x8365('0x2a')]['find']({'where':{'id':_0x2b4c3b['params']['id']}})[_0x8365('0x23')](handleEntityNotFound(_0x464291,null))[_0x8365('0x23')](saveUpdates(_0x2b4c3b[_0x8365('0x44')],null))['then'](respondWithResult(_0x464291,null))[_0x8365('0x3e')](handleError(_0x464291,null));};exports[_0x8365('0x24')]=function(_0x3a391e,_0x53a049){return db['VoiceTransferReport'][_0x8365('0x45')]({'where':{'id':_0x3a391e[_0x8365('0x40')]['id']}})[_0x8365('0x23')](handleEntityNotFound(_0x53a049,null))['then'](removeEntity(_0x53a049,null))[_0x8365('0x3e')](handleError(_0x53a049,null));};exports['describe']=function(_0x35fd0d,_0x1f78d0){return db[_0x8365('0x2a')][_0x8365('0x46')]()['then'](respondWithResult(_0x1f78d0,null))['catch'](handleError(_0x1f78d0,null));}; \ No newline at end of file +var _0xeccb=['attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','fields','length','includeAll','include','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection'];(function(_0x4bc812,_0x5b0784){var _0x3dd703=function(_0x5ded5e){while(--_0x5ded5e){_0x4bc812['push'](_0x4bc812['shift']());}};_0x3dd703(++_0x5b0784);}(_0xeccb,0xf4));var _0xbecc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xeccb[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xbecc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbecc('0x1'));var jsonpatch=require(_0xbecc('0x2'));var rp=require(_0xbecc('0x3'));var moment=require('moment');var BPromise=require(_0xbecc('0x4'));var Mustache=require(_0xbecc('0x5'));var util=require(_0xbecc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbecc('0x7'));var ejs=require(_0xbecc('0x8'));var fs=require('fs');var fs_extra=require(_0xbecc('0x9'));var _=require(_0xbecc('0xa'));var squel=require(_0xbecc('0xb'));var crypto=require(_0xbecc('0xc'));var jsforce=require(_0xbecc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbecc('0xe'));var Papa=require(_0xbecc('0xf'));var Redis=require('ioredis');var authService=require(_0xbecc('0x10'));var qs=require(_0xbecc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbecc('0x12'));var utils=require(_0xbecc('0x13'));var config=require(_0xbecc('0x14'));var licenseUtil=require(_0xbecc('0x15'));var db=require(_0xbecc('0x16'))['db'];function respondWithStatusCode(_0x50fd79,_0x580668){_0x580668=_0x580668||0xcc;return function(_0x95ecae){if(_0x95ecae){return _0x50fd79[_0xbecc('0x17')](_0x580668);}return _0x50fd79[_0xbecc('0x18')](_0x580668)[_0xbecc('0x19')]();};}function respondWithResult(_0x76639f,_0x51ebce){_0x51ebce=_0x51ebce||0xc8;return function(_0x30f8bb){if(_0x30f8bb){return _0x76639f[_0xbecc('0x18')](_0x51ebce)[_0xbecc('0x1a')](_0x30f8bb);}};}function respondWithFilteredResult(_0x2b78b6,_0x1c1957){return function(_0x2416bf){if(_0x2416bf){var _0x2a2efa=typeof _0x1c1957[_0xbecc('0x1b')]===_0xbecc('0x1c')&&typeof _0x1c1957[_0xbecc('0x1d')]==='undefined';var _0x453b94=_0x2416bf[_0xbecc('0x1e')];var _0x584d0e=_0x2a2efa?0x0:_0x1c1957['offset'];var _0x236c33=_0x2a2efa?_0x2416bf[_0xbecc('0x1e')]:_0x1c1957[_0xbecc('0x1b')]+_0x1c1957[_0xbecc('0x1d')];var _0x290b64;if(_0x236c33>=_0x453b94){_0x236c33=_0x453b94;_0x290b64=0xc8;}else{_0x290b64=0xce;}_0x2b78b6[_0xbecc('0x18')](_0x290b64);return _0x2b78b6[_0xbecc('0x1f')](_0xbecc('0x20'),_0x584d0e+'-'+_0x236c33+'/'+_0x453b94)[_0xbecc('0x1a')](_0x2416bf);}return null;};}function patchUpdates(_0x521ed0){return function(_0x132e6){try{jsonpatch[_0xbecc('0x21')](_0x132e6,_0x521ed0,!![]);}catch(_0x12d4b6){return BPromise[_0xbecc('0x22')](_0x12d4b6);}return _0x132e6[_0xbecc('0x23')]();};}function saveUpdates(_0x18eaa8,_0x4b9496){return function(_0x3caff4){if(_0x3caff4){return _0x3caff4[_0xbecc('0x24')](_0x18eaa8)[_0xbecc('0x25')](function(_0x439757){return _0x439757;});}return null;};}function removeEntity(_0x158faf,_0x171b7){return function(_0xe97726){if(_0xe97726){return _0xe97726['destroy']()['then'](function(){_0x158faf[_0xbecc('0x18')](0xcc)[_0xbecc('0x19')]();});}};}function handleEntityNotFound(_0x158675,_0x36c80b){return function(_0x590438){if(!_0x590438){_0x158675[_0xbecc('0x17')](0x194);}return _0x590438;};}function handleError(_0x218e35,_0x449597){_0x449597=_0x449597||0x1f4;return function(_0x26f8f5){logger[_0xbecc('0x26')](_0x26f8f5['stack']);if(_0x26f8f5[_0xbecc('0x27')]){delete _0x26f8f5[_0xbecc('0x27')];}_0x218e35[_0xbecc('0x18')](_0x449597)[_0xbecc('0x28')](_0x26f8f5);};}exports[_0xbecc('0x29')]=function(_0x28af49,_0x5bf9d2){var _0x552311={},_0x379757={},_0x4852e2={'count':0x0,'rows':[]};var _0x1540fd=_[_0xbecc('0x2a')](db[_0xbecc('0x2b')][_0xbecc('0x2c')],function(_0xf559b6){return{'name':_0xf559b6[_0xbecc('0x2d')],'type':_0xf559b6[_0xbecc('0x2e')]['key']};});_0x379757[_0xbecc('0x2f')]=_[_0xbecc('0x2a')](_0x1540fd,'name');_0x379757['query']=_[_0xbecc('0x30')](_0x28af49[_0xbecc('0x31')]);_0x379757[_0xbecc('0x32')]=_[_0xbecc('0x33')](_0x379757['model'],_0x379757['query']);_0x552311[_0xbecc('0x34')]=_[_0xbecc('0x33')](_0x379757['model'],qs['fields'](_0x28af49[_0xbecc('0x31')]['fields']));_0x552311[_0xbecc('0x34')]=_0x552311[_0xbecc('0x34')]['length']?_0x552311[_0xbecc('0x34')]:_0x379757[_0xbecc('0x2f')];if(!_0x28af49[_0xbecc('0x31')]['hasOwnProperty'](_0xbecc('0x35'))){_0x552311[_0xbecc('0x1d')]=qs['limit'](_0x28af49[_0xbecc('0x31')][_0xbecc('0x1d')]);_0x552311[_0xbecc('0x1b')]=qs[_0xbecc('0x1b')](_0x28af49[_0xbecc('0x31')]['offset']);}_0x552311['order']=qs['sort'](_0x28af49[_0xbecc('0x31')][_0xbecc('0x36')]);_0x552311[_0xbecc('0x37')]=qs[_0xbecc('0x32')](_[_0xbecc('0x38')](_0x28af49[_0xbecc('0x31')],_0x379757[_0xbecc('0x32')]),_0x1540fd);if(_0x28af49['query'][_0xbecc('0x39')]){_0x552311['where']=_[_0xbecc('0x3a')](_0x552311['where'],{'$or':_[_0xbecc('0x2a')](_0x1540fd,function(_0x5622a3){if(_0x5622a3[_0xbecc('0x2e')]!==_0xbecc('0x3b')){var _0x3b59e2={};_0x3b59e2[_0x5622a3[_0xbecc('0x27')]]={'$like':'%'+_0x28af49['query'][_0xbecc('0x39')]+'%'};return _0x3b59e2;}})});}_0x552311=_['merge']({},_0x552311,_0x28af49[_0xbecc('0x3c')]);var _0x1ae276={'where':_0x552311[_0xbecc('0x37')]};return db['VoiceTransferReport'][_0xbecc('0x1e')](_0x1ae276)[_0xbecc('0x25')](function(_0x11c17a){_0x4852e2[_0xbecc('0x1e')]=_0x11c17a;if(_0x28af49[_0xbecc('0x31')]['includeAll']){_0x552311['include']=[{'all':!![]}];}return db[_0xbecc('0x2b')][_0xbecc('0x3d')](_0x552311);})[_0xbecc('0x25')](function(_0x19533a){_0x4852e2[_0xbecc('0x3e')]=_0x19533a;return _0x4852e2;})['then'](respondWithFilteredResult(_0x5bf9d2,_0x552311))['catch'](handleError(_0x5bf9d2,null));};exports[_0xbecc('0x3f')]=function(_0x2df2ee,_0x9f166c){var _0x7fcf5b={'raw':!![],'where':{'id':_0x2df2ee[_0xbecc('0x40')]['id']}},_0x485cde={};_0x485cde[_0xbecc('0x2f')]=_['keys'](db[_0xbecc('0x2b')]['rawAttributes']);_0x485cde[_0xbecc('0x31')]=_[_0xbecc('0x30')](_0x2df2ee[_0xbecc('0x31')]);_0x485cde[_0xbecc('0x32')]=_[_0xbecc('0x33')](_0x485cde['model'],_0x485cde['query']);_0x7fcf5b['attributes']=_[_0xbecc('0x33')](_0x485cde['model'],qs[_0xbecc('0x41')](_0x2df2ee[_0xbecc('0x31')]['fields']));_0x7fcf5b[_0xbecc('0x34')]=_0x7fcf5b[_0xbecc('0x34')][_0xbecc('0x42')]?_0x7fcf5b['attributes']:_0x485cde[_0xbecc('0x2f')];if(_0x2df2ee[_0xbecc('0x31')][_0xbecc('0x43')]){_0x7fcf5b[_0xbecc('0x44')]=[{'all':!![]}];}_0x7fcf5b=_['merge']({},_0x7fcf5b,_0x2df2ee[_0xbecc('0x3c')]);return db['VoiceTransferReport'][_0xbecc('0x45')](_0x7fcf5b)[_0xbecc('0x25')](handleEntityNotFound(_0x9f166c,null))['then'](respondWithResult(_0x9f166c,null))[_0xbecc('0x46')](handleError(_0x9f166c,null));};exports[_0xbecc('0x47')]=function(_0x4f5c1f,_0x407143){return db[_0xbecc('0x2b')][_0xbecc('0x47')](_0x4f5c1f[_0xbecc('0x48')],{})['then'](respondWithResult(_0x407143,0xc9))[_0xbecc('0x46')](handleError(_0x407143,null));};exports[_0xbecc('0x24')]=function(_0x18f18f,_0x5ea103){if(_0x18f18f['body']['id']){delete _0x18f18f[_0xbecc('0x48')]['id'];}return db[_0xbecc('0x2b')]['find']({'where':{'id':_0x18f18f[_0xbecc('0x40')]['id']}})[_0xbecc('0x25')](handleEntityNotFound(_0x5ea103,null))[_0xbecc('0x25')](saveUpdates(_0x18f18f[_0xbecc('0x48')],null))[_0xbecc('0x25')](respondWithResult(_0x5ea103,null))['catch'](handleError(_0x5ea103,null));};exports[_0xbecc('0x49')]=function(_0x5b329f,_0x24861f){return db[_0xbecc('0x2b')][_0xbecc('0x45')]({'where':{'id':_0x5b329f['params']['id']}})['then'](handleEntityNotFound(_0x24861f,null))[_0xbecc('0x25')](removeEntity(_0x24861f,null))['catch'](handleError(_0x24861f,null));};exports['describe']=function(_0xf62826,_0x2605db){return db['VoiceTransferReport']['describe']()[_0xbecc('0x25')](respondWithResult(_0x2605db,null))['catch'](handleError(_0x2605db,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d7d19d5..74cf1ce 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 _0x8fe9=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer'];(function(_0x4aeaf4,_0x2625f8){var _0xff1ede=function(_0x48bb55){while(--_0x48bb55){_0x4aeaf4['push'](_0x4aeaf4['shift']());}};_0xff1ede(++_0x2625f8);}(_0x8fe9,0x145));var _0x98fe=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0x8fe9[_0x45c262];return _0x4f2ba6;};'use strict';var _=require(_0x98fe('0x0'));var util=require(_0x98fe('0x1'));var logger=require(_0x98fe('0x2'))(_0x98fe('0x3'));var moment=require('moment');var BPromise=require(_0x98fe('0x4'));var rp=require(_0x98fe('0x5'));var fs=require('fs');var path=require(_0x98fe('0x6'));var rimraf=require(_0x98fe('0x7'));var config=require(_0x98fe('0x8'));var attributes=require(_0x98fe('0x9'));module['exports']=function(_0x47e5ef,_0x545847){return _0x47e5ef[_0x98fe('0xa')](_0x98fe('0xb'),attributes,{'tableName':_0x98fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18e7=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','bluebird','path'];(function(_0xb2f48d,_0x5e0b60){var _0x48af38=function(_0x1bd81f){while(--_0x1bd81f){_0xb2f48d['push'](_0xb2f48d['shift']());}};_0x48af38(++_0x5e0b60);}(_0x18e7,0x193));var _0x718e=function(_0x5c7dad,_0x384cc8){_0x5c7dad=_0x5c7dad-0x0;var _0x45571f=_0x18e7[_0x5c7dad];return _0x45571f;};'use strict';var _=require(_0x718e('0x0'));var util=require(_0x718e('0x1'));var logger=require(_0x718e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x718e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x718e('0x4'));var rimraf=require(_0x718e('0x5'));var config=require(_0x718e('0x6'));var attributes=require(_0x718e('0x7'));module[_0x718e('0x8')]=function(_0x246ebe,_0x4d7e76){return _0x246ebe[_0x718e('0x9')](_0x718e('0xa'),attributes,{'tableName':_0x718e('0xb'),'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 40d6c78..9687b17 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 _0xb549=['message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x34cc5b,_0x16641c){var _0x2a0acd=function(_0xdebf87){while(--_0xdebf87){_0x34cc5b['push'](_0x34cc5b['shift']());}};_0x2a0acd(++_0x16641c);}(_0xb549,0x7c));var _0x9b54=function(_0x4f4c44,_0x540dd8){_0x4f4c44=_0x4f4c44-0x0;var _0x5f17d5=_0xb549[_0x4f4c44];return _0x5f17d5;};'use strict';var _=require(_0x9b54('0x0'));var util=require(_0x9b54('0x1'));var moment=require(_0x9b54('0x2'));var BPromise=require(_0x9b54('0x3'));var rs=require(_0x9b54('0x4'));var fs=require('fs');var Redis=require(_0x9b54('0x5'));var db=require(_0x9b54('0x6'))['db'];var utils=require(_0x9b54('0x7'));var logger=require(_0x9b54('0x8'))(_0x9b54('0x9'));var config=require(_0x9b54('0xa'));var jayson=require(_0x9b54('0xb'));var client=jayson[_0x9b54('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x295584,_0x2e48a3,_0x488cb3){return new BPromise(function(_0x573e31,_0x555bff){return client['request'](_0x295584,_0x488cb3)[_0x9b54('0xd')](function(_0x294535){logger[_0x9b54('0xe')](_0x9b54('0xf'),_0x2e48a3,'request\x20sent');logger[_0x9b54('0x10')](_0x9b54('0x11'),_0x2e48a3,_0x9b54('0x12'),JSON['stringify'](_0x294535));if(_0x294535[_0x9b54('0x13')]){if(_0x294535[_0x9b54('0x13')][_0x9b54('0x14')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x2e48a3,_0x294535[_0x9b54('0x13')][_0x9b54('0x15')]);return _0x555bff(_0x294535[_0x9b54('0x13')][_0x9b54('0x15')]);}logger['error'](_0x9b54('0xf'),_0x2e48a3,_0x294535[_0x9b54('0x13')][_0x9b54('0x15')]);return _0x573e31(_0x294535[_0x9b54('0x13')]['message']);}else{logger['info'](_0x9b54('0xf'),_0x2e48a3,'request\x20sent');_0x573e31(_0x294535[_0x9b54('0x16')][_0x9b54('0x15')]);}})[_0x9b54('0x17')](function(_0x5b5bb5){logger[_0x9b54('0x13')](_0x9b54('0xf'),_0x2e48a3,_0x5b5bb5);_0x555bff(_0x5b5bb5);});});}exports[_0x9b54('0x18')]=function(_0x457092){var _0x5025e8=this;return new Promise(function(_0x37f0f8,_0x189530){return db[_0x9b54('0x19')]['create'](_0x457092['body'],{'raw':_0x457092[_0x9b54('0x1a')]?_0x457092[_0x9b54('0x1a')][_0x9b54('0x1b')]===undefined?!![]:![]:!![]})[_0x9b54('0xd')](function(_0x4e9b49){logger[_0x9b54('0xe')](_0x9b54('0x18'),_0x457092);logger[_0x9b54('0x10')](_0x9b54('0x18'),_0x457092,JSON[_0x9b54('0x1c')](_0x4e9b49));_0x37f0f8(_0x4e9b49);})[_0x9b54('0x17')](function(_0x231d17){logger[_0x9b54('0x13')](_0x9b54('0x18'),_0x231d17[_0x9b54('0x15')],_0x457092);_0x189530(_0x5025e8[_0x9b54('0x13')](0x1f4,_0x231d17[_0x9b54('0x15')]));});});}; \ No newline at end of file +var _0xef9a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','lodash','util','bluebird','ioredis'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xef9a,0x1ea));var _0xaef9=function(_0x188cb9,_0x348b4f){_0x188cb9=_0x188cb9-0x0;var _0xde47b9=_0xef9a[_0x188cb9];return _0xde47b9;};'use strict';var _=require(_0xaef9('0x0'));var util=require(_0xaef9('0x1'));var moment=require('moment');var BPromise=require(_0xaef9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaef9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaef9('0x4'));var logger=require(_0xaef9('0x5'))(_0xaef9('0x6'));var config=require(_0xaef9('0x7'));var jayson=require(_0xaef9('0x8'));var client=jayson[_0xaef9('0x9')][_0xaef9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2be4d4,_0x1ec905,_0x3172bc){return new BPromise(function(_0x3993d2,_0x3cee00){return client[_0xaef9('0xb')](_0x2be4d4,_0x3172bc)[_0xaef9('0xc')](function(_0x27a60e){logger['info'](_0xaef9('0xd'),_0x1ec905,_0xaef9('0xe'));logger['debug'](_0xaef9('0xf'),_0x1ec905,'request\x20sent',JSON[_0xaef9('0x10')](_0x27a60e));if(_0x27a60e[_0xaef9('0x11')]){if(_0x27a60e[_0xaef9('0x11')][_0xaef9('0x12')]===0x1f4){logger['error'](_0xaef9('0xd'),_0x1ec905,_0x27a60e[_0xaef9('0x11')]['message']);return _0x3cee00(_0x27a60e[_0xaef9('0x11')][_0xaef9('0x13')]);}logger[_0xaef9('0x11')](_0xaef9('0xd'),_0x1ec905,_0x27a60e[_0xaef9('0x11')]['message']);return _0x3993d2(_0x27a60e[_0xaef9('0x11')]['message']);}else{logger[_0xaef9('0x14')](_0xaef9('0xd'),_0x1ec905,_0xaef9('0xe'));_0x3993d2(_0x27a60e['result'][_0xaef9('0x13')]);}})[_0xaef9('0x15')](function(_0x56ebe6){logger[_0xaef9('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x1ec905,_0x56ebe6);_0x3cee00(_0x56ebe6);});});}exports[_0xaef9('0x16')]=function(_0xfd0079){var _0x534b13=this;return new Promise(function(_0x28d592,_0x29db0d){return db[_0xaef9('0x17')]['create'](_0xfd0079['body'],{'raw':_0xfd0079[_0xaef9('0x18')]?_0xfd0079[_0xaef9('0x18')][_0xaef9('0x19')]===undefined?!![]:![]:!![]})[_0xaef9('0xc')](function(_0x4cfbdd){logger[_0xaef9('0x14')](_0xaef9('0x16'),_0xfd0079);logger['debug']('CreateVoiceTransferReport',_0xfd0079,JSON[_0xaef9('0x10')](_0x4cfbdd));_0x28d592(_0x4cfbdd);})[_0xaef9('0x15')](function(_0x3bacaa){logger[_0xaef9('0x11')](_0xaef9('0x16'),_0x3bacaa[_0xaef9('0x13')],_0xfd0079);_0x29db0d(_0x534b13['error'](0x1f4,_0x3bacaa[_0xaef9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8553db4..5707063 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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x40637f,_0x29daf1){var _0x33a05b=function(_0x287ac4){while(--_0x287ac4){_0x40637f['push'](_0x40637f['shift']());}};_0x33a05b(++_0x29daf1);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xb4e6[_0x3e182f];return _0x23edc9;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file +var _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x26f1cf,_0x3ed15f){var _0x6674e8=function(_0x1ed975){while(--_0x1ed975){_0x26f1cf['push'](_0x26f1cf['shift']());}};_0x6674e8(++_0x3ed15f);}(_0x750a,0x140));var _0xa750=function(_0x50c109,_0x525133){_0x50c109=_0x50c109-0x0;var _0x55f476=_0x750a[_0x50c109];return _0x55f476;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 63afadb..a369c39 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 _0xb4e6=['request','then','code','message','result','findOne','agent','VoiceChannels','all','filter','rows','length','sessionId\x20','\x20not\x20found!','info','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','sessionId','user:%s','webbar:hangup','answer','validate','webbar:answer','answer\x20executed!','catch','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','stack','name','status','send'];(function(_0xf8f137,_0x1ef640){var _0x489d04=function(_0x3158b2){while(--_0x3158b2){_0xf8f137['push'](_0xf8f137['shift']());}};_0x489d04(++_0x1ef640);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xb4e6[_0x5bd426];return _0x23a7eb;};'use strict';var path=require(_0x6b4e('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x6b4e('0x1'))['db'];var config=require(_0x6b4e('0x2'));var util=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var jayson=require(_0x6b4e('0x5'));var amiClient=jayson[_0x6b4e('0x6')][_0x6b4e('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0x6b4e('0x8'));var Redis=require(_0x6b4e('0x9'));config[_0x6b4e('0xa')]=_['defaults'](config[_0x6b4e('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6b4e('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6b4e('0xb')]},'callNumber':{'type':_0x6b4e('0xc'),'required':[!![],_0x6b4e('0xd')]},'callerId':{'type':_0x6b4e('0xc')},'callbackUrl':{'type':_0x6b4e('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x6b4e('0xe'),'required':[!![],_0x6b4e('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6b4e('0xe'),'required':[!![],_0x6b4e('0xb')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6b4e('0xe'),'required':[!![],_0x6b4e('0xb')]},'sessionId':{'type':_0x6b4e('0xc'),'required':[!![],_0x6b4e('0xf')]},'transferNumber':{'type':_0x6b4e('0xc'),'required':[!![],_0x6b4e('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x6b4e('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6b4e('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6b4e('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6b4e('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6b4e('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x6b4e('0xe'),'required':[!![],_0x6b4e('0xb')]}});function emit(_0x42e265,_0x28c3ba,_0x135568){logger['info'](_0x42e265,_0x28c3ba,JSON['stringify'](_0x135568));io['to'](_0x42e265)[_0x6b4e('0x11')](_0x28c3ba,_0x135568);}function handleError(_0x1beb73){return function(_0x10d2b1){console[_0x6b4e('0x12')](_0x6b4e('0x13'),_0x10d2b1,_0x10d2b1 instanceof RangeError);logger[_0x6b4e('0x14')](_0x10d2b1[_0x6b4e('0x15')]);if(_0x10d2b1 instanceof RangeError){if(_0x10d2b1[_0x6b4e('0x16')]){delete _0x10d2b1[_0x6b4e('0x16')];}_0x1beb73[_0x6b4e('0x17')](0x194)[_0x6b4e('0x18')](_0x10d2b1);}else{if(_0x10d2b1['name']){delete _0x10d2b1[_0x6b4e('0x16')];}_0x1beb73[_0x6b4e('0x17')](0x1f4)[_0x6b4e('0x18')](_0x10d2b1);}};}function checkError(){return function(_0xd81d99){if(!_0xd81d99){throw new RangeError('NotFound');}return _0xd81d99;};}function respondWithRpcPromise(_0x1b48b5,_0x507703){return new BPromise(function(_0x2503a5,_0x163dea){var _0x165a99=amiClient;return _0x165a99[_0x6b4e('0x19')](_0x1b48b5,_0x507703)[_0x6b4e('0x1a')](function(_0x346566){if(_0x346566[_0x6b4e('0x14')]){if(_0x346566['error'][_0x6b4e('0x1b')]===0x1f4){return _0x163dea(_0x346566['error'][_0x6b4e('0x1c')]);}return _0x2503a5(_0x346566[_0x6b4e('0x14')][_0x6b4e('0x1c')]);}else{_0x2503a5(_0x346566[_0x6b4e('0x1d')]);}})['catch'](function(_0xec7d35){_0x163dea(_0xec7d35);});});}function getAgent(_0x3f72d7){return db['User'][_0x6b4e('0x1e')]({'where':{'id':_0x3f72d7,'role':_0x6b4e('0x1f')}})[_0x6b4e('0x1a')](checkError());}function getAgentCheckSession(_0x44b399,_0x5bfe9e){return new BPromise(function(_0x2d42be,_0x182375){var _0x57650d=respondWithRpcPromise(_0x6b4e('0x20'));var _0x453beb=getAgent(_0x44b399);Promise[_0x6b4e('0x21')]([_0x57650d,_0x453beb])[_0x6b4e('0x1a')](function(_0x4a6c90){var _0x445278=_0x4a6c90[0x0];var _0x4007b6=_0x4a6c90[0x1];var _0x47ab11=_[_0x6b4e('0x22')](_0x445278[_0x6b4e('0x23')],function(_0x37b636){return _0x37b636['UserId']==_0x4007b6['id']&&_0x37b636['sessionId']==_0x5bfe9e;});if(_0x47ab11[_0x6b4e('0x24')]==0x1){_0x2d42be(_0x4007b6);}else{_0x182375(new RangeError(_0x6b4e('0x25')+_0x5bfe9e+_0x6b4e('0x26')));}});});}exports['originate']=function(_0x2a1a29,_0x421177){logger[_0x6b4e('0x27')]('originate\x20fired:',_0x2a1a29['body']);var _0x2bff51=originateValidation['validate'](_0x2a1a29[_0x6b4e('0x28')]);if(_0x2bff51[_0x6b4e('0x24')]>0x0){return _0x421177['status'](0x190)[_0x6b4e('0x29')](_0x2bff51);}var _0x3b3094=_0x2a1a29[_0x6b4e('0x28')][_0x6b4e('0x2a')];var _0x516b9f=_0x2a1a29['body'][_0x6b4e('0x2b')];var _0x2efd68=_0x2a1a29[_0x6b4e('0x28')][_0x6b4e('0x2c')];var _0x1dbac7=_0x2a1a29[_0x6b4e('0x28')][_0x6b4e('0x2d')];return getAgent(_0x3b3094)[_0x6b4e('0x1a')](function(_0x144954){logger[_0x6b4e('0x27')](_0x6b4e('0x2e'),_0x144954[_0x6b4e('0x16')]);emit(util[_0x6b4e('0x2f')]('user:%s',_0x144954[_0x6b4e('0x16')]),_0x6b4e('0x30'),{'callNumber':_0x516b9f,'callerId':_0x2efd68,'callbackUrl':_0x1dbac7});return _0x421177[_0x6b4e('0x17')](0xc8)['json']({'error':![],'message':_0x6b4e('0x31')});})['catch'](handleError(_0x421177));};exports[_0x6b4e('0x32')]=function(_0x1cb4c9,_0x38687f){logger['info']('hangup\x20fired:',_0x1cb4c9[_0x6b4e('0x28')]);var _0x112ca3=hangupValidation['validate'](_0x1cb4c9['body']);if(_0x112ca3[_0x6b4e('0x24')]>0x0){return _0x38687f[_0x6b4e('0x17')](0x190)[_0x6b4e('0x29')](_0x112ca3);}var _0x39097d=_0x1cb4c9[_0x6b4e('0x28')][_0x6b4e('0x2a')];var _0x391076=_0x1cb4c9[_0x6b4e('0x28')][_0x6b4e('0x33')];return getAgent(_0x39097d)[_0x6b4e('0x1a')](function(_0x1f2c38){logger['info'](_0x6b4e('0x2e'),_0x1f2c38[_0x6b4e('0x16')]);emit(util['format'](_0x6b4e('0x34'),_0x1f2c38[_0x6b4e('0x16')]),_0x6b4e('0x35'),{'sessionId':_0x391076});return _0x38687f[_0x6b4e('0x17')](0xc8)[_0x6b4e('0x29')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x38687f));};exports[_0x6b4e('0x36')]=function(_0x5959c0,_0x274ed4){logger[_0x6b4e('0x27')]('answer\x20fired:',_0x5959c0[_0x6b4e('0x28')]);var _0x50f0e7=answerValidation[_0x6b4e('0x37')](_0x5959c0['body']);if(_0x50f0e7[_0x6b4e('0x24')]>0x0){return _0x274ed4[_0x6b4e('0x17')](0x190)[_0x6b4e('0x29')](_0x50f0e7);}var _0x30401b=_0x5959c0['body'][_0x6b4e('0x2a')];var _0x244a9f=_0x5959c0[_0x6b4e('0x28')]['sessionId'];return getAgent(_0x30401b)[_0x6b4e('0x1a')](function(_0x2f0ea5){logger[_0x6b4e('0x27')](_0x6b4e('0x2e'),_0x2f0ea5[_0x6b4e('0x16')]);emit(util[_0x6b4e('0x2f')](_0x6b4e('0x34'),_0x2f0ea5[_0x6b4e('0x16')]),_0x6b4e('0x38'),{'sessionId':_0x244a9f});return _0x274ed4['status'](0xc8)[_0x6b4e('0x29')]({'error':![],'message':_0x6b4e('0x39')});})[_0x6b4e('0x3a')](handleError(_0x274ed4));};exports[_0x6b4e('0x3b')]=function(_0x27424c,_0x5c7bda){logger[_0x6b4e('0x27')]('hold\x20fired:',_0x27424c[_0x6b4e('0x28')]);var _0x3bcfcc=holdValidation[_0x6b4e('0x37')](_0x27424c[_0x6b4e('0x28')]);if(_0x3bcfcc['length']>0x0){return _0x5c7bda[_0x6b4e('0x17')](0x190)[_0x6b4e('0x29')](_0x3bcfcc);}var _0x1d0eb3=_0x27424c['body'][_0x6b4e('0x2a')];var _0x455afc=_0x27424c[_0x6b4e('0x28')][_0x6b4e('0x33')];return getAgent(_0x1d0eb3)[_0x6b4e('0x1a')](function(_0x33c797){logger[_0x6b4e('0x27')](_0x6b4e('0x2e'),_0x33c797[_0x6b4e('0x16')]);emit(util[_0x6b4e('0x2f')]('user:%s',_0x33c797[_0x6b4e('0x16')]),_0x6b4e('0x3c'),{'sessionId':_0x455afc});return _0x5c7bda[_0x6b4e('0x17')](0xc8)['json']({'error':![],'message':_0x6b4e('0x3d')});})[_0x6b4e('0x3a')](handleError(_0x5c7bda));};exports[_0x6b4e('0x3e')]=function(_0x738ee5,_0x73c6be){logger[_0x6b4e('0x27')](_0x6b4e('0x3f'),_0x738ee5[_0x6b4e('0x28')]);var _0x29eeb8=unholdValidation[_0x6b4e('0x37')](_0x738ee5[_0x6b4e('0x28')]);if(_0x29eeb8['length']>0x0){return _0x73c6be['status'](0x190)[_0x6b4e('0x29')](_0x29eeb8);}var _0x2d5eda=_0x738ee5[_0x6b4e('0x28')][_0x6b4e('0x2a')];var _0x542e98=_0x738ee5[_0x6b4e('0x28')][_0x6b4e('0x33')];return getAgent(_0x2d5eda)[_0x6b4e('0x1a')](function(_0x59db52){logger[_0x6b4e('0x27')](_0x6b4e('0x2e'),_0x59db52[_0x6b4e('0x16')]);emit(util[_0x6b4e('0x2f')](_0x6b4e('0x34'),_0x59db52['name']),_0x6b4e('0x40'),{'sessionId':_0x542e98});return _0x73c6be['status'](0xc8)[_0x6b4e('0x29')]({'error':![],'message':_0x6b4e('0x41')});})['catch'](handleError(_0x73c6be));};exports[_0x6b4e('0x42')]=function(_0x553521,_0xc47275){logger[_0x6b4e('0x27')](_0x6b4e('0x43'),_0xc47275[_0x6b4e('0x28')]);var _0x11b868=callsValidation['validate'](_0x553521[_0x6b4e('0x28')]);if(_0x11b868[_0x6b4e('0x24')]>0x0){return _0xc47275[_0x6b4e('0x17')](0x190)['json'](_0x11b868);}var _0x5b45f1=_0x553521[_0x6b4e('0x28')][_0x6b4e('0x2a')];var _0x5d46b9=respondWithRpcPromise(_0x6b4e('0x20'));var _0x2cb4c=getAgent(_0x5b45f1);return Promise[_0x6b4e('0x21')]([_0x5d46b9,_0x2cb4c])[_0x6b4e('0x1a')](function(_0x45f16e){var _0x5786f5=_0x45f16e[0x0];var _0x52faab=_0x45f16e[0x1];var _0x1b3f3c=_[_0x6b4e('0x22')](_0x5786f5[_0x6b4e('0x23')],function(_0x2f1354){return _0x2f1354[_0x6b4e('0x44')]==_0x52faab['id'];});return _0xc47275[_0x6b4e('0x17')](0xc8)[_0x6b4e('0x29')]({'count':_0x1b3f3c[_0x6b4e('0x24')],'rows':_0x1b3f3c});})[_0x6b4e('0x3a')](handleError(_0xc47275));};exports['conference']=function(_0x322fa4,_0x4427da){logger[_0x6b4e('0x27')]('conference\x20fired:',_0x322fa4['body']);var _0x22a68a=conferenceValidation[_0x6b4e('0x37')](_0x322fa4[_0x6b4e('0x28')]);if(_0x22a68a[_0x6b4e('0x24')]>0x0){return _0x4427da[_0x6b4e('0x17')](0x190)['json'](_0x22a68a);}var _0x15d205=_0x322fa4[_0x6b4e('0x28')][_0x6b4e('0x2a')];return getAgent(_0x15d205)['then'](function(_0x12827c){logger[_0x6b4e('0x27')](_0x6b4e('0x2e'),_0x12827c['name']);emit(util[_0x6b4e('0x2f')](_0x6b4e('0x34'),_0x12827c['name']),_0x6b4e('0x45'));return _0x4427da[_0x6b4e('0x17')](0xc8)[_0x6b4e('0x29')]({'error':![],'message':_0x6b4e('0x46')});})[_0x6b4e('0x3a')](handleError(_0x4427da));};exports[_0x6b4e('0x47')]=function(_0x2ada5d,_0x5d8433){logger[_0x6b4e('0x27')](_0x6b4e('0x48'),_0x2ada5d[_0x6b4e('0x28')]);var _0x13bddb=transferValidation[_0x6b4e('0x37')](_0x2ada5d['body']);if(_0x13bddb[_0x6b4e('0x24')]>0x0){return _0x5d8433[_0x6b4e('0x17')](0x190)[_0x6b4e('0x29')](_0x13bddb);}var _0x2960ad=_0x2ada5d[_0x6b4e('0x28')]['userId'];var _0xa1246f=_0x2ada5d['body'][_0x6b4e('0x33')];var _0x1eb5e2=_0x2ada5d[_0x6b4e('0x28')][_0x6b4e('0x49')];return getAgent(_0x2960ad)['then'](function(_0x7d1ce){logger[_0x6b4e('0x27')](_0x6b4e('0x2e'),_0x7d1ce[_0x6b4e('0x16')]);emit(util[_0x6b4e('0x2f')](_0x6b4e('0x34'),_0x7d1ce[_0x6b4e('0x16')]),'webbar:transfer',{'sessionId':_0xa1246f,'transferNumber':_0x1eb5e2});return _0x5d8433['status'](0xc8)['json']({'error':![],'message':_0x6b4e('0x4a')});})[_0x6b4e('0x3a')](handleError(_0x5d8433));}; \ No newline at end of file +var _0x1752=['originate','info','body','length','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','validate','hangup\x20executed!','format','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','error','stack','name','status','request','then','code','message','result','catch','User','VoiceChannels','all','sessionId'];(function(_0x2c21fa,_0x5f0a10){var _0x5aafc6=function(_0x1eb171){while(--_0x1eb171){_0x2c21fa['push'](_0x2c21fa['shift']());}};_0x5aafc6(++_0x5f0a10);}(_0x1752,0xa5));var _0x2175=function(_0x29c5e8,_0xdfb7cc){_0x29c5e8=_0x29c5e8-0x0;var _0x2a634a=_0x1752[_0x29c5e8];return _0x2a634a;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x2175('0x0'));var db=require(_0x2175('0x1'))['db'];var config=require(_0x2175('0x2'));var util=require(_0x2175('0x3'));var BPromise=require(_0x2175('0x4'));var jayson=require(_0x2175('0x5'));var amiClient=jayson['client'][_0x2175('0x6')]({'port':0x232a});var logger=require(_0x2175('0x7'))(_0x2175('0x8'));var Redis=require(_0x2175('0x9'));config[_0x2175('0xa')]=_[_0x2175('0xb')](config[_0x2175('0xa')],{'host':_0x2175('0xc'),'port':0x18eb});var io=require(_0x2175('0xd'))(new Redis(config[_0x2175('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x2175('0xe'),'required':[!![],_0x2175('0xf')]},'callNumber':{'type':_0x2175('0x10'),'required':[!![],_0x2175('0x11')]},'callerId':{'type':_0x2175('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2175('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2175('0xf')]},'sessionId':{'type':'string','required':[!![],_0x2175('0x12')]},'transferNumber':{'type':_0x2175('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x2175('0xe'),'required':[!![],_0x2175('0xf')]},'sessionId':{'type':_0x2175('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2175('0xe'),'required':[!![],_0x2175('0xf')]},'sessionId':{'type':_0x2175('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2175('0xe'),'required':[!![],_0x2175('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x371b42,_0x22cd42,_0x22fde9){logger['info'](_0x371b42,_0x22cd42,JSON['stringify'](_0x22fde9));io['to'](_0x371b42)['emit'](_0x22cd42,_0x22fde9);}function handleError(_0x366e37){return function(_0x377586){console['log']('handleError:',_0x377586,_0x377586 instanceof RangeError);logger[_0x2175('0x13')](_0x377586[_0x2175('0x14')]);if(_0x377586 instanceof RangeError){if(_0x377586[_0x2175('0x15')]){delete _0x377586['name'];}_0x366e37[_0x2175('0x16')](0x194)['send'](_0x377586);}else{if(_0x377586[_0x2175('0x15')]){delete _0x377586['name'];}_0x366e37[_0x2175('0x16')](0x1f4)['send'](_0x377586);}};}function checkError(){return function(_0x5366e3){if(!_0x5366e3){throw new RangeError('NotFound');}return _0x5366e3;};}function respondWithRpcPromise(_0x278851,_0x583a1d){return new BPromise(function(_0x28c4b8,_0x46ea57){var _0x2dd77b=amiClient;return _0x2dd77b[_0x2175('0x17')](_0x278851,_0x583a1d)[_0x2175('0x18')](function(_0x12d150){if(_0x12d150['error']){if(_0x12d150[_0x2175('0x13')][_0x2175('0x19')]===0x1f4){return _0x46ea57(_0x12d150[_0x2175('0x13')][_0x2175('0x1a')]);}return _0x28c4b8(_0x12d150['error']['message']);}else{_0x28c4b8(_0x12d150[_0x2175('0x1b')]);}})[_0x2175('0x1c')](function(_0x2204cd){_0x46ea57(_0x2204cd);});});}function getAgent(_0x542273){return db[_0x2175('0x1d')]['findOne']({'where':{'id':_0x542273,'role':'agent'}})[_0x2175('0x18')](checkError());}function getAgentCheckSession(_0x183221,_0x475d6e){return new BPromise(function(_0x3c8986,_0xaa64ce){var _0x31cc46=respondWithRpcPromise(_0x2175('0x1e'));var _0x40d8c8=getAgent(_0x183221);Promise[_0x2175('0x1f')]([_0x31cc46,_0x40d8c8])[_0x2175('0x18')](function(_0x7b6edb){var _0x56dcf9=_0x7b6edb[0x0];var _0x20fccf=_0x7b6edb[0x1];var _0x1e91a6=_['filter'](_0x56dcf9['rows'],function(_0x3d64ac){return _0x3d64ac['UserId']==_0x20fccf['id']&&_0x3d64ac[_0x2175('0x20')]==_0x475d6e;});if(_0x1e91a6['length']==0x1){_0x3c8986(_0x20fccf);}else{_0xaa64ce(new RangeError('sessionId\x20'+_0x475d6e+'\x20not\x20found!'));}});});}exports[_0x2175('0x21')]=function(_0x2811b6,_0x3ba86e){logger[_0x2175('0x22')]('originate\x20fired:',_0x2811b6[_0x2175('0x23')]);var _0x2d9526=originateValidation['validate'](_0x2811b6[_0x2175('0x23')]);if(_0x2d9526[_0x2175('0x24')]>0x0){return _0x3ba86e['status'](0x190)['json'](_0x2d9526);}var _0x4f2cfb=_0x2811b6['body'][_0x2175('0x25')];var _0x1c28da=_0x2811b6[_0x2175('0x23')][_0x2175('0x26')];var _0x3f7bf3=_0x2811b6[_0x2175('0x23')][_0x2175('0x27')];var _0x325731=_0x2811b6['body']['callbackUrl'];return getAgent(_0x4f2cfb)['then'](function(_0x5c232a){logger['info'](_0x2175('0x28'),_0x5c232a[_0x2175('0x15')]);emit(util['format'](_0x2175('0x29'),_0x5c232a[_0x2175('0x15')]),_0x2175('0x2a'),{'callNumber':_0x1c28da,'callerId':_0x3f7bf3,'callbackUrl':_0x325731});return _0x3ba86e[_0x2175('0x16')](0xc8)[_0x2175('0x2b')]({'error':![],'message':_0x2175('0x2c')});})['catch'](handleError(_0x3ba86e));};exports[_0x2175('0x2d')]=function(_0x465ed5,_0x304e18){logger[_0x2175('0x22')](_0x2175('0x2e'),_0x465ed5[_0x2175('0x23')]);var _0x3f1812=hangupValidation[_0x2175('0x2f')](_0x465ed5[_0x2175('0x23')]);if(_0x3f1812[_0x2175('0x24')]>0x0){return _0x304e18[_0x2175('0x16')](0x190)['json'](_0x3f1812);}var _0x398015=_0x465ed5[_0x2175('0x23')][_0x2175('0x25')];var _0x4f5744=_0x465ed5['body'][_0x2175('0x20')];return getAgent(_0x398015)['then'](function(_0x724d49){logger[_0x2175('0x22')](_0x2175('0x28'),_0x724d49['name']);emit(util['format'](_0x2175('0x29'),_0x724d49[_0x2175('0x15')]),'webbar:hangup',{'sessionId':_0x4f5744});return _0x304e18['status'](0xc8)[_0x2175('0x2b')]({'error':![],'message':_0x2175('0x30')});})[_0x2175('0x1c')](handleError(_0x304e18));};exports['answer']=function(_0x2b2f32,_0x4343f9){logger[_0x2175('0x22')]('answer\x20fired:',_0x2b2f32['body']);var _0x459cee=answerValidation['validate'](_0x2b2f32[_0x2175('0x23')]);if(_0x459cee[_0x2175('0x24')]>0x0){return _0x4343f9['status'](0x190)['json'](_0x459cee);}var _0x4d8a30=_0x2b2f32[_0x2175('0x23')]['userId'];var _0x48688c=_0x2b2f32[_0x2175('0x23')]['sessionId'];return getAgent(_0x4d8a30)[_0x2175('0x18')](function(_0x18826a){logger[_0x2175('0x22')](_0x2175('0x28'),_0x18826a[_0x2175('0x15')]);emit(util[_0x2175('0x31')]('user:%s',_0x18826a[_0x2175('0x15')]),_0x2175('0x32'),{'sessionId':_0x48688c});return _0x4343f9[_0x2175('0x16')](0xc8)[_0x2175('0x2b')]({'error':![],'message':_0x2175('0x33')});})[_0x2175('0x1c')](handleError(_0x4343f9));};exports['hold']=function(_0x18bc16,_0x382f5c){logger[_0x2175('0x22')]('hold\x20fired:',_0x18bc16[_0x2175('0x23')]);var _0x522b4f=holdValidation['validate'](_0x18bc16[_0x2175('0x23')]);if(_0x522b4f[_0x2175('0x24')]>0x0){return _0x382f5c[_0x2175('0x16')](0x190)['json'](_0x522b4f);}var _0x32d6eb=_0x18bc16[_0x2175('0x23')][_0x2175('0x25')];var _0x2e5cfc=_0x18bc16[_0x2175('0x23')]['sessionId'];return getAgent(_0x32d6eb)['then'](function(_0xdb0a97){logger[_0x2175('0x22')](_0x2175('0x28'),_0xdb0a97[_0x2175('0x15')]);emit(util[_0x2175('0x31')]('user:%s',_0xdb0a97[_0x2175('0x15')]),_0x2175('0x34'),{'sessionId':_0x2e5cfc});return _0x382f5c[_0x2175('0x16')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x2175('0x1c')](handleError(_0x382f5c));};exports['unhold']=function(_0x5af419,_0x5bab81){logger['info'](_0x2175('0x35'),_0x5af419[_0x2175('0x23')]);var _0x4d0b79=unholdValidation['validate'](_0x5af419['body']);if(_0x4d0b79['length']>0x0){return _0x5bab81[_0x2175('0x16')](0x190)[_0x2175('0x2b')](_0x4d0b79);}var _0x5d18c2=_0x5af419['body'][_0x2175('0x25')];var _0x17705c=_0x5af419[_0x2175('0x23')][_0x2175('0x20')];return getAgent(_0x5d18c2)[_0x2175('0x18')](function(_0x4cd703){logger[_0x2175('0x22')]('entityFound:',_0x4cd703[_0x2175('0x15')]);emit(util[_0x2175('0x31')](_0x2175('0x29'),_0x4cd703[_0x2175('0x15')]),_0x2175('0x36'),{'sessionId':_0x17705c});return _0x5bab81[_0x2175('0x16')](0xc8)[_0x2175('0x2b')]({'error':![],'message':_0x2175('0x37')});})[_0x2175('0x1c')](handleError(_0x5bab81));};exports[_0x2175('0x38')]=function(_0x1f967d,_0x172844){logger[_0x2175('0x22')](_0x2175('0x39'),_0x172844[_0x2175('0x23')]);var _0x5e6d93=callsValidation[_0x2175('0x2f')](_0x1f967d[_0x2175('0x23')]);if(_0x5e6d93[_0x2175('0x24')]>0x0){return _0x172844[_0x2175('0x16')](0x190)['json'](_0x5e6d93);}var _0x10bd47=_0x1f967d['body'][_0x2175('0x25')];var _0xfd4b02=respondWithRpcPromise(_0x2175('0x1e'));var _0x1b26cc=getAgent(_0x10bd47);return Promise[_0x2175('0x1f')]([_0xfd4b02,_0x1b26cc])[_0x2175('0x18')](function(_0x177b5f){var _0xa2e4fb=_0x177b5f[0x0];var _0x5dfcf2=_0x177b5f[0x1];var _0x4f138b=_[_0x2175('0x3a')](_0xa2e4fb[_0x2175('0x3b')],function(_0x4ec9dc){return _0x4ec9dc['UserId']==_0x5dfcf2['id'];});return _0x172844[_0x2175('0x16')](0xc8)[_0x2175('0x2b')]({'count':_0x4f138b[_0x2175('0x24')],'rows':_0x4f138b});})[_0x2175('0x1c')](handleError(_0x172844));};exports['conference']=function(_0x3368be,_0x5a93b7){logger[_0x2175('0x22')](_0x2175('0x3c'),_0x3368be['body']);var _0x3e5b50=conferenceValidation[_0x2175('0x2f')](_0x3368be[_0x2175('0x23')]);if(_0x3e5b50[_0x2175('0x24')]>0x0){return _0x5a93b7[_0x2175('0x16')](0x190)['json'](_0x3e5b50);}var _0x209691=_0x3368be[_0x2175('0x23')]['userId'];return getAgent(_0x209691)[_0x2175('0x18')](function(_0x584439){logger[_0x2175('0x22')]('entityFound:',_0x584439[_0x2175('0x15')]);emit(util[_0x2175('0x31')](_0x2175('0x29'),_0x584439[_0x2175('0x15')]),_0x2175('0x3d'));return _0x5a93b7['status'](0xc8)[_0x2175('0x2b')]({'error':![],'message':_0x2175('0x3e')});})[_0x2175('0x1c')](handleError(_0x5a93b7));};exports[_0x2175('0x3f')]=function(_0x2747aa,_0x36d67e){logger['info']('transfer\x20fired:',_0x2747aa[_0x2175('0x23')]);var _0x12c327=transferValidation[_0x2175('0x2f')](_0x2747aa[_0x2175('0x23')]);if(_0x12c327[_0x2175('0x24')]>0x0){return _0x36d67e[_0x2175('0x16')](0x190)[_0x2175('0x2b')](_0x12c327);}var _0x2cae7b=_0x2747aa['body'][_0x2175('0x25')];var _0x318afb=_0x2747aa[_0x2175('0x23')]['sessionId'];var _0x57c5a9=_0x2747aa['body']['transferNumber'];return getAgent(_0x2cae7b)[_0x2175('0x18')](function(_0x17c15e){logger[_0x2175('0x22')](_0x2175('0x28'),_0x17c15e[_0x2175('0x15')]);emit(util[_0x2175('0x31')](_0x2175('0x29'),_0x17c15e[_0x2175('0x15')]),_0x2175('0x40'),{'sessionId':_0x318afb,'transferNumber':_0x57c5a9});return _0x36d67e['status'](0xc8)['json']({'error':![],'message':_0x2175('0x41')});})[_0x2175('0x1c')](handleError(_0x36d67e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 25e7bfc..8557043 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 _0xc2c7=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x149b9,_0x85803e){var _0x111a7e=function(_0x15f016){while(--_0x15f016){_0x149b9['push'](_0x149b9['shift']());}};_0x111a7e(++_0x85803e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x7f7dff,_0x5ac0bd){_0x7f7dff=_0x7f7dff-0x0;var _0x3282d1=_0xc2c7[_0x7f7dff];return _0x3282d1;};'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('./whatsappAccount.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['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x8')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c2c('0x16')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['addDisposition']);router[_0x7c2c('0x16')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['post'](_0x7c2c('0x12'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x16')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x19')]);router[_0x7c2c('0x16')](_0x7c2c('0x1a'),controller[_0x7c2c('0x1b')]);router[_0x7c2c('0x16')](_0x7c2c('0x1c'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1d')]);router['put'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7c2c('0x1e')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1f')]);router[_0x7c2c('0x1e')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['removeDispositions']);router[_0x7c2c('0x1e')]('/:id/canned_answers',auth[_0x7c2c('0x9')](),controller['removeAnswers']);router[_0x7c2c('0x1e')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x47c5=['/:id/notify','notify','send','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x47c5,0x165));var _0x547c=function(_0x3d5e72,_0x3ab167){_0x3d5e72=_0x3d5e72-0x0;var _0x2230e4=_0x47c5[_0x3d5e72];return _0x2230e4;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0x9')](_0x547c('0xe'),auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x9')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x9')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);router['get'](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['getAgents']);router[_0x547c('0x9')](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x16')]);router[_0x547c('0x17')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0x18')]);router[_0x547c('0x17')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x19')]);router[_0x547c('0x17')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x1a')]);router[_0x547c('0x17')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['addAgents']);router['post'](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x1b')]);router['post'](_0x547c('0x1c'),controller[_0x547c('0x1d')]);router[_0x547c('0x17')]('/:id/send',auth[_0x547c('0xc')](),controller[_0x547c('0x1e')]);router['put']('/:id',auth[_0x547c('0xc')](),controller[_0x547c('0x1f')]);router['delete'](_0x547c('0xe'),auth[_0x547c('0xc')](),controller['destroy']);router[_0x547c('0x20')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller['removeDispositions']);router[_0x547c('0x20')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x21')]);router[_0x547c('0x20')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller[_0x547c('0x22')]);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 ef1622b..0955e87 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 _0x0445=['sinch','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','twilio'];(function(_0x4c6d28,_0x4641b1){var _0x5f2a40=function(_0x3dede7){while(--_0x3dede7){_0x4c6d28['push'](_0x4c6d28['shift']());}};_0x5f2a40(++_0x4641b1);}(_0x0445,0x120));var _0x5044=function(_0x32cd29,_0x29f6bb){_0x32cd29=_0x32cd29-0x0;var _0x2f7e6e=_0x0445[_0x32cd29];return _0x2f7e6e;};'use strict';var Sequelize=require(_0x5044('0x0'));var rs=require(_0x5044('0x1'));module[_0x5044('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x5044('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5044('0x3')],'defaultValue':function(){return rs[_0x5044('0x4')]();}},'phone':{'type':Sequelize[_0x5044('0x3')]},'type':{'type':Sequelize['ENUM'](_0x5044('0x5'),_0x5044('0x6'))},'accountSid':{'type':Sequelize[_0x5044('0x3')]},'baseUrl':{'type':Sequelize[_0x5044('0x3')]},'authToken':{'type':Sequelize[_0x5044('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5044('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5044('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5044('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5044('0x8')],'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'],'comment':_0x5044('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x5044('0x7')],'defaultValue':![],'comment':_0x5044('0xa'),'set':function(_0x2e3d32){if(!_0x2e3d32){this[_0x5044('0xb')](_0x5044('0xc'),null);}this[_0x5044('0xb')](_0x5044('0xd'),_0x2e3d32);}},'description':{'type':Sequelize[_0x5044('0x3')]}}; \ No newline at end of file +var _0x92f6=['STRING','generate','ENUM','sinch','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x92f6,0x1df));var _0x692f=function(_0x277c03,_0x141043){_0x277c03=_0x277c03-0x0;var _0x2c6b63=_0x92f6[_0x277c03];return _0x2c6b63;};'use strict';var Sequelize=require(_0x692f('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x692f('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x692f('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x692f('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x692f('0x1')],'defaultValue':function(){return rs[_0x692f('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x692f('0x3')]('twilio',_0x692f('0x4'))},'accountSid':{'type':Sequelize[_0x692f('0x1')]},'baseUrl':{'type':Sequelize[_0x692f('0x1')]},'authToken':{'type':Sequelize[_0x692f('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x692f('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x692f('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x692f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x692f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x692f('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x692f('0x6')],'comment':_0x692f('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x692f('0x5')],'defaultValue':![],'comment':_0x692f('0x8'),'set':function(_0x4483a0){if(!_0x4483a0){this[_0x692f('0x9')](_0x692f('0xa'),null);}this[_0x692f('0x9')](_0x692f('0xb'),_0x4483a0);}},'description':{'type':Sequelize[_0x692f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d2f385c..f26941a 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 _0xed5d=['key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','merge','options','include','findAll','rows','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','Disposition','findOne','nolimit','includeAll','ids','addAnswer','WhatsappAccountId','CannedAnswer','getAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','notifications','messageId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','CmContact','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','end','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount'];(function(_0x1bea6d,_0x3f5124){var _0x26d6dd=function(_0x3f2c08){while(--_0x3f2c08){_0x1bea6d['push'](_0x1bea6d['shift']());}};_0x26d6dd(++_0x3f5124);}(_0xed5d,0x140));var _0xded5=function(_0x490a9a,_0x50b790){_0x490a9a=_0x490a9a-0x0;var _0x34f0a1=_0xed5d[_0x490a9a];return _0x34f0a1;};'use strict';var emlformat=require(_0xded5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xded5('0x1'));var rp=require(_0xded5('0x2'));var moment=require('moment');var BPromise=require(_0xded5('0x3'));var Mustache=require(_0xded5('0x4'));var util=require(_0xded5('0x5'));var path=require(_0xded5('0x6'));var sox=require(_0xded5('0x7'));var csv=require(_0xded5('0x8'));var ejs=require(_0xded5('0x9'));var fs=require('fs');var fs_extra=require(_0xded5('0xa'));var _=require(_0xded5('0xb'));var squel=require(_0xded5('0xc'));var crypto=require(_0xded5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xded5('0x8'));var querystring=require(_0xded5('0xe'));var Papa=require(_0xded5('0xf'));var Redis=require(_0xded5('0x10'));var authService=require(_0xded5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xded5('0x12'));var hardwareService=require(_0xded5('0x13'));var logger=require(_0xded5('0x14'))(_0xded5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xded5('0x16'));var db=require(_0xded5('0x17'))['db'];config[_0xded5('0x18')]=_[_0xded5('0x19')](config[_0xded5('0x18')],{'host':_0xded5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xded5('0x1b'))[_0xded5('0x1c')](socket);var jayson=require(_0xded5('0x1d'));var client=jayson[_0xded5('0x1e')][_0xded5('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5ac209,_0x1f0763,_0x26c3b8,_0x567dbc){return new BPromise(function(_0x3b48f7,_0x9de293){var _0x700b32=_0x567dbc||client;return _0x700b32[_0xded5('0x20')](_0x5ac209,_0x26c3b8)[_0xded5('0x21')](function(_0x313065){logger[_0xded5('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x1f0763,_0xded5('0x23'));logger['debug'](_0xded5('0x24'),_0x1f0763,_0xded5('0x23'),JSON['stringify'](_0x313065));if(_0x313065[_0xded5('0x25')]){if(_0x313065[_0xded5('0x25')]['code']===0x1f4){logger[_0xded5('0x25')](_0xded5('0x26'),_0x1f0763,_0x313065[_0xded5('0x25')][_0xded5('0x27')]);return _0x9de293(_0x313065[_0xded5('0x25')][_0xded5('0x27')]);}logger[_0xded5('0x25')](_0xded5('0x26'),_0x1f0763,_0x313065[_0xded5('0x25')][_0xded5('0x27')]);return _0x3b48f7(_0x313065['error'][_0xded5('0x27')]);}else{logger[_0xded5('0x22')](_0xded5('0x26'),_0x1f0763,_0xded5('0x23'));_0x3b48f7(_0x313065[_0xded5('0x28')]['message']);}})[_0xded5('0x29')](function(_0x5567b9){logger[_0xded5('0x25')](_0xded5('0x26'),_0x1f0763,_0x5567b9);_0x9de293(_0x5567b9);});});}function respondWithStatusCode(_0x86286e,_0x2c3ebc){_0x2c3ebc=_0x2c3ebc||0xcc;return function(_0x521b8d){if(_0x521b8d){return _0x86286e[_0xded5('0x2a')](_0x2c3ebc);}return _0x86286e[_0xded5('0x2b')](_0x2c3ebc)['end']();};}function respondWithResult(_0x34fc90,_0x7dd2a1){_0x7dd2a1=_0x7dd2a1||0xc8;return function(_0x5d133f){if(_0x5d133f){return _0x34fc90['status'](_0x7dd2a1)[_0xded5('0x2c')](_0x5d133f);}};}function respondWithFilteredResult(_0x533ddf,_0x593970){return function(_0x17e4ee){if(_0x17e4ee){var _0x544826=typeof _0x593970['offset']===_0xded5('0x2d')&&typeof _0x593970['limit']==='undefined';var _0xccd52c=_0x17e4ee[_0xded5('0x2e')];var _0x539e46=_0x544826?0x0:_0x593970[_0xded5('0x2f')];var _0x1505e3=_0x544826?_0x17e4ee[_0xded5('0x2e')]:_0x593970[_0xded5('0x2f')]+_0x593970[_0xded5('0x30')];var _0x53b5a5;if(_0x1505e3>=_0xccd52c){_0x1505e3=_0xccd52c;_0x53b5a5=0xc8;}else{_0x53b5a5=0xce;}_0x533ddf['status'](_0x53b5a5);return _0x533ddf[_0xded5('0x31')](_0xded5('0x32'),_0x539e46+'-'+_0x1505e3+'/'+_0xccd52c)[_0xded5('0x2c')](_0x17e4ee);}return null;};}function patchUpdates(_0x2082ef){return function(_0x3845d7){try{jsonpatch[_0xded5('0x33')](_0x3845d7,_0x2082ef,!![]);}catch(_0x507519){return BPromise[_0xded5('0x34')](_0x507519);}return _0x3845d7[_0xded5('0x35')]();};}function saveUpdates(_0x24605f,_0x39e9f7){return function(_0x522b9b){if(_0x522b9b){return _0x522b9b[_0xded5('0x36')](_0x24605f)[_0xded5('0x21')](function(_0x54b982){return _0x54b982;});}return null;};}function removeEntity(_0x22abb9,_0x5ae289){return function(_0x98e082){if(_0x98e082){return _0x98e082[_0xded5('0x37')]()[_0xded5('0x21')](function(){var _0x26e174=_0x98e082[_0xded5('0x38')]({'plain':!![]});var _0x573376='WhatsappAccounts';return db['UserProfileResource'][_0xded5('0x37')]({'where':{'type':_0x573376,'resourceId':_0x26e174['id']}})[_0xded5('0x21')](function(){return _0x98e082;});})['then'](function(){_0x22abb9['status'](0xcc)[_0xded5('0x39')]();});}};}function handleEntityNotFound(_0xfd507a,_0x45a4aa){return function(_0x5197d1){if(!_0x5197d1){_0xfd507a[_0xded5('0x2a')](0x194);}return _0x5197d1;};}function handleError(_0x1f2312,_0x10ae38){_0x10ae38=_0x10ae38||0x1f4;return function(_0x4e9562){logger[_0xded5('0x25')](_0x4e9562[_0xded5('0x3a')]);if(_0x4e9562[_0xded5('0x3b')]){delete _0x4e9562[_0xded5('0x3b')];}_0x1f2312[_0xded5('0x2b')](_0x10ae38)['send'](_0x4e9562);};}exports['index']=function(_0x21905c,_0x35f7b7){var _0xbd488c={'include':[{'model':db[_0xded5('0x3c')],'as':_0xded5('0x3d')}]},_0x29e276={},_0x5bd35e={'count':0x0,'rows':[]};var _0x39a2be=_[_0xded5('0x3e')](db[_0xded5('0x3f')]['rawAttributes'],function(_0x2e4f9f){return{'name':_0x2e4f9f['fieldName'],'type':_0x2e4f9f['type'][_0xded5('0x40')]};});_0x29e276['model']=_[_0xded5('0x3e')](_0x39a2be,'name');_0x29e276[_0xded5('0x41')]=_[_0xded5('0x42')](_0x21905c[_0xded5('0x41')]);_0x29e276['filters']=_['intersection'](_0x29e276[_0xded5('0x43')],_0x29e276[_0xded5('0x41')]);_0xbd488c['attributes']=_[_0xded5('0x44')](_0x29e276[_0xded5('0x43')],qs['fields'](_0x21905c[_0xded5('0x41')][_0xded5('0x45')]));_0xbd488c['attributes']=_0xbd488c[_0xded5('0x46')][_0xded5('0x47')]?_0xbd488c[_0xded5('0x46')]:_0x29e276[_0xded5('0x43')];if(!_0x21905c['query'][_0xded5('0x48')]('nolimit')){_0xbd488c[_0xded5('0x30')]=qs[_0xded5('0x30')](_0x21905c['query'][_0xded5('0x30')]);_0xbd488c[_0xded5('0x2f')]=qs[_0xded5('0x2f')](_0x21905c['query'][_0xded5('0x2f')]);}_0xbd488c[_0xded5('0x49')]=qs[_0xded5('0x4a')](_0x21905c[_0xded5('0x41')]['sort']);_0xbd488c[_0xded5('0x4b')]=qs[_0xded5('0x4c')](_[_0xded5('0x4d')](_0x21905c[_0xded5('0x41')],_0x29e276['filters']),_0x39a2be);if(_0x21905c['query'][_0xded5('0x4e')]){_0xbd488c[_0xded5('0x4b')]=_['merge'](_0xbd488c[_0xded5('0x4b')],{'$or':_[_0xded5('0x3e')](_0x39a2be,function(_0x25dc84){if(_0x25dc84[_0xded5('0x4f')]!=='VIRTUAL'){var _0x1d9a13={};_0x1d9a13[_0x25dc84[_0xded5('0x3b')]]={'$like':'%'+_0x21905c['query'][_0xded5('0x4e')]+'%'};return _0x1d9a13;}})});}_0xbd488c=_[_0xded5('0x50')]({},_0xbd488c,_0x21905c[_0xded5('0x51')]);var _0x14ec87={'where':_0xbd488c[_0xded5('0x4b')]};return db[_0xded5('0x3f')][_0xded5('0x2e')](_0x14ec87)[_0xded5('0x21')](function(_0x4c42b2){_0x5bd35e[_0xded5('0x2e')]=_0x4c42b2;if(_0x21905c[_0xded5('0x41')]['includeAll']){_0xbd488c[_0xded5('0x52')]=[{'all':!![]}];}return db[_0xded5('0x3f')][_0xded5('0x53')](_0xbd488c);})[_0xded5('0x21')](function(_0x160929){_0x5bd35e[_0xded5('0x54')]=_0x160929;return _0x5bd35e;})[_0xded5('0x21')](respondWithFilteredResult(_0x35f7b7,_0xbd488c))[_0xded5('0x29')](handleError(_0x35f7b7,null));};exports['show']=function(_0x1973d9,_0x3fab11){var _0x2db670={'raw':![],'where':{'id':_0x1973d9[_0xded5('0x55')]['id']},'include':[{'model':db[_0xded5('0x3c')],'as':_0xded5('0x3d')}]},_0xc92b45={};_0xc92b45['model']=_[_0xded5('0x42')](db[_0xded5('0x3f')][_0xded5('0x56')]);_0xc92b45['query']=_[_0xded5('0x42')](_0x1973d9['query']);_0xc92b45['filters']=_['intersection'](_0xc92b45[_0xded5('0x43')],_0xc92b45[_0xded5('0x41')]);_0x2db670[_0xded5('0x46')]=_[_0xded5('0x44')](_0xc92b45[_0xded5('0x43')],qs[_0xded5('0x45')](_0x1973d9[_0xded5('0x41')][_0xded5('0x45')]));_0x2db670[_0xded5('0x46')]=_0x2db670[_0xded5('0x46')][_0xded5('0x47')]?_0x2db670['attributes']:_0xc92b45[_0xded5('0x43')];if(_0x1973d9['query']['includeAll']){_0x2db670[_0xded5('0x52')]=[{'all':!![]}];}_0x2db670=_[_0xded5('0x50')]({},_0x2db670,_0x1973d9[_0xded5('0x51')]);return db[_0xded5('0x3f')][_0xded5('0x57')](_0x2db670)['then'](handleEntityNotFound(_0x3fab11,null))[_0xded5('0x21')](respondWithResult(_0x3fab11,null))[_0xded5('0x29')](handleError(_0x3fab11,null));};exports[_0xded5('0x58')]=function(_0x3cffb5,_0x5a32b6){return db[_0xded5('0x3f')][_0xded5('0x58')](_0x3cffb5['body'],{})[_0xded5('0x21')](function(_0x4ebba7){var _0x24eebd=_0x3cffb5['user']['get']({'plain':!![]});if(!_0x24eebd)throw new Error(_0xded5('0x59'));if(_0x24eebd['role']==='user'){var _0x41c318=_0x4ebba7[_0xded5('0x38')]({'plain':!![]});var _0x382830=_0xded5('0x5a');return db['UserProfileSection'][_0xded5('0x57')]({'where':{'name':_0x382830,'userProfileId':_0x24eebd['userProfileId']},'raw':!![]})[_0xded5('0x21')](function(_0x5dd373){if(_0x5dd373&&_0x5dd373['autoAssociation']===0x0){return db[_0xded5('0x5b')][_0xded5('0x58')]({'name':_0x41c318[_0xded5('0x3b')],'resourceId':_0x41c318['id'],'type':_0x5dd373[_0xded5('0x3b')],'sectionId':_0x5dd373['id']},{})[_0xded5('0x21')](function(){return _0x4ebba7;});}else{return _0x4ebba7;}})[_0xded5('0x29')](function(_0x56ff05){logger[_0xded5('0x25')](_0xded5('0x5c'),_0x56ff05);throw _0x56ff05;});}return _0x4ebba7;})[_0xded5('0x21')](respondWithResult(_0x5a32b6,0xc9))['catch'](handleError(_0x5a32b6,null));};exports[_0xded5('0x36')]=function(_0x2b2243,_0x1dac99){if(_0x2b2243[_0xded5('0x5d')]['id']){delete _0x2b2243['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2b2243[_0xded5('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xded5('0x3d')}]})[_0xded5('0x21')](handleEntityNotFound(_0x1dac99,null))['then'](saveUpdates(_0x2b2243['body'],null))['then'](respondWithResult(_0x1dac99,null))[_0xded5('0x29')](handleError(_0x1dac99,null));};exports['destroy']=function(_0x531caf,_0x2dbef4){return db[_0xded5('0x3f')]['find']({'where':{'id':_0x531caf[_0xded5('0x55')]['id']}})['then'](handleEntityNotFound(_0x2dbef4,null))[_0xded5('0x21')](removeEntity(_0x2dbef4,null))[_0xded5('0x29')](handleError(_0x2dbef4,null));};exports['describe']=function(_0x592a47,_0x550b1e){return db[_0xded5('0x3f')][_0xded5('0x5e')]()[_0xded5('0x21')](respondWithResult(_0x550b1e,null))[_0xded5('0x29')](handleError(_0x550b1e,null));};exports['addDisposition']=function(_0x2c62db,_0x26571d,_0x46c4a9){if(_0x2c62db[_0xded5('0x5d')]['id']){delete _0x2c62db[_0xded5('0x5d')]['id'];}return db[_0xded5('0x3f')][_0xded5('0x57')]({'where':{'id':_0x2c62db[_0xded5('0x55')]['id']}})['then'](handleEntityNotFound(_0x26571d,null))[_0xded5('0x21')](function(_0x3d1c83){if(_0x3d1c83){_0x2c62db[_0xded5('0x5d')]['WhatsappAccountId']=_0x3d1c83['id'];return db[_0xded5('0x5f')][_0xded5('0x58')](_0x2c62db[_0xded5('0x5d')]);}})[_0xded5('0x21')](respondWithResult(_0x26571d,null))[_0xded5('0x29')](handleError(_0x26571d,null));};exports['getDispositions']=function(_0x58199f,_0x3a56e3,_0x14a3d5){var _0x485df1={'raw':![],'where':{}};var _0x839ed7={};var _0x501ffb={'count':0x0,'rows':[]};return db[_0xded5('0x3f')][_0xded5('0x60')]({'where':{'id':_0x58199f[_0xded5('0x55')]['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x3a56e3,null))['then'](function(_0x2d8769){if(_0x2d8769){_0x839ed7[_0xded5('0x43')]=_[_0xded5('0x42')](db['Disposition'][_0xded5('0x56')]);_0x839ed7[_0xded5('0x41')]=_[_0xded5('0x42')](_0x58199f[_0xded5('0x41')]);_0x839ed7[_0xded5('0x4c')]=_[_0xded5('0x44')](_0x839ed7[_0xded5('0x43')],_0x839ed7['query']);_0x485df1[_0xded5('0x46')]=_[_0xded5('0x44')](_0x839ed7['model'],qs[_0xded5('0x45')](_0x58199f[_0xded5('0x41')][_0xded5('0x45')]));_0x485df1[_0xded5('0x46')]=_0x485df1[_0xded5('0x46')]['length']?_0x485df1['attributes']:_0x839ed7[_0xded5('0x43')];if(!_0x58199f['query'][_0xded5('0x48')](_0xded5('0x61'))){_0x485df1[_0xded5('0x30')]=qs['limit'](_0x58199f[_0xded5('0x41')][_0xded5('0x30')]);_0x485df1[_0xded5('0x2f')]=qs[_0xded5('0x2f')](_0x58199f['query'][_0xded5('0x2f')]);}_0x485df1['order']=qs[_0xded5('0x4a')](_0x58199f[_0xded5('0x41')][_0xded5('0x4a')]);_0x485df1[_0xded5('0x4b')]=qs[_0xded5('0x4c')](_[_0xded5('0x4d')](_0x58199f[_0xded5('0x41')],_0x839ed7['filters']));_0x485df1['where']['WhatsappAccountId']=_0x2d8769['id'];if(_0x58199f[_0xded5('0x41')]['filter']){_0x485df1[_0xded5('0x4b')]=_[_0xded5('0x50')](_0x485df1[_0xded5('0x4b')],{'$or':_[_0xded5('0x3e')](_0x485df1['attributes'],function(_0x513d26){var _0x516597={};_0x516597[_0x513d26]={'$like':'%'+_0x58199f['query']['filter']+'%'};return _0x516597;})});}_0x485df1=_['merge']({},_0x485df1,_0x58199f[_0xded5('0x51')]);return db['Disposition']['count']({'where':_0x485df1[_0xded5('0x4b')]})[_0xded5('0x21')](function(_0x218680){_0x501ffb[_0xded5('0x2e')]=_0x218680;if(_0x58199f[_0xded5('0x41')][_0xded5('0x62')]){_0x485df1[_0xded5('0x52')]=[{'all':!![]}];}return db[_0xded5('0x5f')]['findAll'](_0x485df1);})[_0xded5('0x21')](function(_0x1d4fc5){_0x501ffb['rows']=_0x1d4fc5;return _0x501ffb;});}})[_0xded5('0x21')](respondWithFilteredResult(_0x3a56e3,_0x485df1))['catch'](handleError(_0x3a56e3,null));};exports['removeDispositions']=function(_0x3ecfaf,_0x451301,_0x591ce0){return db[_0xded5('0x3f')]['find']({'where':{'id':_0x3ecfaf['params']['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x451301,null))['then'](function(_0x12d6f3){if(_0x12d6f3){return _0x12d6f3['removeDispositions'](_0x3ecfaf[_0xded5('0x41')][_0xded5('0x63')]);}})[_0xded5('0x21')](respondWithStatusCode(_0x451301,null))[_0xded5('0x29')](handleError(_0x451301,null));};exports[_0xded5('0x64')]=function(_0x4a6e1d,_0x271bc0,_0x85c85){if(_0x4a6e1d[_0xded5('0x5d')]['id']){delete _0x4a6e1d['body']['id'];}return db[_0xded5('0x3f')][_0xded5('0x57')]({'where':{'id':_0x4a6e1d[_0xded5('0x55')]['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x271bc0,null))[_0xded5('0x21')](function(_0x59680c){if(_0x59680c){_0x4a6e1d[_0xded5('0x5d')][_0xded5('0x65')]=_0x59680c['id'];return db[_0xded5('0x66')][_0xded5('0x58')](_0x4a6e1d[_0xded5('0x5d')]);}})[_0xded5('0x21')](respondWithResult(_0x271bc0,null))[_0xded5('0x29')](handleError(_0x271bc0,null));};exports[_0xded5('0x67')]=function(_0x59978d,_0x972605,_0x24b18e){var _0x4b0d6a={'raw':![],'where':{}};var _0x59c325={};var _0x29e32e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xded5('0x60')]({'where':{'id':_0x59978d[_0xded5('0x55')]['id']}})['then'](handleEntityNotFound(_0x972605,null))['then'](function(_0x1633fd){if(_0x1633fd){_0x59c325[_0xded5('0x43')]=_['keys'](db[_0xded5('0x66')]['rawAttributes']);_0x59c325[_0xded5('0x41')]=_[_0xded5('0x42')](_0x59978d[_0xded5('0x41')]);_0x59c325[_0xded5('0x4c')]=_[_0xded5('0x44')](_0x59c325[_0xded5('0x43')],_0x59c325['query']);_0x4b0d6a[_0xded5('0x46')]=_[_0xded5('0x44')](_0x59c325[_0xded5('0x43')],qs[_0xded5('0x45')](_0x59978d[_0xded5('0x41')][_0xded5('0x45')]));_0x4b0d6a['attributes']=_0x4b0d6a[_0xded5('0x46')][_0xded5('0x47')]?_0x4b0d6a['attributes']:_0x59c325[_0xded5('0x43')];if(!_0x59978d[_0xded5('0x41')][_0xded5('0x48')](_0xded5('0x61'))){_0x4b0d6a[_0xded5('0x30')]=qs[_0xded5('0x30')](_0x59978d['query']['limit']);_0x4b0d6a[_0xded5('0x2f')]=qs[_0xded5('0x2f')](_0x59978d[_0xded5('0x41')][_0xded5('0x2f')]);}_0x4b0d6a['order']=qs[_0xded5('0x4a')](_0x59978d[_0xded5('0x41')]['sort']);_0x4b0d6a[_0xded5('0x4b')]=qs[_0xded5('0x4c')](_[_0xded5('0x4d')](_0x59978d['query'],_0x59c325['filters']));_0x4b0d6a[_0xded5('0x4b')]['WhatsappAccountId']=_0x1633fd['id'];if(_0x59978d[_0xded5('0x41')][_0xded5('0x4e')]){_0x4b0d6a['where']=_[_0xded5('0x50')](_0x4b0d6a['where'],{'$or':_[_0xded5('0x3e')](_0x4b0d6a[_0xded5('0x46')],function(_0x275133){var _0x4112c7={};_0x4112c7[_0x275133]={'$like':'%'+_0x59978d['query']['filter']+'%'};return _0x4112c7;})});}_0x4b0d6a=_[_0xded5('0x50')]({},_0x4b0d6a,_0x59978d[_0xded5('0x51')]);return db['CannedAnswer'][_0xded5('0x2e')]({'where':_0x4b0d6a[_0xded5('0x4b')]})[_0xded5('0x21')](function(_0x5493e9){_0x29e32e[_0xded5('0x2e')]=_0x5493e9;if(_0x59978d[_0xded5('0x41')][_0xded5('0x62')]){_0x4b0d6a[_0xded5('0x52')]=[{'all':!![]}];}return db[_0xded5('0x66')][_0xded5('0x53')](_0x4b0d6a);})[_0xded5('0x21')](function(_0x3f87f5){_0x29e32e[_0xded5('0x54')]=_0x3f87f5;return _0x29e32e;});}})[_0xded5('0x21')](respondWithFilteredResult(_0x972605,_0x4b0d6a))[_0xded5('0x29')](handleError(_0x972605,null));};exports['removeAnswers']=function(_0xb2041d,_0x5be668,_0x45dd2c){return db[_0xded5('0x3f')][_0xded5('0x57')]({'where':{'id':_0xb2041d['params']['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x5be668,null))[_0xded5('0x21')](function(_0x1c1c2c){if(_0x1c1c2c){return _0x1c1c2c['removeAnswers'](_0xb2041d[_0xded5('0x41')][_0xded5('0x63')]);}})[_0xded5('0x21')](respondWithStatusCode(_0x5be668,null))['catch'](handleError(_0x5be668,null));};exports[_0xded5('0x68')]=function(_0x96abbc,_0x17d282,_0x24f048){return db['WhatsappAccount'][_0xded5('0x57')]({'where':{'id':_0x96abbc['params']['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x17d282,null))[_0xded5('0x21')](function(_0x1c9d1a){if(_0x1c9d1a){return _0x1c9d1a[_0xded5('0x68')](_0x96abbc['body'][_0xded5('0x63')],_[_0xded5('0x69')](_0x96abbc[_0xded5('0x5d')],[_0xded5('0x63'),'id'])||{})[_0xded5('0x6a')](function(_0x48e6c0){for(var _0x3b7c02=0x0;_0x3b7c02<_0x96abbc[_0xded5('0x5d')][_0xded5('0x63')][_0xded5('0x47')];_0x3b7c02+=0x1){socket[_0xded5('0x6b')](_0xded5('0x6c'),{'UserId':Number(_0x96abbc[_0xded5('0x5d')][_0xded5('0x63')][_0x3b7c02]),'WhatsappAccountId':Number(_0x96abbc[_0xded5('0x55')]['id'])});}return _0x48e6c0;});}})[_0xded5('0x21')](respondWithResult(_0x17d282,null))[_0xded5('0x29')](handleError(_0x17d282,null));};exports[_0xded5('0x6d')]=function(_0x3cb61b,_0x3ef28e,_0x363351){return db[_0xded5('0x3f')][_0xded5('0x57')]({'where':{'id':_0x3cb61b[_0xded5('0x55')]['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x3ef28e,null))['then'](function(_0x46d5f2){if(_0x46d5f2){return _0x46d5f2[_0xded5('0x6d')](_0x3cb61b[_0xded5('0x41')][_0xded5('0x63')])[_0xded5('0x21')](function(){if(_[_0xded5('0x6e')](_0x3cb61b[_0xded5('0x41')][_0xded5('0x63')])){for(var _0x14f310=0x0;_0x14f310<_0x3cb61b[_0xded5('0x41')][_0xded5('0x63')][_0xded5('0x47')];_0x14f310+=0x1){socket['emit'](_0xded5('0x6f'),{'UserId':Number(_0x3cb61b[_0xded5('0x41')][_0xded5('0x63')][_0x14f310]),'WhatsappAccountId':Number(_0x3cb61b[_0xded5('0x55')]['id'])});}}else{socket[_0xded5('0x6b')](_0xded5('0x6f'),{'UserId':Number(_0x3cb61b['query'][_0xded5('0x63')]),'WhatsappAccountId':Number(_0x3cb61b[_0xded5('0x55')]['id'])});}});}})[_0xded5('0x21')](respondWithStatusCode(_0x3ef28e,null))[_0xded5('0x29')](handleError(_0x3ef28e,null));};exports['getAgents']=function(_0x3544de,_0x4ab527,_0x17b3a1){var _0x401ef0={};var _0x1a8813={};var _0x32f11e;var _0x5db5f7;return db[_0xded5('0x3f')][_0xded5('0x60')]({'where':{'id':_0x3544de[_0xded5('0x55')]['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x4ab527,null))[_0xded5('0x21')](function(_0x5272c5){if(_0x5272c5){_0x32f11e=_0x5272c5;_0x1a8813[_0xded5('0x43')]=_[_0xded5('0x42')](db['User'][_0xded5('0x56')]);_0x1a8813[_0xded5('0x41')]=_[_0xded5('0x42')](_0x3544de['query']);_0x1a8813[_0xded5('0x4c')]=_[_0xded5('0x44')](_0x1a8813['model'],_0x1a8813[_0xded5('0x41')]);_0x401ef0[_0xded5('0x46')]=_[_0xded5('0x44')](_0x1a8813[_0xded5('0x43')],qs['fields'](_0x3544de[_0xded5('0x41')][_0xded5('0x45')]));_0x401ef0[_0xded5('0x46')]=_0x401ef0[_0xded5('0x46')]['length']?_0x401ef0['attributes']:_0x1a8813['model'];_0x401ef0[_0xded5('0x49')]=qs['sort'](_0x3544de['query'][_0xded5('0x4a')]);_0x401ef0[_0xded5('0x4b')]=qs[_0xded5('0x4c')](_[_0xded5('0x4d')](_0x3544de[_0xded5('0x41')],_0x1a8813[_0xded5('0x4c')]));if(_0x3544de[_0xded5('0x41')]['filter']){_0x401ef0['where']=_[_0xded5('0x50')](_0x401ef0[_0xded5('0x4b')],{'$or':_[_0xded5('0x3e')](_0x401ef0[_0xded5('0x46')],function(_0x585b8c){var _0x57b7f6={};_0x57b7f6[_0x585b8c]={'$like':'%'+_0x3544de['query'][_0xded5('0x4e')]+'%'};return _0x57b7f6;})});}_0x401ef0=_[_0xded5('0x50')]({},_0x401ef0,_0x3544de[_0xded5('0x51')]);return _0x32f11e[_0xded5('0x70')](_0x401ef0);}})[_0xded5('0x21')](function(_0x174928){if(_0x174928){_0x5db5f7=_0x174928[_0xded5('0x47')];if(!_0x3544de[_0xded5('0x41')][_0xded5('0x48')](_0xded5('0x61'))){_0x401ef0[_0xded5('0x30')]=qs[_0xded5('0x30')](_0x3544de['query']['limit']);_0x401ef0['offset']=qs[_0xded5('0x2f')](_0x3544de[_0xded5('0x41')][_0xded5('0x2f')]);}return _0x32f11e[_0xded5('0x70')](_0x401ef0);}})[_0xded5('0x21')](function(_0x352289){if(_0x352289){return _0x352289?{'count':_0x5db5f7,'rows':_0x352289}:null;}})[_0xded5('0x21')](respondWithResult(_0x4ab527,null))[_0xded5('0x29')](handleError(_0x4ab527,null));};exports['addApplications']=function(_0x3e5aa6,_0x4dd087){var _0x2aa81e=_0x3e5aa6[_0xded5('0x55')]['id'];var _0x2f2333=_0x3e5aa6['body'];var _0x4e4bd8=0xc8;var _0x4f7937=null;return db[_0xded5('0x71')][_0xded5('0x72')]({'isolationLevel':db[_0xded5('0x71')][_0xded5('0x73')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4c4d0e){return db[_0xded5('0x3f')][_0xded5('0x60')]({'where':{'id':_0x2aa81e},'transaction':_0x4c4d0e})[_0xded5('0x21')](function(_0x28a34b){if(_0x28a34b){return db[_0xded5('0x74')]['destroy']({'where':{'WhatsappAccountId':_0x2aa81e},'transaction':_0x4c4d0e})['then'](function(){var _0x1e7547=_['map'](_0x2f2333,function(_0x2a1487){_0x2a1487[_0xded5('0x65')]=_0x2aa81e;return _0x2a1487;});return db['WhatsappApplication'][_0xded5('0x75')](_0x1e7547,{'transaction':_0x4c4d0e});});}else{_0x4e4bd8=0x194;_0x4f7937=[];}});})[_0xded5('0x21')](function(){if(_0x4e4bd8!==0x194){return db[_0xded5('0x74')][_0xded5('0x76')]({'where':{'WhatsappAccountId':_0x2aa81e},'order':_0xded5('0x77')})[_0xded5('0x21')](function(_0x2e8e69){_0x4f7937=_0x2e8e69;});}})[_0xded5('0x29')](function(_0x485f62){_0x4e4bd8=0x1f4;logger[_0xded5('0x25')](_0x485f62[_0xded5('0x3a')]);if(_0x485f62['name']){delete _0x485f62[_0xded5('0x3b')];}_0x4f7937=_0x485f62;})[_0xded5('0x78')](function(){if(_0x4f7937===null){_0x4dd087[_0xded5('0x2a')](_0x4e4bd8);}else{if(_0x4e4bd8===0x1f4){_0x4dd087['status'](_0x4e4bd8)[_0xded5('0x79')](_0x4f7937);}else{_0x4dd087[_0xded5('0x2b')](_0x4e4bd8)['json'](_0x4f7937);}}});};exports[_0xded5('0x7a')]=function(_0x2b0b5c,_0x4e9f4e,_0xfde21a){var _0x72c352={};var _0x4bc820={};var _0x68731f;var _0x54017d;return db[_0xded5('0x3f')][_0xded5('0x60')]({'where':{'id':_0x2b0b5c[_0xded5('0x55')]['id']}})[_0xded5('0x21')](handleEntityNotFound(_0x4e9f4e,null))[_0xded5('0x21')](function(_0x125504){if(_0x125504){_0x68731f=_0x125504;_0x4bc820[_0xded5('0x43')]=_[_0xded5('0x42')](db[_0xded5('0x74')][_0xded5('0x56')]);_0x4bc820['query']=_[_0xded5('0x42')](_0x2b0b5c['query']);_0x4bc820[_0xded5('0x4c')]=_[_0xded5('0x44')](_0x4bc820[_0xded5('0x43')],_0x4bc820[_0xded5('0x41')]);_0x72c352[_0xded5('0x46')]=_[_0xded5('0x44')](_0x4bc820[_0xded5('0x43')],qs[_0xded5('0x45')](_0x2b0b5c[_0xded5('0x41')][_0xded5('0x45')]));_0x72c352['attributes']=_0x72c352[_0xded5('0x46')][_0xded5('0x47')]?_0x72c352[_0xded5('0x46')]:_0x4bc820[_0xded5('0x43')];_0x72c352[_0xded5('0x49')]=qs['sort'](_0x2b0b5c[_0xded5('0x41')]['sort']);_0x72c352[_0xded5('0x4b')]=qs[_0xded5('0x4c')](_[_0xded5('0x4d')](_0x2b0b5c[_0xded5('0x41')],_0x4bc820[_0xded5('0x4c')]));if(_0x2b0b5c[_0xded5('0x41')]['filter']){_0x72c352[_0xded5('0x4b')]=_[_0xded5('0x50')](_0x72c352[_0xded5('0x4b')],{'$or':_[_0xded5('0x3e')](_0x72c352[_0xded5('0x46')],function(_0x2102be){var _0x42cc4f={};_0x42cc4f[_0x2102be]={'$like':'%'+_0x2b0b5c[_0xded5('0x41')][_0xded5('0x4e')]+'%'};return _0x42cc4f;})});}_0x72c352=_[_0xded5('0x50')]({},_0x72c352,_0x2b0b5c[_0xded5('0x51')]);return _0x68731f[_0xded5('0x7a')](_0x72c352);}})[_0xded5('0x21')](function(_0x3634af){if(_0x3634af){_0x54017d=_0x3634af['length'];if(!_0x2b0b5c[_0xded5('0x41')][_0xded5('0x48')]('nolimit')){_0x72c352[_0xded5('0x30')]=qs[_0xded5('0x30')](_0x2b0b5c[_0xded5('0x41')]['limit']);_0x72c352['offset']=qs['offset'](_0x2b0b5c[_0xded5('0x41')][_0xded5('0x2f')]);}return _0x68731f[_0xded5('0x7a')](_0x72c352);}})[_0xded5('0x21')](function(_0x477eae){if(_0x477eae){return _0x477eae?{'count':_0x54017d,'rows':_0x477eae}:null;}})[_0xded5('0x21')](respondWithResult(_0x4e9f4e,null))[_0xded5('0x29')](handleError(_0x4e9f4e,null));};exports['notify']=function(_0x28962d,_0x1a823d,_0x532840){var _0x4be877={'channel':_0xded5('0x7b')};var _0x11e431=[];var _0x985f80=[];var _0x2ce83e={};return db[_0xded5('0x3f')][_0xded5('0x57')]({'where':{'id':_0x28962d[_0xded5('0x55')]['id']},'include':[{'model':db[_0xded5('0x74')],'as':'Applications'}]})[_0xded5('0x21')](handleEntityNotFound(_0x1a823d,null))['then'](function(_0x5ce85a){_0x4be877['account']=_0x5ce85a;if(_0x4be877[_0xded5('0x7c')]&&_0x4be877[_0xded5('0x7c')]['type']===_0xded5('0x7d')&&_0x28962d[_0xded5('0x5d')][_0xded5('0x7e')]){if(_0x28962d[_0xded5('0x5d')]['statuses'][_0xded5('0x47')]===0x0)return;if(_0x28962d['body'][_0xded5('0x7e')][0x0][_0xded5('0x7f')]!==_0xded5('0x80'))return;return db[_0xded5('0x81')][_0xded5('0x36')]({'read':!![],'readAt':_0x28962d[_0xded5('0x5d')][_0xded5('0x7e')][0x0][_0xded5('0x82')]},{'where':{'messageId':_0x28962d[_0xded5('0x5d')]['statuses'][0x0][_0xded5('0x83')]},'individualHooks':!![]})['then'](function(_0x3f671e){return _0x1a823d[_0xded5('0x2b')](0xc8)[_0xded5('0x2c')](_0x3f671e);});}_0x4be877[_0xded5('0x84')]=_[_0xded5('0x85')](_0x5ce85a[_0xded5('0x86')],[_0xded5('0x77')],['asc']);if(_0x4be877['account'][_0xded5('0x86')]){delete _0x4be877['account'][_0xded5('0x86')];}return db['CmContact'][_0xded5('0x5e')]()[_0xded5('0x21')](function(_0x1ed9a3){if(!_0x1ed9a3){throw new db[(_0xded5('0x87'))][(_0xded5('0x88'))](_0xded5('0x89'));}_0x11e431=_['difference'](_[_0xded5('0x42')](_0x1ed9a3),[_0xded5('0x8a'),_0xded5('0x8b')]);_0x985f80=_[_0xded5('0x8c')](_[_0xded5('0x42')](_0x1ed9a3),[_0xded5('0x8a'),_0xded5('0x8b'),_0xded5('0x8d'),_0xded5('0x8e')]);_0x4be877[_0xded5('0x5d')]={'mapKey':_0xded5('0x8f')};if(_0x4be877[_0xded5('0x7c')]&&_0x4be877[_0xded5('0x7c')]['type']===_0xded5('0x90')){_0x4be877[_0xded5('0x5d')][_0xded5('0x91')]=_0x28962d[_0xded5('0x5d')][_0xded5('0x92')][_0xded5('0x93')](_0xded5('0x94'),'');_0x4be877[_0xded5('0x5d')][_0xded5('0x5d')]=_0x28962d[_0xded5('0x5d')][_0xded5('0x95')];_0x4be877[_0xded5('0x5d')]['messageId']=_0x28962d['body'][_0xded5('0x96')];}if(_0x4be877[_0xded5('0x7c')]&&_0x4be877['account'][_0xded5('0x4f')]===_0xded5('0x7d')){_0x4be877[_0xded5('0x5d')][_0xded5('0x91')]=_0x28962d[_0xded5('0x5d')][_0xded5('0x97')][0x0]['from'];_0x4be877[_0xded5('0x5d')]['body']=_0x28962d[_0xded5('0x5d')][_0xded5('0x97')][0x0]['message'][_0xded5('0x5d')];_0x4be877['body'][_0xded5('0x98')]=_0x28962d[_0xded5('0x5d')][_0xded5('0x97')][0x0]['message_id'];}if(_0x4be877[_0xded5('0x5d')]['id']){delete _0x4be877[_0xded5('0x5d')]['id'];}if(_['isNil'](_0x4be877[_0xded5('0x5d')][_0xded5('0x91')])){throw new db[(_0xded5('0x87'))][(_0xded5('0x88'))](_0xded5('0x99'));}if(_[_0xded5('0x9a')](_0x4be877[_0xded5('0x5d')][_0xded5('0x5d')])||_0x4be877[_0xded5('0x5d')]['body']===''){throw new db[(_0xded5('0x87'))][(_0xded5('0x88'))](_0xded5('0x9b'));}if(_[_0xded5('0x9a')](_0x4be877[_0xded5('0x5d')][_0xded5('0x9c')])){throw new db[(_0xded5('0x87'))][(_0xded5('0x88'))](_0xded5('0x9d')+_0x985f80);}if(!_[_0xded5('0x9e')](_0x985f80,_0x4be877['body'][_0xded5('0x9c')])){throw new db[(_0xded5('0x87'))][(_0xded5('0x88'))](_0xded5('0x9f')+_0x985f80);}_0x2ce83e[_0x4be877[_0xded5('0x5d')][_0xded5('0x9c')]]=_0x4be877['body'][_0xded5('0x91')];return db[_0xded5('0xa0')]['find']({'where':{'id':_0x4be877[_0xded5('0x7c')][_0xded5('0x8e')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2ce83e,'limit':0x1,'order':[[_0xded5('0x8b'),'DESC']]}]});})[_0xded5('0x21')](handleEntityNotFound(_0x1a823d,null))[_0xded5('0x21')](function(_0x244d15){if(_0x244d15){_0x4be877['list']=_[_0xded5('0x69')](_0x244d15,[_0xded5('0xa1')]);if(_0x244d15[_0xded5('0xa1')][_0xded5('0x47')]){return _0x244d15[_0xded5('0xa1')][0x0];}var _0x8779b0=_[_0xded5('0x19')](_0x4be877[_0xded5('0x5d')],{'firstName':_0x4be877[_0xded5('0x5d')][_0xded5('0x91')],'ListId':_0x244d15['id']});_0x8779b0[_0x4be877[_0xded5('0x5d')][_0xded5('0x9c')]]=_0x4be877['body'][_0xded5('0x91')];return db[_0xded5('0xa2')][_0xded5('0x58')](_0x8779b0,{'fields':_0x11e431,'raw':!![]});}})[_0xded5('0x21')](handleEntityNotFound(_0x1a823d,null))[_0xded5('0x21')](function(_0x2b83a7){if(_0x2b83a7){_0x4be877[_0xded5('0xa3')]=_0x2b83a7;var _0x5e757c={'ContactId':_0x2b83a7['id'],'phone':_0x4be877[_0xded5('0x5d')][_0xded5('0x91')],'WhatsappAccountId':_0x28962d[_0xded5('0x55')]['id']};var _0x3bf900={'ContactId':_0x2b83a7['id'],'WhatsappAccountId':_0x28962d[_0xded5('0x55')]['id'],'closed':![]};return db[_0xded5('0xa4')]['find']({'where':_0x3bf900})[_0xded5('0x21')](function(_0x41a3c8){if(_0x41a3c8){return[_0x41a3c8,![]];}return db[_0xded5('0xa4')]['create'](_0x5e757c)['then'](function(_0x504717){return[_0x504717,!![]];});});}})[_0xded5('0x6a')](function(_0x293142,_0x46ed7a){_0x4be877[_0xded5('0xa5')]=_0x293142[_0xded5('0x38')]({'plain':!![]});_0x4be877[_0xded5('0xa5')][_0xded5('0xa6')]=![];if(_0x46ed7a){if(_0x4be877[_0xded5('0x7c')][_0xded5('0xa7')]){_0x4be877[_0xded5('0x84')][_0xded5('0xa8')]({'id':0x0,'priority':_0x4be877[_0xded5('0x84')][_0xded5('0x47')]+0x1,'app':_0xded5('0xa9'),'appdata':_0xded5('0xaa'),'interval':'*,*,*,*'});}_0x4be877[_0xded5('0xa5')][_0xded5('0xa6')]=!![];}return db[_0xded5('0x81')][_0xded5('0x58')]({'phone':_0x4be877[_0xded5('0x5d')][_0xded5('0x91')],'messageId':_0x4be877['body'][_0xded5('0x98')],'body':_0x4be877[_0xded5('0x5d')][_0xded5('0x5d')],'WhatsappAccountId':_0x28962d[_0xded5('0x55')]['id'],'WhatsappInteractionId':_0x293142['id'],'direction':'in','ContactId':_0x293142[_0xded5('0xab')],'AttachmentId':_0x4be877[_0xded5('0x5d')]['AttachmentId']});})[_0xded5('0x21')](function(_0x17946f){_0x4be877[_0xded5('0x27')]=_0x17946f;if(_0x4be877[_0xded5('0xa5')]['UserId']){return db['User'][_0xded5('0x57')]({'attributes':['id',_0xded5('0x3b')],'where':{'id':_0x4be877['interaction'][_0xded5('0xac')]}})[_0xded5('0x21')](function(_0x14e18c){if(_0x14e18c){_0x4be877[_0xded5('0x84')][_0xded5('0xad')]({'id':0x0,'priority':0x0,'app':_0xded5('0xae'),'appdata':_0x14e18c['name']+','+(_0x4be877['account'][_0xded5('0xaf')]||0xa),'interval':_0xded5('0xb0')});}return respondWithRpcPromise(_0xded5('0xb1'),_0xded5('0xb2'),_0x4be877);});}return respondWithRpcPromise(_0xded5('0xb1'),_0xded5('0xb2'),_0x4be877);})[_0xded5('0x21')](function(_0x2b449a){if(_0x2b449a){var _0x1ee707=0xc8;var _0x561586='receiveMessage';logger[_0xded5('0x22')](_0xded5('0x24'),_0x561586,_0x1ee707,_0xded5('0xb3'));logger[_0xded5('0xb4')](_0xded5('0xb5'),_0x561586,_0x1ee707,_0xded5('0xb3'),JSON[_0xded5('0xb6')](_0x2b449a));if(_0x4be877[_0xded5('0x7c')][_0xded5('0x4f')]===_0xded5('0x90')){return _0x1a823d[_0xded5('0x2b')](_0x1ee707)[_0xded5('0x31')](_0xded5('0xb7'),_0xded5('0xb8'))['send'](_0xded5('0xb9'));}else{return _0x1a823d[_0xded5('0x2b')](_0x1ee707)[_0xded5('0x2c')](_0x2b449a);}}});})[_0xded5('0x29')](handleError(_0x1a823d,null));};exports[_0xded5('0x79')]=function(_0x2bceb6,_0x231596,_0x3b7ade){var _0x4d292e,_0x2f5fed,_0x3fe74f;if(_[_0xded5('0x9a')](_0x2bceb6[_0xded5('0x5d')][_0xded5('0x5d')])||_0x2bceb6[_0xded5('0x5d')][_0xded5('0x5d')]===''){throw new db[(_0xded5('0x87'))][(_0xded5('0x88'))](_0xded5('0x9b'));}if(_['isNil'](_0x2bceb6['body']['to'])){throw new db[(_0xded5('0x87'))][(_0xded5('0x88'))](_0xded5('0xba'));}_0x4d292e=_0x2bceb6['body']['to'];return db['WhatsappAccount'][_0xded5('0x57')]({'where':{'id':_0x2bceb6[_0xded5('0x55')]['id']},'include':[{'model':db[_0xded5('0xa0')],'as':_0xded5('0xbb'),'include':[{'model':db[_0xded5('0xa2')],'as':_0xded5('0xa1'),'where':{'mobile':_0x4d292e},'limit':0x1,'order':[[_0xded5('0x8b'),_0xded5('0xbc')]]}]}]})[_0xded5('0x21')](handleEntityNotFound(_0x231596,null))['then'](function(_0x112cb0){if(_0x112cb0&&_0x112cb0[_0xded5('0xbb')]){_0x2f5fed=_0x112cb0[_0xded5('0x38')]({'plain':!![]});if(_0x2f5fed['List']&&_0x2f5fed['List']['Contacts'][_0xded5('0x47')]){return _0x2f5fed['List'][_0xded5('0xa1')][0x0];}return db[_0xded5('0xa2')]['create'](_[_0xded5('0x19')](_0x2bceb6[_0xded5('0x5d')],{'firstName':_0x4d292e,'mobile':_0x4d292e,'phone':_0x4d292e,'ListId':_0x2f5fed['ListId']}));}})['then'](handleEntityNotFound(_0x231596,null))[_0xded5('0x21')](function(_0x202d94){if(_0x202d94){_0x3fe74f=_0x202d94;return db['WhatsappInteraction'][_0xded5('0x57')]({'where':{'ContactId':_0x3fe74f['id'],'closed':![],'WhatsappAccountId':_0x2f5fed['id']}})[_0xded5('0x21')](function(_0x19410c){if(_0x19410c){return[_0x19410c,![]];}return db[_0xded5('0xa4')][_0xded5('0x58')]({'UserId':_0x2bceb6['user']['id'],'ContactId':_0x3fe74f['id'],'WhatsappAccountId':_0x2f5fed['id'],'phone':_0x4d292e,'firstMsgDirection':_0xded5('0xbd'),'Messages':[_[_0xded5('0x50')](_0x2bceb6[_0xded5('0x5d')],{'read':![],'body':_0x2bceb6[_0xded5('0x5d')]['body'],'phone':_0x4d292e,'WhatsappAccountId':_0x2f5fed['id'],'UserId':_0x2bceb6['user']['id'],'ContactId':_0x3fe74f['id']})]},{'include':[{'model':db[_0xded5('0x81')],'as':'Messages'}]})[_0xded5('0x21')](function(_0x50b0eb){return[_0x50b0eb,!![]];});});}})['spread'](function(_0x1dbd3f,_0x4432f1){if(_0x4432f1){return _0x1dbd3f;}return db[_0xded5('0x81')][_0xded5('0x58')](_[_0xded5('0x50')](_0x2bceb6[_0xded5('0x5d')],{'read':![],'body':_0x2bceb6[_0xded5('0x5d')][_0xded5('0x5d')],'phone':_0x4d292e,'WhatsappAccountId':_0x2f5fed['id'],'WhatsappInteractionId':_0x1dbd3f['id'],'UserId':_0x2bceb6['user']['id'],'ContactId':_0x3fe74f['id']}))[_0xded5('0x21')](function(_0x4815e8){_0x1dbd3f['dataValues'][_0xded5('0xbe')]=[];_0x1dbd3f[_0xded5('0xbf')]['Messages']['push'](_0x4815e8[_0xded5('0xbf')]);return _0x1dbd3f;});})[_0xded5('0x21')](respondWithResult(_0x231596,null))[_0xded5('0x29')](handleError(_0x231596,null));}; \ No newline at end of file +var _0x906b=['Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','spread','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','user','role','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','ContactId','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s'];(function(_0x675dfd,_0x113543){var _0x9dcdd6=function(_0xd70298){while(--_0xd70298){_0x675dfd['push'](_0x675dfd['shift']());}};_0x9dcdd6(++_0x113543);}(_0x906b,0x18e));var _0xb906=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x906b[_0x22cb5f];return _0x274d36;};'use strict';var emlformat=require(_0xb906('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb906('0x1'));var jsonpatch=require(_0xb906('0x2'));var rp=require(_0xb906('0x3'));var moment=require(_0xb906('0x4'));var BPromise=require(_0xb906('0x5'));var Mustache=require('mustache');var util=require(_0xb906('0x6'));var path=require(_0xb906('0x7'));var sox=require(_0xb906('0x8'));var csv=require(_0xb906('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb906('0xa'));var _=require(_0xb906('0xb'));var squel=require(_0xb906('0xc'));var crypto=require('crypto');var jsforce=require(_0xb906('0xd'));var deskjs=require(_0xb906('0xe'));var toCsv=require(_0xb906('0x9'));var querystring=require('querystring');var Papa=require(_0xb906('0xf'));var Redis=require(_0xb906('0x10'));var authService=require(_0xb906('0x11'));var qs=require(_0xb906('0x12'));var as=require(_0xb906('0x13'));var hardwareService=require(_0xb906('0x14'));var logger=require(_0xb906('0x15'))(_0xb906('0x16'));var utils=require('../../config/utils');var config=require(_0xb906('0x17'));var licenseUtil=require(_0xb906('0x18'));var db=require(_0xb906('0x19'))['db'];config[_0xb906('0x1a')]=_[_0xb906('0x1b')](config[_0xb906('0x1a')],{'host':_0xb906('0x1c'),'port':0x18eb});var socket=require(_0xb906('0x1d'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xb906('0x1e')](socket);var jayson=require(_0xb906('0x1f'));var client=jayson['client'][_0xb906('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x17fe01,_0x4d7009,_0x5cb157,_0x4432da){return new BPromise(function(_0xcb817f,_0x5bb1f2){var _0xfb0653=_0x4432da||client;return _0xfb0653['request'](_0x17fe01,_0x5cb157)['then'](function(_0x2bba08){logger[_0xb906('0x21')](_0xb906('0x22'),_0x4d7009,_0xb906('0x23'));logger[_0xb906('0x24')](_0xb906('0x25'),_0x4d7009,'request\x20sent',JSON[_0xb906('0x26')](_0x2bba08));if(_0x2bba08[_0xb906('0x27')]){if(_0x2bba08[_0xb906('0x27')]['code']===0x1f4){logger[_0xb906('0x27')](_0xb906('0x22'),_0x4d7009,_0x2bba08[_0xb906('0x27')]['message']);return _0x5bb1f2(_0x2bba08[_0xb906('0x27')]['message']);}logger[_0xb906('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x4d7009,_0x2bba08[_0xb906('0x27')][_0xb906('0x28')]);return _0xcb817f(_0x2bba08[_0xb906('0x27')]['message']);}else{logger['info'](_0xb906('0x22'),_0x4d7009,_0xb906('0x23'));_0xcb817f(_0x2bba08[_0xb906('0x29')][_0xb906('0x28')]);}})['catch'](function(_0x2cb3d4){logger[_0xb906('0x27')](_0xb906('0x22'),_0x4d7009,_0x2cb3d4);_0x5bb1f2(_0x2cb3d4);});});}function respondWithStatusCode(_0xdd3800,_0x10beed){_0x10beed=_0x10beed||0xcc;return function(_0xe835e6){if(_0xe835e6){return _0xdd3800[_0xb906('0x2a')](_0x10beed);}return _0xdd3800[_0xb906('0x2b')](_0x10beed)[_0xb906('0x2c')]();};}function respondWithResult(_0x157a27,_0x4ba1e4){_0x4ba1e4=_0x4ba1e4||0xc8;return function(_0x488da6){if(_0x488da6){return _0x157a27[_0xb906('0x2b')](_0x4ba1e4)[_0xb906('0x2d')](_0x488da6);}};}function respondWithFilteredResult(_0x597015,_0x196b35){return function(_0x2b9818){if(_0x2b9818){var _0x2eee4b=typeof _0x196b35[_0xb906('0x2e')]===_0xb906('0x2f')&&typeof _0x196b35['limit']==='undefined';var _0x170c03=_0x2b9818[_0xb906('0x30')];var _0x21412d=_0x2eee4b?0x0:_0x196b35[_0xb906('0x2e')];var _0x1e28bf=_0x2eee4b?_0x2b9818[_0xb906('0x30')]:_0x196b35[_0xb906('0x2e')]+_0x196b35[_0xb906('0x31')];var _0x8d8620;if(_0x1e28bf>=_0x170c03){_0x1e28bf=_0x170c03;_0x8d8620=0xc8;}else{_0x8d8620=0xce;}_0x597015[_0xb906('0x2b')](_0x8d8620);return _0x597015[_0xb906('0x32')](_0xb906('0x33'),_0x21412d+'-'+_0x1e28bf+'/'+_0x170c03)[_0xb906('0x2d')](_0x2b9818);}return null;};}function patchUpdates(_0x2eecc8){return function(_0x52c459){try{jsonpatch[_0xb906('0x34')](_0x52c459,_0x2eecc8,!![]);}catch(_0x77c48f){return BPromise[_0xb906('0x35')](_0x77c48f);}return _0x52c459[_0xb906('0x36')]();};}function saveUpdates(_0x271753,_0x59e4db){return function(_0x47bc78){if(_0x47bc78){return _0x47bc78['update'](_0x271753)[_0xb906('0x37')](function(_0x3ee45b){return _0x3ee45b;});}return null;};}function removeEntity(_0x5ecec0,_0x176577){return function(_0x13a8e5){if(_0x13a8e5){return _0x13a8e5[_0xb906('0x38')]()[_0xb906('0x37')](function(){var _0x24d0ce=_0x13a8e5[_0xb906('0x39')]({'plain':!![]});var _0xccafb3='WhatsappAccounts';return db[_0xb906('0x3a')]['destroy']({'where':{'type':_0xccafb3,'resourceId':_0x24d0ce['id']}})[_0xb906('0x37')](function(){return _0x13a8e5;});})[_0xb906('0x37')](function(){_0x5ecec0[_0xb906('0x2b')](0xcc)[_0xb906('0x2c')]();});}};}function handleEntityNotFound(_0x312858,_0x96f250){return function(_0x474e29){if(!_0x474e29){_0x312858['sendStatus'](0x194);}return _0x474e29;};}function handleError(_0x4c6dd9,_0x5ab0df){_0x5ab0df=_0x5ab0df||0x1f4;return function(_0x2fda15){logger['error'](_0x2fda15[_0xb906('0x3b')]);if(_0x2fda15['name']){delete _0x2fda15[_0xb906('0x3c')];}_0x4c6dd9[_0xb906('0x2b')](_0x5ab0df)[_0xb906('0x3d')](_0x2fda15);};}exports[_0xb906('0x3e')]=function(_0x266efb,_0x5f4486){var _0x353ad0={'include':[{'model':db['Pause'],'as':_0xb906('0x3f')}]},_0x52d5d8={},_0xd0242e={'count':0x0,'rows':[]};var _0x44edd1=_[_0xb906('0x40')](db[_0xb906('0x41')][_0xb906('0x42')],function(_0x422706){return{'name':_0x422706['fieldName'],'type':_0x422706[_0xb906('0x43')]['key']};});_0x52d5d8[_0xb906('0x44')]=_[_0xb906('0x40')](_0x44edd1,'name');_0x52d5d8['query']=_[_0xb906('0x45')](_0x266efb[_0xb906('0x46')]);_0x52d5d8[_0xb906('0x47')]=_[_0xb906('0x48')](_0x52d5d8[_0xb906('0x44')],_0x52d5d8[_0xb906('0x46')]);_0x353ad0['attributes']=_[_0xb906('0x48')](_0x52d5d8[_0xb906('0x44')],qs[_0xb906('0x49')](_0x266efb[_0xb906('0x46')][_0xb906('0x49')]));_0x353ad0[_0xb906('0x4a')]=_0x353ad0[_0xb906('0x4a')][_0xb906('0x4b')]?_0x353ad0[_0xb906('0x4a')]:_0x52d5d8[_0xb906('0x44')];if(!_0x266efb[_0xb906('0x46')]['hasOwnProperty'](_0xb906('0x4c'))){_0x353ad0['limit']=qs[_0xb906('0x31')](_0x266efb['query'][_0xb906('0x31')]);_0x353ad0[_0xb906('0x2e')]=qs[_0xb906('0x2e')](_0x266efb[_0xb906('0x46')][_0xb906('0x2e')]);}_0x353ad0[_0xb906('0x4d')]=qs[_0xb906('0x4e')](_0x266efb[_0xb906('0x46')][_0xb906('0x4e')]);_0x353ad0[_0xb906('0x4f')]=qs[_0xb906('0x47')](_[_0xb906('0x50')](_0x266efb['query'],_0x52d5d8[_0xb906('0x47')]),_0x44edd1);if(_0x266efb['query'][_0xb906('0x51')]){_0x353ad0['where']=_[_0xb906('0x52')](_0x353ad0['where'],{'$or':_['map'](_0x44edd1,function(_0x25c662){if(_0x25c662[_0xb906('0x43')]!==_0xb906('0x53')){var _0x9f0ba1={};_0x9f0ba1[_0x25c662[_0xb906('0x3c')]]={'$like':'%'+_0x266efb[_0xb906('0x46')]['filter']+'%'};return _0x9f0ba1;}})});}_0x353ad0=_['merge']({},_0x353ad0,_0x266efb[_0xb906('0x54')]);var _0x3c81f5={'where':_0x353ad0[_0xb906('0x4f')]};return db['WhatsappAccount'][_0xb906('0x30')](_0x3c81f5)['then'](function(_0xe3426){_0xd0242e[_0xb906('0x30')]=_0xe3426;if(_0x266efb[_0xb906('0x46')]['includeAll']){_0x353ad0[_0xb906('0x55')]=[{'all':!![]}];}return db[_0xb906('0x41')][_0xb906('0x56')](_0x353ad0);})[_0xb906('0x37')](function(_0x3efc49){_0xd0242e[_0xb906('0x57')]=_0x3efc49;return _0xd0242e;})['then'](respondWithFilteredResult(_0x5f4486,_0x353ad0))['catch'](handleError(_0x5f4486,null));};exports['show']=function(_0x76929b,_0x560f51){var _0x4a87dd={'raw':![],'where':{'id':_0x76929b[_0xb906('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x39239f={};_0x39239f['model']=_[_0xb906('0x45')](db[_0xb906('0x41')]['rawAttributes']);_0x39239f[_0xb906('0x46')]=_['keys'](_0x76929b[_0xb906('0x46')]);_0x39239f[_0xb906('0x47')]=_['intersection'](_0x39239f[_0xb906('0x44')],_0x39239f[_0xb906('0x46')]);_0x4a87dd[_0xb906('0x4a')]=_['intersection'](_0x39239f[_0xb906('0x44')],qs[_0xb906('0x49')](_0x76929b[_0xb906('0x46')][_0xb906('0x49')]));_0x4a87dd[_0xb906('0x4a')]=_0x4a87dd[_0xb906('0x4a')][_0xb906('0x4b')]?_0x4a87dd['attributes']:_0x39239f['model'];if(_0x76929b[_0xb906('0x46')][_0xb906('0x59')]){_0x4a87dd[_0xb906('0x55')]=[{'all':!![]}];}_0x4a87dd=_['merge']({},_0x4a87dd,_0x76929b['options']);return db['WhatsappAccount'][_0xb906('0x5a')](_0x4a87dd)[_0xb906('0x37')](handleEntityNotFound(_0x560f51,null))[_0xb906('0x37')](respondWithResult(_0x560f51,null))[_0xb906('0x5b')](handleError(_0x560f51,null));};exports[_0xb906('0x5c')]=function(_0x5c002c,_0x1887f5){return db[_0xb906('0x41')][_0xb906('0x5c')](_0x5c002c[_0xb906('0x5d')],{})[_0xb906('0x37')](function(_0x53ca74){var _0x3aaeb2=_0x5c002c[_0xb906('0x5e')][_0xb906('0x39')]({'plain':!![]});if(!_0x3aaeb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3aaeb2[_0xb906('0x5f')]===_0xb906('0x5e')){var _0x38c212=_0x53ca74['get']({'plain':!![]});var _0x5d9fca=_0xb906('0x60');return db[_0xb906('0x61')][_0xb906('0x5a')]({'where':{'name':_0x5d9fca,'userProfileId':_0x3aaeb2[_0xb906('0x62')]},'raw':!![]})['then'](function(_0xb29885){if(_0xb29885&&_0xb29885['autoAssociation']===0x0){return db['UserProfileResource'][_0xb906('0x5c')]({'name':_0x38c212[_0xb906('0x3c')],'resourceId':_0x38c212['id'],'type':_0xb29885[_0xb906('0x3c')],'sectionId':_0xb29885['id']},{})[_0xb906('0x37')](function(){return _0x53ca74;});}else{return _0x53ca74;}})['catch'](function(_0xce8472){logger['error'](_0xb906('0x63'),_0xce8472);throw _0xce8472;});}return _0x53ca74;})[_0xb906('0x37')](respondWithResult(_0x1887f5,0xc9))[_0xb906('0x5b')](handleError(_0x1887f5,null));};exports[_0xb906('0x64')]=function(_0x8569bd,_0xa2a24){if(_0x8569bd[_0xb906('0x5d')]['id']){delete _0x8569bd[_0xb906('0x5d')]['id'];}return db[_0xb906('0x41')][_0xb906('0x5a')]({'where':{'id':_0x8569bd[_0xb906('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xb906('0x3f')}]})[_0xb906('0x37')](handleEntityNotFound(_0xa2a24,null))[_0xb906('0x37')](saveUpdates(_0x8569bd[_0xb906('0x5d')],null))[_0xb906('0x37')](respondWithResult(_0xa2a24,null))[_0xb906('0x5b')](handleError(_0xa2a24,null));};exports[_0xb906('0x38')]=function(_0x37c1af,_0x598449){return db[_0xb906('0x41')]['find']({'where':{'id':_0x37c1af[_0xb906('0x58')]['id']}})['then'](handleEntityNotFound(_0x598449,null))[_0xb906('0x37')](removeEntity(_0x598449,null))[_0xb906('0x5b')](handleError(_0x598449,null));};exports[_0xb906('0x65')]=function(_0x29b48b,_0xf59935){return db[_0xb906('0x41')][_0xb906('0x65')]()['then'](respondWithResult(_0xf59935,null))[_0xb906('0x5b')](handleError(_0xf59935,null));};exports[_0xb906('0x66')]=function(_0x5b7fd9,_0x4a3a9c,_0x467550){if(_0x5b7fd9['body']['id']){delete _0x5b7fd9[_0xb906('0x5d')]['id'];}return db[_0xb906('0x41')][_0xb906('0x5a')]({'where':{'id':_0x5b7fd9[_0xb906('0x58')]['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x4a3a9c,null))[_0xb906('0x37')](function(_0xdf09be){if(_0xdf09be){_0x5b7fd9[_0xb906('0x5d')][_0xb906('0x67')]=_0xdf09be['id'];return db[_0xb906('0x68')][_0xb906('0x5c')](_0x5b7fd9[_0xb906('0x5d')]);}})[_0xb906('0x37')](respondWithResult(_0x4a3a9c,null))[_0xb906('0x5b')](handleError(_0x4a3a9c,null));};exports['getDispositions']=function(_0x3f7b28,_0x13f06f,_0xfd71cb){var _0x4ad386={'raw':![],'where':{}};var _0x532daf={};var _0x5a7294={'count':0x0,'rows':[]};return db[_0xb906('0x41')][_0xb906('0x69')]({'where':{'id':_0x3f7b28[_0xb906('0x58')]['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x13f06f,null))[_0xb906('0x37')](function(_0x43f963){if(_0x43f963){_0x532daf[_0xb906('0x44')]=_[_0xb906('0x45')](db[_0xb906('0x68')][_0xb906('0x42')]);_0x532daf['query']=_[_0xb906('0x45')](_0x3f7b28[_0xb906('0x46')]);_0x532daf['filters']=_['intersection'](_0x532daf[_0xb906('0x44')],_0x532daf[_0xb906('0x46')]);_0x4ad386[_0xb906('0x4a')]=_[_0xb906('0x48')](_0x532daf[_0xb906('0x44')],qs[_0xb906('0x49')](_0x3f7b28[_0xb906('0x46')][_0xb906('0x49')]));_0x4ad386['attributes']=_0x4ad386['attributes'][_0xb906('0x4b')]?_0x4ad386['attributes']:_0x532daf['model'];if(!_0x3f7b28[_0xb906('0x46')][_0xb906('0x6a')]('nolimit')){_0x4ad386[_0xb906('0x31')]=qs[_0xb906('0x31')](_0x3f7b28['query'][_0xb906('0x31')]);_0x4ad386[_0xb906('0x2e')]=qs[_0xb906('0x2e')](_0x3f7b28[_0xb906('0x46')][_0xb906('0x2e')]);}_0x4ad386[_0xb906('0x4d')]=qs[_0xb906('0x4e')](_0x3f7b28[_0xb906('0x46')][_0xb906('0x4e')]);_0x4ad386[_0xb906('0x4f')]=qs[_0xb906('0x47')](_[_0xb906('0x50')](_0x3f7b28[_0xb906('0x46')],_0x532daf[_0xb906('0x47')]));_0x4ad386[_0xb906('0x4f')]['WhatsappAccountId']=_0x43f963['id'];if(_0x3f7b28['query']['filter']){_0x4ad386[_0xb906('0x4f')]=_[_0xb906('0x52')](_0x4ad386[_0xb906('0x4f')],{'$or':_['map'](_0x4ad386[_0xb906('0x4a')],function(_0x2f0fb6){var _0x4a49e7={};_0x4a49e7[_0x2f0fb6]={'$like':'%'+_0x3f7b28[_0xb906('0x46')][_0xb906('0x51')]+'%'};return _0x4a49e7;})});}_0x4ad386=_[_0xb906('0x52')]({},_0x4ad386,_0x3f7b28['options']);return db[_0xb906('0x68')][_0xb906('0x30')]({'where':_0x4ad386[_0xb906('0x4f')]})['then'](function(_0x414c9d){_0x5a7294['count']=_0x414c9d;if(_0x3f7b28[_0xb906('0x46')][_0xb906('0x59')]){_0x4ad386[_0xb906('0x55')]=[{'all':!![]}];}return db[_0xb906('0x68')][_0xb906('0x56')](_0x4ad386);})[_0xb906('0x37')](function(_0x25b6f5){_0x5a7294[_0xb906('0x57')]=_0x25b6f5;return _0x5a7294;});}})['then'](respondWithFilteredResult(_0x13f06f,_0x4ad386))[_0xb906('0x5b')](handleError(_0x13f06f,null));};exports['removeDispositions']=function(_0x14e8aa,_0x3a2f2a,_0x12643e){return db['WhatsappAccount']['find']({'where':{'id':_0x14e8aa[_0xb906('0x58')]['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x3a2f2a,null))[_0xb906('0x37')](function(_0x322f8d){if(_0x322f8d){return _0x322f8d[_0xb906('0x6b')](_0x14e8aa[_0xb906('0x46')][_0xb906('0x6c')]);}})[_0xb906('0x37')](respondWithStatusCode(_0x3a2f2a,null))['catch'](handleError(_0x3a2f2a,null));};exports['addAnswer']=function(_0x3706f5,_0x42d6d2,_0x54d5d6){if(_0x3706f5[_0xb906('0x5d')]['id']){delete _0x3706f5[_0xb906('0x5d')]['id'];}return db[_0xb906('0x41')]['find']({'where':{'id':_0x3706f5['params']['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x42d6d2,null))[_0xb906('0x37')](function(_0x5c9d0e){if(_0x5c9d0e){_0x3706f5[_0xb906('0x5d')]['WhatsappAccountId']=_0x5c9d0e['id'];return db[_0xb906('0x6d')]['create'](_0x3706f5[_0xb906('0x5d')]);}})[_0xb906('0x37')](respondWithResult(_0x42d6d2,null))['catch'](handleError(_0x42d6d2,null));};exports['getAnswers']=function(_0x5a255f,_0x30df1a,_0xdb2b55){var _0x5762bb={'raw':![],'where':{}};var _0xba5341={};var _0x1228a2={'count':0x0,'rows':[]};return db[_0xb906('0x41')][_0xb906('0x69')]({'where':{'id':_0x5a255f[_0xb906('0x58')]['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x30df1a,null))[_0xb906('0x37')](function(_0x3f7fbd){if(_0x3f7fbd){_0xba5341[_0xb906('0x44')]=_[_0xb906('0x45')](db[_0xb906('0x6d')][_0xb906('0x42')]);_0xba5341[_0xb906('0x46')]=_[_0xb906('0x45')](_0x5a255f[_0xb906('0x46')]);_0xba5341[_0xb906('0x47')]=_[_0xb906('0x48')](_0xba5341[_0xb906('0x44')],_0xba5341[_0xb906('0x46')]);_0x5762bb[_0xb906('0x4a')]=_[_0xb906('0x48')](_0xba5341['model'],qs['fields'](_0x5a255f['query'][_0xb906('0x49')]));_0x5762bb[_0xb906('0x4a')]=_0x5762bb['attributes'][_0xb906('0x4b')]?_0x5762bb[_0xb906('0x4a')]:_0xba5341[_0xb906('0x44')];if(!_0x5a255f[_0xb906('0x46')][_0xb906('0x6a')](_0xb906('0x4c'))){_0x5762bb['limit']=qs[_0xb906('0x31')](_0x5a255f[_0xb906('0x46')][_0xb906('0x31')]);_0x5762bb['offset']=qs[_0xb906('0x2e')](_0x5a255f[_0xb906('0x46')]['offset']);}_0x5762bb[_0xb906('0x4d')]=qs[_0xb906('0x4e')](_0x5a255f['query'][_0xb906('0x4e')]);_0x5762bb[_0xb906('0x4f')]=qs[_0xb906('0x47')](_[_0xb906('0x50')](_0x5a255f[_0xb906('0x46')],_0xba5341[_0xb906('0x47')]));_0x5762bb[_0xb906('0x4f')]['WhatsappAccountId']=_0x3f7fbd['id'];if(_0x5a255f[_0xb906('0x46')][_0xb906('0x51')]){_0x5762bb[_0xb906('0x4f')]=_['merge'](_0x5762bb[_0xb906('0x4f')],{'$or':_[_0xb906('0x40')](_0x5762bb['attributes'],function(_0x86c39d){var _0x51cae1={};_0x51cae1[_0x86c39d]={'$like':'%'+_0x5a255f[_0xb906('0x46')]['filter']+'%'};return _0x51cae1;})});}_0x5762bb=_[_0xb906('0x52')]({},_0x5762bb,_0x5a255f['options']);return db[_0xb906('0x6d')][_0xb906('0x30')]({'where':_0x5762bb[_0xb906('0x4f')]})['then'](function(_0x2fea83){_0x1228a2[_0xb906('0x30')]=_0x2fea83;if(_0x5a255f[_0xb906('0x46')]['includeAll']){_0x5762bb[_0xb906('0x55')]=[{'all':!![]}];}return db[_0xb906('0x6d')][_0xb906('0x56')](_0x5762bb);})[_0xb906('0x37')](function(_0x15156b){_0x1228a2[_0xb906('0x57')]=_0x15156b;return _0x1228a2;});}})['then'](respondWithFilteredResult(_0x30df1a,_0x5762bb))[_0xb906('0x5b')](handleError(_0x30df1a,null));};exports[_0xb906('0x6e')]=function(_0xa755ec,_0x445e6c,_0x35a6cd){return db['WhatsappAccount'][_0xb906('0x5a')]({'where':{'id':_0xa755ec[_0xb906('0x58')]['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x445e6c,null))['then'](function(_0x2c48e4){if(_0x2c48e4){return _0x2c48e4[_0xb906('0x6e')](_0xa755ec[_0xb906('0x46')]['ids']);}})[_0xb906('0x37')](respondWithStatusCode(_0x445e6c,null))[_0xb906('0x5b')](handleError(_0x445e6c,null));};exports[_0xb906('0x6f')]=function(_0x201fd2,_0x304f65,_0x10a271){return db['WhatsappAccount'][_0xb906('0x5a')]({'where':{'id':_0x201fd2['params']['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x304f65,null))[_0xb906('0x37')](function(_0x16c6dc){if(_0x16c6dc){return _0x16c6dc[_0xb906('0x6f')](_0x201fd2[_0xb906('0x5d')][_0xb906('0x6c')],_[_0xb906('0x70')](_0x201fd2[_0xb906('0x5d')],[_0xb906('0x6c'),'id'])||{})['spread'](function(_0x280f77){for(var _0x57832d=0x0;_0x57832d<_0x201fd2[_0xb906('0x5d')][_0xb906('0x6c')][_0xb906('0x4b')];_0x57832d+=0x1){socket[_0xb906('0x71')](_0xb906('0x72'),{'UserId':Number(_0x201fd2['body'][_0xb906('0x6c')][_0x57832d]),'WhatsappAccountId':Number(_0x201fd2[_0xb906('0x58')]['id'])});}return _0x280f77;});}})['then'](respondWithResult(_0x304f65,null))[_0xb906('0x5b')](handleError(_0x304f65,null));};exports[_0xb906('0x73')]=function(_0x5e0317,_0x1c2469,_0x308df0){return db[_0xb906('0x41')][_0xb906('0x5a')]({'where':{'id':_0x5e0317[_0xb906('0x58')]['id']}})['then'](handleEntityNotFound(_0x1c2469,null))[_0xb906('0x37')](function(_0x1a06ce){if(_0x1a06ce){return _0x1a06ce[_0xb906('0x73')](_0x5e0317[_0xb906('0x46')][_0xb906('0x6c')])[_0xb906('0x37')](function(){if(_[_0xb906('0x74')](_0x5e0317['query'][_0xb906('0x6c')])){for(var _0x23740e=0x0;_0x23740e<_0x5e0317[_0xb906('0x46')]['ids']['length'];_0x23740e+=0x1){socket[_0xb906('0x71')](_0xb906('0x75'),{'UserId':Number(_0x5e0317[_0xb906('0x46')]['ids'][_0x23740e]),'WhatsappAccountId':Number(_0x5e0317[_0xb906('0x58')]['id'])});}}else{socket[_0xb906('0x71')](_0xb906('0x75'),{'UserId':Number(_0x5e0317[_0xb906('0x46')][_0xb906('0x6c')]),'WhatsappAccountId':Number(_0x5e0317[_0xb906('0x58')]['id'])});}});}})[_0xb906('0x37')](respondWithStatusCode(_0x1c2469,null))[_0xb906('0x5b')](handleError(_0x1c2469,null));};exports[_0xb906('0x76')]=function(_0x615777,_0x556ad0,_0x43366f){var _0x3c8632={};var _0x332d60={};var _0x356e9e;var _0x546bad;return db[_0xb906('0x41')][_0xb906('0x69')]({'where':{'id':_0x615777[_0xb906('0x58')]['id']}})['then'](handleEntityNotFound(_0x556ad0,null))[_0xb906('0x37')](function(_0x2271b1){if(_0x2271b1){_0x356e9e=_0x2271b1;_0x332d60[_0xb906('0x44')]=_[_0xb906('0x45')](db[_0xb906('0x77')][_0xb906('0x42')]);_0x332d60[_0xb906('0x46')]=_[_0xb906('0x45')](_0x615777[_0xb906('0x46')]);_0x332d60[_0xb906('0x47')]=_[_0xb906('0x48')](_0x332d60[_0xb906('0x44')],_0x332d60[_0xb906('0x46')]);_0x3c8632[_0xb906('0x4a')]=_[_0xb906('0x48')](_0x332d60[_0xb906('0x44')],qs['fields'](_0x615777[_0xb906('0x46')][_0xb906('0x49')]));_0x3c8632['attributes']=_0x3c8632[_0xb906('0x4a')][_0xb906('0x4b')]?_0x3c8632[_0xb906('0x4a')]:_0x332d60[_0xb906('0x44')];_0x3c8632[_0xb906('0x4d')]=qs[_0xb906('0x4e')](_0x615777[_0xb906('0x46')][_0xb906('0x4e')]);_0x3c8632[_0xb906('0x4f')]=qs[_0xb906('0x47')](_['pick'](_0x615777['query'],_0x332d60[_0xb906('0x47')]));if(_0x615777[_0xb906('0x46')]['filter']){_0x3c8632[_0xb906('0x4f')]=_[_0xb906('0x52')](_0x3c8632['where'],{'$or':_[_0xb906('0x40')](_0x3c8632['attributes'],function(_0x5154c7){var _0x1a5b2e={};_0x1a5b2e[_0x5154c7]={'$like':'%'+_0x615777[_0xb906('0x46')][_0xb906('0x51')]+'%'};return _0x1a5b2e;})});}_0x3c8632=_[_0xb906('0x52')]({},_0x3c8632,_0x615777[_0xb906('0x54')]);return _0x356e9e[_0xb906('0x76')](_0x3c8632);}})[_0xb906('0x37')](function(_0x58af54){if(_0x58af54){_0x546bad=_0x58af54[_0xb906('0x4b')];if(!_0x615777[_0xb906('0x46')]['hasOwnProperty']('nolimit')){_0x3c8632[_0xb906('0x31')]=qs['limit'](_0x615777[_0xb906('0x46')][_0xb906('0x31')]);_0x3c8632[_0xb906('0x2e')]=qs[_0xb906('0x2e')](_0x615777[_0xb906('0x46')][_0xb906('0x2e')]);}return _0x356e9e[_0xb906('0x76')](_0x3c8632);}})[_0xb906('0x37')](function(_0x118153){if(_0x118153){return _0x118153?{'count':_0x546bad,'rows':_0x118153}:null;}})[_0xb906('0x37')](respondWithResult(_0x556ad0,null))[_0xb906('0x5b')](handleError(_0x556ad0,null));};exports[_0xb906('0x78')]=function(_0x5e13ac,_0x2657af){var _0x134225=_0x5e13ac[_0xb906('0x58')]['id'];var _0x593e2f=_0x5e13ac[_0xb906('0x5d')];var _0x21e2dd=0xc8;var _0xef515d=null;return db[_0xb906('0x79')][_0xb906('0x7a')]({'isolationLevel':db[_0xb906('0x79')][_0xb906('0x7b')][_0xb906('0x7c')][_0xb906('0x7d')]},function(_0x197c70){return db['WhatsappAccount'][_0xb906('0x69')]({'where':{'id':_0x134225},'transaction':_0x197c70})[_0xb906('0x37')](function(_0x1ee45){if(_0x1ee45){return db[_0xb906('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x134225},'transaction':_0x197c70})['then'](function(){var _0x351708=_[_0xb906('0x40')](_0x593e2f,function(_0x4da44b){_0x4da44b[_0xb906('0x67')]=_0x134225;return _0x4da44b;});return db['WhatsappApplication']['bulkCreate'](_0x351708,{'transaction':_0x197c70});});}else{_0x21e2dd=0x194;_0xef515d=[];}});})[_0xb906('0x37')](function(){if(_0x21e2dd!==0x194){return db[_0xb906('0x7e')][_0xb906('0x7f')]({'where':{'WhatsappAccountId':_0x134225},'order':_0xb906('0x80')})[_0xb906('0x37')](function(_0x4bb67b){_0xef515d=_0x4bb67b;});}})[_0xb906('0x5b')](function(_0x9fe00f){_0x21e2dd=0x1f4;logger['error'](_0x9fe00f['stack']);if(_0x9fe00f[_0xb906('0x3c')]){delete _0x9fe00f[_0xb906('0x3c')];}_0xef515d=_0x9fe00f;})[_0xb906('0x81')](function(){if(_0xef515d===null){_0x2657af[_0xb906('0x2a')](_0x21e2dd);}else{if(_0x21e2dd===0x1f4){_0x2657af[_0xb906('0x2b')](_0x21e2dd)[_0xb906('0x3d')](_0xef515d);}else{_0x2657af[_0xb906('0x2b')](_0x21e2dd)[_0xb906('0x2d')](_0xef515d);}}});};exports[_0xb906('0x82')]=function(_0x265051,_0x254ae4,_0x1b1493){var _0x44a69e={};var _0x423913={};var _0x447b72;var _0x2fede6;return db[_0xb906('0x41')][_0xb906('0x69')]({'where':{'id':_0x265051[_0xb906('0x58')]['id']}})[_0xb906('0x37')](handleEntityNotFound(_0x254ae4,null))[_0xb906('0x37')](function(_0x459cb3){if(_0x459cb3){_0x447b72=_0x459cb3;_0x423913['model']=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x423913[_0xb906('0x46')]=_[_0xb906('0x45')](_0x265051[_0xb906('0x46')]);_0x423913[_0xb906('0x47')]=_[_0xb906('0x48')](_0x423913['model'],_0x423913[_0xb906('0x46')]);_0x44a69e[_0xb906('0x4a')]=_[_0xb906('0x48')](_0x423913[_0xb906('0x44')],qs['fields'](_0x265051[_0xb906('0x46')][_0xb906('0x49')]));_0x44a69e[_0xb906('0x4a')]=_0x44a69e['attributes'][_0xb906('0x4b')]?_0x44a69e[_0xb906('0x4a')]:_0x423913['model'];_0x44a69e[_0xb906('0x4d')]=qs[_0xb906('0x4e')](_0x265051[_0xb906('0x46')][_0xb906('0x4e')]);_0x44a69e[_0xb906('0x4f')]=qs[_0xb906('0x47')](_[_0xb906('0x50')](_0x265051[_0xb906('0x46')],_0x423913[_0xb906('0x47')]));if(_0x265051[_0xb906('0x46')][_0xb906('0x51')]){_0x44a69e[_0xb906('0x4f')]=_[_0xb906('0x52')](_0x44a69e[_0xb906('0x4f')],{'$or':_[_0xb906('0x40')](_0x44a69e[_0xb906('0x4a')],function(_0x5d3cca){var _0x2ffe50={};_0x2ffe50[_0x5d3cca]={'$like':'%'+_0x265051[_0xb906('0x46')][_0xb906('0x51')]+'%'};return _0x2ffe50;})});}_0x44a69e=_[_0xb906('0x52')]({},_0x44a69e,_0x265051[_0xb906('0x54')]);return _0x447b72[_0xb906('0x82')](_0x44a69e);}})['then'](function(_0x4cdfd7){if(_0x4cdfd7){_0x2fede6=_0x4cdfd7[_0xb906('0x4b')];if(!_0x265051['query'][_0xb906('0x6a')](_0xb906('0x4c'))){_0x44a69e[_0xb906('0x31')]=qs[_0xb906('0x31')](_0x265051[_0xb906('0x46')][_0xb906('0x31')]);_0x44a69e[_0xb906('0x2e')]=qs[_0xb906('0x2e')](_0x265051[_0xb906('0x46')][_0xb906('0x2e')]);}return _0x447b72[_0xb906('0x82')](_0x44a69e);}})[_0xb906('0x37')](function(_0x309004){if(_0x309004){return _0x309004?{'count':_0x2fede6,'rows':_0x309004}:null;}})['then'](respondWithResult(_0x254ae4,null))[_0xb906('0x5b')](handleError(_0x254ae4,null));};exports['notify']=function(_0xbe31fb,_0x43a7f3,_0x518ed7){var _0x2926ce={'channel':_0xb906('0x83')};var _0x510071=[];var _0x27b959=[];var _0x3995cd={};return db[_0xb906('0x41')][_0xb906('0x5a')]({'where':{'id':_0xbe31fb[_0xb906('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xb906('0x84')}]})[_0xb906('0x37')](handleEntityNotFound(_0x43a7f3,null))['then'](function(_0x3b7cf0){_0x2926ce[_0xb906('0x85')]=_0x3b7cf0;if(_0x2926ce['account']&&_0x2926ce['account'][_0xb906('0x43')]===_0xb906('0x86')&&_0xbe31fb['body']['statuses']){if(_0xbe31fb['body'][_0xb906('0x87')][_0xb906('0x4b')]===0x0)return;if(_0xbe31fb[_0xb906('0x5d')][_0xb906('0x87')][0x0][_0xb906('0x88')]!=='read')return;return db['WhatsappMessage'][_0xb906('0x64')]({'read':!![],'readAt':_0xbe31fb[_0xb906('0x5d')][_0xb906('0x87')][0x0]['timestamp']},{'where':{'messageId':_0xbe31fb[_0xb906('0x5d')]['statuses'][0x0][_0xb906('0x89')]},'individualHooks':!![]})[_0xb906('0x37')](function(_0x5bb870){return _0x43a7f3[_0xb906('0x2b')](0xc8)['json'](_0x5bb870);});}_0x2926ce[_0xb906('0x8a')]=_[_0xb906('0x8b')](_0x3b7cf0[_0xb906('0x84')],[_0xb906('0x80')],[_0xb906('0x8c')]);if(_0x2926ce[_0xb906('0x85')][_0xb906('0x84')]){delete _0x2926ce['account'][_0xb906('0x84')];}return db[_0xb906('0x8d')][_0xb906('0x65')]()[_0xb906('0x37')](function(_0x277019){if(!_0x277019){throw new db[(_0xb906('0x8e'))][(_0xb906('0x8f'))](_0xb906('0x90'));}_0x510071=_['difference'](_[_0xb906('0x45')](_0x277019),['createdAt','updatedAt']);_0x27b959=_['difference'](_['keys'](_0x277019),[_0xb906('0x91'),_0xb906('0x92'),_0xb906('0x93'),_0xb906('0x94')]);_0x2926ce[_0xb906('0x5d')]={'mapKey':_0xb906('0x95')};if(_0x2926ce[_0xb906('0x85')]&&_0x2926ce[_0xb906('0x85')]['type']===_0xb906('0x96')){_0x2926ce[_0xb906('0x5d')][_0xb906('0x97')]=_0xbe31fb['body'][_0xb906('0x98')][_0xb906('0x99')](_0xb906('0x9a'),'');_0x2926ce['body'][_0xb906('0x5d')]=_0xbe31fb[_0xb906('0x5d')]['Body'];_0x2926ce['body'][_0xb906('0x9b')]=_0xbe31fb[_0xb906('0x5d')][_0xb906('0x9c')];}if(_0x2926ce[_0xb906('0x85')]&&_0x2926ce[_0xb906('0x85')][_0xb906('0x43')]==='sinch'){_0x2926ce[_0xb906('0x5d')][_0xb906('0x97')]=_0xbe31fb[_0xb906('0x5d')]['notifications'][0x0][_0xb906('0x97')];_0x2926ce[_0xb906('0x5d')][_0xb906('0x5d')]=_0xbe31fb[_0xb906('0x5d')][_0xb906('0x9d')][0x0]['message'][_0xb906('0x5d')];_0x2926ce[_0xb906('0x5d')][_0xb906('0x9b')]=_0xbe31fb[_0xb906('0x5d')]['notifications'][0x0]['message_id'];}if(_0x2926ce['body']['id']){delete _0x2926ce[_0xb906('0x5d')]['id'];}if(_[_0xb906('0x9e')](_0x2926ce[_0xb906('0x5d')]['from'])){throw new db['Sequelize'][(_0xb906('0x8f'))](_0xb906('0x9f'));}if(_[_0xb906('0x9e')](_0x2926ce[_0xb906('0x5d')][_0xb906('0x5d')])||_0x2926ce['body'][_0xb906('0x5d')]===''){throw new db['Sequelize'][(_0xb906('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2926ce[_0xb906('0x5d')]['mapKey'])){throw new db[(_0xb906('0x8e'))][(_0xb906('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x27b959);}if(!_[_0xb906('0xa0')](_0x27b959,_0x2926ce['body'][_0xb906('0xa1')])){throw new db['Sequelize'][(_0xb906('0x8f'))](_0xb906('0xa2')+_0x27b959);}_0x3995cd[_0x2926ce[_0xb906('0x5d')][_0xb906('0xa1')]]=_0x2926ce['body']['from'];return db[_0xb906('0xa3')]['find']({'where':{'id':_0x2926ce['account']['ListId']},'include':[{'model':db[_0xb906('0x8d')],'as':_0xb906('0xa4'),'where':_0x3995cd,'limit':0x1,'order':[[_0xb906('0x92'),_0xb906('0xa5')]]}]});})[_0xb906('0x37')](handleEntityNotFound(_0x43a7f3,null))['then'](function(_0x4b5df2){if(_0x4b5df2){_0x2926ce['list']=_[_0xb906('0x70')](_0x4b5df2,['Contacts']);if(_0x4b5df2['Contacts'][_0xb906('0x4b')]){return _0x4b5df2[_0xb906('0xa4')][0x0];}var _0xdb5ffa=_['defaults'](_0x2926ce[_0xb906('0x5d')],{'firstName':_0x2926ce[_0xb906('0x5d')]['from'],'ListId':_0x4b5df2['id']});_0xdb5ffa[_0x2926ce['body'][_0xb906('0xa1')]]=_0x2926ce[_0xb906('0x5d')][_0xb906('0x97')];return db[_0xb906('0x8d')][_0xb906('0x5c')](_0xdb5ffa,{'fields':_0x510071,'raw':!![]});}})[_0xb906('0x37')](handleEntityNotFound(_0x43a7f3,null))[_0xb906('0x37')](function(_0x2f0b12){if(_0x2f0b12){_0x2926ce[_0xb906('0xa6')]=_0x2f0b12;var _0x1ccdab={'ContactId':_0x2f0b12['id'],'phone':_0x2926ce[_0xb906('0x5d')][_0xb906('0x97')],'WhatsappAccountId':_0xbe31fb[_0xb906('0x58')]['id']};var _0x17a4c9={'ContactId':_0x2f0b12['id'],'WhatsappAccountId':_0xbe31fb['params']['id'],'closed':![]};return db[_0xb906('0xa7')][_0xb906('0x5a')]({'where':_0x17a4c9})[_0xb906('0x37')](function(_0x2baa20){if(_0x2baa20){return[_0x2baa20,![]];}return db[_0xb906('0xa7')][_0xb906('0x5c')](_0x1ccdab)['then'](function(_0x158bc5){return[_0x158bc5,!![]];});});}})['spread'](function(_0x4a9485,_0x30fad8){_0x2926ce['interaction']=_0x4a9485['get']({'plain':!![]});_0x2926ce[_0xb906('0xa8')][_0xb906('0xa9')]=![];if(_0x30fad8){if(_0x2926ce[_0xb906('0x85')][_0xb906('0xaa')]){_0x2926ce[_0xb906('0x8a')]['push']({'id':0x0,'priority':_0x2926ce[_0xb906('0x8a')]['length']+0x1,'app':_0xb906('0xab'),'appdata':'unmanaged','interval':_0xb906('0xac')});}_0x2926ce[_0xb906('0xa8')]['created']=!![];}return db['WhatsappMessage'][_0xb906('0x5c')]({'phone':_0x2926ce[_0xb906('0x5d')][_0xb906('0x97')],'messageId':_0x2926ce[_0xb906('0x5d')][_0xb906('0x9b')],'body':_0x2926ce[_0xb906('0x5d')]['body'],'WhatsappAccountId':_0xbe31fb[_0xb906('0x58')]['id'],'WhatsappInteractionId':_0x4a9485['id'],'direction':'in','ContactId':_0x4a9485[_0xb906('0xad')],'AttachmentId':_0x2926ce[_0xb906('0x5d')]['AttachmentId']});})[_0xb906('0x37')](function(_0x59dfcf){_0x2926ce[_0xb906('0x28')]=_0x59dfcf;if(_0x2926ce[_0xb906('0xa8')][_0xb906('0xae')]){return db['User'][_0xb906('0x5a')]({'attributes':['id','name'],'where':{'id':_0x2926ce[_0xb906('0xa8')][_0xb906('0xae')]}})[_0xb906('0x37')](function(_0x52fa9a){if(_0x52fa9a){_0x2926ce[_0xb906('0x8a')][_0xb906('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x52fa9a[_0xb906('0x3c')]+','+(_0x2926ce[_0xb906('0x85')][_0xb906('0xb0')]||0xa),'interval':_0xb906('0xac')});}return respondWithRpcPromise('Start',_0xb906('0xb1'),_0x2926ce);});}return respondWithRpcPromise(_0xb906('0xb2'),_0xb906('0xb1'),_0x2926ce);})['then'](function(_0x1cd28c){if(_0x1cd28c){var _0x12ae29=0xc8;var _0x36626a=_0xb906('0xb3');logger[_0xb906('0x21')](_0xb906('0x25'),_0x36626a,_0x12ae29,'entity\x20found');logger[_0xb906('0x24')](_0xb906('0xb4'),_0x36626a,_0x12ae29,'entity\x20found',JSON[_0xb906('0x26')](_0x1cd28c));if(_0x2926ce[_0xb906('0x85')]['type']===_0xb906('0x96')){return _0x43a7f3[_0xb906('0x2b')](_0x12ae29)[_0xb906('0x32')](_0xb906('0xb5'),_0xb906('0xb6'))[_0xb906('0x3d')](_0xb906('0xb7'));}else{return _0x43a7f3['status'](_0x12ae29)['json'](_0x1cd28c);}}});})[_0xb906('0x5b')](handleError(_0x43a7f3,null));};exports[_0xb906('0x3d')]=function(_0x4c2109,_0x443fd0,_0x54be22){var _0x117d0b,_0x34112a,_0x3308c8;if(_[_0xb906('0x9e')](_0x4c2109[_0xb906('0x5d')][_0xb906('0x5d')])||_0x4c2109['body'][_0xb906('0x5d')]===''){throw new db[(_0xb906('0x8e'))][(_0xb906('0x8f'))](_0xb906('0xb8'));}if(_[_0xb906('0x9e')](_0x4c2109['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xb906('0xb9'));}_0x117d0b=_0x4c2109[_0xb906('0x5d')]['to'];return db[_0xb906('0x41')][_0xb906('0x5a')]({'where':{'id':_0x4c2109['params']['id']},'include':[{'model':db[_0xb906('0xa3')],'as':_0xb906('0xba'),'include':[{'model':db[_0xb906('0x8d')],'as':_0xb906('0xa4'),'where':{'mobile':_0x117d0b},'limit':0x1,'order':[[_0xb906('0x92'),_0xb906('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x443fd0,null))['then'](function(_0x3f8093){if(_0x3f8093&&_0x3f8093['List']){_0x34112a=_0x3f8093[_0xb906('0x39')]({'plain':!![]});if(_0x34112a[_0xb906('0xba')]&&_0x34112a[_0xb906('0xba')][_0xb906('0xa4')][_0xb906('0x4b')]){return _0x34112a['List'][_0xb906('0xa4')][0x0];}return db[_0xb906('0x8d')][_0xb906('0x5c')](_[_0xb906('0x1b')](_0x4c2109[_0xb906('0x5d')],{'firstName':_0x117d0b,'mobile':_0x117d0b,'phone':_0x117d0b,'ListId':_0x34112a[_0xb906('0x94')]}));}})[_0xb906('0x37')](handleEntityNotFound(_0x443fd0,null))['then'](function(_0x3130c0){if(_0x3130c0){_0x3308c8=_0x3130c0;return db[_0xb906('0xa7')]['find']({'where':{'ContactId':_0x3308c8['id'],'closed':![],'WhatsappAccountId':_0x34112a['id']}})[_0xb906('0x37')](function(_0x4d6640){if(_0x4d6640){return[_0x4d6640,![]];}return db[_0xb906('0xa7')]['create']({'UserId':_0x4c2109['user']['id'],'ContactId':_0x3308c8['id'],'WhatsappAccountId':_0x34112a['id'],'phone':_0x117d0b,'firstMsgDirection':_0xb906('0xbb'),'Messages':[_[_0xb906('0x52')](_0x4c2109[_0xb906('0x5d')],{'read':![],'body':_0x4c2109[_0xb906('0x5d')]['body'],'phone':_0x117d0b,'WhatsappAccountId':_0x34112a['id'],'UserId':_0x4c2109['user']['id'],'ContactId':_0x3308c8['id']})]},{'include':[{'model':db[_0xb906('0xbc')],'as':_0xb906('0xbd')}]})[_0xb906('0x37')](function(_0x33624e){return[_0x33624e,!![]];});});}})[_0xb906('0xbe')](function(_0x810eb3,_0x17393e){if(_0x17393e){return _0x810eb3;}return db['WhatsappMessage']['create'](_['merge'](_0x4c2109[_0xb906('0x5d')],{'read':![],'body':_0x4c2109[_0xb906('0x5d')][_0xb906('0x5d')],'phone':_0x117d0b,'WhatsappAccountId':_0x34112a['id'],'WhatsappInteractionId':_0x810eb3['id'],'UserId':_0x4c2109[_0xb906('0x5e')]['id'],'ContactId':_0x3308c8['id']}))[_0xb906('0x37')](function(_0x17addc){_0x810eb3[_0xb906('0xbf')][_0xb906('0xbd')]=[];_0x810eb3['dataValues']['Messages'][_0xb906('0xc0')](_0x17addc[_0xb906('0xbf')]);return _0x810eb3;});})[_0xb906('0x37')](respondWithResult(_0x443fd0,null))[_0xb906('0x5b')](handleError(_0x443fd0,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3c04cce..5dab3f7 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 _0x4800=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x58aca2,_0x32bca7){var _0x1c6b0=function(_0x377cf4){while(--_0x377cf4){_0x58aca2['push'](_0x58aca2['shift']());}};_0x1c6b0(++_0x32bca7);}(_0x4800,0xd2));var _0x0480=function(_0x2da230,_0x5a5dfc){_0x2da230=_0x2da230-0x0;var _0x3504a9=_0x4800[_0x2da230];return _0x3504a9;};'use strict';var EventEmitter=require(_0x0480('0x0'));var WhatsappAccount=require(_0x0480('0x1'))['db'][_0x0480('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0480('0x3')](0x0);var events={'afterCreate':_0x0480('0x4'),'afterUpdate':_0x0480('0x5'),'afterDestroy':_0x0480('0x6')};function emitEvent(_0x7e8923){return function(_0x23db2b,_0x3e9270,_0xed96f4){WhatsappAccountEvents[_0x0480('0x7')](_0x7e8923+':'+_0x23db2b['id'],_0x23db2b);WhatsappAccountEvents[_0x0480('0x7')](_0x7e8923,_0x23db2b);_0xed96f4(null);};}for(var e in events){if(events[_0x0480('0x8')](e)){var event=events[e];WhatsappAccount[_0x0480('0x9')](e,emitEvent(event));}}module[_0x0480('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0b9b=['emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','remove'];(function(_0x498e37,_0x84e565){var _0x61a0c1=function(_0x4117ec){while(--_0x4117ec){_0x498e37['push'](_0x498e37['shift']());}};_0x61a0c1(++_0x84e565);}(_0x0b9b,0x1bb));var _0xb0b9=function(_0x258a63,_0x1a234c){_0x258a63=_0x258a63-0x0;var _0x700f96=_0x0b9b[_0x258a63];return _0x700f96;};'use strict';var EventEmitter=require(_0xb0b9('0x0'));var WhatsappAccount=require(_0xb0b9('0x1'))['db'][_0xb0b9('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb0b9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb0b9('0x4')};function emitEvent(_0x344b64){return function(_0x1b94f9,_0x1c8d13,_0x2704e0){WhatsappAccountEvents[_0xb0b9('0x5')](_0x344b64+':'+_0x1b94f9['id'],_0x1b94f9);WhatsappAccountEvents['emit'](_0x344b64,_0x1b94f9);_0x2704e0(null);};}for(var e in events){if(events[_0xb0b9('0x6')](e)){var event=events[e];WhatsappAccount[_0xb0b9('0x7')](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 e4ff4ae..c07eb41 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 _0x74ba=['./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3a1c36,_0x32c7a2){var _0x5caf9a=function(_0x3c5827){while(--_0x3c5827){_0x3a1c36['push'](_0x3a1c36['shift']());}};_0x5caf9a(++_0x32c7a2);}(_0x74ba,0x1e0));var _0xa74b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74ba[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xa74b('0x0'));var logger=require(_0xa74b('0x1'))('api');var moment=require(_0xa74b('0x2'));var BPromise=require(_0xa74b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa74b('0x4'));var rimraf=require(_0xa74b('0x5'));var config=require('../../config/environment');var attributes=require(_0xa74b('0x6'));module['exports']=function(_0x5791b5,_0x34f17b){return _0x5791b5['define'](_0xa74b('0x7'),attributes,{'tableName':_0xa74b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c5c=['lodash','../../config/logger','api','moment','path','rimraf','WhatsappAccount','whatsapp_accounts'];(function(_0x54691e,_0x28b041){var _0x5520b2=function(_0x501a05){while(--_0x501a05){_0x54691e['push'](_0x54691e['shift']());}};_0x5520b2(++_0x28b041);}(_0x4c5c,0x188));var _0xc4c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4c5('0x0'));var util=require('util');var logger=require(_0xc4c5('0x1'))(_0xc4c5('0x2'));var moment=require(_0xc4c5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c5('0x4'));var rimraf=require(_0xc4c5('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x164010,_0x4ea8b8){return _0x164010['define'](_0xc4c5('0x6'),attributes,{'tableName':_0xc4c5('0x7'),'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 d7017b1..e210ab9 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 _0xae0d=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','options','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x45cf0a,_0x3e323d){var _0x2a7b4c=function(_0x51566e){while(--_0x51566e){_0x45cf0a['push'](_0x45cf0a['shift']());}};_0x2a7b4c(++_0x3e323d);}(_0xae0d,0x14e));var _0xdae0=function(_0x5ba51c,_0x4b1356){_0x5ba51c=_0x5ba51c-0x0;var _0x16e08b=_0xae0d[_0x5ba51c];return _0x16e08b;};'use strict';var _=require(_0xdae0('0x0'));var util=require(_0xdae0('0x1'));var moment=require(_0xdae0('0x2'));var BPromise=require(_0xdae0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdae0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdae0('0x5'));var logger=require(_0xdae0('0x6'))(_0xdae0('0x7'));var config=require('../../config/environment');var jayson=require(_0xdae0('0x8'));var client=jayson[_0xdae0('0x9')][_0xdae0('0xa')]({'port':0x232a});config[_0xdae0('0xb')]=_['defaults'](config[_0xdae0('0xb')],{'host':_0xdae0('0xc'),'port':0x18eb});var socket=require(_0xdae0('0xd'))(new Redis(config[_0xdae0('0xb')]));require('./whatsappAccount.socket')[_0xdae0('0xe')](socket);function respondWithRpcPromise(_0x17bc7b,_0x254980,_0x34cd2b){return new BPromise(function(_0x1279ac,_0x52593a){return client[_0xdae0('0xf')](_0x17bc7b,_0x34cd2b)[_0xdae0('0x10')](function(_0x53a499){logger[_0xdae0('0x11')](_0xdae0('0x12'),_0x254980,_0xdae0('0x13'));logger[_0xdae0('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x254980,_0xdae0('0x13'),JSON[_0xdae0('0x15')](_0x53a499));if(_0x53a499[_0xdae0('0x16')]){if(_0x53a499['error']['code']===0x1f4){logger[_0xdae0('0x16')](_0xdae0('0x12'),_0x254980,_0x53a499[_0xdae0('0x16')][_0xdae0('0x17')]);return _0x52593a(_0x53a499[_0xdae0('0x16')][_0xdae0('0x17')]);}logger['error'](_0xdae0('0x12'),_0x254980,_0x53a499[_0xdae0('0x16')][_0xdae0('0x17')]);return _0x1279ac(_0x53a499[_0xdae0('0x16')][_0xdae0('0x17')]);}else{logger[_0xdae0('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x254980,_0xdae0('0x13'));_0x1279ac(_0x53a499['result'][_0xdae0('0x17')]);}})[_0xdae0('0x18')](function(_0x209939){logger['error'](_0xdae0('0x12'),_0x254980,_0x209939);_0x52593a(_0x209939);});});}exports['ShowWhatsappAccount']=function(_0xcd3d2){var _0x567f34=this;return new Promise(function(_0x5532c1,_0x5e669e){return db['WhatsappAccount']['find']({'raw':_0xcd3d2[_0xdae0('0x19')]?_0xcd3d2['options']['raw']===undefined?!![]:![]:!![],'where':_0xcd3d2[_0xdae0('0x19')]?_0xcd3d2[_0xdae0('0x19')]['where']||null:null,'attributes':_0xcd3d2[_0xdae0('0x19')]?_0xcd3d2[_0xdae0('0x19')][_0xdae0('0x1a')]||null:null,'include':_0xcd3d2[_0xdae0('0x19')]?_0xcd3d2['options'][_0xdae0('0x1b')]?_[_0xdae0('0x1c')](_0xcd3d2[_0xdae0('0x19')][_0xdae0('0x1b')],function(_0x5a2077){return{'model':db[_0x5a2077[_0xdae0('0x1d')]],'as':_0x5a2077['as'],'attributes':_0x5a2077[_0xdae0('0x1a')],'include':_0x5a2077['include']?_['map'](_0x5a2077[_0xdae0('0x1b')],function(_0x3f718e){return{'model':db[_0x3f718e[_0xdae0('0x1d')]],'as':_0x3f718e['as'],'attributes':_0x3f718e[_0xdae0('0x1a')],'include':_0x3f718e[_0xdae0('0x1b')]?_[_0xdae0('0x1c')](_0x3f718e[_0xdae0('0x1b')],function(_0x9c0df7){return{'model':db[_0x9c0df7['model']],'as':_0x9c0df7['as'],'attributes':_0x9c0df7[_0xdae0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdae0('0x10')](function(_0x233b04){logger[_0xdae0('0x11')]('ShowWhatsappAccount',_0xcd3d2);logger[_0xdae0('0x14')]('ShowWhatsappAccount',_0xcd3d2,JSON[_0xdae0('0x15')](_0x233b04));_0x5532c1(_0x233b04);})[_0xdae0('0x18')](function(_0x4ff905){logger['error'](_0xdae0('0x1e'),_0x4ff905['message'],_0xcd3d2);_0x5e669e(_0x567f34[_0xdae0('0x16')](0x1f4,_0x4ff905[_0xdae0('0x17')]));});});}; \ No newline at end of file +var _0x3222=['options','raw','where','attributes','model','include','map','ShowWhatsappAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappAccount'];(function(_0x3ced9d,_0x18daa5){var _0xa06cbb=function(_0x3e6c51){while(--_0x3e6c51){_0x3ced9d['push'](_0x3ced9d['shift']());}};_0xa06cbb(++_0x18daa5);}(_0x3222,0xe1));var _0x2322=function(_0x55332e,_0x21ba15){_0x55332e=_0x55332e-0x0;var _0x2dc6cf=_0x3222[_0x55332e];return _0x2dc6cf;};'use strict';var _=require(_0x2322('0x0'));var util=require(_0x2322('0x1'));var moment=require(_0x2322('0x2'));var BPromise=require(_0x2322('0x3'));var rs=require(_0x2322('0x4'));var fs=require('fs');var Redis=require(_0x2322('0x5'));var db=require(_0x2322('0x6'))['db'];var utils=require(_0x2322('0x7'));var logger=require(_0x2322('0x8'))(_0x2322('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2322('0xa')][_0x2322('0xb')]({'port':0x232a});config[_0x2322('0xc')]=_['defaults'](config[_0x2322('0xc')],{'host':_0x2322('0xd'),'port':0x18eb});var socket=require(_0x2322('0xe'))(new Redis(config[_0x2322('0xc')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x304f2e,_0x524385,_0x397563){return new BPromise(function(_0x4c0d9b,_0x18ca98){return client['request'](_0x304f2e,_0x397563)[_0x2322('0xf')](function(_0x31710f){logger[_0x2322('0x10')](_0x2322('0x11'),_0x524385,_0x2322('0x12'));logger[_0x2322('0x13')](_0x2322('0x14'),_0x524385,_0x2322('0x12'),JSON['stringify'](_0x31710f));if(_0x31710f[_0x2322('0x15')]){if(_0x31710f[_0x2322('0x15')][_0x2322('0x16')]===0x1f4){logger['error'](_0x2322('0x11'),_0x524385,_0x31710f['error'][_0x2322('0x17')]);return _0x18ca98(_0x31710f[_0x2322('0x15')]['message']);}logger[_0x2322('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x524385,_0x31710f[_0x2322('0x15')]['message']);return _0x4c0d9b(_0x31710f['error'][_0x2322('0x17')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x524385,_0x2322('0x12'));_0x4c0d9b(_0x31710f[_0x2322('0x18')][_0x2322('0x17')]);}})[_0x2322('0x19')](function(_0x21299d){logger['error'](_0x2322('0x11'),_0x524385,_0x21299d);_0x18ca98(_0x21299d);});});}exports['ShowWhatsappAccount']=function(_0x5d7dd0){var _0x3f3650=this;return new Promise(function(_0x87d375,_0x2a656b){return db[_0x2322('0x1a')]['find']({'raw':_0x5d7dd0[_0x2322('0x1b')]?_0x5d7dd0[_0x2322('0x1b')][_0x2322('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d7dd0[_0x2322('0x1b')]?_0x5d7dd0[_0x2322('0x1b')][_0x2322('0x1d')]||null:null,'attributes':_0x5d7dd0[_0x2322('0x1b')]?_0x5d7dd0['options'][_0x2322('0x1e')]||null:null,'include':_0x5d7dd0[_0x2322('0x1b')]?_0x5d7dd0['options']['include']?_['map'](_0x5d7dd0[_0x2322('0x1b')]['include'],function(_0x552ba5){return{'model':db[_0x552ba5[_0x2322('0x1f')]],'as':_0x552ba5['as'],'attributes':_0x552ba5[_0x2322('0x1e')],'include':_0x552ba5['include']?_['map'](_0x552ba5['include'],function(_0x1b7b1c){return{'model':db[_0x1b7b1c[_0x2322('0x1f')]],'as':_0x1b7b1c['as'],'attributes':_0x1b7b1c[_0x2322('0x1e')],'include':_0x1b7b1c[_0x2322('0x20')]?_[_0x2322('0x21')](_0x1b7b1c['include'],function(_0x2319de){return{'model':db[_0x2319de[_0x2322('0x1f')]],'as':_0x2319de['as'],'attributes':_0x2319de[_0x2322('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2322('0xf')](function(_0x109c43){logger[_0x2322('0x10')](_0x2322('0x22'),_0x5d7dd0);logger[_0x2322('0x13')]('ShowWhatsappAccount',_0x5d7dd0,JSON[_0x2322('0x23')](_0x109c43));_0x87d375(_0x109c43);})[_0x2322('0x19')](function(_0x407b30){logger['error'](_0x2322('0x22'),_0x407b30['message'],_0x5d7dd0);_0x2a656b(_0x3f3650['error'](0x1f4,_0x407b30[_0x2322('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5497059..9f5629a 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 _0x4b9b=['length','whatsappAccount:','./whatsappAccount.events','save','remove','emit','register'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4b9b,0x8e));var _0xb4b9=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x4b9b[_0x5e238b];return _0x389bea;};'use strict';var WhatsappAccountEvents=require(_0xb4b9('0x0'));var events=[_0xb4b9('0x1'),_0xb4b9('0x2'),'update'];function createListener(_0x475f51,_0x25d7a5){return function(_0x51f7c8){_0x25d7a5[_0xb4b9('0x3')](_0x475f51,_0x51f7c8);};}function removeListener(_0x997857,_0x4f3af2){return function(){WhatsappAccountEvents['removeListener'](_0x997857,_0x4f3af2);};}exports[_0xb4b9('0x4')]=function(_0x52bfb9){for(var _0x5ed279=0x0,_0x3c7fb2=events[_0xb4b9('0x5')];_0x5ed279<_0x3c7fb2;_0x5ed279++){var _0x5c8b82=events[_0x5ed279];var _0x55f51b=createListener(_0xb4b9('0x6')+_0x5c8b82,_0x52bfb9);WhatsappAccountEvents['on'](_0x5c8b82,_0x55f51b);}}; \ No newline at end of file +var _0x179f=['./whatsappAccount.events','save','update','emit','register','length','whatsappAccount:'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x179f,0x11f));var _0xf179=function(_0x336011,_0x1e019d){_0x336011=_0x336011-0x0;var _0x1ff594=_0x179f[_0x336011];return _0x1ff594;};'use strict';var WhatsappAccountEvents=require(_0xf179('0x0'));var events=[_0xf179('0x1'),'remove',_0xf179('0x2')];function createListener(_0x436669,_0x3b3591){return function(_0x134c48){_0x3b3591[_0xf179('0x3')](_0x436669,_0x134c48);};}function removeListener(_0x488f67,_0x446c04){return function(){WhatsappAccountEvents['removeListener'](_0x488f67,_0x446c04);};}exports[_0xf179('0x4')]=function(_0x2237b7){for(var _0x3c8ec8=0x0,_0x1c11d3=events[_0xf179('0x5')];_0x3c8ec8<_0x1c11d3;_0x3c8ec8++){var _0x524f78=events[_0x3c8ec8];var _0x283b77=createListener(_0xf179('0x6')+_0x524f78,_0x2237b7);WhatsappAccountEvents['on'](_0x524f78,_0x283b77);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 305e1d7..c5476bb 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 _0xc5a2=['isAuthenticated','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','index','get','/:id'];(function(_0x4aafb2,_0x5dd1cb){var _0x23f984=function(_0x5709df){while(--_0x5709df){_0x4aafb2['push'](_0x4aafb2['shift']());}};_0x23f984(++_0x5dd1cb);}(_0xc5a2,0x16a));var _0x2c5a=function(_0x3fc62f,_0x443b35){_0x3fc62f=_0x3fc62f-0x0;var _0x16c69c=_0xc5a2[_0x3fc62f];return _0x16c69c;};'use strict';var multer=require(_0x2c5a('0x0'));var util=require('util');var path=require(_0x2c5a('0x1'));var timeout=require(_0x2c5a('0x2'));var express=require(_0x2c5a('0x3'));var router=express[_0x2c5a('0x4')]();var fs_extra=require(_0x2c5a('0x5'));var auth=require(_0x2c5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2c5a('0x7'));var controller=require(_0x2c5a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2c5a('0x9')]);router[_0x2c5a('0xa')](_0x2c5a('0xb'),auth[_0x2c5a('0xc')](),controller['show']);router['post']('/',auth[_0x2c5a('0xc')](),controller['create']);router[_0x2c5a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2c5a('0xe')]);router[_0x2c5a('0xf')](_0x2c5a('0xb'),auth[_0x2c5a('0xc')](),controller['destroy']);module[_0x2c5a('0x10')]=router; \ No newline at end of file +var _0x765c=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x27788d,_0xa40844){var _0x3c8382=function(_0x18f8b4){while(--_0x18f8b4){_0x27788d['push'](_0x27788d['shift']());}};_0x3c8382(++_0xa40844);}(_0x765c,0xac));var _0xc765=function(_0x4bf4d6,_0x53b4ae){_0x4bf4d6=_0x4bf4d6-0x0;var _0x48bbe8=_0x765c[_0x4bf4d6];return _0x48bbe8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc765('0x0'));var express=require(_0xc765('0x1'));var router=express[_0xc765('0x2')]();var fs_extra=require(_0xc765('0x3'));var auth=require(_0xc765('0x4'));var interaction=require(_0xc765('0x5'));var config=require(_0xc765('0x6'));var controller=require(_0xc765('0x7'));router[_0xc765('0x8')]('/',auth[_0xc765('0x9')](),controller[_0xc765('0xa')]);router[_0xc765('0x8')](_0xc765('0xb'),auth['isAuthenticated'](),controller[_0xc765('0xc')]);router[_0xc765('0xd')]('/',auth[_0xc765('0x9')](),controller[_0xc765('0xe')]);router[_0xc765('0xf')](_0xc765('0xb'),auth['isAuthenticated'](),controller[_0xc765('0x10')]);router[_0xc765('0x11')](_0xc765('0xb'),auth['isAuthenticated'](),controller[_0xc765('0x12')]);module[_0xc765('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 6a4bd20..aeef8ad 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 _0xd5d0=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x5c6972,_0x10a701){var _0x3579c8=function(_0x507047){while(--_0x507047){_0x5c6972['push'](_0x5c6972['shift']());}};_0x3579c8(++_0x10a701);}(_0xd5d0,0x1e2));var _0x0d5d=function(_0x4c6b93,_0x20aceb){_0x4c6b93=_0x4c6b93-0x0;var _0x5a88ee=_0xd5d0[_0x4c6b93];return _0x5a88ee;};'use strict';var Sequelize=require('sequelize');module[_0x0d5d('0x0')]={'priority':{'type':Sequelize[_0x0d5d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0d5d('0x2')},'appdata':{'type':Sequelize[_0x0d5d('0x3')]()},'description':{'type':Sequelize[_0x0d5d('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0d5d('0x5')}}; \ No newline at end of file +var _0x4d37=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x5dde20,_0x14353e){var _0x4e70e3=function(_0xcc2618){while(--_0xcc2618){_0x5dde20['push'](_0x5dde20['shift']());}};_0x4e70e3(++_0x14353e);}(_0x4d37,0x18d));var _0x74d3=function(_0xb04cb1,_0x13b8e3){_0xb04cb1=_0xb04cb1-0x0;var _0x309445=_0x4d37[_0xb04cb1];return _0x309445;};'use strict';var Sequelize=require(_0x74d3('0x0'));module[_0x74d3('0x1')]={'priority':{'type':Sequelize[_0x74d3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x74d3('0x3')},'appdata':{'type':Sequelize[_0x74d3('0x4')]()},'description':{'type':Sequelize[_0x74d3('0x5')]},'interval':{'type':Sequelize[_0x74d3('0x5')],'defaultValue':_0x74d3('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ee42f9b..069c693 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 _0xa817=['count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','merge','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','status','end','offset','undefined','limit'];(function(_0x1fbdd6,_0x21ad1f){var _0x8a8600=function(_0x31a1c3){while(--_0x31a1c3){_0x1fbdd6['push'](_0x1fbdd6['shift']());}};_0x8a8600(++_0x21ad1f);}(_0xa817,0x7b));var _0x7a81=function(_0x4a9e90,_0x517ad5){_0x4a9e90=_0x4a9e90-0x0;var _0x83f0a9=_0xa817[_0x4a9e90];return _0x83f0a9;};'use strict';var emlformat=require(_0x7a81('0x0'));var rimraf=require(_0x7a81('0x1'));var zipdir=require(_0x7a81('0x2'));var jsonpatch=require(_0x7a81('0x3'));var rp=require(_0x7a81('0x4'));var moment=require(_0x7a81('0x5'));var BPromise=require(_0x7a81('0x6'));var Mustache=require(_0x7a81('0x7'));var util=require(_0x7a81('0x8'));var path=require('path');var sox=require(_0x7a81('0x9'));var csv=require(_0x7a81('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a81('0xb'));var _=require(_0x7a81('0xc'));var squel=require(_0x7a81('0xd'));var crypto=require(_0x7a81('0xe'));var jsforce=require(_0x7a81('0xf'));var deskjs=require(_0x7a81('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7a81('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a81('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7a81('0x13'));var hardwareService=require(_0x7a81('0x14'));var logger=require(_0x7a81('0x15'))(_0x7a81('0x16'));var utils=require(_0x7a81('0x17'));var config=require(_0x7a81('0x18'));var licenseUtil=require(_0x7a81('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a089,_0x32c90e){_0x32c90e=_0x32c90e||0xcc;return function(_0xc5cdf2){if(_0xc5cdf2){return _0x12a089['sendStatus'](_0x32c90e);}return _0x12a089[_0x7a81('0x1a')](_0x32c90e)[_0x7a81('0x1b')]();};}function respondWithResult(_0x2977a9,_0x4ca2d3){_0x4ca2d3=_0x4ca2d3||0xc8;return function(_0x43141a){if(_0x43141a){return _0x2977a9[_0x7a81('0x1a')](_0x4ca2d3)['json'](_0x43141a);}};}function respondWithFilteredResult(_0x4aef24,_0x1ce514){return function(_0x208a7b){if(_0x208a7b){var _0x584c0c=typeof _0x1ce514[_0x7a81('0x1c')]===_0x7a81('0x1d')&&typeof _0x1ce514[_0x7a81('0x1e')]===_0x7a81('0x1d');var _0xed69fc=_0x208a7b[_0x7a81('0x1f')];var _0x114cfa=_0x584c0c?0x0:_0x1ce514[_0x7a81('0x1c')];var _0x2b5720=_0x584c0c?_0x208a7b[_0x7a81('0x1f')]:_0x1ce514[_0x7a81('0x1c')]+_0x1ce514[_0x7a81('0x1e')];var _0x1aefdf;if(_0x2b5720>=_0xed69fc){_0x2b5720=_0xed69fc;_0x1aefdf=0xc8;}else{_0x1aefdf=0xce;}_0x4aef24['status'](_0x1aefdf);return _0x4aef24[_0x7a81('0x20')](_0x7a81('0x21'),_0x114cfa+'-'+_0x2b5720+'/'+_0xed69fc)[_0x7a81('0x22')](_0x208a7b);}return null;};}function patchUpdates(_0x3087c0){return function(_0x3b0786){try{jsonpatch[_0x7a81('0x23')](_0x3b0786,_0x3087c0,!![]);}catch(_0x34dd0b){return BPromise[_0x7a81('0x24')](_0x34dd0b);}return _0x3b0786[_0x7a81('0x25')]();};}function saveUpdates(_0x596a8c,_0x3c0c41){return function(_0x26b384){if(_0x26b384){return _0x26b384[_0x7a81('0x26')](_0x596a8c)[_0x7a81('0x27')](function(_0x26556b){return _0x26556b;});}return null;};}function removeEntity(_0x15a1cd,_0x249ae1){return function(_0x21c45a){if(_0x21c45a){return _0x21c45a['destroy']()[_0x7a81('0x27')](function(){_0x15a1cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2476,_0x41ea68){return function(_0x13d2ae){if(!_0x13d2ae){_0x1e2476['sendStatus'](0x194);}return _0x13d2ae;};}function handleError(_0x2abcf4,_0x35f521){_0x35f521=_0x35f521||0x1f4;return function(_0x87e708){logger[_0x7a81('0x28')](_0x87e708[_0x7a81('0x29')]);if(_0x87e708['name']){delete _0x87e708[_0x7a81('0x2a')];}_0x2abcf4[_0x7a81('0x1a')](_0x35f521)[_0x7a81('0x2b')](_0x87e708);};}exports[_0x7a81('0x2c')]=function(_0x29655a,_0x3295df){var _0x31fe26={},_0x551c14={},_0x1a0232={'count':0x0,'rows':[]};var _0x5b79ea=_[_0x7a81('0x2d')](db[_0x7a81('0x2e')][_0x7a81('0x2f')],function(_0x523d39){return{'name':_0x523d39[_0x7a81('0x30')],'type':_0x523d39['type']['key']};});_0x551c14[_0x7a81('0x31')]=_[_0x7a81('0x2d')](_0x5b79ea,_0x7a81('0x2a'));_0x551c14[_0x7a81('0x32')]=_[_0x7a81('0x33')](_0x29655a['query']);_0x551c14[_0x7a81('0x34')]=_[_0x7a81('0x35')](_0x551c14[_0x7a81('0x31')],_0x551c14[_0x7a81('0x32')]);_0x31fe26[_0x7a81('0x36')]=_[_0x7a81('0x35')](_0x551c14[_0x7a81('0x31')],qs['fields'](_0x29655a[_0x7a81('0x32')][_0x7a81('0x37')]));_0x31fe26[_0x7a81('0x36')]=_0x31fe26['attributes'][_0x7a81('0x38')]?_0x31fe26[_0x7a81('0x36')]:_0x551c14[_0x7a81('0x31')];if(!_0x29655a[_0x7a81('0x32')]['hasOwnProperty'](_0x7a81('0x39'))){_0x31fe26[_0x7a81('0x1e')]=qs[_0x7a81('0x1e')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x1e')]);_0x31fe26['offset']=qs[_0x7a81('0x1c')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x1c')]);}_0x31fe26[_0x7a81('0x3a')]=qs[_0x7a81('0x3b')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x3b')]);_0x31fe26['where']=qs['filters'](_[_0x7a81('0x3c')](_0x29655a[_0x7a81('0x32')],_0x551c14['filters']),_0x5b79ea);if(_0x29655a[_0x7a81('0x32')][_0x7a81('0x3d')]){_0x31fe26[_0x7a81('0x3e')]=_['merge'](_0x31fe26[_0x7a81('0x3e')],{'$or':_[_0x7a81('0x2d')](_0x5b79ea,function(_0x4be82f){if(_0x4be82f[_0x7a81('0x3f')]!==_0x7a81('0x40')){var _0x475aac={};_0x475aac[_0x4be82f['name']]={'$like':'%'+_0x29655a[_0x7a81('0x32')][_0x7a81('0x3d')]+'%'};return _0x475aac;}})});}_0x31fe26=_['merge']({},_0x31fe26,_0x29655a[_0x7a81('0x41')]);var _0x315db1={'where':_0x31fe26[_0x7a81('0x3e')]};return db[_0x7a81('0x2e')][_0x7a81('0x1f')](_0x315db1)[_0x7a81('0x27')](function(_0x4723ea){_0x1a0232['count']=_0x4723ea;if(_0x29655a['query'][_0x7a81('0x42')]){_0x31fe26[_0x7a81('0x43')]=[{'all':!![]}];}return db[_0x7a81('0x2e')][_0x7a81('0x44')](_0x31fe26);})[_0x7a81('0x27')](function(_0x25ef87){_0x1a0232[_0x7a81('0x45')]=_0x25ef87;return _0x1a0232;})[_0x7a81('0x27')](respondWithFilteredResult(_0x3295df,_0x31fe26))[_0x7a81('0x46')](handleError(_0x3295df,null));};exports['show']=function(_0x28f628,_0x58777a){var _0x4f9bb7={'raw':!![],'where':{'id':_0x28f628['params']['id']}},_0x611df={};_0x611df['model']=_[_0x7a81('0x33')](db[_0x7a81('0x2e')][_0x7a81('0x2f')]);_0x611df[_0x7a81('0x32')]=_[_0x7a81('0x33')](_0x28f628[_0x7a81('0x32')]);_0x611df[_0x7a81('0x34')]=_[_0x7a81('0x35')](_0x611df[_0x7a81('0x31')],_0x611df[_0x7a81('0x32')]);_0x4f9bb7[_0x7a81('0x36')]=_[_0x7a81('0x35')](_0x611df[_0x7a81('0x31')],qs['fields'](_0x28f628[_0x7a81('0x32')][_0x7a81('0x37')]));_0x4f9bb7[_0x7a81('0x36')]=_0x4f9bb7[_0x7a81('0x36')][_0x7a81('0x38')]?_0x4f9bb7['attributes']:_0x611df[_0x7a81('0x31')];if(_0x28f628[_0x7a81('0x32')][_0x7a81('0x42')]){_0x4f9bb7['include']=[{'all':!![]}];}_0x4f9bb7=_[_0x7a81('0x47')]({},_0x4f9bb7,_0x28f628[_0x7a81('0x41')]);return db[_0x7a81('0x2e')][_0x7a81('0x48')](_0x4f9bb7)[_0x7a81('0x27')](handleEntityNotFound(_0x58777a,null))[_0x7a81('0x27')](respondWithResult(_0x58777a,null))[_0x7a81('0x46')](handleError(_0x58777a,null));};exports['create']=function(_0x40c17c,_0x473e42){return db[_0x7a81('0x2e')][_0x7a81('0x49')](_0x40c17c[_0x7a81('0x4a')],{})[_0x7a81('0x27')](respondWithResult(_0x473e42,0xc9))['catch'](handleError(_0x473e42,null));};exports['update']=function(_0x31a0aa,_0x7fb80){if(_0x31a0aa[_0x7a81('0x4a')]['id']){delete _0x31a0aa[_0x7a81('0x4a')]['id'];}return db['WhatsappApplication'][_0x7a81('0x48')]({'where':{'id':_0x31a0aa[_0x7a81('0x4b')]['id']}})[_0x7a81('0x27')](handleEntityNotFound(_0x7fb80,null))[_0x7a81('0x27')](saveUpdates(_0x31a0aa[_0x7a81('0x4a')],null))['then'](respondWithResult(_0x7fb80,null))['catch'](handleError(_0x7fb80,null));};exports[_0x7a81('0x4c')]=function(_0x450f67,_0x1ed652){return db['WhatsappApplication'][_0x7a81('0x48')]({'where':{'id':_0x450f67[_0x7a81('0x4b')]['id']}})[_0x7a81('0x27')](handleEntityNotFound(_0x1ed652,null))[_0x7a81('0x27')](removeEntity(_0x1ed652,null))['catch'](handleError(_0x1ed652,null));}; \ No newline at end of file +var _0x4c99=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','eml-format','zip-dir','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4c99,0x1ec));var _0x94c9=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x4c99[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0x94c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x94c9('0x2'));var Mustache=require(_0x94c9('0x3'));var util=require('util');var path=require(_0x94c9('0x4'));var sox=require(_0x94c9('0x5'));var csv=require('to-csv');var ejs=require(_0x94c9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x94c9('0x7'));var jsforce=require(_0x94c9('0x8'));var deskjs=require(_0x94c9('0x9'));var toCsv=require(_0x94c9('0xa'));var querystring=require(_0x94c9('0xb'));var Papa=require(_0x94c9('0xc'));var Redis=require(_0x94c9('0xd'));var authService=require(_0x94c9('0xe'));var qs=require(_0x94c9('0xf'));var as=require(_0x94c9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x94c9('0x11'))(_0x94c9('0x12'));var utils=require(_0x94c9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x94c9('0x14'));var db=require(_0x94c9('0x15'))['db'];function respondWithStatusCode(_0x3a5540,_0xadd7ac){_0xadd7ac=_0xadd7ac||0xcc;return function(_0x2a2c24){if(_0x2a2c24){return _0x3a5540[_0x94c9('0x16')](_0xadd7ac);}return _0x3a5540[_0x94c9('0x17')](_0xadd7ac)[_0x94c9('0x18')]();};}function respondWithResult(_0x495654,_0x5990e8){_0x5990e8=_0x5990e8||0xc8;return function(_0x5801d3){if(_0x5801d3){return _0x495654[_0x94c9('0x17')](_0x5990e8)[_0x94c9('0x19')](_0x5801d3);}};}function respondWithFilteredResult(_0x5249d3,_0x210709){return function(_0x3abfa5){if(_0x3abfa5){var _0x372b66=typeof _0x210709['offset']==='undefined'&&typeof _0x210709[_0x94c9('0x1a')]===_0x94c9('0x1b');var _0x8778dc=_0x3abfa5[_0x94c9('0x1c')];var _0x5ab49f=_0x372b66?0x0:_0x210709[_0x94c9('0x1d')];var _0x2bca02=_0x372b66?_0x3abfa5[_0x94c9('0x1c')]:_0x210709[_0x94c9('0x1d')]+_0x210709[_0x94c9('0x1a')];var _0xf48950;if(_0x2bca02>=_0x8778dc){_0x2bca02=_0x8778dc;_0xf48950=0xc8;}else{_0xf48950=0xce;}_0x5249d3[_0x94c9('0x17')](_0xf48950);return _0x5249d3['set'](_0x94c9('0x1e'),_0x5ab49f+'-'+_0x2bca02+'/'+_0x8778dc)[_0x94c9('0x19')](_0x3abfa5);}return null;};}function patchUpdates(_0x4d7a9b){return function(_0x35b03c){try{jsonpatch[_0x94c9('0x1f')](_0x35b03c,_0x4d7a9b,!![]);}catch(_0x114828){return BPromise[_0x94c9('0x20')](_0x114828);}return _0x35b03c[_0x94c9('0x21')]();};}function saveUpdates(_0x2892d1,_0x410f00){return function(_0x45f33f){if(_0x45f33f){return _0x45f33f[_0x94c9('0x22')](_0x2892d1)[_0x94c9('0x23')](function(_0x553196){return _0x553196;});}return null;};}function removeEntity(_0x2f20bd,_0x50ee41){return function(_0xf5ce65){if(_0xf5ce65){return _0xf5ce65['destroy']()[_0x94c9('0x23')](function(){_0x2f20bd[_0x94c9('0x17')](0xcc)[_0x94c9('0x18')]();});}};}function handleEntityNotFound(_0xf73058,_0x1821a2){return function(_0x158db9){if(!_0x158db9){_0xf73058['sendStatus'](0x194);}return _0x158db9;};}function handleError(_0xeb9f1,_0x1ba423){_0x1ba423=_0x1ba423||0x1f4;return function(_0x15718d){logger['error'](_0x15718d[_0x94c9('0x24')]);if(_0x15718d['name']){delete _0x15718d[_0x94c9('0x25')];}_0xeb9f1[_0x94c9('0x17')](_0x1ba423)[_0x94c9('0x26')](_0x15718d);};}exports[_0x94c9('0x27')]=function(_0x299ad1,_0x46a8fc){var _0x5d265f={},_0x3ab136={},_0x16bdb3={'count':0x0,'rows':[]};var _0x31ee63=_['map'](db[_0x94c9('0x28')][_0x94c9('0x29')],function(_0x1337c9){return{'name':_0x1337c9[_0x94c9('0x2a')],'type':_0x1337c9['type'][_0x94c9('0x2b')]};});_0x3ab136[_0x94c9('0x2c')]=_['map'](_0x31ee63,_0x94c9('0x25'));_0x3ab136[_0x94c9('0x2d')]=_[_0x94c9('0x2e')](_0x299ad1[_0x94c9('0x2d')]);_0x3ab136[_0x94c9('0x2f')]=_[_0x94c9('0x30')](_0x3ab136[_0x94c9('0x2c')],_0x3ab136['query']);_0x5d265f[_0x94c9('0x31')]=_[_0x94c9('0x30')](_0x3ab136[_0x94c9('0x2c')],qs[_0x94c9('0x32')](_0x299ad1['query'][_0x94c9('0x32')]));_0x5d265f[_0x94c9('0x31')]=_0x5d265f['attributes'][_0x94c9('0x33')]?_0x5d265f[_0x94c9('0x31')]:_0x3ab136[_0x94c9('0x2c')];if(!_0x299ad1['query'][_0x94c9('0x34')](_0x94c9('0x35'))){_0x5d265f['limit']=qs[_0x94c9('0x1a')](_0x299ad1['query']['limit']);_0x5d265f[_0x94c9('0x1d')]=qs['offset'](_0x299ad1[_0x94c9('0x2d')][_0x94c9('0x1d')]);}_0x5d265f[_0x94c9('0x36')]=qs[_0x94c9('0x37')](_0x299ad1[_0x94c9('0x2d')][_0x94c9('0x37')]);_0x5d265f['where']=qs[_0x94c9('0x2f')](_[_0x94c9('0x38')](_0x299ad1[_0x94c9('0x2d')],_0x3ab136[_0x94c9('0x2f')]),_0x31ee63);if(_0x299ad1['query'][_0x94c9('0x39')]){_0x5d265f[_0x94c9('0x3a')]=_[_0x94c9('0x3b')](_0x5d265f[_0x94c9('0x3a')],{'$or':_['map'](_0x31ee63,function(_0xfea7b){if(_0xfea7b[_0x94c9('0x3c')]!==_0x94c9('0x3d')){var _0x4e2854={};_0x4e2854[_0xfea7b[_0x94c9('0x25')]]={'$like':'%'+_0x299ad1[_0x94c9('0x2d')][_0x94c9('0x39')]+'%'};return _0x4e2854;}})});}_0x5d265f=_[_0x94c9('0x3b')]({},_0x5d265f,_0x299ad1[_0x94c9('0x3e')]);var _0x1c474b={'where':_0x5d265f[_0x94c9('0x3a')]};return db[_0x94c9('0x28')][_0x94c9('0x1c')](_0x1c474b)[_0x94c9('0x23')](function(_0x62fa1e){_0x16bdb3[_0x94c9('0x1c')]=_0x62fa1e;if(_0x299ad1[_0x94c9('0x2d')][_0x94c9('0x3f')]){_0x5d265f[_0x94c9('0x40')]=[{'all':!![]}];}return db[_0x94c9('0x28')][_0x94c9('0x41')](_0x5d265f);})[_0x94c9('0x23')](function(_0x13825d){_0x16bdb3[_0x94c9('0x42')]=_0x13825d;return _0x16bdb3;})[_0x94c9('0x23')](respondWithFilteredResult(_0x46a8fc,_0x5d265f))['catch'](handleError(_0x46a8fc,null));};exports[_0x94c9('0x43')]=function(_0x2ebc10,_0x2e6da2){var _0x4ed9bd={'raw':!![],'where':{'id':_0x2ebc10['params']['id']}},_0x19cfe6={};_0x19cfe6[_0x94c9('0x2c')]=_[_0x94c9('0x2e')](db[_0x94c9('0x28')]['rawAttributes']);_0x19cfe6[_0x94c9('0x2d')]=_['keys'](_0x2ebc10[_0x94c9('0x2d')]);_0x19cfe6[_0x94c9('0x2f')]=_[_0x94c9('0x30')](_0x19cfe6[_0x94c9('0x2c')],_0x19cfe6[_0x94c9('0x2d')]);_0x4ed9bd[_0x94c9('0x31')]=_['intersection'](_0x19cfe6['model'],qs['fields'](_0x2ebc10[_0x94c9('0x2d')][_0x94c9('0x32')]));_0x4ed9bd[_0x94c9('0x31')]=_0x4ed9bd['attributes'][_0x94c9('0x33')]?_0x4ed9bd['attributes']:_0x19cfe6[_0x94c9('0x2c')];if(_0x2ebc10[_0x94c9('0x2d')][_0x94c9('0x3f')]){_0x4ed9bd[_0x94c9('0x40')]=[{'all':!![]}];}_0x4ed9bd=_[_0x94c9('0x3b')]({},_0x4ed9bd,_0x2ebc10[_0x94c9('0x3e')]);return db[_0x94c9('0x28')]['find'](_0x4ed9bd)[_0x94c9('0x23')](handleEntityNotFound(_0x2e6da2,null))['then'](respondWithResult(_0x2e6da2,null))[_0x94c9('0x44')](handleError(_0x2e6da2,null));};exports[_0x94c9('0x45')]=function(_0x9e0fb8,_0x9db0af){return db[_0x94c9('0x28')][_0x94c9('0x45')](_0x9e0fb8[_0x94c9('0x46')],{})[_0x94c9('0x23')](respondWithResult(_0x9db0af,0xc9))['catch'](handleError(_0x9db0af,null));};exports[_0x94c9('0x22')]=function(_0x4653d4,_0x27b1d3){if(_0x4653d4[_0x94c9('0x46')]['id']){delete _0x4653d4[_0x94c9('0x46')]['id'];}return db['WhatsappApplication'][_0x94c9('0x47')]({'where':{'id':_0x4653d4[_0x94c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x27b1d3,null))[_0x94c9('0x23')](saveUpdates(_0x4653d4['body'],null))[_0x94c9('0x23')](respondWithResult(_0x27b1d3,null))['catch'](handleError(_0x27b1d3,null));};exports['destroy']=function(_0x2b4dca,_0x5155e3){return db[_0x94c9('0x28')]['find']({'where':{'id':_0x2b4dca[_0x94c9('0x48')]['id']}})[_0x94c9('0x23')](handleEntityNotFound(_0x5155e3,null))[_0x94c9('0x23')](removeEntity(_0x5155e3,null))['catch'](handleError(_0x5155e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 80f8f1d..de27a01 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca8d=['whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x5e3fd5,_0x50e0e2){var _0x15f35e=function(_0x15c758){while(--_0x15c758){_0x5e3fd5['push'](_0x5e3fd5['shift']());}};_0x15f35e(++_0x50e0e2);}(_0xca8d,0x172));var _0xdca8=function(_0x5499d9,_0x1abd4f){_0x5499d9=_0x5499d9-0x0;var _0x52054c=_0xca8d[_0x5499d9];return _0x52054c;};'use strict';var _=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var logger=require(_0xdca8('0x2'))(_0xdca8('0x3'));var moment=require(_0xdca8('0x4'));var BPromise=require(_0xdca8('0x5'));var rp=require(_0xdca8('0x6'));var fs=require('fs');var path=require(_0xdca8('0x7'));var rimraf=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var attributes=require(_0xdca8('0xa'));module[_0xdca8('0xb')]=function(_0x4d6383,_0x3366d5){return _0x4d6383[_0xdca8('0xc')](_0xdca8('0xd'),attributes,{'tableName':_0xdca8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdca8('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6f7f=['api','moment','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x44236c,_0x1bb771){var _0x533730=function(_0x3b79ad){while(--_0x3b79ad){_0x44236c['push'](_0x44236c['shift']());}};_0x533730(++_0x1bb771);}(_0x6f7f,0x177));var _0xf6f7=function(_0x3af057,_0x7ca513){_0x3af057=_0x3af057-0x0;var _0x1e1a26=_0x6f7f[_0x3af057];return _0x1e1a26;};'use strict';var _=require('lodash');var util=require(_0xf6f7('0x0'));var logger=require(_0xf6f7('0x1'))(_0xf6f7('0x2'));var moment=require(_0xf6f7('0x3'));var BPromise=require(_0xf6f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6f7('0x5'));var rimraf=require('rimraf');var config=require(_0xf6f7('0x6'));var attributes=require(_0xf6f7('0x7'));module[_0xf6f7('0x8')]=function(_0x5495b9,_0x2f6df9){return _0x5495b9['define'](_0xf6f7('0x9'),attributes,{'tableName':_0xf6f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6f7('0xb'),'collate':_0xf6f7('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index cc5c094..b0e310d 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 _0xb903=['http','request','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x44876a,_0x4699fc){var _0x3c1647=function(_0x212713){while(--_0x212713){_0x44876a['push'](_0x44876a['shift']());}};_0x3c1647(++_0x4699fc);}(_0xb903,0x185));var _0x3b90=function(_0x3e002e,_0x27323a){_0x3e002e=_0x3e002e-0x0;var _0x162c68=_0xb903[_0x3e002e];return _0x162c68;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x12bdf0,_0x5158b5){var _0x25e13d=function(_0x1fe0b6){while(--_0x1fe0b6){_0x12bdf0['push'](_0x12bdf0['shift']());}};_0x25e13d(++_0x5158b5);}(_0x24ca,0x1bc));var _0xa24c=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x24ca[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index adf9970..59ded84 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 _0x292c=['getMessages','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','whatsapp','update','delete','tracked','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages'];(function(_0x4e77c6,_0x4c359c){var _0x3e326c=function(_0x50e425){while(--_0x50e425){_0x4e77c6['push'](_0x4e77c6['shift']());}};_0x3e326c(++_0x4c359c);}(_0x292c,0x66));var _0xc292=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x292c[_0x34325b];return _0x3da348;};'use strict';var multer=require(_0xc292('0x0'));var util=require('util');var path=require(_0xc292('0x1'));var timeout=require(_0xc292('0x2'));var express=require(_0xc292('0x3'));var router=express[_0xc292('0x4')]();var fs_extra=require(_0xc292('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc292('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xc292('0x7')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x9')]);router[_0xc292('0x7')](_0xc292('0xa'),auth[_0xc292('0x8')](),controller[_0xc292('0xb')]);router[_0xc292('0x7')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller['show']);router[_0xc292('0x7')](_0xc292('0xd'),auth[_0xc292('0x8')](),controller[_0xc292('0xe')]);router[_0xc292('0x7')]('/:id/download',auth[_0xc292('0x8')](),controller[_0xc292('0xf')]);router[_0xc292('0x10')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x11')]);router[_0xc292('0x10')]('/:id/messages',auth[_0xc292('0x8')](),controller[_0xc292('0x12')]);router[_0xc292('0x10')](_0xc292('0x13'),auth[_0xc292('0x8')](),interaction['tracked']('whatsapp',_0xc292('0x14')),controller[_0xc292('0x15')]);router['put'](_0xc292('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xc292('0x16'),'whatsappinteraction:update'),controller[_0xc292('0x17')]);router[_0xc292('0x18')](_0xc292('0xc'),auth['isAuthenticated'](),interaction[_0xc292('0x19')]('whatsapp','whatsappinteraction:destroy'),controller[_0xc292('0x1a')]);router[_0xc292('0x18')]('/:id/tags',auth[_0xc292('0x8')](),controller[_0xc292('0x1b')]);module[_0xc292('0x1c')]=router; \ No newline at end of file +var _0x4351=['whatsappinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','download','post','/:id/tags','whatsappinteraction:addtags','put','tracked','whatsapp','whatsappinteraction:update','update','delete'];(function(_0x11e19e,_0x3fe5da){var _0x43a564=function(_0x2021bd){while(--_0x2021bd){_0x11e19e['push'](_0x11e19e['shift']());}};_0x43a564(++_0x3fe5da);}(_0x4351,0x1b5));var _0x1435=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4351[_0x279d37];return _0x530173;};'use strict';var multer=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var path=require(_0x1435('0x2'));var timeout=require(_0x1435('0x3'));var express=require(_0x1435('0x4'));var router=express[_0x1435('0x5')]();var fs_extra=require(_0x1435('0x6'));var auth=require(_0x1435('0x7'));var interaction=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var controller=require(_0x1435('0xa'));router[_0x1435('0xb')]('/',auth[_0x1435('0xc')](),controller[_0x1435('0xd')]);router[_0x1435('0xb')]('/describe',auth[_0x1435('0xc')](),controller['describe']);router['get'](_0x1435('0xe'),auth[_0x1435('0xc')](),controller[_0x1435('0xf')]);router[_0x1435('0xb')](_0x1435('0x10'),auth['isAuthenticated'](),controller[_0x1435('0x11')]);router[_0x1435('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x1435('0x12')]);router['post']('/',auth[_0x1435('0xc')](),controller['create']);router[_0x1435('0x13')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x1435('0x13')](_0x1435('0x14'),auth[_0x1435('0xc')](),interaction['tracked']('whatsapp',_0x1435('0x15')),controller['addTags']);router[_0x1435('0x16')](_0x1435('0xe'),auth[_0x1435('0xc')](),interaction[_0x1435('0x17')](_0x1435('0x18'),_0x1435('0x19')),controller[_0x1435('0x1a')]);router[_0x1435('0x1b')](_0x1435('0xe'),auth[_0x1435('0xc')](),interaction[_0x1435('0x17')](_0x1435('0x18'),_0x1435('0x1c')),controller[_0x1435('0x1d')]);router[_0x1435('0x1b')]('/:id/tags',auth[_0x1435('0xc')](),controller[_0x1435('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3f72559..fc45ec1 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 _0x98a8=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x98a8,0x12c));var _0x898a=function(_0xd37b35,_0x46a07c){_0xd37b35=_0xd37b35-0x0;var _0x3b04c5=_0x98a8[_0xd37b35];return _0x3b04c5;};'use strict';var Sequelize=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));module[_0x898a('0x2')]={'closed':{'type':Sequelize[_0x898a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x898a('0x4')]},'disposition':{'type':Sequelize[_0x898a('0x5')]},'secondDisposition':{'type':Sequelize[_0x898a('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x898a('0x5')]},'phone':{'type':Sequelize[_0x898a('0x5')]},'read1stAt':{'type':Sequelize[_0x898a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x898a('0x6')]('in',_0x898a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x898a('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x898a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x04f1=['out','BOOLEAN','sequelize','moment','exports','STRING','DATE','ENUM'];(function(_0x19a4ed,_0x476e25){var _0x4f8121=function(_0x29276c){while(--_0x29276c){_0x19a4ed['push'](_0x19a4ed['shift']());}};_0x4f8121(++_0x476e25);}(_0x04f1,0x92));var _0x104f=function(_0x1dceb0,_0x46ea75){_0x1dceb0=_0x1dceb0-0x0;var _0x13a639=_0x04f1[_0x1dceb0];return _0x13a639;};'use strict';var Sequelize=require(_0x104f('0x0'));var moment=require(_0x104f('0x1'));module[_0x104f('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x104f('0x3')]},'secondDisposition':{'type':Sequelize[_0x104f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x104f('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x104f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x104f('0x5')]('in',_0x104f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x104f('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 964feab..0a67f19 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 _0x3e4d=['ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','keys','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','rows','show','params','includeAll','options','create','WhatsappInteraction','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','tmp','join','fullname','firstName','attachments','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Owner','get','Whatsapp','Account','closedAt','existsSync','createReadStream','createWriteStream','basename','System','lastName','out','renderFile','downloadInteraction.ejs','transcript-','download','log','err','unlinkSync','eml-format','zip-dir','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','end','stack','name','send','Users','TagIds','Tags','split','forEach','push','catch','talking','answered','unmanaged','closed','UserId','waiting','total','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find'];(function(_0x3e5d32,_0x19ce13){var _0x3e7822=function(_0x5c192c){while(--_0x5c192c){_0x3e5d32['push'](_0x3e5d32['shift']());}};_0x3e7822(++_0x19ce13);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x39b612,_0x2cc50d){_0x39b612=_0x39b612-0x0;var _0x2bfd7d=_0x3e4d[_0x39b612];return _0x2bfd7d;};'use strict';var emlformat=require(_0xd3e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3e4('0x2'));var Mustache=require(_0xd3e4('0x3'));var util=require(_0xd3e4('0x4'));var path=require('path');var sox=require(_0xd3e4('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3e4('0x6'));var _=require(_0xd3e4('0x7'));var squel=require(_0xd3e4('0x8'));var crypto=require(_0xd3e4('0x9'));var jsforce=require(_0xd3e4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd3e4('0xb'));var querystring=require(_0xd3e4('0xc'));var Papa=require(_0xd3e4('0xd'));var Redis=require('ioredis');var authService=require(_0xd3e4('0xe'));var qs=require(_0xd3e4('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xd3e4('0x10'));var logger=require(_0xd3e4('0x11'))(_0xd3e4('0x12'));var utils=require(_0xd3e4('0x13'));var config=require(_0xd3e4('0x14'));var licenseUtil=require(_0xd3e4('0x15'));var db=require(_0xd3e4('0x16'))['db'];config['redis']=_[_0xd3e4('0x17')](config[_0xd3e4('0x18')],{'host':_0xd3e4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd3e4('0x1a'))['register'](socket);function respondWithStatusCode(_0x33daec,_0xa878f1){_0xa878f1=_0xa878f1||0xcc;return function(_0x586db9){if(_0x586db9){return _0x33daec[_0xd3e4('0x1b')](_0xa878f1);}return _0x33daec[_0xd3e4('0x1c')](_0xa878f1)['end']();};}function respondWithResult(_0x4fae0a,_0x5acc91){_0x5acc91=_0x5acc91||0xc8;return function(_0x353f84){if(_0x353f84){return _0x4fae0a[_0xd3e4('0x1c')](_0x5acc91)[_0xd3e4('0x1d')](_0x353f84);}};}function respondWithFilteredResult(_0x157658,_0xcf261b){return function(_0x48d143){if(_0x48d143){var _0x1a6d65=typeof _0xcf261b[_0xd3e4('0x1e')]===_0xd3e4('0x1f')&&typeof _0xcf261b['limit']===_0xd3e4('0x1f');var _0x43eda6=_0x48d143[_0xd3e4('0x20')];var _0x4d1cd1=_0x1a6d65?0x0:_0xcf261b[_0xd3e4('0x1e')];var _0x2e2ab8=_0x1a6d65?_0x48d143[_0xd3e4('0x20')]:_0xcf261b[_0xd3e4('0x1e')]+_0xcf261b[_0xd3e4('0x21')];var _0xa147d2;if(_0x2e2ab8>=_0x43eda6){_0x2e2ab8=_0x43eda6;_0xa147d2=0xc8;}else{_0xa147d2=0xce;}_0x157658[_0xd3e4('0x1c')](_0xa147d2);return _0x157658[_0xd3e4('0x22')](_0xd3e4('0x23'),_0x4d1cd1+'-'+_0x2e2ab8+'/'+_0x43eda6)[_0xd3e4('0x1d')](_0x48d143);}return null;};}function patchUpdates(_0x522f94){return function(_0x19ad0f){try{jsonpatch['apply'](_0x19ad0f,_0x522f94,!![]);}catch(_0x17b41a){return BPromise[_0xd3e4('0x24')](_0x17b41a);}return _0x19ad0f[_0xd3e4('0x25')]();};}function saveUpdates(_0x82d2c5,_0x426aa4){return function(_0x128efb){if(_0x128efb){return _0x128efb[_0xd3e4('0x26')](_0x82d2c5)['then'](function(_0x512ab8){return _0x512ab8;});}return null;};}function removeEntity(_0x81b1f5,_0x239763){return function(_0xebf9ff){if(_0xebf9ff){return _0xebf9ff[_0xd3e4('0x27')]()[_0xd3e4('0x28')](function(){_0x81b1f5[_0xd3e4('0x1c')](0xcc)[_0xd3e4('0x29')]();});}};}function handleEntityNotFound(_0x520383,_0x4bfec1){return function(_0x578c9e){if(!_0x578c9e){_0x520383[_0xd3e4('0x1b')](0x194);}return _0x578c9e;};}function handleError(_0x5e96fc,_0x46dada){_0x46dada=_0x46dada||0x1f4;return function(_0x387ea6){logger['error'](_0x387ea6[_0xd3e4('0x2a')]);if(_0x387ea6[_0xd3e4('0x2b')]){delete _0x387ea6[_0xd3e4('0x2b')];}_0x5e96fc[_0xd3e4('0x1c')](_0x46dada)[_0xd3e4('0x2c')](_0x387ea6);};}function getInteractionUsers(_0x22036d,_0x1b6cab){return new BPromise(function(_0x2f0571,_0x2ba847){try{if(_0x1b6cab[_0x22036d['id']]){_0x22036d[_0xd3e4('0x2d')]=_['map'](_0x1b6cab[_0x22036d['id']],function(_0x267e88){return{'id':_0x267e88['id'],'fullname':_0x267e88['fullname']};});}}catch(_0x3fe00d){_0x2ba847(_0x3fe00d);}_0x2f0571(_0x22036d);});}function getInteractionTags(_0x47bd95,_0x594ed3){return new BPromise(function(_0x57446a,_0x2c6cce){try{if(_0x47bd95[_0xd3e4('0x2e')]){_0x47bd95[_0xd3e4('0x2f')]=[];_0x47bd95['TagIds'][_0xd3e4('0x30')](',')[_0xd3e4('0x31')](function(_0x1ca7f4){_0x47bd95[_0xd3e4('0x2f')][_0xd3e4('0x32')](_0x594ed3[_0x1ca7f4]);});}delete _0x47bd95[_0xd3e4('0x2e')];}catch(_0x5cdd82){_0x2c6cce(_0x5cdd82);}_0x57446a(_0x47bd95);});}function updateWhatsappInteraction(_0x4affa6,_0x18bc38,_0x479d00){return new BPromise(function(_0x85379e,_0x373c99){return getInteractionUsers(_0x4affa6,_0x479d00)[_0xd3e4('0x28')](function(_0x58c9b1){return getInteractionTags(_0x58c9b1,_0x18bc38);})[_0xd3e4('0x28')](function(_0x599ff0){return getStateInteraction(_0x599ff0);})[_0xd3e4('0x28')](function(_0x361699){_0x85379e(_0x361699);})[_0xd3e4('0x33')](function(_0x132bbe){_0x373c99(_0x132bbe);});});}function getStateInteraction(_0x49bf5a){return new BPromise(function(_0xb74c6e){_0x49bf5a['waiting']=0x0;_0x49bf5a[_0xd3e4('0x34')]=0x0;_0x49bf5a[_0xd3e4('0x35')]=0x0;_0x49bf5a[_0xd3e4('0x36')]=0x0;_0x49bf5a['total']=0x0;if(!_0x49bf5a[_0xd3e4('0x37')]&&!_0x49bf5a[_0xd3e4('0x38')]){_0x49bf5a[_0xd3e4('0x39')]+=0x1;}if(!_0x49bf5a[_0xd3e4('0x37')]&&_0x49bf5a[_0xd3e4('0x38')]){_0x49bf5a[_0xd3e4('0x34')]+=0x1;if(_0x49bf5a[_0xd3e4('0x39')]){_0x49bf5a[_0xd3e4('0x39')]-=0x1;}}if(_0x49bf5a[_0xd3e4('0x37')]&&_0x49bf5a[_0xd3e4('0x38')]){_0x49bf5a[_0xd3e4('0x35')]+=0x1;if(_0x49bf5a[_0xd3e4('0x34')]){_0x49bf5a['talking']-=0x1;}}if(_0x49bf5a[_0xd3e4('0x37')]&&!_0x49bf5a[_0xd3e4('0x38')]){_0x49bf5a[_0xd3e4('0x36')]+=0x1;if(_0x49bf5a[_0xd3e4('0x39')]){_0x49bf5a[_0xd3e4('0x39')]-=0x1;}}_0x49bf5a[_0xd3e4('0x3a')]+=0x1;_0xb74c6e(_0x49bf5a);});}exports[_0xd3e4('0x3b')]=function(_0x2f2d73,_0x848661){var _0x5f20f9={},_0xc429de={},_0x573762={'count':0x0,'rows':[]};var _0x576d32=_[_0xd3e4('0x3c')](db['WhatsappInteraction'][_0xd3e4('0x3d')],function(_0x52f496){return{'name':_0x52f496[_0xd3e4('0x3e')],'type':_0x52f496[_0xd3e4('0x3f')][_0xd3e4('0x40')]};});_0xc429de[_0xd3e4('0x41')]=_[_0xd3e4('0x3c')](_0x576d32,_0xd3e4('0x2b'));_0xc429de[_0xd3e4('0x42')]=_['keys'](_0x2f2d73['query']);_0xc429de['filters']=_[_0xd3e4('0x43')](_0xc429de[_0xd3e4('0x41')],_0xc429de[_0xd3e4('0x42')]);_0x5f20f9[_0xd3e4('0x44')]=_[_0xd3e4('0x43')](_0xc429de[_0xd3e4('0x41')],qs[_0xd3e4('0x45')](_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x45')]));_0x5f20f9[_0xd3e4('0x44')]=_0x5f20f9['attributes'][_0xd3e4('0x46')]?_0x5f20f9[_0xd3e4('0x44')]:_0xc429de[_0xd3e4('0x41')];if(!_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x47')](_0xd3e4('0x48'))){_0x5f20f9[_0xd3e4('0x21')]=qs[_0xd3e4('0x21')](_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x21')]);_0x5f20f9[_0xd3e4('0x1e')]=qs[_0xd3e4('0x1e')](_0x2f2d73['query'][_0xd3e4('0x1e')]);}_0x5f20f9[_0xd3e4('0x49')]=qs[_0xd3e4('0x4a')](_0x2f2d73['query'][_0xd3e4('0x4a')]);_0x5f20f9['where']=qs[_0xd3e4('0x4b')](_[_0xd3e4('0x4c')](_0x2f2d73[_0xd3e4('0x42')],_0xc429de[_0xd3e4('0x4b')]),_0x576d32);var _0x8ffe57=[];var _0x4e113c=squel[_0xd3e4('0x4d')]()[_0xd3e4('0x4e')]('id')['field'](_0xd3e4('0x2b'))[_0xd3e4('0x4e')](_0xd3e4('0x4f'))['from'](_0xd3e4('0x50'));var _0xbbd6ea=squel[_0xd3e4('0x4d')]()[_0xd3e4('0x4e')](_0xd3e4('0x51'))[_0xd3e4('0x4e')](_0xd3e4('0x52'))['field'](_0xd3e4('0x53'))[_0xd3e4('0x54')](_0xd3e4('0x55'),'ui')[_0xd3e4('0x56')]('users','u',_0xd3e4('0x57'));var _0x1051a2=squel['select']()['from'](_0xd3e4('0x58'),'i')[_0xd3e4('0x56')](_0xd3e4('0x59'),'c',_0xd3e4('0x5a'))['left_join'](_0xd3e4('0x5b'),'o',_0xd3e4('0x5c'))[_0xd3e4('0x56')]('whatsapp_accounts','a',_0xd3e4('0x5d'))[_0xd3e4('0x56')](_0xd3e4('0x5e'),'me',_0xd3e4('0x5f'))[_0xd3e4('0x56')]('whatsapp_interaction_has_tags','it',_0xd3e4('0x60'))[_0xd3e4('0x56')](_0xd3e4('0x50'),'t',_0xd3e4('0x61'));var _0x4954ec=squel['expr']();var _0x5e8843=[];var _0x300346=squel[_0xd3e4('0x62')]();var _0x1657c3;if(_0x2f2d73['query']['search']){_0x1657c3=as[_0xd3e4('0x63')](_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x64')]);var _0x40096e=_0x1657c3[_0xd3e4('0x65')];for(var _0x1dc530=0x0;_0x1dc530<_0x1657c3['conditions'][_0xd3e4('0x46')];_0x1dc530++){var _0xc01cf=_0x1657c3['conditions'][_0x1dc530];var _0x44d4f9='i';var _0x51d70e=_['find'](_0x576d32,[_0xd3e4('0x2b'),_0xc01cf[_0xd3e4('0x4e')]]);if(!_0x51d70e){switch(_0xc01cf[_0xd3e4('0x4e')]){case _0xd3e4('0x66'):if(_0xc01cf[_0xd3e4('0x67')]==0x1){_0x1051a2[_0xd3e4('0x68')]('`'+_0xc01cf[_0xd3e4('0x4e')]+_0xd3e4('0x69'));}else{_0x1051a2[_0xd3e4('0x68')]('`'+_0xc01cf[_0xd3e4('0x4e')]+_0xd3e4('0x6a'));}break;case _0xd3e4('0x6b'):if(_0xc01cf[_0xd3e4('0x6c')]===_0xd3e4('0x6d')){if(_0xc01cf[_0xd3e4('0x67')][_0xd3e4('0x30')]('\x20')[_0xd3e4('0x46')]>0x1){_0x4954ec[_0x40096e](_0xd3e4('0x6e'),qs[_0xd3e4('0x6f')](_0xc01cf[_0xd3e4('0x67')]),null);}else{var _0x464076='%'+_0xc01cf[_0xd3e4('0x67')]+'%';_0x4954ec[_0x40096e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x464076,_0x464076,_0x464076);}}else{_0x51d70e=_[_0xd3e4('0x70')](_0x576d32,[_0xd3e4('0x2b'),_0xd3e4('0x71')]);_0xc01cf['field']=_0xd3e4('0x71');_0x18baf0=as['buildExpression'](_0x44d4f9,_0x51d70e['type'],_0xc01cf);_0x4954ec[_0x40096e](_0x18baf0[_0xd3e4('0x72')],_0x18baf0[_0xd3e4('0x67')][_0xd3e4('0x73')],_0x18baf0['value'][_0xd3e4('0x29')]);}break;case'Tag':var _0x42f179=_0xc01cf[_0xd3e4('0x67')][_0xd3e4('0x30')](',')['map'](function(_0x31d4c9){return Number(_0x31d4c9);});_0x42f179[_0xd3e4('0x31')](function(_0x914a71){_0x300346['or'](_0xd3e4('0x74'),'%,'+_0x914a71+',%');});_0x5e8843=_[_0xd3e4('0x75')](_0x5e8843,_0x42f179);break;case _0xd3e4('0x76'):if(_0xc01cf[_0xd3e4('0x6c')]===_0xd3e4('0x6d')){_0x4954ec[_0x40096e](_0xd3e4('0x77'),'%'+_0xc01cf['value']+'%',null);}else{_0x51d70e=_[_0xd3e4('0x70')](_0x576d32,[_0xd3e4('0x2b'),_0xd3e4('0x38')]);_0xc01cf[_0xd3e4('0x4e')]='UserId';_0x18baf0=as[_0xd3e4('0x78')](_0x44d4f9,_0x51d70e[_0xd3e4('0x3f')],_0xc01cf);_0x4954ec[_0x40096e](_0x18baf0[_0xd3e4('0x72')],_0x18baf0[_0xd3e4('0x67')][_0xd3e4('0x73')],_0x18baf0[_0xd3e4('0x67')][_0xd3e4('0x29')]);}break;case _0xd3e4('0x79'):_0x18baf0=as[_0xd3e4('0x78')]('me',null,_0xc01cf);_0x4954ec[_0x40096e](_0x18baf0['text'],_0x18baf0[_0xd3e4('0x67')][_0xd3e4('0x73')],_0x18baf0[_0xd3e4('0x67')]['end']);break;}}else{var _0x18baf0=as[_0xd3e4('0x78')](_0x44d4f9,_0x51d70e[_0xd3e4('0x3f')],_0xc01cf);_0x4954ec[_0x40096e](_0x18baf0['text'],_0x18baf0['value'][_0xd3e4('0x73')],_0x18baf0['value']['end']);}}}else{var _0x143b0d=_(_0x2f2d73[_0xd3e4('0x42')])[_0xd3e4('0x7a')]()[_0xd3e4('0x3c')](function(_0x3d149b){return _[_0xd3e4('0x7b')](_0x576d32,['name',_0x3d149b])?_0x3d149b:undefined;})[_0xd3e4('0x7c')]()['value']();if(!_[_0xd3e4('0x7d')](_0x143b0d)){_0x143b0d['forEach'](function(_0x33b4be){if(_0x33b4be===_0xd3e4('0x7e')){_0x1051a2['where'](_0xd3e4('0x7f'),[][_0xd3e4('0x80')](_0x2f2d73[_0xd3e4('0x42')][_0x33b4be]));}else if(_0x33b4be==='createdAt'){var _0x52e8c1=JSON[_0xd3e4('0x81')](_0x2f2d73[_0xd3e4('0x42')][_0x33b4be])[_0xd3e4('0x82')];var _0x46e4ec=JSON[_0xd3e4('0x81')](_0x2f2d73[_0xd3e4('0x42')][_0x33b4be])[_0xd3e4('0x83')];_0x1051a2['where'](_0xd3e4('0x84'),_0x52e8c1,_0x46e4ec);}else{if(_0x2f2d73['query'][_0x33b4be]===_0xd3e4('0x85')){_0x1051a2[_0xd3e4('0x86')]('i.'+_0x33b4be+_0xd3e4('0x87'));}else{_0x1051a2[_0xd3e4('0x86')]('i.'+_0x33b4be+_0xd3e4('0x88'),_0x2f2d73['query'][_0x33b4be]);}}});}if(_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x89')]){if(_0x2f2d73[_0xd3e4('0x42')]['read']==0x1){_0x1051a2[_0xd3e4('0x68')](_0xd3e4('0x8a'));}else{_0x1051a2['having'](_0xd3e4('0x8b'));}}if(_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x8c')]){_0x5e8843=_['isArray'](_0x2f2d73['query']['tag'])?_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x8c')]:new Array(_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x8c')]);_0x5e8843[_0xd3e4('0x31')](function(_0x1f0952){_0x300346['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1f0952+',%');});}if(_0x2f2d73['query'][_0xd3e4('0x8d')]){var _0x1ec314=_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x8d')][_0xd3e4('0x8e')]('\x5c','\x5c\x5c')[_0xd3e4('0x8e')](/'/g,'\x27\x27');if(qs[_0xd3e4('0x8f')](_0x1ec314)){_0x4954ec['or'](_0xd3e4('0x90'),_0x1ec314+'%')['or']('i.phone\x20LIKE\x20?',_0x1ec314+'%');}else{_0x4954ec['or'](_0xd3e4('0x91'),qs['getFullTextValue'](_0x1ec314))['or'](_0xd3e4('0x92'),_0x1ec314+'%');}}}_0x1051a2['where'](_0x4954ec);_0x1051a2[_0xd3e4('0x93')](_0xd3e4('0x94'));var _0x40c812={'type':db[_0xd3e4('0x95')][_0xd3e4('0x96')][_0xd3e4('0x97')],'raw':!![]};var _0x3fb25a=_0x1051a2[_0xd3e4('0x98')]();_0x3fb25a['field'](_0xd3e4('0x94'));_0x3fb25a['field'](_0xd3e4('0x99'),_0xd3e4('0x66'));if(_0x5f20f9[_0xd3e4('0x49')]){_0x5f20f9['order'][_0xd3e4('0x31')](function(_0x58b041){var _0x7a98f2=_0x58b041[0x0]==='contactName'?_0x58b041[0x0]:'i.'+_0x58b041[0x0];_0x1051a2[_0xd3e4('0x49')](_0x7a98f2,_0x58b041[0x1]===_0xd3e4('0x9a')?![]:!![]);});}if(!_[_0xd3e4('0x7d')](_0x5e8843)){_0x1051a2[_0xd3e4('0x68')](_0x300346);_0x3fb25a[_0xd3e4('0x86')](_0xd3e4('0x9b'),_0x5e8843);}BPromise['resolve']()['then'](function(){if(!_0x1657c3){if(_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x7e')])return;_0x3fb25a[_0xd3e4('0x86')](_0xd3e4('0x9c'));_0x1051a2[_0xd3e4('0x86')](_0xd3e4('0x9c'));return;}if(_0x2f2d73[_0xd3e4('0x9d')][_0xd3e4('0x9e')]!==_0xd3e4('0x9f'))return;return _0x2f2d73[_0xd3e4('0x9d')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xd3e4('0x28')](function(_0x5c99fe){if(_[_0xd3e4('0x7d')](_0x5c99fe)){_0x3fb25a['where'](_0xd3e4('0xa0'));_0x1051a2[_0xd3e4('0x86')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x3fb25a[_0xd3e4('0x86')](_0xd3e4('0x7f'),_['map'](_0x5c99fe,'id'));_0x1051a2['where'](_0xd3e4('0x7f'),_['map'](_0x5c99fe,'id'));}});})[_0xd3e4('0x28')](function(){if(_0x2f2d73[_0xd3e4('0x9d')]['role']===_0xd3e4('0x9f')&&!_0x1657c3&&!_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x7e')])return[];return db[_0xd3e4('0xa1')][_0xd3e4('0x42')](_0x3fb25a['toString'](),_0x40c812);})[_0xd3e4('0x28')](function(_0x18bcd6){_0x573762[_0xd3e4('0x20')]=_0x18bcd6[_0xd3e4('0x46')];if(_0x573762['count']===0x0)return[];return db['sequelize'][_0xd3e4('0x42')](_0x4e113c[_0xd3e4('0xa2')](),_0x40c812)['then'](function(_0x1950bf){_0x8ffe57=_['keyBy'](_0x1950bf,'id');_0x40c812=_[_0xd3e4('0xa3')](_0x40c812,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f2d73[_0xd3e4('0x42')][_0xd3e4('0x45')]){_0x5f20f9[_0xd3e4('0x44')][_0xd3e4('0x31')](function(_0x4eb1c2){_0x1051a2['field']('i.'+_0x4eb1c2);});}else{_0x1051a2['field'](_0xd3e4('0x99'),_0xd3e4('0x66'));_0x1051a2[_0xd3e4('0x4e')](_0xd3e4('0xa4'),'Account.key');_0x1051a2['field']('a.mandatoryDisposition',_0xd3e4('0xa5'));_0x1051a2[_0xd3e4('0x4e')](_0xd3e4('0xa6'),'contactName');_0x1051a2[_0xd3e4('0x4e')](_0xd3e4('0xa7'));_0x1051a2[_0xd3e4('0x4e')]('c.firstName','Contact.firstName');_0x1051a2[_0xd3e4('0x4e')]('c.lastName',_0xd3e4('0xa8'));_0x1051a2['field'](_0xd3e4('0xa9'),_0xd3e4('0xaa'));_0x1051a2['field'](_0xd3e4('0xab'),_0xd3e4('0xac'));_0x1051a2['field'](_0xd3e4('0xad'),_0xd3e4('0xae'));_0x1051a2[_0xd3e4('0x4e')](_0xd3e4('0xaf'),'Contact.fax');_0x1051a2[_0xd3e4('0x4e')](_0xd3e4('0xb0'),_0xd3e4('0xb1'));_0x1051a2[_0xd3e4('0x4e')]('o.internal',_0xd3e4('0xb2'));_0x1051a2[_0xd3e4('0x4e')](_0xd3e4('0xb3'),_0xd3e4('0x2e'));}if(_0x5f20f9['limit'])_0x1051a2[_0xd3e4('0x21')](_0x5f20f9[_0xd3e4('0x21')]);if(_0x5f20f9['offset'])_0x1051a2['offset'](_0x5f20f9[_0xd3e4('0x1e')]);return db['sequelize'][_0xd3e4('0x42')](_0x1051a2[_0xd3e4('0xa2')](),_0x40c812);})['then'](function(_0x3e151c){if(_0x3e151c[_0xd3e4('0x46')]>0x0)_0xbbd6ea[_0xd3e4('0x86')](_0xd3e4('0xb4'),_[_0xd3e4('0x3c')](_0x3e151c,'id'));return db[_0xd3e4('0xa1')]['query'](_0xbbd6ea[_0xd3e4('0xa2')](),_0x40c812)[_0xd3e4('0x28')](function(_0x24088a){var _0x52c044=_[_0xd3e4('0xb5')](_0x24088a,'WhatsappInteractionId');var _0x5ca1c7=[];_0x3e151c[_0xd3e4('0x31')](function(_0x55a4e4){_0x5ca1c7[_0xd3e4('0x32')](updateWhatsappInteraction(_0x55a4e4,_0x8ffe57,_0x52c044));});return BPromise['all'](_0x5ca1c7);});});})['then'](function(_0x53a550){_0x573762[_0xd3e4('0xb6')]=_0x53a550;return _0x573762;})[_0xd3e4('0x28')](respondWithFilteredResult(_0x848661,_0x5f20f9))[_0xd3e4('0x33')](handleError(_0x848661,null));};exports[_0xd3e4('0xb7')]=function(_0x29e7d8,_0x52cd65){var _0x2468c={'raw':![],'where':{'id':_0x29e7d8[_0xd3e4('0xb8')]['id']}},_0x3d6056={};_0x3d6056[_0xd3e4('0x41')]=_[_0xd3e4('0x7a')](db['WhatsappInteraction'][_0xd3e4('0x3d')]);_0x3d6056[_0xd3e4('0x42')]=_[_0xd3e4('0x7a')](_0x29e7d8[_0xd3e4('0x42')]);_0x3d6056['filters']=_[_0xd3e4('0x43')](_0x3d6056[_0xd3e4('0x41')],_0x3d6056[_0xd3e4('0x42')]);_0x2468c[_0xd3e4('0x44')]=_['intersection'](_0x3d6056[_0xd3e4('0x41')],qs[_0xd3e4('0x45')](_0x29e7d8[_0xd3e4('0x42')][_0xd3e4('0x45')]));_0x2468c[_0xd3e4('0x44')]=_0x2468c[_0xd3e4('0x44')][_0xd3e4('0x46')]?_0x2468c[_0xd3e4('0x44')]:_0x3d6056['model'];if(_0x29e7d8[_0xd3e4('0x42')][_0xd3e4('0xb9')]){_0x2468c['include']=[{'all':!![]}];}_0x2468c=_[_0xd3e4('0xa3')]({},_0x2468c,_0x29e7d8[_0xd3e4('0xba')]);return db['WhatsappInteraction'][_0xd3e4('0x70')](_0x2468c)[_0xd3e4('0x28')](handleEntityNotFound(_0x52cd65,null))[_0xd3e4('0x28')](respondWithResult(_0x52cd65,null))['catch'](handleError(_0x52cd65,null));};exports[_0xd3e4('0xbb')]=function(_0x4c2a35,_0x1e6878){return db['WhatsappInteraction'][_0xd3e4('0xbb')](_0x4c2a35[_0xd3e4('0x79')],{})[_0xd3e4('0x28')](respondWithResult(_0x1e6878,0xc9))[_0xd3e4('0x33')](handleError(_0x1e6878,null));};exports[_0xd3e4('0x26')]=function(_0xa7d5ac,_0x3a5a8d){if(_0xa7d5ac[_0xd3e4('0x79')]['id']){delete _0xa7d5ac[_0xd3e4('0x79')]['id'];}return db[_0xd3e4('0xbc')][_0xd3e4('0x70')]({'where':{'id':_0xa7d5ac[_0xd3e4('0xb8')]['id']}})[_0xd3e4('0x28')](handleEntityNotFound(_0x3a5a8d,null))[_0xd3e4('0x28')](saveUpdates(_0xa7d5ac[_0xd3e4('0x79')],null))[_0xd3e4('0x28')](respondWithResult(_0x3a5a8d,null))['catch'](handleError(_0x3a5a8d,null));};exports[_0xd3e4('0x27')]=function(_0x29fee1,_0x2a4010){return db['WhatsappInteraction']['find']({'where':{'id':_0x29fee1[_0xd3e4('0xb8')]['id']}})[_0xd3e4('0x28')](handleEntityNotFound(_0x2a4010,null))[_0xd3e4('0x28')](removeEntity(_0x2a4010,null))[_0xd3e4('0x33')](handleError(_0x2a4010,null));};exports[_0xd3e4('0xbd')]=function(_0x54397b,_0x17d442){return db[_0xd3e4('0xbc')][_0xd3e4('0xbd')]()[_0xd3e4('0x28')](respondWithResult(_0x17d442,null))['catch'](handleError(_0x17d442,null));};exports[_0xd3e4('0xbe')]=function(_0x17e4f4,_0x2b3394,_0x463f8c){return db[_0xd3e4('0xbf')][_0xd3e4('0x70')]({'where':{'id':_0x17e4f4[_0xd3e4('0xb8')]['id']}})[_0xd3e4('0x28')](handleEntityNotFound(_0x2b3394,null))['then'](function(_0x4051b2){if(_0x4051b2){return _0x4051b2[_0xd3e4('0xbe')](_0x17e4f4[_0xd3e4('0x79')][_0xd3e4('0xc0')],_[_0xd3e4('0xc1')](_0x17e4f4[_0xd3e4('0x79')],['ids','id'])||{});}})[_0xd3e4('0x28')](respondWithResult(_0x2b3394,null))[_0xd3e4('0x33')](handleError(_0x2b3394,null));};exports[_0xd3e4('0xc2')]=function(_0x49ae45,_0x2791ad,_0x14d001){var _0x283c66={'raw':![],'where':{}};var _0x59b8d1={};var _0x579f32={'count':0x0,'rows':[]};return db[_0xd3e4('0xbc')][_0xd3e4('0xc3')]({'where':{'id':_0x49ae45[_0xd3e4('0xb8')]['id']}})[_0xd3e4('0x28')](handleEntityNotFound(_0x2791ad,null))[_0xd3e4('0x28')](function(_0x41a466){if(_0x41a466){_0x59b8d1['model']=_[_0xd3e4('0x7a')](db[_0xd3e4('0xbf')]['rawAttributes']);_0x59b8d1['query']=_[_0xd3e4('0x7a')](_0x49ae45[_0xd3e4('0x42')]);_0x59b8d1['filters']=_['intersection'](_0x59b8d1['model'],_0x59b8d1[_0xd3e4('0x42')]);_0x283c66[_0xd3e4('0x44')]=_[_0xd3e4('0x43')](_0x59b8d1[_0xd3e4('0x41')],qs['fields'](_0x49ae45['query'][_0xd3e4('0x45')]));_0x283c66[_0xd3e4('0x44')]=_0x283c66[_0xd3e4('0x44')][_0xd3e4('0x46')]?_0x283c66[_0xd3e4('0x44')]:_0x59b8d1[_0xd3e4('0x41')];if(!_0x49ae45[_0xd3e4('0x42')][_0xd3e4('0x47')](_0xd3e4('0x48'))){_0x283c66[_0xd3e4('0x21')]=qs[_0xd3e4('0x21')](_0x49ae45[_0xd3e4('0x42')]['limit']);_0x283c66[_0xd3e4('0x1e')]=qs[_0xd3e4('0x1e')](_0x49ae45['query']['offset']);}_0x283c66['order']=qs[_0xd3e4('0x4a')](_0x49ae45[_0xd3e4('0x42')]['sort']);_0x283c66['where']=qs['filters'](_[_0xd3e4('0x4c')](_0x49ae45[_0xd3e4('0x42')],_0x59b8d1[_0xd3e4('0x4b')]));_0x283c66[_0xd3e4('0x86')][_0xd3e4('0xc4')]=_0x41a466['id'];if(_0x49ae45[_0xd3e4('0x42')][_0xd3e4('0x8d')]){_0x283c66[_0xd3e4('0x86')]=_[_0xd3e4('0xa3')](_0x283c66['where'],{'$or':_[_0xd3e4('0x3c')](_0x283c66['attributes'],function(_0x53ccb2){var _0x4535b8={};_0x4535b8[_0x53ccb2]={'$like':'%'+_0x49ae45[_0xd3e4('0x42')][_0xd3e4('0x8d')]+'%'};return _0x4535b8;})});}if(_0x49ae45[_0xd3e4('0x42')][_0xd3e4('0x82')]){var _0x487868=_0x49ae45[_0xd3e4('0x42')][_0xd3e4('0x82')][_0xd3e4('0x30')](',');var _0x21faee={};_0x21faee[_0x487868[0x0]]={'$gte':moment(_0x487868[0x1])[_0xd3e4('0xc5')](_0xd3e4('0xc6'))};_0x283c66['where']=_['merge'](_0x283c66[_0xd3e4('0x86')],_0x21faee);}_0x283c66=_[_0xd3e4('0xa3')]({},_0x283c66,_0x49ae45[_0xd3e4('0xba')]);return db['WhatsappMessage']['count']({'where':_0x283c66[_0xd3e4('0x86')]})[_0xd3e4('0x28')](function(_0x34c532){_0x579f32['count']=_0x34c532;if(_0x49ae45[_0xd3e4('0x42')][_0xd3e4('0xb9')]){_0x283c66['include']=[{'all':!![]}];}return db[_0xd3e4('0xbf')]['findAll'](_0x283c66);})[_0xd3e4('0x28')](function(_0x5bc540){_0x579f32[_0xd3e4('0xb6')]=_0x5bc540;return _0x579f32;});}})[_0xd3e4('0x28')](respondWithFilteredResult(_0x2791ad,_0x283c66))[_0xd3e4('0x33')](handleError(_0x2791ad,null));};exports[_0xd3e4('0xc7')]=function(_0x397c75,_0x4492b8,_0x478c4c){return db[_0xd3e4('0xbc')][_0xd3e4('0x70')]({'where':{'id':_0x397c75['params']['id']}})[_0xd3e4('0x28')](handleEntityNotFound(_0x4492b8,null))[_0xd3e4('0x28')](function(_0x2c8fea){if(_0x2c8fea){return _0x2c8fea[_0xd3e4('0xc8')](_0x397c75[_0xd3e4('0x79')][_0xd3e4('0xc0')],_[_0xd3e4('0xc1')](_0x397c75[_0xd3e4('0x79')],['ids','id'])||{})[_0xd3e4('0xc9')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xd3e4('0x4f')],'where':{'id':_0x397c75[_0xd3e4('0x79')]['ids']}});})[_0xd3e4('0x28')](function(_0x2bb0ef){socket[_0xd3e4('0xca')](_0xd3e4('0xcb'),{'id':Number(_0x397c75[_0xd3e4('0xb8')]['id']),'tags':_0x2bb0ef||[]});return{'id':Number(_0x397c75['params']['id']),'tags':_0x2bb0ef||[]};});}})[_0xd3e4('0x28')](respondWithResult(_0x4492b8,null))[_0xd3e4('0x33')](handleError(_0x4492b8,null));};exports[_0xd3e4('0xcc')]=function(_0x5b0915,_0x4e8ab4,_0x51cd63){return db['WhatsappInteraction'][_0xd3e4('0x70')]({'where':{'id':_0x5b0915[_0xd3e4('0xb8')]['id']}})[_0xd3e4('0x28')](handleEntityNotFound(_0x4e8ab4,null))[_0xd3e4('0x28')](function(_0x474798){if(_0x474798){return _0x474798[_0xd3e4('0xcc')](_0x5b0915[_0xd3e4('0x42')][_0xd3e4('0xc0')]);}})[_0xd3e4('0x28')](respondWithStatusCode(_0x4e8ab4,null))[_0xd3e4('0x33')](handleError(_0x4e8ab4,null));};exports['download']=function(_0x49eeea,_0x4f4acc){var _0x155d94=moment()[_0xd3e4('0xcd')]()[_0xd3e4('0xa2')]();var _0x3f299a=path['join'](config[_0xd3e4('0xce')],_0xd3e4('0xcf'),_0xd3e4('0xd0'),_0xd3e4('0xd1'));var _0x138705=path[_0xd3e4('0xd2')](config[_0xd3e4('0xce')],_0xd3e4('0xcf'),'files','attachments');var _0x4bd920=path[_0xd3e4('0xd2')](_0x3f299a,_0x155d94);var _0x42b10f=util[_0xd3e4('0xc5')]('transcript-%d-%s.zip',_0x49eeea['params']['id'],_0x155d94);var _0x3c9def=path[_0xd3e4('0xd2')](_0x3f299a,_0x42b10f);var _0x487f74=[];_0x487f74[_0xd3e4('0x32')]({'model':db[_0xd3e4('0x76')],'as':_0xd3e4('0x76'),'attributes':['id',_0xd3e4('0xd3')],'raw':!![]});_0x487f74[_0xd3e4('0x32')]({'model':db['CmContact'],'as':_0xd3e4('0x6b'),'attributes':['id',_0xd3e4('0xd4'),'lastName'],'raw':!![]});if(_0x49eeea[_0xd3e4('0x42')][_0xd3e4('0xd5')]){_0x487f74['push']({'model':db[_0xd3e4('0xd6')],'as':_0xd3e4('0xd6'),'raw':!![]});}var _0x38ea3c=[{'model':db[_0xd3e4('0xbf')],'as':_0xd3e4('0xd7'),'attributes':['id',_0xd3e4('0x79'),_0xd3e4('0xd8'),_0xd3e4('0xd9'),_0xd3e4('0xda'),_0xd3e4('0x89')],'include':_0x487f74}];_0x38ea3c[_0xd3e4('0x32')]({'model':db[_0xd3e4('0xdb')],'as':'Account','attributes':['id',_0xd3e4('0x2b')]});_0x38ea3c[_0xd3e4('0x32')]({'model':db[_0xd3e4('0x76')],'as':_0xd3e4('0xdc'),'attributes':['id',_0xd3e4('0xd3')]});return db[_0xd3e4('0xbc')]['find']({'where':{'id':_0x49eeea[_0xd3e4('0xb8')]['id']},'include':_0x38ea3c})[_0xd3e4('0x28')](handleEntityNotFound(_0x4f4acc,null))['then'](function(_0x4cd3cf){if(_0x4cd3cf){var _0x34a15f=_0x4cd3cf[_0xd3e4('0xdd')]({'plain':!![]});fs['mkdirSync'](_0x4bd920);var _0x19d5ce={'channel':_0xd3e4('0xde'),'account':_0x34a15f[_0xd3e4('0xdf')]['name'],'agent':_0x34a15f[_0xd3e4('0xdc')]?_0x34a15f[_0xd3e4('0xdc')][_0xd3e4('0xd3')]:'N.A.','createdAt':moment(_0x34a15f['createdAt'])['format'](_0xd3e4('0xc6'))[_0xd3e4('0xa2')](),'closedAt':_0x34a15f[_0xd3e4('0x37')]?moment(_0x34a15f[_0xd3e4('0xe0')])[_0xd3e4('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd3e4('0xa2')]():'','disposition':_0x34a15f['disposition'],'messages':_(_0x34a15f['Messages'])[_0xd3e4('0x8d')]({'secret':![]})['map'](function(_0x292c36){if(_0x292c36[_0xd3e4('0xd6')]){var _0x53fd2f=path[_0xd3e4('0xd2')](_0x138705,_0x292c36[_0xd3e4('0xd6')]['basename']);if(fs[_0xd3e4('0xe1')](_0x53fd2f)){fs[_0xd3e4('0xe2')](_0x53fd2f)['pipe'](fs[_0xd3e4('0xe3')](path['join'](_0x4bd920,_0x292c36['Attachment'][_0xd3e4('0xe4')])));}}return{'date':moment(_0x292c36[_0xd3e4('0xd8')])[_0xd3e4('0xc5')](_0xd3e4('0xc6'))[_0xd3e4('0xa2')](),'sender':_0x292c36['direction']==='out'?_0x292c36['User']?_0x292c36[_0xd3e4('0x76')][_0xd3e4('0xd3')]:_0xd3e4('0xe5'):_0x292c36[_0xd3e4('0x6b')][_0xd3e4('0xd4')]+(_0x292c36[_0xd3e4('0x6b')][_0xd3e4('0xe6')]?'\x20'+_0x292c36[_0xd3e4('0x6b')][_0xd3e4('0xe6')]:''),'body':_0x292c36['Attachment']?_0x292c36[_0xd3e4('0xd6')]['basename']:_0x292c36[_0xd3e4('0x79')],'direction':_0x292c36['direction']===_0xd3e4('0xe7')?'A':'C','secret':_0x292c36[_0xd3e4('0xda')],'read':_0x292c36[_0xd3e4('0x89')],'attachment':_0x292c36[_0xd3e4('0xd6')]};})[_0xd3e4('0x67')]()};return ejs[_0xd3e4('0xe8')](path['join'](config[_0xd3e4('0xce')],_0xd3e4('0xcf'),'views',_0xd3e4('0xe9')),{'interaction':_0x19d5ce})[_0xd3e4('0x28')](function(_0x2be34b){var _0x145670=path[_0xd3e4('0xd2')](_0x4bd920,_0xd3e4('0xea')+_0x34a15f['id']+'-'+_0x155d94+'.pdf');var _0x148c1c={'path':_0x145670,'channel':'Whatsapp','interactionId':_0x34a15f['id']};return pdf['createPdfFromHTML'](_0x2be34b,_0x148c1c);})[_0xd3e4('0x28')](function(){return new BPromise(function(_0x18cb8f,_0x261440){zipdir(_0x4bd920,{'saveTo':_0x3c9def},function(_0x27b4a2,_0x40a122){if(_0x27b4a2)return _0x261440(_0x27b4a2);return _0x18cb8f(_0x40a122);});})['then'](function(){return new BPromise(function(_0x3283cf,_0x323251){rimraf(_0x4bd920,function(_0x5f3bb7){if(_0x5f3bb7)_0x323251(_0x5f3bb7);return _0x3283cf();});});})[_0xd3e4('0x28')](function(){return _0x4f4acc[_0xd3e4('0xeb')](_0x3c9def,_0x42b10f,function(_0x35af14){if(_0x35af14){console[_0xd3e4('0xec')](_0xd3e4('0xed'),_0x35af14);}else{fs[_0xd3e4('0xee')](_0x3c9def);}});});});}else{return _0x4f4acc['sendStatus'](0xc8);}})[_0xd3e4('0x33')](handleError(_0x4f4acc,null));}; \ No newline at end of file +var _0x1cbc=['log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','status','end','stack','name','send','Users','map','fullname','Tags','split','push','TagIds','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','WhatsappInteraction','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','union','User','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','options','create','update','describe','addMessage','ids','getMessages','findOne','hasOwnProperty','merge','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','addTags','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','out','System','basename','renderFile','transcript-','createPdfFromHTML'];(function(_0x22e332,_0x2bd769){var _0x2087b3=function(_0x5b876a){while(--_0x5b876a){_0x22e332['push'](_0x22e332['shift']());}};_0x2087b3(++_0x2bd769);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x5e608c,_0x453591){_0x5e608c=_0x5e608c-0x0;var _0x44d7fc=_0x1cbc[_0x5e608c];return _0x44d7fc;};'use strict';var emlformat=require(_0xc1cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1cb('0x1'));var jsonpatch=require(_0xc1cb('0x2'));var rp=require(_0xc1cb('0x3'));var moment=require(_0xc1cb('0x4'));var BPromise=require(_0xc1cb('0x5'));var Mustache=require(_0xc1cb('0x6'));var util=require(_0xc1cb('0x7'));var path=require(_0xc1cb('0x8'));var sox=require(_0xc1cb('0x9'));var csv=require(_0xc1cb('0xa'));var ejs=require(_0xc1cb('0xb'));var fs=require('fs');var fs_extra=require(_0xc1cb('0xc'));var _=require('lodash');var squel=require(_0xc1cb('0xd'));var crypto=require('crypto');var jsforce=require(_0xc1cb('0xe'));var deskjs=require(_0xc1cb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc1cb('0x10'));var Papa=require(_0xc1cb('0x11'));var Redis=require(_0xc1cb('0x12'));var authService=require(_0xc1cb('0x13'));var qs=require(_0xc1cb('0x14'));var as=require(_0xc1cb('0x15'));var pdf=require(_0xc1cb('0x16'));var hardwareService=require(_0xc1cb('0x17'));var logger=require('../../config/logger')(_0xc1cb('0x18'));var utils=require('../../config/utils');var config=require(_0xc1cb('0x19'));var licenseUtil=require(_0xc1cb('0x1a'));var db=require(_0xc1cb('0x1b'))['db'];config[_0xc1cb('0x1c')]=_[_0xc1cb('0x1d')](config[_0xc1cb('0x1c')],{'host':_0xc1cb('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1cb('0x1c')]));require(_0xc1cb('0x1f'))[_0xc1cb('0x20')](socket);function respondWithStatusCode(_0x102d56,_0x5c7a99){_0x5c7a99=_0x5c7a99||0xcc;return function(_0x31476a){if(_0x31476a){return _0x102d56[_0xc1cb('0x21')](_0x5c7a99);}return _0x102d56['status'](_0x5c7a99)['end']();};}function respondWithResult(_0x1fda2c,_0x4630fb){_0x4630fb=_0x4630fb||0xc8;return function(_0xc10170){if(_0xc10170){return _0x1fda2c['status'](_0x4630fb)['json'](_0xc10170);}};}function respondWithFilteredResult(_0x4df1b9,_0x5d32ec){return function(_0xa9fa1){if(_0xa9fa1){var _0x3cb250=typeof _0x5d32ec[_0xc1cb('0x22')]===_0xc1cb('0x23')&&typeof _0x5d32ec[_0xc1cb('0x24')]===_0xc1cb('0x23');var _0x596f58=_0xa9fa1[_0xc1cb('0x25')];var _0x11bdb0=_0x3cb250?0x0:_0x5d32ec[_0xc1cb('0x22')];var _0x3d051c=_0x3cb250?_0xa9fa1['count']:_0x5d32ec[_0xc1cb('0x22')]+_0x5d32ec[_0xc1cb('0x24')];var _0x1666ce;if(_0x3d051c>=_0x596f58){_0x3d051c=_0x596f58;_0x1666ce=0xc8;}else{_0x1666ce=0xce;}_0x4df1b9['status'](_0x1666ce);return _0x4df1b9['set'](_0xc1cb('0x26'),_0x11bdb0+'-'+_0x3d051c+'/'+_0x596f58)[_0xc1cb('0x27')](_0xa9fa1);}return null;};}function patchUpdates(_0x4c8298){return function(_0x5e4e33){try{jsonpatch[_0xc1cb('0x28')](_0x5e4e33,_0x4c8298,!![]);}catch(_0x1bc2fa){return BPromise[_0xc1cb('0x29')](_0x1bc2fa);}return _0x5e4e33[_0xc1cb('0x2a')]();};}function saveUpdates(_0x2d27a7,_0x46c404){return function(_0xac87d){if(_0xac87d){return _0xac87d['update'](_0x2d27a7)[_0xc1cb('0x2b')](function(_0x4c418d){return _0x4c418d;});}return null;};}function removeEntity(_0x1179a1,_0x3f6481){return function(_0x357358){if(_0x357358){return _0x357358[_0xc1cb('0x2c')]()[_0xc1cb('0x2b')](function(){_0x1179a1[_0xc1cb('0x2d')](0xcc)[_0xc1cb('0x2e')]();});}};}function handleEntityNotFound(_0x26260b,_0x18e9c4){return function(_0xc926c6){if(!_0xc926c6){_0x26260b[_0xc1cb('0x21')](0x194);}return _0xc926c6;};}function handleError(_0x4378f4,_0x54afed){_0x54afed=_0x54afed||0x1f4;return function(_0x54f42d){logger['error'](_0x54f42d[_0xc1cb('0x2f')]);if(_0x54f42d[_0xc1cb('0x30')]){delete _0x54f42d[_0xc1cb('0x30')];}_0x4378f4['status'](_0x54afed)[_0xc1cb('0x31')](_0x54f42d);};}function getInteractionUsers(_0x3b5063,_0x2e6d7d){return new BPromise(function(_0x54c5db,_0x50d0a0){try{if(_0x2e6d7d[_0x3b5063['id']]){_0x3b5063[_0xc1cb('0x32')]=_[_0xc1cb('0x33')](_0x2e6d7d[_0x3b5063['id']],function(_0x139bd3){return{'id':_0x139bd3['id'],'fullname':_0x139bd3[_0xc1cb('0x34')]};});}}catch(_0x3c2a3e){_0x50d0a0(_0x3c2a3e);}_0x54c5db(_0x3b5063);});}function getInteractionTags(_0x3d9fa9,_0x3c0017){return new BPromise(function(_0x31e450,_0x5e036b){try{if(_0x3d9fa9['TagIds']){_0x3d9fa9[_0xc1cb('0x35')]=[];_0x3d9fa9['TagIds'][_0xc1cb('0x36')](',')['forEach'](function(_0x3f68b5){_0x3d9fa9[_0xc1cb('0x35')][_0xc1cb('0x37')](_0x3c0017[_0x3f68b5]);});}delete _0x3d9fa9[_0xc1cb('0x38')];}catch(_0x46ce22){_0x5e036b(_0x46ce22);}_0x31e450(_0x3d9fa9);});}function updateWhatsappInteraction(_0x1ab125,_0x7e60d9,_0x4bf21b){return new BPromise(function(_0x3de181,_0x521909){return getInteractionUsers(_0x1ab125,_0x4bf21b)['then'](function(_0x59f715){return getInteractionTags(_0x59f715,_0x7e60d9);})[_0xc1cb('0x2b')](function(_0x27f202){return getStateInteraction(_0x27f202);})[_0xc1cb('0x2b')](function(_0x668c09){_0x3de181(_0x668c09);})[_0xc1cb('0x39')](function(_0x30474f){_0x521909(_0x30474f);});});}function getStateInteraction(_0x357de7){return new BPromise(function(_0x27f389){_0x357de7[_0xc1cb('0x3a')]=0x0;_0x357de7['talking']=0x0;_0x357de7[_0xc1cb('0x3b')]=0x0;_0x357de7[_0xc1cb('0x3c')]=0x0;_0x357de7[_0xc1cb('0x3d')]=0x0;if(!_0x357de7['closed']&&!_0x357de7['UserId']){_0x357de7[_0xc1cb('0x3a')]+=0x1;}if(!_0x357de7[_0xc1cb('0x3e')]&&_0x357de7[_0xc1cb('0x3f')]){_0x357de7[_0xc1cb('0x40')]+=0x1;if(_0x357de7[_0xc1cb('0x3a')]){_0x357de7['waiting']-=0x1;}}if(_0x357de7[_0xc1cb('0x3e')]&&_0x357de7[_0xc1cb('0x3f')]){_0x357de7[_0xc1cb('0x3b')]+=0x1;if(_0x357de7[_0xc1cb('0x40')]){_0x357de7[_0xc1cb('0x40')]-=0x1;}}if(_0x357de7[_0xc1cb('0x3e')]&&!_0x357de7[_0xc1cb('0x3f')]){_0x357de7[_0xc1cb('0x3c')]+=0x1;if(_0x357de7['waiting']){_0x357de7[_0xc1cb('0x3a')]-=0x1;}}_0x357de7['total']+=0x1;_0x27f389(_0x357de7);});}exports[_0xc1cb('0x41')]=function(_0x3520b5,_0x15b03b){var _0x375c13={},_0x2b3d76={},_0x263993={'count':0x0,'rows':[]};var _0x458059=_['map'](db[_0xc1cb('0x42')][_0xc1cb('0x43')],function(_0x1379d5){return{'name':_0x1379d5[_0xc1cb('0x44')],'type':_0x1379d5[_0xc1cb('0x45')]['key']};});_0x2b3d76[_0xc1cb('0x46')]=_[_0xc1cb('0x33')](_0x458059,'name');_0x2b3d76[_0xc1cb('0x47')]=_[_0xc1cb('0x48')](_0x3520b5[_0xc1cb('0x47')]);_0x2b3d76[_0xc1cb('0x49')]=_['intersection'](_0x2b3d76['model'],_0x2b3d76[_0xc1cb('0x47')]);_0x375c13[_0xc1cb('0x4a')]=_[_0xc1cb('0x4b')](_0x2b3d76['model'],qs[_0xc1cb('0x4c')](_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x4c')]));_0x375c13[_0xc1cb('0x4a')]=_0x375c13[_0xc1cb('0x4a')][_0xc1cb('0x4d')]?_0x375c13['attributes']:_0x2b3d76['model'];if(!_0x3520b5['query']['hasOwnProperty'](_0xc1cb('0x4e'))){_0x375c13[_0xc1cb('0x24')]=qs[_0xc1cb('0x24')](_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x24')]);_0x375c13[_0xc1cb('0x22')]=qs[_0xc1cb('0x22')](_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x22')]);}_0x375c13['order']=qs[_0xc1cb('0x4f')](_0x3520b5['query'][_0xc1cb('0x4f')]);_0x375c13[_0xc1cb('0x50')]=qs[_0xc1cb('0x49')](_['pick'](_0x3520b5[_0xc1cb('0x47')],_0x2b3d76[_0xc1cb('0x49')]),_0x458059);var _0x20d531=[];var _0x37cbfb=squel[_0xc1cb('0x51')]()['field']('id')[_0xc1cb('0x52')](_0xc1cb('0x30'))['field'](_0xc1cb('0x53'))[_0xc1cb('0x54')](_0xc1cb('0x55'));var _0x3b2882=squel[_0xc1cb('0x51')]()[_0xc1cb('0x52')](_0xc1cb('0x56'))[_0xc1cb('0x52')]('u.fullname')[_0xc1cb('0x52')](_0xc1cb('0x57'))[_0xc1cb('0x54')](_0xc1cb('0x58'),'ui')[_0xc1cb('0x59')](_0xc1cb('0x5a'),'u',_0xc1cb('0x5b'));var _0xbc8d04=squel[_0xc1cb('0x51')]()['from'](_0xc1cb('0x5c'),'i')[_0xc1cb('0x59')](_0xc1cb('0x5d'),'c',_0xc1cb('0x5e'))[_0xc1cb('0x59')](_0xc1cb('0x5a'),'o',_0xc1cb('0x5f'))[_0xc1cb('0x59')](_0xc1cb('0x60'),'a',_0xc1cb('0x61'))[_0xc1cb('0x59')](_0xc1cb('0x62'),'me',_0xc1cb('0x63'))[_0xc1cb('0x59')](_0xc1cb('0x64'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xc1cb('0x59')](_0xc1cb('0x55'),'t','t.id\x20=\x20it.TagId');var _0x170b49=squel['expr']();var _0x244029=[];var _0x1b3b02=squel[_0xc1cb('0x65')]();var _0x304495;if(_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x66')]){_0x304495=as[_0xc1cb('0x67')](_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x66')]);var _0x306cc5=_0x304495[_0xc1cb('0x68')];for(var _0x5ddc80=0x0;_0x5ddc80<_0x304495[_0xc1cb('0x69')][_0xc1cb('0x4d')];_0x5ddc80++){var _0x2b2297=_0x304495['conditions'][_0x5ddc80];var _0x10a8c6='i';var _0x52bfc2=_['find'](_0x458059,[_0xc1cb('0x30'),_0x2b2297[_0xc1cb('0x52')]]);if(!_0x52bfc2){switch(_0x2b2297[_0xc1cb('0x52')]){case _0xc1cb('0x6a'):if(_0x2b2297['value']==0x1){_0xbc8d04[_0xc1cb('0x6b')]('`'+_0x2b2297[_0xc1cb('0x52')]+'`\x20=\x200');}else{_0xbc8d04[_0xc1cb('0x6b')]('`'+_0x2b2297[_0xc1cb('0x52')]+_0xc1cb('0x6c'));}break;case _0xc1cb('0x6d'):if(_0x2b2297[_0xc1cb('0x6e')]===_0xc1cb('0x6f')){if(_0x2b2297['value'][_0xc1cb('0x36')]('\x20')['length']>0x1){_0x170b49[_0x306cc5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2b2297['value']),null);}else{var _0x32e8ea='%'+_0x2b2297[_0xc1cb('0x70')]+'%';_0x170b49[_0x306cc5](_0xc1cb('0x71'),_0x32e8ea,_0x32e8ea,_0x32e8ea);}}else{_0x52bfc2=_[_0xc1cb('0x72')](_0x458059,[_0xc1cb('0x30'),'ContactId']);_0x2b2297[_0xc1cb('0x52')]=_0xc1cb('0x73');_0x47c8e7=as[_0xc1cb('0x74')](_0x10a8c6,_0x52bfc2[_0xc1cb('0x45')],_0x2b2297);_0x170b49[_0x306cc5](_0x47c8e7[_0xc1cb('0x75')],_0x47c8e7[_0xc1cb('0x70')][_0xc1cb('0x76')],_0x47c8e7[_0xc1cb('0x70')][_0xc1cb('0x2e')]);}break;case _0xc1cb('0x77'):var _0x15e7ca=_0x2b2297[_0xc1cb('0x70')]['split'](',')[_0xc1cb('0x33')](function(_0x6c3937){return Number(_0x6c3937);});_0x15e7ca[_0xc1cb('0x78')](function(_0xddc04){_0x1b3b02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xddc04+',%');});_0x244029=_[_0xc1cb('0x79')](_0x244029,_0x15e7ca);break;case _0xc1cb('0x7a'):if(_0x2b2297[_0xc1cb('0x6e')]===_0xc1cb('0x6f')){_0x170b49[_0x306cc5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2b2297[_0xc1cb('0x70')]+'%',null);}else{_0x52bfc2=_[_0xc1cb('0x72')](_0x458059,[_0xc1cb('0x30'),_0xc1cb('0x3f')]);_0x2b2297[_0xc1cb('0x52')]=_0xc1cb('0x3f');_0x47c8e7=as[_0xc1cb('0x74')](_0x10a8c6,_0x52bfc2['type'],_0x2b2297);_0x170b49[_0x306cc5](_0x47c8e7['text'],_0x47c8e7[_0xc1cb('0x70')][_0xc1cb('0x76')],_0x47c8e7[_0xc1cb('0x70')]['end']);}break;case _0xc1cb('0x7b'):_0x47c8e7=as[_0xc1cb('0x74')]('me',null,_0x2b2297);_0x170b49[_0x306cc5](_0x47c8e7['text'],_0x47c8e7[_0xc1cb('0x70')][_0xc1cb('0x76')],_0x47c8e7[_0xc1cb('0x70')]['end']);break;}}else{var _0x47c8e7=as[_0xc1cb('0x74')](_0x10a8c6,_0x52bfc2['type'],_0x2b2297);_0x170b49[_0x306cc5](_0x47c8e7[_0xc1cb('0x75')],_0x47c8e7[_0xc1cb('0x70')][_0xc1cb('0x76')],_0x47c8e7[_0xc1cb('0x70')]['end']);}}}else{var _0x251cae=_(_0x3520b5[_0xc1cb('0x47')])[_0xc1cb('0x48')]()[_0xc1cb('0x33')](function(_0xb30a00){return _[_0xc1cb('0x7c')](_0x458059,[_0xc1cb('0x30'),_0xb30a00])?_0xb30a00:undefined;})[_0xc1cb('0x7d')]()[_0xc1cb('0x70')]();if(!_['isEmpty'](_0x251cae)){_0x251cae[_0xc1cb('0x78')](function(_0x1750f6){if(_0x1750f6===_0xc1cb('0x7e')){_0xbc8d04[_0xc1cb('0x50')](_0xc1cb('0x7f'),[]['concat'](_0x3520b5[_0xc1cb('0x47')][_0x1750f6]));}else if(_0x1750f6===_0xc1cb('0x80')){var _0x513547=JSON[_0xc1cb('0x81')](_0x3520b5[_0xc1cb('0x47')][_0x1750f6])[_0xc1cb('0x82')];var _0x51c5c2=JSON['parse'](_0x3520b5[_0xc1cb('0x47')][_0x1750f6])[_0xc1cb('0x83')];_0xbc8d04[_0xc1cb('0x50')](_0xc1cb('0x84'),_0x513547,_0x51c5c2);}else{if(_0x3520b5[_0xc1cb('0x47')][_0x1750f6]===_0xc1cb('0x85')){_0xbc8d04[_0xc1cb('0x50')]('i.'+_0x1750f6+'\x20IS\x20NULL');}else{_0xbc8d04['where']('i.'+_0x1750f6+_0xc1cb('0x86'),_0x3520b5[_0xc1cb('0x47')][_0x1750f6]);}}});}if(_0x3520b5[_0xc1cb('0x47')]['read']){if(_0x3520b5['query']['read']==0x1){_0xbc8d04['having'](_0xc1cb('0x87'));}else{_0xbc8d04['having'](_0xc1cb('0x88'));}}if(_0x3520b5['query']['tag']){_0x244029=_[_0xc1cb('0x89')](_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x8a')])?_0x3520b5['query'][_0xc1cb('0x8a')]:new Array(_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x8a')]);_0x244029['forEach'](function(_0x43cb1){_0x1b3b02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43cb1+',%');});}if(_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x8b')]){var _0x3bdcd5=_0x3520b5[_0xc1cb('0x47')]['filter']['replace']('\x5c','\x5c\x5c')[_0xc1cb('0x8c')](/'/g,'\x27\x27');if(qs[_0xc1cb('0x8d')](_0x3bdcd5)){_0x170b49['or']('i.id\x20LIKE\x20?',_0x3bdcd5+'%')['or']('i.phone\x20LIKE\x20?',_0x3bdcd5+'%');}else{_0x170b49['or'](_0xc1cb('0x8e'),qs['getFullTextValue'](_0x3bdcd5))['or'](_0xc1cb('0x8f'),_0x3bdcd5+'%');}}}_0xbc8d04['where'](_0x170b49);_0xbc8d04[_0xc1cb('0x90')](_0xc1cb('0x91'));var _0x3a478c={'type':db[_0xc1cb('0x92')][_0xc1cb('0x93')][_0xc1cb('0x94')],'raw':!![]};var _0x44889b=_0xbc8d04[_0xc1cb('0x95')]();_0x44889b[_0xc1cb('0x52')](_0xc1cb('0x91'));_0x44889b['field'](_0xc1cb('0x96'),_0xc1cb('0x6a'));if(_0x375c13[_0xc1cb('0x97')]){_0x375c13['order'][_0xc1cb('0x78')](function(_0x4a4350){var _0x47cd3a=_0x4a4350[0x0]==='contactName'?_0x4a4350[0x0]:'i.'+_0x4a4350[0x0];_0xbc8d04[_0xc1cb('0x97')](_0x47cd3a,_0x4a4350[0x1]===_0xc1cb('0x98')?![]:!![]);});}if(!_[_0xc1cb('0x99')](_0x244029)){_0xbc8d04[_0xc1cb('0x6b')](_0x1b3b02);_0x44889b[_0xc1cb('0x50')]('t.id\x20IN\x20?',_0x244029);}BPromise[_0xc1cb('0x9a')]()[_0xc1cb('0x2b')](function(){if(!_0x304495){if(_0x3520b5['query'][_0xc1cb('0x7e')])return;_0x44889b[_0xc1cb('0x50')](_0xc1cb('0x9b'));_0xbc8d04['where'](_0xc1cb('0x9b'));return;}if(_0x3520b5[_0xc1cb('0x9c')][_0xc1cb('0x9d')]!==_0xc1cb('0x9e'))return;return _0x3520b5['user'][_0xc1cb('0x9f')]({'attributes':['id'],'raw':!![]})[_0xc1cb('0x2b')](function(_0xa2ce6c){if(_[_0xc1cb('0x99')](_0xa2ce6c)){_0x44889b['where']('i.WhatsappAccountId\x20IS\x20NULL');_0xbc8d04[_0xc1cb('0x50')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x44889b[_0xc1cb('0x50')](_0xc1cb('0x7f'),_[_0xc1cb('0x33')](_0xa2ce6c,'id'));_0xbc8d04['where'](_0xc1cb('0x7f'),_[_0xc1cb('0x33')](_0xa2ce6c,'id'));}});})[_0xc1cb('0x2b')](function(){if(_0x3520b5['user'][_0xc1cb('0x9d')]===_0xc1cb('0x9e')&&!_0x304495&&!_0x3520b5[_0xc1cb('0x47')][_0xc1cb('0x7e')])return[];return db[_0xc1cb('0xa0')]['query'](_0x44889b[_0xc1cb('0xa1')](),_0x3a478c);})[_0xc1cb('0x2b')](function(_0x46030d){_0x263993[_0xc1cb('0x25')]=_0x46030d[_0xc1cb('0x4d')];if(_0x263993[_0xc1cb('0x25')]===0x0)return[];return db[_0xc1cb('0xa0')][_0xc1cb('0x47')](_0x37cbfb[_0xc1cb('0xa1')](),_0x3a478c)[_0xc1cb('0x2b')](function(_0x153a14){_0x20d531=_[_0xc1cb('0xa2')](_0x153a14,'id');_0x3a478c=_['merge'](_0x3a478c,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3520b5['query']['fields']){_0x375c13[_0xc1cb('0x4a')]['forEach'](function(_0x35ca40){_0xbc8d04[_0xc1cb('0x52')]('i.'+_0x35ca40);});}else{_0xbc8d04[_0xc1cb('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc1cb('0x6a'));_0xbc8d04[_0xc1cb('0x52')]('a.key',_0xc1cb('0xa3'));_0xbc8d04[_0xc1cb('0x52')](_0xc1cb('0xa4'),'Account.mandatoryDisposition');_0xbc8d04[_0xc1cb('0x52')]('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',_0xc1cb('0xa5'));_0xbc8d04['field'](_0xc1cb('0xa6'));_0xbc8d04[_0xc1cb('0x52')](_0xc1cb('0xa7'),_0xc1cb('0xa8'));_0xbc8d04['field'](_0xc1cb('0xa9'),_0xc1cb('0xaa'));_0xbc8d04[_0xc1cb('0x52')]('c.email','Contact.email');_0xbc8d04['field'](_0xc1cb('0xab'),_0xc1cb('0xac'));_0xbc8d04[_0xc1cb('0x52')](_0xc1cb('0xad'),_0xc1cb('0xae'));_0xbc8d04[_0xc1cb('0x52')]('c.fax','Contact.fax');_0xbc8d04[_0xc1cb('0x52')](_0xc1cb('0xaf'),_0xc1cb('0xb0'));_0xbc8d04[_0xc1cb('0x52')](_0xc1cb('0xb1'),'Owner.internal');_0xbc8d04['field'](_0xc1cb('0xb2'),_0xc1cb('0x38'));}if(_0x375c13[_0xc1cb('0x24')])_0xbc8d04[_0xc1cb('0x24')](_0x375c13[_0xc1cb('0x24')]);if(_0x375c13['offset'])_0xbc8d04[_0xc1cb('0x22')](_0x375c13[_0xc1cb('0x22')]);return db[_0xc1cb('0xa0')][_0xc1cb('0x47')](_0xbc8d04[_0xc1cb('0xa1')](),_0x3a478c);})[_0xc1cb('0x2b')](function(_0x4a2d63){if(_0x4a2d63[_0xc1cb('0x4d')]>0x0)_0x3b2882[_0xc1cb('0x50')](_0xc1cb('0xb3'),_[_0xc1cb('0x33')](_0x4a2d63,'id'));return db[_0xc1cb('0xa0')][_0xc1cb('0x47')](_0x3b2882[_0xc1cb('0xa1')](),_0x3a478c)['then'](function(_0xb0b385){var _0x1aed70=_['groupBy'](_0xb0b385,_0xc1cb('0xb4'));var _0x5701ee=[];_0x4a2d63[_0xc1cb('0x78')](function(_0x19460d){_0x5701ee['push'](updateWhatsappInteraction(_0x19460d,_0x20d531,_0x1aed70));});return BPromise['all'](_0x5701ee);});});})[_0xc1cb('0x2b')](function(_0x392dd3){_0x263993[_0xc1cb('0xb5')]=_0x392dd3;return _0x263993;})[_0xc1cb('0x2b')](respondWithFilteredResult(_0x15b03b,_0x375c13))[_0xc1cb('0x39')](handleError(_0x15b03b,null));};exports[_0xc1cb('0xb6')]=function(_0x339e6e,_0x3ff54f){var _0x3b4ce4={'raw':![],'where':{'id':_0x339e6e[_0xc1cb('0xb7')]['id']}},_0x4b0778={};_0x4b0778[_0xc1cb('0x46')]=_['keys'](db[_0xc1cb('0x42')][_0xc1cb('0x43')]);_0x4b0778[_0xc1cb('0x47')]=_['keys'](_0x339e6e[_0xc1cb('0x47')]);_0x4b0778[_0xc1cb('0x49')]=_[_0xc1cb('0x4b')](_0x4b0778['model'],_0x4b0778['query']);_0x3b4ce4[_0xc1cb('0x4a')]=_[_0xc1cb('0x4b')](_0x4b0778[_0xc1cb('0x46')],qs[_0xc1cb('0x4c')](_0x339e6e['query'][_0xc1cb('0x4c')]));_0x3b4ce4[_0xc1cb('0x4a')]=_0x3b4ce4[_0xc1cb('0x4a')]['length']?_0x3b4ce4['attributes']:_0x4b0778['model'];if(_0x339e6e[_0xc1cb('0x47')][_0xc1cb('0xb8')]){_0x3b4ce4[_0xc1cb('0xb9')]=[{'all':!![]}];}_0x3b4ce4=_['merge']({},_0x3b4ce4,_0x339e6e[_0xc1cb('0xba')]);return db['WhatsappInteraction'][_0xc1cb('0x72')](_0x3b4ce4)[_0xc1cb('0x2b')](handleEntityNotFound(_0x3ff54f,null))[_0xc1cb('0x2b')](respondWithResult(_0x3ff54f,null))['catch'](handleError(_0x3ff54f,null));};exports[_0xc1cb('0xbb')]=function(_0x385001,_0x381046){return db['WhatsappInteraction'][_0xc1cb('0xbb')](_0x385001[_0xc1cb('0x7b')],{})[_0xc1cb('0x2b')](respondWithResult(_0x381046,0xc9))[_0xc1cb('0x39')](handleError(_0x381046,null));};exports[_0xc1cb('0xbc')]=function(_0x431acc,_0x5b193e){if(_0x431acc['body']['id']){delete _0x431acc[_0xc1cb('0x7b')]['id'];}return db[_0xc1cb('0x42')][_0xc1cb('0x72')]({'where':{'id':_0x431acc['params']['id']}})[_0xc1cb('0x2b')](handleEntityNotFound(_0x5b193e,null))['then'](saveUpdates(_0x431acc[_0xc1cb('0x7b')],null))[_0xc1cb('0x2b')](respondWithResult(_0x5b193e,null))['catch'](handleError(_0x5b193e,null));};exports['destroy']=function(_0x37539d,_0x331c48){return db['WhatsappInteraction'][_0xc1cb('0x72')]({'where':{'id':_0x37539d['params']['id']}})[_0xc1cb('0x2b')](handleEntityNotFound(_0x331c48,null))[_0xc1cb('0x2b')](removeEntity(_0x331c48,null))[_0xc1cb('0x39')](handleError(_0x331c48,null));};exports[_0xc1cb('0xbd')]=function(_0x213bb4,_0xe19382){return db[_0xc1cb('0x42')]['describe']()[_0xc1cb('0x2b')](respondWithResult(_0xe19382,null))[_0xc1cb('0x39')](handleError(_0xe19382,null));};exports[_0xc1cb('0xbe')]=function(_0x3aee3d,_0x2980b8,_0x425428){return db['WhatsappMessage'][_0xc1cb('0x72')]({'where':{'id':_0x3aee3d[_0xc1cb('0xb7')]['id']}})['then'](handleEntityNotFound(_0x2980b8,null))['then'](function(_0x4d4785){if(_0x4d4785){return _0x4d4785[_0xc1cb('0xbe')](_0x3aee3d[_0xc1cb('0x7b')][_0xc1cb('0xbf')],_['omit'](_0x3aee3d['body'],[_0xc1cb('0xbf'),'id'])||{});}})[_0xc1cb('0x2b')](respondWithResult(_0x2980b8,null))[_0xc1cb('0x39')](handleError(_0x2980b8,null));};exports[_0xc1cb('0xc0')]=function(_0x476496,_0xc787b6,_0x1f2c19){var _0x140c88={'raw':![],'where':{}};var _0x40e015={};var _0x4cfd62={'count':0x0,'rows':[]};return db[_0xc1cb('0x42')][_0xc1cb('0xc1')]({'where':{'id':_0x476496[_0xc1cb('0xb7')]['id']}})['then'](handleEntityNotFound(_0xc787b6,null))[_0xc1cb('0x2b')](function(_0x17b33d){if(_0x17b33d){_0x40e015[_0xc1cb('0x46')]=_[_0xc1cb('0x48')](db['WhatsappMessage']['rawAttributes']);_0x40e015[_0xc1cb('0x47')]=_[_0xc1cb('0x48')](_0x476496[_0xc1cb('0x47')]);_0x40e015[_0xc1cb('0x49')]=_[_0xc1cb('0x4b')](_0x40e015['model'],_0x40e015[_0xc1cb('0x47')]);_0x140c88[_0xc1cb('0x4a')]=_[_0xc1cb('0x4b')](_0x40e015['model'],qs[_0xc1cb('0x4c')](_0x476496[_0xc1cb('0x47')][_0xc1cb('0x4c')]));_0x140c88[_0xc1cb('0x4a')]=_0x140c88[_0xc1cb('0x4a')]['length']?_0x140c88[_0xc1cb('0x4a')]:_0x40e015['model'];if(!_0x476496['query'][_0xc1cb('0xc2')](_0xc1cb('0x4e'))){_0x140c88[_0xc1cb('0x24')]=qs[_0xc1cb('0x24')](_0x476496[_0xc1cb('0x47')]['limit']);_0x140c88['offset']=qs[_0xc1cb('0x22')](_0x476496[_0xc1cb('0x47')]['offset']);}_0x140c88[_0xc1cb('0x97')]=qs[_0xc1cb('0x4f')](_0x476496[_0xc1cb('0x47')]['sort']);_0x140c88['where']=qs[_0xc1cb('0x49')](_['pick'](_0x476496[_0xc1cb('0x47')],_0x40e015[_0xc1cb('0x49')]));_0x140c88[_0xc1cb('0x50')][_0xc1cb('0xb4')]=_0x17b33d['id'];if(_0x476496[_0xc1cb('0x47')][_0xc1cb('0x8b')]){_0x140c88[_0xc1cb('0x50')]=_[_0xc1cb('0xc3')](_0x140c88['where'],{'$or':_[_0xc1cb('0x33')](_0x140c88[_0xc1cb('0x4a')],function(_0x259bd2){var _0x57946e={};_0x57946e[_0x259bd2]={'$like':'%'+_0x476496[_0xc1cb('0x47')][_0xc1cb('0x8b')]+'%'};return _0x57946e;})});}if(_0x476496[_0xc1cb('0x47')][_0xc1cb('0x82')]){var _0x1a6bad=_0x476496[_0xc1cb('0x47')]['$gte'][_0xc1cb('0x36')](',');var _0x3dd186={};_0x3dd186[_0x1a6bad[0x0]]={'$gte':moment(_0x1a6bad[0x1])[_0xc1cb('0xc4')](_0xc1cb('0xc5'))};_0x140c88[_0xc1cb('0x50')]=_[_0xc1cb('0xc3')](_0x140c88[_0xc1cb('0x50')],_0x3dd186);}_0x140c88=_[_0xc1cb('0xc3')]({},_0x140c88,_0x476496[_0xc1cb('0xba')]);return db[_0xc1cb('0xc6')][_0xc1cb('0x25')]({'where':_0x140c88[_0xc1cb('0x50')]})['then'](function(_0x1e6870){_0x4cfd62[_0xc1cb('0x25')]=_0x1e6870;if(_0x476496['query'][_0xc1cb('0xb8')]){_0x140c88[_0xc1cb('0xb9')]=[{'all':!![]}];}return db[_0xc1cb('0xc6')]['findAll'](_0x140c88);})[_0xc1cb('0x2b')](function(_0x268a4f){_0x4cfd62['rows']=_0x268a4f;return _0x4cfd62;});}})['then'](respondWithFilteredResult(_0xc787b6,_0x140c88))['catch'](handleError(_0xc787b6,null));};exports[_0xc1cb('0xc7')]=function(_0x37c384,_0x144d85,_0x460de2){return db[_0xc1cb('0x42')][_0xc1cb('0x72')]({'where':{'id':_0x37c384['params']['id']}})['then'](handleEntityNotFound(_0x144d85,null))[_0xc1cb('0x2b')](function(_0x5ce172){if(_0x5ce172){return _0x5ce172[_0xc1cb('0xc8')](_0x37c384[_0xc1cb('0x7b')][_0xc1cb('0xbf')],_['omit'](_0x37c384[_0xc1cb('0x7b')],[_0xc1cb('0xbf'),'id'])||{})[_0xc1cb('0xc9')](function(){return db[_0xc1cb('0x77')][_0xc1cb('0xca')]({'attributes':['id','name',_0xc1cb('0x53')],'where':{'id':_0x37c384[_0xc1cb('0x7b')][_0xc1cb('0xbf')]}});})[_0xc1cb('0x2b')](function(_0x1f9420){socket[_0xc1cb('0xcb')](_0xc1cb('0xcc'),{'id':Number(_0x37c384[_0xc1cb('0xb7')]['id']),'tags':_0x1f9420||[]});return{'id':Number(_0x37c384['params']['id']),'tags':_0x1f9420||[]};});}})[_0xc1cb('0x2b')](respondWithResult(_0x144d85,null))['catch'](handleError(_0x144d85,null));};exports[_0xc1cb('0xcd')]=function(_0x3b9e64,_0x19fd01,_0x376110){return db['WhatsappInteraction'][_0xc1cb('0x72')]({'where':{'id':_0x3b9e64[_0xc1cb('0xb7')]['id']}})['then'](handleEntityNotFound(_0x19fd01,null))[_0xc1cb('0x2b')](function(_0x167041){if(_0x167041){return _0x167041['removeTags'](_0x3b9e64[_0xc1cb('0x47')][_0xc1cb('0xbf')]);}})[_0xc1cb('0x2b')](respondWithStatusCode(_0x19fd01,null))['catch'](handleError(_0x19fd01,null));};exports[_0xc1cb('0xce')]=function(_0x51638e,_0x56b02b){var _0x5ae38f=moment()[_0xc1cb('0xcf')]()[_0xc1cb('0xa1')]();var _0x27c3e2=path[_0xc1cb('0xd0')](config['root'],_0xc1cb('0xd1'),_0xc1cb('0xd2'),_0xc1cb('0xd3'));var _0x4c5fb3=path[_0xc1cb('0xd0')](config[_0xc1cb('0xd4')],_0xc1cb('0xd1'),_0xc1cb('0xd2'),_0xc1cb('0xd5'));var _0x4634d1=path['join'](_0x27c3e2,_0x5ae38f);var _0x1d4437=util[_0xc1cb('0xc4')](_0xc1cb('0xd6'),_0x51638e[_0xc1cb('0xb7')]['id'],_0x5ae38f);var _0x3fa2aa=path[_0xc1cb('0xd0')](_0x27c3e2,_0x1d4437);var _0x5fd9da=[];_0x5fd9da[_0xc1cb('0x37')]({'model':db[_0xc1cb('0x7a')],'as':'User','attributes':['id',_0xc1cb('0x34')],'raw':!![]});_0x5fd9da[_0xc1cb('0x37')]({'model':db['CmContact'],'as':_0xc1cb('0x6d'),'attributes':['id',_0xc1cb('0xd7'),_0xc1cb('0xd8')],'raw':!![]});if(_0x51638e[_0xc1cb('0x47')]['attachments']){_0x5fd9da[_0xc1cb('0x37')]({'model':db[_0xc1cb('0xd9')],'as':_0xc1cb('0xd9'),'raw':!![]});}var _0x44942f=[{'model':db[_0xc1cb('0xc6')],'as':_0xc1cb('0xda'),'attributes':['id','body',_0xc1cb('0x80'),_0xc1cb('0xdb'),'secret','read'],'include':_0x5fd9da}];_0x44942f[_0xc1cb('0x37')]({'model':db[_0xc1cb('0xdc')],'as':'Account','attributes':['id',_0xc1cb('0x30')]});_0x44942f[_0xc1cb('0x37')]({'model':db['User'],'as':_0xc1cb('0xdd'),'attributes':['id',_0xc1cb('0x34')]});return db[_0xc1cb('0x42')]['find']({'where':{'id':_0x51638e[_0xc1cb('0xb7')]['id']},'include':_0x44942f})[_0xc1cb('0x2b')](handleEntityNotFound(_0x56b02b,null))[_0xc1cb('0x2b')](function(_0x2608d){if(_0x2608d){var _0x1758bd=_0x2608d[_0xc1cb('0xde')]({'plain':!![]});fs[_0xc1cb('0xdf')](_0x4634d1);var _0x3abd34={'channel':_0xc1cb('0xe0'),'account':_0x1758bd['Account']['name'],'agent':_0x1758bd[_0xc1cb('0xdd')]?_0x1758bd[_0xc1cb('0xdd')][_0xc1cb('0x34')]:_0xc1cb('0xe1'),'createdAt':moment(_0x1758bd['createdAt'])['format'](_0xc1cb('0xc5'))[_0xc1cb('0xa1')](),'closedAt':_0x1758bd[_0xc1cb('0x3e')]?moment(_0x1758bd[_0xc1cb('0xe2')])[_0xc1cb('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc1cb('0xa1')]():'','disposition':_0x1758bd[_0xc1cb('0xe3')],'messages':_(_0x1758bd[_0xc1cb('0xda')])[_0xc1cb('0x8b')]({'secret':![]})[_0xc1cb('0x33')](function(_0x101868){if(_0x101868['Attachment']){var _0x3df0b8=path[_0xc1cb('0xd0')](_0x4c5fb3,_0x101868[_0xc1cb('0xd9')]['basename']);if(fs[_0xc1cb('0xe4')](_0x3df0b8)){fs[_0xc1cb('0xe5')](_0x3df0b8)[_0xc1cb('0xe6')](fs[_0xc1cb('0xe7')](path[_0xc1cb('0xd0')](_0x4634d1,_0x101868[_0xc1cb('0xd9')]['basename'])));}}return{'date':moment(_0x101868[_0xc1cb('0x80')])[_0xc1cb('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc1cb('0xa1')](),'sender':_0x101868[_0xc1cb('0xdb')]===_0xc1cb('0xe8')?_0x101868[_0xc1cb('0x7a')]?_0x101868[_0xc1cb('0x7a')][_0xc1cb('0x34')]:_0xc1cb('0xe9'):_0x101868['Contact'][_0xc1cb('0xd7')]+(_0x101868[_0xc1cb('0x6d')][_0xc1cb('0xd8')]?'\x20'+_0x101868[_0xc1cb('0x6d')]['lastName']:''),'body':_0x101868[_0xc1cb('0xd9')]?_0x101868[_0xc1cb('0xd9')][_0xc1cb('0xea')]:_0x101868['body'],'direction':_0x101868[_0xc1cb('0xdb')]===_0xc1cb('0xe8')?'A':'C','secret':_0x101868['secret'],'read':_0x101868['read'],'attachment':_0x101868[_0xc1cb('0xd9')]};})[_0xc1cb('0x70')]()};return ejs[_0xc1cb('0xeb')](path['join'](config['root'],'server','views','downloadInteraction.ejs'),{'interaction':_0x3abd34})[_0xc1cb('0x2b')](function(_0x34030f){var _0x1821f7=path['join'](_0x4634d1,_0xc1cb('0xec')+_0x1758bd['id']+'-'+_0x5ae38f+'.pdf');var _0xabc2d3={'path':_0x1821f7,'channel':_0xc1cb('0xe0'),'interactionId':_0x1758bd['id']};return pdf[_0xc1cb('0xed')](_0x34030f,_0xabc2d3);})[_0xc1cb('0x2b')](function(){return new BPromise(function(_0x402a1c,_0x4f8673){zipdir(_0x4634d1,{'saveTo':_0x3fa2aa},function(_0x149326,_0xa9a0e1){if(_0x149326)return _0x4f8673(_0x149326);return _0x402a1c(_0xa9a0e1);});})[_0xc1cb('0x2b')](function(){return new BPromise(function(_0x486577,_0x30e784){rimraf(_0x4634d1,function(_0x28a978){if(_0x28a978)_0x30e784(_0x28a978);return _0x486577();});});})[_0xc1cb('0x2b')](function(){return _0x56b02b[_0xc1cb('0xce')](_0x3fa2aa,_0x1d4437,function(_0x86950a){if(_0x86950a){console[_0xc1cb('0xee')](_0xc1cb('0xef'),_0x86950a);}else{fs[_0xc1cb('0xf0')](_0x3fa2aa);}});});});}else{return _0x56b02b[_0xc1cb('0x21')](0xc8);}})[_0xc1cb('0x39')](handleError(_0x56b02b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5ff0a4e..5b82ed0 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 _0x0e9f=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','update','getUsers','setDataValue','Users','findAll','then','unreadMessages'];(function(_0x287965,_0x184502){var _0x20e85e=function(_0x19e6af){while(--_0x19e6af){_0x287965['push'](_0x287965['shift']());}};_0x20e85e(++_0x184502);}(_0x0e9f,0x116));var _0xf0e9=function(_0xf091c2,_0x2bbe87){_0xf091c2=_0xf091c2-0x0;var _0x5a3103=_0x0e9f[_0xf091c2];return _0x5a3103;};'use strict';var EventEmitter=require(_0xf0e9('0x0'));var WhatsappInteraction=require(_0xf0e9('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0xf0e9('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf0e9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x52a19d){return function(_0x159a42,_0x192b21,_0x59ac7e){_0x159a42[_0xf0e9('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3f9792){_0x159a42[_0xf0e9('0x5')](_0xf0e9('0x6'),_0x3f9792['map'](function(_0x5ebd72){return{'id':_0x5ebd72['id']};}));return WhatsappMessage[_0xf0e9('0x7')]({'where':{'WhatsappInteractionId':_0x159a42['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf0e9('0x8')](function(_0x55278c){_0x159a42['setDataValue'](_0xf0e9('0x9'),_0x55278c[_0xf0e9('0xa')]);WhatsappInteractionEvents[_0xf0e9('0xb')](_0x52a19d+':'+_0x159a42['id'],_0x159a42);WhatsappInteractionEvents['emit'](_0x52a19d,_0x159a42);_0x59ac7e(null);})[_0xf0e9('0xc')](_0x59ac7e(null));};}for(var e in events){if(events[_0xf0e9('0xd')](e)){var event=events[e];WhatsappInteraction[_0xf0e9('0xe')](e,emitEvent(event));}}module[_0xf0e9('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x84e1=['exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0x84e1,0x1dc));var _0x184e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x84e1[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require(_0x184e('0x0'));var WhatsappInteraction=require(_0x184e('0x1'))['db'][_0x184e('0x2')];var WhatsappMessage=require(_0x184e('0x1'))['db'][_0x184e('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x184e('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x184e('0x5'),'afterDestroy':_0x184e('0x6')};function emitEvent(_0x26826d){return function(_0x1dab36,_0x2a97b1,_0x86a78e){_0x1dab36[_0x184e('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3f24d3){_0x1dab36[_0x184e('0x8')](_0x184e('0x9'),_0x3f24d3['map'](function(_0x66d238){return{'id':_0x66d238['id']};}));return WhatsappMessage[_0x184e('0xa')]({'where':{'WhatsappInteractionId':_0x1dab36['id'],'direction':'in','read':![]},'raw':!![]});})[_0x184e('0xb')](function(_0x430a7e){_0x1dab36['setDataValue'](_0x184e('0xc'),_0x430a7e[_0x184e('0xd')]);WhatsappInteractionEvents[_0x184e('0xe')](_0x26826d+':'+_0x1dab36['id'],_0x1dab36);WhatsappInteractionEvents[_0x184e('0xe')](_0x26826d,_0x1dab36);_0x86a78e(null);})[_0x184e('0xf')](_0x86a78e(null));};}for(var e in events){if(events[_0x184e('0x10')](e)){var event=events[e];WhatsappInteraction[_0x184e('0x11')](e,emitEvent(event));}}module[_0x184e('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6aeab75..c6351b1 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 _0x787e=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2ef178,_0x4a1871){var _0x22c048=function(_0x22a3c8){while(--_0x22a3c8){_0x2ef178['push'](_0x2ef178['shift']());}};_0x22c048(++_0x4a1871);}(_0x787e,0xe7));var _0xe787=function(_0xbd45ac,_0x269b2d){_0xbd45ac=_0xbd45ac-0x0;var _0x159d69=_0x787e[_0xbd45ac];return _0x159d69;};'use strict';var _=require(_0xe787('0x0'));var util=require(_0xe787('0x1'));var logger=require(_0xe787('0x2'))(_0xe787('0x3'));var moment=require(_0xe787('0x4'));var BPromise=require(_0xe787('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe787('0x6'));var rimraf=require('rimraf');var config=require(_0xe787('0x7'));var attributes=require(_0xe787('0x8'));module[_0xe787('0x9')]=function(_0x54d2d5,_0x2494cd){return _0x54d2d5[_0xe787('0xa')](_0xe787('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16f8bb,_0xcd82de,_0x90ecff){if(_0x16f8bb[_0xe787('0xc')]('closed')){_0x16f8bb['closedAt']=moment()['format'](_0xe787('0xd'));}_0x90ecff(null,_0x16f8bb);}}});}; \ No newline at end of file +var _0xe7fd=['WhatsappInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define'];(function(_0x204789,_0x2e6e57){var _0x2dded7=function(_0x2aa3af){while(--_0x2aa3af){_0x204789['push'](_0x204789['shift']());}};_0x2dded7(++_0x2e6e57);}(_0xe7fd,0x148));var _0xde7f=function(_0x441544,_0x4c4795){_0x441544=_0x441544-0x0;var _0x1a7e95=_0xe7fd[_0x441544];return _0x1a7e95;};'use strict';var _=require('lodash');var util=require(_0xde7f('0x0'));var logger=require(_0xde7f('0x1'))('api');var moment=require(_0xde7f('0x2'));var BPromise=require(_0xde7f('0x3'));var rp=require(_0xde7f('0x4'));var fs=require('fs');var path=require(_0xde7f('0x5'));var rimraf=require(_0xde7f('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x593b68,_0x57adb5){return _0x593b68[_0xde7f('0x7')](_0xde7f('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c390b,_0xf08ff1,_0x1a2f05){if(_0x4c390b[_0xde7f('0x9')](_0xde7f('0xa'))){_0x4c390b[_0xde7f('0xb')]=moment()[_0xde7f('0xc')](_0xde7f('0xd'));}_0x1a2f05(null,_0x4c390b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 44f9113..6e8bc8b 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 _0x0e14=['AddTags','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread'];(function(_0x27546a,_0x4964a8){var _0x236718=function(_0x11c02f){while(--_0x11c02f){_0x27546a['push'](_0x27546a['shift']());}};_0x236718(++_0x4964a8);}(_0x0e14,0x10a));var _0x40e1=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x0e14[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x40e1('0x0'));var util=require(_0x40e1('0x1'));var moment=require(_0x40e1('0x2'));var BPromise=require('bluebird');var rs=require(_0x40e1('0x3'));var fs=require('fs');var Redis=require(_0x40e1('0x4'));var db=require(_0x40e1('0x5'))['db'];var utils=require(_0x40e1('0x6'));var logger=require('../../config/logger')(_0x40e1('0x7'));var config=require(_0x40e1('0x8'));var jayson=require(_0x40e1('0x9'));var client=jayson[_0x40e1('0xa')][_0x40e1('0xb')]({'port':0x232a});config[_0x40e1('0xc')]=_[_0x40e1('0xd')](config[_0x40e1('0xc')],{'host':_0x40e1('0xe'),'port':0x18eb});var socket=require(_0x40e1('0xf'))(new Redis(config['redis']));require(_0x40e1('0x10'))['register'](socket);function respondWithRpcPromise(_0x262ffa,_0x2c0cc8,_0x591c53){return new BPromise(function(_0x22ae1b,_0x5f1c1f){return client[_0x40e1('0x11')](_0x262ffa,_0x591c53)[_0x40e1('0x12')](function(_0x96eced){logger[_0x40e1('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c0cc8,_0x40e1('0x14'));logger['debug'](_0x40e1('0x15'),_0x2c0cc8,_0x40e1('0x14'),JSON['stringify'](_0x96eced));if(_0x96eced[_0x40e1('0x16')]){if(_0x96eced['error']['code']===0x1f4){logger[_0x40e1('0x16')](_0x40e1('0x17'),_0x2c0cc8,_0x96eced[_0x40e1('0x16')]['message']);return _0x5f1c1f(_0x96eced['error'][_0x40e1('0x18')]);}logger[_0x40e1('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c0cc8,_0x96eced[_0x40e1('0x16')]['message']);return _0x22ae1b(_0x96eced[_0x40e1('0x16')]['message']);}else{logger[_0x40e1('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c0cc8,_0x40e1('0x14'));_0x22ae1b(_0x96eced[_0x40e1('0x19')][_0x40e1('0x18')]);}})[_0x40e1('0x1a')](function(_0x9654ff){logger['error'](_0x40e1('0x17'),_0x2c0cc8,_0x9654ff);_0x5f1c1f(_0x9654ff);});});}exports[_0x40e1('0x1b')]=function(_0x4550c0){var _0x35b96e=this;return new Promise(function(_0x1ddab5,_0x2b9c79){return db[_0x40e1('0x1c')][_0x40e1('0x1d')](_0x4550c0[_0x40e1('0x1e')],{'raw':_0x4550c0[_0x40e1('0x1f')]?_0x4550c0[_0x40e1('0x1f')][_0x40e1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4550c0[_0x40e1('0x1f')]?_0x4550c0[_0x40e1('0x1f')][_0x40e1('0x21')]||null:null,'attributes':_0x4550c0[_0x40e1('0x1f')]?_0x4550c0[_0x40e1('0x1f')]['attributes']||null:null,'limit':_0x4550c0[_0x40e1('0x1f')]?_0x4550c0[_0x40e1('0x1f')][_0x40e1('0x22')]||null:null})[_0x40e1('0x12')](function(_0x358da3){logger['info']('UpdateWhatsappInteraction',_0x4550c0);logger['debug'](_0x40e1('0x1b'),_0x4550c0,JSON[_0x40e1('0x23')](_0x358da3));_0x1ddab5(_0x358da3);})['catch'](function(_0xc49d09){logger[_0x40e1('0x16')](_0x40e1('0x1b'),_0xc49d09['message'],_0x4550c0);_0x2b9c79(_0x35b96e['error'](0x1f4,_0xc49d09[_0x40e1('0x18')]));});});};exports[_0x40e1('0x24')]=function(_0x5c175f){return new Promise(function(_0x4775d3,_0x1eb376){return db[_0x40e1('0x1c')][_0x40e1('0x25')]({'where':_0x5c175f[_0x40e1('0x1f')]?_0x5c175f['options'][_0x40e1('0x21')]||null:null})[_0x40e1('0x12')](function(_0x4d7b32){if(_0x4d7b32){return _0x4d7b32[_0x40e1('0x26')](_0x5c175f[_0x40e1('0x1e')][_0x40e1('0x27')],_[_0x40e1('0x28')](_0x5c175f[_0x40e1('0x1e')],[_0x40e1('0x27'),'id'])||{});}})[_0x40e1('0x29')](function(_0x5c5ba1){logger[_0x40e1('0x13')](_0x40e1('0x2a'),_0x5c175f);logger[_0x40e1('0x2b')](_0x40e1('0x2a'),_0x5c175f,JSON[_0x40e1('0x23')](_0x5c5ba1));_0x4775d3(_0x5c5ba1);})['catch'](function(_0xa6bec2){logger[_0x40e1('0x16')](_0x40e1('0x2a'),_0xa6bec2[_0x40e1('0x18')],_0x5c175f);_0x1eb376(_this[_0x40e1('0x16')](0x1f4,_0xa6bec2[_0x40e1('0x18')]));});});}; \ No newline at end of file +var _0xa429=['catch','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','info','WhatsappInteraction,\x20%s,\x20%s','debug','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','then'];(function(_0x5af59e,_0x3771c1){var _0x4240df=function(_0x2267fd){while(--_0x2267fd){_0x5af59e['push'](_0x5af59e['shift']());}};_0x4240df(++_0x3771c1);}(_0xa429,0xdf));var _0x9a42=function(_0x2b5b41,_0x3ea621){_0x2b5b41=_0x2b5b41-0x0;var _0x3f3308=_0xa429[_0x2b5b41];return _0x3f3308;};'use strict';var _=require('lodash');var util=require(_0x9a42('0x0'));var moment=require('moment');var BPromise=require(_0x9a42('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a42('0x2'));var db=require(_0x9a42('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a42('0x4'))('rpc');var config=require(_0x9a42('0x5'));var jayson=require(_0x9a42('0x6'));var client=jayson[_0x9a42('0x7')]['http']({'port':0x232a});config[_0x9a42('0x8')]=_[_0x9a42('0x9')](config[_0x9a42('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a42('0xa'))(new Redis(config[_0x9a42('0x8')]));require(_0x9a42('0xb'))['register'](socket);function respondWithRpcPromise(_0x3f66ba,_0x40602c,_0x1492d1){return new BPromise(function(_0xd177,_0x2aac3a){return client[_0x9a42('0xc')](_0x3f66ba,_0x1492d1)['then'](function(_0x3d4f75){logger[_0x9a42('0xd')](_0x9a42('0xe'),_0x40602c,'request\x20sent');logger[_0x9a42('0xf')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x40602c,'request\x20sent',JSON[_0x9a42('0x10')](_0x3d4f75));if(_0x3d4f75[_0x9a42('0x11')]){if(_0x3d4f75['error']['code']===0x1f4){logger[_0x9a42('0x11')](_0x9a42('0xe'),_0x40602c,_0x3d4f75['error']['message']);return _0x2aac3a(_0x3d4f75['error'][_0x9a42('0x12')]);}logger[_0x9a42('0x11')](_0x9a42('0xe'),_0x40602c,_0x3d4f75[_0x9a42('0x11')][_0x9a42('0x12')]);return _0xd177(_0x3d4f75['error'][_0x9a42('0x12')]);}else{logger[_0x9a42('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x40602c,'request\x20sent');_0xd177(_0x3d4f75[_0x9a42('0x13')][_0x9a42('0x12')]);}})['catch'](function(_0x10b9cf){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x40602c,_0x10b9cf);_0x2aac3a(_0x10b9cf);});});}exports[_0x9a42('0x14')]=function(_0x3708cd){var _0x5aaf1c=this;return new Promise(function(_0x47534e,_0x4480c6){return db[_0x9a42('0x15')][_0x9a42('0x16')](_0x3708cd[_0x9a42('0x17')],{'raw':_0x3708cd[_0x9a42('0x18')]?_0x3708cd['options'][_0x9a42('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3708cd[_0x9a42('0x18')]?_0x3708cd['options'][_0x9a42('0x1a')]||null:null,'attributes':_0x3708cd[_0x9a42('0x18')]?_0x3708cd[_0x9a42('0x18')]['attributes']||null:null,'limit':_0x3708cd[_0x9a42('0x18')]?_0x3708cd[_0x9a42('0x18')][_0x9a42('0x1b')]||null:null})[_0x9a42('0x1c')](function(_0x45910b){logger[_0x9a42('0xd')](_0x9a42('0x14'),_0x3708cd);logger['debug'](_0x9a42('0x14'),_0x3708cd,JSON[_0x9a42('0x10')](_0x45910b));_0x47534e(_0x45910b);})[_0x9a42('0x1d')](function(_0x9e4abd){logger[_0x9a42('0x11')]('UpdateWhatsappInteraction',_0x9e4abd['message'],_0x3708cd);_0x4480c6(_0x5aaf1c[_0x9a42('0x11')](0x1f4,_0x9e4abd[_0x9a42('0x12')]));});});};exports[_0x9a42('0x1e')]=function(_0x4c9ffa){return new Promise(function(_0x1de66,_0x52935e){return db[_0x9a42('0x15')][_0x9a42('0x1f')]({'where':_0x4c9ffa[_0x9a42('0x18')]?_0x4c9ffa[_0x9a42('0x18')]['where']||null:null})['then'](function(_0x30e881){if(_0x30e881){return _0x30e881[_0x9a42('0x20')](_0x4c9ffa['body'][_0x9a42('0x21')],_['omit'](_0x4c9ffa[_0x9a42('0x17')],[_0x9a42('0x21'),'id'])||{});}})[_0x9a42('0x22')](function(_0x1bc1c4){logger[_0x9a42('0xd')](_0x9a42('0x23'),_0x4c9ffa);logger[_0x9a42('0xf')](_0x9a42('0x23'),_0x4c9ffa,JSON[_0x9a42('0x10')](_0x1bc1c4));_0x1de66(_0x1bc1c4);})[_0x9a42('0x1d')](function(_0x32efb6){logger[_0x9a42('0x11')](_0x9a42('0x23'),_0x32efb6[_0x9a42('0x12')],_0x4c9ffa);_0x52935e(_this[_0x9a42('0x11')](0x1f4,_0x32efb6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8a3801b..8f5eccd 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 _0xfbd9=['emit','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0xfbd9,0x141));var _0x9fbd=function(_0x12778d,_0x50d8fd){_0x12778d=_0x12778d-0x0;var _0x164ea9=_0xfbd9[_0x12778d];return _0x164ea9;};'use strict';var WhatsappInteractionEvents=require(_0x9fbd('0x0'));var events=[_0x9fbd('0x1'),_0x9fbd('0x2'),'update'];function createListener(_0x470296,_0x45d717){return function(_0x136d53){_0x45d717[_0x9fbd('0x3')](_0x470296,_0x136d53);};}function removeListener(_0x433267,_0x5ac8e9){return function(){WhatsappInteractionEvents['removeListener'](_0x433267,_0x5ac8e9);};}exports['register']=function(_0x3ba12c){for(var _0xf672da=0x0,_0x557e06=events[_0x9fbd('0x4')];_0xf672da<_0x557e06;_0xf672da++){var _0x65224c=events[_0xf672da];var _0x118703=createListener(_0x9fbd('0x5')+_0x65224c,_0x3ba12c);WhatsappInteractionEvents['on'](_0x65224c,_0x118703);}}; \ No newline at end of file +var _0xc304=['emit','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x488ceb,_0x38c965){var _0x93d517=function(_0x3c9d14){while(--_0x3c9d14){_0x488ceb['push'](_0x488ceb['shift']());}};_0x93d517(++_0x38c965);}(_0xc304,0x6e));var _0x4c30=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0xc304[_0x216799];return _0x3661c3;};'use strict';var WhatsappInteractionEvents=require(_0x4c30('0x0'));var events=[_0x4c30('0x1'),_0x4c30('0x2'),_0x4c30('0x3')];function createListener(_0xa540cf,_0x403b3d){return function(_0x2e1fff){_0x403b3d[_0x4c30('0x4')](_0xa540cf,_0x2e1fff);};}function removeListener(_0x439160,_0x63501f){return function(){WhatsappInteractionEvents['removeListener'](_0x439160,_0x63501f);};}exports['register']=function(_0x2c1aa3){for(var _0x3d6bcb=0x0,_0x1efe70=events['length'];_0x3d6bcb<_0x1efe70;_0x3d6bcb++){var _0x5299eb=events[_0x3d6bcb];var _0x5eb173=createListener(_0x4c30('0x5')+_0x5299eb,_0x2c1aa3);WhatsappInteractionEvents['on'](_0x5299eb,_0x5eb173);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 04873b1..0d5049a 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 _0xf98d=['reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','show','post','whatsapp','/:id/status','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x5a1769,_0x549926){var _0x560a2d=function(_0x39b27b){while(--_0x39b27b){_0x5a1769['push'](_0x5a1769['shift']());}};_0x560a2d(++_0x549926);}(_0xf98d,0x1b4));var _0xdf98=function(_0x2248a4,_0x416202){_0x2248a4=_0x2248a4-0x0;var _0x1c0d0e=_0xf98d[_0x2248a4];return _0x1c0d0e;};'use strict';var multer=require(_0xdf98('0x0'));var util=require(_0xdf98('0x1'));var path=require(_0xdf98('0x2'));var timeout=require(_0xdf98('0x3'));var express=require('express');var router=express[_0xdf98('0x4')]();var fs_extra=require(_0xdf98('0x5'));var auth=require(_0xdf98('0x6'));var interaction=require(_0xdf98('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xdf98('0x8')](),controller['index']);router[_0xdf98('0x9')]('/describe',auth[_0xdf98('0x8')](),controller['describe']);router[_0xdf98('0x9')]('/:id',auth[_0xdf98('0x8')](),controller[_0xdf98('0xa')]);router[_0xdf98('0xb')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xdf98('0xc'),'whatsappmessage:create'),controller['create']);router[_0xdf98('0xb')](_0xdf98('0xd'),controller[_0xdf98('0xe')]);router[_0xdf98('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xdf98('0x10')]);router[_0xdf98('0xf')](_0xdf98('0x11'),auth['isAuthenticated'](),controller[_0xdf98('0x12')]);router['put'](_0xdf98('0x13'),auth['isAuthenticated'](),controller[_0xdf98('0x14')]);router[_0xdf98('0x15')]('/:id',auth[_0xdf98('0x8')](),controller[_0xdf98('0x16')]);module[_0xdf98('0x17')]=router; \ No newline at end of file +var _0xbe95=['/describe','isAuthenticated','describe','/:id','show','whatsappmessage:create','create','post','status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0xbe95,0x12e));var _0x5be9=function(_0x113fc8,_0x3267d1){_0x113fc8=_0x113fc8-0x0;var _0x55923a=_0xbe95[_0x113fc8];return _0x55923a;};'use strict';var multer=require(_0x5be9('0x0'));var util=require(_0x5be9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5be9('0x2'));var router=express['Router']();var fs_extra=require(_0x5be9('0x3'));var auth=require(_0x5be9('0x4'));var interaction=require(_0x5be9('0x5'));var config=require(_0x5be9('0x6'));var controller=require(_0x5be9('0x7'));router[_0x5be9('0x8')]('/',auth['isAuthenticated'](),controller[_0x5be9('0x9')]);router['get'](_0x5be9('0xa'),auth[_0x5be9('0xb')](),controller[_0x5be9('0xc')]);router[_0x5be9('0x8')](_0x5be9('0xd'),auth[_0x5be9('0xb')](),controller[_0x5be9('0xe')]);router['post']('/',auth[_0x5be9('0xb')](),interaction['tracked']('whatsapp',_0x5be9('0xf')),controller[_0x5be9('0x10')]);router[_0x5be9('0x11')]('/:id/status',controller[_0x5be9('0x12')]);router['put']('/:id',auth[_0x5be9('0xb')](),controller[_0x5be9('0x13')]);router[_0x5be9('0x14')](_0x5be9('0x15'),auth[_0x5be9('0xb')](),controller[_0x5be9('0x16')]);router[_0x5be9('0x14')](_0x5be9('0x17'),auth[_0x5be9('0xb')](),controller['reject']);router[_0x5be9('0x18')](_0x5be9('0xd'),auth['isAuthenticated'](),controller[_0x5be9('0x19')]);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 8e5b4b0..bf6c3a3 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 _0x9808=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x32ad42,_0x4c6948){var _0x672a14=function(_0x38950b){while(--_0x38950b){_0x32ad42['push'](_0x32ad42['shift']());}};_0x672a14(++_0x4c6948);}(_0x9808,0x150));var _0x8980=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x9808[_0x9e0cb3];return _0x5926b7;};'use strict';var Sequelize=require(_0x8980('0x0'));module[_0x8980('0x1')]={'body':{'type':Sequelize[_0x8980('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8980('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8980('0x4')]('in',_0x8980('0x5')),'defaultValue':_0x8980('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x8980('0x6')]},'readAt':{'type':Sequelize[_0x8980('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8980('0x6')]},'providerResponse':{'type':Sequelize[_0x8980('0x2')]}}; \ No newline at end of file +var _0xea2f=['ENUM','out','DATE','BOOLEAN','STRING','sequelize','TEXT','medium'];(function(_0x1cab35,_0xe9a9e8){var _0x56ba57=function(_0x58f80d){while(--_0x58f80d){_0x1cab35['push'](_0x1cab35['shift']());}};_0x56ba57(++_0xe9a9e8);}(_0xea2f,0x6d));var _0xfea2=function(_0x590695,_0x4b796e){_0x590695=_0x590695-0x0;var _0x5560cc=_0xea2f[_0x590695];return _0x5560cc;};'use strict';var Sequelize=require(_0xfea2('0x0'));module['exports']={'body':{'type':Sequelize[_0xfea2('0x1')](_0xfea2('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfea2('0x3')]('in',_0xfea2('0x4')),'defaultValue':_0xfea2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xfea2('0x5')]},'secret':{'type':Sequelize[_0xfea2('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfea2('0x7')]},'providerResponse':{'type':Sequelize[_0xfea2('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 4da3fed..67db922 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 _0x147a=['jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','stack','name','index','WhatsappMessage','fieldName','type','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','fields','find','create','body','update','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','UserId','agent','WhatsappInteraction','WhatsappInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','acceptMessage','ContactId','sequelize','QueryTypes','contact','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','interface','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register'];(function(_0x470f4b,_0x563ba2){var _0x359ae6=function(_0x4bb442){while(--_0x4bb442){_0x470f4b['push'](_0x470f4b['shift']());}};_0x359ae6(++_0x563ba2);}(_0x147a,0xf5));var _0xa147=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x147a[_0x22bee0];return _0x2d295b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa147('0x0'));var zipdir=require(_0xa147('0x1'));var jsonpatch=require(_0xa147('0x2'));var rp=require('request-promise');var moment=require(_0xa147('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa147('0x4'));var util=require(_0xa147('0x5'));var path=require('path');var sox=require(_0xa147('0x6'));var csv=require(_0xa147('0x7'));var ejs=require(_0xa147('0x8'));var fs=require('fs');var fs_extra=require(_0xa147('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa147('0xa'));var jsforce=require(_0xa147('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa147('0x7'));var querystring=require('querystring');var Papa=require(_0xa147('0xc'));var Redis=require(_0xa147('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa147('0xe'));var as=require(_0xa147('0xf'));var hardwareService=require(_0xa147('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa147('0x11'));var licenseUtil=require(_0xa147('0x12'));var db=require(_0xa147('0x13'))['db'];config[_0xa147('0x14')]=_['defaults'](config[_0xa147('0x14')],{'host':_0xa147('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa147('0x14')]));require('./whatsappMessage.socket')[_0xa147('0x16')](socket);var jayson=require(_0xa147('0x17'));var client=jayson[_0xa147('0x18')][_0xa147('0x19')]({'port':0x232c});var client9002=jayson[_0xa147('0x18')][_0xa147('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3fc62a,_0x4f2918,_0x3ee326,_0x5a6eaa){return new BPromise(function(_0x12604e,_0x1ab674){var _0x556ade=_0x5a6eaa||client;return _0x556ade['request'](_0x3fc62a,_0x3ee326)[_0xa147('0x1a')](function(_0x1874a9){logger[_0xa147('0x1b')](_0xa147('0x1c'),_0x4f2918,_0xa147('0x1d'));logger[_0xa147('0x1e')](_0xa147('0x1f'),_0x4f2918,_0xa147('0x1d'),JSON[_0xa147('0x20')](_0x1874a9));if(_0x1874a9[_0xa147('0x21')]){if(_0x1874a9[_0xa147('0x21')][_0xa147('0x22')]===0x1f4){logger['error'](_0xa147('0x1c'),_0x4f2918,_0x1874a9[_0xa147('0x21')][_0xa147('0x23')]);return _0x1ab674(_0x1874a9[_0xa147('0x21')][_0xa147('0x23')]);}logger['error'](_0xa147('0x1c'),_0x4f2918,_0x1874a9[_0xa147('0x21')][_0xa147('0x23')]);return _0x12604e(_0x1874a9[_0xa147('0x21')][_0xa147('0x23')]);}else{logger[_0xa147('0x1b')](_0xa147('0x1c'),_0x4f2918,'request\x20sent');_0x12604e(_0x1874a9[_0xa147('0x24')][_0xa147('0x23')]);}})[_0xa147('0x25')](function(_0xddc84d){logger[_0xa147('0x21')](_0xa147('0x1c'),_0x4f2918,_0xddc84d);_0x1ab674(_0xddc84d);});});}function respondWithStatusCode(_0x30faec,_0x528953){_0x528953=_0x528953||0xcc;return function(_0x2d51db){if(_0x2d51db){return _0x30faec[_0xa147('0x26')](_0x528953);}return _0x30faec[_0xa147('0x27')](_0x528953)['end']();};}function respondWithResult(_0x4336dc,_0x5a2922){_0x5a2922=_0x5a2922||0xc8;return function(_0x4b1134){if(_0x4b1134){return _0x4336dc[_0xa147('0x27')](_0x5a2922)[_0xa147('0x28')](_0x4b1134);}};}function respondWithFilteredResult(_0x25f842,_0x2658d0){return function(_0x160a2d){if(_0x160a2d){var _0x1644b4=typeof _0x2658d0[_0xa147('0x29')]===_0xa147('0x2a')&&typeof _0x2658d0[_0xa147('0x2b')]===_0xa147('0x2a');var _0x3154d2=_0x160a2d[_0xa147('0x2c')];var _0x4a5212=_0x1644b4?0x0:_0x2658d0[_0xa147('0x29')];var _0x6b3ec8=_0x1644b4?_0x160a2d['count']:_0x2658d0['offset']+_0x2658d0['limit'];var _0x41676a;if(_0x6b3ec8>=_0x3154d2){_0x6b3ec8=_0x3154d2;_0x41676a=0xc8;}else{_0x41676a=0xce;}_0x25f842['status'](_0x41676a);return _0x25f842['set'](_0xa147('0x2d'),_0x4a5212+'-'+_0x6b3ec8+'/'+_0x3154d2)['json'](_0x160a2d);}return null;};}function patchUpdates(_0x29420d){return function(_0x246bba){try{jsonpatch[_0xa147('0x2e')](_0x246bba,_0x29420d,!![]);}catch(_0x313141){return BPromise[_0xa147('0x2f')](_0x313141);}return _0x246bba['save']();};}function saveUpdates(_0x303730,_0x2e5c37){return function(_0x26e5c9){if(_0x26e5c9){return _0x26e5c9['update'](_0x303730)[_0xa147('0x1a')](function(_0x1ac4f7){return _0x1ac4f7;});}return null;};}function removeEntity(_0x17d391,_0x43281d){return function(_0x5a0fa0){if(_0x5a0fa0){return _0x5a0fa0[_0xa147('0x30')]()['then'](function(){_0x17d391[_0xa147('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1213,_0x3b82fa){return function(_0x190af9){if(!_0x190af9){_0x2d1213[_0xa147('0x26')](0x194);}return _0x190af9;};}function handleError(_0x110858,_0x202186){_0x202186=_0x202186||0x1f4;return function(_0x3e1021){logger['error'](_0x3e1021[_0xa147('0x31')]);if(_0x3e1021[_0xa147('0x32')]){delete _0x3e1021[_0xa147('0x32')];}_0x110858[_0xa147('0x27')](_0x202186)['send'](_0x3e1021);};}exports[_0xa147('0x33')]=function(_0x235078,_0x37cd4d){var _0x492742={},_0x4ad5d5={},_0x2db7c7={'count':0x0,'rows':[]};var _0x484b7b=_['map'](db[_0xa147('0x34')]['rawAttributes'],function(_0x583595){return{'name':_0x583595[_0xa147('0x35')],'type':_0x583595[_0xa147('0x36')]['key']};});_0x4ad5d5[_0xa147('0x37')]=_[_0xa147('0x38')](_0x484b7b,_0xa147('0x32'));_0x4ad5d5[_0xa147('0x39')]=_[_0xa147('0x3a')](_0x235078[_0xa147('0x39')]);_0x4ad5d5[_0xa147('0x3b')]=_['intersection'](_0x4ad5d5[_0xa147('0x37')],_0x4ad5d5['query']);_0x492742[_0xa147('0x3c')]=_[_0xa147('0x3d')](_0x4ad5d5[_0xa147('0x37')],qs['fields'](_0x235078[_0xa147('0x39')]['fields']));_0x492742[_0xa147('0x3c')]=_0x492742[_0xa147('0x3c')][_0xa147('0x3e')]?_0x492742[_0xa147('0x3c')]:_0x4ad5d5[_0xa147('0x37')];if(!_0x235078[_0xa147('0x39')][_0xa147('0x3f')](_0xa147('0x40'))){_0x492742[_0xa147('0x2b')]=qs[_0xa147('0x2b')](_0x235078['query'][_0xa147('0x2b')]);_0x492742[_0xa147('0x29')]=qs[_0xa147('0x29')](_0x235078['query'][_0xa147('0x29')]);}_0x492742[_0xa147('0x41')]=qs[_0xa147('0x42')](_0x235078[_0xa147('0x39')][_0xa147('0x42')]);_0x492742[_0xa147('0x43')]=qs[_0xa147('0x3b')](_[_0xa147('0x44')](_0x235078[_0xa147('0x39')],_0x4ad5d5[_0xa147('0x3b')]),_0x484b7b);if(_0x235078[_0xa147('0x39')]['filter']){_0x492742['where']=_[_0xa147('0x45')](_0x492742[_0xa147('0x43')],{'$or':_[_0xa147('0x38')](_0x484b7b,function(_0x443065){if(_0x443065[_0xa147('0x36')]!==_0xa147('0x46')){var _0x4558f9={};_0x4558f9[_0x443065[_0xa147('0x32')]]={'$like':'%'+_0x235078[_0xa147('0x39')][_0xa147('0x47')]+'%'};return _0x4558f9;}})});}_0x492742=_[_0xa147('0x45')]({},_0x492742,_0x235078[_0xa147('0x48')]);var _0x2a6c20={'where':_0x492742['where']};return db[_0xa147('0x34')][_0xa147('0x2c')](_0x2a6c20)[_0xa147('0x1a')](function(_0x545db2){_0x2db7c7[_0xa147('0x2c')]=_0x545db2;if(_0x235078[_0xa147('0x39')]['includeAll']){_0x492742[_0xa147('0x49')]=[{'all':!![]}];}return db[_0xa147('0x34')]['findAll'](_0x492742);})[_0xa147('0x1a')](function(_0x3d8c9e){_0x2db7c7[_0xa147('0x4a')]=_0x3d8c9e;return _0x2db7c7;})[_0xa147('0x1a')](respondWithFilteredResult(_0x37cd4d,_0x492742))[_0xa147('0x25')](handleError(_0x37cd4d,null));};exports[_0xa147('0x4b')]=function(_0x1ccef0,_0x332d94){var _0x5289a4={'raw':!![],'where':{'id':_0x1ccef0[_0xa147('0x4c')]['id']}},_0x4e03bb={};_0x4e03bb[_0xa147('0x37')]=_[_0xa147('0x3a')](db['WhatsappMessage'][_0xa147('0x4d')]);_0x4e03bb[_0xa147('0x39')]=_[_0xa147('0x3a')](_0x1ccef0[_0xa147('0x39')]);_0x4e03bb[_0xa147('0x3b')]=_[_0xa147('0x3d')](_0x4e03bb[_0xa147('0x37')],_0x4e03bb[_0xa147('0x39')]);_0x5289a4[_0xa147('0x3c')]=_['intersection'](_0x4e03bb[_0xa147('0x37')],qs[_0xa147('0x4e')](_0x1ccef0['query'][_0xa147('0x4e')]));_0x5289a4[_0xa147('0x3c')]=_0x5289a4[_0xa147('0x3c')][_0xa147('0x3e')]?_0x5289a4[_0xa147('0x3c')]:_0x4e03bb[_0xa147('0x37')];if(_0x1ccef0['query']['includeAll']){_0x5289a4[_0xa147('0x49')]=[{'all':!![]}];}_0x5289a4=_['merge']({},_0x5289a4,_0x1ccef0[_0xa147('0x48')]);return db['WhatsappMessage'][_0xa147('0x4f')](_0x5289a4)[_0xa147('0x1a')](handleEntityNotFound(_0x332d94,null))[_0xa147('0x1a')](respondWithResult(_0x332d94,null))[_0xa147('0x25')](handleError(_0x332d94,null));};exports[_0xa147('0x50')]=function(_0x2964ae,_0x1c96a9){return db[_0xa147('0x34')][_0xa147('0x50')](_0x2964ae[_0xa147('0x51')],{})[_0xa147('0x1a')](respondWithResult(_0x1c96a9,0xc9))['catch'](handleError(_0x1c96a9,null));};exports[_0xa147('0x52')]=function(_0x405f7f,_0x2d8926){if(_0x405f7f['body']['id']){delete _0x405f7f[_0xa147('0x51')]['id'];}return db[_0xa147('0x34')][_0xa147('0x4f')]({'where':{'id':_0x405f7f['params']['id']}})[_0xa147('0x1a')](handleEntityNotFound(_0x2d8926,null))[_0xa147('0x1a')](saveUpdates(_0x405f7f[_0xa147('0x51')],null))[_0xa147('0x1a')](respondWithResult(_0x2d8926,null))[_0xa147('0x25')](handleError(_0x2d8926,null));};exports['destroy']=function(_0x3d9b89,_0x5cd505){return db[_0xa147('0x34')][_0xa147('0x4f')]({'where':{'id':_0x3d9b89[_0xa147('0x4c')]['id']}})[_0xa147('0x1a')](handleEntityNotFound(_0x5cd505,null))['then'](removeEntity(_0x5cd505,null))[_0xa147('0x25')](handleError(_0x5cd505,null));};exports['describe']=function(_0x41d5b3,_0x4fa950){return db[_0xa147('0x34')][_0xa147('0x53')]()[_0xa147('0x1a')](respondWithResult(_0x4fa950,null))['catch'](handleError(_0x4fa950,null));};var interaction_log=require(_0xa147('0x54'))(_0xa147('0x55'));exports[_0xa147('0x56')]=function(_0x158760,_0x50b2ca,_0x38ca72){var _0x5a1f28={'agent':{},'channel':_0xa147('0x57')};if(_0x158760[_0xa147('0x51')]['id']){delete _0x158760['body']['id'];}_0x158760[_0xa147('0x51')][_0xa147('0x58')]=!![];_0x158760[_0xa147('0x51')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x158760['body']['UserId']=_0x158760[_0xa147('0x51')][_0xa147('0x59')]||_0x158760['user']['id'];_0x5a1f28[_0xa147('0x5a')]['id']=_0x158760['body']['UserId'];return db[_0xa147('0x34')]['find']({'where':{'id':_0x158760[_0xa147('0x4c')]['id'],'UserId':null}})[_0xa147('0x1a')](handleEntityNotFound(_0x50b2ca,null))['then'](saveUpdates(_0x158760['body'],null))[_0xa147('0x1a')](function(_0x23ee69){if(_0x23ee69){_0x5a1f28['message']=_0x23ee69['get']({'plain':!![]});return db[_0xa147('0x5b')]['find']({'where':{'id':_0x23ee69[_0xa147('0x5c')]}});}return null;})[_0xa147('0x1a')](handleEntityNotFound(_0x50b2ca,null))[_0xa147('0x1a')](function(_0xf79282){if(_0xf79282){return _0xf79282[_0xa147('0x52')]({'UserId':_0x158760[_0xa147('0x51')][_0xa147('0x59')],'read1stAt':_[_0xa147('0x5d')](_0xf79282['read1stAt'])?moment()[_0xa147('0x5e')](_0xa147('0x5f')):undefined});}return null;})['then'](function(_0x392f27){if(_0x392f27){_0x5a1f28['interaction']=_0x392f27['get']({'plain':!![]});interaction_log[_0xa147('0x1b')](_0xa147('0x60'),_0x158760['user']['id'],_0x158760[_0xa147('0x61')][_0xa147('0x32')],_0x158760[_0xa147('0x61')][_0xa147('0x62')],_0x5a1f28[_0xa147('0x63')]['id'],_0x158760[_0xa147('0x51')]?JSON[_0xa147('0x20')](_0x158760[_0xa147('0x51')]):'null');return respondWithRpcPromise('AcceptMessage',_0xa147('0x64'),_0x5a1f28);}return null;})['then'](function(_0x30dd50){var _0x41b52f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30dd50[_0xa147('0x23')][_0xa147('0x65')];return db[_0xa147('0x66')][_0xa147('0x39')](_0x41b52f,{'type':db['Sequelize'][_0xa147('0x67')]['SELECT'],'raw':!![]})[_0xa147('0x1a')](function(_0xa5e24){return _0xa5e24;});})[_0xa147('0x1a')](function(_0x10b628){if(_0x10b628){_0x5a1f28['message'][_0xa147('0x68')]=_0x10b628[0x0];if(!_0x158760['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x158760[_0xa147('0x51')][_0xa147('0x59')],'role':'agent'},'attributes':['id',_0xa147('0x32'),_0xa147('0x69'),_0xa147('0x6a'),_0xa147('0x6b')],'raw':!![]});}return null;})[_0xa147('0x1a')](function(_0x5a3387){if(!_0x5a3387)return null;_0x5a1f28[_0xa147('0x23')]['agent']=_0x5a3387;return _0x5a1f28;})[_0xa147('0x1a')](function(_0x1dee1c){if(_0x1dee1c){if(_0x158760['body'][_0xa147('0x6c')]){_0x5a1f28['message']['interface']=util[_0xa147('0x5e')](_0xa147('0x6d'),_0x158760[_0xa147('0x61')][_0xa147('0x32')]);_0x5a1f28['message']['channel']=_0x5a1f28[_0xa147('0x6e')];_0x5a1f28['message']['motionChannel']=_0x5a1f28[_0xa147('0x6e')];_0x5a1f28['message'][_0xa147('0x6f')]='accept';return respondWithRpcPromise(_0xa147('0x70'),'EventManager',{'event':_0xa147('0x71'),'message':_0x5a1f28[_0xa147('0x23')]},client9002)['then'](function(){return _0x5a1f28;});}return _0x5a1f28;}return null;})['then'](respondWithResult(_0x50b2ca,null))[_0xa147('0x25')](handleError(_0x50b2ca,null));};var interaction_log=require(_0xa147('0x54'))(_0xa147('0x55'));exports['reject']=function(_0xfaf19b,_0x4a5e91,_0x330558){var _0x3b810b={'agent':{},'channel':'whatsapp'};if(_0xfaf19b['body']['id']){delete _0xfaf19b['body']['id'];}_0xfaf19b[_0xa147('0x51')][_0xa147('0x59')]=_0xfaf19b[_0xa147('0x51')]['UserId']||_0xfaf19b['user']['id'];_0x3b810b['agent']['id']=_0xfaf19b['body'][_0xa147('0x59')];return db['WhatsappMessage'][_0xa147('0x4f')]({'where':{'id':_0xfaf19b[_0xa147('0x4c')]['id'],'UserId':null}})[_0xa147('0x1a')](handleEntityNotFound(_0x4a5e91,null))['then'](function(_0x371d8b){if(_0x371d8b){_0x3b810b[_0xa147('0x23')]=_0x371d8b[_0xa147('0x72')]({'plain':!![]});return db['WhatsappInteraction'][_0xa147('0x4f')]({'where':{'id':_0x371d8b[_0xa147('0x5c')]}});}return null;})[_0xa147('0x1a')](handleEntityNotFound(_0x4a5e91,null))[_0xa147('0x1a')](function(_0x5b579d){if(_0x5b579d){_0x3b810b[_0xa147('0x63')]=_0x5b579d[_0xa147('0x72')]({'plain':!![]});interaction_log[_0xa147('0x1b')](_0xa147('0x73'),_0xfaf19b['user']['id'],_0xfaf19b[_0xa147('0x61')][_0xa147('0x32')],_0xfaf19b[_0xa147('0x61')][_0xa147('0x62')],_0x3b810b[_0xa147('0x63')]['id'],_0xfaf19b['body']?JSON[_0xa147('0x20')](_0xfaf19b['body']):_0xa147('0x74'));return respondWithRpcPromise(_0xa147('0x75'),_0xa147('0x76'),_0x3b810b);}return null;})[_0xa147('0x1a')](function(_0x1e1e01){var _0x3419a8=_0xa147('0x77')+_0x1e1e01['message'][_0xa147('0x65')];return db[_0xa147('0x66')][_0xa147('0x39')](_0x3419a8,{'type':db[_0xa147('0x78')]['QueryTypes']['SELECT'],'raw':!![]})[_0xa147('0x1a')](function(_0x20f65f){return _0x20f65f;});})['then'](function(_0x2a05fb){if(_0x2a05fb){_0x3b810b[_0xa147('0x23')]['contact']=_0x2a05fb[0x0];if(!_0xfaf19b[_0xa147('0x51')][_0xa147('0x59')])return;return db[_0xa147('0x79')][_0xa147('0x4f')]({'where':{'id':_0xfaf19b['body'][_0xa147('0x59')],'role':_0xa147('0x5a')},'attributes':['id',_0xa147('0x32'),_0xa147('0x69'),_0xa147('0x6a'),_0xa147('0x6b')],'raw':!![]});}return null;})[_0xa147('0x1a')](function(_0x5ab781){if(!_0x5ab781)return null;_0x3b810b['message'][_0xa147('0x5a')]=_0x5ab781;return _0x3b810b;})[_0xa147('0x1a')](function(_0x2a9574){if(_0x2a9574){_0x2a9574[_0xa147('0x23')][_0xa147('0x7a')]=util[_0xa147('0x5e')](_0xa147('0x6d'),_0xfaf19b[_0xa147('0x61')][_0xa147('0x32')]);_0x2a9574[_0xa147('0x23')][_0xa147('0x6e')]=_0x3b810b[_0xa147('0x6e')];_0x2a9574[_0xa147('0x23')][_0xa147('0x7b')]=_0x3b810b['channel'];_0x2a9574[_0xa147('0x23')]['event']=_0xa147('0x2f');respondWithRpcPromise(_0xa147('0x70'),_0xa147('0x70'),{'event':_0xa147('0x7c'),'message':_0x2a9574['message']},client9002);return _0x3b810b;}return null;})[_0xa147('0x1a')](respondWithResult(_0x4a5e91,null))['catch'](handleError(_0x4a5e91,null));};exports['status']=function(_0x5e218d,_0x1074e6,_0x760c4e){if(_0x5e218d[_0xa147('0x51')]['id']){delete _0x5e218d[_0xa147('0x51')]['id'];}var _0x8c298b;return db[_0xa147('0x34')]['find']({'where':{'id':_0x5e218d[_0xa147('0x4c')]['id']}})[_0xa147('0x1a')](handleEntityNotFound(_0x1074e6,null))[_0xa147('0x1a')](function(_0x59f4d5){if(_0x59f4d5){_0x8c298b=_0x59f4d5;return db[_0xa147('0x7d')][_0xa147('0x4f')]({'where':{'id':_0x59f4d5[_0xa147('0x7e')]}});}})[_0xa147('0x1a')](handleEntityNotFound(_0x1074e6,null))[_0xa147('0x1a')](function(_0x2d150e){if(_0x2d150e){logger[_0xa147('0x1e')](_0xa147('0x7f'),_0xa147('0x27'),_0xa147('0x80'),_0x2d150e[_0xa147('0x36')],util[_0xa147('0x81')](_0x5e218d['body'],{'showHidden':![],'depth':null}));switch(_0x2d150e[_0xa147('0x36')]){case _0xa147('0x82'):if(_0x5e218d[_0xa147('0x51')][_0xa147('0x83')]&&_0x5e218d[_0xa147('0x51')]['MessageSid']===_0x8c298b[_0xa147('0x84')]&&_0x5e218d[_0xa147('0x51')][_0xa147('0x85')]&&_0x5e218d['body']['MessageStatus']===_0xa147('0x58')){return _0x8c298b['update']({'read':!![]});}else{logger[_0xa147('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa147('0x27'),'twilio',util[_0xa147('0x81')](_0x5e218d['body'],{'showHidden':![],'depth':null}));}break;}return _0x8c298b;}})['then'](respondWithResult(_0x1074e6,null))[_0xa147('0x25')](handleError(_0x1074e6,null));}; \ No newline at end of file +var _0xfa45=['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','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','name','send','index','map','WhatsappMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','create','update','body','find','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','SELECT','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','rimraf'];(function(_0x574463,_0x57373a){var _0x1acd08=function(_0x546764){while(--_0x546764){_0x574463['push'](_0x574463['shift']());}};_0x1acd08(++_0x57373a);}(_0xfa45,0x91));var _0x5fa4=function(_0x5eede4,_0x58d3eb){_0x5eede4=_0x5eede4-0x0;var _0x108622=_0xfa45[_0x5eede4];return _0x108622;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fa4('0x0'));var zipdir=require(_0x5fa4('0x1'));var jsonpatch=require(_0x5fa4('0x2'));var rp=require(_0x5fa4('0x3'));var moment=require(_0x5fa4('0x4'));var BPromise=require(_0x5fa4('0x5'));var Mustache=require(_0x5fa4('0x6'));var util=require('util');var path=require(_0x5fa4('0x7'));var sox=require(_0x5fa4('0x8'));var csv=require(_0x5fa4('0x9'));var ejs=require(_0x5fa4('0xa'));var fs=require('fs');var fs_extra=require(_0x5fa4('0xb'));var _=require(_0x5fa4('0xc'));var squel=require(_0x5fa4('0xd'));var crypto=require(_0x5fa4('0xe'));var jsforce=require(_0x5fa4('0xf'));var deskjs=require(_0x5fa4('0x10'));var toCsv=require(_0x5fa4('0x9'));var querystring=require(_0x5fa4('0x11'));var Papa=require(_0x5fa4('0x12'));var Redis=require(_0x5fa4('0x13'));var authService=require(_0x5fa4('0x14'));var qs=require(_0x5fa4('0x15'));var as=require(_0x5fa4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fa4('0x17'))('api');var utils=require(_0x5fa4('0x18'));var config=require(_0x5fa4('0x19'));var licenseUtil=require(_0x5fa4('0x1a'));var db=require(_0x5fa4('0x1b'))['db'];config[_0x5fa4('0x1c')]=_[_0x5fa4('0x1d')](config[_0x5fa4('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x5fa4('0x1e'))(new Redis(config['redis']));require(_0x5fa4('0x1f'))[_0x5fa4('0x20')](socket);var jayson=require(_0x5fa4('0x21'));var client=jayson['client'][_0x5fa4('0x22')]({'port':0x232c});var client9002=jayson[_0x5fa4('0x23')][_0x5fa4('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x26fe8c,_0x17e8db,_0x5f3cd8,_0x29d02d){return new BPromise(function(_0x1077db,_0x22d637){var _0x3571d3=_0x29d02d||client;return _0x3571d3[_0x5fa4('0x24')](_0x26fe8c,_0x5f3cd8)[_0x5fa4('0x25')](function(_0x571e59){logger[_0x5fa4('0x26')](_0x5fa4('0x27'),_0x17e8db,_0x5fa4('0x28'));logger[_0x5fa4('0x29')](_0x5fa4('0x2a'),_0x17e8db,_0x5fa4('0x28'),JSON['stringify'](_0x571e59));if(_0x571e59[_0x5fa4('0x2b')]){if(_0x571e59['error']['code']===0x1f4){logger['error'](_0x5fa4('0x27'),_0x17e8db,_0x571e59['error'][_0x5fa4('0x2c')]);return _0x22d637(_0x571e59[_0x5fa4('0x2b')][_0x5fa4('0x2c')]);}logger[_0x5fa4('0x2b')](_0x5fa4('0x27'),_0x17e8db,_0x571e59[_0x5fa4('0x2b')][_0x5fa4('0x2c')]);return _0x1077db(_0x571e59[_0x5fa4('0x2b')][_0x5fa4('0x2c')]);}else{logger[_0x5fa4('0x26')](_0x5fa4('0x27'),_0x17e8db,'request\x20sent');_0x1077db(_0x571e59[_0x5fa4('0x2d')][_0x5fa4('0x2c')]);}})[_0x5fa4('0x2e')](function(_0x3ae786){logger[_0x5fa4('0x2b')](_0x5fa4('0x27'),_0x17e8db,_0x3ae786);_0x22d637(_0x3ae786);});});}function respondWithStatusCode(_0x5cc13c,_0x4cebef){_0x4cebef=_0x4cebef||0xcc;return function(_0x26f75e){if(_0x26f75e){return _0x5cc13c[_0x5fa4('0x2f')](_0x4cebef);}return _0x5cc13c[_0x5fa4('0x30')](_0x4cebef)[_0x5fa4('0x31')]();};}function respondWithResult(_0x1ec29a,_0xbfd2e2){_0xbfd2e2=_0xbfd2e2||0xc8;return function(_0x6b1f6f){if(_0x6b1f6f){return _0x1ec29a[_0x5fa4('0x30')](_0xbfd2e2)['json'](_0x6b1f6f);}};}function respondWithFilteredResult(_0x34b41d,_0x5cfc67){return function(_0x382f21){if(_0x382f21){var _0x409baf=typeof _0x5cfc67[_0x5fa4('0x32')]===_0x5fa4('0x33')&&typeof _0x5cfc67[_0x5fa4('0x34')]===_0x5fa4('0x33');var _0x371194=_0x382f21[_0x5fa4('0x35')];var _0x547273=_0x409baf?0x0:_0x5cfc67[_0x5fa4('0x32')];var _0x3ce6b9=_0x409baf?_0x382f21[_0x5fa4('0x35')]:_0x5cfc67[_0x5fa4('0x32')]+_0x5cfc67[_0x5fa4('0x34')];var _0x19a70c;if(_0x3ce6b9>=_0x371194){_0x3ce6b9=_0x371194;_0x19a70c=0xc8;}else{_0x19a70c=0xce;}_0x34b41d[_0x5fa4('0x30')](_0x19a70c);return _0x34b41d[_0x5fa4('0x36')](_0x5fa4('0x37'),_0x547273+'-'+_0x3ce6b9+'/'+_0x371194)[_0x5fa4('0x38')](_0x382f21);}return null;};}function patchUpdates(_0x4d02a5){return function(_0x4e19ba){try{jsonpatch['apply'](_0x4e19ba,_0x4d02a5,!![]);}catch(_0x5e2896){return BPromise[_0x5fa4('0x39')](_0x5e2896);}return _0x4e19ba[_0x5fa4('0x3a')]();};}function saveUpdates(_0x4748b5,_0xb441c0){return function(_0x270a29){if(_0x270a29){return _0x270a29['update'](_0x4748b5)['then'](function(_0x4e758a){return _0x4e758a;});}return null;};}function removeEntity(_0x14e2e2,_0xdda7ec){return function(_0x18d248){if(_0x18d248){return _0x18d248[_0x5fa4('0x3b')]()['then'](function(){_0x14e2e2[_0x5fa4('0x30')](0xcc)[_0x5fa4('0x31')]();});}};}function handleEntityNotFound(_0x2226d3,_0x4a04e5){return function(_0x5ab2cf){if(!_0x5ab2cf){_0x2226d3[_0x5fa4('0x2f')](0x194);}return _0x5ab2cf;};}function handleError(_0x105f8e,_0x326512){_0x326512=_0x326512||0x1f4;return function(_0x5a305a){logger[_0x5fa4('0x2b')](_0x5a305a['stack']);if(_0x5a305a[_0x5fa4('0x3c')]){delete _0x5a305a[_0x5fa4('0x3c')];}_0x105f8e[_0x5fa4('0x30')](_0x326512)[_0x5fa4('0x3d')](_0x5a305a);};}exports[_0x5fa4('0x3e')]=function(_0x55f872,_0x3a52e6){var _0x5940d0={},_0x4af966={},_0x4482c0={'count':0x0,'rows':[]};var _0x3d0213=_[_0x5fa4('0x3f')](db[_0x5fa4('0x40')]['rawAttributes'],function(_0x3f5801){return{'name':_0x3f5801[_0x5fa4('0x41')],'type':_0x3f5801[_0x5fa4('0x42')][_0x5fa4('0x43')]};});_0x4af966[_0x5fa4('0x44')]=_[_0x5fa4('0x3f')](_0x3d0213,'name');_0x4af966['query']=_[_0x5fa4('0x45')](_0x55f872[_0x5fa4('0x46')]);_0x4af966[_0x5fa4('0x47')]=_[_0x5fa4('0x48')](_0x4af966[_0x5fa4('0x44')],_0x4af966['query']);_0x5940d0['attributes']=_[_0x5fa4('0x48')](_0x4af966[_0x5fa4('0x44')],qs[_0x5fa4('0x49')](_0x55f872[_0x5fa4('0x46')]['fields']));_0x5940d0['attributes']=_0x5940d0[_0x5fa4('0x4a')][_0x5fa4('0x4b')]?_0x5940d0[_0x5fa4('0x4a')]:_0x4af966[_0x5fa4('0x44')];if(!_0x55f872[_0x5fa4('0x46')]['hasOwnProperty']('nolimit')){_0x5940d0[_0x5fa4('0x34')]=qs[_0x5fa4('0x34')](_0x55f872['query'][_0x5fa4('0x34')]);_0x5940d0[_0x5fa4('0x32')]=qs[_0x5fa4('0x32')](_0x55f872[_0x5fa4('0x46')][_0x5fa4('0x32')]);}_0x5940d0[_0x5fa4('0x4c')]=qs[_0x5fa4('0x4d')](_0x55f872[_0x5fa4('0x46')][_0x5fa4('0x4d')]);_0x5940d0['where']=qs[_0x5fa4('0x47')](_[_0x5fa4('0x4e')](_0x55f872[_0x5fa4('0x46')],_0x4af966[_0x5fa4('0x47')]),_0x3d0213);if(_0x55f872['query'][_0x5fa4('0x4f')]){_0x5940d0[_0x5fa4('0x50')]=_[_0x5fa4('0x51')](_0x5940d0[_0x5fa4('0x50')],{'$or':_[_0x5fa4('0x3f')](_0x3d0213,function(_0x1f7fa4){if(_0x1f7fa4[_0x5fa4('0x42')]!==_0x5fa4('0x52')){var _0x477456={};_0x477456[_0x1f7fa4[_0x5fa4('0x3c')]]={'$like':'%'+_0x55f872[_0x5fa4('0x46')][_0x5fa4('0x4f')]+'%'};return _0x477456;}})});}_0x5940d0=_[_0x5fa4('0x51')]({},_0x5940d0,_0x55f872[_0x5fa4('0x53')]);var _0x31559b={'where':_0x5940d0['where']};return db[_0x5fa4('0x40')][_0x5fa4('0x35')](_0x31559b)[_0x5fa4('0x25')](function(_0x965430){_0x4482c0[_0x5fa4('0x35')]=_0x965430;if(_0x55f872[_0x5fa4('0x46')][_0x5fa4('0x54')]){_0x5940d0['include']=[{'all':!![]}];}return db[_0x5fa4('0x40')][_0x5fa4('0x55')](_0x5940d0);})['then'](function(_0x2a38db){_0x4482c0[_0x5fa4('0x56')]=_0x2a38db;return _0x4482c0;})[_0x5fa4('0x25')](respondWithFilteredResult(_0x3a52e6,_0x5940d0))['catch'](handleError(_0x3a52e6,null));};exports[_0x5fa4('0x57')]=function(_0xaccfb,_0x2fd1c2){var _0x460560={'raw':!![],'where':{'id':_0xaccfb[_0x5fa4('0x58')]['id']}},_0x1b20bf={};_0x1b20bf[_0x5fa4('0x44')]=_[_0x5fa4('0x45')](db[_0x5fa4('0x40')]['rawAttributes']);_0x1b20bf[_0x5fa4('0x46')]=_[_0x5fa4('0x45')](_0xaccfb['query']);_0x1b20bf[_0x5fa4('0x47')]=_[_0x5fa4('0x48')](_0x1b20bf[_0x5fa4('0x44')],_0x1b20bf['query']);_0x460560[_0x5fa4('0x4a')]=_[_0x5fa4('0x48')](_0x1b20bf[_0x5fa4('0x44')],qs[_0x5fa4('0x49')](_0xaccfb['query'][_0x5fa4('0x49')]));_0x460560[_0x5fa4('0x4a')]=_0x460560[_0x5fa4('0x4a')][_0x5fa4('0x4b')]?_0x460560[_0x5fa4('0x4a')]:_0x1b20bf[_0x5fa4('0x44')];if(_0xaccfb['query'][_0x5fa4('0x54')]){_0x460560[_0x5fa4('0x59')]=[{'all':!![]}];}_0x460560=_[_0x5fa4('0x51')]({},_0x460560,_0xaccfb[_0x5fa4('0x53')]);return db[_0x5fa4('0x40')]['find'](_0x460560)[_0x5fa4('0x25')](handleEntityNotFound(_0x2fd1c2,null))[_0x5fa4('0x25')](respondWithResult(_0x2fd1c2,null))[_0x5fa4('0x2e')](handleError(_0x2fd1c2,null));};exports[_0x5fa4('0x5a')]=function(_0x108ddc,_0x3ca1d3){return db[_0x5fa4('0x40')][_0x5fa4('0x5a')](_0x108ddc['body'],{})[_0x5fa4('0x25')](respondWithResult(_0x3ca1d3,0xc9))[_0x5fa4('0x2e')](handleError(_0x3ca1d3,null));};exports[_0x5fa4('0x5b')]=function(_0x18f6e6,_0x264246){if(_0x18f6e6[_0x5fa4('0x5c')]['id']){delete _0x18f6e6[_0x5fa4('0x5c')]['id'];}return db['WhatsappMessage'][_0x5fa4('0x5d')]({'where':{'id':_0x18f6e6[_0x5fa4('0x58')]['id']}})['then'](handleEntityNotFound(_0x264246,null))[_0x5fa4('0x25')](saveUpdates(_0x18f6e6[_0x5fa4('0x5c')],null))[_0x5fa4('0x25')](respondWithResult(_0x264246,null))[_0x5fa4('0x2e')](handleError(_0x264246,null));};exports[_0x5fa4('0x3b')]=function(_0x1e787e,_0x26f2a2){return db[_0x5fa4('0x40')][_0x5fa4('0x5d')]({'where':{'id':_0x1e787e[_0x5fa4('0x58')]['id']}})[_0x5fa4('0x25')](handleEntityNotFound(_0x26f2a2,null))[_0x5fa4('0x25')](removeEntity(_0x26f2a2,null))[_0x5fa4('0x2e')](handleError(_0x26f2a2,null));};exports[_0x5fa4('0x5e')]=function(_0x29e10b,_0x43be30){return db[_0x5fa4('0x40')]['describe']()['then'](respondWithResult(_0x43be30,null))['catch'](handleError(_0x43be30,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x5fa4('0x5f')]=function(_0x8b4b3b,_0x1eb3cd,_0x5b3304){var _0x4ff4a9={'agent':{},'channel':_0x5fa4('0x60')};if(_0x8b4b3b[_0x5fa4('0x5c')]['id']){delete _0x8b4b3b[_0x5fa4('0x5c')]['id'];}_0x8b4b3b[_0x5fa4('0x5c')][_0x5fa4('0x61')]=!![];_0x8b4b3b[_0x5fa4('0x5c')][_0x5fa4('0x62')]=moment()[_0x5fa4('0x63')](_0x5fa4('0x64'));_0x8b4b3b[_0x5fa4('0x5c')]['UserId']=_0x8b4b3b[_0x5fa4('0x5c')][_0x5fa4('0x65')]||_0x8b4b3b[_0x5fa4('0x66')]['id'];_0x4ff4a9[_0x5fa4('0x67')]['id']=_0x8b4b3b[_0x5fa4('0x5c')][_0x5fa4('0x65')];return db['WhatsappMessage'][_0x5fa4('0x5d')]({'where':{'id':_0x8b4b3b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1eb3cd,null))['then'](saveUpdates(_0x8b4b3b[_0x5fa4('0x5c')],null))['then'](function(_0x55bdc8){if(_0x55bdc8){_0x4ff4a9[_0x5fa4('0x2c')]=_0x55bdc8['get']({'plain':!![]});return db[_0x5fa4('0x68')][_0x5fa4('0x5d')]({'where':{'id':_0x55bdc8['WhatsappInteractionId']}});}return null;})[_0x5fa4('0x25')](handleEntityNotFound(_0x1eb3cd,null))[_0x5fa4('0x25')](function(_0x4ec43c){if(_0x4ec43c){return _0x4ec43c[_0x5fa4('0x5b')]({'UserId':_0x8b4b3b[_0x5fa4('0x5c')]['UserId'],'read1stAt':_[_0x5fa4('0x69')](_0x4ec43c[_0x5fa4('0x6a')])?moment()[_0x5fa4('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5fa4('0x25')](function(_0x5bd8e6){if(_0x5bd8e6){_0x4ff4a9[_0x5fa4('0x6b')]=_0x5bd8e6[_0x5fa4('0x6c')]({'plain':!![]});interaction_log[_0x5fa4('0x26')](_0x5fa4('0x6d'),_0x8b4b3b[_0x5fa4('0x66')]['id'],_0x8b4b3b[_0x5fa4('0x66')][_0x5fa4('0x3c')],_0x8b4b3b[_0x5fa4('0x66')][_0x5fa4('0x6e')],_0x4ff4a9[_0x5fa4('0x6b')]['id'],_0x8b4b3b[_0x5fa4('0x5c')]?JSON[_0x5fa4('0x6f')](_0x8b4b3b[_0x5fa4('0x5c')]):_0x5fa4('0x70'));return respondWithRpcPromise('AcceptMessage',_0x5fa4('0x71'),_0x4ff4a9);}return null;})[_0x5fa4('0x25')](function(_0x193721){var _0x53dff4=_0x5fa4('0x72')+_0x193721[_0x5fa4('0x2c')]['ContactId'];return db[_0x5fa4('0x73')][_0x5fa4('0x46')](_0x53dff4,{'type':db[_0x5fa4('0x74')][_0x5fa4('0x75')]['SELECT'],'raw':!![]})[_0x5fa4('0x25')](function(_0x1ec249){return _0x1ec249;});})['then'](function(_0x5b07ac){if(_0x5b07ac){_0x4ff4a9[_0x5fa4('0x2c')][_0x5fa4('0x76')]=_0x5b07ac[0x0];if(!_0x8b4b3b[_0x5fa4('0x5c')][_0x5fa4('0x65')])return;return db['User'][_0x5fa4('0x5d')]({'where':{'id':_0x8b4b3b[_0x5fa4('0x5c')][_0x5fa4('0x65')],'role':_0x5fa4('0x67')},'attributes':['id',_0x5fa4('0x3c'),_0x5fa4('0x77'),_0x5fa4('0x78'),_0x5fa4('0x79')],'raw':!![]});}return null;})[_0x5fa4('0x25')](function(_0x5f24a5){if(!_0x5f24a5)return null;_0x4ff4a9['message']['agent']=_0x5f24a5;return _0x4ff4a9;})[_0x5fa4('0x25')](function(_0x5d4c2f){if(_0x5d4c2f){if(_0x8b4b3b[_0x5fa4('0x5c')][_0x5fa4('0x7a')]){_0x4ff4a9[_0x5fa4('0x2c')]['interface']=util[_0x5fa4('0x63')](_0x5fa4('0x7b'),_0x8b4b3b[_0x5fa4('0x66')]['name']);_0x4ff4a9['message'][_0x5fa4('0x7c')]=_0x4ff4a9[_0x5fa4('0x7c')];_0x4ff4a9[_0x5fa4('0x2c')][_0x5fa4('0x7d')]=_0x4ff4a9['channel'];_0x4ff4a9['message'][_0x5fa4('0x7e')]=_0x5fa4('0x5f');return respondWithRpcPromise(_0x5fa4('0x7f'),_0x5fa4('0x7f'),{'event':_0x5fa4('0x80'),'message':_0x4ff4a9[_0x5fa4('0x2c')]},client9002)[_0x5fa4('0x25')](function(){return _0x4ff4a9;});}return _0x4ff4a9;}return null;})[_0x5fa4('0x25')](respondWithResult(_0x1eb3cd,null))[_0x5fa4('0x2e')](handleError(_0x1eb3cd,null));};var interaction_log=require(_0x5fa4('0x17'))(_0x5fa4('0x81'));exports[_0x5fa4('0x39')]=function(_0x24f9de,_0x4bc55d,_0x316b29){var _0x3b71c1={'agent':{},'channel':'whatsapp'};if(_0x24f9de[_0x5fa4('0x5c')]['id']){delete _0x24f9de[_0x5fa4('0x5c')]['id'];}_0x24f9de[_0x5fa4('0x5c')]['UserId']=_0x24f9de['body'][_0x5fa4('0x65')]||_0x24f9de[_0x5fa4('0x66')]['id'];_0x3b71c1['agent']['id']=_0x24f9de[_0x5fa4('0x5c')][_0x5fa4('0x65')];return db['WhatsappMessage'][_0x5fa4('0x5d')]({'where':{'id':_0x24f9de['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4bc55d,null))[_0x5fa4('0x25')](function(_0x3cbe6b){if(_0x3cbe6b){_0x3b71c1['message']=_0x3cbe6b['get']({'plain':!![]});return db[_0x5fa4('0x68')][_0x5fa4('0x5d')]({'where':{'id':_0x3cbe6b[_0x5fa4('0x82')]}});}return null;})[_0x5fa4('0x25')](handleEntityNotFound(_0x4bc55d,null))[_0x5fa4('0x25')](function(_0x497bad){if(_0x497bad){_0x3b71c1[_0x5fa4('0x6b')]=_0x497bad['get']({'plain':!![]});interaction_log[_0x5fa4('0x26')](_0x5fa4('0x83'),_0x24f9de[_0x5fa4('0x66')]['id'],_0x24f9de[_0x5fa4('0x66')][_0x5fa4('0x3c')],_0x24f9de[_0x5fa4('0x66')][_0x5fa4('0x6e')],_0x3b71c1[_0x5fa4('0x6b')]['id'],_0x24f9de[_0x5fa4('0x5c')]?JSON[_0x5fa4('0x6f')](_0x24f9de[_0x5fa4('0x5c')]):_0x5fa4('0x70'));return respondWithRpcPromise(_0x5fa4('0x84'),'rejectMessage',_0x3b71c1);}return null;})[_0x5fa4('0x25')](function(_0x23086b){var _0x5edbf9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x23086b['message'][_0x5fa4('0x85')];return db['sequelize'][_0x5fa4('0x46')](_0x5edbf9,{'type':db[_0x5fa4('0x74')][_0x5fa4('0x75')][_0x5fa4('0x86')],'raw':!![]})[_0x5fa4('0x25')](function(_0x2b296d){return _0x2b296d;});})[_0x5fa4('0x25')](function(_0x569a6d){if(_0x569a6d){_0x3b71c1[_0x5fa4('0x2c')][_0x5fa4('0x76')]=_0x569a6d[0x0];if(!_0x24f9de[_0x5fa4('0x5c')]['UserId'])return;return db['User'][_0x5fa4('0x5d')]({'where':{'id':_0x24f9de[_0x5fa4('0x5c')][_0x5fa4('0x65')],'role':'agent'},'attributes':['id',_0x5fa4('0x3c'),'fullname',_0x5fa4('0x78'),'internal'],'raw':!![]});}return null;})[_0x5fa4('0x25')](function(_0x5973ac){if(!_0x5973ac)return null;_0x3b71c1['message'][_0x5fa4('0x67')]=_0x5973ac;return _0x3b71c1;})[_0x5fa4('0x25')](function(_0x377589){if(_0x377589){_0x377589[_0x5fa4('0x2c')][_0x5fa4('0x87')]=util['format'](_0x5fa4('0x7b'),_0x24f9de[_0x5fa4('0x66')][_0x5fa4('0x3c')]);_0x377589['message'][_0x5fa4('0x7c')]=_0x3b71c1['channel'];_0x377589[_0x5fa4('0x2c')][_0x5fa4('0x7d')]=_0x3b71c1[_0x5fa4('0x7c')];_0x377589[_0x5fa4('0x2c')]['event']=_0x5fa4('0x39');respondWithRpcPromise(_0x5fa4('0x7f'),_0x5fa4('0x7f'),{'event':_0x5fa4('0x88'),'message':_0x377589[_0x5fa4('0x2c')]},client9002);return _0x3b71c1;}return null;})['then'](respondWithResult(_0x4bc55d,null))[_0x5fa4('0x2e')](handleError(_0x4bc55d,null));};exports[_0x5fa4('0x30')]=function(_0x4735ec,_0x2e1c36,_0x61334d){if(_0x4735ec[_0x5fa4('0x5c')]['id']){delete _0x4735ec['body']['id'];}var _0x1b9e80;return db[_0x5fa4('0x40')][_0x5fa4('0x5d')]({'where':{'id':_0x4735ec[_0x5fa4('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e1c36,null))[_0x5fa4('0x25')](function(_0x30cb17){if(_0x30cb17){_0x1b9e80=_0x30cb17;return db[_0x5fa4('0x89')][_0x5fa4('0x5d')]({'where':{'id':_0x30cb17[_0x5fa4('0x8a')]}});}})[_0x5fa4('0x25')](handleEntityNotFound(_0x2e1c36,null))[_0x5fa4('0x25')](function(_0xbbd5a8){if(_0xbbd5a8){logger['debug'](_0x5fa4('0x8b'),_0x5fa4('0x30'),'received\x20delivery\x20report\x20from',_0xbbd5a8[_0x5fa4('0x42')],util['inspect'](_0x4735ec[_0x5fa4('0x5c')],{'showHidden':![],'depth':null}));switch(_0xbbd5a8['type']){case'twilio':if(_0x4735ec[_0x5fa4('0x5c')][_0x5fa4('0x8c')]&&_0x4735ec['body'][_0x5fa4('0x8c')]===_0x1b9e80[_0x5fa4('0x8d')]&&_0x4735ec[_0x5fa4('0x5c')][_0x5fa4('0x8e')]&&_0x4735ec['body'][_0x5fa4('0x8e')]===_0x5fa4('0x61')){return _0x1b9e80['update']({'read':!![]});}else{logger[_0x5fa4('0x2b')](_0x5fa4('0x8f'),_0x5fa4('0x30'),_0x5fa4('0x90'),util[_0x5fa4('0x91')](_0x4735ec[_0x5fa4('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1b9e80;}})['then'](respondWithResult(_0x2e1c36,null))[_0x5fa4('0x2e')](handleError(_0x2e1c36,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b146e7a..a7041f1 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 _0x7d98=['events','WhatsappMessage','setMaxListeners','save','update','hook','exports'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x7d98,0xe7));var _0x87d9=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x7d98[_0x10c16d];return _0x5896f4;};'use strict';var EventEmitter=require(_0x87d9('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x87d9('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x87d9('0x2')](0x0);var events={'afterCreate':_0x87d9('0x3'),'afterUpdate':_0x87d9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x417ed2){return function(_0x317ba8,_0x4b4f58,_0x127fa8){WhatsappMessageEvents['emit'](_0x417ed2+':'+_0x317ba8['id'],_0x317ba8);WhatsappMessageEvents['emit'](_0x417ed2,_0x317ba8);_0x127fa8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x87d9('0x5')](e,emitEvent(event));}}module[_0x87d9('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8cc8=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x1d16c0,_0x5c30b4){var _0xb017b3=function(_0x59a2b8){while(--_0x59a2b8){_0x1d16c0['push'](_0x1d16c0['shift']());}};_0xb017b3(++_0x5c30b4);}(_0x8cc8,0x177));var _0x88cc=function(_0x28d872,_0x265276){_0x28d872=_0x28d872-0x0;var _0x36308a=_0x8cc8[_0x28d872];return _0x36308a;};'use strict';var EventEmitter=require(_0x88cc('0x0'));var WhatsappMessage=require(_0x88cc('0x1'))['db'][_0x88cc('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x88cc('0x3')](0x0);var events={'afterCreate':_0x88cc('0x4'),'afterUpdate':_0x88cc('0x5'),'afterDestroy':_0x88cc('0x6')};function emitEvent(_0x41ec3a){return function(_0x407cb0,_0xce4dc7,_0x1c943a){WhatsappMessageEvents[_0x88cc('0x7')](_0x41ec3a+':'+_0x407cb0['id'],_0x407cb0);WhatsappMessageEvents[_0x88cc('0x7')](_0x41ec3a,_0x407cb0);_0x1c943a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x88cc('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index f346e26..c6ca399 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 _0x1ae0=['WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','createdAt','catch','error','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','update','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define'];(function(_0x386b14,_0x21536e){var _0x20c7ae=function(_0x20ca47){while(--_0x20ca47){_0x386b14['push'](_0x386b14['shift']());}};_0x20c7ae(++_0x21536e);}(_0x1ae0,0xa5));var _0x01ae=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0x1ae0[_0x463376];return _0x336ccd;};'use strict';var _=require(_0x01ae('0x0'));var util=require(_0x01ae('0x1'));var logger=require(_0x01ae('0x2'))('api');var moment=require(_0x01ae('0x3'));var BPromise=require(_0x01ae('0x4'));var rp=require(_0x01ae('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x01ae('0x6'));var rimraf=require(_0x01ae('0x7'));var config=require(_0x01ae('0x8'));var attributes=require(_0x01ae('0x9'));module[_0x01ae('0xa')]=function(_0x1af047,_0x5afb59){return _0x1af047[_0x01ae('0xb')](_0x01ae('0xc'),attributes,{'tableName':_0x01ae('0xd'),'paranoid':![],'indexes':[{'name':_0x01ae('0xe'),'fields':[_0x01ae('0xe')]},{'name':_0x01ae('0xf'),'fields':[_0x01ae('0x10')],'type':_0x01ae('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e7f1c,_0x338f26,_0x48b601){var _0x4775b8=_0x1af047[_0x01ae('0x12')];var _0x2a9048=_0x1e7f1c[_0x01ae('0x13')]({'plain':!![]});if(_0x2a9048[_0x01ae('0x14')][_0x01ae('0x15')]()==='in'||_0x2a9048[_0x01ae('0x14')][_0x01ae('0x15')]()===_0x01ae('0x16')&&!_0x2a9048[_0x01ae('0x17')]&&!_[_0x01ae('0x18')](_0x2a9048[_0x01ae('0x19')])){_0x4775b8[_0x01ae('0x1a')]['findOne']({'where':{'id':_0x2a9048['WhatsappInteractionId']}})[_0x01ae('0x1b')](function(_0x4f5e35){if(_0x4f5e35){_0x4f5e35['update']({'lastMsgAt':_0x2a9048[_0x01ae('0x1c')],'lastMsgDirection':_0x2a9048['direction'][_0x01ae('0x15')]()});}})[_0x01ae('0x1d')](function(_0x6ae657){console[_0x01ae('0x1e')](_0x6ae657);});}if(_0x2a9048[_0x01ae('0x14')]===_0x01ae('0x16')&&!_0x2a9048[_0x01ae('0x17')]){var _0x5c17b0;_0x4775b8['WhatsappAccount']['find']({'where':{'id':_0x2a9048[_0x01ae('0x1f')]},'raw':!![]})[_0x01ae('0x1b')](function(_0x5ddcbc){_0x5c17b0=_0x5ddcbc;if(_0x5c17b0&&_0x5c17b0[_0x01ae('0x20')]){switch(_0x5c17b0['type']){case _0x01ae('0x21'):var _0x3b9a5c=require('twilio');if(_0x5c17b0[_0x01ae('0x22')]&&_0x5c17b0[_0x01ae('0x23')]&&_0x5c17b0['phone']){var _0x2a8140=new _0x3b9a5c(_0x5c17b0[_0x01ae('0x22')],_0x5c17b0[_0x01ae('0x23')]);_0x2a8140[_0x01ae('0x24')][_0x01ae('0x25')]({'body':_0x2a9048['body'],'to':_0x01ae('0x26')+_0x2a9048[_0x01ae('0x27')],'from':_0x01ae('0x26')+_0x5c17b0['phone'],'statusCallback':_0x5c17b0['remote']+_0x01ae('0x28')+_0x2a9048['id']+_0x01ae('0x29')+_0x5c17b0[_0x01ae('0x2a')]})[_0x01ae('0x1b')](function(_0x1ffe3b){if(_0x1ffe3b[_0x01ae('0x2b')]){return _0x1e7f1c['update']({'messageId':_0x1ffe3b[_0x01ae('0x2b')]});}})['catch'](function(_0x5ac126){logger[_0x01ae('0x1e')](_0x01ae('0x2c'),_0x01ae('0x2d'),_0x01ae('0x21'),util[_0x01ae('0x2e')](_0x5ac126,{'showHidden':![],'depth':null}));});}else{logger[_0x01ae('0x1e')](_0x01ae('0x2c'),_0x01ae('0x2d'),'twilio',_0x01ae('0x2f'));}break;case'sinch':var _0xf183ef=_0x5c17b0[_0x01ae('0x22')];var _0x445ce7=_0x5c17b0[_0x01ae('0x23')];var _0xc30791=_0x5c17b0[_0x01ae('0x30')]+_0x01ae('0x31')+_0xf183ef+_0x01ae('0x32');var _0x28b447={'to':[_0x2a9048[_0x01ae('0x27')]],'message':{'type':_0x01ae('0x33'),'text':_0x2a9048['body']}};var _0x4c2f9a={'method':'POST','uri':_0xc30791,'headers':{'Authorization':_0x01ae('0x34')+_0x445ce7,'Content-Type':_0x01ae('0x35')},'body':_0x28b447,'json':!![]};rp(_0x4c2f9a)[_0x01ae('0x1b')](function(_0x5a713d){if(_0x5a713d['statuses'][0x0]['message_id']){return _0x1e7f1c[_0x01ae('0x36')]({'messageId':_0x5a713d[_0x01ae('0x37')][0x0][_0x01ae('0x38')]});}})[_0x01ae('0x1d')](function(_0x2f09c2){logger['err'](_0x01ae('0x39'),_0x2f09c2);});break;}}})['finally'](function(){_0x48b601();});}else{_0x48b601();}}},'charset':'utf8mb4','collate':_0x01ae('0x3a')});}; \ No newline at end of file +var _0x78ef=['token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','secret','then','update','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','messages','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token='];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x78ef,0x162));var _0xf78e=function(_0x558a16,_0x1e2a50){_0x558a16=_0x558a16-0x0;var _0x309879=_0x78ef[_0x558a16];return _0x309879;};'use strict';var _=require('lodash');var util=require(_0xf78e('0x0'));var logger=require('../../config/logger')(_0xf78e('0x1'));var moment=require(_0xf78e('0x2'));var BPromise=require('bluebird');var rp=require(_0xf78e('0x3'));var fetch=require(_0xf78e('0x4'));var fs=require('fs');var path=require(_0xf78e('0x5'));var rimraf=require(_0xf78e('0x6'));var config=require(_0xf78e('0x7'));var attributes=require(_0xf78e('0x8'));module[_0xf78e('0x9')]=function(_0x426ef2,_0x3125a5){return _0x426ef2[_0xf78e('0xa')](_0xf78e('0xb'),attributes,{'tableName':_0xf78e('0xc'),'paranoid':![],'indexes':[{'name':_0xf78e('0xd'),'fields':['messageId']},{'name':_0xf78e('0xe'),'fields':['body'],'type':_0xf78e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1febaf,_0x2b7350,_0xebe517){var _0x480991=_0x426ef2['models'];var _0x546bd4=_0x1febaf[_0xf78e('0x10')]({'plain':!![]});if(_0x546bd4[_0xf78e('0x11')][_0xf78e('0x12')]()==='in'||_0x546bd4[_0xf78e('0x11')][_0xf78e('0x12')]()===_0xf78e('0x13')&&!_0x546bd4[_0xf78e('0x14')]&&!_['isNil'](_0x546bd4['UserId'])){_0x480991['WhatsappInteraction']['findOne']({'where':{'id':_0x546bd4['WhatsappInteractionId']}})[_0xf78e('0x15')](function(_0x465eea){if(_0x465eea){_0x465eea[_0xf78e('0x16')]({'lastMsgAt':_0x546bd4['createdAt'],'lastMsgDirection':_0x546bd4[_0xf78e('0x11')]['toLowerCase']()});}})[_0xf78e('0x17')](function(_0x46d708){console[_0xf78e('0x18')](_0x46d708);});}if(_0x546bd4['direction']===_0xf78e('0x13')&&!_0x546bd4[_0xf78e('0x14')]){var _0x2adfae;_0x480991[_0xf78e('0x19')][_0xf78e('0x1a')]({'where':{'id':_0x546bd4['WhatsappAccountId']},'raw':!![]})[_0xf78e('0x15')](function(_0x3c296a){_0x2adfae=_0x3c296a;if(_0x2adfae&&_0x2adfae[_0xf78e('0x1b')]){switch(_0x2adfae['type']){case _0xf78e('0x1c'):var _0x9aa9c5=require('twilio');if(_0x2adfae[_0xf78e('0x1d')]&&_0x2adfae[_0xf78e('0x1e')]&&_0x2adfae['phone']){var _0x3fac06=new _0x9aa9c5(_0x2adfae['accountSid'],_0x2adfae[_0xf78e('0x1e')]);_0x3fac06[_0xf78e('0x1f')]['create']({'body':_0x546bd4[_0xf78e('0x20')],'to':_0xf78e('0x21')+_0x546bd4[_0xf78e('0x22')],'from':_0xf78e('0x21')+_0x2adfae['phone'],'statusCallback':_0x2adfae[_0xf78e('0x23')]+_0xf78e('0x24')+_0x546bd4['id']+_0xf78e('0x25')+_0x2adfae[_0xf78e('0x26')]})[_0xf78e('0x15')](function(_0x5275bd){if(_0x5275bd[_0xf78e('0x27')]){return _0x1febaf[_0xf78e('0x16')]({'messageId':_0x5275bd[_0xf78e('0x27')]});}})['catch'](function(_0x29a8a6){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf78e('0x28'),'twilio',util[_0xf78e('0x29')](_0x29a8a6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf78e('0x2a'),_0xf78e('0x28'),_0xf78e('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xf78e('0x2b'):var _0x41bc44=_0x2adfae[_0xf78e('0x1d')];var _0x47e4c9=_0x2adfae['authToken'];var _0x37e4de=_0x2adfae['baseUrl']+_0xf78e('0x2c')+_0x41bc44+_0xf78e('0x2d');var _0x35a030={'to':[_0x546bd4[_0xf78e('0x22')]],'message':{'type':_0xf78e('0x2e'),'text':_0x546bd4['body']}};var _0x4f20f1={'method':_0xf78e('0x2f'),'uri':_0x37e4de,'headers':{'Authorization':_0xf78e('0x30')+_0x47e4c9,'Content-Type':_0xf78e('0x31')},'body':_0x35a030,'json':!![]};rp(_0x4f20f1)[_0xf78e('0x15')](function(_0x31df61){if(_0x31df61[_0xf78e('0x32')][0x0]['message_id']){return _0x1febaf[_0xf78e('0x16')]({'messageId':_0x31df61['statuses'][0x0][_0xf78e('0x33')]});}})['catch'](function(_0x5617ca){logger['err'](_0xf78e('0x34'),_0x5617ca);});break;}}})[_0xf78e('0x35')](function(){_0xebe517();});}else{_0xebe517();}}},'charset':_0xf78e('0x36'),'collate':_0xf78e('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 8efe020..5f51537 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 _0x9093=['code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','info','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5348bd,_0x5f2f35){var _0x7165dc=function(_0x243a77){while(--_0x243a77){_0x5348bd['push'](_0x5348bd['shift']());}};_0x7165dc(++_0x5f2f35);}(_0x9093,0x1bc));var _0x3909=function(_0x2c500f,_0x428d0f){_0x2c500f=_0x2c500f-0x0;var _0x30ebf1=_0x9093[_0x2c500f];return _0x30ebf1;};'use strict';var _=require(_0x3909('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3909('0x1'));var rs=require(_0x3909('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3909('0x3'))['db'];var utils=require(_0x3909('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3909('0x5'));var jayson=require(_0x3909('0x6'));var client=jayson[_0x3909('0x7')][_0x3909('0x8')]({'port':0x232a});config['redis']=_[_0x3909('0x9')](config[_0x3909('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3909('0xb'))(new Redis(config[_0x3909('0xa')]));require(_0x3909('0xc'))[_0x3909('0xd')](socket);function respondWithRpcPromise(_0x1ecd2a,_0x533d5e,_0x417fba){return new BPromise(function(_0x3579b4,_0x19c09e){return client['request'](_0x1ecd2a,_0x417fba)[_0x3909('0xe')](function(_0x109416){logger['info'](_0x3909('0xf'),_0x533d5e,_0x3909('0x10'));logger[_0x3909('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x533d5e,_0x3909('0x10'),JSON[_0x3909('0x12')](_0x109416));if(_0x109416[_0x3909('0x13')]){if(_0x109416[_0x3909('0x13')][_0x3909('0x14')]===0x1f4){logger[_0x3909('0x13')](_0x3909('0xf'),_0x533d5e,_0x109416[_0x3909('0x13')][_0x3909('0x15')]);return _0x19c09e(_0x109416[_0x3909('0x13')][_0x3909('0x15')]);}logger[_0x3909('0x13')](_0x3909('0xf'),_0x533d5e,_0x109416['error'][_0x3909('0x15')]);return _0x3579b4(_0x109416[_0x3909('0x13')][_0x3909('0x15')]);}else{logger['info'](_0x3909('0xf'),_0x533d5e,_0x3909('0x10'));_0x3579b4(_0x109416['result']['message']);}})[_0x3909('0x16')](function(_0x33f70c){logger[_0x3909('0x13')](_0x3909('0xf'),_0x533d5e,_0x33f70c);_0x19c09e(_0x33f70c);});});}exports[_0x3909('0x17')]=function(_0x47c29a){var _0x835a3e=this;return new Promise(function(_0x40229d,_0x9c0967){return db[_0x3909('0x18')][_0x3909('0x19')](_0x47c29a['body'],{'raw':_0x47c29a[_0x3909('0x1a')]?_0x47c29a[_0x3909('0x1a')][_0x3909('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3b20d4){logger[_0x3909('0x1c')](_0x3909('0x17'),_0x47c29a);logger[_0x3909('0x11')](_0x3909('0x17'),_0x47c29a,JSON['stringify'](_0x3b20d4));_0x40229d(_0x3b20d4);})[_0x3909('0x16')](function(_0x46d424){logger[_0x3909('0x13')](_0x3909('0x17'),_0x46d424['message'],_0x47c29a);_0x9c0967(_0x835a3e[_0x3909('0x13')](0x1f4,_0x46d424[_0x3909('0x15')]));});});}; \ No newline at end of file +var _0x3c38=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x1743a1,_0x3c6bfd){var _0x351412=function(_0x14636b){while(--_0x14636b){_0x1743a1['push'](_0x1743a1['shift']());}};_0x351412(++_0x3c6bfd);}(_0x3c38,0xde));var _0x83c3=function(_0x2a5c3f,_0x2f45e0){_0x2a5c3f=_0x2a5c3f-0x0;var _0x473cbe=_0x3c38[_0x2a5c3f];return _0x473cbe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83c3('0x0'));var BPromise=require(_0x83c3('0x1'));var rs=require(_0x83c3('0x2'));var fs=require('fs');var Redis=require(_0x83c3('0x3'));var db=require(_0x83c3('0x4'))['db'];var utils=require(_0x83c3('0x5'));var logger=require(_0x83c3('0x6'))(_0x83c3('0x7'));var config=require(_0x83c3('0x8'));var jayson=require(_0x83c3('0x9'));var client=jayson[_0x83c3('0xa')]['http']({'port':0x232a});config[_0x83c3('0xb')]=_[_0x83c3('0xc')](config[_0x83c3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x83c3('0xd'))(new Redis(config['redis']));require(_0x83c3('0xe'))[_0x83c3('0xf')](socket);function respondWithRpcPromise(_0x4a6c78,_0x5047b4,_0x4c1338){return new BPromise(function(_0x249e2f,_0x57432a){return client['request'](_0x4a6c78,_0x4c1338)[_0x83c3('0x10')](function(_0x24418a){logger[_0x83c3('0x11')](_0x83c3('0x12'),_0x5047b4,_0x83c3('0x13'));logger[_0x83c3('0x14')](_0x83c3('0x15'),_0x5047b4,_0x83c3('0x13'),JSON[_0x83c3('0x16')](_0x24418a));if(_0x24418a['error']){if(_0x24418a[_0x83c3('0x17')][_0x83c3('0x18')]===0x1f4){logger[_0x83c3('0x17')](_0x83c3('0x12'),_0x5047b4,_0x24418a[_0x83c3('0x17')][_0x83c3('0x19')]);return _0x57432a(_0x24418a['error'][_0x83c3('0x19')]);}logger[_0x83c3('0x17')](_0x83c3('0x12'),_0x5047b4,_0x24418a[_0x83c3('0x17')][_0x83c3('0x19')]);return _0x249e2f(_0x24418a[_0x83c3('0x17')][_0x83c3('0x19')]);}else{logger[_0x83c3('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x5047b4,_0x83c3('0x13'));_0x249e2f(_0x24418a[_0x83c3('0x1a')][_0x83c3('0x19')]);}})[_0x83c3('0x1b')](function(_0x8ec27b){logger['error'](_0x83c3('0x12'),_0x5047b4,_0x8ec27b);_0x57432a(_0x8ec27b);});});}exports[_0x83c3('0x1c')]=function(_0xd55e85){var _0x5c9fa7=this;return new Promise(function(_0x1db181,_0x558b5e){return db[_0x83c3('0x1d')][_0x83c3('0x1e')](_0xd55e85[_0x83c3('0x1f')],{'raw':_0xd55e85[_0x83c3('0x20')]?_0xd55e85[_0x83c3('0x20')][_0x83c3('0x21')]===undefined?!![]:![]:!![]})[_0x83c3('0x10')](function(_0x2b11b7){logger[_0x83c3('0x11')](_0x83c3('0x1c'),_0xd55e85);logger[_0x83c3('0x14')](_0x83c3('0x1c'),_0xd55e85,JSON['stringify'](_0x2b11b7));_0x1db181(_0x2b11b7);})[_0x83c3('0x1b')](function(_0x3da724){logger[_0x83c3('0x17')]('CreateWhatsappMessage',_0x3da724['message'],_0xd55e85);_0x558b5e(_0x5c9fa7[_0x83c3('0x17')](0x1f4,_0x3da724['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f324f12..2ee46cf 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 _0xe281=['emit','removeListener','register','length','whatsappMessage:','save','remove'];(function(_0x1078be,_0x15a887){var _0x35e0fd=function(_0x246c34){while(--_0x246c34){_0x1078be['push'](_0x1078be['shift']());}};_0x35e0fd(++_0x15a887);}(_0xe281,0x18d));var _0x1e28=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe281[_0x3b380d];return _0x54502b;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x1e28('0x0'),_0x1e28('0x1'),'update'];function createListener(_0x39ec94,_0xdf75df){return function(_0x4c4d67){_0xdf75df[_0x1e28('0x2')](_0x39ec94,_0x4c4d67);};}function removeListener(_0x5b8b47,_0x2a8fe7){return function(){WhatsappMessageEvents[_0x1e28('0x3')](_0x5b8b47,_0x2a8fe7);};}exports[_0x1e28('0x4')]=function(_0x2232f1){for(var _0x4d66e2=0x0,_0x1d54e7=events[_0x1e28('0x5')];_0x4d66e2<_0x1d54e7;_0x4d66e2++){var _0x3f3754=events[_0x4d66e2];var _0x4871f8=createListener(_0x1e28('0x6')+_0x3f3754,_0x2232f1);WhatsappMessageEvents['on'](_0x3f3754,_0x4871f8);}}; \ No newline at end of file +var _0x7015=['update','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x7015,0xbd));var _0x5701=function(_0x32cbc1,_0x82e161){_0x32cbc1=_0x32cbc1-0x0;var _0x202342=_0x7015[_0x32cbc1];return _0x202342;};'use strict';var WhatsappMessageEvents=require(_0x5701('0x0'));var events=[_0x5701('0x1'),_0x5701('0x2'),_0x5701('0x3')];function createListener(_0x525f9c,_0x302d22){return function(_0x80743f){_0x302d22[_0x5701('0x4')](_0x525f9c,_0x80743f);};}function removeListener(_0x3f62e7,_0x299a3b){return function(){WhatsappMessageEvents[_0x5701('0x5')](_0x3f62e7,_0x299a3b);};}exports['register']=function(_0x476d9e){for(var _0x55fafa=0x0,_0x494bcb=events[_0x5701('0x6')];_0x55fafa<_0x494bcb;_0x55fafa++){var _0x224907=events[_0x55fafa];var _0x3945c3=createListener(_0x5701('0x7')+_0x224907,_0x476d9e);WhatsappMessageEvents['on'](_0x224907,_0x3945c3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 388df23..71fa9f3 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 _0x75f4=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','update','delete','destroy'];(function(_0x27f889,_0x50cd8c){var _0x39a19d=function(_0x4fe261){while(--_0x4fe261){_0x27f889['push'](_0x27f889['shift']());}};_0x39a19d(++_0x50cd8c);}(_0x75f4,0xc3));var _0x475f=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x75f4[_0x4bfe08];return _0x1f9125;};'use strict';var multer=require(_0x475f('0x0'));var util=require(_0x475f('0x1'));var path=require(_0x475f('0x2'));var timeout=require(_0x475f('0x3'));var express=require(_0x475f('0x4'));var router=express[_0x475f('0x5')]();var fs_extra=require(_0x475f('0x6'));var auth=require(_0x475f('0x7'));var interaction=require(_0x475f('0x8'));var config=require(_0x475f('0x9'));var controller=require(_0x475f('0xa'));router[_0x475f('0xb')]('/',auth[_0x475f('0xc')](),controller[_0x475f('0xd')]);router['get'](_0x475f('0xe'),auth[_0x475f('0xc')](),controller[_0x475f('0xf')]);router[_0x475f('0xb')](_0x475f('0x10'),auth[_0x475f('0xc')](),controller['show']);router[_0x475f('0xb')]('/:id/members',auth[_0x475f('0xc')](),controller[_0x475f('0x11')]);router[_0x475f('0xb')](_0x475f('0x12'),auth[_0x475f('0xc')](),controller[_0x475f('0x13')]);router[_0x475f('0xb')](_0x475f('0x14'),auth[_0x475f('0xc')](),controller['getAgents']);router['post']('/',auth[_0x475f('0xc')](),controller[_0x475f('0x15')]);router[_0x475f('0x16')]('/:id/teams',auth[_0x475f('0xc')](),controller[_0x475f('0x17')]);router[_0x475f('0x16')]('/:id/users',auth[_0x475f('0xc')](),controller[_0x475f('0x18')]);router[_0x475f('0x19')](_0x475f('0x10'),auth[_0x475f('0xc')](),controller[_0x475f('0x1a')]);router[_0x475f('0x1b')](_0x475f('0x10'),auth[_0x475f('0xc')](),controller[_0x475f('0x1c')]);router[_0x475f('0x1b')](_0x475f('0x12'),auth[_0x475f('0xc')](),controller[_0x475f('0x1d')]);router[_0x475f('0x1b')]('/:id/users',auth[_0x475f('0xc')](),controller[_0x475f('0x1e')]);module[_0x475f('0x1f')]=router; \ No newline at end of file +var _0xf01b=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/describe','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents'];(function(_0xd3d5c3,_0x42d2af){var _0x29a808=function(_0x208512){while(--_0x208512){_0xd3d5c3['push'](_0xd3d5c3['shift']());}};_0x29a808(++_0x42d2af);}(_0xf01b,0xb5));var _0xbf01=function(_0x3a43fc,_0x248108){_0x3a43fc=_0x3a43fc-0x0;var _0x5d332f=_0xf01b[_0x3a43fc];return _0x5d332f;};'use strict';var multer=require(_0xbf01('0x0'));var util=require(_0xbf01('0x1'));var path=require('path');var timeout=require(_0xbf01('0x2'));var express=require(_0xbf01('0x3'));var router=express[_0xbf01('0x4')]();var fs_extra=require(_0xbf01('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf01('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xbf01('0x7')]('/',auth['isAuthenticated'](),controller[_0xbf01('0x8')]);router['get'](_0xbf01('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbf01('0xa'),auth[_0xbf01('0xb')](),controller[_0xbf01('0xc')]);router[_0xbf01('0x7')](_0xbf01('0xd'),auth[_0xbf01('0xb')](),controller[_0xbf01('0xe')]);router[_0xbf01('0x7')]('/:id/teams',auth[_0xbf01('0xb')](),controller[_0xbf01('0xf')]);router[_0xbf01('0x7')](_0xbf01('0x10'),auth[_0xbf01('0xb')](),controller[_0xbf01('0x11')]);router[_0xbf01('0x12')]('/',auth[_0xbf01('0xb')](),controller[_0xbf01('0x13')]);router[_0xbf01('0x12')](_0xbf01('0x14'),auth[_0xbf01('0xb')](),controller[_0xbf01('0x15')]);router['post'](_0xbf01('0x10'),auth['isAuthenticated'](),controller[_0xbf01('0x16')]);router[_0xbf01('0x17')](_0xbf01('0xa'),auth[_0xbf01('0xb')](),controller[_0xbf01('0x18')]);router[_0xbf01('0x19')](_0xbf01('0xa'),auth[_0xbf01('0xb')](),controller[_0xbf01('0x1a')]);router['delete'](_0xbf01('0x14'),auth[_0xbf01('0xb')](),controller[_0xbf01('0x1b')]);router[_0xbf01('0x19')](_0xbf01('0x10'),auth['isAuthenticated'](),controller[_0xbf01('0x1c')]);module[_0xbf01('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index daa43c4..99a0e5c 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 _0xb377=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x13ff4f,_0x4defc2){var _0xd04dee=function(_0x516beb){while(--_0x516beb){_0x13ff4f['push'](_0x13ff4f['shift']());}};_0xd04dee(++_0x4defc2);}(_0xb377,0x1b6));var _0x7b37=function(_0x111df5,_0x8c6d5){_0x111df5=_0x111df5-0x0;var _0x30ed4a=_0xb377[_0x111df5];return _0x30ed4a;};'use strict';var Sequelize=require(_0x7b37('0x0'));module[_0x7b37('0x1')]={'name':{'type':Sequelize[_0x7b37('0x2')],'unique':_0x7b37('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7b37('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b37('0x5')](_0x7b37('0x6'),_0x7b37('0x7'),_0x7b37('0x8'))},'description':{'type':Sequelize[_0x7b37('0x2')]}}; \ No newline at end of file +var _0x9993=['roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x5da696,_0x328c94){var _0x2419a6=function(_0x1f4cee){while(--_0x1f4cee){_0x5da696['push'](_0x5da696['shift']());}};_0x2419a6(++_0x328c94);}(_0x9993,0x109));var _0x3999=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9993[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x3999('0x0'));module['exports']={'name':{'type':Sequelize[_0x3999('0x1')],'unique':_0x3999('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3999('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3999('0x4'),'beepall',_0x3999('0x5'))},'description':{'type':Sequelize[_0x3999('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8417854..7d5dac7 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 _0xd85f=['then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','pick','WhatsappQueueId','UserWhatsappQueue','findAndCountAll','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd85f,0x180));var _0xfd85=function(_0xf7dc8a,_0x45d8a2){_0xf7dc8a=_0xf7dc8a-0x0;var _0x426573=_0xd85f[_0xf7dc8a];return _0x426573;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd85('0x0'));var zipdir=require(_0xfd85('0x1'));var jsonpatch=require(_0xfd85('0x2'));var rp=require(_0xfd85('0x3'));var moment=require(_0xfd85('0x4'));var BPromise=require(_0xfd85('0x5'));var Mustache=require('mustache');var util=require(_0xfd85('0x6'));var path=require(_0xfd85('0x7'));var sox=require('sox');var csv=require(_0xfd85('0x8'));var ejs=require(_0xfd85('0x9'));var fs=require('fs');var fs_extra=require(_0xfd85('0xa'));var _=require(_0xfd85('0xb'));var squel=require(_0xfd85('0xc'));var crypto=require(_0xfd85('0xd'));var jsforce=require(_0xfd85('0xe'));var deskjs=require(_0xfd85('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfd85('0x10'));var Papa=require(_0xfd85('0x11'));var Redis=require(_0xfd85('0x12'));var authService=require(_0xfd85('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfd85('0x14'));var hardwareService=require(_0xfd85('0x15'));var logger=require('../../config/logger')(_0xfd85('0x16'));var utils=require('../../config/utils');var config=require(_0xfd85('0x17'));var licenseUtil=require(_0xfd85('0x18'));var db=require(_0xfd85('0x19'))['db'];config[_0xfd85('0x1a')]=_[_0xfd85('0x1b')](config[_0xfd85('0x1a')],{'host':_0xfd85('0x1c'),'port':0x18eb});var socket=require(_0xfd85('0x1d'))(new Redis(config[_0xfd85('0x1a')]));require(_0xfd85('0x1e'))[_0xfd85('0x1f')](socket);function respondWithStatusCode(_0x21fb69,_0x1010b5){_0x1010b5=_0x1010b5||0xcc;return function(_0x4c530b){if(_0x4c530b){return _0x21fb69[_0xfd85('0x20')](_0x1010b5);}return _0x21fb69[_0xfd85('0x21')](_0x1010b5)[_0xfd85('0x22')]();};}function respondWithResult(_0x3e7905,_0x3635af){_0x3635af=_0x3635af||0xc8;return function(_0xaa4bc0){if(_0xaa4bc0){return _0x3e7905[_0xfd85('0x21')](_0x3635af)['json'](_0xaa4bc0);}};}function respondWithFilteredResult(_0x38de44,_0x14a86a){return function(_0x3a72d4){if(_0x3a72d4){var _0x5aa0d8=typeof _0x14a86a['offset']===_0xfd85('0x23')&&typeof _0x14a86a[_0xfd85('0x24')]===_0xfd85('0x23');var _0x4ce384=_0x3a72d4[_0xfd85('0x25')];var _0x591445=_0x5aa0d8?0x0:_0x14a86a['offset'];var _0x51272b=_0x5aa0d8?_0x3a72d4[_0xfd85('0x25')]:_0x14a86a[_0xfd85('0x26')]+_0x14a86a[_0xfd85('0x24')];var _0x3dcec3;if(_0x51272b>=_0x4ce384){_0x51272b=_0x4ce384;_0x3dcec3=0xc8;}else{_0x3dcec3=0xce;}_0x38de44[_0xfd85('0x21')](_0x3dcec3);return _0x38de44[_0xfd85('0x27')](_0xfd85('0x28'),_0x591445+'-'+_0x51272b+'/'+_0x4ce384)['json'](_0x3a72d4);}return null;};}function patchUpdates(_0x5aad1a){return function(_0x2bfb6a){try{jsonpatch[_0xfd85('0x29')](_0x2bfb6a,_0x5aad1a,!![]);}catch(_0x262396){return BPromise[_0xfd85('0x2a')](_0x262396);}return _0x2bfb6a[_0xfd85('0x2b')]();};}function saveUpdates(_0x5334fd,_0x4a074d){return function(_0x3897ac){if(_0x3897ac){return _0x3897ac[_0xfd85('0x2c')](_0x5334fd)[_0xfd85('0x2d')](function(_0xd9e103){return _0xd9e103;});}return null;};}function removeEntity(_0x5b0ad1,_0xfac3cf){return function(_0x5b072a){if(_0x5b072a){return _0x5b072a[_0xfd85('0x2e')]()[_0xfd85('0x2d')](function(){var _0x308e25=_0x5b072a[_0xfd85('0x2f')]({'plain':!![]});var _0x398df3=_0xfd85('0x30');return db[_0xfd85('0x31')][_0xfd85('0x2e')]({'where':{'type':_0x398df3,'resourceId':_0x308e25['id']}})[_0xfd85('0x2d')](function(){return _0x5b072a;});})[_0xfd85('0x2d')](function(){_0x5b0ad1['status'](0xcc)[_0xfd85('0x22')]();});}};}function handleEntityNotFound(_0x56e5d9,_0xf95746){return function(_0x43dbde){if(!_0x43dbde){_0x56e5d9[_0xfd85('0x20')](0x194);}return _0x43dbde;};}function handleError(_0x6569d6,_0x3b5c1b){_0x3b5c1b=_0x3b5c1b||0x1f4;return function(_0x4ca6eb){logger[_0xfd85('0x32')](_0x4ca6eb[_0xfd85('0x33')]);if(_0x4ca6eb[_0xfd85('0x34')]){delete _0x4ca6eb[_0xfd85('0x34')];}_0x6569d6[_0xfd85('0x21')](_0x3b5c1b)[_0xfd85('0x35')](_0x4ca6eb);};}exports[_0xfd85('0x36')]=function(_0xc4ad1e,_0x546840){var _0x3ad9cb={},_0x2394c8={},_0x13e604={'count':0x0,'rows':[]};var _0x1b981d=_['map'](db[_0xfd85('0x37')][_0xfd85('0x38')],function(_0xbd17ea){return{'name':_0xbd17ea[_0xfd85('0x39')],'type':_0xbd17ea[_0xfd85('0x3a')][_0xfd85('0x3b')]};});_0x2394c8[_0xfd85('0x3c')]=_[_0xfd85('0x3d')](_0x1b981d,'name');_0x2394c8[_0xfd85('0x3e')]=_['keys'](_0xc4ad1e[_0xfd85('0x3e')]);_0x2394c8['filters']=_[_0xfd85('0x3f')](_0x2394c8[_0xfd85('0x3c')],_0x2394c8['query']);_0x3ad9cb[_0xfd85('0x40')]=_[_0xfd85('0x3f')](_0x2394c8[_0xfd85('0x3c')],qs[_0xfd85('0x41')](_0xc4ad1e['query']['fields']));_0x3ad9cb['attributes']=_0x3ad9cb[_0xfd85('0x40')][_0xfd85('0x42')]?_0x3ad9cb[_0xfd85('0x40')]:_0x2394c8['model'];if(!_0xc4ad1e[_0xfd85('0x3e')][_0xfd85('0x43')](_0xfd85('0x44'))){_0x3ad9cb[_0xfd85('0x24')]=qs[_0xfd85('0x24')](_0xc4ad1e['query'][_0xfd85('0x24')]);_0x3ad9cb[_0xfd85('0x26')]=qs[_0xfd85('0x26')](_0xc4ad1e[_0xfd85('0x3e')][_0xfd85('0x26')]);}_0x3ad9cb[_0xfd85('0x45')]=qs[_0xfd85('0x46')](_0xc4ad1e[_0xfd85('0x3e')][_0xfd85('0x46')]);_0x3ad9cb['where']=qs[_0xfd85('0x47')](_['pick'](_0xc4ad1e[_0xfd85('0x3e')],_0x2394c8[_0xfd85('0x47')]),_0x1b981d);if(_0xc4ad1e[_0xfd85('0x3e')][_0xfd85('0x48')]){_0x3ad9cb[_0xfd85('0x49')]=_[_0xfd85('0x4a')](_0x3ad9cb[_0xfd85('0x49')],{'$or':_['map'](_0x1b981d,function(_0x3bc303){if(_0x3bc303[_0xfd85('0x3a')]!=='VIRTUAL'){var _0x4b9b45={};_0x4b9b45[_0x3bc303[_0xfd85('0x34')]]={'$like':'%'+_0xc4ad1e[_0xfd85('0x3e')][_0xfd85('0x48')]+'%'};return _0x4b9b45;}})});}_0x3ad9cb=_['merge']({},_0x3ad9cb,_0xc4ad1e[_0xfd85('0x4b')]);var _0x384909={'where':_0x3ad9cb[_0xfd85('0x49')]};return db[_0xfd85('0x37')][_0xfd85('0x25')](_0x384909)[_0xfd85('0x2d')](function(_0x1a7bb0){_0x13e604[_0xfd85('0x25')]=_0x1a7bb0;if(_0xc4ad1e[_0xfd85('0x3e')][_0xfd85('0x4c')]){_0x3ad9cb[_0xfd85('0x4d')]=[{'all':!![]}];}return db[_0xfd85('0x37')][_0xfd85('0x4e')](_0x3ad9cb);})[_0xfd85('0x2d')](function(_0x35d867){_0x13e604[_0xfd85('0x4f')]=_0x35d867;return _0x13e604;})[_0xfd85('0x2d')](respondWithFilteredResult(_0x546840,_0x3ad9cb))[_0xfd85('0x50')](handleError(_0x546840,null));};exports[_0xfd85('0x51')]=function(_0x3a692b,_0x4a91a1){var _0x1c2f7e={'raw':!![],'where':{'id':_0x3a692b['params']['id']}},_0x3d0821={};_0x3d0821[_0xfd85('0x3c')]=_[_0xfd85('0x52')](db['WhatsappQueue'][_0xfd85('0x38')]);_0x3d0821[_0xfd85('0x3e')]=_[_0xfd85('0x52')](_0x3a692b[_0xfd85('0x3e')]);_0x3d0821[_0xfd85('0x47')]=_['intersection'](_0x3d0821[_0xfd85('0x3c')],_0x3d0821[_0xfd85('0x3e')]);_0x1c2f7e[_0xfd85('0x40')]=_[_0xfd85('0x3f')](_0x3d0821[_0xfd85('0x3c')],qs['fields'](_0x3a692b[_0xfd85('0x3e')]['fields']));_0x1c2f7e['attributes']=_0x1c2f7e[_0xfd85('0x40')][_0xfd85('0x42')]?_0x1c2f7e[_0xfd85('0x40')]:_0x3d0821[_0xfd85('0x3c')];if(_0x3a692b['query'][_0xfd85('0x4c')]){_0x1c2f7e[_0xfd85('0x4d')]=[{'all':!![]}];}_0x1c2f7e=_[_0xfd85('0x4a')]({},_0x1c2f7e,_0x3a692b[_0xfd85('0x4b')]);return db['WhatsappQueue']['find'](_0x1c2f7e)['then'](handleEntityNotFound(_0x4a91a1,null))[_0xfd85('0x2d')](respondWithResult(_0x4a91a1,null))[_0xfd85('0x50')](handleError(_0x4a91a1,null));};exports[_0xfd85('0x53')]=function(_0xefe5,_0x3b9c27){return db[_0xfd85('0x37')][_0xfd85('0x53')](_0xefe5[_0xfd85('0x54')],{})[_0xfd85('0x2d')](function(_0x1fe7da){var _0x3704f9=_0xefe5[_0xfd85('0x55')]['get']({'plain':!![]});if(!_0x3704f9)throw new Error(_0xfd85('0x56'));if(_0x3704f9['role']==='user'){var _0x3b0b09=_0x1fe7da[_0xfd85('0x2f')]({'plain':!![]});var _0x2b0643='WhatsappQueues';return db[_0xfd85('0x57')][_0xfd85('0x58')]({'where':{'name':_0x2b0643,'userProfileId':_0x3704f9['userProfileId']},'raw':!![]})[_0xfd85('0x2d')](function(_0x41688f){if(_0x41688f&&_0x41688f[_0xfd85('0x59')]===0x0){return db[_0xfd85('0x31')]['create']({'name':_0x3b0b09[_0xfd85('0x34')],'resourceId':_0x3b0b09['id'],'type':_0x41688f[_0xfd85('0x34')],'sectionId':_0x41688f['id']},{})[_0xfd85('0x2d')](function(){return _0x1fe7da;});}else{return _0x1fe7da;}})[_0xfd85('0x50')](function(_0x45608d){logger[_0xfd85('0x32')](_0xfd85('0x5a'),_0x45608d);throw _0x45608d;});}return _0x1fe7da;})[_0xfd85('0x2d')](respondWithResult(_0x3b9c27,0xc9))['catch'](handleError(_0x3b9c27,null));};exports[_0xfd85('0x2c')]=function(_0x21cce7,_0x1deb68){if(_0x21cce7[_0xfd85('0x54')]['id']){delete _0x21cce7[_0xfd85('0x54')]['id'];}return db['WhatsappQueue'][_0xfd85('0x58')]({'where':{'id':_0x21cce7[_0xfd85('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1deb68,null))[_0xfd85('0x2d')](saveUpdates(_0x21cce7[_0xfd85('0x54')],null))[_0xfd85('0x2d')](respondWithResult(_0x1deb68,null))[_0xfd85('0x50')](handleError(_0x1deb68,null));};exports[_0xfd85('0x2e')]=function(_0x21769e,_0x4dfc2a){return db[_0xfd85('0x37')][_0xfd85('0x58')]({'where':{'id':_0x21769e[_0xfd85('0x5b')]['id']}})[_0xfd85('0x2d')](handleEntityNotFound(_0x4dfc2a,null))[_0xfd85('0x2d')](removeEntity(_0x4dfc2a,null))['catch'](handleError(_0x4dfc2a,null));};exports[_0xfd85('0x5c')]=function(_0x3a0c00,_0x4c347b){return db[_0xfd85('0x37')][_0xfd85('0x5c')]()[_0xfd85('0x2d')](respondWithResult(_0x4c347b,null))[_0xfd85('0x50')](handleError(_0x4c347b,null));};exports[_0xfd85('0x5d')]=function(_0x5c1423,_0x3e3e43,_0x1a18ce){var _0x4712ba={'raw':!![],'where':{}},_0x483abd={},_0x29f17d;return db[_0xfd85('0x37')][_0xfd85('0x5e')]({'where':{'id':_0x5c1423[_0xfd85('0x5b')]['id']}})[_0xfd85('0x2d')](handleEntityNotFound(_0x3e3e43,null))[_0xfd85('0x2d')](function(_0x381291){if(_0x381291){_0x29f17d=_0x381291[_0xfd85('0x2f')]({'plain':!![]});_0x483abd[_0xfd85('0x3c')]=_['keys'](db['UserWhatsappQueue'][_0xfd85('0x38')]);_0x483abd[_0xfd85('0x3e')]=_[_0xfd85('0x52')](_0x5c1423[_0xfd85('0x3e')]);_0x483abd[_0xfd85('0x47')]=_[_0xfd85('0x3f')](_0x483abd[_0xfd85('0x3c')],_0x483abd[_0xfd85('0x3e')]);_0x4712ba[_0xfd85('0x40')]=_['intersection'](_0x483abd['model'],qs[_0xfd85('0x41')](_0x5c1423[_0xfd85('0x3e')]['fields']));_0x4712ba['attributes']=_0x4712ba[_0xfd85('0x40')]['length']?_0x4712ba['attributes']:_0x483abd[_0xfd85('0x3c')];if(!_0x5c1423[_0xfd85('0x3e')][_0xfd85('0x43')](_0xfd85('0x44'))){_0x4712ba[_0xfd85('0x24')]=qs[_0xfd85('0x24')](_0x5c1423['query'][_0xfd85('0x24')]);_0x4712ba[_0xfd85('0x26')]=qs[_0xfd85('0x26')](_0x5c1423['query'][_0xfd85('0x26')]);}_0x4712ba['order']=qs[_0xfd85('0x46')](_0x5c1423['query'][_0xfd85('0x46')]);_0x4712ba[_0xfd85('0x49')]=qs['filters'](_[_0xfd85('0x5f')](_0x5c1423[_0xfd85('0x3e')],_0x483abd['filters']));_0x4712ba[_0xfd85('0x49')][_0xfd85('0x60')]=_0x381291['id'];if(_0x5c1423[_0xfd85('0x3e')][_0xfd85('0x48')]){_0x4712ba[_0xfd85('0x49')]=_['merge'](_0x4712ba[_0xfd85('0x49')],{'$or':_[_0xfd85('0x3d')](_0x4712ba['attributes'],function(_0x5a20de){var _0x14d48e={};_0x14d48e[_0x5a20de]={'$like':'%'+_0x5c1423[_0xfd85('0x3e')][_0xfd85('0x48')]+'%'};return _0x14d48e;})});}_0x4712ba=_[_0xfd85('0x4a')]({},_0x4712ba,_0x5c1423[_0xfd85('0x4b')]);return db[_0xfd85('0x61')]['findAll'](_0x4712ba);}})[_0xfd85('0x2d')](function(_0x28331c){if(_0x28331c){return db['User'][_0xfd85('0x62')]({'where':{'id':_['map'](_0x28331c,'UserId'),'role':'agent'},'attributes':['id','name',_0xfd85('0x63'),_0xfd85('0x64'),_0xfd85('0x65')]});}})[_0xfd85('0x2d')](function(_0x2abb2a){if(_0x2abb2a){return{'count':_0x2abb2a['count'],'rows':_[_0xfd85('0x3d')](_0x2abb2a[_0xfd85('0x4f')],function(_0x5d8d2e){return{'membername':_0x5d8d2e[_0xfd85('0x34')],'UserId':_0x5d8d2e['id'],'queue_name':_0x29f17d[_0xfd85('0x34')],'WhatsappQueueId':_0x29f17d['id'],'interface':util[_0xfd85('0x66')](_0xfd85('0x67'),_0xfd85('0x68'),_0x5d8d2e['name']),'penalty':0x0,'paused':_0x5d8d2e[_0xfd85('0x63')],'createdAt':_0x5d8d2e[_0xfd85('0x65')],'updatedAt':_0x5d8d2e[_0xfd85('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfd85('0x2d')](respondWithFilteredResult(_0x3e3e43,_0x4712ba))['catch'](handleError(_0x3e3e43,null));};exports[_0xfd85('0x69')]=function(_0x407dcd,_0x10d9c4,_0x301f7d){var _0x242d1f={};var _0xdf1fda={};var _0x1949d5;var _0x51310f;return db['WhatsappQueue'][_0xfd85('0x5e')]({'where':{'id':_0x407dcd['params']['id']}})[_0xfd85('0x2d')](handleEntityNotFound(_0x10d9c4,null))['then'](function(_0x3d8dea){if(_0x3d8dea){_0x1949d5=_0x3d8dea;_0xdf1fda[_0xfd85('0x3c')]=_[_0xfd85('0x52')](db[_0xfd85('0x6a')][_0xfd85('0x38')]);_0xdf1fda['query']=_['keys'](_0x407dcd[_0xfd85('0x3e')]);_0xdf1fda[_0xfd85('0x47')]=_['intersection'](_0xdf1fda[_0xfd85('0x3c')],_0xdf1fda[_0xfd85('0x3e')]);_0x242d1f[_0xfd85('0x40')]=_[_0xfd85('0x3f')](_0xdf1fda[_0xfd85('0x3c')],qs[_0xfd85('0x41')](_0x407dcd[_0xfd85('0x3e')]['fields']));_0x242d1f['attributes']=_0x242d1f['attributes'][_0xfd85('0x42')]?_0x242d1f[_0xfd85('0x40')]:_0xdf1fda[_0xfd85('0x3c')];_0x242d1f[_0xfd85('0x45')]=qs[_0xfd85('0x46')](_0x407dcd[_0xfd85('0x3e')]['sort']);_0x242d1f['where']=qs[_0xfd85('0x47')](_[_0xfd85('0x5f')](_0x407dcd['query'],_0xdf1fda[_0xfd85('0x47')]));if(_0x407dcd[_0xfd85('0x3e')][_0xfd85('0x48')]){_0x242d1f['where']=_['merge'](_0x242d1f[_0xfd85('0x49')],{'$or':_['map'](_0x242d1f[_0xfd85('0x40')],function(_0x22c250){var _0x2f4416={};_0x2f4416[_0x22c250]={'$like':'%'+_0x407dcd[_0xfd85('0x3e')][_0xfd85('0x48')]+'%'};return _0x2f4416;})});}_0x242d1f=_[_0xfd85('0x4a')]({},_0x242d1f,_0x407dcd[_0xfd85('0x4b')]);return _0x1949d5[_0xfd85('0x69')](_0x242d1f);}})['then'](function(_0x1fec2d){if(_0x1fec2d){_0x51310f=_0x1fec2d[_0xfd85('0x42')];if(!_0x407dcd['query'][_0xfd85('0x43')](_0xfd85('0x44'))){_0x242d1f['limit']=qs[_0xfd85('0x24')](_0x407dcd[_0xfd85('0x3e')]['limit']);_0x242d1f[_0xfd85('0x26')]=qs[_0xfd85('0x26')](_0x407dcd['query'][_0xfd85('0x26')]);}return _0x1949d5[_0xfd85('0x69')](_0x242d1f);}})['then'](function(_0xf8db90){if(_0xf8db90){return _0xf8db90?{'count':_0x51310f,'rows':_0xf8db90}:null;}})[_0xfd85('0x2d')](respondWithResult(_0x10d9c4,null))[_0xfd85('0x50')](handleError(_0x10d9c4,null));};exports[_0xfd85('0x6b')]=function(_0x3e79cb,_0x595b7d,_0x5b979b){var _0x29bea2=_0x3e79cb[_0xfd85('0x54')][_0xfd85('0x6c')];return db[_0xfd85('0x6a')][_0xfd85('0x4e')]({'where':{'id':_0x29bea2},'attributes':['id'],'include':[{'model':db[_0xfd85('0x6d')],'as':_0xfd85('0x6e'),'attributes':['id','name',_0xfd85('0x6f'),_0xfd85('0x70'),_0xfd85('0x71')],'raw':!![]}]})['then'](function(_0x59108b){if(_0x59108b){var _0x36a16c=_[_0xfd85('0x72')](_0x59108b,function(_0x351f0c){var _0xea60e8=_0x351f0c['get']({'plain':!![]});return _0xea60e8['Agents'];});return db[_0xfd85('0x37')][_0xfd85('0x58')]({'where':{'id':_0x3e79cb[_0xfd85('0x5b')]['id']}})['then'](function(_0x823641){return db[_0xfd85('0x73')][_0xfd85('0x74')](function(_0x2b9f0d){return _0x823641[_0xfd85('0x6b')](_0x29bea2,{'transaction':_0x2b9f0d})[_0xfd85('0x2d')](function(){return BPromise[_0xfd85('0x75')](_0x36a16c,function(_0x332617){return db[_0xfd85('0x61')][_0xfd85('0x76')]({'where':{'UserId':_0x332617['id'],'WhatsappQueueId':_0x3e79cb[_0xfd85('0x5b')]['id']},'transaction':_0x2b9f0d});});})['then'](function(){_0x36a16c[_0xfd85('0x77')](function(_0x1e9b10){socket[_0xfd85('0x78')](_0xfd85('0x79'),{'UserId':_0x1e9b10['id'],'WhatsappQueueId':_0x823641['id']});});});});});}})['then'](respondWithStatusCode(_0x595b7d,null))[_0xfd85('0x50')](handleError(_0x595b7d,null));};exports['removeTeams']=function(_0x5ef379,_0xa3a51a,_0x57d625){return db[_0xfd85('0x6a')][_0xfd85('0x4e')]({'where':{'id':_0x5ef379[_0xfd85('0x3e')][_0xfd85('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xfd85('0x6d')],'as':_0xfd85('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xfd85('0x2d')](handleEntityNotFound(_0xa3a51a,null))[_0xfd85('0x2d')](function(_0x2cef09){var _0x433a0d=_['map'](_0x2cef09,'id');var _0x325c1a=[];var _0x4bb352=[];var _0x39323c=squel['select']();_0x39323c[_0xfd85('0x7a')]('tq.TeamId')[_0xfd85('0x7b')]('team_has_whatsapp_queues','tq')[_0xfd85('0x7c')](_0xfd85('0x7d'),'ut',_0xfd85('0x7e'))[_0xfd85('0x49')]('WhatsappQueueId\x20=\x20?',_0x5ef379[_0xfd85('0x5b')]['id']);for(var _0x59f3d0=0x0;_0x59f3d0<_0x2cef09[_0xfd85('0x42')];_0x59f3d0+=0x1){let _0x43f219=_0x2cef09[_0x59f3d0];for(var _0x50f811=0x0;_0x50f811<_0x43f219[_0xfd85('0x6e')][_0xfd85('0x42')];_0x50f811+=0x1){let _0x5a1074=_0x43f219['Agents'][_0x50f811];var _0x22fa62=_0x39323c[_0xfd85('0x7f')]();_0x22fa62[_0xfd85('0x49')](_0xfd85('0x80'),_0x5a1074['id']);_0x4bb352[_0xfd85('0x81')](db['sequelize']['query'](_0x22fa62[_0xfd85('0x82')](),{'type':db[_0xfd85('0x73')][_0xfd85('0x83')]['SELECT']})['then'](function(_0x4d24e2){if(_0x4d24e2[_0xfd85('0x42')]===0x1){return _0x5a1074['id'];}else{var _0x1ce618=_[_0xfd85('0x84')](_[_0xfd85('0x3d')](_0x4d24e2,'TeamId'),function(_0x11a67e){return _[_0xfd85('0x85')](_0x433a0d,_0x11a67e);});if(_0x1ce618){return _0x5a1074['id'];}}}));}}return BPromise[_0xfd85('0x86')](_0x4bb352)['then'](function(_0x57a7e7){_0x325c1a=_(_0x325c1a)['union'](_0x57a7e7)['compact']()[_0xfd85('0x87')]();return db[_0xfd85('0x37')]['find']({'where':{'id':_0x5ef379['params']['id']}})[_0xfd85('0x2d')](function(_0x564bed){return db[_0xfd85('0x73')][_0xfd85('0x74')](function(_0x442941){return _0x564bed['removeTeams'](_0x5ef379[_0xfd85('0x3e')][_0xfd85('0x6c')],{'transaction':_0x442941})[_0xfd85('0x2d')](function(){if(!_['isEmpty'](_0x325c1a)){return _0x564bed[_0xfd85('0x88')](_0x325c1a,{'transaction':_0x442941});}})[_0xfd85('0x2d')](function(){_0x325c1a['forEach'](function(_0x56ac3c){socket['emit'](_0xfd85('0x89'),{'UserId':_0x56ac3c,'WhatsappQueueId':_0x564bed['id']});});});});});});})[_0xfd85('0x2d')](respondWithStatusCode(_0xa3a51a,null))[_0xfd85('0x50')](handleError(_0xa3a51a,null));};exports[_0xfd85('0x8a')]=function(_0x1a1685,_0x3f8e89,_0x9ccfb5){return db[_0xfd85('0x37')]['find']({'where':{'id':_0x1a1685['params']['id']}})[_0xfd85('0x2d')](handleEntityNotFound(_0x3f8e89,null))['then'](function(_0x17b5af){if(_0x17b5af){return _0x17b5af[_0xfd85('0x8a')](_0x1a1685['body'][_0xfd85('0x6c')],_[_0xfd85('0x8b')](_0x1a1685[_0xfd85('0x54')],[_0xfd85('0x6c'),'id'])||{})[_0xfd85('0x8c')](function(_0x302ca8){for(var _0x584009=0x0;_0x584009<_0x1a1685[_0xfd85('0x54')][_0xfd85('0x6c')]['length'];_0x584009+=0x1){socket[_0xfd85('0x78')](_0xfd85('0x79'),{'UserId':Number(_0x1a1685['body'][_0xfd85('0x6c')][_0x584009]),'WhatsappQueueId':Number(_0x1a1685[_0xfd85('0x5b')]['id'])});}return _0x302ca8;});}})[_0xfd85('0x2d')](respondWithResult(_0x3f8e89,null))['catch'](handleError(_0x3f8e89,null));};exports['removeAgents']=function(_0x17b72d,_0x582091,_0x587aac){return db[_0xfd85('0x37')][_0xfd85('0x58')]({'where':{'id':_0x17b72d[_0xfd85('0x5b')]['id']}})[_0xfd85('0x2d')](handleEntityNotFound(_0x582091,null))[_0xfd85('0x2d')](function(_0x3fb4b1){if(_0x3fb4b1){return _0x3fb4b1[_0xfd85('0x88')](_0x17b72d[_0xfd85('0x3e')][_0xfd85('0x6c')])['then'](function(){if(_[_0xfd85('0x8d')](_0x17b72d[_0xfd85('0x3e')][_0xfd85('0x6c')])){for(var _0x4cb319=0x0;_0x4cb319<_0x17b72d[_0xfd85('0x3e')][_0xfd85('0x6c')][_0xfd85('0x42')];_0x4cb319+=0x1){socket[_0xfd85('0x78')]('userWhatsappQueue:remove',{'UserId':Number(_0x17b72d[_0xfd85('0x3e')]['ids'][_0x4cb319]),'WhatsappQueueId':Number(_0x17b72d[_0xfd85('0x5b')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x17b72d[_0xfd85('0x3e')]['ids']),'WhatsappQueueId':Number(_0x17b72d[_0xfd85('0x5b')]['id'])});}});}})[_0xfd85('0x2d')](respondWithStatusCode(_0x582091,null))[_0xfd85('0x50')](handleError(_0x582091,null));};exports[_0xfd85('0x8e')]=function(_0xbac45a,_0x5aef8b,_0x3cd152){var _0x24a7fe={};var _0x528d55={};var _0x265a72;var _0x16f808;return db[_0xfd85('0x37')]['findOne']({'where':{'id':_0xbac45a[_0xfd85('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5aef8b,null))['then'](function(_0x36c1c5){if(_0x36c1c5){_0x265a72=_0x36c1c5;_0x528d55[_0xfd85('0x3c')]=_[_0xfd85('0x52')](db[_0xfd85('0x6d')][_0xfd85('0x38')]);_0x528d55['query']=_[_0xfd85('0x52')](_0xbac45a[_0xfd85('0x3e')]);_0x528d55[_0xfd85('0x47')]=_[_0xfd85('0x3f')](_0x528d55[_0xfd85('0x3c')],_0x528d55['query']);_0x24a7fe[_0xfd85('0x40')]=_[_0xfd85('0x3f')](_0x528d55[_0xfd85('0x3c')],qs[_0xfd85('0x41')](_0xbac45a[_0xfd85('0x3e')][_0xfd85('0x41')]));_0x24a7fe['attributes']=_0x24a7fe['attributes']['length']?_0x24a7fe[_0xfd85('0x40')]:_0x528d55[_0xfd85('0x3c')];_0x24a7fe['order']=qs[_0xfd85('0x46')](_0xbac45a[_0xfd85('0x3e')][_0xfd85('0x46')]);_0x24a7fe[_0xfd85('0x49')]=qs['filters'](_[_0xfd85('0x5f')](_0xbac45a[_0xfd85('0x3e')],_0x528d55[_0xfd85('0x47')]));if(_0xbac45a[_0xfd85('0x3e')]['filter']){_0x24a7fe[_0xfd85('0x49')]=_[_0xfd85('0x4a')](_0x24a7fe[_0xfd85('0x49')],{'$or':_[_0xfd85('0x3d')](_0x24a7fe[_0xfd85('0x40')],function(_0x2a2de1){var _0x42be95={};_0x42be95[_0x2a2de1]={'$like':'%'+_0xbac45a[_0xfd85('0x3e')]['filter']+'%'};return _0x42be95;})});}_0x24a7fe=_[_0xfd85('0x4a')]({},_0x24a7fe,_0xbac45a[_0xfd85('0x4b')]);return _0x265a72[_0xfd85('0x8e')](_0x24a7fe);}})[_0xfd85('0x2d')](function(_0x31fc90){if(_0x31fc90){_0x16f808=_0x31fc90[_0xfd85('0x42')];if(!_0xbac45a[_0xfd85('0x3e')]['hasOwnProperty']('nolimit')){_0x24a7fe[_0xfd85('0x24')]=qs[_0xfd85('0x24')](_0xbac45a[_0xfd85('0x3e')][_0xfd85('0x24')]);_0x24a7fe[_0xfd85('0x26')]=qs['offset'](_0xbac45a[_0xfd85('0x3e')]['offset']);}return _0x265a72[_0xfd85('0x8e')](_0x24a7fe);}})[_0xfd85('0x2d')](function(_0x1aeba2){if(_0x1aeba2){return _0x1aeba2?{'count':_0x16f808,'rows':_0x1aeba2}:null;}})[_0xfd85('0x2d')](respondWithResult(_0x5aef8b,null))[_0xfd85('0x50')](handleError(_0x5aef8b,null));}; \ No newline at end of file +var _0x9492=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','nolimit','sort','WhatsappQueueId','UserWhatsappQueue','findAll','User','UserId','whatsappPause','updatedAt','createdAt','%s/%s','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','sequelize','QueryTypes','every','includes','all','value','transaction','removeAgents','addAgents','omit','spread','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x55642e,_0x3f7ab6){var _0x3e5fc9=function(_0x1f3af2){while(--_0x1f3af2){_0x55642e['push'](_0x55642e['shift']());}};_0x3e5fc9(++_0x3f7ab6);}(_0x9492,0x74));var _0x2949=function(_0x4bc169,_0x4b1164){_0x4bc169=_0x4bc169-0x0;var _0x56d503=_0x9492[_0x4bc169];return _0x56d503;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2949('0x0'));var zipdir=require(_0x2949('0x1'));var jsonpatch=require(_0x2949('0x2'));var rp=require(_0x2949('0x3'));var moment=require(_0x2949('0x4'));var BPromise=require(_0x2949('0x5'));var Mustache=require(_0x2949('0x6'));var util=require('util');var path=require(_0x2949('0x7'));var sox=require(_0x2949('0x8'));var csv=require(_0x2949('0x9'));var ejs=require(_0x2949('0xa'));var fs=require('fs');var fs_extra=require(_0x2949('0xb'));var _=require(_0x2949('0xc'));var squel=require(_0x2949('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2949('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2949('0xf'));var Papa=require(_0x2949('0x10'));var Redis=require(_0x2949('0x11'));var authService=require(_0x2949('0x12'));var qs=require(_0x2949('0x13'));var as=require(_0x2949('0x14'));var hardwareService=require(_0x2949('0x15'));var logger=require(_0x2949('0x16'))(_0x2949('0x17'));var utils=require(_0x2949('0x18'));var config=require(_0x2949('0x19'));var licenseUtil=require(_0x2949('0x1a'));var db=require(_0x2949('0x1b'))['db'];config['redis']=_[_0x2949('0x1c')](config['redis'],{'host':_0x2949('0x1d'),'port':0x18eb});var socket=require(_0x2949('0x1e'))(new Redis(config[_0x2949('0x1f')]));require(_0x2949('0x20'))['register'](socket);function respondWithStatusCode(_0x3e832a,_0x4356c5){_0x4356c5=_0x4356c5||0xcc;return function(_0x9ac4f6){if(_0x9ac4f6){return _0x3e832a[_0x2949('0x21')](_0x4356c5);}return _0x3e832a[_0x2949('0x22')](_0x4356c5)[_0x2949('0x23')]();};}function respondWithResult(_0x18ab14,_0x55e074){_0x55e074=_0x55e074||0xc8;return function(_0x232452){if(_0x232452){return _0x18ab14[_0x2949('0x22')](_0x55e074)[_0x2949('0x24')](_0x232452);}};}function respondWithFilteredResult(_0x189d07,_0x73b07b){return function(_0x2de3ca){if(_0x2de3ca){var _0x45b8a1=typeof _0x73b07b[_0x2949('0x25')]===_0x2949('0x26')&&typeof _0x73b07b[_0x2949('0x27')]===_0x2949('0x26');var _0x1decc5=_0x2de3ca[_0x2949('0x28')];var _0x130e77=_0x45b8a1?0x0:_0x73b07b[_0x2949('0x25')];var _0x2f6140=_0x45b8a1?_0x2de3ca[_0x2949('0x28')]:_0x73b07b[_0x2949('0x25')]+_0x73b07b[_0x2949('0x27')];var _0x11bb35;if(_0x2f6140>=_0x1decc5){_0x2f6140=_0x1decc5;_0x11bb35=0xc8;}else{_0x11bb35=0xce;}_0x189d07[_0x2949('0x22')](_0x11bb35);return _0x189d07[_0x2949('0x29')](_0x2949('0x2a'),_0x130e77+'-'+_0x2f6140+'/'+_0x1decc5)[_0x2949('0x24')](_0x2de3ca);}return null;};}function patchUpdates(_0x5b69d8){return function(_0x36d0f2){try{jsonpatch['apply'](_0x36d0f2,_0x5b69d8,!![]);}catch(_0x13b4a7){return BPromise[_0x2949('0x2b')](_0x13b4a7);}return _0x36d0f2['save']();};}function saveUpdates(_0x284eac,_0x52fcf3){return function(_0xf1f71d){if(_0xf1f71d){return _0xf1f71d[_0x2949('0x2c')](_0x284eac)[_0x2949('0x2d')](function(_0x391125){return _0x391125;});}return null;};}function removeEntity(_0x2a359a,_0x5a252b){return function(_0x16ddeb){if(_0x16ddeb){return _0x16ddeb[_0x2949('0x2e')]()[_0x2949('0x2d')](function(){var _0x47594d=_0x16ddeb[_0x2949('0x2f')]({'plain':!![]});var _0x453cf3='WhatsappQueues';return db[_0x2949('0x30')]['destroy']({'where':{'type':_0x453cf3,'resourceId':_0x47594d['id']}})[_0x2949('0x2d')](function(){return _0x16ddeb;});})[_0x2949('0x2d')](function(){_0x2a359a[_0x2949('0x22')](0xcc)[_0x2949('0x23')]();});}};}function handleEntityNotFound(_0x407fc7,_0x5e0428){return function(_0x287307){if(!_0x287307){_0x407fc7['sendStatus'](0x194);}return _0x287307;};}function handleError(_0x517d7e,_0x19f892){_0x19f892=_0x19f892||0x1f4;return function(_0x312688){logger[_0x2949('0x31')](_0x312688[_0x2949('0x32')]);if(_0x312688[_0x2949('0x33')]){delete _0x312688['name'];}_0x517d7e[_0x2949('0x22')](_0x19f892)[_0x2949('0x34')](_0x312688);};}exports[_0x2949('0x35')]=function(_0x2d6e2f,_0x3bd031){var _0x5a3315={},_0x14d8f6={},_0x55e538={'count':0x0,'rows':[]};var _0x1aa303=_[_0x2949('0x36')](db[_0x2949('0x37')][_0x2949('0x38')],function(_0x3273c4){return{'name':_0x3273c4[_0x2949('0x39')],'type':_0x3273c4[_0x2949('0x3a')]['key']};});_0x14d8f6[_0x2949('0x3b')]=_[_0x2949('0x36')](_0x1aa303,_0x2949('0x33'));_0x14d8f6[_0x2949('0x3c')]=_['keys'](_0x2d6e2f['query']);_0x14d8f6[_0x2949('0x3d')]=_[_0x2949('0x3e')](_0x14d8f6['model'],_0x14d8f6[_0x2949('0x3c')]);_0x5a3315[_0x2949('0x3f')]=_[_0x2949('0x3e')](_0x14d8f6[_0x2949('0x3b')],qs[_0x2949('0x40')](_0x2d6e2f[_0x2949('0x3c')][_0x2949('0x40')]));_0x5a3315[_0x2949('0x3f')]=_0x5a3315[_0x2949('0x3f')]['length']?_0x5a3315[_0x2949('0x3f')]:_0x14d8f6[_0x2949('0x3b')];if(!_0x2d6e2f['query'][_0x2949('0x41')]('nolimit')){_0x5a3315[_0x2949('0x27')]=qs[_0x2949('0x27')](_0x2d6e2f[_0x2949('0x3c')][_0x2949('0x27')]);_0x5a3315['offset']=qs[_0x2949('0x25')](_0x2d6e2f[_0x2949('0x3c')][_0x2949('0x25')]);}_0x5a3315[_0x2949('0x42')]=qs['sort'](_0x2d6e2f[_0x2949('0x3c')]['sort']);_0x5a3315[_0x2949('0x43')]=qs[_0x2949('0x3d')](_[_0x2949('0x44')](_0x2d6e2f['query'],_0x14d8f6[_0x2949('0x3d')]),_0x1aa303);if(_0x2d6e2f[_0x2949('0x3c')][_0x2949('0x45')]){_0x5a3315[_0x2949('0x43')]=_[_0x2949('0x46')](_0x5a3315[_0x2949('0x43')],{'$or':_[_0x2949('0x36')](_0x1aa303,function(_0x434e04){if(_0x434e04[_0x2949('0x3a')]!==_0x2949('0x47')){var _0x519b4f={};_0x519b4f[_0x434e04[_0x2949('0x33')]]={'$like':'%'+_0x2d6e2f[_0x2949('0x3c')][_0x2949('0x45')]+'%'};return _0x519b4f;}})});}_0x5a3315=_[_0x2949('0x46')]({},_0x5a3315,_0x2d6e2f[_0x2949('0x48')]);var _0x22aa3d={'where':_0x5a3315['where']};return db[_0x2949('0x37')]['count'](_0x22aa3d)['then'](function(_0x37980b){_0x55e538[_0x2949('0x28')]=_0x37980b;if(_0x2d6e2f['query'][_0x2949('0x49')]){_0x5a3315[_0x2949('0x4a')]=[{'all':!![]}];}return db[_0x2949('0x37')]['findAll'](_0x5a3315);})['then'](function(_0x1f44ac){_0x55e538[_0x2949('0x4b')]=_0x1f44ac;return _0x55e538;})[_0x2949('0x2d')](respondWithFilteredResult(_0x3bd031,_0x5a3315))[_0x2949('0x4c')](handleError(_0x3bd031,null));};exports[_0x2949('0x4d')]=function(_0xaf7806,_0x3a8e32){var _0x170bb5={'raw':!![],'where':{'id':_0xaf7806[_0x2949('0x4e')]['id']}},_0x4889a7={};_0x4889a7[_0x2949('0x3b')]=_['keys'](db[_0x2949('0x37')][_0x2949('0x38')]);_0x4889a7[_0x2949('0x3c')]=_[_0x2949('0x4f')](_0xaf7806[_0x2949('0x3c')]);_0x4889a7[_0x2949('0x3d')]=_['intersection'](_0x4889a7[_0x2949('0x3b')],_0x4889a7[_0x2949('0x3c')]);_0x170bb5[_0x2949('0x3f')]=_['intersection'](_0x4889a7['model'],qs[_0x2949('0x40')](_0xaf7806[_0x2949('0x3c')][_0x2949('0x40')]));_0x170bb5[_0x2949('0x3f')]=_0x170bb5[_0x2949('0x3f')][_0x2949('0x50')]?_0x170bb5['attributes']:_0x4889a7[_0x2949('0x3b')];if(_0xaf7806['query'][_0x2949('0x49')]){_0x170bb5[_0x2949('0x4a')]=[{'all':!![]}];}_0x170bb5=_[_0x2949('0x46')]({},_0x170bb5,_0xaf7806['options']);return db[_0x2949('0x37')][_0x2949('0x51')](_0x170bb5)[_0x2949('0x2d')](handleEntityNotFound(_0x3a8e32,null))[_0x2949('0x2d')](respondWithResult(_0x3a8e32,null))[_0x2949('0x4c')](handleError(_0x3a8e32,null));};exports['create']=function(_0x77f8ec,_0x3c2767){return db[_0x2949('0x37')][_0x2949('0x52')](_0x77f8ec['body'],{})[_0x2949('0x2d')](function(_0x215fd9){var _0x4af269=_0x77f8ec[_0x2949('0x53')][_0x2949('0x2f')]({'plain':!![]});if(!_0x4af269)throw new Error(_0x2949('0x54'));if(_0x4af269[_0x2949('0x55')]===_0x2949('0x53')){var _0x3c81c7=_0x215fd9[_0x2949('0x2f')]({'plain':!![]});var _0x311415=_0x2949('0x56');return db[_0x2949('0x57')][_0x2949('0x51')]({'where':{'name':_0x311415,'userProfileId':_0x4af269[_0x2949('0x58')]},'raw':!![]})['then'](function(_0x39da67){if(_0x39da67&&_0x39da67['autoAssociation']===0x0){return db[_0x2949('0x30')][_0x2949('0x52')]({'name':_0x3c81c7['name'],'resourceId':_0x3c81c7['id'],'type':_0x39da67['name'],'sectionId':_0x39da67['id']},{})[_0x2949('0x2d')](function(){return _0x215fd9;});}else{return _0x215fd9;}})[_0x2949('0x4c')](function(_0x3922fc){logger[_0x2949('0x31')](_0x2949('0x59'),_0x3922fc);throw _0x3922fc;});}return _0x215fd9;})[_0x2949('0x2d')](respondWithResult(_0x3c2767,0xc9))[_0x2949('0x4c')](handleError(_0x3c2767,null));};exports[_0x2949('0x2c')]=function(_0x2cd659,_0x3d9e41){if(_0x2cd659[_0x2949('0x5a')]['id']){delete _0x2cd659[_0x2949('0x5a')]['id'];}return db[_0x2949('0x37')][_0x2949('0x51')]({'where':{'id':_0x2cd659['params']['id']}})[_0x2949('0x2d')](handleEntityNotFound(_0x3d9e41,null))[_0x2949('0x2d')](saveUpdates(_0x2cd659[_0x2949('0x5a')],null))[_0x2949('0x2d')](respondWithResult(_0x3d9e41,null))[_0x2949('0x4c')](handleError(_0x3d9e41,null));};exports[_0x2949('0x2e')]=function(_0x1fb639,_0x5bd877){return db[_0x2949('0x37')]['find']({'where':{'id':_0x1fb639[_0x2949('0x4e')]['id']}})[_0x2949('0x2d')](handleEntityNotFound(_0x5bd877,null))[_0x2949('0x2d')](removeEntity(_0x5bd877,null))[_0x2949('0x4c')](handleError(_0x5bd877,null));};exports[_0x2949('0x5b')]=function(_0x37fa7a,_0x3709f4){return db[_0x2949('0x37')][_0x2949('0x5b')]()['then'](respondWithResult(_0x3709f4,null))['catch'](handleError(_0x3709f4,null));};exports[_0x2949('0x5c')]=function(_0x1a17b2,_0x1bdcaa,_0x10b15d){var _0x206068={'raw':!![],'where':{}},_0x4e8423={},_0x323ad3;return db[_0x2949('0x37')][_0x2949('0x5d')]({'where':{'id':_0x1a17b2[_0x2949('0x4e')]['id']}})[_0x2949('0x2d')](handleEntityNotFound(_0x1bdcaa,null))[_0x2949('0x2d')](function(_0x4c432e){if(_0x4c432e){_0x323ad3=_0x4c432e[_0x2949('0x2f')]({'plain':!![]});_0x4e8423[_0x2949('0x3b')]=_['keys'](db['UserWhatsappQueue'][_0x2949('0x38')]);_0x4e8423[_0x2949('0x3c')]=_[_0x2949('0x4f')](_0x1a17b2[_0x2949('0x3c')]);_0x4e8423[_0x2949('0x3d')]=_[_0x2949('0x3e')](_0x4e8423['model'],_0x4e8423['query']);_0x206068[_0x2949('0x3f')]=_[_0x2949('0x3e')](_0x4e8423[_0x2949('0x3b')],qs['fields'](_0x1a17b2['query'][_0x2949('0x40')]));_0x206068[_0x2949('0x3f')]=_0x206068[_0x2949('0x3f')][_0x2949('0x50')]?_0x206068['attributes']:_0x4e8423[_0x2949('0x3b')];if(!_0x1a17b2[_0x2949('0x3c')][_0x2949('0x41')](_0x2949('0x5e'))){_0x206068['limit']=qs['limit'](_0x1a17b2[_0x2949('0x3c')][_0x2949('0x27')]);_0x206068[_0x2949('0x25')]=qs[_0x2949('0x25')](_0x1a17b2['query']['offset']);}_0x206068['order']=qs[_0x2949('0x5f')](_0x1a17b2[_0x2949('0x3c')][_0x2949('0x5f')]);_0x206068['where']=qs['filters'](_[_0x2949('0x44')](_0x1a17b2['query'],_0x4e8423[_0x2949('0x3d')]));_0x206068[_0x2949('0x43')][_0x2949('0x60')]=_0x4c432e['id'];if(_0x1a17b2[_0x2949('0x3c')][_0x2949('0x45')]){_0x206068[_0x2949('0x43')]=_[_0x2949('0x46')](_0x206068['where'],{'$or':_[_0x2949('0x36')](_0x206068[_0x2949('0x3f')],function(_0x29b2b9){var _0x4fe04d={};_0x4fe04d[_0x29b2b9]={'$like':'%'+_0x1a17b2['query'][_0x2949('0x45')]+'%'};return _0x4fe04d;})});}_0x206068=_['merge']({},_0x206068,_0x1a17b2[_0x2949('0x48')]);return db[_0x2949('0x61')][_0x2949('0x62')](_0x206068);}})[_0x2949('0x2d')](function(_0x5f28a1){if(_0x5f28a1){return db[_0x2949('0x63')]['findAndCountAll']({'where':{'id':_[_0x2949('0x36')](_0x5f28a1,_0x2949('0x64')),'role':'agent'},'attributes':['id','name',_0x2949('0x65'),_0x2949('0x66'),_0x2949('0x67')]});}})[_0x2949('0x2d')](function(_0x594767){if(_0x594767){return{'count':_0x594767[_0x2949('0x28')],'rows':_['map'](_0x594767[_0x2949('0x4b')],function(_0x5257f9){return{'membername':_0x5257f9['name'],'UserId':_0x5257f9['id'],'queue_name':_0x323ad3['name'],'WhatsappQueueId':_0x323ad3['id'],'interface':util['format'](_0x2949('0x68'),'SIP',_0x5257f9[_0x2949('0x33')]),'penalty':0x0,'paused':_0x5257f9['whatsappPause'],'createdAt':_0x5257f9[_0x2949('0x67')],'updatedAt':_0x5257f9[_0x2949('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1bdcaa,_0x206068))['catch'](handleError(_0x1bdcaa,null));};exports['getTeams']=function(_0x452fae,_0x3c7401,_0x374179){var _0x5656d1={};var _0x9a96ce={};var _0x2ccde0;var _0x23994c;return db[_0x2949('0x37')][_0x2949('0x5d')]({'where':{'id':_0x452fae[_0x2949('0x4e')]['id']}})[_0x2949('0x2d')](handleEntityNotFound(_0x3c7401,null))[_0x2949('0x2d')](function(_0x52a9fc){if(_0x52a9fc){_0x2ccde0=_0x52a9fc;_0x9a96ce['model']=_[_0x2949('0x4f')](db[_0x2949('0x69')][_0x2949('0x38')]);_0x9a96ce[_0x2949('0x3c')]=_['keys'](_0x452fae[_0x2949('0x3c')]);_0x9a96ce[_0x2949('0x3d')]=_['intersection'](_0x9a96ce[_0x2949('0x3b')],_0x9a96ce['query']);_0x5656d1['attributes']=_[_0x2949('0x3e')](_0x9a96ce[_0x2949('0x3b')],qs[_0x2949('0x40')](_0x452fae[_0x2949('0x3c')]['fields']));_0x5656d1['attributes']=_0x5656d1[_0x2949('0x3f')][_0x2949('0x50')]?_0x5656d1[_0x2949('0x3f')]:_0x9a96ce['model'];_0x5656d1['order']=qs['sort'](_0x452fae[_0x2949('0x3c')][_0x2949('0x5f')]);_0x5656d1[_0x2949('0x43')]=qs['filters'](_['pick'](_0x452fae[_0x2949('0x3c')],_0x9a96ce[_0x2949('0x3d')]));if(_0x452fae[_0x2949('0x3c')][_0x2949('0x45')]){_0x5656d1[_0x2949('0x43')]=_[_0x2949('0x46')](_0x5656d1[_0x2949('0x43')],{'$or':_[_0x2949('0x36')](_0x5656d1['attributes'],function(_0x585796){var _0x3489ad={};_0x3489ad[_0x585796]={'$like':'%'+_0x452fae[_0x2949('0x3c')][_0x2949('0x45')]+'%'};return _0x3489ad;})});}_0x5656d1=_['merge']({},_0x5656d1,_0x452fae[_0x2949('0x48')]);return _0x2ccde0[_0x2949('0x6a')](_0x5656d1);}})[_0x2949('0x2d')](function(_0x3760a6){if(_0x3760a6){_0x23994c=_0x3760a6[_0x2949('0x50')];if(!_0x452fae[_0x2949('0x3c')]['hasOwnProperty'](_0x2949('0x5e'))){_0x5656d1[_0x2949('0x27')]=qs['limit'](_0x452fae[_0x2949('0x3c')][_0x2949('0x27')]);_0x5656d1[_0x2949('0x25')]=qs[_0x2949('0x25')](_0x452fae[_0x2949('0x3c')][_0x2949('0x25')]);}return _0x2ccde0[_0x2949('0x6a')](_0x5656d1);}})[_0x2949('0x2d')](function(_0x3f6768){if(_0x3f6768){return _0x3f6768?{'count':_0x23994c,'rows':_0x3f6768}:null;}})[_0x2949('0x2d')](respondWithResult(_0x3c7401,null))[_0x2949('0x4c')](handleError(_0x3c7401,null));};exports[_0x2949('0x6b')]=function(_0x45e920,_0xc04e54,_0x289acb){var _0x20b20d=_0x45e920['body'][_0x2949('0x6c')];return db[_0x2949('0x69')][_0x2949('0x62')]({'where':{'id':_0x20b20d},'attributes':['id'],'include':[{'model':db[_0x2949('0x63')],'as':_0x2949('0x6d'),'attributes':['id',_0x2949('0x33'),'online',_0x2949('0x6e'),_0x2949('0x6f')],'raw':!![]}]})['then'](function(_0x4d4d44){if(_0x4d4d44){var _0x727060=_[_0x2949('0x70')](_0x4d4d44,function(_0x5de1c5){var _0x514d9d=_0x5de1c5['get']({'plain':!![]});return _0x514d9d[_0x2949('0x6d')];});return db[_0x2949('0x37')][_0x2949('0x51')]({'where':{'id':_0x45e920['params']['id']}})[_0x2949('0x2d')](function(_0x22a26f){return db['sequelize']['transaction'](function(_0x561040){return _0x22a26f[_0x2949('0x6b')](_0x20b20d,{'transaction':_0x561040})['then'](function(){return BPromise[_0x2949('0x71')](_0x727060,function(_0x1167cc){return db[_0x2949('0x61')]['findOrCreate']({'where':{'UserId':_0x1167cc['id'],'WhatsappQueueId':_0x45e920[_0x2949('0x4e')]['id']},'transaction':_0x561040});});})[_0x2949('0x2d')](function(){_0x727060[_0x2949('0x72')](function(_0x107282){socket[_0x2949('0x73')](_0x2949('0x74'),{'UserId':_0x107282['id'],'WhatsappQueueId':_0x22a26f['id']});});});});});}})['then'](respondWithStatusCode(_0xc04e54,null))[_0x2949('0x4c')](handleError(_0xc04e54,null));};exports[_0x2949('0x75')]=function(_0x798f59,_0xcbad83,_0x3d0a75){return db['Team']['findAll']({'where':{'id':_0x798f59[_0x2949('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2949('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xcbad83,null))[_0x2949('0x2d')](function(_0x3c750e){var _0x1ac56e=_['map'](_0x3c750e,'id');var _0x15febd=[];var _0x29cbc3=[];var _0x474335=squel[_0x2949('0x76')]();_0x474335[_0x2949('0x77')](_0x2949('0x78'))[_0x2949('0x79')]('team_has_whatsapp_queues','tq')[_0x2949('0x7a')](_0x2949('0x7b'),'ut',_0x2949('0x7c'))[_0x2949('0x43')](_0x2949('0x7d'),_0x798f59[_0x2949('0x4e')]['id']);for(var _0x3e9295=0x0;_0x3e9295<_0x3c750e[_0x2949('0x50')];_0x3e9295+=0x1){let _0x1ad5e0=_0x3c750e[_0x3e9295];for(var _0x1fc54b=0x0;_0x1fc54b<_0x1ad5e0['Agents'][_0x2949('0x50')];_0x1fc54b+=0x1){let _0x4e60e1=_0x1ad5e0[_0x2949('0x6d')][_0x1fc54b];var _0xacc1e6=_0x474335[_0x2949('0x7e')]();_0xacc1e6['where']('ut.UserId\x20=\x20?',_0x4e60e1['id']);_0x29cbc3['push'](db[_0x2949('0x7f')]['query'](_0xacc1e6['toString'](),{'type':db[_0x2949('0x7f')][_0x2949('0x80')]['SELECT']})[_0x2949('0x2d')](function(_0x50b460){if(_0x50b460[_0x2949('0x50')]===0x1){return _0x4e60e1['id'];}else{var _0x5c1865=_[_0x2949('0x81')](_[_0x2949('0x36')](_0x50b460,'TeamId'),function(_0x408568){return _[_0x2949('0x82')](_0x1ac56e,_0x408568);});if(_0x5c1865){return _0x4e60e1['id'];}}}));}}return BPromise[_0x2949('0x83')](_0x29cbc3)[_0x2949('0x2d')](function(_0x1cb906){_0x15febd=_(_0x15febd)['union'](_0x1cb906)['compact']()[_0x2949('0x84')]();return db[_0x2949('0x37')][_0x2949('0x51')]({'where':{'id':_0x798f59[_0x2949('0x4e')]['id']}})['then'](function(_0x138bd4){return db[_0x2949('0x7f')][_0x2949('0x85')](function(_0x5cf1cb){return _0x138bd4[_0x2949('0x75')](_0x798f59[_0x2949('0x3c')][_0x2949('0x6c')],{'transaction':_0x5cf1cb})['then'](function(){if(!_['isEmpty'](_0x15febd)){return _0x138bd4[_0x2949('0x86')](_0x15febd,{'transaction':_0x5cf1cb});}})[_0x2949('0x2d')](function(){_0x15febd['forEach'](function(_0x5c04f1){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x5c04f1,'WhatsappQueueId':_0x138bd4['id']});});});});});});})[_0x2949('0x2d')](respondWithStatusCode(_0xcbad83,null))['catch'](handleError(_0xcbad83,null));};exports[_0x2949('0x87')]=function(_0xab933b,_0x454e13,_0x28d4f2){return db[_0x2949('0x37')][_0x2949('0x51')]({'where':{'id':_0xab933b['params']['id']}})['then'](handleEntityNotFound(_0x454e13,null))[_0x2949('0x2d')](function(_0x49a727){if(_0x49a727){return _0x49a727['addAgents'](_0xab933b[_0x2949('0x5a')][_0x2949('0x6c')],_[_0x2949('0x88')](_0xab933b['body'],[_0x2949('0x6c'),'id'])||{})[_0x2949('0x89')](function(_0x2abcda){for(var _0x27b8bc=0x0;_0x27b8bc<_0xab933b[_0x2949('0x5a')][_0x2949('0x6c')][_0x2949('0x50')];_0x27b8bc+=0x1){socket[_0x2949('0x73')](_0x2949('0x74'),{'UserId':Number(_0xab933b[_0x2949('0x5a')]['ids'][_0x27b8bc]),'WhatsappQueueId':Number(_0xab933b[_0x2949('0x4e')]['id'])});}return _0x2abcda;});}})[_0x2949('0x2d')](respondWithResult(_0x454e13,null))[_0x2949('0x4c')](handleError(_0x454e13,null));};exports['removeAgents']=function(_0x57451e,_0x224751,_0x12320a){return db[_0x2949('0x37')][_0x2949('0x51')]({'where':{'id':_0x57451e[_0x2949('0x4e')]['id']}})['then'](handleEntityNotFound(_0x224751,null))[_0x2949('0x2d')](function(_0x5178bf){if(_0x5178bf){return _0x5178bf[_0x2949('0x86')](_0x57451e['query']['ids'])[_0x2949('0x2d')](function(){if(_['isArray'](_0x57451e[_0x2949('0x3c')][_0x2949('0x6c')])){for(var _0x312cae=0x0;_0x312cae<_0x57451e[_0x2949('0x3c')][_0x2949('0x6c')][_0x2949('0x50')];_0x312cae+=0x1){socket[_0x2949('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x57451e[_0x2949('0x3c')]['ids'][_0x312cae]),'WhatsappQueueId':Number(_0x57451e[_0x2949('0x4e')]['id'])});}}else{socket['emit'](_0x2949('0x8a'),{'UserId':Number(_0x57451e[_0x2949('0x3c')][_0x2949('0x6c')]),'WhatsappQueueId':Number(_0x57451e[_0x2949('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x224751,null))[_0x2949('0x4c')](handleError(_0x224751,null));};exports[_0x2949('0x8b')]=function(_0x3af49c,_0x52cd8a,_0x54d2bb){var _0x404f80={};var _0x192fe8={};var _0x22f3be;var _0x5f0330;return db['WhatsappQueue'][_0x2949('0x5d')]({'where':{'id':_0x3af49c[_0x2949('0x4e')]['id']}})[_0x2949('0x2d')](handleEntityNotFound(_0x52cd8a,null))[_0x2949('0x2d')](function(_0xb90c7a){if(_0xb90c7a){_0x22f3be=_0xb90c7a;_0x192fe8['model']=_[_0x2949('0x4f')](db[_0x2949('0x63')][_0x2949('0x38')]);_0x192fe8[_0x2949('0x3c')]=_['keys'](_0x3af49c['query']);_0x192fe8[_0x2949('0x3d')]=_[_0x2949('0x3e')](_0x192fe8[_0x2949('0x3b')],_0x192fe8[_0x2949('0x3c')]);_0x404f80['attributes']=_[_0x2949('0x3e')](_0x192fe8[_0x2949('0x3b')],qs['fields'](_0x3af49c[_0x2949('0x3c')][_0x2949('0x40')]));_0x404f80[_0x2949('0x3f')]=_0x404f80['attributes'][_0x2949('0x50')]?_0x404f80['attributes']:_0x192fe8[_0x2949('0x3b')];_0x404f80['order']=qs[_0x2949('0x5f')](_0x3af49c[_0x2949('0x3c')][_0x2949('0x5f')]);_0x404f80['where']=qs[_0x2949('0x3d')](_[_0x2949('0x44')](_0x3af49c[_0x2949('0x3c')],_0x192fe8[_0x2949('0x3d')]));if(_0x3af49c[_0x2949('0x3c')]['filter']){_0x404f80[_0x2949('0x43')]=_[_0x2949('0x46')](_0x404f80[_0x2949('0x43')],{'$or':_['map'](_0x404f80['attributes'],function(_0x213ffe){var _0x1c7fe3={};_0x1c7fe3[_0x213ffe]={'$like':'%'+_0x3af49c[_0x2949('0x3c')]['filter']+'%'};return _0x1c7fe3;})});}_0x404f80=_['merge']({},_0x404f80,_0x3af49c[_0x2949('0x48')]);return _0x22f3be[_0x2949('0x8b')](_0x404f80);}})['then'](function(_0x5f549f){if(_0x5f549f){_0x5f0330=_0x5f549f[_0x2949('0x50')];if(!_0x3af49c[_0x2949('0x3c')][_0x2949('0x41')](_0x2949('0x5e'))){_0x404f80[_0x2949('0x27')]=qs[_0x2949('0x27')](_0x3af49c[_0x2949('0x3c')][_0x2949('0x27')]);_0x404f80[_0x2949('0x25')]=qs[_0x2949('0x25')](_0x3af49c[_0x2949('0x3c')][_0x2949('0x25')]);}return _0x22f3be[_0x2949('0x8b')](_0x404f80);}})['then'](function(_0x5d4f26){if(_0x5d4f26){return _0x5d4f26?{'count':_0x5f0330,'rows':_0x5d4f26}:null;}})[_0x2949('0x2d')](respondWithResult(_0x52cd8a,null))['catch'](handleError(_0x52cd8a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index af8768b..f379e7e 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 _0x19f2=['WhatsappQueue','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x42fba0,_0x194be7){var _0x5d8980=function(_0x40cef2){while(--_0x40cef2){_0x42fba0['push'](_0x42fba0['shift']());}};_0x5d8980(++_0x194be7);}(_0x19f2,0x1db));var _0x219f=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x19f2[_0x46401e];return _0x447cba;};'use strict';var EventEmitter=require(_0x219f('0x0'));var WhatsappQueue=require(_0x219f('0x1'))['db'][_0x219f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x219f('0x3'),'afterUpdate':_0x219f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x165571){return function(_0x4d3e39,_0x1b0640,_0x36b09e){WhatsappQueueEvents['emit'](_0x165571+':'+_0x4d3e39['id'],_0x4d3e39);WhatsappQueueEvents[_0x219f('0x5')](_0x165571,_0x4d3e39);_0x36b09e(null);};}for(var e in events){if(events[_0x219f('0x6')](e)){var event=events[e];WhatsappQueue[_0x219f('0x7')](e,emitEvent(event));}}module[_0x219f('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xc4be=['save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xc4be,0x14f));var _0xec4b=function(_0x228cc2,_0x258735){_0x228cc2=_0x228cc2-0x0;var _0x3b1c56=_0xc4be[_0x228cc2];return _0x3b1c56;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xec4b('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec4b('0x1'),'afterUpdate':_0xec4b('0x2'),'afterDestroy':_0xec4b('0x3')};function emitEvent(_0x5ec728){return function(_0x1eb5e9,_0x42032b,_0x26e0ea){WhatsappQueueEvents[_0xec4b('0x4')](_0x5ec728+':'+_0x1eb5e9['id'],_0x1eb5e9);WhatsappQueueEvents[_0xec4b('0x4')](_0x5ec728,_0x1eb5e9);_0x26e0ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xec4b('0x5')](e,emitEvent(event));}}module[_0xec4b('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 8cd6ee2..43110e5 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 _0x6f87=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x6f87,0x179));var _0x76f8=function(_0x5f520a,_0x2cd033){_0x5f520a=_0x5f520a-0x0;var _0x2d869c=_0x6f87[_0x5f520a];return _0x2d869c;};'use strict';var _=require(_0x76f8('0x0'));var util=require('util');var logger=require(_0x76f8('0x1'))(_0x76f8('0x2'));var moment=require(_0x76f8('0x3'));var BPromise=require(_0x76f8('0x4'));var rp=require(_0x76f8('0x5'));var fs=require('fs');var path=require(_0x76f8('0x6'));var rimraf=require(_0x76f8('0x7'));var config=require(_0x76f8('0x8'));var attributes=require(_0x76f8('0x9'));module[_0x76f8('0xa')]=function(_0x49460d,_0x5a7b6d){return _0x49460d[_0x76f8('0xb')](_0x76f8('0xc'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x661b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x3d12f1,_0x5b9a7b){var _0x1db71c=function(_0x13586e){while(--_0x13586e){_0x3d12f1['push'](_0x3d12f1['shift']());}};_0x1db71c(++_0x5b9a7b);}(_0x661b,0x179));var _0xb661=function(_0x5d9035,_0x4a5cd0){_0x5d9035=_0x5d9035-0x0;var _0x4c3538=_0x661b[_0x5d9035];return _0x4c3538;};'use strict';var _=require('lodash');var util=require(_0xb661('0x0'));var logger=require(_0xb661('0x1'))(_0xb661('0x2'));var moment=require(_0xb661('0x3'));var BPromise=require(_0xb661('0x4'));var rp=require(_0xb661('0x5'));var fs=require('fs');var path=require(_0xb661('0x6'));var rimraf=require(_0xb661('0x7'));var config=require('../../config/environment');var attributes=require(_0xb661('0x8'));module[_0xb661('0x9')]=function(_0x315cd6,_0x1ae5bf){return _0x315cd6[_0xb661('0xa')](_0xb661('0xb'),attributes,{'tableName':_0xb661('0xc'),'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 e63a774..2023c2d 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 _0xd52f=['http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetWhatsappQueue','findAll','options','raw','where','attributes','include','map','model','WhatsappQueue','find','ShowWhatsappQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x376ee8,_0x3cea80){var _0x467de1=function(_0x2100d1){while(--_0x2100d1){_0x376ee8['push'](_0x376ee8['shift']());}};_0x467de1(++_0x3cea80);}(_0xd52f,0x1a3));var _0xfd52=function(_0x465e00,_0x2864f2){_0x465e00=_0x465e00-0x0;var _0x48d61c=_0xd52f[_0x465e00];return _0x48d61c;};'use strict';var _=require('lodash');var util=require(_0xfd52('0x0'));var moment=require('moment');var BPromise=require(_0xfd52('0x1'));var rs=require(_0xfd52('0x2'));var fs=require('fs');var Redis=require(_0xfd52('0x3'));var db=require(_0xfd52('0x4'))['db'];var utils=require(_0xfd52('0x5'));var logger=require(_0xfd52('0x6'))(_0xfd52('0x7'));var config=require('../../config/environment');var jayson=require(_0xfd52('0x8'));var client=jayson[_0xfd52('0x9')][_0xfd52('0xa')]({'port':0x232a});config[_0xfd52('0xb')]=_['defaults'](config[_0xfd52('0xb')],{'host':_0xfd52('0xc'),'port':0x18eb});var socket=require(_0xfd52('0xd'))(new Redis(config['redis']));require(_0xfd52('0xe'))[_0xfd52('0xf')](socket);function respondWithRpcPromise(_0x3a3376,_0x5045c0,_0x11f05b){return new BPromise(function(_0x161432,_0x5de3f0){return client[_0xfd52('0x10')](_0x3a3376,_0x11f05b)[_0xfd52('0x11')](function(_0xeb4a60){logger[_0xfd52('0x12')](_0xfd52('0x13'),_0x5045c0,_0xfd52('0x14'));logger[_0xfd52('0x15')](_0xfd52('0x16'),_0x5045c0,_0xfd52('0x14'),JSON[_0xfd52('0x17')](_0xeb4a60));if(_0xeb4a60['error']){if(_0xeb4a60[_0xfd52('0x18')][_0xfd52('0x19')]===0x1f4){logger[_0xfd52('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x5045c0,_0xeb4a60[_0xfd52('0x18')][_0xfd52('0x1a')]);return _0x5de3f0(_0xeb4a60[_0xfd52('0x18')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5045c0,_0xeb4a60['error'][_0xfd52('0x1a')]);return _0x161432(_0xeb4a60[_0xfd52('0x18')][_0xfd52('0x1a')]);}else{logger[_0xfd52('0x12')](_0xfd52('0x13'),_0x5045c0,_0xfd52('0x14'));_0x161432(_0xeb4a60['result'][_0xfd52('0x1a')]);}})['catch'](function(_0x3e1170){logger[_0xfd52('0x18')](_0xfd52('0x13'),_0x5045c0,_0x3e1170);_0x5de3f0(_0x3e1170);});});}exports[_0xfd52('0x1b')]=function(_0x55b15f){var _0x21c51b=this;return new Promise(function(_0xc061bc,_0x3d876c){return db['WhatsappQueue'][_0xfd52('0x1c')]({'raw':_0x55b15f[_0xfd52('0x1d')]?_0x55b15f[_0xfd52('0x1d')][_0xfd52('0x1e')]===undefined?!![]:![]:!![],'where':_0x55b15f[_0xfd52('0x1d')]?_0x55b15f['options'][_0xfd52('0x1f')]||null:null,'attributes':_0x55b15f['options']?_0x55b15f[_0xfd52('0x1d')][_0xfd52('0x20')]||null:null,'limit':_0x55b15f[_0xfd52('0x1d')]?_0x55b15f[_0xfd52('0x1d')]['limit']||null:null,'include':_0x55b15f[_0xfd52('0x1d')]?_0x55b15f[_0xfd52('0x1d')][_0xfd52('0x21')]?_[_0xfd52('0x22')](_0x55b15f[_0xfd52('0x1d')][_0xfd52('0x21')],function(_0x497530){return{'model':db[_0x497530[_0xfd52('0x23')]],'as':_0x497530['as'],'attributes':_0x497530[_0xfd52('0x20')],'include':_0x497530[_0xfd52('0x21')]?_[_0xfd52('0x22')](_0x497530['include'],function(_0x2895ef){return{'model':db[_0x2895ef['model']],'as':_0x2895ef['as'],'attributes':_0x2895ef[_0xfd52('0x20')],'include':_0x2895ef['include']?_[_0xfd52('0x22')](_0x2895ef[_0xfd52('0x21')],function(_0xb79733){return{'model':db[_0xb79733[_0xfd52('0x23')]],'as':_0xb79733['as'],'attributes':_0xb79733['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd52('0x11')](function(_0x53b2a3){logger[_0xfd52('0x12')](_0xfd52('0x1b'),_0x55b15f);logger[_0xfd52('0x15')](_0xfd52('0x1b'),_0x55b15f,JSON[_0xfd52('0x17')](_0x53b2a3));_0xc061bc(_0x53b2a3);})['catch'](function(_0x56ca6c){logger[_0xfd52('0x18')](_0xfd52('0x1b'),_0x56ca6c[_0xfd52('0x1a')],_0x55b15f);_0x3d876c(_0x21c51b[_0xfd52('0x18')](0x1f4,_0x56ca6c[_0xfd52('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x50318b){var _0x4e8c8d=this;return new Promise(function(_0x30c2f4,_0x547ce3){return db[_0xfd52('0x24')][_0xfd52('0x25')]({'raw':_0x50318b[_0xfd52('0x1d')]?_0x50318b[_0xfd52('0x1d')][_0xfd52('0x1e')]===undefined?!![]:![]:!![],'where':_0x50318b['options']?_0x50318b[_0xfd52('0x1d')][_0xfd52('0x1f')]||null:null,'attributes':_0x50318b[_0xfd52('0x1d')]?_0x50318b['options']['attributes']||null:null,'include':_0x50318b['options']?_0x50318b['options']['include']?_[_0xfd52('0x22')](_0x50318b[_0xfd52('0x1d')][_0xfd52('0x21')],function(_0x1ff58b){return{'model':db[_0x1ff58b['model']],'as':_0x1ff58b['as'],'attributes':_0x1ff58b[_0xfd52('0x20')],'include':_0x1ff58b[_0xfd52('0x21')]?_[_0xfd52('0x22')](_0x1ff58b[_0xfd52('0x21')],function(_0xd4403a){return{'model':db[_0xd4403a[_0xfd52('0x23')]],'as':_0xd4403a['as'],'attributes':_0xd4403a[_0xfd52('0x20')],'include':_0xd4403a[_0xfd52('0x21')]?_['map'](_0xd4403a[_0xfd52('0x21')],function(_0x46c953){return{'model':db[_0x46c953[_0xfd52('0x23')]],'as':_0x46c953['as'],'attributes':_0x46c953['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd52('0x11')](function(_0x21c992){logger[_0xfd52('0x12')](_0xfd52('0x26'),_0x50318b);logger[_0xfd52('0x15')](_0xfd52('0x26'),_0x50318b,JSON[_0xfd52('0x17')](_0x21c992));_0x30c2f4(_0x21c992);})['catch'](function(_0x55a019){logger[_0xfd52('0x18')](_0xfd52('0x26'),_0x55a019['message'],_0x50318b);_0x547ce3(_0x4e8c8d[_0xfd52('0x18')](0x1f4,_0x55a019[_0xfd52('0x1a')]));});});}; \ No newline at end of file +var _0x4e50=['message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','include','map','model','attributes','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','socket.io-emitter','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1eb763,_0x327f71){var _0x52210e=function(_0x240699){while(--_0x240699){_0x1eb763['push'](_0x1eb763['shift']());}};_0x52210e(++_0x327f71);}(_0x4e50,0x1a5));var _0x04e5=function(_0x24a1fa,_0x4983dc){_0x24a1fa=_0x24a1fa-0x0;var _0x33e3bb=_0x4e50[_0x24a1fa];return _0x33e3bb;};'use strict';var _=require('lodash');var util=require(_0x04e5('0x0'));var moment=require(_0x04e5('0x1'));var BPromise=require(_0x04e5('0x2'));var rs=require(_0x04e5('0x3'));var fs=require('fs');var Redis=require(_0x04e5('0x4'));var db=require(_0x04e5('0x5'))['db'];var utils=require(_0x04e5('0x6'));var logger=require(_0x04e5('0x7'))('rpc');var config=require(_0x04e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x04e5('0x9')]['http']({'port':0x232a});config[_0x04e5('0xa')]=_['defaults'](config[_0x04e5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x04e5('0xb'))(new Redis(config[_0x04e5('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x11c793,_0x48c618,_0x5bf101){return new BPromise(function(_0x3a58e9,_0x3c82eb){return client[_0x04e5('0xc')](_0x11c793,_0x5bf101)['then'](function(_0x412759){logger[_0x04e5('0xd')](_0x04e5('0xe'),_0x48c618,_0x04e5('0xf'));logger[_0x04e5('0x10')](_0x04e5('0x11'),_0x48c618,_0x04e5('0xf'),JSON[_0x04e5('0x12')](_0x412759));if(_0x412759['error']){if(_0x412759[_0x04e5('0x13')][_0x04e5('0x14')]===0x1f4){logger[_0x04e5('0x13')](_0x04e5('0xe'),_0x48c618,_0x412759['error'][_0x04e5('0x15')]);return _0x3c82eb(_0x412759[_0x04e5('0x13')]['message']);}logger[_0x04e5('0x13')](_0x04e5('0xe'),_0x48c618,_0x412759[_0x04e5('0x13')]['message']);return _0x3a58e9(_0x412759[_0x04e5('0x13')][_0x04e5('0x15')]);}else{logger['info'](_0x04e5('0xe'),_0x48c618,_0x04e5('0xf'));_0x3a58e9(_0x412759[_0x04e5('0x16')]['message']);}})[_0x04e5('0x17')](function(_0x1452a2){logger['error'](_0x04e5('0xe'),_0x48c618,_0x1452a2);_0x3c82eb(_0x1452a2);});});}exports[_0x04e5('0x18')]=function(_0x277502){var _0x29694f=this;return new Promise(function(_0x914490,_0x36831d){return db[_0x04e5('0x19')]['findAll']({'raw':_0x277502[_0x04e5('0x1a')]?_0x277502[_0x04e5('0x1a')][_0x04e5('0x1b')]===undefined?!![]:![]:!![],'where':_0x277502[_0x04e5('0x1a')]?_0x277502['options'][_0x04e5('0x1c')]||null:null,'attributes':_0x277502[_0x04e5('0x1a')]?_0x277502[_0x04e5('0x1a')]['attributes']||null:null,'limit':_0x277502[_0x04e5('0x1a')]?_0x277502[_0x04e5('0x1a')]['limit']||null:null,'include':_0x277502['options']?_0x277502[_0x04e5('0x1a')][_0x04e5('0x1d')]?_[_0x04e5('0x1e')](_0x277502['options'][_0x04e5('0x1d')],function(_0x28e466){return{'model':db[_0x28e466[_0x04e5('0x1f')]],'as':_0x28e466['as'],'attributes':_0x28e466['attributes'],'include':_0x28e466['include']?_[_0x04e5('0x1e')](_0x28e466[_0x04e5('0x1d')],function(_0x3972d6){return{'model':db[_0x3972d6[_0x04e5('0x1f')]],'as':_0x3972d6['as'],'attributes':_0x3972d6[_0x04e5('0x20')],'include':_0x3972d6[_0x04e5('0x1d')]?_[_0x04e5('0x1e')](_0x3972d6['include'],function(_0x5df63){return{'model':db[_0x5df63['model']],'as':_0x5df63['as'],'attributes':_0x5df63[_0x04e5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfd986b){logger['info'](_0x04e5('0x18'),_0x277502);logger[_0x04e5('0x10')](_0x04e5('0x18'),_0x277502,JSON[_0x04e5('0x12')](_0xfd986b));_0x914490(_0xfd986b);})[_0x04e5('0x17')](function(_0x4475d6){logger[_0x04e5('0x13')]('GetWhatsappQueue',_0x4475d6[_0x04e5('0x15')],_0x277502);_0x36831d(_0x29694f[_0x04e5('0x13')](0x1f4,_0x4475d6[_0x04e5('0x15')]));});});};exports[_0x04e5('0x21')]=function(_0x5107a4){var _0x2fc01e=this;return new Promise(function(_0x42d4c4,_0x303949){return db[_0x04e5('0x19')]['find']({'raw':_0x5107a4[_0x04e5('0x1a')]?_0x5107a4[_0x04e5('0x1a')][_0x04e5('0x1b')]===undefined?!![]:![]:!![],'where':_0x5107a4['options']?_0x5107a4['options'][_0x04e5('0x1c')]||null:null,'attributes':_0x5107a4[_0x04e5('0x1a')]?_0x5107a4['options'][_0x04e5('0x20')]||null:null,'include':_0x5107a4['options']?_0x5107a4[_0x04e5('0x1a')]['include']?_[_0x04e5('0x1e')](_0x5107a4[_0x04e5('0x1a')][_0x04e5('0x1d')],function(_0x223d7c){return{'model':db[_0x223d7c[_0x04e5('0x1f')]],'as':_0x223d7c['as'],'attributes':_0x223d7c[_0x04e5('0x20')],'include':_0x223d7c[_0x04e5('0x1d')]?_[_0x04e5('0x1e')](_0x223d7c[_0x04e5('0x1d')],function(_0x391637){return{'model':db[_0x391637[_0x04e5('0x1f')]],'as':_0x391637['as'],'attributes':_0x391637['attributes'],'include':_0x391637[_0x04e5('0x1d')]?_[_0x04e5('0x1e')](_0x391637['include'],function(_0x116586){return{'model':db[_0x116586['model']],'as':_0x116586['as'],'attributes':_0x116586[_0x04e5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f6515){logger[_0x04e5('0xd')](_0x04e5('0x21'),_0x5107a4);logger[_0x04e5('0x10')](_0x04e5('0x21'),_0x5107a4,JSON[_0x04e5('0x12')](_0x4f6515));_0x42d4c4(_0x4f6515);})[_0x04e5('0x17')](function(_0xd8e304){logger[_0x04e5('0x13')]('ShowWhatsappQueue',_0xd8e304[_0x04e5('0x15')],_0x5107a4);_0x303949(_0x2fc01e[_0x04e5('0x13')](0x1f4,_0xd8e304[_0x04e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5209244..29588ea 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 _0xc9d0=['register','length','save','emit','removeListener'];(function(_0x1a4fe4,_0x109009){var _0x1c5bca=function(_0x3f5b1b){while(--_0x3f5b1b){_0x1a4fe4['push'](_0x1a4fe4['shift']());}};_0x1c5bca(++_0x109009);}(_0xc9d0,0x156));var _0x0c9d=function(_0xe866e8,_0x2730ef){_0xe866e8=_0xe866e8-0x0;var _0x393bd6=_0xc9d0[_0xe866e8];return _0x393bd6;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x0c9d('0x0'),'remove','update'];function createListener(_0x492a36,_0x2fa51e){return function(_0x448dd1){_0x2fa51e[_0x0c9d('0x1')](_0x492a36,_0x448dd1);};}function removeListener(_0x456431,_0x2c72e8){return function(){WhatsappQueueEvents[_0x0c9d('0x2')](_0x456431,_0x2c72e8);};}exports[_0x0c9d('0x3')]=function(_0x4568c0){for(var _0x1a861e=0x0,_0x395b00=events[_0x0c9d('0x4')];_0x1a861e<_0x395b00;_0x1a861e++){var _0x75453b=events[_0x1a861e];var _0x49de02=createListener('whatsappQueue:'+_0x75453b,_0x4568c0);WhatsappQueueEvents['on'](_0x75453b,_0x49de02);}}; \ No newline at end of file +var _0x15bc=['./whatsappQueue.events','remove','update','emit','removeListener','register','length','whatsappQueue:'];(function(_0x2515da,_0x4b2f3f){var _0x46358e=function(_0x348d86){while(--_0x348d86){_0x2515da['push'](_0x2515da['shift']());}};_0x46358e(++_0x4b2f3f);}(_0x15bc,0x100));var _0xc15b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15bc[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0xc15b('0x0'));var events=['save',_0xc15b('0x1'),_0xc15b('0x2')];function createListener(_0x38550b,_0x18e866){return function(_0xe203c0){_0x18e866[_0xc15b('0x3')](_0x38550b,_0xe203c0);};}function removeListener(_0x5252f2,_0x416c5a){return function(){WhatsappQueueEvents[_0xc15b('0x4')](_0x5252f2,_0x416c5a);};}exports[_0xc15b('0x5')]=function(_0x7efa0c){for(var _0x4ce219=0x0,_0x3ed9f6=events[_0xc15b('0x6')];_0x4ce219<_0x3ed9f6;_0x4ce219++){var _0x45f07d=events[_0x4ce219];var _0x3d89e5=createListener(_0xc15b('0x7')+_0x45f07d,_0x7efa0c);WhatsappQueueEvents['on'](_0x45f07d,_0x3d89e5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5623f35..a92c9ce 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 _0x48f2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x53801b,_0x5feff1){var _0x5a9482=function(_0xc094f){while(--_0xc094f){_0x53801b['push'](_0x53801b['shift']());}};_0x5a9482(++_0x5feff1);}(_0x48f2,0xd8));var _0x248f=function(_0x35b06e,_0x104588){_0x35b06e=_0x35b06e-0x0;var _0x1cbc73=_0x48f2[_0x35b06e];return _0x1cbc73;};'use strict';var multer=require('multer');var util=require(_0x248f('0x0'));var path=require(_0x248f('0x1'));var timeout=require(_0x248f('0x2'));var express=require(_0x248f('0x3'));var router=express[_0x248f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x248f('0x5'));var interaction=require(_0x248f('0x6'));var config=require(_0x248f('0x7'));var controller=require(_0x248f('0x8'));router[_0x248f('0x9')]('/',auth[_0x248f('0xa')](),controller[_0x248f('0xb')]);router[_0x248f('0x9')](_0x248f('0xc'),auth[_0x248f('0xa')](),controller[_0x248f('0xd')]);router[_0x248f('0x9')](_0x248f('0xe'),auth[_0x248f('0xa')](),controller[_0x248f('0xf')]);router[_0x248f('0x10')]('/',auth[_0x248f('0xa')](),controller[_0x248f('0x11')]);router['put']('/:id',auth[_0x248f('0xa')](),controller[_0x248f('0x12')]);router[_0x248f('0x13')](_0x248f('0xe'),auth[_0x248f('0xa')](),controller[_0x248f('0x14')]);module[_0x248f('0x15')]=router; \ No newline at end of file +var _0xcb2e=['fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x5085d6,_0x3a72fc){var _0x29d829=function(_0x1cbd40){while(--_0x1cbd40){_0x5085d6['push'](_0x5085d6['shift']());}};_0x29d829(++_0x3a72fc);}(_0xcb2e,0x1ea));var _0xecb2=function(_0x2dbcbb,_0x560e27){_0x2dbcbb=_0x2dbcbb-0x0;var _0x460204=_0xcb2e[_0x2dbcbb];return _0x460204;};'use strict';var multer=require(_0xecb2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xecb2('0x1'));var express=require(_0xecb2('0x2'));var router=express[_0xecb2('0x3')]();var fs_extra=require(_0xecb2('0x4'));var auth=require(_0xecb2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xecb2('0x6'));var controller=require(_0xecb2('0x7'));router[_0xecb2('0x8')]('/',auth[_0xecb2('0x9')](),controller[_0xecb2('0xa')]);router[_0xecb2('0x8')](_0xecb2('0xb'),auth[_0xecb2('0x9')](),controller[_0xecb2('0xc')]);router['get'](_0xecb2('0xd'),auth[_0xecb2('0x9')](),controller['show']);router[_0xecb2('0xe')]('/',auth[_0xecb2('0x9')](),controller['create']);router[_0xecb2('0xf')](_0xecb2('0xd'),auth[_0xecb2('0x9')](),controller[_0xecb2('0x10')]);router['delete'](_0xecb2('0xd'),auth[_0xecb2('0x9')](),controller[_0xecb2('0x11')]);module[_0xecb2('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0381ec4..7bae11c 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x47e6b7,_0x179fef){var _0x57cbd2=function(_0x538d9c){while(--_0x538d9c){_0x47e6b7['push'](_0x47e6b7['shift']());}};_0x57cbd2(++_0x179fef);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x56087e,_0x43fd54){var _0x10d62f=function(_0x244b90){while(--_0x244b90){_0x56087e['push'](_0x56087e['shift']());}};_0x10d62f(++_0x43fd54);}(_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 993028e..5d92cda 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 _0xbfcc=['destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','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','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then'];(function(_0x3e69fc,_0x46f306){var _0x5ed51e=function(_0x2c52ec){while(--_0x2c52ec){_0x3e69fc['push'](_0x3e69fc['shift']());}};_0x5ed51e(++_0x46f306);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xbfcc[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x51284a,_0x280b78){return function(_0x75bca0){if(!_0x75bca0){_0x51284a['sendStatus'](0x194);}return _0x75bca0;};}function handleError(_0x28bdcf,_0x3b73a3){_0x3b73a3=_0x3b73a3||0x1f4;return function(_0x4ab48e){logger[_0xcbfc('0x23')](_0x4ab48e[_0xcbfc('0x24')]);if(_0x4ab48e[_0xcbfc('0x25')]){delete _0x4ab48e[_0xcbfc('0x25')];}_0x28bdcf['status'](_0x3b73a3)[_0xcbfc('0x26')](_0x4ab48e);};}exports[_0xcbfc('0x27')]=function(_0x4f632a,_0x1f6a14){var _0x26463f={},_0x7cbdfa={},_0x388d41={'count':0x0,'rows':[]};var _0x2b4286=_[_0xcbfc('0x28')](db[_0xcbfc('0x29')]['rawAttributes'],function(_0x41b68b){return{'name':_0x41b68b[_0xcbfc('0x2a')],'type':_0x41b68b[_0xcbfc('0x2b')][_0xcbfc('0x2c')]};});_0x7cbdfa['model']=_[_0xcbfc('0x28')](_0x2b4286,_0xcbfc('0x25'));_0x7cbdfa[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x4f632a[_0xcbfc('0x2d')]);_0x7cbdfa[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x7cbdfa['model'],_0x7cbdfa[_0xcbfc('0x2d')]);_0x26463f[_0xcbfc('0x31')]=_['intersection'](_0x7cbdfa[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x4f632a[_0xcbfc('0x2d')]['fields']));_0x26463f['attributes']=_0x26463f['attributes'][_0xcbfc('0x34')]?_0x26463f[_0xcbfc('0x31')]:_0x7cbdfa[_0xcbfc('0x32')];if(!_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x35')](_0xcbfc('0x36'))){_0x26463f[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x4f632a['query'][_0xcbfc('0x19')]);_0x26463f[_0xcbfc('0x1b')]=qs['offset'](_0x4f632a[_0xcbfc('0x2d')]['offset']);}_0x26463f[_0xcbfc('0x37')]=qs[_0xcbfc('0x38')](_0x4f632a[_0xcbfc('0x2d')]['sort']);_0x26463f[_0xcbfc('0x39')]=qs['filters'](_['pick'](_0x4f632a[_0xcbfc('0x2d')],_0x7cbdfa[_0xcbfc('0x2f')]),_0x2b4286);if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]){_0x26463f[_0xcbfc('0x39')]=_[_0xcbfc('0x3b')](_0x26463f[_0xcbfc('0x39')],{'$or':_[_0xcbfc('0x28')](_0x2b4286,function(_0x5cf4fa){if(_0x5cf4fa[_0xcbfc('0x2b')]!=='VIRTUAL'){var _0x15a5c4={};_0x15a5c4[_0x5cf4fa[_0xcbfc('0x25')]]={'$like':'%'+_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]+'%'};return _0x15a5c4;}})});}_0x26463f=_['merge']({},_0x26463f,_0x4f632a['options']);var _0x236b66={'where':_0x26463f[_0xcbfc('0x39')]};return db[_0xcbfc('0x29')][_0xcbfc('0x1c')](_0x236b66)[_0xcbfc('0x21')](function(_0x4aa189){_0x388d41[_0xcbfc('0x1c')]=_0x4aa189;if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x26463f['include']=[{'all':!![]}];}return db[_0xcbfc('0x29')][_0xcbfc('0x3d')](_0x26463f);})[_0xcbfc('0x21')](function(_0x4ca55c){_0x388d41[_0xcbfc('0x3e')]=_0x4ca55c;return _0x388d41;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x1f6a14,_0x26463f))[_0xcbfc('0x3f')](handleError(_0x1f6a14,null));};exports[_0xcbfc('0x40')]=function(_0x102f4f,_0x28447a){var _0x1e14bb={'raw':!![],'where':{'id':_0x102f4f[_0xcbfc('0x41')]['id']}},_0x561544={};_0x561544[_0xcbfc('0x32')]=_['keys'](db[_0xcbfc('0x29')][_0xcbfc('0x42')]);_0x561544[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x102f4f[_0xcbfc('0x2d')]);_0x561544[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],_0x561544['query']);_0x1e14bb[_0xcbfc('0x31')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x33')]));_0x1e14bb[_0xcbfc('0x31')]=_0x1e14bb['attributes'][_0xcbfc('0x34')]?_0x1e14bb[_0xcbfc('0x31')]:_0x561544['model'];if(_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x1e14bb[_0xcbfc('0x43')]=[{'all':!![]}];}_0x1e14bb=_['merge']({},_0x1e14bb,_0x102f4f[_0xcbfc('0x44')]);return db[_0xcbfc('0x29')][_0xcbfc('0x45')](_0x1e14bb)[_0xcbfc('0x21')](handleEntityNotFound(_0x28447a,null))[_0xcbfc('0x21')](respondWithResult(_0x28447a,null))[_0xcbfc('0x3f')](handleError(_0x28447a,null));};exports[_0xcbfc('0x46')]=function(_0x55fc0b,_0x5a87b6){return db[_0xcbfc('0x29')][_0xcbfc('0x46')](_0x55fc0b[_0xcbfc('0x47')],{})[_0xcbfc('0x21')](respondWithResult(_0x5a87b6,0xc9))['catch'](handleError(_0x5a87b6,null));};exports['update']=function(_0x2e89bf,_0xe5c5ef){if(_0x2e89bf[_0xcbfc('0x47')]['id']){delete _0x2e89bf['body']['id'];}return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0x2e89bf[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0xe5c5ef,null))[_0xcbfc('0x21')](saveUpdates(_0x2e89bf[_0xcbfc('0x47')],null))[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,null))[_0xcbfc('0x3f')](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x22')]=function(_0xd9976d,_0x222b58){return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0xd9976d[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0x222b58,null))[_0xcbfc('0x21')](removeEntity(_0x222b58,null))[_0xcbfc('0x3f')](handleError(_0x222b58,null));};exports[_0xcbfc('0x48')]=function(_0x5c2ad9,_0x28ae7f){return db[_0xcbfc('0x29')]['describe']()[_0xcbfc('0x21')](respondWithResult(_0x28ae7f,null))[_0xcbfc('0x3f')](handleError(_0x28ae7f,null));}; \ No newline at end of file +var _0xe5b5=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','create','body','find','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','jsforce','desk.js','querystring','papaparse'];(function(_0xc0a7ca,_0x6cd6bd){var _0x154586=function(_0x44748e){while(--_0x44748e){_0xc0a7ca['push'](_0xc0a7ca['shift']());}};_0x154586(++_0x6cd6bd);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xe5b5[_0x434783];return _0x13efcf;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0x4da321,_0x1ebb11){return function(_0x75800d){if(!_0x75800d){_0x4da321[_0x5e5b('0x1b')](0x194);}return _0x75800d;};}function handleError(_0x5a2ba8,_0x988e5d){_0x988e5d=_0x988e5d||0x1f4;return function(_0xdb2863){logger['error'](_0xdb2863[_0x5e5b('0x29')]);if(_0xdb2863[_0x5e5b('0x2a')]){delete _0xdb2863[_0x5e5b('0x2a')];}_0x5a2ba8[_0x5e5b('0x1c')](_0x988e5d)[_0x5e5b('0x2b')](_0xdb2863);};}exports[_0x5e5b('0x2c')]=function(_0x2cb695,_0x2b4351){var _0x3f6b25={},_0x42da3b={},_0xcb272c={'count':0x0,'rows':[]};var _0x28157a=_['map'](db['WhatsappQueueReport'][_0x5e5b('0x2d')],function(_0x289f54){return{'name':_0x289f54[_0x5e5b('0x2e')],'type':_0x289f54[_0x5e5b('0x2f')][_0x5e5b('0x30')]};});_0x42da3b['model']=_[_0x5e5b('0x31')](_0x28157a,'name');_0x42da3b[_0x5e5b('0x32')]=_[_0x5e5b('0x33')](_0x2cb695[_0x5e5b('0x32')]);_0x42da3b[_0x5e5b('0x34')]=_['intersection'](_0x42da3b[_0x5e5b('0x35')],_0x42da3b[_0x5e5b('0x32')]);_0x3f6b25['attributes']=_[_0x5e5b('0x36')](_0x42da3b[_0x5e5b('0x35')],qs[_0x5e5b('0x37')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x3f6b25[_0x5e5b('0x38')]=_0x3f6b25[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x3f6b25['attributes']:_0x42da3b[_0x5e5b('0x35')];if(!_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3a')](_0x5e5b('0x3b'))){_0x3f6b25[_0x5e5b('0x3c')]=qs[_0x5e5b('0x3c')](_0x2cb695['query']['limit']);_0x3f6b25[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x2cb695[_0x5e5b('0x32')]['offset']);}_0x3f6b25[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3e')]);_0x3f6b25['where']=qs[_0x5e5b('0x34')](_[_0x5e5b('0x3f')](_0x2cb695['query'],_0x42da3b['filters']),_0x28157a);if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]){_0x3f6b25[_0x5e5b('0x41')]=_['merge'](_0x3f6b25[_0x5e5b('0x41')],{'$or':_['map'](_0x28157a,function(_0x5cb741){if(_0x5cb741[_0x5e5b('0x2f')]!==_0x5e5b('0x42')){var _0xef0295={};_0xef0295[_0x5cb741[_0x5e5b('0x2a')]]={'$like':'%'+_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]+'%'};return _0xef0295;}})});}_0x3f6b25=_[_0x5e5b('0x43')]({},_0x3f6b25,_0x2cb695[_0x5e5b('0x44')]);var _0x1034fa={'where':_0x3f6b25['where']};return db[_0x5e5b('0x45')][_0x5e5b('0x20')](_0x1034fa)['then'](function(_0x204487){_0xcb272c['count']=_0x204487;if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x46')]){_0x3f6b25[_0x5e5b('0x47')]=[{'all':!![]}];}return db[_0x5e5b('0x45')][_0x5e5b('0x48')](_0x3f6b25);})[_0x5e5b('0x27')](function(_0x371550){_0xcb272c[_0x5e5b('0x49')]=_0x371550;return _0xcb272c;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x2b4351,_0x3f6b25))[_0x5e5b('0x4a')](handleError(_0x2b4351,null));};exports[_0x5e5b('0x4b')]=function(_0x4e6fe2,_0x2b81dd){var _0x40e8ce={'raw':!![],'where':{'id':_0x4e6fe2['params']['id']}},_0x46fec9={};_0x46fec9[_0x5e5b('0x35')]=_[_0x5e5b('0x33')](db['WhatsappQueueReport'][_0x5e5b('0x2d')]);_0x46fec9[_0x5e5b('0x32')]=_['keys'](_0x4e6fe2[_0x5e5b('0x32')]);_0x46fec9['filters']=_['intersection'](_0x46fec9['model'],_0x46fec9[_0x5e5b('0x32')]);_0x40e8ce['attributes']=_[_0x5e5b('0x36')](_0x46fec9['model'],qs[_0x5e5b('0x37')](_0x4e6fe2[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x40e8ce[_0x5e5b('0x38')]=_0x40e8ce[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x40e8ce[_0x5e5b('0x38')]:_0x46fec9['model'];if(_0x4e6fe2['query'][_0x5e5b('0x46')]){_0x40e8ce['include']=[{'all':!![]}];}_0x40e8ce=_['merge']({},_0x40e8ce,_0x4e6fe2['options']);return db[_0x5e5b('0x45')]['find'](_0x40e8ce)[_0x5e5b('0x27')](handleEntityNotFound(_0x2b81dd,null))[_0x5e5b('0x27')](respondWithResult(_0x2b81dd,null))[_0x5e5b('0x4a')](handleError(_0x2b81dd,null));};exports[_0x5e5b('0x4c')]=function(_0x2982e7,_0x192445){return db['WhatsappQueueReport'][_0x5e5b('0x4c')](_0x2982e7[_0x5e5b('0x4d')],{})['then'](respondWithResult(_0x192445,0xc9))[_0x5e5b('0x4a')](handleError(_0x192445,null));};exports['update']=function(_0x41e4b3,_0x36d8fa){if(_0x41e4b3[_0x5e5b('0x4d')]['id']){delete _0x41e4b3[_0x5e5b('0x4d')]['id'];}return db['WhatsappQueueReport'][_0x5e5b('0x4e')]({'where':{'id':_0x41e4b3[_0x5e5b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36d8fa,null))[_0x5e5b('0x27')](saveUpdates(_0x41e4b3[_0x5e5b('0x4d')],null))[_0x5e5b('0x27')](respondWithResult(_0x36d8fa,null))[_0x5e5b('0x4a')](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x28')]=function(_0x5ae8d0,_0x50fc9c){return db[_0x5e5b('0x45')][_0x5e5b('0x4e')]({'where':{'id':_0x5ae8d0['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x50fc9c,null))[_0x5e5b('0x27')](removeEntity(_0x50fc9c,null))[_0x5e5b('0x4a')](handleError(_0x50fc9c,null));};exports['describe']=function(_0x3f9d26,_0x3e0ce5){return db[_0x5e5b('0x45')]['describe']()[_0x5e5b('0x27')](respondWithResult(_0x3e0ce5,null))[_0x5e5b('0x4a')](handleError(_0x3e0ce5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8001f04..b7cd2fc 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 _0x50e0=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b2fb9,_0x2fb41b){var _0x1eb74b=function(_0x1e1cf5){while(--_0x1e1cf5){_0x4b2fb9['push'](_0x4b2fb9['shift']());}};_0x1eb74b(++_0x2fb41b);}(_0x50e0,0x157));var _0x050e=function(_0x58fd7e,_0x582692){_0x58fd7e=_0x58fd7e-0x0;var _0x9d9a05=_0x50e0[_0x58fd7e];return _0x9d9a05;};'use strict';var _=require(_0x050e('0x0'));var util=require('util');var logger=require(_0x050e('0x1'))(_0x050e('0x2'));var moment=require('moment');var BPromise=require(_0x050e('0x3'));var rp=require(_0x050e('0x4'));var fs=require('fs');var path=require(_0x050e('0x5'));var rimraf=require(_0x050e('0x6'));var config=require(_0x050e('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x050e('0x8')]=function(_0x4b4a2d,_0x1c62c0){return _0x4b4a2d[_0x050e('0x9')](_0x050e('0xa'),attributes,{'tableName':_0x050e('0xb'),'paranoid':![],'indexes':[{'name':_0x050e('0xc'),'fields':[_0x050e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f22=['util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid'];(function(_0x4b0dc2,_0x62ecfd){var _0x293630=function(_0x2f1344){while(--_0x2f1344){_0x4b0dc2['push'](_0x4b0dc2['shift']());}};_0x293630(++_0x62ecfd);}(_0x2f22,0x12c));var _0x22f2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2f22[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x22f2('0x0'));var logger=require('../../config/logger')(_0x22f2('0x1'));var moment=require(_0x22f2('0x2'));var BPromise=require(_0x22f2('0x3'));var rp=require(_0x22f2('0x4'));var fs=require('fs');var path=require(_0x22f2('0x5'));var rimraf=require('rimraf');var config=require(_0x22f2('0x6'));var attributes=require(_0x22f2('0x7'));module[_0x22f2('0x8')]=function(_0x2a07b9,_0x4d2e26){return _0x2a07b9[_0x22f2('0x9')](_0x22f2('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x22f2('0xb'),'fields':[_0x22f2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9f121fc..62bde63 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 _0x457f=['result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x251e39,_0x118f38){var _0x27791b=function(_0x4bf0f7){while(--_0x4bf0f7){_0x251e39['push'](_0x251e39['shift']());}};_0x27791b(++_0x118f38);}(_0x457f,0x148));var _0xf457=function(_0x2792ad,_0x34ef3e){_0x2792ad=_0x2792ad-0x0;var _0x2b3ee5=_0x457f[_0x2792ad];return _0x2b3ee5;};'use strict';var _=require(_0xf457('0x0'));var util=require(_0xf457('0x1'));var moment=require('moment');var BPromise=require(_0xf457('0x2'));var rs=require(_0xf457('0x3'));var fs=require('fs');var Redis=require(_0xf457('0x4'));var db=require(_0xf457('0x5'))['db'];var utils=require(_0xf457('0x6'));var logger=require(_0xf457('0x7'))(_0xf457('0x8'));var config=require(_0xf457('0x9'));var jayson=require(_0xf457('0xa'));var client=jayson['client'][_0xf457('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x495d6b,_0x1b8af9,_0x3f513a){return new BPromise(function(_0x57b23f,_0x50df30){return client[_0xf457('0xc')](_0x495d6b,_0x3f513a)['then'](function(_0x51500f){logger['info'](_0xf457('0xd'),_0x1b8af9,_0xf457('0xe'));logger[_0xf457('0xf')](_0xf457('0x10'),_0x1b8af9,_0xf457('0xe'),JSON[_0xf457('0x11')](_0x51500f));if(_0x51500f[_0xf457('0x12')]){if(_0x51500f['error'][_0xf457('0x13')]===0x1f4){logger[_0xf457('0x12')](_0xf457('0xd'),_0x1b8af9,_0x51500f[_0xf457('0x12')][_0xf457('0x14')]);return _0x50df30(_0x51500f[_0xf457('0x12')][_0xf457('0x14')]);}logger[_0xf457('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1b8af9,_0x51500f[_0xf457('0x12')][_0xf457('0x14')]);return _0x57b23f(_0x51500f[_0xf457('0x12')][_0xf457('0x14')]);}else{logger[_0xf457('0x15')](_0xf457('0xd'),_0x1b8af9,'request\x20sent');_0x57b23f(_0x51500f[_0xf457('0x16')][_0xf457('0x14')]);}})[_0xf457('0x17')](function(_0x1f10d3){logger['error'](_0xf457('0xd'),_0x1b8af9,_0x1f10d3);_0x50df30(_0x1f10d3);});});}exports[_0xf457('0x18')]=function(_0x5ab459){var _0x1827cd=this;return new Promise(function(_0x1eb46e,_0x482af0){return db[_0xf457('0x19')][_0xf457('0x1a')](_0x5ab459[_0xf457('0x1b')],{'raw':_0x5ab459[_0xf457('0x1c')]?_0x5ab459[_0xf457('0x1c')][_0xf457('0x1d')]===undefined?!![]:![]:!![]})[_0xf457('0x1e')](function(_0x2b4c67){logger['info'](_0xf457('0x18'),_0x5ab459);logger[_0xf457('0xf')](_0xf457('0x18'),_0x5ab459,JSON[_0xf457('0x11')](_0x2b4c67));_0x1eb46e(_0x2b4c67);})[_0xf457('0x17')](function(_0x5397a1){logger['error'](_0xf457('0x18'),_0x5397a1['message'],_0x5ab459);_0x482af0(_0x1827cd[_0xf457('0x12')](0x1f4,_0x5397a1['message']));});});};exports[_0xf457('0x1f')]=function(_0x2c6b6a){var _0x1a32cb=this;return new Promise(function(_0x33d7d1,_0x3d4352){return db[_0xf457('0x19')][_0xf457('0x20')](_0x2c6b6a[_0xf457('0x1b')],{'raw':_0x2c6b6a[_0xf457('0x1c')]?_0x2c6b6a[_0xf457('0x1c')][_0xf457('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6b6a[_0xf457('0x1c')]?_0x2c6b6a['options'][_0xf457('0x21')]||null:null,'attributes':_0x2c6b6a[_0xf457('0x1c')]?_0x2c6b6a[_0xf457('0x1c')][_0xf457('0x22')]||null:null,'limit':_0x2c6b6a[_0xf457('0x1c')]?_0x2c6b6a['options']['limit']||null:null})[_0xf457('0x1e')](function(_0x432c30){logger[_0xf457('0x15')]('UpdateWhatsappQueueReport',_0x2c6b6a);logger[_0xf457('0xf')]('UpdateWhatsappQueueReport',_0x2c6b6a,JSON[_0xf457('0x11')](_0x432c30));_0x33d7d1(_0x432c30);})[_0xf457('0x17')](function(_0x281b50){logger['error'](_0xf457('0x1f'),_0x281b50['message'],_0x2c6b6a);_0x3d4352(_0x1a32cb[_0xf457('0x12')](0x1f4,_0x281b50[_0xf457('0x14')]));});});}; \ No newline at end of file +var _0x3ea3=['request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','UpdateWhatsappQueueReport','raw','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x66808a,_0x60f3bd){var _0x760006=function(_0x520c41){while(--_0x520c41){_0x66808a['push'](_0x66808a['shift']());}};_0x760006(++_0x60f3bd);}(_0x3ea3,0x1c7));var _0x33ea=function(_0x4e83f7,_0x4dcb77){_0x4e83f7=_0x4e83f7-0x0;var _0x451d6b=_0x3ea3[_0x4e83f7];return _0x451d6b;};'use strict';var _=require(_0x33ea('0x0'));var util=require(_0x33ea('0x1'));var moment=require(_0x33ea('0x2'));var BPromise=require(_0x33ea('0x3'));var rs=require(_0x33ea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x33ea('0x6'))(_0x33ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x33ea('0x8'));var client=jayson['client'][_0x33ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x308638,_0x53e2d5,_0xf3f1ba){return new BPromise(function(_0x4d92e4,_0x45099f){return client[_0x33ea('0xa')](_0x308638,_0xf3f1ba)['then'](function(_0x777a72){logger[_0x33ea('0xb')](_0x33ea('0xc'),_0x53e2d5,_0x33ea('0xd'));logger[_0x33ea('0xe')](_0x33ea('0xf'),_0x53e2d5,_0x33ea('0xd'),JSON[_0x33ea('0x10')](_0x777a72));if(_0x777a72[_0x33ea('0x11')]){if(_0x777a72[_0x33ea('0x11')][_0x33ea('0x12')]===0x1f4){logger[_0x33ea('0x11')](_0x33ea('0xc'),_0x53e2d5,_0x777a72[_0x33ea('0x11')][_0x33ea('0x13')]);return _0x45099f(_0x777a72[_0x33ea('0x11')][_0x33ea('0x13')]);}logger[_0x33ea('0x11')](_0x33ea('0xc'),_0x53e2d5,_0x777a72[_0x33ea('0x11')][_0x33ea('0x13')]);return _0x4d92e4(_0x777a72[_0x33ea('0x11')][_0x33ea('0x13')]);}else{logger[_0x33ea('0xb')](_0x33ea('0xc'),_0x53e2d5,_0x33ea('0xd'));_0x4d92e4(_0x777a72[_0x33ea('0x14')][_0x33ea('0x13')]);}})[_0x33ea('0x15')](function(_0x15af37){logger[_0x33ea('0x11')](_0x33ea('0xc'),_0x53e2d5,_0x15af37);_0x45099f(_0x15af37);});});}exports[_0x33ea('0x16')]=function(_0x1a4b60){var _0x3db16c=this;return new Promise(function(_0x43856f,_0x3c4844){return db[_0x33ea('0x17')][_0x33ea('0x18')](_0x1a4b60[_0x33ea('0x19')],{'raw':_0x1a4b60[_0x33ea('0x1a')]?_0x1a4b60[_0x33ea('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x33ea('0x1b')](function(_0x1c35a9){logger[_0x33ea('0xb')](_0x33ea('0x16'),_0x1a4b60);logger[_0x33ea('0xe')](_0x33ea('0x16'),_0x1a4b60,JSON[_0x33ea('0x10')](_0x1c35a9));_0x43856f(_0x1c35a9);})['catch'](function(_0x2e434a){logger[_0x33ea('0x11')](_0x33ea('0x16'),_0x2e434a['message'],_0x1a4b60);_0x3c4844(_0x3db16c[_0x33ea('0x11')](0x1f4,_0x2e434a[_0x33ea('0x13')]));});});};exports[_0x33ea('0x1c')]=function(_0xb1b806){var _0x2665b9=this;return new Promise(function(_0x2592a3,_0x40eb0e){return db[_0x33ea('0x17')]['update'](_0xb1b806[_0x33ea('0x19')],{'raw':_0xb1b806[_0x33ea('0x1a')]?_0xb1b806[_0x33ea('0x1a')][_0x33ea('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb1b806['options']?_0xb1b806['options']['where']||null:null,'attributes':_0xb1b806[_0x33ea('0x1a')]?_0xb1b806[_0x33ea('0x1a')]['attributes']||null:null,'limit':_0xb1b806[_0x33ea('0x1a')]?_0xb1b806[_0x33ea('0x1a')][_0x33ea('0x1e')]||null:null})[_0x33ea('0x1b')](function(_0x3c5475){logger[_0x33ea('0xb')](_0x33ea('0x1c'),_0xb1b806);logger[_0x33ea('0xe')](_0x33ea('0x1c'),_0xb1b806,JSON[_0x33ea('0x10')](_0x3c5475));_0x2592a3(_0x3c5475);})[_0x33ea('0x15')](function(_0x37b857){logger[_0x33ea('0x11')](_0x33ea('0x1c'),_0x37b857['message'],_0xb1b806);_0x40eb0e(_0x2665b9[_0x33ea('0x11')](0x1f4,_0x37b857[_0x33ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9f1fbfe..dce49e7 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 _0x409d=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x409d,0x190));var _0xd409=function(_0xadfe2,_0x2f3413){_0xadfe2=_0xadfe2-0x0;var _0x420f57=_0x409d[_0xadfe2];return _0x420f57;};'use strict';var multer=require(_0xd409('0x0'));var util=require(_0xd409('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd409('0x2'));var router=express[_0xd409('0x3')]();var fs_extra=require(_0xd409('0x4'));var auth=require(_0xd409('0x5'));var interaction=require(_0xd409('0x6'));var config=require(_0xd409('0x7'));var controller=require(_0xd409('0x8'));router[_0xd409('0x9')]('/',auth[_0xd409('0xa')](),controller[_0xd409('0xb')]);router[_0xd409('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd409('0x9')](_0xd409('0xc'),auth['isAuthenticated'](),controller[_0xd409('0xd')]);router[_0xd409('0xe')]('/',auth['isAuthenticated'](),controller[_0xd409('0xf')]);router[_0xd409('0x10')](_0xd409('0xc'),auth[_0xd409('0xa')](),controller[_0xd409('0x11')]);router[_0xd409('0x12')](_0xd409('0xc'),auth['isAuthenticated'](),controller[_0xd409('0x13')]);module[_0xd409('0x14')]=router; \ No newline at end of file +var _0x5712=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','describe','/:id','post','create','update'];(function(_0x39b5f2,_0x2583cd){var _0x1a8c99=function(_0x3c81d9){while(--_0x3c81d9){_0x39b5f2['push'](_0x39b5f2['shift']());}};_0x1a8c99(++_0x2583cd);}(_0x5712,0x134));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x2571('0x0'));var path=require('path');var timeout=require(_0x2571('0x1'));var express=require(_0x2571('0x2'));var router=express[_0x2571('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2571('0x4'));var interaction=require(_0x2571('0x5'));var config=require(_0x2571('0x6'));var controller=require(_0x2571('0x7'));router['get']('/',auth[_0x2571('0x8')](),controller['index']);router[_0x2571('0x9')]('/describe',auth[_0x2571('0x8')](),controller[_0x2571('0xa')]);router[_0x2571('0x9')](_0x2571('0xb'),auth[_0x2571('0x8')](),controller['show']);router[_0x2571('0xc')]('/',auth[_0x2571('0x8')](),controller[_0x2571('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2571('0xe')]);router[_0x2571('0xf')](_0x2571('0xb'),auth[_0x2571('0x8')](),controller['destroy']);module[_0x2571('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index df6f1f5..08db7a8 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 _0x6000=['agent','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x3525ff,_0x2cc4ad){var _0x4422cf=function(_0x1b479c){while(--_0x1b479c){_0x3525ff['push'](_0x3525ff['shift']());}};_0x4422cf(++_0x2cc4ad);}(_0x6000,0x17c));var _0x0600=function(_0xcd696d,_0x13ada3){_0xcd696d=_0xcd696d-0x0;var _0x4c7e4e=_0x6000[_0xcd696d];return _0x4c7e4e;};'use strict';var Sequelize=require(_0x0600('0x0'));module[_0x0600('0x1')]={'uniqueid':{'type':Sequelize[_0x0600('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0600('0x3')](_0x0600('0x4'),_0x0600('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0600('0x6')]}}; \ No newline at end of file +var _0x0caf=['ENUM','account','agent'];(function(_0x309d56,_0x245015){var _0x4c28de=function(_0x15ac0f){while(--_0x15ac0f){_0x309d56['push'](_0x309d56['shift']());}};_0x4c28de(++_0x245015);}(_0x0caf,0x9f));var _0xf0ca=function(_0x3a3be2,_0x2f7132){_0x3a3be2=_0x3a3be2-0x0;var _0x17f537=_0x0caf[_0x3a3be2];return _0x17f537;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf0ca('0x0')](_0xf0ca('0x1'),_0xf0ca('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a76c635..24169f7 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 _0x7d9b=['request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','keys','length','include','find','create','body','params','describe','zip-dir','fast-json-patch'];(function(_0x13525f,_0x3af2ff){var _0x52f540=function(_0xdc6c84){while(--_0xdc6c84){_0x13525f['push'](_0x13525f['shift']());}};_0x52f540(++_0x3af2ff);}(_0x7d9b,0x126));var _0xb7d9=function(_0x54861c,_0x8756fc){_0x54861c=_0x54861c-0x0;var _0x4786d6=_0x7d9b[_0x54861c];return _0x4786d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb7d9('0x0'));var jsonpatch=require(_0xb7d9('0x1'));var rp=require(_0xb7d9('0x2'));var moment=require(_0xb7d9('0x3'));var BPromise=require(_0xb7d9('0x4'));var Mustache=require(_0xb7d9('0x5'));var util=require(_0xb7d9('0x6'));var path=require('path');var sox=require(_0xb7d9('0x7'));var csv=require(_0xb7d9('0x8'));var ejs=require(_0xb7d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7d9('0xa'));var squel=require('squel');var crypto=require(_0xb7d9('0xb'));var jsforce=require(_0xb7d9('0xc'));var deskjs=require(_0xb7d9('0xd'));var toCsv=require(_0xb7d9('0x8'));var querystring=require(_0xb7d9('0xe'));var Papa=require(_0xb7d9('0xf'));var Redis=require(_0xb7d9('0x10'));var authService=require(_0xb7d9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb7d9('0x12'));var hardwareService=require(_0xb7d9('0x13'));var logger=require(_0xb7d9('0x14'))(_0xb7d9('0x15'));var utils=require(_0xb7d9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb7d9('0x17'))['db'];function respondWithStatusCode(_0xa5cf84,_0x3a981f){_0x3a981f=_0x3a981f||0xcc;return function(_0x349673){if(_0x349673){return _0xa5cf84['sendStatus'](_0x3a981f);}return _0xa5cf84[_0xb7d9('0x18')](_0x3a981f)[_0xb7d9('0x19')]();};}function respondWithResult(_0x1e8afa,_0x44087f){_0x44087f=_0x44087f||0xc8;return function(_0x28d5a4){if(_0x28d5a4){return _0x1e8afa[_0xb7d9('0x18')](_0x44087f)['json'](_0x28d5a4);}};}function respondWithFilteredResult(_0x3363bc,_0x3993b9){return function(_0x16e2dc){if(_0x16e2dc){var _0x4274af=typeof _0x3993b9['offset']===_0xb7d9('0x1a')&&typeof _0x3993b9[_0xb7d9('0x1b')]===_0xb7d9('0x1a');var _0x8d855a=_0x16e2dc[_0xb7d9('0x1c')];var _0x2f1bc4=_0x4274af?0x0:_0x3993b9[_0xb7d9('0x1d')];var _0xa14a96=_0x4274af?_0x16e2dc[_0xb7d9('0x1c')]:_0x3993b9['offset']+_0x3993b9[_0xb7d9('0x1b')];var _0x5def6c;if(_0xa14a96>=_0x8d855a){_0xa14a96=_0x8d855a;_0x5def6c=0xc8;}else{_0x5def6c=0xce;}_0x3363bc[_0xb7d9('0x18')](_0x5def6c);return _0x3363bc[_0xb7d9('0x1e')](_0xb7d9('0x1f'),_0x2f1bc4+'-'+_0xa14a96+'/'+_0x8d855a)[_0xb7d9('0x20')](_0x16e2dc);}return null;};}function patchUpdates(_0xbee9f7){return function(_0x25a05c){try{jsonpatch[_0xb7d9('0x21')](_0x25a05c,_0xbee9f7,!![]);}catch(_0xf30265){return BPromise[_0xb7d9('0x22')](_0xf30265);}return _0x25a05c[_0xb7d9('0x23')]();};}function saveUpdates(_0x3de6d0,_0x15aad7){return function(_0x477b6e){if(_0x477b6e){return _0x477b6e[_0xb7d9('0x24')](_0x3de6d0)[_0xb7d9('0x25')](function(_0x4e66bc){return _0x4e66bc;});}return null;};}function removeEntity(_0x2c1cc6,_0x538b68){return function(_0x3ae346){if(_0x3ae346){return _0x3ae346[_0xb7d9('0x26')]()['then'](function(){_0x2c1cc6[_0xb7d9('0x18')](0xcc)[_0xb7d9('0x19')]();});}};}function handleEntityNotFound(_0x5602cd,_0x5cd79f){return function(_0x47622a){if(!_0x47622a){_0x5602cd[_0xb7d9('0x27')](0x194);}return _0x47622a;};}function handleError(_0x2192e6,_0x3fb56f){_0x3fb56f=_0x3fb56f||0x1f4;return function(_0x2ee4b9){logger[_0xb7d9('0x28')](_0x2ee4b9['stack']);if(_0x2ee4b9[_0xb7d9('0x29')]){delete _0x2ee4b9['name'];}_0x2192e6[_0xb7d9('0x18')](_0x3fb56f)[_0xb7d9('0x2a')](_0x2ee4b9);};}exports[_0xb7d9('0x2b')]=function(_0x4f2d1a,_0x2acdc8){var _0x26237d={},_0xea5024={},_0x47a82b={'count':0x0,'rows':[]};var _0x497fb7=_[_0xb7d9('0x2c')](db[_0xb7d9('0x2d')][_0xb7d9('0x2e')],function(_0x35bc4a){return{'name':_0x35bc4a['fieldName'],'type':_0x35bc4a[_0xb7d9('0x2f')][_0xb7d9('0x30')]};});_0xea5024[_0xb7d9('0x31')]=_['map'](_0x497fb7,_0xb7d9('0x29'));_0xea5024['query']=_['keys'](_0x4f2d1a[_0xb7d9('0x32')]);_0xea5024[_0xb7d9('0x33')]=_[_0xb7d9('0x34')](_0xea5024[_0xb7d9('0x31')],_0xea5024['query']);_0x26237d[_0xb7d9('0x35')]=_[_0xb7d9('0x34')](_0xea5024[_0xb7d9('0x31')],qs[_0xb7d9('0x36')](_0x4f2d1a[_0xb7d9('0x32')][_0xb7d9('0x36')]));_0x26237d[_0xb7d9('0x35')]=_0x26237d[_0xb7d9('0x35')]['length']?_0x26237d[_0xb7d9('0x35')]:_0xea5024[_0xb7d9('0x31')];if(!_0x4f2d1a[_0xb7d9('0x32')]['hasOwnProperty'](_0xb7d9('0x37'))){_0x26237d[_0xb7d9('0x1b')]=qs[_0xb7d9('0x1b')](_0x4f2d1a[_0xb7d9('0x32')]['limit']);_0x26237d[_0xb7d9('0x1d')]=qs[_0xb7d9('0x1d')](_0x4f2d1a[_0xb7d9('0x32')]['offset']);}_0x26237d[_0xb7d9('0x38')]=qs[_0xb7d9('0x39')](_0x4f2d1a[_0xb7d9('0x32')][_0xb7d9('0x39')]);_0x26237d[_0xb7d9('0x3a')]=qs[_0xb7d9('0x33')](_['pick'](_0x4f2d1a[_0xb7d9('0x32')],_0xea5024[_0xb7d9('0x33')]),_0x497fb7);if(_0x4f2d1a['query'][_0xb7d9('0x3b')]){_0x26237d[_0xb7d9('0x3a')]=_[_0xb7d9('0x3c')](_0x26237d['where'],{'$or':_[_0xb7d9('0x2c')](_0x497fb7,function(_0x3e173c){if(_0x3e173c[_0xb7d9('0x2f')]!=='VIRTUAL'){var _0x2140e4={};_0x2140e4[_0x3e173c[_0xb7d9('0x29')]]={'$like':'%'+_0x4f2d1a[_0xb7d9('0x32')]['filter']+'%'};return _0x2140e4;}})});}_0x26237d=_[_0xb7d9('0x3c')]({},_0x26237d,_0x4f2d1a['options']);var _0x26e89b={'where':_0x26237d[_0xb7d9('0x3a')]};return db['WhatsappTransferReport'][_0xb7d9('0x1c')](_0x26e89b)['then'](function(_0x331ad3){_0x47a82b[_0xb7d9('0x1c')]=_0x331ad3;if(_0x4f2d1a['query'][_0xb7d9('0x3d')]){_0x26237d['include']=[{'all':!![]}];}return db[_0xb7d9('0x2d')][_0xb7d9('0x3e')](_0x26237d);})[_0xb7d9('0x25')](function(_0x1fbfdf){_0x47a82b[_0xb7d9('0x3f')]=_0x1fbfdf;return _0x47a82b;})[_0xb7d9('0x25')](respondWithFilteredResult(_0x2acdc8,_0x26237d))[_0xb7d9('0x40')](handleError(_0x2acdc8,null));};exports[_0xb7d9('0x41')]=function(_0x3b4974,_0x566ab7){var _0x361d17={'raw':!![],'where':{'id':_0x3b4974['params']['id']}},_0x15627c={};_0x15627c[_0xb7d9('0x31')]=_[_0xb7d9('0x42')](db[_0xb7d9('0x2d')]['rawAttributes']);_0x15627c[_0xb7d9('0x32')]=_[_0xb7d9('0x42')](_0x3b4974[_0xb7d9('0x32')]);_0x15627c[_0xb7d9('0x33')]=_[_0xb7d9('0x34')](_0x15627c[_0xb7d9('0x31')],_0x15627c[_0xb7d9('0x32')]);_0x361d17[_0xb7d9('0x35')]=_[_0xb7d9('0x34')](_0x15627c['model'],qs[_0xb7d9('0x36')](_0x3b4974['query'][_0xb7d9('0x36')]));_0x361d17[_0xb7d9('0x35')]=_0x361d17[_0xb7d9('0x35')][_0xb7d9('0x43')]?_0x361d17[_0xb7d9('0x35')]:_0x15627c[_0xb7d9('0x31')];if(_0x3b4974[_0xb7d9('0x32')][_0xb7d9('0x3d')]){_0x361d17[_0xb7d9('0x44')]=[{'all':!![]}];}_0x361d17=_[_0xb7d9('0x3c')]({},_0x361d17,_0x3b4974['options']);return db[_0xb7d9('0x2d')][_0xb7d9('0x45')](_0x361d17)[_0xb7d9('0x25')](handleEntityNotFound(_0x566ab7,null))[_0xb7d9('0x25')](respondWithResult(_0x566ab7,null))[_0xb7d9('0x40')](handleError(_0x566ab7,null));};exports[_0xb7d9('0x46')]=function(_0x499098,_0x43600c){return db[_0xb7d9('0x2d')][_0xb7d9('0x46')](_0x499098[_0xb7d9('0x47')],{})['then'](respondWithResult(_0x43600c,0xc9))[_0xb7d9('0x40')](handleError(_0x43600c,null));};exports[_0xb7d9('0x24')]=function(_0x1a01aa,_0x329044){if(_0x1a01aa[_0xb7d9('0x47')]['id']){delete _0x1a01aa[_0xb7d9('0x47')]['id'];}return db[_0xb7d9('0x2d')]['find']({'where':{'id':_0x1a01aa[_0xb7d9('0x48')]['id']}})[_0xb7d9('0x25')](handleEntityNotFound(_0x329044,null))[_0xb7d9('0x25')](saveUpdates(_0x1a01aa['body'],null))[_0xb7d9('0x25')](respondWithResult(_0x329044,null))[_0xb7d9('0x40')](handleError(_0x329044,null));};exports[_0xb7d9('0x26')]=function(_0x3fbe3a,_0x520469){return db[_0xb7d9('0x2d')]['find']({'where':{'id':_0x3fbe3a[_0xb7d9('0x48')]['id']}})[_0xb7d9('0x25')](handleEntityNotFound(_0x520469,null))['then'](removeEntity(_0x520469,null))[_0xb7d9('0x40')](handleError(_0x520469,null));};exports['describe']=function(_0x3e3a59,_0x7703ef){return db[_0xb7d9('0x2d')][_0xb7d9('0x49')]()[_0xb7d9('0x25')](respondWithResult(_0x7703ef,null))[_0xb7d9('0x40')](handleError(_0x7703ef,null));}; \ No newline at end of file +var _0x68d7=['include','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','update','then','error','stack','name','send','index','map','WhatsappTransferReport','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes'];(function(_0x181c80,_0xda9ab4){var _0x4e0077=function(_0x16b50c){while(--_0x16b50c){_0x181c80['push'](_0x181c80['shift']());}};_0x4e0077(++_0xda9ab4);}(_0x68d7,0xf4));var _0x768d=function(_0x508105,_0x1e54c0){_0x508105=_0x508105-0x0;var _0xaafbc8=_0x68d7[_0x508105];return _0xaafbc8;};'use strict';var emlformat=require(_0x768d('0x0'));var rimraf=require(_0x768d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x768d('0x2'));var rp=require(_0x768d('0x3'));var moment=require(_0x768d('0x4'));var BPromise=require(_0x768d('0x5'));var Mustache=require(_0x768d('0x6'));var util=require(_0x768d('0x7'));var path=require(_0x768d('0x8'));var sox=require(_0x768d('0x9'));var csv=require(_0x768d('0xa'));var ejs=require(_0x768d('0xb'));var fs=require('fs');var fs_extra=require(_0x768d('0xc'));var _=require(_0x768d('0xd'));var squel=require(_0x768d('0xe'));var crypto=require('crypto');var jsforce=require(_0x768d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x768d('0xa'));var querystring=require(_0x768d('0x10'));var Papa=require(_0x768d('0x11'));var Redis=require('ioredis');var authService=require(_0x768d('0x12'));var qs=require(_0x768d('0x13'));var as=require(_0x768d('0x14'));var hardwareService=require(_0x768d('0x15'));var logger=require(_0x768d('0x16'))(_0x768d('0x17'));var utils=require(_0x768d('0x18'));var config=require(_0x768d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x768d('0x1a'))['db'];function respondWithStatusCode(_0x5a3fec,_0x25c7ca){_0x25c7ca=_0x25c7ca||0xcc;return function(_0x320e93){if(_0x320e93){return _0x5a3fec[_0x768d('0x1b')](_0x25c7ca);}return _0x5a3fec[_0x768d('0x1c')](_0x25c7ca)[_0x768d('0x1d')]();};}function respondWithResult(_0x3aa05a,_0x1d5bcb){_0x1d5bcb=_0x1d5bcb||0xc8;return function(_0x50faeb){if(_0x50faeb){return _0x3aa05a[_0x768d('0x1c')](_0x1d5bcb)[_0x768d('0x1e')](_0x50faeb);}};}function respondWithFilteredResult(_0x2aae1c,_0x313e9f){return function(_0x4198a6){if(_0x4198a6){var _0x1a263f=typeof _0x313e9f[_0x768d('0x1f')]===_0x768d('0x20')&&typeof _0x313e9f['limit']==='undefined';var _0x5b3db5=_0x4198a6[_0x768d('0x21')];var _0x3b0353=_0x1a263f?0x0:_0x313e9f['offset'];var _0x19d13a=_0x1a263f?_0x4198a6[_0x768d('0x21')]:_0x313e9f['offset']+_0x313e9f['limit'];var _0x490c61;if(_0x19d13a>=_0x5b3db5){_0x19d13a=_0x5b3db5;_0x490c61=0xc8;}else{_0x490c61=0xce;}_0x2aae1c[_0x768d('0x1c')](_0x490c61);return _0x2aae1c['set'](_0x768d('0x22'),_0x3b0353+'-'+_0x19d13a+'/'+_0x5b3db5)[_0x768d('0x1e')](_0x4198a6);}return null;};}function patchUpdates(_0x3135f8){return function(_0x28b51b){try{jsonpatch['apply'](_0x28b51b,_0x3135f8,!![]);}catch(_0x2da488){return BPromise[_0x768d('0x23')](_0x2da488);}return _0x28b51b[_0x768d('0x24')]();};}function saveUpdates(_0xe7f7cf,_0x197d38){return function(_0x229555){if(_0x229555){return _0x229555[_0x768d('0x25')](_0xe7f7cf)[_0x768d('0x26')](function(_0x224b4c){return _0x224b4c;});}return null;};}function removeEntity(_0x219eab,_0x19b280){return function(_0x40fe3f){if(_0x40fe3f){return _0x40fe3f['destroy']()['then'](function(){_0x219eab[_0x768d('0x1c')](0xcc)[_0x768d('0x1d')]();});}};}function handleEntityNotFound(_0xb9165d,_0x3dc993){return function(_0x50577d){if(!_0x50577d){_0xb9165d[_0x768d('0x1b')](0x194);}return _0x50577d;};}function handleError(_0x20b1f9,_0xf5e937){_0xf5e937=_0xf5e937||0x1f4;return function(_0x236a67){logger[_0x768d('0x27')](_0x236a67[_0x768d('0x28')]);if(_0x236a67[_0x768d('0x29')]){delete _0x236a67[_0x768d('0x29')];}_0x20b1f9[_0x768d('0x1c')](_0xf5e937)[_0x768d('0x2a')](_0x236a67);};}exports[_0x768d('0x2b')]=function(_0x2ddf75,_0x247cb9){var _0x2a324f={},_0x471b99={},_0x51b89b={'count':0x0,'rows':[]};var _0x150455=_[_0x768d('0x2c')](db[_0x768d('0x2d')]['rawAttributes'],function(_0x183944){return{'name':_0x183944['fieldName'],'type':_0x183944['type'][_0x768d('0x2e')]};});_0x471b99[_0x768d('0x2f')]=_['map'](_0x150455,'name');_0x471b99[_0x768d('0x30')]=_[_0x768d('0x31')](_0x2ddf75[_0x768d('0x30')]);_0x471b99[_0x768d('0x32')]=_['intersection'](_0x471b99[_0x768d('0x2f')],_0x471b99[_0x768d('0x30')]);_0x2a324f[_0x768d('0x33')]=_[_0x768d('0x34')](_0x471b99['model'],qs[_0x768d('0x35')](_0x2ddf75['query']['fields']));_0x2a324f[_0x768d('0x33')]=_0x2a324f[_0x768d('0x33')][_0x768d('0x36')]?_0x2a324f[_0x768d('0x33')]:_0x471b99[_0x768d('0x2f')];if(!_0x2ddf75['query'][_0x768d('0x37')](_0x768d('0x38'))){_0x2a324f[_0x768d('0x39')]=qs[_0x768d('0x39')](_0x2ddf75[_0x768d('0x30')][_0x768d('0x39')]);_0x2a324f[_0x768d('0x1f')]=qs['offset'](_0x2ddf75[_0x768d('0x30')][_0x768d('0x1f')]);}_0x2a324f[_0x768d('0x3a')]=qs[_0x768d('0x3b')](_0x2ddf75[_0x768d('0x30')][_0x768d('0x3b')]);_0x2a324f[_0x768d('0x3c')]=qs[_0x768d('0x32')](_[_0x768d('0x3d')](_0x2ddf75[_0x768d('0x30')],_0x471b99[_0x768d('0x32')]),_0x150455);if(_0x2ddf75[_0x768d('0x30')][_0x768d('0x3e')]){_0x2a324f[_0x768d('0x3c')]=_['merge'](_0x2a324f['where'],{'$or':_[_0x768d('0x2c')](_0x150455,function(_0x2a6798){if(_0x2a6798['type']!==_0x768d('0x3f')){var _0x5aafa3={};_0x5aafa3[_0x2a6798[_0x768d('0x29')]]={'$like':'%'+_0x2ddf75[_0x768d('0x30')][_0x768d('0x3e')]+'%'};return _0x5aafa3;}})});}_0x2a324f=_[_0x768d('0x40')]({},_0x2a324f,_0x2ddf75[_0x768d('0x41')]);var _0x382a06={'where':_0x2a324f[_0x768d('0x3c')]};return db[_0x768d('0x2d')][_0x768d('0x21')](_0x382a06)['then'](function(_0x40b0aa){_0x51b89b[_0x768d('0x21')]=_0x40b0aa;if(_0x2ddf75[_0x768d('0x30')][_0x768d('0x42')]){_0x2a324f['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x768d('0x43')](_0x2a324f);})[_0x768d('0x26')](function(_0x1cb57d){_0x51b89b[_0x768d('0x44')]=_0x1cb57d;return _0x51b89b;})['then'](respondWithFilteredResult(_0x247cb9,_0x2a324f))['catch'](handleError(_0x247cb9,null));};exports[_0x768d('0x45')]=function(_0xac285e,_0x721681){var _0x1c8363={'raw':!![],'where':{'id':_0xac285e[_0x768d('0x46')]['id']}},_0x5ba251={};_0x5ba251[_0x768d('0x2f')]=_[_0x768d('0x31')](db['WhatsappTransferReport'][_0x768d('0x47')]);_0x5ba251['query']=_[_0x768d('0x31')](_0xac285e[_0x768d('0x30')]);_0x5ba251['filters']=_['intersection'](_0x5ba251[_0x768d('0x2f')],_0x5ba251['query']);_0x1c8363[_0x768d('0x33')]=_[_0x768d('0x34')](_0x5ba251[_0x768d('0x2f')],qs[_0x768d('0x35')](_0xac285e['query'][_0x768d('0x35')]));_0x1c8363[_0x768d('0x33')]=_0x1c8363[_0x768d('0x33')][_0x768d('0x36')]?_0x1c8363[_0x768d('0x33')]:_0x5ba251[_0x768d('0x2f')];if(_0xac285e[_0x768d('0x30')][_0x768d('0x42')]){_0x1c8363[_0x768d('0x48')]=[{'all':!![]}];}_0x1c8363=_[_0x768d('0x40')]({},_0x1c8363,_0xac285e[_0x768d('0x41')]);return db[_0x768d('0x2d')][_0x768d('0x49')](_0x1c8363)[_0x768d('0x26')](handleEntityNotFound(_0x721681,null))['then'](respondWithResult(_0x721681,null))[_0x768d('0x4a')](handleError(_0x721681,null));};exports[_0x768d('0x4b')]=function(_0x4eb4fa,_0x58682a){return db[_0x768d('0x2d')]['create'](_0x4eb4fa[_0x768d('0x4c')],{})['then'](respondWithResult(_0x58682a,0xc9))[_0x768d('0x4a')](handleError(_0x58682a,null));};exports['update']=function(_0x3bfa01,_0x542930){if(_0x3bfa01[_0x768d('0x4c')]['id']){delete _0x3bfa01[_0x768d('0x4c')]['id'];}return db[_0x768d('0x2d')][_0x768d('0x49')]({'where':{'id':_0x3bfa01[_0x768d('0x46')]['id']}})['then'](handleEntityNotFound(_0x542930,null))[_0x768d('0x26')](saveUpdates(_0x3bfa01[_0x768d('0x4c')],null))['then'](respondWithResult(_0x542930,null))[_0x768d('0x4a')](handleError(_0x542930,null));};exports[_0x768d('0x4d')]=function(_0xf586f6,_0x34ac84){return db[_0x768d('0x2d')][_0x768d('0x49')]({'where':{'id':_0xf586f6['params']['id']}})[_0x768d('0x26')](handleEntityNotFound(_0x34ac84,null))['then'](removeEntity(_0x34ac84,null))[_0x768d('0x4a')](handleError(_0x34ac84,null));};exports['describe']=function(_0x2994e6,_0x24e67d){return db[_0x768d('0x2d')][_0x768d('0x4e')]()[_0x768d('0x26')](respondWithResult(_0x24e67d,null))[_0x768d('0x4a')](handleError(_0x24e67d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 1f90bd3..678e16e 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 _0xa94e=['bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x9e7f3a,_0x37105f){var _0x5ab145=function(_0x5b3bad){while(--_0x5b3bad){_0x9e7f3a['push'](_0x9e7f3a['shift']());}};_0x5ab145(++_0x37105f);}(_0xa94e,0x158));var _0xea94=function(_0x2c2447,_0x411743){_0x2c2447=_0x2c2447-0x0;var _0xcbf574=_0xa94e[_0x2c2447];return _0xcbf574;};'use strict';var _=require(_0xea94('0x0'));var util=require(_0xea94('0x1'));var logger=require(_0xea94('0x2'))(_0xea94('0x3'));var moment=require('moment');var BPromise=require(_0xea94('0x4'));var rp=require(_0xea94('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea94('0x6'));var config=require(_0xea94('0x7'));var attributes=require(_0xea94('0x8'));module[_0xea94('0x9')]=function(_0x4425c6,_0x559136){return _0x4425c6[_0xea94('0xa')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xea94('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x25c4=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x3e2040,_0x660381){var _0x38e3ec=function(_0x2e61bd){while(--_0x2e61bd){_0x3e2040['push'](_0x3e2040['shift']());}};_0x38e3ec(++_0x660381);}(_0x25c4,0x1c1));var _0x425c=function(_0xeb4c8b,_0x1dc497){_0xeb4c8b=_0xeb4c8b-0x0;var _0x90b0d0=_0x25c4[_0xeb4c8b];return _0x90b0d0;};'use strict';var _=require(_0x425c('0x0'));var util=require(_0x425c('0x1'));var logger=require(_0x425c('0x2'))(_0x425c('0x3'));var moment=require(_0x425c('0x4'));var BPromise=require('bluebird');var rp=require(_0x425c('0x5'));var fs=require('fs');var path=require(_0x425c('0x6'));var rimraf=require(_0x425c('0x7'));var config=require(_0x425c('0x8'));var attributes=require(_0x425c('0x9'));module[_0x425c('0xa')]=function(_0x13d8e3,_0x3e5ceb){return _0x13d8e3[_0x425c('0xb')](_0x425c('0xc'),attributes,{'tableName':_0x425c('0xd'),'paranoid':![],'indexes':[{'name':_0x425c('0xe'),'fields':[_0x425c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b212196..8046637 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 _0x668f=['debug','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2a8bfd,_0xd990b){var _0x1148aa=function(_0x58f4ab){while(--_0x58f4ab){_0x2a8bfd['push'](_0x2a8bfd['shift']());}};_0x1148aa(++_0xd990b);}(_0x668f,0x1a2));var _0xf668=function(_0x54ba4a,_0x2d6323){_0x54ba4a=_0x54ba4a-0x0;var _0x1fe325=_0x668f[_0x54ba4a];return _0x1fe325;};'use strict';var _=require(_0xf668('0x0'));var util=require(_0xf668('0x1'));var moment=require(_0xf668('0x2'));var BPromise=require(_0xf668('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf668('0x4'));var db=require(_0xf668('0x5'))['db'];var utils=require(_0xf668('0x6'));var logger=require(_0xf668('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf668('0x8')][_0xf668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a26e,_0x3edbd5,_0x1af1b5){return new BPromise(function(_0x34de8,_0x17c956){return client['request'](_0x34a26e,_0x1af1b5)[_0xf668('0xa')](function(_0x1aeef5){logger[_0xf668('0xb')](_0xf668('0xc'),_0x3edbd5,_0xf668('0xd'));logger[_0xf668('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x3edbd5,_0xf668('0xd'),JSON[_0xf668('0xf')](_0x1aeef5));if(_0x1aeef5['error']){if(_0x1aeef5['error']['code']===0x1f4){logger['error'](_0xf668('0xc'),_0x3edbd5,_0x1aeef5[_0xf668('0x10')][_0xf668('0x11')]);return _0x17c956(_0x1aeef5[_0xf668('0x10')][_0xf668('0x11')]);}logger[_0xf668('0x10')](_0xf668('0xc'),_0x3edbd5,_0x1aeef5[_0xf668('0x10')][_0xf668('0x11')]);return _0x34de8(_0x1aeef5['error']['message']);}else{logger[_0xf668('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3edbd5,'request\x20sent');_0x34de8(_0x1aeef5['result'][_0xf668('0x11')]);}})['catch'](function(_0x577fc9){logger[_0xf668('0x10')](_0xf668('0xc'),_0x3edbd5,_0x577fc9);_0x17c956(_0x577fc9);});});} \ No newline at end of file +var _0xb692=['rpc','../../config/environment','jayson/promise','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57bd45,_0x186ad5){var _0x4bdcdd=function(_0x400d2b){while(--_0x400d2b){_0x57bd45['push'](_0x57bd45['shift']());}};_0x4bdcdd(++_0x186ad5);}(_0xb692,0x159));var _0x2b69=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0xb692[_0x36d703];return _0x12c909;};'use strict';var _=require(_0x2b69('0x0'));var util=require(_0x2b69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2b69('0x2'));var fs=require('fs');var Redis=require(_0x2b69('0x3'));var db=require(_0x2b69('0x4'))['db'];var utils=require(_0x2b69('0x5'));var logger=require(_0x2b69('0x6'))(_0x2b69('0x7'));var config=require(_0x2b69('0x8'));var jayson=require(_0x2b69('0x9'));var client=jayson[_0x2b69('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe7abb7,_0xa7e64,_0x3e2f91){return new BPromise(function(_0x3fa53e,_0x7407f9){return client['request'](_0xe7abb7,_0x3e2f91)[_0x2b69('0xb')](function(_0x41b10b){logger[_0x2b69('0xc')](_0x2b69('0xd'),_0xa7e64,_0x2b69('0xe'));logger[_0x2b69('0xf')](_0x2b69('0x10'),_0xa7e64,_0x2b69('0xe'),JSON['stringify'](_0x41b10b));if(_0x41b10b[_0x2b69('0x11')]){if(_0x41b10b[_0x2b69('0x11')][_0x2b69('0x12')]===0x1f4){logger[_0x2b69('0x11')](_0x2b69('0xd'),_0xa7e64,_0x41b10b['error']['message']);return _0x7407f9(_0x41b10b[_0x2b69('0x11')][_0x2b69('0x13')]);}logger[_0x2b69('0x11')](_0x2b69('0xd'),_0xa7e64,_0x41b10b[_0x2b69('0x11')][_0x2b69('0x13')]);return _0x3fa53e(_0x41b10b[_0x2b69('0x11')][_0x2b69('0x13')]);}else{logger[_0x2b69('0xc')](_0x2b69('0xd'),_0xa7e64,_0x2b69('0xe'));_0x3fa53e(_0x41b10b[_0x2b69('0x14')][_0x2b69('0x13')]);}})[_0x2b69('0x15')](function(_0x2d9796){logger[_0x2b69('0x11')](_0x2b69('0xd'),_0xa7e64,_0x2d9796);_0x7407f9(_0x2d9796);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index dd8daa2..581c6e1 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48e3=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/cloud-provider','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','map','filter','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error'];(function(_0x324d05,_0x5e2b01){var _0x572121=function(_0x27671a){while(--_0x27671a){_0x324d05['push'](_0x324d05['shift']());}};_0x572121(++_0x5e2b01);}(_0x48e3,0xe9));var _0x348e=function(_0x28efcd,_0x3eb676){_0x28efcd=_0x28efcd-0x0;var _0x403c9a=_0x48e3[_0x28efcd];return _0x403c9a;};'use strict';var _=require(_0x348e('0x0'));var db=require(_0x348e('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x348e('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x348e('0x3'))(_0x348e('0x4'));var pm2=require(_0x348e('0x5'));var pm2Config=require(_0x348e('0x6'));var schedule=require('./config/schedule');var chat=require(_0x348e('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x348e('0x8'));function main(){return db['sequelize']['sync']()[_0x348e('0x9')](function(){if(config['seedDB']){return seedDb[_0x348e('0xa')]();}})[_0x348e('0x9')](function(){return checkLicense[_0x348e('0xa')]();})[_0x348e('0x9')](function(){return rpc[_0x348e('0xb')]();})[_0x348e('0x9')](function(_0x2a91dd){logger[_0x348e('0xc')](_0x2a91dd);return chat[_0x348e('0xd')]();})[_0x348e('0x9')](function(){return whatsapp[_0x348e('0xd')]();})[_0x348e('0x9')](function(){return schedule[_0x348e('0xd')]();})[_0x348e('0x9')](function(){return transcribe['start']();})[_0x348e('0x9')](function(){return provider[_0x348e('0xd')]();})[_0x348e('0x9')](function(_0x52266d){logger[_0x348e('0xc')](_0x52266d);return pm2[_0x348e('0xd')](pm2Config);})[_0x348e('0x9')](function(_0x246a85){var _0x4763fb=_0x246a85['filter'](function(_0x5169aa){return typeof _0x5169aa[_0x348e('0xe')]===_0x348e('0xf')&&_0x5169aa[_0x348e('0xe')]>=0x0;});if(_0x4763fb[_0x348e('0x10')]>0x0){throw new Error(_0x4763fb['length']+_0x348e('0x11')+_['map'](_0x4763fb,function(_0x217857){return'\x22'+_0x217857[_0x348e('0x12')][_0x348e('0x13')]+'\x22';}));}logger['info'](_0x348e('0x14'),_['map'](_['filter'](_0x246a85,{'status':'online'}),_0x348e('0x13'))[_0x348e('0x15')]());logger[_0x348e('0xc')](_0x348e('0x16'),_[_0x348e('0x17')](_[_0x348e('0x18')](_0x246a85,function(_0x3d1ae3){return _0x3d1ae3[_0x348e('0x19')]!=='online';}),'name')[_0x348e('0x15')]()||_0x348e('0x1a'));console[_0x348e('0x1b')](_0x348e('0x1c'));})['catch'](function(_0x36796a){console[_0x348e('0x1b')](_0x348e('0x1d'),_0x36796a);logger[_0x348e('0x1e')](_0x348e('0x1f'),_0x36796a);process[_0x348e('0x20')](0x1);});}main(); \ No newline at end of file +var _0x5e17=['Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','map','pm2_env','Online\x20apps:','online','name','Offline\x20apps:','join','None','log'];(function(_0x3ea121,_0x3d678e){var _0x239c79=function(_0x5abd13){while(--_0x5abd13){_0x3ea121['push'](_0x3ea121['shift']());}};_0x239c79(++_0x3d678e);}(_0x5e17,0x17a));var _0x75e1=function(_0x1a0016,_0xd29c3c){_0x1a0016=_0x1a0016-0x0;var _0x293787=_0x5e17[_0x1a0016];return _0x293787;};'use strict';var _=require(_0x75e1('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x75e1('0x1'))(_0x75e1('0x2'));var pm2=require(_0x75e1('0x3'));var pm2Config=require(_0x75e1('0x4'));var schedule=require(_0x75e1('0x5'));var chat=require(_0x75e1('0x6'));var whatsapp=require(_0x75e1('0x7'));var transcribe=require(_0x75e1('0x8'));var provider=require(_0x75e1('0x9'));function main(){return db[_0x75e1('0xa')][_0x75e1('0xb')]()[_0x75e1('0xc')](function(){if(config[_0x75e1('0xd')]){return seedDb[_0x75e1('0xe')]();}})[_0x75e1('0xc')](function(){return checkLicense['default']();})[_0x75e1('0xc')](function(){return rpc['listen']();})['then'](function(_0x9a257e){logger[_0x75e1('0xf')](_0x9a257e);return chat[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(){return whatsapp[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(){return schedule[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(){return transcribe['start']();})[_0x75e1('0xc')](function(){return provider[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(_0x5376e0){logger[_0x75e1('0xf')](_0x5376e0);return pm2[_0x75e1('0x10')](pm2Config);})[_0x75e1('0xc')](function(_0x260f06){var _0x582b54=_0x260f06[_0x75e1('0x11')](function(_0x262ac4){return typeof _0x262ac4[_0x75e1('0x12')]===_0x75e1('0x13')&&_0x262ac4[_0x75e1('0x12')]>=0x0;});if(_0x582b54[_0x75e1('0x14')]>0x0){throw new Error(_0x582b54[_0x75e1('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x75e1('0x15')](_0x582b54,function(_0x14dc9d){return'\x22'+_0x14dc9d[_0x75e1('0x16')]['name']+'\x22';}));}logger[_0x75e1('0xf')](_0x75e1('0x17'),_['map'](_[_0x75e1('0x11')](_0x260f06,{'status':_0x75e1('0x18')}),_0x75e1('0x19'))['join']());logger[_0x75e1('0xf')](_0x75e1('0x1a'),_[_0x75e1('0x15')](_[_0x75e1('0x11')](_0x260f06,function(_0x1ae04e){return _0x1ae04e['status']!==_0x75e1('0x18');}),'name')[_0x75e1('0x1b')]()||_0x75e1('0x1c'));console[_0x75e1('0x1d')]('App\x20Ready!');})['catch'](function(_0x266715){console[_0x75e1('0x1d')](_0x75e1('0x1e'),_0x266715);logger[_0x75e1('0x1f')](_0x75e1('0x20'),_0x266715);process[_0x75e1('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5197f1e..e33d549 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 _0x4b84=['User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','secret','secrets','payload','randomBytes','hex','now','toString','HS512','../../mysqldb','../../config/environment','../encryptor','express-jwt','composable-middleware','basic-auth','moment','session','fullname','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','disposition','then','closed','status','unmanaged','Forbidden.','catch','use','headers','authorization','Basic','User','find','name','authenticate','pass','json','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key'];(function(_0x2b027e,_0x4526fe){var _0x21b88a=function(_0x155241){while(--_0x155241){_0x2b027e['push'](_0x2b027e['shift']());}};_0x21b88a(++_0x4526fe);}(_0x4b84,0x1cc));var _0x44b8=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4b84[_0x18ab2a];return _0x16dcee;};'use strict';var db=require(_0x44b8('0x0'))['db'];var config=require(_0x44b8('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x44b8('0x2'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x44b8('0x3'));var compose=require(_0x44b8('0x4'));var basicAuth=require(_0x44b8('0x5'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require(_0x44b8('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0x44b8('0x7')]});var userAttributes=['id','role',_0x44b8('0x8'),'name','internal',_0x44b8('0x9'),_0x44b8('0xa'),_0x44b8('0xb'),'md5secret',_0x44b8('0xc'),_0x44b8('0xd'),_0x44b8('0xe'),_0x44b8('0xf'),_0x44b8('0x10'),_0x44b8('0x11'),_0x44b8('0x12'),'showWebBar',_0x44b8('0x13'),_0x44b8('0x14'),'crudPermissions',_0x44b8('0x15'),'passwordResetAt',_0x44b8('0x16'),_0x44b8('0x17'),'phoneBarAutoAnswerDelay',_0x44b8('0x18'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),'phoneBarRemoteControlPort','hotdesk','interface',_0x44b8('0x1d'),'privacyEnabled',_0x44b8('0x1e'),_0x44b8('0x1f'),'downloadVoiceRecordings',_0x44b8('0x20'),_0x44b8('0x21'),'ignorePauseForPreviewCalls',_0x44b8('0x22'),_0x44b8('0x23'),'chatAutoanswerDelay',_0x44b8('0x24'),_0x44b8('0x25'),_0x44b8('0x26'),_0x44b8('0x27'),_0x44b8('0x28'),_0x44b8('0x29'),_0x44b8('0x2a'),_0x44b8('0x2b'),_0x44b8('0x2c'),_0x44b8('0x2d')];exports[_0x44b8('0x2e')]=function(){return this[_0x44b8('0x2f')](!![])['use'](function(_0x56549a,_0x3a8aa4,_0x416b34){if(_0x56549a[_0x44b8('0x30')]){_0x416b34();}else{return db[_0x44b8('0x31')]['findOne']({'where':{'id':_0x56549a[_0x44b8('0x32')]['id']},'attributes':['id','closed',_0x44b8('0x33')],'raw':!![]})[_0x44b8('0x34')](function(_0x25a0c1){if(_0x25a0c1&&_0x25a0c1[_0x44b8('0x35')]){return _0x3a8aa4[_0x44b8('0x36')](_0x25a0c1['disposition']===_0x44b8('0x37')?0x195:0x193)['json']({'message':_0x25a0c1[_0x44b8('0x33')]===_0x44b8('0x37')?'Unmanaged.':_0x44b8('0x38')});}else{_0x416b34();}})[_0x44b8('0x39')](function(_0x2656d7){_0x416b34(_0x2656d7);});}});};exports['isAuthenticated']=function isAuthenticated(_0xb22107){return compose()[_0x44b8('0x3a')](function(_0x53d9c7,_0x2e0174,_0x4a182d){var _0xfb0028;if(_0x53d9c7['headers']['authorization']){if(_['startsWith'](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x3d'))){var _0x1bd1be=basicAuth(_0x53d9c7);db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'name':_0x1bd1be[_0x44b8('0x40')]}})[_0x44b8('0x34')](function(_0xd1d320){if(!_0xd1d320||!_0xd1d320[_0x44b8('0x41')](_0x1bd1be[_0x44b8('0x42')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Wrong\x20credentials.'});}_0x53d9c7[_0x44b8('0x30')]={'id':_0xd1d320['id']};_0x4a182d();})['catch'](function(_0x212983){_0x4a182d(_0x212983);});}else if(_[_0x44b8('0x44')](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x45'))){validateJwt(_0x53d9c7,_0x2e0174,_0x4a182d);}else{if(_0xb22107){_0x4a182d();}else{return _0x2e0174['status'](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}}}else if(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')]){try{var _0x46b008={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x44b8('0x49')]()};verifyJwt(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')],_0x46b008)[_0x44b8('0x34')](function(_0x140a79){return db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x140a79[_0x44b8('0x4a')]}})[_0x44b8('0x34')](function(_0x181761){_0xfb0028=_0x181761;return db[_0x44b8('0x4b')][_0x44b8('0x4c')]({'where':{'id':0x1},'attributes':[_0x44b8('0x4d'),_0x44b8('0x4e')],'raw':!![]});})[_0x44b8('0x34')](function(_0x1becb0){if(!_0xfb0028||!_[_0x44b8('0x4f')](_0xfb0028[_0x44b8('0x50')],_0x140a79[_0x44b8('0x51')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x52')});}if(_0xfb0028['disabled']){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0xfb0028[_0x44b8('0x53')]){if(_0x1becb0[_0x44b8('0x4e')]>0x0){if(moment(_0xfb0028[_0x44b8('0x54')])[_0x44b8('0x55')](_0x1becb0['blockDuration'],_0x44b8('0x56'))>moment()){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}else{return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}_0x53d9c7[_0x44b8('0x30')]={'id':_0xfb0028['id']};_0x4a182d();});})[_0x44b8('0x39')](function(){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});});}catch(_0xd69398){_0x4a182d(_0xd69398);}}else if(_0xb22107){_0x4a182d();}else{return _0x2e0174[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}})['use'](function(_0x12a0a4,_0x43e43a,_0xbf444f){if(_0x12a0a4['user']){db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x12a0a4[_0x44b8('0x30')]['id']},'attributes':userAttributes})['then'](function(_0xbad4bb){if(!_0xbad4bb){return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x58')});}_0x12a0a4[_0x44b8('0x30')]=_0xbad4bb;_0xbf444f();})['catch'](function(_0x5ae5f9){_0xbf444f(_0x5ae5f9);});}else if(_0xb22107){_0xbf444f();}else{return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x59')});}});};exports[_0x44b8('0x5a')]=function canUpdate(){return compose()[_0x44b8('0x3a')](function(_0x26e1f1,_0x3fc41b,_0x457348){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x197782){if(_0x197782[_0x44b8('0x5c')]){_0x457348();}else{return _0x3fc41b[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x5d')});}})[_0x44b8('0x39')](function(_0xce06dc){_0x457348(_0xce06dc);});});};exports[_0x44b8('0x5e')]=function isWebrtcLicence(){return compose()[_0x44b8('0x3a')](function(_0x49c507,_0x547dc1,_0x3b1b12){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x269284){if(_0x269284[_0x44b8('0x5f')]){_0x3b1b12();}else{return _0x547dc1[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':'Forbidden'});}})[_0x44b8('0x39')](function(_0x53edca){_0x3b1b12(_0x53edca);});});};exports[_0x44b8('0x60')]=function(_0x3ef886,_0x1dbc28,_0x9207bf){_0x3ef886[_0x44b8('0x60')]=!![];return _0x9207bf();};exports[_0x44b8('0x61')]=function signToken(_0x491600){return signJwt(_0x491600);};exports[_0x44b8('0x62')]=function(_0xff92fb,_0x10602c){if(!_0xff92fb[_0x44b8('0x30')]){return _0x10602c['status'](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x63')});}var _0x36afa9={'payload':{'id':_0xff92fb[_0x44b8('0x30')]['id'],'role':_0xff92fb[_0x44b8('0x30')][_0x44b8('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x36afa9)['then'](function(_0x19d95d){_0x10602c[_0x44b8('0x65')](_0x44b8('0x66'),_0x19d95d);_0x10602c[_0x44b8('0x67')](_0x44b8('0x68'));})['catch'](function(_0x493840){return _0x10602c[_0x44b8('0x36')](0x1f4)['send'](_0x493840);});};exports[_0x44b8('0x69')]=function(_0x5785ef){if(_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x50')])||_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x6b')])){return null;}else{return createJwt(_0x5785ef);}};exports[_0x44b8('0x6c')]=function(_0x32f588){_0x32f588[_0x44b8('0x50')]=generateNonce();_0x32f588['apiKeyIat']=generateIssuedAt();return createJwt(_0x32f588);};exports[_0x44b8('0x6d')]=function(_0x37b2c2,_0x1e6a5e){var _0x492be6=_0x37b2c2[_0x44b8('0x47')][_0x44b8('0x48')];if(_0x492be6){var _0x45f9a0={'nonce':_0x1e6a5e[_0x44b8('0x50')],'iat':_0x1e6a5e['apiKeyIat'],'audience':hardwareConf[_0x44b8('0x49')](),'issuer':hardwareConf[_0x44b8('0x49')]()};return verifyJwt(_0x492be6,_0x45f9a0)['then'](function(){return generateApiKey(_0x1e6a5e);});}else{throw{'message':_0x44b8('0x6e')};}};exports[_0x44b8('0x6f')]=function(_0x35136e){var _0x3df6aa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3df6aa[_0x44b8('0x70')](_0x35136e))throw new db['Sequelize']['ValidationError'](_0x44b8('0x71'));return;};exports[_0x44b8('0x72')]=function(_0xa30834,_0x4358aa,_0x765e45){var _0x3f6b92=encryptor[_0x44b8('0x73')](_0x4358aa)[_0x44b8('0x74')](',');for(var _0x10bbd9=0x0;_0x10bbd9<_0x765e45;_0x10bbd9++){if(!_0x3f6b92[_0x10bbd9])break;if(_0xa30834[_0x44b8('0x75')]()===_0x3f6b92[_0x10bbd9][_0x44b8('0x75')]()){var _0x3f7576=util['format'](_0x44b8('0x76'),_0x765e45);if(_0x765e45===0x1){_0x3f7576=_0x44b8('0x77');}throw new db[(_0x44b8('0x78'))][(_0x44b8('0x79'))](_0x3f7576);}}return;};exports[_0x44b8('0x7a')]=function(_0x1df915,_0x426a6a){var _0x172ff3=_0x426a6a?encryptor[_0x44b8('0x73')](_0x426a6a)[_0x44b8('0x74')](','):[];if(_0x172ff3[_0x44b8('0x7b')]===0x5){_0x172ff3[_0x44b8('0x7c')](-0x1,0x1);}_0x172ff3[_0x44b8('0x7d')](_0x1df915);return encryptor[_0x44b8('0x7e')](_0x172ff3[_0x44b8('0x7f')](','));};function signJwt(_0x293c2e){var _0x25f91c=BPromise[_0x44b8('0x80')](jwt['sign'],{'context':jwt});var _0x1ec516=_0x293c2e[_0x44b8('0x81')]||config[_0x44b8('0x82')][_0x44b8('0x7')];return new BPromise(function(_0x51f763,_0x29ed5d){_0x25f91c(_0x293c2e[_0x44b8('0x83')],_0x1ec516,_0x293c2e['options'])[_0x44b8('0x34')](function(_0xc4d667){_0x51f763(_0xc4d667);})['catch'](function(_0x2a95f6){_0x29ed5d(_0x2a95f6);});});}function verifyJwt(_0x3354bd,_0x520929,_0x37e42e){var _0x454fe6=BPromise[_0x44b8('0x80')](jwt['verify'],{'context':jwt});var _0x16e790=_0x37e42e||config['secrets'][_0x44b8('0x7')];return new BPromise(function(_0x5161ea,_0x176536){_0x454fe6(_0x3354bd,_0x16e790,_0x520929)[_0x44b8('0x34')](function(_0xf4d81f){_0x5161ea(_0xf4d81f);})[_0x44b8('0x39')](function(_0x3c6aad){_0x176536(_0x3c6aad);});});}function generateNonce(){return crypto[_0x44b8('0x84')](0x10)['toString'](_0x44b8('0x85'));}function generateIssuedAt(){return Math['floor'](Date[_0x44b8('0x86')]()/0x3e8)[_0x44b8('0x87')]();}function createJwt(_0x4c1a7c){var _0x3f9438={'payload':{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')]},'options':{'algorithm':_0x44b8('0x88'),'subject':_0x4c1a7c['id'][_0x44b8('0x87')](),'issuer':hardwareConf[_0x44b8('0x49')](),'audience':hardwareConf[_0x44b8('0x49')]()}};return signJwt(_0x3f9438)[_0x44b8('0x34')](function(_0x3f9102){return{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')],'token':_0x3f9102};});} \ No newline at end of file +var _0x008c=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','session','payload','options','promisify','verify','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','userpic','permissions','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','smsAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','unmanaged','json','headers','startsWith','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x008c,0x188));var _0xc008=function(_0x883d31,_0x50f7d0){_0x883d31=_0x883d31-0x0;var _0x4201bb=_0x008c[_0x883d31];return _0x4201bb;};'use strict';var db=require(_0xc008('0x0'))['db'];var config=require(_0xc008('0x1'));var hardwareConf=require(_0xc008('0x2'));var licenseUtil=require(_0xc008('0x3'));var encryptor=require(_0xc008('0x4'));var _=require('lodash');var jwt=require(_0xc008('0x5'));var expressJwt=require(_0xc008('0x6'));var compose=require(_0xc008('0x7'));var basicAuth=require(_0xc008('0x8'));var crypto=require(_0xc008('0x9'));var BPromise=require(_0xc008('0xa'));var util=require(_0xc008('0xb'));var moment=require(_0xc008('0xc'));var validateJwt=expressJwt({'secret':config[_0xc008('0xd')]['session']});var userAttributes=['id',_0xc008('0xe'),'fullname',_0xc008('0xf'),'internal','email',_0xc008('0x10'),_0xc008('0x11'),'md5secret','voicePause','chatPause',_0xc008('0x12'),_0xc008('0x13'),'smsPause',_0xc008('0x14'),_0xc008('0x15'),_0xc008('0x16'),_0xc008('0x17'),_0xc008('0x18'),_0xc008('0x19'),_0xc008('0x1a'),'passwordResetAt','alias',_0xc008('0x1b'),'phoneBarAutoAnswerDelay',_0xc008('0x1c'),_0xc008('0x1d'),_0xc008('0x1e'),_0xc008('0x1f'),_0xc008('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xc008('0x21'),_0xc008('0x22'),_0xc008('0x23'),_0xc008('0x24'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xc008('0x25'),_0xc008('0x26'),'selectRecallMeCampaign',_0xc008('0x27'),'chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xc008('0x28'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xc008('0x29')];exports[_0xc008('0x2a')]=function(){return this[_0xc008('0x2b')](!![])[_0xc008('0x2c')](function(_0x11cc75,_0x110128,_0x4f43e2){if(_0x11cc75[_0xc008('0x2d')]){_0x4f43e2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x11cc75[_0xc008('0x2e')]['id']},'attributes':['id',_0xc008('0x2f'),_0xc008('0x30')],'raw':!![]})[_0xc008('0x31')](function(_0x5410f5){if(_0x5410f5&&_0x5410f5['closed']){return _0x110128['status'](_0x5410f5[_0xc008('0x30')]===_0xc008('0x32')?0x195:0x193)[_0xc008('0x33')]({'message':_0x5410f5[_0xc008('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x4f43e2();}})['catch'](function(_0x4caaf4){_0x4f43e2(_0x4caaf4);});}});};exports[_0xc008('0x2b')]=function isAuthenticated(_0x29ba43){return compose()[_0xc008('0x2c')](function(_0x529961,_0x24c14c,_0x32390d){var _0x209591;if(_0x529961[_0xc008('0x34')]['authorization']){if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],'Basic')){var _0x539766=basicAuth(_0x529961);db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'name':_0x539766[_0xc008('0xf')]}})[_0xc008('0x31')](function(_0x1de04b){if(!_0x1de04b||!_0x1de04b[_0xc008('0x38')](_0x539766[_0xc008('0x39')])){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x3b')});}_0x529961[_0xc008('0x2d')]={'id':_0x1de04b['id']};_0x32390d();})[_0xc008('0x3c')](function(_0x596ee8){_0x32390d(_0x596ee8);});}else if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],_0xc008('0x3d'))){validateJwt(_0x529961,_0x24c14c,_0x32390d);}else{if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}}}else if(_0x529961[_0xc008('0x3f')][_0xc008('0x40')]){try{var _0x7cfbc5={'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};verifyJwt(_0x529961['query'][_0xc008('0x40')],_0x7cfbc5)[_0xc008('0x31')](function(_0x459df4){return db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x459df4[_0xc008('0x42')]}})[_0xc008('0x31')](function(_0x5d0e06){_0x209591=_0x5d0e06;return db[_0xc008('0x43')][_0xc008('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc008('0x45')],'raw':!![]});})[_0xc008('0x31')](function(_0x5e38d5){if(!_0x209591||!_[_0xc008('0x46')](_0x209591[_0xc008('0x47')],_0x459df4[_0xc008('0x48')])){return _0x24c14c['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x209591[_0xc008('0x49')]){return _0x24c14c['status'](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}if(_0x209591[_0xc008('0x4b')]){if(_0x5e38d5[_0xc008('0x45')]>0x0){if(moment(_0x209591[_0xc008('0x4c')])[_0xc008('0x4d')](_0x5e38d5[_0xc008('0x45')],_0xc008('0x4e'))>moment()){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}else{return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}_0x529961['user']={'id':_0x209591['id']};_0x32390d();});})[_0xc008('0x3c')](function(){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});});}catch(_0x49a16d){_0x32390d(_0x49a16d);}}else if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}})[_0xc008('0x2c')](function(_0x2d142d,_0x5706bb,_0x398cdd){if(_0x2d142d[_0xc008('0x2d')]){db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x2d142d[_0xc008('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0xf4cc4b){if(!_0xf4cc4b){return _0x5706bb[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x4f')});}_0x2d142d['user']=_0xf4cc4b;_0x398cdd();})[_0xc008('0x3c')](function(_0xe37446){_0x398cdd(_0xe37446);});}else if(_0x29ba43){_0x398cdd();}else{return _0x5706bb[_0xc008('0x3a')](0x194)['json']({'message':_0xc008('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc008('0x2c')](function(_0x5d3a72,_0x46fa8f,_0x213014){return licenseUtil['getLicense']()[_0xc008('0x31')](function(_0x24ba0f){if(_0x24ba0f[_0xc008('0x51')]){_0x213014();}else{return _0x46fa8f['status'](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x44fc5d){_0x213014(_0x44fc5d);});});};exports[_0xc008('0x53')]=function isWebrtcLicence(){return compose()[_0xc008('0x2c')](function(_0x59ca2b,_0x47cafa,_0x5283a8){return licenseUtil[_0xc008('0x54')]()[_0xc008('0x31')](function(_0x103a83){if(_0x103a83[_0xc008('0x55')]){_0x5283a8();}else{return _0x47cafa[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x572593){_0x5283a8(_0x572593);});});};exports['isMiddleware']=function(_0x516e43,_0x2d5a49,_0x2651cf){_0x516e43[_0xc008('0x56')]=!![];return _0x2651cf();};exports['signToken']=function signToken(_0x28bc33){return signJwt(_0x28bc33);};exports[_0xc008('0x57')]=function(_0x17ab1a,_0x1c2c50){if(!_0x17ab1a[_0xc008('0x2d')]){return _0x1c2c50[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x58')});}var _0x3fd7d9={'payload':{'id':_0x17ab1a[_0xc008('0x2d')]['id'],'role':_0x17ab1a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd7d9)[_0xc008('0x31')](function(_0x51cb14){_0x1c2c50[_0xc008('0x59')](_0xc008('0x5a'),_0x51cb14);_0x1c2c50[_0xc008('0x5b')]('/dashboards/general');})[_0xc008('0x3c')](function(_0x32b435){return _0x1c2c50[_0xc008('0x3a')](0x1f4)[_0xc008('0x5c')](_0x32b435);});};exports[_0xc008('0x5d')]=function(_0x51105f){if(_[_0xc008('0x5e')](_0x51105f[_0xc008('0x47')])||_['isNil'](_0x51105f[_0xc008('0x5f')])){return null;}else{return createJwt(_0x51105f);}};exports[_0xc008('0x60')]=function(_0x5b5fbf){_0x5b5fbf['apiKeyNonce']=generateNonce();_0x5b5fbf[_0xc008('0x5f')]=generateIssuedAt();return createJwt(_0x5b5fbf);};exports[_0xc008('0x61')]=function(_0x20947b,_0x30d0aa){var _0x14b6a0=_0x20947b['query']['apikey'];if(_0x14b6a0){var _0x34b72a={'nonce':_0x30d0aa['apiKeyNonce'],'iat':_0x30d0aa[_0xc008('0x5f')],'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};return verifyJwt(_0x14b6a0,_0x34b72a)[_0xc008('0x31')](function(){return generateApiKey(_0x30d0aa);});}else{throw{'message':_0xc008('0x62')};}};exports[_0xc008('0x63')]=function(_0x49d8b0){var _0x2ea742=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2ea742[_0xc008('0x64')](_0x49d8b0))throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0xc008('0x67'));return;};exports['validatePasswordHistory']=function(_0x41fae3,_0x4fdab4,_0x535e6e){var _0x5dbfca=encryptor[_0xc008('0x68')](_0x4fdab4)[_0xc008('0x69')](',');for(var _0x5dfb69=0x0;_0x5dfb69<_0x535e6e;_0x5dfb69++){if(!_0x5dbfca[_0x5dfb69])break;if(_0x41fae3['toLowerCase']()===_0x5dbfca[_0x5dfb69][_0xc008('0x6a')]()){var _0x2d8361=util[_0xc008('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x535e6e);if(_0x535e6e===0x1){_0x2d8361=_0xc008('0x6c');}throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0x2d8361);}}return;};exports[_0xc008('0x6d')]=function(_0x5baff1,_0x4022dd){var _0x4eaa6d=_0x4022dd?encryptor[_0xc008('0x68')](_0x4022dd)[_0xc008('0x69')](','):[];if(_0x4eaa6d[_0xc008('0x6e')]===0x5){_0x4eaa6d[_0xc008('0x6f')](-0x1,0x1);}_0x4eaa6d[_0xc008('0x70')](_0x5baff1);return encryptor[_0xc008('0x71')](_0x4eaa6d['join'](','));};function signJwt(_0x375e71){var _0x570001=BPromise['promisify'](jwt[_0xc008('0x72')],{'context':jwt});var _0x30aa1e=_0x375e71['secret']||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x3e373e,_0x4517c0){_0x570001(_0x375e71[_0xc008('0x74')],_0x30aa1e,_0x375e71[_0xc008('0x75')])[_0xc008('0x31')](function(_0x57ce9a){_0x3e373e(_0x57ce9a);})[_0xc008('0x3c')](function(_0x462e1e){_0x4517c0(_0x462e1e);});});}function verifyJwt(_0x3bfb15,_0x2a60e6,_0xb3ca0f){var _0x167425=BPromise[_0xc008('0x76')](jwt[_0xc008('0x77')],{'context':jwt});var _0xbc430a=_0xb3ca0f||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x2b5eb6,_0x131b81){_0x167425(_0x3bfb15,_0xbc430a,_0x2a60e6)[_0xc008('0x31')](function(_0x4e0251){_0x2b5eb6(_0x4e0251);})[_0xc008('0x3c')](function(_0x2e5467){_0x131b81(_0x2e5467);});});}function generateNonce(){return crypto[_0xc008('0x78')](0x10)['toString'](_0xc008('0x79'));}function generateIssuedAt(){return Math[_0xc008('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1a03fd){var _0x2a4c2b={'payload':{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd[_0xc008('0x47')]},'options':{'algorithm':_0xc008('0x7b'),'subject':_0x1a03fd['id'][_0xc008('0x7c')](),'issuer':hardwareConf[_0xc008('0x41')](),'audience':hardwareConf[_0xc008('0x41')]()}};return signJwt(_0x2a4c2b)[_0xc008('0x31')](function(_0x1b059b){return{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd['apiKeyNonce'],'token':_0x1b059b};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 7c960f6..d3b0e15 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 _0xa7a7=['aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','createReadStream','createWriteStream','binary','write','end','final','close','unlink','decryptFile','createDecipher','update','secret','createCipher','utf8','base64','bluebird','lodash','../../config/environment','../../config/logger','secrets','session'];(function(_0x1bcac1,_0x38c85e){var _0x460c6f=function(_0x1bbce0){while(--_0x1bbce0){_0x1bcac1['push'](_0x1bcac1['shift']());}};_0x460c6f(++_0x38c85e);}(_0xa7a7,0x7a));var _0x7a7a=function(_0x18f084,_0x782d8e){_0x18f084=_0x18f084-0x0;var _0x5943b7=_0xa7a7[_0x18f084];return _0x5943b7;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x7a7a('0x0'));var _=require(_0x7a7a('0x1'));var config=require(_0x7a7a('0x2'));var logger=require(_0x7a7a('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7a7a('0x4')][_0x7a7a('0x5')],'algorithm':_0x7a7a('0x6')};const fileOptions={'algorithm':_0x7a7a('0x7')};if(config[_0x7a7a('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x7a7a('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x7a7a('0x8')][_0x7a7a('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7a7a('0xa')](',\x20');logger[_0x7a7a('0xb')](config['encrypt']['algorithm'],_0x7a7a('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x1546f1){return AES_SUPPORTED_RX[_0x7a7a('0xd')](_0x1546f1);}function getSupportedCiphers(){return crypto[_0x7a7a('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x5e20f1){return getSupportedCiphers()[_0x7a7a('0xf')](_0x5e20f1)>-0x1;}function combineOptions(_0x3f24dc){var _0x49af16={};for(var _0x458048 in fileOptions){if(fileOptions[_0x7a7a('0x10')](_0x458048)){_0x49af16[_0x458048]=fileOptions[_0x458048];}}if(_0x3f24dc){for(var _0x3dab78 in _0x3f24dc){if(_0x3f24dc[_0x7a7a('0x10')](_0x3dab78)){_0x49af16[_0x3dab78]=_0x3f24dc[_0x3dab78];}}}return _0x49af16;}exports['encryptFile']=function(_0x181d21,_0x4dcb3a,_0x6e07b6,_0x203227){return new BPromise(function(_0x21abd0,_0x2f32a6){_0x203227=combineOptions(_0x203227);var _0x52a138=new Buffer(_0x6e07b6);var _0x1d7f0e=fs[_0x7a7a('0x11')](_0x181d21);var _0x481718=fs[_0x7a7a('0x12')](_0x4dcb3a);var _0x50a59c=crypto['createCipher'](_0x203227[_0x7a7a('0x9')],_0x52a138);_0x1d7f0e['on']('data',function(_0x47bed8){var _0x252428=new Buffer(_0x50a59c['update'](_0x47bed8),_0x7a7a('0x13'));_0x481718[_0x7a7a('0x14')](_0x252428);});_0x1d7f0e['on'](_0x7a7a('0x15'),function(){try{var _0x1dd140=new Buffer(_0x50a59c[_0x7a7a('0x16')](_0x7a7a('0x13')),_0x7a7a('0x13'));_0x481718[_0x7a7a('0x14')](_0x1dd140);_0x481718[_0x7a7a('0x15')]();_0x481718['on'](_0x7a7a('0x17'),function(){return _0x21abd0(_0x4dcb3a);});}catch(_0x5bda87){fs[_0x7a7a('0x18')](_0x4dcb3a);return _0x2f32a6(_0x5bda87);}});});};exports[_0x7a7a('0x19')]=function(_0x30d844,_0x153b35,_0xc4bc4e,_0x715815){return new BPromise(function(_0x332216,_0x4710ee){_0x715815=combineOptions(_0x715815);var _0x1c1089=new Buffer(_0xc4bc4e);var _0x2a2c15=fs[_0x7a7a('0x11')](_0x30d844);var _0x138bd7=fs['createWriteStream'](_0x153b35);var _0x261d04=crypto[_0x7a7a('0x1a')](_0x715815[_0x7a7a('0x9')],_0x1c1089);_0x2a2c15['on']('data',function(_0x327e28){var _0x2e2a8d=new Buffer(_0x261d04[_0x7a7a('0x1b')](_0x327e28),_0x7a7a('0x13'));_0x138bd7['write'](_0x2e2a8d);});_0x2a2c15['on']('end',function(){try{var _0x456771=new Buffer(_0x261d04[_0x7a7a('0x16')](_0x7a7a('0x13')),'binary');_0x138bd7[_0x7a7a('0x14')](_0x456771);_0x138bd7['end']();_0x138bd7['on'](_0x7a7a('0x17'),function(){return _0x332216(_0x153b35);});}catch(_0x5ad02c){fs[_0x7a7a('0x18')](_0x153b35);return _0x4710ee(_0x5ad02c);}});});};exports['encryptString']=function(_0x320306,_0x579e64,_0x414d08){var _0x3d4631=_0x414d08||stringOptions['algorithm'];var _0x2f50c0=_0x579e64||stringOptions[_0x7a7a('0x1c')];var _0x414f88=crypto[_0x7a7a('0x1d')](_0x3d4631,_0x2f50c0);var _0x3c45e4=_0x414f88[_0x7a7a('0x1b')](_0x320306,_0x7a7a('0x1e'),_0x7a7a('0x1f'));_0x3c45e4+=_0x414f88[_0x7a7a('0x16')](_0x7a7a('0x1f'));return _0x3c45e4;};exports['decryptString']=function(_0x2a6b28,_0x2651ee,_0x263732){var _0xc21d48=_0x263732||stringOptions[_0x7a7a('0x9')];var _0x2880e9=_0x2651ee||stringOptions[_0x7a7a('0x1c')];var _0x3bd32f=crypto[_0x7a7a('0x1a')](_0xc21d48,_0x2880e9);var _0x13bb5c=_0x3bd32f['update'](_0x2a6b28,_0x7a7a('0x1f'),_0x7a7a('0x1e'));_0x13bb5c+=_0x3bd32f[_0x7a7a('0x16')](_0x7a7a('0x1e'));return _0x13bb5c;}; \ No newline at end of file +var _0x82db=['utf8','base64','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','end','close','unlink','decryptFile','createDecipher','final','write','encryptString','secret'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x82db,0xa7));var _0xb82d=function(_0x4d857c,_0x512c53){_0x4d857c=_0x4d857c-0x0;var _0x857c55=_0x82db[_0x4d857c];return _0x857c55;};'use strict';var crypto=require(_0xb82d('0x0'));var fs=require('fs');var BPromise=require(_0xb82d('0x1'));var _=require(_0xb82d('0x2'));var config=require(_0xb82d('0x3'));var logger=require(_0xb82d('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb82d('0x5')][_0xb82d('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0xb82d('0x7')]&&config[_0xb82d('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xb82d('0x7')][_0xb82d('0x8')]);if(isSupported){fileOptions[_0xb82d('0x8')]=config[_0xb82d('0x7')][_0xb82d('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb82d('0x9')](',\x20');logger[_0xb82d('0xa')](config[_0xb82d('0x7')][_0xb82d('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x37bd29){return AES_SUPPORTED_RX[_0xb82d('0xb')](_0x37bd29);}function getSupportedCiphers(){return crypto[_0xb82d('0xc')]()[_0xb82d('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4ae226){return getSupportedCiphers()[_0xb82d('0xe')](_0x4ae226)>-0x1;}function combineOptions(_0x412015){var _0x182aba={};for(var _0x54f5c6 in fileOptions){if(fileOptions[_0xb82d('0xf')](_0x54f5c6)){_0x182aba[_0x54f5c6]=fileOptions[_0x54f5c6];}}if(_0x412015){for(var _0x36048b in _0x412015){if(_0x412015['hasOwnProperty'](_0x36048b)){_0x182aba[_0x36048b]=_0x412015[_0x36048b];}}}return _0x182aba;}exports[_0xb82d('0x10')]=function(_0x45f05e,_0x1ee886,_0xad42c0,_0x58ad4f){return new BPromise(function(_0x296e04,_0x219ea2){_0x58ad4f=combineOptions(_0x58ad4f);var _0x2e0c97=new Buffer(_0xad42c0);var _0x1a927e=fs['createReadStream'](_0x45f05e);var _0x56872f=fs[_0xb82d('0x11')](_0x1ee886);var _0x20577e=crypto[_0xb82d('0x12')](_0x58ad4f[_0xb82d('0x8')],_0x2e0c97);_0x1a927e['on'](_0xb82d('0x13'),function(_0x25a430){var _0x2bd725=new Buffer(_0x20577e[_0xb82d('0x14')](_0x25a430),_0xb82d('0x15'));_0x56872f['write'](_0x2bd725);});_0x1a927e['on']('end',function(){try{var _0x4a286d=new Buffer(_0x20577e['final'](_0xb82d('0x15')),_0xb82d('0x15'));_0x56872f['write'](_0x4a286d);_0x56872f[_0xb82d('0x16')]();_0x56872f['on'](_0xb82d('0x17'),function(){return _0x296e04(_0x1ee886);});}catch(_0x2348d7){fs[_0xb82d('0x18')](_0x1ee886);return _0x219ea2(_0x2348d7);}});});};exports[_0xb82d('0x19')]=function(_0xc178d0,_0x23b429,_0x2da988,_0x466fe9){return new BPromise(function(_0x37938c,_0xff2923){_0x466fe9=combineOptions(_0x466fe9);var _0x40cd99=new Buffer(_0x2da988);var _0x52b0d2=fs['createReadStream'](_0xc178d0);var _0x4ec731=fs[_0xb82d('0x11')](_0x23b429);var _0x199c97=crypto[_0xb82d('0x1a')](_0x466fe9[_0xb82d('0x8')],_0x40cd99);_0x52b0d2['on'](_0xb82d('0x13'),function(_0x4a43b1){var _0x3554aa=new Buffer(_0x199c97['update'](_0x4a43b1),_0xb82d('0x15'));_0x4ec731['write'](_0x3554aa);});_0x52b0d2['on'](_0xb82d('0x16'),function(){try{var _0x466a00=new Buffer(_0x199c97[_0xb82d('0x1b')](_0xb82d('0x15')),_0xb82d('0x15'));_0x4ec731[_0xb82d('0x1c')](_0x466a00);_0x4ec731[_0xb82d('0x16')]();_0x4ec731['on'](_0xb82d('0x17'),function(){return _0x37938c(_0x23b429);});}catch(_0x526d5e){fs[_0xb82d('0x18')](_0x23b429);return _0xff2923(_0x526d5e);}});});};exports[_0xb82d('0x1d')]=function(_0x117d71,_0x5dfa14,_0x53c3f6){var _0x44be12=_0x53c3f6||stringOptions[_0xb82d('0x8')];var _0x25e0fa=_0x5dfa14||stringOptions[_0xb82d('0x1e')];var _0x11dd8c=crypto['createCipher'](_0x44be12,_0x25e0fa);var _0x5c1917=_0x11dd8c[_0xb82d('0x14')](_0x117d71,_0xb82d('0x1f'),_0xb82d('0x20'));_0x5c1917+=_0x11dd8c['final'](_0xb82d('0x20'));return _0x5c1917;};exports['decryptString']=function(_0x1dfa5d,_0x580021,_0x495f31){var _0x8056fa=_0x495f31||stringOptions[_0xb82d('0x8')];var _0x44f66b=_0x580021||stringOptions[_0xb82d('0x1e')];var _0x4f32d9=crypto['createDecipher'](_0x8056fa,_0x44f66b);var _0x439185=_0x4f32d9['update'](_0x1dfa5d,_0xb82d('0x20'),'utf8');_0x439185+=_0x4f32d9[_0xb82d('0x1b')]('utf8');return _0x439185;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3a0bead..7541c7e 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 _0x1446=['CSV','Setting','find','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','split','length','range','query','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each','%s%d.%s','%s.%s','csv','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1446,0x1bd));var _0x6144=function(_0x9b7325,_0x50b8fa){_0x9b7325=_0x9b7325-0x0;var _0x550071=_0x1446[_0x9b7325];return _0x550071;};'use strict';var util=require(_0x6144('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0x6144('0x1'));var fs=require('fs');var BPromise=require(_0x6144('0x2'));var zipdir=require(_0x6144('0x3'));var rimraf=require(_0x6144('0x4'));var db=require(_0x6144('0x5'))['db'];var dbH=require(_0x6144('0x5'))[_0x6144('0x6')];var logger=require('../../config/logger')(_0x6144('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6144('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6144('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5aef7f,_0x378c5a){var _0x1ab797={'status':_0x5aef7f};var _0x280265={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x378c5a){_0x1ab797[_0x6144('0x9')]=_0x378c5a;}return db[_0x6144('0xa')][_0x6144('0xb')](_0x1ab797,_0x280265);}function main(){var _0x2ba756=0x1388;var _0x17e014;logger[_0x6144('0xc')](util[_0x6144('0xd')](_0x6144('0xe'),EXTRACTED_REPORT_ID,_0x6144('0xf')));return db[_0x6144('0x10')][_0x6144('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6144('0x12')]})[_0x6144('0x13')](function(_0x239919){if(_0x239919){_0x17e014=_0x239919;_0x2ba756=_0x17e014[_0x6144('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x6144('0xd')](_0x6144('0x14'),QUERY),{'type':dbH[_0x6144('0x15')][_0x6144('0x16')][_0x6144('0x17')]});})[_0x6144('0x13')](function(_0x1d0ae4){if(!_0x1d0ae4[0x0][_0x6144('0x18')]){return analyticExtractedReport('Empty');}var _0x1d51ef=[];var _0x730f7a=0x0;if(_0x17e014[_0x6144('0x19')]){if(_0x1d0ae4&&_0x1d0ae4[_0x6144('0x1a')]){var _0x2adf66=_[_0x6144('0x1b')](_0x1d0ae4[0x0]['num']/_0x2ba756);var _0x4661b4=Number['isInteger'](_0x1d0ae4[0x0][_0x6144('0x18')]/_0x2ba756)?_0x1d0ae4[0x0][_0x6144('0x18')]%_0x2ba756:0x0;_0x2adf66['forEach'](function(_0x27b5bb){if(_0x27b5bb>0x0){_0x730f7a+=_0x2ba756;}_0x1d51ef['push'](dbH[_0x6144('0x15')][_0x6144('0x1c')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2ba756,_0x730f7a),{'type':dbH['sequelize'][_0x6144('0x16')]['SELECT']}));});if(_0x4661b4>0x0){_0x730f7a+=_0x2ba756;_0x1d51ef[_0x6144('0x1d')](dbH[_0x6144('0x15')]['query'](util['format'](_0x6144('0x1e'),QUERY,_0x4661b4,_0x730f7a),{'type':dbH['sequelize']['QueryTypes'][_0x6144('0x17')]}));}}}else{_0x1d51ef[_0x6144('0x1d')](dbH[_0x6144('0x15')][_0x6144('0x1c')](QUERY,{'type':dbH[_0x6144('0x15')][_0x6144('0x16')][_0x6144('0x17')]}));}var _0x3081a3=path[_0x6144('0x1f')](PATH);var _0x178e62=path[_0x6144('0x20')](PATH,'.csv');var _0x38e640=_0x17e014[_0x6144('0x19')]&&_0x1d51ef['length']>0x1;var _0x10745=[];if(!fs['existsSync'](path[_0x6144('0x21')](_0x3081a3,_0x178e62))&&_0x38e640){fs[_0x6144('0x22')](path[_0x6144('0x21')](_0x3081a3,_0x178e62));}return BPromise[_0x6144('0x23')](_0x1d51ef,function(_0x20a181){_0x10745[_0x6144('0x1d')](_0x20a181);})[_0x6144('0x13')](function(){for(var _0xcd52f1=0x0;_0xcd52f1<_0x10745[_0x6144('0x1a')];_0xcd52f1+=0x1){var _0x1134b6;var _0xb310d=_0x10745[_0xcd52f1];if(_0x38e640){_0x1134b6=path['join'](_0x3081a3,_0x178e62,util[_0x6144('0xd')](_0x6144('0x24'),_0x178e62,_0xcd52f1,'csv'));}else{_0x1134b6=path[_0x6144('0x21')](_0x3081a3,util['format'](_0x6144('0x25'),_0x178e62,_0x6144('0x26')));}fs['writeFileSync'](_0x1134b6,csv(_0xb310d));}})['then'](function(){if(_0x38e640){return new Promise(function(_0x408231){zipdir(path['join'](_0x3081a3,_0x178e62),{'saveTo':path[_0x6144('0x21')](_0x3081a3,util[_0x6144('0xd')](_0x6144('0x25'),_0x178e62,_0x6144('0x27')))},function(_0x2b9e90,_0x39ccb6){rimraf(path['join'](_0x3081a3,_0x178e62),function(){});_0x408231('zip\x20finished');});});}})[_0x6144('0x13')](function(){logger[_0x6144('0xc')](util[_0x6144('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6144('0xf')));return analyticExtractedReport(_0x6144('0x28'),_0x38e640?util['format'](_0x6144('0x25'),_0x178e62,_0x38e640?'zip':_0x6144('0x26')):null);});})[_0x6144('0x29')](function(_0x4ac0a9){logger[_0x6144('0xc')](util[_0x6144('0xd')](_0x6144('0x2a'),EXTRACTED_REPORT_ID,_0x6144('0xf')),util[_0x6144('0x2b')](_0x4ac0a9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6144('0x2c'));})[_0x6144('0x2d')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf836=['inspect','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','find','split','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch'];(function(_0x582dce,_0x580506){var _0xab1e90=function(_0x31d183){while(--_0x31d183){_0x582dce['push'](_0x582dce['shift']());}};_0xab1e90(++_0x580506);}(_0xf836,0x13c));var _0x6f83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf836[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x6f83('0x0'));var path=require(_0x6f83('0x1'));var _=require('lodash');var csv=require(_0x6f83('0x2'));var fs=require('fs');var BPromise=require(_0x6f83('0x3'));var zipdir=require(_0x6f83('0x4'));var rimraf=require(_0x6f83('0x5'));var db=require(_0x6f83('0x6'))['db'];var dbH=require('../../mysqldb')[_0x6f83('0x7')];var logger=require(_0x6f83('0x8'))(_0x6f83('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x6f83('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6f83('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x126eff,_0x5ae42a){var _0x4340b1={'status':_0x126eff};var _0x1a034b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ae42a){_0x4340b1[_0x6f83('0xb')]=_0x5ae42a;}return db[_0x6f83('0xc')][_0x6f83('0xd')](_0x4340b1,_0x1a034b);}function main(){var _0x55edd7=0x1388;var _0x1a1d15;logger[_0x6f83('0xe')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6f83('0xf')));return db[_0x6f83('0x10')][_0x6f83('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6f83('0x12'),'splitSizeCsv']})[_0x6f83('0x13')](function(_0xfcc0ce){if(_0xfcc0ce){_0x1a1d15=_0xfcc0ce;_0x55edd7=_0x1a1d15['splitSizeCsv']||0x1388;}})[_0x6f83('0x13')](function(){return dbH[_0x6f83('0x14')][_0x6f83('0x15')](util[_0x6f83('0x16')](_0x6f83('0x17'),QUERY),{'type':dbH[_0x6f83('0x14')][_0x6f83('0x18')][_0x6f83('0x19')]});})[_0x6f83('0x13')](function(_0x41f8db){if(!_0x41f8db[0x0][_0x6f83('0x1a')]){return analyticExtractedReport('Empty');}var _0x33d7fd=[];var _0x1b1617=0x0;if(_0x1a1d15[_0x6f83('0x12')]){if(_0x41f8db&&_0x41f8db[_0x6f83('0x1b')]){var _0x317e0e=_[_0x6f83('0x1c')](_0x41f8db[0x0][_0x6f83('0x1a')]/_0x55edd7);var _0x21979e=Number[_0x6f83('0x1d')](_0x41f8db[0x0][_0x6f83('0x1a')]/_0x55edd7)?_0x41f8db[0x0][_0x6f83('0x1a')]%_0x55edd7:0x0;_0x317e0e[_0x6f83('0x1e')](function(_0x36c783){if(_0x36c783>0x0){_0x1b1617+=_0x55edd7;}_0x33d7fd[_0x6f83('0x1f')](dbH[_0x6f83('0x14')][_0x6f83('0x15')](util[_0x6f83('0x16')](_0x6f83('0x20'),QUERY,_0x55edd7,_0x1b1617),{'type':dbH[_0x6f83('0x14')]['QueryTypes']['SELECT']}));});if(_0x21979e>0x0){_0x1b1617+=_0x55edd7;_0x33d7fd['push'](dbH[_0x6f83('0x14')]['query'](util[_0x6f83('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x21979e,_0x1b1617),{'type':dbH['sequelize']['QueryTypes'][_0x6f83('0x19')]}));}}}else{_0x33d7fd[_0x6f83('0x1f')](dbH[_0x6f83('0x14')]['query'](QUERY,{'type':dbH[_0x6f83('0x14')]['QueryTypes'][_0x6f83('0x19')]}));}var _0x4b3f87=path[_0x6f83('0x21')](PATH);var _0x24a3ac=path[_0x6f83('0x22')](PATH,'.csv');var _0x576432=_0x1a1d15['split']&&_0x33d7fd[_0x6f83('0x1b')]>0x1;var _0x31f18f=[];if(!fs[_0x6f83('0x23')](path[_0x6f83('0x24')](_0x4b3f87,_0x24a3ac))&&_0x576432){fs[_0x6f83('0x25')](path['join'](_0x4b3f87,_0x24a3ac));}return BPromise[_0x6f83('0x26')](_0x33d7fd,function(_0x7206d5){_0x31f18f[_0x6f83('0x1f')](_0x7206d5);})[_0x6f83('0x13')](function(){for(var _0x970d03=0x0;_0x970d03<_0x31f18f['length'];_0x970d03+=0x1){var _0x45f1b3;var _0x4af6e9=_0x31f18f[_0x970d03];if(_0x576432){_0x45f1b3=path['join'](_0x4b3f87,_0x24a3ac,util[_0x6f83('0x16')](_0x6f83('0x27'),_0x24a3ac,_0x970d03,_0x6f83('0x28')));}else{_0x45f1b3=path[_0x6f83('0x24')](_0x4b3f87,util[_0x6f83('0x16')](_0x6f83('0x29'),_0x24a3ac,_0x6f83('0x28')));}fs[_0x6f83('0x2a')](_0x45f1b3,csv(_0x4af6e9));}})[_0x6f83('0x13')](function(){if(_0x576432){return new Promise(function(_0x4aee79){zipdir(path['join'](_0x4b3f87,_0x24a3ac),{'saveTo':path['join'](_0x4b3f87,util['format'](_0x6f83('0x29'),_0x24a3ac,_0x6f83('0x2b')))},function(_0x166cf3,_0x59a39a){rimraf(path[_0x6f83('0x24')](_0x4b3f87,_0x24a3ac),function(){});_0x4aee79(_0x6f83('0x2c'));});});}})[_0x6f83('0x13')](function(){logger[_0x6f83('0xe')](util[_0x6f83('0x16')](_0x6f83('0x2d'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6f83('0x2e'),_0x576432?util[_0x6f83('0x16')](_0x6f83('0x29'),_0x24a3ac,_0x576432?'zip':'csv'):null);});})[_0x6f83('0x2f')](function(_0x1124c0){logger[_0x6f83('0xe')](util[_0x6f83('0x16')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6f83('0xf')),util[_0x6f83('0x30')](_0x1124c0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6f83('0x31'));})[_0x6f83('0x32')](function(){process[_0x6f83('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0b12423..a368958 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 _0x11e2=['findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfKitDocument','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','header','pageBreak','margin','landscape','\x20/\x20','footer','black','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','existsSync','mkdirSync','join','each','flatten','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x16ae4c,_0x111a84){var _0xc354b0=function(_0x536c30){while(--_0x536c30){_0x16ae4c['push'](_0x16ae4c['shift']());}};_0xc354b0(++_0x111a84);}(_0x11e2,0x1e5));var _0x211e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x11e2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x211e('0x0'));var fs=require('fs');var util=require(_0x211e('0x1'));var path=require(_0x211e('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x211e('0x3'));var PdfPrinter=require(_0x211e('0x4'));var zipdir=require(_0x211e('0x5'));var rimraf=require(_0x211e('0x6'));var JSDOM=require(_0x211e('0x7'))[_0x211e('0x8')];var window=new JSDOM('')[_0x211e('0x9')];var BPromise=require('bluebird');var db=require(_0x211e('0xa'))['db'];var dbH=require(_0x211e('0xa'))[_0x211e('0xb')];var logger=require(_0x211e('0xc'))(_0x211e('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x211e('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x211e('0xe')][0x4];var NAME=process[_0x211e('0xe')][0x5];var FORMAT=_0x211e('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x241427,_0x15b0c6){var _0x2c376c={'status':_0x241427};var _0x476597={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15b0c6){_0x2c376c['savename']=_0x15b0c6;}return db[_0x211e('0x10')][_0x211e('0x11')](_0x2c376c,_0x476597);}function getHeaders(_0x31611e){return _[_0x211e('0x12')](_0x31611e,function(_0x32e0bf){return{'text':_0x32e0bf,'style':_0x211e('0x13')};});}function getRows(_0x13d539,_0x149a1f){return _['map'](_0x149a1f,function(_0x3a4b5f){return _(_0x3a4b5f)[_0x211e('0x14')](_0x13d539)[_0x211e('0x12')](function(_0x215f96){return _0x215f96?_[_0x211e('0x15')](_0x215f96):'';})[_0x211e('0x16')]();});}function createTable(_0xf0df03,_0x225bd1){var _0x4e2978={'widths':_[_0x211e('0x17')](Array(_0xf0df03['length']),0x91),'heights':function(_0x15bcca){return _0x15bcca===0x0?_0x211e('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xe45e0b=getHeaders(_0xf0df03);_0x4e2978['body']['push'](_0xe45e0b);var _0xd187ee=getRows(_0xf0df03,_0x225bd1);_0x4e2978[_0x211e('0x19')]=_0x4e2978[_0x211e('0x19')]['concat'](_0xd187ee);return _0x4e2978;}function createTables(_0x2fa414){var _0x504633=[];var _0x7abffb=_[_0x211e('0x1a')](Object[_0x211e('0x1b')](_0x2fa414[0x0]),0x5);_0x7abffb[_0x211e('0x1c')](function(_0x339d5c){_0x504633[_0x211e('0x1d')](createTable(_0x339d5c,_0x2fa414));});return _0x504633;}function getPDFDocDefinition(_0x3cdcaf){var _0x14b66c=util[_0x211e('0x1e')](_0x211e('0x1f'),NAME,EXTRACTED_REPORT[_0x211e('0x20')],moment(EXTRACTED_REPORT[_0x211e('0x21')])[_0x211e('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x211e('0x1e')](FORMAT));var _0x5e4826=[];for(var _0x45525e=0x0;_0x45525e<_0x3cdcaf[_0x211e('0x22')];_0x45525e++){var _0x263f91=[];if(_0x45525e===0x0){_0x263f91[_0x211e('0x1d')]({'text':_0x14b66c,'style':_0x211e('0x23')});}var _0x5cdbfd={'table':_0x3cdcaf[_0x45525e]};if(_0x45525e>0x0){_0x5cdbfd[_0x211e('0x24')]='before';_0x5cdbfd[_0x211e('0x25')]=[0x0,0x46,0x0,0x0];}_0x263f91[_0x211e('0x1d')](_0x5cdbfd);_0x5e4826[_0x211e('0x1d')](_0x263f91);}return{'pageSize':'A4','pageOrientation':_0x211e('0x26'),'content':_0x5e4826,'footer':function(_0x1cde59,_0x27bbdd){return{'text':_0x1cde59[_0x211e('0x15')]()+_0x211e('0x27')+_0x27bbdd,'style':_0x211e('0x28')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x211e('0x29')},'footer':{'alignment':_0x211e('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5aaf56){var _0x42a65e=0x1388;var _0x465ebc;if(!_0x5aaf56[0x0][_0x211e('0x2b')]){return analyticExtractedReport(_0x211e('0x2c'));}return db['Setting'][_0x211e('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x211e('0x2e'),_0x211e('0x2f')]})[_0x211e('0x30')](function(_0x3fd25b){if(_0x3fd25b){_0x465ebc=_0x3fd25b;_0x42a65e=_0x465ebc[_0x211e('0x2f')]||0x3e8;}})['then'](function(){var _0x4a61bb=[];var _0x1ce7ed=0x0;if(_0x465ebc['split']){if(_0x5aaf56&&_0x5aaf56[_0x211e('0x22')]){var _0x42a2a2=_[_0x211e('0x31')](_0x5aaf56[0x0][_0x211e('0x2b')]/_0x42a65e);var _0x2c97f8=Number[_0x211e('0x32')](_0x5aaf56[0x0][_0x211e('0x2b')]/_0x42a65e)?_0x5aaf56[0x0][_0x211e('0x2b')]%_0x42a65e:0x0;_0x42a2a2[_0x211e('0x1c')](function(_0x2efe62){if(_0x2efe62>0x0){_0x1ce7ed+=_0x42a65e;}_0x4a61bb[_0x211e('0x1d')](dbH['sequelize'][_0x211e('0x33')](util[_0x211e('0x1e')](_0x211e('0x34'),QUERY,_0x42a65e,_0x1ce7ed),{'type':dbH[_0x211e('0x35')][_0x211e('0x36')][_0x211e('0x37')]}));});if(_0x2c97f8>0x0){_0x1ce7ed+=_0x42a65e;_0x4a61bb[_0x211e('0x1d')](dbH[_0x211e('0x35')][_0x211e('0x33')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2c97f8,_0x1ce7ed),{'type':dbH[_0x211e('0x35')][_0x211e('0x36')][_0x211e('0x37')]}));}}}else{_0x4a61bb[_0x211e('0x1d')](dbH[_0x211e('0x35')]['query'](QUERY,{'type':dbH['sequelize'][_0x211e('0x36')][_0x211e('0x37')]}));}var _0x14ec86=path[_0x211e('0x38')](PATH);var _0x27d9ca=path[_0x211e('0x39')](PATH,'.pdf');var _0x5fb95=_0x465ebc['split']&&_0x4a61bb[_0x211e('0x22')]>0x1;var _0x417336=[];if(!fs[_0x211e('0x3a')](path['join'](_0x14ec86,_0x27d9ca))&&_0x5fb95){fs[_0x211e('0x3b')](path[_0x211e('0x3c')](_0x14ec86,_0x27d9ca));}return BPromise[_0x211e('0x3d')](_0x4a61bb,function(_0x1f8f90){_0x417336[_0x211e('0x1d')](_0x1f8f90);})[_0x211e('0x30')](function(){var _0x4926d1=[];for(var _0x71d177=0x0;_0x71d177<_0x417336[_0x211e('0x22')];_0x71d177+=0x1){var _0x5f9db9=_0x417336[_0x71d177];var _0x18473e=createTables(_[_0x211e('0x3e')](_0x5f9db9));var _0x43cb12;var _0x269779=getPDFDocDefinition(_0x18473e);var _0x3c8dd1=getPDFPrinter();var _0x161912=_0x3c8dd1['createPdfKitDocument'](_0x269779);if(_0x5fb95){_0x43cb12=path[_0x211e('0x3c')](_0x14ec86,_0x27d9ca,util[_0x211e('0x1e')]('%s%d.%s',_0x27d9ca,_0x71d177,_0x211e('0x3f')));}else{_0x43cb12=path['join'](_0x14ec86,util[_0x211e('0x1e')](_0x211e('0x40'),_0x27d9ca,'pdf'));}_0x4926d1[_0x211e('0x1d')](writePDFDocument(_0x161912,_0x43cb12));}return Promise[_0x211e('0x41')](_0x4926d1);})[_0x211e('0x30')](function(){if(_0x5fb95){return new Promise(function(_0x3c9972){zipdir(path[_0x211e('0x3c')](_0x14ec86,_0x27d9ca),{'saveTo':path['join'](_0x14ec86,util['format'](_0x211e('0x40'),_0x27d9ca,'zip'))},function(){rimraf(path['join'](_0x14ec86,_0x27d9ca),function(){});_0x3c9972(_0x211e('0x42'));});});}})[_0x211e('0x30')](function(){if(!_0x5fb95)return;rimraf(path[_0x211e('0x3c')](_0x14ec86,_0x27d9ca),function(){});})[_0x211e('0x30')](function(){logger[_0x211e('0x43')](util['format'](_0x211e('0x44'),EXTRACTED_REPORT_ID,_0x211e('0x45')));return analyticExtractedReport(_0x211e('0x46'),_0x5fb95?util['format'](_0x211e('0x40'),_0x27d9ca,_0x5fb95?_0x211e('0x47'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x211e('0x1e')](_0x211e('0x48'),EXTRACTED_REPORT_ID,_0x211e('0x45')));return db[_0x211e('0x10')][_0x211e('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x211e('0x30')](function(_0x14f9fc){EXTRACTED_REPORT=_0x14f9fc;return dbH[_0x211e('0x35')]['query'](util[_0x211e('0x1e')](_0x211e('0x4a'),QUERY),{'type':dbH[_0x211e('0x35')][_0x211e('0x36')][_0x211e('0x37')]});})['then'](extractReport)['catch'](function(_0x55b439){logger[_0x211e('0x43')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x211e('0x45')),util[_0x211e('0x4b')](_0x55b439,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x211e('0x4c')](function(){process[_0x211e('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3361a4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x211e('0x4e'),'italics':__dirname+_0x211e('0x4f'),'bolditalics':__dirname+_0x211e('0x50')}});return _0x3361a4;}function getPDFDocDefinitionFromHTML(_0x47574a,_0x44d8cb){var _0x263ab6=util[_0x211e('0x1e')](_0x211e('0x51'),_0x44d8cb[_0x211e('0x52')],_0x44d8cb[_0x211e('0x53')]);var _0x2a89b0=moment()[_0x211e('0x1e')](_0x211e('0x54'))[_0x211e('0x15')]();var _0x5d746b=htmlToPdfmake(_0x47574a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5d746b],'defaultStyle':{'font':_0x211e('0x55')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x211e('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x211e('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x211e('0x57'),'style':_0x211e('0x23')}];},'footer':function(_0x2a0c3f,_0x4dd2cf){return[{'text':util[_0x211e('0x1e')](_0x211e('0x58'),_0x263ab6,_0x2a0c3f,_0x4dd2cf,_0x2a89b0),'style':_0x211e('0x28')}];}};}function writePDFDocument(_0x5645c2,_0x1994b3){return new Promise(function(_0x298cf4,_0x501e36){var _0x19ce46=_0x5645c2['pipe'](fs['createWriteStream'](_0x1994b3));_0x19ce46['on'](_0x211e('0x59'),function(){_0x298cf4(_0x211e('0x59'));});_0x19ce46['on'](_0x211e('0x5a'),function(_0x1098fd){_0x501e36(_0x1098fd);});_0x5645c2[_0x211e('0x5b')]();});}exports['createPdfFromHTML']=function(_0x1177b1,_0x4087b8){var _0x1ff4b3=getPDFPrinter();var _0x4c7312=getPDFDocDefinitionFromHTML(_0x1177b1,_0x4087b8);var _0x3d23e3=_0x1ff4b3[_0x211e('0x5c')](_0x4c7312);return writePDFDocument(_0x3d23e3,_0x4087b8[_0x211e('0x2')])['catch'](function(_0x5bc6b8){throw _0x5bc6b8;});}; \ No newline at end of file +var _0xb689=['rimraf','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','length','body','push','chunk','keys','forEach','format','name','startDate','endDate','header','pageBreak','before','margin','landscape','footer','Arial','black','right','num','Empty','Setting','split','then','splitSizePdf','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','Interaction\x20Transcript','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','pdfmake/src/printer','zip-dir'];(function(_0x2dbac1,_0x44db3b){var _0x8c4e86=function(_0x1544ef){while(--_0x1544ef){_0x2dbac1['push'](_0x2dbac1['shift']());}};_0x8c4e86(++_0x44db3b);}(_0xb689,0x19e));var _0x9b68=function(_0x402954,_0x18004e){_0x402954=_0x402954-0x0;var _0xf95f1f=_0xb689[_0x402954];return _0xf95f1f;};'use strict';var _=require(_0x9b68('0x0'));var fs=require('fs');var util=require(_0x9b68('0x1'));var path=require(_0x9b68('0x2'));var moment=require(_0x9b68('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x9b68('0x4'));var zipdir=require(_0x9b68('0x5'));var rimraf=require(_0x9b68('0x6'));var JSDOM=require('jsdom')[_0x9b68('0x7')];var window=new JSDOM('')[_0x9b68('0x8')];var BPromise=require('bluebird');var db=require(_0x9b68('0x9'))['db'];var dbH=require(_0x9b68('0x9'))[_0x9b68('0xa')];var logger=require(_0x9b68('0xb'))(_0x9b68('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9b68('0xd')][0x3];var PATH=process[_0x9b68('0xd')][0x4];var NAME=process[_0x9b68('0xd')][0x5];var FORMAT=_0x9b68('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xbf2452,_0x5b968b){var _0x313f70={'status':_0xbf2452};var _0x497608={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5b968b){_0x313f70[_0x9b68('0xf')]=_0x5b968b;}return db[_0x9b68('0x10')][_0x9b68('0x11')](_0x313f70,_0x497608);}function getHeaders(_0x5db77a){return _['map'](_0x5db77a,function(_0x2cfd23){return{'text':_0x2cfd23,'style':'tableHeader'};});}function getRows(_0x104e74,_0x250d59){return _[_0x9b68('0x12')](_0x250d59,function(_0x4ee629){return _(_0x4ee629)[_0x9b68('0x13')](_0x104e74)[_0x9b68('0x12')](function(_0x239102){return _0x239102?_[_0x9b68('0x14')](_0x239102):'';})[_0x9b68('0x15')]();});}function createTable(_0x1d24b2,_0x13fb68){var _0x2db4f9={'widths':_['fill'](Array(_0x1d24b2[_0x9b68('0x16')]),0x91),'heights':function(_0x5a5930){return _0x5a5930===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x19ca00=getHeaders(_0x1d24b2);_0x2db4f9[_0x9b68('0x17')][_0x9b68('0x18')](_0x19ca00);var _0x4d995b=getRows(_0x1d24b2,_0x13fb68);_0x2db4f9[_0x9b68('0x17')]=_0x2db4f9['body']['concat'](_0x4d995b);return _0x2db4f9;}function createTables(_0x1923c4){var _0x1007ed=[];var _0x1d6679=_[_0x9b68('0x19')](Object[_0x9b68('0x1a')](_0x1923c4[0x0]),0x5);_0x1d6679[_0x9b68('0x1b')](function(_0x1e4087){_0x1007ed['push'](createTable(_0x1e4087,_0x1923c4));});return _0x1007ed;}function getPDFDocDefinition(_0x188196){var _0x107533=util[_0x9b68('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x9b68('0x1d')],moment(EXTRACTED_REPORT[_0x9b68('0x1e')])[_0x9b68('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x9b68('0x1f')])[_0x9b68('0x1c')](FORMAT));var _0x369518=[];for(var _0x2c1143=0x0;_0x2c1143<_0x188196[_0x9b68('0x16')];_0x2c1143++){var _0x4efc2e=[];if(_0x2c1143===0x0){_0x4efc2e[_0x9b68('0x18')]({'text':_0x107533,'style':_0x9b68('0x20')});}var _0x133f4b={'table':_0x188196[_0x2c1143]};if(_0x2c1143>0x0){_0x133f4b[_0x9b68('0x21')]=_0x9b68('0x22');_0x133f4b[_0x9b68('0x23')]=[0x0,0x46,0x0,0x0];}_0x4efc2e[_0x9b68('0x18')](_0x133f4b);_0x369518[_0x9b68('0x18')](_0x4efc2e);}return{'pageSize':'A4','pageOrientation':_0x9b68('0x24'),'content':_0x369518,'footer':function(_0x3863d0,_0x2eb975){return{'text':_0x3863d0[_0x9b68('0x14')]()+'\x20/\x20'+_0x2eb975,'style':_0x9b68('0x25')};},'defaultStyle':{'font':_0x9b68('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9b68('0x27')},'footer':{'alignment':_0x9b68('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1ff69f){var _0x352de0=0x1388;var _0x1955c8;if(!_0x1ff69f[0x0][_0x9b68('0x29')]){return analyticExtractedReport(_0x9b68('0x2a'));}return db[_0x9b68('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9b68('0x2c'),'splitSizePdf']})[_0x9b68('0x2d')](function(_0x24ec20){if(_0x24ec20){_0x1955c8=_0x24ec20;_0x352de0=_0x1955c8[_0x9b68('0x2e')]||0x3e8;}})['then'](function(){var _0x45f89d=[];var _0x64ba1d=0x0;if(_0x1955c8[_0x9b68('0x2c')]){if(_0x1ff69f&&_0x1ff69f['length']){var _0x58bf2d=_[_0x9b68('0x2f')](_0x1ff69f[0x0][_0x9b68('0x29')]/_0x352de0);var _0x33d355=Number[_0x9b68('0x30')](_0x1ff69f[0x0]['num']/_0x352de0)?_0x1ff69f[0x0][_0x9b68('0x29')]%_0x352de0:0x0;_0x58bf2d[_0x9b68('0x1b')](function(_0x5c82e6){if(_0x5c82e6>0x0){_0x64ba1d+=_0x352de0;}_0x45f89d[_0x9b68('0x18')](dbH[_0x9b68('0x31')][_0x9b68('0x32')](util[_0x9b68('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x352de0,_0x64ba1d),{'type':dbH[_0x9b68('0x31')][_0x9b68('0x33')][_0x9b68('0x34')]}));});if(_0x33d355>0x0){_0x64ba1d+=_0x352de0;_0x45f89d[_0x9b68('0x18')](dbH[_0x9b68('0x31')][_0x9b68('0x32')](util[_0x9b68('0x1c')](_0x9b68('0x35'),QUERY,_0x33d355,_0x64ba1d),{'type':dbH[_0x9b68('0x31')][_0x9b68('0x33')]['SELECT']}));}}}else{_0x45f89d[_0x9b68('0x18')](dbH[_0x9b68('0x31')]['query'](QUERY,{'type':dbH[_0x9b68('0x31')][_0x9b68('0x33')]['SELECT']}));}var _0x1c375a=path[_0x9b68('0x36')](PATH);var _0x549f69=path[_0x9b68('0x37')](PATH,'.pdf');var _0x22f048=_0x1955c8[_0x9b68('0x2c')]&&_0x45f89d[_0x9b68('0x16')]>0x1;var _0x10038d=[];if(!fs['existsSync'](path[_0x9b68('0x38')](_0x1c375a,_0x549f69))&&_0x22f048){fs[_0x9b68('0x39')](path[_0x9b68('0x38')](_0x1c375a,_0x549f69));}return BPromise[_0x9b68('0x3a')](_0x45f89d,function(_0x4dae51){_0x10038d[_0x9b68('0x18')](_0x4dae51);})['then'](function(){var _0x44645c=[];for(var _0x35d136=0x0;_0x35d136<_0x10038d[_0x9b68('0x16')];_0x35d136+=0x1){var _0x9922d1=_0x10038d[_0x35d136];var _0x5bf282=createTables(_['flatten'](_0x9922d1));var _0xcd3d75;var _0x4fc38e=getPDFDocDefinition(_0x5bf282);var _0x242fd4=getPDFPrinter();var _0x34f617=_0x242fd4['createPdfKitDocument'](_0x4fc38e);if(_0x22f048){_0xcd3d75=path[_0x9b68('0x38')](_0x1c375a,_0x549f69,util[_0x9b68('0x1c')](_0x9b68('0x3b'),_0x549f69,_0x35d136,_0x9b68('0x3c')));}else{_0xcd3d75=path[_0x9b68('0x38')](_0x1c375a,util['format'](_0x9b68('0x3d'),_0x549f69,'pdf'));}_0x44645c['push'](writePDFDocument(_0x34f617,_0xcd3d75));}return Promise['all'](_0x44645c);})[_0x9b68('0x2d')](function(){if(_0x22f048){return new Promise(function(_0x588133){zipdir(path[_0x9b68('0x38')](_0x1c375a,_0x549f69),{'saveTo':path[_0x9b68('0x38')](_0x1c375a,util[_0x9b68('0x1c')](_0x9b68('0x3d'),_0x549f69,'zip'))},function(){rimraf(path[_0x9b68('0x38')](_0x1c375a,_0x549f69),function(){});_0x588133('zip\x20finished');});});}})[_0x9b68('0x2d')](function(){if(!_0x22f048)return;rimraf(path[_0x9b68('0x38')](_0x1c375a,_0x549f69),function(){});})[_0x9b68('0x2d')](function(){logger['info'](util['format'](_0x9b68('0x3e'),EXTRACTED_REPORT_ID,_0x9b68('0x3f')));return analyticExtractedReport('Completed',_0x22f048?util[_0x9b68('0x1c')]('%s.%s',_0x549f69,_0x22f048?_0x9b68('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9b68('0x41')](util[_0x9b68('0x1c')](_0x9b68('0x42'),EXTRACTED_REPORT_ID,_0x9b68('0x3f')));return db['AnalyticExtractedReport'][_0x9b68('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2a95c8){EXTRACTED_REPORT=_0x2a95c8;return dbH['sequelize'][_0x9b68('0x32')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9b68('0x31')][_0x9b68('0x33')][_0x9b68('0x34')]});})['then'](extractReport)[_0x9b68('0x44')](function(_0xd34878){logger['info'](util[_0x9b68('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9b68('0x3f')),util[_0x9b68('0x45')](_0xd34878,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9b68('0x46')](function(){process[_0x9b68('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xffb97=new PdfPrinter({'Arial':{'normal':__dirname+_0x9b68('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x9b68('0x49'),'bolditalics':__dirname+_0x9b68('0x4a')}});return _0xffb97;}function getPDFDocDefinitionFromHTML(_0xd5c892,_0x372a23){var _0xf0a572=util[_0x9b68('0x1c')](_0x9b68('0x4b'),_0x372a23['channel'],_0x372a23['interactionId']);var _0x42182b=moment()[_0x9b68('0x1c')](_0x9b68('0x4c'))['toString']();var _0x4bb853=htmlToPdfmake(_0xd5c892,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4bb853],'defaultStyle':{'font':_0x9b68('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9b68('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9b68('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9b68('0x4d')}},'header':function(){return[{'text':_0x9b68('0x4e'),'style':'header'}];},'footer':function(_0x44f775,_0x114096){return[{'text':util[_0x9b68('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xf0a572,_0x44f775,_0x114096,_0x42182b),'style':'footer'}];}};}function writePDFDocument(_0x17fc0f,_0x1c757d){return new Promise(function(_0x4f6e24,_0x5143db){var _0xf3c32b=_0x17fc0f['pipe'](fs['createWriteStream'](_0x1c757d));_0xf3c32b['on'](_0x9b68('0x4f'),function(){_0x4f6e24(_0x9b68('0x4f'));});_0xf3c32b['on'](_0x9b68('0x50'),function(_0xc05747){_0x5143db(_0xc05747);});_0x17fc0f[_0x9b68('0x51')]();});}exports[_0x9b68('0x52')]=function(_0x2a386a,_0x5c66a5){var _0x13b7d5=getPDFPrinter();var _0x5c1890=getPDFDocDefinitionFromHTML(_0x2a386a,_0x5c66a5);var _0x582275=_0x13b7d5[_0x9b68('0x53')](_0x5c1890);return writePDFDocument(_0x582275,_0x5c66a5[_0x9b68('0x2')])[_0x9b68('0x44')](function(_0x18b2ab){throw _0x18b2ab;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index bcee245..71fe944 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 _0xa96d=['finally','exit','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','push','dirname','.xlsx','existsSync','join','mkdirSync','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x591014,_0x1a5ee0){var _0x45bc59=function(_0x220f1a){while(--_0x220f1a){_0x591014['push'](_0x591014['shift']());}};_0x45bc59(++_0x1a5ee0);}(_0xa96d,0x116));var _0xda96=function(_0x4eab4d,_0x1fbd49){_0x4eab4d=_0x4eab4d-0x0;var _0x3bffce=_0xa96d[_0x4eab4d];return _0x3bffce;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xda96('0x0'));var zipdir=require(_0xda96('0x1'));var rimraf=require(_0xda96('0x2'));var db=require(_0xda96('0x3'))['db'];var dbH=require(_0xda96('0x3'))[_0xda96('0x4')];var logger=require(_0xda96('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xda96('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3199d0,_0x2ff9dd){var _0x3673b8={'status':_0x3199d0};var _0x3e0c6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ff9dd){_0x3673b8['savename']=_0x2ff9dd;}return db[_0xda96('0x7')][_0xda96('0x8')](_0x3673b8,_0x3e0c6f);}function main(){var _0x58ac5f=0x1388;var _0x309f51;logger[_0xda96('0x9')](util['format'](_0xda96('0xa'),EXTRACTED_REPORT_ID,_0xda96('0xb')));return db[_0xda96('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xda96('0xd'),'splitSizeXlsx']})[_0xda96('0xe')](function(_0x2d9057){if(_0x2d9057){_0x309f51=_0x2d9057;_0x58ac5f=_0x309f51[_0xda96('0xf')]||0x1388;}})[_0xda96('0xe')](function(){return dbH[_0xda96('0x10')][_0xda96('0x11')](util[_0xda96('0x12')](_0xda96('0x13'),QUERY),{'type':dbH[_0xda96('0x10')]['QueryTypes']['SELECT']});})['then'](function(_0x47ff42){if(!_0x47ff42[0x0][_0xda96('0x14')]){return analyticExtractedReport(_0xda96('0x15'));}var _0x71df4d=[];var _0x28f85f=0x0;if(_0x309f51[_0xda96('0xd')]){if(_0x47ff42&&_0x47ff42[_0xda96('0x16')]){var _0x346a18=_[_0xda96('0x17')](_0x47ff42[0x0]['num']/_0x58ac5f);var _0x49b3db=Number[_0xda96('0x18')](_0x47ff42[0x0][_0xda96('0x14')]/_0x58ac5f)?_0x47ff42[0x0][_0xda96('0x14')]%_0x58ac5f:0x0;_0x346a18[_0xda96('0x19')](function(_0x29b123){if(_0x29b123>0x0){_0x28f85f+=_0x58ac5f;}_0x71df4d['push'](dbH[_0xda96('0x10')]['query'](util['format'](_0xda96('0x1a'),QUERY,_0x58ac5f,_0x28f85f),{'type':dbH['sequelize'][_0xda96('0x1b')][_0xda96('0x1c')]}));});if(_0x49b3db>0x0){_0x28f85f+=_0x58ac5f;_0x71df4d[_0xda96('0x1d')](dbH['sequelize'][_0xda96('0x11')](util[_0xda96('0x12')](_0xda96('0x1a'),QUERY,_0x49b3db,_0x28f85f),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x71df4d[_0xda96('0x1d')](dbH[_0xda96('0x10')][_0xda96('0x11')](QUERY,{'type':dbH[_0xda96('0x10')][_0xda96('0x1b')][_0xda96('0x1c')]}));}var _0x41b516=path[_0xda96('0x1e')](PATH);var _0x52a57b=path['basename'](PATH,_0xda96('0x1f'));var _0x4107f0=_0x309f51[_0xda96('0xd')]&&_0x71df4d[_0xda96('0x16')]>0x1;var _0xfe6eda=[];if(!fs[_0xda96('0x20')](path[_0xda96('0x21')](_0x41b516,_0x52a57b))&&_0x4107f0){fs[_0xda96('0x22')](path['join'](_0x41b516,_0x52a57b));}return BPromise['each'](_0x71df4d,function(_0x2fb635){_0xfe6eda[_0xda96('0x1d')](_0x2fb635);})['then'](function(){for(var _0x42ac17=0x0;_0x42ac17<_0xfe6eda[_0xda96('0x16')];_0x42ac17+=0x1){var _0x175fb5;var _0x371fa1=_0xfe6eda[_0x42ac17];if(_0x4107f0){_0x175fb5=path[_0xda96('0x21')](_0x41b516,_0x52a57b,util[_0xda96('0x12')]('%s%d.%s',_0x52a57b,_0x42ac17,_0xda96('0x23')));}else{_0x175fb5=path[_0xda96('0x21')](_0x41b516,util[_0xda96('0x12')](_0xda96('0x24'),_0x52a57b,_0xda96('0x23')));}fs['writeFileSync'](_0x175fb5,json2xls(_0x371fa1),_0xda96('0x25'));}})['then'](function(){if(_0x4107f0){return new Promise(function(_0x6411bd){zipdir(path[_0xda96('0x21')](_0x41b516,_0x52a57b),{'saveTo':path[_0xda96('0x21')](_0x41b516,util[_0xda96('0x12')](_0xda96('0x24'),_0x52a57b,_0xda96('0x26')))},function(_0x340af2,_0x198298){rimraf(path['join'](_0x41b516,_0x52a57b),function(){});_0x6411bd(_0xda96('0x27'));});});}})[_0xda96('0xe')](function(){logger['info'](util['format'](_0xda96('0x28'),EXTRACTED_REPORT_ID,_0xda96('0xb')));return analyticExtractedReport('Completed',_0x4107f0?util[_0xda96('0x12')](_0xda96('0x24'),_0x52a57b,_0x4107f0?_0xda96('0x26'):_0xda96('0x23')):null);});})['catch'](function(_0x2b241d){logger[_0xda96('0x9')](util[_0xda96('0x12')](_0xda96('0x29'),EXTRACTED_REPORT_ID,_0xda96('0xb')),util[_0xda96('0x2a')](_0x2b241d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xda96('0x2b'));})[_0xda96('0x2c')](function(){process[_0xda96('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x467e=['zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','split','length','range','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x524451,_0x3f6a5d){var _0xb369b6=function(_0x5283b9){while(--_0x5283b9){_0x524451['push'](_0x524451['shift']());}};_0xb369b6(++_0x3f6a5d);}(_0x467e,0x121));var _0xe467=function(_0x16c1d9,_0x2a1270){_0x16c1d9=_0x16c1d9-0x0;var _0x85293b=_0x467e[_0x16c1d9];return _0x85293b;};'use strict';var util=require(_0xe467('0x0'));var path=require(_0xe467('0x1'));var _=require(_0xe467('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xe467('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xe467('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe467('0x5'))[_0xe467('0x6')];var logger=require(_0xe467('0x7'))(_0xe467('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe467('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf7775d,_0x2b1a3d){var _0x5d2a11={'status':_0xf7775d};var _0x3d7461={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b1a3d){_0x5d2a11[_0xe467('0xa')]=_0x2b1a3d;}return db['AnalyticExtractedReport'][_0xe467('0xb')](_0x5d2a11,_0x3d7461);}function main(){var _0x3fb58d=0x1388;var _0xa3b91a;logger[_0xe467('0xc')](util[_0xe467('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe467('0xe')));return db[_0xe467('0xf')][_0xe467('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe467('0x11')]})[_0xe467('0x12')](function(_0x42bb81){if(_0x42bb81){_0xa3b91a=_0x42bb81;_0x3fb58d=_0xa3b91a['splitSizeXlsx']||0x1388;}})[_0xe467('0x12')](function(){return dbH[_0xe467('0x13')][_0xe467('0x14')](util[_0xe467('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe467('0x13')][_0xe467('0x15')][_0xe467('0x16')]});})[_0xe467('0x12')](function(_0x573fa3){if(!_0x573fa3[0x0][_0xe467('0x17')]){return analyticExtractedReport('Empty');}var _0x1eaa43=[];var _0x3324aa=0x0;if(_0xa3b91a[_0xe467('0x18')]){if(_0x573fa3&&_0x573fa3[_0xe467('0x19')]){var _0x153d87=_[_0xe467('0x1a')](_0x573fa3[0x0][_0xe467('0x17')]/_0x3fb58d);var _0x47a3b7=Number['isInteger'](_0x573fa3[0x0][_0xe467('0x17')]/_0x3fb58d)?_0x573fa3[0x0][_0xe467('0x17')]%_0x3fb58d:0x0;_0x153d87['forEach'](function(_0x38a07a){if(_0x38a07a>0x0){_0x3324aa+=_0x3fb58d;}_0x1eaa43['push'](dbH[_0xe467('0x13')][_0xe467('0x14')](util[_0xe467('0xd')](_0xe467('0x1b'),QUERY,_0x3fb58d,_0x3324aa),{'type':dbH[_0xe467('0x13')][_0xe467('0x15')][_0xe467('0x16')]}));});if(_0x47a3b7>0x0){_0x3324aa+=_0x3fb58d;_0x1eaa43['push'](dbH[_0xe467('0x13')][_0xe467('0x14')](util[_0xe467('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x47a3b7,_0x3324aa),{'type':dbH[_0xe467('0x13')]['QueryTypes'][_0xe467('0x16')]}));}}}else{_0x1eaa43[_0xe467('0x1c')](dbH[_0xe467('0x13')][_0xe467('0x14')](QUERY,{'type':dbH[_0xe467('0x13')][_0xe467('0x15')][_0xe467('0x16')]}));}var _0x12c698=path['dirname'](PATH);var _0x445393=path[_0xe467('0x1d')](PATH,_0xe467('0x1e'));var _0x10e7c0=_0xa3b91a['split']&&_0x1eaa43[_0xe467('0x19')]>0x1;var _0x77345b=[];if(!fs[_0xe467('0x1f')](path[_0xe467('0x20')](_0x12c698,_0x445393))&&_0x10e7c0){fs[_0xe467('0x21')](path[_0xe467('0x20')](_0x12c698,_0x445393));}return BPromise[_0xe467('0x22')](_0x1eaa43,function(_0x1873ed){_0x77345b['push'](_0x1873ed);})[_0xe467('0x12')](function(){for(var _0x61b1e0=0x0;_0x61b1e0<_0x77345b['length'];_0x61b1e0+=0x1){var _0x1ddfc1;var _0x42e51d=_0x77345b[_0x61b1e0];if(_0x10e7c0){_0x1ddfc1=path[_0xe467('0x20')](_0x12c698,_0x445393,util[_0xe467('0xd')]('%s%d.%s',_0x445393,_0x61b1e0,_0xe467('0x23')));}else{_0x1ddfc1=path[_0xe467('0x20')](_0x12c698,util[_0xe467('0xd')](_0xe467('0x24'),_0x445393,_0xe467('0x23')));}fs[_0xe467('0x25')](_0x1ddfc1,json2xls(_0x42e51d),'binary');}})[_0xe467('0x12')](function(){if(_0x10e7c0){return new Promise(function(_0x3bdc00){zipdir(path[_0xe467('0x20')](_0x12c698,_0x445393),{'saveTo':path[_0xe467('0x20')](_0x12c698,util[_0xe467('0xd')](_0xe467('0x24'),_0x445393,'zip'))},function(_0xb9ed65,_0x5342b4){rimraf(path[_0xe467('0x20')](_0x12c698,_0x445393),function(){});_0x3bdc00('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0xe467('0xd')](_0xe467('0x26'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xe467('0x27'),_0x10e7c0?util[_0xe467('0xd')](_0xe467('0x24'),_0x445393,_0x10e7c0?_0xe467('0x28'):_0xe467('0x23')):null);});})[_0xe467('0x29')](function(_0x16a0b5){logger[_0xe467('0xc')](util[_0xe467('0xd')](_0xe467('0x2a'),EXTRACTED_REPORT_ID,_0xe467('0xe')),util[_0xe467('0x2b')](_0x16a0b5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe467('0x2c'));})[_0xe467('0x2d')](function(){process[_0xe467('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 35d1462..1316435 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 _0xe091=['findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','extension','find','extensions','push','type','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','priority','outbound','Set','cutdigits','${EXTEN:','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','then','intervals','models','VoiceExtension'];(function(_0x276fae,_0x1424c1){var _0x132c7e=function(_0x4bf08a){while(--_0x4bf08a){_0x276fae['push'](_0x276fae['shift']());}};_0x132c7e(++_0x1424c1);}(_0xe091,0x18c));var _0x1e09=function(_0x2d56ed,_0x5103ee){_0x2d56ed=_0x2d56ed-0x0;var _0x5eaffb=_0xe091[_0x2d56ed];return _0x5eaffb;};'use strict';var _=require(_0x1e09('0x0'));var util=require(_0x1e09('0x1'));function rewrite(_0x580c00,_0xfa2b29){var _0x47ed4c=this;return _0x580c00['models']['Interval']['findAll']({'raw':!![]})[_0x1e09('0x2')](function(_0x4e3337){_0x47ed4c[_0x1e09('0x3')]=_0x4e3337;return _0x580c00[_0x1e09('0x4')][_0x1e09('0x5')][_0x1e09('0x6')]({'where':{'IntervalId':_0xfa2b29['IntervalId']},'raw':!![]});})[_0x1e09('0x2')](function(_0x561c6b){return _0x580c00['models'][_0x1e09('0x5')][_0x1e09('0x6')]({'where':{'exten':{'$in':_[_0x1e09('0x7')](_[_0x1e09('0x8')](_0x561c6b,_0x1e09('0x9')))}},'order':[{'raw':_0x1e09('0xa')}],'raw':!![]});})['then'](function(_0x346422){var _0x58561d=_['filter'](_0x346422,{'priority':'1'});var _0x590b4f=_[_0x1e09('0xb')](_0x346422,{'isApp':0x1});var _0x1288f4=_[_0x1e09('0xc')](_0x590b4f,'exten');var _0x4193e0=[_0x1e09('0xd'),'playback'];var _0x33720b=[];var _0x3e2d3c=[];for(var _0x163dac in _0x1288f4){if(_0x1288f4[_0x1e09('0xe')](_0x163dac)){_0x47ed4c['priority']=0x2;_0x47ed4c['extensions']=[];_0x47ed4c[_0x1e09('0xf')]=_[_0x1e09('0x10')](_0x58561d,{'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')]});_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':'Set','appdata':util['format'](_0x1e09('0x14'),_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')]),'context':_0x1288f4[_0x163dac][0x0]['context'],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c['priority']++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});if(_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')]===_0x1e09('0x16')){_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0]['type'],'app':'Set','appdata':_0x1e09('0x17')+_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')],'context':_0x1288f4[_0x163dac][0x0]['context'],'exten':_0x1288f4[_0x163dac][0x0]['exten'],'priority':_0x47ed4c[_0x1e09('0x18')]++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0]['VoiceExtensionId']});}else if(_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')]===_0x1e09('0x19')){if(_0x47ed4c[_0x1e09('0xf')]){_0x47ed4c[_0x1e09('0x11')]['push']({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1a'),'appdata':'CDR(destination)='+(_0x47ed4c[_0x1e09('0xf')][_0x1e09('0x1b')]?_0x1e09('0x1c')+_0x47ed4c['extension'][_0x1e09('0x1b')]+'}':_0x1e09('0x1d')),'context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c[_0x1e09('0x18')]++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});}_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1a'),'appdata':_0x1e09('0x17')+_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')],'context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0]['exten'],'priority':_0x47ed4c['priority']++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});var _0x1b1cca=_0x47ed4c[_0x1e09('0x18')]++;_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1f'),'appdata':_0x1e09('0x20')+(_0x1b1cca+0x2)+_0x1e09('0x21')+(_0x1b1cca+0x1)+')','context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x1b1cca,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0]['VoiceExtensionId']});if(_0x47ed4c[_0x1e09('0xf')]){_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':'Set','appdata':_0x47ed4c[_0x1e09('0xf')][_0x1e09('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x47ed4c[_0x1e09('0xf')][_0x1e09('0x1b')]+'}':_0x1e09('0x22'),'context':_0x1288f4[_0x163dac][0x0]['context'],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c[_0x1e09('0x18')]++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});}_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1a'),'appdata':_0x1e09('0x23')+_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')],'context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c[_0x1e09('0x18')]++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});if(_0x47ed4c[_0x1e09('0xf')]&&_0x47ed4c[_0x1e09('0xf')][_0x1e09('0xe')](_0x1e09('0x24'))&&_0x47ed4c[_0x1e09('0xf')][_0x1e09('0x24')]!==_0x1e09('0x25')){_0x47ed4c['extensions'][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1a'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c['priority']++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1a'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x47ed4c[_0x1e09('0xf')][_0x1e09('0x24')]||_0x1e09('0x26'),'context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c[_0x1e09('0x18')]++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});}}_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1a'),'appdata':_0x1e09('0x27'),'context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c[_0x1e09('0x18')]++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});_0x47ed4c['extensions'][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x1a'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c[_0x1e09('0x18')]++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0]['VoiceExtensionId']});_0x47ed4c['extensions'][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1288f4[_0x163dac][0x0][_0x1e09('0x1e')],'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'priority':_0x47ed4c['priority']++,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0]['VoiceExtensionId']});for(var _0x4ed7bb=0x0,_0x2c310f=0x0;_0x4ed7bb<_0x1288f4[_0x163dac]['length'];_0x4ed7bb+=0x1,_0x2c310f=0x0){var _0xb05c0f=_0x1288f4[_0x163dac][_0x4ed7bb];if(_0xb05c0f[_0x1e09('0x13')]){_0xb05c0f[_0x1e09('0x13')]=_0xb05c0f[_0x1e09('0x13')][_0x1e09('0x28')]();}var _0xe0cc6=[];var _0x159d28=[];delete _0xb05c0f['id'];delete _0xb05c0f[_0x1e09('0x29')];delete _0xb05c0f['updatedAt'];var _0x35907b=_0xb05c0f[_0x1e09('0x2a')]!==_0x1e09('0x2b')?[_0xb05c0f[_0x1e09('0x2a')]]:_0xb05c0f[_0x1e09('0x2c')]?_[_0x1e09('0x8')](_[_0x1e09('0xb')](_0x47ed4c[_0x1e09('0x3')],{'IntervalId':_0xb05c0f['IntervalId']}),_0x1e09('0x2a')):[];if(_0xb05c0f[_0x1e09('0xe')](_0x1e09('0x2d'))){if(_0xb05c0f[_0x1e09('0x2d')]&&_0xb05c0f[_0x1e09('0x2d')]!=='--'){_0xe0cc6['push']({'type':_0xb05c0f['type'],'app':_0x1e09('0x1a'),'appdata':_0x1e09('0x2e')+_0xb05c0f[_0x1e09('0x2d')],'context':_0xb05c0f[_0x1e09('0x1e')],'exten':_0xb05c0f[_0x1e09('0x9')],'priority':_0x35907b[_0x1e09('0x2f')]+_0x47ed4c['priority']+_0x2c310f++,'VoiceExtensionId':_0xb05c0f['VoiceExtensionId']});}}if(_0xb05c0f[_0x1e09('0x13')]===_0x1e09('0x19')&&_0xb05c0f[_0x1e09('0xe')](_0x1e09('0x30'))){if(_0xb05c0f[_0x1e09('0x30')]){_0xe0cc6['push']({'type':_0xb05c0f[_0x1e09('0x13')],'app':_0x1e09('0x1f'),'appdata':_0x1e09('0x31')+_0xb05c0f[_0x1e09('0x30')]+')','context':_0xb05c0f[_0x1e09('0x1e')],'exten':_0xb05c0f[_0x1e09('0x9')],'priority':_0x35907b[_0x1e09('0x2f')]+_0x47ed4c[_0x1e09('0x18')]+_0x2c310f++,'VoiceExtensionId':_0xb05c0f['VoiceExtensionId']});}else{_0xe0cc6['push']({'type':_0xb05c0f[_0x1e09('0x13')],'app':_0x1e09('0x1f'),'appdata':_0x1e09('0x32'),'context':_0xb05c0f[_0x1e09('0x1e')],'exten':_0xb05c0f[_0x1e09('0x9')],'priority':_0x35907b[_0x1e09('0x2f')]+_0x47ed4c[_0x1e09('0x18')]+_0x2c310f++,'VoiceExtensionId':_0xb05c0f[_0x1e09('0x15')]});}}if(_0xb05c0f[_0x1e09('0xe')](_0x1e09('0x33'))){if(_0x4193e0['indexOf'](_0xb05c0f[_0x1e09('0x34')][_0x1e09('0x28')]())>=0x0&&_0xb05c0f['appType']!==_0x1e09('0x35')){if(_0xb05c0f[_0x1e09('0x33')]){_0xe0cc6['push']({'type':_0xb05c0f[_0x1e09('0x13')],'app':_0x1e09('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xb05c0f[_0x1e09('0x1e')],'exten':_0xb05c0f['exten'],'priority':_0x35907b[_0x1e09('0x2f')]+_0x47ed4c[_0x1e09('0x18')]+_0x2c310f++,'VoiceExtensionId':_0xb05c0f[_0x1e09('0x15')]});_0xe0cc6[_0x1e09('0x12')]({'type':_0xb05c0f['type'],'app':_0x1e09('0x1a'),'appdata':_0x1e09('0x36'),'context':_0xb05c0f[_0x1e09('0x1e')],'exten':_0xb05c0f[_0x1e09('0x9')],'priority':_0x35907b[_0x1e09('0x2f')]+_0x47ed4c[_0x1e09('0x18')]+_0x2c310f++,'VoiceExtensionId':_0xb05c0f['VoiceExtensionId']});}else{_0xe0cc6[_0x1e09('0x12')]({'type':_0xb05c0f[_0x1e09('0x13')],'app':'ExecIf','appdata':_0x1e09('0x37'),'context':_0xb05c0f['context'],'exten':_0xb05c0f[_0x1e09('0x9')],'priority':_0x35907b[_0x1e09('0x2f')]+_0x47ed4c['priority']+_0x2c310f++,'VoiceExtensionId':_0xb05c0f['VoiceExtensionId']});_0xe0cc6[_0x1e09('0x12')]({'type':_0xb05c0f['type'],'app':_0x1e09('0x1a'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xb05c0f['context'],'exten':_0xb05c0f[_0x1e09('0x9')],'priority':_0x35907b[_0x1e09('0x2f')]+_0x47ed4c['priority']+_0x2c310f++,'VoiceExtensionId':_0xb05c0f['VoiceExtensionId']});}}}for(var _0x7e7e9=0x0;_0x7e7e9<_0x35907b['length'];_0x7e7e9+=0x1){var _0x6ae008=_0x47ed4c['priority']+_0x35907b[_0x1e09('0x2f')];var _0x27d085=_0x7e7e9===_0x35907b[_0x1e09('0x2f')]-0x1?_0x47ed4c[_0x1e09('0x18')]+_0xe0cc6['length']+_0x159d28[_0x1e09('0x2f')]+0x2:_0x47ed4c[_0x1e09('0x18')]+_0x7e7e9+0x1;_0xe0cc6[_0x1e09('0x38')](_0x7e7e9,0x0,{'type':_0xb05c0f[_0x1e09('0x13')],'app':'GotoIfTime','appdata':_0x35907b[_0x7e7e9]+'?'+_0xb05c0f[_0x1e09('0x1e')]+_0x1e09('0x39')+_0x6ae008+':'+_0xb05c0f['context']+_0x1e09('0x39')+_0x27d085,'exten':_0xb05c0f[_0x1e09('0x9')],'context':_0xb05c0f[_0x1e09('0x1e')],'priority':_0x47ed4c[_0x1e09('0x18')]+_0x7e7e9,'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});}_0xb05c0f[_0x1e09('0x18')]=_0xe0cc6[_0x1e09('0x2f')]?_[_0x1e09('0x3a')](_0xe0cc6)[_0x1e09('0x18')]+0x1:_0x47ed4c[_0x1e09('0x18')];_0x47ed4c[_0x1e09('0x18')]=(_0x159d28[_0x1e09('0x2f')]?_[_0x1e09('0x3a')](_0x159d28)[_0x1e09('0x18')]:_0xb05c0f['priority'])+0x1;_0x47ed4c['extensions']=_[_0x1e09('0x3b')](_0x47ed4c[_0x1e09('0x11')],_0xe0cc6,[_0xb05c0f],_0x159d28);}_0x47ed4c[_0x1e09('0x11')][_0x1e09('0x12')]({'type':_0x1288f4[_0x163dac][0x0][_0x1e09('0x13')],'app':_0x1e09('0x3c'),'exten':_0x1288f4[_0x163dac][0x0][_0x1e09('0x9')],'context':_0x1288f4[_0x163dac][0x0]['context'],'priority':_0x47ed4c['priority'],'VoiceExtensionId':_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]});_0x33720b[_0x1e09('0x12')](_0x1288f4[_0x163dac][0x0][_0x1e09('0x15')]);_0x3e2d3c=_[_0x1e09('0x3b')](_0x3e2d3c,_0x47ed4c[_0x1e09('0x11')]);}}return _0x580c00[_0x1e09('0x3d')](function(_0x1f0fcc){return _0x580c00[_0x1e09('0x4')][_0x1e09('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x33720b}},'transaction':_0x1f0fcc})[_0x1e09('0x2')](function(_0x140b05){return _0x580c00[_0x1e09('0x4')][_0x1e09('0x5')][_0x1e09('0x3e')](_[_0x1e09('0x3f')](_0x3e2d3c,'priority'),{'transaction':_0x1f0fcc});});});})[_0x1e09('0x40')](function(_0x5a2186){console[_0x1e09('0x41')](_0x5a2186);});}exports[_0x1e09('0x42')]=rewrite; \ No newline at end of file +var _0xd8f9=['IntervalId','uniq','map','groupBy','queue','priority','extensions','extension','exten','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','push','CDR(destination)=','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','filter','tag','CDR(tag)=','callerID','ExecIf','$[${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-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension'];(function(_0x3e385c,_0x24e848){var _0x4c6171=function(_0x1825c7){while(--_0x1825c7){_0x3e385c['push'](_0x3e385c['shift']());}};_0x4c6171(++_0x24e848);}(_0xd8f9,0xcd));var _0x9d8f=function(_0xbf3e92,_0x3523a3){_0xbf3e92=_0xbf3e92-0x0;var _0x274a64=_0xd8f9[_0xbf3e92];return _0x274a64;};'use strict';var _=require(_0x9d8f('0x0'));var util=require(_0x9d8f('0x1'));function rewrite(_0x2d6b9e,_0x3c1677){var _0x46acdb=this;return _0x2d6b9e[_0x9d8f('0x2')][_0x9d8f('0x3')][_0x9d8f('0x4')]({'raw':!![]})[_0x9d8f('0x5')](function(_0x236a05){_0x46acdb[_0x9d8f('0x6')]=_0x236a05;return _0x2d6b9e[_0x9d8f('0x2')][_0x9d8f('0x7')][_0x9d8f('0x4')]({'where':{'IntervalId':_0x3c1677[_0x9d8f('0x8')]},'raw':!![]});})[_0x9d8f('0x5')](function(_0x43108e){return _0x2d6b9e[_0x9d8f('0x2')][_0x9d8f('0x7')][_0x9d8f('0x4')]({'where':{'exten':{'$in':_[_0x9d8f('0x9')](_[_0x9d8f('0xa')](_0x43108e,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x9d8f('0x5')](function(_0x40e154){var _0x2e168c=_['filter'](_0x40e154,{'priority':'1'});var _0x41598d=_['filter'](_0x40e154,{'isApp':0x1});var _0x563bef=_[_0x9d8f('0xb')](_0x41598d,'exten');var _0x262afe=[_0x9d8f('0xc'),'playback'];var _0x2c2475=[];var _0x39275a=[];for(var _0x4ae279 in _0x563bef){if(_0x563bef['hasOwnProperty'](_0x4ae279)){_0x46acdb[_0x9d8f('0xd')]=0x2;_0x46acdb[_0x9d8f('0xe')]=[];_0x46acdb[_0x9d8f('0xf')]=_['find'](_0x2e168c,{'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')]});_0x46acdb[_0x9d8f('0xe')]['push']({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':util[_0x9d8f('0x13')]('CDR(type)=%s',_0x563bef[_0x4ae279][0x0]['type']),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0]['exten'],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});if(_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')]===_0x9d8f('0x16')){_0x46acdb['extensions']['push']({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':_0x9d8f('0x17')+_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')],'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});}else if(_0x563bef[_0x4ae279][0x0]['type']===_0x9d8f('0x18')){if(_0x46acdb[_0x9d8f('0xf')]){_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':'Set','appdata':_0x9d8f('0x1a')+(_0x46acdb['extension']['cutdigits']?_0x9d8f('0x1b')+_0x46acdb['extension'][_0x9d8f('0x1c')]+'}':'${EXTEN}'),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});}_0x46acdb[_0x9d8f('0xe')]['push']({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':'Set','appdata':'CDR(routeid)='+_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')],'context':_0x563bef[_0x4ae279][0x0]['context'],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});var _0x5bfe7d=_0x46acdb[_0x9d8f('0xd')]++;_0x46acdb['extensions'][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':'ExecIf','appdata':_0x9d8f('0x1d')+(_0x5bfe7d+0x2)+'):Goto('+(_0x5bfe7d+0x1)+')','context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x5bfe7d,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0]['VoiceExtensionId']});if(_0x46acdb['extension']){_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':_0x46acdb['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x46acdb[_0x9d8f('0xf')][_0x9d8f('0x1c')]+'}':_0x9d8f('0x1e'),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0]['exten'],'priority':_0x46acdb['priority']++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});}_0x46acdb[_0x9d8f('0xe')]['push']({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':'Set','appdata':_0x9d8f('0x1f')+_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')],'context':_0x563bef[_0x4ae279][0x0]['context'],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0]['VoiceExtensionId']});if(_0x46acdb['extension']&&_0x46acdb[_0x9d8f('0xf')][_0x9d8f('0x20')](_0x9d8f('0x21'))&&_0x46acdb[_0x9d8f('0xf')][_0x9d8f('0x21')]!==_0x9d8f('0x22')){_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':_0x9d8f('0x23'),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb['priority']++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':_0x9d8f('0x24')+_0x46acdb[_0x9d8f('0xf')][_0x9d8f('0x21')]||_0x9d8f('0x25'),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb['priority']++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});}}_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':'Set','appdata':_0x9d8f('0x26'),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':_0x9d8f('0x27'),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':_0x9d8f('0x28'),'context':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x14')],'exten':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x10')],'priority':_0x46acdb[_0x9d8f('0xd')]++,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});for(var _0x2f7013=0x0,_0x34725e=0x0;_0x2f7013<_0x563bef[_0x4ae279][_0x9d8f('0x29')];_0x2f7013+=0x1,_0x34725e=0x0){var _0x1e3ba7=_0x563bef[_0x4ae279][_0x2f7013];if(_0x1e3ba7['type']){_0x1e3ba7[_0x9d8f('0x11')]=_0x1e3ba7[_0x9d8f('0x11')][_0x9d8f('0x2a')]();}var _0x5ecba7=[];var _0x1bf2bf=[];delete _0x1e3ba7['id'];delete _0x1e3ba7['createdAt'];delete _0x1e3ba7[_0x9d8f('0x2b')];var _0x101cdb=_0x1e3ba7[_0x9d8f('0x2c')]!==_0x9d8f('0x2d')?[_0x1e3ba7['interval']]:_0x1e3ba7[_0x9d8f('0x8')]?_['map'](_[_0x9d8f('0x2e')](_0x46acdb['intervals'],{'IntervalId':_0x1e3ba7['IntervalId']}),'interval'):[];if(_0x1e3ba7[_0x9d8f('0x20')]('tag')){if(_0x1e3ba7[_0x9d8f('0x2f')]&&_0x1e3ba7[_0x9d8f('0x2f')]!=='--'){_0x5ecba7[_0x9d8f('0x19')]({'type':_0x1e3ba7['type'],'app':_0x9d8f('0x12'),'appdata':_0x9d8f('0x30')+_0x1e3ba7['tag'],'context':_0x1e3ba7[_0x9d8f('0x14')],'exten':_0x1e3ba7[_0x9d8f('0x10')],'priority':_0x101cdb[_0x9d8f('0x29')]+_0x46acdb[_0x9d8f('0xd')]+_0x34725e++,'VoiceExtensionId':_0x1e3ba7[_0x9d8f('0x15')]});}}if(_0x1e3ba7[_0x9d8f('0x11')]==='outbound'&&_0x1e3ba7[_0x9d8f('0x20')](_0x9d8f('0x31'))){if(_0x1e3ba7[_0x9d8f('0x31')]){_0x5ecba7[_0x9d8f('0x19')]({'type':_0x1e3ba7[_0x9d8f('0x11')],'app':_0x9d8f('0x32'),'appdata':_0x9d8f('0x33')+_0x1e3ba7[_0x9d8f('0x31')]+')','context':_0x1e3ba7[_0x9d8f('0x14')],'exten':_0x1e3ba7[_0x9d8f('0x10')],'priority':_0x101cdb[_0x9d8f('0x29')]+_0x46acdb['priority']+_0x34725e++,'VoiceExtensionId':_0x1e3ba7[_0x9d8f('0x15')]});}else{_0x5ecba7[_0x9d8f('0x19')]({'type':_0x1e3ba7['type'],'app':_0x9d8f('0x32'),'appdata':_0x9d8f('0x34'),'context':_0x1e3ba7[_0x9d8f('0x14')],'exten':_0x1e3ba7[_0x9d8f('0x10')],'priority':_0x101cdb[_0x9d8f('0x29')]+_0x46acdb[_0x9d8f('0xd')]+_0x34725e++,'VoiceExtensionId':_0x1e3ba7['VoiceExtensionId']});}}if(_0x1e3ba7[_0x9d8f('0x20')]('answer')){if(_0x262afe[_0x9d8f('0x35')](_0x1e3ba7[_0x9d8f('0x36')]['toLowerCase']())>=0x0&&_0x1e3ba7[_0x9d8f('0x37')]!=='custom'){if(_0x1e3ba7[_0x9d8f('0x38')]){_0x5ecba7[_0x9d8f('0x19')]({'type':_0x1e3ba7[_0x9d8f('0x11')],'app':_0x9d8f('0x32'),'appdata':_0x9d8f('0x39'),'context':_0x1e3ba7['context'],'exten':_0x1e3ba7['exten'],'priority':_0x101cdb[_0x9d8f('0x29')]+_0x46acdb['priority']+_0x34725e++,'VoiceExtensionId':_0x1e3ba7[_0x9d8f('0x15')]});_0x5ecba7[_0x9d8f('0x19')]({'type':_0x1e3ba7[_0x9d8f('0x11')],'app':_0x9d8f('0x12'),'appdata':_0x9d8f('0x3a'),'context':_0x1e3ba7[_0x9d8f('0x14')],'exten':_0x1e3ba7['exten'],'priority':_0x101cdb[_0x9d8f('0x29')]+_0x46acdb[_0x9d8f('0xd')]+_0x34725e++,'VoiceExtensionId':_0x1e3ba7[_0x9d8f('0x15')]});}else{_0x5ecba7['push']({'type':_0x1e3ba7[_0x9d8f('0x11')],'app':_0x9d8f('0x32'),'appdata':_0x9d8f('0x3b'),'context':_0x1e3ba7[_0x9d8f('0x14')],'exten':_0x1e3ba7[_0x9d8f('0x10')],'priority':_0x101cdb['length']+_0x46acdb['priority']+_0x34725e++,'VoiceExtensionId':_0x1e3ba7[_0x9d8f('0x15')]});_0x5ecba7[_0x9d8f('0x19')]({'type':_0x1e3ba7[_0x9d8f('0x11')],'app':'Set','appdata':_0x9d8f('0x3c'),'context':_0x1e3ba7['context'],'exten':_0x1e3ba7[_0x9d8f('0x10')],'priority':_0x101cdb[_0x9d8f('0x29')]+_0x46acdb[_0x9d8f('0xd')]+_0x34725e++,'VoiceExtensionId':_0x1e3ba7[_0x9d8f('0x15')]});}}}for(var _0x12f790=0x0;_0x12f790<_0x101cdb[_0x9d8f('0x29')];_0x12f790+=0x1){var _0x4e964b=_0x46acdb[_0x9d8f('0xd')]+_0x101cdb[_0x9d8f('0x29')];var _0x24b6a8=_0x12f790===_0x101cdb[_0x9d8f('0x29')]-0x1?_0x46acdb[_0x9d8f('0xd')]+_0x5ecba7[_0x9d8f('0x29')]+_0x1bf2bf[_0x9d8f('0x29')]+0x2:_0x46acdb['priority']+_0x12f790+0x1;_0x5ecba7['splice'](_0x12f790,0x0,{'type':_0x1e3ba7[_0x9d8f('0x11')],'app':_0x9d8f('0x3d'),'appdata':_0x101cdb[_0x12f790]+'?'+_0x1e3ba7['context']+',${EXTEN},'+_0x4e964b+':'+_0x1e3ba7[_0x9d8f('0x14')]+',${EXTEN},'+_0x24b6a8,'exten':_0x1e3ba7[_0x9d8f('0x10')],'context':_0x1e3ba7[_0x9d8f('0x14')],'priority':_0x46acdb['priority']+_0x12f790,'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});}_0x1e3ba7[_0x9d8f('0xd')]=_0x5ecba7[_0x9d8f('0x29')]?_[_0x9d8f('0x3e')](_0x5ecba7)[_0x9d8f('0xd')]+0x1:_0x46acdb[_0x9d8f('0xd')];_0x46acdb[_0x9d8f('0xd')]=(_0x1bf2bf['length']?_[_0x9d8f('0x3e')](_0x1bf2bf)[_0x9d8f('0xd')]:_0x1e3ba7['priority'])+0x1;_0x46acdb['extensions']=_[_0x9d8f('0x3f')](_0x46acdb[_0x9d8f('0xe')],_0x5ecba7,[_0x1e3ba7],_0x1bf2bf);}_0x46acdb[_0x9d8f('0xe')][_0x9d8f('0x19')]({'type':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x11')],'app':_0x9d8f('0x40'),'exten':_0x563bef[_0x4ae279][0x0]['exten'],'context':_0x563bef[_0x4ae279][0x0]['context'],'priority':_0x46acdb[_0x9d8f('0xd')],'VoiceExtensionId':_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]});_0x2c2475[_0x9d8f('0x19')](_0x563bef[_0x4ae279][0x0][_0x9d8f('0x15')]);_0x39275a=_['concat'](_0x39275a,_0x46acdb['extensions']);}}return _0x2d6b9e['transaction'](function(_0x5a5db0){return _0x2d6b9e['models'][_0x9d8f('0x7')][_0x9d8f('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x2c2475}},'transaction':_0x5a5db0})[_0x9d8f('0x5')](function(_0x437550){return _0x2d6b9e[_0x9d8f('0x2')][_0x9d8f('0x7')][_0x9d8f('0x42')](_[_0x9d8f('0x43')](_0x39275a,_0x9d8f('0xd')),{'transaction':_0x5a5db0});});});})[_0x9d8f('0x44')](function(_0x19d0e){console[_0x9d8f('0x45')](_0x19d0e);});}exports[_0x9d8f('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ad0be04..382d90f 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 _0xe110=['createdAt','updatedAt','select','NOW()','ContactId','field','toString','from','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','cm_contacts','deletedAt\x20IS\x20NULL','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','resolve','split','createReadStream','pause','info','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','phone','scheduledAt'];(function(_0x279398,_0x40e597){var _0x544a37=function(_0x602725){while(--_0x602725){_0x279398['push'](_0x279398['shift']());}};_0x544a37(++_0x40e597);}(_0xe110,0xa4));var _0x0e11=function(_0x17f4c8,_0x3aa345){_0x17f4c8=_0x17f4c8-0x0;var _0x288b47=_0xe110[_0x17f4c8];return _0x288b47;};'use strict';var BPromise=require(_0x0e11('0x0'));var util=require('util');var _=require(_0x0e11('0x1'));var fs=require('fs');var squel=require(_0x0e11('0x2'));var Papa=require(_0x0e11('0x3'));var Redis=require('ioredis');var db=require(_0x0e11('0x4'))['db'];var config=require(_0x0e11('0x5'));var logger=require('../../../config/logger')(_0x0e11('0x6'));config[_0x0e11('0x7')]=_[_0x0e11('0x8')](config[_0x0e11('0x7')],{'host':_0x0e11('0x9'),'port':0x18eb});var socket=require(_0x0e11('0xa'))(new Redis(config['redis']));require(_0x0e11('0xb'))['register'](socket);try{if(!process[_0x0e11('0xc')][0x2]||process[_0x0e11('0xc')][0x2]===_0x0e11('0xd')||process[_0x0e11('0xc')][0x2]==='null'){throw new Error(_0x0e11('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0x0e11('0xc')][0x3]||process[_0x0e11('0xc')][0x3]===_0x0e11('0xd')||process[_0x0e11('0xc')][0x3]===_0x0e11('0xf')||!process['argv'][0x4]||process[_0x0e11('0xc')][0x4]===_0x0e11('0xd')||process[_0x0e11('0xc')][0x4]===_0x0e11('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x0e11('0x10')](process[_0x0e11('0xc')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x0e11('0xc')][0x5]||process[_0x0e11('0xc')][0x5]==='undefined'||process[_0x0e11('0xc')][0x5]===_0x0e11('0xf')){throw new Error(_0x0e11('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x0e11('0xd')&&process[_0x0e11('0xc')][0x6]!=='null'?process[_0x0e11('0xc')][0x6]:null;var DUPLICATES=process[_0x0e11('0xc')][0x7]&&process['argv'][0x7]!==_0x0e11('0xd')&&process['argv'][0x7]!==_0x0e11('0xf')?process[_0x0e11('0xc')][0x7]:null;if(!process[_0x0e11('0xc')][0x8]||process[_0x0e11('0xc')][0x8]===_0x0e11('0xd')||process[_0x0e11('0xc')][0x8]==='null'){throw new Error(_0x0e11('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x56a09a){logger[_0x0e11('0x13')](_0x56a09a);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(_0x120feb,_0x12c7c2,_0x208b0b,_0x349203){var _0x438e47={'message':_0x12c7c2};_0x438e47[_0x120feb]=!![];if(_0x208b0b){_0x438e47['contact']=_0x208b0b;}if(_0x349203){_0x438e47[_0x0e11('0x14')]=_0x349203;}return _0x438e47;}function isEmail(_0x22fad8){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))*$/[_0x0e11('0x15')](_0x22fad8);}function checkRow(_0x437d12,_0x354238,_0x3eee58){return new BPromise(function(_0x4806b8,_0x25f999){if(_[_0x0e11('0x16')](_0x437d12)){return _0x25f999(handleCheckRowError(_0x0e11('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3eee58));}if(_0x437d12[_0x0e11('0x17')]&&_0x437d12[_0x0e11('0x17')][_0x0e11('0x18')]){var _0x196bff=_[_0x0e11('0x19')](_0x437d12[_0x0e11('0x17')],_0x0e11('0x1a'))[_0x0e11('0x1b')](';');return _0x25f999(handleCheckRowError(_0x0e11('0x13'),_0x196bff,null,_0x3eee58));}var _0x24b0cb={};for(var _0x228199 in FIELDS){if(FIELDS['hasOwnProperty'](_0x228199)&&FIELDS[_0x228199]){_0x24b0cb[_0x228199]=_0x437d12[_0x0e11('0x1c')][0x0][FIELDS[_0x228199]]||_0x437d12[_0x0e11('0x1c')][0x0]['\ufeff'+FIELDS[_0x228199]];}}if(!_0x24b0cb[_0x0e11('0x1d')]){return _0x25f999(handleCheckRowError(_0x0e11('0x13'),_0x0e11('0x1e'),null,_0x3eee58));}if(!_0x24b0cb['phone']){return _0x25f999(handleCheckRowError(_0x0e11('0x13'),_0x0e11('0x1f'),null,_0x3eee58));}if(_0x24b0cb[_0x0e11('0x20')]){var _0x4c4d9f=moment(_0x24b0cb[_0x0e11('0x20')],_0x0e11('0x21'));if(!_0x4c4d9f['isValid']()){return _0x25f999(handleCheckRowError(_0x0e11('0x13'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3eee58));}}if(_0x24b0cb[_0x0e11('0x22')]){if(!isEmail(_0x24b0cb[_0x0e11('0x22')])){return _0x25f999(handleCheckRowError(_0x0e11('0x13'),_0x0e11('0x23'),null,_0x3eee58));}}_0x24b0cb[_0x0e11('0x24')]=LISTID;_0x24b0cb[_0x0e11('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0e11('0x18')]&&_0x354238){var _0x5b9171={};for(var _0x25d01e=0x0,_0x565fc9=DUPLICATES[_0x0e11('0x18')];_0x25d01e<_0x565fc9;_0x25d01e+=0x1){_0x5b9171[DUPLICATES[_0x25d01e]]=_0x24b0cb[DUPLICATES[_0x25d01e]];}var _0x2874f4=_[_0x0e11('0x26')](_0x354238,_0x5b9171);if(_0x2874f4){return _0x25f999(handleCheckRowError(_0x0e11('0x27'),'Duplicate\x20Contact',_0x2874f4,_0x3eee58));}}return db[_0x0e11('0x28')][_0x0e11('0x29')](_0x24b0cb,{'raw':!![],'hooks':![],'fields':_['keys'](_0x24b0cb)})[_0x0e11('0x2a')](function(_0x137fd9){if(DUPLICATES&&DUPLICATES[_0x0e11('0x18')]&&_0x354238){_0x354238['push'](_[_0x0e11('0x2b')](_0x24b0cb,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x137fd9['id'];return _0x4806b8();})[_0x0e11('0x2c')](function(_0x2a19b8){return _0x25f999(handleCheckRowError(_0x0e11('0x13'),_0x0e11('0x2d')+(_0x2a19b8['message']||JSON[_0x0e11('0x2e')](_0x2a19b8)),null,_0x3eee58));});});}function checkHopper(){function _0x25027f(){return function(_0x866ff7){logger[_0x0e11('0x13')](_0x0e11('0x2f'),_0x0e11('0x30'),util[_0x0e11('0x31')](_0x866ff7,{'showHidden':![],'depth':null}));};}var _0x1b9d6b=function(_0x16e9a9,_0x310689){var _0x5f2283=squel['insert']()['into'](_0x0e11('0x32'))[_0x0e11('0x33')]([_0x0e11('0x34'),_0x0e11('0x35'),'ContactId',_0x0e11('0x24'),_0x310689,_0x0e11('0x36'),_0x0e11('0x37')],squel[_0x0e11('0x38')]()['field'](_0x0e11('0x34'),'phone')['field'](_0x0e11('0x39'),_0x0e11('0x35'))['field']('id',_0x0e11('0x3a'))[_0x0e11('0x3b')](LISTID[_0x0e11('0x3c')](),_0x0e11('0x24'))[_0x0e11('0x3b')](_0x16e9a9['id'][_0x0e11('0x3c')](),_0x310689)[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x36'))[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x37'))[_0x0e11('0x3d')]('cm_contacts')[_0x0e11('0x3e')]('deletedAt\x20IS\x20NULL')[_0x0e11('0x3e')](_0x0e11('0x3f'),LISTID[_0x0e11('0x3c')]())[_0x0e11('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x0e11('0x3e')](_0x0e11('0x40'),squel[_0x0e11('0x38')]()[_0x0e11('0x3b')](_0x0e11('0x34'))[_0x0e11('0x3d')](_0x0e11('0x32'))[_0x0e11('0x3e')](_0x310689+_0x0e11('0x41'),_0x16e9a9['id'][_0x0e11('0x3c')]())))[_0x0e11('0x3c')]();return _0x5f2283;};var _0x57bad8=function(_0xd9c5fb,_0xccd950){var _0x3f0de2=squel[_0x0e11('0x42')]()[_0x0e11('0x43')](_0x0e11('0x32'))['fromQuery']([_0x0e11('0x34'),'scheduledAt',_0x0e11('0x3a'),_0x0e11('0x24'),_0xccd950,_0x0e11('0x36'),_0x0e11('0x37')],squel[_0x0e11('0x38')]()['field'](_0x0e11('0x34'),_0x0e11('0x34'))['field']('NOW()',_0x0e11('0x35'))[_0x0e11('0x3b')]('id',_0x0e11('0x3a'))[_0x0e11('0x3b')](LISTID[_0x0e11('0x3c')](),_0x0e11('0x24'))[_0x0e11('0x3b')](_0xd9c5fb['id'][_0x0e11('0x3c')](),_0xccd950)[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x36'))[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x37'))[_0x0e11('0x3d')](_0x0e11('0x44'))['where'](_0x0e11('0x45'))['where'](_0x0e11('0x3f'),LISTID['toString']())[_0x0e11('0x3e')]('id\x20IN\x20?',squel[_0x0e11('0x46')](hopperContacts))[_0x0e11('0x3e')](_0x0e11('0x47'))['where'](_0x0e11('0x40'),squel[_0x0e11('0x38')]()[_0x0e11('0x3b')](_0x0e11('0x48'))[_0x0e11('0x3d')](_0x0e11('0x49'))[_0x0e11('0x3e')](_0xccd950+_0x0e11('0x41'),_0xd9c5fb['id'][_0x0e11('0x3c')]()))['where'](_0x0e11('0x40'),squel[_0x0e11('0x38')]()[_0x0e11('0x3b')](_0x0e11('0x34'))['from']('cm_hopper')[_0x0e11('0x3e')](_0xccd950+_0x0e11('0x41'),_0xd9c5fb['id']['toString']())))['toString']();return _0x3f0de2;};function _0x3ed737(_0x2f3e14,_0x5430a1){var _0x490c50=squel['insert']()['into']('cm_hopper')[_0x0e11('0x33')]([_0x0e11('0x34'),_0x0e11('0x35'),_0x0e11('0x3a'),_0x0e11('0x24'),_0x5430a1,_0x0e11('0x36'),_0x0e11('0x37')],squel[_0x0e11('0x38')]()[_0x0e11('0x3b')](_0x0e11('0x34'),_0x0e11('0x34'))[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x35'))[_0x0e11('0x3b')]('id','ContactId')['field'](LISTID['toString'](),'ListId')['field'](_0x2f3e14['id'][_0x0e11('0x3c')](),_0x5430a1)[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x36'))[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x37'))[_0x0e11('0x3d')](_0x0e11('0x44'))[_0x0e11('0x3e')]('deletedAt\x20IS\x20NULL')[_0x0e11('0x3e')](_0x0e11('0x3f'),LISTID[_0x0e11('0x3c')]())[_0x0e11('0x3e')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x0e11('0x3e')](_0x0e11('0x47')))[_0x0e11('0x3c')]();return _0x490c50;}function _0x6920e5(_0x3ff2ea,_0x5e5865){var _0x587e6f=squel['insert']()['into'](_0x0e11('0x4a'))[_0x0e11('0x33')]([_0x0e11('0x34'),'ContactId',_0x0e11('0x24'),_0x5e5865,_0x0e11('0x36'),_0x0e11('0x37')],squel[_0x0e11('0x38')]()[_0x0e11('0x3b')](_0x0e11('0x34'),_0x0e11('0x34'))[_0x0e11('0x3b')]('id',_0x0e11('0x3a'))['field'](LISTID[_0x0e11('0x3c')](),_0x0e11('0x24'))[_0x0e11('0x3b')](_0x3ff2ea['id']['toString'](),_0x5e5865)['field']('NOW()',_0x0e11('0x36'))[_0x0e11('0x3b')](_0x0e11('0x39'),_0x0e11('0x37'))[_0x0e11('0x3d')](_0x0e11('0x44'))['where'](_0x0e11('0x45'))[_0x0e11('0x3e')](_0x0e11('0x3f'),LISTID[_0x0e11('0x3c')]())[_0x0e11('0x3e')](_0x0e11('0x4b'),squel[_0x0e11('0x46')](hopperContacts))[_0x0e11('0x3e')](_0x0e11('0x47')))[_0x0e11('0x3c')]();return _0x587e6f;}return db[_0x0e11('0x4c')][_0x0e11('0x4d')]({'where':{'type':_0x0e11('0x4e')},'attributes':['id',_0x0e11('0x4f')],'include':[{'model':db[_0x0e11('0x50')],'as':_0x0e11('0x51'),'where':{'id':LISTID}}]})[_0x0e11('0x2a')](function(_0x1cb098){var _0x16dcc9=[];if(_0x1cb098){var _0x33f718;for(var _0x2db2ac=0x0,_0x1c74bf;_0x2db2ac<_0x1cb098[_0x0e11('0x18')];_0x2db2ac+=0x1){_0x1c74bf=_0x1cb098[_0x2db2ac][_0x0e11('0x52')]({'plain':!![]});switch(_0x1c74bf['dialCheckDuplicateType']){case _0x0e11('0x53'):_0x16dcc9[_0x0e11('0x54')](db[_0x0e11('0x55')][_0x0e11('0x56')](_0x57bad8(_0x1c74bf,_0x0e11('0x57')))['then'](function(){})[_0x0e11('0x2c')](_0x25027f()));break;case _0x0e11('0x58'):_0x16dcc9[_0x0e11('0x54')](db[_0x0e11('0x55')][_0x0e11('0x56')](_0x1b9d6b(_0x1c74bf,_0x0e11('0x57')))[_0x0e11('0x2a')](function(){})[_0x0e11('0x2c')](_0x25027f()));break;default:_0x16dcc9[_0x0e11('0x54')](db[_0x0e11('0x55')]['query'](_0x3ed737(_0x1c74bf,_0x0e11('0x57')))['then'](function(){})['catch'](_0x25027f()));}}}return _0x16dcc9;})[_0x0e11('0x59')]()[_0x0e11('0x2a')](function(){return db[_0x0e11('0x4c')]['findAll']({'where':{'type':_0x0e11('0x4e')},'attributes':['id'],'include':[{'model':db[_0x0e11('0x50')],'as':_0x0e11('0x5a'),'where':{'id':LISTID}}]})[_0x0e11('0x2a')](function(_0x420a1e){var _0x4490c8=[];if(_0x420a1e){var _0x32a047;for(var _0x4248b0=0x0,_0x310dac;_0x4248b0<_0x420a1e[_0x0e11('0x18')];_0x4248b0+=0x1){_0x310dac=_0x420a1e[_0x4248b0]['get']({'plain':!![]});_0x4490c8[_0x0e11('0x54')](db[_0x0e11('0x55')][_0x0e11('0x56')](_0x6920e5(_0x310dac,_0x0e11('0x57')))['then'](function(){})[_0x0e11('0x2c')](_0x25027f()));}}return _0x4490c8;})['all']();})[_0x0e11('0x2a')](function(){return db['Campaign'][_0x0e11('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x0e11('0x2a')](function(_0x53833){var _0x5b802d=[];if(_0x53833){for(var _0x260c17=0x0,_0x1ae483;_0x260c17<_0x53833[_0x0e11('0x18')];_0x260c17+=0x1){_0x1ae483=_0x53833[_0x260c17]['get']({'plain':!![]});switch(_0x1ae483['dialCheckDuplicateType']){case _0x0e11('0x53'):_0x5b802d['push'](db[_0x0e11('0x55')][_0x0e11('0x56')](_0x57bad8(_0x1ae483,_0x0e11('0x5b')))['then'](function(){})[_0x0e11('0x2c')](_0x25027f()));break;case _0x0e11('0x58'):_0x5b802d[_0x0e11('0x54')](db[_0x0e11('0x55')]['query'](_0x1b9d6b(_0x1ae483,'CampaignId'))[_0x0e11('0x2a')](function(){})[_0x0e11('0x2c')](_0x25027f()));break;default:_0x5b802d[_0x0e11('0x54')](db[_0x0e11('0x55')][_0x0e11('0x56')](_0x3ed737(_0x1ae483,_0x0e11('0x5b')))['then'](function(){})[_0x0e11('0x2c')](_0x25027f()));}}}return _0x5b802d;})[_0x0e11('0x59')]();})[_0x0e11('0x2a')](function(){return db[_0x0e11('0x5c')][_0x0e11('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x0e11('0x50')],'as':_0x0e11('0x5a'),'where':{'id':LISTID}}]})[_0x0e11('0x2a')](function(_0x288169){var _0x54f3a6=[];if(_0x288169){for(var _0x1dea9b=0x0,_0x4ee760;_0x1dea9b<_0x288169[_0x0e11('0x18')];_0x1dea9b+=0x1){_0x4ee760=_0x288169[_0x1dea9b]['get']({'plain':!![]});_0x54f3a6[_0x0e11('0x54')](db['sequelize']['query'](_0x6920e5(_0x4ee760,_0x0e11('0x5b')))[_0x0e11('0x2a')](function(){})[_0x0e11('0x2c')](_0x25027f()));}}return _0x54f3a6;})[_0x0e11('0x59')]();})[_0x0e11('0x2c')](function(_0x300e6e){logger[_0x0e11('0x13')](_0x0e11('0x5d'),_0x0e11('0x5e'),_0x300e6e[_0x0e11('0x1a')]);});}var processPromises=function(_0xdf9f67){return BPromise[_0x0e11('0x59')](promises)[_0x0e11('0x2a')](function(_0x6d785e){})[_0x0e11('0x2c')](function(_0x19637d){logger[_0x0e11('0x13')](_0x0e11('0x5f'),JSON[_0x0e11('0x2e')](_0x19637d));})['finally'](function(){socket[_0x0e11('0x60')](_0x0e11('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xdf9f67){return _0xdf9f67[_0x0e11('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x0e11('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x0e11('0x2a')](function(){socket['emit'](_0x0e11('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0e11('0x63')](FILEPATH);}catch(_0x12d645){logger['error'](_0x0e11('0x64'),JSON[_0x0e11('0x2e')](_0x12d645));}finally{process[_0x0e11('0x65')](0x0);}});};process['on'](_0x0e11('0x66'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x0e11('0x67')]()[_0x0e11('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0e11('0x68')](',');return db[_0x0e11('0x28')][_0x0e11('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xf7a538){var _0x2a64a6=fs[_0x0e11('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2a64a6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x21fb01,_0xdfa72b){total+=0x1;var _0x10309a=total;promises[_0x0e11('0x54')](checkRow(_0x21fb01,_0xf7a538,_0x10309a)[_0x0e11('0x2a')](function(){success+=0x1;})[_0x0e11('0x2c')](function(_0x48b3b8){if(_0x48b3b8[_0x0e11('0x13')]){errors+=0x1;delete _0x48b3b8[_0x0e11('0x13')];}else if(_0x48b3b8[_0x0e11('0x27')]){duplicates+=0x1;delete _0x48b3b8[_0x0e11('0x27')];}rows[_0x0e11('0x54')](_0x48b3b8);}));if(total%0xc8===0x0){_0xdfa72b[_0x0e11('0x6a')]();return processPromises(_0xdfa72b);}},'complete':function(){return processPromises()[_0x0e11('0x2a')](function(){logger[_0x0e11('0x6b')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x39080a,_0x59215c){logger[_0x0e11('0x6b')]('CSV\x20parse\x20error',JSON['stringify'](_0x39080a));endCsv();}});})[_0x0e11('0x2c')](function(_0x7522f8){logger[_0x0e11('0x13')](_0x0e11('0x6c'),JSON[_0x0e11('0x2e')](_0x7522f8));});}main(); \ No newline at end of file +var _0x4a3a=['length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','CmContact','create','push','pick','catch','stringify','cmContact','checkHopper','cm_hopper','fromQuery','scheduledAt','ListId','createdAt','select','field','NOW()','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','ContactId','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_black','dialCheckDuplicateType','then','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','findAll','outbound','CmList','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resume','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors'];(function(_0x46e26d,_0x1fad78){var _0x553609=function(_0x4a23f0){while(--_0x4a23f0){_0x46e26d['push'](_0x46e26d['shift']());}};_0x553609(++_0x1fad78);}(_0x4a3a,0xc0));var _0xa4a3=function(_0x1017df,_0x4b8ad4){_0x1017df=_0x1017df-0x0;var _0x3526a5=_0x4a3a[_0x1017df];return _0x3526a5;};'use strict';var BPromise=require(_0xa4a3('0x0'));var util=require(_0xa4a3('0x1'));var _=require(_0xa4a3('0x2'));var fs=require('fs');var squel=require(_0xa4a3('0x3'));var Papa=require(_0xa4a3('0x4'));var Redis=require(_0xa4a3('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xa4a3('0x6'));var logger=require(_0xa4a3('0x7'))(_0xa4a3('0x8'));config[_0xa4a3('0x9')]=_[_0xa4a3('0xa')](config[_0xa4a3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4a3('0xb'))(new Redis(config[_0xa4a3('0x9')]));require(_0xa4a3('0xc'))[_0xa4a3('0xd')](socket);try{if(!process[_0xa4a3('0xe')][0x2]||process[_0xa4a3('0xe')][0x2]===_0xa4a3('0xf')||process[_0xa4a3('0xe')][0x2]===_0xa4a3('0x10')){throw new Error(_0xa4a3('0x11'));}var FILEPATH=process[_0xa4a3('0xe')][0x2];if(!process[_0xa4a3('0xe')][0x3]||process['argv'][0x3]===_0xa4a3('0xf')||process[_0xa4a3('0xe')][0x3]===_0xa4a3('0x10')||!process[_0xa4a3('0xe')][0x4]||process[_0xa4a3('0xe')][0x4]==='undefined'||process['argv'][0x4]===_0xa4a3('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xa4a3('0x12')](process[_0xa4a3('0xe')][0x3][_0xa4a3('0x13')](','),process['argv'][0x4][_0xa4a3('0x13')](','));if(!process[_0xa4a3('0xe')][0x5]||process[_0xa4a3('0xe')][0x5]===_0xa4a3('0xf')||process[_0xa4a3('0xe')][0x5]==='null'){throw new Error(_0xa4a3('0x14'));}var LISTID=process[_0xa4a3('0xe')][0x5];var COMPANYID=process[_0xa4a3('0xe')][0x6]&&process[_0xa4a3('0xe')][0x6]!==_0xa4a3('0xf')&&process[_0xa4a3('0xe')][0x6]!==_0xa4a3('0x10')?process[_0xa4a3('0xe')][0x6]:null;var DUPLICATES=process[_0xa4a3('0xe')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xa4a3('0xe')][0x7]!=='null'?process[_0xa4a3('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0xa4a3('0xe')][0x8]==='undefined'||process['argv'][0x8]===_0xa4a3('0x10')){throw new Error(_0xa4a3('0x15'));}var SOCKET_TIMESTAMP=process[_0xa4a3('0xe')][0x8];}catch(_0x18b620){logger[_0xa4a3('0x16')](_0x18b620);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(_0x4efad8,_0x65c105,_0x124659,_0x564c0c){var _0x35d12a={'message':_0x65c105};_0x35d12a[_0x4efad8]=!![];if(_0x124659){_0x35d12a['contact']=_0x124659;}if(_0x564c0c){_0x35d12a[_0xa4a3('0x17')]=_0x564c0c;}return _0x35d12a;}function isEmail(_0x2c2c3f){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))*$/[_0xa4a3('0x18')](_0x2c2c3f);}function checkRow(_0x54db82,_0x4b72a7,_0xf48403){return new BPromise(function(_0x265d00,_0x3daf06){if(_[_0xa4a3('0x19')](_0x54db82)){return _0x3daf06(handleCheckRowError(_0xa4a3('0x16'),_0xa4a3('0x1a'),null,_0xf48403));}if(_0x54db82[_0xa4a3('0x1b')]&&_0x54db82[_0xa4a3('0x1b')][_0xa4a3('0x1c')]){var _0x2cafd5=_['map'](_0x54db82[_0xa4a3('0x1b')],_0xa4a3('0x1d'))[_0xa4a3('0x1e')](';');return _0x3daf06(handleCheckRowError('error',_0x2cafd5,null,_0xf48403));}var _0x168bb4={};for(var _0x31c864 in FIELDS){if(FIELDS[_0xa4a3('0x1f')](_0x31c864)&&FIELDS[_0x31c864]){_0x168bb4[_0x31c864]=_0x54db82[_0xa4a3('0x20')][0x0][FIELDS[_0x31c864]]||_0x54db82['data'][0x0]['\ufeff'+FIELDS[_0x31c864]];}}if(!_0x168bb4[_0xa4a3('0x21')]){return _0x3daf06(handleCheckRowError(_0xa4a3('0x16'),_0xa4a3('0x22'),null,_0xf48403));}if(!_0x168bb4[_0xa4a3('0x23')]){return _0x3daf06(handleCheckRowError(_0xa4a3('0x16'),_0xa4a3('0x24'),null,_0xf48403));}if(_0x168bb4['birthDate']){var _0x201657=moment(_0x168bb4['birthDate'],'YYYY-MM-DD');if(!_0x201657['isValid']()){return _0x3daf06(handleCheckRowError(_0xa4a3('0x16'),_0xa4a3('0x25'),null,_0xf48403));}}if(_0x168bb4[_0xa4a3('0x26')]){if(!isEmail(_0x168bb4[_0xa4a3('0x26')])){return _0x3daf06(handleCheckRowError(_0xa4a3('0x16'),_0xa4a3('0x27'),null,_0xf48403));}}_0x168bb4['ListId']=LISTID;_0x168bb4['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa4a3('0x1c')]&&_0x4b72a7){var _0x2d1274={};for(var _0x201f98=0x0,_0x2689b3=DUPLICATES[_0xa4a3('0x1c')];_0x201f98<_0x2689b3;_0x201f98+=0x1){_0x2d1274[DUPLICATES[_0x201f98]]=_0x168bb4[DUPLICATES[_0x201f98]];}var _0x2a37c8=_[_0xa4a3('0x28')](_0x4b72a7,_0x2d1274);if(_0x2a37c8){return _0x3daf06(handleCheckRowError(_0xa4a3('0x29'),_0xa4a3('0x2a'),_0x2a37c8,_0xf48403));}}return db[_0xa4a3('0x2b')][_0xa4a3('0x2c')](_0x168bb4,{'raw':!![],'hooks':![],'fields':_['keys'](_0x168bb4)})['then'](function(_0x36e5de){if(DUPLICATES&&DUPLICATES[_0xa4a3('0x1c')]&&_0x4b72a7){_0x4b72a7[_0xa4a3('0x2d')](_[_0xa4a3('0x2e')](_0x168bb4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x36e5de['id'];return _0x265d00();})[_0xa4a3('0x2f')](function(_0x286651){return _0x3daf06(handleCheckRowError(_0xa4a3('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x286651[_0xa4a3('0x1d')]||JSON[_0xa4a3('0x30')](_0x286651)),null,_0xf48403));});});}function checkHopper(){function _0x31872e(){return function(_0x1b9544){logger[_0xa4a3('0x16')](_0xa4a3('0x31'),_0xa4a3('0x32'),util['inspect'](_0x1b9544,{'showHidden':![],'depth':null}));};}var _0x87fe78=function(_0x430c38,_0x540e94){var _0x58e4d6=squel['insert']()['into'](_0xa4a3('0x33'))[_0xa4a3('0x34')](['phone',_0xa4a3('0x35'),'ContactId',_0xa4a3('0x36'),_0x540e94,_0xa4a3('0x37'),'updatedAt'],squel[_0xa4a3('0x38')]()[_0xa4a3('0x39')](_0xa4a3('0x23'),_0xa4a3('0x23'))[_0xa4a3('0x39')](_0xa4a3('0x3a'),_0xa4a3('0x35'))['field']('id','ContactId')[_0xa4a3('0x39')](LISTID[_0xa4a3('0x3b')](),_0xa4a3('0x36'))[_0xa4a3('0x39')](_0x430c38['id']['toString'](),_0x540e94)[_0xa4a3('0x39')](_0xa4a3('0x3a'),'createdAt')['field'](_0xa4a3('0x3a'),_0xa4a3('0x3c'))[_0xa4a3('0x3d')](_0xa4a3('0x3e'))[_0xa4a3('0x3f')](_0xa4a3('0x40'))['where'](_0xa4a3('0x41'),LISTID[_0xa4a3('0x3b')]())[_0xa4a3('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xa4a3('0x3f')](_0xa4a3('0x42'),squel['select']()['field'](_0xa4a3('0x23'))[_0xa4a3('0x3d')](_0xa4a3('0x33'))[_0xa4a3('0x3f')](_0x540e94+_0xa4a3('0x43'),_0x430c38['id'][_0xa4a3('0x3b')]())))[_0xa4a3('0x3b')]();return _0x58e4d6;};var _0x17160a=function(_0xf07562,_0x1a9b2e){var _0x389def=squel[_0xa4a3('0x44')]()[_0xa4a3('0x45')](_0xa4a3('0x33'))[_0xa4a3('0x34')]([_0xa4a3('0x23'),_0xa4a3('0x35'),_0xa4a3('0x46'),_0xa4a3('0x36'),_0x1a9b2e,_0xa4a3('0x37'),_0xa4a3('0x3c')],squel[_0xa4a3('0x38')]()[_0xa4a3('0x39')](_0xa4a3('0x23'),_0xa4a3('0x23'))[_0xa4a3('0x39')](_0xa4a3('0x3a'),_0xa4a3('0x35'))['field']('id','ContactId')[_0xa4a3('0x39')](LISTID[_0xa4a3('0x3b')](),'ListId')['field'](_0xf07562['id']['toString'](),_0x1a9b2e)[_0xa4a3('0x39')](_0xa4a3('0x3a'),'createdAt')[_0xa4a3('0x39')]('NOW()','updatedAt')['from'](_0xa4a3('0x3e'))[_0xa4a3('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa4a3('0x3f')](_0xa4a3('0x41'),LISTID['toString']())['where'](_0xa4a3('0x47'),squel[_0xa4a3('0x48')](hopperContacts))[_0xa4a3('0x3f')](_0xa4a3('0x49'))[_0xa4a3('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa4a3('0x38')]()[_0xa4a3('0x39')](_0xa4a3('0x4a'))[_0xa4a3('0x3d')]('cm_hopper_final')[_0xa4a3('0x3f')](_0x1a9b2e+_0xa4a3('0x43'),_0xf07562['id'][_0xa4a3('0x3b')]()))[_0xa4a3('0x3f')](_0xa4a3('0x42'),squel[_0xa4a3('0x38')]()[_0xa4a3('0x39')](_0xa4a3('0x23'))[_0xa4a3('0x3d')](_0xa4a3('0x33'))[_0xa4a3('0x3f')](_0x1a9b2e+'\x20=\x20?',_0xf07562['id'][_0xa4a3('0x3b')]())))['toString']();return _0x389def;};function _0x9a4f5e(_0x43ec65,_0x3635d3){var _0x52a0a6=squel[_0xa4a3('0x44')]()[_0xa4a3('0x45')](_0xa4a3('0x33'))['fromQuery'](['phone',_0xa4a3('0x35'),'ContactId','ListId',_0x3635d3,_0xa4a3('0x37'),_0xa4a3('0x3c')],squel['select']()[_0xa4a3('0x39')](_0xa4a3('0x23'),_0xa4a3('0x23'))[_0xa4a3('0x39')](_0xa4a3('0x3a'),'scheduledAt')['field']('id',_0xa4a3('0x46'))['field'](LISTID[_0xa4a3('0x3b')](),_0xa4a3('0x36'))[_0xa4a3('0x39')](_0x43ec65['id'][_0xa4a3('0x3b')](),_0x3635d3)[_0xa4a3('0x39')](_0xa4a3('0x3a'),'createdAt')[_0xa4a3('0x39')](_0xa4a3('0x3a'),_0xa4a3('0x3c'))['from'](_0xa4a3('0x3e'))[_0xa4a3('0x3f')](_0xa4a3('0x40'))[_0xa4a3('0x3f')]('ListId\x20=\x20?',LISTID['toString']())[_0xa4a3('0x3f')](_0xa4a3('0x47'),squel[_0xa4a3('0x48')](hopperContacts))['where'](_0xa4a3('0x49')))[_0xa4a3('0x3b')]();return _0x52a0a6;}function _0x2ca741(_0x4e3d22,_0x420b73){var _0x51217c=squel[_0xa4a3('0x44')]()[_0xa4a3('0x45')](_0xa4a3('0x4b'))[_0xa4a3('0x34')]([_0xa4a3('0x23'),_0xa4a3('0x46'),_0xa4a3('0x36'),_0x420b73,'createdAt','updatedAt'],squel['select']()['field'](_0xa4a3('0x23'),_0xa4a3('0x23'))[_0xa4a3('0x39')]('id',_0xa4a3('0x46'))[_0xa4a3('0x39')](LISTID[_0xa4a3('0x3b')](),_0xa4a3('0x36'))[_0xa4a3('0x39')](_0x4e3d22['id']['toString'](),_0x420b73)[_0xa4a3('0x39')](_0xa4a3('0x3a'),_0xa4a3('0x37'))[_0xa4a3('0x39')](_0xa4a3('0x3a'),_0xa4a3('0x3c'))[_0xa4a3('0x3d')]('cm_contacts')[_0xa4a3('0x3f')](_0xa4a3('0x40'))[_0xa4a3('0x3f')](_0xa4a3('0x41'),LISTID[_0xa4a3('0x3b')]())[_0xa4a3('0x3f')](_0xa4a3('0x47'),squel[_0xa4a3('0x48')](hopperContacts))[_0xa4a3('0x3f')](_0xa4a3('0x49')))['toString']();return _0x51217c;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xa4a3('0x4c')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xa4a3('0x4d')](function(_0x353bfe){var _0x36bc86=[];if(_0x353bfe){var _0x3cee34;for(var _0x264263=0x0,_0x1f6ff4;_0x264263<_0x353bfe[_0xa4a3('0x1c')];_0x264263+=0x1){_0x1f6ff4=_0x353bfe[_0x264263][_0xa4a3('0x4e')]({'plain':!![]});switch(_0x1f6ff4[_0xa4a3('0x4c')]){case _0xa4a3('0x4f'):_0x36bc86[_0xa4a3('0x2d')](db[_0xa4a3('0x50')]['query'](_0x17160a(_0x1f6ff4,_0xa4a3('0x51')))[_0xa4a3('0x4d')](function(){})['catch'](_0x31872e()));break;case _0xa4a3('0x52'):_0x36bc86['push'](db[_0xa4a3('0x50')][_0xa4a3('0x53')](_0x87fe78(_0x1f6ff4,_0xa4a3('0x51')))[_0xa4a3('0x4d')](function(){})['catch'](_0x31872e()));break;default:_0x36bc86[_0xa4a3('0x2d')](db[_0xa4a3('0x50')][_0xa4a3('0x53')](_0x9a4f5e(_0x1f6ff4,_0xa4a3('0x51')))['then'](function(){})['catch'](_0x31872e()));}}}return _0x36bc86;})[_0xa4a3('0x54')]()[_0xa4a3('0x4d')](function(){return db['VoiceQueue'][_0xa4a3('0x55')]({'where':{'type':_0xa4a3('0x56')},'attributes':['id'],'include':[{'model':db[_0xa4a3('0x57')],'as':_0xa4a3('0x58'),'where':{'id':LISTID}}]})[_0xa4a3('0x4d')](function(_0x27dbd1){var _0x1dd62e=[];if(_0x27dbd1){var _0x2cc5b0;for(var _0x13cbe3=0x0,_0x803164;_0x13cbe3<_0x27dbd1[_0xa4a3('0x1c')];_0x13cbe3+=0x1){_0x803164=_0x27dbd1[_0x13cbe3]['get']({'plain':!![]});_0x1dd62e['push'](db[_0xa4a3('0x50')][_0xa4a3('0x53')](_0x2ca741(_0x803164,_0xa4a3('0x51')))[_0xa4a3('0x4d')](function(){})['catch'](_0x31872e()));}}return _0x1dd62e;})[_0xa4a3('0x54')]();})['then'](function(){return db[_0xa4a3('0x59')]['findAll']({'attributes':['id',_0xa4a3('0x4c')],'include':[{'model':db[_0xa4a3('0x57')],'as':'Lists','where':{'id':LISTID}}]})[_0xa4a3('0x4d')](function(_0x3c3def){var _0xc13e73=[];if(_0x3c3def){for(var _0x602838=0x0,_0x282233;_0x602838<_0x3c3def['length'];_0x602838+=0x1){_0x282233=_0x3c3def[_0x602838]['get']({'plain':!![]});switch(_0x282233['dialCheckDuplicateType']){case'always':_0xc13e73['push'](db[_0xa4a3('0x50')][_0xa4a3('0x53')](_0x17160a(_0x282233,_0xa4a3('0x5a')))[_0xa4a3('0x4d')](function(){})[_0xa4a3('0x2f')](_0x31872e()));break;case _0xa4a3('0x52'):_0xc13e73[_0xa4a3('0x2d')](db[_0xa4a3('0x50')][_0xa4a3('0x53')](_0x87fe78(_0x282233,_0xa4a3('0x5a')))[_0xa4a3('0x4d')](function(){})['catch'](_0x31872e()));break;default:_0xc13e73[_0xa4a3('0x2d')](db[_0xa4a3('0x50')][_0xa4a3('0x53')](_0x9a4f5e(_0x282233,_0xa4a3('0x5a')))['then'](function(){})['catch'](_0x31872e()));}}}return _0xc13e73;})[_0xa4a3('0x54')]();})[_0xa4a3('0x4d')](function(){return db[_0xa4a3('0x59')][_0xa4a3('0x55')]({'attributes':['id'],'include':[{'model':db[_0xa4a3('0x57')],'as':_0xa4a3('0x58'),'where':{'id':LISTID}}]})[_0xa4a3('0x4d')](function(_0x525f08){var _0xe9b23=[];if(_0x525f08){for(var _0x11faf6=0x0,_0x3b9c8a;_0x11faf6<_0x525f08['length'];_0x11faf6+=0x1){_0x3b9c8a=_0x525f08[_0x11faf6]['get']({'plain':!![]});_0xe9b23[_0xa4a3('0x2d')](db[_0xa4a3('0x50')][_0xa4a3('0x53')](_0x2ca741(_0x3b9c8a,_0xa4a3('0x5a')))['then'](function(){})['catch'](_0x31872e()));}}return _0xe9b23;})['all']();})[_0xa4a3('0x2f')](function(_0x249955){logger[_0xa4a3('0x16')](_0xa4a3('0x5b'),_0xa4a3('0x5c'),_0x249955['message']);});}var processPromises=function(_0x2347e3){return BPromise[_0xa4a3('0x54')](promises)['then'](function(_0x12bbae){})[_0xa4a3('0x2f')](function(_0xa21a8e){logger[_0xa4a3('0x16')](_0xa4a3('0x5d'),JSON[_0xa4a3('0x30')](_0xa21a8e));})[_0xa4a3('0x5e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2347e3){return _0x2347e3[_0xa4a3('0x5f')]();}});};var endCsv=function(){return BPromise[_0xa4a3('0x60')]()[_0xa4a3('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0xa4a3('0x4d')](function(){socket[_0xa4a3('0x61')](_0xa4a3('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa4a3('0x63')](FILEPATH);}catch(_0x50eaa2){logger[_0xa4a3('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xa4a3('0x30')](_0x50eaa2));}finally{process[_0xa4a3('0x64')](0x0);}});};process['on'](_0xa4a3('0x65'),function(){logger[_0xa4a3('0x66')](_0xa4a3('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0xa4a3('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa4a3('0x13')](',');return db[_0xa4a3('0x2b')][_0xa4a3('0x55')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x349ad8){var _0x1d6ef8=fs[_0xa4a3('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa4a3('0x69')](_0x1d6ef8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x38acda,_0x25f7fc){total+=0x1;var _0x55b643=total;promises[_0xa4a3('0x2d')](checkRow(_0x38acda,_0x349ad8,_0x55b643)[_0xa4a3('0x4d')](function(){success+=0x1;})[_0xa4a3('0x2f')](function(_0x17c77f){if(_0x17c77f[_0xa4a3('0x16')]){errors+=0x1;delete _0x17c77f[_0xa4a3('0x16')];}else if(_0x17c77f[_0xa4a3('0x29')]){duplicates+=0x1;delete _0x17c77f[_0xa4a3('0x29')];}rows[_0xa4a3('0x2d')](_0x17c77f);}));if(total%0xc8===0x0){_0x25f7fc[_0xa4a3('0x6a')]();return processPromises(_0x25f7fc);}},'complete':function(){return processPromises()[_0xa4a3('0x4d')](function(){logger[_0xa4a3('0x66')](_0xa4a3('0x6b'));endCsv();});},'error':function(_0x433624,_0x4aab9c){logger[_0xa4a3('0x66')](_0xa4a3('0x6c'),JSON[_0xa4a3('0x30')](_0x433624));endCsv();}});})[_0xa4a3('0x2f')](function(_0x4cbf3b){logger[_0xa4a3('0x16')](_0xa4a3('0x6d'),JSON[_0xa4a3('0x30')](_0x4cbf3b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index da37481..8668c16 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 _0x0c97=['join','CmContact','findAll','AdditionalPhones','length','push','all','then','split','isNil','filter','CmContactHasItem','findOne','create','inserted','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','ContactId','ListId','createdAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.phone','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','updatedAt','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','CompanyId','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','message','exit','sequelize','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','utcOffset','set','offset','dialTimezone','main','stringify','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','keys','header','ContactItemType','name','_description','writeFileSync','parse','data','rows','errors','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','trim','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','each','contactId','contactTypeId','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','select','field','phone','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20('];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x0c97,0x9f));var _0x70c9=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x0c97[_0x5b740b];return _0x6f8f4e;};'use strict';var fs=require('fs');var path=require(_0x70c9('0x0'));var _=require(_0x70c9('0x1'));var Papa=require(_0x70c9('0x2'));var util=require(_0x70c9('0x3'));var BPromise=require(_0x70c9('0x4'));var moment=require('moment');var squel=require(_0x70c9('0x5'));var Redis=require(_0x70c9('0x6'));var db=require(_0x70c9('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x70c9('0x8'))(_0x70c9('0x9'));config[_0x70c9('0xa')]=_['defaults'](config['redis'],{'host':_0x70c9('0xb'),'port':0x18eb});var socket=require(_0x70c9('0xc'))(new Redis(config[_0x70c9('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x70c9('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x70c9('0xe')](_0x70c9('0xd'));function isEmail(_0x1432a7){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'](_0x1432a7);}function selectNotIn(_0x242fec,_0x24439d,_0x4892ef,_0x2b2716,_0x37f143){return squel[_0x70c9('0xf')]()[_0x70c9('0x10')](_0x70c9('0x11'))[_0x70c9('0x12')](_0x2b2716)['join'](_0x24439d,null,_0x24439d+_0x70c9('0x13')+_0x2b2716+'.'+_0x4892ef)['where'](_0x2b2716+'.'+_0x4892ef+_0x70c9('0x14')+_0x242fec+'.'+_0x4892ef)[_0x70c9('0x15')](_0x24439d+_0x70c9('0x16')+_0x37f143[_0x70c9('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x468775,_0x5a1a6e){promisesAdditionalPhones=[];return db[_0x70c9('0x18')][_0x70c9('0x19')]({'raw':!![],'attributes':['id',_0x70c9('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x1d4355){if(_0x1d4355!==null){var _0x3eef4e=[];for(var _0x59fea4=0x0;_0x59fea4<_0x1d4355[_0x70c9('0x1b')];_0x59fea4++){var _0x3ae820=_0x1d4355[_0x59fea4];_0x3eef4e[_0x70c9('0x1c')](insertAdditionalPhones(_0x3ae820));}}Promise[_0x70c9('0x1d')](_0x3eef4e)[_0x70c9('0x1e')](function(){_0x468775({'val':0x1});});});});}function insertAdditionalPhones(_0x349f3a){return new Promise(function(_0xe51267,_0x193eba){var _0x41eb81=_0x349f3a['AdditionalPhones'];var _0x5bc49d=_0x41eb81[_0x70c9('0x1f')](';');var _0x5c61e9=[];orderBy=0x0;for(var _0x5be7d7=0x0;_0x5be7d7<_0x5bc49d['length'];_0x5be7d7++){_0x5c61e9[_0x70c9('0x1c')](splitAdditionalPhone(_0x349f3a['id'],_0x5bc49d[_0x5be7d7]));}Promise[_0x70c9('0x1d')](_0x5c61e9)[_0x70c9('0x1e')](function(){_0xe51267({'val':_0x5bc49d['length']});});});}function splitAdditionalPhone(_0x2dae4e,_0x2c7b22){return new Promise(function(_0x3f097c,_0x2918d1){var _0x35e443=_0x2c7b22[_0x70c9('0x1f')](':');var _0x3c62b3=_0x35e443[0x0];var _0x1931d7=_0x35e443[0x1];if(!_[_0x70c9('0x20')](_0x1931d7)){var _0x9d174c=_0x1931d7[_0x70c9('0x1f')]('|');var _0x34e969=[];for(var _0x350d72=0x0;_0x350d72<_0x9d174c[_0x70c9('0x1b')];_0x350d72++){if(_0x9d174c[_0x350d72]!==''){var _0x1f29b2=_[_0x70c9('0x21')](promisesAdditionalPhones,{'contactId':_0x2dae4e,'phone':_0x9d174c[_0x350d72]});if(_0x1f29b2[_0x70c9('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x70c9('0x1c')]({'contactId':_0x2dae4e,'contactTypeId':_0x3c62b3,'phone':_0x9d174c[_0x350d72],'orderBy':orderBy});}}}_0x3f097c({'ok':0x1});}else _0x3f097c({'res':0x0});});}function createAdditionalPhone(_0x5616db,_0x3f3470,_0x4c9d4c,_0x2cccf8){var _0x5497ad='';var _0x396b61='';var _0x5e97bc=_0x4c9d4c['split']('§');_0x5497ad=_0x5e97bc[0x0];if(_0x5e97bc['length']==0x2)_0x396b61=_0x5e97bc[0x1];return new Promise(function(_0x24944f,_0x3bd650){return db[_0x70c9('0x22')][_0x70c9('0x23')]({'where':{'CmContactId':_0x5616db,'item':_0x5497ad}})['then'](function(_0x1b2017){if(_0x1b2017){return db[_0x70c9('0x22')]['update']({'ItemTypeId':_0x3f3470,'description':_0x396b61,'OrderBy':_0x2cccf8},{'where':{'CmContactId':_0x5616db,'item':_0x5497ad}})[_0x70c9('0x1e')](function(_0x54294a){_0x24944f({'res':'updated'});});}else{return db[_0x70c9('0x22')][_0x70c9('0x24')]({'CmContactId':_0x5616db,'item':_0x5497ad,'description':_0x396b61,'ItemTypeId':_0x3f3470,'OrderBy':_0x2cccf8,'ItemClass':'PHONE'})[_0x70c9('0x1e')](function(_0x43c645){_0x24944f({'res':_0x70c9('0x25')});});}});});}function insertCmHopper(_0x55e617,_0xaba385,_0x218a22,_0x39d790,_0x149849){var _0xb9cd94=['cm_contacts.phone',_0x70c9('0x26'),_0x70c9('0x27'),_0x70c9('0x28'),_0xaba385+'.'+_0x39d790,_0x70c9('0x29'),_0x70c9('0x2a'),_0x70c9('0x2b'),_0x70c9('0x2c'),'\x22'+_0x149849+'\x22'];return squel[_0x70c9('0x2d')]()[_0x70c9('0x2e')](_0x70c9('0x2f'))[_0x70c9('0x30')]([_0x70c9('0x11'),_0x70c9('0x31'),_0x70c9('0x32'),_0x70c9('0x33'),_0x39d790,_0x70c9('0x34'),'updatedAt','priority',_0x70c9('0x35'),_0x70c9('0x36')],squel[_0x70c9('0xf')]()[_0x70c9('0x37')](_0xb9cd94)[_0x70c9('0x12')](_0xaba385)[_0x70c9('0x17')](_0x70c9('0x38'),null,_0x70c9('0x39')+_0xaba385+_0x70c9('0x3a'))['join'](_0x218a22,null,_0x218a22+_0x70c9('0x13')+_0xaba385+'.'+_0x39d790)[_0x70c9('0x15')](_0xaba385+_0x70c9('0x3b'),_0x55e617)['where'](_0x70c9('0x3c'),NOW)['where'](_0x70c9('0x3d'),selectNotIn(_0xaba385,_0x218a22,_0x39d790,'cm_hopper',['\x22always\x22',_0x70c9('0x3e')]))[_0x70c9('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xaba385,_0x218a22,_0x39d790,_0x70c9('0x2f'),[_0x70c9('0x3f')])))[_0x70c9('0x40')]();}function insertCmHopperBlack(_0x2203a0,_0x4c6f27,_0x1d3bd2,_0x57711b){var _0xd6c574=[_0x70c9('0x41'),'cm_contacts.id',_0x70c9('0x28'),_0x4c6f27+'.'+_0x57711b,_0x70c9('0x29'),_0x70c9('0x2a')];return squel[_0x70c9('0x2d')]()[_0x70c9('0x2e')](_0x70c9('0x42'))['fromQuery'](['phone','ContactId',_0x70c9('0x33'),_0x57711b,_0x70c9('0x34'),'updatedAt'],squel[_0x70c9('0xf')]()[_0x70c9('0x37')](_0xd6c574)[_0x70c9('0x12')](_0x4c6f27)[_0x70c9('0x17')](_0x70c9('0x38'),null,_0x70c9('0x39')+_0x4c6f27+_0x70c9('0x3a'))[_0x70c9('0x17')](_0x1d3bd2,null,_0x1d3bd2+_0x70c9('0x13')+_0x4c6f27+'.'+_0x57711b)['where'](_0x4c6f27+'.CmListId\x20=\x20?',_0x2203a0)[_0x70c9('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x70c9('0xf')]()[_0x70c9('0x10')](_0x70c9('0x11'))[_0x70c9('0x12')](_0x70c9('0x42'))[_0x70c9('0x15')]('ListId\x20=\x20?',_0x2203a0)['where'](_0x57711b+_0x70c9('0x14')+_0x4c6f27+'.'+_0x57711b)))[_0x70c9('0x40')]();}function insertTzCmHopper(_0x5b22ee,_0x4355c7,_0x4e4c28,_0x4bb585,_0x3c3643,_0x4e4cf3){var _0x168d16=[_0x70c9('0x41'),_0x70c9('0x43')+_0x4e4cf3+_0x70c9('0x44'),_0x70c9('0x27'),_0x70c9('0x28'),_0x4355c7+'.'+_0x4bb585,_0x70c9('0x29'),_0x70c9('0x2a'),_0x70c9('0x2b'),_0x70c9('0x2c'),'\x22'+_0x3c3643+'\x22'];var _0x50fe6f=squel['insert']()[_0x70c9('0x2e')](_0x70c9('0x2f'))[_0x70c9('0x30')]([_0x70c9('0x11'),_0x70c9('0x31'),_0x70c9('0x32'),_0x70c9('0x33'),_0x4bb585,_0x70c9('0x34'),_0x70c9('0x45'),'priority',_0x70c9('0x35'),_0x70c9('0x36')],squel['select']()[_0x70c9('0x37')](_0x168d16)['from'](_0x4355c7)[_0x70c9('0x17')](_0x70c9('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x4355c7+_0x70c9('0x3a'))[_0x70c9('0x17')](_0x4e4c28,null,_0x4e4c28+_0x70c9('0x13')+_0x4355c7+'.'+_0x4bb585)['join'](_0x4e4cf3,null,_0x4e4cf3+_0x70c9('0x13')+_0x4355c7+'.'+_0x4bb585)[_0x70c9('0x15')](_0x4355c7+_0x70c9('0x3b'),_0x5b22ee)[_0x70c9('0x15')](_0x70c9('0x3c'),NOW)[_0x70c9('0x15')](_0x70c9('0x3d'),selectNotIn(_0x4355c7,_0x4e4c28,_0x4bb585,_0x70c9('0x2f'),[_0x70c9('0x3f'),_0x70c9('0x3e')]))[_0x70c9('0x15')](_0x70c9('0x3d'),selectNotIn(_0x4355c7,_0x4e4c28,_0x4bb585,_0x70c9('0x2f'),[_0x70c9('0x3f')])))[_0x70c9('0x40')]();return _0x50fe6f;}function insertTzCmHopperBlack(_0x11667b,_0x3a887e,_0x5cafb9,_0x4f3b07){var _0x13d46e=[_0x70c9('0x41'),_0x70c9('0x27'),_0x70c9('0x28'),_0x3a887e+'.'+_0x4f3b07,_0x70c9('0x29'),'cm_contacts.updatedAt'];return squel[_0x70c9('0x2d')]()['into'](_0x70c9('0x42'))[_0x70c9('0x30')]([_0x70c9('0x11'),'ContactId',_0x70c9('0x33'),_0x4f3b07,_0x70c9('0x34'),'updatedAt'],squel[_0x70c9('0xf')]()[_0x70c9('0x37')](_0x13d46e)[_0x70c9('0x12')](_0x3a887e)[_0x70c9('0x17')](_0x70c9('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x3a887e+_0x70c9('0x3a'))['join'](_0x5cafb9,null,_0x5cafb9+_0x70c9('0x13')+_0x3a887e+'.'+_0x4f3b07)[_0x70c9('0x15')](_0x3a887e+_0x70c9('0x3b'),_0x11667b)[_0x70c9('0x15')](_0x70c9('0x3c'),NOW)['where'](_0x70c9('0x3d'),squel['select']()[_0x70c9('0x10')](_0x70c9('0x11'))[_0x70c9('0x12')](_0x70c9('0x42'))[_0x70c9('0x15')]('ListId\x20=\x20?',_0x11667b)[_0x70c9('0x15')](_0x4f3b07+_0x70c9('0x14')+_0x3a887e+'.'+_0x4f3b07)))['toString']();}function insertCmHopperAdditionalPhones(_0x46d874){var _0x16c7e9=['cm_hopper.id',_0x70c9('0x46'),'cm_contact_has_items.OrderBy',_0x70c9('0x47'),_0x70c9('0x48')];return squel['insert']()['into'](_0x70c9('0x49'))['fromQuery']([_0x70c9('0x4a'),_0x70c9('0x11'),_0x70c9('0x4b'),_0x70c9('0x34'),_0x70c9('0x45')],squel[_0x70c9('0xf')]()['fields'](_0x16c7e9)[_0x70c9('0x12')](_0x70c9('0x2f'))['join'](_0x70c9('0x38'),null,_0x70c9('0x4c'))['join'](_0x70c9('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x70c9('0x15')](_0x70c9('0x4e'),_0x46d874)[_0x70c9('0x15')](_0x70c9('0x3c'),NOW))[_0x70c9('0x40')]();}function insertCmContact(_0x4edeb3,_0x2dbc63,_0x413b7f,_0x2e9db4){var _0x550508=_[_0x70c9('0x4f')](_['keys'](_0x2e9db4),[_0x70c9('0x33'),_0x70c9('0x50'),'createdAt',_0x70c9('0x45')]);return squel[_0x70c9('0x2d')]()['into'](_0x70c9('0x38'))[_0x70c9('0x30')](_0x550508,squel[_0x70c9('0xf')]()[_0x70c9('0x37')](_0x550508)[_0x70c9('0x12')](_0x2dbc63)[_0x70c9('0x15')]('('+_0x413b7f[_0x70c9('0x17')](',')+')\x20NOT\x20IN\x20?',squel[_0x70c9('0xf')]()[_0x70c9('0x37')](_0x413b7f)[_0x70c9('0x12')](_0x70c9('0x38'))[_0x70c9('0x15')](_0x70c9('0x51'),_0x4edeb3)[_0x70c9('0x15')]('deletedAt\x20IS\x20NULL'))[_0x70c9('0x15')](_0x70c9('0x52'),squel[_0x70c9('0xf')]()['field'](_0x70c9('0x53'),_0x70c9('0x54'))[_0x70c9('0x12')](_0x2dbc63)['group'](_0x413b7f[_0x70c9('0x17')](','))))[_0x70c9('0x40')]();}function handleStop(){logger[_0x70c9('0x55')](_0x70c9('0x56'));stopped=!![];}function handleUncaughtException(_0x5e1e8d){logger['error'](_0x5e1e8d[_0x70c9('0x57')]);process[_0x70c9('0x58')](0x1);}function handleError(_0x45ed42,_0x4f36ba){stats['errors']['push']({'name':_0x4f36ba['code'],'message':_0x4f36ba[_0x70c9('0x57')],'row':_0x45ed42});}function handleQuery(_0x3a9303){logger['info'](_0x3a9303);return db[_0x70c9('0x59')]['query'](_0x3a9303)[_0x70c9('0x5a')](function(_0x14a00c){results[_0x70c9('0x1c')](_0x14a00c);})[_0x70c9('0x5b')](function(_0x2fc4f4){logger[_0x70c9('0x5c')](_0x2fc4f4[_0x70c9('0x57')]);});}function updateTzCampaigns(_0x1d7a22){return new Promise(function(_0x166b2f,_0x294fb5){var _0x12e192=squel[_0x70c9('0xf')]()[_0x70c9('0x37')]([_0x70c9('0x5d'),_0x70c9('0x5e')])[_0x70c9('0x12')](_0x70c9('0x5f'))[_0x70c9('0x17')]('campaigns_has_cm_lists',null,_0x70c9('0x60'))['where'](_0x70c9('0x61')+_0x1d7a22);db[_0x70c9('0x59')][_0x70c9('0x62')](_0x12e192['toString']())[_0x70c9('0x5a')](function(_0x55fe53){var _0x5d6c52=[];for(var _0x54186e=0x0;_0x54186e<_0x55fe53['length'];_0x54186e++){_0x5d6c52[_0x70c9('0x1c')](getTimezoneData(_0x55fe53[_0x54186e],tmp_campaigns));}BPromise['all'](_0x5d6c52)[_0x70c9('0x1e')](function(){_0x166b2f({'val':0x1});});})[_0x70c9('0x5b')](function(_0x3e1c30){logger[_0x70c9('0x5c')](_0x3e1c30[_0x70c9('0x57')]);_0x166b2f({'val':0x0});});});}function updateTzVoiceQueues(_0x5d208f){return new Promise(function(_0x501949,_0x1157cc){var _0x3392e6=squel[_0x70c9('0xf')]()[_0x70c9('0x37')]([_0x70c9('0x63'),_0x70c9('0x64')])[_0x70c9('0x12')]('voice_queues')[_0x70c9('0x17')](_0x70c9('0x65'),null,_0x70c9('0x66'))[_0x70c9('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x5d208f);db[_0x70c9('0x59')][_0x70c9('0x62')](_0x3392e6[_0x70c9('0x40')]())['spread'](function(_0x27997f){var _0x24609f=[];for(var _0x4935fb=0x0;_0x4935fb<_0x27997f[_0x70c9('0x1b')];_0x4935fb++){_0x24609f['push'](getTimezoneData(_0x27997f[_0x4935fb],tmp_voice_queues));}BPromise['all'](_0x24609f)[_0x70c9('0x1e')](function(){_0x501949({'val':0x1});});})[_0x70c9('0x5b')](function(_0x2cfce8){logger[_0x70c9('0x5c')](_0x2cfce8[_0x70c9('0x57')]);_0x501949({'val':0x0});});});}function getTimezoneData(_0x5b5837,_0x177b24){return new Promise(function(_0x58600c,_0x597675){var _0xe916b3=shared[_0x70c9('0x67')];var _0x40dc17=_0xe916b3[_0x5b5837['dialTimezone']];if(_[_0x70c9('0x20')](_0x40dc17)){_0x58600c({'ret':0x1});}else{var _0x5da39d=_0x40dc17[_0x70c9('0x68')];var _0x3d8f9e=squel[_0x70c9('0x2d')]()['into'](_0x177b24)[_0x70c9('0x69')]('id',_0x5b5837['id'])[_0x70c9('0x69')](_0x70c9('0x6a'),_0x5da39d)[_0x70c9('0x69')](_0x70c9('0x6b'),_0x5b5837[_0x70c9('0x6b')])[_0x70c9('0x40')]();return db['sequelize'][_0x70c9('0x62')](_0x3d8f9e)[_0x70c9('0x5a')](function(_0x12dec0){_0x58600c({'ret':0x1});})[_0x70c9('0x5b')](function(_0x1443a8){logger[_0x70c9('0x5c')](_0x1443a8[_0x70c9('0x57')]);_0x597675({'ret':0x1});});}});}function handleTZQuery(_0x1003ea){logger['info'](_0x1003ea);return db[_0x70c9('0x59')][_0x70c9('0x62')](_0x1003ea)[_0x70c9('0x5a')](function(_0x1357a4){})[_0x70c9('0x5b')](function(_0x16c7de){logger[_0x70c9('0x5c')](_0x16c7de[_0x70c9('0x57')]);});}function main(_0x360df2,_0x4517b7,_0x31d793,_0x4a0162){logger['info'](_0x70c9('0x6c'),_0x360df2,JSON[_0x70c9('0x6d')](_0x4517b7));process['send'](_0x70c9('0x6e'));var _0x43e2f4=_0x4517b7[_0x70c9('0x6f')];var _0x156478=_[_0x70c9('0x70')](_0x43e2f4);var _0x1f4b81=_0x4517b7[_0x70c9('0x71')];var _0xcbdae6=path['join'](config['root'],_0x70c9('0x72'),_0x1f4b81+_0x70c9('0x73'));hasTZ=_['keys'](_0x43e2f4)[_0x70c9('0x74')](_0x70c9('0x6b'));var _0x3b109b=_[_0x70c9('0x75')](_0x43e2f4)['join']();logger[_0x70c9('0x55')](_0x70c9('0x76'),_0x3b109b);db[_0x70c9('0x77')][_0x70c9('0x19')]({'raw':!![],'attributes':['id',_0x70c9('0x78')]})[_0x70c9('0x1e')](function(_0x35120d){for(var _0x4c820c=0x0;_0x4c820c<_0x35120d[_0x70c9('0x1b')];_0x4c820c++){if(_0x35120d[_0x4c820c][_0x70c9('0x78')]in _0x43e2f4){contactItemTypes[_0x70c9('0x1c')](_0x35120d[_0x4c820c]);delete _0x156478[_0x35120d[_0x4c820c][_0x70c9('0x78')]];hasAdditionalPhones=!![];}for(var _0x47b08d in _0x43e2f4){if(_0x35120d[_0x4c820c][_0x70c9('0x78')]+_0x70c9('0x79')===_0x47b08d){phoneDescriptions[_0x70c9('0x1c')]({'itemTypeId':_0x35120d[_0x4c820c]['id'],'description':_0x47b08d});delete _0x156478[_0x47b08d];}}}if(hasAdditionalPhones)_0x156478['AdditionalPhones']='';var _0x55deb3=_[_0x70c9('0x75')](_0x156478)[_0x70c9('0x17')]();logger[_0x70c9('0x55')](_0x70c9('0x76'),_0x55deb3);fs[_0x70c9('0x7a')](_0xcbdae6,_0x55deb3+'\x0a');Papa[_0x70c9('0x7b')](fs['createReadStream'](_0x360df2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3fa285,_0x2f9876){try{for(var _0x101811=0x0,_0x3be468=[];_0x101811<_0x3fa285[_0x70c9('0x7c')][_0x70c9('0x1b')];_0x101811++){stats[_0x70c9('0x7d')]+=0x1;if(_0x3fa285[_0x70c9('0x7e')][_0x101811]){handleError(_0x3fa285[_0x70c9('0x7c')][_0x101811],_0x3fa285[_0x70c9('0x7e')][_0x101811]);}else{var _0x4245ac=[];var _0x3f0738=[];var _0x2957f1={};for(var _0x2cca68 in _0x43e2f4){let _0x1a4f88=contactItemTypes['find'](_0x5747ac=>_0x5747ac[_0x70c9('0x78')]===_0x2cca68);let _0xe95d6a=contactItemTypes[_0x70c9('0x7f')](_0x2bf06d=>_0x2bf06d[_0x70c9('0x78')]+_0x70c9('0x79')===_0x2cca68);if(_[_0x70c9('0x20')](_0x1a4f88)&&_['isNil'](_0xe95d6a)){if(_0x43e2f4[_0x70c9('0x80')](_0x2cca68)){if(_0x3fa285[_0x70c9('0x7c')][_0x101811][_0x43e2f4[_0x2cca68]]){var _0x46661c=_['trim'](_0x3fa285[_0x70c9('0x7c')][_0x101811][_0x43e2f4[_0x2cca68]][_0x70c9('0x81')](/"/g,'\x27'));switch(_0x2cca68){case'scheduledat':var _0x351125=moment(_0x46661c,_0x70c9('0xd'),!![]);if(_0x351125[_0x70c9('0x82')]()){_0x3be468['push']('\x22'+_0x46661c+'\x22');}else{_0x4245ac[_0x70c9('0x1c')](_0x70c9('0x83'));}break;case _0x70c9('0x84'):var _0x22aabd=parseInt(_0x46661c);_0x46661c=_['isNaN'](_0x22aabd)||_0x22aabd<0x0||_0x22aabd>0x4?_0x4a0162?0x3:0x2:_0x22aabd;_0x3be468[_0x70c9('0x1c')]('\x22'+_0x46661c+'\x22');break;case _0x70c9('0x35'):var _0x7b1b0b=parseInt(_0x46661c);if(_['isNumber'](_0x7b1b0b)&&_['includes'](_0x31d793,_0x7b1b0b)){_0x3be468[_0x70c9('0x1c')]('\x22'+_0x7b1b0b+'\x22');}else{_0x4245ac['push'](_0x70c9('0x85'));}break;case _0x70c9('0x86'):if(isEmail(_0x46661c)){_0x3be468[_0x70c9('0x1c')]('\x22'+_0x46661c+'\x22');}else{_0x4245ac[_0x70c9('0x1c')](_0x70c9('0x87'));}break;case _0x70c9('0x88'):var _0x5764b4=moment(_0x46661c,_0x70c9('0x89'),!![]);if(_0x5764b4[_0x70c9('0x82')]()){_0x3be468['push']('\x22'+_0x46661c+'\x22');}else{_0x4245ac['push'](_0x70c9('0x8a'));}break;case _0x70c9('0x6b'):var _0x42275f=shared[_0x70c9('0x67')];var _0x115e7a=_0x42275f[_0x46661c];if(!_[_0x70c9('0x20')](_0x115e7a)){var _0x59ddc6=_0x115e7a['utcOffset'];_0x3be468[_0x70c9('0x1c')]('\x22'+_0x46661c+'\x22');_0x3be468[_0x70c9('0x1c')]('\x22'+_0x59ddc6+'\x22');}break;default:_0x3be468['push']('\x22'+_0x46661c+'\x22');}}else{switch(_0x2cca68){case'firstName':case _0x70c9('0x11'):_0x4245ac[_0x70c9('0x1c')](_0x2cca68+_0x70c9('0x8b'));break;default:_0x3be468[_0x70c9('0x1c')]('\x22\x22');}}}}else{var _0x79d1b7='';if(!_[_0x70c9('0x20')](_0x1a4f88)){if(!_0x2957f1['hasOwnProperty'](_0x1a4f88['id'])){if(!_['isNil'](_0x3fa285[_0x70c9('0x7c')][_0x101811][_0x43e2f4[_0x2cca68]])){var _0x46661c=_['trim'](_0x3fa285[_0x70c9('0x7c')][_0x101811][_0x43e2f4[_0x2cca68]]['replace'](/"/g,'\x27'));var _0x2dd6be=phoneDescriptions[_0x70c9('0x7f')](_0x3bd115=>_0x3bd115[_0x70c9('0x8c')]===_0x1a4f88['id']);if(!_[_0x70c9('0x20')](_0x2dd6be)){var _0x26beec=_[_0x70c9('0x8d')](_0x3fa285['data'][_0x101811][_0x43e2f4[_0x2dd6be[_0x70c9('0x8e')]]]['replace'](/"/g,'\x27'));if(!_[_0x70c9('0x20')](_0x26beec))_0x46661c=_0x46661c+'§'+_0x26beec;}if(_0x79d1b7=='')_0x79d1b7=_0x46661c;else _0x79d1b7+='|'+_0x46661c;}_0x3f0738[_0x70c9('0x1c')](_0x1a4f88['id']+':'+_0x79d1b7);_0x2957f1[_0x1a4f88['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3be468[_0x70c9('0x1c')]('\x22'+_0x3f0738[_0x70c9('0x17')](';')+'\x22');}if(_0x4245ac['length']){handleError(_0x3fa285[_0x70c9('0x7c')][_0x101811],{'code':_0x70c9('0x8f'),'message':_0x4245ac[_0x70c9('0x17')]()});}else{fs[_0x70c9('0x90')](_0xcbdae6,_0x3be468['join']()+'\x0a');}_0x3be468=[];}if(!(stats[_0x70c9('0x7d')]%0xc8)){socket[_0x70c9('0x91')](_0x70c9('0x92')+_0x1f4b81,stats);stats[_0x70c9('0x7e')]=[];}}if(stopped){logger[_0x70c9('0x55')](_0x70c9('0x93'));_0x2f9876['abort']();}}catch(_0x42ce3e){handleError(_0x3fa285[_0x70c9('0x7c')][_0x101811],{'code':'SystemError','message':_0x42ce3e[_0x70c9('0x57')]});logger[_0x70c9('0x5c')](_0x70c9('0x94'),_0x42ce3e[_0x70c9('0x57')]);}},'complete':function(){try{var _0x5dc119=[];var _0x13f288=[];var _0x1842bd=_0x70c9('0x38');if(_0x4517b7[_0x70c9('0x95')]&&_0x4517b7[_0x70c9('0x95')][_0x70c9('0x1b')]){_0x1842bd=_0x70c9('0x96')+_0x1f4b81;_0x5dc119[_0x70c9('0x1c')](_0x70c9('0x97')+_0x1842bd+_0x70c9('0x98'));}tmp_campaigns=_0x70c9('0x99')+_0x1f4b81;tmp_voice_queues='voice_queues_'+_0x1f4b81;_0x13f288['push'](_0x70c9('0x97')+tmp_campaigns+_0x70c9('0x9a'));_0x13f288['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x70c9('0x9a'));BPromise['each'](_0x13f288,handleTZQuery)['then'](function(_0x2f2124){updateTzCampaigns(_0x4517b7[_0x70c9('0x33')])[_0x70c9('0x1e')](function(_0x63b63){updateTzVoiceQueues(_0x4517b7['ListId'])['then'](function(_0x239da8){if(hasTZ)_0x55deb3=_0x55deb3[_0x70c9('0x81')](_0x70c9('0x6b'),_0x70c9('0x9b'));var _0x2e2db2=util[_0x70c9('0xe')](_0x70c9('0x9c'),_0xcbdae6,_0x1842bd,_0x55deb3,_0x4517b7[_0x70c9('0x33')],_0x4517b7[_0x70c9('0x50')]||null,NOW,NOW);if(_[_0x70c9('0x20')](_0x43e2f4[_0x70c9('0x31')])){_0x2e2db2+=_0x70c9('0x9d');}_0x5dc119[_0x70c9('0x1c')](_0x2e2db2);if(_0x4517b7['duplicates']&&_0x4517b7[_0x70c9('0x95')][_0x70c9('0x1b')]){_0x5dc119[_0x70c9('0x1c')](insertCmContact(_0x4517b7[_0x70c9('0x33')],_0x1842bd,_0x4517b7[_0x70c9('0x95')],_0x43e2f4));_0x5dc119[_0x70c9('0x1c')](_0x70c9('0x9e')+_0x1842bd+';');}BPromise[_0x70c9('0x9f')](_0x5dc119,handleQuery)[_0x70c9('0x1e')](function(_0x558890){BPromise[_0x70c9('0x1d')]([handleAdditionalPhones()])[_0x70c9('0x1e')](function(){_0x5dc119=[];for(var _0x6d8c67=0x0;_0x6d8c67\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.ListId','into','cm_hopper_black','.CmListId\x20=\x20?','select','ListId\x20=\x20?','UserId','recallme','toString','cm_hopper.id','cm_contact_has_items.item','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','exit','errors','code','message','info','query','spread','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','utcOffset','set','offset','dialTimezone','main','stringify','binding','clone','socket_timestamp','root','server/files/tmp','includes','header','name','writeFileSync','parse','createReadStream','data','rows','find','_description','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20'];(function(_0x3777c4,_0x5dc039){var _0x20551e=function(_0x375f76){while(--_0x375f76){_0x3777c4['push'](_0x3777c4['shift']());}};_0x20551e(++_0x5dc039);}(_0xef0d,0xdc));var _0xdef0=function(_0x51719f,_0x4d569a){_0x51719f=_0x51719f-0x0;var _0x57f06c=_0xef0d[_0x51719f];return _0x57f06c;};'use strict';var fs=require('fs');var path=require(_0xdef0('0x0'));var _=require('lodash');var Papa=require(_0xdef0('0x1'));var util=require(_0xdef0('0x2'));var BPromise=require(_0xdef0('0x3'));var moment=require(_0xdef0('0x4'));var squel=require(_0xdef0('0x5'));var Redis=require(_0xdef0('0x6'));var db=require(_0xdef0('0x7'))['db'];var config=require(_0xdef0('0x8'));var shared=require(_0xdef0('0x9'));var logger=require('../../../config/logger')(_0xdef0('0xa'));config[_0xdef0('0xb')]=_[_0xdef0('0xc')](config[_0xdef0('0xb')],{'host':_0xdef0('0xd'),'port':0x18eb});var socket=require(_0xdef0('0xe'))(new Redis(config[_0xdef0('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xdef0('0xf')]('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()[_0xdef0('0xf')](_0xdef0('0x10'));function isEmail(_0x2c2f6f){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))*$/[_0xdef0('0x11')](_0x2c2f6f);}function selectNotIn(_0x1b9e5c,_0x575b9d,_0x599428,_0x372e2c,_0x465d7f){return squel['select']()[_0xdef0('0x12')](_0xdef0('0x13'))[_0xdef0('0x14')](_0x372e2c)['join'](_0x575b9d,null,_0x575b9d+_0xdef0('0x15')+_0x372e2c+'.'+_0x599428)[_0xdef0('0x16')](_0x372e2c+'.'+_0x599428+_0xdef0('0x17')+_0x1b9e5c+'.'+_0x599428)[_0xdef0('0x16')](_0x575b9d+_0xdef0('0x18')+_0x465d7f[_0xdef0('0x19')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2bbcea,_0x4f9ac6){promisesAdditionalPhones=[];return db[_0xdef0('0x1a')][_0xdef0('0x1b')]({'raw':!![],'attributes':['id',_0xdef0('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xdef0('0x1d')](function(_0x102fc9){if(_0x102fc9!==null){var _0x57e395=[];for(var _0x5dc89e=0x0;_0x5dc89e<_0x102fc9[_0xdef0('0x1e')];_0x5dc89e++){var _0x5b4ddb=_0x102fc9[_0x5dc89e];_0x57e395[_0xdef0('0x1f')](insertAdditionalPhones(_0x5b4ddb));}}Promise[_0xdef0('0x20')](_0x57e395)[_0xdef0('0x1d')](function(){_0x2bbcea({'val':0x1});});});});}function insertAdditionalPhones(_0x1ea829){return new Promise(function(_0x5961fa,_0x31faf7){var _0x591ade=_0x1ea829['AdditionalPhones'];var _0x2d75d2=_0x591ade[_0xdef0('0x21')](';');var _0x3239af=[];orderBy=0x0;for(var _0x129881=0x0;_0x129881<_0x2d75d2['length'];_0x129881++){_0x3239af['push'](splitAdditionalPhone(_0x1ea829['id'],_0x2d75d2[_0x129881]));}Promise[_0xdef0('0x20')](_0x3239af)[_0xdef0('0x1d')](function(){_0x5961fa({'val':_0x2d75d2[_0xdef0('0x1e')]});});});}function splitAdditionalPhone(_0xebadf,_0x1f63aa){return new Promise(function(_0x55a915,_0x493405){var _0x207c66=_0x1f63aa[_0xdef0('0x21')](':');var _0x13f211=_0x207c66[0x0];var _0x5c0258=_0x207c66[0x1];if(!_[_0xdef0('0x22')](_0x5c0258)){var _0x4bde65=_0x5c0258[_0xdef0('0x21')]('|');var _0x2797d6=[];for(var _0x5c0af8=0x0;_0x5c0af8<_0x4bde65[_0xdef0('0x1e')];_0x5c0af8++){if(_0x4bde65[_0x5c0af8]!==''){var _0x2aec17=_[_0xdef0('0x23')](promisesAdditionalPhones,{'contactId':_0xebadf,'phone':_0x4bde65[_0x5c0af8]});if(_0x2aec17['length']==0x0){orderBy++;promisesAdditionalPhones[_0xdef0('0x1f')]({'contactId':_0xebadf,'contactTypeId':_0x13f211,'phone':_0x4bde65[_0x5c0af8],'orderBy':orderBy});}}}_0x55a915({'ok':0x1});}else _0x55a915({'res':0x0});});}function createAdditionalPhone(_0x56d8d4,_0x30d1cf,_0x5b4cd3,_0xbea465){var _0xe7139f='';var _0x39bf0e='';var _0x4a9bfc=_0x5b4cd3['split']('§');_0xe7139f=_0x4a9bfc[0x0];if(_0x4a9bfc[_0xdef0('0x1e')]==0x2)_0x39bf0e=_0x4a9bfc[0x1];return new Promise(function(_0x4a883f,_0x396507){return db[_0xdef0('0x24')][_0xdef0('0x25')]({'where':{'CmContactId':_0x56d8d4,'item':_0xe7139f}})[_0xdef0('0x1d')](function(_0x19bf8b){if(_0x19bf8b){return db[_0xdef0('0x24')][_0xdef0('0x26')]({'ItemTypeId':_0x30d1cf,'description':_0x39bf0e,'OrderBy':_0xbea465},{'where':{'CmContactId':_0x56d8d4,'item':_0xe7139f}})[_0xdef0('0x1d')](function(_0x1b51c3){_0x4a883f({'res':_0xdef0('0x27')});});}else{return db[_0xdef0('0x24')][_0xdef0('0x28')]({'CmContactId':_0x56d8d4,'item':_0xe7139f,'description':_0x39bf0e,'ItemTypeId':_0x30d1cf,'OrderBy':_0xbea465,'ItemClass':_0xdef0('0x29')})[_0xdef0('0x1d')](function(_0x1cd2b6){_0x4a883f({'res':_0xdef0('0x2a')});});}});});}function insertCmHopper(_0xcec0b,_0xff86d1,_0x4e146a,_0x116a50,_0x36c5f0){var _0x17e42c=[_0xdef0('0x2b'),_0xdef0('0x2c'),_0xdef0('0x2d'),'cm_contacts.ListId',_0xff86d1+'.'+_0x116a50,_0xdef0('0x2e'),_0xdef0('0x2f'),_0xdef0('0x30'),'cm_contacts.UserId','\x22'+_0x36c5f0+'\x22'];return squel[_0xdef0('0x31')]()['into'](_0xdef0('0x32'))[_0xdef0('0x33')]([_0xdef0('0x13'),_0xdef0('0x34'),_0xdef0('0x35'),_0xdef0('0x36'),_0x116a50,_0xdef0('0x37'),_0xdef0('0x38'),_0xdef0('0x39'),'UserId','recallme'],squel['select']()[_0xdef0('0x3a')](_0x17e42c)[_0xdef0('0x14')](_0xff86d1)['join'](_0xdef0('0x3b'),null,_0xdef0('0x3c')+_0xff86d1+_0xdef0('0x3d'))[_0xdef0('0x19')](_0x4e146a,null,_0x4e146a+_0xdef0('0x15')+_0xff86d1+'.'+_0x116a50)['where'](_0xff86d1+'.CmListId\x20=\x20?',_0xcec0b)[_0xdef0('0x16')](_0xdef0('0x3e'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xff86d1,_0x4e146a,_0x116a50,_0xdef0('0x32'),['\x22always\x22',_0xdef0('0x3f')]))[_0xdef0('0x16')](_0xdef0('0x40'),selectNotIn(_0xff86d1,_0x4e146a,_0x116a50,_0xdef0('0x32'),[_0xdef0('0x41')])))['toString']();}function insertCmHopperBlack(_0xb1d84,_0x5a87fb,_0x56f5d4,_0xc8771a){var _0x2d4a42=['cm_contacts.phone',_0xdef0('0x2d'),_0xdef0('0x42'),_0x5a87fb+'.'+_0xc8771a,'cm_contacts.createdAt',_0xdef0('0x2f')];return squel[_0xdef0('0x31')]()[_0xdef0('0x43')](_0xdef0('0x44'))[_0xdef0('0x33')]([_0xdef0('0x13'),'ContactId',_0xdef0('0x36'),_0xc8771a,_0xdef0('0x37'),'updatedAt'],squel['select']()[_0xdef0('0x3a')](_0x2d4a42)[_0xdef0('0x14')](_0x5a87fb)[_0xdef0('0x19')]('cm_contacts',null,_0xdef0('0x3c')+_0x5a87fb+_0xdef0('0x3d'))[_0xdef0('0x19')](_0x56f5d4,null,_0x56f5d4+_0xdef0('0x15')+_0x5a87fb+'.'+_0xc8771a)['where'](_0x5a87fb+_0xdef0('0x45'),_0xb1d84)[_0xdef0('0x16')](_0xdef0('0x3e'),NOW)['where'](_0xdef0('0x40'),squel[_0xdef0('0x46')]()['field'](_0xdef0('0x13'))[_0xdef0('0x14')](_0xdef0('0x44'))['where'](_0xdef0('0x47'),_0xb1d84)[_0xdef0('0x16')](_0xc8771a+_0xdef0('0x17')+_0x5a87fb+'.'+_0xc8771a)))['toString']();}function insertTzCmHopper(_0x1b9957,_0x22b390,_0x3f3cff,_0x269443,_0x2a548f,_0xdd258d){var _0x354678=[_0xdef0('0x2b'),'date_add(cm_contacts.scheduledat,interval\x20'+_0xdd258d+'.offset-cm_contacts.utcOffset\x20minute)',_0xdef0('0x2d'),_0xdef0('0x42'),_0x22b390+'.'+_0x269443,_0xdef0('0x2e'),'cm_contacts.updatedAt',_0xdef0('0x30'),'cm_contacts.UserId','\x22'+_0x2a548f+'\x22'];var _0x252799=squel[_0xdef0('0x31')]()[_0xdef0('0x43')](_0xdef0('0x32'))[_0xdef0('0x33')]([_0xdef0('0x13'),'scheduledat',_0xdef0('0x35'),'ListId',_0x269443,'createdAt',_0xdef0('0x38'),_0xdef0('0x39'),_0xdef0('0x48'),_0xdef0('0x49')],squel[_0xdef0('0x46')]()[_0xdef0('0x3a')](_0x354678)['from'](_0x22b390)[_0xdef0('0x19')](_0xdef0('0x3b'),null,_0xdef0('0x3c')+_0x22b390+_0xdef0('0x3d'))[_0xdef0('0x19')](_0x3f3cff,null,_0x3f3cff+'.id\x20=\x20'+_0x22b390+'.'+_0x269443)[_0xdef0('0x19')](_0xdd258d,null,_0xdd258d+_0xdef0('0x15')+_0x22b390+'.'+_0x269443)[_0xdef0('0x16')](_0x22b390+_0xdef0('0x45'),_0x1b9957)[_0xdef0('0x16')](_0xdef0('0x3e'),NOW)[_0xdef0('0x16')](_0xdef0('0x40'),selectNotIn(_0x22b390,_0x3f3cff,_0x269443,_0xdef0('0x32'),[_0xdef0('0x41'),_0xdef0('0x3f')]))['where'](_0xdef0('0x40'),selectNotIn(_0x22b390,_0x3f3cff,_0x269443,_0xdef0('0x32'),[_0xdef0('0x41')])))[_0xdef0('0x4a')]();return _0x252799;}function insertTzCmHopperBlack(_0x311f0a,_0x4a835c,_0x371a8c,_0x1e30cd){var _0x37c7c4=[_0xdef0('0x2b'),_0xdef0('0x2d'),'cm_contacts.ListId',_0x4a835c+'.'+_0x1e30cd,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xdef0('0x31')]()[_0xdef0('0x43')](_0xdef0('0x44'))['fromQuery']([_0xdef0('0x13'),'ContactId','ListId',_0x1e30cd,_0xdef0('0x37'),'updatedAt'],squel['select']()[_0xdef0('0x3a')](_0x37c7c4)[_0xdef0('0x14')](_0x4a835c)[_0xdef0('0x19')](_0xdef0('0x3b'),null,_0xdef0('0x3c')+_0x4a835c+_0xdef0('0x3d'))['join'](_0x371a8c,null,_0x371a8c+'.id\x20=\x20'+_0x4a835c+'.'+_0x1e30cd)[_0xdef0('0x16')](_0x4a835c+_0xdef0('0x45'),_0x311f0a)['where'](_0xdef0('0x3e'),NOW)[_0xdef0('0x16')](_0xdef0('0x40'),squel[_0xdef0('0x46')]()['field'](_0xdef0('0x13'))['from'](_0xdef0('0x44'))['where'](_0xdef0('0x47'),_0x311f0a)[_0xdef0('0x16')](_0x1e30cd+_0xdef0('0x17')+_0x4a835c+'.'+_0x1e30cd)))[_0xdef0('0x4a')]();}function insertCmHopperAdditionalPhones(_0x1b7f1d){var _0x553caa=[_0xdef0('0x4b'),_0xdef0('0x4c'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xdef0('0x31')]()[_0xdef0('0x43')](_0xdef0('0x4d'))[_0xdef0('0x33')]([_0xdef0('0x4e'),_0xdef0('0x13'),_0xdef0('0x4f'),_0xdef0('0x37'),'updatedAt'],squel['select']()[_0xdef0('0x3a')](_0x553caa)[_0xdef0('0x14')]('cm_hopper')[_0xdef0('0x19')](_0xdef0('0x3b'),null,_0xdef0('0x50'))[_0xdef0('0x19')](_0xdef0('0x51'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xdef0('0x16')](_0xdef0('0x52'),_0x1b7f1d)[_0xdef0('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xdef0('0x4a')]();}function insertCmContact(_0x226339,_0x3531ec,_0x48d53a,_0x1b1069){var _0xa25d73=_[_0xdef0('0x53')](_[_0xdef0('0x54')](_0x1b1069),[_0xdef0('0x36'),'CompanyId',_0xdef0('0x37'),_0xdef0('0x38')]);return squel[_0xdef0('0x31')]()['into'](_0xdef0('0x3b'))['fromQuery'](_0xa25d73,squel['select']()[_0xdef0('0x3a')](_0xa25d73)[_0xdef0('0x14')](_0x3531ec)['where']('('+_0x48d53a['join'](',')+_0xdef0('0x55'),squel[_0xdef0('0x46')]()[_0xdef0('0x3a')](_0x48d53a)['from'](_0xdef0('0x3b'))[_0xdef0('0x16')](_0xdef0('0x47'),_0x226339)[_0xdef0('0x16')](_0xdef0('0x56')))[_0xdef0('0x16')](_0xdef0('0x57'),squel[_0xdef0('0x46')]()[_0xdef0('0x12')](_0xdef0('0x58'),_0xdef0('0x59'))[_0xdef0('0x14')](_0x3531ec)[_0xdef0('0x5a')](_0x48d53a[_0xdef0('0x19')](','))))[_0xdef0('0x4a')]();}function handleStop(){logger['info'](_0xdef0('0x5b'));stopped=!![];}function handleUncaughtException(_0x184494){logger[_0xdef0('0x5c')](_0x184494['message']);process[_0xdef0('0x5d')](0x1);}function handleError(_0x392fc4,_0x3df596){stats[_0xdef0('0x5e')][_0xdef0('0x1f')]({'name':_0x3df596[_0xdef0('0x5f')],'message':_0x3df596[_0xdef0('0x60')],'row':_0x392fc4});}function handleQuery(_0x547e16){logger[_0xdef0('0x61')](_0x547e16);return db['sequelize'][_0xdef0('0x62')](_0x547e16)[_0xdef0('0x63')](function(_0xd04e5f){results[_0xdef0('0x1f')](_0xd04e5f);})[_0xdef0('0x64')](function(_0x3ebb8c){logger['error'](_0x3ebb8c['message']);});}function updateTzCampaigns(_0x21a93d){return new Promise(function(_0x37e81c,_0x50d2ed){var _0x26d1e2=squel[_0xdef0('0x46')]()['fields']([_0xdef0('0x65'),'campaigns.dialTimezone'])[_0xdef0('0x14')](_0xdef0('0x66'))[_0xdef0('0x19')]('campaigns_has_cm_lists',null,_0xdef0('0x67'))['where'](_0xdef0('0x68')+_0x21a93d);db[_0xdef0('0x69')][_0xdef0('0x62')](_0x26d1e2[_0xdef0('0x4a')]())['spread'](function(_0xfa0f38){var _0x114952=[];for(var _0x44fe60=0x0;_0x44fe60<_0xfa0f38[_0xdef0('0x1e')];_0x44fe60++){_0x114952[_0xdef0('0x1f')](getTimezoneData(_0xfa0f38[_0x44fe60],tmp_campaigns));}BPromise[_0xdef0('0x20')](_0x114952)[_0xdef0('0x1d')](function(){_0x37e81c({'val':0x1});});})['catch'](function(_0xe56551){logger[_0xdef0('0x5c')](_0xe56551[_0xdef0('0x60')]);_0x37e81c({'val':0x0});});});}function updateTzVoiceQueues(_0x331be1){return new Promise(function(_0x46272d,_0x524a00){var _0x26ab79=squel[_0xdef0('0x46')]()[_0xdef0('0x3a')](['voice_queues.id',_0xdef0('0x6a')])['from'](_0xdef0('0x6b'))[_0xdef0('0x19')](_0xdef0('0x6c'),null,_0xdef0('0x6d'))[_0xdef0('0x16')]('voice_queues_has_cm_lists.CmListId='+_0x331be1);db[_0xdef0('0x69')][_0xdef0('0x62')](_0x26ab79['toString']())[_0xdef0('0x63')](function(_0x14ccb8){var _0x54a0f9=[];for(var _0x41a7bb=0x0;_0x41a7bb<_0x14ccb8[_0xdef0('0x1e')];_0x41a7bb++){_0x54a0f9[_0xdef0('0x1f')](getTimezoneData(_0x14ccb8[_0x41a7bb],tmp_voice_queues));}BPromise['all'](_0x54a0f9)[_0xdef0('0x1d')](function(){_0x46272d({'val':0x1});});})[_0xdef0('0x64')](function(_0x6fccc2){logger[_0xdef0('0x5c')](_0x6fccc2[_0xdef0('0x60')]);_0x46272d({'val':0x0});});});}function getTimezoneData(_0xdca77a,_0x2e7f6e){return new Promise(function(_0x568a61,_0x206766){var _0x5a8b6f=shared[_0xdef0('0x6e')];var _0x348e10=_0x5a8b6f[_0xdca77a['dialTimezone']];if(_[_0xdef0('0x22')](_0x348e10)){_0x568a61({'ret':0x1});}else{var _0x48757a=_0x348e10[_0xdef0('0x6f')];var _0x279012=squel['insert']()[_0xdef0('0x43')](_0x2e7f6e)[_0xdef0('0x70')]('id',_0xdca77a['id'])[_0xdef0('0x70')](_0xdef0('0x71'),_0x48757a)['set'](_0xdef0('0x72'),_0xdca77a[_0xdef0('0x72')])[_0xdef0('0x4a')]();return db[_0xdef0('0x69')][_0xdef0('0x62')](_0x279012)['spread'](function(_0x1b0948){_0x568a61({'ret':0x1});})[_0xdef0('0x64')](function(_0x55f931){logger[_0xdef0('0x5c')](_0x55f931[_0xdef0('0x60')]);_0x206766({'ret':0x1});});}});}function handleTZQuery(_0x5aa3bb){logger[_0xdef0('0x61')](_0x5aa3bb);return db[_0xdef0('0x69')][_0xdef0('0x62')](_0x5aa3bb)[_0xdef0('0x63')](function(_0x1a1318){})[_0xdef0('0x64')](function(_0x40a48f){logger[_0xdef0('0x5c')](_0x40a48f['message']);});}function main(_0x19a9c6,_0x2040a7,_0x1f6c3c,_0x50dacd){logger['info'](_0xdef0('0x73'),_0x19a9c6,JSON[_0xdef0('0x74')](_0x2040a7));process['send']('start');var _0x22a707=_0x2040a7[_0xdef0('0x75')];var _0x5d935a=_[_0xdef0('0x76')](_0x22a707);var _0x1e1717=_0x2040a7[_0xdef0('0x77')];var _0x4dfbe7=path[_0xdef0('0x19')](config[_0xdef0('0x78')],_0xdef0('0x79'),_0x1e1717+'.csv');hasTZ=_[_0xdef0('0x54')](_0x22a707)[_0xdef0('0x7a')](_0xdef0('0x72'));var _0x291517=_['keys'](_0x22a707)['join']();logger['info'](_0xdef0('0x7b'),_0x291517);db['ContactItemType'][_0xdef0('0x1b')]({'raw':!![],'attributes':['id',_0xdef0('0x7c')]})[_0xdef0('0x1d')](function(_0x1ab295){for(var _0x1be039=0x0;_0x1be039<_0x1ab295[_0xdef0('0x1e')];_0x1be039++){if(_0x1ab295[_0x1be039][_0xdef0('0x7c')]in _0x22a707){contactItemTypes[_0xdef0('0x1f')](_0x1ab295[_0x1be039]);delete _0x5d935a[_0x1ab295[_0x1be039][_0xdef0('0x7c')]];hasAdditionalPhones=!![];}for(var _0x667fcc in _0x22a707){if(_0x1ab295[_0x1be039][_0xdef0('0x7c')]+'_description'===_0x667fcc){phoneDescriptions[_0xdef0('0x1f')]({'itemTypeId':_0x1ab295[_0x1be039]['id'],'description':_0x667fcc});delete _0x5d935a[_0x667fcc];}}}if(hasAdditionalPhones)_0x5d935a[_0xdef0('0x1c')]='';var _0x59a19e=_['keys'](_0x5d935a)[_0xdef0('0x19')]();logger['info']('header',_0x59a19e);fs[_0xdef0('0x7d')](_0x4dfbe7,_0x59a19e+'\x0a');Papa[_0xdef0('0x7e')](fs[_0xdef0('0x7f')](_0x19a9c6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x350f04,_0x59e42f){try{for(var _0x164f23=0x0,_0xded944=[];_0x164f23<_0x350f04[_0xdef0('0x80')][_0xdef0('0x1e')];_0x164f23++){stats[_0xdef0('0x81')]+=0x1;if(_0x350f04['errors'][_0x164f23]){handleError(_0x350f04[_0xdef0('0x80')][_0x164f23],_0x350f04['errors'][_0x164f23]);}else{var _0x2a49c8=[];var _0x10e81c=[];var _0x171a36={};for(var _0x4e3e69 in _0x22a707){let _0x493a66=contactItemTypes[_0xdef0('0x82')](_0x11a2f6=>_0x11a2f6[_0xdef0('0x7c')]===_0x4e3e69);let _0x265c19=contactItemTypes[_0xdef0('0x82')](_0x47ca0c=>_0x47ca0c[_0xdef0('0x7c')]+_0xdef0('0x83')===_0x4e3e69);if(_[_0xdef0('0x22')](_0x493a66)&&_[_0xdef0('0x22')](_0x265c19)){if(_0x22a707['hasOwnProperty'](_0x4e3e69)){if(_0x350f04[_0xdef0('0x80')][_0x164f23][_0x22a707[_0x4e3e69]]){var _0x3b498a=_['trim'](_0x350f04[_0xdef0('0x80')][_0x164f23][_0x22a707[_0x4e3e69]][_0xdef0('0x84')](/"/g,'\x27'));switch(_0x4e3e69){case'scheduledat':var _0x41858f=moment(_0x3b498a,_0xdef0('0x10'),!![]);if(_0x41858f[_0xdef0('0x85')]()){_0xded944[_0xdef0('0x1f')]('\x22'+_0x3b498a+'\x22');}else{_0x2a49c8[_0xdef0('0x1f')](_0xdef0('0x86'));}break;case _0xdef0('0x39'):var _0x161c5f=parseInt(_0x3b498a);_0x3b498a=_[_0xdef0('0x87')](_0x161c5f)||_0x161c5f<0x0||_0x161c5f>0x4?_0x50dacd?0x3:0x2:_0x161c5f;_0xded944[_0xdef0('0x1f')]('\x22'+_0x3b498a+'\x22');break;case _0xdef0('0x48'):var _0x4e4538=parseInt(_0x3b498a);if(_['isNumber'](_0x4e4538)&&_[_0xdef0('0x7a')](_0x1f6c3c,_0x4e4538)){_0xded944[_0xdef0('0x1f')]('\x22'+_0x4e4538+'\x22');}else{_0x2a49c8[_0xdef0('0x1f')](_0xdef0('0x88'));}break;case _0xdef0('0x89'):if(isEmail(_0x3b498a)){_0xded944[_0xdef0('0x1f')]('\x22'+_0x3b498a+'\x22');}else{_0x2a49c8['push'](_0xdef0('0x8a'));}break;case _0xdef0('0x8b'):var _0x3090fe=moment(_0x3b498a,_0xdef0('0x8c'),!![]);if(_0x3090fe[_0xdef0('0x85')]()){_0xded944[_0xdef0('0x1f')]('\x22'+_0x3b498a+'\x22');}else{_0x2a49c8['push'](_0xdef0('0x8d'));}break;case _0xdef0('0x72'):var _0x3c0550=shared[_0xdef0('0x6e')];var _0x27dc51=_0x3c0550[_0x3b498a];if(!_[_0xdef0('0x22')](_0x27dc51)){var _0x413c36=_0x27dc51[_0xdef0('0x6f')];_0xded944[_0xdef0('0x1f')]('\x22'+_0x3b498a+'\x22');_0xded944[_0xdef0('0x1f')]('\x22'+_0x413c36+'\x22');}break;default:_0xded944[_0xdef0('0x1f')]('\x22'+_0x3b498a+'\x22');}}else{switch(_0x4e3e69){case _0xdef0('0x8e'):case _0xdef0('0x13'):_0x2a49c8['push'](_0x4e3e69+_0xdef0('0x8f'));break;default:_0xded944[_0xdef0('0x1f')]('\x22\x22');}}}}else{var _0x38ec2e='';if(!_[_0xdef0('0x22')](_0x493a66)){if(!_0x171a36[_0xdef0('0x90')](_0x493a66['id'])){if(!_[_0xdef0('0x22')](_0x350f04[_0xdef0('0x80')][_0x164f23][_0x22a707[_0x4e3e69]])){var _0x3b498a=_[_0xdef0('0x91')](_0x350f04['data'][_0x164f23][_0x22a707[_0x4e3e69]]['replace'](/"/g,'\x27'));var _0x1a0ca5=phoneDescriptions[_0xdef0('0x82')](_0x11e54a=>_0x11e54a[_0xdef0('0x92')]===_0x493a66['id']);if(!_[_0xdef0('0x22')](_0x1a0ca5)){var _0x181bbe=_['trim'](_0x350f04['data'][_0x164f23][_0x22a707[_0x1a0ca5[_0xdef0('0x93')]]][_0xdef0('0x84')](/"/g,'\x27'));if(!_['isNil'](_0x181bbe))_0x3b498a=_0x3b498a+'§'+_0x181bbe;}if(_0x38ec2e=='')_0x38ec2e=_0x3b498a;else _0x38ec2e+='|'+_0x3b498a;}_0x10e81c['push'](_0x493a66['id']+':'+_0x38ec2e);_0x171a36[_0x493a66['id']]=0x1;}}}}if(hasAdditionalPhones){_0xded944[_0xdef0('0x1f')]('\x22'+_0x10e81c['join'](';')+'\x22');}if(_0x2a49c8[_0xdef0('0x1e')]){handleError(_0x350f04['data'][_0x164f23],{'code':_0xdef0('0x94'),'message':_0x2a49c8[_0xdef0('0x19')]()});}else{fs[_0xdef0('0x95')](_0x4dfbe7,_0xded944[_0xdef0('0x19')]()+'\x0a');}_0xded944=[];}if(!(stats[_0xdef0('0x81')]%0xc8)){socket[_0xdef0('0x96')](_0xdef0('0x97')+_0x1e1717,stats);stats[_0xdef0('0x5e')]=[];}}if(stopped){logger[_0xdef0('0x61')](_0xdef0('0x98'));_0x59e42f[_0xdef0('0x99')]();}}catch(_0x33541e){handleError(_0x350f04[_0xdef0('0x80')][_0x164f23],{'code':_0xdef0('0x9a'),'message':_0x33541e['message']});logger[_0xdef0('0x5c')](_0xdef0('0x9b'),_0x33541e['message']);}},'complete':function(){try{var _0x185e20=[];var _0x3a1a12=[];var _0x646318=_0xdef0('0x3b');if(_0x2040a7[_0xdef0('0x9c')]&&_0x2040a7['duplicates']['length']){_0x646318='cm_contacts_'+_0x1e1717;_0x185e20[_0xdef0('0x1f')](_0xdef0('0x9d')+_0x646318+_0xdef0('0x9e'));}tmp_campaigns=_0xdef0('0x9f')+_0x1e1717;tmp_voice_queues='voice_queues_'+_0x1e1717;_0x3a1a12[_0xdef0('0x1f')](_0xdef0('0x9d')+tmp_campaigns+_0xdef0('0xa0'));_0x3a1a12['push'](_0xdef0('0x9d')+tmp_voice_queues+_0xdef0('0xa0'));BPromise[_0xdef0('0xa1')](_0x3a1a12,handleTZQuery)[_0xdef0('0x1d')](function(_0x10d71f){updateTzCampaigns(_0x2040a7[_0xdef0('0x36')])[_0xdef0('0x1d')](function(_0x1910b0){updateTzVoiceQueues(_0x2040a7[_0xdef0('0x36')])[_0xdef0('0x1d')](function(_0x465f3b){if(hasTZ)_0x59a19e=_0x59a19e[_0xdef0('0x84')](_0xdef0('0x72'),'dialTimezone,utcOffset');var _0x1cc1e1=util[_0xdef0('0xf')](_0xdef0('0xa2'),_0x4dfbe7,_0x646318,_0x59a19e,_0x2040a7['ListId'],_0x2040a7[_0xdef0('0xa3')]||null,NOW,NOW);if(_[_0xdef0('0x22')](_0x22a707['scheduledat'])){_0x1cc1e1+=_0xdef0('0xa4');}_0x185e20[_0xdef0('0x1f')](_0x1cc1e1);if(_0x2040a7[_0xdef0('0x9c')]&&_0x2040a7['duplicates']['length']){_0x185e20[_0xdef0('0x1f')](insertCmContact(_0x2040a7[_0xdef0('0x36')],_0x646318,_0x2040a7['duplicates'],_0x22a707));_0x185e20[_0xdef0('0x1f')](_0xdef0('0xa5')+_0x646318+';');}BPromise[_0xdef0('0xa1')](_0x185e20,handleQuery)[_0xdef0('0x1d')](function(_0x1885d6){BPromise[_0xdef0('0x20')]([handleAdditionalPhones()])[_0xdef0('0x1d')](function(){_0x185e20=[];for(var _0x21db24=0x0;_0x21db24\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','.id\x20=\x20','query','spread','length','isNil','push','all','then','catch','error','message','AdditionalPhones','split','filter','findOne','update','CmContactHasItem','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ListId','createdAt','UserId','recallme','from','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','into','cm_hopper_black','ContactId','updatedAt','fields','.CmListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','exit','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','info'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5464,0x15d));var _0x4546=function(_0x5b332a,_0x12dc8a){_0x5b332a=_0x5b332a-0x0;var _0x5e4441=_0x5464[_0x5b332a];return _0x5e4441;};'use strict';var fs=require('fs');var path=require(_0x4546('0x0'));var _=require(_0x4546('0x1'));var Papa=require(_0x4546('0x2'));var util=require('util');var BPromise=require(_0x4546('0x3'));var moment=require('moment');var squel=require(_0x4546('0x4'));var Redis=require('ioredis');var db=require(_0x4546('0x5'))['db'];var config=require(_0x4546('0x6'));var logger=require(_0x4546('0x7'))(_0x4546('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x4546('0x9'),'port':0x18eb});var socket=require(_0x4546('0xa'))(new Redis(config[_0x4546('0xb')]));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()[_0x4546('0xc')](_0x4546('0xd'));var tempTableName=_0x4546('0xe')+moment()[_0x4546('0xc')](_0x4546('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x383bf2){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'](_0x383bf2);}function selectNotIn(_0x1dd3f5,_0x8a15e2,_0x3d082a,_0x4a32b2,_0x1f82c9){return squel[_0x4546('0x10')]()[_0x4546('0x11')](_0x4546('0x12'))['from'](_0x4a32b2)['join'](_0x8a15e2,null,_0x8a15e2+_0x4546('0x13')+_0x4a32b2+'.'+_0x3d082a)['where'](_0x4a32b2+'.'+_0x3d082a+'\x20=\x20'+_0x1dd3f5+'.'+_0x3d082a)['where'](_0x8a15e2+'.dialCheckDuplicateType\x20IN\x20('+_0x1f82c9['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4f5571,_0x102180){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x4546('0x14')]('select\x20*\x20from\x20'+tempTableName)[_0x4546('0x15')](function(_0x564f3e){if(_0x564f3e!==null){var _0x3741f2=[];for(var _0x18bc09=0x0;_0x18bc09<_0x564f3e[_0x4546('0x16')];_0x18bc09++){var _0x203348=_0x564f3e[_0x18bc09];if(!_[_0x4546('0x17')](_0x203348[_0x4546('0x12')])){if(!_['isNil'](_0x203348['AdditionalPhones']))_0x3741f2['push'](insertAdditionalPhones(_0x203348));promisesContact[_0x4546('0x18')]({'contact':_0x203348});}}}Promise[_0x4546('0x19')](_0x3741f2)[_0x4546('0x1a')](function(){_0x4f5571({'val':0x1});});})[_0x4546('0x1b')](function(_0x1d412c){logger[_0x4546('0x1c')](_0x1d412c[_0x4546('0x1d')]);});});}function insertAdditionalPhones(_0x2f6329){return new Promise(function(_0x4034a5,_0xceb1d6){var _0x57d740=_0x2f6329[_0x4546('0x1e')];if(_[_0x4546('0x17')](_0x57d740))_0xceb1d6({'val':0x0});else{var _0x52447c=_0x57d740[_0x4546('0x1f')](';');var _0x437f55=[];orderBy=0x0;for(var _0x1a1984=0x0;_0x1a1984<_0x52447c[_0x4546('0x16')];_0x1a1984++){_0x437f55[_0x4546('0x18')](splitAdditionalPhone(_0x2f6329['id'],_0x52447c[_0x1a1984]));}Promise[_0x4546('0x19')](_0x437f55)['then'](function(){_0x4034a5({'val':_0x52447c[_0x4546('0x16')]});});}});}function splitAdditionalPhone(_0x2cca8b,_0x4f9fcf){return new Promise(function(_0x824698,_0x4618a6){var _0x202a6c=_0x4f9fcf[_0x4546('0x1f')](':');var _0x23084b=_0x202a6c[0x0];var _0x53ae5e=_0x202a6c[0x1];if(_0x53ae5e!==''){var _0x49dc98=_0x53ae5e[_0x4546('0x1f')]('|');var _0x831fa5=[];for(var _0x48fc36=0x0;_0x48fc36<_0x49dc98['length'];_0x48fc36++){if(_0x49dc98[_0x48fc36]!==''){var _0x43740e=_[_0x4546('0x20')](promisesAdditionalPhones,{'contactId':_0x2cca8b,'phone':_0x49dc98[_0x48fc36]});if(_0x43740e[_0x4546('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0x4546('0x18')]({'contactId':_0x2cca8b,'contactTypeId':_0x23084b,'phone':_0x49dc98[_0x48fc36],'orderBy':orderBy});}}}_0x824698({'ok':0x1});}else _0x824698({'res':0x0});});}function createAdditionalPhone(_0x29a3f0,_0x225bc6,_0xcea7da,_0x586ff1){var _0x367b23='';var _0x52c546='';var _0x3a2d12=_0xcea7da[_0x4546('0x1f')]('§');_0x367b23=_0x3a2d12[0x0];if(_0x3a2d12['length']==0x2)_0x52c546=_0x3a2d12[0x1];return new Promise(function(_0x539f74,_0xf7a95b){return db['CmContactHasItem'][_0x4546('0x21')]({'where':{'CmContactId':_0x29a3f0,'item':_0x367b23}})[_0x4546('0x1a')](function(_0x480d8e){if(_0x480d8e){return db['CmContactHasItem'][_0x4546('0x22')]({'ItemTypeId':_0x225bc6,'description':_0x52c546,'OrderBy':_0x586ff1},{'where':{'CmContactId':_0x29a3f0,'item':_0x367b23}})[_0x4546('0x1a')](function(_0x258d26){_0x539f74({'res':'updated'});});}else{return db[_0x4546('0x23')][_0x4546('0x24')]({'CmContactId':_0x29a3f0,'item':_0x367b23,'ItemTypeId':_0x225bc6,'description':_0x52c546,'OrderBy':_0x586ff1,'ItemClass':'PHONE'})[_0x4546('0x1a')](function(_0x4f5f36){_0x539f74({'res':_0x4546('0x25')});});}});});}function updateContact(_0x44f604){return new Promise(function(_0xe89b7c,_0x2ce37f){var _0x507ccb=_0x44f604['id'];delete _0x44f604['id'];return db[_0x4546('0x26')][_0x4546('0x22')](_0x44f604,{'where':{'id':_0x507ccb}})[_0x4546('0x1a')](function(_0x298bef){updatedRows+=0x1;return db[_0x4546('0x27')][_0x4546('0x22')]({'phone':_0x44f604['phone']},{'where':{'ContactId':_0x507ccb}})[_0x4546('0x1a')](function(_0x1ff54c){_0xe89b7c({'ret':'OK'});});});});}function insertCmHopper(_0x549f48,_0x5749b0,_0x3eb8e8,_0x26fb3d,_0x56049d){var _0x3ecd16=[_0x4546('0x28'),'cm_contacts.scheduledat','cm_contacts.id',_0x4546('0x29'),_0x5749b0+'.'+_0x26fb3d,_0x4546('0x2a'),_0x4546('0x2b'),_0x4546('0x2c'),_0x4546('0x2d'),'\x22'+_0x56049d+'\x22'];return squel[_0x4546('0x2e')]()['into'](_0x4546('0x2f'))[_0x4546('0x30')](['phone',_0x4546('0x31'),'ContactId',_0x4546('0x32'),_0x26fb3d,_0x4546('0x33'),'updatedAt','priority',_0x4546('0x34'),_0x4546('0x35')],squel[_0x4546('0x10')]()['fields'](_0x3ecd16)[_0x4546('0x36')](_0x5749b0)[_0x4546('0x37')](_0x4546('0x38'),null,_0x4546('0x39')+_0x5749b0+_0x4546('0x3a'))[_0x4546('0x37')](_0x3eb8e8,null,_0x3eb8e8+_0x4546('0x13')+_0x5749b0+'.'+_0x26fb3d)[_0x4546('0x3b')](_0x5749b0+'.CmListId\x20=\x20?',_0x549f48)[_0x4546('0x3b')](_0x4546('0x3c'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5749b0,_0x3eb8e8,_0x26fb3d,_0x4546('0x2f'),[_0x4546('0x3d'),_0x4546('0x3e')]))[_0x4546('0x3b')](_0x4546('0x3f'),selectNotIn(_0x5749b0,_0x3eb8e8,_0x26fb3d,'cm_hopper',[_0x4546('0x3d')])))[_0x4546('0x40')]();}function insertCmHopperBlack(_0x1060d1,_0x185b76,_0x236fc0,_0x3fabf0){var _0x3dad7e=[_0x4546('0x28'),_0x4546('0x41'),'cm_contacts.ListId',_0x185b76+'.'+_0x3fabf0,_0x4546('0x2a'),_0x4546('0x2b')];return squel[_0x4546('0x2e')]()[_0x4546('0x42')](_0x4546('0x43'))[_0x4546('0x30')]([_0x4546('0x12'),_0x4546('0x44'),_0x4546('0x32'),_0x3fabf0,_0x4546('0x33'),_0x4546('0x45')],squel['select']()[_0x4546('0x46')](_0x3dad7e)[_0x4546('0x36')](_0x185b76)['join'](_0x4546('0x38'),null,_0x4546('0x39')+_0x185b76+_0x4546('0x3a'))['join'](_0x236fc0,null,_0x236fc0+_0x4546('0x13')+_0x185b76+'.'+_0x3fabf0)[_0x4546('0x3b')](_0x185b76+_0x4546('0x47'),_0x1060d1)[_0x4546('0x3b')](_0x4546('0x3c'),NOW)[_0x4546('0x3b')](_0x4546('0x3f'),squel[_0x4546('0x10')]()[_0x4546('0x11')](_0x4546('0x12'))['from'](_0x4546('0x43'))[_0x4546('0x3b')]('ListId\x20=\x20?',_0x1060d1)[_0x4546('0x3b')](_0x3fabf0+_0x4546('0x48'),_0x185b76+'.'+_0x3fabf0)))[_0x4546('0x40')]();}function insertCmHopperAdditionalPhones(_0x2eee81){var _0x576c0a=[_0x4546('0x49'),'cm_contact_has_items.item',_0x4546('0x4a'),_0x4546('0x4b'),_0x4546('0x4c')];return squel['insert']()[_0x4546('0x42')](_0x4546('0x4d'))[_0x4546('0x30')]([_0x4546('0x4e'),_0x4546('0x12'),_0x4546('0x4f'),_0x4546('0x33'),_0x4546('0x45')],squel[_0x4546('0x10')]()[_0x4546('0x46')](_0x576c0a)[_0x4546('0x36')]('cm_hopper')[_0x4546('0x37')](_0x4546('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x4546('0x37')](_0x4546('0x50'),null,_0x4546('0x51'))['where'](_0x4546('0x52'),_0x2eee81)[_0x4546('0x3b')](_0x4546('0x3c'),NOW))[_0x4546('0x40')]();}function insertCmContact(_0x10dfd6,_0x1ffcd5,_0x2ca7d8,_0x3c36b2){var _0x50c2df=_[_0x4546('0x53')](_[_0x4546('0x54')](_0x3c36b2),[_0x4546('0x32'),_0x4546('0x55'),_0x4546('0x33'),_0x4546('0x45')]);return squel[_0x4546('0x2e')]()['into'](_0x4546('0x38'))[_0x4546('0x30')](_0x50c2df,squel['select']()[_0x4546('0x46')](_0x50c2df)[_0x4546('0x36')](_0x1ffcd5)[_0x4546('0x3b')]('('+_0x2ca7d8[_0x4546('0x37')](',')+')\x20NOT\x20IN\x20?',squel[_0x4546('0x10')]()[_0x4546('0x46')](_0x2ca7d8)[_0x4546('0x36')](_0x4546('0x38'))[_0x4546('0x3b')](_0x4546('0x56'),_0x10dfd6))[_0x4546('0x3b')](_0x4546('0x57'),squel[_0x4546('0x10')]()[_0x4546('0x11')](_0x4546('0x58'),'min_id')[_0x4546('0x36')](_0x1ffcd5)[_0x4546('0x59')](_0x2ca7d8[_0x4546('0x37')](','))))[_0x4546('0x40')]();}function handleStop(){logger['info'](_0x4546('0x5a'));stopped=!![];}function handleUncaughtException(_0x4a1a00){logger[_0x4546('0x1c')](_0x4a1a00[_0x4546('0x1d')]);process[_0x4546('0x5b')](0x1);}function handleError(_0xbe8cb1,_0x2e476e){stats['errors'][_0x4546('0x18')]({'name':_0x2e476e['code'],'message':_0x2e476e[_0x4546('0x1d')],'row':_0xbe8cb1});}function handleQuery(_0x522165){logger['info'](_0x522165);return db['sequelize'][_0x4546('0x14')](_0x522165)['spread'](function(_0x29f980){results[_0x4546('0x18')](_0x29f980);})[_0x4546('0x1b')](function(_0x2a1a21){logger['error'](_0x2a1a21[_0x4546('0x1d')]);});}function main(_0xdac0b7,_0x2682d5,_0x23bcc2,_0x1962c5){logger['info'](_0x4546('0x5c'),_0xdac0b7,JSON[_0x4546('0x5d')](_0x2682d5));process[_0x4546('0x5e')]('start');var _0x1bcbc8=_0x2682d5[_0x4546('0x5f')];var _0x25435e=_['clone'](_0x1bcbc8);var _0x320010=_0x2682d5[_0x4546('0x60')];var _0x17b211=path[_0x4546('0x37')](config[_0x4546('0x61')],_0x4546('0x62'),_0x320010+_0x4546('0x63'));logger[_0x4546('0x64')]('body',_0x2682d5);db[_0x4546('0x65')][_0x4546('0x66')]({'raw':!![],'attributes':['id',_0x4546('0x67')]})[_0x4546('0x1a')](function(_0x3c5b32){for(var _0x146438=0x0;_0x146438<_0x3c5b32[_0x4546('0x16')];_0x146438++){if(_0x3c5b32[_0x146438][_0x4546('0x67')]in _0x1bcbc8){contactItemTypes[_0x4546('0x18')](_0x3c5b32[_0x146438]);delete _0x25435e[_0x3c5b32[_0x146438][_0x4546('0x67')]];hasAdditionalPhones=!![];}for(var _0x214fb3 in _0x1bcbc8){if(_0x3c5b32[_0x146438][_0x4546('0x67')]+_0x4546('0x68')===_0x214fb3){phoneDescriptions[_0x4546('0x18')]({'itemTypeId':_0x3c5b32[_0x146438]['id'],'description':_0x214fb3});delete _0x25435e[_0x214fb3];}}}if(hasAdditionalPhones)_0x25435e[_0x4546('0x1e')]='';var _0x4d73a0=_[_0x4546('0x54')](_0x25435e)['join']();logger[_0x4546('0x64')](_0x4546('0x69'),_0x4d73a0);fs['writeFileSync'](_0x17b211,_0x4d73a0+'\x0a');Papa[_0x4546('0x6a')](fs[_0x4546('0x6b')](_0xdac0b7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x27680b,_0x180b24){try{for(var _0x3c3f29=0x0,_0x2960a0=[];_0x3c3f29<_0x27680b[_0x4546('0x6c')][_0x4546('0x16')];_0x3c3f29++){stats[_0x4546('0x6d')]+=0x1;if(_0x27680b[_0x4546('0x6e')][_0x3c3f29]){handleError(_0x27680b[_0x4546('0x6c')][_0x3c3f29],_0x27680b[_0x4546('0x6e')][_0x3c3f29]);}else{var _0x10a332=[];var _0x49cac3=[];var _0x235e41={};for(var _0x38681f in _0x1bcbc8){let _0x396b08=contactItemTypes['find'](_0xb6e936=>_0xb6e936[_0x4546('0x67')]===_0x38681f);let _0x1dafcc=contactItemTypes[_0x4546('0x6f')](_0x1b687a=>_0x1b687a[_0x4546('0x67')]+_0x4546('0x68')===_0x38681f);if(_['isNil'](_0x396b08)&&_[_0x4546('0x17')](_0x1dafcc)){if(_0x1bcbc8[_0x4546('0x70')](_0x38681f)){if(_0x27680b[_0x4546('0x6c')][_0x3c3f29][_0x1bcbc8[_0x38681f]]){var _0x4c1a64=_['trim'](_0x27680b[_0x4546('0x6c')][_0x3c3f29][_0x1bcbc8[_0x38681f]][_0x4546('0x71')](/"/g,'\x27'));switch(_0x38681f){case'scheduledat':var _0x44dd7a=moment(_0x4c1a64,_0x4546('0xd'),!![]);if(_0x44dd7a[_0x4546('0x72')]()){_0x2960a0[_0x4546('0x18')]('\x22'+_0x4c1a64+'\x22');}else{_0x10a332['push'](_0x4546('0x73'));}break;case _0x4546('0x74'):var _0x345c7e=parseInt(_0x4c1a64);_0x4c1a64=_[_0x4546('0x75')](_0x345c7e)||_0x345c7e<0x0||_0x345c7e>0x4?_0x1962c5?0x3:0x2:_0x345c7e;_0x2960a0[_0x4546('0x18')]('\x22'+_0x4c1a64+'\x22');break;case _0x4546('0x34'):var _0x194d41=parseInt(_0x4c1a64);if(_[_0x4546('0x76')](_0x194d41)&&_['includes'](_0x23bcc2,_0x194d41)){_0x2960a0[_0x4546('0x18')]('\x22'+_0x194d41+'\x22');}else{_0x10a332[_0x4546('0x18')]('agent\x20not\x20exists');}break;case _0x4546('0x77'):if(isEmail(_0x4c1a64)){_0x2960a0[_0x4546('0x18')]('\x22'+_0x4c1a64+'\x22');}else{_0x10a332['push'](_0x4546('0x78'));}break;case _0x4546('0x79'):var _0x2096a8=moment(_0x4c1a64,'YYYY-MM-DD',!![]);if(_0x2096a8[_0x4546('0x72')]()){_0x2960a0[_0x4546('0x18')]('\x22'+_0x4c1a64+'\x22');}else{_0x10a332[_0x4546('0x18')](_0x4546('0x7a'));}break;default:_0x2960a0[_0x4546('0x18')]('\x22'+_0x4c1a64+'\x22');}}else{switch(_0x38681f){case _0x4546('0x7b'):case _0x4546('0x12'):_0x10a332['push'](_0x38681f+'\x20not\x20specified');break;default:_0x2960a0[_0x4546('0x18')]('\x22\x22');}}}}else{var _0x3daef7='';if(!_[_0x4546('0x17')](_0x396b08)){if(!_0x235e41[_0x4546('0x70')](_0x396b08['id'])){for(var _0x1e8f3a=0x0;_0x1e8f3a<_0x1bcbc8[_0x38681f][_0x4546('0x16')];_0x1e8f3a++){var _0x4c1a64=_['trim'](_0x27680b[_0x4546('0x6c')][_0x3c3f29][_0x1bcbc8[_0x38681f][_0x1e8f3a]][_0x4546('0x71')](/"/g,'\x27'));var _0x39d86a=phoneDescriptions[_0x4546('0x6f')](_0x26d065=>_0x26d065[_0x4546('0x7c')]===_0x396b08['id']);if(!_[_0x4546('0x17')](_0x39d86a)){var _0x24d214=_['trim'](_0x27680b[_0x4546('0x6c')][_0x3c3f29][_0x1bcbc8[_0x39d86a['description']][0x0]][_0x4546('0x71')](/"/g,'\x27'));if(!_[_0x4546('0x17')](_0x24d214))_0x4c1a64=_0x4c1a64+'§'+_0x24d214;}if(_0x3daef7=='')_0x3daef7=_0x4c1a64;else _0x3daef7+='|'+_0x4c1a64;}_0x49cac3[_0x4546('0x18')](_0x396b08['id']+':'+_0x3daef7);_0x235e41[_0x396b08['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2960a0['push']('\x22'+_0x49cac3[_0x4546('0x37')](';')+'\x22');}if(_0x10a332[_0x4546('0x16')]){handleError(_0x27680b[_0x4546('0x6c')][_0x3c3f29],{'code':_0x4546('0x7d'),'message':_0x10a332[_0x4546('0x37')]()});}else{fs[_0x4546('0x7e')](_0x17b211,_0x2960a0[_0x4546('0x37')]()+'\x0a');}_0x2960a0=[];}if(!(stats[_0x4546('0x6d')]%0xc8)){socket[_0x4546('0x7f')](_0x4546('0x80')+_0x320010,stats);stats['errors']=[];}}if(stopped){logger[_0x4546('0x64')](_0x4546('0x81'));_0x180b24['abort']();}}catch(_0x36f8b5){handleError(_0x27680b[_0x4546('0x6c')][_0x3c3f29],{'code':_0x4546('0x82'),'message':_0x36f8b5[_0x4546('0x1d')]});logger['error']('step',_0x36f8b5[_0x4546('0x1d')]);}},'complete':function(){try{var _0x2c6d39=[];var _0x51828c=tempTableName;_0x2c6d39[_0x4546('0x18')](_0x4546('0x83')+_0x51828c+'\x20LIKE\x20cm_contacts;');logger[_0x4546('0x64')](_0x4546('0x84'),contactItemTypes[_0x4546('0x16')]);var _0x2eab5f=util[_0x4546('0xc')]('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',_0x17b211,_0x51828c,_0x4d73a0,_0x2682d5[_0x4546('0x32')],_0x2682d5['CompanyId']||null,NOW,NOW);if(_[_0x4546('0x17')](_0x1bcbc8[_0x4546('0x31')])){_0x2eab5f+=_0x4546('0x85');}_0x2c6d39[_0x4546('0x18')](_0x2eab5f);BPromise[_0x4546('0x86')](_0x2c6d39,handleQuery)[_0x4546('0x1a')](function(_0x26cb26){BPromise[_0x4546('0x19')]([handleAdditionalPhones()])['then'](function(){_0x2c6d39=[];for(var _0x1edb52=0x0;_0x1edb52\x20\x20','existsSync','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','squel','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','phone','AdditionalPhones','push','all','error','message','split','length','filter','CmContactHasItem','PHONE','then','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','updatedAt','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','into','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','catch','main','stringify','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','_description','trim','scheduledat','isValid'];(function(_0x4905e4,_0x500a74){var _0x53ec71=function(_0x3d6440){while(--_0x3d6440){_0x4905e4['push'](_0x4905e4['shift']());}};_0x53ec71(++_0x500a74);}(_0xbdbe,0x1f3));var _0xebdb=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xbdbe[_0x178e48];return _0x440d7e;};'use strict';var fs=require('fs');var path=require(_0xebdb('0x0'));var _=require('lodash');var Papa=require(_0xebdb('0x1'));var util=require('util');var BPromise=require(_0xebdb('0x2'));var moment=require('moment');var squel=require(_0xebdb('0x3'));var Redis=require('ioredis');var db=require(_0xebdb('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xebdb('0x5'))('import');config[_0xebdb('0x6')]=_[_0xebdb('0x7')](config[_0xebdb('0x6')],{'host':_0xebdb('0x8'),'port':0x18eb});var socket=require(_0xebdb('0x9'))(new Redis(config[_0xebdb('0x6')]));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()[_0xebdb('0xa')](_0xebdb('0xb'));var tempTableName=_0xebdb('0xc')+moment()[_0xebdb('0xa')](_0xebdb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x54a360){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))*$/[_0xebdb('0xe')](_0x54a360);}function selectNotIn(_0x1622d5,_0x557d85,_0x1f10d7,_0x24266c,_0x2379d3){return squel[_0xebdb('0xf')]()['field']('phone')[_0xebdb('0x10')](_0x24266c)[_0xebdb('0x11')](_0x557d85,null,_0x557d85+_0xebdb('0x12')+_0x24266c+'.'+_0x1f10d7)[_0xebdb('0x13')](_0x24266c+'.'+_0x1f10d7+'\x20=\x20'+_0x1622d5+'.'+_0x1f10d7)[_0xebdb('0x13')](_0x557d85+_0xebdb('0x14')+_0x2379d3[_0xebdb('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x46f8f8,_0x1a87bc){promisesAdditionalPhones=[];promisesContact=[];return db[_0xebdb('0x15')][_0xebdb('0x16')](_0xebdb('0x17')+tempTableName)[_0xebdb('0x18')](function(_0x74f971){if(_0x74f971!==null){var _0x4ab0f9=[];for(var _0x2a5253=0x0;_0x2a5253<_0x74f971['length'];_0x2a5253++){var _0x4c3700=_0x74f971[_0x2a5253];if(!_[_0xebdb('0x19')](_0x4c3700[_0xebdb('0x1a')])){if(!_['isNil'](_0x4c3700[_0xebdb('0x1b')]))_0x4ab0f9[_0xebdb('0x1c')](insertAdditionalPhones(_0x4c3700));promisesContact['push']({'contact':_0x4c3700});}}}Promise[_0xebdb('0x1d')](_0x4ab0f9)['then'](function(){_0x46f8f8({'val':0x1});});})['catch'](function(_0x3e89cf){logger[_0xebdb('0x1e')](_0x3e89cf[_0xebdb('0x1f')]);});});}function insertAdditionalPhones(_0x5c76cc){return new Promise(function(_0x38a4dd,_0x4c5a44){var _0x3b1b87=_0x5c76cc[_0xebdb('0x1b')];if(_['isNil'](_0x3b1b87))_0x4c5a44({'val':0x0});else{var _0x561653=_0x3b1b87[_0xebdb('0x20')](';');var _0x521da8=[];orderBy=0x0;for(var _0x264e94=0x0;_0x264e94<_0x561653[_0xebdb('0x21')];_0x264e94++){_0x521da8[_0xebdb('0x1c')](splitAdditionalPhone(_0x5c76cc['id'],_0x561653[_0x264e94]));}Promise['all'](_0x521da8)['then'](function(){_0x38a4dd({'val':_0x561653[_0xebdb('0x21')]});});}});}function splitAdditionalPhone(_0x27c9ec,_0x24f4ce){return new Promise(function(_0xdb4ad8,_0xae2fed){var _0x24001d=_0x24f4ce[_0xebdb('0x20')](':');var _0x184871=_0x24001d[0x0];var _0x5b721f=_0x24001d[0x1];if(_0x5b721f!==''){var _0x1f4b46=_0x5b721f[_0xebdb('0x20')]('|');var _0x124321=[];for(var _0x577abd=0x0;_0x577abd<_0x1f4b46[_0xebdb('0x21')];_0x577abd++){if(_0x1f4b46[_0x577abd]!==''){var _0x59d9f7=_[_0xebdb('0x22')](promisesAdditionalPhones,{'contactId':_0x27c9ec,'phone':_0x1f4b46[_0x577abd]});if(_0x59d9f7[_0xebdb('0x21')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x27c9ec,'contactTypeId':_0x184871,'phone':_0x1f4b46[_0x577abd],'orderBy':orderBy});}}}_0xdb4ad8({'ok':0x1});}else _0xdb4ad8({'res':0x0});});}function createAdditionalPhone(_0x19ef3c,_0x57f324,_0x497642,_0x184ec4){var _0x37a52d='';var _0x12fafd='';var _0x5136f2=_0x497642[_0xebdb('0x20')]('§');_0x37a52d=_0x5136f2[0x0];if(_0x5136f2[_0xebdb('0x21')]==0x2)_0x12fafd=_0x5136f2[0x1];return new Promise(function(_0x94f1e3,_0x3b4e92){return db[_0xebdb('0x23')]['findOne']({'where':{'CmContactId':_0x19ef3c,'item':_0x37a52d}})['then'](function(_0x36fe2b){if(_0x36fe2b){return db[_0xebdb('0x23')]['update']({'ItemTypeId':_0x57f324,'description':_0x12fafd,'OrderBy':_0x184ec4},{'where':{'CmContactId':_0x19ef3c,'item':_0x37a52d}})['then'](function(_0x4fed6c){_0x94f1e3({'res':'updated'});});}else{return db[_0xebdb('0x23')]['create']({'CmContactId':_0x19ef3c,'item':_0x37a52d,'ItemTypeId':_0x57f324,'description':_0x12fafd,'OrderBy':_0x184ec4,'ItemClass':_0xebdb('0x24')})[_0xebdb('0x25')](function(_0x54466b){_0x94f1e3({'res':'inserted'});});}});});}function updateContact(_0x190bdb){return new Promise(function(_0x33f64d,_0x1a660c){var _0x4c10be=_0x190bdb['id'];delete _0x190bdb['id'];return db[_0xebdb('0x26')][_0xebdb('0x27')](_0x190bdb,{'where':{'id':_0x4c10be}})[_0xebdb('0x25')](function(_0x2f8355){updatedRows+=0x1;return db[_0xebdb('0x28')][_0xebdb('0x27')]({'phone':_0x190bdb['phone']},{'where':{'ContactId':_0x4c10be}})[_0xebdb('0x25')](function(_0x192d7d){_0x33f64d({'ret':'OK'});});});});}function insertCmHopper(_0x2e922b,_0xe7f4c6,_0x3dc8d3,_0x3c650c,_0x3395c5){var _0x1136ea=[_0xebdb('0x29'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0xe7f4c6+'.'+_0x3c650c,_0xebdb('0x2a'),_0xebdb('0x2b'),'cm_contacts.priority',_0xebdb('0x2c'),'\x22'+_0x3395c5+'\x22'];return squel[_0xebdb('0x2d')]()['into'](_0xebdb('0x2e'))[_0xebdb('0x2f')](['phone','scheduledat',_0xebdb('0x30'),_0xebdb('0x31'),_0x3c650c,_0xebdb('0x32'),'updatedAt',_0xebdb('0x33'),_0xebdb('0x34'),_0xebdb('0x35')],squel[_0xebdb('0xf')]()[_0xebdb('0x36')](_0x1136ea)[_0xebdb('0x10')](_0xe7f4c6)[_0xebdb('0x11')](_0xebdb('0x37'),null,_0xebdb('0x38')+_0xe7f4c6+_0xebdb('0x39'))[_0xebdb('0x11')](_0x3dc8d3,null,_0x3dc8d3+'.id\x20=\x20'+_0xe7f4c6+'.'+_0x3c650c)[_0xebdb('0x13')](_0xe7f4c6+_0xebdb('0x3a'),_0x2e922b)[_0xebdb('0x13')](_0xebdb('0x3b'),NOW)['where'](_0xebdb('0x3c'),selectNotIn(_0xe7f4c6,_0x3dc8d3,_0x3c650c,'cm_hopper',['\x22always\x22',_0xebdb('0x3d')]))[_0xebdb('0x13')](_0xebdb('0x3c'),selectNotIn(_0xe7f4c6,_0x3dc8d3,_0x3c650c,_0xebdb('0x2e'),[_0xebdb('0x3e')])))[_0xebdb('0x3f')]();}function insertCmHopperBlack(_0x202f9b,_0x162b79,_0x5f4333,_0x57ad10){var _0x133484=[_0xebdb('0x29'),_0xebdb('0x40'),_0xebdb('0x41'),_0x162b79+'.'+_0x57ad10,_0xebdb('0x2a'),_0xebdb('0x2b')];return squel['insert']()['into'](_0xebdb('0x42'))[_0xebdb('0x2f')]([_0xebdb('0x1a'),'ContactId',_0xebdb('0x31'),_0x57ad10,'createdAt',_0xebdb('0x43')],squel[_0xebdb('0xf')]()[_0xebdb('0x36')](_0x133484)[_0xebdb('0x10')](_0x162b79)['join'](_0xebdb('0x37'),null,_0xebdb('0x38')+_0x162b79+'.CmListId')[_0xebdb('0x11')](_0x5f4333,null,_0x5f4333+_0xebdb('0x12')+_0x162b79+'.'+_0x57ad10)[_0xebdb('0x13')](_0x162b79+'.CmListId\x20=\x20?',_0x202f9b)[_0xebdb('0x13')](_0xebdb('0x3b'),NOW)[_0xebdb('0x13')](_0xebdb('0x3c'),squel[_0xebdb('0xf')]()[_0xebdb('0x44')](_0xebdb('0x1a'))[_0xebdb('0x10')](_0xebdb('0x42'))[_0xebdb('0x13')](_0xebdb('0x45'),_0x202f9b)['where'](_0x57ad10+_0xebdb('0x46'),_0x162b79+'.'+_0x57ad10)))[_0xebdb('0x3f')]();}function insertCmHopperAdditionalPhones(_0x5a44fb){var _0x41ed32=[_0xebdb('0x47'),_0xebdb('0x48'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xebdb('0x49')];return squel[_0xebdb('0x2d')]()[_0xebdb('0x4a')]('cm_hopper_additional_phones')[_0xebdb('0x2f')]([_0xebdb('0x4b'),_0xebdb('0x1a'),'OrderBy','createdAt','updatedAt'],squel['select']()[_0xebdb('0x36')](_0x41ed32)[_0xebdb('0x10')](_0xebdb('0x2e'))[_0xebdb('0x11')](_0xebdb('0x37'),null,_0xebdb('0x4c'))[_0xebdb('0x11')](_0xebdb('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xebdb('0x13')](_0xebdb('0x4e'),_0x5a44fb)[_0xebdb('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xebdb('0x3f')]();}function insertCmContact(_0x2a8cdc,_0x5e767b,_0x8fe1b4,_0xf5b5b6){var _0x5beec8=_['concat'](_[_0xebdb('0x4f')](_0xf5b5b6),['ListId',_0xebdb('0x50'),_0xebdb('0x32'),_0xebdb('0x43')]);return squel[_0xebdb('0x2d')]()[_0xebdb('0x4a')]('cm_contacts')['fromQuery'](_0x5beec8,squel[_0xebdb('0xf')]()[_0xebdb('0x36')](_0x5beec8)[_0xebdb('0x10')](_0x5e767b)[_0xebdb('0x13')]('('+_0x8fe1b4[_0xebdb('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0xebdb('0xf')]()[_0xebdb('0x36')](_0x8fe1b4)[_0xebdb('0x10')](_0xebdb('0x37'))[_0xebdb('0x13')](_0xebdb('0x45'),_0x2a8cdc))[_0xebdb('0x13')](_0xebdb('0x51'),squel[_0xebdb('0xf')]()[_0xebdb('0x44')](_0xebdb('0x52'),_0xebdb('0x53'))[_0xebdb('0x10')](_0x5e767b)[_0xebdb('0x54')](_0x8fe1b4[_0xebdb('0x11')](','))))['toString']();}function handleStop(){logger[_0xebdb('0x55')](_0xebdb('0x56'));stopped=!![];}function handleUncaughtException(_0x21b9e0){logger[_0xebdb('0x1e')](_0x21b9e0[_0xebdb('0x1f')]);process[_0xebdb('0x57')](0x1);}function handleError(_0x26fa90,_0x435a13){stats[_0xebdb('0x58')]['push']({'name':_0x435a13[_0xebdb('0x59')],'message':_0x435a13[_0xebdb('0x1f')],'row':_0x26fa90});}function handleQuery(_0x3a99d4){logger[_0xebdb('0x55')](_0x3a99d4);return db[_0xebdb('0x15')][_0xebdb('0x16')](_0x3a99d4)[_0xebdb('0x18')](function(_0x58502f){results[_0xebdb('0x1c')](_0x58502f);})[_0xebdb('0x5a')](function(_0x2f7fb1){logger['error'](_0x2f7fb1[_0xebdb('0x1f')]);});}function main(_0x2317d8,_0x4504b6,_0x4e660b,_0x435b9a){logger[_0xebdb('0x55')](_0xebdb('0x5b'),_0x2317d8,JSON[_0xebdb('0x5c')](_0x4504b6));process['send']('start');var _0x4c6481=_0x4504b6[_0xebdb('0x5d')];var _0x4abf61=_[_0xebdb('0x5e')](_0x4c6481);var _0x1fb211=_0x4504b6['socket_timestamp'];var _0x485b36=path[_0xebdb('0x11')](config[_0xebdb('0x5f')],_0xebdb('0x60'),_0x1fb211+_0xebdb('0x61'));logger[_0xebdb('0x55')](_0xebdb('0x62'),_0x4504b6);db[_0xebdb('0x63')][_0xebdb('0x64')]({'raw':!![],'attributes':['id',_0xebdb('0x65')]})[_0xebdb('0x25')](function(_0x2efa32){for(var _0x546a59=0x0;_0x546a59<_0x2efa32[_0xebdb('0x21')];_0x546a59++){if(_0x2efa32[_0x546a59][_0xebdb('0x65')]in _0x4c6481){contactItemTypes['push'](_0x2efa32[_0x546a59]);delete _0x4abf61[_0x2efa32[_0x546a59][_0xebdb('0x65')]];hasAdditionalPhones=!![];}for(var _0x3d9c55 in _0x4c6481){if(_0x2efa32[_0x546a59][_0xebdb('0x65')]+'_description'===_0x3d9c55){phoneDescriptions['push']({'itemTypeId':_0x2efa32[_0x546a59]['id'],'description':_0x3d9c55});delete _0x4abf61[_0x3d9c55];}}}if(hasAdditionalPhones)_0x4abf61['AdditionalPhones']='';var _0x22a6f1=_['keys'](_0x4abf61)[_0xebdb('0x11')]();logger[_0xebdb('0x55')](_0xebdb('0x66'),_0x22a6f1);fs[_0xebdb('0x67')](_0x485b36,_0x22a6f1+'\x0a');Papa[_0xebdb('0x68')](fs[_0xebdb('0x69')](_0x2317d8),{'header':!![],'skipEmptyLines':!![],'step':function(_0xaa1ed7,_0x4e6175){try{for(var _0x3d9bf9=0x0,_0x2f35d1=[];_0x3d9bf9<_0xaa1ed7[_0xebdb('0x6a')]['length'];_0x3d9bf9++){stats[_0xebdb('0x6b')]+=0x1;if(_0xaa1ed7[_0xebdb('0x58')][_0x3d9bf9]){handleError(_0xaa1ed7['data'][_0x3d9bf9],_0xaa1ed7[_0xebdb('0x58')][_0x3d9bf9]);}else{var _0xf6aade=[];var _0x19f0ea=[];var _0x577530={};for(var _0x36e317 in _0x4c6481){let _0x12b534=contactItemTypes[_0xebdb('0x6c')](_0x22440b=>_0x22440b[_0xebdb('0x65')]===_0x36e317);let _0x17cecd=contactItemTypes[_0xebdb('0x6c')](_0x93917f=>_0x93917f[_0xebdb('0x65')]+_0xebdb('0x6d')===_0x36e317);if(_['isNil'](_0x12b534)&&_[_0xebdb('0x19')](_0x17cecd)){if(_0x4c6481['hasOwnProperty'](_0x36e317)){if(_0xaa1ed7[_0xebdb('0x6a')][_0x3d9bf9][_0x4c6481[_0x36e317]]){var _0x5314fe=_[_0xebdb('0x6e')](_0xaa1ed7['data'][_0x3d9bf9][_0x4c6481[_0x36e317]]['replace'](/"/g,'\x27'));switch(_0x36e317){case _0xebdb('0x6f'):var _0x2a60c6=moment(_0x5314fe,_0xebdb('0xb'),!![]);if(_0x2a60c6[_0xebdb('0x70')]()){_0x2f35d1[_0xebdb('0x1c')]('\x22'+_0x5314fe+'\x22');}else{_0xf6aade[_0xebdb('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xebdb('0x33'):var _0x3f8d20=parseInt(_0x5314fe);_0x5314fe=_[_0xebdb('0x71')](_0x3f8d20)||_0x3f8d20<0x0||_0x3f8d20>0x4?_0x435b9a?0x3:0x2:_0x3f8d20;_0x2f35d1['push']('\x22'+_0x5314fe+'\x22');break;case'UserId':var _0x5d3209=parseInt(_0x5314fe);if(_['isNumber'](_0x5d3209)&&_[_0xebdb('0x72')](_0x4e660b,_0x5d3209)){_0x2f35d1[_0xebdb('0x1c')]('\x22'+_0x5d3209+'\x22');}else{_0xf6aade[_0xebdb('0x1c')](_0xebdb('0x73'));}break;case _0xebdb('0x74'):if(isEmail(_0x5314fe)){_0x2f35d1[_0xebdb('0x1c')]('\x22'+_0x5314fe+'\x22');}else{_0xf6aade['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x3d573d=moment(_0x5314fe,'YYYY-MM-DD',!![]);if(_0x3d573d[_0xebdb('0x70')]()){_0x2f35d1[_0xebdb('0x1c')]('\x22'+_0x5314fe+'\x22');}else{_0xf6aade[_0xebdb('0x1c')](_0xebdb('0x75'));}break;default:_0x2f35d1[_0xebdb('0x1c')]('\x22'+_0x5314fe+'\x22');}}else{switch(_0x36e317){case _0xebdb('0x76'):case _0xebdb('0x1a'):_0xf6aade[_0xebdb('0x1c')](_0x36e317+_0xebdb('0x77'));break;default:_0x2f35d1[_0xebdb('0x1c')]('\x22\x22');}}}}else{var _0x1fde28='';if(!_[_0xebdb('0x19')](_0x12b534)){if(!_0x577530[_0xebdb('0x78')](_0x12b534['id'])){for(var _0x3597dc=0x0;_0x3597dc<_0x4c6481[_0x36e317][_0xebdb('0x21')];_0x3597dc++){var _0x5314fe=_['trim'](_0xaa1ed7[_0xebdb('0x6a')][_0x3d9bf9][_0x4c6481[_0x36e317][_0x3597dc]][_0xebdb('0x79')](/"/g,'\x27'));var _0x4cdb1d=phoneDescriptions[_0xebdb('0x6c')](_0x2aae75=>_0x2aae75[_0xebdb('0x7a')]===_0x12b534['id']);if(!_['isNil'](_0x4cdb1d)){var _0x55c036=_[_0xebdb('0x6e')](_0xaa1ed7['data'][_0x3d9bf9][_0x4c6481[_0x4cdb1d[_0xebdb('0x7b')]][0x0]][_0xebdb('0x79')](/"/g,'\x27'));if(!_[_0xebdb('0x19')](_0x55c036))_0x5314fe=_0x5314fe+'§'+_0x55c036;}if(_0x1fde28=='')_0x1fde28=_0x5314fe;else _0x1fde28+='|'+_0x5314fe;}_0x19f0ea[_0xebdb('0x1c')](_0x12b534['id']+':'+_0x1fde28);_0x577530[_0x12b534['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2f35d1['push']('\x22'+_0x19f0ea[_0xebdb('0x11')](';')+'\x22');}if(_0xf6aade[_0xebdb('0x21')]){handleError(_0xaa1ed7[_0xebdb('0x6a')][_0x3d9bf9],{'code':_0xebdb('0x7c'),'message':_0xf6aade[_0xebdb('0x11')]()});}else{fs[_0xebdb('0x7d')](_0x485b36,_0x2f35d1[_0xebdb('0x11')]()+'\x0a');}_0x2f35d1=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xebdb('0x7e')+_0x1fb211,stats);stats[_0xebdb('0x58')]=[];}}if(stopped){logger['info'](_0xebdb('0x7f'));_0x4e6175[_0xebdb('0x80')]();}}catch(_0xda0f26){handleError(_0xaa1ed7[_0xebdb('0x6a')][_0x3d9bf9],{'code':_0xebdb('0x81'),'message':_0xda0f26[_0xebdb('0x1f')]});logger[_0xebdb('0x1e')](_0xebdb('0x82'),_0xda0f26['message']);}},'complete':function(){try{var _0x2e8c2a=[];var _0x4c2651=tempTableName;_0x2e8c2a[_0xebdb('0x1c')](_0xebdb('0x83')+_0x4c2651+'\x20LIKE\x20cm_contacts;');logger[_0xebdb('0x55')](_0xebdb('0x84'),contactItemTypes[_0xebdb('0x21')]);var _0x54ede6=util[_0xebdb('0xa')](_0xebdb('0x85'),_0x485b36,_0x4c2651,_0x22a6f1,_0x4504b6[_0xebdb('0x31')],_0x4504b6[_0xebdb('0x50')]||null,NOW,NOW);if(_[_0xebdb('0x19')](_0x4c6481['scheduledat'])){_0x54ede6+=_0xebdb('0x86');}_0x2e8c2a[_0xebdb('0x1c')](_0x54ede6);BPromise['each'](_0x2e8c2a,handleQuery)['then'](function(_0x5ad599){BPromise[_0xebdb('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x2e8c2a=[];for(var _0x2778f1=0x0;_0x2778f1=_0x57a735){return _0xf89ee8['status'](0x193)[_0x63c1('0x12')]({'message':util[_0x63c1('0xa')](_0x63c1('0x13'),_0x7991ce)});}_0x290dc5();})[_0x63c1('0x14')](function(_0x151a84){_0x290dc5(_0x151a84);});});}function isUserLimit(){return isLimit(_0x63c1('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0x63c1('0x16')},{'role':_0x63c1('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xdf87=['count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','use','findOne','then'];(function(_0x48c2ae,_0x5d422d){var _0x114fc3=function(_0x295265){while(--_0x295265){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x114fc3(++_0x5d422d);}(_0xdf87,0x6c));var _0x7df8=function(_0x21d36d,_0x5cca54){_0x21d36d=_0x21d36d-0x0;var _0x5e0deb=_0xdf87[_0x21d36d];return _0x5e0deb;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x7df8('0x0'));var db=require(_0x7df8('0x1'))['db'];var config=require(_0x7df8('0x2'));function getValueFromLicense(_0x443d33,_0x4c0319){if(_0x443d33&&_0x4c0319){if(_0x4c0319[_0x7df8('0x3')]&&_0x4c0319['license']){var _0x5b1622=_0x4c0319[_0x7df8('0x3')];var _0x34af06=_0x4c0319[_0x7df8('0x4')];var _0x503441=_0x5b1622['split']('-')[0x4];var _0x5cbd97=_0x5b1622[_0x7df8('0x5')]('-')[0x0];var _0x274f06=crypto[_0x7df8('0x6')](_0x7df8('0x7'),util[_0x7df8('0x8')](_0x7df8('0x9'),_0x503441,_0x5b1622,_0x5cbd97));var _0x405d3c=_0x274f06[_0x7df8('0xa')](_0x34af06,_0x7df8('0xb'),'utf8');_0x405d3c+=_0x274f06['final'](_0x7df8('0xc'));var _0xbb8511=JSON[_0x7df8('0xd')](_0x405d3c);return _0xbb8511['hasOwnProperty'](_0x443d33)?_0xbb8511[_0x443d33]:null;}}return null;}function isLimit(_0x26c5cd,_0x5e21a8,_0x2f2dbf,_0xf4b344){var _0x580925=_0x5e21a8;return compose()[_0x7df8('0xe')](function(_0x53b270,_0x10b409,_0x49b4a6){return db['License'][_0x7df8('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x7df8('0x10')](function(_0x34f5ad){var _0x3981e6=getValueFromLicense(_0x26c5cd,_0x34f5ad);return _0x3981e6?_0x3981e6:_0x580925;})[_0x7df8('0x10')](function(_0x1b9a7c){_0x580925=_0x1b9a7c;return _0x2f2dbf[_0x7df8('0x11')](_0xf4b344);})[_0x7df8('0x10')](function(_0x1d60a5){if(_0x1d60a5>=_0x580925){return _0x10b409[_0x7df8('0x12')](0x193)['json']({'message':util[_0x7df8('0x8')](_0x7df8('0x13'),_0x26c5cd)});}_0x49b4a6();})[_0x7df8('0x14')](function(_0x15bac2){_0x49b4a6(_0x15bac2);});});}function isUserLimit(){return isLimit(_0x7df8('0x15'),0x1,db[_0x7df8('0x16')],{'where':{'$or':[{'role':_0x7df8('0x17')},{'role':_0x7df8('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5502ecc..bf4eb0b 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 _0x63a9=['\x20IS\x20NULL)','NOT\x20IN\x20?','=\x20?','$startsWith','$endsWith','$lt','<\x20?','$gt','$lte','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','$substring','start','utcOffset','add','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','slice','split','shift','match','forEach','filter','indexOf','push','DATE','$eq','operator','$between','value','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20'];(function(_0x7059b0,_0x19fb4f){var _0x4c87d7=function(_0x4cd772){while(--_0x4cd772){_0x7059b0['push'](_0x7059b0['shift']());}};_0x4c87d7(++_0x19fb4f);}(_0x63a9,0x71));var _0x963a=function(_0x38ab39,_0x1f7593){_0x38ab39=_0x38ab39-0x0;var _0xc94625=_0x63a9[_0x38ab39];return _0xc94625;};'use strict';var _=require('lodash');var moment=require(_0x963a('0x0'));exports['parseSearch']=function(_0x5376b9){var _0x439309={'conditions':[]};_0x439309[_0x963a('0x1')]=_[_0x963a('0x2')](_0x5376b9,_0x963a('0x3'))?'or':_0x963a('0x4');var _0x4a85c6=_0x5376b9[_0x963a('0x5')](_0x963a('0x6'),'')['replace'](_0x963a('0x3'),'')['split']('||');for(var _0x197ae7=0x0;_0x197ae7<_0x4a85c6[_0x963a('0x7')];_0x197ae7++){var _0x2c0dfc=_0x4a85c6[_0x197ae7]['split'](':=');var _0x28811c=_0x2c0dfc[0x0];var _0x4185a4=_0x2c0dfc[_0x963a('0x8')](0x1);_0x4185a4['forEach'](function(_0x599d65){var _0x235171=_0x599d65[_0x963a('0x9')]('[')[_0x963a('0xa')]();var _0x1e468c=_0x599d65[_0x963a('0xb')](/\[(.*?)\]/g);_0x1e468c[_0x963a('0xc')](function(_0x29283e){var _0x403e96=_0x29283e[_0x963a('0x9')]('[')[_0x963a('0xd')](function(_0xf35f22){return _0xf35f22[_0x963a('0xe')](']')>-0x1;})['map'](function(_0x3f7d60){return _0x3f7d60[_0x963a('0x9')](']')[0x0];})[0x0];_0x439309['conditions'][_0x963a('0xf')]({'field':_0x28811c,'operator':_0x235171,'value':_0x403e96});});});}return _0x439309;};exports['buildExpression']=function(_0x44dc85,_0x2fa808,_0x3ba778){var _0x1a50fe={};if(_0x2fa808===_0x963a('0x10')){if(_0x3ba778['operator']===_0x963a('0x11')){_0x3ba778[_0x963a('0x12')]=_0x963a('0x13');_0x3ba778[_0x963a('0x14')]+=','+_0x3ba778[_0x963a('0x14')];}else if(_['includes'](['$gt','$lte'],_0x3ba778['operator'])){_0x3ba778['value']=moment(_0x3ba778[_0x963a('0x14')])['add'](0x1,_0x963a('0x15'))[_0x963a('0x16')](_0x963a('0x17'));}}if(_0x3ba778[_0x963a('0x18')]){_0x2fa808=_0x3ba778[_0x963a('0x18')];_0x1a50fe[_0x963a('0x19')]=_0x963a('0x1a')+_0x44dc85+'.'+_0x3ba778[_0x963a('0x1b')]+'\x20AS\x20'+_0x3ba778[_0x963a('0x18')]+')\x20'+parseOperator(_0x3ba778['operator']);}else{_0x1a50fe[_0x963a('0x19')]=_0x44dc85+'.'+_0x3ba778[_0x963a('0x1b')]+'\x20'+parseOperator(_0x3ba778['operator']);}if(_['includes']([_0x963a('0x1c'),_0x963a('0x1d')],_0x3ba778[_0x963a('0x12')]))_0x1a50fe['text']='('+_0x1a50fe[_0x963a('0x19')]+_0x963a('0x1e')+_0x44dc85+'.'+_0x3ba778[_0x963a('0x1b')]+_0x963a('0x1f');_0x1a50fe[_0x963a('0x14')]=parseValue(_0x2fa808,_0x3ba778['operator'],_0x3ba778[_0x963a('0x14')]);return _0x1a50fe;};function parseOperator(_0x2944e5){var _0x3674af;switch(_0x2944e5){case'$in':_0x3674af='IN\x20?';break;case _0x963a('0x1d'):_0x3674af=_0x963a('0x20');break;case _0x963a('0x11'):_0x3674af=_0x963a('0x21');break;case _0x963a('0x1c'):_0x3674af='<>\x20?';break;case'$substring':case _0x963a('0x22'):case _0x963a('0x23'):_0x3674af='LIKE\x20?';break;case _0x963a('0x24'):_0x3674af=_0x963a('0x25');break;case _0x963a('0x26'):_0x3674af='>\x20?';break;case _0x963a('0x27'):_0x3674af=_0x963a('0x28');break;case'$gte':_0x3674af=_0x963a('0x29');break;case _0x963a('0x13'):_0x3674af=_0x963a('0x2a');break;}return _0x3674af;}function parseValue(_0x6aaef5,_0xa0122c,_0x4c0931){var _0x41690f={'start':undefined,'end':undefined};switch(_0xa0122c){case _0x963a('0x2b'):case _0x963a('0x1d'):_0x41690f['start']=_0x4c0931[_0x963a('0x9')](',');break;case _0x963a('0x2c'):_0x41690f[_0x963a('0x2d')]='%'+_0x4c0931+'%';break;case'$startsWith':_0x41690f[_0x963a('0x2d')]=_0x4c0931+'%';break;case _0x963a('0x23'):_0x41690f['start']='%'+_0x4c0931;break;case _0x963a('0x13'):var _0x289d22=_0x4c0931[_0x963a('0x9')](',');var _0x4c0931=_0x289d22[_0x963a('0xa')]();var _0x5e8cc6=_0x289d22['pop']();if(_0x6aaef5==='DATE'){_0x4c0931=moment(_0x4c0931)[_0x963a('0x2e')](0x0,!![])[_0x963a('0x16')]();_0x5e8cc6=moment(_0x5e8cc6)[_0x963a('0x2e')](0x0,!![])[_0x963a('0x2f')](0x17,'hours')[_0x963a('0x2f')](0x3b,'minutes')[_0x963a('0x2f')](0x3b,'seconds')[_0x963a('0x16')]();}_0x41690f={'start':_0x4c0931,'end':_0x5e8cc6};break;default:_0x41690f['start']=_0x4c0931;break;}return _0x41690f;} \ No newline at end of file +var _0x5564=['$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$startsWith','$endsWith','$lt','>\x20?','>=\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','slice','forEach','filter','conditions','push','buildExpression','DATE','$eq','operator','$between','value','includes','$gt'];(function(_0x3f5290,_0x53c67c){var _0x8a452d=function(_0x312179){while(--_0x312179){_0x3f5290['push'](_0x3f5290['shift']());}};_0x8a452d(++_0x53c67c);}(_0x5564,0xe0));var _0x4556=function(_0x27519c,_0x3d6ac7){_0x27519c=_0x27519c-0x0;var _0x2b04a5=_0x5564[_0x27519c];return _0x2b04a5;};'use strict';var _=require(_0x4556('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x34fc4f){var _0x25b5b5={'conditions':[]};_0x25b5b5[_0x4556('0x1')]=_[_0x4556('0x2')](_0x34fc4f,_0x4556('0x3'))?'or':_0x4556('0x4');var _0x7fc62a=_0x34fc4f['replace'](_0x4556('0x5'),'')[_0x4556('0x6')](_0x4556('0x3'),'')[_0x4556('0x7')]('||');for(var _0x33b058=0x0;_0x33b058<_0x7fc62a['length'];_0x33b058++){var _0x3e9972=_0x7fc62a[_0x33b058]['split'](':=');var _0xdfe27=_0x3e9972[0x0];var _0x1ab88c=_0x3e9972[_0x4556('0x8')](0x1);_0x1ab88c[_0x4556('0x9')](function(_0x1a67aa){var _0x5d44df=_0x1a67aa['split']('[')['shift']();var _0x333b0f=_0x1a67aa['match'](/\[(.*?)\]/g);_0x333b0f[_0x4556('0x9')](function(_0x3d58b3){var _0x2ab4dc=_0x3d58b3['split']('[')[_0x4556('0xa')](function(_0x7cc45a){return _0x7cc45a['indexOf'](']')>-0x1;})['map'](function(_0x4c1c63){return _0x4c1c63[_0x4556('0x7')](']')[0x0];})[0x0];_0x25b5b5[_0x4556('0xb')][_0x4556('0xc')]({'field':_0xdfe27,'operator':_0x5d44df,'value':_0x2ab4dc});});});}return _0x25b5b5;};exports[_0x4556('0xd')]=function(_0x3fe89c,_0x37029e,_0x456fb9){var _0x293d08={};if(_0x37029e===_0x4556('0xe')){if(_0x456fb9['operator']===_0x4556('0xf')){_0x456fb9[_0x4556('0x10')]=_0x4556('0x11');_0x456fb9[_0x4556('0x12')]+=','+_0x456fb9[_0x4556('0x12')];}else if(_[_0x4556('0x13')]([_0x4556('0x14'),_0x4556('0x15')],_0x456fb9[_0x4556('0x10')])){_0x456fb9[_0x4556('0x12')]=moment(_0x456fb9[_0x4556('0x12')])[_0x4556('0x16')](0x1,_0x4556('0x17'))[_0x4556('0x18')](_0x4556('0x19'));}}if(_0x456fb9[_0x4556('0x1a')]){_0x37029e=_0x456fb9['castTo'];_0x293d08[_0x4556('0x1b')]=_0x4556('0x1c')+_0x3fe89c+'.'+_0x456fb9[_0x4556('0x1d')]+_0x4556('0x1e')+_0x456fb9[_0x4556('0x1a')]+')\x20'+parseOperator(_0x456fb9[_0x4556('0x10')]);}else{_0x293d08[_0x4556('0x1b')]=_0x3fe89c+'.'+_0x456fb9['field']+'\x20'+parseOperator(_0x456fb9[_0x4556('0x10')]);}if(_[_0x4556('0x13')]([_0x4556('0x1f'),_0x4556('0x20')],_0x456fb9[_0x4556('0x10')]))_0x293d08[_0x4556('0x1b')]='('+_0x293d08[_0x4556('0x1b')]+'\x20OR\x20'+_0x3fe89c+'.'+_0x456fb9[_0x4556('0x1d')]+_0x4556('0x21');_0x293d08[_0x4556('0x12')]=parseValue(_0x37029e,_0x456fb9['operator'],_0x456fb9[_0x4556('0x12')]);return _0x293d08;};function parseOperator(_0x4bc011){var _0x555eb3;switch(_0x4bc011){case _0x4556('0x22'):_0x555eb3=_0x4556('0x23');break;case _0x4556('0x20'):_0x555eb3='NOT\x20IN\x20?';break;case'$eq':_0x555eb3=_0x4556('0x24');break;case _0x4556('0x1f'):_0x555eb3='<>\x20?';break;case _0x4556('0x25'):case _0x4556('0x26'):case _0x4556('0x27'):_0x555eb3='LIKE\x20?';break;case _0x4556('0x28'):_0x555eb3='<\x20?';break;case _0x4556('0x14'):_0x555eb3=_0x4556('0x29');break;case _0x4556('0x15'):_0x555eb3='<=\x20?';break;case'$gte':_0x555eb3=_0x4556('0x2a');break;case _0x4556('0x11'):_0x555eb3='BETWEEN\x20?\x20AND\x20?';break;}return _0x555eb3;}function parseValue(_0xc6a1a1,_0x4912ab,_0x134966){var _0x3f5130={'start':undefined,'end':undefined};switch(_0x4912ab){case _0x4556('0x22'):case _0x4556('0x20'):_0x3f5130[_0x4556('0x2b')]=_0x134966[_0x4556('0x7')](',');break;case'$substring':_0x3f5130[_0x4556('0x2b')]='%'+_0x134966+'%';break;case _0x4556('0x26'):_0x3f5130[_0x4556('0x2b')]=_0x134966+'%';break;case _0x4556('0x27'):_0x3f5130[_0x4556('0x2b')]='%'+_0x134966;break;case'$between':var _0x1a65b7=_0x134966[_0x4556('0x7')](',');var _0x134966=_0x1a65b7['shift']();var _0x47e407=_0x1a65b7[_0x4556('0x2c')]();if(_0xc6a1a1===_0x4556('0xe')){_0x134966=moment(_0x134966)[_0x4556('0x2d')](0x0,!![])[_0x4556('0x18')]();_0x47e407=moment(_0x47e407)[_0x4556('0x2d')](0x0,!![])[_0x4556('0x16')](0x17,_0x4556('0x2e'))[_0x4556('0x16')](0x3b,_0x4556('0x2f'))['add'](0x3b,_0x4556('0x30'))['format']();}_0x3f5130={'start':_0x134966,'end':_0x47e407};break;default:_0x3f5130[_0x4556('0x2b')]=_0x134966;break;}return _0x3f5130;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8d3c8be..e683b72 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 _0x81bd=['lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','isPlainObject','format','utc','$lte','YYYY-MM-DD','subtract','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','unsigned','DESC','col','ASC','omit','length','isObject','isString','unset','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','join','getOptions','query','$id','map','name','intersection','model','attributes','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x81bd,0x7c));var _0xd81b=function(_0x4dca4f,_0x3d3989){_0x4dca4f=_0x4dca4f-0x0;var _0xb1f24e=_0x81bd[_0x4dca4f];return _0xb1f24e;};'use strict';var _=require(_0xd81b('0x0'));var sequelize=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2337b1){var _0x2d27cb=['ne'];try{var _0x2ec03a=JSON[_0xd81b('0x3')](_0x2337b1);var _0x54e096=Object[_0xd81b('0x4')](_0x2ec03a)[0x0];return _0x2d27cb[_0xd81b('0x5')](_0x54e096);}catch(_0x1b6cfe){return![];}}function getOperatorValue(_0x4d8e7e){var _0x42a0aa=JSON[_0xd81b('0x3')](_0x4d8e7e);var _0x1f3f2c=Object['keys'](_0x42a0aa)[0x0];var _0x5e14e8=_0x42a0aa[_0x1f3f2c];return{['$'+_0x1f3f2c]:_0x5e14e8};}exports[_0xd81b('0x6')]=function(_0x5468d5){var _0x223515=null;if(_0x5468d5){_0x223515=_0x5468d5[_0xd81b('0x7')](',');}return _0x223515;};exports[_0xd81b('0x8')]=function(_0x86dab6,_0x17fba4){var _0x1ff60f={};if(!_[_0xd81b('0x9')](_0x86dab6)){_[_0xd81b('0xa')](_0x86dab6,function(_0x2090e1,_0x23c789){try{if(_0x17fba4){var _0x215b92=_[_0xd81b('0xb')](_0x17fba4,{'name':_0x23c789})||{};if(hasSequelizeOperator(_0x2090e1)){_0x1ff60f[_0x23c789]=getOperatorValue(_0x2090e1);}else if(_0x215b92[_0xd81b('0xc')]==='DATE'&&_[_0xd81b('0xd')](_0x2090e1)){var _0x57f71d=JSON[_0xd81b('0x3')](_0x2090e1);var _0xe75568={'$gte':moment(moment(_0x57f71d['$gte'])[_0xd81b('0xe')]('YYYY-MM-DD'))[_0xd81b('0xf')]()[_0xd81b('0xe')](),'$lte':moment(moment(_0x57f71d[_0xd81b('0x10')])[_0xd81b('0xe')](_0xd81b('0x11')))['utc']()[_0xd81b('0x12')](0x1,'s')[_0xd81b('0xe')]()};_0x1ff60f[_0x23c789]=_0xe75568;}else if(_0x215b92['name']===_0xd81b('0x13')){_0x1ff60f[_0x23c789]=_0x2090e1;}else{_0x1ff60f[_0x23c789]=_[_0xd81b('0x14')](_0x2090e1)?_0x2090e1:JSON[_0xd81b('0x3')](_0x2090e1);}}else{_0x1ff60f[_0x23c789]=_[_0xd81b('0x14')](_0x2090e1)?_0x2090e1:JSON[_0xd81b('0x3')](_0x2090e1);}}catch(_0xc49b8d){_0x1ff60f[_0x23c789]=_0x2090e1[_0xd81b('0x7')](',');}});}return _0x1ff60f;};exports[_0xd81b('0x15')]=function(_0x1c34c5){_0x1c34c5=parseInt(_0x1c34c5,0xa);if(!_0x1c34c5||_0x1c34c5<0x0){_0x1c34c5=LIMIT_VALUE;}return _0x1c34c5;};exports[_0xd81b('0x16')]=function(_0x1ff3c6){_0x1ff3c6=parseInt(_0x1ff3c6,0xa);if(!_0x1ff3c6||_0x1ff3c6<0x0){_0x1ff3c6=0x0;}return _0x1ff3c6;};exports[_0xd81b('0x17')]=function(_0xfa27e0){var _0x3518f0,_0x156894=null;if(_0xfa27e0){_0x3518f0=_0xfa27e0[_0xd81b('0x7')](',');_0x156894=_['map'](_0x3518f0,function(_0x4d566e){if(_0x4d566e[_0xd81b('0x18')]('-')===0x0){return[_0x4d566e===_0xd81b('0x19')?sequelize[_0xd81b('0x1a')](sequelize['col'](_0xd81b('0x19')),_0xd81b('0x1b')):_0x4d566e['substr'](0x1),_0xd81b('0x1c')];}else{return[_0x4d566e===_0xd81b('0x19')?sequelize[_0xd81b('0x1a')](sequelize[_0xd81b('0x1d')](_0xd81b('0x19')),_0xd81b('0x1b')):_0x4d566e,_0xd81b('0x1e')];}});}return _0x156894;};exports[_0xd81b('0x1f')]=function(_0x341aec,_0x212c4e){if(_[_0xd81b('0x9')](_0x341aec)){return _0x341aec;}if(_[_0xd81b('0x14')](_0x341aec)){for(var _0x596389=0x0;_0x596389<_0x341aec[_0xd81b('0x20')];_0x596389+=0x1){_0x341aec[_0x596389]=this[_0xd81b('0x1f')](_0x341aec[_0x596389],_0x212c4e);}return _0x341aec;}if(!_[_0xd81b('0x21')](_0x341aec)){return _0x341aec;}if(_[_0xd81b('0x22')](_0x212c4e)){_0x212c4e=[_0x212c4e];}if(!_[_0xd81b('0x14')](_0x212c4e)){return _0x341aec;}for(var _0x2d0d02=0x0;_0x2d0d02<_0x212c4e[_0xd81b('0x20')];_0x2d0d02+=0x1){_[_0xd81b('0x23')](_0x341aec,_0x212c4e[_0x2d0d02]);}for(var _0x10a561 in _0x341aec){if(_0x341aec['hasOwnProperty'](_0x10a561)){_0x341aec[_0x10a561]=this[_0xd81b('0x1f')](_0x341aec[_0x10a561],_0x212c4e);}}return _0x341aec;};exports['isNumeric']=function(_0x5c8aee){return _0x5c8aee[_0xd81b('0x24')](RegExp(_0xd81b('0x25')))?!![]:![];};exports['isEmail']=function(_0x481454){return _0x481454[_0xd81b('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xd81b('0x26')]=function(_0x1b1434){var _0x289f54=[];_0x1b1434[_0xd81b('0x7')](/[ ,]+/)[_0xd81b('0x27')](function(_0x5527ed){_0x5527ed=_0x5527ed[_0xd81b('0x28')](/([^:]")"+/g,'$1');_0x5527ed='+'+_0x5527ed+'*';var _0x26f629=/[ `!@#$%^&*()_\-?~]/;if(_0x5527ed['match'](_0x26f629))_0x5527ed='\x22'+_0x5527ed+'\x22';_0x289f54['push'](_0x5527ed);});return _0x289f54[_0xd81b('0x29')]('\x20');};exports[_0xd81b('0x2a')]=function(_0x50472a,_0x50ce25,_0x5317b2){var _0x322991={},_0x3ead68={};if(_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x2c')]){_0x50ce25[_0xd81b('0x2b')]['id']=_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x2c')];delete _0x50ce25['query'][_0xd81b('0x2c')];}_0x322991['model']=_[_0xd81b('0x2d')](_0x50472a,_0xd81b('0x2e'));_0x322991[_0xd81b('0x2b')]=_[_0xd81b('0x4')](_0x50ce25[_0xd81b('0x2b')]);_0x322991[_0xd81b('0x8')]=_[_0xd81b('0x2f')](_0x322991[_0xd81b('0x30')],_0x322991[_0xd81b('0x2b')]);_0x3ead68[_0xd81b('0x31')]=_[_0xd81b('0x2f')](_0x322991[_0xd81b('0x30')],this[_0xd81b('0x6')](_0x50ce25['query']['fields']));_0x3ead68[_0xd81b('0x31')]=_0x3ead68[_0xd81b('0x31')][_0xd81b('0x20')]?_0x3ead68['attributes']:_0x322991[_0xd81b('0x30')];if(!_0x50ce25[_0xd81b('0x2b')]['hasOwnProperty'](_0xd81b('0x32'))){_0x3ead68[_0xd81b('0x15')]=this['limit'](_0x50ce25[_0xd81b('0x2b')]['limit']);_0x3ead68[_0xd81b('0x16')]=this[_0xd81b('0x16')](_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x16')]);}_0x3ead68['order']=this[_0xd81b('0x17')](_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x17')]);_0x3ead68[_0xd81b('0x33')]=this[_0xd81b('0x8')](_[_0xd81b('0x34')](_0x50ce25[_0xd81b('0x2b')],_0x322991['filters']),_0x50472a);if(_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')]){var _0x5185fe=_0x50472a;var _0x5065a0=_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')];if(typeof _0x5065a0===_0xd81b('0x36')){_0x5185fe=_[_0xd81b('0x35')](_0x50472a,function(_0x29bddd){return _['includes'](_0x5065a0[_0xd81b('0x37')],_0x29bddd[_0xd81b('0x2e')]);});_0x5065a0=_0x5065a0[_0xd81b('0x38')];}_0x3ead68[_0xd81b('0x33')]=_[_0xd81b('0x39')](_0x3ead68[_0xd81b('0x33')],{'$or':_[_0xd81b('0x2d')](_0x5185fe,function(_0x486f0d){if(_0x486f0d[_0xd81b('0xc')]!==_0xd81b('0x3a')){if(_0x5317b2){return sequelize[_0xd81b('0x33')](sequelize['fn']('lower',sequelize[_0xd81b('0x1d')](_0x486f0d[_0xd81b('0x2e')])),{'$like':sequelize['fn'](_0xd81b('0x3b'),'%'+_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')]+'%')});}else{var _0x194d2a={};_0x194d2a[_0x486f0d[_0xd81b('0x2e')]]={'$like':'%'+_0x50ce25[_0xd81b('0x2b')]['filter']+'%'};return _0x194d2a;}}})});}_0x3ead68=_['merge']({},_0x3ead68,_0x50ce25[_0xd81b('0x3c')]);return _0x3ead68;}; \ No newline at end of file +var _0xd67b=['attributes','nolimit','offset','sort','where','filter','object','columns','value','merge','lower','options','sequelize','includes','parse','keys','fields','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','isArray','limit','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isEmpty','length','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','getOptions','$id','query','model','intersection'];(function(_0x3f70e2,_0x57a580){var _0x371537=function(_0x453083){while(--_0x453083){_0x3f70e2['push'](_0x3f70e2['shift']());}};_0x371537(++_0x57a580);}(_0xd67b,0x133));var _0xbd67=function(_0x1517e9,_0x1cbfdf){_0x1517e9=_0x1517e9-0x0;var _0x2f1299=_0xd67b[_0x1517e9];return _0x2f1299;};'use strict';var _=require('lodash');var sequelize=require(_0xbd67('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1da24d){var _0x280954=['ne'];try{var _0x317e33=JSON['parse'](_0x1da24d);var _0x40e384=Object['keys'](_0x317e33)[0x0];return _0x280954[_0xbd67('0x1')](_0x40e384);}catch(_0x5a827b){return![];}}function getOperatorValue(_0x309962){var _0xa5c384=JSON[_0xbd67('0x2')](_0x309962);var _0x27b016=Object[_0xbd67('0x3')](_0xa5c384)[0x0];var _0x72f9ac=_0xa5c384[_0x27b016];return{['$'+_0x27b016]:_0x72f9ac};}exports[_0xbd67('0x4')]=function(_0xfad775){var _0x1da7f1=null;if(_0xfad775){_0x1da7f1=_0xfad775[_0xbd67('0x5')](',');}return _0x1da7f1;};exports[_0xbd67('0x6')]=function(_0x3a7f43,_0x283f2f){var _0x52b981={};if(!_['isEmpty'](_0x3a7f43)){_[_0xbd67('0x7')](_0x3a7f43,function(_0x5aad7a,_0x388d95){try{if(_0x283f2f){var _0xb6b4b5=_[_0xbd67('0x8')](_0x283f2f,{'name':_0x388d95})||{};if(hasSequelizeOperator(_0x5aad7a)){_0x52b981[_0x388d95]=getOperatorValue(_0x5aad7a);}else if(_0xb6b4b5[_0xbd67('0x9')]===_0xbd67('0xa')&&_[_0xbd67('0xb')](_0x5aad7a)){var _0x3621ad=JSON[_0xbd67('0x2')](_0x5aad7a);var _0x341b2b={'$gte':moment(moment(_0x3621ad[_0xbd67('0xc')])['format'](_0xbd67('0xd')))[_0xbd67('0xe')]()[_0xbd67('0xf')](),'$lte':moment(moment(_0x3621ad[_0xbd67('0x10')])[_0xbd67('0xf')](_0xbd67('0xd')))[_0xbd67('0xe')]()[_0xbd67('0x11')](0x1,'s')[_0xbd67('0xf')]()};_0x52b981[_0x388d95]=_0x341b2b;}else if(_0xb6b4b5[_0xbd67('0x12')]==='uniqueid'){_0x52b981[_0x388d95]=_0x5aad7a;}else{_0x52b981[_0x388d95]=_['isArray'](_0x5aad7a)?_0x5aad7a:JSON[_0xbd67('0x2')](_0x5aad7a);}}else{_0x52b981[_0x388d95]=_[_0xbd67('0x13')](_0x5aad7a)?_0x5aad7a:JSON[_0xbd67('0x2')](_0x5aad7a);}}catch(_0x47d066){_0x52b981[_0x388d95]=_0x5aad7a[_0xbd67('0x5')](',');}});}return _0x52b981;};exports[_0xbd67('0x14')]=function(_0x357ff2){_0x357ff2=parseInt(_0x357ff2,0xa);if(!_0x357ff2||_0x357ff2<0x0){_0x357ff2=LIMIT_VALUE;}return _0x357ff2;};exports['offset']=function(_0x5906a2){_0x5906a2=parseInt(_0x5906a2,0xa);if(!_0x5906a2||_0x5906a2<0x0){_0x5906a2=0x0;}return _0x5906a2;};exports['sort']=function(_0x1f9193){var _0x4609b7,_0xb3f67f=null;if(_0x1f9193){_0x4609b7=_0x1f9193['split'](',');_0xb3f67f=_[_0xbd67('0x15')](_0x4609b7,function(_0x40ec96){if(_0x40ec96[_0xbd67('0x16')]('-')===0x0){return[_0x40ec96===_0xbd67('0x17')?sequelize[_0xbd67('0x18')](sequelize[_0xbd67('0x19')]('priority'),_0xbd67('0x1a')):_0x40ec96[_0xbd67('0x1b')](0x1),_0xbd67('0x1c')];}else{return[_0x40ec96===_0xbd67('0x17')?sequelize[_0xbd67('0x18')](sequelize[_0xbd67('0x19')](_0xbd67('0x17')),_0xbd67('0x1a')):_0x40ec96,_0xbd67('0x1d')];}});}return _0xb3f67f;};exports[_0xbd67('0x1e')]=function(_0x46b7ff,_0x57602d){if(_[_0xbd67('0x1f')](_0x46b7ff)){return _0x46b7ff;}if(_['isArray'](_0x46b7ff)){for(var _0x25bf7a=0x0;_0x25bf7a<_0x46b7ff[_0xbd67('0x20')];_0x25bf7a+=0x1){_0x46b7ff[_0x25bf7a]=this[_0xbd67('0x1e')](_0x46b7ff[_0x25bf7a],_0x57602d);}return _0x46b7ff;}if(!_['isObject'](_0x46b7ff)){return _0x46b7ff;}if(_[_0xbd67('0x21')](_0x57602d)){_0x57602d=[_0x57602d];}if(!_[_0xbd67('0x13')](_0x57602d)){return _0x46b7ff;}for(var _0x4dfa19=0x0;_0x4dfa19<_0x57602d[_0xbd67('0x20')];_0x4dfa19+=0x1){_[_0xbd67('0x22')](_0x46b7ff,_0x57602d[_0x4dfa19]);}for(var _0x374f1b in _0x46b7ff){if(_0x46b7ff[_0xbd67('0x23')](_0x374f1b)){_0x46b7ff[_0x374f1b]=this[_0xbd67('0x1e')](_0x46b7ff[_0x374f1b],_0x57602d);}}return _0x46b7ff;};exports['isNumeric']=function(_0x5975dc){return _0x5975dc[_0xbd67('0x24')](RegExp(_0xbd67('0x25')))?!![]:![];};exports[_0xbd67('0x26')]=function(_0x44eced){return _0x44eced[_0xbd67('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xbd67('0x27')]=function(_0x256137){var _0x2e123e=[];_0x256137[_0xbd67('0x5')](/[ ,]+/)[_0xbd67('0x28')](function(_0x5cb0ce){_0x5cb0ce=_0x5cb0ce['replace'](/([^:]")"+/g,'$1');_0x5cb0ce='+'+_0x5cb0ce+'*';var _0x5fcae8=/[ `!@#$%^&*()_\-?~]/;if(_0x5cb0ce[_0xbd67('0x24')](_0x5fcae8))_0x5cb0ce='\x22'+_0x5cb0ce+'\x22';_0x2e123e[_0xbd67('0x29')](_0x5cb0ce);});return _0x2e123e['join']('\x20');};exports[_0xbd67('0x2a')]=function(_0x15da85,_0xb3f593,_0x484989){var _0x4d1ce3={},_0x5186eb={};if(_0xb3f593['query'][_0xbd67('0x2b')]){_0xb3f593[_0xbd67('0x2c')]['id']=_0xb3f593[_0xbd67('0x2c')]['$id'];delete _0xb3f593['query'][_0xbd67('0x2b')];}_0x4d1ce3[_0xbd67('0x2d')]=_[_0xbd67('0x15')](_0x15da85,_0xbd67('0x12'));_0x4d1ce3[_0xbd67('0x2c')]=_[_0xbd67('0x3')](_0xb3f593['query']);_0x4d1ce3[_0xbd67('0x6')]=_[_0xbd67('0x2e')](_0x4d1ce3[_0xbd67('0x2d')],_0x4d1ce3['query']);_0x5186eb[_0xbd67('0x2f')]=_['intersection'](_0x4d1ce3[_0xbd67('0x2d')],this[_0xbd67('0x4')](_0xb3f593['query'][_0xbd67('0x4')]));_0x5186eb[_0xbd67('0x2f')]=_0x5186eb[_0xbd67('0x2f')][_0xbd67('0x20')]?_0x5186eb[_0xbd67('0x2f')]:_0x4d1ce3[_0xbd67('0x2d')];if(!_0xb3f593['query'][_0xbd67('0x23')](_0xbd67('0x30'))){_0x5186eb[_0xbd67('0x14')]=this[_0xbd67('0x14')](_0xb3f593[_0xbd67('0x2c')]['limit']);_0x5186eb['offset']=this[_0xbd67('0x31')](_0xb3f593[_0xbd67('0x2c')][_0xbd67('0x31')]);}_0x5186eb['order']=this[_0xbd67('0x32')](_0xb3f593[_0xbd67('0x2c')][_0xbd67('0x32')]);_0x5186eb[_0xbd67('0x33')]=this['filters'](_['pick'](_0xb3f593['query'],_0x4d1ce3['filters']),_0x15da85);if(_0xb3f593['query'][_0xbd67('0x34')]){var _0x5a6b2d=_0x15da85;var _0x4d08a6=_0xb3f593['query'][_0xbd67('0x34')];if(typeof _0x4d08a6===_0xbd67('0x35')){_0x5a6b2d=_[_0xbd67('0x34')](_0x15da85,function(_0x2ca134){return _['includes'](_0x4d08a6[_0xbd67('0x36')],_0x2ca134[_0xbd67('0x12')]);});_0x4d08a6=_0x4d08a6[_0xbd67('0x37')];}_0x5186eb[_0xbd67('0x33')]=_[_0xbd67('0x38')](_0x5186eb[_0xbd67('0x33')],{'$or':_[_0xbd67('0x15')](_0x5a6b2d,function(_0x532c9b){if(_0x532c9b[_0xbd67('0x9')]!=='VIRTUAL'){if(_0x484989){return sequelize[_0xbd67('0x33')](sequelize['fn'](_0xbd67('0x39'),sequelize[_0xbd67('0x19')](_0x532c9b[_0xbd67('0x12')])),{'$like':sequelize['fn'](_0xbd67('0x39'),'%'+_0xb3f593[_0xbd67('0x2c')][_0xbd67('0x34')]+'%')});}else{var _0xfe170b={};_0xfe170b[_0x532c9b['name']]={'$like':'%'+_0xb3f593[_0xbd67('0x2c')][_0xbd67('0x34')]+'%'};return _0xfe170b;}}})});}_0x5186eb=_['merge']({},_0x5186eb,_0xb3f593[_0xbd67('0x3a')]);return _0x5186eb;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d77f9b3..104be79 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +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(_0x1008b9,_0x40b907){var _0x346f4a=function(_0x6e92b2){while(--_0x6e92b2){_0x1008b9['push'](_0x1008b9['shift']());}};_0x346f4a(++_0x40b907);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 440c7b4..f1bd5ba 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 _0x7b37=['lodash','crypto','bimedia-machine-uuid','child_process','length','filter','family','IPv4','internal','concat','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring'];(function(_0x269beb,_0x443465){var _0x19f78d=function(_0x36abfe){while(--_0x36abfe){_0x269beb['push'](_0x269beb['shift']());}};_0x19f78d(++_0x443465);}(_0x7b37,0x1c7));var _0x77b3=function(_0x5d7463,_0x3dbc4a){_0x5d7463=_0x5d7463-0x0;var _0x316d29=_0x7b37[_0x5d7463];return _0x316d29;};'use strict';var _=require(_0x77b3('0x0'));var os=require('os');var crypto=require(_0x77b3('0x1'));var machine=require(_0x77b3('0x2'));var exec=require(_0x77b3('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0xbd7164=[];var _0x18820e=os['networkInterfaces']();var _0x441709=_['orderBy'](_['keys'](_0x18820e));for(var _0x41d03b=0x0;_0x41d03b<_0x441709[_0x77b3('0x4')];_0x41d03b++){var _0x2f7288=_0x18820e[_0x441709[_0x41d03b]][_0x77b3('0x5')](function(_0x10c023){return _0x10c023[_0x77b3('0x6')]===_0x77b3('0x7')&&_0x10c023[_0x77b3('0x8')]===![];});_0xbd7164=_0xbd7164[_0x77b3('0x9')](_0x2f7288);}return _0xbd7164;}function getFirstInterface(){var _0x44a1e2=_['head'](getInterfaces());return{'macAddress':_0x44a1e2&&_0x44a1e2[_0x77b3('0xa')]?_0x44a1e2[_0x77b3('0xa')]:'00:00:00:00:00:00','ipAddress':_0x44a1e2&&_0x44a1e2[_0x77b3('0xb')]?_0x44a1e2[_0x77b3('0xb')]:_0x77b3('0xc')};}exports[_0x77b3('0xd')]=getFirstInterface;function getCPUhash(){var _0x2fc834=_[_0x77b3('0xe')](os[_0x77b3('0xf')]()[_0x77b3('0x10')](function(_0x2c724f){return _0x2c724f[_0x77b3('0x11')];}))[_0x77b3('0x12')](':');return crypto[_0x77b3('0x13')](_0x77b3('0x14'))[_0x77b3('0x15')](_0x2fc834)[_0x77b3('0x16')]('hex');}exports[_0x77b3('0x17')]=function(){var _0x1f289c=os[_0x77b3('0x18')]();var _0x1b369f=/[0-9a-f-]{36}/;if(config[_0x77b3('0x19')]&&_0x1b369f[_0x77b3('0x1a')](config[_0x77b3('0x19')])){return config[_0x77b3('0x19')];}else if(_0x1f289c===_0x77b3('0x1b')){return exec(_0x77b3('0x1c'),{'encoding':_0x77b3('0x1d')})[_0x77b3('0x1e')]('\x0d\x0a','');}else{var _0x2d2a9d=getFirstInterface();var _0x4ef6bf=getCPUhash();var _0x3abe51=_0x4ef6bf+'|'+os[_0x77b3('0x1f')]()+'|'+_0x2d2a9d[_0x77b3('0x20')]+'|'+_0x2d2a9d[_0x77b3('0x21')];var _0x3c80d1=crypto['createHash'](_0x77b3('0x14'))[_0x77b3('0x15')](_0x3abe51)[_0x77b3('0x16')]('hex');return _0x3c80d1[_0x77b3('0x22')](0x0,0x8)+'-'+_0x3c80d1[_0x77b3('0x22')](0x8,0xc)+'-'+_0x3c80d1[_0x77b3('0x22')](0xc,0x10)+'-'+_0x3c80d1[_0x77b3('0x22')](0x10,0x14)+'-'+_0x3c80d1['substring'](0x14);}}; \ No newline at end of file +var _0x9990=['licenseToken','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest','hex','test'];(function(_0x1cde1e,_0x51be34){var _0x3e29b1=function(_0xe3ca2e){while(--_0xe3ca2e){_0x1cde1e['push'](_0x1cde1e['shift']());}};_0x3e29b1(++_0x51be34);}(_0x9990,0x1da));var _0x0999=function(_0x49e6ca,_0x3fb558){_0x49e6ca=_0x49e6ca-0x0;var _0x362189=_0x9990[_0x49e6ca];return _0x362189;};'use strict';var _=require(_0x0999('0x0'));var os=require('os');var crypto=require(_0x0999('0x1'));var machine=require(_0x0999('0x2'));var exec=require(_0x0999('0x3'))[_0x0999('0x4')];var config=require(_0x0999('0x5'));function getInterfaces(){var _0x3198cd=[];var _0x2173f8=os[_0x0999('0x6')]();var _0x611c99=_['orderBy'](_[_0x0999('0x7')](_0x2173f8));for(var _0x187c4f=0x0;_0x187c4f<_0x611c99[_0x0999('0x8')];_0x187c4f++){var _0x246143=_0x2173f8[_0x611c99[_0x187c4f]][_0x0999('0x9')](function(_0x58ebca){return _0x58ebca[_0x0999('0xa')]===_0x0999('0xb')&&_0x58ebca[_0x0999('0xc')]===![];});_0x3198cd=_0x3198cd[_0x0999('0xd')](_0x246143);}return _0x3198cd;}function getFirstInterface(){var _0x22c48d=_[_0x0999('0xe')](getInterfaces());return{'macAddress':_0x22c48d&&_0x22c48d[_0x0999('0xf')]?_0x22c48d[_0x0999('0xf')]:_0x0999('0x10'),'ipAddress':_0x22c48d&&_0x22c48d[_0x0999('0x11')]?_0x22c48d[_0x0999('0x11')]:_0x0999('0x12')};}exports[_0x0999('0x13')]=getFirstInterface;function getCPUhash(){var _0x1f2feb=_[_0x0999('0x14')](os[_0x0999('0x15')]()[_0x0999('0x16')](function(_0x13bc2f){return _0x13bc2f[_0x0999('0x17')];}))[_0x0999('0x18')](':');return crypto['createHash'](_0x0999('0x19'))[_0x0999('0x1a')](_0x1f2feb)[_0x0999('0x1b')](_0x0999('0x1c'));}exports['getUuid']=function(){var _0x11cf37=os['platform']();var _0x28e95a=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x28e95a[_0x0999('0x1d')](config[_0x0999('0x1e')])){return config[_0x0999('0x1e')];}else if(_0x11cf37==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x0999('0x1f')})['replace']('\x0d\x0a','');}else{var _0x5d81b3=getFirstInterface();var _0x17ea6c=getCPUhash();var _0x4ddf5d=_0x17ea6c+'|'+os[_0x0999('0x20')]()+'|'+_0x5d81b3[_0x0999('0x21')]+'|'+_0x5d81b3[_0x0999('0x22')];var _0x6590a8=crypto['createHash'](_0x0999('0x19'))[_0x0999('0x1a')](_0x4ddf5d)['digest'](_0x0999('0x1c'));return _0x6590a8[_0x0999('0x23')](0x0,0x8)+'-'+_0x6590a8['substring'](0x8,0xc)+'-'+_0x6590a8[_0x0999('0x23')](0xc,0x10)+'-'+_0x6590a8[_0x0999('0x23')](0x10,0x14)+'-'+_0x6590a8[_0x0999('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b7e33ed..18bf7f6 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 _0x0702=['../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','update','YYYY-MM-DD\x20HH:mm','diff','decryptString','error','finally','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','bluebird','pkginfo','version'];(function(_0x33cdb8,_0x374ca7){var _0x5ea84d=function(_0x4cc412){while(--_0x4cc412){_0x33cdb8['push'](_0x33cdb8['shift']());}};_0x5ea84d(++_0x374ca7);}(_0x0702,0x1d0));var _0x2070=function(_0xef7283,_0xaa6010){_0xef7283=_0xef7283-0x0;var _0x5bac58=_0x0702[_0xef7283];return _0x5bac58;};'use strict';var util=require('util');var moment=require(_0x2070('0x0'));var rp=require('request-promise');var BPromise=require(_0x2070('0x1'));var pkginfo=require(_0x2070('0x2'))(module,_0x2070('0x3'));var db=require(_0x2070('0x4'))['db'];var encryptor=require(_0x2070('0x5'));var hardware=require(_0x2070('0x6'));var logger=require(_0x2070('0x7'))(_0x2070('0x8'));var HOST=_0x2070('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1ff744){return new BPromise(function(_0x228883,_0x4ef12c){var _0x37a99e=util[_0x2070('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x1ff744,module[_0x2070('0xb')][_0x2070('0x3')]);if(oldToken){_0x37a99e=util[_0x2070('0xa')](_0x2070('0xc'),HOST,_0x1ff744,module[_0x2070('0xb')][_0x2070('0x3')],oldToken);}var _0x5139fa={'uri':_0x37a99e,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x5139fa)[_0x2070('0xd')](function(_0x30100a){_0x228883(_0x30100a);})[_0x2070('0xe')](function(_0x2984c2){_0x4ef12c(_0x2984c2);});});}function manageLicense(_0x1740fc,_0x170a20){var _0x12fe5f=_0x170a20[_0x2070('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x12fe5f[_0x2070('0x10')]!==_0x1740fc&&!_0x12fe5f[_0x2070('0x11')]){oldToken=_0x12fe5f[_0x2070('0x10')];}httpRequest(_0x1740fc)[_0x2070('0xd')](function(_0x19cf08){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x19cf08['active']){isOldTokenSent=![];if(!_0x12fe5f[_0x2070('0x8')]&&_0x12fe5f['license']!=_0x19cf08[_0x2070('0x8')]||_0x12fe5f[_0x2070('0x8')]&&_0x12fe5f[_0x2070('0x11')]){logger['info'](_0x2070('0x12'));}if(_0x12fe5f[_0x2070('0x8')]&&!_0x12fe5f[_0x2070('0x11')]&&_0x12fe5f[_0x2070('0x8')]!=_0x19cf08[_0x2070('0x8')]){logger[_0x2070('0x13')](_0x2070('0x14'));}if(_0x12fe5f[_0x2070('0x8')]&&!_0x12fe5f[_0x2070('0x11')]&&_0x12fe5f['license']==_0x19cf08[_0x2070('0x8')]){return _0x170a20;}return _0x170a20['update']({'data1':_0x1740fc,'data2':null,'license':_0x19cf08[_0x2070('0x8')]});}else{if(_0x19cf08[_0x2070('0x8')]||_0x12fe5f['license']){if(!_0x12fe5f[_0x2070('0x11')]){if(_0x12fe5f[_0x2070('0x10')]==_0x1740fc){GRAY_PERIOD_REASON=_0x2070('0x15');logger['info'](_0x2070('0x16'));}else{GRAY_PERIOD_REASON=_0x2070('0x17');logger[_0x2070('0x13')](_0x2070('0x18'),_0x12fe5f['data1'],_0x1740fc);}logger[_0x2070('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x2070('0x19')](),moment()[_0x2070('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x170a20[_0x2070('0x1a')]({'data2':encryptor['encryptString'](moment()['format'](_0x2070('0x1b')))});}else{if(moment()[_0x2070('0x1c')](encryptor[_0x2070('0x1d')](_0x12fe5f[_0x2070('0x11')]),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x2070('0xa')](_0x2070('0x1b')));isOldTokenSent=![];return _0x170a20['update']({'data1':_0x1740fc,'data2':null,'license':null});}}}else{if(_0x12fe5f[_0x2070('0x10')]!=_0x1740fc){logger[_0x2070('0x13')](_0x2070('0x18'),_0x12fe5f[_0x2070('0x10')],_0x1740fc);return _0x170a20[_0x2070('0x1a')]({'data1':_0x1740fc,'data2':null,'license':null});}}}return _0x170a20;})['then'](function(_0x11d5c4){_0x170a20=_0x11d5c4;})['catch'](function(_0x4378d1){logger[_0x2070('0x1e')](_0x4378d1['message']);})[_0x2070('0x1f')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x170a20);},TIME);});}function defaultLicense(){var _0x1899c2=hardware['getUuid']();if(_0x1899c2){return db[_0x2070('0x20')][_0x2070('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x1899c2}})['spread'](function(_0x393ad3,_0x3b4974){logger['info'](_0x2070('0x22'),_0x1899c2);manageLicense(_0x1899c2,_0x393ad3);})['catch'](function(_0x36a5bc){logger[_0x2070('0x1e')](_0x36a5bc['message']);});}}exports[_0x2070('0x23')]=defaultLicense; \ No newline at end of file +var _0xf68d=['data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch'];(function(_0x47aded,_0xb76625){var _0x505e9a=function(_0x68696d){while(--_0x68696d){_0x47aded['push'](_0x47aded['shift']());}};_0x505e9a(++_0xb76625);}(_0xf68d,0x92));var _0xdf68=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf68d[_0x3ff085];return _0x2b68c3;};'use strict';var util=require(_0xdf68('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xdf68('0x1'));var pkginfo=require(_0xdf68('0x2'))(module,_0xdf68('0x3'));var db=require(_0xdf68('0x4'))['db'];var encryptor=require(_0xdf68('0x5'));var hardware=require(_0xdf68('0x6'));var logger=require('../logger')('license');var HOST=_0xdf68('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xad5f2f){return new BPromise(function(_0x5489e2,_0x1083b4){var _0x3efc63=util[_0xdf68('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0xad5f2f,module[_0xdf68('0x9')][_0xdf68('0x3')]);if(oldToken){_0x3efc63=util[_0xdf68('0x8')](_0xdf68('0xa'),HOST,_0xad5f2f,module[_0xdf68('0x9')]['version'],oldToken);}var _0x5bf525={'uri':_0x3efc63,'method':_0xdf68('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x5bf525)[_0xdf68('0xc')](function(_0x4e593a){_0x5489e2(_0x4e593a);})[_0xdf68('0xd')](function(_0x3739d0){_0x1083b4(_0x3739d0);});});}function manageLicense(_0x1d6911,_0x92c27e){var _0xd4d71d=_0x92c27e['get']({'plain':!![]});if(!isOldTokenSent&&_0xd4d71d['data1']!==_0x1d6911&&!_0xd4d71d[_0xdf68('0xe')]){oldToken=_0xd4d71d['data1'];}httpRequest(_0x1d6911)[_0xdf68('0xc')](function(_0x593f3b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x593f3b[_0xdf68('0xf')]){isOldTokenSent=![];if(!_0xd4d71d['license']&&_0xd4d71d[_0xdf68('0x10')]!=_0x593f3b['license']||_0xd4d71d['license']&&_0xd4d71d[_0xdf68('0xe')]){logger[_0xdf68('0x11')](_0xdf68('0x12'));}if(_0xd4d71d[_0xdf68('0x10')]&&!_0xd4d71d['data2']&&_0xd4d71d[_0xdf68('0x10')]!=_0x593f3b[_0xdf68('0x10')]){logger[_0xdf68('0x11')](_0xdf68('0x13'));}if(_0xd4d71d[_0xdf68('0x10')]&&!_0xd4d71d[_0xdf68('0xe')]&&_0xd4d71d[_0xdf68('0x10')]==_0x593f3b[_0xdf68('0x10')]){return _0x92c27e;}return _0x92c27e['update']({'data1':_0x1d6911,'data2':null,'license':_0x593f3b[_0xdf68('0x10')]});}else{if(_0x593f3b[_0xdf68('0x10')]||_0xd4d71d[_0xdf68('0x10')]){if(!_0xd4d71d[_0xdf68('0xe')]){if(_0xd4d71d[_0xdf68('0x14')]==_0x1d6911){GRAY_PERIOD_REASON=_0xdf68('0x15');logger['info'](_0xdf68('0x16'));}else{GRAY_PERIOD_REASON=_0xdf68('0x17');logger[_0xdf68('0x11')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xd4d71d[_0xdf68('0x14')],_0x1d6911);}logger[_0xdf68('0x11')](_0xdf68('0x18'),GRAY_PERIOD_REASON[_0xdf68('0x19')](),moment()[_0xdf68('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x92c27e[_0xdf68('0x1a')]({'data2':encryptor['encryptString'](moment()[_0xdf68('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xdf68('0x1b')](encryptor[_0xdf68('0x1c')](_0xd4d71d[_0xdf68('0xe')]),_0xdf68('0x1d'))>DAYS){logger[_0xdf68('0x11')](_0xdf68('0x1e'),moment()['format'](_0xdf68('0x1f')));isOldTokenSent=![];return _0x92c27e[_0xdf68('0x1a')]({'data1':_0x1d6911,'data2':null,'license':null});}}}else{if(_0xd4d71d[_0xdf68('0x14')]!=_0x1d6911){logger[_0xdf68('0x11')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xd4d71d['data1'],_0x1d6911);return _0x92c27e[_0xdf68('0x1a')]({'data1':_0x1d6911,'data2':null,'license':null});}}}return _0x92c27e;})['then'](function(_0x3a5b74){_0x92c27e=_0x3a5b74;})['catch'](function(_0x3bdc8b){logger['error'](_0x3bdc8b['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x92c27e);},TIME);});}function defaultLicense(){var _0x368218=hardware[_0xdf68('0x20')]();if(_0x368218){return db[_0xdf68('0x21')][_0xdf68('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x368218}})[_0xdf68('0x23')](function(_0x3174d6,_0x3ec444){logger[_0xdf68('0x11')](_0xdf68('0x24'),_0x368218);manageLicense(_0x368218,_0x3174d6);})[_0xdf68('0xd')](function(_0x36a5b5){logger[_0xdf68('0x25')](_0x36a5b5[_0xdf68('0x26')]);});}}exports[_0xdf68('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3306749..09ff830 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 _0xd19c=['add','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin','user','telephone','users','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline'];(function(_0x17fbe1,_0x14876c){var _0x3ec29a=function(_0x2edf85){while(--_0x2edf85){_0x17fbe1['push'](_0x17fbe1['shift']());}};_0x3ec29a(++_0x14876c);}(_0xd19c,0x6e));var _0xcd19=function(_0x5e9122,_0x49de1b){_0x5e9122=_0x5e9122-0x0;var _0x25afa0=_0xd19c[_0x5e9122];return _0x25afa0;};'use strict';var util=require(_0xcd19('0x0'));var _=require('lodash');var moment=require(_0xcd19('0x1'));var BPromise=require('bluebird');var hardware=require(_0xcd19('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xcd19('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcd19('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcd19('0x5'),'machineUuid':hardware[_0xcd19('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcd19('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xcd19('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x508c57){return new BPromise(function(_0x328673,_0x553753){return db[_0xcd19('0x7')]['find'](_[_0xcd19('0x8')](_0x508c57,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2a716d){return checkLicense(_0x2a716d,null);})[_0xcd19('0x9')](function(_0x486656){_0x328673(_0x486656);return;})[_0xcd19('0xa')](function(_0x201bcb){_0x553753(_0x201bcb);});});}function checkLicense(_0x17dca7,_0x2fbbdb){if(!_0x17dca7){demoLicense[_0xcd19('0xb')]=_0x17dca7[_0xcd19('0xc')];return demoLicense;}try{var _0x436f1d=_0x2fbbdb||_0x17dca7[_0xcd19('0xd')];if(_[_0xcd19('0xe')](_0x436f1d)){throw new Error(_0xcd19('0xf'));}var _0x451de6=_0x17dca7[_0xcd19('0xc')];var _0x51eeb8=_0x17dca7[_0xcd19('0x10')];var _0x5791e8=_0x451de6['split']('-')[0x4];var _0x5cc666=_0x451de6['split']('-')[0x0];var _0x61757f=encryptor[_0xcd19('0x11')](_0x436f1d,util[_0xcd19('0x12')](_0xcd19('0x13'),_0x5791e8,_0x451de6,_0x5cc666));var _0x36931a=JSON[_0xcd19('0x14')](_0x61757f);_0x36931a[_0xcd19('0x15')]=![];_0x36931a['uuid']=_0x451de6;_0x36931a[_0xcd19('0x16')]=hardware[_0xcd19('0x6')]();if(_0x51eeb8){var _0x5ead2f=encryptor['decryptString'](_0x51eeb8);_0x36931a[_0xcd19('0x17')]=_0x5ead2f;_0x36931a[_0xcd19('0x18')]=moment(_0x5ead2f)[_0xcd19('0x19')](0x7,'days')[_0xcd19('0x12')]();_0x36931a['grayReason']=_0x36931a[_0xcd19('0xb')]!=_0x36931a['machineUuid']?_0xcd19('0x1a'):_0xcd19('0x1b');}return _0x36931a;}catch(_0x15114a){breakingLicense['uuid']=_0x17dca7[_0xcd19('0xc')];breakingLicense[_0xcd19('0x1c')]=_0x15114a[_0xcd19('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2e08be,_0x218685){getLicense()[_0xcd19('0x9')](function(_0x46ba19){return db[_0xcd19('0x1d')][_0xcd19('0x1e')]({'attributes':[_0xcd19('0x1f'),[db[_0xcd19('0x20')]['fn'](_0xcd19('0x21'),db[_0xcd19('0x20')]['col']('role')),'count']],'group':_0xcd19('0x1f'),'where':{'role':{'$or':[_0xcd19('0x22'),_0xcd19('0x23'),_0xcd19('0x24')]}},'raw':!![]})[_0xcd19('0x9')](function(_0x25386a){var _0x5389ae={'user':_0x46ba19[_0xcd19('0x25')]||0x0,'telephone':_0x46ba19[_0xcd19('0x26')]||0x0};_0x25386a[_0xcd19('0x27')](function(_0x4d6399){var _0x45237c=_0x4d6399[_0xcd19('0x1f')]===_0xcd19('0x22')?_0xcd19('0x23'):_0x4d6399[_0xcd19('0x1f')];_0x5389ae[_0x45237c]-=_0x4d6399[_0xcd19('0x28')];if(_0x5389ae[_0x45237c]<0x0)_0x5389ae[_0x45237c]=0x0;});_0x2e08be(_0x5389ae);return;});})[_0xcd19('0xa')](function(_0xf3b758){_0x218685(_0xf3b758);});});}function checkUserLimits(_0x4110f0){return new BPromise(function(_0x332e8a,_0x4a4ddf){getLimits()[_0xcd19('0x9')](function(_0x5a79c9){var _0x49670e=_[_0xcd19('0x29')](_[_0xcd19('0x2a')](_0x4110f0,_0xcd19('0x1f')),[_0xcd19('0x22'),_0xcd19('0x23'),_0xcd19('0x24')]);var _0x55f3b5=(_0x49670e[_0xcd19('0x22')]||0x0)+(_0x49670e['user']||0x0);var _0x3ac51f=_0x49670e['telephone']||0x0;if(_0x55f3b5>_0x5a79c9['user'])return _0x4a4ddf('License\x20limit\x20reached\x20for\x20users');if(_0x3ac51f>_0x5a79c9[_0xcd19('0x24')])return _0x4a4ddf(_0xcd19('0x2b'));return _0x332e8a();})[_0xcd19('0xa')](function(_0x509d04){_0x4a4ddf(_0x509d04);});});}module[_0xcd19('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7f35=['uuid','data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','gray','add','days','grayReason','machineUuid','changed','disabled','message','then','User','role','sequelize','COUNT','count','users','telephones','admin','pick','user','telephone','License\x20limit\x20reached\x20for\x20telephones','catch','exports','bluebird','../../components/encryptor','../../mysqldb','getUuid','License','find','defaults'];(function(_0x4c7b82,_0x3014f0){var _0x16ca3c=function(_0x54eda1){while(--_0x54eda1){_0x4c7b82['push'](_0x4c7b82['shift']());}};_0x16ca3c(++_0x3014f0);}(_0x7f35,0x95));var _0x57f3=function(_0x27f5e4,_0x342896){_0x27f5e4=_0x27f5e4-0x0;var _0x30bfab=_0x7f35[_0x27f5e4];return _0x30bfab;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var BPromise=require(_0x57f3('0x0'));var hardware=require('./hardware');var encryptor=require(_0x57f3('0x1'));var db=require(_0x57f3('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x57f3('0x3')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x57f3('0x3')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xd9a7c0){return new BPromise(function(_0x34c58f,_0xef45b4){return db[_0x57f3('0x4')][_0x57f3('0x5')](_[_0x57f3('0x6')](_0xd9a7c0,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x200fb1){return checkLicense(_0x200fb1,null);})['then'](function(_0xf3d5d1){_0x34c58f(_0xf3d5d1);return;})['catch'](function(_0x3f63fd){_0xef45b4(_0x3f63fd);});});}function checkLicense(_0x43b9c6,_0xa97ca0){if(!_0x43b9c6){demoLicense[_0x57f3('0x7')]=_0x43b9c6[_0x57f3('0x8')];return demoLicense;}try{var _0x3b33c0=_0xa97ca0||_0x43b9c6[_0x57f3('0x9')];if(_['isEmpty'](_0x3b33c0)){throw new Error(_0x57f3('0xa'));}var _0x26700f=_0x43b9c6['data1'];var _0x5815af=_0x43b9c6['data2'];var _0x57354d=_0x26700f[_0x57f3('0xb')]('-')[0x4];var _0x115dd=_0x26700f[_0x57f3('0xb')]('-')[0x0];var _0x106e29=encryptor[_0x57f3('0xc')](_0x3b33c0,util[_0x57f3('0xd')](_0x57f3('0xe'),_0x57354d,_0x26700f,_0x115dd));var _0x17ccd8=JSON[_0x57f3('0xf')](_0x106e29);_0x17ccd8['demo']=![];_0x17ccd8[_0x57f3('0x7')]=_0x26700f;_0x17ccd8['machineUuid']=hardware[_0x57f3('0x3')]();if(_0x5815af){var _0xbeb981=encryptor[_0x57f3('0xc')](_0x5815af);_0x17ccd8[_0x57f3('0x10')]=_0xbeb981;_0x17ccd8['deadline']=moment(_0xbeb981)[_0x57f3('0x11')](0x7,_0x57f3('0x12'))['format']();_0x17ccd8[_0x57f3('0x13')]=_0x17ccd8[_0x57f3('0x7')]!=_0x17ccd8[_0x57f3('0x14')]?_0x57f3('0x15'):_0x57f3('0x16');}return _0x17ccd8;}catch(_0x549a03){breakingLicense[_0x57f3('0x7')]=_0x43b9c6['data1'];breakingLicense[_0x57f3('0x17')]=_0x549a03['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3ec053,_0x70e2a2){getLicense()[_0x57f3('0x18')](function(_0xe5dcc5){return db[_0x57f3('0x19')]['findAll']({'attributes':[_0x57f3('0x1a'),[db[_0x57f3('0x1b')]['fn'](_0x57f3('0x1c'),db[_0x57f3('0x1b')]['col'](_0x57f3('0x1a'))),_0x57f3('0x1d')]],'group':_0x57f3('0x1a'),'where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})[_0x57f3('0x18')](function(_0xd1f21f){var _0x2c5f94={'user':_0xe5dcc5[_0x57f3('0x1e')]||0x0,'telephone':_0xe5dcc5[_0x57f3('0x1f')]||0x0};_0xd1f21f['forEach'](function(_0x34d77a){var _0x1b8cb3=_0x34d77a[_0x57f3('0x1a')]===_0x57f3('0x20')?'user':_0x34d77a['role'];_0x2c5f94[_0x1b8cb3]-=_0x34d77a['count'];if(_0x2c5f94[_0x1b8cb3]<0x0)_0x2c5f94[_0x1b8cb3]=0x0;});_0x3ec053(_0x2c5f94);return;});})['catch'](function(_0x4ebeae){_0x70e2a2(_0x4ebeae);});});}function checkUserLimits(_0x13a304){return new BPromise(function(_0x74a409,_0x3c321f){getLimits()[_0x57f3('0x18')](function(_0x26ad3e){var _0x2ab1c1=_[_0x57f3('0x21')](_['countBy'](_0x13a304,_0x57f3('0x1a')),[_0x57f3('0x20'),'user','telephone']);var _0x1041c2=(_0x2ab1c1[_0x57f3('0x20')]||0x0)+(_0x2ab1c1[_0x57f3('0x22')]||0x0);var _0x387d1b=_0x2ab1c1[_0x57f3('0x23')]||0x0;if(_0x1041c2>_0x26ad3e[_0x57f3('0x22')])return _0x3c321f('License\x20limit\x20reached\x20for\x20users');if(_0x387d1b>_0x26ad3e[_0x57f3('0x23')])return _0x3c321f(_0x57f3('0x24'));return _0x74a409();})[_0x57f3('0x25')](function(_0x48ae49){_0x3c321f(_0x48ae49);});});}module[_0x57f3('0x26')]={'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 a4958b2..f903ece 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 _0x9582=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0xbab326,_0x100dd5){var _0x1d5d08=function(_0x381d2a){while(--_0x381d2a){_0xbab326['push'](_0xbab326['shift']());}};_0x1d5d08(++_0x100dd5);}(_0x9582,0x95));var _0x2958=function(_0x1a31cc,_0x19e08b){_0x1a31cc=_0x1a31cc-0x0;var _0x1f3111=_0x9582[_0x1a31cc];return _0x1f3111;};'use strict';module[_0x2958('0x0')]={'DOMAIN':_0x2958('0x1'),'SESSION_SECRET':_0x2958('0x2'),'GOOGLE_ID':_0x2958('0x3'),'GOOGLE_SECRET':_0x2958('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xfb11[_0x2160a9];return _0xa88cf7;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 4a0c748..c733ab0 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78fe=['../utils/loggers','exports'];(function(_0x1237dc,_0x27709f){var _0x5532f5=function(_0x6c3206){while(--_0x6c3206){_0x1237dc['push'](_0x1237dc['shift']());}};_0x5532f5(++_0x27709f);}(_0x78fe,0x96));var _0xe78f=function(_0x488c17,_0x29a2a6){_0x488c17=_0x488c17-0x0;var _0x2ad783=_0x78fe[_0x488c17];return _0x2ad783;};'use strict';var fileLogger=require(_0xe78f('0x0'))['fileLogger'];module[_0xe78f('0x1')]=fileLogger; \ No newline at end of file +var _0x9bb8=['../utils/loggers','exports'];(function(_0x1f41f7,_0x4d8024){var _0x53d488=function(_0x2e7cda){while(--_0x2e7cda){_0x1f41f7['push'](_0x1f41f7['shift']());}};_0x53d488(++_0x4d8024);}(_0x9bb8,0x1b8));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var fileLogger=require(_0x89bb('0x0'))['fileLogger'];module[_0x89bb('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e9a60bf..bb1010d 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 _0x22d5=['../../services/xdr/index.js','exports','express','join','ami','../../services/ami/index.js','agi','routing','../../services/routing/index.js','xdr'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x22d5,0xca));var _0x522d=function(_0x582ec5,_0xb743f8){_0x582ec5=_0x582ec5-0x0;var _0x23100c=_0x22d5[_0x582ec5];return _0x23100c;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x522d('0x0'),'script':path[_0x522d('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x522d('0x2'),'script':path['join'](__dirname,_0x522d('0x3'))},{'name':_0x522d('0x4'),'script':path[_0x522d('0x1')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x522d('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x522d('0x5'),'script':path['join'](__dirname,_0x522d('0x6'))},{'name':_0x522d('0x7'),'script':path[_0x522d('0x1')](__dirname,_0x522d('0x8'))}]};module[_0x522d('0x9')]=config; \ No newline at end of file +var _0x061a=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x18600d,_0x43c6e6){var _0x277202=function(_0x1e90bb){while(--_0x1e90bb){_0x18600d['push'](_0x18600d['shift']());}};_0x277202(++_0x43c6e6);}(_0x061a,0xbe));var _0xa061=function(_0x79572,_0x4e5445){_0x79572=_0x79572-0x0;var _0x1e0cf1=_0x061a[_0x79572];return _0x1e0cf1;};'use strict';var path=require(_0xa061('0x0'));var os=require('os');var config={'apps':[{'name':_0xa061('0x1'),'script':path[_0xa061('0x2')](__dirname,_0xa061('0x3'))},{'name':_0xa061('0x4'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xa061('0x5'),'script':path[_0xa061('0x2')](__dirname,_0xa061('0x6'))},{'name':'email','script':path['join'](__dirname,_0xa061('0x7'))},{'name':'routing','script':path[_0xa061('0x2')](__dirname,_0xa061('0x8'))},{'name':'xdr','script':path[_0xa061('0x2')](__dirname,_0xa061('0x9'))}]};module[_0xa061('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 29d3572..dcaea04 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 _0xccad=['pm2','bluebird','./config','connect','connected','then','start','stop','disconnect','restart','list','describe','delete','dump','saved'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xccad,0x186));var _0xdcca=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xccad[_0x29e35f];return _0x266b74;};'use strict';var pm2=require(_0xdcca('0x0'));var BPromise=require(_0xdcca('0x1'));var config=require(_0xdcca('0x2'));function connect(){return new BPromise(function(_0x48324d,_0x3bcf29){return pm2[_0xdcca('0x3')](function(_0x161a61){if(_0x161a61){return _0x3bcf29(_0x161a61);}return _0x48324d(_0xdcca('0x4'));});});};exports['start']=function(_0x44ed8a){return connect()[_0xdcca('0x5')](function(){return new BPromise(function(_0x118c83,_0x9780bc){return pm2[_0xdcca('0x6')](_0x44ed8a,function(_0x2dbe02,_0x3d5175){if(_0x2dbe02){return _0x9780bc(_0x2dbe02);}pm2['disconnect']();return _0x118c83(_0x3d5175);});});});};exports[_0xdcca('0x7')]=function(_0x27065b){return connect()['then'](function(){return new BPromise(function(_0x23a6cb,_0x4f9b9e){return pm2['stop'](_0x27065b,function(_0x10bfc9,_0x7c395d){if(_0x10bfc9){return _0x4f9b9e(_0x10bfc9);}pm2[_0xdcca('0x8')]();return _0x23a6cb(_0x7c395d);});});});};exports[_0xdcca('0x9')]=function(_0x32446c){return connect()[_0xdcca('0x5')](function(){return new BPromise(function(_0x27d883,_0x4bb859){return pm2[_0xdcca('0x9')](_0x32446c,function(_0x135d78,_0xe0f6b8){if(_0x135d78){return _0x4bb859(_0x135d78);}pm2[_0xdcca('0x8')]();return _0x27d883(_0xe0f6b8);});});});};exports[_0xdcca('0xa')]=function(){return connect()[_0xdcca('0x5')](function(){return new BPromise(function(_0x20cd28,_0x5ee0d4){return pm2[_0xdcca('0xa')](function(_0x2bdb31,_0x8343cb){if(_0x2bdb31){return _0x5ee0d4(_0x2bdb31);}pm2[_0xdcca('0x8')]();return _0x20cd28(_0x8343cb);});});});};exports[_0xdcca('0xb')]=function(_0x4a22e0){return connect()['then'](function(){return new BPromise(function(_0x1422ae,_0x335ee1){return pm2[_0xdcca('0xb')](_0x4a22e0,function(_0x56e42d,_0x27cb43){if(_0x56e42d){return _0x335ee1(_0x56e42d);}pm2['disconnect']();return _0x1422ae(_0x27cb43);});});});};exports[_0xdcca('0xc')]=function(_0x5517f9){return connect()['then'](function(){return new BPromise(function(_0x274f19,_0x29c171){return pm2[_0xdcca('0xc')](_0x5517f9,function(_0x51db90,_0xed1f71){if(_0x51db90){return _0x29c171(_0x51db90);}pm2[_0xdcca('0x8')]();return _0x274f19(_0xed1f71);});});});};exports[_0xdcca('0xd')]=function(){return connect()[_0xdcca('0x5')](function(){return new BPromise(function(_0x604798,_0x225c9f){return pm2[_0xdcca('0xd')](function(_0x46fefa){if(_0x46fefa){return _0x225c9f(_0x46fefa);}return _0x604798(_0xdcca('0xe'));});});});}; \ No newline at end of file +var _0x7e7f=['describe','delete','dump','connected','start','then','stop','disconnect','restart','list'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x7e7f,0x193));var _0xf7e7=function(_0x33f461,_0x50d04f){_0x33f461=_0x33f461-0x0;var _0x35eea8=_0x7e7f[_0x33f461];return _0x35eea8;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x1c5bab,_0x51aecf){return pm2['connect'](function(_0x14eba9){if(_0x14eba9){return _0x51aecf(_0x14eba9);}return _0x1c5bab(_0xf7e7('0x0'));});});};exports[_0xf7e7('0x1')]=function(_0xd75aa1){return connect()[_0xf7e7('0x2')](function(){return new BPromise(function(_0x520f09,_0x382b83){return pm2[_0xf7e7('0x1')](_0xd75aa1,function(_0x55f01f,_0x1763cd){if(_0x55f01f){return _0x382b83(_0x55f01f);}pm2['disconnect']();return _0x520f09(_0x1763cd);});});});};exports[_0xf7e7('0x3')]=function(_0x2287ac){return connect()[_0xf7e7('0x2')](function(){return new BPromise(function(_0x2bad48,_0x55e273){return pm2[_0xf7e7('0x3')](_0x2287ac,function(_0x42af33,_0x43dcbd){if(_0x42af33){return _0x55e273(_0x42af33);}pm2[_0xf7e7('0x4')]();return _0x2bad48(_0x43dcbd);});});});};exports[_0xf7e7('0x5')]=function(_0x51cbe4){return connect()[_0xf7e7('0x2')](function(){return new BPromise(function(_0x27f953,_0x416d32){return pm2[_0xf7e7('0x5')](_0x51cbe4,function(_0x2bf8c7,_0x2d51d6){if(_0x2bf8c7){return _0x416d32(_0x2bf8c7);}pm2[_0xf7e7('0x4')]();return _0x27f953(_0x2d51d6);});});});};exports[_0xf7e7('0x6')]=function(){return connect()['then'](function(){return new BPromise(function(_0x15b031,_0x26f44a){return pm2[_0xf7e7('0x6')](function(_0xa085f9,_0x182662){if(_0xa085f9){return _0x26f44a(_0xa085f9);}pm2[_0xf7e7('0x4')]();return _0x15b031(_0x182662);});});});};exports[_0xf7e7('0x7')]=function(_0x43c161){return connect()[_0xf7e7('0x2')](function(){return new BPromise(function(_0x256beb,_0x1660e5){return pm2['describe'](_0x43c161,function(_0x23e2b4,_0x1d1b14){if(_0x23e2b4){return _0x1660e5(_0x23e2b4);}pm2['disconnect']();return _0x256beb(_0x1d1b14);});});});};exports[_0xf7e7('0x8')]=function(_0x1a9f2e){return connect()[_0xf7e7('0x2')](function(){return new BPromise(function(_0x41410e,_0x4cf1fc){return pm2[_0xf7e7('0x8')](_0x1a9f2e,function(_0x3be81e,_0x31ec4e){if(_0x3be81e){return _0x4cf1fc(_0x3be81e);}pm2[_0xf7e7('0x4')]();return _0x41410e(_0x31ec4e);});});});};exports[_0xf7e7('0x9')]=function(){return connect()[_0xf7e7('0x2')](function(){return new BPromise(function(_0x40b9e7,_0x4c68f1){return pm2[_0xf7e7('0x9')](function(_0x3ee2e6){if(_0x3ee2e6){return _0x4c68f1(_0x3ee2e6);}return _0x40b9e7('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5f48ee9..72a6f18 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 _0x90e6=['schedule','redis','localhost','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../config/environment','../logger'];(function(_0x449ec7,_0x330e3d){var _0x520d42=function(_0x523c0c){while(--_0x523c0c){_0x449ec7['push'](_0x449ec7['shift']());}};_0x520d42(++_0x330e3d);}(_0x90e6,0xe6));var _0x690e=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x90e6[_0x21b36c];return _0x236627;};'use strict';var _=require(_0x690e('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x690e('0x1'));var config=require(_0x690e('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x690e('0x3'))(_0x690e('0x4'));config['redis']=_['defaults'](config[_0x690e('0x5')],{'host':_0x690e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x690e('0x5')]));function closeInteractions(){var _0x3e388a=0x0;var _0x51472d=[];return db[_0x690e('0x7')][_0x690e('0x8')]({'raw':!![],'attributes':['id',_0x690e('0x9')],'where':{'id':0x1}})['then'](function(_0x32c210){_0x3e388a=_0x32c210['chatTimeout'];if(_0x3e388a){return db[_0x690e('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x690e('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x32c210[_0x690e('0x9')],_0x690e('0xc'))}}});}else{return[];}})[_0x690e('0xd')](function(_0x2cd7b4){if(_0x2cd7b4&&_0x2cd7b4[_0x690e('0xe')]){_0x51472d=_['map'](_0x2cd7b4||[],'id');logger[_0x690e('0xf')](_0x690e('0x10'),_0x51472d[_0x690e('0x11')]());return db[_0x690e('0xa')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x690e('0x12')](_0x690e('0x13'))},{'where':{'id':_0x51472d}});}})['then'](function(){if(_0x51472d&&_0x51472d[_0x690e('0xe')]){logger[_0x690e('0xf')](_0x690e('0x14'),_0x51472d[_0x690e('0x11')]());for(var _0x6414ca=0x0;_0x6414ca<_0x51472d[_0x690e('0xe')];_0x6414ca++){io[_0x690e('0x15')](_0x690e('0x16'),{'id':_0x51472d[_0x6414ca],'closed':!![]});}}})['catch'](function(_0x6d42ca){logger['error'](_0x690e('0x17'),_0x6d42ca?util[_0x690e('0x18')](_0x6d42ca,{'showHidden':![],'depth':null}):'');});}exports[_0x690e('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x499b=['chatTimeout','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','start','lodash','moment','ioredis','util','../../mysqldb','schedule','defaults','redis','socket.io-emitter','then'];(function(_0x5a4fc0,_0x278ee9){var _0x27c25e=function(_0x2b0fd0){while(--_0x2b0fd0){_0x5a4fc0['push'](_0x5a4fc0['shift']());}};_0x27c25e(++_0x278ee9);}(_0x499b,0x1e3));var _0xb499=function(_0x5df69b,_0x30ee1b){_0x5df69b=_0x5df69b-0x0;var _0x51d62d=_0x499b[_0x5df69b];return _0x51d62d;};'use strict';var _=require(_0xb499('0x0'));var moment=require(_0xb499('0x1'));var Redis=require(_0xb499('0x2'));var util=require(_0xb499('0x3'));var config=require('../../config/environment');var db=require(_0xb499('0x4'))['db'];var logger=require('../logger')(_0xb499('0x5'));config['redis']=_[_0xb499('0x6')](config[_0xb499('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb499('0x8'))(new Redis(config[_0xb499('0x7')]));function closeInteractions(){var _0x31e9fe=0x0;var _0x2358e3=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xb499('0x9')](function(_0x1fb36b){_0x31e9fe=_0x1fb36b[_0xb499('0xa')];if(_0x31e9fe){return db['ChatInteraction'][_0xb499('0xb')]({'raw':!![],'attributes':['id',_0xb499('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb499('0xd')](_0x1fb36b[_0xb499('0xa')],_0xb499('0xe'))}}});}else{return[];}})[_0xb499('0x9')](function(_0x5d1b1a){if(_0x5d1b1a&&_0x5d1b1a[_0xb499('0xf')]){_0x2358e3=_['map'](_0x5d1b1a||[],'id');logger[_0xb499('0x10')](_0xb499('0x11'),_0x2358e3[_0xb499('0x12')]());return db[_0xb499('0x13')][_0xb499('0x14')]({'closeReason':_0xb499('0x15'),'disposition':_0xb499('0x16'),'closed':!![],'closedAt':moment()[_0xb499('0x17')](_0xb499('0x18'))},{'where':{'id':_0x2358e3}});}})[_0xb499('0x9')](function(){if(_0x2358e3&&_0x2358e3[_0xb499('0xf')]){logger[_0xb499('0x10')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2358e3[_0xb499('0x12')]());for(var _0x49f858=0x0;_0x49f858<_0x2358e3[_0xb499('0xf')];_0x49f858++){io[_0xb499('0x19')](_0xb499('0x1a'),{'id':_0x2358e3[_0x49f858],'closed':!![]});}}})['catch'](function(_0x3877c7){logger[_0xb499('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x3877c7?util['inspect'](_0x3877c7,{'showHidden':![],'depth':null}):'');});}exports[_0xb499('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 cccfcb8..9557866 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. * // * * // ************************************************************************* -'use strict';function start(){var _0x4fc767=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4fc767['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x8ddc=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x598444,_0x43b020){var _0xe1c9d9=function(_0x517a30){while(--_0x517a30){_0x598444['push'](_0x598444['shift']());}};_0xe1c9d9(++_0x43b020);}(_0x8ddc,0x1a9));var _0xc8dd=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x8ddc[_0x34325b];return _0x3da348;};'use strict';function start(){var _0x1103f4=require(_0xc8dd('0x0'));return _0x1103f4['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a85206c..2c65634 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 _0x629d=['../logger','schedule','../../mysqldb','client','http','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','MailAccount','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','message','attachments','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','data','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','intersection','length','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','endAt','start','add\x20cron','exists','stop\x20cron','startAt','update','update\x20cron','run','util','path','lodash','moment','bluebird'];(function(_0x2bf6a2,_0x5533d6){var _0xc067d1=function(_0x502802){while(--_0x502802){_0x2bf6a2['push'](_0x2bf6a2['shift']());}};_0xc067d1(++_0x5533d6);}(_0x629d,0xa1));var _0xd629=function(_0x25ea25,_0x570998){_0x25ea25=_0x25ea25-0x0;var _0x1d453c=_0x629d[_0x25ea25];return _0x1d453c;};'use strict';var fs=require('fs');var util=require(_0xd629('0x0'));var path=require(_0xd629('0x1'));var _=require(_0xd629('0x2'));var moment=require(_0xd629('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xd629('0x4'));var logger=require(_0xd629('0x5'))(_0xd629('0x6'));var db=require(_0xd629('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xd629('0x8')][_0xd629('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2abf4a,_0x15838e){return function(){logger[_0xd629('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x2abf4a[_0xd629('0xb')]);var _0x45854b=!![];var _0x626a09=_0x2abf4a['MailAccount'][_0xd629('0xc')]();var _0x77de16={'account':_0x626a09,'message':{'from':util[_0xd629('0xd')](_0xd629('0xe'),_0x2abf4a['MailAccount'][_0xd629('0xf')],_0x2abf4a[_0xd629('0x10')][_0xd629('0xb')]||_0x2abf4a[_0xd629('0x10')][_0xd629('0x11')][_0xd629('0x12')]),'to':_0x2abf4a['email'],'cc':_0x2abf4a['cc'],'bcc':_0x2abf4a['bcc'],'subject':util[_0xd629('0xd')](_0xd629('0x13'),_0x15838e['name'],_0x2abf4a[_0xd629('0x14')],_0x2abf4a[_0xd629('0x15')])}};var _0x272ad8=path[_0xd629('0x16')](__dirname,_0xd629('0x17'));var _0x56a9bc=_0x15838e[_0xd629('0x18')];var _0x2d49ea=util[_0xd629('0xd')](_0xd629('0x19'),path[_0xd629('0x1a')](_0x15838e[_0xd629('0x18')],path['extname'](_0x15838e[_0xd629('0x18')])),_0xd629('0x1b'));var _0x1b552d=path[_0xd629('0x16')](_0x272ad8,_0x56a9bc);var _0x446474=path['join'](_0x272ad8,_0x2d49ea);if(fs[_0xd629('0x1c')](_0x1b552d)){_0x15838e[_0xd629('0x1d')]=_0xd629('0x1e');_0x77de16['message']['attachments']=[{'filename':_0x56a9bc,'path':_0x1b552d}];_0x77de16['message'][_0xd629('0x1f')]=util[_0xd629('0xd')](_0xd629('0x20'),JSON['stringify'](_0x15838e,null,0x2));}else if(fs[_0xd629('0x1c')](_0x446474)){_0x15838e['status']=_0xd629('0x1e');_0x77de16[_0xd629('0x21')][_0xd629('0x22')]=[{'filename':_0x2d49ea,'path':_0x446474}];}else{_0x77de16['message'][_0xd629('0x1f')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2abf4a[_0xd629('0x23')]){_0x45854b=![];logger['info'](_0xd629('0x24'));}}if(_0x45854b){return client[_0xd629('0x25')](_0xd629('0x26'),_0x77de16)[_0xd629('0x27')](function(_0x4e5bc6){if(_0x4e5bc6[_0xd629('0x28')]){return logger['error'](_0xd629('0x29'),JSON[_0xd629('0x2a')](_0x4e5bc6));}return logger[_0xd629('0xa')](_0xd629('0x2b'));})[_0xd629('0x2c')](function(_0x2e658e){return logger[_0xd629('0x28')]('error\x20mail',JSON[_0xd629('0x2a')](_0x2e658e));});}};}function handleError(){return function(_0x26e27f){return logger[_0xd629('0x28')](JSON['stringify'](_0x26e27f));};}function handleResult(_0x1cc765){return function(_0x1caa9f){logger['info'](_0xd629('0x2d'),JSON[_0xd629('0x2a')](_0x1caa9f));if(_0x1cc765[_0xd629('0x10')]&&_0x1cc765[_0xd629('0x10')][_0xd629('0x11')]&&!_['isNil'](_0x1cc765[_0xd629('0xb')])){setTimeout(handleSendEmail(_0x1cc765,_0x1caa9f),0x3c*0x3e8);}};}function handleJob(_0x2fda39){return function(){try{if(_['isNil'](_0x2fda39['subtractNumber'])){return logger[_0xd629('0xa')](_0xd629('0x2e'));}if(_['isNil'](_0x2fda39['subtractUnit'])){return logger[_0xd629('0xa')](_0xd629('0x2f'));}var _0x68439c={'startDate':moment()[_0xd629('0x30')](_0x2fda39['subtractNumber'],_0x2fda39[_0xd629('0x15')])[_0xd629('0xd')](_0xd629('0x31')),'endDate':moment()[_0xd629('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xd629('0x32'),'output':_0x2fda39[_0xd629('0x33')],'name':_0x2fda39['name']};if(!_[_0xd629('0x34')](_0x2fda39['DefaultReportId'])){logger[_0xd629('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x2fda39[_0xd629('0x35')]);return analyticDefaultReportController[_0xd629('0x36')]({'id':_0x2fda39[_0xd629('0x35')]},_0x68439c)['then'](handleResult(_0x2fda39))['catch'](handleError());}if(!_[_0xd629('0x34')](_0x2fda39[_0xd629('0x37')])){logger['info'](_0xd629('0x38'),_0x2fda39[_0xd629('0x37')]);return analyticCustomReportController['runReport']({'id':_0x2fda39['CustomReportId']},_0x68439c)[_0xd629('0x27')](handleResult(_0x2fda39))[_0xd629('0x2c')](handleError());}}catch(_0x2034e6){logger[_0xd629('0x28')](JSON['stringify'](_0x2034e6));}return logger[_0xd629('0xa')]('no\x20report\x20id');};}function getJobs(_0x25a7b5){var _0x35ef21={};if(_0x25a7b5){_0x35ef21['id']=_0x25a7b5;}return db['Schedule'][_0xd629('0x39')]({'where':_0x35ef21,'include':[{'model':db[_0xd629('0x10')],'attributes':['id',_0xd629('0xf'),_0xd629('0xb')],'include':[{'model':db[_0xd629('0x3a')],'as':_0xd629('0x11'),'include':[{'model':db[_0xd629('0x3b')],'as':_0xd629('0x3b')}]}]}]})['then'](function(_0x25a8ec){var _0x79e0ab=_[_0xd629('0x3c')](manager['jobs']);var _0x2ed71c=_[_0xd629('0x3d')](_0x25a8ec,function(_0x350969){return _0x350969['id'][_0xd629('0x3e')]();});var _0x3cb269=_[_0xd629('0x3f')](_0x25a8ec,function(_0x4c0c8e){return _0x4c0c8e['id'][_0xd629('0x3e')]();});var _0x296716=_0x25a7b5?_0x2ed71c:_['difference'](_0x2ed71c,_0x79e0ab);var _0x224144=_[_0xd629('0x40')](_0x2ed71c,_0x79e0ab);var _0x3cf832=_['difference'](_0x79e0ab,_0x2ed71c);var _0x50ce50;var _0x5b681b;for(_0x50ce50=0x0;_0x50ce50<_0x3cf832[_0xd629('0x41')]&&!_0x25a7b5;_0x50ce50+=0x1){_0x5b681b=_0x3cf832[_0x50ce50]['toString']();if(manager['exists'](_0x5b681b)){manager['stop'](_0x5b681b);manager[_0xd629('0x42')](_0x5b681b);logger[_0xd629('0xa')](_0xd629('0x43'),_0x5b681b);}}logger['info']('toRun',JSON[_0xd629('0x2a')](_0x296716));for(_0x50ce50=0x0;_0x50ce50<_0x296716[_0xd629('0x41')];_0x50ce50+=0x1){_0x5b681b=_0x296716[_0x50ce50][_0xd629('0x3e')]();logger[_0xd629('0xa')](_0xd629('0x44'),_0x5b681b);if(_0x25a7b5){logger[_0xd629('0xa')](_0xd629('0x45'),_0x25a7b5);logger[_0xd629('0xa')](JSON[_0xd629('0x2a')](_0x3cb269[_0x5b681b]));BPromise[_0xd629('0x46')]()[_0xd629('0x27')](handleJob(_0x3cb269[_0x5b681b]));logger[_0xd629('0xa')](_0xd629('0x47'),_0x3cb269[_0x5b681b][_0xd629('0xf')],_0x3cb269[_0x5b681b]['cron']);}else if(_0x3cb269[_0x5b681b][_0xd629('0x48')]&&_0x3cb269[_0x5b681b][_0xd629('0x49')]&&moment()['isBetween'](_0x3cb269[_0x5b681b]['startAt'],_0x3cb269[_0x5b681b][_0xd629('0x4a')])){manager['add'](_0x5b681b,_0x3cb269[_0x5b681b][_0xd629('0x48')],handleJob(_0x3cb269[_0x5b681b]));manager[_0xd629('0x4b')](_0x5b681b);logger[_0xd629('0xa')](_0xd629('0x4c'),_0x3cb269[_0x5b681b][_0xd629('0xf')],_0x3cb269[_0x5b681b][_0xd629('0x48')]);}else if(manager[_0xd629('0x4d')](_0x5b681b)){manager['stop'](_0x5b681b);manager[_0xd629('0x42')](_0x5b681b);logger[_0xd629('0xa')](_0xd629('0x4e'),_0x3cb269[_0x5b681b][_0xd629('0xf')],_0x3cb269[_0x5b681b][_0xd629('0x48')]);}}for(_0x50ce50=0x0,_0x5b681b;_0x50ce50<_0x224144[_0xd629('0x41')]&&!_0x25a7b5;_0x50ce50+=0x1){_0x5b681b=_0x224144[_0x50ce50]['toString']();if(manager[_0xd629('0x4d')](_0x5b681b)){if(_0x3cb269[_0x5b681b]['cron']&&_0x3cb269[_0x5b681b][_0xd629('0x49')]&&moment()['isBetween'](_0x3cb269[_0x5b681b][_0xd629('0x4f')],_0x3cb269[_0x5b681b][_0xd629('0x4a')])){manager[_0xd629('0x50')](_0x5b681b,_0x3cb269[_0x5b681b]['cron'],handleJob(_0x3cb269[_0x5b681b]));logger['info'](_0xd629('0x51'),_0x3cb269[_0x5b681b]['name'],_0x3cb269[_0x5b681b][_0xd629('0x48')]);}else{manager['stop'](_0x5b681b);manager['deleteJob'](_0x5b681b);logger[_0xd629('0xa')](_0xd629('0x4e'),_0x3cb269[_0x5b681b]['name'],_0x3cb269[_0x5b681b][_0xd629('0x48')]);}}}})[_0xd629('0x2c')](function(_0x18883a){logger[_0xd629('0x28')](JSON['stringify'](_0x18883a));});}exports[_0xd629('0x52')]=function(_0x346a3d){return getJobs(_0x346a3d);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x804c=['endAt','add','start','update','update\x20cron','run','util','path','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','index','resolve','run\x20job','cron','active','isBetween','startAt'];(function(_0x57590b,_0x2ecd39){var _0x2375ea=function(_0x2b8f1f){while(--_0x2b8f1f){_0x57590b['push'](_0x57590b['shift']());}};_0x2375ea(++_0x2ecd39);}(_0x804c,0xfc));var _0xc804=function(_0x25721c,_0x12b3b1){_0x25721c=_0x25721c-0x0;var _0x56e006=_0x804c[_0x25721c];return _0x56e006;};'use strict';var fs=require('fs');var util=require(_0xc804('0x0'));var path=require(_0xc804('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xc804('0x2'));var jayson=require(_0xc804('0x3'));var BPromise=require(_0xc804('0x4'));var logger=require(_0xc804('0x5'))(_0xc804('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xc804('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xc804('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4867e2,_0x4148ce){return function(){logger[_0xc804('0x9')](_0xc804('0xa'),_0x4867e2[_0xc804('0xb')]);var _0x4cfd02=!![];var _0x367b00=_0x4867e2['MailAccount'][_0xc804('0xc')]();var _0x55bc6c={'account':_0x367b00,'message':{'from':util[_0xc804('0xd')](_0xc804('0xe'),_0x4867e2[_0xc804('0xf')][_0xc804('0x10')],_0x4867e2[_0xc804('0xf')][_0xc804('0xb')]||_0x4867e2[_0xc804('0xf')][_0xc804('0x11')][_0xc804('0x12')]),'to':_0x4867e2[_0xc804('0xb')],'cc':_0x4867e2['cc'],'bcc':_0x4867e2[_0xc804('0x13')],'subject':util[_0xc804('0xd')](_0xc804('0x14'),_0x4148ce[_0xc804('0x10')],_0x4867e2[_0xc804('0x15')],_0x4867e2[_0xc804('0x16')])}};var _0x1b47af=path[_0xc804('0x17')](__dirname,'../../files/reports');var _0x41c86d=_0x4148ce[_0xc804('0x18')];var _0x5e6cdb=util[_0xc804('0xd')](_0xc804('0x19'),path[_0xc804('0x1a')](_0x4148ce[_0xc804('0x18')],path[_0xc804('0x1b')](_0x4148ce[_0xc804('0x18')])),'zip');var _0x12cfd2=path[_0xc804('0x17')](_0x1b47af,_0x41c86d);var _0x5e9e14=path['join'](_0x1b47af,_0x5e6cdb);if(fs[_0xc804('0x1c')](_0x12cfd2)){_0x4148ce[_0xc804('0x1d')]=_0xc804('0x1e');_0x55bc6c[_0xc804('0x1f')]['attachments']=[{'filename':_0x41c86d,'path':_0x12cfd2}];_0x55bc6c[_0xc804('0x1f')][_0xc804('0x20')]=util[_0xc804('0xd')](_0xc804('0x21'),JSON['stringify'](_0x4148ce,null,0x2));}else if(fs[_0xc804('0x1c')](_0x5e9e14)){_0x4148ce[_0xc804('0x1d')]=_0xc804('0x1e');_0x55bc6c[_0xc804('0x1f')][_0xc804('0x22')]=[{'filename':_0x5e6cdb,'path':_0x5e9e14}];}else{_0x55bc6c[_0xc804('0x1f')][_0xc804('0x20')]=_0xc804('0x23');if(!_0x4867e2[_0xc804('0x24')]){_0x4cfd02=![];logger[_0xc804('0x9')](_0xc804('0x25'));}}if(_0x4cfd02){return client['request'](_0xc804('0x26'),_0x55bc6c)[_0xc804('0x27')](function(_0xe3afdd){if(_0xe3afdd[_0xc804('0x28')]){return logger['error'](_0xc804('0x29'),JSON[_0xc804('0x2a')](_0xe3afdd));}return logger['info']('email\x20sent');})[_0xc804('0x2b')](function(_0x36f6a7){return logger[_0xc804('0x28')](_0xc804('0x29'),JSON['stringify'](_0x36f6a7));});}};}function handleError(){return function(_0x544810){return logger[_0xc804('0x28')](JSON[_0xc804('0x2a')](_0x544810));};}function handleResult(_0x52b756){return function(_0x579a31){logger[_0xc804('0x9')](_0xc804('0x2c'),JSON[_0xc804('0x2a')](_0x579a31));if(_0x52b756[_0xc804('0xf')]&&_0x52b756[_0xc804('0xf')][_0xc804('0x11')]&&!_[_0xc804('0x2d')](_0x52b756[_0xc804('0xb')])){setTimeout(handleSendEmail(_0x52b756,_0x579a31),0x3c*0x3e8);}};}function handleJob(_0x24e1f0){return function(){try{if(_[_0xc804('0x2d')](_0x24e1f0[_0xc804('0x15')])){return logger['info'](_0xc804('0x2e'));}if(_[_0xc804('0x2d')](_0x24e1f0['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x35add6={'startDate':moment()['subtract'](_0x24e1f0[_0xc804('0x15')],_0x24e1f0[_0xc804('0x16')])[_0xc804('0xd')](_0xc804('0x2f')),'endDate':moment()[_0xc804('0xd')](_0xc804('0x2f')),'type':_0xc804('0x30'),'output':_0x24e1f0[_0xc804('0x31')],'name':_0x24e1f0[_0xc804('0x10')]};if(!_['isNil'](_0x24e1f0[_0xc804('0x32')])){logger['info'](_0xc804('0x33'),_0x24e1f0[_0xc804('0x32')]);return analyticDefaultReportController['runReport']({'id':_0x24e1f0[_0xc804('0x32')]},_0x35add6)[_0xc804('0x27')](handleResult(_0x24e1f0))['catch'](handleError());}if(!_[_0xc804('0x2d')](_0x24e1f0[_0xc804('0x34')])){logger[_0xc804('0x9')]('exec\x20custom\x20report\x20id:%s',_0x24e1f0[_0xc804('0x34')]);return analyticCustomReportController[_0xc804('0x35')]({'id':_0x24e1f0[_0xc804('0x34')]},_0x35add6)[_0xc804('0x27')](handleResult(_0x24e1f0))[_0xc804('0x2b')](handleError());}}catch(_0x6a9e84){logger[_0xc804('0x28')](JSON[_0xc804('0x2a')](_0x6a9e84));}return logger[_0xc804('0x9')](_0xc804('0x36'));};}function getJobs(_0x8a8b9c){var _0x1dd392={};if(_0x8a8b9c){_0x1dd392['id']=_0x8a8b9c;}return db[_0xc804('0x37')]['findAll']({'where':_0x1dd392,'include':[{'model':db[_0xc804('0xf')],'attributes':['id',_0xc804('0x10'),'email'],'include':[{'model':db[_0xc804('0x38')],'as':_0xc804('0x11'),'include':[{'model':db[_0xc804('0x39')],'as':_0xc804('0x39')}]}]}]})[_0xc804('0x27')](function(_0x5dd51e){var _0x44b9de=_[_0xc804('0x3a')](manager[_0xc804('0x3b')]);var _0x58b7b2=_[_0xc804('0x3c')](_0x5dd51e,function(_0x396c79){return _0x396c79['id'][_0xc804('0x3d')]();});var _0x540438=_[_0xc804('0x3e')](_0x5dd51e,function(_0x4b3fba){return _0x4b3fba['id'][_0xc804('0x3d')]();});var _0x218589=_0x8a8b9c?_0x58b7b2:_[_0xc804('0x3f')](_0x58b7b2,_0x44b9de);var _0x35355e=_['intersection'](_0x58b7b2,_0x44b9de);var _0x15c80d=_['difference'](_0x44b9de,_0x58b7b2);var _0x48acff;var _0x3852eb;for(_0x48acff=0x0;_0x48acff<_0x15c80d[_0xc804('0x40')]&&!_0x8a8b9c;_0x48acff+=0x1){_0x3852eb=_0x15c80d[_0x48acff]['toString']();if(manager[_0xc804('0x41')](_0x3852eb)){manager[_0xc804('0x42')](_0x3852eb);manager[_0xc804('0x43')](_0x3852eb);logger[_0xc804('0x9')](_0xc804('0x44'),_0x3852eb);}}logger[_0xc804('0x9')]('toRun',JSON[_0xc804('0x2a')](_0x218589));for(_0x48acff=0x0;_0x48acff<_0x218589['length'];_0x48acff+=0x1){_0x3852eb=_0x218589[_0x48acff][_0xc804('0x3d')]();logger[_0xc804('0x9')](_0xc804('0x45'),_0x3852eb);if(_0x8a8b9c){logger['info']('my\x20id',_0x8a8b9c);logger[_0xc804('0x9')](JSON['stringify'](_0x540438[_0x3852eb]));BPromise[_0xc804('0x46')]()[_0xc804('0x27')](handleJob(_0x540438[_0x3852eb]));logger[_0xc804('0x9')](_0xc804('0x47'),_0x540438[_0x3852eb][_0xc804('0x10')],_0x540438[_0x3852eb][_0xc804('0x48')]);}else if(_0x540438[_0x3852eb][_0xc804('0x48')]&&_0x540438[_0x3852eb][_0xc804('0x49')]&&moment()[_0xc804('0x4a')](_0x540438[_0x3852eb][_0xc804('0x4b')],_0x540438[_0x3852eb][_0xc804('0x4c')])){manager[_0xc804('0x4d')](_0x3852eb,_0x540438[_0x3852eb]['cron'],handleJob(_0x540438[_0x3852eb]));manager[_0xc804('0x4e')](_0x3852eb);logger[_0xc804('0x9')]('add\x20cron',_0x540438[_0x3852eb][_0xc804('0x10')],_0x540438[_0x3852eb][_0xc804('0x48')]);}else if(manager[_0xc804('0x41')](_0x3852eb)){manager[_0xc804('0x42')](_0x3852eb);manager['deleteJob'](_0x3852eb);logger['info']('stop\x20cron',_0x540438[_0x3852eb][_0xc804('0x10')],_0x540438[_0x3852eb]['cron']);}}for(_0x48acff=0x0,_0x3852eb;_0x48acff<_0x35355e[_0xc804('0x40')]&&!_0x8a8b9c;_0x48acff+=0x1){_0x3852eb=_0x35355e[_0x48acff][_0xc804('0x3d')]();if(manager[_0xc804('0x41')](_0x3852eb)){if(_0x540438[_0x3852eb][_0xc804('0x48')]&&_0x540438[_0x3852eb][_0xc804('0x49')]&&moment()[_0xc804('0x4a')](_0x540438[_0x3852eb][_0xc804('0x4b')],_0x540438[_0x3852eb][_0xc804('0x4c')])){manager[_0xc804('0x4f')](_0x3852eb,_0x540438[_0x3852eb][_0xc804('0x48')],handleJob(_0x540438[_0x3852eb]));logger[_0xc804('0x9')](_0xc804('0x50'),_0x540438[_0x3852eb][_0xc804('0x10')],_0x540438[_0x3852eb][_0xc804('0x48')]);}else{manager[_0xc804('0x42')](_0x3852eb);manager['deleteJob'](_0x3852eb);logger[_0xc804('0x9')]('stop\x20cron',_0x540438[_0x3852eb][_0xc804('0x10')],_0x540438[_0x3852eb][_0xc804('0x48')]);}}}})[_0xc804('0x2b')](function(_0x1f6bb6){logger[_0xc804('0x28')](JSON[_0xc804('0x2a')](_0x1f6bb6));});}exports[_0xc804('0x51')]=function(_0x1e7c19){return getJobs(_0x1e7c19);};exports['start']=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 75dcad8..5f24e7e 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 _0xb2af=['Comprehend','detectSentiment','substring','format','data1','transcribeName','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','data2','catch','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','name','SequelizeValidationError','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob'];(function(_0x26973a,_0x5e9886){var _0x501127=function(_0x7bc491){while(--_0x7bc491){_0x26973a['push'](_0x26973a['shift']());}};_0x501127(++_0x5e9886);}(_0xb2af,0xd2));var _0xfb2a=function(_0x54dacf,_0x144f4c){_0x54dacf=_0x54dacf-0x0;var _0x503e53=_0xb2af[_0x54dacf];return _0x503e53;};var _=require(_0xfb2a('0x0'));var AWS=require(_0xfb2a('0x1'));var rp=require(_0xfb2a('0x2'));var util=require(_0xfb2a('0x3'));var BPromise=require('bluebird');var db=require(_0xfb2a('0x4'))['db'];var logger=require(_0xfb2a('0x5'))(_0xfb2a('0x6'));function getTranscriptionJob(_0x856b1,_0xd63d49,_0x5b7553,_0xad7ba6){return new Promise(function(_0x1f4f1b,_0xb1be3f){var _0x55cf25=new AWS[(_0xfb2a('0x7'))]({'accessKeyId':_0xd63d49,'secretAccessKey':_0x856b1,'region':_0x5b7553});_0x55cf25[_0xfb2a('0x8')]({'TranscriptionJobName':_0xad7ba6},function(_0x1f3315,_0x55bb4e){if(_0x1f3315){return _0xb1be3f(_0x1f3315);}else{return _0x1f4f1b(_0x55bb4e);}});});}function sentiment(_0x2c529e,_0x33b17a,_0x3d3333,_0x9a7bf1,_0x46f390){return new Promise(function(_0x45bdff,_0x2f4f0e){var _0x3cf887=new AWS[(_0xfb2a('0x9'))]({'accessKeyId':_0x33b17a,'secretAccessKey':_0x2c529e,'region':_0x3d3333});_0x3cf887[_0xfb2a('0xa')]({'Text':_0x9a7bf1,'LanguageCode':_0x46f390[_0xfb2a('0xb')](0x0,0x2)},function(_0x383645,_0x5bbc63){if(_0x383645){return _0x2f4f0e(_0x383645);}else{return _0x45bdff(_0x5bbc63);}});});}function checkTranscribeJob(_0x4dad44,_0x49a66c,_0x26057f){var _0x37e000;return new BPromise(function(_0x422f6f,_0x10e1a0){logger['info'](util[_0xfb2a('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4dad44['id'],_0x4dad44['transcribeName']));return getTranscriptionJob(_0x26057f[_0xfb2a('0xd')],_0x26057f['data2'],_0x49a66c['transcribeRegion'],_0x4dad44[_0xfb2a('0xe')])[_0xfb2a('0xf')](function(_0x49ecbd){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x11'),_0x4dad44['id'],_0x4dad44[_0xfb2a('0xe')],_0x49ecbd[_0xfb2a('0x12')][_0xfb2a('0x13')]));if(!_0x4dad44['fileText']){switch(_0x49ecbd[_0xfb2a('0x12')][_0xfb2a('0x13')]){case _0xfb2a('0x14'):var _0x2b072a={'transcribeStatus':_0x49ecbd['TranscriptionJob'][_0xfb2a('0x13')],'fileUri':_0x49ecbd['TranscriptionJob'][_0xfb2a('0x15')][_0xfb2a('0x16')]};logger[_0xfb2a('0x10')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x4dad44['id']));return rp({'uri':_0x49ecbd['TranscriptionJob']['Transcript'][_0xfb2a('0x16')],'json':!![]})[_0xfb2a('0xf')](function(_0x434ca5){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x17'),_0x4dad44['id']));if(_0x434ca5&&_0x434ca5[_0xfb2a('0x18')]&&_0x434ca5[_0xfb2a('0x18')][_0xfb2a('0x19')]&&_0x434ca5[_0xfb2a('0x18')]['transcripts'][_0xfb2a('0x1a')]){_0x2b072a['fileText']='';for(var _0x37cc1f=0x0;_0x37cc1f<_0x434ca5[_0xfb2a('0x18')]['transcripts'][_0xfb2a('0x1a')];_0x37cc1f++){_0x2b072a[_0xfb2a('0x1b')]+=_0x434ca5['results'][_0xfb2a('0x19')][_0x37cc1f][_0xfb2a('0x1c')]+'';}}return _0x4dad44['update'](_0x2b072a);})[_0xfb2a('0xf')](function(){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x1d'),_0x4dad44['id']));if(!_0x4dad44[_0xfb2a('0x1e')]){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))](_0xfb2a('0x21'));}if(!_0x49a66c[_0xfb2a('0x22')]||!_0x49a66c[_0xfb2a('0x23')]||!_0x49a66c['sentimentRegion']||!_0x49a66c[_0xfb2a('0x24')]||!_0x49a66c[_0xfb2a('0x25')]){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))](_0xfb2a('0x26'));}if(!_0x2b072a[_0xfb2a('0x1b')]){throw new Error(_0xfb2a('0x27'));}if(_0x49a66c[_0xfb2a('0x23')]===_0x26057f['id']){return _0x26057f;}else{return db['CloudProvider'][_0xfb2a('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x1c3551){if(!_0x1c3551){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1c3551[_0xfb2a('0xd')]||!_0x1c3551['data2']){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))](_0xfb2a('0x29'));}_0x37e000=_0x1c3551;logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x2a'),_0x4dad44['id']));return sentiment(_0x37e000['data1'],_0x37e000['data2'],_0x49a66c[_0xfb2a('0x2b')],_0x2b072a[_0xfb2a('0x1b')],_0x49a66c['language']);})['then'](function(_0x149df0){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x2c'),_0x4dad44['id']));return _0x4dad44[_0xfb2a('0x2d')]({'sentiment':_0x149df0[_0xfb2a('0x2e')],'sPositive':_0x149df0['SentimentScore'][_0xfb2a('0x2f')],'sNegative':_0x149df0[_0xfb2a('0x30')][_0xfb2a('0x31')],'sMixed':_0x149df0[_0xfb2a('0x30')][_0xfb2a('0x32')],'sNeutral':_0x149df0[_0xfb2a('0x30')][_0xfb2a('0x33')]});})[_0xfb2a('0xf')](function(){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x1d'),_0x4dad44['id']));_0x422f6f();});case _0xfb2a('0x34'):return _0x4dad44[_0xfb2a('0x2d')]({'transcribeStatus':_0xfb2a('0x34'),'failureReason':_0x49ecbd[_0xfb2a('0x12')][_0xfb2a('0x35')]})[_0xfb2a('0xf')](function(){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x1d'),_0x4dad44['id']));_0x422f6f();});default:logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x36'),_0x4dad44['id']));break;}}else{return BPromise[_0xfb2a('0x37')]()[_0xfb2a('0xf')](function(){if(!_0x4dad44[_0xfb2a('0x1e')]){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))](_0xfb2a('0x21'));}if(!_0x49a66c['sentiment']||!_0x49a66c[_0xfb2a('0x23')]||!_0x49a66c[_0xfb2a('0x2b')]||!_0x49a66c[_0xfb2a('0x24')]||!_0x49a66c[_0xfb2a('0x25')]){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4dad44[_0xfb2a('0x1b')]){throw new Error(_0xfb2a('0x27'));}if(_0x49a66c[_0xfb2a('0x23')]===_0x26057f['id']){return _0x26057f;}else{return db['CloudProvider'][_0xfb2a('0x28')]({'where':{'id':_settings[_0xfb2a('0x23')]}});}})[_0xfb2a('0xf')](function(_0xb84832){if(!_0xb84832){throw new db['Sequelize'][(_0xfb2a('0x20'))](_0xfb2a('0x38'));}if(!_0xb84832[_0xfb2a('0xd')]||!_0xb84832[_0xfb2a('0x39')]){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))](_0xfb2a('0x29'));}_0x37e000=_0xb84832;logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4dad44['id']));return sentiment(_0x37e000['data1'],_0x37e000['data2'],_0x49a66c[_0xfb2a('0x2b')],_0x4dad44[_0xfb2a('0x1b')],_0x49a66c['language']);})['then'](function(_0x513e12){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x2c'),_0x4dad44['id']));return _0x4dad44[_0xfb2a('0x2d')]({'sentiment':_0x513e12['Sentiment'],'sPositive':_0x513e12[_0xfb2a('0x30')][_0xfb2a('0x2f')],'sNegative':_0x513e12[_0xfb2a('0x30')]['Negative'],'sMixed':_0x513e12['SentimentScore']['Mixed'],'sNeutral':_0x513e12[_0xfb2a('0x30')][_0xfb2a('0x33')],'transcribeStatus':_0xfb2a('0x14')});})[_0xfb2a('0xf')](function(){logger[_0xfb2a('0x10')](util[_0xfb2a('0xc')](_0xfb2a('0x1d'),_0x4dad44['id']));_0x422f6f();});}})[_0xfb2a('0x3a')](function(_0x13673f){if(_0x13673f){if(!_0x13673f['name']||_0x13673f['name']!=='SequelizeValidationError'){logger[_0xfb2a('0x3b')](util['format'](_0xfb2a('0x3c'),_0x4dad44['id']),util['inspect'](_0x13673f,{'showHidden':![],'depth':null}));}}_0x422f6f();});});}function checkTranscribe(){var _0x523414;var _0x253c3e;var _0xef975f;return db['VoiceRecording'][_0xfb2a('0x3d')]({'where':{'transcribeStatus':_0xfb2a('0x3e')}})[_0xfb2a('0xf')](function(_0x5c8789){if(!_0x5c8789||!_0x5c8789[_0xfb2a('0x1a')]){throw new db[(_0xfb2a('0x1f'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x523414=_0x5c8789;return db[_0xfb2a('0x3f')][_0xfb2a('0x28')]({'where':{'id':0x1}});})[_0xfb2a('0xf')](function(_0x4f62af){if(!_0x4f62af){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))](_0xfb2a('0x40'));}_0x253c3e=_0x4f62af;if(!_0x253c3e['transcribe']||!_0x253c3e[_0xfb2a('0x41')]||!_0x253c3e['transcribeRegion']||!_0x253c3e['language']||!_0x253c3e[_0xfb2a('0x25')]){throw new db[(_0xfb2a('0x1f'))]['ValidationError'](_0xfb2a('0x42'));}return db[_0xfb2a('0x43')][_0xfb2a('0x28')]({'where':{'id':_0x253c3e[_0xfb2a('0x41')]}});})[_0xfb2a('0xf')](function(_0x320741){if(!_0x320741){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))](_0xfb2a('0x38'));}if(!_0x320741[_0xfb2a('0xd')]||!_0x320741[_0xfb2a('0x39')]){throw new db[(_0xfb2a('0x1f'))][(_0xfb2a('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0xef975f=_0x320741;var _0x18ca20=[];_0x523414[_0xfb2a('0x44')](function(_0x215d54){_0x18ca20[_0xfb2a('0x45')](checkTranscribeJob(_0x215d54,_0x253c3e,_0xef975f));});return BPromise[_0xfb2a('0x46')](_0x18ca20);})[_0xfb2a('0x3a')](function(_0x4fa6e6){if(_0x4fa6e6){if(!_0x4fa6e6[_0xfb2a('0x47')]||_0x4fa6e6[_0xfb2a('0x47')]!==_0xfb2a('0x48')){logger[_0xfb2a('0x3b')](util['inspect'](_0x4fa6e6,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1a9e=['error','start','lodash','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','Transcript\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all'];(function(_0x346e95,_0x3ba334){var _0x3a6b99=function(_0x160e8d){while(--_0x160e8d){_0x346e95['push'](_0x346e95['shift']());}};_0x3a6b99(++_0x3ba334);}(_0x1a9e,0x122));var _0xe1a9=function(_0x2e44c3,_0x4da5a0){_0x2e44c3=_0x2e44c3-0x0;var _0x4f5b7c=_0x1a9e[_0x2e44c3];return _0x4f5b7c;};var _=require(_0xe1a9('0x0'));var AWS=require('aws-sdk');var rp=require(_0xe1a9('0x1'));var util=require('util');var BPromise=require(_0xe1a9('0x2'));var db=require(_0xe1a9('0x3'))['db'];var logger=require(_0xe1a9('0x4'))(_0xe1a9('0x5'));function getTranscriptionJob(_0x183c84,_0x59f698,_0x16f105,_0xb5e5a4){return new Promise(function(_0x1fbb0f,_0x389ed2){var _0x396dc3=new AWS[(_0xe1a9('0x6'))]({'accessKeyId':_0x59f698,'secretAccessKey':_0x183c84,'region':_0x16f105});_0x396dc3['getTranscriptionJob']({'TranscriptionJobName':_0xb5e5a4},function(_0x1337f8,_0x1e38ca){if(_0x1337f8){return _0x389ed2(_0x1337f8);}else{return _0x1fbb0f(_0x1e38ca);}});});}function sentiment(_0x2f6b61,_0x1d451c,_0x22f41c,_0x15f141,_0x580fca){return new Promise(function(_0x502785,_0x58bdb4){var _0x4c2b90=new AWS[(_0xe1a9('0x7'))]({'accessKeyId':_0x1d451c,'secretAccessKey':_0x2f6b61,'region':_0x22f41c});_0x4c2b90[_0xe1a9('0x8')]({'Text':_0x15f141,'LanguageCode':_0x580fca[_0xe1a9('0x9')](0x0,0x2)},function(_0x44928d,_0x1a2111){if(_0x44928d){return _0x58bdb4(_0x44928d);}else{return _0x502785(_0x1a2111);}});});}function checkTranscribeJob(_0x398f7a,_0x2bfa6b,_0x3e6fe8){var _0x29c33d;return new BPromise(function(_0x479038,_0x27af83){logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x398f7a['id'],_0x398f7a['transcribeName']));return getTranscriptionJob(_0x3e6fe8[_0xe1a9('0xc')],_0x3e6fe8['data2'],_0x2bfa6b['transcribeRegion'],_0x398f7a['transcribeName'])[_0xe1a9('0xd')](function(_0x26d99d){logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')](_0xe1a9('0xe'),_0x398f7a['id'],_0x398f7a[_0xe1a9('0xf')],_0x26d99d['TranscriptionJob'][_0xe1a9('0x10')]));if(!_0x398f7a[_0xe1a9('0x11')]){switch(_0x26d99d[_0xe1a9('0x12')][_0xe1a9('0x10')]){case _0xe1a9('0x13'):var _0x49444e={'transcribeStatus':_0x26d99d['TranscriptionJob'][_0xe1a9('0x10')],'fileUri':_0x26d99d[_0xe1a9('0x12')][_0xe1a9('0x14')][_0xe1a9('0x15')]};logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x398f7a['id']));return rp({'uri':_0x26d99d['TranscriptionJob'][_0xe1a9('0x14')][_0xe1a9('0x15')],'json':!![]})[_0xe1a9('0xd')](function(_0x59e777){logger['info'](util[_0xe1a9('0xb')](_0xe1a9('0x16'),_0x398f7a['id']));if(_0x59e777&&_0x59e777['results']&&_0x59e777['results'][_0xe1a9('0x17')]&&_0x59e777[_0xe1a9('0x18')][_0xe1a9('0x17')][_0xe1a9('0x19')]){_0x49444e[_0xe1a9('0x11')]='';for(var _0x33a8f2=0x0;_0x33a8f2<_0x59e777[_0xe1a9('0x18')][_0xe1a9('0x17')]['length'];_0x33a8f2++){_0x49444e[_0xe1a9('0x11')]+=_0x59e777[_0xe1a9('0x18')][_0xe1a9('0x17')][_0x33a8f2]['transcript']+'';}}return _0x398f7a[_0xe1a9('0x1a')](_0x49444e);})[_0xe1a9('0xd')](function(){logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')](_0xe1a9('0x1b'),_0x398f7a['id']));if(!_0x398f7a['tempSentiment']){throw new db['Sequelize'][(_0xe1a9('0x1c'))](_0xe1a9('0x1d'));}if(!_0x2bfa6b[_0xe1a9('0x1e')]||!_0x2bfa6b[_0xe1a9('0x1f')]||!_0x2bfa6b['sentimentRegion']||!_0x2bfa6b[_0xe1a9('0x20')]||!_0x2bfa6b[_0xe1a9('0x21')]){throw new db[(_0xe1a9('0x22'))][(_0xe1a9('0x1c'))](_0xe1a9('0x23'));}if(!_0x49444e['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2bfa6b[_0xe1a9('0x1f')]===_0x3e6fe8['id']){return _0x3e6fe8;}else{return db[_0xe1a9('0x24')][_0xe1a9('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xe1a9('0xd')](function(_0xba25b9){if(!_0xba25b9){throw new db['Sequelize'][(_0xe1a9('0x1c'))](_0xe1a9('0x26'));}if(!_0xba25b9[_0xe1a9('0xc')]||!_0xba25b9[_0xe1a9('0x27')]){throw new db['Sequelize']['ValidationError'](_0xe1a9('0x28'));}_0x29c33d=_0xba25b9;logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x398f7a['id']));return sentiment(_0x29c33d[_0xe1a9('0xc')],_0x29c33d[_0xe1a9('0x27')],_0x2bfa6b[_0xe1a9('0x29')],_0x49444e[_0xe1a9('0x11')],_0x2bfa6b['language']);})[_0xe1a9('0xd')](function(_0x2559e2){logger[_0xe1a9('0xa')](util['format'](_0xe1a9('0x2a'),_0x398f7a['id']));return _0x398f7a['update']({'sentiment':_0x2559e2[_0xe1a9('0x2b')],'sPositive':_0x2559e2[_0xe1a9('0x2c')]['Positive'],'sNegative':_0x2559e2['SentimentScore'][_0xe1a9('0x2d')],'sMixed':_0x2559e2[_0xe1a9('0x2c')][_0xe1a9('0x2e')],'sNeutral':_0x2559e2[_0xe1a9('0x2c')][_0xe1a9('0x2f')]});})[_0xe1a9('0xd')](function(){logger['info'](util[_0xe1a9('0xb')](_0xe1a9('0x1b'),_0x398f7a['id']));_0x479038();});case _0xe1a9('0x30'):return _0x398f7a['update']({'transcribeStatus':_0xe1a9('0x30'),'failureReason':_0x26d99d[_0xe1a9('0x12')][_0xe1a9('0x31')]})[_0xe1a9('0xd')](function(){logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')](_0xe1a9('0x1b'),_0x398f7a['id']));_0x479038();});default:logger[_0xe1a9('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x398f7a['id']));break;}}else{return BPromise[_0xe1a9('0x32')]()[_0xe1a9('0xd')](function(){if(!_0x398f7a[_0xe1a9('0x33')]){throw new db[(_0xe1a9('0x22'))]['ValidationError'](_0xe1a9('0x1d'));}if(!_0x2bfa6b[_0xe1a9('0x1e')]||!_0x2bfa6b[_0xe1a9('0x1f')]||!_0x2bfa6b[_0xe1a9('0x29')]||!_0x2bfa6b[_0xe1a9('0x20')]||!_0x2bfa6b[_0xe1a9('0x21')]){throw new db[(_0xe1a9('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x398f7a[_0xe1a9('0x11')]){throw new Error(_0xe1a9('0x34'));}if(_0x2bfa6b[_0xe1a9('0x1f')]===_0x3e6fe8['id']){return _0x3e6fe8;}else{return db[_0xe1a9('0x24')][_0xe1a9('0x25')]({'where':{'id':_settings[_0xe1a9('0x1f')]}});}})['then'](function(_0x12f90d){if(!_0x12f90d){throw new db[(_0xe1a9('0x22'))]['ValidationError'](_0xe1a9('0x26'));}if(!_0x12f90d[_0xe1a9('0xc')]||!_0x12f90d[_0xe1a9('0x27')]){throw new db[(_0xe1a9('0x22'))][(_0xe1a9('0x1c'))](_0xe1a9('0x28'));}_0x29c33d=_0x12f90d;logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')](_0xe1a9('0x35'),_0x398f7a['id']));return sentiment(_0x29c33d[_0xe1a9('0xc')],_0x29c33d[_0xe1a9('0x27')],_0x2bfa6b[_0xe1a9('0x29')],_0x398f7a[_0xe1a9('0x11')],_0x2bfa6b[_0xe1a9('0x20')]);})[_0xe1a9('0xd')](function(_0x41ef8e){logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')](_0xe1a9('0x2a'),_0x398f7a['id']));return _0x398f7a[_0xe1a9('0x1a')]({'sentiment':_0x41ef8e[_0xe1a9('0x2b')],'sPositive':_0x41ef8e['SentimentScore'][_0xe1a9('0x36')],'sNegative':_0x41ef8e[_0xe1a9('0x2c')][_0xe1a9('0x2d')],'sMixed':_0x41ef8e[_0xe1a9('0x2c')]['Mixed'],'sNeutral':_0x41ef8e[_0xe1a9('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0xe1a9('0xa')](util[_0xe1a9('0xb')](_0xe1a9('0x1b'),_0x398f7a['id']));_0x479038();});}})[_0xe1a9('0x37')](function(_0x52db2c){if(_0x52db2c){if(!_0x52db2c[_0xe1a9('0x38')]||_0x52db2c[_0xe1a9('0x38')]!==_0xe1a9('0x39')){logger['error'](util['format'](_0xe1a9('0x3a'),_0x398f7a['id']),util[_0xe1a9('0x3b')](_0x52db2c,{'showHidden':![],'depth':null}));}}_0x479038();});});}function checkTranscribe(){var _0x871ec4;var _0xbb40a0;var _0x377370;return db['VoiceRecording'][_0xe1a9('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xe1a9('0xd')](function(_0x3de0f8){if(!_0x3de0f8||!_0x3de0f8[_0xe1a9('0x19')]){throw new db[(_0xe1a9('0x22'))][(_0xe1a9('0x1c'))](_0xe1a9('0x3d'));}_0x871ec4=_0x3de0f8;return db[_0xe1a9('0x3e')][_0xe1a9('0x25')]({'where':{'id':0x1}});})[_0xe1a9('0xd')](function(_0x424ed8){if(!_0x424ed8){throw new db[(_0xe1a9('0x22'))]['ValidationError'](_0xe1a9('0x3f'));}_0xbb40a0=_0x424ed8;if(!_0xbb40a0[_0xe1a9('0x5')]||!_0xbb40a0[_0xe1a9('0x40')]||!_0xbb40a0[_0xe1a9('0x41')]||!_0xbb40a0[_0xe1a9('0x20')]||!_0xbb40a0['bucket']){throw new db[(_0xe1a9('0x22'))][(_0xe1a9('0x1c'))](_0xe1a9('0x42'));}return db[_0xe1a9('0x24')][_0xe1a9('0x25')]({'where':{'id':_0xbb40a0[_0xe1a9('0x40')]}});})[_0xe1a9('0xd')](function(_0x466537){if(!_0x466537){throw new db[(_0xe1a9('0x22'))][(_0xe1a9('0x1c'))](_0xe1a9('0x26'));}if(!_0x466537[_0xe1a9('0xc')]||!_0x466537[_0xe1a9('0x27')]){throw new db['Sequelize'][(_0xe1a9('0x1c'))](_0xe1a9('0x28'));}_0x377370=_0x466537;var _0x226c14=[];_0x871ec4[_0xe1a9('0x43')](function(_0x1d2385){_0x226c14[_0xe1a9('0x44')](checkTranscribeJob(_0x1d2385,_0xbb40a0,_0x377370));});return BPromise[_0xe1a9('0x45')](_0x226c14);})['catch'](function(_0x4dcbbc){if(_0x4dcbbc){if(!_0x4dcbbc[_0xe1a9('0x38')]||_0x4dcbbc['name']!=='SequelizeValidationError'){logger[_0xe1a9('0x46')](util[_0xe1a9('0x3b')](_0x4dcbbc,{'showHidden':![],'depth':null}));}}});}exports[_0xe1a9('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 10ef45c..3e2b1d5 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 _0xc47a=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xc47a,0x1ab));var _0xac47=function(_0x1e07ac,_0x280be8){_0x1e07ac=_0x1e07ac-0x0;var _0xbc98f0=_0xc47a[_0x1e07ac];return _0xbc98f0;};'use strict';var _=require(_0xac47('0x0'));var moment=require(_0xac47('0x1'));var Redis=require('ioredis');var util=require(_0xac47('0x2'));var config=require(_0xac47('0x3'));var db=require(_0xac47('0x4'))['db'];var logger=require('../logger')('schedule');config[_0xac47('0x5')]=_[_0xac47('0x6')](config[_0xac47('0x5')],{'host':_0xac47('0x7'),'port':0x18eb});var io=require(_0xac47('0x8'))(new Redis(config[_0xac47('0x5')]));function closeInteractions(){var _0x511aab=[];return db[_0xac47('0x9')][_0xac47('0xa')]({'raw':!![],'attributes':['id',_0xac47('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xac47('0xc')](0x18,_0xac47('0xd'))}}})['then'](function(_0x475aab){if(_0x475aab&&_0x475aab[_0xac47('0xe')]){_0x511aab=_[_0xac47('0xf')](_0x475aab||[],'id');logger[_0xac47('0x10')](_0xac47('0x11'),_0x511aab[_0xac47('0x12')]());return db[_0xac47('0x9')][_0xac47('0x13')]({'closeReason':_0xac47('0x14'),'disposition':_0xac47('0x15'),'closed':!![],'closedAt':moment()[_0xac47('0x16')](_0xac47('0x17'))},{'where':{'id':_0x511aab}});}})['then'](function(){if(_0x511aab&&_0x511aab[_0xac47('0xe')]){logger[_0xac47('0x10')](_0xac47('0x18'),_0x511aab['join']());for(var _0x1f7f86=0x0;_0x1f7f86<_0x511aab[_0xac47('0xe')];_0x1f7f86++){io['emit'](_0xac47('0x19'),{'id':_0x511aab[_0x1f7f86],'closed':!![]});}}})[_0xac47('0x1a')](function(_0x3b3b71){logger['error'](_0xac47('0x1b'),_0x3b3b71?util[_0xac47('0x1c')](_0x3b3b71,{'showHidden':![],'depth':null}):'');});}exports[_0xac47('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8bdf=['socket.io-emitter','redis','findAll','lastMsgAt','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','ioredis','../../config/environment','../logger','schedule','defaults','localhost'];(function(_0x32c29a,_0x57f5af){var _0x45e862=function(_0x4f909c){while(--_0x4f909c){_0x32c29a['push'](_0x32c29a['shift']());}};_0x45e862(++_0x57f5af);}(_0x8bdf,0xfe));var _0xf8bd=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x8bdf[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xf8bd('0x0'));var moment=require('moment');var Redis=require(_0xf8bd('0x1'));var util=require('util');var config=require(_0xf8bd('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xf8bd('0x3'))(_0xf8bd('0x4'));config['redis']=_[_0xf8bd('0x5')](config['redis'],{'host':_0xf8bd('0x6'),'port':0x18eb});var io=require(_0xf8bd('0x7'))(new Redis(config[_0xf8bd('0x8')]));function closeInteractions(){var _0x3d5ee3=[];return db['WhatsappInteraction'][_0xf8bd('0x9')]({'raw':!![],'attributes':['id',_0xf8bd('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf8bd('0xb'))}}})['then'](function(_0x3d87a3){if(_0x3d87a3&&_0x3d87a3['length']){_0x3d5ee3=_[_0xf8bd('0xc')](_0x3d87a3||[],'id');logger[_0xf8bd('0xd')](_0xf8bd('0xe'),_0x3d5ee3[_0xf8bd('0xf')]());return db[_0xf8bd('0x10')][_0xf8bd('0x11')]({'closeReason':_0xf8bd('0x12'),'disposition':_0xf8bd('0x13'),'closed':!![],'closedAt':moment()[_0xf8bd('0x14')](_0xf8bd('0x15'))},{'where':{'id':_0x3d5ee3}});}})['then'](function(){if(_0x3d5ee3&&_0x3d5ee3[_0xf8bd('0x16')]){logger[_0xf8bd('0xd')](_0xf8bd('0x17'),_0x3d5ee3[_0xf8bd('0xf')]());for(var _0x279270=0x0;_0x279270<_0x3d5ee3[_0xf8bd('0x16')];_0x279270++){io[_0xf8bd('0x18')](_0xf8bd('0x19'),{'id':_0x3d5ee3[_0x279270],'closed':!![]});}}})[_0xf8bd('0x1a')](function(_0x297fa7){logger['error'](_0xf8bd('0x1b'),_0x297fa7?util['inspect'](_0x297fa7,{'showHidden':![],'depth':null}):'');});}exports[_0xf8bd('0x1c')]=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 644f909..d2b8991 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b6e=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','bulkCreate','log','contacts1','CmHopper','then','finished\x20populating','hopper1','contacts2','hopper2','catch','util'];(function(_0x1156ac,_0x55e237){var _0x49601c=function(_0x282636){while(--_0x282636){_0x1156ac['push'](_0x1156ac['shift']());}};_0x49601c(++_0x55e237);}(_0x7b6e,0x8b));var _0xe7b6=function(_0x480843,_0x8121e6){_0x480843=_0x480843-0x0;var _0x1d5cd9=_0x7b6e[_0x480843];return _0x1d5cd9;};'use strict';var util=require(_0xe7b6('0x0'));var db=require(_0xe7b6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe7b6('0x2')]({'id':i,'firstName':_0xe7b6('0x3')+i,'lastName':_0xe7b6('0x4')+i,'phone':0xf879fb460+i,'email':_0xe7b6('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe7b6('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe7b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe7b6('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe7b6('0x4')+i,'phone':0xf879fb460+i,'email':_0xe7b6('0x5')+i+_0xe7b6('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe7b6('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe7b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe7b6('0x6')](),'updatedAt':Date[_0xe7b6('0x6')]()});}db[_0xe7b6('0x8')][_0xe7b6('0x9')]({'where':{}})['then'](function(){return db[_0xe7b6('0x8')][_0xe7b6('0xa')](contacts);})['then'](function(){console[_0xe7b6('0xb')]('finished\x20populating',_0xe7b6('0xc'));return db[_0xe7b6('0xd')]['destroy']({'where':{}});})[_0xe7b6('0xe')](function(){return db[_0xe7b6('0xd')][_0xe7b6('0xa')](hopper);})[_0xe7b6('0xe')](function(){console[_0xe7b6('0xb')](_0xe7b6('0xf'),_0xe7b6('0x10'));return db[_0xe7b6('0x8')][_0xe7b6('0xa')](contacts2);})['then'](function(){console[_0xe7b6('0xb')](_0xe7b6('0xf'),_0xe7b6('0x11'));return db[_0xe7b6('0xd')]['bulkCreate'](hopper2);})[_0xe7b6('0xe')](function(){console[_0xe7b6('0xb')]('finished\x20populating',_0xe7b6('0x12'));})[_0xe7b6('0x13')](function(_0x253313){console[_0xe7b6('0xb')](_0x253313);}); \ No newline at end of file +var _0x8028=['contacts2','hopper2','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1'];(function(_0x7e846e,_0x23bafc){var _0x4b8264=function(_0x3be2fa){while(--_0x3be2fa){_0x7e846e['push'](_0x7e846e['shift']());}};_0x4b8264(++_0x23bafc);}(_0x8028,0x18e));var _0x8802=function(_0x2ed8b7,_0x1f9b8e){_0x2ed8b7=_0x2ed8b7-0x0;var _0x1778e8=_0x8028[_0x2ed8b7];return _0x1778e8;};'use strict';var util=require('util');var db=require(_0x8802('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8802('0x1')]({'id':i,'firstName':_0x8802('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x8802('0x3')+i+_0x8802('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8802('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8802('0x5')](),'updatedAt':Date[_0x8802('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8802('0x1')]({'id':i,'firstName':_0x8802('0x2')+i,'lastName':_0x8802('0x6')+i,'phone':0xf879fb460+i,'email':_0x8802('0x3')+i+_0x8802('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8802('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x8802('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8802('0x5')](),'updatedAt':Date[_0x8802('0x5')]()});}db[_0x8802('0x7')][_0x8802('0x8')]({'where':{}})[_0x8802('0x9')](function(){return db[_0x8802('0x7')]['bulkCreate'](contacts);})[_0x8802('0x9')](function(){console[_0x8802('0xa')](_0x8802('0xb'),_0x8802('0xc'));return db['CmHopper'][_0x8802('0x8')]({'where':{}});})[_0x8802('0x9')](function(){return db[_0x8802('0xd')][_0x8802('0xe')](hopper);})[_0x8802('0x9')](function(){console[_0x8802('0xa')](_0x8802('0xb'),_0x8802('0xf'));return db[_0x8802('0x7')][_0x8802('0xe')](contacts2);})['then'](function(){console[_0x8802('0xa')](_0x8802('0xb'),_0x8802('0x10'));return db['CmHopper'][_0x8802('0xe')](hopper2);})[_0x8802('0x9')](function(){console['log']('finished\x20populating',_0x8802('0x11'));})['catch'](function(_0x2a376a){console[_0x8802('0xa')](_0x2a376a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 0f5f32b..fb401b7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8a2=['then','log','add\x20user','catch','util','../mysqldb','format','agent','%s%s','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xc8a2,0x97));var _0x2c8a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc8a2[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x2c8a('0x0'));var db=require(_0x2c8a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x2c8a('0x2')]('%s%s',_0x2c8a('0x3'),i),'fullname':util[_0x2c8a('0x2')](_0x2c8a('0x4'),_0x2c8a('0x3'),i),'email':util['format']('%s%s@xcally.com',_0x2c8a('0x3'),i),'role':_0x2c8a('0x3'),'password':_0x2c8a('0x5'),'internal':0xfa0+i,'type':_0x2c8a('0x6'),'transport':[_0x2c8a('0x7'),'ws','wss'],'disallow':[_0x2c8a('0x8')],'allow':[_0x2c8a('0x9')],'defaultuser':util['format'](_0x2c8a('0x4'),_0x2c8a('0x3'),i),'encryption':'yes','avpf':'yes','force_avp':_0x2c8a('0xa'),'icesupport':_0x2c8a('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x2c8a('0xb'),'dtlsprivatekey':_0x2c8a('0xc'),'dtlssetup':_0x2c8a('0xd'),'callerid':util[_0x2c8a('0x2')](_0x2c8a('0xe'),util[_0x2c8a('0x2')](_0x2c8a('0x4'),_0x2c8a('0x3'),i),0xfa0+i)});}db[_0x2c8a('0xf')][_0x2c8a('0x10')](users)[_0x2c8a('0x11')](function(){console[_0x2c8a('0x12')](_0x2c8a('0x13'));})[_0x2c8a('0x14')](function(_0x2d50b0){console[_0x2c8a('0x12')](_0x2d50b0);}); \ No newline at end of file +var _0x0d9f=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes'];(function(_0xf18b3d,_0x19c7c8){var _0x31a03d=function(_0x548f73){while(--_0x548f73){_0xf18b3d['push'](_0xf18b3d['shift']());}};_0x31a03d(++_0x19c7c8);}(_0x0d9f,0x1d7));var _0xf0d9=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x0d9f[_0x22e9fe];return _0x47cd19;};'use strict';var util=require(_0xf0d9('0x0'));var db=require(_0xf0d9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xf0d9('0x2'),_0xf0d9('0x3'),i),'fullname':util[_0xf0d9('0x4')]('%s%s',_0xf0d9('0x3'),i),'email':util[_0xf0d9('0x4')](_0xf0d9('0x5'),_0xf0d9('0x3'),i),'role':_0xf0d9('0x3'),'password':_0xf0d9('0x6'),'internal':0xfa0+i,'type':_0xf0d9('0x7'),'transport':[_0xf0d9('0x8'),'ws',_0xf0d9('0x9')],'disallow':[_0xf0d9('0xa')],'allow':[_0xf0d9('0xb')],'defaultuser':util[_0xf0d9('0x4')](_0xf0d9('0x2'),_0xf0d9('0x3'),i),'encryption':'yes','avpf':_0xf0d9('0xc'),'force_avp':_0xf0d9('0xc'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xf0d9('0xd'),'dtlsprivatekey':_0xf0d9('0xe'),'dtlssetup':_0xf0d9('0xf'),'callerid':util[_0xf0d9('0x4')](_0xf0d9('0x10'),util[_0xf0d9('0x4')](_0xf0d9('0x2'),_0xf0d9('0x3'),i),0xfa0+i)});}db[_0xf0d9('0x11')][_0xf0d9('0x12')](users)[_0xf0d9('0x13')](function(){console[_0xf0d9('0x14')](_0xf0d9('0x15'));})['catch'](function(_0xaad9a0){console['log'](_0xaad9a0);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 18e2de9..26c74d6 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd641=['catch','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','MailQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','map','resourceId','User','where','length','format','user:%s','handshake','query','find','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','Campaign','user','voice:inbound','userProfileId','FaxQueues','SmsQueues','SmsQueue','WhatsappQueues','WhatsappQueue','Trunks','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','sms','mail','openchannel','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions'];(function(_0x484590,_0x47818c){var _0x274de2=function(_0x321039){while(--_0x321039){_0x484590['push'](_0x484590['shift']());}};_0x274de2(++_0x47818c);}(_0xd641,0xd9));var _0x1d64=function(_0x57ff42,_0x31f545){_0x57ff42=_0x57ff42-0x0;var _0xd21970=_0xd641[_0x57ff42];return _0xd21970;};'use strict';var _=require(_0x1d64('0x0'));var util=require(_0x1d64('0x1'));var BPromise=require(_0x1d64('0x2'));var db=require(_0x1d64('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x1d64('0x4')],'include':[{'as':_0x1d64('0x5'),'model':db['User'],'attributes':['id',_0x1d64('0x4'),_0x1d64('0x6')],'raw':!![],'where':{'role':_0x1d64('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1d64('0x4')],'where':{'role':_0x1d64('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1d64('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x1d64('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1d64('0x4'),_0x1d64('0x9')],'where':{'type':_0x1d64('0xa')}};function getAssociatedResources(_0x5226cb,_0xefc28b,_0x20f1d0){return db[_0x1d64('0xb')][_0x1d64('0xc')]({'where':{'name':_0x5226cb,'userProfileId':_0xefc28b},'raw':!![]})[_0x1d64('0xd')](function(_0x357de8){if(_0x357de8){if(_0x357de8[_0x1d64('0xe')]){switch(_0x5226cb){case'VoiceQueues':case _0x1d64('0xf'):case'FaxQueues':case'SmsQueues':case _0x1d64('0x10'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x20f1d0][_0x1d64('0x11')](queryQueues);case _0x1d64('0x12'):return db[_0x20f1d0][_0x1d64('0x11')](queryTelephones);case'Trunks':return db[_0x20f1d0]['findAll'](queryTrunks);case _0x1d64('0x13'):return db[_0x20f1d0][_0x1d64('0x11')](queryCampaigns);}}else{return db[_0x1d64('0x14')][_0x1d64('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x357de8['id']},'raw':!![]})[_0x1d64('0xd')](function(_0x5816ef){if(_0x5816ef){var _0x39dc28={'where':{'id':_[_0x1d64('0x15')](_0x5816ef,_0x1d64('0x16'))},'raw':!![]};switch(_0x20f1d0){case _0x1d64('0x17'):_0x39dc28[_0x1d64('0x18')][_0x1d64('0x6')]=_0x1d64('0x8');break;case'Campaign':_0x39dc28[_0x1d64('0x18')][_0x1d64('0x9')]='ivr';break;}return db[_0x20f1d0][_0x1d64('0x11')](_0x39dc28);}else{return[];}});}}else{return[];}})[_0x1d64('0xd')](function(_0x1ac73b){return _0x1ac73b;});}function joinOrLeaveQueues(_0x2efee3,_0x574ed6,_0x119a22,_0x47d8e6){_0x2efee3[_0x574ed6](util['format']('%s:queue:%s',_0x119a22,_0x47d8e6['name']));if(_0x47d8e6[_0x1d64('0x5')]){for(var _0x285778=0x0;_0x285778<_0x47d8e6[_0x1d64('0x5')][_0x1d64('0x19')];_0x285778+=0x1){_0x2efee3[_0x574ed6](util[_0x1d64('0x1a')](_0x1d64('0x1b'),_0x47d8e6[_0x1d64('0x5')][_0x285778][_0x1d64('0x4')]));}}}function joinOrLeave(_0xb79c4d,_0x399b59,_0x2a453b){var _0x4a1c53;if(_0xb79c4d[_0x1d64('0x1c')][_0x1d64('0x1d')]['id']){db['User'][_0x1d64('0x1e')]({'attributes':['id',_0x1d64('0x4'),_0x1d64('0x6'),'userProfileId'],'where':{'id':_0xb79c4d['handshake'][_0x1d64('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1d64('0x1f')],'as':_0x1d64('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d64('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x1d64('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d64('0x23')],'as':_0x1d64('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d64('0x25')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x1d64('0xd')](function(_0x39967c){if(_0x39967c){_0x4a1c53=_0x39967c;_0xb79c4d[_0x399b59](util[_0x1d64('0x1a')](_0x1d64('0x1b'),_0x39967c['name']));var _0x737858=[];switch(_0x39967c[_0x1d64('0x6')]){case _0x1d64('0x26'):_0xb79c4d[_0x399b59]('voice:inbound');_0xb79c4d[_0x399b59](_0x1d64('0x27'));if(queryQueues[_0x1d64('0x28')](_0x1d64('0x29'))){delete queryQueues[_0x1d64('0x29')];}_0x737858[_0x1d64('0x2a')](db[_0x1d64('0x2b')]['findAll'](queryQueues));_0x737858[_0x1d64('0x2a')](db[_0x1d64('0x2c')][_0x1d64('0x11')](queryQueues));_0x737858[_0x1d64('0x2a')](db[_0x1d64('0x2d')]['findAll'](queryQueues));_0x737858[_0x1d64('0x2a')](db['SmsQueue']['findAll'](queryQueues));_0x737858['push'](db[_0x1d64('0x2e')]['findAll'](queryQueues));_0x737858[_0x1d64('0x2a')](db[_0x1d64('0x2f')]['findAll'](queryQueues));_0x737858[_0x1d64('0x2a')](db['WhatsappQueue']['findAll'](queryQueues));_0x737858[_0x1d64('0x2a')](db[_0x1d64('0x17')][_0x1d64('0x11')](queryTelephones));_0x737858[_0x1d64('0x2a')](db['Trunk']['findAll'](queryTrunks));_0x737858[_0x1d64('0x2a')](db[_0x1d64('0x30')][_0x1d64('0x11')](queryCampaigns));_0x737858[_0x1d64('0x2a')](db['User'][_0x1d64('0x11')](queryAgents));break;case _0x1d64('0x31'):_0xb79c4d[_0x399b59](_0x1d64('0x32'));_0xb79c4d[_0x399b59](_0x1d64('0x27'));_0x737858[_0x1d64('0x2a')](getAssociatedResources('VoiceQueues',_0x39967c[_0x1d64('0x33')],_0x1d64('0x2b')));_0x737858[_0x1d64('0x2a')](getAssociatedResources(_0x1d64('0xf'),_0x39967c[_0x1d64('0x33')],_0x1d64('0x2c')));_0x737858[_0x1d64('0x2a')](getAssociatedResources(_0x1d64('0x34'),_0x39967c['userProfileId'],_0x1d64('0x2d')));_0x737858[_0x1d64('0x2a')](getAssociatedResources(_0x1d64('0x35'),_0x39967c[_0x1d64('0x33')],_0x1d64('0x36')));_0x737858['push'](getAssociatedResources(_0x1d64('0x10'),_0x39967c['userProfileId'],_0x1d64('0x2e')));_0x737858['push'](getAssociatedResources('OpenchannelQueues',_0x39967c[_0x1d64('0x33')],_0x1d64('0x2f')));_0x737858[_0x1d64('0x2a')](getAssociatedResources(_0x1d64('0x37'),_0x39967c[_0x1d64('0x33')],_0x1d64('0x38')));_0x737858[_0x1d64('0x2a')](getAssociatedResources(_0x1d64('0x12'),_0x39967c[_0x1d64('0x33')],_0x1d64('0x17')));_0x737858[_0x1d64('0x2a')](getAssociatedResources(_0x1d64('0x39'),_0x39967c[_0x1d64('0x33')],_0x1d64('0x3a')));_0x737858[_0x1d64('0x2a')](getAssociatedResources(_0x1d64('0x13'),_0x39967c[_0x1d64('0x33')],_0x1d64('0x30')));_0x737858[_0x1d64('0x2a')](db[_0x1d64('0x17')][_0x1d64('0x11')](queryAgents));break;case _0x1d64('0x7'):_0xb79c4d[_0x399b59]('voice:inbound');_0xb79c4d[_0x399b59](_0x1d64('0x27'));_0x737858[_0x1d64('0x2a')](_0x39967c[_0x1d64('0x3b')]({'attributes':['id',_0x1d64('0x4')]}));_0x737858[_0x1d64('0x2a')](_0x39967c[_0x1d64('0x3c')]({'attributes':['id',_0x1d64('0x4')]}));_0x737858['push'](_0x39967c[_0x1d64('0x3d')]({'attributes':['id',_0x1d64('0x4')]}));_0x737858['push'](_0x39967c[_0x1d64('0x3e')]({'attributes':['id',_0x1d64('0x4')]}));_0x737858['push'](_0x39967c[_0x1d64('0x3f')]({'attributes':['id',_0x1d64('0x4')]}));_0x737858[_0x1d64('0x2a')](_0x39967c[_0x1d64('0x40')]({'attributes':['id',_0x1d64('0x4')]}));_0x737858[_0x1d64('0x2a')](_0x39967c[_0x1d64('0x41')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x737858);}})['then'](function(_0x285c62){if(_0x285c62&&_0x285c62[_0x1d64('0x19')]){for(var _0x283a46=0x0;_0x283a46<_0x285c62['length'];_0x283a46+=0x1){for(var _0x39768c=0x0;_0x39768c<_0x285c62[_0x283a46][_0x1d64('0x19')];_0x39768c+=0x1){switch(_0x283a46){case 0x0:joinOrLeaveQueues(_0xb79c4d,_0x399b59,_0x1d64('0x42'),_0x285c62[_0x283a46][_0x39768c]);break;case 0x1:joinOrLeaveQueues(_0xb79c4d,_0x399b59,'chat',_0x285c62[_0x283a46][_0x39768c]);break;case 0x2:joinOrLeaveQueues(_0xb79c4d,_0x399b59,'fax',_0x285c62[_0x283a46][_0x39768c]);break;case 0x3:joinOrLeaveQueues(_0xb79c4d,_0x399b59,_0x1d64('0x43'),_0x285c62[_0x283a46][_0x39768c]);break;case 0x4:joinOrLeaveQueues(_0xb79c4d,_0x399b59,_0x1d64('0x44'),_0x285c62[_0x283a46][_0x39768c]);break;case 0x5:joinOrLeaveQueues(_0xb79c4d,_0x399b59,_0x1d64('0x45'),_0x285c62[_0x283a46][_0x39768c]);break;case 0x6:joinOrLeaveQueues(_0xb79c4d,_0x399b59,'whatsapp',_0x285c62[_0x283a46][_0x39768c]);break;case 0x7:if(_0x4a1c53[_0x1d64('0x6')]!==_0x1d64('0x7'))_0xb79c4d[_0x399b59](util[_0x1d64('0x1a')](_0x1d64('0x46'),_0x285c62[_0x283a46][_0x39768c]['name']));break;case 0x8:if(_0x4a1c53[_0x1d64('0x6')]!==_0x1d64('0x7'))_0xb79c4d[_0x399b59](util[_0x1d64('0x1a')](_0x1d64('0x47'),_0x285c62[_0x283a46][_0x39768c]['name']));break;case 0x9:if(_0x4a1c53[_0x1d64('0x6')]!==_0x1d64('0x7'))_0xb79c4d[_0x399b59](util['format']('campaign:%s:%s',_0x285c62[_0x283a46][_0x39768c][_0x1d64('0x9')],_0x285c62[_0x283a46][_0x39768c][_0x1d64('0x4')]));break;case 0xa:_0xb79c4d[_0x399b59](util[_0x1d64('0x1a')](_0x1d64('0x1b'),_0x285c62[_0x283a46][_0x39768c][_0x1d64('0x4')]));break;}}}}})[_0x1d64('0xd')](function(){if(_0x399b59===_0x1d64('0x48')){var _0x282279=_[_0x1d64('0x15')](_0x4a1c53[_0x1d64('0x49')],'id');return _0x4a1c53[_0x1d64('0x4a')](_0x282279)[_0x1d64('0xd')](function(){for(var _0x4f13d6=0x0;_0x4f13d6<_0x282279[_0x1d64('0x19')];_0x4f13d6+=0x1){_0x2a453b[_0x1d64('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x282279[_0x4f13d6]),'UserId':Number(_0x4a1c53['id'])});}});}})[_0x1d64('0xd')](function(){if(_0x399b59===_0x1d64('0x48')){var _0x4400c7=_[_0x1d64('0x15')](_0x4a1c53[_0x1d64('0x20')],'id');return _0x4a1c53[_0x1d64('0x4c')](_0x4400c7)['then'](function(){for(var _0x98ac0e=0x0;_0x98ac0e<_0x4400c7[_0x1d64('0x19')];_0x98ac0e+=0x1){_0x2a453b[_0x1d64('0x4b')](_0x1d64('0x4d'),{'MailInteractionId':Number(_0x4400c7[_0x98ac0e]),'UserId':Number(_0x4a1c53['id'])});}});}})[_0x1d64('0xd')](function(){if(_0x399b59===_0x1d64('0x48')){var _0x30d7e6=_['map'](_0x4a1c53[_0x1d64('0x4e')],'id');return _0x4a1c53[_0x1d64('0x4f')](_0x30d7e6)[_0x1d64('0xd')](function(){for(var _0x1e2d52=0x0;_0x1e2d52<_0x30d7e6[_0x1d64('0x19')];_0x1e2d52+=0x1){_0x2a453b['emit'](_0x1d64('0x50'),{'FaxInteractionId':Number(_0x30d7e6[_0x1e2d52]),'UserId':Number(_0x4a1c53['id'])});}});}})[_0x1d64('0xd')](function(){if(_0x399b59==='leave'){var _0x1b5604=_[_0x1d64('0x15')](_0x4a1c53[_0x1d64('0x22')],'id');return _0x4a1c53[_0x1d64('0x51')](_0x1b5604)['then'](function(){for(var _0x70ff69=0x0;_0x70ff69<_0x1b5604['length'];_0x70ff69+=0x1){_0x2a453b[_0x1d64('0x4b')](_0x1d64('0x52'),{'SmsInteractionId':Number(_0x1b5604[_0x70ff69]),'UserId':Number(_0x4a1c53['id'])});}});}})[_0x1d64('0xd')](function(){if(_0x399b59===_0x1d64('0x48')){var _0x53b5ab=_[_0x1d64('0x15')](_0x4a1c53[_0x1d64('0x24')],'id');return _0x4a1c53[_0x1d64('0x53')](_0x53b5ab)[_0x1d64('0xd')](function(){for(var _0x1e2d45=0x0;_0x1e2d45<_0x53b5ab[_0x1d64('0x19')];_0x1e2d45+=0x1){_0x2a453b[_0x1d64('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x53b5ab[_0x1e2d45]),'UserId':Number(_0x4a1c53['id'])});}});}})[_0x1d64('0xd')](function(){if(_0x399b59===_0x1d64('0x48')){var _0x2a01a8=_[_0x1d64('0x15')](_0x4a1c53[_0x1d64('0x54')],'id');return _0x4a1c53[_0x1d64('0x55')](_0x2a01a8)['then'](function(){for(var _0x27474c=0x0;_0x27474c<_0x2a01a8['length'];_0x27474c+=0x1){_0x2a453b[_0x1d64('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2a01a8[_0x27474c]),'UserId':Number(_0x4a1c53['id'])});}});}})[_0x1d64('0x56')](function(_0x550fb8){_0xb79c4d['log'](_0x550fb8);});}}function onDisconnect(_0xca3b7b,_0x3ae389){joinOrLeave(_0xca3b7b,_0x1d64('0x48'),_0x3ae389);}function onConnect(_0x50ebb4){joinOrLeave(_0x50ebb4,_0x1d64('0x57'));}exports[_0x1d64('0x58')]=function(_0x5aad48){_0x5aad48['on'](_0x1d64('0x59'),function(_0xc7fcd9){_0xc7fcd9[_0x1d64('0x5a')](0x0);_0xc7fcd9['address']=_0xc7fcd9[_0x1d64('0x5b')][_0x1d64('0x59')][_0x1d64('0x5c')]+':'+_0xc7fcd9[_0x1d64('0x5b')][_0x1d64('0x59')][_0x1d64('0x5d')];_0xc7fcd9[_0x1d64('0x5e')]=new Date();_0xc7fcd9[_0x1d64('0x5f')]=function(_0x29c82c){console['log'](_0x1d64('0x60')+_0xc7fcd9[_0x1d64('0x61')][_0x1d64('0x4')]+'['+_0xc7fcd9[_0x1d64('0x62')]+']',_0x29c82c);};_0xc7fcd9['on'](_0x1d64('0x63'),function(){onDisconnect(_0xc7fcd9,_0x5aad48);_0xc7fcd9['log']('DISCONNECTED');});onConnect(_0xc7fcd9);_0xc7fcd9['log'](_0x1d64('0x64'));});}; \ No newline at end of file +var _0x8861=['user_has_sms_interactions:remove','user_has_whatsapp_interactions:remove','catch','join','default','address','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','log','DISCONNECTED','CONNECTED','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','type','format','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','include','push','VoiceQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','voice:outbound','ChatQueue','Trunks','getChatQueues','getSmsQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','whatsapp','campaign:%s:%s','leave','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x8861,0x6d));var _0x1886=function(_0x3138b1,_0x2d2944){_0x3138b1=_0x3138b1-0x0;var _0x1b285d=_0x8861[_0x3138b1];return _0x1b285d;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x1886('0x0'));var db=require(_0x1886('0x1'))['db'];var config=require(_0x1886('0x2'));var queryQueues={'attributes':['id',_0x1886('0x3')],'include':[{'as':_0x1886('0x4'),'model':db[_0x1886('0x5')],'attributes':['id',_0x1886('0x3'),_0x1886('0x6')],'raw':!![],'where':{'role':_0x1886('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1886('0x3')],'where':{'role':_0x1886('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1886('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x1886('0x3')],'where':{'role':_0x1886('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1886('0x3'),'type'],'where':{'type':_0x1886('0x9')}};function getAssociatedResources(_0x534210,_0x1c49fa,_0x489fed){return db[_0x1886('0xa')]['findOne']({'where':{'name':_0x534210,'userProfileId':_0x1c49fa},'raw':!![]})[_0x1886('0xb')](function(_0x2b1f4a){if(_0x2b1f4a){if(_0x2b1f4a[_0x1886('0xc')]){switch(_0x534210){case _0x1886('0xd'):case _0x1886('0xe'):case _0x1886('0xf'):case'SmsQueues':case _0x1886('0x10'):case _0x1886('0x11'):case _0x1886('0x12'):return db[_0x489fed][_0x1886('0x13')](queryQueues);case _0x1886('0x14'):return db[_0x489fed][_0x1886('0x13')](queryTelephones);case'Trunks':return db[_0x489fed]['findAll'](queryTrunks);case _0x1886('0x15'):return db[_0x489fed][_0x1886('0x13')](queryCampaigns);}}else{return db[_0x1886('0x16')]['findAll']({'attributes':[_0x1886('0x17')],'where':{'sectionId':_0x2b1f4a['id']},'raw':!![]})[_0x1886('0xb')](function(_0x3767ba){if(_0x3767ba){var _0x4993fe={'where':{'id':_[_0x1886('0x18')](_0x3767ba,_0x1886('0x17'))},'raw':!![]};switch(_0x489fed){case'User':_0x4993fe[_0x1886('0x19')]['role']=_0x1886('0x8');break;case'Campaign':_0x4993fe['where'][_0x1886('0x1a')]=_0x1886('0x9');break;}return db[_0x489fed][_0x1886('0x13')](_0x4993fe);}else{return[];}});}}else{return[];}})[_0x1886('0xb')](function(_0x299859){return _0x299859;});}function joinOrLeaveQueues(_0x1c9a22,_0x433507,_0x59ef24,_0x2a4f0a){_0x1c9a22[_0x433507](util[_0x1886('0x1b')]('%s:queue:%s',_0x59ef24,_0x2a4f0a[_0x1886('0x3')]));if(_0x2a4f0a[_0x1886('0x4')]){for(var _0x2f39c4=0x0;_0x2f39c4<_0x2a4f0a['Agents'][_0x1886('0x1c')];_0x2f39c4+=0x1){_0x1c9a22[_0x433507](util[_0x1886('0x1b')](_0x1886('0x1d'),_0x2a4f0a[_0x1886('0x4')][_0x2f39c4][_0x1886('0x3')]));}}}function joinOrLeave(_0x5e65eb,_0x500e13,_0x3f7bb1){var _0x345bd7;if(_0x5e65eb[_0x1886('0x1e')][_0x1886('0x1f')]['id']){db[_0x1886('0x5')]['find']({'attributes':['id','name',_0x1886('0x6'),_0x1886('0x20')],'where':{'id':_0x5e65eb[_0x1886('0x1e')]['query']['id']},'include':[{'model':db[_0x1886('0x21')],'as':_0x1886('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1886('0x23')],'as':_0x1886('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1886('0x25')],'as':_0x1886('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1886('0x27')],'as':_0x1886('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1886('0x29')],'as':_0x1886('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x1886('0x2b')],'as':_0x1886('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2e7a79){if(_0x2e7a79){_0x345bd7=_0x2e7a79;_0x5e65eb[_0x500e13](util[_0x1886('0x1b')](_0x1886('0x1d'),_0x2e7a79['name']));var _0xa0700a=[];switch(_0x2e7a79[_0x1886('0x6')]){case _0x1886('0x2d'):_0x5e65eb[_0x500e13]('voice:inbound');_0x5e65eb[_0x500e13]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x1886('0x2e'))){delete queryQueues[_0x1886('0x2e')];}_0xa0700a[_0x1886('0x2f')](db[_0x1886('0x30')][_0x1886('0x13')](queryQueues));_0xa0700a[_0x1886('0x2f')](db['ChatQueue'][_0x1886('0x13')](queryQueues));_0xa0700a[_0x1886('0x2f')](db['FaxQueue'][_0x1886('0x13')](queryQueues));_0xa0700a['push'](db['SmsQueue'][_0x1886('0x13')](queryQueues));_0xa0700a[_0x1886('0x2f')](db[_0x1886('0x31')][_0x1886('0x13')](queryQueues));_0xa0700a[_0x1886('0x2f')](db[_0x1886('0x32')][_0x1886('0x13')](queryQueues));_0xa0700a[_0x1886('0x2f')](db[_0x1886('0x33')][_0x1886('0x13')](queryQueues));_0xa0700a['push'](db['User'][_0x1886('0x13')](queryTelephones));_0xa0700a['push'](db[_0x1886('0x34')][_0x1886('0x13')](queryTrunks));_0xa0700a[_0x1886('0x2f')](db[_0x1886('0x35')][_0x1886('0x13')](queryCampaigns));_0xa0700a[_0x1886('0x2f')](db[_0x1886('0x5')]['findAll'](queryAgents));break;case _0x1886('0x36'):_0x5e65eb[_0x500e13](_0x1886('0x37'));_0x5e65eb[_0x500e13](_0x1886('0x38'));_0xa0700a[_0x1886('0x2f')](getAssociatedResources(_0x1886('0xd'),_0x2e7a79[_0x1886('0x20')],_0x1886('0x30')));_0xa0700a[_0x1886('0x2f')](getAssociatedResources('ChatQueues',_0x2e7a79[_0x1886('0x20')],_0x1886('0x39')));_0xa0700a[_0x1886('0x2f')](getAssociatedResources(_0x1886('0xf'),_0x2e7a79[_0x1886('0x20')],'FaxQueue'));_0xa0700a[_0x1886('0x2f')](getAssociatedResources('SmsQueues',_0x2e7a79['userProfileId'],'SmsQueue'));_0xa0700a[_0x1886('0x2f')](getAssociatedResources(_0x1886('0x10'),_0x2e7a79['userProfileId'],_0x1886('0x31')));_0xa0700a['push'](getAssociatedResources('OpenchannelQueues',_0x2e7a79[_0x1886('0x20')],_0x1886('0x32')));_0xa0700a[_0x1886('0x2f')](getAssociatedResources(_0x1886('0x12'),_0x2e7a79[_0x1886('0x20')],_0x1886('0x33')));_0xa0700a[_0x1886('0x2f')](getAssociatedResources(_0x1886('0x14'),_0x2e7a79[_0x1886('0x20')],_0x1886('0x5')));_0xa0700a[_0x1886('0x2f')](getAssociatedResources(_0x1886('0x3a'),_0x2e7a79[_0x1886('0x20')],_0x1886('0x34')));_0xa0700a[_0x1886('0x2f')](getAssociatedResources(_0x1886('0x15'),_0x2e7a79[_0x1886('0x20')],_0x1886('0x35')));_0xa0700a[_0x1886('0x2f')](db[_0x1886('0x5')][_0x1886('0x13')](queryAgents));break;case _0x1886('0x7'):_0x5e65eb[_0x500e13](_0x1886('0x37'));_0x5e65eb[_0x500e13](_0x1886('0x38'));_0xa0700a[_0x1886('0x2f')](_0x2e7a79['getVoiceQueues']({'attributes':['id',_0x1886('0x3')]}));_0xa0700a['push'](_0x2e7a79[_0x1886('0x3b')]({'attributes':['id','name']}));_0xa0700a[_0x1886('0x2f')](_0x2e7a79['getFaxQueues']({'attributes':['id',_0x1886('0x3')]}));_0xa0700a['push'](_0x2e7a79[_0x1886('0x3c')]({'attributes':['id','name']}));_0xa0700a[_0x1886('0x2f')](_0x2e7a79['getMailQueues']({'attributes':['id',_0x1886('0x3')]}));_0xa0700a['push'](_0x2e7a79[_0x1886('0x3d')]({'attributes':['id','name']}));_0xa0700a[_0x1886('0x2f')](_0x2e7a79['getWhatsappQueues']({'attributes':['id',_0x1886('0x3')]}));break;}return BPromise[_0x1886('0x3e')](_0xa0700a);}})['then'](function(_0x375ae9){if(_0x375ae9&&_0x375ae9[_0x1886('0x1c')]){for(var _0x2278da=0x0;_0x2278da<_0x375ae9['length'];_0x2278da+=0x1){for(var _0x26dbf0=0x0;_0x26dbf0<_0x375ae9[_0x2278da][_0x1886('0x1c')];_0x26dbf0+=0x1){switch(_0x2278da){case 0x0:joinOrLeaveQueues(_0x5e65eb,_0x500e13,'voice',_0x375ae9[_0x2278da][_0x26dbf0]);break;case 0x1:joinOrLeaveQueues(_0x5e65eb,_0x500e13,_0x1886('0x3f'),_0x375ae9[_0x2278da][_0x26dbf0]);break;case 0x2:joinOrLeaveQueues(_0x5e65eb,_0x500e13,_0x1886('0x40'),_0x375ae9[_0x2278da][_0x26dbf0]);break;case 0x3:joinOrLeaveQueues(_0x5e65eb,_0x500e13,_0x1886('0x41'),_0x375ae9[_0x2278da][_0x26dbf0]);break;case 0x4:joinOrLeaveQueues(_0x5e65eb,_0x500e13,_0x1886('0x42'),_0x375ae9[_0x2278da][_0x26dbf0]);break;case 0x5:joinOrLeaveQueues(_0x5e65eb,_0x500e13,_0x1886('0x43'),_0x375ae9[_0x2278da][_0x26dbf0]);break;case 0x6:joinOrLeaveQueues(_0x5e65eb,_0x500e13,_0x1886('0x44'),_0x375ae9[_0x2278da][_0x26dbf0]);break;case 0x7:if(_0x345bd7[_0x1886('0x6')]!=='agent')_0x5e65eb[_0x500e13](util[_0x1886('0x1b')]('telephone:%s',_0x375ae9[_0x2278da][_0x26dbf0]['name']));break;case 0x8:if(_0x345bd7['role']!==_0x1886('0x7'))_0x5e65eb[_0x500e13](util[_0x1886('0x1b')]('trunk:%s',_0x375ae9[_0x2278da][_0x26dbf0][_0x1886('0x3')]));break;case 0x9:if(_0x345bd7[_0x1886('0x6')]!==_0x1886('0x7'))_0x5e65eb[_0x500e13](util[_0x1886('0x1b')](_0x1886('0x45'),_0x375ae9[_0x2278da][_0x26dbf0]['type'],_0x375ae9[_0x2278da][_0x26dbf0][_0x1886('0x3')]));break;case 0xa:_0x5e65eb[_0x500e13](util['format'](_0x1886('0x1d'),_0x375ae9[_0x2278da][_0x26dbf0][_0x1886('0x3')]));break;}}}}})[_0x1886('0xb')](function(){if(_0x500e13===_0x1886('0x46')){var _0x526980=_[_0x1886('0x18')](_0x345bd7[_0x1886('0x22')],'id');return _0x345bd7['removeChatInteractions'](_0x526980)['then'](function(){for(var _0x50a980=0x0;_0x50a980<_0x526980['length'];_0x50a980+=0x1){_0x3f7bb1['emit'](_0x1886('0x47'),{'ChatInteractionId':Number(_0x526980[_0x50a980]),'UserId':Number(_0x345bd7['id'])});}});}})['then'](function(){if(_0x500e13===_0x1886('0x46')){var _0x4d883b=_['map'](_0x345bd7[_0x1886('0x24')],'id');return _0x345bd7[_0x1886('0x48')](_0x4d883b)['then'](function(){for(var _0x3f32c1=0x0;_0x3f32c1<_0x4d883b[_0x1886('0x1c')];_0x3f32c1+=0x1){_0x3f7bb1[_0x1886('0x49')](_0x1886('0x4a'),{'MailInteractionId':Number(_0x4d883b[_0x3f32c1]),'UserId':Number(_0x345bd7['id'])});}});}})[_0x1886('0xb')](function(){if(_0x500e13===_0x1886('0x46')){var _0x1735bb=_[_0x1886('0x18')](_0x345bd7['FaxInteractions'],'id');return _0x345bd7[_0x1886('0x4b')](_0x1735bb)['then'](function(){for(var _0x4ec571=0x0;_0x4ec571<_0x1735bb['length'];_0x4ec571+=0x1){_0x3f7bb1[_0x1886('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1735bb[_0x4ec571]),'UserId':Number(_0x345bd7['id'])});}});}})[_0x1886('0xb')](function(){if(_0x500e13==='leave'){var _0x4c0575=_[_0x1886('0x18')](_0x345bd7['SmsInteractions'],'id');return _0x345bd7[_0x1886('0x4c')](_0x4c0575)['then'](function(){for(var _0x3be557=0x0;_0x3be557<_0x4c0575['length'];_0x3be557+=0x1){_0x3f7bb1[_0x1886('0x49')](_0x1886('0x4d'),{'SmsInteractionId':Number(_0x4c0575[_0x3be557]),'UserId':Number(_0x345bd7['id'])});}});}})[_0x1886('0xb')](function(){if(_0x500e13===_0x1886('0x46')){var _0x2eaa51=_['map'](_0x345bd7[_0x1886('0x2a')],'id');return _0x345bd7['removeOpenchannelInteractions'](_0x2eaa51)[_0x1886('0xb')](function(){for(var _0x56766c=0x0;_0x56766c<_0x2eaa51['length'];_0x56766c+=0x1){_0x3f7bb1['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2eaa51[_0x56766c]),'UserId':Number(_0x345bd7['id'])});}});}})[_0x1886('0xb')](function(){if(_0x500e13===_0x1886('0x46')){var _0x5e2dde=_[_0x1886('0x18')](_0x345bd7['WhatsappInteractions'],'id');return _0x345bd7['removeWhatsappInteractions'](_0x5e2dde)[_0x1886('0xb')](function(){for(var _0x230dc0=0x0;_0x230dc0<_0x5e2dde[_0x1886('0x1c')];_0x230dc0+=0x1){_0x3f7bb1['emit'](_0x1886('0x4e'),{'WhatsappInteractionId':Number(_0x5e2dde[_0x230dc0]),'UserId':Number(_0x345bd7['id'])});}});}})[_0x1886('0x4f')](function(_0x52e351){_0x5e65eb['log'](_0x52e351);});}}function onDisconnect(_0x2c758e,_0x4aa7ac){joinOrLeave(_0x2c758e,_0x1886('0x46'),_0x4aa7ac);}function onConnect(_0x477def){joinOrLeave(_0x477def,_0x1886('0x50'));}exports[_0x1886('0x51')]=function(_0x20ad7f){_0x20ad7f['on']('connection',function(_0x1bbfe9){_0x1bbfe9['setMaxListeners'](0x0);_0x1bbfe9[_0x1886('0x52')]=_0x1bbfe9[_0x1886('0x53')][_0x1886('0x54')]['remoteAddress']+':'+_0x1bbfe9[_0x1886('0x53')][_0x1886('0x54')][_0x1886('0x55')];_0x1bbfe9[_0x1886('0x56')]=new Date();_0x1bbfe9['log']=function(_0x1fedb3){console['log'](_0x1886('0x57')+_0x1bbfe9[_0x1886('0x58')]['name']+'['+_0x1bbfe9['address']+']',_0x1fedb3);};_0x1bbfe9['on'](_0x1886('0x59'),function(){onDisconnect(_0x1bbfe9,_0x20ad7f);_0x1bbfe9[_0x1886('0x5a')](_0x1886('0x5b'));});onConnect(_0x1bbfe9);_0x1bbfe9[_0x1886('0x5a')](_0x1886('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 912cc76..84237aa 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 _0x9808=['model','hook','condition','util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','afterCreate','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','catch','get','motionChannel','event','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','interface','format','changed','closed','substatus','ContactId','query','AfterUpdate','find','fullname','email','internal','default','length'];(function(_0x4fa511,_0x951a42){var _0x1229a0=function(_0x5b1fe4){while(--_0x5b1fe4){_0x4fa511['push'](_0x4fa511['shift']());}};_0x1229a0(++_0x951a42);}(_0x9808,0x1a7));var _0x8980=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0x9808[_0x2abaae];return _0x5b5745;};'use strict';var util=require(_0x8980('0x0'));var db=require(_0x8980('0x1'))['db'];var jayson=require(_0x8980('0x2'));var logger=require(_0x8980('0x3'))(_0x8980('0x4'));var client=jayson['client'][_0x8980('0x5')]({'port':0x232a});var triggers=[{'channel':_0x8980('0x6'),'model':'ChatInteraction','event':_0x8980('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x8980('0x8'),'event':_0x8980('0x9'),'condition':_0x8980('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x8980('0xb'),'event':'afterCreate','condition':_0x8980('0xc'),'callback':afterCreateMessage},{'channel':_0x8980('0x6'),'model':'ChatOfflineMessage','event':_0x8980('0x7'),'condition':_0x8980('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x8980('0xd'),'model':_0x8980('0xe'),'event':'afterCreate','condition':_0x8980('0xf'),'callback':afterCreate},{'channel':_0x8980('0xd'),'model':_0x8980('0xe'),'event':'afterUpdate','condition':_0x8980('0xa'),'callback':afterUpdate},{'channel':_0x8980('0xd'),'model':_0x8980('0x10'),'event':_0x8980('0x7'),'condition':_0x8980('0xc'),'callback':afterCreateMessage},{'channel':_0x8980('0x11'),'model':_0x8980('0x12'),'event':_0x8980('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x8980('0x9'),'condition':_0x8980('0xa'),'callback':afterUpdate},{'channel':_0x8980('0x11'),'model':_0x8980('0x13'),'event':_0x8980('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x8980('0x14'),'event':_0x8980('0x7'),'condition':_0x8980('0xf'),'callback':afterCreate},{'channel':_0x8980('0x15'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x8980('0xa'),'callback':afterUpdate},{'channel':_0x8980('0x15'),'model':_0x8980('0x16'),'event':_0x8980('0x7'),'condition':_0x8980('0xc'),'callback':afterCreateMessage},{'channel':_0x8980('0x17'),'model':'MailInteraction','event':_0x8980('0x7'),'condition':_0x8980('0xf'),'callback':afterCreate},{'channel':'Mail','model':_0x8980('0x18'),'event':_0x8980('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':'afterCreate','condition':_0x8980('0xc'),'callback':afterCreateMessage},{'channel':_0x8980('0x19'),'model':'OpenchannelInteraction','event':_0x8980('0x7'),'condition':_0x8980('0xf'),'callback':afterCreate},{'channel':_0x8980('0x19'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':_0x8980('0x1a'),'event':_0x8980('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x380f2b){return client['request'](_0x8980('0x1b'),_0x380f2b)[_0x8980('0x1c')](function(_0x4f0709){logger[_0x8980('0x1d')](_0x8980('0x1e'),_0x8980('0x1b'),_0x4f0709);if(_0x4f0709[_0x8980('0x1f')]){if(_0x4f0709[_0x8980('0x1f')]['code']===0x1f4){logger[_0x8980('0x1f')](_0x8980('0x1e'),_0x8980('0x1b'),_0x4f0709[_0x8980('0x1f')]);}}})[_0x8980('0x20')](function(_0x4ec525){logger[_0x8980('0x1f')](_0x8980('0x1e'),_0x8980('0x1b'),_0x4ec525);});}function afterCreateMessage(_0x2822b6){return function(_0x496a8f){_0x496a8f=_0x496a8f[_0x8980('0x21')]({'plain':!![]});_0x496a8f['channel']=_0x2822b6;_0x496a8f[_0x8980('0x22')]=_0x2822b6;_0x496a8f[_0x8980('0x23')]=_0x496a8f['direction'];Promise['resolve']()[_0x8980('0x1c')](function(){if(typeof _0x496a8f['ContactId']==='undefined')return null;var _0x51a616=_0x8980('0x24')+_0x496a8f['ContactId'];return db[_0x8980('0x25')]['query'](_0x51a616,{'type':db[_0x8980('0x26')][_0x8980('0x27')][_0x8980('0x28')],'raw':!![]});})[_0x8980('0x1c')](function(_0x4da3b7){if(_0x4da3b7){_0x496a8f[_0x8980('0x29')]=_0x4da3b7[0x0];}if(typeof _0x496a8f[_0x8980('0x2a')]===_0x8980('0x2b'))return;return getAgent(_0x496a8f[_0x8980('0x2a')]);})[_0x8980('0x1c')](function(_0x56dc7d){if(_0x56dc7d){_0x496a8f['interface']=util['format'](_0x8980('0x2c'),_0x56dc7d[_0x8980('0x2d')]);_0x496a8f[_0x8980('0x2e')]=_0x56dc7d;_0x496a8f[_0x8980('0x2f')]=_0x2822b6;return request({'event':_0x8980('0x30'),'message':_0x496a8f});}else{return request({'event':_0x8980('0x31'),'message':_0x496a8f});}})[_0x8980('0x20')](function(_0x1fef92){logger['error'](_0x8980('0x1e'),_0x8980('0x32'),_0x1fef92);});};}function afterCreateOfflineMessage(_0x558bf1){return function(_0xa7c5d8){_0xa7c5d8=_0xa7c5d8[_0x8980('0x21')]({'plain':!![]});_0xa7c5d8[_0x8980('0x2f')]=_0x558bf1;_0xa7c5d8[_0x8980('0x22')]=_0x558bf1;_0xa7c5d8[_0x8980('0x23')]=_0x8980('0x33');return request({'event':_0xa7c5d8[_0x8980('0x23')],'message':_0xa7c5d8});};}function afterCreate(_0x93ad7c,_0xaf8da3){return function(_0x3ebb12){_0x3ebb12=_0x3ebb12[_0x8980('0x21')]({'plain':!![]});_0x3ebb12[_0x8980('0x2f')]=_0x93ad7c;_0x3ebb12[_0x8980('0x22')]=_0x93ad7c;_0x3ebb12[_0x8980('0x23')]=_0x8980('0x34');Promise['resolve']()['then'](function(){var _0x5b9f3b=_0x8980('0x24')+_0x3ebb12['ContactId'];return db['sequelize']['query'](_0x5b9f3b,{'type':db[_0x8980('0x26')]['QueryTypes'][_0x8980('0x28')],'raw':!![]});})[_0x8980('0x1c')](function(_0xf1b953){if(_0xf1b953){_0x3ebb12[_0x8980('0x29')]=_0xf1b953[0x0];}if(typeof _0x3ebb12[_0x8980('0x2a')]===_0x8980('0x2b'))return;return getAgent(_0x3ebb12[_0x8980('0x2a')]);})['then'](function(_0x66afd5){if(_0x66afd5){_0x3ebb12[_0x8980('0x35')]=util[_0x8980('0x36')](_0x8980('0x2c'),_0x66afd5[_0x8980('0x2d')]);_0x3ebb12[_0x8980('0x2e')]=_0x66afd5;}return request({'event':_0xaf8da3,'message':_0x3ebb12});})['catch'](function(_0x267990){logger[_0x8980('0x1f')](_0x8980('0x1e'),'AfterCreate',_0x267990);});};}function afterUpdate(_0x320188){return function(_0x338bbe){var _0x139c38=_0x338bbe[_0x8980('0x37')](_0x8980('0x38'))&&_0x338bbe['closed'];var _0x12c51e=_0x338bbe['changed'](_0x8980('0x39'));if(_0x139c38||_0x12c51e){var _0x5a919b=_0x139c38?'closedinteraction':_0x8980('0x39');var _0x13617d=_0x338bbe[_0x8980('0x21')]({'plain':!![]});_0x13617d['channel']=_0x320188;_0x13617d[_0x8980('0x22')]=_0x320188;_0x13617d[_0x8980('0x23')]=_0x139c38?_0x8980('0x38'):_0x8980('0x39');var _0x39d05e=_0x8980('0x24')+_0x13617d[_0x8980('0x3a')];return db['sequelize'][_0x8980('0x3b')](_0x39d05e,{'type':db[_0x8980('0x26')]['QueryTypes'][_0x8980('0x28')],'raw':!![]})[_0x8980('0x1c')](function(_0xd58da7){if(_0xd58da7){_0x13617d[_0x8980('0x29')]=_0xd58da7[0x0];}if(typeof _0x13617d[_0x8980('0x2a')]===_0x8980('0x2b'))return;return getAgent(_0x13617d[_0x8980('0x2a')]);})['then'](function(_0x45f94d){if(_0x45f94d){_0x13617d[_0x8980('0x35')]=util['format'](_0x8980('0x2c'),_0x45f94d[_0x8980('0x2d')]);_0x13617d[_0x8980('0x2e')]=_0x45f94d;}return request({'event':_0x5a919b,'message':_0x13617d});})[_0x8980('0x20')](function(_0x518167){logger[_0x8980('0x1f')](_0x8980('0x1e'),_0x8980('0x3c'),_0x518167);});}};}function getAgent(_0x138a13){return db['User'][_0x8980('0x3d')]({'where':{'id':_0x138a13},'attributes':['id',_0x8980('0x2d'),_0x8980('0x3e'),_0x8980('0x3f'),_0x8980('0x40')],'raw':!![]})[_0x8980('0x1c')](function(_0x28faa2){return _0x28faa2;});}exports[_0x8980('0x41')]=function(){for(var _0x25eb61=0x0;_0x25eb61=_0x44e6d9[_0xe2dc('0x15')]){throw Error(_0xe2dc('0x16'));}_0x1a7573(_0x47a103);})[_0xe2dc('0x17')](function(_0x49926b){_0x4c0e8e(_0x49926b);});});}; \ No newline at end of file +var _0x6684=['includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase'];(function(_0x4844f6,_0x3959f3){var _0x59256d=function(_0x1eb320){while(--_0x1eb320){_0x4844f6['push'](_0x4844f6['shift']());}};_0x59256d(++_0x3959f3);}(_0x6684,0x112));var _0x4668=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x6684[_0x487496];return _0x539dc8;};'use strict';var _=require(_0x4668('0x0'));var BPromise=require('bluebird');var db=require(_0x4668('0x1'))['db'];var util=require(_0x4668('0x2'));var channels=[_0x4668('0x3'),_0x4668('0x4'),'chat',_0x4668('0x5'),_0x4668('0x6'),_0x4668('0x7'),_0x4668('0x8')];exports[_0x4668('0x9')]=function(){return channels;};exports[_0x4668('0xa')]=function(_0x50dde5){_0x50dde5=_0x50dde5[_0x4668('0xb')]();return _[_0x4668('0xc')](channels,_0x50dde5);};exports[_0x4668('0xd')]=function(_0x3136bb,_0x551e5d,_0x2f0d80,_0x466f64){var _0x5ebdb1={'loginAttempts':_0x551e5d,'blocked':_0x2f0d80};if(!_[_0x4668('0xe')](_0x466f64)){_0x5ebdb1[_0x4668('0xf')]=_0x466f64;}return _0x3136bb[_0x4668('0x10')](_0x5ebdb1);};exports[_0x4668('0x11')]=function(_0x216899){return new BPromise(function(_0xe5110e,_0x5e4e5a){var _0x776c37=0x0;if(_0x216899['role']!==_0x4668('0x12')){_0xe5110e(_0x216899);}db['User']['count']({'where':{'role':_0x4668('0x12'),'online':!![],'id':{'$ne':_0x216899['id']}}})[_0x4668('0x13')](function(_0x440478){_0x776c37=_0x440478;return util[_0x4668('0x11')]();})['then'](function(_0x1f6303){if(_0x1f6303&&_0x1f6303[_0x4668('0x14')]&&_0x776c37>=_0x1f6303[_0x4668('0x14')]){throw Error(_0x4668('0x15'));}_0xe5110e(_0x216899);})['catch'](function(_0x448c77){_0x5e4e5a(_0x448c77);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 29c4c15..6a0cc4a 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['status','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0xf109,0xce));var _0x9f10=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf109[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x9f10('0x0'));var logger=require(_0x9f10('0x1'))(_0x9f10('0x2'));var APIError=function(_0x5d2950,_0x5b381d){this['message']=_0x5d2950||_0x9f10('0x3');this[_0x9f10('0x4')]=_0x5b381d||_0x9f10('0x5');util[_0x9f10('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4027f4){this[_0x9f10('0x7')]=_0x4027f4||_0x9f10('0x8');this[_0x9f10('0x4')]=_0x9f10('0x8');util[_0x9f10('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3fd82f){this['message']=_0x3fd82f||_0x9f10('0x9');this[_0x9f10('0x4')]=_0x9f10('0xa');util[_0x9f10('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x325f22){switch(_0x325f22){case'Bad\x20Request':return 0x190;case _0x9f10('0xb'),_0x9f10('0xc'):return 0x193;case _0x9f10('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x4e577d){return function(_0x50215f){logger[_0x9f10('0xd')](_0x50215f[_0x9f10('0xe')]);var _0x407336=getStatusCode(_0x50215f['name']);if(_0x50215f[_0x9f10('0x4')])delete _0x50215f[_0x9f10('0x4')];return _0x4e577d[_0x9f10('0xf')](_0x407336)['send'](_0x50215f);};}module[_0x9f10('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xdace=['send','exports','util','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','status'];(function(_0x243afa,_0x508889){var _0x2ddd26=function(_0x348813){while(--_0x348813){_0x243afa['push'](_0x243afa['shift']());}};_0x2ddd26(++_0x508889);}(_0xdace,0xc5));var _0xedac=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0xdace[_0x34a8c8];return _0x1fe6e5;};'use strict';var util=require(_0xedac('0x0'));var logger=require('../config/logger')(_0xedac('0x1'));var APIError=function(_0x13adb5,_0x46eba0){this['message']=_0x13adb5||_0xedac('0x2');this[_0xedac('0x3')]=_0x46eba0||_0xedac('0x4');util[_0xedac('0x5')](APIError,Error);};var APIBadRequestError=function(_0x5a97c0){this[_0xedac('0x6')]=_0x5a97c0||_0xedac('0x7');this[_0xedac('0x3')]='Bad\x20Request';util[_0xedac('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x21440e){this[_0xedac('0x6')]=_0x21440e||'Entity\x20not\x20found';this[_0xedac('0x3')]=_0xedac('0x8');util[_0xedac('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x4af030){switch(_0x4af030){case'Bad\x20Request':return 0x190;case _0xedac('0x9'),_0xedac('0xa'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d6a29){return function(_0x4db2ad){logger[_0xedac('0xb')](_0x4db2ad['stack']);var _0x261401=getStatusCode(_0x4db2ad['name']);if(_0x4db2ad[_0xedac('0x3')])delete _0x4db2ad[_0xedac('0x3')];return _0x4d6a29[_0xedac('0xc')](_0x261401)[_0xedac('0xd')](_0x4db2ad);};}module[_0xedac('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a859f46..5068c98 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2955=['status','render','json','send','exports','404'];(function(_0x600f81,_0x5008d6){var _0x59cd78=function(_0x286a03){while(--_0x286a03){_0x600f81['push'](_0x600f81['shift']());}};_0x59cd78(++_0x5008d6);}(_0x2955,0x106));var _0x5295=function(_0x490d35,_0x414c13){_0x490d35=_0x490d35-0x0;var _0x52f92a=_0x2955[_0x490d35];return _0x52f92a;};'use strict';module[_0x5295('0x0')][0x194]=function pageNotFound(_0x5dd8fd,_0x423b76){var _0x4e2a59=_0x5295('0x1');var _0x1ce801=0x194;var _0x342df1={'status':_0x1ce801};_0x423b76[_0x5295('0x2')](_0x342df1['status']);_0x423b76[_0x5295('0x3')](_0x4e2a59,{},function(_0x2fcf7d,_0x5a7e76){if(_0x2fcf7d){return _0x423b76[_0x5295('0x2')](_0x342df1['status'])[_0x5295('0x4')](_0x342df1);}_0x423b76[_0x5295('0x5')](_0x5a7e76);});}; \ No newline at end of file +var _0x5a69=['exports','status','json','send'];(function(_0x3d91fd,_0x3a768b){var _0x137a3a=function(_0x19f617){while(--_0x19f617){_0x3d91fd['push'](_0x3d91fd['shift']());}};_0x137a3a(++_0x3a768b);}(_0x5a69,0x1c0));var _0x95a6=function(_0x5f02a6,_0x2ecf26){_0x5f02a6=_0x5f02a6-0x0;var _0x2a0b8f=_0x5a69[_0x5f02a6];return _0x2a0b8f;};'use strict';module[_0x95a6('0x0')][0x194]=function pageNotFound(_0x262f03,_0x53bd89){var _0x2ac29b='404';var _0x48f21b=0x194;var _0x3c0717={'status':_0x48f21b};_0x53bd89[_0x95a6('0x1')](_0x3c0717['status']);_0x53bd89['render'](_0x2ac29b,{},function(_0x293b07,_0x3ac471){if(_0x293b07){return _0x53bd89[_0x95a6('0x1')](_0x3c0717[_0x95a6('0x1')])[_0x95a6('0x2')](_0x3c0717);}_0x53bd89[_0x95a6('0x3')](_0x3ac471);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d3d170a..0241781 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eec=['VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','Team','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','UserId','hasOne','userSetting','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','cascade','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','WhatsappInteractions','UserNotification','SenderId','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','CmContact','Contacts','Lists','cm_user_has_lists','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteraction','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','FaxQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','AgentReports','ContactId','MailAccountId','CloudProviderId','restrict','Smtp','Answers','Interactions','List','ListId','Template','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','Tags','mail_interaction_has_tags','ThroughTags','Interaction','ChatOfflineMessage','ChatOfflineMessageId','TagId','Dashboard','Dispositions','FaxAccountId','FaxApplication','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','Disposition','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','whatsapp_interaction_has_tags','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','TriggerId','Fields','CustomReportId','MetricId','SalesforceConfiguration','Configurations','AccountId','SubjectId','Description','DescriptionId','Field','SugarcrmConfiguration','Subjects','SugarcrmField','Descriptions','Subject','FieldId','VariableId','DeskAccount','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','ZendeskField','ServicenowConfiguration','ServicenowAccount','FreshsalesAccount','FreshsalesField','ChatQueueReport','FromId','ChatInternalMessage','ToId','SessionId','ProjectId','JscriptyAnswerReport','user_has_teams','ChatQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','HopperHistories','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToUserId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','mysql','database','username','password','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model'];(function(_0x22dd2b,_0x3b116a){var _0x2c816c=function(_0x4f2765){while(--_0x4f2765){_0x22dd2b['push'](_0x22dd2b['shift']());}};_0x2c816c(++_0x3b116a);}(_0x0eec,0x1ea));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var config=require(_0xc0ee('0x0'));var Sequelize=require(_0xc0ee('0x1'));var _=require('lodash');var jstz=require(_0xc0ee('0x2'));var timezone=jstz[_0xc0ee('0x3')]();config[_0xc0ee('0x1')]=_[_0xc0ee('0x4')](config[_0xc0ee('0x1')],{'database':_0xc0ee('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xc0ee('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xc0ee('0x7')},'logging':![],'timezone':timezone[_0xc0ee('0x8')](),'define':{'charset':_0xc0ee('0x9'),'collate':_0xc0ee('0xa')}}});config[_0xc0ee('0xb')]=_[_0xc0ee('0x4')](config['sequelizeHistory'],{'database':_0xc0ee('0x5'),'username':_0xc0ee('0xc'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xc0ee('0xd'),'dialectOptions':{'charset':_0xc0ee('0x7')},'logging':![],'timezone':timezone[_0xc0ee('0x8')](),'define':{'charset':_0xc0ee('0x9'),'collate':_0xc0ee('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc0ee('0x1')][_0xc0ee('0xe')],config[_0xc0ee('0x1')][_0xc0ee('0xf')],config[_0xc0ee('0x1')][_0xc0ee('0x10')],config[_0xc0ee('0x1')][_0xc0ee('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc0ee('0xb')][_0xc0ee('0xe')],config[_0xc0ee('0xb')][_0xc0ee('0xf')],config['sequelizeHistory'][_0xc0ee('0x10')],config['sequelizeHistory'][_0xc0ee('0x11')])};db[_0xc0ee('0x12')]=db['sequelize'][_0xc0ee('0x13')]('../api/user/user.model');db['VoiceChanSpy']=db['sequelize']['import'](_0xc0ee('0x14'));db[_0xc0ee('0x15')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x16'));db['VoiceExtension']=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0xc0ee('0x17')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x18'));db[_0xc0ee('0x19')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x1a'));db[_0xc0ee('0x1b')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x1c'));db[_0xc0ee('0x1d')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/screenRecording/screenRecording.model');db[_0xc0ee('0x1e')]=db[_0xc0ee('0x1')]['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x1f'));db[_0xc0ee('0x20')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x21'));db[_0xc0ee('0x22')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x23'));db['VoiceAgentReport']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x24'));db[_0xc0ee('0x25')]=db[_0xc0ee('0x1')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0xc0ee('0x26')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x27'));db[_0xc0ee('0x28')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x29'));db[_0xc0ee('0x2a')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x2b'));db[_0xc0ee('0x2c')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x2d'));db[_0xc0ee('0x2e')]=db['sequelize']['import'](_0xc0ee('0x2f'));db[_0xc0ee('0x30')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x31'));db[_0xc0ee('0x32')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x33'));db['UserSmsQueue']=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x34'));db[_0xc0ee('0x35')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x36'));db[_0xc0ee('0x37')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x38'));db[_0xc0ee('0x39')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x3a'));db[_0xc0ee('0x3b')]=db['sequelize']['import'](_0xc0ee('0x3c'));db['MailAccount']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x3d'));db['MailQueue']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x3e'));db[_0xc0ee('0x3f')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x40'));db[_0xc0ee('0x41')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x42'));db[_0xc0ee('0x43')]=db['sequelize'][_0xc0ee('0x13')]('../api/mailMessage/mailMessage.model');db[_0xc0ee('0x44')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x45'));db[_0xc0ee('0x46')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x47'));db['Dashboard']=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x48'));db[_0xc0ee('0x49')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x4a'));db[_0xc0ee('0x4b')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db['sequelize']['import']('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x4c'));db['FaxMessage']=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x4d'));db[_0xc0ee('0x4e')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/faxQueue/faxQueue.model');db[_0xc0ee('0x4f')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x50'));db[_0xc0ee('0x51')]=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db[_0xc0ee('0x52')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x53'));db[_0xc0ee('0x54')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x55'));db[_0xc0ee('0x56')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/smsMessage/smsMessage.model');db[_0xc0ee('0x57')]=db['sequelize']['import'](_0xc0ee('0x58'));db['OpenchannelAccount']=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x59'));db['OpenchannelApplication']=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x5a'));db[_0xc0ee('0x5b')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x5c'));db[_0xc0ee('0x5d')]=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xc0ee('0x5e')]=db['sequelize'][_0xc0ee('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0xc0ee('0x5f')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x60'));db[_0xc0ee('0x61')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x62'));db[_0xc0ee('0x63')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x64'));db[_0xc0ee('0x65')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x66'));db['ChatOfflineMessage']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x67'));db[_0xc0ee('0x68')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x69'));db[_0xc0ee('0x6a')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x6b'));db[_0xc0ee('0x6c')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize']['import'](_0xc0ee('0x6d'));db['CmContact']=db[_0xc0ee('0x1')]['import']('../api/cmContact/cmContact.model');db[_0xc0ee('0x6e')]=db['sequelize'][_0xc0ee('0x13')]('../api/cmHopper/cmHopper.model');db[_0xc0ee('0x6f')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x70'));db[_0xc0ee('0x71')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x72'));db['CmHopperHistory']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x73'));db[_0xc0ee('0x74')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x75'));db[_0xc0ee('0x76')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x77'));db[_0xc0ee('0x78')]=db['sequelize'][_0xc0ee('0x13')]('../api/action/action.model');db[_0xc0ee('0x79')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/automation/automation.model');db[_0xc0ee('0x7a')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x7b'));db['Disposition']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x7c'));db[_0xc0ee('0x7d')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x7e'));db[_0xc0ee('0x7f')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x80'));db[_0xc0ee('0x81')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x82'));db[_0xc0ee('0x83')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x84'));db['VoiceQueuesLog']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x85'));db[_0xc0ee('0x86')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x87'));db[_0xc0ee('0x88')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x89'));db[_0xc0ee('0x8a')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x8b'));db[_0xc0ee('0x8c')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x8d'));db[_0xc0ee('0x8e')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x8f'));db[_0xc0ee('0x90')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x91'));db['Template']=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x92'));db[_0xc0ee('0x93')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x94'));db[_0xc0ee('0x95')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x96'));db[_0xc0ee('0x97')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x98'));db[_0xc0ee('0x99')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x9a'));db['AnalyticCustomReport']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x9b'));db[_0xc0ee('0x9c')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x9d'));db[_0xc0ee('0x9e')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x9f'));db['AnalyticMetric']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xa0'));db[_0xc0ee('0xa1')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0xa2'));db[_0xc0ee('0xa3')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xa4'));db[_0xc0ee('0xa5')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xa6'));db['SalesforceConfiguration']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xa7'));db[_0xc0ee('0xa8')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xa9'));db[_0xc0ee('0xaa')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xab'));db['SugarcrmConfiguration']=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xac'));db['SugarcrmField']=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xad'));db['DeskAccount']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xae'));db[_0xc0ee('0xaf')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xb0'));db[_0xc0ee('0xb1')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xb2'));db[_0xc0ee('0xb3')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xb4'));db['ZohoConfiguration']=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xc0ee('0xb5')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xb6'));db[_0xc0ee('0xb7')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xb8'));db[_0xc0ee('0xb9')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xba'));db['ZendeskField']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xbb'));db[_0xc0ee('0xbc')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xbd'));db[_0xc0ee('0xbe')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xbf'));db[_0xc0ee('0xc0')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xc1'));db[_0xc0ee('0xc2')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xc3'));db[_0xc0ee('0xc4')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xc0ee('0xc5')]=db[_0xc0ee('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xc6'));db['ServicenowConfiguration']=db['sequelize']['import'](_0xc0ee('0xc7'));db[_0xc0ee('0xc8')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xc9'));db[_0xc0ee('0xca')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xcb'));db[_0xc0ee('0xcc')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xcd'));db[_0xc0ee('0xce')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xcf'));db['FreshsalesAccount']=db['sequelize']['import'](_0xc0ee('0xd0'));db[_0xc0ee('0xd1')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xd2'));db['FreshsalesField']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xd3'));db[_0xc0ee('0x97')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x98'));db['Network']=db[_0xc0ee('0x1')]['import']('../api/network/network.model');db['ChatQueueReport']=db['sequelize']['import'](_0xc0ee('0xd4'));db['ChatInternalMessage']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xd5'));db['JscriptyAnswerReport']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xd6'));db[_0xc0ee('0xd7')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xd8'));db['JscriptySessionReport']=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0xd9'));db[_0xc0ee('0xda')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xdb'));db[_0xc0ee('0xdc')]=db['sequelize'][_0xc0ee('0x13')]('../api/squareReport/squareReport.model');db[_0xc0ee('0xdd')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xde'));db[_0xc0ee('0xdf')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xe0'));db[_0xc0ee('0xe1')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xe2'));db[_0xc0ee('0xe3')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xe4'));db[_0xc0ee('0xe5')]=db['sequelize'][_0xc0ee('0x13')]('../api/squareProject/squareProject.model');db[_0xc0ee('0xe6')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xc0ee('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0xc0ee('0xe7')]=db[_0xc0ee('0x1')]['import']('../api/team/team.model');db[_0xc0ee('0xe8')]=db[_0xc0ee('0x1')]['import']('../api/license/license.model');db['Campaign']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xe9'));db[_0xc0ee('0xea')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xeb'));db[_0xc0ee('0xec')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xed'));db[_0xc0ee('0xee')]=db['sequelize'][_0xc0ee('0x13')]('../api/plugin/plugin.model');db[_0xc0ee('0xef')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xc0ee('0xf0')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0xf1'));db[_0xc0ee('0xf2')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xf3'));db['OpenchannelTransferReport']=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0xf4'));db[_0xc0ee('0xf5')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xf6'));db[_0xc0ee('0xf7')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xf8'));db[_0xc0ee('0xf9')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xfa'));db['UserProfile']=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0xfb'));db[_0xc0ee('0xfc')]=db['sequelize'][_0xc0ee('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0xc0ee('0xfd')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0xfe'));db['UserNotification']=db[_0xc0ee('0x1')]['import'](_0xc0ee('0xff'));db[_0xc0ee('0x100')]=db['sequelize'][_0xc0ee('0x13')](_0xc0ee('0x101'));db[_0xc0ee('0x102')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0xc0ee('0x103')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xc0ee('0x104')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x105'));db[_0xc0ee('0x106')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0xc0ee('0x1')][_0xc0ee('0x13')](_0xc0ee('0x107'));db['WhatsappQueue']=db['sequelize']['import'](_0xc0ee('0x108'));db[_0xc0ee('0x109')]=db[_0xc0ee('0x1')][_0xc0ee('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xc0ee('0x10a')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x10b'));db[_0xc0ee('0x10c')]=db['sequelize']['import'](_0xc0ee('0x10d'));db[_0xc0ee('0x10e')]=db[_0xc0ee('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0xc0ee('0x10f')]=db[_0xc0ee('0x1')]['import'](_0xc0ee('0x110'));db[_0xc0ee('0x12')]['hasOne'](db[_0xc0ee('0x1e')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x12')][_0xc0ee('0x112')](db[_0xc0ee('0x10f')],{'as':_0xc0ee('0x113'),'onDelete':'cascade','foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x12')]['hasMany'](db[_0xc0ee('0x1b')],{'as':_0xc0ee('0x114'),'foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x12')][_0xc0ee('0x115')](db[_0xc0ee('0x116')],{'as':_0xc0ee('0x117'),'foreignKey':_0xc0ee('0x111')});db['User'][_0xc0ee('0x115')](db[_0xc0ee('0x118')],{'as':_0xc0ee('0x119'),'onDelete':_0xc0ee('0x11a'),'hooks':!![]});db[_0xc0ee('0x12')][_0xc0ee('0x115')](db[_0xc0ee('0x71')],{'as':_0xc0ee('0x11b'),'foreignKey':'UserId'});db[_0xc0ee('0x12')][_0xc0ee('0x115')](db[_0xc0ee('0x11c')],{'as':'HopperHistory','foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x12')][_0xc0ee('0x115')](db[_0xc0ee('0x74')],{'as':'ReportAgentPreview','foreignKey':_0xc0ee('0x111')});db['User'][_0xc0ee('0x115')](db[_0xc0ee('0x5b')],{'as':_0xc0ee('0x11d'),'foreignKey':_0xc0ee('0x111')});db['User'][_0xc0ee('0x115')](db['ChatInteraction'],{'as':_0xc0ee('0x11e'),'foreignKey':'UserId'});db[_0xc0ee('0x12')]['hasMany'](db[_0xc0ee('0x54')],{'as':'SmsInteractions','foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x12')]['hasMany'](db['FaxInteraction'],{'as':_0xc0ee('0x11f'),'foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x12')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db[_0xc0ee('0x12')][_0xc0ee('0x115')](db[_0xc0ee('0x103')],{'as':_0xc0ee('0x120'),'foreignKey':'UserId'});db[_0xc0ee('0x12')][_0xc0ee('0x115')](db[_0xc0ee('0x121')],{'as':'UserNotifications','foreignKey':_0xc0ee('0x122')});db[_0xc0ee('0x12')][_0xc0ee('0x123')](db[_0xc0ee('0x124')],{'as':'UserProfile','foreignKey':_0xc0ee('0x125')});db[_0xc0ee('0x12')]['belongsToMany'](db['ChatGroup'],{'as':_0xc0ee('0x126'),'through':_0xc0ee('0x127')});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x12a'),'through':'cm_user_has_contacts'});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0xf7')],{'as':_0xc0ee('0x12b'),'through':_0xc0ee('0x12c')});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0xe7')],{'through':'user_has_teams'});db['User'][_0xc0ee('0x128')](db[_0xc0ee('0x41')],{'as':_0xc0ee('0x12d'),'through':_0xc0ee('0x12e')});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0x65')],{'as':_0xc0ee('0x11e'),'through':_0xc0ee('0x12f')});db['User'][_0xc0ee('0x128')](db[_0xc0ee('0x130')],{'as':_0xc0ee('0x11f'),'through':'user_has_fax_interactions'});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0x54')],{'as':_0xc0ee('0x131'),'through':_0xc0ee('0x132')});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0x5b')],{'as':_0xc0ee('0x11d'),'through':_0xc0ee('0x133')});db[_0xc0ee('0x12')]['belongsToMany'](db[_0xc0ee('0x103')],{'as':'WhatsappInteractions','through':_0xc0ee('0x134')});db['User'][_0xc0ee('0x128')](db[_0xc0ee('0x19')],{'as':_0xc0ee('0x135'),'through':_0xc0ee('0x2c'),'required':![]});db[_0xc0ee('0x12')]['belongsToMany'](db[_0xc0ee('0xf9')],{'as':_0xc0ee('0x136'),'through':_0xc0ee('0x10e'),'required':![]});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0x137')],{'as':_0xc0ee('0x138'),'through':'UserMailQueue','required':![]});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0x68')],{'as':'ChatQueues','through':_0xc0ee('0x2e'),'required':![],'hooks':!![]});db['User'][_0xc0ee('0x128')](db[_0xc0ee('0x4e')],{'as':_0xc0ee('0x139'),'through':_0xc0ee('0x32'),'required':![]});db['User']['belongsToMany'](db[_0xc0ee('0x57')],{'as':'SmsQueues','through':_0xc0ee('0x13a'),'required':![]});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db['OpenchannelQueue'],{'as':_0xc0ee('0x13b'),'through':_0xc0ee('0x35'),'required':![]});db['User'][_0xc0ee('0x128')](db[_0xc0ee('0x13c')],{'as':_0xc0ee('0x13d'),'through':_0xc0ee('0x37'),'required':![]});db[_0xc0ee('0x12')]['belongsToMany'](db[_0xc0ee('0xf7')],{'through':'cm_user_has_lists'});db[_0xc0ee('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':_0xc0ee('0x13e'),'through':'user_has_chat_websites'});db[_0xc0ee('0x12')]['belongsToMany'](db[_0xc0ee('0x4b')],{'as':_0xc0ee('0x13f'),'through':_0xc0ee('0x140')});db['User'][_0xc0ee('0x128')](db[_0xc0ee('0x141')],{'as':_0xc0ee('0x142'),'through':'user_has_mail_accounts'});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db[_0xc0ee('0x143')],{'as':_0xc0ee('0x144'),'through':_0xc0ee('0x145')});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db['SmsAccount'],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xc0ee('0x12')][_0xc0ee('0x128')](db['WhatsappAccount'],{'as':_0xc0ee('0x146'),'through':_0xc0ee('0x147')});db['User'][_0xc0ee('0x128')](db[_0xc0ee('0xe5')],{'as':_0xc0ee('0x148'),'through':_0xc0ee('0x149')});db[_0xc0ee('0x14a')]['hasMany'](db[_0xc0ee('0x118')],{'as':_0xc0ee('0x14b'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x14c')});db[_0xc0ee('0x15')][_0xc0ee('0x115')](db[_0xc0ee('0x118')],{'onDelete':_0xc0ee('0x11a')});db['VoiceExtension'][_0xc0ee('0x115')](db[_0xc0ee('0x118')],{'as':_0xc0ee('0x14d'),'onDelete':_0xc0ee('0x11a')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xc0ee('0x88')],{'as':'Sounds','through':_0xc0ee('0x14e')});db[_0xc0ee('0x19')]['hasMany'](db[_0xc0ee('0x116')],{'as':_0xc0ee('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xc0ee('0x6e')],{'as':_0xc0ee('0x150'),'foreignKey':_0xc0ee('0x151')});db[_0xc0ee('0x19')][_0xc0ee('0x115')](db[_0xc0ee('0x71')],{'as':_0xc0ee('0x11b'),'foreignKey':'VoiceQueueId'});db[_0xc0ee('0x19')][_0xc0ee('0x115')](db[_0xc0ee('0x11c')],{'as':'HopperHistories','foreignKey':_0xc0ee('0x151')});db[_0xc0ee('0x19')]['hasMany'](db[_0xc0ee('0x74')],{'as':_0xc0ee('0x74'),'foreignKey':_0xc0ee('0x151')});db['VoiceQueue'][_0xc0ee('0x115')](db[_0xc0ee('0x6f')],{'as':_0xc0ee('0x152'),'foreignKey':'VoiceQueueId'});db[_0xc0ee('0x19')][_0xc0ee('0x115')](db[_0xc0ee('0x153')],{'as':_0xc0ee('0x154'),'foreignKey':_0xc0ee('0x151')});db['VoiceQueue'][_0xc0ee('0x123')](db[_0xc0ee('0x28')],{'as':_0xc0ee('0x28'),'foreignKey':_0xc0ee('0x155')});db[_0xc0ee('0x19')][_0xc0ee('0x123')](db[_0xc0ee('0x28')],{'as':_0xc0ee('0x156'),'foreignKey':'TrunkBackupId'});db[_0xc0ee('0x19')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0xc0ee('0x157')});db[_0xc0ee('0x19')]['belongsTo'](db['Pause'],{'as':_0xc0ee('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc0ee('0x19')]['belongsToMany'](db[_0xc0ee('0xf7')],{'as':_0xc0ee('0x12b'),'through':_0xc0ee('0x159')});db['VoiceQueue']['belongsToMany'](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x2c')});db[_0xc0ee('0x19')][_0xc0ee('0x128')](db[_0xc0ee('0xe7')],{'as':_0xc0ee('0x15b'),'through':_0xc0ee('0x10a')});db[_0xc0ee('0x19')][_0xc0ee('0x128')](db['CmList'],{'as':_0xc0ee('0x15c'),'through':_0xc0ee('0x15d')});db[_0xc0ee('0x1b')]['belongsTo'](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x12'),'foreignKey':'UserId'});db['ScreenRecording'][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x12'),'foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x1e')][_0xc0ee('0x115')](db[_0xc0ee('0x15e')],{'as':_0xc0ee('0x15f'),'onDelete':'cascade','foreignKey':_0xc0ee('0x160'),'sourceKey':_0xc0ee('0x161')});db[_0xc0ee('0x15e')][_0xc0ee('0x123')](db[_0xc0ee('0x1e')],{'foreignKey':'mailboxuser','targetKey':_0xc0ee('0x161')});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0xc0ee('0x162'),'constraints':![]});db[_0xc0ee('0x20')][_0xc0ee('0x115')](db['VoiceAgentReport'],{'as':_0xc0ee('0x163'),'foreignKey':_0xc0ee('0x162'),'constraints':![]});db[_0xc0ee('0x20')][_0xc0ee('0x123')](db['User'],{'as':_0xc0ee('0x12'),'foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x20')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':'Contact','foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x39')][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{'as':'MailAccount','foreignKey':_0xc0ee('0x165')});db['MailServerIn'][_0xc0ee('0x123')](db[_0xc0ee('0x109')],{'as':_0xc0ee('0x109'),'foreignKey':_0xc0ee('0x166'),'onDelete':'restrict'});db[_0xc0ee('0x3b')][_0xc0ee('0x123')](db['MailAccount'],{'as':_0xc0ee('0x141'),'foreignKey':_0xc0ee('0x165')});db['MailServerOut'][_0xc0ee('0x123')](db[_0xc0ee('0x109')],{'as':_0xc0ee('0x109'),'foreignKey':'CloudProviderId','onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x141')][_0xc0ee('0x112')](db[_0xc0ee('0x39')],{'as':'Imap','onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x141')]['hasOne'](db[_0xc0ee('0x3b')],{'as':_0xc0ee('0x168'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x141')][_0xc0ee('0x115')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xc0ee('0x165'),'onDelete':_0xc0ee('0x11a')});db['MailAccount'][_0xc0ee('0x115')](db[_0xc0ee('0x7a')],{'as':_0xc0ee('0x169'),'foreignKey':_0xc0ee('0x165')});db[_0xc0ee('0x141')]['hasMany'](db[_0xc0ee('0x43')],{'as':_0xc0ee('0x15f'),'foreignKey':_0xc0ee('0x165')});db[_0xc0ee('0x141')][_0xc0ee('0x115')](db['MailInteraction'],{'as':_0xc0ee('0x16a')});db[_0xc0ee('0x141')][_0xc0ee('0x115')](db[_0xc0ee('0x44')],{'as':_0xc0ee('0x14d')});db[_0xc0ee('0x141')]['belongsTo'](db['CmList'],{'as':_0xc0ee('0x16b'),'foreignKey':_0xc0ee('0x16c')});db[_0xc0ee('0x141')]['belongsTo'](db[_0xc0ee('0x16d')],{'as':_0xc0ee('0x16d'),'foreignKey':'TemplateId'});db[_0xc0ee('0x141')][_0xc0ee('0x123')](db[_0xc0ee('0x81')],{'as':_0xc0ee('0x158'),'foreignKey':_0xc0ee('0x16e')});db[_0xc0ee('0x141')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':'Agents','through':_0xc0ee('0x16f')});db[_0xc0ee('0x137')]['belongsToMany'](db['User'],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x30')});db[_0xc0ee('0x137')][_0xc0ee('0x128')](db[_0xc0ee('0xe7')],{'through':_0xc0ee('0x170'),'as':'Teams'});db[_0xc0ee('0x41')][_0xc0ee('0x115')](db['MailMessage'],{'as':'Messages','onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x171')});db['MailInteraction'][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x165')});db['MailInteraction']['belongsTo'](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x41')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x174'),'foreignKey':'UserId'});db[_0xc0ee('0x41')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':'mail_interaction_has_tags','as':_0xc0ee('0x175')});db[_0xc0ee('0x41')][_0xc0ee('0x128')](db['Tag'],{'through':_0xc0ee('0x176'),'as':_0xc0ee('0x177')});db[_0xc0ee('0x41')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':'Users','through':_0xc0ee('0x12e'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xc0ee('0x115')](db[_0xc0ee('0xec')],{'as':'Attachments','onDelete':_0xc0ee('0x11a')});db['MailMessage'][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x12')});db[_0xc0ee('0x43')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'onDelete':_0xc0ee('0x11a'),'as':'Contact'});db[_0xc0ee('0x43')][_0xc0ee('0x123')](db[_0xc0ee('0x41')],{'as':_0xc0ee('0x178'),'foreignKey':_0xc0ee('0x171')});db[_0xc0ee('0x43')][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{'as':'Account','foreignKey':_0xc0ee('0x165')});db[_0xc0ee('0x43')][_0xc0ee('0x123')](db[_0xc0ee('0x5f')],{'as':_0xc0ee('0x5f'),'foreignKey':'ChatWebsiteId'});db[_0xc0ee('0x43')]['belongsTo'](db[_0xc0ee('0x179')],{'as':_0xc0ee('0x179'),'foreignKey':_0xc0ee('0x17a')});db['MailApplication']['belongsTo'](db[_0xc0ee('0x12')],{'onDelete':_0xc0ee('0x167')});db['MailApplication'][_0xc0ee('0x123')](db['MailQueue'],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x44')][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{'onDelete':_0xc0ee('0x167')});db['MailApplication'][_0xc0ee('0x123')](db['Interval'],{'onDelete':_0xc0ee('0x167'),'foreignKey':'IntervalId'});db['MailApplication'][_0xc0ee('0x123')](db['Tag'],{'onDelete':_0xc0ee('0x167'),'foreignKey':_0xc0ee('0x17b')});db[_0xc0ee('0x46')][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{});db[_0xc0ee('0x46')][_0xc0ee('0x123')](db['CmList'],{'as':_0xc0ee('0x16b'),'foreignKey':_0xc0ee('0x16c')});db['MailQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164')});db['MailQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0x41')],{});db[_0xc0ee('0x46')]['belongsTo'](db[_0xc0ee('0x43')],{});db[_0xc0ee('0x46')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{});db[_0xc0ee('0x46')][_0xc0ee('0x123')](db['MailQueue'],{});db[_0xc0ee('0x17c')][_0xc0ee('0x115')](db[_0xc0ee('0x49')],{'as':'Items','onDelete':_0xc0ee('0x11a')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':_0xc0ee('0x17d'),'foreignKey':_0xc0ee('0x17e'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x4b')]['hasMany'](db[_0xc0ee('0x7a')],{'as':_0xc0ee('0x169'),'foreignKey':_0xc0ee('0x17e')});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':_0xc0ee('0x16a')});db[_0xc0ee('0x4b')][_0xc0ee('0x115')](db[_0xc0ee('0x17f')],{'as':_0xc0ee('0x14d')});db['FaxAccount'][_0xc0ee('0x115')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x4b')]['hasMany'](db[_0xc0ee('0x180')],{'as':_0xc0ee('0x15f')});db[_0xc0ee('0x4b')][_0xc0ee('0x123')](db[_0xc0ee('0x28')],{'as':_0xc0ee('0x28')});db['FaxAccount']['belongsTo'](db[_0xc0ee('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xc0ee('0x4b')]['belongsTo'](db[_0xc0ee('0x81')],{'as':_0xc0ee('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc0ee('0x4b')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':'Agents','through':_0xc0ee('0x140')});db[_0xc0ee('0x17f')][_0xc0ee('0x123')](db['User'],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x17f')]['belongsTo'](db[_0xc0ee('0x4e')],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x17f')]['belongsTo'](db[_0xc0ee('0x4b')],{'onDelete':'restrict'});db[_0xc0ee('0x17f')][_0xc0ee('0x123')](db[_0xc0ee('0x8a')],{'onDelete':_0xc0ee('0x167'),'foreignKey':_0xc0ee('0x17b')});db[_0xc0ee('0x130')][_0xc0ee('0x115')](db['FaxMessage'],{'as':_0xc0ee('0x15f'),'onDelete':'cascade','foreignKey':_0xc0ee('0x181')});db[_0xc0ee('0x130')][_0xc0ee('0x123')](db[_0xc0ee('0x4b')],{'as':_0xc0ee('0x172'),'foreignKey':'FaxAccountId'});db[_0xc0ee('0x130')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':'Contact','foreignKey':_0xc0ee('0x164')});db['FaxInteraction'][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':'Owner','foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x130')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x182'),'as':_0xc0ee('0x175')});db[_0xc0ee('0x130')][_0xc0ee('0x128')](db['Tag'],{'through':_0xc0ee('0x182'),'as':_0xc0ee('0x177')});db[_0xc0ee('0x130')]['belongsToMany'](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x183'),'through':_0xc0ee('0x184'),'foreignKey':_0xc0ee('0x181')});db[_0xc0ee('0x180')][_0xc0ee('0x123')](db['User'],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x12')});db[_0xc0ee('0x180')][_0xc0ee('0x123')](db[_0xc0ee('0x130')],{'as':_0xc0ee('0x178'),'foreignKey':'FaxInteractionId'});db[_0xc0ee('0x180')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x173')});db[_0xc0ee('0x180')][_0xc0ee('0x123')](db[_0xc0ee('0xec')],{'as':_0xc0ee('0xec'),'foreignKey':_0xc0ee('0x185')});db[_0xc0ee('0x180')]['belongsTo'](db['FaxAccount'],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x17e')});db[_0xc0ee('0x4e')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x32')});db[_0xc0ee('0x4e')][_0xc0ee('0x128')](db[_0xc0ee('0xe7')],{'through':_0xc0ee('0x186'),'as':'Teams'});db[_0xc0ee('0x4f')]['belongsTo'](db[_0xc0ee('0x4b')],{});db[_0xc0ee('0x4f')][_0xc0ee('0x123')](db[_0xc0ee('0xf7')],{'as':_0xc0ee('0x16b'),'foreignKey':'ListId'});db[_0xc0ee('0x4f')]['belongsTo'](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x4f')][_0xc0ee('0x123')](db[_0xc0ee('0x130')],{});db[_0xc0ee('0x4f')]['belongsTo'](db[_0xc0ee('0x180')],{});db['FaxQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{});db[_0xc0ee('0x4f')][_0xc0ee('0x123')](db[_0xc0ee('0x4e')],{});db[_0xc0ee('0x51')][_0xc0ee('0x115')](db[_0xc0ee('0x187')],{'as':_0xc0ee('0x17d'),'foreignKey':_0xc0ee('0x188'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x51')][_0xc0ee('0x115')](db[_0xc0ee('0x7a')],{'as':'Answers','foreignKey':_0xc0ee('0x188')});db['SmsAccount'][_0xc0ee('0x115')](db['SmsMessage'],{'as':_0xc0ee('0x15f'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xc0ee('0x115')](db[_0xc0ee('0x54')],{'as':_0xc0ee('0x16a')});db['SmsAccount']['hasMany'](db[_0xc0ee('0x52')],{'as':'Applications'});db[_0xc0ee('0x51')]['belongsTo'](db[_0xc0ee('0xf7')],{'as':_0xc0ee('0x16b'),'foreignKey':_0xc0ee('0x16c')});db[_0xc0ee('0x51')]['belongsTo'](db[_0xc0ee('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xc0ee('0x16e')});db['SmsAccount'][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0xc0ee('0x52')]['belongsTo'](db[_0xc0ee('0x12')],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x52')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xc0ee('0x167')});db['SmsApplication'][_0xc0ee('0x123')](db[_0xc0ee('0x51')],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x52')]['belongsTo'](db[_0xc0ee('0x7f')],{'onDelete':_0xc0ee('0x167'),'foreignKey':'IntervalId'});db[_0xc0ee('0x52')][_0xc0ee('0x123')](db[_0xc0ee('0x8a')],{'onDelete':'restrict','foreignKey':_0xc0ee('0x17b')});db[_0xc0ee('0x54')]['hasMany'](db[_0xc0ee('0x56')],{'as':_0xc0ee('0x15f'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xc0ee('0x123')](db[_0xc0ee('0x51')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x188')});db[_0xc0ee('0x54')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':'Contact','foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x54')][_0xc0ee('0x123')](db['User'],{'as':'Owner','foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x54')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x189'),'as':'Tags'});db[_0xc0ee('0x54')]['belongsToMany'](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x189'),'as':_0xc0ee('0x177')});db[_0xc0ee('0x54')][_0xc0ee('0x128')](db['User'],{'as':_0xc0ee('0x183'),'through':_0xc0ee('0x132'),'foreignKey':_0xc0ee('0x18a')});db[_0xc0ee('0x56')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x12')});db[_0xc0ee('0x56')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x173')});db['SmsMessage'][_0xc0ee('0x123')](db['SmsInteraction'],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x178'),'foreignKey':_0xc0ee('0x18a')});db['SmsMessage'][_0xc0ee('0x123')](db[_0xc0ee('0x51')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x188')});db[_0xc0ee('0x57')][_0xc0ee('0x128')](db['User'],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x13a'),'foreignKey':_0xc0ee('0x18b')});db[_0xc0ee('0x57')]['belongsToMany'](db[_0xc0ee('0xe7')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount'][_0xc0ee('0x115')](db[_0xc0ee('0x187')],{'as':'Dispositions','foreignKey':_0xc0ee('0x18c'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x143')][_0xc0ee('0x115')](db[_0xc0ee('0x7a')],{'as':_0xc0ee('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0xc0ee('0x143')][_0xc0ee('0x115')](db[_0xc0ee('0x5b')],{'as':'Interactions','foreignKey':_0xc0ee('0x18c')});db[_0xc0ee('0x143')]['hasMany'](db['OpenchannelMessage'],{'as':_0xc0ee('0x15f'),'foreignKey':_0xc0ee('0x18c')});db[_0xc0ee('0x143')][_0xc0ee('0x115')](db[_0xc0ee('0x18d')],{'as':'Applications','foreignKey':_0xc0ee('0x18c')});db[_0xc0ee('0x143')][_0xc0ee('0x123')](db[_0xc0ee('0xf7')],{'as':_0xc0ee('0x16b'),'foreignKey':_0xc0ee('0x16c')});db[_0xc0ee('0x143')][_0xc0ee('0x123')](db['Pause'],{'as':_0xc0ee('0x158'),'foreignKey':_0xc0ee('0x16e')});db[_0xc0ee('0x143')]['belongsToMany'](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':'user_has_openchannel_accounts'});db[_0xc0ee('0x18d')]['belongsTo'](db[_0xc0ee('0x12')],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x18d')][_0xc0ee('0x123')](db[_0xc0ee('0x5e')],{'onDelete':_0xc0ee('0x167'),'foreignKey':_0xc0ee('0x18e')});db[_0xc0ee('0x18d')][_0xc0ee('0x123')](db[_0xc0ee('0x143')],{'onDelete':_0xc0ee('0x167'),'foreignKey':_0xc0ee('0x18c')});db[_0xc0ee('0x18d')][_0xc0ee('0x123')](db[_0xc0ee('0x7f')],{'onDelete':_0xc0ee('0x167'),'foreignKey':'IntervalId'});db[_0xc0ee('0x18d')][_0xc0ee('0x123')](db[_0xc0ee('0x8a')],{'onDelete':_0xc0ee('0x167'),'foreignKey':_0xc0ee('0x17b')});db[_0xc0ee('0x5b')][_0xc0ee('0x115')](db[_0xc0ee('0x5d')],{'as':_0xc0ee('0x15f'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x18f')});db['OpenchannelInteraction'][_0xc0ee('0x123')](db[_0xc0ee('0x143')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x18c')});db['OpenchannelInteraction'][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':'Contact','foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x5b')][_0xc0ee('0x123')](db['User'],{'as':'Owner','foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x5b')]['belongsToMany'](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0xc0ee('0x5b')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x190'),'as':_0xc0ee('0x177')});db[_0xc0ee('0x5b')][_0xc0ee('0x128')](db['User'],{'as':_0xc0ee('0x183'),'through':_0xc0ee('0x133'),'foreignKey':_0xc0ee('0x18f')});db['OpenchannelMessage'][_0xc0ee('0x123')](db['User'],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x12')});db['OpenchannelMessage']['belongsTo'](db[_0xc0ee('0x129')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x173')});db['OpenchannelMessage'][_0xc0ee('0x123')](db[_0xc0ee('0x5b')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x178'),'foreignKey':_0xc0ee('0x18f')});db[_0xc0ee('0x5d')][_0xc0ee('0x123')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0xc0ee('0x123')](db[_0xc0ee('0x143')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x18c')});db[_0xc0ee('0x5e')][_0xc0ee('0x128')](db['User'],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x35'),'foreignKey':_0xc0ee('0x18e')});db[_0xc0ee('0x5e')][_0xc0ee('0x128')](db[_0xc0ee('0xe7')],{'through':_0xc0ee('0x191'),'as':_0xc0ee('0x15b')});db[_0xc0ee('0x5f')][_0xc0ee('0x115')](db[_0xc0ee('0x187')],{'as':_0xc0ee('0x17d'),'foreignKey':'ChatWebsiteId','onDelete':_0xc0ee('0x11a')});db['ChatWebsite'][_0xc0ee('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xc0ee('0x192')});db[_0xc0ee('0x5f')][_0xc0ee('0x115')](db['ChatProactiveAction'],{'as':_0xc0ee('0x193')});db[_0xc0ee('0x5f')][_0xc0ee('0x115')](db['ChatInteraction'],{'as':_0xc0ee('0x16a')});db[_0xc0ee('0x5f')]['hasMany'](db['ChatApplication'],{'as':'Applications'});db[_0xc0ee('0x5f')][_0xc0ee('0x115')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite']['belongsTo'](db[_0xc0ee('0xf7')],{'as':'List','foreignKey':_0xc0ee('0x16c')});db[_0xc0ee('0x5f')][_0xc0ee('0x123')](db[_0xc0ee('0x7f')],{'as':_0xc0ee('0x7f'),'foreignKey':_0xc0ee('0x157')});db['ChatWebsite'][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{'as':'MailAccount','foreignKey':_0xc0ee('0x165')});db['ChatWebsite']['belongsTo'](db[_0xc0ee('0x81')],{'as':_0xc0ee('0x158'),'foreignKey':_0xc0ee('0x16e')});db[_0xc0ee('0x5f')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x194')});db[_0xc0ee('0x61')][_0xc0ee('0x123')](db[_0xc0ee('0x143')],{});db[_0xc0ee('0x61')][_0xc0ee('0x123')](db[_0xc0ee('0xf7')],{'as':'List','foreignKey':_0xc0ee('0x16c')});db[_0xc0ee('0x61')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':'ContactId'});db[_0xc0ee('0x61')][_0xc0ee('0x123')](db[_0xc0ee('0x5b')],{});db[_0xc0ee('0x61')][_0xc0ee('0x123')](db['OpenchannelMessage'],{});db[_0xc0ee('0x61')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{});db['OpenchannelQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0x5e')],{});db[_0xc0ee('0x63')]['belongsTo'](db[_0xc0ee('0x12')],{'as':'Agent','foreignKey':_0xc0ee('0x111'),'onDelete':'restrict'});db[_0xc0ee('0x63')][_0xc0ee('0x123')](db[_0xc0ee('0x68')],{'as':_0xc0ee('0x195'),'foreignKey':_0xc0ee('0x196'),'onDelete':'restrict'});db[_0xc0ee('0x63')]['belongsTo'](db[_0xc0ee('0x5f')],{'as':_0xc0ee('0x197'),'foreignKey':_0xc0ee('0x192'),'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x63')][_0xc0ee('0x123')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc0ee('0x17b')});db['ChatInteraction'][_0xc0ee('0x115')](db[_0xc0ee('0x198')],{'as':_0xc0ee('0x15f'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x199')});db[_0xc0ee('0x65')][_0xc0ee('0x123')](db[_0xc0ee('0x5f')],{'as':_0xc0ee('0x172'),'foreignKey':'ChatWebsiteId'});db[_0xc0ee('0x65')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':'Contact','foreignKey':'ContactId'});db[_0xc0ee('0x65')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x174'),'foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x65')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x19a'),'as':_0xc0ee('0x175')});db[_0xc0ee('0x65')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x19a'),'as':'ThroughTags'});db['ChatInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0xc0ee('0x12f'),'foreignKey':_0xc0ee('0x199')});db[_0xc0ee('0x198')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x12')});db[_0xc0ee('0x198')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x173'),'foreignKey':'ContactId'});db[_0xc0ee('0x198')][_0xc0ee('0x123')](db['ChatInteraction'],{'onDelete':_0xc0ee('0x11a'),'as':'Interaction','foreignKey':_0xc0ee('0x199')});db[_0xc0ee('0x198')][_0xc0ee('0x123')](db[_0xc0ee('0xec')],{'as':_0xc0ee('0xec'),'foreignKey':'AttachmentId'});db[_0xc0ee('0x198')][_0xc0ee('0x123')](db[_0xc0ee('0x5f')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x192')});db[_0xc0ee('0x179')]['hasMany'](db[_0xc0ee('0xec')],{'as':_0xc0ee('0x19b'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x179')][_0xc0ee('0x123')](db[_0xc0ee('0x5f')],{'as':_0xc0ee('0x172'),'foreignKey':'ChatWebsiteId'});db[_0xc0ee('0x68')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x2e'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0xc0ee('0x19c'),'as':_0xc0ee('0x15b')});db[_0xc0ee('0x6a')][_0xc0ee('0x115')](db['ChatInternalMessage'],{'as':_0xc0ee('0x15f'),'foreignKey':_0xc0ee('0x19d'),'onDelete':_0xc0ee('0x11a')});db['ChatGroup'][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x14f'),'through':_0xc0ee('0x127')});db[_0xc0ee('0x6c')][_0xc0ee('0x123')](db[_0xc0ee('0x5f')],{'as':'Website','foreignKey':_0xc0ee('0x192')});db[_0xc0ee('0x19e')][_0xc0ee('0x115')](db[_0xc0ee('0x129')],{'as':'Contacts','foreignKey':_0xc0ee('0x19f')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x8e')],{'as':_0xc0ee('0x1a0'),'foreignKey':_0xc0ee('0x1a1')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x71')],{'as':_0xc0ee('0x11b'),'foreignKey':'ContactId'});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x11c')],{'as':'HopperHistories','foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x74')],{'as':_0xc0ee('0x74'),'foreignKey':'ContactId'});db[_0xc0ee('0x129')]['hasMany'](db[_0xc0ee('0x153')],{'as':'JscriptySessions','foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x5b')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x65')],{'as':'ChatInteractions','foreignKey':_0xc0ee('0x164'),'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x54')],{'as':_0xc0ee('0x131'),'foreignKey':_0xc0ee('0x164'),'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db[_0xc0ee('0x130')],{'as':_0xc0ee('0x11f'),'foreignKey':_0xc0ee('0x164'),'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x129')][_0xc0ee('0x115')](db['MailInteraction'],{'as':_0xc0ee('0x12d'),'foreignKey':_0xc0ee('0x164'),'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x129')]['belongsTo'](db[_0xc0ee('0x19e')],{'as':_0xc0ee('0x1a2'),'foreignKey':'CompanyId'});db['CmContact'][_0xc0ee('0x123')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0xc0ee('0x11a')});db['CmContact']['belongsToMany'](db['User'],{'as':_0xc0ee('0x183'),'through':_0xc0ee('0x1a3')});db[_0xc0ee('0x129')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'as':_0xc0ee('0x175'),'through':_0xc0ee('0x1a4')});db['CmContact'][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0xc0ee('0x6e')][_0xc0ee('0x115')](db[_0xc0ee('0x90')],{'as':_0xc0ee('0x1a5'),'foreignKey':_0xc0ee('0x1a6')});db[_0xc0ee('0x6e')]['belongsTo'](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164'),'onDelete':'cascade'});db['CmHopper'][_0xc0ee('0x123')](db['CmList'],{'as':'List','foreignKey':_0xc0ee('0x16c'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x6e')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x1a7'),'foreignKey':_0xc0ee('0x111')});db['CmHopper'][_0xc0ee('0x123')](db[_0xc0ee('0x19')],{'as':_0xc0ee('0x195'),'foreignKey':_0xc0ee('0x151'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x6e')][_0xc0ee('0x123')](db[_0xc0ee('0x1a8')],{'as':_0xc0ee('0x1a8'),'foreignKey':_0xc0ee('0x1a9'),'onDelete':_0xc0ee('0x11a')});db['CmHopper'][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x174'),'foreignKey':_0xc0ee('0x1aa')});db['CmHopperBlack'][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x6f')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xc0ee('0x16c'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x6f')][_0xc0ee('0x123')](db[_0xc0ee('0x19')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x6f')][_0xc0ee('0x123')](db[_0xc0ee('0x1a8')],{'as':'Campaign','foreignKey':_0xc0ee('0x1a9'),'onDelete':'cascade'});db[_0xc0ee('0x79')][_0xc0ee('0x115')](db[_0xc0ee('0x7d')],{'as':{'plural':_0xc0ee('0x1ab'),'singular':_0xc0ee('0x1ac')},'foreignKey':_0xc0ee('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0xc0ee('0x79')]['hasMany'](db[_0xc0ee('0x7d')],{'as':{'plural':_0xc0ee('0x1ae'),'singular':_0xc0ee('0x1af')},'foreignKey':_0xc0ee('0x1b0'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xc0ee('0x115')](db[_0xc0ee('0x78')],{'as':_0xc0ee('0x1b1'),'foreignKey':'AutomationId','onDelete':_0xc0ee('0x11a'),'hooks':!![]});db[_0xc0ee('0x187')][_0xc0ee('0x115')](db[_0xc0ee('0x187')],{'as':_0xc0ee('0x17d'),'foreignKey':'ParentId','onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x7f')]['hasMany'](db[_0xc0ee('0x7f')],{'as':_0xc0ee('0x1b2'),'foreignKey':_0xc0ee('0x157'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xc0ee('0x7f')][_0xc0ee('0x115')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x7f')][_0xc0ee('0x115')](db[_0xc0ee('0x44')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xc0ee('0x7f')][_0xc0ee('0x115')](db[_0xc0ee('0x63')],{'as':_0xc0ee('0x1b3'),'foreignKey':_0xc0ee('0x157')});db[_0xc0ee('0x7f')][_0xc0ee('0x115')](db[_0xc0ee('0x17f')],{'as':_0xc0ee('0x1b4'),'foreignKey':_0xc0ee('0x157')});db['Interval'][_0xc0ee('0x115')](db[_0xc0ee('0x52')],{'as':_0xc0ee('0x1b5'),'foreignKey':_0xc0ee('0x157')});db['Schedule'][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{});db[_0xc0ee('0x86')]['belongsTo'](db[_0xc0ee('0x9c')],{'foreignKey':_0xc0ee('0x1b6')});db[_0xc0ee('0x86')][_0xc0ee('0x123')](db[_0xc0ee('0x1b7')],{'foreignKey':'CustomReportId'});db[_0xc0ee('0x88')][_0xc0ee('0x128')](db[_0xc0ee('0x17')],{'as':'Mohs','through':_0xc0ee('0x14e'),'onDelete':'restrict'});db['Tag'][_0xc0ee('0x128')](db['CmContact'],{'through':_0xc0ee('0x1a4')});db[_0xc0ee('0x8a')][_0xc0ee('0x128')](db['ChatInteraction'],{'through':_0xc0ee('0x19a')});db['Tag'][_0xc0ee('0x128')](db[_0xc0ee('0x41')],{'through':'mail_interaction_has_tags'});db[_0xc0ee('0x8a')][_0xc0ee('0x128')](db[_0xc0ee('0x54')],{'through':_0xc0ee('0x189')});db[_0xc0ee('0x8a')]['belongsToMany'](db[_0xc0ee('0x130')],{'through':_0xc0ee('0x182')});db[_0xc0ee('0x8a')][_0xc0ee('0x128')](db[_0xc0ee('0x5b')],{'through':_0xc0ee('0x190')});db[_0xc0ee('0x8a')][_0xc0ee('0x128')](db[_0xc0ee('0x103')],{'through':_0xc0ee('0x1b8')});db[_0xc0ee('0x8e')][_0xc0ee('0x123')](db[_0xc0ee('0x8c')],{'as':_0xc0ee('0x1b9'),'foreignKey':'ItemTypeId'});db[_0xc0ee('0x90')][_0xc0ee('0x123')](db[_0xc0ee('0x6e')],{'as':_0xc0ee('0x1ba'),'foreignKey':_0xc0ee('0x1a6')});db[_0xc0ee('0x8e')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':'CmContactId'});db[_0xc0ee('0x93')][_0xc0ee('0x115')](db[_0xc0ee('0x7d')],{'as':{'plural':_0xc0ee('0x1bb'),'singular':_0xc0ee('0x1bc')},'foreignKey':_0xc0ee('0x1bd'),'onDelete':_0xc0ee('0x11a'),'hooks':!![]});db[_0xc0ee('0x93')][_0xc0ee('0x115')](db[_0xc0ee('0x7d')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0xc0ee('0x11a'),'hooks':!![]});db[_0xc0ee('0x93')][_0xc0ee('0x115')](db[_0xc0ee('0x78')],{'as':_0xc0ee('0x1b1'),'foreignKey':_0xc0ee('0x1be'),'onDelete':_0xc0ee('0x11a'),'hooks':!![]});db[_0xc0ee('0x1b7')][_0xc0ee('0x115')](db[_0xc0ee('0xa1')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c0'),'hooks':!![]});db[_0xc0ee('0x9c')][_0xc0ee('0x115')](db[_0xc0ee('0xa1')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xc0ee('0x115')](db[_0xc0ee('0xa1')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c1')});db[_0xc0ee('0xa1')][_0xc0ee('0x123')](db['AnalyticMetric'],{'foreignKey':_0xc0ee('0x1c1')});db[_0xc0ee('0xa5')]['hasMany'](db[_0xc0ee('0x1c2')],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0x1c2')][_0xc0ee('0x115')](db[_0xc0ee('0xa8')],{'as':'Subjects','onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0x1c2')][_0xc0ee('0x115')](db[_0xc0ee('0xa8')],{'as':'Descriptions','onDelete':_0xc0ee('0x11a'),'foreignKey':'DescriptionId'});db[_0xc0ee('0x1c2')][_0xc0ee('0x115')](db[_0xc0ee('0xa8')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'FieldId'});db[_0xc0ee('0x1c2')]['belongsTo'](db[_0xc0ee('0xa5')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0xa8')][_0xc0ee('0x115')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xc0ee('0x1c5')});db['SalesforceField'][_0xc0ee('0x115')](db['SalesforceField'],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db['SalesforceField']['hasMany'](db[_0xc0ee('0xa8')],{'as':_0xc0ee('0x1c8'),'foreignKey':'FieldId'});db['SalesforceField'][_0xc0ee('0x123')](db[_0xc0ee('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0xc0ee('0xaa')][_0xc0ee('0x115')](db[_0xc0ee('0x1c9')],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0x1c9')][_0xc0ee('0x115')](db['SugarcrmField'],{'as':_0xc0ee('0x1ca'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'SubjectId'});db[_0xc0ee('0x1c9')][_0xc0ee('0x115')](db[_0xc0ee('0x1cb')],{'as':_0xc0ee('0x1cc'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'DescriptionId'});db[_0xc0ee('0x1c9')]['hasMany'](db[_0xc0ee('0x1cb')],{'as':'Fields','onDelete':_0xc0ee('0x11a'),'foreignKey':'FieldId'});db[_0xc0ee('0x1c9')]['belongsTo'](db[_0xc0ee('0xaa')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x1c4')});db['SugarcrmField'][_0xc0ee('0x115')](db[_0xc0ee('0x1cb')],{'as':_0xc0ee('0x1cd'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0x1cb')][_0xc0ee('0x115')](db[_0xc0ee('0x1cb')],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0x1cb')][_0xc0ee('0x115')](db[_0xc0ee('0x1cb')],{'as':_0xc0ee('0x1c8'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0x1cb')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xc0ee('0x1cf')});db[_0xc0ee('0x1d0')]['hasMany'](db[_0xc0ee('0xaf')],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0xaf')][_0xc0ee('0x115')](db[_0xc0ee('0xb1')],{'as':_0xc0ee('0x1ca'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0xaf')][_0xc0ee('0x115')](db[_0xc0ee('0xb1')],{'as':'Descriptions','onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xaf')]['hasMany'](db[_0xc0ee('0xb1')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0xaf')][_0xc0ee('0x123')](db[_0xc0ee('0x1d0')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0xaf')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x1d1')});db[_0xc0ee('0xb1')][_0xc0ee('0x115')](db[_0xc0ee('0xb1')],{'as':_0xc0ee('0x1cd'),'foreignKey':_0xc0ee('0x1c5')});db['DeskField'][_0xc0ee('0x115')](db[_0xc0ee('0xb1')],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xb1')][_0xc0ee('0x115')](db[_0xc0ee('0xb1')],{'as':_0xc0ee('0x1c8'),'foreignKey':'FieldId'});db[_0xc0ee('0xb1')][_0xc0ee('0x123')](db['Variable'],{'as':_0xc0ee('0x95'),'foreignKey':_0xc0ee('0x1cf')});db[_0xc0ee('0xb3')][_0xc0ee('0x115')](db[_0xc0ee('0x1d2')],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0x1d2')]['hasMany'](db[_0xc0ee('0xb5')],{'as':_0xc0ee('0x1ca'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0x1d2')]['hasMany'](db['ZohoField'],{'as':_0xc0ee('0x1cc'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0x1d2')]['hasMany'](db[_0xc0ee('0xb5')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'FieldId'});db[_0xc0ee('0x1d2')][_0xc0ee('0x123')](db[_0xc0ee('0xb3')],{'as':'Account','foreignKey':'AccountId'});db['ZohoField'][_0xc0ee('0x115')](db[_0xc0ee('0xb5')],{'as':_0xc0ee('0x1cd'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0xb5')][_0xc0ee('0x115')](db[_0xc0ee('0xb5')],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xb5')][_0xc0ee('0x115')](db['ZohoField'],{'as':_0xc0ee('0x1c8'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0xb5')]['belongsTo'](db[_0xc0ee('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0xc0ee('0xb7')][_0xc0ee('0x115')](db[_0xc0ee('0xb9')],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xc0ee('0x115')](db['ZendeskField'],{'as':_0xc0ee('0x1ca'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0xb9')][_0xc0ee('0x115')](db['ZendeskField'],{'as':_0xc0ee('0x1cc'),'foreignKey':_0xc0ee('0x1c7')});db['ZendeskConfiguration'][_0xc0ee('0x115')](db['ZendeskField'],{'as':_0xc0ee('0x1bf'),'foreignKey':'FieldId'});db[_0xc0ee('0xb9')][_0xc0ee('0x123')](db['ZendeskAccount'],{'as':_0xc0ee('0x172'),'foreignKey':'AccountId'});db[_0xc0ee('0xb9')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x1d3')});db[_0xc0ee('0x1d4')][_0xc0ee('0x115')](db[_0xc0ee('0x1d4')],{'as':_0xc0ee('0x1cd'),'foreignKey':'SubjectId'});db[_0xc0ee('0x1d4')][_0xc0ee('0x115')](db['ZendeskField'],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':'Field','foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0x1d4')][_0xc0ee('0x123')](db[_0xc0ee('0x95')],{'as':_0xc0ee('0x95'),'foreignKey':_0xc0ee('0x1cf')});db[_0xc0ee('0xbc')][_0xc0ee('0x115')](db[_0xc0ee('0xbe')],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0xbe')][_0xc0ee('0x115')](db['FreshdeskField'],{'as':_0xc0ee('0x1ca'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0xbe')][_0xc0ee('0x115')](db[_0xc0ee('0xc0')],{'as':_0xc0ee('0x1cc'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xbe')][_0xc0ee('0x115')](db[_0xc0ee('0xc0')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1ce')});db['FreshdeskConfiguration'][_0xc0ee('0x123')](db[_0xc0ee('0xbc')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x1c4')});db['FreshdeskConfiguration'][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xc0ee('0xc0')][_0xc0ee('0x115')](db[_0xc0ee('0xc0')],{'as':_0xc0ee('0x1cd'),'foreignKey':_0xc0ee('0x1c5')});db['FreshdeskField']['hasMany'](db[_0xc0ee('0xc0')],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xc0')][_0xc0ee('0x115')](db[_0xc0ee('0xc0')],{'as':_0xc0ee('0x1c8'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0xc0')][_0xc0ee('0x123')](db[_0xc0ee('0x95')],{'as':_0xc0ee('0x95'),'foreignKey':'VariableId'});db['VtigerAccount'][_0xc0ee('0x115')](db[_0xc0ee('0xc4')],{'as':'Configurations','onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db['VtigerConfiguration'][_0xc0ee('0x115')](db[_0xc0ee('0xc5')],{'as':'Subjects','foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0xc4')]['hasMany'](db['VtigerField'],{'as':_0xc0ee('0x1cc'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xc4')][_0xc0ee('0x115')](db['VtigerField'],{'as':_0xc0ee('0x1bf'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0xc0ee('0x123')](db[_0xc0ee('0xc2')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0xc5')][_0xc0ee('0x115')](db[_0xc0ee('0xc5')],{'as':'Subject','foreignKey':'SubjectId'});db['VtigerField'][_0xc0ee('0x115')](db[_0xc0ee('0xc5')],{'as':'Description','foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xc5')][_0xc0ee('0x115')](db[_0xc0ee('0xc5')],{'as':_0xc0ee('0x1c8'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0xc5')]['belongsTo'](db[_0xc0ee('0x95')],{'as':_0xc0ee('0x95'),'foreignKey':_0xc0ee('0x1cf')});db['ServicenowAccount'][_0xc0ee('0x115')](db[_0xc0ee('0x1d5')],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db['ServicenowConfiguration'][_0xc0ee('0x115')](db['ServicenowField'],{'as':_0xc0ee('0x1ca'),'foreignKey':_0xc0ee('0x1c5')});db['ServicenowConfiguration'][_0xc0ee('0x115')](db[_0xc0ee('0xc8')],{'as':_0xc0ee('0x1cc'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0x1d5')][_0xc0ee('0x115')](db[_0xc0ee('0xc8')],{'as':_0xc0ee('0x1bf'),'foreignKey':'FieldId'});db[_0xc0ee('0x1d5')]['belongsTo'](db[_0xc0ee('0x1d6')],{'as':'Account','foreignKey':_0xc0ee('0x1c4')});db['ServicenowField'][_0xc0ee('0x115')](db['ServicenowField'],{'as':_0xc0ee('0x1cd'),'foreignKey':'SubjectId'});db[_0xc0ee('0xc8')][_0xc0ee('0x115')](db[_0xc0ee('0xc8')],{'as':'Description','foreignKey':_0xc0ee('0x1c7')});db['ServicenowField'][_0xc0ee('0x115')](db[_0xc0ee('0xc8')],{'as':_0xc0ee('0x1c8'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0xc8')][_0xc0ee('0x123')](db[_0xc0ee('0x95')],{'as':_0xc0ee('0x95'),'foreignKey':_0xc0ee('0x1cf')});db['Dynamics365Account'][_0xc0ee('0x115')](db[_0xc0ee('0xcc')],{'as':_0xc0ee('0x1c3'),'onDelete':'cascade','foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0xca')][_0xc0ee('0x123')](db[_0xc0ee('0x109')],{'as':'CloudProvider','foreignKey':_0xc0ee('0x166')});db['Dynamics365Configuration']['hasMany'](db[_0xc0ee('0xce')],{'as':_0xc0ee('0x1ca'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'SubjectId'});db[_0xc0ee('0xcc')][_0xc0ee('0x115')](db['Dynamics365Field'],{'as':_0xc0ee('0x1cc'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xcc')]['hasMany'](db[_0xc0ee('0xce')],{'as':_0xc0ee('0x1bf'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0xcc')][_0xc0ee('0x123')](db[_0xc0ee('0xca')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0xce')][_0xc0ee('0x115')](db[_0xc0ee('0xce')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xc0ee('0xce')][_0xc0ee('0x115')](db['Dynamics365Field'],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xce')][_0xc0ee('0x115')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xc0ee('0x1ce')});db['Dynamics365Field'][_0xc0ee('0x123')](db[_0xc0ee('0x95')],{'as':_0xc0ee('0x95'),'foreignKey':_0xc0ee('0x1cf')});db[_0xc0ee('0x1d7')][_0xc0ee('0x115')](db['FreshsalesConfiguration'],{'as':_0xc0ee('0x1c3'),'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1c4')});db['FreshsalesConfiguration']['hasMany'](db[_0xc0ee('0x1d8')],{'as':_0xc0ee('0x1ca'),'foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0xd1')]['hasMany'](db['FreshsalesField'],{'as':_0xc0ee('0x1cc'),'foreignKey':_0xc0ee('0x1c7')});db[_0xc0ee('0xd1')][_0xc0ee('0x115')](db[_0xc0ee('0x1d8')],{'as':_0xc0ee('0x1bf'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0xd1')][_0xc0ee('0x123')](db[_0xc0ee('0x1d7')],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x1c4')});db[_0xc0ee('0x1d8')][_0xc0ee('0x115')](db[_0xc0ee('0x1d8')],{'as':'Subject','foreignKey':_0xc0ee('0x1c5')});db[_0xc0ee('0x1d8')][_0xc0ee('0x115')](db[_0xc0ee('0x1d8')],{'as':_0xc0ee('0x1c6'),'foreignKey':_0xc0ee('0x1c7')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0xc0ee('0x1c8'),'foreignKey':_0xc0ee('0x1ce')});db[_0xc0ee('0x1d8')][_0xc0ee('0x123')](db[_0xc0ee('0x95')],{'as':_0xc0ee('0x95'),'foreignKey':_0xc0ee('0x1cf')});db[_0xc0ee('0x1d9')][_0xc0ee('0x123')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xc0ee('0x1d9')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0x1d9')][_0xc0ee('0x123')](db[_0xc0ee('0x65')],{});db['ChatQueueReport'][_0xc0ee('0x123')](db['ChatMessage'],{});db[_0xc0ee('0x1d9')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{});db['ChatQueueReport']['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage'][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x1da')});db[_0xc0ee('0x1db')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'onDelete':'cascade','foreignKey':_0xc0ee('0x1dc')});db[_0xc0ee('0x153')][_0xc0ee('0x115')](db['JscriptyQuestionReport'],{'foreignKey':_0xc0ee('0x1dd'),'onDelete':_0xc0ee('0x11a')});db['JscriptySessionReport'][_0xc0ee('0x115')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0xda')][_0xc0ee('0x123')](db[_0xc0ee('0x51')],{});db['SmsQueueReport'][_0xc0ee('0x123')](db['CmList'],{'as':_0xc0ee('0x16b'),'foreignKey':'ListId'});db[_0xc0ee('0xda')][_0xc0ee('0x123')](db['CmContact'],{'as':_0xc0ee('0x173'),'foreignKey':_0xc0ee('0x164')});db[_0xc0ee('0xda')]['belongsTo'](db[_0xc0ee('0x54')],{});db[_0xc0ee('0xda')][_0xc0ee('0x123')](db[_0xc0ee('0x56')],{});db[_0xc0ee('0xda')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{});db['SmsQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0x57')],{});db[_0xc0ee('0xdf')][_0xc0ee('0x115')](db[_0xc0ee('0x153')],{'foreignKey':'ProjectId'});db[_0xc0ee('0xdf')]['hasMany'](db[_0xc0ee('0xd7')],{'foreignKey':_0xc0ee('0x1de')});db[_0xc0ee('0xdf')][_0xc0ee('0x115')](db[_0xc0ee('0x1df')],{'foreignKey':_0xc0ee('0x1de')});db[_0xc0ee('0xe5')]['belongsToMany'](db['User'],{'as':_0xc0ee('0x183'),'through':'user_has_square_projects'});db[_0xc0ee('0xe7')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x1e0')});db['Team'][_0xc0ee('0x128')](db['VoiceQueue'],{'through':_0xc0ee('0x10a'),'as':'VoiceQueues'});db[_0xc0ee('0xe7')][_0xc0ee('0x128')](db[_0xc0ee('0x137')],{'through':_0xc0ee('0x170'),'as':_0xc0ee('0x138')});db[_0xc0ee('0xe7')][_0xc0ee('0x128')](db[_0xc0ee('0x68')],{'through':_0xc0ee('0x19c'),'as':_0xc0ee('0x1e1')});db[_0xc0ee('0xe7')][_0xc0ee('0x128')](db[_0xc0ee('0x4e')],{'through':'team_has_fax_queues','as':_0xc0ee('0x139')});db['Team'][_0xc0ee('0x128')](db[_0xc0ee('0x57')],{'through':_0xc0ee('0x1e2'),'as':_0xc0ee('0x1e3')});db['Team'][_0xc0ee('0x128')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xc0ee('0xe7')]['belongsToMany'](db[_0xc0ee('0x13c')],{'through':_0xc0ee('0x1e4'),'as':'WhatsappQueues'});db[_0xc0ee('0xe7')]['belongsToMany'](db[_0xc0ee('0xf9')],{'through':_0xc0ee('0x10c'),'as':_0xc0ee('0x136')});db[_0xc0ee('0x1a8')][_0xc0ee('0x115')](db['CmHopper'],{'as':_0xc0ee('0x150'),'foreignKey':_0xc0ee('0x1a9')});db[_0xc0ee('0x1a8')][_0xc0ee('0x115')](db[_0xc0ee('0x71')],{'as':_0xc0ee('0x11b'),'foreignKey':_0xc0ee('0x1a9')});db['Campaign'][_0xc0ee('0x115')](db['CmHopperHistory'],{'as':_0xc0ee('0x1e5'),'foreignKey':_0xc0ee('0x1a9')});db[_0xc0ee('0x1a8')]['hasMany'](db[_0xc0ee('0x6f')],{'as':_0xc0ee('0x152'),'foreignKey':_0xc0ee('0x1a9')});db[_0xc0ee('0x1a8')][_0xc0ee('0x123')](db[_0xc0ee('0x28')],{'as':'Trunk','foreignKey':_0xc0ee('0x155')});db[_0xc0ee('0x1a8')][_0xc0ee('0x123')](db['Trunk'],{'as':_0xc0ee('0x156'),'foreignKey':_0xc0ee('0x1e6')});db[_0xc0ee('0x1a8')]['belongsTo'](db[_0xc0ee('0x7f')],{'as':_0xc0ee('0x7f'),'foreignKey':'IntervalId'});db['Campaign'][_0xc0ee('0x123')](db[_0xc0ee('0xe5')],{'as':_0xc0ee('0xe5'),'foreignKey':_0xc0ee('0x1e7')});db[_0xc0ee('0x1a8')][_0xc0ee('0x128')](db['CmList'],{'as':_0xc0ee('0x12b'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xc0ee('0x128')](db[_0xc0ee('0xf7')],{'as':_0xc0ee('0x15c'),'through':_0xc0ee('0x1e8')});db[_0xc0ee('0xec')][_0xc0ee('0x123')](db[_0xc0ee('0x179')],{'as':_0xc0ee('0x179'),'foreignKey':_0xc0ee('0x17a')});db['MailTransferReport'][_0xc0ee('0x123')](db[_0xc0ee('0x43')],{});db[_0xc0ee('0xef')][_0xc0ee('0x123')](db[_0xc0ee('0x41')],{});db[_0xc0ee('0xef')][_0xc0ee('0x123')](db[_0xc0ee('0x141')],{'foreignKey':_0xc0ee('0x1e9'),'as':_0xc0ee('0x1ea')});db[_0xc0ee('0xef')][_0xc0ee('0x123')](db['User'],{'foreignKey':_0xc0ee('0x1eb'),'as':_0xc0ee('0x1ec')});db[_0xc0ee('0xef')]['belongsTo'](db[_0xc0ee('0x12')],{'foreignKey':'ToUserId','as':_0xc0ee('0x1ed')});db['MailTransferReport'][_0xc0ee('0x123')](db['MailQueue'],{'foreignKey':_0xc0ee('0x1ee'),'as':_0xc0ee('0x1ef')});db['MailTransferReport'][_0xc0ee('0x123')](db['MailAccount'],{'foreignKey':_0xc0ee('0x1f0'),'as':_0xc0ee('0x1f1')});db[_0xc0ee('0xf0')]['belongsTo'](db[_0xc0ee('0x198')],{});db[_0xc0ee('0xf0')][_0xc0ee('0x123')](db['ChatInteraction'],{});db[_0xc0ee('0xf0')]['belongsTo'](db[_0xc0ee('0x5f')],{'foreignKey':_0xc0ee('0x1f2'),'as':_0xc0ee('0x1ea')});db[_0xc0ee('0xf0')]['belongsTo'](db[_0xc0ee('0x12')],{'foreignKey':'FromUserId','as':_0xc0ee('0x1ec')});db[_0xc0ee('0xf0')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':'ToUserId','as':_0xc0ee('0x1ed')});db['ChatTransferReport'][_0xc0ee('0x123')](db[_0xc0ee('0x68')],{'foreignKey':_0xc0ee('0x1f3'),'as':_0xc0ee('0x1ef')});db[_0xc0ee('0xf0')][_0xc0ee('0x123')](db['ChatWebsite'],{'foreignKey':_0xc0ee('0x1f4'),'as':_0xc0ee('0x1f1')});db[_0xc0ee('0xf2')][_0xc0ee('0x123')](db[_0xc0ee('0x180')],{});db[_0xc0ee('0xf2')][_0xc0ee('0x123')](db[_0xc0ee('0x130')],{});db[_0xc0ee('0xf2')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xc0ee('0x1f5'),'as':_0xc0ee('0x1ea')});db[_0xc0ee('0xf2')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':_0xc0ee('0x1eb'),'as':_0xc0ee('0x1ec')});db[_0xc0ee('0xf2')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':_0xc0ee('0x1f6'),'as':_0xc0ee('0x1ed')});db['FaxTransferReport']['belongsTo'](db['FaxQueue'],{'foreignKey':_0xc0ee('0x1f7'),'as':_0xc0ee('0x1ef')});db[_0xc0ee('0xf2')][_0xc0ee('0x123')](db[_0xc0ee('0x4b')],{'foreignKey':_0xc0ee('0x1f8'),'as':'ToAccount'});db[_0xc0ee('0x1f9')][_0xc0ee('0x123')](db[_0xc0ee('0x5d')],{});db[_0xc0ee('0x1f9')][_0xc0ee('0x123')](db[_0xc0ee('0x5b')],{});db[_0xc0ee('0x1f9')][_0xc0ee('0x123')](db[_0xc0ee('0x143')],{'foreignKey':_0xc0ee('0x1fa'),'as':_0xc0ee('0x1ea')});db[_0xc0ee('0x1f9')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xc0ee('0x1f9')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport'][_0xc0ee('0x123')](db[_0xc0ee('0x5e')],{'foreignKey':'ToOpenchannelQueueId','as':_0xc0ee('0x1ef')});db[_0xc0ee('0x1f9')][_0xc0ee('0x123')](db[_0xc0ee('0x143')],{'foreignKey':'ToOpenchannelAccountId','as':_0xc0ee('0x1f1')});db[_0xc0ee('0xf5')][_0xc0ee('0x123')](db['SmsMessage'],{});db[_0xc0ee('0xf5')]['belongsTo'](db[_0xc0ee('0x54')],{});db[_0xc0ee('0xf5')][_0xc0ee('0x123')](db[_0xc0ee('0x51')],{'foreignKey':_0xc0ee('0x1fb'),'as':_0xc0ee('0x1ea')});db[_0xc0ee('0xf5')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':_0xc0ee('0x1eb'),'as':_0xc0ee('0x1ec')});db[_0xc0ee('0xf5')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':'ToUserId','as':_0xc0ee('0x1ed')});db[_0xc0ee('0xf5')][_0xc0ee('0x123')](db[_0xc0ee('0x57')],{'foreignKey':_0xc0ee('0x1fc'),'as':_0xc0ee('0x1ef')});db['SmsTransferReport']['belongsTo'](db[_0xc0ee('0x51')],{'foreignKey':_0xc0ee('0x1fd'),'as':_0xc0ee('0x1f1')});db[_0xc0ee('0xf7')][_0xc0ee('0x115')](db['Disposition'],{'as':_0xc0ee('0x17d'),'foreignKey':_0xc0ee('0x16c'),'onDelete':'cascade'});db['CmList'][_0xc0ee('0x115')](db[_0xc0ee('0x76')],{'as':'CustomFields','foreignKey':_0xc0ee('0x16c')});db['CmList'][_0xc0ee('0x115')](db[_0xc0ee('0x129')],{'as':_0xc0ee('0x12a'),'onDelete':_0xc0ee('0x11a'),'foreignKey':'ListId'});db[_0xc0ee('0xf7')][_0xc0ee('0x115')](db['CmHopperFinal'],{'as':_0xc0ee('0x11b'),'foreignKey':_0xc0ee('0x16c')});db['CmList'][_0xc0ee('0x115')](db[_0xc0ee('0x11c')],{'as':_0xc0ee('0x1fe'),'foreignKey':_0xc0ee('0x16c')});db[_0xc0ee('0xf7')]['hasMany'](db[_0xc0ee('0x74')],{'as':_0xc0ee('0x74'),'foreignKey':_0xc0ee('0x16c')});db[_0xc0ee('0xf7')]['belongsToMany'](db[_0xc0ee('0x19')],{'as':_0xc0ee('0x1ff'),'through':_0xc0ee('0x159')});db[_0xc0ee('0xf7')][_0xc0ee('0x128')](db['User'],{'as':'Agents','through':_0xc0ee('0x12c')});db[_0xc0ee('0xf9')][_0xc0ee('0x115')](db[_0xc0ee('0x118')],{'as':_0xc0ee('0x119'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0xf9')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':'Agents','through':_0xc0ee('0x10e')});db[_0xc0ee('0xf9')][_0xc0ee('0x128')](db[_0xc0ee('0xe7')],{'through':_0xc0ee('0x10c'),'as':_0xc0ee('0x15b')});db[_0xc0ee('0x124')]['hasMany'](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x183'),'foreignKey':_0xc0ee('0x125')});db[_0xc0ee('0x124')]['hasMany'](db[_0xc0ee('0xfc')],{'as':_0xc0ee('0x200'),'foreignKey':_0xc0ee('0x125'),'onDelete':'cascade'});db['UserProfileSection'][_0xc0ee('0x115')](db[_0xc0ee('0xfd')],{'as':_0xc0ee('0x201'),'foreignKey':_0xc0ee('0x202'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x100')][_0xc0ee('0x115')](db[_0xc0ee('0x187')],{'as':'Dispositions','foreignKey':_0xc0ee('0x203'),'onDelete':_0xc0ee('0x11a')});db[_0xc0ee('0x100')][_0xc0ee('0x115')](db[_0xc0ee('0x7a')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0xc0ee('0x104')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xc0ee('0x100')][_0xc0ee('0x115')](db['WhatsappInteraction'],{'as':_0xc0ee('0x16a')});db['WhatsappAccount'][_0xc0ee('0x115')](db['WhatsappApplication'],{'as':'Applications'});db['WhatsappAccount'][_0xc0ee('0x123')](db[_0xc0ee('0xf7')],{'as':_0xc0ee('0x16b'),'foreignKey':'ListId'});db[_0xc0ee('0x100')][_0xc0ee('0x123')](db[_0xc0ee('0x81')],{'as':_0xc0ee('0x158'),'foreignKey':_0xc0ee('0x16e')});db[_0xc0ee('0x100')]['belongsToMany'](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':_0xc0ee('0x147')});db[_0xc0ee('0x102')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x102')][_0xc0ee('0x123')](db[_0xc0ee('0x13c')],{'onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x102')][_0xc0ee('0x123')](db[_0xc0ee('0x100')],{'onDelete':_0xc0ee('0x167')});db['WhatsappApplication'][_0xc0ee('0x123')](db[_0xc0ee('0x7f')],{'onDelete':'restrict','foreignKey':_0xc0ee('0x157')});db[_0xc0ee('0x102')][_0xc0ee('0x123')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc0ee('0x17b')});db[_0xc0ee('0x103')][_0xc0ee('0x115')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xc0ee('0x11a'),'foreignKey':_0xc0ee('0x204')});db[_0xc0ee('0x103')]['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xc0ee('0x203')});db[_0xc0ee('0x103')][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':'Contact','foreignKey':_0xc0ee('0x164')});db['WhatsappInteraction'][_0xc0ee('0x123')](db['User'],{'as':_0xc0ee('0x174'),'foreignKey':_0xc0ee('0x111')});db[_0xc0ee('0x103')][_0xc0ee('0x128')](db[_0xc0ee('0x8a')],{'through':_0xc0ee('0x1b8'),'as':_0xc0ee('0x175')});db[_0xc0ee('0x103')][_0xc0ee('0x128')](db['Tag'],{'through':_0xc0ee('0x1b8'),'as':_0xc0ee('0x177')});db[_0xc0ee('0x103')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x183'),'through':_0xc0ee('0x134'),'foreignKey':'WhatsappInteractionId'});db[_0xc0ee('0x104')]['belongsTo'](db['User'],{'as':_0xc0ee('0x12')});db['WhatsappMessage'][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'onDelete':_0xc0ee('0x11a'),'as':_0xc0ee('0x173')});db[_0xc0ee('0x104')][_0xc0ee('0x123')](db['WhatsappInteraction'],{'onDelete':_0xc0ee('0x11a'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xc0ee('0x123')](db['WhatsappAccount'],{'as':_0xc0ee('0x172'),'foreignKey':_0xc0ee('0x203')});db[_0xc0ee('0x106')][_0xc0ee('0x123')](db[_0xc0ee('0x100')],{});db[_0xc0ee('0x106')][_0xc0ee('0x123')](db[_0xc0ee('0xf7')],{'as':'List','foreignKey':_0xc0ee('0x16c')});db['WhatsappQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0x129')],{'as':'Contact','foreignKey':'ContactId'});db[_0xc0ee('0x106')][_0xc0ee('0x123')](db[_0xc0ee('0x103')],{});db[_0xc0ee('0x106')]['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0xc0ee('0x123')](db[_0xc0ee('0x104')],{});db[_0xc0ee('0x106')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{});db[_0xc0ee('0x205')][_0xc0ee('0x123')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0xc0ee('0x123')](db[_0xc0ee('0x103')],{});db[_0xc0ee('0x205')][_0xc0ee('0x123')](db[_0xc0ee('0x100')],{'foreignKey':_0xc0ee('0x206'),'as':_0xc0ee('0x1ea')});db[_0xc0ee('0x205')][_0xc0ee('0x123')](db[_0xc0ee('0x100')],{'foreignKey':'ToWhatsappAccountId','as':_0xc0ee('0x1f1')});db[_0xc0ee('0x205')][_0xc0ee('0x123')](db['WhatsappQueue'],{'foreignKey':_0xc0ee('0x207'),'as':'ToQueue'});db[_0xc0ee('0x205')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':_0xc0ee('0x1eb'),'as':'FromAgent'});db[_0xc0ee('0x205')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'foreignKey':_0xc0ee('0x1f6'),'as':_0xc0ee('0x1ed')});db[_0xc0ee('0x13c')][_0xc0ee('0x128')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x15a'),'through':'UserWhatsappQueue','foreignKey':_0xc0ee('0x208')});db['WhatsappQueue']['belongsToMany'](db[_0xc0ee('0xe7')],{'through':_0xc0ee('0x1e4'),'as':_0xc0ee('0x15b')});db[_0xc0ee('0x10f')][_0xc0ee('0x123')](db[_0xc0ee('0x12')],{'as':_0xc0ee('0x209'),'foreignKey':'UserId','onDelete':_0xc0ee('0x11a'),'hooks':!![]});db[_0xc0ee('0x109')][_0xc0ee('0x112')](db[_0xc0ee('0xca')],{'as':'Dynamics365Account','onDelete':_0xc0ee('0x167')});db[_0xc0ee('0x109')][_0xc0ee('0x112')](db[_0xc0ee('0x39')],{'as':_0xc0ee('0x20a'),'onDelete':'restrict'});db[_0xc0ee('0x109')][_0xc0ee('0x112')](db['MailServerOut'],{'as':_0xc0ee('0x168'),'onDelete':_0xc0ee('0x167')});module[_0xc0ee('0x20b')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf092=['../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','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/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','UserId','userSetting','hasMany','Recordings','UserVoiceQueueRt','Extensions','HopperFinals','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteractions','WhatsappInteraction','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','FaxQueue','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','SquareProjects','ChanSpyId','VoiceExtension','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','Imap','Disposition','Dispositions','MailMessage','Messages','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Account','ChatOfflineMessage','restrict','TagId','Items','FaxAccountId','Interactions','Applications','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','Answers','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueue','OpenchannelQueueId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','CompanyId','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Condition','OneAll','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','FieldId','Description','DescriptionId','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','Subject','DeskConfiguration','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','FreshsalesConfiguration','ToId','SessionId','SmsQueueReport','ProjectId','user_has_square_projects','TeamVoiceQueue','team_has_chat_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','ChatOfflineMessageId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','sequelize','lodash','jstz','determine','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField'];(function(_0x554e9e,_0xcb21e5){var _0x1ba47c=function(_0x535af9){while(--_0x535af9){_0x554e9e['push'](_0x554e9e['shift']());}};_0x1ba47c(++_0xcb21e5);}(_0xf092,0x152));var _0x2f09=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0xf092[_0x25b24a];return _0x224e68;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x2f09('0x0'));var _=require(_0x2f09('0x1'));var jstz=require(_0x2f09('0x2'));var timezone=jstz[_0x2f09('0x3')]();config[_0x2f09('0x0')]=_['defaultsDeep'](config[_0x2f09('0x0')],{'database':_0x2f09('0x4'),'username':_0x2f09('0x5'),'password':'xC@LL1234','options':{'host':_0x2f09('0x6'),'port':0xcea,'dialect':_0x2f09('0x7'),'dialectOptions':{'charset':_0x2f09('0x8')},'logging':![],'timezone':timezone[_0x2f09('0x9')](),'define':{'charset':_0x2f09('0xa'),'collate':'utf8_general_ci'}}});config[_0x2f09('0xb')]=_[_0x2f09('0xc')](config[_0x2f09('0xb')],{'database':_0x2f09('0x4'),'username':_0x2f09('0x5'),'password':'xC@LL1234','options':{'host':_0x2f09('0x6'),'port':0xcea,'dialect':_0x2f09('0x7'),'dialectOptions':{'charset':_0x2f09('0x8')},'logging':![],'timezone':timezone[_0x2f09('0x9')](),'define':{'charset':_0x2f09('0xa'),'collate':_0x2f09('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2f09('0x0')][_0x2f09('0xe')],config[_0x2f09('0x0')][_0x2f09('0xf')],config['sequelize'][_0x2f09('0x10')],config[_0x2f09('0x0')][_0x2f09('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2f09('0xb')]['database'],config['sequelizeHistory'][_0x2f09('0xf')],config[_0x2f09('0xb')][_0x2f09('0x10')],config[_0x2f09('0xb')][_0x2f09('0x11')])};db[_0x2f09('0x12')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x14'));db[_0x2f09('0x15')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x16'));db[_0x2f09('0x17')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x18'));db['VoiceExtension']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x19'));db[_0x2f09('0x1a')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x1b'));db[_0x2f09('0x1c')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x1d'));db['VoiceRecording']=db[_0x2f09('0x0')]['import'](_0x2f09('0x1e'));db[_0x2f09('0x1f')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/screenRecording/screenRecording.model');db[_0x2f09('0x20')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x21'));db[_0x2f09('0x22')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x23'));db[_0x2f09('0x24')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x25'));db[_0x2f09('0x26')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x27'));db['VoiceAgentReport']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x28'));db[_0x2f09('0x29')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x2a'));db[_0x2f09('0x2b')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x2c'));db['Trunk']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x2d'));db['VoiceTransferReport']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x2e'));db['UserVoiceQueueRt']=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x2f09('0x2f')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x30'));db[_0x2f09('0x31')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x32'));db[_0x2f09('0x33')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x34'));db[_0x2f09('0x35')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0x2f09('0x36')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x37'));db[_0x2f09('0x38')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x39'));db['UserWhatsappQueue']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x3a'));db[_0x2f09('0x3b')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x3c'));db[_0x2f09('0x3d')]=db['sequelize']['import'](_0x2f09('0x3e'));db[_0x2f09('0x3f')]=db['sequelize'][_0x2f09('0x13')]('../api/mailAccount/mailAccount.model');db[_0x2f09('0x40')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x41'));db[_0x2f09('0x42')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x43'));db[_0x2f09('0x44')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x45'));db['MailMessage']=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x46'));db[_0x2f09('0x47')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x48'));db[_0x2f09('0x49')]=db[_0x2f09('0x0')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x2f09('0x4a')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x4b'));db[_0x2f09('0x4c')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x2f09('0x4d')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/faxAccount/faxAccount.model');db[_0x2f09('0x4e')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x4f'));db[_0x2f09('0x50')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x51'));db[_0x2f09('0x52')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x53'));db[_0x2f09('0x54')]=db['sequelize'][_0x2f09('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x2f09('0x55')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x56'));db[_0x2f09('0x57')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x58'));db[_0x2f09('0x59')]=db['sequelize'][_0x2f09('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0x2f09('0x5a')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x5b'));db['SmsQueue']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x5c'));db['OpenchannelAccount']=db[_0x2f09('0x0')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x2f09('0x5d')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x5e'));db[_0x2f09('0x5f')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x60'));db[_0x2f09('0x61')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x62'));db['OpenchannelQueue']=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x2f09('0x63')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x64'));db[_0x2f09('0x65')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x66'));db[_0x2f09('0x67')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x68'));db[_0x2f09('0x69')]=db['sequelize']['import'](_0x2f09('0x6a'));db[_0x2f09('0x6b')]=db['sequelize']['import'](_0x2f09('0x6c'));db['ChatOfflineMessage']=db[_0x2f09('0x0')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x6d'));db[_0x2f09('0x6e')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x6f'));db['CmCompany']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x70'));db[_0x2f09('0x71')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x72'));db[_0x2f09('0x73')]=db['sequelize'][_0x2f09('0x13')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x74'));db['CmHopperFinal']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x75'));db[_0x2f09('0x76')]=db['sequelize']['import'](_0x2f09('0x77'));db['ReportAgentPreview']=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x78'));db[_0x2f09('0x79')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x7a'));db[_0x2f09('0x7b')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/action/action.model');db[_0x2f09('0x7c')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x7d'));db[_0x2f09('0x7e')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x7f'));db['Disposition']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x80'));db['Condition']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x81'));db['Interval']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x82'));db[_0x2f09('0x83')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x84'));db[_0x2f09('0x85')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x86'));db[_0x2f09('0x87')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x88'));db[_0x2f09('0x89')]=db['sequelize']['import'](_0x2f09('0x8a'));db[_0x2f09('0x8b')]=db['sequelize']['import'](_0x2f09('0x8c'));db[_0x2f09('0x8d')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x8e'));db[_0x2f09('0x8f')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x90'));db[_0x2f09('0x91')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x92'));db[_0x2f09('0x93')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x94'));db[_0x2f09('0x95')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x96'));db[_0x2f09('0x97')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x98'));db[_0x2f09('0x99')]=db['sequelize']['import']('../api/variable/variable.model');db[_0x2f09('0x9a')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x9b'));db[_0x2f09('0x9c')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/integrationReport/integrationReport.model');db[_0x2f09('0x9d')]=db[_0x2f09('0x0')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x2f09('0x9e')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x9f'));db['AnalyticExtractedReport']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xa0'));db[_0x2f09('0xa1')]=db['sequelize']['import'](_0x2f09('0xa2'));db[_0x2f09('0xa3')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xa4'));db[_0x2f09('0xa5')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xa6'));db['SalesforceConfiguration']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xa7'));db['SalesforceField']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xa8'));db['SugarcrmAccount']=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x2f09('0x0')]['import'](_0x2f09('0xa9'));db['SugarcrmField']=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xaa'));db[_0x2f09('0xab')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xac'));db['DeskConfiguration']=db[_0x2f09('0x0')]['import'](_0x2f09('0xad'));db[_0x2f09('0xae')]=db[_0x2f09('0x0')]['import'](_0x2f09('0xaf'));db[_0x2f09('0xb0')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xb1'));db[_0x2f09('0xb2')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x2f09('0xb3')]=db[_0x2f09('0x0')]['import'](_0x2f09('0xb4'));db[_0x2f09('0xb5')]=db[_0x2f09('0x0')]['import'](_0x2f09('0xb6'));db['ZendeskConfiguration']=db['sequelize'][_0x2f09('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xb7'));db[_0x2f09('0xb8')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xb9'));db[_0x2f09('0xba')]=db[_0x2f09('0x0')]['import'](_0x2f09('0xbb'));db[_0x2f09('0xbc')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x2f09('0xbd')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xbe'));db[_0x2f09('0xbf')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xc0'));db[_0x2f09('0xc1')]=db['sequelize'][_0x2f09('0x13')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xc2'));db[_0x2f09('0xc3')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xc4'));db[_0x2f09('0xc5')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x2f09('0xc6')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x2f09('0xc7')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xc8'));db[_0x2f09('0xc9')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xca'));db['FreshsalesConfiguration']=db[_0x2f09('0x0')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x2f09('0xcb')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x2f09('0x9a')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0x2f09('0x13')]('../api/network/network.model');db[_0x2f09('0xcc')]=db[_0x2f09('0x0')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x2f09('0xcd')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xce'));db[_0x2f09('0xcf')]=db[_0x2f09('0x0')]['import'](_0x2f09('0xd0'));db[_0x2f09('0xd1')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xd2'));db[_0x2f09('0xd3')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xd4'));db['SmsQueueReport']=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xd5'));db[_0x2f09('0xd6')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xd7'));db[_0x2f09('0xd8')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xd9'));db[_0x2f09('0xda')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xdb'));db[_0x2f09('0xdc')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/setting/setting.model');db[_0x2f09('0xdd')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x2f09('0xde')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xdf'));db[_0x2f09('0xe0')]=db['sequelize'][_0x2f09('0x13')]('../api/squareRecording/squareRecording.model');db[_0x2f09('0xe1')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/squareMessage/squareMessage.model');db[_0x2f09('0xe2')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xe3'));db[_0x2f09('0xe4')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xe5'));db[_0x2f09('0xe6')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xe7'));db[_0x2f09('0xe8')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xe9'));db[_0x2f09('0xea')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xeb'));db[_0x2f09('0xec')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xed'));db[_0x2f09('0xee')]=db[_0x2f09('0x0')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x2f09('0xef')]=db['sequelize']['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x2f09('0xf0')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xf1'));db[_0x2f09('0xf2')]=db['sequelize']['import'](_0x2f09('0xf3'));db[_0x2f09('0xf4')]=db[_0x2f09('0x0')]['import'](_0x2f09('0xf5'));db[_0x2f09('0xf6')]=db[_0x2f09('0x0')]['import']('../api/cmList/cmList.model');db[_0x2f09('0xf7')]=db['sequelize']['import'](_0x2f09('0xf8'));db[_0x2f09('0xf9')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xfa'));db[_0x2f09('0xfb')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0xfc'));db[_0x2f09('0xfd')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xfe'));db['UserNotification']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0xff'));db[_0x2f09('0x100')]=db[_0x2f09('0x0')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x2f09('0x101')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x102'));db['WhatsappInteraction']=db[_0x2f09('0x0')]['import'](_0x2f09('0x103'));db[_0x2f09('0x104')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x105'));db[_0x2f09('0x106')]=db[_0x2f09('0x0')][_0x2f09('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x2f09('0x107')]=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x108'));db[_0x2f09('0x109')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x10a'));db['CloudProvider']=db[_0x2f09('0x0')]['import'](_0x2f09('0x10b'));db['TeamVoiceQueue']=db[_0x2f09('0x0')][_0x2f09('0x13')](_0x2f09('0x10c'));db[_0x2f09('0x10d')]=db['sequelize'][_0x2f09('0x13')](_0x2f09('0x10e'));db[_0x2f09('0x10f')]=db[_0x2f09('0x0')]['import'](_0x2f09('0x110'));db[_0x2f09('0x111')]=db['sequelize'][_0x2f09('0x13')]('../api/user-setting/user-setting.model');db['User'][_0x2f09('0x112')](db['VoiceMail'],{'as':_0x2f09('0x20'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x112')](db[_0x2f09('0x111')],{'as':_0x2f09('0x115'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db['VoiceRecording'],{'as':_0x2f09('0x117'),'foreignKey':_0x2f09('0x114')});db['User']['hasMany'](db[_0x2f09('0x118')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User'][_0x2f09('0x116')](db['VoiceExtension'],{'as':_0x2f09('0x119'),'onDelete':_0x2f09('0x113'),'hooks':!![]});db['User'][_0x2f09('0x116')](db['CmHopperFinal'],{'as':_0x2f09('0x11a'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db[_0x2f09('0x76')],{'as':'HopperHistory','foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')]['hasMany'](db[_0x2f09('0x11b')],{'as':'ReportAgentPreview','foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db[_0x2f09('0x5f')],{'as':_0x2f09('0x11c'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db[_0x2f09('0x69')],{'as':'ChatInteractions','foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db[_0x2f09('0x59')],{'as':_0x2f09('0x11d'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db['FaxInteraction'],{'as':_0x2f09('0x11e'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db[_0x2f09('0x44')],{'as':'MailInteractions','foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db[_0x2f09('0x11f')],{'as':_0x2f09('0x120'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x12')][_0x2f09('0x116')](db[_0x2f09('0x121')],{'as':_0x2f09('0x122'),'foreignKey':_0x2f09('0x123')});db['User'][_0x2f09('0x124')](db[_0x2f09('0xf9')],{'as':_0x2f09('0xf9'),'foreignKey':'userProfileId'});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x6e')],{'as':_0x2f09('0x126'),'through':_0x2f09('0x127')});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x71')],{'as':_0x2f09('0x128'),'through':'cm_user_has_contacts'});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x129'),'through':'cm_user_has_lists'});db[_0x2f09('0x12')][_0x2f09('0x125')](db['Team'],{'through':_0x2f09('0x12a')});db[_0x2f09('0x12')]['belongsToMany'](db[_0x2f09('0x44')],{'as':_0x2f09('0x12b'),'through':_0x2f09('0x12c')});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x69')],{'as':_0x2f09('0x12d'),'through':_0x2f09('0x12e')});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x50')],{'as':_0x2f09('0x11e'),'through':_0x2f09('0x12f')});db[_0x2f09('0x12')][_0x2f09('0x125')](db['SmsInteraction'],{'as':_0x2f09('0x11d'),'through':_0x2f09('0x130')});db[_0x2f09('0x12')]['belongsToMany'](db[_0x2f09('0x5f')],{'as':_0x2f09('0x11c'),'through':'user_has_openchannel_interactions'});db['User'][_0x2f09('0x125')](db[_0x2f09('0x11f')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x1c')],{'as':_0x2f09('0x131'),'through':'UserVoiceQueue','required':![]});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0xf7')],{'as':_0x2f09('0x132'),'through':'UserVoicePrefix','required':![]});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x40')],{'as':_0x2f09('0x133'),'through':'UserMailQueue','required':![]});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x134')],{'as':_0x2f09('0x135'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x136')],{'as':_0x2f09('0x137'),'through':'UserFaxQueue','required':![]});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x138')],{'as':_0x2f09('0x139'),'through':_0x2f09('0x36'),'required':![]});db['User'][_0x2f09('0x125')](db['OpenchannelQueue'],{'as':_0x2f09('0x13a'),'through':_0x2f09('0x38'),'required':![]});db[_0x2f09('0x12')]['belongsToMany'](db[_0x2f09('0x109')],{'as':_0x2f09('0x13b'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x2f09('0x125')](db[_0x2f09('0xf6')],{'through':_0x2f09('0x13c')});db[_0x2f09('0x12')][_0x2f09('0x125')](db['ChatWebsite'],{'as':_0x2f09('0x13d'),'through':_0x2f09('0x13e')});db['User']['belongsToMany'](db['FaxAccount'],{'as':_0x2f09('0x13f'),'through':_0x2f09('0x140')});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x3f')],{'as':_0x2f09('0x141'),'through':_0x2f09('0x142')});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0x143')],{'as':_0x2f09('0x144'),'through':_0x2f09('0x145')});db[_0x2f09('0x12')]['belongsToMany'](db['SmsAccount'],{'as':_0x2f09('0x146'),'through':'user_has_sms_accounts'});db['User'][_0x2f09('0x125')](db[_0x2f09('0x100')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x2f09('0x12')][_0x2f09('0x125')](db[_0x2f09('0xde')],{'as':_0x2f09('0x147'),'through':'user_has_square_projects'});db[_0x2f09('0x15')][_0x2f09('0x116')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x2f09('0x148')});db[_0x2f09('0x17')]['hasMany'](db[_0x2f09('0x149')],{'onDelete':_0x2f09('0x113')});db['VoiceExtension'][_0x2f09('0x116')](db[_0x2f09('0x149')],{'as':'Applications','onDelete':_0x2f09('0x113')});db[_0x2f09('0x1a')]['belongsToMany'](db[_0x2f09('0x8b')],{'as':_0x2f09('0x14a'),'through':_0x2f09('0x14b')});db['VoiceQueue']['hasMany'](db[_0x2f09('0x118')],{'as':_0x2f09('0x14c'),'foreignKey':_0x2f09('0x14d')});db[_0x2f09('0x1c')][_0x2f09('0x116')](db['CmHopper'],{'as':_0x2f09('0x14e'),'foreignKey':_0x2f09('0x14d')});db[_0x2f09('0x1c')][_0x2f09('0x116')](db[_0x2f09('0x14f')],{'as':_0x2f09('0x11a'),'foreignKey':_0x2f09('0x14d')});db[_0x2f09('0x1c')][_0x2f09('0x116')](db[_0x2f09('0x76')],{'as':'HopperHistories','foreignKey':_0x2f09('0x14d')});db['VoiceQueue']['hasMany'](db[_0x2f09('0x11b')],{'as':_0x2f09('0x11b'),'foreignKey':_0x2f09('0x14d')});db['VoiceQueue'][_0x2f09('0x116')](db[_0x2f09('0x150')],{'as':_0x2f09('0x151'),'foreignKey':_0x2f09('0x14d')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0x2f09('0x152'),'foreignKey':_0x2f09('0x14d')});db[_0x2f09('0x1c')][_0x2f09('0x124')](db[_0x2f09('0x153')],{'as':'Trunk','foreignKey':'TrunkId'});db['VoiceQueue'][_0x2f09('0x124')](db[_0x2f09('0x153')],{'as':_0x2f09('0x154'),'foreignKey':_0x2f09('0x155')});db[_0x2f09('0x1c')]['belongsTo'](db['Interval'],{'as':_0x2f09('0x156'),'foreignKey':_0x2f09('0x157')});db[_0x2f09('0x1c')][_0x2f09('0x124')](db[_0x2f09('0x83')],{'as':_0x2f09('0x158'),'foreignKey':_0x2f09('0x159')});db[_0x2f09('0x1c')][_0x2f09('0x125')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x129'),'through':'voice_queues_has_cm_lists'});db[_0x2f09('0x1c')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':'UserVoiceQueue'});db[_0x2f09('0x1c')]['belongsToMany'](db['Team'],{'as':_0x2f09('0x15b'),'through':'TeamVoiceQueue'});db[_0x2f09('0x1c')][_0x2f09('0x125')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x15c'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x2f09('0x124')](db['User'],{'as':_0x2f09('0x12'),'foreignKey':_0x2f09('0x114')});db['ScreenRecording'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':_0x2f09('0x12'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x20')][_0x2f09('0x116')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x2f09('0x113'),'foreignKey':'mailboxuser','sourceKey':_0x2f09('0x15d')});db[_0x2f09('0x22')][_0x2f09('0x124')](db[_0x2f09('0x20')],{'foreignKey':_0x2f09('0x15e'),'targetKey':_0x2f09('0x15d')});db[_0x2f09('0x24')][_0x2f09('0x116')](db['VoiceQueueReport'],{'as':_0x2f09('0x15f'),'foreignKey':'uniqueid','constraints':![]});db[_0x2f09('0x24')][_0x2f09('0x116')](db['VoiceAgentReport'],{'as':_0x2f09('0x160'),'foreignKey':_0x2f09('0x161'),'constraints':![]});db[_0x2f09('0x24')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':_0x2f09('0x12'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x24')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db['MailServerIn'][_0x2f09('0x124')](db[_0x2f09('0x3f')],{'as':_0x2f09('0x3f'),'foreignKey':_0x2f09('0x164')});db['MailServerIn'][_0x2f09('0x124')](db[_0x2f09('0x165')],{'as':_0x2f09('0x165'),'foreignKey':_0x2f09('0x166'),'onDelete':'restrict'});db['MailServerOut']['belongsTo'](db[_0x2f09('0x3f')],{'as':_0x2f09('0x3f'),'foreignKey':_0x2f09('0x164')});db[_0x2f09('0x3d')][_0x2f09('0x124')](db[_0x2f09('0x165')],{'as':_0x2f09('0x165'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x2f09('0x3f')]['hasOne'](db[_0x2f09('0x3b')],{'as':_0x2f09('0x167'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x3f')][_0x2f09('0x112')](db[_0x2f09('0x3d')],{'as':'Smtp','onDelete':_0x2f09('0x113')});db[_0x2f09('0x3f')][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':_0x2f09('0x169'),'foreignKey':_0x2f09('0x164'),'onDelete':'cascade'});db['MailAccount'][_0x2f09('0x116')](db['CannedAnswer'],{'as':'Answers','foreignKey':'MailAccountId'});db['MailAccount'][_0x2f09('0x116')](db[_0x2f09('0x16a')],{'as':_0x2f09('0x16b'),'foreignKey':_0x2f09('0x164')});db[_0x2f09('0x3f')][_0x2f09('0x116')](db[_0x2f09('0x44')],{'as':'Interactions'});db[_0x2f09('0x3f')]['hasMany'](db[_0x2f09('0x47')],{'as':'Applications'});db[_0x2f09('0x3f')][_0x2f09('0x124')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db['MailAccount'][_0x2f09('0x124')](db[_0x2f09('0x95')],{'as':_0x2f09('0x95'),'foreignKey':_0x2f09('0x16e')});db[_0x2f09('0x3f')][_0x2f09('0x124')](db[_0x2f09('0x83')],{'as':_0x2f09('0x158'),'foreignKey':_0x2f09('0x159')});db[_0x2f09('0x3f')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x2f09('0x40')][_0x2f09('0x125')](db['User'],{'as':_0x2f09('0x15a'),'through':_0x2f09('0x33')});db['MailQueue'][_0x2f09('0x125')](db[_0x2f09('0xe2')],{'through':_0x2f09('0x16f'),'as':_0x2f09('0x15b')});db['MailInteraction'][_0x2f09('0x116')](db[_0x2f09('0x16a')],{'as':'Messages','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x170')});db[_0x2f09('0x44')][_0x2f09('0x124')](db[_0x2f09('0x3f')],{'as':'Account','foreignKey':_0x2f09('0x164')});db[_0x2f09('0x44')]['belongsTo'](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':'ContactId'});db[_0x2f09('0x44')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x2f09('0x44')][_0x2f09('0x125')](db[_0x2f09('0x8d')],{'through':_0x2f09('0x171'),'as':_0x2f09('0x172')});db[_0x2f09('0x44')][_0x2f09('0x125')](db['Tag'],{'through':_0x2f09('0x171'),'as':_0x2f09('0x173')});db[_0x2f09('0x44')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x174'),'through':_0x2f09('0x12c'),'foreignKey':_0x2f09('0x170')});db['MailMessage'][_0x2f09('0x116')](db[_0x2f09('0xea')],{'as':_0x2f09('0x175'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x16a')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':_0x2f09('0x12')});db['MailMessage'][_0x2f09('0x124')](db['CmContact'],{'onDelete':_0x2f09('0x113'),'as':'Contact'});db[_0x2f09('0x16a')][_0x2f09('0x124')](db[_0x2f09('0x44')],{'as':'Interaction','foreignKey':_0x2f09('0x170')});db[_0x2f09('0x16a')][_0x2f09('0x124')](db[_0x2f09('0x3f')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x164')});db[_0x2f09('0x16a')][_0x2f09('0x124')](db[_0x2f09('0x63')],{'as':_0x2f09('0x63'),'foreignKey':'ChatWebsiteId'});db[_0x2f09('0x16a')]['belongsTo'](db[_0x2f09('0x177')],{'as':_0x2f09('0x177'),'foreignKey':'ChatOfflineMessageId'});db[_0x2f09('0x47')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x2f09('0x40')],{'onDelete':'restrict'});db['MailApplication'][_0x2f09('0x124')](db[_0x2f09('0x3f')],{'onDelete':_0x2f09('0x178')});db[_0x2f09('0x47')][_0x2f09('0x124')](db[_0x2f09('0x156')],{'onDelete':'restrict','foreignKey':_0x2f09('0x157')});db[_0x2f09('0x47')][_0x2f09('0x124')](db[_0x2f09('0x8d')],{'onDelete':_0x2f09('0x178'),'foreignKey':_0x2f09('0x179')});db[_0x2f09('0x49')][_0x2f09('0x124')](db['MailAccount'],{});db[_0x2f09('0x49')][_0x2f09('0x124')](db['CmList'],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x49')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db['MailQueueReport'][_0x2f09('0x124')](db[_0x2f09('0x44')],{});db[_0x2f09('0x49')]['belongsTo'](db[_0x2f09('0x16a')],{});db[_0x2f09('0x49')][_0x2f09('0x124')](db[_0x2f09('0x12')],{});db[_0x2f09('0x49')][_0x2f09('0x124')](db[_0x2f09('0x40')],{});db['Dashboard'][_0x2f09('0x116')](db[_0x2f09('0x4c')],{'as':_0x2f09('0x17a'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x4d')][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':_0x2f09('0x169'),'foreignKey':_0x2f09('0x17b'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x4d')][_0x2f09('0x116')](db[_0x2f09('0x7e')],{'as':'Answers','foreignKey':_0x2f09('0x17b')});db[_0x2f09('0x4d')][_0x2f09('0x116')](db[_0x2f09('0x50')],{'as':_0x2f09('0x17c')});db[_0x2f09('0x4d')][_0x2f09('0x116')](db[_0x2f09('0x4e')],{'as':_0x2f09('0x17d')});db[_0x2f09('0x4d')][_0x2f09('0x116')](db[_0x2f09('0x149')],{'as':_0x2f09('0x17e'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x4d')][_0x2f09('0x116')](db[_0x2f09('0x52')],{'as':_0x2f09('0x16b')});db[_0x2f09('0x4d')][_0x2f09('0x124')](db['Trunk'],{'as':_0x2f09('0x153')});db[_0x2f09('0x4d')][_0x2f09('0x124')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db['FaxAccount'][_0x2f09('0x124')](db[_0x2f09('0x83')],{'as':_0x2f09('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2f09('0x4d')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':'user_has_fax_accounts'});db[_0x2f09('0x4e')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':_0x2f09('0x178')});db[_0x2f09('0x4e')]['belongsTo'](db[_0x2f09('0x136')],{'onDelete':_0x2f09('0x178')});db[_0x2f09('0x4e')]['belongsTo'](db[_0x2f09('0x4d')],{'onDelete':'restrict'});db[_0x2f09('0x4e')][_0x2f09('0x124')](db[_0x2f09('0x8d')],{'onDelete':_0x2f09('0x178'),'foreignKey':_0x2f09('0x179')});db['FaxInteraction'][_0x2f09('0x116')](db[_0x2f09('0x52')],{'as':_0x2f09('0x16b'),'onDelete':'cascade','foreignKey':_0x2f09('0x17f')});db[_0x2f09('0x50')][_0x2f09('0x124')](db[_0x2f09('0x4d')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x17b')});db[_0x2f09('0x50')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':'ContactId'});db[_0x2f09('0x50')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':_0x2f09('0x180'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x50')]['belongsToMany'](db[_0x2f09('0x8d')],{'through':_0x2f09('0x181'),'as':_0x2f09('0x172')});db['FaxInteraction']['belongsToMany'](db[_0x2f09('0x8d')],{'through':_0x2f09('0x181'),'as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0x2f09('0x12f'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x12')});db[_0x2f09('0x52')][_0x2f09('0x124')](db[_0x2f09('0x50')],{'as':_0x2f09('0x182'),'foreignKey':_0x2f09('0x17f')});db['FaxMessage'][_0x2f09('0x124')](db[_0x2f09('0x71')],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x162')});db[_0x2f09('0x52')]['belongsTo'](db['Attachment'],{'as':_0x2f09('0xea'),'foreignKey':_0x2f09('0x183')});db[_0x2f09('0x52')][_0x2f09('0x124')](db['FaxAccount'],{'as':_0x2f09('0x176'),'foreignKey':'FaxAccountId'});db[_0x2f09('0x136')]['belongsToMany'](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':'UserFaxQueue'});db[_0x2f09('0x136')][_0x2f09('0x125')](db['Team'],{'through':_0x2f09('0x184'),'as':_0x2f09('0x15b')});db[_0x2f09('0x54')][_0x2f09('0x124')](db[_0x2f09('0x4d')],{});db['FaxQueueReport'][_0x2f09('0x124')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x54')][_0x2f09('0x124')](db['CmContact'],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db['FaxQueueReport'][_0x2f09('0x124')](db[_0x2f09('0x50')],{});db[_0x2f09('0x54')][_0x2f09('0x124')](db[_0x2f09('0x52')],{});db[_0x2f09('0x54')]['belongsTo'](db[_0x2f09('0x12')],{});db[_0x2f09('0x54')]['belongsTo'](db[_0x2f09('0x136')],{});db['SmsAccount'][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':_0x2f09('0x169'),'foreignKey':'SmsAccountId','onDelete':_0x2f09('0x113')});db['SmsAccount'][_0x2f09('0x116')](db[_0x2f09('0x7e')],{'as':_0x2f09('0x185'),'foreignKey':_0x2f09('0x186')});db[_0x2f09('0x55')]['hasMany'](db[_0x2f09('0x5a')],{'as':_0x2f09('0x16b'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x2f09('0x116')](db['SmsInteraction'],{'as':_0x2f09('0x17c')});db[_0x2f09('0x55')][_0x2f09('0x116')](db[_0x2f09('0x57')],{'as':_0x2f09('0x17d')});db['SmsAccount'][_0x2f09('0x124')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x55')][_0x2f09('0x124')](db[_0x2f09('0x83')],{'as':_0x2f09('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2f09('0x55')][_0x2f09('0x125')](db['User'],{'as':_0x2f09('0x15a'),'through':_0x2f09('0x187')});db['SmsApplication'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':_0x2f09('0x178')});db[_0x2f09('0x57')]['belongsTo'](db[_0x2f09('0x138')],{'onDelete':_0x2f09('0x178')});db['SmsApplication'][_0x2f09('0x124')](db[_0x2f09('0x55')],{'onDelete':'restrict'});db['SmsApplication'][_0x2f09('0x124')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x2f09('0x157')});db[_0x2f09('0x57')][_0x2f09('0x124')](db[_0x2f09('0x8d')],{'onDelete':_0x2f09('0x178'),'foreignKey':'TagId'});db[_0x2f09('0x59')][_0x2f09('0x116')](db[_0x2f09('0x5a')],{'as':_0x2f09('0x16b'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x188')});db[_0x2f09('0x59')][_0x2f09('0x124')](db[_0x2f09('0x55')],{'as':'Account','foreignKey':_0x2f09('0x186')});db[_0x2f09('0x59')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':'Contact','foreignKey':_0x2f09('0x163')});db[_0x2f09('0x59')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':_0x2f09('0x180'),'foreignKey':'UserId'});db['SmsInteraction']['belongsToMany'](db[_0x2f09('0x8d')],{'through':_0x2f09('0x189'),'as':'Tags'});db[_0x2f09('0x59')][_0x2f09('0x125')](db[_0x2f09('0x8d')],{'through':_0x2f09('0x189'),'as':_0x2f09('0x173')});db[_0x2f09('0x59')]['belongsToMany'](db[_0x2f09('0x12')],{'as':_0x2f09('0x174'),'through':_0x2f09('0x130'),'foreignKey':'SmsInteractionId'});db[_0x2f09('0x5a')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':_0x2f09('0x12')});db[_0x2f09('0x5a')]['belongsTo'](db['CmContact'],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x162')});db[_0x2f09('0x5a')]['belongsTo'](db['SmsInteraction'],{'onDelete':'cascade','as':_0x2f09('0x182'),'foreignKey':_0x2f09('0x188')});db[_0x2f09('0x5a')][_0x2f09('0x124')](db[_0x2f09('0x55')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x186')});db[_0x2f09('0x138')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':_0x2f09('0x36'),'foreignKey':_0x2f09('0x18a')});db['SmsQueue'][_0x2f09('0x125')](db[_0x2f09('0xe2')],{'through':_0x2f09('0x18b'),'as':_0x2f09('0x15b')});db[_0x2f09('0x143')][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':_0x2f09('0x169'),'foreignKey':_0x2f09('0x18c'),'onDelete':'cascade'});db[_0x2f09('0x143')][_0x2f09('0x116')](db[_0x2f09('0x7e')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2f09('0x116')](db['OpenchannelInteraction'],{'as':_0x2f09('0x17c'),'foreignKey':_0x2f09('0x18c')});db[_0x2f09('0x143')][_0x2f09('0x116')](db[_0x2f09('0x61')],{'as':_0x2f09('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0x2f09('0x143')][_0x2f09('0x116')](db['OpenchannelApplication'],{'as':_0x2f09('0x17d'),'foreignKey':'OpenchannelAccountId'});db[_0x2f09('0x143')][_0x2f09('0x124')](db['CmList'],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x143')][_0x2f09('0x124')](db[_0x2f09('0x83')],{'as':_0x2f09('0x158'),'foreignKey':_0x2f09('0x159')});db[_0x2f09('0x143')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':_0x2f09('0x145')});db[_0x2f09('0x5d')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':'restrict'});db[_0x2f09('0x5d')][_0x2f09('0x124')](db[_0x2f09('0x18d')],{'onDelete':_0x2f09('0x178'),'foreignKey':_0x2f09('0x18e')});db[_0x2f09('0x5d')]['belongsTo'](db[_0x2f09('0x143')],{'onDelete':'restrict','foreignKey':_0x2f09('0x18c')});db[_0x2f09('0x5d')]['belongsTo'](db[_0x2f09('0x156')],{'onDelete':'restrict','foreignKey':_0x2f09('0x157')});db['OpenchannelApplication'][_0x2f09('0x124')](db[_0x2f09('0x8d')],{'onDelete':'restrict','foreignKey':_0x2f09('0x179')});db[_0x2f09('0x5f')][_0x2f09('0x116')](db['OpenchannelMessage'],{'as':_0x2f09('0x16b'),'onDelete':_0x2f09('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x2f09('0x5f')][_0x2f09('0x124')](db[_0x2f09('0x143')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x18c')});db['OpenchannelInteraction'][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':'Contact','foreignKey':_0x2f09('0x163')});db[_0x2f09('0x5f')][_0x2f09('0x124')](db['User'],{'as':_0x2f09('0x180'),'foreignKey':'UserId'});db[_0x2f09('0x5f')][_0x2f09('0x125')](db[_0x2f09('0x8d')],{'through':_0x2f09('0x18f'),'as':_0x2f09('0x172')});db[_0x2f09('0x5f')]['belongsToMany'](db[_0x2f09('0x8d')],{'through':'openchannel_interaction_has_tags','as':_0x2f09('0x173')});db['OpenchannelInteraction']['belongsToMany'](db[_0x2f09('0x12')],{'as':_0x2f09('0x174'),'through':_0x2f09('0x190'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x12')});db[_0x2f09('0x61')][_0x2f09('0x124')](db['CmContact'],{'onDelete':_0x2f09('0x113'),'as':'Contact'});db[_0x2f09('0x61')]['belongsTo'](db[_0x2f09('0x5f')],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x182'),'foreignKey':_0x2f09('0x191')});db[_0x2f09('0x61')][_0x2f09('0x124')](db[_0x2f09('0xea')],{'as':_0x2f09('0xea'),'foreignKey':'AttachmentId'});db[_0x2f09('0x61')][_0x2f09('0x124')](db[_0x2f09('0x143')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x18c')});db[_0x2f09('0x18d')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x2f09('0x18d')]['belongsToMany'](db[_0x2f09('0xe2')],{'through':_0x2f09('0x192'),'as':_0x2f09('0x15b')});db[_0x2f09('0x63')][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':_0x2f09('0x169'),'foreignKey':'ChatWebsiteId','onDelete':_0x2f09('0x113')});db[_0x2f09('0x63')][_0x2f09('0x116')](db[_0x2f09('0x7e')],{'as':_0x2f09('0x185'),'foreignKey':_0x2f09('0x193')});db['ChatWebsite'][_0x2f09('0x116')](db[_0x2f09('0x194')],{'as':_0x2f09('0x195')});db['ChatWebsite']['hasMany'](db[_0x2f09('0x69')],{'as':_0x2f09('0x17c')});db['ChatWebsite']['hasMany'](db[_0x2f09('0x67')],{'as':'Applications'});db[_0x2f09('0x63')][_0x2f09('0x116')](db['ChatMessage'],{'as':'Messages'});db[_0x2f09('0x63')][_0x2f09('0x124')](db['CmList'],{'as':'List','foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x63')]['belongsTo'](db[_0x2f09('0x156')],{'as':'Interval','foreignKey':_0x2f09('0x157')});db[_0x2f09('0x63')][_0x2f09('0x124')](db[_0x2f09('0x3f')],{'as':_0x2f09('0x3f'),'foreignKey':_0x2f09('0x164')});db[_0x2f09('0x63')][_0x2f09('0x124')](db[_0x2f09('0x83')],{'as':_0x2f09('0x158'),'foreignKey':_0x2f09('0x159')});db[_0x2f09('0x63')][_0x2f09('0x125')](db['User'],{'as':'Agents','through':_0x2f09('0x13e')});db['OpenchannelQueueReport'][_0x2f09('0x124')](db[_0x2f09('0x143')],{});db[_0x2f09('0x65')][_0x2f09('0x124')](db['CmList'],{'as':_0x2f09('0x16c'),'foreignKey':'ListId'});db['OpenchannelQueueReport']['belongsTo'](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db[_0x2f09('0x65')][_0x2f09('0x124')](db[_0x2f09('0x5f')],{});db[_0x2f09('0x65')][_0x2f09('0x124')](db[_0x2f09('0x61')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x2f09('0x12')],{});db[_0x2f09('0x65')][_0x2f09('0x124')](db[_0x2f09('0x18d')],{});db['ChatApplication'][_0x2f09('0x124')](db['User'],{'as':_0x2f09('0x196'),'foreignKey':_0x2f09('0x114'),'onDelete':_0x2f09('0x178')});db['ChatApplication'][_0x2f09('0x124')](db['ChatQueue'],{'as':_0x2f09('0x197'),'foreignKey':_0x2f09('0x198'),'onDelete':'restrict'});db['ChatApplication'][_0x2f09('0x124')](db['ChatWebsite'],{'as':_0x2f09('0x199'),'foreignKey':'ChatWebsiteId','onDelete':_0x2f09('0x178')});db['ChatApplication'][_0x2f09('0x124')](db['Tag'],{'onDelete':_0x2f09('0x178'),'foreignKey':_0x2f09('0x179')});db[_0x2f09('0x69')]['hasMany'](db[_0x2f09('0x6b')],{'as':_0x2f09('0x16b'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x2f09('0x69')]['belongsTo'](db[_0x2f09('0x63')],{'as':_0x2f09('0x176'),'foreignKey':'ChatWebsiteId'});db[_0x2f09('0x69')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db[_0x2f09('0x69')]['belongsTo'](db[_0x2f09('0x12')],{'as':_0x2f09('0x180'),'foreignKey':_0x2f09('0x114')});db['ChatInteraction']['belongsToMany'](db[_0x2f09('0x8d')],{'through':_0x2f09('0x19a'),'as':_0x2f09('0x172')});db[_0x2f09('0x69')][_0x2f09('0x125')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x2f09('0x173')});db[_0x2f09('0x69')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x2f09('0x19b')});db[_0x2f09('0x6b')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x12')});db['ChatMessage'][_0x2f09('0x124')](db[_0x2f09('0x71')],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db[_0x2f09('0x6b')][_0x2f09('0x124')](db[_0x2f09('0x69')],{'onDelete':_0x2f09('0x113'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x2f09('0x6b')][_0x2f09('0x124')](db[_0x2f09('0xea')],{'as':'Attachment','foreignKey':_0x2f09('0x183')});db[_0x2f09('0x6b')][_0x2f09('0x124')](db[_0x2f09('0x63')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x193')});db[_0x2f09('0x177')]['hasMany'](db[_0x2f09('0xea')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x2f09('0x113'),'hooks':!![]});db[_0x2f09('0x177')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x2f09('0x163')});db['ChatOfflineMessage'][_0x2f09('0x124')](db[_0x2f09('0x63')],{'as':'Account','foreignKey':_0x2f09('0x193')});db['ChatQueue'][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':'Agents','through':_0x2f09('0x31'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':'team_has_chat_queues','as':'Teams'});db[_0x2f09('0x6e')][_0x2f09('0x116')](db[_0x2f09('0xcd')],{'as':'Messages','foreignKey':_0x2f09('0x19c'),'onDelete':'cascade'});db[_0x2f09('0x6e')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':'Members','through':_0x2f09('0x127')});db[_0x2f09('0x194')]['belongsTo'](db[_0x2f09('0x63')],{'as':_0x2f09('0x199'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x2f09('0x116')](db[_0x2f09('0x71')],{'as':_0x2f09('0x128'),'foreignKey':_0x2f09('0x19d')});db['CmContact'][_0x2f09('0x116')](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x2f09('0x19e')});db[_0x2f09('0x71')][_0x2f09('0x116')](db[_0x2f09('0x73')],{'as':_0x2f09('0x14e'),'foreignKey':'ContactId'});db[_0x2f09('0x71')][_0x2f09('0x116')](db['CmHopperFinal'],{'as':_0x2f09('0x11a'),'foreignKey':_0x2f09('0x163')});db[_0x2f09('0x71')][_0x2f09('0x116')](db[_0x2f09('0x76')],{'as':_0x2f09('0x19f'),'foreignKey':_0x2f09('0x163')});db['CmContact'][_0x2f09('0x116')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x2f09('0x163')});db[_0x2f09('0x71')][_0x2f09('0x116')](db[_0x2f09('0xd3')],{'as':_0x2f09('0x152'),'foreignKey':_0x2f09('0x163')});db[_0x2f09('0x71')][_0x2f09('0x116')](db[_0x2f09('0x5f')],{'as':_0x2f09('0x11c'),'foreignKey':_0x2f09('0x163'),'onDelete':'restrict'});db[_0x2f09('0x71')][_0x2f09('0x116')](db[_0x2f09('0x69')],{'as':_0x2f09('0x12d'),'foreignKey':_0x2f09('0x163'),'onDelete':_0x2f09('0x178')});db[_0x2f09('0x71')][_0x2f09('0x116')](db['SmsInteraction'],{'as':_0x2f09('0x11d'),'foreignKey':'ContactId','onDelete':_0x2f09('0x178')});db[_0x2f09('0x71')][_0x2f09('0x116')](db[_0x2f09('0x50')],{'as':_0x2f09('0x11e'),'foreignKey':'ContactId','onDelete':_0x2f09('0x178')});db[_0x2f09('0x71')][_0x2f09('0x116')](db[_0x2f09('0x44')],{'as':'MailInteractions','foreignKey':_0x2f09('0x163'),'onDelete':'restrict'});db[_0x2f09('0x71')][_0x2f09('0x124')](db['CmCompany'],{'as':_0x2f09('0x1a0'),'foreignKey':'CompanyId'});db[_0x2f09('0x71')][_0x2f09('0x124')](db[_0x2f09('0xf6')],{'as':'List','foreignKey':_0x2f09('0x16d'),'onDelete':'cascade'});db[_0x2f09('0x71')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x174'),'through':'cm_user_has_contacts'});db[_0x2f09('0x71')]['belongsToMany'](db[_0x2f09('0x8d')],{'as':_0x2f09('0x172'),'through':_0x2f09('0x1a1')});db[_0x2f09('0x71')][_0x2f09('0x125')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x2f09('0x173')});db[_0x2f09('0x73')][_0x2f09('0x116')](db[_0x2f09('0x93')],{'as':_0x2f09('0x1a2'),'foreignKey':_0x2f09('0x1a3')});db['CmHopper']['belongsTo'](db[_0x2f09('0x71')],{'as':'Contact','foreignKey':_0x2f09('0x163'),'onDelete':'cascade'});db[_0x2f09('0x73')][_0x2f09('0x124')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x16c'),'foreignKey':'ListId','onDelete':_0x2f09('0x113')});db['CmHopper'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':_0x2f09('0x196'),'foreignKey':_0x2f09('0x114')});db[_0x2f09('0x73')][_0x2f09('0x124')](db['VoiceQueue'],{'as':_0x2f09('0x197'),'foreignKey':_0x2f09('0x14d'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x73')][_0x2f09('0x124')](db['Campaign'],{'as':'Campaign','foreignKey':_0x2f09('0x1a4'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x73')]['belongsTo'](db[_0x2f09('0x12')],{'as':'Owner','foreignKey':_0x2f09('0x1a5')});db['CmHopperBlack'][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':'ContactId','onDelete':_0x2f09('0x113')});db[_0x2f09('0x150')]['belongsTo'](db[_0x2f09('0xf6')],{'as':'List','foreignKey':_0x2f09('0x16d'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x150')][_0x2f09('0x124')](db[_0x2f09('0x1c')],{'as':'Queue','foreignKey':_0x2f09('0x14d'),'onDelete':'cascade'});db[_0x2f09('0x150')][_0x2f09('0x124')](db[_0x2f09('0xe6')],{'as':_0x2f09('0xe6'),'foreignKey':_0x2f09('0x1a4'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x7c')][_0x2f09('0x116')](db[_0x2f09('0x1a6')],{'as':{'plural':'All','singular':_0x2f09('0x1a7')},'foreignKey':'AutomationAllId','onDelete':_0x2f09('0x113'),'hooks':!![]});db[_0x2f09('0x7c')][_0x2f09('0x116')](db[_0x2f09('0x1a6')],{'as':{'plural':_0x2f09('0x1a8'),'singular':'OneAny'},'foreignKey':_0x2f09('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0x2f09('0x7c')]['hasMany'](db[_0x2f09('0x7b')],{'as':_0x2f09('0x1aa'),'foreignKey':_0x2f09('0x1ab'),'onDelete':_0x2f09('0x113'),'hooks':!![]});db['Disposition'][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':'Dispositions','foreignKey':_0x2f09('0x1ac'),'onDelete':'cascade'});db[_0x2f09('0x156')]['hasMany'](db['Interval'],{'as':_0x2f09('0x1ad'),'foreignKey':_0x2f09('0x157'),'onDelete':_0x2f09('0x113'),'hooks':!![],'required':![]});db[_0x2f09('0x156')][_0x2f09('0x116')](db['VoiceExtension'],{'as':_0x2f09('0x119'),'foreignKey':'IntervalId','onDelete':_0x2f09('0x178')});db['Interval'][_0x2f09('0x116')](db['MailApplication'],{'as':_0x2f09('0x1ae'),'foreignKey':_0x2f09('0x157')});db['Interval']['hasMany'](db[_0x2f09('0x67')],{'as':_0x2f09('0x1af'),'foreignKey':_0x2f09('0x157')});db[_0x2f09('0x156')][_0x2f09('0x116')](db[_0x2f09('0x4e')],{'as':_0x2f09('0x1b0'),'foreignKey':_0x2f09('0x157')});db[_0x2f09('0x156')][_0x2f09('0x116')](db[_0x2f09('0x57')],{'as':'SmsApplications','foreignKey':_0x2f09('0x157')});db[_0x2f09('0x89')][_0x2f09('0x124')](db[_0x2f09('0x3f')],{});db[_0x2f09('0x89')][_0x2f09('0x124')](db[_0x2f09('0x9e')],{'foreignKey':_0x2f09('0x1b1')});db[_0x2f09('0x89')][_0x2f09('0x124')](db['AnalyticCustomReport'],{'foreignKey':_0x2f09('0x1b2')});db[_0x2f09('0x8b')][_0x2f09('0x125')](db[_0x2f09('0x1a')],{'as':_0x2f09('0x1b3'),'through':_0x2f09('0x14b'),'onDelete':_0x2f09('0x178')});db[_0x2f09('0x8d')]['belongsToMany'](db[_0x2f09('0x71')],{'through':_0x2f09('0x1a1')});db['Tag'][_0x2f09('0x125')](db[_0x2f09('0x69')],{'through':_0x2f09('0x19a')});db[_0x2f09('0x8d')][_0x2f09('0x125')](db[_0x2f09('0x44')],{'through':_0x2f09('0x171')});db['Tag'][_0x2f09('0x125')](db[_0x2f09('0x59')],{'through':_0x2f09('0x189')});db[_0x2f09('0x8d')][_0x2f09('0x125')](db[_0x2f09('0x50')],{'through':_0x2f09('0x181')});db['Tag'][_0x2f09('0x125')](db['OpenchannelInteraction'],{'through':_0x2f09('0x18f')});db[_0x2f09('0x8d')][_0x2f09('0x125')](db[_0x2f09('0x11f')],{'through':_0x2f09('0x1b4')});db[_0x2f09('0x91')][_0x2f09('0x124')](db[_0x2f09('0x8f')],{'as':_0x2f09('0x1b5'),'foreignKey':_0x2f09('0x1b6')});db[_0x2f09('0x93')][_0x2f09('0x124')](db[_0x2f09('0x73')],{'as':'Hopper','foreignKey':_0x2f09('0x1a3')});db[_0x2f09('0x91')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x19e')});db['Trigger']['hasMany'](db[_0x2f09('0x1a6')],{'as':{'plural':_0x2f09('0x1b7'),'singular':'AllCondition'},'foreignKey':_0x2f09('0x1b8'),'onDelete':_0x2f09('0x113'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x2f09('0x1a6')],{'as':{'plural':_0x2f09('0x1b9'),'singular':'AnyCondition'},'foreignKey':_0x2f09('0x1ba'),'onDelete':_0x2f09('0x113'),'hooks':!![]});db[_0x2f09('0x97')][_0x2f09('0x116')](db[_0x2f09('0x7b')],{'as':_0x2f09('0x1aa'),'foreignKey':'TriggerId','onDelete':_0x2f09('0x113'),'hooks':!![]});db[_0x2f09('0x9d')]['hasMany'](db[_0x2f09('0xa3')],{'as':_0x2f09('0x1bb'),'onDelete':'cascade','foreignKey':_0x2f09('0x1b2'),'hooks':!![]});db['AnalyticDefaultReport'][_0x2f09('0x116')](db[_0x2f09('0xa3')],{'as':_0x2f09('0x1bb'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1b1')});db['AnalyticMetric'][_0x2f09('0x116')](db[_0x2f09('0xa3')],{'as':'Fields','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bc')});db[_0x2f09('0xa3')][_0x2f09('0x124')](db[_0x2f09('0xa1')],{'foreignKey':_0x2f09('0x1bc')});db[_0x2f09('0xa5')][_0x2f09('0x116')](db[_0x2f09('0x1bd')],{'as':_0x2f09('0x1be'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0x1bd')][_0x2f09('0x116')](db['SalesforceField'],{'as':_0x2f09('0x1c0'),'onDelete':'cascade','foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0x1bd')]['hasMany'](db[_0x2f09('0x1c2')],{'as':_0x2f09('0x1c3'),'onDelete':_0x2f09('0x113'),'foreignKey':'DescriptionId'});db[_0x2f09('0x1bd')][_0x2f09('0x116')](db[_0x2f09('0x1c2')],{'as':'Fields','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0x1bd')][_0x2f09('0x124')](db[_0x2f09('0xa5')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0x1c2')][_0x2f09('0x116')](db[_0x2f09('0x1c2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2f09('0x1c2')][_0x2f09('0x116')](db[_0x2f09('0x1c2')],{'as':_0x2f09('0x1c5'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0x1c2')][_0x2f09('0x116')](db[_0x2f09('0x1c2')],{'as':_0x2f09('0x1c7'),'foreignKey':'FieldId'});db[_0x2f09('0x1c2')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0x1c9')][_0x2f09('0x116')](db['SugarcrmConfiguration'],{'as':_0x2f09('0x1be'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0x1ca')][_0x2f09('0x116')](db['SugarcrmField'],{'as':_0x2f09('0x1c0'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c1')});db['SugarcrmConfiguration']['hasMany'](db[_0x2f09('0x1cb')],{'as':_0x2f09('0x1c3'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c6')});db['SugarcrmConfiguration'][_0x2f09('0x116')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c4')});db['SugarcrmConfiguration'][_0x2f09('0x124')](db[_0x2f09('0x1c9')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1bf')});db['SugarcrmField'][_0x2f09('0x116')](db[_0x2f09('0x1cb')],{'as':_0x2f09('0x1cc'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0x1cb')][_0x2f09('0x116')](db[_0x2f09('0x1cb')],{'as':_0x2f09('0x1c5'),'foreignKey':'DescriptionId'});db[_0x2f09('0x1cb')][_0x2f09('0x116')](db['SugarcrmField'],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0x1cb')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0xab')][_0x2f09('0x116')](db[_0x2f09('0x1cd')],{'as':_0x2f09('0x1be'),'onDelete':_0x2f09('0x113'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x2f09('0x116')](db[_0x2f09('0xae')],{'as':_0x2f09('0x1c0'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0x1cd')][_0x2f09('0x116')](db[_0x2f09('0xae')],{'as':_0x2f09('0x1c3'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0x1cd')][_0x2f09('0x116')](db[_0x2f09('0xae')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x2f09('0x1cd')][_0x2f09('0x124')](db['DeskAccount'],{'as':_0x2f09('0x176'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x2f09('0x125')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x2f09('0xae')]['hasMany'](db[_0x2f09('0xae')],{'as':_0x2f09('0x1cc'),'foreignKey':'SubjectId'});db[_0x2f09('0xae')][_0x2f09('0x116')](db['DeskField'],{'as':'Description','foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xae')][_0x2f09('0x116')](db[_0x2f09('0xae')],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db['DeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x2f09('0x1c8')});db['ZohoAccount'][_0x2f09('0x116')](db[_0x2f09('0xb2')],{'as':'Configurations','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xb2')]['hasMany'](db[_0x2f09('0xb3')],{'as':_0x2f09('0x1c0'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0xb2')][_0x2f09('0x116')](db[_0x2f09('0xb3')],{'as':_0x2f09('0x1c3'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xb2')][_0x2f09('0x116')](db[_0x2f09('0xb3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xb2')][_0x2f09('0x124')](db[_0x2f09('0xb0')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xb3')][_0x2f09('0x116')](db['ZohoField'],{'as':'Subject','foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0xb3')][_0x2f09('0x116')](db[_0x2f09('0xb3')],{'as':_0x2f09('0x1c5'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xb3')][_0x2f09('0x116')](db[_0x2f09('0xb3')],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xb3')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0xb5')][_0x2f09('0x116')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0x1ce')][_0x2f09('0x116')](db['ZendeskField'],{'as':_0x2f09('0x1c0'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0x1ce')][_0x2f09('0x116')](db[_0x2f09('0x1cf')],{'as':_0x2f09('0x1c3'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0x1ce')]['hasMany'](db['ZendeskField'],{'as':_0x2f09('0x1bb'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x2f09('0x124')](db[_0x2f09('0xb5')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0x1ce')][_0x2f09('0x125')](db[_0x2f09('0x8d')],{'through':_0x2f09('0x1d0')});db[_0x2f09('0x1cf')]['hasMany'](db[_0x2f09('0x1cf')],{'as':_0x2f09('0x1cc'),'foreignKey':_0x2f09('0x1c1')});db['ZendeskField'][_0x2f09('0x116')](db['ZendeskField'],{'as':_0x2f09('0x1c5'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0x1cf')]['hasMany'](db[_0x2f09('0x1cf')],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0x1cf')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0xb8')]['hasMany'](db[_0x2f09('0xba')],{'as':_0x2f09('0x1be'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xba')][_0x2f09('0x116')](db[_0x2f09('0xbc')],{'as':_0x2f09('0x1c0'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0xba')][_0x2f09('0x116')](db[_0x2f09('0xbc')],{'as':_0x2f09('0x1c3'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xba')][_0x2f09('0x116')](db[_0x2f09('0xbc')],{'as':_0x2f09('0x1bb'),'onDelete':'cascade','foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xba')][_0x2f09('0x124')](db[_0x2f09('0xb8')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1bf')});db['FreshdeskConfiguration'][_0x2f09('0x125')](db[_0x2f09('0x8d')],{'through':_0x2f09('0x1d1')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x2f09('0x1cc'),'foreignKey':_0x2f09('0x1c1')});db['FreshdeskField'][_0x2f09('0x116')](db[_0x2f09('0xbc')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2f09('0xbc')][_0x2f09('0x116')](db[_0x2f09('0xbc')],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xbc')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0xbd')][_0x2f09('0x116')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xbf')][_0x2f09('0x116')](db[_0x2f09('0xc1')],{'as':_0x2f09('0x1c0'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0xbf')]['hasMany'](db[_0x2f09('0xc1')],{'as':_0x2f09('0x1c3'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xbf')][_0x2f09('0x116')](db[_0x2f09('0xc1')],{'as':_0x2f09('0x1bb'),'foreignKey':_0x2f09('0x1c4')});db['VtigerConfiguration'][_0x2f09('0x124')](db[_0x2f09('0xbd')],{'as':_0x2f09('0x176'),'foreignKey':'AccountId'});db['VtigerField'][_0x2f09('0x116')](db['VtigerField'],{'as':'Subject','foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0xc1')][_0x2f09('0x116')](db[_0x2f09('0xc1')],{'as':_0x2f09('0x1c5'),'foreignKey':_0x2f09('0x1c6')});db['VtigerField'][_0x2f09('0x116')](db['VtigerField'],{'as':'Field','foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xc1')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0x1d2')]['hasMany'](db[_0x2f09('0xc3')],{'as':_0x2f09('0x1be'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xc3')][_0x2f09('0x116')](db[_0x2f09('0xc5')],{'as':_0x2f09('0x1c0'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0xc3')][_0x2f09('0x116')](db['ServicenowField'],{'as':_0x2f09('0x1c3'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xc3')][_0x2f09('0x116')](db[_0x2f09('0xc5')],{'as':_0x2f09('0x1bb'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xc3')][_0x2f09('0x124')](db[_0x2f09('0x1d2')],{'as':'Account','foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xc5')][_0x2f09('0x116')](db['ServicenowField'],{'as':_0x2f09('0x1cc'),'foreignKey':_0x2f09('0x1c1')});db['ServicenowField'][_0x2f09('0x116')](db[_0x2f09('0xc5')],{'as':'Description','foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xc5')][_0x2f09('0x116')](db['ServicenowField'],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xc5')][_0x2f09('0x124')](db['Variable'],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0x1d3')][_0x2f09('0x116')](db['Dynamics365Configuration'],{'as':_0x2f09('0x1be'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db['Dynamics365Account']['belongsTo'](db[_0x2f09('0x165')],{'as':'CloudProvider','foreignKey':_0x2f09('0x166')});db[_0x2f09('0xc6')][_0x2f09('0x116')](db[_0x2f09('0xc7')],{'as':_0x2f09('0x1c0'),'onDelete':'cascade','foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0xc6')][_0x2f09('0x116')](db[_0x2f09('0xc7')],{'as':'Descriptions','onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xc6')][_0x2f09('0x116')](db[_0x2f09('0xc7')],{'as':_0x2f09('0x1bb'),'onDelete':'cascade','foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xc6')][_0x2f09('0x124')](db['Dynamics365Account'],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xc7')][_0x2f09('0x116')](db['Dynamics365Field'],{'as':_0x2f09('0x1cc'),'foreignKey':'SubjectId'});db[_0x2f09('0xc7')][_0x2f09('0x116')](db[_0x2f09('0xc7')],{'as':_0x2f09('0x1c5'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xc7')][_0x2f09('0x116')](db[_0x2f09('0xc7')],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xc7')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db[_0x2f09('0xc9')]['hasMany'](db[_0x2f09('0x1d4')],{'as':_0x2f09('0x1be'),'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0x1d4')][_0x2f09('0x116')](db['FreshsalesField'],{'as':_0x2f09('0x1c0'),'foreignKey':_0x2f09('0x1c1')});db[_0x2f09('0x1d4')][_0x2f09('0x116')](db[_0x2f09('0xcb')],{'as':_0x2f09('0x1c3'),'foreignKey':'DescriptionId'});db[_0x2f09('0x1d4')][_0x2f09('0x116')](db[_0x2f09('0xcb')],{'as':_0x2f09('0x1bb'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0x1d4')]['belongsTo'](db[_0x2f09('0xc9')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1bf')});db[_0x2f09('0xcb')]['hasMany'](db['FreshsalesField'],{'as':_0x2f09('0x1cc'),'foreignKey':'SubjectId'});db[_0x2f09('0xcb')]['hasMany'](db['FreshsalesField'],{'as':_0x2f09('0x1c5'),'foreignKey':_0x2f09('0x1c6')});db[_0x2f09('0xcb')]['hasMany'](db[_0x2f09('0xcb')],{'as':_0x2f09('0x1c7'),'foreignKey':_0x2f09('0x1c4')});db[_0x2f09('0xcb')][_0x2f09('0x124')](db[_0x2f09('0x99')],{'as':_0x2f09('0x99'),'foreignKey':_0x2f09('0x1c8')});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db[_0x2f09('0xcc')][_0x2f09('0x124')](db['CmList'],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db[_0x2f09('0xcc')][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db[_0x2f09('0xcc')][_0x2f09('0x124')](db[_0x2f09('0x69')],{});db[_0x2f09('0xcc')][_0x2f09('0x124')](db[_0x2f09('0x6b')],{});db[_0x2f09('0xcc')][_0x2f09('0x124')](db[_0x2f09('0x12')],{});db['ChatQueueReport'][_0x2f09('0x124')](db['ChatQueue'],{});db[_0x2f09('0xcd')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'onDelete':_0x2f09('0x113'),'foreignKey':'FromId'});db[_0x2f09('0xcd')][_0x2f09('0x124')](db['User'],{'onDelete':_0x2f09('0x113'),'foreignKey':_0x2f09('0x1d5')});db['JscriptySessionReport']['hasMany'](db[_0x2f09('0xd1')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x2f09('0xd3')][_0x2f09('0x116')](db[_0x2f09('0xcf')],{'foreignKey':_0x2f09('0x1d6'),'onDelete':_0x2f09('0x113')});db['SmsQueueReport'][_0x2f09('0x124')](db[_0x2f09('0x55')],{});db['SmsQueueReport']['belongsTo'](db[_0x2f09('0xf6')],{'as':'List','foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x1d7')]['belongsTo'](db[_0x2f09('0x71')],{'as':'Contact','foreignKey':_0x2f09('0x163')});db[_0x2f09('0x1d7')][_0x2f09('0x124')](db[_0x2f09('0x59')],{});db[_0x2f09('0x1d7')][_0x2f09('0x124')](db[_0x2f09('0x5a')],{});db[_0x2f09('0x1d7')]['belongsTo'](db['User'],{});db[_0x2f09('0x1d7')][_0x2f09('0x124')](db[_0x2f09('0x138')],{});db[_0x2f09('0xda')][_0x2f09('0x116')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x2f09('0x116')](db[_0x2f09('0xd1')],{'foreignKey':_0x2f09('0x1d8')});db[_0x2f09('0xda')][_0x2f09('0x116')](db[_0x2f09('0xcf')],{'foreignKey':_0x2f09('0x1d8')});db[_0x2f09('0xde')]['belongsToMany'](db[_0x2f09('0x12')],{'as':_0x2f09('0x174'),'through':_0x2f09('0x1d9')});db[_0x2f09('0xe2')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':'Agents','through':_0x2f09('0x12a')});db[_0x2f09('0xe2')]['belongsToMany'](db[_0x2f09('0x1c')],{'through':_0x2f09('0x1da'),'as':_0x2f09('0x131')});db[_0x2f09('0xe2')][_0x2f09('0x125')](db['MailQueue'],{'through':_0x2f09('0x16f'),'as':_0x2f09('0x133')});db['Team']['belongsToMany'](db[_0x2f09('0x134')],{'through':_0x2f09('0x1db'),'as':_0x2f09('0x135')});db[_0x2f09('0xe2')]['belongsToMany'](db[_0x2f09('0x136')],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team'][_0x2f09('0x125')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x2f09('0x139')});db[_0x2f09('0xe2')][_0x2f09('0x125')](db[_0x2f09('0x18d')],{'through':_0x2f09('0x192'),'as':'OpenchannelQueues'});db[_0x2f09('0xe2')][_0x2f09('0x125')](db[_0x2f09('0x109')],{'through':_0x2f09('0x1dc'),'as':'WhatsappQueues'});db[_0x2f09('0xe2')][_0x2f09('0x125')](db[_0x2f09('0xf7')],{'through':'TeamVoicePrefix','as':_0x2f09('0x132')});db[_0x2f09('0xe6')][_0x2f09('0x116')](db['CmHopper'],{'as':_0x2f09('0x14e'),'foreignKey':'CampaignId'});db[_0x2f09('0xe6')][_0x2f09('0x116')](db[_0x2f09('0x14f')],{'as':'HopperFinals','foreignKey':_0x2f09('0x1a4')});db['Campaign'][_0x2f09('0x116')](db['CmHopperHistory'],{'as':_0x2f09('0x19f'),'foreignKey':'CampaignId'});db[_0x2f09('0xe6')][_0x2f09('0x116')](db[_0x2f09('0x150')],{'as':'HopperBlacks','foreignKey':_0x2f09('0x1a4')});db[_0x2f09('0xe6')][_0x2f09('0x124')](db['Trunk'],{'as':_0x2f09('0x153'),'foreignKey':'TrunkId'});db[_0x2f09('0xe6')][_0x2f09('0x124')](db[_0x2f09('0x153')],{'as':_0x2f09('0x154'),'foreignKey':_0x2f09('0x155')});db['Campaign'][_0x2f09('0x124')](db[_0x2f09('0x156')],{'as':_0x2f09('0x156'),'foreignKey':_0x2f09('0x157')});db[_0x2f09('0xe6')][_0x2f09('0x124')](db['SquareProject'],{'as':_0x2f09('0xde'),'foreignKey':_0x2f09('0x1dd')});db['Campaign'][_0x2f09('0x125')](db[_0x2f09('0xf6')],{'as':'Lists','through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0x2f09('0xf6')],{'as':_0x2f09('0x15c'),'through':_0x2f09('0x1de')});db[_0x2f09('0xea')][_0x2f09('0x124')](db[_0x2f09('0x177')],{'as':'ChatOfflineMessage','foreignKey':_0x2f09('0x1df')});db[_0x2f09('0xee')][_0x2f09('0x124')](db[_0x2f09('0x16a')],{});db[_0x2f09('0xee')][_0x2f09('0x124')](db[_0x2f09('0x44')],{});db[_0x2f09('0xee')][_0x2f09('0x124')](db[_0x2f09('0x3f')],{'foreignKey':'FromMailAccountId','as':_0x2f09('0x1e0')});db[_0x2f09('0xee')]['belongsTo'](db[_0x2f09('0x12')],{'foreignKey':_0x2f09('0x1e1'),'as':_0x2f09('0x1e2')});db[_0x2f09('0xee')][_0x2f09('0x124')](db['User'],{'foreignKey':_0x2f09('0x1e3'),'as':_0x2f09('0x1e4')});db[_0x2f09('0xee')][_0x2f09('0x124')](db[_0x2f09('0x40')],{'foreignKey':_0x2f09('0x1e5'),'as':_0x2f09('0x1e6')});db['MailTransferReport'][_0x2f09('0x124')](db[_0x2f09('0x3f')],{'foreignKey':_0x2f09('0x1e7'),'as':_0x2f09('0x1e8')});db[_0x2f09('0xef')][_0x2f09('0x124')](db[_0x2f09('0x6b')],{});db[_0x2f09('0xef')]['belongsTo'](db[_0x2f09('0x69')],{});db[_0x2f09('0xef')][_0x2f09('0x124')](db[_0x2f09('0x63')],{'foreignKey':_0x2f09('0x1e9'),'as':'FromAccount'});db[_0x2f09('0xef')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'foreignKey':'FromUserId','as':_0x2f09('0x1e2')});db[_0x2f09('0xef')][_0x2f09('0x124')](db['User'],{'foreignKey':_0x2f09('0x1e3'),'as':_0x2f09('0x1e4')});db['ChatTransferReport'][_0x2f09('0x124')](db[_0x2f09('0x134')],{'foreignKey':_0x2f09('0x1ea'),'as':'ToQueue'});db['ChatTransferReport'][_0x2f09('0x124')](db[_0x2f09('0x63')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x2f09('0xf0')][_0x2f09('0x124')](db[_0x2f09('0x52')],{});db[_0x2f09('0xf0')][_0x2f09('0x124')](db[_0x2f09('0x50')],{});db[_0x2f09('0xf0')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x2f09('0x1eb'),'as':_0x2f09('0x1e0')});db['FaxTransferReport'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'foreignKey':_0x2f09('0x1e1'),'as':'FromAgent'});db[_0x2f09('0xf0')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'foreignKey':_0x2f09('0x1e3'),'as':_0x2f09('0x1e4')});db[_0x2f09('0xf0')][_0x2f09('0x124')](db['FaxQueue'],{'foreignKey':_0x2f09('0x1ec'),'as':_0x2f09('0x1e6')});db[_0x2f09('0xf0')][_0x2f09('0x124')](db['FaxAccount'],{'foreignKey':_0x2f09('0x1ed'),'as':_0x2f09('0x1e8')});db[_0x2f09('0xf2')][_0x2f09('0x124')](db[_0x2f09('0x61')],{});db[_0x2f09('0xf2')][_0x2f09('0x124')](db[_0x2f09('0x5f')],{});db[_0x2f09('0xf2')][_0x2f09('0x124')](db[_0x2f09('0x143')],{'foreignKey':_0x2f09('0x1ee'),'as':_0x2f09('0x1e0')});db[_0x2f09('0xf2')]['belongsTo'](db[_0x2f09('0x12')],{'foreignKey':_0x2f09('0x1e1'),'as':_0x2f09('0x1e2')});db[_0x2f09('0xf2')]['belongsTo'](db[_0x2f09('0x12')],{'foreignKey':_0x2f09('0x1e3'),'as':_0x2f09('0x1e4')});db[_0x2f09('0xf2')][_0x2f09('0x124')](db[_0x2f09('0x18d')],{'foreignKey':_0x2f09('0x1ef'),'as':'ToQueue'});db[_0x2f09('0xf2')]['belongsTo'](db[_0x2f09('0x143')],{'foreignKey':_0x2f09('0x1f0'),'as':_0x2f09('0x1e8')});db[_0x2f09('0xf4')]['belongsTo'](db[_0x2f09('0x5a')],{});db[_0x2f09('0xf4')]['belongsTo'](db[_0x2f09('0x59')],{});db[_0x2f09('0xf4')]['belongsTo'](db[_0x2f09('0x55')],{'foreignKey':_0x2f09('0x1f1'),'as':_0x2f09('0x1e0')});db[_0x2f09('0xf4')]['belongsTo'](db[_0x2f09('0x12')],{'foreignKey':_0x2f09('0x1e1'),'as':_0x2f09('0x1e2')});db[_0x2f09('0xf4')][_0x2f09('0x124')](db['User'],{'foreignKey':'ToUserId','as':_0x2f09('0x1e4')});db[_0x2f09('0xf4')][_0x2f09('0x124')](db[_0x2f09('0x138')],{'foreignKey':_0x2f09('0x1f2'),'as':_0x2f09('0x1e6')});db['SmsTransferReport'][_0x2f09('0x124')](db['SmsAccount'],{'foreignKey':_0x2f09('0x1f3'),'as':_0x2f09('0x1e8')});db['CmList'][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':_0x2f09('0x169'),'foreignKey':'ListId','onDelete':_0x2f09('0x113')});db[_0x2f09('0xf6')]['hasMany'](db['CmCustomField'],{'as':_0x2f09('0x1f4'),'foreignKey':'ListId'});db[_0x2f09('0xf6')][_0x2f09('0x116')](db[_0x2f09('0x71')],{'as':'Contacts','onDelete':_0x2f09('0x113'),'foreignKey':'ListId'});db['CmList'][_0x2f09('0x116')](db[_0x2f09('0x14f')],{'as':_0x2f09('0x11a'),'foreignKey':_0x2f09('0x16d')});db[_0x2f09('0xf6')][_0x2f09('0x116')](db[_0x2f09('0x76')],{'as':_0x2f09('0x1f5'),'foreignKey':_0x2f09('0x16d')});db['CmList'][_0x2f09('0x116')](db[_0x2f09('0x11b')],{'as':_0x2f09('0x11b'),'foreignKey':_0x2f09('0x16d')});db['CmList']['belongsToMany'](db[_0x2f09('0x1c')],{'as':_0x2f09('0x1f6'),'through':_0x2f09('0x1f7')});db[_0x2f09('0xf6')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':'cm_user_has_lists'});db[_0x2f09('0xf7')][_0x2f09('0x116')](db[_0x2f09('0x149')],{'as':_0x2f09('0x119'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0xf7')][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':'Agents','through':'UserVoicePrefix'});db[_0x2f09('0xf7')][_0x2f09('0x125')](db[_0x2f09('0xe2')],{'through':'TeamVoicePrefix','as':_0x2f09('0x15b')});db['UserProfile']['hasMany'](db[_0x2f09('0x12')],{'as':_0x2f09('0x174'),'foreignKey':_0x2f09('0x1f8')});db[_0x2f09('0xf9')]['hasMany'](db[_0x2f09('0xfb')],{'as':_0x2f09('0x1f9'),'foreignKey':_0x2f09('0x1f8'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0xfb')][_0x2f09('0x116')](db[_0x2f09('0xfd')],{'as':_0x2f09('0x1fa'),'foreignKey':_0x2f09('0x1fb'),'onDelete':_0x2f09('0x113')});db[_0x2f09('0x100')][_0x2f09('0x116')](db[_0x2f09('0x168')],{'as':_0x2f09('0x169'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x2f09('0x100')][_0x2f09('0x116')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x2f09('0x1fc')});db[_0x2f09('0x100')][_0x2f09('0x116')](db[_0x2f09('0x104')],{'as':'Messages','foreignKey':_0x2f09('0x1fc')});db[_0x2f09('0x100')][_0x2f09('0x116')](db[_0x2f09('0x11f')],{'as':'Interactions'});db['WhatsappAccount'][_0x2f09('0x116')](db[_0x2f09('0x101')],{'as':_0x2f09('0x17d')});db[_0x2f09('0x100')][_0x2f09('0x124')](db['CmList'],{'as':'List','foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x100')][_0x2f09('0x124')](db[_0x2f09('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x2f09('0x159')});db[_0x2f09('0x100')]['belongsToMany'](db['User'],{'as':_0x2f09('0x15a'),'through':_0x2f09('0x1fd')});db[_0x2f09('0x101')]['belongsTo'](db['User'],{'onDelete':_0x2f09('0x178')});db[_0x2f09('0x101')][_0x2f09('0x124')](db['WhatsappQueue'],{'onDelete':_0x2f09('0x178')});db[_0x2f09('0x101')]['belongsTo'](db[_0x2f09('0x100')],{'onDelete':_0x2f09('0x178')});db[_0x2f09('0x101')][_0x2f09('0x124')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x2f09('0x157')});db[_0x2f09('0x101')][_0x2f09('0x124')](db[_0x2f09('0x8d')],{'onDelete':_0x2f09('0x178'),'foreignKey':'TagId'});db[_0x2f09('0x11f')][_0x2f09('0x116')](db['WhatsappMessage'],{'as':_0x2f09('0x16b'),'onDelete':_0x2f09('0x113'),'foreignKey':'WhatsappInteractionId'});db[_0x2f09('0x11f')][_0x2f09('0x124')](db[_0x2f09('0x100')],{'as':_0x2f09('0x176'),'foreignKey':_0x2f09('0x1fc')});db['WhatsappInteraction'][_0x2f09('0x124')](db[_0x2f09('0x71')],{'as':_0x2f09('0x162'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':'Owner','foreignKey':_0x2f09('0x114')});db['WhatsappInteraction'][_0x2f09('0x125')](db['Tag'],{'through':_0x2f09('0x1b4'),'as':_0x2f09('0x172')});db[_0x2f09('0x11f')][_0x2f09('0x125')](db[_0x2f09('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x2f09('0x173')});db[_0x2f09('0x11f')][_0x2f09('0x125')](db['User'],{'as':_0x2f09('0x174'),'through':_0x2f09('0x1fe'),'foreignKey':_0x2f09('0x1ff')});db[_0x2f09('0x104')][_0x2f09('0x124')](db['User'],{'as':'User'});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x2f09('0x113'),'as':'Contact'});db[_0x2f09('0x104')][_0x2f09('0x124')](db[_0x2f09('0x11f')],{'onDelete':_0x2f09('0x113'),'as':_0x2f09('0x182'),'foreignKey':_0x2f09('0x1ff')});db[_0x2f09('0x104')][_0x2f09('0x124')](db[_0x2f09('0x100')],{'as':'Account','foreignKey':_0x2f09('0x1fc')});db['WhatsappQueueReport'][_0x2f09('0x124')](db[_0x2f09('0x100')],{});db[_0x2f09('0x106')][_0x2f09('0x124')](db[_0x2f09('0xf6')],{'as':_0x2f09('0x16c'),'foreignKey':_0x2f09('0x16d')});db[_0x2f09('0x106')]['belongsTo'](db['CmContact'],{'as':_0x2f09('0x162'),'foreignKey':_0x2f09('0x163')});db[_0x2f09('0x106')][_0x2f09('0x124')](db[_0x2f09('0x11f')],{});db[_0x2f09('0x106')][_0x2f09('0x124')](db[_0x2f09('0x109')],{});db[_0x2f09('0x106')]['belongsTo'](db[_0x2f09('0x104')],{});db['WhatsappQueueReport'][_0x2f09('0x124')](db['User'],{});db[_0x2f09('0x107')][_0x2f09('0x124')](db[_0x2f09('0x104')],{});db[_0x2f09('0x107')][_0x2f09('0x124')](db[_0x2f09('0x11f')],{});db[_0x2f09('0x107')][_0x2f09('0x124')](db['WhatsappAccount'],{'foreignKey':_0x2f09('0x200'),'as':_0x2f09('0x1e0')});db[_0x2f09('0x107')]['belongsTo'](db[_0x2f09('0x100')],{'foreignKey':_0x2f09('0x201'),'as':_0x2f09('0x1e8')});db[_0x2f09('0x107')][_0x2f09('0x124')](db[_0x2f09('0x109')],{'foreignKey':_0x2f09('0x202'),'as':_0x2f09('0x1e6')});db['WhatsappTransferReport'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'foreignKey':_0x2f09('0x1e1'),'as':'FromAgent'});db[_0x2f09('0x107')][_0x2f09('0x124')](db[_0x2f09('0x12')],{'foreignKey':'ToUserId','as':_0x2f09('0x1e4')});db['WhatsappQueue'][_0x2f09('0x125')](db[_0x2f09('0x12')],{'as':_0x2f09('0x15a'),'through':_0x2f09('0x203'),'foreignKey':_0x2f09('0x204')});db['WhatsappQueue'][_0x2f09('0x125')](db[_0x2f09('0xe2')],{'through':_0x2f09('0x1dc'),'as':_0x2f09('0x15b')});db['UserSetting'][_0x2f09('0x124')](db[_0x2f09('0x12')],{'as':'user','foreignKey':'UserId','onDelete':_0x2f09('0x113'),'hooks':!![]});db['CloudProvider'][_0x2f09('0x112')](db[_0x2f09('0x1d3')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0x2f09('0x165')][_0x2f09('0x112')](db[_0x2f09('0x3b')],{'as':_0x2f09('0x167'),'onDelete':_0x2f09('0x178')});db[_0x2f09('0x165')][_0x2f09('0x112')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x2f09('0x178')});module[_0x2f09('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c09362f..11ac2cc 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c77=['/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/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/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/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/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport'];(function(_0x15c9b2,_0x578a26){var _0x1d15fb=function(_0x308fa8){while(--_0x308fa8){_0x15c9b2['push'](_0x15c9b2['shift']());}};_0x1d15fb(++_0x578a26);}(_0x8c77,0xf9));var _0x78c7=function(_0x4266ae,_0x852bc2){_0x4266ae=_0x4266ae-0x0;var _0x1fcacf=_0x8c77[_0x4266ae];return _0x1fcacf;};'use strict';var path=require(_0x78c7('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x78c7('0x1'))[_0x78c7('0x2')];var clientSideLogs=require(_0x78c7('0x3'));exports['default']=function(_0xed4b18){return setupLoggers(_0xed4b18)[_0x78c7('0x4')](function(){_0xed4b18[_0x78c7('0x5')](_0x78c7('0x6'),require(_0x78c7('0x7')));_0xed4b18[_0x78c7('0x5')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0xed4b18[_0x78c7('0x5')]('/api/voice/contexts',require(_0x78c7('0x8')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x9'),require(_0x78c7('0xa')));_0xed4b18['use'](_0x78c7('0xb'),require('./api/voiceMusicOnHold'));_0xed4b18[_0x78c7('0x5')]('/api/voice/queues',require(_0x78c7('0xc')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xd'),require(_0x78c7('0xe')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xf'),require('./api/screenRecording'));_0xed4b18[_0x78c7('0x5')]('/api/voice/mails',require(_0x78c7('0x10')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x11'),require(_0x78c7('0x12')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x13'),require('./api/voiceCallReport'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x14'),require(_0x78c7('0x15')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x16'),require(_0x78c7('0x17')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x18'),require(_0x78c7('0x19')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x1a'),require(_0x78c7('0x1b')));_0xed4b18[_0x78c7('0x5')]('/api/trunks',require('./api/trunk'));_0xed4b18['use'](_0x78c7('0x1c'),require(_0x78c7('0x1d')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x1e'),require(_0x78c7('0x1f')));_0xed4b18['use'](_0x78c7('0x20'),require('./api/mailAccount'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x21'),require(_0x78c7('0x22')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x23'),require('./api/mailSubstatus'));_0xed4b18['use'](_0x78c7('0x24'),require(_0x78c7('0x25')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x26'),require(_0x78c7('0x27')));_0xed4b18['use'](_0x78c7('0x28'),require(_0x78c7('0x29')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x2a'),require('./api/mailQueueReport'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x2b'),require('./api/dashboard'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x2c'),require('./api/dashboardItem'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x2d'),require(_0x78c7('0x2e')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x2f'),require(_0x78c7('0x30')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x31'),require(_0x78c7('0x32')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x33'),require('./api/faxMessage'));_0xed4b18['use']('/api/fax/queues',require('./api/faxQueue'));_0xed4b18['use']('/api/fax/reports/queue',require(_0x78c7('0x34')));_0xed4b18[_0x78c7('0x5')]('/api/sms/accounts',require(_0x78c7('0x35')));_0xed4b18[_0x78c7('0x5')]('/api/sms/applications',require(_0x78c7('0x36')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x37'),require(_0x78c7('0x38')));_0xed4b18[_0x78c7('0x5')]('/api/sms/messages',require('./api/smsMessage'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x39'),require('./api/smsQueue'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x3a'),require(_0x78c7('0x3b')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x3c'),require(_0x78c7('0x3d')));_0xed4b18[_0x78c7('0x5')]('/api/openchannel/interactions',require(_0x78c7('0x3e')));_0xed4b18['use']('/api/openchannel/messages',require(_0x78c7('0x3f')));_0xed4b18[_0x78c7('0x5')]('/api/openchannel/queues',require(_0x78c7('0x40')));_0xed4b18['use']('/api/chat/websites',require(_0x78c7('0x41')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x42'),require(_0x78c7('0x43')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x44'),require(_0x78c7('0x45')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x46'),require('./api/chatInteraction'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x47'),require(_0x78c7('0x48')));_0xed4b18['use'](_0x78c7('0x49'),require('./api/chatOfflineMessage'));_0xed4b18[_0x78c7('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0xed4b18[_0x78c7('0x5')]('/api/chat/groups',require(_0x78c7('0x4a')));_0xed4b18['use'](_0x78c7('0x4b'),require('./api/chatProactiveAction'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x4c'),require(_0x78c7('0x4d')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x4e'),require(_0x78c7('0x4f')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x50'),require('./api/cmHopper'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x51'),require(_0x78c7('0x52')));_0xed4b18['use'](_0x78c7('0x53'),require(_0x78c7('0x54')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x55'),require(_0x78c7('0x56')));_0xed4b18[_0x78c7('0x5')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x57'),require('./api/action'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x58'),require(_0x78c7('0x59')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x5a'),require('./api/cannedAnswer'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x5b'),require(_0x78c7('0x5c')));_0xed4b18['use'](_0x78c7('0x5d'),require(_0x78c7('0x5e')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x5f'),require(_0x78c7('0x60')));_0xed4b18['use'](_0x78c7('0x61'),require(_0x78c7('0x62')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x63'),require(_0x78c7('0x64')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x65'),require(_0x78c7('0x66')));_0xed4b18['use'](_0x78c7('0x67'),require(_0x78c7('0x68')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x69'),require(_0x78c7('0x6a')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x6b'),require(_0x78c7('0x6c')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x6d'),require('./api/contactItemType'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x6e'),require(_0x78c7('0x6f')));_0xed4b18[_0x78c7('0x5')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x70'),require(_0x78c7('0x71')));_0xed4b18[_0x78c7('0x5')]('/api/triggers',require(_0x78c7('0x72')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x73'),require(_0x78c7('0x74')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x75'),require(_0x78c7('0x76')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x77'),require(_0x78c7('0x78')));_0xed4b18['use'](_0x78c7('0x79'),require(_0x78c7('0x7a')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x7b'),require('./api/analyticDefaultReport'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x7c'),require('./api/analyticExtractedReport'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x7d'),require(_0x78c7('0x7e')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x7f'),require('./api/analyticFieldReport'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x80'),require(_0x78c7('0x81')));_0xed4b18['use'](_0x78c7('0x82'),require('./api/intSalesforceAccount'));_0xed4b18['use'](_0x78c7('0x83'),require(_0x78c7('0x84')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x85'),require(_0x78c7('0x86')));_0xed4b18[_0x78c7('0x5')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x87'),require(_0x78c7('0x88')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x89'),require(_0x78c7('0x8a')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x8b'),require(_0x78c7('0x8c')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x8d'),require('./api/intDeskConfiguration'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x8e'),require(_0x78c7('0x8f')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x90'),require(_0x78c7('0x91')));_0xed4b18[_0x78c7('0x5')]('/api/integrations/zoho/configurations',require(_0x78c7('0x92')));_0xed4b18['use'](_0x78c7('0x93'),require(_0x78c7('0x94')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x95'),require('./api/intZendeskAccount'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x96'),require(_0x78c7('0x97')));_0xed4b18[_0x78c7('0x5')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x98'),require(_0x78c7('0x99')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x9a'),require(_0x78c7('0x9b')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x9c'),require(_0x78c7('0x9d')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x9e'),require(_0x78c7('0x9f')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xa0'),require(_0x78c7('0xa1')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xa2'),require(_0x78c7('0xa3')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xa4'),require(_0x78c7('0xa5')));_0xed4b18['use']('/api/integrations/servicenow/configurations',require(_0x78c7('0xa6')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xa7'),require(_0x78c7('0xa8')));_0xed4b18['use'](_0x78c7('0xa9'),require(_0x78c7('0xaa')));_0xed4b18['use'](_0x78c7('0xab'),require(_0x78c7('0xac')));_0xed4b18['use'](_0x78c7('0xad'),require('./api/intDynamics365Field'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xae'),require(_0x78c7('0xaf')));_0xed4b18[_0x78c7('0x5')]('/api/integrations/freshsales/configurations',require(_0x78c7('0xb0')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xb1'),require(_0x78c7('0xb2')));_0xed4b18['use'](_0x78c7('0xb3'),require(_0x78c7('0xb4')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xb5'),require(_0x78c7('0xb6')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xb7'),require('./api/chatInternalMessage'));_0xed4b18[_0x78c7('0x5')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xb8'),require(_0x78c7('0xb9')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xba'),require(_0x78c7('0xbb')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xbc'),require(_0x78c7('0xbd')));_0xed4b18[_0x78c7('0x5')]('/api/square/reports',require(_0x78c7('0xbe')));_0xed4b18['use'](_0x78c7('0xbf'),require(_0x78c7('0xc0')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xc1'),require(_0x78c7('0xc2')));_0xed4b18[_0x78c7('0x5')]('/api/settings',require(_0x78c7('0xc3')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xc4'),require(_0x78c7('0xc5')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xc6'),require(_0x78c7('0xc7')));_0xed4b18['use']('/api/square/recordings',require(_0x78c7('0xc8')));_0xed4b18[_0x78c7('0x5')]('/api/square/messages',require(_0x78c7('0xc9')));_0xed4b18[_0x78c7('0x5')]('/api/teams',require(_0x78c7('0xca')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xcb'),require(_0x78c7('0xcc')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xcd'),require(_0x78c7('0xce')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xcf'),require(_0x78c7('0xd0')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xd1'),require(_0x78c7('0xd2')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xd3'),require('./api/plugin'));_0xed4b18['use'](_0x78c7('0xd4'),require('./api/mailTransferReport'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xd5'),require(_0x78c7('0xd6')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xd7'),require(_0x78c7('0xd8')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xd9'),require('./api/openchannelTransferReport'));_0xed4b18['use'](_0x78c7('0xda'),require(_0x78c7('0xdb')));_0xed4b18['use'](_0x78c7('0xdc'),require('./api/cmList'));_0xed4b18['use']('/api/voice/prefixes',require(_0x78c7('0xdd')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xde'),require(_0x78c7('0xdf')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xe0'),require(_0x78c7('0xe1')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xe2'),require(_0x78c7('0xe3')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xe4'),require(_0x78c7('0xe5')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xe6'),require('./api/whatsappAccount'));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xe7'),require(_0x78c7('0xe8')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xe9'),require(_0x78c7('0xea')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xeb'),require(_0x78c7('0xec')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xed'),require('./api/whatsappQueueReport'));_0xed4b18['use'](_0x78c7('0xee'),require(_0x78c7('0xef')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xf0'),require(_0x78c7('0xf1')));_0xed4b18[_0x78c7('0x5')]('/api/cloudProviders',require(_0x78c7('0xf2')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xf3'),require(_0x78c7('0xf4')));_0xed4b18['use']('/api/user-settings',require('./api/user-setting'));_0xed4b18['use'](_0x78c7('0xf5'),require('./api/authLocal'));_0xed4b18['use'](_0x78c7('0xf6'),require(_0x78c7('0xf7')));_0xed4b18[_0x78c7('0x5')]('/api/auth/activedirectory',require(_0x78c7('0xf8')));_0xed4b18[_0x78c7('0x5')]('/api/jira',require(_0x78c7('0xf9')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xfa'),require(_0x78c7('0xfb')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xfc'),require(_0x78c7('0xfd')));_0xed4b18[_0x78c7('0x5')]('/api/system',require(_0x78c7('0xfe')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0xff'),require(_0x78c7('0x100')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x101'),require(_0x78c7('0x102')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x103'),clientSideLogs);_0xed4b18[_0x78c7('0x5')](_0x78c7('0x104'),express[_0x78c7('0x105')](path['join'](config[_0x78c7('0x106')],'/apidoc')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x107'),express[_0x78c7('0x105')](path[_0x78c7('0x108')](config[_0x78c7('0x106')],'/www')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x109'),express[_0x78c7('0x105')](path['join'](config[_0x78c7('0x106')],_0x78c7('0x109'))));_0xed4b18[_0x78c7('0x5')]('/snippet',express['static'](path['join'](config[_0x78c7('0x106')],'snippet','3.0.0')));_0xed4b18[_0x78c7('0x5')](_0x78c7('0x10a'),express[_0x78c7('0x105')](path['join'](config['root'],_0x78c7('0x10b'))));_0xed4b18[_0x78c7('0x10c')](_0x78c7('0x10d'))[_0x78c7('0x10e')](errors[0x194]);_0xed4b18[_0x78c7('0x10c')]('/*')[_0x78c7('0x10e')](function(_0x424eb8,_0x910e0e){_0x910e0e[_0x78c7('0x10f')](path[_0x78c7('0x110')](_0xed4b18[_0x78c7('0x10e')](_0x78c7('0x111'))+_0x78c7('0x112')));});return _0xed4b18;});}; \ No newline at end of file +var _0x4999=['./api/interval','./api/pause','/api/cdr','./api/cdr','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/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/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./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/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','/api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/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/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/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/cm/custom_fields','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals'];(function(_0xd6039b,_0x50c4c7){var _0x122001=function(_0x2dd3d8){while(--_0x2dd3d8){_0xd6039b['push'](_0xd6039b['shift']());}};_0x122001(++_0x50c4c7);}(_0x4999,0xae));var _0x9499=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0x4999[_0x4cefc3];return _0x1cc779;};'use strict';var path=require('path');var express=require(_0x9499('0x0'));var errors=require(_0x9499('0x1'));var config=require(_0x9499('0x2'));var setupLoggers=require(_0x9499('0x3'))[_0x9499('0x4')];var clientSideLogs=require(_0x9499('0x5'));exports[_0x9499('0x6')]=function(_0x364f4b){return setupLoggers(_0x364f4b)[_0x9499('0x7')](function(){_0x364f4b['use'](_0x9499('0x8'),require(_0x9499('0x9')));_0x364f4b[_0x9499('0xa')](_0x9499('0xb'),require(_0x9499('0xc')));_0x364f4b['use'](_0x9499('0xd'),require(_0x9499('0xe')));_0x364f4b[_0x9499('0xa')](_0x9499('0xf'),require('./api/voiceExtension'));_0x364f4b[_0x9499('0xa')]('/api/voice/mohs',require(_0x9499('0x10')));_0x364f4b[_0x9499('0xa')](_0x9499('0x11'),require(_0x9499('0x12')));_0x364f4b[_0x9499('0xa')](_0x9499('0x13'),require(_0x9499('0x14')));_0x364f4b[_0x9499('0xa')](_0x9499('0x15'),require('./api/screenRecording'));_0x364f4b['use']('/api/voice/mails',require('./api/voiceMail'));_0x364f4b[_0x9499('0xa')](_0x9499('0x16'),require(_0x9499('0x17')));_0x364f4b[_0x9499('0xa')]('/api/voice/calls/reports',require(_0x9499('0x18')));_0x364f4b[_0x9499('0xa')](_0x9499('0x19'),require(_0x9499('0x1a')));_0x364f4b[_0x9499('0xa')](_0x9499('0x1b'),require(_0x9499('0x1c')));_0x364f4b[_0x9499('0xa')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x364f4b['use']('/api/members/reports',require(_0x9499('0x1d')));_0x364f4b[_0x9499('0xa')](_0x9499('0x1e'),require('./api/trunk'));_0x364f4b[_0x9499('0xa')](_0x9499('0x1f'),require(_0x9499('0x20')));_0x364f4b[_0x9499('0xa')](_0x9499('0x21'),require(_0x9499('0x22')));_0x364f4b['use'](_0x9499('0x23'),require('./api/mailAccount'));_0x364f4b[_0x9499('0xa')](_0x9499('0x24'),require(_0x9499('0x25')));_0x364f4b[_0x9499('0xa')]('/api/mail/substatuses',require(_0x9499('0x26')));_0x364f4b['use']('/api/mail/interactions',require(_0x9499('0x27')));_0x364f4b[_0x9499('0xa')]('/api/mail/messages',require(_0x9499('0x28')));_0x364f4b['use'](_0x9499('0x29'),require(_0x9499('0x2a')));_0x364f4b[_0x9499('0xa')]('/api/mail/reports/queue',require(_0x9499('0x2b')));_0x364f4b[_0x9499('0xa')](_0x9499('0x2c'),require('./api/dashboard'));_0x364f4b[_0x9499('0xa')](_0x9499('0x2d'),require(_0x9499('0x2e')));_0x364f4b['use'](_0x9499('0x2f'),require(_0x9499('0x30')));_0x364f4b[_0x9499('0xa')]('/api/fax/applications',require('./api/faxApplication'));_0x364f4b['use'](_0x9499('0x31'),require(_0x9499('0x32')));_0x364f4b[_0x9499('0xa')](_0x9499('0x33'),require(_0x9499('0x34')));_0x364f4b[_0x9499('0xa')](_0x9499('0x35'),require(_0x9499('0x36')));_0x364f4b[_0x9499('0xa')](_0x9499('0x37'),require(_0x9499('0x38')));_0x364f4b[_0x9499('0xa')](_0x9499('0x39'),require(_0x9499('0x3a')));_0x364f4b['use'](_0x9499('0x3b'),require(_0x9499('0x3c')));_0x364f4b['use']('/api/sms/interactions',require(_0x9499('0x3d')));_0x364f4b['use'](_0x9499('0x3e'),require(_0x9499('0x3f')));_0x364f4b[_0x9499('0xa')](_0x9499('0x40'),require(_0x9499('0x41')));_0x364f4b[_0x9499('0xa')](_0x9499('0x42'),require(_0x9499('0x43')));_0x364f4b[_0x9499('0xa')]('/api/openchannel/applications',require(_0x9499('0x44')));_0x364f4b[_0x9499('0xa')]('/api/openchannel/interactions',require(_0x9499('0x45')));_0x364f4b['use']('/api/openchannel/messages',require(_0x9499('0x46')));_0x364f4b[_0x9499('0xa')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x364f4b[_0x9499('0xa')](_0x9499('0x47'),require(_0x9499('0x48')));_0x364f4b[_0x9499('0xa')](_0x9499('0x49'),require(_0x9499('0x4a')));_0x364f4b[_0x9499('0xa')](_0x9499('0x4b'),require('./api/chatApplication'));_0x364f4b[_0x9499('0xa')](_0x9499('0x4c'),require(_0x9499('0x4d')));_0x364f4b[_0x9499('0xa')](_0x9499('0x4e'),require(_0x9499('0x4f')));_0x364f4b['use']('/api/chat/offline_messages',require(_0x9499('0x50')));_0x364f4b['use']('/api/chat/queues',require(_0x9499('0x51')));_0x364f4b[_0x9499('0xa')](_0x9499('0x52'),require(_0x9499('0x53')));_0x364f4b[_0x9499('0xa')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x364f4b[_0x9499('0xa')](_0x9499('0x54'),require(_0x9499('0x55')));_0x364f4b['use'](_0x9499('0x56'),require('./api/cmContact'));_0x364f4b[_0x9499('0xa')](_0x9499('0x57'),require(_0x9499('0x58')));_0x364f4b[_0x9499('0xa')](_0x9499('0x59'),require(_0x9499('0x5a')));_0x364f4b[_0x9499('0xa')](_0x9499('0x5b'),require(_0x9499('0x5c')));_0x364f4b[_0x9499('0xa')](_0x9499('0x5d'),require('./api/cmHopperHistory'));_0x364f4b[_0x9499('0xa')](_0x9499('0x5e'),require(_0x9499('0x5f')));_0x364f4b['use']('/api/actions',require('./api/action'));_0x364f4b[_0x9499('0xa')](_0x9499('0x60'),require(_0x9499('0x61')));_0x364f4b['use'](_0x9499('0x62'),require(_0x9499('0x63')));_0x364f4b[_0x9499('0xa')](_0x9499('0x64'),require(_0x9499('0x65')));_0x364f4b[_0x9499('0xa')](_0x9499('0x66'),require(_0x9499('0x67')));_0x364f4b[_0x9499('0xa')](_0x9499('0x68'),require(_0x9499('0x69')));_0x364f4b[_0x9499('0xa')]('/api/pauses',require(_0x9499('0x6a')));_0x364f4b[_0x9499('0xa')](_0x9499('0x6b'),require(_0x9499('0x6c')));_0x364f4b[_0x9499('0xa')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x364f4b[_0x9499('0xa')](_0x9499('0x6d'),require(_0x9499('0x6e')));_0x364f4b['use'](_0x9499('0x6f'),require(_0x9499('0x70')));_0x364f4b['use'](_0x9499('0x71'),require(_0x9499('0x72')));_0x364f4b['use']('/api/contact_item_types',require(_0x9499('0x73')));_0x364f4b[_0x9499('0xa')](_0x9499('0x74'),require('./api/cmContactHasItem'));_0x364f4b[_0x9499('0xa')]('/api/cm_hopper_additional_phones',require(_0x9499('0x75')));_0x364f4b['use'](_0x9499('0x76'),require(_0x9499('0x77')));_0x364f4b[_0x9499('0xa')](_0x9499('0x78'),require('./api/trigger'));_0x364f4b[_0x9499('0xa')](_0x9499('0x79'),require(_0x9499('0x7a')));_0x364f4b[_0x9499('0xa')](_0x9499('0x7b'),require('./api/integration'));_0x364f4b[_0x9499('0xa')](_0x9499('0x7c'),require(_0x9499('0x7d')));_0x364f4b['use']('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x364f4b[_0x9499('0xa')]('/api/analytics/default_reports',require(_0x9499('0x7e')));_0x364f4b[_0x9499('0xa')](_0x9499('0x7f'),require('./api/analyticExtractedReport'));_0x364f4b[_0x9499('0xa')](_0x9499('0x80'),require(_0x9499('0x81')));_0x364f4b[_0x9499('0xa')](_0x9499('0x82'),require(_0x9499('0x83')));_0x364f4b[_0x9499('0xa')](_0x9499('0x84'),require(_0x9499('0x85')));_0x364f4b[_0x9499('0xa')](_0x9499('0x86'),require(_0x9499('0x87')));_0x364f4b[_0x9499('0xa')](_0x9499('0x88'),require(_0x9499('0x89')));_0x364f4b['use'](_0x9499('0x8a'),require(_0x9499('0x8b')));_0x364f4b[_0x9499('0xa')]('/api/integrations/sugarcrm/accounts',require(_0x9499('0x8c')));_0x364f4b[_0x9499('0xa')](_0x9499('0x8d'),require(_0x9499('0x8e')));_0x364f4b[_0x9499('0xa')](_0x9499('0x8f'),require(_0x9499('0x90')));_0x364f4b[_0x9499('0xa')](_0x9499('0x91'),require(_0x9499('0x92')));_0x364f4b['use'](_0x9499('0x93'),require(_0x9499('0x94')));_0x364f4b[_0x9499('0xa')](_0x9499('0x95'),require(_0x9499('0x96')));_0x364f4b[_0x9499('0xa')](_0x9499('0x97'),require('./api/intZohoAccount'));_0x364f4b[_0x9499('0xa')]('/api/integrations/zoho/configurations',require(_0x9499('0x98')));_0x364f4b[_0x9499('0xa')](_0x9499('0x99'),require(_0x9499('0x9a')));_0x364f4b[_0x9499('0xa')]('/api/integrations/zendesk/accounts',require(_0x9499('0x9b')));_0x364f4b[_0x9499('0xa')](_0x9499('0x9c'),require(_0x9499('0x9d')));_0x364f4b['use'](_0x9499('0x9e'),require(_0x9499('0x9f')));_0x364f4b[_0x9499('0xa')]('/api/integrations/freshdesk/accounts',require(_0x9499('0xa0')));_0x364f4b[_0x9499('0xa')](_0x9499('0xa1'),require(_0x9499('0xa2')));_0x364f4b['use'](_0x9499('0xa3'),require(_0x9499('0xa4')));_0x364f4b[_0x9499('0xa')](_0x9499('0xa5'),require(_0x9499('0xa6')));_0x364f4b[_0x9499('0xa')](_0x9499('0xa7'),require(_0x9499('0xa8')));_0x364f4b[_0x9499('0xa')](_0x9499('0xa9'),require(_0x9499('0xaa')));_0x364f4b[_0x9499('0xa')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x364f4b[_0x9499('0xa')](_0x9499('0xab'),require(_0x9499('0xac')));_0x364f4b[_0x9499('0xa')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x364f4b[_0x9499('0xa')](_0x9499('0xad'),require(_0x9499('0xae')));_0x364f4b[_0x9499('0xa')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x364f4b['use'](_0x9499('0xaf'),require(_0x9499('0xb0')));_0x364f4b['use'](_0x9499('0xb1'),require(_0x9499('0xb2')));_0x364f4b[_0x9499('0xa')]('/api/integrations/freshsales/configurations',require(_0x9499('0xb3')));_0x364f4b['use'](_0x9499('0xb4'),require(_0x9499('0xb5')));_0x364f4b['use'](_0x9499('0xb6'),require(_0x9499('0xb7')));_0x364f4b['use'](_0x9499('0xb8'),require(_0x9499('0xb9')));_0x364f4b['use']('/api/chat/internal/messages',require(_0x9499('0xba')));_0x364f4b['use'](_0x9499('0xbb'),require(_0x9499('0xbc')));_0x364f4b[_0x9499('0xa')](_0x9499('0xbd'),require(_0x9499('0xbe')));_0x364f4b['use'](_0x9499('0xbf'),require('./api/jscriptySessionReport'));_0x364f4b[_0x9499('0xa')]('/api/sms/reports/queue',require(_0x9499('0xc0')));_0x364f4b[_0x9499('0xa')](_0x9499('0xc1'),require(_0x9499('0xc2')));_0x364f4b[_0x9499('0xa')](_0x9499('0xc3'),require(_0x9499('0xc4')));_0x364f4b[_0x9499('0xa')]('/api/jscripty/projects',require(_0x9499('0xc5')));_0x364f4b[_0x9499('0xa')]('/api/settings',require(_0x9499('0xc6')));_0x364f4b[_0x9499('0xa')](_0x9499('0xc7'),require(_0x9499('0xc8')));_0x364f4b[_0x9499('0xa')](_0x9499('0xc9'),require(_0x9499('0xca')));_0x364f4b[_0x9499('0xa')](_0x9499('0xcb'),require(_0x9499('0xcc')));_0x364f4b['use'](_0x9499('0xcd'),require('./api/squareMessage'));_0x364f4b[_0x9499('0xa')](_0x9499('0xce'),require(_0x9499('0xcf')));_0x364f4b[_0x9499('0xa')](_0x9499('0xd0'),require(_0x9499('0xd1')));_0x364f4b[_0x9499('0xa')](_0x9499('0xd2'),require('./api/campaign'));_0x364f4b[_0x9499('0xa')]('/api/migrations',require(_0x9499('0xd3')));_0x364f4b[_0x9499('0xa')](_0x9499('0xd4'),require(_0x9499('0xd5')));_0x364f4b[_0x9499('0xa')]('/api/plugins',require(_0x9499('0xd6')));_0x364f4b['use'](_0x9499('0xd7'),require(_0x9499('0xd8')));_0x364f4b['use'](_0x9499('0xd9'),require(_0x9499('0xda')));_0x364f4b[_0x9499('0xa')]('/api/fax/reports/transfer',require(_0x9499('0xdb')));_0x364f4b[_0x9499('0xa')](_0x9499('0xdc'),require(_0x9499('0xdd')));_0x364f4b[_0x9499('0xa')](_0x9499('0xde'),require(_0x9499('0xdf')));_0x364f4b['use'](_0x9499('0xe0'),require(_0x9499('0xe1')));_0x364f4b[_0x9499('0xa')](_0x9499('0xe2'),require(_0x9499('0xe3')));_0x364f4b[_0x9499('0xa')](_0x9499('0xe4'),require('./api/userProfile'));_0x364f4b[_0x9499('0xa')]('/api/userProfile/sections',require(_0x9499('0xe5')));_0x364f4b[_0x9499('0xa')]('/api/userProfile/resources',require(_0x9499('0xe6')));_0x364f4b[_0x9499('0xa')](_0x9499('0xe7'),require(_0x9499('0xe8')));_0x364f4b['use'](_0x9499('0xe9'),require(_0x9499('0xea')));_0x364f4b[_0x9499('0xa')](_0x9499('0xeb'),require(_0x9499('0xec')));_0x364f4b[_0x9499('0xa')](_0x9499('0xed'),require(_0x9499('0xee')));_0x364f4b[_0x9499('0xa')]('/api/whatsapp/messages',require(_0x9499('0xef')));_0x364f4b[_0x9499('0xa')](_0x9499('0xf0'),require(_0x9499('0xf1')));_0x364f4b['use'](_0x9499('0xf2'),require(_0x9499('0xf3')));_0x364f4b[_0x9499('0xa')](_0x9499('0xf4'),require(_0x9499('0xf5')));_0x364f4b[_0x9499('0xa')](_0x9499('0xf6'),require('./api/cloudProvider'));_0x364f4b[_0x9499('0xa')](_0x9499('0xf7'),require(_0x9499('0xf8')));_0x364f4b['use'](_0x9499('0xf9'),require(_0x9499('0xfa')));_0x364f4b[_0x9499('0xa')](_0x9499('0xfb'),require('./api/authLocal'));_0x364f4b[_0x9499('0xa')]('/api/auth/google',require('./api/authGoogle'));_0x364f4b[_0x9499('0xa')](_0x9499('0xfc'),require(_0x9499('0xfd')));_0x364f4b[_0x9499('0xa')](_0x9499('0xfe'),require('./api/jira'));_0x364f4b[_0x9499('0xa')](_0x9499('0xff'),require('./api/rpc'));_0x364f4b[_0x9499('0xa')]('/api/version',require('./api/version'));_0x364f4b[_0x9499('0xa')](_0x9499('0x100'),require('./api/system'));_0x364f4b[_0x9499('0xa')](_0x9499('0x101'),require('./api/pm2'));_0x364f4b['use'](_0x9499('0x102'),require(_0x9499('0x103')));_0x364f4b[_0x9499('0xa')](_0x9499('0x104'),clientSideLogs);_0x364f4b[_0x9499('0xa')](_0x9499('0x105'),express[_0x9499('0x106')](path['join'](config[_0x9499('0x107')],_0x9499('0x105'))));_0x364f4b[_0x9499('0xa')](_0x9499('0x108'),express[_0x9499('0x106')](path[_0x9499('0x109')](config[_0x9499('0x107')],_0x9499('0x108'))));_0x364f4b['use'](_0x9499('0x10a'),express[_0x9499('0x106')](path['join'](config['root'],_0x9499('0x10a'))));_0x364f4b[_0x9499('0xa')](_0x9499('0x10b'),express[_0x9499('0x106')](path['join'](config['root'],_0x9499('0x10c'),_0x9499('0x10d'))));_0x364f4b[_0x9499('0xa')](_0x9499('0x10e'),express[_0x9499('0x106')](path[_0x9499('0x109')](config['root'],_0x9499('0x10f'))));_0x364f4b[_0x9499('0x110')](_0x9499('0x111'))[_0x9499('0x112')](errors[0x194]);_0x364f4b[_0x9499('0x110')]('/*')['get'](function(_0x4a9cc4,_0x503418){_0x503418[_0x9499('0x113')](path[_0x9499('0x114')](_0x364f4b['get'](_0x9499('0x115'))+_0x9499('0x116')));});return _0x364f4b;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3e97c8c..936a8d8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bce=['../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.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/whatsappQueue/whatsappQueue.rpc','server','rpc','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','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/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc'];(function(_0x4df7a7,_0x3659a0){var _0x502edd=function(_0x24c88f){while(--_0x24c88f){_0x4df7a7['push'](_0x4df7a7['shift']());}};_0x502edd(++_0x3659a0);}(_0x9bce,0x125));var _0xe9bc=function(_0x18379a,_0x4558c9){_0x18379a=_0x18379a-0x0;var _0x533b9d=_0x9bce[_0x18379a];return _0x533b9d;};'use strict';var jayson=require(_0xe9bc('0x0'));var _=require(_0xe9bc('0x1'));var config=require(_0xe9bc('0x2'));exports['listen']=function(){return new Promise(function(_0xe61f42,_0x142aa3){var _0x2a404c={};_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x4')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x5')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x6')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x7')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x8')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x9')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0xa')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0xb')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/trunk/trunk.rpc'));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0xc')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0xd')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0xe')));_0x2a404c=_['merge'](_0x2a404c,require('../api/mailAccount/mailAccount.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0xf')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x10')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/mailMessage/mailMessage.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/mailApplication/mailApplication.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x11')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x12')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x13')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x14')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x15')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x16')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x17')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x18')));_0x2a404c=_['merge'](_0x2a404c,require('../api/smsInteraction/smsInteraction.rpc'));_0x2a404c=_['merge'](_0x2a404c,require('../api/smsMessage/smsMessage.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x19')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2a404c=_['merge'](_0x2a404c,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x1a')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x1b')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x1c')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x1d')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x1e')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/cmContact/cmContact.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x1f')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x20')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x21')));_0x2a404c=_['merge'](_0x2a404c,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x22')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x23')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/pause/pause.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x24')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x25')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x26')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x27')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x28')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x29')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x2a')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x2b')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x2c')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x2d')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x2e')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x2f')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x30')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x31')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x32')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x33')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x34')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/setting/setting.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/squareOdbc/squareOdbc.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x35')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x36')));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x37')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x38')));_0x2a404c=_['merge'](_0x2a404c,require('../api/attachment/attachment.rpc'));_0x2a404c=_['merge'](_0x2a404c,require('../api/plugin/plugin.rpc'));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x39')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require(_0xe9bc('0x3a')));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2a404c=_[_0xe9bc('0x3')](_0x2a404c,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2a404c=_['merge'](_0x2a404c,require(_0xe9bc('0x3b')));var _0x49f64c=jayson[_0xe9bc('0x3c')](_0x2a404c)['http']();var _0x9e04bb=config[_0xe9bc('0x3d')]['port']||config['port']+0x1;var _0x38e595=config[_0xe9bc('0x3d')]['ip']||_0xe9bc('0x3e');_0x49f64c['on']('error',function(_0x1c2d74){return _0x142aa3(_0x1c2d74);});_0x49f64c[_0xe9bc('0x3f')](_0x9e04bb,_0x38e595,function(){console[_0xe9bc('0x40')](_0xe9bc('0x41'),_0x38e595,_0x9e04bb);require(_0xe9bc('0x42'))['default']();return _0xe61f42(_0xe9bc('0x43')+_0x38e595+':'+_0x9e04bb);});});}; \ No newline at end of file +var _0x5c79=['../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc'];(function(_0x11dd5c,_0x5eb541){var _0x40fa8a=function(_0x4cf1ea){while(--_0x4cf1ea){_0x11dd5c['push'](_0x11dd5c['shift']());}};_0x40fa8a(++_0x5eb541);}(_0x5c79,0x18c));var _0x95c7=function(_0x1bfcfc,_0x140f5b){_0x1bfcfc=_0x1bfcfc-0x0;var _0x1041ff=_0x5c79[_0x1bfcfc];return _0x1041ff;};'use strict';var jayson=require('jayson/promise');var _=require(_0x95c7('0x0'));var config=require(_0x95c7('0x1'));exports[_0x95c7('0x2')]=function(){return new Promise(function(_0x5d5ee3,_0x3d1308){var _0x55ff60={};_0x55ff60=_['merge'](_0x55ff60,require('../api/user/user.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x4')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x5')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x6')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x7')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x8')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x9')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0xa')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0xb')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0xc')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0xd')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/mailServerIn/mailServerIn.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/mailAccount/mailAccount.rpc'));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0xe')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0xf')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/mailMessage/mailMessage.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x10')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x11')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/faxAccount/faxAccount.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/faxApplication/faxApplication.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x12')));_0x55ff60=_['merge'](_0x55ff60,require('../api/faxMessage/faxMessage.rpc'));_0x55ff60=_['merge'](_0x55ff60,require('../api/faxQueue/faxQueue.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x13')));_0x55ff60=_['merge'](_0x55ff60,require('../api/smsAccount/smsAccount.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x14')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x15')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x16')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x17')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x18')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x19')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x1a')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x1b')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x1c')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x1d')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x1e')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x1f')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x20')));_0x55ff60=_['merge'](_0x55ff60,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x21')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x22')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x23')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x24')));_0x55ff60=_['merge'](_0x55ff60,require('../api/sound/sound.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x25')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x26')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x27')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x28')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x29')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x2a')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x2b')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x2c')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x2d')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x2e')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x2f')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x30')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x31')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x32')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/setting/setting.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x33')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x34')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x35')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x36')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x37')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x38')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/plugin/plugin.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x39')));_0x55ff60=_['merge'](_0x55ff60,require(_0x95c7('0x3a')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x3b')));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x55ff60=_[_0x95c7('0x3')](_0x55ff60,require(_0x95c7('0x3c')));var _0x37bfff=jayson['server'](_0x55ff60)[_0x95c7('0x3d')]();var _0x8fbbbc=config[_0x95c7('0x3e')]['port']||config[_0x95c7('0x3f')]+0x1;var _0x51ad5d=config[_0x95c7('0x3e')]['ip']||_0x95c7('0x40');_0x37bfff['on'](_0x95c7('0x41'),function(_0x533f0b){return _0x3d1308(_0x533f0b);});_0x37bfff[_0x95c7('0x2')](_0x8fbbbc,_0x51ad5d,function(){console[_0x95c7('0x42')](_0x95c7('0x43'),_0x51ad5d,_0x8fbbbc);require(_0x95c7('0x44'))[_0x95c7('0x45')]();return _0x5d5ee3(_0x95c7('0x46')+_0x51ad5d+':'+_0x8fbbbc);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e3b8ea4..59c6b12 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 _0xe706=['startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','pipe','command','write','destroy','inherits','prototype','sendRequest','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr'];(function(_0x8a7802,_0x36c26c){var _0x159338=function(_0x486853){while(--_0x486853){_0x8a7802['push'](_0x8a7802['shift']());}};_0x159338(++_0x36c26c);}(_0xe706,0x1ab));var _0x6e70=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0xe706[_0x179b74];return _0x268f76;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require('events')[_0x6e70('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x6e70('0x3'));function AGIChannel(_0x1f2cd6){var _0x35e727=this,_0x5c9fb3=new AGIReply(),_0x26a1be=![],_0xdad23b={};EventEmitter[_0x6e70('0x4')](_0x35e727);_0x1f2cd6[_0x6e70('0x5')](_0x6e70('0x6'));_0x1f2cd6[_0x6e70('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5c9fb3[_0x6e70('0x5')](_0x6e70('0x6'));_0x5c9fb3['on'](_0x6e70('0x8'),function(_0x4a674f){for(var _0x4fafb2 in _0x4a674f){_0x35e727[_0x4fafb2]=_0x4a674f[_0x4fafb2];}_0x35e727[_0x6e70('0x9')](_0x6e70('0xa'));});_0x5c9fb3['on'](_0x6e70('0xb'),function(_0x68fdd3){if(_0x68fdd3[_0x6e70('0xc')]()=='hangup'){_0x35e727[_0x6e70('0x9')](_0x6e70('0xd'));return;}if(_0x68fdd3[_0x6e70('0xe')](0x0,0xb)=='520-Invalid'){_0x26a1be=!![];}if(_0x26a1be){_0xdad23b['rx']+=_0x68fdd3+'\x0a';if(_0x68fdd3[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x26a1be=![];}}else{_0xdad23b['rx']=_0x68fdd3;}if(_0x26a1be){return;}if(typeof _0xdad23b['cb']==_0x6e70('0x11')){var _0x4aff11=_0xdad23b['rx'][_0x6e70('0xe')](0x0,0x3),_0x34133e=null,_0x824c1e=null;_0x4aff11=parseInt(_0x4aff11);if(isNaN(_0x4aff11)){_0xdad23b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x12')});return;}if(_0x4aff11!=0xc8){_0xdad23b['cb'](null,{'code':_0x4aff11,'result':-0x1,'extra':'KO'});return;}_0x34133e=_0xdad23b['rx']['substring'](0x4)[_0x6e70('0x13')](_0x6e70('0x14'),'');if(_0x34133e[_0x6e70('0x15')]('\x20')!=-0x1){_0x34133e=_0x34133e[_0x6e70('0x16')](0x0,_0x34133e[_0x6e70('0x15')]('\x20'));}if(_[_0x6e70('0x17')](_0x34133e,'-1')){_0x34133e=parseInt(_0x34133e);}_0x824c1e=_0xdad23b['rx'][_0x6e70('0x18')]('\x20');if(_0x824c1e[_0x6e70('0x19')]==0x3){_0x824c1e=_0x824c1e[0x2][_0x6e70('0xe')](0x1,_0x824c1e[0x2][_0x6e70('0x19')]-0x1);}else if(_0x824c1e[_0x6e70('0x19')]>0x3){var _0x3cdfd5=/\((.+)\)/;var _0x35506a=_0xdad23b['rx']['match'](_0x3cdfd5);if(_0x35506a){_0x824c1e=_0x35506a[0x1];}else{_0x824c1e=null;}}else{_0x824c1e=null;}_0xdad23b['cb'](null,{'code':_0x4aff11,'result':_0x34133e,'extra':_0x824c1e});}});_0x1f2cd6['on']('error',function(_0x5a940f){_0x35e727[_0x6e70('0x9')](_0x6e70('0x1a'),new AGIError(_0x6e70('0x1b'),_0x5a940f['code']));});_0x1f2cd6['on'](_0x6e70('0x1c'),function(){_0x35e727[_0x6e70('0x9')](_0x6e70('0x1c'),new AGIError(_0x6e70('0x1d')));});_0x1f2cd6['on']('timeout',function(){_0x35e727['emit']('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1f2cd6['destroy']();});_0x1f2cd6[_0x6e70('0x1e')](_0x5c9fb3);this[_0x6e70('0x1f')]=function(_0x604071,_0x46dea3){var _0x604071=_0x604071||'',_0x46dea3=typeof _0x46dea3==_0x6e70('0x11')?_0x46dea3:new Function();_0xdad23b={'tx':_0x604071,'rx':'','cb':_0x46dea3};_0x1f2cd6[_0x6e70('0x20')](_0x604071+'\x0a');},this['close']=function(){_0x1f2cd6[_0x6e70('0x21')]();};}util[_0x6e70('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x6e70('0x23')][_0x6e70('0x24')]=function(_0x17e7cb){return this[_0x6e70('0x1f')][_0x6e70('0x25')](this,_0x17e7cb);};AGIChannel[_0x6e70('0x23')]['answer']=function(){return this[_0x6e70('0x24')](_0x6e70('0x26'));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x27')]=function(_0x1012aa,_0x378aca,_0x3d3ee9){_0x1012aa=_0x1012aa===undefined?'beep':_0x1012aa;_0x378aca=_0x378aca===undefined?'5':_0x378aca;_0x3d3ee9=_0x3d3ee9===undefined?'1':_0x3d3ee9;return this['sendRequest'](util['format'](_0x6e70('0x28'),_0x1012aa,_0x378aca*0x3e8,_0x3d3ee9));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x29')]=function(_0x3933a2){_0x3933a2=_0x3933a2||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x2c'),_0x3933a2));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x2d')]=function(_0x163dac,_0x1ab669){if(_[_0x6e70('0x2e')](_0x1ab669)){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x2f'),_0x163dac,_0x1ab669['join'](',')));}return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('EXEC\x20%s\x20%s',_0x163dac,_0x1ab669));};AGIChannel['prototype']['setContext']=function(_0x32836a){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('SET\x20CONTEXT\x20%s',_0x32836a));};AGIChannel['prototype'][_0x6e70('0x30')]=function(_0x20070d){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('SET\x20EXTENSION\x20%s',_0x20070d));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x31')]=function(_0x1614eb){return this['sendRequest'](util[_0x6e70('0x2b')](_0x6e70('0x32'),_0x1614eb));};AGIChannel[_0x6e70('0x23')][_0x6e70('0xd')]=function(){return this[_0x6e70('0x24')](_0x6e70('0x33'));};AGIChannel[_0x6e70('0x23')]['setVariable']=function(_0x49993e,_0x358ac5){var _0x405fca=_[_0x6e70('0x34')](_0x358ac5)||_[_0x6e70('0x35')](_0x358ac5)?_0x358ac5['toString']():_0x358ac5;return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x36'),_0x49993e,_0x405fca?_0x405fca[_0x6e70('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x580652,_0x3d8be4){return this['sendRequest'](util['format'](_0x6e70('0x38'),_0x580652,_0x3d8be4));};AGIChannel[_0x6e70('0x23')]['sayDigits']=function(_0x9527d3,_0x9ac887){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x39'),_0x9527d3,_0x9ac887));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x3a')]=function(_0x1d0df0,_0x524291){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1d0df0,_0x524291));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x3b')]=function(_0x6fbef6,_0x501c64,_0x4d303e){_0x501c64=_0x501c64||this[_0x6e70('0x3c')];_0x4d303e=_0x4d303e||0x1;this[_0x6e70('0x3d')](_0x6fbef6);this[_0x6e70('0x30')](_0x501c64);this[_0x6e70('0x31')](_0x4d303e);return this[_0x6e70('0x29')](util[_0x6e70('0x2b')](_0x6e70('0x3e'),_0x6fbef6,_0x501c64,_0x4d303e));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x3f')]=function(_0x19e6dd){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x40'),_0x19e6dd));};AGIChannel['prototype'][_0x6e70('0x41')]=function(_0x3f2a0c,_0xc1c48,_0x309f7c,_0x1f731f,_0x4c51c8,_0x5b6b7f){_0xc1c48=_0xc1c48||_0x6e70('0x42');_0x309f7c=_0x309f7c||'';_0x1f731f=_0x1f731f===undefined?-0x1:_0x1f731f==='-1'?-0x1:_0x1f731f*0x3e8;_0x4c51c8=_0x4c51c8===undefined?'':'s='+_0x4c51c8;_0x5b6b7f=_0x5b6b7f?_0x6e70('0x43'):'';return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3f2a0c,_0xc1c48,_0x309f7c,_0x1f731f,_0x5b6b7f,_0x4c51c8));};AGIChannel['prototype']['streamFile']=function(_0x3f9c17,_0x50339e){_0x50339e=_0x50339e||'';return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x44'),_0x3f9c17,_0x50339e));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x45')]=function(_0x2b4ab7){return this[_0x6e70('0x2d')](_0x6e70('0x46'),_0x2b4ab7);};AGIChannel['prototype'][_0x6e70('0x47')]=function(_0x503e9d){return this[_0x6e70('0x2d')](_0x6e70('0x48'),_0x503e9d);};AGIChannel[_0x6e70('0x23')][_0x6e70('0x1a')]=function(_0x325669,_0xc501ba){this['noop'](util[_0x6e70('0x2b')](_0x6e70('0x49'),_0x325669['id'],_0x325669[_0x6e70('0x4a')],_0xc501ba));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x83ed=['setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','wait','WAIT','label','exports','util','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s'];(function(_0x280e85,_0x4bfd61){var _0x503cc4=function(_0x5586d7){while(--_0x5586d7){_0x280e85['push'](_0x280e85['shift']());}};_0x503cc4(++_0x4bfd61);}(_0x83ed,0x66));var _0xd83e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x83ed[_0x47b58b];return _0x46bebe;};'use strict';var util=require(_0xd83e('0x0'));var _=require('lodash');var EventEmitter=require(_0xd83e('0x1'))[_0xd83e('0x2')];var AGIReply=require(_0xd83e('0x3'));var AGIError=require('./error');function AGIChannel(_0x234756){var _0x1d73ac=this,_0x1b9d22=new AGIReply(),_0x1e2576=![],_0x229726={};EventEmitter[_0xd83e('0x4')](_0x1d73ac);_0x234756[_0xd83e('0x5')](_0xd83e('0x6'));_0x234756[_0xd83e('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1b9d22['setEncoding'](_0xd83e('0x6'));_0x1b9d22['on'](_0xd83e('0x8'),function(_0x47d268){for(var _0x102e9c in _0x47d268){_0x1d73ac[_0x102e9c]=_0x47d268[_0x102e9c];}_0x1d73ac[_0xd83e('0x9')](_0xd83e('0xa'));});_0x1b9d22['on']('line',function(_0x43e440){if(_0x43e440['toLowerCase']()==_0xd83e('0xb')){_0x1d73ac['emit'](_0xd83e('0xb'));return;}if(_0x43e440[_0xd83e('0xc')](0x0,0xb)=='520-Invalid'){_0x1e2576=!![];}if(_0x1e2576){_0x229726['rx']+=_0x43e440+'\x0a';if(_0x43e440[_0xd83e('0xd')](_0xd83e('0xe'))!=-0x1){_0x1e2576=![];}}else{_0x229726['rx']=_0x43e440;}if(_0x1e2576){return;}if(typeof _0x229726['cb']==_0xd83e('0xf')){var _0x53ce8b=_0x229726['rx'][_0xd83e('0xc')](0x0,0x3),_0x2a2a88=null,_0x3ff12f=null;_0x53ce8b=parseInt(_0x53ce8b);if(isNaN(_0x53ce8b)){_0x229726['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd83e('0x10')});return;}if(_0x53ce8b!=0xc8){_0x229726['cb'](null,{'code':_0x53ce8b,'result':-0x1,'extra':'KO'});return;}_0x2a2a88=_0x229726['rx'][_0xd83e('0xc')](0x4)[_0xd83e('0x11')](_0xd83e('0x12'),'');if(_0x2a2a88[_0xd83e('0x13')]('\x20')!=-0x1){_0x2a2a88=_0x2a2a88[_0xd83e('0x14')](0x0,_0x2a2a88[_0xd83e('0x13')]('\x20'));}if(_[_0xd83e('0x15')](_0x2a2a88,'-1')){_0x2a2a88=parseInt(_0x2a2a88);}_0x3ff12f=_0x229726['rx'][_0xd83e('0x16')]('\x20');if(_0x3ff12f[_0xd83e('0x17')]==0x3){_0x3ff12f=_0x3ff12f[0x2]['substring'](0x1,_0x3ff12f[0x2]['length']-0x1);}else if(_0x3ff12f[_0xd83e('0x17')]>0x3){var _0x4bfb10=/\((.+)\)/;var _0x34dda3=_0x229726['rx']['match'](_0x4bfb10);if(_0x34dda3){_0x3ff12f=_0x34dda3[0x1];}else{_0x3ff12f=null;}}else{_0x3ff12f=null;}_0x229726['cb'](null,{'code':_0x53ce8b,'result':_0x2a2a88,'extra':_0x3ff12f});}});_0x234756['on'](_0xd83e('0x18'),function(_0x91b23f){_0x1d73ac['emit']('error',new AGIError(_0xd83e('0x19'),_0x91b23f[_0xd83e('0x1a')]));});_0x234756['on'](_0xd83e('0x1b'),function(){_0x1d73ac[_0xd83e('0x9')](_0xd83e('0x1b'),new AGIError(_0xd83e('0x1c')));});_0x234756['on'](_0xd83e('0x1d'),function(){_0x1d73ac[_0xd83e('0x9')](_0xd83e('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x234756[_0xd83e('0x1e')]();});_0x234756['pipe'](_0x1b9d22);this[_0xd83e('0x1f')]=function(_0x1acc1a,_0x58a9d5){var _0x1acc1a=_0x1acc1a||'',_0x58a9d5=typeof _0x58a9d5==_0xd83e('0xf')?_0x58a9d5:new Function();_0x229726={'tx':_0x1acc1a,'rx':'','cb':_0x58a9d5};_0x234756[_0xd83e('0x20')](_0x1acc1a+'\x0a');},this[_0xd83e('0x1b')]=function(){_0x234756[_0xd83e('0x1e')]();};}util[_0xd83e('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xd83e('0x22')]['sendRequest']=function(_0x490af0){return this['command']['sync'](this,_0x490af0);};AGIChannel[_0xd83e('0x22')][_0xd83e('0x23')]=function(){return this[_0xd83e('0x24')](_0xd83e('0x25'));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x26')]=function(_0x40c974,_0x1f95d9,_0xb213a2){_0x40c974=_0x40c974===undefined?_0xd83e('0x27'):_0x40c974;_0x1f95d9=_0x1f95d9===undefined?'5':_0x1f95d9;_0xb213a2=_0xb213a2===undefined?'1':_0xb213a2;return this[_0xd83e('0x24')](util[_0xd83e('0x28')](_0xd83e('0x29'),_0x40c974,_0x1f95d9*0x3e8,_0xb213a2));};AGIChannel['prototype'][_0xd83e('0x2a')]=function(_0x4189e2){_0x4189e2=_0x4189e2||_0xd83e('0x2b');return this[_0xd83e('0x24')](util['format'](_0xd83e('0x2c'),_0x4189e2));};AGIChannel['prototype']['exec']=function(_0x52a207,_0x2adafe){if(_[_0xd83e('0x2d')](_0x2adafe)){return this[_0xd83e('0x24')](util[_0xd83e('0x28')]('EXEC\x20%s\x20%s',_0x52a207,_0x2adafe['join'](',')));}return this[_0xd83e('0x24')](util[_0xd83e('0x28')](_0xd83e('0x2e'),_0x52a207,_0x2adafe));};AGIChannel[_0xd83e('0x22')]['setContext']=function(_0xb7efa9){return this[_0xd83e('0x24')](util[_0xd83e('0x28')](_0xd83e('0x2f'),_0xb7efa9));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x30')]=function(_0x2640cc){return this[_0xd83e('0x24')](util['format'](_0xd83e('0x31'),_0x2640cc));};AGIChannel['prototype'][_0xd83e('0x32')]=function(_0x5d814e){return this[_0xd83e('0x24')](util[_0xd83e('0x28')](_0xd83e('0x33'),_0x5d814e));};AGIChannel[_0xd83e('0x22')][_0xd83e('0xb')]=function(){return this[_0xd83e('0x24')](_0xd83e('0x34'));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x35')]=function(_0x291cb7,_0x590ec2){var _0x503beb=_[_0xd83e('0x36')](_0x590ec2)||_[_0xd83e('0x37')](_0x590ec2)?_0x590ec2[_0xd83e('0x38')]():_0x590ec2;return this[_0xd83e('0x24')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x291cb7,_0x503beb?_0x503beb['toString']()[_0xd83e('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd83e('0x22')]['sayNumber']=function(_0x394cab,_0x1e4dcf){return this[_0xd83e('0x24')](util[_0xd83e('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x394cab,_0x1e4dcf));};AGIChannel['prototype'][_0xd83e('0x39')]=function(_0x259888,_0x204ea0){return this[_0xd83e('0x24')](util[_0xd83e('0x28')](_0xd83e('0x3a'),_0x259888,_0x204ea0));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x3b')]=function(_0x4200a8,_0x127934){return this[_0xd83e('0x24')](util[_0xd83e('0x28')](_0xd83e('0x3c'),_0x4200a8,_0x127934));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x3d')]=function(_0x26355b,_0x5a1793,_0x2b4535){_0x5a1793=_0x5a1793||this['extension'];_0x2b4535=_0x2b4535||0x1;this[_0xd83e('0x3e')](_0x26355b);this[_0xd83e('0x30')](_0x5a1793);this['setPriority'](_0x2b4535);return this[_0xd83e('0x2a')](util[_0xd83e('0x28')](_0xd83e('0x3f'),_0x26355b,_0x5a1793,_0x2b4535));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x40')]=function(_0x12dd54){return this[_0xd83e('0x24')](util[_0xd83e('0x28')](_0xd83e('0x41'),_0x12dd54));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x42')]=function(_0x1b1dd8,_0x26d658,_0x2eddf3,_0x3a296d,_0x4ecdec,_0x47c9ae){_0x26d658=_0x26d658||_0xd83e('0x43');_0x2eddf3=_0x2eddf3||'';_0x3a296d=_0x3a296d===undefined?-0x1:_0x3a296d==='-1'?-0x1:_0x3a296d*0x3e8;_0x4ecdec=_0x4ecdec===undefined?'':'s='+_0x4ecdec;_0x47c9ae=_0x47c9ae?_0xd83e('0x44'):'';return this[_0xd83e('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1b1dd8,_0x26d658,_0x2eddf3,_0x3a296d,_0x47c9ae,_0x4ecdec));};AGIChannel[_0xd83e('0x22')][_0xd83e('0x45')]=function(_0x1a1789,_0x4b8e79){_0x4b8e79=_0x4b8e79||'';return this['sendRequest'](util[_0xd83e('0x28')](_0xd83e('0x46'),_0x1a1789,_0x4b8e79));};AGIChannel['prototype']['agi']=function(_0x31244a){return this[_0xd83e('0x47')]('AGI',_0x31244a);};AGIChannel['prototype'][_0xd83e('0x48')]=function(_0x42e8ac){return this[_0xd83e('0x47')](_0xd83e('0x49'),_0x42e8ac);};AGIChannel[_0xd83e('0x22')][_0xd83e('0x18')]=function(_0x1fc5aa,_0x46bf7c){this[_0xd83e('0x2a')](util[_0xd83e('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1fc5aa['id'],_0x1fc5aa[_0xd83e('0x4a')],_0x46bf7c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xd83e('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9fa9963..fc60f6d 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 _0x8e5a=['Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x8e5a,0x7c));var _0xa8e5=function(_0x19cb77,_0x15fe8c){_0x19cb77=_0x19cb77-0x0;var _0x1a18f7=_0x8e5a[_0x19cb77];return _0x1a18f7;};'use strict';var util=require(_0xa8e5('0x0'));var error={'E_AGI_UNDEFINED':_0xa8e5('0x1'),'E_AGI_ARGUMENT_PORT':_0xa8e5('0x2'),'E_AGI_SERVER_ERROR':_0xa8e5('0x3'),'E_AGI_SERVER_CLOSE':_0xa8e5('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa8e5('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa8e5('0x6'),'E_AGI_COMMAND_EMPTY':_0xa8e5('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa8e5('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2bec87){var _0x2bec87=_0x2bec87||null,_0x647aa8=_0x647aa8||[],_0x51c67c=0x1,_0x104dfa='';if(!error[_0x2bec87]){_0x2bec87=_0xa8e5('0x9');}_0x647aa8[_0xa8e5('0xa')](error[_0x2bec87]);while(arguments[_0x51c67c]){_0x647aa8[_0xa8e5('0xa')](arguments[_0x51c67c]);_0x51c67c++;}_0x104dfa=util[_0xa8e5('0xb')][_0xa8e5('0xc')](util,_0x647aa8);this[_0xa8e5('0xd')]=_0x104dfa;this[_0xa8e5('0xe')]=_0x2bec87;}module[_0xa8e5('0xf')]=AGIError; \ No newline at end of file +var _0xde7a=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x32b496,_0x5b9f92){var _0x405503=function(_0x309e5b){while(--_0x309e5b){_0x32b496['push'](_0x32b496['shift']());}};_0x405503(++_0x5b9f92);}(_0xde7a,0x7a));var _0xade7=function(_0x20f643,_0xa02b6a){_0x20f643=_0x20f643-0x0;var _0x1e98f4=_0xde7a[_0x20f643];return _0x1e98f4;};'use strict';var util=require(_0xade7('0x0'));var error={'E_AGI_UNDEFINED':_0xade7('0x1'),'E_AGI_ARGUMENT_PORT':_0xade7('0x2'),'E_AGI_SERVER_ERROR':_0xade7('0x3'),'E_AGI_SERVER_CLOSE':_0xade7('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xade7('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xade7('0x6'),'E_AGI_SOCKET_ERROR':_0xade7('0x7'),'E_AGI_SOCKET_CLOSE':_0xade7('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xade7('0x9'),'E_AGI_COMMAND_EMPTY':_0xade7('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xade7('0xb'),'E_AGI_IVR_ENTRY':_0xade7('0xc')};function AGIError(_0x1b30e2){var _0x1b30e2=_0x1b30e2||null,_0x4f094a=_0x4f094a||[],_0x145e6f=0x1,_0x30a521='';if(!error[_0x1b30e2]){_0x1b30e2=_0xade7('0xd');}_0x4f094a[_0xade7('0xe')](error[_0x1b30e2]);while(arguments[_0x145e6f]){_0x4f094a[_0xade7('0xe')](arguments[_0x145e6f]);_0x145e6f++;}_0x30a521=util[_0xade7('0xf')][_0xade7('0x10')](util,_0x4f094a);this['message']=_0x30a521;this[_0xade7('0x11')]=_0x1b30e2;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 08c87a0..3c9a77e 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 _0xc8d4=['lodash','events','EventEmitter','./error','../../config/environment','redis','defaults','subscribe','agi','emit','parse','projectUpdate','error','E_AGI_SERVER_ERROR','exports'];(function(_0x1daf2b,_0x4c389d){var _0x5ed025=function(_0x65a384){while(--_0x65a384){_0x1daf2b['push'](_0x1daf2b['shift']());}};_0x5ed025(++_0x4c389d);}(_0xc8d4,0x1e0));var _0x4c8d=function(_0x440f39,_0x361c65){_0x440f39=_0x440f39-0x0;var _0x865083=_0xc8d4[_0x440f39];return _0x865083;};'use strict';var _=require(_0x4c8d('0x0'));var EventEmitter=require(_0x4c8d('0x1'))[_0x4c8d('0x2')];var Redis=require('ioredis');var AGIError=require(_0x4c8d('0x3'));var config=require(_0x4c8d('0x4'));config[_0x4c8d('0x5')]=_[_0x4c8d('0x6')](config[_0x4c8d('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4c8d('0x5')]);sub[_0x4c8d('0x7')](_0x4c8d('0x8'),function(_0x5bd985){if(_0x5bd985)return eventEmitter[_0x4c8d('0x9')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5bd985));});sub['on']('message',function(_0x1e3eda,_0x560b0e){if(_0x1e3eda!==_0x4c8d('0x8'))return;try{var _0x53d9b4=JSON[_0x4c8d('0xa')](_0x560b0e);eventEmitter[_0x4c8d('0x9')](_0x4c8d('0xb'),_0x53d9b4);}catch(_0x5c1ee0){eventEmitter['emit'](_0x4c8d('0xc'),new AGIError(_0x4c8d('0xd'),_0x5c1ee0));}});module[_0x4c8d('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x63c4=['../../config/environment','defaults','redis','localhost','subscribe','agi','emit','error','parse','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','./error'];(function(_0x5527f6,_0x4d5724){var _0x20030a=function(_0x3840ff){while(--_0x3840ff){_0x5527f6['push'](_0x5527f6['shift']());}};_0x20030a(++_0x4d5724);}(_0x63c4,0x128));var _0x463c=function(_0x5f8c56,_0x346570){_0x5f8c56=_0x5f8c56-0x0;var _0x556df6=_0x63c4[_0x5f8c56];return _0x556df6;};'use strict';var _=require(_0x463c('0x0'));var EventEmitter=require(_0x463c('0x1'))[_0x463c('0x2')];var Redis=require('ioredis');var AGIError=require(_0x463c('0x3'));var config=require(_0x463c('0x4'));config['redis']=_[_0x463c('0x5')](config[_0x463c('0x6')],{'host':_0x463c('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x463c('0x8')](_0x463c('0x9'),function(_0x3528c3){if(_0x3528c3)return eventEmitter[_0x463c('0xa')](_0x463c('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x3528c3));});sub['on']('message',function(_0x2900f1,_0x298c8c){if(_0x2900f1!=='agi')return;try{var _0x3473ed=JSON[_0x463c('0xc')](_0x298c8c);eventEmitter['emit']('projectUpdate',_0x3473ed);}catch(_0x4fe534){eventEmitter['emit'](_0x463c('0xb'),new AGIError(_0x463c('0xd'),_0x4fe534));}});module[_0x463c('0xe')]={'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 a29cdbd..f24e4a0 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 _0xbee1=['edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices'];(function(_0x2b8565,_0x166230){var _0x5bde3d=function(_0x9a3428){while(--_0x9a3428){_0x2b8565['push'](_0x2b8565['shift']());}};_0x5bde3d(++_0x166230);}(_0xbee1,0xb3));var _0x1bee=function(_0x1f53d3,_0x1f5e95){_0x1f53d3=_0x1f53d3-0x0;var _0x4e837b=_0xbee1[_0x1f53d3];return _0x4e837b;};'use strict';var _=require(_0x1bee('0x0'));var logger=require(_0x1bee('0x1'))(_0x1bee('0x2'));var verticesWithRetry=[_0x1bee('0x3'),_0x1bee('0x4'),_0x1bee('0x5')];var Graph=function(){this[_0x1bee('0x6')]={};this[_0x1bee('0x7')]={};this[_0x1bee('0x8')]=0x0;};Graph[_0x1bee('0x9')][_0x1bee('0xa')]=function(_0x2a4d9b){this[_0x1bee('0x6')][_0x2a4d9b['id']]=_0x2a4d9b;this['edges'][_0x2a4d9b['id']]=[];};Graph[_0x1bee('0x9')]['addEdge']=function(_0x4fb6c3,_0x997008,_0x3bea69){this['edges'][_0x4fb6c3][_0x1bee('0xb')]({'target':_0x997008,'condition':_0x3bea69});this[_0x1bee('0x8')]+=0x1;};Graph['prototype'][_0x1bee('0xc')]=function(){return _[_0x1bee('0xc')](this[_0x1bee('0x6')]);};Graph[_0x1bee('0x9')][_0x1bee('0xd')]=function(){return this['numberOfEdges'];};Graph[_0x1bee('0x9')][_0x1bee('0xe')]=function(_0x2e2256){return this[_0x1bee('0x6')][_0x2e2256];};Graph[_0x1bee('0x9')][_0x1bee('0xf')]=function(_0x4cc431,_0x22f9ca){if(!this['vertices'][_0x4cc431]){return logger[_0x1bee('0x10')](_0x1bee('0x11'));}var _0x25f734=_0x22f9ca(this['vertices'][_0x4cc431]);if(!_0x25f734){return logger[_0x1bee('0x10')]('stop\x20traverse');}if(this[_0x1bee('0x7')][_0x4cc431][_0x1bee('0x12')]===0x0){return logger[_0x1bee('0x10')](_0x1bee('0x13'));}for(var _0x245e2b=0x0,_0x2f7eff=[],_0x457b18=![];_0x245e2b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','arg_1','evtHangup','createSquareReport','then','catch','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','handleNotFound','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','lodash','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','defaults','127.0.0.1','projectUpdate','nextTick','error','findIndex','deleted'];(function(_0x322296,_0x57eb19){var _0x432ea7=function(_0x4bd2b3){while(--_0x4bd2b3){_0x322296['push'](_0x322296['shift']());}};_0x432ea7(++_0x57eb19);}(_0x496f,0x114));var _0xf496=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x496f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf496('0x0'));var syncho=require(_0xf496('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0xf496('0x2'))(_0xf496('0x3'));var utilLicense=require(_0xf496('0x4'));var rpc=require(_0xf496('0x5'));var Project=require(_0xf496('0x6'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0xf496('0x3')]=_[_0xf496('0x7')](config[_0xf496('0x3')],{'ip':_0xf496('0x8'),'port':0x11dd});AGIEmitter['on'](_0xf496('0x9'),projectUpdateHandler);function connectionHandler(_0x401e8e){process[_0xf496('0xa')](function(){syncho(function(){try{setChannelVariables(_0x401e8e);agiHandler(_0x401e8e);}catch(_0x14d425){logger[_0xf496('0xb')](_0x14d425['stack']);}});});}function projectUpdateHandler(_0x1ac976){try{var _0x455250=_[_0xf496('0xc')](projects,['id',_0x1ac976['id']]);if(_0x455250>-0x1){if(_0x1ac976[_0xf496('0xd')]===!![]){projects[_0xf496('0xe')](_0x455250,0x1);}else{projects[_0x455250]=_0x1ac976;}}else{projects[_0xf496('0xf')](_0x1ac976);}}catch(_0x52e5c8){logger[_0xf496('0xb')](_0x52e5c8['stack']);}}function listeningHandler(){console['log'](_0xf496('0x10'),config[_0xf496('0x3')][_0xf496('0x11')]);logger[_0xf496('0x12')](util[_0xf496('0x13')](_0xf496('0x14'),config['agi']['ip'],config['agi'][_0xf496('0x11')]));}function errorHandler(_0x1b8f47){if(_0x1b8f47&&_0x1b8f47['name']&&_0x1b8f47[_0xf496('0x15')]){logger[_0xf496('0xb')](util[_0xf496('0x13')](_0xf496('0x16'),_0x1b8f47[_0xf496('0x17')],_0x1b8f47[_0xf496('0x15')]));}else{logger['error'](util[_0xf496('0x13')](_0xf496('0x18'),_0x1b8f47[_0xf496('0x19')]));}}function closeHandler(){logger[_0xf496('0x12')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xf496('0x1a')],this[_0xf496('0x1b')],this['dnid'],this[_0xf496('0x1c')]));try{createSquareReport(this);}catch(_0x341fe2){logger[_0xf496('0xb')](_0x341fe2[_0xf496('0x19')]);}}function timeoutHandler(){logger[_0xf496('0x12')](util[_0xf496('0x13')](_0xf496('0x1d'),this['arg_1'],this[_0xf496('0x1a')],this[_0xf496('0x1b')],this[_0xf496('0x1e')],this[_0xf496('0x1c')]));}function hangupHandler(){logger[_0xf496('0x12')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf496('0x1f')],this[_0xf496('0x1a')],this['callerid'],this['dnid'],this[_0xf496('0x1c')]));this[_0xf496('0x20')]=!![];}function createSquareReport(_0x2ca0b1,_0x35ec91){rpc[_0xf496('0x21')](_0x2ca0b1)[_0xf496('0x22')](function(_0x27c34a){if(_0x35ec91){_0x35ec91(null,_0x27c34a);}})[_0xf496('0x23')](function(_0x37595c){if(_0x35ec91){_0x35ec91(null,_0x37595c);}});}function setChannelVariables(_0x290f38){for(var _0x1de04d in _0x290f38){if(_0x290f38['hasOwnProperty'](_0x1de04d)){if(_0x1de04d[_0xf496('0x24')](_0xf496('0x25'))===0x0){_0x290f38[_0x1de04d[_0xf496('0x26')](0x4)]=_0x290f38[_0x1de04d];delete _0x290f38[_0x1de04d];}}}}function agiHandler(_0x2a8f3a){logger[_0xf496('0x27')](_0xf496('0x28'),JSON[_0xf496('0x29')](_0x2a8f3a,null,0x2));logger[_0xf496('0x12')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2a8f3a[_0xf496('0x1f')],_0x2a8f3a[_0xf496('0x1a')],_0x2a8f3a[_0xf496('0x1b')],_0x2a8f3a[_0xf496('0x1e')],_0x2a8f3a[_0xf496('0x1c')]));_0x2a8f3a['on'](_0xf496('0xb'),errorHandler);_0x2a8f3a['on'](_0xf496('0x2a'),closeHandler);_0x2a8f3a['on'](_0xf496('0x2b'),timeoutHandler);_0x2a8f3a[_0xf496('0x20')]=![];_0x2a8f3a['on'](_0xf496('0x2c'),hangupHandler);var _0x258e16=_['find'](projects,[_0xf496('0x17'),_0x2a8f3a['arg_1']]);if(!_0x258e16)return Project[_0xf496('0x2d')](_0x2a8f3a);if(!_0x258e16['production'])return Project[_0xf496('0x2e')](_0x2a8f3a);return Project[_0xf496('0x2f')](_0x258e16,_0x2a8f3a);}function main(){var _0x19f4f1;return utilLicense[_0xf496('0x30')]()[_0xf496('0x22')](function(_0x186400){if(!_0x186400)return;if(_0x186400[_0xf496('0x31')]){if(_0x186400[_0xf496('0x32')]&&_0x186400[_0xf496('0x32')]>0x0){logger[_0xf496('0x12')](util[_0xf496('0x13')](_0xf496('0x33'),_0x186400['callysquare']));_0x19f4f1=_0x186400[_0xf496('0x32')];}else{logger[_0xf496('0x12')](_0xf496('0x34'));}}else{logger['info'](_0xf496('0x35'));_0x19f4f1=-0x1;}})[_0xf496('0x22')](function(){return Project[_0xf496('0x36')]();})['then'](function(_0x186553){projects=_0x186553;return;})['catch'](function(_0x5e601e){logger[_0xf496('0xb')]('[LICENSE]',_0x5e601e[_0xf496('0x19')]);})[_0xf496('0x37')](function(){var _0x5c259c=require(_0xf496('0x38'))(config[_0xf496('0x3')][_0xf496('0x11')],config['agi']['ip'],_0x19f4f1);_0x5c259c['on']('error',errorHandler);_0x5c259c['on'](_0xf496('0x39'),listeningHandler);_0x5c259c['on']('connection',connectionHandler);_0x5c259c['on'](_0xf496('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0xb5db=['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','find','handleNotFound','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','catch','[LICENSE]','listening','connection','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','format','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','then','hasOwnProperty','indexOf','agi_','substring'];(function(_0x309162,_0x1b90d1){var _0x37e1c2=function(_0x4a3156){while(--_0x4a3156){_0x309162['push'](_0x309162['shift']());}};_0x37e1c2(++_0x1b90d1);}(_0xb5db,0x135));var _0xbb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb5d('0x0'));var syncho=require(_0xbb5d('0x1'));var util=require('util');var config=require(_0xbb5d('0x2'));var logger=require(_0xbb5d('0x3'))(_0xbb5d('0x4'));var utilLicense=require(_0xbb5d('0x5'));var rpc=require(_0xbb5d('0x6'));var Project=require(_0xbb5d('0x7'));var AGIEmitter=require(_0xbb5d('0x8'))['EventEmitter'];var projects=[];config['agi']=_[_0xbb5d('0x9')](config['agi'],{'ip':_0xbb5d('0xa'),'port':0x11dd});AGIEmitter['on'](_0xbb5d('0xb'),projectUpdateHandler);function connectionHandler(_0x2326b8){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2326b8);agiHandler(_0x2326b8);}catch(_0x4af02e){logger[_0xbb5d('0xc')](_0x4af02e[_0xbb5d('0xd')]);}});});}function projectUpdateHandler(_0x1d5700){try{var _0xe72d36=_[_0xbb5d('0xe')](projects,['id',_0x1d5700['id']]);if(_0xe72d36>-0x1){if(_0x1d5700[_0xbb5d('0xf')]===!![]){projects['splice'](_0xe72d36,0x1);}else{projects[_0xe72d36]=_0x1d5700;}}else{projects[_0xbb5d('0x10')](_0x1d5700);}}catch(_0x2ff59a){logger['error'](_0x2ff59a[_0xbb5d('0xd')]);}}function listeningHandler(){console[_0xbb5d('0x11')](_0xbb5d('0x12'),config[_0xbb5d('0x4')][_0xbb5d('0x13')]);logger[_0xbb5d('0x14')](util['format'](_0xbb5d('0x15'),config['agi']['ip'],config['agi'][_0xbb5d('0x13')]));}function errorHandler(_0x56d2d9){if(_0x56d2d9&&_0x56d2d9[_0xbb5d('0x16')]&&_0x56d2d9['message']){logger['error'](util['format'](_0xbb5d('0x17'),_0x56d2d9[_0xbb5d('0x16')],_0x56d2d9['message']));}else{logger[_0xbb5d('0xc')](util[_0xbb5d('0x18')]('[ERROR]\x20%s',_0x56d2d9[_0xbb5d('0xd')]));}}function closeHandler(){logger['info'](util[_0xbb5d('0x18')](_0xbb5d('0x19'),this[_0xbb5d('0x1a')],this['calleridname'],this[_0xbb5d('0x1b')],this[_0xbb5d('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x49cbce){logger[_0xbb5d('0xc')](_0x49cbce[_0xbb5d('0xd')]);}}function timeoutHandler(){logger[_0xbb5d('0x14')](util[_0xbb5d('0x18')](_0xbb5d('0x1d'),this[_0xbb5d('0x1a')],this['calleridname'],this[_0xbb5d('0x1b')],this['dnid'],this[_0xbb5d('0x1e')]));}function hangupHandler(){logger[_0xbb5d('0x14')](util['format'](_0xbb5d('0x1f'),this[_0xbb5d('0x1a')],this[_0xbb5d('0x20')],this['callerid'],this[_0xbb5d('0x1c')],this['uniqueid']));this[_0xbb5d('0x21')]=!![];}function createSquareReport(_0x1fbced,_0x573cbb){rpc['createSquareReport'](_0x1fbced)[_0xbb5d('0x22')](function(_0x436b39){if(_0x573cbb){_0x573cbb(null,_0x436b39);}})['catch'](function(_0x41642a){if(_0x573cbb){_0x573cbb(null,_0x41642a);}});}function setChannelVariables(_0x4bae45){for(var _0x381ace in _0x4bae45){if(_0x4bae45[_0xbb5d('0x23')](_0x381ace)){if(_0x381ace[_0xbb5d('0x24')](_0xbb5d('0x25'))===0x0){_0x4bae45[_0x381ace[_0xbb5d('0x26')](0x4)]=_0x4bae45[_0x381ace];delete _0x4bae45[_0x381ace];}}}}function agiHandler(_0x365b55){logger[_0xbb5d('0x27')](_0xbb5d('0x28'),JSON[_0xbb5d('0x29')](_0x365b55,null,0x2));logger[_0xbb5d('0x14')](util[_0xbb5d('0x18')](_0xbb5d('0x2a'),_0x365b55[_0xbb5d('0x1a')],_0x365b55['calleridname'],_0x365b55['callerid'],_0x365b55[_0xbb5d('0x1c')],_0x365b55['uniqueid']));_0x365b55['on'](_0xbb5d('0xc'),errorHandler);_0x365b55['on'](_0xbb5d('0x2b'),closeHandler);_0x365b55['on'](_0xbb5d('0x2c'),timeoutHandler);_0x365b55['evtHangup']=![];_0x365b55['on'](_0xbb5d('0x2d'),hangupHandler);var _0x11725b=_[_0xbb5d('0x2e')](projects,[_0xbb5d('0x16'),_0x365b55[_0xbb5d('0x1a')]]);if(!_0x11725b)return Project[_0xbb5d('0x2f')](_0x365b55);if(!_0x11725b['production'])return Project['handleUnpublished'](_0x365b55);return Project[_0xbb5d('0x30')](_0x11725b,_0x365b55);}function main(){var _0xfa1f14;return utilLicense[_0xbb5d('0x31')]()['then'](function(_0x5e9ef0){if(!_0x5e9ef0)return;if(_0x5e9ef0[_0xbb5d('0x32')]){if(_0x5e9ef0['callysquare']&&_0x5e9ef0[_0xbb5d('0x33')]>0x0){logger[_0xbb5d('0x14')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x5e9ef0[_0xbb5d('0x33')]));_0xfa1f14=_0x5e9ef0[_0xbb5d('0x33')];}else{logger[_0xbb5d('0x14')](_0xbb5d('0x34'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xfa1f14=-0x1;}})['then'](function(){return Project[_0xbb5d('0x35')]();})[_0xbb5d('0x22')](function(_0x398581){projects=_0x398581;return;})[_0xbb5d('0x36')](function(_0xddc200){logger[_0xbb5d('0xc')](_0xbb5d('0x37'),_0xddc200[_0xbb5d('0xd')]);})['finally'](function(){var _0x15c15e=require('./server')(config[_0xbb5d('0x4')][_0xbb5d('0x13')],config['agi']['ip'],_0xfa1f14);_0x15c15e['on'](_0xbb5d('0xc'),errorHandler);_0x15c15e['on'](_0xbb5d('0x38'),listeningHandler);_0x15c15e['on'](_0xbb5d('0x39'),connectionHandler);_0x15c15e['on']('close',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 6e2c383..adea333 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 _0x5fc5=['sendMailMessage','SendMail','jayson/promise','client','request','then','error','result'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5fc5,0x1aa));var _0x55fc=function(_0x4f6f8e,_0x195751){_0x4f6f8e=_0x4f6f8e-0x0;var _0x34da29=_0x5fc5[_0x4f6f8e];return _0x34da29;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x55fc('0x0'));var client=jayson[_0x55fc('0x1')]['http']({'port':0x232b});function request(_0x53c9b2,_0x444580){return new BPromise(function(_0x4d2221,_0x176381){return client[_0x55fc('0x2')](_0x53c9b2,_0x444580)[_0x55fc('0x3')](function(_0x265c3e){if(_0x265c3e[_0x55fc('0x4')]){return _0x176381(_0x265c3e['error']['message']);}else{return _0x4d2221(_0x265c3e[_0x55fc('0x5')]);}})['catch'](function(_0x379095){return _0x176381(_0x379095);});});}exports[_0x55fc('0x6')]=function(_0x19e802,_0x5035ea){return request(_0x55fc('0x7'),{'account':_0x19e802,'message':_0x5035ea});}; \ No newline at end of file +var _0x3d0a=['client','http','request','then','error','result','catch','SendMail','bluebird'];(function(_0xc2dccb,_0x5957f2){var _0x3239b3=function(_0x58f337){while(--_0x58f337){_0xc2dccb['push'](_0xc2dccb['shift']());}};_0x3239b3(++_0x5957f2);}(_0x3d0a,0xd7));var _0xa3d0=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x3d0a[_0x2b5eae];return _0x5f3ac9;};'use strict';var BPromise=require(_0xa3d0('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xa3d0('0x1')][_0xa3d0('0x2')]({'port':0x232b});function request(_0xafeab9,_0x144b66){return new BPromise(function(_0xc83eee,_0x494da1){return client[_0xa3d0('0x3')](_0xafeab9,_0x144b66)[_0xa3d0('0x4')](function(_0x413a2f){if(_0x413a2f['error']){return _0x494da1(_0x413a2f[_0xa3d0('0x5')]['message']);}else{return _0xc83eee(_0x413a2f[_0xa3d0('0x6')]);}})[_0xa3d0('0x7')](function(_0x26216c){return _0x494da1(_0x26216c);});});}exports['sendMailMessage']=function(_0x286143,_0x165bc0){return request(_0xa3d0('0x8'),{'account':_0x286143,'message':_0x165bc0});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 2c41630..8dcf6ac 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 _0x1b78=['xml2json','util','../../config/logger','./rpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','hasOwnProperty','isArray','length','target','addEdge','source','value','root','inspect','production','start','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','arg_1','callerid','dnid','traverseBFS','clear','debug','vertex','stringify','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1b78,0xae));var _0x81b7=function(_0x4578bc,_0x290b73){_0x4578bc=_0x4578bc-0x0;var _0x2f148a=_0x1b78[_0x4578bc];return _0x2f148a;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x81b7('0x0'));var util=require(_0x81b7('0x1'));var logger=require(_0x81b7('0x2'))('agi');var rpc=require(_0x81b7('0x3'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x81b7('0x4'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x81b7('0x5')]()[_0x81b7('0x6')](function(_0x14b20e){logger[_0x81b7('0x7')](_0x81b7('0x8'),_0x14b20e[_0x81b7('0x9')]);return[];});}function addVertex(_0x57207c,_0xdb5a0f,_0x4132ac){_0xdb5a0f[_0x81b7('0xa')]=_0x4132ac;if(_0xdb5a0f['hasOwnProperty'](_0x81b7('0xb'))){_0xdb5a0f['maxRetry']=parseInt(_0xdb5a0f[_0x81b7('0xb')],0xa);}_0x57207c[_0x81b7('0xc')](_['omit'](_0xdb5a0f,'mxCell'));}function initGraph(_0x5e8759,_0x583e08){var _0x3e8fa4=new Graph();for(var _0x14f77f in _0x5e8759){if(_0x5e8759[_0x81b7('0xd')](_0x14f77f)){if(_[_0x81b7('0xe')](_0x5e8759[_0x14f77f])){for(var _0x2e1ba0=0x0;_0x2e1ba0<_0x5e8759[_0x14f77f][_0x81b7('0xf')];_0x2e1ba0+=0x1){addVertex(_0x3e8fa4,_0x5e8759[_0x14f77f][_0x2e1ba0],_0x14f77f);}}else{addVertex(_0x3e8fa4,_0x5e8759[_0x14f77f],_0x14f77f);}}}for(var _0x537d6e=0x0;_0x537d6e<_0x583e08['length'];_0x537d6e+=0x1){if(_0x583e08[_0x537d6e]['source']&&_0x583e08[_0x537d6e][_0x81b7('0x10')]){_0x3e8fa4[_0x81b7('0x11')](_0x583e08[_0x537d6e][_0x81b7('0x12')],_0x583e08[_0x537d6e][_0x81b7('0x10')],_0x583e08[_0x537d6e][_0x81b7('0x13')]);}}return _0x3e8fa4;}function getRoot(_0x3320f1){return parser['toJson'](_0x3320f1,{'object':!![]})['mxGraphModel'][_0x81b7('0x14')];}function inspect(_0x180e4f){return util[_0x81b7('0x15')](_0x180e4f,{'showHidden':![],'depth':null});}function initialize(_0xd66dc0,_0x2de918){var _0x25fb92=getRoot(_0xd66dc0[_0x81b7('0x16')]);if(!_0x25fb92||!_0x25fb92[_0x81b7('0x17')])return;var _0x4d3b88,_0xd01a5c,_0xe62c8d;logger['debug'](_0x81b7('0x14'),JSON['stringify'](_0x25fb92,null,0x2));_0x2de918['joinAt']=moment()[_0x81b7('0x18')](_0x81b7('0x19'));_0x4d3b88=initGraph(_[_0x81b7('0x1a')](_0x25fb92,_0x81b7('0x1b')),_0x25fb92[_0x81b7('0x1b')]);_0xd01a5c=new Vertices(_0x2de918,rpc,mailRpc);logger['info'](util[_0x81b7('0x18')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2de918[_0x81b7('0x1c')],_0x2de918['calleridname'],_0x2de918[_0x81b7('0x1d')],_0x2de918[_0x81b7('0x1e')],_0x2de918['uniqueid']));_0x4d3b88[_0x81b7('0x1f')](_0x25fb92[_0x81b7('0x17')]['id'],function(_0x5c0ed3){try{_0x5c0ed3=_0xd01a5c[_0x81b7('0x20')](_0x5c0ed3);logger[_0x81b7('0x21')](_0x81b7('0x22'),JSON[_0x81b7('0x23')](_0x5c0ed3,null,0x2));if(_0x5c0ed3[_0x81b7('0xa')]===_0x81b7('0x24')){logger[_0x81b7('0x25')](_0x81b7('0x26'));_0x2de918[_0x81b7('0x27')]=_0x5c0ed3[_0x81b7('0x27')]||_0x2de918['context'];_0x2de918[_0x81b7('0x28')]=_0x5c0ed3[_0x81b7('0x28')];_0x2de918[_0x81b7('0x29')]=_0x5c0ed3['priority']?_0x5c0ed3['priority']-0x1:0x1;return null;}else if(_0x5c0ed3&&_0xd01a5c[_0x5c0ed3[_0x81b7('0xa')]]){_0xe62c8d=_0xd01a5c[_0x5c0ed3[_0x81b7('0xa')]](_0x5c0ed3);logger['info'](_0x81b7('0x2a'),JSON[_0x81b7('0x23')](_0xe62c8d,null,0x2));if(_0xe62c8d&&_0xe62c8d[_0x81b7('0x2b')]===AGI_CODE_SUCCESS&&_0xe62c8d[_0x81b7('0x2c')]!==AGI_RESULT_ERROR&&!_0x2de918[_0x81b7('0x2d')]){logger[_0x81b7('0x21')](_0x81b7('0x2a'),inspect(_0xe62c8d));return _[_0x81b7('0x2e')](_0xe62c8d['result'])?null:_0xe62c8d[_0x81b7('0x2c')]['toString']();}else{logger[_0x81b7('0x7')](_0x81b7('0x2a'),inspect(_0xe62c8d));return null;}}else{logger['error'](_0x81b7('0x2f'));return null;}}catch(_0x29bcf4){logger[_0x81b7('0x7')](_0x29bcf4[_0x81b7('0x9')]);return null;}});if(_0x25fb92[_0x81b7('0x30')]){logger[_0x81b7('0x25')](util['format'](_0x81b7('0x31'),_0x2de918['arg_1'],_0x2de918[_0x81b7('0x32')],_0x2de918['callerid'],_0x2de918['dnid'],_0x2de918[_0x81b7('0x33')]));_0x4d3b88[_0x81b7('0x1f')](_0x25fb92[_0x81b7('0x30')]['id'],function(_0x1900d2){try{_0x1900d2=_0xd01a5c['clear'](_0x1900d2);logger['debug'](_0x81b7('0x22'),JSON['stringify'](_0x1900d2,null,0x2));if(_0x1900d2&&_0xd01a5c[_0x1900d2['agicommand']]){_0xe62c8d=_0xd01a5c[_0x1900d2[_0x81b7('0xa')]](_0x1900d2);if(_0xe62c8d){logger[_0x81b7('0x21')](_0x81b7('0x2a'),inspect(_0xe62c8d));return _[_0x81b7('0x2e')](_0xe62c8d[_0x81b7('0x2c')])?null:_0xe62c8d[_0x81b7('0x2c')][_0x81b7('0x34')]();}else{logger['error'](_0x81b7('0x2a'),inspect(_0xe62c8d));return null;}}else{logger[_0x81b7('0x7')](_0x81b7('0x2f'));return null;}}catch(_0x2672f2){logger['error'](_0x2672f2[_0x81b7('0x9')]);return null;}});}logger[_0x81b7('0x25')](util[_0x81b7('0x18')](_0x81b7('0x35'),_0x2de918['arg_1'],_0x2de918['calleridname'],_0x2de918[_0x81b7('0x1d')],_0x2de918[_0x81b7('0x1e')],_0x2de918[_0x81b7('0x33')]));logger[_0x81b7('0x25')](util[_0x81b7('0x18')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2de918[_0x81b7('0x27')],_0x2de918[_0x81b7('0x28')],parseInt(_0x2de918['priority'],0xa)+0x1));_0x2de918[_0x81b7('0x36')](_0x2de918[_0x81b7('0x27')],_0x2de918['extension'],parseInt(_0x2de918['priority'],0xa)+0x1);_0x2de918['close']();}function handleNotFound(_0x51728f){logger['error'](util[_0x81b7('0x18')](_0x81b7('0x37'),_0x51728f['arg_1']));_0x51728f[_0x81b7('0x36')](_0x51728f[_0x81b7('0x27')],_0x51728f[_0x81b7('0x28')],parseInt(_0x51728f['priority'],0xa)+0x1);_0x51728f['close']();}function handleUnpublished(_0x2cb660){logger[_0x81b7('0x7')](util[_0x81b7('0x18')](_0x81b7('0x38'),_0x2cb660[_0x81b7('0x1c')]));_0x2cb660['continueAt'](_0x2cb660[_0x81b7('0x27')],_0x2cb660[_0x81b7('0x28')],parseInt(_0x2cb660['priority'],0xa)+0x1);_0x2cb660[_0x81b7('0x39')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xf0d9=['lodash','xml2json','util','../../config/logger','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','traverseBFS','clear','agicommand','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','response','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf0d9,0xf8));var _0x9f0d=function(_0x4d8f8e,_0x4e8c85){_0x4d8f8e=_0x4d8f8e-0x0;var _0x372805=_0xf0d9[_0x4d8f8e];return _0x372805;};'use strict';var _=require(_0x9f0d('0x0'));var moment=require('moment');var parser=require(_0x9f0d('0x1'));var util=require(_0x9f0d('0x2'));var logger=require(_0x9f0d('0x3'))('agi');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x9f0d('0x4'));var Vertices=require(_0x9f0d('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9f0d('0x6')]()[_0x9f0d('0x7')](function(_0x1a5223){logger[_0x9f0d('0x8')](_0x9f0d('0x9'),_0x1a5223['stack']);return[];});}function addVertex(_0x594b0f,_0xd974f9,_0x4ab1d8){_0xd974f9['agicommand']=_0x4ab1d8;if(_0xd974f9[_0x9f0d('0xa')](_0x9f0d('0xb'))){_0xd974f9[_0x9f0d('0xc')]=parseInt(_0xd974f9[_0x9f0d('0xb')],0xa);}_0x594b0f[_0x9f0d('0xd')](_[_0x9f0d('0xe')](_0xd974f9,_0x9f0d('0xf')));}function initGraph(_0x59f77f,_0x515003){var _0x46c499=new Graph();for(var _0x5b5582 in _0x59f77f){if(_0x59f77f[_0x9f0d('0xa')](_0x5b5582)){if(_[_0x9f0d('0x10')](_0x59f77f[_0x5b5582])){for(var _0x264325=0x0;_0x264325<_0x59f77f[_0x5b5582][_0x9f0d('0x11')];_0x264325+=0x1){addVertex(_0x46c499,_0x59f77f[_0x5b5582][_0x264325],_0x5b5582);}}else{addVertex(_0x46c499,_0x59f77f[_0x5b5582],_0x5b5582);}}}for(var _0x476be4=0x0;_0x476be4<_0x515003[_0x9f0d('0x11')];_0x476be4+=0x1){if(_0x515003[_0x476be4][_0x9f0d('0x12')]&&_0x515003[_0x476be4][_0x9f0d('0x13')]){_0x46c499[_0x9f0d('0x14')](_0x515003[_0x476be4][_0x9f0d('0x12')],_0x515003[_0x476be4][_0x9f0d('0x13')],_0x515003[_0x476be4]['value']);}}return _0x46c499;}function getRoot(_0x1fd0ae){return parser[_0x9f0d('0x15')](_0x1fd0ae,{'object':!![]})[_0x9f0d('0x16')][_0x9f0d('0x17')];}function inspect(_0x4d8dfe){return util[_0x9f0d('0x18')](_0x4d8dfe,{'showHidden':![],'depth':null});}function initialize(_0x10d84d,_0x18b909){var _0x46cfc1=getRoot(_0x10d84d[_0x9f0d('0x19')]);if(!_0x46cfc1||!_0x46cfc1[_0x9f0d('0x1a')])return;var _0x2b8b94,_0xde0281,_0x5495e1;logger[_0x9f0d('0x1b')](_0x9f0d('0x17'),JSON[_0x9f0d('0x1c')](_0x46cfc1,null,0x2));_0x18b909[_0x9f0d('0x1d')]=moment()[_0x9f0d('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b8b94=initGraph(_[_0x9f0d('0xe')](_0x46cfc1,_0x9f0d('0xf')),_0x46cfc1[_0x9f0d('0xf')]);_0xde0281=new Vertices(_0x18b909,rpc,mailRpc);logger['info'](util[_0x9f0d('0x1e')](_0x9f0d('0x1f'),_0x18b909[_0x9f0d('0x20')],_0x18b909['calleridname'],_0x18b909[_0x9f0d('0x21')],_0x18b909[_0x9f0d('0x22')],_0x18b909['uniqueid']));_0x2b8b94[_0x9f0d('0x23')](_0x46cfc1[_0x9f0d('0x1a')]['id'],function(_0x4df5fb){try{_0x4df5fb=_0xde0281[_0x9f0d('0x24')](_0x4df5fb);logger[_0x9f0d('0x1b')]('vertex',JSON[_0x9f0d('0x1c')](_0x4df5fb,null,0x2));if(_0x4df5fb[_0x9f0d('0x25')]===_0x9f0d('0x26')){logger[_0x9f0d('0x27')](_0x9f0d('0x28'));_0x18b909[_0x9f0d('0x29')]=_0x4df5fb[_0x9f0d('0x29')]||_0x18b909[_0x9f0d('0x29')];_0x18b909[_0x9f0d('0x2a')]=_0x4df5fb[_0x9f0d('0x2a')];_0x18b909[_0x9f0d('0x2b')]=_0x4df5fb[_0x9f0d('0x2b')]?_0x4df5fb['priority']-0x1:0x1;return null;}else if(_0x4df5fb&&_0xde0281[_0x4df5fb[_0x9f0d('0x25')]]){_0x5495e1=_0xde0281[_0x4df5fb[_0x9f0d('0x25')]](_0x4df5fb);logger['info']('response',JSON[_0x9f0d('0x1c')](_0x5495e1,null,0x2));if(_0x5495e1&&_0x5495e1['code']===AGI_CODE_SUCCESS&&_0x5495e1[_0x9f0d('0x2c')]!==AGI_RESULT_ERROR&&!_0x18b909[_0x9f0d('0x2d')]){logger[_0x9f0d('0x1b')]('response',inspect(_0x5495e1));return _[_0x9f0d('0x2e')](_0x5495e1[_0x9f0d('0x2c')])?null:_0x5495e1['result'][_0x9f0d('0x2f')]();}else{logger['error']('response',inspect(_0x5495e1));return null;}}else{logger[_0x9f0d('0x8')](_0x9f0d('0x30'));return null;}}catch(_0x28051f){logger[_0x9f0d('0x8')](_0x28051f[_0x9f0d('0x31')]);return null;}});if(_0x46cfc1[_0x9f0d('0x32')]){logger[_0x9f0d('0x27')](util[_0x9f0d('0x1e')](_0x9f0d('0x33'),_0x18b909[_0x9f0d('0x20')],_0x18b909['calleridname'],_0x18b909[_0x9f0d('0x21')],_0x18b909['dnid'],_0x18b909[_0x9f0d('0x34')]));_0x2b8b94[_0x9f0d('0x23')](_0x46cfc1['finally']['id'],function(_0x58a4ee){try{_0x58a4ee=_0xde0281[_0x9f0d('0x24')](_0x58a4ee);logger['debug']('vertex',JSON[_0x9f0d('0x1c')](_0x58a4ee,null,0x2));if(_0x58a4ee&&_0xde0281[_0x58a4ee[_0x9f0d('0x25')]]){_0x5495e1=_0xde0281[_0x58a4ee[_0x9f0d('0x25')]](_0x58a4ee);if(_0x5495e1){logger['debug'](_0x9f0d('0x35'),inspect(_0x5495e1));return _[_0x9f0d('0x2e')](_0x5495e1[_0x9f0d('0x2c')])?null:_0x5495e1[_0x9f0d('0x2c')]['toString']();}else{logger['error'](_0x9f0d('0x35'),inspect(_0x5495e1));return null;}}else{logger[_0x9f0d('0x8')](_0x9f0d('0x30'));return null;}}catch(_0x5489df){logger['error'](_0x5489df[_0x9f0d('0x31')]);return null;}});}logger[_0x9f0d('0x27')](util['format'](_0x9f0d('0x36'),_0x18b909['arg_1'],_0x18b909[_0x9f0d('0x37')],_0x18b909['callerid'],_0x18b909[_0x9f0d('0x22')],_0x18b909[_0x9f0d('0x34')]));logger[_0x9f0d('0x27')](util[_0x9f0d('0x1e')](_0x9f0d('0x38'),_0x18b909[_0x9f0d('0x29')],_0x18b909[_0x9f0d('0x2a')],parseInt(_0x18b909[_0x9f0d('0x2b')],0xa)+0x1));_0x18b909[_0x9f0d('0x39')](_0x18b909[_0x9f0d('0x29')],_0x18b909[_0x9f0d('0x2a')],parseInt(_0x18b909[_0x9f0d('0x2b')],0xa)+0x1);_0x18b909['close']();}function handleNotFound(_0x471b5d){logger[_0x9f0d('0x8')](util['format'](_0x9f0d('0x3a'),_0x471b5d[_0x9f0d('0x20')]));_0x471b5d[_0x9f0d('0x39')](_0x471b5d[_0x9f0d('0x29')],_0x471b5d[_0x9f0d('0x2a')],parseInt(_0x471b5d['priority'],0xa)+0x1);_0x471b5d[_0x9f0d('0x3b')]();}function handleUnpublished(_0x553264){logger[_0x9f0d('0x8')](util[_0x9f0d('0x1e')](_0x9f0d('0x3c'),_0x553264['arg_1']));_0x553264[_0x9f0d('0x39')](_0x553264[_0x9f0d('0x29')],_0x553264[_0x9f0d('0x2a')],parseInt(_0x553264['priority'],0xa)+0x1);_0x553264[_0x9f0d('0x3b')]();}module[_0x9f0d('0x3d')]={'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 666f798..bb08dbb 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 _0x9e5e=['trim','emit','headers','_inBody','line','length','exports','util','stream','call','_localBuffer','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','slice'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x9e5e[_0x5627e1];return _0x2f013f;};'use strict';var util=require(_0xe9e5('0x0'));var Transform=require(_0xe9e5('0x1'))['Transform'];function AGIReply(_0xb44bd2){Transform[_0xe9e5('0x2')](this,_0xb44bd2);this[_0xe9e5('0x3')]='';this['_inBody']=![];}util[_0xe9e5('0x4')](AGIReply,Transform);AGIReply['prototype'][_0xe9e5('0x5')]=function(_0x2bc952,_0x4f5182,_0x5c09f0){var _0xf4d974='\x0a',_0x2333df=['\x0a\x0a',_0xe9e5('0x6')],_0x4e0730=-0x1,_0x3648a5=-0x1,_0x2533d8='',_0x3c5c1b=0x0,_0x6325f0='',_0x34b7f5='';this[_0xe9e5('0x3')]+=_0x2bc952[_0xe9e5('0x7')]();_0x6325f0=this[_0xe9e5('0x3')];if(!this['_inBody']){_0x3c5c1b=0x0;while(_0x2333df[_0x3c5c1b]){while((_0x3648a5=_0x6325f0[_0xe9e5('0x8')](_0x2333df[_0x3c5c1b]))!=-0x1){_0x2533d8=_0x2333df[_0x3c5c1b];_0x34b7f5=_0x6325f0[_0xe9e5('0x9')](0x0,_0x3648a5);_0x6325f0=_0x6325f0['substring'](_0x3648a5+_0x2533d8['length']);var _0x4f4d79=_0x34b7f5[_0xe9e5('0xa')](_0xf4d974),_0x517c91=0x0,_0x439466={},_0x145c5f='',_0x42dcba='',_0x272b49=-0x1;while(_0x4f4d79[_0x517c91]){_0x272b49=_0x4f4d79[_0x517c91][_0xe9e5('0x8')](':');if(_0x272b49!=-0x1){_0x145c5f=_0x4f4d79[_0x517c91][_0xe9e5('0xb')](0x0,_0x272b49)[_0xe9e5('0xc')]();_0x42dcba=_0x4f4d79[_0x517c91][_0xe9e5('0xb')](_0x272b49+0x1)[_0xe9e5('0xc')]();if(_0x145c5f['length']>0x0){_0x439466[_0x145c5f]=_0x42dcba;}}else{}_0x517c91++;}this[_0xe9e5('0xd')](_0xe9e5('0xe'),_0x439466);this[_0xe9e5('0xf')]=!![];}_0x3c5c1b++;}this[_0xe9e5('0x3')]=_0x6325f0;}else{while((_0x4e0730=_0x6325f0[_0xe9e5('0x8')](_0xf4d974))!=-0x1){_0x34b7f5=_0x6325f0[_0xe9e5('0x9')](0x0,_0x4e0730);this[_0xe9e5('0xd')](_0xe9e5('0x10'),_0x34b7f5);_0x6325f0=_0x6325f0[_0xe9e5('0x9')](_0x4e0730+_0xf4d974[_0xe9e5('0x11')]);}this['_localBuffer']=_0x6325f0;}_0x5c09f0();};module[_0xe9e5('0x12')]=AGIReply; \ No newline at end of file +var _0x1d6a=['prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','split','trim','slice','emit','headers','length','exports','util','stream','Transform','_localBuffer','_inBody','inherits'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1d6a,0x12c));var _0xa1d6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d6a[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xa1d6('0x0'));var Transform=require(_0xa1d6('0x1'))[_0xa1d6('0x2')];function AGIReply(_0x24cf81){Transform['call'](this,_0x24cf81);this[_0xa1d6('0x3')]='';this[_0xa1d6('0x4')]=![];}util[_0xa1d6('0x5')](AGIReply,Transform);AGIReply[_0xa1d6('0x6')][_0xa1d6('0x7')]=function(_0xb4eb7e,_0x4afc69,_0x33855c){var _0x11de71='\x0a',_0x494a3a=['\x0a\x0a',_0xa1d6('0x8')],_0x4032e1=-0x1,_0x392b7d=-0x1,_0x10a3d6='',_0x47dad6=0x0,_0xaace4d='',_0x485d99='';this[_0xa1d6('0x3')]+=_0xb4eb7e['toString']();_0xaace4d=this[_0xa1d6('0x3')];if(!this[_0xa1d6('0x4')]){_0x47dad6=0x0;while(_0x494a3a[_0x47dad6]){while((_0x392b7d=_0xaace4d[_0xa1d6('0x9')](_0x494a3a[_0x47dad6]))!=-0x1){_0x10a3d6=_0x494a3a[_0x47dad6];_0x485d99=_0xaace4d[_0xa1d6('0xa')](0x0,_0x392b7d);_0xaace4d=_0xaace4d[_0xa1d6('0xa')](_0x392b7d+_0x10a3d6['length']);var _0x1f74ef=_0x485d99[_0xa1d6('0xb')](_0x11de71),_0x3f7113=0x0,_0x3fafc1={},_0x567c11='',_0xb8d67d='',_0x1b98bd=-0x1;while(_0x1f74ef[_0x3f7113]){_0x1b98bd=_0x1f74ef[_0x3f7113][_0xa1d6('0x9')](':');if(_0x1b98bd!=-0x1){_0x567c11=_0x1f74ef[_0x3f7113]['slice'](0x0,_0x1b98bd)[_0xa1d6('0xc')]();_0xb8d67d=_0x1f74ef[_0x3f7113][_0xa1d6('0xd')](_0x1b98bd+0x1)[_0xa1d6('0xc')]();if(_0x567c11['length']>0x0){_0x3fafc1[_0x567c11]=_0xb8d67d;}}else{}_0x3f7113++;}this[_0xa1d6('0xe')](_0xa1d6('0xf'),_0x3fafc1);this['_inBody']=!![];}_0x47dad6++;}this[_0xa1d6('0x3')]=_0xaace4d;}else{while((_0x4032e1=_0xaace4d[_0xa1d6('0x9')](_0x11de71))!=-0x1){_0x485d99=_0xaace4d['substring'](0x0,_0x4032e1);this[_0xa1d6('0xe')]('line',_0x485d99);_0xaace4d=_0xaace4d[_0xa1d6('0xa')](_0x4032e1+_0x11de71[_0xa1d6('0x10')]);}this['_localBuffer']=_0xaace4d;}_0x33855c();};module[_0xa1d6('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d04ea71..ae29373 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 _0xf53f=['ShowUser','getContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','message','catch','getSquareProjects','production','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xf53f,0x8d));var _0xff53=function(_0xaa9767,_0x1f9324){_0xaa9767=_0xaa9767-0x0;var _0x464a85=_0xf53f[_0xaa9767];return _0x464a85;};'use strict';var _=require(_0xff53('0x0'));var moment=require(_0xff53('0x1'));var jayson=require(_0xff53('0x2'));var client=jayson[_0xff53('0x3')][_0xff53('0x4')]({'port':0x2329});function request(_0x4afcd,_0x492e12){return new Promise(function(_0x32529d,_0x18b504){return client[_0xff53('0x5')](_0x4afcd,_0x492e12)[_0xff53('0x6')](function(_0x495edc){if(_0x495edc['error']){return _0x18b504(_0x495edc['error'][_0xff53('0x7')]);}else{return _0x32529d(_0x495edc['result']);}})[_0xff53('0x8')](function(_0x122746){return _0x18b504(_0x122746);});});}exports[_0xff53('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0xff53('0xa')]}});};exports['getSquareProject']=function(_0x130576){return request(_0xff53('0xb'),{'options':{'raw':![],'where':{'name':_0x130576},'attributes':['production']}});};exports[_0xff53('0xc')]=function(_0x14f3ac){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x14f3ac},'include':[{'model':_0xff53('0xd'),'as':_0xff53('0xe'),'include':[{'model':_0xff53('0xf'),'as':'CloudProvider'}]}],'attributes':['id',_0xff53('0x10'),_0xff53('0x11')],'smtp':!![]}});};exports[_0xff53('0x12')]=function(_0x5d4996){return request(_0xff53('0xb'),{'options':{'where':{'id':_0x5d4996},'attributes':[_0xff53('0x10')]}});};exports['getVoiceQueueById']=function(_0x55c489){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x55c489},'attributes':['name']}});};exports[_0xff53('0x13')]=function(_0x2f1292){return request(_0xff53('0x14'),{'options':{'where':{'id':_0x2f1292},'attributes':['name']}});};exports[_0xff53('0x15')]=function(_0x5d7dbd){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5d7dbd},'attributes':[_0xff53('0x16')]}});};exports[_0xff53('0x17')]=function(_0x4eea1b){return request(_0xff53('0x18'),{'options':{'where':{'id':_0x4eea1b},'attributes':[_0xff53('0x10')]}});};exports[_0xff53('0x19')]=function(_0x14b502){return request('GetContactByPhone',{'options':{'where':{'phone':_0x14b502['phone']},'attributes':['id']}});};exports[_0xff53('0x1a')]=function(_0x49aefa){return request(_0xff53('0x1b'),{'options':{'where':{'id':_0x49aefa},'attributes':[_0xff53('0x10')]}});};exports[_0xff53('0x1c')]=function(_0x323d17){return request(_0xff53('0x1d'),{'options':{'where':{'id':_0x323d17},'attributes':[_0xff53('0x1e')]}});};exports[_0xff53('0x1f')]=function(_0x2f1538){return request(_0xff53('0x20'),{'options':{'raw':![],'where':{'id':_0x2f1538},'include':[{'model':'Interval','as':_0xff53('0x21')}]}});};exports['getSmsAccountById']=function(_0x53e291){return request('ShowSmsAccount',{'options':{'where':{'id':_0x53e291},'attributes':['id','name']}});};exports[_0xff53('0x22')]=function(_0x13d5cd){return request('CreateSmsMessage',{'body':_0x13d5cd});};exports['createSquareDetailsReport']=function(_0xb8ea75){return request(_0xff53('0x23'),{'body':_0xb8ea75});};exports[_0xff53('0x24')]=function(_0x2981d5){return request(_0xff53('0x25'),{'body':_[_0xff53('0x26')](_0x2981d5,{'project_name':_0x2981d5['arg_1'],'prev_project_name':_0x2981d5[_0xff53('0x27')]||'','is_subproject':_0x2981d5['arg_2']?!![]:![],'leaveAt':moment()[_0xff53('0x28')](_0xff53('0x29'))})});};exports[_0xff53('0x2a')]=function(_0xcd7243){return request(_0xff53('0x2b'),{'body':_0xcd7243});};exports[_0xff53('0x2c')]=function(_0x43b400){return request(_0xff53('0x2d'),{'body':_0x43b400});};exports['createCmContact']=function(_0xe9031f){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xe9031f['phone'],'ListId':_0xe9031f[_0xff53('0x2e')]}}})[_0xff53('0x6')](function(_0x40e295){if(_0x40e295){return _0x40e295;}return request(_0xff53('0x2f'),{'body':_0xe9031f});});};exports[_0xff53('0x30')]=function(_0x4d870b){return request(_0xff53('0x31'),{'options':{'where':{'id':_0x4d870b},'attributes':['name']}});};exports[_0xff53('0x32')]=function(_0x20e60a,_0xff83d4){return request('LoginUser',{'body':{'interface':_0xff83d4},'options':{'where':_0x20e60a}});};exports['agentPause']=function(_0x44170f,_0x27d979,_0x400104){return request(_0xff53('0x33'),{'body':{'type':_0x27d979,'uniqueid':_0x400104},'options':{'where':_0x44170f}});};exports[_0xff53('0x34')]=function(_0x380275){return request('UnpauseUser',{'body':{},'options':{'where':_0x380275}});};exports[_0xff53('0x35')]=function(_0x560623){return request(_0xff53('0x36'),{'body':{},'options':{'where':_0x560623}});}; \ No newline at end of file +var _0xf675=['LogoutUser','lodash','moment','jayson/promise','http','then','error','result','catch','GetSquareProjects','name','ShowSquareProject','production','MailServerOut','Smtp','CloudProvider','email','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','CreateSquareMessage','createCmContact','ListId','CreateCmContact','agentLogin','PauseUser','agentUnpause'];(function(_0x68359d,_0x51477f){var _0x15d875=function(_0x5efef8){while(--_0x5efef8){_0x68359d['push'](_0x68359d['shift']());}};_0x15d875(++_0x51477f);}(_0xf675,0x199));var _0x5f67=function(_0x49bdc4,_0x1e2507){_0x49bdc4=_0x49bdc4-0x0;var _0x1f7437=_0xf675[_0x49bdc4];return _0x1f7437;};'use strict';var _=require(_0x5f67('0x0'));var moment=require(_0x5f67('0x1'));var jayson=require(_0x5f67('0x2'));var client=jayson['client'][_0x5f67('0x3')]({'port':0x2329});function request(_0x5c51b4,_0xc47435){return new Promise(function(_0x25480d,_0x2b07d5){return client['request'](_0x5c51b4,_0xc47435)[_0x5f67('0x4')](function(_0x36b14f){if(_0x36b14f[_0x5f67('0x5')]){return _0x2b07d5(_0x36b14f[_0x5f67('0x5')]['message']);}else{return _0x25480d(_0x36b14f[_0x5f67('0x6')]);}})[_0x5f67('0x7')](function(_0x55efcd){return _0x2b07d5(_0x55efcd);});});}exports['getSquareProjects']=function(){return request(_0x5f67('0x8'),{'options':{'raw':![],'attributes':['id',_0x5f67('0x9'),'production']}});};exports['getSquareProject']=function(_0x42dafc){return request(_0x5f67('0xa'),{'options':{'raw':![],'where':{'name':_0x42dafc},'attributes':[_0x5f67('0xb')]}});};exports['getMailAccountById']=function(_0x59bab1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x59bab1},'include':[{'model':_0x5f67('0xc'),'as':_0x5f67('0xd'),'include':[{'model':'CloudProvider','as':_0x5f67('0xe')}]}],'attributes':['id','name',_0x5f67('0xf')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x34ad41){return request(_0x5f67('0xa'),{'options':{'where':{'id':_0x34ad41},'attributes':[_0x5f67('0x9')]}});};exports['getVoiceQueueById']=function(_0x121c72){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x121c72},'attributes':[_0x5f67('0x9')]}});};exports['getVariableById']=function(_0xfe718e){return request('ShowVariable',{'options':{'where':{'id':_0xfe718e},'attributes':[_0x5f67('0x9')]}});};exports[_0x5f67('0x10')]=function(_0x3a4cc3){return request(_0x5f67('0x11'),{'options':{'where':{'id':_0x3a4cc3},'attributes':[_0x5f67('0x12')]}});};exports[_0x5f67('0x13')]=function(_0x3e3e2e){return request(_0x5f67('0x14'),{'options':{'where':{'id':_0x3e3e2e},'attributes':[_0x5f67('0x9')]}});};exports[_0x5f67('0x15')]=function(_0x5275d6){return request('GetContactByPhone',{'options':{'where':{'phone':_0x5275d6[_0x5f67('0x16')]},'attributes':['id']}});};exports[_0x5f67('0x17')]=function(_0x4fe826){return request(_0x5f67('0x18'),{'options':{'where':{'id':_0x4fe826},'attributes':[_0x5f67('0x9')]}});};exports[_0x5f67('0x19')]=function(_0x31eea7){return request(_0x5f67('0x1a'),{'options':{'where':{'id':_0x31eea7},'attributes':[_0x5f67('0x1b')]}});};exports[_0x5f67('0x1c')]=function(_0x3ca7d6){return request(_0x5f67('0x1d'),{'options':{'raw':![],'where':{'id':_0x3ca7d6},'include':[{'model':_0x5f67('0x1e'),'as':_0x5f67('0x1f')}]}});};exports[_0x5f67('0x20')]=function(_0x531f2e){return request(_0x5f67('0x21'),{'options':{'where':{'id':_0x531f2e},'attributes':['id',_0x5f67('0x9')]}});};exports[_0x5f67('0x22')]=function(_0x5bb1de){return request('CreateSmsMessage',{'body':_0x5bb1de});};exports[_0x5f67('0x23')]=function(_0x40b138){return request('CreateSquareDetailsReport',{'body':_0x40b138});};exports[_0x5f67('0x24')]=function(_0x26f12a){return request(_0x5f67('0x25'),{'body':_[_0x5f67('0x26')](_0x26f12a,{'project_name':_0x26f12a['arg_1'],'prev_project_name':_0x26f12a[_0x5f67('0x27')]||'','is_subproject':_0x26f12a['arg_2']?!![]:![],'leaveAt':moment()[_0x5f67('0x28')](_0x5f67('0x29'))})});};exports['createSquareRecording']=function(_0x1c395f){return request(_0x5f67('0x2a'),{'body':_0x1c395f});};exports['createSquareMessage']=function(_0x4b62f2){return request(_0x5f67('0x2b'),{'body':_0x4b62f2});};exports[_0x5f67('0x2c')]=function(_0x32830d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x32830d[_0x5f67('0x16')],'ListId':_0x32830d[_0x5f67('0x2d')]}}})['then'](function(_0x172b47){if(_0x172b47){return _0x172b47;}return request(_0x5f67('0x2e'),{'body':_0x32830d});});};exports['getPauseById']=function(_0xbb56ce){return request('ShowPause',{'options':{'where':{'id':_0xbb56ce},'attributes':[_0x5f67('0x9')]}});};exports[_0x5f67('0x2f')]=function(_0x3ccf2b,_0x542c0a){return request('LoginUser',{'body':{'interface':_0x542c0a},'options':{'where':_0x3ccf2b}});};exports['agentPause']=function(_0x38c0e2,_0x5b7a72,_0x1515b0){return request(_0x5f67('0x30'),{'body':{'type':_0x5b7a72,'uniqueid':_0x1515b0},'options':{'where':_0x38c0e2}});};exports[_0x5f67('0x31')]=function(_0x2547cd){return request('UnpauseUser',{'body':{},'options':{'where':_0x2547cd}});};exports['agentLogout']=function(_0x383042){return request(_0x5f67('0x32'),{'body':{},'options':{'where':_0x383042}});}; \ 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 cd73eb6..28cfe96 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 _0x1bce=['./lex','./polly'];(function(_0x3f2262,_0x445ffa){var _0x293f32=function(_0x2b0e64){while(--_0x2b0e64){_0x3f2262['push'](_0x3f2262['shift']());}};_0x293f32(++_0x445ffa);}(_0x1bce,0x73));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};var polly=require(_0xe1bc('0x0'));var lex=require(_0xe1bc('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 7257e6c..a3cfe8e 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 _0xe706=['exports','./lib/api'];(function(_0x2ceb67,_0x222576){var _0x541ddc=function(_0x2dcee4){while(--_0x2dcee4){_0x2ceb67['push'](_0x2ceb67['shift']());}};_0x541ddc(++_0x222576);}(_0xe706,0xa3));var _0x6e70=function(_0x3d309c,_0x242f4c){_0x3d309c=_0x3d309c-0x0;var _0x241187=_0xe706[_0x3d309c];return _0x241187;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ No newline at end of file +var _0xf109=['./lib/api','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf109,0xce));var _0x9f10=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xf109[_0xc8a931];return _0x28bd27;};'use strict';var lex=require(_0x9f10('0x0'));module[_0x9f10('0x1')]=function(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517){return lex(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517);}; \ 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 3ecd169..00d1eb5 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(_0x18e8f5,_0x1d223f){var _0x575d7e=function(_0x280c7f){while(--_0x280c7f){_0x18e8f5['push'](_0x18e8f5['shift']());}};_0x575d7e(++_0x1d223f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x47d794,_0x279a81){var _0x46de59=function(_0x5ad783){while(--_0x5ad783){_0x47d794['push'](_0x47d794['shift']());}};_0x46de59(++_0x279a81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 8475280..d973fa5 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 _0x8914=['exports'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0x8914,0x174));var _0x4891=function(_0x5896a8,_0x42f1fa){_0x5896a8=_0x5896a8-0x0;var _0x368021=_0x8914[_0x5896a8];return _0x368021;};'use strict';var polly=require('./lib/api');module[_0x4891('0x0')]=function(_0x4d0959,_0x2d759c,_0x50f54c,_0x19060d,_0x489ad7,_0x384020,_0x5cdd21){return polly(_0x4d0959,_0x2d759c,_0x50f54c,_0x19060d,_0x489ad7,_0x384020,_0x5cdd21);}; \ No newline at end of file +var _0xf982=['exports','./lib/api'];(function(_0x4c9fa9,_0x478b86){var _0x3ca7e0=function(_0x3ae043){while(--_0x3ae043){_0x4c9fa9['push'](_0x4c9fa9['shift']());}};_0x3ca7e0(++_0x478b86);}(_0xf982,0x1a7));var _0x2f98=function(_0x347acb,_0x458251){_0x347acb=_0x347acb-0x0;var _0xf33e6d=_0xf982[_0x347acb];return _0xf33e6d;};'use strict';var polly=require(_0x2f98('0x0'));module[_0x2f98('0x1')]=function(_0x24bd94,_0x320d60,_0x2c9083,_0x3a69ec,_0x471753,_0x1cf87d,_0x4ea426){return polly(_0x24bd94,_0x320d60,_0x2c9083,_0x3a69ec,_0x471753,_0x1cf87d,_0x4ea426);}; \ 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 b37116f..90f42e8 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 _0xc960=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','randomstring','synthesizeSpeech','writeFile','AudioStream'];(function(_0x35df02,_0x574b3a){var _0x3331f9=function(_0x5ab321){while(--_0x5ab321){_0x35df02['push'](_0x35df02['shift']());}};_0x3331f9(++_0x574b3a);}(_0xc960,0x1b4));var _0x0c96=function(_0x47c594,_0x2ad973){_0x47c594=_0x47c594-0x0;var _0xbedfc1=_0xc960[_0x47c594];return _0xbedfc1;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x0c96('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x21c25c,_0x365ddd,_0x414acb){return new BPromise(function(_0x504811,_0x1b7bb1){_0x21c25c[_0x0c96('0x1')](_0x365ddd,function(_0x58f245,_0x1ee585){if(_0x58f245){_0x1b7bb1(_0x58f245);}else if(_0x1ee585){if(_0x1ee585['AudioStream']instanceof Buffer){fs[_0x0c96('0x2')](_0x414acb,_0x1ee585[_0x0c96('0x3')],function(_0x15db35){if(_0x15db35){_0x1b7bb1(_0x15db35);}else{_0x504811();}});}else{_0x1b7bb1(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x1b7bb1(new Error(_0x0c96('0x4')));}});});}module['exports']=function(_0x39807f,_0x31d2eb,_0xcfaa47,_0x3ea027,_0x29e302,_0x273bfb,_0x3542de){var _0x2b8f03=new AWS[(_0x0c96('0x5'))]({'accessKeyId':_0x39807f,'secretAccessKey':_0x31d2eb,'region':_0xcfaa47});var _0x3fe14d={'Text':_0x29e302,'TextType':_0x273bfb||_0x0c96('0x6'),'OutputFormat':_0x0c96('0x7'),'VoiceId':_0x3ea027};return pollyResult(_0x2b8f03,_0x3fe14d,_0x3542de);}; \ No newline at end of file +var _0x71fc=['bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x546635,_0x5458ab){var _0x1234ed=function(_0x3ae72f){while(--_0x3ae72f){_0x546635['push'](_0x546635['shift']());}};_0x1234ed(++_0x5458ab);}(_0x71fc,0xe3));var _0xc71f=function(_0xcc7d14,_0x1c6331){_0xcc7d14=_0xcc7d14-0x0;var _0x50adda=_0x71fc[_0xcc7d14];return _0x50adda;};'use strict';var fs=require('fs');var path=require(_0xc71f('0x0'));var BPromise=require(_0xc71f('0x1'));var rs=require(_0xc71f('0x2'));var AWS=require(_0xc71f('0x3'));function pollyResult(_0x40546d,_0x3efdfe,_0x3e1b25){return new BPromise(function(_0x1bb447,_0x35b04f){_0x40546d[_0xc71f('0x4')](_0x3efdfe,function(_0x1da88a,_0x3f5cad){if(_0x1da88a){_0x35b04f(_0x1da88a);}else if(_0x3f5cad){if(_0x3f5cad['AudioStream']instanceof Buffer){fs[_0xc71f('0x5')](_0x3e1b25,_0x3f5cad[_0xc71f('0x6')],function(_0x39bcf4){if(_0x39bcf4){_0x35b04f(_0x39bcf4);}else{_0x1bb447();}});}else{_0x35b04f(new Error(_0xc71f('0x7')));}}else{_0x35b04f(new Error(_0xc71f('0x8')));}});});}module[_0xc71f('0x9')]=function(_0x241352,_0x1a6854,_0x5239af,_0x59af9f,_0x57d48d,_0x2e843b,_0x80492a){var _0x38578a=new AWS[(_0xc71f('0xa'))]({'accessKeyId':_0x241352,'secretAccessKey':_0x1a6854,'region':_0x5239af});var _0xb7fb6a={'Text':_0x57d48d,'TextType':_0x2e843b||_0xc71f('0xb'),'OutputFormat':'mp3','VoiceId':_0x59af9f};return pollyResult(_0x38578a,_0xb7fb6a,_0x80492a);}; \ 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 b6c2556..ce9c9cc 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 _0x97af=['./lib/api'];(function(_0x1fe915,_0x50da25){var _0x36d429=function(_0x8a58e2){while(--_0x8a58e2){_0x1fe915['push'](_0x1fe915['shift']());}};_0x36d429(++_0x50da25);}(_0x97af,0xf0));var _0xf97a=function(_0x18662e,_0x5908fb){_0x18662e=_0x18662e-0x0;var _0x5ac528=_0x97af[_0x18662e];return _0x5ac528;};'use strict';var asr=require(_0xf97a('0x0'));module['exports']=function(_0x41d4eb,_0x3a4fc0,_0x350a3d,_0x1fac41){return asr(_0x41d4eb,_0x3a4fc0,_0x350a3d);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x3056d1,_0x4bd045,_0x289cc7,_0x5a23fd){return asr(_0x3056d1,_0x4bd045,_0x289cc7);}; \ 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 4afb5d3..0aa5621 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 _0x131e=['filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','exports','string','length'];(function(_0x45a2ef,_0x20da44){var _0x398ae1=function(_0x1ce19a){while(--_0x1ce19a){_0x45a2ef['push'](_0x45a2ef['shift']());}};_0x398ae1(++_0x20da44);}(_0x131e,0x1ec));var _0xe131=function(_0xb9198b,_0x2dfac0){_0xb9198b=_0xb9198b-0x0;var _0x32fba3=_0x131e[_0xb9198b];return _0x32fba3;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xe131('0x0')]=function(_0x1f42ef,_0x2615f2,_0x418ed5){return new BPromise(function(_0x30486b,_0x761c){var _0x4ff7f7;if(typeof _0x1f42ef!==_0xe131('0x1')||_0x1f42ef[_0xe131('0x2')]===0x0){return _0x761c(_0xe131('0x3'));}if(typeof _0x2615f2!==_0xe131('0x1')||_0x2615f2[_0xe131('0x2')]===0x0){return _0x761c('key\x20should\x20be\x20a\x20string');}if(typeof _0x418ed5!=='undefined'&&(typeof _0x418ed5!=='string'||_0x418ed5['length']===0x0)){return _0x761c(_0xe131('0x4'));}try{_0x4ff7f7=fs[_0xe131('0x5')](_0x1f42ef)['toString'](_0xe131('0x6'));}catch(_0x4e126a){return _0x761c(_0x4e126a);}return _0x30486b({'method':_0xe131('0x7'),'uri':host+_0xe131('0x8')+_0x2615f2,'body':{'config':{'encoding':_0xe131('0x9'),'sampleRateHertz':_0xe131('0xa'),'languageCode':_0x418ed5},'audio':{'content':_0x4ff7f7}},'json':!![]});});}; \ No newline at end of file +var _0x1cc7=['https://speech.googleapis.com','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','string','readFileSync','toString','base64','8000','url','bluebird'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1cc7,0x15a));var _0x71cc=function(_0x224c8d,_0x2cc9dd){_0x224c8d=_0x224c8d-0x0;var _0xacf452=_0x1cc7[_0x224c8d];return _0xacf452;};'use strict';var url=require(_0x71cc('0x0'));var BPromise=require(_0x71cc('0x1'));var fs=require('fs');var host=_0x71cc('0x2');module['exports']=function(_0x4db9cd,_0x547fe6,_0xe5d54e){return new BPromise(function(_0x1fac93,_0x402191){var _0x5431e1;if(typeof _0x4db9cd!=='string'||_0x4db9cd['length']===0x0){return _0x402191(_0x71cc('0x3'));}if(typeof _0x547fe6!=='string'||_0x547fe6[_0x71cc('0x4')]===0x0){return _0x402191(_0x71cc('0x5'));}if(typeof _0xe5d54e!==_0x71cc('0x6')&&(typeof _0xe5d54e!==_0x71cc('0x7')||_0xe5d54e[_0x71cc('0x4')]===0x0)){return _0x402191('lang\x20should\x20be\x20a\x20string');}try{_0x5431e1=fs[_0x71cc('0x8')](_0x4db9cd)[_0x71cc('0x9')](_0x71cc('0xa'));}catch(_0x5ae8e7){return _0x402191(_0x5ae8e7);}return _0x1fac93({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x547fe6,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x71cc('0xb'),'languageCode':_0xe5d54e},'audio':{'content':_0x5431e1}},'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 c31c4c4..bab90a9 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 _0x6ab2=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ab2,0x79));var _0x26ab=function(_0x112484,_0x9672cc){_0x112484=_0x112484-0x0;var _0x42d65c=_0x6ab2[_0x112484];return _0x42d65c;};var asr=require(_0x26ab('0x0'));module[_0x26ab('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4fe8=['./asr','exports'];(function(_0x100a5d,_0x4bd15a){var _0x5d7a90=function(_0x4f39d5){while(--_0x4f39d5){_0x100a5d['push'](_0x100a5d['shift']());}};_0x5d7a90(++_0x4bd15a);}(_0x4fe8,0xd8));var _0x84fe=function(_0x80fd6d,_0x27d082){_0x80fd6d=_0x80fd6d-0x0;var _0xb04a77=_0x4fe8[_0x80fd6d];return _0xb04a77;};var asr=require(_0x84fe('0x0'));module[_0x84fe('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 f094061..d266fe7 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 _0x1500=['isFallback','languageCode','queryText','intentDetectionConfidence','asr','Tilde\x20ASR\x20confidence','777','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','Data','audiofile','apiai-promise','dialogflow','path','querystring','sox','google-tts-api','url','parse','./aws','./sestek','./tilde','../../../config/logger','agi','protocol','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','https:','transcode','wav','error\x20convert','start','tmp','.wav','base64','then','chmodSync','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','audioContent','resolve','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','goggleTTS\x20path','split','googleASR','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName'];(function(_0x4b4d4b,_0x2bd84d){var _0x35aa98=function(_0x3c0720){while(--_0x3c0720){_0x4b4d4b['push'](_0x4b4d4b['shift']());}};_0x35aa98(++_0x2bd84d);}(_0x1500,0x19c));var _0x0150=function(_0x1ff09a,_0x495e54){_0x1ff09a=_0x1ff09a-0x0;var _0x246c77=_0x1500[_0x1ff09a];return _0x246c77;};'use strict';var apiai=require(_0x0150('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x0150('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require(_0x0150('0x2'));var querystring=require(_0x0150('0x3'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x0150('0x4'));var tts=require(_0x0150('0x5'));var urlParse=require(_0x0150('0x6'))[_0x0150('0x7')];var util=require('util');var aws=require(_0x0150('0x8'));var google=require('./google');var sestek=require(_0x0150('0x9'));var tilde=require(_0x0150('0xa'));var logger=require(_0x0150('0xb'))(_0x0150('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x8e0fa7,_0x23d65f){return new BPromise(function(_0x45b179,_0x596989){var _0x10daef=urlParse(_0x8e0fa7);var _0x46ab10=_0x10daef[_0x0150('0xd')]==='https:'?https:http;var _0xbe3678={'host':_0x10daef[_0x0150('0xe')],'path':_0x10daef[_0x0150('0x2')],'headers':{'user-agent':_0x0150('0xf')}};_0x46ab10['get'](_0xbe3678,function(_0x384c36){if(_0x384c36[_0x0150('0x10')]!==0xc8){logger[_0x0150('0x11')](_0x0150('0x12')+_0x8e0fa7+_0x0150('0x13')+_0x384c36[_0x0150('0x10')]+'\x20('+_0x384c36[_0x0150('0x14')]+')');_0x596989(new Error(_0x0150('0x12')+_0x8e0fa7+'\x20failed,\x20status\x20code\x20=\x20'+_0x384c36[_0x0150('0x10')]+'\x20('+_0x384c36[_0x0150('0x14')]+')'));return;}var _0x3d60b5=fs[_0x0150('0x15')](_0x23d65f);_0x3d60b5['on'](_0x0150('0x16'),function(){logger[_0x0150('0x17')](_0x0150('0x18'));_0x3d60b5[_0x0150('0x19')](_0x45b179);});_0x3d60b5['on'](_0x0150('0x11'),function(_0x2f80c7){fs[_0x0150('0x1a')](_0x23d65f);logger[_0x0150('0x11')]('download\x20error',_0x2f80c7);_0x596989(_0x2f80c7);});_0x384c36[_0x0150('0x1b')](_0x3d60b5);})['on'](_0x0150('0x11'),function(_0x52970c){logger[_0x0150('0x11')](_0x52970c);_0x596989(_0x52970c);})[_0x0150('0x1c')]();});}function uploadFile(_0x3388b7){return new BPromise(function(_0x2a19de,_0x56a46f){var _0x3996d4=urlParse(_0x3388b7);var _0x4757de=_0x3996d4['protocol']===_0x0150('0x1d')?https:http;var _0x1f99e0={'host':_0x3996d4[_0x0150('0xe')],'path':_0x3996d4[_0x0150('0x2')],'headers':{'user-agent':_0x0150('0xf')}};_0x4757de['get'](_0x1f99e0,function(_0x1d2748){if(_0x1d2748[_0x0150('0x10')]!==0xc8){_0x56a46f(new Error(_0x0150('0x12')+_0x3388b7+_0x0150('0x13')+_0x1d2748['statusCode']+'\x20('+_0x1d2748[_0x0150('0x14')]+')'));return;}var _0x386271='';_0x1d2748['on']('data',function(_0x47cd32){_0x386271+=_0x47cd32;});_0x1d2748['on'](_0x0150('0x1c'),function(){_0x2a19de(_0x386271);});})['on'](_0x0150('0x11'),function(_0x9380ed){_0x56a46f(_0x9380ed);})[_0x0150('0x1c')]();});}function convertFile(_0x264ec6,_0x3d5be4){return new BPromise(function(_0x35c238,_0x5c3cc4){var _0x3e6947=sox[_0x0150('0x1e')](_0x264ec6,_0x3d5be4,{'sampleRate':0x1f40,'format':_0x0150('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3e6947['on']('error',function(_0x3d17d5){logger[_0x0150('0x11')](_0x0150('0x20'),_0x3d17d5);_0x5c3cc4(_0x3d17d5);});_0x3e6947['on'](_0x0150('0x1c'),function(){logger['info']('finish\x20to\x20convert');_0x35c238();});_0x3e6947[_0x0150('0x21')]();});}function base64Decode(_0x74d1ec,_0x29fea9){var _0x787e56=path['resolve'](__dirname,_0x0150('0x22'),rs['generate'](0x4)+_0x0150('0x23'));fs['writeFileSync'](_0x787e56,_0x74d1ec,_0x0150('0x24'));return convertFile(_0x787e56,_0x29fea9)[_0x0150('0x25')](function(){try{fs[_0x0150('0x1a')](_0x787e56);fs[_0x0150('0x26')](_0x29fea9,'777');}catch(_0x315b0a){logger[_0x0150('0x11')](_0x315b0a);}return _0x29fea9['split']('.')[0x0];});}function base64Encode(_0x4aa0f1){var _0x46accd=fs[_0x0150('0x27')](_0x4aa0f1);return new Buffer(_0x46accd)['toString'](_0x0150('0x24'));}exports[_0x0150('0x28')]=function(_0x2a0245,_0x1cc28e,_0x291905,_0x5166bf,_0x36f4fc,_0x5c2d95){var _0x2b6833,_0x4d3eae;var _0x4b572a=_0x0150('0x29');var _0x41059c=_0x0150('0x2a')+_0x2a0245;var _0x1a0c3f={};if(_0x1cc28e===_0x0150('0x2b')){_0x1a0c3f[_0x0150('0x2c')]={'ssml':_0x291905};}else{_0x1a0c3f[_0x0150('0x2c')]={'text':_0x291905};};_0x1a0c3f[_0x0150('0x2d')]={'languageCode':_0x5166bf,'ssmlGender':_0x36f4fc};_0x1a0c3f[_0x0150('0x2e')]={'audioEncoding':_0x0150('0x2f'),'sampleRateHertz':0x1f40};var _0x3259cd={'url':_0x4b572a+'text:synthesize'+_0x41059c,'method':_0x0150('0x30'),'json':!![],'body':_0x1a0c3f};return rp(_0x3259cd)[_0x0150('0x25')](function(_0x2ea540){return new BPromise(function(_0x3431f8,_0x236749){_0x2b6833=path['resolve'](__dirname,_0x0150('0x22'),rs[_0x0150('0x31')](0x4)+_0x0150('0x32'));var _0x39ef58=Buffer['from'](_0x2ea540[_0x0150('0x33')],_0x0150('0x24'));return fs['writeFile'](_0x2b6833,_0x39ef58,function(_0x3606be){_0x236749(_0x3606be);},function(_0x42103d){fs[_0x0150('0x26')](_0x2b6833,'777');_0x3431f8(_0x42103d);});});})[_0x0150('0x25')](function(_0x72528c){_0x4d3eae=path[_0x0150('0x34')](__dirname,_0x0150('0x22'),rs[_0x0150('0x31')](0x4)+'.wav');return convertFile(_0x2b6833,_0x4d3eae);})[_0x0150('0x25')](function(){try{fs[_0x0150('0x1a')](_0x2b6833);fs['chmodSync'](_0x4d3eae,'777');}catch(_0x56501b){logger['error'](_0x56501b);}logger[_0x0150('0x17')](_0x0150('0x35'),_0x4d3eae['split']('.')[0x0]);return _0x4d3eae['split']('.')[0x0];});};exports[_0x0150('0x36')]=function(_0x5e0cf4,_0x8f401e){var _0x555f4b=_0x0150('0x37');var _0x26f08d,_0x16e8f;var _0x3f00e8;var _0x46a133={'encoding':_0x0150('0x38'),'method':_0x0150('0x30'),'timeout':0x2710,'url':_0x555f4b,'headers':{'Content-Type':_0x0150('0x39')},'body':_0x0150('0x3a')+encodeURIComponent(JSON[_0x0150('0x3b')]([[[_0x0150('0x3c'),JSON[_0x0150('0x3b')]([_0x5e0cf4,_0x8f401e||'en',![],_0x0150('0x3d')]),null,_0x0150('0x3e')]]]))};return rp(_0x46a133)[_0x0150('0x25')](function(_0x54f6e3){try{_0x3f00e8=eval(_0x54f6e3[_0x0150('0x3f')](0x5))[0x0][0x2];}catch(_0x35836d){throw new Error(_0x0150('0x40')+_0x54f6e3[_0x0150('0x41')]);}if(!_0x3f00e8){if(_0x5e0cf4[_0x0150('0x42')]>0xc8){throw new Error(_0x0150('0x43'));}else{throw new Error('lang\x20\x22'+_0x8f401e+'\x22\x20might\x20not\x20exist');}}try{_0x3f00e8=eval(_0x3f00e8)[0x0];}catch(_0x45739a){throw new Error(_0x0150('0x40')+res[_0x0150('0x41')]);}const _0x870074=_0x3f00e8;_0x26f08d=path[_0x0150('0x34')](__dirname,_0x0150('0x22'),rs[_0x0150('0x31')](0x4)+'.mp3');fs['writeFileSync'](_0x26f08d,_0x3f00e8,{'encoding':_0x0150('0x24')});_0x16e8f=path[_0x0150('0x34')](__dirname,_0x0150('0x22'),rs[_0x0150('0x31')](0x4)+_0x0150('0x23'));return convertFile(_0x26f08d,_0x16e8f);})['then'](function(){try{fs[_0x0150('0x1a')](_0x26f08d);fs[_0x0150('0x26')](_0x16e8f,'777');}catch(_0x53c9a3){logger[_0x0150('0x11')](_0x53c9a3);}logger[_0x0150('0x17')](_0x0150('0x44'),_0x16e8f[_0x0150('0x45')]('.')[0x0]);return _0x16e8f['split']('.')[0x0];});};exports[_0x0150('0x46')]=function(_0x338e23,_0x4ceed2,_0x483c72){return google['asr'](_0x338e23,_0x4ceed2,_0x483c72)[_0x0150('0x25')](function(_0x4be21b){logger[_0x0150('0x17')](_0x4be21b['uri']);return rp(_0x4be21b);})['then'](function(_0x54a12c){var _0x4fc5ce='';var _0x1e7e50=0x0;try{fs[_0x0150('0x1a')](_0x338e23);}catch(_0x1e6055){logger[_0x0150('0x11')](_0x1e6055);}if(_0x54a12c&&_0x54a12c[_0x0150('0x47')]){_0x4fc5ce=_0x54a12c[_0x0150('0x47')][_0x0150('0x48')](function(_0x517368){return _0x517368&&_0x517368['alternatives'][0x0]&&_0x517368[_0x0150('0x49')][0x0][_0x0150('0x4a')]?_0x517368[_0x0150('0x49')][0x0][_0x0150('0x4a')]:'';})[_0x0150('0x4b')]('\x0a');_0x1e7e50=_0x54a12c[_0x0150('0x47')][_0x0150('0x48')](function(_0x45161a){return _0x45161a&&_0x45161a[_0x0150('0x49')][0x0]&&_0x45161a[_0x0150('0x49')][0x0][_0x0150('0x4c')]?_0x45161a[_0x0150('0x49')][0x0][_0x0150('0x4c')]:0x0;})[_0x0150('0x4b')]('\x0a');}logger[_0x0150('0x17')]('googleASR\x20transcription',_0x4fc5ce);logger[_0x0150('0x17')](_0x0150('0x4d'),_0x1e7e50);return{'transcript':_0x4fc5ce,'confidence':_0x1e7e50};})[_0x0150('0x4e')](function(_0x2544cf){logger[_0x0150('0x11')](_0x0150('0x4f'),_0x2544cf[_0x0150('0x10')],_0x2544cf[_0x0150('0x50')],_0x2544cf[_0x0150('0x51')]);});};exports[_0x0150('0x52')]=function(_0x1ed141,_0x266d02,_0x3de01f,_0x24a5ec){var _0x27f4cf=apiai(_0x266d02,{'language':_0x24a5ec||'en'});return _0x27f4cf[_0x0150('0x53')](_0x3de01f,{'sessionId':md5(_0x1ed141)})[_0x0150('0x25')](function(_0x57108b){logger[_0x0150('0x17')](JSON[_0x0150('0x3b')](_0x57108b));return{'source':_0x57108b[_0x0150('0x54')][_0x0150('0x55')],'resolvedQuery':_0x57108b[_0x0150('0x54')][_0x0150('0x56')],'action':_0x57108b['result'][_0x0150('0x57')],'actionIncomplete':_0x57108b[_0x0150('0x54')][_0x0150('0x58')],'speech':_0x57108b[_0x0150('0x54')][_0x0150('0x59')][_0x0150('0x5a')],'score':_0x57108b[_0x0150('0x54')][_0x0150('0x5b')],'statusCode':_0x57108b['status']['code'],'endConversation':_0x57108b[_0x0150('0x54')][_0x0150('0x5c')][_0x0150('0x5d')]||![],'isFallbackIntent':_0x57108b[_0x0150('0x54')][_0x0150('0x5c')][_0x0150('0x5e')]};});};exports[_0x0150('0x5f')]=function(_0x281dff,_0x5d9fde,_0x1c2cbd,_0x4ca85a,_0x3774e0,_0x5d2953){var _0x4dbfac=_0x4ca85a[_0x0150('0x60')](/\\n/g,'\x0a');var _0x4ab5ce={'credentials':{'private_key':_0x4dbfac,'client_email':_0x1c2cbd}};var _0x2e364a=new dialogflow['SessionsClient'](_0x4ab5ce);var _0x1b5006=_0x2e364a[_0x0150('0x61')](_0x5d9fde,md5(_0x281dff));var _0x164a49={'session':_0x1b5006,'queryInput':{'text':{'text':_0x3774e0,'languageCode':_0x5d2953}}};return _0x2e364a[_0x0150('0x62')](_0x164a49)[_0x0150('0x25')](function(_0x2157fb){if(_0x2157fb&&_0x2157fb[_0x0150('0x42')]){logger[_0x0150('0x17')](_0x0150('0x63'),JSON['stringify'](_0x2157fb));var _0x5a3e10=_0x2157fb[0x0];if(_0x5a3e10){var _0x22e873={'action':_0x5a3e10[_0x0150('0x64')][_0x0150('0x57')],'allRequiredParamsPresent':_0x5a3e10[_0x0150('0x64')][_0x0150('0x65')],'endConversation':_0x5a3e10[_0x0150('0x64')][_0x0150('0x66')]&&_0x5a3e10['queryResult'][_0x0150('0x66')][_0x0150('0x67')]?_0x5a3e10[_0x0150('0x64')][_0x0150('0x66')][_0x0150('0x67')][_0x0150('0x68')]['boolValue']:![],'fulfillmentText':_0x5a3e10['queryResult'][_0x0150('0x69')],'intentName':_0x5a3e10[_0x0150('0x64')][_0x0150('0x6a')][_0x0150('0x50')],'intentDisplayName':_0x5a3e10[_0x0150('0x64')][_0x0150('0x6a')][_0x0150('0x6b')],'isFallbackIntent':_0x5a3e10[_0x0150('0x64')][_0x0150('0x6a')][_0x0150('0x6c')],'languageCode':_0x5a3e10[_0x0150('0x64')][_0x0150('0x6d')],'queryText':_0x5a3e10[_0x0150('0x64')][_0x0150('0x6e')],'responseId':_0x5a3e10['responseId'],'score':_0x5a3e10[_0x0150('0x64')][_0x0150('0x6f')],'speech':_0x5a3e10[_0x0150('0x64')][_0x0150('0x69')],'providerResponse':JSON['stringify'](_0x2157fb)};return _0x22e873;}}});};exports['tildeASR']=function(_0x41ae7e,_0x2236c0,_0x1def8e,_0x182359){return tilde[_0x0150('0x70')](_0x41ae7e,_0x2236c0,_0x1def8e,_0x182359)[_0x0150('0x25')](function(_0x5511b4){try{fs['unlink'](_0x41ae7e);}catch(_0x3b8813){logger[_0x0150('0x11')](_0x3b8813);}logger[_0x0150('0x17')]('Tilde\x20ASR\x20transcription',_0x5511b4[_0x0150('0x4a')]);logger[_0x0150('0x17')](_0x0150('0x71'),_0x5511b4[_0x0150('0x4c')]);return _0x5511b4;});};exports['awsPolly']=function(_0x287ede,_0x700f33,_0x5445cc,_0x107cdf,_0x38ced8,_0x3cb124){var _0x3b1d53=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x0150('0x32'));var _0x3fdaf3;return aws['polly'](_0x287ede,_0x700f33,_0x5445cc,_0x107cdf,_0x38ced8,_0x3cb124,_0x3b1d53)['then'](function(){_0x3fdaf3=path[_0x0150('0x34')](__dirname,'tmp',rs[_0x0150('0x31')](0x4)+_0x0150('0x23'));return convertFile(_0x3b1d53,_0x3fdaf3);})['then'](function(){try{fs['unlink'](_0x3b1d53);fs['chmodSync'](_0x3fdaf3,_0x0150('0x72'));}catch(_0x2e2b10){logger[_0x0150('0x11')](_0x2e2b10);}return _0x3fdaf3[_0x0150('0x45')]('.')[0x0];});};exports[_0x0150('0x73')]=function(_0x5706b5,_0x57bd71,_0xdfddec,_0x35cea4,_0x2c7b7c,_0x13f429){return aws[_0x0150('0x74')](_0x5706b5,_0x57bd71,_0xdfddec,_0x35cea4,_0x2c7b7c,_0x13f429)[_0x0150('0x25')](function(_0x549454){logger[_0x0150('0x17')](JSON[_0x0150('0x3b')](_0x549454));return _0x549454;});};exports[_0x0150('0x75')]=function(_0x4b8466,_0x4363ce,_0x4b6034,_0x2a6d09){var _0x509222=util[_0x0150('0x76')](_0x0150('0x77'),ISPEECH_API,_0x4b8466,encodeURIComponent(_0x4363ce),_0x4b6034,_0x2a6d09);var _0x5529d0=path[_0x0150('0x34')](__dirname,'tmp',rs[_0x0150('0x31')](0x4)+_0x0150('0x32'));var _0x3f2db9;return downloadFile(_0x509222,_0x5529d0)[_0x0150('0x25')](function(){_0x3f2db9=path[_0x0150('0x34')](__dirname,_0x0150('0x22'),rs[_0x0150('0x31')](0x4)+_0x0150('0x23'));return convertFile(_0x5529d0,_0x3f2db9);})[_0x0150('0x25')](function(){try{fs[_0x0150('0x1a')](_0x5529d0);fs['chmodSync'](_0x3f2db9,_0x0150('0x72'));}catch(_0x5f19ba){logger[_0x0150('0x11')](_0x5f19ba);}return _0x3f2db9[_0x0150('0x45')]('.')[0x0];});};exports[_0x0150('0x78')]=function(_0x13b439,_0x33b977,_0x2c0b5e,_0x5aa691){var _0x58d467=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x33b977,_0x2c0b5e,base64Encode(_0x13b439),_0x5aa691?util['format'](_0x0150('0x79'),encodeURIComponent(_0x5aa691)):_0x0150('0x7a'));return uploadFile(_0x58d467)[_0x0150('0x25')](function(_0x4e2094){return querystring[_0x0150('0x7')](_0x4e2094);});};exports[_0x0150('0x7b')]=function(_0xffee6e,_0x4898ed){return sestek[_0x0150('0x7c')](_0xffee6e,_0x4898ed)[_0x0150('0x25')](function(_0x3e4e84){logger[_0x0150('0x17')](JSON[_0x0150('0x3b')](_0x3e4e84));var _0x5cb05d={'speech':_0x3e4e84[_0x0150('0x7d')],'action':_0x3e4e84[_0x0150('0x7e')]?_0x3e4e84[_0x0150('0x7e')]['CustomAction']:undefined,'actiondata':_0x3e4e84[_0x0150('0x7e')]?_0x3e4e84[_0x0150('0x7e')][_0x0150('0x7f')]:undefined};if(_0x3e4e84['channelData']&&_0x3e4e84['channelData']['AudioFromTts']){return base64Decode(_0x3e4e84[_0x0150('0x7e')]['AudioFromTts'][_0x0150('0x80')],path[_0x0150('0x34')](__dirname,_0x0150('0x22'),rs[_0x0150('0x31')](0x4)+'.wav'))[_0x0150('0x25')](function(_0x378cd8){_0x5cb05d[_0x0150('0x81')]=_0x378cd8;return _0x5cb05d;});}return _0x5cb05d;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x1308=['https','md5','path','request-promise','randomstring','sox','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','https:','get','data','transcode','wav','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','googleCloudTTS','ssml','input','MP3','then','resolve','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','jQ1olc','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','googleDialogflow','textRequest','stringify','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http'];(function(_0x2fa86b,_0x3293f3){var _0x1542a1=function(_0x36b48f){while(--_0x36b48f){_0x2fa86b['push'](_0x2fa86b['shift']());}};_0x1542a1(++_0x3293f3);}(_0x1308,0x7d));var _0x8130=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x1308[_0x5cc8];return _0x450661;};'use strict';var apiai=require(_0x8130('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x8130('0x1'));var fs=require('fs');var http=require(_0x8130('0x2'));var https=require(_0x8130('0x3'));var md5=require(_0x8130('0x4'));var path=require(_0x8130('0x5'));var querystring=require('querystring');var rp=require(_0x8130('0x6'));var rs=require(_0x8130('0x7'));var sox=require(_0x8130('0x8'));var tts=require('google-tts-api');var urlParse=require('url')['parse'];var util=require('util');var aws=require('./aws');var google=require(_0x8130('0x9'));var sestek=require(_0x8130('0xa'));var tilde=require(_0x8130('0xb'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x8130('0xc');function downloadFile(_0x26f75c,_0x5d3066){return new BPromise(function(_0x365711,_0x27db20){var _0x25c8f6=urlParse(_0x26f75c);var _0x4d3a12=_0x25c8f6[_0x8130('0xd')]==='https:'?https:http;var _0x1ec96e={'host':_0x25c8f6[_0x8130('0xe')],'path':_0x25c8f6['path'],'headers':{'user-agent':_0x8130('0xf')}};_0x4d3a12['get'](_0x1ec96e,function(_0x35c52d){if(_0x35c52d[_0x8130('0x10')]!==0xc8){logger[_0x8130('0x11')]('request\x20to\x20'+_0x26f75c+_0x8130('0x12')+_0x35c52d['statusCode']+'\x20('+_0x35c52d[_0x8130('0x13')]+')');_0x27db20(new Error(_0x8130('0x14')+_0x26f75c+_0x8130('0x12')+_0x35c52d[_0x8130('0x10')]+'\x20('+_0x35c52d['statusMessage']+')'));return;}var _0x4b44d3=fs[_0x8130('0x15')](_0x5d3066);_0x4b44d3['on'](_0x8130('0x16'),function(){logger[_0x8130('0x17')](_0x8130('0x18'));_0x4b44d3['close'](_0x365711);});_0x4b44d3['on'](_0x8130('0x11'),function(_0xb471c6){fs[_0x8130('0x19')](_0x5d3066);logger[_0x8130('0x11')](_0x8130('0x1a'),_0xb471c6);_0x27db20(_0xb471c6);});_0x35c52d[_0x8130('0x1b')](_0x4b44d3);})['on'](_0x8130('0x11'),function(_0x30a749){logger[_0x8130('0x11')](_0x30a749);_0x27db20(_0x30a749);})[_0x8130('0x1c')]();});}function uploadFile(_0x1fe10c){return new BPromise(function(_0x3636d2,_0x2d332b){var _0x5935fe=urlParse(_0x1fe10c);var _0x24b318=_0x5935fe['protocol']===_0x8130('0x1d')?https:http;var _0x4875c9={'host':_0x5935fe[_0x8130('0xe')],'path':_0x5935fe[_0x8130('0x5')],'headers':{'user-agent':_0x8130('0xf')}};_0x24b318[_0x8130('0x1e')](_0x4875c9,function(_0x670628){if(_0x670628[_0x8130('0x10')]!==0xc8){_0x2d332b(new Error(_0x8130('0x14')+_0x1fe10c+_0x8130('0x12')+_0x670628[_0x8130('0x10')]+'\x20('+_0x670628['statusMessage']+')'));return;}var _0x1a2b48='';_0x670628['on'](_0x8130('0x1f'),function(_0x5bb5e0){_0x1a2b48+=_0x5bb5e0;});_0x670628['on'](_0x8130('0x1c'),function(){_0x3636d2(_0x1a2b48);});})['on'](_0x8130('0x11'),function(_0x492fe6){_0x2d332b(_0x492fe6);})['end']();});}function convertFile(_0xe3b1d5,_0x2d371b){return new BPromise(function(_0x516e1a,_0x104b18){var _0x12cc07=sox[_0x8130('0x20')](_0xe3b1d5,_0x2d371b,{'sampleRate':0x1f40,'format':_0x8130('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12cc07['on'](_0x8130('0x11'),function(_0x9ff1a9){logger['error']('error\x20convert',_0x9ff1a9);_0x104b18(_0x9ff1a9);});_0x12cc07['on']('end',function(){logger['info'](_0x8130('0x22'));_0x516e1a();});_0x12cc07[_0x8130('0x23')]();});}function base64Decode(_0x4b77ee,_0x5a1bad){var _0x465ff4=path['resolve'](__dirname,_0x8130('0x24'),rs[_0x8130('0x25')](0x4)+_0x8130('0x26'));fs[_0x8130('0x27')](_0x465ff4,_0x4b77ee,_0x8130('0x28'));return convertFile(_0x465ff4,_0x5a1bad)['then'](function(){try{fs['unlink'](_0x465ff4);fs[_0x8130('0x29')](_0x5a1bad,_0x8130('0x2a'));}catch(_0x461d0e){logger['error'](_0x461d0e);}return _0x5a1bad[_0x8130('0x2b')]('.')[0x0];});}function base64Encode(_0x254df3){var _0x1b4e9d=fs[_0x8130('0x2c')](_0x254df3);return new Buffer(_0x1b4e9d)['toString'](_0x8130('0x28'));}exports[_0x8130('0x2d')]=function(_0x511615,_0xe7f582,_0xfb6003,_0x3a0fd4,_0x3a7ef9,_0x4949b6){var _0x480ccf,_0x449b39;var _0x44588e='https://texttospeech.googleapis.com/v1/';var _0xbad34d='?key='+_0x511615;var _0x383ca8={};if(_0xe7f582===_0x8130('0x2e')){_0x383ca8[_0x8130('0x2f')]={'ssml':_0xfb6003};}else{_0x383ca8[_0x8130('0x2f')]={'text':_0xfb6003};};_0x383ca8['voice']={'languageCode':_0x3a0fd4,'ssmlGender':_0x3a7ef9};_0x383ca8['audioConfig']={'audioEncoding':_0x8130('0x30'),'sampleRateHertz':0x1f40};var _0x1bb147={'url':_0x44588e+'text:synthesize'+_0xbad34d,'method':'POST','json':!![],'body':_0x383ca8};return rp(_0x1bb147)[_0x8130('0x31')](function(_0x38b2d0){return new BPromise(function(_0x21f204,_0x4fad25){_0x480ccf=path[_0x8130('0x32')](__dirname,_0x8130('0x24'),rs['generate'](0x4)+_0x8130('0x33'));var _0x68d45d=Buffer['from'](_0x38b2d0[_0x8130('0x34')],_0x8130('0x28'));return fs[_0x8130('0x35')](_0x480ccf,_0x68d45d,function(_0xeb3889){_0x4fad25(_0xeb3889);},function(_0x243b63){fs[_0x8130('0x29')](_0x480ccf,_0x8130('0x2a'));_0x21f204(_0x243b63);});});})[_0x8130('0x31')](function(_0x494eb3){_0x449b39=path[_0x8130('0x32')](__dirname,_0x8130('0x24'),rs[_0x8130('0x25')](0x4)+'.wav');return convertFile(_0x480ccf,_0x449b39);})[_0x8130('0x31')](function(){try{fs[_0x8130('0x19')](_0x480ccf);fs[_0x8130('0x29')](_0x449b39,_0x8130('0x2a'));}catch(_0x1cf666){logger[_0x8130('0x11')](_0x1cf666);}logger[_0x8130('0x17')](_0x8130('0x36'),_0x449b39[_0x8130('0x2b')]('.')[0x0]);return _0x449b39[_0x8130('0x2b')]('.')[0x0];});};exports[_0x8130('0x37')]=function(_0x53cda6,_0x2ee5f7){var _0x170f34=_0x8130('0x38');var _0x3bb32d,_0x5ceb08;var _0x505796;var _0x198218={'encoding':_0x8130('0x39'),'method':_0x8130('0x3a'),'timeout':0x2710,'url':_0x170f34,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x8130('0x3b')+encodeURIComponent(JSON['stringify']([[[_0x8130('0x3c'),JSON['stringify']([_0x53cda6,_0x2ee5f7||'en',![],'null']),null,'generic']]]))};return rp(_0x198218)['then'](function(_0xae9d70){try{_0x505796=eval(_0xae9d70[_0x8130('0x3d')](0x5))[0x0][0x2];}catch(_0x41c325){throw new Error('parse\x20response\x20failed:\x0a'+_0xae9d70[_0x8130('0x1f')]);}if(!_0x505796){if(_0x53cda6[_0x8130('0x3e')]>0xc8){throw new Error(_0x8130('0x3f'));}else{throw new Error(_0x8130('0x40')+_0x2ee5f7+_0x8130('0x41'));}}try{_0x505796=eval(_0x505796)[0x0];}catch(_0x2abc87){throw new Error(_0x8130('0x42')+res['data']);}const _0x4cad7d=_0x505796;_0x3bb32d=path[_0x8130('0x32')](__dirname,'tmp',rs[_0x8130('0x25')](0x4)+_0x8130('0x33'));fs[_0x8130('0x27')](_0x3bb32d,_0x505796,{'encoding':_0x8130('0x28')});_0x5ceb08=path['resolve'](__dirname,'tmp',rs[_0x8130('0x25')](0x4)+_0x8130('0x26'));return convertFile(_0x3bb32d,_0x5ceb08);})[_0x8130('0x31')](function(){try{fs['unlink'](_0x3bb32d);fs[_0x8130('0x29')](_0x5ceb08,_0x8130('0x2a'));}catch(_0xda190c){logger[_0x8130('0x11')](_0xda190c);}logger[_0x8130('0x17')](_0x8130('0x43'),_0x5ceb08['split']('.')[0x0]);return _0x5ceb08[_0x8130('0x2b')]('.')[0x0];});};exports[_0x8130('0x44')]=function(_0x123238,_0x2cd4fe,_0x4e50b7){return google['asr'](_0x123238,_0x2cd4fe,_0x4e50b7)[_0x8130('0x31')](function(_0x52d285){logger[_0x8130('0x17')](_0x52d285[_0x8130('0x45')]);return rp(_0x52d285);})[_0x8130('0x31')](function(_0x3d4029){var _0x131bbb='';var _0x29c22e=0x0;try{fs['unlink'](_0x123238);}catch(_0xbed6dc){logger[_0x8130('0x11')](_0xbed6dc);}if(_0x3d4029&&_0x3d4029[_0x8130('0x46')]){_0x131bbb=_0x3d4029['results'][_0x8130('0x47')](function(_0x379c62){return _0x379c62&&_0x379c62['alternatives'][0x0]&&_0x379c62[_0x8130('0x48')][0x0][_0x8130('0x49')]?_0x379c62[_0x8130('0x48')][0x0][_0x8130('0x49')]:'';})[_0x8130('0x4a')]('\x0a');_0x29c22e=_0x3d4029[_0x8130('0x46')][_0x8130('0x47')](function(_0x4fb4d8){return _0x4fb4d8&&_0x4fb4d8[_0x8130('0x48')][0x0]&&_0x4fb4d8['alternatives'][0x0]['confidence']?_0x4fb4d8[_0x8130('0x48')][0x0][_0x8130('0x4b')]:0x0;})['join']('\x0a');}logger[_0x8130('0x17')](_0x8130('0x4c'),_0x131bbb);logger[_0x8130('0x17')]('googleASR\x20confidence',_0x29c22e);return{'transcript':_0x131bbb,'confidence':_0x29c22e};})[_0x8130('0x4d')](function(_0x5b5f4e){logger[_0x8130('0x11')]('[%s]\x20%s:%s',_0x5b5f4e['statusCode'],_0x5b5f4e['name'],_0x5b5f4e['message']);});};exports[_0x8130('0x4e')]=function(_0x4b6353,_0x12ed5c,_0x35b913,_0x10cb15){var _0x26142b=apiai(_0x12ed5c,{'language':_0x10cb15||'en'});return _0x26142b[_0x8130('0x4f')](_0x35b913,{'sessionId':md5(_0x4b6353)})[_0x8130('0x31')](function(_0x2ebb74){logger[_0x8130('0x17')](JSON[_0x8130('0x50')](_0x2ebb74));return{'source':_0x2ebb74[_0x8130('0x51')]['source'],'resolvedQuery':_0x2ebb74[_0x8130('0x51')][_0x8130('0x52')],'action':_0x2ebb74[_0x8130('0x51')][_0x8130('0x53')],'actionIncomplete':_0x2ebb74[_0x8130('0x51')][_0x8130('0x54')],'speech':_0x2ebb74[_0x8130('0x51')][_0x8130('0x55')][_0x8130('0x56')],'score':_0x2ebb74[_0x8130('0x51')]['score'],'statusCode':_0x2ebb74[_0x8130('0x57')][_0x8130('0x58')],'endConversation':_0x2ebb74[_0x8130('0x51')][_0x8130('0x59')][_0x8130('0x5a')]||![],'isFallbackIntent':_0x2ebb74[_0x8130('0x51')][_0x8130('0x59')][_0x8130('0x5b')]};});};exports['googleDialogflowV2']=function(_0x54a2f3,_0x4cb729,_0x374223,_0x21cd65,_0x395804,_0x1b3f3b){var _0x54fc49=_0x21cd65['replace'](/\\n/g,'\x0a');var _0x1c76ae={'credentials':{'private_key':_0x54fc49,'client_email':_0x374223}};var _0x3fc604=new dialogflow[(_0x8130('0x5c'))](_0x1c76ae);var _0x37375a=_0x3fc604['sessionPath'](_0x4cb729,md5(_0x54a2f3));var _0xbc9e14={'session':_0x37375a,'queryInput':{'text':{'text':_0x395804,'languageCode':_0x1b3f3b}}};return _0x3fc604[_0x8130('0x5d')](_0xbc9e14)[_0x8130('0x31')](function(_0x456745){if(_0x456745&&_0x456745['length']){logger[_0x8130('0x17')](_0x8130('0x5e'),JSON[_0x8130('0x50')](_0x456745));var _0x583fd6=_0x456745[0x0];if(_0x583fd6){var _0x3083bd={'action':_0x583fd6[_0x8130('0x5f')][_0x8130('0x53')],'allRequiredParamsPresent':_0x583fd6[_0x8130('0x5f')][_0x8130('0x60')],'endConversation':_0x583fd6[_0x8130('0x5f')]['diagnosticInfo']&&_0x583fd6[_0x8130('0x5f')][_0x8130('0x61')]['fields']?_0x583fd6[_0x8130('0x5f')][_0x8130('0x61')][_0x8130('0x62')]['end_conversation'][_0x8130('0x63')]:![],'fulfillmentText':_0x583fd6[_0x8130('0x5f')][_0x8130('0x64')],'intentName':_0x583fd6[_0x8130('0x5f')]['intent']['name'],'intentDisplayName':_0x583fd6[_0x8130('0x5f')][_0x8130('0x65')][_0x8130('0x66')],'isFallbackIntent':_0x583fd6['queryResult'][_0x8130('0x65')][_0x8130('0x67')],'languageCode':_0x583fd6[_0x8130('0x5f')][_0x8130('0x68')],'queryText':_0x583fd6['queryResult']['queryText'],'responseId':_0x583fd6[_0x8130('0x69')],'score':_0x583fd6['queryResult']['intentDetectionConfidence'],'speech':_0x583fd6[_0x8130('0x5f')][_0x8130('0x64')],'providerResponse':JSON[_0x8130('0x50')](_0x456745)};return _0x3083bd;}}});};exports[_0x8130('0x6a')]=function(_0x3c00f0,_0x4d86f8,_0x215134,_0x1fb9b2){return tilde[_0x8130('0x6b')](_0x3c00f0,_0x4d86f8,_0x215134,_0x1fb9b2)[_0x8130('0x31')](function(_0x1cd764){try{fs[_0x8130('0x19')](_0x3c00f0);}catch(_0x3af709){logger['error'](_0x3af709);}logger['info']('Tilde\x20ASR\x20transcription',_0x1cd764[_0x8130('0x49')]);logger[_0x8130('0x17')](_0x8130('0x6c'),_0x1cd764[_0x8130('0x4b')]);return _0x1cd764;});};exports[_0x8130('0x6d')]=function(_0x1cb1e5,_0x239f61,_0x66a392,_0x4b07d2,_0x41ab1b,_0x581f83){var _0x33c387=path[_0x8130('0x32')](__dirname,_0x8130('0x24'),rs['generate'](0x4)+_0x8130('0x33'));var _0x294fba;return aws[_0x8130('0x6e')](_0x1cb1e5,_0x239f61,_0x66a392,_0x4b07d2,_0x41ab1b,_0x581f83,_0x33c387)[_0x8130('0x31')](function(){_0x294fba=path[_0x8130('0x32')](__dirname,_0x8130('0x24'),rs[_0x8130('0x25')](0x4)+_0x8130('0x26'));return convertFile(_0x33c387,_0x294fba);})[_0x8130('0x31')](function(){try{fs[_0x8130('0x19')](_0x33c387);fs['chmodSync'](_0x294fba,'777');}catch(_0x537554){logger[_0x8130('0x11')](_0x537554);}return _0x294fba[_0x8130('0x2b')]('.')[0x0];});};exports[_0x8130('0x6f')]=function(_0x22b978,_0x201904,_0x21c7b2,_0x415e27,_0x4fa294,_0x2fad85){return aws[_0x8130('0x70')](_0x22b978,_0x201904,_0x21c7b2,_0x415e27,_0x4fa294,_0x2fad85)[_0x8130('0x31')](function(_0xf0d8b3){logger[_0x8130('0x17')](JSON[_0x8130('0x50')](_0xf0d8b3));return _0xf0d8b3;});};exports[_0x8130('0x71')]=function(_0x4b80c5,_0x474eec,_0x538cbd,_0x49ed8f){var _0x54a207=util[_0x8130('0x72')](_0x8130('0x73'),ISPEECH_API,_0x4b80c5,encodeURIComponent(_0x474eec),_0x538cbd,_0x49ed8f);var _0x44951b=path['resolve'](__dirname,_0x8130('0x24'),rs[_0x8130('0x25')](0x4)+_0x8130('0x33'));var _0x4640a4;return downloadFile(_0x54a207,_0x44951b)[_0x8130('0x31')](function(){_0x4640a4=path['resolve'](__dirname,_0x8130('0x24'),rs['generate'](0x4)+_0x8130('0x26'));return convertFile(_0x44951b,_0x4640a4);})['then'](function(){try{fs[_0x8130('0x19')](_0x44951b);fs['chmodSync'](_0x4640a4,_0x8130('0x2a'));}catch(_0x3a9108){logger[_0x8130('0x11')](_0x3a9108);}return _0x4640a4[_0x8130('0x2b')]('.')[0x0];});};exports[_0x8130('0x74')]=function(_0x437f68,_0x42ec82,_0x4ae588,_0x557544){var _0x497b71=util['format'](_0x8130('0x75'),ISPEECH_API,_0x42ec82,_0x4ae588,base64Encode(_0x437f68),_0x557544?util[_0x8130('0x72')](_0x8130('0x76'),encodeURIComponent(_0x557544)):_0x8130('0x77'));return uploadFile(_0x497b71)[_0x8130('0x31')](function(_0x129b28){return querystring['parse'](_0x129b28);});};exports[_0x8130('0x78')]=function(_0x2d0e96,_0x2fc7eb){return sestek[_0x8130('0x79')](_0x2d0e96,_0x2fc7eb)[_0x8130('0x31')](function(_0x7280ca){logger['info'](JSON['stringify'](_0x7280ca));var _0x1cbe9e={'speech':_0x7280ca[_0x8130('0x7a')],'action':_0x7280ca[_0x8130('0x7b')]?_0x7280ca[_0x8130('0x7b')][_0x8130('0x7c')]:undefined,'actiondata':_0x7280ca[_0x8130('0x7b')]?_0x7280ca[_0x8130('0x7b')]['CustomActionData']:undefined};if(_0x7280ca[_0x8130('0x7b')]&&_0x7280ca[_0x8130('0x7b')][_0x8130('0x7d')]){return base64Decode(_0x7280ca[_0x8130('0x7b')][_0x8130('0x7d')]['Data'],path[_0x8130('0x32')](__dirname,'tmp',rs['generate'](0x4)+_0x8130('0x26')))[_0x8130('0x31')](function(_0x573c4d){_0x1cbe9e[_0x8130('0x7e')]=_0x573c4d;return _0x1cbe9e;});}return _0x1cbe9e;});};exports[_0x8130('0x7f')]=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 0d9a6e3..ec1966b 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 _0x2299=['exports'];(function(_0x1dd117,_0x4bbc0e){var _0xaec8f5=function(_0x1858d0){while(--_0x1858d0){_0x1dd117['push'](_0x1dd117['shift']());}};_0xaec8f5(++_0x4bbc0e);}(_0x2299,0xcf));var _0x9229=function(_0x1df644,_0x513cd7){_0x1df644=_0x1df644-0x0;var _0x236bdb=_0x2299[_0x1df644];return _0x236bdb;};var nda=require('./nda');module[_0x9229('0x0')]={'nda':nda}; \ No newline at end of file +var _0x1871=['./nda','exports'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x1871,0xc8));var _0x1187=function(_0x5b513b,_0x1e02c8){_0x5b513b=_0x5b513b-0x0;var _0x5a277e=_0x1871[_0x5b513b];return _0x5a277e;};var nda=require(_0x1187('0x0'));module[_0x1187('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 dcdea25..0075a38 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 _0xb98f=['ndaactivity_type','message','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password'];(function(_0xef4584,_0x53918f){var _0x54a1ab=function(_0x4c48a0){while(--_0x4c48a0){_0xef4584['push'](_0xef4584['shift']());}};_0x54a1ab(++_0x53918f);}(_0xb98f,0xce));var _0xfb98=function(_0x39d85e,_0xa26306){_0x39d85e=_0x39d85e-0x0;var _0x4def78=_0xb98f[_0x39d85e];return _0x4def78;};'use strict';var rp=require(_0xfb98('0x0'));var url=require(_0xfb98('0x1'));var logger=require(_0xfb98('0x2'))(_0xfb98('0x3'));module[_0xfb98('0x4')]=function(_0x4f16b2,_0x5570ce){var _0x593d54={'method':_0xfb98('0x5'),'uri':url[_0xfb98('0x6')](_0x5570ce[_0xfb98('0x7')],_0xfb98('0x8')),'form':{'grant_type':'password','username':_0x5570ce[_0xfb98('0x9')],'password':_0x5570ce[_0xfb98('0xa')]},'json':!![]};return rp(_0x593d54)['then'](function(_0x27b394){var _0x4d06fc={'method':'POST','uri':url['resolve'](_0x5570ce['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5570ce[_0xfb98('0xb')]||_0xfb98('0xc'),'channelId':'Nda','conversation':{'id':_0x4f16b2['uniqueid']},'from':{'id':_0x4f16b2[_0xfb98('0xd')],'name':_0x4f16b2['calleridname']},'recipient':{'id':_0x4f16b2[_0xfb98('0xe')],'name':_0x4f16b2[_0xfb98('0xf')]},'text':_0x5570ce[_0xfb98('0x10')],'channelData':{}},'headers':{'Authorization':_0xfb98('0x11')+_0x27b394[_0xfb98('0x12')]},'json':!![]};if(_0x5570ce[_0xfb98('0x13')]){_0x4d06fc[_0xfb98('0x14')][_0xfb98('0x15')][_0xfb98('0x16')]=_0x5570ce[_0xfb98('0x13')];}if(_0x5570ce[_0xfb98('0x17')]=='1'){_0x4d06fc[_0xfb98('0x14')][_0xfb98('0x15')][_0xfb98('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5570ce[_0xfb98('0x19')]){_0x4d06fc['body'][_0xfb98('0x15')][_0xfb98('0x1a')]=_0x5570ce[_0xfb98('0x19')];if(_0x5570ce[_0xfb98('0x1b')]){_0x4d06fc[_0xfb98('0x14')]['channelData'][_0xfb98('0x1c')]=_0x5570ce[_0xfb98('0x1b')];}}logger[_0xfb98('0x1d')](JSON[_0xfb98('0x1e')](_0x4d06fc));return rp(_0x4d06fc);});}; \ No newline at end of file +var _0x9bc3=['CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','exports','resolve','ndauth_url','/token','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','Bearer\x20','access_token','body','channelData','ProjectName','custom_action','custom_action_data'];(function(_0x15aaa7,_0x588cac){var _0x55ccd2=function(_0x45a60a){while(--_0x45a60a){_0x15aaa7['push'](_0x15aaa7['shift']());}};_0x55ccd2(++_0x588cac);}(_0x9bc3,0x137));var _0x39bc=function(_0x29201a,_0x53338b){_0x29201a=_0x29201a-0x0;var _0x391538=_0x9bc3[_0x29201a];return _0x391538;};'use strict';var rp=require(_0x39bc('0x0'));var url=require(_0x39bc('0x1'));var logger=require(_0x39bc('0x2'))('agi');module[_0x39bc('0x3')]=function(_0x168290,_0x2551d6){var _0x31d720={'method':'POST','uri':url[_0x39bc('0x4')](_0x2551d6[_0x39bc('0x5')],_0x39bc('0x6')),'form':{'grant_type':_0x39bc('0x7'),'username':_0x2551d6['username'],'password':_0x2551d6[_0x39bc('0x7')]},'json':!![]};return rp(_0x31d720)[_0x39bc('0x8')](function(_0x86cff3){var _0x10be27={'method':_0x39bc('0x9'),'uri':url[_0x39bc('0x4')](_0x2551d6[_0x39bc('0xa')],_0x39bc('0xb')),'body':{'type':_0x2551d6['ndaactivity_type']||_0x39bc('0xc'),'channelId':_0x39bc('0xd'),'conversation':{'id':_0x168290[_0x39bc('0xe')]},'from':{'id':_0x168290[_0x39bc('0xf')],'name':_0x168290[_0x39bc('0x10')]},'recipient':{'id':_0x168290[_0x39bc('0x11')],'name':_0x168290['extension']},'text':_0x2551d6['text'],'channelData':{}},'headers':{'Authorization':_0x39bc('0x12')+_0x86cff3[_0x39bc('0x13')]},'json':!![]};if(_0x2551d6['project']){_0x10be27[_0x39bc('0x14')][_0x39bc('0x15')][_0x39bc('0x16')]=_0x2551d6['project'];}if(_0x2551d6['ndagenerate_audio']=='1'){_0x10be27['body'][_0x39bc('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2551d6[_0x39bc('0x17')]){_0x10be27[_0x39bc('0x14')]['channelData']['CustomAction']=_0x2551d6[_0x39bc('0x17')];if(_0x2551d6[_0x39bc('0x18')]){_0x10be27[_0x39bc('0x14')]['channelData'][_0x39bc('0x19')]=_0x2551d6[_0x39bc('0x18')];}}logger[_0x39bc('0x1a')](JSON[_0x39bc('0x1b')](_0x10be27));return rp(_0x10be27);});}; \ 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 f17c1ca..a3ed779 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 _0x087e=['./lib/api'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x087e,0x121));var _0xe087=function(_0x2fb7fc,_0x50a284){_0x2fb7fc=_0x2fb7fc-0x0;var _0x1488ea=_0x087e[_0x2fb7fc];return _0x1488ea;};'use strict';var asr=require(_0xe087('0x0'));module['exports']=function(_0xdcd54c,_0x47fe39,_0x4c9912,_0x105a95){return asr(_0xdcd54c,_0x47fe39,_0x4c9912,_0x105a95);}; \ No newline at end of file +var _0x8b66=['exports','./lib/api'];(function(_0xac7678,_0x558b61){var _0x358e1e=function(_0x4498be){while(--_0x4498be){_0xac7678['push'](_0xac7678['shift']());}};_0x358e1e(++_0x558b61);}(_0x8b66,0x1e1));var _0x68b6=function(_0x245b57,_0x420f33){_0x245b57=_0x245b57-0x0;var _0x1d07d9=_0x8b66[_0x245b57];return _0x1d07d9;};'use strict';var asr=require(_0x68b6('0x0'));module[_0x68b6('0x1')]=function(_0x3831fd,_0x163600,_0x438dd5,_0x49c444){return asr(_0x3831fd,_0x163600,_0x438dd5,_0x49c444);}; \ 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 3da5a1a..a77e1d7 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 _0xf736=['bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','status','result','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message'];(function(_0x3301c2,_0x3f8369){var _0x1da11f=function(_0x19220d){while(--_0x19220d){_0x3301c2['push'](_0x3301c2['shift']());}};_0x1da11f(++_0x3f8369);}(_0xf736,0x128));var _0x6f73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf736[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x6f73('0x0'));var _=require(_0x6f73('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6f73('0x2'));var crypto=require(_0x6f73('0x3'));var logger=require(_0x6f73('0x4'))(_0x6f73('0x5'));module['exports']=function(_0x3f28be,_0x448d9e,_0x490232,_0x9191c0){return new BPromise(function(_0x59e254,_0x331d10){logger[_0x6f73('0x6')](_0x6f73('0x7'),_0x9191c0||_0x6f73('0x8'));var _0x2220ca=new WebSocket(_0x9191c0||_0x6f73('0x8'),{'perMessageDeflate':![]});var _0x1325cd='';var _0x4bb927='0';var _0x244232='1';var _0x233150='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x430705(_0x2c9909){var _0x58103e=crypto['createHash'](_0x6f73('0x9'));_0x58103e['update'](_0x2c9909);return _0x58103e[_0x6f73('0xa')](_0x6f73('0xb'));}function _0x25edf6(){try{logger[_0x6f73('0x6')](_0x6f73('0xc'));var _0x244539=moment()[_0x6f73('0xd')]();var _0x4f718c=_0x430705(_0x244539+_0x448d9e+_0x490232);_0x2220ca[_0x6f73('0xe')](JSON[_0x6f73('0xf')]({'appID':_0x448d9e,'timestamp':_0x244539,'appKey':_0x4f718c}));var _0x4bc20f=fs['createReadStream'](_0x3f28be);_0x4bc20f['on'](_0x6f73('0x10'),function(_0x4c06d6){_0x2220ca[_0x6f73('0xe')](_0x4c06d6);});_0x4bc20f['on']('close',function(){_0x2220ca[_0x6f73('0xe')](_0x6f73('0x11'));});}catch(_0xa6dbda){logger['error'](_0x6f73('0x12'),JSON['stringify'](_0xa6dbda));_0x2220ca[_0x6f73('0x13')]();}}function _0x1e02b6(_0x438822){try{if(_0x438822){var _0x285cec=JSON['parse'](_0x438822);switch(_0x285cec[_0x6f73('0x14')]){case 0x0:if(_0x285cec[_0x6f73('0x15')]){if(_0x285cec['result']['final']){logger[_0x6f73('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x285cec[_0x6f73('0x15')][_0x6f73('0x16')]));_0x1325cd=_0x285cec[_0x6f73('0x15')][_0x6f73('0x16')][0x0][_0x6f73('0x17')];_0x4bb927=_0x285cec[_0x6f73('0x15')]['hypotheses'][0x0][_0x6f73('0x18')];_0x244232='0';_0x233150=_0x6f73('0x19');_0x2220ca[_0x6f73('0x13')]();}}break;case 0x1:logger[_0x6f73('0x6')](_0x6f73('0x1a'));_0x244232='1';_0x233150=_0x6f73('0x1a');break;case 0x2:logger[_0x6f73('0x6')](_0x6f73('0x1b'));_0x244232='2';_0x233150=_0x6f73('0x1b');break;case 0x9:logger[_0x6f73('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x244232='9';_0x233150=_0x6f73('0x1c');break;case 0xa:logger['info'](_0x6f73('0x1d'));_0x244232='10';_0x233150=_0x6f73('0x1d');break;case 0xb:logger['info'](_0x6f73('0x1e'));_0x244232='11';_0x233150=_0x6f73('0x1e');}}}catch(_0xb9c81c){logger[_0x6f73('0x1f')](_0x6f73('0x20'),JSON[_0x6f73('0xf')](_0xb9c81c));_0x2220ca[_0x6f73('0x13')]();}}function _0x311a96(){logger[_0x6f73('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x59e254({'transcript':_0x1325cd,'confidence':_0x4bb927,'status':_0x244232,'status_message':_0x233150});}function _0x494531(_0x1624bc){logger[_0x6f73('0x1f')](_0x6f73('0x21'));if(!_[_0x6f73('0x22')](_0x1624bc)){logger[_0x6f73('0x1f')](_[_0x6f73('0x23')](_0x1624bc)?JSON[_0x6f73('0xf')](_0x1624bc):_0x1624bc);}}_0x2220ca['on']('open',_0x25edf6);_0x2220ca['on'](_0x6f73('0x24'),_0x1e02b6);_0x2220ca['on']('close',_0x311a96);_0x2220ca['on'](_0x6f73('0x1f'),_0x494531);});}; \ No newline at end of file +var _0x3395=['Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.'];(function(_0x388428,_0xda6d9f){var _0x4a2ffa=function(_0x53ce1a){while(--_0x53ce1a){_0x388428['push'](_0x388428['shift']());}};_0x4a2ffa(++_0xda6d9f);}(_0x3395,0x1d5));var _0x5339=function(_0x13552b,_0x1f43b3){_0x13552b=_0x13552b-0x0;var _0x4430d5=_0x3395[_0x13552b];return _0x4430d5;};'use strict';var BPromise=require(_0x5339('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5339('0x1'));var logger=require(_0x5339('0x2'))(_0x5339('0x3'));module[_0x5339('0x4')]=function(_0x490188,_0x456ae2,_0x3ef140,_0x5ca0d4){return new BPromise(function(_0xf7d8d1,_0x54f506){logger['info'](_0x5339('0x5'),_0x5ca0d4||_0x5339('0x6'));var _0x1c1791=new WebSocket(_0x5ca0d4||_0x5339('0x6'),{'perMessageDeflate':![]});var _0x35619a='';var _0x53bd32='0';var _0x3d6856='1';var _0x2b257a=_0x5339('0x7');function _0x165dc5(_0x27062b){var _0x3ebde9=crypto[_0x5339('0x8')]('sha1');_0x3ebde9[_0x5339('0x9')](_0x27062b);return _0x3ebde9[_0x5339('0xa')](_0x5339('0xb'));}function _0xd653c2(){try{logger['info'](_0x5339('0xc'));var _0x2c3fa6=moment()[_0x5339('0xd')]();var _0xb23a88=_0x165dc5(_0x2c3fa6+_0x456ae2+_0x3ef140);_0x1c1791[_0x5339('0xe')](JSON[_0x5339('0xf')]({'appID':_0x456ae2,'timestamp':_0x2c3fa6,'appKey':_0xb23a88}));var _0x83453c=fs[_0x5339('0x10')](_0x490188);_0x83453c['on']('data',function(_0x5f500d){_0x1c1791['send'](_0x5f500d);});_0x83453c['on'](_0x5339('0x11'),function(){_0x1c1791['send'](_0x5339('0x12'));});}catch(_0x549798){logger[_0x5339('0x13')](_0x5339('0x14'),JSON[_0x5339('0xf')](_0x549798));_0x1c1791[_0x5339('0x15')]();}}function _0x440936(_0x370577){try{if(_0x370577){var _0xd7ea25=JSON['parse'](_0x370577);switch(_0xd7ea25[_0x5339('0x16')]){case 0x0:if(_0xd7ea25[_0x5339('0x17')]){if(_0xd7ea25[_0x5339('0x17')][_0x5339('0x18')]){logger[_0x5339('0x19')](_0x5339('0x1a'),JSON[_0x5339('0xf')](_0xd7ea25['result'][_0x5339('0x1b')]));_0x35619a=_0xd7ea25['result'][_0x5339('0x1b')][0x0][_0x5339('0x1c')];_0x53bd32=_0xd7ea25[_0x5339('0x17')][_0x5339('0x1b')][0x0][_0x5339('0x1d')];_0x3d6856='0';_0x2b257a=_0x5339('0x1e');_0x1c1791[_0x5339('0x15')]();}}break;case 0x1:logger[_0x5339('0x19')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3d6856='1';_0x2b257a=_0x5339('0x7');break;case 0x2:logger[_0x5339('0x19')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x3d6856='2';_0x2b257a=_0x5339('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3d6856='9';_0x2b257a=_0x5339('0x20');break;case 0xa:logger[_0x5339('0x19')](_0x5339('0x21'));_0x3d6856='10';_0x2b257a='Authentication\x20failed.';break;case 0xb:logger[_0x5339('0x19')](_0x5339('0x22'));_0x3d6856='11';_0x2b257a=_0x5339('0x22');}}}catch(_0x3c6205){logger['error'](_0x5339('0x23'),JSON['stringify'](_0x3c6205));_0x1c1791[_0x5339('0x15')]();}}function _0x3e7dbf(){logger[_0x5339('0x19')](_0x5339('0x24'));_0xf7d8d1({'transcript':_0x35619a,'confidence':_0x53bd32,'status':_0x3d6856,'status_message':_0x2b257a});}function _0x10dc78(_0x186823){logger[_0x5339('0x13')](_0x5339('0x25'));if(!_[_0x5339('0x26')](_0x186823)){logger[_0x5339('0x13')](_[_0x5339('0x27')](_0x186823)?JSON['stringify'](_0x186823):_0x186823);}}_0x1c1791['on'](_0x5339('0x28'),_0xd653c2);_0x1c1791['on'](_0x5339('0x29'),_0x440936);_0x1c1791['on'](_0x5339('0x11'),_0x3e7dbf);_0x1c1791['on'](_0x5339('0x13'),_0x10dc78);});}; \ 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 e596f4c..518876b 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 _0xac3f=['exports','./asr'];(function(_0x4c6640,_0x3a4a77){var _0x100d68=function(_0x45de56){while(--_0x45de56){_0x4c6640['push'](_0x4c6640['shift']());}};_0x100d68(++_0x3a4a77);}(_0xac3f,0xe1));var _0xfac3=function(_0x5da63e,_0x4d3503){_0x5da63e=_0x5da63e-0x0;var _0x442aca=_0xac3f[_0x5da63e];return _0x442aca;};var asr=require(_0xfac3('0x0'));module[_0xfac3('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0592=['./asr','exports'];(function(_0x3e1677,_0x4b973d){var _0x65b8f0=function(_0xf86a21){while(--_0xf86a21){_0x3e1677['push'](_0x3e1677['shift']());}};_0x65b8f0(++_0x4b973d);}(_0x0592,0x1b8));var _0x2059=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0592[_0x42cae2];return _0x5f256f;};var asr=require(_0x2059('0x0'));module[_0x2059('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e592501..9e43d24 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 _0xd8b0=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection'];(function(_0x31ff54,_0x5ebea4){var _0x1aec2d=function(_0x42a915){while(--_0x42a915){_0x31ff54['push'](_0x31ff54['shift']());}};_0x1aec2d(++_0x5ebea4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var net=require(_0x0d8b('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0d8b('0x2'));var AGIServer=function(_0x5b9b89,_0x43bca1,_0x364286){var _0x8196ed=this;var _0x577834=null;var _0x5e15e6=0x0;if(!_0x5b9b89)_0x5b9b89=0x11dd;if(!_0x43bca1)_0x43bca1=_0x0d8b('0x3');EventEmitter[_0x0d8b('0x4')](_0x8196ed);function _0x39f43a(){if(!_0x5b9b89){_0x8196ed['emit'](_0x0d8b('0x5'),new AGIError(_0x0d8b('0x6')));return![];}_0x577834=net['createServer']();_0x577834[_0x0d8b('0x7')](_0x5b9b89,_0x43bca1);_0x577834['on'](_0x0d8b('0x8'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x8'));});_0x577834['on'](_0x0d8b('0xa'),function(_0x1cac62){_0x577834[_0x0d8b('0xb')](function(_0x28f87c,_0x48fa16){if(_0x28f87c){_0x8196ed[_0x0d8b('0x9')]('error',new AGIError(_0x0d8b('0xc'),_0x28f87c));}else if(_0x364286&&_0x364286<0x0){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xd')));_0x1cac62[_0x0d8b('0xe')]();}else if(_0x364286&&_0x364286>0x0&&_0x364286<_0x48fa16){_0x5e15e6+=0x1;_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xf'),_0x5e15e6));_0x1cac62[_0x0d8b('0xe')]();}else{var _0x2ce75e=new AGIChannel(_0x1cac62);_0x2ce75e['on'](_0x0d8b('0x10'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x2ce75e);});}});});_0x577834['on'](_0x0d8b('0x5'),function(_0x4f6f21){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xc'),_0x4f6f21[_0x0d8b('0x11')]));});_0x577834['on'](_0x0d8b('0x12'),function(){_0x8196ed['emit'](_0x0d8b('0x12'),new AGIError(_0x0d8b('0x13')));});}process[_0x0d8b('0x14')](function(){_0x39f43a();});};util[_0x0d8b('0x15')](AGIServer,EventEmitter);module[_0x0d8b('0x16')]=function(_0x18dd2d,_0x264b39,_0xa3612a){return new AGIServer(_0x18dd2d,_0x264b39,_0xa3612a);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xe706,0xa3));var _0x6e70=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0xe706[_0x217a6f];return _0x5553f3;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b2c49ec..700ef06 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 _0x8c11=['sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','googleDialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','getData','response','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','gotoif','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','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','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','AGI','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','mailRpc','rpc','getVariableById','then','catch','name','prototype','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','shellCommand','exec','replace','apiKey','languageCode','en-US','ssmlGender','googleTTS','text','restAPI','timeout','number','includes','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','result','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','noop','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s'];(function(_0x3a2c37,_0x4a7bc6){var _0x3ed66c=function(_0x2eb119){while(--_0x2eb119){_0x3a2c37['push'](_0x3a2c37['shift']());}};_0x3ed66c(++_0x4a7bc6);}(_0x8c11,0xf5));var _0x18c1=function(_0xbb2e47,_0x3b9d31){_0xbb2e47=_0xbb2e47-0x0;var _0x48577e=_0x8c11[_0xbb2e47];return _0x48577e;};'use strict';var fs=require('fs');var util=require(_0x18c1('0x0'));var _=require(_0x18c1('0x1'));var sh=require(_0x18c1('0x2'));var odbc=require(_0x18c1('0x3'))();var rs=require(_0x18c1('0x4'));var moment=require(_0x18c1('0x5'));var Mustache=require(_0x18c1('0x6'));var rp=require('request-promise');var logger=require(_0x18c1('0x7'))(_0x18c1('0x8'));var config=require(_0x18c1('0x9'));var shared=require(_0x18c1('0xa'));var scripts=require(_0x18c1('0xb'));var FILES_PATH=_0x18c1('0xc');var recursiveMapAttributes=[_0x18c1('0xd'),_0x18c1('0xe')];var verticesWithRetry=['menu',_0x18c1('0xf'),_0x18c1('0x10')];var AGIVertices=function(_0x54adc6,_0x119260,_0x343480){this[_0x18c1('0x11')]=_0x54adc6;this['rpc']=_0x119260;this[_0x18c1('0x12')]=_0x343480;};AGIVertices['prototype']['getVariable']=function(_0x1f1507,_0x293269){this[_0x18c1('0x13')][_0x18c1('0x14')](_0x1f1507)[_0x18c1('0x15')](function(_0x4a7a5c){_0x293269(null,_0x4a7a5c?_0x4a7a5c['name']:![]);})[_0x18c1('0x16')](function(_0x3b9cc2){_0x293269(_0x3b9cc2);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x285d83,_0x33d377){this[_0x18c1('0x13')]['getVoiceQueueById'](_0x285d83)['then'](function(_0x4c9196){_0x33d377(null,_0x4c9196?_0x4c9196[_0x18c1('0x17')]:![]);})[_0x18c1('0x16')](function(_0xf5817c){_0x33d377(_0xf5817c);});};AGIVertices[_0x18c1('0x18')]['getSquareProject']=function(_0x459947,_0x6306f1){this[_0x18c1('0x13')]['getSquareProjectById'](_0x459947)[_0x18c1('0x15')](function(_0x20112e){_0x6306f1(null,_0x20112e?_0x20112e[_0x18c1('0x17')]:![]);})[_0x18c1('0x16')](function(_0x230148){_0x6306f1(_0x230148);});};AGIVertices['prototype'][_0x18c1('0x19')]=function(_0x4a58a1,_0x5a986){this['rpc']['getSquareOdbcById'](_0x4a58a1)[_0x18c1('0x15')](function(_0xf52301){_0x5a986(null,_0xf52301?_0xf52301[_0x18c1('0x1a')]:![]);})[_0x18c1('0x16')](function(_0xabcbfd){_0x5a986(_0xabcbfd);});};AGIVertices['prototype'][_0x18c1('0x1b')]=function(_0x4141c6,_0x48a34c){this['rpc'][_0x18c1('0x1c')](_0x4141c6)[_0x18c1('0x15')](function(_0x53a784){_0x48a34c(null,_0x53a784?_0x53a784[_0x18c1('0x17')]:![]);})[_0x18c1('0x16')](function(_0x390133){_0x48a34c(_0x390133);});};AGIVertices[_0x18c1('0x18')]['getTrunk']=function(_0x24c1e4,_0x42ed1b){this[_0x18c1('0x13')][_0x18c1('0x1d')](_0x24c1e4)[_0x18c1('0x15')](function(_0x211a1f){_0x42ed1b(null,_0x211a1f?_0x211a1f[_0x18c1('0x17')]:![]);})[_0x18c1('0x16')](function(_0x5496fe){_0x42ed1b(_0x5496fe);});};AGIVertices[_0x18c1('0x18')]['getSound']=function(_0x504047,_0x47ac81){var _0x512899=this;this[_0x18c1('0x13')][_0x18c1('0x1e')](_0x504047)[_0x18c1('0x15')](function(_0x1d3ffc){_0x47ac81(null,_0x1d3ffc?_0x512899[_0x18c1('0x1f')](_0x1d3ffc[_0x18c1('0x20')]):![]);})['catch'](function(_0x3ab8df){_0x47ac81(_0x3ab8df);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x21')]=function(_0x228850,_0xcc2907){this[_0x18c1('0x13')][_0x18c1('0x22')](_0x228850)['then'](function(_0xcf6ea2){_0xcc2907(null,_0xcf6ea2?_0xcf6ea2:![]);})[_0x18c1('0x16')](function(_0x4d7369){_0xcc2907(_0x4d7369);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x23')]=function(_0x46b133,_0x2fe8d7,_0x7b41ae){this['mailRpc'][_0x18c1('0x23')](_0x46b133,_0x2fe8d7)[_0x18c1('0x15')](function(){_0x7b41ae(null);})[_0x18c1('0x16')](function(_0x3683bb){_0x7b41ae(_0x3683bb);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x24')]=function(_0x38b9ea,_0x1e406c){this[_0x18c1('0x13')][_0x18c1('0x25')](_0x38b9ea)[_0x18c1('0x15')](function(_0x19d2ea){if(_0x19d2ea){if(_0x19d2ea['IntervalId']){_0x1e406c(null,[_0x19d2ea[_0x18c1('0x26')]]);}else{_0x1e406c(null,_[_0x18c1('0x27')](_0x19d2ea[_0x18c1('0x28')],'interval'));}}else{_0x1e406c(null,![]);}})[_0x18c1('0x16')](function(_0x34f205){_0x1e406c(_0x34f205);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x1f')]=function(_0x564aeb){return util[_0x18c1('0x29')](_0x18c1('0x2a'),FILES_PATH,_0x564aeb);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x2b')]=function(_0x8e213d,_0x5a9433,_0x33d108){odbc['open'](_0x8e213d,function(_0x98428e){if(_0x98428e){logger['error'](_0x18c1('0x2c'),_0x98428e);_0x33d108(_0x98428e);}else{logger[_0x18c1('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x18c1('0x2e')](_0x5a9433,function(_0x3253a4,_0x5439a0){if(_0x3253a4){logger['info'](_0x18c1('0x2f'),_0x5a9433);_0x33d108(_0x3253a4);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5a9433);odbc[_0x18c1('0x30')](function(_0x3a220a){if(_0x3a220a){logger[_0x18c1('0x31')](_0x18c1('0x32'),_0x3a220a);}_0x33d108(null,_0x5439a0);});}});}});};AGIVertices[_0x18c1('0x18')]['getSmsAccount']=function(_0x52a47d,_0xd37174){this[_0x18c1('0x13')]['getSmsAccountById'](_0x52a47d)[_0x18c1('0x15')](function(_0x17d79f){_0xd37174(null,_0x17d79f?_0x17d79f:![]);})[_0x18c1('0x16')](function(_0x16ac5b){_0xd37174(_0x16ac5b);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x33')]=function(_0x51e50b,_0x24f326){this['rpc'][_0x18c1('0x33')](_0x51e50b)['then'](function(_0xb71d7){_0x24f326(null,_0xb71d7);})[_0x18c1('0x16')](function(_0x4bf9da){_0x24f326(_0x4bf9da);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x34')]=function(_0x3bf94a,_0x733c1c,_0x291bc6){this[_0x18c1('0x13')]['createSquareDetailsReport']({'uniqueid':this[_0x18c1('0x11')]['uniqueid'],'node':_0x3bf94a['label'],'application':_0x3bf94a[_0x18c1('0x35')],'data':_0x733c1c||null,'project_name':this[_0x18c1('0x11')][_0x18c1('0x36')],'callerid':this['channel'][_0x18c1('0x37')]})[_0x18c1('0x15')](function(_0xd6db55){if(_0x291bc6){_0x291bc6(null,_0xd6db55);}})[_0x18c1('0x16')](function(_0x44f2ec){if(_0x291bc6){_0x291bc6(_0x44f2ec);}});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x38')]=function(_0x34d02d,_0x468ab5,_0x2dfb33,_0xd1804d){this['rpc'][_0x18c1('0x38')]({'uniqueid':this[_0x18c1('0x11')][_0x18c1('0x39')],'callerid':this['channel'][_0x18c1('0x37')],'calleridname':this['channel'][_0x18c1('0x3a')],'context':this[_0x18c1('0x11')][_0x18c1('0x3b')],'extension':this[_0x18c1('0x11')][_0x18c1('0x3c')],'priority':this[_0x18c1('0x11')][_0x18c1('0x3d')],'accountcode':this[_0x18c1('0x11')]['accountcode'],'dnid':this['channel'][_0x18c1('0x3e')],'projectName':this[_0x18c1('0x11')][_0x18c1('0x36')],'saveName':_0x468ab5,'filename':_0x34d02d[_0x18c1('0x3f')]||_0x468ab5,'savePath':_0x2dfb33})[_0x18c1('0x15')](function(_0xa0973c){_0xd1804d(null,_0xa0973c);})[_0x18c1('0x16')](function(_0x29dfbd){_0xd1804d(_0x29dfbd);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x40')]=function(_0x517837,_0x5c1d6d,_0x282b79,_0x2babfc,_0x4d2fb0){this[_0x18c1('0x13')][_0x18c1('0x40')]({'uniqueid':this[_0x18c1('0x11')][_0x18c1('0x39')],'body':_0x517837,'direction':_0x5c1d6d,'providerName':_0x282b79,'providerResponse':_0x2babfc})[_0x18c1('0x15')](function(_0x179e35){if(_0x4d2fb0){_0x4d2fb0(null,_0x179e35);}})[_0x18c1('0x16')](function(_0x37b26f){if(_0x4d2fb0){_0x4d2fb0(_0x37b26f);}});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x41')]=function(_0x535511,_0x141c5b){this['rpc'][_0x18c1('0x41')]({'firstName':_['isEmpty'](_0x535511[_0x18c1('0x17')])||_[_0x18c1('0x42')](_0x535511['name'])?_0x18c1('0x43')+Math[_0x18c1('0x44')]():_0x535511[_0x18c1('0x17')],'lastName':_[_0x18c1('0x45')](_0x535511[_0x18c1('0x46')])||_[_0x18c1('0x42')](_0x535511[_0x18c1('0x46')])?null:_0x535511[_0x18c1('0x46')],'phone':_0x535511[_0x18c1('0x47')],'ListId':_0x535511[_0x18c1('0x48')],'scheduledat':_0x535511[_0x18c1('0x49')],'callbackUniqueid':this['channel'][_0x18c1('0x39')],'tags':_0x18c1('0x4a'),'description':_0x18c1('0x4b')+_0x535511[_0x18c1('0x49')]['toString'](),'priority':_0x535511[_0x18c1('0x4c')]})[_0x18c1('0x15')](function(_0x88486a){_0x141c5b(null,_0x88486a);})[_0x18c1('0x16')](function(_0x21ed3f){_0x141c5b(_0x21ed3f);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x4d')]=function(_0x4bcb88,_0x1a8172){this[_0x18c1('0x13')][_0x18c1('0x4e')](_0x4bcb88)[_0x18c1('0x15')](function(_0x46cfc2){_0x1a8172(null,_0x46cfc2?_0x46cfc2[_0x18c1('0x17')]:![]);})[_0x18c1('0x16')](function(_0x582cb2){_0x1a8172(_0x582cb2);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x4f')]=function(_0x2b6236,_0x573e29,_0x308027){var _0x33d095={'role':'agent'};_0x33d095[_0x2b6236]=this['channel'][_0x18c1('0x37')];this[_0x18c1('0x13')][_0x18c1('0x4f')](_0x33d095,_0x573e29,this[_0x18c1('0x11')][_0x18c1('0x39')])[_0x18c1('0x15')](function(_0x537897){_0x308027(null,_[_0x18c1('0x42')](_0x537897)?![]:!![]);})['catch'](function(_0xc21d88){logger[_0x18c1('0x31')](_0xc21d88);_0x308027(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x35f6f7,_0x135354){var _0x4fa434={'role':'agent'};_0x4fa434[_0x35f6f7]=this[_0x18c1('0x11')]['callerid'];this['rpc'][_0x18c1('0x50')](_0x4fa434)[_0x18c1('0x15')](function(_0xd2863a){_0x135354(null,_[_0x18c1('0x42')](_0xd2863a)?![]:!![]);})[_0x18c1('0x16')](function(_0xbdf6c4){logger['error'](_0xbdf6c4);_0x135354(null,![]);});};AGIVertices['prototype'][_0x18c1('0x51')]=function(_0x418ee2,_0x10b206){var _0x37a011={'role':_0x18c1('0x52')};_0x37a011[_0x418ee2]=this[_0x18c1('0x11')][_0x18c1('0x37')];this[_0x18c1('0x13')]['agentLogout'](_0x37a011)[_0x18c1('0x15')](function(_0x2ccc67){_0x10b206(null,_[_0x18c1('0x42')](_0x2ccc67)?![]:!![]);})[_0x18c1('0x16')](function(_0xe36521){logger[_0x18c1('0x31')](_0xe36521);_0x10b206(null,![]);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x53')]=function(_0x4d2aef,_0x4ffef4){var _0x1ec288={'role':'agent'};_0x1ec288[_0x4d2aef]=this[_0x18c1('0x11')]['callerid'];var _0x3a1146=_0x4d2aef!=_0x18c1('0x54')?util['format']('%s/%s@from-sip/n','LOCAL',this['channel'][_0x18c1('0x37')]):undefined;this[_0x18c1('0x13')][_0x18c1('0x53')](_0x1ec288,_0x3a1146)[_0x18c1('0x15')](function(_0x4d44b0){_0x4ffef4(null,_['isNil'](_0x4d44b0)?![]:!![]);})[_0x18c1('0x16')](function(_0x1d8379){logger[_0x18c1('0x31')](_0x1d8379);_0x4ffef4(null,![]);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x55')]=function(_0x3212fa,_0x58ef9c){sh[_0x18c1('0x56')](_['trim'](_0x3212fa),function(_0x191d70,_0x5ec772){var _0xbe55de=_0x5ec772[_0x18c1('0x57')](/(\r\n|\n|\r)/gm,'');_0x58ef9c(null,_0xbe55de);});};AGIVertices[_0x18c1('0x18')]['googleCloudTTS']=function(_0x311f25,_0x4c815a){scripts['googleCloudTTS'](_0x311f25[_0x18c1('0x58')],_0x311f25['google_cloud_tts_text_type']||'text',_0x311f25['text'],_0x311f25[_0x18c1('0x59')]||_0x18c1('0x5a'),_0x311f25[_0x18c1('0x5b')]||'MALE',_0x311f25['audioEncoding']||'MP3')[_0x18c1('0x15')](function(_0x4bd4ed){_0x4c815a(null,_0x4bd4ed);})[_0x18c1('0x16')](function(_0x4a03a6){_0x4c815a(_0x4a03a6);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x5c')]=function(_0x303680,_0x511894){scripts[_0x18c1('0x5c')](_0x303680[_0x18c1('0x5d')],_0x303680['google_tts_language']||'en',0x1)[_0x18c1('0x15')](function(_0x49858b){_0x511894(null,_0x49858b);})['catch'](function(_0x35b6f9){_0x511894(_0x35b6f9);});};AGIVertices['prototype'][_0x18c1('0x5e')]=function(_0x4bbbd9,_0x1d904d){var _0xd07b9={'uri':_0x4bbbd9['url'],'method':_0x4bbbd9['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4bbbd9[_0x18c1('0x5f')])===_0x18c1('0x60')&&parseInt(_0x4bbbd9[_0x18c1('0x5f')])>=0x1?parseInt(_0x4bbbd9[_0x18c1('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0x18c1('0x61')]([_0x18c1('0x62'),'PUT'],_0xd07b9['method']['toUpperCase']())){try{_0xd07b9[_0x18c1('0x63')]=_0x4bbbd9[_0x18c1('0xe')]?JSON[_0x18c1('0x64')](_0x4bbbd9[_0x18c1('0xe')]):{};}catch(_0x5b888c){logger[_0x18c1('0x31')](_0x18c1('0x65'),_0x5b888c);}}try{_0xd07b9['headers']=_0x4bbbd9[_0x18c1('0xd')]?JSON[_0x18c1('0x64')](_0x4bbbd9[_0x18c1('0xd')]):{};}catch(_0x15a3f6){logger[_0x18c1('0x31')](_0x18c1('0x66'),_0x15a3f6);}if(_0x4bbbd9['computedVariables']){try{var _0x53785c=require(_0x4bbbd9['computedVariables'])[_0x18c1('0x67')](this,_0xd07b9);_0xd07b9['uri']=Mustache[_0x18c1('0x68')](_0x4bbbd9[_0x18c1('0x69')],_0x53785c,{},['$$','$$']);if(_0xd07b9['headers']){_0xd07b9[_0x18c1('0x6a')]=JSON[_0x18c1('0x64')](Mustache['render'](JSON[_0x18c1('0x6b')](_0xd07b9[_0x18c1('0x6a')]),_0x53785c,{},['$$','$$']));}if(_0xd07b9[_0x18c1('0x63')]){_0xd07b9[_0x18c1('0x63')]=JSON[_0x18c1('0x64')](Mustache['render'](JSON[_0x18c1('0x6b')](_0xd07b9[_0x18c1('0x63')]),_0x53785c,{},['$$','$$']));}}catch(_0x51b8e1){logger[_0x18c1('0x31')](_0x18c1('0x6c'),_0x51b8e1);}}rp(_0xd07b9)[_0x18c1('0x15')](function(_0x5e12e0){var _0x488ce4={'statusCode':_0x5e12e0[_0x18c1('0x6d')]||0xc8,'statusMessage':_0x5e12e0['statusMessage']||'OK','headers':_0x5e12e0['headers']||{},'body':_0x5e12e0['body']||{}};_0x1d904d(null,_0x488ce4);})[_0x18c1('0x16')](function(_0xcdbf79){var _0x131eff={'statusCode':_0xcdbf79[_0x18c1('0x6d')]||0x1f4,'statusMessage':_0xcdbf79[_0x18c1('0x6e')]||_0x18c1('0x6f'),'headers':_0xcdbf79['options'][_0x18c1('0x6a')]||{},'body':_0xcdbf79['options'][_0x18c1('0x63')]||{}};_0x1d904d(null,_0x131eff);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x70')]=function(_0x4352af,_0x2023be){scripts['googleDialogflow'](this[_0x18c1('0x11')][_0x18c1('0x39')],_0x4352af['key'],_0x4352af[_0x18c1('0x5d')],_0x4352af['dialogflow_language']||'en')['then'](function(_0x3b2b53){_0x2023be(null,_0x3b2b53);})[_0x18c1('0x16')](function(_0x340e15){_0x2023be(_0x340e15);});};AGIVertices[_0x18c1('0x18')]['googleDialogflowV2']=function(_0x2c62ed,_0x728fa9){scripts['googleDialogflowV2'](this['channel'][_0x18c1('0x39')],_0x2c62ed['dialogflowV2_project_id'],_0x2c62ed[_0x18c1('0x71')],_0x2c62ed[_0x18c1('0x72')],_0x2c62ed['text'],_0x2c62ed[_0x18c1('0x73')]||'en')[_0x18c1('0x15')](function(_0x57e351){_0x728fa9(null,_0x57e351);})['catch'](function(_0x3ed235){_0x728fa9(_0x3ed235);});};AGIVertices[_0x18c1('0x18')]['sestekNDA']=function(_0x40795a,_0x1af131){scripts[_0x18c1('0x74')](this[_0x18c1('0x11')],_0x40795a)[_0x18c1('0x15')](function(_0x40e7d4){_0x1af131(null,_0x40e7d4);})[_0x18c1('0x16')](function(_0x18a2f0){_0x1af131(_0x18a2f0);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x75')]=function(_0x477d69,_0xb1083e){scripts[_0x18c1('0x75')](_0x477d69[_0x18c1('0x76')],_0x477d69[_0x18c1('0x5d')],_0x477d69['ispeech_tts_language']||'en-US',_0x477d69[_0x18c1('0x77')])[_0x18c1('0x15')](function(_0x39be72){_0xb1083e(null,_0x39be72);})['catch'](function(_0x9b7e9f){_0xb1083e(_0x9b7e9f);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x78')]=function(_0x208487,_0x3fa32e,_0xde8f0a){scripts[_0x18c1('0x78')](_0x3fa32e,_0x208487[_0x18c1('0x76')],_0x208487[_0x18c1('0x79')]||_0x18c1('0x5a'),this['isConfigured'](_0x208487[_0x18c1('0x7a')])?_0x208487[_0x18c1('0x7a')]:undefined)[_0x18c1('0x15')](function(_0xf97a8a){_0xde8f0a(null,_0xf97a8a);})['catch'](function(_0x33e331){_0xde8f0a(_0x33e331);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x7b')]=function(_0xe33d5e,_0x566ad4){scripts[_0x18c1('0x7b')](_0xe33d5e[_0x18c1('0x7c')],_0xe33d5e['aws_secret_access_key'],_0xe33d5e[_0x18c1('0x7d')],_0xe33d5e['aws_polly_voice']||_0x18c1('0x7e'),_0xe33d5e[_0x18c1('0x5d')],_0xe33d5e[_0x18c1('0x7f')]||_0x18c1('0x5d'))[_0x18c1('0x15')](function(_0x5df0bf){_0x566ad4(null,_0x5df0bf);})['catch'](function(_0x1acea9){_0x566ad4(_0x1acea9);});};AGIVertices['prototype'][_0x18c1('0x80')]=function(_0x6e905d,_0x43d5ef){scripts[_0x18c1('0x80')](this[_0x18c1('0x11')][_0x18c1('0x39')],_0x6e905d[_0x18c1('0x7c')],_0x6e905d[_0x18c1('0x81')],_0x6e905d[_0x18c1('0x82')],_0x6e905d['text'],_0x6e905d[_0x18c1('0x83')])[_0x18c1('0x15')](function(_0x401a4a){_0x43d5ef(null,_0x401a4a);})[_0x18c1('0x16')](function(_0xc9f2c2){_0x43d5ef(_0xc9f2c2);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x84')]=function(_0x30f516,_0x285a02,_0x251243){scripts[_0x18c1('0x84')](_0x285a02,_0x30f516['key'],_0x30f516[_0x18c1('0x85')]||_0x18c1('0x5a'))['then'](function(_0x1f31cc){_0x251243(null,_0x1f31cc);})[_0x18c1('0x16')](function(_0x502fa2){_0x251243(_0x502fa2);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x86')]=function(_0xb94295,_0x487df1,_0xbb3926){scripts[_0x18c1('0x86')](_0x487df1,_0xb94295[_0x18c1('0x87')],_0xb94295['appsecret'],_0xb94295[_0x18c1('0x88')])[_0x18c1('0x15')](function(_0xca014b){_0xbb3926(null,_0xca014b);})[_0x18c1('0x16')](function(_0x5392d3){_0xbb3926(_0x5392d3);});};AGIVertices[_0x18c1('0x18')][_0x18c1('0x89')]=function(_0x5260d1){var _0x5c94f9=_['includes'](verticesWithRetry,_0x5260d1[_0x18c1('0x35')])?_0x5260d1:_['clone'](_0x5260d1);for(var _0x41d7f3 in _0x5c94f9){if(_0x5c94f9['hasOwnProperty'](_0x41d7f3)){if(_0x5c94f9[_0x41d7f3]&&_[_0x18c1('0x8a')](_0x5c94f9[_0x41d7f3])){if(_['includes'](recursiveMapAttributes,_0x41d7f3)){_0x5c94f9[_0x41d7f3]=this[_0x18c1('0x8b')](_0x5c94f9[_0x41d7f3]);}else{_0x5c94f9[_0x41d7f3]=this[_0x18c1('0x8c')](_0x5c94f9[_0x41d7f3]);}}}}return _0x5c94f9;};AGIVertices['prototype'][_0x18c1('0x8d')]=function(_0x38d607){for(var _0x3f786a in _0x38d607){if(_0x38d607['hasOwnProperty'](_0x3f786a)){if(_[_0x18c1('0x8e')](_0x38d607[_0x3f786a])){this[_0x18c1('0x8d')](_0x38d607[_0x3f786a]);}else if(_[_0x18c1('0x8f')](_0x38d607[_0x3f786a])){for(var _0xd8d878=0x0;_0xd8d878<_0x38d607[_0x3f786a][_0x18c1('0x90')];_0xd8d878++){this[_0x18c1('0x8d')](_0x38d607[_0x3f786a][_0xd8d878]);}}else if(_[_0x18c1('0x8a')](_0x38d607[_0x3f786a])){_0x38d607[_0x3f786a]=this[_0x18c1('0x8c')](_0x38d607[_0x3f786a]);}}}};AGIVertices[_0x18c1('0x18')][_0x18c1('0x91')]=function(_0x2a1a91,_0x37da8b){for(var _0x1f7202 in _0x2a1a91){if(_0x2a1a91[_0x18c1('0x92')](_0x1f7202)){if(_[_0x18c1('0x8e')](_0x2a1a91[_0x1f7202])){if(!_['isEmpty'](_0x2a1a91[_0x1f7202])){this[_0x18c1('0x91')](_0x2a1a91[_0x1f7202],util[_0x18c1('0x29')](_0x18c1('0x93'),_0x37da8b,_0x1f7202));}}else if(_[_0x18c1('0x8f')](_0x2a1a91[_0x1f7202])){for(var _0x2b70e3=0x0;_0x2b70e3<_0x2a1a91[_0x1f7202][_0x18c1('0x90')];_0x2b70e3++){this['saveRestApiResult'](_0x2a1a91[_0x1f7202][_0x2b70e3],util[_0x18c1('0x29')](_0x18c1('0x93'),_0x37da8b,_0x1f7202+'['+_0x2b70e3+']'));}}else{if(!_[_0x18c1('0x42')](_0x2a1a91[_0x1f7202])){this[_0x18c1('0x11')][_0x18c1('0x94')](util[_0x18c1('0x29')](_0x18c1('0x93'),_0x37da8b,_0x1f7202),_0x2a1a91[_0x1f7202]);}}}}};AGIVertices[_0x18c1('0x18')][_0x18c1('0x8b')]=function(_0x10676a){try{var _0x4b1008=JSON[_0x18c1('0x64')](_0x10676a);this[_0x18c1('0x8d')](_0x4b1008);return JSON[_0x18c1('0x6b')](_0x4b1008);}catch(_0x32fee2){return this[_0x18c1('0x8c')](_0x10676a);}};AGIVertices[_0x18c1('0x18')]['replaceAllVariables']=function(_0xa6aef3){var _0x55b9cf=_0xa6aef3[_0x18c1('0x95')]('{');for(var _0x3666e7=0x1;_0x3666e7<_0x55b9cf[_0x18c1('0x90')];_0x3666e7+=0x1){var _0x1f5b74=_0x55b9cf[_0x3666e7][_0x18c1('0x95')]('}');if(_0x1f5b74[_0x18c1('0x90')]>0x1){_0xa6aef3=_0xa6aef3[_0x18c1('0x96')]('{'+_0x1f5b74[0x0]+'}',this['channel'][_0x18c1('0x97')](_0x1f5b74[0x0])[_0x18c1('0x98')]||_0x1f5b74[0x0]);}}if(_0x55b9cf[_0x18c1('0x90')]===0x1){return _0xa6aef3['toString']();}return this[_0x18c1('0x8c')](_0xa6aef3);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x99')]=function(_0x342b2c,_0x2fc9ec){var _0x23b09e=this['channel'][_0x18c1('0x97')](_0x342b2c);if(_0x23b09e['result']===-0x1){return _0x23b09e;}logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x9a'),_0x2fc9ec,_0x23b09e[_0x18c1('0x98')]));return this[_0x18c1('0x11')][_0x18c1('0x94')](_0x2fc9ec,_0x23b09e[_0x18c1('0x98')]);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x9b')]=function(_0x2bd104){return _0x2bd104&&_0x2bd104!=='0'&&_0x2bd104!=='-1'&&_0x2bd104!=='';};AGIVertices[_0x18c1('0x18')]['maxRetry']=function(_0x53cf14){this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x53cf14,'-');_0x53cf14[_0x18c1('0x9c')]=_0x53cf14[_0x18c1('0x9d')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x18c1('0x18')]['mrcpsynth']=function(_0x53e94e){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x9e'),_0x53e94e[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x53e94e[_0x18c1('0x5d')])){return this['channel']['noop'](_0x18c1('0xa0'));}var _0xb91966='\x22'+_0x53e94e[_0x18c1('0x5d')]+'\x22';if(this[_0x18c1('0x9b')](_0x53e94e[_0x18c1('0xa1')])){_0xb91966+=','+_0x53e94e['options'];}var _0x3a960e=this[_0x18c1('0x11')][_0x18c1('0x56')](_0x18c1('0xa2'),_0xb91966);if(_0x3a960e['result']===-0x1){return _0x3a960e;}return this[_0x18c1('0x11')]['noop'](util['format'](_0x18c1('0xa3'),_0xb91966));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xa4')]=function(_0x22183b){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xa5'),_0x22183b[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x22183b['grammar'])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0xa6'));}var _0x1ec08a=_0x22183b[_0x18c1('0xa7')];if(this['isConfigured'](_0x22183b[_0x18c1('0xa1')])){_0x1ec08a+=','+_0x22183b[_0x18c1('0xa1')];}var _0x1370ef=this[_0x18c1('0x11')]['exec'](_0x18c1('0xa8'),_0x1ec08a);if(_0x1370ef['result']===-0x1){return _0x1370ef;}var _0x3ca5d1=this[_0x18c1('0x99')](_0x18c1('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x3ca5d1[_0x18c1('0xaa')]===-0x1){return _0x3ca5d1;}var _0x129ff4=this[_0x18c1('0x99')]('RECOG_INPUT()',_0x18c1('0xab'));if(_0x129ff4['result']===-0x1){return _0x129ff4;}var _0x4b43f2=this[_0x18c1('0x99')](_0x18c1('0xac'),_0x18c1('0xad'));if(_0x4b43f2[_0x18c1('0xaa')]===-0x1){return _0x4b43f2;}return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1ec08a));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x8')]=function(_0x1980ef){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xaf'),_0x1980ef[_0x18c1('0x9f')]));return this[_0x18c1('0x11')][_0x18c1('0x8')]([_0x1980ef[_0x18c1('0xb0')],_0x1980ef[_0x18c1('0xb1')]]);};AGIVertices[_0x18c1('0x18')]['answer']=function(_0x30ef86){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xb2'),_0x30ef86['label']));if(this['isConfigured'](_0x30ef86['timeout'])){logger[_0x18c1('0x2d')](util['format'](_0x18c1('0xb3'),_0x30ef86[_0x18c1('0x5f')]));var _0x4599c5=this['channel'][_0x18c1('0xb4')](_0x30ef86[_0x18c1('0x5f')]);if(_0x4599c5[_0x18c1('0xaa')]===-0x1){return _0x4599c5;}}return this['channel'][_0x18c1('0xb5')]();};AGIVertices[_0x18c1('0x18')][_0x18c1('0x4a')]=function(_0xee8d5e){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xb6'),_0xee8d5e[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0xee8d5e[_0x18c1('0x48')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0xee8d5e,_0x18c1('0xb7'));}_0xee8d5e[_0x18c1('0x49')]=moment();if(this[_0x18c1('0x9b')](_0xee8d5e[_0x18c1('0xb8')])){_0xee8d5e[_0x18c1('0x49')]=moment()[_0x18c1('0xb9')](_0xee8d5e[_0x18c1('0xb8')],_0x18c1('0xba'));}if(!this[_0x18c1('0x9b')](_0xee8d5e[_0x18c1('0x4c')])){_0xee8d5e[_0x18c1('0x4c')]=0x2;}this[_0x18c1('0x41')][_0x18c1('0x67')](this,_0xee8d5e);return this[_0x18c1('0x11')]['noop'](util['format'](_0x18c1('0xbb'),_0xee8d5e[_0x18c1('0x47')],_0xee8d5e['list_id'],_0xee8d5e[_0x18c1('0x49')]));};AGIVertices['prototype']['custom_app']=function(_0x18c0df){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xbc'),_0x18c0df[_0x18c1('0x9f')]));var _0xfd1f4=this['channel'][_0x18c1('0x56')](_0x18c0df[_0x18c1('0xbd')],_0x18c0df['options']);if(_0xfd1f4[_0x18c1('0xaa')]===-0x1){return _0xfd1f4;}return this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0xbe'),_0x18c0df[_0x18c1('0xbd')],_0x18c0df[_0x18c1('0xa1')]));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xbf')]=function(_0x40ae07){logger['info'](util[_0x18c1('0x29')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x40ae07[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x40ae07['text'])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0xa0'));}var _0x35550e='\x22'+_0x40ae07['text']+'\x22';if(this[_0x18c1('0x9b')](_0x40ae07[_0x18c1('0xa1')])){_0x35550e+=','+_0x40ae07[_0x18c1('0xa1')];}var _0x27b0ac=this[_0x18c1('0x11')][_0x18c1('0x56')](_0x18c1('0xa2'),_0x35550e);if(_0x27b0ac['result']===-0x1){return _0x27b0ac;}return this['channel'][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xa3'),_0x35550e));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xc0')]=function(_0x464e6b){logger[_0x18c1('0x2d')](util['format'](_0x18c1('0xc1'),_0x464e6b[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x464e6b[_0x18c1('0x5d')])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20text\x20configured');}var _0x5e03c5='\x22'+_0x464e6b[_0x18c1('0x5d')]+'\x22';if(this['isConfigured'](_0x464e6b['options'])){_0x5e03c5+=','+_0x464e6b[_0x18c1('0xa1')];}var _0x51209a=this['channel'][_0x18c1('0x56')]('MRCPSynth',_0x5e03c5);if(_0x51209a[_0x18c1('0xaa')]===-0x1){return _0x51209a;}return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5e03c5));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xc2')]=function(_0x2c8f7e){logger[_0x18c1('0x2d')](util['format'](_0x18c1('0xc3'),_0x2c8f7e[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x2c8f7e[_0x18c1('0xa7')])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0xa6'));}var _0x3850a0=_0x2c8f7e[_0x18c1('0xa7')];if(this[_0x18c1('0x9b')](_0x2c8f7e[_0x18c1('0xa1')])){_0x3850a0+=','+_0x2c8f7e[_0x18c1('0xa1')];}var _0x526d17=this[_0x18c1('0x11')]['exec'](_0x18c1('0xa8'),_0x3850a0);if(_0x526d17[_0x18c1('0xaa')]===-0x1){return _0x526d17;}var _0x36f881=this[_0x18c1('0x99')](_0x18c1('0xa9'),_0x18c1('0xc4'));if(_0x36f881[_0x18c1('0xaa')]===-0x1){return _0x36f881;}var _0x5064ca=this[_0x18c1('0x99')](_0x18c1('0xc5'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5064ca[_0x18c1('0xaa')]===-0x1){return _0x5064ca;}var _0x450440=this[_0x18c1('0x99')](_0x18c1('0xac'),_0x18c1('0xc6'));if(_0x450440['result']===-0x1){return _0x450440;}return this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0xc7'),_0x3850a0));};AGIVertices['prototype'][_0x18c1('0xc8')]=function(_0x63abf6){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xc9'),_0x63abf6[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x63abf6[_0x18c1('0xa7')])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20grammar\x20configured');}var _0xa1af01=_0x63abf6['grammar'];if(this[_0x18c1('0x9b')](_0x63abf6['options'])){_0xa1af01+=','+_0x63abf6['options'];}var _0x11888f=this['channel'][_0x18c1('0x56')]('MRCPRecog',_0xa1af01);if(_0x11888f[_0x18c1('0xaa')]===-0x1){return _0x11888f;}var _0x409388=this['getAndSetVariable'](_0x18c1('0xa9'),'SESTEK_ASR_CONFIDENCE');if(_0x409388['result']===-0x1){return _0x409388;}var _0x5ece75=this['getAndSetVariable']('RECOG_INPUT()',_0x18c1('0xca'));if(_0x5ece75[_0x18c1('0xaa')]===-0x1){return _0x5ece75;}var _0x375159=this[_0x18c1('0x99')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x375159['result']===-0x1){return _0x375159;}return this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0xc7'),_0xa1af01));};AGIVertices[_0x18c1('0x18')]['database']=function(_0x39bc2e){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xcb'),_0x39bc2e[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x39bc2e[_0x18c1('0xcc')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x39bc2e,_0x18c1('0xcd'));}var _0xfd33d9=this[_0x18c1('0x19')][_0x18c1('0x67')](this,_0x39bc2e[_0x18c1('0xcc')]);if(!_0xfd33d9){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x39bc2e,_0x18c1('0xce'));}if(!this[_0x18c1('0x9b')](_0x39bc2e[_0x18c1('0x2e')])){return this['channel'][_0x18c1('0x31')](_0x39bc2e,'no\x20query\x20configured');}var _0x2a5f69=_0x39bc2e[_0x18c1('0x2e')][_0x18c1('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xcf'),_0x2a5f69));var _0x457a4c=this['getQueryOdbc'][_0x18c1('0x67')](this,_0xfd33d9,_0x2a5f69);this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x39bc2e,_0x2a5f69);if(!this[_0x18c1('0x9b')](_0x39bc2e['variable_id'])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0xd0'));}var _0x133d89=this[_0x18c1('0x97')][_0x18c1('0x67')](this,_0x39bc2e[_0x18c1('0xd1')]);if(!_0x133d89){return this[_0x18c1('0x11')]['error'](_0x39bc2e,_0x18c1('0xd2'));}var _0x407ed8=this;_0x457a4c[_0x18c1('0xd3')](function(_0x67b845,_0x2cfdde){Object['keys'](_0x67b845)[_0x18c1('0xd3')](function(_0x92cb25){_0x407ed8[_0x18c1('0x11')][_0x18c1('0x94')](util[_0x18c1('0x29')]('%s[%s][%s]',_0x133d89,_0x2cfdde,_0x92cb25),_0x67b845[_0x92cb25]);});});this[_0x18c1('0x11')][_0x18c1('0x94')](util['format']('%s_ROWS_COUNT',_0x133d89),_0x457a4c['length']);return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xd4'),_0x133d89));};AGIVertices[_0x18c1('0x18')]['dial']=function(_0xbecc7e){logger[_0x18c1('0xd5')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xbecc7e[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0xbecc7e[_0x18c1('0xd6')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0xbecc7e,_0x18c1('0xd7'));}var _0x1f86d2=this[_0x18c1('0x1b')]['sync'](this,_0xbecc7e['sip_id']);if(!_0x1f86d2){return this[_0x18c1('0x11')]['error'](_0xbecc7e,_0x18c1('0xd8'));}var _0x384121=this['channel'][_0x18c1('0x56')](_0x18c1('0xd9'),[util['format']('SIP/%s',_0x1f86d2),_0xbecc7e[_0x18c1('0x5f')],_0xbecc7e[_0x18c1('0xda')],_0xbecc7e['url']]);if(_0x384121[_0x18c1('0xaa')]===-0x1){return _0x384121;}return this['channel'][_0x18c1('0xae')](util[_0x18c1('0x29')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xdb')]=function(_0x5a3aaa){logger[_0x18c1('0x2d')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5a3aaa['label']));if(!this[_0x18c1('0x9b')](_0x5a3aaa['key'])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20key\x20configured');}if(!this[_0x18c1('0x9b')](_0x5a3aaa[_0x18c1('0x5d')])){return this['channel'][_0x18c1('0xae')]('no\x20text\x20configured');}this[_0x18c1('0x11')][_0x18c1('0xdc')]=!![];this[_0x18c1('0x34')](_0x5a3aaa);this[_0x18c1('0x40')](_0x5a3aaa[_0x18c1('0x5d')],'in','','');this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0xdd'),_0x5a3aaa[_0x18c1('0x5d')]));var _0x4eca7a=this['googleDialogflow']['sync'](this,_0x5a3aaa);if(_0x4eca7a){for(var _0x27f85c in _0x4eca7a){if(_0x4eca7a['hasOwnProperty'](_0x27f85c)){this[_0x18c1('0x11')][_0x18c1('0x94')](util[_0x18c1('0x29')](_0x18c1('0xde'),_0x27f85c[_0x18c1('0xdf')]()),_0x4eca7a[_0x27f85c]);}}this['createSquareMessage'](_0x4eca7a[_0x18c1('0xe0')],'out',_0x18c1('0xdb'),'');return this[_0x18c1('0x11')]['noop'](util['format'](_0x18c1('0xe1'),_0x4eca7a['speech']));}return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x5a3aaa,_0x18c1('0xe2'));};AGIVertices[_0x18c1('0x18')]['dialogflowV2']=function(_0x3e8391){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0xe3'),_0x3e8391[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x3e8391[_0x18c1('0xe4')])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0xe5'));}if(!this[_0x18c1('0x9b')](_0x3e8391[_0x18c1('0x71')])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0xe6'));}if(!this[_0x18c1('0x9b')](_0x3e8391[_0x18c1('0x72')])){return this['channel'][_0x18c1('0xae')](_0x18c1('0xe7'));}if(!this['isConfigured'](_0x3e8391[_0x18c1('0x73')])){return this['channel'][_0x18c1('0xae')]('no\x20anguage\x20configured');}if(!this[_0x18c1('0x9b')](_0x3e8391[_0x18c1('0x5d')])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0xa0'));}this[_0x18c1('0x11')]['bot']=!![];this[_0x18c1('0x34')](_0x3e8391);this[_0x18c1('0x40')](_0x3e8391[_0x18c1('0x5d')],'in','','');this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x3e8391[_0x18c1('0x5d')]));var _0x3b31fa=this[_0x18c1('0xe8')]['sync'](this,_0x3e8391);if(_0x3b31fa){for(var _0x38a295 in _0x3b31fa){if(_0x3b31fa['hasOwnProperty'](_0x38a295)){if(_0x38a295!==_0x18c1('0xe9')){this[_0x18c1('0x11')][_0x18c1('0x94')](util[_0x18c1('0x29')]('DIALOGFLOW_%s',_0x38a295[_0x18c1('0xdf')]()),_0x3b31fa[_0x38a295]);}}}this[_0x18c1('0x40')](_0x3b31fa[_0x18c1('0xe0')],'out','dialogflowV2',_0x3b31fa[_0x18c1('0xe9')]);return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xea'),_0x3b31fa[_0x18c1('0xe0')]));}return this['channel'][_0x18c1('0x31')](_0x3e8391,_0x18c1('0xeb'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xec')]=function(_0x22e045){logger['info'](util[_0x18c1('0x29')](_0x18c1('0xed'),_0x22e045[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x22e045[_0x18c1('0xee')])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x22e045[_0x18c1('0xef')])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0xf0'));}if(!this[_0x18c1('0x9b')](_0x22e045[_0x18c1('0xf1')])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0x18c1('0x9b')](_0x22e045[_0x18c1('0xf2')])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20text\x20configured');}this[_0x18c1('0x11')][_0x18c1('0xdc')]=!![];this[_0x18c1('0x34')](_0x22e045);this[_0x18c1('0x40')](_0x22e045[_0x18c1('0x5d')],'in','','');this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0xf3'),_0x22e045[_0x18c1('0x5d')]));var _0x5c756f=this[_0x18c1('0x74')][_0x18c1('0x67')](this,_0x22e045);if(_0x5c756f){for(var _0x32fcaa in _0x5c756f){if(_0x5c756f[_0x18c1('0x92')](_0x32fcaa)){this[_0x18c1('0x11')]['setVariable'](util[_0x18c1('0x29')](_0x18c1('0xf4'),_0x32fcaa[_0x18c1('0xdf')]()),_0x5c756f[_0x32fcaa]);}}this['createSquareMessage'](_0x5c756f['speech'],_0x18c1('0xf5'),_0x18c1('0xec'),'');if(_0x5c756f['audiofile']){this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xf6'),_0x5c756f['audiofile']));var _0xcdb19b=this[_0x18c1('0x11')][_0x18c1('0xf7')](_0x5c756f['audiofile']);try{fs[_0x18c1('0xf8')](_0x5c756f[_0x18c1('0xf9')]+_0x18c1('0xfa'));}catch(_0xb8bbdb){logger[_0x18c1('0x31')](_0xb8bbdb);}return _0xcdb19b;}else{return this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0xfb'),_0x5c756f['speech']));}}return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x22e045,_0x18c1('0xfc'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xfd')]=function(_0x464b9f){logger['info'](util[_0x18c1('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0x464b9f[_0x18c1('0x9f')]));return this[_0x18c1('0x11')]['noop'](_0x18c1('0xfd'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xfe')]=function(_0xafe3f4){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xafe3f4[_0x18c1('0x9f')]));var _0x344c9f='';if(_0xafe3f4[_0x18c1('0xff')]){if(!this[_0x18c1('0x9b')](_0xafe3f4['trunk_id'])){return this[_0x18c1('0x11')]['error'](_0xafe3f4,'no\x20trunk\x20selected');}else{var _0x569f17=parseInt(_0xafe3f4[_0x18c1('0xff')],0xa);if(isNaN(_0x569f17)){_0x344c9f=_0xafe3f4[_0x18c1('0xff')];}else{_0x344c9f=this[_0x18c1('0x100')]['sync'](this,_0xafe3f4[_0x18c1('0xff')]);if(!_0x344c9f){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0xafe3f4,_0x18c1('0x101'));}}}}else if(_0xafe3f4[_0x18c1('0x102')]){_0x344c9f=_0xafe3f4['trunk_name'];}else{return this['channel'][_0x18c1('0x31')](_0xafe3f4,_0x18c1('0x103'));}var _0x5be441=this[_0x18c1('0x11')][_0x18c1('0x56')](_0x18c1('0xd9'),[util[_0x18c1('0x29')](_0x18c1('0x104'),_0x344c9f,_0xafe3f4[_0x18c1('0x47')]),_0xafe3f4[_0x18c1('0x5f')],_0xafe3f4[_0x18c1('0xda')],_0xafe3f4[_0x18c1('0x69')]]);if(_0x5be441['result']===-0x1){return _0x5be441;}return this['channel']['noop'](util[_0x18c1('0x29')]('Executed\x20command\x20%s',_0x18c1('0xd9')));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x105')]=function(_0x15ed8b){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x106'),_0x15ed8b['label']));return this['channel'][_0x18c1('0xae')](_0x18c1('0x105'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0xf')]=function(_0x13cc1c){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x13cc1c[_0x18c1('0x9f')]));if(_0x13cc1c[_0x18c1('0x9c')]===0x0){return this[_0x18c1('0x9d')](_0x13cc1c);}_0x13cc1c[_0x18c1('0x9c')]-=0x1;if(!this[_0x18c1('0x9b')](_0x13cc1c['file_id'])){return this['channel']['error'](_0x13cc1c,_0x18c1('0x107'));}var _0x19f876=this[_0x18c1('0x108')]['sync'](this,_0x13cc1c[_0x18c1('0x109')]);if(!_0x19f876){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x13cc1c,'no\x20file\x20audio\x20found');}if(!this[_0x18c1('0x9b')](_0x13cc1c[_0x18c1('0xd1')])){return this['channel']['error'](_0x18c1('0xd0'));}var _0x269b2d=this[_0x18c1('0x11')][_0x18c1('0x10a')](_0x19f876,_0x13cc1c[_0x18c1('0x10b')],_0x13cc1c[_0x18c1('0x10c')]);var _0x191dbc=_0x269b2d[_0x18c1('0xaa')]?_0x269b2d[_0x18c1('0xaa')][_0x18c1('0x10d')]():'';logger['info'](_0x18c1('0x10e'),JSON[_0x18c1('0x6b')](_0x269b2d));if(_0x269b2d[_0x18c1('0xaa')]===-0x1){this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x13cc1c,_0x191dbc);return _0x269b2d;}else if(_0x269b2d[_0x18c1('0x98')]===_0x18c1('0x5f')){_0x269b2d['result']=_0x191dbc[_0x18c1('0x90')]>=parseInt(_0x13cc1c[_0x18c1('0x10f')])?'x':'i';}else{_0x269b2d[_0x18c1('0xaa')]=_0x191dbc[_0x18c1('0x90')]>=parseInt(_0x13cc1c['mindigit'])&&_0x191dbc[_0x18c1('0x90')]<=parseInt(_0x13cc1c[_0x18c1('0x10c')])?'x':'i';}var _0x400ef6=this[_0x18c1('0x97')]['sync'](this,_0x13cc1c[_0x18c1('0xd1')]);if(!_0x400ef6){return this['channel']['error'](_0x13cc1c,_0x18c1('0xd2'));}this[_0x18c1('0x11')][_0x18c1('0x94')](_0x400ef6,_0x191dbc);if(this[_0x18c1('0x9b')](_0x13cc1c['hiddendigitsnum'])){var _0x4c7d47=parseInt(_0x13cc1c[_0x18c1('0x110')],0xa);var _0x4212af=rs[_0x18c1('0x111')]({'charset':'*','length':_0x4c7d47});var _0x51ebbd=_0x191dbc[_0x18c1('0x90')];if(_0x51ebbd>0x0){if(_0x51ebbd>_0x4c7d47){this[_0x18c1('0x34')]['sync'](this,_0x13cc1c,_0x13cc1c['hiddendigitspos']===_0x18c1('0x112')?_0x4212af+_0x191dbc[_0x18c1('0x113')](_0x4c7d47):_0x191dbc['substr'](0x0,_0x51ebbd-_0x4c7d47)+_0x4212af);}else{this[_0x18c1('0x34')]['sync'](this,_0x13cc1c,rs[_0x18c1('0x111')]({'charset':'*','length':_0x51ebbd}));}}else{this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x13cc1c,'');}}else{this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x13cc1c,_0x191dbc);}return _0x269b2d;};AGIVertices[_0x18c1('0x18')][_0x18c1('0x10')]=function(_0x1fab6b){logger[_0x18c1('0x2d')](util['format'](_0x18c1('0x114'),_0x1fab6b[_0x18c1('0x9f')]));return this[_0x18c1('0xf')](_0x1fab6b);};AGIVertices[_0x18c1('0x18')]['goal']=function(_0x579e0b){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x579e0b[_0x18c1('0x9f')]));this['createSquareDetailsReport'][_0x18c1('0x67')](this,_0x579e0b,_0x579e0b[_0x18c1('0x115')]);return this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0x116'),_0x579e0b[_0x18c1('0x115')]));};AGIVertices[_0x18c1('0x18')]['awspolly']=function(_0x174185){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x117'),_0x174185[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x174185['aws_access_key_id'])||!this[_0x18c1('0x9b')](_0x174185[_0x18c1('0x81')])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x118'));}if(!this[_0x18c1('0x9b')](_0x174185['text'])){return this['channel'][_0x18c1('0xae')](_0x18c1('0xa0'));}this[_0x18c1('0x11')]['noop'](util['format'](_0x18c1('0x119'),_0x174185['text']));var _0x1b8b9d=this[_0x18c1('0x7b')][_0x18c1('0x67')](this,_0x174185);if(_0x1b8b9d){this['channel']['noop'](util[_0x18c1('0x29')](_0x18c1('0x11a'),_0x1b8b9d));var _0x215735=this[_0x18c1('0x11')][_0x18c1('0xf7')](_0x1b8b9d);try{fs['unlink'](_0x1b8b9d+_0x18c1('0xfa'));}catch(_0x4fa158){logger['error'](_0x4fa158);}return _0x215735;}return this['channel']['error'](_0x174185,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x18c1('0x11b')]=function(_0x58b693){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x11c'),_0x58b693[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x58b693['aws_access_key_id'])||!this[_0x18c1('0x9b')](_0x58b693[_0x18c1('0x81')])){return this['channel'][_0x18c1('0xae')](_0x18c1('0x118'));}if(!this[_0x18c1('0x9b')](_0x58b693[_0x18c1('0x83')])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x11d'));}if(!this[_0x18c1('0x9b')](_0x58b693['text'])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20text\x20configured');}this[_0x18c1('0x11')]['bot']=!![];this['createSquareDetailsReport'](_0x58b693);this[_0x18c1('0x40')](_0x58b693['text'],'in','','');this[_0x18c1('0x11')]['noop'](util['format'](_0x18c1('0x11e'),_0x58b693[_0x18c1('0x5d')]));var _0x2acfa1=this[_0x18c1('0x80')]['sync'](this,_0x58b693);if(_0x2acfa1){for(var _0x3954e6 in _0x2acfa1){if(_0x2acfa1[_0x18c1('0x92')](_0x3954e6)&&_[_0x18c1('0x8a')](_0x2acfa1[_0x3954e6])){this[_0x18c1('0x11')][_0x18c1('0x94')](util['format'](_0x18c1('0x11f'),_0x3954e6[_0x18c1('0xdf')]()),_0x2acfa1[_0x3954e6]);}}if(_['isNil'](_0x2acfa1[_0x18c1('0x6e')])){return this['channel']['noop'](_0x18c1('0x120'));}else{this['createSquareMessage'](_0x2acfa1['message'],_0x18c1('0xf5'),_0x18c1('0x121'),'');return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x122'),_0x2acfa1[_0x18c1('0x6e')]));}}return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x58b693,_0x18c1('0x123'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x124')]=function(_0x465b69){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x125'),_0x465b69[_0x18c1('0x9f')],_0x465b69[_0x18c1('0x5f')]));if(!this[_0x18c1('0x9b')](_0x465b69['key'])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x126'));}var _0x5f245a=_0x18c1('0x127');var _0x318bbf=util[_0x18c1('0x29')](_0x18c1('0x128'),FILES_PATH,rs[_0x18c1('0x111')](0x4));var _0x559b9b=util[_0x18c1('0x29')](_0x18c1('0x93'),_0x318bbf,_0x5f245a);var _0x12ba9a=!![];if(_0x465b69[_0x18c1('0x129')]===_0x18c1('0x12a')){_0x12ba9a=![];}var _0x42b024=this[_0x18c1('0x11')][_0x18c1('0x12b')](_0x318bbf,_0x5f245a,_0x465b69['intKey'],_0x465b69[_0x18c1('0x5f')],undefined,_0x12ba9a);if(_0x42b024[_0x18c1('0xaa')]!==-0x1){this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x12c'),_0x559b9b));var _0xcddcef=this['googleASR'][_0x18c1('0x67')](this,_0x465b69,_0x559b9b);if(_0xcddcef){for(var _0x5ce22a in _0xcddcef){if(_0xcddcef[_0x18c1('0x92')](_0x5ce22a)){this[_0x18c1('0x11')][_0x18c1('0x94')](util[_0x18c1('0x29')](_0x18c1('0x12d'),_0x5ce22a[_0x18c1('0xdf')]()),_0xcddcef[_0x5ce22a]);}}return this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0x12e'),JSON[_0x18c1('0x6b')](_0xcddcef)));}}return _0x42b024;};AGIVertices[_0x18c1('0x18')][_0x18c1('0x12f')]=function(_0x5361d6){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x130'),_0x5361d6[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x5361d6[_0x18c1('0x87')])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0x131'));}if(!this[_0x18c1('0x9b')](_0x5361d6['appsecret'])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20appsecret\x20configured');}var _0x4d7489='wav';var _0x1bba80=util[_0x18c1('0x29')](_0x18c1('0x128'),FILES_PATH,rs[_0x18c1('0x111')](0x4));var _0xe8f76b=util[_0x18c1('0x29')](_0x18c1('0x93'),_0x1bba80,_0x4d7489);var _0x2bdcbe=!![];if(_0x5361d6[_0x18c1('0x129')]==='NOBEEP'){_0x2bdcbe=![];}var _0x5b806c=this[_0x18c1('0x11')][_0x18c1('0x12b')](_0x1bba80,_0x4d7489,_0x5361d6[_0x18c1('0x132')],_0x5361d6[_0x18c1('0x5f')],undefined,_0x2bdcbe);if(_0x5b806c[_0x18c1('0xaa')]!==-0x1){this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x133'),_0xe8f76b));var _0x48cfb6=this[_0x18c1('0x86')]['sync'](this,_0x5361d6,_0xe8f76b);if(_0x48cfb6){for(var _0x299555 in _0x48cfb6){if(_0x48cfb6[_0x18c1('0x92')](_0x299555)){this[_0x18c1('0x11')][_0x18c1('0x94')](util[_0x18c1('0x29')](_0x18c1('0x134'),_0x299555[_0x18c1('0xdf')]()),_0x48cfb6[_0x299555]);}}return this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')]('TildeASR\x20Result\x20%s',JSON[_0x18c1('0x6b')](_0x48cfb6)));}}return _0x5b806c;};AGIVertices[_0x18c1('0x18')][_0x18c1('0x135')]=function(_0x36c85a){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x36c85a[_0x18c1('0x9f')]));return this[_0x18c1('0x11')]['continueAt'](_0x36c85a['context'],_0x36c85a['extension'],_0x36c85a[_0x18c1('0x3d')]);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x136')]=function(_0x34145f){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x34145f[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x34145f[_0x18c1('0x137')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x34145f,'no\x20condition\x20configured');}try{var _0x2b1742=eval(_0x34145f[_0x18c1('0x137')])?_0x18c1('0x138'):_0x18c1('0x139');this['channel'][_0x18c1('0xae')](util[_0x18c1('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x34145f[_0x18c1('0x137')],_0x2b1742));return{'code':0xc8,'result':_0x2b1742};}catch(_0x1bff35){return{'code':0xc8,'result':_0x18c1('0x139')};}};AGIVertices[_0x18c1('0x18')]['gotoiftime']=function(_0x2330b5){logger['info'](util['format'](_0x18c1('0x13a'),_0x2330b5[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x2330b5[_0x18c1('0x13b')])){return this['channel'][_0x18c1('0x31')](_0x2330b5,_0x18c1('0x13c'));}var _0x54bbd7=this['getIntervals'][_0x18c1('0x67')](this,_0x2330b5['interval_id']);if(!_0x54bbd7){return this['channel'][_0x18c1('0x31')](_0x2330b5,_0x18c1('0x13d'));}for(var _0x3dcbac=0x0;_0x3dcbac<_0x54bbd7[_0x18c1('0x90')];_0x3dcbac+=0x1){var _0xce61d8=this['channel'][_0x18c1('0x97')](util[_0x18c1('0x29')]('IFTIME(%s?true:false)',_0x54bbd7[_0x3dcbac]));if(_0xce61d8[_0x18c1('0xaa')]===-0x1){return _0xce61d8;}logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('IFTIME\x20%s\x20%s',_0x54bbd7[_0x3dcbac],_0xce61d8[_0x18c1('0x98')]));if(_0xce61d8[_0x18c1('0x98')]===_0x18c1('0x138')){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x13e'),_0x54bbd7[_0x3dcbac],_0x18c1('0x138')));this['channel'][_0x18c1('0xae')](util['format'](_0x18c1('0x13e'),_0x54bbd7[_0x3dcbac],_0x18c1('0x138')));return{'code':0xc8,'result':'true'};}else{logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('IFTIME\x20%s\x20%s',_0x54bbd7[_0x3dcbac],'false'));this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x13e'),_0x54bbd7[_0x3dcbac],_0x18c1('0x139')));}}return{'code':0xc8,'result':_0x18c1('0x139')};};AGIVertices[_0x18c1('0x18')][_0x18c1('0x13f')]=function(_0x5e81ad){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x140'),_0x5e81ad[_0x18c1('0x9f')]));return this[_0x18c1('0x11')]['hangup']();};AGIVertices[_0x18c1('0x18')][_0x18c1('0x141')]=function(_0x2a5fc2){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x142'),_0x2a5fc2['label']));if(!this['isConfigured'](_0x2a5fc2[_0x18c1('0x76')])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0x126'));}var _0x568af0=_0x18c1('0x127');var _0x34e7dc=util[_0x18c1('0x29')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x3fe08b=util['format']('%s.%s',_0x34e7dc,_0x568af0);var _0x12cd44=!![];if(_0x2a5fc2['beep']===_0x18c1('0x12a')){_0x12cd44=![];}var _0x1eec1f=this[_0x18c1('0x11')][_0x18c1('0x12b')](_0x34e7dc,_0x568af0,_0x2a5fc2['intKey'],_0x2a5fc2['timeout'],undefined,_0x12cd44);if(_0x1eec1f[_0x18c1('0xaa')]!==-0x1){this['channel'][_0x18c1('0xae')](util['format'](_0x18c1('0x143'),_0x3fe08b));var _0x16cd13=this['ispeechASR']['sync'](this,_0x2a5fc2,_0x3fe08b);if(_0x16cd13){for(var _0x173261 in _0x16cd13){if(_0x16cd13[_0x18c1('0x92')](_0x173261)){this[_0x18c1('0x11')][_0x18c1('0x94')](util[_0x18c1('0x29')](_0x18c1('0x144'),_0x173261['toUpperCase']()),_0x16cd13[_0x173261]);}}return this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')]('IspeechASR\x20Result\x20%s',JSON[_0x18c1('0x6b')](_0x16cd13)));}}return _0x1eec1f;};AGIVertices['prototype'][_0x18c1('0x145')]=function(_0x421136){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x146'),_0x421136[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x421136[_0x18c1('0x76')])){return this['channel'][_0x18c1('0xae')](_0x18c1('0x126'));}if(!this[_0x18c1('0x9b')](_0x421136[_0x18c1('0x5d')])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x18c1('0x29')]('Trying\x20ispeech\x20TTS\x20%s',_0x421136['text']));var _0x4229d5=this[_0x18c1('0x75')]['sync'](this,_0x421136);if(_0x4229d5){this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0x143'),_0x4229d5));var _0x2a9856=this[_0x18c1('0x11')][_0x18c1('0xf7')](_0x4229d5,_0x421136[_0x18c1('0x132')]);try{fs[_0x18c1('0xf8')](_0x4229d5+_0x18c1('0xfa'));}catch(_0x448fba){logger[_0x18c1('0x31')](_0x448fba);}return _0x2a9856;}return this[_0x18c1('0x11')]['error'](_0x421136,_0x18c1('0x147'));};AGIVertices[_0x18c1('0x18')]['login']=function(_0x2deb41){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x148'),_0x2deb41[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x2deb41[_0x18c1('0x149')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x2deb41,_0x18c1('0x14a'));}logger[_0x18c1('0x2d')](util['format'](_0x18c1('0x14b'),this['channel'][_0x18c1('0x37')],_0x2deb41[_0x18c1('0x149')]));var _0x53b475=this[_0x18c1('0x53')][_0x18c1('0x67')](this,_0x2deb41['findBy']);if(_0x53b475){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x18c1('0x11')]['callerid'],_0x2deb41[_0x18c1('0x149')]));this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x14c'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x2deb41[_0x18c1('0x149')]));return{'code':0xc8,'result':'success'};}else{logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x14d'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x2deb41[_0x18c1('0x149')]));this['channel'][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x14d'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x2deb41[_0x18c1('0x149')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x18c1('0x14e')]=function(_0x2f83d8){logger[_0x18c1('0x2d')](util['format'](_0x18c1('0x14f'),_0x2f83d8[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x2f83d8[_0x18c1('0x149')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x2f83d8,'no\x20find\x20by\x20configured');}logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x14b'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x2f83d8['findBy']));var _0x307923=this[_0x18c1('0x51')]['sync'](this,_0x2f83d8[_0x18c1('0x149')]);if(_0x307923){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x14c'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x2f83d8['findBy']));this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x14c'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x2f83d8[_0x18c1('0x149')]));return{'code':0xc8,'result':_0x18c1('0x150')};}else{logger['info'](util['format'](_0x18c1('0x14d'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x2f83d8['findBy']));this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x18c1('0x11')]['callerid'],_0x2f83d8[_0x18c1('0x149')]));return{'code':0xc8,'result':_0x18c1('0x151')};}};AGIVertices[_0x18c1('0x18')][_0x18c1('0x152')]=function(_0x2ef84f){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x153'),_0x2ef84f[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x2ef84f[_0x18c1('0x154')])){return this['channel'][_0x18c1('0x31')](_0x2ef84f,_0x18c1('0x155'));}this['channel']['noop'](util['format'](_0x18c1('0x156'),_0x2ef84f['operation']));var _0x174891=eval(_0x2ef84f[_0x18c1('0x154')]);if(!this['isConfigured'](_0x2ef84f[_0x18c1('0xd1')])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0xd0'));}var _0xcf9da4=this[_0x18c1('0x97')][_0x18c1('0x67')](this,_0x2ef84f['variable_id']);if(!_0xcf9da4){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x2ef84f,_0x18c1('0xd2'));}if(_['isArray'](_0x174891)){var _0x34567a=this;_0x174891[_0x18c1('0xd3')](function(_0xa691aa,_0x1b7435){_0x34567a[_0x18c1('0x11')]['setVariable'](util[_0x18c1('0x29')](_0x18c1('0x157'),_0xcf9da4,_0x1b7435),_0xa691aa);});return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x158'),_0xcf9da4));}else{return this[_0x18c1('0x11')][_0x18c1('0x94')](_0xcf9da4,_0x174891);}};AGIVertices[_0x18c1('0x18')][_0x18c1('0x159')]=function(_0x28c217){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x15a'),_0x28c217[_0x18c1('0x9f')]));if(_0x28c217[_0x18c1('0x9c')]===0x0){return this[_0x18c1('0x9d')](_0x28c217);}_0x28c217['retry']-=0x1;if(!this[_0x18c1('0x9b')](_0x28c217['file_id'])){return this[_0x18c1('0x11')]['error'](_0x28c217,_0x18c1('0x107'));}var _0x161564=this[_0x18c1('0x108')][_0x18c1('0x67')](this,_0x28c217[_0x18c1('0x109')]);if(!_0x161564){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x28c217,'no\x20file\x20audio\x20found');}var _0x55b119=this[_0x18c1('0x11')][_0x18c1('0x10a')](_0x161564,_0x28c217['response'],_0x28c217[_0x18c1('0x15b')]);var _0x350126=_0x55b119['result'];if(_0x55b119['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x28c217,'-1');return _0x55b119;}else if(_0x55b119[_0x18c1('0x98')]==='timeout'){_0x55b119['result']=_0x55b119[_0x18c1('0xaa')][_0x18c1('0x90')]>0x0?_0x55b119['result']:'t';}else if(_[_0x18c1('0x45')](_0x55b119[_0x18c1('0xaa')])){_0x55b119['result']='#';_0x350126='#';}if(!this[_0x18c1('0x9b')](_0x28c217[_0x18c1('0xd1')])){this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1e1b61=this[_0x18c1('0x97')]['sync'](this,_0x28c217['variable_id']);if(!_0x1e1b61){return this['channel'][_0x18c1('0x31')](_0x28c217,_0x18c1('0xd2'));}this['channel']['setVariable'](_0x1e1b61,_0x350126);}this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x28c217,_0x350126);return _0x55b119;};AGIVertices[_0x18c1('0x18')][_0x18c1('0xae')]=function(_0x278dc1){logger[_0x18c1('0x2d')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x278dc1[_0x18c1('0x9f')]));return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x278dc1[_0x18c1('0x15c')]||_0x278dc1['label']);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x15d')]=function(_0x43fc91){logger[_0x18c1('0x2d')](util['format'](_0x18c1('0x15e'),_0x43fc91[_0x18c1('0x9f')]));if(!this['isConfigured'](_0x43fc91[_0x18c1('0x149')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x43fc91,'no\x20find\x20by\x20configured');}logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x14b'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x43fc91[_0x18c1('0x149')]));var _0x478b45=this['getPause']['sync'](this,_0x43fc91[_0x18c1('0x15f')]);var _0x31a488=this[_0x18c1('0x4f')][_0x18c1('0x67')](this,_0x43fc91['findBy'],_0x478b45);if(_0x31a488){logger[_0x18c1('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x18c1('0x11')][_0x18c1('0x37')],_0x43fc91[_0x18c1('0x149')]));this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x14c'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x43fc91[_0x18c1('0x149')]));return{'code':0xc8,'result':_0x18c1('0x150')};}else{logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x14d'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x43fc91[_0x18c1('0x149')]));this['channel'][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x14c'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x43fc91['findBy']));return{'code':0xc8,'result':_0x18c1('0x151')};}};AGIVertices[_0x18c1('0x18')][_0x18c1('0x160')]=function(_0x50c774){logger['info'](util['format'](_0x18c1('0x161'),_0x50c774['label']));if(!this[_0x18c1('0x9b')](_0x50c774[_0x18c1('0x109')])){return this['channel'][_0x18c1('0x31')](_0x50c774,_0x18c1('0x107'));}var _0x169695=this[_0x18c1('0x108')][_0x18c1('0x67')](this,_0x50c774[_0x18c1('0x109')]);if(!_0x169695){return this['channel']['error'](_0x50c774,'no\x20file\x20audio\x20found');}var _0x3e79c0=this[_0x18c1('0x11')][_0x18c1('0x56')](_0x18c1('0x162'),[_0x169695,_0x50c774[_0x18c1('0xda')]]);if(_0x3e79c0[_0x18c1('0xaa')]===-0x1){return _0x3e79c0;}return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xbe'),_0x18c1('0x162'),_0x169695));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x163')]=function(_0x22b06a){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x164'),_0x22b06a[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x22b06a[_0x18c1('0x165')])){return this['channel']['error'](_0x22b06a,_0x18c1('0x166'));}var _0x43e276='';var _0x131b95=parseInt(_0x22b06a[_0x18c1('0x165')],0xa);if(isNaN(_0x131b95)){_0x43e276=_0x22b06a['queue_id'];}else{_0x43e276=this[_0x18c1('0x167')]['sync'](this,_0x22b06a[_0x18c1('0x165')]);if(!_0x43e276){return this['channel'][_0x18c1('0x31')](_0x22b06a,_0x18c1('0x168'));}}var _0x4d9597='';if(this[_0x18c1('0x9b')](_0x22b06a['file_id'])){var _0x1137fc=this[_0x18c1('0x108')][_0x18c1('0x67')](this,_0x22b06a[_0x18c1('0x109')]);if(_0x1137fc){_0x4d9597=_0x1137fc;}}this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x22b06a,_0x43e276);if(_0x22b06a['opts'][_0x18c1('0x169')]('x')<0x0){_0x22b06a[_0x18c1('0xda')]+='x';}if(_0x22b06a[_0x18c1('0xda')][_0x18c1('0x169')]('X')<0x0){_0x22b06a['opts']+='X';}this[_0x18c1('0x11')][_0x18c1('0x94')](_0x18c1('0x16a'),_0x43e276?_0x43e276[_0x18c1('0x16b')]():'');var _0x4b3fb5=this['channel'][_0x18c1('0x56')](_0x18c1('0x16c'),[_0x43e276,_0x22b06a[_0x18c1('0xda')],_0x22b06a['url'],_0x4d9597,_0x22b06a[_0x18c1('0x5f')],_0x22b06a[_0x18c1('0x8')],_0x22b06a[_0x18c1('0x16d')],_0x22b06a[_0x18c1('0x16e')],'',_0x22b06a['position']]);if(_0x4b3fb5[_0x18c1('0xaa')]===-0x1){return _0x4b3fb5;}return this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0xbe'),'QUEUE',_0x43e276));};AGIVertices['prototype'][_0x18c1('0x16f')]=function(_0x2ade40){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x170'),_0x2ade40[_0x18c1('0x9f')]));var _0x492d57=_0x2ade40[_0x18c1('0x171')]||_0x18c1('0x127');var _0x4d0b6e=util['format'](_0x18c1('0x172'),this[_0x18c1('0x11')][_0x18c1('0x39')],rs[_0x18c1('0x111')](0x5));var _0xdd76c3=util[_0x18c1('0x29')](_0x18c1('0x173'),FILES_PATH,_0x4d0b6e,_0x492d57);var _0x542fe8=util[_0x18c1('0x29')](_0x18c1('0x128'),FILES_PATH,_0x4d0b6e);this['createSquareRecording'][_0x18c1('0x67')](this,_0x2ade40,_0x4d0b6e,_0xdd76c3);this[_0x18c1('0x11')][_0x18c1('0x94')]('RECORDING_SAVENAME',_0x4d0b6e);logger[_0x18c1('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x542fe8,_0x492d57,_0x2ade40['escape_digits'],_0x2ade40[_0x18c1('0x5f')]);return this['channel'][_0x18c1('0x12b')](_0x542fe8,_0x492d57,_0x2ade40['escape_digits'],_0x2ade40[_0x18c1('0x5f')],undefined,!![]);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x174')]=function(_0x550180){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x175'),_0x550180[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x550180[_0x18c1('0x69')])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x176'));}var _0x2a905d=this['restAPI']['sync'](this,_0x550180);logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x177'),util[_0x18c1('0x178')](_0x2a905d,{'showHidden':![],'depth':null})));if(!this[_0x18c1('0x9b')](_0x550180[_0x18c1('0xd1')])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0x179'));}var _0x4df60c=this[_0x18c1('0x97')][_0x18c1('0x67')](this,_0x550180[_0x18c1('0xd1')]);if(!_0x4df60c){return this['channel'][_0x18c1('0x31')](_0x550180,_0x18c1('0xd2'));}this[_0x18c1('0x11')][_0x18c1('0x94')](util['format'](_0x18c1('0x17a'),_0x4df60c),_0x2a905d[_0x18c1('0x6d')]?_0x2a905d[_0x18c1('0x6d')]:'200');this['channel'][_0x18c1('0x94')](util[_0x18c1('0x29')]('%s_STATUS_MESSAGE',_0x4df60c),_0x2a905d[_0x18c1('0x17b')]?_0x2a905d[_0x18c1('0x17b')]:'OK');if(_0x2a905d['body']){try{this[_0x18c1('0x91')](_0x2a905d[_0x18c1('0x63')],_0x4df60c);}catch(_0x3f414b){logger['error'](util['format'](_0x18c1('0x17c'),_0x4df60c));}}return this['channel'][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xd4'),_0x4df60c));};AGIVertices[_0x18c1('0x18')]['saydigits']=function(_0x251938){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x17d'),_0x251938[_0x18c1('0x9f')]));return this[_0x18c1('0x11')][_0x18c1('0x17e')](_0x251938[_0x18c1('0x17f')][_0x18c1('0x57')](/\s+/g,''),_0x251938[_0x18c1('0x180')]);};AGIVertices[_0x18c1('0x18')]['saynumber']=function(_0x1ced90){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x181'),_0x1ced90[_0x18c1('0x9f')]));return this['channel'][_0x18c1('0x182')](_0x1ced90[_0x18c1('0x60')][_0x18c1('0x57')](/\s+/g,''),_0x1ced90[_0x18c1('0x180')]);};AGIVertices[_0x18c1('0x18')]['sayphonetic']=function(_0x5f2613){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x183'),_0x5f2613['label']));return this[_0x18c1('0x11')]['sayPhonetic'](_0x5f2613[_0x18c1('0x5d')],_0x5f2613['escape_digits']);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x184')]=function(_0x2ce3e1){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x185'),_0x2ce3e1['label']));if(!this['isConfigured'](_0x2ce3e1['account_id'])){return this[_0x18c1('0x11')][_0x18c1('0xae')]('no\x20mail\x20account\x20configured');}var _0x3c0501=this[_0x18c1('0x21')][_0x18c1('0x67')](this,_0x2ce3e1[_0x18c1('0x186')]);if(!_0x3c0501||!_0x3c0501[_0x18c1('0x187')]){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x2ce3e1,_0x18c1('0x188'));}var _0x3bdab3={'from':util[_0x18c1('0x29')](_0x18c1('0x189'),_0x3c0501[_0x18c1('0x17')],_0x3c0501[_0x18c1('0x18a')]||_0x3c0501[_0x18c1('0x187')][_0x18c1('0x18b')]),'to':_0x2ce3e1['to']||'','cc':_0x2ce3e1['cc']||'','bcc':_0x2ce3e1[_0x18c1('0x18c')]||'','subject':_0x2ce3e1[_0x18c1('0x18d')],'html':_0x2ce3e1[_0x18c1('0x5d')],'text':_0x2ce3e1['text']};if(this['isConfigured'](_0x2ce3e1['template_id'])){}logger[_0x18c1('0xd5')](_0x18c1('0x18e'),JSON['stringify'](_0x3bdab3));this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x2ce3e1,_0x2ce3e1['account_id']);this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0x18f'),_0x3c0501[_0x18c1('0x17')]));this[_0x18c1('0x23')]['sync'](this,_0x3c0501[_0x18c1('0x190')],_0x3bdab3);return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x191'));};AGIVertices[_0x18c1('0x18')]['sendFax']=function(_0x3e28f0){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x192'),_0x3e28f0[_0x18c1('0x9f')]));return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x193'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x194')]=function(_0x3cb888){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x195'),_0x3cb888[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x3cb888['sms_account_id'])){return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x196'));}var _0x33dd4d=this['getSmsAccount']['sync'](this,_0x3cb888['sms_account_id']);if(!_0x33dd4d){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x3cb888,_0x18c1('0x197'));}var _0x55fa0d={'body':_0x3cb888[_0x18c1('0x198')],'phone':_0x3cb888['to']||'','SmsAccountId':_0x33dd4d['id']};logger[_0x18c1('0xd5')](_0x18c1('0x199'),JSON[_0x18c1('0x6b')](_0x55fa0d));this['createSquareDetailsReport'][_0x18c1('0x67')](this,_0x3cb888,_0x3cb888['sms_account_id']);this[_0x18c1('0x11')]['noop'](util['format'](_0x18c1('0x19a'),_0x33dd4d[_0x18c1('0x17')]));this[_0x18c1('0x33')][_0x18c1('0x67')](this,_0x55fa0d);return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x19b'));};AGIVertices[_0x18c1('0x18')]['set']=function(_0x3f45f3){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x19c'),_0x3f45f3[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x3f45f3['variable_id'])){return this['channel'][_0x18c1('0x31')](_0x3f45f3,_0x18c1('0x19d'));}var _0x4585d0=this['getVariable']['sync'](this,_0x3f45f3[_0x18c1('0xd1')]);if(!_0x4585d0){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x3f45f3,_0x18c1('0xd2'));}return this[_0x18c1('0x11')][_0x18c1('0x94')](_0x4585d0,_0x3f45f3['variable_value']);};AGIVertices[_0x18c1('0x18')][_0x18c1('0x19e')]=function(_0x4144dc){logger[_0x18c1('0x2d')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x4144dc[_0x18c1('0x9f')]));this['channel'][_0x18c1('0xae')]('START\x20CALLY\x20SQUARE');if(_0x4144dc[_0x18c1('0xb5')]===_0x18c1('0x19f')){this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x1a0'));return this[_0x18c1('0x11')]['answer']();}return this[_0x18c1('0x11')][_0x18c1('0xae')](_0x18c1('0x1a1'));};AGIVertices[_0x18c1('0x18')]['subproject']=function(_0x2b6645){logger['info'](util['format'](_0x18c1('0x1a2'),_0x2b6645[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x2b6645['project_id'])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x2b6645,_0x18c1('0x1a3'));}var _0xdf5a88=this['getSquareProject'][_0x18c1('0x67')](this,_0x2b6645['project_id']);if(!this[_0x18c1('0x9b')](_0xdf5a88)){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x2b6645,util[_0x18c1('0x29')](_0x18c1('0x1a4'),_0x2b6645[_0x18c1('0x1a5')]));}if(_0xdf5a88===this[_0x18c1('0x11')][_0x18c1('0x36')]){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x2b6645,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x2b6645,_0xdf5a88);var _0x535b8d=this[_0x18c1('0x11')][_0x18c1('0x56')](_0x18c1('0x1a6'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x18c1('0x1a7')]||'127.0.0.1',_0xdf5a88,this[_0x18c1('0x11')][_0x18c1('0x36')]));if(_0x535b8d[_0x18c1('0xaa')]===-0x1){return _0x535b8d;}return this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0xbe'),_0x18c1('0x1a6'),_0xdf5a88));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x1a8')]=function(_0x37008f){logger['info'](util[_0x18c1('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x37008f[_0x18c1('0x9f')]));var _0x6b2001=this[_0x18c1('0x55')]['sync'](this,_0x37008f[_0x18c1('0xb0')]);this[_0x18c1('0x34')][_0x18c1('0x67')](this,_0x37008f,_0x37008f[_0x18c1('0xb0')]);if(this['isConfigured'](_0x37008f[_0x18c1('0xd1')])){var _0x3e176f=this[_0x18c1('0x97')][_0x18c1('0x67')](this,_0x37008f[_0x18c1('0xd1')]);if(_0x3e176f){this['channel'][_0x18c1('0x94')](_0x3e176f,_0x6b2001);return this[_0x18c1('0x11')]['noop'](util[_0x18c1('0x29')](_0x18c1('0x1a9'),_0x37008f[_0x18c1('0xb0')],_0x3e176f));}}return this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0x1aa'),_0x37008f['command']));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x1ab')]=function(_0x429be2){logger[_0x18c1('0x2d')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x429be2[_0x18c1('0x9f')]));_0x429be2[_0x18c1('0x5d')]=_0x429be2[_0x18c1('0x5d')][_0x18c1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x18c1('0x9b')](_0x429be2[_0x18c1('0x58')])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0x1ac'));}if(!this[_0x18c1('0x9b')](_0x429be2[_0x18c1('0x5d')])){return this['channel'][_0x18c1('0xae')](_0x18c1('0xa0'));}this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0x1ad'),_0x429be2[_0x18c1('0x5d')]));var _0x512663=this[_0x18c1('0x1ae')]['sync'](this,_0x429be2);if(_0x512663){this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x1af'),_0x512663));var _0x10378c=this[_0x18c1('0x11')][_0x18c1('0xf7')](_0x512663);try{fs[_0x18c1('0xf8')](_0x512663+_0x18c1('0xfa'));}catch(_0x40fa95){logger[_0x18c1('0x31')](_0x40fa95);}return _0x10378c;}return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x429be2,_0x18c1('0x1b0'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x1b1')]=function(_0x502699){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x1b2'),_0x502699[_0x18c1('0x9f')]));_0x502699['text']=_0x502699[_0x18c1('0x5d')][_0x18c1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x502699['text'])){return this[_0x18c1('0x11')]['noop'](_0x18c1('0xa0'));}this[_0x18c1('0x11')][_0x18c1('0xae')](util['format'](_0x18c1('0x1b3'),_0x502699[_0x18c1('0x5d')]));var _0x1fb6fc=this['googleTTS']['sync'](this,_0x502699);if(_0x1fb6fc){this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x1b4'),_0x1fb6fc));var _0x542f60=this[_0x18c1('0x11')][_0x18c1('0xf7')](_0x1fb6fc);try{fs['unlink'](_0x1fb6fc+_0x18c1('0xfa'));}catch(_0x5a5c00){logger[_0x18c1('0x31')](_0x5a5c00);}return _0x542f60;}return this['channel'][_0x18c1('0x31')](_0x502699,_0x18c1('0x1b5'));};AGIVertices[_0x18c1('0x18')][_0x18c1('0x1b6')]=function(_0x1f149d){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x1b7'),_0x1f149d[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x1f149d[_0x18c1('0x149')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x1f149d,'no\x20find\x20by\x20configured');}logger[_0x18c1('0x2d')](util[_0x18c1('0x29')](_0x18c1('0x14b'),this[_0x18c1('0x11')]['callerid'],_0x1f149d[_0x18c1('0x149')]));var _0x33daf1=this['agentUnpause'][_0x18c1('0x67')](this,_0x1f149d['findBy']);if(_0x33daf1){logger['info'](util[_0x18c1('0x29')](_0x18c1('0x14c'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x1f149d['findBy']));this['channel'][_0x18c1('0xae')](util[_0x18c1('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x18c1('0x11')][_0x18c1('0x37')],_0x1f149d['findBy']));return{'code':0xc8,'result':_0x18c1('0x150')};}else{logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x18c1('0x37')],_0x1f149d[_0x18c1('0x149')]));this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0x14d'),this[_0x18c1('0x11')][_0x18c1('0x37')],_0x1f149d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x18c1('0x18')][_0x18c1('0x1b8')]=function(_0x4700de){logger[_0x18c1('0x2d')](util[_0x18c1('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4700de[_0x18c1('0x9f')]));var _0x336dec=this['channel'][_0x18c1('0x56')](_0x18c1('0x1b9'),[_0x4700de[_0x18c1('0x1ba')],_0x4700de[_0x18c1('0xa1')]]);if(_0x336dec[_0x18c1('0xaa')]===-0x1){return _0x336dec;}return this[_0x18c1('0x11')][_0x18c1('0xae')](util[_0x18c1('0x29')](_0x18c1('0xbe'),_0x18c1('0x1b9'),_0x4700de['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x548b37){logger['info'](util[_0x18c1('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x548b37[_0x18c1('0x9f')]));if(!this[_0x18c1('0x9b')](_0x548b37[_0x18c1('0xd1')])){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x548b37,_0x18c1('0x19d'));}var _0x3f42c5=this[_0x18c1('0x97')][_0x18c1('0x67')](this,_0x548b37[_0x18c1('0xd1')]);if(!_0x3f42c5){return this[_0x18c1('0x11')][_0x18c1('0x31')](_0x548b37,'no\x20variable\x20found');}var _0x5bc14b=this[_0x18c1('0x11')][_0x18c1('0x97')](_0x3f42c5);return{'code':0xc8,'result':_0x5bc14b[_0x18c1('0x98')]?_0x5bc14b[_0x18c1('0x98')]:'-'};};String[_0x18c1('0x18')]['replaceAll']=function(_0x4ba484,_0x4ea5d6){return this[_0x18c1('0x95')](_0x4ba484)[_0x18c1('0x1bb')](_0x4ea5d6);};module[_0x18c1('0x1bc')]=AGIVertices; \ No newline at end of file +var _0x44f8=['project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','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\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','mailRpc','rpc','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','prototype','getSquareProject','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','channel','agicommand','arg_1','callerid','createSquareRecording','uniqueid','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','format','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','googleDialogflowV2','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','includes','clone','isString','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','dial','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','setVariable','DIALOGFLOW_%s','toUpperCase','out','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','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','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','no\x20find\x20by\x20configured','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block'];(function(_0x1236a5,_0xed9d6b){var _0x234702=function(_0xa80dc8){while(--_0xa80dc8){_0x1236a5['push'](_0x1236a5['shift']());}};_0x234702(++_0xed9d6b);}(_0x44f8,0x1de));var _0x844f=function(_0x3b7262,_0x1b3eb7){_0x3b7262=_0x3b7262-0x0;var _0x11f5d3=_0x44f8[_0x3b7262];return _0x11f5d3;};'use strict';var fs=require('fs');var util=require(_0x844f('0x0'));var _=require(_0x844f('0x1'));var sh=require(_0x844f('0x2'));var odbc=require(_0x844f('0x3'))();var rs=require(_0x844f('0x4'));var moment=require(_0x844f('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x844f('0x6'))('agi');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0x844f('0x7'));var FILES_PATH=_0x844f('0x8');var recursiveMapAttributes=[_0x844f('0x9'),_0x844f('0xa')];var verticesWithRetry=[_0x844f('0xb'),_0x844f('0xc'),_0x844f('0xd')];var AGIVertices=function(_0x502d8a,_0x47b507,_0x39416d){this['channel']=_0x502d8a;this['rpc']=_0x47b507;this[_0x844f('0xe')]=_0x39416d;};AGIVertices['prototype']['getVariable']=function(_0x4f7386,_0x4f6811){this[_0x844f('0xf')][_0x844f('0x10')](_0x4f7386)['then'](function(_0x2a67fd){_0x4f6811(null,_0x2a67fd?_0x2a67fd[_0x844f('0x11')]:![]);})[_0x844f('0x12')](function(_0x5ea542){_0x4f6811(_0x5ea542);});};AGIVertices['prototype'][_0x844f('0x13')]=function(_0x4dfe2e,_0x3137c1){this[_0x844f('0xf')][_0x844f('0x14')](_0x4dfe2e)[_0x844f('0x15')](function(_0xb61e4f){_0x3137c1(null,_0xb61e4f?_0xb61e4f['name']:![]);})['catch'](function(_0x1b04a9){_0x3137c1(_0x1b04a9);});};AGIVertices[_0x844f('0x16')][_0x844f('0x17')]=function(_0x9f7182,_0x4f7ce4){this[_0x844f('0xf')]['getSquareProjectById'](_0x9f7182)['then'](function(_0x1f96d0){_0x4f7ce4(null,_0x1f96d0?_0x1f96d0[_0x844f('0x11')]:![]);})['catch'](function(_0x24e386){_0x4f7ce4(_0x24e386);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x31431e,_0x541997){this[_0x844f('0xf')][_0x844f('0x18')](_0x31431e)[_0x844f('0x15')](function(_0x38e732){_0x541997(null,_0x38e732?_0x38e732[_0x844f('0x19')]:![]);})['catch'](function(_0x270be6){_0x541997(_0x270be6);});};AGIVertices['prototype']['getUser']=function(_0x3f83cd,_0x4261b6){this[_0x844f('0xf')][_0x844f('0x1a')](_0x3f83cd)[_0x844f('0x15')](function(_0x523f49){_0x4261b6(null,_0x523f49?_0x523f49[_0x844f('0x11')]:![]);})['catch'](function(_0x22c055){_0x4261b6(_0x22c055);});};AGIVertices['prototype'][_0x844f('0x1b')]=function(_0x19b96a,_0x1fcc0f){this[_0x844f('0xf')][_0x844f('0x1c')](_0x19b96a)[_0x844f('0x15')](function(_0x41458f){_0x1fcc0f(null,_0x41458f?_0x41458f['name']:![]);})[_0x844f('0x12')](function(_0x16d7ad){_0x1fcc0f(_0x16d7ad);});};AGIVertices[_0x844f('0x16')][_0x844f('0x1d')]=function(_0x29c4c3,_0x29d224){var _0x4caee1=this;this[_0x844f('0xf')][_0x844f('0x1e')](_0x29c4c3)[_0x844f('0x15')](function(_0x4d3abd){_0x29d224(null,_0x4d3abd?_0x4caee1['getSoundPath'](_0x4d3abd[_0x844f('0x1f')]):![]);})[_0x844f('0x12')](function(_0x28a4b6){_0x29d224(_0x28a4b6);});};AGIVertices['prototype'][_0x844f('0x20')]=function(_0x55de3e,_0x2a0dc9){this[_0x844f('0xf')]['getMailAccountById'](_0x55de3e)['then'](function(_0x24319c){_0x2a0dc9(null,_0x24319c?_0x24319c:![]);})[_0x844f('0x12')](function(_0x59f4f0){_0x2a0dc9(_0x59f4f0);});};AGIVertices['prototype'][_0x844f('0x21')]=function(_0xb3527a,_0xbb629c,_0x4c89cc){this[_0x844f('0xe')][_0x844f('0x21')](_0xb3527a,_0xbb629c)[_0x844f('0x15')](function(){_0x4c89cc(null);})[_0x844f('0x12')](function(_0x55d9ce){_0x4c89cc(_0x55d9ce);});};AGIVertices[_0x844f('0x16')][_0x844f('0x22')]=function(_0x210100,_0x372b43){this[_0x844f('0xf')][_0x844f('0x23')](_0x210100)[_0x844f('0x15')](function(_0x2a327a){if(_0x2a327a){if(_0x2a327a['IntervalId']){_0x372b43(null,[_0x2a327a[_0x844f('0x24')]]);}else{_0x372b43(null,_['map'](_0x2a327a[_0x844f('0x25')],_0x844f('0x24')));}}else{_0x372b43(null,![]);}})[_0x844f('0x12')](function(_0x37d174){_0x372b43(_0x37d174);});};AGIVertices['prototype'][_0x844f('0x26')]=function(_0x462b15){return util['format'](_0x844f('0x27'),FILES_PATH,_0x462b15);};AGIVertices[_0x844f('0x16')][_0x844f('0x28')]=function(_0x357e1c,_0x459ca2,_0x45df15){odbc['open'](_0x357e1c,function(_0x3592d9){if(_0x3592d9){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x3592d9);_0x45df15(_0x3592d9);}else{logger[_0x844f('0x29')]('ODBC\x20connection\x20successfully');odbc[_0x844f('0x2a')](_0x459ca2,function(_0x1b29ba,_0x27f40e){if(_0x1b29ba){logger[_0x844f('0x29')](_0x844f('0x2b'),_0x459ca2);_0x45df15(_0x1b29ba);}else{logger[_0x844f('0x29')](_0x844f('0x2c'),_0x459ca2);odbc[_0x844f('0x2d')](function(_0x2dc81a){if(_0x2dc81a){logger[_0x844f('0x2e')](_0x844f('0x2f'),_0x2dc81a);}_0x45df15(null,_0x27f40e);});}});}});};AGIVertices[_0x844f('0x16')][_0x844f('0x30')]=function(_0x218a42,_0x23a721){this['rpc']['getSmsAccountById'](_0x218a42)[_0x844f('0x15')](function(_0x523fad){_0x23a721(null,_0x523fad?_0x523fad:![]);})[_0x844f('0x12')](function(_0x2ecd23){_0x23a721(_0x2ecd23);});};AGIVertices['prototype'][_0x844f('0x31')]=function(_0x533208,_0x50f762){this[_0x844f('0xf')]['createSmsMessage'](_0x533208)['then'](function(_0x16b667){_0x50f762(null,_0x16b667);})[_0x844f('0x12')](function(_0x17957a){_0x50f762(_0x17957a);});};AGIVertices[_0x844f('0x16')]['createSquareDetailsReport']=function(_0x1df697,_0x14edc0,_0x2bab81){this[_0x844f('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x844f('0x32')]['uniqueid'],'node':_0x1df697['label'],'application':_0x1df697[_0x844f('0x33')],'data':_0x14edc0||null,'project_name':this[_0x844f('0x32')][_0x844f('0x34')],'callerid':this[_0x844f('0x32')][_0x844f('0x35')]})['then'](function(_0x270ea8){if(_0x2bab81){_0x2bab81(null,_0x270ea8);}})[_0x844f('0x12')](function(_0x527da3){if(_0x2bab81){_0x2bab81(_0x527da3);}});};AGIVertices[_0x844f('0x16')][_0x844f('0x36')]=function(_0x2f1dc3,_0x22a23a,_0x74a4ff,_0x478505){this[_0x844f('0xf')][_0x844f('0x36')]({'uniqueid':this[_0x844f('0x32')][_0x844f('0x37')],'callerid':this[_0x844f('0x32')]['callerid'],'calleridname':this[_0x844f('0x32')]['calleridname'],'context':this[_0x844f('0x32')][_0x844f('0x38')],'extension':this['channel'][_0x844f('0x39')],'priority':this[_0x844f('0x32')][_0x844f('0x3a')],'accountcode':this[_0x844f('0x32')][_0x844f('0x3b')],'dnid':this['channel'][_0x844f('0x3c')],'projectName':this['channel'][_0x844f('0x34')],'saveName':_0x22a23a,'filename':_0x2f1dc3[_0x844f('0x3d')]||_0x22a23a,'savePath':_0x74a4ff})[_0x844f('0x15')](function(_0x4a35ef){_0x478505(null,_0x4a35ef);})[_0x844f('0x12')](function(_0x36b919){_0x478505(_0x36b919);});};AGIVertices[_0x844f('0x16')]['createSquareMessage']=function(_0x17c388,_0x320832,_0x1665ee,_0x298e1c,_0x45be6f){this['rpc'][_0x844f('0x3e')]({'uniqueid':this[_0x844f('0x32')][_0x844f('0x37')],'body':_0x17c388,'direction':_0x320832,'providerName':_0x1665ee,'providerResponse':_0x298e1c})[_0x844f('0x15')](function(_0x4ef696){if(_0x45be6f){_0x45be6f(null,_0x4ef696);}})[_0x844f('0x12')](function(_0x2dc859){if(_0x45be6f){_0x45be6f(_0x2dc859);}});};AGIVertices[_0x844f('0x16')][_0x844f('0x3f')]=function(_0x46fab0,_0x25ffa3){this['rpc']['createCmContact']({'firstName':_[_0x844f('0x40')](_0x46fab0[_0x844f('0x11')])||_[_0x844f('0x41')](_0x46fab0[_0x844f('0x11')])?'callback_'+Math['random']():_0x46fab0[_0x844f('0x11')],'lastName':_['isEmpty'](_0x46fab0[_0x844f('0x42')])||_[_0x844f('0x41')](_0x46fab0[_0x844f('0x42')])?null:_0x46fab0[_0x844f('0x42')],'phone':_0x46fab0['phone'],'ListId':_0x46fab0[_0x844f('0x43')],'scheduledat':_0x46fab0[_0x844f('0x44')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x844f('0x45'),'description':_0x844f('0x46')+_0x46fab0[_0x844f('0x44')][_0x844f('0x47')](),'priority':_0x46fab0[_0x844f('0x48')]})[_0x844f('0x15')](function(_0x47ddbf){_0x25ffa3(null,_0x47ddbf);})['catch'](function(_0x8bbcf8){_0x25ffa3(_0x8bbcf8);});};AGIVertices[_0x844f('0x16')][_0x844f('0x49')]=function(_0x213217,_0x346d6b){this[_0x844f('0xf')][_0x844f('0x4a')](_0x213217)[_0x844f('0x15')](function(_0x17f61c){_0x346d6b(null,_0x17f61c?_0x17f61c[_0x844f('0x11')]:![]);})[_0x844f('0x12')](function(_0x107e5e){_0x346d6b(_0x107e5e);});};AGIVertices[_0x844f('0x16')][_0x844f('0x4b')]=function(_0x345496,_0x1664b5,_0x51be4a){var _0x5ba22c={'role':_0x844f('0x4c')};_0x5ba22c[_0x345496]=this['channel'][_0x844f('0x35')];this['rpc'][_0x844f('0x4b')](_0x5ba22c,_0x1664b5,this[_0x844f('0x32')][_0x844f('0x37')])[_0x844f('0x15')](function(_0x288a39){_0x51be4a(null,_['isNil'](_0x288a39)?![]:!![]);})[_0x844f('0x12')](function(_0x511998){logger[_0x844f('0x2e')](_0x511998);_0x51be4a(null,![]);});};AGIVertices[_0x844f('0x16')][_0x844f('0x4d')]=function(_0x25956f,_0x12016a){var _0x2a25ea={'role':_0x844f('0x4c')};_0x2a25ea[_0x25956f]=this[_0x844f('0x32')]['callerid'];this[_0x844f('0xf')]['agentUnpause'](_0x2a25ea)[_0x844f('0x15')](function(_0x3d28fe){_0x12016a(null,_['isNil'](_0x3d28fe)?![]:!![]);})[_0x844f('0x12')](function(_0x227b6b){logger[_0x844f('0x2e')](_0x227b6b);_0x12016a(null,![]);});};AGIVertices[_0x844f('0x16')]['agentLogout']=function(_0x41c7d8,_0x4b4a82){var _0x5354e8={'role':'agent'};_0x5354e8[_0x41c7d8]=this[_0x844f('0x32')][_0x844f('0x35')];this[_0x844f('0xf')]['agentLogout'](_0x5354e8)[_0x844f('0x15')](function(_0x422f99){_0x4b4a82(null,_[_0x844f('0x41')](_0x422f99)?![]:!![]);})[_0x844f('0x12')](function(_0x29f839){logger['error'](_0x29f839);_0x4b4a82(null,![]);});};AGIVertices[_0x844f('0x16')]['agentLogin']=function(_0x4edb79,_0x5601e0){var _0x291e88={'role':_0x844f('0x4c')};_0x291e88[_0x4edb79]=this[_0x844f('0x32')][_0x844f('0x35')];var _0xdfadf6=_0x4edb79!='internal'?util[_0x844f('0x4e')](_0x844f('0x4f'),'LOCAL',this['channel'][_0x844f('0x35')]):undefined;this[_0x844f('0xf')][_0x844f('0x50')](_0x291e88,_0xdfadf6)['then'](function(_0x37d54b){_0x5601e0(null,_[_0x844f('0x41')](_0x37d54b)?![]:!![]);})['catch'](function(_0x1c7854){logger[_0x844f('0x2e')](_0x1c7854);_0x5601e0(null,![]);});};AGIVertices[_0x844f('0x16')][_0x844f('0x51')]=function(_0x5db2ad,_0x5d2d96){sh[_0x844f('0x52')](_[_0x844f('0x53')](_0x5db2ad),function(_0x49e4fb,_0x2028e3){var _0x4e14b5=_0x2028e3[_0x844f('0x54')](/(\r\n|\n|\r)/gm,'');_0x5d2d96(null,_0x4e14b5);});};AGIVertices[_0x844f('0x16')][_0x844f('0x55')]=function(_0x701b18,_0x55e528){scripts[_0x844f('0x55')](_0x701b18[_0x844f('0x56')],_0x701b18[_0x844f('0x57')]||_0x844f('0x58'),_0x701b18[_0x844f('0x58')],_0x701b18[_0x844f('0x59')]||_0x844f('0x5a'),_0x701b18[_0x844f('0x5b')]||_0x844f('0x5c'),_0x701b18[_0x844f('0x5d')]||_0x844f('0x5e'))[_0x844f('0x15')](function(_0x187733){_0x55e528(null,_0x187733);})[_0x844f('0x12')](function(_0x22c53f){_0x55e528(_0x22c53f);});};AGIVertices['prototype'][_0x844f('0x5f')]=function(_0x98860b,_0x53fb40){scripts[_0x844f('0x5f')](_0x98860b[_0x844f('0x58')],_0x98860b[_0x844f('0x60')]||'en',0x1)[_0x844f('0x15')](function(_0x51e23e){_0x53fb40(null,_0x51e23e);})['catch'](function(_0x92c9fb){_0x53fb40(_0x92c9fb);});};AGIVertices['prototype'][_0x844f('0x61')]=function(_0xf3ebfc,_0x71588d){var _0x5c9127={'uri':_0xf3ebfc[_0x844f('0x62')],'method':_0xf3ebfc[_0x844f('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xf3ebfc['timeout'])===_0x844f('0x64')&&parseInt(_0xf3ebfc[_0x844f('0x65')])>=0x1?parseInt(_0xf3ebfc['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x844f('0x66'),_0x844f('0x67')],_0x5c9127[_0x844f('0x63')]['toUpperCase']())){try{_0x5c9127['body']=_0xf3ebfc[_0x844f('0xa')]?JSON[_0x844f('0x68')](_0xf3ebfc[_0x844f('0xa')]):{};}catch(_0x53e250){logger[_0x844f('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x53e250);}}try{_0x5c9127[_0x844f('0x69')]=_0xf3ebfc['rawHeaders']?JSON[_0x844f('0x68')](_0xf3ebfc[_0x844f('0x9')]):{};}catch(_0x87122){logger[_0x844f('0x2e')](_0x844f('0x6a'),_0x87122);}if(_0xf3ebfc[_0x844f('0x6b')]){try{var _0x20ca1f=require(_0xf3ebfc['computedVariables'])['sync'](this,_0x5c9127);_0x5c9127['uri']=Mustache[_0x844f('0x6c')](_0xf3ebfc['url'],_0x20ca1f,{},['$$','$$']);if(_0x5c9127[_0x844f('0x69')]){_0x5c9127[_0x844f('0x69')]=JSON[_0x844f('0x68')](Mustache[_0x844f('0x6c')](JSON[_0x844f('0x6d')](_0x5c9127[_0x844f('0x69')]),_0x20ca1f,{},['$$','$$']));}if(_0x5c9127[_0x844f('0x6e')]){_0x5c9127['body']=JSON[_0x844f('0x68')](Mustache[_0x844f('0x6c')](JSON['stringify'](_0x5c9127[_0x844f('0x6e')]),_0x20ca1f,{},['$$','$$']));}}catch(_0x2616b8){logger[_0x844f('0x2e')](_0x844f('0x6f'),_0x2616b8);}}rp(_0x5c9127)[_0x844f('0x15')](function(_0x5c6027){var _0x285cd6={'statusCode':_0x5c6027[_0x844f('0x70')]||0xc8,'statusMessage':_0x5c6027[_0x844f('0x71')]||'OK','headers':_0x5c6027[_0x844f('0x69')]||{},'body':_0x5c6027[_0x844f('0x6e')]||{}};_0x71588d(null,_0x285cd6);})[_0x844f('0x12')](function(_0x5d0192){var _0x1c5044={'statusCode':_0x5d0192[_0x844f('0x70')]||0x1f4,'statusMessage':_0x5d0192[_0x844f('0x72')]||_0x844f('0x73'),'headers':_0x5d0192['options'][_0x844f('0x69')]||{},'body':_0x5d0192['options'][_0x844f('0x6e')]||{}};_0x71588d(null,_0x1c5044);});};AGIVertices['prototype']['googleDialogflow']=function(_0x4c056c,_0x3dcf7d){scripts[_0x844f('0x74')](this[_0x844f('0x32')][_0x844f('0x37')],_0x4c056c[_0x844f('0x75')],_0x4c056c[_0x844f('0x58')],_0x4c056c['dialogflow_language']||'en')[_0x844f('0x15')](function(_0x255572){_0x3dcf7d(null,_0x255572);})[_0x844f('0x12')](function(_0x36be74){_0x3dcf7d(_0x36be74);});};AGIVertices[_0x844f('0x16')][_0x844f('0x76')]=function(_0x2548c6,_0x54abcc){scripts[_0x844f('0x76')](this['channel']['uniqueid'],_0x2548c6['dialogflowV2_project_id'],_0x2548c6['client_email'],_0x2548c6[_0x844f('0x77')],_0x2548c6[_0x844f('0x58')],_0x2548c6['dialogflowV2_language']||'en')[_0x844f('0x15')](function(_0x1c7e52){_0x54abcc(null,_0x1c7e52);})[_0x844f('0x12')](function(_0x42bc32){_0x54abcc(_0x42bc32);});};AGIVertices[_0x844f('0x16')][_0x844f('0x78')]=function(_0x360e62,_0xb0297c){scripts['sestekNDA'](this[_0x844f('0x32')],_0x360e62)[_0x844f('0x15')](function(_0x2d91ea){_0xb0297c(null,_0x2d91ea);})['catch'](function(_0x415bc7){_0xb0297c(_0x415bc7);});};AGIVertices[_0x844f('0x16')]['ispeechTTS']=function(_0x1dc1bf,_0x501370){scripts[_0x844f('0x79')](_0x1dc1bf[_0x844f('0x75')],_0x1dc1bf['text'],_0x1dc1bf['ispeech_tts_language']||_0x844f('0x5a'),_0x1dc1bf[_0x844f('0x7a')])[_0x844f('0x15')](function(_0x55bd76){_0x501370(null,_0x55bd76);})[_0x844f('0x12')](function(_0xa8165c){_0x501370(_0xa8165c);});};AGIVertices[_0x844f('0x16')][_0x844f('0x7b')]=function(_0x950a5c,_0x4ebb00,_0x196127){scripts[_0x844f('0x7b')](_0x4ebb00,_0x950a5c['key'],_0x950a5c[_0x844f('0x7c')]||_0x844f('0x5a'),this[_0x844f('0x7d')](_0x950a5c[_0x844f('0x7e')])?_0x950a5c[_0x844f('0x7e')]:undefined)[_0x844f('0x15')](function(_0x4678e0){_0x196127(null,_0x4678e0);})['catch'](function(_0xb105ce){_0x196127(_0xb105ce);});};AGIVertices[_0x844f('0x16')][_0x844f('0x7f')]=function(_0x238cc8,_0x5246da){scripts[_0x844f('0x7f')](_0x238cc8['aws_access_key_id'],_0x238cc8[_0x844f('0x80')],_0x238cc8[_0x844f('0x81')],_0x238cc8[_0x844f('0x82')]||_0x844f('0x83'),_0x238cc8[_0x844f('0x58')],_0x238cc8[_0x844f('0x84')]||_0x844f('0x58'))['then'](function(_0x546394){_0x5246da(null,_0x546394);})[_0x844f('0x12')](function(_0x4e8107){_0x5246da(_0x4e8107);});};AGIVertices[_0x844f('0x16')][_0x844f('0x85')]=function(_0x506208,_0x2c1ead){scripts[_0x844f('0x85')](this['channel'][_0x844f('0x37')],_0x506208[_0x844f('0x86')],_0x506208[_0x844f('0x80')],_0x506208[_0x844f('0x87')],_0x506208[_0x844f('0x58')],_0x506208[_0x844f('0x88')])[_0x844f('0x15')](function(_0x359703){_0x2c1ead(null,_0x359703);})[_0x844f('0x12')](function(_0x471a11){_0x2c1ead(_0x471a11);});};AGIVertices[_0x844f('0x16')][_0x844f('0x89')]=function(_0x18d614,_0x537c82,_0xc424dd){scripts[_0x844f('0x89')](_0x537c82,_0x18d614[_0x844f('0x75')],_0x18d614[_0x844f('0x8a')]||'en-US')[_0x844f('0x15')](function(_0x1ea78d){_0xc424dd(null,_0x1ea78d);})[_0x844f('0x12')](function(_0xd3c006){_0xc424dd(_0xd3c006);});};AGIVertices[_0x844f('0x16')]['tildeASR']=function(_0x10c175,_0x1393b9,_0x1458c0){scripts[_0x844f('0x8b')](_0x1393b9,_0x10c175['appid'],_0x10c175[_0x844f('0x8c')],_0x10c175[_0x844f('0x8d')])[_0x844f('0x15')](function(_0x3a9f75){_0x1458c0(null,_0x3a9f75);})[_0x844f('0x12')](function(_0x5cf1b6){_0x1458c0(_0x5cf1b6);});};AGIVertices['prototype'][_0x844f('0x8e')]=function(_0x2ab4c1){var _0xe189bf=_[_0x844f('0x8f')](verticesWithRetry,_0x2ab4c1[_0x844f('0x33')])?_0x2ab4c1:_[_0x844f('0x90')](_0x2ab4c1);for(var _0x352cbf in _0xe189bf){if(_0xe189bf['hasOwnProperty'](_0x352cbf)){if(_0xe189bf[_0x352cbf]&&_[_0x844f('0x91')](_0xe189bf[_0x352cbf])){if(_[_0x844f('0x8f')](recursiveMapAttributes,_0x352cbf)){_0xe189bf[_0x352cbf]=this['replaceObjectAllVariables'](_0xe189bf[_0x352cbf]);}else{_0xe189bf[_0x352cbf]=this[_0x844f('0x92')](_0xe189bf[_0x352cbf]);}}}}return _0xe189bf;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x2786ee){for(var _0x318e9d in _0x2786ee){if(_0x2786ee[_0x844f('0x93')](_0x318e9d)){if(_[_0x844f('0x94')](_0x2786ee[_0x318e9d])){this[_0x844f('0x95')](_0x2786ee[_0x318e9d]);}else if(_[_0x844f('0x96')](_0x2786ee[_0x318e9d])){for(var _0xd8529e=0x0;_0xd8529e<_0x2786ee[_0x318e9d][_0x844f('0x97')];_0xd8529e++){this[_0x844f('0x95')](_0x2786ee[_0x318e9d][_0xd8529e]);}}else if(_[_0x844f('0x91')](_0x2786ee[_0x318e9d])){_0x2786ee[_0x318e9d]=this[_0x844f('0x92')](_0x2786ee[_0x318e9d]);}}}};AGIVertices['prototype'][_0x844f('0x98')]=function(_0x5a5125,_0x425b49){for(var _0xb59c8 in _0x5a5125){if(_0x5a5125['hasOwnProperty'](_0xb59c8)){if(_[_0x844f('0x94')](_0x5a5125[_0xb59c8])){if(!_['isEmpty'](_0x5a5125[_0xb59c8])){this['saveRestApiResult'](_0x5a5125[_0xb59c8],util[_0x844f('0x4e')](_0x844f('0x99'),_0x425b49,_0xb59c8));}}else if(_[_0x844f('0x96')](_0x5a5125[_0xb59c8])){for(var _0x5998d5=0x0;_0x5998d5<_0x5a5125[_0xb59c8][_0x844f('0x97')];_0x5998d5++){this[_0x844f('0x98')](_0x5a5125[_0xb59c8][_0x5998d5],util[_0x844f('0x4e')](_0x844f('0x99'),_0x425b49,_0xb59c8+'['+_0x5998d5+']'));}}else{if(!_[_0x844f('0x41')](_0x5a5125[_0xb59c8])){this[_0x844f('0x32')]['setVariable'](util['format'](_0x844f('0x99'),_0x425b49,_0xb59c8),_0x5a5125[_0xb59c8]);}}}}};AGIVertices[_0x844f('0x16')]['replaceObjectAllVariables']=function(_0x180ef7){try{var _0x53569e=JSON[_0x844f('0x68')](_0x180ef7);this['recursiveNodeIndex'](_0x53569e);return JSON[_0x844f('0x6d')](_0x53569e);}catch(_0x406be0){return this[_0x844f('0x92')](_0x180ef7);}};AGIVertices[_0x844f('0x16')][_0x844f('0x92')]=function(_0x14c4f9){var _0x5f3fa2=_0x14c4f9[_0x844f('0x9a')]('{');for(var _0x2a2285=0x1;_0x2a2285<_0x5f3fa2[_0x844f('0x97')];_0x2a2285+=0x1){var _0x5c4a31=_0x5f3fa2[_0x2a2285][_0x844f('0x9a')]('}');if(_0x5c4a31[_0x844f('0x97')]>0x1){_0x14c4f9=_0x14c4f9[_0x844f('0x9b')]('{'+_0x5c4a31[0x0]+'}',this[_0x844f('0x32')]['getVariable'](_0x5c4a31[0x0])[_0x844f('0x9c')]||_0x5c4a31[0x0]);}}if(_0x5f3fa2[_0x844f('0x97')]===0x1){return _0x14c4f9[_0x844f('0x47')]();}return this[_0x844f('0x92')](_0x14c4f9);};AGIVertices[_0x844f('0x16')][_0x844f('0x9d')]=function(_0x5ab7ac,_0x5c5bb0){var _0x4c6875=this['channel'][_0x844f('0x9e')](_0x5ab7ac);if(_0x4c6875[_0x844f('0x9f')]===-0x1){return _0x4c6875;}logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xa0'),_0x5c5bb0,_0x4c6875[_0x844f('0x9c')]));return this[_0x844f('0x32')]['setVariable'](_0x5c5bb0,_0x4c6875[_0x844f('0x9c')]);};AGIVertices[_0x844f('0x16')][_0x844f('0x7d')]=function(_0x1bcd8a){return _0x1bcd8a&&_0x1bcd8a!=='0'&&_0x1bcd8a!=='-1'&&_0x1bcd8a!=='';};AGIVertices[_0x844f('0x16')][_0x844f('0xa1')]=function(_0x4542a1){this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x4542a1,'-');_0x4542a1[_0x844f('0xa4')]=_0x4542a1[_0x844f('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x844f('0x16')][_0x844f('0xa5')]=function(_0x5c8ea1){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xa6'),_0x5c8ea1[_0x844f('0xa7')]));if(!this['isConfigured'](_0x5c8ea1[_0x844f('0x58')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xa9'));}var _0x2a0ca6='\x22'+_0x5c8ea1[_0x844f('0x58')]+'\x22';if(this[_0x844f('0x7d')](_0x5c8ea1[_0x844f('0xaa')])){_0x2a0ca6+=','+_0x5c8ea1[_0x844f('0xaa')];}var _0x5d92d4=this['channel'][_0x844f('0x52')](_0x844f('0xab'),_0x2a0ca6);if(_0x5d92d4[_0x844f('0x9f')]===-0x1){return _0x5d92d4;}return this[_0x844f('0x32')]['noop'](util[_0x844f('0x4e')](_0x844f('0xac'),_0x2a0ca6));};AGIVertices[_0x844f('0x16')][_0x844f('0xad')]=function(_0x2e43db){logger['info'](util[_0x844f('0x4e')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2e43db[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x2e43db[_0x844f('0xae')])){return this['channel'][_0x844f('0xa8')](_0x844f('0xaf'));}var _0x5a85ff=_0x2e43db[_0x844f('0xae')];if(this[_0x844f('0x7d')](_0x2e43db[_0x844f('0xaa')])){_0x5a85ff+=','+_0x2e43db[_0x844f('0xaa')];}var _0x2a2237=this[_0x844f('0x32')][_0x844f('0x52')]('MRCPRecog',_0x5a85ff);if(_0x2a2237[_0x844f('0x9f')]===-0x1){return _0x2a2237;}var _0x38593c=this[_0x844f('0x9d')]('RECOG_CONFIDENCE()',_0x844f('0xb0'));if(_0x38593c[_0x844f('0x9f')]===-0x1){return _0x38593c;}var _0x267a6d=this[_0x844f('0x9d')]('RECOG_INPUT()',_0x844f('0xb1'));if(_0x267a6d[_0x844f('0x9f')]===-0x1){return _0x267a6d;}var _0x1f31ac=this[_0x844f('0x9d')](_0x844f('0xb2'),_0x844f('0xb3'));if(_0x1f31ac['result']===-0x1){return _0x1f31ac;}return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5a85ff));};AGIVertices[_0x844f('0x16')][_0x844f('0xb4')]=function(_0x13fb8b){logger[_0x844f('0x29')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x13fb8b[_0x844f('0xa7')]));return this[_0x844f('0x32')][_0x844f('0xb4')]([_0x13fb8b[_0x844f('0xb5')],_0x13fb8b[_0x844f('0xb6')]]);};AGIVertices[_0x844f('0x16')][_0x844f('0xb7')]=function(_0x4569db){logger['info'](util[_0x844f('0x4e')](_0x844f('0xb8'),_0x4569db[_0x844f('0xa7')]));if(this[_0x844f('0x7d')](_0x4569db[_0x844f('0x65')])){logger['info'](util[_0x844f('0x4e')](_0x844f('0xb9'),_0x4569db['timeout']));var _0xc0ad52=this['channel']['wait'](_0x4569db['timeout']);if(_0xc0ad52[_0x844f('0x9f')]===-0x1){return _0xc0ad52;}}return this[_0x844f('0x32')][_0x844f('0xb7')]();};AGIVertices[_0x844f('0x16')][_0x844f('0x45')]=function(_0x35b666){logger['info'](util[_0x844f('0x4e')](_0x844f('0xba'),_0x35b666['label']));if(!this[_0x844f('0x7d')](_0x35b666['list_id'])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x35b666,'no\x20list\x20selected');}_0x35b666[_0x844f('0x44')]=moment();if(this[_0x844f('0x7d')](_0x35b666[_0x844f('0xbb')])){_0x35b666['scheduledAt']=moment()[_0x844f('0xbc')](_0x35b666[_0x844f('0xbb')],_0x844f('0xbd'));}if(!this[_0x844f('0x7d')](_0x35b666[_0x844f('0x48')])){_0x35b666[_0x844f('0x48')]=0x2;}this[_0x844f('0x3f')][_0x844f('0xa3')](this,_0x35b666);return this['channel'][_0x844f('0xa8')](util['format'](_0x844f('0xbe'),_0x35b666[_0x844f('0xbf')],_0x35b666['list_id'],_0x35b666[_0x844f('0x44')]));};AGIVertices[_0x844f('0x16')]['custom_app']=function(_0xdb0f4d){logger['info'](util[_0x844f('0x4e')](_0x844f('0xc0'),_0xdb0f4d[_0x844f('0xa7')]));var _0x3d06b6=this[_0x844f('0x32')][_0x844f('0x52')](_0xdb0f4d[_0x844f('0xc1')],_0xdb0f4d['options']);if(_0x3d06b6[_0x844f('0x9f')]===-0x1){return _0x3d06b6;}return this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xc2'),_0xdb0f4d[_0x844f('0xc1')],_0xdb0f4d[_0x844f('0xaa')]));};AGIVertices[_0x844f('0x16')][_0x844f('0xc3')]=function(_0xd2a308){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xc4'),_0xd2a308[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0xd2a308[_0x844f('0x58')])){return this['channel'][_0x844f('0xa8')]('no\x20text\x20configured');}var _0x567c65='\x22'+_0xd2a308['text']+'\x22';if(this[_0x844f('0x7d')](_0xd2a308[_0x844f('0xaa')])){_0x567c65+=','+_0xd2a308[_0x844f('0xaa')];}var _0x23b143=this['channel']['exec'](_0x844f('0xab'),_0x567c65);if(_0x23b143[_0x844f('0x9f')]===-0x1){return _0x23b143;}return this[_0x844f('0x32')][_0x844f('0xa8')](util['format'](_0x844f('0xac'),_0x567c65));};AGIVertices[_0x844f('0x16')][_0x844f('0xc5')]=function(_0x416211){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xc6'),_0x416211[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x416211['text'])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xa9'));}var _0x1a1d12='\x22'+_0x416211[_0x844f('0x58')]+'\x22';if(this[_0x844f('0x7d')](_0x416211[_0x844f('0xaa')])){_0x1a1d12+=','+_0x416211[_0x844f('0xaa')];}var _0x5d08fa=this[_0x844f('0x32')][_0x844f('0x52')](_0x844f('0xab'),_0x1a1d12);if(_0x5d08fa[_0x844f('0x9f')]===-0x1){return _0x5d08fa;}return this[_0x844f('0x32')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1a1d12));};AGIVertices[_0x844f('0x16')][_0x844f('0xc7')]=function(_0x2af1ca){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xc8'),_0x2af1ca[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x2af1ca[_0x844f('0xae')])){return this['channel'][_0x844f('0xa8')](_0x844f('0xaf'));}var _0x95bd76=_0x2af1ca[_0x844f('0xae')];if(this[_0x844f('0x7d')](_0x2af1ca[_0x844f('0xaa')])){_0x95bd76+=','+_0x2af1ca[_0x844f('0xaa')];}var _0x40629c=this[_0x844f('0x32')][_0x844f('0x52')](_0x844f('0xc9'),_0x95bd76);if(_0x40629c[_0x844f('0x9f')]===-0x1){return _0x40629c;}var _0x483169=this[_0x844f('0x9d')](_0x844f('0xca'),'LUMENVOX_ASR_CONFIDENCE');if(_0x483169[_0x844f('0x9f')]===-0x1){return _0x483169;}var _0x1cead3=this[_0x844f('0x9d')](_0x844f('0xcb'),_0x844f('0xcc'));if(_0x1cead3[_0x844f('0x9f')]===-0x1){return _0x1cead3;}var _0x40fd55=this[_0x844f('0x9d')](_0x844f('0xb2'),_0x844f('0xcd'));if(_0x40fd55[_0x844f('0x9f')]===-0x1){return _0x40fd55;}return this[_0x844f('0x32')]['noop'](util[_0x844f('0x4e')](_0x844f('0xce'),_0x95bd76));};AGIVertices[_0x844f('0x16')][_0x844f('0xcf')]=function(_0x3c4900){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xd0'),_0x3c4900['label']));if(!this[_0x844f('0x7d')](_0x3c4900[_0x844f('0xae')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xaf'));}var _0x40a49e=_0x3c4900[_0x844f('0xae')];if(this['isConfigured'](_0x3c4900[_0x844f('0xaa')])){_0x40a49e+=','+_0x3c4900[_0x844f('0xaa')];}var _0x3a81b9=this[_0x844f('0x32')][_0x844f('0x52')]('MRCPRecog',_0x40a49e);if(_0x3a81b9[_0x844f('0x9f')]===-0x1){return _0x3a81b9;}var _0x5662ff=this[_0x844f('0x9d')](_0x844f('0xca'),'SESTEK_ASR_CONFIDENCE');if(_0x5662ff[_0x844f('0x9f')]===-0x1){return _0x5662ff;}var _0x53b15c=this['getAndSetVariable'](_0x844f('0xcb'),'SESTEK_ASR_TRANSCRIPT');if(_0x53b15c[_0x844f('0x9f')]===-0x1){return _0x53b15c;}var _0x2dee41=this['getAndSetVariable'](_0x844f('0xb2'),'SESTEK_ASR_INSTANCE');if(_0x2dee41['result']===-0x1){return _0x2dee41;}return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xce'),_0x40a49e));};AGIVertices['prototype']['database']=function(_0x30367f){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xd1'),_0x30367f[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x30367f[_0x844f('0xd2')])){return this[_0x844f('0x32')]['error'](_0x30367f,_0x844f('0xd3'));}var _0x34d49f=this['getSquareOdbc']['sync'](this,_0x30367f[_0x844f('0xd2')]);if(!_0x34d49f){return this['channel'][_0x844f('0x2e')](_0x30367f,_0x844f('0xd4'));}if(!this[_0x844f('0x7d')](_0x30367f[_0x844f('0x2a')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x30367f,_0x844f('0xd5'));}var _0x10d5f6=_0x30367f[_0x844f('0x2a')][_0x844f('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0x844f('0x32')]['noop'](util[_0x844f('0x4e')](_0x844f('0xd6'),_0x10d5f6));var _0x4a7aa9=this[_0x844f('0x28')][_0x844f('0xa3')](this,_0x34d49f,_0x10d5f6);this['createSquareDetailsReport'][_0x844f('0xa3')](this,_0x30367f,_0x10d5f6);if(!this[_0x844f('0x7d')](_0x30367f['variable_id'])){return this['channel'][_0x844f('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xb081c9=this[_0x844f('0x9e')][_0x844f('0xa3')](this,_0x30367f[_0x844f('0xd7')]);if(!_0xb081c9){return this['channel']['error'](_0x30367f,_0x844f('0xd8'));}var _0x12a122=this;_0x4a7aa9[_0x844f('0xd9')](function(_0x138b16,_0x442afb){Object[_0x844f('0xda')](_0x138b16)[_0x844f('0xd9')](function(_0x4d3e2e){_0x12a122[_0x844f('0x32')]['setVariable'](util[_0x844f('0x4e')]('%s[%s][%s]',_0xb081c9,_0x442afb,_0x4d3e2e),_0x138b16[_0x4d3e2e]);});});this[_0x844f('0x32')]['setVariable'](util[_0x844f('0x4e')]('%s_ROWS_COUNT',_0xb081c9),_0x4a7aa9[_0x844f('0x97')]);return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')]('variable\x20%s\x20set',_0xb081c9));};AGIVertices[_0x844f('0x16')][_0x844f('0xdb')]=function(_0x32b1b8){logger['debug'](util[_0x844f('0x4e')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x32b1b8['label']));if(!this[_0x844f('0x7d')](_0x32b1b8['sip_id'])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x32b1b8,_0x844f('0xdc'));}var _0xf9cddb=this[_0x844f('0xdd')]['sync'](this,_0x32b1b8[_0x844f('0xde')]);if(!_0xf9cddb){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x32b1b8,_0x844f('0xdf'));}var _0x44a6fe=this[_0x844f('0x32')][_0x844f('0x52')](_0x844f('0xe0'),[util['format'](_0x844f('0xe1'),_0xf9cddb),_0x32b1b8['timeout'],_0x32b1b8[_0x844f('0xe2')],_0x32b1b8[_0x844f('0x62')]]);if(_0x44a6fe[_0x844f('0x9f')]===-0x1){return _0x44a6fe;}return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')]('Executed\x20command\x20%s',_0x844f('0xe0')));};AGIVertices[_0x844f('0x16')][_0x844f('0xe3')]=function(_0x4811f8){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xe4'),_0x4811f8[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x4811f8['key'])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20key\x20configured');}if(!this[_0x844f('0x7d')](_0x4811f8[_0x844f('0x58')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xa9'));}this[_0x844f('0x32')]['bot']=!![];this[_0x844f('0xa2')](_0x4811f8);this[_0x844f('0x3e')](_0x4811f8[_0x844f('0x58')],'in','','');this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')]('Trying\x20Dialogflow:\x20%s',_0x4811f8[_0x844f('0x58')]));var _0x41a9ce=this[_0x844f('0x74')][_0x844f('0xa3')](this,_0x4811f8);if(_0x41a9ce){for(var _0x4df841 in _0x41a9ce){if(_0x41a9ce[_0x844f('0x93')](_0x4df841)){this[_0x844f('0x32')][_0x844f('0xe5')](util['format'](_0x844f('0xe6'),_0x4df841[_0x844f('0xe7')]()),_0x41a9ce[_0x4df841]);}}this[_0x844f('0x3e')](_0x41a9ce['speech'],_0x844f('0xe8'),_0x844f('0xe3'),'');return this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xe9'),_0x41a9ce[_0x844f('0xea')]));}return this['channel'][_0x844f('0x2e')](_0x4811f8,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x844f('0xeb')]=function(_0x34bfba){logger['info'](util[_0x844f('0x4e')](_0x844f('0xec'),_0x34bfba[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x34bfba[_0x844f('0xed')])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x34bfba[_0x844f('0xee')])){return this['channel'][_0x844f('0xa8')](_0x844f('0xef'));}if(!this[_0x844f('0x7d')](_0x34bfba[_0x844f('0x77')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xf0'));}if(!this[_0x844f('0x7d')](_0x34bfba[_0x844f('0xf1')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xf2'));}if(!this[_0x844f('0x7d')](_0x34bfba['text'])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xa9'));}this['channel'][_0x844f('0xf3')]=!![];this['createSquareDetailsReport'](_0x34bfba);this[_0x844f('0x3e')](_0x34bfba[_0x844f('0x58')],'in','','');this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xf4'),_0x34bfba[_0x844f('0x58')]));var _0x5251f8=this[_0x844f('0x76')]['sync'](this,_0x34bfba);if(_0x5251f8){for(var _0x35eeaa in _0x5251f8){if(_0x5251f8[_0x844f('0x93')](_0x35eeaa)){if(_0x35eeaa!==_0x844f('0xf5')){this[_0x844f('0x32')]['setVariable'](util[_0x844f('0x4e')](_0x844f('0xe6'),_0x35eeaa[_0x844f('0xe7')]()),_0x5251f8[_0x35eeaa]);}}}this[_0x844f('0x3e')](_0x5251f8[_0x844f('0xea')],'out',_0x844f('0xeb'),_0x5251f8[_0x844f('0xf5')]);return this[_0x844f('0x32')][_0x844f('0xa8')](util['format'](_0x844f('0xf6'),_0x5251f8[_0x844f('0xea')]));}return this[_0x844f('0x32')]['error'](_0x34bfba,_0x844f('0xf7'));};AGIVertices[_0x844f('0x16')][_0x844f('0xf8')]=function(_0x1e43dc){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0xf9'),_0x1e43dc[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x1e43dc['ndauth_url'])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xfa'));}if(!this[_0x844f('0x7d')](_0x1e43dc[_0x844f('0xfb')])){return this[_0x844f('0x32')]['noop']('no\x20username\x20configured');}if(!this['isConfigured'](_0x1e43dc['password'])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20password\x20configured');}if(!this[_0x844f('0x7d')](_0x1e43dc['ndassistant_url'])){return this['channel'][_0x844f('0xa8')](_0x844f('0xa9'));}this[_0x844f('0x32')][_0x844f('0xf3')]=!![];this[_0x844f('0xa2')](_0x1e43dc);this[_0x844f('0x3e')](_0x1e43dc[_0x844f('0x58')],'in','','');this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xfc'),_0x1e43dc['text']));var _0x9a6ac8=this[_0x844f('0x78')][_0x844f('0xa3')](this,_0x1e43dc);if(_0x9a6ac8){for(var _0x25b7d4 in _0x9a6ac8){if(_0x9a6ac8[_0x844f('0x93')](_0x25b7d4)){this[_0x844f('0x32')]['setVariable'](util[_0x844f('0x4e')]('SESTEK_NDA_%s',_0x25b7d4[_0x844f('0xe7')]()),_0x9a6ac8[_0x25b7d4]);}}this[_0x844f('0x3e')](_0x9a6ac8[_0x844f('0xea')],'out',_0x844f('0xf8'),'');if(_0x9a6ac8[_0x844f('0xfd')]){this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xfe'),_0x9a6ac8[_0x844f('0xfd')]));var _0x299397=this[_0x844f('0x32')][_0x844f('0xff')](_0x9a6ac8['audiofile']);try{fs[_0x844f('0x100')](_0x9a6ac8[_0x844f('0xfd')]+_0x844f('0x101'));}catch(_0x25eae7){logger[_0x844f('0x2e')](_0x25eae7);}return _0x299397;}else{return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x102'),_0x9a6ac8[_0x844f('0xea')]));}}return this['channel']['error'](_0x1e43dc,_0x844f('0x103'));};AGIVertices[_0x844f('0x16')][_0x844f('0x104')]=function(_0x475d74){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x105'),_0x475d74[_0x844f('0xa7')]));return this['channel'][_0x844f('0xa8')]('end');};AGIVertices[_0x844f('0x16')]['ext_dial']=function(_0x291120){logger[_0x844f('0x29')](util['format'](_0x844f('0x106'),_0x291120[_0x844f('0xa7')]));var _0x23886a='';if(_0x291120['trunk_id']){if(!this[_0x844f('0x7d')](_0x291120[_0x844f('0x107')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x291120,_0x844f('0x108'));}else{var _0x1a7c1e=parseInt(_0x291120[_0x844f('0x107')],0xa);if(isNaN(_0x1a7c1e)){_0x23886a=_0x291120[_0x844f('0x107')];}else{_0x23886a=this['getTrunk']['sync'](this,_0x291120[_0x844f('0x107')]);if(!_0x23886a){return this[_0x844f('0x32')]['error'](_0x291120,_0x844f('0x109'));}}}}else if(_0x291120[_0x844f('0x10a')]){_0x23886a=_0x291120['trunk_name'];}else{return this[_0x844f('0x32')][_0x844f('0x2e')](_0x291120,_0x844f('0x108'));}var _0x40c446=this[_0x844f('0x32')][_0x844f('0x52')]('DIAL',[util['format']('SIP/%s/%s',_0x23886a,_0x291120[_0x844f('0xbf')]),_0x291120['timeout'],_0x291120[_0x844f('0xe2')],_0x291120[_0x844f('0x62')]]);if(_0x40c446['result']===-0x1){return _0x40c446;}return this[_0x844f('0x32')][_0x844f('0xa8')](util['format'](_0x844f('0x10b'),'DIAL'));};AGIVertices[_0x844f('0x16')][_0x844f('0x10c')]=function(_0x2ef7c6){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x10d'),_0x2ef7c6[_0x844f('0xa7')]));return this[_0x844f('0x32')]['noop'](_0x844f('0x10c'));};AGIVertices[_0x844f('0x16')]['getdigits']=function(_0x9f2c41){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x10e'),_0x9f2c41[_0x844f('0xa7')]));if(_0x9f2c41[_0x844f('0xa4')]===0x0){return this['maxRetry'](_0x9f2c41);}_0x9f2c41[_0x844f('0xa4')]-=0x1;if(!this[_0x844f('0x7d')](_0x9f2c41[_0x844f('0x10f')])){return this['channel'][_0x844f('0x2e')](_0x9f2c41,_0x844f('0x110'));}var _0xce6990=this['getSound'][_0x844f('0xa3')](this,_0x9f2c41[_0x844f('0x10f')]);if(!_0xce6990){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x9f2c41,_0x844f('0x111'));}if(!this[_0x844f('0x7d')](_0x9f2c41['variable_id'])){return this['channel']['error'](_0x844f('0x112'));}var _0x8d9da7=this['channel'][_0x844f('0x113')](_0xce6990,_0x9f2c41[_0x844f('0x114')],_0x9f2c41['maxdigit']);var _0x4f8646=_0x8d9da7[_0x844f('0x9f')]?_0x8d9da7['result'][_0x844f('0x47')]():'';logger[_0x844f('0x29')]('test',JSON['stringify'](_0x8d9da7));if(_0x8d9da7[_0x844f('0x9f')]===-0x1){this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x9f2c41,_0x4f8646);return _0x8d9da7;}else if(_0x8d9da7['extra']===_0x844f('0x65')){_0x8d9da7['result']=_0x4f8646[_0x844f('0x97')]>=parseInt(_0x9f2c41['mindigit'])?'x':'i';}else{_0x8d9da7[_0x844f('0x9f')]=_0x4f8646['length']>=parseInt(_0x9f2c41['mindigit'])&&_0x4f8646['length']<=parseInt(_0x9f2c41[_0x844f('0x115')])?'x':'i';}var _0xd6d73e=this[_0x844f('0x9e')]['sync'](this,_0x9f2c41['variable_id']);if(!_0xd6d73e){return this[_0x844f('0x32')]['error'](_0x9f2c41,_0x844f('0xd8'));}this['channel'][_0x844f('0xe5')](_0xd6d73e,_0x4f8646);if(this['isConfigured'](_0x9f2c41[_0x844f('0x116')])){var _0x201005=parseInt(_0x9f2c41[_0x844f('0x116')],0xa);var _0x19f1f9=rs[_0x844f('0x117')]({'charset':'*','length':_0x201005});var _0x2152d7=_0x4f8646[_0x844f('0x97')];if(_0x2152d7>0x0){if(_0x2152d7>_0x201005){this[_0x844f('0xa2')]['sync'](this,_0x9f2c41,_0x9f2c41[_0x844f('0x118')]===_0x844f('0x119')?_0x19f1f9+_0x4f8646['substr'](_0x201005):_0x4f8646[_0x844f('0x11a')](0x0,_0x2152d7-_0x201005)+_0x19f1f9);}else{this['createSquareDetailsReport'][_0x844f('0xa3')](this,_0x9f2c41,rs[_0x844f('0x117')]({'charset':'*','length':_0x2152d7}));}}else{this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x9f2c41,'');}}else{this[_0x844f('0xa2')]['sync'](this,_0x9f2c41,_0x4f8646);}return _0x8d9da7;};AGIVertices[_0x844f('0x16')][_0x844f('0xd')]=function(_0x3a136d){logger['info'](util[_0x844f('0x4e')](_0x844f('0x11b'),_0x3a136d[_0x844f('0xa7')]));return this[_0x844f('0xc')](_0x3a136d);};AGIVertices[_0x844f('0x16')]['goal']=function(_0x210eb8){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x11c'),_0x210eb8[_0x844f('0xa7')]));this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x210eb8,_0x210eb8[_0x844f('0x11d')]);return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x11e'),_0x210eb8['goalname']));};AGIVertices[_0x844f('0x16')]['awspolly']=function(_0x2a5baa){logger[_0x844f('0x29')](util[_0x844f('0x4e')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2a5baa[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x2a5baa['aws_access_key_id'])||!this[_0x844f('0x7d')](_0x2a5baa[_0x844f('0x80')])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2a5baa[_0x844f('0x58')])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x844f('0x4e')](_0x844f('0x11f'),_0x2a5baa[_0x844f('0x58')]));var _0x3241dd=this[_0x844f('0x7f')][_0x844f('0xa3')](this,_0x2a5baa);if(_0x3241dd){this['channel']['noop'](util[_0x844f('0x4e')](_0x844f('0x120'),_0x3241dd));var _0x237ec5=this[_0x844f('0x32')][_0x844f('0xff')](_0x3241dd);try{fs[_0x844f('0x100')](_0x3241dd+_0x844f('0x101'));}catch(_0x47115e){logger['error'](_0x47115e);}return _0x237ec5;}return this[_0x844f('0x32')][_0x844f('0x2e')](_0x2a5baa,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x844f('0x16')][_0x844f('0x121')]=function(_0x397faa){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x122'),_0x397faa[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x397faa['aws_access_key_id'])||!this[_0x844f('0x7d')](_0x397faa[_0x844f('0x80')])){return this['channel'][_0x844f('0xa8')](_0x844f('0x123'));}if(!this['isConfigured'](_0x397faa[_0x844f('0x88')])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x397faa['text'])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xa9'));}this[_0x844f('0x32')][_0x844f('0xf3')]=!![];this['createSquareDetailsReport'](_0x397faa);this[_0x844f('0x3e')](_0x397faa[_0x844f('0x58')],'in','','');this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x124'),_0x397faa[_0x844f('0x58')]));var _0x432efa=this['awsLex'][_0x844f('0xa3')](this,_0x397faa);if(_0x432efa){for(var _0x1df225 in _0x432efa){if(_0x432efa[_0x844f('0x93')](_0x1df225)&&_[_0x844f('0x91')](_0x432efa[_0x1df225])){this[_0x844f('0x32')][_0x844f('0xe5')](util[_0x844f('0x4e')](_0x844f('0x125'),_0x1df225['toUpperCase']()),_0x432efa[_0x1df225]);}}if(_[_0x844f('0x41')](_0x432efa[_0x844f('0x72')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0x126'));}else{this['createSquareMessage'](_0x432efa[_0x844f('0x72')],_0x844f('0xe8'),'amazonlex','');return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x127'),_0x432efa['message']));}}return this[_0x844f('0x32')][_0x844f('0x2e')](_0x397faa,_0x844f('0x128'));};AGIVertices[_0x844f('0x16')][_0x844f('0x129')]=function(_0x3607ee){logger[_0x844f('0x29')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3607ee[_0x844f('0xa7')],_0x3607ee[_0x844f('0x65')]));if(!this[_0x844f('0x7d')](_0x3607ee[_0x844f('0x75')])){return this['channel']['noop'](_0x844f('0x12a'));}var _0x47bb72=_0x844f('0x12b');var _0x43925f=util[_0x844f('0x4e')](_0x844f('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x91177e=util[_0x844f('0x4e')]('%s.%s',_0x43925f,_0x47bb72);var _0x28b851=!![];if(_0x3607ee[_0x844f('0x12d')]===_0x844f('0x12e')){_0x28b851=![];}var _0x73e596=this[_0x844f('0x32')][_0x844f('0x12f')](_0x43925f,_0x47bb72,_0x3607ee['intKey'],_0x3607ee['timeout'],undefined,_0x28b851);if(_0x73e596['result']!==-0x1){this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')]('google\x20%s\x20file\x20created',_0x91177e));var _0x27b266=this[_0x844f('0x89')][_0x844f('0xa3')](this,_0x3607ee,_0x91177e);if(_0x27b266){for(var _0x55f91d in _0x27b266){if(_0x27b266[_0x844f('0x93')](_0x55f91d)){this[_0x844f('0x32')][_0x844f('0xe5')](util[_0x844f('0x4e')](_0x844f('0x130'),_0x55f91d[_0x844f('0xe7')]()),_0x27b266[_0x55f91d]);}}return this['channel'][_0x844f('0xa8')](util['format'](_0x844f('0x131'),JSON['stringify'](_0x27b266)));}}return _0x73e596;};AGIVertices[_0x844f('0x16')]['tildeasr']=function(_0x346a15){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x132'),_0x346a15['label']));if(!this[_0x844f('0x7d')](_0x346a15[_0x844f('0x133')])){return this['channel'][_0x844f('0xa8')]('no\x20appid\x20configured');}if(!this[_0x844f('0x7d')](_0x346a15[_0x844f('0x8c')])){return this[_0x844f('0x32')]['noop'](_0x844f('0x134'));}var _0x4026da=_0x844f('0x12b');var _0x447d00=util[_0x844f('0x4e')](_0x844f('0x12c'),FILES_PATH,rs[_0x844f('0x117')](0x4));var _0x2e2568=util[_0x844f('0x4e')](_0x844f('0x99'),_0x447d00,_0x4026da);var _0x47908a=!![];if(_0x346a15[_0x844f('0x12d')]===_0x844f('0x12e')){_0x47908a=![];}var _0x28c093=this[_0x844f('0x32')][_0x844f('0x12f')](_0x447d00,_0x4026da,_0x346a15['intKey'],_0x346a15[_0x844f('0x65')],undefined,_0x47908a);if(_0x28c093[_0x844f('0x9f')]!==-0x1){this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x135'),_0x2e2568));var _0x172e23=this[_0x844f('0x8b')][_0x844f('0xa3')](this,_0x346a15,_0x2e2568);if(_0x172e23){for(var _0x2ecb48 in _0x172e23){if(_0x172e23[_0x844f('0x93')](_0x2ecb48)){this[_0x844f('0x32')][_0x844f('0xe5')](util[_0x844f('0x4e')](_0x844f('0x136'),_0x2ecb48['toUpperCase']()),_0x172e23[_0x2ecb48]);}}return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x137'),JSON[_0x844f('0x6d')](_0x172e23)));}}return _0x28c093;};AGIVertices['prototype'][_0x844f('0x138')]=function(_0x54bd26){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x139'),_0x54bd26[_0x844f('0xa7')]));return this[_0x844f('0x32')][_0x844f('0x13a')](_0x54bd26['context'],_0x54bd26[_0x844f('0x39')],_0x54bd26[_0x844f('0x3a')]);};AGIVertices[_0x844f('0x16')][_0x844f('0x13b')]=function(_0x28b1f9){logger[_0x844f('0x29')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x28b1f9[_0x844f('0xa7')]));if(!this['isConfigured'](_0x28b1f9[_0x844f('0x13c')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x28b1f9,'no\x20condition\x20configured');}try{var _0x1c022f=eval(_0x28b1f9[_0x844f('0x13c')])?_0x844f('0x13d'):_0x844f('0x13e');this[_0x844f('0x32')]['noop'](util['format'](_0x844f('0x13f'),_0x28b1f9[_0x844f('0x13c')],_0x1c022f));return{'code':0xc8,'result':_0x1c022f};}catch(_0x56c0fb){return{'code':0xc8,'result':_0x844f('0x13e')};}};AGIVertices[_0x844f('0x16')][_0x844f('0x140')]=function(_0x169e6a){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x141'),_0x169e6a[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x169e6a[_0x844f('0x142')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x169e6a,_0x844f('0x143'));}var _0x137af9=this['getIntervals'][_0x844f('0xa3')](this,_0x169e6a['interval_id']);if(!_0x137af9){return this[_0x844f('0x32')]['error'](_0x169e6a,_0x844f('0x144'));}for(var _0x142279=0x0;_0x142279<_0x137af9[_0x844f('0x97')];_0x142279+=0x1){var _0x23f65f=this['channel'][_0x844f('0x9e')](util['format'](_0x844f('0x145'),_0x137af9[_0x142279]));if(_0x23f65f['result']===-0x1){return _0x23f65f;}logger['info'](util[_0x844f('0x4e')](_0x844f('0x146'),_0x137af9[_0x142279],_0x23f65f[_0x844f('0x9c')]));if(_0x23f65f[_0x844f('0x9c')]===_0x844f('0x13d')){logger[_0x844f('0x29')](util['format']('IFTIME\x20%s\x20%s',_0x137af9[_0x142279],'true'));this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x146'),_0x137af9[_0x142279],_0x844f('0x13d')));return{'code':0xc8,'result':_0x844f('0x13d')};}else{logger[_0x844f('0x29')](util['format']('IFTIME\x20%s\x20%s',_0x137af9[_0x142279],'false'));this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x146'),_0x137af9[_0x142279],_0x844f('0x13e')));}}return{'code':0xc8,'result':_0x844f('0x13e')};};AGIVertices[_0x844f('0x16')]['hangup']=function(_0x4fd1bd){logger['info'](util[_0x844f('0x4e')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x4fd1bd['label']));return this['channel']['hangup']();};AGIVertices[_0x844f('0x16')][_0x844f('0x147')]=function(_0xcf9e1d){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x148'),_0xcf9e1d['label']));if(!this[_0x844f('0x7d')](_0xcf9e1d[_0x844f('0x75')])){return this['channel'][_0x844f('0xa8')](_0x844f('0x12a'));}var _0x34e194=_0x844f('0x12b');var _0x3aa293=util[_0x844f('0x4e')](_0x844f('0x12c'),FILES_PATH,rs[_0x844f('0x117')](0x4));var _0x64d4f1=util['format'](_0x844f('0x99'),_0x3aa293,_0x34e194);var _0x3b33b6=!![];if(_0xcf9e1d['beep']===_0x844f('0x12e')){_0x3b33b6=![];}var _0x3cb131=this['channel']['recordFile'](_0x3aa293,_0x34e194,_0xcf9e1d[_0x844f('0x149')],_0xcf9e1d['timeout'],undefined,_0x3b33b6);if(_0x3cb131[_0x844f('0x9f')]!==-0x1){this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x14a'),_0x64d4f1));var _0x33aeae=this[_0x844f('0x7b')][_0x844f('0xa3')](this,_0xcf9e1d,_0x64d4f1);if(_0x33aeae){for(var _0x25547b in _0x33aeae){if(_0x33aeae[_0x844f('0x93')](_0x25547b)){this[_0x844f('0x32')]['setVariable'](util[_0x844f('0x4e')](_0x844f('0x14b'),_0x25547b[_0x844f('0xe7')]()),_0x33aeae[_0x25547b]);}}return this[_0x844f('0x32')]['noop'](util[_0x844f('0x4e')](_0x844f('0x14c'),JSON[_0x844f('0x6d')](_0x33aeae)));}}return _0x3cb131;};AGIVertices[_0x844f('0x16')][_0x844f('0x14d')]=function(_0x213495){logger[_0x844f('0x29')](util['format'](_0x844f('0x14e'),_0x213495[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x213495[_0x844f('0x75')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0x12a'));}if(!this['isConfigured'](_0x213495[_0x844f('0x58')])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20text\x20configured');}this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x14f'),_0x213495[_0x844f('0x58')]));var _0x44761b=this[_0x844f('0x79')]['sync'](this,_0x213495);if(_0x44761b){this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x14a'),_0x44761b));var _0x47704f=this[_0x844f('0x32')][_0x844f('0xff')](_0x44761b,_0x213495['intKey']);try{fs[_0x844f('0x100')](_0x44761b+_0x844f('0x101'));}catch(_0x371f63){logger['error'](_0x371f63);}return _0x47704f;}return this['channel'][_0x844f('0x2e')](_0x213495,_0x844f('0x150'));};AGIVertices[_0x844f('0x16')]['login']=function(_0x2adda6){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x151'),_0x2adda6['label']));if(!this['isConfigured'](_0x2adda6[_0x844f('0x152')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x2adda6,'no\x20find\x20by\x20configured');}logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x153'),this[_0x844f('0x32')][_0x844f('0x35')],_0x2adda6[_0x844f('0x152')]));var _0x58e4de=this['agentLogin'][_0x844f('0xa3')](this,_0x2adda6[_0x844f('0x152')]);if(_0x58e4de){logger[_0x844f('0x29')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x844f('0x32')][_0x844f('0x35')],_0x2adda6[_0x844f('0x152')]));this[_0x844f('0x32')][_0x844f('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x844f('0x32')][_0x844f('0x35')],_0x2adda6['findBy']));return{'code':0xc8,'result':_0x844f('0x154')};}else{logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x155'),this[_0x844f('0x32')][_0x844f('0x35')],_0x2adda6[_0x844f('0x152')]));this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x844f('0x35')],_0x2adda6['findBy']));return{'code':0xc8,'result':_0x844f('0x156')};}};AGIVertices[_0x844f('0x16')][_0x844f('0x157')]=function(_0x5060f5){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x158'),_0x5060f5[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x5060f5['findBy'])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x5060f5,'no\x20find\x20by\x20configured');}logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x153'),this[_0x844f('0x32')][_0x844f('0x35')],_0x5060f5[_0x844f('0x152')]));var _0x373077=this[_0x844f('0x159')][_0x844f('0xa3')](this,_0x5060f5[_0x844f('0x152')]);if(_0x373077){logger[_0x844f('0x29')](util[_0x844f('0x4e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x844f('0x32')][_0x844f('0x35')],_0x5060f5[_0x844f('0x152')]));this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x15a'),this['channel'][_0x844f('0x35')],_0x5060f5[_0x844f('0x152')]));return{'code':0xc8,'result':_0x844f('0x154')};}else{logger[_0x844f('0x29')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x844f('0x32')]['callerid'],_0x5060f5[_0x844f('0x152')]));this[_0x844f('0x32')]['noop'](util[_0x844f('0x4e')](_0x844f('0x155'),this[_0x844f('0x32')][_0x844f('0x35')],_0x5060f5['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x844f('0x15b')]=function(_0x482d7a){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x15c'),_0x482d7a[_0x844f('0xa7')]));if(!this['isConfigured'](_0x482d7a[_0x844f('0x15d')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x482d7a,_0x844f('0x15e'));}this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x15f'),_0x482d7a[_0x844f('0x15d')]));var _0x4f0345=eval(_0x482d7a[_0x844f('0x15d')]);if(!this[_0x844f('0x7d')](_0x482d7a['variable_id'])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x35fa73=this['getVariable'][_0x844f('0xa3')](this,_0x482d7a[_0x844f('0xd7')]);if(!_0x35fa73){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x482d7a,_0x844f('0xd8'));}if(_['isArray'](_0x4f0345)){var _0x259c05=this;_0x4f0345[_0x844f('0xd9')](function(_0x24b2dc,_0xc009d7){_0x259c05[_0x844f('0x32')][_0x844f('0xe5')](util['format'](_0x844f('0x160'),_0x35fa73,_0xc009d7),_0x24b2dc);});return this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x161'),_0x35fa73));}else{return this[_0x844f('0x32')][_0x844f('0xe5')](_0x35fa73,_0x4f0345);}};AGIVertices[_0x844f('0x16')][_0x844f('0xb')]=function(_0xf408a5){logger[_0x844f('0x29')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0xf408a5[_0x844f('0xa7')]));if(_0xf408a5[_0x844f('0xa4')]===0x0){return this['maxRetry'](_0xf408a5);}_0xf408a5[_0x844f('0xa4')]-=0x1;if(!this[_0x844f('0x7d')](_0xf408a5['file_id'])){return this[_0x844f('0x32')]['error'](_0xf408a5,_0x844f('0x110'));}var _0x1da188=this[_0x844f('0x1d')][_0x844f('0xa3')](this,_0xf408a5[_0x844f('0x10f')]);if(!_0x1da188){return this[_0x844f('0x32')][_0x844f('0x2e')](_0xf408a5,_0x844f('0x111'));}var _0xff614e=this['channel'][_0x844f('0x113')](_0x1da188,_0xf408a5[_0x844f('0x114')],_0xf408a5[_0x844f('0x162')]);var _0x1735f4=_0xff614e['result'];if(_0xff614e[_0x844f('0x9f')]===-0x1){this['createSquareDetailsReport'][_0x844f('0xa3')](this,_0xf408a5,'-1');return _0xff614e;}else if(_0xff614e[_0x844f('0x9c')]==='timeout'){_0xff614e[_0x844f('0x9f')]=_0xff614e[_0x844f('0x9f')][_0x844f('0x97')]>0x0?_0xff614e[_0x844f('0x9f')]:'t';}else if(_[_0x844f('0x40')](_0xff614e[_0x844f('0x9f')])){_0xff614e[_0x844f('0x9f')]='#';_0x1735f4='#';}if(!this['isConfigured'](_0xf408a5['variable_id'])){this['channel'][_0x844f('0xa8')](_0x844f('0x112'));}else{var _0x877345=this['getVariable']['sync'](this,_0xf408a5[_0x844f('0xd7')]);if(!_0x877345){return this[_0x844f('0x32')][_0x844f('0x2e')](_0xf408a5,_0x844f('0xd8'));}this[_0x844f('0x32')][_0x844f('0xe5')](_0x877345,_0x1735f4);}this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0xf408a5,_0x1735f4);return _0xff614e;};AGIVertices[_0x844f('0x16')][_0x844f('0xa8')]=function(_0x5d8491){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x163'),_0x5d8491[_0x844f('0xa7')]));return this[_0x844f('0x32')]['noop'](_0x5d8491[_0x844f('0x164')]||_0x5d8491[_0x844f('0xa7')]);};AGIVertices['prototype'][_0x844f('0x165')]=function(_0x11d0b6){logger['info'](util[_0x844f('0x4e')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x11d0b6['label']));if(!this[_0x844f('0x7d')](_0x11d0b6['findBy'])){return this['channel'][_0x844f('0x2e')](_0x11d0b6,_0x844f('0x166'));}logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x153'),this[_0x844f('0x32')]['callerid'],_0x11d0b6[_0x844f('0x152')]));var _0xc2e86e=this[_0x844f('0x49')][_0x844f('0xa3')](this,_0x11d0b6['pause_id']);var _0x19446e=this[_0x844f('0x4b')][_0x844f('0xa3')](this,_0x11d0b6[_0x844f('0x152')],_0xc2e86e);if(_0x19446e){logger['info'](util[_0x844f('0x4e')](_0x844f('0x15a'),this['channel'][_0x844f('0x35')],_0x11d0b6[_0x844f('0x152')]));this[_0x844f('0x32')]['noop'](util[_0x844f('0x4e')](_0x844f('0x15a'),this[_0x844f('0x32')][_0x844f('0x35')],_0x11d0b6[_0x844f('0x152')]));return{'code':0xc8,'result':_0x844f('0x154')};}else{logger[_0x844f('0x29')](util[_0x844f('0x4e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x844f('0x32')][_0x844f('0x35')],_0x11d0b6[_0x844f('0x152')]));this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x15a'),this[_0x844f('0x32')][_0x844f('0x35')],_0x11d0b6[_0x844f('0x152')]));return{'code':0xc8,'result':_0x844f('0x156')};}};AGIVertices[_0x844f('0x16')][_0x844f('0x167')]=function(_0x249dd5){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x168'),_0x249dd5[_0x844f('0xa7')]));if(!this['isConfigured'](_0x249dd5[_0x844f('0x10f')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x249dd5,_0x844f('0x110'));}var _0x4e2189=this[_0x844f('0x1d')][_0x844f('0xa3')](this,_0x249dd5[_0x844f('0x10f')]);if(!_0x4e2189){return this['channel'][_0x844f('0x2e')](_0x249dd5,_0x844f('0x111'));}var _0x305067=this[_0x844f('0x32')][_0x844f('0x52')](_0x844f('0x169'),[_0x4e2189,_0x249dd5[_0x844f('0xe2')]]);if(_0x305067[_0x844f('0x9f')]===-0x1){return _0x305067;}return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')]('Executed\x20command\x20%s\x20%s',_0x844f('0x169'),_0x4e2189));};AGIVertices['prototype'][_0x844f('0x16a')]=function(_0x4f4a2b){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x16b'),_0x4f4a2b[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x4f4a2b[_0x844f('0x16c')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x4f4a2b,_0x844f('0x16d'));}var _0x291ac1='';var _0x4a7db5=parseInt(_0x4f4a2b['queue_id'],0xa);if(isNaN(_0x4a7db5)){_0x291ac1=_0x4f4a2b['queue_id'];}else{_0x291ac1=this[_0x844f('0x13')]['sync'](this,_0x4f4a2b[_0x844f('0x16c')]);if(!_0x291ac1){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x4f4a2b,'no\x20queue\x20found');}}var _0x5311f3='';if(this[_0x844f('0x7d')](_0x4f4a2b[_0x844f('0x10f')])){var _0x426cd8=this[_0x844f('0x1d')]['sync'](this,_0x4f4a2b[_0x844f('0x10f')]);if(_0x426cd8){_0x5311f3=_0x426cd8;}}this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x4f4a2b,_0x291ac1);if(_0x4f4a2b['opts'][_0x844f('0x16e')]('x')<0x0){_0x4f4a2b[_0x844f('0xe2')]+='x';}if(_0x4f4a2b[_0x844f('0xe2')][_0x844f('0x16e')]('X')<0x0){_0x4f4a2b['opts']+='X';}this[_0x844f('0x32')]['setVariable'](_0x844f('0x16f'),_0x291ac1?_0x291ac1[_0x844f('0x170')]():'');var _0x4e1389=this[_0x844f('0x32')][_0x844f('0x52')](_0x844f('0x171'),[_0x291ac1,_0x4f4a2b[_0x844f('0xe2')],_0x4f4a2b[_0x844f('0x62')],_0x5311f3,_0x4f4a2b[_0x844f('0x65')],_0x4f4a2b[_0x844f('0xb4')],_0x4f4a2b[_0x844f('0x172')],_0x4f4a2b[_0x844f('0x173')],'',_0x4f4a2b[_0x844f('0x174')]]);if(_0x4e1389['result']===-0x1){return _0x4e1389;}return this[_0x844f('0x32')]['noop'](util['format'](_0x844f('0xc2'),_0x844f('0x171'),_0x291ac1));};AGIVertices[_0x844f('0x16')]['record']=function(_0x4bc316){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x175'),_0x4bc316[_0x844f('0xa7')]));var _0x5a7761=_0x4bc316['recordingFormat']||_0x844f('0x12b');var _0x4a7301=util['format'](_0x844f('0x176'),this['channel'][_0x844f('0x37')],rs['generate'](0x5));var _0x4f2a0d=util[_0x844f('0x4e')](_0x844f('0x177'),FILES_PATH,_0x4a7301,_0x5a7761);var _0x429526=util['format']('%s/recordings/%s',FILES_PATH,_0x4a7301);this[_0x844f('0x36')][_0x844f('0xa3')](this,_0x4bc316,_0x4a7301,_0x4f2a0d);this['channel'][_0x844f('0xe5')](_0x844f('0x178'),_0x4a7301);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x429526,_0x5a7761,_0x4bc316[_0x844f('0x179')],_0x4bc316[_0x844f('0x65')]);return this[_0x844f('0x32')]['recordFile'](_0x429526,_0x5a7761,_0x4bc316[_0x844f('0x179')],_0x4bc316['timeout'],undefined,!![]);};AGIVertices[_0x844f('0x16')][_0x844f('0x17a')]=function(_0x426fc9){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x17b'),_0x426fc9[_0x844f('0xa7')]));if(!this['isConfigured'](_0x426fc9[_0x844f('0x62')])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20url\x20configured');}var _0x152414=this[_0x844f('0x61')][_0x844f('0xa3')](this,_0x426fc9);logger[_0x844f('0x29')](util['format'](_0x844f('0x17c'),util[_0x844f('0x17d')](_0x152414,{'showHidden':![],'depth':null})));if(!this[_0x844f('0x7d')](_0x426fc9[_0x844f('0xd7')])){return this['channel'][_0x844f('0xa8')](_0x844f('0x17e'));}var _0x35eec1=this['getVariable'][_0x844f('0xa3')](this,_0x426fc9[_0x844f('0xd7')]);if(!_0x35eec1){return this['channel'][_0x844f('0x2e')](_0x426fc9,_0x844f('0xd8'));}this['channel']['setVariable'](util[_0x844f('0x4e')]('%s_STATUS_CODE',_0x35eec1),_0x152414[_0x844f('0x70')]?_0x152414[_0x844f('0x70')]:'200');this['channel'][_0x844f('0xe5')](util[_0x844f('0x4e')](_0x844f('0x17f'),_0x35eec1),_0x152414[_0x844f('0x71')]?_0x152414['statusMessage']:'OK');if(_0x152414['body']){try{this[_0x844f('0x98')](_0x152414['body'],_0x35eec1);}catch(_0x42b84c){logger['error'](util[_0x844f('0x4e')](_0x844f('0x180'),_0x35eec1));}}return this[_0x844f('0x32')]['noop'](util['format'](_0x844f('0x181'),_0x35eec1));};AGIVertices['prototype'][_0x844f('0x182')]=function(_0x23033f){logger[_0x844f('0x29')](util['format'](_0x844f('0x183'),_0x23033f['label']));return this['channel'][_0x844f('0x184')](_0x23033f[_0x844f('0x185')][_0x844f('0x54')](/\s+/g,''),_0x23033f[_0x844f('0x179')]);};AGIVertices['prototype'][_0x844f('0x186')]=function(_0x4a6b03){logger['info'](util[_0x844f('0x4e')](_0x844f('0x187'),_0x4a6b03[_0x844f('0xa7')]));return this[_0x844f('0x32')][_0x844f('0x188')](_0x4a6b03[_0x844f('0x64')][_0x844f('0x54')](/\s+/g,''),_0x4a6b03[_0x844f('0x179')]);};AGIVertices[_0x844f('0x16')]['sayphonetic']=function(_0x53fcbb){logger['info'](util[_0x844f('0x4e')](_0x844f('0x189'),_0x53fcbb[_0x844f('0xa7')]));return this['channel'][_0x844f('0x18a')](_0x53fcbb[_0x844f('0x58')],_0x53fcbb['escape_digits']);};AGIVertices[_0x844f('0x16')][_0x844f('0x18b')]=function(_0x2a5655){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x18c'),_0x2a5655[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x2a5655[_0x844f('0x18d')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0x18e'));}var _0x384ed8=this['getMailAccount'][_0x844f('0xa3')](this,_0x2a5655['account_id']);if(!_0x384ed8||!_0x384ed8[_0x844f('0x18f')]){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x2a5655,_0x844f('0x190'));}var _0xe19fe5={'from':util[_0x844f('0x4e')](_0x844f('0x191'),_0x384ed8[_0x844f('0x11')],_0x384ed8[_0x844f('0x192')]||_0x384ed8[_0x844f('0x18f')][_0x844f('0x193')]),'to':_0x2a5655['to']||'','cc':_0x2a5655['cc']||'','bcc':_0x2a5655['bcc']||'','subject':_0x2a5655['subject'],'html':_0x2a5655[_0x844f('0x58')],'text':_0x2a5655[_0x844f('0x58')]};if(this[_0x844f('0x7d')](_0x2a5655[_0x844f('0x194')])){}logger[_0x844f('0x195')](_0x844f('0x196'),JSON['stringify'](_0xe19fe5));this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x2a5655,_0x2a5655['account_id']);this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x197'),_0x384ed8['name']));this['sendMailMessage']['sync'](this,_0x384ed8[_0x844f('0x198')],_0xe19fe5);return this[_0x844f('0x32')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x844f('0x16')][_0x844f('0x199')]=function(_0x34014e){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x19a'),_0x34014e[_0x844f('0xa7')]));return this['channel']['noop'](_0x844f('0x19b'));};AGIVertices['prototype']['sendSMS']=function(_0x13d1d7){logger[_0x844f('0x29')](util[_0x844f('0x4e')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x13d1d7[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x13d1d7[_0x844f('0x19c')])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20sms\x20account\x20configured');}var _0x4643ec=this[_0x844f('0x30')][_0x844f('0xa3')](this,_0x13d1d7[_0x844f('0x19c')]);if(!_0x4643ec){return this[_0x844f('0x32')]['error'](_0x13d1d7,_0x844f('0x19d'));}var _0x9b2254={'body':_0x13d1d7[_0x844f('0x19e')],'phone':_0x13d1d7['to']||'','SmsAccountId':_0x4643ec['id']};logger[_0x844f('0x195')]('sendSMS\x20message',JSON[_0x844f('0x6d')](_0x9b2254));this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x13d1d7,_0x13d1d7['sms_account_id']);this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x19f'),_0x4643ec['name']));this['createSmsMessage'][_0x844f('0xa3')](this,_0x9b2254);return this['channel'][_0x844f('0xa8')](_0x844f('0x1a0'));};AGIVertices['prototype'][_0x844f('0x1a1')]=function(_0x3cb4d6){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x1a2'),_0x3cb4d6[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x3cb4d6[_0x844f('0xd7')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x3cb4d6,_0x844f('0x1a3'));}var _0x795517=this[_0x844f('0x9e')][_0x844f('0xa3')](this,_0x3cb4d6[_0x844f('0xd7')]);if(!_0x795517){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x3cb4d6,_0x844f('0xd8'));}return this[_0x844f('0x32')][_0x844f('0xe5')](_0x795517,_0x3cb4d6[_0x844f('0x1a4')]);};AGIVertices[_0x844f('0x16')][_0x844f('0x1a5')]=function(_0x4054b7){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x1a6'),_0x4054b7[_0x844f('0xa7')]));this[_0x844f('0x32')][_0x844f('0xa8')]('START\x20CALLY\x20SQUARE');if(_0x4054b7['answer']===_0x844f('0x1a7')){this['channel'][_0x844f('0xa8')]('Answer');return this[_0x844f('0x32')]['answer']();}return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0x1a8'));};AGIVertices[_0x844f('0x16')]['subproject']=function(_0xf3b498){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x1a9'),_0xf3b498[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0xf3b498['project_id'])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0xf3b498,'no\x20subproject\x20selected');}var _0x27b9cf=this[_0x844f('0x17')][_0x844f('0xa3')](this,_0xf3b498[_0x844f('0x1aa')]);if(!this[_0x844f('0x7d')](_0x27b9cf)){return this[_0x844f('0x32')][_0x844f('0x2e')](_0xf3b498,util['format'](_0x844f('0x1ab'),_0xf3b498[_0x844f('0x1aa')]));}if(_0x27b9cf===this[_0x844f('0x32')][_0x844f('0x34')]){return this[_0x844f('0x32')][_0x844f('0x2e')](_0xf3b498,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x844f('0xa2')]['sync'](this,_0xf3b498,_0x27b9cf);var _0xd7b88b=this[_0x844f('0x32')][_0x844f('0x52')](_0x844f('0x1ac'),util[_0x844f('0x4e')](_0x844f('0x1ad'),config[_0x844f('0xb4')][_0x844f('0x1ae')]||'127.0.0.1',_0x27b9cf,this[_0x844f('0x32')]['arg_1']));if(_0xd7b88b[_0x844f('0x9f')]===-0x1){return _0xd7b88b;}return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xc2'),_0x844f('0x1ac'),_0x27b9cf));};AGIVertices[_0x844f('0x16')][_0x844f('0x1af')]=function(_0x3aa492){logger[_0x844f('0x29')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3aa492[_0x844f('0xa7')]));var _0x901263=this[_0x844f('0x51')][_0x844f('0xa3')](this,_0x3aa492['command']);this[_0x844f('0xa2')][_0x844f('0xa3')](this,_0x3aa492,_0x3aa492[_0x844f('0xb5')]);if(this[_0x844f('0x7d')](_0x3aa492['variable_id'])){var _0x180a74=this[_0x844f('0x9e')][_0x844f('0xa3')](this,_0x3aa492[_0x844f('0xd7')]);if(_0x180a74){this['channel'][_0x844f('0xe5')](_0x180a74,_0x901263);return this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x1b0'),_0x3aa492[_0x844f('0xb5')],_0x180a74));}}return this['channel'][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x1b1'),_0x3aa492[_0x844f('0xb5')]));};AGIVertices[_0x844f('0x16')][_0x844f('0x1b2')]=function(_0x921b69){logger[_0x844f('0x29')](util['format'](_0x844f('0x1b3'),_0x921b69[_0x844f('0xa7')]));_0x921b69['text']=_0x921b69[_0x844f('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x844f('0x7d')](_0x921b69[_0x844f('0x56')])){return this[_0x844f('0x32')]['noop'](_0x844f('0x1b4'));}if(!this[_0x844f('0x7d')](_0x921b69[_0x844f('0x58')])){return this[_0x844f('0x32')][_0x844f('0xa8')](_0x844f('0xa9'));}this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0x1b5'),_0x921b69[_0x844f('0x58')]));var _0x4733b0=this[_0x844f('0x55')][_0x844f('0xa3')](this,_0x921b69);if(_0x4733b0){this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4733b0));var _0x28a01a=this[_0x844f('0x32')][_0x844f('0xff')](_0x4733b0);try{fs[_0x844f('0x100')](_0x4733b0+'.wav');}catch(_0x59318d){logger[_0x844f('0x2e')](_0x59318d);}return _0x28a01a;}return this[_0x844f('0x32')][_0x844f('0x2e')](_0x921b69,_0x844f('0x1b6'));};AGIVertices[_0x844f('0x16')][_0x844f('0x1b7')]=function(_0x4e1250){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x1b8'),_0x4e1250[_0x844f('0xa7')]));_0x4e1250[_0x844f('0x58')]=_0x4e1250['text'][_0x844f('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x844f('0x7d')](_0x4e1250['text'])){return this[_0x844f('0x32')][_0x844f('0xa8')]('no\x20text\x20configured');}this['channel'][_0x844f('0xa8')](util['format'](_0x844f('0x1b9'),_0x4e1250[_0x844f('0x58')]));var _0x1420de=this['googleTTS']['sync'](this,_0x4e1250);if(_0x1420de){this[_0x844f('0x32')]['noop'](util['format'](_0x844f('0x1ba'),_0x1420de));var _0x159af7=this[_0x844f('0x32')][_0x844f('0xff')](_0x1420de);try{fs[_0x844f('0x100')](_0x1420de+_0x844f('0x101'));}catch(_0x51547e){logger[_0x844f('0x2e')](_0x51547e);}return _0x159af7;}return this[_0x844f('0x32')][_0x844f('0x2e')](_0x4e1250,_0x844f('0x1bb'));};AGIVertices[_0x844f('0x16')][_0x844f('0x1bc')]=function(_0x1cb6aa){logger[_0x844f('0x29')](util['format'](_0x844f('0x1bd'),_0x1cb6aa[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x1cb6aa[_0x844f('0x152')])){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x1cb6aa,'no\x20find\x20by\x20configured');}logger[_0x844f('0x29')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x1cb6aa[_0x844f('0x152')]));var _0x5bab73=this[_0x844f('0x4d')][_0x844f('0xa3')](this,_0x1cb6aa[_0x844f('0x152')]);if(_0x5bab73){logger[_0x844f('0x29')](util[_0x844f('0x4e')](_0x844f('0x15a'),this[_0x844f('0x32')]['callerid'],_0x1cb6aa[_0x844f('0x152')]));this[_0x844f('0x32')][_0x844f('0xa8')](util['format'](_0x844f('0x15a'),this['channel']['callerid'],_0x1cb6aa[_0x844f('0x152')]));return{'code':0xc8,'result':_0x844f('0x154')};}else{logger[_0x844f('0x29')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x844f('0x35')],_0x1cb6aa['findBy']));this[_0x844f('0x32')]['noop'](util['format'](_0x844f('0x155'),this[_0x844f('0x32')][_0x844f('0x35')],_0x1cb6aa[_0x844f('0x152')]));return{'code':0xc8,'result':_0x844f('0x156')};}};AGIVertices[_0x844f('0x16')][_0x844f('0x1be')]=function(_0x3f0a30){logger[_0x844f('0x29')](util[_0x844f('0x4e')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3f0a30[_0x844f('0xa7')]));var _0x5c7ed6=this['channel'][_0x844f('0x52')]('VOICEMAIL',[_0x3f0a30['mailbox'],_0x3f0a30['options']]);if(_0x5c7ed6[_0x844f('0x9f')]===-0x1){return _0x5c7ed6;}return this[_0x844f('0x32')][_0x844f('0xa8')](util[_0x844f('0x4e')](_0x844f('0xc2'),_0x844f('0x1bf'),_0x3f0a30[_0x844f('0x1c0')]));};AGIVertices['prototype']['vswitch']=function(_0x5c2791){logger['info'](util[_0x844f('0x4e')](_0x844f('0x1c1'),_0x5c2791[_0x844f('0xa7')]));if(!this[_0x844f('0x7d')](_0x5c2791[_0x844f('0xd7')])){return this['channel'][_0x844f('0x2e')](_0x5c2791,'no\x20variable\x20selected');}var _0x10671f=this[_0x844f('0x9e')][_0x844f('0xa3')](this,_0x5c2791[_0x844f('0xd7')]);if(!_0x10671f){return this[_0x844f('0x32')][_0x844f('0x2e')](_0x5c2791,_0x844f('0xd8'));}var _0x19ad27=this[_0x844f('0x32')][_0x844f('0x9e')](_0x10671f);return{'code':0xc8,'result':_0x19ad27['extra']?_0x19ad27['extra']:'-'};};String[_0x844f('0x16')][_0x844f('0x9b')]=function(_0x381c1b,_0xd437eb){return this[_0x844f('0x9a')](_0x381c1b)[_0x844f('0x1c2')](_0xd437eb);};module[_0x844f('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 9461eb1..0ea0e2f 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 _0x38c2=['savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','format','uniqueid','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','acw','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','agents','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid'];(function(_0x3b709d,_0x22c173){var _0x125dea=function(_0x1d95ee){while(--_0x1d95ee){_0x3b709d['push'](_0x3b709d['shift']());}};_0x125dea(++_0x22c173);}(_0x38c2,0x81));var _0x238c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x38c2[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x238c('0x0'));var _=require('lodash');var moment=require(_0x238c('0x1'));var ami=require(_0x238c('0x2'));var logger=require(_0x238c('0x3'))('acw');var RpcUser=require(_0x238c('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x180ef3){this[_0x238c('0x5')]=_0x180ef3[_0x238c('0x5')];this['agents']=_0x180ef3['agents'];this[_0x238c('0x6')]=_0x180ef3['timers'];this['channels']={};ami['on'](_0x238c('0x7'),this[_0x238c('0x8')][_0x238c('0x9')](this));ami['on']('hanguprequest',this[_0x238c('0xa')][_0x238c('0x9')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x238c('0xb')][_0x238c('0x9')](this));ami['on'](_0x238c('0xc'),this[_0x238c('0xd')][_0x238c('0x9')](this));ami['on'](_0x238c('0xe'),this[_0x238c('0xf')][_0x238c('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0x238c('0x10')][_0x238c('0x9')](this));}function getDiff(_0x4b1c51){var _0x3b18d3=moment()[_0x238c('0x11')](0x0);var _0x17149b=moment(_0x4b1c51)[_0x238c('0x11')](0x0);return _0x3b18d3['diff'](_0x17149b,_0x238c('0x12'));}Acw[_0x238c('0x13')]['startAcw']=function(_0x53ae52){try{var _0x860468=this;var _0x45dbbd=this[_0x238c('0x14')][_0x53ae52][_0x238c('0x15')];var _0x1f6438=this[_0x238c('0x14')][_0x53ae52][_0x238c('0x16')];var _0x4d0dbd=this[_0x238c('0x5')][_0x1f6438];var _0x4ba5b3=![];var _0x56c561=_0x238c('0x17');if(_0x4d0dbd[_0x238c('0x18')]){if(_0x4d0dbd[_0x238c('0x19')]['name']){_0x4ba5b3=!![];_0x56c561=_0x4d0dbd[_0x238c('0x19')][_0x238c('0x1a')];}}ami[_0x238c('0x1b')]({'action':_0x238c('0x1c'),'interface':_0x45dbbd,'paused':!![],'reason':_0x56c561})[_0x238c('0x1d')](function(_0x365045){if(_0x860468['agents'][_0x45dbbd]){return RpcUser[_0x238c('0x1e')](_0x860468[_0x238c('0x1f')][_0x45dbbd]['id'])['then'](function(_0xbc08fd){if(_0xbc08fd&&!_0xbc08fd[_0x238c('0x20')]){logger[_0x238c('0x21')](_0x238c('0x22'),_0x53ae52,_0x45dbbd,_0x1f6438);var _0x1fa504=_0x860468[_0x238c('0x14')][_0x53ae52][_0x238c('0x23')]&&_0x860468[_0x238c('0x14')][_0x53ae52]['destlinkedid']?_0x860468[_0x238c('0x14')][_0x53ae52][_0x238c('0x24')]:_0x53ae52;return RpcUser[_0x238c('0x25')](_0x860468[_0x238c('0x1f')][_0x45dbbd],_0x56c561,_0x1fa504)[_0x238c('0x1d')](function(_0x4df5ca){if(!_0x4ba5b3){_0x860468[_0x238c('0x6')][_0x45dbbd]={};logger['info'](_0x238c('0x26'),_0x53ae52,_0x860468[_0x238c('0x5')][_0x1f6438]['acwTimeout'],_0x45dbbd,_0x1f6438);_0x860468[_0x238c('0x6')][_0x45dbbd]['timer']=setTimeout(_0x860468[_0x238c('0x27')][_0x238c('0x9')](_0x860468,_0x45dbbd),_0x860468[_0x238c('0x5')][_0x1f6438][_0x238c('0x28')]*0x3e8);_0x860468[_0x238c('0x6')][_0x45dbbd]['lastPauseAt']=moment()[_0x238c('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x860468[_0x238c('0x6')][_0x45dbbd][_0x238c('0x2a')]=_0x53ae52;_0x860468[_0x238c('0x6')][_0x45dbbd][_0x238c('0x16')]=_0x1f6438;_0x860468[_0x238c('0x6')][_0x45dbbd]['updateAcw']=function(){var _0x35f8ad=getDiff(_0x860468[_0x238c('0x6')][_0x45dbbd]['lastPauseAt']);clearTimeout(_0x860468['timers'][_0x45dbbd][_0x238c('0x2b')]);_0x860468[_0x238c('0x6')][_0x45dbbd][_0x238c('0x2b')]=![];RpcVoiceAgentReport[_0x238c('0x2c')]({'acwtime':_0x35f8ad},_0x860468[_0x238c('0x6')][_0x45dbbd][_0x238c('0x2a')],_0x45dbbd)[_0x238c('0x1d')](function(_0x576dc0){logger[_0x238c('0x21')](_0x238c('0x2d'),_0x53ae52,_0x35f8ad,_0x576dc0);})[_0x238c('0x2e')](function(_0x39a540){logger[_0x238c('0x2f')](_0x238c('0x30'),_0x53ae52,_0x39a540);});delete _0x860468[_0x238c('0x6')][_0x45dbbd];};}});}else{logger[_0x238c('0x21')](_0x238c('0x31'),_0x53ae52,_0x45dbbd,_0x1f6438);}});}})[_0x238c('0x2e')](function(_0x5ab309){logger[_0x238c('0x2f')](_0x238c('0x26'),_0x53ae52,_0x860468['voiceQueues'][_0x1f6438][_0x238c('0x28')],_0x45dbbd,_0x1f6438);})['finally'](function(){delete _0x860468[_0x238c('0x14')][_0x53ae52];});}catch(_0xca1afe){logger[_0x238c('0x2f')]('[ACW][START]\x20%s',_0xca1afe[_0x238c('0x32')]);}};Acw[_0x238c('0x13')][_0x238c('0x27')]=function(_0x5e1379){try{var _0x20bbca=this;if(_0x20bbca['timers'][_0x5e1379]){_0x20bbca[_0x238c('0x6')][_0x5e1379][_0x238c('0x2b')]=![];var _0x4a57f1=_0x20bbca['timers'][_0x5e1379][_0x238c('0x2a')];var _0x24d49a=_0x20bbca[_0x238c('0x6')][_0x5e1379][_0x238c('0x16')];var _0x3d0636=_0x20bbca[_0x238c('0x5')][_0x24d49a][_0x238c('0x28')];logger[_0x238c('0x21')]('[%s][TIMER][STOP][AGENT:%s]',_0x4a57f1,_0x5e1379);RpcUser[_0x238c('0x33')](this[_0x238c('0x1f')][_0x5e1379]);RpcVoiceAgentReport[_0x238c('0x2c')]({'acwtime':_0x3d0636,'agentacw':!![]},_0x4a57f1,_0x5e1379)[_0x238c('0x1d')](function(_0x1e8737){logger[_0x238c('0x21')](_0x238c('0x2d'),_0x4a57f1,_0x3d0636,_0x1e8737);})['catch'](function(_0x4d8554){logger[_0x238c('0x2f')](_0x238c('0x30'),_0x4a57f1,_0x4d8554);});}else{logger[_0x238c('0x2f')](_0x238c('0x34'),_0x5e1379);if(_0x20bbca['timers']){logger[_0x238c('0x21')](_0x238c('0x35'),JSON['stringify'](_0x20bbca['timers']));}}}catch(_0x164669){logger[_0x238c('0x2f')](_0x238c('0x36'),_0x164669[_0x238c('0x32')]);}};Acw[_0x238c('0x13')][_0x238c('0x8')]=function(_0x34abdf){try{if(this[_0x238c('0x5')][_0x34abdf[_0x238c('0x16')]]&&(this['voiceQueues'][_0x34abdf[_0x238c('0x16')]]['acw']||this[_0x238c('0x5')][_0x34abdf['queue']][_0x238c('0x18')])){if(this[_0x238c('0x1f')][_0x34abdf[_0x238c('0x15')]]){this[_0x238c('0x14')][_0x34abdf[_0x238c('0x2a')]]={'queue':_0x34abdf[_0x238c('0x16')],'interface':_0x34abdf[_0x238c('0x15')],'destlinkedid':_0x34abdf[_0x238c('0x24')]};}}}catch(_0x530031){logger[_0x238c('0x2f')](_0x238c('0x37'),_0x530031[_0x238c('0x32')]);}};Acw[_0x238c('0x13')]['syncAgentConnectPreview']=function(_0x43dfd4){try{if(this[_0x238c('0x5')][_0x43dfd4[_0x238c('0x16')]]&&(this[_0x238c('0x5')][_0x43dfd4[_0x238c('0x16')]][_0x238c('0x38')]||this[_0x238c('0x5')][_0x43dfd4[_0x238c('0x16')]][_0x238c('0x18')])){if(this['agents'][_0x43dfd4[_0x238c('0x15')]]){this[_0x238c('0x14')][_0x43dfd4[_0x238c('0x2a')]]={'queue':_0x43dfd4[_0x238c('0x16')],'interface':_0x43dfd4['interface']};}}}catch(_0x9c0f7a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x9c0f7a[_0x238c('0x32')]);}};Acw[_0x238c('0x13')][_0x238c('0xa')]=function(_0x5b2f48){try{if(this['channels'][_0x5b2f48[_0x238c('0x2a')]]&&_[_0x238c('0x39')](this[_0x238c('0x14')][_0x5b2f48['uniqueid']][_0x238c('0x23')])){logger[_0x238c('0x21')](_0x238c('0x3a'),_0x5b2f48['uniqueid']);this['startAcw'](_0x5b2f48['uniqueid']);}else if(this[_0x238c('0x14')][_0x5b2f48[_0x238c('0x3b')]]&&_['isUndefined'](this[_0x238c('0x14')][_0x5b2f48[_0x238c('0x3b')]]['attended'])){logger['info'](_0x238c('0x3c'),_0x5b2f48[_0x238c('0x3b')]);this['startAcw'](_0x5b2f48[_0x238c('0x3b')]);}}catch(_0x13b17d){logger[_0x238c('0x2f')](_0x238c('0x3d'),_0x13b17d['message']);}};Acw[_0x238c('0x13')]['syncHangup']=function(_0x140473){try{if(this[_0x238c('0x14')][_0x140473[_0x238c('0x2a')]]&&this[_0x238c('0x14')][_0x140473['uniqueid']][_0x238c('0x23')]){logger[_0x238c('0x21')](_0x238c('0x3e'),_0x140473['uniqueid']);this[_0x238c('0x3f')](_0x140473['uniqueid']);}else if(this['channels'][_0x140473['linkedid']]&&this['channels'][_0x140473[_0x238c('0x3b')]][_0x238c('0x23')]){logger['info'](_0x238c('0x40'),_0x140473['linkedid']);this[_0x238c('0x3f')](_0x140473[_0x238c('0x3b')]);}}catch(_0x574ffe){logger[_0x238c('0x2f')](_0x238c('0x41'),_0x574ffe[_0x238c('0x32')]);}};Acw[_0x238c('0x13')][_0x238c('0xd')]=function(_0x18b42a){try{if(!_['isNil'](this[_0x238c('0x14')][_0x18b42a[_0x238c('0x42')]])){this[_0x238c('0x3f')](_0x18b42a[_0x238c('0x42')]);if(this[_0x238c('0x14')][_0x18b42a[_0x238c('0x43')]]){this[_0x238c('0x14')][_0x18b42a['secondtransfereruniqueid']][_0x238c('0x23')]=!![];this['channels'][_0x18b42a['transfertargetuniqueid']]=this[_0x238c('0x14')][_0x18b42a['secondtransfereruniqueid']];delete this[_0x238c('0x14')][_0x18b42a['secondtransfereruniqueid']];}}else if(!_[_0x238c('0x44')](this[_0x238c('0x14')][_0x18b42a[_0x238c('0x45')]])){this[_0x238c('0x3f')](_0x18b42a['transfertargetuniqueid']);if(this['channels'][_0x18b42a[_0x238c('0x46')]]){this[_0x238c('0x14')][_0x18b42a['origtransfereruniqueid']][_0x238c('0x23')]=!![];this[_0x238c('0x14')][_0x18b42a[_0x238c('0x42')]]=this[_0x238c('0x14')][_0x18b42a[_0x238c('0x46')]];delete this[_0x238c('0x14')][_0x18b42a[_0x238c('0x46')]];}}}catch(_0x1e3ba8){logger[_0x238c('0x2f')](_0x238c('0x47'),_0x1e3ba8[_0x238c('0x32')]);}};Acw[_0x238c('0x13')]['syncBlindTransfer']=function(_0x275573){try{if(this[_0x238c('0x14')][_0x275573[_0x238c('0x48')]]){logger[_0x238c('0x21')](_0x238c('0x49'),JSON[_0x238c('0x4a')](_0x275573[_0x238c('0x48')]));this[_0x238c('0x3f')](_0x275573['transfereruniqueid']);}else if(this[_0x238c('0x14')][_0x275573[_0x238c('0x4b')]]){logger[_0x238c('0x21')](_0x238c('0x4c'),JSON[_0x238c('0x4a')](_0x275573[_0x238c('0x4b')]));this[_0x238c('0x3f')](_0x275573[_0x238c('0x4b')]);}}catch(_0x5398d8){logger[_0x238c('0x2f')](_0x238c('0x4d'),_0x5398d8[_0x238c('0x32')]);}};Acw[_0x238c('0x13')][_0x238c('0xb')]=function(_0xb6375f){try{if(this[_0x238c('0x5')][_0xb6375f[_0x238c('0x16')]]&&this[_0x238c('0x5')][_0xb6375f[_0x238c('0x16')]][_0x238c('0x4e')]===_0x238c('0x4f')){if(this['agents'][_0xb6375f[_0x238c('0x15')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xb6375f['uniqueid'],_0xb6375f['interface'],_0xb6375f[_0x238c('0x16')]);return RpcUser['savePause'](this[_0x238c('0x1f')][_0xb6375f[_0x238c('0x15')]],_0x238c('0x50'),_0xb6375f[_0x238c('0x2a')]);}}}catch(_0x489f11){logger[_0x238c('0x2f')](_0x238c('0x51'),_0x489f11[_0x238c('0x32')]);}};module[_0x238c('0x52')]=Acw; \ No newline at end of file +var _0x8770=['message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','finally'];(function(_0x4667f9,_0x5b937d){var _0xd1bbaf=function(_0x4df748){while(--_0x4df748){_0x4667f9['push'](_0x4667f9['shift']());}};_0xd1bbaf(++_0x5b937d);}(_0x8770,0x1c0));var _0x0877=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8770[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0877('0x0'));var _=require('lodash');var moment=require('moment');var ami=require(_0x0877('0x1'));var logger=require(_0x0877('0x2'))('acw');var RpcUser=require(_0x0877('0x3'));var RpcVoiceAgentReport=require(_0x0877('0x4'));function Acw(_0x362ba6){this[_0x0877('0x5')]=_0x362ba6[_0x0877('0x5')];this[_0x0877('0x6')]=_0x362ba6[_0x0877('0x6')];this[_0x0877('0x7')]=_0x362ba6['timers'];this[_0x0877('0x8')]={};ami['on'](_0x0877('0x9'),this['syncAgentConnect'][_0x0877('0xa')](this));ami['on'](_0x0877('0xb'),this[_0x0877('0xc')][_0x0877('0xa')](this));ami['on']('hangup',this[_0x0877('0xd')][_0x0877('0xa')](this));ami['on'](_0x0877('0xe'),this[_0x0877('0xf')]['bind'](this));ami['on'](_0x0877('0x10'),this['syncAttendedTransfer'][_0x0877('0xa')](this));ami['on']('blindtransfer',this[_0x0877('0x11')]['bind'](this));ami['on'](_0x0877('0x12'),this['syncAgentConnectPreview'][_0x0877('0xa')](this));}function getDiff(_0x23ee34){var _0x3a640d=moment()[_0x0877('0x13')](0x0);var _0x28ad72=moment(_0x23ee34)[_0x0877('0x13')](0x0);return _0x3a640d[_0x0877('0x14')](_0x28ad72,_0x0877('0x15'));}Acw[_0x0877('0x16')][_0x0877('0x17')]=function(_0x4a84ff){try{var _0x56be4f=this;var _0x51353b=this[_0x0877('0x8')][_0x4a84ff][_0x0877('0x18')];var _0x57905d=this[_0x0877('0x8')][_0x4a84ff]['queue'];var _0x5ec3c1=this[_0x0877('0x5')][_0x57905d];var _0xde3acd=![];var _0x43348a=_0x0877('0x19');if(_0x5ec3c1[_0x0877('0x1a')]){if(_0x5ec3c1[_0x0877('0x1b')][_0x0877('0x1c')]){_0xde3acd=!![];_0x43348a=_0x5ec3c1[_0x0877('0x1b')][_0x0877('0x1c')];}}ami[_0x0877('0x1d')]({'action':'QueuePause','interface':_0x51353b,'paused':!![],'reason':_0x43348a})[_0x0877('0x1e')](function(_0x1f2909){if(_0x56be4f[_0x0877('0x6')][_0x51353b]){return RpcUser[_0x0877('0x1f')](_0x56be4f[_0x0877('0x6')][_0x51353b]['id'])[_0x0877('0x1e')](function(_0x221911){if(_0x221911&&!_0x221911['voicePause']){logger['info'](_0x0877('0x20'),_0x4a84ff,_0x51353b,_0x57905d);var _0x5e4232=_0x56be4f[_0x0877('0x8')][_0x4a84ff]['attended']&&_0x56be4f['channels'][_0x4a84ff]['destlinkedid']?_0x56be4f[_0x0877('0x8')][_0x4a84ff][_0x0877('0x21')]:_0x4a84ff;return RpcUser[_0x0877('0x22')](_0x56be4f[_0x0877('0x6')][_0x51353b],_0x43348a,_0x5e4232)[_0x0877('0x1e')](function(_0x3bd471){if(!_0xde3acd){_0x56be4f[_0x0877('0x7')][_0x51353b]={};logger[_0x0877('0x23')](_0x0877('0x24'),_0x4a84ff,_0x56be4f[_0x0877('0x5')][_0x57905d][_0x0877('0x25')],_0x51353b,_0x57905d);_0x56be4f[_0x0877('0x7')][_0x51353b][_0x0877('0x26')]=setTimeout(_0x56be4f['stopAcw'][_0x0877('0xa')](_0x56be4f,_0x51353b),_0x56be4f[_0x0877('0x5')][_0x57905d][_0x0877('0x25')]*0x3e8);_0x56be4f[_0x0877('0x7')][_0x51353b][_0x0877('0x27')]=moment()[_0x0877('0x28')](_0x0877('0x29'));_0x56be4f[_0x0877('0x7')][_0x51353b][_0x0877('0x2a')]=_0x4a84ff;_0x56be4f[_0x0877('0x7')][_0x51353b][_0x0877('0x2b')]=_0x57905d;_0x56be4f['timers'][_0x51353b][_0x0877('0x2c')]=function(){var _0x2e19b9=getDiff(_0x56be4f['timers'][_0x51353b][_0x0877('0x27')]);clearTimeout(_0x56be4f[_0x0877('0x7')][_0x51353b][_0x0877('0x26')]);_0x56be4f[_0x0877('0x7')][_0x51353b]['timer']=![];RpcVoiceAgentReport[_0x0877('0x2d')]({'acwtime':_0x2e19b9},_0x56be4f['timers'][_0x51353b]['uniqueid'],_0x51353b)[_0x0877('0x1e')](function(_0xf688dd){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4a84ff,_0x2e19b9,_0xf688dd);})[_0x0877('0x2e')](function(_0x322b9c){logger[_0x0877('0x2f')](_0x0877('0x30'),_0x4a84ff,_0x322b9c);});delete _0x56be4f['timers'][_0x51353b];};}});}else{logger[_0x0877('0x23')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4a84ff,_0x51353b,_0x57905d);}});}})[_0x0877('0x2e')](function(_0x579e73){logger[_0x0877('0x2f')](_0x0877('0x24'),_0x4a84ff,_0x56be4f[_0x0877('0x5')][_0x57905d]['acwTimeout'],_0x51353b,_0x57905d);})[_0x0877('0x31')](function(){delete _0x56be4f['channels'][_0x4a84ff];});}catch(_0x466e29){logger[_0x0877('0x2f')]('[ACW][START]\x20%s',_0x466e29[_0x0877('0x32')]);}};Acw[_0x0877('0x16')][_0x0877('0x33')]=function(_0x12bba1){try{var _0x2d9408=this;if(_0x2d9408[_0x0877('0x7')][_0x12bba1]){_0x2d9408[_0x0877('0x7')][_0x12bba1][_0x0877('0x26')]=![];var _0x5cee78=_0x2d9408[_0x0877('0x7')][_0x12bba1][_0x0877('0x2a')];var _0x3480c9=_0x2d9408['timers'][_0x12bba1]['queue'];var _0x2db2de=_0x2d9408[_0x0877('0x5')][_0x3480c9][_0x0877('0x25')];logger['info'](_0x0877('0x34'),_0x5cee78,_0x12bba1);RpcUser[_0x0877('0x35')](this['agents'][_0x12bba1]);RpcVoiceAgentReport['update']({'acwtime':_0x2db2de,'agentacw':!![]},_0x5cee78,_0x12bba1)[_0x0877('0x1e')](function(_0x6bf6b0){logger[_0x0877('0x23')](_0x0877('0x36'),_0x5cee78,_0x2db2de,_0x6bf6b0);})[_0x0877('0x2e')](function(_0x253b1f){logger[_0x0877('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x5cee78,_0x253b1f);});}else{logger[_0x0877('0x2f')](_0x0877('0x37'),_0x12bba1);if(_0x2d9408['timers']){logger['info'](_0x0877('0x38'),JSON['stringify'](_0x2d9408[_0x0877('0x7')]));}}}catch(_0x3328b1){logger[_0x0877('0x2f')](_0x0877('0x39'),_0x3328b1[_0x0877('0x32')]);}};Acw[_0x0877('0x16')][_0x0877('0x3a')]=function(_0x437f5f){try{if(this[_0x0877('0x5')][_0x437f5f[_0x0877('0x2b')]]&&(this['voiceQueues'][_0x437f5f['queue']][_0x0877('0x3b')]||this[_0x0877('0x5')][_0x437f5f['queue']][_0x0877('0x1a')])){if(this['agents'][_0x437f5f[_0x0877('0x18')]]){this['channels'][_0x437f5f['uniqueid']]={'queue':_0x437f5f['queue'],'interface':_0x437f5f['interface'],'destlinkedid':_0x437f5f[_0x0877('0x21')]};}}}catch(_0x19d39a){logger['error'](_0x0877('0x3c'),_0x19d39a[_0x0877('0x32')]);}};Acw[_0x0877('0x16')][_0x0877('0x3d')]=function(_0xcb843e){try{if(this[_0x0877('0x5')][_0xcb843e[_0x0877('0x2b')]]&&(this['voiceQueues'][_0xcb843e[_0x0877('0x2b')]][_0x0877('0x3b')]||this[_0x0877('0x5')][_0xcb843e['queue']]['mandatoryDisposition'])){if(this[_0x0877('0x6')][_0xcb843e[_0x0877('0x18')]]){this[_0x0877('0x8')][_0xcb843e[_0x0877('0x2a')]]={'queue':_0xcb843e[_0x0877('0x2b')],'interface':_0xcb843e[_0x0877('0x18')]};}}}catch(_0x3dfaf3){logger[_0x0877('0x2f')](_0x0877('0x3e'),_0x3dfaf3[_0x0877('0x32')]);}};Acw[_0x0877('0x16')][_0x0877('0xc')]=function(_0x280155){try{if(this[_0x0877('0x8')][_0x280155[_0x0877('0x2a')]]&&_[_0x0877('0x3f')](this[_0x0877('0x8')][_0x280155[_0x0877('0x2a')]][_0x0877('0x40')])){logger['info'](_0x0877('0x41'),_0x280155[_0x0877('0x2a')]);this[_0x0877('0x17')](_0x280155[_0x0877('0x2a')]);}else if(this[_0x0877('0x8')][_0x280155[_0x0877('0x42')]]&&_[_0x0877('0x3f')](this[_0x0877('0x8')][_0x280155['linkedid']][_0x0877('0x40')])){logger[_0x0877('0x23')](_0x0877('0x43'),_0x280155[_0x0877('0x42')]);this[_0x0877('0x17')](_0x280155[_0x0877('0x42')]);}}catch(_0x93d10f){logger[_0x0877('0x2f')]('[ACW][syncHangupRequest]\x20%s',_0x93d10f['message']);}};Acw[_0x0877('0x16')][_0x0877('0xd')]=function(_0xfc141c){try{if(this['channels'][_0xfc141c[_0x0877('0x2a')]]&&this[_0x0877('0x8')][_0xfc141c[_0x0877('0x2a')]][_0x0877('0x40')]){logger[_0x0877('0x23')](_0x0877('0x44'),_0xfc141c[_0x0877('0x2a')]);this[_0x0877('0x17')](_0xfc141c[_0x0877('0x2a')]);}else if(this[_0x0877('0x8')][_0xfc141c[_0x0877('0x42')]]&&this[_0x0877('0x8')][_0xfc141c['linkedid']][_0x0877('0x40')]){logger[_0x0877('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xfc141c['linkedid']);this[_0x0877('0x17')](_0xfc141c[_0x0877('0x42')]);}}catch(_0x43cc3b){logger[_0x0877('0x2f')](_0x0877('0x45'),_0x43cc3b['message']);}};Acw[_0x0877('0x16')]['syncAttendedTransfer']=function(_0x2c9222){try{if(!_['isNil'](this[_0x0877('0x8')][_0x2c9222[_0x0877('0x46')]])){this[_0x0877('0x17')](_0x2c9222[_0x0877('0x46')]);if(this[_0x0877('0x8')][_0x2c9222[_0x0877('0x47')]]){this[_0x0877('0x8')][_0x2c9222[_0x0877('0x47')]][_0x0877('0x40')]=!![];this[_0x0877('0x8')][_0x2c9222['transfertargetuniqueid']]=this['channels'][_0x2c9222[_0x0877('0x47')]];delete this[_0x0877('0x8')][_0x2c9222[_0x0877('0x47')]];}}else if(!_[_0x0877('0x48')](this['channels'][_0x2c9222['transfertargetuniqueid']])){this[_0x0877('0x17')](_0x2c9222[_0x0877('0x49')]);if(this['channels'][_0x2c9222['origtransfereruniqueid']]){this[_0x0877('0x8')][_0x2c9222[_0x0877('0x4a')]][_0x0877('0x40')]=!![];this[_0x0877('0x8')][_0x2c9222['transfereeuniqueid']]=this['channels'][_0x2c9222[_0x0877('0x4a')]];delete this[_0x0877('0x8')][_0x2c9222['origtransfereruniqueid']];}}}catch(_0x5c2a0e){logger['error'](_0x0877('0x4b'),_0x5c2a0e['message']);}};Acw[_0x0877('0x16')][_0x0877('0x11')]=function(_0x2ef73a){try{if(this[_0x0877('0x8')][_0x2ef73a['transfereruniqueid']]){logger[_0x0877('0x23')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x2ef73a[_0x0877('0x4c')]));this['startAcw'](_0x2ef73a[_0x0877('0x4c')]);}else if(this[_0x0877('0x8')][_0x2ef73a[_0x0877('0x4d')]]){logger[_0x0877('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x2ef73a[_0x0877('0x4d')]));this[_0x0877('0x17')](_0x2ef73a[_0x0877('0x4d')]);}}catch(_0x572933){logger[_0x0877('0x2f')](_0x0877('0x4e'),_0x572933[_0x0877('0x32')]);}};Acw['prototype'][_0x0877('0xf')]=function(_0x3fdb3e){try{if(this[_0x0877('0x5')][_0x3fdb3e[_0x0877('0x2b')]]&&this[_0x0877('0x5')][_0x3fdb3e[_0x0877('0x2b')]][_0x0877('0x4f')]===_0x0877('0x50')){if(this[_0x0877('0x6')][_0x3fdb3e[_0x0877('0x18')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3fdb3e[_0x0877('0x2a')],_0x3fdb3e[_0x0877('0x18')],_0x3fdb3e[_0x0877('0x2b')]);return RpcUser[_0x0877('0x22')](this[_0x0877('0x6')][_0x3fdb3e[_0x0877('0x18')]],_0x0877('0x51'),_0x3fdb3e[_0x0877('0x2a')]);}}}catch(_0x1562db){logger['error'](_0x0877('0x52'),_0x1562db['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c2b6ba3..75d894a 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','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','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x3835cd,_0x1c5100){var _0x1cef0e=function(_0x4822de){while(--_0x4822de){_0x3835cd['push'](_0x3835cd['shift']());}};_0x1cef0e(++_0x1c5100);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','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','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','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'];(function(_0x190ec5,_0x32b48d){var _0x433339=function(_0x37cb03){while(--_0x37cb03){_0x190ec5['push'](_0x190ec5['shift']());}};_0x433339(++_0x32b48d);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 72d3649..ccda922 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 _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x51541e,_0x451ab2){var _0xf33eb=function(_0x10ee2e){while(--_0x10ee2e){_0x51541e['push'](_0x51541e['shift']());}};_0xf33eb(++_0x451ab2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x1e765a,_0x4a7c55){var _0x5bc8a1=function(_0x8dbd4d){while(--_0x8dbd4d){_0x1e765a['push'](_0x1e765a['shift']());}};_0x5bc8a1(++_0x4a7c55);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xbdb7[_0x486f4a];return _0x135d99;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9a75391..1589744 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ced=['getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','firstName','Contact','lastName','number','queue','active','type','dialQueueTimeout','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','prototype'];(function(_0x4263d0,_0x342a41){var _0x1db4b7=function(_0x18f3e3){while(--_0x18f3e3){_0x4263d0['push'](_0x4263d0['shift']());}};_0x1db4b7(++_0x342a41);}(_0x2ced,0x84));var _0xd2ce=function(_0x581adf,_0x53b203){_0x581adf=_0x581adf-0x0;var _0x5a1216=_0x2ced[_0x581adf];return _0x5a1216;};'use strict';var util=require(_0xd2ce('0x0'));var _=require(_0xd2ce('0x1'));var moment=require(_0xd2ce('0x2'));function checkNameSurname(_0x55705c,_0x904c15,_0x38c827){var _0x28e9a0='';if(!_[_0xd2ce('0x3')](_0x904c15)&&_0xd2ce('0x4')===typeof _0x904c15){_0x28e9a0+=_0x904c15;}if(!_[_0xd2ce('0x3')](_0x38c827)&&_0xd2ce('0x4')===typeof _0x38c827){_0x28e9a0+='\x20'+_0x38c827;}if(_0x28e9a0!==''){return _0x28e9a0;}return _0x55705c;}function Action(_0x1975eb,_0x55047f,_0x438626){this[_0xd2ce('0x5')]=_0x1975eb;this[_0xd2ce('0x6')]=_0x438626||undefined;this[_0xd2ce('0x7')]=checkNameSurname(_0x55047f['Contact'][_0xd2ce('0x8')],_0x55047f['Contact'][_0xd2ce('0x9')],_0x55047f[_0xd2ce('0xa')][_0xd2ce('0xb')]);this[_0xd2ce('0xc')]=_0x55047f[_0xd2ce('0x8')];this[_0xd2ce('0xd')]=_0x1975eb[_0xd2ce('0x7')];this[_0xd2ce('0xe')]=_0x55047f[_0xd2ce('0xe')]||![];this[_0xd2ce('0xf')]=_0x1975eb[_0xd2ce('0xf')];this[_0xd2ce('0x10')]=_0x1975eb[_0xd2ce('0x10')]||0x3;this['scheduledat']=_0x55047f['scheduledat'];this[_0xd2ce('0x11')]=_0x55047f[_0xd2ce('0x11')];this['countcongestionretry']=_0x55047f['countcongestionretry'];this[_0xd2ce('0x12')]=_0x55047f[_0xd2ce('0x12')];this['countnosuchnumberretry']=_0x55047f['countnosuchnumberretry'];this[_0xd2ce('0x13')]=_0x55047f[_0xd2ce('0x13')];this['countabandonedretry']=_0x55047f[_0xd2ce('0x14')];this[_0xd2ce('0x15')]=_0x55047f['countmachineretry'];this[_0xd2ce('0x16')]=_0x55047f[_0xd2ce('0x16')];this['ContactId']=_0x55047f[_0xd2ce('0x17')];this['ListId']=_0x55047f['ListId'];this[_0xd2ce('0x18')]=_0x55047f['UserId'];this[_0xd2ce('0x19')]=_0x55047f[_0xd2ce('0x19')];this[_0xd2ce('0x1a')]=_0x55047f['CampaignId'];this[_0xd2ce('0x1b')]=_0x55047f['id'];this[_0xd2ce('0x1c')]=_0x55047f[_0xd2ce('0xa')][_0xd2ce('0x9')]||'';this[_0xd2ce('0x1d')]=moment()[_0xd2ce('0x1e')](_0xd2ce('0x1f'));this['callback']=_0x55047f['callback'];this[_0xd2ce('0x20')]=_0x55047f[_0xd2ce('0x20')];this[_0xd2ce('0x21')]=_0x55047f[_0xd2ce('0x21')];this[_0xd2ce('0x22')]=_0x55047f[_0xd2ce('0x22')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xd2ce('0x23')][_0xd2ce('0x24')]=function(){return util['format'](_0xd2ce('0x25'),this[_0xd2ce('0x7')],this[_0xd2ce('0x5')][_0xd2ce('0x26')]>0x0?this['number'][_0xd2ce('0x27')](this['voiceQueue']['dialCutDigit']):this[_0xd2ce('0xc')]);};Action[_0xd2ce('0x23')][_0xd2ce('0x28')]=function(){return this[_0xd2ce('0xd')];};module[_0xd2ce('0x29')]=Action; \ No newline at end of file +var _0x1eb9=['string','uniqueid','name','Contact','firstName','lastName','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','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','util','lodash','moment','isNil'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x1eb9,0xd3));var _0x91eb=function(_0x2378d7,_0xd46258){_0x2378d7=_0x2378d7-0x0;var _0x58dc15=_0x1eb9[_0x2378d7];return _0x58dc15;};'use strict';var util=require(_0x91eb('0x0'));var _=require(_0x91eb('0x1'));var moment=require(_0x91eb('0x2'));function checkNameSurname(_0x1a2ccd,_0x3bec43,_0x11f5b1){var _0x1d533a='';if(!_[_0x91eb('0x3')](_0x3bec43)&&_0x91eb('0x4')===typeof _0x3bec43){_0x1d533a+=_0x3bec43;}if(!_[_0x91eb('0x3')](_0x11f5b1)&&_0x91eb('0x4')===typeof _0x11f5b1){_0x1d533a+='\x20'+_0x11f5b1;}if(_0x1d533a!==''){return _0x1d533a;}return _0x1a2ccd;}function Action(_0x4ff1b1,_0xe9672b,_0x34662b){this['voiceQueue']=_0x4ff1b1;this[_0x91eb('0x5')]=_0x34662b||undefined;this[_0x91eb('0x6')]=checkNameSurname(_0xe9672b['Contact']['phone'],_0xe9672b[_0x91eb('0x7')][_0x91eb('0x8')],_0xe9672b[_0x91eb('0x7')][_0x91eb('0x9')]);this['number']=_0xe9672b['phone'];this[_0x91eb('0xa')]=_0x4ff1b1[_0x91eb('0x6')];this[_0x91eb('0xb')]=_0xe9672b[_0x91eb('0xb')]||![];this[_0x91eb('0xc')]=_0x4ff1b1[_0x91eb('0xc')];this[_0x91eb('0xd')]=_0x4ff1b1['dialQueueTimeout']||0x3;this[_0x91eb('0xe')]=_0xe9672b[_0x91eb('0xe')];this[_0x91eb('0xf')]=_0xe9672b[_0x91eb('0xf')];this[_0x91eb('0x10')]=_0xe9672b[_0x91eb('0x10')];this[_0x91eb('0x11')]=_0xe9672b['countnoanswerretry'];this['countnosuchnumberretry']=_0xe9672b[_0x91eb('0x12')];this[_0x91eb('0x13')]=_0xe9672b[_0x91eb('0x13')];this[_0x91eb('0x14')]=_0xe9672b['countabandonedretry'];this['countmachineretry']=_0xe9672b[_0x91eb('0x15')];this['countagentrejectretry']=_0xe9672b[_0x91eb('0x16')];this[_0x91eb('0x17')]=_0xe9672b[_0x91eb('0x17')];this[_0x91eb('0x18')]=_0xe9672b[_0x91eb('0x18')];this['UserId']=_0xe9672b['UserId'];this[_0x91eb('0x19')]=_0xe9672b['VoiceQueueId'];this[_0x91eb('0x1a')]=_0xe9672b[_0x91eb('0x1a')];this[_0x91eb('0x1b')]=_0xe9672b['id'];this['ContactFirstName']=_0xe9672b['Contact'][_0x91eb('0x8')]||'';this[_0x91eb('0x1c')]=moment()[_0x91eb('0x1d')](_0x91eb('0x1e'));this[_0x91eb('0x1f')]=_0xe9672b[_0x91eb('0x1f')];this['callbackuniqueid']=_0xe9672b[_0x91eb('0x20')];this[_0x91eb('0x21')]=_0xe9672b[_0x91eb('0x21')];this['recallme']=_0xe9672b['recallme'];this[_0x91eb('0x22')]='';this[_0x91eb('0x23')]='';}Action['prototype'][_0x91eb('0x24')]=function(){return util[_0x91eb('0x1d')](_0x91eb('0x25'),this[_0x91eb('0x6')],this[_0x91eb('0x26')][_0x91eb('0x27')]>0x0?this[_0x91eb('0x28')][_0x91eb('0x29')](this[_0x91eb('0x26')][_0x91eb('0x27')]):this[_0x91eb('0x28')]);};Action['prototype'][_0x91eb('0x2a')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 47e3bde..85de301 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe42=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','queue','membername','reason','callback'];(function(_0x21209b,_0x419e62){var _0x3cb3bb=function(_0x1a2611){while(--_0x1a2611){_0x21209b['push'](_0x21209b['shift']());}};_0x3cb3bb(++_0x419e62);}(_0xfe42,0xf0));var _0x2fe4=function(_0x47e806,_0x59b753){_0x47e806=_0x47e806-0x0;var _0x1e2d2e=_0xfe42[_0x47e806];return _0x1e2d2e;};'use strict';var util=require('util');var _=require(_0x2fe4('0x0'));var moment=require(_0x2fe4('0x1'));function getSeconds(_0x2d21b8,_0x412ee7){var _0x74a385=moment(_0x2d21b8)[_0x2fe4('0x2')](0x0);var _0x2fd499=moment(_0x412ee7)[_0x2fe4('0x2')](0x0);return _0x74a385[_0x2fe4('0x3')](_0x2fd499,'seconds');}function AgentComplete(_0x2e6c9a,_0x3fc652){this[_0x2fe4('0x4')]=0x4;this[_0x2fe4('0x5')]=_0x2fe4('0x6');this['scheduledat']=_0x2e6c9a[_0x2fe4('0x7')];this[_0x2fe4('0x8')]=_0x2e6c9a[_0x2fe4('0x8')];this[_0x2fe4('0x9')]=_0x2e6c9a[_0x2fe4('0x8')]===_0x2fe4('0xa')?'queue':_0x2e6c9a['type'];this[_0x2fe4('0xb')]=_0x2e6c9a[_0x2fe4('0xb')];this[_0x2fe4('0xc')]=_0x2e6c9a['countcongestionretry'];this[_0x2fe4('0xd')]=_0x2e6c9a[_0x2fe4('0xd')];this[_0x2fe4('0xe')]=_0x2e6c9a['countbusyretry']+_0x2e6c9a[_0x2fe4('0xc')]+_0x2e6c9a['countnoanswerretry']+_0x2e6c9a['countnosuchnumberretry']+_0x2e6c9a[_0x2fe4('0xf')]+_0x2e6c9a[_0x2fe4('0x10')]+_0x2e6c9a[_0x2fe4('0x11')]+_0x2e6c9a[_0x2fe4('0x12')];this['countnosuchnumberretry']=_0x2e6c9a[_0x2fe4('0x13')];this['countdropretry']=_0x2e6c9a['countdropretry'];this[_0x2fe4('0x10')]=_0x2e6c9a[_0x2fe4('0x10')];this[_0x2fe4('0x11')]=_0x2e6c9a[_0x2fe4('0x11')];this[_0x2fe4('0x12')]=_0x2e6c9a[_0x2fe4('0x12')];this[_0x2fe4('0x14')]=_0x3fc652[_0x2fe4('0x14')];this[_0x2fe4('0x15')]=_0x2e6c9a[_0x2fe4('0x16')];this['calleridnum']=_0x2e6c9a[_0x2fe4('0x17')];this['starttime']=_0x2e6c9a[_0x2fe4('0x18')];this[_0x2fe4('0x19')]=_0x2e6c9a[_0x2fe4('0x19')];this[_0x2fe4('0x1a')]=_0x2e6c9a[_0x2fe4('0x1a')];this[_0x2fe4('0x1b')]=moment()[_0x2fe4('0x1c')](_0x2fe4('0x1d'));this['ringtime']=getSeconds(_0x2e6c9a['responsetime'],_0x2e6c9a[_0x2fe4('0x18')]);this[_0x2fe4('0x1e')]=getSeconds(_0x2e6c9a[_0x2fe4('0x1a')],_0x2e6c9a[_0x2fe4('0x19')]);this[_0x2fe4('0x1f')]=getSeconds(this['endtime'],_0x2e6c9a[_0x2fe4('0x1a')]);this['queue']=_0x3fc652[_0x2fe4('0x20')];this[_0x2fe4('0x21')]=_0x3fc652['membername'];this[_0x2fe4('0x22')]=_0x3fc652['reason'];this['callback']=_0x2e6c9a[_0x2fe4('0x23')];this['callbackuniqueid']=_0x2e6c9a['callbackuniqueid'];this[_0x2fe4('0x24')]=_0x2e6c9a['callbackat'];this[_0x2fe4('0x25')]=_0x2e6c9a[_0x2fe4('0x25')];this[_0x2fe4('0x26')]=_0x2e6c9a[_0x2fe4('0x26')];this[_0x2fe4('0x27')]=_0x2e6c9a['ListId'];this[_0x2fe4('0x28')]=_0x2e6c9a[_0x2fe4('0x28')];this[_0x2fe4('0x29')]=_0x2e6c9a[_0x2fe4('0x29')];this[_0x2fe4('0x2a')]=_0x2e6c9a['CampaignId'];this[_0x2fe4('0x2b')]=_0x2e6c9a[_0x2fe4('0x2b')]||'';this[_0x2fe4('0x2c')]=_0x2e6c9a[_0x2fe4('0x2c')]||'';}module[_0x2fe4('0x2d')]=AgentComplete; \ No newline at end of file +var _0x4451=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4451,0xf4));var _0x1445=function(_0x4fbee2,_0x590bd4){_0x4fbee2=_0x4fbee2-0x0;var _0x13fbd9=_0x4451[_0x4fbee2];return _0x13fbd9;};'use strict';var util=require(_0x1445('0x0'));var _=require(_0x1445('0x1'));var moment=require(_0x1445('0x2'));function getSeconds(_0x81e348,_0x577e7f){var _0x7ba44d=moment(_0x81e348)[_0x1445('0x3')](0x0);var _0x33d025=moment(_0x577e7f)[_0x1445('0x3')](0x0);return _0x7ba44d[_0x1445('0x4')](_0x33d025,_0x1445('0x5'));}function AgentComplete(_0x32e3b4,_0x12be5d){this[_0x1445('0x6')]=0x4;this[_0x1445('0x7')]='Answer';this[_0x1445('0x8')]=_0x32e3b4[_0x1445('0x8')];this[_0x1445('0x9')]=_0x32e3b4[_0x1445('0x9')];this[_0x1445('0xa')]=_0x32e3b4[_0x1445('0x9')]==='outbound'?'queue':_0x32e3b4[_0x1445('0x9')];this[_0x1445('0xb')]=_0x32e3b4[_0x1445('0xb')];this['countcongestionretry']=_0x32e3b4['countcongestionretry'];this[_0x1445('0xc')]=_0x32e3b4[_0x1445('0xc')];this[_0x1445('0xd')]=_0x32e3b4[_0x1445('0xb')]+_0x32e3b4[_0x1445('0xe')]+_0x32e3b4[_0x1445('0xc')]+_0x32e3b4['countnosuchnumberretry']+_0x32e3b4[_0x1445('0xf')]+_0x32e3b4['countabandonedretry']+_0x32e3b4['countmachineretry']+_0x32e3b4[_0x1445('0x10')];this[_0x1445('0x11')]=_0x32e3b4['countnosuchnumberretry'];this[_0x1445('0xf')]=_0x32e3b4[_0x1445('0xf')];this[_0x1445('0x12')]=_0x32e3b4[_0x1445('0x12')];this['countmachineretry']=_0x32e3b4[_0x1445('0x13')];this[_0x1445('0x10')]=_0x32e3b4[_0x1445('0x10')];this[_0x1445('0x14')]=_0x12be5d[_0x1445('0x14')];this[_0x1445('0x15')]=_0x32e3b4['name'];this[_0x1445('0x16')]=_0x32e3b4[_0x1445('0x17')];this[_0x1445('0x18')]=_0x32e3b4[_0x1445('0x18')];this[_0x1445('0x19')]=_0x32e3b4[_0x1445('0x19')];this[_0x1445('0x1a')]=_0x32e3b4['answertime'];this[_0x1445('0x1b')]=moment()[_0x1445('0x1c')](_0x1445('0x1d'));this[_0x1445('0x1e')]=getSeconds(_0x32e3b4['responsetime'],_0x32e3b4[_0x1445('0x18')]);this['holdtime']=getSeconds(_0x32e3b4[_0x1445('0x1a')],_0x32e3b4[_0x1445('0x19')]);this[_0x1445('0x1f')]=getSeconds(this[_0x1445('0x1b')],_0x32e3b4[_0x1445('0x1a')]);this[_0x1445('0x20')]=_0x12be5d[_0x1445('0x20')];this['membername']=_0x12be5d[_0x1445('0x21')];this[_0x1445('0x22')]=_0x12be5d[_0x1445('0x22')];this[_0x1445('0x23')]=_0x32e3b4['callback'];this[_0x1445('0x24')]=_0x32e3b4[_0x1445('0x24')];this[_0x1445('0x25')]=_0x32e3b4['callbackat'];this[_0x1445('0x26')]=_0x32e3b4[_0x1445('0x26')];this[_0x1445('0x27')]=_0x32e3b4['ContactId'];this[_0x1445('0x28')]=_0x32e3b4[_0x1445('0x28')];this[_0x1445('0x29')]=_0x32e3b4[_0x1445('0x29')];this[_0x1445('0x2a')]=_0x32e3b4[_0x1445('0x2a')];this[_0x1445('0x2b')]=_0x32e3b4[_0x1445('0x2b')];this[_0x1445('0x2c')]=_0x32e3b4[_0x1445('0x2c')]||'';this[_0x1445('0x2d')]=_0x32e3b4[_0x1445('0x2d')]||'';}module[_0x1445('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index caa506d..0af5739 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6075=['starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum'];(function(_0x3083d4,_0x7b7a75){var _0x3fea39=function(_0x3f8f0c){while(--_0x3f8f0c){_0x3083d4['push'](_0x3083d4['shift']());}};_0x3fea39(++_0x7b7a75);}(_0x6075,0x191));var _0x5607=function(_0x3ffa60,_0x345abc){_0x3ffa60=_0x3ffa60-0x0;var _0x537779=_0x6075[_0x3ffa60];return _0x537779;};'use strict';var util=require('util');var _=require(_0x5607('0x0'));var moment=require(_0x5607('0x1'));function getSeconds(_0x2c33af,_0x24427f){var _0x2bcf4e=moment(_0x2c33af)[_0x5607('0x2')](0x0);var _0xf96316=moment(_0x24427f)[_0x5607('0x2')](0x0);return _0x2bcf4e[_0x5607('0x3')](_0xf96316,'seconds');}function Final(_0x1f4637){this[_0x5607('0x4')]=_0x1f4637[_0x5607('0x4')];this['scheduledat']=_0x1f4637['scheduledat'];this[_0x5607('0x5')]=_0x1f4637[_0x5607('0x5')];this[_0x5607('0x6')]=_0x1f4637[_0x5607('0x5')]===_0x5607('0x7')?'queue':_0x1f4637[_0x5607('0x5')];this[_0x5607('0x8')]=_0x1f4637[_0x5607('0x8')];this['countcongestionretry']=_0x1f4637[_0x5607('0x9')];this['countnoanswerretry']=_0x1f4637['countnoanswerretry'];this[_0x5607('0xa')]=_0x1f4637[_0x5607('0x8')]+_0x1f4637[_0x5607('0x9')]+_0x1f4637['countnoanswerretry']+_0x1f4637[_0x5607('0xb')]+_0x1f4637[_0x5607('0xc')]+_0x1f4637[_0x5607('0xd')]+_0x1f4637[_0x5607('0xe')]+_0x1f4637[_0x5607('0xf')];this[_0x5607('0xb')]=_0x1f4637[_0x5607('0xb')];this[_0x5607('0xc')]=_0x1f4637[_0x5607('0xc')];this['countabandonedretry']=_0x1f4637[_0x5607('0xd')];this[_0x5607('0xe')]=_0x1f4637[_0x5607('0xe')];this['countagentrejectretry']=_0x1f4637['countagentrejectretry'];this[_0x5607('0x10')]=_0x1f4637['queue'];this[_0x5607('0x11')]=_0x1f4637[_0x5607('0x11')];this[_0x5607('0x12')]=_0x1f4637[_0x5607('0x12')];this[_0x5607('0x13')]=_0x1f4637[_0x5607('0x13')];this['responsetime']=_0x1f4637[_0x5607('0x14')];this['endtime']=_0x1f4637[_0x5607('0x14')];this[_0x5607('0x15')]=_0x1f4637[_0x5607('0x15')]||0x0;this['holdtime']=_0x1f4637[_0x5607('0x16')]||0x0;this[_0x5607('0x17')]=_0x1f4637[_0x5607('0x17')]||0x0;this['callback']=_0x1f4637[_0x5607('0x18')];this[_0x5607('0x19')]=_0x1f4637[_0x5607('0x19')];this['callbackat']=_0x1f4637[_0x5607('0x1a')];this['recallme']=_0x1f4637['recallme'];this[_0x5607('0x1b')]=_0x1f4637[_0x5607('0x1b')];this[_0x5607('0x1c')]=_0x1f4637[_0x5607('0x1c')];this[_0x5607('0x1d')]=_0x1f4637[_0x5607('0x1d')];this[_0x5607('0x1e')]=_0x1f4637[_0x5607('0x1e')];this[_0x5607('0x1f')]=_0x1f4637[_0x5607('0x1f')];this['originatecalleridnum']=_0x1f4637[_0x5607('0x20')]||'';this[_0x5607('0x21')]=_0x1f4637['originatecalleridname']||'';}module[_0x5607('0x22')]=Final; \ No newline at end of file +var _0x89c3=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x252ae5,_0x18d5ed){var _0x395b68=function(_0x460a0f){while(--_0x460a0f){_0x252ae5['push'](_0x252ae5['shift']());}};_0x395b68(++_0x18d5ed);}(_0x89c3,0xff));var _0x389c=function(_0x3d89e5,_0x1c5a79){_0x3d89e5=_0x3d89e5-0x0;var _0x2b6540=_0x89c3[_0x3d89e5];return _0x2b6540;};'use strict';var util=require(_0x389c('0x0'));var _=require(_0x389c('0x1'));var moment=require(_0x389c('0x2'));function getSeconds(_0x56e907,_0x2ffc1d){var _0x14c809=moment(_0x56e907)[_0x389c('0x3')](0x0);var _0x3a2fa4=moment(_0x2ffc1d)['milliseconds'](0x0);return _0x14c809[_0x389c('0x4')](_0x3a2fa4,'seconds');}function Final(_0x283ff9){this['uniqueid']=_0x283ff9['uniqueid'];this[_0x389c('0x5')]=_0x283ff9['scheduledat'];this['type']=_0x283ff9[_0x389c('0x6')];this[_0x389c('0x7')]=_0x283ff9[_0x389c('0x6')]===_0x389c('0x8')?_0x389c('0x9'):_0x283ff9[_0x389c('0x6')];this[_0x389c('0xa')]=_0x283ff9[_0x389c('0xa')];this[_0x389c('0xb')]=_0x283ff9['countcongestionretry'];this[_0x389c('0xc')]=_0x283ff9[_0x389c('0xc')];this[_0x389c('0xd')]=_0x283ff9[_0x389c('0xa')]+_0x283ff9[_0x389c('0xb')]+_0x283ff9['countnoanswerretry']+_0x283ff9['countnosuchnumberretry']+_0x283ff9[_0x389c('0xe')]+_0x283ff9[_0x389c('0xf')]+_0x283ff9[_0x389c('0x10')]+_0x283ff9['countagentrejectretry'];this[_0x389c('0x11')]=_0x283ff9['countnosuchnumberretry'];this[_0x389c('0xe')]=_0x283ff9[_0x389c('0xe')];this['countabandonedretry']=_0x283ff9[_0x389c('0xf')];this[_0x389c('0x10')]=_0x283ff9[_0x389c('0x10')];this['countagentrejectretry']=_0x283ff9[_0x389c('0x12')];this[_0x389c('0x9')]=_0x283ff9[_0x389c('0x9')];this[_0x389c('0x13')]=_0x283ff9[_0x389c('0x13')];this['calleridnum']=_0x283ff9['calleridnum'];this['starttime']=_0x283ff9[_0x389c('0x14')];this[_0x389c('0x15')]=_0x283ff9['responsetime'];this[_0x389c('0x16')]=_0x283ff9[_0x389c('0x15')];this[_0x389c('0x17')]=_0x283ff9[_0x389c('0x17')]||0x0;this[_0x389c('0x18')]=_0x283ff9[_0x389c('0x18')]||0x0;this[_0x389c('0x19')]=_0x283ff9[_0x389c('0x19')]||0x0;this[_0x389c('0x1a')]=_0x283ff9['callback'];this[_0x389c('0x1b')]=_0x283ff9[_0x389c('0x1b')];this[_0x389c('0x1c')]=_0x283ff9[_0x389c('0x1c')];this[_0x389c('0x1d')]=_0x283ff9[_0x389c('0x1d')];this['ContactId']=_0x283ff9[_0x389c('0x1e')];this[_0x389c('0x1f')]=_0x283ff9[_0x389c('0x1f')];this[_0x389c('0x20')]=_0x283ff9['UserId'];this[_0x389c('0x21')]=_0x283ff9[_0x389c('0x21')];this['CampaignId']=_0x283ff9[_0x389c('0x22')];this['originatecalleridnum']=_0x283ff9[_0x389c('0x23')]||'';this[_0x389c('0x24')]=_0x283ff9[_0x389c('0x24')]||'';}module[_0x389c('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 95fae92..55acea3 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2f1=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','endtime','IVR','cause-txt','callbackuniqueid'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0xd2f1,0x1e1));var _0x1d2f=function(_0xe27180,_0x56e592){_0xe27180=_0xe27180-0x0;var _0x1624c9=_0xd2f1[_0xe27180];return _0x1624c9;};'use strict';var util=require(_0x1d2f('0x0'));var _=require(_0x1d2f('0x1'));var moment=require(_0x1d2f('0x2'));function getSeconds(_0x313925,_0x212c04){var _0x5bf98e=moment(_0x313925)[_0x1d2f('0x3')](0x0);var _0x5b1554=moment(_0x212c04)['milliseconds'](0x0);return _0x5bf98e[_0x1d2f('0x4')](_0x5b1554,_0x1d2f('0x5'));}function Hangup(_0x5a3faa,_0x142637){this['state']=0x4;this[_0x1d2f('0x6')]=_0x1d2f('0x7');this[_0x1d2f('0x8')]=_0x5a3faa['scheduledat'];this[_0x1d2f('0x9')]=_0x5a3faa[_0x1d2f('0x9')];this[_0x1d2f('0xa')]=_0x5a3faa[_0x1d2f('0x9')]===_0x1d2f('0xb')?_0x1d2f('0xc'):_0x5a3faa[_0x1d2f('0x9')];this[_0x1d2f('0xd')]=_0x5a3faa[_0x1d2f('0xd')];this[_0x1d2f('0xe')]=_0x5a3faa[_0x1d2f('0xe')];this[_0x1d2f('0xf')]=_0x5a3faa[_0x1d2f('0xf')];this[_0x1d2f('0x10')]=_0x5a3faa[_0x1d2f('0xd')]+_0x5a3faa[_0x1d2f('0xe')]+_0x5a3faa[_0x1d2f('0xf')]+_0x5a3faa[_0x1d2f('0x11')]+_0x5a3faa['countdropretry']+_0x5a3faa[_0x1d2f('0x12')]+_0x5a3faa[_0x1d2f('0x13')]+_0x5a3faa[_0x1d2f('0x14')];this[_0x1d2f('0x11')]=_0x5a3faa['countnosuchnumberretry'];this['countdropretry']=_0x5a3faa[_0x1d2f('0x15')];this['countabandonedretry']=_0x5a3faa['countabandonedretry'];this[_0x1d2f('0x13')]=_0x5a3faa[_0x1d2f('0x13')];this[_0x1d2f('0x14')]=_0x5a3faa[_0x1d2f('0x14')];this['uniqueid']=_0x142637[_0x1d2f('0x16')];this[_0x1d2f('0x17')]=_0x5a3faa[_0x1d2f('0x18')];this['calleridnum']=_0x5a3faa['number'];this[_0x1d2f('0x19')]=_0x5a3faa[_0x1d2f('0x19')];this[_0x1d2f('0x1a')]=_0x5a3faa[_0x1d2f('0x1a')];this['endtime']=moment()[_0x1d2f('0x1b')](_0x1d2f('0x1c'));this[_0x1d2f('0x1d')]=getSeconds(_0x5a3faa[_0x1d2f('0x1a')],_0x5a3faa[_0x1d2f('0x19')]);this['holdtime']=0x0;this[_0x1d2f('0x1e')]=getSeconds(this[_0x1d2f('0x1f')],_0x5a3faa[_0x1d2f('0x1a')]);this[_0x1d2f('0xc')]=_0x5a3faa['queue'];this['membername']=_0x1d2f('0x20');this['reason']=_0x142637[_0x1d2f('0x21')];this['callback']=_0x5a3faa['callback'];this['callbackuniqueid']=_0x5a3faa[_0x1d2f('0x22')];this['callbackat']=_0x5a3faa[_0x1d2f('0x23')];this[_0x1d2f('0x24')]=_0x5a3faa[_0x1d2f('0x24')];this[_0x1d2f('0x25')]=_0x5a3faa[_0x1d2f('0x25')];this[_0x1d2f('0x26')]=_0x5a3faa['ListId'];this[_0x1d2f('0x27')]=_0x5a3faa[_0x1d2f('0x27')];this[_0x1d2f('0x28')]=_0x5a3faa['VoiceQueueId'];this[_0x1d2f('0x29')]=_0x5a3faa[_0x1d2f('0x29')];}module[_0x1d2f('0x2a')]=Hangup; \ No newline at end of file +var _0x3012=['moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util'];(function(_0x1e43e1,_0x15d7b6){var _0x424173=function(_0x1bdcda){while(--_0x1bdcda){_0x1e43e1['push'](_0x1e43e1['shift']());}};_0x424173(++_0x15d7b6);}(_0x3012,0x125));var _0x2301=function(_0x5ed401,_0x34b964){_0x5ed401=_0x5ed401-0x0;var _0x1dba3c=_0x3012[_0x5ed401];return _0x1dba3c;};'use strict';var util=require(_0x2301('0x0'));var _=require('lodash');var moment=require(_0x2301('0x1'));function getSeconds(_0x49a9eb,_0x58257a){var _0x512e12=moment(_0x49a9eb)[_0x2301('0x2')](0x0);var _0x294273=moment(_0x58257a)['milliseconds'](0x0);return _0x512e12[_0x2301('0x3')](_0x294273,_0x2301('0x4'));}function Hangup(_0x2c52a9,_0x47572f){this[_0x2301('0x5')]=0x4;this[_0x2301('0x6')]=_0x2301('0x7');this[_0x2301('0x8')]=_0x2c52a9['scheduledat'];this['type']=_0x2c52a9[_0x2301('0x9')];this[_0x2301('0xa')]=_0x2c52a9[_0x2301('0x9')]===_0x2301('0xb')?_0x2301('0xc'):_0x2c52a9[_0x2301('0x9')];this[_0x2301('0xd')]=_0x2c52a9[_0x2301('0xd')];this[_0x2301('0xe')]=_0x2c52a9[_0x2301('0xe')];this['countnoanswerretry']=_0x2c52a9[_0x2301('0xf')];this['countglobal']=_0x2c52a9[_0x2301('0xd')]+_0x2c52a9[_0x2301('0xe')]+_0x2c52a9[_0x2301('0xf')]+_0x2c52a9[_0x2301('0x10')]+_0x2c52a9['countdropretry']+_0x2c52a9[_0x2301('0x11')]+_0x2c52a9['countmachineretry']+_0x2c52a9[_0x2301('0x12')];this['countnosuchnumberretry']=_0x2c52a9[_0x2301('0x10')];this[_0x2301('0x13')]=_0x2c52a9[_0x2301('0x13')];this[_0x2301('0x11')]=_0x2c52a9['countabandonedretry'];this['countmachineretry']=_0x2c52a9['countmachineretry'];this[_0x2301('0x12')]=_0x2c52a9['countagentrejectretry'];this['uniqueid']=_0x47572f[_0x2301('0x14')];this[_0x2301('0x15')]=_0x2c52a9['name'];this[_0x2301('0x16')]=_0x2c52a9[_0x2301('0x17')];this[_0x2301('0x18')]=_0x2c52a9[_0x2301('0x18')];this['responsetime']=_0x2c52a9[_0x2301('0x19')];this[_0x2301('0x1a')]=moment()['format'](_0x2301('0x1b'));this[_0x2301('0x1c')]=getSeconds(_0x2c52a9[_0x2301('0x19')],_0x2c52a9[_0x2301('0x18')]);this['holdtime']=0x0;this[_0x2301('0x1d')]=getSeconds(this[_0x2301('0x1a')],_0x2c52a9[_0x2301('0x19')]);this[_0x2301('0xc')]=_0x2c52a9[_0x2301('0xc')];this['membername']='IVR';this[_0x2301('0x1e')]=_0x47572f[_0x2301('0x1f')];this[_0x2301('0x20')]=_0x2c52a9['callback'];this['callbackuniqueid']=_0x2c52a9[_0x2301('0x21')];this['callbackat']=_0x2c52a9[_0x2301('0x22')];this[_0x2301('0x23')]=_0x2c52a9[_0x2301('0x23')];this[_0x2301('0x24')]=_0x2c52a9[_0x2301('0x24')];this[_0x2301('0x25')]=_0x2c52a9[_0x2301('0x25')];this[_0x2301('0x26')]=_0x2c52a9[_0x2301('0x26')];this[_0x2301('0x27')]=_0x2c52a9[_0x2301('0x27')];this[_0x2301('0x28')]=_0x2c52a9[_0x2301('0x28')];}module[_0x2301('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8267431..4b171a1 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc697=['ListId','VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','queue','calleridname','number','starttime','responsetime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc697,0x67));var _0x7c69=function(_0x5fbeb0,_0x3eb180){_0x5fbeb0=_0x5fbeb0-0x0;var _0x502a3a=_0xc697[_0x5fbeb0];return _0x502a3a;};'use strict';var util=require(_0x7c69('0x0'));var _=require(_0x7c69('0x1'));var moment=require('moment');function getSeconds(_0x5dd390,_0x21b8d5){var _0x4eeaec=moment(_0x5dd390)[_0x7c69('0x2')](0x0);var _0x57be69=moment(_0x21b8d5)['milliseconds'](0x0);return _0x4eeaec[_0x7c69('0x3')](_0x57be69,'seconds');}function History(_0xd53334){this[_0x7c69('0x4')]=_0xd53334['uniqueid'];this[_0x7c69('0x5')]=_0xd53334[_0x7c69('0x5')]||undefined;this['type']=_0xd53334[_0x7c69('0x6')];this[_0x7c69('0x7')]=_0xd53334['type']===_0x7c69('0x8')?'queue':_0xd53334['type'];this[_0x7c69('0x9')]=_0xd53334[_0x7c69('0x9')];this[_0x7c69('0xa')]=_0xd53334['countcongestionretry'];this[_0x7c69('0xb')]=_0xd53334['countnoanswerretry'];this[_0x7c69('0xc')]=_0xd53334['countbusyretry']+_0xd53334[_0x7c69('0xa')]+_0xd53334[_0x7c69('0xb')]+_0xd53334[_0x7c69('0xd')]+_0xd53334['countdropretry']+_0xd53334['countabandonedretry']+_0xd53334[_0x7c69('0xe')]+_0xd53334['countagentrejectretry'];this[_0x7c69('0xd')]=_0xd53334[_0x7c69('0xd')];this[_0x7c69('0xf')]=_0xd53334['countdropretry'];this['countabandonedretry']=_0xd53334[_0x7c69('0x10')];this['countmachineretry']=_0xd53334[_0x7c69('0xe')];this[_0x7c69('0x11')]=_0xd53334[_0x7c69('0x11')];this[_0x7c69('0x12')]=_0xd53334['queue'];this[_0x7c69('0x13')]=_0xd53334['name'];this['calleridnum']=_0xd53334[_0x7c69('0x14')];this[_0x7c69('0x15')]=_0xd53334['starttime'];this[_0x7c69('0x16')]=_0xd53334[_0x7c69('0x16')];this['endtime']=_0xd53334[_0x7c69('0x16')];this[_0x7c69('0x17')]=getSeconds(_0xd53334[_0x7c69('0x16')],_0xd53334['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this[_0x7c69('0x18')]=_0xd53334[_0x7c69('0x18')];this['callbackuniqueid']=_0xd53334[_0x7c69('0x19')];this[_0x7c69('0x1a')]=_0xd53334[_0x7c69('0x1a')];this['recallme']=_0xd53334[_0x7c69('0x1b')];this[_0x7c69('0x1c')]=_0xd53334[_0x7c69('0x1c')];this[_0x7c69('0x1d')]=_0xd53334[_0x7c69('0x1d')];this['UserId']=_0xd53334['UserId'];this[_0x7c69('0x1e')]=_0xd53334[_0x7c69('0x1e')];this[_0x7c69('0x1f')]=_0xd53334[_0x7c69('0x1f')];this['originatecalleridnum']=_0xd53334[_0x7c69('0x20')]||'';this['originatecalleridname']=_0xd53334['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0x7fe6=['CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x114adc,_0x1b1c55){var _0x19199a=function(_0x2c9442){while(--_0x2c9442){_0x114adc['push'](_0x114adc['shift']());}};_0x19199a(++_0x1b1c55);}(_0x7fe6,0xa9));var _0x67fe=function(_0x2d9f02,_0x5b7597){_0x2d9f02=_0x2d9f02-0x0;var _0x514b53=_0x7fe6[_0x2d9f02];return _0x514b53;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x67fe('0x0'));function getSeconds(_0x46d8c3,_0x4dacda){var _0x58cf93=moment(_0x46d8c3)[_0x67fe('0x1')](0x0);var _0x7cd77=moment(_0x4dacda)[_0x67fe('0x1')](0x0);return _0x58cf93['diff'](_0x7cd77,_0x67fe('0x2'));}function History(_0x3c7fdf){this['uniqueid']=_0x3c7fdf[_0x67fe('0x3')];this['scheduledat']=_0x3c7fdf['scheduledat']||undefined;this[_0x67fe('0x4')]=_0x3c7fdf[_0x67fe('0x4')];this[_0x67fe('0x5')]=_0x3c7fdf[_0x67fe('0x4')]==='outbound'?_0x67fe('0x6'):_0x3c7fdf[_0x67fe('0x4')];this[_0x67fe('0x7')]=_0x3c7fdf[_0x67fe('0x7')];this[_0x67fe('0x8')]=_0x3c7fdf['countcongestionretry'];this[_0x67fe('0x9')]=_0x3c7fdf[_0x67fe('0x9')];this['countglobal']=_0x3c7fdf[_0x67fe('0x7')]+_0x3c7fdf[_0x67fe('0x8')]+_0x3c7fdf['countnoanswerretry']+_0x3c7fdf[_0x67fe('0xa')]+_0x3c7fdf[_0x67fe('0xb')]+_0x3c7fdf[_0x67fe('0xc')]+_0x3c7fdf[_0x67fe('0xd')]+_0x3c7fdf[_0x67fe('0xe')];this[_0x67fe('0xa')]=_0x3c7fdf[_0x67fe('0xa')];this[_0x67fe('0xb')]=_0x3c7fdf[_0x67fe('0xb')];this[_0x67fe('0xc')]=_0x3c7fdf[_0x67fe('0xc')];this[_0x67fe('0xd')]=_0x3c7fdf[_0x67fe('0xd')];this[_0x67fe('0xe')]=_0x3c7fdf[_0x67fe('0xe')];this['queue']=_0x3c7fdf[_0x67fe('0x6')];this[_0x67fe('0xf')]=_0x3c7fdf[_0x67fe('0x10')];this['calleridnum']=_0x3c7fdf['number'];this[_0x67fe('0x11')]=_0x3c7fdf[_0x67fe('0x11')];this[_0x67fe('0x12')]=_0x3c7fdf[_0x67fe('0x12')];this[_0x67fe('0x13')]=_0x3c7fdf[_0x67fe('0x12')];this[_0x67fe('0x14')]=getSeconds(_0x3c7fdf[_0x67fe('0x12')],_0x3c7fdf['starttime']);this['holdtime']=0x0;this[_0x67fe('0x15')]=0x0;this[_0x67fe('0x16')]=_0x3c7fdf['callback'];this[_0x67fe('0x17')]=_0x3c7fdf[_0x67fe('0x17')];this['callbackat']=_0x3c7fdf['callbackat'];this['recallme']=_0x3c7fdf[_0x67fe('0x18')];this[_0x67fe('0x19')]=_0x3c7fdf[_0x67fe('0x19')];this[_0x67fe('0x1a')]=_0x3c7fdf[_0x67fe('0x1a')];this[_0x67fe('0x1b')]=_0x3c7fdf['UserId'];this[_0x67fe('0x1c')]=_0x3c7fdf['VoiceQueueId'];this[_0x67fe('0x1d')]=_0x3c7fdf[_0x67fe('0x1d')];this['originatecalleridnum']=_0x3c7fdf[_0x67fe('0x1e')]||'';this[_0x67fe('0x1f')]=_0x3c7fdf[_0x67fe('0x1f')]||'';}module[_0x67fe('0x20')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 01bc162..b132c19 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 _0x5088=['XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','stateGlobal','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','INTERVAL_IS_NULL','Interval','Intervals','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','callerid','md5','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign: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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\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','milliseconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','format','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','debug','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','No\x20such\x20channel','updateOriginated','voiceQueues','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','queue','resolve','countReScheduled','[countReScheduled]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','catch','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ListId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','state','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','reason19\x20machine....','add','minutes','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','[syncHangupIvr]','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','TIMEOUT','countglobal','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','syncNewExten','channel','syncQueueMember','actionid','locked','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','syncQueueSummary','dialActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[syncCampaigns]','pow','replace','random','match','object','originate','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH'];(function(_0x341d24,_0xb568eb){var _0x185525=function(_0xa576e0){while(--_0xa576e0){_0x341d24['push'](_0x341d24['shift']());}};_0x185525(++_0xb568eb);}(_0x5088,0xa9));var _0x8508=function(_0x1cb825,_0x909dc6){_0x1cb825=_0x1cb825-0x0;var _0x596088=_0x5088[_0x1cb825];return _0x596088;};'use strict';var util=require('util');var _=require(_0x8508('0x0'));var BPromise=require(_0x8508('0x1'));var uuid=require(_0x8508('0x2'));var moment=require(_0x8508('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x8508('0x4'));var ut=require(_0x8508('0x5'));var config=require(_0x8508('0x6'));var logger=require(_0x8508('0x7'))('dialer');var loggerBooked=require(_0x8508('0x7'))('booked');var loggerPredictive=require(_0x8508('0x7'))(_0x8508('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x8508('0x9'));var loggerSyncQueueSummary=require(_0x8508('0x7'))('syncQueueSummary');var ami=require(_0x8508('0xa'));config[_0x8508('0xb')]=_[_0x8508('0xc')](config[_0x8508('0xb')],{'host':_0x8508('0xd'),'port':0x18eb});var io=require(_0x8508('0xe'))(new Redis(config[_0x8508('0xb')]));var cmHopper=require(_0x8508('0xf'));var cmHopperHistory=require(_0x8508('0x10'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0x8508('0x11'));var cmHopperBlack=require(_0x8508('0x12'));var voiceQueueRt=require(_0x8508('0x13'));var RpcSetting=require(_0x8508('0x14'));var Action=require(_0x8508('0x15'));var History=require(_0x8508('0x16'));var Final=require(_0x8508('0x17'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x8508('0x18'));var Hangup=require(_0x8508('0x19'));var ipAgi=process[_0x8508('0x1a')][_0x8508('0x1b')]||'127.0.0.1';var strategy={'rrmemory':_0x8508('0x1c'),'roundrobin':_0x8508('0x1d')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x8508('0x1e')]=function(_0x4f81c7){this[_0x8508('0x1f')]=this[_0x8508('0x1f')]?this[_0x8508('0x1f')][_0x8508('0x20')](_0x4f81c7):_0x4f81c7();};function Dialer(_0x2c12ed,_0x5668d3){this[_0x8508('0x21')]=new Sequence();this[_0x8508('0x22')]=_0x5668d3;this['voiceQueues']=_0x2c12ed['voiceQueues'];this[_0x8508('0x23')]=_0x2c12ed['campaigns'];this[_0x8508('0x24')]=_0x2c12ed[_0x8508('0x24')];this[_0x8508('0x25')]=_0x2c12ed['trunks'];this[_0x8508('0x26')]=config[_0x8508('0x26')]||0x2;this[_0x8508('0x27')]={};this[_0x8508('0x28')]={};this[_0x8508('0x29')]={};this[_0x8508('0x2a')]={};this[_0x8508('0x2b')]={};this[_0x8508('0x2c')]={};this[_0x8508('0x2d')]={};this[_0x8508('0x2e')]={};this[_0x8508('0x2f')]={};this['queueBookedRR']={};ami['on'](_0x8508('0x30'),this[_0x8508('0x31')][_0x8508('0x32')](this));ami['on']('queuecallerabandon',this[_0x8508('0x33')][_0x8508('0x32')](this));ami['on'](_0x8508('0x34'),this['syncOriginateResponse'][_0x8508('0x32')](this));ami['on'](_0x8508('0x35'),this[_0x8508('0x36')][_0x8508('0x32')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x8508('0x32')](this));ami['on']('custom:queuesummarycomplete',this[_0x8508('0x37')]['bind'](this));ami['on'](_0x8508('0x38'),this[_0x8508('0x39')][_0x8508('0x32')](this));ami['on'](_0x8508('0x3a'),this['syncNewExten'][_0x8508('0x32')](this));ami['on'](_0x8508('0x3b'),this[_0x8508('0x3c')]['bind'](this));ami['on'](_0x8508('0x3d'),this['syncQueueMember'][_0x8508('0x32')](this));ami['on'](_0x8508('0x3e'),this['syncQueueStatusComplete'][_0x8508('0x32')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x8508('0x3f')]()['then'](function(_0x35c46d){previewRecallmeReminderInterval=_0x35c46d[_0x8508('0x40')];});}function isNotNull(_0x5076ed){return _0x5076ed!==null&&!_[_0x8508('0x41')](_0x5076ed);}function checkIsLoggedIn(_0x6cd807,_0x1d2463){return function(){if(_0x1d2463<=0x0){_0x6cd807[_0x8508('0x42')]=_0x8508('0x43');throw _0x6cd807['name']+_0x8508('0x44');}};}function isActive(_0x185182){return _0x185182;}function checkIsActive(_0x20be98,_0x577186){return function(){if(!isActive(_0x577186)){_0x20be98[_0x8508('0x42')]=_0x8508('0x45');throw _0x20be98[_0x8508('0x46')]+_0x8508('0x47');}};}function checkInterval(_0x4ffa14){return function(){if(!isNotNull(_0x4ffa14['Interval'])){_0x4ffa14[_0x8508('0x42')]=_0x8508('0x48');throw _0x4ffa14[_0x8508('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4ffa14[_0x8508('0x49')][_0x8508('0x4a')])){_0x4ffa14[_0x8508('0x42')]='INTERVAL_IS_NULL';throw _0x4ffa14['name']+_0x8508('0x4b');}if(!isNotNull(_['isEmpty'](_0x4ffa14['Interval'][_0x8508('0x4a')]))){_0x4ffa14[_0x8508('0x42')]=_0x8508('0x48');throw _0x4ffa14[_0x8508('0x46')]+_0x8508('0x4b');}};}function msgResponse(_0x5d0039,_0x452dd0,_0x575cec){return{'action':_0x5d0039,'response':_0x452dd0,'message':_0x575cec,'stack':_0x575cec};}function myreject(_0x547bff){return function(_0x1d0b04){return _0x547bff(msgResponse(_0x8508('0x4c'),_0x8508('0x4d'),JSON[_0x8508('0x4e')](_0x1d0b04)));};}function getSeconds(_0x70b5f4,_0x42888b){var _0x58de84=moment(_0x70b5f4)['milliseconds'](0x0);var _0x212444=moment(_0x42888b)['milliseconds'](0x0);return _0x58de84[_0x8508('0x4f')](_0x212444,_0x8508('0x50'));}function emit(_0x436521,_0x12de10,_0x3d6d1f){io['to'](_0x436521)[_0x8508('0x51')](_0x12de10,_0x3d6d1f);}function emitVoiceQueueSummary(_0xf2ea9f){if(_0xf2ea9f[_0x8508('0x52')]===_0x8508('0x53')){var _0x13ea27={'id':_0xf2ea9f['id'],'name':_0xf2ea9f[_0x8508('0x46')],'strategy':_0xf2ea9f[_0x8508('0x54')],'answered':_0xf2ea9f[_0x8508('0x55')],'available':_0xf2ea9f[_0x8508('0x56')],'loggedIn':_0xf2ea9f[_0x8508('0x57')],'pTalking':_0xf2ea9f['pTalking'],'sumBillable':_0xf2ea9f[_0x8508('0x58')],'sumDuration':_0xf2ea9f[_0x8508('0x59')],'sumHoldTime':_0xf2ea9f[_0x8508('0x5a')]||0x0,'talking':_0xf2ea9f[_0x8508('0x5b')],'total':_0xf2ea9f['total'],'type':_0xf2ea9f['type'],'unmanaged':_0xf2ea9f[_0x8508('0x5c')],'abandoned':_0xf2ea9f[_0x8508('0x5d')],'waiting':_0xf2ea9f[_0x8508('0x5e')],'loggedInDb':_0xf2ea9f['loggedInDb'],'dialActive':_0xf2ea9f['dialActive'],'dialMethod':_0xf2ea9f[_0x8508('0x5f')],'dialOriginateCallerIdName':_0xf2ea9f[_0x8508('0x60')],'dialOriginateCallerIdNumber':_0xf2ea9f[_0x8508('0x61')],'dialOriginateTimeout':_0xf2ea9f['dialOriginateTimeout'],'dialPrefix':_0xf2ea9f['dialPrefix'],'outboundAnswerAgiCallsDay':_0xf2ea9f[_0x8508('0x62')],'outboundAnswerCallsDay':_0xf2ea9f[_0x8508('0x63')],'outboundBlacklistCallsDay':_0xf2ea9f[_0x8508('0x64')],'outboundBusyCallsDay':_0xf2ea9f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xf2ea9f[_0x8508('0x65')],'outboundDropCallsDayACS':_0xf2ea9f[_0x8508('0x66')],'outboundDropCallsDayCallersExit':_0xf2ea9f[_0x8508('0x67')],'outboundDropCallsDayTimeout':_0xf2ea9f[_0x8508('0x68')],'outboundNoAnswerCallsDay':_0xf2ea9f[_0x8508('0x69')],'outboundNoSuchCallsDay':_0xf2ea9f[_0x8508('0x6a')],'outboundOriginateFailureCallsDay':_0xf2ea9f[_0x8508('0x6b')],'outboundReCallsDay':_0xf2ea9f['outboundReCallsDay'],'outboundRejectCallsDay':_0xf2ea9f[_0x8508('0x6c')],'outboundUnknownCallsDay':_0xf2ea9f[_0x8508('0x6d')],'predictiveIntervalAnsweredCalls':_0xf2ea9f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xf2ea9f[_0x8508('0x6e')],'predictiveIntervalAvgTalktime':_0xf2ea9f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xf2ea9f[_0x8508('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0xf2ea9f[_0x8508('0x70')],'predictiveIntervalErlangCalls':_0xf2ea9f[_0x8508('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0xf2ea9f[_0x8508('0x72')],'predictiveIntervalHitRate':_0xf2ea9f[_0x8508('0x73')],'predictiveIntervalMultiplicativeFactor':_0xf2ea9f[_0x8508('0x74')],'predictiveIntervalPauses':_0xf2ea9f[_0x8508('0x75')],'predictiveIntervalAvailable':_0xf2ea9f[_0x8508('0x76')],'predictiveIntervalTotalCalls':_0xf2ea9f['predictiveIntervalTotalCalls'],'message':_0xf2ea9f[_0x8508('0x42')],'originated':_0xf2ea9f[_0x8508('0x77')],'erlangCalls':_0xf2ea9f[_0x8508('0x78')],'erlangCallToSecond':_0xf2ea9f['erlangCallToSecond'],'erlangAbandonmentRate':_0xf2ea9f[_0x8508('0x79')],'erlangBusyFactor':_0xf2ea9f['erlangBusyFactor'],'startPredictive':_0xf2ea9f[_0x8508('0x2c')],'startProgressive':_0xf2ea9f[_0x8508('0x2d')]};if(_0xf2ea9f[_0x8508('0x7a')]){_0x13ea27[_0x8508('0x7a')]={'id':_0xf2ea9f['Trunk']['id'],'name':_0xf2ea9f['Trunk'][_0x8508('0x46')],'active':_0xf2ea9f[_0x8508('0x7a')][_0x8508('0x7b')],'callerid':_0xf2ea9f['Trunk'][_0x8508('0x7c')]};}if(_0xf2ea9f[_0x8508('0x49')]){_0x13ea27['Interval']={'id':_0xf2ea9f[_0x8508('0x49')]['id'],'name':_0xf2ea9f['Interval'][_0x8508('0x46')]};}var _0x14e80d=md5(JSON[_0x8508('0x4e')](_0x13ea27));if(_0xf2ea9f[_0x8508('0x7d')]!==_0x14e80d){_0xf2ea9f[_0x8508('0x7d')]=_0x14e80d;emit(util['format'](_0x8508('0x7e'),_0x13ea27[_0x8508('0x46')]),_0x8508('0x7f'),_0x13ea27);}}}function emitCampaignSummary(_0x444670){if(_0x444670[_0x8508('0x52')]===_0x8508('0x80')){emit(util['format'](_0x8508('0x81'),_0x444670[_0x8508('0x46')]),_0x8508('0x82'),_0x444670);}}function checkGetDataPredictive(_0x33eaa0){if(isNotNull(_0x33eaa0)&&!_['isEmpty'](_0x33eaa0)){loggerPredictive[_0x8508('0x83')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x8508('0x83')](_0x8508('0x84'),_0x33eaa0[_0x8508('0x85')]);loggerPredictive[_0x8508('0x83')](_0x8508('0x86'),_0x33eaa0[_0x8508('0x87')]);loggerPredictive[_0x8508('0x83')](_0x8508('0x88'),_0x33eaa0[_0x8508('0x70')]);loggerPredictive[_0x8508('0x83')](_0x8508('0x89'),_0x33eaa0[_0x8508('0x6f')]);loggerPredictive[_0x8508('0x83')](_0x8508('0x8a'),_0x33eaa0[_0x8508('0x6e')]);loggerPredictive[_0x8508('0x83')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33eaa0[_0x8508('0x8b')]);loggerPredictive[_0x8508('0x83')](_0x8508('0x8c'));if(_0x33eaa0[_0x8508('0x85')]>0x0){if(!_[_0x8508('0x41')](_0x33eaa0['predictiveIntervalAvgTalktime'])&&_0x33eaa0[_0x8508('0x8b')]>0x0){return!![];}loggerPredictive[_0x8508('0x83')](_0x8508('0x8d'));if(!_[_0x8508('0x41')](_0x33eaa0[_0x8508('0x6e')])&&_0x33eaa0[_0x8508('0x6e')]>0x0){return!![];}loggerPredictive['info'](_0x8508('0x8e'));}else{loggerPredictive[_0x8508('0x83')](_0x8508('0x8f'));}}else{loggerPredictive[_0x8508('0x83')](_0x8508('0x90'));}return![];}function mergeDataErlangB(_0x23ada1){return function(_0xf33be4){loggerPredictive['info'](_0x8508('0x91'));loggerPredictive[_0x8508('0x83')](_0x8508('0x92'),_0xf33be4[_0x8508('0x78')]);loggerPredictive[_0x8508('0x83')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf33be4[_0x8508('0x93')]);loggerPredictive[_0x8508('0x83')](_0x8508('0x94'),_0xf33be4[_0x8508('0x79')]);loggerPredictive[_0x8508('0x83')](_0x8508('0x95'),_0xf33be4[_0x8508('0x96')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf33be4[_0x8508('0x79')]);loggerPredictive['info']('---------------------------');_['merge'](_0x23ada1,_0xf33be4);};}function getDiff(_0x633d15){var _0x5a639f=moment()[_0x8508('0x97')](0x0);var _0x119d37=moment(_0x633d15)[_0x8508('0x97')](0x0);return _0x5a639f['diff'](_0x119d37,_0x8508('0x50'));}function ifInterval(_0x3b0464,_0x24874d){if(_['isUndefined'](_0x24874d)){return![];}return getDiff(_0x24874d)<_0x3b0464*0x3c;}function freeVariablesPredictive(_0x4cd10a){if(isNotNull(_0x4cd10a)){if(!_[_0x8508('0x41')](_0x4cd10a[_0x8508('0x2d')])){_0x4cd10a[_0x8508('0x2d')]=undefined;loggerPredictive['info'](_0x4cd10a['name'],_0x8508('0x98'));}if(!_[_0x8508('0x41')](_0x4cd10a['startPredictive'])){_0x4cd10a['startPredictive']=undefined;loggerPredictive[_0x8508('0x83')](_0x4cd10a['name'],_0x8508('0x99'));}if(!_[_0x8508('0x41')](_0x4cd10a[_0x8508('0x9a')])){clearInterval(_0x4cd10a[_0x8508('0x9a')]);_0x4cd10a[_0x8508('0x9a')]=undefined;loggerPredictive[_0x8508('0x83')](_0x4cd10a['name'],_0x8508('0x9b'));}}}function erlangb(_0x2cc11e,_0x2f49d1){if(_0x2f49d1===0x0){return 0x0;}var _0x5c012b=0x1;for(var _0x17e53c=0x1;_0x17e53c<=_0x2f49d1;_0x17e53c+=0x1){_0x5c012b=0x1+_0x5c012b*_0x17e53c/_0x2cc11e;}return 0x1/_0x5c012b;}function isVoiceQueueOutbound(_0x354047){return _0x354047===_0x8508('0x53');}function isNotPreview(_0x1a73d3){return _0x1a73d3!==_0x8508('0x22');}function isCampaignIvr(_0x4492cb){return _0x4492cb==='ivr';}function getCallerId(_0x3d05ac,_0xa3932f,_0x356a33){if(!_[_0x8508('0x41')](_0x356a33)&&typeof _0x356a33===_0x8508('0x9c')&&!_[_0x8508('0x9d')](_0x356a33)){if(!_[_0x8508('0x41')](_0xa3932f)&&typeof _0xa3932f===_0x8508('0x9c')&&!_[_0x8508('0x9d')](_0xa3932f)){return util[_0x8508('0x9e')]('\x22%s\x22\x20<%s>',_0xa3932f,_0x356a33);}return util[_0x8508('0x9e')]('\x22%s\x22\x20<%s>',_0x356a33,_0x356a33);}if(!_[_0x8508('0x41')](_0x3d05ac)&&typeof _0x3d05ac===_0x8508('0x9c')&&!_[_0x8508('0x9d')](_0x3d05ac)){return _0x3d05ac;}return _0x8508('0x9f');}function loggerCatchQueueSummary(_0x229643,_0x2213a5){return function(_0x4d2771){freeVariablesPredictive(_0x2213a5);emitVoiceQueueSummary(_0x2213a5);emitCampaignSummary(_0x2213a5);loggerSyncQueueSummary['debug'](_0x229643,util[_0x8508('0xa0')](_0x4d2771,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4faa1c,_0x5b9f1a){return function(_0x47c04e){loggerPredictive['error'](_0x5b9f1a['name'],_0x4faa1c);loggerPredictive[_0x8508('0xa1')](_0x47c04e[_0x8508('0xa2')]);freeVariablesPredictive(_0x5b9f1a);};}function loggerCatch(_0x44a203){return function(_0x4b2739){logger[_0x8508('0xa1')](_0x44a203,util[_0x8508('0xa0')](_0x4b2739,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x26e26d){return _0x26e26d&&!_['isUndefined'](_0x26e26d)&&_0x26e26d[_0x8508('0xa3')]>0x0;}function decremetOriginate(_0x318101){if(!_[_0x8508('0x41')](_0x318101)&&_0x318101!==null){if(typeof _0x318101['originated']!==_0x8508('0xa4')){if(_0x318101[_0x8508('0x77')]>0x0){_0x318101[_0x8508('0x77')]-=0x1;}else{logger[_0x8508('0xa1')](_0x8508('0xa5'));}}}else{logger[_0x8508('0xa1')](_0x8508('0xa6'));}}function checkContactLowerLimitOriginate(_0x1c8bc2,_0x1677b6,_0x101a99){if(_0x1677b6>_0x101a99){for(var _0x3a110b=0x0;_0x3a110b<_0x1677b6-_0x101a99;_0x3a110b+=0x1){decremetOriginate(_0x1c8bc2);}}}function loggerGetContactDialer(_0x5bd044,_0x216b55,_0x105286){return function(_0x1d87bb){checkContactLowerLimitOriginate(_0x216b55,_0x105286,0x0);logger[_0x8508('0xa1')](_0x5bd044,util[_0x8508('0xa0')](_0x1d87bb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5c468f){return function(_0x4e5c56){if(isNotNull(_0x4e5c56)&&isNotNull(_0x4e5c56[0x0])){if(_0x4e5c56[0x0][_0x8508('0xa7')]>0x0){_0x5c468f[_0x8508('0x42')]=_0x8508('0xa8');logger['info'](_0x8508('0xa9')+_0x5c468f[_0x8508('0x46')],_0x4e5c56[0x0][_0x8508('0xa7')],_0x8508('0xaa'));}else{_0x5c468f[_0x8508('0x42')]=_0x8508('0xab');logger[_0x8508('0x83')]('[getContactDialer2][Empty]'+_0x5c468f[_0x8508('0x46')]);}}};}function notSendMessagesQueue(_0x22a57a){if(_0x22a57a[_0x8508('0xac')]){freeVariablesPredictive(_0x22a57a);if(_0x22a57a['originated']===0x0&&_0x22a57a[_0x8508('0x5b')]===0x0&&_0x22a57a[_0x8508('0x5e')]===0x0&&(_0x22a57a['pTalking']||0x0)===0x0){_0x22a57a[_0x8508('0xac')]=![];_0x22a57a[_0x8508('0x56')]=0x0;_0x22a57a[_0x8508('0x42')]=_0x8508('0x45');loggerSyncQueueSummary[_0x8508('0xad')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x22a57a[_0x8508('0x46')],_0x8508('0xae'));}else{_0x22a57a[_0x8508('0x42')]=_0x8508('0xaf');loggerSyncQueueSummary[_0x8508('0xad')](_0x8508('0xb0'),_0x22a57a[_0x8508('0x46')],_0x8508('0xb1'));}emitVoiceQueueSummary(_0x22a57a);}}function notSendMessagesCampaign(_0x17a4db){if(_0x17a4db['sendMessageOneNotActive']){if(_0x17a4db[_0x8508('0x77')]===0x0){_0x17a4db[_0x8508('0xac')]=![];_0x17a4db['message']=_0x8508('0x45');loggerSyncQueueSummary['debug'](_0x8508('0xb2'),_0x17a4db[_0x8508('0x46')],'is\x20not\x20active');}else{_0x17a4db[_0x8508('0x42')]=_0x8508('0xaf');loggerSyncQueueSummary[_0x8508('0xad')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x17a4db['name'],_0x8508('0xb1'));}emitCampaignSummary(_0x17a4db);}}function createObjHistory(_0x307e71,_0x410e47,_0x2d6a1b,_0x43dfc0,_0x3c1aa1){_0x307e71['message']=_0x2d6a1b;var _0x4404fc=new Action(_0x307e71,_0x410e47);var _0x878845=new History(_0x4404fc);_0x878845['state']=_0x43dfc0;_0x878845[_0x8508('0xb3')]=_0x3c1aa1;_0x878845[_0x8508('0xb4')]=_0x4404fc[_0x8508('0xb5')];return _0x878845;}Dialer[_0x8508('0xb6')][_0x8508('0xb7')]=function(){var _0x473dab=this;setInterval(function(){_0x473dab[_0x8508('0xb8')](_0x473dab[_0x8508('0x2a')],_0x8508('0xb9'));_0x473dab[_0x8508('0xb8')](_0x473dab[_0x8508('0x28')],_0x8508('0xba'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x3806e1,_0x46f009){var _0x5f11ca=this;for(var _0x43a497 in _0x3806e1){if(typeof _0x3806e1[_0x43a497]!==_0x8508('0xa4')){this['sequence'][_0x8508('0x1e')](function(){if(!_[_0x8508('0xbb')](_0x3806e1[_0x43a497])){return ami[_0x8508('0xbc')]({'action':_0x8508('0xbd'),'channel':_0x3806e1[_0x43a497]['channel']})['catch'](function(_0x43a1bd){if(_0x43a1bd[_0x8508('0x42')]===_0x8508('0xbe')){setTimeout(function(){if(_0x3806e1[_0x43a497]&&_0x3806e1[_0x43a497]['type']!==_0x8508('0x80')){_0x5f11ca[_0x8508('0xbf')](_0x5f11ca[_0x8508('0xc0')][_0x3806e1[_0x43a497]['queue']]);logger['error'](_0x8508('0xc1'),_0x46f009,_0x43a497,_0x3806e1[_0x43a497]['queue']);delete _0x3806e1[_0x43a497];}if(_0x3806e1[_0x43a497]&&_0x3806e1[_0x43a497][_0x8508('0x52')]===_0x8508('0x80')){_0x5f11ca[_0x8508('0xbf')](_0x5f11ca['campaigns'][_0x3806e1[_0x43a497]['queue']]);logger[_0x8508('0xa1')](_0x8508('0xc2'),_0x46f009,_0x43a497,_0x3806e1[_0x43a497][_0x8508('0xc3')]);delete _0x3806e1[_0x43a497];}},0x2328);}});}});}}};Dialer[_0x8508('0xb6')]['countReScheduled']=function(_0x127a2d){return BPromise[_0x8508('0xc4')]()['then'](cmHopper[_0x8508('0xc5')](_0x127a2d))['catch'](loggerCatch(_0x8508('0xc6')));};Dialer[_0x8508('0xb6')]['checkIsBlackList']=function(_0x83c913){return BPromise['resolve']()[_0x8508('0xc7')](cmHopperBlack[_0x8508('0xc8')](_0x83c913))['catch'](loggerCatch(_0x8508('0xc9')));};Dialer[_0x8508('0xb6')][_0x8508('0xca')]=function(_0x555cb4,_0x5f1047,_0x35e323){return BPromise[_0x8508('0xc4')]()['then'](cmHopperAdditionalPhone[_0x8508('0xca')](_0x555cb4,_0x5f1047,_0x35e323))[_0x8508('0xcb')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x8508('0xb6')][_0x8508('0xcc')]=function(_0x482efa,_0x3253fe,_0x20410d){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x8508('0xcc')](_0x482efa,_0x3253fe,_0x20410d))['catch'](loggerCatch(_0x8508('0xcd')));};Dialer[_0x8508('0xb6')]['checkIsBlackListIvr']=function(_0x4ea78c){return BPromise[_0x8508('0xc4')]()[_0x8508('0xc7')](cmHopperBlack[_0x8508('0xce')](_0x4ea78c))[_0x8508('0xcb')](loggerCatch(_0x8508('0xcf')));};Dialer[_0x8508('0xb6')]['averageHandleTime']=function(_0xc291ed){return BPromise[_0x8508('0xc4')]()['then'](cmHopperHistory[_0x8508('0xd0')](_0xc291ed))[_0x8508('0xcb')](loggerCatch(_0x8508('0xd1')));};Dialer[_0x8508('0xb6')][_0x8508('0xd2')]=function(_0x51244b){return BPromise['resolve']()[_0x8508('0xc7')](cmHopper[_0x8508('0xd2')](_0x51244b))[_0x8508('0xcb')](loggerCatch(_0x8508('0xd3')));};Dialer['prototype'][_0x8508('0xd4')]=function(_0x420305,_0xb5da29,_0x431ac8){return BPromise[_0x8508('0xc4')]()['then'](cmHopper['unlockContact'](_0x420305,_0xb5da29,_0x431ac8))[_0x8508('0xcb')](loggerCatch(_0x8508('0xd5')));};Dialer['prototype'][_0x8508('0xd6')]=function(_0xac8514,_0xc7397a,_0x3c912f,_0x1c3e8c,_0x3eac3d){return BPromise[_0x8508('0xc4')]()[_0x8508('0xc7')](cmHopper['getContactDialer'](_0xac8514,_0xc7397a,_0x3c912f,_0x1c3e8c))[_0x8508('0xcb')](function(_0x59dd24){_0x3eac3d[_0x8508('0xd7')]-=_0x3c912f;_0x3eac3d['temp']=_0x3eac3d[_0x8508('0xd7')]>0x0?_0x3eac3d['temp']:0x0;loggerCatch(_0x8508('0xd8'))(_0x59dd24);});};Dialer[_0x8508('0xb6')]['getContactDialerIvr']=function(_0x44a77c,_0x477cc4,_0x54637f,_0x53d2b7){return BPromise['resolve']()['then'](cmHopper[_0x8508('0xd9')](_0x44a77c,_0x477cc4,_0x54637f))[_0x8508('0xcb')](function(_0x5d9144){_0x53d2b7[_0x8508('0xd7')]-=_0x477cc4;_0x53d2b7[_0x8508('0xd7')]=_0x53d2b7[_0x8508('0xd7')]>0x0?_0x53d2b7[_0x8508('0xd7')]:0x0;loggerCatch(_0x8508('0xda'))(_0x5d9144);});};Dialer[_0x8508('0xb6')][_0x8508('0xdb')]=function(_0xb007e0){return BPromise[_0x8508('0xc4')]()[_0x8508('0xc7')](voiceQueueRt[_0x8508('0xdb')](_0xb007e0))['catch'](loggerCatch(_0x8508('0xdc')));};Dialer[_0x8508('0xb6')][_0x8508('0xdd')]=function(_0x5b86d6){return BPromise[_0x8508('0xc4')]()['then'](cmHopper[_0x8508('0xdd')](_0x5b86d6))[_0x8508('0xcb')](loggerCatch(_0x8508('0xde')));};Dialer['prototype']['createHistory']=function(_0x31d9a9){return BPromise[_0x8508('0xc4')]()[_0x8508('0xc7')](cmHopperHistory[_0x8508('0xdf')](_0x31d9a9))[_0x8508('0xcb')](loggerCatch(_0x8508('0xe0')));};Dialer['prototype'][_0x8508('0xbf')]=function(_0x252889){if(!_[_0x8508('0x41')](_0x252889)&&_0x252889!==null){if(typeof _0x252889[_0x8508('0x77')]!==_0x8508('0xa4')){if(_0x252889[_0x8508('0x77')]>0x0){_0x252889['originated']-=0x1;}else{logger[_0x8508('0xa1')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x8508('0xa1')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x8508('0xb6')][_0x8508('0xe1')]=function(_0x172780,_0x40e1fb){var _0xf7c68e=this;return function(_0x3318cb){_0xf7c68e[_0x8508('0xbf')](_0x40e1fb);logger[_0x8508('0xa1')](_0x172780,util[_0x8508('0xa0')](_0x3318cb,{'showHidden':![],'depth':null}));};};Dialer[_0x8508('0xb6')][_0x8508('0xe2')]=function(_0x40a77e,_0x8caf19,_0x3d572e){var _0x5165a1={'state':0x19,'statedesc':_0x8508('0xe3')};this[_0x8508('0xbf')](_0x8caf19);this[_0x8508('0xe4')](_[_0x8508('0xe5')](_0x5165a1,_[_0x8508('0xe6')](_0x3d572e,['ContactId',_0x8508('0xe7'),'UserId',_0x8508('0xe8'),_0x8508('0xe9')])),'[emptyContact][createHistory]',_0x8508('0xea'));logger[_0x8508('0xa1')](_0x40a77e);};Dialer[_0x8508('0xb6')][_0x8508('0xeb')]=function(_0x4bcd4c){return _0x4bcd4c===_0x8508('0xec');};Dialer[_0x8508('0xb6')]['isTrunkReachable']=function(_0x56698f){return!_[_0x8508('0x41')](_0x56698f)&&_0x56698f&&!_[_0x8508('0x41')](_0x56698f[_0x8508('0x46')])&&!_[_0x8508('0x41')](_0x56698f[_0x8508('0x7b')])&&_0x56698f[_0x8508('0x7b')]&&(this[_0x8508('0x25')][util[_0x8508('0x9e')](_0x8508('0xed'),_0x56698f['name'])]['status']===_0x8508('0xee')||this[_0x8508('0x25')][util[_0x8508('0x9e')]('SIP/%s',_0x56698f[_0x8508('0x46')])]['status']===_0x8508('0xef'));};Dialer[_0x8508('0xb6')][_0x8508('0xe4')]=function(_0x5b13dc,_0x3d49ad,_0x16695d){this[_0x8508('0xdf')](_0x5b13dc)['catch'](loggerCatch(_0x3d49ad));this[_0x8508('0xdd')](_0x5b13dc)[_0x8508('0xcb')](loggerCatch(_0x16695d));};Dialer[_0x8508('0xb6')][_0x8508('0x3c')]=function(_0x15497e){var _0x41a913=this[_0x8508('0x2a')][_0x15497e[_0x8508('0xf0')]];var _0x526484;if(!_[_0x8508('0xbb')](_0x15497e)&&!_['isNil'](_0x15497e[_0x8508('0xf1')])&&!_['isNil'](_0x15497e[_0x8508('0xf1')][_0x8508('0xf2')])&&_0x15497e[_0x8508('0xf3')]===_0x8508('0xf4')&&_0x41a913){if(_0x41a913[_0x8508('0x52')]!=='ivr'&&this[_0x8508('0xc0')][_0x41a913['queue']][_0x8508('0xf5')]&&_0x15497e['value']==='HANGUP'){delete this[_0x8508('0x2a')][_0x15497e[_0x8508('0xf0')]];this['updateOriginated'](this[_0x8508('0xc0')][_0x41a913[_0x8508('0xc3')]]);this['voiceQueues'][_0x41a913[_0x8508('0xc3')]][_0x8508('0x63')]+=0x1;this['voiceQueues'][_0x41a913[_0x8508('0xc3')]][_0x8508('0x62')]+=0x1;_0x526484=new Hangup(_0x41a913,_0x15497e);_0x526484[_0x8508('0xf6')]=0x12;_0x526484[_0x8508('0xb3')]=_0x8508('0xf7');_0x526484[_0x8508('0xf8')]=_0x8508('0xf9');ami[_0x8508('0x51')]('custom:amd',ut[_0x8508('0xfa')](_0x526484,_0x8508('0xfb')));this[_0x8508('0xe4')](_0x526484,'[syncHangupInAMD][createHistory]',_0x8508('0xfc'));}if(_0x41a913[_0x8508('0x52')]!==_0x8508('0x80')&&this['voiceQueues'][_0x41a913[_0x8508('0xc3')]]['dialAMDActive']&&_0x15497e['value']===_0x8508('0xfd')){var _0x2dcb5e=this;return new BPromise(function(_0x26d98c,_0x1f68e9){delete _0x2dcb5e[_0x8508('0x2a')][_0x15497e[_0x8508('0xf0')]];_0x2dcb5e[_0x8508('0xbf')](_0x2dcb5e['voiceQueues'][_0x41a913[_0x8508('0xc3')]]);_0x2dcb5e[_0x8508('0xc0')][_0x41a913[_0x8508('0xc3')]][_0x8508('0x63')]+=0x1;_0x2dcb5e[_0x8508('0xc0')][_0x41a913[_0x8508('0xc3')]][_0x8508('0x62')]+=0x1;var _0x109df2=_0x2dcb5e[_0x8508('0xc0')][_0x41a913[_0x8508('0xc3')]];var _0x468866=new Hangup(_0x41a913,_0x15497e);_0x468866[_0x8508('0xf6')]=0x13;_0x468866[_0x8508('0xb3')]=_0x8508('0xfe');_0x468866[_0x8508('0xf8')]=_0x8508('0xf9');_0x468866[_0x8508('0xff')]+=0x1;_0x468866['countglobal']+=0x1;_0x468866[_0x8508('0xfb')]=!![];ami['emit'](_0x8508('0x100'),ut['buildObj'](_0x468866,'amd'));_0x2dcb5e[_0x8508('0xdf')](_0x468866)[_0x8508('0xcb')](loggerCatch(_0x8508('0x101')));if(_0x468866['countbusyretry']+_0x468866[_0x8508('0x102')]+_0x468866[_0x8508('0x103')]+_0x468866[_0x8508('0x104')]+_0x468866[_0x8508('0x105')]+_0x468866[_0x8508('0x106')]+_0x468866[_0x8508('0xff')]+_0x468866[_0x8508('0x107')]>=_0x109df2[_0x8508('0x108')]){_0x2dcb5e['stateGlobal'](_0x468866,_0x26d98c,_0x1f68e9,'reason19\x20machine....');}else{if(_0x468866['countmachineretry']>=_0x109df2[_0x8508('0x109')]){_0x2dcb5e[_0x8508('0x10a')](_0x468866,_0x26d98c,_0x1f68e9,_0x8508('0x10b'));}else{_0x2dcb5e[_0x8508('0xd2')]({'active':![],'countmachineretry':_0x468866[_0x8508('0xff')],'scheduledat':moment()['add'](_0x109df2['dialMachineRetryFrequency'],'minutes')[_0x8508('0x9e')](_0x8508('0x10c')),'ContactId':_0x468866[_0x8508('0x10d')],'ListId':_0x468866[_0x8508('0xe7')],'VoiceQueueId':_0x468866[_0x8508('0xe8')]||undefined,'CampaignId':_0x468866[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x10e')));_0x26d98c({'reschedule':0x1});}}});}if(_0x41a913['type']==='ivr'&&this[_0x8508('0x23')][_0x41a913[_0x8508('0xc3')]][_0x8508('0xf5')]&&_0x15497e[_0x8508('0x10f')]==='HANGUP'){delete this['uniqueId'][_0x15497e[_0x8508('0xf0')]];this[_0x8508('0xbf')](this[_0x8508('0x23')][_0x41a913[_0x8508('0xc3')]]);_0x526484=new Hangup(_0x41a913,_0x15497e);_0x526484['state']=0x12;_0x526484[_0x8508('0xb3')]=_0x8508('0xf7');_0x526484[_0x8508('0xf8')]='AMD';ami[_0x8508('0x51')](_0x8508('0x100'),ut[_0x8508('0xfa')](_0x526484,_0x8508('0xfb')));this[_0x8508('0xe4')](_0x526484,_0x8508('0x110'),_0x8508('0x111'));}if(_0x41a913[_0x8508('0x52')]===_0x8508('0x80')&&this[_0x8508('0x23')][_0x41a913[_0x8508('0xc3')]][_0x8508('0xf5')]&&_0x15497e[_0x8508('0x10f')]===_0x8508('0xfd')){var _0x2dcb5e=this;return new BPromise(function(_0xcdea02,_0x51d509){delete _0x2dcb5e[_0x8508('0x2a')][_0x15497e[_0x8508('0xf0')]];_0x2dcb5e[_0x8508('0xbf')](_0x2dcb5e[_0x8508('0x23')][_0x41a913[_0x8508('0xc3')]]);_0x2dcb5e[_0x8508('0x23')][_0x41a913[_0x8508('0xc3')]][_0x8508('0x63')]+=0x1;_0x2dcb5e['campaigns'][_0x41a913['queue']][_0x8508('0x62')]+=0x1;var _0x484b93=_0x2dcb5e['campaigns'][_0x41a913['queue']];var _0x4b18f5=new Hangup(_0x41a913,_0x15497e);_0x4b18f5['state']=0x13;_0x4b18f5[_0x8508('0xb3')]=_0x8508('0xfe');_0x4b18f5['membername']=_0x8508('0xf9');_0x4b18f5['countmachineretry']+=0x1;_0x4b18f5['countglobal']+=0x1;_0x4b18f5[_0x8508('0xfb')]=!![];ami[_0x8508('0x51')]('custom:amd',ut[_0x8508('0xfa')](_0x4b18f5,'amd'));_0x2dcb5e[_0x8508('0xdf')](_0x4b18f5)[_0x8508('0xcb')](loggerCatch(_0x8508('0x101')));if(_0x4b18f5[_0x8508('0x112')]+_0x4b18f5[_0x8508('0x102')]+_0x4b18f5[_0x8508('0x103')]+_0x4b18f5[_0x8508('0x104')]+_0x4b18f5['countdropretry']+_0x4b18f5[_0x8508('0x106')]+_0x4b18f5[_0x8508('0xff')]+_0x4b18f5['countagentrejectretry']>=_0x484b93[_0x8508('0x108')]){_0x2dcb5e['stateGlobal'](_0x4b18f5,_0xcdea02,_0x51d509,_0x8508('0x113'));}else{if(_0x4b18f5[_0x8508('0xff')]>=_0x484b93[_0x8508('0x109')]){_0x2dcb5e[_0x8508('0x10a')](_0x4b18f5,_0xcdea02,_0x51d509,_0x8508('0x10b'));}else{_0x2dcb5e[_0x8508('0xd2')]({'active':![],'countmachineretry':_0x4b18f5[_0x8508('0xff')],'scheduledat':moment()[_0x8508('0x114')](_0x484b93['dialMachineRetryFrequency'],_0x8508('0x115'))[_0x8508('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b18f5['ContactId'],'ListId':_0x4b18f5[_0x8508('0xe7')],'VoiceQueueId':_0x4b18f5[_0x8508('0xe8')]||undefined,'CampaignId':_0x4b18f5[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x10e')));_0xcdea02({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x8508('0x39')]=function(_0x48e523){var _0x694f39=this[_0x8508('0x2a')][_0x48e523[_0x8508('0xf0')]];var _0x34d8cb=this;var _0x294f66;if(_0x694f39&&_0x694f39[_0x8508('0x52')]===_0x8508('0x80')){delete this[_0x8508('0x2a')][_0x48e523['uniqueid']];this[_0x8508('0xbf')](this[_0x8508('0x23')][_0x694f39[_0x8508('0xc3')]]);this[_0x8508('0x23')][_0x694f39['queue']][_0x8508('0x116')]+=0x1;_0x294f66=new Hangup(_0x694f39,_0x48e523);this['createHistory'](_0x294f66)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8508('0xdd')](_0x294f66)[_0x8508('0xcb')](loggerCatch('[syncHangupIvr]'));}if(_0x694f39&&_0x694f39['type']!==_0x8508('0x80')&&isNotNull(this['voiceQueues'][_0x694f39[_0x8508('0xc3')]][_0x8508('0x117')])){delete this[_0x8508('0x2a')][_0x48e523['uniqueid']];this['updateOriginated'](this[_0x8508('0xc0')][_0x694f39['queue']]);this[_0x8508('0xc0')][_0x694f39[_0x8508('0xc3')]][_0x8508('0x63')]+=0x1;this[_0x8508('0xc0')][_0x694f39[_0x8508('0xc3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x294f66=new Hangup(_0x694f39,_0x48e523);_0x294f66[_0x8508('0xf6')]=0x10;_0x294f66[_0x8508('0xb3')]=_0x8508('0x118');_0x294f66['membername']=_0x8508('0x119');this[_0x8508('0xdf')](_0x294f66)[_0x8508('0xcb')](loggerCatch(_0x8508('0x11a')));this[_0x8508('0xdd')](_0x294f66)[_0x8508('0xcb')](loggerCatch('[syncHangupIvr]'));}if(_0x694f39&&_0x694f39[_0x8508('0x52')]!==_0x8508('0x80')&&!isNotNull(this[_0x8508('0xc0')][_0x694f39[_0x8508('0xc3')]][_0x8508('0x117')])){delete this['uniqueId'][_0x48e523[_0x8508('0xf0')]];this['updateOriginated'](this[_0x8508('0xc0')][_0x694f39['queue']]);this[_0x8508('0xc0')][_0x694f39[_0x8508('0xc3')]][_0x8508('0x6d')]+=0x1;_0x294f66=new Hangup(_0x694f39,_0x48e523);_0x294f66[_0x8508('0xf6')]=0xc;_0x294f66['statedesc']=_0x48e523[_0x8508('0x11b')];_0x294f66[_0x8508('0xf8')]='Unknow';this[_0x8508('0xdf')](_0x294f66)[_0x8508('0xcb')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x294f66)[_0x8508('0xcb')](loggerCatch(_0x8508('0x11c')));}};Dialer[_0x8508('0xb6')][_0x8508('0x36')]=function(_0x100dc2){var _0x1aeb7b=this[_0x8508('0x2a')][_0x100dc2[_0x8508('0xf0')]];var _0x19b002=this;if(this[_0x8508('0xc0')][_0x100dc2['queue']]){if(_0x1aeb7b&&_0x1aeb7b[_0x8508('0x52')]!=='ivr'){delete this[_0x8508('0x2a')][_0x100dc2[_0x8508('0xf0')]];this[_0x8508('0xc0')][_0x100dc2[_0x8508('0xc3')]][_0x8508('0x63')]+=0x1;var _0x3ae9fb=new AgentComplete(_0x1aeb7b,_0x100dc2);if(_0x100dc2[_0x8508('0x11d')]===_0x8508('0x11e')){_0x3ae9fb[_0x8508('0x11f')]=this['voiceQueues'][_0x100dc2[_0x8508('0xc3')]][_0x8508('0x120')]&&this[_0x8508('0xc0')][_0x100dc2[_0x8508('0xc3')]][_0x8508('0x121')]?moment()[_0x8508('0x9e')](_0x8508('0x10c')):undefined;}this[_0x8508('0xdf')](_0x3ae9fb)[_0x8508('0xcb')](loggerCatch(_0x8508('0x122')));this[_0x8508('0xdd')](_0x3ae9fb)[_0x8508('0xcb')](loggerCatch(_0x8508('0x123')));}}};Dialer[_0x8508('0xb6')]['syncAgentConnect']=function(_0x237129){if(this[_0x8508('0xc0')][_0x237129[_0x8508('0xc3')]]){if(this[_0x8508('0x2a')][_0x237129['uniqueid']]&&this[_0x8508('0x2a')][_0x237129[_0x8508('0xf0')]][_0x8508('0x52')]!==_0x8508('0x80')){this['updateOriginated'](this[_0x8508('0xc0')][_0x237129[_0x8508('0xc3')]]);this[_0x8508('0x2a')][_0x237129['uniqueid']][_0x8508('0x124')]=moment()[_0x8508('0x9e')](_0x8508('0x10c'));}}};Dialer[_0x8508('0xb6')][_0x8508('0x125')]=function(_0x56daee,_0x23d8a0){this[_0x8508('0xdf')](_0x56daee)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x23d8a0==0x0){this['moveContactManagedDialer'](_0x56daee)['catch'](loggerCatch(_0x8508('0x126')));}};Dialer[_0x8508('0xb6')][_0x8508('0x33')]=function(_0x30fb91){var _0x42a347=this['uniqueId'][_0x30fb91['uniqueid']];var _0x569159=this;var _0x5d5cac=![];var _0x5d7452;var _0x5dfd02;if(this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]]){if(_0x42a347&&_0x42a347['type']!==_0x8508('0x80')){delete this[_0x8508('0x2a')][_0x30fb91[_0x8508('0xf0')]];this['updateOriginated'](this[_0x8508('0xc0')][_0x30fb91['queue']]);_0x42a347[_0x8508('0x127')]=moment()[_0x8508('0x9e')](_0x8508('0x10c'));var _0x42939e=new QueueCallerAbandon(_0x42a347,_0x30fb91);if(getSeconds(_0x42a347[_0x8508('0x127')],_0x42a347[_0x8508('0x128')])>=_0x42a347[_0x8508('0x129')]){this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x70')]+=0x1;this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x68')]+=0x1;this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x72')]+=0x1;_0x42939e[_0x8508('0xf6')]=0xa;_0x42939e[_0x8508('0xb3')]='Drop';_0x42939e['dropreason']=_0x8508('0x12a');_0x42939e[_0x8508('0x11f')]=this['voiceQueues'][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x120')]?moment()['format'](_0x8508('0x10c')):undefined;_0x42939e[_0x8508('0x105')]+=0x1;_0x42939e[_0x8508('0x12b')]+=0x1;_0x5d7452=this['voiceQueues'][_0x30fb91[_0x8508('0xc3')]]['dialDropRetryFrequency'];_0x5dfd02=this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]]['callAdditionalPhoneAfterMin'];_0x569159[_0x8508('0xca')](_0x42939e,_0x42939e['state'],_0x42a347[_0x8508('0x12c')])[_0x8508('0xc7')](function(_0x282ace){_0x5d5cac=_0x282ace[_0x8508('0x12d')]==0x1;if(_0x42939e[_0x8508('0x105')]>=_0x569159[_0x8508('0xc0')][_0x30fb91['queue']][_0x8508('0x12e')]){_0x569159[_0x8508('0x125')](_0x42939e,_0x282ace['additional']);}else{_0x569159[_0x8508('0xd2')]({'active':![],'countdropretry':_0x42939e['countdropretry'],'scheduledat':moment()[_0x8508('0x114')](_0x569159[_0x8508('0xc0')][_0x30fb91['queue']][_0x8508('0x12f')],'minutes')[_0x8508('0x9e')](_0x8508('0x10c')),'ContactId':_0x42a347['ContactId'],'ListId':_0x42a347[_0x8508('0xe7')],'VoiceQueueId':_0x42a347[_0x8508('0xe8')]||undefined,'CampaignId':_0x42a347[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch('[rescheduleContact][Drop]'));var _0x680eb1=new History(_0x42939e);_0x680eb1[_0x8508('0xf6')]=0xa;_0x680eb1[_0x8508('0xb3')]=_0x8508('0x130');_0x680eb1[_0x8508('0xb5')]=moment()[_0x8508('0x9e')]('YYYY-MM-DD\x20HH:mm:ss');_0x680eb1[_0x8508('0xb4')]=_0x680eb1[_0x8508('0xb5')];_0x680eb1[_0x8508('0x131')]=_0x42939e[_0x8508('0x131')];_0x680eb1[_0x8508('0x132')]=_0x42939e['calleridnum'];_0x569159['createHistory'](_0x680eb1)['catch'](loggerCatch(_0x8508('0x133')));}})[_0x8508('0xc7')](function(_0x5d096f){if(_0x5d5cac)_0x569159[_0x8508('0xcc')](_0x42939e,_0x5d7452,_0x5dfd02)[_0x8508('0xc7')](function(_0x3936ac){return 0x1;});});}else{this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x6f')]+=0x1;this[_0x8508('0xc0')][_0x30fb91['queue']][_0x8508('0x67')]+=0x1;_0x42939e[_0x8508('0xf6')]=0xb;_0x42939e['statedesc']=_0x8508('0x134');_0x42939e[_0x8508('0x135')]=_0x8508('0x136');_0x42939e[_0x8508('0x106')]+=0x1;_0x42939e['countglobal']+=0x1;_0x5d7452=this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x137')];_0x5dfd02=this[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x138')];_0x569159['verifyAdditionalPhones'](_0x42939e,_0x42939e[_0x8508('0xf6')],_0x42a347[_0x8508('0x12c')])[_0x8508('0xc7')](function(_0x44e6b1){if(_0x42939e[_0x8508('0x106')]>=_0x569159[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x139')]){_0x569159['queueCallerAbandonCreateState'](_0x42939e,_0x44e6b1[_0x8508('0x12d')]);}else{_0x569159[_0x8508('0xd2')]({'active':![],'countabandonedretry':_0x42939e['countabandonedretry'],'scheduledat':moment()['add'](_0x569159[_0x8508('0xc0')][_0x30fb91[_0x8508('0xc3')]][_0x8508('0x137')],'minutes')[_0x8508('0x9e')](_0x8508('0x10c')),'ContactId':_0x42a347[_0x8508('0x10d')],'ListId':_0x42a347[_0x8508('0xe7')],'VoiceQueueId':_0x42a347[_0x8508('0xe8')]||undefined,'CampaignId':_0x42a347[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x13a')));var _0x35d2cc=new History(_0x42939e);_0x35d2cc[_0x8508('0xf6')]=0xb;_0x35d2cc['statedesc']=_0x8508('0x134');_0x35d2cc['starttime']=moment()[_0x8508('0x9e')](_0x8508('0x10c'));_0x35d2cc[_0x8508('0xb4')]=_0x35d2cc[_0x8508('0xb5')];_0x35d2cc['calleridname']=_0x42939e[_0x8508('0x131')];_0x35d2cc[_0x8508('0x132')]=_0x42939e[_0x8508('0x132')];_0x569159[_0x8508('0xdf')](_0x35d2cc)[_0x8508('0xcb')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x8508('0xc7')](function(_0x2b1dfb){if(_0x5d5cac)_0x569159[_0x8508('0xcc')](_0x42939e,_0x5d7452,_0x5dfd02)['then'](function(_0x3e88e7){return 0x1;});});}}}};Dialer[_0x8508('0xb6')][_0x8508('0x13b')]=function(_0x12a964){if(this[_0x8508('0x28')][_0x12a964[_0x8508('0xf0')]]){this['actions'][_0x12a964['uniqueid']][_0x8508('0x13c')]=_0x12a964[_0x8508('0x13c')];}if(this[_0x8508('0x2a')][_0x12a964[_0x8508('0xf0')]]){this[_0x8508('0x2a')][_0x12a964['uniqueid']][_0x8508('0x13c')]=_0x12a964['channel'];}};Dialer[_0x8508('0xb6')][_0x8508('0x13d')]=function(_0x34bd0a){if(strategy[this[_0x8508('0xc0')][this[_0x8508('0x28')][_0x34bd0a[_0x8508('0x13e')]][_0x8508('0xc3')]]['strategy']]===_0x8508('0x1d')){if(this['actions'][_0x34bd0a['actionid']]&&_[_0x8508('0xbb')](this[_0x8508('0x28')][_0x34bd0a[_0x8508('0x13e')]][_0x8508('0x13f')])&&_0x34bd0a[_0x8508('0xbd')]==='1'&&_0x34bd0a['paused']==='0'){if(this[_0x8508('0x24')][_0x34bd0a['stateinterface']]){if(!this[_0x8508('0x24')][_0x34bd0a[_0x8508('0x140')]]['locked']){this[_0x8508('0x24')][_0x34bd0a[_0x8508('0x140')]]['locked']=!![];this['actions'][_0x34bd0a[_0x8508('0x13e')]][_0x8508('0x13f')]=!![];this['actions'][_0x34bd0a[_0x8508('0x13e')]][_0x8508('0x140')]=_0x34bd0a[_0x8508('0x140')];}}}}else if((strategy[this[_0x8508('0xc0')][this['actions'][_0x34bd0a['actionid']][_0x8508('0xc3')]][_0x8508('0x54')]]||'rrmemory')===_0x8508('0x1c')){if(this[_0x8508('0x28')][_0x34bd0a[_0x8508('0x13e')]]){if(this[_0x8508('0x24')][_0x34bd0a['stateinterface']]){this[_0x8508('0x28')][_0x34bd0a[_0x8508('0x13e')]][_0x8508('0x140')]=_0x34bd0a['stateinterface'];if(_[_0x8508('0xbb')](this[_0x8508('0x2f')][this[_0x8508('0x28')][_0x34bd0a[_0x8508('0x13e')]][_0x8508('0xc3')]])){this[_0x8508('0x2f')][this['actions'][_0x34bd0a[_0x8508('0x13e')]]['queue']]=[];}this['queueBooked'][this[_0x8508('0x28')][_0x34bd0a[_0x8508('0x13e')]]['queue']]['push'](_['merge'](_[_0x8508('0xe6')](this['actions'][_0x34bd0a[_0x8508('0x13e')]],['idHopper','stateinterface']),{'status':_0x34bd0a[_0x8508('0xbd')],'paused':_0x34bd0a['paused']}));}}}};function unlockQueueStatus(_0x211567,_0x1d9177){setTimeout(function(){if(_['isUndefined'](_0x211567[_0x8508('0x141')])){loggerBooked[_0x8508('0xa1')](_0x8508('0x142'),_0x1d9177);}_0x211567[_0x8508('0x141')]=!![];loggerBooked['info'](_0x8508('0x143'),_0x1d9177,JSON[_0x8508('0x4e')](_[_0x8508('0xe6')](_0x211567,[_0x8508('0x46'),_0x8508('0x141')])));},0x1f3);}Dialer['prototype'][_0x8508('0x144')]=function(_0x1bf705){var _0x1e1d5e=this;var _0x421e6d=_0x1e1d5e['voiceQueues'][_0x1e1d5e[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]];if(strategy[this[_0x8508('0xc0')][this[_0x8508('0x28')][_0x1bf705['actionid']][_0x8508('0xc3')]][_0x8508('0x54')]]==='roundrobin'){if(this[_0x8508('0x28')][_0x1bf705['actionid']]&&this[_0x8508('0x28')][_0x1bf705['actionid']][_0x8508('0x140')]){this['preview'][_0x8508('0x145')](this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0x146')],this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0x140')])[_0x8508('0xcb')](function(_0x29b1fd){logger['error'](_0x8508('0x147'),util[_0x8508('0xa0')](_0x29b1fd,{'showHidden':![],'depth':null}));})[_0x8508('0x20')](function(){_0x1e1d5e[_0x8508('0xbf')](_0x1e1d5e[_0x8508('0xc0')][_0x1e1d5e[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]]);_0x1e1d5e[_0x8508('0x24')][_0x1e1d5e[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0x140')]][_0x8508('0x13f')]=![];delete _0x1e1d5e[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]];unlockQueueStatus(_0x421e6d);});}else{this['updateOriginated'](this[_0x8508('0xc0')][this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x8508('0x28')][_0x1bf705['actionid']]['ContactId'],'ListId':this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]]['ListId'],'VoiceQueueId':this['actions'][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xe8')]||undefined,'CampaignId':this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]]['CampaignId']||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x148')));delete this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]];unlockQueueStatus(_0x421e6d);}}else if((strategy[this['voiceQueues'][this[_0x8508('0x28')][_0x1bf705['actionid']][_0x8508('0xc3')]][_0x8508('0x54')]]||_0x8508('0x1c'))===_0x8508('0x1c')){var _0x22ae26;if(this[_0x8508('0x28')][_0x1bf705['actionid']]&&!_[_0x8508('0x9d')](this[_0x8508('0x2f')][this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]])){if(this[_0x8508('0x149')][_0x1e1d5e[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]]){this['queueBookedRR'][_0x1e1d5e[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]]=this['queueBookedRR'][this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]]?this['queueBookedRR'][this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]]:this[_0x8508('0x2f')][this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]]['queue']]?this[_0x8508('0x2f')][this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]][_0x8508('0xc3')]][_0x8508('0x14a')]||0x0:0x0;}this[_0x8508('0x2f')][this['actions'][_0x1bf705['actionid']][_0x8508('0xc3')]][_0x8508('0x14a')]=this[_0x8508('0x149')][this[_0x8508('0x28')][_0x1bf705[_0x8508('0x13e')]]['queue']];for(var _0x15db43=0x0;_0x15db43=0x0;})[_0x8508('0xcb')](myreject(_0x3f472b)));}}else{_0xd374a3[_0x8508('0x166')](ami['Action']({'action':_0x8508('0x167'),'command':util[_0x8508('0x9e')](_0x8508('0x168'),_0x575f40,!_[_0x8508('0x41')](config[_0x8508('0x162')][_0x2d06e8])?_0x2d06e8:'')})[_0x8508('0xc7')](function(_0x2a5e90){return _0x2a5e90['content'][_0x8508('0x16b')](_0x8508('0x16c'))>=0x0;})[_0x8508('0xcb')](myreject(_0x3f472b)));}BPromise['all'](_0xd374a3)['then'](function(_0x2eaf8b){var _0x49d32d=_[_0x8508('0x16d')](_0x2eaf8b);if(_0x49d32d){return _0x4ee3cb(_0x49d32d);}else{_0x4a0fe8['message']=_0x3c5838?'GLOBAL_INTERVAL_IS_OVERTIME':_0x8508('0x16e');return _0x3f472b(msgResponse(_0x8508('0x16f'),_0x8508('0x15f'),'Global:\x20'+_0x3c5838+'\x20'+_0x2e68ef+_0x8508('0x170')+util[_0x8508('0xa0')](_0x575f40,{'showHidden':![],'depth':null})+_0x8508('0x171')+_0x2d06e8));}})['catch'](function(_0x2847fd){return _0x3f472b(msgResponse(_0x8508('0x15e'),_0x8508('0x15f'),JSON[_0x8508('0x4e')](_0x2847fd)));});});};Dialer[_0x8508('0xb6')][_0x8508('0x172')]=function(_0x577ea5){var _0x190a85=this;return function(){switch(_0x577ea5['dialMethod']){case _0x8508('0x173'):freeVariablesPredictive(_0x577ea5);_0x190a85[_0x8508('0x174')](_0x577ea5,0x1);break;case'power':freeVariablesPredictive(_0x577ea5);_0x190a85['handlePower'](_0x577ea5,_0x577ea5['dialPowerLevel']);break;case _0x8508('0x8'):_0x190a85[_0x8508('0x8')](_0x577ea5);break;case'booked':freeVariablesPredictive(_0x577ea5);_0x190a85[_0x8508('0x174')](_0x577ea5,0x1);break;default:freeVariablesPredictive(_0x577ea5);logger[_0x8508('0xa1')](_0x8508('0x175'),_0x577ea5[_0x8508('0x46')],_0x8508('0x176'));}};};Dialer[_0x8508('0xb6')][_0x8508('0x177')]=function(_0x5cf4a1){var _0x40e8c9=this;return function(){_0x40e8c9[_0x8508('0x178')](_0x5cf4a1);};};Dialer[_0x8508('0xb6')][_0x8508('0x179')]=function(_0x5cb01a){var _0xfd01fd=this;if(isNotPreview(_0x5cb01a[_0x8508('0x5f')])){if(isVoiceQueueOutbound(_0x5cb01a[_0x8508('0x52')])&&isActive(_0x5cb01a[_0x8508('0x17a')])){_0x5cb01a[_0x8508('0xac')]=!![];BPromise[_0x8508('0xc4')]()[_0x8508('0xc7')](checkIsLoggedIn(_0x5cb01a,_0x5cb01a[_0x8508('0x57')]))[_0x8508('0xc7')](checkIsActive(_0x5cb01a,_0x5cb01a[_0x8508('0x17a')]))['then'](checkInterval(_0x5cb01a))[_0x8508('0xc7')](_0xfd01fd[_0x8508('0x158')](_0x5cb01a))['then'](_0xfd01fd[_0x8508('0x15d')](_0x5cb01a[_0x8508('0x17b')],_0x5cb01a[_0x8508('0x17c')],_0x5cb01a['name'],_0x5cb01a))[_0x8508('0xc7')](_0xfd01fd[_0x8508('0x17d')](_0x5cb01a[_0x8508('0x49')],_0x5cb01a[_0x8508('0x17c')],_0x5cb01a[_0x8508('0x46')],_0x5cb01a))['then'](_0xfd01fd['checkDialMethod'](_0x5cb01a))[_0x8508('0xcb')](loggerCatchQueueSummary('[syncQueueSummary]',_0x5cb01a));}else{notSendMessagesQueue(_0x5cb01a);}}else{freeVariablesPredictive(_0x5cb01a);}};Dialer['prototype'][_0x8508('0x37')]=_['throttle'](function(){var _0x20fffa=_[_0x8508('0x17e')](this[_0x8508('0xc0')],function(_0x28c0a9){return _0x28c0a9[_0x8508('0x17f')];});var _0x54b545=_[_0x8508('0x17e')](this[_0x8508('0x24')],function(_0x2af6d3){return _0x2af6d3[_0x8508('0x180')]&&_0x2af6d3[_0x8508('0xbd')]===_0x8508('0xee');});if(_0x20fffa[_0x8508('0xa3')]>0x0&&_0x54b545[_0x8508('0xa3')]>0x0){return BPromise[_0x8508('0xc4')]()['then'](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x20fffa,'id'),previewRecallmeReminderInterval,_[_0x8508('0x181')](_0x54b545,'id')))['then'](function(_0x186d41){for(var _0x15dd6b=0x0;_0x15dd6b<_0x186d41['length'];_0x15dd6b++){var _0x213c11=_0x186d41[_0x15dd6b][_0x8508('0x182')]['name'];if(_0x213c11)io['to'](util[_0x8508('0x9e')](_0x8508('0x183'),_0x213c11))[_0x8508('0x51')](_0x8508('0x184'),{'hopper':_0x186d41[_0x15dd6b]});}})[_0x8508('0xcb')](function(_0x317a){logger['error'](_0x8508('0x185'),_0x317a);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x8508('0x157')]=function(){var _0x84748=this;var _0x376d87;for(var _0x589d2d in this[_0x8508('0x23')]){if(typeof this[_0x8508('0x23')][_0x589d2d]!==_0x8508('0xa4')){_0x376d87=this['campaigns'][_0x589d2d];if(isCampaignIvr(_0x376d87[_0x8508('0x52')])&&isActive(_0x376d87[_0x8508('0x7b')])){_0x376d87[_0x8508('0xac')]=!![];BPromise[_0x8508('0xc4')]()[_0x8508('0xc7')](checkIsActive(_0x376d87,_0x376d87[_0x8508('0x7b')]))[_0x8508('0xc7')](checkInterval(_0x376d87))[_0x8508('0xc7')](_0x84748[_0x8508('0x158')](_0x376d87))[_0x8508('0xc7')](_0x84748[_0x8508('0x15d')](_0x376d87['dialGlobalInterval'],_0x376d87[_0x8508('0x17c')],_0x376d87[_0x8508('0x46')],_0x376d87))[_0x8508('0xc7')](_0x84748[_0x8508('0x17d')](_0x376d87[_0x8508('0x49')],_0x376d87[_0x8508('0x17c')],_0x376d87['name'],_0x376d87))['then'](_0x84748[_0x8508('0x177')](_0x376d87))[_0x8508('0xcb')](loggerCatchQueueSummary(_0x8508('0x186'),_0x376d87));}else{notSendMessagesCampaign(_0x376d87);}}}};function getCallerIdRandom(_0x17496e,_0x55d92a){var _0x21d1bb;var _0x2a43cd;var _0x1c0ba5;if(_0x55d92a<=0x0){_0x55d92a=0x1;}_0x21d1bb=new RegExp('\x5cw{0,'+_0x55d92a+'}$');_0x2a43cd=Math[_0x8508('0x187')](0xa,_0x55d92a-0x1);_0x1c0ba5=Math['pow'](0xa,_0x55d92a)-0x1;return util['format']('%s',_[_0x8508('0x188')](_0x17496e,_0x21d1bb,_[_0x8508('0x189')](_0x2a43cd,_0x1c0ba5)));}function extractCalleridName(_0x2dce9f){var _0x27aa0d=_0x2dce9f[_0x8508('0x18a')](/"(.*?)"/);return _0x27aa0d?_0x27aa0d[0x1]:_0x2dce9f;}function extractCalleridNumber(_0x131dcb){var _0x2d2b7f=_0x131dcb[_0x8508('0x18a')](/<(.*?)>/);return _0x2d2b7f?_0x2d2b7f[0x1]:_0x131dcb;}Dialer[_0x8508('0xb6')]['actionOriginate']=function(_0x105c69,_0x37061e){var _0x37f1e5=this;var _0x1d877c=uuid['v4']();this[_0x8508('0x28')][_0x1d877c]=new Action(_0x105c69,_0x37061e,_0x1d877c);return new BPromise(function(_0x584be1,_0x4f6fd3){if(_[_0x8508('0x41')](_0x105c69)&&typeof _0x105c69!==_0x8508('0x18b')){return _0x4f6fd3(msgResponse(_0x8508('0x18c'),_0x8508('0x15f'),'voiceQueue\x20is\x20undefine'));}if(_[_0x8508('0x41')](_0x37061e[_0x8508('0x18d')])||_0x37061e[_0x8508('0x18d')]===null){return _0x4f6fd3(msgResponse(_0x8508('0x18c'),_0x8508('0x15f'),_0x8508('0x18e')));}var _0x30bb0c={'XMD-CALLERID':_0x37f1e5['actions'][_0x1d877c]['getCaller'](),'XMD-AGI':_0x105c69[_0x8508('0x117')]?util[_0x8508('0x9e')](_0x8508('0x18f'),ipAgi,_0x105c69[_0x8508('0x117')]):_0x8508('0x190'),'XMD-AGIAFTER':_0x105c69[_0x8508('0x120')]?util['format'](_0x8508('0x18f'),ipAgi,_0x105c69['dialQueueProject2']):'NONE','XMD-QUEUE':_0x105c69[_0x8508('0x52')]===_0x8508('0x53')?util['format'](_0x8508('0x191'),_0x105c69['name'],_0x105c69[_0x8508('0x192')]||'',_0x105c69[_0x8508('0x121')]?'c':'',_0x105c69['dialQueueTimeout']||0x3):_0x8508('0x190'),'XMD-CONTACTID':_0x37061e[_0x8508('0x10d')],'XMD-CDRTYPE':_0x8508('0x193'),'CALLERID(all)':_0x37f1e5[_0x8508('0x28')][_0x1d877c]['getCaller'](),'XMD-AMD':_0x105c69[_0x8508('0xf5')]?'ACTIVE':_0x8508('0x190'),'XMD-DESTINATION':_0x8508('0xf4')};if(_0x105c69['dialAMDActive']){_0x30bb0c[_0x8508('0x194')]=_0x105c69['dialAMDInitialSilence']||0x9c4;_0x30bb0c['XMD-AMDGREETING']=_0x105c69[_0x8508('0x195')]||0x5dc;_0x30bb0c[_0x8508('0x196')]=_0x105c69[_0x8508('0x197')]||0x320;_0x30bb0c[_0x8508('0x198')]=_0x105c69['dialAMDTotalAnalysisTime']||0x1388;_0x30bb0c[_0x8508('0x199')]=_0x105c69['dialAMDMinWordLength']||0x64;_0x30bb0c[_0x8508('0x19a')]=_0x105c69[_0x8508('0x19b')]||0x32;_0x30bb0c[_0x8508('0x19c')]=_0x105c69[_0x8508('0x19d')]||0x3;_0x30bb0c['XMD-AMDSILENCETHRESHOLD']=_0x105c69[_0x8508('0x19e')]||0x100;_0x30bb0c[_0x8508('0x19f')]=_0x105c69[_0x8508('0x1a0')]||0x1388;}if(_0x105c69['type']===_0x8508('0x53')){_0x30bb0c['XMD-VOICEQUEUEID']=_0x37061e[_0x8508('0xe8')];}else{_0x30bb0c[_0x8508('0x1a1')]=_0x37061e[_0x8508('0xe9')];}for(var _0xa0171c in _0x37061e[_0x8508('0x1a2')]){if(typeof _0x37061e['Contact'][_0xa0171c]!==_0x8508('0xa4')){if(isNotNull(_0x37061e[_0x8508('0x1a2')][_0xa0171c])&&_0xa0171c!=='id'&&_0xa0171c!==_0x8508('0x1a3')&&_0xa0171c!=='createdAt'&&_0xa0171c!=='updatedAt'){_0x30bb0c[util[_0x8508('0x9e')](_0x8508('0x1a4'),'XMD-',_[_0x8508('0x1a5')](_0xa0171c))]=_0x37061e[_0x8508('0x1a2')][_0xa0171c];}}}var _0x31654b=_0x37f1e5[_0x8508('0x159')](_0x105c69[_0x8508('0x7a')])?getCallerId(_0x105c69[_0x8508('0x7a')][_0x8508('0x7c')],_0x105c69[_0x8508('0x60')],_0x105c69[_0x8508('0x1a6')]>0x0?getCallerIdRandom(_0x105c69[_0x8508('0x61')],_0x105c69[_0x8508('0x1a6')]):_0x105c69[_0x8508('0x61')]):getCallerId(_[_0x8508('0xbb')](_0x105c69[_0x8508('0x15a')])?_0x105c69[_0x8508('0x7a')][_0x8508('0x7c')]:_0x105c69[_0x8508('0x15a')][_0x8508('0x7c')],_0x105c69[_0x8508('0x60')],_0x105c69[_0x8508('0x1a6')]>0x0?getCallerIdRandom(_0x105c69[_0x8508('0x61')],_0x105c69[_0x8508('0x1a6')]):_0x105c69[_0x8508('0x61')]);if(_0x31654b){_0x30bb0c[_0x8508('0x1a7')]=_0x37f1e5[_0x8508('0x28')][_0x1d877c][_0x8508('0x1a8')]=extractCalleridName(_0x31654b);_0x30bb0c['XMD-ORIGINATECALLERIDNUM']=_0x37061e['phone'];}return ami[_0x8508('0xbc')]({'actionid':_0x1d877c,'action':'originate','channel':_0x37f1e5[_0x8508('0x159')](_0x105c69[_0x8508('0x7a')])?util['format'](_0x8508('0x1a9'),_0x105c69[_0x8508('0x7a')][_0x8508('0x46')],isNotNull(_0x105c69[_0x8508('0x1aa')])?_0x105c69[_0x8508('0x1aa')][_0x8508('0x1ab')]()||'':'',_0x105c69['dialCutDigit']>0x0?_0x37061e[_0x8508('0x18d')][_0x8508('0x1ac')](_0x105c69['dialCutDigit']):_0x37061e['phone']):util['format'](_0x8508('0x1a9'),_[_0x8508('0xbb')](_0x105c69[_0x8508('0x15a')])?_0x105c69[_0x8508('0x7a')][_0x8508('0x46')]:_0x105c69['TrunkBackup']['name'],isNotNull(_0x105c69['dialPrefix'])?_0x105c69[_0x8508('0x1aa')][_0x8508('0x1ab')]()||'':'',_0x105c69[_0x8508('0x1ad')]>0x0?_0x37061e['phone'][_0x8508('0x1ac')](_0x105c69[_0x8508('0x1ad')]):_0x37061e[_0x8508('0x18d')]),'callerid':_0x31654b,'Exten':_0x8508('0xf4'),'Context':'from-sip','Priority':'1','variable':_0x30bb0c,'timeout':(_0x105c69[_0x8508('0x1ae')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1d877c})['then'](function(_0xaa3217){return _0x584be1(_0xaa3217);})[_0x8508('0xcb')](function(_0x17db2f){_0x105c69[_0x8508('0x6b')]+=0x1;var _0xea750=new History(_0x37f1e5[_0x8508('0x28')][_0x1d877c]);logger['error'](util[_0x8508('0x9e')]('[originateError]:\x20%s',JSON['stringify'](_0x17db2f)));_0xea750[_0x8508('0xf6')]=0xe;_0xea750['statedesc']=_0x8508('0x1af');_0xea750[_0x8508('0xb5')]=moment()[_0x8508('0x9e')](_0x8508('0x10c'));_0xea750['endtime']=_0xea750['starttime'];_0x37f1e5['createHistory'](_0xea750)[_0x8508('0xcb')](loggerCatch(_0x8508('0x1b0')));_0x37f1e5['moveContactManagedDialer'](_0xea750)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x37f1e5['actions'][_0x1d877c];return _0x4f6fd3(msgResponse(_0x8508('0x18c'),'Error',_0x8508('0x1b1')));});});});};Dialer[_0x8508('0xb6')]['syncOriginateResponse']=function(_0xeee029){var _0x5866e4=this[_0x8508('0x28')][_0xeee029[_0x8508('0x13e')]];if(_0x5866e4){delete this[_0x8508('0x28')][_0xeee029['actionid']];_0x5866e4['responsetime']=moment()[_0x8508('0x9e')](_0x8508('0x10c'));var _0x414a38=_0x5866e4[_0x8508('0x52')]===_0x8508('0x80')?this['campaigns'][_0x5866e4[_0x8508('0xc3')]]:this[_0x8508('0xc0')][_0x5866e4[_0x8508('0x1b2')]()];if(!this[_0x8508('0xeb')](_0xeee029[_0x8508('0x1b3')])){this[_0x8508('0xbf')](_0x414a38);return this[_0x8508('0x1b4')](_0x5866e4,_0x414a38,_0xeee029)[_0x8508('0xcb')](loggerCatch(_0x8508('0x1b5')));}this[_0x8508('0x2a')][_0xeee029['uniqueid']]=_0x5866e4;}};Dialer[_0x8508('0xb6')][_0x8508('0x1b6')]=function(_0x58456f,_0x568518,_0x4dd73e){var _0x250c75=new History(_0x568518);if(_0x250c75['countbusyretry']+_0x250c75['countcongestionretry']+_0x250c75[_0x8508('0x103')]+_0x250c75[_0x8508('0x104')]+_0x250c75['countdropretry']+_0x250c75[_0x8508('0x106')]+_0x250c75[_0x8508('0xff')]+_0x250c75[_0x8508('0x107')]>=_0x4dd73e[_0x8508('0x108')]-0x1){return!![];}switch(_0x58456f){case 0x3:if(_0x250c75[_0x8508('0x103')]>=_0x4dd73e[_0x8508('0x1b7')]-0x1){return!![];}this[_0x8508('0xd2')]({'active':![],'countnoanswerretry':_0x250c75[_0x8508('0x103')]+=0x1,'scheduledat':moment()[_0x8508('0x114')](_0x4dd73e[_0x8508('0x1b8')],'minutes')[_0x8508('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75[_0x8508('0xe7')],'VoiceQueueId':_0x250c75[_0x8508('0xe8')]||undefined,'CampaignId':_0x250c75['CampaignId']||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x1b9')));break;case 0x5:if(_0x250c75['countbusyretry']>=_0x4dd73e[_0x8508('0x1ba')]-0x1){return!![];}this[_0x8508('0xd2')]({'active':![],'countbusyretry':_0x250c75[_0x8508('0x112')]+=0x1,'scheduledat':moment()[_0x8508('0x114')](_0x4dd73e[_0x8508('0x1bb')],_0x8508('0x115'))['format'](_0x8508('0x10c')),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75[_0x8508('0xe7')],'VoiceQueueId':_0x250c75[_0x8508('0xe8')]||undefined,'CampaignId':_0x250c75['CampaignId']||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x1bc')));break;case 0x8:if(_0x250c75['countcongestionretry']>=_0x4dd73e[_0x8508('0x1bd')]-0x1){return!![];}this[_0x8508('0xd2')]({'active':![],'countcongestionretry':_0x250c75[_0x8508('0x102')]+=0x1,'scheduledat':moment()[_0x8508('0x114')](_0x4dd73e['dialCongestionRetryFrequency'],_0x8508('0x115'))[_0x8508('0x9e')](_0x8508('0x10c')),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75[_0x8508('0xe7')],'VoiceQueueId':_0x250c75[_0x8508('0xe8')]||undefined,'CampaignId':_0x250c75[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x1be')));break;case 0x0:if(_0x250c75[_0x8508('0x104')]>=_0x4dd73e[_0x8508('0x1bf')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x250c75[_0x8508('0x104')]+=0x1,'scheduledat':moment()[_0x8508('0x114')](_0x4dd73e['dialNoSuchNumberRetryFrequency'],_0x8508('0x115'))[_0x8508('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75['ListId'],'VoiceQueueId':_0x250c75['VoiceQueueId']||undefined,'CampaignId':_0x250c75[_0x8508('0xe9')]||undefined})['catch'](loggerCatch(_0x8508('0x1c0')));}break;case 0xa:if(_0x250c75['countdropretry']>=_0x4dd73e[_0x8508('0x12e')]-0x1){return!![];}this[_0x8508('0xd2')]({'active':![],'countdropretry':_0x250c75[_0x8508('0x105')]+=0x1,'scheduledat':moment()['add'](_0x4dd73e[_0x8508('0x12f')],_0x8508('0x115'))[_0x8508('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75[_0x8508('0xe7')],'VoiceQueueId':_0x250c75[_0x8508('0xe8')]||undefined,'CampaignId':_0x250c75['CampaignId']||undefined})[_0x8508('0xcb')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x250c75['countabandonedretry']>=_0x4dd73e[_0x8508('0x139')]-0x1){return!![];}this[_0x8508('0xd2')]({'active':![],'countabandonedretry':_0x250c75['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x4dd73e[_0x8508('0x137')],'minutes')[_0x8508('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75['ListId'],'VoiceQueueId':_0x250c75['VoiceQueueId']||undefined,'CampaignId':_0x250c75[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x250c75[_0x8508('0xff')]>=_0x4dd73e[_0x8508('0x109')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x250c75['countmachineretry']+=0x1,'scheduledat':moment()[_0x8508('0x114')](_0x4dd73e[_0x8508('0x1c1')],_0x8508('0x115'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75['ListId'],'VoiceQueueId':_0x250c75['VoiceQueueId']||undefined,'CampaignId':_0x250c75[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x10e')));break;case 0x14:if(_0x250c75['countagentrejectretry']>=_0x4dd73e[_0x8508('0x1c2')]-0x1){return!![];}this[_0x8508('0xd2')]({'active':![],'countagentrejectretry':_0x250c75[_0x8508('0x107')]+=0x1,'scheduledat':moment()[_0x8508('0x114')](_0x4dd73e[_0x8508('0x1c3')],'minutes')[_0x8508('0x9e')](_0x8508('0x10c')),'ContactId':_0x250c75[_0x8508('0x10d')],'ListId':_0x250c75[_0x8508('0xe7')],'VoiceQueueId':_0x250c75[_0x8508('0xe8')]||undefined,'CampaignId':_0x250c75[_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x8508('0xb6')][_0x8508('0x1b4')]=function(_0x5f53e3,_0x5bf0fe,_0x5c56f9){var _0x4add94=this;var _0x5242b9=new History(_0x5f53e3);var _0x507989=![];var _0x213995;var _0x1805bc;return new BPromise(function(_0x17f254,_0x4d661c){if(_['isUndefined'](_0x5bf0fe)&&typeof _0x5bf0fe!==_0x8508('0x18b')){return _0x4d661c(msgResponse(_0x8508('0x1c4'),_0x8508('0x15f'),_0x8508('0x1c5')));}if(_[_0x8508('0x41')](_0x5c56f9)&&typeof _0x5c56f9!==_0x8508('0x18b')){return _0x4d661c(msgResponse(_0x8508('0x1c4'),'Failure','evt\x20is\x20undefine'));}_0x4add94[_0x8508('0xca')](_0x5242b9,_0x5c56f9[_0x8508('0x11d')],_0x5bf0fe)[_0x8508('0xc7')](function(_0x377ffa){if(_0x377ffa[_0x8508('0x12d')]==0x1)_0x507989=!![];switch(_0x5c56f9[_0x8508('0x11d')]){case'0':_0x5bf0fe['outboundNoSuchCallsDay']+=0x1;_0x5242b9['state']=0x0;_0x5242b9[_0x8508('0xb3')]=_0x8508('0x1c6');_0x5242b9[_0x8508('0x104')]+=0x1;_0x5242b9[_0x8508('0x12b')]+=0x1;ami[_0x8508('0x51')](_0x8508('0x1c7'),ut['buildObj'](_0x5f53e3,_0x8508('0x1c8')));_0x213995=_0x5bf0fe[_0x8508('0x1c9')];_0x1805bc=_0x5bf0fe['callAdditionalPhoneAfterMin'];_0x4add94[_0x8508('0xdf')](_0x5242b9)[_0x8508('0xcb')](loggerCatch(_0x8508('0x101')));if(_0x4add94[_0x8508('0x1b6')](0x0,_0x5f53e3,_0x5bf0fe)&&!_0x507989){if(_0x5242b9[_0x8508('0x104')]>=_0x5bf0fe[_0x8508('0x1bf')]){_0x4add94[_0x8508('0x10a')](_0x5242b9,_0x17f254,_0x4d661c,'reason\x200\x20no\x20such\x20number....');}else{_0x4add94[_0x8508('0x1ca')](_0x5242b9,_0x17f254,_0x4d661c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5bf0fe['outboundNoAnswerCallsDay']+=0x1;_0x5242b9[_0x8508('0xf6')]=0x3;_0x5242b9[_0x8508('0xb3')]=_0x8508('0x1cb');_0x5242b9[_0x8508('0x103')]+=0x1;_0x5242b9[_0x8508('0x12b')]+=0x1;ami['emit'](_0x8508('0x1cc'),ut[_0x8508('0xfa')](_0x5f53e3,_0x8508('0x1cd')));_0x213995=_0x5bf0fe['dialNoAnswerRetryFrequency'];_0x1805bc=_0x5bf0fe[_0x8508('0x138')];_0x4add94[_0x8508('0xdf')](_0x5242b9)[_0x8508('0xcb')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4add94[_0x8508('0x1b6')](0x3,_0x5f53e3,_0x5bf0fe)&&!_0x507989){if(_0x5242b9[_0x8508('0x103')]>=_0x5bf0fe[_0x8508('0x1b7')]){_0x4add94['createStateFinal'](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1ce'));}else{_0x4add94['stateGlobal'](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1ce'));}}break;case'5':_0x5bf0fe[_0x8508('0x1cf')]+=0x1;_0x5242b9[_0x8508('0xf6')]=0x5;_0x5242b9['statedesc']=_0x8508('0x1d0');_0x5242b9[_0x8508('0x112')]+=0x1;_0x5242b9['countglobal']+=0x1;ami['emit'](_0x8508('0x1d1'),ut[_0x8508('0xfa')](_0x5f53e3,_0x8508('0x1d2')));_0x213995=_0x5bf0fe['dialBusyRetryFrequency'];_0x1805bc=_0x5bf0fe[_0x8508('0x138')];_0x4add94['createHistory'](_0x5242b9)[_0x8508('0xcb')](loggerCatch(_0x8508('0x1d3')));if(_0x4add94[_0x8508('0x1b6')](0x5,_0x5f53e3,_0x5bf0fe)&&!_0x507989){if(_0x5242b9['countbusyretry']>=_0x5bf0fe[_0x8508('0x1ba')]){_0x4add94[_0x8508('0x10a')](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1d4'));}else{_0x4add94[_0x8508('0x1ca')](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1d4'));}}break;case'8':_0x5bf0fe[_0x8508('0x65')]+=0x1;_0x5242b9[_0x8508('0xf6')]=0x8;_0x5242b9['statedesc']=_0x8508('0x1d5');_0x5242b9[_0x8508('0x102')]+=0x1;_0x5242b9['countglobal']+=0x1;_0x213995=_0x5bf0fe[_0x8508('0x1d6')];_0x1805bc=_0x5bf0fe[_0x8508('0x138')];ami['emit']('custom:agentcongestion',ut[_0x8508('0xfa')](_0x5f53e3,_0x8508('0x1d7')));_0x4add94[_0x8508('0xdf')](_0x5242b9)[_0x8508('0xcb')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4add94[_0x8508('0x1b6')](0x8,_0x5f53e3,_0x5bf0fe)&&!_0x507989){if(_0x5242b9[_0x8508('0x102')]>=_0x5bf0fe['dialCongestionMaxRetry']){_0x4add94[_0x8508('0x10a')](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1d8'));}else{_0x4add94[_0x8508('0x1ca')](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1d8'));}}break;case'11':_0x5bf0fe[_0x8508('0x1d9')]+=0x1;_0x5242b9[_0x8508('0xf6')]=0xb;_0x5242b9['statedesc']='Abandoned';_0x5242b9[_0x8508('0x106')]+=0x1;_0x5242b9[_0x8508('0x12b')]+=0x1;_0x213995=_0x5bf0fe[_0x8508('0x137')];_0x1805bc=_0x5bf0fe[_0x8508('0x138')];_0x4add94[_0x8508('0xdf')](_0x5242b9)['catch'](loggerCatch(_0x8508('0x1da')));if(_0x4add94[_0x8508('0x1b6')](0xb,_0x5f53e3,_0x5bf0fe)&&!_0x507989){if(_0x5242b9[_0x8508('0x106')]>=_0x5bf0fe[_0x8508('0x139')]){_0x4add94[_0x8508('0x10a')](_0x5242b9,_0x17f254,_0x4d661c,'reason\x2011\x20abandoned');}else{_0x4add94['stateGlobal'](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1db'));}}break;case'20':_0x5bf0fe[_0x8508('0x6c')]+=0x1;_0x5242b9[_0x8508('0xf6')]=0x14;_0x5242b9[_0x8508('0xb3')]='AgentReject';_0x5242b9[_0x8508('0x107')]+=0x1;_0x5242b9['countglobal']+=0x1;_0x213995=_0x5bf0fe[_0x8508('0x1c3')];_0x1805bc=_0x5bf0fe[_0x8508('0x138')];ami[_0x8508('0x51')](_0x8508('0x1dc'),ut[_0x8508('0xfa')](_0x5f53e3,_0x8508('0x1dd')));_0x4add94[_0x8508('0xdf')](_0x5242b9)['catch'](loggerCatch(_0x8508('0x1de')));if(_0x4add94[_0x8508('0x1b6')](0x14,_0x5f53e3,_0x5bf0fe)&&!_0x507989){if(_0x5242b9[_0x8508('0x107')]>=_0x5bf0fe['dialAgentRejectMaxRetry']){_0x4add94[_0x8508('0x10a')](_0x5242b9,_0x17f254,_0x4d661c,_0x8508('0x1df'));}else{_0x4add94[_0x8508('0x1ca')](_0x5242b9,_0x17f254,_0x4d661c,'reason\x2020\x20agentreject');}}break;default:_0x5bf0fe[_0x8508('0x6d')]+=0x1;_0x5242b9[_0x8508('0xf6')]=0xc;_0x5242b9['statedesc']=_0x5c56f9[_0x8508('0x11d')];_0x213995=_0x5bf0fe[_0x8508('0x1c3')];_0x1805bc=_0x5bf0fe[_0x8508('0x138')];_0x4add94[_0x8508('0xdf')](_0x5242b9)[_0x8508('0xcb')](loggerCatch(_0x8508('0x1e0')));if(_0x4add94[_0x8508('0x1b6')](_0x5c56f9[_0x8508('0x11d')],_0x5f53e3,_0x5bf0fe)&&!_0x507989){if(_0x5242b9[_0x8508('0x112')]+_0x5242b9[_0x8508('0x102')]+_0x5242b9[_0x8508('0x103')]+_0x5242b9[_0x8508('0x104')]+_0x5242b9[_0x8508('0x105')]+_0x5242b9[_0x8508('0x106')]+_0x5242b9[_0x8508('0xff')]+_0x5242b9[_0x8508('0x107')]>=_0x5bf0fe[_0x8508('0x108')]){_0x4add94[_0x8508('0x1ca')](_0x5242b9,_0x17f254,_0x4d661c,_0x5c56f9[_0x8508('0x11d')]);}else{_0x4add94[_0x8508('0x10a')](_0x5242b9,_0x17f254,_0x4d661c,_0x5c56f9['reason']);}}}})[_0x8508('0xc7')](function(_0x5e10bb){if(_0x507989){_0x4add94['swapAdditionalPhones'](_0x5242b9,_0x213995,_0x1805bc)[_0x8508('0xc7')](function(_0x2baa91){return _0x17f254(0x1);});}});});};Dialer['prototype'][_0x8508('0x1ca')]=function(_0x224f33,_0xd59e6c,_0x457702,_0x2cf209){var _0x43d9f1=new Final(_0x224f33);_0x43d9f1[_0x8508('0xf6')]=0xf;_0x43d9f1['statedesc']=_0x8508('0x1e1');this['createStateFinal'](_0x43d9f1,_0xd59e6c,_0x457702,_0x2cf209);};Dialer[_0x8508('0xb6')][_0x8508('0x10a')]=function(_0x58ca6e,_0x4bec1b,_0x4123a3,_0x58f852){this['moveContactManagedDialer'](_0x58ca6e)['then'](function(){return _0x4bec1b(msgResponse(_0x8508('0x1c4'),_0x8508('0xec'),_0x58f852));})[_0x8508('0xcb')](function(){return _0x4123a3(msgResponse(_0x8508('0x1e2'),'Failure',_0x8508('0x1e3')));});};Dialer[_0x8508('0xb6')][_0x8508('0x8')]=function(_0x5b78f6){var _0x233b3a=_0x5b78f6['dialPredictiveOptimizationPercentage']/0x64;var _0xd17a8e=_0x5b78f6[_0x8508('0x68')]/(_0x5b78f6[_0x8508('0x68')]+_0x5b78f6[_0x8508('0x63')]);var _0x4ce76b=Math['round'](_0x5b78f6[_0x8508('0x76')]*(_0x5b78f6[_0x8508('0x1e4')]/0x64));var _0x173239=Math[_0x8508('0x1e5')](_0x5b78f6['predictiveIntervalAvailable']*(_0x5b78f6['predictiveIntervalMinThreshold']/0x64));var _0x5f16bf=_0x5b78f6[_0x8508('0x56')]+_0x5b78f6[_0x8508('0x5b')];var _0x3e6732=Math[_0x8508('0x1e6')](_0x5b78f6[_0x8508('0x78')]*_0x5b78f6['erlangAbandonmentRate']*_0x5b78f6[_0x8508('0x73')]*_0x5b78f6['predictiveIntervalMultiplicativeFactor']);if(_[_0x8508('0x41')](_0x5b78f6[_0x8508('0x2d')])){if(!_[_0x8508('0x41')](_0x5b78f6['startPredictive'])){_0x5b78f6[_0x8508('0x2c')]=undefined;loggerPredictive[_0x8508('0xa1')](_0x8508('0x1e7'),_0x8508('0x1e8'));}if(!_['isUndefined'](_0x5b78f6[_0x8508('0x9a')])){loggerPredictive['error'](_0x8508('0x1e7'),_0x8508('0x1e9'));clearInterval(_0x5b78f6[_0x8508('0x9a')]);_0x5b78f6[_0x8508('0x9a')]=undefined;}_0x5b78f6[_0x8508('0x2d')]=moment()[_0x8508('0x9e')](_0x8508('0x10c'));loggerPredictive[_0x8508('0x83')](_0x5b78f6['name'],_0x8508('0x1ea'),_0x5b78f6[_0x8508('0x2d')]);this[_0x8508('0x174')](_0x5b78f6,0x1);}else if(ifInterval(_0x5b78f6['dialPredictiveInterval'],_0x5b78f6[_0x8508('0x2d')])){this[_0x8508('0x174')](_0x5b78f6,0x1);loggerPredictiveCalls['info'](_0x8508('0x1eb'),_0x5b78f6[_0x8508('0x2d')],_0x5b78f6[_0x8508('0x46')]);_0x5b78f6['erlangCalls']=0x0;_0x5b78f6[_0x8508('0x72')]=0x0;}else if(_0x233b3a<_0xd17a8e&&_0x5b78f6[_0x8508('0x1ec')]===_0x8508('0x1ed')){freeVariablesPredictive(_0x5b78f6);loggerPredictive[_0x8508('0x83')](_0x8508('0x1ee'),_0x8508('0x1ef'),_0xd17a8e,_0x8508('0x2d'),_0x5b78f6['name']);}else if(_0x3e6732<_0x5b78f6['predictiveIntervalErlangCallsDroppedCalls']&&_0x5b78f6[_0x8508('0x1ec')]===_0x8508('0x1ed')){freeVariablesPredictive(_0x5b78f6);loggerPredictive[_0x8508('0x83')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x8508('0x1f0'),_0x3e6732,_0x8508('0x1f1'),_0x5b78f6[_0x8508('0x72')],_0x8508('0x2d'),_0x5b78f6[_0x8508('0x46')]);}else if(!ifInterval(_0x5b78f6['dialPredictiveInterval'],_0x5b78f6[_0x8508('0x2d')])&&_[_0x8508('0x41')](_0x5b78f6[_0x8508('0x2c')])&&!_[_0x8508('0x41')](_0x5b78f6[_0x8508('0x2d')])){_0x5b78f6['startPredictive']=moment()[_0x8508('0x9e')](_0x8508('0x10c'));loggerPredictive[_0x8508('0x83')](_0x5b78f6['name'],_0x8508('0x1f2'),_0x5b78f6[_0x8508('0x2c')]);this[_0x8508('0x1f3')](_0x5b78f6[_0x8508('0x1f4')])[_0x8508('0xc7')](this[_0x8508('0x1f5')](_0x5b78f6))['then'](mergeDataErlangB(_0x5b78f6))['then'](this[_0x8508('0x1f6')](_0x5b78f6))[_0x8508('0xcb')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5b78f6));}else if(!ifInterval(_0x5b78f6[_0x8508('0x1f4')],_0x5b78f6[_0x8508('0x2c')])){_0x5b78f6[_0x8508('0x72')]=0x0;_0x5b78f6[_0x8508('0x2c')]=moment()[_0x8508('0x9e')](_0x8508('0x10c'));loggerPredictive['info'](_0x5b78f6[_0x8508('0x46')],_0x8508('0x1f7'),_0x5b78f6[_0x8508('0x2c')]);clearInterval(_0x5b78f6['handlePredictive']);_0x5b78f6[_0x8508('0x9a')]=undefined;this[_0x8508('0x1f3')](_0x5b78f6[_0x8508('0x1f4')])['then'](this[_0x8508('0x1f5')](_0x5b78f6))[_0x8508('0xc7')](mergeDataErlangB(_0x5b78f6))[_0x8508('0xc7')](this[_0x8508('0x1f6')](_0x5b78f6))['catch'](loggerCatchPredictive(_0x8508('0x1f8'),_0x5b78f6));}else if(_0x5b78f6[_0x8508('0x76')]&&_0x5f16bf<_0x5b78f6['predictiveIntervalAvailable']-_0x173239){freeVariablesPredictive(_0x5b78f6);loggerPredictive[_0x8508('0x83')](_0x5b78f6['name'],_0x8508('0x1f9'),_0x5f16bf,_0x8508('0x1fa'),_0x5b78f6[_0x8508('0x76')],'-',_0x173239,'=',_0x5b78f6[_0x8508('0x76')]-_0x173239,')');}else if(_0x5b78f6[_0x8508('0x76')]&&_0x5f16bf>_0x5b78f6[_0x8508('0x76')]+_0x4ce76b){freeVariablesPredictive(_0x5b78f6);loggerPredictive['info'](_0x5b78f6['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5f16bf,_0x8508('0x1fb'),_0x5b78f6['predictiveIntervalAvailable'],'+',_0x4ce76b,'=',_0x5b78f6[_0x8508('0x76')]+_0x4ce76b,')');}};Dialer[_0x8508('0xb6')][_0x8508('0x1f5')]=function(_0x491648){var _0x5d78ef=this;return function(_0x574675){return new BPromise(function(_0x3120e6,_0x2a1427){_[_0x8508('0xe5')](_0x491648,_0x574675[0x0]);if(checkGetDataPredictive(_0x574675[0x0])){var _0x3596c1=_0x491648['predictiveIntervalAvailable']=_0x491648[_0x8508('0x5b')]+_0x491648[_0x8508('0x56')];var _0x13d65c=_0x491648['dialPredictiveInterval']*0x3c;var _0x3e4a8e=_0x574675[0x0]['predictiveIntervalAvgTalktime']+_0x574675[0x0][_0x8508('0x6e')];var _0x4aa7b3=(_0x574675[0x0][_0x8508('0x87')]+_0x574675[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x574675[0x0][_0x8508('0x6f')])/_0x574675[0x0][_0x8508('0x85')];_0x491648[_0x8508('0x73')]=_0x4aa7b3>0x0?_0x4aa7b3:0x1;switch(_0x491648[_0x8508('0x1ec')]){case _0x8508('0x1ed'):var _0x343003=_0x491648[_0x8508('0x1fc')]/0x64;return _0x5d78ef['abandonmentRate'](_0x3596c1,_0x13d65c,_0x3e4a8e,_0x4aa7b3,_0x343003)[_0x8508('0xc7')](function(_0x4683d3){return _0x3120e6(_0x4683d3);});case _0x8508('0x1fd'):var _0x525c65=_0x491648[_0x8508('0x1fc')]/0x64;return _0x5d78ef[_0x8508('0x1fe')](_0x3596c1,_0x13d65c,_0x3e4a8e,_0x4aa7b3,_0x525c65)[_0x8508('0xc7')](function(_0x36793c){return _0x3120e6(_0x36793c);});default:return _0x2a1427(msgResponse('[getDataPredictive]',_0x8508('0x15f'),_0x8508('0x1ff')));}}else{return _0x2a1427(msgResponse(_0x8508('0x200'),'Failure',_0x8508('0x201')));}});};};Dialer['prototype'][_0x8508('0x202')]=function(_0x5b6dfe){var _0x1b378c=this;return function(_0x411c4a){return new BPromise(function(_0x2892c5,_0x935dcf){_['merge'](_0x5b6dfe,_0x411c4a[0x0]);if(checkGetDataPredictive(_0x411c4a[0x0])){loggerPredictive['info'](JSON[_0x8508('0x4e')](_0x411c4a[0x0]));if(_0x5b6dfe[_0x8508('0x1ec')]===_0x8508('0x1ed')){return _0x1b378c[_0x8508('0xdb')](_0x5b6dfe['id'])[_0x8508('0xc7')](function(_0x3b1a9e){var _0x4725eb=_0x5b6dfe[_0x8508('0x57')]-_0x3b1a9e[0x0]['outboundQueuePauses'];var _0x353296=_0x5b6dfe['dialPredictiveInterval']*0x3c;var _0x55bac9=_0x411c4a[0x0][_0x8508('0x8b')]+_0x411c4a[0x0]['predictiveIntervalAvgHoldtime'];var _0x268fd9=(_0x411c4a[0x0][_0x8508('0x87')]+_0x411c4a[0x0][_0x8508('0x70')]+_0x411c4a[0x0][_0x8508('0x6f')])/_0x411c4a[0x0][_0x8508('0x85')];var _0x5e98ab=_0x5b6dfe[_0x8508('0x1fc')]/0x64;_0x5b6dfe[_0x8508('0x75')]=_0x3b1a9e[0x0][_0x8508('0x203')]||0x0;_0x5b6dfe['predictiveIntervalHitRate']=_0x268fd9>0x0?_0x268fd9:0x1;return _0x1b378c['abandonmentRate'](_0x4725eb,_0x353296,_0x55bac9,_0x268fd9,_0x5e98ab);})[_0x8508('0xc7')](function(_0x406d7c){return _0x2892c5(_0x406d7c);})[_0x8508('0xcb')](function(_0x332e86){return _0x935dcf(msgResponse(_0x8508('0x204'),_0x8508('0x15f'),JSON[_0x8508('0x4e')](_0x332e86)));});}if(_0x5b6dfe[_0x8508('0x1ec')]===_0x8508('0x1fd')){return _0x1b378c['getVoiceQueueRtPauses'](_0x5b6dfe['id'])['then'](function(_0x2af064){var _0x2b7bb1=_0x5b6dfe[_0x8508('0x57')]-_0x2af064[0x0][_0x8508('0x203')];var _0xcd7bf0=_0x5b6dfe[_0x8508('0x1f4')]*0x3c;var _0x22b416=_0x411c4a[0x0][_0x8508('0x8b')]+_0x411c4a[0x0][_0x8508('0x6e')];var _0x1675a6=(_0x411c4a[0x0][_0x8508('0x87')]+_0x411c4a[0x0][_0x8508('0x70')]+_0x411c4a[0x0][_0x8508('0x6f')])/_0x411c4a[0x0]['predictiveIntervalTotalCalls'];var _0x3d4118=_0x5b6dfe[_0x8508('0x1fc')]/0x64;_0x5b6dfe[_0x8508('0x75')]=_0x2af064[0x0]['outboundQueuePauses']||0x0;_0x5b6dfe[_0x8508('0x73')]=_0x1675a6>0x0?_0x1675a6:0x1;return _0x1b378c[_0x8508('0x1fe')](_0x2b7bb1,_0xcd7bf0,_0x22b416,_0x1675a6,_0x3d4118);})[_0x8508('0xc7')](function(_0x4dcc8e){return _0x2892c5(_0x4dcc8e);})[_0x8508('0xcb')](function(_0x25cc11){return _0x935dcf(msgResponse(_0x8508('0x204'),_0x8508('0x15f'),JSON['stringify'](_0x25cc11)));});}}else{return _0x935dcf(msgResponse(_0x8508('0x200'),_0x8508('0x15f'),_0x8508('0x201')));}});};};Dialer[_0x8508('0xb6')][_0x8508('0x1f6')]=function(_0x463bcb){var _0x42978d=this;return function(){var _0x1f7e7a=0x0;var _0x13c0ce=Math[_0x8508('0x1e6')](_0x463bcb['erlangCallToSecond']*0x3e8);if(_0x13c0ce>0x0){_0x13c0ce=_0x13c0ce<0x64?0x64:_0x13c0ce;loggerPredictive['info'](_0x463bcb[_0x8508('0x46')],_0x8508('0x205'),_0x13c0ce,_0x8508('0x97'));_0x463bcb[_0x8508('0x9a')]=setInterval(function(){_0x42978d[_0x8508('0x9a')](_0x463bcb);loggerPredictiveCalls[_0x8508('0x83')](_0x8508('0x206'),_0x1f7e7a+=0x1);},_0x13c0ce);}else{loggerPredictive[_0x8508('0x83')](_0x463bcb[_0x8508('0x46')],_0x8508('0x207'));}};};Dialer['prototype']['checkContactBlack']=function(_0x51ef95,_0x2a65ca){var _0x17d80e=this;return function(_0xd2c7c7){if(_[_0x8508('0x9d')](_0xd2c7c7)){if(_[_0x8508('0xbb')](_0x2a65ca[_0x8508('0x208')])||!_0x2a65ca[_0x8508('0x209')]){if(_0x51ef95[_0x8508('0x5f')]===_0x8508('0x20a')){_0x51ef95[_0x8508('0x141')]=_['isUndefined'](_0x51ef95['queueStatusComplete'])?!![]:_0x51ef95['queueStatusComplete'];var _0xdde8fe=uuid['v4']();_0x17d80e[_0x8508('0x28')][_0xdde8fe]=new Action(_0x51ef95,_0x2a65ca,_0xdde8fe);loggerBooked[_0x8508('0x83')](_0x8508('0x20b'),_0xdde8fe,_0x8508('0x20c'),JSON[_0x8508('0x4e')](_0x51ef95[_0x8508('0x141')]),_0x8508('0x20d'),_0x51ef95['name']);if(_0x51ef95[_0x8508('0x141')]){_0x51ef95[_0x8508('0x141')]=![];_0x17d80e[_0x8508('0x2f')][_0x17d80e[_0x8508('0x28')][_0xdde8fe][_0x8508('0xc3')]]=[];ami[_0x8508('0xbc')]({'actionid':_0xdde8fe,'action':'queuestatus','queue':_0x51ef95['name']})[_0x8508('0xcb')](function(){_0x17d80e[_0x8508('0xbf')](_0x51ef95);_0x17d80e[_0x8508('0xd2')]({'active':![],'ContactId':_0x17d80e[_0x8508('0x28')][_0xdde8fe]['ContactId'],'ListId':_0x17d80e[_0x8508('0x28')][_0xdde8fe]['ListId'],'VoiceQueueId':_0x17d80e['actions'][_0xdde8fe][_0x8508('0xe8')]||undefined,'CampaignId':_0x17d80e[_0x8508('0x28')][_0xdde8fe]['CampaignId']||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x20e')));delete _0x17d80e[_0x8508('0x28')][_0xdde8fe];});}else{loggerBooked[_0x8508('0x83')](_0x8508('0x20f'),JSON[_0x8508('0x4e')](_0x51ef95[_0x8508('0x141')]),_0x8508('0x20d'),_0x51ef95['name']);_0x17d80e[_0x8508('0xbf')](_0x51ef95);_0x17d80e[_0x8508('0xd2')]({'active':![],'ContactId':_0x17d80e[_0x8508('0x28')][_0xdde8fe]['ContactId'],'ListId':_0x17d80e[_0x8508('0x28')][_0xdde8fe][_0x8508('0xe7')],'VoiceQueueId':_0x17d80e[_0x8508('0x28')][_0xdde8fe][_0x8508('0xe8')]||undefined,'CampaignId':_0x17d80e[_0x8508('0x28')][_0xdde8fe][_0x8508('0xe9')]||undefined})[_0x8508('0xcb')](loggerCatch(_0x8508('0x20e')));delete _0x17d80e[_0x8508('0x28')][_0xdde8fe];}}else{return _0x17d80e[_0x8508('0x210')](_0x51ef95,_0x2a65ca);}}else{if(getDiff(_0x2a65ca[_0x8508('0x211')])<_0x51ef95[_0x8508('0x212')]*0x3c){if(_0x2a65ca['Agent']&&!_0x2a65ca['Agent'][_0x8508('0x213')]){_0x17d80e[_0x8508('0x22')][_0x8508('0x145')](_0x2a65ca['id'])[_0x8508('0x20')](function(){_0x17d80e[_0x8508('0xbf')](_0x51ef95);});}else{_0x17d80e[_0x8508('0xd4')]({'active':![]},_0x2a65ca['id'],0x1)[_0x8508('0x20')](function(){_0x17d80e['updateOriginated'](_0x51ef95);});}}else{_0x51ef95[_0x8508('0x214')]+=0x1;_0x17d80e['updateOriginated'](_0x51ef95);if(_0x51ef95[_0x8508('0x215')]){_0x17d80e[_0x8508('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a65ca['ContactId'],'ListId':_0x2a65ca['ListId'],'VoiceQueueId':_0x2a65ca[_0x8508('0xe8')]||undefined,'CampaignId':_0x2a65ca[_0x8508('0xe9')]||undefined})['catch'](loggerCatch(_0x8508('0x216')));_0x17d80e[_0x8508('0xdf')](createObjHistory(_0x51ef95,_0x2a65ca,_0x8508('0x217'),0x17,_0x8508('0x218')))['catch'](loggerCatch(_0x8508('0x219')));}else{_0x17d80e[_0x8508('0xe4')](createObjHistory(_0x51ef95,_0x2a65ca,_0x8508('0x21a'),0x16,_0x8508('0x21b')),_0x8508('0x21c'),_0x8508('0x21d'));}}}}else{_0x51ef95[_0x8508('0x64')]+=0x1;_0x17d80e['saveInDb'](createObjHistory(_0x51ef95,_0x2a65ca,'BLACKLIST',0xd,_0x8508('0x21e')),_0x8508('0x21f'),_0x8508('0x220'));throw _0x8508('0x221');}};};Dialer[_0x8508('0xb6')][_0x8508('0x178')]=function(_0x2c6e10){var _0x40caed=this;var _0xba6308=_0x2c6e10[_0x8508('0x222')]-_0x2c6e10['originated']-_0x2c6e10[_0x8508('0xd7')];emitCampaignSummary(_0x2c6e10);if(_0xba6308>0x0){if(_0xba6308>this[_0x8508('0x26')]){_0xba6308=this['maxNumberOriginate'];}_0x2c6e10[_0x8508('0xd7')]+=_0xba6308;this[_0x8508('0xd9')](_0x2c6e10['id'],_0xba6308,_0x2c6e10[_0x8508('0x223')],_0x2c6e10)[_0x8508('0xc7')](function(_0x130c77){_0x2c6e10[_0x8508('0xd7')]-=_0xba6308;_0x2c6e10['temp']=_0x2c6e10[_0x8508('0xd7')]>0x0?_0x2c6e10[_0x8508('0xd7')]:0x0;if(!checkContactEmpty(_0x130c77)){_0x2c6e10['message']=_0x8508('0xab');logger['info'](_0x8508('0x224')+_0x2c6e10[_0x8508('0x46')]);}else{_0x2c6e10[_0x8508('0x77')]+=_0x130c77[_0x8508('0xa3')];_0x2c6e10[_0x8508('0x42')]=_0x8508('0x225');for(var _0x272a40=0x0;_0x272a40<_0x130c77[_0x8508('0xa3')];_0x272a40+=0x1){_0x2c6e10[_0x8508('0x226')]+=0x1;if(_[_0x8508('0xbb')](_0x130c77[_0x272a40])||_[_0x8508('0xbb')](_0x130c77[_0x272a40][_0x8508('0x1a2')])||_[_0x8508('0xbb')](_0x130c77[_0x272a40][_0x8508('0x18d')])){_0x40caed[_0x8508('0xe2')](_0x8508('0x227'),_0x2c6e10,_0x130c77[_0x272a40]);}else{_0x40caed[_0x8508('0xce')](_['pick'](_0x130c77[_0x272a40],[_0x8508('0xe9'),_0x8508('0x228')]))[_0x8508('0xc7')](_0x40caed['checkContactBlack'](_0x2c6e10,_0x130c77[_0x272a40]))[_0x8508('0xcb')](_0x40caed[_0x8508('0xe1')](_0x8508('0x229'),_0x2c6e10));}}}})[_0x8508('0xcb')](loggerGetContactDialer(_0x8508('0x22a'),_0x2c6e10,_0xba6308));}};Dialer[_0x8508('0xb6')][_0x8508('0x174')]=function(_0x3167a7,_0x20ce9d){var _0x502876=this;var _0x39151c=[];var _0x28a423=_0x20ce9d>=0x1?_0x20ce9d:0x1;if(_0x3167a7['dialMethod']===_0x8508('0x20a')){_0x28a423=0x1;}var _0x3aa45a=Math[_0x8508('0x1e6')](_0x3167a7['available']*_0x28a423)-_0x3167a7[_0x8508('0x77')]-_0x3167a7['temp'];emitVoiceQueueSummary(_0x3167a7);if(_0x3167a7['dialLimitQueue']>0x0){var _0x5c9010=_0x3167a7['dialLimitQueue']-_0x3167a7[_0x8508('0x77')]-_0x3167a7['talking']-_0x3167a7[_0x8508('0xd7')]-_0x3167a7['pTalking'];if(_0x3aa45a>_0x5c9010){_0x3aa45a=_0x5c9010;}}if(_0x3aa45a>0x0){if(_0x3167a7[_0x8508('0x5f')]===_0x8508('0x20a')){_0x3aa45a=0x1;}if(_0x3aa45a>this['maxNumberOriginate']){_0x3aa45a=this['maxNumberOriginate'];}_0x3167a7[_0x8508('0xd7')]+=_0x3aa45a;for(var _0x302cd4 in this[_0x8508('0x24')]){if(typeof this['agents'][_0x302cd4]!=='undefined'){if(this[_0x8508('0x24')][_0x302cd4][_0x8508('0xf6')]===_0x8508('0x22b')&&this[_0x8508('0x24')][_0x302cd4][_0x8508('0xbd')]===_0x8508('0xee')){_0x39151c[_0x8508('0x166')](this[_0x8508('0x24')][_0x302cd4]['id']);}}}this['getContactDialer'](_0x3167a7['id'],_0x39151c,_0x3aa45a,_0x3167a7[_0x8508('0x223')],_0x3167a7)[_0x8508('0xc7')](function(_0x3ad92e){_0x3167a7[_0x8508('0xd7')]-=_0x3aa45a;_0x3167a7[_0x8508('0xd7')]=_0x3167a7['temp']>0x0?_0x3167a7[_0x8508('0xd7')]:0x0;if(!checkContactEmpty(_0x3ad92e)){_0x502876[_0x8508('0xc5')](_0x3167a7)['then'](sendMessageReschedule(_0x3167a7))[_0x8508('0xcb')](loggerCatch(_0x8508('0xc6')));}else{_0x3167a7[_0x8508('0x77')]+=_0x3ad92e[_0x8508('0xa3')];_0x3167a7[_0x8508('0x42')]=_0x3167a7[_0x8508('0x5f')]===_0x8508('0x20a')?'ACTIVE':'RUNNING';for(var _0x47f2e2=0x0;_0x47f2e2<_0x3ad92e[_0x8508('0xa3')];_0x47f2e2+=0x1){if(_[_0x8508('0xbb')](_0x3ad92e[_0x47f2e2])||_['isNil'](_0x3ad92e[_0x47f2e2][_0x8508('0x1a2')])||_[_0x8508('0xbb')](_0x3ad92e[_0x47f2e2][_0x8508('0x18d')])){_0x502876['emptyContact'](_0x8508('0x227'),_0x3167a7,_0x3ad92e[_0x47f2e2]);}else{_0x502876[_0x8508('0xc8')](_[_0x8508('0xe6')](_0x3ad92e[_0x47f2e2],['VoiceQueueId',_0x8508('0x228')]))[_0x8508('0xc7')](_0x502876['checkContactBlack'](_0x3167a7,_0x3ad92e[_0x47f2e2]))['catch'](_0x502876[_0x8508('0xe1')](_0x8508('0x227'),_0x3167a7));}}}})[_0x8508('0xcb')](loggerGetContactDialer(_0x8508('0x22c'),_0x3167a7,_0x3aa45a));}};Dialer[_0x8508('0xb6')][_0x8508('0x9a')]=function(_0x2ab47a){if(_0x2ab47a[_0x8508('0x22d')]>0x0){var _0x540a84=_0x2ab47a[_0x8508('0x22d')]-_0x2ab47a[_0x8508('0x77')]-_0x2ab47a[_0x8508('0x5b')];if(_0x540a84>0x0){this[_0x8508('0x22e')](_0x2ab47a);}else{loggerPredictiveCalls[_0x8508('0x83')](_0x8508('0x22f'));}}else{this['tryOriginatePredictive'](_0x2ab47a);}};Dialer[_0x8508('0xb6')]['tryOriginatePredictive']=function(_0xb35d94){var _0x3bed33=this;var _0x28ead6=[];_0xb35d94[_0x8508('0x77')]+=0x1;for(var _0xdbae21 in this[_0x8508('0x24')]){if(typeof this[_0x8508('0x24')][_0xdbae21]!=='undefined'){if(this['agents'][_0xdbae21][_0x8508('0xf6')]==='not_inuse'&&this['agents'][_0xdbae21][_0x8508('0xbd')]===_0x8508('0xee')){_0x28ead6[_0x8508('0x166')](this[_0x8508('0x24')][_0xdbae21]['id']);}}}this[_0x8508('0xd6')](_0xb35d94['id'],_0x28ead6,0x1,_0xb35d94[_0x8508('0x223')],_0xb35d94)['then'](function(_0x1ba56c){if(!checkContactEmpty(_0x1ba56c)){checkContactLowerLimitOriginate(_0xb35d94,0x1,0x0);_0x3bed33['countReScheduled'](_0xb35d94)['then'](sendMessageReschedule(_0xb35d94))[_0x8508('0xcb')](loggerCatch('[countReScheduled]\x20'));}else{_0xb35d94[_0x8508('0x42')]=_0x8508('0x225');if(_[_0x8508('0xbb')](_0x1ba56c[0x0])||_[_0x8508('0xbb')](_0x1ba56c[0x0]['Contact'])||_['isNil'](_0x1ba56c[0x0]['phone'])){_0x3bed33['emptyContact']('[actionOriginate]\x20',_0xb35d94,_0x1ba56c[0x0]);}else{_0x3bed33[_0x8508('0xc8')](_[_0x8508('0xe6')](_0x1ba56c[0x0],[_0x8508('0xe8'),_0x8508('0x228')]))[_0x8508('0xc7')](_0x3bed33['checkContactBlack'](_0xb35d94,_0x1ba56c[0x0]))[_0x8508('0xcb')](_0x3bed33[_0x8508('0xe1')](_0x8508('0x230'),_0xb35d94));}}})[_0x8508('0xcb')](loggerGetContactDialer(_0x8508('0x231'),_0xb35d94,0x1));emitVoiceQueueSummary(_0xb35d94);};Dialer[_0x8508('0xb6')][_0x8508('0x232')]=function(_0x20cd6c,_0xaa4934,_0x31a6d3,_0x2c390b,_0x2b3be7,_0x46f2f3){loggerPredictive[_0x8508('0x83')](_0x8508('0x233'));loggerPredictive['info'](_0x8508('0x234'),_0x20cd6c);loggerPredictive[_0x8508('0x83')](_0x8508('0x235'),_0xaa4934);loggerPredictive[_0x8508('0x83')](_0x8508('0x236'),_0x31a6d3);loggerPredictive[_0x8508('0x83')]('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',_0x2c390b);loggerPredictive[_0x8508('0x83')](_0x8508('0x237'),_0x2b3be7);loggerPredictive[_0x8508('0x83')](_0x8508('0x8c'));return new BPromise(function(_0x37ae07,_0x38222f){if(_0x20cd6c<=0x0||isNaN(_0x20cd6c)){return _0x38222f(msgResponse('[abandonmentRate]',_0x8508('0x4d'),_0x8508('0x238')+_0x20cd6c));}if(_0x31a6d3<=0x0||isNaN(_0x31a6d3)){return _0x38222f(msgResponse('[abandonmentRate]',_0x8508('0x4d'),_0x8508('0x239')+_0x31a6d3));}if(_0x2c390b<=0x0||isNaN(_0x2c390b)){return _0x38222f(msgResponse(_0x8508('0x23a'),_0x8508('0x4d'),_0x8508('0x23b')+_0x2c390b));}if(_0xaa4934<=0x0||isNaN(_0xaa4934)){return _0x38222f(msgResponse(_0x8508('0x23a'),_0x8508('0x4d'),_0x8508('0x23c')+_0xaa4934));}if(_0x2b3be7<=0x0||isNaN(_0x2b3be7)){return _0x38222f(msgResponse(_0x8508('0x23a'),'Error',_0x8508('0x23d')+_0x2b3be7));}_0x46f2f3=_0x46f2f3||0x0;var _0x5bd215=0x1/_0x31a6d3;var _0x2d7038=0x0;var _0x3c94c6=0x0;var _0x1ae087=0x0;var _0x5bddef=0x0;for(var _0x4e531b=0x0;_0x1ae087<_0x2b3be7;_0x4e531b+=0x1){_0x3c94c6=_0x4e531b/_0xaa4934;_0x2d7038=(_0x2c390b*_0x3c94c6+_0x46f2f3)/_0x5bd215;_0x1ae087=erlangb(_0x2d7038,_0x20cd6c);_0x5bddef=_0x2d7038/_0x20cd6c*(0x1-erlangb(_0x2d7038,_0x20cd6c));}return _0x37ae07({'erlangCalls':_0x4e531b,'erlangCallToSecond':_0xaa4934/_0x4e531b,'erlangAbandonmentRate':_0x1ae087,'erlangBusyFactor':_0x5bddef});});};Dialer[_0x8508('0xb6')][_0x8508('0x1fe')]=function(_0x71238c,_0x3caa12,_0x47fb87,_0x2d43cc,_0x1f523f,_0x5c7b79){loggerPredictive[_0x8508('0x83')](_0x8508('0x23e'));loggerPredictive[_0x8508('0x83')](_0x8508('0x234'),_0x71238c);loggerPredictive[_0x8508('0x83')](_0x8508('0x235'),_0x3caa12);loggerPredictive[_0x8508('0x83')](_0x8508('0x236'),_0x47fb87);loggerPredictive[_0x8508('0x83')](_0x8508('0x23f'),_0x2d43cc);loggerPredictive[_0x8508('0x83')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f523f);loggerPredictive['info'](_0x8508('0x8c'));return new BPromise(function(_0x238174,_0x540b68){if(_0x71238c<=0x0||isNaN(_0x71238c)){return _0x540b68(msgResponse(_0x8508('0x240'),_0x8508('0x4d'),'m\x20=\x20'+_0x71238c));}if(_0x47fb87<=0x0||isNaN(_0x47fb87)){return _0x540b68(msgResponse(_0x8508('0x240'),_0x8508('0x4d'),_0x8508('0x239')+_0x47fb87));}if(_0x2d43cc<=0x0||isNaN(_0x2d43cc)){return _0x540b68(msgResponse('[busyFactor]',_0x8508('0x4d'),_0x8508('0x23b')+_0x2d43cc));}if(_0x3caa12<=0x0||isNaN(_0x3caa12)){return _0x540b68(msgResponse(_0x8508('0x240'),_0x8508('0x4d'),_0x8508('0x23c')+_0x3caa12));}if(_0x1f523f<=0x0||isNaN(_0x1f523f)){return _0x540b68(msgResponse(_0x8508('0x240'),_0x8508('0x4d'),_0x8508('0x241')+_0x1f523f));}_0x5c7b79=_0x5c7b79||0x0;var _0x5dd5a7=0x1/_0x47fb87;var _0x3d2c05=0x0;var _0x3b8004=0x0;var _0x5941f9=0x0;var _0x1327e9=0x0;for(var _0x222422=0x0;_0x1327e9<_0x1f523f;_0x222422+=0x1){_0x3b8004=_0x222422/_0x3caa12;_0x3d2c05=(_0x2d43cc*_0x3b8004+_0x5c7b79)/_0x5dd5a7;_0x5941f9=erlangb(_0x3d2c05,_0x71238c);_0x1327e9=_0x3d2c05/_0x71238c*(0x1-erlangb(_0x3d2c05,_0x71238c));}return _0x238174({'erlangCalls':_0x222422,'erlangCallToSecond':_0x3caa12/_0x222422,'erlangAbandonmentRate':_0x5941f9,'erlangBusyFactor':_0x1327e9});});};module[_0x8508('0x242')]=Dialer; \ No newline at end of file +var _0x6ae2=['syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','emit','type','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','seconds','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','[actions]','prototype','clearZombieChannels','Action','channel','catch','[Dialer][checkChannel]','queue','ivr','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','saveInDb','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','outboundAnswerCallsDay','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','dialAMDActive','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countnosuchnumberretry','createStateFinal','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','additional','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','pick','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','booked','Queue','launchHandleIvr','dialTimezone','checkDialMethod','[syncQueueSummary]','throttle','filter','online','reachable','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','checkPreviewRecallReminder','dialGlobalInterval','[syncCampaigns]','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','checkRetriveMax','reason\x2011\x20abandoned','AgentReject','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','Contact.phone','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startProgressive','queueBooked','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x280828,_0x1bf47f){_0x280828=_0x280828-0x0;var _0x352eff=_0x6ae2[_0x280828];return _0x352eff;};'use strict';var util=require(_0x26ae('0x0'));var _=require(_0x26ae('0x1'));var BPromise=require(_0x26ae('0x2'));var uuid=require(_0x26ae('0x3'));var moment=require(_0x26ae('0x4'));var rr=require('rr');var md5=require(_0x26ae('0x5'));var Redis=require(_0x26ae('0x6'));var ut=require(_0x26ae('0x7'));var config=require(_0x26ae('0x8'));var logger=require('../../../config/logger')(_0x26ae('0x9'));var loggerBooked=require(_0x26ae('0xa'))('booked');var loggerPredictive=require('../../../config/logger')(_0x26ae('0xb'));var loggerPredictiveCalls=require(_0x26ae('0xa'))(_0x26ae('0xc'));var loggerSyncQueueSummary=require(_0x26ae('0xa'))(_0x26ae('0xd'));var ami=require(_0x26ae('0xe'));config[_0x26ae('0xf')]=_[_0x26ae('0x10')](config[_0x26ae('0xf')],{'host':_0x26ae('0x11'),'port':0x18eb});var io=require(_0x26ae('0x12'))(new Redis(config[_0x26ae('0xf')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x26ae('0x13'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0x26ae('0x14'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x26ae('0x15'));var Action=require(_0x26ae('0x16'));var History=require(_0x26ae('0x17'));var Final=require(_0x26ae('0x18'));var AgentComplete=require(_0x26ae('0x19'));var QueueCallerAbandon=require(_0x26ae('0x1a'));var Hangup=require(_0x26ae('0x1b'));var ipAgi=process[_0x26ae('0x1c')][_0x26ae('0x1d')]||_0x26ae('0x1e');var strategy={'rrmemory':_0x26ae('0x1f'),'roundrobin':_0x26ae('0x20')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x26ae('0x21')]=function(_0x32cd9e){this['tail']=this[_0x26ae('0x22')]?this[_0x26ae('0x22')][_0x26ae('0x23')](_0x32cd9e):_0x32cd9e();};function Dialer(_0x11a091,_0x13ad43){this[_0x26ae('0x24')]=new Sequence();this[_0x26ae('0x25')]=_0x13ad43;this[_0x26ae('0x26')]=_0x11a091[_0x26ae('0x26')];this[_0x26ae('0x27')]=_0x11a091[_0x26ae('0x27')];this[_0x26ae('0x28')]=_0x11a091[_0x26ae('0x28')];this[_0x26ae('0x29')]=_0x11a091[_0x26ae('0x29')];this[_0x26ae('0x2a')]=config[_0x26ae('0x2a')]||0x2;this[_0x26ae('0x2b')]={};this[_0x26ae('0x2c')]={};this[_0x26ae('0x2d')]={};this[_0x26ae('0x2e')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x26ae('0x2f')]={};this['ivrOriginated']={};this[_0x26ae('0x30')]={};this['queueBookedRR']={};ami['on'](_0x26ae('0x31'),this[_0x26ae('0x32')][_0x26ae('0x33')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x26ae('0x33')](this));ami['on'](_0x26ae('0x34'),this[_0x26ae('0x35')]['bind'](this));ami['on'](_0x26ae('0x36'),this[_0x26ae('0x37')]['bind'](this));ami['on'](_0x26ae('0x38'),this[_0x26ae('0xd')][_0x26ae('0x33')](this));ami['on']('custom:queuesummarycomplete',this[_0x26ae('0x39')]['bind'](this));ami['on'](_0x26ae('0x3a'),this[_0x26ae('0x3b')][_0x26ae('0x33')](this));ami['on']('newexten',this[_0x26ae('0x3c')]['bind'](this));ami['on']('varset',this[_0x26ae('0x3d')][_0x26ae('0x33')](this));ami['on']('queuemember',this[_0x26ae('0x3e')][_0x26ae('0x33')](this));ami['on'](_0x26ae('0x3f'),this[_0x26ae('0x40')][_0x26ae('0x33')](this));this['loopCampaigns']();this[_0x26ae('0x41')]();RpcSetting[_0x26ae('0x42')]()[_0x26ae('0x43')](function(_0x461d50){previewRecallmeReminderInterval=_0x461d50[_0x26ae('0x44')];});}function isNotNull(_0x56588f){return _0x56588f!==null&&!_[_0x26ae('0x45')](_0x56588f);}function checkIsLoggedIn(_0x3c9267,_0x3423b9){return function(){if(_0x3423b9<=0x0){_0x3c9267[_0x26ae('0x46')]=_0x26ae('0x47');throw _0x3c9267[_0x26ae('0x48')]+_0x26ae('0x49');}};}function isActive(_0x45737c){return _0x45737c;}function checkIsActive(_0x5f46bd,_0x170dd4){return function(){if(!isActive(_0x170dd4)){_0x5f46bd['message']='NOT_ACTIVE';throw _0x5f46bd[_0x26ae('0x48')]+_0x26ae('0x4a');}};}function checkInterval(_0x2f410c){return function(){if(!isNotNull(_0x2f410c['Interval'])){_0x2f410c[_0x26ae('0x46')]=_0x26ae('0x4b');throw _0x2f410c[_0x26ae('0x48')]+_0x26ae('0x4c');}if(!isNotNull(_0x2f410c[_0x26ae('0x4d')][_0x26ae('0x4e')])){_0x2f410c[_0x26ae('0x46')]=_0x26ae('0x4b');throw _0x2f410c[_0x26ae('0x48')]+_0x26ae('0x4c');}if(!isNotNull(_[_0x26ae('0x4f')](_0x2f410c[_0x26ae('0x4d')][_0x26ae('0x4e')]))){_0x2f410c[_0x26ae('0x46')]='INTERVAL_IS_NULL';throw _0x2f410c[_0x26ae('0x48')]+_0x26ae('0x4c');}};}function msgResponse(_0x2e5d70,_0x484dec,_0x20c60a){return{'action':_0x2e5d70,'response':_0x484dec,'message':_0x20c60a,'stack':_0x20c60a};}function myreject(_0x37855d){return function(_0x341469){return _0x37855d(msgResponse(_0x26ae('0x50'),_0x26ae('0x51'),JSON['stringify'](_0x341469)));};}function getSeconds(_0x3d4e10,_0x255ec3){var _0x49eb68=moment(_0x3d4e10)[_0x26ae('0x52')](0x0);var _0x348471=moment(_0x255ec3)[_0x26ae('0x52')](0x0);return _0x49eb68['diff'](_0x348471,'seconds');}function emit(_0x52ed4d,_0x1b2c5c,_0xcdb7ff){io['to'](_0x52ed4d)[_0x26ae('0x53')](_0x1b2c5c,_0xcdb7ff);}function emitVoiceQueueSummary(_0x1519a3){if(_0x1519a3[_0x26ae('0x54')]==='outbound'){var _0x249edf={'id':_0x1519a3['id'],'name':_0x1519a3[_0x26ae('0x48')],'strategy':_0x1519a3[_0x26ae('0x55')],'answered':_0x1519a3[_0x26ae('0x56')],'available':_0x1519a3[_0x26ae('0x57')],'loggedIn':_0x1519a3[_0x26ae('0x58')],'pTalking':_0x1519a3[_0x26ae('0x59')],'sumBillable':_0x1519a3['sumBillable'],'sumDuration':_0x1519a3[_0x26ae('0x5a')],'sumHoldTime':_0x1519a3[_0x26ae('0x5b')]||0x0,'talking':_0x1519a3['talking'],'total':_0x1519a3[_0x26ae('0x5c')],'type':_0x1519a3['type'],'unmanaged':_0x1519a3[_0x26ae('0x5d')],'abandoned':_0x1519a3[_0x26ae('0x5e')],'waiting':_0x1519a3[_0x26ae('0x5f')],'loggedInDb':_0x1519a3['loggedInDb'],'dialActive':_0x1519a3[_0x26ae('0x60')],'dialMethod':_0x1519a3[_0x26ae('0x61')],'dialOriginateCallerIdName':_0x1519a3[_0x26ae('0x62')],'dialOriginateCallerIdNumber':_0x1519a3[_0x26ae('0x63')],'dialOriginateTimeout':_0x1519a3[_0x26ae('0x64')],'dialPrefix':_0x1519a3[_0x26ae('0x65')],'outboundAnswerAgiCallsDay':_0x1519a3['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1519a3['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1519a3['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1519a3[_0x26ae('0x66')],'outboundCongestionCallsDay':_0x1519a3[_0x26ae('0x67')],'outboundDropCallsDayACS':_0x1519a3[_0x26ae('0x68')],'outboundDropCallsDayCallersExit':_0x1519a3[_0x26ae('0x69')],'outboundDropCallsDayTimeout':_0x1519a3[_0x26ae('0x6a')],'outboundNoAnswerCallsDay':_0x1519a3['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1519a3['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1519a3[_0x26ae('0x6b')],'outboundReCallsDay':_0x1519a3[_0x26ae('0x6c')],'outboundRejectCallsDay':_0x1519a3[_0x26ae('0x6d')],'outboundUnknownCallsDay':_0x1519a3['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x1519a3[_0x26ae('0x6e')],'predictiveIntervalAvgHoldtime':_0x1519a3['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1519a3[_0x26ae('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x1519a3[_0x26ae('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x1519a3['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1519a3['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1519a3[_0x26ae('0x71')],'predictiveIntervalHitRate':_0x1519a3['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x1519a3[_0x26ae('0x72')],'predictiveIntervalPauses':_0x1519a3[_0x26ae('0x73')],'predictiveIntervalAvailable':_0x1519a3[_0x26ae('0x74')],'predictiveIntervalTotalCalls':_0x1519a3[_0x26ae('0x75')],'message':_0x1519a3[_0x26ae('0x46')],'originated':_0x1519a3[_0x26ae('0x76')],'erlangCalls':_0x1519a3[_0x26ae('0x77')],'erlangCallToSecond':_0x1519a3[_0x26ae('0x78')],'erlangAbandonmentRate':_0x1519a3[_0x26ae('0x79')],'erlangBusyFactor':_0x1519a3[_0x26ae('0x7a')],'startPredictive':_0x1519a3[_0x26ae('0x7b')],'startProgressive':_0x1519a3['startProgressive']};if(_0x1519a3[_0x26ae('0x7c')]){_0x249edf[_0x26ae('0x7c')]={'id':_0x1519a3[_0x26ae('0x7c')]['id'],'name':_0x1519a3[_0x26ae('0x7c')][_0x26ae('0x48')],'active':_0x1519a3[_0x26ae('0x7c')][_0x26ae('0x7d')],'callerid':_0x1519a3[_0x26ae('0x7c')][_0x26ae('0x7e')]};}if(_0x1519a3[_0x26ae('0x4d')]){_0x249edf[_0x26ae('0x4d')]={'id':_0x1519a3[_0x26ae('0x4d')]['id'],'name':_0x1519a3[_0x26ae('0x4d')]['name']};}var _0x1b075d=md5(JSON['stringify'](_0x249edf));if(_0x1519a3[_0x26ae('0x5')]!==_0x1b075d){_0x1519a3[_0x26ae('0x5')]=_0x1b075d;emit(util[_0x26ae('0x7f')](_0x26ae('0x80'),_0x249edf[_0x26ae('0x48')]),_0x26ae('0x81'),_0x249edf);}}}function emitCampaignSummary(_0x58bbc8){if(_0x58bbc8[_0x26ae('0x54')]==='ivr'){emit(util[_0x26ae('0x7f')]('campaign:ivr:%s',_0x58bbc8[_0x26ae('0x48')]),_0x26ae('0x82'),_0x58bbc8);}}function checkGetDataPredictive(_0x502d63){if(isNotNull(_0x502d63)&&!_[_0x26ae('0x4f')](_0x502d63)){loggerPredictive[_0x26ae('0x83')](_0x26ae('0x84'));loggerPredictive[_0x26ae('0x83')](_0x26ae('0x85'),_0x502d63['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x26ae('0x86'),_0x502d63[_0x26ae('0x6e')]);loggerPredictive['info'](_0x26ae('0x87'),_0x502d63[_0x26ae('0x88')]);loggerPredictive[_0x26ae('0x83')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x502d63[_0x26ae('0x70')]);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x89'),_0x502d63[_0x26ae('0x8a')]);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8b'),_0x502d63[_0x26ae('0x6f')]);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8c'));if(_0x502d63[_0x26ae('0x75')]>0x0){if(!_[_0x26ae('0x45')](_0x502d63[_0x26ae('0x6f')])&&_0x502d63[_0x26ae('0x6f')]>0x0){return!![];}loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8d'));if(!_[_0x26ae('0x45')](_0x502d63[_0x26ae('0x8a')])&&_0x502d63[_0x26ae('0x8a')]>0x0){return!![];}loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8e'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8f'));}return![];}function mergeDataErlangB(_0x286ac1){return function(_0x593950){loggerPredictive[_0x26ae('0x83')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x26ae('0x83')](_0x26ae('0x90'),_0x593950['erlangCalls']);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x91'),_0x593950[_0x26ae('0x78')]);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x92'),_0x593950[_0x26ae('0x79')]);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x93'),_0x593950[_0x26ae('0x7a')]);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x92'),_0x593950[_0x26ae('0x79')]);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8c'));_[_0x26ae('0x94')](_0x286ac1,_0x593950);};}function getDiff(_0x514140){var _0x10f8a8=moment()['milliseconds'](0x0);var _0x100d7b=moment(_0x514140)['milliseconds'](0x0);return _0x10f8a8[_0x26ae('0x95')](_0x100d7b,_0x26ae('0x96'));}function ifInterval(_0x3e23e9,_0x1327bc){if(_[_0x26ae('0x45')](_0x1327bc)){return![];}return getDiff(_0x1327bc)<_0x3e23e9*0x3c;}function freeVariablesPredictive(_0x5695b4){if(isNotNull(_0x5695b4)){if(!_['isUndefined'](_0x5695b4[_0x26ae('0x2f')])){_0x5695b4[_0x26ae('0x2f')]=undefined;loggerPredictive[_0x26ae('0x83')](_0x5695b4['name'],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x5695b4['startPredictive'])){_0x5695b4['startPredictive']=undefined;loggerPredictive[_0x26ae('0x83')](_0x5695b4['name'],_0x26ae('0x97'));}if(!_[_0x26ae('0x45')](_0x5695b4['handlePredictive'])){clearInterval(_0x5695b4[_0x26ae('0x98')]);_0x5695b4[_0x26ae('0x98')]=undefined;loggerPredictive['info'](_0x5695b4[_0x26ae('0x48')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x3f071f,_0x27e66f){if(_0x27e66f===0x0){return 0x0;}var _0xea38b5=0x1;for(var _0x3990c3=0x1;_0x3990c3<=_0x27e66f;_0x3990c3+=0x1){_0xea38b5=0x1+_0xea38b5*_0x3990c3/_0x3f071f;}return 0x1/_0xea38b5;}function isVoiceQueueOutbound(_0x475376){return _0x475376===_0x26ae('0x99');}function isNotPreview(_0x2dea1f){return _0x2dea1f!==_0x26ae('0x25');}function isCampaignIvr(_0xc63d1d){return _0xc63d1d==='ivr';}function getCallerId(_0x5a2828,_0x23dca1,_0x1f738b){if(!_[_0x26ae('0x45')](_0x1f738b)&&typeof _0x1f738b===_0x26ae('0x9a')&&!_[_0x26ae('0x4f')](_0x1f738b)){if(!_[_0x26ae('0x45')](_0x23dca1)&&typeof _0x23dca1===_0x26ae('0x9a')&&!_[_0x26ae('0x4f')](_0x23dca1)){return util[_0x26ae('0x7f')](_0x26ae('0x9b'),_0x23dca1,_0x1f738b);}return util[_0x26ae('0x7f')]('\x22%s\x22\x20<%s>',_0x1f738b,_0x1f738b);}if(!_['isUndefined'](_0x5a2828)&&typeof _0x5a2828==='string'&&!_[_0x26ae('0x4f')](_0x5a2828)){return _0x5a2828;}return _0x26ae('0x9c');}function loggerCatchQueueSummary(_0x4bec54,_0x5ab688){return function(_0x521d2b){freeVariablesPredictive(_0x5ab688);emitVoiceQueueSummary(_0x5ab688);emitCampaignSummary(_0x5ab688);loggerSyncQueueSummary['debug'](_0x4bec54,util[_0x26ae('0x9d')](_0x521d2b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1e49ed,_0x5ae6b2){return function(_0x4ec8e7){loggerPredictive[_0x26ae('0x9e')](_0x5ae6b2[_0x26ae('0x48')],_0x1e49ed);loggerPredictive[_0x26ae('0x9e')](_0x4ec8e7[_0x26ae('0x9f')]);freeVariablesPredictive(_0x5ae6b2);};}function loggerCatch(_0x272e16){return function(_0x2c002b){logger[_0x26ae('0x9e')](_0x272e16,util['inspect'](_0x2c002b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2c2c32){return _0x2c2c32&&!_[_0x26ae('0x45')](_0x2c2c32)&&_0x2c2c32['length']>0x0;}function decremetOriginate(_0x39ccaf){if(!_[_0x26ae('0x45')](_0x39ccaf)&&_0x39ccaf!==null){if(typeof _0x39ccaf[_0x26ae('0x76')]!==_0x26ae('0xa0')){if(_0x39ccaf[_0x26ae('0x76')]>0x0){_0x39ccaf['originated']-=0x1;}else{logger[_0x26ae('0x9e')](_0x26ae('0xa1'));}}}else{logger[_0x26ae('0x9e')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x1c013b,_0x4fbf27,_0x2fde0b){if(_0x4fbf27>_0x2fde0b){for(var _0x2be899=0x0;_0x2be899<_0x4fbf27-_0x2fde0b;_0x2be899+=0x1){decremetOriginate(_0x1c013b);}}}function loggerGetContactDialer(_0x52f697,_0x888fdf,_0x3575cf){return function(_0x1a615c){checkContactLowerLimitOriginate(_0x888fdf,_0x3575cf,0x0);logger[_0x26ae('0x9e')](_0x52f697,util[_0x26ae('0x9d')](_0x1a615c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x46bdf9){return function(_0x51085c){if(isNotNull(_0x51085c)&&isNotNull(_0x51085c[0x0])){if(_0x51085c[0x0][_0x26ae('0xa2')]>0x0){_0x46bdf9[_0x26ae('0x46')]=_0x26ae('0xa3');logger[_0x26ae('0x83')](_0x26ae('0xa4')+_0x46bdf9[_0x26ae('0x48')],_0x51085c[0x0][_0x26ae('0xa2')],_0x26ae('0xa5'));}else{_0x46bdf9[_0x26ae('0x46')]=_0x26ae('0xa6');logger['info'](_0x26ae('0xa7')+_0x46bdf9[_0x26ae('0x48')]);}}};}function notSendMessagesQueue(_0x561832){if(_0x561832[_0x26ae('0xa8')]){freeVariablesPredictive(_0x561832);if(_0x561832[_0x26ae('0x76')]===0x0&&_0x561832['talking']===0x0&&_0x561832['waiting']===0x0&&(_0x561832[_0x26ae('0x59')]||0x0)===0x0){_0x561832[_0x26ae('0xa8')]=![];_0x561832['available']=0x0;_0x561832[_0x26ae('0x46')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x26ae('0xa9')](_0x26ae('0xaa'),_0x561832[_0x26ae('0x48')],_0x26ae('0xab'));}else{_0x561832['message']=_0x26ae('0xac');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x561832[_0x26ae('0x48')],_0x26ae('0xad'));}emitVoiceQueueSummary(_0x561832);}}function notSendMessagesCampaign(_0x203224){if(_0x203224[_0x26ae('0xa8')]){if(_0x203224[_0x26ae('0x76')]===0x0){_0x203224['sendMessageOneNotActive']=![];_0x203224[_0x26ae('0x46')]=_0x26ae('0xae');loggerSyncQueueSummary[_0x26ae('0xa9')](_0x26ae('0xaf'),_0x203224[_0x26ae('0x48')],_0x26ae('0xab'));}else{_0x203224[_0x26ae('0x46')]=_0x26ae('0xac');loggerSyncQueueSummary[_0x26ae('0xa9')](_0x26ae('0xaf'),_0x203224[_0x26ae('0x48')],'is\x20disactive');}emitCampaignSummary(_0x203224);}}function createObjHistory(_0x3bf350,_0x253e4f,_0x14bd57,_0x5e9a78,_0x1fdbff){_0x3bf350[_0x26ae('0x46')]=_0x14bd57;var _0x252e1d=new Action(_0x3bf350,_0x253e4f);var _0x558280=new History(_0x252e1d);_0x558280[_0x26ae('0xb0')]=_0x5e9a78;_0x558280[_0x26ae('0xb1')]=_0x1fdbff;_0x558280[_0x26ae('0xb2')]=_0x252e1d[_0x26ae('0xb3')];return _0x558280;}Dialer['prototype'][_0x26ae('0x41')]=function(){var _0x231c6c=this;setInterval(function(){_0x231c6c['clearZombieChannels'](_0x231c6c[_0x26ae('0x2e')],'[uniqueid]');_0x231c6c['clearZombieChannels'](_0x231c6c['actions'],_0x26ae('0xb4'));},0x32c8);};Dialer[_0x26ae('0xb5')][_0x26ae('0xb6')]=function(_0x4c7a93,_0x20cf0e){var _0x1e60e0=this;for(var _0x35caa9 in _0x4c7a93){if(typeof _0x4c7a93[_0x35caa9]!==_0x26ae('0xa0')){this[_0x26ae('0x24')][_0x26ae('0x21')](function(){if(!_['isNil'](_0x4c7a93[_0x35caa9])){return ami[_0x26ae('0xb7')]({'action':'status','channel':_0x4c7a93[_0x35caa9][_0x26ae('0xb8')]})[_0x26ae('0xb9')](function(_0x4f0016){if(_0x4f0016['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x4c7a93[_0x35caa9]&&_0x4c7a93[_0x35caa9][_0x26ae('0x54')]!=='ivr'){_0x1e60e0['updateOriginated'](_0x1e60e0[_0x26ae('0x26')][_0x4c7a93[_0x35caa9]['queue']]);logger[_0x26ae('0x9e')](_0x26ae('0xba'),_0x20cf0e,_0x35caa9,_0x4c7a93[_0x35caa9][_0x26ae('0xbb')]);delete _0x4c7a93[_0x35caa9];}if(_0x4c7a93[_0x35caa9]&&_0x4c7a93[_0x35caa9][_0x26ae('0x54')]===_0x26ae('0xbc')){_0x1e60e0['updateOriginated'](_0x1e60e0[_0x26ae('0x27')][_0x4c7a93[_0x35caa9][_0x26ae('0xbb')]]);logger[_0x26ae('0x9e')]('[Dialer][checkChannel][ivr]',_0x20cf0e,_0x35caa9,_0x4c7a93[_0x35caa9]['queue']);delete _0x4c7a93[_0x35caa9];}},0x2328);}});}});}}};Dialer[_0x26ae('0xb5')][_0x26ae('0xbd')]=function(_0x4439ae){return BPromise[_0x26ae('0xbe')]()['then'](cmHopper[_0x26ae('0xbd')](_0x4439ae))[_0x26ae('0xb9')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x26ae('0xbf')]=function(_0x29473f){return BPromise['resolve']()['then'](cmHopperBlack[_0x26ae('0xbf')](_0x29473f))[_0x26ae('0xb9')](loggerCatch(_0x26ae('0xc0')));};Dialer[_0x26ae('0xb5')][_0x26ae('0xc1')]=function(_0xa47473,_0x142144,_0x22e639){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xa47473,_0x142144,_0x22e639))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x26ae('0xb5')]['swapAdditionalPhones']=function(_0x58ae1a,_0x440f08,_0x35147d){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopperAdditionalPhone[_0x26ae('0xc2')](_0x58ae1a,_0x440f08,_0x35147d))[_0x26ae('0xb9')](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer[_0x26ae('0xb5')][_0x26ae('0xc3')]=function(_0x1dc80f){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopperBlack[_0x26ae('0xc3')](_0x1dc80f))[_0x26ae('0xb9')](loggerCatch(_0x26ae('0xc4')));};Dialer[_0x26ae('0xb5')][_0x26ae('0xc5')]=function(_0x12f921){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopperHistory[_0x26ae('0xc6')](_0x12f921))[_0x26ae('0xb9')](loggerCatch(_0x26ae('0xc7')));};Dialer[_0x26ae('0xb5')][_0x26ae('0xc8')]=function(_0x27a880){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopper['rescheduleContact'](_0x27a880))[_0x26ae('0xb9')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x26ae('0xb5')][_0x26ae('0xc9')]=function(_0x427a14,_0x1e0b0b,_0x49c6e3){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopper[_0x26ae('0xc9')](_0x427a14,_0x1e0b0b,_0x49c6e3))[_0x26ae('0xb9')](loggerCatch(_0x26ae('0xca')));};Dialer[_0x26ae('0xb5')][_0x26ae('0xcb')]=function(_0x1f9210,_0x5bffdd,_0x373337,_0x335645,_0x14f336){return BPromise[_0x26ae('0xbe')]()['then'](cmHopper[_0x26ae('0xcb')](_0x1f9210,_0x5bffdd,_0x373337,_0x335645))[_0x26ae('0xb9')](function(_0x317dae){_0x14f336[_0x26ae('0xcc')]-=_0x373337;_0x14f336[_0x26ae('0xcc')]=_0x14f336[_0x26ae('0xcc')]>0x0?_0x14f336['temp']:0x0;loggerCatch(_0x26ae('0xcd'))(_0x317dae);});};Dialer[_0x26ae('0xb5')][_0x26ae('0xce')]=function(_0x1fc10e,_0x4d1214,_0xaa0a99,_0x3dd409){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopper[_0x26ae('0xce')](_0x1fc10e,_0x4d1214,_0xaa0a99))[_0x26ae('0xb9')](function(_0x2e7b00){_0x3dd409[_0x26ae('0xcc')]-=_0x4d1214;_0x3dd409[_0x26ae('0xcc')]=_0x3dd409[_0x26ae('0xcc')]>0x0?_0x3dd409['temp']:0x0;loggerCatch(_0x26ae('0xcf'))(_0x2e7b00);});};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x16a7f7){return BPromise['resolve']()['then'](voiceQueueRt[_0x26ae('0xd0')](_0x16a7f7))[_0x26ae('0xb9')](loggerCatch(_0x26ae('0xd1')));};Dialer[_0x26ae('0xb5')]['moveContactManagedDialer']=function(_0x4fa7a0){return BPromise[_0x26ae('0xbe')]()['then'](cmHopper['moveContactManagedDialer'](_0x4fa7a0))[_0x26ae('0xb9')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x26ae('0xd2')]=function(_0x271435){return BPromise['resolve']()['then'](cmHopperHistory[_0x26ae('0xd2')](_0x271435))[_0x26ae('0xb9')](loggerCatch(_0x26ae('0xd3')));};Dialer[_0x26ae('0xb5')][_0x26ae('0xd4')]=function(_0x3494c9){if(!_['isUndefined'](_0x3494c9)&&_0x3494c9!==null){if(typeof _0x3494c9[_0x26ae('0x76')]!==_0x26ae('0xa0')){if(_0x3494c9[_0x26ae('0x76')]>0x0){_0x3494c9[_0x26ae('0x76')]-=0x1;}else{logger[_0x26ae('0x9e')](_0x26ae('0xd5'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x26ae('0xd6')]=function(_0x4016d3,_0x475084){var _0xe320c0=this;return function(_0xe17aad){_0xe320c0[_0x26ae('0xd4')](_0x475084);logger['error'](_0x4016d3,util[_0x26ae('0x9d')](_0xe17aad,{'showHidden':![],'depth':null}));};};Dialer[_0x26ae('0xb5')][_0x26ae('0xd7')]=function(_0xc711f2,_0x1475a5,_0x58b24a){var _0x56508f={'state':0x19,'statedesc':'notFound'};this[_0x26ae('0xd4')](_0x1475a5);this[_0x26ae('0xd8')](_[_0x26ae('0x94')](_0x56508f,_['pick'](_0x58b24a,[_0x26ae('0xd9'),_0x26ae('0xda'),_0x26ae('0xdb'),'VoiceQueueId',_0x26ae('0xdc')])),_0x26ae('0xdd'),_0x26ae('0xde'));logger[_0x26ae('0x9e')](_0xc711f2);};Dialer[_0x26ae('0xb5')][_0x26ae('0xdf')]=function(_0x31e20e){return _0x31e20e===_0x26ae('0xe0');};Dialer[_0x26ae('0xb5')][_0x26ae('0xe1')]=function(_0x559827){return!_['isUndefined'](_0x559827)&&_0x559827&&!_[_0x26ae('0x45')](_0x559827['name'])&&!_[_0x26ae('0x45')](_0x559827[_0x26ae('0x7d')])&&_0x559827[_0x26ae('0x7d')]&&(this[_0x26ae('0x29')][util['format'](_0x26ae('0xe2'),_0x559827[_0x26ae('0x48')])][_0x26ae('0xe3')]==='reachable'||this[_0x26ae('0x29')][util['format'](_0x26ae('0xe2'),_0x559827[_0x26ae('0x48')])][_0x26ae('0xe3')]==='unmonitored');};Dialer[_0x26ae('0xb5')]['saveInDb']=function(_0x5a6cd9,_0x501a95,_0x1eb6a3){this['createHistory'](_0x5a6cd9)['catch'](loggerCatch(_0x501a95));this['moveContactManagedDialer'](_0x5a6cd9)[_0x26ae('0xb9')](loggerCatch(_0x1eb6a3));};Dialer[_0x26ae('0xb5')][_0x26ae('0x3d')]=function(_0x315738){var _0x52316e=this['uniqueId'][_0x315738[_0x26ae('0xe4')]];var _0x4259dd;if(!_[_0x26ae('0xe5')](_0x315738)&&!_['isNil'](_0x315738[_0x26ae('0xe6')])&&!_['isNil'](_0x315738[_0x26ae('0xe6')][_0x26ae('0xe7')])&&_0x315738[_0x26ae('0xe8')]===_0x26ae('0xe9')&&_0x52316e){if(_0x52316e['type']!=='ivr'&&this[_0x26ae('0x26')][_0x52316e['queue']]['dialAMDActive']&&_0x315738['value']===_0x26ae('0xea')){delete this[_0x26ae('0x2e')][_0x315738[_0x26ae('0xe4')]];this[_0x26ae('0xd4')](this[_0x26ae('0x26')][_0x52316e[_0x26ae('0xbb')]]);this['voiceQueues'][_0x52316e[_0x26ae('0xbb')]]['outboundAnswerCallsDay']+=0x1;this[_0x26ae('0x26')][_0x52316e[_0x26ae('0xbb')]][_0x26ae('0xeb')]+=0x1;_0x4259dd=new Hangup(_0x52316e,_0x315738);_0x4259dd['state']=0x12;_0x4259dd[_0x26ae('0xb1')]=_0x26ae('0xec');_0x4259dd[_0x26ae('0xed')]=_0x26ae('0xee');ami[_0x26ae('0x53')](_0x26ae('0xef'),ut[_0x26ae('0xf0')](_0x4259dd,_0x26ae('0xf1')));this[_0x26ae('0xd8')](_0x4259dd,_0x26ae('0xf2'),_0x26ae('0xf3'));}if(_0x52316e[_0x26ae('0x54')]!==_0x26ae('0xbc')&&this[_0x26ae('0x26')][_0x52316e['queue']]['dialAMDActive']&&_0x315738['value']==='MACHINE'){var _0x2089e0=this;return new BPromise(function(_0x3fd192,_0x555160){delete _0x2089e0['uniqueId'][_0x315738['uniqueid']];_0x2089e0[_0x26ae('0xd4')](_0x2089e0[_0x26ae('0x26')][_0x52316e[_0x26ae('0xbb')]]);_0x2089e0[_0x26ae('0x26')][_0x52316e[_0x26ae('0xbb')]][_0x26ae('0xf4')]+=0x1;_0x2089e0[_0x26ae('0x26')][_0x52316e['queue']][_0x26ae('0xeb')]+=0x1;var _0x47e02a=_0x2089e0[_0x26ae('0x26')][_0x52316e['queue']];var _0x4861a6=new Hangup(_0x52316e,_0x315738);_0x4861a6[_0x26ae('0xb0')]=0x13;_0x4861a6[_0x26ae('0xb1')]=_0x26ae('0xf5');_0x4861a6[_0x26ae('0xed')]=_0x26ae('0xee');_0x4861a6['countmachineretry']+=0x1;_0x4861a6[_0x26ae('0xf6')]+=0x1;_0x4861a6[_0x26ae('0xf1')]=!![];ami['emit'](_0x26ae('0xef'),ut['buildObj'](_0x4861a6,'amd'));_0x2089e0[_0x26ae('0xd2')](_0x4861a6)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0xf7')));if(_0x4861a6[_0x26ae('0xf8')]+_0x4861a6[_0x26ae('0xf9')]+_0x4861a6[_0x26ae('0xfa')]+_0x4861a6['countnosuchnumberretry']+_0x4861a6[_0x26ae('0xfb')]+_0x4861a6[_0x26ae('0xfc')]+_0x4861a6[_0x26ae('0xfd')]+_0x4861a6[_0x26ae('0xfe')]>=_0x47e02a[_0x26ae('0xff')]){_0x2089e0[_0x26ae('0x100')](_0x4861a6,_0x3fd192,_0x555160,_0x26ae('0x101'));}else{if(_0x4861a6[_0x26ae('0xfd')]>=_0x47e02a[_0x26ae('0x102')]){_0x2089e0['createStateFinal'](_0x4861a6,_0x3fd192,_0x555160,_0x26ae('0x103'));}else{_0x2089e0[_0x26ae('0xc8')]({'active':![],'countmachineretry':_0x4861a6[_0x26ae('0xfd')],'scheduledat':moment()[_0x26ae('0x104')](_0x47e02a[_0x26ae('0x105')],_0x26ae('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4861a6[_0x26ae('0xd9')],'ListId':_0x4861a6['ListId'],'VoiceQueueId':_0x4861a6['VoiceQueueId']||undefined,'CampaignId':_0x4861a6['CampaignId']||undefined})['catch'](loggerCatch(_0x26ae('0x107')));_0x3fd192({'reschedule':0x1});}}});}if(_0x52316e[_0x26ae('0x54')]==='ivr'&&this[_0x26ae('0x27')][_0x52316e[_0x26ae('0xbb')]][_0x26ae('0x108')]&&_0x315738[_0x26ae('0x109')]===_0x26ae('0xea')){delete this[_0x26ae('0x2e')][_0x315738['uniqueid']];this[_0x26ae('0xd4')](this[_0x26ae('0x27')][_0x52316e[_0x26ae('0xbb')]]);_0x4259dd=new Hangup(_0x52316e,_0x315738);_0x4259dd[_0x26ae('0xb0')]=0x12;_0x4259dd[_0x26ae('0xb1')]=_0x26ae('0xec');_0x4259dd[_0x26ae('0xed')]=_0x26ae('0xee');ami[_0x26ae('0x53')](_0x26ae('0xef'),ut[_0x26ae('0xf0')](_0x4259dd,_0x26ae('0xf1')));this[_0x26ae('0xd8')](_0x4259dd,_0x26ae('0x10a'),_0x26ae('0x10b'));}if(_0x52316e[_0x26ae('0x54')]===_0x26ae('0xbc')&&this['campaigns'][_0x52316e['queue']][_0x26ae('0x108')]&&_0x315738[_0x26ae('0x109')]===_0x26ae('0x10c')){var _0x2089e0=this;return new BPromise(function(_0x569f48,_0x4d9ae7){delete _0x2089e0['uniqueId'][_0x315738['uniqueid']];_0x2089e0[_0x26ae('0xd4')](_0x2089e0[_0x26ae('0x27')][_0x52316e[_0x26ae('0xbb')]]);_0x2089e0['campaigns'][_0x52316e['queue']]['outboundAnswerCallsDay']+=0x1;_0x2089e0[_0x26ae('0x27')][_0x52316e['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x28019d=_0x2089e0[_0x26ae('0x27')][_0x52316e[_0x26ae('0xbb')]];var _0x39f791=new Hangup(_0x52316e,_0x315738);_0x39f791['state']=0x13;_0x39f791[_0x26ae('0xb1')]=_0x26ae('0xf5');_0x39f791[_0x26ae('0xed')]=_0x26ae('0xee');_0x39f791[_0x26ae('0xfd')]+=0x1;_0x39f791['countglobal']+=0x1;_0x39f791[_0x26ae('0xf1')]=!![];ami[_0x26ae('0x53')](_0x26ae('0xef'),ut[_0x26ae('0xf0')](_0x39f791,_0x26ae('0xf1')));_0x2089e0[_0x26ae('0xd2')](_0x39f791)[_0x26ae('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x39f791[_0x26ae('0xf8')]+_0x39f791['countcongestionretry']+_0x39f791['countnoanswerretry']+_0x39f791[_0x26ae('0x10d')]+_0x39f791[_0x26ae('0xfb')]+_0x39f791[_0x26ae('0xfc')]+_0x39f791[_0x26ae('0xfd')]+_0x39f791[_0x26ae('0xfe')]>=_0x28019d[_0x26ae('0xff')]){_0x2089e0['stateGlobal'](_0x39f791,_0x569f48,_0x4d9ae7,'reason19\x20machine....');}else{if(_0x39f791[_0x26ae('0xfd')]>=_0x28019d[_0x26ae('0x102')]){_0x2089e0[_0x26ae('0x10e')](_0x39f791,_0x569f48,_0x4d9ae7,_0x26ae('0x103'));}else{_0x2089e0[_0x26ae('0xc8')]({'active':![],'countmachineretry':_0x39f791[_0x26ae('0xfd')],'scheduledat':moment()[_0x26ae('0x104')](_0x28019d['dialMachineRetryFrequency'],'minutes')['format'](_0x26ae('0x10f')),'ContactId':_0x39f791['ContactId'],'ListId':_0x39f791[_0x26ae('0xda')],'VoiceQueueId':_0x39f791[_0x26ae('0x110')]||undefined,'CampaignId':_0x39f791[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x107')));_0x569f48({'reschedule':0x1});}}});}}};Dialer[_0x26ae('0xb5')][_0x26ae('0x3b')]=function(_0x3f6b4c){var _0x87369d=this[_0x26ae('0x2e')][_0x3f6b4c[_0x26ae('0xe4')]];var _0x313495=this;var _0x4d5a1f;if(_0x87369d&&_0x87369d[_0x26ae('0x54')]==='ivr'){delete this[_0x26ae('0x2e')][_0x3f6b4c[_0x26ae('0xe4')]];this[_0x26ae('0xd4')](this[_0x26ae('0x27')][_0x87369d[_0x26ae('0xbb')]]);this[_0x26ae('0x27')][_0x87369d[_0x26ae('0xbb')]]['ivrAnswerCallsDay']+=0x1;_0x4d5a1f=new Hangup(_0x87369d,_0x3f6b4c);this[_0x26ae('0xd2')](_0x4d5a1f)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x111')));this[_0x26ae('0x112')](_0x4d5a1f)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x113')));}if(_0x87369d&&_0x87369d[_0x26ae('0x54')]!==_0x26ae('0xbc')&&isNotNull(this['voiceQueues'][_0x87369d['queue']]['dialQueueProject'])){delete this[_0x26ae('0x2e')][_0x3f6b4c['uniqueid']];this[_0x26ae('0xd4')](this['voiceQueues'][_0x87369d['queue']]);this[_0x26ae('0x26')][_0x87369d[_0x26ae('0xbb')]]['outboundAnswerCallsDay']+=0x1;this[_0x26ae('0x26')][_0x87369d[_0x26ae('0xbb')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4d5a1f=new Hangup(_0x87369d,_0x3f6b4c);_0x4d5a1f[_0x26ae('0xb0')]=0x10;_0x4d5a1f[_0x26ae('0xb1')]=_0x26ae('0x114');_0x4d5a1f[_0x26ae('0xed')]=_0x26ae('0x115');this[_0x26ae('0xd2')](_0x4d5a1f)[_0x26ae('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x26ae('0x112')](_0x4d5a1f)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x113')));}if(_0x87369d&&_0x87369d['type']!==_0x26ae('0xbc')&&!isNotNull(this[_0x26ae('0x26')][_0x87369d[_0x26ae('0xbb')]][_0x26ae('0x116')])){delete this[_0x26ae('0x2e')][_0x3f6b4c[_0x26ae('0xe4')]];this[_0x26ae('0xd4')](this[_0x26ae('0x26')][_0x87369d[_0x26ae('0xbb')]]);this[_0x26ae('0x26')][_0x87369d[_0x26ae('0xbb')]][_0x26ae('0x117')]+=0x1;_0x4d5a1f=new Hangup(_0x87369d,_0x3f6b4c);_0x4d5a1f['state']=0xc;_0x4d5a1f[_0x26ae('0xb1')]=_0x3f6b4c[_0x26ae('0x118')];_0x4d5a1f['membername']='Unknow';this[_0x26ae('0xd2')](_0x4d5a1f)[_0x26ae('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x26ae('0x112')](_0x4d5a1f)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x113')));}};Dialer[_0x26ae('0xb5')]['syncAgentComplete']=function(_0x566718){var _0x5372a7=this[_0x26ae('0x2e')][_0x566718[_0x26ae('0xe4')]];var _0x2c5953=this;if(this[_0x26ae('0x26')][_0x566718[_0x26ae('0xbb')]]){if(_0x5372a7&&_0x5372a7[_0x26ae('0x54')]!==_0x26ae('0xbc')){delete this[_0x26ae('0x2e')][_0x566718['uniqueid']];this[_0x26ae('0x26')][_0x566718[_0x26ae('0xbb')]][_0x26ae('0xf4')]+=0x1;var _0x9fb215=new AgentComplete(_0x5372a7,_0x566718);if(_0x566718[_0x26ae('0x119')]===_0x26ae('0x11a')){_0x9fb215['agiafterat']=this[_0x26ae('0x26')][_0x566718[_0x26ae('0xbb')]]['dialQueueProject2']&&this[_0x26ae('0x26')][_0x566718[_0x26ae('0xbb')]][_0x26ae('0x11b')]?moment()[_0x26ae('0x7f')](_0x26ae('0x10f')):undefined;}this[_0x26ae('0xd2')](_0x9fb215)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x11c')));this['moveContactManagedDialer'](_0x9fb215)['catch'](loggerCatch(_0x26ae('0x11d')));}}};Dialer[_0x26ae('0xb5')]['syncAgentConnect']=function(_0x2e45e9){if(this[_0x26ae('0x26')][_0x2e45e9['queue']]){if(this[_0x26ae('0x2e')][_0x2e45e9['uniqueid']]&&this[_0x26ae('0x2e')][_0x2e45e9['uniqueid']][_0x26ae('0x54')]!==_0x26ae('0xbc')){this[_0x26ae('0xd4')](this['voiceQueues'][_0x2e45e9[_0x26ae('0xbb')]]);this[_0x26ae('0x2e')][_0x2e45e9[_0x26ae('0xe4')]][_0x26ae('0x11e')]=moment()[_0x26ae('0x7f')](_0x26ae('0x10f'));}}};Dialer[_0x26ae('0xb5')]['queueCallerAbandonCreateState']=function(_0x321cbe,_0x42a328){this[_0x26ae('0xd2')](_0x321cbe)[_0x26ae('0xb9')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x42a328==0x0){this[_0x26ae('0x112')](_0x321cbe)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x11f')));}};Dialer[_0x26ae('0xb5')][_0x26ae('0x120')]=function(_0x12954c){var _0x1c4e14=this[_0x26ae('0x2e')][_0x12954c[_0x26ae('0xe4')]];var _0x49359d=this;var _0xcf532f=![];var _0x4eb60a;var _0x23349e;if(this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]]){if(_0x1c4e14&&_0x1c4e14[_0x26ae('0x54')]!=='ivr'){delete this[_0x26ae('0x2e')][_0x12954c[_0x26ae('0xe4')]];this[_0x26ae('0xd4')](this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]]);_0x1c4e14[_0x26ae('0x121')]=moment()['format'](_0x26ae('0x10f'));var _0x4beec1=new QueueCallerAbandon(_0x1c4e14,_0x12954c);if(getSeconds(_0x1c4e14[_0x26ae('0x121')],_0x1c4e14[_0x26ae('0x122')])>=_0x1c4e14[_0x26ae('0x123')]){this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x88')]+=0x1;this['voiceQueues'][_0x12954c[_0x26ae('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x71')]+=0x1;_0x4beec1[_0x26ae('0xb0')]=0xa;_0x4beec1[_0x26ae('0xb1')]=_0x26ae('0x124');_0x4beec1[_0x26ae('0x125')]=_0x26ae('0x126');_0x4beec1['agiafterat']=this['voiceQueues'][_0x12954c['queue']][_0x26ae('0x127')]?moment()[_0x26ae('0x7f')](_0x26ae('0x10f')):undefined;_0x4beec1[_0x26ae('0xfb')]+=0x1;_0x4beec1[_0x26ae('0xf6')]+=0x1;_0x4eb60a=this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x128')];_0x23349e=this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x129')];_0x49359d[_0x26ae('0xc1')](_0x4beec1,_0x4beec1['state'],_0x1c4e14[_0x26ae('0x12a')])[_0x26ae('0x43')](function(_0x3de7d1){_0xcf532f=_0x3de7d1['additional']==0x1;if(_0x4beec1[_0x26ae('0xfb')]>=_0x49359d['voiceQueues'][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x12b')]){_0x49359d[_0x26ae('0x12c')](_0x4beec1,_0x3de7d1[_0x26ae('0x12d')]);}else{_0x49359d[_0x26ae('0xc8')]({'active':![],'countdropretry':_0x4beec1[_0x26ae('0xfb')],'scheduledat':moment()[_0x26ae('0x104')](_0x49359d['voiceQueues'][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x128')],_0x26ae('0x106'))[_0x26ae('0x7f')](_0x26ae('0x10f')),'ContactId':_0x1c4e14['ContactId'],'ListId':_0x1c4e14[_0x26ae('0xda')],'VoiceQueueId':_0x1c4e14[_0x26ae('0x110')]||undefined,'CampaignId':_0x1c4e14[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x12e')));var _0x3d7415=new History(_0x4beec1);_0x3d7415['state']=0xa;_0x3d7415['statedesc']=_0x26ae('0x124');_0x3d7415[_0x26ae('0xb3')]=moment()['format'](_0x26ae('0x10f'));_0x3d7415[_0x26ae('0xb2')]=_0x3d7415['starttime'];_0x3d7415[_0x26ae('0x12f')]=_0x4beec1['calleridname'];_0x3d7415[_0x26ae('0x130')]=_0x4beec1[_0x26ae('0x130')];_0x49359d['createHistory'](_0x3d7415)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x131')));}})[_0x26ae('0x43')](function(_0x28356b){if(_0xcf532f)_0x49359d[_0x26ae('0xc2')](_0x4beec1,_0x4eb60a,_0x23349e)[_0x26ae('0x43')](function(_0x3d0317){return 0x1;});});}else{this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x70')]+=0x1;this[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x69')]+=0x1;_0x4beec1[_0x26ae('0xb0')]=0xb;_0x4beec1[_0x26ae('0xb1')]=_0x26ae('0x132');_0x4beec1[_0x26ae('0x125')]='CALLEREXIT';_0x4beec1[_0x26ae('0xfc')]+=0x1;_0x4beec1[_0x26ae('0xf6')]+=0x1;_0x4eb60a=this['voiceQueues'][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x133')];_0x23349e=this['voiceQueues'][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x129')];_0x49359d[_0x26ae('0xc1')](_0x4beec1,_0x4beec1[_0x26ae('0xb0')],_0x1c4e14[_0x26ae('0x12a')])['then'](function(_0x448005){if(_0x4beec1[_0x26ae('0xfc')]>=_0x49359d[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]][_0x26ae('0x134')]){_0x49359d[_0x26ae('0x12c')](_0x4beec1,_0x448005[_0x26ae('0x12d')]);}else{_0x49359d['rescheduleContact']({'active':![],'countabandonedretry':_0x4beec1['countabandonedretry'],'scheduledat':moment()[_0x26ae('0x104')](_0x49359d[_0x26ae('0x26')][_0x12954c[_0x26ae('0xbb')]]['dialAbandonedRetryFrequency'],_0x26ae('0x106'))['format'](_0x26ae('0x10f')),'ContactId':_0x1c4e14[_0x26ae('0xd9')],'ListId':_0x1c4e14['ListId'],'VoiceQueueId':_0x1c4e14['VoiceQueueId']||undefined,'CampaignId':_0x1c4e14[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x485b7b=new History(_0x4beec1);_0x485b7b['state']=0xb;_0x485b7b[_0x26ae('0xb1')]=_0x26ae('0x132');_0x485b7b[_0x26ae('0xb3')]=moment()[_0x26ae('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x485b7b[_0x26ae('0xb2')]=_0x485b7b[_0x26ae('0xb3')];_0x485b7b[_0x26ae('0x12f')]=_0x4beec1['calleridname'];_0x485b7b['calleridnum']=_0x4beec1[_0x26ae('0x130')];_0x49359d[_0x26ae('0xd2')](_0x485b7b)['catch'](loggerCatch(_0x26ae('0x135')));}})[_0x26ae('0x43')](function(_0x3db216){if(_0xcf532f)_0x49359d[_0x26ae('0xc2')](_0x4beec1,_0x4eb60a,_0x23349e)[_0x26ae('0x43')](function(_0x563d63){return 0x1;});});}}}};Dialer[_0x26ae('0xb5')][_0x26ae('0x3c')]=function(_0xcf44){if(this[_0x26ae('0x2c')][_0xcf44[_0x26ae('0xe4')]]){this['actions'][_0xcf44[_0x26ae('0xe4')]][_0x26ae('0xb8')]=_0xcf44[_0x26ae('0xb8')];}if(this[_0x26ae('0x2e')][_0xcf44[_0x26ae('0xe4')]]){this[_0x26ae('0x2e')][_0xcf44[_0x26ae('0xe4')]][_0x26ae('0xb8')]=_0xcf44[_0x26ae('0xb8')];}};Dialer[_0x26ae('0xb5')][_0x26ae('0x3e')]=function(_0x298416){if(strategy[this[_0x26ae('0x26')][this['actions'][_0x298416['actionid']][_0x26ae('0xbb')]][_0x26ae('0x55')]]===_0x26ae('0x20')){if(this[_0x26ae('0x2c')][_0x298416[_0x26ae('0x136')]]&&_[_0x26ae('0xe5')](this['actions'][_0x298416['actionid']]['locked'])&&_0x298416['status']==='1'&&_0x298416[_0x26ae('0x137')]==='0'){if(this['agents'][_0x298416[_0x26ae('0x138')]]){if(!this[_0x26ae('0x28')][_0x298416[_0x26ae('0x138')]][_0x26ae('0x139')]){this[_0x26ae('0x28')][_0x298416[_0x26ae('0x138')]][_0x26ae('0x139')]=!![];this[_0x26ae('0x2c')][_0x298416[_0x26ae('0x136')]][_0x26ae('0x139')]=!![];this['actions'][_0x298416[_0x26ae('0x136')]][_0x26ae('0x138')]=_0x298416['stateinterface'];}}}}else if((strategy[this[_0x26ae('0x26')][this['actions'][_0x298416[_0x26ae('0x136')]][_0x26ae('0xbb')]][_0x26ae('0x55')]]||_0x26ae('0x1f'))===_0x26ae('0x1f')){if(this[_0x26ae('0x2c')][_0x298416[_0x26ae('0x136')]]){if(this[_0x26ae('0x28')][_0x298416[_0x26ae('0x138')]]){this[_0x26ae('0x2c')][_0x298416[_0x26ae('0x136')]][_0x26ae('0x138')]=_0x298416['stateinterface'];if(_[_0x26ae('0xe5')](this[_0x26ae('0x30')][this['actions'][_0x298416[_0x26ae('0x136')]][_0x26ae('0xbb')]])){this['queueBooked'][this[_0x26ae('0x2c')][_0x298416[_0x26ae('0x136')]]['queue']]=[];}this[_0x26ae('0x30')][this['actions'][_0x298416[_0x26ae('0x136')]][_0x26ae('0xbb')]][_0x26ae('0x13a')](_[_0x26ae('0x94')](_[_0x26ae('0x13b')](this['actions'][_0x298416['actionid']],['idHopper',_0x26ae('0x138')]),{'status':_0x298416[_0x26ae('0xe3')],'paused':_0x298416[_0x26ae('0x137')]}));}}}};function unlockQueueStatus(_0x23a328,_0xf3672){setTimeout(function(){if(_[_0x26ae('0x45')](_0x23a328[_0x26ae('0x13c')])){loggerBooked[_0x26ae('0x9e')](_0x26ae('0x13d'),_0xf3672);}_0x23a328[_0x26ae('0x13c')]=!![];loggerBooked[_0x26ae('0x83')](_0x26ae('0x13e'),_0xf3672,JSON[_0x26ae('0x13f')](_[_0x26ae('0x13b')](_0x23a328,['name',_0x26ae('0x13c')])));},0x1f3);}Dialer[_0x26ae('0xb5')][_0x26ae('0x40')]=function(_0x492c17){var _0x120647=this;var _0x54c477=_0x120647[_0x26ae('0x26')][_0x120647[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]];if(strategy[this[_0x26ae('0x26')][this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]][_0x26ae('0x55')]]===_0x26ae('0x20')){if(this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]]&&this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0x138')]){this[_0x26ae('0x25')][_0x26ae('0x140')](this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0x141')],this['actions'][_0x492c17['actionid']][_0x26ae('0x138')])[_0x26ae('0xb9')](function(_0x2910ff){logger[_0x26ae('0x9e')](_0x26ae('0x142'),util[_0x26ae('0x9d')](_0x2910ff,{'showHidden':![],'depth':null}));})[_0x26ae('0x23')](function(){_0x120647[_0x26ae('0xd4')](_0x120647[_0x26ae('0x26')][_0x120647[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]]);_0x120647[_0x26ae('0x28')][_0x120647[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0x138')]]['locked']=![];delete _0x120647[_0x26ae('0x2c')][_0x492c17['actionid']];unlockQueueStatus(_0x54c477);});}else{this[_0x26ae('0xd4')](this['voiceQueues'][this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]]);this[_0x26ae('0xc8')]({'active':![],'ContactId':this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]]['ContactId'],'ListId':this['actions'][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xda')],'VoiceQueueId':this[_0x26ae('0x2c')][_0x492c17['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x143')));delete this['actions'][_0x492c17[_0x26ae('0x136')]];unlockQueueStatus(_0x54c477);}}else if((strategy[this['voiceQueues'][this['actions'][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]]['strategy']]||'rrmemory')===_0x26ae('0x1f')){var _0x1765e9;if(this['actions'][_0x492c17[_0x26ae('0x136')]]&&!_[_0x26ae('0x4f')](this['queueBooked'][this['actions'][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]])){if(this[_0x26ae('0x144')][_0x120647['actions'][_0x492c17['actionid']]['queue']]){this[_0x26ae('0x144')][_0x120647['actions'][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]]=this[_0x26ae('0x144')][this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]]['queue']]?this[_0x26ae('0x144')][this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]]:this[_0x26ae('0x30')][this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]]?this[_0x26ae('0x30')][this[_0x26ae('0x2c')][_0x492c17['actionid']]['queue']][_0x26ae('0x145')]||0x0:0x0;}this[_0x26ae('0x30')][this[_0x26ae('0x2c')][_0x492c17['actionid']][_0x26ae('0xbb')]][_0x26ae('0x145')]=this[_0x26ae('0x144')][this[_0x26ae('0x2c')][_0x492c17[_0x26ae('0x136')]][_0x26ae('0xbb')]];for(var _0x52bd8e=0x0;_0x52bd8e=0x0;})['catch'](myreject(_0x12112d)));}}else{_0x5010ba['push'](ami[_0x26ae('0xb7')]({'action':_0x26ae('0x15f'),'command':util[_0x26ae('0x7f')](_0x26ae('0x160'),_0x4051fb,!_[_0x26ae('0x45')](config['timezones'][_0x38b9f])?_0x38b9f:'')})['then'](function(_0x4be8b9){return _0x4be8b9[_0x26ae('0x162')][_0x26ae('0x163')](_0x26ae('0x164'))>=0x0;})[_0x26ae('0xb9')](myreject(_0x12112d)));}BPromise[_0x26ae('0x165')](_0x5010ba)[_0x26ae('0x43')](function(_0x564ffe){var _0x36282a=_['some'](_0x564ffe);if(_0x36282a){return _0x39a356(_0x36282a);}else{_0x49494c[_0x26ae('0x46')]=_0x39a7a4?_0x26ae('0x166'):_0x26ae('0x167');return _0x12112d(msgResponse(_0x26ae('0x168'),_0x26ae('0x157'),'Global:\x20'+_0x39a7a4+'\x20'+_0x191450+_0x26ae('0x169')+util[_0x26ae('0x9d')](_0x4051fb,{'showHidden':![],'depth':null})+_0x26ae('0x16a')+_0x38b9f));}})[_0x26ae('0xb9')](function(_0x3df1d2){return _0x12112d(msgResponse(_0x26ae('0x155'),_0x26ae('0x157'),JSON[_0x26ae('0x13f')](_0x3df1d2)));});});};Dialer['prototype']['checkDialMethod']=function(_0x2fdabf){var _0x2594c8=this;return function(){switch(_0x2fdabf[_0x26ae('0x61')]){case _0x26ae('0x16b'):freeVariablesPredictive(_0x2fdabf);_0x2594c8[_0x26ae('0x16c')](_0x2fdabf,0x1);break;case _0x26ae('0x16d'):freeVariablesPredictive(_0x2fdabf);_0x2594c8[_0x26ae('0x16c')](_0x2fdabf,_0x2fdabf[_0x26ae('0x16e')]);break;case'predictive':_0x2594c8['predictive'](_0x2fdabf);break;case _0x26ae('0x16f'):freeVariablesPredictive(_0x2fdabf);_0x2594c8[_0x26ae('0x16c')](_0x2fdabf,0x1);break;default:freeVariablesPredictive(_0x2fdabf);logger[_0x26ae('0x9e')](_0x26ae('0x170'),_0x2fdabf[_0x26ae('0x48')],'method\x20not\x20recognized');}};};Dialer[_0x26ae('0xb5')][_0x26ae('0x171')]=function(_0x6baa13){var _0x30c79a=this;return function(){_0x30c79a['handleIvr'](_0x6baa13);};};Dialer[_0x26ae('0xb5')][_0x26ae('0xd')]=function(_0x8c45ff){var _0x20b088=this;if(isNotPreview(_0x8c45ff[_0x26ae('0x61')])){if(isVoiceQueueOutbound(_0x8c45ff[_0x26ae('0x54')])&&isActive(_0x8c45ff[_0x26ae('0x60')])){_0x8c45ff[_0x26ae('0xa8')]=!![];BPromise[_0x26ae('0xbe')]()['then'](checkIsLoggedIn(_0x8c45ff,_0x8c45ff[_0x26ae('0x58')]))['then'](checkIsActive(_0x8c45ff,_0x8c45ff[_0x26ae('0x60')]))[_0x26ae('0x43')](checkInterval(_0x8c45ff))[_0x26ae('0x43')](_0x20b088[_0x26ae('0x150')](_0x8c45ff))[_0x26ae('0x43')](_0x20b088[_0x26ae('0x154')](_0x8c45ff['dialGlobalInterval'],_0x8c45ff[_0x26ae('0x172')],_0x8c45ff[_0x26ae('0x48')],_0x8c45ff))[_0x26ae('0x43')](_0x20b088['checkIfTimeIntervals'](_0x8c45ff['Interval'],_0x8c45ff[_0x26ae('0x172')],_0x8c45ff['name'],_0x8c45ff))[_0x26ae('0x43')](_0x20b088[_0x26ae('0x173')](_0x8c45ff))[_0x26ae('0xb9')](loggerCatchQueueSummary(_0x26ae('0x174'),_0x8c45ff));}else{notSendMessagesQueue(_0x8c45ff);}}else{freeVariablesPredictive(_0x8c45ff);}};Dialer[_0x26ae('0xb5')][_0x26ae('0x39')]=_[_0x26ae('0x175')](function(){var _0x31e969=_[_0x26ae('0x176')](this[_0x26ae('0x26')],function(_0x2b2713){return _0x2b2713['dialPreviewRecallmeReminder'];});var _0x3f3632=_['filter'](this['agents'],function(_0x4a9fb8){return _0x4a9fb8[_0x26ae('0x177')]&&_0x4a9fb8[_0x26ae('0xe3')]===_0x26ae('0x178');});if(_0x31e969[_0x26ae('0x15e')]>0x0&&_0x3f3632[_0x26ae('0x15e')]>0x0){return BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](cmHopper[_0x26ae('0x179')](_['map'](_0x31e969,'id'),previewRecallmeReminderInterval,_[_0x26ae('0x17a')](_0x3f3632,'id')))[_0x26ae('0x43')](function(_0x94b1f7){for(var _0x20e485=0x0;_0x20e485<_0x94b1f7['length'];_0x20e485++){var _0x45325=_0x94b1f7[_0x20e485]['Agent'][_0x26ae('0x48')];if(_0x45325)io['to'](util[_0x26ae('0x7f')]('user:%s',_0x45325))[_0x26ae('0x53')](_0x26ae('0x17b'),{'hopper':_0x94b1f7[_0x20e485]});}})[_0x26ae('0xb9')](function(_0x302644){logger['error'](_0x26ae('0x17c'),_0x302644);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x26ae('0xb5')][_0x26ae('0x14f')]=function(){var _0x3c1014=this;var _0x43356a;for(var _0x999832 in this['campaigns']){if(typeof this[_0x26ae('0x27')][_0x999832]!==_0x26ae('0xa0')){_0x43356a=this[_0x26ae('0x27')][_0x999832];if(isCampaignIvr(_0x43356a[_0x26ae('0x54')])&&isActive(_0x43356a[_0x26ae('0x7d')])){_0x43356a['sendMessageOneNotActive']=!![];BPromise[_0x26ae('0xbe')]()[_0x26ae('0x43')](checkIsActive(_0x43356a,_0x43356a[_0x26ae('0x7d')]))[_0x26ae('0x43')](checkInterval(_0x43356a))[_0x26ae('0x43')](_0x3c1014[_0x26ae('0x150')](_0x43356a))[_0x26ae('0x43')](_0x3c1014[_0x26ae('0x154')](_0x43356a[_0x26ae('0x17d')],_0x43356a[_0x26ae('0x172')],_0x43356a['name'],_0x43356a))[_0x26ae('0x43')](_0x3c1014[_0x26ae('0x156')](_0x43356a[_0x26ae('0x4d')],_0x43356a[_0x26ae('0x172')],_0x43356a[_0x26ae('0x48')],_0x43356a))[_0x26ae('0x43')](_0x3c1014['launchHandleIvr'](_0x43356a))[_0x26ae('0xb9')](loggerCatchQueueSummary(_0x26ae('0x17e'),_0x43356a));}else{notSendMessagesCampaign(_0x43356a);}}}};function getCallerIdRandom(_0x23680f,_0x18bf27){var _0x5d7237;var _0x1eff32;var _0x45bf3d;if(_0x18bf27<=0x0){_0x18bf27=0x1;}_0x5d7237=new RegExp('\x5cw{0,'+_0x18bf27+'}$');_0x1eff32=Math['pow'](0xa,_0x18bf27-0x1);_0x45bf3d=Math[_0x26ae('0x17f')](0xa,_0x18bf27)-0x1;return util[_0x26ae('0x7f')]('%s',_['replace'](_0x23680f,_0x5d7237,_[_0x26ae('0x180')](_0x1eff32,_0x45bf3d)));}function extractCalleridName(_0x26a106){var _0x2934ee=_0x26a106[_0x26ae('0x181')](/"(.*?)"/);return _0x2934ee?_0x2934ee[0x1]:_0x26a106;}function extractCalleridNumber(_0x59fcda){var _0x5da45f=_0x59fcda[_0x26ae('0x181')](/<(.*?)>/);return _0x5da45f?_0x5da45f[0x1]:_0x59fcda;}Dialer[_0x26ae('0xb5')][_0x26ae('0x182')]=function(_0xa6a55c,_0x4e911e){var _0x451133=this;var _0x4e31ac=uuid['v4']();this[_0x26ae('0x2c')][_0x4e31ac]=new Action(_0xa6a55c,_0x4e911e,_0x4e31ac);return new BPromise(function(_0x28da2b,_0x54d552){if(_['isUndefined'](_0xa6a55c)&&typeof _0xa6a55c!=='object'){return _0x54d552(msgResponse(_0x26ae('0x183'),_0x26ae('0x157'),_0x26ae('0x184')));}if(_[_0x26ae('0x45')](_0x4e911e[_0x26ae('0x185')])||_0x4e911e[_0x26ae('0x185')]===null){return _0x54d552(msgResponse(_0x26ae('0x183'),_0x26ae('0x157'),'contact\x20is\x20undefine'));}var _0x322e9e={'XMD-CALLERID':_0x451133[_0x26ae('0x2c')][_0x4e31ac][_0x26ae('0x186')](),'XMD-AGI':_0xa6a55c['dialQueueProject']?util[_0x26ae('0x7f')](_0x26ae('0x187'),ipAgi,_0xa6a55c[_0x26ae('0x116')]):_0x26ae('0x188'),'XMD-AGIAFTER':_0xa6a55c['dialQueueProject2']?util[_0x26ae('0x7f')]('\x22agi://%s/square,%s\x22',ipAgi,_0xa6a55c['dialQueueProject2']):_0x26ae('0x188'),'XMD-QUEUE':_0xa6a55c[_0x26ae('0x54')]===_0x26ae('0x99')?util['format'](_0x26ae('0x189'),_0xa6a55c[_0x26ae('0x48')],_0xa6a55c[_0x26ae('0x18a')]||'',_0xa6a55c[_0x26ae('0x11b')]?'c':'',_0xa6a55c[_0x26ae('0x123')]||0x3):_0x26ae('0x188'),'XMD-CONTACTID':_0x4e911e[_0x26ae('0xd9')],'XMD-CDRTYPE':_0x26ae('0x9'),'CALLERID(all)':_0x451133['actions'][_0x4e31ac][_0x26ae('0x186')](),'XMD-AMD':_0xa6a55c[_0x26ae('0x108')]?_0x26ae('0x18b'):_0x26ae('0x188'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xa6a55c[_0x26ae('0x108')]){_0x322e9e['XMD-AMDINITIALSILENCE']=_0xa6a55c[_0x26ae('0x18c')]||0x9c4;_0x322e9e['XMD-AMDGREETING']=_0xa6a55c[_0x26ae('0x18d')]||0x5dc;_0x322e9e[_0x26ae('0x18e')]=_0xa6a55c[_0x26ae('0x18f')]||0x320;_0x322e9e[_0x26ae('0x190')]=_0xa6a55c[_0x26ae('0x191')]||0x1388;_0x322e9e[_0x26ae('0x192')]=_0xa6a55c['dialAMDMinWordLength']||0x64;_0x322e9e[_0x26ae('0x193')]=_0xa6a55c['dialAMDBetweenWordsSilence']||0x32;_0x322e9e['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xa6a55c[_0x26ae('0x194')]||0x3;_0x322e9e[_0x26ae('0x195')]=_0xa6a55c['dialAMDSilenceThreshold']||0x100;_0x322e9e[_0x26ae('0x196')]=_0xa6a55c[_0x26ae('0x197')]||0x1388;}if(_0xa6a55c[_0x26ae('0x54')]===_0x26ae('0x99')){_0x322e9e['XMD-VOICEQUEUEID']=_0x4e911e[_0x26ae('0x110')];}else{_0x322e9e[_0x26ae('0x198')]=_0x4e911e[_0x26ae('0xdc')];}for(var _0x1447aa in _0x4e911e['Contact']){if(typeof _0x4e911e[_0x26ae('0x199')][_0x1447aa]!=='undefined'){if(isNotNull(_0x4e911e[_0x26ae('0x199')][_0x1447aa])&&_0x1447aa!=='id'&&_0x1447aa!=='tags'&&_0x1447aa!==_0x26ae('0x19a')&&_0x1447aa!==_0x26ae('0x19b')){_0x322e9e[util['format'](_0x26ae('0x19c'),'XMD-',_[_0x26ae('0x19d')](_0x1447aa))]=_0x4e911e[_0x26ae('0x199')][_0x1447aa];}}}var _0x1061e7=_0x451133[_0x26ae('0xe1')](_0xa6a55c[_0x26ae('0x7c')])?getCallerId(_0xa6a55c['Trunk']['callerid'],_0xa6a55c[_0x26ae('0x62')],_0xa6a55c[_0x26ae('0x19e')]>0x0?getCallerIdRandom(_0xa6a55c[_0x26ae('0x63')],_0xa6a55c[_0x26ae('0x19e')]):_0xa6a55c[_0x26ae('0x63')]):getCallerId(_[_0x26ae('0xe5')](_0xa6a55c[_0x26ae('0x151')])?_0xa6a55c['Trunk'][_0x26ae('0x7e')]:_0xa6a55c['TrunkBackup']['callerid'],_0xa6a55c[_0x26ae('0x62')],_0xa6a55c[_0x26ae('0x19e')]>0x0?getCallerIdRandom(_0xa6a55c[_0x26ae('0x63')],_0xa6a55c['dialRandomLastDigitCallerIdNumber']):_0xa6a55c['dialOriginateCallerIdNumber']);if(_0x1061e7){_0x322e9e['XMD-ORIGINATECALLERIDNAME']=_0x451133[_0x26ae('0x2c')][_0x4e31ac][_0x26ae('0x19f')]=extractCalleridName(_0x1061e7);_0x322e9e['XMD-ORIGINATECALLERIDNUM']=_0x4e911e[_0x26ae('0x185')];}return ami[_0x26ae('0xb7')]({'actionid':_0x4e31ac,'action':_0x26ae('0x183'),'channel':_0x451133[_0x26ae('0xe1')](_0xa6a55c[_0x26ae('0x7c')])?util[_0x26ae('0x7f')](_0x26ae('0x1a0'),_0xa6a55c[_0x26ae('0x7c')]['name'],isNotNull(_0xa6a55c[_0x26ae('0x65')])?_0xa6a55c['dialPrefix'][_0x26ae('0x1a1')]()||'':'',_0xa6a55c[_0x26ae('0x1a2')]>0x0?_0x4e911e[_0x26ae('0x185')][_0x26ae('0x1a3')](_0xa6a55c[_0x26ae('0x1a2')]):_0x4e911e['phone']):util[_0x26ae('0x7f')]('SIP/%s/%s%s',_['isNil'](_0xa6a55c[_0x26ae('0x151')])?_0xa6a55c['Trunk']['name']:_0xa6a55c[_0x26ae('0x151')][_0x26ae('0x48')],isNotNull(_0xa6a55c[_0x26ae('0x65')])?_0xa6a55c[_0x26ae('0x65')][_0x26ae('0x1a1')]()||'':'',_0xa6a55c['dialCutDigit']>0x0?_0x4e911e[_0x26ae('0x185')][_0x26ae('0x1a3')](_0xa6a55c[_0x26ae('0x1a2')]):_0x4e911e[_0x26ae('0x185')]),'callerid':_0x1061e7,'Exten':_0x26ae('0xe9'),'Context':_0x26ae('0x1a4'),'Priority':'1','variable':_0x322e9e,'timeout':(_0xa6a55c[_0x26ae('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e31ac})[_0x26ae('0x43')](function(_0x56f7d8){return _0x28da2b(_0x56f7d8);})['catch'](function(_0xe7c01d){_0xa6a55c[_0x26ae('0x6b')]+=0x1;var _0x5493db=new History(_0x451133['actions'][_0x4e31ac]);logger[_0x26ae('0x9e')](util[_0x26ae('0x7f')]('[originateError]:\x20%s',JSON['stringify'](_0xe7c01d)));_0x5493db['state']=0xe;_0x5493db[_0x26ae('0xb1')]=_0x26ae('0x1a5');_0x5493db[_0x26ae('0xb3')]=moment()[_0x26ae('0x7f')](_0x26ae('0x10f'));_0x5493db[_0x26ae('0xb2')]=_0x5493db[_0x26ae('0xb3')];_0x451133['createHistory'](_0x5493db)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1a6')));_0x451133[_0x26ae('0x112')](_0x5493db)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1a6')))[_0x26ae('0x23')](function(){delete _0x451133[_0x26ae('0x2c')][_0x4e31ac];return _0x54d552(msgResponse(_0x26ae('0x183'),_0x26ae('0x51'),_0x26ae('0x1a7')));});});});};Dialer[_0x26ae('0xb5')][_0x26ae('0x35')]=function(_0x568ee9){var _0x5133d2=this[_0x26ae('0x2c')][_0x568ee9[_0x26ae('0x136')]];if(_0x5133d2){delete this[_0x26ae('0x2c')][_0x568ee9['actionid']];_0x5133d2['responsetime']=moment()[_0x26ae('0x7f')](_0x26ae('0x10f'));var _0x438deb=_0x5133d2[_0x26ae('0x54')]==='ivr'?this['campaigns'][_0x5133d2[_0x26ae('0xbb')]]:this['voiceQueues'][_0x5133d2['getQueue']()];if(!this['isSuccess'](_0x568ee9[_0x26ae('0x1a8')])){this['updateOriginated'](_0x438deb);return this[_0x26ae('0x1a9')](_0x5133d2,_0x438deb,_0x568ee9)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1aa')));}this[_0x26ae('0x2e')][_0x568ee9[_0x26ae('0xe4')]]=_0x5133d2;}};Dialer[_0x26ae('0xb5')]['checkRetriveMax']=function(_0x3beea8,_0x46e6b4,_0x58cefc){var _0x58d876=new History(_0x46e6b4);if(_0x58d876[_0x26ae('0xf8')]+_0x58d876[_0x26ae('0xf9')]+_0x58d876['countnoanswerretry']+_0x58d876[_0x26ae('0x10d')]+_0x58d876[_0x26ae('0xfb')]+_0x58d876['countabandonedretry']+_0x58d876[_0x26ae('0xfd')]+_0x58d876[_0x26ae('0xfe')]>=_0x58cefc[_0x26ae('0xff')]-0x1){return!![];}switch(_0x3beea8){case 0x3:if(_0x58d876['countnoanswerretry']>=_0x58cefc[_0x26ae('0x1ab')]-0x1){return!![];}this[_0x26ae('0xc8')]({'active':![],'countnoanswerretry':_0x58d876[_0x26ae('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x58cefc[_0x26ae('0x1ac')],'minutes')[_0x26ae('0x7f')](_0x26ae('0x10f')),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876[_0x26ae('0xda')],'VoiceQueueId':_0x58d876[_0x26ae('0x110')]||undefined,'CampaignId':_0x58d876[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1ad')));break;case 0x5:if(_0x58d876[_0x26ae('0xf8')]>=_0x58cefc[_0x26ae('0x1ae')]-0x1){return!![];}this[_0x26ae('0xc8')]({'active':![],'countbusyretry':_0x58d876['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x58cefc[_0x26ae('0x1af')],_0x26ae('0x106'))[_0x26ae('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876[_0x26ae('0xda')],'VoiceQueueId':_0x58d876[_0x26ae('0x110')]||undefined,'CampaignId':_0x58d876[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1b0')));break;case 0x8:if(_0x58d876[_0x26ae('0xf9')]>=_0x58cefc[_0x26ae('0x1b1')]-0x1){return!![];}this[_0x26ae('0xc8')]({'active':![],'countcongestionretry':_0x58d876[_0x26ae('0xf9')]+=0x1,'scheduledat':moment()[_0x26ae('0x104')](_0x58cefc['dialCongestionRetryFrequency'],_0x26ae('0x106'))[_0x26ae('0x7f')](_0x26ae('0x10f')),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876[_0x26ae('0xda')],'VoiceQueueId':_0x58d876['VoiceQueueId']||undefined,'CampaignId':_0x58d876[_0x26ae('0xdc')]||undefined})['catch'](loggerCatch(_0x26ae('0x1b2')));break;case 0x0:if(_0x58d876[_0x26ae('0x10d')]>=_0x58cefc[_0x26ae('0x1b3')]-0x1){return!![];}else{this[_0x26ae('0xc8')]({'active':![],'countnosuchnumberretry':_0x58d876[_0x26ae('0x10d')]+=0x1,'scheduledat':moment()['add'](_0x58cefc['dialNoSuchNumberRetryFrequency'],_0x26ae('0x106'))[_0x26ae('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876[_0x26ae('0xda')],'VoiceQueueId':_0x58d876['VoiceQueueId']||undefined,'CampaignId':_0x58d876[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1b4')));}break;case 0xa:if(_0x58d876[_0x26ae('0xfb')]>=_0x58cefc[_0x26ae('0x12b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x58d876[_0x26ae('0xfb')]+=0x1,'scheduledat':moment()[_0x26ae('0x104')](_0x58cefc['dialDropRetryFrequency'],_0x26ae('0x106'))[_0x26ae('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876[_0x26ae('0xda')],'VoiceQueueId':_0x58d876['VoiceQueueId']||undefined,'CampaignId':_0x58d876[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x12e')));break;case 0xb:if(_0x58d876[_0x26ae('0xfc')]>=_0x58cefc[_0x26ae('0x134')]-0x1){return!![];}this[_0x26ae('0xc8')]({'active':![],'countabandonedretry':_0x58d876[_0x26ae('0xfc')]+=0x1,'scheduledat':moment()[_0x26ae('0x104')](_0x58cefc[_0x26ae('0x133')],'minutes')[_0x26ae('0x7f')](_0x26ae('0x10f')),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876['ListId'],'VoiceQueueId':_0x58d876[_0x26ae('0x110')]||undefined,'CampaignId':_0x58d876[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1b5')));break;case 0x13:if(_0x58d876['countmachineretry']>=_0x58cefc[_0x26ae('0x102')]-0x1){return!![];}this[_0x26ae('0xc8')]({'active':![],'countmachineretry':_0x58d876[_0x26ae('0xfd')]+=0x1,'scheduledat':moment()[_0x26ae('0x104')](_0x58cefc[_0x26ae('0x105')],_0x26ae('0x106'))['format'](_0x26ae('0x10f')),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876[_0x26ae('0xda')],'VoiceQueueId':_0x58d876['VoiceQueueId']||undefined,'CampaignId':_0x58d876['CampaignId']||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x107')));break;case 0x14:if(_0x58d876[_0x26ae('0xfe')]>=_0x58cefc[_0x26ae('0x1b6')]-0x1){return!![];}this[_0x26ae('0xc8')]({'active':![],'countagentrejectretry':_0x58d876[_0x26ae('0xfe')]+=0x1,'scheduledat':moment()[_0x26ae('0x104')](_0x58cefc['dialAgentRejectRetryFrequency'],_0x26ae('0x106'))['format'](_0x26ae('0x10f')),'ContactId':_0x58d876[_0x26ae('0xd9')],'ListId':_0x58d876[_0x26ae('0xda')],'VoiceQueueId':_0x58d876[_0x26ae('0x110')]||undefined,'CampaignId':_0x58d876[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1b7')));break;default:return!![];}};Dialer[_0x26ae('0xb5')][_0x26ae('0x1a9')]=function(_0x131280,_0x155a16,_0x2a67b0){var _0x43a332=this;var _0x932eba=new History(_0x131280);var _0x110e5c=![];var _0x35a970;var _0x3e9272;return new BPromise(function(_0x3bf430,_0x27e239){if(_[_0x26ae('0x45')](_0x155a16)&&typeof _0x155a16!==_0x26ae('0x1b8')){return _0x27e239(msgResponse(_0x26ae('0x1b9'),_0x26ae('0x157'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x2a67b0)&&typeof _0x2a67b0!==_0x26ae('0x1b8')){return _0x27e239(msgResponse(_0x26ae('0x1b9'),_0x26ae('0x157'),_0x26ae('0x1ba')));}_0x43a332['verifyAdditionalPhones'](_0x932eba,_0x2a67b0['reason'],_0x155a16)[_0x26ae('0x43')](function(_0x2877b5){if(_0x2877b5[_0x26ae('0x12d')]==0x1)_0x110e5c=!![];switch(_0x2a67b0[_0x26ae('0x119')]){case'0':_0x155a16['outboundNoSuchCallsDay']+=0x1;_0x932eba[_0x26ae('0xb0')]=0x0;_0x932eba[_0x26ae('0xb1')]=_0x26ae('0x1bb');_0x932eba[_0x26ae('0x10d')]+=0x1;_0x932eba['countglobal']+=0x1;ami[_0x26ae('0x53')](_0x26ae('0x1bc'),ut[_0x26ae('0xf0')](_0x131280,_0x26ae('0x1bd')));_0x35a970=_0x155a16[_0x26ae('0x1be')];_0x3e9272=_0x155a16[_0x26ae('0x129')];_0x43a332['createHistory'](_0x932eba)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x43a332['checkRetriveMax'](0x0,_0x131280,_0x155a16)&&!_0x110e5c){if(_0x932eba[_0x26ae('0x10d')]>=_0x155a16[_0x26ae('0x1b3')]){_0x43a332[_0x26ae('0x10e')](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1bf'));}else{_0x43a332[_0x26ae('0x100')](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1bf'));}}break;case'3':_0x155a16[_0x26ae('0x1c0')]+=0x1;_0x932eba['state']=0x3;_0x932eba[_0x26ae('0xb1')]=_0x26ae('0x1c1');_0x932eba[_0x26ae('0xfa')]+=0x1;_0x932eba[_0x26ae('0xf6')]+=0x1;ami[_0x26ae('0x53')](_0x26ae('0x1c2'),ut[_0x26ae('0xf0')](_0x131280,_0x26ae('0x1c3')));_0x35a970=_0x155a16[_0x26ae('0x1ac')];_0x3e9272=_0x155a16[_0x26ae('0x129')];_0x43a332[_0x26ae('0xd2')](_0x932eba)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1c4')));if(_0x43a332['checkRetriveMax'](0x3,_0x131280,_0x155a16)&&!_0x110e5c){if(_0x932eba[_0x26ae('0xfa')]>=_0x155a16[_0x26ae('0x1ab')]){_0x43a332[_0x26ae('0x10e')](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1c5'));}else{_0x43a332[_0x26ae('0x100')](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1c5'));}}break;case'5':_0x155a16[_0x26ae('0x66')]+=0x1;_0x932eba['state']=0x5;_0x932eba[_0x26ae('0xb1')]=_0x26ae('0x1c6');_0x932eba[_0x26ae('0xf8')]+=0x1;_0x932eba[_0x26ae('0xf6')]+=0x1;ami[_0x26ae('0x53')]('custom:agentbusy',ut[_0x26ae('0xf0')](_0x131280,_0x26ae('0x1c7')));_0x35a970=_0x155a16[_0x26ae('0x1af')];_0x3e9272=_0x155a16['callAdditionalPhoneAfterMin'];_0x43a332['createHistory'](_0x932eba)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1c8')));if(_0x43a332['checkRetriveMax'](0x5,_0x131280,_0x155a16)&&!_0x110e5c){if(_0x932eba['countbusyretry']>=_0x155a16[_0x26ae('0x1ae')]){_0x43a332[_0x26ae('0x10e')](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1c9'));}else{_0x43a332['stateGlobal'](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1c9'));}}break;case'8':_0x155a16[_0x26ae('0x67')]+=0x1;_0x932eba['state']=0x8;_0x932eba[_0x26ae('0xb1')]=_0x26ae('0x1ca');_0x932eba[_0x26ae('0xf9')]+=0x1;_0x932eba['countglobal']+=0x1;_0x35a970=_0x155a16[_0x26ae('0x1cb')];_0x3e9272=_0x155a16[_0x26ae('0x129')];ami['emit']('custom:agentcongestion',ut[_0x26ae('0xf0')](_0x131280,_0x26ae('0x1cc')));_0x43a332[_0x26ae('0xd2')](_0x932eba)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1cd')));if(_0x43a332['checkRetriveMax'](0x8,_0x131280,_0x155a16)&&!_0x110e5c){if(_0x932eba['countcongestionretry']>=_0x155a16['dialCongestionMaxRetry']){_0x43a332[_0x26ae('0x10e')](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1ce'));}else{_0x43a332[_0x26ae('0x100')](_0x932eba,_0x3bf430,_0x27e239,'reason\x208\x20congestion');}}break;case'11':_0x155a16[_0x26ae('0x1cf')]+=0x1;_0x932eba[_0x26ae('0xb0')]=0xb;_0x932eba[_0x26ae('0xb1')]=_0x26ae('0x132');_0x932eba[_0x26ae('0xfc')]+=0x1;_0x932eba['countglobal']+=0x1;_0x35a970=_0x155a16[_0x26ae('0x133')];_0x3e9272=_0x155a16[_0x26ae('0x129')];_0x43a332[_0x26ae('0xd2')](_0x932eba)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x43a332[_0x26ae('0x1d0')](0xb,_0x131280,_0x155a16)&&!_0x110e5c){if(_0x932eba[_0x26ae('0xfc')]>=_0x155a16[_0x26ae('0x134')]){_0x43a332['createStateFinal'](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1d1'));}else{_0x43a332[_0x26ae('0x100')](_0x932eba,_0x3bf430,_0x27e239,'reason\x2011\x20abandoned');}}break;case'20':_0x155a16[_0x26ae('0x6d')]+=0x1;_0x932eba[_0x26ae('0xb0')]=0x14;_0x932eba[_0x26ae('0xb1')]=_0x26ae('0x1d2');_0x932eba[_0x26ae('0xfe')]+=0x1;_0x932eba['countglobal']+=0x1;_0x35a970=_0x155a16['dialAgentRejectRetryFrequency'];_0x3e9272=_0x155a16[_0x26ae('0x129')];ami[_0x26ae('0x53')]('custom:agentreject',ut[_0x26ae('0xf0')](_0x131280,'agentreject'));_0x43a332[_0x26ae('0xd2')](_0x932eba)[_0x26ae('0xb9')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x43a332[_0x26ae('0x1d0')](0x14,_0x131280,_0x155a16)&&!_0x110e5c){if(_0x932eba[_0x26ae('0xfe')]>=_0x155a16[_0x26ae('0x1b6')]){_0x43a332[_0x26ae('0x10e')](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1d3'));}else{_0x43a332['stateGlobal'](_0x932eba,_0x3bf430,_0x27e239,_0x26ae('0x1d3'));}}break;default:_0x155a16['outboundUnknownCallsDay']+=0x1;_0x932eba['state']=0xc;_0x932eba[_0x26ae('0xb1')]=_0x2a67b0[_0x26ae('0x119')];_0x35a970=_0x155a16[_0x26ae('0x1d4')];_0x3e9272=_0x155a16[_0x26ae('0x129')];_0x43a332['createHistory'](_0x932eba)[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x1d5')));if(_0x43a332['checkRetriveMax'](_0x2a67b0[_0x26ae('0x119')],_0x131280,_0x155a16)&&!_0x110e5c){if(_0x932eba['countbusyretry']+_0x932eba[_0x26ae('0xf9')]+_0x932eba[_0x26ae('0xfa')]+_0x932eba[_0x26ae('0x10d')]+_0x932eba['countdropretry']+_0x932eba['countabandonedretry']+_0x932eba['countmachineretry']+_0x932eba['countagentrejectretry']>=_0x155a16[_0x26ae('0xff')]){_0x43a332[_0x26ae('0x100')](_0x932eba,_0x3bf430,_0x27e239,_0x2a67b0['reason']);}else{_0x43a332[_0x26ae('0x10e')](_0x932eba,_0x3bf430,_0x27e239,_0x2a67b0['reason']);}}}})[_0x26ae('0x43')](function(_0x2a6f2f){if(_0x110e5c){_0x43a332[_0x26ae('0xc2')](_0x932eba,_0x35a970,_0x3e9272)[_0x26ae('0x43')](function(_0x7e9cf1){return _0x3bf430(0x1);});}});});};Dialer[_0x26ae('0xb5')][_0x26ae('0x100')]=function(_0x3665bc,_0x5c776c,_0x5b5e9c,_0xb2e735){var _0x5147f9=new Final(_0x3665bc);_0x5147f9[_0x26ae('0xb0')]=0xf;_0x5147f9[_0x26ae('0xb1')]=_0x26ae('0x1d6');this[_0x26ae('0x10e')](_0x5147f9,_0x5c776c,_0x5b5e9c,_0xb2e735);};Dialer[_0x26ae('0xb5')]['createStateFinal']=function(_0x392669,_0x583d83,_0x3e320b,_0x3a6c5b){this[_0x26ae('0x112')](_0x392669)[_0x26ae('0x43')](function(){return _0x583d83(msgResponse(_0x26ae('0x1b9'),_0x26ae('0xe0'),_0x3a6c5b));})[_0x26ae('0xb9')](function(){return _0x3e320b(msgResponse('[moveContactManagedDialer][0]','Failure','contact\x20not\x20moved'));});};Dialer[_0x26ae('0xb5')]['predictive']=function(_0x49a1e6){var _0x2d0e14=_0x49a1e6['dialPredictiveOptimizationPercentage']/0x64;var _0x52c1a5=_0x49a1e6[_0x26ae('0x6a')]/(_0x49a1e6[_0x26ae('0x6a')]+_0x49a1e6[_0x26ae('0xf4')]);var _0x27bb30=Math[_0x26ae('0x1d7')](_0x49a1e6[_0x26ae('0x74')]*(_0x49a1e6[_0x26ae('0x1d8')]/0x64));var _0x35bc2c=Math[_0x26ae('0x1d7')](_0x49a1e6['predictiveIntervalAvailable']*(_0x49a1e6[_0x26ae('0x1d9')]/0x64));var _0x1bdc78=_0x49a1e6[_0x26ae('0x57')]+_0x49a1e6[_0x26ae('0x1da')];var _0x2e576f=Math[_0x26ae('0x1db')](_0x49a1e6[_0x26ae('0x77')]*_0x49a1e6[_0x26ae('0x79')]*_0x49a1e6[_0x26ae('0x1dc')]*_0x49a1e6['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x49a1e6[_0x26ae('0x2f')])){if(!_[_0x26ae('0x45')](_0x49a1e6[_0x26ae('0x7b')])){_0x49a1e6[_0x26ae('0x7b')]=undefined;loggerPredictive['error'](_0x26ae('0x1dd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x26ae('0x45')](_0x49a1e6['handlePredictive'])){loggerPredictive['error'](_0x26ae('0x1dd'),_0x26ae('0x1de'));clearInterval(_0x49a1e6[_0x26ae('0x98')]);_0x49a1e6[_0x26ae('0x98')]=undefined;}_0x49a1e6[_0x26ae('0x2f')]=moment()[_0x26ae('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x26ae('0x83')](_0x49a1e6[_0x26ae('0x48')],_0x26ae('0x1df'),_0x49a1e6['startProgressive']);this['handlePower'](_0x49a1e6,0x1);}else if(ifInterval(_0x49a1e6[_0x26ae('0x1e0')],_0x49a1e6[_0x26ae('0x2f')])){this[_0x26ae('0x16c')](_0x49a1e6,0x1);loggerPredictiveCalls[_0x26ae('0x83')](_0x26ae('0x1e1'),_0x49a1e6[_0x26ae('0x2f')],_0x49a1e6[_0x26ae('0x48')]);_0x49a1e6[_0x26ae('0x77')]=0x0;_0x49a1e6['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2d0e14<_0x52c1a5&&_0x49a1e6[_0x26ae('0x1e2')]===_0x26ae('0x1e3')){freeVariablesPredictive(_0x49a1e6);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x1e4'),'Dropped\x20calls\x20day',_0x52c1a5,_0x26ae('0x2f'),_0x49a1e6[_0x26ae('0x48')]);}else if(_0x2e576f<_0x49a1e6[_0x26ae('0x71')]&&_0x49a1e6[_0x26ae('0x1e2')]===_0x26ae('0x1e3')){freeVariablesPredictive(_0x49a1e6);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x1e5'),_0x26ae('0x1e6'),_0x2e576f,_0x26ae('0x1e7'),_0x49a1e6[_0x26ae('0x71')],_0x26ae('0x2f'),_0x49a1e6['name']);}else if(!ifInterval(_0x49a1e6['dialPredictiveInterval'],_0x49a1e6[_0x26ae('0x2f')])&&_['isUndefined'](_0x49a1e6['startPredictive'])&&!_[_0x26ae('0x45')](_0x49a1e6[_0x26ae('0x2f')])){_0x49a1e6['startPredictive']=moment()[_0x26ae('0x7f')](_0x26ae('0x10f'));loggerPredictive[_0x26ae('0x83')](_0x49a1e6['name'],_0x26ae('0x1e8'),_0x49a1e6[_0x26ae('0x7b')]);this[_0x26ae('0xc5')](_0x49a1e6[_0x26ae('0x1e0')])[_0x26ae('0x43')](this[_0x26ae('0x1e9')](_0x49a1e6))['then'](mergeDataErlangB(_0x49a1e6))[_0x26ae('0x43')](this[_0x26ae('0x1ea')](_0x49a1e6))[_0x26ae('0xb9')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x49a1e6));}else if(!ifInterval(_0x49a1e6[_0x26ae('0x1e0')],_0x49a1e6['startPredictive'])){_0x49a1e6[_0x26ae('0x71')]=0x0;_0x49a1e6['startPredictive']=moment()[_0x26ae('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x49a1e6[_0x26ae('0x48')],'recalculate\x20predictive\x20at',_0x49a1e6[_0x26ae('0x7b')]);clearInterval(_0x49a1e6['handlePredictive']);_0x49a1e6[_0x26ae('0x98')]=undefined;this[_0x26ae('0xc5')](_0x49a1e6[_0x26ae('0x1e0')])[_0x26ae('0x43')](this[_0x26ae('0x1e9')](_0x49a1e6))[_0x26ae('0x43')](mergeDataErlangB(_0x49a1e6))['then'](this[_0x26ae('0x1ea')](_0x49a1e6))[_0x26ae('0xb9')](loggerCatchPredictive(_0x26ae('0x1eb'),_0x49a1e6));}else if(_0x49a1e6[_0x26ae('0x74')]&&_0x1bdc78<_0x49a1e6[_0x26ae('0x74')]-_0x35bc2c){freeVariablesPredictive(_0x49a1e6);loggerPredictive[_0x26ae('0x83')](_0x49a1e6['name'],_0x26ae('0x1ec'),_0x1bdc78,')\x20are\x20less\x20than\x20threshold\x20(',_0x49a1e6[_0x26ae('0x74')],'-',_0x35bc2c,'=',_0x49a1e6['predictiveIntervalAvailable']-_0x35bc2c,')');}else if(_0x49a1e6[_0x26ae('0x74')]&&_0x1bdc78>_0x49a1e6[_0x26ae('0x74')]+_0x27bb30){freeVariablesPredictive(_0x49a1e6);loggerPredictive[_0x26ae('0x83')](_0x49a1e6[_0x26ae('0x48')],_0x26ae('0x1ec'),_0x1bdc78,_0x26ae('0x1ed'),_0x49a1e6[_0x26ae('0x74')],'+',_0x27bb30,'=',_0x49a1e6[_0x26ae('0x74')]+_0x27bb30,')');}};Dialer[_0x26ae('0xb5')][_0x26ae('0x1e9')]=function(_0x34de9b){var _0x3ead29=this;return function(_0x360c03){return new BPromise(function(_0x5081be,_0x493107){_[_0x26ae('0x94')](_0x34de9b,_0x360c03[0x0]);if(checkGetDataPredictive(_0x360c03[0x0])){var _0x45f8ff=_0x34de9b['predictiveIntervalAvailable']=_0x34de9b['talking']+_0x34de9b[_0x26ae('0x57')];var _0x4c6036=_0x34de9b[_0x26ae('0x1e0')]*0x3c;var _0x1411bb=_0x360c03[0x0][_0x26ae('0x6f')]+_0x360c03[0x0][_0x26ae('0x8a')];var _0x7b11f5=(_0x360c03[0x0][_0x26ae('0x6e')]+_0x360c03[0x0][_0x26ae('0x88')]+_0x360c03[0x0][_0x26ae('0x70')])/_0x360c03[0x0][_0x26ae('0x75')];_0x34de9b[_0x26ae('0x1dc')]=_0x7b11f5>0x0?_0x7b11f5:0x1;switch(_0x34de9b[_0x26ae('0x1e2')]){case _0x26ae('0x1e3'):var _0x5b2c43=_0x34de9b[_0x26ae('0x1ee')]/0x64;return _0x3ead29[_0x26ae('0x1ef')](_0x45f8ff,_0x4c6036,_0x1411bb,_0x7b11f5,_0x5b2c43)['then'](function(_0x24b6f2){return _0x5081be(_0x24b6f2);});case _0x26ae('0x1f0'):var _0x4eaec8=_0x34de9b[_0x26ae('0x1ee')]/0x64;return _0x3ead29[_0x26ae('0x1f1')](_0x45f8ff,_0x4c6036,_0x1411bb,_0x7b11f5,_0x4eaec8)[_0x26ae('0x43')](function(_0x44457b){return _0x5081be(_0x44457b);});default:return _0x493107(msgResponse('[getDataPredictive]','Failure',_0x26ae('0x1f2')));}}else{return _0x493107(msgResponse(_0x26ae('0x1f3'),'Failure','check\x20failure'));}});};};Dialer[_0x26ae('0xb5')][_0x26ae('0x1f4')]=function(_0x347c20){var _0x38de01=this;return function(_0x53f0c0){return new BPromise(function(_0x3972b2,_0x490f63){_['merge'](_0x347c20,_0x53f0c0[0x0]);if(checkGetDataPredictive(_0x53f0c0[0x0])){loggerPredictive[_0x26ae('0x83')](JSON[_0x26ae('0x13f')](_0x53f0c0[0x0]));if(_0x347c20[_0x26ae('0x1e2')]===_0x26ae('0x1e3')){return _0x38de01[_0x26ae('0xd0')](_0x347c20['id'])[_0x26ae('0x43')](function(_0x4b4cc5){var _0x482b0e=_0x347c20[_0x26ae('0x58')]-_0x4b4cc5[0x0][_0x26ae('0x1f5')];var _0x497c13=_0x347c20[_0x26ae('0x1e0')]*0x3c;var _0x1e8ad7=_0x53f0c0[0x0][_0x26ae('0x6f')]+_0x53f0c0[0x0][_0x26ae('0x8a')];var _0x14b737=(_0x53f0c0[0x0][_0x26ae('0x6e')]+_0x53f0c0[0x0][_0x26ae('0x88')]+_0x53f0c0[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x53f0c0[0x0][_0x26ae('0x75')];var _0x899538=_0x347c20['dialPredictiveOptimizationPercentage']/0x64;_0x347c20[_0x26ae('0x73')]=_0x4b4cc5[0x0][_0x26ae('0x1f5')]||0x0;_0x347c20['predictiveIntervalHitRate']=_0x14b737>0x0?_0x14b737:0x1;return _0x38de01[_0x26ae('0x1ef')](_0x482b0e,_0x497c13,_0x1e8ad7,_0x14b737,_0x899538);})['then'](function(_0x254543){return _0x3972b2(_0x254543);})[_0x26ae('0xb9')](function(_0x320e5b){return _0x490f63(msgResponse('[CatchErlangB]',_0x26ae('0x157'),JSON[_0x26ae('0x13f')](_0x320e5b)));});}if(_0x347c20[_0x26ae('0x1e2')]===_0x26ae('0x1f0')){return _0x38de01[_0x26ae('0xd0')](_0x347c20['id'])[_0x26ae('0x43')](function(_0x19f412){var _0x57ed16=_0x347c20[_0x26ae('0x58')]-_0x19f412[0x0][_0x26ae('0x1f5')];var _0x367ef9=_0x347c20[_0x26ae('0x1e0')]*0x3c;var _0x257fb0=_0x53f0c0[0x0][_0x26ae('0x6f')]+_0x53f0c0[0x0]['predictiveIntervalAvgHoldtime'];var _0x864b36=(_0x53f0c0[0x0]['predictiveIntervalAnsweredCalls']+_0x53f0c0[0x0][_0x26ae('0x88')]+_0x53f0c0[0x0][_0x26ae('0x70')])/_0x53f0c0[0x0][_0x26ae('0x75')];var _0x137e8e=_0x347c20[_0x26ae('0x1ee')]/0x64;_0x347c20[_0x26ae('0x73')]=_0x19f412[0x0][_0x26ae('0x1f5')]||0x0;_0x347c20['predictiveIntervalHitRate']=_0x864b36>0x0?_0x864b36:0x1;return _0x38de01[_0x26ae('0x1f1')](_0x57ed16,_0x367ef9,_0x257fb0,_0x864b36,_0x137e8e);})[_0x26ae('0x43')](function(_0x1793d4){return _0x3972b2(_0x1793d4);})[_0x26ae('0xb9')](function(_0x2aafd2){return _0x490f63(msgResponse(_0x26ae('0x1f6'),_0x26ae('0x157'),JSON[_0x26ae('0x13f')](_0x2aafd2)));});}}else{return _0x490f63(msgResponse(_0x26ae('0x1f3'),_0x26ae('0x157'),_0x26ae('0x1f7')));}});};};Dialer[_0x26ae('0xb5')][_0x26ae('0x1ea')]=function(_0x5ac670){var _0x1ccc7e=this;return function(){var _0x2e385d=0x0;var _0x22d5cd=Math[_0x26ae('0x1db')](_0x5ac670[_0x26ae('0x78')]*0x3e8);if(_0x22d5cd>0x0){_0x22d5cd=_0x22d5cd<0x64?0x64:_0x22d5cd;loggerPredictive[_0x26ae('0x83')](_0x5ac670['name'],_0x26ae('0x1f8'),_0x22d5cd,_0x26ae('0x52'));_0x5ac670['handlePredictive']=setInterval(function(){_0x1ccc7e[_0x26ae('0x98')](_0x5ac670);loggerPredictiveCalls[_0x26ae('0x83')](_0x26ae('0x1f9'),_0x2e385d+=0x1);},_0x22d5cd);}else{loggerPredictive[_0x26ae('0x83')](_0x5ac670[_0x26ae('0x48')],_0x26ae('0x1fa'));}};};Dialer[_0x26ae('0xb5')][_0x26ae('0x1fb')]=function(_0x30ab36,_0x4692d3){var _0x25328b=this;return function(_0x5f1ab5){if(_['isEmpty'](_0x5f1ab5)){if(_['isNil'](_0x4692d3['UserId'])||!_0x4692d3['recallme']){if(_0x30ab36['dialMethod']===_0x26ae('0x16f')){_0x30ab36['queueStatusComplete']=_[_0x26ae('0x45')](_0x30ab36[_0x26ae('0x13c')])?!![]:_0x30ab36[_0x26ae('0x13c')];var _0x41b861=uuid['v4']();_0x25328b[_0x26ae('0x2c')][_0x41b861]=new Action(_0x30ab36,_0x4692d3,_0x41b861);loggerBooked[_0x26ae('0x83')](_0x26ae('0x1fc'),_0x41b861,_0x26ae('0x1fd'),JSON[_0x26ae('0x13f')](_0x30ab36[_0x26ae('0x13c')]),_0x26ae('0x1fe'),_0x30ab36[_0x26ae('0x48')]);if(_0x30ab36[_0x26ae('0x13c')]){_0x30ab36[_0x26ae('0x13c')]=![];_0x25328b[_0x26ae('0x30')][_0x25328b[_0x26ae('0x2c')][_0x41b861][_0x26ae('0xbb')]]=[];ami[_0x26ae('0xb7')]({'actionid':_0x41b861,'action':'queuestatus','queue':_0x30ab36[_0x26ae('0x48')]})[_0x26ae('0xb9')](function(){_0x25328b[_0x26ae('0xd4')](_0x30ab36);_0x25328b['rescheduleContact']({'active':![],'ContactId':_0x25328b[_0x26ae('0x2c')][_0x41b861][_0x26ae('0xd9')],'ListId':_0x25328b['actions'][_0x41b861][_0x26ae('0xda')],'VoiceQueueId':_0x25328b['actions'][_0x41b861][_0x26ae('0x110')]||undefined,'CampaignId':_0x25328b[_0x26ae('0x2c')][_0x41b861]['CampaignId']||undefined})['catch'](loggerCatch(_0x26ae('0x1ff')));delete _0x25328b[_0x26ae('0x2c')][_0x41b861];});}else{loggerBooked['info'](_0x26ae('0x200'),JSON[_0x26ae('0x13f')](_0x30ab36[_0x26ae('0x13c')]),'Queue:\x20',_0x30ab36['name']);_0x25328b[_0x26ae('0xd4')](_0x30ab36);_0x25328b[_0x26ae('0xc8')]({'active':![],'ContactId':_0x25328b[_0x26ae('0x2c')][_0x41b861]['ContactId'],'ListId':_0x25328b[_0x26ae('0x2c')][_0x41b861][_0x26ae('0xda')],'VoiceQueueId':_0x25328b[_0x26ae('0x2c')][_0x41b861]['VoiceQueueId']||undefined,'CampaignId':_0x25328b[_0x26ae('0x2c')][_0x41b861][_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x25328b[_0x26ae('0x2c')][_0x41b861];}}else{return _0x25328b[_0x26ae('0x182')](_0x30ab36,_0x4692d3);}}else{if(getDiff(_0x4692d3['scheduledat'])<_0x30ab36[_0x26ae('0x201')]*0x3c){if(_0x4692d3[_0x26ae('0x202')]&&!_0x4692d3[_0x26ae('0x202')][_0x26ae('0x203')]){_0x25328b['preview'][_0x26ae('0x140')](_0x4692d3['id'])[_0x26ae('0x23')](function(){_0x25328b[_0x26ae('0xd4')](_0x30ab36);});}else{_0x25328b[_0x26ae('0xc9')]({'active':![]},_0x4692d3['id'],0x1)[_0x26ae('0x23')](function(){_0x25328b[_0x26ae('0xd4')](_0x30ab36);});}}else{_0x30ab36[_0x26ae('0x6c')]+=0x1;_0x25328b['updateOriginated'](_0x30ab36);if(_0x30ab36['dialRecallInQueue']){_0x25328b[_0x26ae('0xc8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4692d3[_0x26ae('0xd9')],'ListId':_0x4692d3['ListId'],'VoiceQueueId':_0x4692d3[_0x26ae('0x110')]||undefined,'CampaignId':_0x4692d3[_0x26ae('0xdc')]||undefined})[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x204')));_0x25328b[_0x26ae('0xd2')](createObjHistory(_0x30ab36,_0x4692d3,_0x26ae('0x205'),0x17,_0x26ae('0x206')))[_0x26ae('0xb9')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x25328b[_0x26ae('0xd8')](createObjHistory(_0x30ab36,_0x4692d3,'RECALLFAILEDTIMEOUT',0x16,_0x26ae('0x207')),_0x26ae('0x208'),_0x26ae('0x209'));}}}}else{_0x30ab36[_0x26ae('0x20a')]+=0x1;_0x25328b[_0x26ae('0xd8')](createObjHistory(_0x30ab36,_0x4692d3,_0x26ae('0x20b'),0xd,'Blacklist'),_0x26ae('0x20c'),_0x26ae('0x20d'));throw'inBlackList';}};};Dialer['prototype'][_0x26ae('0x20e')]=function(_0x3b03c5){var _0x288c23=this;var _0x69f653=_0x3b03c5[_0x26ae('0x20f')]-_0x3b03c5[_0x26ae('0x76')]-_0x3b03c5[_0x26ae('0xcc')];emitCampaignSummary(_0x3b03c5);if(_0x69f653>0x0){if(_0x69f653>this[_0x26ae('0x2a')]){_0x69f653=this['maxNumberOriginate'];}_0x3b03c5[_0x26ae('0xcc')]+=_0x69f653;this[_0x26ae('0xce')](_0x3b03c5['id'],_0x69f653,_0x3b03c5[_0x26ae('0x210')],_0x3b03c5)[_0x26ae('0x43')](function(_0x70bdd){_0x3b03c5[_0x26ae('0xcc')]-=_0x69f653;_0x3b03c5[_0x26ae('0xcc')]=_0x3b03c5[_0x26ae('0xcc')]>0x0?_0x3b03c5[_0x26ae('0xcc')]:0x0;if(!checkContactEmpty(_0x70bdd)){_0x3b03c5[_0x26ae('0x46')]=_0x26ae('0xa6');logger[_0x26ae('0x83')](_0x26ae('0x211')+_0x3b03c5[_0x26ae('0x48')]);}else{_0x3b03c5[_0x26ae('0x76')]+=_0x70bdd[_0x26ae('0x15e')];_0x3b03c5[_0x26ae('0x46')]=_0x26ae('0x212');for(var _0x3bda18=0x0;_0x3bda18<_0x70bdd[_0x26ae('0x15e')];_0x3bda18+=0x1){_0x3b03c5[_0x26ae('0x213')]+=0x1;if(_[_0x26ae('0xe5')](_0x70bdd[_0x3bda18])||_[_0x26ae('0xe5')](_0x70bdd[_0x3bda18][_0x26ae('0x199')])||_['isNil'](_0x70bdd[_0x3bda18][_0x26ae('0x185')])){_0x288c23[_0x26ae('0xd7')]('[actionOriginate]\x20',_0x3b03c5,_0x70bdd[_0x3bda18]);}else{_0x288c23[_0x26ae('0xc3')](_[_0x26ae('0x13b')](_0x70bdd[_0x3bda18],[_0x26ae('0xdc'),'Contact.phone']))['then'](_0x288c23[_0x26ae('0x1fb')](_0x3b03c5,_0x70bdd[_0x3bda18]))[_0x26ae('0xb9')](_0x288c23[_0x26ae('0xd6')](_0x26ae('0x214'),_0x3b03c5));}}}})['catch'](loggerGetContactDialer(_0x26ae('0x215'),_0x3b03c5,_0x69f653));}};Dialer[_0x26ae('0xb5')][_0x26ae('0x16c')]=function(_0x4b3b69,_0x4c8f4c){var _0x386975=this;var _0x4b26d3=[];var _0xace8bd=_0x4c8f4c>=0x1?_0x4c8f4c:0x1;if(_0x4b3b69[_0x26ae('0x61')]===_0x26ae('0x16f')){_0xace8bd=0x1;}var _0x285df0=Math[_0x26ae('0x1db')](_0x4b3b69[_0x26ae('0x57')]*_0xace8bd)-_0x4b3b69[_0x26ae('0x76')]-_0x4b3b69[_0x26ae('0xcc')];emitVoiceQueueSummary(_0x4b3b69);if(_0x4b3b69[_0x26ae('0x216')]>0x0){var _0x5cd037=_0x4b3b69['dialLimitQueue']-_0x4b3b69[_0x26ae('0x76')]-_0x4b3b69[_0x26ae('0x1da')]-_0x4b3b69[_0x26ae('0xcc')]-_0x4b3b69[_0x26ae('0x59')];if(_0x285df0>_0x5cd037){_0x285df0=_0x5cd037;}}if(_0x285df0>0x0){if(_0x4b3b69[_0x26ae('0x61')]===_0x26ae('0x16f')){_0x285df0=0x1;}if(_0x285df0>this[_0x26ae('0x2a')]){_0x285df0=this[_0x26ae('0x2a')];}_0x4b3b69[_0x26ae('0xcc')]+=_0x285df0;for(var _0x3edc74 in this[_0x26ae('0x28')]){if(typeof this[_0x26ae('0x28')][_0x3edc74]!==_0x26ae('0xa0')){if(this[_0x26ae('0x28')][_0x3edc74][_0x26ae('0xb0')]===_0x26ae('0x217')&&this[_0x26ae('0x28')][_0x3edc74][_0x26ae('0xe3')]===_0x26ae('0x178')){_0x4b26d3['push'](this[_0x26ae('0x28')][_0x3edc74]['id']);}}}this[_0x26ae('0xcb')](_0x4b3b69['id'],_0x4b26d3,_0x285df0,_0x4b3b69[_0x26ae('0x210')],_0x4b3b69)[_0x26ae('0x43')](function(_0x201354){_0x4b3b69[_0x26ae('0xcc')]-=_0x285df0;_0x4b3b69[_0x26ae('0xcc')]=_0x4b3b69[_0x26ae('0xcc')]>0x0?_0x4b3b69[_0x26ae('0xcc')]:0x0;if(!checkContactEmpty(_0x201354)){_0x386975[_0x26ae('0xbd')](_0x4b3b69)[_0x26ae('0x43')](sendMessageReschedule(_0x4b3b69))[_0x26ae('0xb9')](loggerCatch(_0x26ae('0x218')));}else{_0x4b3b69[_0x26ae('0x76')]+=_0x201354[_0x26ae('0x15e')];_0x4b3b69[_0x26ae('0x46')]=_0x4b3b69[_0x26ae('0x61')]===_0x26ae('0x16f')?_0x26ae('0x18b'):_0x26ae('0x212');for(var _0x2f3e6a=0x0;_0x2f3e6a<_0x201354[_0x26ae('0x15e')];_0x2f3e6a+=0x1){if(_['isNil'](_0x201354[_0x2f3e6a])||_[_0x26ae('0xe5')](_0x201354[_0x2f3e6a][_0x26ae('0x199')])||_[_0x26ae('0xe5')](_0x201354[_0x2f3e6a][_0x26ae('0x185')])){_0x386975['emptyContact']('[actionOriginate]\x20',_0x4b3b69,_0x201354[_0x2f3e6a]);}else{_0x386975[_0x26ae('0xbf')](_[_0x26ae('0x13b')](_0x201354[_0x2f3e6a],[_0x26ae('0x110'),_0x26ae('0x219')]))[_0x26ae('0x43')](_0x386975['checkContactBlack'](_0x4b3b69,_0x201354[_0x2f3e6a]))['catch'](_0x386975[_0x26ae('0xd6')](_0x26ae('0x21a'),_0x4b3b69));}}}})[_0x26ae('0xb9')](loggerGetContactDialer(_0x26ae('0x21b'),_0x4b3b69,_0x285df0));}};Dialer[_0x26ae('0xb5')]['handlePredictive']=function(_0x1bd8bc){if(_0x1bd8bc[_0x26ae('0x216')]>0x0){var _0x1a6b25=_0x1bd8bc['dialLimitQueue']-_0x1bd8bc[_0x26ae('0x76')]-_0x1bd8bc[_0x26ae('0x1da')];if(_0x1a6b25>0x0){this[_0x26ae('0x21c')](_0x1bd8bc);}else{loggerPredictiveCalls['info'](_0x26ae('0x21d'));}}else{this[_0x26ae('0x21c')](_0x1bd8bc);}};Dialer[_0x26ae('0xb5')][_0x26ae('0x21c')]=function(_0x3d65dd){var _0x23958e=this;var _0x41148e=[];_0x3d65dd['originated']+=0x1;for(var _0x47eb9f in this['agents']){if(typeof this[_0x26ae('0x28')][_0x47eb9f]!==_0x26ae('0xa0')){if(this[_0x26ae('0x28')][_0x47eb9f][_0x26ae('0xb0')]===_0x26ae('0x217')&&this['agents'][_0x47eb9f]['status']===_0x26ae('0x178')){_0x41148e[_0x26ae('0x13a')](this[_0x26ae('0x28')][_0x47eb9f]['id']);}}}this['getContactDialer'](_0x3d65dd['id'],_0x41148e,0x1,_0x3d65dd[_0x26ae('0x210')],_0x3d65dd)['then'](function(_0xaceec8){if(!checkContactEmpty(_0xaceec8)){checkContactLowerLimitOriginate(_0x3d65dd,0x1,0x0);_0x23958e['countReScheduled'](_0x3d65dd)[_0x26ae('0x43')](sendMessageReschedule(_0x3d65dd))[_0x26ae('0xb9')](loggerCatch('[countReScheduled]\x20'));}else{_0x3d65dd[_0x26ae('0x46')]='RUNNING';if(_[_0x26ae('0xe5')](_0xaceec8[0x0])||_[_0x26ae('0xe5')](_0xaceec8[0x0][_0x26ae('0x199')])||_[_0x26ae('0xe5')](_0xaceec8[0x0][_0x26ae('0x185')])){_0x23958e['emptyContact']('[actionOriginate]\x20',_0x3d65dd,_0xaceec8[0x0]);}else{_0x23958e[_0x26ae('0xbf')](_[_0x26ae('0x13b')](_0xaceec8[0x0],[_0x26ae('0x110'),_0x26ae('0x219')]))[_0x26ae('0x43')](_0x23958e[_0x26ae('0x1fb')](_0x3d65dd,_0xaceec8[0x0]))[_0x26ae('0xb9')](_0x23958e[_0x26ae('0xd6')]('[actionOriginatePredictive]\x20',_0x3d65dd));}}})['catch'](loggerGetContactDialer(_0x26ae('0x21e'),_0x3d65dd,0x1));emitVoiceQueueSummary(_0x3d65dd);};Dialer[_0x26ae('0xb5')]['abandonmentRate']=function(_0x3469ed,_0x4710aa,_0x5f4ffc,_0x55c98c,_0x216436,_0x18d204){loggerPredictive[_0x26ae('0x83')](_0x26ae('0x21f'));loggerPredictive[_0x26ae('0x83')](_0x26ae('0x220'),_0x3469ed);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x221'),_0x4710aa);loggerPredictive['info']('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',_0x5f4ffc);loggerPredictive[_0x26ae('0x83')]('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',_0x55c98c);loggerPredictive['info'](_0x26ae('0x222'),_0x216436);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8c'));return new BPromise(function(_0x12611e,_0x50fb08){if(_0x3469ed<=0x0||isNaN(_0x3469ed)){return _0x50fb08(msgResponse(_0x26ae('0x223'),_0x26ae('0x51'),'m\x20=\x20'+_0x3469ed));}if(_0x5f4ffc<=0x0||isNaN(_0x5f4ffc)){return _0x50fb08(msgResponse(_0x26ae('0x223'),'Error',_0x26ae('0x224')+_0x5f4ffc));}if(_0x55c98c<=0x0||isNaN(_0x55c98c)){return _0x50fb08(msgResponse('[abandonmentRate]',_0x26ae('0x51'),'p\x20=\x20'+_0x55c98c));}if(_0x4710aa<=0x0||isNaN(_0x4710aa)){return _0x50fb08(msgResponse(_0x26ae('0x223'),_0x26ae('0x51'),_0x26ae('0x225')+_0x4710aa));}if(_0x216436<=0x0||isNaN(_0x216436)){return _0x50fb08(msgResponse(_0x26ae('0x223'),_0x26ae('0x51'),'Amax\x20=\x20'+_0x216436));}_0x18d204=_0x18d204||0x0;var _0x511bc0=0x1/_0x5f4ffc;var _0x150893=0x0;var _0x54c8bb=0x0;var _0x4edc79=0x0;var _0x511cd0=0x0;for(var _0x197817=0x0;_0x4edc79<_0x216436;_0x197817+=0x1){_0x54c8bb=_0x197817/_0x4710aa;_0x150893=(_0x55c98c*_0x54c8bb+_0x18d204)/_0x511bc0;_0x4edc79=erlangb(_0x150893,_0x3469ed);_0x511cd0=_0x150893/_0x3469ed*(0x1-erlangb(_0x150893,_0x3469ed));}return _0x12611e({'erlangCalls':_0x197817,'erlangCallToSecond':_0x4710aa/_0x197817,'erlangAbandonmentRate':_0x4edc79,'erlangBusyFactor':_0x511cd0});});};Dialer[_0x26ae('0xb5')][_0x26ae('0x1f1')]=function(_0x53f74d,_0x1aa8a3,_0x4c89fb,_0xa93638,_0x515101,_0x5b5cf6){loggerPredictive[_0x26ae('0x83')](_0x26ae('0x226'));loggerPredictive[_0x26ae('0x83')](_0x26ae('0x220'),_0x53f74d);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x221'),_0x1aa8a3);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x227'),_0x4c89fb);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x228'),_0xa93638);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x515101);loggerPredictive[_0x26ae('0x83')](_0x26ae('0x8c'));return new BPromise(function(_0x4a1beb,_0x2f347e){if(_0x53f74d<=0x0||isNaN(_0x53f74d)){return _0x2f347e(msgResponse('[busyFactor]',_0x26ae('0x51'),_0x26ae('0x229')+_0x53f74d));}if(_0x4c89fb<=0x0||isNaN(_0x4c89fb)){return _0x2f347e(msgResponse(_0x26ae('0x22a'),_0x26ae('0x51'),_0x26ae('0x224')+_0x4c89fb));}if(_0xa93638<=0x0||isNaN(_0xa93638)){return _0x2f347e(msgResponse(_0x26ae('0x22a'),_0x26ae('0x51'),'p\x20=\x20'+_0xa93638));}if(_0x1aa8a3<=0x0||isNaN(_0x1aa8a3)){return _0x2f347e(msgResponse(_0x26ae('0x22a'),_0x26ae('0x51'),_0x26ae('0x225')+_0x1aa8a3));}if(_0x515101<=0x0||isNaN(_0x515101)){return _0x2f347e(msgResponse(_0x26ae('0x22a'),_0x26ae('0x51'),_0x26ae('0x22b')+_0x515101));}_0x5b5cf6=_0x5b5cf6||0x0;var _0x4cd81a=0x1/_0x4c89fb;var _0x5730f1=0x0;var _0x522052=0x0;var _0x45ef8b=0x0;var _0x5d12bb=0x0;for(var _0x3a0617=0x0;_0x5d12bb<_0x515101;_0x3a0617+=0x1){_0x522052=_0x3a0617/_0x1aa8a3;_0x5730f1=(_0xa93638*_0x522052+_0x5b5cf6)/_0x4cd81a;_0x45ef8b=erlangb(_0x5730f1,_0x53f74d);_0x5d12bb=_0x5730f1/_0x53f74d*(0x1-erlangb(_0x5730f1,_0x53f74d));}return _0x4a1beb({'erlangCalls':_0x3a0617,'erlangCallToSecond':_0x1aa8a3/_0x3a0617,'erlangAbandonmentRate':_0x45ef8b,'erlangBusyFactor':_0x5d12bb});});};module[_0x26ae('0x22c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a66fa68..ee127c1 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1526=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry'];(function(_0x2c06ab,_0x2bd97e){var _0x4946c2=function(_0xb5ef0){while(--_0xb5ef0){_0x2c06ab['push'](_0x2c06ab['shift']());}};_0x4946c2(++_0x2bd97e);}(_0x1526,0x16e));var _0x6152=function(_0x24cf86,_0x463fdc){_0x24cf86=_0x24cf86-0x0;var _0x5bdba9=_0x1526[_0x24cf86];return _0x5bdba9;};'use strict';var util=require(_0x6152('0x0'));var _=require(_0x6152('0x1'));var moment=require(_0x6152('0x2'));function getSeconds(_0x31ff8d,_0x51dd82){var _0x3b41cd=moment(_0x31ff8d)[_0x6152('0x3')](0x0);var _0x52b763=moment(_0x51dd82)[_0x6152('0x3')](0x0);return _0x3b41cd[_0x6152('0x4')](_0x52b763,_0x6152('0x5'));}function QueueCallerAbandon(_0x557451,_0x4fda48){this['scheduledat']=_0x557451[_0x6152('0x6')];this['type']=_0x557451[_0x6152('0x7')];this[_0x6152('0x8')]=_0x557451['type']===_0x6152('0x9')?'queue':_0x557451['type'];this[_0x6152('0xa')]=_0x557451[_0x6152('0xa')];this[_0x6152('0xb')]=_0x557451['countcongestionretry'];this['countnoanswerretry']=_0x557451['countnoanswerretry'];this['countglobal']=_0x557451['countbusyretry']+_0x557451[_0x6152('0xb')]+_0x557451[_0x6152('0xc')]+_0x557451[_0x6152('0xd')]+_0x557451[_0x6152('0xe')]+_0x557451[_0x6152('0xf')]+_0x557451[_0x6152('0x10')]+_0x557451[_0x6152('0x11')];this[_0x6152('0xd')]=_0x557451[_0x6152('0xd')];this['countdropretry']=_0x557451[_0x6152('0xe')];this[_0x6152('0xf')]=_0x557451[_0x6152('0xf')];this[_0x6152('0x10')]=_0x557451[_0x6152('0x10')];this[_0x6152('0x11')]=_0x557451[_0x6152('0x11')];this[_0x6152('0x12')]=_0x4fda48[_0x6152('0x12')];this[_0x6152('0x13')]=_0x557451['name'];this[_0x6152('0x14')]=_0x557451[_0x6152('0x15')];this['starttime']=_0x557451[_0x6152('0x16')];this[_0x6152('0x17')]=_0x557451[_0x6152('0x17')];this[_0x6152('0x18')]=_0x557451[_0x6152('0x18')];this['endtime']=this['droptime'];this[_0x6152('0x19')]=getSeconds(_0x557451[_0x6152('0x17')],_0x557451['starttime']);this[_0x6152('0x1a')]=getSeconds(this[_0x6152('0x18')],_0x557451[_0x6152('0x17')]);this[_0x6152('0x1b')]=0x0;this[_0x6152('0x1c')]=_0x4fda48['queue'];this['membername']=_0x4fda48[_0x6152('0x1d')];this[_0x6152('0x1e')]=_0x4fda48[_0x6152('0x1e')];this[_0x6152('0x1f')]=_0x557451[_0x6152('0x1f')];this['callbackuniqueid']=_0x557451[_0x6152('0x20')];this['callbackat']=_0x557451[_0x6152('0x21')];this[_0x6152('0x22')]=_0x557451[_0x6152('0x22')];this[_0x6152('0x23')]=_0x557451[_0x6152('0x23')];this[_0x6152('0x24')]=_0x557451[_0x6152('0x24')];this['UserId']=_0x557451[_0x6152('0x25')];this[_0x6152('0x26')]=_0x557451[_0x6152('0x26')];this[_0x6152('0x27')]=_0x557451[_0x6152('0x27')];this['originatecalleridnum']=_0x557451[_0x6152('0x28')]||'';this[_0x6152('0x29')]=_0x557451['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x9676=['seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff'];(function(_0x2d0f42,_0x18d525){var _0xb98060=function(_0x5d17a1){while(--_0x5d17a1){_0x2d0f42['push'](_0x2d0f42['shift']());}};_0xb98060(++_0x18d525);}(_0x9676,0xce));var _0x6967=function(_0xa88f71,_0x2e0e3e){_0xa88f71=_0xa88f71-0x0;var _0x1487b8=_0x9676[_0xa88f71];return _0x1487b8;};'use strict';var util=require('util');var _=require(_0x6967('0x0'));var moment=require(_0x6967('0x1'));function getSeconds(_0x3fa92a,_0x153c1c){var _0x1f7509=moment(_0x3fa92a)['milliseconds'](0x0);var _0x232c79=moment(_0x153c1c)[_0x6967('0x2')](0x0);return _0x1f7509[_0x6967('0x3')](_0x232c79,_0x6967('0x4'));}function QueueCallerAbandon(_0x4a62c6,_0x4f355e){this[_0x6967('0x5')]=_0x4a62c6[_0x6967('0x5')];this[_0x6967('0x6')]=_0x4a62c6[_0x6967('0x6')];this[_0x6967('0x7')]=_0x4a62c6['type']===_0x6967('0x8')?_0x6967('0x9'):_0x4a62c6[_0x6967('0x6')];this['countbusyretry']=_0x4a62c6[_0x6967('0xa')];this[_0x6967('0xb')]=_0x4a62c6[_0x6967('0xb')];this[_0x6967('0xc')]=_0x4a62c6[_0x6967('0xc')];this['countglobal']=_0x4a62c6[_0x6967('0xa')]+_0x4a62c6['countcongestionretry']+_0x4a62c6[_0x6967('0xc')]+_0x4a62c6[_0x6967('0xd')]+_0x4a62c6[_0x6967('0xe')]+_0x4a62c6[_0x6967('0xf')]+_0x4a62c6[_0x6967('0x10')]+_0x4a62c6[_0x6967('0x11')];this[_0x6967('0xd')]=_0x4a62c6[_0x6967('0xd')];this[_0x6967('0xe')]=_0x4a62c6['countdropretry'];this[_0x6967('0xf')]=_0x4a62c6[_0x6967('0xf')];this[_0x6967('0x10')]=_0x4a62c6['countmachineretry'];this[_0x6967('0x11')]=_0x4a62c6[_0x6967('0x11')];this[_0x6967('0x12')]=_0x4f355e[_0x6967('0x12')];this[_0x6967('0x13')]=_0x4a62c6[_0x6967('0x14')];this[_0x6967('0x15')]=_0x4a62c6[_0x6967('0x16')];this[_0x6967('0x17')]=_0x4a62c6[_0x6967('0x17')];this[_0x6967('0x18')]=_0x4a62c6['responsetime'];this['droptime']=_0x4a62c6[_0x6967('0x19')];this[_0x6967('0x1a')]=this[_0x6967('0x19')];this[_0x6967('0x1b')]=getSeconds(_0x4a62c6[_0x6967('0x18')],_0x4a62c6[_0x6967('0x17')]);this[_0x6967('0x1c')]=getSeconds(this[_0x6967('0x19')],_0x4a62c6[_0x6967('0x18')]);this['talktime']=0x0;this[_0x6967('0x9')]=_0x4f355e[_0x6967('0x9')];this['membername']=_0x4f355e[_0x6967('0x1d')];this[_0x6967('0x1e')]=_0x4f355e[_0x6967('0x1e')];this['callback']=_0x4a62c6[_0x6967('0x1f')];this[_0x6967('0x20')]=_0x4a62c6[_0x6967('0x20')];this['callbackat']=_0x4a62c6['callbackat'];this['recallme']=_0x4a62c6[_0x6967('0x21')];this[_0x6967('0x22')]=_0x4a62c6[_0x6967('0x22')];this[_0x6967('0x23')]=_0x4a62c6[_0x6967('0x23')];this[_0x6967('0x24')]=_0x4a62c6[_0x6967('0x24')];this[_0x6967('0x25')]=_0x4a62c6[_0x6967('0x25')];this[_0x6967('0x26')]=_0x4a62c6[_0x6967('0x26')];this[_0x6967('0x27')]=_0x4a62c6[_0x6967('0x27')]||'';this[_0x6967('0x28')]=_0x4a62c6[_0x6967('0x28')]||'';}module[_0x6967('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index cad7cd3..38402b9 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(_0x279d33,_0x48be27){var _0x5d3542=function(_0x1e40ae){while(--_0x1e40ae){_0x279d33['push'](_0x279d33['shift']());}};_0x5d3542(++_0x48be27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x241aa9,_0x3a1b4a){var _0x546e88=function(_0x1970e9){while(--_0x1970e9){_0x241aa9['push'](_0x241aa9['shift']());}};_0x546e88(++_0x3a1b4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 f23b124..1cee66e 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 _0xbb00=['info','actions','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','moment','path','./util/gs','fax','../ami','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','from-voip-provider','exten','uniqueid','channel','name'];(function(_0x485e59,_0x3fb454){var _0x1cd8a2=function(_0x3c39f7){while(--_0x3c39f7){_0x485e59['push'](_0x485e59['shift']());}};_0x1cd8a2(++_0x3fb454);}(_0xbb00,0x1a9));var _0x0bb0=function(_0x156a97,_0x2edddd){_0x156a97=_0x156a97-0x0;var _0xf92a71=_0xbb00[_0x156a97];return _0xf92a71;};'use strict';var util=require(_0x0bb0('0x0'));var _=require(_0x0bb0('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x0bb0('0x2'));var path=require(_0x0bb0('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x0bb0('0x4'));var logger=require('../../../config/logger')(_0x0bb0('0x5'));var ami=require(_0x0bb0('0x6'));var rpcDb=require(_0x0bb0('0x7'));var Channel=require('./channel');var ut=require(_0x0bb0('0x8'));var Action=require(_0x0bb0('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x0bb0('0xa'));var faxMessage=require(_0x0bb0('0xb'));function Fax(_0x4ce709){this[_0x0bb0('0xc')]={};this['faxAccounts']=_0x4ce709[_0x0bb0('0xd')];this[_0x0bb0('0xe')]=_0x4ce709['trunks'];this['actions']={};ami['on'](_0x0bb0('0xf'),this[_0x0bb0('0x10')][_0x0bb0('0x11')](this));ami['on'](_0x0bb0('0x12'),this[_0x0bb0('0x13')][_0x0bb0('0x11')](this));ami['on'](_0x0bb0('0x14'),this[_0x0bb0('0x15')]['bind'](this));ami['on'](_0x0bb0('0x16'),this['syncNewExten']['bind'](this));ami['on']('faxstatus',this[_0x0bb0('0x17')]['bind'](this));ami['on'](_0x0bb0('0x18'),this[_0x0bb0('0x19')][_0x0bb0('0x11')](this));ami['on'](_0x0bb0('0x1a'),this[_0x0bb0('0x1b')][_0x0bb0('0x11')](this));ami['on']('originateresponse',this[_0x0bb0('0x1c')][_0x0bb0('0x11')](this));}Fax[_0x0bb0('0x1d')][_0x0bb0('0x10')]=function(_0x45033b){if(_0x45033b['context']===_0x0bb0('0x1e')){for(var _0x3dc7bb in this[_0x0bb0('0xd')]){if(this[_0x0bb0('0xd')]['hasOwnProperty'](_0x3dc7bb)){if(_0x45033b[_0x0bb0('0x1f')]===this['faxAccounts'][_0x3dc7bb]['localstationid']){this['channels'][_0x45033b[_0x0bb0('0x20')]]={};this['channels'][_0x45033b['uniqueid']]['channel']=_0x45033b[_0x0bb0('0x21')];this['channels'][_0x45033b[_0x0bb0('0x20')]]['id']=this[_0x0bb0('0xd')][_0x3dc7bb]['id'];this['channels'][_0x45033b['uniqueid']]['name']=this[_0x0bb0('0xd')][_0x3dc7bb][_0x0bb0('0x22')];logger[_0x0bb0('0x23')](_0x45033b['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x0bb0('0x24')][_0x45033b['uniqueid']]){this['channels'][_0x45033b['uniqueid']]={};this[_0x0bb0('0xc')][_0x45033b[_0x0bb0('0x20')]]['channel']=_0x45033b['channel'];logger[_0x0bb0('0x23')](_0x45033b[_0x0bb0('0x20')],_0x0bb0('0x25'));}};Fax['prototype']['syncVarSet']=function(_0xe59caf){if(this['channels'][_0xe59caf[_0x0bb0('0x20')]]){for(var _0x307293 in _0xe59caf[_0x0bb0('0x26')]){if(_0xe59caf[_0x0bb0('0x26')][_0x0bb0('0x27')](_0x307293)){this[_0x0bb0('0xc')][_0xe59caf['uniqueid']][_0x307293]=_0xe59caf[_0x0bb0('0x28')];}}}};Fax[_0x0bb0('0x1d')][_0x0bb0('0x15')]=function(_0xee547e){if(this['channels'][_0xee547e[_0x0bb0('0x20')]]){this[_0x0bb0('0xc')][_0xee547e['uniqueid']][_0x0bb0('0x29')]=_0xee547e['channelstate'];this[_0x0bb0('0xc')][_0xee547e['uniqueid']][_0x0bb0('0x2a')]=_0xee547e[_0x0bb0('0x2a')];}};Fax[_0x0bb0('0x1d')][_0x0bb0('0x2b')]=function(_0x2c20fb){if(this['channels'][_0x2c20fb[_0x0bb0('0x20')]]){for(var _0x59cf06 in _0x2c20fb[_0x0bb0('0x26')]){if(_0x2c20fb[_0x0bb0('0x26')]['hasOwnProperty'](_0x59cf06)){this[_0x0bb0('0xc')][_0x2c20fb['uniqueid']][_0x59cf06]=_0x2c20fb[_0x0bb0('0x28')];}}}};Fax[_0x0bb0('0x1d')][_0x0bb0('0x17')]=function(_0x46bd9b){if(this[_0x0bb0('0xc')][_0x46bd9b[_0x0bb0('0x20')]]){this[_0x0bb0('0xc')][_0x46bd9b[_0x0bb0('0x20')]][_0x0bb0('0x2c')]=_0x46bd9b[_0x0bb0('0x2c')];this['channels'][_0x46bd9b[_0x0bb0('0x20')]]['status']=_0x46bd9b[_0x0bb0('0x2d')];this[_0x0bb0('0xc')][_0x46bd9b[_0x0bb0('0x20')]][_0x0bb0('0x2e')]=_0x46bd9b[_0x0bb0('0x2e')];this[_0x0bb0('0xc')][_0x46bd9b['uniqueid']][_0x0bb0('0x2f')]=_0x46bd9b[_0x0bb0('0x2f')];logger['info'](_0x46bd9b[_0x0bb0('0x20')],_0x0bb0('0x30'));}};Fax[_0x0bb0('0x1d')]['syncReceiveFax']=function(_0x75d2f2){var _0x55ce15=this;if(this[_0x0bb0('0xc')][_0x75d2f2[_0x0bb0('0x20')]]){var _0x23ca44=this[_0x0bb0('0xc')][_0x75d2f2[_0x0bb0('0x20')]]['id'];this['channels'][_0x75d2f2['uniqueid']][_0x0bb0('0x31')]=_0x75d2f2[_0x0bb0('0x31')];this['channels'][_0x75d2f2[_0x0bb0('0x20')]][_0x0bb0('0x32')]=_0x75d2f2[_0x0bb0('0x32')];this[_0x0bb0('0xc')][_0x75d2f2[_0x0bb0('0x20')]]['localstationid']=_0x75d2f2[_0x0bb0('0x2e')];this[_0x0bb0('0xc')][_0x75d2f2['uniqueid']][_0x0bb0('0x33')]=_0x75d2f2[_0x0bb0('0x33')];this['channels'][_0x75d2f2[_0x0bb0('0x20')]][_0x0bb0('0x34')]=_0x75d2f2['transferrate'];this['channels'][_0x75d2f2['uniqueid']][_0x0bb0('0x2f')]=_0x75d2f2['filename'];this[_0x0bb0('0xc')][_0x75d2f2['uniqueid']]['calleridnum']=_0x75d2f2[_0x0bb0('0x35')];if(this[_0x0bb0('0xc')][_0x75d2f2['uniqueid']][_0x0bb0('0x32')]>0x0){tiff2pdf(_0x75d2f2['filename'],_0x0bb0('0x36'),function(_0x19c41b){logger[_0x0bb0('0x23')](_0x75d2f2[_0x0bb0('0x20')],_0x0bb0('0x37'),_0x19c41b[_0x0bb0('0x38')]);attachment[_0x0bb0('0x39')]({'name':path[_0x0bb0('0x3a')](_0x75d2f2[_0x0bb0('0x2f')])['name'],'basename':path[_0x0bb0('0x3a')](_0x75d2f2['filename'])['name']+_0x0bb0('0x3b'),'type':'application/pdf'})[_0x0bb0('0x3c')](function(_0x7c9382){faxAccount[_0x0bb0('0x3d')](_0x23ca44,{'from':_0x75d2f2[_0x0bb0('0x35')],'mapKey':_0x0bb0('0x5'),'body':path[_0x0bb0('0x3a')](_0x75d2f2[_0x0bb0('0x2f')])[_0x0bb0('0x22')]+_0x0bb0('0x3b'),'AttachmentId':_0x7c9382['id']})[_0x0bb0('0x3e')](function(_0x154014){logger[_0x0bb0('0x3f')](_0x75d2f2['uniqueid'],_0x0bb0('0x40'),JSON[_0x0bb0('0x41')](_0x154014));});})[_0x0bb0('0x3e')](function(_0x4e85fc){logger['error'](_0x75d2f2[_0x0bb0('0x20')],_0x0bb0('0x42'),JSON[_0x0bb0('0x41')](_0x4e85fc));});});}logger['info'](_0x75d2f2[_0x0bb0('0x20')],_0x0bb0('0x42'));}};Fax[_0x0bb0('0x1d')][_0x0bb0('0x1c')]=function(_0x528ac9){if(this['actions'][_0x528ac9[_0x0bb0('0x20')]]){_['merge'](this['channels'][_0x528ac9[_0x0bb0('0x20')]],_[_0x0bb0('0x43')](_0x528ac9,[_0x0bb0('0x44'),_0x0bb0('0x45')]));}};function updateStatus(_0x2dbb4d){if(_0x2dbb4d[_0x0bb0('0x46')]){faxMessage[_0x0bb0('0x47')](_0x2dbb4d['AttachmentId'],{'failMessage':_0x0bb0('0x48')})[_0x0bb0('0x3c')](function(_0xeaeda5){ut[_0x0bb0('0x49')](_0x0bb0('0x4a'),_0xeaeda5);})[_0x0bb0('0x3e')](function(_0x35e233){ut['logger'](_0x0bb0('0x4b'),_0x35e233);});}else{ut[_0x0bb0('0x49')](_0x0bb0('0x4c'));}}Fax[_0x0bb0('0x1d')]['updateStatus']=function(_0x10c8bb,_0x5161cd,_0x49a1aa){var _0x3cea79=this;var _0x2231be={};if(_0x5161cd){_0x2231be={'read':_0x5161cd};}else{_0x2231be={'failMessage':_0x49a1aa};}if(this['actions'][_0x10c8bb]['AttachmentId']){faxMessage['update'](this[_0x0bb0('0x24')][_0x10c8bb]['AttachmentId'],_0x2231be)[_0x0bb0('0x3c')](function(_0x3d13fc){ut['logger'](_0x0bb0('0x4d'),_0x3d13fc);})['catch'](function(_0x2b1727){ut[_0x0bb0('0x49')](_0x0bb0('0x4e'),_0x2b1727);})[_0x0bb0('0x4f')](function(){delete _0x3cea79[_0x0bb0('0xc')][_0x10c8bb];delete _0x3cea79[_0x0bb0('0x24')][_0x10c8bb];});}else{ut[_0x0bb0('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0x0bb0('0xc')][_0x10c8bb];delete this['actions'][_0x10c8bb];}};Fax[_0x0bb0('0x1d')]['syncHangup']=function(_0x304ba9){var _0x42a389=this;if(this[_0x0bb0('0xc')][_0x304ba9[_0x0bb0('0x20')]]){if(this['actions'][_0x304ba9[_0x0bb0('0x20')]]){this[_0x0bb0('0xc')][_0x304ba9[_0x0bb0('0x20')]]['id']=this[_0x0bb0('0x24')][_0x304ba9[_0x0bb0('0x20')]]['id'];this['channels'][_0x304ba9[_0x0bb0('0x20')]]['name']=this[_0x0bb0('0x24')][_0x304ba9[_0x0bb0('0x20')]][_0x0bb0('0x22')];}logger[_0x0bb0('0x23')](_0x304ba9[_0x0bb0('0x20')],this[_0x0bb0('0x24')][_0x304ba9['uniqueid']]?_0x0bb0('0x50'):_0x0bb0('0x51'),JSON[_0x0bb0('0x41')](this[_0x0bb0('0xc')][_0x304ba9[_0x0bb0('0x20')]]));if(this[_0x0bb0('0x24')][_0x304ba9[_0x0bb0('0x20')]]){if(this['channels'][_0x304ba9['uniqueid']]['faxpages']>0x0&&this['channels'][_0x304ba9['uniqueid']][_0x0bb0('0x52')]===_0x0bb0('0x53')){this['updateStatus'](_0x304ba9['uniqueid'],!![]);}else{this[_0x0bb0('0x54')](_0x304ba9[_0x0bb0('0x20')],![],this[_0x0bb0('0xc')][_0x304ba9['uniqueid']][_0x0bb0('0x55')]?_0x0bb0('0x56')+this['channels'][_0x304ba9[_0x0bb0('0x20')]][_0x0bb0('0x55')]:'SENDING\x20FAILED');}}}};Fax[_0x0bb0('0x1d')][_0x0bb0('0x57')]=function(_0x337cd1){var _0x4cd72e=this;return new BPromise(function(_0x822982,_0x352fc0){_0x4cd72e['execOriginate'](_0x337cd1,_0x4cd72e['faxAccounts'][_0x337cd1[_0x0bb0('0x58')]])[_0x0bb0('0x3c')](function(_0x4c5f5f){ut['logger'](_0x0bb0('0x59'),_0x4c5f5f);_0x822982(ut[_0x0bb0('0x38')](_0x0bb0('0x5a')));})[_0x0bb0('0x3e')](function(_0x5c6cea){ut['logger'](_0x0bb0('0x5b'),_0x5c6cea);updateStatus(_0x337cd1);_0x352fc0(ut[_0x0bb0('0x38')](_0x0bb0('0x5c')));});});};Fax[_0x0bb0('0x1d')][_0x0bb0('0x5d')]=function(_0x585f6a){var _0x889996=this;return new BPromise(function(_0x427bd3,_0x1fbac4){var _0x37bd05=_0x889996[_0x0bb0('0x5e')](_0x889996[_0x0bb0('0xd')][_0x585f6a[_0x0bb0('0x58')]]['Trunk'],_0x585f6a);if(_0x37bd05['isValid']){_0x427bd3(ut[_0x0bb0('0x38')](_0x0bb0('0x5f')));}else{_0x1fbac4(ut[_0x0bb0('0x38')](_0x37bd05[_0x0bb0('0x38')]));}});};function originate(_0x14e658,_0x94c361,_0x2abce5){return new BPromise(function(_0x534f03,_0x150b2c){if(_0x2abce5){var _0x2f6634=util[_0x0bb0('0x60')](_0x0bb0('0x61'),path[_0x0bb0('0x3a')](_0x14e658[_0x0bb0('0x3')])[_0x0bb0('0x22')],_0x14e658[_0x0bb0('0x3')]);gs[_0x0bb0('0x62')](_0x2f6634)[_0x0bb0('0x3c')](function(){_0x14e658[_0x0bb0('0x3')]=util[_0x0bb0('0x60')](_0x0bb0('0x63'),path[_0x0bb0('0x3a')](_0x14e658[_0x0bb0('0x3')])['dir'],path[_0x0bb0('0x3a')](_0x14e658[_0x0bb0('0x3')])[_0x0bb0('0x22')]);_0x94c361['XMF-PATH']=_0x14e658[_0x0bb0('0x3')];ut[_0x0bb0('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x0bb0('0x64')](ut[_0x0bb0('0x65')](_0x14e658,_0x94c361))[_0x0bb0('0x3c')](function(_0x5e3003){_0x534f03(_0x5e3003);})[_0x0bb0('0x3e')](function(_0x101f41){_0x150b2c(_0x101f41);});})['catch'](function(_0x186711){_0x150b2c(_0x186711);});}else{ami[_0x0bb0('0x64')](ut['variablesAction'](_0x14e658,_0x94c361))[_0x0bb0('0x3c')](function(_0x35358c){_0x534f03(_0x35358c);})[_0x0bb0('0x3e')](function(_0x40ec69){_0x150b2c(_0x40ec69);});}});}Fax['prototype']['execOriginate']=function(_0x3c2b21,_0x3f3be6){var _0x1bbd5d=this;return new BPromise(function(_0x591067,_0x274fd9){var _0x27fb7c=uuid['v4']();var _0x26be39=ut['addVariables'](_0x3c2b21,_0x3f3be6);_0x1bbd5d[_0x0bb0('0x24')][_0x27fb7c]=new Action(_0x27fb7c,_0x3f3be6,_0x3c2b21);var _0x1177d1=_0x1bbd5d[_0x0bb0('0x24')][_0x27fb7c];if(path[_0x0bb0('0x3a')](_0x3c2b21[_0x0bb0('0x3')])['ext']===_0x0bb0('0x3b')){originate(_0x1177d1,_0x26be39,!![])[_0x0bb0('0x3c')](function(_0x2ee4f0){_0x591067(_0x2ee4f0);})[_0x0bb0('0x3e')](function(_0x34013f){_0x274fd9(_0x34013f);});}else{originate(_0x1177d1,_0x26be39,![])[_0x0bb0('0x3c')](function(_0x2edfd4){_0x591067(_0x2edfd4);})[_0x0bb0('0x3e')](function(_0x2dcaf6){_0x274fd9(_0x2dcaf6);});}});};Fax[_0x0bb0('0x1d')][_0x0bb0('0x66')]=function(_0x22e1a7){return!_['isNil'](_0x22e1a7)&&!_[_0x0bb0('0x67')](_0x22e1a7[_0x0bb0('0x22')])&&!_[_0x0bb0('0x67')](_0x22e1a7[_0x0bb0('0x68')])&&_0x22e1a7['active']&&!_[_0x0bb0('0x67')](this[_0x0bb0('0xe')][util[_0x0bb0('0x60')](_0x0bb0('0x69'),_0x22e1a7[_0x0bb0('0x22')])])&&!_[_0x0bb0('0x67')](this[_0x0bb0('0xe')][util[_0x0bb0('0x60')](_0x0bb0('0x69'),_0x22e1a7[_0x0bb0('0x22')])][_0x0bb0('0x2d')])&&(this['trunks'][util['format'](_0x0bb0('0x69'),_0x22e1a7['name'])][_0x0bb0('0x2d')]===_0x0bb0('0x6a')||this['trunks'][util['format'](_0x0bb0('0x69'),_0x22e1a7['name'])][_0x0bb0('0x2d')]==='unmonitored');};Fax['prototype'][_0x0bb0('0x5e')]=function(_0x41a20f,_0x4e2c20){if(!this[_0x0bb0('0x66')](_0x41a20f)){ut[_0x0bb0('0x49')](_0x0bb0('0x6b'),_[_0x0bb0('0x67')](_0x41a20f)?'':_0x41a20f[_0x0bb0('0x22')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x0bb0('0x6c')};}if(_[_0x0bb0('0x67')](_0x4e2c20[_0x0bb0('0x5')])){ut[_0x0bb0('0x49')](_0x0bb0('0x6d'),JSON['stringify'](_0x4e2c20));return{'isValid':![],'message':_0x0bb0('0x6e')};}if(_[_0x0bb0('0x67')](_0x4e2c20['path'])){ut[_0x0bb0('0x49')](_0x0bb0('0x6f'),JSON[_0x0bb0('0x41')](_0x4e2c20));return{'isValid':![],'message':_0x0bb0('0x70')};}return{'isValid':!![],'message':_0x0bb0('0x71')};};module[_0x0bb0('0x72')]=Fax; \ No newline at end of file +var _0x5b41=['isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','syncNewchannel','bind','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','syncVarSet','hasOwnProperty','channelstate','variable','syncFaxStatus','operation','status','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext'];(function(_0x3661e8,_0xdab197){var _0x1b34d4=function(_0x3e9f69){while(--_0x3e9f69){_0x3661e8['push'](_0x3661e8['shift']());}};_0x1b34d4(++_0xdab197);}(_0x5b41,0xf5));var _0x15b4=function(_0x35b105,_0x578c59){_0x35b105=_0x35b105-0x0;var _0x3780e9=_0x5b41[_0x35b105];return _0x3780e9;};'use strict';var util=require(_0x15b4('0x0'));var _=require(_0x15b4('0x1'));var BPromise=require(_0x15b4('0x2'));var uuid=require(_0x15b4('0x3'));var moment=require(_0x15b4('0x4'));var path=require(_0x15b4('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x15b4('0x6'));var logger=require(_0x15b4('0x7'))(_0x15b4('0x8'));var ami=require('../ami');var rpcDb=require(_0x15b4('0x9'));var Channel=require(_0x15b4('0xa'));var ut=require(_0x15b4('0xb'));var Action=require('./action');var faxAccount=require(_0x15b4('0xc'));var attachment=require(_0x15b4('0xd'));var faxMessage=require(_0x15b4('0xe'));function Fax(_0x2a3ede){this[_0x15b4('0xf')]={};this[_0x15b4('0x10')]=_0x2a3ede[_0x15b4('0x10')];this['trunks']=_0x2a3ede['trunks'];this[_0x15b4('0x11')]={};ami['on']('newchannel',this[_0x15b4('0x12')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x15b4('0x13')](this));ami['on'](_0x15b4('0x14'),this[_0x15b4('0x15')][_0x15b4('0x13')](this));ami['on']('newexten',this[_0x15b4('0x16')][_0x15b4('0x13')](this));ami['on'](_0x15b4('0x17'),this['syncFaxStatus'][_0x15b4('0x13')](this));ami['on'](_0x15b4('0x18'),this[_0x15b4('0x19')][_0x15b4('0x13')](this));ami['on']('hangup',this['syncHangup'][_0x15b4('0x13')](this));ami['on']('originateresponse',this[_0x15b4('0x1a')][_0x15b4('0x13')](this));}Fax[_0x15b4('0x1b')][_0x15b4('0x12')]=function(_0x3e31ef){if(_0x3e31ef[_0x15b4('0x1c')]===_0x15b4('0x1d')){for(var _0x525c87 in this[_0x15b4('0x10')]){if(this[_0x15b4('0x10')]['hasOwnProperty'](_0x525c87)){if(_0x3e31ef[_0x15b4('0x1e')]===this[_0x15b4('0x10')][_0x525c87][_0x15b4('0x1f')]){this['channels'][_0x3e31ef[_0x15b4('0x20')]]={};this['channels'][_0x3e31ef[_0x15b4('0x20')]][_0x15b4('0x21')]=_0x3e31ef[_0x15b4('0x21')];this['channels'][_0x3e31ef[_0x15b4('0x20')]]['id']=this[_0x15b4('0x10')][_0x525c87]['id'];this[_0x15b4('0xf')][_0x3e31ef['uniqueid']][_0x15b4('0x22')]=this[_0x15b4('0x10')][_0x525c87][_0x15b4('0x22')];logger['info'](_0x3e31ef[_0x15b4('0x20')],_0x15b4('0x23'));}}}}if(this[_0x15b4('0x11')][_0x3e31ef['uniqueid']]){this[_0x15b4('0xf')][_0x3e31ef['uniqueid']]={};this[_0x15b4('0xf')][_0x3e31ef[_0x15b4('0x20')]]['channel']=_0x3e31ef[_0x15b4('0x21')];logger['info'](_0x3e31ef[_0x15b4('0x20')],'\x20syncNewchannel\x20');}};Fax[_0x15b4('0x1b')][_0x15b4('0x24')]=function(_0x43729a){if(this[_0x15b4('0xf')][_0x43729a[_0x15b4('0x20')]]){for(var _0x1aafce in _0x43729a['variable']){if(_0x43729a['variable'][_0x15b4('0x25')](_0x1aafce)){this['channels'][_0x43729a[_0x15b4('0x20')]][_0x1aafce]=_0x43729a['value'];}}}};Fax[_0x15b4('0x1b')][_0x15b4('0x15')]=function(_0x197801){if(this[_0x15b4('0xf')][_0x197801[_0x15b4('0x20')]]){this[_0x15b4('0xf')][_0x197801['uniqueid']][_0x15b4('0x26')]=_0x197801[_0x15b4('0x26')];this[_0x15b4('0xf')][_0x197801[_0x15b4('0x20')]]['channelstatedesc']=_0x197801['channelstatedesc'];}};Fax[_0x15b4('0x1b')][_0x15b4('0x16')]=function(_0x4c114b){if(this[_0x15b4('0xf')][_0x4c114b['uniqueid']]){for(var _0x2f0b7d in _0x4c114b['variable']){if(_0x4c114b[_0x15b4('0x27')][_0x15b4('0x25')](_0x2f0b7d)){this[_0x15b4('0xf')][_0x4c114b['uniqueid']][_0x2f0b7d]=_0x4c114b['value'];}}}};Fax['prototype'][_0x15b4('0x28')]=function(_0x39e7ac){if(this[_0x15b4('0xf')][_0x39e7ac[_0x15b4('0x20')]]){this[_0x15b4('0xf')][_0x39e7ac['uniqueid']][_0x15b4('0x29')]=_0x39e7ac[_0x15b4('0x29')];this['channels'][_0x39e7ac[_0x15b4('0x20')]][_0x15b4('0x2a')]=_0x39e7ac['status'];this[_0x15b4('0xf')][_0x39e7ac[_0x15b4('0x20')]]['localstationid']=_0x39e7ac[_0x15b4('0x1f')];this['channels'][_0x39e7ac[_0x15b4('0x20')]][_0x15b4('0x2b')]=_0x39e7ac[_0x15b4('0x2b')];logger[_0x15b4('0x2c')](_0x39e7ac[_0x15b4('0x20')],_0x15b4('0x2d'));}};Fax[_0x15b4('0x1b')]['syncReceiveFax']=function(_0x59c078){var _0x39eb5a=this;if(this[_0x15b4('0xf')][_0x59c078['uniqueid']]){var _0x2b0f48=this[_0x15b4('0xf')][_0x59c078['uniqueid']]['id'];this['channels'][_0x59c078[_0x15b4('0x20')]][_0x15b4('0x2e')]=_0x59c078[_0x15b4('0x2e')];this['channels'][_0x59c078['uniqueid']][_0x15b4('0x2f')]=_0x59c078[_0x15b4('0x2f')];this['channels'][_0x59c078[_0x15b4('0x20')]][_0x15b4('0x1f')]=_0x59c078['localstationid'];this['channels'][_0x59c078[_0x15b4('0x20')]][_0x15b4('0x30')]=_0x59c078[_0x15b4('0x30')];this['channels'][_0x59c078[_0x15b4('0x20')]][_0x15b4('0x31')]=_0x59c078[_0x15b4('0x31')];this['channels'][_0x59c078[_0x15b4('0x20')]][_0x15b4('0x2b')]=_0x59c078[_0x15b4('0x2b')];this[_0x15b4('0xf')][_0x59c078[_0x15b4('0x20')]][_0x15b4('0x32')]=_0x59c078[_0x15b4('0x32')];if(this[_0x15b4('0xf')][_0x59c078[_0x15b4('0x20')]][_0x15b4('0x2f')]>0x0){tiff2pdf(_0x59c078[_0x15b4('0x2b')],_0x15b4('0x33'),function(_0x527f33){logger[_0x15b4('0x2c')](_0x59c078[_0x15b4('0x20')],_0x15b4('0x34'),_0x527f33['message']);attachment[_0x15b4('0x35')]({'name':path[_0x15b4('0x36')](_0x59c078[_0x15b4('0x2b')])[_0x15b4('0x22')],'basename':path[_0x15b4('0x36')](_0x59c078['filename'])[_0x15b4('0x22')]+_0x15b4('0x37'),'type':_0x15b4('0x38')})[_0x15b4('0x39')](function(_0x51b2e1){faxAccount[_0x15b4('0x3a')](_0x2b0f48,{'from':_0x59c078[_0x15b4('0x32')],'mapKey':'fax','body':path[_0x15b4('0x36')](_0x59c078[_0x15b4('0x2b')])[_0x15b4('0x22')]+_0x15b4('0x37'),'AttachmentId':_0x51b2e1['id']})[_0x15b4('0x3b')](function(_0x5b4b7b){logger[_0x15b4('0x3c')](_0x59c078[_0x15b4('0x20')],'\x20notify\x20',JSON[_0x15b4('0x3d')](_0x5b4b7b));});})['catch'](function(_0x45f0e4){logger[_0x15b4('0x3c')](_0x59c078['uniqueid'],_0x15b4('0x3e'),JSON[_0x15b4('0x3d')](_0x45f0e4));});});}logger[_0x15b4('0x2c')](_0x59c078['uniqueid'],_0x15b4('0x3e'));}};Fax[_0x15b4('0x1b')][_0x15b4('0x1a')]=function(_0x28e909){if(this[_0x15b4('0x11')][_0x28e909['uniqueid']]){_[_0x15b4('0x3f')](this[_0x15b4('0xf')][_0x28e909[_0x15b4('0x20')]],_[_0x15b4('0x40')](_0x28e909,[_0x15b4('0x41'),_0x15b4('0x42')]));}};function updateStatus(_0x2e7c5e){if(_0x2e7c5e[_0x15b4('0x43')]){faxMessage[_0x15b4('0x44')](_0x2e7c5e[_0x15b4('0x43')],{'failMessage':_0x15b4('0x45')})[_0x15b4('0x39')](function(_0x1f0844){ut['logger']('[Fax][Message][Error][Updated]',_0x1f0844);})['catch'](function(_0x458f4b){ut[_0x15b4('0x46')](_0x15b4('0x47'),_0x458f4b);});}else{ut[_0x15b4('0x46')](_0x15b4('0x48'));}}Fax[_0x15b4('0x1b')][_0x15b4('0x49')]=function(_0xc52b90,_0x55efd9,_0x5cbeeb){var _0x21f801=this;var _0x1fa110={};if(_0x55efd9){_0x1fa110={'read':_0x55efd9};}else{_0x1fa110={'failMessage':_0x5cbeeb};}if(this[_0x15b4('0x11')][_0xc52b90]['AttachmentId']){faxMessage[_0x15b4('0x44')](this[_0x15b4('0x11')][_0xc52b90][_0x15b4('0x43')],_0x1fa110)[_0x15b4('0x39')](function(_0x10a6d9){ut[_0x15b4('0x46')](_0x15b4('0x4a'),_0x10a6d9);})['catch'](function(_0x15c29a){ut[_0x15b4('0x46')](_0x15b4('0x4b'),_0x15c29a);})[_0x15b4('0x4c')](function(){delete _0x21f801[_0x15b4('0xf')][_0xc52b90];delete _0x21f801[_0x15b4('0x11')][_0xc52b90];});}else{ut[_0x15b4('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0x15b4('0xf')][_0xc52b90];delete this['actions'][_0xc52b90];}};Fax['prototype'][_0x15b4('0x4d')]=function(_0xc10391){var _0x5a8fee=this;if(this[_0x15b4('0xf')][_0xc10391['uniqueid']]){if(this['actions'][_0xc10391['uniqueid']]){this['channels'][_0xc10391[_0x15b4('0x20')]]['id']=this[_0x15b4('0x11')][_0xc10391['uniqueid']]['id'];this[_0x15b4('0xf')][_0xc10391[_0x15b4('0x20')]][_0x15b4('0x22')]=this[_0x15b4('0x11')][_0xc10391[_0x15b4('0x20')]]['name'];}logger[_0x15b4('0x2c')](_0xc10391[_0x15b4('0x20')],this[_0x15b4('0x11')][_0xc10391[_0x15b4('0x20')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x15b4('0x3d')](this['channels'][_0xc10391[_0x15b4('0x20')]]));if(this[_0x15b4('0x11')][_0xc10391[_0x15b4('0x20')]]){if(this[_0x15b4('0xf')][_0xc10391['uniqueid']][_0x15b4('0x4e')]>0x0&&this[_0x15b4('0xf')][_0xc10391[_0x15b4('0x20')]][_0x15b4('0x17')]===_0x15b4('0x4f')){this['updateStatus'](_0xc10391['uniqueid'],!![]);}else{this[_0x15b4('0x49')](_0xc10391[_0x15b4('0x20')],![],this[_0x15b4('0xf')][_0xc10391[_0x15b4('0x20')]]['faxstatusstring']?_0x15b4('0x50')+this['channels'][_0xc10391['uniqueid']][_0x15b4('0x51')]:_0x15b4('0x52'));}}}};Fax[_0x15b4('0x1b')]['send']=function(_0x158312){var _0x1a3be4=this;return new BPromise(function(_0x3e88a8,_0x13cbdc){_0x1a3be4[_0x15b4('0x53')](_0x158312,_0x1a3be4[_0x15b4('0x10')][_0x158312[_0x15b4('0x54')]])['then'](function(_0x12bbe9){ut[_0x15b4('0x46')](_0x15b4('0x55'),_0x12bbe9);_0x3e88a8(ut[_0x15b4('0x56')](_0x15b4('0x57')));})[_0x15b4('0x3b')](function(_0x2b421d){ut[_0x15b4('0x46')](_0x15b4('0x58'),_0x2b421d);updateStatus(_0x158312);_0x13cbdc(ut[_0x15b4('0x56')]('Fax\x20failed'));});});};Fax['prototype'][_0x15b4('0x59')]=function(_0x12679c){var _0x213e2f=this;return new BPromise(function(_0x12b50f,_0xf6016e){var _0x3552d2=_0x213e2f[_0x15b4('0x5a')](_0x213e2f[_0x15b4('0x10')][_0x12679c['FaxAccountId']][_0x15b4('0x5b')],_0x12679c);if(_0x3552d2['isValid']){_0x12b50f(ut[_0x15b4('0x56')](_0x15b4('0x5c')));}else{_0xf6016e(ut[_0x15b4('0x56')](_0x3552d2['message']));}});};function originate(_0x9d45ee,_0x56ccfa,_0x3cf35b){return new BPromise(function(_0x5eefa0,_0x8a9031){if(_0x3cf35b){var _0x5d825f=util[_0x15b4('0x5d')](_0x15b4('0x5e'),path[_0x15b4('0x36')](_0x9d45ee[_0x15b4('0x5')])[_0x15b4('0x22')],_0x9d45ee[_0x15b4('0x5')]);gs[_0x15b4('0x5f')](_0x5d825f)[_0x15b4('0x39')](function(){_0x9d45ee[_0x15b4('0x5')]=util[_0x15b4('0x5d')](_0x15b4('0x60'),path[_0x15b4('0x36')](_0x9d45ee['path'])['dir'],path[_0x15b4('0x36')](_0x9d45ee[_0x15b4('0x5')])[_0x15b4('0x22')]);_0x56ccfa[_0x15b4('0x61')]=_0x9d45ee['path'];ut['logger'](_0x15b4('0x62'),'');ami[_0x15b4('0x63')](ut[_0x15b4('0x64')](_0x9d45ee,_0x56ccfa))['then'](function(_0x5a158f){_0x5eefa0(_0x5a158f);})[_0x15b4('0x3b')](function(_0x153bb5){_0x8a9031(_0x153bb5);});})[_0x15b4('0x3b')](function(_0x1815a8){_0x8a9031(_0x1815a8);});}else{ami[_0x15b4('0x63')](ut[_0x15b4('0x64')](_0x9d45ee,_0x56ccfa))[_0x15b4('0x39')](function(_0x120069){_0x5eefa0(_0x120069);})[_0x15b4('0x3b')](function(_0x5dae47){_0x8a9031(_0x5dae47);});}});}Fax['prototype']['execOriginate']=function(_0x335c9c,_0x73b210){var _0x324860=this;return new BPromise(function(_0x341c23,_0x3619bd){var _0x247cd2=uuid['v4']();var _0x4439e5=ut[_0x15b4('0x65')](_0x335c9c,_0x73b210);_0x324860[_0x15b4('0x11')][_0x247cd2]=new Action(_0x247cd2,_0x73b210,_0x335c9c);var _0x5566dc=_0x324860['actions'][_0x247cd2];if(path['parse'](_0x335c9c[_0x15b4('0x5')])[_0x15b4('0x66')]===_0x15b4('0x37')){originate(_0x5566dc,_0x4439e5,!![])[_0x15b4('0x39')](function(_0x4fc4ec){_0x341c23(_0x4fc4ec);})[_0x15b4('0x3b')](function(_0x5ddb11){_0x3619bd(_0x5ddb11);});}else{originate(_0x5566dc,_0x4439e5,![])['then'](function(_0x3c9895){_0x341c23(_0x3c9895);})[_0x15b4('0x3b')](function(_0x1c6b37){_0x3619bd(_0x1c6b37);});}});};Fax[_0x15b4('0x1b')][_0x15b4('0x67')]=function(_0x2a76b4){return!_[_0x15b4('0x68')](_0x2a76b4)&&!_[_0x15b4('0x68')](_0x2a76b4[_0x15b4('0x22')])&&!_['isNil'](_0x2a76b4[_0x15b4('0x69')])&&_0x2a76b4['active']&&!_[_0x15b4('0x68')](this[_0x15b4('0x6a')][util[_0x15b4('0x5d')](_0x15b4('0x6b'),_0x2a76b4[_0x15b4('0x22')])])&&!_[_0x15b4('0x68')](this[_0x15b4('0x6a')][util[_0x15b4('0x5d')](_0x15b4('0x6b'),_0x2a76b4[_0x15b4('0x22')])]['status'])&&(this['trunks'][util[_0x15b4('0x5d')](_0x15b4('0x6b'),_0x2a76b4['name'])]['status']===_0x15b4('0x6c')||this[_0x15b4('0x6a')][util['format'](_0x15b4('0x6b'),_0x2a76b4[_0x15b4('0x22')])][_0x15b4('0x2a')]===_0x15b4('0x6d'));};Fax[_0x15b4('0x1b')]['checkTrunk']=function(_0xe3573d,_0xe47b87){if(!this[_0x15b4('0x67')](_0xe3573d)){ut[_0x15b4('0x46')](_0x15b4('0x6e'),_[_0x15b4('0x68')](_0xe3573d)?'':_0xe3573d[_0x15b4('0x22')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x15b4('0x6f')};}if(_[_0x15b4('0x68')](_0xe47b87['fax'])){ut[_0x15b4('0x46')](_0x15b4('0x70'),JSON['stringify'](_0xe47b87));return{'isValid':![],'message':_0x15b4('0x71')};}if(_[_0x15b4('0x68')](_0xe47b87[_0x15b4('0x5')])){ut[_0x15b4('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x15b4('0x3d')](_0xe47b87));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x15b4('0x72')};};module[_0x15b4('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 56e5a5e..2eaccf9 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 _0x7dc0=['preview','lodash','error','inspect','notify','then','catch','[Notify]\x20','bluebird'];(function(_0x4d6a9e,_0x367e3e){var _0x1e4526=function(_0x560510){while(--_0x560510){_0x4d6a9e['push'](_0x4d6a9e['shift']());}};_0x1e4526(++_0x367e3e);}(_0x7dc0,0x1a6));var _0x07dc=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x7dc0[_0x231b2e];return _0x3feb2a;};'use strict';var util=require('util');var BPromise=require(_0x07dc('0x0'));var logger=require('../../../config/logger')(_0x07dc('0x1'));var _=require(_0x07dc('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2675e9){return function(_0x2e35ec){logger[_0x07dc('0x3')](_0x2675e9,util[_0x07dc('0x4')](_0x2e35ec,{'showHidden':![],'depth':null}));};}exports[_0x07dc('0x5')]=function(_0x1aa09e,_0x2714f4){return BPromise['resolve']()[_0x07dc('0x6')](faxAccount[_0x07dc('0x5')](_0x1aa09e,_0x2714f4))[_0x07dc('0x7')](loggerCatch(_0x07dc('0x8')));}; \ No newline at end of file +var _0x5215=['../../../config/logger','preview','inspect','resolve','then','notify','catch','util'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0x5215,0x8f));var _0x5521=function(_0x3faabd,_0x153807){_0x3faabd=_0x3faabd-0x0;var _0x465aa5=_0x5215[_0x3faabd];return _0x465aa5;};'use strict';var util=require(_0x5521('0x0'));var BPromise=require('bluebird');var logger=require(_0x5521('0x1'))(_0x5521('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xbad1b5){return function(_0x29e52c){logger['error'](_0xbad1b5,util[_0x5521('0x3')](_0x29e52c,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4385df,_0x375e65){return BPromise[_0x5521('0x4')]()[_0x5521('0x5')](faxAccount[_0x5521('0x6')](_0x4385df,_0x375e65))[_0x5521('0x7')](loggerCatch('[Notify]\x20'));}; \ 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 25ce62c..f9e78c6 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 _0x2b10=['execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec'];(function(_0x533f59,_0x35f294){var _0x3490cc=function(_0x5da0a6){while(--_0x5da0a6){_0x533f59['push'](_0x533f59['shift']());}};_0x3490cc(++_0x35f294);}(_0x2b10,0xaf));var _0x02b1=function(_0x153baf,_0x34b794){_0x153baf=_0x153baf-0x0;var _0x2d0596=_0x2b10[_0x153baf];return _0x2d0596;};'use strict';var util=require(_0x02b1('0x0'));var logger=require('../../../../config/logger')(_0x02b1('0x1'));var BPromise=require(_0x02b1('0x2'));var exec=require(_0x02b1('0x3'))[_0x02b1('0x4')];exports[_0x02b1('0x5')]=function(_0x3468f0){return new BPromise(function(_0x257143,_0x33f1cc){exec(_0x3468f0,function(_0x59bedd,_0x44c0f3,_0xadc142){logger['info'](_0x02b1('0x6'),_0x44c0f3);if(_0x59bedd){logger[_0x02b1('0x7')](_0x02b1('0x6'),_0x02b1('0x8'),util[_0x02b1('0x9')](_0x59bedd,{'showHidden':![],'depth':null}),_0x44c0f3,_0xadc142);_0x33f1cc(_0x59bedd);}_0x257143(_0x44c0f3);});});}; \ No newline at end of file +var _0x0df4=['fax','bluebird','exec','info','\x20Error\x20:','util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x0df4,0xf5));var _0x40df=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x0df4[_0x173d7e];return _0x2220d6;};'use strict';var util=require(_0x40df('0x0'));var logger=require('../../../../config/logger')(_0x40df('0x1'));var BPromise=require(_0x40df('0x2'));var exec=require('child_process')[_0x40df('0x3')];exports['execute']=function(_0x2dae49){return new BPromise(function(_0x54e8ab,_0x48d3f5){exec(_0x2dae49,function(_0x4a4a36,_0x4ac4d6,_0x3e6298){logger[_0x40df('0x4')]('Exec\x20gs',_0x4ac4d6);if(_0x4a4a36){logger['info']('Exec\x20gs',_0x40df('0x5'),util['inspect'](_0x4a4a36,{'showHidden':![],'depth':null}),_0x4ac4d6,_0x3e6298);_0x48d3f5(_0x4a4a36);}_0x54e8ab(_0x4ac4d6);});});}; \ 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 2487893..405a95e 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 _0xd0b3=['addVariables','minrate','\x22%s\x22','modem','t38timeout','path','originate','channel','xcally-motion-fax','from-sip','format','headerinfo','localstationid','uniqueid','moment','fax','message','logger','info','inspect'];(function(_0x232587,_0x5b5b54){var _0x3f3b5b=function(_0x3fd3a1){while(--_0x3fd3a1){_0x232587['push'](_0x232587['shift']());}};_0x3f3b5b(++_0x5b5b54);}(_0xd0b3,0x72));var _0x3d0b=function(_0x1e50ac,_0x30423b){_0x1e50ac=_0x1e50ac-0x0;var _0x347fb4=_0xd0b3[_0x1e50ac];return _0x347fb4;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3d0b('0x0'));var logger=require('../../../../config/logger')(_0x3d0b('0x1'));exports[_0x3d0b('0x2')]=function(_0x350fa8){return{'message':_0x350fa8};};exports[_0x3d0b('0x3')]=function(_0xc373b4,_0x2055aa){logger[_0x3d0b('0x4')](_0xc373b4,util[_0x3d0b('0x5')](_0x2055aa,{'showHidden':![],'depth':null}));};exports[_0x3d0b('0x6')]=function(_0x3c63c5,_0xfd6b07){var _0x51408e={'XMF-ECM':_0xfd6b07['ecm'],'XMF-HEADERINFO':_0xfd6b07['headerinfo'],'XMF-MINRATE':_0xfd6b07[_0x3d0b('0x7')],'XMF-MAXRATE':_0xfd6b07['maxrate'],'XMF-MODEM':util['format'](_0x3d0b('0x8'),_0xfd6b07[_0x3d0b('0x9')]),'XMF-GATEWAY':_0xfd6b07['gateway'],'XMF-FAXDETECT':_0xfd6b07['faxdetect'],'XMF-T38TIMEOUT':_0xfd6b07[_0x3d0b('0xa')],'XMF-LOCALSTATIONID':_0xfd6b07['localstationid'],'XMF-PATH':_0x3c63c5[_0x3d0b('0xb')]};return _0x51408e;};exports['variablesAction']=function(_0x424855,_0x1734ff){return{'actionid':_0x424855['uniqueid'],'action':_0x3d0b('0xc'),'channel':_0x424855[_0x3d0b('0xd')],'Exten':_0x3d0b('0xe'),'Context':_0x3d0b('0xf'),'Priority':'1','callerid':util[_0x3d0b('0x10')]('\x22%s\x22\x20<%s>',_0x424855[_0x3d0b('0x11')]?_0x424855[_0x3d0b('0x11')]:'',_0x424855[_0x3d0b('0x12')]),'variable':_0x1734ff,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x424855[_0x3d0b('0x13')]};}; \ No newline at end of file +var _0xebf3=['util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid'];(function(_0x624cbf,_0x59be9e){var _0x1d8f7d=function(_0x9fd354){while(--_0x9fd354){_0x624cbf['push'](_0x624cbf['shift']());}};_0x1d8f7d(++_0x59be9e);}(_0xebf3,0x114));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3ebf('0x0'));var _=require(_0x3ebf('0x1'));var moment=require(_0x3ebf('0x2'));var logger=require(_0x3ebf('0x3'))(_0x3ebf('0x4'));exports['message']=function(_0x46b69c){return{'message':_0x46b69c};};exports[_0x3ebf('0x5')]=function(_0x219c40,_0x5e9b18){logger[_0x3ebf('0x6')](_0x219c40,util[_0x3ebf('0x7')](_0x5e9b18,{'showHidden':![],'depth':null}));};exports[_0x3ebf('0x8')]=function(_0x13836e,_0x13889e){var _0x3e44aa={'XMF-ECM':_0x13889e[_0x3ebf('0x9')],'XMF-HEADERINFO':_0x13889e[_0x3ebf('0xa')],'XMF-MINRATE':_0x13889e[_0x3ebf('0xb')],'XMF-MAXRATE':_0x13889e['maxrate'],'XMF-MODEM':util[_0x3ebf('0xc')](_0x3ebf('0xd'),_0x13889e[_0x3ebf('0xe')]),'XMF-GATEWAY':_0x13889e[_0x3ebf('0xf')],'XMF-FAXDETECT':_0x13889e[_0x3ebf('0x10')],'XMF-T38TIMEOUT':_0x13889e['t38timeout'],'XMF-LOCALSTATIONID':_0x13889e['localstationid'],'XMF-PATH':_0x13836e['path']};return _0x3e44aa;};exports['variablesAction']=function(_0x21ed44,_0x143e83){return{'actionid':_0x21ed44[_0x3ebf('0x11')],'action':'originate','channel':_0x21ed44[_0x3ebf('0x12')],'Exten':_0x3ebf('0x13'),'Context':_0x3ebf('0x14'),'Priority':'1','callerid':util[_0x3ebf('0xc')](_0x3ebf('0x15'),_0x21ed44[_0x3ebf('0xa')]?_0x21ed44[_0x3ebf('0xa')]:'',_0x21ed44[_0x3ebf('0x16')]),'variable':_0x143e83,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x21ed44[_0x3ebf('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ab00e2b..30e72c0 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 _0xd862=['../../config/logger','get','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','sync','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow'];(function(_0x4afb62,_0x31c09d){var _0x46280c=function(_0x2d7648){while(--_0x2d7648){_0x4afb62['push'](_0x4afb62['shift']());}};_0x46280c(++_0x31c09d);}(_0xd862,0x193));var _0x2d86=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xd862[_0x2080a3];return _0x8d7d17;};'use strict';var BPromise=require('bluebird');var util=require(_0x2d86('0x0'));var moment=require(_0x2d86('0x1'));var server=require(_0x2d86('0x2'));var Realtime=require(_0x2d86('0x3'));var Report=require(_0x2d86('0x4'));var Acw=require(_0x2d86('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x2d86('0x6'));var Preview=require(_0x2d86('0x7'));var Fax=require('./fax');var user=require(_0x2d86('0x8'));var voiceQueue=require(_0x2d86('0x9'));var voiceQueueReport=require(_0x2d86('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x2d86('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x2d86('0xc'));var cmHopperHistory=require(_0x2d86('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x2d86('0xe'));var faxAccount=require(_0x2d86('0xf'));var zendesk=require(_0x2d86('0x10'));var salesforce=require(_0x2d86('0x11'));var sugarcrm=require(_0x2d86('0x12'));var freshdesk=require(_0x2d86('0x13'));var desk=require(_0x2d86('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x2d86('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x2d86('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x2d86('0x17'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2d86('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2d86('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2d86('0x19')]()[_0x2d86('0x1a')](user[_0x2d86('0x1b')]())[_0x2d86('0x1a')](realtime['initAgents']())['then'](user[_0x2d86('0x1c')]())['then'](realtime[_0x2d86('0x1d')]())[_0x2d86('0x1a')](trunk[_0x2d86('0x1e')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x1f')]())[_0x2d86('0x1a')](voiceQueue[_0x2d86('0x20')]())[_0x2d86('0x1a')](realtime['initVoiceQueues']())[_0x2d86('0x1a')](trigger[_0x2d86('0x21')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x22')]())[_0x2d86('0x1a')](template[_0x2d86('0x23')]())['then'](realtime['initTemplates']())['then'](zendesk['getZendeskAccounts']())['then'](realtime[_0x2d86('0x24')]())[_0x2d86('0x1a')](salesforce[_0x2d86('0x25')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x26')]())[_0x2d86('0x1a')](sugarcrm[_0x2d86('0x27')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x28')]())[_0x2d86('0x1a')](freshdesk[_0x2d86('0x29')]())[_0x2d86('0x1a')](realtime['initFreshdeskAccounts']())[_0x2d86('0x1a')](desk[_0x2d86('0x2a')]())['then'](realtime[_0x2d86('0x2b')]())['then'](zoho[_0x2d86('0x2c')]())['then'](realtime[_0x2d86('0x2d')]())[_0x2d86('0x1a')](vtiger[_0x2d86('0x2e')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x2f')]())[_0x2d86('0x1a')](freshsales[_0x2d86('0x30')]())['then'](realtime[_0x2d86('0x31')]())[_0x2d86('0x1a')](servicenow[_0x2d86('0x32')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x33')]())[_0x2d86('0x1a')](dynamics365[_0x2d86('0x34')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x35')]())[_0x2d86('0x1a')](campaign[_0x2d86('0x36')]())['then'](realtime[_0x2d86('0x37')]())[_0x2d86('0x1a')](voiceExtension[_0x2d86('0x38')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x39')]())['then'](faxAccount[_0x2d86('0x3a')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x3b')]())[_0x2d86('0x1a')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x2d86('0x1a')](voiceQueueReport[_0x2d86('0x3c')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x3d')]())[_0x2d86('0x1a')](cmHopperHistory[_0x2d86('0x3e')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x2d86('0x1a')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x2d86('0x3f')]())[_0x2d86('0x1a')](voiceCallReport[_0x2d86('0x40')]())[_0x2d86('0x1a')](realtime[_0x2d86('0x41')]())[_0x2d86('0x42')](function(_0x5ec507){logger[_0x2d86('0x43')]('[index.js][initParams]',util['inspect'](_0x5ec507,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x2d86('0x1a')](function(_0x3bbb9b){return initRealtime();})[_0x2d86('0x1a')](function(){return initParams();})[_0x2d86('0x1a')](function(){report[_0x2d86('0x44')]();setInterval(initRealtime,0x1388);})[_0x2d86('0x42')](function(_0x191e24){logger[_0x2d86('0x43')](_0x2d86('0x45'),util[_0x2d86('0x46')](_0x191e24,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x538a=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','moment','./server','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getServicenowAccounts'];(function(_0x3b8d6c,_0x29aa13){var _0x5c79b3=function(_0x531c3c){while(--_0x531c3c){_0x3b8d6c['push'](_0x3b8d6c['shift']());}};_0x5c79b3(++_0x29aa13);}(_0x538a,0x176));var _0xa538=function(_0x531bf4,_0x4d692a){_0x531bf4=_0x531bf4-0x0;var _0x5bc23d=_0x538a[_0x531bf4];return _0x5bc23d;};'use strict';var BPromise=require(_0xa538('0x0'));var util=require('util');var moment=require(_0xa538('0x1'));var server=require(_0xa538('0x2'));var Realtime=require('./realtime');var Report=require(_0xa538('0x3'));var Acw=require(_0xa538('0x4'));var Trigger=require(_0xa538('0x5'));var Dialer=require('./dialer');var Preview=require(_0xa538('0x6'));var Fax=require(_0xa538('0x7'));var user=require(_0xa538('0x8'));var voiceQueue=require(_0xa538('0x9'));var voiceQueueReport=require(_0xa538('0xa'));var voiceCallReport=require(_0xa538('0xb'));var trunk=require(_0xa538('0xc'));var trigger=require(_0xa538('0xd'));var template=require(_0xa538('0xe'));var cmHopperHistory=require(_0xa538('0xf'));var campaign=require(_0xa538('0x10'));var voiceExtension=require(_0xa538('0x11'));var faxAccount=require(_0xa538('0x12'));var zendesk=require(_0xa538('0x13'));var salesforce=require(_0xa538('0x14'));var sugarcrm=require(_0xa538('0x15'));var freshdesk=require(_0xa538('0x16'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xa538('0x17'));var freshsales=require(_0xa538('0x18'));var servicenow=require(_0xa538('0x19'));var dynamics365=require(_0xa538('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(_0xa538('0x1b'))(_0xa538('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa538('0x1d')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa538('0x1d')](_0xa538('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa538('0x1f')]()[_0xa538('0x20')](user[_0xa538('0x21')]())[_0xa538('0x20')](realtime[_0xa538('0x22')]())[_0xa538('0x20')](user[_0xa538('0x23')]())[_0xa538('0x20')](realtime[_0xa538('0x24')]())[_0xa538('0x20')](trunk[_0xa538('0x25')]())[_0xa538('0x20')](realtime[_0xa538('0x26')]())[_0xa538('0x20')](voiceQueue[_0xa538('0x27')]())[_0xa538('0x20')](realtime['initVoiceQueues']())[_0xa538('0x20')](trigger[_0xa538('0x28')]())[_0xa538('0x20')](realtime['initTriggers']())['then'](template['getTemplates']())[_0xa538('0x20')](realtime[_0xa538('0x29')]())[_0xa538('0x20')](zendesk[_0xa538('0x2a')]())[_0xa538('0x20')](realtime[_0xa538('0x2b')]())[_0xa538('0x20')](salesforce[_0xa538('0x2c')]())[_0xa538('0x20')](realtime['initSalesforceAccounts']())['then'](sugarcrm['getSugarcrmAccounts']())[_0xa538('0x20')](realtime[_0xa538('0x2d')]())['then'](freshdesk[_0xa538('0x2e')]())[_0xa538('0x20')](realtime['initFreshdeskAccounts']())[_0xa538('0x20')](desk[_0xa538('0x2f')]())[_0xa538('0x20')](realtime[_0xa538('0x30')]())[_0xa538('0x20')](zoho['getZohoAccounts']())[_0xa538('0x20')](realtime[_0xa538('0x31')]())[_0xa538('0x20')](vtiger[_0xa538('0x32')]())[_0xa538('0x20')](realtime['initVtigerAccounts']())[_0xa538('0x20')](freshsales['getFreshsalesAccounts']())[_0xa538('0x20')](realtime['initFreshsalesAccounts']())[_0xa538('0x20')](servicenow[_0xa538('0x33')]())[_0xa538('0x20')](realtime['initServicenowAccounts']())[_0xa538('0x20')](dynamics365[_0xa538('0x34')]())['then'](realtime[_0xa538('0x35')]())[_0xa538('0x20')](campaign[_0xa538('0x36')]())['then'](realtime[_0xa538('0x37')]())['then'](voiceExtension['getVoiceExtensions']())[_0xa538('0x20')](realtime[_0xa538('0x38')]())['then'](faxAccount[_0xa538('0x39')]())[_0xa538('0x20')](realtime[_0xa538('0x3a')]())[_0xa538('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0xa538('0x1f')]()[_0xa538('0x20')](voiceQueueReport[_0xa538('0x3b')]())['then'](realtime[_0xa538('0x3c')]())[_0xa538('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xa538('0x20')](realtime['initVoiceQueueHopperHistory']())[_0xa538('0x20')](cmHopperHistory[_0xa538('0x3d')]())[_0xa538('0x20')](realtime[_0xa538('0x3e')]())[_0xa538('0x20')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0xa538('0x3f')]())[_0xa538('0x40')](function(_0x1361d2){logger[_0xa538('0x41')](_0xa538('0x42'),util[_0xa538('0x43')](_0x1361d2,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa538('0x44')](realtime,preview,fax)[_0xa538('0x20')](function(_0x534c52){return initRealtime();})[_0xa538('0x20')](function(){return initParams();})[_0xa538('0x20')](function(){report[_0xa538('0x45')]();setInterval(initRealtime,0x1388);})[_0xa538('0x40')](function(_0x111f18){logger[_0xa538('0x41')](_0xa538('0x46'),util['inspect'](_0x111f18,{'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 c07e68b..2940495 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x29fa3d,_0x45d24f){var _0x5d4bbf=function(_0x5b89ef){while(--_0x5b89ef){_0x29fa3d['push'](_0x29fa3d['shift']());}};_0x5d4bbf(++_0x45d24f);}(_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 moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4ea47e1..a1d043c 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 _0x0ce1=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x2c1e07,_0x4afdb3){var _0x2d5cb5=function(_0x47bf71){while(--_0x47bf71){_0x2c1e07['push'](_0x2c1e07['shift']());}};_0x2d5cb5(++_0x4afdb3);}(_0x0ce1,0x1c0));var _0x10ce=function(_0x13c90a,_0x182cea){_0x13c90a=_0x13c90a-0x0;var _0x47bc14=_0x0ce1[_0x13c90a];return _0x47bc14;};'use strict';function Campaign(_0x30f831){this['id']=_0x30f831['id']||0x0;this[_0x10ce('0x0')]=_0x30f831[_0x10ce('0x0')]||'';this[_0x10ce('0x1')]=_0x30f831[_0x10ce('0x1')]||_0x10ce('0x2');this[_0x10ce('0x3')]=0x0;this[_0x10ce('0x4')]=0x0;this[_0x10ce('0x5')]=0x0;this[_0x10ce('0x6')]=0x0;this[_0x10ce('0x7')]='';this[_0x10ce('0x8')]=!![];this['active']=_0x30f831['active'];this['limitCalls']=_0x30f831['limitCalls'];this[_0x10ce('0x9')]=_0x30f831[_0x10ce('0x9')]||null;this[_0x10ce('0xa')]=_0x30f831[_0x10ce('0xa')]?_0x30f831['dialGlobalInterval']:null;this[_0x10ce('0xb')]=_0x30f831['dialOriginateCallerIdName'];this[_0x10ce('0xc')]=_0x30f831[_0x10ce('0xc')];this[_0x10ce('0xd')]=_0x30f831[_0x10ce('0xd')]||0x1e;this[_0x10ce('0xe')]=_0x30f831[_0x10ce('0xe')];this['dialCongestionRetryFrequency']=_0x30f831['dialCongestionRetryFrequency'];this[_0x10ce('0xf')]=_0x30f831[_0x10ce('0xf')];this[_0x10ce('0x10')]=_0x30f831[_0x10ce('0x10')];this[_0x10ce('0x11')]=_0x30f831[_0x10ce('0x11')];this[_0x10ce('0x12')]=_0x30f831[_0x10ce('0x12')];this[_0x10ce('0x13')]=_0x30f831[_0x10ce('0x13')];this[_0x10ce('0x14')]=_0x30f831['dialNoSuchNumberMaxRetry']||0x3;this[_0x10ce('0x15')]=_0x30f831[_0x10ce('0x15')]||0x96;this[_0x10ce('0x16')]=_0x30f831['dialDropMaxRetry']||0x3;this[_0x10ce('0x17')]=_0x30f831[_0x10ce('0x17')]||0x96;this[_0x10ce('0x18')]=_0x30f831[_0x10ce('0x18')]||0x3;this[_0x10ce('0x19')]=_0x30f831['dialAbandonedRetryFrequency']||0x96;this[_0x10ce('0x1a')]=_0x30f831['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x30f831[_0x10ce('0x1b')]||0x96;this[_0x10ce('0x1c')]=_0x30f831[_0x10ce('0x1c')]||0x3;this[_0x10ce('0x1d')]=_0x30f831[_0x10ce('0x1d')]||0x96;this[_0x10ce('0x1e')]=_0x30f831[_0x10ce('0x1e')]||_0x10ce('0x1f');this[_0x10ce('0x20')]=_0x30f831[_0x10ce('0x20')]||undefined;this[_0x10ce('0x21')]=_0x30f831[_0x10ce('0x21')]||undefined;this[_0x10ce('0x22')]=_0x30f831['dialCutDigit']||undefined;this[_0x10ce('0x23')]=_0x30f831[_0x10ce('0x23')]?_0x30f831[_0x10ce('0x23')]:undefined;this[_0x10ce('0x24')]=_0x30f831[_0x10ce('0x24')]?_0x30f831[_0x10ce('0x24')]:undefined;this[_0x10ce('0x25')]=_0x30f831[_0x10ce('0x25')]?_0x30f831[_0x10ce('0x25')]:undefined;this['SquareProject']=_0x30f831[_0x10ce('0x26')]?_0x30f831['SquareProject']:undefined;this[_0x10ce('0x27')]=_0x30f831[_0x10ce('0x26')]?_0x30f831['SquareProject']['name']:undefined;this['dialAMDActive']=_0x30f831['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x30f831['dialAMDInitialSilence'];this[_0x10ce('0x28')]=_0x30f831[_0x10ce('0x28')];this['dialAMDAfterGreetingSilence']=_0x30f831[_0x10ce('0x29')];this[_0x10ce('0x2a')]=_0x30f831[_0x10ce('0x2a')];this[_0x10ce('0x2b')]=_0x30f831['dialAMDMinWordLength'];this[_0x10ce('0x2c')]=_0x30f831[_0x10ce('0x2c')];this[_0x10ce('0x2d')]=_0x30f831[_0x10ce('0x2d')];this[_0x10ce('0x2e')]=_0x30f831['dialAMDSilenceThreshold'];this[_0x10ce('0x2f')]=_0x30f831[_0x10ce('0x2f')];}module[_0x10ce('0x30')]=Campaign; \ No newline at end of file +var _0xf4a7=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf4a7,0x1d1));var _0x7f4a=function(_0x1741b1,_0x494db4){_0x1741b1=_0x1741b1-0x0;var _0x2d814b=_0xf4a7[_0x1741b1];return _0x2d814b;};'use strict';function Campaign(_0xc0be82){this['id']=_0xc0be82['id']||0x0;this['name']=_0xc0be82[_0x7f4a('0x0')]||'';this[_0x7f4a('0x1')]=_0xc0be82[_0x7f4a('0x1')]||_0x7f4a('0x2');this[_0x7f4a('0x3')]=0x0;this[_0x7f4a('0x4')]=0x0;this[_0x7f4a('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7f4a('0x6')]='';this[_0x7f4a('0x7')]=!![];this[_0x7f4a('0x8')]=_0xc0be82[_0x7f4a('0x8')];this[_0x7f4a('0x9')]=_0xc0be82[_0x7f4a('0x9')];this[_0x7f4a('0xa')]=_0xc0be82[_0x7f4a('0xa')]||null;this[_0x7f4a('0xb')]=_0xc0be82[_0x7f4a('0xb')]?_0xc0be82[_0x7f4a('0xb')]:null;this['dialOriginateCallerIdName']=_0xc0be82[_0x7f4a('0xc')];this[_0x7f4a('0xd')]=_0xc0be82[_0x7f4a('0xd')];this[_0x7f4a('0xe')]=_0xc0be82[_0x7f4a('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0xc0be82[_0x7f4a('0xf')];this[_0x7f4a('0x10')]=_0xc0be82[_0x7f4a('0x10')];this[_0x7f4a('0x11')]=_0xc0be82[_0x7f4a('0x11')];this[_0x7f4a('0x12')]=_0xc0be82['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0xc0be82[_0x7f4a('0x13')];this[_0x7f4a('0x14')]=_0xc0be82[_0x7f4a('0x14')];this[_0x7f4a('0x15')]=_0xc0be82[_0x7f4a('0x15')];this[_0x7f4a('0x16')]=_0xc0be82['dialNoSuchNumberMaxRetry']||0x3;this[_0x7f4a('0x17')]=_0xc0be82[_0x7f4a('0x17')]||0x96;this[_0x7f4a('0x18')]=_0xc0be82['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0xc0be82[_0x7f4a('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0xc0be82[_0x7f4a('0x1a')]||0x3;this[_0x7f4a('0x1b')]=_0xc0be82[_0x7f4a('0x1b')]||0x96;this[_0x7f4a('0x1c')]=_0xc0be82[_0x7f4a('0x1c')]||0x3;this[_0x7f4a('0x1d')]=_0xc0be82[_0x7f4a('0x1d')]||0x96;this[_0x7f4a('0x1e')]=_0xc0be82[_0x7f4a('0x1e')]||0x3;this[_0x7f4a('0x1f')]=_0xc0be82['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0xc0be82[_0x7f4a('0x20')]||_0x7f4a('0x21');this['dialPrefix']=_0xc0be82['dialPrefix']||undefined;this[_0x7f4a('0x22')]=_0xc0be82[_0x7f4a('0x22')]||undefined;this[_0x7f4a('0x23')]=_0xc0be82[_0x7f4a('0x23')]||undefined;this[_0x7f4a('0x24')]=_0xc0be82[_0x7f4a('0x24')]?_0xc0be82['TrunkBackup']:undefined;this[_0x7f4a('0x25')]=_0xc0be82[_0x7f4a('0x25')]?_0xc0be82[_0x7f4a('0x25')]:undefined;this[_0x7f4a('0x26')]=_0xc0be82[_0x7f4a('0x26')]?_0xc0be82[_0x7f4a('0x26')]:undefined;this[_0x7f4a('0x27')]=_0xc0be82['SquareProject']?_0xc0be82[_0x7f4a('0x27')]:undefined;this['dialQueueProject']=_0xc0be82[_0x7f4a('0x27')]?_0xc0be82[_0x7f4a('0x27')]['name']:undefined;this['dialAMDActive']=_0xc0be82[_0x7f4a('0x28')]||![];this[_0x7f4a('0x29')]=_0xc0be82[_0x7f4a('0x29')];this[_0x7f4a('0x2a')]=_0xc0be82[_0x7f4a('0x2a')];this[_0x7f4a('0x2b')]=_0xc0be82[_0x7f4a('0x2b')];this['dialAMDTotalAnalysisTime']=_0xc0be82[_0x7f4a('0x2c')];this['dialAMDMinWordLength']=_0xc0be82[_0x7f4a('0x2d')];this[_0x7f4a('0x2e')]=_0xc0be82['dialAMDBetweenWordsSilence'];this[_0x7f4a('0x2f')]=_0xc0be82[_0x7f4a('0x2f')];this['dialAMDSilenceThreshold']=_0xc0be82[_0x7f4a('0x30')];this[_0x7f4a('0x31')]=_0xc0be82[_0x7f4a('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 0806e4a..06bde56 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 _0x7cfa=['lastdata','duration','billableseconds','type','tag','monitor','monitorFilename','queue','transferconnectedlinenum','transferType','mohtime','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication'];(function(_0x50b157,_0x4801e6){var _0x7979bd=function(_0x1d7a16){while(--_0x1d7a16){_0x50b157['push'](_0x50b157['shift']());}};_0x7979bd(++_0x4801e6);}(_0x7cfa,0x137));var _0xa7cf=function(_0x43ff2b,_0x11678d){_0x43ff2b=_0x43ff2b-0x0;var _0x477e34=_0x7cfa[_0x43ff2b];return _0x477e34;};'use strict';function Channel(){this[_0xa7cf('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xa7cf('0x1')]=0x0;this[_0xa7cf('0x2')]='';this[_0xa7cf('0x3')]=undefined;this[_0xa7cf('0x4')]=undefined;this['accountcode']=0x0;this[_0xa7cf('0x5')]='';this['uniqueid']=0x0;this[_0xa7cf('0x6')]=0x0;this[_0xa7cf('0x7')]=0x0;this[_0xa7cf('0x8')]=![];this[_0xa7cf('0x9')]=null;this[_0xa7cf('0xa')]=null;this[_0xa7cf('0xb')]=![];this[_0xa7cf('0xc')]=![];this[_0xa7cf('0xd')]='';this[_0xa7cf('0xe')]='';this[_0xa7cf('0xf')]=0x0;this[_0xa7cf('0x10')]=0x0;this['holdtime']=0x0;this[_0xa7cf('0x11')]=null;this[_0xa7cf('0x12')]=null;this['disposition']=null;this[_0xa7cf('0x13')]=![];this[_0xa7cf('0x14')]=null;this[_0xa7cf('0x15')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xa7cf('0x16')]=undefined;this[_0xa7cf('0x17')]=undefined;this[_0xa7cf('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x0a93=['tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','answertime','endtime','lastapplication','lastdata','duration','holdtime','type'];(function(_0x45c1cc,_0x4ff8e7){var _0x5505c9=function(_0x1473aa){while(--_0x1473aa){_0x45c1cc['push'](_0x45c1cc['shift']());}};_0x5505c9(++_0x4ff8e7);}(_0x0a93,0x6a));var _0x30a9=function(_0x1f9d20,_0x14aa69){_0x1f9d20=_0x1f9d20-0x0;var _0x6460a0=_0x0a93[_0x1f9d20];return _0x6460a0;};'use strict';function Channel(){this[_0x30a9('0x0')]=null;this[_0x30a9('0x1')]='';this[_0x30a9('0x2')]='';this['calleridnum']=0x0;this[_0x30a9('0x3')]='';this[_0x30a9('0x4')]=undefined;this[_0x30a9('0x5')]=undefined;this[_0x30a9('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this['answered']=![];this[_0x30a9('0x7')]=null;this[_0x30a9('0x8')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x30a9('0x9')]='';this[_0x30a9('0xa')]='';this[_0x30a9('0xb')]=0x0;this['billableseconds']=0x0;this[_0x30a9('0xc')]=0x0;this[_0x30a9('0xd')]=null;this[_0x30a9('0xe')]=null;this[_0x30a9('0xf')]=null;this[_0x30a9('0x10')]=![];this[_0x30a9('0x11')]=null;this[_0x30a9('0x12')]=null;this[_0x30a9('0x13')]=[];this[_0x30a9('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x30a9('0x15')]=undefined;this[_0x30a9('0x16')]=0x0;}module[_0x30a9('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 153907d..8959b2b 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 _0x7311=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x56c485,_0x18b801){var _0x211c52=function(_0x5dd190){while(--_0x5dd190){_0x56c485['push'](_0x56c485['shift']());}};_0x211c52(++_0x18b801);}(_0x7311,0x18f));var _0x1731=function(_0x361fe1,_0x17d79a){_0x361fe1=_0x361fe1-0x0;var _0x4eec28=_0x7311[_0x361fe1];return _0x4eec28;};'use strict';function DeskAccount(_0x3c9f53){this['id']=_0x3c9f53['id']||0x0;this['name']=_0x3c9f53[_0x1731('0x0')]||'';this[_0x1731('0x1')]=_0x3c9f53[_0x1731('0x1')]||'';this[_0x1731('0x2')]=_0x3c9f53[_0x1731('0x2')]||'';this[_0x1731('0x3')]=_0x3c9f53[_0x1731('0x3')]||'';this[_0x1731('0x4')]=_0x3c9f53['password']||'';this[_0x1731('0x5')]=_0x3c9f53['consumerKey']||'';this[_0x1731('0x6')]=_0x3c9f53[_0x1731('0x6')]||'';this[_0x1731('0x7')]=_0x3c9f53[_0x1731('0x7')]||'';this[_0x1731('0x8')]=_0x3c9f53['tokenSecret']||'';this[_0x1731('0x9')]=_0x3c9f53['type']||'';this['serverUrl']=_0x3c9f53[_0x1731('0xa')]||'';this[_0x1731('0xb')]=_0x3c9f53[_0x1731('0xb')]||{};}module[_0x1731('0xc')]=DeskAccount; \ No newline at end of file +var _0xdcce=['serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xdcce,0x1ba));var _0xedcc=function(_0x4d25a5,_0x11b699){_0x4d25a5=_0x4d25a5-0x0;var _0x42f011=_0xdcce[_0x4d25a5];return _0x42f011;};'use strict';function DeskAccount(_0x2008b7){this['id']=_0x2008b7['id']||0x0;this[_0xedcc('0x0')]=_0x2008b7[_0xedcc('0x0')]||'';this[_0xedcc('0x1')]=_0x2008b7['username']||'';this[_0xedcc('0x2')]=_0x2008b7[_0xedcc('0x2')]||'';this[_0xedcc('0x3')]=_0x2008b7[_0xedcc('0x3')]||'';this[_0xedcc('0x4')]=_0x2008b7[_0xedcc('0x4')]||'';this[_0xedcc('0x5')]=_0x2008b7[_0xedcc('0x5')]||'';this['consumerSecret']=_0x2008b7[_0xedcc('0x6')]||'';this['token']=_0x2008b7['token']||'';this[_0xedcc('0x7')]=_0x2008b7[_0xedcc('0x7')]||'';this['type']=_0x2008b7['type']||'';this[_0xedcc('0x8')]=_0x2008b7[_0xedcc('0x8')]||'';this['Configurations']=_0x2008b7[_0xedcc('0x9')]||{};}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 0ff46d7..624967a 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 _0x3286=['Configurations','CloudProvider','exports','name','username','password','tenantId','clientSecret','serverUrl','modernAuthentication'];(function(_0x1e9578,_0x49e814){var _0x2be3c3=function(_0x23f269){while(--_0x23f269){_0x1e9578['push'](_0x1e9578['shift']());}};_0x2be3c3(++_0x49e814);}(_0x3286,0x193));var _0x6328=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3286[_0x14add3];return _0x4a174f;};'use strict';function Dynamics365Account(_0x28efa4){this['id']=_0x28efa4['id']||0x0;this[_0x6328('0x0')]=_0x28efa4[_0x6328('0x0')]||'';this[_0x6328('0x1')]=_0x28efa4[_0x6328('0x1')]||'';this[_0x6328('0x2')]=_0x28efa4['password']||'';this['remoteUri']=_0x28efa4['remoteUri']||'';this[_0x6328('0x3')]=_0x28efa4[_0x6328('0x3')]||'';this['clientId']=_0x28efa4['clientId']||'';this['clientSecret']=_0x28efa4[_0x6328('0x4')]||{};this[_0x6328('0x5')]=_0x28efa4[_0x6328('0x5')]||'';this[_0x6328('0x6')]=_0x28efa4[_0x6328('0x6')]||![];this[_0x6328('0x7')]=_0x28efa4[_0x6328('0x7')]||{};this[_0x6328('0x8')]=_0x28efa4[_0x6328('0x8')]||{};}module[_0x6328('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xfaec=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x5bf03a,_0x26d063){var _0x10a83e=function(_0x1b2f44){while(--_0x1b2f44){_0x5bf03a['push'](_0x5bf03a['shift']());}};_0x10a83e(++_0x26d063);}(_0xfaec,0x107));var _0xcfae=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfaec[_0x397e5f];return _0x5302b8;};'use strict';function Dynamics365Account(_0x419f19){this['id']=_0x419f19['id']||0x0;this[_0xcfae('0x0')]=_0x419f19[_0xcfae('0x0')]||'';this[_0xcfae('0x1')]=_0x419f19['username']||'';this[_0xcfae('0x2')]=_0x419f19[_0xcfae('0x2')]||'';this[_0xcfae('0x3')]=_0x419f19[_0xcfae('0x3')]||'';this[_0xcfae('0x4')]=_0x419f19[_0xcfae('0x4')]||'';this[_0xcfae('0x5')]=_0x419f19['clientId']||'';this[_0xcfae('0x6')]=_0x419f19[_0xcfae('0x6')]||{};this[_0xcfae('0x7')]=_0x419f19[_0xcfae('0x7')]||'';this['modernAuthentication']=_0x419f19[_0xcfae('0x8')]||![];this[_0xcfae('0x9')]=_0x419f19[_0xcfae('0x9')]||{};this[_0xcfae('0xa')]=_0x419f19[_0xcfae('0xa')]||{};}module[_0xcfae('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d3bc3a3..8838e60 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 _0xbc7f=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x4287e9,_0x31f01c){var _0x2f8390=function(_0xb41856){while(--_0xb41856){_0x4287e9['push'](_0x4287e9['shift']());}};_0x2f8390(++_0x31f01c);}(_0xbc7f,0x137));var _0xfbc7=function(_0x4e655b,_0x54ebd1){_0x4e655b=_0x4e655b-0x0;var _0x22c98c=_0xbc7f[_0x4e655b];return _0x22c98c;};'use strict';function FaxAccount(_0x250634){this['id']=_0x250634['id']||0x0;this['name']=_0x250634[_0xfbc7('0x0')]||'';this[_0xfbc7('0x1')]=_0x250634[_0xfbc7('0x1')];this[_0xfbc7('0x2')]=_0x250634[_0xfbc7('0x2')];this[_0xfbc7('0x3')]=_0x250634[_0xfbc7('0x3')];this[_0xfbc7('0x4')]=_0x250634['localstationid'];this[_0xfbc7('0x5')]=_0x250634['minrate']||0x960;this[_0xfbc7('0x6')]=_0x250634[_0xfbc7('0x6')]||0x3840;this[_0xfbc7('0x7')]=_0x250634[_0xfbc7('0x7')]||_0xfbc7('0x8');this['gateway']=_0x250634[_0xfbc7('0x9')]||'no';this[_0xfbc7('0xa')]=_0x250634[_0xfbc7('0xa')]||'no';this[_0xfbc7('0xb')]=_0x250634[_0xfbc7('0xb')]||0x1388;this['tech']=_0x250634[_0xfbc7('0xc')]||_0xfbc7('0xd');this[_0xfbc7('0xe')]=_0x250634[_0xfbc7('0xe')]?_0x250634[_0xfbc7('0xe')]:undefined;this[_0xfbc7('0xf')]=_0x250634[_0xfbc7('0xf')];this[_0xfbc7('0x10')]=_0x250634[_0xfbc7('0x10')];}module[_0xfbc7('0x11')]=FaxAccount; \ No newline at end of file +var _0xf6cd=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','key','exports'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0xf6cd,0x120));var _0xdf6c=function(_0x229cfd,_0x3d7b4c){_0x229cfd=_0x229cfd-0x0;var _0x5621a3=_0xf6cd[_0x229cfd];return _0x5621a3;};'use strict';function FaxAccount(_0x59a771){this['id']=_0x59a771['id']||0x0;this[_0xdf6c('0x0')]=_0x59a771[_0xdf6c('0x0')]||'';this[_0xdf6c('0x1')]=_0x59a771[_0xdf6c('0x1')];this[_0xdf6c('0x2')]=_0x59a771[_0xdf6c('0x2')];this['headerinfo']=_0x59a771[_0xdf6c('0x3')];this['localstationid']=_0x59a771[_0xdf6c('0x4')];this[_0xdf6c('0x5')]=_0x59a771[_0xdf6c('0x5')]||0x960;this[_0xdf6c('0x6')]=_0x59a771[_0xdf6c('0x6')]||0x3840;this['modem']=_0x59a771[_0xdf6c('0x7')]||_0xdf6c('0x8');this['gateway']=_0x59a771['gateway']||'no';this['faxdetect']=_0x59a771[_0xdf6c('0x9')]||'no';this[_0xdf6c('0xa')]=_0x59a771[_0xdf6c('0xa')]||0x1388;this[_0xdf6c('0xb')]=_0x59a771[_0xdf6c('0xb')]||_0xdf6c('0xc');this['Trunk']=_0x59a771['Trunk']?_0x59a771[_0xdf6c('0xd')]:undefined;this['ListId']=_0x59a771['ListId'];this[_0xdf6c('0xe')]=_0x59a771[_0xdf6c('0xe')];}module[_0xdf6c('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f5ff49e..6ccf7ba 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 _0x00b7=['remoteUri','serverUrl','Configurations','exports','name','apiKey','token'];(function(_0x4f68c9,_0x28cc37){var _0x430ee9=function(_0x2aea64){while(--_0x2aea64){_0x4f68c9['push'](_0x4f68c9['shift']());}};_0x430ee9(++_0x28cc37);}(_0x00b7,0xc1));var _0x700b=function(_0x530c3c,_0x482711){_0x530c3c=_0x530c3c-0x0;var _0xac1986=_0x00b7[_0x530c3c];return _0xac1986;};'use strict';function FreshdeskAccount(_0x17e285){this['id']=_0x17e285['id']||0x0;this['name']=_0x17e285[_0x700b('0x0')]||'';this['username']=_0x17e285['username']||'';this[_0x700b('0x1')]=_0x17e285[_0x700b('0x2')]||'';this[_0x700b('0x3')]=_0x17e285[_0x700b('0x3')]||'';this['serverUrl']=_0x17e285[_0x700b('0x4')]||'';this[_0x700b('0x5')]=_0x17e285[_0x700b('0x5')]||{};}module[_0x700b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x887d=['name','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2a1856,_0x3c9998){var _0x548c00=function(_0x4d9b31){while(--_0x4d9b31){_0x2a1856['push'](_0x2a1856['shift']());}};_0x548c00(++_0x3c9998);}(_0x887d,0xd2));var _0xd887=function(_0x420570,_0x1e1196){_0x420570=_0x420570-0x0;var _0x1b5e37=_0x887d[_0x420570];return _0x1b5e37;};'use strict';function FreshdeskAccount(_0x38db26){this['id']=_0x38db26['id']||0x0;this[_0xd887('0x0')]=_0x38db26[_0xd887('0x0')]||'';this['username']=_0x38db26['username']||'';this[_0xd887('0x1')]=_0x38db26[_0xd887('0x2')]||'';this[_0xd887('0x3')]=_0x38db26[_0xd887('0x3')]||'';this['serverUrl']=_0x38db26[_0xd887('0x4')]||'';this[_0xd887('0x5')]=_0x38db26[_0xd887('0x5')]||{};}module[_0xd887('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 521960f..0aec618 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 _0xb7a8=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x11026e,_0x164422){var _0x334d99=function(_0x1c9568){while(--_0x1c9568){_0x11026e['push'](_0x11026e['shift']());}};_0x334d99(++_0x164422);}(_0xb7a8,0xec));var _0x8b7a=function(_0xbd80a3,_0x3fae8a){_0xbd80a3=_0xbd80a3-0x0;var _0x29f5d6=_0xb7a8[_0xbd80a3];return _0x29f5d6;};'use strict';function FreshsalesAccount(_0x17ec1f){this['id']=_0x17ec1f['id']||0x0;this[_0x8b7a('0x0')]=_0x17ec1f[_0x8b7a('0x0')]||'';this['username']=_0x17ec1f[_0x8b7a('0x1')]||'';this[_0x8b7a('0x2')]=_0x17ec1f[_0x8b7a('0x3')]||'';this['remoteUri']=_0x17ec1f[_0x8b7a('0x4')]||'';this[_0x8b7a('0x5')]=_0x17ec1f[_0x8b7a('0x5')]||'';this[_0x8b7a('0x6')]=_0x17ec1f[_0x8b7a('0x6')]||{};}module[_0x8b7a('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x4672=['apiKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x459554,_0x489423){var _0x1ca663=function(_0xd166a7){while(--_0xd166a7){_0x459554['push'](_0x459554['shift']());}};_0x1ca663(++_0x489423);}(_0x4672,0x18a));var _0x2467=function(_0x54abc8,_0xd098e){_0x54abc8=_0x54abc8-0x0;var _0x4dfe6d=_0x4672[_0x54abc8];return _0x4dfe6d;};'use strict';function FreshsalesAccount(_0x314d5b){this['id']=_0x314d5b['id']||0x0;this['name']=_0x314d5b[_0x2467('0x0')]||'';this[_0x2467('0x1')]=_0x314d5b['username']||'';this[_0x2467('0x2')]=_0x314d5b['token']||'';this[_0x2467('0x3')]=_0x314d5b[_0x2467('0x3')]||'';this[_0x2467('0x4')]=_0x314d5b[_0x2467('0x4')]||'';this['Configurations']=_0x314d5b[_0x2467('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c37d7a7..e552cd2 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 _0x3ea1=['lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','holdtime','assigned'];(function(_0x352790,_0x53811c){var _0x4ab401=function(_0x3fa774){while(--_0x3fa774){_0x352790['push'](_0x352790['shift']());}};_0x4ab401(++_0x53811c);}(_0x3ea1,0xc1));var _0x13ea=function(_0x16ee50,_0x221376){_0x16ee50=_0x16ee50-0x0;var _0x4d68d8=_0x3ea1[_0x16ee50];return _0x4d68d8;};'use strict';function QueueReport(){this['type']=_0x13ea('0x0');this[_0x13ea('0x1')]='';this[_0x13ea('0x2')]='';this[_0x13ea('0x3')]='';this[_0x13ea('0x4')]='';this[_0x13ea('0x5')]=null;this[_0x13ea('0x6')]=null;this[_0x13ea('0x7')]=0x1;this[_0x13ea('0x8')]=0x1;this[_0x13ea('0x9')]=![];this[_0x13ea('0xa')]=null;this[_0x13ea('0xb')]=![];this[_0x13ea('0xc')]=null;this[_0x13ea('0xd')]=![];this[_0x13ea('0xe')]=null;this[_0x13ea('0xf')]=0x1;this[_0x13ea('0x10')]='';this[_0x13ea('0x11')]='';this[_0x13ea('0x12')]='';this[_0x13ea('0x13')]='';this[_0x13ea('0x14')]='';this['exten']='';this['priority']='';this[_0x13ea('0x15')]=0x0;this[_0x13ea('0x16')]=![];this[_0x13ea('0x17')]='';this['motionChannel']='voice';this[_0x13ea('0x18')]=0x0;this[_0x13ea('0x19')]={};}module[_0x13ea('0x1a')]=QueueReport; \ No newline at end of file +var _0x6a47=['lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','context','exten','priority','holdtime','assigned'];(function(_0x42f4db,_0x2bbcc4){var _0x1b38ee=function(_0x3cba9c){while(--_0x3cba9c){_0x42f4db['push'](_0x42f4db['shift']());}};_0x1b38ee(++_0x2bbcc4);}(_0x6a47,0xca));var _0x76a4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6a47[_0x19950b];return _0x3c6b41;};'use strict';function QueueReport(){this[_0x76a4('0x0')]=_0x76a4('0x1');this[_0x76a4('0x2')]='';this[_0x76a4('0x3')]='';this[_0x76a4('0x4')]='';this[_0x76a4('0x5')]='';this[_0x76a4('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x76a4('0x7')]=0x1;this[_0x76a4('0x8')]=0x1;this[_0x76a4('0x9')]=![];this[_0x76a4('0xa')]=null;this[_0x76a4('0xb')]=![];this[_0x76a4('0xc')]=null;this[_0x76a4('0xd')]=![];this[_0x76a4('0xe')]=null;this[_0x76a4('0xf')]=0x1;this[_0x76a4('0x10')]='';this['connectedlinenum']='';this['connectedlinename']='';this['accountcode']='';this[_0x76a4('0x11')]='';this[_0x76a4('0x12')]='';this[_0x76a4('0x13')]='';this[_0x76a4('0x14')]=0x0;this[_0x76a4('0x15')]=![];this[_0x76a4('0x16')]='';this[_0x76a4('0x17')]=_0x76a4('0x18');this[_0x76a4('0x19')]=0x0;this[_0x76a4('0x1a')]={};}module[_0x76a4('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 3911d9f..00df236 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 _0x2abd=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x35b742,_0x5c4a23){var _0x18bf6f=function(_0x51aa74){while(--_0x51aa74){_0x35b742['push'](_0x35b742['shift']());}};_0x18bf6f(++_0x5c4a23);}(_0x2abd,0x72));var _0xd2ab=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x2abd[_0x3e5086];return _0xfeb102;};'use strict';function SalesforceAccount(_0x5c2372){this['id']=_0x5c2372['id']||0x0;this[_0xd2ab('0x0')]=_0x5c2372['name']||'';this[_0xd2ab('0x1')]=_0x5c2372[_0xd2ab('0x1')]||'';this[_0xd2ab('0x2')]=_0x5c2372[_0xd2ab('0x2')]||'';this[_0xd2ab('0x3')]=_0x5c2372[_0xd2ab('0x3')]||'';this[_0xd2ab('0x4')]=_0x5c2372[_0xd2ab('0x4')]||'';this[_0xd2ab('0x5')]=_0x5c2372[_0xd2ab('0x5')]||'';this[_0xd2ab('0x6')]=_0x5c2372[_0xd2ab('0x6')]||'';this['type']=_0x5c2372[_0xd2ab('0x7')]||_0xd2ab('0x8');this[_0xd2ab('0x9')]=_0x5c2372[_0xd2ab('0x9')]||'';this['Configurations']=_0x5c2372[_0xd2ab('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xa0da=['password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','name','username','remoteUri'];(function(_0x7e53ee,_0x3fd332){var _0x4af756=function(_0x32d80e){while(--_0x32d80e){_0x7e53ee['push'](_0x7e53ee['shift']());}};_0x4af756(++_0x3fd332);}(_0xa0da,0x183));var _0xaa0d=function(_0x1cee97,_0x1c8506){_0x1cee97=_0x1cee97-0x0;var _0x80c59=_0xa0da[_0x1cee97];return _0x80c59;};'use strict';function SalesforceAccount(_0x1f6b9a){this['id']=_0x1f6b9a['id']||0x0;this['name']=_0x1f6b9a[_0xaa0d('0x0')]||'';this[_0xaa0d('0x1')]=_0x1f6b9a[_0xaa0d('0x1')]||'';this[_0xaa0d('0x2')]=_0x1f6b9a['remoteUri']||'';this[_0xaa0d('0x3')]=_0x1f6b9a[_0xaa0d('0x3')]||'';this['clientId']=_0x1f6b9a[_0xaa0d('0x4')]||'';this[_0xaa0d('0x5')]=_0x1f6b9a['clientSecret']||'';this[_0xaa0d('0x6')]=_0x1f6b9a[_0xaa0d('0x6')]||'';this['type']=_0x1f6b9a[_0xaa0d('0x7')]||_0xaa0d('0x8');this['serverUrl']=_0x1f6b9a['serverUrl']||'';this[_0xaa0d('0x9')]=_0x1f6b9a[_0xaa0d('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 18c5350..786ccf2 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 _0x6b57=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x380c75,_0x17f983){var _0x57f90b=function(_0xaa9e2e){while(--_0xaa9e2e){_0x380c75['push'](_0x380c75['shift']());}};_0x57f90b(++_0x17f983);}(_0x6b57,0x72));var _0x76b5=function(_0x26f502,_0x36fa4e){_0x26f502=_0x26f502-0x0;var _0x907579=_0x6b57[_0x26f502];return _0x907579;};'use strict';function ServicenowAccount(_0x3ea3dc){this['id']=_0x3ea3dc['id']||0x0;this[_0x76b5('0x0')]=_0x3ea3dc[_0x76b5('0x0')]||'';this[_0x76b5('0x1')]=_0x3ea3dc[_0x76b5('0x1')]||'';this[_0x76b5('0x2')]=_0x3ea3dc['password']||'';this[_0x76b5('0x3')]=_0x3ea3dc[_0x76b5('0x3')]||'';this[_0x76b5('0x4')]=_0x3ea3dc[_0x76b5('0x4')]||'';this[_0x76b5('0x5')]=_0x3ea3dc[_0x76b5('0x5')]||{};}module[_0x76b5('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x5683=['password','serverUrl','Configurations','name','username'];(function(_0x5c44bb,_0x916a99){var _0x566a92=function(_0x5f1cb6){while(--_0x5f1cb6){_0x5c44bb['push'](_0x5c44bb['shift']());}};_0x566a92(++_0x916a99);}(_0x5683,0x1de));var _0x3568=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5683[_0x122096];return _0x3d1966;};'use strict';function ServicenowAccount(_0x3b70bc){this['id']=_0x3b70bc['id']||0x0;this[_0x3568('0x0')]=_0x3b70bc[_0x3568('0x0')]||'';this['username']=_0x3b70bc[_0x3568('0x1')]||'';this['password']=_0x3b70bc[_0x3568('0x2')]||'';this['remoteUri']=_0x3b70bc['remoteUri']||'';this[_0x3568('0x3')]=_0x3b70bc['serverUrl']||'';this[_0x3568('0x4')]=_0x3b70bc[_0x3568('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 975cd1e..d303df4 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 _0x26d7=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x13be06,_0x41214c){var _0x54d525=function(_0x3cad66){while(--_0x3cad66){_0x13be06['push'](_0x13be06['shift']());}};_0x54d525(++_0x41214c);}(_0x26d7,0x18f));var _0x726d=function(_0x264ff7,_0x51c3cb){_0x264ff7=_0x264ff7-0x0;var _0x13779a=_0x26d7[_0x264ff7];return _0x13779a;};'use strict';function SugarcrmAccount(_0x5a8cb6){this['id']=_0x5a8cb6['id']||0x0;this[_0x726d('0x0')]=_0x5a8cb6['name']||'';this[_0x726d('0x1')]=_0x5a8cb6['username']||'';this[_0x726d('0x2')]=_0x5a8cb6[_0x726d('0x2')]||'';this['remoteUri']=_0x5a8cb6[_0x726d('0x3')]||'';this[_0x726d('0x4')]=_0x5a8cb6[_0x726d('0x4')]||'';this[_0x726d('0x5')]=_0x5a8cb6[_0x726d('0x5')]||{};}module[_0x726d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb374=['password','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x3f8306,_0xfb994c){var _0x48bde8=function(_0x3b2b44){while(--_0x3b2b44){_0x3f8306['push'](_0x3f8306['shift']());}};_0x48bde8(++_0xfb994c);}(_0xb374,0x113));var _0x4b37=function(_0x2bed94,_0x17ee15){_0x2bed94=_0x2bed94-0x0;var _0x4e3b81=_0xb374[_0x2bed94];return _0x4e3b81;};'use strict';function SugarcrmAccount(_0x49fb58){this['id']=_0x49fb58['id']||0x0;this['name']=_0x49fb58['name']||'';this[_0x4b37('0x0')]=_0x49fb58[_0x4b37('0x0')]||'';this[_0x4b37('0x1')]=_0x49fb58[_0x4b37('0x1')]||'';this[_0x4b37('0x2')]=_0x49fb58[_0x4b37('0x2')]||'';this['serverUrl']=_0x49fb58[_0x4b37('0x3')]||'';this[_0x4b37('0x4')]=_0x49fb58[_0x4b37('0x4')]||{};}module[_0x4b37('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 30875e6..b6d5d94 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 _0xe3d4=['address','exports','name','accountcode','state','unknown','status'];(function(_0x1c9684,_0xaa6435){var _0x269c24=function(_0x5a1308){while(--_0x5a1308){_0x1c9684['push'](_0x1c9684['shift']());}};_0x269c24(++_0xaa6435);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xe3d4[_0x37ffea];return _0x2e2615;};'use strict';function Telephone(_0x3673e0){this['id']=_0x3673e0['id']||0x0;this[_0x4e3d('0x0')]=_0x3673e0[_0x4e3d('0x0')]||'';this[_0x4e3d('0x1')]=_0x3673e0['accountcode']||'';this[_0x4e3d('0x2')]=_0x4e3d('0x3');this['stateTime']=0x0;this[_0x4e3d('0x4')]='unknown';this[_0x4e3d('0x5')]='';}module[_0x4e3d('0x6')]=Telephone; \ No newline at end of file +var _0x95e6=['unknown','stateTime','status','exports','name'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0x95e6,0x171));var _0x695e=function(_0x138463,_0x3b3a5){_0x138463=_0x138463-0x0;var _0x558108=_0x95e6[_0x138463];return _0x558108;};'use strict';function Telephone(_0x422676){this['id']=_0x422676['id']||0x0;this['name']=_0x422676[_0x695e('0x0')]||'';this['accountcode']=_0x422676['accountcode']||'';this['state']=_0x695e('0x1');this[_0x695e('0x2')]=0x0;this[_0x695e('0x3')]=_0x695e('0x1');this['address']='';}module[_0x695e('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2b1b13a..8f1ddf9 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(_0x35e31e,_0x1cbd4a){var _0x2ecfdc=function(_0x256896){while(--_0x256896){_0x35e31e['push'](_0x35e31e['shift']());}};_0x2ecfdc(++_0x1cbd4a);}(_0xb10b,0x12a));var _0xbb10=function(_0x437472,_0x31db2d){_0x437472=_0x437472-0x0;var _0x217fce=_0xb10b[_0x437472];return _0x217fce;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x12d829,_0x3b367f){var _0x5dbf16=function(_0x32ad63){while(--_0x32ad63){_0x12d829['push'](_0x12d829['shift']());}};_0x5dbf16(++_0x3b367f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 99eb755..a45fa6b 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x48db71,_0x3bead9){var _0x396b59=function(_0x3ce37a){while(--_0x3ce37a){_0x48db71['push'](_0x48db71['shift']());}};_0x396b59(++_0x3bead9);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2b1670,_0x47aeab){_0x2b1670=_0x2b1670-0x0;var _0x1c5cde=_0x9ffd[_0x2b1670];return _0x1c5cde;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x0b0e[_0x4382bc];return _0x13c82a;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index cd23938..345c3ee 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 _0x3058=['unknown','stateTime','registry','split','host','port','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3058,0x89));var _0x8305=function(_0x2e11ba,_0xfa235){_0x2e11ba=_0x2e11ba-0x0;var _0x2ad349=_0x3058[_0x2e11ba];return _0x2ad349;};'use strict';function Trunk(_0x119429){this['id']=_0x119429['id']||0x0;this['active']=_0x119429[_0x8305('0x0')]||![];this[_0x8305('0x1')]=_0x119429[_0x8305('0x1')]||'';this[_0x8305('0x2')]=_0x8305('0x3');this[_0x8305('0x4')]=0x0;this['status']='unknown';this[_0x8305('0x5')]=_0x119429[_0x8305('0x5')]&&_0x119429['registry']['indexOf'](':')?_0x119429[_0x8305('0x5')][_0x8305('0x6')](':')[0x0]:'';this[_0x8305('0x7')]='';this[_0x8305('0x8')]='';this['domain']='';this['domainport']='';this['refresh']='';this[_0x8305('0x9')]=_0x8305('0x3');this[_0x8305('0xa')]='';this[_0x8305('0xb')]='';this[_0x8305('0xc')]=_0x119429[_0x8305('0xc')]||'';}module[_0x8305('0xd')]=Trunk; \ No newline at end of file +var _0x7497=['host','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','state','unknown','registry','split'];(function(_0x6c3df8,_0x57e22e){var _0x492833=function(_0x27afad){while(--_0x27afad){_0x6c3df8['push'](_0x6c3df8['shift']());}};_0x492833(++_0x57e22e);}(_0x7497,0x1f3));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x292a9e){this['id']=_0x292a9e['id']||0x0;this[_0x7749('0x0')]=_0x292a9e[_0x7749('0x0')]||![];this['name']=_0x292a9e['name']||'';this[_0x7749('0x1')]='unknown';this['stateTime']=0x0;this['status']=_0x7749('0x2');this[_0x7749('0x3')]=_0x292a9e[_0x7749('0x3')]&&_0x292a9e['registry']['indexOf'](':')?_0x292a9e[_0x7749('0x3')][_0x7749('0x4')](':')[0x0]:'';this[_0x7749('0x5')]='';this['port']='';this['domain']='';this[_0x7749('0x6')]='';this[_0x7749('0x7')]='';this[_0x7749('0x8')]=_0x7749('0x2');this[_0x7749('0x9')]='';this[_0x7749('0xa')]='';this[_0x7749('0xb')]=_0x292a9e['defaultuser']||'';}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 0995a32..a139c97 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 _0x285e=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x22284f,_0xb33e3a){var _0x506712=function(_0xbc32c2){while(--_0xbc32c2){_0x22284f['push'](_0x22284f['shift']());}};_0x506712(++_0xb33e3a);}(_0x285e,0xdc));var _0xe285=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x285e[_0x44946b];return _0x249bc4;};'use strict';function voiceExtension(_0x1e681b){this['id']=_0x1e681b['id']||0x0;this[_0xe285('0x0')]=_0x1e681b[_0xe285('0x0')]||'';this[_0xe285('0x1')]=_0x1e681b[_0xe285('0x1')]||_0xe285('0x2');this[_0xe285('0x3')]=_0x1e681b['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x5e17=['recordingFormat','mandatoryDisposition','exten'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x5e17,0x1a0));var _0x75e1=function(_0x581c80,_0xa51798){_0x581c80=_0x581c80-0x0;var _0x1e2bf2=_0x5e17[_0x581c80];return _0x1e2bf2;};'use strict';function voiceExtension(_0x5ecc02){this['id']=_0x5ecc02['id']||0x0;this[_0x75e1('0x0')]=_0x5ecc02[_0x75e1('0x0')]||'';this[_0x75e1('0x1')]=_0x5ecc02[_0x75e1('0x1')]||'none';this[_0x75e1('0x2')]=_0x5ecc02['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1234021..84997fe 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 _0x9f78=['queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9f78,0xab));var _0x89f7=function(_0x1b5383,_0x55d8cf){_0x1b5383=_0x1b5383-0x0;var _0x4a2ad9=_0x9f78[_0x1b5383];return _0x4a2ad9;};'use strict';var statusDesc=[_0x89f7('0x0'),'not_inuse','inuse',_0x89f7('0x1'),_0x89f7('0x2'),_0x89f7('0x3'),_0x89f7('0x4'),_0x89f7('0x5'),_0x89f7('0x6')];var monitorFormat={'wav':_0x89f7('0x7'),'wav49':_0x89f7('0x8'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0x89f7('0x9')};function VoiceQueue(_0x289d04){this['id']=_0x289d04['id']||0x0;this[_0x89f7('0xa')]=_0x289d04[_0x89f7('0xa')]||'';this[_0x89f7('0xb')]=_0x289d04[_0x89f7('0xb')]||'';this[_0x89f7('0xc')]=_0x289d04[_0x89f7('0xc')]||_0x89f7('0xd');this[_0x89f7('0xe')]=0x0;this[_0x89f7('0xf')]=0x0;this[_0x89f7('0x10')]=0x0;this[_0x89f7('0x11')]=0x0;this[_0x89f7('0x12')]=0x0;this[_0x89f7('0x13')]=0x0;this[_0x89f7('0x14')]=0x0;this[_0x89f7('0x15')]=0x0;this[_0x89f7('0x16')]=0x0;this[_0x89f7('0x17')]=0x0;this[_0x89f7('0x18')]=0x0;this[_0x89f7('0x19')]=_0x289d04[_0x89f7('0x19')]||![];this[_0x89f7('0x1a')]=_0x289d04[_0x89f7('0x1a')]||0xa;this[_0x89f7('0x1b')]=_0x289d04['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x89f7('0x1c')]='';this[_0x89f7('0x1d')]=0x0;this[_0x89f7('0x1e')]=0x0;this[_0x89f7('0x1f')]=_0x289d04[_0x89f7('0x1f')]||null;this[_0x89f7('0x20')]=_0x289d04[_0x89f7('0x20')]?_0x289d04[_0x89f7('0x20')]:null;this[_0x89f7('0x21')]=_0x289d04[_0x89f7('0x21')];this[_0x89f7('0x22')]=_0x289d04[_0x89f7('0x22')]||_0x89f7('0x23');this[_0x89f7('0x24')]=_0x289d04[_0x89f7('0x24')]||0x0;this[_0x89f7('0x25')]=_0x289d04['dialLimitQueue']||0x0;this[_0x89f7('0x26')]=_0x289d04[_0x89f7('0x26')]||0x1;this[_0x89f7('0x27')]=_0x289d04[_0x89f7('0x27')]||_0x89f7('0x28');this['dialPredictiveOptimizationPercentage']=_0x289d04['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x289d04['dialPredictiveInterval']||0x258;this[_0x89f7('0x29')]=_0x289d04['dialOriginateCallerIdName']||_0x89f7('0x2a');this['dialOriginateCallerIdNumber']=_0x289d04[_0x89f7('0x2b')]||_0x89f7('0x2a');this[_0x89f7('0x2c')]=_0x289d04[_0x89f7('0x2c')]||0x1e;this['dialQueueOptions']=_0x289d04['dialQueueOptions']||_0x89f7('0x2d');this['dialQueueTimeout']=_0x289d04[_0x89f7('0x2e')]||0x3;this[_0x89f7('0x2f')]=_0x289d04[_0x89f7('0x2f')]||undefined;this[_0x89f7('0x30')]=_0x289d04[_0x89f7('0x30')]||0x3;this[_0x89f7('0x31')]=_0x289d04[_0x89f7('0x31')]||0x96;this[_0x89f7('0x32')]=_0x289d04[_0x89f7('0x32')]||0x3;this[_0x89f7('0x33')]=_0x289d04[_0x89f7('0x33')]||0x96;this[_0x89f7('0x34')]=_0x289d04[_0x89f7('0x34')]||0x3;this[_0x89f7('0x35')]=_0x289d04[_0x89f7('0x35')]||0x96;this[_0x89f7('0x36')]=_0x289d04[_0x89f7('0x36')]||0x3;this[_0x89f7('0x37')]=_0x289d04[_0x89f7('0x37')]||0x96;this[_0x89f7('0x38')]=_0x289d04[_0x89f7('0x38')]||0x3;this['dialDropRetryFrequency']=_0x289d04[_0x89f7('0x39')]||0x96;this[_0x89f7('0x3a')]=_0x289d04['dialAbandonedMaxRetry']||0x3;this[_0x89f7('0x3b')]=_0x289d04['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x289d04['dialMachineMaxRetry']||0x3;this[_0x89f7('0x3c')]=_0x289d04['dialMachineRetryFrequency']||0x96;this[_0x89f7('0x3d')]=_0x289d04[_0x89f7('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x289d04[_0x89f7('0x3e')]||0x96;this[_0x89f7('0x3f')]=_0x289d04['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x289d04[_0x89f7('0x40')]||0x4;this[_0x89f7('0x41')]=_0x289d04['Trunk']?_0x289d04[_0x89f7('0x41')]:undefined;this[_0x89f7('0x42')]=_0x289d04['TrunkBackup']?_0x289d04[_0x89f7('0x42')]:undefined;this[_0x89f7('0x43')]=_0x289d04[_0x89f7('0x43')]||undefined;this['Interval']=_0x289d04[_0x89f7('0x44')]?_0x289d04['Interval']:undefined;this['dialOrderByScheduledAt']=_0x289d04[_0x89f7('0x45')]||_0x89f7('0x46');this[_0x89f7('0x47')]=_0x289d04['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x89f7('0x48')]=_0x289d04[_0x89f7('0x48')]||undefined;this[_0x89f7('0x49')]=strategy[_0x289d04[_0x89f7('0x49')]]||_0x89f7('0x4a');this[_0x89f7('0x4b')]=!![];this[_0x89f7('0x4c')]=_0x289d04['dialAMDActive']||![];this[_0x89f7('0x4d')]=_0x289d04['dialAMDInitialSilence'];this[_0x89f7('0x4e')]=_0x289d04['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x289d04[_0x89f7('0x4f')];this[_0x89f7('0x50')]=_0x289d04[_0x89f7('0x50')];this[_0x89f7('0x51')]=_0x289d04['dialAMDMinWordLength'];this[_0x89f7('0x52')]=_0x289d04['dialAMDBetweenWordsSilence'];this[_0x89f7('0x53')]=_0x289d04[_0x89f7('0x53')];this[_0x89f7('0x54')]=_0x289d04[_0x89f7('0x54')];this['dialAMDMaximumWordLength']=_0x289d04['dialAMDMaximumWordLength'];this[_0x89f7('0x55')]=0x0;this[_0x89f7('0x56')]=0x0;this[_0x89f7('0x57')]=_0x289d04[_0x89f7('0x57')];this[_0x89f7('0x58')]=0x0;this[_0x89f7('0x59')]=0x0;this[_0x89f7('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x89f7('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x89f7('0x5c')]=0x0;this[_0x89f7('0x5d')]=0x0;this[_0x89f7('0x5e')]=0x0;this[_0x89f7('0x5f')]=0x0;this[_0x89f7('0x60')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x89f7('0x61')]=undefined;this[_0x89f7('0x62')]=undefined;this[_0x89f7('0x63')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x89f7('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x89f7('0x65')]=0x0;this[_0x89f7('0x66')]=0x0;this[_0x89f7('0x67')]=0x0;this[_0x89f7('0x68')]=0x0;this[_0x89f7('0x69')]=0x0;this[_0x89f7('0x6a')]=_0x289d04[_0x89f7('0x6b')]||0x14;this[_0x89f7('0x6c')]=_0x289d04[_0x89f7('0x6b')]||0xa;this[_0x89f7('0x6d')]=0x0;this[_0x89f7('0x6e')]=0x0;this[_0x89f7('0x6f')]=0x1;this[_0x89f7('0x70')]=0x0;this[_0x89f7('0x71')]=0x0;this[_0x89f7('0x72')]=0x0;this['erlangBusyFactor']=0x0;this[_0x89f7('0x73')]=_0x289d04[_0x89f7('0x73')]||0x1e;this[_0x89f7('0x74')]=_0x289d04['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x289d04[_0x89f7('0x75')]||![];this[_0x89f7('0x76')]=!!_0x289d04[_0x89f7('0x76')]||![];this['dialQueueProject2']=_0x289d04[_0x89f7('0x77')]||undefined;this[_0x89f7('0x78')]=_0x289d04[_0x89f7('0x78')]||![];this[_0x89f7('0x79')]=_0x289d04[_0x89f7('0x79')]||![];this[_0x89f7('0xb')]=monitorFormat[_0x289d04[_0x89f7('0xb')]]?monitorFormat[_0x289d04[_0x89f7('0xb')]]:undefined;this['mandatoryDisposition']=_0x289d04['mandatoryDisposition']||![];this[_0x89f7('0x7a')]=_0x289d04[_0x89f7('0x7a')]?_0x289d04[_0x89f7('0x7a')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xe51f=['mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe51f,0xfe));var _0xfe51=function(_0x32d2a9,_0x17acd9){_0x32d2a9=_0x32d2a9-0x0;var _0x4e036a=_0xe51f[_0x32d2a9];return _0x4e036a;};'use strict';var statusDesc=[_0xfe51('0x0'),_0xfe51('0x1'),'inuse',_0xfe51('0x2'),_0xfe51('0x3'),_0xfe51('0x4'),_0xfe51('0x5'),_0xfe51('0x6'),_0xfe51('0x7')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0xfe51('0x8'),'roundrobin':_0xfe51('0x9')};function VoiceQueue(_0x3c0251){this['id']=_0x3c0251['id']||0x0;this[_0xfe51('0xa')]=_0x3c0251['name']||'';this[_0xfe51('0xb')]=_0x3c0251[_0xfe51('0xb')]||'';this[_0xfe51('0xc')]=_0x3c0251[_0xfe51('0xc')]||_0xfe51('0xd');this[_0xfe51('0xe')]=0x0;this[_0xfe51('0xf')]=0x0;this[_0xfe51('0x10')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xfe51('0x11')]=0x0;this[_0xfe51('0x12')]=0x0;this[_0xfe51('0x13')]=0x0;this[_0xfe51('0x14')]=0x0;this[_0xfe51('0x15')]=0x0;this[_0xfe51('0x16')]=0x0;this['acw']=_0x3c0251[_0xfe51('0x17')]||![];this[_0xfe51('0x18')]=_0x3c0251[_0xfe51('0x18')]||0xa;this[_0xfe51('0x19')]=_0x3c0251[_0xfe51('0x19')]||'no';this[_0xfe51('0x1a')]=!![];this[_0xfe51('0x1b')]='';this['originated']=0x0;this[_0xfe51('0x1c')]=0x0;this[_0xfe51('0x1d')]=_0x3c0251[_0xfe51('0x1d')]||null;this[_0xfe51('0x1e')]=_0x3c0251[_0xfe51('0x1e')]?_0x3c0251[_0xfe51('0x1e')]:null;this[_0xfe51('0x1f')]=_0x3c0251[_0xfe51('0x1f')];this[_0xfe51('0x20')]=_0x3c0251['dialMethod']||'progressive';this[_0xfe51('0x21')]=_0x3c0251[_0xfe51('0x21')]||0x0;this[_0xfe51('0x22')]=_0x3c0251['dialLimitQueue']||0x0;this[_0xfe51('0x23')]=_0x3c0251[_0xfe51('0x23')]||0x1;this[_0xfe51('0x24')]=_0x3c0251[_0xfe51('0x24')]||_0xfe51('0x25');this[_0xfe51('0x26')]=_0x3c0251[_0xfe51('0x26')]||0.03;this[_0xfe51('0x27')]=_0x3c0251[_0xfe51('0x27')]||0x258;this[_0xfe51('0x28')]=_0x3c0251[_0xfe51('0x28')]||'anonymous';this[_0xfe51('0x29')]=_0x3c0251[_0xfe51('0x29')]||_0xfe51('0x2a');this['dialOriginateTimeout']=_0x3c0251['dialOriginateTimeout']||0x1e;this[_0xfe51('0x2b')]=_0x3c0251['dialQueueOptions']||_0xfe51('0x2c');this[_0xfe51('0x2d')]=_0x3c0251[_0xfe51('0x2d')]||0x3;this[_0xfe51('0x2e')]=_0x3c0251['dialQueueProject']||undefined;this[_0xfe51('0x2f')]=_0x3c0251[_0xfe51('0x2f')]||0x3;this['dialCongestionRetryFrequency']=_0x3c0251[_0xfe51('0x30')]||0x96;this[_0xfe51('0x31')]=_0x3c0251['dialBusyMaxRetry']||0x3;this[_0xfe51('0x32')]=_0x3c0251[_0xfe51('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x3c0251[_0xfe51('0x33')]||0x3;this[_0xfe51('0x34')]=_0x3c0251[_0xfe51('0x34')]||0x96;this[_0xfe51('0x35')]=_0x3c0251[_0xfe51('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3c0251[_0xfe51('0x36')]||0x96;this[_0xfe51('0x37')]=_0x3c0251['dialDropMaxRetry']||0x3;this[_0xfe51('0x38')]=_0x3c0251[_0xfe51('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x3c0251['dialAbandonedMaxRetry']||0x3;this[_0xfe51('0x39')]=_0x3c0251[_0xfe51('0x39')]||0x96;this[_0xfe51('0x3a')]=_0x3c0251[_0xfe51('0x3a')]||0x3;this[_0xfe51('0x3b')]=_0x3c0251['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x3c0251[_0xfe51('0x3c')]||0x3;this[_0xfe51('0x3d')]=_0x3c0251['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x3c0251[_0xfe51('0x3e')]||0x3;this[_0xfe51('0x3f')]=_0x3c0251[_0xfe51('0x3f')]||0x4;this[_0xfe51('0x40')]=_0x3c0251['Trunk']?_0x3c0251['Trunk']:undefined;this[_0xfe51('0x41')]=_0x3c0251[_0xfe51('0x41')]?_0x3c0251[_0xfe51('0x41')]:undefined;this[_0xfe51('0x42')]=_0x3c0251[_0xfe51('0x42')]||undefined;this[_0xfe51('0x43')]=_0x3c0251['Interval']?_0x3c0251['Interval']:undefined;this[_0xfe51('0x44')]=_0x3c0251[_0xfe51('0x44')]||_0xfe51('0x45');this[_0xfe51('0x46')]=_0x3c0251[_0xfe51('0x46')]||undefined;this[_0xfe51('0x47')]=_0x3c0251[_0xfe51('0x47')]||undefined;this[_0xfe51('0x48')]=strategy[_0x3c0251[_0xfe51('0x48')]]||_0xfe51('0x8');this[_0xfe51('0x49')]=!![];this[_0xfe51('0x4a')]=_0x3c0251[_0xfe51('0x4a')]||![];this[_0xfe51('0x4b')]=_0x3c0251[_0xfe51('0x4b')];this[_0xfe51('0x4c')]=_0x3c0251['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x3c0251[_0xfe51('0x4d')];this['dialAMDTotalAnalysisTime']=_0x3c0251[_0xfe51('0x4e')];this[_0xfe51('0x4f')]=_0x3c0251[_0xfe51('0x4f')];this[_0xfe51('0x50')]=_0x3c0251[_0xfe51('0x50')];this[_0xfe51('0x51')]=_0x3c0251[_0xfe51('0x51')];this[_0xfe51('0x52')]=_0x3c0251[_0xfe51('0x52')];this[_0xfe51('0x53')]=_0x3c0251[_0xfe51('0x53')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xfe51('0x54')]=_0x3c0251['timeout'];this[_0xfe51('0x55')]=0x0;this[_0xfe51('0x56')]=0x0;this[_0xfe51('0x57')]=0x0;this[_0xfe51('0x58')]=0x0;this[_0xfe51('0x59')]=0x0;this[_0xfe51('0x5a')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xfe51('0x5b')]=0x0;this[_0xfe51('0x5c')]=0x0;this[_0xfe51('0x5d')]=0x0;this[_0xfe51('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xfe51('0x5f')]=0x0;this[_0xfe51('0x60')]=0x0;this[_0xfe51('0x61')]=undefined;this[_0xfe51('0x62')]=undefined;this['handlePredictive']=undefined;this[_0xfe51('0x63')]=1.05;this[_0xfe51('0x64')]=0x0;this[_0xfe51('0x65')]=0x0;this[_0xfe51('0x66')]=0x0;this[_0xfe51('0x67')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xfe51('0x68')]=0x0;this[_0xfe51('0x69')]=0x0;this[_0xfe51('0x6a')]=0x0;this[_0xfe51('0x6b')]=_0x3c0251[_0xfe51('0x6c')]||0x14;this['predictiveIntervalMinThreshold']=_0x3c0251['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xfe51('0x6d')]=0x0;this[_0xfe51('0x6e')]=0x0;this[_0xfe51('0x6f')]=0x1;this[_0xfe51('0x70')]=0x0;this[_0xfe51('0x71')]=0x0;this[_0xfe51('0x72')]=0x0;this[_0xfe51('0x73')]=0x0;this[_0xfe51('0x74')]=_0x3c0251[_0xfe51('0x74')]||0x1e;this['dialRecallInQueue']=_0x3c0251[_0xfe51('0x75')]||![];this[_0xfe51('0x76')]=!!_0x3c0251[_0xfe51('0x76')]||![];this['dialPreviewRecallmeReminder']=!!_0x3c0251[_0xfe51('0x77')]||![];this[_0xfe51('0x78')]=_0x3c0251[_0xfe51('0x78')]||undefined;this[_0xfe51('0x79')]=_0x3c0251[_0xfe51('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x3c0251[_0xfe51('0x7a')]||![];this[_0xfe51('0xb')]=monitorFormat[_0x3c0251[_0xfe51('0xb')]]?monitorFormat[_0x3c0251[_0xfe51('0xb')]]:undefined;this['mandatoryDisposition']=_0x3c0251[_0xfe51('0x7b')]||![];this[_0xfe51('0x7c')]=_0x3c0251[_0xfe51('0x7c')]?_0x3c0251[_0xfe51('0x7c')]:undefined;}module[_0xfe51('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index c317326..85f4261 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 _0x8d59=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x36be38,_0x50b484){var _0x10a629=function(_0x23b8d2){while(--_0x23b8d2){_0x36be38['push'](_0x36be38['shift']());}};_0x10a629(++_0x50b484);}(_0x8d59,0x109));var _0x98d5=function(_0x4b676d,_0x4d0289){_0x4b676d=_0x4b676d-0x0;var _0x3cc016=_0x8d59[_0x4b676d];return _0x3cc016;};'use strict';function VtigerAccount(_0x2567e5){this['id']=_0x2567e5['id']||0x0;this[_0x98d5('0x0')]=_0x2567e5[_0x98d5('0x0')]||'';this[_0x98d5('0x1')]=_0x2567e5[_0x98d5('0x1')]||'';this[_0x98d5('0x2')]=_0x2567e5[_0x98d5('0x2')]||'';this[_0x98d5('0x3')]=_0x2567e5[_0x98d5('0x3')]||'';this[_0x98d5('0x4')]=_0x2567e5[_0x98d5('0x4')]||'';this[_0x98d5('0x5')]=_0x2567e5[_0x98d5('0x5')]||{};}module[_0x98d5('0x6')]=VtigerAccount; \ No newline at end of file +var _0x44f4=['exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x44f4,0xdf));var _0x444f=function(_0x16ff86,_0x33ae76){_0x16ff86=_0x16ff86-0x0;var _0x33e8da=_0x44f4[_0x16ff86];return _0x33e8da;};'use strict';function VtigerAccount(_0x4f853c){this['id']=_0x4f853c['id']||0x0;this[_0x444f('0x0')]=_0x4f853c[_0x444f('0x0')]||'';this[_0x444f('0x1')]=_0x4f853c[_0x444f('0x1')]||'';this[_0x444f('0x2')]=_0x4f853c[_0x444f('0x2')]||'';this[_0x444f('0x3')]=_0x4f853c[_0x444f('0x3')]||'';this[_0x444f('0x4')]=_0x4f853c[_0x444f('0x4')]||'';this['Configurations']=_0x4f853c['Configurations']||{};}module[_0x444f('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6ca98c9..8fb5dec 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 _0xc2f6=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xc2f6,0x142));var _0x6c2f=function(_0x3e8ed9,_0x4f505a){_0x3e8ed9=_0x3e8ed9-0x0;var _0x29eecc=_0xc2f6[_0x3e8ed9];return _0x29eecc;};'use strict';function ZendeskAccount(_0x51ed03){this['id']=_0x51ed03['id']||0x0;this[_0x6c2f('0x0')]=_0x51ed03[_0x6c2f('0x0')]||'';this[_0x6c2f('0x1')]=_0x51ed03[_0x6c2f('0x1')]||'';this['password']=_0x51ed03[_0x6c2f('0x2')]||'';this[_0x6c2f('0x3')]=_0x51ed03['token']||'';this[_0x6c2f('0x4')]=_0x51ed03[_0x6c2f('0x4')]||'';this[_0x6c2f('0x5')]=_0x51ed03[_0x6c2f('0x5')]||'';this['type']=_0x51ed03[_0x6c2f('0x6')]||_0x6c2f('0x7');this[_0x6c2f('0x8')]=_0x51ed03[_0x6c2f('0x8')]||'';this['Configurations']=_0x51ed03[_0x6c2f('0x9')]||{};}module[_0x6c2f('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xf5c3=['remoteUri','authType','type','serverUrl','Configurations','name','username','password','token'];(function(_0x55f8d8,_0x5c831e){var _0x2dc219=function(_0x78bb4a){while(--_0x78bb4a){_0x55f8d8['push'](_0x55f8d8['shift']());}};_0x2dc219(++_0x5c831e);}(_0xf5c3,0x137));var _0x3f5c=function(_0x2f3a98,_0x112f1d){_0x2f3a98=_0x2f3a98-0x0;var _0x4ba539=_0xf5c3[_0x2f3a98];return _0x4ba539;};'use strict';function ZendeskAccount(_0x55acdf){this['id']=_0x55acdf['id']||0x0;this[_0x3f5c('0x0')]=_0x55acdf[_0x3f5c('0x0')]||'';this[_0x3f5c('0x1')]=_0x55acdf[_0x3f5c('0x1')]||'';this[_0x3f5c('0x2')]=_0x55acdf['password']||'';this[_0x3f5c('0x3')]=_0x55acdf[_0x3f5c('0x3')]||'';this[_0x3f5c('0x4')]=_0x55acdf[_0x3f5c('0x4')]||'';this[_0x3f5c('0x5')]=_0x55acdf['authType']||'';this[_0x3f5c('0x6')]=_0x55acdf['type']||'integrationTab';this[_0x3f5c('0x7')]=_0x55acdf[_0x3f5c('0x7')]||'';this[_0x3f5c('0x8')]=_0x55acdf[_0x3f5c('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5f9042f..aa12661 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 _0xf1d2=['refreshToken','Configurations','exports','name','description','clientId','clientSecret','serverUrl','code'];(function(_0x5492b1,_0x54f9cf){var _0x2d6486=function(_0x27fc4e){while(--_0x27fc4e){_0x5492b1['push'](_0x5492b1['shift']());}};_0x2d6486(++_0x54f9cf);}(_0xf1d2,0xb7));var _0x2f1d=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0xf1d2[_0x9df3d8];return _0x366da1;};'use strict';function ZohoAccount(_0x470126){this['id']=_0x470126['id']||0x0;this[_0x2f1d('0x0')]=_0x470126[_0x2f1d('0x0')]||'';this[_0x2f1d('0x1')]=_0x470126['description']||'';this['host']=_0x470126['host']||'';this['zone']=_0x470126['zone']||'';this[_0x2f1d('0x2')]=_0x470126[_0x2f1d('0x2')]||'';this[_0x2f1d('0x3')]=_0x470126[_0x2f1d('0x3')]||'';this[_0x2f1d('0x4')]=_0x470126[_0x2f1d('0x4')]||'';this['code']=_0x470126[_0x2f1d('0x5')]||'';this[_0x2f1d('0x6')]=_0x470126[_0x2f1d('0x6')]||'';this[_0x2f1d('0x7')]=_0x470126[_0x2f1d('0x7')]||{};}module[_0x2f1d('0x8')]=ZohoAccount; \ No newline at end of file +var _0xd632=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x30f59b,_0x182cc2){var _0x326cf3=function(_0x485477){while(--_0x485477){_0x30f59b['push'](_0x30f59b['shift']());}};_0x326cf3(++_0x182cc2);}(_0xd632,0x15a));var _0x2d63=function(_0x47638d,_0x2c6518){_0x47638d=_0x47638d-0x0;var _0x42ccbb=_0xd632[_0x47638d];return _0x42ccbb;};'use strict';function ZohoAccount(_0x6e9c2){this['id']=_0x6e9c2['id']||0x0;this[_0x2d63('0x0')]=_0x6e9c2['name']||'';this[_0x2d63('0x1')]=_0x6e9c2[_0x2d63('0x1')]||'';this[_0x2d63('0x2')]=_0x6e9c2[_0x2d63('0x2')]||'';this[_0x2d63('0x3')]=_0x6e9c2['zone']||'';this[_0x2d63('0x4')]=_0x6e9c2[_0x2d63('0x4')]||'';this[_0x2d63('0x5')]=_0x6e9c2['clientSecret']||'';this['serverUrl']=_0x6e9c2[_0x2d63('0x6')]||'';this[_0x2d63('0x7')]=_0x6e9c2[_0x2d63('0x7')]||'';this['refreshToken']=_0x6e9c2[_0x2d63('0x8')]||'';this['Configurations']=_0x6e9c2[_0x2d63('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 32f9492..01f3329 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 _0xed3c=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','type','campaigntype','queue','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','Contact','phone'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0xed3c,0x1a6));var _0xced3=function(_0x35335f,_0x4861ff){_0x35335f=_0x35335f-0x0;var _0x4a9103=_0xed3c[_0x35335f];return _0x4a9103;};'use strict';var util=require(_0xced3('0x0'));var _=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));function checkNameSurname(_0x3fb5e1,_0x558ee8,_0xfdc1ed){var _0x144d14='';if(!_[_0xced3('0x3')](_0x558ee8)&&'string'===typeof _0x558ee8){_0x144d14+=_0x558ee8;}if(!_['isNil'](_0xfdc1ed)&&_0xced3('0x4')===typeof _0xfdc1ed){_0x144d14+='\x20'+_0xfdc1ed;}if(_0x144d14!==''){return _0x144d14;}return _0x3fb5e1;}function Action(_0x1ada18,_0x2f92f8,_0x1cd694,_0x4795cd,_0x510164){this['uniqueid']=_0x1cd694||undefined;this[_0xced3('0x5')]=_0x1ada18['id'];this['queue']=_0x2f92f8['name'];this['type']=_0x2f92f8[_0xced3('0x6')];this[_0xced3('0x7')]=_0xced3('0x8');this[_0xced3('0x9')]=![];this[_0xced3('0xa')]=_['isNil'](_0x1ada18[_0xced3('0xb')])?undefined:_0x1ada18[_0xced3('0xb')][_0xced3('0xc')];this['channelAgent']=this[_0xced3('0xa')]?util[_0xced3('0xd')](_0xced3('0xe'),this[_0xced3('0xa')]):_0x4795cd||undefined;this[_0xced3('0xf')]=checkNameSurname(_0x1ada18[_0xced3('0x10')][_0xced3('0x11')],_0x1ada18['Contact'][_0xced3('0x12')],_0x1ada18['Contact'][_0xced3('0x13')]);this[_0xced3('0x14')]=_0x1ada18[_0xced3('0x14')]||![];this[_0xced3('0x15')]=_0x1ada18['phone'];this[_0xced3('0x16')]=_0x1ada18[_0xced3('0x16')];this['countbusyretry']=_0x1ada18[_0xced3('0x17')]||0x0;this[_0xced3('0x18')]=_0x1ada18[_0xced3('0x18')]||0x0;this[_0xced3('0x19')]=_0x1ada18['countnoanswerretry']||0x0;this[_0xced3('0x1a')]=(_0x1ada18['countbusyretry']||0x0)+(_0x1ada18[_0xced3('0x18')]||0x0)+(_0x1ada18[_0xced3('0x19')]||0x0)+(_0x1ada18[_0xced3('0x1b')]||0x0)+(_0x1ada18[_0xced3('0x1c')]||0x0)+(_0x1ada18[_0xced3('0x1d')]||0x0)+(_0x1ada18[_0xced3('0x1e')]||0x0)+(_0x1ada18[_0xced3('0x1f')]||0x0);this[_0xced3('0x1b')]=_0x1ada18[_0xced3('0x1b')]||0x0;this[_0xced3('0x1c')]=_0x1ada18[_0xced3('0x1c')]||0x0;this['countabandonedretry']=_0x1ada18['countabandonedretry']||0x0;this['countmachineretry']=_0x1ada18[_0xced3('0x1e')]||0x0;this[_0xced3('0x1f')]=_0x1ada18[_0xced3('0x1f')]||0x0;this['callback']=_0x1ada18[_0xced3('0x20')];this[_0xced3('0x21')]=_0x1ada18['callbackuniqueid'];this['callbackat']=_0x1ada18[_0xced3('0x22')];this[_0xced3('0x23')]=_0x1ada18[_0xced3('0x23')];this[_0xced3('0x24')]=_0x1ada18['ContactId'];this[_0xced3('0x25')]=_0x1ada18[_0xced3('0x25')];this['UserId']=_[_0xced3('0x3')](_0x1ada18['Agent'])?_0x1ada18[_0xced3('0x26')]:_0x1ada18[_0xced3('0xb')]['id'];this[_0xced3('0x27')]=_0x1ada18[_0xced3('0x27')];this[_0xced3('0x28')]='';this['originatecalleridname']='';}Action['prototype'][_0xced3('0x29')]=function(){return util['format'](_0xced3('0x2a'),this[_0xced3('0xf')],this['number']);};module[_0xced3('0x2b')]=Action; \ No newline at end of file +var _0xfff0=['recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','uniqueid','queue','type','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0xfff0,0x139));var _0x0fff=function(_0x39abe3,_0x130a84){_0x39abe3=_0x39abe3-0x0;var _0x254614=_0xfff0[_0x39abe3];return _0x254614;};'use strict';var util=require('util');var _=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));function checkNameSurname(_0x148db8,_0x527213,_0x37165b){var _0x1f4065='';if(!_[_0x0fff('0x2')](_0x527213)&&'string'===typeof _0x527213){_0x1f4065+=_0x527213;}if(!_[_0x0fff('0x2')](_0x37165b)&&_0x0fff('0x3')===typeof _0x37165b){_0x1f4065+='\x20'+_0x37165b;}if(_0x1f4065!==''){return _0x1f4065;}return _0x148db8;}function Action(_0x53c517,_0x33c813,_0x4c2221,_0x2f1d2b,_0x586dc5){this[_0x0fff('0x4')]=_0x4c2221||undefined;this['idContact']=_0x53c517['id'];this[_0x0fff('0x5')]=_0x33c813['name'];this[_0x0fff('0x6')]=_0x33c813[_0x0fff('0x6')];this['campaigntype']=_0x0fff('0x5');this[_0x0fff('0x7')]=![];this[_0x0fff('0x8')]=_[_0x0fff('0x2')](_0x53c517[_0x0fff('0x9')])?undefined:_0x53c517[_0x0fff('0x9')][_0x0fff('0xa')];this[_0x0fff('0xb')]=this[_0x0fff('0x8')]?util[_0x0fff('0xc')](_0x0fff('0xd'),this['membername']):_0x2f1d2b||undefined;this[_0x0fff('0xe')]=checkNameSurname(_0x53c517['Contact'][_0x0fff('0xf')],_0x53c517[_0x0fff('0x10')][_0x0fff('0x11')],_0x53c517[_0x0fff('0x10')]['lastName']);this['active']=_0x53c517[_0x0fff('0x12')]||![];this['calleridnum']=_0x53c517['phone'];this['scheduledat']=_0x53c517[_0x0fff('0x13')];this[_0x0fff('0x14')]=_0x53c517['countbusyretry']||0x0;this[_0x0fff('0x15')]=_0x53c517[_0x0fff('0x15')]||0x0;this['countnoanswerretry']=_0x53c517['countnoanswerretry']||0x0;this['countglobal']=(_0x53c517[_0x0fff('0x14')]||0x0)+(_0x53c517[_0x0fff('0x15')]||0x0)+(_0x53c517[_0x0fff('0x16')]||0x0)+(_0x53c517[_0x0fff('0x17')]||0x0)+(_0x53c517[_0x0fff('0x18')]||0x0)+(_0x53c517[_0x0fff('0x19')]||0x0)+(_0x53c517['countmachineretry']||0x0)+(_0x53c517[_0x0fff('0x1a')]||0x0);this[_0x0fff('0x17')]=_0x53c517[_0x0fff('0x17')]||0x0;this['countdropretry']=_0x53c517['countdropretry']||0x0;this[_0x0fff('0x19')]=_0x53c517[_0x0fff('0x19')]||0x0;this[_0x0fff('0x1b')]=_0x53c517[_0x0fff('0x1b')]||0x0;this['countagentrejectretry']=_0x53c517[_0x0fff('0x1a')]||0x0;this[_0x0fff('0x1c')]=_0x53c517[_0x0fff('0x1c')];this[_0x0fff('0x1d')]=_0x53c517[_0x0fff('0x1d')];this[_0x0fff('0x1e')]=_0x53c517['callbackat'];this[_0x0fff('0x1f')]=_0x53c517[_0x0fff('0x1f')];this[_0x0fff('0x20')]=_0x53c517[_0x0fff('0x20')];this[_0x0fff('0x21')]=_0x53c517[_0x0fff('0x21')];this['UserId']=_[_0x0fff('0x2')](_0x53c517[_0x0fff('0x9')])?_0x53c517[_0x0fff('0x22')]:_0x53c517[_0x0fff('0x9')]['id'];this[_0x0fff('0x23')]=_0x53c517[_0x0fff('0x23')];this[_0x0fff('0x24')]='';this[_0x0fff('0x25')]='';}Action[_0x0fff('0x26')][_0x0fff('0x27')]=function(){return util[_0x0fff('0xc')](_0x0fff('0x28'),this['calleridname'],this[_0x0fff('0x29')]);};module[_0x0fff('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2522fdd..de05ceb 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 _0x8958=['[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','scheduledAt','unlockAgent','idContact','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','noanswer','[callProgressDetectingCustomer][logNoAnswer]','swapAdditionalPhones','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','Queue:\x20','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','SIP/%s','reachable','unlock','unlockContact','execRun','recallme','validateContact','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','TrunkBackup','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','YYYY-MM-DD\x20HH:mm:ss','Action','[originated][increment]','OriginateError','logLookAgent','clone','responsetime','response','custom:agentringnoanswer','rejected','Answer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','keys','addVariable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','lodash','ioredis','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','type','outbound','name','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','Interval','stringify','md5','format','info','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','syncCampaigns','hasOwnProperty','booked','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','Queue','originated:\x20','queue','pTalking:\x20','pick','contactId','ListId','status','channel','catch','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','then','isNil','length','getDiff','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','actioncountonusuch','incrementPreviewCounters','ANSWER','[syncHangup][talking][increment]','uniqueid','\x20Queue','acw','buildAcw','complete','[16]','[callProgressDetectingCustomer][logAnswer]'];(function(_0x3dba77,_0x31f643){var _0x348eb1=function(_0x35bc9d){while(--_0x35bc9d){_0x3dba77['push'](_0x3dba77['shift']());}};_0x348eb1(++_0x31f643);}(_0x8958,0x93));var _0x8895=function(_0x49f898,_0xcbe604){_0x49f898=_0x49f898-0x0;var _0x161c72=_0x8958[_0x49f898];return _0x161c72;};'use strict';var util=require('util');var _=require(_0x8895('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require('md5');var Redis=require(_0x8895('0x1'));var config=require('../../../config/environment');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var loggerAction=require(_0x8895('0x2'))('actionPreview');var ami=require(_0x8895('0x4'));var rpcDb=require(_0x8895('0x5'));var cmHopperAdditionalPhone=require(_0x8895('0x6'));var Action=require(_0x8895('0x7'));var ut=require(_0x8895('0x8'));config['redis']=_[_0x8895('0x9')](config[_0x8895('0xa')],{'host':_0x8895('0xb'),'port':0x18eb});var io=require(_0x8895('0xc'))(new Redis(config[_0x8895('0xa')]));var Sequence=function(){};Sequence[_0x8895('0xd')][_0x8895('0xe')]=function(_0xdb3d59){this[_0x8895('0xf')]=this[_0x8895('0xf')]?this['tail'][_0x8895('0x10')](_0xdb3d59):_0xdb3d59();};function Preview(_0x332bc9){this[_0x8895('0x11')]=new Sequence();this[_0x8895('0x12')]=_0x332bc9[_0x8895('0x13')];this[_0x8895('0x14')]=_0x332bc9['trunks'];this[_0x8895('0x15')]={};this[_0x8895('0x16')]=_0x332bc9[_0x8895('0x16')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x8895('0x17')]['bind'](this));ami['on'](_0x8895('0x18'),this[_0x8895('0x19')][_0x8895('0x1a')](this));ami['on'](_0x8895('0x1b'),this[_0x8895('0x1c')]['bind'](this));ami['on'](_0x8895('0x1d'),this[_0x8895('0x1e')][_0x8895('0x1a')](this));ami['on'](_0x8895('0x1f'),this[_0x8895('0x20')][_0x8895('0x1a')](this));ami['on'](_0x8895('0x21'),this[_0x8895('0x22')][_0x8895('0x1a')](this));ami['on'](_0x8895('0x23'),this[_0x8895('0x24')][_0x8895('0x1a')](this));ami['on'](_0x8895('0x25'),this['syncBlindTransfer']['bind'](this));this['loopCampaigns'](this[_0x8895('0x12')]);}function emit(_0x456282,_0x2d189c,_0x29449a){io['to'](_0x456282)[_0x8895('0x26')](_0x2d189c,_0x29449a);}function emitCampaignPreview(_0x35bda5){if(_0x35bda5[_0x8895('0x27')]===_0x8895('0x28')){var _0x5219ca={'id':_0x35bda5['id'],'name':_0x35bda5[_0x8895('0x29')],'strategy':_0x35bda5[_0x8895('0x2a')],'answered':_0x35bda5[_0x8895('0x2b')],'available':_0x35bda5[_0x8895('0x2c')],'loggedIn':_0x35bda5[_0x8895('0x2d')],'pTalking':_0x35bda5['pTalking'],'sumBillable':_0x35bda5['sumBillable'],'sumDuration':_0x35bda5[_0x8895('0x2e')],'sumHoldTime':_0x35bda5[_0x8895('0x2f')]||0x0,'talking':_0x35bda5[_0x8895('0x30')],'total':_0x35bda5[_0x8895('0x31')],'type':_0x35bda5['type'],'unmanaged':_0x35bda5[_0x8895('0x32')],'abandoned':_0x35bda5[_0x8895('0x33')],'waiting':_0x35bda5[_0x8895('0x34')],'loggedInDb':_0x35bda5['loggedInDb'],'dialActive':_0x35bda5['dialActive'],'dialMethod':_0x35bda5[_0x8895('0x35')],'dialOriginateCallerIdName':_0x35bda5['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x35bda5[_0x8895('0x36')],'dialOriginateTimeout':_0x35bda5[_0x8895('0x37')],'dialPrefix':_0x35bda5[_0x8895('0x38')],'outboundAnswerAgiCallsDay':_0x35bda5[_0x8895('0x39')],'outboundAnswerCallsDay':_0x35bda5[_0x8895('0x3a')],'outboundBlacklistCallsDay':_0x35bda5['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x35bda5['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x35bda5[_0x8895('0x3b')],'outboundDropCallsDayACS':_0x35bda5[_0x8895('0x3c')],'outboundDropCallsDayCallersExit':_0x35bda5[_0x8895('0x3d')],'outboundDropCallsDayTimeout':_0x35bda5[_0x8895('0x3e')],'outboundNoAnswerCallsDay':_0x35bda5[_0x8895('0x3f')],'outboundNoSuchCallsDay':_0x35bda5['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x35bda5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x35bda5[_0x8895('0x40')],'outboundRejectCallsDay':_0x35bda5[_0x8895('0x41')],'outboundUnknownCallsDay':_0x35bda5[_0x8895('0x42')],'outboundAbandonedCallsDay':_0x35bda5[_0x8895('0x43')],'predictiveIntervalAnsweredCalls':_0x35bda5[_0x8895('0x44')],'predictiveIntervalAvgHoldtime':_0x35bda5['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x35bda5[_0x8895('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x35bda5['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x35bda5[_0x8895('0x46')],'predictiveIntervalErlangCalls':_0x35bda5['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x35bda5[_0x8895('0x47')],'predictiveIntervalHitRate':_0x35bda5[_0x8895('0x48')],'predictiveIntervalMultiplicativeFactor':_0x35bda5[_0x8895('0x49')],'predictiveIntervalPauses':_0x35bda5[_0x8895('0x4a')],'predictiveIntervalAvailable':_0x35bda5[_0x8895('0x4b')],'predictiveIntervalTotalCalls':_0x35bda5['predictiveIntervalTotalCalls'],'message':_0x35bda5[_0x8895('0x4c')],'originated':_0x35bda5[_0x8895('0x4d')],'erlangCalls':_0x35bda5[_0x8895('0x4e')],'erlangCallToSecond':_0x35bda5[_0x8895('0x4f')],'erlangAbandonmentRate':_0x35bda5[_0x8895('0x50')],'erlangBusyFactor':_0x35bda5['erlangBusyFactor'],'startPredictive':_0x35bda5[_0x8895('0x51')],'startProgressive':_0x35bda5['startProgressive']};if(_0x35bda5[_0x8895('0x52')]){_0x5219ca['Trunk']={'id':_0x35bda5[_0x8895('0x52')]['id'],'name':_0x35bda5[_0x8895('0x52')][_0x8895('0x29')],'active':_0x35bda5[_0x8895('0x52')][_0x8895('0x53')],'callerid':_0x35bda5['Trunk'][_0x8895('0x54')]};}if(_0x35bda5['Interval']){_0x5219ca[_0x8895('0x55')]={'id':_0x35bda5[_0x8895('0x55')]['id'],'name':_0x35bda5[_0x8895('0x55')][_0x8895('0x29')]};}var _0x25fa39=md5(JSON[_0x8895('0x56')](_0x5219ca));if(_0x35bda5['md5']!==_0x25fa39){_0x35bda5[_0x8895('0x57')]=_0x25fa39;emit(util[_0x8895('0x58')]('voice:queue:%s',_0x5219ca[_0x8895('0x29')]),'voice_queue:save',_0x5219ca);}}}function emitVoiceQueueChannelRemove(_0x134d5c){logger[_0x8895('0x59')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x8895('0x56')](_0x134d5c));emit(util[_0x8895('0x58')]('voice:queue:%s',_0x134d5c['name']),_0x8895('0x5a'),_0x134d5c);io[_0x8895('0x26')](_0x8895('0x5b'),_0x134d5c);}function notSendMessagesQueue(_0x331a9e){if(_0x331a9e[_0x8895('0x5c')]){if(_0x331a9e['originated']===0x0&&_0x331a9e[_0x8895('0x5d')]===0x0){_0x331a9e[_0x8895('0x5c')]=![];_0x331a9e[_0x8895('0x2c')]=0x0;_0x331a9e[_0x8895('0x5e')]=0x0;_0x331a9e[_0x8895('0x4c')]=_0x8895('0x5f');ut['logger'](_0x8895('0x60'),_0x331a9e['name']+_0x8895('0x61'));}else{_0x331a9e[_0x8895('0x4c')]='DEACTIVATED';ut[_0x8895('0x62')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x331a9e[_0x8895('0x29')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x331a9e);}}Preview['prototype']['loopCampaigns']=function(){var _0x4cd625=this;setInterval(function(){_0x4cd625['syncCampaigns']();},0x7cf);};Preview['prototype'][_0x8895('0x63')]=function(){var _0x206f57=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x261bb1 in _0x206f57){if(_0x206f57[_0x8895('0x64')](_0x261bb1)&&(_0x206f57[_0x261bb1]['dialMethod']===_0x8895('0x3')||_0x206f57[_0x261bb1][_0x8895('0x35')]===_0x8895('0x65'))&&_0x206f57[_0x261bb1][_0x8895('0x27')]===_0x8895('0x28')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x206f57[_0x8895('0x64')](_0x261bb1)&&_0x206f57[_0x261bb1]['dialMethod']===_0x8895('0x3')&&_0x206f57[_0x261bb1][_0x8895('0x27')]===_0x8895('0x28')){if(_0x206f57[_0x261bb1][_0x8895('0x66')]){this['setMessage'](_0x206f57[_0x261bb1]);if(_0x206f57[_0x261bb1][_0x8895('0x67')])this[_0x8895('0x68')](_0x206f57[_0x261bb1]);}else{notSendMessagesQueue(_0x206f57[_0x261bb1]);}}}};Preview[_0x8895('0xd')][_0x8895('0x69')]=function(_0x2d585c){var _0x15868f=this;this[_0x8895('0x11')][_0x8895('0xe')](function(){if(!_['isNil'](_0x15868f[_0x8895('0x15')][_0x2d585c])){loggerAction[_0x8895('0x59')]('[clearZombieChannels][talking]',_0x2d585c,_0x8895('0x6a'),_0x15868f['actions'][_0x2d585c]['queue'],_0x8895('0x6b'),JSON[_0x8895('0x56')](_0x15868f[_0x8895('0x12')][_0x15868f['actions'][_0x2d585c][_0x8895('0x6c')]]['originated']),_0x8895('0x6d'),JSON[_0x8895('0x56')](_0x15868f[_0x8895('0x12')][_0x15868f[_0x8895('0x15')][_0x2d585c][_0x8895('0x6c')]][_0x8895('0x5d')]),JSON[_0x8895('0x56')](_0x15868f['actions'][_0x2d585c]['dialAnswer']),JSON[_0x8895('0x56')](_[_0x8895('0x6e')](_0x15868f['actions'][_0x2d585c],[_0x8895('0x6f'),'UserId','VoiceQueueId',_0x8895('0x70')])));return ami['Action']({'action':_0x8895('0x71'),'channel':_0x15868f[_0x8895('0x15')][_0x2d585c][_0x8895('0x72')]})[_0x8895('0x73')](function(_0x2714d3){if(_0x2714d3[_0x8895('0x4c')]===_0x8895('0x74')){setTimeout(function(){if(_0x15868f[_0x8895('0x15')][_0x2d585c]){ut['updateOriginated'](_0x15868f[_0x8895('0x12')][_0x15868f[_0x8895('0x15')][_0x2d585c][_0x8895('0x6c')]],'[clearZombieChannel]');if(_0x15868f[_0x8895('0x15')][_0x2d585c][_0x8895('0x75')]===!![]){ut[_0x8895('0x76')](_0x15868f[_0x8895('0x12')][_0x15868f[_0x8895('0x15')][_0x2d585c][_0x8895('0x6c')]],_0x8895('0x77'));ut[_0x8895('0x78')](_0x8895('0x79')+_0x2d585c,_0x15868f[_0x8895('0x15')][_0x2d585c]['queue']);}ut[_0x8895('0x78')](_0x8895('0x7a')+_0x2d585c,_0x15868f[_0x8895('0x15')][_0x2d585c][_0x8895('0x6c')]);delete _0x15868f[_0x8895('0x15')][_0x2d585c];}},0x2328);}});}});};Preview['prototype'][_0x8895('0x7b')]=function(){var _0x38c88f=this;loggerAction[_0x8895('0x59')](_0x8895('0x7c'),_[_0x8895('0x7d')](this['actions']));for(var _0x46389f in this[_0x8895('0x15')]){if(_0x38c88f[_0x8895('0x15')]['hasOwnProperty'](_0x46389f)){_0x38c88f[_0x8895('0x69')](_0x46389f);}}};Preview[_0x8895('0xd')][_0x8895('0x68')]=function(_0x4ec8eb){var _0x11153d=this;rpcDb[_0x8895('0x7e')](_0x4ec8eb['id'],ut['agentReadyId'](this[_0x8895('0x16')]))[_0x8895('0x7f')](function(_0x5198f8){if(!_[_0x8895('0x80')](_0x5198f8)){for(var _0x2794c1=0x0;_0x2794c1<_0x5198f8[_0x8895('0x81')];_0x2794c1+=0x1){if(ut[_0x8895('0x82')](_0x5198f8[_0x2794c1]['scheduledat'])<_0x4ec8eb['dialRecallMeTimeout']*0x3c){if(_0x5198f8[_0x2794c1][_0x8895('0x83')]&&!_0x5198f8[_0x2794c1][_0x8895('0x83')][_0x8895('0x84')]){_0x11153d['run'](_0x5198f8[_0x2794c1]['id'])[_0x8895('0x7f')](ut[_0x8895('0x85')]('[RecallMe]'))[_0x8895('0x73')](ut['logger2'](_0x8895('0x86')));}else{rpcDb[_0x8895('0x87')](_0x5198f8[_0x2794c1]['id']);}}else{var _0x46c521=new Action(_0x5198f8[_0x2794c1],_0x4ec8eb);_0x46c521[_0x8895('0x88')]=moment()[_0x8895('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ec8eb['outboundReCallsDay']+=0x1;ut[_0x8895('0x89')](_0x46c521,0x17,_0x8895('0x8a'));if(_0x4ec8eb['dialRecallInQueue']){rpcDb[_0x8895('0x8b')](ut[_0x8895('0x8c')](_0x5198f8[_0x2794c1]));rpcDb[_0x8895('0x8d')](_0x46c521,_0x8895('0x8e'));}else{ut['logCustomer'](_0x46c521,0x16,_0x8895('0x8f'));rpcDb[_0x8895('0x8d')](_0x46c521,_0x8895('0x90'));rpcDb[_0x8895('0x91')](_0x46c521,_0x8895('0x90'));}}}}})[_0x8895('0x73')](ut[_0x8895('0x85')](_0x8895('0x92')));};Preview[_0x8895('0xd')][_0x8895('0x93')]=function(_0xb903d8){_0xb903d8[_0x8895('0x5c')]=!![];if(ut[_0x8895('0x94')](_0xb903d8[_0x8895('0x2d')])){_0xb903d8[_0x8895('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0xb903d8['dialActive'])){_0xb903d8[_0x8895('0x4c')]=_0x8895('0x5f');}else if(!this[_0x8895('0x95')](_0xb903d8[_0x8895('0x52')])){if(!this[_0x8895('0x95')](_0xb903d8['TrunkBackup'])){_0xb903d8[_0x8895('0x4c')]=_0x8895('0x96');}else{_0xb903d8['message']=_0x8895('0x97');}}else{_0xb903d8[_0x8895('0x4c')]=_0x8895('0x97');}emitCampaignPreview(_0xb903d8);};Preview[_0x8895('0xd')][_0x8895('0x98')]=function(_0x526ac9,_0x6440ea,_0x3c318c){var _0x119624=this;var _0x43bb78=this[_0x8895('0x15')][_0x6440ea];var _0x7a312c=this[_0x8895('0x12')][_0x43bb78['queue']];var _0x10d395;var _0x26f482=![];var _0x49dcab=0x2;var _0x1ffefd=0x3;if(_0x7a312c){switch(_0x3c318c){case'1':_0x7a312c[_0x8895('0x99')]+=0x1;_0x43bb78[_0x8895('0x9a')]+=0x1;_0x43bb78[_0x8895('0x9b')]=ut[_0x8895('0x9c')](_0x43bb78);ut['logCustomer'](_0x43bb78,0x0,_0x8895('0x9d'));ami['emit'](_0x8895('0x9e'),ut[_0x8895('0x9f')](_0x43bb78,'nosuchnumber'));rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xa0'));_0x119624[_0x8895('0xa1')](_0x43bb78,'0',_0x7a312c)[_0x8895('0x7f')](function(_0x57e429){_0x26f482=_0x57e429[_0x8895('0xa2')]==0x1;_0x49dcab=_0x7a312c['dialNoSuchNumberRetryFrequency'];_0x1ffefd=_0x7a312c['callAdditionalPhoneAfterMin'];if(!_0x26f482){if(ut[_0x8895('0x9c')](_0x43bb78)>=_0x7a312c[_0x8895('0xa3')]){_0x10d395=ut[_0x8895('0xa4')](_0x43bb78,0xf,'Global');rpcDb[_0x8895('0x91')](_0x10d395,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x43bb78[_0x8895('0x9a')]>=_0x7a312c[_0x8895('0xa5')]){rpcDb[_0x8895('0x91')](_0x43bb78,_0x8895('0xa6'));}else{rpcDb[_0x8895('0xa7')](ut['scheduledAt'](_0x43bb78,'countnosuchnumberretry',_0x7a312c[_0x8895('0xa8')]),_0x43bb78['unlockAgent'],_0x43bb78[_0x8895('0xa9')]);}}delete this[_0x8895('0x15')][_0x526ac9['linkedid']];}else{_0x43bb78[_0x8895('0x9a')]++;logger[_0x8895('0x59')](_0x8895('0xaa'),_0x43bb78[_0x8895('0x9a')]);logger[_0x8895('0x59')]('id',_0x43bb78['idContact']);_0x119624[_0x8895('0xab')]({'id':_0x43bb78['idContact'],'field':{'countnosuchnumberretry':_0x43bb78['countnosuchnumberretry']}})[_0x8895('0x7f')](function(){_0x119624['swapAdditionalPhones'](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(){});});}});break;case _0x8895('0xac'):var _0x64eca7=moment()[_0x8895('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x43bb78['responsetime']=_0x64eca7;_0x43bb78['answertime']=_0x64eca7;_0x43bb78[_0x8895('0x75')]=!![];_0x7a312c[_0x8895('0x5d')]+=0x1;logger[_0x8895('0x59')](_0x8895('0xad'),_0x43bb78[_0x8895('0xae')],_0x8895('0xaf'),_0x7a312c['name'],_0x8895('0x6d'),_0x7a312c[_0x8895('0x5d')]);ami[_0x8895('0x26')]('custom:agentconnect',ut[_0x8895('0x9f')](_0x43bb78,'connect',this[_0x8895('0x12')][_0x43bb78['queue']]));if(_0x7a312c[_0x8895('0xb0')]){ami[_0x8895('0x26')]('custom:agentConnectPreview',ut[_0x8895('0xb1')](_0x43bb78));}break;case'16':ami[_0x8895('0x26')]('custom:agentcomplete',ut[_0x8895('0x9f')](_0x43bb78,_0x8895('0xb2'),this[_0x8895('0x12')][_0x43bb78[_0x8895('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0x8895('0x9f')](_0x43bb78,_0x8895('0xb2')));_0x7a312c[_0x8895('0x3a')]+=0x1;_0x7a312c['total']+=0x1;_0x7a312c[_0x8895('0x2b')]+=0x1;ut['decrementTalkink'](_0x7a312c,_0x8895('0xb3'));_0x43bb78[_0x8895('0x9b')]=ut[_0x8895('0x9c')](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0x4,'Answer');rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xb4'));rpcDb[_0x8895('0x91')](_0x43bb78,_0x8895('0xb5'));rpcDb[_0x8895('0xb6')](_0x43bb78);_0x7a312c[_0x8895('0x2e')]+=_0x43bb78[_0x8895('0xb7')];_0x7a312c[_0x8895('0xb8')]+=_0x43bb78['talktime'];logger[_0x8895('0x59')](_0x8895('0xb9'),_0x43bb78['uniqueid'],'\x20Queue',_0x7a312c[_0x8895('0x29')],_0x8895('0x6d'),_0x7a312c[_0x8895('0x5d')]);delete this[_0x8895('0x15')][_0x526ac9['linkedid']];break;case'BUSY':_0x7a312c[_0x8895('0xba')]+=0x1;_0x43bb78[_0x8895('0xbb')]+=0x1;_0x43bb78[_0x8895('0x9b')]=ut[_0x8895('0x9c')](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0x5,'Busy');_0x49dcab=_0x7a312c[_0x8895('0xbc')];_0x1ffefd=_0x7a312c[_0x8895('0xbd')];ami['emit'](_0x8895('0xbe'),ut[_0x8895('0x9f')](_0x43bb78,_0x8895('0xbf')));rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xc0'));_0x119624[_0x8895('0xa1')](_0x43bb78,'5',_0x7a312c)['then'](function(_0x3ec392){_0x26f482=_0x3ec392[_0x8895('0xa2')]==0x1;if(!_0x26f482){if(ut['totalGlobal'](_0x43bb78)>=_0x7a312c['dialGlobalMaxRetry']){_0x10d395=ut['cloneAction'](_0x43bb78,0xf,_0x8895('0xc1'));rpcDb[_0x8895('0x91')](_0x10d395,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x43bb78[_0x8895('0xbb')]>=_0x7a312c['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x43bb78,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8895('0xa7')](ut[_0x8895('0xc2')](_0x43bb78,_0x8895('0xbb'),_0x7a312c[_0x8895('0xbc')]),_0x43bb78[_0x8895('0xc3')],_0x43bb78['activeContact']);}}}else{_0x43bb78[_0x8895('0xbb')]++;_0x119624[_0x8895('0xab')]({'id':_0x43bb78[_0x8895('0xc4')],'field':{'countbusyretry':_0x43bb78['countbusyretry']}})['then'](function(){_0x119624['swapAdditionalPhones'](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(){});});}});break;case _0x8895('0xc5'):_0x7a312c[_0x8895('0x3f')]+=0x1;_0x43bb78[_0x8895('0xc6')]+=0x1;_0x43bb78[_0x8895('0x9b')]=ut[_0x8895('0x9c')](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0x3,'NoAnswer');_0x49dcab=_0x7a312c[_0x8895('0xc7')];_0x1ffefd=_0x7a312c['callAdditionalPhoneAfterMin'];ami[_0x8895('0x26')]('custom:agentnoanswer',ut[_0x8895('0x9f')](_0x43bb78,_0x8895('0xc8')));rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xc9'));_0x119624[_0x8895('0xa1')](_0x43bb78,'3',_0x7a312c)[_0x8895('0x7f')](function(_0x208a36){_0x26f482=_0x208a36['additional']==0x1;if(!_0x26f482){if(ut[_0x8895('0x9c')](_0x43bb78)>=_0x7a312c[_0x8895('0xa3')]){_0x10d395=ut[_0x8895('0xa4')](_0x43bb78,0xf,_0x8895('0xc1'));rpcDb[_0x8895('0x91')](_0x10d395,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x43bb78[_0x8895('0xc6')]>=_0x7a312c['dialNoAnswerMaxRetry']){rpcDb[_0x8895('0x91')](_0x43bb78,_0x8895('0xc9'));}else{rpcDb[_0x8895('0xa7')](ut[_0x8895('0xc2')](_0x43bb78,_0x8895('0xc6'),_0x7a312c[_0x8895('0xc7')]),_0x43bb78[_0x8895('0xc3')],_0x43bb78[_0x8895('0xa9')]);}}}else{_0x43bb78[_0x8895('0xc6')]++;_0x119624['incrementPreviewCounters']({'id':_0x43bb78[_0x8895('0xc4')],'field':{'countnoanswerretry':_0x43bb78['countnoanswerretry']}})[_0x8895('0x7f')](function(){_0x119624[_0x8895('0xca')](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(){});});}});break;case'CONGESTION':_0x7a312c[_0x8895('0x3b')]+=0x1;_0x43bb78['countcongestionretry']+=0x1;_0x43bb78[_0x8895('0x9b')]=ut[_0x8895('0x9c')](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0x8,_0x8895('0xcb'));_0x49dcab=_0x7a312c['dialCongestionRetryFrequency'];_0x1ffefd=_0x7a312c['callAdditionalPhoneAfterMin'];ami[_0x8895('0x26')]('custom:agentcongestion',ut['buildObj'](_0x43bb78,_0x8895('0xcc')));rpcDb['createCustomerHistory'](_0x43bb78,_0x8895('0xcd'));_0x119624[_0x8895('0xa1')](_0x43bb78,'8',_0x7a312c)[_0x8895('0x7f')](function(_0xcb467c){_0x26f482=_0xcb467c[_0x8895('0xa2')]==0x1;if(!_0x26f482){if(ut[_0x8895('0x9c')](_0x43bb78)>=_0x7a312c[_0x8895('0xa3')]){_0x10d395=ut[_0x8895('0xa4')](_0x43bb78,0xf,_0x8895('0xc1'));rpcDb['createCustomerFinal'](_0x10d395,_0x8895('0xce'));}else{if(_0x43bb78[_0x8895('0xcf')]>=_0x7a312c[_0x8895('0xd0')]){rpcDb['createCustomerFinal'](_0x43bb78,_0x8895('0xcd'));}else{rpcDb[_0x8895('0xa7')](ut[_0x8895('0xc2')](_0x43bb78,'countcongestionretry',_0x7a312c[_0x8895('0xbc')]),_0x43bb78[_0x8895('0xc3')],_0x43bb78[_0x8895('0xa9')]);}}}else{_0x43bb78[_0x8895('0xcf')]++;_0x119624[_0x8895('0xab')]({'id':_0x43bb78[_0x8895('0xc4')],'field':{'countcongestionretry':_0x43bb78[_0x8895('0xcf')]}})['then'](function(){_0x119624[_0x8895('0xca')](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(){});});}});break;case _0x8895('0xd1'):_0x7a312c[_0x8895('0x41')]+=0x1;_0x43bb78[_0x8895('0xd2')]+=0x1;_0x43bb78[_0x8895('0x9b')]=ut['totalGlobal'](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0x14,_0x8895('0xd3'));_0x49dcab=_0x7a312c['dialAgentRejectRetryFrequency'];_0x1ffefd=_0x7a312c['callAdditionalPhoneAfterMin'];ami[_0x8895('0x26')](_0x8895('0xd4'),ut['buildObj'](_0x43bb78,_0x8895('0xd5')));rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xd6'));_0x119624[_0x8895('0xa1')](_0x43bb78,'20',_0x7a312c)[_0x8895('0x7f')](function(_0x515f7e){_0x26f482=_0x515f7e[_0x8895('0xa2')]==0x1;if(!_0x26f482){if(ut[_0x8895('0x9c')](_0x43bb78)>=_0x7a312c[_0x8895('0xa3')]){_0x10d395=ut[_0x8895('0xa4')](_0x43bb78,0x14,_0x8895('0xd3'));rpcDb[_0x8895('0x91')](_0x10d395,_0x8895('0xd7'));}else{if(_0x43bb78[_0x8895('0xd2')]>=_0x7a312c[_0x8895('0xd8')]){rpcDb[_0x8895('0x91')](_0x43bb78,_0x8895('0xd7'));}else{rpcDb[_0x8895('0xa7')](ut['scheduledAt'](_0x43bb78,_0x8895('0xd2'),_0x7a312c[_0x8895('0xd9')]),_0x43bb78[_0x8895('0xc3')],_0x43bb78[_0x8895('0xa9')]);}}}else{_0x43bb78['countnoanswerretry']++;_0x119624[_0x8895('0xab')]({'id':_0x43bb78[_0x8895('0xc4')],'field':{'countnoanswerretry':_0x43bb78['countnoanswerretry']}})['then'](function(){_0x119624[_0x8895('0xca')](_0x43bb78,_0x49dcab,_0x1ffefd)['then'](function(){});});}});break;case _0x8895('0xda'):_0x7a312c['outboundAbandonedCallsDay']+=0x1;_0x43bb78['countabandonedretry']+=0x1;_0x43bb78[_0x8895('0x9b')]=ut['totalGlobal'](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0xb,'Abandoned');rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xdb'));_0x119624['verifyAdditionalPhones'](_0x43bb78,'11',_0x7a312c)[_0x8895('0x7f')](function(_0x3636ab){_0x26f482=_0x3636ab[_0x8895('0xa2')]==0x1;if(!_0x26f482){if(ut['totalGlobal'](_0x43bb78)>=_0x7a312c['dialGlobalMaxRetry']){_0x10d395=ut[_0x8895('0xa4')](_0x43bb78,0xf,_0x8895('0xc1'));rpcDb[_0x8895('0x91')](_0x10d395,_0x8895('0xdb'));}else{if(_0x43bb78[_0x8895('0xdc')]>=_0x7a312c[_0x8895('0xdd')]){rpcDb[_0x8895('0x91')](_0x43bb78,_0x8895('0xdb'));}else{rpcDb[_0x8895('0xa7')](ut[_0x8895('0xc2')](_0x43bb78,_0x8895('0xde'),_0x7a312c[_0x8895('0xdf')]),_0x43bb78[_0x8895('0xc3')],_0x43bb78[_0x8895('0xa9')]);}}}else{_0x43bb78['countnoanswerretry']++;_0x119624[_0x8895('0xab')]({'id':_0x43bb78[_0x8895('0xc4')],'field':{'countnoanswerretry':_0x43bb78[_0x8895('0xc6')]}})[_0x8895('0x7f')](function(){_0x119624['swapAdditionalPhones'](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(){});});}});break;case'18':_0x7a312c[_0x8895('0x42')]+=0x1;_0x43bb78[_0x8895('0xe0')]+=0x1;_0x43bb78[_0x8895('0x9b')]=ut[_0x8895('0x9c')](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0x12,_0x526ac9[_0x8895('0xe1')]||_0x526ac9[_0x8895('0xe2')]);ami[_0x8895('0x26')](_0x8895('0xe3'),ut[_0x8895('0x9f')](_0x43bb78,_0x8895('0xe4')));rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xe5'));_0x119624[_0x8895('0xa1')](_0x43bb78,'18',_0x7a312c)[_0x8895('0x7f')](function(_0x4c4291){_0x26f482=_0x4c4291[_0x8895('0xa2')]==0x1;if(!_0x26f482){if(ut['totalGlobal'](_0x43bb78)>=_0x7a312c[_0x8895('0xa3')]){_0x10d395=ut[_0x8895('0xa4')](_0x43bb78,0x12,_0x8895('0xc1'));rpcDb['createCustomerFinal'](_0x10d395,_0x8895('0xe5'));}else{rpcDb[_0x8895('0x91')](_0x43bb78,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x43bb78[_0x8895('0xc6')]++;_0x119624['incrementPreviewCounters']({'id':_0x43bb78[_0x8895('0xc4')],'field':{'countnoanswerretry':_0x43bb78['countnoanswerretry']}})['then'](function(){_0x119624[_0x8895('0xca')](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(){});});}});delete this[_0x8895('0x15')][_0x526ac9[_0x8895('0xe6')]];break;case'19':_0x7a312c[_0x8895('0x42')]+=0x1;_0x43bb78['countglobal']=ut[_0x8895('0x9c')](_0x43bb78);ut['logCustomer'](_0x43bb78,0x13,_0x526ac9['cause-txt']||_0x526ac9[_0x8895('0xe2')]);ami[_0x8895('0x26')]('custom:amd',ut[_0x8895('0x9f')](_0x43bb78,_0x8895('0xe4')));rpcDb[_0x8895('0x8d')](_0x43bb78,'[callProgressDetectingCustomer][machine]');_0x119624[_0x8895('0xa1')](_0x43bb78,'18',_0x7a312c)[_0x8895('0x7f')](function(_0x114200){_0x26f482=_0x114200['additional']==0x1;if(!_0x26f482){if(ut[_0x8895('0x9c')](_0x43bb78)>=_0x7a312c[_0x8895('0xa3')]){_0x10d395=ut[_0x8895('0xa4')](_0x43bb78,0xf,_0x8895('0xc1'));rpcDb[_0x8895('0x91')](_0x10d395,_0x8895('0xe7'));}else{rpcDb[_0x8895('0x91')](_0x43bb78,_0x8895('0xe7'));}}else{_0x43bb78['countnoanswerretry']++;_0x119624['incrementPreviewCounters']({'id':_0x43bb78[_0x8895('0xc4')],'field':{'countnoanswerretry':_0x43bb78['countnoanswerretry']}})[_0x8895('0x7f')](function(){_0x119624[_0x8895('0xca')](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(){});});}});delete this[_0x8895('0x15')][_0x526ac9[_0x8895('0xe6')]];break;default:if(_0x43bb78[_0x8895('0x75')]){ut[_0x8895('0x76')](_0x7a312c,_0x8895('0xe8'));ut[_0x8895('0x78')](_0x8895('0xe9')+_0x7a312c[_0x8895('0x29')],_0x526ac9);}_0x7a312c[_0x8895('0x42')]+=0x1;_0x43bb78['countglobal']=ut[_0x8895('0x9c')](_0x43bb78);ut[_0x8895('0x89')](_0x43bb78,0xc,_0x526ac9[_0x8895('0xe1')]||_0x526ac9[_0x8895('0xe2')]);_0x49dcab=_0x7a312c[_0x8895('0xd9')];_0x1ffefd=_0x7a312c[_0x8895('0xbd')];rpcDb[_0x8895('0x8d')](_0x43bb78,_0x8895('0xea'));_0x119624[_0x8895('0xa1')](_0x43bb78,'20',_0x7a312c)[_0x8895('0x7f')](function(_0x359ad4){_0x26f482=_0x359ad4[_0x8895('0xa2')]==0x1;if(!_0x26f482){if(ut[_0x8895('0x9c')](_0x43bb78)>=_0x7a312c[_0x8895('0xa3')]){_0x10d395=ut['cloneAction'](_0x43bb78,0xf,_0x8895('0xc1'));rpcDb['createCustomerFinal'](_0x10d395,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x43bb78,_0x8895('0xeb'));}delete this[_0x8895('0x15')][_0x526ac9[_0x8895('0xe6')]];}else{_0x119624['swapAdditionalPhones'](_0x43bb78,_0x49dcab,_0x1ffefd)[_0x8895('0x7f')](function(_0x1c7920){});}});}if(!(_0x43bb78[_0x8895('0x75')]&&_0x3c318c==='16')){ut['updateOriginated'](_0x7a312c,_0x8895('0xec'));logger[_0x8895('0x59')](_0x8895('0xed'),_0x43bb78['uniqueid'],_0x8895('0xaf'),_0x7a312c[_0x8895('0x29')],_0x8895('0x6b'),_0x7a312c[_0x8895('0x4d')]);}if(_0x3c318c!==_0x8895('0xac')){delete this[_0x8895('0x15')][_0x526ac9['linkedid']];delete this[_0x8895('0x15')][_0x526ac9[_0x8895('0xee')]];}}};Preview['prototype'][_0x8895('0xef')]=function(_0x108bde,_0x2e1983,_0x259b25){if(_[_0x8895('0xf0')](_0x2e1983)&&_0x8895('0xf1')!==typeof _0x2e1983){return;}if(_[_0x8895('0xf0')](_0x259b25)&&_0x8895('0xf1')!==typeof _0x259b25){return;}switch(_0x259b25[_0x8895('0xf2')]){case'0':ut[_0x8895('0xf3')](_0x108bde,0x0,_0x8895('0x9d'));rpcDb['createAgentHistory'](_0x108bde,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x8895('0xf3')](_0x108bde,0x3,_0x8895('0xf4'));rpcDb[_0x8895('0xf5')](_0x108bde,_0x8895('0xf6'));break;case'5':ut[_0x8895('0xf3')](_0x108bde,0x5,_0x8895('0xf7'));rpcDb[_0x8895('0xf5')](_0x108bde,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x108bde,0x8,_0x8895('0xcb'));rpcDb[_0x8895('0xf5')](_0x108bde,_0x8895('0xf8'));break;case'22':ut[_0x8895('0xf3')](_0x108bde,0x16,_0x8895('0xf9'));rpcDb[_0x8895('0xf5')](_0x108bde,_0x8895('0xfa'));break;default:ut[_0x8895('0xf3')](_0x108bde,0xc,_0x259b25[_0x8895('0xf2')]);rpcDb[_0x8895('0xf5')](_0x108bde,'[callProgressDetectingAgent][logCongestion]');}ut[_0x8895('0xfb')](_0x2e1983,'[callProgressDetectingAgent]');logger[_0x8895('0x59')](_0x8895('0xfc'),_0x108bde[_0x8895('0xae')],'\x20Queue',_0x2e1983['name'],'originated:\x20',_0x2e1983[_0x8895('0x4d')]);delete this['actions'][_0x108bde[_0x8895('0xae')]];};Preview[_0x8895('0xd')][_0x8895('0xa1')]=function(_0x4a4cb9,_0x3ccf2a,_0x3a348d){return BPromise['resolve']()[_0x8895('0x7f')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4a4cb9,_0x3ccf2a,_0x3a348d))[_0x8895('0x73')](logger[_0x8895('0x59')](_0x8895('0xfd')));};Preview[_0x8895('0xd')][_0x8895('0xca')]=function(_0x4ae8a2,_0x50eea8,_0x3c21e4){return BPromise[_0x8895('0xfe')]()[_0x8895('0x7f')](cmHopperAdditionalPhone[_0x8895('0xca')](_0x4ae8a2,_0x50eea8,_0x3c21e4))[_0x8895('0x73')](logger[_0x8895('0x59')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0x8895('0xab')]=function(_0x3a6226){return BPromise[_0x8895('0xfe')]()[_0x8895('0x7f')](cmHopperAdditionalPhone[_0x8895('0xab')](_0x3a6226))['catch'](logger['info'](_0x8895('0xff')));};Preview['prototype']['checkInBlack']=function(_0x21a242,_0x1f9a65,_0x4ba848,_0x18d965,_0x5f0b5f){var _0x29cb64=this;return new BPromise(function(_0x242a19,_0x206b43){if(_[_0x8895('0x80')](_0x1f9a65)||_[_0x8895('0x80')](_0x1f9a65[_0x8895('0x100')])||_['isNil'](_0x1f9a65[_0x8895('0x101')])||_[_0x8895('0x80')](_0x1f9a65[_0x8895('0x102')])){_0x206b43(ut[_0x8895('0x4c')](_0x8895('0x103'),_0x18d965,_0x5f0b5f));return;}var _0x5a18c0=uuid['v4']();var _0x584867=_0x29cb64[_0x8895('0x12')][_0x1f9a65[_0x8895('0x6a')][_0x8895('0x29')]];var _0x2e0bcf=_0x4ba848?_0x29cb64[_0x8895('0x16')][_0x4ba848]['id']:undefined;_0x29cb64['actions'][_0x5a18c0]=new Action(_0x1f9a65,_0x584867,_0x5a18c0,_0x4ba848,_0x2e0bcf);var _0x5cf33e=_0x29cb64['actions'][_0x5a18c0];_0x5cf33e[_0x8895('0xc3')]=_0x18d965;_0x5cf33e[_0x8895('0xa9')]=_0x5f0b5f;_0x5cf33e[_0x8895('0x104')]=_0x4ba848;if(_['isEmpty'](_0x21a242)){_0x29cb64['execCall'](_0x5cf33e,_0x584867,_0x1f9a65,_0x4ba848)[_0x8895('0x7f')](function(_0xfee1e){logger[_0x8895('0x59')](_0x8895('0x105'),_0x8895('0x106')+_0x5cf33e[_0x8895('0x6c')]+'\x20IdHopper:\x20'+_0x5cf33e['idContact'],JSON[_0x8895('0x56')](_0xfee1e));ami[_0x8895('0x26')]('custom:agentcalled',ut[_0x8895('0x9f')](_0x5cf33e,'called',_0x29cb64['campaignsPreview'][_0x5cf33e[_0x8895('0x6c')]]));_0x242a19(ut[_0x8895('0x4c')](_0x8895('0x107')));})['catch'](function(_0x2ca29e){ut['logger'](_0x8895('0x108'),_0x2ca29e);_0x206b43(ut[_0x8895('0x4c')]('Call\x20failed',_0x18d965,_0x5f0b5f));});}else{_0x584867[_0x8895('0x109')]+=0x1;ut['logBlacklist'](_0x5cf33e);rpcDb[_0x8895('0x10a')](_0x5cf33e,_0x8895('0x10b'));delete _0x29cb64[_0x8895('0x15')][_0x5a18c0];_0x206b43(ut[_0x8895('0x4c')]('Contact\x20in\x20black\x20List',_0x18d965,_0x5f0b5f));}});};Preview[_0x8895('0xd')]['isTrunkReachable']=function(_0x2f2490){return!_[_0x8895('0x80')](_0x2f2490)&&!_[_0x8895('0x80')](_0x2f2490[_0x8895('0x29')])&&!_[_0x8895('0x80')](_0x2f2490[_0x8895('0x53')])&&_0x2f2490[_0x8895('0x53')]&&!_[_0x8895('0x80')](this[_0x8895('0x14')][util[_0x8895('0x58')](_0x8895('0x10c'),_0x2f2490['name'])])&&!_[_0x8895('0x80')](this[_0x8895('0x14')][util[_0x8895('0x58')]('SIP/%s',_0x2f2490[_0x8895('0x29')])][_0x8895('0x71')])&&(this['trunks'][util[_0x8895('0x58')](_0x8895('0x10c'),_0x2f2490[_0x8895('0x29')])][_0x8895('0x71')]===_0x8895('0x10d')||this[_0x8895('0x14')][util[_0x8895('0x58')](_0x8895('0x10c'),_0x2f2490[_0x8895('0x29')])]['status']==='unmonitored');};Preview[_0x8895('0xd')]['run']=function(_0x7dae44,_0x1953c7){var _0x399543=this;return new BPromise(function(_0x5358cb,_0x3050ed){_0x399543['execRun'](_0x7dae44,_0x1953c7)[_0x8895('0x7f')](function(_0x274fde){_0x5358cb(_['pick'](_0x274fde,[_0x8895('0x4c')]));})[_0x8895('0x73')](function(_0x3dbd17){if(_0x3dbd17[_0x8895('0x10e')]){rpcDb[_0x8895('0x10f')](_0x7dae44);}if(_0x3dbd17['active']){rpcDb[_0x8895('0x87')](_0x7dae44);}_0x3050ed(_[_0x8895('0x6e')](_0x3dbd17,['message']));});});};Preview['prototype'][_0x8895('0x110')]=function(_0x50a5c1,_0x2c3fd9){var _0x14cbd0=this;return new BPromise(function(_0x284811,_0x9eee06){var _0x14ab10,_0x170051;rpcDb['getContactPreview'](_0x50a5c1)[_0x8895('0x7f')](function(_0x993687){if(!_[_0x8895('0x80')](_0x993687[0x0])){_0x170051=_0x993687[0x0][_0x8895('0x111')]?![]:!![];_0x14ab10=_0x993687[0x0][_0x8895('0x111')]?!![]:![];_0x14ab10=_0x2c3fd9?!![]:_0x14ab10;}var _0x246445=_0x14cbd0[_0x8895('0x112')](_0x993687);if(_0x246445['isValid']){rpcDb['checkIsBlackList'](_[_0x8895('0x6e')](_0x993687[0x0],[_0x8895('0x102'),_0x8895('0x101')]))[_0x8895('0x7f')](function(_0x5e88f1){_0x14cbd0['checkInBlack'](_0x5e88f1,_0x993687[0x0],_0x2c3fd9,_0x170051,_0x14ab10)[_0x8895('0x7f')](function(_0xf59d21){_0x284811(_0xf59d21);})[_0x8895('0x73')](function(_0x15ab18){_0x9eee06(_0x15ab18);});})[_0x8895('0x73')](function(_0x4348c5){ut['logger']('[Preview][checkIsBlackList]',_0x4348c5);_0x9eee06(ut[_0x8895('0x4c')](_0x8895('0x113'),_0x170051,_0x14ab10));});}else{_0x9eee06(ut[_0x8895('0x4c')](_0x246445[_0x8895('0x4c')],_0x170051,_0x14ab10));}})[_0x8895('0x73')](function(_0x2b8ade){ut[_0x8895('0x62')](_0x8895('0x114'),_0x2b8ade);_0x9eee06(ut[_0x8895('0x4c')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x8895('0xd')][_0x8895('0x112')]=function(_0x4843a2){if(_[_0x8895('0x80')](_0x4843a2)||_[_0x8895('0x115')](_0x4843a2)||!_[_0x8895('0x80')](_0x4843a2[0x0][_0x8895('0x83')])&&_[_0x8895('0x80')](_0x4843a2[0x0][_0x8895('0x83')][_0x8895('0x29')])){ut[_0x8895('0x62')]('[Preview][validateContact][Empty\x20Contact]',_0x4843a2);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2e5769=this[_0x8895('0x12')][_0x4843a2[0x0][_0x8895('0x6a')][_0x8895('0x29')]];_0x2e5769[_0x8895('0x4c')]=_0x8895('0x97');if(_['isNil'](_0x2e5769)){ut[_0x8895('0x62')](_0x8895('0x116'),_0x2e5769);return{'isValid':![],'message':_0x8895('0x117')};}if(!this['isTrunkReachable'](_0x2e5769[_0x8895('0x52')])){ut[_0x8895('0x62')](_0x8895('0x118'),'campaign\x20Name:\x20'+_0x2e5769[_0x8895('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x8895('0x95')](_0x2e5769[_0x8895('0x119')])){ut[_0x8895('0x62')](_0x8895('0x118'),_0x2e5769[_0x8895('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x8895('0x11a')](_0x2e5769['dialActive'])){ut[_0x8895('0x62')](_0x8895('0x11b'),_0x2e5769[_0x8895('0x29')]+_0x8895('0x11c'));return{'isValid':![],'message':_0x8895('0x11d')+_0x2e5769[_0x8895('0x29')]+_0x8895('0x11c')};}return{'isValid':!![],'message':_0x8895('0x11e')};};Preview['prototype'][_0x8895('0x11f')]=function(_0x28f043,_0xf6849b,_0x4d601a,_0x2f3aa9){var _0x5b5592=this;return new BPromise(function(_0xf48827,_0x24413d){var _0x6286c3=_0x28f043[_0x8895('0xae')];var _0x1040d8=_0x5b5592[_0x8895('0x95')](_0xf6849b['Trunk'])?util[_0x8895('0x58')](_0x8895('0x120'),_0xf6849b[_0x8895('0x52')]['name'],_[_0x8895('0x80')](_0xf6849b['dialPrefix'])?'':_0xf6849b[_0x8895('0x38')][_0x8895('0x121')]()||'',_0xf6849b[_0x8895('0x122')]>0x0?_0x4d601a[_0x8895('0x101')][_0x8895('0x123')](_0xf6849b[_0x8895('0x122')]):_0x4d601a[_0x8895('0x101')]):util[_0x8895('0x58')](_0x8895('0x120'),_[_0x8895('0x80')](_0xf6849b[_0x8895('0x119')])?_0xf6849b['Trunk']['name']:_0xf6849b[_0x8895('0x119')][_0x8895('0x29')],_[_0x8895('0x80')](_0xf6849b['dialPrefix'])?'':_0xf6849b[_0x8895('0x38')][_0x8895('0x121')]()||'',_0xf6849b['dialCutDigit']>0x0?_0x4d601a[_0x8895('0x101')]['substring'](_0xf6849b[_0x8895('0x122')]):_0x4d601a[_0x8895('0x101')]);var _0x401a0d=_0x5b5592[_0x8895('0x95')](_0xf6849b[_0x8895('0x52')])?ut[_0x8895('0x124')](_0xf6849b['Trunk'][_0x8895('0x54')],_0xf6849b[_0x8895('0x125')],_0xf6849b[_0x8895('0x126')]>0x0?ut[_0x8895('0x127')](_0xf6849b[_0x8895('0x36')],_0xf6849b[_0x8895('0x126')]):_0xf6849b[_0x8895('0x36')]):ut[_0x8895('0x124')](_['isNil'](_0xf6849b[_0x8895('0x119')])?_0xf6849b[_0x8895('0x52')][_0x8895('0x54')]:_0xf6849b[_0x8895('0x119')][_0x8895('0x54')],_0xf6849b[_0x8895('0x125')],_0xf6849b['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0xf6849b[_0x8895('0x36')],_0xf6849b[_0x8895('0x126')]):_0xf6849b[_0x8895('0x36')]);if(_0x401a0d){_0x28f043[_0x8895('0x128')]=ut[_0x8895('0x129')](_0x401a0d);_0x28f043[_0x8895('0x12a')]=ut[_0x8895('0x12b')](_0x401a0d);}var _0x4898c7=ut['addVariables'](_0xf6849b,_0x4d601a,_0x1040d8,_0x401a0d,_0x6286c3,_0x28f043);_[_0x8895('0x12c')](_0x28f043,ut['toLowerVariables'](_0x4898c7));_0x28f043[_0x8895('0x88')]=moment()[_0x8895('0x58')](_0x8895('0x12d'));ami[_0x8895('0x12e')](ut['variablesAction'](_0x28f043,_0xf6849b,_0x4898c7,_0x28f043[_0x8895('0xa9')],_0x2f3aa9))[_0x8895('0x7f')](function(_0x2e0b1a){_0xf6849b[_0x8895('0x4d')]+=0x1;logger['info'](_0x8895('0x12f'),_0x6286c3,_0x8895('0xaf'),_0xf6849b['name'],_0x8895('0x6b'),_0xf6849b[_0x8895('0x4d')]);_0xf48827(_0x2e0b1a);})[_0x8895('0x73')](function(_0x28be49){ut[_0x8895('0xf3')](_0x28f043,0xe,_0x8895('0x130'));rpcDb[_0x8895('0xf5')](_0x28f043,'[originateFailure][logOriginateFailure]');_0x24413d(_0x28be49);});});};Preview[_0x8895('0xd')][_0x8895('0x20')]=function(_0x577de0){if(this[_0x8895('0x15')][_0x577de0[_0x8895('0xe6')]]){this['actions'][_0x577de0['linkedid']][_0x8895('0x72')]=_0x577de0[_0x8895('0x72')];}};Preview[_0x8895('0xd')][_0x8895('0x17')]=function(_0x1bb46d){var _0x131c27=this;var _0x345227=this[_0x8895('0x15')][_0x1bb46d['actionid']];if(_0x345227){if(_0x345227[_0x8895('0x104')]&&this['agents'][_0x345227[_0x8895('0x104')]]){ut[_0x8895('0x131')](_0x345227,this[_0x8895('0x16')][_0x345227[_0x8895('0x104')]][_0x8895('0x29')],this['agents'][_0x345227[_0x8895('0x104')]]['id']);}var _0x201526=_[_0x8895('0x132')](_0x345227);_0x201526[_0x8895('0x133')]=moment()[_0x8895('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x419702=_0x131c27[_0x8895('0x12')][_0x345227['queue']];if(ut['isFailure'](_0x1bb46d[_0x8895('0x134')])){if(_0x345227[_0x8895('0xc3')]){rpcDb[_0x8895('0x10f')](_0x345227[_0x8895('0xc4')]);}if(_0x345227[_0x8895('0xa9')]){rpcDb[_0x8895('0x87')](_0x345227[_0x8895('0xc4')]);}ami['emit'](_0x8895('0x135'),ut['buildObj'](_0x345227,_0x8895('0x136'),this[_0x8895('0x12')][_0x345227['queue']]));this['callProgressDetectingAgent'](_0x201526,_0x419702,_0x1bb46d);}else{_0x345227[_0x8895('0x88')]=moment()[_0x8895('0x58')](_0x8895('0x12d'));ut['logAgent'](_0x201526,0x4,_0x8895('0x137'));rpcDb[_0x8895('0xf5')](_0x201526,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x8895('0xd')][_0x8895('0x19')]=function(_0x27d9f5){var _0x3862c4=this;var _0x592e3b=this[_0x8895('0x15')][_0x27d9f5['linkedid']];var _0x29ad6b;if(_0x592e3b){_0x29ad6b=this['campaignsPreview'][_0x592e3b[_0x8895('0x6c')]];logger['info']('[syncHangup][talking]',_0x27d9f5[_0x8895('0xe6')],_0x8895('0xaf'),_0x29ad6b[_0x8895('0x29')],_0x8895('0x6d'),_0x29ad6b[_0x8895('0x5d')]);}if(this[_0x8895('0x15')][_0x27d9f5[_0x8895('0xe6')]]&&_0x27d9f5['linkedid']!==_0x27d9f5['uniqueid']){if(_0x27d9f5[_0x8895('0x138')]==='16'&&this[_0x8895('0x15')][_0x27d9f5[_0x8895('0xe6')]][_0x8895('0x75')]){this[_0x8895('0x98')](_0x27d9f5,_0x27d9f5[_0x8895('0xe6')],_0x27d9f5['cause']);}else if(this[_0x8895('0x15')][_0x27d9f5[_0x8895('0xe6')]][_0x8895('0x75')]){logger[_0x8895('0x59')](_0x8895('0x139'),_0x27d9f5[_0x8895('0xe6')],_0x27d9f5[_0x8895('0x138')],'\x20Queue',_0x29ad6b[_0x8895('0x29')],_0x8895('0x6d'),_0x29ad6b[_0x8895('0x5d')]);this[_0x8895('0x98')](_0x27d9f5,_0x27d9f5[_0x8895('0xe6')],_0x27d9f5[_0x8895('0x138')]);}}else if(_0x592e3b&&_[_0x8895('0x80')](_0x592e3b[_0x8895('0x13a')])&&_0x29ad6b[_0x8895('0x13b')]&&_0x27d9f5['linkedid']===_0x27d9f5[_0x8895('0xae')]&&_[_0x8895('0x80')](_0x27d9f5[_0x8895('0xf2')])&&_0x27d9f5[_0x8895('0x138')]==='16'&&_0x27d9f5[_0x8895('0x13c')]==='6'&&_[_0x8895('0xf0')](_0x592e3b[_0x8895('0x13d')])){if(_0x592e3b[_0x8895('0xc3')]){rpcDb[_0x8895('0x10f')](_0x592e3b['idContact']);}if(_0x592e3b[_0x8895('0xa9')]){rpcDb[_0x8895('0x87')](_0x592e3b[_0x8895('0xc4')]);}_0x27d9f5[_0x8895('0xf2')]='22';this[_0x8895('0xef')](_0x592e3b,_0x29ad6b,_0x27d9f5);}else if(_0x592e3b&&_0x592e3b[_0x8895('0x13d')]){if(_0x27d9f5[_0x8895('0x138')]==='16'&&this[_0x8895('0x15')][_0x27d9f5[_0x8895('0xe6')]][_0x8895('0x75')]){logger[_0x8895('0x59')](_0x8895('0x13e'),_0x27d9f5[_0x8895('0xe6')],_0x27d9f5['cause'],_0x8895('0xaf'),_0x29ad6b[_0x8895('0x29')],_0x8895('0x6d'),_0x29ad6b[_0x8895('0x5d')]);this[_0x8895('0x98')](_0x27d9f5,_0x27d9f5[_0x8895('0xe6')],_0x27d9f5['cause']);}else if(this[_0x8895('0x15')][_0x27d9f5['linkedid']][_0x8895('0x75')]){logger[_0x8895('0x59')](_0x8895('0x139'),_0x27d9f5[_0x8895('0xe6')],_0x27d9f5[_0x8895('0x138')],_0x8895('0xaf'),_0x29ad6b[_0x8895('0x29')],_0x8895('0x6d'),_0x29ad6b[_0x8895('0x5d')]);this[_0x8895('0x98')](_0x27d9f5,_0x27d9f5[_0x8895('0xe6')],_0x27d9f5[_0x8895('0x138')]);}}};Preview[_0x8895('0xd')][_0x8895('0x1e')]=function(_0x50c48a){if(this['actions'][_0x50c48a[_0x8895('0xee')]]&&_0x50c48a[_0x8895('0xee')]!==_0x50c48a['destuniqueid']){this[_0x8895('0x98')](_0x50c48a,_0x50c48a[_0x8895('0xee')],_0x50c48a[_0x8895('0xe2')]);}};Preview[_0x8895('0xd')][_0x8895('0x1c')]=function(_0x477a7c){if(this[_0x8895('0x15')][_0x477a7c[_0x8895('0xe6')]]&&_0x477a7c[_0x8895('0xe6')]!==_0x477a7c[_0x8895('0xae')]&&!this[_0x8895('0x15')][_0x477a7c[_0x8895('0xe6')]][_0x8895('0x75')]){if(_0x477a7c[_0x8895('0x138')]==='1'){this[_0x8895('0x98')](_0x477a7c,_0x477a7c[_0x8895('0xe6')],_0x477a7c['cause']);}}};Preview[_0x8895('0xd')]['addVariable']=function(_0x38adf5,_0x2abc20,_0x1fe4ea){if(this[_0x8895('0x15')][_0x38adf5]){if(_['isNil'](this[_0x8895('0x15')][_0x38adf5]['variables'])){this[_0x8895('0x15')][_0x38adf5]['variables']={};}this['actions'][_0x38adf5]['variables'][_0x2abc20]=_0x1fe4ea;}};Preview[_0x8895('0xd')][_0x8895('0x22')]=function(_0xd49ee7){try{if(!_[_0x8895('0x80')](_0xd49ee7)){if(ut['filterKey'](_[_0x8895('0x13f')](_0xd49ee7['variable'])[0x0])){this[_0x8895('0x140')](_0xd49ee7[_0x8895('0xae')],_[_0x8895('0x13f')](_0xd49ee7['variable'])[0x0],_0xd49ee7['value']);}}}catch(_0x513923){logger[_0x8895('0x141')](_0x8895('0x142'),util[_0x8895('0x143')](_0x513923,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x8895('0x24')]=function(_0x2b68a0){if(_0x2b68a0){if(this[_0x8895('0x15')][_0x2b68a0[_0x8895('0x144')]]){this[_0x8895('0x15')][_0x2b68a0['transfertargetlinkedid']][_0x8895('0x13d')]=!![];}}};Preview['prototype'][_0x8895('0x145')]=function(_0x240854){if(_0x240854){if(this['actions'][_0x240854[_0x8895('0x146')]]){this['actions'][_0x240854[_0x8895('0x146')]][_0x8895('0x13d')]=!![];}}};module[_0x8895('0x147')]=Preview; \ No newline at end of file +var _0x8d0e=['[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','disableContact','isValid','phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','syncNewExten','logLookAgent','clone','responsetime','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destlinkedid','destuniqueid','variables','filterKey','variable','addVariable','keys','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','preview','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','[clearZombieChannel]','loggerError','[action]','getContactRecallMe','agentReadyId','then','getDiff','dialRecallMeTimeout','Agent','run','logger2','catch','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NOANSWER','custom:agentnoanswer','noanswer'];(function(_0x4dae00,_0x15b194){var _0x16bf42=function(_0x5f2a9a){while(--_0x5f2a9a){_0x4dae00['push'](_0x4dae00['shift']());}};_0x16bf42(++_0x15b194);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2e2a22,_0x2d5a61){_0x2e2a22=_0x2e2a22-0x0;var _0x19ae5e=_0x8d0e[_0x2e2a22];return _0x19ae5e;};'use strict';var util=require(_0xe8d0('0x0'));var _=require(_0xe8d0('0x1'));var BPromise=require(_0xe8d0('0x2'));var uuid=require(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var md5=require(_0xe8d0('0x5'));var Redis=require(_0xe8d0('0x6'));var config=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('preview');var loggerAction=require(_0xe8d0('0x8'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xe8d0('0x9'));var cmHopperAdditionalPhone=require(_0xe8d0('0xa'));var Action=require(_0xe8d0('0xb'));var ut=require(_0xe8d0('0xc'));config[_0xe8d0('0xd')]=_[_0xe8d0('0xe')](config[_0xe8d0('0xd')],{'host':_0xe8d0('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe8d0('0xd')]));var Sequence=function(){};Sequence[_0xe8d0('0x10')][_0xe8d0('0x11')]=function(_0x599bc3){this['tail']=this[_0xe8d0('0x12')]?this[_0xe8d0('0x12')][_0xe8d0('0x13')](_0x599bc3):_0x599bc3();};function Preview(_0x10b345){this[_0xe8d0('0x14')]=new Sequence();this[_0xe8d0('0x15')]=_0x10b345['voiceQueues'];this[_0xe8d0('0x16')]=_0x10b345[_0xe8d0('0x16')];this['actions']={};this[_0xe8d0('0x17')]=_0x10b345['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xe8d0('0x18'),this[_0xe8d0('0x19')][_0xe8d0('0x1a')](this));ami['on'](_0xe8d0('0x1b'),this[_0xe8d0('0x1c')][_0xe8d0('0x1a')](this));ami['on']('hanguprequest',this[_0xe8d0('0x1d')]['bind'](this));ami['on'](_0xe8d0('0x1e'),this[_0xe8d0('0x1f')][_0xe8d0('0x1a')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xe8d0('0x20'),this[_0xe8d0('0x21')][_0xe8d0('0x1a')](this));ami['on'](_0xe8d0('0x22'),this[_0xe8d0('0x23')]['bind'](this));ami['on'](_0xe8d0('0x24'),this[_0xe8d0('0x25')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x384a60,_0x35d131,_0x25363b){io['to'](_0x384a60)[_0xe8d0('0x26')](_0x35d131,_0x25363b);}function emitCampaignPreview(_0x25f764){if(_0x25f764[_0xe8d0('0x27')]===_0xe8d0('0x28')){var _0x28a6b5={'id':_0x25f764['id'],'name':_0x25f764[_0xe8d0('0x29')],'strategy':_0x25f764['strategy'],'answered':_0x25f764[_0xe8d0('0x2a')],'available':_0x25f764[_0xe8d0('0x2b')],'loggedIn':_0x25f764['loggedIn'],'pTalking':_0x25f764[_0xe8d0('0x2c')],'sumBillable':_0x25f764[_0xe8d0('0x2d')],'sumDuration':_0x25f764[_0xe8d0('0x2e')],'sumHoldTime':_0x25f764[_0xe8d0('0x2f')]||0x0,'talking':_0x25f764[_0xe8d0('0x30')],'total':_0x25f764[_0xe8d0('0x31')],'type':_0x25f764[_0xe8d0('0x27')],'unmanaged':_0x25f764[_0xe8d0('0x32')],'abandoned':_0x25f764[_0xe8d0('0x33')],'waiting':_0x25f764[_0xe8d0('0x34')],'loggedInDb':_0x25f764[_0xe8d0('0x35')],'dialActive':_0x25f764['dialActive'],'dialMethod':_0x25f764[_0xe8d0('0x36')],'dialOriginateCallerIdName':_0x25f764[_0xe8d0('0x37')],'dialOriginateCallerIdNumber':_0x25f764[_0xe8d0('0x38')],'dialOriginateTimeout':_0x25f764['dialOriginateTimeout'],'dialPrefix':_0x25f764[_0xe8d0('0x39')],'outboundAnswerAgiCallsDay':_0x25f764[_0xe8d0('0x3a')],'outboundAnswerCallsDay':_0x25f764['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x25f764[_0xe8d0('0x3b')],'outboundBusyCallsDay':_0x25f764[_0xe8d0('0x3c')],'outboundCongestionCallsDay':_0x25f764[_0xe8d0('0x3d')],'outboundDropCallsDayACS':_0x25f764[_0xe8d0('0x3e')],'outboundDropCallsDayCallersExit':_0x25f764[_0xe8d0('0x3f')],'outboundDropCallsDayTimeout':_0x25f764['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x25f764[_0xe8d0('0x40')],'outboundNoSuchCallsDay':_0x25f764['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x25f764['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x25f764['outboundReCallsDay'],'outboundRejectCallsDay':_0x25f764[_0xe8d0('0x41')],'outboundUnknownCallsDay':_0x25f764[_0xe8d0('0x42')],'outboundAbandonedCallsDay':_0x25f764[_0xe8d0('0x43')],'predictiveIntervalAnsweredCalls':_0x25f764['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x25f764['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x25f764[_0xe8d0('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x25f764['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x25f764[_0xe8d0('0x45')],'predictiveIntervalErlangCalls':_0x25f764[_0xe8d0('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x25f764[_0xe8d0('0x47')],'predictiveIntervalHitRate':_0x25f764[_0xe8d0('0x48')],'predictiveIntervalMultiplicativeFactor':_0x25f764[_0xe8d0('0x49')],'predictiveIntervalPauses':_0x25f764['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x25f764[_0xe8d0('0x4a')],'predictiveIntervalTotalCalls':_0x25f764[_0xe8d0('0x4b')],'message':_0x25f764[_0xe8d0('0x4c')],'originated':_0x25f764[_0xe8d0('0x4d')],'erlangCalls':_0x25f764['erlangCalls'],'erlangCallToSecond':_0x25f764[_0xe8d0('0x4e')],'erlangAbandonmentRate':_0x25f764[_0xe8d0('0x4f')],'erlangBusyFactor':_0x25f764['erlangBusyFactor'],'startPredictive':_0x25f764[_0xe8d0('0x50')],'startProgressive':_0x25f764['startProgressive']};if(_0x25f764[_0xe8d0('0x51')]){_0x28a6b5['Trunk']={'id':_0x25f764[_0xe8d0('0x51')]['id'],'name':_0x25f764['Trunk'][_0xe8d0('0x29')],'active':_0x25f764[_0xe8d0('0x51')][_0xe8d0('0x52')],'callerid':_0x25f764[_0xe8d0('0x51')]['callerid']};}if(_0x25f764[_0xe8d0('0x53')]){_0x28a6b5[_0xe8d0('0x53')]={'id':_0x25f764[_0xe8d0('0x53')]['id'],'name':_0x25f764['Interval'][_0xe8d0('0x29')]};}var _0xa02b8d=md5(JSON[_0xe8d0('0x54')](_0x28a6b5));if(_0x25f764[_0xe8d0('0x5')]!==_0xa02b8d){_0x25f764[_0xe8d0('0x5')]=_0xa02b8d;emit(util['format'](_0xe8d0('0x55'),_0x28a6b5[_0xe8d0('0x29')]),_0xe8d0('0x56'),_0x28a6b5);}}}function emitVoiceQueueChannelRemove(_0x3d76d5){logger[_0xe8d0('0x57')](_0xe8d0('0x58'),JSON[_0xe8d0('0x54')](_0x3d76d5));emit(util[_0xe8d0('0x59')]('voice:queue:%s',_0x3d76d5['name']),_0xe8d0('0x5a'),_0x3d76d5);io[_0xe8d0('0x26')](_0xe8d0('0x5b'),_0x3d76d5);}function notSendMessagesQueue(_0x377dc1){if(_0x377dc1[_0xe8d0('0x5c')]){if(_0x377dc1['originated']===0x0&&_0x377dc1[_0xe8d0('0x2c')]===0x0){_0x377dc1['sendMessageOneNotActive']=![];_0x377dc1[_0xe8d0('0x2b')]=0x0;_0x377dc1[_0xe8d0('0x5d')]=0x0;_0x377dc1[_0xe8d0('0x4c')]='NOT_ACTIVE';ut[_0xe8d0('0x5e')](_0xe8d0('0x5f'),_0x377dc1[_0xe8d0('0x29')]+_0xe8d0('0x60'));}else{_0x377dc1[_0xe8d0('0x4c')]='DEACTIVATED';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x377dc1['name']+_0xe8d0('0x61'));}emitCampaignPreview(_0x377dc1);}}Preview['prototype'][_0xe8d0('0x62')]=function(){var _0x1b0ef3=this;setInterval(function(){_0x1b0ef3[_0xe8d0('0x63')]();},0x7cf);};Preview[_0xe8d0('0x10')][_0xe8d0('0x63')]=function(){var _0x1156da=this[_0xe8d0('0x15')];this[_0xe8d0('0x64')]+=0x1;for(var _0x563c16 in _0x1156da){if(_0x1156da[_0xe8d0('0x65')](_0x563c16)&&(_0x1156da[_0x563c16][_0xe8d0('0x36')]==='preview'||_0x1156da[_0x563c16]['dialMethod']===_0xe8d0('0x66'))&&_0x1156da[_0x563c16][_0xe8d0('0x27')]===_0xe8d0('0x28')){if(this['clockClearZombieChannels']>0x7){this[_0xe8d0('0x64')]=0x0;this[_0xe8d0('0x67')]();}}if(_0x1156da['hasOwnProperty'](_0x563c16)&&_0x1156da[_0x563c16][_0xe8d0('0x36')]===_0xe8d0('0x68')&&_0x1156da[_0x563c16]['type']===_0xe8d0('0x28')){if(_0x1156da[_0x563c16][_0xe8d0('0x69')]){this[_0xe8d0('0x6a')](_0x1156da[_0x563c16]);if(_0x1156da[_0x563c16][_0xe8d0('0x6b')])this[_0xe8d0('0x6c')](_0x1156da[_0x563c16]);}else{notSendMessagesQueue(_0x1156da[_0x563c16]);}}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6d')]=function(_0x1ce97d){var _0x510f62=this;this[_0xe8d0('0x14')][_0xe8d0('0x11')](function(){if(!_[_0xe8d0('0x6e')](_0x510f62[_0xe8d0('0x6f')][_0x1ce97d])){loggerAction[_0xe8d0('0x57')](_0xe8d0('0x70'),_0x1ce97d,_0xe8d0('0x71'),_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')],_0xe8d0('0x73'),JSON[_0xe8d0('0x54')](_0x510f62[_0xe8d0('0x15')][_0x510f62['actions'][_0x1ce97d][_0xe8d0('0x72')]][_0xe8d0('0x4d')]),_0xe8d0('0x74'),JSON[_0xe8d0('0x54')](_0x510f62[_0xe8d0('0x15')][_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')]]['pTalking']),JSON[_0xe8d0('0x54')](_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x75')]),JSON[_0xe8d0('0x54')](_['pick'](_0x510f62[_0xe8d0('0x6f')][_0x1ce97d],['contactId',_0xe8d0('0x76'),_0xe8d0('0x77'),_0xe8d0('0x78')])));return ami[_0xe8d0('0x79')]({'action':_0xe8d0('0x7a'),'channel':_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x7b')]})['catch'](function(_0x137bc3){if(_0x137bc3['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x510f62[_0xe8d0('0x6f')][_0x1ce97d]){ut['updateOriginated'](_0x510f62[_0xe8d0('0x15')][_0x510f62['actions'][_0x1ce97d][_0xe8d0('0x72')]],_0xe8d0('0x7c'));if(_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x75')]===!![]){ut['decrementTalkink'](_0x510f62[_0xe8d0('0x15')][_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')]],_0xe8d0('0x7c'));ut[_0xe8d0('0x7d')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1ce97d,_0x510f62[_0xe8d0('0x6f')][_0x1ce97d][_0xe8d0('0x72')]);}ut[_0xe8d0('0x7d')]('[Dialer][checkChannel][Preview]'+_0x1ce97d,_0x510f62[_0xe8d0('0x6f')][_0x1ce97d]['queue']);delete _0x510f62['actions'][_0x1ce97d];}},0x2328);}});}});};Preview[_0xe8d0('0x10')][_0xe8d0('0x67')]=function(){var _0x4e7b49=this;loggerAction[_0xe8d0('0x57')](_0xe8d0('0x7e'),_['size'](this[_0xe8d0('0x6f')]));for(var _0xe67928 in this[_0xe8d0('0x6f')]){if(_0x4e7b49[_0xe8d0('0x6f')]['hasOwnProperty'](_0xe67928)){_0x4e7b49[_0xe8d0('0x6d')](_0xe67928);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6c')]=function(_0x76316a){var _0x51930e=this;rpcDb[_0xe8d0('0x7f')](_0x76316a['id'],ut[_0xe8d0('0x80')](this[_0xe8d0('0x17')]))[_0xe8d0('0x81')](function(_0x1a74d0){if(!_[_0xe8d0('0x6e')](_0x1a74d0)){for(var _0x595b24=0x0;_0x595b24<_0x1a74d0['length'];_0x595b24+=0x1){if(ut[_0xe8d0('0x82')](_0x1a74d0[_0x595b24]['scheduledat'])<_0x76316a[_0xe8d0('0x83')]*0x3c){if(_0x1a74d0[_0x595b24][_0xe8d0('0x84')]&&!_0x1a74d0[_0x595b24]['Agent']['voicePause']){_0x51930e[_0xe8d0('0x85')](_0x1a74d0[_0x595b24]['id'])['then'](ut[_0xe8d0('0x86')]('[RecallMe]'))[_0xe8d0('0x87')](ut[_0xe8d0('0x86')](_0xe8d0('0x88')));}else{rpcDb['disableContact'](_0x1a74d0[_0x595b24]['id']);}}else{var _0x3091fb=new Action(_0x1a74d0[_0x595b24],_0x76316a);_0x3091fb[_0xe8d0('0x89')]=moment()['format'](_0xe8d0('0x8a'));_0x76316a['outboundReCallsDay']+=0x1;ut[_0xe8d0('0x8b')](_0x3091fb,0x17,'RecallInQueue');if(_0x76316a[_0xe8d0('0x8c')]){rpcDb[_0xe8d0('0x8d')](ut[_0xe8d0('0x8e')](_0x1a74d0[_0x595b24]));rpcDb[_0xe8d0('0x8f')](_0x3091fb,_0xe8d0('0x90'));}else{ut['logCustomer'](_0x3091fb,0x16,'RecallFailedTimeout');rpcDb[_0xe8d0('0x8f')](_0x3091fb,'[HistoryRecallClose]');rpcDb[_0xe8d0('0x91')](_0x3091fb,_0xe8d0('0x92'));}}}}})[_0xe8d0('0x87')](ut[_0xe8d0('0x86')](_0xe8d0('0x93')));};Preview[_0xe8d0('0x10')][_0xe8d0('0x6a')]=function(_0x20647d){_0x20647d[_0xe8d0('0x5c')]=!![];if(ut[_0xe8d0('0x94')](_0x20647d[_0xe8d0('0x95')])){_0x20647d[_0xe8d0('0x4c')]=_0xe8d0('0x96');}else if(!ut[_0xe8d0('0x97')](_0x20647d[_0xe8d0('0x69')])){_0x20647d['message']=_0xe8d0('0x98');}else if(!this[_0xe8d0('0x99')](_0x20647d[_0xe8d0('0x51')])){if(!this[_0xe8d0('0x99')](_0x20647d[_0xe8d0('0x9a')])){_0x20647d['message']=_0xe8d0('0x9b');}else{_0x20647d[_0xe8d0('0x4c')]=_0xe8d0('0x9c');}}else{_0x20647d[_0xe8d0('0x4c')]=_0xe8d0('0x9c');}emitCampaignPreview(_0x20647d);};Preview[_0xe8d0('0x10')][_0xe8d0('0x9d')]=function(_0x13ceb4,_0x40cb5c,_0x24be86){var _0x23955c=this;var _0xdb3e53=this['actions'][_0x40cb5c];var _0x4c4019=this[_0xe8d0('0x15')][_0xdb3e53['queue']];var _0x169047;var _0x209263=![];var _0x56761c=0x2;var _0x16a989=0x3;if(_0x4c4019){switch(_0x24be86){case'1':_0x4c4019[_0xe8d0('0x9e')]+=0x1;_0xdb3e53[_0xe8d0('0x9f')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x0,_0xe8d0('0xa2'));ami[_0xe8d0('0x26')](_0xe8d0('0xa3'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xa5')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xa6'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'0',_0x4c4019)[_0xe8d0('0x81')](function(_0x391510){_0x209263=_0x391510[_0xe8d0('0xa8')]==0x1;_0x56761c=_0x4c4019[_0xe8d0('0xa9')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];if(!_0x209263){if(ut['totalGlobal'](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb['createCustomerFinal'](_0x169047,_0xe8d0('0xae'));}else{if(_0xdb3e53['countnosuchnumberretry']>=_0x4c4019[_0xe8d0('0xaf')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xae'));}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xb0')](_0xdb3e53,_0xe8d0('0x9f'),_0x4c4019[_0xe8d0('0xa9')]),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}delete this['actions'][_0x13ceb4[_0xe8d0('0xb3')]];}else{_0xdb3e53[_0xe8d0('0x9f')]++;logger[_0xe8d0('0x57')](_0xe8d0('0xb4'),_0xdb3e53[_0xe8d0('0x9f')]);logger[_0xe8d0('0x57')]('id',_0xdb3e53[_0xe8d0('0xb5')]);_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53['idContact'],'field':{'countnosuchnumberretry':_0xdb3e53[_0xe8d0('0x9f')]}})[_0xe8d0('0x81')](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case'ANSWER':var _0x428b00=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));_0xdb3e53['responsetime']=_0x428b00;_0xdb3e53[_0xe8d0('0xb8')]=_0x428b00;_0xdb3e53['dialAnswer']=!![];_0x4c4019[_0xe8d0('0x2c')]+=0x1;logger['info'](_0xe8d0('0xb9'),_0xdb3e53[_0xe8d0('0xba')],_0xe8d0('0xbb'),_0x4c4019[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x4c4019[_0xe8d0('0x2c')]);ami[_0xe8d0('0x26')](_0xe8d0('0xbc'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xbd'),this[_0xe8d0('0x15')][_0xdb3e53[_0xe8d0('0x72')]]));if(_0x4c4019['acw']){ami[_0xe8d0('0x26')](_0xe8d0('0xbe'),ut[_0xe8d0('0xbf')](_0xdb3e53));}break;case'16':ami[_0xe8d0('0x26')](_0xe8d0('0xc0'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xc1'),this[_0xe8d0('0x15')][_0xdb3e53[_0xe8d0('0x72')]]));emitVoiceQueueChannelRemove(ut[_0xe8d0('0xa4')](_0xdb3e53,'complete'));_0x4c4019[_0xe8d0('0xc2')]+=0x1;_0x4c4019[_0xe8d0('0x31')]+=0x1;_0x4c4019[_0xe8d0('0x2a')]+=0x1;ut[_0xe8d0('0xc3')](_0x4c4019,_0xe8d0('0xc4'));_0xdb3e53['countglobal']=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x4,'Answer');rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xc5'));rpcDb[_0xe8d0('0x91')](_0xdb3e53,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xe8d0('0xc6')](_0xdb3e53);_0x4c4019['sumDuration']+=_0xdb3e53[_0xe8d0('0xc7')];_0x4c4019[_0xe8d0('0x2d')]+=_0xdb3e53[_0xe8d0('0xc7')];logger[_0xe8d0('0x57')](_0xe8d0('0xc8'),_0xdb3e53['uniqueid'],'\x20Queue',_0x4c4019[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x4c4019[_0xe8d0('0x2c')]);delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];break;case _0xe8d0('0xc9'):_0x4c4019[_0xe8d0('0x3c')]+=0x1;_0xdb3e53[_0xe8d0('0xca')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x5,_0xe8d0('0xcb'));_0x56761c=_0x4c4019[_0xe8d0('0xcc')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami['emit']('custom:agentbusy',ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xcd')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xce'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'5',_0x4c4019)[_0xe8d0('0x81')](function(_0x1a4129){_0x209263=_0x1a4129[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut['cloneAction'](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xcf'));}else{if(_0xdb3e53[_0xe8d0('0xca')]>=_0x4c4019[_0xe8d0('0xd0')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xce'));}else{rpcDb[_0xe8d0('0xd1')](ut[_0xe8d0('0xb0')](_0xdb3e53,'countbusyretry',_0x4c4019['dialBusyRetryFrequency']),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53['countbusyretry']++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countbusyretry':_0xdb3e53[_0xe8d0('0xca')]}})['then'](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case _0xe8d0('0xd2'):_0x4c4019[_0xe8d0('0x40')]+=0x1;_0xdb3e53['countnoanswerretry']+=0x1;_0xdb3e53['countglobal']=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x3,'NoAnswer');_0x56761c=_0x4c4019['dialNoAnswerRetryFrequency'];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami[_0xe8d0('0x26')](_0xe8d0('0xd3'),ut['buildObj'](_0xdb3e53,_0xe8d0('0xd4')));rpcDb['createCustomerHistory'](_0xdb3e53,'[callProgressDetectingCustomer][logNoAnswer]');_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'3',_0x4c4019)[_0xe8d0('0x81')](function(_0x1dad96){_0x209263=_0x1dad96[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019['dialGlobalMaxRetry']){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb['createCustomerFinal'](_0x169047,_0xe8d0('0xd5'));}else{if(_0xdb3e53[_0xe8d0('0xd6')]>=_0x4c4019[_0xe8d0('0xd7')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe8d0('0xd1')](ut[_0xe8d0('0xb0')](_0xdb3e53,_0xe8d0('0xd6'),_0x4c4019[_0xe8d0('0xd8')]),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53['idContact'],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})[_0xe8d0('0x81')](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)['then'](function(){});});}});break;case'CONGESTION':_0x4c4019['outboundCongestionCallsDay']+=0x1;_0xdb3e53[_0xe8d0('0xd9')]+=0x1;_0xdb3e53['countglobal']=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x8,'Congestion');_0x56761c=_0x4c4019[_0xe8d0('0xda')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami[_0xe8d0('0x26')](_0xe8d0('0xdb'),ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xdc')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xdd'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'8',_0x4c4019)[_0xe8d0('0x81')](function(_0x21e53d){_0x209263=_0x21e53d[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,'Global');rpcDb[_0xe8d0('0x91')](_0x169047,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xdb3e53[_0xe8d0('0xd9')]>=_0x4c4019[_0xe8d0('0xde')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xdd'));}else{rpcDb[_0xe8d0('0xd1')](ut[_0xe8d0('0xb0')](_0xdb3e53,_0xe8d0('0xd9'),_0x4c4019[_0xe8d0('0xcc')]),_0xdb3e53['unlockAgent'],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53[_0xe8d0('0xd9')]++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countcongestionretry':_0xdb3e53[_0xe8d0('0xd9')]}})['then'](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case _0xe8d0('0xdf'):_0x4c4019[_0xe8d0('0x41')]+=0x1;_0xdb3e53[_0xe8d0('0xe0')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x14,_0xe8d0('0xe1'));_0x56761c=_0x4c4019[_0xe8d0('0xe2')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];ami[_0xe8d0('0x26')](_0xe8d0('0xe3'),ut[_0xe8d0('0xa4')](_0xdb3e53,'agentreject'));rpcDb['createCustomerHistory'](_0xdb3e53,_0xe8d0('0xe4'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'20',_0x4c4019)[_0xe8d0('0x81')](function(_0x459264){_0x209263=_0x459264[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut['totalGlobal'](_0xdb3e53)>=_0x4c4019['dialGlobalMaxRetry']){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0x14,'AgentReject');rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xe5'));}else{if(_0xdb3e53[_0xe8d0('0xe0')]>=_0x4c4019[_0xe8d0('0xe6')]){rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xe5'));}else{rpcDb[_0xe8d0('0xd1')](ut['scheduledAt'](_0xdb3e53,_0xe8d0('0xe0'),_0x4c4019[_0xe8d0('0xe2')]),_0xdb3e53[_0xe8d0('0xb1')],_0xdb3e53[_0xe8d0('0xb2')]);}}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c['incrementPreviewCounters']({'id':_0xdb3e53['idContact'],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})['then'](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)['then'](function(){});});}});break;case _0xe8d0('0xe7'):_0x4c4019[_0xe8d0('0x43')]+=0x1;_0xdb3e53[_0xe8d0('0xe8')]+=0x1;_0xdb3e53['countglobal']=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0xb,'Abandoned');rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xe9'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'11',_0x4c4019)['then'](function(_0x5829b9){_0x209263=_0x5829b9[_0xe8d0('0xa8')]==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut['cloneAction'](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb['createCustomerFinal'](_0x169047,_0xe8d0('0xe9'));}else{if(_0xdb3e53['countabandonedetry']>=_0x4c4019['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0xdb3e53,_0xe8d0('0xe9'));}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xb0')](_0xdb3e53,'countabandonedretry',_0x4c4019[_0xe8d0('0xea')]),_0xdb3e53['unlockAgent'],_0xdb3e53['activeContact']);}}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c['incrementPreviewCounters']({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})[_0xe8d0('0x81')](function(){_0x23955c[_0xe8d0('0xb7')](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});break;case'18':_0x4c4019[_0xe8d0('0x42')]+=0x1;_0xdb3e53[_0xe8d0('0xeb')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut['totalGlobal'](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0x12,_0x13ceb4[_0xe8d0('0xec')]||_0x13ceb4[_0xe8d0('0xed')]);ami[_0xe8d0('0x26')]('custom:amd',ut[_0xe8d0('0xa4')](_0xdb3e53,_0xe8d0('0xee')));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xef'));_0x23955c[_0xe8d0('0xa7')](_0xdb3e53,'18',_0x4c4019)[_0xe8d0('0x81')](function(_0x3df7cb){_0x209263=_0x3df7cb['additional']==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0x12,_0xe8d0('0xad'));rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xef'));}else{rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xef'));}}else{_0xdb3e53['countnoanswerretry']++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countnoanswerretry':_0xdb3e53['countnoanswerretry']}})['then'](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];break;case'19':_0x4c4019[_0xe8d0('0x42')]+=0x1;_0xdb3e53['countglobal']=ut[_0xe8d0('0xa1')](_0xdb3e53);ut['logCustomer'](_0xdb3e53,0x13,_0x13ceb4['cause-txt']||_0x13ceb4[_0xe8d0('0xed')]);ami['emit']('custom:amd',ut[_0xe8d0('0xa4')](_0xdb3e53,'amd'));rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xf0'));_0x23955c['verifyAdditionalPhones'](_0xdb3e53,'18',_0x4c4019)[_0xe8d0('0x81')](function(_0xc6fd9a){_0x209263=_0xc6fd9a['additional']==0x1;if(!_0x209263){if(ut[_0xe8d0('0xa1')](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut[_0xe8d0('0xac')](_0xdb3e53,0xf,_0xe8d0('0xad'));rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xf0'));}else{rpcDb[_0xe8d0('0x91')](_0xdb3e53,_0xe8d0('0xf0'));}}else{_0xdb3e53[_0xe8d0('0xd6')]++;_0x23955c[_0xe8d0('0xb6')]({'id':_0xdb3e53[_0xe8d0('0xb5')],'field':{'countnoanswerretry':_0xdb3e53[_0xe8d0('0xd6')]}})[_0xe8d0('0x81')](function(){_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(){});});}});delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];break;default:if(_0xdb3e53[_0xe8d0('0x75')]){ut[_0xe8d0('0xc3')](_0x4c4019,_0xe8d0('0xf1'));ut[_0xe8d0('0x7d')](_0xe8d0('0xf2')+_0x4c4019[_0xe8d0('0x29')],_0x13ceb4);}_0x4c4019[_0xe8d0('0x42')]+=0x1;_0xdb3e53[_0xe8d0('0xa0')]=ut[_0xe8d0('0xa1')](_0xdb3e53);ut[_0xe8d0('0x8b')](_0xdb3e53,0xc,_0x13ceb4[_0xe8d0('0xec')]||_0x13ceb4[_0xe8d0('0xed')]);_0x56761c=_0x4c4019[_0xe8d0('0xe2')];_0x16a989=_0x4c4019[_0xe8d0('0xaa')];rpcDb[_0xe8d0('0x8f')](_0xdb3e53,_0xe8d0('0xf3'));_0x23955c['verifyAdditionalPhones'](_0xdb3e53,'20',_0x4c4019)[_0xe8d0('0x81')](function(_0x3cdce4){_0x209263=_0x3cdce4['additional']==0x1;if(!_0x209263){if(ut['totalGlobal'](_0xdb3e53)>=_0x4c4019[_0xe8d0('0xab')]){_0x169047=ut['cloneAction'](_0xdb3e53,0xf,'Global');rpcDb[_0xe8d0('0x91')](_0x169047,_0xe8d0('0xf4'));}else{rpcDb['createCustomerFinal'](_0xdb3e53,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe8d0('0x6f')][_0x13ceb4[_0xe8d0('0xb3')]];}else{_0x23955c['swapAdditionalPhones'](_0xdb3e53,_0x56761c,_0x16a989)[_0xe8d0('0x81')](function(_0x12f775){});}});}if(!(_0xdb3e53['dialAnswer']&&_0x24be86==='16')){ut['updateOriginated'](_0x4c4019,_0xe8d0('0xf5'));logger[_0xe8d0('0x57')](_0xe8d0('0xf6'),_0xdb3e53[_0xe8d0('0xba')],_0xe8d0('0xbb'),_0x4c4019['name'],_0xe8d0('0x73'),_0x4c4019[_0xe8d0('0x4d')]);}if(_0x24be86!=='ANSWER'){delete this['actions'][_0x13ceb4[_0xe8d0('0xb3')]];delete this[_0xe8d0('0x6f')][_0x13ceb4['destlinkedid']];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0xf7')]=function(_0x54878e,_0x48bb3a,_0x20bfdb){if(_['isUndefined'](_0x48bb3a)&&_0xe8d0('0xf8')!==typeof _0x48bb3a){return;}if(_[_0xe8d0('0xf9')](_0x20bfdb)&&_0xe8d0('0xf8')!==typeof _0x20bfdb){return;}switch(_0x20bfdb[_0xe8d0('0xfa')]){case'0':ut['logAgent'](_0x54878e,0x0,_0xe8d0('0xa2'));rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0xfc'));break;case'3':ut['logAgent'](_0x54878e,0x3,'NoAnswer');rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0xfd'));break;case'5':ut[_0xe8d0('0xfe')](_0x54878e,0x5,_0xe8d0('0xcb'));rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0xff'));break;case'8':ut['logAgent'](_0x54878e,0x8,_0xe8d0('0x100'));rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0x101'));break;case'22':ut[_0xe8d0('0xfe')](_0x54878e,0x16,'AnswerAGI');rpcDb[_0xe8d0('0xfb')](_0x54878e,_0xe8d0('0x102'));break;default:ut['logAgent'](_0x54878e,0xc,_0x20bfdb[_0xe8d0('0xfa')]);rpcDb['createAgentHistory'](_0x54878e,_0xe8d0('0x101'));}ut[_0xe8d0('0x103')](_0x48bb3a,_0xe8d0('0x104'));logger['info'](_0xe8d0('0x105'),_0x54878e[_0xe8d0('0xba')],_0xe8d0('0xbb'),_0x48bb3a[_0xe8d0('0x29')],'originated:\x20',_0x48bb3a[_0xe8d0('0x4d')]);delete this[_0xe8d0('0x6f')][_0x54878e[_0xe8d0('0xba')]];};Preview['prototype'][_0xe8d0('0xa7')]=function(_0x47b4bb,_0xa57cb9,_0x48cae3){return BPromise[_0xe8d0('0x106')]()['then'](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x47b4bb,_0xa57cb9,_0x48cae3))['catch'](logger[_0xe8d0('0x57')](_0xe8d0('0x107')));};Preview[_0xe8d0('0x10')][_0xe8d0('0xb7')]=function(_0x6ee9e3,_0x5314e7,_0xc73a2){return BPromise[_0xe8d0('0x106')]()[_0xe8d0('0x81')](cmHopperAdditionalPhone[_0xe8d0('0xb7')](_0x6ee9e3,_0x5314e7,_0xc73a2))[_0xe8d0('0x87')](logger[_0xe8d0('0x57')](_0xe8d0('0x108')));};Preview[_0xe8d0('0x10')][_0xe8d0('0xb6')]=function(_0x598287){return BPromise[_0xe8d0('0x106')]()['then'](cmHopperAdditionalPhone[_0xe8d0('0xb6')](_0x598287))['catch'](logger[_0xe8d0('0x57')](_0xe8d0('0x109')));};Preview[_0xe8d0('0x10')][_0xe8d0('0x10a')]=function(_0x38ab00,_0x4b92e6,_0x145714,_0x13b61b,_0xb05e5){var _0x48ac43=this;return new BPromise(function(_0x21d2f7,_0x152043){if(_[_0xe8d0('0x6e')](_0x4b92e6)||_[_0xe8d0('0x6e')](_0x4b92e6[_0xe8d0('0x10b')])||_['isNil'](_0x4b92e6['phone'])||_[_0xe8d0('0x6e')](_0x4b92e6['VoiceQueueId'])){_0x152043(ut[_0xe8d0('0x4c')](_0xe8d0('0x10c'),_0x13b61b,_0xb05e5));return;}var _0x32a704=uuid['v4']();var _0x25009f=_0x48ac43['campaignsPreview'][_0x4b92e6[_0xe8d0('0x71')][_0xe8d0('0x29')]];var _0xf18d16=_0x145714?_0x48ac43['agents'][_0x145714]['id']:undefined;_0x48ac43[_0xe8d0('0x6f')][_0x32a704]=new Action(_0x4b92e6,_0x25009f,_0x32a704,_0x145714,_0xf18d16);var _0x5420f5=_0x48ac43[_0xe8d0('0x6f')][_0x32a704];_0x5420f5[_0xe8d0('0xb1')]=_0x13b61b;_0x5420f5[_0xe8d0('0xb2')]=_0xb05e5;_0x5420f5[_0xe8d0('0x10d')]=_0x145714;if(_[_0xe8d0('0x10e')](_0x38ab00)){_0x48ac43[_0xe8d0('0x10f')](_0x5420f5,_0x25009f,_0x4b92e6,_0x145714)[_0xe8d0('0x81')](function(_0x182d06){logger[_0xe8d0('0x57')](_0xe8d0('0x110'),'Queue:\x20'+_0x5420f5[_0xe8d0('0x72')]+_0xe8d0('0x111')+_0x5420f5[_0xe8d0('0xb5')],JSON['stringify'](_0x182d06));ami['emit'](_0xe8d0('0x112'),ut[_0xe8d0('0xa4')](_0x5420f5,'called',_0x48ac43[_0xe8d0('0x15')][_0x5420f5['queue']]));_0x21d2f7(ut[_0xe8d0('0x4c')](_0xe8d0('0x113')));})[_0xe8d0('0x87')](function(_0x2489d3){ut[_0xe8d0('0x5e')]('[Preview][execCall][failure]',_0x2489d3);_0x152043(ut['message'](_0xe8d0('0x114'),_0x13b61b,_0xb05e5));});}else{_0x25009f[_0xe8d0('0x3b')]+=0x1;ut[_0xe8d0('0x115')](_0x5420f5);rpcDb[_0xe8d0('0x116')](_0x5420f5,_0xe8d0('0x117'));delete _0x48ac43['actions'][_0x32a704];_0x152043(ut[_0xe8d0('0x4c')](_0xe8d0('0x118'),_0x13b61b,_0xb05e5));}});};Preview[_0xe8d0('0x10')]['isTrunkReachable']=function(_0x31bfe){return!_['isNil'](_0x31bfe)&&!_[_0xe8d0('0x6e')](_0x31bfe['name'])&&!_[_0xe8d0('0x6e')](_0x31bfe['active'])&&_0x31bfe[_0xe8d0('0x52')]&&!_[_0xe8d0('0x6e')](this[_0xe8d0('0x16')][util['format']('SIP/%s',_0x31bfe[_0xe8d0('0x29')])])&&!_[_0xe8d0('0x6e')](this[_0xe8d0('0x16')][util[_0xe8d0('0x59')](_0xe8d0('0x119'),_0x31bfe[_0xe8d0('0x29')])][_0xe8d0('0x7a')])&&(this['trunks'][util['format'](_0xe8d0('0x119'),_0x31bfe[_0xe8d0('0x29')])]['status']===_0xe8d0('0x11a')||this['trunks'][util[_0xe8d0('0x59')]('SIP/%s',_0x31bfe['name'])][_0xe8d0('0x7a')]===_0xe8d0('0x11b'));};Preview['prototype']['run']=function(_0x38ab65,_0x5e47ae){var _0x2b8448=this;return new BPromise(function(_0x51a290,_0x348e6d){_0x2b8448[_0xe8d0('0x11c')](_0x38ab65,_0x5e47ae)[_0xe8d0('0x81')](function(_0x5a87ee){_0x51a290(_[_0xe8d0('0x11d')](_0x5a87ee,[_0xe8d0('0x4c')]));})['catch'](function(_0x2edc14){if(_0x2edc14[_0xe8d0('0x11e')]){rpcDb[_0xe8d0('0x11f')](_0x38ab65);}if(_0x2edc14[_0xe8d0('0x52')]){rpcDb[_0xe8d0('0x120')](_0x38ab65);}_0x348e6d(_[_0xe8d0('0x11d')](_0x2edc14,[_0xe8d0('0x4c')]));});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x11c')]=function(_0x5b4e24,_0x22cced){var _0x28691c=this;return new BPromise(function(_0x19385d,_0x512dd4){var _0x55dbfb,_0x26b24b;rpcDb['getContactPreview'](_0x5b4e24)[_0xe8d0('0x81')](function(_0x19f8c3){if(!_[_0xe8d0('0x6e')](_0x19f8c3[0x0])){_0x26b24b=_0x19f8c3[0x0]['recallme']?![]:!![];_0x55dbfb=_0x19f8c3[0x0]['recallme']?!![]:![];_0x55dbfb=_0x22cced?!![]:_0x55dbfb;}var _0x57a379=_0x28691c['validateContact'](_0x19f8c3);if(_0x57a379[_0xe8d0('0x121')]){rpcDb['checkIsBlackList'](_[_0xe8d0('0x11d')](_0x19f8c3[0x0],['VoiceQueueId',_0xe8d0('0x122')]))['then'](function(_0x347687){_0x28691c['checkInBlack'](_0x347687,_0x19f8c3[0x0],_0x22cced,_0x26b24b,_0x55dbfb)[_0xe8d0('0x81')](function(_0x168bd8){_0x19385d(_0x168bd8);})[_0xe8d0('0x87')](function(_0x284c03){_0x512dd4(_0x284c03);});})[_0xe8d0('0x87')](function(_0x587a0c){ut['logger'](_0xe8d0('0x123'),_0x587a0c);_0x512dd4(ut[_0xe8d0('0x4c')]('Call\x20unsuccessful',_0x26b24b,_0x55dbfb));});}else{_0x512dd4(ut['message'](_0x57a379['message'],_0x26b24b,_0x55dbfb));}})[_0xe8d0('0x87')](function(_0x41cffa){ut['logger'](_0xe8d0('0x124'),_0x41cffa);_0x512dd4(ut[_0xe8d0('0x4c')](_0xe8d0('0x125'),![],!![]));});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x126')]=function(_0x1d3953){if(_[_0xe8d0('0x6e')](_0x1d3953)||_[_0xe8d0('0x10e')](_0x1d3953)||!_[_0xe8d0('0x6e')](_0x1d3953[0x0]['Agent'])&&_[_0xe8d0('0x6e')](_0x1d3953[0x0]['Agent'][_0xe8d0('0x29')])){ut[_0xe8d0('0x5e')]('[Preview][validateContact][Empty\x20Contact]',_0x1d3953);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x56b23a=this[_0xe8d0('0x15')][_0x1d3953[0x0]['Queue'][_0xe8d0('0x29')]];_0x56b23a[_0xe8d0('0x4c')]='ACTIVE';if(_['isNil'](_0x56b23a)){ut[_0xe8d0('0x5e')]('[Preview][validateContact][Empty\x20Campaign]',_0x56b23a);return{'isValid':![],'message':_0xe8d0('0x127')};}if(!this[_0xe8d0('0x99')](_0x56b23a['Trunk'])){ut[_0xe8d0('0x5e')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xe8d0('0x128')+_0x56b23a[_0xe8d0('0x29')]+_0xe8d0('0x129'));if(!this['isTrunkReachable'](_0x56b23a[_0xe8d0('0x9a')])){ut[_0xe8d0('0x5e')](_0xe8d0('0x12a'),_0x56b23a['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe8d0('0x12b')};}}if(!ut['isActive'](_0x56b23a[_0xe8d0('0x69')])){ut[_0xe8d0('0x5e')](_0xe8d0('0x12c'),_0x56b23a[_0xe8d0('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe8d0('0x128')+_0x56b23a['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe8d0('0x10')][_0xe8d0('0x10f')]=function(_0x2b7530,_0x258265,_0x19f710,_0x5a90f3){var _0xf18e32=this;return new BPromise(function(_0x5b821d,_0x4af90e){var _0x12c494=_0x2b7530[_0xe8d0('0xba')];var _0x17ac52=_0xf18e32['isTrunkReachable'](_0x258265[_0xe8d0('0x51')])?util[_0xe8d0('0x59')](_0xe8d0('0x12d'),_0x258265[_0xe8d0('0x51')][_0xe8d0('0x29')],_['isNil'](_0x258265[_0xe8d0('0x39')])?'':_0x258265[_0xe8d0('0x39')][_0xe8d0('0x12e')]()||'',_0x258265[_0xe8d0('0x12f')]>0x0?_0x19f710[_0xe8d0('0x122')][_0xe8d0('0x130')](_0x258265[_0xe8d0('0x12f')]):_0x19f710[_0xe8d0('0x122')]):util[_0xe8d0('0x59')](_0xe8d0('0x12d'),_[_0xe8d0('0x6e')](_0x258265['TrunkBackup'])?_0x258265[_0xe8d0('0x51')]['name']:_0x258265['TrunkBackup'][_0xe8d0('0x29')],_[_0xe8d0('0x6e')](_0x258265[_0xe8d0('0x39')])?'':_0x258265['dialPrefix'][_0xe8d0('0x12e')]()||'',_0x258265[_0xe8d0('0x12f')]>0x0?_0x19f710[_0xe8d0('0x122')][_0xe8d0('0x130')](_0x258265[_0xe8d0('0x12f')]):_0x19f710[_0xe8d0('0x122')]);var _0x48fe46=_0xf18e32[_0xe8d0('0x99')](_0x258265[_0xe8d0('0x51')])?ut[_0xe8d0('0x131')](_0x258265[_0xe8d0('0x51')][_0xe8d0('0x132')],_0x258265[_0xe8d0('0x37')],_0x258265['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x258265[_0xe8d0('0x38')],_0x258265[_0xe8d0('0x133')]):_0x258265[_0xe8d0('0x38')]):ut[_0xe8d0('0x131')](_[_0xe8d0('0x6e')](_0x258265[_0xe8d0('0x9a')])?_0x258265['Trunk'][_0xe8d0('0x132')]:_0x258265[_0xe8d0('0x9a')][_0xe8d0('0x132')],_0x258265[_0xe8d0('0x37')],_0x258265[_0xe8d0('0x133')]>0x0?ut['getCallerIdRandom'](_0x258265[_0xe8d0('0x38')],_0x258265[_0xe8d0('0x133')]):_0x258265[_0xe8d0('0x38')]);if(_0x48fe46){_0x2b7530['originatecalleridname']=ut[_0xe8d0('0x134')](_0x48fe46);_0x2b7530[_0xe8d0('0x135')]=ut[_0xe8d0('0x136')](_0x48fe46);}var _0x19a76e=ut['addVariables'](_0x258265,_0x19f710,_0x17ac52,_0x48fe46,_0x12c494,_0x2b7530);_[_0xe8d0('0x137')](_0x2b7530,ut[_0xe8d0('0x138')](_0x19a76e));_0x2b7530[_0xe8d0('0x89')]=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));ami['Action'](ut[_0xe8d0('0x139')](_0x2b7530,_0x258265,_0x19a76e,_0x2b7530[_0xe8d0('0xb2')],_0x5a90f3))[_0xe8d0('0x81')](function(_0xf94727){_0x258265[_0xe8d0('0x4d')]+=0x1;logger[_0xe8d0('0x57')](_0xe8d0('0x13a'),_0x12c494,'\x20Queue',_0x258265[_0xe8d0('0x29')],'originated:\x20',_0x258265[_0xe8d0('0x4d')]);_0x5b821d(_0xf94727);})[_0xe8d0('0x87')](function(_0x2d1802){ut['logAgent'](_0x2b7530,0xe,_0xe8d0('0x13b'));rpcDb[_0xe8d0('0xfb')](_0x2b7530,'[originateFailure][logOriginateFailure]');_0x4af90e(_0x2d1802);});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x13c')]=function(_0x15b1bf){if(this[_0xe8d0('0x6f')][_0x15b1bf[_0xe8d0('0xb3')]]){this['actions'][_0x15b1bf[_0xe8d0('0xb3')]][_0xe8d0('0x7b')]=_0x15b1bf['channel'];}};Preview[_0xe8d0('0x10')]['syncOriginateResponse']=function(_0x4cace8){var _0x18a42b=this;var _0x1801fc=this[_0xe8d0('0x6f')][_0x4cace8['actionid']];if(_0x1801fc){if(_0x1801fc[_0xe8d0('0x10d')]&&this[_0xe8d0('0x17')][_0x1801fc['lookAgent']]){ut[_0xe8d0('0x13d')](_0x1801fc,this['agents'][_0x1801fc[_0xe8d0('0x10d')]][_0xe8d0('0x29')],this[_0xe8d0('0x17')][_0x1801fc['lookAgent']]['id']);}var _0x199369=_[_0xe8d0('0x13e')](_0x1801fc);_0x199369[_0xe8d0('0x13f')]=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));var _0x28d34f=_0x18a42b[_0xe8d0('0x15')][_0x1801fc[_0xe8d0('0x72')]];if(ut['isFailure'](_0x4cace8[_0xe8d0('0x140')])){if(_0x1801fc[_0xe8d0('0xb1')]){rpcDb[_0xe8d0('0x11f')](_0x1801fc[_0xe8d0('0xb5')]);}if(_0x1801fc[_0xe8d0('0xb2')]){rpcDb[_0xe8d0('0x120')](_0x1801fc['idContact']);}ami[_0xe8d0('0x26')](_0xe8d0('0x141'),ut[_0xe8d0('0xa4')](_0x1801fc,_0xe8d0('0x142'),this[_0xe8d0('0x15')][_0x1801fc[_0xe8d0('0x72')]]));this[_0xe8d0('0xf7')](_0x199369,_0x28d34f,_0x4cace8);}else{_0x1801fc[_0xe8d0('0x89')]=moment()[_0xe8d0('0x59')](_0xe8d0('0x8a'));ut[_0xe8d0('0xfe')](_0x199369,0x4,'Answer');rpcDb[_0xe8d0('0xfb')](_0x199369,_0xe8d0('0x143'));}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x1c')]=function(_0x287704){var _0x4dd0d2=this;var _0x564361=this[_0xe8d0('0x6f')][_0x287704[_0xe8d0('0xb3')]];var _0x231f49;if(_0x564361){_0x231f49=this['campaignsPreview'][_0x564361['queue']];logger[_0xe8d0('0x57')](_0xe8d0('0x144'),_0x287704[_0xe8d0('0xb3')],_0xe8d0('0xbb'),_0x231f49[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x231f49['pTalking']);}if(this['actions'][_0x287704['linkedid']]&&_0x287704[_0xe8d0('0xb3')]!==_0x287704['uniqueid']){if(_0x287704['cause']==='16'&&this['actions'][_0x287704[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){this[_0xe8d0('0x9d')](_0x287704,_0x287704[_0xe8d0('0xb3')],_0x287704[_0xe8d0('0x145')]);}else if(this['actions'][_0x287704[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){logger[_0xe8d0('0x57')](_0xe8d0('0x146'),_0x287704[_0xe8d0('0xb3')],_0x287704['cause'],_0xe8d0('0xbb'),_0x231f49[_0xe8d0('0x29')],'pTalking:\x20',_0x231f49[_0xe8d0('0x2c')]);this[_0xe8d0('0x9d')](_0x287704,_0x287704['linkedid'],_0x287704[_0xe8d0('0x145')]);}}else if(_0x564361&&_['isNil'](_0x564361[_0xe8d0('0x147')])&&_0x231f49['dialQueueProject']&&_0x287704['linkedid']===_0x287704[_0xe8d0('0xba')]&&_[_0xe8d0('0x6e')](_0x287704[_0xe8d0('0xfa')])&&_0x287704[_0xe8d0('0x145')]==='16'&&_0x287704[_0xe8d0('0x148')]==='6'&&_[_0xe8d0('0xf9')](_0x564361['transfer'])){if(_0x564361[_0xe8d0('0xb1')]){rpcDb[_0xe8d0('0x11f')](_0x564361['idContact']);}if(_0x564361[_0xe8d0('0xb2')]){rpcDb[_0xe8d0('0x120')](_0x564361[_0xe8d0('0xb5')]);}_0x287704['reason']='22';this['callProgressDetectingAgent'](_0x564361,_0x231f49,_0x287704);}else if(_0x564361&&_0x564361['transfer']){if(_0x287704[_0xe8d0('0x145')]==='16'&&this['actions'][_0x287704['linkedid']]['dialAnswer']){logger[_0xe8d0('0x57')]('[syncHangup][talking][transfer]',_0x287704[_0xe8d0('0xb3')],_0x287704[_0xe8d0('0x145')],_0xe8d0('0xbb'),_0x231f49[_0xe8d0('0x29')],_0xe8d0('0x74'),_0x231f49['pTalking']);this['callProgressDetectingCustomer'](_0x287704,_0x287704['linkedid'],_0x287704['cause']);}else if(this['actions'][_0x287704[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){logger['info'](_0xe8d0('0x146'),_0x287704[_0xe8d0('0xb3')],_0x287704[_0xe8d0('0x145')],_0xe8d0('0xbb'),_0x231f49['name'],_0xe8d0('0x74'),_0x231f49['pTalking']);this[_0xe8d0('0x9d')](_0x287704,_0x287704['linkedid'],_0x287704[_0xe8d0('0x145')]);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x1f')]=function(_0x264913){if(this[_0xe8d0('0x6f')][_0x264913[_0xe8d0('0x149')]]&&_0x264913['destlinkedid']!==_0x264913[_0xe8d0('0x14a')]){this[_0xe8d0('0x9d')](_0x264913,_0x264913[_0xe8d0('0x149')],_0x264913[_0xe8d0('0xed')]);}};Preview[_0xe8d0('0x10')]['syncHangupRequest']=function(_0x5a8c45){if(this[_0xe8d0('0x6f')][_0x5a8c45[_0xe8d0('0xb3')]]&&_0x5a8c45[_0xe8d0('0xb3')]!==_0x5a8c45[_0xe8d0('0xba')]&&!this['actions'][_0x5a8c45[_0xe8d0('0xb3')]][_0xe8d0('0x75')]){if(_0x5a8c45[_0xe8d0('0x145')]==='1'){this[_0xe8d0('0x9d')](_0x5a8c45,_0x5a8c45[_0xe8d0('0xb3')],_0x5a8c45[_0xe8d0('0x145')]);}}};Preview[_0xe8d0('0x10')]['addVariable']=function(_0x4c221e,_0x2167ec,_0x31e850){if(this[_0xe8d0('0x6f')][_0x4c221e]){if(_[_0xe8d0('0x6e')](this[_0xe8d0('0x6f')][_0x4c221e]['variables'])){this['actions'][_0x4c221e][_0xe8d0('0x14b')]={};}this[_0xe8d0('0x6f')][_0x4c221e][_0xe8d0('0x14b')][_0x2167ec]=_0x31e850;}};Preview[_0xe8d0('0x10')]['syncVarSet']=function(_0x3dd1a3){try{if(!_[_0xe8d0('0x6e')](_0x3dd1a3)){if(ut[_0xe8d0('0x14c')](_['keys'](_0x3dd1a3[_0xe8d0('0x14d')])[0x0])){this[_0xe8d0('0x14e')](_0x3dd1a3[_0xe8d0('0xba')],_[_0xe8d0('0x14f')](_0x3dd1a3[_0xe8d0('0x14d')])[0x0],_0x3dd1a3['value']);}}}catch(_0x2e2793){logger[_0xe8d0('0x150')](_0xe8d0('0x151'),util[_0xe8d0('0x152')](_0x2e2793,{'showHidden':![],'depth':null}));}};Preview[_0xe8d0('0x10')][_0xe8d0('0x23')]=function(_0xc0f639){if(_0xc0f639){if(this[_0xe8d0('0x6f')][_0xc0f639[_0xe8d0('0x153')]]){this[_0xe8d0('0x6f')][_0xc0f639[_0xe8d0('0x153')]][_0xe8d0('0x154')]=!![];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x25')]=function(_0x162542){if(_0x162542){if(this['actions'][_0x162542[_0xe8d0('0x155')]]){this[_0xe8d0('0x6f')][_0x162542[_0xe8d0('0x155')]][_0xe8d0('0x154')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2873ef0..c449961 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 _0x56e1=['../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x56e1,0x1f0));var _0x156e=function(_0x58c882,_0x487257){_0x58c882=_0x58c882-0x0;var _0x145f90=_0x56e1[_0x58c882];return _0x145f90;};'use strict';var util=require('util');var BPromise=require(_0x156e('0x0'));var logger=require(_0x156e('0x1'))(_0x156e('0x2'));var _=require('lodash');var cmHopper=require(_0x156e('0x3'));var cmHopperFinal=require(_0x156e('0x4'));var cmHopperHistory=require(_0x156e('0x5'));var cmHopperBlack=require(_0x156e('0x6'));var voiceQueueRt=require(_0x156e('0x7'));var agentReportPreview=require(_0x156e('0x8'));var voiceQueueReport=require(_0x156e('0x9'));function loggerCatch(_0x27d5fc){return function(_0x429f00){logger[_0x156e('0xa')](_0x27d5fc,util['inspect'](_0x429f00,{'showHidden':![],'depth':null}));};}function create(_0x1f0bd9){return BPromise[_0x156e('0xb')]()['then'](cmHopperHistory['createHistory'](_0x1f0bd9))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x287780){return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](agentReportPreview[_0x156e('0xd')](_0x287780))[_0x156e('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x12f03d){return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](cmHopper[_0x156e('0xf')](_0x12f03d,!![]))[_0x156e('0xe')](loggerCatch(_0x156e('0x10')));}exports[_0x156e('0x11')]=function(_0x4335b6){return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](cmHopperBlack[_0x156e('0x11')](_0x4335b6))[_0x156e('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x321640){return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](cmHopper[_0x156e('0x12')](_0x321640))[_0x156e('0xe')](loggerCatch(_0x156e('0x13')));};exports['createHistory']=function(_0xcb2350,_0x5ca499){create(_0xcb2350)[_0x156e('0xe')](loggerCatch(_0x5ca499));moveContact(_0xcb2350)['catch'](loggerCatch(_0x5ca499));};exports[_0x156e('0x14')]=function(_0x268852,_0x3a3de9){createAgent(_0x268852)['catch'](loggerCatch(_0x3a3de9));};exports[_0x156e('0x15')]=function(_0xdf9ae5,_0x47cb00){create(_0xdf9ae5)[_0x156e('0xe')](loggerCatch(_0x47cb00));};exports[_0x156e('0x16')]=function(_0xfe85ba,_0x312824){moveContact(_0xfe85ba)['catch'](loggerCatch(_0x312824));};exports[_0x156e('0x17')]=function(_0x44ccea,_0x4d6ec4,_0x3629b2){if(_0x4d6ec4){_0x44ccea[_0x156e('0x18')]=null;}if(_0x3629b2){_0x44ccea[_0x156e('0x19')]=![];}return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](cmHopper[_0x156e('0x17')](_0x44ccea))['catch'](loggerCatch(_0x156e('0x1a')));};exports['countReScheduled']=function(_0x57cff0){return BPromise[_0x156e('0xb')]()['then'](cmHopper['countReScheduled'](_0x57cff0))[_0x156e('0xe')](loggerCatch(_0x156e('0x1b')));};exports[_0x156e('0x1c')]=function(_0x42f894){return BPromise[_0x156e('0xb')]()['then'](cmHopper[_0x156e('0x1c')]({'UserId':null},_0x42f894,0x1))[_0x156e('0xe')](loggerCatch(_0x156e('0x1d')));};exports[_0x156e('0x1e')]=function(_0x361cd4){return BPromise['resolve']()[_0x156e('0xc')](cmHopper[_0x156e('0x1c')]({'active':![]},_0x361cd4,0x1))[_0x156e('0xe')](loggerCatch(_0x156e('0x1f')));};exports['crateCustomerReportQueue']=function(_0x231d62){var _0x1d6462={};_0x1d6462[_0x156e('0x20')]=_0x231d62[_0x156e('0x20')];_0x1d6462['uniqueid']=_0x231d62[_0x156e('0x21')];_0x1d6462[_0x156e('0x22')]=_0x231d62['calleridnum'];_0x1d6462[_0x156e('0x23')]=_0x231d62[_0x156e('0x23')];_0x1d6462[_0x156e('0x24')]=_0x231d62[_0x156e('0x24')];_0x1d6462[_0x156e('0x25')]=_0x231d62[_0x156e('0x26')];_0x1d6462[_0x156e('0x27')]=_0x231d62[_0x156e('0x26')];_0x1d6462[_0x156e('0x28')]=0x1;_0x1d6462[_0x156e('0x29')]=_0x231d62[_0x156e('0x2a')];_0x1d6462[_0x156e('0x2b')]=_0x231d62[_0x156e('0x2c')];_0x1d6462[_0x156e('0x2d')]=_0x156e('0x2e');_0x1d6462[_0x156e('0x2f')]=_0x156e('0x30');_0x1d6462['holdtime']=0x0;_0x1d6462['assigned']=0x1;_0x1d6462[_0x156e('0x31')]=_0x231d62[_0x156e('0x2c')];_0x1d6462[_0x156e('0x32')]=_0x156e('0x33');return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](voiceQueueReport['create'](_0x1d6462))['catch'](loggerCatch(_0x156e('0x34')));};exports[_0x156e('0x35')]=function(_0x2c5ab8,_0x548d35){return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](cmHopper[_0x156e('0x35')](_0x2c5ab8,_0x548d35))[_0x156e('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x156e('0x36')]=function(_0x2ef36a){return BPromise[_0x156e('0xb')]()[_0x156e('0xc')](cmHopper[_0x156e('0x17')](_0x2ef36a,!![],!![]))['catch'](loggerCatch(_0x156e('0x37')));}; \ No newline at end of file +var _0x45c8=['[unlockContact]\x20','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x33d669,_0x561672){var _0x46186c=function(_0x3246e7){while(--_0x3246e7){_0x33d669['push'](_0x33d669['shift']());}};_0x46186c(++_0x561672);}(_0x45c8,0xb3));var _0x845c=function(_0x1ea519,_0x4c65a8){_0x1ea519=_0x1ea519-0x0;var _0x27e73e=_0x45c8[_0x1ea519];return _0x27e73e;};'use strict';var util=require(_0x845c('0x0'));var BPromise=require('bluebird');var logger=require(_0x845c('0x1'))(_0x845c('0x2'));var _=require(_0x845c('0x3'));var cmHopper=require(_0x845c('0x4'));var cmHopperFinal=require(_0x845c('0x5'));var cmHopperHistory=require(_0x845c('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x845c('0x7'));var voiceQueueReport=require(_0x845c('0x8'));function loggerCatch(_0x143b19){return function(_0x576ede){logger[_0x845c('0x9')](_0x143b19,util['inspect'](_0x576ede,{'showHidden':![],'depth':null}));};}function create(_0x235a17){return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopperHistory['createHistory'](_0x235a17))[_0x845c('0xc')](loggerCatch(_0x845c('0xd')));}function createAgent(_0x3a149e){return BPromise['resolve']()[_0x845c('0xb')](agentReportPreview['createHistory'](_0x3a149e))[_0x845c('0xc')](loggerCatch(_0x845c('0xd')));}function moveContact(_0x262e3e){return BPromise['resolve']()['then'](cmHopper[_0x845c('0xe')](_0x262e3e,!![]))['catch'](loggerCatch(_0x845c('0xf')));}exports['checkIsBlackList']=function(_0x321885){return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopperBlack[_0x845c('0x10')](_0x321885))[_0x845c('0xc')](loggerCatch(_0x845c('0x11')));};exports[_0x845c('0x12')]=function(_0x4c0fc3){return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopper[_0x845c('0x12')](_0x4c0fc3))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x845c('0x13')]=function(_0x365c94,_0x5ea26c){create(_0x365c94)[_0x845c('0xc')](loggerCatch(_0x5ea26c));moveContact(_0x365c94)[_0x845c('0xc')](loggerCatch(_0x5ea26c));};exports[_0x845c('0x14')]=function(_0x2829eb,_0x541360){createAgent(_0x2829eb)[_0x845c('0xc')](loggerCatch(_0x541360));};exports[_0x845c('0x15')]=function(_0x279e9a,_0x3b9fc3){create(_0x279e9a)[_0x845c('0xc')](loggerCatch(_0x3b9fc3));};exports[_0x845c('0x16')]=function(_0x4e2e90,_0x38b80c){moveContact(_0x4e2e90)['catch'](loggerCatch(_0x38b80c));};exports[_0x845c('0x17')]=function(_0xbb8100,_0x3394c9,_0x551224){if(_0x3394c9){_0xbb8100['UserId']=null;}if(_0x551224){_0xbb8100[_0x845c('0x18')]=![];}return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopper[_0x845c('0x17')](_0xbb8100))[_0x845c('0xc')](loggerCatch(_0x845c('0x19')));};exports[_0x845c('0x1a')]=function(_0x39173a){return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopper[_0x845c('0x1a')](_0x39173a))[_0x845c('0xc')](loggerCatch(_0x845c('0x1b')));};exports[_0x845c('0x1c')]=function(_0x1dce2f){return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopper['unlockContact']({'UserId':null},_0x1dce2f,0x1))['catch'](loggerCatch(_0x845c('0x1d')));};exports['disableContact']=function(_0x25ffa3){return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopper[_0x845c('0x1c')]({'active':![]},_0x25ffa3,0x1))[_0x845c('0xc')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x39d172){var _0x4656bf={};_0x4656bf['type']=_0x39d172['type'];_0x4656bf[_0x845c('0x1e')]=_0x39d172[_0x845c('0x1e')];_0x4656bf['calleridnum']=_0x39d172[_0x845c('0x1f')];_0x4656bf[_0x845c('0x20')]=_0x39d172['calleridname'];_0x4656bf[_0x845c('0x21')]=_0x39d172['queue'];_0x4656bf['queuecallerjoinAt']=_0x39d172[_0x845c('0x22')];_0x4656bf[_0x845c('0x23')]=_0x39d172[_0x845c('0x22')];_0x4656bf[_0x845c('0x24')]=0x1;_0x4656bf[_0x845c('0x25')]=_0x39d172[_0x845c('0x26')];_0x4656bf[_0x845c('0x27')]=_0x39d172['membername'];_0x4656bf['context']='from-sip';_0x4656bf[_0x845c('0x28')]=_0x845c('0x29');_0x4656bf['holdtime']=0x0;_0x4656bf[_0x845c('0x2a')]=0x1;_0x4656bf[_0x845c('0x2b')]=_0x39d172[_0x845c('0x2c')];_0x4656bf[_0x845c('0x2d')]=_0x845c('0x2e');return BPromise['resolve']()[_0x845c('0xb')](voiceQueueReport['create'](_0x4656bf))[_0x845c('0xc')](loggerCatch(_0x845c('0x2f')));};exports[_0x845c('0x30')]=function(_0x2ae496,_0x245675){return BPromise[_0x845c('0xa')]()[_0x845c('0xb')](cmHopper[_0x845c('0x30')](_0x2ae496,_0x245675))[_0x845c('0xc')](loggerCatch(_0x845c('0x31')));};exports[_0x845c('0x32')]=function(_0x55ccdf){return BPromise['resolve']()[_0x845c('0xb')](cmHopper[_0x845c('0x17')](_0x55ccdf,!![],!![]))[_0x845c('0xc')](loggerCatch(_0x845c('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 ca0d41b..d3c23a0 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 _0xe46d=['isEmpty','format','\x22\x22\x20<>','isActive','isNil','Queue','name','\x22%s\x22\x20<%s>','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','logCustomer','statedesc','talktime','answertime','Failure','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','interface','motionChannel','mandatoryDisposition','queue','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','ListId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','isUndefined','string'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0xe46d,0x199));var _0xde46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe46d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xde46('0x0'));var moment=require(_0xde46('0x1'));var logger=require('../../../../config/logger')(_0xde46('0x2'));var ipAgi=process[_0xde46('0x3')][_0xde46('0x4')]||_0xde46('0x5');function getSeconds(_0x2ee5ff,_0xa8ad5d){var _0x54d5d5=moment(_0x2ee5ff)[_0xde46('0x6')](0x0);var _0x4e501e=moment(_0xa8ad5d)['milliseconds'](0x0);return _0x54d5d5['diff'](_0x4e501e,'seconds');}exports[_0xde46('0x7')]=function(_0x1f9e3e){return function(_0x4118bd){logger[_0xde46('0x8')](_0x1f9e3e,util['inspect'](_0x4118bd,{'showHidden':![],'depth':null}));};};exports[_0xde46('0x9')]=function(_0x5b0250,_0xbadbbd){logger[_0xde46('0xa')](_0x5b0250,util['inspect'](_0xbadbbd,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4a0a2f,_0x46dd12){logger['error'](_0x4a0a2f,util[_0xde46('0xb')](_0x46dd12,{'showHidden':![],'depth':null}));};exports[_0xde46('0xc')]=function(_0x3c8c2d){return function(_0x343c01){logger[_0xde46('0xa')](_0x3c8c2d,util[_0xde46('0xb')](_0x343c01,{'showHidden':![],'depth':null}));};};exports[_0xde46('0xd')]=function(_0x617b59,_0x3018e2,_0x10c05e){return{'message':_0x617b59,'unlock':_0x3018e2,'active':_0x10c05e};};exports[_0xde46('0xe')]=function(_0x40bb91,_0x457097,_0x101aac){if(!_[_0xde46('0xf')](_0x101aac)&&_0xde46('0x10')===typeof _0x101aac&&!_['isEmpty'](_0x101aac)){if(!_[_0xde46('0xf')](_0x457097)&&_0xde46('0x10')===typeof _0x457097&&!_[_0xde46('0x11')](_0x457097)){return util[_0xde46('0x12')]('\x22%s\x22\x20<%s>',_0x457097,_0x101aac);}return util[_0xde46('0x12')]('\x22%s\x22\x20<%s>',_0x101aac,_0x101aac);}if(!_['isUndefined'](_0x40bb91)&&_0xde46('0x10')===typeof _0x40bb91&&!_['isEmpty'](_0x40bb91)){return _0x40bb91;}return _0xde46('0x13');};exports[_0xde46('0x14')]=function(_0x458a54){if(_[_0xde46('0x15')](_0x458a54)){return![];}return _0x458a54;};exports['addVariables']=function(_0x440dd5,_0x50e8e1,_0x47ddc5,_0x1ec48b,_0x2bc812,_0x134340){var _0xc3a419={'XMD-QUEUE':_0x50e8e1[_0xde46('0x16')]?_0x50e8e1[_0xde46('0x16')][_0xde46('0x17')]:'','XMD-CALLERID':_0x1ec48b,'XMD-CALLERID-PREVIEW':_0x134340?util['format'](_0xde46('0x18'),_0x134340[_0xde46('0x19')],_0x134340['calleridnum']):_0x1ec48b,'XMD-DIALID':_0x2bc812,'XMD-CONTACTID':_0x50e8e1[_0xde46('0x1a')],'XMD-CDRTYPE':_0xde46('0x1b'),'CALLERID(all)':_0x1ec48b,'XMD-VOICEQUEUEID':_0x50e8e1['VoiceQueueId'],'XMD-DIALCHANNEL':_0x47ddc5,'XMD-DIALTIMEOUT':_0x440dd5[_0xde46('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xde46('0x12')](_0xde46('0x1d'),_0x440dd5[_0xde46('0x1e')]?'g':'',_['isEmpty'](_0x440dd5[_0xde46('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x440dd5['dialPreviewUrl']||'','XMD-AGI':_0x440dd5[_0xde46('0x20')]?util[_0xde46('0x12')](_0xde46('0x21'),ipAgi,_0x440dd5['dialQueueProject']):_0xde46('0x22'),'XMD-AGIAFTER':_0x440dd5['dialQueueProject2']?util[_0xde46('0x12')](_0xde46('0x21'),ipAgi,_0x440dd5[_0xde46('0x1e')]):_0xde46('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x134340?_0x134340['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x134340?_0x134340[_0xde46('0x23')]:'','XMD-DESTINATION':_0xde46('0x24'),'SIPADDHEADER':_0xde46('0x25')};if(!_[_0xde46('0x11')](_0x440dd5[_0xde46('0x1f')])){_0xc3a419[util[_0xde46('0x12')]('%s',_0xde46('0x26'))]=_0x440dd5['monitor_format'];_0xc3a419[util[_0xde46('0x12')]('%s',_0xde46('0x27'))]=_0x2bc812;}if(_0x50e8e1&&_0x50e8e1[_0xde46('0x28')]){for(var _0x75a2ba in _0x50e8e1[_0xde46('0x28')]){if(_0x50e8e1[_0xde46('0x28')]['hasOwnProperty'](_0x75a2ba)){if(!_[_0xde46('0x15')](_0x50e8e1['Contact'][_0x75a2ba])&&_0x75a2ba!=='id'&&_0x75a2ba!=='tags'&&_0x75a2ba!==_0xde46('0x29')&&_0x75a2ba!==_0xde46('0x2a')){_0xc3a419[util['format'](_0xde46('0x2b'),'XMD-',_[_0xde46('0x2c')](_0x75a2ba))]=_0x50e8e1['Contact'][_0x75a2ba];}}}}return _0xc3a419;};exports[_0xde46('0x2d')]=function(_0x2a4b1e){var _0x1adc10={};for(var _0x53e6c2 in _0x2a4b1e){if(_0x2a4b1e['hasOwnProperty'](_0x53e6c2)){_0x1adc10[util[_0xde46('0x12')]('%s',_[_0xde46('0x2e')](_0x53e6c2))]=_0x2a4b1e[_0x53e6c2];}}return{'variables':_0x1adc10};};exports['updateOriginated']=function(_0x4b98dc,_0x1ae6c0){if(!_[_0xde46('0x15')](_0x4b98dc)){if(_0x4b98dc[_0xde46('0x2f')](_0xde46('0x30'))){if(_0x4b98dc[_0xde46('0x30')]>0x0){_0x4b98dc[_0xde46('0x30')]-=0x1;}else{logger[_0xde46('0x8')](_0xde46('0x31'),_0x1ae6c0);}}}else{logger[_0xde46('0x8')](_0xde46('0x32'),_0x1ae6c0);}};exports['logBlacklist']=function(_0x4d4681){var _0x3a0245=moment()[_0xde46('0x12')](_0xde46('0x33'));_0x4d4681[_0xde46('0x34')]=0xd;_0x4d4681['statedesc']=_0xde46('0x35');_0x4d4681[_0xde46('0x36')]=_0x3a0245;_0x4d4681[_0xde46('0x37')]=_0x3a0245;_0x4d4681[_0xde46('0x38')]=_0x3a0245;};exports[_0xde46('0x39')]=function(_0x5eb0d5,_0x2a84ef,_0x39c75c){var _0x5bd8df=moment()[_0xde46('0x12')](_0xde46('0x33'));_0x5eb0d5[_0xde46('0x34')]=_0x2a84ef;_0x5eb0d5['statedesc']=_0x39c75c;_0x5eb0d5[_0xde46('0x37')]=_0x5bd8df;_0x5eb0d5[_0xde46('0x3a')]=getSeconds(_0x5eb0d5[_0xde46('0x37')],_0x5eb0d5[_0xde46('0x36')]);};exports['logLookAgent']=function(_0x47a0e6,_0x1fcb3c,_0xb47b1a){_0x47a0e6[_0xde46('0x3b')]=_0x1fcb3c;_0x47a0e6[_0xde46('0x3c')]=_0xb47b1a;};exports[_0xde46('0x3d')]=function(_0x4a4a5a,_0x59c4f2,_0x5ccd17){var _0x2cc65d=moment()[_0xde46('0x12')](_0xde46('0x33'));_0x4a4a5a[_0xde46('0x34')]=_0x59c4f2;_0x4a4a5a[_0xde46('0x3e')]=_0x5ccd17;_0x4a4a5a[_0xde46('0x37')]=_0x4a4a5a['responsetime']?_0x4a4a5a[_0xde46('0x37')]:_0x2cc65d;_0x4a4a5a[_0xde46('0x38')]=_0x4a4a5a[_0xde46('0x38')]?_0x4a4a5a[_0xde46('0x38')]:_0x2cc65d;_0x4a4a5a[_0xde46('0x3a')]=getSeconds(_0x4a4a5a[_0xde46('0x37')]||0x0,_0x4a4a5a[_0xde46('0x36')]||0x0);_0x4a4a5a[_0xde46('0x3f')]=_0x4a4a5a[_0xde46('0x40')]?getSeconds(_0x4a4a5a['endtime'],_0x4a4a5a['answertime']):0x0;};exports['isFailure']=function(_0x1490fa){return _0x1490fa===_0xde46('0x41');};exports['variablesAction']=function(_0x302f9a,_0x541806,_0x5d520e,_0x5b8548,_0x3cabe1){var _0x12aedc=_0x5b8548?'RECALL':_0x302f9a[_0xde46('0x19')];_0x12aedc=_0x3cabe1?_0xde46('0x42'):_0x12aedc;return{'actionid':_0x302f9a[_0xde46('0x43')],'action':_0xde46('0x44'),'channel':_0x302f9a[_0xde46('0x45')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x12aedc,_0x302f9a[_0xde46('0x46')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x5d520e,'timeout':(_0x541806[_0xde46('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x302f9a[_0xde46('0x43')]};};exports[_0xde46('0x48')]=function(_0x31cbd1){return _0x31cbd1[_0xde46('0x49')]+_0x31cbd1[_0xde46('0x4a')]+_0x31cbd1[_0xde46('0x4b')]+_0x31cbd1['countagentrejectretry']+_0x31cbd1[_0xde46('0x4c')];};exports[_0xde46('0x4d')]=function(_0x12a86a){var _0x351d6e=_[_0xde46('0x4e')](_0x12a86a);_0x351d6e[_0xde46('0x34')]=0xf;_0x351d6e[_0xde46('0x3e')]=_0xde46('0x4f');return _0x351d6e;};exports[_0xde46('0x50')]=function(_0x54df09,_0x216935,_0x32e830){var _0x2deb47={};_0x2deb47[_0x216935]=_0x54df09[_0x216935];_0x2deb47[_0xde46('0x51')]=![];_0x2deb47[_0xde46('0x52')]=moment()[_0xde46('0x53')](_0x32e830,'minutes')[_0xde46('0x12')](_0xde46('0x33'));_0x2deb47['ContactId']=_0x54df09[_0xde46('0x1a')];_0x2deb47['ListId']=_0x54df09['ListId'];_0x2deb47[_0xde46('0x54')]=_0x54df09['VoiceQueueId']||undefined;return _0x2deb47;};exports[_0xde46('0x55')]=function(_0x2c8fda,_0x8de6c4){if(!_[_0xde46('0x15')](_0x2c8fda)){if(_0x2c8fda['pTalking']>0x0){_0x2c8fda[_0xde46('0x56')]-=0x1;}else{logger[_0xde46('0x8')](_0x8de6c4,_0xde46('0x57'));}}else{logger[_0xde46('0x8')](_0x8de6c4,_0xde46('0x58'));}};exports[_0xde46('0x59')]=function(_0x59c55d){if(_0x59c55d<=0x0){return!![];}return![];};exports[_0xde46('0x5a')]=function(_0x201bde,_0x20fb83,_0x502aa6){_0x201bde['lastevent']=_0x20fb83;_0x201bde[_0xde46('0x17')]=_0x201bde['queue'];_0x201bde[_0xde46('0x5b')]=_0x201bde['channelAgent'];_0x201bde[_0xde46('0x5c')]='voice';if(_0x502aa6){_0x201bde[_0xde46('0x5d')]=_0x502aa6[_0xde46('0x5d')];}return _0x201bde;};exports['buildAcw']=function(_0x3d4301){var _0x4e97ec={};_0x4e97ec['queue']=_0x3d4301[_0xde46('0x5e')];_0x4e97ec['interface']=_0x3d4301['channelAgent'];_0x4e97ec[_0xde46('0x43')]=_0x3d4301[_0xde46('0x43')];return _0x4e97ec;};exports[_0xde46('0x5f')]=function(_0x5ba113){var _0x366ef7=[];for(var _0x22481a in _0x5ba113){if(_0x5ba113['hasOwnProperty'](_0x22481a)){if(!_[_0xde46('0x15')](_0x5ba113[_0x22481a])&&_0x5ba113[_0x22481a][_0xde46('0x34')]===_0xde46('0x60')&&_0x5ba113[_0x22481a][_0xde46('0x61')]===_0xde46('0x62')){_0x366ef7[_0xde46('0x63')](_0x5ba113[_0x22481a]['id']);}}}return _0x366ef7;};exports[_0xde46('0x64')]=function(_0x570c4b){var _0x302def=moment()[_0xde46('0x6')](0x0);var _0x1d4d42=moment(_0x570c4b)['milliseconds'](0x0);return _0x302def[_0xde46('0x65')](_0x1d4d42,_0xde46('0x66'));};exports[_0xde46('0x67')]=function(_0x1aa18a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1aa18a['ContactId'],'ListId':_0x1aa18a['ListId'],'VoiceQueueId':_0x1aa18a[_0xde46('0x54')]||undefined,'CampaignId':_0x1aa18a[_0xde46('0x68')]||undefined};};exports[_0xde46('0x69')]=function(_0x3f3ea5){if(_0x3f3ea5===_0xde46('0x43')||_0x3f3ea5===_0xde46('0x6a')||_0x3f3ea5===_0xde46('0x5e')||_0x3f3ea5===_0xde46('0x6b')||_0x3f3ea5===_0xde46('0x6c')||_0x3f3ea5===_0xde46('0x6d')||_0x3f3ea5===_0xde46('0x3b')||_0x3f3ea5===_0xde46('0x45')||_0x3f3ea5===_0xde46('0x19')||_0x3f3ea5===_0xde46('0x51')||_0x3f3ea5==='calleridnum'||_0x3f3ea5===_0xde46('0x52')||_0x3f3ea5===_0xde46('0x49')||_0x3f3ea5===_0xde46('0x4a')||_0x3f3ea5===_0xde46('0x4b')||_0x3f3ea5===_0xde46('0x6e')||_0x3f3ea5===_0xde46('0x6f')||_0x3f3ea5==='callbackuniqueid'||_0x3f3ea5===_0xde46('0x70')||_0x3f3ea5===_0xde46('0x71')||_0x3f3ea5===_0xde46('0x1a')||_0x3f3ea5===_0xde46('0x72')||_0x3f3ea5===_0xde46('0x3c')||_0x3f3ea5==='VoiceQueueId'||_0x3f3ea5===_0xde46('0x73')||_0x3f3ea5===_0xde46('0x74')||_0x3f3ea5==='xmd-queue'||_0x3f3ea5===_0xde46('0x75')||_0x3f3ea5==='xmd-listid'||_0x3f3ea5===_0xde46('0x76')||_0x3f3ea5===_0xde46('0x77')||_0x3f3ea5==='xmd-dialoptions'||_0x3f3ea5===_0xde46('0x78')||_0x3f3ea5===_0xde46('0x79')||_0x3f3ea5===_0xde46('0x7a')||_0x3f3ea5===_0xde46('0x7b')||_0x3f3ea5===_0xde46('0x7c')||_0x3f3ea5===_0xde46('0x7d')||_0x3f3ea5==='xmd-agi'||_0x3f3ea5===_0xde46('0x7e')||_0x3f3ea5===_0xde46('0x7f')||_0x3f3ea5===_0xde46('0x80')||_0x3f3ea5===_0xde46('0x81')||_0x3f3ea5===_0xde46('0x82')||_0x3f3ea5===_0xde46('0x83')||_0x3f3ea5==='rtpaudioqosrtt'||_0x3f3ea5==='rtpaudioqosrttbridged'||_0x3f3ea5==='rtpaudioqos'||_0x3f3ea5===_0xde46('0x7f')||_0x3f3ea5===_0xde46('0x80')||_0x3f3ea5==='rtpaudioqosjitterbridged'||_0x3f3ea5===_0xde46('0x82')||_0x3f3ea5==='rtpaudioqoslossbridged'||_0x3f3ea5===_0xde46('0x84')||_0x3f3ea5===_0xde46('0x85')||_0x3f3ea5===_0xde46('0x86')||_0x3f3ea5===_0xde46('0x87')||_0x3f3ea5==='state'||_0x3f3ea5===_0xde46('0x3e')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3f73f8,_0x35bc05){var _0x72b290,_0x3a4061,_0x47ec59;if(_0x35bc05<=0x0){_0x35bc05=0x1;}_0x72b290=new RegExp(_0xde46('0x88')+_0x35bc05+'}$');_0x3a4061=Math[_0xde46('0x89')](0xa,_0x35bc05-0x1);_0x47ec59=Math[_0xde46('0x89')](0xa,_0x35bc05)-0x1;return util[_0xde46('0x12')]('%s',_[_0xde46('0x8a')](_0x3f73f8,_0x72b290,_[_0xde46('0x8b')](_0x3a4061,_0x47ec59)));};exports['extractCalleridName']=function(_0x59bebd){var _0x1cb07c=_0x59bebd[_0xde46('0x8c')](/"(.*?)"/);return _0x1cb07c?_0x1cb07c[0x1]:_0x59bebd;};exports[_0xde46('0x8d')]=function(_0x6b029e){var _0x37bf68=_0x6b029e['match'](/<(.*?)>/);return _0x37bf68?_0x37bf68[0x1]:_0x6b029e;}; \ No newline at end of file +var _0x41a2=['info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','starttime','logLookAgent','UserId','ringtime','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','scheduledat','countbusyretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','lodash','moment','../../../../config/logger','preview','milliseconds','diff','seconds','loggerCatch','error','inspect','logger'];(function(_0x364f76,_0x1a2597){var _0x1264ca=function(_0x296db1){while(--_0x296db1){_0x364f76['push'](_0x364f76['shift']());}};_0x1264ca(++_0x1a2597);}(_0x41a2,0x1a2));var _0x241a=function(_0x37974a,_0x2804cf){_0x37974a=_0x37974a-0x0;var _0x45fd4e=_0x41a2[_0x37974a];return _0x45fd4e;};'use strict';var util=require('util');var _=require(_0x241a('0x0'));var moment=require(_0x241a('0x1'));var logger=require(_0x241a('0x2'))(_0x241a('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x145aa9,_0x1b7304){var _0x29af4f=moment(_0x145aa9)[_0x241a('0x4')](0x0);var _0x28d10c=moment(_0x1b7304)[_0x241a('0x4')](0x0);return _0x29af4f[_0x241a('0x5')](_0x28d10c,_0x241a('0x6'));}exports[_0x241a('0x7')]=function(_0x3f8b57){return function(_0xf0d7e0){logger[_0x241a('0x8')](_0x3f8b57,util[_0x241a('0x9')](_0xf0d7e0,{'showHidden':![],'depth':null}));};};exports[_0x241a('0xa')]=function(_0x8a2870,_0x1c3d5f){logger[_0x241a('0xb')](_0x8a2870,util[_0x241a('0x9')](_0x1c3d5f,{'showHidden':![],'depth':null}));};exports[_0x241a('0xc')]=function(_0x2586ff,_0x2814fe){logger[_0x241a('0x8')](_0x2586ff,util[_0x241a('0x9')](_0x2814fe,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x1aa7f3){return function(_0x2ceab6){logger[_0x241a('0xb')](_0x1aa7f3,util[_0x241a('0x9')](_0x2ceab6,{'showHidden':![],'depth':null}));};};exports[_0x241a('0xd')]=function(_0x98e852,_0x5024d5,_0x102a87){return{'message':_0x98e852,'unlock':_0x5024d5,'active':_0x102a87};};exports[_0x241a('0xe')]=function(_0x3ab243,_0x5c5f4d,_0x1971c4){if(!_['isUndefined'](_0x1971c4)&&'string'===typeof _0x1971c4&&!_['isEmpty'](_0x1971c4)){if(!_[_0x241a('0xf')](_0x5c5f4d)&&_0x241a('0x10')===typeof _0x5c5f4d&&!_[_0x241a('0x11')](_0x5c5f4d)){return util[_0x241a('0x12')](_0x241a('0x13'),_0x5c5f4d,_0x1971c4);}return util['format']('\x22%s\x22\x20<%s>',_0x1971c4,_0x1971c4);}if(!_[_0x241a('0xf')](_0x3ab243)&&_0x241a('0x10')===typeof _0x3ab243&&!_['isEmpty'](_0x3ab243)){return _0x3ab243;}return _0x241a('0x14');};exports[_0x241a('0x15')]=function(_0x42050d){if(_[_0x241a('0x16')](_0x42050d)){return![];}return _0x42050d;};exports['addVariables']=function(_0x534a1f,_0x188b6a,_0x10af35,_0x1d57c8,_0xc42f1d,_0x2bf295){var _0x14df09={'XMD-QUEUE':_0x188b6a[_0x241a('0x17')]?_0x188b6a[_0x241a('0x17')][_0x241a('0x18')]:'','XMD-CALLERID':_0x1d57c8,'XMD-CALLERID-PREVIEW':_0x2bf295?util[_0x241a('0x12')](_0x241a('0x13'),_0x2bf295[_0x241a('0x19')],_0x2bf295[_0x241a('0x1a')]):_0x1d57c8,'XMD-DIALID':_0xc42f1d,'XMD-CONTACTID':_0x188b6a[_0x241a('0x1b')],'XMD-CDRTYPE':_0x241a('0x1c'),'CALLERID(all)':_0x1d57c8,'XMD-VOICEQUEUEID':_0x188b6a[_0x241a('0x1d')],'XMD-DIALCHANNEL':_0x10af35,'XMD-DIALTIMEOUT':_0x534a1f['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x241a('0x12')](_0x241a('0x1e'),_0x534a1f[_0x241a('0x1f')]?'g':'',_['isEmpty'](_0x534a1f[_0x241a('0x20')])?'':_0x241a('0x21')),'XMD-DIALURL':_0x534a1f[_0x241a('0x22')]||'','XMD-AGI':_0x534a1f[_0x241a('0x23')]?util[_0x241a('0x12')](_0x241a('0x24'),ipAgi,_0x534a1f[_0x241a('0x23')]):'NONE','XMD-AGIAFTER':_0x534a1f[_0x241a('0x1f')]?util[_0x241a('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x534a1f[_0x241a('0x1f')]):_0x241a('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2bf295?_0x2bf295[_0x241a('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x2bf295?_0x2bf295['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x241a('0x27')};if(!_[_0x241a('0x11')](_0x534a1f[_0x241a('0x20')])){_0x14df09[util[_0x241a('0x12')]('%s',_0x241a('0x28'))]=_0x534a1f[_0x241a('0x20')];_0x14df09[util['format']('%s',_0x241a('0x29'))]=_0xc42f1d;}if(_0x188b6a&&_0x188b6a[_0x241a('0x2a')]){for(var _0xb0a8f8 in _0x188b6a[_0x241a('0x2a')]){if(_0x188b6a[_0x241a('0x2a')][_0x241a('0x2b')](_0xb0a8f8)){if(!_[_0x241a('0x16')](_0x188b6a[_0x241a('0x2a')][_0xb0a8f8])&&_0xb0a8f8!=='id'&&_0xb0a8f8!==_0x241a('0x2c')&&_0xb0a8f8!==_0x241a('0x2d')&&_0xb0a8f8!==_0x241a('0x2e')){_0x14df09[util[_0x241a('0x12')]('%s%s',_0x241a('0x2f'),_['toUpper'](_0xb0a8f8))]=_0x188b6a[_0x241a('0x2a')][_0xb0a8f8];}}}}return _0x14df09;};exports['toLowerVariables']=function(_0x3f8c94){var _0x2189b7={};for(var _0x280a83 in _0x3f8c94){if(_0x3f8c94[_0x241a('0x2b')](_0x280a83)){_0x2189b7[util['format']('%s',_['toLower'](_0x280a83))]=_0x3f8c94[_0x280a83];}}return{'variables':_0x2189b7};};exports[_0x241a('0x30')]=function(_0x57888b,_0x5b996f){if(!_['isNil'](_0x57888b)){if(_0x57888b[_0x241a('0x2b')](_0x241a('0x31'))){if(_0x57888b[_0x241a('0x31')]>0x0){_0x57888b[_0x241a('0x31')]-=0x1;}else{logger[_0x241a('0x8')](_0x241a('0x32'),_0x5b996f);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5b996f);}};exports[_0x241a('0x33')]=function(_0x197c3f){var _0x3fe194=moment()[_0x241a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x197c3f[_0x241a('0x34')]=0xd;_0x197c3f[_0x241a('0x35')]=_0x241a('0x36');_0x197c3f['starttime']=_0x3fe194;_0x197c3f[_0x241a('0x37')]=_0x3fe194;_0x197c3f[_0x241a('0x38')]=_0x3fe194;};exports[_0x241a('0x39')]=function(_0x1c7e3a,_0x52850d,_0x3996b9){var _0x33b8a7=moment()['format'](_0x241a('0x3a'));_0x1c7e3a[_0x241a('0x34')]=_0x52850d;_0x1c7e3a['statedesc']=_0x3996b9;_0x1c7e3a[_0x241a('0x37')]=_0x33b8a7;_0x1c7e3a['ringtime']=getSeconds(_0x1c7e3a[_0x241a('0x37')],_0x1c7e3a[_0x241a('0x3b')]);};exports[_0x241a('0x3c')]=function(_0x68f212,_0xd27ea0,_0x6e6b0d){_0x68f212['membername']=_0xd27ea0;_0x68f212[_0x241a('0x3d')]=_0x6e6b0d;};exports['logCustomer']=function(_0x321fa0,_0x4688d4,_0x461a55){var _0x5e4395=moment()[_0x241a('0x12')](_0x241a('0x3a'));_0x321fa0[_0x241a('0x34')]=_0x4688d4;_0x321fa0[_0x241a('0x35')]=_0x461a55;_0x321fa0['responsetime']=_0x321fa0[_0x241a('0x37')]?_0x321fa0['responsetime']:_0x5e4395;_0x321fa0['endtime']=_0x321fa0['endtime']?_0x321fa0['endtime']:_0x5e4395;_0x321fa0[_0x241a('0x3e')]=getSeconds(_0x321fa0[_0x241a('0x37')]||0x0,_0x321fa0[_0x241a('0x3b')]||0x0);_0x321fa0[_0x241a('0x3f')]=_0x321fa0[_0x241a('0x40')]?getSeconds(_0x321fa0[_0x241a('0x38')],_0x321fa0[_0x241a('0x40')]):0x0;};exports[_0x241a('0x41')]=function(_0x53a5cd){return _0x53a5cd==='Failure';};exports['variablesAction']=function(_0x3723d,_0x5d8a04,_0x6f6bb6,_0x53b7fd,_0x464055){var _0x48f62d=_0x53b7fd?_0x241a('0x42'):_0x3723d[_0x241a('0x19')];_0x48f62d=_0x464055?_0x241a('0x43'):_0x48f62d;return{'actionid':_0x3723d[_0x241a('0x44')],'action':_0x241a('0x45'),'channel':_0x3723d[_0x241a('0x46')],'callerid':util['format'](_0x241a('0x13'),_0x48f62d,_0x3723d['calleridnum']),'Exten':_0x241a('0x47'),'Context':_0x241a('0x48'),'Priority':'1','variable':_0x6f6bb6,'timeout':(_0x5d8a04[_0x241a('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3723d['uniqueid']};};exports[_0x241a('0x4a')]=function(_0x14697f){return _0x14697f['countbusyretry']+_0x14697f[_0x241a('0x4b')]+_0x14697f[_0x241a('0x4c')]+_0x14697f[_0x241a('0x4d')]+_0x14697f[_0x241a('0x4e')];};exports[_0x241a('0x4f')]=function(_0x22fa0f){var _0x2e9711=_[_0x241a('0x50')](_0x22fa0f);_0x2e9711[_0x241a('0x34')]=0xf;_0x2e9711[_0x241a('0x35')]=_0x241a('0x51');return _0x2e9711;};exports[_0x241a('0x52')]=function(_0x4f82e1,_0x2eb594,_0x39f050){var _0x54f858={};_0x54f858[_0x2eb594]=_0x4f82e1[_0x2eb594];_0x54f858[_0x241a('0x53')]=![];_0x54f858['scheduledat']=moment()[_0x241a('0x54')](_0x39f050,_0x241a('0x55'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x54f858[_0x241a('0x1b')]=_0x4f82e1[_0x241a('0x1b')];_0x54f858[_0x241a('0x56')]=_0x4f82e1[_0x241a('0x56')];_0x54f858['VoiceQueueId']=_0x4f82e1[_0x241a('0x1d')]||undefined;return _0x54f858;};exports[_0x241a('0x57')]=function(_0x551498,_0x41a093){if(!_[_0x241a('0x16')](_0x551498)){if(_0x551498[_0x241a('0x58')]>0x0){_0x551498[_0x241a('0x58')]-=0x1;}else{logger[_0x241a('0x8')](_0x41a093,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x241a('0x8')](_0x41a093,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x241a('0x59')]=function(_0x180e44){if(_0x180e44<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3cc801,_0x924a71,_0x5e3301){_0x3cc801[_0x241a('0x5a')]=_0x924a71;_0x3cc801[_0x241a('0x18')]=_0x3cc801[_0x241a('0x5b')];_0x3cc801[_0x241a('0x5c')]=_0x3cc801[_0x241a('0x46')];_0x3cc801['motionChannel']='voice';if(_0x5e3301){_0x3cc801[_0x241a('0x5d')]=_0x5e3301['mandatoryDisposition'];}return _0x3cc801;};exports[_0x241a('0x5e')]=function(_0x5af458){var _0x137f17={};_0x137f17['queue']=_0x5af458['queue'];_0x137f17[_0x241a('0x5c')]=_0x5af458[_0x241a('0x46')];_0x137f17[_0x241a('0x44')]=_0x5af458[_0x241a('0x44')];return _0x137f17;};exports[_0x241a('0x5f')]=function(_0xe62306){var _0x28ee32=[];for(var _0xb66c66 in _0xe62306){if(_0xe62306[_0x241a('0x2b')](_0xb66c66)){if(!_[_0x241a('0x16')](_0xe62306[_0xb66c66])&&_0xe62306[_0xb66c66][_0x241a('0x34')]===_0x241a('0x60')&&_0xe62306[_0xb66c66][_0x241a('0x61')]===_0x241a('0x62')){_0x28ee32[_0x241a('0x63')](_0xe62306[_0xb66c66]['id']);}}}return _0x28ee32;};exports['getDiff']=function(_0x1e6a20){var _0x2c9474=moment()['milliseconds'](0x0);var _0x104dac=moment(_0x1e6a20)[_0x241a('0x4')](0x0);return _0x2c9474['diff'](_0x104dac,_0x241a('0x6'));};exports[_0x241a('0x64')]=function(_0xf189fb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xf189fb[_0x241a('0x1b')],'ListId':_0xf189fb[_0x241a('0x56')],'VoiceQueueId':_0xf189fb[_0x241a('0x1d')]||undefined,'CampaignId':_0xf189fb[_0x241a('0x65')]||undefined};};exports[_0x241a('0x66')]=function(_0x309942){if(_0x309942===_0x241a('0x44')||_0x309942===_0x241a('0x67')||_0x309942==='queue'||_0x309942===_0x241a('0x68')||_0x309942===_0x241a('0x69')||_0x309942===_0x241a('0x6a')||_0x309942===_0x241a('0x6b')||_0x309942===_0x241a('0x46')||_0x309942===_0x241a('0x19')||_0x309942===_0x241a('0x53')||_0x309942===_0x241a('0x1a')||_0x309942===_0x241a('0x6c')||_0x309942===_0x241a('0x6d')||_0x309942===_0x241a('0x4b')||_0x309942==='countnoanswerretry'||_0x309942==='countglobal'||_0x309942===_0x241a('0x6e')||_0x309942===_0x241a('0x6f')||_0x309942===_0x241a('0x70')||_0x309942===_0x241a('0x71')||_0x309942===_0x241a('0x1b')||_0x309942===_0x241a('0x56')||_0x309942===_0x241a('0x3d')||_0x309942===_0x241a('0x1d')||_0x309942===_0x241a('0x72')||_0x309942===_0x241a('0x73')||_0x309942===_0x241a('0x74')||_0x309942===_0x241a('0x75')||_0x309942===_0x241a('0x76')||_0x309942===_0x241a('0x77')||_0x309942===_0x241a('0x78')||_0x309942===_0x241a('0x79')||_0x309942===_0x241a('0x7a')||_0x309942===_0x241a('0x7b')||_0x309942===_0x241a('0x7c')||_0x309942===_0x241a('0x7d')||_0x309942===_0x241a('0x7e')||_0x309942==='xmd-agiafter'||_0x309942===_0x241a('0x7f')||_0x309942===_0x241a('0x80')||_0x309942===_0x241a('0x81')||_0x309942==='rtpaudioqosjitter'||_0x309942===_0x241a('0x82')||_0x309942===_0x241a('0x83')||_0x309942===_0x241a('0x84')||_0x309942===_0x241a('0x85')||_0x309942===_0x241a('0x86')||_0x309942===_0x241a('0x80')||_0x309942===_0x241a('0x81')||_0x309942===_0x241a('0x87')||_0x309942==='rtpaudioqosjitterbridged'||_0x309942===_0x241a('0x83')||_0x309942===_0x241a('0x84')||_0x309942==='rtpaudioqosrtt'||_0x309942===_0x241a('0x86')||_0x309942==='bridgepeer'||_0x309942==='bridgepvtcallid'||_0x309942===_0x241a('0x34')||_0x309942===_0x241a('0x35')){return![];}return!![];};exports[_0x241a('0x88')]=function(_0x221f36,_0x1da10d){var _0x338d9c,_0x19488c,_0x221e0e;if(_0x1da10d<=0x0){_0x1da10d=0x1;}_0x338d9c=new RegExp(_0x241a('0x89')+_0x1da10d+'}$');_0x19488c=Math['pow'](0xa,_0x1da10d-0x1);_0x221e0e=Math[_0x241a('0x8a')](0xa,_0x1da10d)-0x1;return util[_0x241a('0x12')]('%s',_[_0x241a('0x8b')](_0x221f36,_0x338d9c,_[_0x241a('0x8c')](_0x19488c,_0x221e0e)));};exports[_0x241a('0x8d')]=function(_0x287bf8){var _0x2d9311=_0x287bf8[_0x241a('0x8e')](/"(.*?)"/);return _0x2d9311?_0x2d9311[0x1]:_0x287bf8;};exports['extractCalleridNumber']=function(_0x335a05){var _0x1c6ba8=_0x335a05[_0x241a('0x8e')](/<(.*?)>/);return _0x1c6ba8?_0x1c6ba8[0x1]:_0x335a05;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 93c7674..06ad4c9 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 _0xf435=['reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queuepause'];(function(_0x383200,_0x55917e){var _0x36592f=function(_0x4005b1){while(--_0x4005b1){_0x383200['push'](_0x383200['shift']());}};_0x36592f(++_0x55917e);}(_0xf435,0x174));var _0x5f43=function(_0xbe6b81,_0x540325){_0xbe6b81=_0xbe6b81-0x0;var _0x5ad7e1=_0xf435[_0xbe6b81];return _0x5ad7e1;};'use strict';exports['queueadd']={'queue':{'type':_0x5f43('0x0'),'required':!![]},'interface':{'type':_0x5f43('0x0'),'required':!![]},'membername':{'type':_0x5f43('0x0'),'required':!![]},'penalty':{'type':_0x5f43('0x1'),'required':![]},'paused':{'type':_0x5f43('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x5f43('0x0'),'required':!![]},'interface':{'type':_0x5f43('0x0'),'required':!![]}};exports[_0x5f43('0x3')]={'interface':{'type':_0x5f43('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x5f43('0x0'),'required':![]}};exports[_0x5f43('0x4')]={'module':{'type':_0x5f43('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x5f43('0x0'),'required':!![]}};exports[_0x5f43('0x5')]={'uniqueid':{'type':_0x5f43('0x0'),'required':!![]},'filename':{'type':_0x5f43('0x0')},'format':{'type':_0x5f43('0x0')},'mixmonitorid':{'type':_0x5f43('0x0')}};exports[_0x5f43('0x6')]={'uniqueid':{'type':_0x5f43('0x0'),'required':!![]}};exports[_0x5f43('0x7')]={'uniqueid':{'type':_0x5f43('0x0'),'required':!![]},'exten':{'type':_0x5f43('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x0202=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload'];(function(_0x52863c,_0x157826){var _0x135a3e=function(_0x4dcd43){while(--_0x4dcd43){_0x52863c['push'](_0x52863c['shift']());}};_0x135a3e(++_0x157826);}(_0x0202,0x157));var _0x2020=function(_0x55bee1,_0x56468c){_0x55bee1=_0x55bee1-0x0;var _0x566475=_0x0202[_0x55bee1];return _0x566475;};'use strict';exports[_0x2020('0x0')]={'queue':{'type':_0x2020('0x1'),'required':!![]},'interface':{'type':_0x2020('0x1'),'required':!![]},'membername':{'type':_0x2020('0x1'),'required':!![]},'penalty':{'type':_0x2020('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x2020('0x3')]={'queue':{'type':_0x2020('0x1'),'required':!![]},'interface':{'type':_0x2020('0x1'),'required':!![]}};exports[_0x2020('0x4')]={'interface':{'type':_0x2020('0x1'),'required':!![]},'paused':{'type':_0x2020('0x5')},'reason':{'type':_0x2020('0x1'),'required':![]}};exports[_0x2020('0x6')]={'module':{'type':_0x2020('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0x2020('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x2020('0x1')},'format':{'type':_0x2020('0x1')},'mixmonitorid':{'type':_0x2020('0x1')}};exports[_0x2020('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2020('0x9')]={'uniqueid':{'type':_0x2020('0x1'),'required':!![]},'exten':{'type':_0x2020('0x1'),'required':!![]},'context':{'type':_0x2020('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0f29130..551e342 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 _0xe5ad=['faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','diff','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts'];(function(_0x179d19,_0x3f63fc){var _0x1ca47f=function(_0x42ef71){while(--_0x42ef71){_0x179d19['push'](_0x179d19['shift']());}};_0x1ca47f(++_0x3f63fc);}(_0xe5ad,0x1a3));var _0xde5a=function(_0x19672a,_0x1f8c20){_0x19672a=_0x19672a-0x0;var _0x480491=_0xe5ad[_0x19672a];return _0x480491;};'use strict';var BPromise=require(_0xde5a('0x0'));var util=require('util');var _=require(_0xde5a('0x1'));var moment=require(_0xde5a('0x2'));var Agent=require(_0xde5a('0x3'));var Telephone=require(_0xde5a('0x4'));var Trunk=require(_0xde5a('0x5'));var VoiceQueue=require(_0xde5a('0x6'));var Trigger=require(_0xde5a('0x7'));var Template=require('../model/template');var Campaign=require(_0xde5a('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xde5a('0x9'));var SalesforceAccount=require(_0xde5a('0xa'));var FreshdeskAccount=require(_0xde5a('0xb'));var SugarcrmAccount=require(_0xde5a('0xc'));var ZohoAccount=require(_0xde5a('0xd'));var DeskAccount=require(_0xde5a('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xde5a('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xde5a('0x10'));var FaxAccount=require(_0xde5a('0x11'));var Realtime=function(){this[_0xde5a('0x12')]={};this[_0xde5a('0x13')]={};this[_0xde5a('0x14')]={};this[_0xde5a('0x15')]={};this['triggers']={};this[_0xde5a('0x16')]={};this[_0xde5a('0x17')]={};this[_0xde5a('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xde5a('0x19')]={};this[_0xde5a('0x1a')]={};this['queueChannels']={};this[_0xde5a('0x1b')]={};this[_0xde5a('0x1c')]={};this['settings']={};this[_0xde5a('0x1d')]={};this[_0xde5a('0x1e')]={};this['sugarcrmAccounts']={};this[_0xde5a('0x1f')]={};this['zohoAccounts']={};this[_0xde5a('0x20')]={};this[_0xde5a('0x21')]={};this[_0xde5a('0x22')]={};this[_0xde5a('0x23')]={};this[_0xde5a('0x24')]={};this[_0xde5a('0x25')]={};};function freeIsNotKey(_0x359fe3,_0x285cc9,_0x4ecfab){var _0x5539bd=_[_0xde5a('0x26')](_0x359fe3,function(_0x12574d,_0x53d8dc){return _0x12574d[_0x4ecfab];});for(var _0x3c269a in _0x285cc9){if(_0x285cc9[_0xde5a('0x27')](_0x3c269a)){if(!_0x5539bd[_0x3c269a]){delete _0x285cc9[_0x3c269a];}}}}function freeIsNotKeySip(_0x356fac,_0x420fe6){var _0x45c993=_['mapKeys'](_0x356fac,function(_0x2f3f42,_0xa2cfa5){return util[_0xde5a('0x28')](_0xde5a('0x29'),_0x2f3f42[_0xde5a('0x2a')]);});for(var _0x5b3a72 in _0x420fe6){if(_0x420fe6[_0xde5a('0x27')](_0x5b3a72)){if(!_0x45c993[_0x5b3a72]){delete _0x420fe6[_0x5b3a72];}}}}function freeIsNotKeyAgent(_0x35a0d4,_0x418d8d){var _0x23db30=_[_0xde5a('0x26')](_0x35a0d4,function(_0x143760,_0xefc9cb){var _0x1624b3=_[_0xde5a('0x2b')](_0x143760[_0xde5a('0x2c')])?util[_0xde5a('0x28')]('SIP/%s',_0x143760[_0xde5a('0x2a')]):_0x143760[_0xde5a('0x2c')];return _0x1624b3;});for(var _0x305426 in _0x418d8d){if(_0x418d8d['hasOwnProperty'](_0x305426)){if(!_0x23db30[_0x305426]){delete _0x418d8d[_0x305426];}}}}function clearVoiceCallReports(_0x4c6547){_0x4c6547[_0xde5a('0x2d')]=0x0;_0x4c6547[_0xde5a('0x2e')]=0x0;_0x4c6547[_0xde5a('0x2f')]=0x0;_0x4c6547[_0xde5a('0x30')]=0x0;_0x4c6547[_0xde5a('0x31')]=0x0;}function clearCampaigns(_0x1ed49f){if(!_[_0xde5a('0x32')](_0x1ed49f)){for(var _0x40a5a2 in _0x1ed49f){if(_0x1ed49f[_0xde5a('0x27')](_0x40a5a2)){_0x1ed49f[_0x40a5a2][_0xde5a('0x33')]=0x0;_0x1ed49f[_0x40a5a2][_0xde5a('0x34')]=0x0;}}}}function clearVoiceQueues(_0x5a69f5){if(!_[_0xde5a('0x32')](_0x5a69f5)){for(var _0x349777 in _0x5a69f5){if(_0x5a69f5['hasOwnProperty'](_0x349777)){_0x5a69f5[_0x349777][_0xde5a('0x2d')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x2e')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x35')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x36')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x2f')]=0x0;_0x5a69f5[_0x349777]['sumDuration']=0x0;_0x5a69f5[_0x349777][_0xde5a('0x31')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x37')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x38')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x39')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x3a')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x3b')]=0x0;_0x5a69f5[_0x349777]['outboundUnknownCallsDay']=0x0;_0x5a69f5[_0x349777][_0xde5a('0x3c')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x3d')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x3e')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x3f')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x40')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x41')]=0x0;_0x5a69f5[_0x349777]['outboundAnswerAgiCallsDay']=0x0;_0x5a69f5[_0x349777][_0xde5a('0x42')]=0x0;_0x5a69f5[_0x349777][_0xde5a('0x43')]=!![];}}}}Realtime['prototype'][_0xde5a('0x44')]=function(_0x178d02,_0x715478){for(var _0x45b492 in _0x715478){if(_0x178d02['hasOwnProperty'](_0x45b492)){_0x178d02[_0x45b492]=_0x715478[_0x45b492];}}};Realtime[_0xde5a('0x45')][_0xde5a('0x46')]=function(){var _0x46b777=this;return function(_0x714bda){if(_0x714bda){freeIsNotKeyAgent(_0x714bda,_0x46b777['agents']);for(var _0x43a31e=0x0,_0x5865f4={},_0x4b3417={};_0x43a31e<_0x714bda[_0xde5a('0x47')];_0x43a31e+=0x1){_0x5865f4=_0x714bda[_0x43a31e];var _0x31b1a8=_[_0xde5a('0x2b')](_0x5865f4[_0xde5a('0x2c')])?util[_0xde5a('0x28')](_0xde5a('0x29'),_0x5865f4[_0xde5a('0x2a')]):_0x5865f4[_0xde5a('0x2c')];if(_[_0xde5a('0x48')](_0x46b777[_0xde5a('0x12')][_0x31b1a8])){_0x46b777[_0xde5a('0x12')][_0x31b1a8]=new Agent(_0x5865f4);}else{_0x46b777[_0xde5a('0x44')](_0x46b777['agents'][_0x31b1a8],_0x5865f4);}}}return _0x46b777[_0xde5a('0x12')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x49')]=function(){var _0x5c95b2=this;return function(_0x10f8b7){if(_0x10f8b7){freeIsNotKeySip(_0x10f8b7,_0x5c95b2[_0xde5a('0x13')]);for(var _0x5495fb=0x0,_0x196db7={},_0x486ead={};_0x5495fb<_0x10f8b7[_0xde5a('0x47')];_0x5495fb+=0x1){_0x196db7=_0x10f8b7[_0x5495fb];if(_[_0xde5a('0x48')](_0x5c95b2[_0xde5a('0x13')][util[_0xde5a('0x28')](_0xde5a('0x29'),_0x196db7[_0xde5a('0x2a')])])){_0x5c95b2[_0xde5a('0x13')][util[_0xde5a('0x28')](_0xde5a('0x29'),_0x196db7[_0xde5a('0x2a')])]=new Telephone(_0x196db7);}else{_0x5c95b2[_0xde5a('0x44')](_0x5c95b2[_0xde5a('0x13')][util['format'](_0xde5a('0x29'),_0x196db7[_0xde5a('0x2a')])],_0x196db7);}}}return _0x5c95b2[_0xde5a('0x13')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x4a')]=function(){var _0x5d8820=this;return function(_0x49934d){if(_0x49934d){freeIsNotKeySip(_0x49934d,_0x5d8820['trunks']);for(var _0x5412a7=0x0,_0x2e3536={},_0x25a018={};_0x5412a7<_0x49934d[_0xde5a('0x47')];_0x5412a7+=0x1){_0x2e3536=_0x49934d[_0x5412a7];if(_['isUndefined'](_0x5d8820[_0xde5a('0x14')][util['format'](_0xde5a('0x29'),_0x2e3536[_0xde5a('0x2a')])])){_0x5d8820[_0xde5a('0x14')][util[_0xde5a('0x28')](_0xde5a('0x29'),_0x2e3536[_0xde5a('0x2a')])]=new Trunk(_0x2e3536);}else{_0x5d8820[_0xde5a('0x44')](_0x5d8820['trunks'][util['format'](_0xde5a('0x29'),_0x2e3536['name'])],_0x2e3536);}}}return _0x5d8820['trunks'];};};Realtime[_0xde5a('0x45')][_0xde5a('0x4b')]=function(){var _0x48d500=this;return function(_0x1298aa){if(_0x1298aa){freeIsNotKey(_0x1298aa,_0x48d500[_0xde5a('0x15')],'name');for(var _0x4b5719=0x0,_0x128864={},_0x22bf1b={};_0x4b5719<_0x1298aa[_0xde5a('0x47')];_0x4b5719+=0x1){_0x128864=_0x1298aa[_0x4b5719];if(_[_0xde5a('0x48')](_0x48d500[_0xde5a('0x15')][_0x128864[_0xde5a('0x2a')]])){_0x48d500[_0xde5a('0x15')][_0x128864[_0xde5a('0x2a')]]=new VoiceQueue(_0x128864);}else{_0x48d500['mergeFromDatabase'](_0x48d500[_0xde5a('0x15')][_0x128864['name']],_0x128864);}}}return _0x48d500['voiceQueues'];};};Realtime[_0xde5a('0x45')][_0xde5a('0x4c')]=function(){var _0x485293=this;return function(_0x54b824){if(_0x54b824){freeIsNotKey(_0x54b824,_0x485293['triggers'],'id');for(var _0x677dd2=0x0,_0x30e31a={},_0x3df85b={};_0x677dd2<_0x54b824['length'];_0x677dd2+=0x1){_0x30e31a=_0x54b824[_0x677dd2];if(_[_0xde5a('0x48')](_0x485293[_0xde5a('0x4d')][_0x30e31a['id']])){_0x485293[_0xde5a('0x4d')][_0x30e31a['id']]=new Trigger(_0x30e31a);}else{_0x485293[_0xde5a('0x44')](_0x485293[_0xde5a('0x4d')][_0x30e31a['id']],_0x30e31a);}}}return _0x485293['triggers'];};};Realtime[_0xde5a('0x45')][_0xde5a('0x4e')]=function(){var _0x185934=this;return function(_0x21392d){if(_0x21392d){freeIsNotKey(_0x21392d,_0x185934[_0xde5a('0x17')],'id');for(var _0x5c32f1=0x0,_0x2b97d3={},_0xc8a515={};_0x5c32f1<_0x21392d[_0xde5a('0x47')];_0x5c32f1+=0x1){_0x2b97d3=_0x21392d[_0x5c32f1];if(_[_0xde5a('0x48')](_0x185934[_0xde5a('0x17')][_0x2b97d3['id']])){_0x185934[_0xde5a('0x17')][_0x2b97d3['id']]=new Template(_0x2b97d3);}else{_0x185934[_0xde5a('0x44')](_0x185934[_0xde5a('0x17')][_0x2b97d3['id']],_0x2b97d3);}}}return _0x185934[_0xde5a('0x17')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x4f')]=function(){var _0x343068=this;return function(_0xaa5257){if(_0xaa5257){freeIsNotKey(_0xaa5257,_0x343068['zendeskAccounts'],'id');for(var _0x3dbd92=0x0,_0x2ddb60={},_0x292382={};_0x3dbd92<_0xaa5257[_0xde5a('0x47')];_0x3dbd92+=0x1){_0x2ddb60=_0xaa5257[_0x3dbd92];if(_[_0xde5a('0x48')](_0x343068[_0xde5a('0x1d')][_0x2ddb60['id']])){_0x343068[_0xde5a('0x1d')][_0x2ddb60['id']]=new ZendeskAccount(_0x2ddb60);}else{_0x343068[_0xde5a('0x44')](_0x343068[_0xde5a('0x1d')][_0x2ddb60['id']],_0x2ddb60);}}}return _0x343068['zendeskAccounts'];};};Realtime[_0xde5a('0x45')][_0xde5a('0x50')]=function(){var _0x159013=this;return function(_0x21fb71){if(_0x21fb71){freeIsNotKey(_0x21fb71,_0x159013[_0xde5a('0x1e')],'id');for(var _0xead43f=0x0,_0x5bb73b={},_0x3b9099={};_0xead43f<_0x21fb71[_0xde5a('0x47')];_0xead43f+=0x1){_0x5bb73b=_0x21fb71[_0xead43f];if(_['isUndefined'](_0x159013[_0xde5a('0x1e')][_0x5bb73b['id']])){_0x159013[_0xde5a('0x1e')][_0x5bb73b['id']]=new SalesforceAccount(_0x5bb73b);}else{_0x159013[_0xde5a('0x44')](_0x159013[_0xde5a('0x1e')][_0x5bb73b['id']],_0x5bb73b);}}}return _0x159013['salesforceAccounts'];};};Realtime[_0xde5a('0x45')]['initFreshdeskAccounts']=function(){var _0xa237fc=this;return function(_0xffee3f){if(_0xffee3f){freeIsNotKey(_0xffee3f,_0xa237fc[_0xde5a('0x1f')],'id');for(var _0x4b1071=0x0,_0x585f9f={},_0x259ef2={};_0x4b1071<_0xffee3f[_0xde5a('0x47')];_0x4b1071+=0x1){_0x585f9f=_0xffee3f[_0x4b1071];if(_['isUndefined'](_0xa237fc[_0xde5a('0x1f')][_0x585f9f['id']])){_0xa237fc[_0xde5a('0x1f')][_0x585f9f['id']]=new FreshdeskAccount(_0x585f9f);}else{_0xa237fc[_0xde5a('0x44')](_0xa237fc[_0xde5a('0x1f')][_0x585f9f['id']],_0x585f9f);}}}return _0xa237fc[_0xde5a('0x1f')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x4c6dd2=this;return function(_0x460971){if(_0x460971){freeIsNotKey(_0x460971,_0x4c6dd2['zohoAccounts'],'id');for(var _0x3e6ced=0x0,_0x5ce65b={},_0x12799f={};_0x3e6ced<_0x460971[_0xde5a('0x47')];_0x3e6ced+=0x1){_0x5ce65b=_0x460971[_0x3e6ced];if(_[_0xde5a('0x48')](_0x4c6dd2[_0xde5a('0x51')][_0x5ce65b['id']])){_0x4c6dd2['zohoAccounts'][_0x5ce65b['id']]=new ZohoAccount(_0x5ce65b);}else{_0x4c6dd2[_0xde5a('0x44')](_0x4c6dd2[_0xde5a('0x51')][_0x5ce65b['id']],_0x5ce65b);}}}return _0x4c6dd2[_0xde5a('0x51')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x52')]=function(){var _0x45ef5f=this;return function(_0x4c8baa){if(_0x4c8baa){freeIsNotKey(_0x4c8baa,_0x45ef5f['deskAccounts'],'id');for(var _0x238a81=0x0,_0x272933={},_0x3d690a={};_0x238a81<_0x4c8baa['length'];_0x238a81+=0x1){_0x272933=_0x4c8baa[_0x238a81];if(_[_0xde5a('0x48')](_0x45ef5f[_0xde5a('0x20')][_0x272933['id']])){_0x45ef5f[_0xde5a('0x20')][_0x272933['id']]=new DeskAccount(_0x272933);}else{_0x45ef5f[_0xde5a('0x44')](_0x45ef5f['deskAccounts'][_0x272933['id']],_0x272933);}}}return _0x45ef5f[_0xde5a('0x20')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x53')]=function(){var _0x407ee7=this;return function(_0x3fc7ad){if(_0x3fc7ad){freeIsNotKey(_0x3fc7ad,_0x407ee7[_0xde5a('0x54')],'id');for(var _0x15d572=0x0,_0x56dc50={},_0x4514e4={};_0x15d572<_0x3fc7ad[_0xde5a('0x47')];_0x15d572+=0x1){_0x56dc50=_0x3fc7ad[_0x15d572];if(_['isUndefined'](_0x407ee7['sugarcrmAccounts'][_0x56dc50['id']])){_0x407ee7[_0xde5a('0x54')][_0x56dc50['id']]=new SugarcrmAccount(_0x56dc50);}else{_0x407ee7[_0xde5a('0x44')](_0x407ee7[_0xde5a('0x54')][_0x56dc50['id']],_0x56dc50);}}}return _0x407ee7['sugarcrmAccounts'];};};Realtime[_0xde5a('0x45')][_0xde5a('0x55')]=function(){var _0x1301c8=this;return function(_0x25903e){if(_0x25903e){freeIsNotKey(_0x25903e,_0x1301c8[_0xde5a('0x21')],'id');for(var _0x582663=0x0,_0x42cb15={},_0x16d869={};_0x582663<_0x25903e[_0xde5a('0x47')];_0x582663+=0x1){_0x42cb15=_0x25903e[_0x582663];if(_[_0xde5a('0x48')](_0x1301c8[_0xde5a('0x21')][_0x42cb15['id']])){_0x1301c8[_0xde5a('0x21')][_0x42cb15['id']]=new VtigerAccount(_0x42cb15);}else{_0x1301c8[_0xde5a('0x44')](_0x1301c8[_0xde5a('0x21')][_0x42cb15['id']],_0x42cb15);}}}return _0x1301c8[_0xde5a('0x21')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x56')]=function(){var _0x4e0829=this;return function(_0x2f5820){if(_0x2f5820){freeIsNotKey(_0x2f5820,_0x4e0829[_0xde5a('0x22')],'id');for(var _0x403a2e=0x0,_0x3fb784={},_0x3e8f3c={};_0x403a2e<_0x2f5820[_0xde5a('0x47')];_0x403a2e+=0x1){_0x3fb784=_0x2f5820[_0x403a2e];if(_[_0xde5a('0x48')](_0x4e0829[_0xde5a('0x22')][_0x3fb784['id']])){_0x4e0829['servicenowAccounts'][_0x3fb784['id']]=new ServicenowAccount(_0x3fb784);}else{_0x4e0829[_0xde5a('0x44')](_0x4e0829['servicenowAccounts'][_0x3fb784['id']],_0x3fb784);}}}return _0x4e0829[_0xde5a('0x22')];};};Realtime['prototype'][_0xde5a('0x57')]=function(){var _0x3fc861=this;return function(_0x48573e){if(_0x48573e){freeIsNotKey(_0x48573e,_0x3fc861[_0xde5a('0x23')],'id');for(var _0x2cf576=0x0,_0x37ec9d={},_0x55ced0={};_0x2cf576<_0x48573e['length'];_0x2cf576+=0x1){_0x37ec9d=_0x48573e[_0x2cf576];if(_[_0xde5a('0x48')](_0x3fc861[_0xde5a('0x23')][_0x37ec9d['id']])){_0x3fc861[_0xde5a('0x23')][_0x37ec9d['id']]=new Dynamics365Account(_0x37ec9d);}else{_0x3fc861[_0xde5a('0x44')](_0x3fc861[_0xde5a('0x23')][_0x37ec9d['id']],_0x37ec9d);}}}return _0x3fc861[_0xde5a('0x23')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x58')]=function(){var _0x103960=this;return function(_0x422e69){if(_0x422e69){freeIsNotKey(_0x422e69,_0x103960[_0xde5a('0x24')],'id');for(var _0xadeedc=0x0,_0x2c4f29={},_0x3fd846={};_0xadeedc<_0x422e69[_0xde5a('0x47')];_0xadeedc+=0x1){_0x2c4f29=_0x422e69[_0xadeedc];if(_[_0xde5a('0x48')](_0x103960[_0xde5a('0x24')][_0x2c4f29['id']])){_0x103960[_0xde5a('0x24')][_0x2c4f29['id']]=new FreshsalesAccount(_0x2c4f29);}else{_0x103960[_0xde5a('0x44')](_0x103960['freshsalesAccounts'][_0x2c4f29['id']],_0x2c4f29);}}}return _0x103960[_0xde5a('0x24')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x59')]=function(){var _0x1e2ab9=this;return function(_0x29fb05){for(var _0x256072=0x0;_0x256072<_0x29fb05['length'];_0x256072+=0x1){_[_0xde5a('0x5a')](_0x1e2ab9[_0xde5a('0x15')][_0x29fb05[_0x256072][_0xde5a('0x2a')]],_0x29fb05[_0x256072]);}return _0x1e2ab9[_0xde5a('0x15')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x5b')]=function(){var _0x3044d9=this;return function(_0x1ce5f1){clearVoiceQueues(_0x3044d9[_0xde5a('0x15')]);if(_0x1ce5f1){_0x1ce5f1=_[_0xde5a('0x5c')](_0x1ce5f1,_0xde5a('0x5d'));for(var _0x19d62c in _0x1ce5f1){if(_0x1ce5f1[_0xde5a('0x27')](_0x19d62c)){var _0x4e2c5c={};for(var _0x36ea86=0x0;_0x36ea86<_0x1ce5f1[_0x19d62c]['length'];_0x36ea86+=0x1){var _0x331b12=_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x5e')];if(_0x3044d9[_0xde5a('0x15')][_0x331b12]){if(_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x5f')]){_0x3044d9[_0xde5a('0x15')][_0x331b12][_0xde5a('0x35')]+=0x1;}if(_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x60')]){_0x3044d9[_0xde5a('0x15')][_0x331b12][_0xde5a('0x36')]+=0x1;}_0x3044d9[_0xde5a('0x15')][_0x331b12]['sumHoldTime']+=moment(_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x61')])['diff'](moment(_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x62')]),_0xde5a('0x63'))||0x0;if(_0x36ea86===_0x1ce5f1[_0x19d62c][_0xde5a('0x47')]-0x1){_0x3044d9[_0xde5a('0x15')][_0x331b12][_0xde5a('0x30')]+=moment(_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x64')]||_0x1ce5f1[_0x19d62c][_0x36ea86]['queuecallerabandonAt']||_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x65')])[_0xde5a('0x66')](moment(_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x62')]),_0xde5a('0x63'))||0x0;_0x3044d9[_0xde5a('0x15')][_0x331b12]['total']+=0x1;if(_0x1ce5f1[_0x19d62c][_0x36ea86]['queuecallercomplete']){_0x3044d9[_0xde5a('0x15')][_0x331b12][_0xde5a('0x2e')]+=0x1;_0x3044d9[_0xde5a('0x15')][_0x331b12][_0xde5a('0x31')]+=moment(_0x1ce5f1[_0x19d62c][_0x36ea86][_0xde5a('0x64')])['diff'](moment(_0x1ce5f1[_0x19d62c][_0x36ea86]['queuecallerleaveAt']),_0xde5a('0x63'))||0x0;}}else{_0x3044d9[_0xde5a('0x15')][_0x331b12][_0xde5a('0x30')]+=_0x3044d9[_0xde5a('0x15')][_0x331b12][_0xde5a('0x2f')]||0x0;}}}}}}return _0x3044d9[_0xde5a('0x15')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x67')]=function(){var _0x3e76cf=this;return function(_0xe0cab8){clearVoiceCallReports(_0x3e76cf[_0xde5a('0x18')]);if(_0xe0cab8){for(var _0x3f7198=0x0;_0x3f7198<_0xe0cab8[_0xde5a('0x47')];_0x3f7198+=0x1){_0x3e76cf[_0xde5a('0x18')]['total']+=0x1;_0x3e76cf[_0xde5a('0x18')][_0xde5a('0x30')]+=_0xe0cab8[_0x3f7198]['duration'];if(_0xe0cab8[_0x3f7198][_0xde5a('0x68')]===_0xde5a('0x69')){_0x3e76cf[_0xde5a('0x18')][_0xde5a('0x2e')]+=0x1;_0x3e76cf['outbound'][_0xde5a('0x2f')]+=_0xe0cab8[_0x3f7198][_0xde5a('0x6a')]-_0xe0cab8[_0x3f7198][_0xde5a('0x6b')]||0x0;_0x3e76cf[_0xde5a('0x18')][_0xde5a('0x31')]+=_0xe0cab8[_0x3f7198][_0xde5a('0x6b')];}}}return _0x3e76cf[_0xde5a('0x18')];};};Realtime['prototype'][_0xde5a('0x6c')]=function(){var _0x2eda7c=this;return function(_0xca5738){if(_0xca5738){freeIsNotKey(_0xca5738,_0x2eda7c[_0xde5a('0x16')],_0xde5a('0x2a'));for(var _0x34d174=0x0,_0x14bd0a={};_0x34d174<_0xca5738[_0xde5a('0x47')];_0x34d174+=0x1){_0x14bd0a=_0xca5738[_0x34d174];if(_[_0xde5a('0x48')](_0x2eda7c[_0xde5a('0x16')][_0x14bd0a[_0xde5a('0x2a')]])){_0x2eda7c[_0xde5a('0x16')][_0x14bd0a[_0xde5a('0x2a')]]=new Campaign(_0x14bd0a);}else{_0x2eda7c[_0xde5a('0x44')](_0x2eda7c[_0xde5a('0x16')][_0x14bd0a[_0xde5a('0x2a')]],_0x14bd0a);_0x2eda7c[_0xde5a('0x16')][_0x14bd0a[_0xde5a('0x2a')]][_0xde5a('0x6d')]=_0x14bd0a[_0xde5a('0x6e')]?_0x14bd0a[_0xde5a('0x6e')]['name']:undefined;}}}return _0x2eda7c[_0xde5a('0x16')];};};Realtime[_0xde5a('0x45')][_0xde5a('0x6f')]=function(){var _0x3ad427=this;return function(_0x265ab1){if(_0x265ab1){freeIsNotKey(_0x265ab1,_0x3ad427[_0xde5a('0x19')],'id');for(var _0x37a7c1=0x0,_0x6412a4={};_0x37a7c1<_0x265ab1[_0xde5a('0x47')];_0x37a7c1+=0x1){_0x6412a4=_0x265ab1[_0x37a7c1];if(_[_0xde5a('0x48')](_0x3ad427[_0xde5a('0x19')][_0x6412a4['id']])){_0x3ad427[_0xde5a('0x19')][_0x6412a4['id']]=new VoiceExtension(_0x6412a4);}else{_0x3ad427[_0xde5a('0x44')](_0x3ad427[_0xde5a('0x19')][_0x6412a4['id']],_0x6412a4);}}}return _0x3ad427[_0xde5a('0x19')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x341168=this;return function(_0x5d24a6){clearCampaigns(_0x341168[_0xde5a('0x16')]);for(var _0x5cb411=0x0;_0x5cb411<_0x5d24a6[_0xde5a('0x47')];_0x5cb411+=0x1){_[_0xde5a('0x5a')](_0x341168[_0xde5a('0x16')][_0x5d24a6[_0x5cb411][_0xde5a('0x2a')]],_0x5d24a6[_0x5cb411]);}return _0x341168[_0xde5a('0x16')];};};Realtime['prototype'][_0xde5a('0x70')]=function(){var _0x5a4b61=this;return function(_0x43cc68){if(_0x43cc68){freeIsNotKey(_0x43cc68,_0x5a4b61[_0xde5a('0x25')],'id');for(var _0x269f2b=0x0,_0x2a1f69={},_0xf83624={};_0x269f2b<_0x43cc68['length'];_0x269f2b+=0x1){_0x2a1f69=_0x43cc68[_0x269f2b];if(_[_0xde5a('0x48')](_0x5a4b61[_0xde5a('0x25')][_0x2a1f69['id']])){_0x5a4b61[_0xde5a('0x25')][_0x2a1f69['id']]=new FaxAccount(_0x2a1f69);}else{_0x5a4b61[_0xde5a('0x44')](_0x5a4b61[_0xde5a('0x25')][_0x2a1f69['id']],_0x2a1f69);}}}return _0x5a4b61[_0xde5a('0x25')];};};module[_0xde5a('0x71')]=Realtime; \ No newline at end of file +var _0x8ec3=['queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','bluebird','util','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','unmanaged','queuecallerabandon','abandoned'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8ec3,0xe9));var _0x38ec=function(_0x9fcfba,_0x42d159){_0x9fcfba=_0x9fcfba-0x0;var _0x1595ee=_0x8ec3[_0x9fcfba];return _0x1595ee;};'use strict';var BPromise=require(_0x38ec('0x0'));var util=require(_0x38ec('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x38ec('0x2'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x38ec('0x3'));var Trigger=require(_0x38ec('0x4'));var Template=require(_0x38ec('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x38ec('0x6'));var ZendeskAccount=require(_0x38ec('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x38ec('0x8'));var SugarcrmAccount=require(_0x38ec('0x9'));var ZohoAccount=require(_0x38ec('0xa'));var DeskAccount=require(_0x38ec('0xb'));var VtigerAccount=require(_0x38ec('0xc'));var ServicenowAccount=require(_0x38ec('0xd'));var Dynamics365Account=require(_0x38ec('0xe'));var FreshsalesAccount=require(_0x38ec('0xf'));var FaxAccount=require(_0x38ec('0x10'));var Realtime=function(){this[_0x38ec('0x11')]={};this[_0x38ec('0x12')]={};this[_0x38ec('0x13')]={};this['voiceQueues']={};this[_0x38ec('0x14')]={};this[_0x38ec('0x15')]={};this['templates']={};this[_0x38ec('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x38ec('0x17')]={};this[_0x38ec('0x18')]={};this[_0x38ec('0x19')]={};this[_0x38ec('0x1a')]={};this['timers']={};this['settings']={};this[_0x38ec('0x1b')]={};this[_0x38ec('0x1c')]={};this[_0x38ec('0x1d')]={};this['freshdeskAccounts']={};this[_0x38ec('0x1e')]={};this[_0x38ec('0x1f')]={};this[_0x38ec('0x20')]={};this['servicenowAccounts']={};this[_0x38ec('0x21')]={};this[_0x38ec('0x22')]={};this[_0x38ec('0x23')]={};};function freeIsNotKey(_0x484181,_0x3e05c4,_0x37f694){var _0x4051d2=_[_0x38ec('0x24')](_0x484181,function(_0x4528ac,_0x2710fb){return _0x4528ac[_0x37f694];});for(var _0x267177 in _0x3e05c4){if(_0x3e05c4[_0x38ec('0x25')](_0x267177)){if(!_0x4051d2[_0x267177]){delete _0x3e05c4[_0x267177];}}}}function freeIsNotKeySip(_0xb23ec8,_0x147e68){var _0x1ecb4e=_[_0x38ec('0x24')](_0xb23ec8,function(_0x198494,_0x18c720){return util[_0x38ec('0x26')](_0x38ec('0x27'),_0x198494['name']);});for(var _0x16880f in _0x147e68){if(_0x147e68[_0x38ec('0x25')](_0x16880f)){if(!_0x1ecb4e[_0x16880f]){delete _0x147e68[_0x16880f];}}}}function freeIsNotKeyAgent(_0x2abf92,_0x54cc04){var _0x1de008=_[_0x38ec('0x24')](_0x2abf92,function(_0x11cce6,_0x274294){var _0x26cde3=_['isNil'](_0x11cce6[_0x38ec('0x28')])?util[_0x38ec('0x26')]('SIP/%s',_0x11cce6[_0x38ec('0x29')]):_0x11cce6[_0x38ec('0x28')];return _0x26cde3;});for(var _0x95d044 in _0x54cc04){if(_0x54cc04[_0x38ec('0x25')](_0x95d044)){if(!_0x1de008[_0x95d044]){delete _0x54cc04[_0x95d044];}}}}function clearVoiceCallReports(_0x4a3e52){_0x4a3e52[_0x38ec('0x2a')]=0x0;_0x4a3e52[_0x38ec('0x2b')]=0x0;_0x4a3e52[_0x38ec('0x2c')]=0x0;_0x4a3e52[_0x38ec('0x2d')]=0x0;_0x4a3e52[_0x38ec('0x2e')]=0x0;}function clearCampaigns(_0x36fff2){if(!_['isEmpty'](_0x36fff2)){for(var _0x5eb920 in _0x36fff2){if(_0x36fff2[_0x38ec('0x25')](_0x5eb920)){_0x36fff2[_0x5eb920][_0x38ec('0x2f')]=0x0;_0x36fff2[_0x5eb920]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x1a4220){if(!_['isEmpty'](_0x1a4220)){for(var _0x35c26f in _0x1a4220){if(_0x1a4220[_0x38ec('0x25')](_0x35c26f)){_0x1a4220[_0x35c26f][_0x38ec('0x2a')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x2b')]=0x0;_0x1a4220[_0x35c26f]['unmanaged']=0x0;_0x1a4220[_0x35c26f]['abandoned']=0x0;_0x1a4220[_0x35c26f]['sumHoldTime']=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x2d')]=0x0;_0x1a4220[_0x35c26f]['sumBillable']=0x0;_0x1a4220[_0x35c26f]['outboundAnswerAgiCallsDay']=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x30')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x31')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x32')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x33')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x34')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x35')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x36')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x37')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x38')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x39')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x3a')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x3b')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x3c')]=0x0;_0x1a4220[_0x35c26f][_0x38ec('0x3d')]=!![];}}}}Realtime[_0x38ec('0x3e')][_0x38ec('0x3f')]=function(_0x55e55d,_0xa94b31){for(var _0x21ffd7 in _0xa94b31){if(_0x55e55d[_0x38ec('0x25')](_0x21ffd7)){_0x55e55d[_0x21ffd7]=_0xa94b31[_0x21ffd7];}}};Realtime[_0x38ec('0x3e')][_0x38ec('0x40')]=function(){var _0x482348=this;return function(_0x4d7bd2){if(_0x4d7bd2){freeIsNotKeyAgent(_0x4d7bd2,_0x482348[_0x38ec('0x11')]);for(var _0x320b4e=0x0,_0x2bda0e={},_0x28fae3={};_0x320b4e<_0x4d7bd2['length'];_0x320b4e+=0x1){_0x2bda0e=_0x4d7bd2[_0x320b4e];var _0x340a9b=_['isNil'](_0x2bda0e[_0x38ec('0x28')])?util['format'](_0x38ec('0x27'),_0x2bda0e[_0x38ec('0x29')]):_0x2bda0e['interface'];if(_[_0x38ec('0x41')](_0x482348['agents'][_0x340a9b])){_0x482348[_0x38ec('0x11')][_0x340a9b]=new Agent(_0x2bda0e);}else{_0x482348['mergeFromDatabase'](_0x482348[_0x38ec('0x11')][_0x340a9b],_0x2bda0e);}}}return _0x482348[_0x38ec('0x11')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x42')]=function(){var _0x1fb5c8=this;return function(_0xdc21f6){if(_0xdc21f6){freeIsNotKeySip(_0xdc21f6,_0x1fb5c8[_0x38ec('0x12')]);for(var _0x3b0f1f=0x0,_0x2f51e1={},_0x40d33e={};_0x3b0f1f<_0xdc21f6[_0x38ec('0x43')];_0x3b0f1f+=0x1){_0x2f51e1=_0xdc21f6[_0x3b0f1f];if(_['isUndefined'](_0x1fb5c8[_0x38ec('0x12')][util[_0x38ec('0x26')](_0x38ec('0x27'),_0x2f51e1['name'])])){_0x1fb5c8[_0x38ec('0x12')][util['format'](_0x38ec('0x27'),_0x2f51e1[_0x38ec('0x29')])]=new Telephone(_0x2f51e1);}else{_0x1fb5c8[_0x38ec('0x3f')](_0x1fb5c8['telephones'][util[_0x38ec('0x26')]('SIP/%s',_0x2f51e1[_0x38ec('0x29')])],_0x2f51e1);}}}return _0x1fb5c8[_0x38ec('0x12')];};};Realtime['prototype'][_0x38ec('0x44')]=function(){var _0x2a3456=this;return function(_0x2a5047){if(_0x2a5047){freeIsNotKeySip(_0x2a5047,_0x2a3456[_0x38ec('0x13')]);for(var _0x5437d6=0x0,_0x5d90e7={},_0x47e5f0={};_0x5437d6<_0x2a5047[_0x38ec('0x43')];_0x5437d6+=0x1){_0x5d90e7=_0x2a5047[_0x5437d6];if(_['isUndefined'](_0x2a3456[_0x38ec('0x13')][util[_0x38ec('0x26')]('SIP/%s',_0x5d90e7[_0x38ec('0x29')])])){_0x2a3456['trunks'][util[_0x38ec('0x26')](_0x38ec('0x27'),_0x5d90e7[_0x38ec('0x29')])]=new Trunk(_0x5d90e7);}else{_0x2a3456['mergeFromDatabase'](_0x2a3456[_0x38ec('0x13')][util[_0x38ec('0x26')](_0x38ec('0x27'),_0x5d90e7['name'])],_0x5d90e7);}}}return _0x2a3456['trunks'];};};Realtime['prototype'][_0x38ec('0x45')]=function(){var _0x3a830e=this;return function(_0x514d63){if(_0x514d63){freeIsNotKey(_0x514d63,_0x3a830e[_0x38ec('0x46')],'name');for(var _0x4f418e=0x0,_0x408020={},_0x3ae0dc={};_0x4f418e<_0x514d63[_0x38ec('0x43')];_0x4f418e+=0x1){_0x408020=_0x514d63[_0x4f418e];if(_[_0x38ec('0x41')](_0x3a830e[_0x38ec('0x46')][_0x408020[_0x38ec('0x29')]])){_0x3a830e[_0x38ec('0x46')][_0x408020[_0x38ec('0x29')]]=new VoiceQueue(_0x408020);}else{_0x3a830e[_0x38ec('0x3f')](_0x3a830e[_0x38ec('0x46')][_0x408020['name']],_0x408020);}}}return _0x3a830e['voiceQueues'];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x47')]=function(){var _0x4bf7d4=this;return function(_0x12a77e){if(_0x12a77e){freeIsNotKey(_0x12a77e,_0x4bf7d4[_0x38ec('0x14')],'id');for(var _0x1bc3c2=0x0,_0x3ddf18={},_0x1c84de={};_0x1bc3c2<_0x12a77e['length'];_0x1bc3c2+=0x1){_0x3ddf18=_0x12a77e[_0x1bc3c2];if(_[_0x38ec('0x41')](_0x4bf7d4[_0x38ec('0x14')][_0x3ddf18['id']])){_0x4bf7d4[_0x38ec('0x14')][_0x3ddf18['id']]=new Trigger(_0x3ddf18);}else{_0x4bf7d4[_0x38ec('0x3f')](_0x4bf7d4[_0x38ec('0x14')][_0x3ddf18['id']],_0x3ddf18);}}}return _0x4bf7d4[_0x38ec('0x14')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x48')]=function(){var _0x264568=this;return function(_0x583449){if(_0x583449){freeIsNotKey(_0x583449,_0x264568[_0x38ec('0x49')],'id');for(var _0x28997e=0x0,_0x40df25={},_0x1d42d5={};_0x28997e<_0x583449['length'];_0x28997e+=0x1){_0x40df25=_0x583449[_0x28997e];if(_[_0x38ec('0x41')](_0x264568[_0x38ec('0x49')][_0x40df25['id']])){_0x264568[_0x38ec('0x49')][_0x40df25['id']]=new Template(_0x40df25);}else{_0x264568[_0x38ec('0x3f')](_0x264568['templates'][_0x40df25['id']],_0x40df25);}}}return _0x264568['templates'];};};Realtime['prototype'][_0x38ec('0x4a')]=function(){var _0x1e3ecc=this;return function(_0x18b53e){if(_0x18b53e){freeIsNotKey(_0x18b53e,_0x1e3ecc[_0x38ec('0x1b')],'id');for(var _0xb76b33=0x0,_0x2943cc={},_0x41de7d={};_0xb76b33<_0x18b53e[_0x38ec('0x43')];_0xb76b33+=0x1){_0x2943cc=_0x18b53e[_0xb76b33];if(_[_0x38ec('0x41')](_0x1e3ecc[_0x38ec('0x1b')][_0x2943cc['id']])){_0x1e3ecc[_0x38ec('0x1b')][_0x2943cc['id']]=new ZendeskAccount(_0x2943cc);}else{_0x1e3ecc['mergeFromDatabase'](_0x1e3ecc['zendeskAccounts'][_0x2943cc['id']],_0x2943cc);}}}return _0x1e3ecc[_0x38ec('0x1b')];};};Realtime['prototype'][_0x38ec('0x4b')]=function(){var _0x3cc77a=this;return function(_0x847b30){if(_0x847b30){freeIsNotKey(_0x847b30,_0x3cc77a['salesforceAccounts'],'id');for(var _0x41cb98=0x0,_0x57620c={},_0x12c1a0={};_0x41cb98<_0x847b30[_0x38ec('0x43')];_0x41cb98+=0x1){_0x57620c=_0x847b30[_0x41cb98];if(_['isUndefined'](_0x3cc77a[_0x38ec('0x1c')][_0x57620c['id']])){_0x3cc77a['salesforceAccounts'][_0x57620c['id']]=new SalesforceAccount(_0x57620c);}else{_0x3cc77a['mergeFromDatabase'](_0x3cc77a[_0x38ec('0x1c')][_0x57620c['id']],_0x57620c);}}}return _0x3cc77a[_0x38ec('0x1c')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x4c')]=function(){var _0x14017f=this;return function(_0x1af252){if(_0x1af252){freeIsNotKey(_0x1af252,_0x14017f[_0x38ec('0x4d')],'id');for(var _0x3d4eec=0x0,_0x35c7c5={},_0x5ac880={};_0x3d4eec<_0x1af252['length'];_0x3d4eec+=0x1){_0x35c7c5=_0x1af252[_0x3d4eec];if(_[_0x38ec('0x41')](_0x14017f['freshdeskAccounts'][_0x35c7c5['id']])){_0x14017f['freshdeskAccounts'][_0x35c7c5['id']]=new FreshdeskAccount(_0x35c7c5);}else{_0x14017f['mergeFromDatabase'](_0x14017f[_0x38ec('0x4d')][_0x35c7c5['id']],_0x35c7c5);}}}return _0x14017f[_0x38ec('0x4d')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x4e')]=function(){var _0x2ea9ca=this;return function(_0x12d2d2){if(_0x12d2d2){freeIsNotKey(_0x12d2d2,_0x2ea9ca[_0x38ec('0x1e')],'id');for(var _0x142e35=0x0,_0x22951b={},_0x5c9abb={};_0x142e35<_0x12d2d2[_0x38ec('0x43')];_0x142e35+=0x1){_0x22951b=_0x12d2d2[_0x142e35];if(_[_0x38ec('0x41')](_0x2ea9ca[_0x38ec('0x1e')][_0x22951b['id']])){_0x2ea9ca[_0x38ec('0x1e')][_0x22951b['id']]=new ZohoAccount(_0x22951b);}else{_0x2ea9ca['mergeFromDatabase'](_0x2ea9ca[_0x38ec('0x1e')][_0x22951b['id']],_0x22951b);}}}return _0x2ea9ca[_0x38ec('0x1e')];};};Realtime[_0x38ec('0x3e')]['initDeskAccounts']=function(){var _0x5ce618=this;return function(_0x2e5534){if(_0x2e5534){freeIsNotKey(_0x2e5534,_0x5ce618[_0x38ec('0x1f')],'id');for(var _0x5ed41b=0x0,_0x44abc3={},_0x58c5b1={};_0x5ed41b<_0x2e5534[_0x38ec('0x43')];_0x5ed41b+=0x1){_0x44abc3=_0x2e5534[_0x5ed41b];if(_[_0x38ec('0x41')](_0x5ce618['deskAccounts'][_0x44abc3['id']])){_0x5ce618['deskAccounts'][_0x44abc3['id']]=new DeskAccount(_0x44abc3);}else{_0x5ce618[_0x38ec('0x3f')](_0x5ce618['deskAccounts'][_0x44abc3['id']],_0x44abc3);}}}return _0x5ce618['deskAccounts'];};};Realtime[_0x38ec('0x3e')]['initSugarcrmAccounts']=function(){var _0x35a114=this;return function(_0x3f380e){if(_0x3f380e){freeIsNotKey(_0x3f380e,_0x35a114[_0x38ec('0x1d')],'id');for(var _0x2ff70a=0x0,_0x18b3cc={},_0x140f17={};_0x2ff70a<_0x3f380e['length'];_0x2ff70a+=0x1){_0x18b3cc=_0x3f380e[_0x2ff70a];if(_[_0x38ec('0x41')](_0x35a114[_0x38ec('0x1d')][_0x18b3cc['id']])){_0x35a114[_0x38ec('0x1d')][_0x18b3cc['id']]=new SugarcrmAccount(_0x18b3cc);}else{_0x35a114['mergeFromDatabase'](_0x35a114[_0x38ec('0x1d')][_0x18b3cc['id']],_0x18b3cc);}}}return _0x35a114[_0x38ec('0x1d')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x41442d=this;return function(_0x125cfa){if(_0x125cfa){freeIsNotKey(_0x125cfa,_0x41442d[_0x38ec('0x20')],'id');for(var _0x4b94f4=0x0,_0x35719c={},_0x2b05d6={};_0x4b94f4<_0x125cfa[_0x38ec('0x43')];_0x4b94f4+=0x1){_0x35719c=_0x125cfa[_0x4b94f4];if(_[_0x38ec('0x41')](_0x41442d[_0x38ec('0x20')][_0x35719c['id']])){_0x41442d['vtigerAccounts'][_0x35719c['id']]=new VtigerAccount(_0x35719c);}else{_0x41442d[_0x38ec('0x3f')](_0x41442d[_0x38ec('0x20')][_0x35719c['id']],_0x35719c);}}}return _0x41442d[_0x38ec('0x20')];};};Realtime['prototype'][_0x38ec('0x4f')]=function(){var _0x11e501=this;return function(_0x4ebb61){if(_0x4ebb61){freeIsNotKey(_0x4ebb61,_0x11e501[_0x38ec('0x50')],'id');for(var _0x28f180=0x0,_0x46a27b={},_0x57379f={};_0x28f180<_0x4ebb61[_0x38ec('0x43')];_0x28f180+=0x1){_0x46a27b=_0x4ebb61[_0x28f180];if(_[_0x38ec('0x41')](_0x11e501[_0x38ec('0x50')][_0x46a27b['id']])){_0x11e501[_0x38ec('0x50')][_0x46a27b['id']]=new ServicenowAccount(_0x46a27b);}else{_0x11e501[_0x38ec('0x3f')](_0x11e501[_0x38ec('0x50')][_0x46a27b['id']],_0x46a27b);}}}return _0x11e501[_0x38ec('0x50')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x51')]=function(){var _0xc12bee=this;return function(_0x4daa47){if(_0x4daa47){freeIsNotKey(_0x4daa47,_0xc12bee['dynamics365Accounts'],'id');for(var _0x8d6526=0x0,_0x5c1eb2={},_0x5776d6={};_0x8d6526<_0x4daa47[_0x38ec('0x43')];_0x8d6526+=0x1){_0x5c1eb2=_0x4daa47[_0x8d6526];if(_[_0x38ec('0x41')](_0xc12bee[_0x38ec('0x21')][_0x5c1eb2['id']])){_0xc12bee[_0x38ec('0x21')][_0x5c1eb2['id']]=new Dynamics365Account(_0x5c1eb2);}else{_0xc12bee[_0x38ec('0x3f')](_0xc12bee[_0x38ec('0x21')][_0x5c1eb2['id']],_0x5c1eb2);}}}return _0xc12bee['dynamics365Accounts'];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x52')]=function(){var _0x5916ec=this;return function(_0x66e1e){if(_0x66e1e){freeIsNotKey(_0x66e1e,_0x5916ec[_0x38ec('0x22')],'id');for(var _0x10c62e=0x0,_0x13ab7b={},_0x199668={};_0x10c62e<_0x66e1e[_0x38ec('0x43')];_0x10c62e+=0x1){_0x13ab7b=_0x66e1e[_0x10c62e];if(_[_0x38ec('0x41')](_0x5916ec[_0x38ec('0x22')][_0x13ab7b['id']])){_0x5916ec[_0x38ec('0x22')][_0x13ab7b['id']]=new FreshsalesAccount(_0x13ab7b);}else{_0x5916ec['mergeFromDatabase'](_0x5916ec[_0x38ec('0x22')][_0x13ab7b['id']],_0x13ab7b);}}}return _0x5916ec[_0x38ec('0x22')];};};Realtime[_0x38ec('0x3e')]['initVoiceQueueHopperHistory']=function(){var _0x1619ae=this;return function(_0x15e493){for(var _0x3c84f7=0x0;_0x3c84f7<_0x15e493[_0x38ec('0x43')];_0x3c84f7+=0x1){_[_0x38ec('0x53')](_0x1619ae[_0x38ec('0x46')][_0x15e493[_0x3c84f7]['name']],_0x15e493[_0x3c84f7]);}return _0x1619ae[_0x38ec('0x46')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x54')]=function(){var _0x4056e8=this;return function(_0x3aa596){clearVoiceQueues(_0x4056e8[_0x38ec('0x46')]);if(_0x3aa596){_0x3aa596=_[_0x38ec('0x55')](_0x3aa596,_0x38ec('0x56'));for(var _0x29378e in _0x3aa596){if(_0x3aa596['hasOwnProperty'](_0x29378e)){var _0x1701e7={};for(var _0x37f2b2=0x0;_0x37f2b2<_0x3aa596[_0x29378e]['length'];_0x37f2b2+=0x1){var _0x549e97=_0x3aa596[_0x29378e][_0x37f2b2]['queue'];if(_0x4056e8[_0x38ec('0x46')][_0x549e97]){if(_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x57')]){_0x4056e8[_0x38ec('0x46')][_0x549e97][_0x38ec('0x58')]+=0x1;}if(_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x59')]){_0x4056e8[_0x38ec('0x46')][_0x549e97][_0x38ec('0x5a')]+=0x1;}_0x4056e8['voiceQueues'][_0x549e97]['sumHoldTime']+=moment(_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x5b')])[_0x38ec('0x5c')](moment(_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x5d')]),'seconds')||0x0;if(_0x37f2b2===_0x3aa596[_0x29378e][_0x38ec('0x43')]-0x1){_0x4056e8[_0x38ec('0x46')][_0x549e97][_0x38ec('0x2d')]+=moment(_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x5e')]||_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x5f')]||_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x60')])[_0x38ec('0x5c')](moment(_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x5d')]),_0x38ec('0x61'))||0x0;_0x4056e8['voiceQueues'][_0x549e97][_0x38ec('0x2a')]+=0x1;if(_0x3aa596[_0x29378e][_0x37f2b2][_0x38ec('0x62')]){_0x4056e8[_0x38ec('0x46')][_0x549e97][_0x38ec('0x2b')]+=0x1;_0x4056e8[_0x38ec('0x46')][_0x549e97][_0x38ec('0x2e')]+=moment(_0x3aa596[_0x29378e][_0x37f2b2]['queuecallercompleteAt'])['diff'](moment(_0x3aa596[_0x29378e][_0x37f2b2]['queuecallerleaveAt']),_0x38ec('0x61'))||0x0;}}else{_0x4056e8[_0x38ec('0x46')][_0x549e97][_0x38ec('0x2d')]+=_0x4056e8[_0x38ec('0x46')][_0x549e97][_0x38ec('0x2c')]||0x0;}}}}}}return _0x4056e8[_0x38ec('0x46')];};};Realtime[_0x38ec('0x3e')]['initVoiceCallReports']=function(){var _0x1ea477=this;return function(_0x16aa95){clearVoiceCallReports(_0x1ea477[_0x38ec('0x16')]);if(_0x16aa95){for(var _0x528119=0x0;_0x528119<_0x16aa95['length'];_0x528119+=0x1){_0x1ea477[_0x38ec('0x16')][_0x38ec('0x2a')]+=0x1;_0x1ea477['outbound'][_0x38ec('0x2d')]+=_0x16aa95[_0x528119][_0x38ec('0x63')];if(_0x16aa95[_0x528119][_0x38ec('0x64')]===_0x38ec('0x65')){_0x1ea477[_0x38ec('0x16')][_0x38ec('0x2b')]+=0x1;_0x1ea477['outbound'][_0x38ec('0x2c')]+=_0x16aa95[_0x528119]['duration']-_0x16aa95[_0x528119][_0x38ec('0x66')]||0x0;_0x1ea477[_0x38ec('0x16')][_0x38ec('0x2e')]+=_0x16aa95[_0x528119]['billableseconds'];}}}return _0x1ea477[_0x38ec('0x16')];};};Realtime['prototype'][_0x38ec('0x67')]=function(){var _0x1d7556=this;return function(_0x1717f0){if(_0x1717f0){freeIsNotKey(_0x1717f0,_0x1d7556[_0x38ec('0x15')],_0x38ec('0x29'));for(var _0xdf1d22=0x0,_0xa1dc83={};_0xdf1d22<_0x1717f0[_0x38ec('0x43')];_0xdf1d22+=0x1){_0xa1dc83=_0x1717f0[_0xdf1d22];if(_['isUndefined'](_0x1d7556['campaigns'][_0xa1dc83[_0x38ec('0x29')]])){_0x1d7556[_0x38ec('0x15')][_0xa1dc83[_0x38ec('0x29')]]=new Campaign(_0xa1dc83);}else{_0x1d7556['mergeFromDatabase'](_0x1d7556[_0x38ec('0x15')][_0xa1dc83[_0x38ec('0x29')]],_0xa1dc83);_0x1d7556[_0x38ec('0x15')][_0xa1dc83['name']][_0x38ec('0x68')]=_0xa1dc83['SquareProject']?_0xa1dc83[_0x38ec('0x69')][_0x38ec('0x29')]:undefined;}}}return _0x1d7556[_0x38ec('0x15')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x6a')]=function(){var _0x41a433=this;return function(_0x10539f){if(_0x10539f){freeIsNotKey(_0x10539f,_0x41a433[_0x38ec('0x17')],'id');for(var _0x38b297=0x0,_0x475460={};_0x38b297<_0x10539f[_0x38ec('0x43')];_0x38b297+=0x1){_0x475460=_0x10539f[_0x38b297];if(_['isUndefined'](_0x41a433[_0x38ec('0x17')][_0x475460['id']])){_0x41a433[_0x38ec('0x17')][_0x475460['id']]=new VoiceExtension(_0x475460);}else{_0x41a433[_0x38ec('0x3f')](_0x41a433[_0x38ec('0x17')][_0x475460['id']],_0x475460);}}}return _0x41a433[_0x38ec('0x17')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x44ad26=this;return function(_0x31ec53){clearCampaigns(_0x44ad26[_0x38ec('0x15')]);for(var _0x4e0237=0x0;_0x4e0237<_0x31ec53['length'];_0x4e0237+=0x1){_[_0x38ec('0x53')](_0x44ad26[_0x38ec('0x15')][_0x31ec53[_0x4e0237]['name']],_0x31ec53[_0x4e0237]);}return _0x44ad26[_0x38ec('0x15')];};};Realtime[_0x38ec('0x3e')][_0x38ec('0x6b')]=function(){var _0x3f7786=this;return function(_0x416840){if(_0x416840){freeIsNotKey(_0x416840,_0x3f7786[_0x38ec('0x23')],'id');for(var _0x23df06=0x0,_0x2c4029={},_0xdeb8e8={};_0x23df06<_0x416840[_0x38ec('0x43')];_0x23df06+=0x1){_0x2c4029=_0x416840[_0x23df06];if(_[_0x38ec('0x41')](_0x3f7786[_0x38ec('0x23')][_0x2c4029['id']])){_0x3f7786[_0x38ec('0x23')][_0x2c4029['id']]=new FaxAccount(_0x2c4029);}else{_0x3f7786[_0x38ec('0x3f')](_0x3f7786[_0x38ec('0x23')][_0x2c4029['id']],_0x2c4029);}}}return _0x3f7786[_0x38ec('0x23')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f2a902a..6b12079 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 _0x36f3=['voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceDialReport','blindtransfer','attendedTransfer','prototype','findAgent','find','name','format','SIP/%s','length','connectedlinenum','accountcode','lastAssignedTo','isNil','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','keys','getCallType','channel','split','getAgentByInternal','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','calleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','blindTransfer','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x36f3,0x122));var _0x336f=function(_0x290bab,_0x42ad9e){_0x290bab=_0x290bab-0x0;var _0x1b9d35=_0x36f3[_0x290bab];return _0x1b9d35;};'use strict';var _=require(_0x336f('0x0'));var moment=require(_0x336f('0x1'));var util=require(_0x336f('0x2'));var config=require('../../../config/environment');var ami=require(_0x336f('0x3'));var RpcVoiceAgentReport=require(_0x336f('0x4'));var RpcVoiceCallReport=require(_0x336f('0x5'));var RpcVoiceDialReport=require(_0x336f('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x336f('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x336f('0x8'));var VoiceQueueReport=require(_0x336f('0x9'));var VoiceCallReport=require(_0x336f('0xa'));var VoiceAgentReport=require(_0x336f('0xb'));var VoiceDialReport=require(_0x336f('0xc'));var UserReport=require(_0x336f('0xd'));function Report(_0x21be54){this[_0x336f('0xe')]=_0x21be54;this[_0x336f('0xf')]=_0x21be54[_0x336f('0xf')];this[_0x336f('0x10')]=_0x21be54[_0x336f('0x10')];}Report['prototype'][_0x336f('0x11')]=function(_0x2bc03b){var _0x489162=new VoiceQueueReport(this[_0x336f('0xe')]);var _0x14bf6c=new VoiceAgentReport(this[_0x336f('0xe')]);var _0x38d4ed=new VoiceDialReport(this['realtime']);var _0x55caf4=new VoiceCallReport(this[_0x336f('0xe')]);var _0x226c28=new UserReport(this[_0x336f('0xe')]);if(config[_0x336f('0x12')]&&config[_0x336f('0x12')][_0x336f('0x13')]){ami['on'](_0x336f('0x14'),this[_0x336f('0x15')][_0x336f('0x16')](this));ami['on'](_0x336f('0x17'),this[_0x336f('0x18')][_0x336f('0x16')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x336f('0x16')](this));ami['on'](_0x336f('0x19'),this['voiceDialReport']['bind'](this));ami['on'](_0x336f('0x1a'),this['blindTransfer'][_0x336f('0x16')](this));ami['on']('attendedtransfer',this[_0x336f('0x1b')]['bind'](this));}};Report[_0x336f('0x1c')][_0x336f('0x1d')]=function(_0x5381d4){var _0x20a9f9;_0x20a9f9=_[_0x336f('0x1e')](this['agents'],function(_0x52cedd){return _0x52cedd['accountcode']==_0x5381d4||_0x52cedd[_0x336f('0x1f')]==_0x5381d4;});if(_['isNil'](_0x20a9f9)){var _0x175366=_[_0x336f('0x1e')](this[_0x336f('0x10')],function(_0x2d7ffe){return _0x2d7ffe['accountcode']==_0x5381d4||_0x2d7ffe[_0x336f('0x1f')]==_0x5381d4;});if(_0x175366){_0x20a9f9=_[_0x336f('0x1e')](this[_0x336f('0xf')],function(_0x17d3ae){return _0x17d3ae['interface']==util[_0x336f('0x20')](_0x336f('0x21'),_0x175366[_0x336f('0x1f')]);});}}return _0x20a9f9;};Report[_0x336f('0x1c')][_0x336f('0x15')]=function(_0x407c9a){for(var _0x17471b=0x0;_0x17471b<_0x407c9a[_0x336f('0x22')];_0x17471b+=0x1){var _0x57eccd=this[_0x336f('0x1d')](_0x407c9a[_0x17471b][_0x336f('0x23')]);if(_0x57eccd){_0x407c9a[_0x17471b][_0x336f('0x24')]=_0x57eccd[_0x336f('0x24')];_0x407c9a[_0x17471b]['assigned']=!![];_0x407c9a[_0x17471b][_0x336f('0x25')]=_0x57eccd[_0x336f('0x1f')];_0x407c9a[_0x17471b]['interface']=_[_0x336f('0x26')](_0x57eccd[_0x336f('0x27')])?util[_0x336f('0x20')](_0x336f('0x21'),_0x57eccd[_0x336f('0x1f')]):_0x57eccd[_0x336f('0x27')];if(_0x407c9a[_0x17471b]['queuecallercomplete']){_0x407c9a[_0x17471b][_0x336f('0x28')]=moment()[_0x336f('0x20')](_0x336f('0x29'));}if(_0x407c9a[_0x17471b][_0x336f('0x2a')]){_0x407c9a[_0x17471b]['queuecallerexitAt']=moment()[_0x336f('0x20')](_0x336f('0x29'));}RpcMemberReport[_0x336f('0x15')](_0x407c9a[_0x17471b]);}RpcVoiceQueueReport[_0x336f('0x2b')](_0x407c9a[_0x17471b]);}};function extractCalleridNumber(_0x51926a){var _0x2b50c2=_0x51926a['match'](/<(.*?)>/);return _0x2b50c2?_0x2b50c2[0x1]:_0x51926a;}Report[_0x336f('0x1c')]['getAgentByInternal']=function(_0x3462b4){for(var _0x221d6a=0x0;_0x221d6a','calleridname','transfers','transfereelinkedid','blindTransfer','linkedid','UserId','split','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','util','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','voiceAgentReport','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt'];(function(_0x5891cc,_0x2efb6d){var _0x2a5468=function(_0x3cc130){while(--_0x3cc130){_0x5891cc['push'](_0x5891cc['shift']());}};_0x2a5468(++_0x2efb6d);}(_0x27c6,0x141));var _0x627c=function(_0x1be158,_0x292c3f){_0x1be158=_0x1be158-0x0;var _0x1f3676=_0x27c6[_0x1be158];return _0x1f3676;};'use strict';var _=require(_0x627c('0x0'));var moment=require('moment');var util=require(_0x627c('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x627c('0x2'));var RpcVoiceDialReport=require(_0x627c('0x3'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x627c('0x4'));var VoiceQueueReport=require(_0x627c('0x5'));var VoiceCallReport=require(_0x627c('0x6'));var VoiceAgentReport=require(_0x627c('0x7'));var VoiceDialReport=require(_0x627c('0x8'));var UserReport=require(_0x627c('0x9'));function Report(_0xff1fbf){this[_0x627c('0xa')]=_0xff1fbf;this[_0x627c('0xb')]=_0xff1fbf[_0x627c('0xb')];this[_0x627c('0xc')]=_0xff1fbf['telephones'];}Report[_0x627c('0xd')][_0x627c('0xe')]=function(_0x1eee31){var _0x3f1423=new VoiceQueueReport(this[_0x627c('0xa')]);var _0x45b67f=new VoiceAgentReport(this['realtime']);var _0xcf8d7d=new VoiceDialReport(this[_0x627c('0xa')]);var _0x1c7e45=new VoiceCallReport(this[_0x627c('0xa')]);var _0x4cff41=new UserReport(this[_0x627c('0xa')]);if(config[_0x627c('0xf')]&&config[_0x627c('0xf')][_0x627c('0x10')]){ami['on'](_0x627c('0x11'),this[_0x627c('0x12')][_0x627c('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x627c('0x14')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x627c('0x15')]['bind'](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x627c('0x13')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x627c('0x13')](this));ami['on'](_0x627c('0x16'),this[_0x627c('0x17')][_0x627c('0x13')](this));}};Report[_0x627c('0xd')]['findAgent']=function(_0x51c733){var _0x1fcacc;_0x1fcacc=_[_0x627c('0x18')](this[_0x627c('0xb')],function(_0x4f7837){return _0x4f7837[_0x627c('0x19')]==_0x51c733||_0x4f7837[_0x627c('0x1a')]==_0x51c733;});if(_[_0x627c('0x1b')](_0x1fcacc)){var _0x669320=_[_0x627c('0x18')](this[_0x627c('0xc')],function(_0x1fed9a){return _0x1fed9a[_0x627c('0x19')]==_0x51c733||_0x1fed9a[_0x627c('0x1a')]==_0x51c733;});if(_0x669320){_0x1fcacc=_['find'](this['agents'],function(_0x242710){return _0x242710[_0x627c('0x1c')]==util[_0x627c('0x1d')](_0x627c('0x1e'),_0x669320[_0x627c('0x1a')]);});}}return _0x1fcacc;};Report[_0x627c('0xd')][_0x627c('0x12')]=function(_0x23c930){for(var _0xe8b752=0x0;_0xe8b752<_0x23c930[_0x627c('0x1f')];_0xe8b752+=0x1){var _0x571b62=this['findAgent'](_0x23c930[_0xe8b752][_0x627c('0x20')]);if(_0x571b62){_0x23c930[_0xe8b752][_0x627c('0x19')]=_0x571b62[_0x627c('0x19')];_0x23c930[_0xe8b752][_0x627c('0x21')]=!![];_0x23c930[_0xe8b752]['lastAssignedTo']=_0x571b62['name'];_0x23c930[_0xe8b752][_0x627c('0x1c')]=_[_0x627c('0x1b')](_0x571b62[_0x627c('0x1c')])?util[_0x627c('0x1d')]('SIP/%s',_0x571b62[_0x627c('0x1a')]):_0x571b62[_0x627c('0x1c')];if(_0x23c930[_0xe8b752][_0x627c('0x22')]){_0x23c930[_0xe8b752][_0x627c('0x23')]=moment()[_0x627c('0x1d')](_0x627c('0x24'));}if(_0x23c930[_0xe8b752][_0x627c('0x25')]){_0x23c930[_0xe8b752][_0x627c('0x26')]=moment()[_0x627c('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x627c('0x12')](_0x23c930[_0xe8b752]);}RpcVoiceQueueReport[_0x627c('0x27')](_0x23c930[_0xe8b752]);}};function extractCalleridNumber(_0x163d55){var _0x4ae367=_0x163d55[_0x627c('0x28')](/<(.*?)>/);return _0x4ae367?_0x4ae367[0x1]:_0x163d55;}Report[_0x627c('0xd')]['getAgentByInternal']=function(_0x2615f7){for(var _0x1ac591=0x0;_0x1ac5910x0?_0x37ac31:0x0;this['voiceQueues'][_0x46a615[_0x4b02('0x68')]]['talking']=this['voiceQueues'][_0x46a615['queue']][_0x4b02('0x72')]>_[_0x4b02('0x6f')](_0x46a615['loggedin'])?_[_0x4b02('0x6f')](_0x46a615[_0x4b02('0x70')]):this[_0x4b02('0x14')][_0x46a615['queue']][_0x4b02('0x72')];this[_0x4b02('0x4e')](this[_0x4b02('0x14')][_0x46a615['queue']],_0x4b02('0x16'));}logger[_0x4b02('0x43')](_0x4b02('0x73'),util[_0x4b02('0x39')](this['voiceQueues'][_0x46a615[_0x4b02('0x68')]],{'showHidden':![],'depth':null}));ami[_0x4b02('0x42')](_0x4b02('0x74'),this[_0x4b02('0x14')][_0x46a615[_0x4b02('0x68')]]);}}}catch(_0x152c04){logger[_0x4b02('0x37')](_0x4b02('0x66'),util[_0x4b02('0x39')](_0x152c04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b02('0xb')][_0x4b02('0x19')]=function(_0x2942d4){logger[_0x4b02('0x43')](_0x4b02('0x75'),util[_0x4b02('0x39')](_0x2942d4,{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummarycomplete',{});this[_0x4b02('0x15')]=!![];};VoiceQueueReport[_0x4b02('0xb')]['syncQueueCallerJoin']=function(_0x47e665){try{if(this['isNotNull'](_0x47e665)){logger[_0x4b02('0x43')](_0x4b02('0x76'),_0x47e665[_0x4b02('0x45')],util['inspect'](_0x47e665,{'showHidden':![],'depth':null}));if(_[_0x4b02('0x77')](this['queueReports'][_0x47e665['uniqueid']]))this['queueReports'][_0x47e665['uniqueid']]=[];if(_[_0x4b02('0x77')](this[_0x4b02('0x12')][_0x47e665[_0x4b02('0x45')]]))this[_0x4b02('0x12')][_0x47e665[_0x4b02('0x45')]]={};var _0x3c5464=new QueueReport();_0x3c5464['name']=_0x47e665[_0x4b02('0x68')];_0x3c5464['type']=this[_0x4b02('0x14')][_0x3c5464[_0x4b02('0x47')]]&&this[_0x4b02('0x14')][_0x3c5464[_0x4b02('0x47')]][_0x4b02('0x56')]?this['voiceQueues'][_0x3c5464[_0x4b02('0x47')]][_0x4b02('0x56')]||_0x4b02('0x4f'):_0x4b02('0x4f');_0x3c5464['queue']=_0x47e665['queue'];_0x3c5464['queuecallerjoinAt']=moment()[_0x4b02('0x46')](_0x4b02('0x78'));_0x3c5464['position']=_0x47e665[_0x4b02('0x79')];_0x3c5464['count']=_0x47e665[_0x4b02('0x7a')];_0x3c5464[_0x4b02('0x45')]=_0x47e665['uniqueid'];_0x3c5464[_0x4b02('0x7b')]=this[_0x4b02('0x12')][_0x47e665[_0x4b02('0x45')]]['routealias'];logger[_0x4b02('0x6a')](_0x4b02('0x7c'),_0x3c5464[_0x4b02('0x47')],_0x3c5464[_0x4b02('0x56')]);_[_0x4b02('0x7d')](_0x3c5464,_['pick'](_0x47e665,_[_0x4b02('0x7e')](_0x3c5464)));this['queueReports'][_0x47e665['uniqueid']][_0x4b02('0x7f')](_0x3c5464);this['channels'][_0x47e665['uniqueid']]=_0x3c5464;this[_0x4b02('0x80')](_0x3c5464,_0x4b02('0x1a'));}}catch(_0x39ea97){logger[_0x4b02('0x37')]('[%s][voiceQueueReport][queuecallerjoin]',_0x47e665[_0x4b02('0x45')],util[_0x4b02('0x39')](_0x39ea97,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b02('0xb')]['syncQueueCallerAbandon']=function(_0x248ac3){try{if(this[_0x4b02('0x60')](_0x248ac3)){logger[_0x4b02('0x43')](_0x4b02('0x81'),_0x248ac3['uniqueid'],util[_0x4b02('0x39')](_0x248ac3,{'showHidden':![],'depth':null}));if(this[_0x4b02('0x10')][_0x248ac3[_0x4b02('0x45')]]){var _0x2b11b4=_[_0x4b02('0x82')](this[_0x4b02('0x10')][_0x248ac3[_0x4b02('0x45')]]);_0x2b11b4[_0x4b02('0x83')]=![];_0x2b11b4['queuecallercompleteAt']=null;_0x2b11b4['holdtime']=_0x248ac3['holdtime'];_0x2b11b4[_0x4b02('0x84')]=_0x248ac3['originalposition'];_0x2b11b4[_0x4b02('0x1c')]=!![];_0x2b11b4[_0x4b02('0x85')]=moment()[_0x4b02('0x46')](_0x4b02('0x78'));_0x2b11b4[_0x4b02('0x86')]=_0x4b02('0x87');_0x2b11b4[_0x4b02('0x88')]=null;logger[_0x4b02('0x6a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2b11b4[_0x4b02('0x47')],_0x2b11b4[_0x4b02('0x56')]);this[_0x4b02('0x12')][_0x248ac3[_0x4b02('0x45')]]=_0x2b11b4;this[_0x4b02('0x40')](_0x2b11b4,_0x4b02('0x1c'));}}}catch(_0x49f02a){logger[_0x4b02('0x37')](_0x4b02('0x81'),_0x248ac3[_0x4b02('0x45')],util[_0x4b02('0x39')](_0x49f02a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b02('0xb')][_0x4b02('0x89')]=function(_0x3eaa9b){try{if(this[_0x4b02('0x60')](_0x3eaa9b)){logger[_0x4b02('0x43')](_0x4b02('0x8a'),_0x3eaa9b[_0x4b02('0x45')],util[_0x4b02('0x39')](_0x3eaa9b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3eaa9b[_0x4b02('0x45')]]){var _0x79645b=_[_0x4b02('0x82')](this[_0x4b02('0x10')][_0x3eaa9b['uniqueid']]);_0x79645b[_0x4b02('0x8b')]=moment()[_0x4b02('0x46')](_0x4b02('0x78'));_0x79645b[_0x4b02('0x8c')]=_0x3eaa9b['connectedlinenum'];_0x79645b[_0x4b02('0x8d')]=_0x3eaa9b[_0x4b02('0x8d')];logger[_0x4b02('0x6a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x79645b['name'],_0x79645b[_0x4b02('0x56')],_0x3eaa9b[_0x4b02('0x8c')],_0x3eaa9b['connectedlinename']);this[_0x4b02('0x12')][_0x3eaa9b[_0x4b02('0x45')]]=_0x79645b;this['emitVoiceQueueChannelSave'](_0x79645b,_0x4b02('0x1e'));}}}catch(_0x1ce322){logger[_0x4b02('0x37')]('[%s][voiceQueueReport][queuecallerleave]',_0x3eaa9b['uniqueid'],util[_0x4b02('0x39')](_0x1ce322,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b02('0xb')][_0x4b02('0x8e')]=function(_0x15f2d1){try{if(this['isNotNull'](_0x15f2d1)){logger[_0x4b02('0x43')](_0x4b02('0x8f'),_0x15f2d1[_0x4b02('0x45')],util['inspect'](_0x15f2d1,{'showHidden':![],'depth':null}));if(this[_0x4b02('0x10')][_0x15f2d1[_0x4b02('0x45')]]){var _0x4ede0b=_[_0x4b02('0x82')](this[_0x4b02('0x10')][_0x15f2d1['uniqueid']]);_0x4ede0b[_0x4b02('0x83')]=!![];_0x4ede0b[_0x4b02('0x86')]='COMPLETEDBYAGENT';logger[_0x4b02('0x6a')](_0x4b02('0x90'),_0x4ede0b[_0x4b02('0x47')],_0x4ede0b['type']);}}}catch(_0x295763){logger[_0x4b02('0x37')](_0x4b02('0x8f'),_0x15f2d1['uniqueid'],util[_0x4b02('0x39')](_0x295763,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b02('0xb')][_0x4b02('0x20')]=function(_0x177f81){try{if(this[_0x4b02('0x60')](_0x177f81)){logger[_0x4b02('0x43')](_0x4b02('0x91'),_0x177f81[_0x4b02('0x45')],util[_0x4b02('0x39')](_0x177f81,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x177f81[_0x4b02('0x45')]]){var _0x2317ce=_[_0x4b02('0x82')](this['queueReports'][_0x177f81[_0x4b02('0x45')]]);_0x2317ce['queuecallerabandon']=![];_0x2317ce[_0x4b02('0x85')]=null;_0x2317ce[_0x4b02('0x92')]=!![];_0x2317ce[_0x4b02('0x88')]=_0x177f81[_0x4b02('0x93')];_0x2317ce['holdtime']=_0x177f81['holdtime'];_0x2317ce['queuecallercomplete']=!![];_0x2317ce[_0x4b02('0x94')]=![];_0x2317ce[_0x4b02('0x95')]=null;if(!_0x2317ce[_0x4b02('0x96')]){if(_0x177f81[_0x4b02('0x97')]==_0x4b02('0x96')){_0x2317ce[_0x4b02('0x86')]='COMPLETED';logger[_0x4b02('0x6a')](_0x4b02('0x98'),_0x2317ce['name'],_0x2317ce['type']);}else{if(_[_0x4b02('0x99')](_0x177f81[_0x4b02('0x33')][_0x4b02('0x9a')](),'local/')){if(this[_0x4b02('0x10')][_0x177f81[_0x4b02('0x9b')]]){var _0x3d87cc=_['last'](this[_0x4b02('0x10')][_0x177f81[_0x4b02('0x9b')]]);_0x3d87cc[_0x4b02('0x83')]=![];_0x3d87cc['queuecallerexit']=!![];_0x3d87cc[_0x4b02('0x95')]=moment(_0x2317ce[_0x4b02('0x9c')])[_0x4b02('0x9d')](_0x177f81[_0x4b02('0x9e')],_0x4b02('0x9f'))[_0x4b02('0x46')](_0x4b02('0x78'));_0x3d87cc[_0x4b02('0x86')]=_0x4b02('0xa0');_0x3d87cc[_0x4b02('0x96')]=!![];_0x3d87cc[_0x4b02('0xa1')]=_0x4b02('0xa2');_0x3d87cc[_0x4b02('0xa3')]=_0x177f81['destexten'];_0x3d87cc[_0x4b02('0xa4')]=_0x177f81[_0x4b02('0x45')];logger[_0x4b02('0x6a')](_0x4b02('0xa5'),_0x3d87cc[_0x4b02('0x47')],_0x3d87cc['type']);var _0x38984a=this[_0x4b02('0x10')][_0x177f81[_0x4b02('0x9b')]];this[_0x4b02('0x10')][_0x177f81[_0x4b02('0x9b')]]=this[_0x4b02('0x10')][_0x177f81[_0x4b02('0x45')]];this[_0x4b02('0x10')][_0x177f81['uniqueid']]=_0x38984a;}}else{_0x2317ce[_0x4b02('0x86')]=_0x4b02('0xa6')+_0x177f81[_0x4b02('0x97')][_0x4b02('0xa7')]();logger[_0x4b02('0x6a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2317ce[_0x4b02('0x47')],_0x2317ce['type'],_0x2317ce['queuecallerexitreason']);}}}this[_0x4b02('0x12')][_0x177f81[_0x4b02('0x45')]]=_0x2317ce;this['emitVoiceQueueChannelRemove'](_0x2317ce,_0x4b02('0x1f'));}}}catch(_0x1ac90c){logger[_0x4b02('0x37')](_0x4b02('0x91'),_0x177f81[_0x4b02('0x45')],util['inspect'](_0x1ac90c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4b02('0x21')]=function(_0x9dca79){try{if(this[_0x4b02('0x60')](_0x9dca79)){logger[_0x4b02('0x43')](_0x4b02('0xa8'),_0x9dca79[_0x4b02('0x45')],util[_0x4b02('0x39')](_0x9dca79,{'showHidden':![],'depth':null}));this[_0x4b02('0xa9')](_0x9dca79[_0x4b02('0x45')],_[_0x4b02('0x7e')](_0x9dca79[_0x4b02('0xaa')])[0x0],_0x9dca79['value']);if(this['queueReports'][_0x9dca79[_0x4b02('0x45')]]){var _0x5629f0=_[_0x4b02('0x82')](this[_0x4b02('0x10')][_0x9dca79['uniqueid']]);if(_0x5629f0){if(this['isNotNull'](_0x9dca79[_0x4b02('0xaa')])&&this[_0x4b02('0x60')](_0x9dca79[_0x4b02('0xaa')][_0x4b02('0xab')])){switch(_0x9dca79[_0x4b02('0xac')]){case _0x4b02('0xad'):_0x5629f0['queuecallerexit']=![];_0x5629f0['queuecallerexitAt']=null;break;case _0x4b02('0xae'):_0x5629f0[_0x4b02('0xaf')]='timeout';_0x5629f0['queuecallerexit']=!![];_0x5629f0['queuecallerexitAt']=moment()[_0x4b02('0x46')](_0x4b02('0x78'));_0x5629f0[_0x4b02('0x8b')]=moment()[_0x4b02('0x46')](_0x4b02('0x78'));logger['debug'](_0x4b02('0xb0'),_0x9dca79[_0x4b02('0x45')],util['inspect'](_0x5629f0,{'showHidden':![],'depth':null}));ami[_0x4b02('0x42')](_0x4b02('0xb1'),_0x5629f0);break;default:_0x5629f0[_0x4b02('0x94')]=!![];_0x5629f0[_0x4b02('0x95')]=moment()[_0x4b02('0x46')](_0x4b02('0x78'));_0x5629f0[_0x4b02('0x8b')]=moment()[_0x4b02('0x46')](_0x4b02('0x78'));}_0x5629f0[_0x4b02('0x1c')]=![];_0x5629f0[_0x4b02('0x85')]=null;_0x5629f0[_0x4b02('0x86')]=_0x9dca79['value'];this[_0x4b02('0x12')][_0x9dca79[_0x4b02('0x45')]]=_0x5629f0;this[_0x4b02('0x40')](_0x5629f0,_0x4b02('0xb2'));}else if(this['isNotNull'](_0x9dca79[_0x4b02('0xaa')])&&this['isNotNull'](_0x9dca79['variable']['queueposition'])){if(!_0x5629f0[_0x4b02('0x1c')]){_0x5629f0[_0x4b02('0x94')]=!![];_0x5629f0['queuecallerexitAt']=moment()['format'](_0x4b02('0x78'));_0x5629f0['queuecallerexitreason']=_0x4b02('0xb3');_0x5629f0[_0x4b02('0x8b')]=moment()['format'](_0x4b02('0x78'));this[_0x4b02('0x12')][_0x9dca79[_0x4b02('0x45')]]=_0x5629f0;}}logger[_0x4b02('0x6a')](_0x4b02('0xb4'),_0x9dca79[_0x4b02('0x45')],_0x5629f0[_0x4b02('0x47')],_0x5629f0[_0x4b02('0x56')],_[_0x4b02('0x7e')](_0x9dca79['variable'])[0x0],_0x9dca79[_0x4b02('0xac')]);_0x5629f0['variables']=this[_0x4b02('0x3b')][_0x9dca79[_0x4b02('0x45')]];}}}}catch(_0x5077a1){logger[_0x4b02('0x37')](_0x4b02('0xa8'),_0x9dca79[_0x4b02('0x45')],util[_0x4b02('0x39')](_0x5077a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b02('0xb')][_0x4b02('0xa9')]=function(_0x2e8f7c,_0x2b4c8f,_0x479936){var _0x1e59b5=[_0x4b02('0xb5'),'rtpaudioqosbridged',_0x4b02('0xb6'),_0x4b02('0xb7'),_0x4b02('0xb8'),_0x4b02('0xb9'),_0x4b02('0xba'),_0x4b02('0xbb'),_0x4b02('0xbc'),_0x4b02('0xbd'),'bridgepeer','bridgepvtcallid',_0x4b02('0xbe'),_0x4b02('0xbf'),_0x4b02('0xc0'),_0x4b02('0xc1'),'membername',_0x4b02('0xc2'),_0x4b02('0xc3')];if(!_['isNil'](_0x2b4c8f)&&!_[_0x4b02('0xc4')](_0x1e59b5,_0x2b4c8f)){if(_[_0x4b02('0x77')](this[_0x4b02('0x3b')][_0x2e8f7c])){this[_0x4b02('0x3b')][_0x2e8f7c]={};}this[_0x4b02('0x3b')][_0x2e8f7c][_0x2b4c8f]=_0x479936;}};VoiceQueueReport[_0x4b02('0xb')][_0x4b02('0xc5')]=function(_0x3f0f66,_0x44efe3,_0x5c407f){var _0x1237ea={};for(var _0x380a3b=0x0;_0x380a3b0x0?_0x83f04f:0x0;this[_0x88d0('0x12')][_0x17e8b6[_0x88d0('0x6d')]][_0x88d0('0x32')]=this[_0x88d0('0x12')][_0x17e8b6[_0x88d0('0x6d')]]['talking']>_[_0x88d0('0x70')](_0x17e8b6['loggedin'])?_[_0x88d0('0x70')](_0x17e8b6['loggedin']):this[_0x88d0('0x12')][_0x17e8b6['queue']]['talking'];this[_0x88d0('0x53')](this['voiceQueues'][_0x17e8b6[_0x88d0('0x6d')]],_0x88d0('0x16'));}logger[_0x88d0('0x45')](_0x88d0('0x74'),util[_0x88d0('0x3c')](this[_0x88d0('0x12')][_0x17e8b6[_0x88d0('0x6d')]],{'showHidden':![],'depth':null}));ami[_0x88d0('0x43')]('custom:queuesummary',this[_0x88d0('0x12')][_0x17e8b6[_0x88d0('0x6d')]]);}}}catch(_0x59da62){logger[_0x88d0('0x3d')](_0x88d0('0x6b'),util[_0x88d0('0x3c')](_0x59da62,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88d0('0x9')][_0x88d0('0x75')]=function(_0x408659){logger[_0x88d0('0x45')](_0x88d0('0x76'),util[_0x88d0('0x3c')](_0x408659,{'showHidden':![],'depth':null}));ami[_0x88d0('0x43')](_0x88d0('0x77'),{});this[_0x88d0('0x13')]=!![];};VoiceQueueReport[_0x88d0('0x9')][_0x88d0('0x78')]=function(_0x3c255a){try{if(this[_0x88d0('0x6c')](_0x3c255a)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x3c255a[_0x88d0('0x48')],util['inspect'](_0x3c255a,{'showHidden':![],'depth':null}));if(_[_0x88d0('0x79')](this[_0x88d0('0xe')][_0x3c255a[_0x88d0('0x48')]]))this[_0x88d0('0xe')][_0x3c255a['uniqueid']]=[];if(_[_0x88d0('0x79')](this[_0x88d0('0x10')][_0x3c255a[_0x88d0('0x48')]]))this[_0x88d0('0x10')][_0x3c255a[_0x88d0('0x48')]]={};var _0x33d944=new QueueReport();_0x33d944[_0x88d0('0x4b')]=_0x3c255a[_0x88d0('0x6d')];_0x33d944[_0x88d0('0x54')]=this['voiceQueues'][_0x33d944[_0x88d0('0x4b')]]&&this[_0x88d0('0x12')][_0x33d944['name']][_0x88d0('0x54')]?this['voiceQueues'][_0x33d944[_0x88d0('0x4b')]]['type']||_0x88d0('0x55'):_0x88d0('0x55');_0x33d944[_0x88d0('0x6d')]=_0x3c255a[_0x88d0('0x6d')];_0x33d944[_0x88d0('0x7a')]=moment()[_0x88d0('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x33d944['position']=_0x3c255a[_0x88d0('0x7b')];_0x33d944[_0x88d0('0x7c')]=_0x3c255a['count'];_0x33d944[_0x88d0('0x48')]=_0x3c255a['uniqueid'];_0x33d944[_0x88d0('0x7d')]=this[_0x88d0('0x10')][_0x3c255a[_0x88d0('0x48')]]['routealias'];logger[_0x88d0('0x6e')](_0x88d0('0x7e'),_0x33d944[_0x88d0('0x4b')],_0x33d944['type']);_['merge'](_0x33d944,_[_0x88d0('0x7f')](_0x3c255a,_[_0x88d0('0x80')](_0x33d944)));this[_0x88d0('0xe')][_0x3c255a['uniqueid']]['push'](_0x33d944);this['channels'][_0x3c255a[_0x88d0('0x48')]]=_0x33d944;this[_0x88d0('0x44')](_0x33d944,'queuecallerjoin');}}catch(_0x1f05b6){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x3c255a['uniqueid'],util[_0x88d0('0x3c')](_0x1f05b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x88d0('0x1b')]=function(_0x1d9452){try{if(this[_0x88d0('0x6c')](_0x1d9452)){logger[_0x88d0('0x45')](_0x88d0('0x81'),_0x1d9452[_0x88d0('0x48')],util[_0x88d0('0x3c')](_0x1d9452,{'showHidden':![],'depth':null}));if(this[_0x88d0('0xe')][_0x1d9452['uniqueid']]){var _0x534719=_[_0x88d0('0x82')](this[_0x88d0('0xe')][_0x1d9452[_0x88d0('0x48')]]);_0x534719[_0x88d0('0x83')]=![];_0x534719[_0x88d0('0x84')]=null;_0x534719['holdtime']=_0x1d9452[_0x88d0('0x85')];_0x534719[_0x88d0('0x86')]=_0x1d9452['originalposition'];_0x534719[_0x88d0('0x1a')]=!![];_0x534719[_0x88d0('0x87')]=moment()['format'](_0x88d0('0x88'));_0x534719[_0x88d0('0x4f')]='ABANDONED';_0x534719[_0x88d0('0x89')]=null;logger[_0x88d0('0x6e')](_0x88d0('0x8a'),_0x534719[_0x88d0('0x4b')],_0x534719[_0x88d0('0x54')]);this[_0x88d0('0x10')][_0x1d9452[_0x88d0('0x48')]]=_0x534719;this[_0x88d0('0x42')](_0x534719,_0x88d0('0x1a'));}}}catch(_0x1a8e13){logger[_0x88d0('0x3d')](_0x88d0('0x81'),_0x1d9452['uniqueid'],util['inspect'](_0x1a8e13,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88d0('0x9')][_0x88d0('0x1d')]=function(_0x41e192){try{if(this[_0x88d0('0x6c')](_0x41e192)){logger[_0x88d0('0x45')]('[%s][voiceQueueReport][queuecallerleave]',_0x41e192[_0x88d0('0x48')],util['inspect'](_0x41e192,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x41e192[_0x88d0('0x48')]]){var _0x50e8ec=_[_0x88d0('0x82')](this['queueReports'][_0x41e192[_0x88d0('0x48')]]);_0x50e8ec[_0x88d0('0x8b')]=moment()[_0x88d0('0x49')](_0x88d0('0x88'));_0x50e8ec[_0x88d0('0x8c')]=_0x41e192[_0x88d0('0x8c')];_0x50e8ec[_0x88d0('0x8d')]=_0x41e192[_0x88d0('0x8d')];logger[_0x88d0('0x6e')](_0x88d0('0x8e'),_0x50e8ec[_0x88d0('0x4b')],_0x50e8ec[_0x88d0('0x54')],_0x41e192[_0x88d0('0x8c')],_0x41e192[_0x88d0('0x8d')]);this['channels'][_0x41e192['uniqueid']]=_0x50e8ec;this[_0x88d0('0x44')](_0x50e8ec,_0x88d0('0x1c'));}}}catch(_0x423f2d){logger[_0x88d0('0x3d')](_0x88d0('0x8f'),_0x41e192['uniqueid'],util['inspect'](_0x423f2d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88d0('0x9')][_0x88d0('0x20')]=function(_0x566610){try{if(this[_0x88d0('0x6c')](_0x566610)){logger[_0x88d0('0x45')](_0x88d0('0x90'),_0x566610[_0x88d0('0x48')],util[_0x88d0('0x3c')](_0x566610,{'showHidden':![],'depth':null}));if(this[_0x88d0('0xe')][_0x566610[_0x88d0('0x48')]]){var _0x105f25=_[_0x88d0('0x82')](this['queueReports'][_0x566610[_0x88d0('0x48')]]);_0x105f25[_0x88d0('0x83')]=!![];_0x105f25[_0x88d0('0x4f')]=_0x88d0('0x91');logger[_0x88d0('0x6e')](_0x88d0('0x92'),_0x105f25[_0x88d0('0x4b')],_0x105f25[_0x88d0('0x54')]);}}}catch(_0x347804){logger[_0x88d0('0x3d')](_0x88d0('0x90'),_0x566610[_0x88d0('0x48')],util[_0x88d0('0x3c')](_0x347804,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88d0('0x9')][_0x88d0('0x1f')]=function(_0x30f8ac){try{if(this[_0x88d0('0x6c')](_0x30f8ac)){logger[_0x88d0('0x45')](_0x88d0('0x93'),_0x30f8ac['uniqueid'],util[_0x88d0('0x3c')](_0x30f8ac,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x30f8ac['uniqueid']]){var _0x50fbd6=_[_0x88d0('0x82')](this[_0x88d0('0xe')][_0x30f8ac[_0x88d0('0x48')]]);_0x50fbd6['queuecallerabandon']=![];_0x50fbd6[_0x88d0('0x87')]=null;_0x50fbd6['assigned']=!![];_0x50fbd6[_0x88d0('0x89')]=_0x30f8ac[_0x88d0('0x94')];_0x50fbd6[_0x88d0('0x85')]=_0x30f8ac[_0x88d0('0x85')];_0x50fbd6[_0x88d0('0x83')]=!![];_0x50fbd6['queuecallerexit']=![];_0x50fbd6[_0x88d0('0x95')]=null;if(!_0x50fbd6[_0x88d0('0x96')]){if(_0x30f8ac['reason']==_0x88d0('0x96')){_0x50fbd6['queuecallerexitreason']=_0x88d0('0x97');logger[_0x88d0('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x50fbd6[_0x88d0('0x4b')],_0x50fbd6[_0x88d0('0x54')]);}else{if(_['startsWith'](_0x30f8ac[_0x88d0('0x98')][_0x88d0('0x99')](),_0x88d0('0x9a'))){if(this[_0x88d0('0xe')][_0x30f8ac['linkedid']]){var _0xdc6e70=_[_0x88d0('0x82')](this['queueReports'][_0x30f8ac[_0x88d0('0x9b')]]);_0xdc6e70[_0x88d0('0x83')]=![];_0xdc6e70[_0x88d0('0x9c')]=!![];_0xdc6e70[_0x88d0('0x95')]=moment(_0x50fbd6['queuecallerjoinAt'])[_0x88d0('0x9d')](_0x30f8ac[_0x88d0('0x85')],_0x88d0('0x9e'))['format'](_0x88d0('0x88'));_0xdc6e70[_0x88d0('0x4f')]=_0x88d0('0x9f');_0xdc6e70[_0x88d0('0x96')]=!![];_0xdc6e70['transfertype']=_0x88d0('0xa0');_0xdc6e70[_0x88d0('0xa1')]=_0x30f8ac[_0x88d0('0xa2')];_0xdc6e70[_0x88d0('0xa3')]=_0x30f8ac[_0x88d0('0x48')];logger[_0x88d0('0x6e')](_0x88d0('0xa4'),_0xdc6e70[_0x88d0('0x4b')],_0xdc6e70[_0x88d0('0x54')]);var _0x1894f5=this[_0x88d0('0xe')][_0x30f8ac[_0x88d0('0x9b')]];this[_0x88d0('0xe')][_0x30f8ac[_0x88d0('0x9b')]]=this[_0x88d0('0xe')][_0x30f8ac[_0x88d0('0x48')]];this['queueReports'][_0x30f8ac[_0x88d0('0x48')]]=_0x1894f5;}}else{_0x50fbd6[_0x88d0('0x4f')]=_0x88d0('0xa5')+_0x30f8ac[_0x88d0('0xa6')]['toUpperCase']();logger['info'](_0x88d0('0xa7'),_0x50fbd6[_0x88d0('0x4b')],_0x50fbd6[_0x88d0('0x54')],_0x50fbd6[_0x88d0('0x4f')]);}}}this[_0x88d0('0x10')][_0x30f8ac[_0x88d0('0x48')]]=_0x50fbd6;this['emitVoiceQueueChannelRemove'](_0x50fbd6,'agentcomplete');}}}catch(_0x3d26a7){logger[_0x88d0('0x3d')](_0x88d0('0x93'),_0x30f8ac[_0x88d0('0x48')],util['inspect'](_0x3d26a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88d0('0x9')]['syncVarSet']=function(_0x4948c6){try{if(this[_0x88d0('0x6c')](_0x4948c6)){logger['debug'](_0x88d0('0xa8'),_0x4948c6['uniqueid'],util['inspect'](_0x4948c6,{'showHidden':![],'depth':null}));this[_0x88d0('0xa9')](_0x4948c6['uniqueid'],_[_0x88d0('0x80')](_0x4948c6[_0x88d0('0xaa')])[0x0],_0x4948c6[_0x88d0('0xab')]);if(this[_0x88d0('0xe')][_0x4948c6[_0x88d0('0x48')]]){var _0x202ee1=_['last'](this['queueReports'][_0x4948c6['uniqueid']]);if(_0x202ee1){if(this[_0x88d0('0x6c')](_0x4948c6['variable'])&&this[_0x88d0('0x6c')](_0x4948c6[_0x88d0('0xaa')][_0x88d0('0xac')])){switch(_0x4948c6['value']){case _0x88d0('0xad'):_0x202ee1['queuecallerexit']=![];_0x202ee1[_0x88d0('0x95')]=null;break;case _0x88d0('0xae'):_0x202ee1[_0x88d0('0xaf')]='timeout';_0x202ee1[_0x88d0('0x9c')]=!![];_0x202ee1[_0x88d0('0x95')]=moment()[_0x88d0('0x49')](_0x88d0('0x88'));_0x202ee1[_0x88d0('0x8b')]=moment()[_0x88d0('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x88d0('0x45')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x4948c6['uniqueid'],util[_0x88d0('0x3c')](_0x202ee1,{'showHidden':![],'depth':null}));ami[_0x88d0('0x43')](_0x88d0('0xb0'),_0x202ee1);break;default:_0x202ee1[_0x88d0('0x9c')]=!![];_0x202ee1[_0x88d0('0x95')]=moment()[_0x88d0('0x49')](_0x88d0('0x88'));_0x202ee1['queuecallerleaveAt']=moment()[_0x88d0('0x49')](_0x88d0('0x88'));}_0x202ee1[_0x88d0('0x1a')]=![];_0x202ee1[_0x88d0('0x87')]=null;_0x202ee1[_0x88d0('0x4f')]=_0x4948c6[_0x88d0('0xab')];this[_0x88d0('0x10')][_0x4948c6[_0x88d0('0x48')]]=_0x202ee1;this[_0x88d0('0x42')](_0x202ee1,'varset');}else if(this[_0x88d0('0x6c')](_0x4948c6[_0x88d0('0xaa')])&&this[_0x88d0('0x6c')](_0x4948c6[_0x88d0('0xaa')][_0x88d0('0xb1')])){if(!_0x202ee1[_0x88d0('0x1a')]){_0x202ee1['queuecallerexit']=!![];_0x202ee1[_0x88d0('0x95')]=moment()[_0x88d0('0x49')](_0x88d0('0x88'));_0x202ee1['queuecallerexitreason']=_0x88d0('0xb2');_0x202ee1[_0x88d0('0x8b')]=moment()[_0x88d0('0x49')](_0x88d0('0x88'));this[_0x88d0('0x10')][_0x4948c6[_0x88d0('0x48')]]=_0x202ee1;}}logger[_0x88d0('0x6e')](_0x88d0('0xb3'),_0x4948c6['uniqueid'],_0x202ee1['name'],_0x202ee1[_0x88d0('0x54')],_[_0x88d0('0x80')](_0x4948c6[_0x88d0('0xaa')])[0x0],_0x4948c6[_0x88d0('0xab')]);_0x202ee1['variables']=this[_0x88d0('0x15')][_0x4948c6['uniqueid']];}}}}catch(_0x148cfc){logger[_0x88d0('0x3d')](_0x88d0('0xa8'),_0x4948c6[_0x88d0('0x48')],util[_0x88d0('0x3c')](_0x148cfc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x88d0('0x9')][_0x88d0('0xa9')]=function(_0x25184f,_0x42d1e7,_0x1e713d){var _0x2c96d2=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0x88d0('0xb4'),_0x88d0('0xb5'),_0x88d0('0xb6'),_0x88d0('0xb7'),_0x88d0('0xb8'),_0x88d0('0xb9'),'sipuri',_0x88d0('0xba'),_0x88d0('0xbb'),'membercalls','memberdynamic','memberinterface',_0x88d0('0xbc'),_0x88d0('0x94'),_0x88d0('0xbd'),'memberrealtime'];if(!_[_0x88d0('0x37')](_0x42d1e7)&&!_[_0x88d0('0xbe')](_0x2c96d2,_0x42d1e7)){if(_[_0x88d0('0x79')](this['variables'][_0x25184f])){this[_0x88d0('0x15')][_0x25184f]={};}this[_0x88d0('0x15')][_0x25184f][_0x42d1e7]=_0x1e713d;}};VoiceQueueReport['prototype'][_0x88d0('0xbf')]=function(_0x407caa,_0x15e2fb,_0xefb14c){var _0x2a5c63={};for(var _0x51627c=0x0;_0x51627c=0x0?moment(_0x190284[_0xf586('0x11')])[_0xf586('0x12')](_0x190284[_0xf586('0x10')],_0xf586('0x9')):null,'data1':_0xf586('0x13'),'data2':_0x190284[_0xf586('0xd')],'data3':_0x190284[_0xf586('0xb')],'data4':_0x190284[_0xf586('0x14')]||null,'role':_0xf586('0x15'),'internal':_0x190284[_0xf586('0xd')]?_[_0xf586('0xe')](_0x190284[_0xf586('0xd')]):undefined,'uniqueid':_0x190284['uniqueid']},'log':_0xf586('0xf')});}; \ No newline at end of file +var _0x649b=['endtime','outbound','moment','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','format','interface','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x649b,0xa4));var _0xb649=function(_0x36d320,_0x3e01c3){_0x36d320=_0x36d320-0x0;var _0x410b58=_0x649b[_0x36d320];return _0x410b58;};'use strict';var moment=require(_0xb649('0x0'));var _=require('lodash');var util=require(_0xb649('0x1'));var client=require(_0xb649('0x2'));exports[_0xb649('0x3')]=function(_0x1119c3){var _0x4a7dba=_0x1119c3['queuecallercompleteAt']||_0x1119c3[_0xb649('0x4')];return client[_0xb649('0x5')]('CreateMemberReport',{'body':{'channel':_0xb649('0x6'),'membername':_0x1119c3[_0xb649('0x7')],'interface':_[_0xb649('0x8')](_0x1119c3['interface'])?util[_0xb649('0x9')]('SIP/%s',_0x1119c3[_0xb649('0x7')]):_0x1119c3[_0xb649('0xa')],'type':'TALKING','enterAt':_0x1119c3['queuecallerleaveAt'],'exitAt':_0x4a7dba,'duration':moment(_0x4a7dba)[_0xb649('0xb')](_0x1119c3['queuecallerleaveAt'],_0xb649('0xc')),'data1':_0xb649('0xd'),'data2':_0x1119c3[_0xb649('0xe')],'data3':_0x1119c3[_0xb649('0xf')],'data4':null,'data5':_0x1119c3[_0xb649('0x10')],'role':_0xb649('0x11'),'internal':_0x1119c3[_0xb649('0x12')]?_[_0xb649('0x13')](_0x1119c3[_0xb649('0x12')]):undefined,'uniqueid':_0x1119c3[_0xb649('0x14')]},'log':_0xb649('0x15')});};exports[_0xb649('0x16')]=function(_0x26b1df){return client['Request'](_0xb649('0x15'),{'body':{'channel':_0xb649('0x6'),'membername':_0x26b1df[_0xb649('0x17')],'interface':_0x26b1df[_0xb649('0xa')],'type':'TALKING','enterAt':_0x26b1df[_0xb649('0x18')],'exitAt':_0x26b1df[_0xb649('0x19')],'duration':moment(_0x26b1df['endtime'])['diff'](_0x26b1df[_0xb649('0x18')],_0xb649('0xc'))>=0x0?moment(_0x26b1df['endtime'])[_0xb649('0xb')](_0x26b1df[_0xb649('0x18')],_0xb649('0xc')):null,'data1':_0xb649('0x1a'),'data2':_0x26b1df[_0xb649('0x12')],'data3':_0x26b1df[_0xb649('0xf')],'data4':_0x26b1df['dialstring']||null,'role':_0xb649('0x11'),'internal':_0x26b1df['accountcode']?_['toNumber'](_0x26b1df['accountcode']):undefined,'uniqueid':_0x26b1df[_0xb649('0x14')]},'log':_0xb649('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 5dd7579..44d44e5 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 _0x11e3=['ShowSetting','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x254d35,_0x1a0a2b){var _0x249ff4=function(_0x3f7fc5){while(--_0x3f7fc5){_0x254d35['push'](_0x254d35['shift']());}};_0x249ff4(++_0x1a0a2b);}(_0x11e3,0x6f));var _0x311e=function(_0x5b29df,_0x9f665b){_0x5b29df=_0x5b29df-0x0;var _0x9f3815=_0x11e3[_0x5b29df];return _0x9f3815;};'use strict';var client=require(_0x311e('0x0'));exports[_0x311e('0x1')]=function(){return client[_0x311e('0x2')](_0x311e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x311e('0x4')]},'log':_0x311e('0x5')});}; \ No newline at end of file +var _0x5423=['stopRecordingOnTransfer','GetSettings','../client','getSettings','ShowSetting'];(function(_0x711f15,_0x3fd50d){var _0x546e3b=function(_0x530822){while(--_0x530822){_0x711f15['push'](_0x711f15['shift']());}};_0x546e3b(++_0x3fd50d);}(_0x5423,0xe3));var _0x3542=function(_0x47d101,_0xd933b){_0x47d101=_0x47d101-0x0;var _0x1cbc29=_0x5423[_0x47d101];return _0x1cbc29;};'use strict';var client=require(_0x3542('0x0'));exports[_0x3542('0x1')]=function(){return client['Request'](_0x3542('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3542('0x3'),'previewRecallmeReminderInterval']},'log':_0x3542('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 331cc8b..5d6f45f 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 _0xe85c=['getTemplates','Request','GetTemplate','name','../client'];(function(_0x2e291a,_0x3c8a34){var _0x5a6b12=function(_0x271ab0){while(--_0x271ab0){_0x2e291a['push'](_0x2e291a['shift']());}};_0x5a6b12(++_0x3c8a34);}(_0xe85c,0x117));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xce85('0x0'));exports[_0xce85('0x1')]=function(_0x1662d0){return function(_0x6e12b0){return client[_0xce85('0x2')](_0xce85('0x3'),{'options':{'raw':!![],'attributes':['id',_0xce85('0x4'),'html']},'log':_0xce85('0x3')});};}; \ No newline at end of file +var _0x1a3e=['name','html','GetTemplate','../client','getTemplates'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x1a3e,0xad));var _0xe1a3=function(_0x12d1a3,_0x191021){_0x12d1a3=_0x12d1a3-0x0;var _0x4df4c2=_0x1a3e[_0x12d1a3];return _0x4df4c2;};'use strict';var client=require(_0xe1a3('0x0'));exports[_0xe1a3('0x1')]=function(_0x28f62e){return function(_0xe92cf4){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xe1a3('0x2'),_0xe1a3('0x3')]},'log':_0xe1a3('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b55cdb5..45c2950 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 _0x4ad2=['getTriggers','Request','GetTrigger','name','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','action','data1','data2','data3','data4','data5','data6','../client'];(function(_0x2eee7e,_0x164281){var _0x451149=function(_0x53fbcc){while(--_0x53fbcc){_0x2eee7e['push'](_0x2eee7e['shift']());}};_0x451149(++_0x164281);}(_0x4ad2,0xa7));var _0x24ad=function(_0x3a4fd6,_0x286d74){_0x3a4fd6=_0x3a4fd6-0x0;var _0x595dae=_0x4ad2[_0x3a4fd6];return _0x595dae;};'use strict';var client=require(_0x24ad('0x0'));exports[_0x24ad('0x1')]=function(_0x10bf57){return function(_0x4995f2){return client[_0x24ad('0x2')](_0x24ad('0x3'),{'options':{'raw':![],'attributes':['id',_0x24ad('0x4'),_0x24ad('0x5'),_0x24ad('0x6')],'include':[{'model':'Condition','as':_0x24ad('0x7'),'attributes':['id',_0x24ad('0x8'),_0x24ad('0x9'),_0x24ad('0xa')]},{'model':_0x24ad('0xb'),'as':_0x24ad('0xc'),'attributes':['id',_0x24ad('0x8'),_0x24ad('0x9'),'value']},{'model':_0x24ad('0xd'),'as':'Actions','attributes':['id',_0x24ad('0xe'),_0x24ad('0xf'),_0x24ad('0x10'),_0x24ad('0x11'),_0x24ad('0x12'),_0x24ad('0x13'),_0x24ad('0x14'),'data7']}]},'log':_0x24ad('0x3')});};}; \ No newline at end of file +var _0x58eb=['data4','data6','data7','GetTrigger','../client','getTriggers','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2'];(function(_0xc6a4d5,_0x3e498f){var _0x3c07d2=function(_0x198527){while(--_0x198527){_0xc6a4d5['push'](_0xc6a4d5['shift']());}};_0x3c07d2(++_0x3e498f);}(_0x58eb,0x130));var _0xb58e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x58eb[_0xd1d19a];return _0x52a79d;};'use strict';var client=require(_0xb58e('0x0'));exports[_0xb58e('0x1')]=function(_0x4c9e25){return function(_0x2653c1){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xb58e('0x2'),_0xb58e('0x3'),_0xb58e('0x4')],'include':[{'model':_0xb58e('0x5'),'as':_0xb58e('0x6'),'attributes':['id','field',_0xb58e('0x7'),_0xb58e('0x8')]},{'model':_0xb58e('0x5'),'as':_0xb58e('0x9'),'attributes':['id',_0xb58e('0xa'),_0xb58e('0x7'),_0xb58e('0x8')]},{'model':_0xb58e('0xb'),'as':_0xb58e('0xc'),'attributes':['id',_0xb58e('0xd'),_0xb58e('0xe'),_0xb58e('0xf'),'data3',_0xb58e('0x10'),'data5',_0xb58e('0x11'),_0xb58e('0x12')]}]},'log':_0xb58e('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 21ddb1e..312699c 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 _0x01e8=['../client','getTrunks','Request','name','defaultuser'];(function(_0x4a70d2,_0x49f583){var _0x4ed4a6=function(_0x1e0db4){while(--_0x1e0db4){_0x4a70d2['push'](_0x4a70d2['shift']());}};_0x4ed4a6(++_0x49f583);}(_0x01e8,0x6e));var _0x801e=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x01e8[_0x4df1f5];return _0x56585b;};'use strict';var client=require(_0x801e('0x0'));exports[_0x801e('0x1')]=function(_0x24a8c3){return function(_0x5c46ca){return client[_0x801e('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x801e('0x3'),'registry',_0x801e('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x1801=['registry','defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1801,0xc6));var _0x1180=function(_0x58e41f,_0x13d681){_0x58e41f=_0x58e41f-0x0;var _0x23b735=_0x1801[_0x58e41f];return _0x23b735;};'use strict';var client=require(_0x1180('0x0'));exports[_0x1180('0x1')]=function(_0x2eaa51){return function(_0x1db775){return client[_0x1180('0x2')](_0x1180('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1180('0x4'),_0x1180('0x5'),_0x1180('0x6')]},'log':_0x1180('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f3cd95e..d2ff48e 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0xba8233,_0x3e8fbf){var _0x4e6fa8=function(_0x2a0497){while(--_0x2a0497){_0xba8233['push'](_0xba8233['shift']());}};_0x4e6fa8(++_0x3e8fbf);}(_0xedd9,0xfc));var _0x9edd=function(_0x5c374a,_0x3a6020){_0x5c374a=_0x5c374a-0x0;var _0x5cc816=_0xedd9[_0x5c374a];return _0x5cc816;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b61b51c..6b3a9be 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 _0x38e3=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x6c6d17,_0x203165){var _0x425f24=function(_0x3fb7df){while(--_0x3fb7df){_0x6c6d17['push'](_0x6c6d17['shift']());}};_0x425f24(++_0x203165);}(_0x38e3,0x77));var _0x338e=function(_0x4c5b10,_0x272f66){_0x4c5b10=_0x4c5b10-0x0;var _0x27bf0a=_0x38e3[_0x4c5b10];return _0x27bf0a;};'use strict';var client=require(_0x338e('0x0'));exports['create']=function(_0x4ad223){return client[_0x338e('0x1')](_0x338e('0x2'),{'body':_0x4ad223,'log':_0x338e('0x2')});};exports[_0x338e('0x3')]=function(_0x132cd1,_0x13895b,_0x40fda1){return client[_0x338e('0x1')]('UpdateVoiceAgentReport',{'body':_0x132cd1,'options':{'where':{'uniqueid':_0x13895b,'interface':_0x40fda1,'agentcomplete':!![]}},'log':_0x338e('0x4')});}; \ No newline at end of file +var _0x3a69=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x18c2d7,_0x2bc5f3){var _0x881d17=function(_0x3bf0aa){while(--_0x3bf0aa){_0x18c2d7['push'](_0x18c2d7['shift']());}};_0x881d17(++_0x2bc5f3);}(_0x3a69,0x117));var _0x93a6=function(_0x4973ff,_0x30abe4){_0x4973ff=_0x4973ff-0x0;var _0x4dd6b6=_0x3a69[_0x4973ff];return _0x4dd6b6;};'use strict';var client=require(_0x93a6('0x0'));exports[_0x93a6('0x1')]=function(_0x41f16f){return client[_0x93a6('0x2')](_0x93a6('0x3'),{'body':_0x41f16f,'log':'CreateVoiceAgentReport'});};exports[_0x93a6('0x4')]=function(_0x273f3d,_0x4a3de3,_0x1fd1ae){return client[_0x93a6('0x2')](_0x93a6('0x5'),{'body':_0x273f3d,'options':{'where':{'uniqueid':_0x4a3de3,'interface':_0x1fd1ae,'agentcomplete':!![]}},'log':_0x93a6('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 69bdd44..f72d6d7 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 _0x8946=['context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x8946,0x16e));var _0x6894=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x8946[_0x40220a];return _0x3903cc;};'use strict';var moment=require(_0x6894('0x0'));var util=require(_0x6894('0x1'));var _=require(_0x6894('0x2'));var client=require(_0x6894('0x3'));exports[_0x6894('0x4')]=function(_0x4c7abd){return client[_0x6894('0x5')](_0x6894('0x6'),{'body':_['merge'](_0x4c7abd,{'source':_0x4c7abd[_0x6894('0x7')],'destinationcontext':_0x4c7abd[_0x6894('0x8')],'callerid':_0x4c7abd[_0x6894('0x9')],'amaflags':_0x6894('0xa')}),'log':_0x6894('0x6')});};exports[_0x6894('0xb')]=function(){return function(){return client[_0x6894('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x6894('0xc')],'createdAt':{'$between':[moment()[_0x6894('0xd')](_0x6894('0xe'))['format'](_0x6894('0xf')),moment()[_0x6894('0x10')](_0x6894('0xe'))[_0x6894('0x11')](_0x6894('0xf'))]}},'attributes':[_0x6894('0x12'),_0x6894('0x13'),'duration',_0x6894('0x14')]},'log':_0x6894('0x15')});};}; \ No newline at end of file +var _0xa8e9=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x48e27b,_0x6ab21d){var _0x2a6d99=function(_0x5c3d54){while(--_0x5c3d54){_0x48e27b['push'](_0x48e27b['shift']());}};_0x2a6d99(++_0x6ab21d);}(_0xa8e9,0x191));var _0x9a8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8e9[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9a8e('0x0'));var util=require(_0x9a8e('0x1'));var _=require(_0x9a8e('0x2'));var client=require(_0x9a8e('0x3'));exports[_0x9a8e('0x4')]=function(_0x35d64c){return client[_0x9a8e('0x5')](_0x9a8e('0x6'),{'body':_[_0x9a8e('0x7')](_0x35d64c,{'source':_0x35d64c[_0x9a8e('0x8')],'destinationcontext':_0x35d64c[_0x9a8e('0x9')],'callerid':_0x35d64c[_0x9a8e('0xa')],'amaflags':_0x9a8e('0xb')}),'log':_0x9a8e('0x6')});};exports[_0x9a8e('0xc')]=function(){return function(){return client[_0x9a8e('0x5')](_0x9a8e('0xd'),{'options':{'where':{'type':[_0x9a8e('0xe')],'createdAt':{'$between':[moment()[_0x9a8e('0xf')](_0x9a8e('0x10'))[_0x9a8e('0x11')](_0x9a8e('0x12')),moment()[_0x9a8e('0x13')]('day')[_0x9a8e('0x11')](_0x9a8e('0x12'))]}},'attributes':['type',_0x9a8e('0x14'),'duration','billableseconds']},'log':_0x9a8e('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c9b08e3..729d70e 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 _0x582e=['create','Request','CreateVoiceDialReport'];(function(_0x58f4ac,_0x5264d9){var _0x4dcb35=function(_0x1a5cbd){while(--_0x1a5cbd){_0x58f4ac['push'](_0x58f4ac['shift']());}};_0x4dcb35(++_0x5264d9);}(_0x582e,0x1c8));var _0xe582=function(_0x37087e,_0x719222){_0x37087e=_0x37087e-0x0;var _0x117e6f=_0x582e[_0x37087e];return _0x117e6f;};'use strict';var client=require('../client');exports[_0xe582('0x0')]=function(_0x5d3e69){return client[_0xe582('0x1')](_0xe582('0x2'),{'body':_0x5d3e69,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xaba9=['create','Request','CreateVoiceDialReport','../client'];(function(_0x2d3d0d,_0x67ac82){var _0xca35b6=function(_0x483979){while(--_0x483979){_0x2d3d0d['push'](_0x2d3d0d['shift']());}};_0xca35b6(++_0x67ac82);}(_0xaba9,0x10b));var _0x9aba=function(_0x22d0ba,_0x3070f9){_0x22d0ba=_0x22d0ba-0x0;var _0x15a25e=_0xaba9[_0x22d0ba];return _0x15a25e;};'use strict';var client=require(_0x9aba('0x0'));exports[_0x9aba('0x1')]=function(_0x27260f){return client[_0x9aba('0x2')](_0x9aba('0x3'),{'body':_0x27260f,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 0680544..3cb1212 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 _0x70e0=['getVoiceExtensions','Request','recordingFormat','../client'];(function(_0x4aafde,_0x504cb3){var _0x146794=function(_0x4b7ecd){while(--_0x4b7ecd){_0x4aafde['push'](_0x4aafde['shift']());}};_0x146794(++_0x504cb3);}(_0x70e0,0x17b));var _0x070e=function(_0x525adf,_0x930abb){_0x525adf=_0x525adf-0x0;var _0x527eff=_0x70e0[_0x525adf];return _0x527eff;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x070e('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0x1b73=['exten','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x1b73,0x1d5));var _0x31b7=function(_0x5b85b2,_0x497634){_0x5b85b2=_0x5b85b2-0x0;var _0x17a509=_0x1b73[_0x5b85b2];return _0x17a509;};'use strict';var client=require('../client');exports[_0x31b7('0x0')]=function(){return function(){return client[_0x31b7('0x1')](_0x31b7('0x2'),{'options':{'raw':!![],'attributes':['id',_0x31b7('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x31b7('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 058864b..73b8214 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 _0x40e5=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive'];(function(_0x5b0f76,_0x19a10a){var _0x4d0c96=function(_0x5b01fe){while(--_0x5b01fe){_0x5b0f76['push'](_0x5b0f76['shift']());}};_0x4d0c96(++_0x19a10a);}(_0x40e5,0x15e));var _0x540e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x40e5[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../client');exports[_0x540e('0x0')]=function(){return function(){return client[_0x540e('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x540e('0x2'),_0x540e('0x3'),_0x540e('0x4'),_0x540e('0x5'),_0x540e('0x6'),_0x540e('0x7'),_0x540e('0x8'),'dialMethod',_0x540e('0x9'),_0x540e('0xa'),'dialPowerLevel','dialPredictiveOptimization',_0x540e('0xb'),'dialPredictiveInterval',_0x540e('0xc'),_0x540e('0xd'),_0x540e('0xe'),_0x540e('0xf'),'dialQueueTimeout',_0x540e('0x10'),_0x540e('0x11'),_0x540e('0x12'),_0x540e('0x13'),_0x540e('0x14'),_0x540e('0x15'),_0x540e('0x16'),_0x540e('0x17'),_0x540e('0x18'),_0x540e('0x19'),_0x540e('0x1a'),'dialCheckDuplicateType',_0x540e('0x1b'),_0x540e('0x1c'),_0x540e('0x1d'),_0x540e('0x1e'),'dialAMDTotalAnalysisTime',_0x540e('0x1f'),_0x540e('0x20'),_0x540e('0x21'),'dialAMDSilenceThreshold',_0x540e('0x22'),_0x540e('0x23'),'dialRecallMeTimeout',_0x540e('0x24'),_0x540e('0x25'),_0x540e('0x26'),_0x540e('0x27'),_0x540e('0x28'),_0x540e('0x6'),_0x540e('0x29'),'dialRandomLastDigitCallerIdNumber',_0x540e('0x2a'),_0x540e('0x2b'),_0x540e('0x2c'),_0x540e('0x2d'),_0x540e('0x2e'),'dialAbandonedMaxRetry',_0x540e('0x2f'),'dialMachineMaxRetry',_0x540e('0x30'),_0x540e('0x31'),'dialAgentRejectRetryFrequency',_0x540e('0x32'),'dialPredictiveIntervalMaxThreshold',_0x540e('0x33'),_0x540e('0x34'),_0x540e('0x35'),'callAdditionalPhoneAfterMin'],'include':[{'model':'Trunk','as':_0x540e('0x36'),'attributes':['id',_0x540e('0x2'),'callerid',_0x540e('0x37')]},{'model':_0x540e('0x38'),'as':_0x540e('0x39'),'attributes':['id',_0x540e('0x2')]},{'model':_0x540e('0x36'),'as':_0x540e('0x3a'),'attributes':['id','name',_0x540e('0x3b'),_0x540e('0x37')]},{'model':_0x540e('0x3c'),'as':'Interval','attributes':['id',_0x540e('0x2')],'include':[{'model':_0x540e('0x3c'),'as':_0x540e('0x3d'),'attributes':['id',_0x540e('0x2'),_0x540e('0x3e')]}]}]},'log':_0x540e('0x0')});};}; \ No newline at end of file +var _0x1129=['interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals'];(function(_0x4660a5,_0x37edfa){var _0x234ebe=function(_0x1cac1e){while(--_0x1cac1e){_0x4660a5['push'](_0x4660a5['shift']());}};_0x234ebe(++_0x37edfa);}(_0x1129,0x1a5));var _0x9112=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1129[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x9112('0x0'));exports[_0x9112('0x1')]=function(){return function(){return client[_0x9112('0x2')](_0x9112('0x3'),{'options':{'raw':![],'attributes':['id',_0x9112('0x4'),'acw',_0x9112('0x5'),'autopause',_0x9112('0x6'),_0x9112('0x7'),_0x9112('0x8'),_0x9112('0x9'),_0x9112('0xa'),'dialLimitQueue','dialPowerLevel',_0x9112('0xb'),_0x9112('0xc'),'dialPredictiveInterval',_0x9112('0xd'),_0x9112('0xe'),_0x9112('0xf'),_0x9112('0x10'),_0x9112('0x11'),_0x9112('0x12'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x9112('0x13'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x9112('0x14'),'dialGlobalMaxRetry',_0x9112('0x15'),_0x9112('0x16'),_0x9112('0x17'),_0x9112('0x18'),'dialAMDActive',_0x9112('0x19'),'dialAMDGreeting',_0x9112('0x1a'),_0x9112('0x1b'),_0x9112('0x1c'),_0x9112('0x1d'),_0x9112('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x9112('0x1f'),_0x9112('0x20'),_0x9112('0x21'),_0x9112('0x22'),_0x9112('0x23'),_0x9112('0x24'),_0x9112('0x25'),_0x9112('0x6'),_0x9112('0x26'),_0x9112('0x27'),_0x9112('0x28'),_0x9112('0x29'),_0x9112('0x2a'),_0x9112('0x2b'),_0x9112('0x2c'),_0x9112('0x2d'),_0x9112('0x2e'),'dialMachineMaxRetry',_0x9112('0x2f'),_0x9112('0x30'),_0x9112('0x31'),'mandatoryDisposition',_0x9112('0x32'),_0x9112('0x33'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':_0x9112('0x34'),'as':_0x9112('0x34'),'attributes':['id',_0x9112('0x4'),_0x9112('0x35'),_0x9112('0x36')]},{'model':'Pause','as':_0x9112('0x37'),'attributes':['id','name']},{'model':_0x9112('0x34'),'as':_0x9112('0x38'),'attributes':['id','name',_0x9112('0x35'),_0x9112('0x36')]},{'model':_0x9112('0x39'),'as':_0x9112('0x39'),'attributes':['id',_0x9112('0x4')],'include':[{'model':_0x9112('0x39'),'as':_0x9112('0x3a'),'attributes':['id',_0x9112('0x4'),_0x9112('0x3b')]}]}]},'log':_0x9112('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 0945f4a..14f4169 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(_0x214349,_0x536795){var _0x40cc6b=function(_0x5e806b){while(--_0x5e806b){_0x214349['push'](_0x214349['shift']());}};_0x40cc6b(++_0x536795);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x36c23f,_0x762258){var _0x176e18=function(_0x19936b){while(--_0x19936b){_0x36c23f['push'](_0x36c23f['shift']());}};_0x176e18(++_0x762258);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 13dc56a..0f24208 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 _0xfcec=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x8842e9,_0x1743e5){var _0x2f2e9d=function(_0x555209){while(--_0x555209){_0x8842e9['push'](_0x8842e9['shift']());}};_0x2f2e9d(++_0x1743e5);}(_0xfcec,0xbb));var _0xcfce=function(_0x1f15d4,_0x547ee1){_0x1f15d4=_0x1f15d4-0x0;var _0x407670=_0xfcec[_0x1f15d4];return _0x407670;};'use strict';var client=require(_0xcfce('0x0'));exports[_0xcfce('0x1')]=function(_0x1a4e3e){return function(){return client[_0xcfce('0x2')](_0xcfce('0x3'),{'options':{'where':{'VoiceQueueId':_0x1a4e3e,'paused':!![]},'raw':!![]},'log':_0xcfce('0x1')});};}; \ No newline at end of file +var _0x8b1f=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1ef50e,_0x137ac4){var _0x3a3e=function(_0xcdc601){while(--_0xcdc601){_0x1ef50e['push'](_0x1ef50e['shift']());}};_0x3a3e(++_0x137ac4);}(_0x8b1f,0x15e));var _0xf8b1=function(_0x5ec8ba,_0x471eec){_0x5ec8ba=_0x5ec8ba-0x0;var _0x2cb855=_0x8b1f[_0x5ec8ba];return _0x2cb855;};'use strict';var client=require(_0xf8b1('0x0'));exports[_0xf8b1('0x1')]=function(_0x31b1ec){return function(){return client[_0xf8b1('0x2')](_0xf8b1('0x3'),{'options':{'where':{'VoiceQueueId':_0x31b1ec,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3d1f125..50aa1ee 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(_0xd804c2,_0x42b01b){var _0x24179c=function(_0x11f921){while(--_0x11f921){_0xd804c2['push'](_0xd804c2['shift']());}};_0x24179c(++_0x42b01b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x24894d,_0x368e3f){var _0x540db2=function(_0x4a709d){while(--_0x4a709d){_0x24894d['push'](_0x24894d['shift']());}};_0x540db2(++_0x368e3f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 9891543..8b5ebbf 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 _0xd135=['transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xd135,0x116));var _0x5d13=function(_0x262254,_0x3a5e0e){_0x262254=_0x262254-0x0;var _0x5d2944=_0xd135[_0x262254];return _0x5d2944;};'use strict';var client=require(_0x5d13('0x0'));exports[_0x5d13('0x1')]={};exports[_0x5d13('0x2')]=function(_0x34ccb9){return client[_0x5d13('0x3')](_0x5d13('0x4'),{'body':{'result':_0x34ccb9[_0x5d13('0x5')],'transfererchannel':_0x34ccb9['transfererchannel'],'transferercalleridnum':_0x34ccb9['transferercalleridnum'],'transferercalleridname':_0x34ccb9[_0x5d13('0x6')],'transfererconnectedlinenum':_0x34ccb9[_0x5d13('0x7')],'transfererconnectedlinename':_0x34ccb9[_0x5d13('0x8')],'transfereraccountcode':_0x34ccb9['transfereraccountcode'],'transferercontext':_0x34ccb9[_0x5d13('0x9')],'transfererexten':_0x34ccb9['transfererexten'],'transfererlinkedid':_0x34ccb9[_0x5d13('0xa')],'transfereechannel':_0x34ccb9[_0x5d13('0xb')],'transfereecalleridnum':_0x34ccb9[_0x5d13('0xc')],'transfereecalleridname':_0x34ccb9[_0x5d13('0xd')],'transfereeconnectedlinenum':_0x34ccb9[_0x5d13('0xe')],'transfereeconnectedlinename':_0x34ccb9[_0x5d13('0xf')],'transfereeaccountcode':_0x34ccb9[_0x5d13('0x10')],'transfereecontext':_0x34ccb9[_0x5d13('0x11')],'transfereeexten':_0x34ccb9['transfereeexten'],'transfereelinkedid':_0x34ccb9[_0x5d13('0x12')],'isexternal':_0x34ccb9[_0x5d13('0x13')],'context':_0x34ccb9[_0x5d13('0x14')],'extension':_0x34ccb9[_0x5d13('0x15')],'type':'blind'},'log':_0x5d13('0x4')});};exports[_0x5d13('0x16')]=function(_0x950841){return client[_0x5d13('0x3')](_0x5d13('0x4'),{'body':{'result':_0x950841[_0x5d13('0x5')],'transfererchannel':_0x950841[_0x5d13('0x17')],'transferercalleridnum':_0x950841[_0x5d13('0x18')],'transferercalleridname':_0x950841['origtransferercalleridname'],'transfererconnectedlinenum':_0x950841[_0x5d13('0x19')],'transfererconnectedlinename':_0x950841[_0x5d13('0x1a')],'transfereraccountcode':_0x950841[_0x5d13('0x1b')],'transferercontext':_0x950841[_0x5d13('0x1c')],'transfererexten':_0x950841[_0x5d13('0x1d')],'transfererlinkedid':_0x950841[_0x5d13('0x1e')],'transfereechannel':_0x950841['transfertargetchannel'],'transfereecalleridnum':_0x950841['transfertargetcalleridnum'],'transfereecalleridname':_0x950841['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x950841['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x950841[_0x5d13('0x1f')],'transfereeaccountcode':_0x950841['transfertargetaccountcode'],'transfereecontext':_0x950841[_0x5d13('0x20')],'transfereeexten':_0x950841[_0x5d13('0x21')],'transfereelinkedid':_0x950841[_0x5d13('0x22')],'isexternal':_0x950841[_0x5d13('0x13')],'context':_0x950841['origtransferercontext'],'extension':_0x950841[_0x5d13('0x23')],'type':_0x5d13('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x5e08=['transfers','Request','CreateVoiceTransferReport','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','attended','../client'];(function(_0x1370b5,_0x557b1a){var _0x841db7=function(_0x1e9625){while(--_0x1e9625){_0x1370b5['push'](_0x1370b5['shift']());}};_0x841db7(++_0x557b1a);}(_0x5e08,0xb3));var _0x85e0=function(_0x3f5980,_0x5bf76e){_0x3f5980=_0x3f5980-0x0;var _0x1155d4=_0x5e08[_0x3f5980];return _0x1155d4;};'use strict';var client=require(_0x85e0('0x0'));exports[_0x85e0('0x1')]={};exports['blindTransfer']=function(_0x2082b4){return client[_0x85e0('0x2')](_0x85e0('0x3'),{'body':{'result':_0x2082b4['result'],'transfererchannel':_0x2082b4['transfererchannel'],'transferercalleridnum':_0x2082b4[_0x85e0('0x4')],'transferercalleridname':_0x2082b4['transferercalleridname'],'transfererconnectedlinenum':_0x2082b4['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2082b4[_0x85e0('0x5')],'transfereraccountcode':_0x2082b4[_0x85e0('0x6')],'transferercontext':_0x2082b4[_0x85e0('0x7')],'transfererexten':_0x2082b4[_0x85e0('0x8')],'transfererlinkedid':_0x2082b4[_0x85e0('0x9')],'transfereechannel':_0x2082b4[_0x85e0('0xa')],'transfereecalleridnum':_0x2082b4[_0x85e0('0xb')],'transfereecalleridname':_0x2082b4[_0x85e0('0xc')],'transfereeconnectedlinenum':_0x2082b4[_0x85e0('0xd')],'transfereeconnectedlinename':_0x2082b4['transfereeconnectedlinename'],'transfereeaccountcode':_0x2082b4[_0x85e0('0xe')],'transfereecontext':_0x2082b4[_0x85e0('0xf')],'transfereeexten':_0x2082b4[_0x85e0('0x10')],'transfereelinkedid':_0x2082b4['transfereelinkedid'],'isexternal':_0x2082b4[_0x85e0('0x11')],'context':_0x2082b4[_0x85e0('0x12')],'extension':_0x2082b4[_0x85e0('0x13')],'type':'blind'},'log':_0x85e0('0x3')});};exports[_0x85e0('0x14')]=function(_0x264762){return client['Request'](_0x85e0('0x3'),{'body':{'result':_0x264762[_0x85e0('0x15')],'transfererchannel':_0x264762[_0x85e0('0x16')],'transferercalleridnum':_0x264762[_0x85e0('0x17')],'transferercalleridname':_0x264762[_0x85e0('0x18')],'transfererconnectedlinenum':_0x264762['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x264762['secondtransfererconnectedlinename'],'transfereraccountcode':_0x264762[_0x85e0('0x19')],'transferercontext':_0x264762['secondtransferercontext'],'transfererexten':_0x264762[_0x85e0('0x1a')],'transfererlinkedid':_0x264762[_0x85e0('0x1b')],'transfereechannel':_0x264762[_0x85e0('0x1c')],'transfereecalleridnum':_0x264762[_0x85e0('0x1d')],'transfereecalleridname':_0x264762[_0x85e0('0x1e')],'transfereeconnectedlinenum':_0x264762[_0x85e0('0x1f')],'transfereeconnectedlinename':_0x264762['transfertargetconnectedlinename'],'transfereeaccountcode':_0x264762[_0x85e0('0x20')],'transfereecontext':_0x264762[_0x85e0('0x21')],'transfereeexten':_0x264762[_0x85e0('0x22')],'transfereelinkedid':_0x264762['transfertargetlinkedid'],'isexternal':_0x264762[_0x85e0('0x11')],'context':_0x264762['origtransferercontext'],'extension':_0x264762['origtransfererexten'],'type':_0x85e0('0x23')},'log':_0x85e0('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ae1dc24..eb47ab4 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 _0x814b=['127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','catch','command','Command','then','content','message','voiceQueues','hasOwnProperty','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','channels','voicechannel','map','uniqueid','%s.%s','filename','wav','channel','toLowerCase','isNil','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','resolve','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x814b,0x1a2));var _0xb814=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x814b[_0x56fb33];return _0x435ee4;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var jayson=require(_0xb814('0x2'));var schema=require(_0xb814('0x3'));var BPromise=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var config=require('../../../config/environment');var properties=require(_0xb814('0x6'));var ami=require(_0xb814('0x7'));exports[_0xb814('0x8')]=function(_0x4237bc,_0x44931c,_0x322a70){return new BPromise(function(_0x53e507,_0x3b0829){var _0x2e6272={'QueuePause':function(_0x5c8539){return new Promise(function(_0x271af9,_0x2913a6){var _0x186d5a=util[_0xb814('0x9')](_0xb814('0xa'),_0xb814('0xb'),_0x5c8539[_0xb814('0xc')]);if(_0x4237bc[_0xb814('0xd')]&&_0x4237bc[_0xb814('0xd')][_0x186d5a]&&_0x4237bc[_0xb814('0xd')][_0x186d5a][_0xb814('0xe')]){_0x4237bc['timers'][_0x186d5a][_0xb814('0xf')]();}if(_0x4237bc['agents'][_0x186d5a]){_0x4237bc[_0xb814('0x10')][_0x186d5a][_0xb814('0x11')]({'statePause':_0x5c8539[_0xb814('0x12')]?!![]:![]});}_0x271af9({'code':0xc8,'message':_0xb814('0x13')});});},'Reload':function(_0x2ce718){var _0x3bde14=this;return new Promise(function(_0x1438e7,_0x41ed7b){if(ami[_0xb814('0x14')]()==![]){return _0x41ed7b(_0x3bde14[_0xb814('0x15')](0x1f4,[config[_0xb814('0x16')]['ip'],config[_0xb814('0x16')][_0xb814('0x17')],_0xb814('0x18')][_0xb814('0x19')]('\x20')));}_0x2ce718=_[_0xb814('0x1a')](_0x2ce718,_[_0xb814('0x1b')](properties[_0xb814('0x1c')]));_0x2ce718[_0xb814('0x1d')]=_0xb814('0x1e');return ami[_0xb814('0x1f')](_0x2ce718)['then'](function(_0x168a48){_0x1438e7({'code':0xc8,'message':_0x168a48['message']});})[_0xb814('0x20')](function(_0xfac75b){_0x41ed7b(_0x3bde14['error'](0x1f5,_0xfac75b['message']));});});},'Command':function(_0x55d63c){var _0x399b43=this;return new Promise(function(_0x4d5276,_0x57c128){if(ami[_0xb814('0x14')]()==![]){return _0x57c128(_0x399b43[_0xb814('0x15')](0x1f4,[config[_0xb814('0x16')]['ip'],config['asterisk'][_0xb814('0x17')],'ami\x20disconnected'][_0xb814('0x19')]('\x20')));}_0x55d63c=_[_0xb814('0x1a')](_0x55d63c,_0xb814('0x21'));_0x55d63c[_0xb814('0x1d')]=_0xb814('0x22');return ami[_0xb814('0x1f')](_0x55d63c)[_0xb814('0x23')](function(_0x594470){_0x4d5276({'code':0xc8,'message':_0x594470[_0xb814('0x24')]});})['catch'](function(_0x3f81d0){_0x57c128(_0x399b43[_0xb814('0x15')](0x1f5,_0x3f81d0[_0xb814('0x25')]));});});},'VoiceQueues':function(_0x208927){return new Promise(function(_0x1c8a2e,_0xb9e57d){var _0x3d836c=[];for(var _0x5755ea in _0x4237bc[_0xb814('0x26')]){if(_0x4237bc[_0xb814('0x26')][_0xb814('0x27')](_0x5755ea)){var _0x349394=_0x4237bc[_0xb814('0x26')][_0x5755ea];var _0x1d5965={'id':_0x349394['id'],'name':_0x349394[_0xb814('0xc')],'strategy':_0x349394[_0xb814('0x28')],'answered':_0x349394['answered'],'available':_0x349394[_0xb814('0x29')],'loggedIn':_0x349394[_0xb814('0x2a')],'pTalking':_0x349394['pTalking'],'sumBillable':_0x349394[_0xb814('0x2b')],'sumDuration':_0x349394[_0xb814('0x2c')],'sumHoldTime':_0x349394[_0xb814('0x2d')]||0x0,'talking':_0x349394['talking'],'total':_0x349394[_0xb814('0x2e')],'type':_0x349394[_0xb814('0x2f')],'unmanaged':_0x349394['unmanaged'],'abandoned':_0x349394[_0xb814('0x30')],'waiting':_0x349394['waiting'],'loggedInDb':_0x349394[_0xb814('0x31')]};if(_0x349394['type']==='outbound'){_0x1d5965[_0xb814('0x32')]=_0x349394['dialActive'];_0x1d5965[_0xb814('0x33')]=_0x349394[_0xb814('0x33')];_0x1d5965[_0xb814('0x34')]=_0x349394['dialOriginateCallerIdName'];_0x1d5965['dialOriginateCallerIdNumber']=_0x349394[_0xb814('0x35')];_0x1d5965[_0xb814('0x36')]=_0x349394['dialOriginateTimeout'];_0x1d5965[_0xb814('0x37')]=_0x349394[_0xb814('0x37')];_0x1d5965[_0xb814('0x38')]=_0x349394[_0xb814('0x38')];_0x1d5965[_0xb814('0x39')]=_0x349394[_0xb814('0x39')];_0x1d5965[_0xb814('0x3a')]=_0x349394['outboundAnswerCallsDay'];_0x1d5965[_0xb814('0x3b')]=_0x349394[_0xb814('0x3b')];_0x1d5965[_0xb814('0x3c')]=_0x349394[_0xb814('0x3c')];_0x1d5965[_0xb814('0x3d')]=_0x349394['outboundCongestionCallsDay'];_0x1d5965[_0xb814('0x3e')]=_0x349394['outboundDropCallsDayACS'];_0x1d5965[_0xb814('0x3f')]=_0x349394[_0xb814('0x3f')];_0x1d5965[_0xb814('0x40')]=_0x349394['outboundDropCallsDayTimeout'];_0x1d5965[_0xb814('0x41')]=_0x349394[_0xb814('0x41')];_0x1d5965['outboundNoSuchCallsDay']=_0x349394[_0xb814('0x42')];_0x1d5965[_0xb814('0x43')]=_0x349394[_0xb814('0x43')];_0x1d5965[_0xb814('0x44')]=_0x349394[_0xb814('0x44')];_0x1d5965[_0xb814('0x45')]=_0x349394['outboundRejectCallsDay'];_0x1d5965[_0xb814('0x46')]=_0x349394['outboundUnknownCallsDay'];_0x1d5965[_0xb814('0x47')]=_0x349394['predictiveIntervalAnsweredCalls'];_0x1d5965[_0xb814('0x48')]=_0x349394['predictiveIntervalAvgHoldtime'];_0x1d5965[_0xb814('0x49')]=_0x349394[_0xb814('0x49')];_0x1d5965['predictiveIntervalDroppedCallsCallersExit']=_0x349394['predictiveIntervalDroppedCallsCallersExit'];_0x1d5965['predictiveIntervalDroppedCallsTimeout']=_0x349394['predictiveIntervalDroppedCallsTimeout'];_0x1d5965[_0xb814('0x4a')]=_0x349394[_0xb814('0x4a')];_0x1d5965[_0xb814('0x4b')]=_0x349394[_0xb814('0x4b')];_0x1d5965['predictiveIntervalHitRate']=_0x349394['predictiveIntervalHitRate'];_0x1d5965[_0xb814('0x4c')]=_0x349394['predictiveIntervalMultiplicativeFactor'];_0x1d5965[_0xb814('0x4d')]=_0x349394[_0xb814('0x4d')];_0x1d5965[_0xb814('0x4e')]=_0x349394[_0xb814('0x4e')];_0x1d5965[_0xb814('0x4f')]=_0x349394[_0xb814('0x4f')];_0x1d5965[_0xb814('0x25')]=_0x349394[_0xb814('0x25')];_0x1d5965[_0xb814('0x50')]=_0x349394['originated'];_0x1d5965['erlangCalls']=_0x349394['erlangCalls'];_0x1d5965[_0xb814('0x51')]=_0x349394['erlangCallToSecond'];_0x1d5965[_0xb814('0x52')]=_0x349394['erlangAbandonmentRate'];_0x1d5965[_0xb814('0x53')]=_0x349394[_0xb814('0x53')];_0x1d5965[_0xb814('0x54')]=_0x349394[_0xb814('0x54')];_0x1d5965['startProgressive']=_0x349394[_0xb814('0x55')];}if(_0x349394[_0xb814('0x56')]){_0x1d5965[_0xb814('0x56')]={'id':_0x349394[_0xb814('0x56')]['id'],'name':_0x349394[_0xb814('0x56')][_0xb814('0xc')],'active':_0x349394['Trunk'][_0xb814('0x57')],'callerid':_0x349394[_0xb814('0x56')][_0xb814('0x58')]};}if(_0x349394[_0xb814('0x59')]){_0x1d5965[_0xb814('0x59')]={'id':_0x349394[_0xb814('0x59')]['id'],'name':_0x349394[_0xb814('0x59')]['name']};}_0x3d836c['push'](_0x1d5965);}}_0x1c8a2e({'count':_0x3d836c[_0xb814('0x5a')],'rows':_0x3d836c});});},'UpdateVoiceQueue':function(_0x29c7ac){return new Promise(function(_0x4c08d6,_0x2bf906){var _0x43f1b=_[_0xb814('0x5b')](_0x4237bc[_0xb814('0x26')],{'id':parseInt(_0x29c7ac['id'])});var _0x40af85=_[_0xb814('0x5c')](_0x29c7ac,['id']);if(_0x43f1b){for(var _0x344198 in _0x40af85){if(typeof _0x40af85[_0x344198]!==_0xb814('0x5d')&&typeof _0x43f1b[_0x344198]!=='undefined'){_0x43f1b[_0x344198]=_0x40af85[_0x344198];}}_0x4c08d6(_0x43f1b);}else{_0x2bf906();}});},'VoiceChannels':function(_0x37800a){return new Promise(function(_0x17510c,_0x4a76bb){var _0x338e80=_['values'](_0x4237bc[_0xb814('0x5e')]);_0x17510c({'count':_0x338e80[_0xb814('0x5a')],'rows':_0x338e80});});},'VoiceChannelMixMonitor':function(_0xc71270){var _0x22b2ef=this;return new Promise(function(_0x1d3833,_0x4096d4){if(ami[_0xb814('0x14')]()==![]){return _0x4096d4(_0x22b2ef[_0xb814('0x15')](0x1f4,[config[_0xb814('0x16')]['ip'],config[_0xb814('0x16')]['username'],'ami\x20disconnected'][_0xb814('0x19')]('\x20')));}var _0x30f07b=schema(properties[_0xb814('0x5f')])[_0xb814('0x3')](_0xc71270);if(_0x30f07b[_0xb814('0x5a')]>0x0){return _0x4096d4(_0x22b2ef[_0xb814('0x15')](0x1f4,_[_0xb814('0x60')](_0x30f07b,'message')[_0xb814('0x19')](',\x20')));}var _0x388324=_[_0xb814('0x5b')](_0x4237bc['channels'],{'uniqueid':_0xc71270[_0xb814('0x61')]});if(_0x388324&&_0x388324['channel']){var _0x252293=util['format'](_0xb814('0x62'),_0xc71270[_0xb814('0x63')]||_0xc71270['uniqueid'],_0xc71270[_0xb814('0x9')]||_0xb814('0x64'));return ami[_0xb814('0x1f')]({'action':'MixMonitor','channel':_0x388324[_0xb814('0x65')],'file':_0x252293,'options':'ai(mixmonitorid)'})[_0xb814('0x23')](function(_0x158893){var _0x4aed78=_[_0xb814('0x5b')](_0x388324['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x252293[_0xb814('0x66')]()});if(_[_0xb814('0x67')](_0x4aed78)){_0x388324[_0xb814('0x68')]['push']({'filename':_0xb814('0x69')+_0x252293['toLowerCase'](),'createdAt':moment()[_0xb814('0x9')](_0xb814('0x6a')),'mixmonitorid':_0x158893['mixmonitorid'],'status':_0xb814('0x6b')});}else{_0x4aed78['mixmonitorid']=_0x158893[_0xb814('0x6c')];_0x4aed78[_0xb814('0x6d')]=_0xb814('0x6b');}_0x1d3833({'code':0xc8,'message':[_0xc71270[_0xb814('0x61')],_0xb814('0x6e'),_0x158893[_0xb814('0x6c')]][_0xb814('0x19')]('\x20'),'mixmonitorid':_0x158893[_0xb814('0x6c')]});})['catch'](function(_0x374532){_0x4096d4(_0x22b2ef[_0xb814('0x15')](0x1f5,[_0xc71270['uniqueid'],_0x374532[_0xb814('0x25')][_0xb814('0x66')]()]['join']('\x20')));});}else{return _0x4096d4(_0x22b2ef[_0xb814('0x15')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x48362c){var _0x2114ca=this;return new Promise(function(_0x5257be,_0x3ff213){if(ami[_0xb814('0x14')]()==![]){return _0x3ff213(_0x2114ca[_0xb814('0x15')](0x1f4,[config['asterisk']['ip'],config[_0xb814('0x16')]['username'],_0xb814('0x18')][_0xb814('0x19')]('\x20')));}var _0x1236d4=schema(properties[_0xb814('0x5f')])[_0xb814('0x3')](_0x48362c);if(_0x1236d4[_0xb814('0x5a')]>0x0){return _0x3ff213(_0x2114ca[_0xb814('0x15')](0x1f4,_[_0xb814('0x60')](_0x1236d4,_0xb814('0x25'))['join'](',\x20')));}var _0x211194=_[_0xb814('0x5b')](_0x4237bc[_0xb814('0x5e')],{'uniqueid':_0x48362c[_0xb814('0x61')]});if(_0x211194){return BPromise[_0xb814('0x6f')]()[_0xb814('0x23')](function(){if(_0x211194['channel']){return ami[_0xb814('0x1f')]({'action':'StopMixMonitor','channel':_0x211194[_0xb814('0x65')],'mixmonitorid':_0x48362c[_0xb814('0x6c')]})[_0xb814('0x20')](function(_0x4c884c){});}})[_0xb814('0x23')](function(){if(_0x211194['destinationchannel']){return ami[_0xb814('0x1f')]({'action':'StopMixMonitor','channel':_0x211194[_0xb814('0x70')],'mixmonitorid':_0x48362c[_0xb814('0x6c')]})[_0xb814('0x20')](function(_0x1b024f){});}})[_0xb814('0x23')](function(_0x167d82){var _0x143518=_['find'](_0x211194[_0xb814('0x68')],{'mixmonitorid':_0x48362c['mixmonitorid']});if(_0x143518){_0x143518[_0xb814('0x6d')]=_0xb814('0x71');}})[_0xb814('0x23')](function(){var _0x3dcaeb=util[_0xb814('0x9')](_0xb814('0x62'),_0x48362c['filename']||_0x48362c[_0xb814('0x61')],_0x48362c[_0xb814('0x9')]||'wav');var _0x3bb2b4=_[_0xb814('0x5b')](_0x211194[_0xb814('0x68')],{'filename':_0xb814('0x69')+_0x3dcaeb[_0xb814('0x66')]()});if(_0x3bb2b4){_0x3bb2b4['status']=_0xb814('0x71');}})['then'](function(){_0x5257be({'code':0xc8,'message':[_0x48362c[_0xb814('0x61')],_0xb814('0x72')][_0xb814('0x19')]('\x20')});})[_0xb814('0x20')](function(_0x2e39b1){_0x3ff213(_0x2114ca[_0xb814('0x15')](0x1f5,[_0x48362c['uniqueid'],_0x2e39b1['message']['toLowerCase']()][_0xb814('0x19')]('\x20')));});}else{return _0x3ff213(_0x2114ca['error'](0x1f5,_0xb814('0x73')));}});},'VoiceQueuesChannels':function(_0x1d3954){return new Promise(function(_0x25db89,_0x5e966c){var _0x1b76fa=_[_0xb814('0x74')](_0x4237bc[_0xb814('0x75')]);_0x25db89({'count':_0x1b76fa['length'],'rows':_0x1b76fa});});},'VoiceQueuesChannel':function(_0x30f717){var _0x1bf0b7=this;return new Promise(function(_0x1f39c0,_0x3564e0){var _0x555be0=schema(properties['voicequeuechannel'])[_0xb814('0x3')](_0x30f717);if(_0x555be0[_0xb814('0x5a')]>0x0){return _0x3564e0(_0x1bf0b7[_0xb814('0x15')](0x1f4,_[_0xb814('0x60')](_0x555be0,_0xb814('0x25'))[_0xb814('0x19')](',\x20')));}var _0x34a0b3=_[_0xb814('0x5b')](_0x4237bc[_0xb814('0x75')],{'uniqueid':_0x30f717[_0xb814('0x61')]});if(_0x34a0b3){_0x1f39c0(_0x34a0b3);}else{return _0x3564e0(_0x1bf0b7[_0xb814('0x15')](0x1f5,_0xb814('0x73')));}});},'VoiceQueuesChannelHangup':function(_0x3ef474){var _0x21fc41=this;return new Promise(function(_0xc94e99,_0x55a9c4){if(ami[_0xb814('0x14')]()==![]){return _0x55a9c4(_0x21fc41[_0xb814('0x15')](0x1f4,[config[_0xb814('0x16')]['ip'],config[_0xb814('0x16')][_0xb814('0x17')],_0xb814('0x18')]['join']('\x20')));}var _0xff4dc2=schema(properties['voicequeuechannelhangup'])[_0xb814('0x3')](_0x3ef474);if(_0xff4dc2[_0xb814('0x5a')]>0x0){return _0x55a9c4(_0x21fc41[_0xb814('0x15')](0x1f4,_[_0xb814('0x60')](_0xff4dc2,_0xb814('0x25'))['join'](',\x20')));}var _0x4c44ee=_[_0xb814('0x5b')](_0x4237bc[_0xb814('0x75')],{'uniqueid':_0x3ef474[_0xb814('0x61')]});if(_0x4c44ee&&_0x4c44ee[_0xb814('0x65')]){return ami['Action']({'action':_0xb814('0x76'),'channel':_0x4c44ee['channel']})[_0xb814('0x23')](function(_0x227cbd){_0xc94e99({'code':0xc8,'message':[_0x3ef474['uniqueid'],_0x227cbd['message'][_0xb814('0x66')]()]['join']('\x20')});})[_0xb814('0x20')](function(_0x163c2b){_0x55a9c4(_0x21fc41[_0xb814('0x15')](0x1f5,[_0x3ef474[_0xb814('0x61')],_0x163c2b[_0xb814('0x25')][_0xb814('0x66')]()][_0xb814('0x19')]('\x20')));});}else{return _0x55a9c4(_0x21fc41['error'](0x1f5,_0xb814('0x73')));}});},'VoiceQueuesChannelRedirect':function(_0x54413d){var _0x212456=this;return new Promise(function(_0x590145,_0x2838cb){if(ami[_0xb814('0x14')]()==![]){return _0x2838cb(_0x212456['error'](0x1f4,[config[_0xb814('0x16')]['ip'],config['asterisk'][_0xb814('0x17')],_0xb814('0x18')]['join']('\x20')));}var _0x5a0c4a=schema(properties[_0xb814('0x77')])[_0xb814('0x3')](_0x54413d);if(_0x5a0c4a[_0xb814('0x5a')]>0x0){return _0x2838cb(_0x212456[_0xb814('0x15')](0x1f4,_[_0xb814('0x60')](_0x5a0c4a,_0xb814('0x25'))[_0xb814('0x19')](',\x20')));}var _0x314600=_[_0xb814('0x5b')](_0x4237bc[_0xb814('0x75')],{'uniqueid':_0x54413d['uniqueid']});if(_0x314600&&_0x314600['channel']){return ami['Action']({'action':'Redirect','channel':_0x314600['channel'],'exten':_0x54413d[_0xb814('0x78')],'context':_0x54413d[_0xb814('0x79')]||_0x314600[_0xb814('0x79')],'priority':0x1})['then'](function(_0x121330){_0x590145({'code':0xc8,'message':[_0x54413d[_0xb814('0x61')],_0x121330[_0xb814('0x25')][_0xb814('0x66')]()][_0xb814('0x19')]('\x20')});})[_0xb814('0x20')](function(_0x3367b8){_0x2838cb(_0x212456[_0xb814('0x15')](0x1f5,[_0x54413d['uniqueid'],_0x3367b8[_0xb814('0x25')][_0xb814('0x66')]()][_0xb814('0x19')]('\x20')));});}else{return _0x2838cb(_0x212456[_0xb814('0x15')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x29c1a4){return new Promise(function(_0x280af5,_0x3f4b23){var _0x3037f2=_[_0xb814('0x74')](_0x4237bc['agents']);_0x280af5({'count':_0x3037f2['length'],'rows':_0x3037f2});});},'Telephones':function(_0x252f9c){return new Promise(function(_0x57b3f2,_0x15bf14){var _0x3882f8=_['values'](_0x4237bc[_0xb814('0x7a')]);_0x57b3f2({'count':_0x3882f8['length'],'rows':_0x3882f8});});},'Trunks':function(_0xe17e86){return new Promise(function(_0x520d0f,_0x44e668){var _0x1aff2b=_[_0xb814('0x74')](_0x4237bc[_0xb814('0x7b')]);_0x520d0f({'count':_0x1aff2b[_0xb814('0x5a')],'rows':_0x1aff2b});});},'OutboundChannels':function(_0x1ae812){return new Promise(function(_0x455b22,_0x4e3115){var _0x5a4e2e=_[_0xb814('0x74')](_0x4237bc['outboundChannels']);_0x455b22({'count':_0x5a4e2e['length'],'rows':_0x5a4e2e});});},'Outbound':function(_0x2d0061){return new Promise(function(_0x8fbda1,_0x25d42d){_0x8fbda1(_0x4237bc['outbound']);});},'Campaigns':function(_0x2a7cde){return new Promise(function(_0x5a25f2,_0xd5d224){var _0x19d508=_[_0xb814('0x74')](_0x4237bc[_0xb814('0x7c')]);_0x5a25f2({'count':_0x19d508['length'],'rows':_0x19d508});});},'VoiceQueuesPreview':function(_0x1454b3){var _0xc0ff3c=this;return new Promise(function(_0x23ce94,_0x506462){_0x44931c[_0xb814('0x7d')](_0x1454b3['id'])[_0xb814('0x23')](function(_0x183b59){_0x23ce94({'code':0xc8,'message':_0x183b59['message']});})[_0xb814('0x20')](function(_0x2d0651){_0x506462(_0xc0ff3c[_0xb814('0x15')](0x1f4,_0x2d0651[_0xb814('0x25')]));});});},'EventManager':function(_0x40b3c5){var _0x1ae8e8=this;return new Promise(function(_0x37a7ab,_0x472c38){if(!_0x40b3c5[_0xb814('0x7e')]){return _0x472c38(_0x1ae8e8[_0xb814('0x15')](0x1f4,_0xb814('0x7f')));}ami[_0xb814('0x80')](_0xb814('0x81')+_0x40b3c5['event'],_0x40b3c5['message']);_0x37a7ab({'code':0xc8,'message':_0x40b3c5});});},'FaxAccounts':function(_0x2308fc){return new Promise(function(_0x50697f,_0x320296){var _0x3949fd=_[_0xb814('0x74')](_0x4237bc[_0xb814('0x82')]);_0x50697f({'count':_0x3949fd[_0xb814('0x5a')],'rows':_0x3949fd});});},'SendFax':function(_0x2f1674){var _0xf0610f=this;return new Promise(function(_0x5db5d0,_0x4a460a){_0x322a70[_0xb814('0x83')](_0x2f1674)['then'](function(_0x18678f){_0x5db5d0({'code':0xc8,'message':_0x18678f[_0xb814('0x25')]});})[_0xb814('0x20')](function(_0x495431){_0x4a460a(_0xf0610f[_0xb814('0x15')](0x1f4,_0x495431[_0xb814('0x25')]));});});},'CheckAfterSend':function(_0x35c60f){var _0x38c6da=this;return new Promise(function(_0x3860b8,_0x491eb1){_0x322a70[_0xb814('0x84')](_0x35c60f)[_0xb814('0x23')](function(_0x4ac8c5){_0x3860b8({'code':0xc8,'message':_0x4ac8c5[_0xb814('0x25')]});})[_0xb814('0x20')](function(_0x3e3f69){_0x491eb1(_0x38c6da['error'](0x1f4,_0x3e3f69[_0xb814('0x25')]));});});}};var _0x46ea9d=jayson['server'](_0x2e6272)[_0xb814('0x85')]();_0x46ea9d['on'](_0xb814('0x15'),function(_0x5b5634){return _0x3b0829(_0x5b5634);});_0x46ea9d[_0xb814('0x8')](0x232a,_0xb814('0x86'),function(){console[_0xb814('0x87')](_0xb814('0x88'),0x232a);return _0x53e507(_0xb814('0x89')+0x232a);});});}; \ No newline at end of file +var _0xafb9=['then','catch','error','message','isConnected','command','Command','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','find','undefined','values','channels','length','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','resolve','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','send','checkAfterSend','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action'];(function(_0x117902,_0x1d0dd2){var _0x429ccf=function(_0x464c8f){while(--_0x464c8f){_0x117902['push'](_0x117902['shift']());}};_0x429ccf(++_0x1d0dd2);}(_0xafb9,0x68));var _0x9afb=function(_0x427f30,_0x1d6d13){_0x427f30=_0x427f30-0x0;var _0x205ddc=_0xafb9[_0x427f30];return _0x205ddc;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var jayson=require(_0x9afb('0x2'));var schema=require(_0x9afb('0x3'));var BPromise=require(_0x9afb('0x4'));var moment=require(_0x9afb('0x5'));var config=require(_0x9afb('0x6'));var properties=require(_0x9afb('0x7'));var ami=require(_0x9afb('0x8'));exports['listen']=function(_0x498463,_0x91ffa0,_0x56a139){return new BPromise(function(_0x1ccf93,_0x548b24){var _0x556880={'QueuePause':function(_0x4c0e9d){return new Promise(function(_0x1edf77,_0x20b8c1){var _0x51dc88=util[_0x9afb('0x9')](_0x9afb('0xa'),_0x9afb('0xb'),_0x4c0e9d[_0x9afb('0xc')]);if(_0x498463[_0x9afb('0xd')]&&_0x498463['timers'][_0x51dc88]&&_0x498463['timers'][_0x51dc88][_0x9afb('0xe')]){_0x498463[_0x9afb('0xd')][_0x51dc88][_0x9afb('0xf')]();}if(_0x498463[_0x9afb('0x10')][_0x51dc88]){_0x498463[_0x9afb('0x10')][_0x51dc88][_0x9afb('0x11')]({'statePause':_0x4c0e9d[_0x9afb('0x12')]?!![]:![]});}_0x1edf77({'code':0xc8,'message':_0x9afb('0x13')});});},'Reload':function(_0x464462){var _0x10602b=this;return new Promise(function(_0x47a804,_0x27137c){if(ami['isConnected']()==![]){return _0x27137c(_0x10602b['error'](0x1f4,[config[_0x9afb('0x14')]['ip'],config[_0x9afb('0x14')][_0x9afb('0x15')],_0x9afb('0x16')][_0x9afb('0x17')]('\x20')));}_0x464462=_[_0x9afb('0x18')](_0x464462,_[_0x9afb('0x19')](properties['module']));_0x464462[_0x9afb('0x1a')]=_0x9afb('0x1b');return ami[_0x9afb('0x1c')](_0x464462)[_0x9afb('0x1d')](function(_0x223aef){_0x47a804({'code':0xc8,'message':_0x223aef['message']});})[_0x9afb('0x1e')](function(_0x50a7e4){_0x27137c(_0x10602b[_0x9afb('0x1f')](0x1f5,_0x50a7e4[_0x9afb('0x20')]));});});},'Command':function(_0x4a856b){var _0x4a1c74=this;return new Promise(function(_0x3ac42f,_0x1217d9){if(ami[_0x9afb('0x21')]()==![]){return _0x1217d9(_0x4a1c74[_0x9afb('0x1f')](0x1f4,[config[_0x9afb('0x14')]['ip'],config['asterisk'][_0x9afb('0x15')],'ami\x20disconnected']['join']('\x20')));}_0x4a856b=_[_0x9afb('0x18')](_0x4a856b,_0x9afb('0x22'));_0x4a856b[_0x9afb('0x1a')]=_0x9afb('0x23');return ami['Action'](_0x4a856b)[_0x9afb('0x1d')](function(_0x725a04){_0x3ac42f({'code':0xc8,'message':_0x725a04['content']});})['catch'](function(_0x5b5dab){_0x1217d9(_0x4a1c74[_0x9afb('0x1f')](0x1f5,_0x5b5dab['message']));});});},'VoiceQueues':function(_0x387379){return new Promise(function(_0x123510,_0x50a919){var _0x324293=[];for(var _0x28beba in _0x498463[_0x9afb('0x24')]){if(_0x498463[_0x9afb('0x24')]['hasOwnProperty'](_0x28beba)){var _0x348255=_0x498463['voiceQueues'][_0x28beba];var _0x29e092={'id':_0x348255['id'],'name':_0x348255['name'],'strategy':_0x348255['strategy'],'answered':_0x348255[_0x9afb('0x25')],'available':_0x348255[_0x9afb('0x26')],'loggedIn':_0x348255[_0x9afb('0x27')],'pTalking':_0x348255[_0x9afb('0x28')],'sumBillable':_0x348255[_0x9afb('0x29')],'sumDuration':_0x348255[_0x9afb('0x2a')],'sumHoldTime':_0x348255[_0x9afb('0x2b')]||0x0,'talking':_0x348255['talking'],'total':_0x348255['total'],'type':_0x348255[_0x9afb('0x2c')],'unmanaged':_0x348255[_0x9afb('0x2d')],'abandoned':_0x348255['abandoned'],'waiting':_0x348255[_0x9afb('0x2e')],'loggedInDb':_0x348255[_0x9afb('0x2f')]};if(_0x348255['type']===_0x9afb('0x30')){_0x29e092[_0x9afb('0x31')]=_0x348255[_0x9afb('0x31')];_0x29e092[_0x9afb('0x32')]=_0x348255[_0x9afb('0x32')];_0x29e092[_0x9afb('0x33')]=_0x348255[_0x9afb('0x33')];_0x29e092[_0x9afb('0x34')]=_0x348255['dialOriginateCallerIdNumber'];_0x29e092['dialOriginateTimeout']=_0x348255[_0x9afb('0x35')];_0x29e092[_0x9afb('0x36')]=_0x348255[_0x9afb('0x36')];_0x29e092[_0x9afb('0x37')]=_0x348255[_0x9afb('0x37')];_0x29e092[_0x9afb('0x38')]=_0x348255[_0x9afb('0x38')];_0x29e092['outboundAnswerCallsDay']=_0x348255['outboundAnswerCallsDay'];_0x29e092[_0x9afb('0x39')]=_0x348255[_0x9afb('0x39')];_0x29e092['outboundBusyCallsDay']=_0x348255[_0x9afb('0x3a')];_0x29e092['outboundCongestionCallsDay']=_0x348255[_0x9afb('0x3b')];_0x29e092[_0x9afb('0x3c')]=_0x348255['outboundDropCallsDayACS'];_0x29e092[_0x9afb('0x3d')]=_0x348255['outboundDropCallsDayCallersExit'];_0x29e092[_0x9afb('0x3e')]=_0x348255[_0x9afb('0x3e')];_0x29e092[_0x9afb('0x3f')]=_0x348255[_0x9afb('0x3f')];_0x29e092[_0x9afb('0x40')]=_0x348255[_0x9afb('0x40')];_0x29e092[_0x9afb('0x41')]=_0x348255[_0x9afb('0x41')];_0x29e092['outboundReCallsDay']=_0x348255[_0x9afb('0x42')];_0x29e092['outboundRejectCallsDay']=_0x348255[_0x9afb('0x43')];_0x29e092[_0x9afb('0x44')]=_0x348255[_0x9afb('0x44')];_0x29e092[_0x9afb('0x45')]=_0x348255[_0x9afb('0x45')];_0x29e092[_0x9afb('0x46')]=_0x348255[_0x9afb('0x46')];_0x29e092[_0x9afb('0x47')]=_0x348255[_0x9afb('0x47')];_0x29e092['predictiveIntervalDroppedCallsCallersExit']=_0x348255[_0x9afb('0x48')];_0x29e092['predictiveIntervalDroppedCallsTimeout']=_0x348255[_0x9afb('0x49')];_0x29e092[_0x9afb('0x4a')]=_0x348255[_0x9afb('0x4a')];_0x29e092['predictiveIntervalErlangCallsDroppedCalls']=_0x348255[_0x9afb('0x4b')];_0x29e092[_0x9afb('0x4c')]=_0x348255[_0x9afb('0x4c')];_0x29e092[_0x9afb('0x4d')]=_0x348255[_0x9afb('0x4d')];_0x29e092[_0x9afb('0x4e')]=_0x348255[_0x9afb('0x4e')];_0x29e092['predictiveIntervalAvailable']=_0x348255[_0x9afb('0x4f')];_0x29e092[_0x9afb('0x50')]=_0x348255[_0x9afb('0x50')];_0x29e092[_0x9afb('0x20')]=_0x348255[_0x9afb('0x20')];_0x29e092[_0x9afb('0x51')]=_0x348255[_0x9afb('0x51')];_0x29e092[_0x9afb('0x52')]=_0x348255['erlangCalls'];_0x29e092[_0x9afb('0x53')]=_0x348255['erlangCallToSecond'];_0x29e092['erlangAbandonmentRate']=_0x348255['erlangAbandonmentRate'];_0x29e092[_0x9afb('0x54')]=_0x348255[_0x9afb('0x54')];_0x29e092['startPredictive']=_0x348255[_0x9afb('0x55')];_0x29e092[_0x9afb('0x56')]=_0x348255[_0x9afb('0x56')];}if(_0x348255[_0x9afb('0x57')]){_0x29e092[_0x9afb('0x57')]={'id':_0x348255[_0x9afb('0x57')]['id'],'name':_0x348255[_0x9afb('0x57')][_0x9afb('0xc')],'active':_0x348255[_0x9afb('0x57')]['active'],'callerid':_0x348255[_0x9afb('0x57')][_0x9afb('0x58')]};}if(_0x348255[_0x9afb('0x59')]){_0x29e092[_0x9afb('0x59')]={'id':_0x348255['Interval']['id'],'name':_0x348255[_0x9afb('0x59')][_0x9afb('0xc')]};}_0x324293[_0x9afb('0x5a')](_0x29e092);}}_0x123510({'count':_0x324293['length'],'rows':_0x324293});});},'UpdateVoiceQueue':function(_0x24f76c){return new Promise(function(_0x1d79b1,_0x13179d){var _0x12eddf=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x24')],{'id':parseInt(_0x24f76c['id'])});var _0x21ce09=_['omit'](_0x24f76c,['id']);if(_0x12eddf){for(var _0x5a36e4 in _0x21ce09){if(typeof _0x21ce09[_0x5a36e4]!=='undefined'&&typeof _0x12eddf[_0x5a36e4]!==_0x9afb('0x5c')){_0x12eddf[_0x5a36e4]=_0x21ce09[_0x5a36e4];}}_0x1d79b1(_0x12eddf);}else{_0x13179d();}});},'VoiceChannels':function(_0x29cde4){return new Promise(function(_0x5a1507,_0x20bd33){var _0xdcfefd=_[_0x9afb('0x5d')](_0x498463[_0x9afb('0x5e')]);_0x5a1507({'count':_0xdcfefd[_0x9afb('0x5f')],'rows':_0xdcfefd});});},'VoiceChannelMixMonitor':function(_0x122a35){var _0xdb82c3=this;return new Promise(function(_0x1de5cf,_0x20abe4){if(ami[_0x9afb('0x21')]()==![]){return _0x20abe4(_0xdb82c3[_0x9afb('0x1f')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x9afb('0x15')],'ami\x20disconnected'][_0x9afb('0x17')]('\x20')));}var _0xd41258=schema(properties[_0x9afb('0x60')])[_0x9afb('0x3')](_0x122a35);if(_0xd41258[_0x9afb('0x5f')]>0x0){return _0x20abe4(_0xdb82c3['error'](0x1f4,_[_0x9afb('0x61')](_0xd41258,'message')[_0x9afb('0x17')](',\x20')));}var _0x222ee0=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x5e')],{'uniqueid':_0x122a35[_0x9afb('0x62')]});if(_0x222ee0&&_0x222ee0[_0x9afb('0x63')]){var _0x449a7e=util['format'](_0x9afb('0x64'),_0x122a35[_0x9afb('0x65')]||_0x122a35[_0x9afb('0x62')],_0x122a35['format']||_0x9afb('0x66'));return ami[_0x9afb('0x1c')]({'action':'MixMonitor','channel':_0x222ee0[_0x9afb('0x63')],'file':_0x449a7e,'options':_0x9afb('0x67')})[_0x9afb('0x1d')](function(_0x5bcea5){var _0x3975c0=_[_0x9afb('0x5b')](_0x222ee0['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x449a7e['toLowerCase']()});if(_[_0x9afb('0x68')](_0x3975c0)){_0x222ee0['monitors'][_0x9afb('0x5a')]({'filename':'/var/spool/asterisk/monitor/'+_0x449a7e[_0x9afb('0x69')](),'createdAt':moment()[_0x9afb('0x9')](_0x9afb('0x6a')),'mixmonitorid':_0x5bcea5['mixmonitorid'],'status':_0x9afb('0x6b')});}else{_0x3975c0[_0x9afb('0x6c')]=_0x5bcea5[_0x9afb('0x6c')];_0x3975c0[_0x9afb('0x6d')]=_0x9afb('0x6b');}_0x1de5cf({'code':0xc8,'message':[_0x122a35[_0x9afb('0x62')],'MixMonitor\x20Success',_0x5bcea5[_0x9afb('0x6c')]][_0x9afb('0x17')]('\x20'),'mixmonitorid':_0x5bcea5[_0x9afb('0x6c')]});})[_0x9afb('0x1e')](function(_0x54aeff){_0x20abe4(_0xdb82c3[_0x9afb('0x1f')](0x1f5,[_0x122a35[_0x9afb('0x62')],_0x54aeff['message'][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')));});}else{return _0x20abe4(_0xdb82c3[_0x9afb('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x347ce8){var _0x12b44e=this;return new Promise(function(_0x158dfd,_0x41bb8e){if(ami[_0x9afb('0x21')]()==![]){return _0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f4,[config[_0x9afb('0x14')]['ip'],config[_0x9afb('0x14')][_0x9afb('0x15')],_0x9afb('0x16')][_0x9afb('0x17')]('\x20')));}var _0x2404aa=schema(properties[_0x9afb('0x60')])['validate'](_0x347ce8);if(_0x2404aa[_0x9afb('0x5f')]>0x0){return _0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f4,_['map'](_0x2404aa,_0x9afb('0x20'))[_0x9afb('0x17')](',\x20')));}var _0x597bc7=_['find'](_0x498463[_0x9afb('0x5e')],{'uniqueid':_0x347ce8[_0x9afb('0x62')]});if(_0x597bc7){return BPromise[_0x9afb('0x6e')]()[_0x9afb('0x1d')](function(){if(_0x597bc7[_0x9afb('0x63')]){return ami['Action']({'action':_0x9afb('0x6f'),'channel':_0x597bc7[_0x9afb('0x63')],'mixmonitorid':_0x347ce8[_0x9afb('0x6c')]})[_0x9afb('0x1e')](function(_0xcd741f){});}})[_0x9afb('0x1d')](function(){if(_0x597bc7[_0x9afb('0x70')]){return ami[_0x9afb('0x1c')]({'action':'StopMixMonitor','channel':_0x597bc7[_0x9afb('0x70')],'mixmonitorid':_0x347ce8['mixmonitorid']})[_0x9afb('0x1e')](function(_0x1ff543){});}})[_0x9afb('0x1d')](function(_0x22ffa){var _0x20b9d4=_['find'](_0x597bc7['monitors'],{'mixmonitorid':_0x347ce8[_0x9afb('0x6c')]});if(_0x20b9d4){_0x20b9d4[_0x9afb('0x6d')]=_0x9afb('0x71');}})[_0x9afb('0x1d')](function(){var _0x1ecbd1=util['format'](_0x9afb('0x64'),_0x347ce8[_0x9afb('0x65')]||_0x347ce8['uniqueid'],_0x347ce8[_0x9afb('0x9')]||_0x9afb('0x66'));var _0x480c4a=_[_0x9afb('0x5b')](_0x597bc7[_0x9afb('0x72')],{'filename':'/var/spool/asterisk/monitor/'+_0x1ecbd1[_0x9afb('0x69')]()});if(_0x480c4a){_0x480c4a['status']=_0x9afb('0x71');}})[_0x9afb('0x1d')](function(){_0x158dfd({'code':0xc8,'message':[_0x347ce8[_0x9afb('0x62')],_0x9afb('0x73')][_0x9afb('0x17')]('\x20')});})['catch'](function(_0x4be2a5){_0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f5,[_0x347ce8[_0x9afb('0x62')],_0x4be2a5[_0x9afb('0x20')]['toLowerCase']()][_0x9afb('0x17')]('\x20')));});}else{return _0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f5,_0x9afb('0x74')));}});},'VoiceQueuesChannels':function(_0x5357b4){return new Promise(function(_0x3c16a8,_0x1ee714){var _0x134716=_[_0x9afb('0x5d')](_0x498463[_0x9afb('0x75')]);_0x3c16a8({'count':_0x134716[_0x9afb('0x5f')],'rows':_0x134716});});},'VoiceQueuesChannel':function(_0x4f3a42){var _0x3084b3=this;return new Promise(function(_0x5b8b4a,_0x463df3){var _0x1f5a39=schema(properties[_0x9afb('0x76')])['validate'](_0x4f3a42);if(_0x1f5a39[_0x9afb('0x5f')]>0x0){return _0x463df3(_0x3084b3['error'](0x1f4,_[_0x9afb('0x61')](_0x1f5a39,_0x9afb('0x20'))['join'](',\x20')));}var _0x1a43bf=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x75')],{'uniqueid':_0x4f3a42[_0x9afb('0x62')]});if(_0x1a43bf){_0x5b8b4a(_0x1a43bf);}else{return _0x463df3(_0x3084b3['error'](0x1f5,_0x9afb('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x2c8f29){var _0x3af5af=this;return new Promise(function(_0x1e3500,_0x1fa9cc){if(ami['isConnected']()==![]){return _0x1fa9cc(_0x3af5af[_0x9afb('0x1f')](0x1f4,[config[_0x9afb('0x14')]['ip'],config['asterisk'][_0x9afb('0x15')],_0x9afb('0x16')][_0x9afb('0x17')]('\x20')));}var _0x203e5e=schema(properties['voicequeuechannelhangup'])[_0x9afb('0x3')](_0x2c8f29);if(_0x203e5e[_0x9afb('0x5f')]>0x0){return _0x1fa9cc(_0x3af5af[_0x9afb('0x1f')](0x1f4,_[_0x9afb('0x61')](_0x203e5e,_0x9afb('0x20'))[_0x9afb('0x17')](',\x20')));}var _0x5a4596=_[_0x9afb('0x5b')](_0x498463['queueChannels'],{'uniqueid':_0x2c8f29[_0x9afb('0x62')]});if(_0x5a4596&&_0x5a4596[_0x9afb('0x63')]){return ami[_0x9afb('0x1c')]({'action':_0x9afb('0x77'),'channel':_0x5a4596[_0x9afb('0x63')]})[_0x9afb('0x1d')](function(_0x3db3bb){_0x1e3500({'code':0xc8,'message':[_0x2c8f29[_0x9afb('0x62')],_0x3db3bb['message'][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')});})[_0x9afb('0x1e')](function(_0x34ae00){_0x1fa9cc(_0x3af5af[_0x9afb('0x1f')](0x1f5,[_0x2c8f29[_0x9afb('0x62')],_0x34ae00[_0x9afb('0x20')][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')));});}else{return _0x1fa9cc(_0x3af5af['error'](0x1f5,_0x9afb('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x9be6f0){var _0x378462=this;return new Promise(function(_0x14a47f,_0x207180){if(ami[_0x9afb('0x21')]()==![]){return _0x207180(_0x378462['error'](0x1f4,[config[_0x9afb('0x14')]['ip'],config[_0x9afb('0x14')][_0x9afb('0x15')],_0x9afb('0x16')]['join']('\x20')));}var _0x372aed=schema(properties[_0x9afb('0x78')])[_0x9afb('0x3')](_0x9be6f0);if(_0x372aed[_0x9afb('0x5f')]>0x0){return _0x207180(_0x378462['error'](0x1f4,_[_0x9afb('0x61')](_0x372aed,'message')[_0x9afb('0x17')](',\x20')));}var _0x5d1d8e=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x75')],{'uniqueid':_0x9be6f0[_0x9afb('0x62')]});if(_0x5d1d8e&&_0x5d1d8e['channel']){return ami[_0x9afb('0x1c')]({'action':'Redirect','channel':_0x5d1d8e['channel'],'exten':_0x9be6f0[_0x9afb('0x79')],'context':_0x9be6f0['context']||_0x5d1d8e[_0x9afb('0x7a')],'priority':0x1})[_0x9afb('0x1d')](function(_0x5ce675){_0x14a47f({'code':0xc8,'message':[_0x9be6f0['uniqueid'],_0x5ce675[_0x9afb('0x20')][_0x9afb('0x69')]()]['join']('\x20')});})[_0x9afb('0x1e')](function(_0x29f1f2){_0x207180(_0x378462[_0x9afb('0x1f')](0x1f5,[_0x9be6f0['uniqueid'],_0x29f1f2['message'][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')));});}else{return _0x207180(_0x378462[_0x9afb('0x1f')](0x1f5,_0x9afb('0x74')));}});},'Agents':function(_0x46ff4c){return new Promise(function(_0x2991d3,_0x19667d){var _0x369bfb=_[_0x9afb('0x5d')](_0x498463[_0x9afb('0x10')]);_0x2991d3({'count':_0x369bfb['length'],'rows':_0x369bfb});});},'Telephones':function(_0x3c0107){return new Promise(function(_0x14d0f5,_0x535977){var _0x29f047=_['values'](_0x498463[_0x9afb('0x7b')]);_0x14d0f5({'count':_0x29f047[_0x9afb('0x5f')],'rows':_0x29f047});});},'Trunks':function(_0x3ccba9){return new Promise(function(_0xb4a934,_0x538303){var _0x357f57=_['values'](_0x498463[_0x9afb('0x7c')]);_0xb4a934({'count':_0x357f57[_0x9afb('0x5f')],'rows':_0x357f57});});},'OutboundChannels':function(_0x267f7b){return new Promise(function(_0x9acaba,_0x2d6cf1){var _0x4e5467=_['values'](_0x498463[_0x9afb('0x7d')]);_0x9acaba({'count':_0x4e5467['length'],'rows':_0x4e5467});});},'Outbound':function(_0x3cc289){return new Promise(function(_0x2269cc,_0xa3b371){_0x2269cc(_0x498463[_0x9afb('0x30')]);});},'Campaigns':function(_0x4866bd){return new Promise(function(_0x3e5b87,_0x1222f9){var _0x3c96a2=_['values'](_0x498463[_0x9afb('0x7e')]);_0x3e5b87({'count':_0x3c96a2[_0x9afb('0x5f')],'rows':_0x3c96a2});});},'VoiceQueuesPreview':function(_0x24d635){var _0x53d995=this;return new Promise(function(_0x3ebfea,_0x44e3f7){_0x91ffa0['run'](_0x24d635['id'])['then'](function(_0x422edb){_0x3ebfea({'code':0xc8,'message':_0x422edb[_0x9afb('0x20')]});})[_0x9afb('0x1e')](function(_0x83e860){_0x44e3f7(_0x53d995['error'](0x1f4,_0x83e860[_0x9afb('0x20')]));});});},'EventManager':function(_0x120f44){var _0x24a00b=this;return new Promise(function(_0x19a30d,_0xf484b8){if(!_0x120f44[_0x9afb('0x7f')]){return _0xf484b8(_0x24a00b[_0x9afb('0x1f')](0x1f4,_0x9afb('0x80')));}ami['emit'](_0x9afb('0x81')+_0x120f44[_0x9afb('0x7f')],_0x120f44[_0x9afb('0x20')]);_0x19a30d({'code':0xc8,'message':_0x120f44});});},'FaxAccounts':function(_0x2c7a5b){return new Promise(function(_0x194263,_0x173e75){var _0x1faa74=_[_0x9afb('0x5d')](_0x498463['faxAccounts']);_0x194263({'count':_0x1faa74[_0x9afb('0x5f')],'rows':_0x1faa74});});},'SendFax':function(_0x5e5325){var _0xabe6c=this;return new Promise(function(_0x3c6761,_0x3fb617){_0x56a139[_0x9afb('0x82')](_0x5e5325)['then'](function(_0x8cabe2){_0x3c6761({'code':0xc8,'message':_0x8cabe2['message']});})[_0x9afb('0x1e')](function(_0x349fcd){_0x3fb617(_0xabe6c['error'](0x1f4,_0x349fcd[_0x9afb('0x20')]));});});},'CheckAfterSend':function(_0x1997fa){var _0x1c0150=this;return new Promise(function(_0x1cf4ed,_0x287583){_0x56a139[_0x9afb('0x83')](_0x1997fa)[_0x9afb('0x1d')](function(_0x3ba7d7){_0x1cf4ed({'code':0xc8,'message':_0x3ba7d7[_0x9afb('0x20')]});})[_0x9afb('0x1e')](function(_0x17fc1c){_0x287583(_0x1c0150[_0x9afb('0x1f')](0x1f4,_0x17fc1c[_0x9afb('0x20')]));});});}};var _0x376f63=jayson['server'](_0x556880)['http']();_0x376f63['on']('error',function(_0x23a5ad){return _0x548b24(_0x23a5ad);});_0x376f63['listen'](0x232a,'127.0.0.1',function(){console['log'](_0x9afb('0x84'),0x232a);return _0x1ccf93('RPC\x20listening\x20on\x20port:'+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 ca562d5..7b08160 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 _0x6113=['ListId','createdAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','fax'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x6113,0x13e));var _0x3611=function(_0x3e1368,_0x18f453){_0x3e1368=_0x3e1368-0x0;var _0x2154fa=_0x6113[_0x3e1368];return _0x2154fa;};'use strict';var _=require(_0x3611('0x0'));var BPromise=require(_0x3611('0x1'));var Redis=require(_0x3611('0x2'));var util=require(_0x3611('0x3'));var config=require(_0x3611('0x4'));var logger=require(_0x3611('0x5'))(_0x3611('0x6'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x3611('0x7')](config[_0x3611('0x8')],{'host':_0x3611('0x9'),'port':0x18eb});var io=require(_0x3611('0xa'))(new Redis(config[_0x3611('0x8')]));function emit(_0x3e5dfd,_0x30ed6f,_0x2d242b,_0x516659,_0x57b596){logger[_0x3611('0xb')](_0x3611('0xc'),_0x3e5dfd,_0x30ed6f['id'],_0x2d242b,_0x516659,JSON[_0x3611('0xd')](_0x57b596));io['to'](_0x2d242b)[_0x3611('0xe')](_0x516659,_0x57b596);}exports[_0x3611('0xf')]=function(_0xd6d12,_0x2e7e25,_0xecf816,_0x5d507e){var _0x5b2cfd,_0x4f37b7;var _0xb4ced={};var _0x341562;var _0x36379a=Number(_0xecf816['data1']);var _0x2872ea=_0xecf816[_0x3611('0x10')]?Boolean(Number(_0xecf816['data2'])):![];var _0x31fc11;var _0x484d4c=![];if(!_[_0x3611('0x11')](_0xecf816['data5'])){if(_0xecf816[_0x3611('0x12')]=='1')_0x484d4c=!![];}if(!_0x484d4c){if(_0x5d507e[_0x3611('0x13')]){_0xb4ced['id']=_0x5d507e['xmd-contactid'];}}if(!_0xb4ced['id']){_0xb4ced['ListId']=_0x36379a;_0x31fc11=_0xecf816['data3']&&_0xecf816[_0x3611('0x14')]!=='0'?_0xecf816[_0x3611('0x14')][_0x3611('0x15')](','):[_0x3611('0x16')];_0xb4ced[_0x3611('0x17')]=_[_0x3611('0x18')](_0x31fc11,function(_0x153acd){var _0x205e3c={};_0x205e3c[_0x153acd]=_0x5d507e[_0x3611('0x19')]?_0x5d507e[_0x3611('0x1a')]:_0x5d507e['calleridnum'];return _0x205e3c;});_0x341562=_0x5d507e[_0x3611('0x19')]?_0x5d507e[_0x3611('0x1a')]:_0x5d507e[_0x3611('0x1b')];}var _0x1c15bf=['id',_0x3611('0x1c'),'lastName',_0x3611('0x16'),'mobile',_0x3611('0x1d'),_0x3611('0x1e'),_0x3611('0x1f'),'scheduledAt',_0x3611('0x20')];var _0x2500c8=_[_0x3611('0x21')](_0x1c15bf,_0x31fc11);BPromise[_0x3611('0x22')]()[_0x3611('0x23')](cmContactRpc[_0x3611('0x24')]({'attributes':_0x2500c8,'where':_0xb4ced,'phone':_0x341562}))[_0x3611('0x23')](function(_0x18f545){_0x4f37b7=_0x18f545;if(!_['isEmpty'](_0x4f37b7)){if(_0x4f37b7['length']===0x1){_0x5b2cfd=_0x4f37b7[0x0];logger[_0x3611('0xb')](_0x3611('0x25'),_0x5d507e['uniqueid'],_0x2e7e25['id'],_0x5b2cfd['id']);}else{logger[_0x3611('0xb')](_0x3611('0x26'),_0x5d507e['uniqueid'],_0x2e7e25['id'],_[_0x3611('0x18')](_0x4f37b7,'id')[_0x3611('0x27')](','));}return;}else{logger[_0x3611('0xb')](_0x3611('0x28'),_0x5d507e[_0x3611('0x29')],_0x2e7e25['id']);var _0x1c2518={'ListId':_0x36379a};var _0x2bbdf4=_0xecf816[_0x3611('0x2a')]&&_0xecf816[_0x3611('0x2a')]!=='0'?_0xecf816['data4']:'phone';if(_0x2872ea){logger[_0x3611('0xb')](_0x3611('0x2b'),_0x5d507e[_0x3611('0x29')],_0x2e7e25['id']);_0x1c2518[_0x2bbdf4]=_[_0x3611('0x11')](_0x5d507e['routeId'])?_0x5d507e[_0x3611('0x1b')]:_0x5d507e[_0x3611('0x1a')];if(_[_0x3611('0x11')](_0x5d507e[_0x3611('0x19')])){_0x1c2518[_0x3611('0x1c')]=_0x5d507e['calleridname']&&_0x5d507e[_0x3611('0x2c')]!==''?_0x5d507e[_0x3611('0x2c')]:_0x3611('0x2d');}else{_0x1c2518[_0x3611('0x1c')]=_0x5d507e['destcalleridname']&&_0x5d507e[_0x3611('0x2e')]!==_0x3611('0x2f')?_0x5d507e[_0x3611('0x2e')]:'Unknown';}return BPromise[_0x3611('0x22')]()['then'](cmContactRpc[_0x3611('0x30')](_0x1c2518))[_0x3611('0x23')](function(_0x45cc1a){_0x5b2cfd=_0x45cc1a;_0x4f37b7[_0x3611('0x31')](_0x45cc1a);if(_0x5b2cfd){logger[_0x3611('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5d507e['uniqueid'],_0x2e7e25['id'],_0x5b2cfd['id']);}return;});}else{logger['info'](_0x3611('0x32'),_0x5d507e[_0x3611('0x29')],_0x2e7e25['id']);_0x1c2518[_0x2bbdf4]=_[_0x3611('0x11')](_0x5d507e['routeId'])?_0x5d507e[_0x3611('0x1b')]:_0x5d507e['destcalleridnum'];if(_[_0x3611('0x11')](_0x5d507e[_0x3611('0x19')])){_0x1c2518['firstName']=_0x5d507e[_0x3611('0x2c')]&&_0x5d507e['calleridname']!==''?_0x5d507e[_0x3611('0x2c')]:'Unknown';}else{_0x1c2518[_0x3611('0x1c')]=_0x5d507e['destcalleridname']&&_0x5d507e[_0x3611('0x2e')]!==''?_0x5d507e[_0x3611('0x2e')]:'Unknown';}_0x5b2cfd=_0x1c2518;_0x4f37b7[_0x3611('0x31')](_0x1c2518);return;}}})[_0x3611('0x23')](function(){if(_0xd6d12){emit(_0x5d507e[_0x3611('0x29')],_0x2e7e25,util[_0x3611('0x33')](_0x3611('0x34'),_0xd6d12['name']),util['format'](_0x3611('0x35'),_0xecf816[_0x3611('0x36')][_0x3611('0x37')]()),{'evt':_[_0x3611('0x38')](_0x5d507e,{'autoCreate':_0x2872ea}),'contact':_0x5b2cfd===undefined?{}:_0x5b2cfd,'contacts':_0x4f37b7[_0x3611('0x39')]===0x0?undefined:_0x4f37b7});}});}; \ No newline at end of file +var _0xe875=['emit','exec','data1','data2','data5','ListId','data3','split','phone','$or','map','destcalleridnum','routeId','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName','calleridname','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','format','user:%s','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0xe875,0x68));var _0x5e87=function(_0x1e52d4,_0x4fadcc){_0x1e52d4=_0x1e52d4-0x0;var _0x445f46=_0xe875[_0x1e52d4];return _0x445f46;};'use strict';var _=require(_0x5e87('0x0'));var BPromise=require('bluebird');var Redis=require(_0x5e87('0x1'));var util=require(_0x5e87('0x2'));var config=require(_0x5e87('0x3'));var logger=require(_0x5e87('0x4'))(_0x5e87('0x5'));var cmContactRpc=require(_0x5e87('0x6'));config[_0x5e87('0x7')]=_[_0x5e87('0x8')](config[_0x5e87('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5e87('0x9'))(new Redis(config[_0x5e87('0x7')]));function emit(_0x64822e,_0x57dc75,_0x137ac5,_0x1eed71,_0x4b18a5){logger[_0x5e87('0xa')]('[CM][%s][%s]',_0x64822e,_0x57dc75['id'],_0x137ac5,_0x1eed71,JSON[_0x5e87('0xb')](_0x4b18a5));io['to'](_0x137ac5)[_0x5e87('0xc')](_0x1eed71,_0x4b18a5);}exports[_0x5e87('0xd')]=function(_0x51941d,_0x34f274,_0x4d5d1f,_0x150049){var _0x45fddf,_0x2d6375;var _0x53fdd2={};var _0x12d4a1;var _0x5bf9da=Number(_0x4d5d1f[_0x5e87('0xe')]);var _0x3fa90c=_0x4d5d1f['data2']?Boolean(Number(_0x4d5d1f[_0x5e87('0xf')])):![];var _0x5e3ba5;var _0x9bbfc6=![];if(!_['isNil'](_0x4d5d1f[_0x5e87('0x10')])){if(_0x4d5d1f[_0x5e87('0x10')]=='1')_0x9bbfc6=!![];}if(!_0x9bbfc6){if(_0x150049['xmd-contactid']){_0x53fdd2['id']=_0x150049['xmd-contactid'];}}if(!_0x53fdd2['id']){_0x53fdd2[_0x5e87('0x11')]=_0x5bf9da;_0x5e3ba5=_0x4d5d1f['data3']&&_0x4d5d1f['data3']!=='0'?_0x4d5d1f[_0x5e87('0x12')][_0x5e87('0x13')](','):[_0x5e87('0x14')];_0x53fdd2[_0x5e87('0x15')]=_[_0x5e87('0x16')](_0x5e3ba5,function(_0x138277){var _0xd2c06a={};_0xd2c06a[_0x138277]=_0x150049['routeId']?_0x150049[_0x5e87('0x17')]:_0x150049['calleridnum'];return _0xd2c06a;});_0x12d4a1=_0x150049[_0x5e87('0x18')]?_0x150049[_0x5e87('0x17')]:_0x150049[_0x5e87('0x19')];}var _0x560340=['id','firstName',_0x5e87('0x1a'),_0x5e87('0x14'),_0x5e87('0x1b'),_0x5e87('0x1c'),_0x5e87('0x11'),_0x5e87('0x1d'),_0x5e87('0x1e'),_0x5e87('0x1f')];var _0x46ed1e=_[_0x5e87('0x20')](_0x560340,_0x5e3ba5);BPromise['resolve']()[_0x5e87('0x21')](cmContactRpc[_0x5e87('0x22')]({'attributes':_0x46ed1e,'where':_0x53fdd2,'phone':_0x12d4a1}))[_0x5e87('0x21')](function(_0x3dea96){_0x2d6375=_0x3dea96;if(!_['isEmpty'](_0x2d6375)){if(_0x2d6375[_0x5e87('0x23')]===0x1){_0x45fddf=_0x2d6375[0x0];logger['info'](_0x5e87('0x24'),_0x150049['uniqueid'],_0x34f274['id'],_0x45fddf['id']);}else{logger[_0x5e87('0xa')](_0x5e87('0x25'),_0x150049[_0x5e87('0x26')],_0x34f274['id'],_[_0x5e87('0x16')](_0x2d6375,'id')[_0x5e87('0x27')](','));}return;}else{logger['info'](_0x5e87('0x28'),_0x150049['uniqueid'],_0x34f274['id']);var _0x1acbc0={'ListId':_0x5bf9da};var _0xe2964c=_0x4d5d1f['data4']&&_0x4d5d1f[_0x5e87('0x29')]!=='0'?_0x4d5d1f[_0x5e87('0x29')]:'phone';if(_0x3fa90c){logger[_0x5e87('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x150049[_0x5e87('0x26')],_0x34f274['id']);_0x1acbc0[_0xe2964c]=_['isNil'](_0x150049['routeId'])?_0x150049[_0x5e87('0x19')]:_0x150049[_0x5e87('0x17')];if(_['isNil'](_0x150049[_0x5e87('0x18')])){_0x1acbc0[_0x5e87('0x2a')]=_0x150049[_0x5e87('0x2b')]&&_0x150049[_0x5e87('0x2b')]!==''?_0x150049[_0x5e87('0x2b')]:'Unknown';}else{_0x1acbc0['firstName']=_0x150049[_0x5e87('0x2c')]&&_0x150049[_0x5e87('0x2c')]!==_0x5e87('0x2d')?_0x150049[_0x5e87('0x2c')]:_0x5e87('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0x5e87('0x2f')](_0x1acbc0))[_0x5e87('0x21')](function(_0xd368f4){_0x45fddf=_0xd368f4;_0x2d6375[_0x5e87('0x30')](_0xd368f4);if(_0x45fddf){logger[_0x5e87('0xa')](_0x5e87('0x31'),_0x150049[_0x5e87('0x26')],_0x34f274['id'],_0x45fddf['id']);}return;});}else{logger[_0x5e87('0xa')](_0x5e87('0x32'),_0x150049[_0x5e87('0x26')],_0x34f274['id']);_0x1acbc0[_0xe2964c]=_[_0x5e87('0x33')](_0x150049[_0x5e87('0x18')])?_0x150049[_0x5e87('0x19')]:_0x150049[_0x5e87('0x17')];if(_[_0x5e87('0x33')](_0x150049['routeId'])){_0x1acbc0[_0x5e87('0x2a')]=_0x150049[_0x5e87('0x2b')]&&_0x150049[_0x5e87('0x2b')]!==_0x5e87('0x2d')?_0x150049[_0x5e87('0x2b')]:_0x5e87('0x2e');}else{_0x1acbc0[_0x5e87('0x2a')]=_0x150049[_0x5e87('0x2c')]&&_0x150049[_0x5e87('0x2c')]!==_0x5e87('0x2d')?_0x150049[_0x5e87('0x2c')]:_0x5e87('0x2e');}_0x45fddf=_0x1acbc0;_0x2d6375['push'](_0x1acbc0);return;}}})[_0x5e87('0x21')](function(){if(_0x51941d){emit(_0x150049[_0x5e87('0x26')],_0x34f274,util[_0x5e87('0x34')](_0x5e87('0x35'),_0x51941d['name']),util['format'](_0x5e87('0x36'),_0x4d5d1f[_0x5e87('0x37')][_0x5e87('0x38')]()),{'evt':_[_0x5e87('0x39')](_0x150049,{'autoCreate':_0x3fa90c}),'contact':_0x45fddf===undefined?{}:_0x45fddf,'contacts':_0x2d6375[_0x5e87('0x23')]===0x0?undefined:_0x2d6375});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 02f636e..bcdd881 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 _0xdce5=['voice','interface','checkTriggers','hasOwnProperty','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','render','html','uri','buildUri','isNil','data3','location','data4','windowWidth','data5','windowHeight','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','merge','jscripty','trigger:%s','action','exec','integration','queue','script','parse','query','replace','checkTrigger','AllConditions','every','channel','AnyConditions','some','checkConditions','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','undefined','substatus','offlineMessage','created','equals','exports','lodash','mustache','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','info','stringify','emit','prototype','clone','motionChannel'];(function(_0x391dd5,_0x2f1a20){var _0x484dff=function(_0x1cbee1){while(--_0x1cbee1){_0x391dd5['push'](_0x391dd5['shift']());}};_0x484dff(++_0x2f1a20);}(_0xdce5,0xc7));var _0x5dce=function(_0x19e6d9,_0x2eea2a){_0x19e6d9=_0x19e6d9-0x0;var _0x205dfb=_0xdce5[_0x19e6d9];return _0x205dfb;};'use strict';var util=require('util');var _=require(_0x5dce('0x0'));var url=require('url');var Mustache=require(_0x5dce('0x1'));var Redis=require('ioredis');var urlforward=require(_0x5dce('0x2'));var integration=require(_0x5dce('0x3'));var cmContact=require('./cmContact');var script=require(_0x5dce('0x4'));var config=require(_0x5dce('0x5'));var logger=require(_0x5dce('0x6'))(_0x5dce('0x7'));var ami=require(_0x5dce('0x8'));config[_0x5dce('0x9')]=_[_0x5dce('0xa')](config[_0x5dce('0x9')],{'host':_0x5dce('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5dce('0x9')]));var operators={'equals':function(_0x49c321,_0x4b334e){return _0x49c321==_0x4b334e;},'not_equals':function(_0x5382b6,_0x1f9f28){return _0x5382b6!=_0x1f9f28;}};var barAndWebActions=[_0x5dce('0xc'),_0x5dce('0xd'),_0x5dce('0xe')];function Trigger(_0x2e2795){this['triggers']=_0x2e2795[_0x5dce('0xf')];this[_0x5dce('0x10')]=_0x2e2795['agents'];this[_0x5dce('0x11')]=_0x2e2795[_0x5dce('0x11')];this[_0x5dce('0x12')]=_0x2e2795['templates'];this['voiceExtensions']=_0x2e2795[_0x5dce('0x13')];this[_0x5dce('0x14')]=_0x2e2795[_0x5dce('0x14')];this[_0x5dce('0x15')]=_0x2e2795[_0x5dce('0x15')];this[_0x5dce('0x16')]=_0x2e2795['salesforceAccounts'];this['sugarcrmAccounts']=_0x2e2795[_0x5dce('0x17')];this[_0x5dce('0x18')]=_0x2e2795[_0x5dce('0x18')];this[_0x5dce('0x19')]=_0x2e2795[_0x5dce('0x19')];this[_0x5dce('0x1a')]=_0x2e2795['vtigerAccounts'];this[_0x5dce('0x1b')]=_0x2e2795[_0x5dce('0x1b')];this[_0x5dce('0x1c')]=_0x2e2795[_0x5dce('0x1c')];this[_0x5dce('0x1d')]=_0x2e2795[_0x5dce('0x1d')];this[_0x5dce('0x1e')]={'zendesk':this[_0x5dce('0x14')],'salesforce':this[_0x5dce('0x16')],'freshdesk':this[_0x5dce('0x15')],'sugarcrm':this[_0x5dce('0x17')],'zoho':this[_0x5dce('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x5dce('0x1a')],'dynamics365':this[_0x5dce('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x5dce('0x1b')]};ami['on'](_0x5dce('0x1f'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x22'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x23'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x24'),this[_0x5dce('0x20')]['bind'](this));ami['on'](_0x5dce('0x25'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x26'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x27'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x28'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on']('custom:agentreject',this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x29'),this['syncCustomEvent'][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x2a'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x2b'),this['syncCustomEvent'][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x2c'),this[_0x5dce('0x2d')]['bind'](this));ami['on'](_0x5dce('0x2e'),this['syncAgentDial'][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x2f'),this[_0x5dce('0x2d')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x30'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x31'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x32'),this[_0x5dce('0x20')]['bind'](this));ami['on'](_0x5dce('0x33'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5dce('0x34'),this[_0x5dce('0x20')]['bind'](this));ami['on'](_0x5dce('0x35'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on'](_0x5dce('0x36'),this[_0x5dce('0x20')][_0x5dce('0x21')](this));ami['on']('custom:offlineMessage',this[_0x5dce('0x20')]['bind'](this));}Trigger['prototype']['emit']=function(_0x4384f5,_0xb37ec2,_0x5e1103){logger[_0x5dce('0x37')](_0x4384f5,_0xb37ec2,JSON[_0x5dce('0x38')](_0x5e1103));io['to'](_0x4384f5)[_0x5dce('0x39')](_0xb37ec2,_0x5e1103);};Trigger[_0x5dce('0x3a')][_0x5dce('0x20')]=function(_0x196833){var _0x48edc4=_[_0x5dce('0x3b')](_0x196833);if(typeof _0x48edc4[_0x5dce('0x3c')]==='undefined'){_0x48edc4[_0x5dce('0x3c')]=_0x5dce('0x3d');}this['checkTriggers'](_0x48edc4);};Trigger[_0x5dce('0x3a')]['syncAgentDial']=function(_0x25b67c){if(this['agents'][_0x25b67c[_0x5dce('0x3e')]]){this['syncCustomEvent'](_0x25b67c);}};Trigger[_0x5dce('0x3a')][_0x5dce('0x3f')]=function(_0x37075a){var _0x55647e;for(var _0x5a3e03 in this[_0x5dce('0xf')]){if(this[_0x5dce('0xf')][_0x5dce('0x40')](_0x5a3e03)){if(this['triggers'][_0x5a3e03]['status']){_0x55647e=this['checkTrigger'](this[_0x5dce('0xf')][_0x5a3e03],_0x37075a);if(_0x55647e){_['merge'](_0x37075a,_0x37075a[_0x5dce('0x41')]);for(var _0x82689d=0x0,_0x4c99cb,_0x24305b,_0xdda076;_0x82689d0x0){_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 _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x16575d,_0x2dd914){var _0x275e6c=function(_0x935d92){while(--_0x935d92){_0x16575d['push'](_0x16575d['shift']());}};_0x275e6c(++_0x2dd914);}(_0x55ca,0x126));var _0xa55c=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x55ca[_0x500419];return _0x241c1a;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 0026db4..723e878 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 _0xc5a1=[']\x20The\x20%s\x20ID\x20is:\x20%s','ticketType',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','error','Error\x20running\x20Dynamics365\x20integration','request-promise','util','ioredis','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','clientId','username','password','clientSecret','then','catch',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','GET','&$filter=','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','incidents','assign','Subjects','getString','Descriptions','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','/contacts(','headers','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:'];(function(_0x571a4b,_0x5726b0){var _0xafc9b0=function(_0x175900){while(--_0x175900){_0x571a4b['push'](_0x571a4b['shift']());}};_0xafc9b0(++_0x5726b0);}(_0xc5a1,0xde));var _0x1c5a=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xc5a1[_0x448f8];return _0xa73126;};'use strict';var _=require('lodash');var rp=require(_0x1c5a('0x0'));var util=require(_0x1c5a('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x1c5a('0x2'));var logger=require('../../../../config/logger')(_0x1c5a('0x3'));var config=require('../../../../config/environment');config[_0x1c5a('0x4')]=_[_0x1c5a('0x5')](config['redis'],{'host':_0x1c5a('0x6'),'port':0x18eb});var io=require(_0x1c5a('0x7'))(new Redis(config[_0x1c5a('0x4')]));function getAuthToken(_0x1c96cb,_0x4699e3,_0x5f4098){if(_0x1c96cb[_0x1c5a('0x8')]){_0x1c96cb[_0x1c5a('0x9')]=_0x1c96cb[_0x1c5a('0xa')][_0x1c5a('0xb')];_0x1c96cb[_0x1c5a('0xc')]=_0x1c96cb[_0x1c5a('0xa')][_0x1c5a('0xd')];return Promise['resolve'](_0x1c96cb['CloudProvider'][_0x1c5a('0xe')]);}var _0x138a37={'method':_0x1c5a('0xf'),'uri':_0x4699e3,'form':{'client_id':_0x1c96cb[_0x1c5a('0x10')],'resource':_0x1c96cb[_0x1c5a('0x9')],'username':_0x1c96cb[_0x1c5a('0x11')],'password':_0x1c96cb['password'],'grant_type':_0x1c5a('0x12'),'client_secret':_0x1c96cb[_0x1c5a('0x13')]},'json':!![]};return rp(_0x138a37)[_0x1c5a('0x14')](function(_0x1e2c74){return _0x1e2c74['access_token'];})[_0x1c5a('0x15')](function(_0x388025){logger['error']('['+[_0x5f4098['toUpperCase']()]+_0x1c5a('0x16'));return _0x388025[_0x1c5a('0x17')];});}function getUser(_0x3219a5,_0x314374,_0x1d66f9,_0x2ee086,_0x25b347,_0x557265){return new Promise(function(_0x5ee34a,_0x3e1aa7){return getAuthToken(_0x314374,_0x2ee086,_0x557265)[_0x1c5a('0x14')](function(_0x1941af){var _0x5ce30b={'method':'GET','uri':_0x25b347+_0x1c5a('0x18'),'headers':{'Authorization':_0x1c5a('0x19')+_0x1941af,'OData-Version':_0x1c5a('0x1a')},'json':!![]};return rp(_0x5ce30b);})[_0x1c5a('0x14')](function(_0x40a8fc){var _0xd8fc82=_0x40a8fc[_0x1c5a('0x1b')];var _0x514933=![];var _0x15a958=null;if(!_[_0x1c5a('0x1c')](_0x1d66f9)){if(intUtil[_0x1c5a('0x1d')](_0x1d66f9[_0x1c5a('0x1e')])){_0x3219a5[_0x1c5a('0x1f')]=_0x1d66f9[_0x1c5a('0x1e')];for(_0x15a958=0x0;_0x15a958<_0xd8fc82['length'];_0x15a958++){if(_0xd8fc82[_0x15a958][_0x1c5a('0x20')]===_0x1d66f9[_0x1c5a('0x1e')]&&!_0xd8fc82[_0x15a958]['isdisabled']){_0x514933=!![];logger[_0x1c5a('0x21')]('['+[_0x557265[_0x1c5a('0x22')]()]+_0x1c5a('0x23')+_0xd8fc82[_0x15a958][_0x1c5a('0x24')]+'!');_0x3219a5[_0x1c5a('0x25')]=_0xd8fc82[_0x15a958][_0x1c5a('0x24')];}}}}if(!_0x514933){logger['info']('['+[_0x557265[_0x1c5a('0x22')]()]+_0x1c5a('0x26'));_0x3219a5['userEmail']=_0x314374[_0x1c5a('0x11')];for(_0x15a958=0x0;_0x15a958<_0xd8fc82[_0x1c5a('0x27')];_0x15a958++){if(_0xd8fc82[_0x15a958][_0x1c5a('0x20')]===_0x314374[_0x1c5a('0x11')]){_0x3219a5[_0x1c5a('0x25')]=_0xd8fc82[_0x15a958]['systemuserid'];}}}_0x5ee34a(_0x3219a5);})[_0x1c5a('0x15')](function(_0x26ecdb){_0x3e1aa7(_0x26ecdb[_0x1c5a('0x17')]);});});}function createEndUser(_0x44ddd7,_0x41b249,_0x128b5a,_0x29d1f4,_0x9d2206,_0x12c869,_0x7d2bd2){return new Promise(function(_0x3e89f4,_0x525950){return getAuthToken(_0x41b249,_0x128b5a,_0x12c869)[_0x1c5a('0x14')](function(_0x5a2ead){var _0x5df2bf=_0x12c869[_0x1c5a('0x28')]()===_0x1c5a('0x29')?_0x9d2206[_0x1c5a('0x2a')]:_0x9d2206[_0x1c5a('0x2b')];var _0x4409a3={'method':_0x1c5a('0xf'),'uri':_0x29d1f4+'contacts','body':{'fullname':_0x5df2bf,'firstname':_0x5df2bf,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x44ddd7['userId']+')'},'headers':{'Authorization':_0x1c5a('0x19')+_0x5a2ead,'OData-Version':_0x1c5a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x4409a3[_0x1c5a('0x2c')][_0x7d2bd2]=_0x5df2bf;return rp(_0x4409a3);})[_0x1c5a('0x14')](function(_0x3b3d31){var _0x187106=_0x3b3d31['headers'][_0x1c5a('0x2d')];var _0x2648bc=_0x187106[_0x1c5a('0x2e')](_0x187106[_0x1c5a('0x2f')]('(')+0x1,_0x187106[_0x1c5a('0x2f')](')'));_0x44ddd7[_0x1c5a('0x30')]=_0x2648bc;_0x3e89f4(_0x44ddd7);})[_0x1c5a('0x15')](function(_0x5a1ad8){_0x525950(_0x5a1ad8['message']);});});}function getEndUser(_0x40be72,_0x3326fc,_0x3a2087,_0x470dd8,_0x23078c,_0x153687,_0x4d6f8c,_0x3fe02b){var _0x38e936=_0x153687[_0x1c5a('0x28')]()==='outbound'?_0x23078c['destcalleridnum']:_0x23078c[_0x1c5a('0x2b')];return getAuthToken(_0x3326fc,_0x3a2087,_0x153687)[_0x1c5a('0x14')](function(_0x452a16){_0x3fe02b=_0x3fe02b?_0x3fe02b:_0x1c5a('0x31');var _0x45ca62={'method':_0x1c5a('0x32'),'uri':_0x470dd8+'contacts?$select='+_0x3fe02b+_0x1c5a('0x33')+_0x3fe02b+'\x20eq\x20\x27'+_0x38e936['replace']('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x452a16,'If-None-Match':null,'OData-Version':_0x1c5a('0x1a')},'json':!![]};return rp(_0x45ca62);})[_0x1c5a('0x14')](function(_0x56fd71){var _0x898884=![];if(!_0x56fd71)return _0x898884;var _0x3542bc=_0x56fd71[_0x1c5a('0x1b')];for(var _0x2a7bcb=0x0;_0x2a7bcb<_0x3542bc[_0x1c5a('0x27')];_0x2a7bcb++){if(_0x3542bc[_0x2a7bcb][_0x3fe02b]===_0x38e936){_0x898884=!![];_0x40be72['enduserId']=_0x3542bc[_0x2a7bcb][_0x1c5a('0x34')];}}return _0x898884;})[_0x1c5a('0x14')](function(_0x23bcca){if(_0x23bcca)return _0x40be72;if(_0x4d6f8c==='nothing'){logger['info']('['+[_0x153687['toUpperCase']()]+_0x1c5a('0x35'));return _0x40be72;}return createEndUser(_0x40be72,_0x3326fc,_0x3a2087,_0x470dd8,_0x23078c,_0x153687,_0x3fe02b)[_0x1c5a('0x14')](function(_0x446788){logger[_0x1c5a('0x21')]('['+[_0x153687['toUpperCase']()]+_0x1c5a('0x36'),_0x446788[_0x1c5a('0x30')]);return _0x446788;});});}function getCustomFields(_0x4829b5,_0x451644,_0x4ecd8d){var _0x5a47ea={};if(_0x4829b5[_0x1c5a('0x27')]>0x0){_[_0x1c5a('0x37')](_0x4829b5,function(_0x476611){if(_[_0x1c5a('0x38')]([_0x1c5a('0x39'),_0x1c5a('0x3a')],_0x476611[_0x1c5a('0x3b')])&&_0x476611[_0x1c5a('0x3c')]&&!_0x476611[_0x1c5a('0x3d')]){var _0x14827a=_0x476611[_0x1c5a('0x3e')][_0x1c5a('0x28')]();var _0x57f6a6=_0x14827a['substring'](0x0,_0x14827a[_0x1c5a('0x3f')]('_'));var _0x27b861=_0x14827a[_0x1c5a('0x2e')](_0x14827a[_0x1c5a('0x3f')]('_')+0x1);if(_0x57f6a6===_0x4ecd8d){_0x5a47ea[_0x27b861]=_0x476611['content'];}}});}return _0x5a47ea;}function getTicket(_0x247910,_0xc8a42e,_0x2a6cd2,_0x5d4b59,_0x5d3b23,_0x3e7a08,_0x50672c){return new Promise(function(_0x2395a3,_0x358a0e){var _0x1700af;return getAuthToken(_0xc8a42e,_0x2a6cd2,_0x50672c)[_0x1c5a('0x14')](function(_0x58b70d){if(_0x3e7a08['ticketType']==='incident'){_0x1700af={'method':'POST','uri':_0x5d4b59+_0x1c5a('0x40'),'body':Object[_0x1c5a('0x41')]({},{'title':intUtil['getString'](_0x3e7a08[_0x1c5a('0x42')],_0x5d3b23,'\x20'),'description':intUtil[_0x1c5a('0x43')](_0x3e7a08[_0x1c5a('0x44')],_0x5d3b23,'\x0a'),'customerid_contact@odata.bind':_0x247910[_0x1c5a('0x30')]?'/contacts('+_0x247910[_0x1c5a('0x30')]+')':undefined,'ownerid@odata.bind':_0x1c5a('0x45')+_0x247910['userId']+')','caseorigincode':'1'},getCustomFields(_0x3e7a08[_0x1c5a('0x46')],_0x5d3b23,_0x3e7a08['ticketType'])),'headers':{'Authorization':_0x1c5a('0x19')+_0x58b70d,'OData-Version':_0x1c5a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3e7a08['ticketType']===_0x1c5a('0x47')){var _0x41634e=_0x247910[_0x1c5a('0x30')]?[{'partyid_systemuser@odata.bind':_0x1c5a('0x45')+_0x247910[_0x1c5a('0x25')]+')','participationtypemask':_0x247910[_0x1c5a('0x48')]===_0x1c5a('0x49')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x247910['enduserId']+')','participationtypemask':_0x247910[_0x1c5a('0x48')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1c5a('0x45')+_0x247910['userId']+')','participationtypemask':_0x247910[_0x1c5a('0x48')]===_0x1c5a('0x49')?0x2:0x1}];_0x1700af={'method':_0x1c5a('0xf'),'uri':_0x5d4b59+_0x1c5a('0x4a'),'body':Object[_0x1c5a('0x41')]({},{'subject':intUtil[_0x1c5a('0x43')](_0x3e7a08[_0x1c5a('0x42')],_0x5d3b23,'\x20'),'phonenumber':String(_0x5d3b23[_0x1c5a('0x2b')]),'description':intUtil['getString'](_0x3e7a08[_0x1c5a('0x44')],_0x5d3b23,'\x0a'),'regardingobjectid_contact@odata.bind':_0x247910[_0x1c5a('0x30')]?_0x1c5a('0x4b')+_0x247910[_0x1c5a('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x247910['userId']+')','directioncode':_0x247910['callDirection']===_0x1c5a('0x49')?![]:!![],'phonecall_activity_parties':_0x41634e},getCustomFields(_0x3e7a08[_0x1c5a('0x46')],_0x5d3b23,_0x3e7a08['ticketType'])),'headers':{'Authorization':_0x1c5a('0x19')+_0x58b70d,'OData-Version':_0x1c5a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1700af);})[_0x1c5a('0x14')](function(_0xcb1609){var _0xbbb50b=_0xcb1609[_0x1c5a('0x4c')][_0x1c5a('0x2d')];var _0x4063dd=_0xbbb50b[_0x1c5a('0x2e')](_0xbbb50b['lastIndexOf']('(')+0x1,_0xbbb50b[_0x1c5a('0x2f')](')'));_0x247910[_0x1c5a('0x4d')]=_0x4063dd;_0x2395a3(_0x247910);})['catch'](function(_0xc37404){_0x358a0e(_0xc37404[_0x1c5a('0x17')]);});});}function emit(_0x24759d,_0x3ac6d2,_0x246dc4,_0xd3aeef){var _0x360d15={'uri':util[_0x1c5a('0x4e')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x24759d,_0x246dc4,_0xd3aeef)};io['to'](util[_0x1c5a('0x4e')](_0x1c5a('0x4f'),_0x3ac6d2))[_0x1c5a('0x50')](_0x1c5a('0x51'),_0x360d15);}exports['cs']=function(_0x2d96e2,_0x4bcb1e,_0x414628,_0x3dc504,_0x49a569,_0x4e1142,_0x133498,_0x444afb){var _0x4ccded={};_0x4e1142[_0x1c5a('0x9')]=_0x4e1142[_0x1c5a('0x8')]?intUtil['stripTrailingSlash'](_0x4e1142[_0x1c5a('0xa')]['data7']):intUtil[_0x1c5a('0x52')](_0x4e1142['remoteUri']);_0x4e1142[_0x1c5a('0x53')]=intUtil['stripTrailingSlash'](_0x4e1142[_0x1c5a('0x53')]);_0x4ccded['callDirection']=_0x444afb===_0x1c5a('0x49')||_0x444afb===_0x1c5a('0x54')?_0x1c5a('0x49'):_0x1c5a('0x29');var _0x58b086=_0x4e1142[_0x1c5a('0x8')]?util[_0x1c5a('0x4e')](_0x1c5a('0x55'),_0x4e1142['CloudProvider'][_0x1c5a('0xb')]):util[_0x1c5a('0x4e')](_0x1c5a('0x55'),_0x4e1142[_0x1c5a('0x9')]);var _0x411e61=util[_0x1c5a('0x4e')](_0x1c5a('0x56'),_0x4e1142['tenantId']);var _0x1158d4=util[_0x1c5a('0x4e')](_0x1c5a('0x57'),_0x4e1142[_0x1c5a('0x53')],_0x4bcb1e['uniqueid'],md5(_0x4bcb1e[_0x1c5a('0x58')]));if(_0x49a569&&_0x49a569[_0x1c5a('0x59')]){logger[_0x1c5a('0x21')](_0x1c5a('0x5a'),_0x1c5a('0x5b'));_0x4bcb1e['recordingURL']=_0x1158d4;}else if(_0x133498&&_0x133498[_0x1c5a('0x5c')]&&_0x133498[_0x1c5a('0x5c')]!=='none'){logger[_0x1c5a('0x21')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4bcb1e[_0x1c5a('0x5d')]=_0x1158d4;}else{_0x4bcb1e[_0x1c5a('0x5d')]='';}return getUser(_0x4ccded,_0x4e1142,_0x3dc504,_0x411e61,_0x58b086,_0x444afb)['then'](function(_0x30367a){logger[_0x1c5a('0x21')]('['+_0x444afb[_0x1c5a('0x22')]()+_0x1c5a('0x5e'),_0x30367a[_0x1c5a('0x25')]);logger[_0x1c5a('0x21')]('['+_0x444afb[_0x1c5a('0x22')]()+_0x1c5a('0x5f'),_0x30367a[_0x1c5a('0x1f')]);return getEndUser(_0x30367a,_0x4e1142,_0x411e61,_0x58b086,_0x4bcb1e,_0x444afb,_0x414628['moduleCreate'],_0x414628[_0x1c5a('0x60')]);})[_0x1c5a('0x14')](function(_0x415c94){logger[_0x1c5a('0x21')]('['+_0x444afb['toUpperCase']()+_0x1c5a('0x61'),_0x415c94[_0x1c5a('0x30')]);logger[_0x1c5a('0x21')]('['+_0x444afb[_0x1c5a('0x22')]()+_0x1c5a('0x62'),_0x4bcb1e[_0x1c5a('0x2b')]);return getTicket(_0x415c94,_0x4e1142,_0x411e61,_0x58b086,_0x4bcb1e,_0x414628,_0x444afb);})['then'](function(_0x259afb){logger[_0x1c5a('0x21')](util[_0x1c5a('0x4e')]('['+_0x444afb[_0x1c5a('0x22')]()+_0x1c5a('0x63'),_0x414628[_0x1c5a('0x64')],_0x259afb[_0x1c5a('0x4d')]));logger[_0x1c5a('0x21')](util['format']('['+_0x444afb[_0x1c5a('0x22')]()+_0x1c5a('0x65'),_0x444afb));if(_0x444afb!==_0x1c5a('0x54')&&_0x414628['openNewTab']){logger[_0x1c5a('0x21')]('['+_0x444afb[_0x1c5a('0x22')]()+']',_0x1c5a('0x66'));emit(_0x4e1142[_0x1c5a('0x9')],_0x3dc504[_0x1c5a('0x67')],_0x414628['ticketType'],_0x259afb[_0x1c5a('0x4d')]);}})[_0x1c5a('0x15')](function(_0x5180df){logger['error']('['+_0x444afb[_0x1c5a('0x22')]()+_0x1c5a('0x68'),_0x5180df[_0x1c5a('0x17')]);console[_0x1c5a('0x69')](_0x1c5a('0x6a'),_0x5180df);});}; \ No newline at end of file +var _0xe701=['redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','resolve','POST','clientId','username','password','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','/systemusers(','Bearer\x20','body','headers','odata-entityid','lastIndexOf','destcalleridnum','contacts?$select=','&$filter=','%2b','enduserId','contactid','nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','ticketId','format','user:%s','emit','trigger:browser:url','data7','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0xe701,0xd3));var _0x1e70=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe701[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1e70('0x0'));var rp=require(_0x1e70('0x1'));var util=require(_0x1e70('0x2'));var intUtil=require(_0x1e70('0x3'));var md5=require(_0x1e70('0x4'));var Redis=require(_0x1e70('0x5'));var logger=require(_0x1e70('0x6'))(_0x1e70('0x7'));var config=require(_0x1e70('0x8'));config[_0x1e70('0x9')]=_['defaults'](config[_0x1e70('0x9')],{'host':_0x1e70('0xa'),'port':0x18eb});var io=require(_0x1e70('0xb'))(new Redis(config[_0x1e70('0x9')]));function getAuthToken(_0x459377,_0x2f80c3,_0x591e43){if(_0x459377[_0x1e70('0xc')]){_0x459377[_0x1e70('0xd')]=_0x459377[_0x1e70('0xe')]['data7'];_0x459377['tenantId']=_0x459377[_0x1e70('0xe')]['data2'];return Promise[_0x1e70('0xf')](_0x459377['CloudProvider']['data5']);}var _0x27086a={'method':_0x1e70('0x10'),'uri':_0x2f80c3,'form':{'client_id':_0x459377[_0x1e70('0x11')],'resource':_0x459377[_0x1e70('0xd')],'username':_0x459377[_0x1e70('0x12')],'password':_0x459377[_0x1e70('0x13')],'grant_type':_0x1e70('0x13'),'client_secret':_0x459377['clientSecret']},'json':!![]};return rp(_0x27086a)['then'](function(_0x25ad6d){return _0x25ad6d[_0x1e70('0x14')];})[_0x1e70('0x15')](function(_0x1fedda){logger[_0x1e70('0x16')]('['+[_0x591e43[_0x1e70('0x17')]()]+_0x1e70('0x18'));return _0x1fedda[_0x1e70('0x19')];});}function getUser(_0x17d797,_0x44a490,_0x2d02d8,_0x5eaf30,_0x1fe58e,_0x25e7f9){return new Promise(function(_0x4d5050,_0x684401){return getAuthToken(_0x44a490,_0x5eaf30,_0x25e7f9)[_0x1e70('0x1a')](function(_0x4b5e1d){var _0x44b144={'method':_0x1e70('0x1b'),'uri':_0x1fe58e+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x4b5e1d,'OData-Version':_0x1e70('0x1c')},'json':!![]};return rp(_0x44b144);})[_0x1e70('0x1a')](function(_0x24151e){var _0x47552f=_0x24151e[_0x1e70('0x1d')];var _0x16b834=![];var _0x213f7b=null;if(!_[_0x1e70('0x1e')](_0x2d02d8)){if(intUtil[_0x1e70('0x1f')](_0x2d02d8[_0x1e70('0x20')])){_0x17d797[_0x1e70('0x21')]=_0x2d02d8[_0x1e70('0x20')];for(_0x213f7b=0x0;_0x213f7b<_0x47552f[_0x1e70('0x22')];_0x213f7b++){if(_0x47552f[_0x213f7b][_0x1e70('0x23')]===_0x2d02d8[_0x1e70('0x20')]&&!_0x47552f[_0x213f7b][_0x1e70('0x24')]){_0x16b834=!![];logger[_0x1e70('0x25')]('['+[_0x25e7f9[_0x1e70('0x17')]()]+_0x1e70('0x26')+_0x47552f[_0x213f7b][_0x1e70('0x27')]+'!');_0x17d797[_0x1e70('0x28')]=_0x47552f[_0x213f7b][_0x1e70('0x27')];}}}}if(!_0x16b834){logger[_0x1e70('0x25')]('['+[_0x25e7f9[_0x1e70('0x17')]()]+_0x1e70('0x29'));_0x17d797[_0x1e70('0x21')]=_0x44a490[_0x1e70('0x12')];for(_0x213f7b=0x0;_0x213f7b<_0x47552f['length'];_0x213f7b++){if(_0x47552f[_0x213f7b][_0x1e70('0x23')]===_0x44a490[_0x1e70('0x12')]){_0x17d797[_0x1e70('0x28')]=_0x47552f[_0x213f7b][_0x1e70('0x27')];}}}_0x4d5050(_0x17d797);})[_0x1e70('0x15')](function(_0x28484f){_0x684401(_0x28484f[_0x1e70('0x19')]);});});}function createEndUser(_0x17b094,_0x12eb29,_0x48ea83,_0xfbb893,_0x4547fd,_0x1e6c6f,_0x3342b5){return new Promise(function(_0x2a855c,_0x357648){return getAuthToken(_0x12eb29,_0x48ea83,_0x1e6c6f)['then'](function(_0x2128a5){var _0x1703f3=_0x1e6c6f[_0x1e70('0x2a')]()===_0x1e70('0x2b')?_0x4547fd['destcalleridnum']:_0x4547fd[_0x1e70('0x2c')];var _0x2f8984={'method':_0x1e70('0x10'),'uri':_0xfbb893+'contacts','body':{'fullname':_0x1703f3,'firstname':_0x1703f3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1e70('0x2d')+_0x17b094[_0x1e70('0x28')]+')'},'headers':{'Authorization':_0x1e70('0x2e')+_0x2128a5,'OData-Version':_0x1e70('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x2f8984[_0x1e70('0x2f')][_0x3342b5]=_0x1703f3;return rp(_0x2f8984);})[_0x1e70('0x1a')](function(_0x40bcb8){var _0x13bd67=_0x40bcb8[_0x1e70('0x30')][_0x1e70('0x31')];var _0x268b26=_0x13bd67['substring'](_0x13bd67[_0x1e70('0x32')]('(')+0x1,_0x13bd67[_0x1e70('0x32')](')'));_0x17b094['enduserId']=_0x268b26;_0x2a855c(_0x17b094);})[_0x1e70('0x15')](function(_0x2debd9){_0x357648(_0x2debd9[_0x1e70('0x19')]);});});}function getEndUser(_0xe2dce5,_0x31160a,_0x48777c,_0x2e17b5,_0x5433d2,_0x4d5aaa,_0x544910,_0x4444dc){var _0x5856c7=_0x4d5aaa['toLowerCase']()===_0x1e70('0x2b')?_0x5433d2[_0x1e70('0x33')]:_0x5433d2[_0x1e70('0x2c')];return getAuthToken(_0x31160a,_0x48777c,_0x4d5aaa)[_0x1e70('0x1a')](function(_0xcd6439){_0x4444dc=_0x4444dc?_0x4444dc:'telephone1';var _0x12300c={'method':_0x1e70('0x1b'),'uri':_0x2e17b5+_0x1e70('0x34')+_0x4444dc+_0x1e70('0x35')+_0x4444dc+'\x20eq\x20\x27'+_0x5856c7['replace']('+',_0x1e70('0x36'))+'\x27','headers':{'Authorization':_0x1e70('0x2e')+_0xcd6439,'If-None-Match':null,'OData-Version':_0x1e70('0x1c')},'json':!![]};return rp(_0x12300c);})[_0x1e70('0x1a')](function(_0x3d0185){var _0x2d0e9c=![];if(!_0x3d0185)return _0x2d0e9c;var _0x13cf99=_0x3d0185[_0x1e70('0x1d')];for(var _0x50344b=0x0;_0x50344b<_0x13cf99['length'];_0x50344b++){if(_0x13cf99[_0x50344b][_0x4444dc]===_0x5856c7){_0x2d0e9c=!![];_0xe2dce5[_0x1e70('0x37')]=_0x13cf99[_0x50344b][_0x1e70('0x38')];}}return _0x2d0e9c;})[_0x1e70('0x1a')](function(_0x352452){if(_0x352452)return _0xe2dce5;if(_0x544910===_0x1e70('0x39')){logger[_0x1e70('0x25')]('['+[_0x4d5aaa[_0x1e70('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xe2dce5;}return createEndUser(_0xe2dce5,_0x31160a,_0x48777c,_0x2e17b5,_0x5433d2,_0x4d5aaa,_0x4444dc)['then'](function(_0x57f90a){logger['info']('['+[_0x4d5aaa[_0x1e70('0x17')]()]+_0x1e70('0x3a'),_0x57f90a[_0x1e70('0x37')]);return _0x57f90a;});});}function getCustomFields(_0x44e636,_0x1b53dd,_0x3eaf2a){var _0xb56107={};if(_0x44e636[_0x1e70('0x22')]>0x0){_[_0x1e70('0x3b')](_0x44e636,function(_0x37389f){if(_['includes']([_0x1e70('0x3c'),_0x1e70('0x3d')],_0x37389f[_0x1e70('0x3e')])&&_0x37389f[_0x1e70('0x3f')]&&!_0x37389f[_0x1e70('0x40')]){var _0x579721=_0x37389f['idField'][_0x1e70('0x2a')]();var _0x124919=_0x579721[_0x1e70('0x41')](0x0,_0x579721['indexOf']('_'));var _0x253c06=_0x579721['substring'](_0x579721[_0x1e70('0x42')]('_')+0x1);if(_0x124919===_0x3eaf2a){_0xb56107[_0x253c06]=_0x37389f[_0x1e70('0x43')];}}});}return _0xb56107;}function getTicket(_0x3b4946,_0x1a148e,_0x3ef8a0,_0x27cd86,_0x5680e0,_0xc8fcfc,_0x2eb1d3){return new Promise(function(_0x5dad41,_0x1a5196){var _0x231970;return getAuthToken(_0x1a148e,_0x3ef8a0,_0x2eb1d3)['then'](function(_0x146b6e){if(_0xc8fcfc[_0x1e70('0x44')]===_0x1e70('0x45')){_0x231970={'method':_0x1e70('0x10'),'uri':_0x27cd86+_0x1e70('0x46'),'body':Object[_0x1e70('0x47')]({},{'title':intUtil[_0x1e70('0x48')](_0xc8fcfc['Subjects'],_0x5680e0,'\x20'),'description':intUtil[_0x1e70('0x48')](_0xc8fcfc['Descriptions'],_0x5680e0,'\x0a'),'customerid_contact@odata.bind':_0x3b4946[_0x1e70('0x37')]?_0x1e70('0x49')+_0x3b4946[_0x1e70('0x37')]+')':undefined,'ownerid@odata.bind':_0x1e70('0x2d')+_0x3b4946[_0x1e70('0x28')]+')','caseorigincode':'1'},getCustomFields(_0xc8fcfc[_0x1e70('0x4a')],_0x5680e0,_0xc8fcfc[_0x1e70('0x44')])),'headers':{'Authorization':_0x1e70('0x2e')+_0x146b6e,'OData-Version':_0x1e70('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xc8fcfc[_0x1e70('0x44')]===_0x1e70('0x4b')){var _0x1f24fe=_0x3b4946['enduserId']?[{'partyid_systemuser@odata.bind':_0x1e70('0x2d')+_0x3b4946[_0x1e70('0x28')]+')','participationtypemask':_0x3b4946[_0x1e70('0x4c')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x1e70('0x49')+_0x3b4946[_0x1e70('0x37')]+')','participationtypemask':_0x3b4946[_0x1e70('0x4c')]===_0x1e70('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3b4946[_0x1e70('0x28')]+')','participationtypemask':_0x3b4946['callDirection']===_0x1e70('0x4d')?0x2:0x1}];_0x231970={'method':_0x1e70('0x10'),'uri':_0x27cd86+_0x1e70('0x4e'),'body':Object[_0x1e70('0x47')]({},{'subject':intUtil[_0x1e70('0x48')](_0xc8fcfc[_0x1e70('0x4f')],_0x5680e0,'\x20'),'phonenumber':String(_0x5680e0[_0x1e70('0x2c')]),'description':intUtil[_0x1e70('0x48')](_0xc8fcfc[_0x1e70('0x50')],_0x5680e0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3b4946[_0x1e70('0x37')]?'/contacts('+_0x3b4946[_0x1e70('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3b4946[_0x1e70('0x28')]+')','directioncode':_0x3b4946[_0x1e70('0x4c')]===_0x1e70('0x4d')?![]:!![],'phonecall_activity_parties':_0x1f24fe},getCustomFields(_0xc8fcfc['Fields'],_0x5680e0,_0xc8fcfc[_0x1e70('0x44')])),'headers':{'Authorization':_0x1e70('0x2e')+_0x146b6e,'OData-Version':_0x1e70('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x231970);})[_0x1e70('0x1a')](function(_0x2c9990){var _0x536c72=_0x2c9990[_0x1e70('0x30')][_0x1e70('0x31')];var _0x2a137c=_0x536c72[_0x1e70('0x41')](_0x536c72[_0x1e70('0x32')]('(')+0x1,_0x536c72[_0x1e70('0x32')](')'));_0x3b4946[_0x1e70('0x51')]=_0x2a137c;_0x5dad41(_0x3b4946);})[_0x1e70('0x15')](function(_0xa80f9f){_0x1a5196(_0xa80f9f['message']);});});}function emit(_0x4b6221,_0x3b3ccc,_0x381ebb,_0x2bd872){var _0x39b4d5={'uri':util[_0x1e70('0x52')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4b6221,_0x381ebb,_0x2bd872)};io['to'](util[_0x1e70('0x52')](_0x1e70('0x53'),_0x3b3ccc))[_0x1e70('0x54')](_0x1e70('0x55'),_0x39b4d5);}exports['cs']=function(_0x1166d3,_0x3e7869,_0x533238,_0x5b0647,_0x1d1319,_0xffcb03,_0x540b6f,_0x108f9e){var _0x138cd2={};_0xffcb03[_0x1e70('0xd')]=_0xffcb03[_0x1e70('0xc')]?intUtil['stripTrailingSlash'](_0xffcb03[_0x1e70('0xe')][_0x1e70('0x56')]):intUtil['stripTrailingSlash'](_0xffcb03[_0x1e70('0xd')]);_0xffcb03['serverUrl']=intUtil[_0x1e70('0x57')](_0xffcb03['serverUrl']);_0x138cd2['callDirection']=_0x108f9e===_0x1e70('0x4d')||_0x108f9e===_0x1e70('0x58')?_0x1e70('0x4d'):_0x1e70('0x2b');var _0x51ca8f=_0xffcb03[_0x1e70('0xc')]?util[_0x1e70('0x52')]('%s/api/data/v9.0/',_0xffcb03[_0x1e70('0xe')]['data7']):util[_0x1e70('0x52')](_0x1e70('0x59'),_0xffcb03['remoteUri']);var _0x58235e=util[_0x1e70('0x52')](_0x1e70('0x5a'),_0xffcb03[_0x1e70('0x5b')]);var _0x57a090=util[_0x1e70('0x52')](_0x1e70('0x5c'),_0xffcb03[_0x1e70('0x5d')],_0x3e7869['uniqueid'],md5(_0x3e7869[_0x1e70('0x5e')]));if(_0x1d1319&&_0x1d1319[_0x1e70('0x5f')]){logger['info'](_0x1e70('0x60'),_0x1e70('0x61'));_0x3e7869[_0x1e70('0x62')]=_0x57a090;}else if(_0x540b6f&&_0x540b6f['recordingFormat']&&_0x540b6f[_0x1e70('0x63')]!==_0x1e70('0x64')){logger[_0x1e70('0x25')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3e7869['recordingURL']=_0x57a090;}else{_0x3e7869[_0x1e70('0x62')]='';}return getUser(_0x138cd2,_0xffcb03,_0x5b0647,_0x58235e,_0x51ca8f,_0x108f9e)[_0x1e70('0x1a')](function(_0x43ffb4){logger[_0x1e70('0x25')]('['+_0x108f9e['toUpperCase']()+_0x1e70('0x65'),_0x43ffb4[_0x1e70('0x28')]);logger['info']('['+_0x108f9e[_0x1e70('0x17')]()+_0x1e70('0x66'),_0x43ffb4[_0x1e70('0x21')]);return getEndUser(_0x43ffb4,_0xffcb03,_0x58235e,_0x51ca8f,_0x3e7869,_0x108f9e,_0x533238[_0x1e70('0x67')],_0x533238[_0x1e70('0x68')]);})[_0x1e70('0x1a')](function(_0x22be80){logger['info']('['+_0x108f9e[_0x1e70('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x22be80[_0x1e70('0x37')]);logger[_0x1e70('0x25')]('['+_0x108f9e[_0x1e70('0x17')]()+_0x1e70('0x69'),_0x3e7869[_0x1e70('0x2c')]);return getTicket(_0x22be80,_0xffcb03,_0x58235e,_0x51ca8f,_0x3e7869,_0x533238,_0x108f9e);})[_0x1e70('0x1a')](function(_0x441333){logger['info'](util[_0x1e70('0x52')]('['+_0x108f9e[_0x1e70('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x533238['ticketType'],_0x441333['ticketId']));logger[_0x1e70('0x25')](util[_0x1e70('0x52')]('['+_0x108f9e[_0x1e70('0x17')]()+_0x1e70('0x6a'),_0x108f9e));if(_0x108f9e!==_0x1e70('0x58')&&_0x533238[_0x1e70('0x6b')]){logger[_0x1e70('0x25')]('['+_0x108f9e['toUpperCase']()+']',_0x1e70('0x6c'));emit(_0xffcb03[_0x1e70('0xd')],_0x5b0647['name'],_0x533238[_0x1e70('0x44')],_0x441333['ticketId']);}})[_0x1e70('0x15')](function(_0x435947){logger[_0x1e70('0x16')]('['+_0x108f9e[_0x1e70('0x17')]()+_0x1e70('0x6d'),_0x435947[_0x1e70('0x19')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x435947);});}; \ 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 451b293..a5b319c 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 _0x8078=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','length','forEach','string','type','customField','content','toString','picklist','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','format','remoteUri','POST','%s/api/v2/agents','then','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone'];(function(_0x5d6173,_0x82c98e){var _0x62d661=function(_0x14ac54){while(--_0x14ac54){_0x5d6173['push'](_0x5d6173['shift']());}};_0x62d661(++_0x82c98e);}(_0x8078,0x92));var _0x8807=function(_0x12a890,_0x1237bc){_0x12a890=_0x12a890-0x0;var _0x59419b=_0x8078[_0x12a890];return _0x59419b;};'use strict';var _=require(_0x8807('0x0'));var rp=require(_0x8807('0x1'));var md5=require(_0x8807('0x2'));var util=require(_0x8807('0x3'));var Redis=require(_0x8807('0x4'));var intUtil=require(_0x8807('0x5'));var config=require(_0x8807('0x6'));var logger=require(_0x8807('0x7'))('freshdesk');config[_0x8807('0x8')]=_[_0x8807('0x9')](config[_0x8807('0x8')],{'host':_0x8807('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8807('0x8')]));var headers={'Content-Type':_0x8807('0xb'),'Accept':'application/json'};function emit(_0x5f128f,_0x57a481,_0x349480){io['to'](_0x5f128f)['emit'](_0x57a481,_0x349480);}function getTicket(_0x36e01f,_0x147e71,_0x478317,_0x59ce80,_0x241182){logger[_0x8807('0xc')]('Creating\x20new\x20ticket...');var _0x1bfbd0=_[_0x8807('0xd')]({'responder_id':_0x147e71['id'],'requester_id':_0x478317['id'],'name':util['format'](_0x8807('0xe'),_0x241182[_0x8807('0xf')]),'phone':_0x241182[_0x8807('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8807('0x11')](_0x59ce80[_0x8807('0x12')],_0x241182,'\x20'),'description':intUtil[_0x8807('0x11')](_0x59ce80[_0x8807('0x13')],_0x241182,_0x8807('0x14')),'tags':getTags(_0x59ce80[_0x8807('0x15')],_0x8807('0x16'))},getCustomFields(_0x59ce80[_0x8807('0x17')],_0x241182));_0x1bfbd0[_0x8807('0x18')]=_[_0x8807('0x19')](_[_0x8807('0x1a')](_0x1bfbd0[_0x8807('0x18')],'id'),'value');return request({'uri':util[_0x8807('0x1b')]('%s/api/v2/tickets',_0x36e01f[_0x8807('0x1c')]),'method':_0x8807('0x1d'),'body':_0x1bfbd0})['then'](function(_0x1086e9){logger[_0x8807('0xc')]('Ticket\x20created!');return _0x1086e9;});}function getUser(_0x38c1d9,_0x406eec){if(intUtil['validateEmail'](_0x406eec)){return request({'uri':util[_0x8807('0x1b')](_0x8807('0x1e'),_0x38c1d9[_0x8807('0x1c')]),'qs':{'email':_0x406eec}})[_0x8807('0x1f')](function(_0x10d3e7){if(_0x10d3e7['length']){logger['info'](_0x8807('0x20'));return _[_0x8807('0x21')](_0x10d3e7,function(_0x2361e6){return _0x2361e6[_0x8807('0x22')][_0x8807('0x23')]===_0x406eec;});}else{logger[_0x8807('0xc')](_0x8807('0x24'));return request({'uri':util[_0x8807('0x1b')](_0x8807('0x25'),_0x38c1d9[_0x8807('0x1c')])})[_0x8807('0x1f')](function(_0x3b59e5){logger[_0x8807('0xc')](_0x8807('0x26'));return _0x3b59e5;});}});}else{logger[_0x8807('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8807('0x1b')](_0x8807('0x25'),_0x38c1d9[_0x8807('0x1c')])})[_0x8807('0x1f')](function(_0xe778b9){logger[_0x8807('0xc')]('Admin\x20account\x20selected.');return _0xe778b9;});}}function getEndUser(_0x260dc8,_0x5cb193,_0x370ee4){logger[_0x8807('0xc')](_0x8807('0x27'),_0x370ee4);return request({'uri':util[_0x8807('0x1b')]('%s/api/v2/contacts',_0x260dc8[_0x8807('0x1c')]),'qs':{'phone':_0x370ee4}})[_0x8807('0x1f')](function(_0x5ba8f1){if(_0x5ba8f1['length']){logger[_0x8807('0xc')](_0x8807('0x28'));return _[_0x8807('0x21')](_0x5ba8f1,{'phone':_0x370ee4});}else{logger[_0x8807('0xc')](_0x8807('0x29'));return request({'uri':util['format'](_0x8807('0x2a'),_0x260dc8[_0x8807('0x1c')]),'method':_0x8807('0x1d'),'body':{'name':_0x5cb193,'phone':_0x370ee4}})[_0x8807('0x1f')](function(_0x423f2c){logger['info'](_0x8807('0x2b'));return _0x423f2c;});}});}function getAuth(_0x5d20c3){return util[_0x8807('0x1b')](_0x8807('0x2c'),new Buffer(_0x5d20c3['apiKey']+':X')['toString'](_0x8807('0x2d')));}function request(_0x35c301){logger[_0x8807('0x2e')](_0x8807('0x2f'),JSON[_0x8807('0x30')](_0x35c301));return rp(_[_0x8807('0x9')](_0x35c301,{'method':_0x8807('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x48f70f,_0xc0783d){var _0x2700f2=[];if(_0x48f70f&&_0x48f70f['length']>0x0){_0x2700f2=_['map'](_0x48f70f,_0xc0783d);}return _0x2700f2;}function getCustomFields(_0x51d8ea,_0x3f411b){var _0x432dea=[];var _0x3548e6={'custom_fields':[]};if(_0x51d8ea[_0x8807('0x32')]>0x0){_[_0x8807('0x33')](_0x51d8ea,function(_0x20cdfd){if(_['includes']([_0x8807('0x34'),'picklist'],_0x20cdfd[_0x8807('0x35')])&&_0x20cdfd['nameField']&&!_0x20cdfd[_0x8807('0x36')]){_0x3548e6[_0x20cdfd['nameField']['toLowerCase']()]=_0x20cdfd[_0x8807('0x37')][_0x8807('0x38')]();}else if(_['includes']([_0x8807('0x34'),_0x8807('0x39')],_0x20cdfd[_0x8807('0x35')])&&_0x20cdfd[_0x8807('0x3a')]&&_0x20cdfd['customField']){_0x3548e6['custom_fields'][_0x8807('0x3b')]({'id':_0x20cdfd['idField'],'value':_0x20cdfd['content']['toString']()});}else if(_0x20cdfd[_0x8807('0x35')]===_0x8807('0x3c')&&_0x20cdfd[_0x8807('0x3d')]&&_0x20cdfd[_0x8807('0x3a')]&&_0x20cdfd[_0x8807('0x36')]){_0x3f411b[_0x20cdfd[_0x8807('0x3d')]]&&_0x3548e6[_0x8807('0x18')][_0x8807('0x3b')]({'id':_0x20cdfd[_0x8807('0x3a')],'value':_0x3f411b[_0x20cdfd[_0x8807('0x3d')]]['toString']()});}else if(_0x20cdfd[_0x8807('0x35')]===_0x8807('0x3e')&&_0x20cdfd[_0x8807('0x3f')]&&_0x20cdfd['Variable'][_0x8807('0x16')]&&_0x20cdfd[_0x8807('0x3a')]&&_0x20cdfd[_0x8807('0x36')]){_0x3f411b[_0x20cdfd[_0x8807('0x3f')]['name']['toLowerCase']()]&&_0x3548e6[_0x8807('0x18')]['push']({'id':_0x20cdfd['idField'],'value':_0x3f411b[_0x20cdfd['Variable'][_0x8807('0x16')]['toLowerCase']()][_0x8807('0x38')]()});}});}return _0x3548e6;}exports[_0x8807('0x40')]=function(_0x20b38c,_0x40682d,_0xe2808b,_0x3456ff,_0x36d802,_0xe1cd8c){var _0xb7314b,_0xeed1b6;_0xe1cd8c[_0x8807('0x1c')]=intUtil['stripTrailingSlash'](_0xe1cd8c[_0x8807('0x1c')]);_0xe1cd8c[_0x8807('0x41')]=intUtil['stripTrailingSlash'](_0xe1cd8c['serverUrl']);if(_0x36d802&&_0x36d802[_0x8807('0x42')]){logger[_0x8807('0xc')]('[QUEUE]',_0x8807('0x43'));_0x40682d[_0x8807('0x44')]=util[_0x8807('0x1b')](_0x8807('0x45'),_0xe1cd8c[_0x8807('0x41')],_0x40682d[_0x8807('0x46')],md5(_0x40682d[_0x8807('0x46')]));}else{_0x40682d[_0x8807('0x44')]='';}headers[_0x8807('0x47')]=getAuth(_0xe1cd8c);return getUser(_0xe1cd8c,_0x3456ff[_0x8807('0x23')])[_0x8807('0x1f')](function(_0x3f7563){_0xb7314b=_0x3f7563;logger[_0x8807('0xc')](_0x8807('0x48'),_0xb7314b['id']);return getEndUser(_0xe1cd8c,_0x40682d[_0x8807('0xf')],_0x40682d['calleridnum']);})[_0x8807('0x1f')](function(_0x4038b7){_0xeed1b6=_0x4038b7;logger[_0x8807('0xc')](_0x8807('0x49'),_0xeed1b6['id']);return getTicket(_0xe1cd8c,_0xb7314b,_0xeed1b6,_0xe2808b,_0x40682d);})[_0x8807('0x1f')](function(_0x552122){if(_0x552122&&_0x552122['id']){logger[_0x8807('0xc')](_0x8807('0x4a'));logger[_0x8807('0xc')]('The\x20Ticket\x20ID\x20is:',_0x552122['id']);logger[_0x8807('0xc')](_0x8807('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8807('0x1b')](_0x8807('0x4c'),_0x3456ff[_0x8807('0x16')]),_0x8807('0x4d'),{'uri':util[_0x8807('0x1b')](_0x8807('0x4e'),_0xe1cd8c[_0x8807('0x1c')],_0x552122['id'])});}})[_0x8807('0x4f')](function(_0x386a01){logger[_0x8807('0x50')](_0x8807('0x4b'),JSON[_0x8807('0x30')](_0x386a01));});};exports[_0x8807('0x51')]=function(_0x47b493,_0x576300,_0x1545e8,_0x583116,_0x56b050,_0x5621a0,_0x2e30ac){var _0x1cf441,_0x33ede3;_0x5621a0['remoteUri']=intUtil[_0x8807('0x52')](_0x5621a0[_0x8807('0x1c')]);_0x5621a0[_0x8807('0x41')]=intUtil[_0x8807('0x52')](_0x5621a0[_0x8807('0x41')]);if(_0x2e30ac&&_0x2e30ac['recordingFormat']&&_0x2e30ac[_0x8807('0x53')]!==_0x8807('0x54')){logger[_0x8807('0xc')](_0x8807('0x55'),_0x8807('0x43'));_0x576300[_0x8807('0x44')]=util['format'](_0x8807('0x45'),_0x5621a0[_0x8807('0x41')],_0x576300[_0x8807('0x46')],md5(_0x576300[_0x8807('0x46')]));}headers[_0x8807('0x47')]=getAuth(_0x5621a0);return getUser(_0x5621a0,_0x583116[_0x8807('0x23')])[_0x8807('0x1f')](function(_0x3b6e0d){_0x1cf441=_0x3b6e0d;logger[_0x8807('0xc')](_0x8807('0x48'),_0x1cf441['id']);return getEndUser(_0x5621a0,_0x576300[_0x8807('0x56')],_0x576300[_0x8807('0x57')]);})[_0x8807('0x1f')](function(_0x46c54c){_0x33ede3=_0x46c54c;logger[_0x8807('0xc')](_0x8807('0x49'),_0x33ede3['id']);return getTicket(_0x5621a0,_0x1cf441,_0x33ede3,_0x1545e8,_0x576300);})[_0x8807('0x1f')](function(_0x53a039){if(_0x53a039&&_0x53a039['id']){logger[_0x8807('0xc')](_0x8807('0x4a'));logger['info'](_0x8807('0x58'),_0x53a039['id']);logger[_0x8807('0xc')](_0x8807('0x55'),_0x8807('0x59'));emit(util[_0x8807('0x1b')](_0x8807('0x4c'),_0x583116[_0x8807('0x16')]),_0x8807('0x4d'),{'uri':util[_0x8807('0x1b')](_0x8807('0x4e'),_0x5621a0['remoteUri'],_0x53a039['id'])});}})[_0x8807('0x4f')](function(_0x453a73){logger[_0x8807('0x50')](_0x8807('0x55'),JSON['stringify'](_0x453a73));});};exports[_0x8807('0x5a')]=function(_0x13b75f,_0x4846a7,_0x360151,_0x2227f0,_0x4a63c0,_0x299018){var _0x4ac76d,_0x529dcd;_0x299018[_0x8807('0x1c')]=intUtil['stripTrailingSlash'](_0x299018[_0x8807('0x1c')]);_0x299018[_0x8807('0x41')]=intUtil[_0x8807('0x52')](_0x299018[_0x8807('0x41')]);if(_0x4a63c0&&_0x4a63c0[_0x8807('0x42')]){logger[_0x8807('0xc')]('['+_0x4846a7[_0x8807('0x5b')][_0x8807('0x5c')]()+']',_0x8807('0x43'));_0x4846a7[_0x8807('0x44')]=util[_0x8807('0x1b')](_0x8807('0x45'),_0x299018[_0x8807('0x41')],_0x4846a7[_0x8807('0x46')],md5(_0x4846a7[_0x8807('0x46')]));}else{_0x4846a7[_0x8807('0x44')]='';}headers[_0x8807('0x47')]=getAuth(_0x299018);return getUser(_0x299018,'')[_0x8807('0x1f')](function(_0x34b0f2){_0x4ac76d=_0x34b0f2;logger[_0x8807('0xc')]('The\x20User\x20ID\x20is:',_0x4ac76d['id']);return getEndUser(_0x299018,_0x4846a7[_0x8807('0xf')],_0x4846a7[_0x8807('0x10')]);})[_0x8807('0x1f')](function(_0x4ffe78){_0x529dcd=_0x4ffe78;logger[_0x8807('0xc')](_0x8807('0x49'),_0x529dcd['id']);return getTicket(_0x299018,_0x4ac76d,_0x529dcd,_0x360151,_0x4846a7);})[_0x8807('0x1f')](function(_0x2996a1){if(_0x2996a1){logger['info'](_0x8807('0x4a'));logger[_0x8807('0xc')](_0x8807('0x58'),_0x2996a1['id']);}})[_0x8807('0x4f')](function(_0x3081ab){logger[_0x8807('0x50')]('['+_0x4846a7['lastevent'][_0x8807('0x5c')]()+']',JSON[_0x8807('0x30')](_0x3081ab));});}; \ No newline at end of file +var _0x879e=['format','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','picklist','nameField','customField','toLowerCase','content','string','type','custom_fields','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','monitor_format','toUpperCase','catch','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!'];(function(_0x1dac5e,_0x170e76){var _0x287b14=function(_0x4ebbe5){while(--_0x4ebbe5){_0x1dac5e['push'](_0x1dac5e['shift']());}};_0x287b14(++_0x170e76);}(_0x879e,0xa3));var _0xe879=function(_0x223bdb,_0x5882e6){_0x223bdb=_0x223bdb-0x0;var _0xef8e68=_0x879e[_0x223bdb];return _0xef8e68;};'use strict';var _=require(_0xe879('0x0'));var rp=require(_0xe879('0x1'));var md5=require(_0xe879('0x2'));var util=require(_0xe879('0x3'));var Redis=require(_0xe879('0x4'));var intUtil=require('./util');var config=require(_0xe879('0x5'));var logger=require(_0xe879('0x6'))(_0xe879('0x7'));config[_0xe879('0x8')]=_[_0xe879('0x9')](config[_0xe879('0x8')],{'host':_0xe879('0xa'),'port':0x18eb});var io=require(_0xe879('0xb'))(new Redis(config[_0xe879('0x8')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x4aba3d,_0x3fd1d4,_0xf54f4){io['to'](_0x4aba3d)[_0xe879('0xc')](_0x3fd1d4,_0xf54f4);}function getTicket(_0x218f08,_0x58290a,_0x3a50b5,_0x398a57,_0x4f3ee2){logger['info'](_0xe879('0xd'));var _0x37d845=_[_0xe879('0xe')]({'responder_id':_0x58290a['id'],'requester_id':_0x3a50b5['id'],'name':util['format'](_0xe879('0xf'),_0x4f3ee2[_0xe879('0x10')]),'phone':_0x4f3ee2[_0xe879('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe879('0x12')](_0x398a57[_0xe879('0x13')],_0x4f3ee2,'\x20'),'description':intUtil[_0xe879('0x12')](_0x398a57[_0xe879('0x14')],_0x4f3ee2,'
'),'tags':getTags(_0x398a57[_0xe879('0x15')],_0xe879('0x16'))},getCustomFields(_0x398a57[_0xe879('0x17')],_0x4f3ee2));_0x37d845['custom_fields']=_['mapValues'](_[_0xe879('0x18')](_0x37d845['custom_fields'],'id'),_0xe879('0x19'));return request({'uri':util['format'](_0xe879('0x1a'),_0x218f08[_0xe879('0x1b')]),'method':_0xe879('0x1c'),'body':_0x37d845})['then'](function(_0x3b2265){logger[_0xe879('0x1d')](_0xe879('0x1e'));return _0x3b2265;});}function getUser(_0x5eb1af,_0x1eb231){if(intUtil['validateEmail'](_0x1eb231)){return request({'uri':util[_0xe879('0x1f')](_0xe879('0x20'),_0x5eb1af[_0xe879('0x1b')]),'qs':{'email':_0x1eb231}})[_0xe879('0x21')](function(_0x42e00d){if(_0x42e00d[_0xe879('0x22')]){logger[_0xe879('0x1d')](_0xe879('0x23'));return _[_0xe879('0x24')](_0x42e00d,function(_0x1db846){return _0x1db846[_0xe879('0x25')]['email']===_0x1eb231;});}else{logger[_0xe879('0x1d')](_0xe879('0x26'));return request({'uri':util[_0xe879('0x1f')](_0xe879('0x27'),_0x5eb1af[_0xe879('0x1b')])})['then'](function(_0x25ac0d){logger[_0xe879('0x1d')](_0xe879('0x28'));return _0x25ac0d;});}});}else{logger[_0xe879('0x1d')](_0xe879('0x29'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x5eb1af[_0xe879('0x1b')])})[_0xe879('0x21')](function(_0x448793){logger[_0xe879('0x1d')](_0xe879('0x28'));return _0x448793;});}}function getEndUser(_0x3b2255,_0x5e9b2d,_0x2a4359){logger[_0xe879('0x1d')](_0xe879('0x2a'),_0x2a4359);return request({'uri':util['format'](_0xe879('0x2b'),_0x3b2255[_0xe879('0x1b')]),'qs':{'phone':_0x2a4359}})[_0xe879('0x21')](function(_0x5ba177){if(_0x5ba177[_0xe879('0x22')]){logger[_0xe879('0x1d')](_0xe879('0x2c'));return _['find'](_0x5ba177,{'phone':_0x2a4359});}else{logger[_0xe879('0x1d')](_0xe879('0x2d'));return request({'uri':util[_0xe879('0x1f')]('%s/api/v2/contacts',_0x3b2255['remoteUri']),'method':_0xe879('0x1c'),'body':{'name':_0x5e9b2d,'phone':_0x2a4359}})[_0xe879('0x21')](function(_0x294965){logger[_0xe879('0x1d')]('Enduser\x20created.');return _0x294965;});}});}function getAuth(_0x5d31b4){return util['format'](_0xe879('0x2e'),new Buffer(_0x5d31b4[_0xe879('0x2f')]+':X')[_0xe879('0x30')](_0xe879('0x31')));}function request(_0x820306){logger[_0xe879('0x32')](_0xe879('0x33'),JSON[_0xe879('0x34')](_0x820306));return rp(_[_0xe879('0x9')](_0x820306,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4a7a32,_0x53443c){var _0x539426=[];if(_0x4a7a32&&_0x4a7a32[_0xe879('0x22')]>0x0){_0x539426=_['map'](_0x4a7a32,_0x53443c);}return _0x539426;}function getCustomFields(_0x3e712b,_0x34a1b9){var _0x109ae6=[];var _0x294ac0={'custom_fields':[]};if(_0x3e712b['length']>0x0){_[_0xe879('0x35')](_0x3e712b,function(_0x74df88){if(_[_0xe879('0x36')](['string',_0xe879('0x37')],_0x74df88['type'])&&_0x74df88[_0xe879('0x38')]&&!_0x74df88[_0xe879('0x39')]){_0x294ac0[_0x74df88[_0xe879('0x38')][_0xe879('0x3a')]()]=_0x74df88[_0xe879('0x3b')]['toString']();}else if(_[_0xe879('0x36')]([_0xe879('0x3c'),_0xe879('0x37')],_0x74df88[_0xe879('0x3d')])&&_0x74df88['idField']&&_0x74df88[_0xe879('0x39')]){_0x294ac0[_0xe879('0x3e')]['push']({'id':_0x74df88[_0xe879('0x3f')],'value':_0x74df88[_0xe879('0x3b')][_0xe879('0x30')]()});}else if(_0x74df88[_0xe879('0x3d')]===_0xe879('0x40')&&_0x74df88[_0xe879('0x41')]&&_0x74df88['idField']&&_0x74df88['customField']){_0x34a1b9[_0x74df88[_0xe879('0x41')]]&&_0x294ac0[_0xe879('0x3e')][_0xe879('0x42')]({'id':_0x74df88[_0xe879('0x3f')],'value':_0x34a1b9[_0x74df88[_0xe879('0x41')]][_0xe879('0x30')]()});}else if(_0x74df88[_0xe879('0x3d')]===_0xe879('0x43')&&_0x74df88[_0xe879('0x44')]&&_0x74df88['Variable'][_0xe879('0x16')]&&_0x74df88['idField']&&_0x74df88[_0xe879('0x39')]){_0x34a1b9[_0x74df88[_0xe879('0x44')][_0xe879('0x16')][_0xe879('0x3a')]()]&&_0x294ac0[_0xe879('0x3e')]['push']({'id':_0x74df88[_0xe879('0x3f')],'value':_0x34a1b9[_0x74df88[_0xe879('0x44')][_0xe879('0x16')]['toLowerCase']()][_0xe879('0x30')]()});}});}return _0x294ac0;}exports[_0xe879('0x45')]=function(_0x7ca1c1,_0x58e333,_0x1de3bc,_0x47697c,_0x580c18,_0x3705d2){var _0x220d65,_0x5a7b1f;_0x3705d2['remoteUri']=intUtil[_0xe879('0x46')](_0x3705d2[_0xe879('0x1b')]);_0x3705d2[_0xe879('0x47')]=intUtil['stripTrailingSlash'](_0x3705d2[_0xe879('0x47')]);if(_0x580c18&&_0x580c18['monitor_format']){logger[_0xe879('0x1d')](_0xe879('0x48'),_0xe879('0x49'));_0x58e333[_0xe879('0x4a')]=util[_0xe879('0x1f')](_0xe879('0x4b'),_0x3705d2[_0xe879('0x47')],_0x58e333['uniqueid'],md5(_0x58e333['uniqueid']));}else{_0x58e333['recordingURL']='';}headers[_0xe879('0x4c')]=getAuth(_0x3705d2);return getUser(_0x3705d2,_0x47697c[_0xe879('0x4d')])[_0xe879('0x21')](function(_0x292a41){_0x220d65=_0x292a41;logger['info'](_0xe879('0x4e'),_0x220d65['id']);return getEndUser(_0x3705d2,_0x58e333['calleridname'],_0x58e333[_0xe879('0x11')]);})[_0xe879('0x21')](function(_0x56fdd4){_0x5a7b1f=_0x56fdd4;logger['info'](_0xe879('0x4f'),_0x5a7b1f['id']);return getTicket(_0x3705d2,_0x220d65,_0x5a7b1f,_0x1de3bc,_0x58e333);})['then'](function(_0x3828cc){if(_0x3828cc&&_0x3828cc['id']){logger[_0xe879('0x1d')](_0xe879('0x1e'));logger[_0xe879('0x1d')](_0xe879('0x50'),_0x3828cc['id']);logger[_0xe879('0x1d')](_0xe879('0x48'),_0xe879('0x51'));emit(util[_0xe879('0x1f')](_0xe879('0x52'),_0x47697c['name']),_0xe879('0x53'),{'uri':util[_0xe879('0x1f')](_0xe879('0x54'),_0x3705d2[_0xe879('0x1b')],_0x3828cc['id'])});}})['catch'](function(_0x1672e5){logger[_0xe879('0x55')]('[QUEUE]',JSON[_0xe879('0x34')](_0x1672e5));});};exports[_0xe879('0x56')]=function(_0x3fe4d9,_0x22cb69,_0x546b2e,_0x320448,_0x5b28a8,_0x4a82bf,_0x4706b3){var _0x492304,_0x5a7b26;_0x4a82bf['remoteUri']=intUtil[_0xe879('0x46')](_0x4a82bf['remoteUri']);_0x4a82bf[_0xe879('0x47')]=intUtil[_0xe879('0x46')](_0x4a82bf[_0xe879('0x47')]);if(_0x4706b3&&_0x4706b3[_0xe879('0x57')]&&_0x4706b3[_0xe879('0x57')]!==_0xe879('0x58')){logger[_0xe879('0x1d')](_0xe879('0x59'),_0xe879('0x49'));_0x22cb69[_0xe879('0x4a')]=util['format'](_0xe879('0x4b'),_0x4a82bf['serverUrl'],_0x22cb69[_0xe879('0x5a')],md5(_0x22cb69[_0xe879('0x5a')]));}headers[_0xe879('0x4c')]=getAuth(_0x4a82bf);return getUser(_0x4a82bf,_0x320448['email'])[_0xe879('0x21')](function(_0x1a023f){_0x492304=_0x1a023f;logger[_0xe879('0x1d')]('The\x20User\x20ID\x20is:',_0x492304['id']);return getEndUser(_0x4a82bf,_0x22cb69[_0xe879('0x5b')],_0x22cb69[_0xe879('0x5c')]);})[_0xe879('0x21')](function(_0xb80d74){_0x5a7b26=_0xb80d74;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5a7b26['id']);return getTicket(_0x4a82bf,_0x492304,_0x5a7b26,_0x546b2e,_0x22cb69);})[_0xe879('0x21')](function(_0x3faba8){if(_0x3faba8&&_0x3faba8['id']){logger[_0xe879('0x1d')]('Ticket\x20created!');logger[_0xe879('0x1d')](_0xe879('0x50'),_0x3faba8['id']);logger[_0xe879('0x1d')](_0xe879('0x59'),_0xe879('0x51'));emit(util[_0xe879('0x1f')](_0xe879('0x52'),_0x320448[_0xe879('0x16')]),_0xe879('0x53'),{'uri':util[_0xe879('0x1f')](_0xe879('0x54'),_0x4a82bf['remoteUri'],_0x3faba8['id'])});}})['catch'](function(_0x23606f){logger['error'](_0xe879('0x59'),JSON['stringify'](_0x23606f));});};exports['unmanaged']=function(_0x44e6d7,_0xc8d8a,_0x31e868,_0xd406c2,_0xaa992b,_0x143135){var _0x5a83aa,_0x337f6c;_0x143135[_0xe879('0x1b')]=intUtil['stripTrailingSlash'](_0x143135['remoteUri']);_0x143135[_0xe879('0x47')]=intUtil[_0xe879('0x46')](_0x143135[_0xe879('0x47')]);if(_0xaa992b&&_0xaa992b[_0xe879('0x5d')]){logger[_0xe879('0x1d')]('['+_0xc8d8a['lastevent'][_0xe879('0x5e')]()+']',_0xe879('0x49'));_0xc8d8a[_0xe879('0x4a')]=util[_0xe879('0x1f')](_0xe879('0x4b'),_0x143135[_0xe879('0x47')],_0xc8d8a['uniqueid'],md5(_0xc8d8a[_0xe879('0x5a')]));}else{_0xc8d8a[_0xe879('0x4a')]='';}headers[_0xe879('0x4c')]=getAuth(_0x143135);return getUser(_0x143135,'')[_0xe879('0x21')](function(_0xfa82bb){_0x5a83aa=_0xfa82bb;logger[_0xe879('0x1d')](_0xe879('0x4e'),_0x5a83aa['id']);return getEndUser(_0x143135,_0xc8d8a[_0xe879('0x10')],_0xc8d8a[_0xe879('0x11')]);})['then'](function(_0x12e60b){_0x337f6c=_0x12e60b;logger[_0xe879('0x1d')](_0xe879('0x4f'),_0x337f6c['id']);return getTicket(_0x143135,_0x5a83aa,_0x337f6c,_0x31e868,_0xc8d8a);})[_0xe879('0x21')](function(_0x242865){if(_0x242865){logger[_0xe879('0x1d')](_0xe879('0x1e'));logger['info'](_0xe879('0x50'),_0x242865['id']);}})[_0xe879('0x5f')](function(_0x1f334a){logger['error']('['+_0xc8d8a[_0xe879('0x60')][_0xe879('0x5e')]()+']',JSON[_0xe879('0x34')](_0x1f334a));});}; \ 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 a409a33..d2ce583 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 _0x0136=['freshsales','redis','defaults','socket.io-emitter','headers','info','Getting\x20admin\x20information','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','catch','GET','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','then','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/logger'];(function(_0x329175,_0x39a335){var _0x11f251=function(_0x502b71){while(--_0x502b71){_0x329175['push'](_0x329175['shift']());}};_0x11f251(++_0x39a335);}(_0x0136,0x1ab));var _0x6013=function(_0x16e185,_0x3d1b29){_0x16e185=_0x16e185-0x0;var _0x457561=_0x0136[_0x16e185];return _0x457561;};'use strict';var _=require(_0x6013('0x0'));var rp=require(_0x6013('0x1'));var md5=require(_0x6013('0x2'));var util=require(_0x6013('0x3'));var moment=require(_0x6013('0x4'));var Promise=require('bluebird');var Redis=require(_0x6013('0x5'));var intUtil=require(_0x6013('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6013('0x7'))(_0x6013('0x8'));config[_0x6013('0x9')]=_[_0x6013('0xa')](config[_0x6013('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x6013('0xb'))(new Redis(config[_0x6013('0x9')]));function getAdminId(_0x267a56,_0x1ae3c1,_0x10de9f,_0x1cc848){return new Promise(function(_0xb03f67,_0x1a8ec6){var _0x44240a=![];var _0x291145={'method':'GET','uri':_0x1cc848+'/api/selector/owners','json':!![]};_0x291145[_0x6013('0xc')]=_0x10de9f;logger[_0x6013('0xd')](_0x6013('0xe'));return rp(_0x291145)['then'](function(_0x5763e4){if(_0x5763e4){var _0x1de6ae=_0x5763e4['users'];var _0xdb0670=null;for(_0xdb0670=0x0;_0xdb0670<_0x1de6ae[_0x6013('0xf')];_0xdb0670++){if(_0x1de6ae[_0xdb0670][_0x6013('0x10')]===_0x267a56[_0x6013('0x11')]){_0x267a56['adminId']=_0x1de6ae[_0xdb0670]['id'];_0x44240a=!![];}}if(_0x44240a){logger[_0x6013('0xd')](_0x6013('0x12'),_0x267a56[_0x6013('0x13')]);_0xb03f67(_0x267a56);}else{_0x1a8ec6({'statusCode':0x194,'message':_0x6013('0x14')});}}else{_0x1a8ec6({'statusCode':0x194,'message':_0x6013('0x14')});}})['catch'](function(_0x1e9320){logger[_0x6013('0x15')]('['+[_0x1ae3c1[_0x6013('0x16')]()]+']',_0x1e9320[_0x6013('0x17')]);_0x1a8ec6(_0x1e9320);});});}function getUser(_0x23a09b,_0x3a1fbf,_0x3be0c4){return function(_0xdc67cf){return new Promise(function(_0x51ecdb,_0x3c63af){var _0x36eee6={'method':'GET','uri':_0x3be0c4+_0x6013('0x18'),'json':!![]};_0x36eee6[_0x6013('0xc')]=_0x3a1fbf;logger[_0x6013('0xd')](_0x6013('0x19'));return rp(_0x36eee6)['then'](function(_0x5d3fd5){if(_0x5d3fd5){var _0x2a5fbc=_0x5d3fd5['users'];var _0x46550d=![];var _0x4a80de=null;if(_0xdc67cf[_0x6013('0x1a')]!==null){logger[_0x6013('0xd')](_0x6013('0x1b'),_0xdc67cf[_0x6013('0x1a')]);_0xdc67cf['userEmail']=_0xdc67cf[_0x6013('0x1a')];for(_0x4a80de=0x0;_0x4a80de<_0x2a5fbc['length'];_0x4a80de++){if(_0x2a5fbc[_0x4a80de][_0x6013('0x10')]===_0xdc67cf[_0x6013('0x1a')]){_0x46550d=!![];_0xdc67cf[_0x6013('0x1c')]=_0x2a5fbc[_0x4a80de]['id'];logger[_0x6013('0xd')]('User\x20found:',_0xdc67cf[_0x6013('0x1c')]);}}}if(!_0x46550d){logger[_0x6013('0xd')](_0x6013('0x1d'));_0xdc67cf[_0x6013('0x1e')]=_0xdc67cf[_0x6013('0x11')];_0xdc67cf[_0x6013('0x1c')]=_0xdc67cf[_0x6013('0x13')];_0x46550d=!![];}if(_0x46550d){_0x51ecdb(_0xdc67cf);}else{_0x3c63af({'statusCode':0x194,'message':_0x6013('0x14')});}}else{_0x3c63af({'statusCode':0x194,'message':_0x6013('0x14')});}})[_0x6013('0x1f')](function(_0x3cf104){logger[_0x6013('0x15')]('['+[_0x23a09b[_0x6013('0x16')]()]+']',_0x3cf104[_0x6013('0x17')]);_0x3c63af(_0x3cf104);});});};}function searchContact(_0x43b8b9,_0x4ca100,_0xa55f14,_0x394f0a){return new Promise(function(_0x2453c1,_0x4775e9){var _0x5a2a48={'method':_0x6013('0x20'),'headers':_0x4ca100,'uri':_0x43b8b9+_0x6013('0x21')+_0x394f0a+_0x6013('0x22')+_0xa55f14+_0x6013('0x23'),'json':!![]};rp(_0x5a2a48)['then'](function(_0x23d786){var _0x5ba97e=_[_0x6013('0x24')](_0x23d786['contacts'][_0x6013('0x25')],[_0xa55f14,_0x394f0a]);_0x2453c1(_0x5ba97e);})[_0x6013('0x1f')](function(_0x3f1505){_0x4775e9(_0x3f1505);});});}function getEndUser(_0x1ad449,_0x5925d7,_0x23121c){return function(_0x1c72f2){return new Promise(function(_0x3d3ae5,_0x2e1ae2){logger['info'](util[_0x6013('0x26')](_0x6013('0x27'),_0x1c72f2['contactNumber']));searchContact(_0x23121c,_0x5925d7,_0x6013('0x28'),_0x1c72f2['contactNumber'])['then'](function(_0x202fba){if(_0x202fba){_0x1c72f2[_0x6013('0x29')]=_0x202fba['id'];logger['info'](_0x6013('0x2a'),_0x1c72f2['endUserId']);return _0x3d3ae5(_0x1c72f2);}searchContact(_0x23121c,_0x5925d7,_0x6013('0x2b'),_0x1c72f2['contactNumber'])[_0x6013('0x2c')](function(_0x3cdc6d){if(_0x3cdc6d){_0x1c72f2['endUserId']=_0x3cdc6d['id'];logger[_0x6013('0xd')](_0x6013('0x2d'),_0x1c72f2[_0x6013('0x29')]);return _0x3d3ae5(_0x1c72f2);}createEndUser(_0x1c72f2,_0x1ad449,_0x5925d7,_0x23121c)[_0x6013('0x2c')](function(_0x280a64){logger[_0x6013('0xd')](_0x6013('0x2e'),_0x280a64[_0x6013('0x29')]);return _0x3d3ae5(_0x280a64);});});})[_0x6013('0x1f')](function(_0x502ae4){_0x2e1ae2(_0x502ae4);});});};}function createEndUser(_0x461283,_0x265984,_0x4e2e37,_0x3a2c34){return new Promise(function(_0xae5fe4,_0x3d0590){var _0x1681e9=moment();var _0x4e7111={'method':_0x6013('0x2f'),'uri':_0x3a2c34+_0x6013('0x30'),'body':{'contact':{'last_name':_0x461283[_0x6013('0x31')],'work_number':_0x461283[_0x6013('0x31')],'mobile_number':_0x461283[_0x6013('0x31')],'owner_id':_0x461283[_0x6013('0x1c')],'created_at':_0x1681e9[_0x6013('0x26')](_0x6013('0x32'))}},'json':!![]};_0x4e7111['headers']=_0x4e2e37;logger[_0x6013('0xd')](_0x6013('0x33'));return rp(_0x4e7111)[_0x6013('0x2c')](function(_0x8f8883){_0x461283[_0x6013('0x29')]=_0x8f8883[_0x6013('0x34')]['id'];_0xae5fe4(_0x461283);})['catch'](function(_0x289158){logger[_0x6013('0x15')]('['+[_0x265984['toUpperCase']()]+']',_0x289158[_0x6013('0x17')]);_0x3d0590(_0x289158[_0x6013('0x17')]);});});}function getTicket(_0x41d64f,_0x3a3018,_0x395b47,_0x46272d,_0x1b5ff2){return function(_0x5668fe){logger[_0x6013('0xd')](_0x6013('0x35'));return new Promise(function(_0x4a6986,_0x290bb5){var _0x2edf3b=moment();var _0x1ec177={'method':_0x6013('0x2f'),'uri':_0x395b47+'/api/tasks','body':{'title':intUtil[_0x6013('0x36')](_0x46272d['Subjects'],_0x1b5ff2,'\x20'),'description':intUtil[_0x6013('0x36')](_0x46272d[_0x6013('0x37')],_0x1b5ff2,'\x0a'),'owner_id':_0x5668fe[_0x6013('0x1c')],'creater_id':_0x5668fe[_0x6013('0x13')],'targetable_id':_0x5668fe[_0x6013('0x29')],'targetable_type':_0x6013('0x38'),'created_at':_0x2edf3b[_0x6013('0x26')](_0x6013('0x32')),'due_date':_0x2edf3b[_0x6013('0x39')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1ec177['headers']=_0x3a3018;return rp(_0x1ec177)[_0x6013('0x2c')](function(_0x4c359e){_0x5668fe['ticketId']=_0x4c359e[_0x6013('0x3a')]['id'];logger[_0x6013('0xd')](_0x6013('0x3b'),_0x5668fe[_0x6013('0x3c')]);_0x4a6986(_0x5668fe);})[_0x6013('0x1f')](function(_0x1b28dc){logger['error']('['+[_0x41d64f[_0x6013('0x16')]()]+']',_0x1b28dc[_0x6013('0x17')]);_0x290bb5(_0x1b28dc[_0x6013('0x17')]);});});};}function emit(_0x5a42ac,_0x24eb70,_0x56ad3d){var _0x3cf77d={'uri':_0x5a42ac+_0x6013('0x3d')+_0x56ad3d};io['to'](util[_0x6013('0x26')](_0x6013('0x3e'),_0x24eb70))['emit'](_0x6013('0x3f'),_0x3cf77d);}exports['cs']=function(_0xa0c0a8,_0xdf0f07,_0x2cbc10,_0x1f308c,_0x2a3893,_0x783568,_0x4bd8f7,_0xc22dca){var _0x1c39c1={};var _0x429e78={'Authorization':_0x6013('0x40')+_0x783568[_0x6013('0x41')]};_0x783568[_0x6013('0x42')]=intUtil[_0x6013('0x43')](_0x783568[_0x6013('0x42')]);_0x783568[_0x6013('0x44')]=intUtil[_0x6013('0x43')](_0x783568[_0x6013('0x44')]);var _0x49cbf2=_0x783568[_0x6013('0x42')];_0x1c39c1[_0x6013('0x11')]=_0x783568['username'];_0x1c39c1[_0x6013('0x31')]=_0xc22dca[_0x6013('0x45')]()===_0x6013('0x46')?_0xdf0f07[_0x6013('0x47')]:_0xdf0f07[_0x6013('0x48')];_0x1c39c1[_0x6013('0x49')]=_0xc22dca===_0x6013('0x4a')||_0xc22dca==='unmanaged'?'queue':_0x6013('0x46');if(_0x1f308c){_0x1c39c1[_0x6013('0x1a')]=_0x1f308c[_0x6013('0x10')];}var _0x5ee4f6=util['format'](_0x6013('0x4b'),_0x783568[_0x6013('0x44')],_0xdf0f07[_0x6013('0x4c')],md5(_0xdf0f07[_0x6013('0x4c')]));if(_0x2a3893&&_0x2a3893[_0x6013('0x4d')]){logger[_0x6013('0xd')]('[QUEUE]',_0x6013('0x4e'));_0xdf0f07[_0x6013('0x4f')]=_0x5ee4f6;}else if(_0x4bd8f7&&_0x4bd8f7[_0x6013('0x50')]&&_0x4bd8f7[_0x6013('0x50')]!==_0x6013('0x51')){logger['info'](_0x6013('0x52'),_0x6013('0x4e'));_0xdf0f07['recordingURL']=_0x5ee4f6;}else{_0xdf0f07[_0x6013('0x4f')]='';}return getAdminId(_0x1c39c1,_0xc22dca,_0x429e78,_0x49cbf2)[_0x6013('0x2c')](getUser(_0xc22dca,_0x429e78,_0x49cbf2))[_0x6013('0x2c')](getEndUser(_0xc22dca,_0x429e78,_0x49cbf2))[_0x6013('0x2c')](getTicket(_0xc22dca,_0x429e78,_0x49cbf2,_0x2cbc10,_0xdf0f07))[_0x6013('0x2c')](function(_0x32357d){logger['info'](util[_0x6013('0x26')](_0x6013('0x53'),_0x32357d['ticketId']));if(_0xc22dca!=='unmanaged'){logger['info']('['+[_0xc22dca[_0x6013('0x16')]()]+']',_0x6013('0x54'));emit(_0x49cbf2,_0x1f308c['name'],_0x32357d[_0x6013('0x29')]);}})[_0x6013('0x1f')](function(_0x2df9dd){logger[_0x6013('0x15')]('['+[_0xc22dca[_0x6013('0x16')]()]+_0x6013('0x55'),util[_0x6013('0x56')](_0x2df9dd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xae25=['&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xae25,0x187));var _0x5ae2=function(_0x121433,_0x51e62b){_0x121433=_0x121433-0x0;var _0x3229ed=_0xae25[_0x121433];return _0x3229ed;};'use strict';var _=require(_0x5ae2('0x0'));var rp=require(_0x5ae2('0x1'));var md5=require(_0x5ae2('0x2'));var util=require(_0x5ae2('0x3'));var moment=require(_0x5ae2('0x4'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x5ae2('0x5'));var config=require(_0x5ae2('0x6'));var logger=require(_0x5ae2('0x7'))(_0x5ae2('0x8'));config[_0x5ae2('0x9')]=_[_0x5ae2('0xa')](config[_0x5ae2('0x9')],{'host':_0x5ae2('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ae2('0x9')]));function getAdminId(_0x232567,_0x459b34,_0x1fafa3,_0x4260dd){return new Promise(function(_0x5270a0,_0x567118){var _0x3d6c12=![];var _0x8c4d61={'method':_0x5ae2('0xc'),'uri':_0x4260dd+_0x5ae2('0xd'),'json':!![]};_0x8c4d61[_0x5ae2('0xe')]=_0x1fafa3;logger[_0x5ae2('0xf')](_0x5ae2('0x10'));return rp(_0x8c4d61)[_0x5ae2('0x11')](function(_0x413842){if(_0x413842){var _0x49e349=_0x413842[_0x5ae2('0x12')];var _0x3c8492=null;for(_0x3c8492=0x0;_0x3c8492<_0x49e349[_0x5ae2('0x13')];_0x3c8492++){if(_0x49e349[_0x3c8492]['email']===_0x232567[_0x5ae2('0x14')]){_0x232567[_0x5ae2('0x15')]=_0x49e349[_0x3c8492]['id'];_0x3d6c12=!![];}}if(_0x3d6c12){logger[_0x5ae2('0xf')](_0x5ae2('0x16'),_0x232567[_0x5ae2('0x15')]);_0x5270a0(_0x232567);}else{_0x567118({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x567118({'statusCode':0x194,'message':_0x5ae2('0x17')});}})[_0x5ae2('0x18')](function(_0x350e0e){logger[_0x5ae2('0x19')]('['+[_0x459b34[_0x5ae2('0x1a')]()]+']',_0x350e0e['message']);_0x567118(_0x350e0e);});});}function getUser(_0x425cb2,_0x2b7c42,_0x51ea80){return function(_0xa162e7){return new Promise(function(_0x1792ec,_0x4eb3c8){var _0x207298={'method':_0x5ae2('0xc'),'uri':_0x51ea80+_0x5ae2('0xd'),'json':!![]};_0x207298[_0x5ae2('0xe')]=_0x2b7c42;logger['info']('Getting\x20user\x20list');return rp(_0x207298)[_0x5ae2('0x11')](function(_0x2465cd){if(_0x2465cd){var _0x31b7c5=_0x2465cd[_0x5ae2('0x12')];var _0x1c3777=![];var _0x1e2b33=null;if(_0xa162e7[_0x5ae2('0x1b')]!==null){logger[_0x5ae2('0xf')](_0x5ae2('0x1c'),_0xa162e7[_0x5ae2('0x1b')]);_0xa162e7[_0x5ae2('0x1d')]=_0xa162e7['agentEmail'];for(_0x1e2b33=0x0;_0x1e2b33<_0x31b7c5[_0x5ae2('0x13')];_0x1e2b33++){if(_0x31b7c5[_0x1e2b33]['email']===_0xa162e7[_0x5ae2('0x1b')]){_0x1c3777=!![];_0xa162e7[_0x5ae2('0x1e')]=_0x31b7c5[_0x1e2b33]['id'];logger['info'](_0x5ae2('0x1f'),_0xa162e7['userId']);}}}if(!_0x1c3777){logger[_0x5ae2('0xf')](_0x5ae2('0x20'));_0xa162e7[_0x5ae2('0x1d')]=_0xa162e7['adminEmail'];_0xa162e7[_0x5ae2('0x1e')]=_0xa162e7['adminId'];_0x1c3777=!![];}if(_0x1c3777){_0x1792ec(_0xa162e7);}else{_0x4eb3c8({'statusCode':0x194,'message':_0x5ae2('0x17')});}}else{_0x4eb3c8({'statusCode':0x194,'message':_0x5ae2('0x17')});}})[_0x5ae2('0x18')](function(_0x571c5e){logger[_0x5ae2('0x19')]('['+[_0x425cb2[_0x5ae2('0x1a')]()]+']',_0x571c5e[_0x5ae2('0x21')]);_0x4eb3c8(_0x571c5e);});});};}function searchContact(_0x4f166b,_0x5a35c5,_0x2caf37,_0x35d9d5){return new Promise(function(_0x533014,_0x2a4dd2){var _0x381756={'method':_0x5ae2('0xc'),'headers':_0x5a35c5,'uri':_0x4f166b+'/api/lookup?q='+_0x35d9d5+_0x5ae2('0x22')+_0x2caf37+_0x5ae2('0x23'),'json':!![]};rp(_0x381756)[_0x5ae2('0x11')](function(_0x1c110b){var _0x1b9fa8=_[_0x5ae2('0x24')](_0x1c110b[_0x5ae2('0x25')]['contacts'],[_0x2caf37,_0x35d9d5]);_0x533014(_0x1b9fa8);})[_0x5ae2('0x18')](function(_0x4d8f40){_0x2a4dd2(_0x4d8f40);});});}function getEndUser(_0x4739e8,_0x53be61,_0x439729){return function(_0x3a1a32){return new Promise(function(_0x1c28e8,_0x281997){logger[_0x5ae2('0xf')](util[_0x5ae2('0x26')](_0x5ae2('0x27'),_0x3a1a32[_0x5ae2('0x28')]));searchContact(_0x439729,_0x53be61,_0x5ae2('0x29'),_0x3a1a32[_0x5ae2('0x28')])[_0x5ae2('0x11')](function(_0x3a0488){if(_0x3a0488){_0x3a1a32[_0x5ae2('0x2a')]=_0x3a0488['id'];logger[_0x5ae2('0xf')](_0x5ae2('0x2b'),_0x3a1a32['endUserId']);return _0x1c28e8(_0x3a1a32);}searchContact(_0x439729,_0x53be61,_0x5ae2('0x2c'),_0x3a1a32[_0x5ae2('0x28')])[_0x5ae2('0x11')](function(_0x30bd36){if(_0x30bd36){_0x3a1a32[_0x5ae2('0x2a')]=_0x30bd36['id'];logger[_0x5ae2('0xf')](_0x5ae2('0x2d'),_0x3a1a32['endUserId']);return _0x1c28e8(_0x3a1a32);}createEndUser(_0x3a1a32,_0x4739e8,_0x53be61,_0x439729)[_0x5ae2('0x11')](function(_0x17ad97){logger[_0x5ae2('0xf')]('Contact\x20created:',_0x17ad97['endUserId']);return _0x1c28e8(_0x17ad97);});});})[_0x5ae2('0x18')](function(_0x3cffe5){_0x281997(_0x3cffe5);});});};}function createEndUser(_0x541f62,_0xadbaff,_0x11370b,_0x3aa987){return new Promise(function(_0x5c7e7b,_0x407032){var _0x49aa87=moment();var _0xbb1670={'method':_0x5ae2('0x2e'),'uri':_0x3aa987+_0x5ae2('0x2f'),'body':{'contact':{'last_name':_0x541f62[_0x5ae2('0x28')],'work_number':_0x541f62['contactNumber'],'mobile_number':_0x541f62[_0x5ae2('0x28')],'owner_id':_0x541f62[_0x5ae2('0x1e')],'created_at':_0x49aa87['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xbb1670[_0x5ae2('0xe')]=_0x11370b;logger['info'](_0x5ae2('0x30'));return rp(_0xbb1670)['then'](function(_0x24d088){_0x541f62[_0x5ae2('0x2a')]=_0x24d088[_0x5ae2('0x31')]['id'];_0x5c7e7b(_0x541f62);})[_0x5ae2('0x18')](function(_0x131e38){logger[_0x5ae2('0x19')]('['+[_0xadbaff[_0x5ae2('0x1a')]()]+']',_0x131e38[_0x5ae2('0x21')]);_0x407032(_0x131e38[_0x5ae2('0x21')]);});});}function getTicket(_0xe96f0a,_0xd96a95,_0xe589ba,_0xe35717,_0x8b6d6a){return function(_0x5b7b52){logger[_0x5ae2('0xf')](_0x5ae2('0x32'));return new Promise(function(_0x3ecb19,_0x3785e6){var _0xb6ad3f=moment();var _0x578fa3={'method':_0x5ae2('0x2e'),'uri':_0xe589ba+_0x5ae2('0x33'),'body':{'title':intUtil[_0x5ae2('0x34')](_0xe35717[_0x5ae2('0x35')],_0x8b6d6a,'\x20'),'description':intUtil[_0x5ae2('0x34')](_0xe35717[_0x5ae2('0x36')],_0x8b6d6a,'\x0a'),'owner_id':_0x5b7b52[_0x5ae2('0x1e')],'creater_id':_0x5b7b52[_0x5ae2('0x15')],'targetable_id':_0x5b7b52['endUserId'],'targetable_type':_0x5ae2('0x37'),'created_at':_0xb6ad3f[_0x5ae2('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xb6ad3f['add'](0x1e,'m')[_0x5ae2('0x26')](_0x5ae2('0x38'))},'json':!![]};_0x578fa3[_0x5ae2('0xe')]=_0xd96a95;return rp(_0x578fa3)[_0x5ae2('0x11')](function(_0x2c0338){_0x5b7b52[_0x5ae2('0x39')]=_0x2c0338[_0x5ae2('0x3a')]['id'];logger[_0x5ae2('0xf')](_0x5ae2('0x3b'),_0x5b7b52[_0x5ae2('0x39')]);_0x3ecb19(_0x5b7b52);})['catch'](function(_0x113c2e){logger[_0x5ae2('0x19')]('['+[_0xe96f0a[_0x5ae2('0x1a')]()]+']',_0x113c2e[_0x5ae2('0x21')]);_0x3785e6(_0x113c2e[_0x5ae2('0x21')]);});});};}function emit(_0x2927cb,_0x5018e2,_0x332b60){var _0x3cd0d7={'uri':_0x2927cb+_0x5ae2('0x3c')+_0x332b60};io['to'](util['format'](_0x5ae2('0x3d'),_0x5018e2))[_0x5ae2('0x3e')](_0x5ae2('0x3f'),_0x3cd0d7);}exports['cs']=function(_0x50ac51,_0x126653,_0x4f0f64,_0x4b3347,_0x3dee63,_0xf9d7da,_0x17e852,_0x4335a1){var _0x567ece={};var _0x55462b={'Authorization':_0x5ae2('0x40')+_0xf9d7da[_0x5ae2('0x41')]};_0xf9d7da['remoteUri']=intUtil['stripTrailingSlash'](_0xf9d7da[_0x5ae2('0x42')]);_0xf9d7da[_0x5ae2('0x43')]=intUtil[_0x5ae2('0x44')](_0xf9d7da['serverUrl']);var _0x5bf855=_0xf9d7da['remoteUri'];_0x567ece[_0x5ae2('0x14')]=_0xf9d7da[_0x5ae2('0x45')];_0x567ece[_0x5ae2('0x28')]=_0x4335a1['toLowerCase']()==='outbound'?_0x126653['destcalleridnum']:_0x126653[_0x5ae2('0x46')];_0x567ece['callDirection']=_0x4335a1===_0x5ae2('0x47')||_0x4335a1===_0x5ae2('0x48')?_0x5ae2('0x47'):'outbound';if(_0x4b3347){_0x567ece[_0x5ae2('0x1b')]=_0x4b3347['email'];}var _0x12e41a=util[_0x5ae2('0x26')](_0x5ae2('0x49'),_0xf9d7da[_0x5ae2('0x43')],_0x126653[_0x5ae2('0x4a')],md5(_0x126653[_0x5ae2('0x4a')]));if(_0x3dee63&&_0x3dee63[_0x5ae2('0x4b')]){logger[_0x5ae2('0xf')]('[QUEUE]',_0x5ae2('0x4c'));_0x126653[_0x5ae2('0x4d')]=_0x12e41a;}else if(_0x17e852&&_0x17e852['recordingFormat']&&_0x17e852[_0x5ae2('0x4e')]!==_0x5ae2('0x4f')){logger[_0x5ae2('0xf')](_0x5ae2('0x50'),_0x5ae2('0x4c'));_0x126653[_0x5ae2('0x4d')]=_0x12e41a;}else{_0x126653['recordingURL']='';}return getAdminId(_0x567ece,_0x4335a1,_0x55462b,_0x5bf855)['then'](getUser(_0x4335a1,_0x55462b,_0x5bf855))['then'](getEndUser(_0x4335a1,_0x55462b,_0x5bf855))['then'](getTicket(_0x4335a1,_0x55462b,_0x5bf855,_0x4f0f64,_0x126653))[_0x5ae2('0x11')](function(_0x244637){logger[_0x5ae2('0xf')](util[_0x5ae2('0x26')](_0x5ae2('0x51'),_0x244637[_0x5ae2('0x39')]));if(_0x4335a1!==_0x5ae2('0x48')){logger['info']('['+[_0x4335a1[_0x5ae2('0x1a')]()]+']',_0x5ae2('0x52'));emit(_0x5bf855,_0x4b3347[_0x5ae2('0x53')],_0x244637[_0x5ae2('0x2a')]);}})[_0x5ae2('0x18')](function(_0x1336c5){logger[_0x5ae2('0x19')]('['+[_0x4335a1[_0x5ae2('0x1a')]()]+_0x5ae2('0x54'),util['inspect'](_0x1336c5,{'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 04c2e99..20cb6ee 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 _0x4576=['./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','vtiger','servicenow','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x4576,0x16b));var _0x6457=function(_0x3b7553,_0x4fcc7f){_0x3b7553=_0x3b7553-0x0;var _0x398842=_0x4576[_0x3b7553];return _0x398842;};'use strict';var _=require(_0x6457('0x0'));var util=require(_0x6457('0x1'));var zendesk=require(_0x6457('0x2'));var salesforce=require(_0x6457('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x6457('0x4'));var zoho=require(_0x6457('0x5'));var desk=require(_0x6457('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x6457('0x7'));var dynamics365=require(_0x6457('0x8'));var freshsales=require(_0x6457('0x9'));var integrations=[_0x6457('0xa'),_0x6457('0xb'),'sugarcrm',_0x6457('0xc'),_0x6457('0xd'),_0x6457('0xe'),'vtiger',_0x6457('0xf'),_0x6457('0x10'),'servicenow'];exports[_0x6457('0x11')]=function(_0x26ba16,_0x4ad243,_0x1f7b6d,_0x21ab59,_0x14a63f,_0x3b1f19){if(_0x1f7b6d){if(_[_0x6457('0x12')](integrations,_0x26ba16[_0x6457('0x13')][_0x6457('0x14')]())){try{var _0x20bcca=null;var _0x5c3884='';var _0x21b63c=_0x1f7b6d[_0x26ba16[_0x6457('0x13')][_0x6457('0x14')]()];if(_0x21b63c){var _0x535b86=_0x21b63c[_0x26ba16['data2']];if(_0x535b86){var _0x345a85=_[_0x6457('0x15')](_0x535b86[_0x6457('0x16')],{'id':parseInt(_0x26ba16[_0x6457('0x17')],0xa)});if(_0x345a85){if(_0x21ab59){if(_0x14a63f&&_0x4ad243[_0x6457('0x18')]){_0x5c3884=_0x6457('0x18');}else if(_0x4ad243['routeId']){_0x5c3884=_0x6457('0x19');}else{console[_0x6457('0x1a')](_0x6457('0x1b'),_0x4ad243);}}else{_0x5c3884=_0x6457('0x1c');}switch(_0x26ba16[_0x6457('0x13')][_0x6457('0x14')]()){case _0x6457('0xa'):zendesk[_0x5c3884](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19);break;case _0x6457('0xb'):salesforce[_0x5c3884](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19);break;case _0x6457('0x1d'):sugarcrm[_0x5c3884](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19);break;case'freshdesk':freshdesk[_0x5c3884](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19);break;case _0x6457('0xd'):zoho[_0x5c3884](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19);break;case _0x6457('0xe'):desk[_0x5c3884](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19);break;case _0x6457('0x1e'):vtiger[_0x5c3884](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19);break;case _0x6457('0x10'):freshsales['cs'](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19,_0x5c3884);break;case _0x6457('0x1f'):servicenow['cs'](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19,_0x5c3884);break;case _0x6457('0xf'):dynamics365['cs'](_0x26ba16,_0x4ad243,_0x345a85,_0x21ab59,_0x14a63f,_0x535b86,_0x3b1f19,_0x5c3884);break;default:console[_0x6457('0x1a')]('unknown\x20integration');}}else{_0x20bcca=require('../../../../config/logger')(_0x26ba16[_0x6457('0x13')][_0x6457('0x14')]());_0x20bcca[_0x6457('0x20')](_0x6457('0x21'),util['format'](_0x6457('0x22'),_0x26ba16['data1']['toLowerCase'](),_0x26ba16['data3']));}}else{_0x20bcca=require('../../../../config/logger')(_0x26ba16[_0x6457('0x13')][_0x6457('0x14')]());_0x20bcca[_0x6457('0x20')](_0x6457('0x21'),util[_0x6457('0x23')](_0x6457('0x24'),_0x26ba16[_0x6457('0x13')][_0x6457('0x14')](),_0x26ba16['data2']));}}else{}}catch(_0x19ad22){console[_0x6457('0x20')](_0x19ad22);}}}}; \ No newline at end of file +var _0x9304=['routeId','outbound','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','[EXEC]','format','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue'];(function(_0x3e92b3,_0x33f968){var _0x14609f=function(_0x5b968e){while(--_0x5b968e){_0x3e92b3['push'](_0x3e92b3['shift']());}};_0x14609f(++_0x33f968);}(_0x9304,0xb9));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4930('0x0'));var util=require(_0x4930('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4930('0x2'));var sugarcrm=require(_0x4930('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x4930('0x4'));var vtiger=require(_0x4930('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x4930('0x6'));var freshsales=require(_0x4930('0x7'));var integrations=[_0x4930('0x8'),_0x4930('0x9'),_0x4930('0xa'),_0x4930('0xb'),_0x4930('0xc'),_0x4930('0xd'),_0x4930('0xe'),_0x4930('0xf'),'freshsales',_0x4930('0x10')];exports['exec']=function(_0xe6b97f,_0x4222f5,_0x3efa7f,_0x18e121,_0x3cc79e,_0x10832f){if(_0x3efa7f){if(_[_0x4930('0x11')](integrations,_0xe6b97f[_0x4930('0x12')][_0x4930('0x13')]())){try{var _0x53f9ae=null;var _0x1e54df='';var _0x29fbca=_0x3efa7f[_0xe6b97f['data1']['toLowerCase']()];if(_0x29fbca){var _0x2b1fa2=_0x29fbca[_0xe6b97f[_0x4930('0x14')]];if(_0x2b1fa2){var _0x597a73=_[_0x4930('0x15')](_0x2b1fa2[_0x4930('0x16')],{'id':parseInt(_0xe6b97f[_0x4930('0x17')],0xa)});if(_0x597a73){if(_0x18e121){if(_0x3cc79e&&_0x4222f5[_0x4930('0x18')]){_0x1e54df=_0x4930('0x18');}else if(_0x4222f5[_0x4930('0x19')]){_0x1e54df=_0x4930('0x1a');}else{console['log'](_0x4930('0x1b'),_0x4222f5);}}else{_0x1e54df=_0x4930('0x1c');}switch(_0xe6b97f['data1']['toLowerCase']()){case _0x4930('0x8'):zendesk[_0x1e54df](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f);break;case'salesforce':salesforce[_0x1e54df](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f);break;case'sugarcrm':sugarcrm[_0x1e54df](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f);break;case'freshdesk':freshdesk[_0x1e54df](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f);break;case _0x4930('0xc'):zoho[_0x1e54df](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f);break;case _0x4930('0xd'):desk[_0x1e54df](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f);break;case _0x4930('0xe'):vtiger[_0x1e54df](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f);break;case'freshsales':freshsales['cs'](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f,_0x1e54df);break;case _0x4930('0x10'):servicenow['cs'](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f,_0x1e54df);break;case _0x4930('0xf'):dynamics365['cs'](_0xe6b97f,_0x4222f5,_0x597a73,_0x18e121,_0x3cc79e,_0x2b1fa2,_0x10832f,_0x1e54df);break;default:console['log'](_0x4930('0x1d'));}}else{_0x53f9ae=require(_0x4930('0x1e'))(_0xe6b97f[_0x4930('0x12')]['toLowerCase']());_0x53f9ae['error'](_0x4930('0x1f'),util[_0x4930('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0xe6b97f[_0x4930('0x12')][_0x4930('0x13')](),_0xe6b97f[_0x4930('0x17')]));}}else{_0x53f9ae=require(_0x4930('0x1e'))(_0xe6b97f[_0x4930('0x12')][_0x4930('0x13')]());_0x53f9ae[_0x4930('0x21')]('[EXEC]',util['format'](_0x4930('0x22'),_0xe6b97f[_0x4930('0x12')][_0x4930('0x13')](),_0xe6b97f['data2']));}}else{}}catch(_0x8b4b5d){console['error'](_0x8b4b5d);}}}}; \ 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 88edbaa..a1ba660 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 _0xd9b5=['then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','execute','Lead','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','','Caller\x20-\x20%s','No\x20Company','upperFirst','includes','picklist','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','serverUrl','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Subjects','getString','Descriptions','ticketType','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','sobject'];(function(_0x657d86,_0x33364b){var _0x13c113=function(_0x2811df){while(--_0x2811df){_0x657d86['push'](_0x657d86['shift']());}};_0x13c113(++_0x33364b);}(_0xd9b5,0x145));var _0x5d9b=function(_0x294b22,_0x83657){_0x294b22=_0x294b22-0x0;var _0x492c3a=_0xd9b5[_0x294b22];return _0x492c3a;};'use strict';var _=require('lodash');var rp=require(_0x5d9b('0x0'));var moment=require(_0x5d9b('0x1'));var BPromise=require(_0x5d9b('0x2'));var md5=require('md5');var jsforce=require(_0x5d9b('0x3'));var util=require(_0x5d9b('0x4'));var Redis=require('ioredis');var intUtil=require(_0x5d9b('0x5'));var config=require(_0x5d9b('0x6'));var logger=require(_0x5d9b('0x7'))(_0x5d9b('0x8'));config[_0x5d9b('0x9')]=_[_0x5d9b('0xa')](config['redis'],{'host':_0x5d9b('0xb'),'port':0x18eb});var io=require(_0x5d9b('0xc'))(new Redis(config['redis']));function emit(_0x51803a,_0x10107f,_0x1d4d4d){io['to'](_0x51803a)[_0x5d9b('0xd')](_0x10107f,_0x1d4d4d);}function getTicket(_0x5d8980,_0x3abf5b,_0x2d5b32,_0x29247d,_0x274a2c,_0x393bb9,_0x36e9cd,_0xfa51f5){var _0x336c9b=Object['assign']({},{'OwnerId':_0x3abf5b['id'],'Subject':intUtil['getString'](_0x29247d[_0x5d9b('0xe')],_0x274a2c,'\x20'),'Description':intUtil[_0x5d9b('0xf')](_0x29247d[_0x5d9b('0x10')],_0x274a2c,'\x0a')},getCustomFields(_0x393bb9,_0x274a2c));if(_0x2d5b32){if(_0x29247d[_0x5d9b('0x11')]==='Task'){_0x336c9b['ActivityDate']=moment[_0x5d9b('0x12')]();_0x336c9b[_0x5d9b('0x13')]=![];_0x336c9b['IsRecurrence']=![];if(_0x2d5b32[_0x5d9b('0x14')]===_0x5d9b('0x15')||_0x2d5b32[_0x5d9b('0x14')]===_0x5d9b('0x16')){_0x336c9b[_0x5d9b('0x17')]=_0x2d5b32['id'];}else if(_0x2d5b32[_0x5d9b('0x14')]===_0x5d9b('0x18')){_0x336c9b[_0x5d9b('0x19')]=_0x2d5b32['id'];}}else if(_0x29247d[_0x5d9b('0x11')]===_0x5d9b('0x1a')){if(_0x2d5b32[_0x5d9b('0x14')]===_0x5d9b('0x15')){_0x336c9b[_0x5d9b('0x1b')]=_0x2d5b32['id'];}else if(_0x2d5b32[_0x5d9b('0x14')]===_0x5d9b('0x18')){_0x336c9b[_0x5d9b('0x1c')]=_0x2d5b32['id'];}else if(_0x2d5b32[_0x5d9b('0x14')]==='lead'&&_0x29247d[_0x5d9b('0x1d')]){_0x336c9b[_0x29247d[_0x5d9b('0x1d')]]=_0x2d5b32['id'];}else{logger[_0x5d9b('0x1e')](_0x5d9b('0x1f'));}}}return _0x36e9cd['sobject'](_0x29247d['ticketType'])['create'](_0x336c9b);}function getUser(_0x25c4a8,_0x426f3d,_0x21101b){if(!_[_0x5d9b('0x20')](_0x426f3d)&&intUtil[_0x5d9b('0x21')](_0x426f3d)){var _0xff459a={'Email':_0x426f3d};var _0xa7ca60={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x21101b[_0x5d9b('0x22')]('User')['find'](_0xff459a,_0xa7ca60)['execute']()[_0x5d9b('0x23')](function(_0x2bb598){if(_0x2bb598[_0x5d9b('0x24')]){var _0x21d0ae=_[_0x5d9b('0x25')](_0x2bb598,function(_0x37d6a3){return _0x37d6a3[_0x5d9b('0x26')]===_0x426f3d;});if(_0x21d0ae){logger[_0x5d9b('0x1e')](_0x5d9b('0x27'),_0x426f3d);return BPromise[_0x5d9b('0x28')]({'id':_0x21d0ae['Id'],'name':_0x21d0ae[_0x5d9b('0x29')]});}}else{logger[_0x5d9b('0x1e')](_0x5d9b('0x2a'),_0x426f3d);return _0x21101b[_0x5d9b('0x2b')]()[_0x5d9b('0x23')](function(_0xdbc19d){return BPromise[_0x5d9b('0x28')]({'id':_0xdbc19d['user_id'],'name':_0xdbc19d[_0x5d9b('0x2c')]});});}});}else{logger[_0x5d9b('0x1e')](_0x5d9b('0x2a'),_0x426f3d);return _0x21101b[_0x5d9b('0x2b')]()[_0x5d9b('0x23')](function(_0x15e8ac){return BPromise[_0x5d9b('0x28')]({'id':_0x15e8ac[_0x5d9b('0x2d')],'name':_0x15e8ac[_0x5d9b('0x2c')]});});}}function getEndUser(_0x516fcc,_0x4db413,_0x25aff0,_0x39219d,_0x5ec09d){var _0x35fdec={'$or':{'Phone':_0x39219d}};var _0x43af5f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5d9b('0x28')]()[_0x5d9b('0x23')](function(){logger[_0x5d9b('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x39219d,_0x4db413[_0x5d9b('0x2e')]);switch(_0x4db413[_0x5d9b('0x2e')]){case _0x5d9b('0x2f'):var _0x57fecd=_['cloneDeep'](_0x35fdec);if(_0x4db413[_0x5d9b('0x30')]){var _0x3ad8a0={};_0x3ad8a0[_0x4db413[_0x5d9b('0x30')]]=_0x39219d;_[_0x5d9b('0x31')](_0x57fecd[_0x5d9b('0x32')],_0x3ad8a0);}return _0x5ec09d[_0x5d9b('0x22')](_0x5d9b('0x33'))[_0x5d9b('0x25')](_0x57fecd,_0x43af5f)['execute']()[_0x5d9b('0x23')](function(_0x4e5873){if(_0x4e5873&&_0x4e5873['length']){return _0x4e5873;}else{var _0x3ca344=_[_0x5d9b('0x34')](_0x35fdec);if(_0x4db413[_0x5d9b('0x35')]){var _0x555317={};_0x555317[_0x4db413[_0x5d9b('0x35')]]=_0x39219d;_[_0x5d9b('0x31')](_0x3ca344['$or'],_0x555317);}return _0x5ec09d['sobject']('Lead')['find'](_0x3ca344,_0x43af5f);}});case _0x5d9b('0x36'):var _0x4befce=_[_0x5d9b('0x34')](_0x35fdec);if(_0x4db413[_0x5d9b('0x37')]){var _0x3ad8a0={};_0x3ad8a0[_0x4db413['additionalSearchAccount']]=_0x39219d;_[_0x5d9b('0x31')](_0x4befce[_0x5d9b('0x32')],_0x3ad8a0);}return _0x5ec09d['sobject'](_0x5d9b('0x38'))[_0x5d9b('0x25')](_0x4befce,_0x43af5f)[_0x5d9b('0x39')]()[_0x5d9b('0x23')](function(_0x1ba001){if(_0x1ba001&&_0x1ba001['length']){return _0x1ba001;}else{var _0x41e97e=_[_0x5d9b('0x34')](_0x35fdec);if(_0x4db413[_0x5d9b('0x30')]){var _0x532cf8={};_0x532cf8[_0x4db413[_0x5d9b('0x30')]]=_0x39219d;_[_0x5d9b('0x31')](_0x41e97e['$or'],_0x532cf8);}return _0x5ec09d[_0x5d9b('0x22')]('Contact')[_0x5d9b('0x25')](_0x41e97e,_0x43af5f)['then'](function(_0x21c59c){if(_0x21c59c&&_0x21c59c[_0x5d9b('0x24')]){return _0x21c59c;}else{var _0x464d63=_[_0x5d9b('0x34')](_0x35fdec);if(_0x4db413[_0x5d9b('0x35')]){var _0x4f0068={};_0x4f0068[_0x4db413[_0x5d9b('0x35')]]=_0x39219d;_[_0x5d9b('0x31')](_0x464d63[_0x5d9b('0x32')],_0x4f0068);}return _0x5ec09d[_0x5d9b('0x22')](_0x5d9b('0x3a'))[_0x5d9b('0x25')](_0x464d63,_0x43af5f);}});}});case _0x5d9b('0x15'):var _0x57fecd=_[_0x5d9b('0x34')](_0x35fdec);if(_0x4db413[_0x5d9b('0x30')]){var _0x3ad8a0={};_0x3ad8a0[_0x4db413['additionalSearchContact']]=_0x39219d;_[_0x5d9b('0x31')](_0x57fecd[_0x5d9b('0x32')],_0x3ad8a0);}return _0x5ec09d[_0x5d9b('0x22')]('Contact')[_0x5d9b('0x25')](_0x57fecd,_0x43af5f)[_0x5d9b('0x39')]();case _0x5d9b('0x16'):var _0x108588=_[_0x5d9b('0x34')](_0x35fdec);if(_0x4db413['additionalSearchLead']){var _0x3ad8a0={};_0x3ad8a0[_0x4db413[_0x5d9b('0x35')]]=_0x39219d;_['merge'](_0x108588[_0x5d9b('0x32')],_0x3ad8a0);}return _0x5ec09d[_0x5d9b('0x22')](_0x5d9b('0x3a'))[_0x5d9b('0x25')](_0x108588,_0x43af5f);case _0x5d9b('0x18'):var _0x4befce=_[_0x5d9b('0x34')](_0x35fdec);if(_0x4db413[_0x5d9b('0x37')]){var _0x3ad8a0={};_0x3ad8a0[_0x4db413[_0x5d9b('0x37')]]=_0x39219d;_[_0x5d9b('0x31')](_0x4befce[_0x5d9b('0x32')],_0x3ad8a0);}return _0x5ec09d[_0x5d9b('0x22')]('Account')['find'](_0x4befce,_0x43af5f);default:return null;}})[_0x5d9b('0x23')](function(_0x5cd0a4){if(_0x5cd0a4&&_0x5cd0a4['length']){var _0x2c9eb6=_['first'](_0x5cd0a4);if(_0x2c9eb6){return BPromise[_0x5d9b('0x28')]({'id':_0x2c9eb6['Id'],'name':_0x2c9eb6[_0x5d9b('0x29')],'phone':_0x2c9eb6[_0x5d9b('0x3b')],'endUserType':_0x2c9eb6[_0x5d9b('0x3c')][_0x5d9b('0x3d')][_0x5d9b('0x3e')]()});}}})[_0x5d9b('0x23')](function(_0x5740f8){if(_0x5740f8){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5740f8[_0x5d9b('0x14')],_0x39219d);return BPromise[_0x5d9b('0x28')](_0x5740f8);}else{logger[_0x5d9b('0x1e')](_0x5d9b('0x3f'),_0x39219d);var _0x239992={'Phone':_0x39219d};if(_0x4db413[_0x5d9b('0x40')]){if(_0x4db413[_0x5d9b('0x40')]==='contact'){logger[_0x5d9b('0x1e')](_0x5d9b('0x41'),_0x39219d,_0x4db413[_0x5d9b('0x40')]);_0x239992[_0x5d9b('0x42')]=_0x25aff0!==''?_0x25aff0:util[_0x5d9b('0x43')]('Caller\x20-\x20%s',_0x39219d);}else if(_0x4db413[_0x5d9b('0x40')]===_0x5d9b('0x16')){logger[_0x5d9b('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x39219d,_0x4db413[_0x5d9b('0x40')]);_0x239992[_0x5d9b('0x42')]=_0x25aff0!==_0x5d9b('0x44')?_0x25aff0:util[_0x5d9b('0x43')](_0x5d9b('0x45'),_0x39219d);_0x239992['Company']=_0x5d9b('0x46');}else if(_0x4db413[_0x5d9b('0x40')]===_0x5d9b('0x18')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x39219d,_0x4db413[_0x5d9b('0x40')]);_0x239992[_0x5d9b('0x29')]=_0x25aff0!==_0x5d9b('0x44')?_0x25aff0:util['format'](_0x5d9b('0x45'),_0x39219d);}else{return null;}}return _0x5ec09d[_0x5d9b('0x22')](_[_0x5d9b('0x47')](_0x4db413[_0x5d9b('0x40')]))['create'](_0x239992)['then'](function(_0x3e5273){return BPromise['resolve']({'id':_0x3e5273['id'],'endUserType':_0x4db413[_0x5d9b('0x40')]});});}});}function getCustomFields(_0x123190,_0x19ac38){var _0x41ae58={};if(_0x123190[_0x5d9b('0x24')]>0x0){_['forEach'](_0x123190,function(_0x2f640c){if(_[_0x5d9b('0x48')](['string',_0x5d9b('0x49')],_0x2f640c[_0x5d9b('0x3d')])&&_0x2f640c[_0x5d9b('0x4a')]){_0x41ae58[_0x2f640c[_0x5d9b('0x4a')]]=_0x2f640c[_0x5d9b('0x4b')][_0x5d9b('0x4c')]();}else if(_0x2f640c[_0x5d9b('0x3d')]===_0x5d9b('0x4d')&&_0x2f640c[_0x5d9b('0x4e')]&&_0x2f640c[_0x5d9b('0x4a')]){_0x19ac38[_0x2f640c['variableName']]&&(_0x41ae58[_0x2f640c[_0x5d9b('0x4a')]]=_0x19ac38[_0x2f640c[_0x5d9b('0x4e')]]['toString']());}else if(_0x2f640c[_0x5d9b('0x3d')]==='customVariable'&&_0x2f640c[_0x5d9b('0x4f')]&&_0x2f640c[_0x5d9b('0x4f')][_0x5d9b('0x50')]&&_0x2f640c[_0x5d9b('0x4a')]){_0x19ac38[_0x2f640c[_0x5d9b('0x4f')][_0x5d9b('0x50')]['toLowerCase']()]&&(_0x41ae58[_0x2f640c['idField']]=_0x19ac38[_0x2f640c[_0x5d9b('0x4f')][_0x5d9b('0x50')][_0x5d9b('0x3e')]()][_0x5d9b('0x4c')]());}});}return _0x41ae58;}function getConnection(_0x2c9ded){var _0x5fca3d=_0x2c9ded['password'][_0x5d9b('0x51')](_0x2c9ded[_0x5d9b('0x52')]);var _0x373163=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2c9ded[_0x5d9b('0x53')]||_0x5d9b('0x54'),'clientId':_0x2c9ded['clientId'],'clientSecret':_0x2c9ded[_0x5d9b('0x55')]}});return _0x373163[_0x5d9b('0x56')](_0x2c9ded['username'],_0x5fca3d)[_0x5d9b('0x23')](function(){logger[_0x5d9b('0x1e')]('Connection\x20established.');return _0x373163;});}exports['queue']=function(_0x5354b5,_0x23c92d,_0x321ce3,_0x5b0eed,_0x59c585,_0x109356){var _0x1246ae,_0x5742d3,_0x4ea67f,_0x21130c;_0x109356[_0x5d9b('0x57')]=intUtil[_0x5d9b('0x58')](_0x109356[_0x5d9b('0x57')]);_0x109356['remoteUri']=intUtil[_0x5d9b('0x58')](_0x109356[_0x5d9b('0x53')]);if(_0x59c585&&_0x59c585['monitor_format']){logger[_0x5d9b('0x1e')]('[QUEUE]','Recording\x20is\x20enabled!');_0x23c92d[_0x5d9b('0x59')]=util[_0x5d9b('0x43')](_0x5d9b('0x5a'),_0x109356[_0x5d9b('0x57')],_0x23c92d[_0x5d9b('0x5b')],md5(_0x23c92d[_0x5d9b('0x5b')]));}else{_0x23c92d[_0x5d9b('0x59')]='';}return getConnection(_0x109356)[_0x5d9b('0x23')](function(_0x1c63e8){_0x21130c=_0x1c63e8;return getUser(_0x109356,_0x5b0eed['email'],_0x21130c);})[_0x5d9b('0x23')](function(_0x5b5b48){_0x1246ae=_0x5b5b48;return getEndUser(_0x109356,_0x321ce3,_0x23c92d[_0x5d9b('0x5c')],_0x23c92d[_0x5d9b('0x5d')],_0x21130c);})[_0x5d9b('0x23')](function(_0xfc8281){_0x5742d3=_0xfc8281;return getTicket(_0x109356,_0x1246ae,_0x5742d3,_0x321ce3,_0x23c92d,_0x321ce3[_0x5d9b('0x5e')],_0x21130c,_0x5d9b('0x5f'));})[_0x5d9b('0x23')](function(_0x53b937){_0x4ea67f=_0x53b937;logger[_0x5d9b('0x1e')](_0x5d9b('0x60'),_0x4ea67f['id']);logger[_0x5d9b('0x1e')](_0x5d9b('0x61'),_0x4ea67f['id'],_0x5b0eed['name'],_0x109356[_0x5d9b('0x3d')]);switch(_0x109356['type']){case _0x5d9b('0x62'):emit(util[_0x5d9b('0x43')](_0x5d9b('0x63'),_0x5b0eed['name']),'trigger:salesforce:display',{'recordId':_0x4ea67f['id']});break;case _0x5d9b('0x64'):emit(util[_0x5d9b('0x43')](_0x5d9b('0x63'),_0x5b0eed[_0x5d9b('0x50')]),_0x5d9b('0x65'),{'uri':util[_0x5d9b('0x43')](_0x5d9b('0x66'),_0x21130c[_0x5d9b('0x67')],_0x4ea67f['id'])});break;default:logger[_0x5d9b('0x68')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x5d9b('0x69')](function(_0x2fc493){logger[_0x5d9b('0x68')](_0x5d9b('0x6a'),_0x2fc493);});};exports[_0x5d9b('0x6b')]=function(_0xf9e164,_0x41a38c,_0x1f0836,_0x4888f3,_0x389d13,_0x2abb7b,_0x3f521e){var _0x138d20,_0x25c948,_0x2706a9,_0x5d9f97;_0x2abb7b[_0x5d9b('0x57')]=intUtil[_0x5d9b('0x58')](_0x2abb7b[_0x5d9b('0x57')]);_0x2abb7b[_0x5d9b('0x53')]=intUtil['stripTrailingSlash'](_0x2abb7b['remoteUri']);if(_0x3f521e&&_0x3f521e[_0x5d9b('0x6c')]&&_0x3f521e[_0x5d9b('0x6c')]!=='none'){logger[_0x5d9b('0x1e')](_0x5d9b('0x6d'),_0x5d9b('0x6e'));_0x41a38c[_0x5d9b('0x59')]=util['format'](_0x5d9b('0x5a'),_0x2abb7b[_0x5d9b('0x57')],_0x41a38c[_0x5d9b('0x5b')],md5(_0x41a38c[_0x5d9b('0x5b')]));}return getConnection(_0x2abb7b)[_0x5d9b('0x23')](function(_0x29ece4){_0x5d9f97=_0x29ece4;return getUser(_0x2abb7b,_0x4888f3[_0x5d9b('0x6f')],_0x5d9f97);})[_0x5d9b('0x23')](function(_0x1a0a78){_0x138d20=_0x1a0a78;return getEndUser(_0x2abb7b,_0x1f0836,_0x41a38c['destcalleridname'],_0x41a38c[_0x5d9b('0x70')],_0x5d9f97);})[_0x5d9b('0x23')](function(_0x410e36){_0x25c948=_0x410e36;return getTicket(_0x2abb7b,_0x138d20,_0x25c948,_0x1f0836,_0x41a38c,_0x1f0836[_0x5d9b('0x5e')],_0x5d9f97,'outbound');})[_0x5d9b('0x23')](function(_0x16cc69){_0x2706a9=_0x16cc69;logger[_0x5d9b('0x1e')](_0x5d9b('0x71'),_0x2706a9['id']);logger[_0x5d9b('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2706a9['id'],_0x4888f3[_0x5d9b('0x50')],_0x2abb7b[_0x5d9b('0x3d')]);switch(_0x2abb7b[_0x5d9b('0x3d')]){case _0x5d9b('0x62'):emit(util['format'](_0x5d9b('0x63'),_0x4888f3[_0x5d9b('0x50')]),_0x5d9b('0x72'),{'recordId':_0x2706a9['id']});break;case'newTab':emit(util[_0x5d9b('0x43')](_0x5d9b('0x63'),_0x4888f3['name']),'trigger:browser:url',{'uri':util[_0x5d9b('0x43')](_0x5d9b('0x66'),_0x5d9f97[_0x5d9b('0x67')],_0x2706a9['id'])});break;default:logger['error'](_0x5d9b('0x6d'),_0x5d9b('0x73'));}})['catch'](function(_0x32150f){logger[_0x5d9b('0x68')](_0x5d9b('0x6d'),_0x32150f);});};exports[_0x5d9b('0x74')]=function(_0x2e51f9,_0x1610ec,_0x1ab8e4,_0xbd018,_0x4e1ebe,_0x6aa395){var _0x4cd35f,_0x259d28,_0x186863,_0x5edf36;_0x6aa395[_0x5d9b('0x57')]=intUtil['stripTrailingSlash'](_0x6aa395[_0x5d9b('0x57')]);_0x6aa395[_0x5d9b('0x53')]=intUtil[_0x5d9b('0x58')](_0x6aa395[_0x5d9b('0x53')]);if(_0x4e1ebe&&_0x4e1ebe['monitor_format']){logger[_0x5d9b('0x1e')]('['+_0x1610ec['lastevent'][_0x5d9b('0x75')]()+']',_0x5d9b('0x6e'));_0x1610ec[_0x5d9b('0x59')]=util[_0x5d9b('0x43')](_0x5d9b('0x5a'),_0x6aa395[_0x5d9b('0x57')],_0x1610ec[_0x5d9b('0x5b')],md5(_0x1610ec[_0x5d9b('0x5b')]));}else{_0x1610ec[_0x5d9b('0x59')]='';}return getConnection(_0x6aa395)['then'](function(_0x5c8973){_0x5edf36=_0x5c8973;if(!_['isNil'](_0xbd018)){return getUser(_0x6aa395,_0xbd018[_0x5d9b('0x50')],_0x5edf36);}else{return getUser(_0x6aa395,null,_0x5edf36);}})[_0x5d9b('0x23')](function(_0x29d92a){_0x4cd35f=_0x29d92a;return getEndUser(_0x6aa395,_0x1ab8e4,_0x1610ec['calleridname'],_0x1610ec[_0x5d9b('0x5d')],_0x5edf36);})['then'](function(_0x4eedb5){_0x259d28=_0x4eedb5;return getTicket(_0x6aa395,_0x4cd35f,_0x259d28,_0x1ab8e4,_0x1610ec,_0x1ab8e4[_0x5d9b('0x5e')],_0x5edf36);})['then'](function(_0x3614c1){_0x186863=_0x3614c1;logger[_0x5d9b('0x1e')]('['+_0x1610ec[_0x5d9b('0x76')][_0x5d9b('0x75')]()+']\x20Ticket\x20%s\x20created.',_0x186863['id']);logger['info']('['+_0x1610ec['lastevent']['toUpperCase']()+_0x5d9b('0x77'),_0x6aa395[_0x5d9b('0x3d')]);})[_0x5d9b('0x69')](function(_0x20dca0){logger[_0x5d9b('0x68')]('['+_0x1610ec['lastevent'][_0x5d9b('0x75')]()+']',_0x20dca0);});}; \ No newline at end of file +var _0x78b8=['identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','Caller\x20-\x20%s','format','Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','forEach','includes','content','toString','variable','variableName','idField','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Task','ActivityDate','utc','endUserType','contact','lead','WhatId','ticketType','Case','ContactId','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','find','then','length','info','resolve','Name'];(function(_0x1c10cb,_0x5f030d){var _0x5b9a41=function(_0x433ef8){while(--_0x433ef8){_0x1c10cb['push'](_0x1c10cb['shift']());}};_0x5b9a41(++_0x5f030d);}(_0x78b8,0xca));var _0x878b=function(_0x2a10d7,_0x408f0c){_0x2a10d7=_0x2a10d7-0x0;var _0xabc498=_0x78b8[_0x2a10d7];return _0xabc498;};'use strict';var _=require(_0x878b('0x0'));var rp=require(_0x878b('0x1'));var moment=require(_0x878b('0x2'));var BPromise=require(_0x878b('0x3'));var md5=require('md5');var jsforce=require(_0x878b('0x4'));var util=require(_0x878b('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x878b('0x6'));var logger=require(_0x878b('0x7'))(_0x878b('0x8'));config[_0x878b('0x9')]=_[_0x878b('0xa')](config[_0x878b('0x9')],{'host':_0x878b('0xb'),'port':0x18eb});var io=require(_0x878b('0xc'))(new Redis(config[_0x878b('0x9')]));function emit(_0x159fee,_0x1bcf8b,_0xd4594b){io['to'](_0x159fee)[_0x878b('0xd')](_0x1bcf8b,_0xd4594b);}function getTicket(_0x3dec5a,_0x24c50f,_0x5711b5,_0x21f858,_0x50d446,_0x9153e8,_0xc79ada,_0xe8df33){var _0x35b24e=Object[_0x878b('0xe')]({},{'OwnerId':_0x24c50f['id'],'Subject':intUtil[_0x878b('0xf')](_0x21f858[_0x878b('0x10')],_0x50d446,'\x20'),'Description':intUtil['getString'](_0x21f858['Descriptions'],_0x50d446,'\x0a')},getCustomFields(_0x9153e8,_0x50d446));if(_0x5711b5){if(_0x21f858['ticketType']===_0x878b('0x11')){_0x35b24e[_0x878b('0x12')]=moment[_0x878b('0x13')]();_0x35b24e['IsReminderSet']=![];_0x35b24e['IsRecurrence']=![];if(_0x5711b5[_0x878b('0x14')]===_0x878b('0x15')||_0x5711b5[_0x878b('0x14')]===_0x878b('0x16')){_0x35b24e['WhoId']=_0x5711b5['id'];}else if(_0x5711b5[_0x878b('0x14')]==='account'){_0x35b24e[_0x878b('0x17')]=_0x5711b5['id'];}}else if(_0x21f858[_0x878b('0x18')]===_0x878b('0x19')){if(_0x5711b5['endUserType']==='contact'){_0x35b24e[_0x878b('0x1a')]=_0x5711b5['id'];}else if(_0x5711b5['endUserType']===_0x878b('0x1b')){_0x35b24e[_0x878b('0x1c')]=_0x5711b5['id'];}else if(_0x5711b5['endUserType']===_0x878b('0x16')&&_0x21f858[_0x878b('0x1d')]){_0x35b24e[_0x21f858[_0x878b('0x1d')]]=_0x5711b5['id'];}else{logger['info'](_0x878b('0x1e'));}}}return _0xc79ada[_0x878b('0x1f')](_0x21f858[_0x878b('0x18')])[_0x878b('0x20')](_0x35b24e);}function getUser(_0x2b9c44,_0xf356c1,_0x31d4a8){if(!_[_0x878b('0x21')](_0xf356c1)&&intUtil['validateEmail'](_0xf356c1)){var _0x35cc9d={'Email':_0xf356c1};var _0x298a8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x31d4a8[_0x878b('0x1f')]('User')[_0x878b('0x22')](_0x35cc9d,_0x298a8)['execute']()[_0x878b('0x23')](function(_0x55a2f8){if(_0x55a2f8[_0x878b('0x24')]){var _0x39331b=_['find'](_0x55a2f8,function(_0x5a3ea0){return _0x5a3ea0['Email']===_0xf356c1;});if(_0x39331b){logger[_0x878b('0x25')]('Agent\x20%s\x20found.',_0xf356c1);return BPromise[_0x878b('0x26')]({'id':_0x39331b['Id'],'name':_0x39331b[_0x878b('0x27')]});}}else{logger[_0x878b('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xf356c1);return _0x31d4a8[_0x878b('0x28')]()[_0x878b('0x23')](function(_0x1c42ff){return BPromise[_0x878b('0x26')]({'id':_0x1c42ff[_0x878b('0x29')],'name':_0x1c42ff[_0x878b('0x2a')]});});}});}else{logger[_0x878b('0x25')](_0x878b('0x2b'),_0xf356c1);return _0x31d4a8[_0x878b('0x28')]()[_0x878b('0x23')](function(_0x4e69ae){return BPromise[_0x878b('0x26')]({'id':_0x4e69ae['user_id'],'name':_0x4e69ae[_0x878b('0x2a')]});});}}function getEndUser(_0x3810b4,_0x2f08ed,_0x5861cf,_0x9238c,_0x52e905){var _0x25eaf2={'$or':{'Phone':_0x9238c}};var _0x548a20={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x878b('0x23')](function(){logger[_0x878b('0x25')](_0x878b('0x2c'),_0x9238c,_0x2f08ed['moduleSearch']);switch(_0x2f08ed[_0x878b('0x2d')]){case _0x878b('0x2e'):var _0xfe150c=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed['additionalSearchContact']){var _0x5efff1={};_0x5efff1[_0x2f08ed[_0x878b('0x30')]]=_0x9238c;_[_0x878b('0x31')](_0xfe150c[_0x878b('0x32')],_0x5efff1);}return _0x52e905[_0x878b('0x1f')](_0x878b('0x33'))['find'](_0xfe150c,_0x548a20)[_0x878b('0x34')]()[_0x878b('0x23')](function(_0x3bb538){if(_0x3bb538&&_0x3bb538[_0x878b('0x24')]){return _0x3bb538;}else{var _0x3eabb1=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed[_0x878b('0x35')]){var _0x52e5af={};_0x52e5af[_0x2f08ed[_0x878b('0x35')]]=_0x9238c;_[_0x878b('0x31')](_0x3eabb1[_0x878b('0x32')],_0x52e5af);}return _0x52e905['sobject'](_0x878b('0x36'))[_0x878b('0x22')](_0x3eabb1,_0x548a20);}});case _0x878b('0x37'):var _0x2defa0=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed['additionalSearchAccount']){var _0x5efff1={};_0x5efff1[_0x2f08ed['additionalSearchAccount']]=_0x9238c;_[_0x878b('0x31')](_0x2defa0[_0x878b('0x32')],_0x5efff1);}return _0x52e905[_0x878b('0x1f')]('Account')[_0x878b('0x22')](_0x2defa0,_0x548a20)[_0x878b('0x34')]()[_0x878b('0x23')](function(_0x1cd82e){if(_0x1cd82e&&_0x1cd82e[_0x878b('0x24')]){return _0x1cd82e;}else{var _0x1b971b=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed[_0x878b('0x30')]){var _0x5b5076={};_0x5b5076[_0x2f08ed['additionalSearchContact']]=_0x9238c;_[_0x878b('0x31')](_0x1b971b['$or'],_0x5b5076);}return _0x52e905[_0x878b('0x1f')]('Contact')['find'](_0x1b971b,_0x548a20)[_0x878b('0x23')](function(_0xf21e3c){if(_0xf21e3c&&_0xf21e3c[_0x878b('0x24')]){return _0xf21e3c;}else{var _0x174fc5=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed[_0x878b('0x35')]){var _0x3ded3f={};_0x3ded3f[_0x2f08ed[_0x878b('0x35')]]=_0x9238c;_[_0x878b('0x31')](_0x174fc5[_0x878b('0x32')],_0x3ded3f);}return _0x52e905[_0x878b('0x1f')](_0x878b('0x36'))['find'](_0x174fc5,_0x548a20);}});}});case _0x878b('0x15'):var _0xfe150c=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed['additionalSearchContact']){var _0x5efff1={};_0x5efff1[_0x2f08ed[_0x878b('0x30')]]=_0x9238c;_['merge'](_0xfe150c[_0x878b('0x32')],_0x5efff1);}return _0x52e905[_0x878b('0x1f')](_0x878b('0x33'))[_0x878b('0x22')](_0xfe150c,_0x548a20)[_0x878b('0x34')]();case _0x878b('0x16'):var _0x4423c8=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed[_0x878b('0x35')]){var _0x5efff1={};_0x5efff1[_0x2f08ed[_0x878b('0x35')]]=_0x9238c;_['merge'](_0x4423c8[_0x878b('0x32')],_0x5efff1);}return _0x52e905[_0x878b('0x1f')]('Lead')['find'](_0x4423c8,_0x548a20);case _0x878b('0x1b'):var _0x2defa0=_[_0x878b('0x2f')](_0x25eaf2);if(_0x2f08ed[_0x878b('0x38')]){var _0x5efff1={};_0x5efff1[_0x2f08ed[_0x878b('0x38')]]=_0x9238c;_[_0x878b('0x31')](_0x2defa0['$or'],_0x5efff1);}return _0x52e905[_0x878b('0x1f')](_0x878b('0x39'))[_0x878b('0x22')](_0x2defa0,_0x548a20);default:return null;}})['then'](function(_0x541d36){if(_0x541d36&&_0x541d36['length']){var _0x4072d7=_['first'](_0x541d36);if(_0x4072d7){return BPromise[_0x878b('0x26')]({'id':_0x4072d7['Id'],'name':_0x4072d7[_0x878b('0x27')],'phone':_0x4072d7[_0x878b('0x3a')],'endUserType':_0x4072d7[_0x878b('0x3b')][_0x878b('0x3c')][_0x878b('0x3d')]()});}}})[_0x878b('0x23')](function(_0x3a5d19){if(_0x3a5d19){logger[_0x878b('0x25')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3a5d19[_0x878b('0x14')],_0x9238c);return BPromise[_0x878b('0x26')](_0x3a5d19);}else{logger[_0x878b('0x25')](_0x878b('0x3e'),_0x9238c);var _0x3cf7fe={'Phone':_0x9238c};if(_0x2f08ed[_0x878b('0x3f')]){if(_0x2f08ed[_0x878b('0x3f')]===_0x878b('0x15')){logger[_0x878b('0x25')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x9238c,_0x2f08ed[_0x878b('0x3f')]);_0x3cf7fe[_0x878b('0x40')]=_0x5861cf!==''?_0x5861cf:util['format'](_0x878b('0x41'),_0x9238c);}else if(_0x2f08ed['moduleCreate']===_0x878b('0x16')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x9238c,_0x2f08ed[_0x878b('0x3f')]);_0x3cf7fe[_0x878b('0x40')]=_0x5861cf!==''?_0x5861cf:util[_0x878b('0x42')](_0x878b('0x41'),_0x9238c);_0x3cf7fe[_0x878b('0x43')]='No\x20Company';}else if(_0x2f08ed[_0x878b('0x3f')]==='account'){logger[_0x878b('0x25')](_0x878b('0x44'),_0x9238c,_0x2f08ed['moduleCreate']);_0x3cf7fe[_0x878b('0x27')]=_0x5861cf!==''?_0x5861cf:util[_0x878b('0x42')](_0x878b('0x41'),_0x9238c);}else{return null;}}return _0x52e905[_0x878b('0x1f')](_['upperFirst'](_0x2f08ed[_0x878b('0x3f')]))[_0x878b('0x20')](_0x3cf7fe)[_0x878b('0x23')](function(_0xc5aa71){return BPromise[_0x878b('0x26')]({'id':_0xc5aa71['id'],'endUserType':_0x2f08ed[_0x878b('0x3f')]});});}});}function getCustomFields(_0x58e8b8,_0x3e2e04){var _0x29c533={};if(_0x58e8b8[_0x878b('0x24')]>0x0){_[_0x878b('0x45')](_0x58e8b8,function(_0x4fa195){if(_[_0x878b('0x46')](['string','picklist'],_0x4fa195['type'])&&_0x4fa195['idField']){_0x29c533[_0x4fa195['idField']]=_0x4fa195[_0x878b('0x47')][_0x878b('0x48')]();}else if(_0x4fa195[_0x878b('0x3c')]===_0x878b('0x49')&&_0x4fa195[_0x878b('0x4a')]&&_0x4fa195[_0x878b('0x4b')]){_0x3e2e04[_0x4fa195['variableName']]&&(_0x29c533[_0x4fa195['idField']]=_0x3e2e04[_0x4fa195[_0x878b('0x4a')]][_0x878b('0x48')]());}else if(_0x4fa195[_0x878b('0x3c')]==='customVariable'&&_0x4fa195[_0x878b('0x4c')]&&_0x4fa195[_0x878b('0x4c')]['name']&&_0x4fa195['idField']){_0x3e2e04[_0x4fa195[_0x878b('0x4c')][_0x878b('0x4d')][_0x878b('0x3d')]()]&&(_0x29c533[_0x4fa195[_0x878b('0x4b')]]=_0x3e2e04[_0x4fa195['Variable'][_0x878b('0x4d')][_0x878b('0x3d')]()][_0x878b('0x48')]());}});}return _0x29c533;}function getConnection(_0x4f830f){var _0x4bcceb=_0x4f830f['password']['concat'](_0x4f830f[_0x878b('0x4e')]);var _0x4c1e40=new jsforce[(_0x878b('0x4f'))]({'oauth2':{'loginUrl':_0x4f830f[_0x878b('0x50')]||_0x878b('0x51'),'clientId':_0x4f830f[_0x878b('0x52')],'clientSecret':_0x4f830f['clientSecret']}});return _0x4c1e40[_0x878b('0x53')](_0x4f830f[_0x878b('0x54')],_0x4bcceb)[_0x878b('0x23')](function(){logger[_0x878b('0x25')](_0x878b('0x55'));return _0x4c1e40;});}exports[_0x878b('0x56')]=function(_0x1c8fa4,_0x3a2bc6,_0x570055,_0x383cb0,_0x18d391,_0x5353a6){var _0x4704f9,_0x576d44,_0x5115ca,_0x3a5303;_0x5353a6[_0x878b('0x57')]=intUtil[_0x878b('0x58')](_0x5353a6['serverUrl']);_0x5353a6[_0x878b('0x50')]=intUtil[_0x878b('0x58')](_0x5353a6[_0x878b('0x50')]);if(_0x18d391&&_0x18d391[_0x878b('0x59')]){logger[_0x878b('0x25')](_0x878b('0x5a'),_0x878b('0x5b'));_0x3a2bc6[_0x878b('0x5c')]=util[_0x878b('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5353a6[_0x878b('0x57')],_0x3a2bc6[_0x878b('0x5d')],md5(_0x3a2bc6['uniqueid']));}else{_0x3a2bc6['recordingURL']='';}return getConnection(_0x5353a6)[_0x878b('0x23')](function(_0x515255){_0x3a5303=_0x515255;return getUser(_0x5353a6,_0x383cb0['email'],_0x3a5303);})[_0x878b('0x23')](function(_0x5b1b85){_0x4704f9=_0x5b1b85;return getEndUser(_0x5353a6,_0x570055,_0x3a2bc6[_0x878b('0x5e')],_0x3a2bc6['calleridnum'],_0x3a5303);})['then'](function(_0x5b4953){_0x576d44=_0x5b4953;return getTicket(_0x5353a6,_0x4704f9,_0x576d44,_0x570055,_0x3a2bc6,_0x570055[_0x878b('0x5f')],_0x3a5303,_0x878b('0x56'));})[_0x878b('0x23')](function(_0x2a56fc){_0x5115ca=_0x2a56fc;logger[_0x878b('0x25')](_0x878b('0x60'),_0x5115ca['id']);logger[_0x878b('0x25')](_0x878b('0x61'),_0x5115ca['id'],_0x383cb0['name'],_0x5353a6[_0x878b('0x3c')]);switch(_0x5353a6[_0x878b('0x3c')]){case'integrationTab':emit(util[_0x878b('0x42')](_0x878b('0x62'),_0x383cb0[_0x878b('0x4d')]),_0x878b('0x63'),{'recordId':_0x5115ca['id']});break;case _0x878b('0x64'):emit(util[_0x878b('0x42')](_0x878b('0x62'),_0x383cb0[_0x878b('0x4d')]),_0x878b('0x65'),{'uri':util[_0x878b('0x42')](_0x878b('0x66'),_0x3a5303[_0x878b('0x67')],_0x5115ca['id'])});break;default:logger[_0x878b('0x68')](_0x878b('0x69'));}})[_0x878b('0x6a')](function(_0x6f487e){logger['error'](_0x878b('0x5a'),_0x6f487e);});};exports['outbound']=function(_0x21c15a,_0x198566,_0x5a7216,_0x3e0028,_0x4415c2,_0x489539,_0x506c0a){var _0x4503a4,_0x2e942e,_0x8eebfa,_0x5773e9;_0x489539[_0x878b('0x57')]=intUtil[_0x878b('0x58')](_0x489539[_0x878b('0x57')]);_0x489539[_0x878b('0x50')]=intUtil['stripTrailingSlash'](_0x489539[_0x878b('0x50')]);if(_0x506c0a&&_0x506c0a['recordingFormat']&&_0x506c0a[_0x878b('0x6b')]!=='none'){logger[_0x878b('0x25')](_0x878b('0x6c'),_0x878b('0x5b'));_0x198566[_0x878b('0x5c')]=util[_0x878b('0x42')](_0x878b('0x6d'),_0x489539[_0x878b('0x57')],_0x198566[_0x878b('0x5d')],md5(_0x198566[_0x878b('0x5d')]));}return getConnection(_0x489539)[_0x878b('0x23')](function(_0x572faa){_0x5773e9=_0x572faa;return getUser(_0x489539,_0x3e0028[_0x878b('0x6e')],_0x5773e9);})[_0x878b('0x23')](function(_0x4c8a71){_0x4503a4=_0x4c8a71;return getEndUser(_0x489539,_0x5a7216,_0x198566['destcalleridname'],_0x198566[_0x878b('0x6f')],_0x5773e9);})[_0x878b('0x23')](function(_0xd5cb18){_0x2e942e=_0xd5cb18;return getTicket(_0x489539,_0x4503a4,_0x2e942e,_0x5a7216,_0x198566,_0x5a7216[_0x878b('0x5f')],_0x5773e9,_0x878b('0x70'));})[_0x878b('0x23')](function(_0x38bae5){_0x8eebfa=_0x38bae5;logger[_0x878b('0x25')](_0x878b('0x71'),_0x8eebfa['id']);logger[_0x878b('0x25')](_0x878b('0x72'),_0x8eebfa['id'],_0x3e0028[_0x878b('0x4d')],_0x489539[_0x878b('0x3c')]);switch(_0x489539['type']){case _0x878b('0x73'):emit(util[_0x878b('0x42')](_0x878b('0x62'),_0x3e0028[_0x878b('0x4d')]),'trigger:salesforce:display',{'recordId':_0x8eebfa['id']});break;case'newTab':emit(util[_0x878b('0x42')](_0x878b('0x62'),_0x3e0028[_0x878b('0x4d')]),'trigger:browser:url',{'uri':util['format'](_0x878b('0x66'),_0x5773e9['instanceUrl'],_0x8eebfa['id'])});break;default:logger[_0x878b('0x68')](_0x878b('0x6c'),_0x878b('0x74'));}})['catch'](function(_0x25a932){logger[_0x878b('0x68')](_0x878b('0x6c'),_0x25a932);});};exports[_0x878b('0x75')]=function(_0x1fb016,_0x3d3293,_0x2b106d,_0x3ec207,_0x37d97d,_0x1a2f55){var _0xd660fa,_0x177144,_0x23e16d,_0xae43b6;_0x1a2f55[_0x878b('0x57')]=intUtil[_0x878b('0x58')](_0x1a2f55[_0x878b('0x57')]);_0x1a2f55[_0x878b('0x50')]=intUtil[_0x878b('0x58')](_0x1a2f55['remoteUri']);if(_0x37d97d&&_0x37d97d[_0x878b('0x59')]){logger[_0x878b('0x25')]('['+_0x3d3293['lastevent']['toUpperCase']()+']',_0x878b('0x5b'));_0x3d3293[_0x878b('0x5c')]=util[_0x878b('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a2f55[_0x878b('0x57')],_0x3d3293[_0x878b('0x5d')],md5(_0x3d3293[_0x878b('0x5d')]));}else{_0x3d3293[_0x878b('0x5c')]='';}return getConnection(_0x1a2f55)['then'](function(_0x2b1554){_0xae43b6=_0x2b1554;if(!_[_0x878b('0x21')](_0x3ec207)){return getUser(_0x1a2f55,_0x3ec207[_0x878b('0x4d')],_0xae43b6);}else{return getUser(_0x1a2f55,null,_0xae43b6);}})[_0x878b('0x23')](function(_0x280162){_0xd660fa=_0x280162;return getEndUser(_0x1a2f55,_0x2b106d,_0x3d3293[_0x878b('0x5e')],_0x3d3293['calleridnum'],_0xae43b6);})[_0x878b('0x23')](function(_0x58008e){_0x177144=_0x58008e;return getTicket(_0x1a2f55,_0xd660fa,_0x177144,_0x2b106d,_0x3d3293,_0x2b106d[_0x878b('0x5f')],_0xae43b6);})[_0x878b('0x23')](function(_0x20777a){_0x23e16d=_0x20777a;logger[_0x878b('0x25')]('['+_0x3d3293[_0x878b('0x76')][_0x878b('0x77')]()+']\x20Ticket\x20%s\x20created.',_0x23e16d['id']);logger[_0x878b('0x25')]('['+_0x3d3293[_0x878b('0x76')]['toUpperCase']()+_0x878b('0x78'),_0x1a2f55[_0x878b('0x3c')]);})[_0x878b('0x6a')](function(_0xe196d4){logger[_0x878b('0x68')]('['+_0x3d3293[_0x878b('0x76')][_0x878b('0x77')]()+']',_0xe196d4);});}; \ 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 d5a0570..d5b3104 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 _0xd21f=['%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','sys_id','catch','error','toUpperCase','message','info','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','length','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','customField','nameField','content','picklist','type','idField','toLowerCase','toString','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','Subjects','getString','Fields','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xd21f,0x1d5));var _0xfd21=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xd21f[_0x35c5a8];return _0x34782c;};'use strict';var _=require(_0xfd21('0x0'));var Promise=require(_0xfd21('0x1'));var rp=require(_0xfd21('0x2'));var util=require(_0xfd21('0x3'));var md5=require(_0xfd21('0x4'));var Redis=require(_0xfd21('0x5'));var intUtil=require(_0xfd21('0x6'));var config=require(_0xfd21('0x7'));var logger=require(_0xfd21('0x8'))(_0xfd21('0x9'));config['redis']=_[_0xfd21('0xa')](config[_0xfd21('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xfd21('0xc'))(new Redis(config['redis']));function getAdminUser(_0x4ecc72,_0x366e04,_0x166652,_0x5a2bec,_0x32a393,_0xb51770){return new Promise(function(_0x3d1f73,_0x585bf4){var _0x5a828c={'method':_0xfd21('0xd'),'uri':_0x5a2bec+_0xfd21('0xe')+'&'+_0x32a393+'&'+_0xb51770,'auth':_0x366e04,'json':!![]};return rp(_0x5a828c)[_0xfd21('0xf')](function(_0x25d646){if(_0x25d646['result']['length']>0x0){_0x166652['adminId']=_0x25d646['result'][0x0][_0xfd21('0x10')];}logger['info']('['+[_0x4ecc72['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x166652);_0x3d1f73(_0x166652);})[_0xfd21('0x11')](function(_0x21ca41){logger[_0xfd21('0x12')]('['+[_0x4ecc72[_0xfd21('0x13')]()]+']',_0x21ca41[_0xfd21('0x14')]);_0x585bf4(_0x21ca41['message']);});});}function getUser(_0x6c43a4,_0x59b541,_0x4c9f63,_0x5a5fb0,_0x3a3b96){return function(_0x82c940){logger[_0xfd21('0x15')]('['+[_0x6c43a4[_0xfd21('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x82c940);return new Promise(function(_0x4c19ed,_0x29d13a){if(intUtil[_0xfd21('0x16')](_0x82c940['userEmail'])){var _0xffc761={'method':_0xfd21('0xd'),'uri':_0x4c9f63+'sys_user?sysparm_query=email%3D'+_0x82c940[_0xfd21('0x17')]+'&'+_0x5a5fb0+'&'+_0x3a3b96,'auth':_0x59b541,'json':!![]};logger[_0xfd21('0x15')]('['+[_0x6c43a4[_0xfd21('0x13')]()]+_0xfd21('0x18'),_0xffc761);return rp(_0xffc761)['then'](function(_0x195dbd){logger[_0xfd21('0x15')]('['+[_0x6c43a4['toUpperCase']()]+_0xfd21('0x19'),_0x195dbd);if(_0x195dbd[_0xfd21('0x1a')][_0xfd21('0x1b')]>0x0&&String(_0x195dbd[_0xfd21('0x1a')][0x0][_0xfd21('0x1c')])===_0xfd21('0x1d')){_0x82c940[_0xfd21('0x1e')]=_0x195dbd[_0xfd21('0x1a')][0x0]['sys_id'];}else{_0x82c940[_0xfd21('0x1e')]=_0x82c940[_0xfd21('0x1f')];_0x82c940[_0xfd21('0x17')]=_0x82c940[_0xfd21('0x20')];}logger[_0xfd21('0x15')]('['+[_0x6c43a4[_0xfd21('0x13')]()]+_0xfd21('0x21'),_0x82c940);_0x4c19ed(_0x82c940);})[_0xfd21('0x11')](function(_0x55c642){logger[_0xfd21('0x12')]('['+[_0x6c43a4[_0xfd21('0x13')]()]+']',_0x55c642['message']);_0x29d13a(_0x55c642[_0xfd21('0x14')]);});}else{logger[_0xfd21('0x15')]('['+[_0x6c43a4['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x82c940[_0xfd21('0x1e')]=_0x82c940['adminId'];_0x82c940[_0xfd21('0x17')]=_0x82c940[_0xfd21('0x20')];_0x4c19ed(_0x82c940);}});};}function createEndUser(_0x17b995,_0x3597a7,_0x543b49,_0x3113ce,_0xbd4796){logger[_0xfd21('0x15')]('['+[_0x17b995[_0xfd21('0x13')]()]+_0xfd21('0x22'),_0x543b49);return new Promise(function(_0x4dc94a,_0x52609d){var _0xa47a49={'method':'POST','uri':_0x3113ce+_0xfd21('0x23')+_0xbd4796,'body':{'user_name':_0x543b49[_0xfd21('0x24')],'roles':'user','first_name':_0x543b49[_0xfd21('0x24')],'active':_0xfd21('0x1d'),'date_format':'System','phone':_0x543b49[_0xfd21('0x24')]},'auth':_0x3597a7,'json':!![]};return rp(_0xa47a49)['then'](function(_0x3ca951){logger['info']('['+[_0x17b995['toUpperCase']()]+_0xfd21('0x25'),_0x3ca951[_0xfd21('0x1a')]);_0x543b49[_0xfd21('0x26')]=_0x3ca951[_0xfd21('0x1a')][_0xfd21('0x10')];_0x4dc94a(_0x543b49);})[_0xfd21('0x11')](function(_0x225440){logger[_0xfd21('0x12')]('['+[_0x17b995['toUpperCase']()]+']',_0x225440['message']);_0x52609d(_0x225440[_0xfd21('0x14')]);});});}function getEndUser(_0x11a1f3,_0x17988e,_0x1bc779,_0x494249,_0x1cd31a){return function(_0x23b65f){logger[_0xfd21('0x15')]('['+[_0x11a1f3[_0xfd21('0x13')]()]+_0xfd21('0x27'),_0x23b65f);return new Promise(function(_0x109e8d,_0x2c6696){var _0x40f639={'method':_0xfd21('0xd'),'uri':_0x1bc779+_0xfd21('0x28')+_0x23b65f['endUserNumber']+'&'+_0x494249+'&'+_0x1cd31a,'auth':_0x17988e,'json':!![]};return rp(_0x40f639)[_0xfd21('0xf')](function(_0x26ef20){if(_0x26ef20['result']['length']>0x0){_0x23b65f['endUserId']=_0x26ef20[_0xfd21('0x1a')][0x0][_0xfd21('0x10')];logger[_0xfd21('0x15')]('['+[_0x11a1f3[_0xfd21('0x13')]()]+_0xfd21('0x29'),_0x23b65f);_0x109e8d(_0x23b65f);}else{return createEndUser(_0x11a1f3,_0x17988e,_0x23b65f,_0x1bc779,_0x494249)[_0xfd21('0xf')](function(_0x159342){logger[_0xfd21('0x15')]('['+[_0x11a1f3[_0xfd21('0x13')]()]+_0xfd21('0x2a'),_0x159342);_0x109e8d(_0x159342);});}})[_0xfd21('0x11')](function(_0x43a8ee){logger[_0xfd21('0x12')]('['+[_0x11a1f3['toUpperCase']()]+']',_0x43a8ee['message']);_0x2c6696(_0x43a8ee['message']);});});};}function getCustomFields(_0x883139,_0x173866){var _0x485eff={};if(_0x883139['length']>0x0){_[_0xfd21('0x2b')](_0x883139,function(_0x3db4f0){if(_['includes']([_0xfd21('0x2c'),'picklist'],_0x3db4f0['type'])&&_0x3db4f0['nameField']&&!_0x3db4f0[_0xfd21('0x2d')]){_0x485eff[_0x3db4f0[_0xfd21('0x2e')]['toLowerCase']()]=_0x3db4f0[_0xfd21('0x2f')]['toString']();}else if(_['includes']([_0xfd21('0x2c'),_0xfd21('0x30')],_0x3db4f0[_0xfd21('0x31')])&&_0x3db4f0[_0xfd21('0x32')]&&_0x3db4f0[_0xfd21('0x2d')]){_0x485eff[_0x3db4f0['idField'][_0xfd21('0x33')]()]=_0x3db4f0[_0xfd21('0x2f')][_0xfd21('0x34')]();}else if(_0x3db4f0[_0xfd21('0x31')]===_0xfd21('0x35')&&_0x3db4f0['variableName']&&_0x3db4f0[_0xfd21('0x32')]&&_0x3db4f0[_0xfd21('0x2d')]){_0x485eff[_0x3db4f0[_0xfd21('0x32')][_0xfd21('0x33')]()]=_0x173866[_0x3db4f0[_0xfd21('0x36')]][_0xfd21('0x34')]();}else if(_0x3db4f0[_0xfd21('0x31')]===_0xfd21('0x37')&&_0x3db4f0[_0xfd21('0x38')]&&_0x3db4f0[_0xfd21('0x38')]['name']&&_0x3db4f0[_0xfd21('0x32')]&&_0x3db4f0[_0xfd21('0x2d')]){_0x485eff[_0x3db4f0[_0xfd21('0x32')]['toLowerCase']()]=_0x173866[_0x3db4f0[_0xfd21('0x38')]['name'][_0xfd21('0x33')]()][_0xfd21('0x34')]();}});}return _0x485eff;}function getTicket(_0x3b91d4,_0x3f5411,_0x11ad24,_0x242078,_0x3f8b15,_0x578c73){return function(_0x312f80){logger[_0xfd21('0x15')]('['+[_0x3b91d4[_0xfd21('0x13')]()]+_0xfd21('0x39'),_0x312f80);return new Promise(function(_0x4fd785,_0x1302bd){var _0x4ed5d8=_0x3b91d4['toLowerCase']()===_0xfd21('0x3a')?_0x312f80[_0xfd21('0x1e')]:_0x312f80[_0xfd21('0x26')];var _0x120cba={'method':_0xfd21('0x3b'),'uri':_0x11ad24+_0xfd21('0x3c')+'?'+_0x578c73,'body':Object[_0xfd21('0x3d')]({},{'active':_0xfd21('0x1d'),'caller_id':_0x4ed5d8,'assigned_to':_0x312f80['userId'],'short_description':intUtil['getString'](_0x242078[_0xfd21('0x3e')],_0x3f8b15,'\x20'),'description':intUtil[_0xfd21('0x3f')](_0x242078['Descriptions'],_0x3f8b15,'\x0a')},getCustomFields(_0x242078[_0xfd21('0x40')],_0x3f8b15)),'auth':_0x3f5411,'json':!![]};return rp(_0x120cba)[_0xfd21('0xf')](function(_0x2f0f57){logger[_0xfd21('0x15')]('['+[_0x3b91d4[_0xfd21('0x13')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f0f57[_0xfd21('0x1a')]);_0x312f80['ticketId']=_0x2f0f57[_0xfd21('0x1a')][_0xfd21('0x10')];_0x312f80[_0xfd21('0x41')]=_0x2f0f57[_0xfd21('0x1a')][_0xfd21('0x42')];logger[_0xfd21('0x15')]('['+[_0x3b91d4['toUpperCase']()]+_0xfd21('0x43'),_0x312f80);_0x4fd785(_0x312f80);})[_0xfd21('0x11')](function(_0x11805a){logger[_0xfd21('0x12')]('['+[_0x3b91d4['toUpperCase']()]+']',_0x11805a['message']);_0x1302bd(_0x11805a['message']);});});};}function createRemoteTag(_0x32ad10,_0x1d242f,_0x3ac732,_0x358ce4){return new Promise(function(_0x65ab22,_0x54b4c7){var _0x455e7b={'method':'POST','uri':_0x3ac732+_0xfd21('0x44')+'?'+_0x358ce4,'body':{'short_description':_0x32ad10,'global':!![],'active':!![],'name':_0x32ad10},'auth':_0x1d242f,'json':!![]};return rp(_0x455e7b)[_0xfd21('0xf')](function(_0x2fe3aa){var _0x28ea01=_0x2fe3aa[_0xfd21('0x1a')]['sys_id'];_0x65ab22(_0x28ea01);});});}function getRemoteTag(_0x1956ac,_0x833545,_0x22c473,_0x2f5141,_0x2f8f70){return new Promise(function(_0x42d87c,_0x265d6c){var _0x41b788={'method':_0xfd21('0xd'),'uri':_0x22c473+_0xfd21('0x44')+_0xfd21('0x45')+_0x1956ac+'&'+_0x2f5141,'auth':_0x833545,'json':!![]};return rp(_0x41b788)[_0xfd21('0xf')](function(_0x2b97eb){if(_0x2b97eb[_0xfd21('0x1a')]['length']>0x0){var _0x591b60=_0x2b97eb[_0xfd21('0x1a')][0x0][_0xfd21('0x10')];_0x42d87c(_0x591b60);}else{return createRemoteTag(_0x1956ac,_0x833545,_0x22c473,_0x2f5141)[_0xfd21('0xf')](function(_0x536451){_0x42d87c(_0x536451);});}});});}function assignTagToIncident(_0x441ca2,_0x26b123,_0x419039,_0x440875,_0xe5b704){return new Promise(function(_0x3152fc,_0x30e0c3){var _0x140ea4={'method':'POST','uri':_0x419039+'label_entry'+'?'+_0xe5b704,'body':{'label':_0x441ca2,'table':'incident','id_type':_0xfd21('0x46'),'table_key':_0x440875[_0xfd21('0x47')],'title':_0xfd21('0x48')+_0x440875[_0xfd21('0x41')],'id_display':_0x440875[_0xfd21('0x41')]},'auth':_0x26b123,'json':!![]};return rp(_0x140ea4)['then'](function(_0x501ec4){_0x3152fc();})[_0xfd21('0x11')](function(){_0x3152fc();});});}function manageTags(_0x1fa566,_0x406fde,_0x55cdea,_0x847c37,_0x2fcfcc,_0x38df1c,_0x1e6ed4){return new Promise(function(_0xae80a5,_0x2f5fb0){var _0x1c9b50=[];_0x406fde[_0xfd21('0x2b')](function(_0xb43363){_0x1c9b50[_0xfd21('0x49')](getRemoteTag(_0xb43363,_0x55cdea,_0x847c37,_0x38df1c,_0x1e6ed4));});return Promise[_0xfd21('0x4a')](_0x1c9b50)[_0xfd21('0xf')](function(_0x2c4369){if(_0x2c4369[_0xfd21('0x1b')]){logger[_0xfd21('0x15')]('['+[_0x1fa566[_0xfd21('0x13')]()]+_0xfd21('0x4b'),_0x2c4369);var _0x82a09a=[];_0x2c4369['forEach'](function(_0x6d0dbb){_0x82a09a['push'](assignTagToIncident(_0x6d0dbb,_0x55cdea,_0x847c37,_0x2fcfcc,_0x38df1c));});return Promise[_0xfd21('0x4a')](_0x82a09a)[_0xfd21('0xf')](function(){_0xae80a5();})[_0xfd21('0x11')](function(){_0xae80a5();});}else{_0xae80a5();}});});}function getTags(_0x23779e,_0x2e89f3,_0x14c311,_0x316cdc,_0x1d8f4e,_0x3b15da){return function(_0x4daa5c){return new Promise(function(_0x16868d,_0x94116c){var _0x350aa9=[];var _0x56ba13=_0x316cdc[_0xfd21('0x4c')];if(_0x56ba13&&_0x56ba13[_0xfd21('0x1b')]>0x0){_0x350aa9=_[_0xfd21('0x4d')](_0x56ba13,_0xfd21('0x4e'));}if(_0x350aa9['length']>0x0){return manageTags(_0x23779e,_0x350aa9,_0x2e89f3,_0x14c311,_0x4daa5c,_0x1d8f4e,_0x3b15da)[_0xfd21('0xf')](function(){_0x16868d(_0x4daa5c);});}else{_0x16868d(_0x4daa5c);}});};}function emit(_0x27cc97,_0x3e674f,_0x53cfe2){var _0x5a5025=_0xfd21('0x4f')+_0xfd21('0x50')+_0xfd21('0x51')+'%255EORDERBYDESCnumber';var _0x240e2e={'uri':_0x27cc97+_0xfd21('0x52')+_0x53cfe2+_0x5a5025};io['to'](util[_0xfd21('0x53')](_0xfd21('0x54'),_0x3e674f))['emit']('trigger:browser:url',_0x240e2e);}exports['cs']=function(_0x5e92d9,_0x1df289,_0xc93452,_0x597a06,_0x50ec9e,_0x3b2c4a,_0x3b9c54,_0xa962fe){var _0x498a20={};var _0x2131ba={'user':_0x3b2c4a[_0xfd21('0x55')],'pass':_0x3b2c4a[_0xfd21('0x56')]};var _0x14c4c4=_0xfd21('0x57');var _0x383a53=_0xfd21('0x58');_0x3b2c4a['remoteUri']=intUtil[_0xfd21('0x59')](_0x3b2c4a[_0xfd21('0x5a')]);_0x3b2c4a['serverUrl']=intUtil[_0xfd21('0x59')](_0x3b2c4a[_0xfd21('0x5b')]);var _0x289b8e=util[_0xfd21('0x53')](_0xfd21('0x5c'),_0x3b2c4a[_0xfd21('0x5a')]);_0x498a20[_0xfd21('0x17')]=!_[_0xfd21('0x5d')](_0x597a06)?_0x597a06[_0xfd21('0x5e')]:null;_0x498a20[_0xfd21('0x20')]=_0x3b2c4a[_0xfd21('0x5e')];_0x498a20['endUserNumber']=_0xa962fe['toLowerCase']()===_0xfd21('0x3a')?_0x1df289[_0xfd21('0x5f')]:_0x1df289['calleridnum'];_0x498a20[_0xfd21('0x60')]=_0xa962fe==='queue'||_0xa962fe===_0xfd21('0x61')?_0xfd21('0x62'):_0xfd21('0x3a');var _0x3f282e=util['format'](_0xfd21('0x63'),_0x3b2c4a[_0xfd21('0x5b')],_0x1df289['uniqueid'],md5(_0x1df289[_0xfd21('0x64')]));if(_0x50ec9e&&_0x50ec9e[_0xfd21('0x65')]){logger[_0xfd21('0x15')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1df289[_0xfd21('0x66')]=_0x3f282e;}else if(_0x3b9c54&&_0x3b9c54[_0xfd21('0x67')]&&_0x3b9c54[_0xfd21('0x67')]!==_0xfd21('0x68')){logger[_0xfd21('0x15')](_0xfd21('0x69'),'Recording\x20is\x20enabled!');_0x1df289['recordingURL']=_0x3f282e;}else{_0x1df289[_0xfd21('0x66')]='';}return getAdminUser(_0xa962fe,_0x2131ba,_0x498a20,_0x289b8e,_0x383a53,_0x14c4c4)[_0xfd21('0xf')](getUser(_0xa962fe,_0x2131ba,_0x289b8e,_0x383a53,_0x14c4c4))[_0xfd21('0xf')](getEndUser(_0xa962fe,_0x2131ba,_0x289b8e,_0x383a53,_0x14c4c4))[_0xfd21('0xf')](getTicket(_0xa962fe,_0x2131ba,_0x289b8e,_0xc93452,_0x1df289,_0x383a53))[_0xfd21('0xf')](function(_0x317f46){logger[_0xfd21('0x15')](util[_0xfd21('0x53')](_0xfd21('0x6a'),_0x317f46['ticketId']));logger[_0xfd21('0x15')](util[_0xfd21('0x53')](_0xfd21('0x6b'),_0xa962fe));if(_0xa962fe!=='unmanaged'){logger[_0xfd21('0x15')]('['+[_0xa962fe[_0xfd21('0x13')]()]+']',_0xfd21('0x6c'));emit(_0x3b2c4a[_0xfd21('0x5a')],_0x597a06[_0xfd21('0x4e')],_0x317f46[_0xfd21('0x47')]);}})[_0xfd21('0x11')](function(_0xe0ff54){logger[_0xfd21('0x12')]('['+[_0xa962fe[_0xfd21('0x13')]()]+_0xfd21('0x6d'),util['inspect'](_0xe0ff54,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc873=['customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail',']\x20using\x20admin\x20profile','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName'];(function(_0x462e47,_0x5bc307){var _0x36cb97=function(_0x4d86ed){while(--_0x4d86ed){_0x462e47['push'](_0x462e47['shift']());}};_0x36cb97(++_0x5bc307);}(_0xc873,0x171));var _0x3c87=function(_0x1f823d,_0x577933){_0x1f823d=_0x1f823d-0x0;var _0xcb1621=_0xc873[_0x1f823d];return _0xcb1621;};'use strict';var _=require('lodash');var Promise=require(_0x3c87('0x0'));var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require(_0x3c87('0x1'));var intUtil=require(_0x3c87('0x2'));var config=require(_0x3c87('0x3'));var logger=require('../../../../config/logger')(_0x3c87('0x4'));config[_0x3c87('0x5')]=_[_0x3c87('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3c87('0x7'))(new Redis(config[_0x3c87('0x5')]));function getAdminUser(_0xbea215,_0x4dcf25,_0x55756b,_0x394a75,_0x20e332,_0x200bb5){return new Promise(function(_0x1e3b25,_0x2f22ee){var _0x57eed5={'method':_0x3c87('0x8'),'uri':_0x394a75+_0x3c87('0x9')+'&'+_0x20e332+'&'+_0x200bb5,'auth':_0x4dcf25,'json':!![]};return rp(_0x57eed5)[_0x3c87('0xa')](function(_0x33793d){if(_0x33793d['result'][_0x3c87('0xb')]>0x0){_0x55756b[_0x3c87('0xc')]=_0x33793d[_0x3c87('0xd')][0x0][_0x3c87('0xe')];}logger[_0x3c87('0xf')]('['+[_0xbea215[_0x3c87('0x10')]()]+'],\x20getAdminUser\x20crm',_0x55756b);_0x1e3b25(_0x55756b);})[_0x3c87('0x11')](function(_0x5ee59e){logger[_0x3c87('0x12')]('['+[_0xbea215[_0x3c87('0x10')]()]+']',_0x5ee59e[_0x3c87('0x13')]);_0x2f22ee(_0x5ee59e['message']);});});}function getUser(_0xba86f4,_0x5e4f20,_0x4a7aa0,_0x2b165d,_0x423af7){return function(_0x2765fd){logger[_0x3c87('0xf')]('['+[_0xba86f4[_0x3c87('0x10')]()]+_0x3c87('0x14'),_0x2765fd);return new Promise(function(_0xe1eb45,_0x2a5ac3){if(intUtil[_0x3c87('0x15')](_0x2765fd[_0x3c87('0x16')])){var _0x58b7de={'method':_0x3c87('0x8'),'uri':_0x4a7aa0+'sys_user?sysparm_query=email%3D'+_0x2765fd[_0x3c87('0x16')]+'&'+_0x2b165d+'&'+_0x423af7,'auth':_0x5e4f20,'json':!![]};logger['info']('['+[_0xba86f4[_0x3c87('0x10')]()]+_0x3c87('0x17'),_0x58b7de);return rp(_0x58b7de)[_0x3c87('0xa')](function(_0x1cbb0c){logger[_0x3c87('0xf')]('['+[_0xba86f4[_0x3c87('0x10')]()]+_0x3c87('0x18'),_0x1cbb0c);if(_0x1cbb0c[_0x3c87('0xd')][_0x3c87('0xb')]>0x0&&String(_0x1cbb0c[_0x3c87('0xd')][0x0]['active'])===_0x3c87('0x19')){_0x2765fd[_0x3c87('0x1a')]=_0x1cbb0c[_0x3c87('0xd')][0x0][_0x3c87('0xe')];}else{_0x2765fd['userId']=_0x2765fd[_0x3c87('0xc')];_0x2765fd[_0x3c87('0x16')]=_0x2765fd[_0x3c87('0x1b')];}logger[_0x3c87('0xf')]('['+[_0xba86f4[_0x3c87('0x10')]()]+'],\x20getUser\x20crm',_0x2765fd);_0xe1eb45(_0x2765fd);})[_0x3c87('0x11')](function(_0x29bc25){logger[_0x3c87('0x12')]('['+[_0xba86f4[_0x3c87('0x10')]()]+']',_0x29bc25[_0x3c87('0x13')]);_0x2a5ac3(_0x29bc25['message']);});}else{logger[_0x3c87('0xf')]('['+[_0xba86f4['toUpperCase']()]+_0x3c87('0x1c'));_0x2765fd[_0x3c87('0x1a')]=_0x2765fd['adminId'];_0x2765fd[_0x3c87('0x16')]=_0x2765fd[_0x3c87('0x1b')];_0xe1eb45(_0x2765fd);}});};}function createEndUser(_0x23fb09,_0x54706a,_0x9f4987,_0x37c76d,_0x596fd1){logger[_0x3c87('0xf')]('['+[_0x23fb09[_0x3c87('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x9f4987);return new Promise(function(_0x434ca1,_0x21a6aa){var _0xacf6f7={'method':'POST','uri':_0x37c76d+_0x3c87('0x1d')+_0x596fd1,'body':{'user_name':_0x9f4987[_0x3c87('0x1e')],'roles':_0x3c87('0x1f'),'first_name':_0x9f4987['endUserNumber'],'active':_0x3c87('0x19'),'date_format':_0x3c87('0x20'),'phone':_0x9f4987[_0x3c87('0x1e')]},'auth':_0x54706a,'json':!![]};return rp(_0xacf6f7)[_0x3c87('0xa')](function(_0x518046){logger[_0x3c87('0xf')]('['+[_0x23fb09['toUpperCase']()]+_0x3c87('0x21'),_0x518046[_0x3c87('0xd')]);_0x9f4987[_0x3c87('0x22')]=_0x518046['result'][_0x3c87('0xe')];_0x434ca1(_0x9f4987);})[_0x3c87('0x11')](function(_0x221248){logger[_0x3c87('0x12')]('['+[_0x23fb09['toUpperCase']()]+']',_0x221248[_0x3c87('0x13')]);_0x21a6aa(_0x221248[_0x3c87('0x13')]);});});}function getEndUser(_0x53b7be,_0x105c51,_0x237a6e,_0x1448bc,_0x8e429){return function(_0x2c498d){logger[_0x3c87('0xf')]('['+[_0x53b7be[_0x3c87('0x10')]()]+_0x3c87('0x23'),_0x2c498d);return new Promise(function(_0x26a346,_0x17c642){var _0x25b3b5={'method':_0x3c87('0x8'),'uri':_0x237a6e+_0x3c87('0x24')+_0x2c498d['endUserNumber']+'&'+_0x1448bc+'&'+_0x8e429,'auth':_0x105c51,'json':!![]};return rp(_0x25b3b5)[_0x3c87('0xa')](function(_0x2e2327){if(_0x2e2327[_0x3c87('0xd')][_0x3c87('0xb')]>0x0){_0x2c498d['endUserId']=_0x2e2327[_0x3c87('0xd')][0x0]['sys_id'];logger[_0x3c87('0xf')]('['+[_0x53b7be[_0x3c87('0x10')]()]+_0x3c87('0x25'),_0x2c498d);_0x26a346(_0x2c498d);}else{return createEndUser(_0x53b7be,_0x105c51,_0x2c498d,_0x237a6e,_0x1448bc)['then'](function(_0x33cf8e){logger[_0x3c87('0xf')]('['+[_0x53b7be['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x33cf8e);_0x26a346(_0x33cf8e);});}})[_0x3c87('0x11')](function(_0x188ccb){logger[_0x3c87('0x12')]('['+[_0x53b7be[_0x3c87('0x10')]()]+']',_0x188ccb['message']);_0x17c642(_0x188ccb[_0x3c87('0x13')]);});});};}function getCustomFields(_0x26597b,_0x37288e){var _0x3f868c={};if(_0x26597b[_0x3c87('0xb')]>0x0){_[_0x3c87('0x26')](_0x26597b,function(_0x521568){if(_[_0x3c87('0x27')](['string',_0x3c87('0x28')],_0x521568[_0x3c87('0x29')])&&_0x521568[_0x3c87('0x2a')]&&!_0x521568[_0x3c87('0x2b')]){_0x3f868c[_0x521568['nameField'][_0x3c87('0x2c')]()]=_0x521568[_0x3c87('0x2d')][_0x3c87('0x2e')]();}else if(_['includes']([_0x3c87('0x2f'),_0x3c87('0x28')],_0x521568['type'])&&_0x521568['idField']&&_0x521568['customField']){_0x3f868c[_0x521568[_0x3c87('0x30')][_0x3c87('0x2c')]()]=_0x521568[_0x3c87('0x2d')][_0x3c87('0x2e')]();}else if(_0x521568[_0x3c87('0x29')]===_0x3c87('0x31')&&_0x521568[_0x3c87('0x32')]&&_0x521568[_0x3c87('0x30')]&&_0x521568['customField']){_0x3f868c[_0x521568[_0x3c87('0x30')][_0x3c87('0x2c')]()]=_0x37288e[_0x521568[_0x3c87('0x32')]][_0x3c87('0x2e')]();}else if(_0x521568[_0x3c87('0x29')]===_0x3c87('0x33')&&_0x521568[_0x3c87('0x34')]&&_0x521568[_0x3c87('0x34')][_0x3c87('0x35')]&&_0x521568[_0x3c87('0x30')]&&_0x521568[_0x3c87('0x2b')]){_0x3f868c[_0x521568[_0x3c87('0x30')][_0x3c87('0x2c')]()]=_0x37288e[_0x521568[_0x3c87('0x34')][_0x3c87('0x35')][_0x3c87('0x2c')]()][_0x3c87('0x2e')]();}});}return _0x3f868c;}function getTicket(_0x3200bb,_0x33f0e9,_0x3672ad,_0x4427ea,_0x5109c8,_0x57587c){return function(_0x23b0a7){logger[_0x3c87('0xf')]('['+[_0x3200bb[_0x3c87('0x10')]()]+_0x3c87('0x36'),_0x23b0a7);return new Promise(function(_0x477712,_0x5e7b5c){var _0x4f8b40=_0x3200bb[_0x3c87('0x2c')]()===_0x3c87('0x37')?_0x23b0a7['userId']:_0x23b0a7['endUserId'];var _0x22b014={'method':_0x3c87('0x38'),'uri':_0x3672ad+'incident'+'?'+_0x57587c,'body':Object[_0x3c87('0x39')]({},{'active':'true','caller_id':_0x4f8b40,'assigned_to':_0x23b0a7[_0x3c87('0x1a')],'short_description':intUtil[_0x3c87('0x3a')](_0x4427ea['Subjects'],_0x5109c8,'\x20'),'description':intUtil[_0x3c87('0x3a')](_0x4427ea[_0x3c87('0x3b')],_0x5109c8,'\x0a')},getCustomFields(_0x4427ea['Fields'],_0x5109c8)),'auth':_0x33f0e9,'json':!![]};return rp(_0x22b014)[_0x3c87('0xa')](function(_0x341c63){logger['info']('['+[_0x3200bb[_0x3c87('0x10')]()]+_0x3c87('0x3c'),_0x341c63['result']);_0x23b0a7[_0x3c87('0x3d')]=_0x341c63[_0x3c87('0xd')][_0x3c87('0xe')];_0x23b0a7['ticketNumber']=_0x341c63['result'][_0x3c87('0x3e')];logger[_0x3c87('0xf')]('['+[_0x3200bb[_0x3c87('0x10')]()]+_0x3c87('0x3f'),_0x23b0a7);_0x477712(_0x23b0a7);})[_0x3c87('0x11')](function(_0x4eb9bf){logger[_0x3c87('0x12')]('['+[_0x3200bb[_0x3c87('0x10')]()]+']',_0x4eb9bf['message']);_0x5e7b5c(_0x4eb9bf['message']);});});};}function createRemoteTag(_0x11aade,_0x3ed76b,_0x58cc00,_0x52b600){return new Promise(function(_0x5785f7,_0x420794){var _0x1b0850={'method':'POST','uri':_0x58cc00+_0x3c87('0x40')+'?'+_0x52b600,'body':{'short_description':_0x11aade,'global':!![],'active':!![],'name':_0x11aade},'auth':_0x3ed76b,'json':!![]};return rp(_0x1b0850)[_0x3c87('0xa')](function(_0x398287){var _0x7225b5=_0x398287[_0x3c87('0xd')]['sys_id'];_0x5785f7(_0x7225b5);});});}function getRemoteTag(_0x2f5c84,_0x2dc535,_0x5881b4,_0xb39cd7,_0x412c17){return new Promise(function(_0x3d3d78,_0x4b36dd){var _0x3a36ab={'method':'GET','uri':_0x5881b4+_0x3c87('0x40')+_0x3c87('0x41')+_0x2f5c84+'&'+_0xb39cd7,'auth':_0x2dc535,'json':!![]};return rp(_0x3a36ab)[_0x3c87('0xa')](function(_0x3cf9e1){if(_0x3cf9e1[_0x3c87('0xd')][_0x3c87('0xb')]>0x0){var _0x54f9a7=_0x3cf9e1[_0x3c87('0xd')][0x0]['sys_id'];_0x3d3d78(_0x54f9a7);}else{return createRemoteTag(_0x2f5c84,_0x2dc535,_0x5881b4,_0xb39cd7)[_0x3c87('0xa')](function(_0x119029){_0x3d3d78(_0x119029);});}});});}function assignTagToIncident(_0x508489,_0x197ad1,_0x2a1d54,_0x4716f0,_0x4be2a8){return new Promise(function(_0x2b99c0,_0x6bedac){var _0x3e1629={'method':_0x3c87('0x38'),'uri':_0x2a1d54+'label_entry'+'?'+_0x4be2a8,'body':{'label':_0x508489,'table':_0x3c87('0x42'),'id_type':_0x3c87('0x43'),'table_key':_0x4716f0[_0x3c87('0x3d')],'title':_0x3c87('0x44')+_0x4716f0['ticketNumber'],'id_display':_0x4716f0[_0x3c87('0x45')]},'auth':_0x197ad1,'json':!![]};return rp(_0x3e1629)[_0x3c87('0xa')](function(_0x14f2b8){_0x2b99c0();})['catch'](function(){_0x2b99c0();});});}function manageTags(_0x486fe5,_0x361c39,_0x17a886,_0x2101b8,_0x4c1603,_0x4a3235,_0x2f48f6){return new Promise(function(_0x1d7040,_0x5168ac){var _0x1f9538=[];_0x361c39[_0x3c87('0x26')](function(_0x3e389a){_0x1f9538['push'](getRemoteTag(_0x3e389a,_0x17a886,_0x2101b8,_0x4a3235,_0x2f48f6));});return Promise['all'](_0x1f9538)[_0x3c87('0xa')](function(_0x28c3f4){if(_0x28c3f4[_0x3c87('0xb')]){logger[_0x3c87('0xf')]('['+[_0x486fe5[_0x3c87('0x10')]()]+_0x3c87('0x46'),_0x28c3f4);var _0x46a42e=[];_0x28c3f4['forEach'](function(_0x45a2e0){_0x46a42e['push'](assignTagToIncident(_0x45a2e0,_0x17a886,_0x2101b8,_0x4c1603,_0x4a3235));});return Promise[_0x3c87('0x47')](_0x46a42e)['then'](function(){_0x1d7040();})[_0x3c87('0x11')](function(){_0x1d7040();});}else{_0x1d7040();}});});}function getTags(_0x45bbc4,_0x1377d9,_0x2900d1,_0x233220,_0x220047,_0x10ddb8){return function(_0x17b861){return new Promise(function(_0x93415e,_0x2ebd92){var _0xbed94c=[];var _0x2b5d02=_0x233220[_0x3c87('0x48')];if(_0x2b5d02&&_0x2b5d02[_0x3c87('0xb')]>0x0){_0xbed94c=_[_0x3c87('0x49')](_0x2b5d02,_0x3c87('0x35'));}if(_0xbed94c[_0x3c87('0xb')]>0x0){return manageTags(_0x45bbc4,_0xbed94c,_0x1377d9,_0x2900d1,_0x17b861,_0x220047,_0x10ddb8)[_0x3c87('0xa')](function(){_0x93415e(_0x17b861);});}else{_0x93415e(_0x17b861);}});};}function emit(_0x37fce5,_0x2e604c,_0x1446a6){var _0xbd7af8=_0x3c87('0x4a')+_0x3c87('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x3c87('0x4c');var _0x1b6929={'uri':_0x37fce5+_0x3c87('0x4d')+_0x1446a6+_0xbd7af8};io['to'](util[_0x3c87('0x4e')](_0x3c87('0x4f'),_0x2e604c))[_0x3c87('0x50')](_0x3c87('0x51'),_0x1b6929);}exports['cs']=function(_0x6a1b2f,_0x324bf2,_0x1e5e53,_0x21693a,_0x19ddf7,_0x4b0bf2,_0xbd4b34,_0xb92331){var _0xf2e27c={};var _0x1b1519={'user':_0x4b0bf2['username'],'pass':_0x4b0bf2[_0x3c87('0x52')]};var _0x2aba53='sysparm_limit=1';var _0x5f1db2=_0x3c87('0x53');_0x4b0bf2[_0x3c87('0x54')]=intUtil[_0x3c87('0x55')](_0x4b0bf2[_0x3c87('0x54')]);_0x4b0bf2['serverUrl']=intUtil[_0x3c87('0x55')](_0x4b0bf2[_0x3c87('0x56')]);var _0x2ee028=util['format']('%s/api/now/table/',_0x4b0bf2[_0x3c87('0x54')]);_0xf2e27c[_0x3c87('0x16')]=!_[_0x3c87('0x57')](_0x21693a)?_0x21693a[_0x3c87('0x58')]:null;_0xf2e27c[_0x3c87('0x1b')]=_0x4b0bf2[_0x3c87('0x58')];_0xf2e27c['endUserNumber']=_0xb92331[_0x3c87('0x2c')]()===_0x3c87('0x37')?_0x324bf2[_0x3c87('0x59')]:_0x324bf2['calleridnum'];_0xf2e27c[_0x3c87('0x5a')]=_0xb92331==='queue'||_0xb92331===_0x3c87('0x5b')?_0x3c87('0x5c'):_0x3c87('0x37');var _0x16ff85=util[_0x3c87('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b0bf2['serverUrl'],_0x324bf2[_0x3c87('0x5d')],md5(_0x324bf2[_0x3c87('0x5d')]));if(_0x19ddf7&&_0x19ddf7[_0x3c87('0x5e')]){logger[_0x3c87('0xf')]('[QUEUE]',_0x3c87('0x5f'));_0x324bf2[_0x3c87('0x60')]=_0x16ff85;}else if(_0xbd4b34&&_0xbd4b34[_0x3c87('0x61')]&&_0xbd4b34['recordingFormat']!==_0x3c87('0x62')){logger[_0x3c87('0xf')](_0x3c87('0x63'),_0x3c87('0x5f'));_0x324bf2[_0x3c87('0x60')]=_0x16ff85;}else{_0x324bf2[_0x3c87('0x60')]='';}return getAdminUser(_0xb92331,_0x1b1519,_0xf2e27c,_0x2ee028,_0x5f1db2,_0x2aba53)[_0x3c87('0xa')](getUser(_0xb92331,_0x1b1519,_0x2ee028,_0x5f1db2,_0x2aba53))['then'](getEndUser(_0xb92331,_0x1b1519,_0x2ee028,_0x5f1db2,_0x2aba53))['then'](getTicket(_0xb92331,_0x1b1519,_0x2ee028,_0x1e5e53,_0x324bf2,_0x5f1db2))[_0x3c87('0xa')](function(_0x172d22){logger['info'](util['format'](_0x3c87('0x64'),_0x172d22[_0x3c87('0x3d')]));logger[_0x3c87('0xf')](util[_0x3c87('0x4e')](_0x3c87('0x65'),_0xb92331));if(_0xb92331!==_0x3c87('0x5b')){logger['info']('['+[_0xb92331[_0x3c87('0x10')]()]+']',_0x3c87('0x66'));emit(_0x4b0bf2['remoteUri'],_0x21693a[_0x3c87('0x35')],_0x172d22[_0x3c87('0x3d')]);}})[_0x3c87('0x11')](function(_0x358b54){logger[_0x3c87('0x12')]('['+[_0xb92331[_0x3c87('0x10')]()]+_0x3c87('0x67'),util[_0x3c87('0x68')](_0x358b54,{'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 5a50fd9..c6a1771 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 _0xa19d=['stringify','Calls','format','Basic\x20%s','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','user_id','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','forEach','type','string','customField','nameField','content','toString','push','variable','custom_fields','customVariable','Variable','toLowerCase','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','Fields','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','catch','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','idField','variableName','set_entry','JSON'];(function(_0x13c306,_0x41feda){var _0x16ab52=function(_0xa9b7f6){while(--_0xa9b7f6){_0x13c306['push'](_0x13c306['shift']());}};_0x16ab52(++_0x41feda);}(_0xa19d,0xd2));var _0xda19=function(_0x5ed38d,_0x4f2d06){_0x5ed38d=_0x5ed38d-0x0;var _0x55bb4b=_0xa19d[_0x5ed38d];return _0x55bb4b;};'use strict';var _=require(_0xda19('0x0'));var rp=require(_0xda19('0x1'));var BPromise=require(_0xda19('0x2'));var md5=require(_0xda19('0x3'));var util=require(_0xda19('0x4'));var Redis=require('ioredis');var intUtil=require(_0xda19('0x5'));var config=require('../../../../config/environment');var logger=require(_0xda19('0x6'))(_0xda19('0x7'));config[_0xda19('0x8')]=_[_0xda19('0x9')](config[_0xda19('0x8')],{'host':_0xda19('0xa'),'port':0x18eb});var io=require(_0xda19('0xb'))(new Redis(config['redis']));var def={'method':_0xda19('0xc'),'json':!![]};function emit(_0x4ef9df,_0x1dd5b8,_0x10bf2b){io['to'](_0x4ef9df)[_0xda19('0xd')](_0x1dd5b8,_0x10bf2b);}function getTicket(_0x3d25c4,_0x2653c8,_0x2cdb8b,_0x59f892,_0x41636f,_0xc542b0,_0x225991,_0x4820c2){logger[_0xda19('0xe')](_0xda19('0xf'));var _0xa2c19e=new Date();var _0x5b4bcf=[{'name':_0xda19('0x10'),'value':intUtil['getString'](_0x59f892['Subjects'],_0x41636f,'\x20')},{'name':_0xda19('0x11'),'value':_0x2653c8['id']},{'name':_0xda19('0x12'),'value':_0x2653c8['id']},{'name':_0xda19('0x13'),'value':intUtil[_0xda19('0x14')](_0x59f892[_0xda19('0x15')],_0x41636f,'\x0a')},{'name':_0xda19('0x16'),'value':_0xa2c19e[_0xda19('0x17')]()[_0xda19('0x18')](0x0,0x13)[_0xda19('0x19')]('T','\x20')},{'name':_0xda19('0x1a'),'value':'0'},{'name':_0xda19('0x1b'),'value':'15'},{'name':_0xda19('0x1c'),'value':_0x2cdb8b['id']},{'name':_0xda19('0x1d'),'value':_0xda19('0x1e')},{'name':_0xda19('0x1f'),'value':_0x2cdb8b[_0xda19('0x10')]},{'name':_0xda19('0x20'),'value':_0x4820c2}];if(_0xc542b0[_0xda19('0x21')]){_['forEach'](_0xc542b0,function(_0x284bd0){if(_0x41636f[_0x284bd0['variableName']]){_0x5b4bcf['push']({'name':_0x284bd0[_0xda19('0x22')],'value':_0x41636f[_0x284bd0[_0xda19('0x23')]]});}});}return request({'form':{'method':_0xda19('0x24'),'input_type':_0xda19('0x25'),'response_type':'JSON','rest_data':JSON[_0xda19('0x26')]({'session':_0x225991['id'],'module_name':_0xda19('0x27'),'name_value_list':_0x5b4bcf})}});}function getAuth(_0x498939){return util[_0xda19('0x28')](_0xda19('0x29'),new Buffer(_0x498939['apiKey']+':X')['toString'](_0xda19('0x2a')));}function getServerInfo(_0x1fe1ae){return request({'form':{'method':_0xda19('0x2b'),'input_type':_0xda19('0x25'),'response_type':_0xda19('0x25'),'rest_data':JSON['stringify']({'session':_0x1fe1ae['id']})}});}function getUser(_0x9cfbdf,_0x4226f,_0xd5aafc){if(!_[_0xda19('0x2c')](_0x4226f)){logger[_0xda19('0xe')](_0xda19('0x2d'),_0x4226f);return request({'form':{'method':_0xda19('0x2e'),'input_type':_0xda19('0x25'),'response_type':_0xda19('0x25'),'rest_data':JSON[_0xda19('0x26')]({'session':_0xd5aafc['id'],'module_name':'Employees','query':util['format'](_0xda19('0x2f'),_0x4226f),'order_by':'','offset':'0','select_fields':['id','name',_0xda19('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xda19('0x31')](function(_0x26ec4f){if(_0x26ec4f[_0xda19('0x32')][_0xda19('0x21')]){var _0x63b840=_[_0xda19('0x33')](_0x26ec4f[_0xda19('0x32')],function(_0xa83be8){return _0xa83be8[_0xda19('0x34')]['user_name']['value']===_0x4226f;});if(_0x63b840){logger[_0xda19('0xe')](_0xda19('0x35'));return BPromise['resolve']({'id':_0x63b840[_0xda19('0x34')]['id']['value'],'name':_0x63b840[_0xda19('0x34')][_0xda19('0x10')]['value']});}}logger[_0xda19('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xd5aafc[_0xda19('0x34')][_0xda19('0x36')][_0xda19('0x37')],'name':_0xd5aafc[_0xda19('0x34')][_0xda19('0x30')][_0xda19('0x37')]});});}else{logger['info'](_0xda19('0x38'));return BPromise[_0xda19('0x39')]({'id':_0xd5aafc[_0xda19('0x34')][_0xda19('0x36')][_0xda19('0x37')],'name':_0xd5aafc[_0xda19('0x34')][_0xda19('0x30')][_0xda19('0x37')]});}}function getEndUser(_0x5cc7bc,_0x29c436,_0x2e1132,_0x416074){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2e1132);return request({'form':{'method':_0xda19('0x2e'),'input_type':_0xda19('0x25'),'response_type':_0xda19('0x25'),'rest_data':JSON[_0xda19('0x26')]({'session':_0x416074['id'],'module_name':'Contacts','query':util[_0xda19('0x28')](_0xda19('0x3a'),_0x2e1132),'order_by':'','offset':'0','select_fields':['id',_0xda19('0x10'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x582503){if(_0x582503[_0xda19('0x32')]['length']){var _0x2882c0=_[_0xda19('0x33')](_0x582503['entry_list'],function(_0x51f39d){return _0x51f39d[_0xda19('0x34')][_0xda19('0x3b')]['value']===_0x2e1132;});if(_0x2882c0){logger[_0xda19('0xe')](_0xda19('0x3c'));return BPromise[_0xda19('0x39')]({'id':_0x2882c0[_0xda19('0x34')]['id'][_0xda19('0x37')],'name':_0x2882c0['name_value_list'][_0xda19('0x10')][_0xda19('0x37')],'phone':_0x2882c0[_0xda19('0x34')][_0xda19('0x3b')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xda19('0x24'),'input_type':_0xda19('0x25'),'response_type':_0xda19('0x25'),'rest_data':JSON[_0xda19('0x26')]({'session':_0x416074['id'],'module_name':_0xda19('0x1e'),'name_value_list':[{'name':'first_name','value':_0x29c436!==_0xda19('0x3d')?_0x29c436:util['format'](_0xda19('0x3e'),_0x2e1132)},{'name':_0xda19('0x3b'),'value':_0x2e1132}]})}})['then'](function(_0x4b44ab){logger[_0xda19('0xe')](_0xda19('0x3f'));return BPromise[_0xda19('0x39')]({'id':_0x4b44ab['id'],'name':_0x4b44ab[_0xda19('0x32')][_0xda19('0x40')][_0xda19('0x37')],'phone':_0x4b44ab[_0xda19('0x32')][_0xda19('0x3b')]['value']});});}});}function request(_0x36c3a3){logger[_0xda19('0x41')](_0xda19('0x42'),JSON['stringify'](_0x36c3a3));return rp(_['merge'](def,_0x36c3a3));}function getTags(_0x3ac9a3,_0x5a855b){var _0x32fa4f=[];if(_0x3ac9a3&&_0x3ac9a3['length']>0x0){_0x32fa4f=_['map'](_0x3ac9a3,_0x5a855b);}return _0x32fa4f;}function getCustomFields(_0x575020,_0x5091a5){var _0x2cd967=[];var _0x29a059={'custom_fields':[]};if(_0x575020[_0xda19('0x21')]>0x0){_[_0xda19('0x43')](_0x575020,function(_0x4eb6ad){if(_0x4eb6ad[_0xda19('0x44')]===_0xda19('0x45')&&_0x4eb6ad['nameField']&&!_0x4eb6ad[_0xda19('0x46')]){_0x29a059[_0x4eb6ad[_0xda19('0x47')]['toLowerCase']()]=_0x4eb6ad[_0xda19('0x48')][_0xda19('0x49')]();}else if(_0x4eb6ad[_0xda19('0x44')]==='string'&&_0x4eb6ad['idField']&&_0x4eb6ad[_0xda19('0x46')]){_0x29a059['custom_fields'][_0xda19('0x4a')]({'id':_0x4eb6ad[_0xda19('0x22')],'value':_0x4eb6ad[_0xda19('0x48')][_0xda19('0x49')]()});}else if(_0x4eb6ad[_0xda19('0x44')]===_0xda19('0x4b')&&_0x4eb6ad[_0xda19('0x23')]&&_0x4eb6ad[_0xda19('0x22')]&&_0x4eb6ad[_0xda19('0x46')]){_0x5091a5[_0x4eb6ad['variableName']]&&_0x29a059[_0xda19('0x4c')][_0xda19('0x4a')]({'id':_0x4eb6ad['idField'],'value':_0x5091a5[_0x4eb6ad[_0xda19('0x23')]]['toString']()});}else if(_0x4eb6ad[_0xda19('0x44')]===_0xda19('0x4d')&&_0x4eb6ad[_0xda19('0x4e')]&&_0x4eb6ad[_0xda19('0x4e')][_0xda19('0x10')]&&_0x4eb6ad[_0xda19('0x22')]&&_0x4eb6ad[_0xda19('0x46')]){_0x5091a5[_0x4eb6ad[_0xda19('0x4e')][_0xda19('0x10')][_0xda19('0x4f')]()]&&_0x29a059[_0xda19('0x4c')][_0xda19('0x4a')]({'id':_0x4eb6ad[_0xda19('0x22')],'value':_0x5091a5[_0x4eb6ad['Variable']['name']['toLowerCase']()][_0xda19('0x49')]()});}});}return _0x29a059;}function getConnection(_0x594fdd){return request({'method':_0xda19('0xc'),'form':{'method':'login','input_type':_0xda19('0x25'),'response_type':_0xda19('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x594fdd[_0xda19('0x50')],'password':_0x594fdd[_0xda19('0x51')],'encryption':_0xda19('0x52')},'application':_0xda19('0x53')})}})[_0xda19('0x31')](function(_0x526c26){var _0x3125ef=_0x526c26;if(_0x3125ef['id']){def[_0xda19('0x54')]=_0x3125ef['id'];return BPromise['resolve'](_0x3125ef);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x594fdd['id']));}});}function setRelationship(_0x4a2245,_0x1ad85b,_0x36c7c6,_0x4871e0){return request({'form':{'method':_0xda19('0x55'),'input_type':_0xda19('0x25'),'response_type':_0xda19('0x25'),'rest_data':JSON['stringify']({'session':_0x4a2245['id'],'module_name':_0xda19('0x27'),'module_id':_0x36c7c6['id'],'link_field_name':_0x4871e0,'related_ids':[_0x1ad85b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xda19('0x56')]=function(_0x2a0f7b,_0x180f18,_0x528002,_0xc977b,_0x3f5003,_0x28af2c){var _0x244cc2,_0x58fa39,_0x33feb9,_0x4f490a;_0x28af2c[_0xda19('0x57')]=intUtil[_0xda19('0x58')](_0x28af2c[_0xda19('0x57')]);_0x28af2c[_0xda19('0x59')]=intUtil['stripTrailingSlash'](_0x28af2c['serverUrl']);def[_0xda19('0x5a')]=util['format'](_0xda19('0x5b'),_0x28af2c[_0xda19('0x57')]);if(_0x3f5003&&_0x3f5003[_0xda19('0x5c')]){logger[_0xda19('0xe')](_0xda19('0x5d'),_0xda19('0x5e'));_0x180f18[_0xda19('0x5f')]=util[_0xda19('0x28')](_0xda19('0x60'),_0x28af2c[_0xda19('0x59')],_0x180f18['uniqueid'],md5(_0x180f18[_0xda19('0x61')]));}else{_0x180f18['recordingURL']='';}return getConnection(_0x28af2c)[_0xda19('0x31')](function(_0x4b962b){_0x4f490a=_0x4b962b;return getUser(_0x28af2c,_0xc977b['name'],_0x4f490a);})['then'](function(_0x33db5d){_0x244cc2=_0x33db5d;logger[_0xda19('0xe')]('The\x20User\x20ID\x20is:',_0x244cc2['id']);return getEndUser(_0x28af2c,_0x180f18[_0xda19('0x62')],_0x180f18[_0xda19('0x63')],_0x4f490a);})['then'](function(_0x3fad9b){_0x58fa39=_0x3fad9b;logger['info'](_0xda19('0x64'),_0x58fa39['id']);return getTicket(_0x28af2c,_0x244cc2,_0x58fa39,_0x528002,_0x180f18,_0x528002['Fields'],_0x4f490a,_0xda19('0x65'));})[_0xda19('0x31')](function(_0x50effa){_0x33feb9=_0x50effa;logger[_0xda19('0xe')](_0xda19('0x66'));logger[_0xda19('0xe')](_0xda19('0x67'),_0x33feb9['id']);return setRelationship(_0x4f490a,_0x244cc2,_0x33feb9,_0xda19('0x68'));})[_0xda19('0x31')](function(){return setRelationship(_0x4f490a,_0x58fa39,_0x33feb9,_0xda19('0x69'));})[_0xda19('0x31')](function(){return getServerInfo(_0x4f490a);})['then'](function(_0x21be9d){var _0x23d12d=parseInt(_0x21be9d[_0xda19('0x6a')][_0xda19('0x6b')](0x0));var _0xa4ed51=util[_0xda19('0x28')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x28af2c[_0xda19('0x57')],_0x33feb9['id']);if(_0x23d12d>0x6){_0xa4ed51=util['format'](_0xda19('0x6c'),_0x28af2c[_0xda19('0x57')],_0x33feb9['id']);}logger[_0xda19('0xe')](_0xda19('0x5d'),_0xda19('0x6d'));emit(util['format'](_0xda19('0x6e'),_0xc977b['name']),_0xda19('0x6f'),{'uri':_0xa4ed51});})['catch'](function(_0x5979b9){logger[_0xda19('0x70')](_0xda19('0x5d'),JSON['stringify'](_0x5979b9));});};exports[_0xda19('0x71')]=function(_0x4f59e2,_0x300e65,_0x179910,_0x3e06b3,_0x40e6ef,_0x39fb7d,_0x35c2ed){var _0x1bbfcb,_0xbbd7b,_0x2a21f8,_0x18a81b;_0x39fb7d[_0xda19('0x57')]=intUtil['stripTrailingSlash'](_0x39fb7d['remoteUri']);_0x39fb7d[_0xda19('0x59')]=intUtil[_0xda19('0x58')](_0x39fb7d[_0xda19('0x59')]);def['uri']=util[_0xda19('0x28')](_0xda19('0x5b'),_0x39fb7d[_0xda19('0x57')]);if(_0x35c2ed&&_0x35c2ed['recordingFormat']&&_0x35c2ed[_0xda19('0x72')]!==_0xda19('0x73')){logger[_0xda19('0xe')](_0xda19('0x74'),_0xda19('0x5e'));_0x300e65[_0xda19('0x5f')]=util['format'](_0xda19('0x60'),_0x39fb7d[_0xda19('0x59')],_0x300e65[_0xda19('0x61')],md5(_0x300e65[_0xda19('0x61')]));}return getConnection(_0x39fb7d)['then'](function(_0x20527c){_0x18a81b=_0x20527c;return getUser(_0x39fb7d,_0x3e06b3['name'],_0x18a81b);})[_0xda19('0x31')](function(_0x3b2cc0){_0x1bbfcb=_0x3b2cc0;logger[_0xda19('0xe')](_0xda19('0x75'),_0x1bbfcb['id']);return getEndUser(_0x39fb7d,_0x300e65['destcalleridname'],_0x300e65['destcalleridnum'],_0x18a81b);})[_0xda19('0x31')](function(_0x101e99){_0xbbd7b=_0x101e99;logger[_0xda19('0xe')](_0xda19('0x64'),_0xbbd7b['id']);return getTicket(_0x39fb7d,_0x1bbfcb,_0xbbd7b,_0x179910,_0x300e65,_0x179910[_0xda19('0x76')],_0x18a81b,_0xda19('0x77'));})[_0xda19('0x31')](function(_0xab594a){_0x2a21f8=_0xab594a;logger[_0xda19('0xe')](_0xda19('0x66'));logger[_0xda19('0xe')](_0xda19('0x67'),_0x2a21f8['id']);return setRelationship(_0x18a81b,_0x1bbfcb,_0x2a21f8,'users');})[_0xda19('0x31')](function(){return setRelationship(_0x18a81b,_0xbbd7b,_0x2a21f8,_0xda19('0x69'));})['then'](function(){return getServerInfo(_0x18a81b);})[_0xda19('0x31')](function(_0x3b03aa){var _0x38312e=parseInt(_0x3b03aa[_0xda19('0x6a')][_0xda19('0x6b')](0x0));var _0x49fca3=util[_0xda19('0x28')](_0xda19('0x78'),_0x39fb7d['remoteUri'],_0x2a21f8['id']);if(_0x38312e>0x6){_0x49fca3=util['format'](_0xda19('0x6c'),_0x39fb7d[_0xda19('0x57')],_0x2a21f8['id']);}logger[_0xda19('0xe')](_0xda19('0x74'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xda19('0x28')](_0xda19('0x6e'),_0x3e06b3[_0xda19('0x10')]),'trigger:browser:url',{'uri':_0x49fca3});})[_0xda19('0x79')](function(_0x2cb2a9){logger[_0xda19('0x70')]('[OUTBOUND]',JSON['stringify'](_0x2cb2a9));});};exports['unmanaged']=function(_0x341da9,_0x37febe,_0x116774,_0x5cc819,_0x334b91,_0x5adbd1){var _0x6eea93,_0x2b9061,_0x43d109,_0x6967ff;_0x5adbd1[_0xda19('0x57')]=intUtil[_0xda19('0x58')](_0x5adbd1['remoteUri']);_0x5adbd1[_0xda19('0x59')]=intUtil[_0xda19('0x58')](_0x5adbd1[_0xda19('0x59')]);def[_0xda19('0x5a')]=util[_0xda19('0x28')](_0xda19('0x5b'),_0x5adbd1[_0xda19('0x57')]);if(_0x334b91&&_0x334b91[_0xda19('0x5c')]){logger['info']('['+_0x37febe[_0xda19('0x7a')][_0xda19('0x7b')]()+']',_0xda19('0x5e'));_0x37febe[_0xda19('0x5f')]=util[_0xda19('0x28')](_0xda19('0x60'),_0x5adbd1[_0xda19('0x59')],_0x37febe[_0xda19('0x61')],md5(_0x37febe[_0xda19('0x61')]));}else{_0x37febe['recordingURL']='';}return getConnection(_0x5adbd1)[_0xda19('0x31')](function(_0x880cee){_0x6967ff=_0x880cee;if(!_[_0xda19('0x2c')](_0x5cc819)){return getUser(_0x5adbd1,_0x5cc819[_0xda19('0x10')],_0x6967ff);}else{return getUser(_0x5adbd1,null,_0x6967ff);}})[_0xda19('0x31')](function(_0x33a414){_0x6eea93=_0x33a414;logger['info'](_0xda19('0x75'),_0x6eea93['id']);return getEndUser(_0x5adbd1,_0x37febe[_0xda19('0x62')],_0x37febe[_0xda19('0x63')],_0x6967ff);})[_0xda19('0x31')](function(_0x1f38a1){_0x2b9061=_0x1f38a1;logger[_0xda19('0xe')]('The\x20Enduser\x20ID\x20is:',_0x2b9061['id']);return getTicket(_0x5adbd1,_0x6eea93,_0x2b9061,_0x116774,_0x37febe,_0x116774[_0xda19('0x76')],_0x6967ff,_0xda19('0x65'));})[_0xda19('0x31')](function(_0x3175ee){_0x43d109=_0x3175ee;logger[_0xda19('0xe')](_0xda19('0x66'));logger[_0xda19('0xe')]('The\x20Ticket\x20ID\x20is:',_0x43d109['id']);return setRelationship(_0x6967ff,_0x6eea93,_0x43d109,'users');})[_0xda19('0x31')](function(){return setRelationship(_0x6967ff,_0x2b9061,_0x43d109,_0xda19('0x69'));})['then'](function(){return getServerInfo(_0x6967ff);})[_0xda19('0x79')](function(_0xa57e3e){logger['error']('['+_0x37febe[_0xda19('0x7a')]['toUpperCase']()+']',JSON[_0xda19('0x26')](_0xa57e3e));});}; \ No newline at end of file +var _0x1726=['INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','content','toString','idField','push','custom_fields','Variable','toLowerCase','login','username','password','PLAIN','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','The\x20Ticket\x20ID\x20is:','contacts','user:%s','trigger:browser:url','catch','error','uri','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','name','Subjects','created_by','getString','Descriptions','toISOString','replace','parent_id','direction','length','forEach','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','isNil','Getting\x20agent\x20with\x20name','Employees'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x1726,0x18d));var _0x6172=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x1726[_0x2962b4];return _0x411b7d;};'use strict';var _=require('lodash');var rp=require(_0x6172('0x0'));var BPromise=require('bluebird');var md5=require(_0x6172('0x1'));var util=require(_0x6172('0x2'));var Redis=require(_0x6172('0x3'));var intUtil=require('./util');var config=require(_0x6172('0x4'));var logger=require(_0x6172('0x5'))(_0x6172('0x6'));config[_0x6172('0x7')]=_['defaults'](config[_0x6172('0x7')],{'host':_0x6172('0x8'),'port':0x18eb});var io=require(_0x6172('0x9'))(new Redis(config['redis']));var def={'method':_0x6172('0xa'),'json':!![]};function emit(_0x2dd653,_0x41b12e,_0x1c41d1){io['to'](_0x2dd653)[_0x6172('0xb')](_0x41b12e,_0x1c41d1);}function getTicket(_0x63c91d,_0x444282,_0x780492,_0x8d6e8b,_0x3746d4,_0x29992b,_0xe02be,_0x429758){logger[_0x6172('0xc')]('Creating\x20new\x20ticket...');var _0x3dcf64=new Date();var _0x36e292=[{'name':_0x6172('0xd'),'value':intUtil['getString'](_0x8d6e8b[_0x6172('0xe')],_0x3746d4,'\x20')},{'name':'assigned_user_id','value':_0x444282['id']},{'name':_0x6172('0xf'),'value':_0x444282['id']},{'name':'description','value':intUtil[_0x6172('0x10')](_0x8d6e8b[_0x6172('0x11')],_0x3746d4,'\x0a')},{'name':'date_start','value':_0x3dcf64[_0x6172('0x12')]()['slice'](0x0,0x13)[_0x6172('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x6172('0x14'),'value':_0x780492['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x780492[_0x6172('0xd')]},{'name':_0x6172('0x15'),'value':_0x429758}];if(_0x29992b[_0x6172('0x16')]){_[_0x6172('0x17')](_0x29992b,function(_0xc1d603){if(_0x3746d4[_0xc1d603[_0x6172('0x18')]]){_0x36e292['push']({'name':_0xc1d603['idField'],'value':_0x3746d4[_0xc1d603[_0x6172('0x18')]]});}});}return request({'form':{'method':_0x6172('0x19'),'input_type':_0x6172('0x1a'),'response_type':_0x6172('0x1a'),'rest_data':JSON[_0x6172('0x1b')]({'session':_0xe02be['id'],'module_name':_0x6172('0x1c'),'name_value_list':_0x36e292})}});}function getAuth(_0x3345f9){return util[_0x6172('0x1d')](_0x6172('0x1e'),new Buffer(_0x3345f9[_0x6172('0x1f')]+':X')['toString']('base64'));}function getServerInfo(_0x2ecb55){return request({'form':{'method':'get_server_info','input_type':_0x6172('0x1a'),'response_type':_0x6172('0x1a'),'rest_data':JSON[_0x6172('0x1b')]({'session':_0x2ecb55['id']})}});}function getUser(_0x33d0c0,_0x51320e,_0x29b9d0){if(!_[_0x6172('0x20')](_0x51320e)){logger[_0x6172('0xc')](_0x6172('0x21'),_0x51320e);return request({'form':{'method':'get_entry_list','input_type':_0x6172('0x1a'),'response_type':_0x6172('0x1a'),'rest_data':JSON[_0x6172('0x1b')]({'session':_0x29b9d0['id'],'module_name':_0x6172('0x22'),'query':util[_0x6172('0x1d')](_0x6172('0x23'),_0x51320e),'order_by':'','offset':'0','select_fields':['id','name',_0x6172('0x24')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1a5e3c){if(_0x1a5e3c['entry_list'][_0x6172('0x16')]){var _0x1350c2=_[_0x6172('0x25')](_0x1a5e3c[_0x6172('0x26')],function(_0x2c3ef5){return _0x2c3ef5[_0x6172('0x27')][_0x6172('0x24')][_0x6172('0x28')]===_0x51320e;});if(_0x1350c2){logger['info'](_0x6172('0x29'));return BPromise[_0x6172('0x2a')]({'id':_0x1350c2['name_value_list']['id'][_0x6172('0x28')],'name':_0x1350c2['name_value_list'][_0x6172('0xd')][_0x6172('0x28')]});}}logger[_0x6172('0xc')](_0x6172('0x2b'));return BPromise[_0x6172('0x2a')]({'id':_0x29b9d0[_0x6172('0x27')][_0x6172('0x2c')][_0x6172('0x28')],'name':_0x29b9d0[_0x6172('0x27')][_0x6172('0x24')][_0x6172('0x28')]});});}else{logger[_0x6172('0xc')](_0x6172('0x2d'));return BPromise['resolve']({'id':_0x29b9d0[_0x6172('0x27')]['user_id']['value'],'name':_0x29b9d0[_0x6172('0x27')][_0x6172('0x24')][_0x6172('0x28')]});}}function getEndUser(_0x85c558,_0x5219ea,_0x4568da,_0x3c001b){logger[_0x6172('0xc')](_0x6172('0x2e'),_0x4568da);return request({'form':{'method':'get_entry_list','input_type':_0x6172('0x1a'),'response_type':_0x6172('0x1a'),'rest_data':JSON[_0x6172('0x1b')]({'session':_0x3c001b['id'],'module_name':_0x6172('0x2f'),'query':util[_0x6172('0x1d')](_0x6172('0x30'),_0x4568da),'order_by':'','offset':'0','select_fields':['id','name',_0x6172('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x48480d){if(_0x48480d[_0x6172('0x26')][_0x6172('0x16')]){var _0x524a2b=_[_0x6172('0x25')](_0x48480d['entry_list'],function(_0x47b6a3){return _0x47b6a3[_0x6172('0x27')][_0x6172('0x31')][_0x6172('0x28')]===_0x4568da;});if(_0x524a2b){logger[_0x6172('0xc')](_0x6172('0x32'));return BPromise[_0x6172('0x2a')]({'id':_0x524a2b[_0x6172('0x27')]['id'][_0x6172('0x28')],'name':_0x524a2b['name_value_list'][_0x6172('0xd')][_0x6172('0x28')],'phone':_0x524a2b[_0x6172('0x27')][_0x6172('0x31')]['value']});}}else{logger['info'](_0x6172('0x33'));return request({'form':{'method':_0x6172('0x19'),'input_type':_0x6172('0x1a'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3c001b['id'],'module_name':_0x6172('0x2f'),'name_value_list':[{'name':'first_name','value':_0x5219ea!==''?_0x5219ea:util[_0x6172('0x1d')](_0x6172('0x34'),_0x4568da)},{'name':'phone_home','value':_0x4568da}]})}})[_0x6172('0x35')](function(_0x272a75){logger[_0x6172('0xc')](_0x6172('0x36'));return BPromise[_0x6172('0x2a')]({'id':_0x272a75['id'],'name':_0x272a75['entry_list']['first_name']['value'],'phone':_0x272a75[_0x6172('0x26')][_0x6172('0x31')]['value']});});}});}function request(_0x1e5edc){logger[_0x6172('0x37')](_0x6172('0x38'),JSON[_0x6172('0x1b')](_0x1e5edc));return rp(_['merge'](def,_0x1e5edc));}function getTags(_0x598ea3,_0x262fed){var _0xc68ace=[];if(_0x598ea3&&_0x598ea3[_0x6172('0x16')]>0x0){_0xc68ace=_[_0x6172('0x39')](_0x598ea3,_0x262fed);}return _0xc68ace;}function getCustomFields(_0x46914f,_0x3eed63){var _0x510581=[];var _0x3bbf70={'custom_fields':[]};if(_0x46914f['length']>0x0){_[_0x6172('0x17')](_0x46914f,function(_0x5056c4){if(_0x5056c4[_0x6172('0x3a')]===_0x6172('0x3b')&&_0x5056c4[_0x6172('0x3c')]&&!_0x5056c4[_0x6172('0x3d')]){_0x3bbf70[_0x5056c4[_0x6172('0x3c')]['toLowerCase']()]=_0x5056c4[_0x6172('0x3e')][_0x6172('0x3f')]();}else if(_0x5056c4[_0x6172('0x3a')]==='string'&&_0x5056c4[_0x6172('0x40')]&&_0x5056c4['customField']){_0x3bbf70['custom_fields'][_0x6172('0x41')]({'id':_0x5056c4[_0x6172('0x40')],'value':_0x5056c4[_0x6172('0x3e')]['toString']()});}else if(_0x5056c4[_0x6172('0x3a')]==='variable'&&_0x5056c4[_0x6172('0x18')]&&_0x5056c4[_0x6172('0x40')]&&_0x5056c4[_0x6172('0x3d')]){_0x3eed63[_0x5056c4[_0x6172('0x18')]]&&_0x3bbf70[_0x6172('0x42')][_0x6172('0x41')]({'id':_0x5056c4['idField'],'value':_0x3eed63[_0x5056c4[_0x6172('0x18')]][_0x6172('0x3f')]()});}else if(_0x5056c4[_0x6172('0x3a')]==='customVariable'&&_0x5056c4['Variable']&&_0x5056c4['Variable'][_0x6172('0xd')]&&_0x5056c4[_0x6172('0x40')]&&_0x5056c4['customField']){_0x3eed63[_0x5056c4[_0x6172('0x43')][_0x6172('0xd')][_0x6172('0x44')]()]&&_0x3bbf70[_0x6172('0x42')]['push']({'id':_0x5056c4[_0x6172('0x40')],'value':_0x3eed63[_0x5056c4[_0x6172('0x43')][_0x6172('0xd')][_0x6172('0x44')]()][_0x6172('0x3f')]()});}});}return _0x3bbf70;}function getConnection(_0x92190){return request({'method':'POST','form':{'method':_0x6172('0x45'),'input_type':_0x6172('0x1a'),'response_type':_0x6172('0x1a'),'rest_data':JSON[_0x6172('0x1b')]({'user_auth':{'user_name':_0x92190[_0x6172('0x46')],'password':_0x92190[_0x6172('0x47')],'encryption':_0x6172('0x48')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x6172('0x35')](function(_0x591531){var _0xc137d=_0x591531;if(_0xc137d['id']){def['sessionID']=_0xc137d['id'];return BPromise[_0x6172('0x2a')](_0xc137d);}else{throw new Error(util[_0x6172('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x92190['id']));}});}function setRelationship(_0x4e9777,_0x167637,_0x281915,_0xcea840){return request({'form':{'method':'set_relationship','input_type':_0x6172('0x1a'),'response_type':'JSON','rest_data':JSON[_0x6172('0x1b')]({'session':_0x4e9777['id'],'module_name':_0x6172('0x1c'),'module_id':_0x281915['id'],'link_field_name':_0xcea840,'related_ids':[_0x167637['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5a7f2f,_0x32c771,_0x44b5e2,_0x128bd3,_0x4821e2,_0x5b5aa4){var _0x7ed5d2,_0x5f02f1,_0x1be6b8,_0x5f530b;_0x5b5aa4[_0x6172('0x49')]=intUtil[_0x6172('0x4a')](_0x5b5aa4[_0x6172('0x49')]);_0x5b5aa4[_0x6172('0x4b')]=intUtil[_0x6172('0x4a')](_0x5b5aa4['serverUrl']);def['uri']=util[_0x6172('0x1d')](_0x6172('0x4c'),_0x5b5aa4[_0x6172('0x49')]);if(_0x4821e2&&_0x4821e2['monitor_format']){logger[_0x6172('0xc')](_0x6172('0x4d'),'Recording\x20is\x20enabled!');_0x32c771[_0x6172('0x4e')]=util[_0x6172('0x1d')](_0x6172('0x4f'),_0x5b5aa4[_0x6172('0x4b')],_0x32c771[_0x6172('0x50')],md5(_0x32c771[_0x6172('0x50')]));}else{_0x32c771[_0x6172('0x4e')]='';}return getConnection(_0x5b5aa4)[_0x6172('0x35')](function(_0x2dce79){_0x5f530b=_0x2dce79;return getUser(_0x5b5aa4,_0x128bd3[_0x6172('0xd')],_0x5f530b);})['then'](function(_0x2c9e59){_0x7ed5d2=_0x2c9e59;logger[_0x6172('0xc')](_0x6172('0x51'),_0x7ed5d2['id']);return getEndUser(_0x5b5aa4,_0x32c771[_0x6172('0x52')],_0x32c771['calleridnum'],_0x5f530b);})[_0x6172('0x35')](function(_0x49ca4c){_0x5f02f1=_0x49ca4c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5f02f1['id']);return getTicket(_0x5b5aa4,_0x7ed5d2,_0x5f02f1,_0x44b5e2,_0x32c771,_0x44b5e2[_0x6172('0x53')],_0x5f530b,_0x6172('0x54'));})[_0x6172('0x35')](function(_0x2d7c4e){_0x1be6b8=_0x2d7c4e;logger[_0x6172('0xc')]('Ticket\x20created!');logger['info'](_0x6172('0x55'),_0x1be6b8['id']);return setRelationship(_0x5f530b,_0x7ed5d2,_0x1be6b8,'users');})[_0x6172('0x35')](function(){return setRelationship(_0x5f530b,_0x5f02f1,_0x1be6b8,_0x6172('0x56'));})[_0x6172('0x35')](function(){return getServerInfo(_0x5f530b);})[_0x6172('0x35')](function(_0x18ac13){var _0x34b405=parseInt(_0x18ac13['version']['charAt'](0x0));var _0x481c7d=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5b5aa4[_0x6172('0x49')],_0x1be6b8['id']);if(_0x34b405>0x6){_0x481c7d=util[_0x6172('0x1d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5b5aa4[_0x6172('0x49')],_0x1be6b8['id']);}logger['info'](_0x6172('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6172('0x1d')](_0x6172('0x57'),_0x128bd3['name']),_0x6172('0x58'),{'uri':_0x481c7d});})[_0x6172('0x59')](function(_0x484de6){logger[_0x6172('0x5a')]('[QUEUE]',JSON[_0x6172('0x1b')](_0x484de6));});};exports['outbound']=function(_0x256a44,_0x534cfc,_0x197850,_0xe853a3,_0x1125a1,_0x6ef6be,_0x149fc9){var _0xfc9a1a,_0x452d66,_0xd3f3a5,_0x6c43ff;_0x6ef6be[_0x6172('0x49')]=intUtil[_0x6172('0x4a')](_0x6ef6be[_0x6172('0x49')]);_0x6ef6be[_0x6172('0x4b')]=intUtil['stripTrailingSlash'](_0x6ef6be[_0x6172('0x4b')]);def[_0x6172('0x5b')]=util['format'](_0x6172('0x4c'),_0x6ef6be['remoteUri']);if(_0x149fc9&&_0x149fc9['recordingFormat']&&_0x149fc9['recordingFormat']!=='none'){logger[_0x6172('0xc')](_0x6172('0x5c'),_0x6172('0x5d'));_0x534cfc[_0x6172('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6ef6be[_0x6172('0x4b')],_0x534cfc['uniqueid'],md5(_0x534cfc[_0x6172('0x50')]));}return getConnection(_0x6ef6be)[_0x6172('0x35')](function(_0xf10dfc){_0x6c43ff=_0xf10dfc;return getUser(_0x6ef6be,_0xe853a3[_0x6172('0xd')],_0x6c43ff);})['then'](function(_0x4a5f78){_0xfc9a1a=_0x4a5f78;logger[_0x6172('0xc')](_0x6172('0x51'),_0xfc9a1a['id']);return getEndUser(_0x6ef6be,_0x534cfc[_0x6172('0x5e')],_0x534cfc[_0x6172('0x5f')],_0x6c43ff);})['then'](function(_0x174cd9){_0x452d66=_0x174cd9;logger['info'](_0x6172('0x60'),_0x452d66['id']);return getTicket(_0x6ef6be,_0xfc9a1a,_0x452d66,_0x197850,_0x534cfc,_0x197850['Fields'],_0x6c43ff,_0x6172('0x61'));})['then'](function(_0x53b508){_0xd3f3a5=_0x53b508;logger[_0x6172('0xc')](_0x6172('0x62'));logger[_0x6172('0xc')](_0x6172('0x55'),_0xd3f3a5['id']);return setRelationship(_0x6c43ff,_0xfc9a1a,_0xd3f3a5,'users');})['then'](function(){return setRelationship(_0x6c43ff,_0x452d66,_0xd3f3a5,_0x6172('0x56'));})[_0x6172('0x35')](function(){return getServerInfo(_0x6c43ff);})[_0x6172('0x35')](function(_0x141e02){var _0x24eca2=parseInt(_0x141e02[_0x6172('0x63')][_0x6172('0x64')](0x0));var _0x588a24=util[_0x6172('0x1d')](_0x6172('0x65'),_0x6ef6be[_0x6172('0x49')],_0xd3f3a5['id']);if(_0x24eca2>0x6){_0x588a24=util[_0x6172('0x1d')](_0x6172('0x66'),_0x6ef6be['remoteUri'],_0xd3f3a5['id']);}logger['info'](_0x6172('0x5c'),_0x6172('0x67'));emit(util[_0x6172('0x1d')](_0x6172('0x57'),_0xe853a3[_0x6172('0xd')]),_0x6172('0x58'),{'uri':_0x588a24});})[_0x6172('0x59')](function(_0x439cd0){logger['error'](_0x6172('0x5c'),JSON['stringify'](_0x439cd0));});};exports[_0x6172('0x68')]=function(_0x43b704,_0xc7252e,_0x4128b8,_0x1b0f5e,_0xa1b3ed,_0x519963){var _0x39e71b,_0x13e7a9,_0x324966,_0x11d70a;_0x519963[_0x6172('0x49')]=intUtil[_0x6172('0x4a')](_0x519963[_0x6172('0x49')]);_0x519963[_0x6172('0x4b')]=intUtil[_0x6172('0x4a')](_0x519963[_0x6172('0x4b')]);def[_0x6172('0x5b')]=util['format'](_0x6172('0x4c'),_0x519963[_0x6172('0x49')]);if(_0xa1b3ed&&_0xa1b3ed[_0x6172('0x69')]){logger[_0x6172('0xc')]('['+_0xc7252e[_0x6172('0x6a')][_0x6172('0x6b')]()+']',_0x6172('0x5d'));_0xc7252e[_0x6172('0x4e')]=util['format'](_0x6172('0x4f'),_0x519963['serverUrl'],_0xc7252e['uniqueid'],md5(_0xc7252e[_0x6172('0x50')]));}else{_0xc7252e[_0x6172('0x4e')]='';}return getConnection(_0x519963)[_0x6172('0x35')](function(_0x22fd8f){_0x11d70a=_0x22fd8f;if(!_[_0x6172('0x20')](_0x1b0f5e)){return getUser(_0x519963,_0x1b0f5e[_0x6172('0xd')],_0x11d70a);}else{return getUser(_0x519963,null,_0x11d70a);}})[_0x6172('0x35')](function(_0x18358e){_0x39e71b=_0x18358e;logger[_0x6172('0xc')](_0x6172('0x51'),_0x39e71b['id']);return getEndUser(_0x519963,_0xc7252e[_0x6172('0x52')],_0xc7252e['calleridnum'],_0x11d70a);})['then'](function(_0x2aabf3){_0x13e7a9=_0x2aabf3;logger['info'](_0x6172('0x60'),_0x13e7a9['id']);return getTicket(_0x519963,_0x39e71b,_0x13e7a9,_0x4128b8,_0xc7252e,_0x4128b8['Fields'],_0x11d70a,_0x6172('0x54'));})[_0x6172('0x35')](function(_0x5232af){_0x324966=_0x5232af;logger[_0x6172('0xc')](_0x6172('0x62'));logger['info'](_0x6172('0x55'),_0x324966['id']);return setRelationship(_0x11d70a,_0x39e71b,_0x324966,'users');})['then'](function(){return setRelationship(_0x11d70a,_0x13e7a9,_0x324966,'contacts');})[_0x6172('0x35')](function(){return getServerInfo(_0x11d70a);})[_0x6172('0x59')](function(_0x26017c){logger[_0x6172('0x5a')]('['+_0xc7252e[_0x6172('0x6a')][_0x6172('0x6b')]()+']',JSON[_0x6172('0x1b')](_0x26017c));});}; \ 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 ac70d6d..b7abc63 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 _0x06af=['keyContent','key','format','%s:\x20%s','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','keyType'];(function(_0x113791,_0x170a61){var _0xc95671=function(_0x407432){while(--_0x407432){_0x113791['push'](_0x113791['shift']());}};_0xc95671(++_0x170a61);}(_0x06af,0x97));var _0xf06a=function(_0x302116,_0x3ad4dd){_0x302116=_0x302116-0x0;var _0x435f1e=_0x06af[_0x302116];return _0x435f1e;};'use strict';var _=require(_0xf06a('0x0'));var util=require(_0xf06a('0x1'));exports[_0xf06a('0x2')]=function(_0x14f33e,_0x1e3e69,_0x1e8359){var _0x35f1a3=[];if(_0x14f33e[_0xf06a('0x3')]>0x0){var _0x182754=_[_0xf06a('0x4')](_0x14f33e,['id']);for(var _0x4d1ed0=0x0;_0x4d1ed0<_0x182754['length'];_0x4d1ed0++){var _0xa8e4bd=_0x182754[_0x4d1ed0];if(_0xa8e4bd[_0xf06a('0x5')]===_0xf06a('0x6')){_0x35f1a3[_0xf06a('0x7')](_0xa8e4bd['content']);}else if(_0xa8e4bd['type']===_0xf06a('0x8')&&_0xa8e4bd[_0xf06a('0x9')]){_0x1e3e69[_0xa8e4bd[_0xf06a('0x9')]]&&_0x35f1a3[_0xf06a('0x7')](_0x1e3e69[_0xa8e4bd['variableName']][_0xf06a('0xa')]());}else if(_0xa8e4bd[_0xf06a('0x5')]===_0xf06a('0xb')&&_0xa8e4bd['Variable']&&_0xa8e4bd['Variable'][_0xf06a('0xc')]){_0x1e3e69[_0xa8e4bd[_0xf06a('0xd')][_0xf06a('0xc')][_0xf06a('0xe')]()]&&_0x35f1a3[_0xf06a('0x7')](_0x1e3e69[_0xa8e4bd[_0xf06a('0xd')]['name'][_0xf06a('0xe')]()][_0xf06a('0xa')]());}else if(_0xa8e4bd[_0xf06a('0x5')]===_0xf06a('0xf')){if(_0xa8e4bd[_0xf06a('0x10')]==='string'&&_0xa8e4bd['key']){_0x35f1a3[_0xf06a('0x7')](util['format']('%s:\x20%s',_0xa8e4bd['key'],_0xa8e4bd[_0xf06a('0x11')]));}else if(_0xa8e4bd[_0xf06a('0x10')]==='variable'&&_0xa8e4bd['variableName']&&_0xa8e4bd[_0xf06a('0x12')]){_0x1e3e69[_0xa8e4bd[_0xf06a('0x9')]]&&_0x35f1a3[_0xf06a('0x7')](util[_0xf06a('0x13')](_0xf06a('0x14'),_0xa8e4bd[_0xf06a('0x12')],_0x1e3e69[_0xa8e4bd['variableName']]));}else if(_0xa8e4bd[_0xf06a('0x10')]===_0xf06a('0xb')&&_0xa8e4bd[_0xf06a('0xd')]&&_0xa8e4bd[_0xf06a('0xd')][_0xf06a('0xc')]&&_0xa8e4bd['key']){_0x1e3e69[_0xa8e4bd[_0xf06a('0xd')][_0xf06a('0xc')][_0xf06a('0xe')]()]&&_0x35f1a3[_0xf06a('0x7')](util['format'](_0xf06a('0x14'),_0xa8e4bd[_0xf06a('0x12')],_0x1e3e69[_0xa8e4bd[_0xf06a('0xd')][_0xf06a('0xc')][_0xf06a('0xe')]()]));}}}}return _0x35f1a3[_0xf06a('0x15')](_0x1e8359);};exports[_0xf06a('0x16')]=function(_0x3694cb){var _0x3860e0=_0x3694cb['slice'](-0x1);if(_0x3860e0==='/'){_0x3694cb=_0x3694cb[_0xf06a('0x17')](0x0,_0x3694cb[_0xf06a('0x18')](_0x3860e0));}return _0x3694cb;};exports[_0xf06a('0x19')]=function(_0x26ae36){if(!_[_0xf06a('0x1a')](_0x26ae36)&&_0x26ae36!==''){var _0x5de890=/^(([^<>()\[\]\\.,;:\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 _0x5de890[_0xf06a('0x1b')](String(_0x26ae36)[_0xf06a('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xb9fe=['keyContent','join','slice','substring','validateEmail','isNil','test','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s'];(function(_0x350396,_0x391ad2){var _0xf306b1=function(_0x3f2d38){while(--_0x3f2d38){_0x350396['push'](_0x350396['shift']());}};_0xf306b1(++_0x391ad2);}(_0xb9fe,0x13f));var _0xeb9f=function(_0x3ccd72,_0xabc472){_0x3ccd72=_0x3ccd72-0x0;var _0xa47846=_0xb9fe[_0x3ccd72];return _0xa47846;};'use strict';var _=require('lodash');var util=require('util');exports[_0xeb9f('0x0')]=function(_0x489817,_0x50bef1,_0x3dd6b7){var _0x5b7290=[];if(_0x489817[_0xeb9f('0x1')]>0x0){var _0x260ee1=_[_0xeb9f('0x2')](_0x489817,['id']);for(var _0x3688cd=0x0;_0x3688cd<_0x260ee1[_0xeb9f('0x1')];_0x3688cd++){var _0x29bc95=_0x260ee1[_0x3688cd];if(_0x29bc95[_0xeb9f('0x3')]===_0xeb9f('0x4')){_0x5b7290[_0xeb9f('0x5')](_0x29bc95[_0xeb9f('0x6')]);}else if(_0x29bc95[_0xeb9f('0x3')]===_0xeb9f('0x7')&&_0x29bc95[_0xeb9f('0x8')]){_0x50bef1[_0x29bc95[_0xeb9f('0x8')]]&&_0x5b7290['push'](_0x50bef1[_0x29bc95[_0xeb9f('0x8')]][_0xeb9f('0x9')]());}else if(_0x29bc95[_0xeb9f('0x3')]===_0xeb9f('0xa')&&_0x29bc95[_0xeb9f('0xb')]&&_0x29bc95['Variable']['name']){_0x50bef1[_0x29bc95[_0xeb9f('0xb')][_0xeb9f('0xc')][_0xeb9f('0xd')]()]&&_0x5b7290[_0xeb9f('0x5')](_0x50bef1[_0x29bc95[_0xeb9f('0xb')]['name']['toLowerCase']()]['toString']());}else if(_0x29bc95[_0xeb9f('0x3')]===_0xeb9f('0xe')){if(_0x29bc95[_0xeb9f('0xf')]==='string'&&_0x29bc95[_0xeb9f('0x10')]){_0x5b7290['push'](util[_0xeb9f('0x11')](_0xeb9f('0x12'),_0x29bc95[_0xeb9f('0x10')],_0x29bc95[_0xeb9f('0x13')]));}else if(_0x29bc95['keyType']===_0xeb9f('0x7')&&_0x29bc95[_0xeb9f('0x8')]&&_0x29bc95['key']){_0x50bef1[_0x29bc95[_0xeb9f('0x8')]]&&_0x5b7290[_0xeb9f('0x5')](util['format'](_0xeb9f('0x12'),_0x29bc95[_0xeb9f('0x10')],_0x50bef1[_0x29bc95['variableName']]));}else if(_0x29bc95[_0xeb9f('0xf')]===_0xeb9f('0xa')&&_0x29bc95[_0xeb9f('0xb')]&&_0x29bc95[_0xeb9f('0xb')][_0xeb9f('0xc')]&&_0x29bc95[_0xeb9f('0x10')]){_0x50bef1[_0x29bc95['Variable'][_0xeb9f('0xc')][_0xeb9f('0xd')]()]&&_0x5b7290[_0xeb9f('0x5')](util[_0xeb9f('0x11')](_0xeb9f('0x12'),_0x29bc95[_0xeb9f('0x10')],_0x50bef1[_0x29bc95[_0xeb9f('0xb')]['name'][_0xeb9f('0xd')]()]));}}}}return _0x5b7290[_0xeb9f('0x14')](_0x3dd6b7);};exports['stripTrailingSlash']=function(_0x13a782){var _0x5cc30b=_0x13a782[_0xeb9f('0x15')](-0x1);if(_0x5cc30b==='/'){_0x13a782=_0x13a782[_0xeb9f('0x16')](0x0,_0x13a782['lastIndexOf'](_0x5cc30b));}return _0x13a782;};exports[_0xeb9f('0x17')]=function(_0x5857d2){if(!_[_0xeb9f('0x18')](_0x5857d2)&&_0x5857d2!==''){var _0xec019b=/^(([^<>()\[\]\\.,;:\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 _0xec019b[_0xeb9f('0x19')](String(_0x5857d2)[_0xeb9f('0xd')]());}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 94a541e..90db638 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x4e8573,_0x12cc02){var _0x1113f5=function(_0x5bad6e){while(--_0x5bad6e){_0x4e8573['push'](_0x4e8573['shift']());}};_0x1113f5(++_0x12cc02);}(_0xe706,0xa3));var _0x6e70=function(_0x16cfb0,_0x28d646){_0x16cfb0=_0x16cfb0-0x0;var _0x3d8504=_0xe706[_0x16cfb0];return _0x3d8504;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x257a06,_0x1cc27a){var _0x32a15f=function(_0x52e878){while(--_0x52e878){_0x257a06['push'](_0x257a06['shift']());}};_0x32a15f(++_0x1cc27a);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 27edd8a..1733448 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 _0x6e44=['push','variableName','customVariable','Variable','name','toLowerCase','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','integrationTab','newTab','replace','/api/v2','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','getString','Descriptions','Fields','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','length','forEach','includes','string','type','nameField','content','idField','customField'];(function(_0x21a8b7,_0x58aa10){var _0x49fb89=function(_0xfb0a7e){while(--_0xfb0a7e){_0x21a8b7['push'](_0x21a8b7['shift']());}};_0x49fb89(++_0x58aa10);}(_0x6e44,0x17d));var _0x46e4=function(_0xa6e83b,_0x266b29){_0xa6e83b=_0xa6e83b-0x0;var _0x21d379=_0x6e44[_0xa6e83b];return _0x21d379;};'use strict';var _=require(_0x46e4('0x0'));var rp=require(_0x46e4('0x1'));var md5=require(_0x46e4('0x2'));var util=require(_0x46e4('0x3'));var Redis=require(_0x46e4('0x4'));var intUtil=require(_0x46e4('0x5'));var config=require('../../../../config/environment');var logger=require(_0x46e4('0x6'))(_0x46e4('0x7'));config[_0x46e4('0x8')]=_[_0x46e4('0x9')](config[_0x46e4('0x8')],{'host':_0x46e4('0xa'),'port':0x18eb});var io=require(_0x46e4('0xb'))(new Redis(config[_0x46e4('0x8')]));function emit(_0x440133,_0x537c28,_0x5847ed){io['to'](_0x440133)[_0x46e4('0xc')](_0x537c28,_0x5847ed);}var headers={'Content-Type':_0x46e4('0xd'),'Accept':_0x46e4('0xd')};function getTicket(_0x446fcb,_0x18e7eb,_0x35ef8b,_0x48426c,_0x14a527){logger[_0x46e4('0xe')](_0x46e4('0xf'));return request({'uri':util[_0x46e4('0x10')](_0x46e4('0x11'),_0x446fcb['remoteUri']),'method':'POST','body':{'ticket':_[_0x46e4('0x12')]({'requester_id':_0x35ef8b['id'],'submitter_id':_0x18e7eb?_0x18e7eb['id']:undefined,'assignee_id':_0x18e7eb?_0x18e7eb['id']:undefined,'tags':getTags(_0x48426c[_0x46e4('0x13')],'name'),'subject':intUtil['getString'](_0x48426c['Subjects'],_0x14a527,'\x20'),'description':intUtil[_0x46e4('0x14')](_0x48426c[_0x46e4('0x15')],_0x14a527,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x48426c['Descriptions'],_0x14a527,'\x0a')}},getCustomFields(_0x48426c[_0x46e4('0x16')],_0x14a527))}})['then'](function(_0x245f7d){logger['info'](_0x46e4('0x17'));return _0x245f7d['ticket'];});}function getUser(_0x2d4da0,_0x3f5e26){if(intUtil['validateEmail'](_0x3f5e26)){logger[_0x46e4('0xe')](_0x46e4('0x18'),_0x3f5e26);return request({'uri':util[_0x46e4('0x10')](_0x46e4('0x19'),_0x2d4da0[_0x46e4('0x1a')]),'qs':{'query':util[_0x46e4('0x10')](_0x46e4('0x1b'),_0x3f5e26)}})[_0x46e4('0x1c')](function(_0xd413e5){if(_0xd413e5[_0x46e4('0x1d')]){logger[_0x46e4('0xe')](_0x46e4('0x1e'));return _[_0x46e4('0x1f')](_0xd413e5[_0x46e4('0x20')],{'email':_0x3f5e26,'role':_0x46e4('0x21')});}else{logger[_0x46e4('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x46e4('0x10')](_0x46e4('0x22'),_0x2d4da0[_0x46e4('0x1a')])})[_0x46e4('0x1c')](function(_0x254dd8){logger[_0x46e4('0xe')](_0x46e4('0x23'));return _0x254dd8['user'];});}});}else{logger['info'](_0x46e4('0x24'));return request({'uri':util[_0x46e4('0x10')](_0x46e4('0x22'),_0x2d4da0[_0x46e4('0x1a')])})[_0x46e4('0x1c')](function(_0x32f73f){logger[_0x46e4('0xe')]('Admin\x20account\x20selected.');return _0x32f73f['user'];});}}function getEndUser(_0x55b405,_0x2b05e8,_0x4515c0){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4515c0);return request({'uri':util['format']('%s/search.json',_0x55b405['remoteUri']),'qs':{'query':util[_0x46e4('0x10')](_0x46e4('0x25'),_0x4515c0)}})[_0x46e4('0x1c')](function(_0x42416e){var _0x82fcd3;if(_0x42416e[_0x46e4('0x20')]['length']){_0x42416e[_0x46e4('0x20')]=_['filter'](_0x42416e['results'],{'suspended':![],'role':_0x46e4('0x26')});if(_0x42416e[_0x46e4('0x20')]['length']){_0x82fcd3=_['first'](_0x42416e[_0x46e4('0x20')]);}}if(_0x82fcd3){logger[_0x46e4('0xe')](_0x46e4('0x27'));return _0x82fcd3;}else{logger[_0x46e4('0xe')](_0x46e4('0x28'));return request({'uri':util[_0x46e4('0x10')](_0x46e4('0x29'),_0x55b405['remoteUri']),'method':'POST','body':{'user':{'role':_0x46e4('0x26'),'name':util[_0x46e4('0x10')]('Caller\x20-\x20%s',_0x2b05e8||_0x4515c0),'phone':_0x4515c0}}})[_0x46e4('0x1c')](function(_0xfa128d){logger[_0x46e4('0xe')](_0x46e4('0x2a'));return _0xfa128d['user'];});}});}function getAuth(_0x2efe4b){var _0x2e5ca7;if(_0x2efe4b[_0x46e4('0x2b')]===_0x46e4('0x2c')){_0x2e5ca7=util[_0x46e4('0x10')](_0x46e4('0x2d'),_0x2efe4b[_0x46e4('0x2e')],_0x2efe4b[_0x46e4('0x2c')]);}else if(_0x2efe4b[_0x46e4('0x2b')]===_0x46e4('0x2f')){_0x2e5ca7=util[_0x46e4('0x10')](_0x46e4('0x30'),_0x2efe4b[_0x46e4('0x2e')],_0x2efe4b['token']);}return util['format']('Basic\x20%s',new Buffer(_0x2e5ca7)[_0x46e4('0x31')](_0x46e4('0x32')));}function request(_0x5eeca2){logger[_0x46e4('0x33')](_0x46e4('0x34'),JSON[_0x46e4('0x35')](_0x5eeca2));return rp(_[_0x46e4('0x9')](_0x5eeca2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x575a77,_0x28937a){var _0x42a1ab=[];if(_0x575a77&&_0x575a77[_0x46e4('0x36')]>0x0){_0x42a1ab=_['map'](_0x575a77,_0x28937a);}return _0x42a1ab;}function getCustomFields(_0x332192,_0x4ffe1a){var _0x46a675=[];var _0x1242ec={'custom_fields':[]};if(_0x332192['length']>0x0){_[_0x46e4('0x37')](_0x332192,function(_0x398f94){if(_[_0x46e4('0x38')]([_0x46e4('0x39'),'picklist'],_0x398f94[_0x46e4('0x3a')])&&_0x398f94['nameField']&&!_0x398f94['customField']){_0x1242ec[_0x398f94[_0x46e4('0x3b')]['toLowerCase']()]=_0x398f94[_0x46e4('0x3c')]['toString']();}else if(_['includes']([_0x46e4('0x39'),'picklist'],_0x398f94[_0x46e4('0x3a')])&&_0x398f94[_0x46e4('0x3d')]&&_0x398f94[_0x46e4('0x3e')]){_0x1242ec['custom_fields'][_0x46e4('0x3f')]({'id':_0x398f94[_0x46e4('0x3d')],'value':_0x398f94['content'][_0x46e4('0x31')]()});}else if(_0x398f94['type']==='variable'&&_0x398f94[_0x46e4('0x40')]&&_0x398f94[_0x46e4('0x3d')]&&_0x398f94[_0x46e4('0x3e')]){_0x4ffe1a[_0x398f94[_0x46e4('0x40')]]&&_0x1242ec['custom_fields'][_0x46e4('0x3f')]({'id':_0x398f94[_0x46e4('0x3d')],'value':_0x4ffe1a[_0x398f94[_0x46e4('0x40')]][_0x46e4('0x31')]()});}else if(_0x398f94[_0x46e4('0x3a')]===_0x46e4('0x41')&&_0x398f94[_0x46e4('0x42')]&&_0x398f94[_0x46e4('0x42')][_0x46e4('0x43')]&&_0x398f94['idField']&&_0x398f94[_0x46e4('0x3e')]){_0x4ffe1a[_0x398f94['Variable'][_0x46e4('0x43')][_0x46e4('0x44')]()]&&_0x1242ec[_0x46e4('0x45')][_0x46e4('0x3f')]({'id':_0x398f94['idField'],'value':_0x4ffe1a[_0x398f94[_0x46e4('0x42')][_0x46e4('0x43')][_0x46e4('0x44')]()][_0x46e4('0x31')]()});}});}return _0x1242ec;}exports[_0x46e4('0x46')]=function(_0x3b2708,_0x5b3239,_0x239636,_0x5e878a,_0x3ef8c9,_0x289c85){var _0x6e044b,_0x3359ea;_0x289c85[_0x46e4('0x1a')]=intUtil[_0x46e4('0x47')](_0x289c85[_0x46e4('0x1a')]);_0x289c85[_0x46e4('0x48')]=intUtil['stripTrailingSlash'](_0x289c85['serverUrl']);if(_0x3ef8c9&&_0x3ef8c9[_0x46e4('0x49')]){logger['info']('[QUEUE]',_0x46e4('0x4a'));_0x5b3239[_0x46e4('0x4b')]=util[_0x46e4('0x10')](_0x46e4('0x4c'),_0x289c85[_0x46e4('0x48')],_0x5b3239['uniqueid'],md5(_0x5b3239['uniqueid']));}else{_0x5b3239[_0x46e4('0x4b')]='';}headers[_0x46e4('0x4d')]=getAuth(_0x289c85);return getUser(_0x289c85,_0x5e878a[_0x46e4('0x4e')])[_0x46e4('0x1c')](function(_0x46f977){_0x6e044b=_0x46f977;logger[_0x46e4('0xe')](_0x46e4('0x4f'),_0x6e044b['id']);return getEndUser(_0x289c85,_0x5b3239[_0x46e4('0x50')],_0x5b3239[_0x46e4('0x51')]);})[_0x46e4('0x1c')](function(_0x44f038){_0x3359ea=_0x44f038;logger[_0x46e4('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3359ea['id']);return getTicket(_0x289c85,_0x6e044b,_0x3359ea,_0x239636,_0x5b3239);})[_0x46e4('0x1c')](function(_0x299035){if(_0x299035){logger['info']('The\x20Ticket\x20ID\x20is:',_0x299035['id']);switch(_0x289c85[_0x46e4('0x3a')]){case'integrationTab':logger[_0x46e4('0xe')](_0x46e4('0x52'),_0x46e4('0x53'));return request({'uri':util['format'](_0x46e4('0x54'),_0x289c85[_0x46e4('0x1a')],_0x6e044b['id'],_0x299035['id']),'method':_0x46e4('0x55')});case'newTab':logger[_0x46e4('0xe')](_0x46e4('0x52'),_0x46e4('0x56'));emit(util[_0x46e4('0x10')](_0x46e4('0x57'),_0x5e878a[_0x46e4('0x43')]),_0x46e4('0x58'),{'uri':util[_0x46e4('0x10')](_0x46e4('0x59'),_0x289c85[_0x46e4('0x1a')]['replace']('/api/v2',''),_0x299035['id'])});break;default:logger['error']('[QUEUE]',_0x46e4('0x5a'));}}})[_0x46e4('0x5b')](function(_0x2b091e){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x46e4('0x5c')](_0x2b091e,{'showHidden':!![],'depth':null}));});};exports[_0x46e4('0x5d')]=function(_0x5edc62,_0x17ed5d,_0x3ff8fb,_0x259252,_0x3126e2,_0x497acd,_0x998ae8){var _0x354425,_0x423ca2;_0x497acd['remoteUri']=intUtil[_0x46e4('0x47')](_0x497acd[_0x46e4('0x1a')]);_0x497acd[_0x46e4('0x48')]=intUtil[_0x46e4('0x47')](_0x497acd[_0x46e4('0x48')]);if(_0x998ae8&&_0x998ae8[_0x46e4('0x5e')]&&_0x998ae8['recordingFormat']!=='none'){logger[_0x46e4('0xe')](_0x46e4('0x5f'),_0x46e4('0x4a'));_0x17ed5d['recordingURL']=util[_0x46e4('0x10')](_0x46e4('0x4c'),_0x497acd[_0x46e4('0x48')],_0x17ed5d[_0x46e4('0x60')],md5(_0x17ed5d['uniqueid']));}headers[_0x46e4('0x4d')]=getAuth(_0x497acd);return getUser(_0x497acd,_0x259252['email'])['then'](function(_0x18d5a9){_0x354425=_0x18d5a9;logger['info'](_0x46e4('0x4f'),_0x354425['id']);return getEndUser(_0x497acd,_0x17ed5d[_0x46e4('0x61')],_0x17ed5d[_0x46e4('0x62')]);})[_0x46e4('0x1c')](function(_0x593548){_0x423ca2=_0x593548;logger[_0x46e4('0xe')]('The\x20Enduser\x20ID\x20is:',_0x423ca2['id']);return getTicket(_0x497acd,_0x354425,_0x423ca2,_0x3ff8fb,_0x17ed5d);})[_0x46e4('0x1c')](function(_0x201162){if(_0x201162){logger[_0x46e4('0xe')]('The\x20Ticket\x20ID\x20is:',_0x201162['id']);switch(_0x497acd['type']){case _0x46e4('0x63'):logger[_0x46e4('0xe')](_0x46e4('0x5f'),_0x46e4('0x53'));return request({'uri':util[_0x46e4('0x10')](_0x46e4('0x54'),_0x497acd['remoteUri'],_0x354425['id'],_0x201162['id']),'method':'POST'});case _0x46e4('0x64'):logger[_0x46e4('0xe')](_0x46e4('0x5f'),_0x46e4('0x56'));emit(util[_0x46e4('0x10')](_0x46e4('0x57'),_0x259252[_0x46e4('0x43')]),_0x46e4('0x58'),{'uri':util[_0x46e4('0x10')]('%s/agent/tickets/%s',_0x497acd[_0x46e4('0x1a')][_0x46e4('0x65')](_0x46e4('0x66'),''),_0x201162['id'])});break;default:logger[_0x46e4('0x67')](_0x46e4('0x5f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x2ec616){logger['error'](_0x46e4('0x68'),util[_0x46e4('0x5c')](_0x2ec616,{'showHidden':!![],'depth':null}));});};exports[_0x46e4('0x69')]=function(_0x253388,_0x4a77d8,_0xd7a9cd,_0x1ee8b2,_0xf39058,_0x5908e2){var _0xac2c7f,_0x1ca6c9;_0x5908e2['remoteUri']=intUtil['stripTrailingSlash'](_0x5908e2[_0x46e4('0x1a')]);_0x5908e2[_0x46e4('0x48')]=intUtil[_0x46e4('0x47')](_0x5908e2[_0x46e4('0x48')]);if(_0xf39058&&_0xf39058['monitor_format']){logger[_0x46e4('0xe')]('['+_0x4a77d8[_0x46e4('0x6a')]['toUpperCase']()+']',_0x46e4('0x4a'));_0x4a77d8['recordingURL']=util[_0x46e4('0x10')](_0x46e4('0x4c'),_0x5908e2[_0x46e4('0x48')],_0x4a77d8[_0x46e4('0x60')],md5(_0x4a77d8['uniqueid']));}else{_0x4a77d8[_0x46e4('0x4b')]='';}headers[_0x46e4('0x4d')]=getAuth(_0x5908e2);return getUser(_0x5908e2)[_0x46e4('0x1c')](function(_0x34df97){_0xac2c7f=_0x34df97;logger[_0x46e4('0xe')]('The\x20User\x20ID\x20is:',_0xac2c7f['id']);return getEndUser(_0x5908e2,_0x4a77d8[_0x46e4('0x50')],_0x4a77d8[_0x46e4('0x51')]);})[_0x46e4('0x1c')](function(_0x5170b5){_0x1ca6c9=_0x5170b5;logger['info'](_0x46e4('0x6b'),_0x1ca6c9['id']);return getTicket(_0x5908e2,_0xac2c7f,_0x1ca6c9,_0xd7a9cd,_0x4a77d8);})[_0x46e4('0x1c')](function(_0x34c312){if(_0x34c312){logger[_0x46e4('0xe')](_0x46e4('0x6c'),_0x34c312['id']);}})[_0x46e4('0x5b')](function(_0x3496a1){logger[_0x46e4('0x67')]('['+_0x4a77d8[_0x46e4('0x6a')][_0x46e4('0x6d')]()+']'+_0x46e4('0x6e'),util[_0x46e4('0x5c')](_0x3496a1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6aea=['forEach','includes','picklist','type','nameField','customField','toLowerCase','toString','string','idField','push','content','variable','variableName','custom_fields','customVariable','Variable','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','calleridname','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','%s/users.json','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','[HTTP]','stringify','GET'];(function(_0x2a50fc,_0x792726){var _0x5aa6a2=function(_0x26ca83){while(--_0x26ca83){_0x2a50fc['push'](_0x2a50fc['shift']());}};_0x5aa6a2(++_0x792726);}(_0x6aea,0x116));var _0xa6ae=function(_0x27fbfd,_0x4eb3e4){_0x27fbfd=_0x27fbfd-0x0;var _0x540080=_0x6aea[_0x27fbfd];return _0x540080;};'use strict';var _=require(_0xa6ae('0x0'));var rp=require(_0xa6ae('0x1'));var md5=require('md5');var util=require(_0xa6ae('0x2'));var Redis=require(_0xa6ae('0x3'));var intUtil=require(_0xa6ae('0x4'));var config=require(_0xa6ae('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0xa6ae('0x6')]=_[_0xa6ae('0x7')](config[_0xa6ae('0x6')],{'host':_0xa6ae('0x8'),'port':0x18eb});var io=require(_0xa6ae('0x9'))(new Redis(config['redis']));function emit(_0x1b52d9,_0x3b88b6,_0x1f758b){io['to'](_0x1b52d9)[_0xa6ae('0xa')](_0x3b88b6,_0x1f758b);}var headers={'Content-Type':_0xa6ae('0xb'),'Accept':_0xa6ae('0xb')};function getTicket(_0x42bcd4,_0x23d042,_0xeae0b7,_0x335565,_0x15ada7){logger[_0xa6ae('0xc')](_0xa6ae('0xd'));return request({'uri':util[_0xa6ae('0xe')](_0xa6ae('0xf'),_0x42bcd4[_0xa6ae('0x10')]),'method':_0xa6ae('0x11'),'body':{'ticket':_['merge']({'requester_id':_0xeae0b7['id'],'submitter_id':_0x23d042?_0x23d042['id']:undefined,'assignee_id':_0x23d042?_0x23d042['id']:undefined,'tags':getTags(_0x335565['Tags'],_0xa6ae('0x12')),'subject':intUtil[_0xa6ae('0x13')](_0x335565[_0xa6ae('0x14')],_0x15ada7,'\x20'),'description':intUtil[_0xa6ae('0x13')](_0x335565[_0xa6ae('0x15')],_0x15ada7,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa6ae('0x13')](_0x335565[_0xa6ae('0x15')],_0x15ada7,'\x0a')}},getCustomFields(_0x335565[_0xa6ae('0x16')],_0x15ada7))}})[_0xa6ae('0x17')](function(_0x399e22){logger[_0xa6ae('0xc')]('Ticket\x20created!');return _0x399e22[_0xa6ae('0x18')];});}function getUser(_0x195d4d,_0x4f69e0){if(intUtil[_0xa6ae('0x19')](_0x4f69e0)){logger['info'](_0xa6ae('0x1a'),_0x4f69e0);return request({'uri':util[_0xa6ae('0xe')](_0xa6ae('0x1b'),_0x195d4d['remoteUri']),'qs':{'query':util['format'](_0xa6ae('0x1c'),_0x4f69e0)}})[_0xa6ae('0x17')](function(_0xb64def){if(_0xb64def[_0xa6ae('0x1d')]){logger[_0xa6ae('0xc')]('Agent\x20found!');return _[_0xa6ae('0x1e')](_0xb64def[_0xa6ae('0x1f')],{'email':_0x4f69e0,'role':_0xa6ae('0x20')});}else{logger[_0xa6ae('0xc')](_0xa6ae('0x21'));return request({'uri':util[_0xa6ae('0xe')](_0xa6ae('0x22'),_0x195d4d[_0xa6ae('0x10')])})[_0xa6ae('0x17')](function(_0x3aae3a){logger[_0xa6ae('0xc')](_0xa6ae('0x23'));return _0x3aae3a[_0xa6ae('0x24')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa6ae('0xe')](_0xa6ae('0x22'),_0x195d4d[_0xa6ae('0x10')])})['then'](function(_0x1bbb6d){logger[_0xa6ae('0xc')](_0xa6ae('0x23'));return _0x1bbb6d[_0xa6ae('0x24')];});}}function getEndUser(_0x4ef3dc,_0x9806d,_0x19f077){logger[_0xa6ae('0xc')](_0xa6ae('0x25'),_0x19f077);return request({'uri':util[_0xa6ae('0xe')](_0xa6ae('0x1b'),_0x4ef3dc['remoteUri']),'qs':{'query':util[_0xa6ae('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x19f077)}})[_0xa6ae('0x17')](function(_0x425d0b){var _0x354829;if(_0x425d0b[_0xa6ae('0x1f')][_0xa6ae('0x26')]){_0x425d0b['results']=_[_0xa6ae('0x27')](_0x425d0b[_0xa6ae('0x1f')],{'suspended':![],'role':_0xa6ae('0x28')});if(_0x425d0b['results'][_0xa6ae('0x26')]){_0x354829=_[_0xa6ae('0x29')](_0x425d0b[_0xa6ae('0x1f')]);}}if(_0x354829){logger[_0xa6ae('0xc')](_0xa6ae('0x2a'));return _0x354829;}else{logger[_0xa6ae('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xa6ae('0xe')](_0xa6ae('0x2b'),_0x4ef3dc[_0xa6ae('0x10')]),'method':_0xa6ae('0x11'),'body':{'user':{'role':'end-user','name':util[_0xa6ae('0xe')]('Caller\x20-\x20%s',_0x9806d||_0x19f077),'phone':_0x19f077}}})[_0xa6ae('0x17')](function(_0x427aa0){logger[_0xa6ae('0xc')]('Enduser\x20created.');return _0x427aa0[_0xa6ae('0x24')];});}});}function getAuth(_0x45c288){var _0x4d7e5e;if(_0x45c288[_0xa6ae('0x2c')]===_0xa6ae('0x2d')){_0x4d7e5e=util['format'](_0xa6ae('0x2e'),_0x45c288[_0xa6ae('0x2f')],_0x45c288['password']);}else if(_0x45c288['authType']===_0xa6ae('0x30')){_0x4d7e5e=util[_0xa6ae('0xe')](_0xa6ae('0x31'),_0x45c288[_0xa6ae('0x2f')],_0x45c288['token']);}return util[_0xa6ae('0xe')](_0xa6ae('0x32'),new Buffer(_0x4d7e5e)['toString'](_0xa6ae('0x33')));}function request(_0x559f2c){logger['debug'](_0xa6ae('0x34'),JSON[_0xa6ae('0x35')](_0x559f2c));return rp(_[_0xa6ae('0x7')](_0x559f2c,{'method':_0xa6ae('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x870d27,_0x3d28c7){var _0x30dc3c=[];if(_0x870d27&&_0x870d27['length']>0x0){_0x30dc3c=_['map'](_0x870d27,_0x3d28c7);}return _0x30dc3c;}function getCustomFields(_0x48053b,_0xf0428){var _0x363394=[];var _0x2714e5={'custom_fields':[]};if(_0x48053b[_0xa6ae('0x26')]>0x0){_[_0xa6ae('0x37')](_0x48053b,function(_0x3eb4b2){if(_[_0xa6ae('0x38')](['string',_0xa6ae('0x39')],_0x3eb4b2[_0xa6ae('0x3a')])&&_0x3eb4b2[_0xa6ae('0x3b')]&&!_0x3eb4b2[_0xa6ae('0x3c')]){_0x2714e5[_0x3eb4b2[_0xa6ae('0x3b')][_0xa6ae('0x3d')]()]=_0x3eb4b2['content'][_0xa6ae('0x3e')]();}else if(_[_0xa6ae('0x38')]([_0xa6ae('0x3f'),_0xa6ae('0x39')],_0x3eb4b2[_0xa6ae('0x3a')])&&_0x3eb4b2[_0xa6ae('0x40')]&&_0x3eb4b2[_0xa6ae('0x3c')]){_0x2714e5['custom_fields'][_0xa6ae('0x41')]({'id':_0x3eb4b2[_0xa6ae('0x40')],'value':_0x3eb4b2[_0xa6ae('0x42')][_0xa6ae('0x3e')]()});}else if(_0x3eb4b2['type']===_0xa6ae('0x43')&&_0x3eb4b2[_0xa6ae('0x44')]&&_0x3eb4b2[_0xa6ae('0x40')]&&_0x3eb4b2[_0xa6ae('0x3c')]){_0xf0428[_0x3eb4b2[_0xa6ae('0x44')]]&&_0x2714e5[_0xa6ae('0x45')]['push']({'id':_0x3eb4b2[_0xa6ae('0x40')],'value':_0xf0428[_0x3eb4b2[_0xa6ae('0x44')]]['toString']()});}else if(_0x3eb4b2[_0xa6ae('0x3a')]===_0xa6ae('0x46')&&_0x3eb4b2['Variable']&&_0x3eb4b2[_0xa6ae('0x47')][_0xa6ae('0x12')]&&_0x3eb4b2[_0xa6ae('0x40')]&&_0x3eb4b2[_0xa6ae('0x3c')]){_0xf0428[_0x3eb4b2[_0xa6ae('0x47')][_0xa6ae('0x12')][_0xa6ae('0x3d')]()]&&_0x2714e5[_0xa6ae('0x45')][_0xa6ae('0x41')]({'id':_0x3eb4b2[_0xa6ae('0x40')],'value':_0xf0428[_0x3eb4b2['Variable'][_0xa6ae('0x12')]['toLowerCase']()][_0xa6ae('0x3e')]()});}});}return _0x2714e5;}exports['queue']=function(_0x4d69de,_0x33c851,_0x20a11d,_0xb94bf4,_0x46adbe,_0x452bff){var _0x4b8f81,_0x2a4ab2;_0x452bff[_0xa6ae('0x10')]=intUtil[_0xa6ae('0x48')](_0x452bff[_0xa6ae('0x10')]);_0x452bff['serverUrl']=intUtil[_0xa6ae('0x48')](_0x452bff['serverUrl']);if(_0x46adbe&&_0x46adbe[_0xa6ae('0x49')]){logger[_0xa6ae('0xc')]('[QUEUE]',_0xa6ae('0x4a'));_0x33c851[_0xa6ae('0x4b')]=util[_0xa6ae('0xe')](_0xa6ae('0x4c'),_0x452bff[_0xa6ae('0x4d')],_0x33c851[_0xa6ae('0x4e')],md5(_0x33c851[_0xa6ae('0x4e')]));}else{_0x33c851[_0xa6ae('0x4b')]='';}headers['Authorization']=getAuth(_0x452bff);return getUser(_0x452bff,_0xb94bf4['email'])[_0xa6ae('0x17')](function(_0xc56a70){_0x4b8f81=_0xc56a70;logger['info'](_0xa6ae('0x4f'),_0x4b8f81['id']);return getEndUser(_0x452bff,_0x33c851['calleridname'],_0x33c851[_0xa6ae('0x50')]);})['then'](function(_0x3f1546){_0x2a4ab2=_0x3f1546;logger[_0xa6ae('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2a4ab2['id']);return getTicket(_0x452bff,_0x4b8f81,_0x2a4ab2,_0x20a11d,_0x33c851);})['then'](function(_0x17adae){if(_0x17adae){logger[_0xa6ae('0xc')]('The\x20Ticket\x20ID\x20is:',_0x17adae['id']);switch(_0x452bff['type']){case _0xa6ae('0x51'):logger[_0xa6ae('0xc')](_0xa6ae('0x52'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa6ae('0xe')](_0xa6ae('0x53'),_0x452bff['remoteUri'],_0x4b8f81['id'],_0x17adae['id']),'method':_0xa6ae('0x11')});case _0xa6ae('0x54'):logger[_0xa6ae('0xc')](_0xa6ae('0x52'),_0xa6ae('0x55'));emit(util[_0xa6ae('0xe')](_0xa6ae('0x56'),_0xb94bf4[_0xa6ae('0x12')]),_0xa6ae('0x57'),{'uri':util['format'](_0xa6ae('0x58'),_0x452bff['remoteUri'][_0xa6ae('0x59')](_0xa6ae('0x5a'),''),_0x17adae['id'])});break;default:logger[_0xa6ae('0x5b')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x5cae55){logger['error'](_0xa6ae('0x5c'),util['inspect'](_0x5cae55,{'showHidden':!![],'depth':null}));});};exports[_0xa6ae('0x5d')]=function(_0x2acdd5,_0xd62def,_0x445a5d,_0x40c4bd,_0x18da9e,_0x4a158d,_0x2340ea){var _0x15c457,_0x35e562;_0x4a158d[_0xa6ae('0x10')]=intUtil[_0xa6ae('0x48')](_0x4a158d[_0xa6ae('0x10')]);_0x4a158d['serverUrl']=intUtil[_0xa6ae('0x48')](_0x4a158d[_0xa6ae('0x4d')]);if(_0x2340ea&&_0x2340ea[_0xa6ae('0x5e')]&&_0x2340ea['recordingFormat']!=='none'){logger[_0xa6ae('0xc')](_0xa6ae('0x5f'),_0xa6ae('0x4a'));_0xd62def[_0xa6ae('0x4b')]=util[_0xa6ae('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a158d[_0xa6ae('0x4d')],_0xd62def['uniqueid'],md5(_0xd62def[_0xa6ae('0x4e')]));}headers['Authorization']=getAuth(_0x4a158d);return getUser(_0x4a158d,_0x40c4bd[_0xa6ae('0x60')])[_0xa6ae('0x17')](function(_0x4fe0d0){_0x15c457=_0x4fe0d0;logger[_0xa6ae('0xc')](_0xa6ae('0x4f'),_0x15c457['id']);return getEndUser(_0x4a158d,_0xd62def[_0xa6ae('0x61')],_0xd62def[_0xa6ae('0x62')]);})['then'](function(_0x69bfae){_0x35e562=_0x69bfae;logger['info'](_0xa6ae('0x63'),_0x35e562['id']);return getTicket(_0x4a158d,_0x15c457,_0x35e562,_0x445a5d,_0xd62def);})['then'](function(_0x17bc6e){if(_0x17bc6e){logger[_0xa6ae('0xc')]('The\x20Ticket\x20ID\x20is:',_0x17bc6e['id']);switch(_0x4a158d['type']){case _0xa6ae('0x51'):logger[_0xa6ae('0xc')]('[OUTBOUND]',_0xa6ae('0x64'));return request({'uri':util['format'](_0xa6ae('0x53'),_0x4a158d['remoteUri'],_0x15c457['id'],_0x17bc6e['id']),'method':_0xa6ae('0x11')});case'newTab':logger[_0xa6ae('0xc')]('[OUTBOUND]',_0xa6ae('0x55'));emit(util[_0xa6ae('0xe')]('user:%s',_0x40c4bd[_0xa6ae('0x12')]),_0xa6ae('0x57'),{'uri':util[_0xa6ae('0xe')](_0xa6ae('0x58'),_0x4a158d[_0xa6ae('0x10')][_0xa6ae('0x59')](_0xa6ae('0x5a'),''),_0x17bc6e['id'])});break;default:logger[_0xa6ae('0x5b')]('[OUTBOUND]',_0xa6ae('0x65'));}}})[_0xa6ae('0x66')](function(_0x5c0c93){logger['error'](_0xa6ae('0x67'),util[_0xa6ae('0x68')](_0x5c0c93,{'showHidden':!![],'depth':null}));});};exports[_0xa6ae('0x69')]=function(_0x2274a9,_0x26e0d1,_0x107979,_0x1720de,_0x116f6b,_0x4e08fd){var _0x4b1ed3,_0x488dfc;_0x4e08fd[_0xa6ae('0x10')]=intUtil[_0xa6ae('0x48')](_0x4e08fd[_0xa6ae('0x10')]);_0x4e08fd[_0xa6ae('0x4d')]=intUtil[_0xa6ae('0x48')](_0x4e08fd[_0xa6ae('0x4d')]);if(_0x116f6b&&_0x116f6b[_0xa6ae('0x49')]){logger[_0xa6ae('0xc')]('['+_0x26e0d1[_0xa6ae('0x6a')][_0xa6ae('0x6b')]()+']',_0xa6ae('0x4a'));_0x26e0d1[_0xa6ae('0x4b')]=util[_0xa6ae('0xe')](_0xa6ae('0x4c'),_0x4e08fd[_0xa6ae('0x4d')],_0x26e0d1['uniqueid'],md5(_0x26e0d1[_0xa6ae('0x4e')]));}else{_0x26e0d1[_0xa6ae('0x4b')]='';}headers['Authorization']=getAuth(_0x4e08fd);return getUser(_0x4e08fd)[_0xa6ae('0x17')](function(_0x3cd74b){_0x4b1ed3=_0x3cd74b;logger['info']('The\x20User\x20ID\x20is:',_0x4b1ed3['id']);return getEndUser(_0x4e08fd,_0x26e0d1[_0xa6ae('0x6c')],_0x26e0d1['calleridnum']);})[_0xa6ae('0x17')](function(_0x48074c){_0x488dfc=_0x48074c;logger['info'](_0xa6ae('0x63'),_0x488dfc['id']);return getTicket(_0x4e08fd,_0x4b1ed3,_0x488dfc,_0x107979,_0x26e0d1);})[_0xa6ae('0x17')](function(_0x240f51){if(_0x240f51){logger[_0xa6ae('0xc')](_0xa6ae('0x6d'),_0x240f51['id']);}})[_0xa6ae('0x66')](function(_0xfd6362){logger[_0xa6ae('0x5b')]('['+_0x26e0d1[_0xa6ae('0x6a')][_0xa6ae('0x6b')]()+']'+_0xa6ae('0x6e'),util[_0xa6ae('0x68')](_0xfd6362,{'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 1832fe3..d660f1a 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 _0xd286=['content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','GET','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','talktime','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','host','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','/crm/EntityInfo.do?module=Calls&id=','unmanaged','calleridname','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField'];(function(_0x511133,_0x35255f){var _0x3acd78=function(_0x371acd){while(--_0x371acd){_0x511133['push'](_0x511133['shift']());}};_0x3acd78(++_0x35255f);}(_0xd286,0x126));var _0x6d28=function(_0x4e88c1,_0x458a12){_0x4e88c1=_0x4e88c1-0x0;var _0x33e965=_0xd286[_0x4e88c1];return _0x33e965;};'use strict';var _=require(_0x6d28('0x0'));var rp=require(_0x6d28('0x1'));var md5=require(_0x6d28('0x2'));var util=require(_0x6d28('0x3'));var intUtil=require(_0x6d28('0x4'));var moment=require('moment');var Redis=require(_0x6d28('0x5'));var BPromise=require(_0x6d28('0x6'));var config=require(_0x6d28('0x7'));var logger=require(_0x6d28('0x8'))('zoho');config[_0x6d28('0x9')]=_[_0x6d28('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d28('0x9')]));function emit(_0x5f3e31,_0x4c0438,_0x3b7069){io['to'](_0x5f3e31)['emit'](_0x4c0438,_0x3b7069);}function request(_0x2adcf8){logger[_0x6d28('0xb')](_0x6d28('0xc'),JSON[_0x6d28('0xd')](_0x2adcf8));return rp(_0x2adcf8);}function getCustomFields(_0x7aaf1f,_0x5e3c30){var _0x4b3c81={};if(_0x7aaf1f[_0x6d28('0xe')]>0x0){_[_0x6d28('0xf')](_0x7aaf1f,function(_0x12e8f2){if(_['includes']([_0x6d28('0x10'),_0x6d28('0x11')],_0x12e8f2[_0x6d28('0x12')])&&_0x12e8f2[_0x6d28('0x13')]){_0x4b3c81[_0x12e8f2[_0x6d28('0x13')]]=_0x12e8f2[_0x6d28('0x14')][_0x6d28('0x15')]();}else if(_0x12e8f2['type']===_0x6d28('0x16')&&_0x12e8f2[_0x6d28('0x17')]&&_0x12e8f2[_0x6d28('0x13')]&&_0x5e3c30[_0x12e8f2[_0x6d28('0x17')]]){_0x4b3c81[_0x12e8f2['idField']]=_0x5e3c30[_0x12e8f2[_0x6d28('0x17')]][_0x6d28('0x15')]();}else if(_0x12e8f2[_0x6d28('0x12')]===_0x6d28('0x18')&&_0x12e8f2[_0x6d28('0x19')]&&_0x12e8f2[_0x6d28('0x19')]['name']&&_0x12e8f2['idField']&&_0x5e3c30[_0x12e8f2[_0x6d28('0x19')][_0x6d28('0x1a')]['toLowerCase']()]){_0x4b3c81[_0x12e8f2[_0x6d28('0x13')]]=_0x5e3c30[_0x12e8f2['Variable'][_0x6d28('0x1a')][_0x6d28('0x1b')]()][_0x6d28('0x15')]();}});}return _0x4b3c81;}function getName(_0x5a265d){if(_0x5a265d[_0x6d28('0x1c')]('\x20')>0x0){var _0xca24e1=_0x5a265d[_0x6d28('0x1d')](/ (.+)/);if(_0xca24e1[0x1]){return _0xca24e1;}}return[_0x5a265d,_0x5a265d];}var accountsTokens={};function getAccessToken(_0x685011){return new Promise(function(_0x3e0895,_0x51ce46){if(!_['isNil'](accountsTokens[_0x685011['id']])&&!_[_0x6d28('0x1e')](accountsTokens[_0x685011['id']][_0x6d28('0x1f')])){if(moment()[_0x6d28('0x20')](accountsTokens[_0x685011['id']][_0x6d28('0x21')])){_0x3e0895(accountsTokens[_0x685011['id']]['access_token']);}}var _0x4bfae4;switch(_0x685011[_0x6d28('0x22')]){case'US':_0x4bfae4='https://accounts.zoho.com';break;case'AU':_0x4bfae4='https://accounts.zoho.com.au';break;case'EU':_0x4bfae4=_0x6d28('0x23');break;case'IN':_0x4bfae4='https://accounts.zoho.in';break;case'CN':_0x4bfae4=_0x6d28('0x24');break;default:_0x4bfae4=_0x6d28('0x23');break;}var _0x30f0e9={'method':_0x6d28('0x25'),'uri':_0x4bfae4+'/oauth/v2/token','qs':{'refresh_token':_0x685011[_0x6d28('0x26')],'client_id':_0x685011[_0x6d28('0x27')],'client_secret':_0x685011['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x30f0e9)[_0x6d28('0x28')](function(_0x29840b){accountsTokens[_0x685011['id']]={'access_token':_0x29840b[_0x6d28('0x1f')],'expires_in':moment()[_0x6d28('0x29')](_0x29840b['expires_in'],_0x6d28('0x2a'))};_0x3e0895(_0x29840b[_0x6d28('0x1f')]);})[_0x6d28('0x2b')](function(_0x3806d7){logger[_0x6d28('0x2c')](_0x6d28('0x2d'),_0x3806d7[_0x6d28('0x2e')]);_0x51ce46(_0x3806d7);});});}function getUser(_0x57722e,_0xbf6d0d,_0x450276,_0x2589ff){logger[_0x6d28('0x2f')](_0x6d28('0x30'));return request({'method':'GET','uri':util['format'](_0x6d28('0x31'),_0xbf6d0d),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x6d28('0x32')+_0x57722e},'json':!![]})[_0x6d28('0x28')](function(_0x26da9c){if(_0x26da9c[_0x6d28('0x33')]){var _0x3111d1=-0x1;if(_[_0x6d28('0x34')](_0x26da9c[_0x6d28('0x33')])){if(!_['isNil'](_0x2589ff)){_0x3111d1=_[_0x6d28('0x35')](_0x26da9c['users'],function(_0x25b469){return _0x25b469[_0x6d28('0x36')]===_0x2589ff;});}if(_0x3111d1>=0x0){logger[_0x6d28('0x2f')](_0x6d28('0x37'));}else{logger[_0x6d28('0x2f')]('Using\x20the\x20admin\x20account!');_0x3111d1=_[_0x6d28('0x35')](_0x26da9c[_0x6d28('0x33')],function(_0x2e10e0){return _0x2e10e0[_0x6d28('0x38')][_0x6d28('0x1a')]===_0x6d28('0x39');});}return _0x26da9c[_0x6d28('0x33')][_0x3111d1];}else{if(_0x26da9c[_0x6d28('0x3a')]['profile'][_0x6d28('0x1a')]==='Administrator'){logger[_0x6d28('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x26da9c['user'];return user;}else{logger[_0x6d28('0x2c')](_0x6d28('0x3b'),JSON[_0x6d28('0xd')](_0x26da9c));throw new Error(_0x6d28('0x3c')+JSON[_0x6d28('0xd')](_0x26da9c));}}}else{logger[_0x6d28('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x6d28('0xd')](_0x26da9c));throw new Error(_0x6d28('0x3c')+JSON[_0x6d28('0xd')](_0x26da9c));}})[_0x6d28('0x2b')](function(_0x31a33d){console['error'](_0x31a33d);});}function getZohoUser(_0x39cb23,_0x54127a){return new BPromise(function(_0x460d57,_0x23f4b0){request(_0x39cb23)[_0x6d28('0x28')](function(_0x324afc){var _0xcc2d60=null;if(_0x324afc){_0xcc2d60=_0x324afc[_0x6d28('0x3d')][0x0];_0xcc2d60[_0x6d28('0x3e')]=_0x54127a;}_0x460d57(_0xcc2d60);})[_0x6d28('0x2b')](function(_0x2a70f1){_0x23f4b0(_0x2a70f1);});});}function createEndUser(_0x11daa3,_0x52bc12,_0x3e86db,_0x150c19,_0x4bb011,_0x27247a){var _0x3e86db=getName(_0x3e86db);return request({'method':'POST','uri':_0x6d28('0x3f')+_0x52bc12+'/crm/v2/'+_['startCase'](_0x27247a[_0x6d28('0x40')])+'s','body':{'data':[{'Last_Name':_0x3e86db[0x1],'First_Name':_0x3e86db[0x0],'Phone':_0x150c19,'Owner':{'name':!_[_0x6d28('0x1e')](_0x4bb011[_0x6d28('0x41')]['name'])?_0x4bb011[_0x6d28('0x41')][_0x6d28('0x1a')]:!_['isNil'](_0x4bb011[_0x6d28('0x42')])?_0x4bb011['first_name']+'\x20'+_0x4bb011[_0x6d28('0x43')]:_0x4bb011['last_name'],'id':_0x4bb011['id']}}]},'headers':{'Authorization':_0x6d28('0x32')+_0x11daa3},'json':!![]})[_0x6d28('0x28')](function(_0x5f5d28){if(_0x5f5d28&&_0x5f5d28[_0x6d28('0x3d')][0x0][_0x6d28('0x44')]==='SUCCESS'){var _0x5aec0c=_0x5f5d28[_0x6d28('0x3d')][0x0][_0x6d28('0x45')];_0x5aec0c[_0x6d28('0x3e')]=_['startCase'](_0x27247a['moduleCreate'])+'s';return _0x5aec0c;}logger[_0x6d28('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x6d28('0xd')](data));throw new Error(_0x6d28('0x46')+JSON['stringify'](data));})[_0x6d28('0x2b')](function(_0xa613df){console[_0x6d28('0x47')]('CREATE\x20ERROR',_0xa613df);});}function getEndUser(_0x392d61,_0xe41c20,_0x2bed16,_0x496313,_0x497921,_0x342f7b,_0x543e96){var _0x3327a8={'method':_0x6d28('0x48'),'uri':'','headers':{'Authorization':_0x6d28('0x32')+_0x392d61},'json':!![]};switch(_0x543e96['moduleSearch']){case _0x6d28('0x49'):_0x3327a8[_0x6d28('0x4a')]=_0x6d28('0x3f')+_0xe41c20+_0x6d28('0x4b')+_0x497921+'))';return getZohoUser(_0x3327a8,_0x6d28('0x4c'))['then'](function(_0x5bee19){if(_0x5bee19)return _0x5bee19;_0x3327a8[_0x6d28('0x4a')]=_0x6d28('0x3f')+_0xe41c20+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x497921+'))';return getZohoUser(_0x3327a8,_0x6d28('0x4d'))['then'](function(_0x420e38){if(_0x420e38)return _0x420e38;if(_0x543e96[_0x6d28('0x40')]!=_0x6d28('0x4e')){return createEndUser(_0x392d61,_0xe41c20,_0x496313,_0x497921,_0x342f7b,_0x543e96);}else{return{};}});});break;case _0x6d28('0x4f'):_0x3327a8[_0x6d28('0x4a')]=_0x6d28('0x3f')+_0xe41c20+_0x6d28('0x4b')+_0x497921+'))';return getZohoUser(_0x3327a8,_0x6d28('0x4c'))[_0x6d28('0x28')](function(_0x23467f){if(_0x23467f)return _0x23467f;if(_0x543e96[_0x6d28('0x40')]!=_0x6d28('0x4e')){return createEndUser(_0x392d61,_0xe41c20,_0x496313,_0x497921,_0x342f7b,_0x543e96);}else{return{};}});break;case _0x6d28('0x50'):_0x3327a8[_0x6d28('0x4a')]=_0x6d28('0x3f')+_0xe41c20+_0x6d28('0x51')+_0x497921+'))';return getZohoUser(_0x3327a8,_0x6d28('0x4d'))[_0x6d28('0x28')](function(_0x2c61d3){if(_0x2c61d3)return _0x2c61d3;if(_0x543e96[_0x6d28('0x40')]!=_0x6d28('0x4e')){return createEndUser(_0x392d61,_0xe41c20,_0x496313,_0x497921,_0x342f7b,_0x543e96);}else{return{};}});break;}}function getCall(_0xe0c297,_0x85de8f,_0x166a7d,_0x394cc4,_0x3a2502,_0x343a6c,_0x4613db,_0x2aa206){logger[_0x6d28('0x2f')](_0x6d28('0x52'));var _0x4d6393={};_0x4d6393[_0x6d28('0x53')]={'name':!_[_0x6d28('0x1e')](_0x394cc4[_0x6d28('0x41')][_0x6d28('0x1a')])&&!_['isNil'](_0x394cc4[_0x6d28('0x38')][_0x6d28('0x1a')])&&_0x394cc4[_0x6d28('0x38')][_0x6d28('0x1a')]===_0x6d28('0x54')?_0x394cc4[_0x6d28('0x41')][_0x6d28('0x1a')]:!_[_0x6d28('0x1e')](_0x394cc4['first_name'])?_0x394cc4[_0x6d28('0x42')]+'\x20'+_0x394cc4[_0x6d28('0x43')]:_0x394cc4['last_name'],'id':_0x394cc4['id']};_0x4d6393[_0x6d28('0x55')]=intUtil[_0x6d28('0x56')](_0x343a6c[_0x6d28('0x57')],_0x4613db,'\x20');_0x4d6393[_0x6d28('0x58')]=intUtil[_0x6d28('0x56')](_0x343a6c[_0x6d28('0x59')],_0x4613db,'\x0a');if(_0x3a2502[_0x6d28('0x3e')]===_0x6d28('0x4c')){_0x4d6393[_0x6d28('0x5a')]={'name':!_[_0x6d28('0x1e')](_0x3a2502[_0x6d28('0x5b')])?_0x3a2502[_0x6d28('0x5b')]:!_[_0x6d28('0x1e')](_0x3a2502['First_Name'])?_0x3a2502[_0x6d28('0x5c')]+'\x20'+_0x3a2502[_0x6d28('0x5d')]:_0x3a2502['Last_Name'],'id':_0x3a2502['id']};}if(_0x3a2502[_0x6d28('0x3e')]===_0x6d28('0x4d')){_0x4d6393[_0x6d28('0x5e')]={'name':!_[_0x6d28('0x1e')](_0x3a2502[_0x6d28('0x5b')])?_0x3a2502[_0x6d28('0x5b')]:!_[_0x6d28('0x1e')](_0x3a2502['First_Name'])?_0x3a2502[_0x6d28('0x5c')]+'\x20'+_0x3a2502[_0x6d28('0x5d')]:_0x3a2502['Last_Name'],'id':_0x3a2502['id']};_0x4d6393[_0x6d28('0x5f')]=_[_0x6d28('0x60')](_0x3a2502['enduserType']);}if(_0x4613db[_0x6d28('0x61')]){_0x4d6393['Call_Duration']=moment[_0x6d28('0x62')](parseInt(_0x4613db[_0x6d28('0x61')])*0x3e8)[_0x6d28('0x63')](_0x6d28('0x64'));}else if(_0x4613db[_0x6d28('0x65')]&&_0x4613db['endtime']){_0x4d6393['Call_Duration']=moment[_0x6d28('0x62')](moment(_0x4613db[_0x6d28('0x66')],_0x6d28('0x67'))[_0x6d28('0x68')](moment(_0x4613db[_0x6d28('0x69')],_0x6d28('0x67'))))['format'](_0x6d28('0x64'));}switch(_0x4613db[_0x6d28('0x6a')]){case _0x6d28('0x6b'):_0x4d6393[_0x6d28('0x6c')]='Called';break;case _0x6d28('0x6d'):case _0x6d28('0x6e'):_0x4d6393['Call_Result']=_0x6d28('0x6f');break;case _0x6d28('0x70'):_0x4d6393[_0x6d28('0x6c')]=_0x6d28('0x71');break;case _0x6d28('0x72'):_0x4d6393[_0x6d28('0x6c')]=_0x6d28('0x73');break;case'timeout':_0x4d6393[_0x6d28('0x6c')]=_0x6d28('0x74');default:}_0x4d6393[_0x6d28('0x75')]=(_0x2aa206===_0x6d28('0x76')?moment(_0x4613db[_0x6d28('0x69')])[_0x6d28('0x63')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x4613db[_0x6d28('0x77')])[_0x6d28('0x63')](_0x6d28('0x67')))||moment()[_0x6d28('0x63')](_0x6d28('0x67'));_0x4d6393[_0x6d28('0x78')]=_0x2aa206||_0x6d28('0x79');_0x4d6393=_[_0x6d28('0x7a')](_0x4d6393,getCustomFields(_0x343a6c[_0x6d28('0x7b')],_0x4613db));return request({'method':'POST','uri':_0x6d28('0x3f')+_0x85de8f+_0x6d28('0x7c'),'headers':{'Authorization':_0x6d28('0x32')+_0xe0c297},'body':{'data':[_0x4d6393]},'json':!![]})[_0x6d28('0x28')](function(_0x29a41c){if(_0x29a41c&&_0x29a41c[_0x6d28('0x3d')][0x0][_0x6d28('0x44')]==='SUCCESS'){logger[_0x6d28('0x2f')](_0x6d28('0x7d'));return{'id':_0x29a41c[_0x6d28('0x3d')][0x0][_0x6d28('0x45')]['id']};}})[_0x6d28('0x2b')](function(_0x38bc6d){logger[_0x6d28('0x2f')]('err',_0x38bc6d[_0x6d28('0x2e')]);console[_0x6d28('0x47')](_0x6d28('0x7e'),_0x38bc6d);});}exports[_0x6d28('0x7f')]=function(_0x4562a8,_0x5aac7e,_0x1afda6,_0xdad90e,_0x869544,_0xbaac0){var _0x3e072d,_0x4d2e46,_0x5d86a6;_0xbaac0['host']=intUtil[_0x6d28('0x80')](_0xbaac0['host']);_0xbaac0[_0x6d28('0x81')]=intUtil[_0x6d28('0x80')](_0xbaac0['serverUrl']);if(_0x869544&&_0x869544[_0x6d28('0x82')]){logger[_0x6d28('0x2f')]('[QUEUE]',_0x6d28('0x83'));_0x5aac7e[_0x6d28('0x84')]=_0xbaac0[_0x6d28('0x81')]+'/api/voice/recordings/'+_0x5aac7e['uniqueid']+_0x6d28('0x85')+md5(_0x5aac7e[_0x6d28('0x86')]);}else{_0x5aac7e[_0x6d28('0x84')]='';}var _0x11cdc8=_0xbaac0[_0x6d28('0x87')]===_0x6d28('0x88')?'eu':_0x6d28('0x89');return getAccessToken(_0xbaac0)[_0x6d28('0x28')](function(_0x7359b5){_0x5d86a6=_0x7359b5;return getUser(_0x5d86a6,_0x11cdc8,_0xbaac0,_0xdad90e[_0x6d28('0x36')]);})[_0x6d28('0x28')](function(_0x1f030d){_0x3e072d=_0x1f030d;logger[_0x6d28('0x2f')](_0x6d28('0x8a'),_0x3e072d['id']);return getEndUser(_0x5d86a6,_0x11cdc8,_0xbaac0,_0x5aac7e['calleridname'],_0x5aac7e[_0x6d28('0x8b')],_0x3e072d,_0x1afda6);})[_0x6d28('0x28')](function(_0x2e1883){_0x4d2e46=_0x2e1883;return getCall(_0x5d86a6,_0x11cdc8,_0xbaac0,_0x3e072d,_0x4d2e46,_0x1afda6,_0x5aac7e,_0x6d28('0x79'));})[_0x6d28('0x28')](function(_0x1178c4){if(_0x1178c4){logger['info']('The\x20Call\x20ID\x20is:',_0x1178c4['id']);logger[_0x6d28('0x2f')](_0x6d28('0x8c'),_0x6d28('0x8d'));emit(util[_0x6d28('0x63')](_0x6d28('0x8e'),_0xdad90e['name']),_0x6d28('0x8f'),{'uri':_0x6d28('0x90')+_0xbaac0[_0x6d28('0x87')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1178c4['id']});}})['catch'](function(_0x1a4fe7){logger[_0x6d28('0x2c')](_0x6d28('0x8c'),JSON[_0x6d28('0xd')](_0x1a4fe7));});};exports[_0x6d28('0x76')]=function(_0x1a1df6,_0x56ef5e,_0x253a31,_0x19583e,_0x35c96b,_0x1876d5,_0x18389d){var _0x945709,_0x36f9c6,_0x56b10a;_0x1876d5[_0x6d28('0x87')]=intUtil[_0x6d28('0x80')](_0x1876d5[_0x6d28('0x87')]);_0x1876d5[_0x6d28('0x81')]=intUtil[_0x6d28('0x80')](_0x1876d5['serverUrl']);if(_0x18389d&&_0x18389d['recordingFormat']&&_0x18389d[_0x6d28('0x91')]!==_0x6d28('0x92')){logger[_0x6d28('0x2f')](_0x6d28('0x93'),_0x6d28('0x83'));_0x56ef5e[_0x6d28('0x84')]=_0x1876d5[_0x6d28('0x81')]+_0x6d28('0x94')+_0x56ef5e[_0x6d28('0x86')]+_0x6d28('0x85')+md5(_0x56ef5e[_0x6d28('0x86')]);}var _0x5f1c75=_0x1876d5['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x1876d5)['then'](function(_0x3835f6){_0x56b10a=_0x3835f6;return getUser(_0x56b10a,_0x5f1c75,_0x1876d5,_0x19583e[_0x6d28('0x36')]);})[_0x6d28('0x28')](function(_0x1fc26d){_0x945709=_0x1fc26d;logger[_0x6d28('0x2f')](_0x6d28('0x8a'),_0x945709['id']);return getEndUser(_0x56b10a,_0x5f1c75,_0x1876d5,_0x56ef5e[_0x6d28('0x95')],_0x56ef5e[_0x6d28('0x96')],_0x945709,_0x253a31);})[_0x6d28('0x28')](function(_0x1d5d4c){_0x36f9c6=_0x1d5d4c;return getCall(_0x56b10a,_0x5f1c75,_0x1876d5,_0x945709,_0x36f9c6,_0x253a31,_0x56ef5e,_0x6d28('0x97'));})['then'](function(_0x2a6155){if(_0x2a6155){logger[_0x6d28('0x2f')](_0x6d28('0x98'),_0x2a6155['id']);logger[_0x6d28('0x2f')](_0x6d28('0x93'),_0x6d28('0x8d'));emit(util[_0x6d28('0x63')](_0x6d28('0x8e'),_0x19583e[_0x6d28('0x1a')]),_0x6d28('0x8f'),{'uri':_0x6d28('0x90')+_0x1876d5[_0x6d28('0x87')]+_0x6d28('0x99')+_0x2a6155['id']});}})[_0x6d28('0x2b')](function(_0x54000f){logger[_0x6d28('0x2c')](_0x6d28('0x93'),JSON[_0x6d28('0xd')](_0x54000f));});};exports[_0x6d28('0x9a')]=function(_0x342f62,_0x703ba0,_0x2d7ab9,_0x4591e8,_0x3967f6,_0x2def6f){var _0x562b54,_0x518c7e,_0x1e1c49;_0x2def6f[_0x6d28('0x87')]=intUtil[_0x6d28('0x80')](_0x2def6f[_0x6d28('0x87')]);_0x2def6f[_0x6d28('0x81')]=intUtil[_0x6d28('0x80')](_0x2def6f[_0x6d28('0x81')]);if(_0x3967f6&&_0x3967f6['monitor_format']){logger[_0x6d28('0x2f')]('['+_0x703ba0[_0x6d28('0x6a')]['toUpperCase']()+']',_0x6d28('0x83'));_0x703ba0[_0x6d28('0x84')]=_0x2def6f['serverUrl']+_0x6d28('0x94')+_0x703ba0[_0x6d28('0x86')]+_0x6d28('0x85')+md5(_0x703ba0['uniqueid']);}else{_0x703ba0['recordingURL']='';}var _0x14396a=_0x2def6f[_0x6d28('0x87')]===_0x6d28('0x88')?'eu':_0x6d28('0x89');return getAccessToken(_0x2def6f)[_0x6d28('0x28')](function(_0x981d11){_0x1e1c49=_0x981d11;return getUser(_0x1e1c49,_0x14396a,_0x2def6f);})[_0x6d28('0x28')](function(_0x2bd991){_0x562b54=_0x2bd991;logger[_0x6d28('0x2f')](_0x6d28('0x8a'),_0x562b54['id']);return getEndUser(_0x1e1c49,_0x14396a,_0x2def6f,_0x703ba0[_0x6d28('0x9b')],_0x703ba0[_0x6d28('0x8b')],_0x562b54,_0x2d7ab9);})[_0x6d28('0x28')](function(_0x4219fb){_0x518c7e=_0x4219fb;return getCall(_0x1e1c49,_0x14396a,_0x2def6f,_0x562b54,_0x518c7e,_0x2d7ab9,_0x703ba0,'Inbound');})['then'](function(_0xc135de){if(_0xc135de){logger['info'](_0x6d28('0x98'),_0xc135de['id']);}})['catch'](function(_0x59d209){logger[_0x6d28('0x2c')]('['+_0x703ba0['lastevent'][_0x6d28('0x9c')]()+']',JSON['stringify'](_0x59d209));});}; \ No newline at end of file +var _0x2098=['/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','The\x20Call\x20ID\x20is:','user:%s','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','request-promise','md5','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','debug','stringify','length','forEach','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','startCase','log','CREATE\x20ERROR','GET','moduleSearch','Contacts','uri','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Owner','administrator','last_name','getString','Subjects','Description','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2098,0x146));var _0x8209=function(_0x24c71a,_0x484bb8){_0x24c71a=_0x24c71a-0x0;var _0x5d66ca=_0x2098[_0x24c71a];return _0x5d66ca;};'use strict';var _=require('lodash');var rp=require(_0x8209('0x0'));var md5=require(_0x8209('0x1'));var util=require('util');var intUtil=require(_0x8209('0x2'));var moment=require('moment');var Redis=require(_0x8209('0x3'));var BPromise=require('bluebird');var config=require(_0x8209('0x4'));var logger=require(_0x8209('0x5'))(_0x8209('0x6'));config['redis']=_[_0x8209('0x7')](config[_0x8209('0x8')],{'host':_0x8209('0x9'),'port':0x18eb});var io=require(_0x8209('0xa'))(new Redis(config[_0x8209('0x8')]));function emit(_0x578fba,_0x45bea7,_0x24ee53){io['to'](_0x578fba)['emit'](_0x45bea7,_0x24ee53);}function request(_0x145f77){logger[_0x8209('0xb')]('[HTTP]',JSON[_0x8209('0xc')](_0x145f77));return rp(_0x145f77);}function getCustomFields(_0x309ca8,_0x47a4bc){var _0x5eb095={};if(_0x309ca8[_0x8209('0xd')]>0x0){_[_0x8209('0xe')](_0x309ca8,function(_0x3a0c1d){if(_['includes'](['string',_0x8209('0xf')],_0x3a0c1d[_0x8209('0x10')])&&_0x3a0c1d[_0x8209('0x11')]){_0x5eb095[_0x3a0c1d[_0x8209('0x11')]]=_0x3a0c1d[_0x8209('0x12')][_0x8209('0x13')]();}else if(_0x3a0c1d['type']===_0x8209('0x14')&&_0x3a0c1d[_0x8209('0x15')]&&_0x3a0c1d[_0x8209('0x11')]&&_0x47a4bc[_0x3a0c1d[_0x8209('0x15')]]){_0x5eb095[_0x3a0c1d[_0x8209('0x11')]]=_0x47a4bc[_0x3a0c1d['variableName']][_0x8209('0x13')]();}else if(_0x3a0c1d[_0x8209('0x10')]==='customVariable'&&_0x3a0c1d[_0x8209('0x16')]&&_0x3a0c1d[_0x8209('0x16')][_0x8209('0x17')]&&_0x3a0c1d['idField']&&_0x47a4bc[_0x3a0c1d[_0x8209('0x16')][_0x8209('0x17')][_0x8209('0x18')]()]){_0x5eb095[_0x3a0c1d[_0x8209('0x11')]]=_0x47a4bc[_0x3a0c1d['Variable'][_0x8209('0x17')][_0x8209('0x18')]()][_0x8209('0x13')]();}});}return _0x5eb095;}function getName(_0x4fcf0f){if(_0x4fcf0f[_0x8209('0x19')]('\x20')>0x0){var _0x2d18ee=_0x4fcf0f[_0x8209('0x1a')](/ (.+)/);if(_0x2d18ee[0x1]){return _0x2d18ee;}}return[_0x4fcf0f,_0x4fcf0f];}var accountsTokens={};function getAccessToken(_0x20a62e){return new Promise(function(_0x5c4cae,_0x67593b){if(!_[_0x8209('0x1b')](accountsTokens[_0x20a62e['id']])&&!_[_0x8209('0x1b')](accountsTokens[_0x20a62e['id']][_0x8209('0x1c')])){if(moment()[_0x8209('0x1d')](accountsTokens[_0x20a62e['id']]['expires_in'])){_0x5c4cae(accountsTokens[_0x20a62e['id']][_0x8209('0x1c')]);}}var _0x1ba4d3;switch(_0x20a62e[_0x8209('0x1e')]){case'US':_0x1ba4d3=_0x8209('0x1f');break;case'AU':_0x1ba4d3=_0x8209('0x20');break;case'EU':_0x1ba4d3='https://accounts.zoho.eu';break;case'IN':_0x1ba4d3=_0x8209('0x21');break;case'CN':_0x1ba4d3='https://accounts.zoho.com.cn';break;default:_0x1ba4d3=_0x8209('0x22');break;}var _0xc6372a={'method':_0x8209('0x23'),'uri':_0x1ba4d3+_0x8209('0x24'),'qs':{'refresh_token':_0x20a62e[_0x8209('0x25')],'client_id':_0x20a62e[_0x8209('0x26')],'client_secret':_0x20a62e[_0x8209('0x27')],'grant_type':_0x8209('0x28')},'json':!![]};return rp(_0xc6372a)[_0x8209('0x29')](function(_0x433956){accountsTokens[_0x20a62e['id']]={'access_token':_0x433956['access_token'],'expires_in':moment()[_0x8209('0x2a')](_0x433956[_0x8209('0x2b')],'seconds')};_0x5c4cae(_0x433956[_0x8209('0x1c')]);})[_0x8209('0x2c')](function(_0x40951a){logger[_0x8209('0x2d')](_0x8209('0x2e'),_0x40951a[_0x8209('0x2f')]);_0x67593b(_0x40951a);});});}function getUser(_0x4c8724,_0x21269c,_0x459b79,_0x4c9ded){logger[_0x8209('0x30')]('Search\x20user');return request({'method':'GET','uri':util[_0x8209('0x31')](_0x8209('0x32'),_0x21269c),'qs':{'type':_0x8209('0x33')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4c8724},'json':!![]})['then'](function(_0x3e68f2){if(_0x3e68f2[_0x8209('0x34')]){var _0x41f6ae=-0x1;if(_['isArrayLikeObject'](_0x3e68f2[_0x8209('0x34')])){if(!_[_0x8209('0x1b')](_0x4c9ded)){_0x41f6ae=_[_0x8209('0x35')](_0x3e68f2[_0x8209('0x34')],function(_0x1f568f){return _0x1f568f[_0x8209('0x36')]===_0x4c9ded;});}if(_0x41f6ae>=0x0){logger[_0x8209('0x30')](_0x8209('0x37'));}else{logger[_0x8209('0x30')](_0x8209('0x38'));_0x41f6ae=_['findIndex'](_0x3e68f2[_0x8209('0x34')],function(_0x19ffc7){return _0x19ffc7[_0x8209('0x39')][_0x8209('0x17')]===_0x8209('0x3a');});}return _0x3e68f2[_0x8209('0x34')][_0x41f6ae];}else{if(_0x3e68f2[_0x8209('0x3b')][_0x8209('0x39')][_0x8209('0x17')]===_0x8209('0x3a')){logger[_0x8209('0x30')](_0x8209('0x38'));user=_0x3e68f2['user'];return user;}else{logger[_0x8209('0x2d')](_0x8209('0x3c'),JSON[_0x8209('0xc')](_0x3e68f2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x8209('0xc')](_0x3e68f2));}}}else{logger[_0x8209('0x2d')](_0x8209('0x3c'),JSON[_0x8209('0xc')](_0x3e68f2));throw new Error(_0x8209('0x3d')+JSON[_0x8209('0xc')](_0x3e68f2));}})[_0x8209('0x2c')](function(_0x3858c2){console[_0x8209('0x2d')](_0x3858c2);});}function getZohoUser(_0x30275f,_0x575820){return new BPromise(function(_0x30d5c1,_0x2c4872){request(_0x30275f)[_0x8209('0x29')](function(_0x1a8f86){var _0xcd183a=null;if(_0x1a8f86){_0xcd183a=_0x1a8f86[_0x8209('0x3e')][0x0];_0xcd183a['enduserType']=_0x575820;}_0x30d5c1(_0xcd183a);})[_0x8209('0x2c')](function(_0x312c5e){_0x2c4872(_0x312c5e);});});}function createEndUser(_0x5b9377,_0x12d273,_0x3b8b71,_0x148f88,_0x3433d0,_0x4b6b87){var _0x3b8b71=getName(_0x3b8b71);return request({'method':'POST','uri':_0x8209('0x3f')+_0x12d273+_0x8209('0x40')+_['startCase'](_0x4b6b87[_0x8209('0x41')])+'s','body':{'data':[{'Last_Name':_0x3b8b71[0x1],'First_Name':_0x3b8b71[0x0],'Phone':_0x148f88,'Owner':{'name':!_[_0x8209('0x1b')](_0x3433d0[_0x8209('0x42')][_0x8209('0x17')])?_0x3433d0[_0x8209('0x42')][_0x8209('0x17')]:!_['isNil'](_0x3433d0[_0x8209('0x43')])?_0x3433d0[_0x8209('0x43')]+'\x20'+_0x3433d0['last_name']:_0x3433d0['last_name'],'id':_0x3433d0['id']}}]},'headers':{'Authorization':_0x8209('0x44')+_0x5b9377},'json':!![]})[_0x8209('0x29')](function(_0x1f1fa2){if(_0x1f1fa2&&_0x1f1fa2['data'][0x0][_0x8209('0x45')]===_0x8209('0x46')){var _0x45dc96=_0x1f1fa2[_0x8209('0x3e')][0x0][_0x8209('0x47')];_0x45dc96[_0x8209('0x48')]=_[_0x8209('0x49')](_0x4b6b87['moduleCreate'])+'s';return _0x45dc96;}logger[_0x8209('0x2d')](_0x8209('0x3c'),JSON[_0x8209('0xc')](data));throw new Error('Error:\x20'+JSON[_0x8209('0xc')](data));})[_0x8209('0x2c')](function(_0x44ae3e){console[_0x8209('0x4a')](_0x8209('0x4b'),_0x44ae3e);});}function getEndUser(_0x576335,_0x4c175d,_0x45644d,_0x571dc2,_0x500ebc,_0x19be59,_0x2b5513){var _0x153515={'method':_0x8209('0x4c'),'uri':'','headers':{'Authorization':_0x8209('0x44')+_0x576335},'json':!![]};switch(_0x2b5513[_0x8209('0x4d')]){case'contact_lead':_0x153515['uri']=_0x8209('0x3f')+_0x4c175d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x500ebc+'))';return getZohoUser(_0x153515,_0x8209('0x4e'))[_0x8209('0x29')](function(_0x48a5ee){if(_0x48a5ee)return _0x48a5ee;_0x153515[_0x8209('0x4f')]=_0x8209('0x3f')+_0x4c175d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x500ebc+'))';return getZohoUser(_0x153515,_0x8209('0x50'))[_0x8209('0x29')](function(_0x50bd88){if(_0x50bd88)return _0x50bd88;if(_0x2b5513[_0x8209('0x41')]!=_0x8209('0x51')){return createEndUser(_0x576335,_0x4c175d,_0x571dc2,_0x500ebc,_0x19be59,_0x2b5513);}else{return{};}});});break;case'contact':_0x153515[_0x8209('0x4f')]=_0x8209('0x3f')+_0x4c175d+_0x8209('0x52')+_0x500ebc+'))';return getZohoUser(_0x153515,'Contacts')[_0x8209('0x29')](function(_0x2dee07){if(_0x2dee07)return _0x2dee07;if(_0x2b5513[_0x8209('0x41')]!=_0x8209('0x51')){return createEndUser(_0x576335,_0x4c175d,_0x571dc2,_0x500ebc,_0x19be59,_0x2b5513);}else{return{};}});break;case _0x8209('0x53'):_0x153515['uri']=_0x8209('0x3f')+_0x4c175d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x500ebc+'))';return getZohoUser(_0x153515,_0x8209('0x50'))[_0x8209('0x29')](function(_0x582993){if(_0x582993)return _0x582993;if(_0x2b5513['moduleCreate']!=_0x8209('0x51')){return createEndUser(_0x576335,_0x4c175d,_0x571dc2,_0x500ebc,_0x19be59,_0x2b5513);}else{return{};}});break;}}function getCall(_0x3f3653,_0x3c1678,_0x557b74,_0x3b51b8,_0x52bdf2,_0x3761d0,_0x5555c2,_0x553c6b){logger['info']('Creating\x20new\x20call...');var _0x257f1e={};_0x257f1e[_0x8209('0x54')]={'name':!_[_0x8209('0x1b')](_0x3b51b8[_0x8209('0x42')][_0x8209('0x17')])&&!_[_0x8209('0x1b')](_0x3b51b8['profile'][_0x8209('0x17')])&&_0x3b51b8[_0x8209('0x39')][_0x8209('0x17')]===_0x8209('0x55')?_0x3b51b8['role'][_0x8209('0x17')]:!_[_0x8209('0x1b')](_0x3b51b8[_0x8209('0x43')])?_0x3b51b8[_0x8209('0x43')]+'\x20'+_0x3b51b8[_0x8209('0x56')]:_0x3b51b8[_0x8209('0x56')],'id':_0x3b51b8['id']};_0x257f1e['Subject']=intUtil[_0x8209('0x57')](_0x3761d0[_0x8209('0x58')],_0x5555c2,'\x20');_0x257f1e[_0x8209('0x59')]=intUtil[_0x8209('0x57')](_0x3761d0['Descriptions'],_0x5555c2,'\x0a');if(_0x52bdf2[_0x8209('0x48')]===_0x8209('0x4e')){_0x257f1e['Who_Id']={'name':!_[_0x8209('0x1b')](_0x52bdf2['Full_Name'])?_0x52bdf2[_0x8209('0x5a')]:!_[_0x8209('0x1b')](_0x52bdf2[_0x8209('0x5b')])?_0x52bdf2[_0x8209('0x5b')]+'\x20'+_0x52bdf2[_0x8209('0x5c')]:_0x52bdf2['Last_Name'],'id':_0x52bdf2['id']};}if(_0x52bdf2[_0x8209('0x48')]==='Leads'){_0x257f1e[_0x8209('0x5d')]={'name':!_[_0x8209('0x1b')](_0x52bdf2[_0x8209('0x5a')])?_0x52bdf2[_0x8209('0x5a')]:!_[_0x8209('0x1b')](_0x52bdf2[_0x8209('0x5b')])?_0x52bdf2[_0x8209('0x5b')]+'\x20'+_0x52bdf2[_0x8209('0x5c')]:_0x52bdf2[_0x8209('0x5c')],'id':_0x52bdf2['id']};_0x257f1e[_0x8209('0x5e')]=_[_0x8209('0x49')](_0x52bdf2[_0x8209('0x48')]);}if(_0x5555c2[_0x8209('0x5f')]){_0x257f1e[_0x8209('0x60')]=moment[_0x8209('0x61')](parseInt(_0x5555c2[_0x8209('0x5f')])*0x3e8)[_0x8209('0x31')](_0x8209('0x62'));}else if(_0x5555c2[_0x8209('0x63')]&&_0x5555c2[_0x8209('0x64')]){_0x257f1e[_0x8209('0x60')]=moment[_0x8209('0x61')](moment(_0x5555c2[_0x8209('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x8209('0x65')](moment(_0x5555c2[_0x8209('0x66')],_0x8209('0x67'))))[_0x8209('0x31')](_0x8209('0x62'));}switch(_0x5555c2['lastevent']){case _0x8209('0x68'):_0x257f1e[_0x8209('0x69')]=_0x8209('0x6a');break;case _0x8209('0x6b'):case _0x8209('0x6c'):_0x257f1e['Call_Result']=_0x8209('0x6d');break;case _0x8209('0x6e'):_0x257f1e[_0x8209('0x69')]='Rejected';break;case _0x8209('0x6f'):_0x257f1e[_0x8209('0x69')]='Abandoned';break;case _0x8209('0x70'):_0x257f1e[_0x8209('0x69')]=_0x8209('0x71');default:}_0x257f1e['Call_Start_Time']=(_0x553c6b===_0x8209('0x72')?moment(_0x5555c2[_0x8209('0x66')])[_0x8209('0x31')](_0x8209('0x67')):moment(_0x5555c2[_0x8209('0x73')])[_0x8209('0x31')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x8209('0x31')](_0x8209('0x67'));_0x257f1e[_0x8209('0x74')]=_0x553c6b||_0x8209('0x75');_0x257f1e=_[_0x8209('0x76')](_0x257f1e,getCustomFields(_0x3761d0[_0x8209('0x77')],_0x5555c2));return request({'method':_0x8209('0x23'),'uri':_0x8209('0x3f')+_0x3c1678+_0x8209('0x78'),'headers':{'Authorization':_0x8209('0x44')+_0x3f3653},'body':{'data':[_0x257f1e]},'json':!![]})['then'](function(_0x39bed5){if(_0x39bed5&&_0x39bed5[_0x8209('0x3e')][0x0][_0x8209('0x45')]===_0x8209('0x46')){logger[_0x8209('0x30')](_0x8209('0x79'));return{'id':_0x39bed5['data'][0x0][_0x8209('0x47')]['id']};}})[_0x8209('0x2c')](function(_0x4f98e4){logger[_0x8209('0x30')]('err',_0x4f98e4['stack']);console[_0x8209('0x4a')](_0x8209('0x7a'),_0x4f98e4);});}exports[_0x8209('0x7b')]=function(_0x2f0249,_0x3e3d93,_0x35b81a,_0x2f244c,_0x5c61c8,_0x59f659){var _0x40025b,_0x4e0834,_0x562299;_0x59f659[_0x8209('0x7c')]=intUtil['stripTrailingSlash'](_0x59f659[_0x8209('0x7c')]);_0x59f659[_0x8209('0x7d')]=intUtil[_0x8209('0x7e')](_0x59f659[_0x8209('0x7d')]);if(_0x5c61c8&&_0x5c61c8[_0x8209('0x7f')]){logger[_0x8209('0x30')](_0x8209('0x80'),_0x8209('0x81'));_0x3e3d93[_0x8209('0x82')]=_0x59f659[_0x8209('0x7d')]+_0x8209('0x83')+_0x3e3d93[_0x8209('0x84')]+_0x8209('0x85')+md5(_0x3e3d93[_0x8209('0x84')]);}else{_0x3e3d93[_0x8209('0x82')]='';}var _0x350402=_0x59f659[_0x8209('0x7c')]===_0x8209('0x86')?'eu':_0x8209('0x87');return getAccessToken(_0x59f659)['then'](function(_0x1c0ab8){_0x562299=_0x1c0ab8;return getUser(_0x562299,_0x350402,_0x59f659,_0x2f244c['email']);})['then'](function(_0xfb3bc1){_0x40025b=_0xfb3bc1;logger[_0x8209('0x30')]('The\x20User\x20ID\x20is:',_0x40025b['id']);return getEndUser(_0x562299,_0x350402,_0x59f659,_0x3e3d93[_0x8209('0x88')],_0x3e3d93['calleridnum'],_0x40025b,_0x35b81a);})[_0x8209('0x29')](function(_0x5a060e){_0x4e0834=_0x5a060e;return getCall(_0x562299,_0x350402,_0x59f659,_0x40025b,_0x4e0834,_0x35b81a,_0x3e3d93,_0x8209('0x75'));})['then'](function(_0x369713){if(_0x369713){logger[_0x8209('0x30')](_0x8209('0x89'),_0x369713['id']);logger['info'](_0x8209('0x80'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8209('0x31')](_0x8209('0x8a'),_0x2f244c[_0x8209('0x17')]),'trigger:browser:url',{'uri':_0x8209('0x8b')+_0x59f659[_0x8209('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x369713['id']});}})[_0x8209('0x2c')](function(_0x163677){logger['error']('[QUEUE]',JSON[_0x8209('0xc')](_0x163677));});};exports['outbound']=function(_0x489cde,_0x42b039,_0x84fc4f,_0x23c6a2,_0x3a92a3,_0x52e806,_0x410a85){var _0x59232c,_0x32624,_0x3b7c5d;_0x52e806[_0x8209('0x7c')]=intUtil[_0x8209('0x7e')](_0x52e806[_0x8209('0x7c')]);_0x52e806['serverUrl']=intUtil[_0x8209('0x7e')](_0x52e806[_0x8209('0x7d')]);if(_0x410a85&&_0x410a85[_0x8209('0x8c')]&&_0x410a85[_0x8209('0x8c')]!==_0x8209('0x8d')){logger[_0x8209('0x30')](_0x8209('0x8e'),_0x8209('0x81'));_0x42b039['recordingURL']=_0x52e806['serverUrl']+_0x8209('0x83')+_0x42b039[_0x8209('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x42b039[_0x8209('0x84')]);}var _0x5f12db=_0x52e806[_0x8209('0x7c')]===_0x8209('0x86')?'eu':_0x8209('0x87');return getAccessToken(_0x52e806)[_0x8209('0x29')](function(_0x5cdd3e){_0x3b7c5d=_0x5cdd3e;return getUser(_0x3b7c5d,_0x5f12db,_0x52e806,_0x23c6a2[_0x8209('0x36')]);})['then'](function(_0x45507b){_0x59232c=_0x45507b;logger[_0x8209('0x30')]('The\x20User\x20ID\x20is:',_0x59232c['id']);return getEndUser(_0x3b7c5d,_0x5f12db,_0x52e806,_0x42b039[_0x8209('0x8f')],_0x42b039[_0x8209('0x90')],_0x59232c,_0x84fc4f);})[_0x8209('0x29')](function(_0x2a7340){_0x32624=_0x2a7340;return getCall(_0x3b7c5d,_0x5f12db,_0x52e806,_0x59232c,_0x32624,_0x84fc4f,_0x42b039,_0x8209('0x91'));})[_0x8209('0x29')](function(_0x5ae00e){if(_0x5ae00e){logger[_0x8209('0x30')](_0x8209('0x89'),_0x5ae00e['id']);logger[_0x8209('0x30')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8209('0x31')]('user:%s',_0x23c6a2[_0x8209('0x17')]),_0x8209('0x92'),{'uri':_0x8209('0x8b')+_0x52e806['host']+_0x8209('0x93')+_0x5ae00e['id']});}})[_0x8209('0x2c')](function(_0x570acf){logger['error']('[OUTBOUND]',JSON['stringify'](_0x570acf));});};exports[_0x8209('0x94')]=function(_0xab66ba,_0x3a8c77,_0x2b4e25,_0x2773e0,_0x29474d,_0x5cc805){var _0x17f64f,_0xbe6589,_0x4061b3;_0x5cc805[_0x8209('0x7c')]=intUtil['stripTrailingSlash'](_0x5cc805[_0x8209('0x7c')]);_0x5cc805[_0x8209('0x7d')]=intUtil[_0x8209('0x7e')](_0x5cc805[_0x8209('0x7d')]);if(_0x29474d&&_0x29474d[_0x8209('0x7f')]){logger['info']('['+_0x3a8c77[_0x8209('0x95')][_0x8209('0x96')]()+']',_0x8209('0x81'));_0x3a8c77[_0x8209('0x82')]=_0x5cc805[_0x8209('0x7d')]+'/api/voice/recordings/'+_0x3a8c77[_0x8209('0x84')]+_0x8209('0x85')+md5(_0x3a8c77[_0x8209('0x84')]);}else{_0x3a8c77[_0x8209('0x82')]='';}var _0x4ff388=_0x5cc805['host']===_0x8209('0x86')?'eu':'com';return getAccessToken(_0x5cc805)[_0x8209('0x29')](function(_0x1ca0fe){_0x4061b3=_0x1ca0fe;return getUser(_0x4061b3,_0x4ff388,_0x5cc805);})[_0x8209('0x29')](function(_0x1522d4){_0x17f64f=_0x1522d4;logger['info'](_0x8209('0x97'),_0x17f64f['id']);return getEndUser(_0x4061b3,_0x4ff388,_0x5cc805,_0x3a8c77[_0x8209('0x88')],_0x3a8c77[_0x8209('0x98')],_0x17f64f,_0x2b4e25);})[_0x8209('0x29')](function(_0x8411b){_0xbe6589=_0x8411b;return getCall(_0x4061b3,_0x4ff388,_0x5cc805,_0x17f64f,_0xbe6589,_0x2b4e25,_0x3a8c77,_0x8209('0x75'));})[_0x8209('0x29')](function(_0x22fccc){if(_0x22fccc){logger['info'](_0x8209('0x89'),_0x22fccc['id']);}})[_0x8209('0x2c')](function(_0x597527){logger['error']('['+_0x3a8c77['lastevent'][_0x8209('0x96')]()+']',JSON[_0x8209('0xc')](_0x597527));});}; \ 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 0f2f9eb..451e170 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 _0xeee8=['Script','data3','render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','shelljs','mustache','data2'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0xeee8,0x147));var _0x8eee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeee8[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var sh=require(_0x8eee('0x0'));var Mustache=require(_0x8eee('0x1'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0xbf33e9,_0x30f039){var _0x561e32=_0xbf33e9['data2']?_0xbf33e9[_0x8eee('0x2')]:_0x8eee('0x3');var _0x146619=_0xbf33e9[_0x8eee('0x4')]?Mustache[_0x8eee('0x5')](_0xbf33e9[_0x8eee('0x4')],_0x30f039):_0x30f039;sh[_0x8eee('0x6')](_0x146619,function(_0x4c7cc5,_0x5d69d1,_0x180104){if(_0x4c7cc5!==0x0){logger['error'](util[_0x8eee('0x7')](_0x8eee('0x8'),_0x561e32,_0x146619,_0x4c7cc5,_0x180104));}else{logger[_0x8eee('0x9')](util[_0x8eee('0x7')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x561e32,_0x146619,_0x5d69d1));}});}; \ No newline at end of file +var _0xdfd3=['render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x4c8afa,_0x3fba3a){var _0x5d9f55=function(_0x40dc18){while(--_0x40dc18){_0x4c8afa['push'](_0x4c8afa['shift']());}};_0x5d9f55(++_0x3fba3a);}(_0xdfd3,0x14b));var _0x3dfd=function(_0x5864ef,_0x496812){_0x5864ef=_0x5864ef-0x0;var _0x21c244=_0xdfd3[_0x5864ef];return _0x21c244;};'use strict';var util=require(_0x3dfd('0x0'));var sh=require(_0x3dfd('0x1'));var Mustache=require(_0x3dfd('0x2'));var logger=require(_0x3dfd('0x3'))(_0x3dfd('0x4'));exports[_0x3dfd('0x5')]=function(_0x16afc3,_0x3c0dc4){var _0x2a53cc=_0x16afc3[_0x3dfd('0x6')]?_0x16afc3['data2']:'Script';var _0x5eba57=_0x16afc3['data3']?Mustache[_0x3dfd('0x7')](_0x16afc3[_0x3dfd('0x8')],_0x3c0dc4):_0x3c0dc4;sh[_0x3dfd('0x5')](_0x5eba57,function(_0x2befea,_0x3cb59b,_0x4286bd){if(_0x2befea!==0x0){logger[_0x3dfd('0x9')](util[_0x3dfd('0xa')](_0x3dfd('0xb'),_0x2a53cc,_0x5eba57,_0x2befea,_0x4286bd));}else{logger['info'](util[_0x3dfd('0xa')](_0x3dfd('0xc'),_0x2a53cc,_0x5eba57,_0x3cb59b));}});}; \ 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 43aad0b..c74ebab 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 _0xacb1=['DELETE','POST','PUT','data7','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','exec','data1','toUpperCase','data2','number','data5','headers','data6','parse','render','error'];(function(_0x1d6202,_0x18b0b3){var _0x75d444=function(_0x339a18){while(--_0x339a18){_0x1d6202['push'](_0x1d6202['shift']());}};_0x75d444(++_0x18b0b3);}(_0xacb1,0x75));var _0x1acb=function(_0x32cd27,_0x52cfd8){_0x32cd27=_0x32cd27-0x0;var _0x28b225=_0xacb1[_0x32cd27];return _0x28b225;};'use strict';var rp=require(_0x1acb('0x0'));var util=require(_0x1acb('0x1'));var _=require('lodash');var Mustache=require(_0x1acb('0x2'));var logger=require(_0x1acb('0x3'))('trigger');exports[_0x1acb('0x4')]=function(_0x4d203b,_0x2a3ce5){var _0xc1cb7b,_0x58d79f;var _0x281f2c={'method':_0x4d203b[_0x1acb('0x5')][_0x1acb('0x6')](),'uri':Mustache['render'](_0x4d203b[_0x1acb('0x7')],_0x2a3ce5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4d203b['data5'])===_0x1acb('0x8')&&parseInt(_0x4d203b[_0x1acb('0x9')])>=0x1&&parseInt(_0x4d203b[_0x1acb('0x9')])<=0xa?parseInt(_0x4d203b['data5'])*0x3e8:0x5*0x3e8};try{_0x281f2c[_0x1acb('0xa')]=_0x4d203b[_0x1acb('0xb')]?JSON[_0x1acb('0xc')](Mustache[_0x1acb('0xd')](_0x4d203b[_0x1acb('0xb')],_0x2a3ce5)):{};}catch(_0x3647d6){logger[_0x1acb('0xe')](_0x3647d6['stack']);}switch(_0x4d203b[_0x1acb('0x5')][_0x1acb('0x6')]()){case'GET':case _0x1acb('0xf'):_0xc1cb7b=null;_0x281f2c['qs']=_0x2a3ce5;break;case _0x1acb('0x10'):case _0x1acb('0x11'):if(_0x4d203b[_0x1acb('0x12')]){try{_0xc1cb7b=JSON[_0x1acb('0xc')](Mustache[_0x1acb('0xd')](_0x4d203b['data7'],_0x2a3ce5));_0x281f2c['body']=_0xc1cb7b;}catch(_0x5cf075){logger[_0x1acb('0xe')](_0x5cf075[_0x1acb('0x13')]);logger[_0x1acb('0xe')](_0x1acb('0x14'));}}else{_0xc1cb7b=_0x2a3ce5;_0x281f2c[_0x1acb('0x15')]=_0xc1cb7b;}break;}logger[_0x1acb('0x16')](util[_0x1acb('0x17')](_0x1acb('0x18'),_0x4d203b[_0x1acb('0x5')],_0x4d203b[_0x1acb('0x7')],JSON[_0x1acb('0x19')](_0x281f2c)));rp(_0x281f2c)[_0x1acb('0x1a')](function(_0x2db538){_0xc1cb7b=!_[_0x1acb('0x1b')](_0xc1cb7b)?',\x20request\x20body:\x20'+_0xc1cb7b:'';_0x58d79f=typeof _0x2db538[_0x1acb('0x15')]===_0x1acb('0x1c')?JSON['stringify'](_0x2db538[_0x1acb('0x15')]):_0x2db538[_0x1acb('0x15')];logger[_0x1acb('0x16')](util[_0x1acb('0x17')](_0x1acb('0x1d'),_0x4d203b[_0x1acb('0x5')],_0x4d203b[_0x1acb('0x7')],_0x2db538['statusCode'],_0x58d79f));})['catch'](function(_0x4e0443){logger[_0x1acb('0xe')](util['format'](_0x1acb('0x1e'),_0x4d203b[_0x1acb('0x5')],_0x4d203b[_0x1acb('0x7')],_0x4e0443['statusCode'],_0x4e0443[_0x1acb('0x1f')],_0x4e0443[_0x1acb('0x20')]));});}; \ No newline at end of file +var _0x4652=['parse','stack','GET','DELETE','POST','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then',',\x20request\x20body:\x20','object','%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','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','number','data5','headers','data6'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4652,0xdc));var _0x2465=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4652[_0xfae23b];return _0x200640;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var Mustache=require(_0x2465('0x0'));var logger=require(_0x2465('0x1'))(_0x2465('0x2'));exports[_0x2465('0x3')]=function(_0x4c8a8e,_0x46eff2){var _0x76dadd,_0x57aaf4;var _0x1b9968={'method':_0x4c8a8e[_0x2465('0x4')][_0x2465('0x5')](),'uri':Mustache[_0x2465('0x6')](_0x4c8a8e['data2'],_0x46eff2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4c8a8e['data5'])===_0x2465('0x7')&&parseInt(_0x4c8a8e[_0x2465('0x8')])>=0x1&&parseInt(_0x4c8a8e[_0x2465('0x8')])<=0xa?parseInt(_0x4c8a8e[_0x2465('0x8')])*0x3e8:0x5*0x3e8};try{_0x1b9968[_0x2465('0x9')]=_0x4c8a8e[_0x2465('0xa')]?JSON[_0x2465('0xb')](Mustache[_0x2465('0x6')](_0x4c8a8e[_0x2465('0xa')],_0x46eff2)):{};}catch(_0x37ec18){logger['error'](_0x37ec18[_0x2465('0xc')]);}switch(_0x4c8a8e[_0x2465('0x4')][_0x2465('0x5')]()){case _0x2465('0xd'):case _0x2465('0xe'):_0x76dadd=null;_0x1b9968['qs']=_0x46eff2;break;case _0x2465('0xf'):case'PUT':if(_0x4c8a8e[_0x2465('0x10')]){try{_0x76dadd=JSON[_0x2465('0xb')](Mustache[_0x2465('0x6')](_0x4c8a8e[_0x2465('0x10')],_0x46eff2));_0x1b9968[_0x2465('0x11')]=_0x76dadd;}catch(_0x45c0a6){logger['error'](_0x45c0a6[_0x2465('0xc')]);logger[_0x2465('0x12')](_0x2465('0x13'));}}else{_0x76dadd=_0x46eff2;_0x1b9968['body']=_0x76dadd;}break;}logger['info'](util[_0x2465('0x14')](_0x2465('0x15'),_0x4c8a8e['data1'],_0x4c8a8e[_0x2465('0x16')],JSON[_0x2465('0x17')](_0x1b9968)));rp(_0x1b9968)[_0x2465('0x18')](function(_0x14ad42){_0x76dadd=!_['isNil'](_0x76dadd)?_0x2465('0x19')+_0x76dadd:'';_0x57aaf4=typeof _0x14ad42['body']===_0x2465('0x1a')?JSON[_0x2465('0x17')](_0x14ad42[_0x2465('0x11')]):_0x14ad42[_0x2465('0x11')];logger['info'](util[_0x2465('0x14')](_0x2465('0x1b'),_0x4c8a8e[_0x2465('0x4')],_0x4c8a8e[_0x2465('0x16')],_0x14ad42[_0x2465('0x1c')],_0x57aaf4));})[_0x2465('0x1d')](function(_0x2389f3){logger[_0x2465('0x12')](util[_0x2465('0x14')](_0x2465('0x1e'),_0x4c8a8e[_0x2465('0x4')],_0x4c8a8e['data2'],_0x2389f3[_0x2465('0x1c')],_0x2389f3[_0x2465('0x1f')],_0x2389f3[_0x2465('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 47647ec..0fa2366 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 _0x5c23=['rpc','error','message','result','jayson/promise','bluebird','routing','client','http','Request','request','then','debug'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0x5c23,0x149));var _0x35c2=function(_0x1f3673,_0x1d68aa){_0x1f3673=_0x1f3673-0x0;var _0x5307a8=_0x5c23[_0x1f3673];return _0x5307a8;};'use strict';var jayson=require(_0x35c2('0x0'));var BPromise=require(_0x35c2('0x1'));var logger=require('../../config/logger')(_0x35c2('0x2'));var client=jayson[_0x35c2('0x3')][_0x35c2('0x4')]({'port':0x2329});client[_0x35c2('0x5')]=function(_0x47d8f0,_0x53c09e){return new BPromise(function(_0x17b419,_0x39c69b){return client[_0x35c2('0x6')](_0x47d8f0,_0x53c09e)[_0x35c2('0x7')](function(_0x2848d1){logger[_0x35c2('0x8')](_0x35c2('0x9'),'routing',_0x47d8f0,_0x53c09e,_0x2848d1);if(_0x2848d1[_0x35c2('0xa')]){logger[_0x35c2('0xa')](_0x35c2('0x9'),_0x35c2('0x2'),_0x47d8f0,_0x2848d1[_0x35c2('0xa')][_0x35c2('0xb')],_0x53c09e);return _0x39c69b(_0x2848d1[_0x35c2('0xa')]['message']);}else{return _0x17b419(_0x2848d1[_0x35c2('0xc')]);}})['catch'](function(_0x49f056){logger[_0x35c2('0xa')]('rpc',_0x35c2('0x2'),_0x47d8f0,_0x49f056,_0x53c09e);return _0x39c69b(_0x49f056);});});};module['exports']=client; \ No newline at end of file +var _0xc0bc=['result','catch','jayson/promise','bluebird','client','http','request','then','debug','rpc','error','routing','message'];(function(_0xb3ce04,_0x50e9e4){var _0x403a56=function(_0x13a9d9){while(--_0x13a9d9){_0xb3ce04['push'](_0xb3ce04['shift']());}};_0x403a56(++_0x50e9e4);}(_0xc0bc,0x13a));var _0xcc0b=function(_0x5c81cf,_0x6374ec){_0x5c81cf=_0x5c81cf-0x0;var _0x3d368f=_0xc0bc[_0x5c81cf];return _0x3d368f;};'use strict';var jayson=require(_0xcc0b('0x0'));var BPromise=require(_0xcc0b('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xcc0b('0x2')][_0xcc0b('0x3')]({'port':0x2329});client['Request']=function(_0x2b2277,_0x402906){return new BPromise(function(_0x4cb8b6,_0x39e4d7){return client[_0xcc0b('0x4')](_0x2b2277,_0x402906)[_0xcc0b('0x5')](function(_0x45f6d1){logger[_0xcc0b('0x6')](_0xcc0b('0x7'),'routing',_0x2b2277,_0x402906,_0x45f6d1);if(_0x45f6d1[_0xcc0b('0x8')]){logger[_0xcc0b('0x8')](_0xcc0b('0x7'),_0xcc0b('0x9'),_0x2b2277,_0x45f6d1['error'][_0xcc0b('0xa')],_0x402906);return _0x39e4d7(_0x45f6d1[_0xcc0b('0x8')][_0xcc0b('0xa')]);}else{return _0x4cb8b6(_0x45f6d1[_0xcc0b('0xb')]);}})[_0xcc0b('0xc')](function(_0x2a47e1){logger[_0xcc0b('0x8')](_0xcc0b('0x7'),_0xcc0b('0x9'),_0x2b2277,_0x2a47e1,_0x402906);return _0x39e4d7(_0x2a47e1);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index bb76d73..b266c70 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 _0xd0c5=['mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','refresh'];(function(_0xfaf285,_0x5294a1){var _0x49b550=function(_0x254e5b){while(--_0x254e5b){_0xfaf285['push'](_0xfaf285['shift']());}};_0x49b550(++_0x5294a1);}(_0xd0c5,0x1a6));var _0x5d0c=function(_0x75496a,_0x2a7911){_0x75496a=_0x75496a-0x0;var _0x330158=_0xd0c5[_0x75496a];return _0x330158;};'use strict';var server=require(_0x5d0c('0x0'));var Realtime=require(_0x5d0c('0x1'));var EmailChannel=require(_0x5d0c('0x2'));var mailAccount=require(_0x5d0c('0x3'));var setting=require('./rpc/setting');var logger=require(_0x5d0c('0x4'))(_0x5d0c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x5d0c('0x6')]()[_0x5d0c('0x7')](mailAccount[_0x5d0c('0x8')]())[_0x5d0c('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0x5d0c('0x9')](realtime[_0x5d0c('0xa')]);return realtime;});}function main(){return server[_0x5d0c('0xb')](realtime,email)[_0x5d0c('0x7')](function(){return initRealtime();})[_0x5d0c('0x7')](function(){return setting['getSettings']();})[_0x5d0c('0x7')](function(_0x443341){return setInterval(initRealtime,_0x443341[_0x5d0c('0xc')]*0x3e8);})[_0x5d0c('0xd')](function(_0x417043){logger[_0x5d0c('0xe')](_0x5d0c('0xf'),_0x417043);});}main(); \ No newline at end of file +var _0x52ce=['./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x52ce,0x76));var _0xe52c=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x52ce[_0x1b2ff7];return _0x31656a;};'use strict';var server=require(_0xe52c('0x0'));var Realtime=require(_0xe52c('0x1'));var EmailChannel=require(_0xe52c('0x2'));var mailAccount=require(_0xe52c('0x3'));var setting=require('./rpc/setting');var logger=require(_0xe52c('0x4'))(_0xe52c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe52c('0x6')]()[_0xe52c('0x7')](mailAccount['getMailAccounts']())[_0xe52c('0x7')](realtime[_0xe52c('0x8')]())[_0xe52c('0x7')](function(){email[_0xe52c('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0xe52c('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0xe52c('0xa')]();})['then'](function(_0xd6853f){return setInterval(initRealtime,_0xd6853f[_0xe52c('0xb')]*0x3e8);})[_0xe52c('0xc')](function(_0x97ba60){logger[_0xe52c('0xd')](_0xe52c('0xe'),_0x97ba60);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1c0b646..8cc9411 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 _0x4e4d=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','active','service','provider','custom','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','isNil','Smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x4e4d,0xdf));var _0xd4e4=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x4e4d[_0x5466ab];return _0x40751a;};'use strict';var _=require(_0xd4e4('0x0'));var moment=require(_0xd4e4('0x1'));var BPromise=require(_0xd4e4('0x2'));var md5=require(_0xd4e4('0x3'));var Redis=require(_0xd4e4('0x4'));var config=require('../../../config/environment');var logger=require(_0xd4e4('0x5'))(_0xd4e4('0x6'));config[_0xd4e4('0x7')]=_[_0xd4e4('0x8')](config[_0xd4e4('0x7')],{'host':_0xd4e4('0x9'),'port':0x18eb});var io=require(_0xd4e4('0xa'))(new Redis(config['redis']));var EmailImap=require(_0xd4e4('0xb'));var EmailSmtp=require(_0xd4e4('0xc'));var mailAccount=require(_0xd4e4('0xd'));var md5Accounts={};function EmailChannel(_0xf44911){logger[_0xd4e4('0xe')](_0xd4e4('0xf'));this[_0xd4e4('0x10')]=_0xf44911[_0xd4e4('0x10')];this[_0xd4e4('0x11')]={};this[_0xd4e4('0x12')]=new EmailSmtp();}EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x14')]=function(_0x5660ec){var _0x19f4ef=this[_0xd4e4('0x10')][_0x5660ec];var _0xb36ee5={'id':_0x19f4ef['id'],'name':_0x19f4ef[_0xd4e4('0x15')],'key':_0x19f4ef[_0xd4e4('0x16')],'active':_0x19f4ef['active'],'Imap':{'status':_0x19f4ef[_0xd4e4('0x17')]['status'],'messageStatus':_0x19f4ef[_0xd4e4('0x17')][_0xd4e4('0x18')],'total':_0x19f4ef[_0xd4e4('0x17')][_0xd4e4('0x19')]}};if(_['isNil'](md5Accounts[_0x5660ec])){md5Accounts[_0x5660ec]={};}var _0xd4186=md5(JSON[_0xd4e4('0x1a')](_0xb36ee5));if(md5Accounts[_0x5660ec][_0xd4e4('0x3')]!==_0xd4186){md5Accounts[_0x5660ec][_0xd4e4('0x3')]=_0xd4186;io[_0xd4e4('0x14')](_0xd4e4('0x1b'),_0xb36ee5);}};EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x1c')]=function(_0x1fdb5d){for(var _0x4b7ded in _0x1fdb5d){if(_0x1fdb5d[_0xd4e4('0x1d')](_0x4b7ded)){if(_0x1fdb5d[_0x4b7ded]['Imap']&&_0x1fdb5d[_0x4b7ded][_0xd4e4('0x1e')]){var _0x2f10b7=_0x1fdb5d[_0x4b7ded][_0xd4e4('0x17')];if(!_0x2f10b7[_0xd4e4('0x1f')]&&_0x1fdb5d[_0x4b7ded][_0xd4e4('0x20')]!==_0xd4e4('0x21'))_0x2f10b7[_0xd4e4('0x1f')]=_0x1fdb5d[_0x4b7ded][_0xd4e4('0x20')];if(!this[_0xd4e4('0x11')][_0xd4e4('0x1d')](_0x2f10b7['id'])){this[_0xd4e4('0x11')][_0x2f10b7['id']]=new EmailImap(_0x2f10b7,_0x1fdb5d[_0x4b7ded][_0xd4e4('0x6')]);this[_0xd4e4('0x11')][_0x2f10b7['id']]['on']('box',this[_0xd4e4('0x22')][_0xd4e4('0x23')](this,_0x4b7ded));this[_0xd4e4('0x11')][_0x2f10b7['id']]['on']('email',this[_0xd4e4('0x24')][_0xd4e4('0x23')](this,_0x4b7ded));this[_0xd4e4('0x11')][_0x2f10b7['id']]['on'](_0xd4e4('0x25'),this[_0xd4e4('0x26')]['bind'](this,_0x4b7ded));this[_0xd4e4('0x11')][_0x2f10b7['id']]['on'](_0xd4e4('0x27'),this[_0xd4e4('0x28')][_0xd4e4('0x23')](this,_0x4b7ded));}}else{if(_['isNil'](this[_0xd4e4('0x10')][_0x4b7ded]['Imap'])){this[_0xd4e4('0x10')][_0x4b7ded]['Imap']={};}this[_0xd4e4('0x10')][_0x4b7ded][_0xd4e4('0x17')]['status']='disabled';this[_0xd4e4('0x10')][_0x4b7ded][_0xd4e4('0x17')]['messageStatus']='';this[_0xd4e4('0x14')](_0x4b7ded);}}}};EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x22')]=function(_0x31cfbf,_0x4b9ddb){if(this[_0xd4e4('0x10')][_0x31cfbf]){this[_0xd4e4('0x10')][_0x31cfbf][_0xd4e4('0x17')][_0xd4e4('0x29')]=_0xd4e4('0x2a');this['mailAccounts'][_0x31cfbf][_0xd4e4('0x17')]['messageStatus']=_0x4b9ddb[_0xd4e4('0x15')];if(_0x4b9ddb[_0xd4e4('0x2b')]){this[_0xd4e4('0x10')][_0x31cfbf]['Imap'][_0xd4e4('0x19')]=_0x4b9ddb['messages'][_0xd4e4('0x19')];}return this[_0xd4e4('0x14')](_0x31cfbf);}};EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x24')]=function(_0x4e9b97,_0x55ca13){logger[_0xd4e4('0xe')](_0xd4e4('0x2c'),_0x55ca13[_0xd4e4('0x2d')],_0x55ca13[_0xd4e4('0x2e')],_0x55ca13[_0xd4e4('0x2f')],_0x4e9b97);if(this[_0xd4e4('0x10')][_0x4e9b97]){return mailAccount['notify'](_0x4e9b97,_0x55ca13)[_0xd4e4('0x30')](function(_0x38e00){if(_0x38e00){logger[_0xd4e4('0xe')](_0xd4e4('0x31'));}})[_0xd4e4('0x32')](function(_0x57dc71){logger[_0xd4e4('0x27')](_0xd4e4('0x33'),JSON[_0xd4e4('0x1a')](_0x57dc71));});}};EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x26')]=function(_0x2a213d){if(this[_0xd4e4('0x10')][_0x2a213d]&&this[_0xd4e4('0x10')][_0x2a213d]['Imap']){if(this[_0xd4e4('0x11')][this[_0xd4e4('0x10')][_0x2a213d][_0xd4e4('0x17')]['id']]){delete this['imapAccounts'][this[_0xd4e4('0x10')][_0x2a213d][_0xd4e4('0x17')]['id']];}this['mailAccounts'][_0x2a213d][_0xd4e4('0x17')][_0xd4e4('0x34')]=moment();this[_0xd4e4('0x14')](_0x2a213d);}};EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x28')]=function(_0x255fb4,_0x29d47e){if(this[_0xd4e4('0x10')][_0x255fb4]){this[_0xd4e4('0x10')][_0x255fb4]['Imap'][_0xd4e4('0x29')]=_0xd4e4('0x27');this[_0xd4e4('0x10')][_0x255fb4][_0xd4e4('0x17')][_0xd4e4('0x18')]=_0x29d47e;return this[_0xd4e4('0x14')](_0x255fb4);}};EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x35')]=function(_0x5b3f6a,_0x1f448b){return this[_0xd4e4('0x12')]['send'](_0x5b3f6a,_0x1f448b);};EmailChannel[_0xd4e4('0x13')][_0xd4e4('0x36')]=function(_0x428b10){var _0x55baa8=this;if(this[_0xd4e4('0x10')][_0x428b10['id']]){if(_[_0xd4e4('0x37')](this[_0xd4e4('0x10')][_0x428b10['id']][_0xd4e4('0x38')])){this[_0xd4e4('0x10')][_0x428b10['id']][_0xd4e4('0x38')]={};}this[_0xd4e4('0x10')][_0x428b10['id']][_0xd4e4('0x38')][_0xd4e4('0x34')]=moment();return new BPromise(function(_0x841502,_0xffcd04){return _0x55baa8['smtp'][_0xd4e4('0x39')](_0x428b10)['then'](function(_0x3563d3){_0x55baa8['mailAccounts'][_0x428b10['id']][_0xd4e4('0x38')]['status']=_0xd4e4('0x3a');_0x55baa8[_0xd4e4('0x10')][_0x428b10['id']][_0xd4e4('0x38')][_0xd4e4('0x18')]='';_0x55baa8[_0xd4e4('0x14')](_0x428b10['id']);_0x841502(_0x3563d3);})[_0xd4e4('0x32')](function(_0x459dce){_0x55baa8[_0xd4e4('0x10')][_0x428b10['id']]['Smtp'][_0xd4e4('0x29')]=_0xd4e4('0x27');_0x55baa8[_0xd4e4('0x10')][_0x428b10['id']][_0xd4e4('0x38')]['messageStatus']=_0x459dce;_0x55baa8['emit'](_0x428b10['id']);_0xffcd04(_0x459dce);});});}return this['smtp']['verify'](_0x428b10);};module['exports']=EmailChannel; \ No newline at end of file +var _0x14ca=['md5','ioredis','email','defaults','redis','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','key','active','Imap','status','total','isNil','stringify','emit','mailAccount:update','prototype','refresh','service','provider','custom','imapAccounts','hasOwnProperty','box','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','handleImapBox','connected','messages','handleImapEmail','info','firstName','lastName','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x14ca,0x193));var _0xa14c=function(_0x18032f,_0x4f4e45){_0x18032f=_0x18032f-0x0;var _0xb0b2b8=_0x14ca[_0x18032f];return _0xb0b2b8;};'use strict';var _=require(_0xa14c('0x0'));var moment=require(_0xa14c('0x1'));var BPromise=require(_0xa14c('0x2'));var md5=require(_0xa14c('0x3'));var Redis=require(_0xa14c('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xa14c('0x5'));config['redis']=_[_0xa14c('0x6')](config[_0xa14c('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa14c('0x7')]));var EmailImap=require(_0xa14c('0x8'));var EmailSmtp=require(_0xa14c('0x9'));var mailAccount=require(_0xa14c('0xa'));var md5Accounts={};function EmailChannel(_0x433fb7){logger['info'](_0xa14c('0xb'));this[_0xa14c('0xc')]=_0x433fb7[_0xa14c('0xc')];this['imapAccounts']={};this[_0xa14c('0xd')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0xdb56fa){var _0x39d3d3=this[_0xa14c('0xc')][_0xdb56fa];var _0x419bfa={'id':_0x39d3d3['id'],'name':_0x39d3d3['name'],'key':_0x39d3d3[_0xa14c('0xe')],'active':_0x39d3d3[_0xa14c('0xf')],'Imap':{'status':_0x39d3d3[_0xa14c('0x10')][_0xa14c('0x11')],'messageStatus':_0x39d3d3['Imap']['messageStatus'],'total':_0x39d3d3[_0xa14c('0x10')][_0xa14c('0x12')]}};if(_[_0xa14c('0x13')](md5Accounts[_0xdb56fa])){md5Accounts[_0xdb56fa]={};}var _0x19d82e=md5(JSON[_0xa14c('0x14')](_0x419bfa));if(md5Accounts[_0xdb56fa][_0xa14c('0x3')]!==_0x19d82e){md5Accounts[_0xdb56fa][_0xa14c('0x3')]=_0x19d82e;io[_0xa14c('0x15')](_0xa14c('0x16'),_0x419bfa);}};EmailChannel[_0xa14c('0x17')][_0xa14c('0x18')]=function(_0x3a11cd){for(var _0x48f25c in _0x3a11cd){if(_0x3a11cd['hasOwnProperty'](_0x48f25c)){if(_0x3a11cd[_0x48f25c][_0xa14c('0x10')]&&_0x3a11cd[_0x48f25c][_0xa14c('0xf')]){var _0x2ca33a=_0x3a11cd[_0x48f25c][_0xa14c('0x10')];if(!_0x2ca33a[_0xa14c('0x19')]&&_0x3a11cd[_0x48f25c][_0xa14c('0x1a')]!==_0xa14c('0x1b'))_0x2ca33a[_0xa14c('0x19')]=_0x3a11cd[_0x48f25c][_0xa14c('0x1a')];if(!this[_0xa14c('0x1c')][_0xa14c('0x1d')](_0x2ca33a['id'])){this[_0xa14c('0x1c')][_0x2ca33a['id']]=new EmailImap(_0x2ca33a,_0x3a11cd[_0x48f25c]['email']);this['imapAccounts'][_0x2ca33a['id']]['on'](_0xa14c('0x1e'),this['handleImapBox'][_0xa14c('0x1f')](this,_0x48f25c));this[_0xa14c('0x1c')][_0x2ca33a['id']]['on'](_0xa14c('0x5'),this['handleImapEmail'][_0xa14c('0x1f')](this,_0x48f25c));this[_0xa14c('0x1c')][_0x2ca33a['id']]['on'](_0xa14c('0x20'),this[_0xa14c('0x21')][_0xa14c('0x1f')](this,_0x48f25c));this[_0xa14c('0x1c')][_0x2ca33a['id']]['on'](_0xa14c('0x22'),this[_0xa14c('0x23')]['bind'](this,_0x48f25c));}}else{if(_[_0xa14c('0x13')](this[_0xa14c('0xc')][_0x48f25c][_0xa14c('0x10')])){this[_0xa14c('0xc')][_0x48f25c][_0xa14c('0x10')]={};}this[_0xa14c('0xc')][_0x48f25c][_0xa14c('0x10')][_0xa14c('0x11')]=_0xa14c('0x24');this['mailAccounts'][_0x48f25c]['Imap'][_0xa14c('0x25')]='';this[_0xa14c('0x15')](_0x48f25c);}}}};EmailChannel[_0xa14c('0x17')][_0xa14c('0x26')]=function(_0x3d094e,_0xd39e8e){if(this[_0xa14c('0xc')][_0x3d094e]){this[_0xa14c('0xc')][_0x3d094e]['Imap'][_0xa14c('0x11')]=_0xa14c('0x27');this[_0xa14c('0xc')][_0x3d094e][_0xa14c('0x10')][_0xa14c('0x25')]=_0xd39e8e['name'];if(_0xd39e8e[_0xa14c('0x28')]){this[_0xa14c('0xc')][_0x3d094e][_0xa14c('0x10')][_0xa14c('0x12')]=_0xd39e8e[_0xa14c('0x28')][_0xa14c('0x12')];}return this[_0xa14c('0x15')](_0x3d094e);}};EmailChannel[_0xa14c('0x17')][_0xa14c('0x29')]=function(_0x1d7c6d,_0x3ce942){logger[_0xa14c('0x2a')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3ce942[_0xa14c('0x2b')],_0x3ce942[_0xa14c('0x2c')],_0x3ce942[_0xa14c('0x2d')],_0x1d7c6d);if(this['mailAccounts'][_0x1d7c6d]){return mailAccount[_0xa14c('0x2e')](_0x1d7c6d,_0x3ce942)[_0xa14c('0x2f')](function(_0x260123){if(_0x260123){logger[_0xa14c('0x2a')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x117d3a){logger['error'](_0xa14c('0x30'),JSON[_0xa14c('0x14')](_0x117d3a));});}};EmailChannel[_0xa14c('0x17')][_0xa14c('0x21')]=function(_0x81aa04){if(this[_0xa14c('0xc')][_0x81aa04]&&this['mailAccounts'][_0x81aa04][_0xa14c('0x10')]){if(this[_0xa14c('0x1c')][this[_0xa14c('0xc')][_0x81aa04][_0xa14c('0x10')]['id']]){delete this[_0xa14c('0x1c')][this[_0xa14c('0xc')][_0x81aa04][_0xa14c('0x10')]['id']];}this['mailAccounts'][_0x81aa04][_0xa14c('0x10')][_0xa14c('0x31')]=moment();this[_0xa14c('0x15')](_0x81aa04);}};EmailChannel[_0xa14c('0x17')]['handleImapError']=function(_0x342cb4,_0xe6d426){if(this[_0xa14c('0xc')][_0x342cb4]){this[_0xa14c('0xc')][_0x342cb4][_0xa14c('0x10')][_0xa14c('0x11')]=_0xa14c('0x22');this[_0xa14c('0xc')][_0x342cb4][_0xa14c('0x10')][_0xa14c('0x25')]=_0xe6d426;return this[_0xa14c('0x15')](_0x342cb4);}};EmailChannel['prototype'][_0xa14c('0x32')]=function(_0x50b478,_0x3aa5b2){return this[_0xa14c('0xd')][_0xa14c('0x33')](_0x50b478,_0x3aa5b2);};EmailChannel[_0xa14c('0x17')][_0xa14c('0x34')]=function(_0x176a9f){var _0x1f6e9b=this;if(this[_0xa14c('0xc')][_0x176a9f['id']]){if(_[_0xa14c('0x13')](this[_0xa14c('0xc')][_0x176a9f['id']][_0xa14c('0x35')])){this[_0xa14c('0xc')][_0x176a9f['id']][_0xa14c('0x35')]={};}this[_0xa14c('0xc')][_0x176a9f['id']][_0xa14c('0x35')][_0xa14c('0x31')]=moment();return new BPromise(function(_0xdc2695,_0x45b63b){return _0x1f6e9b[_0xa14c('0xd')][_0xa14c('0x36')](_0x176a9f)[_0xa14c('0x2f')](function(_0x12c318){_0x1f6e9b['mailAccounts'][_0x176a9f['id']]['Smtp'][_0xa14c('0x11')]=_0xa14c('0x37');_0x1f6e9b['mailAccounts'][_0x176a9f['id']][_0xa14c('0x35')][_0xa14c('0x25')]='';_0x1f6e9b['emit'](_0x176a9f['id']);_0xdc2695(_0x12c318);})[_0xa14c('0x38')](function(_0x552c78){_0x1f6e9b['mailAccounts'][_0x176a9f['id']][_0xa14c('0x35')]['status']=_0xa14c('0x22');_0x1f6e9b['mailAccounts'][_0x176a9f['id']][_0xa14c('0x35')]['messageStatus']=_0x552c78;_0x1f6e9b[_0xa14c('0x15')](_0x176a9f['id']);_0x45b63b(_0x552c78);});});}return this['smtp']['verify'](_0x176a9f);};module[_0xa14c('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 0685627..559d9f5 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 _0x687b=['handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','account','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','password','host','port','tls','autotls','openBox'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x687b,0x14a));var _0xb687=function(_0x2c60d1,_0x5b778f){_0x2c60d1=_0x2c60d1-0x0;var _0xdf6e43=_0x687b[_0x2c60d1];return _0xdf6e43;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var Imap=require(_0xb687('0x2'));var simpleParser=require(_0xb687('0x3'))['simpleParser'];var Iconv=require('iconv')[_0xb687('0x4')];var EventEmitter=require(_0xb687('0x5'))[_0xb687('0x6')];var utils=require(_0xb687('0x7'));var logger=require(_0xb687('0x8'))(_0xb687('0x9'));function EmailImap(_0x16ccf3,_0xf43a1f){this[_0xb687('0xa')]=_0xb687('0xb');this['account']=this[_0xb687('0xc')](_0x16ccf3,_0xf43a1f);this[_0xb687('0x2')]=new Imap(this['account']);this[_0xb687('0x2')][_0xb687('0xd')](_0xb687('0xe'),this[_0xb687('0xf')][_0xb687('0x10')](this));this[_0xb687('0x2')][_0xb687('0xd')](_0xb687('0x11'),this[_0xb687('0x12')]['bind'](this));this[_0xb687('0x2')]['on'](_0xb687('0x13'),this[_0xb687('0x14')][_0xb687('0x10')](this));this['imap']['connect']();}util[_0xb687('0x15')](EmailImap,EventEmitter);EmailImap[_0xb687('0x16')]['getAccount']=function(_0x108fd0,_0x2f1ac0){var _0x1f1f35={'connTimeout':_0x108fd0[_0xb687('0x17')]?_0x108fd0[_0xb687('0x17')]*0x3e8:0x2710,'authTimeout':_0x108fd0[_0xb687('0x18')]?_0x108fd0[_0xb687('0x18')]*0x3e8:0x1388};if(_0x108fd0[_0xb687('0x19')]){_0x1f1f35[_0xb687('0x1a')]=_0x108fd0[_0xb687('0x1a')];_0x1f1f35[_0xb687('0x9')]=_0x2f1ac0||_0x108fd0[_0xb687('0x1a')]||'anonymous@xcally.com';if(_0x108fd0[_0xb687('0x1b')]){_0x1f1f35[_0xb687('0x1c')]=utils[_0xb687('0x1d')](_0x108fd0['CloudProvider']['data5'],_0x108fd0[_0xb687('0x1a')]);}else{_0x1f1f35[_0xb687('0x1e')]=_0x108fd0[_0xb687('0x1e')];}}else{if(_0x108fd0['authentication']){_0x1f1f35[_0xb687('0x1a')]=_0x108fd0['user'];_0x1f1f35[_0xb687('0x1e')]=_0x108fd0[_0xb687('0x1e')];}}_0x1f1f35[_0xb687('0x1f')]=_0x108fd0[_0xb687('0x1f')];_0x1f1f35['port']=_0x108fd0[_0xb687('0x20')]||0x3e1;if(_0x108fd0['tls']){_0x1f1f35[_0xb687('0x21')]=!![];}else{_0x1f1f35[_0xb687('0x21')]=![];_0x1f1f35[_0xb687('0x22')]='required';}return _0x1f1f35;};EmailImap[_0xb687('0x16')][_0xb687('0xf')]=function(){this[_0xb687('0x2')][_0xb687('0x23')](this[_0xb687('0xa')],![],this[_0xb687('0x24')][_0xb687('0x10')](this));};EmailImap[_0xb687('0x16')]['handleOpenBox']=function(_0xf45db0,_0x129347){if(_0xf45db0){this[_0xb687('0x14')](_0xf45db0,!![]);}else{this[_0xb687('0x25')](_0xb687('0x26'),_0x129347);this[_0xb687('0x27')]();}};EmailImap[_0xb687('0x16')][_0xb687('0x28')]=function(_0x3ff9e1){if(_0x3ff9e1){this[_0xb687('0x14')](_0x3ff9e1,!![]);}else{this['imap'][_0xb687('0x11')]();}};EmailImap[_0xb687('0x16')][_0xb687('0x27')]=function(){this[_0xb687('0x2')][_0xb687('0x29')]([_0xb687('0x2a')],this['handleReadUnseen'][_0xb687('0x10')](this));};EmailImap['prototype'][_0xb687('0x2b')]=function(_0x40f35c,_0x6df7a2){if(_0x40f35c){this[_0xb687('0x14')](_0x40f35c,!![]);}else{if(_0x6df7a2[_0xb687('0x2c')]){try{var _0x43d20d=this[_0xb687('0x2')]['fetch'](_0x6df7a2,{'bodies':'','markSeen':!![]});_0x43d20d['on'](_0xb687('0x2d'),this[_0xb687('0x2e')][_0xb687('0x10')](this));_0x43d20d[_0xb687('0xd')](_0xb687('0x13'),this[_0xb687('0x2f')][_0xb687('0x10')](this));_0x43d20d[_0xb687('0xd')](_0xb687('0x11'),this[_0xb687('0x30')][_0xb687('0x10')](this));}catch(_0x59fc92){logger['error'](_0x59fc92);}}else{this[_0xb687('0x2')][_0xb687('0x31')](!![],this[_0xb687('0x28')][_0xb687('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x1ccc25){_0x1ccc25['on'](_0xb687('0x32'),this['handleMessageBody'][_0xb687('0x10')](this));_0x1ccc25[_0xb687('0xd')]('attributes',this[_0xb687('0x33')]['bind'](this));_0x1ccc25[_0xb687('0xd')](_0xb687('0x11'),this[_0xb687('0x34')][_0xb687('0x10')](this));};EmailImap[_0xb687('0x16')][_0xb687('0x35')]=function(_0x5f59d0){simpleParser(_0x5f59d0,{'Iconv':Iconv},this[_0xb687('0x36')][_0xb687('0x10')](this));};EmailImap[_0xb687('0x16')][_0xb687('0x33')]=function(){};EmailImap['prototype'][_0xb687('0x34')]=function(){};EmailImap[_0xb687('0x16')][_0xb687('0x36')]=function(_0xce9624,_0xa3f0f9){if(_0xce9624){logger['error'](_0xce9624);}else{var _0x17ed43=this;utils[_0xb687('0x37')](this[_0xb687('0x38')],_0xa3f0f9,function(_0xdf57ff){_0x17ed43[_0xb687('0x25')](_0xb687('0x9'),_0xdf57ff);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xb687('0x2')]['closeBox'](!![],this[_0xb687('0x28')][_0xb687('0x10')](this));};EmailImap['prototype'][_0xb687('0x2f')]=function(_0x2ce07a){this['handleError'](_0x2ce07a);this[_0xb687('0x2')][_0xb687('0x31')](!![],this[_0xb687('0x28')]['bind'](this));};EmailImap[_0xb687('0x16')][_0xb687('0x12')]=function(){this[_0xb687('0x25')](_0xb687('0x11'));};EmailImap[_0xb687('0x16')][_0xb687('0x14')]=function(_0x21b9ef,_0x4bb665){logger[_0xb687('0x13')]('handleError',this['account'][_0xb687('0x9')],JSON[_0xb687('0x39')](_0x21b9ef));var _0x515985='';if(_0x21b9ef){if(_0x21b9ef[_0xb687('0x3a')]){_0x515985=_0x21b9ef['textCode'];}else{for(var _0x3e886d in _0x21b9ef){if(_0x21b9ef[_0xb687('0x3b')](_0x3e886d)){_0x515985+=_['upperFirst'](_0x3e886d)+':\x20'+_0x21b9ef[_0x3e886d]+'\x0a';}}}}if(_0x4bb665){this[_0xb687('0x2')][_0xb687('0x11')]();}else{this['emit'](_0xb687('0x13'),_0x515985);this[_0xb687('0x25')](_0xb687('0x11'));}};module[_0xb687('0x3c')]=EmailImap; \ No newline at end of file +var _0x32f4=['handleReady','bind','handleEnd','error','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','mailbox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','end','search','handleReadUnseen','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','INBOX','account','once','ready'];(function(_0x23d267,_0x38054e){var _0x1beddf=function(_0x3fa7ca){while(--_0x3fa7ca){_0x23d267['push'](_0x23d267['shift']());}};_0x1beddf(++_0x38054e);}(_0x32f4,0x154));var _0x432f=function(_0x2b8685,_0x1ec254){_0x2b8685=_0x2b8685-0x0;var _0x56cc12=_0x32f4[_0x2b8685];return _0x56cc12;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var Imap=require(_0x432f('0x2'));var simpleParser=require(_0x432f('0x3'))['simpleParser'];var Iconv=require(_0x432f('0x4'))[_0x432f('0x5')];var EventEmitter=require('events')[_0x432f('0x6')];var utils=require(_0x432f('0x7'));var logger=require(_0x432f('0x8'))(_0x432f('0x9'));function EmailImap(_0x2f5f03,_0x5d8cc0){this['mailbox']=_0x432f('0xa');this[_0x432f('0xb')]=this['getAccount'](_0x2f5f03,_0x5d8cc0);this[_0x432f('0x2')]=new Imap(this['account']);this[_0x432f('0x2')][_0x432f('0xc')](_0x432f('0xd'),this[_0x432f('0xe')][_0x432f('0xf')](this));this['imap'][_0x432f('0xc')]('end',this[_0x432f('0x10')]['bind'](this));this[_0x432f('0x2')]['on'](_0x432f('0x11'),this['handleError'][_0x432f('0xf')](this));this[_0x432f('0x2')]['connect']();}util[_0x432f('0x12')](EmailImap,EventEmitter);EmailImap[_0x432f('0x13')]['getAccount']=function(_0x48a4db,_0x28d9e9){var _0x44756d={'connTimeout':_0x48a4db[_0x432f('0x14')]?_0x48a4db[_0x432f('0x14')]*0x3e8:0x2710,'authTimeout':_0x48a4db[_0x432f('0x15')]?_0x48a4db['authTimeout']*0x3e8:0x1388};if(_0x48a4db[_0x432f('0x16')]){_0x44756d[_0x432f('0x17')]=_0x48a4db[_0x432f('0x17')];_0x44756d[_0x432f('0x9')]=_0x28d9e9||_0x48a4db['user']||_0x432f('0x18');if(_0x48a4db[_0x432f('0x19')]){_0x44756d[_0x432f('0x1a')]=utils[_0x432f('0x1b')](_0x48a4db[_0x432f('0x1c')][_0x432f('0x1d')],_0x48a4db['user']);}else{_0x44756d[_0x432f('0x1e')]=_0x48a4db['password'];}}else{if(_0x48a4db[_0x432f('0x1f')]){_0x44756d[_0x432f('0x17')]=_0x48a4db[_0x432f('0x17')];_0x44756d[_0x432f('0x1e')]=_0x48a4db[_0x432f('0x1e')];}}_0x44756d[_0x432f('0x20')]=_0x48a4db[_0x432f('0x20')];_0x44756d[_0x432f('0x21')]=_0x48a4db[_0x432f('0x21')]||0x3e1;if(_0x48a4db[_0x432f('0x22')]){_0x44756d[_0x432f('0x22')]=!![];}else{_0x44756d[_0x432f('0x22')]=![];_0x44756d['autotls']='required';}return _0x44756d;};EmailImap[_0x432f('0x13')]['handleReady']=function(){this[_0x432f('0x2')]['openBox'](this[_0x432f('0x23')],![],this[_0x432f('0x24')][_0x432f('0xf')](this));};EmailImap[_0x432f('0x13')][_0x432f('0x24')]=function(_0x1e347a,_0x59f352){if(_0x1e347a){this[_0x432f('0x25')](_0x1e347a,!![]);}else{this[_0x432f('0x26')]('box',_0x59f352);this[_0x432f('0x27')]();}};EmailImap[_0x432f('0x13')][_0x432f('0x28')]=function(_0x23347e){if(_0x23347e){this[_0x432f('0x25')](_0x23347e,!![]);}else{this[_0x432f('0x2')][_0x432f('0x29')]();}};EmailImap['prototype'][_0x432f('0x27')]=function(){this['imap'][_0x432f('0x2a')](['UNSEEN'],this[_0x432f('0x2b')]['bind'](this));};EmailImap[_0x432f('0x13')]['handleReadUnseen']=function(_0x325a9c,_0x12efe2){if(_0x325a9c){this[_0x432f('0x25')](_0x325a9c,!![]);}else{if(_0x12efe2['length']){try{var _0x6a116e=this[_0x432f('0x2')]['fetch'](_0x12efe2,{'bodies':'','markSeen':!![]});_0x6a116e['on']('message',this[_0x432f('0x2c')][_0x432f('0xf')](this));_0x6a116e[_0x432f('0xc')](_0x432f('0x11'),this[_0x432f('0x2d')][_0x432f('0xf')](this));_0x6a116e['once']('end',this[_0x432f('0x2e')][_0x432f('0xf')](this));}catch(_0x184203){logger['error'](_0x184203);}}else{this[_0x432f('0x2')][_0x432f('0x2f')](!![],this[_0x432f('0x28')][_0x432f('0xf')](this));}}};EmailImap[_0x432f('0x13')][_0x432f('0x2c')]=function(_0x36e700){_0x36e700['on'](_0x432f('0x30'),this['handleMessageBody']['bind'](this));_0x36e700[_0x432f('0xc')](_0x432f('0x31'),this['handleMessageAttributes']['bind'](this));_0x36e700['once'](_0x432f('0x29'),this[_0x432f('0x32')]['bind'](this));};EmailImap[_0x432f('0x13')][_0x432f('0x33')]=function(_0x123697){simpleParser(_0x123697,{'Iconv':Iconv},this['handleSimpleParser'][_0x432f('0xf')](this));};EmailImap[_0x432f('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x432f('0x13')][_0x432f('0x32')]=function(){};EmailImap['prototype'][_0x432f('0x34')]=function(_0x41b292,_0x148a95){if(_0x41b292){logger[_0x432f('0x11')](_0x41b292);}else{var _0x4190c7=this;utils[_0x432f('0x35')](this[_0x432f('0xb')],_0x148a95,function(_0x2d0d80){_0x4190c7[_0x432f('0x26')](_0x432f('0x9'),_0x2d0d80);});}};EmailImap[_0x432f('0x13')]['handleFetchEnd']=function(){this[_0x432f('0x2')]['closeBox'](!![],this[_0x432f('0x28')][_0x432f('0xf')](this));};EmailImap['prototype'][_0x432f('0x2d')]=function(_0x47d44d){this[_0x432f('0x25')](_0x47d44d);this[_0x432f('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x432f('0xf')](this));};EmailImap[_0x432f('0x13')][_0x432f('0x10')]=function(){this[_0x432f('0x26')](_0x432f('0x29'));};EmailImap['prototype']['handleError']=function(_0x53516d,_0x1ceec7){logger[_0x432f('0x11')]('handleError',this[_0x432f('0xb')][_0x432f('0x9')],JSON[_0x432f('0x36')](_0x53516d));var _0x2656eb='';if(_0x53516d){if(_0x53516d[_0x432f('0x37')]){_0x2656eb=_0x53516d[_0x432f('0x37')];}else{for(var _0x2c32d1 in _0x53516d){if(_0x53516d[_0x432f('0x38')](_0x2c32d1)){_0x2656eb+=_[_0x432f('0x39')](_0x2c32d1)+':\x20'+_0x53516d[_0x2c32d1]+'\x0a';}}}}if(_0x1ceec7){this['imap'][_0x432f('0x29')]();}else{this[_0x432f('0x26')]('error',_0x2656eb);this[_0x432f('0x26')](_0x432f('0x29'));}};module[_0x432f('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index ed561c4..504266d 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 _0x8e64=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','verify','toString'];(function(_0x1759ec,_0x1fd97a){var _0x2936a1=function(_0x1fed3e){while(--_0x1fed3e){_0x1759ec['push'](_0x1759ec['shift']());}};_0x2936a1(++_0x1fd97a);}(_0x8e64,0xa6));var _0x48e6=function(_0x4b2455,_0x4471ac){_0x4b2455=_0x4b2455-0x0;var _0x18482b=_0x8e64[_0x4b2455];return _0x18482b;};'use strict';var nodemailer=require(_0x48e6('0x0'));var inlineBase64=require(_0x48e6('0x1'));function EmailSmtp(){}EmailSmtp[_0x48e6('0x2')][_0x48e6('0x3')]=function(_0x1164be,_0x424ef8){return new Promise(function(_0x5d2af6,_0x9f455c){var _0x3d9820=nodemailer[_0x48e6('0x4')](_0x1164be);_0x3d9820[_0x48e6('0x5')](_0x48e6('0x6'),inlineBase64());_0x3d9820[_0x48e6('0x7')](_0x424ef8,function(_0x5c1f30,_0x785d92){if(_0x5c1f30){_0x9f455c(_0x5c1f30['toString']());}else{_0x5d2af6(_0x785d92);}});});};EmailSmtp[_0x48e6('0x2')][_0x48e6('0x8')]=function(_0x18c8cb){return new Promise(function(_0x2709e7,_0xd816a7){var _0x5ade3b=nodemailer[_0x48e6('0x4')](_0x18c8cb);_0x5ade3b[_0x48e6('0x8')](function(_0x256953,_0x4dc640){if(_0x256953){_0xd816a7(_0x256953[_0x48e6('0x9')]());}else{if(_0x4dc640){_0x2709e7(_0x4dc640);}else{_0xd816a7('Not\x20verifired');}}});});};module[_0x48e6('0xa')]=EmailSmtp; \ No newline at end of file +var _0xe9d9=['Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString','verify'];(function(_0x58b301,_0x2b0d5b){var _0x417532=function(_0x263b04){while(--_0x263b04){_0x58b301['push'](_0x58b301['shift']());}};_0x417532(++_0x2b0d5b);}(_0xe9d9,0xe8));var _0x9e9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9d9[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x9e9d('0x0'));function EmailSmtp(){}EmailSmtp[_0x9e9d('0x1')][_0x9e9d('0x2')]=function(_0x38dc70,_0x3aeeca){return new Promise(function(_0x133742,_0x26686c){var _0x1eb007=nodemailer[_0x9e9d('0x3')](_0x38dc70);_0x1eb007['use'](_0x9e9d('0x4'),inlineBase64());_0x1eb007[_0x9e9d('0x5')](_0x3aeeca,function(_0x1902d1,_0x535a54){if(_0x1902d1){_0x26686c(_0x1902d1[_0x9e9d('0x6')]());}else{_0x133742(_0x535a54);}});});};EmailSmtp[_0x9e9d('0x1')][_0x9e9d('0x7')]=function(_0x2a6547){return new Promise(function(_0x3287db,_0x22b99a){var _0x200000=nodemailer[_0x9e9d('0x3')](_0x2a6547);_0x200000['verify'](function(_0x26d6c2,_0xc493fe){if(_0x26d6c2){_0x22b99a(_0x26d6c2[_0x9e9d('0x6')]());}else{if(_0xc493fe){_0x3287db(_0xc493fe);}else{_0x22b99a(_0x9e9d('0x8'));}}});});};module[_0x9e9d('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e863134..621c211 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 _0x9710=['user=','auth=Bearer\x20','base64','lodash','moment','randomstring','util','../../../config/logger','email','head','anonymous','@xcally.com','name','address','substring','split','length','slice','Anonymous','value','generate','test','html','replace','','body','textAsHtml','message','isEmpty','originCc','includes','originTo','bcc','type','attachment','filename','attachment-','format','%s-%s','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9710,0xde));var _0x0971=function(_0x3cf4d2,_0x50d499){_0x3cf4d2=_0x3cf4d2-0x0;var _0x2b2dd0=_0x9710[_0x3cf4d2];return _0x2b2dd0;};'use strict';var _=require(_0x0971('0x0'));var moment=require(_0x0971('0x1'));var random=require(_0x0971('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x0971('0x3'));var tnef=require('node-tnef');var logger=require(_0x0971('0x4'))(_0x0971('0x5'));var config=require('../../../config/environment');function getAddress(_0x13c70c){var _0x17c8cf=_[_0x0971('0x6')](_0x13c70c['value']);return _0x17c8cf&&_0x17c8cf['address']?_0x17c8cf['address']:_0x0971('0x7')+random['generate'](0x6)+_0x0971('0x8');}function getFirstName(_0x532b01){var _0x141867=_['head'](_0x532b01['value']);if(_0x141867&&_0x141867[_0x0971('0x9')]){if(_0x141867[_0x0971('0x9')]==_0x141867[_0x0971('0xa')]){return _0x141867[_0x0971('0x9')][_0x0971('0xb')](0x0,_0x141867['name']['indexOf']('@'));}var _0x2660b9=_0x141867[_0x0971('0x9')][_0x0971('0xc')](/\s+/);return _0x2660b9[_0x0971('0xd')]>0x1?_0x2660b9[_0x0971('0xe')](0x0,-0x1)['join']('\x20'):_0x141867[_0x0971('0x9')];}return _0x0971('0xf');}function getLastName(_0x3aca60){var _0x5e1e88=_[_0x0971('0x6')](_0x3aca60['value']);if(_0x5e1e88&&_0x5e1e88[_0x0971('0x9')]){var _0x1ee8af=_0x5e1e88['name'][_0x0971('0xc')](/\s+/);return _0x1ee8af['length']>0x1?_0x1ee8af['pop']():'';}return'';}function getMails(_0x3c56ae,_0x1ed62d){var _0x210c94='';for(var _0x4d6bd7=0x0;_0x4d6bd7<_0x1ed62d[_0x0971('0x10')][_0x0971('0xd')];_0x4d6bd7+=0x1){if(_0x1ed62d[_0x0971('0x10')][_0x4d6bd7][_0x0971('0xa')]!==_0x3c56ae){if(!_['isEmpty'](_0x210c94)){_0x210c94+=',';}_0x210c94+=_0x1ed62d[_0x0971('0x10')][_0x4d6bd7][_0x0971('0x9')]||_0x1ed62d['value'][_0x4d6bd7][_0x0971('0xa')]||'';_0x210c94+='\x20<';_0x210c94+=_0x1ed62d[_0x0971('0x10')][_0x4d6bd7][_0x0971('0xa')]?_0x1ed62d['value'][_0x4d6bd7]['address']:_0x0971('0x7')+random[_0x0971('0x11')](0x6)+_0x0971('0x8');_0x210c94+='>';}}return _0x210c94;}function parseEmail(_0x224b84,_0x37211e,_0xcbed55){if(_0x37211e['html']){var _0x3a84cd=/)<[^<]*)*<\/script>/gi;while(_0x3a84cd[_0x0971('0x12')](_0x37211e[_0x0971('0x13')])){_0x37211e[_0x0971('0x13')]=_0x37211e[_0x0971('0x13')][_0x0971('0x14')](_0x3a84cd,'');}if(_0x37211e[_0x0971('0x13')]['includes'](_0x0971('0x15'))){var _0x504cde=[];_0x37211e[_0x0971('0x16')][_0x0971('0x17')](_0x11bc0a=>{_0x504cde[_0x0971('0x18')](_0x11bc0a['filename']);});var _0x2073be=/]+>/g;var _0x23e1b2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1f6ceb=_0x37211e[_0x0971('0x13')]['replace'](_0x23e1b2,_0x0971('0x19'));var _0x42afe3=_0x1f6ceb[_0x0971('0x14')](_0x2073be,'_IMG');for(let _0x1cb775=0x0;_0x1cb775<_0x504cde[_0x0971('0xd')];_0x1cb775++){var _0x306394=_0x42afe3[_0x0971('0x14')](_0x0971('0x1a'),'\x20[Attachment:\x20'+_0x504cde[_0x1cb775]+_0x0971('0x1b'));_0x42afe3=_0x306394;}_0x37211e[_0x0971('0x13')]=_0x42afe3;}_0xcbed55['body']=_0x37211e[_0x0971('0x13')];}else{_0xcbed55[_0x0971('0x1c')]=_0x37211e[_0x0971('0x1d')];}if(_0xcbed55['body']){_0xcbed55[_0x0971('0x1c')]=_0xcbed55[_0x0971('0x1c')][_0x0971('0x14')](/0x0){var _0x2477b3=[_0x0971('0x31'),'X-Auto-Response-Suppress:\x20All',_0x0971('0x32')];for(var _0x52485a=0x0;_0x52485a<_0x37211e['headerLines'][_0x0971('0xd')];_0x52485a++){var _0x1758af=_[_0x0971('0x33')](_0x2477b3,_0x37211e[_0x0971('0x30')][_0x52485a][_0x0971('0x34')]);if(_0x1758af>=0x0){_0xcbed55[_0x0971('0x35')]=!![];}}}return _0xcbed55;}exports[_0x0971('0x36')]=function(_0x4eed44,_0x26b44c,_0xc3e327){var _0x324c0e={'from':getAddress(_0x26b44c[_0x0971('0x37')]),'firstName':getFirstName(_0x26b44c['from']),'lastName':getLastName(_0x26b44c[_0x0971('0x37')]),'mapKey':_0x0971('0x5'),'message':{'from':getMails(_0x4eed44[_0x0971('0x5')],_0x26b44c[_0x0971('0x37')]),'to':_0x4eed44[_0x0971('0x5')],'cc':'','subject':_0x26b44c[_0x0971('0x38')]||'','messageId':_0x26b44c[_0x0971('0x39')],'inReplyTo':_0x26b44c[_0x0971('0x3a')],'sentAt':moment(_0x26b44c[_0x0971('0x3b')])[_0x0971('0x28')](_0x0971('0x3c')),'attach':![],'attachments':[]}};if(!_0x26b44c[_0x0971('0x13')]&&!_0x26b44c[_0x0971('0x1d')]){var _0x57a565=_[_0x0971('0x3d')](_0x26b44c['attachments'],{'contentType':_0x0971('0x3e')});if(_0x57a565['length']){logger[_0x0971('0x3f')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x26b44c[_0x0971('0x39')]));tnef['parseBuffer'](_[_0x0971('0x40')](_0x57a565)['content'],function(_0x3ff41d,_0x5c5534){if(_0x5c5534){_0x26b44c[_0x0971('0x13')]=_0x5c5534[_0x0971('0x41')]||_0x0971('0x42');if(_0x5c5534['Attachments']){for(var _0x4b0ea2=0x0;_0x4b0ea2<_0x5c5534[_0x0971('0x43')]['length'];_0x4b0ea2++){var _0x4a4837=_0x5c5534['Attachments'][_0x4b0ea2];_0x324c0e[_0x0971('0x1e')]['attachments'][_0x0971('0x18')]({'filename':_0x4a4837[_0x0971('0x44')],'content':Buffer['from'](_0x4a4837[_0x0971('0x45')])});}}}_0xc3e327(parseEmail(_0x4eed44,_0x26b44c,_0x324c0e));});}else{_0x26b44c[_0x0971('0x13')]='

Empty\x20message

';_0xc3e327(parseEmail(_0x4eed44,_0x26b44c,_0x324c0e));}}else{_0xc3e327(parseEmail(_0x4eed44,_0x26b44c,_0x324c0e));}};exports['generateXOAuth2Token']=function(_0x45c766,_0x958ffc){var _0x5206a1=[_0x0971('0x46')+(_0x958ffc||''),_0x0971('0x47')+_0x45c766,'',''];return Buffer['from'](_0x5206a1[_0x0971('0x2a')](''),'utf-8')['toString'](_0x0971('0x48'));}; \ No newline at end of file +var _0xa5f5=['content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','isAutoreply','from','subject','messageId','inReplyTo','date','format','filter','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','auth=Bearer\x20','utf-8','toString','base64','lodash','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','slice','join','Anonymous','split','length','isEmpty','anonymous','test','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','email','originCc','includes','bcc','attach','attachment-','now','root'];(function(_0x2cb90f,_0x451c65){var _0x17e649=function(_0x472c2c){while(--_0x472c2c){_0x2cb90f['push'](_0x2cb90f['shift']());}};_0x17e649(++_0x451c65);}(_0xa5f5,0x1b9));var _0x5a5f=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa5f5[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x5a5f('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x5a5f('0x1'));var tnef=require(_0x5a5f('0x2'));var logger=require(_0x5a5f('0x3'))('email');var config=require(_0x5a5f('0x4'));function getAddress(_0x160839){var _0x56ac9a=_[_0x5a5f('0x5')](_0x160839[_0x5a5f('0x6')]);return _0x56ac9a&&_0x56ac9a[_0x5a5f('0x7')]?_0x56ac9a['address']:'anonymous'+random[_0x5a5f('0x8')](0x6)+_0x5a5f('0x9');}function getFirstName(_0x367794){var _0x583fa6=_[_0x5a5f('0x5')](_0x367794['value']);if(_0x583fa6&&_0x583fa6[_0x5a5f('0xa')]){if(_0x583fa6[_0x5a5f('0xa')]==_0x583fa6[_0x5a5f('0x7')]){return _0x583fa6[_0x5a5f('0xa')]['substring'](0x0,_0x583fa6['name']['indexOf']('@'));}var _0x5a3b21=_0x583fa6['name']['split'](/\s+/);return _0x5a3b21['length']>0x1?_0x5a3b21[_0x5a5f('0xb')](0x0,-0x1)[_0x5a5f('0xc')]('\x20'):_0x583fa6[_0x5a5f('0xa')];}return _0x5a5f('0xd');}function getLastName(_0x41f590){var _0x24b799=_[_0x5a5f('0x5')](_0x41f590[_0x5a5f('0x6')]);if(_0x24b799&&_0x24b799[_0x5a5f('0xa')]){var _0x4d63dd=_0x24b799[_0x5a5f('0xa')][_0x5a5f('0xe')](/\s+/);return _0x4d63dd[_0x5a5f('0xf')]>0x1?_0x4d63dd['pop']():'';}return'';}function getMails(_0x493ff4,_0x45e5a4){var _0x1f76a8='';for(var _0x1ac204=0x0;_0x1ac204<_0x45e5a4[_0x5a5f('0x6')][_0x5a5f('0xf')];_0x1ac204+=0x1){if(_0x45e5a4[_0x5a5f('0x6')][_0x1ac204]['address']!==_0x493ff4){if(!_[_0x5a5f('0x10')](_0x1f76a8)){_0x1f76a8+=',';}_0x1f76a8+=_0x45e5a4[_0x5a5f('0x6')][_0x1ac204][_0x5a5f('0xa')]||_0x45e5a4[_0x5a5f('0x6')][_0x1ac204]['address']||'';_0x1f76a8+='\x20<';_0x1f76a8+=_0x45e5a4[_0x5a5f('0x6')][_0x1ac204][_0x5a5f('0x7')]?_0x45e5a4[_0x5a5f('0x6')][_0x1ac204][_0x5a5f('0x7')]:_0x5a5f('0x11')+random[_0x5a5f('0x8')](0x6)+_0x5a5f('0x9');_0x1f76a8+='>';}}return _0x1f76a8;}function parseEmail(_0x1b91e6,_0x3ea911,_0x4e0349){if(_0x3ea911['html']){var _0x2b37ed=/)<[^<]*)*<\/script>/gi;while(_0x2b37ed[_0x5a5f('0x12')](_0x3ea911[_0x5a5f('0x13')])){_0x3ea911[_0x5a5f('0x13')]=_0x3ea911[_0x5a5f('0x13')][_0x5a5f('0x14')](_0x2b37ed,'');}if(_0x3ea911[_0x5a5f('0x13')]['includes'](_0x5a5f('0x15'))){var _0x1335ca=[];_0x3ea911[_0x5a5f('0x16')][_0x5a5f('0x17')](_0x5e0aff=>{_0x1335ca[_0x5a5f('0x18')](_0x5e0aff[_0x5a5f('0x19')]);});var _0x4d7698=/]+>/g;var _0xeee54e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1dda2b=_0x3ea911[_0x5a5f('0x13')][_0x5a5f('0x14')](_0xeee54e,_0x5a5f('0x1a'));var _0x3be9bf=_0x1dda2b['replace'](_0x4d7698,_0x5a5f('0x1b'));for(let _0x4aba78=0x0;_0x4aba78<_0x1335ca[_0x5a5f('0xf')];_0x4aba78++){var _0x220b04=_0x3be9bf[_0x5a5f('0x14')](_0x5a5f('0x1b'),_0x5a5f('0x1c')+_0x1335ca[_0x4aba78]+_0x5a5f('0x1d'));_0x3be9bf=_0x220b04;}_0x3ea911[_0x5a5f('0x13')]=_0x3be9bf;}_0x4e0349['body']=_0x3ea911[_0x5a5f('0x13')];}else{_0x4e0349[_0x5a5f('0x1e')]=_0x3ea911[_0x5a5f('0x1f')];}if(_0x4e0349[_0x5a5f('0x1e')]){_0x4e0349[_0x5a5f('0x1e')]=_0x4e0349['body'][_0x5a5f('0x14')](/0x0){var _0x3a0281=[_0x5a5f('0x2c'),_0x5a5f('0x2d'),_0x5a5f('0x2e')];for(var _0x1960a6=0x0;_0x1960a6<_0x3ea911[_0x5a5f('0x2b')][_0x5a5f('0xf')];_0x1960a6++){var _0x10bc0a=_[_0x5a5f('0x2f')](_0x3a0281,_0x3ea911['headerLines'][_0x1960a6]['line']);if(_0x10bc0a>=0x0){_0x4e0349[_0x5a5f('0x30')]=!![];}}}return _0x4e0349;}exports['parser']=function(_0x4d81fe,_0x1fce8d,_0x5ef6d2){var _0x174502={'from':getAddress(_0x1fce8d[_0x5a5f('0x31')]),'firstName':getFirstName(_0x1fce8d[_0x5a5f('0x31')]),'lastName':getLastName(_0x1fce8d[_0x5a5f('0x31')]),'mapKey':'email','message':{'from':getMails(_0x4d81fe['email'],_0x1fce8d[_0x5a5f('0x31')]),'to':_0x4d81fe[_0x5a5f('0x22')],'cc':'','subject':_0x1fce8d[_0x5a5f('0x32')]||'','messageId':_0x1fce8d[_0x5a5f('0x33')],'inReplyTo':_0x1fce8d[_0x5a5f('0x34')],'sentAt':moment(_0x1fce8d[_0x5a5f('0x35')])[_0x5a5f('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1fce8d[_0x5a5f('0x13')]&&!_0x1fce8d[_0x5a5f('0x1f')]){var _0x1f8547=_[_0x5a5f('0x37')](_0x1fce8d['attachments'],{'contentType':_0x5a5f('0x38')});if(_0x1f8547['length']){logger[_0x5a5f('0x39')](util[_0x5a5f('0x36')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1fce8d[_0x5a5f('0x33')]));tnef[_0x5a5f('0x3a')](_[_0x5a5f('0x3b')](_0x1f8547)[_0x5a5f('0x2a')],function(_0x144d2f,_0x4d0637){if(_0x4d0637){_0x1fce8d['html']=_0x4d0637[_0x5a5f('0x3c')]||_0x5a5f('0x3d');if(_0x4d0637[_0x5a5f('0x3e')]){for(var _0x4386e0=0x0;_0x4386e0<_0x4d0637[_0x5a5f('0x3e')][_0x5a5f('0xf')];_0x4386e0++){var _0x1ade4f=_0x4d0637[_0x5a5f('0x3e')][_0x4386e0];_0x174502[_0x5a5f('0x20')][_0x5a5f('0x16')][_0x5a5f('0x18')]({'filename':_0x1ade4f[_0x5a5f('0x3f')],'content':Buffer['from'](_0x1ade4f[_0x5a5f('0x40')])});}}}_0x5ef6d2(parseEmail(_0x4d81fe,_0x1fce8d,_0x174502));});}else{_0x1fce8d[_0x5a5f('0x13')]=_0x5a5f('0x3d');_0x5ef6d2(parseEmail(_0x4d81fe,_0x1fce8d,_0x174502));}}else{_0x5ef6d2(parseEmail(_0x4d81fe,_0x1fce8d,_0x174502));}};exports['generateXOAuth2Token']=function(_0x1fba29,_0x2ea8eb){var _0x1bbfdf=['user='+(_0x2ea8eb||''),_0x5a5f('0x41')+_0x1fba29,'',''];return Buffer[_0x5a5f('0x31')](_0x1bbfdf['join'](''),_0x5a5f('0x42'))[_0x5a5f('0x43')](_0x5a5f('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 76b1afd..b7abc4d 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 _0xb378=['active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x246f74,_0xd02ff2){var _0x267617=function(_0x2ee065){while(--_0x2ee065){_0x246f74['push'](_0x246f74['shift']());}};_0x267617(++_0xd02ff2);}(_0xb378,0xdc));var _0x8b37=function(_0x3c6b3e,_0x5abb54){_0x3c6b3e=_0x3c6b3e-0x0;var _0x11296c=_0xb378[_0x3c6b3e];return _0x11296c;};'use strict';var _=require(_0x8b37('0x0'));function MailAccount(_0x2cc879){this['id']=_0x2cc879['id']||0x0;this[_0x8b37('0x1')]=_0x2cc879[_0x8b37('0x1')]||_0x8b37('0x2');this[_0x8b37('0x3')]=_0x2cc879['key']||'SERV';this[_0x8b37('0x4')]=_0x2cc879['active']||![];this[_0x8b37('0x5')]=_0x2cc879[_0x8b37('0x5')]||[];this[_0x8b37('0x6')]=_0x2cc879[_0x8b37('0x6')]||[];}module[_0x8b37('0x7')]=MailAccount; \ No newline at end of file +var _0xdd11=['key','SERV','active','Imap','Smtp','lodash','name','Service'];(function(_0x3797f0,_0x58a9ab){var _0x5d8cf8=function(_0x2d102a){while(--_0x2d102a){_0x3797f0['push'](_0x3797f0['shift']());}};_0x5d8cf8(++_0x58a9ab);}(_0xdd11,0x13d));var _0x1dd1=function(_0x69c0fd,_0x36dbee){_0x69c0fd=_0x69c0fd-0x0;var _0x28b1b3=_0xdd11[_0x69c0fd];return _0x28b1b3;};'use strict';var _=require(_0x1dd1('0x0'));function MailAccount(_0x46a616){this['id']=_0x46a616['id']||0x0;this[_0x1dd1('0x1')]=_0x46a616[_0x1dd1('0x1')]||_0x1dd1('0x2');this[_0x1dd1('0x3')]=_0x46a616['key']||_0x1dd1('0x4');this[_0x1dd1('0x5')]=_0x46a616[_0x1dd1('0x5')]||![];this[_0x1dd1('0x6')]=_0x46a616['Imap']||[];this[_0x1dd1('0x7')]=_0x46a616[_0x1dd1('0x7')]||[];}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 00918ae..6ec8533 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 _0x2732=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined','merge','exports','../model/mailAccount'];(function(_0x360929,_0x190357){var _0x42cb22=function(_0x132054){while(--_0x132054){_0x360929['push'](_0x360929['shift']());}};_0x42cb22(++_0x190357);}(_0x2732,0x112));var _0x2273=function(_0x27c34d,_0x29f01a){_0x27c34d=_0x27c34d-0x0;var _0x46aeb8=_0x2732[_0x27c34d];return _0x46aeb8;};'use strict';var _=require('lodash');var MailAccount=require(_0x2273('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0xf14d32,_0x235407,_0x580de0){var _0x15fc0b=_[_0x2273('0x1')](_0xf14d32,function(_0x463395,_0x10c5f0){return _0x463395[_0x580de0];});for(var _0x5144ae in _0x235407){if(_0x235407[_0x2273('0x2')](_0x5144ae)){if(!_0x15fc0b[_0x5144ae]){delete _0x235407[_0x5144ae];}}}}Realtime[_0x2273('0x3')][_0x2273('0x4')]=function(_0x551377,_0x37dce0){for(var _0x28cba6 in _0x37dce0){if(_0x551377['hasOwnProperty'](_0x28cba6)){_0x551377[_0x28cba6]=_0x37dce0[_0x28cba6];}}};Realtime[_0x2273('0x3')][_0x2273('0x5')]=function(){var _0x20e759=this;return function(_0x2b95cc){if(_0x2b95cc){freeIsNotKey(_0x2b95cc,_0x20e759[_0x2273('0x6')],'id');for(var _0x40d8b4=0x0,_0x4317f2={},_0x315519={};_0x40d8b4<_0x2b95cc[_0x2273('0x7')];_0x40d8b4+=0x1){_0x4317f2=_0x2b95cc[_0x40d8b4];if(_[_0x2273('0x8')](_0x20e759[_0x2273('0x6')][_0x4317f2['id']])){_0x20e759['mailAccounts'][_0x4317f2['id']]=new MailAccount(_0x4317f2);}else{_[_0x2273('0x9')](_0x20e759[_0x2273('0x6')][_0x4317f2['id']],_0x4317f2);}}}return _0x20e759[_0x2273('0x6')];};};module[_0x2273('0xa')]=Realtime; \ No newline at end of file +var _0x6c2f=['prototype','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0xb1574a,_0x4fa533){var _0x12f243=function(_0x56261f){while(--_0x56261f){_0xb1574a['push'](_0xb1574a['shift']());}};_0x12f243(++_0x4fa533);}(_0x6c2f,0x198));var _0xf6c2=function(_0x519826,_0x21fa0c){_0x519826=_0x519826-0x0;var _0x1e9482=_0x6c2f[_0x519826];return _0x1e9482;};'use strict';var _=require(_0xf6c2('0x0'));var MailAccount=require(_0xf6c2('0x1'));var Realtime=function(){this[_0xf6c2('0x2')]={};};function freeIsNotKey(_0x3b8a60,_0x2781f9,_0x41a4f5){var _0x34f850=_[_0xf6c2('0x3')](_0x3b8a60,function(_0x1f9738,_0x4b828e){return _0x1f9738[_0x41a4f5];});for(var _0x620c58 in _0x2781f9){if(_0x2781f9[_0xf6c2('0x4')](_0x620c58)){if(!_0x34f850[_0x620c58]){delete _0x2781f9[_0x620c58];}}}}Realtime['prototype'][_0xf6c2('0x5')]=function(_0x4b8f6a,_0x8b9f31){for(var _0x21db2a in _0x8b9f31){if(_0x4b8f6a[_0xf6c2('0x4')](_0x21db2a)){_0x4b8f6a[_0x21db2a]=_0x8b9f31[_0x21db2a];}}};Realtime[_0xf6c2('0x6')]['initMailAccounts']=function(){var _0x868143=this;return function(_0x434647){if(_0x434647){freeIsNotKey(_0x434647,_0x868143['mailAccounts'],'id');for(var _0x447b13=0x0,_0x403a30={},_0x3578de={};_0x447b13<_0x434647['length'];_0x447b13+=0x1){_0x403a30=_0x434647[_0x447b13];if(_[_0xf6c2('0x7')](_0x868143['mailAccounts'][_0x403a30['id']])){_0x868143[_0xf6c2('0x2')][_0x403a30['id']]=new MailAccount(_0x403a30);}else{_[_0xf6c2('0x8')](_0x868143['mailAccounts'][_0x403a30['id']],_0x403a30);}}}return _0x868143[_0xf6c2('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8adcd01..10d7742 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 _0x6114=['email','key','ListId','TemplateId','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name'];(function(_0x989b63,_0x257e0b){var _0x296e59=function(_0x1a8933){while(--_0x1a8933){_0x989b63['push'](_0x989b63['shift']());}};_0x296e59(++_0x257e0b);}(_0x6114,0x6d));var _0x4611=function(_0x390556,_0x5b64bd){_0x390556=_0x390556-0x0;var _0x11868e=_0x6114[_0x390556];return _0x11868e;};'use strict';var client=require(_0x4611('0x0'));exports[_0x4611('0x1')]=function(){return function(){return client[_0x4611('0x2')](_0x4611('0x3'),{'options':{'attributes':['id',_0x4611('0x4'),'provider','service',_0x4611('0x5'),'active',_0x4611('0x6'),_0x4611('0x7'),_0x4611('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x4611('0x9'),'include':[{'model':_0x4611('0xa'),'attributes':['id',_0x4611('0x4'),_0x4611('0xb'),_0x4611('0xc'),_0x4611('0xd')],'as':_0x4611('0xa')}]},{'model':_0x4611('0xe'),'as':_0x4611('0xf'),'include':[{'model':_0x4611('0xa'),'attributes':['id',_0x4611('0x4'),_0x4611('0xb'),'type','data5'],'as':'CloudProvider'}]}]},'log':_0x4611('0x10')});};};exports[_0x4611('0x11')]=function(_0x3082d5,_0x374c03){return client[_0x4611('0x2')]('NotifyMailAccount',{'account':{'id':_0x3082d5},'body':_0x374c03,'log':_0x4611('0x12')});}; \ No newline at end of file +var _0x5e8d=['service','active','key','TemplateId','MailServerIn','Imap','type','data5','Smtp','CloudProvider','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider'];(function(_0x221fc3,_0x3393b0){var _0x5bbb6c=function(_0x5d910b){while(--_0x5d910b){_0x221fc3['push'](_0x221fc3['shift']());}};_0x5bbb6c(++_0x3393b0);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x302822,_0x12f1a6){_0x302822=_0x302822-0x0;var _0x217c10=_0x5e8d[_0x302822];return _0x217c10;};'use strict';var client=require(_0xd5e8('0x0'));exports[_0xd5e8('0x1')]=function(){return function(){return client[_0xd5e8('0x2')](_0xd5e8('0x3'),{'options':{'attributes':['id',_0xd5e8('0x4'),_0xd5e8('0x5'),_0xd5e8('0x6'),'email',_0xd5e8('0x7'),_0xd5e8('0x8'),'ListId',_0xd5e8('0x9')],'raw':![],'include':[{'model':_0xd5e8('0xa'),'as':_0xd5e8('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0xd5e8('0x4'),_0xd5e8('0x6'),_0xd5e8('0xc'),_0xd5e8('0xd')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xd5e8('0xe'),'include':[{'model':_0xd5e8('0xf'),'attributes':['id',_0xd5e8('0x4'),_0xd5e8('0x6'),'type',_0xd5e8('0xd')],'as':_0xd5e8('0xf')}]}]},'log':'getMailAccount'});};};exports[_0xd5e8('0x10')]=function(_0x11f7d2,_0xe54a9a){return client[_0xd5e8('0x2')](_0xd5e8('0x11'),{'account':{'id':_0x11f7d2},'body':_0xe54a9a,'log':_0xd5e8('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1b2e476..db63c31 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 _0x0b35=['getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x161f66,_0x5d632b){var _0xa12ce1=function(_0x375164){while(--_0x375164){_0x161f66['push'](_0x161f66['shift']());}};_0xa12ce1(++_0x5d632b);}(_0x0b35,0x100));var _0x50b3=function(_0x49e66,_0x43f4b9){_0x49e66=_0x49e66-0x0;var _0x545549=_0x0b35[_0x49e66];return _0x545549;};'use strict';var client=require('../client');exports[_0x50b3('0x0')]=function(){return client['Request'](_0x50b3('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x50b3('0x2')]},'log':_0x50b3('0x3')});}; \ No newline at end of file +var _0x3885=['../client','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x341ac2,_0x469e71){var _0x39413d=function(_0xcfc596){while(--_0xcfc596){_0x341ac2['push'](_0x341ac2['shift']());}};_0x39413d(++_0x469e71);}(_0x3885,0x1e5));var _0x5388=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3885[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x5388('0x0'));exports['getSettings']=function(){return client[_0x5388('0x1')](_0x5388('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5388('0x3')]},'log':_0x5388('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 98bdd5f..c99a50e 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 373ac0a..aa27dfe 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 _0xbcfa=['listening','log','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xbcfa,0xf5));var _0xabcf=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xbcfa[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var http=require(_0xabcf('0x0'));var express=require(_0xabcf('0x1'));var sticky=require(_0xabcf('0x2'));var Redis=require(_0xabcf('0x3'));var config=require(_0xabcf('0x4'));var app=express();var server=http[_0xabcf('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0xabcf('0x6')])){var socketio=require(_0xabcf('0x7'))(server,{'transports':[_0xabcf('0x8'),_0xabcf('0x9')]});config[_0xabcf('0xa')]=_[_0xabcf('0xb')](config[_0xabcf('0xa')],{'host':'localhost','port':0x18eb});socketio[_0xabcf('0xc')](require(_0xabcf('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xabcf('0xa')])}));require(_0xabcf('0xe'))[_0xabcf('0xf')]();require(_0xabcf('0x10'))[_0xabcf('0xf')](socketio);require(_0xabcf('0x11'))[_0xabcf('0xf')](app);require('../../routes')[_0xabcf('0xf')](app);}else{server[_0xabcf('0x12')](_0xabcf('0x13'),function(){console[_0xabcf('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0xabcf('0x15')]=app; \ No newline at end of file +var _0x7176=['../../routes','once','listening','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','localhost','adapter','socket.io-redis','redis','../../config/triggers','default','../../config/socketio','../../config/express'];(function(_0x329bbc,_0x1f274c){var _0x366e30=function(_0x35a902){while(--_0x35a902){_0x329bbc['push'](_0x329bbc['shift']());}};_0x366e30(++_0x1f274c);}(_0x7176,0xc4));var _0x6717=function(_0x568df0,_0x4deb5d){_0x568df0=_0x568df0-0x0;var _0x2c06fe=_0x7176[_0x568df0];return _0x2c06fe;};'use strict';var _=require(_0x6717('0x0'));var http=require(_0x6717('0x1'));var express=require(_0x6717('0x2'));var sticky=require(_0x6717('0x3'));var Redis=require(_0x6717('0x4'));var config=require(_0x6717('0x5'));var app=express();var server=http[_0x6717('0x6')](app);server[_0x6717('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0x6717('0x8')])){var socketio=require(_0x6717('0x9'))(server,{'transports':[_0x6717('0xa'),_0x6717('0xb')]});config['redis']=_['defaults'](config['redis'],{'host':_0x6717('0xc'),'port':0x18eb});socketio[_0x6717('0xd')](require(_0x6717('0xe'))({'pubClient':new Redis(config[_0x6717('0xf')]),'subClient':new Redis(config[_0x6717('0xf')])}));require(_0x6717('0x10'))[_0x6717('0x11')]();require(_0x6717('0x12'))[_0x6717('0x11')](socketio);require(_0x6717('0x13'))[_0x6717('0x11')](app);require(_0x6717('0x14'))[_0x6717('0x11')](app);}else{server[_0x6717('0x15')](_0x6717('0x16'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x6717('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 9a35268..c3f8dc7 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 _0x4924=['rpc','error','message','catch','exports','bluebird','routing','client','http','Request','then'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4924,0x17b));var _0x4492=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x4924[_0x57b236];return _0x4feb29;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x4492('0x0'));var logger=require('../../config/logger')(_0x4492('0x1'));var client=jayson[_0x4492('0x2')][_0x4492('0x3')]({'port':0x2329});client[_0x4492('0x4')]=function(_0x33f999,_0x4a6207){return new BPromise(function(_0x1519a6,_0xd1444d){return client['request'](_0x33f999,_0x4a6207)[_0x4492('0x5')](function(_0x2de530){logger['debug'](_0x4492('0x6'),_0x4492('0x1'),_0x33f999,_0x4a6207,_0x2de530);if(_0x2de530[_0x4492('0x7')]){logger['error']('rpc','routing',_0x33f999,_0x2de530[_0x4492('0x7')][_0x4492('0x8')],_0x4a6207);return _0xd1444d(_0x2de530['error'][_0x4492('0x8')]);}else{return _0x1519a6(_0x2de530['result']);}})[_0x4492('0x9')](function(_0x684a9c){logger['error'](_0x4492('0x6'),'routing',_0x33f999,_0x684a9c,_0x4a6207);return _0xd1444d(_0x684a9c);});});};module[_0x4492('0xa')]=client; \ No newline at end of file +var _0x7971=['routing','error','message','exports','jayson/promise','http','Request','debug','rpc'];(function(_0x2745cb,_0x159fc9){var _0x24cec3=function(_0x19554c){while(--_0x19554c){_0x2745cb['push'](_0x2745cb['shift']());}};_0x24cec3(++_0x159fc9);}(_0x7971,0xf7));var _0x1797=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x7971[_0x11005e];return _0x29338f;};'use strict';var jayson=require(_0x1797('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x1797('0x1')]({'port':0x2329});client[_0x1797('0x2')]=function(_0x3db1d0,_0x43c375){return new BPromise(function(_0x2a07bc,_0x34fac5){return client['request'](_0x3db1d0,_0x43c375)['then'](function(_0x461f1f){logger[_0x1797('0x3')](_0x1797('0x4'),_0x1797('0x5'),_0x3db1d0,_0x43c375,_0x461f1f);if(_0x461f1f[_0x1797('0x6')]){logger[_0x1797('0x6')]('rpc',_0x1797('0x5'),_0x3db1d0,_0x461f1f[_0x1797('0x6')][_0x1797('0x7')],_0x43c375);return _0x34fac5(_0x461f1f[_0x1797('0x6')][_0x1797('0x7')]);}else{return _0x2a07bc(_0x461f1f['result']);}})['catch'](function(_0x498d55){logger[_0x1797('0x6')](_0x1797('0x4'),'routing',_0x3db1d0,_0x498d55,_0x43c375);return _0x34fac5(_0x498d55);});});};module[_0x1797('0x8')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index facc984..e34d8a2 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 _0x983e=['getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getOpenchannelQueues','getChatQueues'];(function(_0x5b7696,_0x3ebd92){var _0x42d7b9=function(_0x8afd44){while(--_0x8afd44){_0x5b7696['push'](_0x5b7696['shift']());}};_0x42d7b9(++_0x3ebd92);}(_0x983e,0x128));var _0xe983=function(_0x3b5fc8,_0x29c89f){_0x3b5fc8=_0x3b5fc8-0x0;var _0x511af7=_0x983e[_0x3b5fc8];return _0x511af7;};'use strict';var BPromise=require(_0xe983('0x0'));var server=require(_0xe983('0x1'));var Realtime=require(_0xe983('0x2'));var user=require(_0xe983('0x3'));var interval=require(_0xe983('0x4'));var openchannelQueue=require(_0xe983('0x5'));var chatQueue=require(_0xe983('0x6'));var smsQueue=require(_0xe983('0x7'));var mailQueue=require(_0xe983('0x8'));var faxQueue=require(_0xe983('0x9'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xe983('0xa')]()[_0xe983('0xb')](user[_0xe983('0xc')]())[_0xe983('0xb')](realtime[_0xe983('0xd')]())[_0xe983('0xb')](interval['getIntervals']())[_0xe983('0xb')](realtime['initIntervals']())['then'](openchannelQueue[_0xe983('0xe')]())[_0xe983('0xb')](realtime['initOpenchannelQueues']())[_0xe983('0xb')](chatQueue[_0xe983('0xf')]())[_0xe983('0xb')](realtime['initChatQueues']())[_0xe983('0xb')](smsQueue[_0xe983('0x10')]())['then'](realtime[_0xe983('0x11')]())[_0xe983('0xb')](mailQueue[_0xe983('0x12')]())[_0xe983('0xb')](realtime[_0xe983('0x13')]())[_0xe983('0xb')](faxQueue[_0xe983('0x14')]())[_0xe983('0xb')](realtime[_0xe983('0x15')]())[_0xe983('0xb')](whatsappQueue[_0xe983('0x16')]())[_0xe983('0xb')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0xe983('0x17')](realtime)[_0xe983('0xb')](function(_0x519e42){return initRealtime();})['then'](function(_0x1efb34){return setInterval(initRealtime,0x1388);})[_0xe983('0x18')](function(_0x44ec68){console[_0xe983('0x19')](_0x44ec68);});}main(); \ No newline at end of file +var _0xc749=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0xc749,0x1a3));var _0x9c74=function(_0x54fd5c,_0xa4959a){_0x54fd5c=_0x54fd5c-0x0;var _0x3eccbc=_0xc749[_0x54fd5c];return _0x3eccbc;};'use strict';var BPromise=require(_0x9c74('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x9c74('0x1'));var interval=require(_0x9c74('0x2'));var openchannelQueue=require(_0x9c74('0x3'));var chatQueue=require(_0x9c74('0x4'));var smsQueue=require(_0x9c74('0x5'));var mailQueue=require(_0x9c74('0x6'));var faxQueue=require(_0x9c74('0x7'));var whatsappQueue=require(_0x9c74('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x9c74('0x9')](user[_0x9c74('0xa')]())[_0x9c74('0x9')](realtime[_0x9c74('0xb')]())[_0x9c74('0x9')](interval[_0x9c74('0xc')]())[_0x9c74('0x9')](realtime[_0x9c74('0xd')]())[_0x9c74('0x9')](openchannelQueue['getOpenchannelQueues']())[_0x9c74('0x9')](realtime[_0x9c74('0xe')]())['then'](chatQueue[_0x9c74('0xf')]())[_0x9c74('0x9')](realtime['initChatQueues']())[_0x9c74('0x9')](smsQueue[_0x9c74('0x10')]())[_0x9c74('0x9')](realtime[_0x9c74('0x11')]())[_0x9c74('0x9')](mailQueue[_0x9c74('0x12')]())[_0x9c74('0x9')](realtime[_0x9c74('0x13')]())[_0x9c74('0x9')](faxQueue[_0x9c74('0x14')]())['then'](realtime['initFaxQueues']())[_0x9c74('0x9')](whatsappQueue[_0x9c74('0x15')]())[_0x9c74('0x9')](realtime[_0x9c74('0x16')]())[_0x9c74('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x9c74('0x9')](function(_0x5682f8){return initRealtime();})[_0x9c74('0x9')](function(_0x1f727a){return setInterval(initRealtime,0x1388);})[_0x9c74('0x17')](function(_0x247f6b){console[_0x9c74('0x18')](_0x247f6b);});}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 9e33b42..dbaf409 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x1394a2,_0x533264){var _0x31dcd1=function(_0x58c693){while(--_0x58c693){_0x1394a2['push'](_0x1394a2['shift']());}};_0x31dcd1(++_0x533264);}(_0x326f,0xd1));var _0xf326=function(_0x109485,_0x52ce4e){_0x109485=_0x109485-0x0;var _0x5ce8d9=_0x326f[_0x109485];return _0x5ce8d9;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x391507,_0x564142){_0x391507=_0x391507-0x0;var _0x47fdc4=_0x1261[_0x391507];return _0x47fdc4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 7f2251a..372188a 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 _0xfac9=['then','error','result','catch','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x31f8aa,_0x1d1aa1){var _0x5ef007=function(_0x517d11){while(--_0x517d11){_0x31f8aa['push'](_0x31f8aa['shift']());}};_0x5ef007(++_0x1d1aa1);}(_0xfac9,0x1c7));var _0x9fac=function(_0x18f236,_0x403945){_0x18f236=_0x18f236-0x0;var _0x463298=_0xfac9[_0x18f236];return _0x463298;};'use strict';var BPromise=require(_0x9fac('0x0'));var jayson=require(_0x9fac('0x1'));var client=jayson[_0x9fac('0x2')][_0x9fac('0x3')]({'port':0x232b});function request(_0x15947a,_0x38d893){return new BPromise(function(_0x1df203,_0xdf5be6){return client[_0x9fac('0x4')](_0x15947a,_0x38d893)[_0x9fac('0x5')](function(_0x5e496c){if(_0x5e496c[_0x9fac('0x6')]){return _0xdf5be6(_0x5e496c['error']['message']);}else{return _0x1df203(_0x5e496c[_0x9fac('0x7')]);}})[_0x9fac('0x8')](function(_0x13d7e7){return _0xdf5be6(_0x13d7e7);});});}exports['sendMailMessage']=function(_0x1ccc0,_0x32c7a0){return request(_0x9fac('0x9'),{'account':_0x1ccc0,'message':_0x32c7a0});}; \ No newline at end of file +var _0x31f4=['result','catch','sendMailMessage','jayson/promise','client','http','then','error','message'];(function(_0x5809ff,_0x3f226a){var _0x5bb89a=function(_0x1361f5){while(--_0x1361f5){_0x5809ff['push'](_0x5809ff['shift']());}};_0x5bb89a(++_0x3f226a);}(_0x31f4,0xc0));var _0x431f=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x31f4[_0x3c4a7c];return _0xf13d1e;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x431f('0x0'));var client=jayson[_0x431f('0x1')][_0x431f('0x2')]({'port':0x232b});function request(_0x1c3a15,_0x2a3a6c){return new BPromise(function(_0x20e181,_0x377d17){return client['request'](_0x1c3a15,_0x2a3a6c)[_0x431f('0x3')](function(_0x4909f1){if(_0x4909f1[_0x431f('0x4')]){return _0x377d17(_0x4909f1['error'][_0x431f('0x5')]);}else{return _0x20e181(_0x4909f1[_0x431f('0x6')]);}})[_0x431f('0x7')](function(_0x3a5f9b){return _0x377d17(_0x3a5f9b);});});}exports[_0x431f('0x8')]=function(_0x1278c8,_0x45678a){return request('SendMail',{'account':_0x1278c8,'message':_0x45678a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 720d279..be7c0fc 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 _0xdfcf=['whatsappStatusTime','whatsappCurrentCapacity','stringify','emit','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','smsCurrentCapacity'];(function(_0x5a7f0b,_0x224f5c){var _0x392298=function(_0x23d984){while(--_0x23d984){_0x5a7f0b['push'](_0x5a7f0b['shift']());}};_0x392298(++_0x224f5c);}(_0xdfcf,0x185));var _0xfdfc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdfcf[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var moment=require(_0xfdfc('0x0'));var md5=require(_0xfdfc('0x1'));var Redis=require(_0xfdfc('0x2'));var config=require(_0xfdfc('0x3'));config[_0xfdfc('0x4')]=_[_0xfdfc('0x5')](config[_0xfdfc('0x4')],{'host':_0xfdfc('0x6'),'port':0x18eb});var io=require(_0xfdfc('0x7'))(new Redis(config[_0xfdfc('0x4')]));function Agent(_0x476939){this['id']=_0x476939['id']||0x0;this[_0xfdfc('0x8')]=_0x476939[_0xfdfc('0x8')]||'';this[_0xfdfc('0x9')]=_0x476939[_0xfdfc('0x9')]||!![];this[_0xfdfc('0xa')]=_0x476939[_0xfdfc('0xa')]||![];this['chatPause']=_0x476939[_0xfdfc('0xb')]||![];this[_0xfdfc('0xc')]=_0x476939[_0xfdfc('0xc')]||![];this[_0xfdfc('0xd')]=_0x476939[_0xfdfc('0xd')]||![];this['smsPause']=_0x476939[_0xfdfc('0xe')]||![];this[_0xfdfc('0xf')]=_0x476939['openchannelPause']||![];this[_0xfdfc('0x10')]=_0xfdfc('0x11');this[_0xfdfc('0x12')]=0x0;this[_0xfdfc('0x13')]=_0x476939['chatCapacity']||0x0;this[_0xfdfc('0x14')]=0x0;this[_0xfdfc('0x15')]=_0xfdfc('0x11');this[_0xfdfc('0x16')]=0x0;this['mailCapacity']=_0x476939[_0xfdfc('0x17')]||0x0;this[_0xfdfc('0x18')]=0x0;this[_0xfdfc('0x19')]=_0xfdfc('0x11');this[_0xfdfc('0x1a')]=0x0;this[_0xfdfc('0x1b')]=_0x476939[_0xfdfc('0x1b')]||0x0;this[_0xfdfc('0x1c')]=0x0;this[_0xfdfc('0x1d')]='unknown';this[_0xfdfc('0x1e')]=0x0;this[_0xfdfc('0x1f')]=_0x476939[_0xfdfc('0x1f')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xfdfc('0x20')]='unknown';this['whatsappStatusTime']=0x0;this[_0xfdfc('0x21')]=_0x476939[_0xfdfc('0x21')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xfdfc('0x22')]=_0xfdfc('0x11');this[_0xfdfc('0x23')]=0x0;this[_0xfdfc('0x24')]=_0x476939[_0xfdfc('0x24')]||0x0;this[_0xfdfc('0x25')]=0x0;this[_0xfdfc('0x26')]=![];this[_0xfdfc('0x27')]=undefined;this['md5']='';this[_0xfdfc('0x28')]();}Agent[_0xfdfc('0x29')][_0xfdfc('0x2a')]=function(_0xfbe659){if(this[_0xfbe659+_0xfdfc('0x2b')]>0x0){if(this[_0xfbe659+'Capacity']>0x0&&this[_0xfbe659+_0xfdfc('0x2b')]>=this[_0xfbe659+_0xfdfc('0x2c')]){return _0xfdfc('0x2d');}else{return _0xfdfc('0x2e');}}else{return _0xfdfc('0x2f');}};Agent[_0xfdfc('0x29')]['updateRealtime']=function(){var _0x22f071=[_0xfdfc('0x30'),_0xfdfc('0x31'),_0xfdfc('0x32'),_0xfdfc('0x33'),_0xfdfc('0x34'),_0xfdfc('0x35')];for(var _0x30d4de=0x0;_0x30d4de<_0x22f071[_0xfdfc('0x36')];_0x30d4de+=0x1){var _0x2cad4d=this[_0xfdfc('0x2a')](_0x22f071[_0x30d4de]);if(this[_0x22f071[_0x30d4de]+_0xfdfc('0x37')]!==_0x2cad4d){this[_0x22f071[_0x30d4de]+_0xfdfc('0x38')]=_[_0xfdfc('0x39')](moment()['format']('x'));}this[_0x22f071[_0x30d4de]+_0xfdfc('0x37')]=_0x2cad4d;}var _0x4a6aff={'id':this['id'],'name':this[_0xfdfc('0x8')],'online':this[_0xfdfc('0x9')],'voicePause':this[_0xfdfc('0xa')],'chatPause':this[_0xfdfc('0xb')],'mailPause':this[_0xfdfc('0xc')],'smsPause':this[_0xfdfc('0xe')],'faxPause':this[_0xfdfc('0xd')],'openchannelPause':this[_0xfdfc('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xfdfc('0x12')],'chatCapacity':this[_0xfdfc('0x13')],'chatCurrentCapacity':this[_0xfdfc('0x14')],'mailStatus':this[_0xfdfc('0x15')],'mailStatusTime':this[_0xfdfc('0x16')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xfdfc('0x18')],'faxStatus':this[_0xfdfc('0x19')],'faxStatusTime':this[_0xfdfc('0x1a')],'faxCapacity':this[_0xfdfc('0x1b')],'faxCurrentCapacity':this[_0xfdfc('0x1c')],'smsStatus':this[_0xfdfc('0x1d')],'smsStatusTime':this[_0xfdfc('0x1e')],'smsCapacity':this[_0xfdfc('0x1f')],'smsCurrentCapacity':this[_0xfdfc('0x3a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xfdfc('0x3b')],'whatsappCapacity':this[_0xfdfc('0x21')],'whatsappCurrentCapacity':this[_0xfdfc('0x3c')],'openchannelStatus':this[_0xfdfc('0x22')],'openchannelStatusTime':this[_0xfdfc('0x23')],'openchannelCapacity':this[_0xfdfc('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xfdfc('0x26')],'busyQueue':this[_0xfdfc('0x27')]};var _0x33403c=md5(JSON[_0xfdfc('0x3d')](_0x4a6aff));if(this[_0xfdfc('0x1')]!==_0x33403c){this[_0xfdfc('0x1')]=_0x33403c;io[_0xfdfc('0x3e')]('user:save',_0x4a6aff);}};module[_0xfdfc('0x3f')]=Agent; \ No newline at end of file +var _0xc901=['chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatus','chatCurrentCapacity','mailStatusTime','faxStatus','whatsappStatusTime','whatsappCurrentCapacity','busyQueue','stringify','lodash','redis','defaults','localhost','socket.io-emitter','name','online','voicePause'];(function(_0xab70dd,_0x54e47e){var _0x4932fb=function(_0x409c83){while(--_0x409c83){_0xab70dd['push'](_0xab70dd['shift']());}};_0x4932fb(++_0x54e47e);}(_0xc901,0x142));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c90('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1c90('0x1')]=_[_0x1c90('0x2')](config['redis'],{'host':_0x1c90('0x3'),'port':0x18eb});var io=require(_0x1c90('0x4'))(new Redis(config[_0x1c90('0x1')]));function Agent(_0x2eff92){this['id']=_0x2eff92['id']||0x0;this[_0x1c90('0x5')]=_0x2eff92[_0x1c90('0x5')]||'';this[_0x1c90('0x6')]=_0x2eff92[_0x1c90('0x6')]||!![];this[_0x1c90('0x7')]=_0x2eff92[_0x1c90('0x7')]||![];this['chatPause']=_0x2eff92[_0x1c90('0x8')]||![];this[_0x1c90('0x9')]=_0x2eff92[_0x1c90('0x9')]||![];this[_0x1c90('0xa')]=_0x2eff92[_0x1c90('0xa')]||![];this[_0x1c90('0xb')]=_0x2eff92[_0x1c90('0xb')]||![];this[_0x1c90('0xc')]=_0x2eff92['openchannelPause']||![];this['chatStatus']=_0x1c90('0xd');this[_0x1c90('0xe')]=0x0;this[_0x1c90('0xf')]=_0x2eff92['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x1c90('0x10')]=_0x1c90('0xd');this['mailStatusTime']=0x0;this[_0x1c90('0x11')]=_0x2eff92[_0x1c90('0x11')]||0x0;this[_0x1c90('0x12')]=0x0;this['faxStatus']=_0x1c90('0xd');this['faxStatusTime']=0x0;this[_0x1c90('0x13')]=_0x2eff92[_0x1c90('0x13')]||0x0;this[_0x1c90('0x14')]=0x0;this[_0x1c90('0x15')]='unknown';this[_0x1c90('0x16')]=0x0;this['smsCapacity']=_0x2eff92[_0x1c90('0x17')]||0x0;this[_0x1c90('0x18')]=0x0;this['whatsappStatus']=_0x1c90('0xd');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x2eff92[_0x1c90('0x19')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x1c90('0x1a')]=_0x1c90('0xd');this[_0x1c90('0x1b')]=0x0;this[_0x1c90('0x1c')]=_0x2eff92['openchannelCapacity']||0x0;this[_0x1c90('0x1d')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x1c90('0x1e')]='';this[_0x1c90('0x1f')]();}Agent['prototype'][_0x1c90('0x20')]=function(_0x1af08e){if(this[_0x1af08e+_0x1c90('0x21')]>0x0){if(this[_0x1af08e+_0x1c90('0x22')]>0x0&&this[_0x1af08e+_0x1c90('0x21')]>=this[_0x1af08e+_0x1c90('0x22')]){return'maxcapacity';}else{return _0x1c90('0x23');}}else{return _0x1c90('0x24');}};Agent[_0x1c90('0x25')][_0x1c90('0x1f')]=function(){var _0x24539a=[_0x1c90('0x26'),_0x1c90('0x27'),'openchannel',_0x1c90('0x28'),_0x1c90('0x29'),_0x1c90('0x2a')];for(var _0x4900e1=0x0;_0x4900e1<_0x24539a[_0x1c90('0x2b')];_0x4900e1+=0x1){var _0x44387f=this['getChannelStatus'](_0x24539a[_0x4900e1]);if(this[_0x24539a[_0x4900e1]+_0x1c90('0x2c')]!==_0x44387f){this[_0x24539a[_0x4900e1]+_0x1c90('0x2d')]=_['toNumber'](moment()[_0x1c90('0x2e')]('x'));}this[_0x24539a[_0x4900e1]+_0x1c90('0x2c')]=_0x44387f;}var _0x28801d={'id':this['id'],'name':this[_0x1c90('0x5')],'online':this[_0x1c90('0x6')],'voicePause':this[_0x1c90('0x7')],'chatPause':this[_0x1c90('0x8')],'mailPause':this[_0x1c90('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x1c90('0xa')],'openchannelPause':this[_0x1c90('0xc')],'chatStatus':this[_0x1c90('0x2f')],'chatStatusTime':this[_0x1c90('0xe')],'chatCapacity':this[_0x1c90('0xf')],'chatCurrentCapacity':this[_0x1c90('0x30')],'mailStatus':this[_0x1c90('0x10')],'mailStatusTime':this[_0x1c90('0x31')],'mailCapacity':this[_0x1c90('0x11')],'mailCurrentCapacity':this[_0x1c90('0x12')],'faxStatus':this[_0x1c90('0x32')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x1c90('0x13')],'faxCurrentCapacity':this[_0x1c90('0x14')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x1c90('0x16')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x1c90('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x1c90('0x33')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x1c90('0x34')],'openchannelStatus':this[_0x1c90('0x1a')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x1c90('0x1c')],'openchannelCurrentCapacity':this[_0x1c90('0x1d')],'busy':this['busy'],'busyQueue':this[_0x1c90('0x35')]};var _0x390258=md5(JSON[_0x1c90('0x36')](_0x28801d));if(this[_0x1c90('0x1e')]!==_0x390258){this[_0x1c90('0x1e')]=_0x390258;io['emit']('user:save',_0x28801d);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b187773..e6f9799 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 _0x1082=['_rr','map','paused','length','online','loggedIn','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1082,0x19f));var _0x2108=function(_0x46d652,_0x409dfc){_0x46d652=_0x46d652-0x0;var _0x253db0=_0x1082[_0x46d652];return _0x253db0;};'use strict';var _=require(_0x2108('0x0'));var md5=require(_0x2108('0x1'));var util=require(_0x2108('0x2'));var Redis=require(_0x2108('0x3'));var config=require(_0x2108('0x4'));config[_0x2108('0x5')]=_[_0x2108('0x6')](config[_0x2108('0x5')],{'host':_0x2108('0x7'),'port':0x18eb});var io=require(_0x2108('0x8'))(new Redis(config['redis']));function ChatQueue(_0x2062e6){this['id']=_0x2062e6['id']||0x0;this[_0x2108('0x9')]=_0x2062e6[_0x2108('0x9')]||'';this['timeout']=_0x2062e6[_0x2108('0xa')]||0xa;this['strategy']=_0x2062e6[_0x2108('0xb')]||_0x2108('0xc');this[_0x2108('0xd')]=_0x2062e6[_0x2108('0xd')];this['mapAgentsId']={};this[_0x2108('0xe')]=0x0;this[_0x2108('0x1')]='';this['updateRouting']();this[_0x2108('0xf')]();}ChatQueue[_0x2108('0x10')][_0x2108('0x11')]=function(){var _0x54df28=this[_0x2108('0x12')][_0x2108('0x13')];this[_0x2108('0x12')]=_[_0x2108('0x14')](this[_0x2108('0xd')],'id');this['mapAgentsId'][_0x2108('0x13')]=_0x54df28;};ChatQueue[_0x2108('0x10')][_0x2108('0xf')]=function(){this['loggedIn']=0x0;this[_0x2108('0x15')]=0x0;for(var _0x465434=0x0;_0x465434=0x0?this[_0x2108('0x19')]:0x0;var _0x4ca6ae={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2108('0x18')],'name':this[_0x2108('0x9')],'paused':this['paused'],'waiting':this[_0x2108('0xe')]};var _0x5915e6=md5(JSON[_0x2108('0x1a')](_0x4ca6ae));if(this['md5']!==_0x5915e6){this[_0x2108('0x1')]=_0x5915e6;io['to'](util[_0x2108('0x1b')]('chat:queue:%s',_0x4ca6ae[_0x2108('0x9')]))[_0x2108('0x1c')](_0x2108('0x1d'),_0x4ca6ae);}};module[_0x2108('0x1e')]=ChatQueue; \ No newline at end of file +var _0x95c7=['prototype','loggedIn','paused','length','online','available','waiting','stringify','format','emit','chat_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','updateRealtime'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x95c7,0x1eb));var _0x795c=function(_0x60d3e1,_0x29f5f8){_0x60d3e1=_0x60d3e1-0x0;var _0x7848a8=_0x95c7[_0x60d3e1];return _0x7848a8;};'use strict';var _=require(_0x795c('0x0'));var md5=require(_0x795c('0x1'));var util=require(_0x795c('0x2'));var Redis=require('ioredis');var config=require(_0x795c('0x3'));config[_0x795c('0x4')]=_[_0x795c('0x5')](config[_0x795c('0x4')],{'host':_0x795c('0x6'),'port':0x18eb});var io=require(_0x795c('0x7'))(new Redis(config[_0x795c('0x4')]));function ChatQueue(_0x238886){this['id']=_0x238886['id']||0x0;this['name']=_0x238886[_0x795c('0x8')]||'';this[_0x795c('0x9')]=_0x238886[_0x795c('0x9')]||0xa;this['strategy']=_0x238886['strategy']||'beepall';this[_0x795c('0xa')]=_0x238886[_0x795c('0xa')];this[_0x795c('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x795c('0xc')]();}ChatQueue[_0x795c('0xd')]['updateRouting']=function(){var _0x4d35a4=this[_0x795c('0xb')]['_rr'];this[_0x795c('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x4d35a4;};ChatQueue[_0x795c('0xd')]['updateRealtime']=function(){this[_0x795c('0xe')]=0x0;this[_0x795c('0xf')]=0x0;for(var _0x34ca6f=0x0;_0x34ca6f=0x0?this[_0x795c('0x12')]:0x0;var _0x238c73={'id':this['id'],'available':this['available'],'loggedIn':this[_0x795c('0xe')],'name':this[_0x795c('0x8')],'paused':this['paused'],'waiting':this[_0x795c('0x13')]};var _0x3aa370=md5(JSON[_0x795c('0x14')](_0x238c73));if(this[_0x795c('0x1')]!==_0x3aa370){this[_0x795c('0x1')]=_0x3aa370;io['to'](util[_0x795c('0x15')]('chat:queue:%s',_0x238c73['name']))[_0x795c('0x16')](_0x795c('0x17'),_0x238c73);}};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 a0a9bdc..a5e7f4e 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 _0xa09d=['emit','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','_rr','map','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s'];(function(_0x31d2c2,_0x4fe272){var _0x5ea3fb=function(_0x19b515){while(--_0x19b515){_0x31d2c2['push'](_0x31d2c2['shift']());}};_0x5ea3fb(++_0x4fe272);}(_0xa09d,0x1bb));var _0xda09=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xa09d[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0xda09('0x0'));var md5=require(_0xda09('0x1'));var util=require(_0xda09('0x2'));var Redis=require(_0xda09('0x3'));var config=require(_0xda09('0x4'));config['redis']=_['defaults'](config[_0xda09('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xda09('0x6'))(new Redis(config[_0xda09('0x5')]));function FaxQueue(_0x5991fd){this['id']=_0x5991fd['id']||0x0;this[_0xda09('0x7')]=_0x5991fd[_0xda09('0x7')]||'';this[_0xda09('0x8')]=_0x5991fd[_0xda09('0x8')]||0xa;this['strategy']=_0x5991fd[_0xda09('0x9')]||_0xda09('0xa');this[_0xda09('0xb')]=_0x5991fd['Agents'];this[_0xda09('0xc')]={};this['waiting']=0x0;this[_0xda09('0x1')]='';this['updateRouting']();this[_0xda09('0xd')]();}FaxQueue[_0xda09('0xe')]['updateRouting']=function(){var _0xbddd4c=this[_0xda09('0xc')][_0xda09('0xf')];this[_0xda09('0xc')]=_[_0xda09('0x10')](this['Agents'],'id');this[_0xda09('0xc')][_0xda09('0xf')]=_0xbddd4c;};FaxQueue['prototype'][_0xda09('0xd')]=function(){this[_0xda09('0x11')]=0x0;this[_0xda09('0x12')]=0x0;for(var _0x10b14e=0x0;_0x10b14e=0x0?this[_0xda09('0x15')]:0x0;var _0x57ef09={'id':this['id'],'available':this[_0xda09('0x15')],'loggedIn':this[_0xda09('0x11')],'name':this[_0xda09('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x2215c4=md5(JSON[_0xda09('0x16')](_0x57ef09));if(this['md5']!==_0x2215c4){this[_0xda09('0x1')]=_0x2215c4;io['to'](util[_0xda09('0x17')](_0xda09('0x18'),_0x57ef09[_0xda09('0x7')]))[_0xda09('0x19')]('fax_queue:save',_0x57ef09);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xc8e6=['faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','length','online','loggedIn'];(function(_0x2e47fd,_0x2d6b90){var _0x183129=function(_0x4b251d){while(--_0x4b251d){_0x2e47fd['push'](_0x2e47fd['shift']());}};_0x183129(++_0x2d6b90);}(_0xc8e6,0x79));var _0x6c8e=function(_0xc2bf5e,_0x3b48c1){_0xc2bf5e=_0xc2bf5e-0x0;var _0x3e4354=_0xc8e6[_0xc2bf5e];return _0x3e4354;};'use strict';var _=require(_0x6c8e('0x0'));var md5=require(_0x6c8e('0x1'));var util=require(_0x6c8e('0x2'));var Redis=require(_0x6c8e('0x3'));var config=require('../../../config/environment');config[_0x6c8e('0x4')]=_[_0x6c8e('0x5')](config['redis'],{'host':_0x6c8e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c8e('0x4')]));function FaxQueue(_0x506ae1){this['id']=_0x506ae1['id']||0x0;this[_0x6c8e('0x7')]=_0x506ae1['name']||'';this[_0x6c8e('0x8')]=_0x506ae1[_0x6c8e('0x8')]||0xa;this[_0x6c8e('0x9')]=_0x506ae1['strategy']||'beepall';this[_0x6c8e('0xa')]=_0x506ae1[_0x6c8e('0xa')];this[_0x6c8e('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x6c8e('0xc')]();}FaxQueue['prototype'][_0x6c8e('0xd')]=function(){var _0x416d0e=this[_0x6c8e('0xb')][_0x6c8e('0xe')];this[_0x6c8e('0xb')]=_[_0x6c8e('0xf')](this['Agents'],'id');this[_0x6c8e('0xb')][_0x6c8e('0xe')]=_0x416d0e;};FaxQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x25bf48=0x0;_0x25bf48=0x0?this[_0x6c8e('0x15')]:0x0;var _0x50377b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x6c8e('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x36cc90=md5(JSON[_0x6c8e('0x16')](_0x50377b));if(this[_0x6c8e('0x1')]!==_0x36cc90){this[_0x6c8e('0x1')]=_0x36cc90;io['to'](util[_0x6c8e('0x17')](_0x6c8e('0x18'),_0x50377b[_0x6c8e('0x7')]))[_0x6c8e('0x19')](_0x6c8e('0x1a'),_0x50377b);}};module[_0x6c8e('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index cfc3f11..37a49ac 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 _0xc4cd=['Intervals','exports'];(function(_0x5412c2,_0x2f3149){var _0x5766d0=function(_0xc6de7d){while(--_0xc6de7d){_0x5412c2['push'](_0x5412c2['shift']());}};_0x5766d0(++_0x2f3149);}(_0xc4cd,0xbc));var _0xdc4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4cd[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x1ac50b){this['id']=_0x1ac50b['id']||0x0;this['name']=_0x1ac50b['name']||'';this[_0xdc4c('0x0')]=_0x1ac50b[_0xdc4c('0x0')]||{};}module[_0xdc4c('0x1')]=Interval; \ No newline at end of file +var _0x383d=['Intervals','name'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x383d,0x101));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';function Interval(_0x3affaa){this['id']=_0x3affaa['id']||0x0;this[_0xd383('0x0')]=_0x3affaa[_0xd383('0x0')]||'';this[_0xd383('0x1')]=_0x3affaa[_0xd383('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index abf69bc..4402450 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 _0x94d0=['waiting','format','mail:queue:%s','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','_rr','map','prototype','loggedIn','paused','online','mailPause','available'];(function(_0x380faa,_0x2b38a8){var _0xc0ef54=function(_0x59643b){while(--_0x59643b){_0x380faa['push'](_0x380faa['shift']());}};_0xc0ef54(++_0x2b38a8);}(_0x94d0,0x1b4));var _0x094d=function(_0x5cae3c,_0x2e3a68){_0x5cae3c=_0x5cae3c-0x0;var _0xd50b4f=_0x94d0[_0x5cae3c];return _0xd50b4f;};'use strict';var _=require(_0x094d('0x0'));var md5=require(_0x094d('0x1'));var util=require(_0x094d('0x2'));var Redis=require(_0x094d('0x3'));var config=require('../../../config/environment');config[_0x094d('0x4')]=_[_0x094d('0x5')](config[_0x094d('0x4')],{'host':_0x094d('0x6'),'port':0x18eb});var io=require(_0x094d('0x7'))(new Redis(config[_0x094d('0x4')]));function MailQueue(_0x3ffe6e){this['id']=_0x3ffe6e['id']||0x0;this[_0x094d('0x8')]=_0x3ffe6e[_0x094d('0x8')]||'';this[_0x094d('0x9')]=_0x3ffe6e['timeout']||0xa;this[_0x094d('0xa')]=_0x3ffe6e['strategy']||_0x094d('0xb');this['Agents']=_0x3ffe6e[_0x094d('0xc')];this[_0x094d('0xd')]={};this['waiting']=0x0;this[_0x094d('0x1')]='';this['updateRouting']();this[_0x094d('0xe')]();}MailQueue['prototype']['updateRouting']=function(){var _0x30ea90=this[_0x094d('0xd')][_0x094d('0xf')];this[_0x094d('0xd')]=_[_0x094d('0x10')](this['Agents'],'id');this[_0x094d('0xd')][_0x094d('0xf')]=_0x30ea90;};MailQueue[_0x094d('0x11')][_0x094d('0xe')]=function(){this[_0x094d('0x12')]=0x0;this[_0x094d('0x13')]=0x0;for(var _0x381315=0x0;_0x381315=0x0?this[_0x094d('0x16')]:0x0;var _0x3d7a14={'id':this['id'],'available':this[_0x094d('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x094d('0x8')],'paused':this[_0x094d('0x13')],'waiting':this[_0x094d('0x17')]};var _0x1fc8d0=md5(JSON['stringify'](_0x3d7a14));if(this[_0x094d('0x1')]!==_0x1fc8d0){this[_0x094d('0x1')]=_0x1fc8d0;io['to'](util[_0x094d('0x18')](_0x094d('0x19'),_0x3d7a14[_0x094d('0x8')]))['emit']('mail_queue:save',_0x3d7a14);}};module[_0x094d('0x1a')]=MailQueue; \ No newline at end of file +var _0xe988=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','name','strategy','beepall','Agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe988,0x1dc));var _0x8e98=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xe988[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x8e98('0x0'));var md5=require(_0x8e98('0x1'));var util=require('util');var Redis=require(_0x8e98('0x2'));var config=require(_0x8e98('0x3'));config[_0x8e98('0x4')]=_['defaults'](config[_0x8e98('0x4')],{'host':_0x8e98('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8e98('0x4')]));function MailQueue(_0x4e53a4){this['id']=_0x4e53a4['id']||0x0;this[_0x8e98('0x6')]=_0x4e53a4[_0x8e98('0x6')]||'';this['timeout']=_0x4e53a4['timeout']||0xa;this[_0x8e98('0x7')]=_0x4e53a4[_0x8e98('0x7')]||_0x8e98('0x8');this[_0x8e98('0x9')]=_0x4e53a4[_0x8e98('0x9')];this[_0x8e98('0xa')]={};this[_0x8e98('0xb')]=0x0;this[_0x8e98('0x1')]='';this[_0x8e98('0xc')]();this[_0x8e98('0xd')]();}MailQueue[_0x8e98('0xe')][_0x8e98('0xc')]=function(){var _0x53cf1a=this[_0x8e98('0xa')][_0x8e98('0xf')];this[_0x8e98('0xa')]=_[_0x8e98('0x10')](this[_0x8e98('0x9')],'id');this[_0x8e98('0xa')][_0x8e98('0xf')]=_0x53cf1a;};MailQueue[_0x8e98('0xe')][_0x8e98('0xd')]=function(){this[_0x8e98('0x11')]=0x0;this[_0x8e98('0x12')]=0x0;for(var _0x2b001e=0x0;_0x2b001e=0x0?this[_0x8e98('0x16')]:0x0;var _0x14f306={'id':this['id'],'available':this[_0x8e98('0x16')],'loggedIn':this[_0x8e98('0x11')],'name':this[_0x8e98('0x6')],'paused':this[_0x8e98('0x12')],'waiting':this[_0x8e98('0xb')]};var _0x397ffe=md5(JSON['stringify'](_0x14f306));if(this[_0x8e98('0x1')]!==_0x397ffe){this[_0x8e98('0x1')]=_0x397ffe;io['to'](util[_0x8e98('0x17')](_0x8e98('0x18'),_0x14f306['name']))[_0x8e98('0x19')]('mail_queue:save',_0x14f306);}};module[_0x8e98('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 5e90b43..ce85c44 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(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0x2ef3,0xba));var _0x32ef=function(_0x351307,_0x266b77){_0x351307=_0x351307-0x0;var _0x205290=_0x2ef3[_0x351307];return _0x205290;};'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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7a54,0x106));var _0x47a5=function(_0x4a9068,_0x3f827d){_0x4a9068=_0x4a9068-0x0;var _0x3258e8=_0x7a54[_0x4a9068];return _0x3258e8;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 22910d2..5a041ec 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 _0x8c38=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','waiting','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment'];(function(_0x50c186,_0xf7791){var _0x1da419=function(_0x17b339){while(--_0x17b339){_0x50c186['push'](_0x50c186['shift']());}};_0x1da419(++_0xf7791);}(_0x8c38,0x83));var _0x88c3=function(_0x461195,_0x1dca9a){_0x461195=_0x461195-0x0;var _0x4669b6=_0x8c38[_0x461195];return _0x4669b6;};'use strict';var _=require(_0x88c3('0x0'));var md5=require(_0x88c3('0x1'));var util=require('util');var Redis=require(_0x88c3('0x2'));var config=require(_0x88c3('0x3'));config[_0x88c3('0x4')]=_[_0x88c3('0x5')](config['redis'],{'host':_0x88c3('0x6'),'port':0x18eb});var io=require(_0x88c3('0x7'))(new Redis(config[_0x88c3('0x4')]));function SmsQueue(_0xd38738){this['id']=_0xd38738['id']||0x0;this[_0x88c3('0x8')]=_0xd38738[_0x88c3('0x8')]||'';this[_0x88c3('0x9')]=_0xd38738[_0x88c3('0x9')]||0xa;this['strategy']=_0xd38738[_0x88c3('0xa')]||'beepall';this[_0x88c3('0xb')]=_0xd38738['Agents'];this[_0x88c3('0xc')]={};this['waiting']=0x0;this[_0x88c3('0x1')]='';this[_0x88c3('0xd')]();this[_0x88c3('0xe')]();}SmsQueue[_0x88c3('0xf')]['updateRouting']=function(){var _0x40532a=this[_0x88c3('0xc')][_0x88c3('0x10')];this['mapAgentsId']=_[_0x88c3('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x88c3('0x10')]=_0x40532a;};SmsQueue[_0x88c3('0xf')][_0x88c3('0xe')]=function(){this[_0x88c3('0x12')]=0x0;this[_0x88c3('0x13')]=0x0;for(var _0x524f2a=0x0;_0x524f2a=0x0?this[_0x88c3('0x16')]:0x0;var _0x16ee57={'id':this['id'],'available':this[_0x88c3('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x88c3('0x8')],'paused':this[_0x88c3('0x13')],'waiting':this[_0x88c3('0x17')]};var _0x3a1284=md5(JSON['stringify'](_0x16ee57));if(this['md5']!==_0x3a1284){this[_0x88c3('0x1')]=_0x3a1284;io['to'](util['format']('sms:queue:%s',_0x16ee57[_0x88c3('0x8')]))[_0x88c3('0x18')](_0x88c3('0x19'),_0x16ee57);}};module[_0x88c3('0x1a')]=SmsQueue; \ No newline at end of file +var _0x9f3e=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents'];(function(_0x33cc92,_0x329837){var _0x243ad2=function(_0x41c431){while(--_0x41c431){_0x33cc92['push'](_0x33cc92['shift']());}};_0x243ad2(++_0x329837);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x90cf14,_0x3b698e){_0x90cf14=_0x90cf14-0x0;var _0x1f1de9=_0x9f3e[_0x90cf14];return _0x1f1de9;};'use strict';var _=require(_0xe9f3('0x0'));var md5=require(_0xe9f3('0x1'));var util=require(_0xe9f3('0x2'));var Redis=require(_0xe9f3('0x3'));var config=require(_0xe9f3('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0xe9f3('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe9f3('0x6')]));function SmsQueue(_0x33f11b){this['id']=_0x33f11b['id']||0x0;this[_0xe9f3('0x7')]=_0x33f11b[_0xe9f3('0x7')]||'';this[_0xe9f3('0x8')]=_0x33f11b[_0xe9f3('0x8')]||0xa;this[_0xe9f3('0x9')]=_0x33f11b[_0xe9f3('0x9')]||_0xe9f3('0xa');this[_0xe9f3('0xb')]=_0x33f11b[_0xe9f3('0xb')];this[_0xe9f3('0xc')]={};this[_0xe9f3('0xd')]=0x0;this['md5']='';this[_0xe9f3('0xe')]();this[_0xe9f3('0xf')]();}SmsQueue[_0xe9f3('0x10')][_0xe9f3('0xe')]=function(){var _0x22ed98=this['mapAgentsId'][_0xe9f3('0x11')];this[_0xe9f3('0xc')]=_['map'](this[_0xe9f3('0xb')],'id');this['mapAgentsId'][_0xe9f3('0x11')]=_0x22ed98;};SmsQueue[_0xe9f3('0x10')][_0xe9f3('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x143a34=0x0;_0x143a34=0x0?this[_0xe9f3('0x16')]:0x0;var _0x58825e={'id':this['id'],'available':this[_0xe9f3('0x16')],'loggedIn':this[_0xe9f3('0x13')],'name':this['name'],'paused':this[_0xe9f3('0x15')],'waiting':this[_0xe9f3('0xd')]};var _0x36a3e9=md5(JSON[_0xe9f3('0x17')](_0x58825e));if(this[_0xe9f3('0x1')]!==_0x36a3e9){this[_0xe9f3('0x1')]=_0x36a3e9;io['to'](util[_0xe9f3('0x18')](_0xe9f3('0x19'),_0x58825e['name']))[_0xe9f3('0x1a')](_0xe9f3('0x1b'),_0x58825e);}};module[_0xe9f3('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0a8cd24..cb98705 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 _0xf410=['redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','whatsappPause','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf410,0x1d8));var _0x0f41=function(_0x439d93,_0x454803){_0x439d93=_0x439d93-0x0;var _0x14b127=_0xf410[_0x439d93];return _0x14b127;};'use strict';var _=require(_0x0f41('0x0'));var md5=require(_0x0f41('0x1'));var util=require(_0x0f41('0x2'));var Redis=require('ioredis');var config=require(_0x0f41('0x3'));config[_0x0f41('0x4')]=_[_0x0f41('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0f41('0x4')]));function WhatsappQueue(_0x28b3d1){this['id']=_0x28b3d1['id']||0x0;this['name']=_0x28b3d1[_0x0f41('0x6')]||'';this['timeout']=_0x28b3d1[_0x0f41('0x7')]||0xa;this['strategy']=_0x28b3d1[_0x0f41('0x8')]||_0x0f41('0x9');this[_0x0f41('0xa')]=_0x28b3d1['Agents'];this[_0x0f41('0xb')]={};this['waiting']=0x0;this[_0x0f41('0x1')]='';this[_0x0f41('0xc')]();this[_0x0f41('0xd')]();}WhatsappQueue[_0x0f41('0xe')]['updateRouting']=function(){var _0x25b507=this['mapAgentsId'][_0x0f41('0xf')];this[_0x0f41('0xb')]=_[_0x0f41('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x0f41('0xf')]=_0x25b507;};WhatsappQueue[_0x0f41('0xe')]['updateRealtime']=function(){this[_0x0f41('0x11')]=0x0;this[_0x0f41('0x12')]=0x0;for(var _0x2fc35b=0x0;_0x2fc35b=0x0?this[_0x0f41('0x15')]:0x0;var _0x448b59={'id':this['id'],'available':this[_0x0f41('0x15')],'loggedIn':this[_0x0f41('0x11')],'name':this[_0x0f41('0x6')],'paused':this[_0x0f41('0x12')],'waiting':this[_0x0f41('0x16')]};var _0x71b546=md5(JSON['stringify'](_0x448b59));if(this[_0x0f41('0x1')]!==_0x71b546){this[_0x0f41('0x1')]=_0x71b546;io['to'](util[_0x0f41('0x17')](_0x0f41('0x18'),_0x448b59[_0x0f41('0x6')]))[_0x0f41('0x19')](_0x0f41('0x1a'),_0x448b59);}};module[_0x0f41('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xe671=['md5','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','online','whatsappPause','paused','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x2e29bb,_0x4e9546){var _0x853e95=function(_0x3a4a8f){while(--_0x3a4a8f){_0x2e29bb['push'](_0x2e29bb['shift']());}};_0x853e95(++_0x4e9546);}(_0xe671,0xc0));var _0x1e67=function(_0x40ade3,_0xb65999){_0x40ade3=_0x40ade3-0x0;var _0x6b6c5c=_0xe671[_0x40ade3];return _0x6b6c5c;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x1e67('0x0'));config['redis']=_['defaults'](config[_0x1e67('0x1')],{'host':_0x1e67('0x2'),'port':0x18eb});var io=require(_0x1e67('0x3'))(new Redis(config[_0x1e67('0x1')]));function WhatsappQueue(_0x560452){this['id']=_0x560452['id']||0x0;this[_0x1e67('0x4')]=_0x560452['name']||'';this[_0x1e67('0x5')]=_0x560452['timeout']||0xa;this[_0x1e67('0x6')]=_0x560452[_0x1e67('0x6')]||'beepall';this[_0x1e67('0x7')]=_0x560452[_0x1e67('0x7')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x1e67('0x8')]='';this[_0x1e67('0x9')]();this['updateRealtime']();}WhatsappQueue[_0x1e67('0xa')][_0x1e67('0x9')]=function(){var _0x12a0f7=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x1e67('0xb')][_0x1e67('0xc')]=_0x12a0f7;};WhatsappQueue['prototype'][_0x1e67('0xd')]=function(){this[_0x1e67('0xe')]=0x0;this['paused']=0x0;for(var _0x3b6b4b=0x0;_0x3b6b4b=0x0?this[_0x1e67('0x12')]:0x0;var _0x2c2ee7={'id':this['id'],'available':this[_0x1e67('0x12')],'loggedIn':this[_0x1e67('0xe')],'name':this[_0x1e67('0x4')],'paused':this[_0x1e67('0x11')],'waiting':this[_0x1e67('0x13')]};var _0x5e61fe=md5(JSON[_0x1e67('0x14')](_0x2c2ee7));if(this[_0x1e67('0x8')]!==_0x5e61fe){this[_0x1e67('0x8')]=_0x5e61fe;io['to'](util[_0x1e67('0x15')](_0x1e67('0x16'),_0x2c2ee7[_0x1e67('0x4')]))[_0x1e67('0x17')](_0x1e67('0x18'),_0x2c2ee7);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7dce83d..b55ab20 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 8a7198f..4ca6dd4 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 _0xd6fa=['update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','../client'];(function(_0x4de8c4,_0x75f17f){var _0x276b10=function(_0x1645e9){while(--_0x1645e9){_0x4de8c4['push'](_0x4de8c4['shift']());}};_0x276b10(++_0x75f17f);}(_0xd6fa,0x110));var _0xad6f=function(_0x56a7b3,_0x20c6e6){_0x56a7b3=_0x56a7b3-0x0;var _0x4c1ce6=_0xd6fa[_0x56a7b3];return _0x4c1ce6;};'use strict';var client=require(_0xad6f('0x0'));exports[_0xad6f('0x1')]=function(_0x1a2752,_0x158950){return client['Request'](_0xad6f('0x2'),{'body':_0x158950,'options':{'where':{'id':_0x1a2752}},'log':_0xad6f('0x3')});};exports[_0xad6f('0x4')]=function(_0x257da2,_0x1e2c29){return client[_0xad6f('0x5')](_0xad6f('0x6'),{'body':_0x1e2c29,'options':{'where':{'id':_0x257da2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xf83d=['Request','updateChatInteraction','addTagsToChatInteraction'];(function(_0x221c09,_0x1d4f8d){var _0x1a93f7=function(_0x5156e3){while(--_0x5156e3){_0x221c09['push'](_0x221c09['shift']());}};_0x1a93f7(++_0x1d4f8d);}(_0xf83d,0x1e9));var _0xdf83=function(_0x5eabc0,_0x42dc3e){_0x5eabc0=_0x5eabc0-0x0;var _0xe98ce8=_0xf83d[_0x5eabc0];return _0xe98ce8;};'use strict';var client=require('../client');exports['update']=function(_0x3577a9,_0x481913){return client[_0xdf83('0x0')]('UpdateChatInteraction',{'body':_0x481913,'options':{'where':{'id':_0x3577a9}},'log':_0xdf83('0x1')});};exports['addTags']=function(_0x1a3b4d,_0x407bc4){return client[_0xdf83('0x0')]('AddTagsToChatInteraction',{'body':_0x407bc4,'options':{'where':{'id':_0x1a3b4d}},'log':_0xdf83('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c65cffa..93c8db8 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 _0x7322=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x7322,0x10b));var _0x2732=function(_0x20156c,_0x12e1ff){_0x20156c=_0x20156c-0x0;var _0x4cb19a=_0x7322[_0x20156c];return _0x4cb19a;};'use strict';var client=require('../client');exports[_0x2732('0x0')]=function(_0x18a7c7){return client[_0x2732('0x1')](_0x2732('0x2'),{'body':_0x18a7c7,'log':_0x2732('0x3')});}; \ No newline at end of file +var _0x9733=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x54a1f1,_0x15c6ff){var _0x23798f=function(_0x318ba8){while(--_0x318ba8){_0x54a1f1['push'](_0x54a1f1['shift']());}};_0x23798f(++_0x15c6ff);}(_0x9733,0x1f3));var _0x3973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9733[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x3973('0x0'));exports[_0x3973('0x1')]=function(_0x44abd2){return client[_0x3973('0x2')](_0x3973('0x3'),{'body':_0x44abd2,'log':_0x3973('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 7e738f3..b762824 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 _0xe548=['Request','GetChatQueue','name','online','../client','getChatQueues'];(function(_0x31c480,_0x13f64a){var _0x3687ce=function(_0x46fbc0){while(--_0x46fbc0){_0x31c480['push'](_0x31c480['shift']());}};_0x3687ce(++_0x13f64a);}(_0xe548,0x184));var _0x8e54=function(_0x4b075e,_0x57874c){_0x4b075e=_0x4b075e-0x0;var _0x31385c=_0xe548[_0x4b075e];return _0x31385c;};'use strict';var client=require(_0x8e54('0x0'));exports[_0x8e54('0x1')]=function(){return function(){return client[_0x8e54('0x2')](_0x8e54('0x3'),{'options':{'raw':![],'attributes':['id',_0x8e54('0x4'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x8e54('0x5'),'chatPause']}]},'log':_0x8e54('0x1')});};}; \ No newline at end of file +var _0x448a=['name','User','Agents','online','chatPause','getChatQueues','Request'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x448a,0x1ef));var _0xa448=function(_0x4cd004,_0x14ded8){_0x4cd004=_0x4cd004-0x0;var _0x5b72f1=_0x448a[_0x4cd004];return _0x5b72f1;};'use strict';var client=require('../client');exports[_0xa448('0x0')]=function(){return function(){return client[_0xa448('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xa448('0x2'),'timeout','strategy'],'include':[{'model':_0xa448('0x3'),'as':_0xa448('0x4'),'attributes':['id','name',_0xa448('0x5'),_0xa448('0x6')]}]},'log':_0xa448('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 719a877..5971d07 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 _0x0c02=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x3b5e9f,_0x29601e){var _0x1e9a49=function(_0x31cf02){while(--_0x31cf02){_0x3b5e9f['push'](_0x3b5e9f['shift']());}};_0x1e9a49(++_0x29601e);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x20c0('0x0')]=function(_0x33da8b){return client['Request'](_0x20c0('0x1'),{'body':_0x33da8b,'log':_0x20c0('0x1')});};exports[_0x20c0('0x2')]=function(_0x6d03d0,_0x38022e){return client[_0x20c0('0x3')](_0x20c0('0x4'),{'body':_0x38022e,'options':{'where':{'uniqueid':_0x6d03d0},'order':[['id',_0x20c0('0x5')]],'limit':0x1},'log':_0x20c0('0x4')});}; \ No newline at end of file +var _0xac72=['DESC','../client','create','CreateChatQueueReport','update','Request','UpdateChatQueueReport'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xac72,0x1eb));var _0x2ac7=function(_0xbefbd6,_0x1d6926){_0xbefbd6=_0xbefbd6-0x0;var _0x4fd2e0=_0xac72[_0xbefbd6];return _0x4fd2e0;};'use strict';var client=require(_0x2ac7('0x0'));exports[_0x2ac7('0x1')]=function(_0x3e3f7d){return client['Request'](_0x2ac7('0x2'),{'body':_0x3e3f7d,'log':_0x2ac7('0x2')});};exports[_0x2ac7('0x3')]=function(_0x260649,_0x238ae5){return client[_0x2ac7('0x4')](_0x2ac7('0x5'),{'body':_0x238ae5,'options':{'where':{'uniqueid':_0x260649},'order':[['id',_0x2ac7('0x6')]],'limit':0x1},'log':_0x2ac7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 7c8a980..68fa593 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(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x7a54,0x106));var _0x47a5=function(_0x4c211e,_0x268616){_0x4c211e=_0x4c211e-0x0;var _0xdaea86=_0x7a54[_0x4c211e];return _0xdaea86;};'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(_0x699049,_0x51d7d6){var _0x5e25e4=function(_0x331b29){while(--_0x331b29){_0x699049['push'](_0x699049['shift']());}};_0x5e25e4(++_0x51d7d6);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 178270a..95fe1e4 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 _0x7f09=['Request','createFaxMessage','../client','create'];(function(_0x27276d,_0x339778){var _0x4263f7=function(_0x59c34a){while(--_0x59c34a){_0x27276d['push'](_0x27276d['shift']());}};_0x4263f7(++_0x339778);}(_0x7f09,0x86));var _0x97f0=function(_0x20bccc,_0x5da44b){_0x20bccc=_0x20bccc-0x0;var _0x499e5c=_0x7f09[_0x20bccc];return _0x499e5c;};'use strict';var client=require(_0x97f0('0x0'));exports[_0x97f0('0x1')]=function(_0x29e96c){return client[_0x97f0('0x2')]('CreateFaxMessage',{'body':_0x29e96c,'log':_0x97f0('0x3')});}; \ No newline at end of file +var _0x3ddf=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x547732,_0xe33ed){var _0x290592=function(_0x1a6974){while(--_0x1a6974){_0x547732['push'](_0x547732['shift']());}};_0x290592(++_0xe33ed);}(_0x3ddf,0xcc));var _0xf3dd=function(_0x4f6add,_0x5f2f22){_0x4f6add=_0x4f6add-0x0;var _0x4c0c9a=_0x3ddf[_0x4f6add];return _0x4c0c9a;};'use strict';var client=require(_0xf3dd('0x0'));exports['create']=function(_0x1e3d0c){return client[_0xf3dd('0x1')](_0xf3dd('0x2'),{'body':_0x1e3d0c,'log':_0xf3dd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5f66317..bd0744d 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 _0x2c64=['timeout','User','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x2ed9e7,_0x57269d){var _0x258f8a=function(_0xfe9a73){while(--_0xfe9a73){_0x2ed9e7['push'](_0x2ed9e7['shift']());}};_0x258f8a(++_0x57269d);}(_0x2c64,0x1f4));var _0x42c6=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x2c64[_0x4d8666];return _0x37175b;};'use strict';var client=require(_0x42c6('0x0'));exports[_0x42c6('0x1')]=function(){return function(){return client[_0x42c6('0x2')](_0x42c6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x42c6('0x4'),'strategy'],'include':[{'model':_0x42c6('0x5'),'as':'Agents','attributes':['id',_0x42c6('0x6'),_0x42c6('0x7'),_0x42c6('0x8')]}]},'log':_0x42c6('0x1')});};}; \ No newline at end of file +var _0xcbbb=['online','../client','getFaxQueues','GetFaxQueue','name','timeout','Agents'];(function(_0x875a77,_0x304f3b){var _0x42696a=function(_0xb1346f){while(--_0xb1346f){_0x875a77['push'](_0x875a77['shift']());}};_0x42696a(++_0x304f3b);}(_0xcbbb,0xe8));var _0xbcbb=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcbbb[_0x243b59];return _0x3e1676;};'use strict';var client=require(_0xbcbb('0x0'));exports[_0xbcbb('0x1')]=function(){return function(){return client['Request'](_0xbcbb('0x2'),{'options':{'raw':![],'attributes':['id',_0xbcbb('0x3'),_0xbcbb('0x4'),'strategy'],'include':[{'model':'User','as':_0xbcbb('0x5'),'attributes':['id','name',_0xbcbb('0x6'),'faxPause']}]},'log':_0xbcbb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 97f8a7a..2720122 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 _0xe1b1=['Request','UpdateFaxQueueReport','create','CreateFaxQueueReport','update'];(function(_0x460264,_0x51ddff){var _0x2d75a1=function(_0x5a02a8){while(--_0x5a02a8){_0x460264['push'](_0x460264['shift']());}};_0x2d75a1(++_0x51ddff);}(_0xe1b1,0x138));var _0x1e1b=function(_0x47a660,_0x72ec3f){_0x47a660=_0x47a660-0x0;var _0x4798a4=_0xe1b1[_0x47a660];return _0x4798a4;};'use strict';var client=require('../client');exports[_0x1e1b('0x0')]=function(_0x44b0ef){return client['Request']('CreateFaxQueueReport',{'body':_0x44b0ef,'log':_0x1e1b('0x1')});};exports[_0x1e1b('0x2')]=function(_0x10d0d6,_0xa9fe8d){return client[_0x1e1b('0x3')](_0x1e1b('0x4'),{'body':_0xa9fe8d,'options':{'where':{'uniqueid':_0x10d0d6},'order':[['id','DESC']],'limit':0x1},'log':_0x1e1b('0x4')});}; \ No newline at end of file +var _0xedb1=['../client','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedb1,0x18b));var _0x1edb=function(_0x50fd05,_0x3c77b7){_0x50fd05=_0x50fd05-0x0;var _0x212b5d=_0xedb1[_0x50fd05];return _0x212b5d;};'use strict';var client=require(_0x1edb('0x0'));exports['create']=function(_0x4e5316){return client['Request']('CreateFaxQueueReport',{'body':_0x4e5316,'log':_0x1edb('0x1')});};exports[_0x1edb('0x2')]=function(_0x2c22a9,_0x3a05de){return client['Request'](_0x1edb('0x3'),{'body':_0x3a05de,'options':{'where':{'uniqueid':_0x2c22a9},'order':[['id',_0x1edb('0x4')]],'limit':0x1},'log':_0x1edb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c35d8bf..49288bf 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 _0x6659=['name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x6659,0x90));var _0x9665=function(_0x22c782,_0x1483ba){_0x22c782=_0x22c782-0x0;var _0x509c9c=_0x6659[_0x22c782];return _0x509c9c;};'use strict';var client=require(_0x9665('0x0'));exports[_0x9665('0x1')]=function(){return function(){return client[_0x9665('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9665('0x3')],'include':[{'model':_0x9665('0x4'),'as':_0x9665('0x5'),'attributes':['id',_0x9665('0x3'),_0x9665('0x6')]}]},'log':_0x9665('0x1')});};}; \ No newline at end of file +var _0xe535=['getIntervals','../client','Request','GetInterval','Intervals','name','interval'];(function(_0x4e0cc8,_0x360f60){var _0x418c0c=function(_0x55f3da){while(--_0x55f3da){_0x4e0cc8['push'](_0x4e0cc8['shift']());}};_0x418c0c(++_0x360f60);}(_0xe535,0x1dd));var _0x5e53=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe535[_0x42245d];return _0x4b211a;};'use strict';var client=require(_0x5e53('0x0'));exports['getIntervals']=function(){return function(){return client[_0x5e53('0x1')](_0x5e53('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x5e53('0x3'),'attributes':['id',_0x5e53('0x4'),_0x5e53('0x5')]}]},'log':_0x5e53('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b6a269c..a6f6665 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 _0x4325=['update','Request','UpdateMailInteraction','addTagsToChatInteraction','../client'];(function(_0x34750e,_0x3c3d3b){var _0x36760a=function(_0x40064c){while(--_0x40064c){_0x34750e['push'](_0x34750e['shift']());}};_0x36760a(++_0x3c3d3b);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5432('0x0'));exports[_0x5432('0x1')]=function(_0x5aa4b8,_0x3f491f){return client[_0x5432('0x2')](_0x5432('0x3'),{'body':_0x3f491f,'options':{'where':{'id':_0x5aa4b8}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x20f704,_0x36ce53){return client[_0x5432('0x2')]('AddTagsToMailInteraction',{'body':_0x36ce53,'options':{'where':{'id':_0x20f704}},'log':_0x5432('0x4')});}; \ No newline at end of file +var _0x2542=['AddTagsToMailInteraction','../client','update','UpdateMailInteraction','addTags','Request'];(function(_0x1b8e8b,_0xc325b){var _0x54efe4=function(_0x10a262){while(--_0x10a262){_0x1b8e8b['push'](_0x1b8e8b['shift']());}};_0x54efe4(++_0xc325b);}(_0x2542,0x169));var _0x2254=function(_0x4e0ab8,_0x401afb){_0x4e0ab8=_0x4e0ab8-0x0;var _0x4c1f40=_0x2542[_0x4e0ab8];return _0x4c1f40;};'use strict';var client=require(_0x2254('0x0'));exports[_0x2254('0x1')]=function(_0x2f3bcd,_0x20dfee){return client['Request'](_0x2254('0x2'),{'body':_0x20dfee,'options':{'where':{'id':_0x2f3bcd}},'log':'updateMailInteraction'});};exports[_0x2254('0x3')]=function(_0x3b3dcb,_0x27f5c9){return client[_0x2254('0x4')](_0x2254('0x5'),{'body':_0x27f5c9,'options':{'where':{'id':_0x3b3dcb}},'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 67c5de9..38514f7 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 _0x7dd7=['create','Request','CreateMailMessage','../client'];(function(_0x4f98f0,_0x59bc7e){var _0x3f5ee5=function(_0x3f5037){while(--_0x3f5037){_0x4f98f0['push'](_0x4f98f0['shift']());}};_0x3f5ee5(++_0x59bc7e);}(_0x7dd7,0x15b));var _0x77dd=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x7dd7[_0x1fb1c1];return _0x1622df;};'use strict';var client=require(_0x77dd('0x0'));exports[_0x77dd('0x1')]=function(_0x32d8b1){return client[_0x77dd('0x2')](_0x77dd('0x3'),{'body':_0x32d8b1,'log':'createMailMessage'});}; \ No newline at end of file +var _0xfc67=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x2c4440,_0x4fe366){var _0x20f1dd=function(_0x7495a5){while(--_0x7495a5){_0x2c4440['push'](_0x2c4440['shift']());}};_0x20f1dd(++_0x4fe366);}(_0xfc67,0x94));var _0x7fc6=function(_0xd3fee5,_0x1428b5){_0xd3fee5=_0xd3fee5-0x0;var _0xb7815a=_0xfc67[_0xd3fee5];return _0xb7815a;};'use strict';var client=require(_0x7fc6('0x0'));exports[_0x7fc6('0x1')]=function(_0x3b8e74){return client[_0x7fc6('0x2')](_0x7fc6('0x3'),{'body':_0x3b8e74,'log':_0x7fc6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 12c6c4a..7a2bc01 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 _0xec85=['Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x58a09c,_0x1ece5d){var _0x4c147c=function(_0x5babfb){while(--_0x5babfb){_0x58a09c['push'](_0x58a09c['shift']());}};_0x4c147c(++_0x1ece5d);}(_0xec85,0x12c));var _0x5ec8=function(_0x2c048a,_0x1ab401){_0x2c048a=_0x2c048a-0x0;var _0x3357ab=_0xec85[_0x2c048a];return _0x3357ab;};'use strict';var client=require(_0x5ec8('0x0'));exports[_0x5ec8('0x1')]=function(){return function(){return client[_0x5ec8('0x2')](_0x5ec8('0x3'),{'options':{'raw':![],'attributes':['id',_0x5ec8('0x4'),_0x5ec8('0x5'),_0x5ec8('0x6')],'include':[{'model':_0x5ec8('0x7'),'as':_0x5ec8('0x8'),'attributes':['id',_0x5ec8('0x4'),_0x5ec8('0x9'),_0x5ec8('0xa')]}]},'log':_0x5ec8('0x1')});};}; \ No newline at end of file +var _0x9c77=['mailPause','getMailQueues','Request','User','name','online'];(function(_0x435ba5,_0x55875f){var _0x5af51d=function(_0x35b1ed){while(--_0x35b1ed){_0x435ba5['push'](_0x435ba5['shift']());}};_0x5af51d(++_0x55875f);}(_0x9c77,0x1ab));var _0x79c7=function(_0x3b073f,_0x427536){_0x3b073f=_0x3b073f-0x0;var _0x36e715=_0x9c77[_0x3b073f];return _0x36e715;};'use strict';var client=require('../client');exports[_0x79c7('0x0')]=function(){return function(){return client[_0x79c7('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x79c7('0x2'),'as':'Agents','attributes':['id',_0x79c7('0x3'),_0x79c7('0x4'),_0x79c7('0x5')]}]},'log':_0x79c7('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e41106b..1545773 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 _0x650d=['create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','../client'];(function(_0x48cd6d,_0x430334){var _0x29dac1=function(_0x577771){while(--_0x577771){_0x48cd6d['push'](_0x48cd6d['shift']());}};_0x29dac1(++_0x430334);}(_0x650d,0xb9));var _0xd650=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x650d[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0xd650('0x0'));exports[_0xd650('0x1')]=function(_0x9f394f){return client['Request'](_0xd650('0x2'),{'body':_0x9f394f,'log':_0xd650('0x2')});};exports[_0xd650('0x3')]=function(_0xa3d078,_0x3838d1){return client[_0xd650('0x4')]('UpdateMailQueueReport',{'body':_0x3838d1,'options':{'where':{'uniqueid':_0xa3d078},'order':[['id','DESC']],'limit':0x1},'log':_0xd650('0x5')});}; \ No newline at end of file +var _0x6030=['UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x6030,0x106));var _0x0603=function(_0xd4e1b6,_0x4af999){_0xd4e1b6=_0xd4e1b6-0x0;var _0x2552f8=_0x6030[_0xd4e1b6];return _0x2552f8;};'use strict';var client=require(_0x0603('0x0'));exports['create']=function(_0x58cc0e){return client[_0x0603('0x1')](_0x0603('0x2'),{'body':_0x58cc0e,'log':_0x0603('0x2')});};exports['update']=function(_0x252cd0,_0x4bda84){return client['Request'](_0x0603('0x3'),{'body':_0x4bda84,'options':{'where':{'uniqueid':_0x252cd0},'order':[['id',_0x0603('0x4')]],'limit':0x1},'log':_0x0603('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 52ec319..393f191 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 _0xbb3b=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3b81f2,_0x48d43c){var _0x3af8d0=function(_0x512d4b){while(--_0x512d4b){_0x3b81f2['push'](_0x3b81f2['shift']());}};_0x3af8d0(++_0x48d43c);}(_0xbb3b,0x1a8));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xbbb3('0x0'));exports[_0xbbb3('0x1')]=function(_0x4c66bc,_0x14e08f){return client[_0xbbb3('0x2')](_0xbbb3('0x3'),{'body':_0x14e08f,'options':{'where':{'id':_0x4c66bc}},'log':_0xbbb3('0x4')});};exports['addTags']=function(_0x197a4a,_0x2f5eaa){return client[_0xbbb3('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x2f5eaa,'options':{'where':{'id':_0x197a4a}},'log':_0xbbb3('0x5')});}; \ No newline at end of file +var _0xc4e2=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x1d6f65,_0x159d9e){var _0x2ec37d=function(_0x443db1){while(--_0x443db1){_0x1d6f65['push'](_0x1d6f65['shift']());}};_0x2ec37d(++_0x159d9e);}(_0xc4e2,0x132));var _0x2c4e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc4e2[_0x484e36];return _0xafc85d;};'use strict';var client=require(_0x2c4e('0x0'));exports['update']=function(_0x5e3a87,_0x17e338){return client[_0x2c4e('0x1')](_0x2c4e('0x2'),{'body':_0x17e338,'options':{'where':{'id':_0x5e3a87}},'log':_0x2c4e('0x3')});};exports[_0x2c4e('0x4')]=function(_0x4fee73,_0x32430d){return client['Request'](_0x2c4e('0x5'),{'body':_0x32430d,'options':{'where':{'id':_0x4fee73}},'log':_0x2c4e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 568e546..b1cbd78 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 _0x66c2=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x3b6bab,_0x4dd853){var _0x3f6478=function(_0x43f887){while(--_0x43f887){_0x3b6bab['push'](_0x3b6bab['shift']());}};_0x3f6478(++_0x4dd853);}(_0x66c2,0xfe));var _0x266c=function(_0x18b20e,_0x518082){_0x18b20e=_0x18b20e-0x0;var _0x244ec6=_0x66c2[_0x18b20e];return _0x244ec6;};'use strict';var client=require(_0x266c('0x0'));exports[_0x266c('0x1')]=function(_0x217eda){return client['Request'](_0x266c('0x2'),{'body':_0x217eda,'log':_0x266c('0x3')});}; \ No newline at end of file +var _0xae21=['Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae21,0xff));var _0x1ae2=function(_0x5a80fe,_0x308a08){_0x5a80fe=_0x5a80fe-0x0;var _0x23885e=_0xae21[_0x5a80fe];return _0x23885e;};'use strict';var client=require('../client');exports['create']=function(_0x22ec9d){return client[_0x1ae2('0x0')](_0x1ae2('0x1'),{'body':_0x22ec9d,'log':_0x1ae2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0a378dc..34565b9 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 _0xee39=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents','online','openchannelPause','../client'];(function(_0x1948fd,_0xe3bf57){var _0x25f689=function(_0x52fbd9){while(--_0x52fbd9){_0x1948fd['push'](_0x1948fd['shift']());}};_0x25f689(++_0xe3bf57);}(_0xee39,0x1cb));var _0x9ee3=function(_0x2a146b,_0xf382f1){_0x2a146b=_0x2a146b-0x0;var _0x46a1f5=_0xee39[_0x2a146b];return _0x46a1f5;};'use strict';var client=require(_0x9ee3('0x0'));exports[_0x9ee3('0x1')]=function(){return function(){return client[_0x9ee3('0x2')](_0x9ee3('0x3'),{'options':{'raw':![],'attributes':['id',_0x9ee3('0x4'),_0x9ee3('0x5'),'strategy'],'include':[{'model':_0x9ee3('0x6'),'as':_0x9ee3('0x7'),'attributes':['id',_0x9ee3('0x4'),_0x9ee3('0x8'),_0x9ee3('0x9')]}]},'log':_0x9ee3('0x1')});};}; \ No newline at end of file +var _0x2765=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents'];(function(_0x5f5374,_0x3f0fe0){var _0x22965d=function(_0x5567c5){while(--_0x5567c5){_0x5f5374['push'](_0x5f5374['shift']());}};_0x22965d(++_0x3f0fe0);}(_0x2765,0x115));var _0x5276=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2765[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x5276('0x0'));exports[_0x5276('0x1')]=function(){return function(){return client[_0x5276('0x2')](_0x5276('0x3'),{'options':{'raw':![],'attributes':['id',_0x5276('0x4'),_0x5276('0x5'),_0x5276('0x6')],'include':[{'model':_0x5276('0x7'),'as':_0x5276('0x8'),'attributes':['id','name',_0x5276('0x9'),_0x5276('0xa')]}]},'log':_0x5276('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8e0cae4..a9676c5 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 _0x256e=['Request','UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport','update'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x256e,0x176));var _0xe256=function(_0x22e7a3,_0x317a1c){_0x22e7a3=_0x22e7a3-0x0;var _0x22edf2=_0x256e[_0x22e7a3];return _0x22edf2;};'use strict';var client=require(_0xe256('0x0'));exports[_0xe256('0x1')]=function(_0x5632af){return client['Request'](_0xe256('0x2'),{'body':_0x5632af,'log':_0xe256('0x2')});};exports[_0xe256('0x3')]=function(_0xe67bd6,_0x17e980){return client[_0xe256('0x4')](_0xe256('0x5'),{'body':_0x17e980,'options':{'where':{'uniqueid':_0xe67bd6},'order':[['id',_0xe256('0x6')]],'limit':0x1},'log':_0xe256('0x5')});}; \ No newline at end of file +var _0x97c7=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x9f7112,_0x1f6965){var _0x13fa33=function(_0x3f9787){while(--_0x3f9787){_0x9f7112['push'](_0x9f7112['shift']());}};_0x13fa33(++_0x1f6965);}(_0x97c7,0xdd));var _0x797c=function(_0x3edc8b,_0x1e4db9){_0x3edc8b=_0x3edc8b-0x0;var _0x55a538=_0x97c7[_0x3edc8b];return _0x55a538;};'use strict';var client=require(_0x797c('0x0'));exports[_0x797c('0x1')]=function(_0xf5ca81){return client[_0x797c('0x2')](_0x797c('0x3'),{'body':_0xf5ca81,'log':_0x797c('0x3')});};exports[_0x797c('0x4')]=function(_0x225ae5,_0x361d62){return client[_0x797c('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x361d62,'options':{'where':{'uniqueid':_0x225ae5},'order':[['id','DESC']],'limit':0x1},'log':_0x797c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 30c6ab9..582ad50 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 _0x50d0=['Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x4ec14f,_0x2e16f7){var _0x1088d6=function(_0x59f097){while(--_0x59f097){_0x4ec14f['push'](_0x4ec14f['shift']());}};_0x1088d6(++_0x2e16f7);}(_0x50d0,0x101));var _0x050d=function(_0xaeb23c,_0x1c6c81){_0xaeb23c=_0xaeb23c-0x0;var _0x1de56a=_0x50d0[_0xaeb23c];return _0x1de56a;};'use strict';var client=require(_0x050d('0x0'));exports['update']=function(_0x3c1f6b,_0x5df8fb){return client[_0x050d('0x1')](_0x050d('0x2'),{'body':_0x5df8fb,'options':{'where':{'id':_0x3c1f6b}},'log':_0x050d('0x3')});};exports['addTags']=function(_0x3553e3,_0xd37556){return client[_0x050d('0x1')](_0x050d('0x4'),{'body':_0xd37556,'options':{'where':{'id':_0x3553e3}},'log':_0x050d('0x5')});}; \ No newline at end of file +var _0xafe6=['Request','UpdateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xafe6,0xac));var _0x6afe=function(_0x33d6aa,_0x2fb857){_0x33d6aa=_0x33d6aa-0x0;var _0x3a3102=_0xafe6[_0x33d6aa];return _0x3a3102;};'use strict';var client=require(_0x6afe('0x0'));exports[_0x6afe('0x1')]=function(_0x4e052d,_0x59a85d){return client[_0x6afe('0x2')](_0x6afe('0x3'),{'body':_0x59a85d,'options':{'where':{'id':_0x4e052d}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x40d720,_0x176f85){return client[_0x6afe('0x2')](_0x6afe('0x4'),{'body':_0x176f85,'options':{'where':{'id':_0x40d720}},'log':_0x6afe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7370734..5bdf022 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 _0x899d=['../client','create','CreateSmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x899d,0x17a));var _0xd899=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x899d[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xd899('0x0'));exports[_0xd899('0x1')]=function(_0x414688){return client['Request'](_0xd899('0x2'),{'body':_0x414688,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x2ef8=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x37cb13,_0x136ed2){var _0x41fef0=function(_0x557b15){while(--_0x557b15){_0x37cb13['push'](_0x37cb13['shift']());}};_0x41fef0(++_0x136ed2);}(_0x2ef8,0x127));var _0x82ef=function(_0x1d85a6,_0x462574){_0x1d85a6=_0x1d85a6-0x0;var _0x24da53=_0x2ef8[_0x1d85a6];return _0x24da53;};'use strict';var client=require(_0x82ef('0x0'));exports[_0x82ef('0x1')]=function(_0x55d15d){return client[_0x82ef('0x2')](_0x82ef('0x3'),{'body':_0x55d15d,'log':_0x82ef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index f5259cc..9ed09d5 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0xccc2ef,_0xda5957){var _0xf9cd9b=function(_0x35c0dc){while(--_0x35c0dc){_0xccc2ef['push'](_0xccc2ef['shift']());}};_0xf9cd9b(++_0xda5957);}(_0xe706,0xa3));var _0x6e70=function(_0x4f22fe,_0x23f451){_0x4f22fe=_0x4f22fe-0x0;var _0x12adca=_0xe706[_0x4f22fe];return _0x12adca;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4f4f12,_0x111aa0){var _0x2a9bab=function(_0x44843b){while(--_0x44843b){_0x4f4f12['push'](_0x4f4f12['shift']());}};_0x2a9bab(++_0x111aa0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1625f4a..5070398 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x5afaaf,_0x13eb7c){var _0x48726d=function(_0x5f0632){while(--_0x5f0632){_0x5afaaf['push'](_0x5afaaf['shift']());}};_0x48726d(++_0x13eb7c);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x188488,_0x78cf0a){var _0x16df03=function(_0x467c1c){while(--_0x467c1c){_0x188488['push'](_0x188488['shift']());}};_0x16df03(++_0x78cf0a);}(_0x3e74,0x175));var _0x43e7=function(_0x3d61e2,_0x52e29f){_0x3d61e2=_0x3d61e2-0x0;var _0x27ac5b=_0x3e74[_0x3d61e2];return _0x27ac5b;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 35dc115..d62be5c 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(_0x94cd03,_0x26688c){var _0x17f866=function(_0x3a2455){while(--_0x3a2455){_0x94cd03['push'](_0x94cd03['shift']());}};_0x17f866(++_0x26688c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x4a70bb,_0x228b46){var _0x23a66a=function(_0x46c893){while(--_0x46c893){_0x4a70bb['push'](_0x4a70bb['shift']());}};_0x23a66a(++_0x228b46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 aa27176..fd51e0a 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 _0xea31=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x4e22e8,_0x4e29d6){var _0x4b3e6f=function(_0x4a1f24){while(--_0x4a1f24){_0x4e22e8['push'](_0x4e22e8['shift']());}};_0x4b3e6f(++_0x4e29d6);}(_0xea31,0x6b));var _0x1ea3=function(_0x554b18,_0x461edd){_0x554b18=_0x554b18-0x0;var _0x579c35=_0xea31[_0x554b18];return _0x579c35;};'use strict';var client=require(_0x1ea3('0x0'));exports['update']=function(_0x1782b8,_0x2ed015){return client[_0x1ea3('0x1')](_0x1ea3('0x2'),{'body':_0x2ed015,'options':{'where':{'id':_0x1782b8}},'log':_0x1ea3('0x3')});};exports[_0x1ea3('0x4')]=function(_0x1142f1,_0x555620){return client[_0x1ea3('0x1')](_0x1ea3('0x5'),{'body':_0x555620,'options':{'where':{'id':_0x1142f1}},'log':_0x1ea3('0x6')});}; \ No newline at end of file +var _0x07e8=['AddTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x3b4dd8,_0x4b0ff2){var _0x3776bc=function(_0x281be8){while(--_0x281be8){_0x3b4dd8['push'](_0x3b4dd8['shift']());}};_0x3776bc(++_0x4b0ff2);}(_0x07e8,0x10f));var _0x807e=function(_0x2104c2,_0x56a82b){_0x2104c2=_0x2104c2-0x0;var _0x10014e=_0x07e8[_0x2104c2];return _0x10014e;};'use strict';var client=require(_0x807e('0x0'));exports[_0x807e('0x1')]=function(_0x25e72e,_0x568d61){return client[_0x807e('0x2')]('UpdateWhatsappInteraction',{'body':_0x568d61,'options':{'where':{'id':_0x25e72e}},'log':_0x807e('0x3')});};exports['addTags']=function(_0x47d154,_0x2c423b){return client[_0x807e('0x2')](_0x807e('0x4'),{'body':_0x2c423b,'options':{'where':{'id':_0x47d154}},'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 36df9be..2c8ae78 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 _0xd703=['Request'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xd703,0x65));var _0x3d70=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xd703[_0x1a9204];return _0x17ca68;};'use strict';var client=require('../client');exports['create']=function(_0x28dae4){return client[_0x3d70('0x0')]('CreateWhatsappMessage',{'body':_0x28dae4,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xb14c=['createWhatsappMessage','CreateWhatsappMessage'];(function(_0x4e66d6,_0x9843f7){var _0x1a9b00=function(_0x33e060){while(--_0x33e060){_0x4e66d6['push'](_0x4e66d6['shift']());}};_0x1a9b00(++_0x9843f7);}(_0xb14c,0x11f));var _0xcb14=function(_0xc21ae,_0x173f65){_0xc21ae=_0xc21ae-0x0;var _0x358c22=_0xb14c[_0xc21ae];return _0x358c22;};'use strict';var client=require('../client');exports['create']=function(_0x58f350){return client['Request'](_0xcb14('0x0'),{'body':_0x58f350,'log':_0xcb14('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3f1f7d5..d372f64 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 _0x227a=['Agents','online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','strategy','User'];(function(_0x596c73,_0x22f48d){var _0x515566=function(_0x17ce11){while(--_0x17ce11){_0x596c73['push'](_0x596c73['shift']());}};_0x515566(++_0x22f48d);}(_0x227a,0x1b2));var _0xa227=function(_0xe236e0,_0x4a3feb){_0xe236e0=_0xe236e0-0x0;var _0x25da79=_0x227a[_0xe236e0];return _0x25da79;};'use strict';var client=require(_0xa227('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xa227('0x1')](_0xa227('0x2'),{'options':{'raw':![],'attributes':['id',_0xa227('0x3'),'timeout',_0xa227('0x4')],'include':[{'model':_0xa227('0x5'),'as':_0xa227('0x6'),'attributes':['id',_0xa227('0x3'),_0xa227('0x7'),_0xa227('0x8')]}]},'log':_0xa227('0x9')});};}; \ No newline at end of file +var _0x0876=['Request','GetWhatsappQueue','timeout','strategy','User','name','online','whatsappPause','getWhatsappQueues'];(function(_0x2dce33,_0x18dd32){var _0x52b5a6=function(_0x110679){while(--_0x110679){_0x2dce33['push'](_0x2dce33['shift']());}};_0x52b5a6(++_0x18dd32);}(_0x0876,0x182));var _0x6087=function(_0x56ea84,_0x1ce062){_0x56ea84=_0x56ea84-0x0;var _0x573ba0=_0x0876[_0x56ea84];return _0x573ba0;};'use strict';var client=require('../client');exports[_0x6087('0x0')]=function(){return function(){return client[_0x6087('0x1')](_0x6087('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6087('0x3'),_0x6087('0x4')],'include':[{'model':_0x6087('0x5'),'as':'Agents','attributes':['id',_0x6087('0x6'),_0x6087('0x7'),_0x6087('0x8')]}]},'log':_0x6087('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e03b023..57e2b90 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 _0x7ffc=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x3bf3de,_0x3b4362){var _0x1458b0=function(_0x2da1ab){while(--_0x2da1ab){_0x3bf3de['push'](_0x3bf3de['shift']());}};_0x1458b0(++_0x3b4362);}(_0x7ffc,0x12a));var _0xc7ff=function(_0x4aba38,_0x170974){_0x4aba38=_0x4aba38-0x0;var _0x52b7cb=_0x7ffc[_0x4aba38];return _0x52b7cb;};'use strict';var client=require(_0xc7ff('0x0'));exports[_0xc7ff('0x1')]=function(_0xce239a){return client[_0xc7ff('0x2')]('CreateWhatsappQueueReport',{'body':_0xce239a,'log':_0xc7ff('0x3')});};exports[_0xc7ff('0x4')]=function(_0x92c1ba,_0x210cc6){return client[_0xc7ff('0x2')](_0xc7ff('0x5'),{'body':_0x210cc6,'options':{'where':{'uniqueid':_0x92c1ba},'order':[['id',_0xc7ff('0x6')]],'limit':0x1},'log':_0xc7ff('0x5')});}; \ No newline at end of file +var _0x7b77=['Request','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update'];(function(_0x27bcdc,_0x152997){var _0x391206=function(_0x1993af){while(--_0x1993af){_0x27bcdc['push'](_0x27bcdc['shift']());}};_0x391206(++_0x152997);}(_0x7b77,0x1ee));var _0x77b7=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x7b77[_0x36ed3c];return _0x52a2e0;};'use strict';var client=require(_0x77b7('0x0'));exports[_0x77b7('0x1')]=function(_0x1f11b5){return client['Request']('CreateWhatsappQueueReport',{'body':_0x1f11b5,'log':_0x77b7('0x2')});};exports[_0x77b7('0x3')]=function(_0xb9ff6,_0xefad35){return client[_0x77b7('0x4')](_0x77b7('0x5'),{'body':_0xefad35,'options':{'where':{'uniqueid':_0xb9ff6},'order':[['id','DESC']],'limit':0x1},'log':_0x77b7('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 c55512f..e3c02f7 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 _0xf9a7=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','routing','string','timeout\x20is\x20a\x20number','info'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf9a7,0x133));var _0x7f9a=function(_0x11a57a,_0x425ebf){_0x11a57a=_0x11a57a-0x0;var _0x54fab3=_0xf9a7[_0x11a57a];return _0x54fab3;};'use strict';var schema=require(_0x7f9a('0x0'));var _=require(_0x7f9a('0x1'));var util=require(_0x7f9a('0x2'));var seqqueue=require(_0x7f9a('0x3'));var logger=require('../../../../config/logger')(_0x7f9a('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x7f9a('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7f9a('0x6')}});function writeLog(_0x439807,_0x120d44,_0xfcd905){return logger[_0x7f9a('0x7')](util[_0x7f9a('0x8')](_0x7f9a('0x9'),_0x439807,_0x120d44[_0x7f9a('0xa')],_0xfcd905));}function handleFindAgent(_0x12962c){return function(_0x562b54){return _0x562b54[_0x7f9a('0xa')][_0x7f9a('0xb')]()===_0x12962c['toLowerCase']();};}exports[_0x7f9a('0xc')]=function(_0x59034c,_0x2b098b,_0x18b663,_0xfe0056){return function(_0x35e6cd){try{var _0x11bb83={'name':_0x2b098b[0x0],'timeout':_0x2b098b[0x1]};var _0x3c5253=queue[_0x7f9a('0x0')](_0x11bb83,{'typecast':!![]});if(_0x3c5253[_0x7f9a('0xd')]){logger['error'](_0x7f9a('0xe'),_0x59034c,_[_0x7f9a('0xf')](_0x3c5253,_0x7f9a('0x10'))[_0x7f9a('0x11')](',\x20'));_0x35e6cd['stop']();}else{var _0x5b7e3f=_[_0x7f9a('0x12')](_0x18b663[_0x7f9a('0x13')],handleFindAgent(_0x11bb83['name']));if(_0x5b7e3f){var _0x2021e1=(_0x11bb83[_0x7f9a('0x14')]||0xa)*0x3e8;var _0xda4283,_0x56ef37;var _0x265b57=seqqueue['createQueue'](_0x2021e1);_0x265b57['id']=_0x59034c;_0x265b57['atimeout']=_0x2021e1;_0x265b57[_0x7f9a('0x15')]=_0xfe0056['channel'];writeLog(_0x59034c,_0x5b7e3f,util[_0x7f9a('0x8')](_0x7f9a('0x16'),_0x2021e1));_0x18b663[_0x7f9a('0x17')][_0x59034c]['on'](_0x7f9a('0x18'),function(){logger['info'](_0x7f9a('0x19'),_0x59034c);clearTimeout(_0x56ef37);_0x56ef37=undefined;_0x265b57[_0x7f9a('0x1a')]();if(_0x18b663[_0x7f9a('0x17')][_0x59034c]){delete _0x18b663[_0x7f9a('0x17')][_0x59034c];}_0x35e6cd[_0x7f9a('0x1b')]();});_0x18b663[_0x7f9a('0x17')][_0x59034c]['on'](_0x7f9a('0x1c'),function(){if(_0x18b663[_0x7f9a('0x17')][_0x59034c]){delete _0x18b663[_0x7f9a('0x17')][_0x59034c];}});_0x56ef37=setTimeout(function(){logger[_0x7f9a('0x7')](_0x7f9a('0x1d'),_0x59034c);clearTimeout(_0x56ef37);_0x265b57[_0x7f9a('0x1a')]();_0x35e6cd[_0x7f9a('0x1e')]();},_0x2021e1);strategy[_0x7f9a('0x1f')](_0x265b57,_0x5b7e3f,_0x18b663,_0xfe0056);}else{logger[_0x7f9a('0x20')](_0x7f9a('0x21'),_0x59034c,_0x11bb83[_0x7f9a('0xa')]);_0x35e6cd[_0x7f9a('0x1b')]();}}}catch(_0x201366){console['log'](_0x201366);logger[_0x7f9a('0x20')]('[%s][QUEUE]\x20%s',_0x59034c,_0x201366[_0x7f9a('0x22')]);_0x35e6cd[_0x7f9a('0x1b')]();}};}; \ No newline at end of file +var _0x0223=['START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','name','log','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','channel'];(function(_0x3fe067,_0x42464f){var _0x3018a8=function(_0x50588f){while(--_0x50588f){_0x3fe067['push'](_0x3fe067['shift']());}};_0x3018a8(++_0x42464f);}(_0x0223,0xaf));var _0x3022=function(_0x33f1f1,_0x3f2a10){_0x33f1f1=_0x33f1f1-0x0;var _0x3052d4=_0x0223[_0x33f1f1];return _0x3052d4;};'use strict';var schema=require(_0x3022('0x0'));var _=require(_0x3022('0x1'));var util=require(_0x3022('0x2'));var seqqueue=require(_0x3022('0x3'));var logger=require('../../../../config/logger')(_0x3022('0x4'));var strategy=require(_0x3022('0x5'));var queue=schema({'name':{'type':_0x3022('0x6'),'required':!![],'message':_0x3022('0x7')},'timeout':{'type':_0x3022('0x8'),'message':_0x3022('0x9')}});function writeLog(_0x18b1e9,_0xc2cefe,_0x1c1aff){return logger[_0x3022('0xa')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x18b1e9,_0xc2cefe['name'],_0x1c1aff));}function handleFindAgent(_0x308141){return function(_0x1ab7ad){return _0x1ab7ad['name'][_0x3022('0xb')]()===_0x308141[_0x3022('0xb')]();};}exports[_0x3022('0xc')]=function(_0x929e8,_0x3de68a,_0x7d2b4b,_0x50ae4e){return function(_0x591866){try{var _0x29875f={'name':_0x3de68a[0x0],'timeout':_0x3de68a[0x1]};var _0x508bc1=queue[_0x3022('0x0')](_0x29875f,{'typecast':!![]});if(_0x508bc1['length']){logger[_0x3022('0xd')](_0x3022('0xe'),_0x929e8,_[_0x3022('0xf')](_0x508bc1,_0x3022('0x10'))[_0x3022('0x11')](',\x20'));_0x591866[_0x3022('0x12')]();}else{var _0x510c3a=_[_0x3022('0x13')](_0x7d2b4b[_0x3022('0x14')],handleFindAgent(_0x29875f['name']));if(_0x510c3a){var _0x401b86=(_0x29875f['timeout']||0xa)*0x3e8;var _0x1d5fd9,_0x3dd72e;var _0x55cedb=seqqueue[_0x3022('0x15')](_0x401b86);_0x55cedb['id']=_0x929e8;_0x55cedb['atimeout']=_0x401b86;_0x55cedb[_0x3022('0x16')]=_0x50ae4e[_0x3022('0x16')];writeLog(_0x929e8,_0x510c3a,util['format'](_0x3022('0x17'),_0x401b86));_0x7d2b4b[_0x3022('0x18')][_0x929e8]['on']('end',function(){logger[_0x3022('0xa')](_0x3022('0x19'),_0x929e8);clearTimeout(_0x3dd72e);_0x3dd72e=undefined;_0x55cedb[_0x3022('0x1a')]();if(_0x7d2b4b[_0x3022('0x18')][_0x929e8]){delete _0x7d2b4b[_0x3022('0x18')][_0x929e8];}_0x591866['stop']();});_0x7d2b4b['rules'][_0x929e8]['on'](_0x3022('0x1b'),function(){if(_0x7d2b4b[_0x3022('0x18')][_0x929e8]){delete _0x7d2b4b['rules'][_0x929e8];}});_0x3dd72e=setTimeout(function(){logger[_0x3022('0xa')](_0x3022('0x1c'),_0x929e8);clearTimeout(_0x3dd72e);_0x55cedb[_0x3022('0x1a')]();_0x591866[_0x3022('0x1d')]();},_0x401b86);strategy['agent'](_0x55cedb,_0x510c3a,_0x7d2b4b,_0x50ae4e);}else{logger[_0x3022('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x929e8,_0x29875f[_0x3022('0x1e')]);_0x591866['stop']();}}}catch(_0x44859a){console[_0x3022('0x1f')](_0x44859a);logger['error']('[%s][QUEUE]\x20%s',_0x929e8,_0x44859a[_0x3022('0x20')]);_0x591866[_0x3022('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 195305d..2b316f9 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 _0xc3e7=['created','isEmpty','body','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','amazonlex','dialogState','moment','aws-sdk','./utils','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst'];(function(_0x191f5d,_0x262d2b){var _0x33f419=function(_0x4185f6){while(--_0x4185f6){_0x191f5d['push'](_0x191f5d['shift']());}};_0x33f419(++_0x262d2b);}(_0xc3e7,0x12d));var _0x7c3e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc3e7[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var moment=require(_0x7c3e('0x0'));var AWS=require(_0x7c3e('0x1'));var utils=require(_0x7c3e('0x2'));var logger=require('../../../../config/logger')(_0x7c3e('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7c3e('0x4')),'smsMessage':require(_0x7c3e('0x5')),'faxMessage':require(_0x7c3e('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7c3e('0x7')]=function(_0x290eda,_0x458de1){return function(_0x1748ee){try{if(!_[_0x7c3e('0x8')](this[_0x7c3e('0x9')][_0x7c3e('0xa')])){logger[_0x7c3e('0xb')](_0x7c3e('0xc'),_0x290eda,_0x7c3e('0xd'));return _0x1748ee[_0x7c3e('0xe')]();}var _0xf85614={'ContactId':this[_0x7c3e('0xf')]['id'],'sentAt':moment()[_0x7c3e('0x10')](_0x7c3e('0x11')),'direction':_0x7c3e('0x12')};if(this[_0x7c3e('0x13')]===_0x7c3e('0x14')||this[_0x7c3e('0x13')]===_0x7c3e('0x15')){_0xf85614[_0x7c3e('0x16')]=this[_0x7c3e('0x9')]['phone'];}var _0xfb3152=this[_0x7c3e('0x13')];if(_0xfb3152===_0x7c3e('0x17')){_0xf85614[_0x7c3e('0x18')]=this[_0x7c3e('0x19')]['id'];}else{_0xf85614[_['upperFirst'](_0xfb3152)+_0x7c3e('0x1a')]=this[_0x7c3e('0x19')]['id'];}_0xf85614[_[_0x7c3e('0x1b')](_0xfb3152)+'InteractionId']=this[_0x7c3e('0x9')]['id'];if(this[_0x7c3e('0x9')][_0x7c3e('0x1c')]){var _0x56431f=_0x458de1[0x4];if(!_[_0x7c3e('0x1d')](_0x56431f)){_0xf85614[_0x7c3e('0x1e')]=utils['getMustacheRender'](_0x56431f,this);return rpc[_0xfb3152+_0x7c3e('0x1f')][_0x7c3e('0x20')](_0xf85614)[_0x7c3e('0x21')](function(_0x4f8b8e){logger['info'](_0x7c3e('0xc'),_0x290eda,_0xf85614['body']);})[_0x7c3e('0x22')](function(_0x5fa34c){logger[_0x7c3e('0x23')](_0x7c3e('0xc'),_0x290eda,JSON[_0x7c3e('0x24')](_0x5fa34c));})[_0x7c3e('0x25')](function(){logger['info'](_0x7c3e('0x26'),_0x290eda);_0x1748ee[_0x7c3e('0x27')]();});}else{logger[_0x7c3e('0xb')](_0x7c3e('0x28'),_0x290eda);_0x1748ee[_0x7c3e('0x27')]();}}else{var _0x1a5bb1=this;var _0x42b657=new AWS[(_0x7c3e('0x29'))]({'accessKeyId':_0x458de1[0x0],'secretAccessKey':_0x458de1[0x1],'region':_0x458de1[0x2]});var _0x1076c7={'botAlias':'$LATEST','botName':_0x458de1[0x3],'inputText':this[_0x7c3e('0x2a')][_0x7c3e('0x1e')],'userId':this[_0x7c3e('0x13')]+':'+this[_0x7c3e('0x9')]['id'][_0x7c3e('0x2b')]()};_0x42b657[_0x7c3e('0x2c')](_0x1076c7,function(_0x50a4e7,_0x514a41){if(_0x50a4e7){logger[_0x7c3e('0x23')]('[%s][AMAZONLEX]\x20%s',_0x290eda,_0x50a4e7[_0x7c3e('0x2a')]);_0x1748ee[_0x7c3e('0xe')]();}else if(_0x514a41&&_0x514a41[_0x7c3e('0x2a')]){_0x1a5bb1['body']['amazonlex']=_0x514a41;_0xf85614[_0x7c3e('0x1e')]=_0x514a41[_0x7c3e('0x2a')];_0xf85614['providerName']=_0x7c3e('0x2d');_0xf85614['providerResponse']=JSON[_0x7c3e('0x24')](_0x514a41);return rpc[_0xfb3152+'Message'][_0x7c3e('0x20')](_0xf85614)['then'](function(_0x2a5509){logger[_0x7c3e('0xb')](_0x7c3e('0xc'),_0x290eda,_0xf85614[_0x7c3e('0x1e')]);if(_0x514a41[_0x7c3e('0x2e')]=='Failed'){_0x1748ee[_0x7c3e('0xe')]();}else{_0x1748ee[_0x7c3e('0x27')]();}})[_0x7c3e('0x22')](function(_0x4cfa6b){logger[_0x7c3e('0x23')](_0x7c3e('0xc'),_0x290eda,JSON[_0x7c3e('0x24')](_0x4cfa6b));_0x1748ee['next']();});}else{_0x1748ee[_0x7c3e('0xe')]();}});}}catch(_0x246fdc){logger[_0x7c3e('0x23')](_0x7c3e('0xc'),_0x290eda,JSON['stringify'](_0x246fdc));_0x1748ee[_0x7c3e('0x27')]();}};}; \ No newline at end of file +var _0xe5d6=['channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','created','body','getMustacheRender','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','next','amazonlex','providerResponse','Message','dialogState','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out'];(function(_0x43a2e5,_0x125be7){var _0x1ecd25=function(_0x274428){while(--_0x274428){_0x43a2e5['push'](_0x43a2e5['shift']());}};_0x1ecd25(++_0x125be7);}(_0xe5d6,0x1f4));var _0x6e5d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe5d6[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x6e5d('0x0'));var moment=require('moment');var AWS=require(_0x6e5d('0x1'));var utils=require(_0x6e5d('0x2'));var logger=require(_0x6e5d('0x3'))('routing');var rpc={'chatMessage':require(_0x6e5d('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6e5d('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x6e5d('0x6')]=function(_0x9c820,_0x1f5f2c){return function(_0x7311a8){try{if(!_[_0x6e5d('0x7')](this[_0x6e5d('0x8')][_0x6e5d('0x9')])){logger[_0x6e5d('0xa')](_0x6e5d('0xb'),_0x9c820,_0x6e5d('0xc'));return _0x7311a8['next']();}var _0x49ec1b={'ContactId':this[_0x6e5d('0xd')]['id'],'sentAt':moment()[_0x6e5d('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6e5d('0xf')};if(this[_0x6e5d('0x10')]===_0x6e5d('0x11')||this[_0x6e5d('0x10')]===_0x6e5d('0x12')){_0x49ec1b[_0x6e5d('0x13')]=this[_0x6e5d('0x8')]['phone'];}var _0x2c9978=this[_0x6e5d('0x10')];if(_0x2c9978==='chat'){_0x49ec1b[_0x6e5d('0x14')]=this['account']['id'];}else{_0x49ec1b[_[_0x6e5d('0x15')](_0x2c9978)+_0x6e5d('0x16')]=this['account']['id'];}_0x49ec1b[_[_0x6e5d('0x15')](_0x2c9978)+'InteractionId']=this[_0x6e5d('0x8')]['id'];if(this[_0x6e5d('0x8')][_0x6e5d('0x17')]){var _0x362175=_0x1f5f2c[0x4];if(!_['isEmpty'](_0x362175)){_0x49ec1b[_0x6e5d('0x18')]=utils[_0x6e5d('0x19')](_0x362175,this);return rpc[_0x2c9978+'Message'][_0x6e5d('0x1a')](_0x49ec1b)[_0x6e5d('0x1b')](function(_0x4f8d41){logger[_0x6e5d('0xa')](_0x6e5d('0xb'),_0x9c820,_0x49ec1b[_0x6e5d('0x18')]);})[_0x6e5d('0x1c')](function(_0x22fddf){logger[_0x6e5d('0x1d')](_0x6e5d('0xb'),_0x9c820,JSON[_0x6e5d('0x1e')](_0x22fddf));})[_0x6e5d('0x1f')](function(){logger['info'](_0x6e5d('0x20'),_0x9c820);_0x7311a8[_0x6e5d('0x21')]();});}else{logger[_0x6e5d('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x9c820);_0x7311a8[_0x6e5d('0x21')]();}}else{var _0x31da0a=this;var _0x21c08d=new AWS[(_0x6e5d('0x22'))]({'accessKeyId':_0x1f5f2c[0x0],'secretAccessKey':_0x1f5f2c[0x1],'region':_0x1f5f2c[0x2]});var _0x4122a1={'botAlias':_0x6e5d('0x23'),'botName':_0x1f5f2c[0x3],'inputText':this[_0x6e5d('0x24')][_0x6e5d('0x18')],'userId':this[_0x6e5d('0x10')]+':'+this['interaction']['id'][_0x6e5d('0x25')]()};_0x21c08d['postText'](_0x4122a1,function(_0x4c9e1c,_0x2bb71f){if(_0x4c9e1c){logger[_0x6e5d('0x1d')](_0x6e5d('0xb'),_0x9c820,_0x4c9e1c['message']);_0x7311a8[_0x6e5d('0x26')]();}else if(_0x2bb71f&&_0x2bb71f[_0x6e5d('0x24')]){_0x31da0a[_0x6e5d('0x18')][_0x6e5d('0x27')]=_0x2bb71f;_0x49ec1b[_0x6e5d('0x18')]=_0x2bb71f[_0x6e5d('0x24')];_0x49ec1b['providerName']=_0x6e5d('0x27');_0x49ec1b[_0x6e5d('0x28')]=JSON[_0x6e5d('0x1e')](_0x2bb71f);return rpc[_0x2c9978+_0x6e5d('0x29')][_0x6e5d('0x1a')](_0x49ec1b)['then'](function(_0x5ed2d1){logger[_0x6e5d('0xa')](_0x6e5d('0xb'),_0x9c820,_0x49ec1b[_0x6e5d('0x18')]);if(_0x2bb71f[_0x6e5d('0x2a')]=='Failed'){_0x7311a8['next']();}else{_0x7311a8['stop']();}})[_0x6e5d('0x1c')](function(_0x27d406){logger[_0x6e5d('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x9c820,JSON[_0x6e5d('0x1e')](_0x27d406));_0x7311a8[_0x6e5d('0x26')]();});}else{_0x7311a8[_0x6e5d('0x26')]();}});}}catch(_0x50db3d){logger['error'](_0x6e5d('0xb'),_0x9c820,JSON['stringify'](_0x50db3d));_0x7311a8[_0x6e5d('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 1824662..cf46800 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 _0x69f4=['headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','phone','read','subject','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','messageId','html','','replace',''];(function(_0xb3a7bf,_0x2bc01b){var _0x32a375=function(_0x4e9557){while(--_0x4e9557){_0xb3a7bf['push'](_0xb3a7bf['shift']());}};_0x32a375(++_0x2bc01b);}(_0x69f4,0xa1));var _0x469f=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0x69f4[_0x4f3242];return _0x49844f;};'use strict';var _=require(_0x469f('0x0'));var moment=require('moment');var utils=require(_0x469f('0x1'));var logger=require('../../../../config/logger')(_0x469f('0x2'));var rpc={'chatMessage':require(_0x469f('0x3')),'openchannelMessage':require(_0x469f('0x4')),'mailMessage':require(_0x469f('0x5')),'smsMessage':require(_0x469f('0x6')),'faxMessage':require(_0x469f('0x7')),'whatsappMessage':require(_0x469f('0x8')),'chatInteraction':require(_0x469f('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x469f('0xa')),'whatsappInteraction':require(_0x469f('0xb'))};var mailRpc=require(_0x469f('0xc'));exports[_0x469f('0xd')]=function(_0x4b5a07,_0x36de6d,_0xf4b5b0,_0x5a2653){return function(_0x471400){try{var _0x1f8e1f=this[_0x469f('0xe')];if(_0x1f8e1f===_0x469f('0xf')&&_0x5a2653[_0x469f('0x10')][_0x469f('0x11')]){logger[_0x469f('0x12')](_0x469f('0x13'),_0x4b5a07,_0x469f('0x14'));return _0x471400[_0x469f('0x15')]();}if(_0x36de6d[0x0]==='1'&&(_[_0x469f('0x16')](this[_0x469f('0x17')][_0x469f('0x18')])||!this['interaction'][_0x469f('0x18')])){logger[_0x469f('0x12')](_0x469f('0x13'),_0x4b5a07,_0x469f('0x19'));return _0x471400[_0x469f('0x15')]();}if(_0x36de6d[0x0]==='2'&&this[_0x469f('0x17')][_0x469f('0x1a')]){logger[_0x469f('0x12')](_0x469f('0x1b'),_0x4b5a07,_0x469f('0x1c'));return _0x471400[_0x469f('0x15')]();}var _0x4fb43d={'ContactId':this[_0x469f('0x1d')]['id'],'sentAt':moment()[_0x469f('0x1e')](_0x469f('0x1f')),'direction':_0x469f('0x20')};if(this[_0x469f('0xe')]===_0x469f('0xf')){_0x4fb43d['body']=utils[_0x469f('0x21')](_0x36de6d[0x2],this);}else{_0x4fb43d[_0x469f('0x10')]=utils['getMustacheRender'](_0x36de6d[0x1],this);}if(this['message']){_0x4fb43d['to']=this['message']['from']||'';if(this[_0x469f('0xe')]===_0x469f('0xf')&&_0x36de6d[0x1]==='1'){_0x4fb43d['cc']=this['message']['cc']||'';}_0x4fb43d['from']=this[_0x469f('0x22')]['to']||'';_0x4fb43d[_0x469f('0x23')]=this[_0x469f('0x22')][_0x469f('0x23')]||'';_0x4fb43d[_0x469f('0x24')]=!![];if(this['message'][_0x469f('0x25')]){_0x4fb43d['subject']='';_0x4fb43d[_0x469f('0x25')]+=_['startsWith'](this['message'][_0x469f('0x25')],_0x469f('0x26'))?'':'Re:\x20';_0x4fb43d[_0x469f('0x25')]+=this['message'][_0x469f('0x25')];}}if(this[_0x469f('0xe')]===_0x469f('0x27')){_0x4fb43d[_0x469f('0x28')]=this['account']['id'];}else{_0x4fb43d[_[_0x469f('0x29')](this[_0x469f('0xe')])+_0x469f('0x2a')]=this[_0x469f('0x2b')]['id'];}_0x4fb43d[_[_0x469f('0x29')](this[_0x469f('0xe')])+_0x469f('0x2c')]=this[_0x469f('0x17')]['id'];var _0x1ce9e6=this['interaction'];if(rpc[this['channel']+_0x469f('0x2d')]){if(this['channel']===_0x469f('0xf')){_0x4fb43d['inReplyTo']=this['message'][_0x469f('0x2e')];_0x4fb43d[_0x469f('0x2f')]=_0x469f('0x30')+_[_0x469f('0x31')](_0x4fb43d[_0x469f('0x10')],'','','headers','auto-replied','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','Interaction','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','update','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil'];(function(_0x3ef5e4,_0x562317){var _0x10e5d3=function(_0x507e46){while(--_0x507e46){_0x3ef5e4['push'](_0x3ef5e4['shift']());}};_0x10e5d3(++_0x562317);}(_0xaab3,0x142));var _0x3aab=function(_0x49afee,_0x2a1c15){_0x49afee=_0x49afee-0x0;var _0x28ad83=_0xaab3[_0x49afee];return _0x28ad83;};'use strict';var _=require(_0x3aab('0x0'));var moment=require(_0x3aab('0x1'));var utils=require(_0x3aab('0x2'));var logger=require(_0x3aab('0x3'))(_0x3aab('0x4'));var rpc={'chatMessage':require(_0x3aab('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3aab('0x6')),'smsMessage':require(_0x3aab('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3aab('0x8')),'chatInteraction':require(_0x3aab('0x9')),'openchannelInteraction':require(_0x3aab('0xa')),'mailInteraction':require(_0x3aab('0xb')),'smsInteraction':require(_0x3aab('0xc')),'faxInteraction':require(_0x3aab('0xd')),'whatsappInteraction':require(_0x3aab('0xe'))};var mailRpc=require(_0x3aab('0xf'));exports['consequence']=function(_0x3c0ead,_0x27beb7,_0x41bce2,_0x2b594f){return function(_0x2ac39f){try{var _0x2b55aa=this[_0x3aab('0x10')];if(_0x2b55aa==='mail'&&_0x2b594f[_0x3aab('0x11')][_0x3aab('0x12')]){logger[_0x3aab('0x13')](_0x3aab('0x14'),_0x3c0ead,_0x3aab('0x15'));return _0x2ac39f['next']();}if(_0x27beb7[0x0]==='1'&&(_[_0x3aab('0x16')](this['interaction'][_0x3aab('0x17')])||!this[_0x3aab('0x18')][_0x3aab('0x17')])){logger[_0x3aab('0x13')]('[%s][AUTOREPLY]\x20%s',_0x3c0ead,_0x3aab('0x19'));return _0x2ac39f[_0x3aab('0x1a')]();}if(_0x27beb7[0x0]==='2'&&this[_0x3aab('0x18')]['autoreplyExecuted']){logger['info'](_0x3aab('0x1b'),_0x3c0ead,_0x3aab('0x1c'));return _0x2ac39f[_0x3aab('0x1a')]();}var _0x295765={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3aab('0x1d')](_0x3aab('0x1e')),'direction':_0x3aab('0x1f')};if(this[_0x3aab('0x10')]==='mail'){_0x295765[_0x3aab('0x11')]=utils[_0x3aab('0x20')](_0x27beb7[0x2],this);}else{_0x295765[_0x3aab('0x11')]=utils['getMustacheRender'](_0x27beb7[0x1],this);}if(this['message']){_0x295765['to']=this[_0x3aab('0x21')]['from']||'';if(this[_0x3aab('0x10')]===_0x3aab('0x22')&&_0x27beb7[0x1]==='1'){_0x295765['cc']=this['message']['cc']||'';}_0x295765[_0x3aab('0x23')]=this['message']['to']||'';_0x295765[_0x3aab('0x24')]=this[_0x3aab('0x21')]['phone']||'';_0x295765[_0x3aab('0x25')]=!![];if(this[_0x3aab('0x21')][_0x3aab('0x26')]){_0x295765[_0x3aab('0x26')]='';_0x295765[_0x3aab('0x26')]+=_[_0x3aab('0x27')](this[_0x3aab('0x21')][_0x3aab('0x26')],_0x3aab('0x28'))?'':_0x3aab('0x29');_0x295765[_0x3aab('0x26')]+=this[_0x3aab('0x21')][_0x3aab('0x26')];}}if(this[_0x3aab('0x10')]==='chat'){_0x295765[_0x3aab('0x2a')]=this[_0x3aab('0x2b')]['id'];}else{_0x295765[_[_0x3aab('0x2c')](this[_0x3aab('0x10')])+_0x3aab('0x2d')]=this[_0x3aab('0x2b')]['id'];}_0x295765[_['upperFirst'](this[_0x3aab('0x10')])+'InteractionId']=this[_0x3aab('0x18')]['id'];var _0x420350=this['interaction'];if(rpc[this[_0x3aab('0x10')]+_0x3aab('0x2e')]){if(this[_0x3aab('0x10')]===_0x3aab('0x22')){_0x295765[_0x3aab('0x2f')]=this[_0x3aab('0x21')][_0x3aab('0x30')];_0x295765['html']=_0x3aab('0x31')+_['replace'](_0x295765[_0x3aab('0x11')],_0x3aab('0x32'),']+(>|$)/g,''),'priorityTrue':_0x18eb83[0x1],'priorityFalse':_0x18eb83[0x2]};var _0x3c7d74=gotoif[_0x75dc('0x0')](_0x3343ae,{'typecast':!![]});if(_0x3c7d74['length']){logger[_0x75dc('0xd')](_0x75dc('0xe'),_0x3e9a2a,_['map'](_0x3c7d74,_0x75dc('0xf'))['join'](',\x20'));_0x4265c5[_0x75dc('0x10')]();}else{try{var _0x447dee=eval('('+_0x3343ae[_0x75dc('0x11')]+')');var _0x4f07e0=_0x447dee?_0x3343ae[_0x75dc('0x12')]:_0x3343ae['priorityFalse'];logger[_0x75dc('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3e9a2a,_0x3343ae[_0x75dc('0x11')],_0x447dee,_0x4f07e0||_0x75dc('0x14'));if(_0x4f07e0){var _0x5128f3=_[_0x75dc('0x15')](_0x4265c5['rules'](),{'p':_0x4f07e0});if(_0x5128f3>=0x0){logger[_0x75dc('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3e9a2a,_0x4f07e0||'next',_0x5128f3);_0x4265c5[_0x75dc('0x14')](_0x5128f3);}else{logger[_0x75dc('0x13')](_0x75dc('0x16'),_0x3e9a2a,_0x4f07e0||_0x75dc('0x14'));_0x4265c5[_0x75dc('0x10')]();}}else{_0x4265c5[_0x75dc('0x14')]();}}catch(_0x3ed542){logger[_0x75dc('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3e9a2a,_0x3ed542[_0x75dc('0xf')]);_0x4265c5['stop']();}}}catch(_0x5263c1){logger[_0x75dc('0xd')](_0x75dc('0xe'),_0x3e9a2a,JSON[_0x75dc('0x17')](_0x5263c1));_0x4265c5[_0x75dc('0x10')]();}};}; \ No newline at end of file +var _0x85dc=['stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','message'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x85dc,0xe1));var _0xc85d=function(_0x267ca4,_0xff17fc){_0x267ca4=_0x267ca4-0x0;var _0x2c243b=_0x85dc[_0x267ca4];return _0x2c243b;};'use strict';var schema=require(_0xc85d('0x0'));var _=require(_0xc85d('0x1'));var htmlToText=require(_0xc85d('0x2'));var utils=require(_0xc85d('0x3'));var logger=require('../../../../config/logger')(_0xc85d('0x4'));var gotoif=schema({'condition':{'type':_0xc85d('0x5'),'required':!![],'message':_0xc85d('0x6')},'priorityTrue':{'type':_0xc85d('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xc85d('0x7'),'message':_0xc85d('0x8')}});exports[_0xc85d('0x9')]=function(_0x12a048,_0x197670){return function(_0x21c1b4){try{var _0x2b668f={'condition':htmlToText[_0xc85d('0xa')](utils[_0xc85d('0xb')](_0x197670[0x0],this),{'wordwrap':![]})[_0xc85d('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x197670[0x1],'priorityFalse':_0x197670[0x2]};var _0x753cdb=gotoif[_0xc85d('0x0')](_0x2b668f,{'typecast':!![]});if(_0x753cdb['length']){logger[_0xc85d('0xd')](_0xc85d('0xe'),_0x12a048,_[_0xc85d('0xf')](_0x753cdb,'message')['join'](',\x20'));_0x21c1b4['stop']();}else{try{var _0x2de666=eval('('+_0x2b668f[_0xc85d('0x10')]+')');var _0x268fbe=_0x2de666?_0x2b668f[_0xc85d('0x11')]:_0x2b668f[_0xc85d('0x12')];logger[_0xc85d('0x13')](_0xc85d('0x14'),_0x12a048,_0x2b668f[_0xc85d('0x10')],_0x2de666,_0x268fbe||_0xc85d('0x15'));if(_0x268fbe){var _0x1fa539=_['findIndex'](_0x21c1b4[_0xc85d('0x16')](),{'p':_0x268fbe});if(_0x1fa539>=0x0){logger[_0xc85d('0x13')](_0xc85d('0x17'),_0x12a048,_0x268fbe||_0xc85d('0x15'),_0x1fa539);_0x21c1b4[_0xc85d('0x15')](_0x1fa539);}else{logger[_0xc85d('0x13')](_0xc85d('0x18'),_0x12a048,_0x268fbe||_0xc85d('0x15'));_0x21c1b4[_0xc85d('0x19')]();}}else{_0x21c1b4['next']();}}catch(_0x543ad1){logger[_0xc85d('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x12a048,_0x543ad1[_0xc85d('0x1a')]);_0x21c1b4['stop']();}}}catch(_0x1a1603){logger[_0xc85d('0xd')](_0xc85d('0xe'),_0x12a048,JSON[_0xc85d('0x1b')](_0x1a1603));_0x21c1b4[_0xc85d('0x19')]();}};}; \ 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 02794a1..b392686 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 _0x6f2a=['length','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','consequence'];(function(_0x1f9ea2,_0x2b763e){var _0x169f95=function(_0x40046f){while(--_0x40046f){_0x1f9ea2['push'](_0x1f9ea2['shift']());}};_0x169f95(++_0x2b763e);}(_0x6f2a,0xcc));var _0xa6f2=function(_0x2f07e2,_0x2af349){_0x2f07e2=_0x2f07e2-0x0;var _0x34ad6c=_0x6f2a[_0x2f07e2];return _0x34ad6c;};'use strict';var schema=require('validate');var _=require(_0xa6f2('0x0'));var logger=require(_0xa6f2('0x1'))(_0xa6f2('0x2'));var gotop=schema({'priority':{'type':_0xa6f2('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa6f2('0x4')]=function(_0x216160,_0xb1df15){return function(_0x284273){try{var _0x4cae1b={'priority':_0xb1df15[0x0]};var _0x5ef751=gotop['validate'](_0x4cae1b,{'typecast':!![]});if(_0x5ef751[_0xa6f2('0x5')]){logger['error'](_0xa6f2('0x6'),_0x216160,_[_0xa6f2('0x7')](_0x5ef751,_0xa6f2('0x8'))[_0xa6f2('0x9')](',\x20'));_0x284273[_0xa6f2('0xa')]();}else{logger[_0xa6f2('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x216160,_0x4cae1b[_0xa6f2('0xc')]);if(_0x4cae1b[_0xa6f2('0xc')]){var _0x28b591=_[_0xa6f2('0xd')](_0x284273[_0xa6f2('0xe')](),{'p':_0x4cae1b[_0xa6f2('0xc')]});if(_0x28b591>=0x0){logger[_0xa6f2('0xb')](_0xa6f2('0xf'),_0x216160,_0x4cae1b[_0xa6f2('0xc')]||_0xa6f2('0x10'),_0x28b591);_0x284273[_0xa6f2('0x10')](_0x28b591);}else{logger['info'](_0xa6f2('0x11'),_0x216160,_0x4cae1b[_0xa6f2('0xc')]||'next');_0x284273['stop']();}}else{_0x284273['next']();}}}catch(_0x3cf9fe){logger['error'](_0xa6f2('0x6'),_0x216160,JSON[_0xa6f2('0x12')](_0x3cf9fe));_0x284273[_0xa6f2('0xa')]();}};}; \ No newline at end of file +var _0x76e2=['info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','join'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x76e2,0x107));var _0x276e=function(_0x573463,_0x2e16f6){_0x573463=_0x573463-0x0;var _0x5ad700=_0x76e2[_0x573463];return _0x5ad700;};'use strict';var schema=require(_0x276e('0x0'));var _=require('lodash');var logger=require(_0x276e('0x1'))(_0x276e('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x276e('0x3')}});exports[_0x276e('0x4')]=function(_0x2446d4,_0x8be60f){return function(_0x2f6b15){try{var _0x2869bf={'priority':_0x8be60f[0x0]};var _0x529aba=gotop['validate'](_0x2869bf,{'typecast':!![]});if(_0x529aba[_0x276e('0x5')]){logger['error'](_0x276e('0x6'),_0x2446d4,_['map'](_0x529aba,_0x276e('0x7'))[_0x276e('0x8')](',\x20'));_0x2f6b15['stop']();}else{logger[_0x276e('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x2446d4,_0x2869bf[_0x276e('0xa')]);if(_0x2869bf[_0x276e('0xa')]){var _0x477654=_['findIndex'](_0x2f6b15[_0x276e('0xb')](),{'p':_0x2869bf[_0x276e('0xa')]});if(_0x477654>=0x0){logger[_0x276e('0x9')](_0x276e('0xc'),_0x2446d4,_0x2869bf['priority']||_0x276e('0xd'),_0x477654);_0x2f6b15[_0x276e('0xd')](_0x477654);}else{logger[_0x276e('0x9')](_0x276e('0xe'),_0x2446d4,_0x2869bf[_0x276e('0xa')]||_0x276e('0xd'));_0x2f6b15['stop']();}}else{_0x2f6b15[_0x276e('0xd')]();}}}catch(_0x21a6e){logger['error'](_0x276e('0x6'),_0x2446d4,JSON[_0x276e('0xf')](_0x21a6e));_0x2f6b15[_0x276e('0x10')]();}};}; \ 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 4a0b4ff..83e7894 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 _0x9a8f=['../../rpc/mailMessage','consequence','getMustacheRender','contact','chat','account','channel','AccountId','upperFirst','InteractionId','interaction','Message','[%s][MESSAGE]\x20%s','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x535d4a,_0x3c9019){var _0x425d2d=function(_0xd54663){while(--_0xd54663){_0x535d4a['push'](_0x535d4a['shift']());}};_0x425d2d(++_0x3c9019);}(_0x9a8f,0x1df));var _0xf9a8=function(_0x4601d7,_0x4acec7){_0x4601d7=_0x4601d7-0x0;var _0x3d6669=_0x9a8f[_0x4601d7];return _0x3d6669;};'use strict';var _=require('lodash');var utils=require(_0xf9a8('0x0'));var logger=require(_0xf9a8('0x1'))(_0xf9a8('0x2'));var rpc={'chatMessage':require(_0xf9a8('0x3')),'openchannelMessage':require(_0xf9a8('0x4')),'mailMessage':require(_0xf9a8('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xf9a8('0x6')]=function(_0x28fa50,_0x4389ab){return function(_0x372a0d){try{var _0x48237d={'body':utils[_0xf9a8('0x7')](_0x4389ab[0x0],this),'ContactId':this[_0xf9a8('0x8')]['id']};if(this['channel']===_0xf9a8('0x9')){_0x48237d['ChatWebsiteId']=this[_0xf9a8('0xa')]['id'];}else{_0x48237d[_['upperFirst'](this[_0xf9a8('0xb')])+_0xf9a8('0xc')]=this['account']['id'];}_0x48237d[_[_0xf9a8('0xd')](this[_0xf9a8('0xb')])+_0xf9a8('0xe')]=this[_0xf9a8('0xf')]['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+_0xf9a8('0x10')]['create'](_0x48237d)['then'](function(_0x29ad0c){logger['info'](_0xf9a8('0x11'),_0x28fa50,_0x48237d['body']);_0x372a0d['next']();})[_0xf9a8('0x12')](function(_0x4144ba){logger[_0xf9a8('0x13')]('[%s][MESSAGE]\x20%s',_0x28fa50,JSON[_0xf9a8('0x14')](_0x4144ba));_0x372a0d[_0xf9a8('0x15')]();});}}catch(_0x3678eb){logger[_0xf9a8('0x13')](_0xf9a8('0x11'),_0x28fa50,JSON[_0xf9a8('0x14')](_0x3678eb));_0x372a0d[_0xf9a8('0x15')]();}};}; \ No newline at end of file +var _0xa953=['AccountId','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','getMustacheRender','contact','channel','account'];(function(_0x3fa76e,_0xb0c19f){var _0x16498e=function(_0x191873){while(--_0x191873){_0x3fa76e['push'](_0x3fa76e['shift']());}};_0x16498e(++_0xb0c19f);}(_0xa953,0x1d0));var _0x3a95=function(_0x5bfb78,_0x22e3ff){_0x5bfb78=_0x5bfb78-0x0;var _0x4efd00=_0xa953[_0x5bfb78];return _0x4efd00;};'use strict';var _=require(_0x3a95('0x0'));var utils=require(_0x3a95('0x1'));var logger=require(_0x3a95('0x2'))(_0x3a95('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3a95('0x4')),'mailMessage':require(_0x3a95('0x5')),'smsMessage':require(_0x3a95('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xfd621a,_0x1ffe5f){return function(_0x29613f){try{var _0xb8a831={'body':utils[_0x3a95('0x7')](_0x1ffe5f[0x0],this),'ContactId':this[_0x3a95('0x8')]['id']};if(this[_0x3a95('0x9')]==='chat'){_0xb8a831['ChatWebsiteId']=this[_0x3a95('0xa')]['id'];}else{_0xb8a831[_['upperFirst'](this['channel'])+_0x3a95('0xb')]=this['account']['id'];}_0xb8a831[_[_0x3a95('0xc')](this[_0x3a95('0x9')])+'InteractionId']=this[_0x3a95('0xd')]['id'];if(rpc[this[_0x3a95('0x9')]+_0x3a95('0xe')]){return rpc[this['channel']+_0x3a95('0xe')][_0x3a95('0xf')](_0xb8a831)[_0x3a95('0x10')](function(_0x54e2a6){logger[_0x3a95('0x11')](_0x3a95('0x12'),_0xfd621a,_0xb8a831[_0x3a95('0x13')]);_0x29613f[_0x3a95('0x14')]();})[_0x3a95('0x15')](function(_0x5098c6){logger[_0x3a95('0x16')]('[%s][MESSAGE]\x20%s',_0xfd621a,JSON[_0x3a95('0x17')](_0x5098c6));_0x29613f['stop']();});}}catch(_0x40a01d){logger[_0x3a95('0x16')]('[%s][MESSAGE]\x20%s',_0xfd621a,JSON[_0x3a95('0x17')](_0x40a01d));_0x29613f[_0x3a95('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index b648cc2..38cc8f7 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 _0x8792=['stringify','stop','../../../../config/logger','consequence','[%s][NOOP]\x20%s','next','error'];(function(_0x3fc694,_0x34aa29){var _0xbca2f7=function(_0x37af6d){while(--_0x37af6d){_0x3fc694['push'](_0x3fc694['shift']());}};_0xbca2f7(++_0x34aa29);}(_0x8792,0xe9));var _0x2879=function(_0x31be22,_0x3d1f22){_0x31be22=_0x31be22-0x0;var _0x5db137=_0x8792[_0x31be22];return _0x5db137;};'use strict';var utils=require('./utils');var logger=require(_0x2879('0x0'))('routing');exports[_0x2879('0x1')]=function(_0x54a705,_0x4fab73){return function(_0x14220d){try{logger['info'](_0x2879('0x2'),_0x54a705,utils['getMustacheRender'](_0x4fab73[0x0],this));_0x14220d[_0x2879('0x3')]();}catch(_0x271dfc){logger[_0x2879('0x4')](_0x2879('0x2'),_0x54a705,JSON[_0x2879('0x5')](_0x271dfc));_0x14220d[_0x2879('0x6')]();}};}; \ No newline at end of file +var _0x0677=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','next'];(function(_0x58345a,_0x97317a){var _0x550d0c=function(_0x4824e3){while(--_0x4824e3){_0x58345a['push'](_0x58345a['shift']());}};_0x550d0c(++_0x97317a);}(_0x0677,0xed));var _0x7067=function(_0x591080,_0x117e1e){_0x591080=_0x591080-0x0;var _0x666f7e=_0x0677[_0x591080];return _0x666f7e;};'use strict';var utils=require(_0x7067('0x0'));var logger=require(_0x7067('0x1'))(_0x7067('0x2'));exports[_0x7067('0x3')]=function(_0x41d1bd,_0x12e650){return function(_0xbe2dde){try{logger[_0x7067('0x4')]('[%s][NOOP]\x20%s',_0x41d1bd,utils['getMustacheRender'](_0x12e650[0x0],this));_0xbe2dde[_0x7067('0x5')]();}catch(_0x2cb97f){logger[_0x7067('0x6')]('[%s][NOOP]\x20%s',_0x41d1bd,JSON[_0x7067('0x7')](_0x2cb97f));_0xbe2dde[_0x7067('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e8ccb51..cc0bd32 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 _0x2c57=['contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','join','stop','find','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','account','queue','from','joinAt','clone','queue_id','format','pick','%sQueuesWaitingInteractions','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ed547,_0x1f5ff7){var _0x2260ca=function(_0x1d4dba){while(--_0x1d4dba){_0x2ed547['push'](_0x2ed547['shift']());}};_0x2260ca(++_0x1f5ff7);}(_0x2c57,0x14c));var _0x72c5=function(_0x509af6,_0x348740){_0x509af6=_0x509af6-0x0;var _0x54edde=_0x2c57[_0x509af6];return _0x54edde;};'use strict';var schema=require(_0x72c5('0x0'));var _=require(_0x72c5('0x1'));var util=require(_0x72c5('0x2'));var seqqueue=require(_0x72c5('0x3'));var moment=require(_0x72c5('0x4'));var Redis=require('ioredis');var config=require(_0x72c5('0x5'));var logger=require(_0x72c5('0x6'))(_0x72c5('0x7'));var strategy=require(_0x72c5('0x8'));config[_0x72c5('0x9')]=_[_0x72c5('0xa')](config[_0x72c5('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x72c5('0xb'))(new Redis(config[_0x72c5('0x9')]));var attributes=['id','queue_id',_0x72c5('0xc'),_0x72c5('0xd'),_0x72c5('0xe'),_0x72c5('0xf')];function emit(_0x21d11d,_0x38632a,_0x220fb4){io['to'](_0x21d11d)['emit'](_0x38632a,_0x220fb4);}function emitChannelQueueInteraction(_0xa3f33d,_0x3ffa5d,_0x2ea19e,_0x3e7cad,_0xc33dfa,_0x2178bf,_0x6d1bf8,_0x3e322e){var _0x120ea5=_[_0x72c5('0x10')](_0x2ea19e);_0x120ea5[_0x72c5('0x11')]=_0x3e322e;_0x120ea5[_0x72c5('0xd')]=_0x3ffa5d;_0x120ea5[_0x72c5('0xc')]=_0x3e7cad;_0x120ea5['id']=_0xc33dfa;if(_0x2178bf){_0x6d1bf8[util[_0x72c5('0x12')]('%sQueuesWaitingInteractions',_0xa3f33d)][_0xc33dfa]=_[_0x72c5('0x13')](_0x120ea5,attributes);}else{delete _0x6d1bf8[util[_0x72c5('0x12')](_0x72c5('0x14'),_0xa3f33d)][_0xc33dfa];}emit(util[_0x72c5('0x12')]('%s:queue:%s',_0xa3f33d,_0x3ffa5d),util[_0x72c5('0x12')]('%s_queue_waiting_interaction:%s',_0xa3f33d,_0x2178bf?_0x72c5('0x15'):'remove'),_['pick'](_0x120ea5,attributes));}var rpc={'openchannelQueueReport':require(_0x72c5('0x16')),'mailQueueReport':require(_0x72c5('0x17')),'chatQueueReport':require(_0x72c5('0x18')),'smsQueueReport':require(_0x72c5('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x72c5('0x1a'))};var queue=schema({'name':{'type':_0x72c5('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x72c5('0x1c'),'message':_0x72c5('0x1d')}});function startRouting(_0x127344,_0x58a447,_0x2d19f3,_0x540a92){if(_0x127344&&_0x58a447&&_0x2d19f3){_0x58a447[_0x72c5('0x1e')]+=0x1;var _0x1d6ed4={'uniqueid':_0x127344,'from':_0x2d19f3[_0x72c5('0x1f')]?_0x2d19f3[_0x72c5('0x1f')][_0x72c5('0xe')]:'','joinAt':moment()['format'](_0x72c5('0x20')),'ContactId':_0x2d19f3[_0x72c5('0x21')]?_0x2d19f3[_0x72c5('0x21')]['id']:null,'ListId':_0x2d19f3[_0x72c5('0x22')]?_0x2d19f3[_0x72c5('0x22')]['id']:null};_0x1d6ed4[_[_0x72c5('0x23')](_0x2d19f3[_0x72c5('0x24')])+'QueueId']=_0x58a447['id']||null;_0x1d6ed4[_[_0x72c5('0x23')](_0x2d19f3['channel'])+_0x72c5('0x25')]=_0x2d19f3[_0x72c5('0x26')]?_0x2d19f3[_0x72c5('0x26')]['id']:null;_0x1d6ed4[_['upperFirst'](_0x2d19f3[_0x72c5('0x24')])+_0x72c5('0x27')]=_0x2d19f3[_0x72c5('0x28')]?_0x2d19f3[_0x72c5('0x28')]['id']:null;_0x1d6ed4[_[_0x72c5('0x23')](_0x2d19f3[_0x72c5('0x24')])+(_0x2d19f3[_0x72c5('0x24')]!==_0x72c5('0x29')?'AccountId':'WebsiteId')]=_0x2d19f3['account']?_0x2d19f3[_0x72c5('0xc')]['id']:null;logger['info'](util[_0x72c5('0x12')](_0x72c5('0x2a'),_0x127344,_0x58a447[_0x72c5('0x2b')]));emitChannelQueueInteraction(_0x2d19f3[_0x72c5('0x24')],_0x58a447['name'],_0x1d6ed4,_0x2d19f3[_0x72c5('0xc')]['name'],_0x2d19f3[_0x72c5('0x28')]['id'],!![],_0x540a92,_0x58a447['id']);if(rpc[_0x2d19f3['channel']+_0x72c5('0x2c')]){return rpc[_0x2d19f3[_0x72c5('0x24')]+_0x72c5('0x2c')][_0x72c5('0x2d')](_0x1d6ed4)['catch'](function(_0xc6c838){logger[_0x72c5('0x2e')](_0x72c5('0x2f'));});}}}function stopRouting(_0x562fea,_0x11732f,_0x598ed7,_0x513639){if(_0x562fea&&_0x11732f){_0x11732f[_0x72c5('0x1e')]-=0x1;var _0x1915ac={'leaveAt':moment()[_0x72c5('0x12')](_0x72c5('0x20')),'acceptAt':moment()['format'](_0x72c5('0x20')),'reason':_0x72c5('0x30')};logger[_0x72c5('0x31')](util[_0x72c5('0x12')](_0x72c5('0x32'),_0x562fea,_0x11732f[_0x72c5('0x2b')]));emitChannelQueueInteraction(_0x598ed7[_0x72c5('0x24')],_0x11732f[_0x72c5('0x2b')],_0x598ed7[_0x72c5('0x1f')],_0x598ed7[_0x72c5('0xc')][_0x72c5('0x2b')],_0x598ed7[_0x72c5('0x28')]['id'],![],_0x513639,_0x11732f['id']);if(rpc[_0x598ed7[_0x72c5('0x24')]+_0x72c5('0x2c')]){return rpc[_0x598ed7[_0x72c5('0x24')]+'QueueReport'][_0x72c5('0x33')](_0x562fea,_0x1915ac)['catch'](function(_0x5e837c){logger[_0x72c5('0x2e')](_0x72c5('0x34'));});}}}function endRouting(_0x3ff8b8,_0x33e25d,_0x3ca965,_0x3afb2c){if(_0x3ff8b8&&_0x33e25d){_0x33e25d[_0x72c5('0x1e')]-=0x1;var _0x17246f={'leaveAt':moment()[_0x72c5('0x12')](_0x72c5('0x20')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x72c5('0x35')};logger[_0x72c5('0x31')](util[_0x72c5('0x12')](_0x72c5('0x36'),_0x3ff8b8,_0x33e25d[_0x72c5('0x2b')]));emitChannelQueueInteraction(_0x3ca965[_0x72c5('0x24')],_0x33e25d[_0x72c5('0x2b')],_0x3ca965[_0x72c5('0x1f')],_0x3ca965[_0x72c5('0xc')][_0x72c5('0x2b')],_0x3ca965['message']['id'],![],_0x3afb2c);if(rpc[_0x3ca965['channel']+'QueueReport']){return rpc[_0x3ca965['channel']+'QueueReport'][_0x72c5('0x33')](_0x3ff8b8,_0x17246f)[_0x72c5('0x37')](function(_0x2e3f8c){logger[_0x72c5('0x2e')](_0x72c5('0x34'));});}}}function handleFindQueue(_0x1a07aa){return function(_0x820f34){return _0x820f34[_0x72c5('0x2b')][_0x72c5('0x38')]()===_0x1a07aa['toLowerCase']();};}exports['consequence']=function(_0x302c64,_0x5b07ef,_0x389e6b,_0x251b95){return function(_0x2fd6b0){try{var _0xaee7e4={'name':_0x5b07ef[0x0],'timeout':_0x5b07ef[0x1]};var _0x1cc18a=queue[_0x72c5('0x0')](_0xaee7e4,{'typecast':!![]});if(_0x1cc18a['length']){logger[_0x72c5('0x2e')]('[%s][QUEUE]\x20%s',_0x302c64,_['map'](_0x1cc18a,_0x72c5('0x28'))[_0x72c5('0x39')](',\x20'));_0x2fd6b0[_0x72c5('0x3a')]();}else{var _0x5b3f25=_[_0x72c5('0x3b')](_0x389e6b[_0x251b95[_0x72c5('0x24')]+'Queues'],handleFindQueue(_0xaee7e4[_0x72c5('0x2b')]));if(_0x5b3f25){startRouting(_0x302c64,_0x5b3f25,_0x251b95,_0x389e6b);var _0x2b304a=(_0x5b3f25[_0x72c5('0x35')]||0xa)*0x3e8;var _0x34b82f=(_0xaee7e4[_0x72c5('0x35')]||0x14)*0x3e8;var _0x259b13,_0x45831;if(_0x2b304a>_0x34b82f){_0x34b82f=_0x2b304a;}var _0x445c34=seqqueue[_0x72c5('0x3c')](_0x2b304a);_0x445c34['id']=_0x302c64;_0x445c34[_0x72c5('0x3d')]=_0x2b304a;_0x445c34['qtimeout']=_0x34b82f;_0x445c34[_0x72c5('0x24')]=_0x251b95[_0x72c5('0x24')];_0x389e6b['rules'][_0x302c64]['on'](_0x72c5('0x3e'),function(){logger[_0x72c5('0x31')](_0x72c5('0x3f'),_0x302c64);stopRouting(_0x302c64,_0x5b3f25,_0x251b95,_0x389e6b);clearTimeout(_0x259b13);_0x259b13=undefined;_0x445c34['close'](!![]);if(_0x389e6b['rules'][_0x302c64]){delete _0x389e6b['rules'][_0x302c64];}_0x2fd6b0[_0x72c5('0x3a')]();});_0x389e6b[_0x72c5('0x40')][_0x302c64]['on'](_0x72c5('0x41'),function(){if(_0x389e6b[_0x72c5('0x40')][_0x302c64]){delete _0x389e6b['rules'][_0x302c64];}});_0x259b13=setTimeout(function(){logger[_0x72c5('0x31')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x302c64);endRouting(_0x302c64,_0x5b3f25,_0x251b95,_0x389e6b);clearTimeout(_0x259b13);_0x445c34['close'](!![]);_0x2fd6b0['next']();},_0x34b82f);switch(_0x5b3f25[_0x72c5('0x42')]){case _0x72c5('0x43'):strategy['rrmemory'](_0x445c34,_0x5b3f25,_0x389e6b,_0x251b95);break;default:strategy[_0x72c5('0x44')](_0x445c34,_0x5b3f25,_0x389e6b,_0x251b95);}}else{logger['error'](_0x72c5('0x45'),_0x302c64,_0xaee7e4[_0x72c5('0x2b')]);_0x2fd6b0[_0x72c5('0x3a')]();}}}catch(_0x84f984){console[_0x72c5('0x46')](_0x84f984);logger[_0x72c5('0x2e')](_0x72c5('0x47'),_0x302c64,_0x84f984[_0x72c5('0x48')]);_0x2fd6b0[_0x72c5('0x3a')]();}};}; \ No newline at end of file +var _0xb0dd=['remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','waiting','accepted','info','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','%sQueuesWaitingInteractions','format','%s:queue:%s'];(function(_0x4ff283,_0x4fe02e){var _0x182464=function(_0x15e362){while(--_0x15e362){_0x4ff283['push'](_0x4ff283['shift']());}};_0x182464(++_0x4fe02e);}(_0xb0dd,0xc1));var _0xdb0d=function(_0x3d160f,_0x4d7fb8){_0x3d160f=_0x3d160f-0x0;var _0xd74b68=_0xb0dd[_0x3d160f];return _0xd74b68;};'use strict';var schema=require(_0xdb0d('0x0'));var _=require(_0xdb0d('0x1'));var util=require(_0xdb0d('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xdb0d('0x3'));var Redis=require(_0xdb0d('0x4'));var config=require(_0xdb0d('0x5'));var logger=require('../../../../config/logger')(_0xdb0d('0x6'));var strategy=require('./strategy');config[_0xdb0d('0x7')]=_[_0xdb0d('0x8')](config[_0xdb0d('0x7')],{'host':_0xdb0d('0x9'),'port':0x18eb});var io=require(_0xdb0d('0xa'))(new Redis(config[_0xdb0d('0x7')]));var attributes=['id',_0xdb0d('0xb'),_0xdb0d('0xc'),_0xdb0d('0xd'),_0xdb0d('0xe'),_0xdb0d('0xf')];function emit(_0x36b951,_0x2ba993,_0x1aa64a){io['to'](_0x36b951)[_0xdb0d('0x10')](_0x2ba993,_0x1aa64a);}function emitChannelQueueInteraction(_0x269005,_0xf687f1,_0x27c68a,_0x1c809f,_0x3354cc,_0x4bcffb,_0x548996,_0x396c75){var _0xa935dc=_['clone'](_0x27c68a);_0xa935dc['queue_id']=_0x396c75;_0xa935dc[_0xdb0d('0xd')]=_0xf687f1;_0xa935dc[_0xdb0d('0xc')]=_0x1c809f;_0xa935dc['id']=_0x3354cc;if(_0x4bcffb){_0x548996[util['format'](_0xdb0d('0x11'),_0x269005)][_0x3354cc]=_['pick'](_0xa935dc,attributes);}else{delete _0x548996[util['format'](_0xdb0d('0x11'),_0x269005)][_0x3354cc];}emit(util[_0xdb0d('0x12')](_0xdb0d('0x13'),_0x269005,_0xf687f1),util[_0xdb0d('0x12')]('%s_queue_waiting_interaction:%s',_0x269005,_0x4bcffb?'save':_0xdb0d('0x14')),_[_0xdb0d('0x15')](_0xa935dc,attributes));}var rpc={'openchannelQueueReport':require(_0xdb0d('0x16')),'mailQueueReport':require(_0xdb0d('0x17')),'chatQueueReport':require(_0xdb0d('0x18')),'smsQueueReport':require(_0xdb0d('0x19')),'faxQueueReport':require(_0xdb0d('0x1a')),'whatsappQueueReport':require(_0xdb0d('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xdb0d('0x1c')},'timeout':{'type':'number','message':_0xdb0d('0x1d')}});function startRouting(_0x4e4001,_0x507a02,_0x2138c5,_0x56f55f){if(_0x4e4001&&_0x507a02&&_0x2138c5){_0x507a02['waiting']+=0x1;var _0x400dc8={'uniqueid':_0x4e4001,'from':_0x2138c5[_0xdb0d('0x1e')]?_0x2138c5[_0xdb0d('0x1e')]['from']:'','joinAt':moment()[_0xdb0d('0x12')](_0xdb0d('0x1f')),'ContactId':_0x2138c5[_0xdb0d('0x20')]?_0x2138c5['contact']['id']:null,'ListId':_0x2138c5[_0xdb0d('0x21')]?_0x2138c5[_0xdb0d('0x21')]['id']:null};_0x400dc8[_[_0xdb0d('0x22')](_0x2138c5[_0xdb0d('0x23')])+'QueueId']=_0x507a02['id']||null;_0x400dc8[_[_0xdb0d('0x22')](_0x2138c5[_0xdb0d('0x23')])+_0xdb0d('0x24')]=_0x2138c5['interaction']?_0x2138c5[_0xdb0d('0x25')]['id']:null;_0x400dc8[_[_0xdb0d('0x22')](_0x2138c5['channel'])+_0xdb0d('0x26')]=_0x2138c5[_0xdb0d('0x27')]?_0x2138c5[_0xdb0d('0x27')]['id']:null;_0x400dc8[_[_0xdb0d('0x22')](_0x2138c5['channel'])+(_0x2138c5[_0xdb0d('0x23')]!==_0xdb0d('0x28')?_0xdb0d('0x29'):_0xdb0d('0x2a'))]=_0x2138c5[_0xdb0d('0xc')]?_0x2138c5['account']['id']:null;logger['info'](util[_0xdb0d('0x12')](_0xdb0d('0x2b'),_0x4e4001,_0x507a02[_0xdb0d('0x2c')]));emitChannelQueueInteraction(_0x2138c5[_0xdb0d('0x23')],_0x507a02[_0xdb0d('0x2c')],_0x400dc8,_0x2138c5[_0xdb0d('0xc')][_0xdb0d('0x2c')],_0x2138c5[_0xdb0d('0x27')]['id'],!![],_0x56f55f,_0x507a02['id']);if(rpc[_0x2138c5[_0xdb0d('0x23')]+_0xdb0d('0x2d')]){return rpc[_0x2138c5['channel']+_0xdb0d('0x2d')][_0xdb0d('0x2e')](_0x400dc8)[_0xdb0d('0x2f')](function(_0x138d95){logger[_0xdb0d('0x30')]('create\x20queue\x20report');});}}}function stopRouting(_0x3bdabd,_0x3b955e,_0x15df6d,_0x1799c8){if(_0x3bdabd&&_0x3b955e){_0x3b955e[_0xdb0d('0x31')]-=0x1;var _0x14abf6={'leaveAt':moment()[_0xdb0d('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xdb0d('0x12')](_0xdb0d('0x1f')),'reason':_0xdb0d('0x32')};logger[_0xdb0d('0x33')](util[_0xdb0d('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x3bdabd,_0x3b955e[_0xdb0d('0x2c')]));emitChannelQueueInteraction(_0x15df6d[_0xdb0d('0x23')],_0x3b955e['name'],_0x15df6d[_0xdb0d('0x1e')],_0x15df6d['account'][_0xdb0d('0x2c')],_0x15df6d[_0xdb0d('0x27')]['id'],![],_0x1799c8,_0x3b955e['id']);if(rpc[_0x15df6d['channel']+_0xdb0d('0x2d')]){return rpc[_0x15df6d[_0xdb0d('0x23')]+_0xdb0d('0x2d')][_0xdb0d('0x34')](_0x3bdabd,_0x14abf6)['catch'](function(_0x1b353c){logger[_0xdb0d('0x30')](_0xdb0d('0x35'));});}}}function endRouting(_0x5ed0c0,_0x4d0161,_0x4dbe9a,_0x5cee61){if(_0x5ed0c0&&_0x4d0161){_0x4d0161[_0xdb0d('0x31')]-=0x1;var _0x219846={'leaveAt':moment()[_0xdb0d('0x12')](_0xdb0d('0x1f')),'exitAt':moment()[_0xdb0d('0x12')](_0xdb0d('0x1f')),'reason':_0xdb0d('0x36')};logger[_0xdb0d('0x33')](util[_0xdb0d('0x12')](_0xdb0d('0x37'),_0x5ed0c0,_0x4d0161[_0xdb0d('0x2c')]));emitChannelQueueInteraction(_0x4dbe9a[_0xdb0d('0x23')],_0x4d0161[_0xdb0d('0x2c')],_0x4dbe9a[_0xdb0d('0x1e')],_0x4dbe9a['account'][_0xdb0d('0x2c')],_0x4dbe9a['message']['id'],![],_0x5cee61);if(rpc[_0x4dbe9a[_0xdb0d('0x23')]+_0xdb0d('0x2d')]){return rpc[_0x4dbe9a[_0xdb0d('0x23')]+_0xdb0d('0x2d')][_0xdb0d('0x34')](_0x5ed0c0,_0x219846)[_0xdb0d('0x2f')](function(_0x194fe6){logger[_0xdb0d('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0xcf0281){return function(_0x55b69f){return _0x55b69f[_0xdb0d('0x2c')][_0xdb0d('0x38')]()===_0xcf0281['toLowerCase']();};}exports[_0xdb0d('0x39')]=function(_0xac7078,_0x552db2,_0x374180,_0xbd1d57){return function(_0x2cce0b){try{var _0x56f933={'name':_0x552db2[0x0],'timeout':_0x552db2[0x1]};var _0x2c212a=queue['validate'](_0x56f933,{'typecast':!![]});if(_0x2c212a[_0xdb0d('0x3a')]){logger[_0xdb0d('0x30')](_0xdb0d('0x3b'),_0xac7078,_[_0xdb0d('0x3c')](_0x2c212a,'message')[_0xdb0d('0x3d')](',\x20'));_0x2cce0b[_0xdb0d('0x3e')]();}else{var _0x4d15c2=_['find'](_0x374180[_0xbd1d57[_0xdb0d('0x23')]+_0xdb0d('0x3f')],handleFindQueue(_0x56f933[_0xdb0d('0x2c')]));if(_0x4d15c2){startRouting(_0xac7078,_0x4d15c2,_0xbd1d57,_0x374180);var _0x290729=(_0x4d15c2[_0xdb0d('0x36')]||0xa)*0x3e8;var _0x4b32b2=(_0x56f933['timeout']||0x14)*0x3e8;var _0x1d248d,_0x138a77;if(_0x290729>_0x4b32b2){_0x4b32b2=_0x290729;}var _0x4044d2=seqqueue['createQueue'](_0x290729);_0x4044d2['id']=_0xac7078;_0x4044d2[_0xdb0d('0x40')]=_0x290729;_0x4044d2['qtimeout']=_0x4b32b2;_0x4044d2[_0xdb0d('0x23')]=_0xbd1d57['channel'];_0x374180[_0xdb0d('0x41')][_0xac7078]['on']('end',function(){logger['info'](_0xdb0d('0x42'),_0xac7078);stopRouting(_0xac7078,_0x4d15c2,_0xbd1d57,_0x374180);clearTimeout(_0x1d248d);_0x1d248d=undefined;_0x4044d2['close'](!![]);if(_0x374180[_0xdb0d('0x41')][_0xac7078]){delete _0x374180[_0xdb0d('0x41')][_0xac7078];}_0x2cce0b[_0xdb0d('0x3e')]();});_0x374180[_0xdb0d('0x41')][_0xac7078]['on'](_0xdb0d('0x43'),function(){if(_0x374180[_0xdb0d('0x41')][_0xac7078]){delete _0x374180[_0xdb0d('0x41')][_0xac7078];}});_0x1d248d=setTimeout(function(){logger[_0xdb0d('0x33')](_0xdb0d('0x44'),_0xac7078);endRouting(_0xac7078,_0x4d15c2,_0xbd1d57,_0x374180);clearTimeout(_0x1d248d);_0x4044d2[_0xdb0d('0x45')](!![]);_0x2cce0b['next']();},_0x4b32b2);switch(_0x4d15c2['strategy']){case'rrmemory':strategy['rrmemory'](_0x4044d2,_0x4d15c2,_0x374180,_0xbd1d57);break;default:strategy['beepall'](_0x4044d2,_0x4d15c2,_0x374180,_0xbd1d57);}}else{logger[_0xdb0d('0x30')](_0xdb0d('0x46'),_0xac7078,_0x56f933[_0xdb0d('0x2c')]);_0x2cce0b[_0xdb0d('0x3e')]();}}}catch(_0x48a942){console['log'](_0x48a942);logger[_0xdb0d('0x30')]('[%s][QUEUE]\x20%s',_0xac7078,_0x48a942['stack']);_0x2cce0b[_0xdb0d('0x3e')]();}};}; \ 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 03b2b28..8ce6ab0 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 _0x82a2=['busy','busyQueue','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','notificationId','STOP','uuid','./util','../../../../../config/logger','squeue','agent','routing','push','handleRun','handleTimeout','bind','handleDrained','prototype','debug','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel'];(function(_0x54e974,_0x121e0b){var _0x479fc3=function(_0x552d44){while(--_0x552d44){_0x54e974['push'](_0x54e974['shift']());}};_0x479fc3(++_0x121e0b);}(_0x82a2,0x1ee));var _0x282a=function(_0x4d3159,_0x2f0cb4){_0x4d3159=_0x4d3159-0x0;var _0x4ebf70=_0x82a2[_0x4d3159];return _0x4ebf70;};'use strict';var _=require('lodash');var uuid=require(_0x282a('0x0'));var util=require(_0x282a('0x1'));var logger=require(_0x282a('0x2'))('routing');var Agent=function(_0x5eb880,_0x1e431e,_0x1cf217,_0x3f51dd){this['notificationId']=uuid['v4']();this[_0x282a('0x3')]=_0x5eb880;this[_0x282a('0x4')]=_0x1e431e;this['realtime']=_0x1cf217;this[_0x282a('0x5')]=_0x3f51dd;this['squeue'][_0x282a('0x6')](this[_0x282a('0x7')]['bind'](this),this[_0x282a('0x8')][_0x282a('0x9')](this));this[_0x282a('0x3')]['on']('timeout',this[_0x282a('0x8')][_0x282a('0x9')](this));this[_0x282a('0x3')]['on']('drained',this[_0x282a('0xa')][_0x282a('0x9')](this));};Agent[_0x282a('0xb')]['push']=function(){this[_0x282a('0x3')][_0x282a('0x6')](this[_0x282a('0x7')]['bind'](this),this[_0x282a('0x8')]['bind'](this));};Agent[_0x282a('0xb')][_0x282a('0xa')]=function(){this[_0x282a('0x8')](!![]);};Agent[_0x282a('0xb')][_0x282a('0x7')]=function(){logger[_0x282a('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x282a('0x3')]['id'],this[_0x282a('0x4')]['id']);if(_[_0x282a('0xd')](this[_0x282a('0xe')][_0x282a('0xf')][this['agent']['id']])){logger[_0x282a('0xc')](_0x282a('0x10'),this[_0x282a('0x3')]['id'],this[_0x282a('0x4')]['id']);setTimeout(this[_0x282a('0x6')][_0x282a('0x9')](this),0x3e8);}else{if(this[_0x282a('0x5')][_0x282a('0x11')]||util['isAgentAvailable'](this[_0x282a('0x3')]['id'],this['realtime'][_0x282a('0xf')][this[_0x282a('0x4')]['id']],this[_0x282a('0x3')][_0x282a('0x12')],![])){this[_0x282a('0xe')][_0x282a('0xf')][this[_0x282a('0x4')]['id']][_0x282a('0x13')]=!![];this[_0x282a('0xe')][_0x282a('0xf')][this[_0x282a('0x4')]['id']][_0x282a('0x14')]=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this['realtime']['agents'][this[_0x282a('0x4')]['id']],null,this[_0x282a('0x5')]);util[_0x282a('0x15')](this[_0x282a('0x3')]['id'],this[_0x282a('0xe')]['agents'][this[_0x282a('0x4')]['id']],'RINGING'+(this[_0x282a('0x5')]['forcedOwnership']?_0x282a('0x16'):''));}else{logger['debug'](_0x282a('0x17'),this[_0x282a('0x3')]['id'],this[_0x282a('0x4')]['id']);setTimeout(this['push'][_0x282a('0x9')](this),0x3e8);}}};Agent[_0x282a('0xb')][_0x282a('0x8')]=function(_0xda4d48){if(_[_0x282a('0xd')](this[_0x282a('0xe')][_0x282a('0xf')][this['agent']['id']])){return logger['debug'](_0x282a('0x10'),this[_0x282a('0x3')]['id'],this[_0x282a('0x4')]['id']);}else{logger[_0x282a('0xc')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x282a('0x3')]['id'],this[_0x282a('0x4')]['id']);util[_0x282a('0x18')](this[_0x282a('0x19')],this[_0x282a('0x3')]['id'],this['realtime'][_0x282a('0xf')][this[_0x282a('0x4')]['id']],null,this[_0x282a('0x5')]);this[_0x282a('0xe')][_0x282a('0xf')][this[_0x282a('0x4')]['id']][_0x282a('0x13')]=![];this[_0x282a('0xe')][_0x282a('0xf')][this[_0x282a('0x4')]['id']]['busyQueue']=undefined;util[_0x282a('0x15')](this[_0x282a('0x3')]['id'],this[_0x282a('0xe')][_0x282a('0xf')][this['agent']['id']],_0xda4d48?_0x282a('0x1a'):'TIMEOUT');}if(!_0xda4d48){setTimeout(this[_0x282a('0x6')][_0x282a('0x9')](this),0x3e8);}};function agent(_0x39d01e,_0x34b0ca,_0x299dbc,_0x4f79c8){return new Agent(_0x39d01e,_0x34b0ca,_0x299dbc,_0x4f79c8);}module['exports']=agent; \ No newline at end of file +var _0x02cf=['prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','handleDrained'];(function(_0x4283ff,_0x5589e4){var _0x421b74=function(_0x37ef1a){while(--_0x37ef1a){_0x4283ff['push'](_0x4283ff['shift']());}};_0x421b74(++_0x5589e4);}(_0x02cf,0x185));var _0xf02c=function(_0x4d6f3b,_0x169895){_0x4d6f3b=_0x4d6f3b-0x0;var _0x2c3010=_0x02cf[_0x4d6f3b];return _0x2c3010;};'use strict';var _=require('lodash');var uuid=require(_0xf02c('0x0'));var util=require(_0xf02c('0x1'));var logger=require(_0xf02c('0x2'))(_0xf02c('0x3'));var Agent=function(_0x138c98,_0x6c1841,_0x439ce1,_0x9a60){this[_0xf02c('0x4')]=uuid['v4']();this[_0xf02c('0x5')]=_0x138c98;this[_0xf02c('0x6')]=_0x6c1841;this[_0xf02c('0x7')]=_0x439ce1;this['routing']=_0x9a60;this['squeue'][_0xf02c('0x8')](this[_0xf02c('0x9')][_0xf02c('0xa')](this),this[_0xf02c('0xb')][_0xf02c('0xa')](this));this[_0xf02c('0x5')]['on'](_0xf02c('0xc'),this[_0xf02c('0xb')][_0xf02c('0xa')](this));this[_0xf02c('0x5')]['on']('drained',this[_0xf02c('0xd')][_0xf02c('0xa')](this));};Agent[_0xf02c('0xe')]['push']=function(){this[_0xf02c('0x5')][_0xf02c('0x8')](this[_0xf02c('0x9')]['bind'](this),this[_0xf02c('0xb')][_0xf02c('0xa')](this));};Agent['prototype'][_0xf02c('0xd')]=function(){this[_0xf02c('0xb')](!![]);};Agent[_0xf02c('0xe')][_0xf02c('0x9')]=function(){logger[_0xf02c('0xf')](_0xf02c('0x10'),this['squeue']['id'],this[_0xf02c('0x6')]['id']);if(_[_0xf02c('0x11')](this[_0xf02c('0x7')][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']])){logger['debug'](_0xf02c('0x13'),this[_0xf02c('0x5')]['id'],this[_0xf02c('0x6')]['id']);setTimeout(this['push'][_0xf02c('0xa')](this),0x3e8);}else{if(this[_0xf02c('0x3')][_0xf02c('0x14')]||util['isAgentAvailable'](this[_0xf02c('0x5')]['id'],this[_0xf02c('0x7')][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']],this[_0xf02c('0x5')][_0xf02c('0x15')],![])){this['realtime'][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']][_0xf02c('0x16')]=!![];this['realtime'][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']][_0xf02c('0x17')]=undefined;util[_0xf02c('0x18')](this['notificationId'],this['squeue']['id'],this['realtime'][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']],null,this[_0xf02c('0x3')]);util[_0xf02c('0x19')](this['squeue']['id'],this[_0xf02c('0x7')][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']],'RINGING'+(this[_0xf02c('0x3')][_0xf02c('0x14')]?_0xf02c('0x1a'):''));}else{logger[_0xf02c('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xf02c('0x6')]['id']);setTimeout(this[_0xf02c('0x8')][_0xf02c('0xa')](this),0x3e8);}}};Agent[_0xf02c('0xe')][_0xf02c('0xb')]=function(_0x406e4e){if(_[_0xf02c('0x11')](this['realtime'][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']])){return logger[_0xf02c('0xf')](_0xf02c('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xf02c('0xf')](_0xf02c('0x1b'),this['squeue']['id'],this['agent']['id']);util[_0xf02c('0x1c')](this[_0xf02c('0x4')],this['squeue']['id'],this[_0xf02c('0x7')][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']],null,this['routing']);this[_0xf02c('0x7')][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']][_0xf02c('0x16')]=![];this['realtime'][_0xf02c('0x12')][this[_0xf02c('0x6')]['id']][_0xf02c('0x17')]=undefined;util['writeLog'](this['squeue']['id'],this[_0xf02c('0x7')][_0xf02c('0x12')][this['agent']['id']],_0x406e4e?_0xf02c('0x1d'):_0xf02c('0x1e'));}if(!_0x406e4e){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x42cea8,_0x278410,_0x2fb8ce,_0x49f8a8){return new Agent(_0x42cea8,_0x278410,_0x2fb8ce,_0x49f8a8);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index dd9a769..471466f 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 _0xc4e6=['channel','writeLog','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','queue','Agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xc4e6[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x6c4e('0x0'));var uuid=require(_0x6c4e('0x1'));var util=require('./util');var logger=require(_0x6c4e('0x2'))(_0x6c4e('0x3'));var Beepall=function(_0x86fe20,_0x399a44,_0x5ce91a,_0x23616f){this[_0x6c4e('0x4')]=uuid['v4']();this[_0x6c4e('0x5')]=_0x86fe20;this['queue']=_0x399a44;this[_0x6c4e('0x6')]=_0x5ce91a;this['routing']=_0x23616f;this['squeue'][_0x6c4e('0x7')](this[_0x6c4e('0x8')][_0x6c4e('0x9')](this),this[_0x6c4e('0xa')][_0x6c4e('0x9')](this));this[_0x6c4e('0x5')]['on'](_0x6c4e('0xb'),this[_0x6c4e('0xa')][_0x6c4e('0x9')](this));this[_0x6c4e('0x5')]['on'](_0x6c4e('0xc'),this[_0x6c4e('0xd')]['bind'](this));};Beepall['prototype'][_0x6c4e('0x7')]=function(){this[_0x6c4e('0x5')][_0x6c4e('0x7')](this['handleRun'][_0x6c4e('0x9')](this),this[_0x6c4e('0xa')][_0x6c4e('0x9')](this));};Beepall[_0x6c4e('0xe')]['handleDrained']=function(){this[_0x6c4e('0xa')](!![]);};Beepall[_0x6c4e('0xe')][_0x6c4e('0x8')]=function(){var _0x48c29e=!![];if(!_[_0x6c4e('0xf')](this['queue'])&&!_[_0x6c4e('0xf')](this[_0x6c4e('0x10')][_0x6c4e('0x11')])&&this['queue']['Agents']['length']>0x0){for(var _0x5e4e88=0x0,_0xb0b06c;_0x5e4e880x0){for(var _0x184c05=0x0,_0x3c8e78;_0x184c050x0&&_0x1fc715[_0x3291cd+_0x82bd('0x25')]>=_0x1fc715[_0x3291cd+_0x82bd('0x24')]){writeLog(_0x32954d,_0x1fc715,_0x3291cd[_0x82bd('0x26')]()+_0x82bd('0x27'));return![];}}return!![];};exports[_0x82bd('0x28')]=function(_0x3c7751,_0xbef23b,_0x2f0bb6,_0x2add80,_0x53a2a6){return sendNotification(!![],_0x3c7751,_0xbef23b,_0x2f0bb6,_0x2add80,_0x53a2a6);};exports['hideNotification']=function(_0x5609b7,_0x5d1015,_0x714d70,_0x52bcd8,_0x351d3d){return sendNotification(![],_0x5609b7,_0x5d1015,_0x714d70,_0x52bcd8,_0x351d3d);};exports[_0x82bd('0x29')]=writeLog; \ No newline at end of file +var _0xeec6=['util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','user:%s','name','emit','split','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','format','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash'];(function(_0x2b76b5,_0x22dd0c){var _0x1c4d0e=function(_0x13012f){while(--_0x13012f){_0x2b76b5['push'](_0x2b76b5['shift']());}};_0x1c4d0e(++_0x22dd0c);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0xeec6[_0x3e2489];return _0x2254ce;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var utils=require(_0x6eec('0x2'));var Redis=require(_0x6eec('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x6eec('0x4'))(_0x6eec('0x5'));config[_0x6eec('0x6')]=_[_0x6eec('0x7')](config[_0x6eec('0x6')],{'host':_0x6eec('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6eec('0x6')]));function sendNotification(_0x3c6eda,_0x48064a,_0x5a5e47,_0x1c810e,_0x3443c2,_0x834c2){io['to'](util['format'](_0x6eec('0x9'),_0x1c810e[_0x6eec('0xa')]))[_0x6eec('0xb')]('user:save',_0x1c810e);var _0x595dd4=_0x834c2||{};var _0x5e8aba=_0x5a5e47[_0x6eec('0xc')]('.');var _0xfbcfa1={'uniqueid':_0x48064a,'channel':_0x5e8aba[0x0],'id':_0x5e8aba[0x1],'title':_0x5e8aba[0x0]+'\x20interaction','interactionId':_0x5e8aba[0x2],'queue':_0x3443c2?_0x3443c2['name']:null,'sound':_0x595dd4[_0x6eec('0xd')]['notificationSound'],'shake':_0x595dd4[_0x6eec('0xd')][_0x6eec('0xe')]};try{if(!_0x595dd4[_0x6eec('0xf')]){_0x595dd4[_0x6eec('0xf')]={};}if(_0x3443c2){_0x595dd4[_0x6eec('0xf')]['queue']=_0x3443c2;}else if(_0x595dd4[_0x6eec('0xf')][_0x6eec('0x10')]){delete _0x595dd4[_0x6eec('0xf')][_0x6eec('0x10')];}_0xfbcfa1[_0x6eec('0x11')]=utils[_0x6eec('0x12')](_0x595dd4[_0x6eec('0xd')][_0x6eec('0x13')],_0x595dd4);}catch(_0x34a7fc){_0xfbcfa1[_0x6eec('0x11')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x6eec('0x14')](util['format'](_0x6eec('0x15'),_0x48064a,_0x34a7fc[_0x6eec('0x16')]));}io['to'](util['format'](_0x6eec('0x9'),_0x1c810e[_0x6eec('0xa')]))[_0x6eec('0xb')](util['format'](_0x6eec('0x17'),_0x3c6eda?_0x6eec('0x18'):_0x6eec('0x19')),_0xfbcfa1);}function writeLog(_0x3320a3,_0xd86135,_0x1761f4){return logger['debug'](util[_0x6eec('0x1a')](_0x6eec('0x1b'),_0x3320a3,_0xd86135[_0x6eec('0xa')],_0x1761f4));}exports[_0x6eec('0x1c')]=function(_0x1a8f73,_0xcd546f,_0x52f941,_0x6e40b3){if(_0xcd546f[_0x6eec('0x1d')]){writeLog(_0x1a8f73,_0xcd546f,_0x6eec('0x1e'));return![];}if(!_0xcd546f[_0x6eec('0x1f')]){writeLog(_0x1a8f73,_0xcd546f,_0x6eec('0x20'));return![];}if(_0xcd546f[_0x52f941+_0x6eec('0x21')]){writeLog(_0x1a8f73,_0xcd546f,'PAUSE');return![];}if(_0x6e40b3&&_0xcd546f[_0x6eec('0x22')](_0x52f941+_0x6eec('0x23'))&&_0xcd546f[_0x6eec('0x22')](_0x52f941+_0x6eec('0x24'))){if(_0xcd546f[_0x52f941+_0x6eec('0x23')]>0x0&&_0xcd546f[_0x52f941+_0x6eec('0x24')]>=_0xcd546f[_0x52f941+_0x6eec('0x23')]){writeLog(_0x1a8f73,_0xcd546f,_0x52f941[_0x6eec('0x25')]()+_0x6eec('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x1d750c,_0x44b31c,_0x30eb98,_0x275fd0,_0x4f507e){return sendNotification(!![],_0x1d750c,_0x44b31c,_0x30eb98,_0x275fd0,_0x4f507e);};exports[_0x6eec('0x27')]=function(_0x3b9b9f,_0x518ba5,_0x54b446,_0x3240c3,_0x47ed95){return sendNotification(![],_0x3b9b9f,_0x518ba5,_0x54b446,_0x3240c3,_0x47ed95);};exports[_0x6eec('0x28')]=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 4136b1d..bcdf0b3 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 _0x1c57=['map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','error','[%s][SYSTEM]\x20%s','validate','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x1c57,0xf5));var _0x71c5=function(_0x4f58e4,_0x1fb025){_0x4f58e4=_0x4f58e4-0x0;var _0x5492ed=_0x1c57[_0x4f58e4];return _0x5492ed;};'use strict';var schema=require(_0x71c5('0x0'));var sh=require('shelljs');var _=require(_0x71c5('0x1'));var utils=require(_0x71c5('0x2'));var logger=require('../../../../config/logger')(_0x71c5('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x71c5('0x4')}});exports[_0x71c5('0x5')]=function(_0x3a5c27,_0x48f72a){return function(_0x2cdd4a){try{var _0x5e9700={'command':_0x48f72a[0x0]};var _0xa0ff77=system[_0x71c5('0x0')](_0x5e9700,{'typecast':!![]});if(_0xa0ff77[_0x71c5('0x6')]){logger['error']('[%s][SYSTEM]\x20%s',_0x3a5c27,_[_0x71c5('0x7')](_0xa0ff77,'message')['join'](',\x20'));logger[_0x71c5('0x8')](_0x71c5('0x9'),_0x3a5c27);_0x2cdd4a[_0x71c5('0xa')]();}else{var _0x5e218c=this;var _0xde3326=utils[_0x71c5('0xb')](_0x48f72a[0x0],this);logger[_0x71c5('0x8')](_0x71c5('0xc'),_0x3a5c27,_0xde3326);sh[_0x71c5('0xd')](_[_0x71c5('0xe')](_0xde3326),function(_0x55ee61,_0x23e2cb){logger[_0x71c5('0x8')](_0x71c5('0xf'),_0x3a5c27,_0x55ee61);if(_0x55ee61==0x0){var _0xe83ba7=_0x23e2cb['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x71c5('0x10')](_0x48f72a[0x1])||_['isEmpty'](_0x48f72a[0x1])){logger['info'](_0x71c5('0x11'),_0x3a5c27);_0x5e218c[_0x71c5('0x12')][_0x48f72a[0x1]]=_0xe83ba7;}else{logger[_0x71c5('0x8')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3a5c27,_0x48f72a[0x1],_0xe83ba7);_0x5e218c[_0x71c5('0x12')][_0x48f72a[0x1]]=_0xe83ba7;}}_0x2cdd4a['next']();});}}catch(_0xd67dda){logger[_0x71c5('0x13')](_0x71c5('0x14'),_0x3a5c27,_['isObject'](_0xd67dda)?JSON['stringify'](_0xd67dda):_0xd67dda);logger[_0x71c5('0x8')](_0x71c5('0x9'),_0x3a5c27);_0x2cdd4a['next']();}};}; \ No newline at end of file +var _0xb492=['isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x33b685,_0x43e6f4){var _0x1d11ee=function(_0x1b26d2){while(--_0x1b26d2){_0x33b685['push'](_0x33b685['shift']());}};_0x1d11ee(++_0x43e6f4);}(_0xb492,0x172));var _0x2b49=function(_0x2bbbfa,_0x42316f){_0x2bbbfa=_0x2bbbfa-0x0;var _0x31d4d6=_0xb492[_0x2bbbfa];return _0x31d4d6;};'use strict';var schema=require('validate');var sh=require(_0x2b49('0x0'));var _=require(_0x2b49('0x1'));var utils=require(_0x2b49('0x2'));var logger=require(_0x2b49('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x2b49('0x4')}});exports[_0x2b49('0x5')]=function(_0x317a1d,_0x2b7555){return function(_0x54327a){try{var _0x53508a={'command':_0x2b7555[0x0]};var _0x346359=system[_0x2b49('0x6')](_0x53508a,{'typecast':!![]});if(_0x346359[_0x2b49('0x7')]){logger[_0x2b49('0x8')](_0x2b49('0x9'),_0x317a1d,_[_0x2b49('0xa')](_0x346359,_0x2b49('0xb'))[_0x2b49('0xc')](',\x20'));logger['info'](_0x2b49('0xd'),_0x317a1d);_0x54327a[_0x2b49('0xe')]();}else{var _0x4d9425=this;var _0x46813f=utils[_0x2b49('0xf')](_0x2b7555[0x0],this);logger[_0x2b49('0x10')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x317a1d,_0x46813f);sh[_0x2b49('0x11')](_[_0x2b49('0x12')](_0x46813f),function(_0x4555df,_0x4324da){logger[_0x2b49('0x10')](_0x2b49('0x13'),_0x317a1d,_0x4555df);if(_0x4555df==0x0){var _0x5aad36=_0x4324da['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x2b49('0x14')](_0x2b7555[0x1])||_[_0x2b49('0x15')](_0x2b7555[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x317a1d);_0x4d9425[_0x2b49('0x16')][_0x2b7555[0x1]]=_0x5aad36;}else{logger[_0x2b49('0x10')](_0x2b49('0x17'),_0x317a1d,_0x2b7555[0x1],_0x5aad36);_0x4d9425['body'][_0x2b7555[0x1]]=_0x5aad36;}}_0x54327a[_0x2b49('0xe')]();});}}catch(_0xf92e0d){logger['error']('[%s][SYSTEM]\x20%s',_0x317a1d,_[_0x2b49('0x18')](_0xf92e0d)?JSON[_0x2b49('0x19')](_0xf92e0d):_0xf92e0d);logger[_0x2b49('0x10')](_0x2b49('0xd'),_0x317a1d);_0x54327a[_0x2b49('0xe')]();}};}; \ 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 75fac7c..98d45ed 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 _0xb175=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','message','join','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','next','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','number'];(function(_0x58d7d2,_0x1cbd13){var _0x6ad2be=function(_0x32004e){while(--_0x32004e){_0x58d7d2['push'](_0x58d7d2['shift']());}};_0x6ad2be(++_0x1cbd13);}(_0xb175,0x1a9));var _0x5b17=function(_0x12da2f,_0xee45c9){_0x12da2f=_0x12da2f-0x0;var _0x1883f7=_0xb175[_0x12da2f];return _0x1883f7;};'use strict';var schema=require('validate');var _=require(_0x5b17('0x0'));var rpc={'chatInteraction':require(_0x5b17('0x1')),'openchannelInteraction':require(_0x5b17('0x2')),'smsInteraction':require(_0x5b17('0x3')),'mailInteraction':require(_0x5b17('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5b17('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x5b17('0x6'),'required':!![],'message':_0x5b17('0x7')}});exports[_0x5b17('0x8')]=function(_0x39d331,_0x77954c,_0x2af1b9,_0x259424){return function(_0x22203a){try{var _0xdc8cf4={'tag':_0x77954c[0x0]};var _0x26706e=tag[_0x5b17('0x9')](_0xdc8cf4,{'typecast':!![]});if(_0x26706e[_0x5b17('0xa')]){logger[_0x5b17('0xb')]('[%s][TAG]\x20%s',_0x39d331,_['map'](_0x26706e,_0x5b17('0xc'))[_0x5b17('0xd')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x39d331);_0x22203a['next']();}else{var _0x27f99d={'ids':[_0x77954c[0x0]]};if(rpc[_0x259424[_0x5b17('0xe')]+_0x5b17('0xf')]){rpc[_0x259424['channel']+_0x5b17('0xf')][_0x5b17('0x10')](_0x259424[_0x5b17('0x11')]['id'],_0x27f99d)[_0x5b17('0x12')](function(_0x5e73bd){logger[_0x5b17('0x13')](_0x5b17('0x14'),_0x39d331,_0x77954c[0x1],_0x259424[_0x5b17('0xe')],_0x259424['interaction']['id']);})[_0x5b17('0x15')](function(_0x51ca5a){logger[_0x5b17('0xb')]('[%s][TAG]\x20%s',_0x39d331,JSON[_0x5b17('0x16')](_0x51ca5a));logger[_0x5b17('0x13')](_0x5b17('0x17'),_0x39d331);})[_0x5b17('0x18')](function(){_0x22203a[_0x5b17('0x19')]();});}}}catch(_0xe99e35){logger[_0x5b17('0xb')]('[%s][TAG]\x20%s',_0x39d331,_[_0x5b17('0x1a')](_0xe99e35)?JSON['stringify'](_0xe99e35):_0xe99e35);logger[_0x5b17('0x13')](_0x5b17('0x17'),_0x39d331);_0x22203a['next']();}};}; \ No newline at end of file +var _0x3e91=['../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','finally','next','isObject','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0xfb009,_0x792dcf){var _0x3533d6=function(_0x2dc5f2){while(--_0x2dc5f2){_0xfb009['push'](_0xfb009['shift']());}};_0x3533d6(++_0x792dcf);}(_0x3e91,0xe9));var _0x13e9=function(_0x9d1971,_0x50b82e){_0x9d1971=_0x9d1971-0x0;var _0x203469=_0x3e91[_0x9d1971];return _0x203469;};'use strict';var schema=require(_0x13e9('0x0'));var _=require(_0x13e9('0x1'));var rpc={'chatInteraction':require(_0x13e9('0x2')),'openchannelInteraction':require(_0x13e9('0x3')),'smsInteraction':require(_0x13e9('0x4')),'mailInteraction':require(_0x13e9('0x5')),'faxInteraction':require(_0x13e9('0x6')),'whatsappInteraction':require(_0x13e9('0x7'))};var logger=require(_0x13e9('0x8'))(_0x13e9('0x9'));var tag=schema({'tag':{'type':_0x13e9('0xa'),'required':!![],'message':_0x13e9('0xb')}});exports[_0x13e9('0xc')]=function(_0x3dc06f,_0x254138,_0x293e86,_0x45d1d3){return function(_0x378fdf){try{var _0x50074d={'tag':_0x254138[0x0]};var _0xb99ab9=tag[_0x13e9('0x0')](_0x50074d,{'typecast':!![]});if(_0xb99ab9[_0x13e9('0xd')]){logger[_0x13e9('0xe')](_0x13e9('0xf'),_0x3dc06f,_['map'](_0xb99ab9,_0x13e9('0x10'))[_0x13e9('0x11')](',\x20'));logger[_0x13e9('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3dc06f);_0x378fdf['next']();}else{var _0x1dd8ac={'ids':[_0x254138[0x0]]};if(rpc[_0x45d1d3[_0x13e9('0x13')]+_0x13e9('0x14')]){rpc[_0x45d1d3[_0x13e9('0x13')]+_0x13e9('0x14')][_0x13e9('0x15')](_0x45d1d3[_0x13e9('0x16')]['id'],_0x1dd8ac)[_0x13e9('0x17')](function(_0x2ba612){logger[_0x13e9('0x12')](_0x13e9('0x18'),_0x3dc06f,_0x254138[0x1],_0x45d1d3['channel'],_0x45d1d3[_0x13e9('0x16')]['id']);})['catch'](function(_0x264374){logger[_0x13e9('0xe')](_0x13e9('0xf'),_0x3dc06f,JSON['stringify'](_0x264374));logger[_0x13e9('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3dc06f);})[_0x13e9('0x19')](function(){_0x378fdf[_0x13e9('0x1a')]();});}}}catch(_0x1e8344){logger[_0x13e9('0xe')](_0x13e9('0xf'),_0x3dc06f,_[_0x13e9('0x1b')](_0x1e8344)?JSON[_0x13e9('0x1c')](_0x1e8344):_0x1e8344);logger[_0x13e9('0x12')](_0x13e9('0x1d'),_0x3dc06f);_0x378fdf[_0x13e9('0x1a')]();}};}; \ 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 6e506a2..6af6449 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 _0x3193=['[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','login','params','utf8','POST','application/json-rpc','then','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','stringify','info'];(function(_0x559fb6,_0x29408b){var _0x270b89=function(_0x1ceb3e){while(--_0x1ceb3e){_0x559fb6['push'](_0x559fb6['shift']());}};_0x270b89(++_0x29408b);}(_0x3193,0x115));var _0x3319=function(_0x2738ff,_0x5e4fb9){_0x2738ff=_0x2738ff-0x0;var _0x3b5ada=_0x3193[_0x2738ff];return _0x3b5ada;};'use strict';var rp=require(_0x3319('0x0'));var logger=require(_0x3319('0x1'))(_0x3319('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x535483,_0x41ffc8){return function(_0x408d01){var _0x53a03c=_0x41ffc8[0xa];var _0x2f2288=_0x41ffc8[0xb];var _0x2bbecb=_0x41ffc8[0xc];var _0x2569e0=_0x41ffc8[0xd];var _0x6a7c95=_0x41ffc8[0xe];var _0x18f389=_0x41ffc8[0xf][_0x3319('0x3')](/\n/g,'\x20-\x20');var _0x410a35=_0x41ffc8[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x3319('0x4')](_0x2f2288)){arr[_0x3319('0x5')](_0x2f2288);var _0x42782a=_0x41ffc8[0x3];var _0x38b02e=_0x41ffc8[0x4];var _0x4b39b7=_0x41ffc8[0x1];var _0x5e528a=_0x41ffc8[0x0];var _0x5deb63={};_0x5deb63[_0x3319('0x6')]=_0x41ffc8[0x8]+_0x3319('0x7')+_0x2bbecb+'|'+_0x53a03c+'|'+_0x2569e0+'|'+_0x2f2288+'|'+_0x6a7c95;_0x5deb63[_0x3319('0x8')]=_0x41ffc8[0x7]+'?params='+_0x2bbecb+'|'+_0x53a03c+'|'+_0x2569e0+'|'+_0x2f2288+'|'+_0x6a7c95+'|'+_0x18f389+'|'+_0x410a35;_0x5deb63[_0x3319('0x9')]=_0x41ffc8[0x9];var _0x205f87={};_0x205f87['jsonrpc']=_0x3319('0xa');_0x205f87['method']=_0x3319('0xb');var _0x5bb693=[];_0x5bb693['push'](_0x41ffc8[0x2]);_0x5bb693[_0x3319('0x5')](_0x41ffc8[0x5]);_0x5bb693[_0x3319('0x5')](_0x41ffc8[0x6]);_0x205f87[_0x3319('0xc')]=_0x5bb693;_0x205f87['id']=0x1;var _0x4a39a3=JSON['stringify'](_0x205f87);var _0x4b6b84={'encoding':_0x3319('0xd'),'method':_0x3319('0xe'),'timeout':0x2710,'url':_0x42782a,'headers':{'Content-Type':_0x3319('0xf')},'body':_0x4a39a3};return rp(_0x4b6b84)[_0x3319('0x10')](function(_0x5673ce){const _0x2a3443=JSON['parse'](_0x5673ce);if(!_0x2a3443[_0x3319('0x11')]['logged']){throw new Error(_0x3319('0x12'));}var _0x2a6010=_0x2f2288;var _0x30f163='channelId='+_0x4b39b7+_0x3319('0x13')+_0x5e528a+_0x3319('0x14')+_0x2a6010+'&data='+JSON[_0x3319('0x15')](_0x5deb63);var _0x56a233=_0x38b02e+'?'+_0x30f163;return rp(_0x56a233);})['then'](function(_0x579e78){logger[_0x3319('0x16')](_0x3319('0x17'),_0x535483,_0x579e78);_0x408d01['stop']();})[_0x3319('0x18')](function(_0x14926b){logger[_0x3319('0x19')]('[%s][TVOX]\x20%s',_0x535483,_[_0x3319('0x1a')](_0x14926b)?JSON['stringify'](_0x14926b):_0x14926b);_0x408d01[_0x3319('0x1b')]();});}else{logger[_0x3319('0x16')](_0x3319('0x1c'),_0x535483);_0x408d01[_0x3319('0x1d')]();}};}; \ No newline at end of file +var _0x4a03=['stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','title','jsonrpc','login','push','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4a03,0xb5));var _0x34a0=function(_0x249b63,_0x1d7515){_0x249b63=_0x249b63-0x0;var _0x3b8209=_0x4a03[_0x249b63];return _0x3b8209;};'use strict';var rp=require(_0x34a0('0x0'));var logger=require(_0x34a0('0x1'))('routing');var _=require(_0x34a0('0x2'));var arr=[];exports[_0x34a0('0x3')]=function(_0x550329,_0x8bceb3){return function(_0x5a75a6){var _0x1c94b6=_0x8bceb3[0xa];var _0x319541=_0x8bceb3[0xb];var _0x24c82b=_0x8bceb3[0xc];var _0x539af9=_0x8bceb3[0xd];var _0x357fa1=_0x8bceb3[0xe];var _0x370aad=_0x8bceb3[0xf][_0x34a0('0x4')](/\n/g,_0x34a0('0x5'));var _0xa44b14=_0x8bceb3[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x34a0('0x6')](_0x319541)){arr['push'](_0x319541);var _0x23e51c=_0x8bceb3[0x3];var _0x103b05=_0x8bceb3[0x4];var _0x51f6e5=_0x8bceb3[0x1];var _0x3eb245=_0x8bceb3[0x0];var _0x253b3e={};_0x253b3e[_0x34a0('0x7')]=_0x8bceb3[0x8]+_0x34a0('0x8')+_0x24c82b+'|'+_0x1c94b6+'|'+_0x539af9+'|'+_0x319541+'|'+_0x357fa1;_0x253b3e['urlOnRing']=_0x8bceb3[0x7]+_0x34a0('0x8')+_0x24c82b+'|'+_0x1c94b6+'|'+_0x539af9+'|'+_0x319541+'|'+_0x357fa1+'|'+_0x370aad+'|'+_0xa44b14;_0x253b3e[_0x34a0('0x9')]=_0x8bceb3[0x9];var _0x3c39ab={};_0x3c39ab[_0x34a0('0xa')]='2.0';_0x3c39ab['method']=_0x34a0('0xb');var _0x1cfdcb=[];_0x1cfdcb['push'](_0x8bceb3[0x2]);_0x1cfdcb['push'](_0x8bceb3[0x5]);_0x1cfdcb[_0x34a0('0xc')](_0x8bceb3[0x6]);_0x3c39ab[_0x34a0('0xd')]=_0x1cfdcb;_0x3c39ab['id']=0x1;var _0x17f782=JSON[_0x34a0('0xe')](_0x3c39ab);var _0x41db15={'encoding':_0x34a0('0xf'),'method':_0x34a0('0x10'),'timeout':0x2710,'url':_0x23e51c,'headers':{'Content-Type':_0x34a0('0x11')},'body':_0x17f782};return rp(_0x41db15)[_0x34a0('0x12')](function(_0x444a1e){const _0x4ce68d=JSON[_0x34a0('0x13')](_0x444a1e);if(!_0x4ce68d[_0x34a0('0x14')][_0x34a0('0x15')]){throw new Error(_0x34a0('0x16'));}var _0x4d1529=_0x319541;var _0x42ed53=_0x34a0('0x17')+_0x51f6e5+_0x34a0('0x18')+_0x3eb245+_0x34a0('0x19')+_0x4d1529+_0x34a0('0x1a')+JSON[_0x34a0('0xe')](_0x253b3e);var _0x4dd774=_0x103b05+'?'+_0x42ed53;return rp(_0x4dd774);})['then'](function(_0x156641){logger[_0x34a0('0x1b')](_0x34a0('0x1c'),_0x550329,_0x156641);_0x5a75a6[_0x34a0('0x1d')]();})[_0x34a0('0x1e')](function(_0x7fe335){logger['error'](_0x34a0('0x1f'),_0x550329,_[_0x34a0('0x20')](_0x7fe335)?JSON['stringify'](_0x7fe335):_0x7fe335);_0x5a75a6[_0x34a0('0x1d')]();});}else{logger[_0x34a0('0x1b')](_0x34a0('0x21'),_0x550329);_0x5a75a6[_0x34a0('0x22')]();}};}; \ 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 0b82fb7..06cdec4 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x18e064,_0x3b367d){var _0x4b0f05=function(_0x341f8a){while(--_0x341f8a){_0x18e064['push'](_0x18e064['shift']());}};_0x4b0f05(++_0x3b367d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x250ce9,_0x20a7ea){var _0x1f9095=function(_0x438a7a){while(--_0x438a7a){_0x250ce9['push'](_0x250ce9['shift']());}};_0x1f9095(++_0x20a7ea);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e65a02d..27976b5 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 _0xc36d=['values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','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','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','app','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0xc36d,0x7d));var _0xdc36=function(_0x9e05d1,_0x3cef4a){_0x9e05d1=_0x9e05d1-0x0;var _0x4f7e97=_0xc36d[_0x9e05d1];return _0x4f7e97;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var path=require(_0xdc36('0x2'));var fs=require('fs');var jayson=require(_0xdc36('0x3'));var BPromise=require(_0xdc36('0x4'));var uuid=require(_0xdc36('0x5'));var utils=require('./applications/utils');var config=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xdc36('0x8')),'mailQueueReport':require(_0xdc36('0x9')),'chatQueueReport':require(_0xdc36('0xa')),'smsQueueReport':require(_0xdc36('0xb')),'faxQueueReport':require(_0xdc36('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xdc36('0xd'));function getId(_0x456897,_0x2a0087,_0xdca7f7){return util['format'](_0xdc36('0xe'),_0x456897,_0x2a0087||0x0,_0xdca7f7||0x0);}function getIntervals(_0x23956b,_0x573f8e){var _0x1d0035=[];if(!_[_0xdc36('0xf')](_0x573f8e[_0xdc36('0x10')])&&!_['isNil'](_0x23956b[_0x573f8e[_0xdc36('0x10')]])&&!_[_0xdc36('0xf')](_0x23956b[_0x573f8e['IntervalId']]['Intervals'])){_0x1d0035=_[_0xdc36('0x11')](_0x23956b[_0x573f8e[_0xdc36('0x10')]][_0xdc36('0x12')],_0xdc36('0x13'));}else if(!_['isNil'](_0x573f8e[_0xdc36('0x13')])){_0x1d0035=[_0x573f8e[_0xdc36('0x13')]];}return _0x1d0035;}exports[_0xdc36('0x14')]=function(_0xae6ad3){_0xae6ad3[_0xdc36('0x15')]={};return new BPromise(function(_0x25b900,_0x37ce9c){var _0x809cf0={'Start':function(_0x57ebde){var _0x155cce=this;return new Promise(function(_0x526ac8,_0x4baf2e){if(_0x57ebde){try{var _0x59c88f=[];var _0x64f61e=getId(_0x57ebde[_0xdc36('0x16')],_0x57ebde['message']?_0x57ebde[_0xdc36('0x17')]['id']:0x0,_0x57ebde[_0xdc36('0x18')]?_0x57ebde[_0xdc36('0x18')]['id']:0x0);if(_0x57ebde[_0xdc36('0x19')]&&_[_0xdc36('0x1a')](_0x57ebde[_0xdc36('0x19')])&&_0x57ebde['applications'][_0xdc36('0x1b')]){for(var _0x12d4bf=0x0;_0x12d4bf<_0x57ebde['applications'][_0xdc36('0x1b')];_0x12d4bf+=0x1){var _0x197924=_0x57ebde[_0xdc36('0x19')][_0x12d4bf];if(fs['existsSync'](path[_0xdc36('0x1c')](__dirname,_0xdc36('0x19'),_0x197924['app']+_0xdc36('0x1d')))){var _0x480277=[];switch(_0x197924['app'][_0xdc36('0x1e')]()){case _0xdc36('0x1f'):var _0x42c0d7=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');if(_0x57ebde[_0xdc36('0x16')]===_0xdc36('0x22')){_0x480277[_0xdc36('0x23')](_0x42c0d7[0x0]);_0x480277['push'](_0x42c0d7[0x1]);_0x480277[_0xdc36('0x23')](_0x42c0d7['slice'](0x2,_0x42c0d7[_0xdc36('0x1b')])[_0xdc36('0x1c')](','));}else{_0x480277[_0xdc36('0x23')](_0x42c0d7[0x0]);_0x480277['push'](_0x42c0d7[_0xdc36('0x24')](0x1,_0x42c0d7[_0xdc36('0x1b')])[_0xdc36('0x1c')](','));}break;case'dialogflow':var _0x28a005=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');_0x480277['push'](_0x28a005[0x0]);_0x480277[_0xdc36('0x23')](_0x28a005[0x1]);_0x480277[_0xdc36('0x23')](_0x28a005['slice'](0x2,_0x28a005[_0xdc36('0x1b')])[_0xdc36('0x1c')](','));break;case'dialogflowv2':var _0x21151b=_0x197924['appdata']['split'](',');_0x480277['push'](_0x21151b[0x0]);_0x480277[_0xdc36('0x23')](_0x21151b[0x1]);_0x480277[_0xdc36('0x23')](_0x21151b[0x2]);_0x480277['push'](_0x21151b[0x3]);_0x480277[_0xdc36('0x23')](_0x21151b[_0xdc36('0x24')](0x4,_0x21151b[_0xdc36('0x1b')])['join'](','));break;case _0xdc36('0x25'):var _0xcfff77=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');_0x480277[_0xdc36('0x23')](_0xcfff77[0x0]);_0x480277[_0xdc36('0x23')](_0xcfff77[0x1]);_0x480277[_0xdc36('0x23')](_0xcfff77[0x2]);_0x480277['push'](_0xcfff77[0x3]);_0x480277[_0xdc36('0x23')](_0xcfff77[_0xdc36('0x24')](0x4,_0xcfff77['length'])['join'](','));break;case _0xdc36('0x17'):_0x480277[_0xdc36('0x23')](_0x197924[_0xdc36('0x20')]);break;case'tag':_0x480277['push'](_0x197924[_0xdc36('0x26')]);_0x480277[_0xdc36('0x23')](_0x197924[_0xdc36('0x20')]);break;case _0xdc36('0x27'):var _0x302d69=utils[_0xdc36('0x28')](_0x57ebde[_0xdc36('0x29')][_0xdc36('0x2a')],_0x57ebde);var _0x734ad6=_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');_0x480277['push'](_0x734ad6[0x0]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x1]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x2]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x3]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x4]);_0x480277['push'](_0x734ad6[0x5]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x6]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x7]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x8]);_0x480277[_0xdc36('0x23')](_0x734ad6[0x9]);_0x480277['push'](_0x734ad6[0xa]);_0x480277[_0xdc36('0x23')](_0x57ebde['interaction']['id']);_0x480277['push'](_0x57ebde[_0xdc36('0x17')]['id']);_0x480277[_0xdc36('0x23')](_0x197924[_0xdc36('0x2b')]);_0x480277['push'](_0x57ebde[_0xdc36('0x18')]['ContactId']);_0x480277[_0xdc36('0x23')](_0x57ebde[_0xdc36('0x2c')][_0xdc36('0x2c')]);_0x480277['push'](_0x302d69);break;default:_0x480277=_[_0xdc36('0xf')](_0x197924[_0xdc36('0x20')])?[]:_0x197924[_0xdc36('0x20')][_0xdc36('0x21')](',');}var _0x50cf7b={'id':util[_0xdc36('0x2d')](_0xdc36('0x2e'),_0x64f61e,_0x197924['id'],_0x197924[_0xdc36('0x2f')]),'condition':require('./interval')['condition'](_0x64f61e,getIntervals(_0xae6ad3[_0xdc36('0x30')],_0x197924),_0xae6ad3),'consequence':require(_0xdc36('0x31')+_0x197924['app'])['consequence'](_0x64f61e,_0x480277,_0xae6ad3,_0x57ebde),'p':_0x197924[_0xdc36('0x32')]||0x0};logger[_0xdc36('0x33')](_0xdc36('0x34'),_0x50cf7b['id'],_0xdc36('0x35'),getIntervals(_0xae6ad3[_0xdc36('0x30')],_0x197924)[_0xdc36('0x1c')](_0xdc36('0x36')));_0x59c88f[_0xdc36('0x23')](_0x50cf7b);}else{logger[_0xdc36('0x37')](_0xdc36('0x38'),path[_0xdc36('0x1c')](__dirname,_0xdc36('0x19'),_0x197924[_0xdc36('0x2f')]+_0xdc36('0x1d')));}}_0xae6ad3[_0xdc36('0x15')][_0x64f61e]=new RuleEngine(_0x59c88f);_0xae6ad3[_0xdc36('0x15')][_0x64f61e][_0xdc36('0x39')](_0x57ebde,function(_0x16dcb7){logger[_0xdc36('0x33')](_0xdc36('0x3a'),JSON[_0xdc36('0x3b')](_0x16dcb7[_0xdc36('0x3c')]));if(_0xae6ad3[_0xdc36('0x15')][_0x64f61e]){_0xae6ad3[_0xdc36('0x15')][_0x64f61e][_0xdc36('0x3d')](_0xdc36('0x3e'));}});return _0x526ac8({'code':0xc8,'message':_0x57ebde});}else{logger['info'](_0xdc36('0x3f'));return _0x526ac8({'code':0xc8,'message':_0x57ebde});}}catch(_0x46983e){logger['error'](_0x46983e['stack']);return _0x4baf2e(_0x155cce[_0xdc36('0x37')](0x1f4,_0x46983e));}}return _0x4baf2e('routing\x20is\x20empty');});},'AcceptMessage':function(_0x177d9f){var _0x51a276=this;return new Promise(function(_0x19c7fe,_0x286de7){if(_0x177d9f[_0xdc36('0x40')]&&_0x177d9f[_0xdc36('0x40')]['id']){if(_0xae6ad3[_0xdc36('0x41')][_0x177d9f[_0xdc36('0x40')]['id']]){_0xae6ad3[_0xdc36('0x41')][_0x177d9f[_0xdc36('0x40')]['id']][_0xdc36('0x42')]=![];_0xae6ad3[_0xdc36('0x41')][_0x177d9f[_0xdc36('0x40')]['id']][_0xdc36('0x43')]=undefined;}}if(_0x177d9f[_0xdc36('0x17')]&&_0x177d9f[_0xdc36('0x17')]['id']){try{var _0x2de4d3=getId(_0x177d9f[_0xdc36('0x16')],_0x177d9f[_0xdc36('0x17')]?_0x177d9f[_0xdc36('0x17')]['id']:0x0,_0x177d9f['interaction']?_0x177d9f['interaction']['id']:0x0);if(_0xae6ad3[_0xdc36('0x15')][_0x2de4d3]){_0xae6ad3[_0xdc36('0x15')][_0x2de4d3][_0xdc36('0x3d')](_0xdc36('0x44'));if(rpc[_0x177d9f[_0xdc36('0x16')]+_0xdc36('0x45')]){rpc[_0x177d9f['channel']+_0xdc36('0x45')][_0xdc36('0x46')](_0x2de4d3,{'UserId':_0x177d9f[_0xdc36('0x17')]['UserId']})[_0xdc36('0x47')](function(_0x53ed42){logger[_0xdc36('0x37')](_0xdc36('0x48'));});}}return _0x19c7fe({'code':0xc8,'message':_0x177d9f});}catch(_0x3bfc00){logger[_0xdc36('0x37')](_0x3bfc00['stack']);return _0x286de7(_0x51a276[_0xdc36('0x37')](0x1f4,_0x3bfc00));}}logger[_0xdc36('0x37')](_0xdc36('0x49'));return _0x286de7(_0x51a276[_0xdc36('0x37')](0x1f4,_0xdc36('0x49')));});},'RejectMessage':function(_0x2b7319){var _0x26775a=this;return new Promise(function(_0x225ffb,_0x4abeaf){if(_0x2b7319[_0xdc36('0x40')]&&_0x2b7319[_0xdc36('0x40')]['id']){try{if(_0xae6ad3[_0xdc36('0x41')][_0x2b7319[_0xdc36('0x40')]['id']]){_0xae6ad3[_0xdc36('0x41')][_0x2b7319[_0xdc36('0x40')]['id']][_0xdc36('0x42')]=![];_0xae6ad3[_0xdc36('0x41')][_0x2b7319['agent']['id']]['busyQueue']=undefined;}return _0x225ffb({'code':0xc8,'message':_0x2b7319});}catch(_0x1f49e1){logger[_0xdc36('0x37')](_0x1f49e1['stack']);return _0x4abeaf(_0x26775a[_0xdc36('0x37')](0x1f4,_0x1f49e1));}}logger[_0xdc36('0x37')]('message\x20is\x20empty');return _0x4abeaf(_0x26775a['error'](0x1f4,_0xdc36('0x49')));});},'AbandonInteraction':function(_0x5cf2ee){var _0x4277b4=this;return new Promise(function(_0x5eb1e5,_0x27431c){if(_0x5cf2ee['channel']&&_0x5cf2ee['interaction']&&_0x5cf2ee[_0xdc36('0x18')]['id']){try{var _0x5d139f=getId(_0x5cf2ee[_0xdc36('0x16')],_0x5cf2ee[_0xdc36('0x17')]?_0x5cf2ee[_0xdc36('0x17')]['id']:0x0,_0x5cf2ee[_0xdc36('0x18')]?_0x5cf2ee[_0xdc36('0x18')]['id']:0x0);if(_0xae6ad3['rules'][_0x5d139f]){_0xae6ad3[_0xdc36('0x15')][_0x5d139f][_0xdc36('0x3d')](_0xdc36('0x44'));}return _0x5eb1e5({'code':0xc8,'message':_0x5cf2ee});}catch(_0x4e62c2){logger['error'](_0x4e62c2[_0xdc36('0x4a')]);return _0x27431c(_0x4277b4['error'](0x1f4,_0x4e62c2));}}logger[_0xdc36('0x37')](_0xdc36('0x49'));return _0x27431c(_0x4277b4[_0xdc36('0x37')](0x1f4,_0xdc36('0x49')));});},'AgentCapacity':function(_0x5dc59f){var _0x50e415=this;return new Promise(function(_0x116f5f,_0x1d4707){if(_0xae6ad3[_0xdc36('0x41')][_0xdc36('0x4b')](_0x5dc59f['id'])){for(var _0x22393e in _0x5dc59f[_0xdc36('0x4c')]){if(_0x5dc59f[_0xdc36('0x4c')][_0xdc36('0x4b')](_0x22393e)){if(_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']][_0xdc36('0x4b')](_0x22393e+'CurrentCapacity')){_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']][_0x22393e+'CurrentCapacity']=parseInt(_0x5dc59f[_0xdc36('0x4c')][_0x22393e],0xa);}}}_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']][_0xdc36('0x4d')]();return _0x116f5f({'code':0xc8,'message':_0xae6ad3[_0xdc36('0x41')][_0x5dc59f['id']]});}else{return _0x1d4707(_0x50e415[_0xdc36('0x37')](0x1f4,_0xdc36('0x4e')));}});},'Agents':function(_0x312de6){return new Promise(function(_0x1dc0c9,_0x355530){var _0x186a71=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x41')]);_0x1dc0c9({'count':_0x186a71[_0xdc36('0x1b')],'rows':_0x186a71});});},'ChatQueues':function(_0x309aec){return new Promise(function(_0xde073b,_0x2986ce){var _0x43e23e=[];for(var _0x1994c6 in _0xae6ad3[_0xdc36('0x50')]){if(_0xae6ad3[_0xdc36('0x50')]['hasOwnProperty'](_0x1994c6)){var _0x327c04=_0xae6ad3[_0xdc36('0x50')][_0x1994c6];var _0x437a86={'id':_0x327c04['id'],'available':_0x327c04[_0xdc36('0x51')],'loggedIn':_0x327c04[_0xdc36('0x52')],'name':_0x327c04[_0xdc36('0x53')],'paused':_0x327c04['paused'],'waiting':_0x327c04[_0xdc36('0x54')]};_0x43e23e[_0xdc36('0x23')](_0x437a86);}}_0xde073b({'count':_0x43e23e['length'],'rows':_0x43e23e});});},'MailQueues':function(_0x548a99){return new Promise(function(_0x267d62,_0x271004){var _0x9e867d=[];for(var _0x4869e1 in _0xae6ad3['mailQueues']){if(_0xae6ad3[_0xdc36('0x55')][_0xdc36('0x4b')](_0x4869e1)){var _0x50a8ea=_0xae6ad3['mailQueues'][_0x4869e1];var _0x3bbf88={'id':_0x50a8ea['id'],'available':_0x50a8ea[_0xdc36('0x51')],'loggedIn':_0x50a8ea[_0xdc36('0x52')],'name':_0x50a8ea[_0xdc36('0x53')],'paused':_0x50a8ea[_0xdc36('0x56')],'waiting':_0x50a8ea[_0xdc36('0x54')]};_0x9e867d[_0xdc36('0x23')](_0x3bbf88);}}_0x267d62({'count':_0x9e867d[_0xdc36('0x1b')],'rows':_0x9e867d});});},'OpenchannelQueues':function(_0x4ecc0c){return new Promise(function(_0x2b5e55,_0x5ef6db){var _0x4b353d=[];for(var _0x5a3c01 in _0xae6ad3[_0xdc36('0x57')]){if(_0xae6ad3[_0xdc36('0x57')][_0xdc36('0x4b')](_0x5a3c01)){var _0x1983cd=_0xae6ad3['openchannelQueues'][_0x5a3c01];var _0x1592d0={'id':_0x1983cd['id'],'available':_0x1983cd[_0xdc36('0x51')],'loggedIn':_0x1983cd[_0xdc36('0x52')],'name':_0x1983cd[_0xdc36('0x53')],'paused':_0x1983cd[_0xdc36('0x56')],'waiting':_0x1983cd['waiting']};_0x4b353d['push'](_0x1592d0);}}_0x2b5e55({'count':_0x4b353d['length'],'rows':_0x4b353d});});},'SmsQueues':function(_0x51148b){return new Promise(function(_0x277d13,_0x398272){var _0x3e23e8=[];for(var _0xdc692d in _0xae6ad3[_0xdc36('0x58')]){if(_0xae6ad3[_0xdc36('0x58')][_0xdc36('0x4b')](_0xdc692d)){var _0x31b748=_0xae6ad3[_0xdc36('0x58')][_0xdc692d];var _0x556614={'id':_0x31b748['id'],'available':_0x31b748[_0xdc36('0x51')],'loggedIn':_0x31b748[_0xdc36('0x52')],'name':_0x31b748['name'],'paused':_0x31b748['paused'],'waiting':_0x31b748[_0xdc36('0x54')]};_0x3e23e8['push'](_0x556614);}}_0x277d13({'count':_0x3e23e8[_0xdc36('0x1b')],'rows':_0x3e23e8});});},'FaxQueues':function(_0x583ff0){return new Promise(function(_0x1f855e,_0x3667a2){var _0x26dd8e=[];for(var _0x56931b in _0xae6ad3['faxQueues']){if(_0xae6ad3['faxQueues'][_0xdc36('0x4b')](_0x56931b)){var _0xd8f671=_0xae6ad3[_0xdc36('0x59')][_0x56931b];var _0x3a699d={'id':_0xd8f671['id'],'available':_0xd8f671[_0xdc36('0x51')],'loggedIn':_0xd8f671['loggedIn'],'name':_0xd8f671[_0xdc36('0x53')],'paused':_0xd8f671[_0xdc36('0x56')],'waiting':_0xd8f671[_0xdc36('0x54')]};_0x26dd8e['push'](_0x3a699d);}}_0x1f855e({'count':_0x26dd8e['length'],'rows':_0x26dd8e});});},'WhatsappQueues':function(_0x179dd9){return new Promise(function(_0x705e1e,_0x40bc5b){var _0x3103e5=[];for(var _0x767d7e in _0xae6ad3[_0xdc36('0x5a')]){if(_0xae6ad3[_0xdc36('0x5a')][_0xdc36('0x4b')](_0x767d7e)){var _0x428ea1=_0xae6ad3[_0xdc36('0x5a')][_0x767d7e];var _0x53a7c3={'id':_0x428ea1['id'],'available':_0x428ea1['available'],'loggedIn':_0x428ea1['loggedIn'],'name':_0x428ea1['name'],'paused':_0x428ea1[_0xdc36('0x56')],'waiting':_0x428ea1[_0xdc36('0x54')]};_0x3103e5[_0xdc36('0x23')](_0x53a7c3);}}_0x705e1e({'count':_0x3103e5['length'],'rows':_0x3103e5});});},'ChatQueuesWaitingInteractions':function(_0x99f4d1){return new Promise(function(_0xd674b9,_0x26b38e){var _0x192316=_['values'](_0xae6ad3[_0xdc36('0x5b')]);_0xd674b9({'count':_0x192316[_0xdc36('0x1b')],'rows':_0x192316});});},'MailQueuesWaitingInteractions':function(_0x111f62){return new Promise(function(_0x209cb6,_0x81fdbf){var _0xae33f3=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x5c')]);_0x209cb6({'count':_0xae33f3[_0xdc36('0x1b')],'rows':_0xae33f3});});},'OpenchannelQueuesWaitingInteractions':function(_0x1a4619){return new Promise(function(_0x1097e0,_0x43dd88){var _0x4b244a=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x5d')]);_0x1097e0({'count':_0x4b244a[_0xdc36('0x1b')],'rows':_0x4b244a});});},'SmsQueuesWaitingInteractions':function(_0x344d55){return new Promise(function(_0xfa1cc5,_0x58cd17){var _0x391c7c=_[_0xdc36('0x4f')](_0xae6ad3['smsQueuesWaitingInteractions']);_0xfa1cc5({'count':_0x391c7c[_0xdc36('0x1b')],'rows':_0x391c7c});});},'FaxQueuesWaitingInteractions':function(_0xe3058e){return new Promise(function(_0x31ba3f,_0x4f99d1){var _0x30b797=_[_0xdc36('0x4f')](_0xae6ad3[_0xdc36('0x5e')]);_0x31ba3f({'count':_0x30b797[_0xdc36('0x1b')],'rows':_0x30b797});});},'WhatsappQueuesWaitingInteractions':function(_0x137130){return new Promise(function(_0x2592ba,_0x365f42){var _0x202cac=_['values'](_0xae6ad3[_0xdc36('0x5f')]);_0x2592ba({'count':_0x202cac['length'],'rows':_0x202cac});});}};var _0x30d5a1=jayson[_0xdc36('0x60')](_0x809cf0)[_0xdc36('0x61')]();_0x30d5a1['on'](_0xdc36('0x37'),function(_0x25ea7d){logger[_0xdc36('0x37')](JSON[_0xdc36('0x3b')](_0x25ea7d));return _0x37ce9c(_0x25ea7d);});_0x30d5a1['listen'](0x232c,_0xdc36('0x62'),function(){console[_0xdc36('0x63')](_0xdc36('0x64'),0x232c);return _0x25b900(_0xdc36('0x65')+0x232c);});});}; \ No newline at end of file +var _0x544a=['uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflow','dialogflowv2','split','amazonlex','tag','tvox','account','notificationTemplate','ContactId','format','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544a,0xbd));var _0xa544=function(_0x4d32e9,_0x390d44){_0x4d32e9=_0x4d32e9-0x0;var _0x2d9ece=_0x544a[_0x4d32e9];return _0x2d9ece;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var path=require(_0xa544('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0xa544('0x3'));var utils=require('./applications/utils');var config=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xa544('0x6')),'mailQueueReport':require(_0xa544('0x7')),'chatQueueReport':require(_0xa544('0x8')),'smsQueueReport':require(_0xa544('0x9')),'faxQueueReport':require(_0xa544('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xa544('0xb'));function getId(_0x495819,_0x39bcd7,_0x35f5b5){return util['format'](_0xa544('0xc'),_0x495819,_0x39bcd7||0x0,_0x35f5b5||0x0);}function getIntervals(_0x466616,_0x4766a8){var _0x2d4a97=[];if(!_['isNil'](_0x4766a8[_0xa544('0xd')])&&!_[_0xa544('0xe')](_0x466616[_0x4766a8['IntervalId']])&&!_[_0xa544('0xe')](_0x466616[_0x4766a8['IntervalId']][_0xa544('0xf')])){_0x2d4a97=_[_0xa544('0x10')](_0x466616[_0x4766a8['IntervalId']][_0xa544('0xf')],_0xa544('0x11'));}else if(!_[_0xa544('0xe')](_0x4766a8[_0xa544('0x11')])){_0x2d4a97=[_0x4766a8[_0xa544('0x11')]];}return _0x2d4a97;}exports[_0xa544('0x12')]=function(_0x1ffda8){_0x1ffda8[_0xa544('0x13')]={};return new BPromise(function(_0x141fa7,_0x128b2b){var _0x76e46d={'Start':function(_0x2cfc7a){var _0x4cb09c=this;return new Promise(function(_0xf285db,_0x127ae5){if(_0x2cfc7a){try{var _0x5341f1=[];var _0x9093bd=getId(_0x2cfc7a[_0xa544('0x14')],_0x2cfc7a[_0xa544('0x15')]?_0x2cfc7a[_0xa544('0x15')]['id']:0x0,_0x2cfc7a[_0xa544('0x16')]?_0x2cfc7a[_0xa544('0x16')]['id']:0x0);if(_0x2cfc7a[_0xa544('0x17')]&&_[_0xa544('0x18')](_0x2cfc7a[_0xa544('0x17')])&&_0x2cfc7a[_0xa544('0x17')]['length']){for(var _0x5d0070=0x0;_0x5d0070<_0x2cfc7a[_0xa544('0x17')][_0xa544('0x19')];_0x5d0070+=0x1){var _0x1b17be=_0x2cfc7a['applications'][_0x5d0070];if(fs[_0xa544('0x1a')](path[_0xa544('0x1b')](__dirname,'applications',_0x1b17be[_0xa544('0x1c')]+_0xa544('0x1d')))){var _0x2d332e=[];switch(_0x1b17be[_0xa544('0x1c')][_0xa544('0x1e')]()){case'autoreply':var _0x52104f=_0x1b17be[_0xa544('0x1f')]['split'](',');if(_0x2cfc7a[_0xa544('0x14')]===_0xa544('0x20')){_0x2d332e[_0xa544('0x21')](_0x52104f[0x0]);_0x2d332e[_0xa544('0x21')](_0x52104f[0x1]);_0x2d332e[_0xa544('0x21')](_0x52104f[_0xa544('0x22')](0x2,_0x52104f[_0xa544('0x19')])[_0xa544('0x1b')](','));}else{_0x2d332e[_0xa544('0x21')](_0x52104f[0x0]);_0x2d332e['push'](_0x52104f[_0xa544('0x22')](0x1,_0x52104f[_0xa544('0x19')])['join'](','));}break;case _0xa544('0x23'):var _0x116924=_0x1b17be[_0xa544('0x1f')]['split'](',');_0x2d332e[_0xa544('0x21')](_0x116924[0x0]);_0x2d332e[_0xa544('0x21')](_0x116924[0x1]);_0x2d332e[_0xa544('0x21')](_0x116924[_0xa544('0x22')](0x2,_0x116924['length'])[_0xa544('0x1b')](','));break;case _0xa544('0x24'):var _0x153a15=_0x1b17be['appdata'][_0xa544('0x25')](',');_0x2d332e[_0xa544('0x21')](_0x153a15[0x0]);_0x2d332e['push'](_0x153a15[0x1]);_0x2d332e['push'](_0x153a15[0x2]);_0x2d332e[_0xa544('0x21')](_0x153a15[0x3]);_0x2d332e[_0xa544('0x21')](_0x153a15[_0xa544('0x22')](0x4,_0x153a15['length'])[_0xa544('0x1b')](','));break;case _0xa544('0x26'):var _0xe71f05=_0x1b17be['appdata'][_0xa544('0x25')](',');_0x2d332e[_0xa544('0x21')](_0xe71f05[0x0]);_0x2d332e['push'](_0xe71f05[0x1]);_0x2d332e[_0xa544('0x21')](_0xe71f05[0x2]);_0x2d332e['push'](_0xe71f05[0x3]);_0x2d332e[_0xa544('0x21')](_0xe71f05[_0xa544('0x22')](0x4,_0xe71f05[_0xa544('0x19')])['join'](','));break;case'message':_0x2d332e[_0xa544('0x21')](_0x1b17be[_0xa544('0x1f')]);break;case _0xa544('0x27'):_0x2d332e['push'](_0x1b17be['TagId']);_0x2d332e[_0xa544('0x21')](_0x1b17be[_0xa544('0x1f')]);break;case _0xa544('0x28'):var _0x5590cd=utils['getMustacheRender'](_0x2cfc7a[_0xa544('0x29')][_0xa544('0x2a')],_0x2cfc7a);var _0x2ea614=_0x1b17be[_0xa544('0x1f')][_0xa544('0x25')](',');_0x2d332e[_0xa544('0x21')](_0x2ea614[0x0]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0x1]);_0x2d332e['push'](_0x2ea614[0x2]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0x3]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0x4]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0x5]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0x6]);_0x2d332e['push'](_0x2ea614[0x7]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0x8]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0x9]);_0x2d332e[_0xa544('0x21')](_0x2ea614[0xa]);_0x2d332e[_0xa544('0x21')](_0x2cfc7a['interaction']['id']);_0x2d332e[_0xa544('0x21')](_0x2cfc7a[_0xa544('0x15')]['id']);_0x2d332e[_0xa544('0x21')](_0x1b17be['ChatWebsiteId']);_0x2d332e[_0xa544('0x21')](_0x2cfc7a[_0xa544('0x16')][_0xa544('0x2b')]);_0x2d332e[_0xa544('0x21')](_0x2cfc7a['body']['body']);_0x2d332e[_0xa544('0x21')](_0x5590cd);break;default:_0x2d332e=_[_0xa544('0xe')](_0x1b17be['appdata'])?[]:_0x1b17be[_0xa544('0x1f')][_0xa544('0x25')](',');}var _0x178a7e={'id':util[_0xa544('0x2c')]('%s:%s:%s',_0x9093bd,_0x1b17be['id'],_0x1b17be[_0xa544('0x1c')]),'condition':require('./interval')['condition'](_0x9093bd,getIntervals(_0x1ffda8[_0xa544('0x2d')],_0x1b17be),_0x1ffda8),'consequence':require(_0xa544('0x2e')+_0x1b17be[_0xa544('0x1c')])[_0xa544('0x2f')](_0x9093bd,_0x2d332e,_0x1ffda8,_0x2cfc7a),'p':_0x1b17be[_0xa544('0x30')]||0x0};logger[_0xa544('0x31')](_0xa544('0x32'),_0x178a7e['id'],_0xa544('0x33'),getIntervals(_0x1ffda8[_0xa544('0x2d')],_0x1b17be)[_0xa544('0x1b')]('\x20|\x20'));_0x5341f1[_0xa544('0x21')](_0x178a7e);}else{logger[_0xa544('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0xa544('0x17'),_0x1b17be[_0xa544('0x1c')]+'.js'));}}_0x1ffda8[_0xa544('0x13')][_0x9093bd]=new RuleEngine(_0x5341f1);_0x1ffda8['rules'][_0x9093bd][_0xa544('0x35')](_0x2cfc7a,function(_0x27ce83){logger[_0xa544('0x31')](_0xa544('0x36'),JSON[_0xa544('0x37')](_0x27ce83[_0xa544('0x38')]));if(_0x1ffda8['rules'][_0x9093bd]){_0x1ffda8['rules'][_0x9093bd][_0xa544('0x39')](_0xa544('0x3a'));}});return _0xf285db({'code':0xc8,'message':_0x2cfc7a});}else{logger[_0xa544('0x31')]('No\x20applications\x20to\x20execute');return _0xf285db({'code':0xc8,'message':_0x2cfc7a});}}catch(_0x5daeae){logger[_0xa544('0x34')](_0x5daeae[_0xa544('0x3b')]);return _0x127ae5(_0x4cb09c[_0xa544('0x34')](0x1f4,_0x5daeae));}}return _0x127ae5(_0xa544('0x3c'));});},'AcceptMessage':function(_0x24c7b8){var _0x3cb963=this;return new Promise(function(_0x39dc39,_0x1d42eb){if(_0x24c7b8[_0xa544('0x3d')]&&_0x24c7b8[_0xa544('0x3d')]['id']){if(_0x1ffda8['agents'][_0x24c7b8[_0xa544('0x3d')]['id']]){_0x1ffda8[_0xa544('0x3e')][_0x24c7b8[_0xa544('0x3d')]['id']][_0xa544('0x3f')]=![];_0x1ffda8[_0xa544('0x3e')][_0x24c7b8[_0xa544('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x24c7b8['message']&&_0x24c7b8[_0xa544('0x15')]['id']){try{var _0x2356fa=getId(_0x24c7b8[_0xa544('0x14')],_0x24c7b8[_0xa544('0x15')]?_0x24c7b8[_0xa544('0x15')]['id']:0x0,_0x24c7b8[_0xa544('0x16')]?_0x24c7b8[_0xa544('0x16')]['id']:0x0);if(_0x1ffda8['rules'][_0x2356fa]){_0x1ffda8['rules'][_0x2356fa][_0xa544('0x39')](_0xa544('0x40'));if(rpc[_0x24c7b8[_0xa544('0x14')]+_0xa544('0x41')]){rpc[_0x24c7b8[_0xa544('0x14')]+'QueueReport'][_0xa544('0x42')](_0x2356fa,{'UserId':_0x24c7b8[_0xa544('0x15')][_0xa544('0x43')]})[_0xa544('0x44')](function(_0x5e02b4){logger[_0xa544('0x34')](_0xa544('0x45'));});}}return _0x39dc39({'code':0xc8,'message':_0x24c7b8});}catch(_0x1e1818){logger['error'](_0x1e1818[_0xa544('0x3b')]);return _0x1d42eb(_0x3cb963[_0xa544('0x34')](0x1f4,_0x1e1818));}}logger[_0xa544('0x34')](_0xa544('0x46'));return _0x1d42eb(_0x3cb963[_0xa544('0x34')](0x1f4,_0xa544('0x46')));});},'RejectMessage':function(_0xc9ed87){var _0x4b0400=this;return new Promise(function(_0x93fcba,_0x34dba1){if(_0xc9ed87[_0xa544('0x3d')]&&_0xc9ed87[_0xa544('0x3d')]['id']){try{if(_0x1ffda8['agents'][_0xc9ed87['agent']['id']]){_0x1ffda8['agents'][_0xc9ed87[_0xa544('0x3d')]['id']][_0xa544('0x3f')]=![];_0x1ffda8[_0xa544('0x3e')][_0xc9ed87[_0xa544('0x3d')]['id']][_0xa544('0x47')]=undefined;}return _0x93fcba({'code':0xc8,'message':_0xc9ed87});}catch(_0x2fde39){logger[_0xa544('0x34')](_0x2fde39[_0xa544('0x3b')]);return _0x34dba1(_0x4b0400['error'](0x1f4,_0x2fde39));}}logger[_0xa544('0x34')](_0xa544('0x46'));return _0x34dba1(_0x4b0400[_0xa544('0x34')](0x1f4,_0xa544('0x46')));});},'AbandonInteraction':function(_0x2a414d){var _0x542d59=this;return new Promise(function(_0x4610bb,_0x176b25){if(_0x2a414d[_0xa544('0x14')]&&_0x2a414d['interaction']&&_0x2a414d[_0xa544('0x16')]['id']){try{var _0xa441ac=getId(_0x2a414d[_0xa544('0x14')],_0x2a414d[_0xa544('0x15')]?_0x2a414d[_0xa544('0x15')]['id']:0x0,_0x2a414d[_0xa544('0x16')]?_0x2a414d[_0xa544('0x16')]['id']:0x0);if(_0x1ffda8[_0xa544('0x13')][_0xa441ac]){_0x1ffda8[_0xa544('0x13')][_0xa441ac][_0xa544('0x39')](_0xa544('0x40'));}return _0x4610bb({'code':0xc8,'message':_0x2a414d});}catch(_0x1dcffe){logger[_0xa544('0x34')](_0x1dcffe['stack']);return _0x176b25(_0x542d59[_0xa544('0x34')](0x1f4,_0x1dcffe));}}logger['error'](_0xa544('0x46'));return _0x176b25(_0x542d59[_0xa544('0x34')](0x1f4,_0xa544('0x46')));});},'AgentCapacity':function(_0x2e8a6d){var _0xa3e399=this;return new Promise(function(_0x4dfe51,_0x480071){if(_0x1ffda8['agents']['hasOwnProperty'](_0x2e8a6d['id'])){for(var _0x365f79 in _0x2e8a6d[_0xa544('0x48')]){if(_0x2e8a6d[_0xa544('0x48')][_0xa544('0x49')](_0x365f79)){if(_0x1ffda8[_0xa544('0x3e')][_0x2e8a6d['id']][_0xa544('0x49')](_0x365f79+_0xa544('0x4a'))){_0x1ffda8['agents'][_0x2e8a6d['id']][_0x365f79+_0xa544('0x4a')]=parseInt(_0x2e8a6d[_0xa544('0x48')][_0x365f79],0xa);}}}_0x1ffda8[_0xa544('0x3e')][_0x2e8a6d['id']]['updateRealtime']();return _0x4dfe51({'code':0xc8,'message':_0x1ffda8[_0xa544('0x3e')][_0x2e8a6d['id']]});}else{return _0x480071(_0xa3e399[_0xa544('0x34')](0x1f4,_0xa544('0x4b')));}});},'Agents':function(_0x349a63){return new Promise(function(_0x170ce0,_0x31c249){var _0xe16eea=_['values'](_0x1ffda8[_0xa544('0x3e')]);_0x170ce0({'count':_0xe16eea[_0xa544('0x19')],'rows':_0xe16eea});});},'ChatQueues':function(_0x3dc16f){return new Promise(function(_0x4e2bc4,_0xa17024){var _0x4be641=[];for(var _0x291c5a in _0x1ffda8[_0xa544('0x4c')]){if(_0x1ffda8['chatQueues'][_0xa544('0x49')](_0x291c5a)){var _0x122186=_0x1ffda8['chatQueues'][_0x291c5a];var _0xdb923f={'id':_0x122186['id'],'available':_0x122186[_0xa544('0x4d')],'loggedIn':_0x122186[_0xa544('0x4e')],'name':_0x122186[_0xa544('0x4f')],'paused':_0x122186[_0xa544('0x50')],'waiting':_0x122186[_0xa544('0x51')]};_0x4be641[_0xa544('0x21')](_0xdb923f);}}_0x4e2bc4({'count':_0x4be641[_0xa544('0x19')],'rows':_0x4be641});});},'MailQueues':function(_0x25711d){return new Promise(function(_0x48482f,_0x2c5527){var _0x4830f0=[];for(var _0x1a24de in _0x1ffda8[_0xa544('0x52')]){if(_0x1ffda8[_0xa544('0x52')][_0xa544('0x49')](_0x1a24de)){var _0x57e12f=_0x1ffda8[_0xa544('0x52')][_0x1a24de];var _0x49ab21={'id':_0x57e12f['id'],'available':_0x57e12f[_0xa544('0x4d')],'loggedIn':_0x57e12f[_0xa544('0x4e')],'name':_0x57e12f[_0xa544('0x4f')],'paused':_0x57e12f['paused'],'waiting':_0x57e12f[_0xa544('0x51')]};_0x4830f0[_0xa544('0x21')](_0x49ab21);}}_0x48482f({'count':_0x4830f0['length'],'rows':_0x4830f0});});},'OpenchannelQueues':function(_0x5e79d4){return new Promise(function(_0x3eae65,_0x14320b){var _0x33fc3f=[];for(var _0x2a38d8 in _0x1ffda8[_0xa544('0x53')]){if(_0x1ffda8['openchannelQueues'][_0xa544('0x49')](_0x2a38d8)){var _0x52dce8=_0x1ffda8[_0xa544('0x53')][_0x2a38d8];var _0x361150={'id':_0x52dce8['id'],'available':_0x52dce8['available'],'loggedIn':_0x52dce8[_0xa544('0x4e')],'name':_0x52dce8[_0xa544('0x4f')],'paused':_0x52dce8[_0xa544('0x50')],'waiting':_0x52dce8[_0xa544('0x51')]};_0x33fc3f[_0xa544('0x21')](_0x361150);}}_0x3eae65({'count':_0x33fc3f['length'],'rows':_0x33fc3f});});},'SmsQueues':function(_0x2dff5d){return new Promise(function(_0x570f4f,_0x4ab253){var _0x331b1e=[];for(var _0x2eb5da in _0x1ffda8['smsQueues']){if(_0x1ffda8[_0xa544('0x54')][_0xa544('0x49')](_0x2eb5da)){var _0x25d6bd=_0x1ffda8['smsQueues'][_0x2eb5da];var _0x1e9c04={'id':_0x25d6bd['id'],'available':_0x25d6bd[_0xa544('0x4d')],'loggedIn':_0x25d6bd[_0xa544('0x4e')],'name':_0x25d6bd[_0xa544('0x4f')],'paused':_0x25d6bd[_0xa544('0x50')],'waiting':_0x25d6bd['waiting']};_0x331b1e['push'](_0x1e9c04);}}_0x570f4f({'count':_0x331b1e[_0xa544('0x19')],'rows':_0x331b1e});});},'FaxQueues':function(_0x39e5f6){return new Promise(function(_0x32aa5e,_0x446107){var _0x6bf6ac=[];for(var _0x2af6c7 in _0x1ffda8['faxQueues']){if(_0x1ffda8['faxQueues'][_0xa544('0x49')](_0x2af6c7)){var _0x35862c=_0x1ffda8[_0xa544('0x55')][_0x2af6c7];var _0x3c105c={'id':_0x35862c['id'],'available':_0x35862c[_0xa544('0x4d')],'loggedIn':_0x35862c[_0xa544('0x4e')],'name':_0x35862c[_0xa544('0x4f')],'paused':_0x35862c['paused'],'waiting':_0x35862c['waiting']};_0x6bf6ac[_0xa544('0x21')](_0x3c105c);}}_0x32aa5e({'count':_0x6bf6ac[_0xa544('0x19')],'rows':_0x6bf6ac});});},'WhatsappQueues':function(_0x3cb5a5){return new Promise(function(_0x1a9e60,_0x46bb93){var _0x383e1e=[];for(var _0x2e14c9 in _0x1ffda8[_0xa544('0x56')]){if(_0x1ffda8[_0xa544('0x56')][_0xa544('0x49')](_0x2e14c9)){var _0x281873=_0x1ffda8[_0xa544('0x56')][_0x2e14c9];var _0x34c214={'id':_0x281873['id'],'available':_0x281873[_0xa544('0x4d')],'loggedIn':_0x281873[_0xa544('0x4e')],'name':_0x281873[_0xa544('0x4f')],'paused':_0x281873[_0xa544('0x50')],'waiting':_0x281873[_0xa544('0x51')]};_0x383e1e[_0xa544('0x21')](_0x34c214);}}_0x1a9e60({'count':_0x383e1e[_0xa544('0x19')],'rows':_0x383e1e});});},'ChatQueuesWaitingInteractions':function(_0x525a2d){return new Promise(function(_0x341bf5,_0x4eb6f7){var _0x469b3e=_['values'](_0x1ffda8['chatQueuesWaitingInteractions']);_0x341bf5({'count':_0x469b3e[_0xa544('0x19')],'rows':_0x469b3e});});},'MailQueuesWaitingInteractions':function(_0x36e649){return new Promise(function(_0x6043bf,_0x519a51){var _0x43d57f=_[_0xa544('0x57')](_0x1ffda8[_0xa544('0x58')]);_0x6043bf({'count':_0x43d57f['length'],'rows':_0x43d57f});});},'OpenchannelQueuesWaitingInteractions':function(_0x4bb6aa){return new Promise(function(_0x2b3c16,_0x59af0f){var _0x34a61b=_[_0xa544('0x57')](_0x1ffda8['openchannelQueuesWaitingInteractions']);_0x2b3c16({'count':_0x34a61b['length'],'rows':_0x34a61b});});},'SmsQueuesWaitingInteractions':function(_0x2a16f2){return new Promise(function(_0x385d71,_0x5b8268){var _0x23a6d4=_[_0xa544('0x57')](_0x1ffda8[_0xa544('0x59')]);_0x385d71({'count':_0x23a6d4[_0xa544('0x19')],'rows':_0x23a6d4});});},'FaxQueuesWaitingInteractions':function(_0x55b02a){return new Promise(function(_0x46ad83,_0x1b50e3){var _0x51db36=_[_0xa544('0x57')](_0x1ffda8[_0xa544('0x5a')]);_0x46ad83({'count':_0x51db36['length'],'rows':_0x51db36});});},'WhatsappQueuesWaitingInteractions':function(_0x2cde7c){return new Promise(function(_0x19bbab,_0x4778fa){var _0x307fd2=_[_0xa544('0x57')](_0x1ffda8[_0xa544('0x5b')]);_0x19bbab({'count':_0x307fd2['length'],'rows':_0x307fd2});});}};var _0x44cff4=jayson['server'](_0x76e46d)[_0xa544('0x5c')]();_0x44cff4['on'](_0xa544('0x34'),function(_0x13f8b2){logger[_0xa544('0x34')](JSON[_0xa544('0x37')](_0x13f8b2));return _0x128b2b(_0x13f8b2);});_0x44cff4[_0xa544('0x12')](0x232c,_0xa544('0x5d'),function(){console[_0xa544('0x5e')](_0xa544('0x5f'),0x232c);return _0x141fa7('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 76be6e6..34836c6 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 _0x98d1=['client','http','request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','bluebird','jayson/promise','lodash','routing'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x98d1,0x18f));var _0x198d=function(_0x1be38d,_0x537f33){_0x1be38d=_0x1be38d-0x0;var _0x405f8d=_0x98d1[_0x1be38d];return _0x405f8d;};'use strict';var util=require('util');var BPromise=require(_0x198d('0x0'));var jayson=require(_0x198d('0x1'));var _=require(_0x198d('0x2'));var logger=require('../../../config/logger')(_0x198d('0x3'));var client=jayson[_0x198d('0x4')][_0x198d('0x5')]({'port':0x232a});function request(_0x538971,_0x27e22a){return new BPromise(function(_0x2a58e3,_0x4fb25b){return client[_0x198d('0x6')](_0x538971,_0x27e22a)[_0x198d('0x7')](function(_0x584f2e){if(_0x584f2e[_0x198d('0x8')]){return _0x4fb25b(_0x584f2e[_0x198d('0x8')][_0x198d('0x9')]);}else{return _0x2a58e3(_0x584f2e[_0x198d('0xa')]);}})[_0x198d('0xb')](function(_0x392a49){return _0x4fb25b(_0x392a49);});});}exports[_0x198d('0xc')]=function(_0x19c3b4,_0x2048b8,_0xf3cf78){return function(_0x14302f){if(_0xf3cf78[_0x198d('0xd')]&&!_0xf3cf78[_0x198d('0xd')][_0x19c3b4]){logger['info'](_0x198d('0xe'),_0x19c3b4);return _0x14302f[_0x198d('0xf')]();}var _0x1d4c31=[];for(var _0x1ced1c=0x0;_0x1ced1c<_0x2048b8[_0x198d('0x10')];_0x1ced1c+=0x1){_0x1d4c31[_0x198d('0x11')](request(_0x198d('0x12'),{'command':util[_0x198d('0x13')](_0x198d('0x14'),_0x2048b8[_0x1ced1c])})[_0x198d('0x7')](function(_0x581d20){return _0x581d20&&_0x581d20[_0x198d('0x9')]&&_0x581d20['message'][_0x198d('0x15')](_0x198d('0x16'))>=0x0?!![]:![];})['catch'](function(_0x21af44){logger['error'](_0x198d('0x17'),_0x19c3b4,_0x2048b8[_0x1ced1c]);}));}BPromise['all'](_0x1d4c31)[_0x198d('0x7')](function(_0x2c76b1){var _0x6ec110=_['some'](_0x2c76b1);logger[_0x198d('0x18')](_0x198d('0x19'),_0x19c3b4,_0x2048b8['join'](_0x198d('0x1a')),_0x6ec110);_0x14302f[_0x198d('0x1b')](_0x6ec110);})['catch'](function(_0x3c0986){console[_0x198d('0x1c')](_0x3c0986);logger[_0x198d('0x8')](_0x198d('0x19'),_0x19c3b4,_0x2048b8[_0x198d('0x1d')](_0x198d('0x1a')),_0x3c0986[_0x198d('0x1e')]);_0x14302f[_0x198d('0xf')]();});};}; \ No newline at end of file +var _0x1663=['request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stop','routing','client'];(function(_0x3f7678,_0x5a1f39){var _0x429546=function(_0x311090){while(--_0x311090){_0x3f7678['push'](_0x3f7678['shift']());}};_0x429546(++_0x5a1f39);}(_0x1663,0x1f2));var _0x3166=function(_0x34b19d,_0x179d40){_0x34b19d=_0x34b19d-0x0;var _0x2e71e4=_0x1663[_0x34b19d];return _0x2e71e4;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x3166('0x0'));var client=jayson[_0x3166('0x1')]['http']({'port':0x232a});function request(_0x6e4bda,_0x543c4a){return new BPromise(function(_0x51f45d,_0x84349a){return client[_0x3166('0x2')](_0x6e4bda,_0x543c4a)[_0x3166('0x3')](function(_0x14cd9d){if(_0x14cd9d['error']){return _0x84349a(_0x14cd9d[_0x3166('0x4')][_0x3166('0x5')]);}else{return _0x51f45d(_0x14cd9d[_0x3166('0x6')]);}})[_0x3166('0x7')](function(_0x4e6260){return _0x84349a(_0x4e6260);});});}exports[_0x3166('0x8')]=function(_0x2c919c,_0x15679a,_0x5b2501){return function(_0x83649a){if(_0x5b2501[_0x3166('0x9')]&&!_0x5b2501[_0x3166('0x9')][_0x2c919c]){logger['info'](_0x3166('0xa'),_0x2c919c);return _0x83649a['stop']();}var _0x3a2ad2=[];for(var _0x451b09=0x0;_0x451b09<_0x15679a[_0x3166('0xb')];_0x451b09+=0x1){_0x3a2ad2[_0x3166('0xc')](request('Command',{'command':util[_0x3166('0xd')](_0x3166('0xe'),_0x15679a[_0x451b09])})[_0x3166('0x3')](function(_0x9b0ba1){return _0x9b0ba1&&_0x9b0ba1[_0x3166('0x5')]&&_0x9b0ba1['message'][_0x3166('0xf')](_0x3166('0x10'))>=0x0?!![]:![];})[_0x3166('0x7')](function(_0x327f25){logger['error'](_0x3166('0x11'),_0x2c919c,_0x15679a[_0x451b09]);}));}BPromise[_0x3166('0x12')](_0x3a2ad2)[_0x3166('0x3')](function(_0x30e169){var _0x120afe=_['some'](_0x30e169);logger[_0x3166('0x13')](_0x3166('0x14'),_0x2c919c,_0x15679a[_0x3166('0x15')](_0x3166('0x16')),_0x120afe);_0x83649a['when'](_0x120afe);})[_0x3166('0x7')](function(_0x5483b0){console[_0x3166('0x17')](_0x5483b0);logger[_0x3166('0x4')](_0x3166('0x14'),_0x2c919c,_0x15679a['join']('\x20|\x20'),_0x5483b0['stack']);_0x83649a[_0x3166('0x18')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4e446a8..782f287 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 _0xbc9d=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','lodash','util','./utils','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','reason','ringtime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','talktime','answered_elsewhere','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected'];(function(_0x34bf28,_0x904144){var _0x3d83a8=function(_0x44b52c){while(--_0x44b52c){_0x34bf28['push'](_0x34bf28['shift']());}};_0x3d83a8(++_0x904144);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x23679b,_0x4870f7){_0x23679b=_0x23679b-0x0;var _0x19fc0c=_0xbc9d[_0x23679b];return _0x19fc0c;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var utils=require(_0xdbc9('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x434f6e,_0x35f89c){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x434f6e[_0xdbc9('0x3')],_0x434f6e[_0xdbc9('0x4')],_0x434f6e[_0xdbc9('0x5')],_0x434f6e[_0xdbc9('0x6')],_0x434f6e[_0xdbc9('0x7')],_0x434f6e[_0xdbc9('0x8')],_0x434f6e[_0xdbc9('0x9')],_0x434f6e['lastevent']));if(_0x434f6e[_0xdbc9('0x5')]){utils[_0xdbc9('0xa')](_0x434f6e[_0xdbc9('0x5')])['then'](function(_0x2c7ba5){if(_0x2c7ba5){_0x434f6e['type']=_0x2c7ba5['type'];_0x434f6e[_0xdbc9('0xb')]=_0x434f6e[_0xdbc9('0xc')]?_0x2c7ba5[_0xdbc9('0xd')]:![];_0x434f6e[_0xdbc9('0xe')]=_0x434f6e['agentacw']?_0x2c7ba5[_0xdbc9('0xf')]:0x0;}utils[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x434f6e);});}else{utils[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x434f6e);}if(_0x35f89c){delete transfers[_0x434f6e[_0xdbc9('0x3')]];}else{delete agents[_0x434f6e['destuniqueid']];}}exports['agentcalled']=function(_0x3d0fdd){try{utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x14'),_0x3d0fdd[_0xdbc9('0x3')]),_0x3d0fdd);agents[_0x3d0fdd['destuniqueid']]=_0x3d0fdd;agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x16')]=utils[_0xdbc9('0x17')]();agents[_0x3d0fdd['destuniqueid']][_0xdbc9('0x18')]=_0xdbc9('0x19');agents[_0x3d0fdd['destuniqueid']][_0xdbc9('0x9')]=null;agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x1a')]=null;utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x1c'),_0x3d0fdd[_0xdbc9('0x3')],agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x6')],_0x3d0fdd[_0xdbc9('0x15')]));}catch(_0x57a546){utils[_0xdbc9('0x1d')](util['format'](_0xdbc9('0x14'),_0x3d0fdd[_0xdbc9('0x3')]),_0x57a546);}};exports['agentringnoanswer']=function(_0x4408e9){try{if(!_['isNil'](agents[_0x4408e9['destuniqueid']])){utils['debug'](util['format'](_0xdbc9('0x1e'),_0x4408e9[_0xdbc9('0x3')]),_0x4408e9);utils['info'](util[_0xdbc9('0x13')](_0xdbc9('0x1f'),_0x4408e9['uniqueid'],agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x6')],_0x4408e9[_0xdbc9('0x15')]));agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x20')]=!![];agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x21')]=utils[_0xdbc9('0x17')]();agents[_0x4408e9[_0xdbc9('0x15')]]['lastevent']=_0xdbc9('0x22');agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x23')]=_0xdbc9('0x22');agents[_0x4408e9[_0xdbc9('0x15')]]['holdtime']=_0x4408e9[_0xdbc9('0x24')]?parseInt(_0x4408e9[_0xdbc9('0x24')])/0x3e8:0x0;agents[_0x4408e9['destuniqueid']]['talktime']=0x0;unanswered[_0xdbc9('0x25')](_0x4408e9[_0xdbc9('0x15')]);}}catch(_0x473430){utils['error'](util[_0xdbc9('0x13')]('[%s][agents][agentringnoanswer]',_0x4408e9['uniqueid']),_0x473430);}};exports[_0xdbc9('0x26')]=function(_0x49da36){try{_['forIn'](agents,function(_0x417b17,_0x20eb4f){if(_0x417b17[_0xdbc9('0x3')]==_0x49da36['uniqueid']&&!_[_0xdbc9('0x27')](unanswered,_0x417b17[_0xdbc9('0x15')])){utils['debug'](util['format'](_0xdbc9('0x28'),_0x49da36[_0xdbc9('0x3')]),_0x49da36);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x29'),_0x49da36[_0xdbc9('0x3')],_0x417b17[_0xdbc9('0x6')],_0x417b17['destuniqueid']));_0x417b17[_0xdbc9('0x20')]=!![];_0x417b17[_0xdbc9('0x21')]=utils[_0xdbc9('0x17')]();_0x417b17[_0xdbc9('0x18')]=_0xdbc9('0x2a');_0x417b17[_0xdbc9('0x23')]='abandoned';_0x417b17[_0xdbc9('0x2b')]=_0x49da36['holdtime'];_0x417b17['talktime']=0x0;writeDB(_0x417b17);}});}catch(_0x495c0e){utils['error'](util['format'](_0xdbc9('0x28'),_0x49da36[_0xdbc9('0x3')]),_0x495c0e);}};exports[_0xdbc9('0x2c')]=function(_0x5527fc){try{if(agents[_0x5527fc[_0xdbc9('0x15')]]){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x2d'),_0x5527fc[_0xdbc9('0x3')]),_0x5527fc);utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x2e'),_0x5527fc[_0xdbc9('0x3')],agents[_0x5527fc[_0xdbc9('0x15')]]['membername'],_0x5527fc[_0xdbc9('0x15')]));agents[_0x5527fc[_0xdbc9('0x15')]][_0xdbc9('0x2f')]=utils[_0xdbc9('0x17')]();agents[_0x5527fc['destuniqueid']]['connectedlinenum']=_0x5527fc[_0xdbc9('0x9')];agents[_0x5527fc[_0xdbc9('0x15')]][_0xdbc9('0x1a')]=_0x5527fc[_0xdbc9('0x1a')];agents[_0x5527fc['destuniqueid']][_0xdbc9('0x2b')]=_0x5527fc[_0xdbc9('0x24')];agents[_0x5527fc[_0xdbc9('0x15')]]['lastevent']=_0xdbc9('0x30');_[_0xdbc9('0x31')](agents,function(_0x444219,_0x523c79){if(_0x444219[_0xdbc9('0x15')]!=_0x5527fc[_0xdbc9('0x15')]&&_0x444219['uniqueid']==_0x5527fc['uniqueid']){_0x444219[_0xdbc9('0x32')]=0x0;_0x444219[_0xdbc9('0x2b')]=_0x5527fc[_0xdbc9('0x24')];_0x444219[_0xdbc9('0x20')]=!![];_0x444219['agentringnoanswerAt']=utils[_0xdbc9('0x17')]();_0x444219[_0xdbc9('0x18')]='answered_elsewhere';_0x444219[_0xdbc9('0x23')]=_0xdbc9('0x33');_0x444219['answeredelsewheredestinationuniqueid']=_0x5527fc[_0xdbc9('0x15')];_0x444219[_0xdbc9('0x34')]=_0x5527fc[_0xdbc9('0x6')];writeDB(_0x444219);}});}}catch(_0x3415c3){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x2d'),_0x5527fc['uniqueid']),_0x3415c3);}};exports['agentcomplete']=function(_0x768856){try{if(!_[_0xdbc9('0x35')](agents[_0x768856[_0xdbc9('0x15')]])){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x36'),_0x768856[_0xdbc9('0x3')]),_0x768856);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x37'),_0x768856[_0xdbc9('0x3')],agents[_0x768856['destuniqueid']]['membername'],_0x768856[_0xdbc9('0x15')]));agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0xc')]=!![];agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x38')]=utils[_0xdbc9('0x17')]();agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x32')]=utils['diffTime'](agents[_0x768856['destuniqueid']][_0xdbc9('0x38')],agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x2f')]);agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x23')]=_0x768856[_0xdbc9('0x23')];agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x18')]=_0xdbc9('0x39');writeDB(agents[_0x768856['destuniqueid']]);}}catch(_0x2c24a9){utils[_0xdbc9('0x1d')](util['format']('[%s][agents][agentcomplete]',_0x768856[_0xdbc9('0x3')]),_0x2c24a9);}};exports[_0xdbc9('0x3a')]=function(_0x133a13){try{if(!_['isNil'](agents[_0x133a13[_0xdbc9('0x3b')]])){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x3c'),_0x133a13['uniqueid']),_0x133a13);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x3d'),_0x133a13[_0xdbc9('0x3')],agents[_0x133a13['transfereruniqueid']][_0xdbc9('0x6')],agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3')]));agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3e')]=!![];agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3f')]=_0xdbc9('0x40');agents[_0x133a13['transfereruniqueid']][_0xdbc9('0x41')]=_0x133a13['extension'];agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x42')]=agents[_0x133a13['transfereruniqueid']]['uniqueid'];}}catch(_0xc7335d){utils['error'](util[_0xdbc9('0x13')](_0xdbc9('0x3c'),_0x133a13[_0xdbc9('0x3')]),_0xc7335d);}};exports['attendedtransfer']=function(_0x32b38d){try{utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x43'),_0x32b38d[_0xdbc9('0x44')]),_0x32b38d);if(_0x32b38d[_0xdbc9('0x44')]==_0x32b38d[_0xdbc9('0x45')]){if(!_[_0xdbc9('0x35')](agents[_0x32b38d['secondtransfereruniqueid']])){utils['info'](util['format'](_0xdbc9('0x46'),_0x32b38d[_0xdbc9('0x44')],agents[_0x32b38d[_0xdbc9('0x47')]]['membername']));agents[_0x32b38d['secondtransfereruniqueid']][_0xdbc9('0x3e')]=!![];agents[_0x32b38d[_0xdbc9('0x47')]]['transfertype']='ATTENDED';agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x41')]=_0x32b38d[_0xdbc9('0x48')];agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x42')]=_0x32b38d[_0xdbc9('0x44')];}if(_0x32b38d['transfereeuniqueid']&&agents[_0x32b38d[_0xdbc9('0x49')]]){agents[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4a')]=0x1;transfers[_0x32b38d['transfereeuniqueid']]=_[_0xdbc9('0x4b')](agents[_0x32b38d[_0xdbc9('0x49')]]);transfers[_0x32b38d[_0xdbc9('0x49')]]['calleridnum']=agents[_0x32b38d[_0xdbc9('0x47')]]['calleridnum'];transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4c')]=agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x4c')];transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x16')]=utils['now']();transfers[_0x32b38d[_0xdbc9('0x49')]]['agentconnectAt']=utils[_0xdbc9('0x17')]();transfers[_0x32b38d[_0xdbc9('0x49')]]['holdtime']=0x0;transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4a')]=0x2;}}else if(_0x32b38d['secondtransfereruniqueid']==_0x32b38d['secondtransfererlinkedid']){if(!_[_0xdbc9('0x35')](agents[_0x32b38d[_0xdbc9('0x44')]])){utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x46'),_0x32b38d[_0xdbc9('0x44')],agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x6')]));agents[_0x32b38d[_0xdbc9('0x44')]]['transfer']=!![];agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x3f')]=_0xdbc9('0x4d');agents[_0x32b38d[_0xdbc9('0x44')]][_0xdbc9('0x41')]=_0x32b38d[_0xdbc9('0x4e')];agents[_0x32b38d[_0xdbc9('0x44')]][_0xdbc9('0x42')]=_0x32b38d[_0xdbc9('0x47')];}if(_0x32b38d['transfertargetuniqueid']&&agents[_0x32b38d[_0xdbc9('0x4f')]]){agents[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x4a')]=0x1;transfers[_0x32b38d[_0xdbc9('0x4f')]]=_[_0xdbc9('0x4b')](agents[_0x32b38d[_0xdbc9('0x4f')]]);transfers[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x8')]=agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x8')];transfers[_0x32b38d['transfertargetuniqueid']][_0xdbc9('0x4c')]=agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x4c')];transfers[_0x32b38d[_0xdbc9('0x4f')]]['agentcalledAt']=utils['now']();transfers[_0x32b38d['transfertargetuniqueid']][_0xdbc9('0x2f')]=utils[_0xdbc9('0x17')]();transfers[_0x32b38d[_0xdbc9('0x4f')]]['holdtime']=0x0;transfers[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x4a')]=0x2;}}}catch(_0x53843c){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x43'),_0x32b38d[_0xdbc9('0x44')]),_0x53843c);}};exports[_0xdbc9('0x50')]=function(_0xfdfb20){try{utils['debug'](util[_0xdbc9('0x13')](_0xdbc9('0x51'),_0xfdfb20['uniqueid']),_0xfdfb20);if(agents[_0xfdfb20['uniqueid']]&&agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')]===_0xdbc9('0x22')){if(_0xfdfb20[_0xdbc9('0x52')]==='21'){agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')]=_0xdbc9('0x53');agents[_0xfdfb20['uniqueid']][_0xdbc9('0x18')]=_0xdbc9('0x53');}utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x54'),_0xfdfb20[_0xdbc9('0x3')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x6')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]));writeDB(agents[_0xfdfb20[_0xdbc9('0x3')]]);var _0x1afbcd=unanswered[_0xdbc9('0x55')](_0xfdfb20[_0xdbc9('0x3')]);if(_0x1afbcd>-0x1){unanswered['splice'](_0x1afbcd,0x1);}}if(transfers[_0xfdfb20['uniqueid']]){transfers[_0xfdfb20[_0xdbc9('0x3')]]['agentcomplete']=!![];transfers[_0xfdfb20['uniqueid']][_0xdbc9('0x38')]=utils[_0xdbc9('0x17')]();transfers[_0xfdfb20[_0xdbc9('0x3')]]['talktime']=utils[_0xdbc9('0x56')](transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x38')],transfers[_0xfdfb20['uniqueid']][_0xdbc9('0x2f')]);transfers[_0xfdfb20[_0xdbc9('0x3')]]['reason']=_0xdbc9('0x57');transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]=_0xdbc9('0x39');utils[_0xdbc9('0x1b')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xfdfb20[_0xdbc9('0x3')],transfers[_0xfdfb20[_0xdbc9('0x3')]]['membername'],transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')],transfers[_0xfdfb20[_0xdbc9('0x3')]]['lastevent']));writeDB(transfers[_0xfdfb20[_0xdbc9('0x3')]],!![]);}if(agents[_0xfdfb20[_0xdbc9('0x3')]]&&agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x2f')]){agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0xc')]=!![];agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x38')]=utils['now']();agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x32')]=utils[_0xdbc9('0x56')](agents[_0xfdfb20[_0xdbc9('0x3')]]['agentcompleteAt'],agents[_0xfdfb20[_0xdbc9('0x3')]]['agentconnectAt']);agents[_0xfdfb20['uniqueid']][_0xdbc9('0x23')]=agents[_0xfdfb20[_0xdbc9('0x3')]]['transfer']?_0xdbc9('0x3e'):_0xdbc9('0x57');agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]=_0xdbc9('0x39');utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xfdfb20['uniqueid'],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x6')],agents[_0xfdfb20[_0xdbc9('0x3')]]['reason'],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]));writeDB(agents[_0xfdfb20[_0xdbc9('0x3')]]);}}catch(_0x1839e4){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x51'),_0xfdfb20[_0xdbc9('0x3')]),_0x1839e4);}}; \ No newline at end of file +var _0x9c00=['acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','origtransfereruniqueid','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','[%s][agents][hangup]','lodash','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0x9c00,0x1a0));var _0x09c0=function(_0x3034ce,_0x1421b6){_0x3034ce=_0x3034ce-0x0;var _0x4bc0e3=_0x9c00[_0x3034ce];return _0x4bc0e3;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e32e7,_0xe0d293){utils[_0x09c0('0x2')](util['format'](_0x09c0('0x3'),_0x5e32e7[_0x09c0('0x4')],_0x5e32e7[_0x09c0('0x5')],_0x5e32e7[_0x09c0('0x6')],_0x5e32e7[_0x09c0('0x7')],_0x5e32e7['interface'],_0x5e32e7['calleridnum'],_0x5e32e7[_0x09c0('0x8')],_0x5e32e7[_0x09c0('0x9')]));if(_0x5e32e7[_0x09c0('0x6')]){utils[_0x09c0('0xa')](_0x5e32e7[_0x09c0('0x6')])['then'](function(_0x6558ca){if(_0x6558ca){_0x5e32e7[_0x09c0('0xb')]=_0x6558ca[_0x09c0('0xb')];_0x5e32e7[_0x09c0('0xc')]=_0x5e32e7[_0x09c0('0xd')]?_0x6558ca[_0x09c0('0xe')]:![];_0x5e32e7[_0x09c0('0xf')]=_0x5e32e7[_0x09c0('0xc')]?_0x6558ca[_0x09c0('0x10')]:0x0;}utils[_0x09c0('0x11')](_0x09c0('0x12'),_0x5e32e7);});}else{utils[_0x09c0('0x11')](_0x09c0('0x12'),_0x5e32e7);}if(_0xe0d293){delete transfers[_0x5e32e7[_0x09c0('0x4')]];}else{delete agents[_0x5e32e7[_0x09c0('0x13')]];}}exports[_0x09c0('0x14')]=function(_0x6149a8){try{utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x17'),_0x6149a8[_0x09c0('0x4')]),_0x6149a8);agents[_0x6149a8[_0x09c0('0x13')]]=_0x6149a8;agents[_0x6149a8[_0x09c0('0x13')]][_0x09c0('0x18')]=utils[_0x09c0('0x19')]();agents[_0x6149a8[_0x09c0('0x13')]]['lastevent']='called';agents[_0x6149a8['destuniqueid']][_0x09c0('0x8')]=null;agents[_0x6149a8[_0x09c0('0x13')]][_0x09c0('0x1a')]=null;utils[_0x09c0('0x2')](util['format'](_0x09c0('0x1b'),_0x6149a8['uniqueid'],agents[_0x6149a8['destuniqueid']][_0x09c0('0x7')],_0x6149a8['destuniqueid']));}catch(_0x2cda5e){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')]('[%s][agents][agentcalled]',_0x6149a8[_0x09c0('0x4')]),_0x2cda5e);}};exports[_0x09c0('0x1d')]=function(_0x8ad645){try{if(!_[_0x09c0('0x1e')](agents[_0x8ad645[_0x09c0('0x13')]])){utils[_0x09c0('0x15')](util[_0x09c0('0x16')]('[%s][agents][agentringnoanswer]',_0x8ad645[_0x09c0('0x4')]),_0x8ad645);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x1f'),_0x8ad645['uniqueid'],agents[_0x8ad645['destuniqueid']][_0x09c0('0x7')],_0x8ad645[_0x09c0('0x13')]));agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x1d')]=!![];agents[_0x8ad645['destuniqueid']][_0x09c0('0x20')]=utils[_0x09c0('0x19')]();agents[_0x8ad645['destuniqueid']][_0x09c0('0x9')]=_0x09c0('0x21');agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x22')]=_0x09c0('0x21');agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x23')]=_0x8ad645[_0x09c0('0x24')]?parseInt(_0x8ad645[_0x09c0('0x24')])/0x3e8:0x0;agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x25')]=0x0;unanswered['push'](_0x8ad645[_0x09c0('0x13')]);}}catch(_0x1bdde9){utils['error'](util[_0x09c0('0x16')]('[%s][agents][agentringnoanswer]',_0x8ad645[_0x09c0('0x4')]),_0x1bdde9);}};exports['queuecallerabandon']=function(_0x3ac8e4){try{_[_0x09c0('0x26')](agents,function(_0x108409,_0x4159bc){if(_0x108409['uniqueid']==_0x3ac8e4['uniqueid']&&!_[_0x09c0('0x27')](unanswered,_0x108409[_0x09c0('0x13')])){utils[_0x09c0('0x15')](util['format'](_0x09c0('0x28'),_0x3ac8e4['uniqueid']),_0x3ac8e4);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x29'),_0x3ac8e4['uniqueid'],_0x108409[_0x09c0('0x7')],_0x108409[_0x09c0('0x13')]));_0x108409[_0x09c0('0x1d')]=!![];_0x108409[_0x09c0('0x20')]=utils[_0x09c0('0x19')]();_0x108409[_0x09c0('0x9')]=_0x09c0('0x2a');_0x108409['reason']=_0x09c0('0x2a');_0x108409[_0x09c0('0x23')]=_0x3ac8e4[_0x09c0('0x23')];_0x108409[_0x09c0('0x25')]=0x0;writeDB(_0x108409);}});}catch(_0x2c1ad3){utils['error'](util[_0x09c0('0x16')](_0x09c0('0x28'),_0x3ac8e4[_0x09c0('0x4')]),_0x2c1ad3);}};exports[_0x09c0('0x2b')]=function(_0x353454){try{if(agents[_0x353454['destuniqueid']]){utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x2c'),_0x353454[_0x09c0('0x4')]),_0x353454);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x2d'),_0x353454['uniqueid'],agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x7')],_0x353454[_0x09c0('0x13')]));agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x2e')]=utils['now']();agents[_0x353454['destuniqueid']]['connectedlinenum']=_0x353454['connectedlinenum'];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x1a')]=_0x353454[_0x09c0('0x1a')];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x23')]=_0x353454['ringtime'];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x9')]='connect';_[_0x09c0('0x26')](agents,function(_0x5d50b9,_0x3ee063){if(_0x5d50b9['destuniqueid']!=_0x353454[_0x09c0('0x13')]&&_0x5d50b9[_0x09c0('0x4')]==_0x353454['uniqueid']){_0x5d50b9[_0x09c0('0x25')]=0x0;_0x5d50b9[_0x09c0('0x23')]=_0x353454['ringtime'];_0x5d50b9[_0x09c0('0x1d')]=!![];_0x5d50b9[_0x09c0('0x20')]=utils[_0x09c0('0x19')]();_0x5d50b9[_0x09c0('0x9')]=_0x09c0('0x2f');_0x5d50b9[_0x09c0('0x22')]='answered_elsewhere';_0x5d50b9[_0x09c0('0x30')]=_0x353454[_0x09c0('0x13')];_0x5d50b9[_0x09c0('0x31')]=_0x353454['membername'];writeDB(_0x5d50b9);}});}}catch(_0x193ed2){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')]('[%s][agents][agentconnect]',_0x353454[_0x09c0('0x4')]),_0x193ed2);}};exports[_0x09c0('0xd')]=function(_0x52cd5c){try{if(!_['isNil'](agents[_0x52cd5c[_0x09c0('0x13')]])){utils[_0x09c0('0x15')](util['format'](_0x09c0('0x32'),_0x52cd5c[_0x09c0('0x4')]),_0x52cd5c);utils['info'](util[_0x09c0('0x16')](_0x09c0('0x33'),_0x52cd5c[_0x09c0('0x4')],agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x7')],_0x52cd5c['destuniqueid']));agents[_0x52cd5c[_0x09c0('0x13')]]['agentcomplete']=!![];agents[_0x52cd5c['destuniqueid']][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x25')]=utils[_0x09c0('0x35')](agents[_0x52cd5c[_0x09c0('0x13')]]['agentcompleteAt'],agents[_0x52cd5c['destuniqueid']]['agentconnectAt']);agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x22')]=_0x52cd5c[_0x09c0('0x22')];agents[_0x52cd5c['destuniqueid']][_0x09c0('0x9')]=_0x09c0('0x36');writeDB(agents[_0x52cd5c[_0x09c0('0x13')]]);}}catch(_0x198517){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x32'),_0x52cd5c[_0x09c0('0x4')]),_0x198517);}};exports[_0x09c0('0x37')]=function(_0x38085c){try{if(!_[_0x09c0('0x1e')](agents[_0x38085c[_0x09c0('0x38')]])){utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x39'),_0x38085c[_0x09c0('0x4')]),_0x38085c);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x3a'),_0x38085c[_0x09c0('0x4')],agents[_0x38085c['transfereruniqueid']][_0x09c0('0x7')],agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x4')]));agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x3b')]=!![];agents[_0x38085c['transfereruniqueid']][_0x09c0('0x3c')]=_0x09c0('0x3d');agents[_0x38085c[_0x09c0('0x38')]]['transferexten']=_0x38085c[_0x09c0('0x3e')];agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x3f')]=agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x4')];}}catch(_0xebfd6d){utils[_0x09c0('0x1c')](util['format'](_0x09c0('0x39'),_0x38085c[_0x09c0('0x4')]),_0xebfd6d);}};exports[_0x09c0('0x40')]=function(_0x428f9a){try{utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x41'),_0x428f9a['origtransfereruniqueid']),_0x428f9a);if(_0x428f9a['origtransfereruniqueid']==_0x428f9a[_0x09c0('0x42')]){if(!_[_0x09c0('0x1e')](agents[_0x428f9a[_0x09c0('0x43')]])){utils['info'](util[_0x09c0('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x428f9a[_0x09c0('0x44')],agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x7')]));agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3b')]=!![];agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3c')]='ATTENDED';agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x45')]=_0x428f9a[_0x09c0('0x46')];agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3f')]=_0x428f9a[_0x09c0('0x44')];}if(_0x428f9a[_0x09c0('0x47')]&&agents[_0x428f9a[_0x09c0('0x47')]]){agents[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x48')]=0x1;transfers[_0x428f9a[_0x09c0('0x47')]]=_['clone'](agents[_0x428f9a[_0x09c0('0x47')]]);transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x49')]=agents[_0x428f9a[_0x09c0('0x43')]]['calleridnum'];transfers[_0x428f9a[_0x09c0('0x47')]]['calleridname']=agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x4a')];transfers[_0x428f9a[_0x09c0('0x47')]]['agentcalledAt']=utils['now']();transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x2e')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a[_0x09c0('0x47')]]['holdtime']=0x0;transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x48')]=0x2;}}else if(_0x428f9a['secondtransfereruniqueid']==_0x428f9a[_0x09c0('0x4b')]){if(!_[_0x09c0('0x1e')](agents[_0x428f9a[_0x09c0('0x44')]])){utils[_0x09c0('0x2')](util['format'](_0x09c0('0x4c'),_0x428f9a[_0x09c0('0x44')],agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x7')]));agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x3b')]=!![];agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x3c')]=_0x09c0('0x4d');agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x45')]=_0x428f9a[_0x09c0('0x4e')];agents[_0x428f9a[_0x09c0('0x44')]]['transferuniqueid']=_0x428f9a[_0x09c0('0x43')];}if(_0x428f9a[_0x09c0('0x4f')]&&agents[_0x428f9a[_0x09c0('0x4f')]]){agents[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x48')]=0x1;transfers[_0x428f9a['transfertargetuniqueid']]=_[_0x09c0('0x50')](agents[_0x428f9a[_0x09c0('0x4f')]]);transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x49')]=agents[_0x428f9a['origtransfereruniqueid']][_0x09c0('0x49')];transfers[_0x428f9a[_0x09c0('0x4f')]]['calleridname']=agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x4a')];transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x18')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a['transfertargetuniqueid']][_0x09c0('0x2e')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x23')]=0x0;transfers[_0x428f9a[_0x09c0('0x4f')]]['agententerreason']=0x2;}}}catch(_0x422046){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x41'),_0x428f9a[_0x09c0('0x44')]),_0x422046);}};exports[_0x09c0('0x51')]=function(_0x59c57a){try{utils['debug'](util['format']('[%s][agents][hangup]',_0x59c57a[_0x09c0('0x4')]),_0x59c57a);if(agents[_0x59c57a[_0x09c0('0x4')]]&&agents[_0x59c57a[_0x09c0('0x4')]]['reason']===_0x09c0('0x21')){if(_0x59c57a['cause']==='21'){agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')]='rejected';agents[_0x59c57a[_0x09c0('0x4')]]['lastevent']='rejected';}utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a[_0x09c0('0x4')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x9')]));writeDB(agents[_0x59c57a['uniqueid']]);var _0x188af2=unanswered[_0x09c0('0x53')](_0x59c57a['uniqueid']);if(_0x188af2>-0x1){unanswered['splice'](_0x188af2,0x1);}}if(transfers[_0x59c57a[_0x09c0('0x4')]]){transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0xd')]=!![];transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();transfers[_0x59c57a[_0x09c0('0x4')]]['talktime']=utils[_0x09c0('0x35')](transfers[_0x59c57a['uniqueid']][_0x09c0('0x34')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]);transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')]='agent';transfers[_0x59c57a[_0x09c0('0x4')]]['lastevent']=_0x09c0('0x36');utils['info'](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a[_0x09c0('0x4')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],transfers[_0x59c57a['uniqueid']]['lastevent']));writeDB(transfers[_0x59c57a[_0x09c0('0x4')]],!![]);}if(agents[_0x59c57a[_0x09c0('0x4')]]&&agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]){agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0xd')]=!![];agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();agents[_0x59c57a[_0x09c0('0x4')]]['talktime']=utils['diffTime'](agents[_0x59c57a['uniqueid']][_0x09c0('0x34')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]);agents[_0x59c57a['uniqueid']]['reason']=agents[_0x59c57a[_0x09c0('0x4')]]['transfer']?_0x09c0('0x3b'):_0x09c0('0x54');agents[_0x59c57a['uniqueid']][_0x09c0('0x9')]='complete';utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a['uniqueid'],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x9')]));writeDB(agents[_0x59c57a[_0x09c0('0x4')]]);}}catch(_0x4345a8){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x55'),_0x59c57a[_0x09c0('0x4')]),_0x4345a8);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 925c3a2..ad7e034 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 _0x3914=['cdr','split','lastIndexOf','includes','execif','gotoif','lastapplication','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','isNil','channelstate','systemanswertime','now','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','Queue','lastdata','queue','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata'];(function(_0x3f5772,_0x9186f0){var _0x4ea6cb=function(_0x304496){while(--_0x304496){_0x3f5772['push'](_0x3f5772['shift']());}};_0x4ea6cb(++_0x9186f0);}(_0x3914,0xeb));var _0x4391=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x3914[_0x18b5e8];return _0x25baed;};'use strict';var _=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var utils=require('./utils');var transfers=require(_0x4391('0x2'));var dispositions=[_0x4391('0x3'),'FAILED',_0x4391('0x4'),_0x4391('0x3'),_0x4391('0x3'),'NO\x20ANSWER',_0x4391('0x5'),_0x4391('0x6'),'FAILED',_0x4391('0x4'),'FAILED'];var channels={};function writeDB(_0x4733a2){var _0x5c32ac;if(transfers[_0x4391('0x7')][_0x4733a2[_0x4391('0x8')]]){_0x5c32ac=_0x4733a2['uniqueid'];_0x4733a2['uniqueid']=transfers[_0x4391('0x7')][_0x4733a2[_0x4391('0x8')]][_0x4391('0x9')];}utils['info'](util[_0x4391('0xa')](_0x4391('0xb'),_0x4733a2[_0x4391('0x8')],_0x4733a2[_0x4391('0xc')],_0x4733a2['queue'],_0x4733a2[_0x4391('0xd')],_0x4733a2[_0x4391('0xe')],_0x4733a2[_0x4391('0xf')],_0x4733a2[_0x4391('0x10')],_0x4733a2[_0x4391('0x11')]));if(_0x4733a2[_0x4391('0x12')]){utils[_0x4391('0x13')](_0x4733a2[_0x4391('0x12')])['then'](function(_0x1a49ba){if(_0x1a49ba){_0x4733a2[_0x4391('0x14')]=_0x1a49ba['id'];}utils[_0x4391('0x15')](_0x4391('0x16'),_0x4733a2);});}else{utils['request'](_0x4391('0x16'),_0x4733a2);}if(channels[_0x4733a2['uniqueid']]){delete channels[_0x4733a2[_0x4391('0x8')]];}else if(_0x5c32ac&&channels[_0x5c32ac]){if(!transfers[_0x4391('0x7')][_0x5c32ac][_0x4391('0x17')])delete transfers[_0x4391('0x7')][_0x5c32ac];delete channels[_0x5c32ac];}}exports[_0x4391('0x18')]=function(_0x15e884){try{utils[_0x4391('0x19')](util[_0x4391('0xa')]('[%s][calls][newchannel]',_0x15e884['uniqueid']),_0x15e884);if(_0x15e884[_0x4391('0x8')]==_0x15e884['linkedid']&&_0x15e884[_0x4391('0xc')]!=_0x4391('0x1a')){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x1c'),_0x15e884['uniqueid'],_0x15e884['context'],_0x15e884[_0x4391('0x1d')]));channels[_0x15e884[_0x4391('0x8')]]={'uniqueid':_0x15e884[_0x4391('0x8')],'accountcode':_0x15e884['accountcode'],'source':_0x15e884[_0x4391('0xf')],'destination':_0x15e884[_0x4391('0x1d')],'destinationcontext':_0x15e884[_0x4391('0x1e')],'channel':_0x15e884[_0x4391('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4391('0x3'),'amaflags':_0x4391('0x1f')};}}catch(_0x3c4c9b){utils[_0x4391('0x20')](util[_0x4391('0xa')](_0x4391('0x21'),_0x15e884['uniqueid']),_0x3c4c9b);}};exports[_0x4391('0x22')]=function(_0x224e13){try{utils[_0x4391('0x19')](util[_0x4391('0xa')]('[%s][calls][newstate]',_0x224e13['uniqueid']),_0x224e13);if(!_[_0x4391('0x23')](channels[_0x224e13[_0x4391('0x8')]])&&_0x224e13[_0x4391('0x24')]==0x6){utils[_0x4391('0x1b')](util[_0x4391('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x224e13['uniqueid'],_0x224e13['context'],_0x224e13['channel']));if(_[_0x4391('0x23')](channels[_0x224e13[_0x4391('0x8')]][_0x4391('0x25')])){channels[_0x224e13[_0x4391('0x8')]]['systemanswertime']=utils[_0x4391('0x26')]();}}else if(!_[_0x4391('0x23')](channels[_0x224e13[_0x4391('0x27')]])&&_0x224e13[_0x4391('0x24')]==0x6&&_0x224e13[_0x4391('0x1e')]!='transfer'){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x28'),_0x224e13[_0x4391('0x8')],_0x224e13[_0x4391('0x27')],_0x224e13[_0x4391('0x1e')],_0x224e13[_0x4391('0xc')]));channels[_0x224e13[_0x4391('0x27')]][_0x4391('0x12')]=_0x224e13[_0x4391('0x12')];channels[_0x224e13[_0x4391('0x27')]]['destinationchannel']=_0x224e13[_0x4391('0xc')];if(_['isNil'](channels[_0x224e13[_0x4391('0x27')]]['answertime'])){channels[_0x224e13['linkedid']][_0x4391('0x29')]=utils[_0x4391('0x26')]();}channels[_0x224e13[_0x4391('0x27')]][_0x4391('0x2a')]=dispositions[_[_0x4391('0x2b')](_0x224e13[_0x4391('0x24')])]||_0x4391('0x5');}}catch(_0x4afd6c){utils[_0x4391('0x20')](util['format'](_0x4391('0x2c'),_0x224e13['uniqueid']),_0x4afd6c);}};exports[_0x4391('0x2d')]=function(_0x11e3ae){try{if(!_[_0x4391('0x23')](channels[_0x11e3ae[_0x4391('0x8')]])){utils[_0x4391('0x19')](util[_0x4391('0xa')](_0x4391('0x2e'),_0x11e3ae[_0x4391('0x8')]),_0x11e3ae);if(_[_0x4391('0x23')](channels[_0x11e3ae[_0x4391('0x8')]][_0x4391('0x2f')])){channels[_0x11e3ae[_0x4391('0x8')]][_0x4391('0x2f')]=_0x11e3ae[_0x4391('0x30')]+'\x20<'+_0x11e3ae[_0x4391('0xf')]+'>';}utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x31'),_0x11e3ae['uniqueid'],channels[_0x11e3ae['uniqueid']][_0x4391('0x2f')],_0x11e3ae[_0x4391('0x32')]));channels[_0x11e3ae[_0x4391('0x8')]][_0x4391('0x33')]=utils[_0x4391('0x26')]();channels[_0x11e3ae[_0x4391('0x8')]][_0x4391('0x34')]=utils[_0x4391('0x35')](channels[_0x11e3ae['uniqueid']][_0x4391('0x33')],channels[_0x11e3ae['uniqueid']]['starttime']);channels[_0x11e3ae['uniqueid']]['billableseconds']=channels[_0x11e3ae[_0x4391('0x8')]][_0x4391('0x29')]?utils[_0x4391('0x35')](channels[_0x11e3ae[_0x4391('0x8')]]['endtime'],channels[_0x11e3ae['uniqueid']][_0x4391('0x29')]):0x0;writeDB(channels[_0x11e3ae['uniqueid']]);}}catch(_0x2818c2){utils[_0x4391('0x20')](util[_0x4391('0xa')](_0x4391('0x2e'),_0x11e3ae[_0x4391('0x8')]),_0x2818c2);}};exports[_0x4391('0x36')]=function(_0x4d5fb6){try{if(!_[_0x4391('0x23')](channels[_0x4d5fb6[_0x4391('0x37')]])){utils[_0x4391('0x19')](util[_0x4391('0xa')](_0x4391('0x38'),_0x4d5fb6[_0x4391('0x39')]),_0x4d5fb6);if(channels[_0x4d5fb6[_0x4391('0x37')]]['channel']==_0x4d5fb6[_0x4391('0x3a')]){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x3b'),_0x4d5fb6[_0x4391('0x39')],_0x4d5fb6[_0x4391('0x37')],_0x4d5fb6[_0x4391('0x3c')]));channels[_0x4d5fb6['localtwolinkedid']][_0x4391('0x3d')]=_0x4d5fb6['secondtransfererchannel'];channels[_0x4d5fb6[_0x4391('0x37')]][_0x4391('0x3e')]=_0x4391('0x3f');}else if(channels[_0x4d5fb6[_0x4391('0x37')]][_0x4391('0xc')]=_0x4d5fb6[_0x4391('0x40')]){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x3b'),_0x4d5fb6[_0x4391('0x39')],_0x4d5fb6[_0x4391('0x37')],_0x4d5fb6[_0x4391('0x41')]));channels[_0x4d5fb6[_0x4391('0x37')]]['destinationchannel']=_0x4d5fb6['origtransfererchannel'];channels[_0x4d5fb6[_0x4391('0x37')]][_0x4391('0x3e')]=_0x4391('0x3f');}}}catch(_0x3ea728){utils[_0x4391('0x20')](util[_0x4391('0xa')]('[%s][calls][attendedtransfer]',_0x4d5fb6[_0x4391('0x39')]),_0x3ea728);}};exports['musiconholdstart']=function(_0x2c225e){try{if(!_['isNil'](channels[_0x2c225e[_0x4391('0x8')]])){utils[_0x4391('0x19')](util[_0x4391('0xa')](_0x4391('0x42'),_0x2c225e[_0x4391('0x8')]),_0x2c225e);channels[_0x2c225e[_0x4391('0x8')]]['musiconholdstartAt']=utils[_0x4391('0x26')]();utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x43'),_0x2c225e[_0x4391('0x8')],channels[_0x2c225e[_0x4391('0x8')]][_0x4391('0x44')]));}}catch(_0x3e1fa0){utils[_0x4391('0x20')](util[_0x4391('0xa')](_0x4391('0x42'),_0x2c225e[_0x4391('0x8')]),_0x3e1fa0);}};exports[_0x4391('0x45')]=function(_0x53730d){try{if(!_[_0x4391('0x23')](channels[_0x53730d[_0x4391('0x8')]])){utils[_0x4391('0x19')](util['format'](_0x4391('0x46'),_0x53730d[_0x4391('0x8')]),_0x53730d);if(!_[_0x4391('0x23')](channels[_0x53730d['uniqueid']][_0x4391('0x44')])){channels[_0x53730d[_0x4391('0x8')]]['mohtime']+=utils[_0x4391('0x35')](utils[_0x4391('0x26')](),channels[_0x53730d[_0x4391('0x8')]][_0x4391('0x44')]);utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x47'),_0x53730d['uniqueid'],channels[_0x53730d[_0x4391('0x8')]][_0x4391('0x48')]));delete channels[_0x53730d[_0x4391('0x8')]][_0x4391('0x44')];}}}catch(_0x46b336){utils['error'](util[_0x4391('0xa')](_0x4391('0x46'),_0x53730d[_0x4391('0x8')]),_0x46b336);}};exports[_0x4391('0x49')]=function(_0x1e65b2){try{if(!_[_0x4391('0x23')](channels[_0x1e65b2['uniqueid']])){utils[_0x4391('0x19')](util['format'](_0x4391('0x4a'),_0x1e65b2[_0x4391('0x8')]),_0x1e65b2);if(!_['isNil'](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x4c')])){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x4d'),_0x1e65b2[_0x4391('0x8')],_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2[_0x4391('0x8')]]['source']=_0x1e65b2[_0x4391('0x4e')];}if(!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x4f')])){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x50'),_0x1e65b2['uniqueid'],_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2[_0x4391('0x8')]][_0x4391('0x51')]=_0x1e65b2[_0x4391('0x4e')];channels[_0x1e65b2[_0x4391('0x8')]][_0x4391('0x2f')]='\x22'+_0x1e65b2['value']+_0x4391('0x52')+_0x1e65b2[_0x4391('0x4e')]+'>';}if(!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x53')])||!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')]['xmd-callerid'])){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x54'),_0x1e65b2[_0x4391('0x8')],!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x53')])?_0x4391('0x53'):_0x4391('0x55'),_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2[_0x4391('0x8')]][_0x4391('0x2f')]=_0x1e65b2[_0x4391('0x4e')];}if(!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')]['xmd-queue'])||!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x56')])){utils[_0x4391('0x1b')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1e65b2[_0x4391('0x8')],!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x57')])?'xmd-queue':_0x4391('0x56'),_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2[_0x4391('0x8')]]['lastapplication']=_0x4391('0x58');channels[_0x1e65b2[_0x4391('0x8')]][_0x4391('0x59')]=_0x1e65b2[_0x4391('0x4e')];channels[_0x1e65b2['uniqueid']][_0x4391('0x5a')]=!![];}if(!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x5b')])){utils[_0x4391('0x1b')](util[_0x4391('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1e65b2[_0x4391('0x8')],_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2['uniqueid']]['ContactId']=_0x1e65b2['value'];}if(!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x5c')])){utils[_0x4391('0x1b')](util['format'](_0x4391('0x5d'),_0x1e65b2['uniqueid'],_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2['uniqueid']][_0x4391('0x5e')]=_0x1e65b2[_0x4391('0x4e')];}if(!_[_0x4391('0x23')](_0x1e65b2[_0x4391('0x4b')][_0x4391('0x5f')])){utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x60'),_0x1e65b2['uniqueid'],_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2[_0x4391('0x8')]][_0x4391('0x61')]=_0x1e65b2[_0x4391('0x4e')];}if(!_['isNil'](_0x1e65b2['variable'][_0x4391('0x62')])){utils[_0x4391('0x1b')](util[_0x4391('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1e65b2[_0x4391('0x8')],_0x1e65b2[_0x4391('0x4e')]));channels[_0x1e65b2[_0x4391('0x8')]][_0x4391('0x62')]=_0x1e65b2[_0x4391('0x4e')];}}}catch(_0x531f76){utils[_0x4391('0x20')](util[_0x4391('0xa')](_0x4391('0x4a'),_0x1e65b2[_0x4391('0x8')]),_0x531f76);}};exports[_0x4391('0x63')]=function(_0x53080c){try{if(!_[_0x4391('0x23')](channels[_0x53080c[_0x4391('0x8')]])){utils[_0x4391('0x19')](util[_0x4391('0xa')](_0x4391('0x64'),_0x53080c[_0x4391('0x8')]),_0x53080c);utils[_0x4391('0x1b')](util[_0x4391('0xa')](_0x4391('0x65'),_0x53080c[_0x4391('0x8')],_0x53080c[_0x4391('0x66')],_0x53080c['appdata']));if(_0x53080c['application'][_0x4391('0x67')]()==_0x4391('0x68')&&_[_0x4391('0x69')](_0x53080c[_0x4391('0x6a')]['toLowerCase'](),_0x4391('0x6b'))){var _0x111584=_0x53080c['appdata'][_0x4391('0x6c')]('=');var _0x5ab8e9=_0x111584[0x0]['substring'](_0x111584[0x0][_0x4391('0x6d')]('(')+0x1,_0x111584[0x0][_0x4391('0x6d')](')'));var _0x184b25=_0x111584[0x1];channels[_0x53080c[_0x4391('0x8')]][_0x5ab8e9]=_0x184b25;}if(!_[_0x4391('0x6e')]([_0x4391('0x2d'),'noop',_0x4391('0x6f'),_0x4391('0x68'),_0x4391('0x70')],_0x53080c[_0x4391('0x66')][_0x4391('0x67')]())){channels[_0x53080c[_0x4391('0x8')]][_0x4391('0x71')]=_0x53080c[_0x4391('0x66')];channels[_0x53080c[_0x4391('0x8')]][_0x4391('0x59')]=_0x53080c[_0x4391('0x6a')];}}}catch(_0x1ed862){utils[_0x4391('0x20')](util[_0x4391('0xa')](_0x4391('0x64'),_0x53080c[_0x4391('0x8')]),_0x1ed862);}}; \ No newline at end of file +var _0xff4c=['routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x7ba547,_0x1add51){var _0x240e44=function(_0x2196f9){while(--_0x2196f9){_0x7ba547['push'](_0x7ba547['shift']());}};_0x240e44(++_0x1add51);}(_0xff4c,0x167));var _0xcff4=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0xff4c[_0x56e0e8];return _0x2dab50;};'use strict';var _=require(_0xcff4('0x0'));var util=require(_0xcff4('0x1'));var utils=require('./utils');var transfers=require(_0xcff4('0x2'));var dispositions=['NO\x20ANSWER',_0xcff4('0x3'),_0xcff4('0x3'),'NO\x20ANSWER',_0xcff4('0x4'),_0xcff4('0x4'),_0xcff4('0x5'),_0xcff4('0x6'),_0xcff4('0x3'),'FAILED',_0xcff4('0x3')];var channels={};function writeDB(_0x37f75c){var _0x44c9fa;if(transfers[_0xcff4('0x7')][_0x37f75c[_0xcff4('0x8')]]){_0x44c9fa=_0x37f75c['uniqueid'];_0x37f75c[_0xcff4('0x8')]=transfers[_0xcff4('0x7')][_0x37f75c[_0xcff4('0x8')]][_0xcff4('0x9')];}utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0xc'),_0x37f75c['uniqueid'],_0x37f75c[_0xcff4('0xd')],_0x37f75c[_0xcff4('0xe')],_0x37f75c[_0xcff4('0xf')],_0x37f75c['interface'],_0x37f75c[_0xcff4('0x10')],_0x37f75c[_0xcff4('0x11')],_0x37f75c[_0xcff4('0x12')]));if(_0x37f75c[_0xcff4('0x13')]){utils[_0xcff4('0x14')](_0x37f75c['accountcode'])['then'](function(_0x12ee37){if(_0x12ee37){_0x37f75c[_0xcff4('0x15')]=_0x12ee37['id'];}utils['request']('CreateVoiceCallReport',_0x37f75c);});}else{utils[_0xcff4('0x16')](_0xcff4('0x17'),_0x37f75c);}if(channels[_0x37f75c[_0xcff4('0x8')]]){delete channels[_0x37f75c[_0xcff4('0x8')]];}else if(_0x44c9fa&&channels[_0x44c9fa]){if(!transfers[_0xcff4('0x7')][_0x44c9fa]['recording'])delete transfers['blinds'][_0x44c9fa];delete channels[_0x44c9fa];}}exports[_0xcff4('0x18')]=function(_0x628d54){try{utils[_0xcff4('0x19')](util[_0xcff4('0xb')](_0xcff4('0x1a'),_0x628d54[_0xcff4('0x8')]),_0x628d54);if(_0x628d54['uniqueid']==_0x628d54['linkedid']&&_0x628d54[_0xcff4('0xd')]!='OutgoingSpoolFailed'){utils['info'](util[_0xcff4('0xb')](_0xcff4('0x1b'),_0x628d54['uniqueid'],_0x628d54[_0xcff4('0x1c')],_0x628d54[_0xcff4('0x1d')]));channels[_0x628d54[_0xcff4('0x8')]]={'uniqueid':_0x628d54['uniqueid'],'accountcode':_0x628d54[_0xcff4('0x13')],'source':_0x628d54[_0xcff4('0x10')],'destination':_0x628d54[_0xcff4('0x1d')],'destinationcontext':_0x628d54[_0xcff4('0x1c')],'channel':_0x628d54['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcff4('0x4'),'amaflags':_0xcff4('0x1e')};}}catch(_0x3c6835){utils[_0xcff4('0x1f')](util[_0xcff4('0xb')](_0xcff4('0x1a'),_0x628d54[_0xcff4('0x8')]),_0x3c6835);}};exports['newstate']=function(_0x5acc7a){try{utils[_0xcff4('0x19')](util['format'](_0xcff4('0x20'),_0x5acc7a[_0xcff4('0x8')]),_0x5acc7a);if(!_[_0xcff4('0x21')](channels[_0x5acc7a[_0xcff4('0x8')]])&&_0x5acc7a[_0xcff4('0x22')]==0x6){utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x23'),_0x5acc7a['uniqueid'],_0x5acc7a['context'],_0x5acc7a['channel']));if(_[_0xcff4('0x21')](channels[_0x5acc7a[_0xcff4('0x8')]][_0xcff4('0x24')])){channels[_0x5acc7a[_0xcff4('0x8')]][_0xcff4('0x24')]=utils[_0xcff4('0x25')]();}}else if(!_['isNil'](channels[_0x5acc7a[_0xcff4('0x26')]])&&_0x5acc7a[_0xcff4('0x22')]==0x6&&_0x5acc7a['context']!=_0xcff4('0x27')){utils[_0xcff4('0xa')](util[_0xcff4('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5acc7a['uniqueid'],_0x5acc7a[_0xcff4('0x26')],_0x5acc7a[_0xcff4('0x1c')],_0x5acc7a[_0xcff4('0xd')]));channels[_0x5acc7a[_0xcff4('0x26')]]['accountcode']=_0x5acc7a[_0xcff4('0x13')];channels[_0x5acc7a[_0xcff4('0x26')]][_0xcff4('0x28')]=_0x5acc7a[_0xcff4('0xd')];if(_['isNil'](channels[_0x5acc7a['linkedid']][_0xcff4('0x29')])){channels[_0x5acc7a[_0xcff4('0x26')]]['answertime']=utils[_0xcff4('0x25')]();}channels[_0x5acc7a['linkedid']][_0xcff4('0x2a')]=dispositions[_[_0xcff4('0x2b')](_0x5acc7a[_0xcff4('0x22')])]||_0xcff4('0x5');}}catch(_0x495a86){utils[_0xcff4('0x1f')](util[_0xcff4('0xb')](_0xcff4('0x20'),_0x5acc7a[_0xcff4('0x8')]),_0x495a86);}};exports[_0xcff4('0x2c')]=function(_0x58d2e3){try{if(!_[_0xcff4('0x21')](channels[_0x58d2e3[_0xcff4('0x8')]])){utils['debug'](util['format'](_0xcff4('0x2d'),_0x58d2e3['uniqueid']),_0x58d2e3);if(_[_0xcff4('0x21')](channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x2e')])){channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x2e')]=_0x58d2e3['calleridname']+'\x20<'+_0x58d2e3['calleridnum']+'>';}utils[_0xcff4('0xa')](util['format'](_0xcff4('0x2f'),_0x58d2e3[_0xcff4('0x8')],channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x2e')],_0x58d2e3[_0xcff4('0x30')]));channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x31')]=utils[_0xcff4('0x25')]();channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x32')]=utils['diffTime'](channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x31')],channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x33')]);channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x34')]=channels[_0x58d2e3['uniqueid']][_0xcff4('0x29')]?utils[_0xcff4('0x35')](channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x31')],channels[_0x58d2e3[_0xcff4('0x8')]][_0xcff4('0x29')]):0x0;writeDB(channels[_0x58d2e3['uniqueid']]);}}catch(_0x30d9ae){utils['error'](util['format']('[%s][calls][hangup]',_0x58d2e3[_0xcff4('0x8')]),_0x30d9ae);}};exports[_0xcff4('0x36')]=function(_0x593564){try{if(!_[_0xcff4('0x21')](channels[_0x593564[_0xcff4('0x37')]])){utils[_0xcff4('0x19')](util['format'](_0xcff4('0x38'),_0x593564[_0xcff4('0x39')]),_0x593564);if(channels[_0x593564[_0xcff4('0x37')]][_0xcff4('0xd')]==_0x593564[_0xcff4('0x3a')]){utils['info'](util[_0xcff4('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x593564[_0xcff4('0x39')],_0x593564[_0xcff4('0x37')],_0x593564['secondtransfererchannel']));channels[_0x593564['localtwolinkedid']][_0xcff4('0x28')]=_0x593564[_0xcff4('0x3b')];channels[_0x593564[_0xcff4('0x37')]][_0xcff4('0x3c')]=_0xcff4('0x3d');}else if(channels[_0x593564['localtwolinkedid']][_0xcff4('0xd')]=_0x593564[_0xcff4('0x3e')]){utils[_0xcff4('0xa')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x593564[_0xcff4('0x39')],_0x593564[_0xcff4('0x37')],_0x593564[_0xcff4('0x3f')]));channels[_0x593564['localtwolinkedid']][_0xcff4('0x28')]=_0x593564[_0xcff4('0x3f')];channels[_0x593564[_0xcff4('0x37')]][_0xcff4('0x3c')]=_0xcff4('0x3d');}}}catch(_0x8ad6fc){utils[_0xcff4('0x1f')](util['format'](_0xcff4('0x38'),_0x593564[_0xcff4('0x39')]),_0x8ad6fc);}};exports[_0xcff4('0x40')]=function(_0x3f4e24){try{if(!_['isNil'](channels[_0x3f4e24['uniqueid']])){utils[_0xcff4('0x19')](util['format'](_0xcff4('0x41'),_0x3f4e24['uniqueid']),_0x3f4e24);channels[_0x3f4e24[_0xcff4('0x8')]][_0xcff4('0x42')]=utils[_0xcff4('0x25')]();utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x43'),_0x3f4e24[_0xcff4('0x8')],channels[_0x3f4e24[_0xcff4('0x8')]][_0xcff4('0x42')]));}}catch(_0x390257){utils[_0xcff4('0x1f')](util['format'](_0xcff4('0x41'),_0x3f4e24[_0xcff4('0x8')]),_0x390257);}};exports[_0xcff4('0x44')]=function(_0x369aae){try{if(!_[_0xcff4('0x21')](channels[_0x369aae[_0xcff4('0x8')]])){utils['debug'](util[_0xcff4('0xb')](_0xcff4('0x45'),_0x369aae[_0xcff4('0x8')]),_0x369aae);if(!_['isNil'](channels[_0x369aae['uniqueid']][_0xcff4('0x42')])){channels[_0x369aae[_0xcff4('0x8')]][_0xcff4('0x46')]+=utils[_0xcff4('0x35')](utils['now'](),channels[_0x369aae[_0xcff4('0x8')]][_0xcff4('0x42')]);utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x47'),_0x369aae[_0xcff4('0x8')],channels[_0x369aae['uniqueid']][_0xcff4('0x46')]));delete channels[_0x369aae[_0xcff4('0x8')]][_0xcff4('0x42')];}}}catch(_0xabdfc){utils[_0xcff4('0x1f')](util[_0xcff4('0xb')](_0xcff4('0x45'),_0x369aae[_0xcff4('0x8')]),_0xabdfc);}};exports[_0xcff4('0x48')]=function(_0x1e82fa){try{if(!_[_0xcff4('0x21')](channels[_0x1e82fa['uniqueid']])){utils[_0xcff4('0x19')](util[_0xcff4('0xb')](_0xcff4('0x49'),_0x1e82fa['uniqueid']),_0x1e82fa);if(!_[_0xcff4('0x21')](_0x1e82fa['variable'][_0xcff4('0x4a')])){utils[_0xcff4('0xa')](util['format'](_0xcff4('0x4b'),_0x1e82fa[_0xcff4('0x8')],_0x1e82fa[_0xcff4('0x4c')]));channels[_0x1e82fa[_0xcff4('0x8')]][_0xcff4('0x4d')]=_0x1e82fa[_0xcff4('0x4c')];}if(!_[_0xcff4('0x21')](_0x1e82fa['variable'][_0xcff4('0x4e')])){utils['info'](util[_0xcff4('0xb')](_0xcff4('0x4f'),_0x1e82fa['uniqueid'],_0x1e82fa['value']));channels[_0x1e82fa[_0xcff4('0x8')]][_0xcff4('0x50')]=_0x1e82fa[_0xcff4('0x4c')];channels[_0x1e82fa[_0xcff4('0x8')]][_0xcff4('0x2e')]='\x22'+_0x1e82fa['value']+_0xcff4('0x51')+_0x1e82fa[_0xcff4('0x4c')]+'>';}if(!_['isNil'](_0x1e82fa[_0xcff4('0x52')][_0xcff4('0x53')])||!_['isNil'](_0x1e82fa[_0xcff4('0x52')][_0xcff4('0x54')])){utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x55'),_0x1e82fa[_0xcff4('0x8')],!_[_0xcff4('0x21')](_0x1e82fa[_0xcff4('0x52')][_0xcff4('0x53')])?'xmd-callerid-preview':_0xcff4('0x54'),_0x1e82fa[_0xcff4('0x4c')]));channels[_0x1e82fa[_0xcff4('0x8')]]['callerid']=_0x1e82fa[_0xcff4('0x4c')];}if(!_[_0xcff4('0x21')](_0x1e82fa[_0xcff4('0x52')][_0xcff4('0x56')])||!_['isNil'](_0x1e82fa[_0xcff4('0x52')]['xmcs-queue'])){utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x55'),_0x1e82fa['uniqueid'],!_['isNil'](_0x1e82fa['variable'][_0xcff4('0x56')])?_0xcff4('0x56'):_0xcff4('0x57'),_0x1e82fa['value']));channels[_0x1e82fa['uniqueid']][_0xcff4('0x58')]=_0xcff4('0x59');channels[_0x1e82fa[_0xcff4('0x8')]][_0xcff4('0x5a')]=_0x1e82fa[_0xcff4('0x4c')];channels[_0x1e82fa['uniqueid']][_0xcff4('0xe')]=!![];}if(!_[_0xcff4('0x21')](_0x1e82fa[_0xcff4('0x52')]['xmd-contactid'])){utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x5b'),_0x1e82fa[_0xcff4('0x8')],_0x1e82fa[_0xcff4('0x4c')]));channels[_0x1e82fa[_0xcff4('0x8')]]['ContactId']=_0x1e82fa['value'];}if(!_[_0xcff4('0x21')](_0x1e82fa[_0xcff4('0x52')][_0xcff4('0x5c')])){utils[_0xcff4('0xa')](util['format'](_0xcff4('0x5d'),_0x1e82fa[_0xcff4('0x8')],_0x1e82fa[_0xcff4('0x4c')]));channels[_0x1e82fa['uniqueid']][_0xcff4('0x5e')]=_0x1e82fa[_0xcff4('0x4c')];}if(!_['isNil'](_0x1e82fa[_0xcff4('0x52')][_0xcff4('0x5f')])){utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x60'),_0x1e82fa[_0xcff4('0x8')],_0x1e82fa[_0xcff4('0x4c')]));channels[_0x1e82fa['uniqueid']][_0xcff4('0x61')]=_0x1e82fa[_0xcff4('0x4c')];}if(!_[_0xcff4('0x21')](_0x1e82fa[_0xcff4('0x52')][_0xcff4('0x62')])){utils['info'](util[_0xcff4('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1e82fa['uniqueid'],_0x1e82fa['value']));channels[_0x1e82fa[_0xcff4('0x8')]][_0xcff4('0x62')]=_0x1e82fa['value'];}}}catch(_0xaf64b){utils[_0xcff4('0x1f')](util[_0xcff4('0xb')](_0xcff4('0x49'),_0x1e82fa[_0xcff4('0x8')]),_0xaf64b);}};exports[_0xcff4('0x63')]=function(_0x2e5986){try{if(!_[_0xcff4('0x21')](channels[_0x2e5986['uniqueid']])){utils[_0xcff4('0x19')](util[_0xcff4('0xb')](_0xcff4('0x64'),_0x2e5986[_0xcff4('0x8')]),_0x2e5986);utils[_0xcff4('0xa')](util[_0xcff4('0xb')](_0xcff4('0x65'),_0x2e5986[_0xcff4('0x8')],_0x2e5986[_0xcff4('0x66')],_0x2e5986[_0xcff4('0x67')]));if(_0x2e5986['application'][_0xcff4('0x68')]()==_0xcff4('0x69')&&_[_0xcff4('0x6a')](_0x2e5986[_0xcff4('0x67')][_0xcff4('0x68')](),_0xcff4('0x6b'))){var _0x5da65f=_0x2e5986['appdata'][_0xcff4('0x6c')]('=');var _0x140427=_0x5da65f[0x0][_0xcff4('0x6d')](_0x5da65f[0x0][_0xcff4('0x6e')]('(')+0x1,_0x5da65f[0x0][_0xcff4('0x6e')](')'));var _0x8bd25e=_0x5da65f[0x1];channels[_0x2e5986[_0xcff4('0x8')]][_0x140427]=_0x8bd25e;}if(!_[_0xcff4('0x6f')]([_0xcff4('0x2c'),_0xcff4('0x70'),'execif',_0xcff4('0x69'),_0xcff4('0x71')],_0x2e5986[_0xcff4('0x66')][_0xcff4('0x68')]())){channels[_0x2e5986[_0xcff4('0x8')]][_0xcff4('0x58')]=_0x2e5986[_0xcff4('0x66')];channels[_0x2e5986['uniqueid']][_0xcff4('0x5a')]=_0x2e5986[_0xcff4('0x67')];}}}catch(_0x20ca89){utils[_0xcff4('0x1f')](util[_0xcff4('0xb')]('[%s][calls][newexten]',_0x2e5986[_0xcff4('0x8')]),_0x20ca89);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9ae408d..3b35977 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 _0x34e1=['close','[core]\x20close','connect','info','[core]\x20connected','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x3b4b9e,_0x2acc39){var _0x3f516d=function(_0x414168){while(--_0x414168){_0x3b4b9e['push'](_0x3b4b9e['shift']());}};_0x3f516d(++_0x2acc39);}(_0x34e1,0x17c));var _0x134e=function(_0x68b38d,_0x2fb9ef){_0x68b38d=_0x68b38d-0x0;var _0x5b59d5=_0x34e1[_0x68b38d];return _0x5b59d5;};'use strict';var utils=require('./utils');exports[_0x134e('0x0')]=function(){utils[_0x134e('0x1')](_0x134e('0x2'));};exports['shutdown']=function(){utils[_0x134e('0x1')](_0x134e('0x3'));};exports['fullybooted']=function(){utils[_0x134e('0x1')](_0x134e('0x4'));};exports[_0x134e('0x5')]=function(_0x321140){utils['error'](_0x134e('0x6'),_0x321140);};exports[_0x134e('0x7')]=function(){utils[_0x134e('0x1')](_0x134e('0x8'));};exports['managerevent']=function(_0x47b16c){}; \ No newline at end of file +var _0xa580=['./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x235294,_0x41e4d5){var _0x1ab65d=function(_0x5bde71){while(--_0x5bde71){_0x235294['push'](_0x235294['shift']());}};_0x1ab65d(++_0x41e4d5);}(_0xa580,0x8f));var _0x0a58=function(_0x1882b7,_0x3c087a){_0x1882b7=_0x1882b7-0x0;var _0xb6c818=_0xa580[_0x1882b7];return _0xb6c818;};'use strict';var utils=require(_0x0a58('0x0'));exports[_0x0a58('0x1')]=function(){utils[_0x0a58('0x2')](_0x0a58('0x3'));};exports['shutdown']=function(){utils[_0x0a58('0x2')](_0x0a58('0x4'));};exports[_0x0a58('0x5')]=function(){utils['info'](_0x0a58('0x6'));};exports[_0x0a58('0x7')]=function(_0x14d5ee){utils['error'](_0x0a58('0x8'),_0x14d5ee);};exports[_0x0a58('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0x0a58('0xa')]=function(_0x4caf48){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0328264..e7e4226 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 _0xac95=['info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','uniqueid','application','appdata','toLowerCase','set','startsWith','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','[%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','assign','duration','diffTime','endtime','holdtime','answertime','billableseconds','lodash','util','./utils'];(function(_0x6c7cb2,_0x220f0e){var _0x4c8a09=function(_0x3cc19c){while(--_0x3cc19c){_0x6c7cb2['push'](_0x6c7cb2['shift']());}};_0x4c8a09(++_0x220f0e);}(_0xac95,0x69));var _0x5ac9=function(_0x23ef22,_0x2e5af6){_0x23ef22=_0x23ef22-0x0;var _0x5b85d2=_0xac95[_0x23ef22];return _0x5b85d2;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var utils=require(_0x5ac9('0x2'));var dials={};function writeDB(_0x364ff3){utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x5'),_0x364ff3['uniqueid'],_0x364ff3[_0x5ac9('0x6')],_0x364ff3[_0x5ac9('0x7')],_0x364ff3['calleridnum'],_0x364ff3[_0x5ac9('0x8')],_0x364ff3[_0x5ac9('0x9')]));utils[_0x5ac9('0xa')](_0x5ac9('0xb'),_0x364ff3);delete dials[_0x364ff3['uniqueid']];}exports[_0x5ac9('0xc')]=function(_0x382a47){try{utils[_0x5ac9('0xd')](util['format'](_0x5ac9('0xe'),_0x382a47['uniqueid']),_0x382a47);utils['info'](util[_0x5ac9('0x4')](_0x5ac9('0xf'),_0x382a47[_0x5ac9('0x10')],_0x382a47[_0x5ac9('0x11')],_0x382a47[_0x5ac9('0x12')]));if(_0x382a47[_0x5ac9('0x11')][_0x5ac9('0x13')]()==_0x5ac9('0x14')&&_[_0x5ac9('0x15')](_0x382a47[_0x5ac9('0x12')][_0x5ac9('0x13')](),'cdr(routeid)')){var _0x160a44=_0x382a47[_0x5ac9('0x12')]['split']('=');dials[_0x382a47[_0x5ac9('0x10')]]={'routeId':_0x160a44[0x1]};}}catch(_0x1026e5){utils[_0x5ac9('0x16')](util['format'](_0x5ac9('0xe'),_0x382a47[_0x5ac9('0x10')]),_0x1026e5);}};exports[_0x5ac9('0x17')]=function(_0x538376){try{utils[_0x5ac9('0xd')](util[_0x5ac9('0x4')](_0x5ac9('0x18'),_0x538376['uniqueid']),_0x538376);if(!_['isNil'](_0x538376[_0x5ac9('0x19')][_0x5ac9('0x1a')])){utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x1b'),_0x538376['uniqueid'],_0x538376[_0x5ac9('0x1c')]));dials[_0x538376[_0x5ac9('0x10')]]={'routeId':_0x538376[_0x5ac9('0x1c')]};}}catch(_0x2aa2c5){utils[_0x5ac9('0x16')](util['format'](_0x5ac9('0x18'),_0x538376[_0x5ac9('0x10')]),_0x2aa2c5);}};exports[_0x5ac9('0x1d')]=function(_0x50e0ca){try{if(!_[_0x5ac9('0x1e')](dials[_0x50e0ca[_0x5ac9('0x10')]])){utils['debug'](util[_0x5ac9('0x4')](_0x5ac9('0x1f'),_0x50e0ca['uniqueid']),_0x50e0ca);dials[_0x50e0ca['uniqueid']]=_['assign'](dials[_0x50e0ca[_0x5ac9('0x10')]],_0x50e0ca);dials[_0x50e0ca[_0x5ac9('0x10')]]['starttime']=utils[_0x5ac9('0x20')]();dials[_0x50e0ca['uniqueid']][_0x5ac9('0x21')]=_0x5ac9('0x22');utils[_0x5ac9('0x3')](util['format'](_0x5ac9('0x23'),_0x50e0ca[_0x5ac9('0x10')],dials[_0x50e0ca[_0x5ac9('0x10')]][_0x5ac9('0x24')]));}}catch(_0x5218b){utils[_0x5ac9('0x16')](util['format'](_0x5ac9('0x1f'),_0x50e0ca[_0x5ac9('0x10')]),_0x5218b);}};exports[_0x5ac9('0x25')]=function(_0x32aa8d){try{if(!_[_0x5ac9('0x1e')](dials[_0x32aa8d[_0x5ac9('0x10')]])){utils[_0x5ac9('0xd')](util[_0x5ac9('0x4')]('[%s][dials][dialend]',_0x32aa8d[_0x5ac9('0x10')]),_0x32aa8d);dials[_0x32aa8d['uniqueid']][_0x5ac9('0x9')]=_0x32aa8d[_0x5ac9('0x9')];if(_0x32aa8d[_0x5ac9('0x9')]==_0x5ac9('0x26')){dials[_0x32aa8d[_0x5ac9('0x10')]]=_['assign'](dials[_0x32aa8d['uniqueid']],_0x32aa8d);dials[_0x32aa8d['uniqueid']]['answertime']=utils['now']();dials[_0x32aa8d[_0x5ac9('0x10')]][_0x5ac9('0x21')]='connect';utils[_0x5ac9('0x3')](util['format'](_0x5ac9('0x27'),_0x32aa8d[_0x5ac9('0x10')],_0x32aa8d[_0x5ac9('0x9')],dials[_0x32aa8d[_0x5ac9('0x10')]]['answertime']));}else{utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x28'),_0x32aa8d[_0x5ac9('0x10')],_0x32aa8d[_0x5ac9('0x9')]));}}}catch(_0x3ee2b5){utils[_0x5ac9('0x16')](util[_0x5ac9('0x4')]('[%s][dials][dialend]',_0x32aa8d[_0x5ac9('0x10')]),_0x3ee2b5);}};exports[_0x5ac9('0x29')]=function(_0x195936){try{if(!_[_0x5ac9('0x1e')](dials[_0x195936[_0x5ac9('0x10')]])){utils[_0x5ac9('0xd')](util[_0x5ac9('0x4')](_0x5ac9('0x2a'),_0x195936[_0x5ac9('0x10')]),_0x195936);utils[_0x5ac9('0x3')](util[_0x5ac9('0x4')](_0x5ac9('0x2b'),_0x195936[_0x5ac9('0x10')],_0x195936[_0x5ac9('0x2c')],_0x195936[_0x5ac9('0x2d')],_0x195936[_0x5ac9('0x2e')]));dials[_0x195936[_0x5ac9('0x10')]]=_[_0x5ac9('0x2f')](dials[_0x195936[_0x5ac9('0x10')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x30')]=utils[_0x5ac9('0x31')](dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x32')],dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x24')]);dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x33')]=utils[_0x5ac9('0x31')](dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x34')]||dials[_0x195936['uniqueid']]['endtime'],dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x24')]);dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x35')]=dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x34')]?utils['diffTime'](dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x32')],dials[_0x195936[_0x5ac9('0x10')]][_0x5ac9('0x34')]):0x0;writeDB(dials[_0x195936[_0x5ac9('0x10')]]);}}catch(_0x33a938){utils[_0x5ac9('0x16')](util[_0x5ac9('0x4')](_0x5ac9('0x2a'),_0x195936['uniqueid']),_0x33a938);}}; \ No newline at end of file +var _0xb83a=['dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','[%s][dials][newexten]','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','dialend','[%s][dials][dialend]','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','calleridname','complete','duration','endtime','diffTime','billableseconds','lodash','util','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum'];(function(_0x27e6ad,_0x32631d){var _0x255944=function(_0x173181){while(--_0x173181){_0x27e6ad['push'](_0x27e6ad['shift']());}};_0x255944(++_0x32631d);}(_0xb83a,0x187));var _0xab83=function(_0x3f5d63,_0x2fc7a0){_0x3f5d63=_0x3f5d63-0x0;var _0x49c8da=_0xb83a[_0x3f5d63];return _0x49c8da;};'use strict';var _=require(_0xab83('0x0'));var util=require(_0xab83('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x20bd2f){utils[_0xab83('0x2')](util[_0xab83('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x20bd2f[_0xab83('0x4')],_0x20bd2f[_0xab83('0x5')],_0x20bd2f[_0xab83('0x6')],_0x20bd2f[_0xab83('0x7')],_0x20bd2f[_0xab83('0x8')],_0x20bd2f[_0xab83('0x9')]));utils[_0xab83('0xa')](_0xab83('0xb'),_0x20bd2f);delete dials[_0x20bd2f['uniqueid']];}exports[_0xab83('0xc')]=function(_0x221d24){try{utils[_0xab83('0xd')](util['format']('[%s][dials][newexten]',_0x221d24['uniqueid']),_0x221d24);utils[_0xab83('0x2')](util[_0xab83('0x3')](_0xab83('0xe'),_0x221d24[_0xab83('0x4')],_0x221d24[_0xab83('0xf')],_0x221d24[_0xab83('0x10')]));if(_0x221d24[_0xab83('0xf')][_0xab83('0x11')]()==_0xab83('0x12')&&_[_0xab83('0x13')](_0x221d24['appdata'][_0xab83('0x11')](),_0xab83('0x14'))){var _0x31dd39=_0x221d24['appdata'][_0xab83('0x15')]('=');dials[_0x221d24['uniqueid']]={'routeId':_0x31dd39[0x1]};}}catch(_0x354528){utils['error'](util['format'](_0xab83('0x16'),_0x221d24[_0xab83('0x4')]),_0x354528);}};exports['varset']=function(_0xe99117){try{utils[_0xab83('0xd')](util[_0xab83('0x3')](_0xab83('0x17'),_0xe99117[_0xab83('0x4')]),_0xe99117);if(!_[_0xab83('0x18')](_0xe99117[_0xab83('0x19')][_0xab83('0x1a')])){utils['info'](util[_0xab83('0x3')](_0xab83('0x1b'),_0xe99117[_0xab83('0x4')],_0xe99117[_0xab83('0x1c')]));dials[_0xe99117['uniqueid']]={'routeId':_0xe99117[_0xab83('0x1c')]};}}catch(_0x3f69ab){utils[_0xab83('0x1d')](util['format'](_0xab83('0x17'),_0xe99117['uniqueid']),_0x3f69ab);}};exports[_0xab83('0x1e')]=function(_0x5b5437){try{if(!_[_0xab83('0x18')](dials[_0x5b5437[_0xab83('0x4')]])){utils[_0xab83('0xd')](util[_0xab83('0x3')](_0xab83('0x1f'),_0x5b5437['uniqueid']),_0x5b5437);dials[_0x5b5437[_0xab83('0x4')]]=_[_0xab83('0x20')](dials[_0x5b5437[_0xab83('0x4')]],_0x5b5437);dials[_0x5b5437[_0xab83('0x4')]][_0xab83('0x21')]=utils['now']();dials[_0x5b5437[_0xab83('0x4')]][_0xab83('0x22')]=_0xab83('0x23');utils[_0xab83('0x2')](util[_0xab83('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x5b5437[_0xab83('0x4')],dials[_0x5b5437[_0xab83('0x4')]][_0xab83('0x21')]));}}catch(_0x192a06){utils[_0xab83('0x1d')](util[_0xab83('0x3')](_0xab83('0x1f'),_0x5b5437[_0xab83('0x4')]),_0x192a06);}};exports[_0xab83('0x24')]=function(_0x1c939c){try{if(!_[_0xab83('0x18')](dials[_0x1c939c['uniqueid']])){utils[_0xab83('0xd')](util['format'](_0xab83('0x25'),_0x1c939c[_0xab83('0x4')]),_0x1c939c);dials[_0x1c939c[_0xab83('0x4')]]['dialstatus']=_0x1c939c[_0xab83('0x9')];if(_0x1c939c[_0xab83('0x9')]=='ANSWER'){dials[_0x1c939c[_0xab83('0x4')]]=_['assign'](dials[_0x1c939c[_0xab83('0x4')]],_0x1c939c);dials[_0x1c939c[_0xab83('0x4')]][_0xab83('0x26')]=utils[_0xab83('0x27')]();dials[_0x1c939c[_0xab83('0x4')]]['lastevent']=_0xab83('0x28');utils[_0xab83('0x2')](util['format'](_0xab83('0x29'),_0x1c939c[_0xab83('0x4')],_0x1c939c['dialstatus'],dials[_0x1c939c['uniqueid']]['answertime']));}else{utils[_0xab83('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x1c939c[_0xab83('0x4')],_0x1c939c['dialstatus']));}}}catch(_0x4a7bef){utils['error'](util[_0xab83('0x3')](_0xab83('0x25'),_0x1c939c[_0xab83('0x4')]),_0x4a7bef);}};exports[_0xab83('0x2a')]=function(_0x254d3a){try{if(!_['isNil'](dials[_0x254d3a[_0xab83('0x4')]])){utils[_0xab83('0xd')](util['format'](_0xab83('0x2b'),_0x254d3a[_0xab83('0x4')]),_0x254d3a);utils[_0xab83('0x2')](util[_0xab83('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x254d3a['uniqueid'],_0x254d3a[_0xab83('0x7')],_0x254d3a[_0xab83('0x2c')],_0x254d3a['cause-txt']));dials[_0x254d3a[_0xab83('0x4')]]=_['assign'](dials[_0x254d3a[_0xab83('0x4')]],{'endtime':utils['now'](),'lastevent':_0xab83('0x2d')});dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x2e')]=utils['diffTime'](dials[_0x254d3a['uniqueid']][_0xab83('0x2f')],dials[_0x254d3a[_0xab83('0x4')]]['starttime']);dials[_0x254d3a['uniqueid']]['holdtime']=utils[_0xab83('0x30')](dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x26')]||dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x2f')],dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x21')]);dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x31')]=dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x26')]?utils[_0xab83('0x30')](dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x2f')],dials[_0x254d3a[_0xab83('0x4')]][_0xab83('0x26')]):0x0;writeDB(dials[_0x254d3a[_0xab83('0x4')]]);}}catch(_0x5d2549){utils[_0xab83('0x1d')](util[_0xab83('0x3')](_0xab83('0x2b'),_0x254d3a[_0xab83('0x4')]),_0x5d2549);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a2b012b..762a9f1 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 _0xb9d2=['disabled','env','local','asterisk','port','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','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','xdr'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xb9d2,0x1e0));var _0x2b9d=function(_0x6cfbf6,_0x594cf1){_0x6cfbf6=_0x6cfbf6-0x0;var _0x537202=_0xb9d2[_0x6cfbf6];return _0x537202;};var AsteriskManager=require(_0x2b9d('0x0'));var config=require(_0x2b9d('0x1'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0x2b9d('0x2')]&&config['xdr'][_0x2b9d('0x3')]?!config['xdr'][_0x2b9d('0x3')]:!![];var isProduction=config[_0x2b9d('0x4')]==='production'||![];var isLocalAsterisk=config[_0x2b9d('0x2')]&&config[_0x2b9d('0x2')][_0x2b9d('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x2b9d('0x6')][_0x2b9d('0x7')],config[_0x2b9d('0x6')]['ip'],config[_0x2b9d('0x6')]['username'],config[_0x2b9d('0x6')][_0x2b9d('0x8')],!![]);ami[_0x2b9d('0x9')]();if(!isXDREnabled){utils['info'](_0x2b9d('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x2b9d('0xb')](_0x2b9d('0xc'));}else{var agents=require(_0x2b9d('0xd'));var calls=require('./calls.controller');var queues=require(_0x2b9d('0xe'));var recordings=require(_0x2b9d('0xf'));var members=require(_0x2b9d('0x10'));var dials=require(_0x2b9d('0x11'));var transfers=require('./transfers.controller');var core=require(_0x2b9d('0x12'));ami['on']('connect',core[_0x2b9d('0x13')]);ami['on'](_0x2b9d('0x14'),core['shutdown']);ami['on'](_0x2b9d('0x15'),core[_0x2b9d('0x15')]);ami['on'](_0x2b9d('0x16'),core[_0x2b9d('0x16')]);ami['on'](_0x2b9d('0x17'),core[_0x2b9d('0x17')]);ami['on'](_0x2b9d('0x18'),core[_0x2b9d('0x18')]);ami['on'](_0x2b9d('0x19'),function(_0x55fd4a){try{utils['debug'](util['format']('[%s][index][devicestatechange]',_0x55fd4a[_0x2b9d('0x1a')]),_0x55fd4a);members['devicestatechange'](_0x55fd4a);}catch(_0x4dd76b){utils[_0x2b9d('0x16')](util['format']('[%s][index][devicestatechange]',_0x55fd4a[_0x2b9d('0x1a')]),_0x4dd76b);}});ami['on'](_0x2b9d('0x1b'),function(_0x495749){try{utils['debug'](util[_0x2b9d('0x1c')](_0x2b9d('0x1d'),_0x495749[_0x2b9d('0x1e')]),_0x495749);agents['agentcalled'](_0x495749);}catch(_0x7300c2){utils['error'](util[_0x2b9d('0x1c')](_0x2b9d('0x1d'),_0x495749[_0x2b9d('0x1e')]),_0x7300c2);}});ami['on'](_0x2b9d('0x1f'),function(_0x36f1ac){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x21'),_0x36f1ac[_0x2b9d('0x1e')]),_0x36f1ac);agents[_0x2b9d('0x1f')](_0x36f1ac);}catch(_0x3502f3){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')](_0x2b9d('0x21'),_0x36f1ac[_0x2b9d('0x1e')]),_0x3502f3);}});ami['on'](_0x2b9d('0x22'),function(_0x504928){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x23'),_0x504928[_0x2b9d('0x1e')]),_0x504928);agents[_0x2b9d('0x22')](_0x504928);queues[_0x2b9d('0x22')](_0x504928);}catch(_0x4c948d){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')]('[%s][index][agentconnect]',_0x504928[_0x2b9d('0x1e')]),_0x4c948d);}});ami['on'](_0x2b9d('0x24'),function(_0xad7f92){try{utils['debug'](util['format'](_0x2b9d('0x25'),_0xad7f92['uniqueid']),_0xad7f92);agents['agentcomplete'](_0xad7f92);queues[_0x2b9d('0x24')](_0xad7f92);members['agentcomplete'](_0xad7f92);}catch(_0x114ab2){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')]('[%s][index][agentcomplete]',_0xad7f92[_0x2b9d('0x1e')]),_0x114ab2);}});ami['on'](_0x2b9d('0x26'),function(_0x1599a8){try{utils['debug'](util['format'](_0x2b9d('0x27'),_0x1599a8[_0x2b9d('0x1e')]),_0x1599a8);agents[_0x2b9d('0x26')](_0x1599a8);queues[_0x2b9d('0x26')](_0x1599a8);}catch(_0x315d69){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')](_0x2b9d('0x27'),_0x1599a8[_0x2b9d('0x1e')]),_0x315d69);}});ami['on'](_0x2b9d('0x28'),function(_0x552e4f){try{utils['debug'](util['format'](_0x2b9d('0x29'),_0x552e4f[_0x2b9d('0x1e')]),_0x552e4f);queues[_0x2b9d('0x28')](_0x552e4f);recordings[_0x2b9d('0x28')](_0x552e4f);}catch(_0x19fb4b){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')](_0x2b9d('0x29'),_0x552e4f[_0x2b9d('0x1e')]),_0x19fb4b);}});ami['on']('queuecallerleave',function(_0x31db51){try{utils['debug'](util['format'](_0x2b9d('0x2a'),_0x31db51[_0x2b9d('0x1e')]),_0x31db51);queues['queuecallerleave'](_0x31db51);}catch(_0x129708){utils[_0x2b9d('0x16')](util['format'](_0x2b9d('0x2a'),_0x31db51[_0x2b9d('0x1e')]),_0x129708);}});ami['on'](_0x2b9d('0x2b'),function(_0x319301){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x2c'),_0x319301[_0x2b9d('0x1e')]),_0x319301);queues[_0x2b9d('0x2b')](_0x319301);calls[_0x2b9d('0x2b')](_0x319301);}catch(_0x93f2a6){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')](_0x2b9d('0x2c'),_0x319301[_0x2b9d('0x1e')]),_0x93f2a6);}});ami['on'](_0x2b9d('0x2d'),function(_0x4ba051){try{utils['debug'](util[_0x2b9d('0x1c')](_0x2b9d('0x2e'),_0x4ba051[_0x2b9d('0x1e')]),_0x4ba051);queues['musiconholdstop'](_0x4ba051);calls['musiconholdstop'](_0x4ba051);}catch(_0x40ef36){utils['error'](util[_0x2b9d('0x1c')](_0x2b9d('0x2e'),_0x4ba051[_0x2b9d('0x1e')]),_0x40ef36);}});ami['on']('newstate',function(_0x5345a5){try{utils['debug'](util[_0x2b9d('0x1c')](_0x2b9d('0x2f'),_0x5345a5[_0x2b9d('0x1e')]),_0x5345a5);calls[_0x2b9d('0x30')](_0x5345a5);recordings['newstate'](_0x5345a5);}catch(_0x41c2cd){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')]('[%s][index][newstate]',_0x5345a5['uniqueid']),_0x41c2cd);}});ami['on'](_0x2b9d('0x31'),function(_0x45d77c){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x32'),_0x45d77c[_0x2b9d('0x1e')]),_0x45d77c);calls[_0x2b9d('0x31')](_0x45d77c);recordings[_0x2b9d('0x31')](_0x45d77c);dials['hangup'](_0x45d77c);agents[_0x2b9d('0x31')](_0x45d77c);queues[_0x2b9d('0x31')](_0x45d77c);}catch(_0x211c76){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')]('[%s][index][hangup]',_0x45d77c[_0x2b9d('0x1e')]),_0x211c76);}});ami['on']('cdr',function(_0x117165){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x33'),_0x117165[_0x2b9d('0x1e')]),_0x117165);members[_0x2b9d('0x34')](_0x117165);}catch(_0xd8ed7e){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')]('[%s][index][cdr]',_0x117165[_0x2b9d('0x1e')]),_0xd8ed7e);}});ami['on'](_0x2b9d('0x35'),function(_0x3504b0){try{utils['debug'](util[_0x2b9d('0x1c')]('[%s][index][blindtransfer]',_0x3504b0[_0x2b9d('0x1e')]),_0x3504b0);queues[_0x2b9d('0x35')](_0x3504b0);agents[_0x2b9d('0x35')](_0x3504b0);transfers[_0x2b9d('0x35')](_0x3504b0);recordings[_0x2b9d('0x35')](_0x3504b0);}catch(_0x7764b7){utils[_0x2b9d('0x16')](util['format'](_0x2b9d('0x36'),_0x3504b0[_0x2b9d('0x1e')]),_0x7764b7);}});ami['on'](_0x2b9d('0x37'),function(_0x19a1e6){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x38'),_0x19a1e6[_0x2b9d('0x39')]),_0x19a1e6);queues[_0x2b9d('0x37')](_0x19a1e6);transfers[_0x2b9d('0x37')](_0x19a1e6);agents['attendedtransfer'](_0x19a1e6);calls['attendedtransfer'](_0x19a1e6);}catch(_0x4fa1f8){utils[_0x2b9d('0x16')](util['format'](_0x2b9d('0x38'),_0x19a1e6[_0x2b9d('0x39')]),_0x4fa1f8);}});ami['on'](_0x2b9d('0x3a'),function(_0x594b52){try{utils['debug'](util[_0x2b9d('0x1c')](_0x2b9d('0x3b'),_0x594b52[_0x2b9d('0x1e')]),_0x594b52);queues[_0x2b9d('0x3a')](_0x594b52);recordings[_0x2b9d('0x3a')](_0x594b52);calls['varset'](_0x594b52);dials[_0x2b9d('0x3a')](_0x594b52);}catch(_0x4ae592){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')](_0x2b9d('0x3b'),_0x594b52[_0x2b9d('0x1e')]),_0x4ae592);}});ami['on'](_0x2b9d('0x3c'),function(_0x3b4e2c){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x3d'),_0x3b4e2c[_0x2b9d('0x1e')]),_0x3b4e2c);calls[_0x2b9d('0x3c')](_0x3b4e2c);recordings[_0x2b9d('0x3c')](_0x3b4e2c);dials[_0x2b9d('0x3c')](_0x3b4e2c);}catch(_0xae6429){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')]('[%s][index][newexten]',_0x3b4e2c[_0x2b9d('0x1e')]),_0xae6429);}});ami['on'](_0x2b9d('0x3e'),function(_0x2d1c1d){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x3f'),_0x2d1c1d[_0x2b9d('0x1e')]),_0x2d1c1d);calls[_0x2b9d('0x3e')](_0x2d1c1d);recordings['newchannel'](_0x2d1c1d);}catch(_0x3066df){utils['error'](util[_0x2b9d('0x1c')](_0x2b9d('0x3f'),_0x2d1c1d['uniqueid']),_0x3066df);}});ami['on'](_0x2b9d('0x40'),function(_0x3108d7){try{utils['debug'](util['format'](_0x2b9d('0x41'),_0x3108d7[_0x2b9d('0x1e')]),_0x3108d7);dials[_0x2b9d('0x40')](_0x3108d7);}catch(_0x421b4e){utils['error'](util[_0x2b9d('0x1c')](_0x2b9d('0x42'),_0x3108d7[_0x2b9d('0x1e')]),_0x421b4e);}});ami['on'](_0x2b9d('0x43'),function(_0xa1586){try{utils[_0x2b9d('0x20')](util[_0x2b9d('0x1c')](_0x2b9d('0x44'),_0xa1586[_0x2b9d('0x1e')]),_0xa1586);dials[_0x2b9d('0x43')](_0xa1586);}catch(_0x4e30b8){utils[_0x2b9d('0x16')](util[_0x2b9d('0x1c')]('[%s][index][dialend]',_0xa1586[_0x2b9d('0x1e')]),_0x4e30b8);}});} \ No newline at end of file +var _0x8d4e=['./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%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][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','port','asterisk','username','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller'];(function(_0x35447a,_0x326b96){var _0x1126a5=function(_0x1c445a){while(--_0x1c445a){_0x35447a['push'](_0x35447a['shift']());}};_0x1126a5(++_0x326b96);}(_0x8d4e,0x13b));var _0xe8d4=function(_0x50fd62,_0x15c351){_0x50fd62=_0x50fd62-0x0;var _0x5208b0=_0x8d4e[_0x50fd62];return _0x5208b0;};var AsteriskManager=require(_0xe8d4('0x0'));var config=require(_0xe8d4('0x1'));var utils=require(_0xe8d4('0x2'));var util=require(_0xe8d4('0x3'));var isXDREnabled=config[_0xe8d4('0x4')]&&config['xdr'][_0xe8d4('0x5')]?!config['xdr'][_0xe8d4('0x5')]:!![];var isProduction=config['env']===_0xe8d4('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0xe8d4('0x4')][_0xe8d4('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xe8d4('0x8')],config['asterisk']['ip'],config[_0xe8d4('0x9')][_0xe8d4('0xa')],config[_0xe8d4('0x9')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0xe8d4('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xe8d4('0xc'));var recordings=require(_0xe8d4('0xd'));var members=require(_0xe8d4('0xe'));var dials=require('./dials.controller');var transfers=require(_0xe8d4('0xf'));var core=require(_0xe8d4('0x10'));ami['on']('connect',core[_0xe8d4('0x11')]);ami['on'](_0xe8d4('0x12'),core[_0xe8d4('0x12')]);ami['on'](_0xe8d4('0x13'),core[_0xe8d4('0x13')]);ami['on'](_0xe8d4('0x14'),core[_0xe8d4('0x14')]);ami['on']('close',core[_0xe8d4('0x15')]);ami['on']('managerevent',core[_0xe8d4('0x16')]);ami['on']('devicestatechange',function(_0x5c6188){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x19'),_0x5c6188[_0xe8d4('0x1a')]),_0x5c6188);members[_0xe8d4('0x1b')](_0x5c6188);}catch(_0x135d5f){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')]('[%s][index][devicestatechange]',_0x5c6188[_0xe8d4('0x1a')]),_0x135d5f);}});ami['on'](_0xe8d4('0x1c'),function(_0x295672){try{utils[_0xe8d4('0x17')](util['format'](_0xe8d4('0x1d'),_0x295672['uniqueid']),_0x295672);agents[_0xe8d4('0x1c')](_0x295672);}catch(_0x4629bd){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')](_0xe8d4('0x1d'),_0x295672[_0xe8d4('0x1e')]),_0x4629bd);}});ami['on'](_0xe8d4('0x1f'),function(_0x178c37){try{utils[_0xe8d4('0x17')](util['format']('[%s][index][agentringnoanswer]',_0x178c37[_0xe8d4('0x1e')]),_0x178c37);agents[_0xe8d4('0x1f')](_0x178c37);}catch(_0xa21544){utils['error'](util[_0xe8d4('0x18')](_0xe8d4('0x20'),_0x178c37[_0xe8d4('0x1e')]),_0xa21544);}});ami['on'](_0xe8d4('0x21'),function(_0x193776){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x22'),_0x193776['uniqueid']),_0x193776);agents['agentconnect'](_0x193776);queues[_0xe8d4('0x21')](_0x193776);}catch(_0x176edd){utils[_0xe8d4('0x14')](util['format']('[%s][index][agentconnect]',_0x193776['uniqueid']),_0x176edd);}});ami['on'](_0xe8d4('0x23'),function(_0xa56848){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x24'),_0xa56848[_0xe8d4('0x1e')]),_0xa56848);agents[_0xe8d4('0x23')](_0xa56848);queues[_0xe8d4('0x23')](_0xa56848);members[_0xe8d4('0x23')](_0xa56848);}catch(_0xcedc8b){utils[_0xe8d4('0x14')](util['format']('[%s][index][agentcomplete]',_0xa56848[_0xe8d4('0x1e')]),_0xcedc8b);}});ami['on'](_0xe8d4('0x25'),function(_0x2cac63){try{utils['debug'](util['format'](_0xe8d4('0x26'),_0x2cac63[_0xe8d4('0x1e')]),_0x2cac63);agents[_0xe8d4('0x25')](_0x2cac63);queues['queuecallerabandon'](_0x2cac63);}catch(_0x5e3046){utils['error'](util[_0xe8d4('0x18')](_0xe8d4('0x26'),_0x2cac63['uniqueid']),_0x5e3046);}});ami['on'](_0xe8d4('0x27'),function(_0x5975da){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x28'),_0x5975da['uniqueid']),_0x5975da);queues[_0xe8d4('0x27')](_0x5975da);recordings[_0xe8d4('0x27')](_0x5975da);}catch(_0x445279){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')](_0xe8d4('0x28'),_0x5975da[_0xe8d4('0x1e')]),_0x445279);}});ami['on']('queuecallerleave',function(_0x2a0d3c){try{utils['debug'](util[_0xe8d4('0x18')]('[%s][index][queuecallerleave]',_0x2a0d3c[_0xe8d4('0x1e')]),_0x2a0d3c);queues[_0xe8d4('0x29')](_0x2a0d3c);}catch(_0x567664){utils['error'](util[_0xe8d4('0x18')](_0xe8d4('0x2a'),_0x2a0d3c[_0xe8d4('0x1e')]),_0x567664);}});ami['on'](_0xe8d4('0x2b'),function(_0x374f9b){try{utils['debug'](util[_0xe8d4('0x18')](_0xe8d4('0x2c'),_0x374f9b[_0xe8d4('0x1e')]),_0x374f9b);queues['musiconholdstart'](_0x374f9b);calls[_0xe8d4('0x2b')](_0x374f9b);}catch(_0x7d3485){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')](_0xe8d4('0x2c'),_0x374f9b[_0xe8d4('0x1e')]),_0x7d3485);}});ami['on'](_0xe8d4('0x2d'),function(_0x586d1d){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x2e'),_0x586d1d[_0xe8d4('0x1e')]),_0x586d1d);queues[_0xe8d4('0x2d')](_0x586d1d);calls[_0xe8d4('0x2d')](_0x586d1d);}catch(_0x5d7904){utils['error'](util[_0xe8d4('0x18')](_0xe8d4('0x2e'),_0x586d1d[_0xe8d4('0x1e')]),_0x5d7904);}});ami['on'](_0xe8d4('0x2f'),function(_0x5c0451){try{utils[_0xe8d4('0x17')](util['format'](_0xe8d4('0x30'),_0x5c0451[_0xe8d4('0x1e')]),_0x5c0451);calls[_0xe8d4('0x2f')](_0x5c0451);recordings[_0xe8d4('0x2f')](_0x5c0451);}catch(_0xcf707a){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')](_0xe8d4('0x30'),_0x5c0451[_0xe8d4('0x1e')]),_0xcf707a);}});ami['on'](_0xe8d4('0x31'),function(_0x501f01){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')]('[%s][index][hangup]',_0x501f01[_0xe8d4('0x1e')]),_0x501f01);calls[_0xe8d4('0x31')](_0x501f01);recordings[_0xe8d4('0x31')](_0x501f01);dials[_0xe8d4('0x31')](_0x501f01);agents[_0xe8d4('0x31')](_0x501f01);queues['hangup'](_0x501f01);}catch(_0x3a84f1){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')]('[%s][index][hangup]',_0x501f01['uniqueid']),_0x3a84f1);}});ami['on']('cdr',function(_0xbb344b){try{utils['debug'](util['format'](_0xe8d4('0x32'),_0xbb344b[_0xe8d4('0x1e')]),_0xbb344b);members['cdr'](_0xbb344b);}catch(_0xf8b9c0){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')]('[%s][index][cdr]',_0xbb344b[_0xe8d4('0x1e')]),_0xf8b9c0);}});ami['on'](_0xe8d4('0x33'),function(_0x58a86c){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0x58a86c['uniqueid']),_0x58a86c);queues[_0xe8d4('0x33')](_0x58a86c);agents[_0xe8d4('0x33')](_0x58a86c);transfers[_0xe8d4('0x33')](_0x58a86c);recordings[_0xe8d4('0x33')](_0x58a86c);}catch(_0x2807b5){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')](_0xe8d4('0x34'),_0x58a86c[_0xe8d4('0x1e')]),_0x2807b5);}});ami['on'](_0xe8d4('0x35'),function(_0x24744b){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')]('[%s][index][attendedtransfer]',_0x24744b['origtransfereruniqueid']),_0x24744b);queues[_0xe8d4('0x35')](_0x24744b);transfers[_0xe8d4('0x35')](_0x24744b);agents[_0xe8d4('0x35')](_0x24744b);calls[_0xe8d4('0x35')](_0x24744b);}catch(_0xdce8f){utils[_0xe8d4('0x14')](util['format'](_0xe8d4('0x36'),_0x24744b['origtransfereruniqueid']),_0xdce8f);}});ami['on'](_0xe8d4('0x37'),function(_0x54b7fb){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x38'),_0x54b7fb['uniqueid']),_0x54b7fb);queues['varset'](_0x54b7fb);recordings[_0xe8d4('0x37')](_0x54b7fb);calls['varset'](_0x54b7fb);dials[_0xe8d4('0x37')](_0x54b7fb);}catch(_0x382c7a){utils[_0xe8d4('0x14')](util['format'](_0xe8d4('0x38'),_0x54b7fb[_0xe8d4('0x1e')]),_0x382c7a);}});ami['on']('newexten',function(_0x2794f3){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')]('[%s][index][newexten]',_0x2794f3[_0xe8d4('0x1e')]),_0x2794f3);calls[_0xe8d4('0x39')](_0x2794f3);recordings[_0xe8d4('0x39')](_0x2794f3);dials['newexten'](_0x2794f3);}catch(_0x5bca4c){utils['error'](util[_0xe8d4('0x18')](_0xe8d4('0x3a'),_0x2794f3[_0xe8d4('0x1e')]),_0x5bca4c);}});ami['on']('newchannel',function(_0xcbebe9){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x3b'),_0xcbebe9[_0xe8d4('0x1e')]),_0xcbebe9);calls[_0xe8d4('0x3c')](_0xcbebe9);recordings[_0xe8d4('0x3c')](_0xcbebe9);}catch(_0x2457be){utils['error'](util[_0xe8d4('0x18')]('[%s][index][newchannel]',_0xcbebe9[_0xe8d4('0x1e')]),_0x2457be);}});ami['on'](_0xe8d4('0x3d'),function(_0x26b775){try{utils[_0xe8d4('0x17')](util[_0xe8d4('0x18')](_0xe8d4('0x3e'),_0x26b775[_0xe8d4('0x1e')]),_0x26b775);dials['dialbegin'](_0x26b775);}catch(_0x284931){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')](_0xe8d4('0x3f'),_0x26b775['uniqueid']),_0x284931);}});ami['on']('dialend',function(_0x30e5de){try{utils['debug'](util[_0xe8d4('0x18')](_0xe8d4('0x40'),_0x30e5de['uniqueid']),_0x30e5de);dials[_0xe8d4('0x41')](_0x30e5de);}catch(_0x3cd9a9){utils[_0xe8d4('0x14')](util[_0xe8d4('0x18')](_0xe8d4('0x40'),_0x30e5de[_0xe8d4('0x1e')]),_0x3cd9a9);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c591d81..dbed7bb 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 _0x88cc=['agent','NOT_INUSE','now','duration','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','data1','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','isNil','source','[%s][members][cdr]','lodash','util','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','type','getUserByInterface','then','name','internal','getUserByName','split','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING'];(function(_0x5a107a,_0xde1538){var _0x1a2752=function(_0x37a9ff){while(--_0x37a9ff){_0x5a107a['push'](_0x5a107a['shift']());}};_0x1a2752(++_0xde1538);}(_0x88cc,0x1bd));var _0xc88c=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0x88cc[_0x59522a];return _0x30f09d;};'use strict';var _=require(_0xc88c('0x0'));var util=require(_0xc88c('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0xc88c('0x2')];function writeDB(_0x1a53ed){utils['info'](util[_0xc88c('0x3')](_0xc88c('0x4'),_0x1a53ed['uniqueid'],_0x1a53ed[_0xc88c('0x5')],_0x1a53ed[_0xc88c('0x6')],_0x1a53ed['data2'],_0x1a53ed[_0xc88c('0x7')],_0x1a53ed[_0xc88c('0x8')]));if(_0x1a53ed['interface']){utils[_0xc88c('0x9')](_0x1a53ed[_0xc88c('0x5')])[_0xc88c('0xa')](function(_0x4c8e70){if(_0x4c8e70){_0x1a53ed[_0xc88c('0x7')]=_0x4c8e70[_0xc88c('0xb')];_0x1a53ed[_0xc88c('0xc')]=_0x4c8e70[_0xc88c('0xc')];utils['request']('CreateMemberReport',_0x1a53ed);}else{utils[_0xc88c('0xd')](_0x1a53ed[_0xc88c('0x5')][_0xc88c('0xe')]('/')[0x1])[_0xc88c('0xa')](function(_0xef87c7){if(_0xef87c7){_0x1a53ed[_0xc88c('0x7')]=_0xef87c7[_0xc88c('0xb')];_0x1a53ed[_0xc88c('0xc')]=_0xef87c7[_0xc88c('0xc')];utils['request'](_0xc88c('0xf'),_0x1a53ed);}});}})['catch'](function(_0x1b2db6){utils[_0xc88c('0x10')](util[_0xc88c('0x3')](_0xc88c('0x11'),_0x1a53ed[_0xc88c('0x12')]),_0x1b2db6);});}delete members[_0x1a53ed[_0xc88c('0x5')]];}function startsWith(_0x903542,_0x45bb3b){return _[_0xc88c('0x13')](_0x903542,function(_0x2d7f87){return _[_0xc88c('0x14')](_0x45bb3b,_0x2d7f87);});}exports[_0xc88c('0x15')]=function(_0x2e70bc){try{utils[_0xc88c('0x16')](util[_0xc88c('0x3')](_0xc88c('0x17'),members[_0x2e70bc[_0xc88c('0x18')]]?members[_0x2e70bc['device']][_0xc88c('0x12')]:_0x2e70bc[_0xc88c('0x18')]),_0x2e70bc);utils[_0xc88c('0x19')](util[_0xc88c('0x3')](_0xc88c('0x1a'),members[_0x2e70bc[_0xc88c('0x18')]]?members[_0x2e70bc[_0xc88c('0x18')]][_0xc88c('0x12')]:_0x2e70bc['device'],_0x2e70bc[_0xc88c('0x1b')],_0x2e70bc[_0xc88c('0x18')]));switch(_0x2e70bc['state']){case _0xc88c('0x1c'):case _0xc88c('0x1d'):if(!startsWith(exclude,_0x2e70bc['device'])){members[_0x2e70bc[_0xc88c('0x18')]]={'channel':_0xc88c('0x1e'),'interface':_0x2e70bc['device'],'type':_0xc88c('0x1f'),'enterAt':utils['now'](),'role':_0xc88c('0x20')};}break;case _0xc88c('0x21'):if(!_['isNil'](members[_0x2e70bc[_0xc88c('0x18')]])){members[_0x2e70bc[_0xc88c('0x18')]]['exitAt']=utils[_0xc88c('0x22')]();members[_0x2e70bc['device']][_0xc88c('0x23')]=utils[_0xc88c('0x24')](members[_0x2e70bc['device']][_0xc88c('0x25')],members[_0x2e70bc[_0xc88c('0x18')]][_0xc88c('0x26')]);if(members[_0x2e70bc[_0xc88c('0x18')]][_0xc88c('0x12')]){writeDB(members[_0x2e70bc[_0xc88c('0x18')]]);}}break;default:break;}}catch(_0x116ff4){utils[_0xc88c('0x10')](util[_0xc88c('0x3')]('[%s][members][devicestatechange]',members[_0x2e70bc[_0xc88c('0x18')]]?members[_0x2e70bc[_0xc88c('0x18')]][_0xc88c('0x12')]:_0x2e70bc[_0xc88c('0x18')]),_0x116ff4);}};exports[_0xc88c('0x27')]=function(_0x536065){try{if(!_['isNil'](members[_0x536065[_0xc88c('0x5')]])){utils[_0xc88c('0x16')](util['format'](_0xc88c('0x28'),_0x536065['uniqueid']),_0x536065);utils['info'](util[_0xc88c('0x3')](_0xc88c('0x29'),_0x536065[_0xc88c('0x12')],_0x536065[_0xc88c('0x5')],_0x536065[_0xc88c('0x2a')]));members[_0x536065[_0xc88c('0x5')]]=_['assign'](members[_0x536065['interface']],{'data4':_0x536065[_0xc88c('0x2a')],'uniqueid':_0x536065['uniqueid']});}}catch(_0x3fb6a6){utils['error'](util[_0xc88c('0x3')](_0xc88c('0x28'),_0x536065['uniqueid']),_0x3fb6a6);}};exports['cdr']=function(_0x522d1){try{utils[_0xc88c('0x16')](util['format']('[%s][members][cdr]',_0x522d1[_0xc88c('0x12')]),_0x522d1);if(_0x522d1['channel']){var _0x53f378=_0x522d1[_0xc88c('0x6')][_0xc88c('0xe')]('-')[0x0];if(!_['isNil'](members[_0x53f378])){members[_0x53f378]=_[_0xc88c('0x2b')](members[_0x53f378],{'data1':members[_0x53f378][_0xc88c('0x2c')]||_0x522d1[_0xc88c('0x8')],'data2':members[_0x53f378][_0xc88c('0x2d')]||_0x522d1['source'],'data3':members[_0x53f378][_0xc88c('0x2e')]||_0x522d1[_0xc88c('0x2f')],'uniqueid':members[_0x53f378][_0xc88c('0x12')]||_0x522d1[_0xc88c('0x12')]});utils[_0xc88c('0x19')](util[_0xc88c('0x3')](_0xc88c('0x30'),_0x522d1[_0xc88c('0x12')],members[_0x53f378][_0xc88c('0x2c')],members[_0x53f378][_0xc88c('0x2d')],members[_0x53f378]['data3']));if(members[_0x53f378][_0xc88c('0x25')]){writeDB(members[_0x53f378]);}}}if(_0x522d1[_0xc88c('0x31')]){var _0x301a6c=_0x522d1[_0xc88c('0x31')][_0xc88c('0xe')]('-')[0x0];if(!_[_0xc88c('0x32')](members[_0x301a6c])){members[_0x301a6c]=_[_0xc88c('0x2b')](members[_0x301a6c],{'data1':members[_0x301a6c][_0xc88c('0x2c')]||_0x522d1[_0xc88c('0x8')],'data2':members[_0x301a6c][_0xc88c('0x2d')]||_0x522d1[_0xc88c('0x33')],'data3':members[_0x301a6c][_0xc88c('0x2e')]||_0x522d1['destination'],'uniqueid':members[_0x301a6c][_0xc88c('0x12')]||_0x522d1[_0xc88c('0x12')]});utils['info'](util[_0xc88c('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x522d1['uniqueid'],members[_0x301a6c][_0xc88c('0x2c')],members[_0x301a6c][_0xc88c('0x2d')],members[_0x301a6c][_0xc88c('0x2e')]));if(members[_0x301a6c][_0xc88c('0x25')]){writeDB(members[_0x301a6c]);}}}}catch(_0x20e615){utils[_0xc88c('0x10')](util[_0xc88c('0x3')](_0xc88c('0x34'),_0x522d1[_0xc88c('0x12')]),_0x20e615);}}; \ No newline at end of file +var _0x1816=['getUserByName','then','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','split','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','util','./utils','Queue:','info','format','uniqueid','interface','data2','membername','type','name','internal','request','CreateMemberReport'];(function(_0x512514,_0x4d9933){var _0x1614bf=function(_0x29b8f5){while(--_0x29b8f5){_0x512514['push'](_0x512514['shift']());}};_0x1614bf(++_0x4d9933);}(_0x1816,0x15e));var _0x6181=function(_0x1bb882,_0x5c23a4){_0x1bb882=_0x1bb882-0x0;var _0x39712f=_0x1816[_0x1bb882];return _0x39712f;};'use strict';var _=require('lodash');var util=require(_0x6181('0x0'));var utils=require(_0x6181('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x6181('0x2')];function writeDB(_0x42e41e){utils[_0x6181('0x3')](util[_0x6181('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x42e41e[_0x6181('0x5')],_0x42e41e[_0x6181('0x6')],_0x42e41e['channel'],_0x42e41e[_0x6181('0x7')],_0x42e41e[_0x6181('0x8')],_0x42e41e[_0x6181('0x9')]));if(_0x42e41e[_0x6181('0x6')]){utils['getUserByInterface'](_0x42e41e[_0x6181('0x6')])['then'](function(_0x2964d7){if(_0x2964d7){_0x42e41e[_0x6181('0x8')]=_0x2964d7[_0x6181('0xa')];_0x42e41e[_0x6181('0xb')]=_0x2964d7[_0x6181('0xb')];utils[_0x6181('0xc')](_0x6181('0xd'),_0x42e41e);}else{utils[_0x6181('0xe')](_0x42e41e[_0x6181('0x6')]['split']('/')[0x1])[_0x6181('0xf')](function(_0xe0252){if(_0xe0252){_0x42e41e[_0x6181('0x8')]=_0xe0252[_0x6181('0xa')];_0x42e41e[_0x6181('0xb')]=_0xe0252['internal'];utils[_0x6181('0xc')](_0x6181('0xd'),_0x42e41e);}});}})[_0x6181('0x10')](function(_0x546e59){utils[_0x6181('0x11')](util['format'](_0x6181('0x12'),_0x42e41e[_0x6181('0x5')]),_0x546e59);});}delete members[_0x42e41e[_0x6181('0x6')]];}function startsWith(_0x204003,_0x254e87){return _['some'](_0x204003,function(_0x12988c){return _[_0x6181('0x13')](_0x254e87,_0x12988c);});}exports[_0x6181('0x14')]=function(_0x53da42){try{utils[_0x6181('0x15')](util[_0x6181('0x4')](_0x6181('0x16'),members[_0x53da42['device']]?members[_0x53da42[_0x6181('0x17')]]['uniqueid']:_0x53da42[_0x6181('0x17')]),_0x53da42);utils[_0x6181('0x3')](util[_0x6181('0x4')](_0x6181('0x18'),members[_0x53da42['device']]?members[_0x53da42[_0x6181('0x17')]][_0x6181('0x5')]:_0x53da42[_0x6181('0x17')],_0x53da42[_0x6181('0x19')],_0x53da42[_0x6181('0x17')]));switch(_0x53da42[_0x6181('0x19')]){case _0x6181('0x1a'):case _0x6181('0x1b'):if(!startsWith(exclude,_0x53da42[_0x6181('0x17')])){members[_0x53da42[_0x6181('0x17')]]={'channel':_0x6181('0x1c'),'interface':_0x53da42[_0x6181('0x17')],'type':_0x6181('0x1d'),'enterAt':utils[_0x6181('0x1e')](),'role':_0x6181('0x1f')};}break;case _0x6181('0x20'):if(!_[_0x6181('0x21')](members[_0x53da42['device']])){members[_0x53da42[_0x6181('0x17')]][_0x6181('0x22')]=utils[_0x6181('0x1e')]();members[_0x53da42['device']][_0x6181('0x23')]=utils[_0x6181('0x24')](members[_0x53da42[_0x6181('0x17')]]['exitAt'],members[_0x53da42[_0x6181('0x17')]][_0x6181('0x25')]);if(members[_0x53da42[_0x6181('0x17')]]['uniqueid']){writeDB(members[_0x53da42[_0x6181('0x17')]]);}}break;default:break;}}catch(_0x3453a3){utils['error'](util[_0x6181('0x4')](_0x6181('0x16'),members[_0x53da42['device']]?members[_0x53da42[_0x6181('0x17')]][_0x6181('0x5')]:_0x53da42[_0x6181('0x17')]),_0x3453a3);}};exports[_0x6181('0x26')]=function(_0xc46ba5){try{if(!_[_0x6181('0x21')](members[_0xc46ba5[_0x6181('0x6')]])){utils[_0x6181('0x15')](util['format'](_0x6181('0x27'),_0xc46ba5['uniqueid']),_0xc46ba5);utils[_0x6181('0x3')](util[_0x6181('0x4')](_0x6181('0x28'),_0xc46ba5['uniqueid'],_0xc46ba5[_0x6181('0x6')],_0xc46ba5['queue']));members[_0xc46ba5[_0x6181('0x6')]]=_[_0x6181('0x29')](members[_0xc46ba5[_0x6181('0x6')]],{'data4':_0xc46ba5[_0x6181('0x2a')],'uniqueid':_0xc46ba5['uniqueid']});}}catch(_0x46af63){utils['error'](util[_0x6181('0x4')](_0x6181('0x27'),_0xc46ba5[_0x6181('0x5')]),_0x46af63);}};exports[_0x6181('0x2b')]=function(_0x5a6b94){try{utils[_0x6181('0x15')](util['format'](_0x6181('0x2c'),_0x5a6b94[_0x6181('0x5')]),_0x5a6b94);if(_0x5a6b94['channel']){var _0x2fe691=_0x5a6b94['channel'][_0x6181('0x2d')]('-')[0x0];if(!_[_0x6181('0x21')](members[_0x2fe691])){members[_0x2fe691]=_['assign'](members[_0x2fe691],{'data1':members[_0x2fe691][_0x6181('0x2e')]||_0x5a6b94[_0x6181('0x9')],'data2':members[_0x2fe691][_0x6181('0x7')]||_0x5a6b94['source'],'data3':members[_0x2fe691][_0x6181('0x2f')]||_0x5a6b94[_0x6181('0x30')],'uniqueid':members[_0x2fe691][_0x6181('0x5')]||_0x5a6b94[_0x6181('0x5')]});utils[_0x6181('0x3')](util['format'](_0x6181('0x31'),_0x5a6b94[_0x6181('0x5')],members[_0x2fe691][_0x6181('0x2e')],members[_0x2fe691][_0x6181('0x7')],members[_0x2fe691][_0x6181('0x2f')]));if(members[_0x2fe691][_0x6181('0x22')]){writeDB(members[_0x2fe691]);}}}if(_0x5a6b94['destinationchannel']){var _0x4cb96b=_0x5a6b94[_0x6181('0x32')][_0x6181('0x2d')]('-')[0x0];if(!_[_0x6181('0x21')](members[_0x4cb96b])){members[_0x4cb96b]=_[_0x6181('0x29')](members[_0x4cb96b],{'data1':members[_0x4cb96b]['data1']||_0x5a6b94[_0x6181('0x9')],'data2':members[_0x4cb96b]['data2']||_0x5a6b94[_0x6181('0x33')],'data3':members[_0x4cb96b][_0x6181('0x2f')]||_0x5a6b94['destination'],'uniqueid':members[_0x4cb96b][_0x6181('0x5')]||_0x5a6b94[_0x6181('0x5')]});utils[_0x6181('0x3')](util[_0x6181('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5a6b94[_0x6181('0x5')],members[_0x4cb96b][_0x6181('0x2e')],members[_0x4cb96b][_0x6181('0x7')],members[_0x4cb96b][_0x6181('0x2f')]));if(members[_0x4cb96b][_0x6181('0x22')]){writeDB(members[_0x4cb96b]);}}}}catch(_0x48d0e9){utils['error'](util['format'](_0x6181('0x2c'),_0x5a6b94[_0x6181('0x5')]),_0x48d0e9);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4c3ec44..a578004 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 _0xf218=['[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave'];(function(_0x469770,_0x21e77c){var _0x480f5=function(_0xd37e2){while(--_0xd37e2){_0x469770['push'](_0x469770['shift']());}};_0x480f5(++_0x21e77c);}(_0xf218,0x1f3));var _0x8f21=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0xf218[_0x1559a5];return _0x17a783;};'use strict';var _=require(_0x8f21('0x0'));var util=require(_0x8f21('0x1'));var utils=require(_0x8f21('0x2'));var queues={};function writeDB(_0x36c541){utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x5'),_0x36c541[_0x8f21('0x6')],_0x36c541[_0x8f21('0x7')],_0x36c541[_0x8f21('0x8')],_0x36c541[_0x8f21('0x9')],_0x36c541[_0x8f21('0xa')],_0x36c541['accountcode'],_0x36c541[_0x8f21('0xb')]));if(_0x36c541[_0x8f21('0x8')]){utils[_0x8f21('0xc')](_0x36c541[_0x8f21('0x8')])[_0x8f21('0xd')](function(_0x38705c){if(_0x38705c){_0x36c541[_0x8f21('0xe')]=_0x38705c[_0x8f21('0xe')];}utils[_0x8f21('0xf')](_0x8f21('0x10'),_0x36c541);});}else{utils['request'](_0x8f21('0x10'),_0x36c541);}if(_0x36c541[_0x8f21('0x11')]){delete queues[_0x36c541['transfereduniqueid']];}else{delete queues[_0x36c541[_0x8f21('0x6')]];}}exports['queuecallerjoin']=function(_0x410df0){try{utils[_0x8f21('0x12')](util[_0x8f21('0x4')]('[%s][queues][queuecallerjoin]',_0x410df0['uniqueid']),_0x410df0);utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x13'),_0x410df0['uniqueid'],_0x410df0[_0x8f21('0x8')],_0x410df0[_0x8f21('0x14')]));queues[_0x410df0['uniqueid']]=_[_0x8f21('0x15')](_0x410df0,{'originalposition':_0x410df0[_0x8f21('0x14')],'queuecallerjoinAt':utils[_0x8f21('0x16')](),'mohtime':0x0});}catch(_0x2f1f89){utils[_0x8f21('0x17')](util[_0x8f21('0x4')](_0x8f21('0x18'),_0x410df0[_0x8f21('0x6')]),_0x2f1f89);}};exports[_0x8f21('0x19')]=function(_0x5a6db3){try{if(!_[_0x8f21('0x1a')](queues[_0x5a6db3[_0x8f21('0x6')]])){utils['debug'](util[_0x8f21('0x4')](_0x8f21('0x1b'),_0x5a6db3[_0x8f21('0x6')]),_0x5a6db3);if(queues[_0x5a6db3[_0x8f21('0x6')]]['queuecallerleaveAt']){if(!queues[_0x5a6db3[_0x8f21('0x6')]]['queuecallerabandon']&&!queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0x1c')]){queues[_0x5a6db3['uniqueid']][_0x8f21('0x1d')]=!![];queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0x1e')]=utils[_0x8f21('0x16')]();queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0xb')]=_0x8f21('0x1f');}utils[_0x8f21('0x3')](util[_0x8f21('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5a6db3[_0x8f21('0x6')],queues[_0x5a6db3[_0x8f21('0x6')]]['name'],queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0xb')]));writeDB(queues[_0x5a6db3['uniqueid']]);}else if(queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0x11')]){utils[_0x8f21('0x3')](util['format'](_0x8f21('0x20'),_0x5a6db3['uniqueid'],queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0x21')],queues[_0x5a6db3['uniqueid']]['transfereduniqueid']));queues[queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0x11')]]=queues[_0x5a6db3['uniqueid']];queues[queues[_0x5a6db3[_0x8f21('0x6')]][_0x8f21('0x11')]]['queuecallerenterreason']=0x2;delete queues[_0x5a6db3[_0x8f21('0x6')]];}}}catch(_0xed5ad){utils[_0x8f21('0x17')](util[_0x8f21('0x4')](_0x8f21('0x1b'),_0x5a6db3['uniqueid']),_0xed5ad);}};exports[_0x8f21('0x22')]=function(_0x4f054d){try{utils[_0x8f21('0x12')](util[_0x8f21('0x4')](_0x8f21('0x23'),_0x4f054d['uniqueid']),_0x4f054d);if(!_[_0x8f21('0x1a')](_0x4f054d[_0x8f21('0x24')][_0x8f21('0x25')])&&_0x4f054d[_0x8f21('0x26')][_0x8f21('0x27')]()!==_0x8f21('0x28')){if(!_[_0x8f21('0x1a')](queues[_0x4f054d[_0x8f21('0x6')]])){queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x29')]=![];queues[_0x4f054d[_0x8f21('0x6')]]['queuecallerabandonAt']=null;queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x1c')]=!![];queues[_0x4f054d[_0x8f21('0x6')]]['queuecallerexitAt']=utils[_0x8f21('0x16')]();queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0xb')]=_0x4f054d[_0x8f21('0x26')]['toUpperCase']();utils[_0x8f21('0x3')](util[_0x8f21('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4f054d[_0x8f21('0x6')],queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x21')],_0x4f054d[_0x8f21('0x26')],queues[_0x4f054d['uniqueid']][_0x8f21('0xb')]));writeDB(queues[_0x4f054d[_0x8f21('0x6')]]);}}else if(!_[_0x8f21('0x1a')](_0x4f054d['variable'][_0x8f21('0x2a')])){if(!_[_0x8f21('0x1a')](queues[_0x4f054d[_0x8f21('0x6')]])&&!queues[_0x4f054d['uniqueid']]['queuecallerabandon']){queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x29')]=![];queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x2b')]=null;queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x1c')]=!![];queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x2c')]=utils['now']();queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0xb')]=_0x8f21('0x2d');utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x2e'),_0x4f054d[_0x8f21('0x6')],queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0x21')],_0x4f054d['value'],queues[_0x4f054d[_0x8f21('0x6')]][_0x8f21('0xb')]));}}}catch(_0x2fd393){utils['error'](util[_0x8f21('0x4')](_0x8f21('0x23'),_0x4f054d['uniqueid']),_0x2fd393);}};exports[_0x8f21('0x29')]=function(_0xde83b1){try{if(!_[_0x8f21('0x1a')](queues[_0xde83b1['uniqueid']])){utils['debug'](util[_0x8f21('0x4')](_0x8f21('0x2f'),_0xde83b1['uniqueid']),_0xde83b1);queues[_0xde83b1[_0x8f21('0x6')]][_0x8f21('0x1c')]=![];queues[_0xde83b1['uniqueid']]['queuecallerexitAt']=null;queues[_0xde83b1[_0x8f21('0x6')]][_0x8f21('0x29')]=!![];queues[_0xde83b1[_0x8f21('0x6')]][_0x8f21('0x2b')]=utils[_0x8f21('0x16')]();queues[_0xde83b1[_0x8f21('0x6')]][_0x8f21('0xb')]=_0x8f21('0x30');utils['info'](util[_0x8f21('0x4')](_0x8f21('0x31'),_0xde83b1[_0x8f21('0x6')],queues[_0xde83b1[_0x8f21('0x6')]][_0x8f21('0x21')],queues[_0xde83b1[_0x8f21('0x6')]][_0x8f21('0xb')]));}}catch(_0x45f3e0){utils[_0x8f21('0x17')](util[_0x8f21('0x4')](_0x8f21('0x2f'),_0xde83b1[_0x8f21('0x6')]),_0x45f3e0);}};exports[_0x8f21('0x32')]=function(_0x37ca5b){try{if(!_[_0x8f21('0x1a')](queues[_0x37ca5b[_0x8f21('0x6')]])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x37ca5b[_0x8f21('0x6')]),_0x37ca5b);utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x33'),_0x37ca5b[_0x8f21('0x6')],queues[_0x37ca5b[_0x8f21('0x6')]][_0x8f21('0x21')],_0x37ca5b[_0x8f21('0x34')],_0x37ca5b[_0x8f21('0x35')]));queues[_0x37ca5b[_0x8f21('0x6')]]['queuecallerleave']=!![];queues[_0x37ca5b[_0x8f21('0x6')]][_0x8f21('0x36')]=utils['now']();queues[_0x37ca5b['uniqueid']][_0x8f21('0x37')]=utils[_0x8f21('0x38')](queues[_0x37ca5b[_0x8f21('0x6')]]['queuecallerleaveAt'],queues[_0x37ca5b[_0x8f21('0x6')]][_0x8f21('0x39')]);queues[_0x37ca5b[_0x8f21('0x6')]]['position']=_0x37ca5b[_0x8f21('0x14')];queues[_0x37ca5b[_0x8f21('0x6')]][_0x8f21('0x3a')]=_0x37ca5b[_0x8f21('0x3a')];queues[_0x37ca5b[_0x8f21('0x6')]][_0x8f21('0x34')]=_0x37ca5b[_0x8f21('0x34')];queues[_0x37ca5b[_0x8f21('0x6')]]['connectedlinename']=_0x37ca5b['connectedlinename'];}}catch(_0x3a5caf){utils[_0x8f21('0x17')](util[_0x8f21('0x4')](_0x8f21('0x3b'),_0x37ca5b[_0x8f21('0x6')]),_0x3a5caf);}};exports[_0x8f21('0x3c')]=function(_0x1f6263){try{if(!_['isNil'](queues[_0x1f6263[_0x8f21('0x6')]])){utils['debug'](util[_0x8f21('0x4')](_0x8f21('0x3d'),_0x1f6263[_0x8f21('0x6')]),_0x1f6263);utils['info'](util[_0x8f21('0x4')](_0x8f21('0x3e'),_0x1f6263[_0x8f21('0x6')],queues[_0x1f6263[_0x8f21('0x6')]][_0x8f21('0x21')],_0x1f6263[_0x8f21('0x3f')],_0x1f6263[_0x8f21('0x40')]));queues[_0x1f6263[_0x8f21('0x6')]][_0x8f21('0x29')]=![];queues[_0x1f6263[_0x8f21('0x6')]]['queuecallerabandon']=![];queues[_0x1f6263['uniqueid']][_0x8f21('0x2b')]=null;queues[_0x1f6263[_0x8f21('0x6')]][_0x8f21('0x1c')]=![];queues[_0x1f6263[_0x8f21('0x6')]][_0x8f21('0xb')]=null;queues[_0x1f6263[_0x8f21('0x6')]][_0x8f21('0x2c')]=null;queues[_0x1f6263[_0x8f21('0x6')]][_0x8f21('0x41')]=!![];queues[_0x1f6263[_0x8f21('0x6')]][_0x8f21('0x42')]=_0x1f6263[_0x8f21('0x40')];queues[_0x1f6263['uniqueid']][_0x8f21('0x9')]=_0x1f6263[_0x8f21('0x3f')];}}catch(_0x2cb4ad){utils[_0x8f21('0x17')](util['format']('[%s][queues][agentconnect]',_0x1f6263[_0x8f21('0x6')]),_0x2cb4ad);}};exports['agentcomplete']=function(_0x3dc6e3){try{if(!_['isNil'](queues[_0x3dc6e3['uniqueid']])){if(queues[_0x3dc6e3[_0x8f21('0x6')]]['queuecallerleaveAt']){utils[_0x8f21('0x12')](util[_0x8f21('0x4')](_0x8f21('0x43'),_0x3dc6e3['uniqueid']),_0x3dc6e3);queues[_0x3dc6e3[_0x8f21('0x6')]][_0x8f21('0x29')]=![];queues[_0x3dc6e3['uniqueid']][_0x8f21('0x29')]=![];queues[_0x3dc6e3[_0x8f21('0x6')]][_0x8f21('0x2b')]=null;queues[_0x3dc6e3[_0x8f21('0x6')]][_0x8f21('0x1c')]=![];queues[_0x3dc6e3['uniqueid']][_0x8f21('0x2c')]=null;queues[_0x3dc6e3['uniqueid']][_0x8f21('0x41')]=!![];queues[_0x3dc6e3['uniqueid']][_0x8f21('0x9')]=_0x3dc6e3[_0x8f21('0x3f')];queues[_0x3dc6e3[_0x8f21('0x6')]][_0x8f21('0x1d')]=!![];queues[_0x3dc6e3[_0x8f21('0x6')]]['queuecallercompleteAt']=utils[_0x8f21('0x16')]();if(_0x3dc6e3[_0x8f21('0x44')]==_0x8f21('0x45')){if(!queues[_0x3dc6e3[_0x8f21('0x6')]][_0x8f21('0x45')]){queues[_0x3dc6e3['uniqueid']][_0x8f21('0xb')]=_0x8f21('0x46');}}else{queues[_0x3dc6e3[_0x8f21('0x6')]][_0x8f21('0xb')]=_0x8f21('0x47')+_0x3dc6e3['reason'][_0x8f21('0x27')]();}utils[_0x8f21('0x3')](util['format'](_0x8f21('0x48'),_0x3dc6e3[_0x8f21('0x6')],queues[_0x3dc6e3[_0x8f21('0x6')]]['name'],_0x3dc6e3[_0x8f21('0x3f')],queues[_0x3dc6e3[_0x8f21('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x3dc6e3[_0x8f21('0x6')]]);}}}catch(_0x280003){utils[_0x8f21('0x17')](util['format'](_0x8f21('0x43'),_0x3dc6e3[_0x8f21('0x6')]),_0x280003);}};exports['blindtransfer']=function(_0x188023){try{if(!_[_0x8f21('0x1a')](queues[_0x188023[_0x8f21('0x49')]])){utils[_0x8f21('0x12')](util[_0x8f21('0x4')](_0x8f21('0x4a'),_0x188023['uniqueid']),_0x188023);queues[_0x188023[_0x8f21('0x49')]][_0x8f21('0x45')]=!![];queues[_0x188023['transfereeuniqueid']]['transfertype']=_0x8f21('0x4b');queues[_0x188023[_0x8f21('0x49')]][_0x8f21('0x4c')]=_0x188023['extension'];queues[_0x188023[_0x8f21('0x49')]][_0x8f21('0x4d')]=_0x188023[_0x8f21('0x49')];queues[_0x188023['transfereeuniqueid']][_0x8f21('0xb')]=_0x8f21('0x4e');utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x4f'),_0x188023[_0x8f21('0x6')],queues[_0x188023['transfereeuniqueid']][_0x8f21('0x21')],_0x188023[_0x8f21('0x49')],_0x188023[_0x8f21('0x50')]));}}catch(_0x3b44b5){utils['error'](util[_0x8f21('0x4')](_0x8f21('0x4a'),_0x188023[_0x8f21('0x6')]),_0x3b44b5);}};exports[_0x8f21('0x51')]=function(_0xd8e1b4){try{utils[_0x8f21('0x12')](util['format'](_0x8f21('0x52'),_0xd8e1b4[_0x8f21('0x53')]),_0xd8e1b4);if(_0xd8e1b4[_0x8f21('0x53')]==_0xd8e1b4[_0x8f21('0x54')]){if(!_['isNil'](queues[_0xd8e1b4[_0x8f21('0x55')]])){utils['info'](util[_0x8f21('0x4')](_0x8f21('0x56'),_0xd8e1b4[_0x8f21('0x53')],queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0x21')],_0xd8e1b4[_0x8f21('0x57')]));queues[_0xd8e1b4['secondtransfererlinkedid']][_0x8f21('0x45')]=!![];queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0x58')]='ATTENDED';queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0x4c')]=_0xd8e1b4[_0x8f21('0x57')];queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0x4d')]=_0xd8e1b4[_0x8f21('0x53')];queues[_0xd8e1b4['secondtransfererlinkedid']][_0x8f21('0xb')]=_0x8f21('0x59');}if(!_['isNil'](queues[_0xd8e1b4[_0x8f21('0x54')]])){if(_0xd8e1b4['transfereelinkedid']&&queues[_0xd8e1b4[_0x8f21('0x5a')]]){queues[_0xd8e1b4[_0x8f21('0x5a')]][_0x8f21('0x5b')]=0x1;queues[_0xd8e1b4[_0x8f21('0x49')]]=_['clone'](queues[_0xd8e1b4[_0x8f21('0x5a')]]);queues[_0xd8e1b4[_0x8f21('0x49')]][_0x8f21('0x11')]=_0xd8e1b4[_0x8f21('0x5c')];queues[_0xd8e1b4['transfereeuniqueid']][_0x8f21('0x5b')]=0x2;queues[_0xd8e1b4[_0x8f21('0x49')]][_0x8f21('0xa')]=queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0xa')];queues[_0xd8e1b4[_0x8f21('0x49')]]['calleridname']=queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0x5d')];queues[_0xd8e1b4['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x8f21('0x16')]();queues[_0xd8e1b4[_0x8f21('0x49')]][_0x8f21('0x36')]=utils[_0x8f21('0x16')]();queues[_0xd8e1b4[_0x8f21('0x49')]][_0x8f21('0x37')]=0x0;queues[_0xd8e1b4['transfereeuniqueid']][_0x8f21('0x5e')]=0x0;utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x5f'),_0xd8e1b4[_0x8f21('0x53')],queues[_0xd8e1b4[_0x8f21('0x49')]][_0x8f21('0x21')],queues[_0xd8e1b4['transfereeuniqueid']][_0x8f21('0xa')],queues[_0xd8e1b4['transfereeuniqueid']]['calleridname']));}else{utils[_0x8f21('0x3')](util['format'](_0x8f21('0x60'),_0xd8e1b4['origtransfereruniqueid'],queues[_0xd8e1b4['origtransfererlinkedid']]['name'],_0xd8e1b4[_0x8f21('0x55')]));queues[_0xd8e1b4[_0x8f21('0x54')]][_0x8f21('0x11')]=_0xd8e1b4[_0x8f21('0x55')];}}}else if(_0xd8e1b4[_0x8f21('0x61')]==_0xd8e1b4[_0x8f21('0x55')]){if(!_[_0x8f21('0x1a')](queues[_0xd8e1b4[_0x8f21('0x54')]])){utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x62'),_0xd8e1b4[_0x8f21('0x53')],queues[_0xd8e1b4[_0x8f21('0x54')]][_0x8f21('0x21')],_0xd8e1b4['secondtransfereruniqueid'],_0xd8e1b4[_0x8f21('0x63')]));queues[_0xd8e1b4['origtransfererlinkedid']]['transfer']=!![];queues[_0xd8e1b4[_0x8f21('0x54')]][_0x8f21('0x58')]=_0x8f21('0x64');queues[_0xd8e1b4[_0x8f21('0x54')]]['transferexten']=_0xd8e1b4[_0x8f21('0x63')];queues[_0xd8e1b4[_0x8f21('0x54')]]['transferuniqueid']=_0xd8e1b4[_0x8f21('0x61')];queues[_0xd8e1b4[_0x8f21('0x54')]][_0x8f21('0xb')]=_0x8f21('0x59');}if(!_[_0x8f21('0x1a')](queues[_0xd8e1b4[_0x8f21('0x55')]])){if(_0xd8e1b4[_0x8f21('0x65')]&&queues[_0xd8e1b4[_0x8f21('0x65')]]){queues[_0xd8e1b4['transfertargetlinkedid']][_0x8f21('0x5b')]=0x1;queues[_0xd8e1b4[_0x8f21('0x5c')]]=_[_0x8f21('0x66')](queues[_0xd8e1b4[_0x8f21('0x65')]]);queues[_0xd8e1b4[_0x8f21('0x5c')]][_0x8f21('0x11')]=_0xd8e1b4[_0x8f21('0x5c')];queues[_0xd8e1b4[_0x8f21('0x5c')]]['queuecallerenterreason']=0x2;queues[_0xd8e1b4[_0x8f21('0x5c')]][_0x8f21('0xa')]=queues[_0xd8e1b4[_0x8f21('0x54')]][_0x8f21('0xa')];queues[_0xd8e1b4[_0x8f21('0x5c')]][_0x8f21('0x5d')]=queues[_0xd8e1b4[_0x8f21('0x54')]][_0x8f21('0x5d')];queues[_0xd8e1b4[_0x8f21('0x5c')]]['queuecallerjoinAt']=utils['now']();queues[_0xd8e1b4[_0x8f21('0x5c')]]['queuecallerleaveAt']=utils[_0x8f21('0x16')]();queues[_0xd8e1b4[_0x8f21('0x5c')]][_0x8f21('0x37')]=0x0;queues[_0xd8e1b4[_0x8f21('0x5c')]][_0x8f21('0x5e')]=0x0;utils[_0x8f21('0x3')](util[_0x8f21('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0xd8e1b4[_0x8f21('0x53')],queues[_0xd8e1b4['transfertargetuniqueid']][_0x8f21('0x21')],queues[_0xd8e1b4['transfertargetuniqueid']]['transfereduniqueid'],queues[_0xd8e1b4[_0x8f21('0x5c')]]['calleridnum'],queues[_0xd8e1b4[_0x8f21('0x5c')]][_0x8f21('0x5d')]));}else{utils['info'](util[_0x8f21('0x4')](_0x8f21('0x60'),_0xd8e1b4['origtransfereruniqueid'],queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0x21')],_0xd8e1b4[_0x8f21('0x54')]));queues[_0xd8e1b4[_0x8f21('0x55')]][_0x8f21('0x11')]=_0xd8e1b4[_0x8f21('0x54')];}}}}catch(_0xab7e98){utils[_0x8f21('0x17')](util[_0x8f21('0x4')]('[%s][queues][attendedtransfer]',_0xd8e1b4[_0x8f21('0x53')]),_0xab7e98);}};exports[_0x8f21('0x67')]=function(_0x329c42){try{if(!_[_0x8f21('0x1a')](queues[_0x329c42[_0x8f21('0x6')]])){utils[_0x8f21('0x12')](util[_0x8f21('0x4')]('[%s][queues][musiconholdstart]',_0x329c42[_0x8f21('0x6')]),_0x329c42);queues[_0x329c42[_0x8f21('0x6')]]['musiconholdstartAt']=utils[_0x8f21('0x16')]();utils['info'](util[_0x8f21('0x4')](_0x8f21('0x68'),_0x329c42[_0x8f21('0x6')],queues[_0x329c42['uniqueid']][_0x8f21('0x21')],queues[_0x329c42[_0x8f21('0x6')]]['musiconholdstartAt']));}}catch(_0x47c114){utils[_0x8f21('0x17')](util[_0x8f21('0x4')](_0x8f21('0x69'),_0x329c42['uniqueid']),_0x47c114);}};exports[_0x8f21('0x6a')]=function(_0x2fc48b){try{if(!_['isNil'](queues[_0x2fc48b[_0x8f21('0x6')]])){if(!_[_0x8f21('0x1a')](queues[_0x2fc48b[_0x8f21('0x6')]][_0x8f21('0x6b')])){utils[_0x8f21('0x12')](util['format'](_0x8f21('0x6c'),_0x2fc48b['uniqueid']),_0x2fc48b);queues[_0x2fc48b[_0x8f21('0x6')]][_0x8f21('0x5e')]+=utils[_0x8f21('0x38')](utils['now'](),queues[_0x2fc48b[_0x8f21('0x6')]]['musiconholdstartAt']);utils[_0x8f21('0x3')](util[_0x8f21('0x4')](_0x8f21('0x6d'),_0x2fc48b[_0x8f21('0x6')],queues[_0x2fc48b[_0x8f21('0x6')]][_0x8f21('0x21')],queues[_0x2fc48b[_0x8f21('0x6')]][_0x8f21('0x5e')]));delete queues[_0x2fc48b['uniqueid']][_0x8f21('0x6b')];}}}catch(_0x15915b){utils['error'](util[_0x8f21('0x4')]('[%s][queues][musiconholdstop]',_0x2fc48b[_0x8f21('0x6')]),_0x15915b);}}; \ No newline at end of file +var _0x528b=['[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','queuecallerjoinAt','mohtime','[%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]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','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]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','diffTime','count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','membername','assigned','[%s][queues][agentconnect]','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x528b,0xe9));var _0xb528=function(_0x4d1645,_0x2421e9){_0x4d1645=_0x4d1645-0x0;var _0x196418=_0x528b[_0x4d1645];return _0x196418;};'use strict';var _=require(_0xb528('0x0'));var util=require(_0xb528('0x1'));var utils=require(_0xb528('0x2'));var queues={};function writeDB(_0x100a62){utils[_0xb528('0x3')](util[_0xb528('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x100a62['uniqueid'],_0x100a62['channel'],_0x100a62[_0xb528('0x5')],_0x100a62[_0xb528('0x6')],_0x100a62[_0xb528('0x7')],_0x100a62[_0xb528('0x8')],_0x100a62['queuecallerexitreason']));if(_0x100a62[_0xb528('0x5')]){utils[_0xb528('0x9')](_0x100a62[_0xb528('0x5')])[_0xb528('0xa')](function(_0x51b904){if(_0x51b904){_0x100a62[_0xb528('0xb')]=_0x51b904[_0xb528('0xb')];}utils['request'](_0xb528('0xc'),_0x100a62);});}else{utils[_0xb528('0xd')](_0xb528('0xc'),_0x100a62);}if(_0x100a62[_0xb528('0xe')]){delete queues[_0x100a62['transfereduniqueid']];}else{delete queues[_0x100a62['uniqueid']];}}exports[_0xb528('0xf')]=function(_0x43efd1){try{utils[_0xb528('0x10')](util[_0xb528('0x4')](_0xb528('0x11'),_0x43efd1[_0xb528('0x12')]),_0x43efd1);utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x13'),_0x43efd1[_0xb528('0x12')],_0x43efd1[_0xb528('0x5')],_0x43efd1[_0xb528('0x14')]));queues[_0x43efd1['uniqueid']]=_[_0xb528('0x15')](_0x43efd1,{'originalposition':_0x43efd1[_0xb528('0x14')],'queuecallerjoinAt':utils[_0xb528('0x16')](),'mohtime':0x0});}catch(_0x436e92){utils[_0xb528('0x17')](util[_0xb528('0x4')]('[%s][queues][queuecallerjoin]',_0x43efd1[_0xb528('0x12')]),_0x436e92);}};exports['hangup']=function(_0x1be53c){try{if(!_[_0xb528('0x18')](queues[_0x1be53c[_0xb528('0x12')]])){utils[_0xb528('0x10')](util['format'](_0xb528('0x19'),_0x1be53c[_0xb528('0x12')]),_0x1be53c);if(queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0x1a')]){if(!queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0x1b')]&&!queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0x1c')]){queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0x1d')]=!![];queues[_0x1be53c['uniqueid']][_0xb528('0x1e')]=utils['now']();queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0x1f')]=_0xb528('0x20');}utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x21'),_0x1be53c[_0xb528('0x12')],queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0x22')],queues[_0x1be53c[_0xb528('0x12')]]['queuecallerexitreason']));writeDB(queues[_0x1be53c[_0xb528('0x12')]]);}else if(queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0xe')]){utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x23'),_0x1be53c[_0xb528('0x12')],queues[_0x1be53c[_0xb528('0x12')]]['name'],queues[_0x1be53c[_0xb528('0x12')]]['transfereduniqueid']));queues[queues[_0x1be53c[_0xb528('0x12')]][_0xb528('0xe')]]=queues[_0x1be53c[_0xb528('0x12')]];queues[queues[_0x1be53c[_0xb528('0x12')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x1be53c[_0xb528('0x12')]];}}}catch(_0x12a74d){utils[_0xb528('0x17')](util[_0xb528('0x4')](_0xb528('0x19'),_0x1be53c[_0xb528('0x12')]),_0x12a74d);}};exports[_0xb528('0x24')]=function(_0x1024f1){try{utils[_0xb528('0x10')](util[_0xb528('0x4')](_0xb528('0x25'),_0x1024f1[_0xb528('0x12')]),_0x1024f1);if(!_['isNil'](_0x1024f1[_0xb528('0x26')][_0xb528('0x27')])&&_0x1024f1['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0xb528('0x18')](queues[_0x1024f1[_0xb528('0x12')]])){queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x1b')]=![];queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x28')]=null;queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x1c')]=!![];queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x29')]=utils[_0xb528('0x16')]();queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x1f')]=_0x1024f1[_0xb528('0x2a')]['toUpperCase']();utils[_0xb528('0x3')](util['format'](_0xb528('0x2b'),_0x1024f1[_0xb528('0x12')],queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x22')],_0x1024f1[_0xb528('0x2a')],queues[_0x1024f1['uniqueid']][_0xb528('0x1f')]));writeDB(queues[_0x1024f1[_0xb528('0x12')]]);}}else if(!_[_0xb528('0x18')](_0x1024f1['variable']['queueposition'])){if(!_[_0xb528('0x18')](queues[_0x1024f1['uniqueid']])&&!queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x1b')]){queues[_0x1024f1['uniqueid']][_0xb528('0x1b')]=![];queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x28')]=null;queues[_0x1024f1['uniqueid']]['queuecallerexit']=!![];queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x29')]=utils['now']();queues[_0x1024f1[_0xb528('0x12')]]['queuecallerexitreason']=_0xb528('0x2c');utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x2d'),_0x1024f1['uniqueid'],queues[_0x1024f1[_0xb528('0x12')]][_0xb528('0x22')],_0x1024f1[_0xb528('0x2a')],queues[_0x1024f1[_0xb528('0x12')]]['queuecallerexitreason']));}}}catch(_0x5c349b){utils[_0xb528('0x17')](util[_0xb528('0x4')](_0xb528('0x25'),_0x1024f1[_0xb528('0x12')]),_0x5c349b);}};exports[_0xb528('0x1b')]=function(_0x13b94d){try{if(!_[_0xb528('0x18')](queues[_0x13b94d[_0xb528('0x12')]])){utils[_0xb528('0x10')](util[_0xb528('0x4')](_0xb528('0x2e'),_0x13b94d['uniqueid']),_0x13b94d);queues[_0x13b94d[_0xb528('0x12')]][_0xb528('0x1c')]=![];queues[_0x13b94d[_0xb528('0x12')]]['queuecallerexitAt']=null;queues[_0x13b94d['uniqueid']][_0xb528('0x1b')]=!![];queues[_0x13b94d[_0xb528('0x12')]][_0xb528('0x28')]=utils[_0xb528('0x16')]();queues[_0x13b94d[_0xb528('0x12')]]['queuecallerexitreason']='ABANDONED';utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x2f'),_0x13b94d[_0xb528('0x12')],queues[_0x13b94d[_0xb528('0x12')]][_0xb528('0x22')],queues[_0x13b94d['uniqueid']][_0xb528('0x1f')]));}}catch(_0x2ce2a2){utils[_0xb528('0x17')](util[_0xb528('0x4')]('[%s][queues][queuecallerabandon]',_0x13b94d[_0xb528('0x12')]),_0x2ce2a2);}};exports[_0xb528('0x30')]=function(_0xc15597){try{if(!_['isNil'](queues[_0xc15597['uniqueid']])){utils[_0xb528('0x10')](util[_0xb528('0x4')]('[%s][queues][queuecallerleave]',_0xc15597[_0xb528('0x12')]),_0xc15597);utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x31'),_0xc15597['uniqueid'],queues[_0xc15597[_0xb528('0x12')]][_0xb528('0x22')],_0xc15597['connectedlinenum'],_0xc15597['connectedlinename']));queues[_0xc15597[_0xb528('0x12')]][_0xb528('0x30')]=!![];queues[_0xc15597[_0xb528('0x12')]][_0xb528('0x1a')]=utils[_0xb528('0x16')]();queues[_0xc15597[_0xb528('0x12')]][_0xb528('0x32')]=utils[_0xb528('0x33')](queues[_0xc15597[_0xb528('0x12')]]['queuecallerleaveAt'],queues[_0xc15597[_0xb528('0x12')]]['queuecallerjoinAt']);queues[_0xc15597[_0xb528('0x12')]]['position']=_0xc15597['position'];queues[_0xc15597[_0xb528('0x12')]]['count']=_0xc15597[_0xb528('0x34')];queues[_0xc15597[_0xb528('0x12')]]['connectedlinenum']=_0xc15597['connectedlinenum'];queues[_0xc15597['uniqueid']][_0xb528('0x35')]=_0xc15597['connectedlinename'];}}catch(_0x3bd312){utils[_0xb528('0x17')](util[_0xb528('0x4')](_0xb528('0x36'),_0xc15597['uniqueid']),_0x3bd312);}};exports[_0xb528('0x37')]=function(_0x237302){try{if(!_[_0xb528('0x18')](queues[_0x237302[_0xb528('0x12')]])){utils[_0xb528('0x10')](util[_0xb528('0x4')]('[%s][queues][agentconnect]',_0x237302[_0xb528('0x12')]),_0x237302);utils[_0xb528('0x3')](util[_0xb528('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x237302[_0xb528('0x12')],queues[_0x237302[_0xb528('0x12')]][_0xb528('0x22')],_0x237302[_0xb528('0x38')],_0x237302['destaccountcode']));queues[_0x237302[_0xb528('0x12')]][_0xb528('0x1b')]=![];queues[_0x237302[_0xb528('0x12')]][_0xb528('0x1b')]=![];queues[_0x237302[_0xb528('0x12')]][_0xb528('0x28')]=null;queues[_0x237302[_0xb528('0x12')]][_0xb528('0x1c')]=![];queues[_0x237302[_0xb528('0x12')]][_0xb528('0x1f')]=null;queues[_0x237302[_0xb528('0x12')]][_0xb528('0x29')]=null;queues[_0x237302[_0xb528('0x12')]][_0xb528('0x39')]=!![];queues[_0x237302[_0xb528('0x12')]]['accountcode']=_0x237302['destaccountcode'];queues[_0x237302[_0xb528('0x12')]][_0xb528('0x6')]=_0x237302[_0xb528('0x38')];}}catch(_0x281114){utils[_0xb528('0x17')](util[_0xb528('0x4')](_0xb528('0x3a'),_0x237302['uniqueid']),_0x281114);}};exports[_0xb528('0x3b')]=function(_0x16c527){try{if(!_[_0xb528('0x18')](queues[_0x16c527[_0xb528('0x12')]])){if(queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x1a')]){utils['debug'](util[_0xb528('0x4')]('[%s][queues][agentcomplete]',_0x16c527[_0xb528('0x12')]),_0x16c527);queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x1b')]=![];queues[_0x16c527['uniqueid']][_0xb528('0x1b')]=![];queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x28')]=null;queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x1c')]=![];queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x29')]=null;queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x39')]=!![];queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x6')]=_0x16c527[_0xb528('0x38')];queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x1d')]=!![];queues[_0x16c527[_0xb528('0x12')]]['queuecallercompleteAt']=utils[_0xb528('0x16')]();if(_0x16c527[_0xb528('0x3c')]==_0xb528('0x3d')){if(!queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x3d')]){queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x1f')]=_0xb528('0x3e');}}else{queues[_0x16c527[_0xb528('0x12')]]['queuecallerexitreason']=_0xb528('0x3f')+_0x16c527[_0xb528('0x3c')][_0xb528('0x40')]();}utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x41'),_0x16c527[_0xb528('0x12')],queues[_0x16c527['uniqueid']][_0xb528('0x22')],_0x16c527[_0xb528('0x38')],queues[_0x16c527[_0xb528('0x12')]][_0xb528('0x1f')]));writeDB(queues[_0x16c527['uniqueid']]);}}}catch(_0x55293b){utils[_0xb528('0x17')](util[_0xb528('0x4')]('[%s][queues][agentcomplete]',_0x16c527[_0xb528('0x12')]),_0x55293b);}};exports[_0xb528('0x42')]=function(_0x46faab){try{if(!_['isNil'](queues[_0x46faab['transfereeuniqueid']])){utils[_0xb528('0x10')](util[_0xb528('0x4')](_0xb528('0x43'),_0x46faab['uniqueid']),_0x46faab);queues[_0x46faab[_0xb528('0x44')]][_0xb528('0x3d')]=!![];queues[_0x46faab[_0xb528('0x44')]][_0xb528('0x45')]=_0xb528('0x46');queues[_0x46faab[_0xb528('0x44')]][_0xb528('0x47')]=_0x46faab[_0xb528('0x48')];queues[_0x46faab[_0xb528('0x44')]][_0xb528('0x49')]=_0x46faab[_0xb528('0x44')];queues[_0x46faab[_0xb528('0x44')]][_0xb528('0x1f')]='BLINDTRANSFER';utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x4a'),_0x46faab['uniqueid'],queues[_0x46faab[_0xb528('0x44')]][_0xb528('0x22')],_0x46faab[_0xb528('0x44')],_0x46faab[_0xb528('0x48')]));}}catch(_0x44a245){utils['error'](util[_0xb528('0x4')](_0xb528('0x43'),_0x46faab['uniqueid']),_0x44a245);}};exports[_0xb528('0x4b')]=function(_0x142cbe){try{utils[_0xb528('0x10')](util[_0xb528('0x4')](_0xb528('0x4c'),_0x142cbe['origtransfereruniqueid']),_0x142cbe);if(_0x142cbe[_0xb528('0x4d')]==_0x142cbe[_0xb528('0x4e')]){if(!_[_0xb528('0x18')](queues[_0x142cbe['secondtransfererlinkedid']])){utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x4f'),_0x142cbe[_0xb528('0x4d')],queues[_0x142cbe[_0xb528('0x50')]][_0xb528('0x22')],_0x142cbe[_0xb528('0x51')]));queues[_0x142cbe[_0xb528('0x50')]]['transfer']=!![];queues[_0x142cbe[_0xb528('0x50')]]['transfertype']=_0xb528('0x52');queues[_0x142cbe[_0xb528('0x50')]][_0xb528('0x47')]=_0x142cbe[_0xb528('0x51')];queues[_0x142cbe[_0xb528('0x50')]][_0xb528('0x49')]=_0x142cbe[_0xb528('0x4d')];queues[_0x142cbe['secondtransfererlinkedid']][_0xb528('0x1f')]=_0xb528('0x53');}if(!_['isNil'](queues[_0x142cbe['origtransfererlinkedid']])){if(_0x142cbe[_0xb528('0x54')]&&queues[_0x142cbe[_0xb528('0x54')]]){queues[_0x142cbe[_0xb528('0x54')]][_0xb528('0x55')]=0x1;queues[_0x142cbe[_0xb528('0x44')]]=_[_0xb528('0x56')](queues[_0x142cbe['transfereelinkedid']]);queues[_0x142cbe['transfereeuniqueid']][_0xb528('0xe')]=_0x142cbe[_0xb528('0x57')];queues[_0x142cbe['transfereeuniqueid']][_0xb528('0x55')]=0x2;queues[_0x142cbe[_0xb528('0x44')]][_0xb528('0x7')]=queues[_0x142cbe[_0xb528('0x50')]]['calleridnum'];queues[_0x142cbe['transfereeuniqueid']][_0xb528('0x58')]=queues[_0x142cbe[_0xb528('0x50')]]['calleridname'];queues[_0x142cbe[_0xb528('0x44')]]['queuecallerjoinAt']=utils[_0xb528('0x16')]();queues[_0x142cbe[_0xb528('0x44')]]['queuecallerleaveAt']=utils['now']();queues[_0x142cbe['transfereeuniqueid']][_0xb528('0x32')]=0x0;queues[_0x142cbe[_0xb528('0x44')]]['mohtime']=0x0;utils['info'](util[_0xb528('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x142cbe[_0xb528('0x4d')],queues[_0x142cbe[_0xb528('0x44')]]['name'],queues[_0x142cbe[_0xb528('0x44')]][_0xb528('0x7')],queues[_0x142cbe[_0xb528('0x44')]][_0xb528('0x58')]));}else{utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x59'),_0x142cbe[_0xb528('0x4d')],queues[_0x142cbe[_0xb528('0x4e')]][_0xb528('0x22')],_0x142cbe[_0xb528('0x50')]));queues[_0x142cbe[_0xb528('0x4e')]][_0xb528('0xe')]=_0x142cbe['secondtransfererlinkedid'];}}}else if(_0x142cbe['secondtransfereruniqueid']==_0x142cbe[_0xb528('0x50')]){if(!_['isNil'](queues[_0x142cbe[_0xb528('0x4e')]])){utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x5a'),_0x142cbe[_0xb528('0x4d')],queues[_0x142cbe[_0xb528('0x4e')]][_0xb528('0x22')],_0x142cbe[_0xb528('0x5b')],_0x142cbe[_0xb528('0x5c')]));queues[_0x142cbe[_0xb528('0x4e')]][_0xb528('0x3d')]=!![];queues[_0x142cbe['origtransfererlinkedid']][_0xb528('0x45')]=_0xb528('0x52');queues[_0x142cbe['origtransfererlinkedid']][_0xb528('0x47')]=_0x142cbe['secondtransfererexten'];queues[_0x142cbe[_0xb528('0x4e')]]['transferuniqueid']=_0x142cbe[_0xb528('0x5b')];queues[_0x142cbe[_0xb528('0x4e')]][_0xb528('0x1f')]=_0xb528('0x53');}if(!_[_0xb528('0x18')](queues[_0x142cbe[_0xb528('0x50')]])){if(_0x142cbe[_0xb528('0x5d')]&&queues[_0x142cbe[_0xb528('0x5d')]]){queues[_0x142cbe[_0xb528('0x5d')]][_0xb528('0x55')]=0x1;queues[_0x142cbe['transfertargetuniqueid']]=_['clone'](queues[_0x142cbe['transfertargetlinkedid']]);queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0xe')]=_0x142cbe[_0xb528('0x57')];queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x55')]=0x2;queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x7')]=queues[_0x142cbe[_0xb528('0x4e')]][_0xb528('0x7')];queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x58')]=queues[_0x142cbe[_0xb528('0x4e')]]['calleridname'];queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x5e')]=utils[_0xb528('0x16')]();queues[_0x142cbe['transfertargetuniqueid']][_0xb528('0x1a')]=utils[_0xb528('0x16')]();queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x32')]=0x0;queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x5f')]=0x0;utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x60'),_0x142cbe[_0xb528('0x4d')],queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x22')],queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0xe')],queues[_0x142cbe[_0xb528('0x57')]]['calleridnum'],queues[_0x142cbe[_0xb528('0x57')]][_0xb528('0x58')]));}else{utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x59'),_0x142cbe['origtransfereruniqueid'],queues[_0x142cbe['secondtransfererlinkedid']][_0xb528('0x22')],_0x142cbe[_0xb528('0x4e')]));queues[_0x142cbe['secondtransfererlinkedid']][_0xb528('0xe')]=_0x142cbe[_0xb528('0x4e')];}}}}catch(_0x2d4d5b){utils['error'](util[_0xb528('0x4')]('[%s][queues][attendedtransfer]',_0x142cbe[_0xb528('0x4d')]),_0x2d4d5b);}};exports[_0xb528('0x61')]=function(_0x57fc6f){try{if(!_[_0xb528('0x18')](queues[_0x57fc6f[_0xb528('0x12')]])){utils[_0xb528('0x10')](util[_0xb528('0x4')](_0xb528('0x62'),_0x57fc6f[_0xb528('0x12')]),_0x57fc6f);queues[_0x57fc6f['uniqueid']]['musiconholdstartAt']=utils[_0xb528('0x16')]();utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x63'),_0x57fc6f[_0xb528('0x12')],queues[_0x57fc6f[_0xb528('0x12')]][_0xb528('0x22')],queues[_0x57fc6f[_0xb528('0x12')]][_0xb528('0x64')]));}}catch(_0xfa0c46){utils[_0xb528('0x17')](util['format'](_0xb528('0x62'),_0x57fc6f[_0xb528('0x12')]),_0xfa0c46);}};exports[_0xb528('0x65')]=function(_0x59da2b){try{if(!_[_0xb528('0x18')](queues[_0x59da2b['uniqueid']])){if(!_['isNil'](queues[_0x59da2b[_0xb528('0x12')]][_0xb528('0x64')])){utils[_0xb528('0x10')](util['format'](_0xb528('0x66'),_0x59da2b[_0xb528('0x12')]),_0x59da2b);queues[_0x59da2b['uniqueid']][_0xb528('0x5f')]+=utils[_0xb528('0x33')](utils['now'](),queues[_0x59da2b[_0xb528('0x12')]]['musiconholdstartAt']);utils[_0xb528('0x3')](util[_0xb528('0x4')](_0xb528('0x67'),_0x59da2b[_0xb528('0x12')],queues[_0x59da2b[_0xb528('0x12')]][_0xb528('0x22')],queues[_0x59da2b['uniqueid']][_0xb528('0x5f')]));delete queues[_0x59da2b[_0xb528('0x12')]][_0xb528('0x64')];}}}catch(_0x44d58d){utils[_0xb528('0x17')](util[_0xb528('0x4')](_0xb528('0x66'),_0x59da2b[_0xb528('0x12')]),_0x44d58d);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 63bcbad..17b1477 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 _0x48a7=['transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','blinds','newchannel','[%s][recordings][newchannel]','linkedid','info','context','exten','channel','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','find','monitors','error','debug','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x48a7,0x1e3));var _0x748a=function(_0x396d39,_0x11e76f){_0x396d39=_0x396d39-0x0;var _0x5139bc=_0x48a7[_0x396d39];return _0x5139bc;};'use strict';var _=require(_0x748a('0x0'));var util=require(_0x748a('0x1'));var utils=require(_0x748a('0x2'));var transfers=require(_0x748a('0x3'));var recordings={};function writeDB(_0xb9f062){var _0x3afe0e;utils['info'](util[_0x748a('0x4')](_0x748a('0x5'),_0xb9f062['uniqueid']));if(transfers['blinds'][_0xb9f062[_0x748a('0x6')]]){_0x3afe0e=_0xb9f062[_0x748a('0x6')];_0xb9f062['uniqueid']=transfers['blinds'][_0xb9f062[_0x748a('0x6')]][_0x748a('0x7')];}if(_0xb9f062[_0x748a('0x8')]){utils[_0x748a('0x9')](_0xb9f062[_0x748a('0x8')])['then'](function(_0x1ac1bf){if(_0x1ac1bf){_0xb9f062[_0x748a('0xa')]=_0x1ac1bf[_0x748a('0xb')];_0xb9f062[_0x748a('0xc')]=_0x1ac1bf['id'];}utils[_0x748a('0xd')](_0x748a('0xe'),_0xb9f062);});}else{utils[_0x748a('0xd')](_0x748a('0xe'),_0xb9f062);}if(_0x3afe0e)delete transfers[_0x748a('0xf')][_0x3afe0e];}exports[_0x748a('0x10')]=function(_0x266c36){try{utils['debug'](util['format'](_0x748a('0x11'),_0x266c36['uniqueid']),_0x266c36);if(_0x266c36[_0x748a('0x6')]==_0x266c36[_0x748a('0x12')]){utils[_0x748a('0x13')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x266c36[_0x748a('0x6')],_0x266c36[_0x748a('0x14')],_0x266c36[_0x748a('0x15')]));recordings[_0x266c36[_0x748a('0x6')]]={'uniqueid':_0x266c36[_0x748a('0x6')],'accountcode':_0x266c36[_0x748a('0x8')],'exten':_0x266c36['exten'],'context':_0x266c36[_0x748a('0x14')],'channel':_0x266c36[_0x748a('0x16')],'monitors':[]};}}catch(_0x23c0ac){utils['error'](util[_0x748a('0x4')](_0x748a('0x11'),_0x266c36[_0x748a('0x6')]),_0x23c0ac);}};exports[_0x748a('0x17')]=function(_0x2a6940){try{utils['debug'](util[_0x748a('0x4')](_0x748a('0x18'),_0x2a6940['uniqueid']),_0x2a6940);if(!_['isNil'](recordings[_0x2a6940[_0x748a('0x6')]])&&_0x2a6940[_0x748a('0x19')]==0x6){utils[_0x748a('0x13')](util[_0x748a('0x4')](_0x748a('0x1a'),_0x2a6940['uniqueid'],_0x2a6940[_0x748a('0x14')],_0x2a6940[_0x748a('0x16')]));}else if(!_[_0x748a('0x1b')](recordings[_0x2a6940[_0x748a('0x12')]])&&_0x2a6940[_0x748a('0x19')]==0x6&&_0x2a6940['context']!=_0x748a('0x1c')){utils[_0x748a('0x13')](util['format'](_0x748a('0x1d'),_0x2a6940[_0x748a('0x6')],_0x2a6940[_0x748a('0x12')],_0x2a6940[_0x748a('0x14')],_0x2a6940[_0x748a('0x16')]));recordings[_0x2a6940['linkedid']][_0x748a('0x8')]=_0x2a6940[_0x748a('0x8')];}}catch(_0x2505bd){utils['error'](util[_0x748a('0x4')](_0x748a('0x18'),_0x2a6940['uniqueid']),_0x2505bd);}};exports[_0x748a('0x1e')]=function(_0x5839a1){try{if(!_[_0x748a('0x1b')](_0x5839a1[_0x748a('0x1f')])&&!_['isNil'](_0x5839a1[_0x748a('0x1f')]['mixmonitor_filename'])){utils['debug'](util[_0x748a('0x4')](_0x748a('0x20'),_0x5839a1['uniqueid']),_0x5839a1);utils[_0x748a('0x13')](util['format'](_0x748a('0x21'),_0x5839a1['uniqueid'],_0x5839a1['variable'],_0x5839a1[_0x748a('0x22')]));if(_['endsWith'](_0x5839a1[_0x748a('0x22')],_0x748a('0x23'))){_0x5839a1[_0x748a('0x22')]=_0x5839a1['value']['replace'](_0x748a('0x23'),_0x748a('0x24'));}if(recordings[_0x5839a1[_0x748a('0x12')]]){var _0x5d5672=_[_0x748a('0x25')](recordings[_0x5839a1[_0x748a('0x12')]][_0x748a('0x26')],{'value':_0x5839a1[_0x748a('0x22')]});if(_['isNil'](_0x5d5672)){recordings[_0x5839a1['linkedid']][_0x748a('0x26')]['push']({'value':_0x5839a1['value']});}}}}catch(_0x558b8d){utils[_0x748a('0x27')](util[_0x748a('0x4')](_0x748a('0x20'),_0x5839a1[_0x748a('0x6')]),_0x558b8d);}};exports['hangup']=function(_0x16860e){try{if(!_[_0x748a('0x1b')](recordings[_0x16860e[_0x748a('0x6')]])){utils[_0x748a('0x28')](util['format'](_0x748a('0x29'),_0x16860e[_0x748a('0x6')]),_0x16860e);utils['info'](util[_0x748a('0x4')](_0x748a('0x2a'),_0x16860e[_0x748a('0x6')],_0x16860e['calleridnum'],_0x16860e[_0x748a('0x2b')],_0x16860e['cause-txt']));recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x2c')]=_0x16860e[_0x748a('0x2c')];recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x2b')]=_0x16860e[_0x748a('0x2b')];recordings[_0x16860e['uniqueid']]['connectedlinenum']=_0x16860e[_0x748a('0x2d')];recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x2e')]=_0x16860e[_0x748a('0x2e')];if(recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x2f')]==_0x748a('0x30')&&recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x8')]){recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x2d')]=recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x8')];recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x2e')]='';}recordings[_0x16860e[_0x748a('0x6')]][_0x748a('0x26')][_0x748a('0x31')](function(_0x2987d2){var _0x32640a=_[_0x748a('0x32')](recordings[_0x16860e[_0x748a('0x6')]]);_0x32640a['value']=_0x2987d2[_0x748a('0x22')];writeDB(_0x32640a);});delete recordings[_0x16860e[_0x748a('0x6')]];}}catch(_0x31ca47){utils['error'](util[_0x748a('0x4')](_0x748a('0x29'),_0x16860e[_0x748a('0x6')]),_0x31ca47);}};exports[_0x748a('0x33')]=function(_0x55223c){try{if(!_[_0x748a('0x1b')](recordings[_0x55223c['uniqueid']])){utils[_0x748a('0x28')](util[_0x748a('0x4')](_0x748a('0x34'),_0x55223c['uniqueid']),_0x55223c);utils[_0x748a('0x13')](util[_0x748a('0x4')](_0x748a('0x35'),_0x55223c['uniqueid'],_0x55223c[_0x748a('0x36')],_0x55223c['appdata']));if(_0x55223c[_0x748a('0x36')][_0x748a('0x37')]()==_0x748a('0x38')&&_[_0x748a('0x39')](_0x55223c['appdata']['toLowerCase'](),_0x748a('0x3a'))){var _0x447c4c=_0x55223c['appdata']['split']('=');var _0x5a5b87=_0x447c4c[0x0]['substring'](_0x447c4c[0x0][_0x748a('0x3b')]('(')+0x1,_0x447c4c[0x0]['lastIndexOf'](')'));var _0x356a57=_0x447c4c[0x1];recordings[_0x55223c[_0x748a('0x6')]][_0x5a5b87]=_0x356a57;}}}catch(_0x585d8e){utils[_0x748a('0x27')](util[_0x748a('0x4')]('[%s][recordings][newexten]',_0x55223c['uniqueid']),_0x585d8e);}};exports[_0x748a('0x3c')]=function(_0x28831b){try{if(!_[_0x748a('0x1b')](recordings[_0x28831b['uniqueid']])){utils['debug'](util['format'](_0x748a('0x3d'),_0x28831b[_0x748a('0x6')]),_0x28831b);utils['info'](util[_0x748a('0x4')](_0x748a('0x3e'),_0x28831b[_0x748a('0x6')],_0x28831b[_0x748a('0x3f')]));recordings[_0x28831b[_0x748a('0x6')]][_0x748a('0x3f')]=_0x28831b['queue'];}}catch(_0x1a41c9){utils[_0x748a('0x27')](util[_0x748a('0x4')]('[%s][recordings][queuecallerjoin]',_0x28831b['uniqueid']),_0x1a41c9);}};exports[_0x748a('0x40')]=function(_0x21f245){try{utils[_0x748a('0x28')](util[_0x748a('0x4')]('[%s][recordings][blindtransfer]',_0x21f245[_0x748a('0x6')]),_0x21f245);utils['info'](util[_0x748a('0x4')](_0x748a('0x41'),_0x21f245[_0x748a('0x6')],_0x21f245[_0x748a('0x42')],_0x21f245['transferercalleridname'],_0x21f245['transfereecalleridnum'],_0x21f245[_0x748a('0x43')]));if(recordings[_0x21f245['transfereruniqueid']]&&transfers[_0x748a('0xf')][_0x21f245[_0x748a('0x44')]]){transfers[_0x748a('0xf')][_0x21f245['transfereruniqueid']][_0x748a('0x45')]=!![];}}catch(_0x339f04){utils[_0x748a('0x27')](util['format']('[%s][recordings][blindtransfer]',_0x21f245[_0x748a('0x6')]),_0x339f04);}}; \ No newline at end of file +var _0x6a32=['split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','membername','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','appdata','application','startsWith','toLowerCase','cdr'];(function(_0xc7b719,_0x46878a){var _0xd84cac=function(_0x12e139){while(--_0x12e139){_0xc7b719['push'](_0xc7b719['shift']());}};_0xd84cac(++_0x46878a);}(_0x6a32,0x1c6));var _0x26a3=function(_0x93ef1c,_0x34b2a8){_0x93ef1c=_0x93ef1c-0x0;var _0x595484=_0x6a32[_0x93ef1c];return _0x595484;};'use strict';var _=require('lodash');var util=require(_0x26a3('0x0'));var utils=require(_0x26a3('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x14a005){var _0xb9c980;utils[_0x26a3('0x2')](util[_0x26a3('0x3')](_0x26a3('0x4'),_0x14a005[_0x26a3('0x5')]));if(transfers[_0x26a3('0x6')][_0x14a005[_0x26a3('0x5')]]){_0xb9c980=_0x14a005['uniqueid'];_0x14a005['uniqueid']=transfers[_0x26a3('0x6')][_0x14a005[_0x26a3('0x5')]][_0x26a3('0x7')];}if(_0x14a005['accountcode']){utils[_0x26a3('0x8')](_0x14a005[_0x26a3('0x9')])['then'](function(_0x43136d){if(_0x43136d){_0x14a005[_0x26a3('0xa')]=_0x43136d[_0x26a3('0xb')];_0x14a005[_0x26a3('0xc')]=_0x43136d['id'];}utils['request']('CreateVoiceRecording',_0x14a005);});}else{utils['request'](_0x26a3('0xd'),_0x14a005);}if(_0xb9c980)delete transfers[_0x26a3('0x6')][_0xb9c980];}exports[_0x26a3('0xe')]=function(_0x47cce9){try{utils[_0x26a3('0xf')](util[_0x26a3('0x3')](_0x26a3('0x10'),_0x47cce9[_0x26a3('0x5')]),_0x47cce9);if(_0x47cce9['uniqueid']==_0x47cce9['linkedid']){utils[_0x26a3('0x2')](util['format'](_0x26a3('0x11'),_0x47cce9['uniqueid'],_0x47cce9['context'],_0x47cce9['exten']));recordings[_0x47cce9['uniqueid']]={'uniqueid':_0x47cce9[_0x26a3('0x5')],'accountcode':_0x47cce9[_0x26a3('0x9')],'exten':_0x47cce9[_0x26a3('0x12')],'context':_0x47cce9[_0x26a3('0x13')],'channel':_0x47cce9[_0x26a3('0x14')],'monitors':[]};}}catch(_0x5d87f1){utils[_0x26a3('0x15')](util[_0x26a3('0x3')]('[%s][recordings][newchannel]',_0x47cce9['uniqueid']),_0x5d87f1);}};exports[_0x26a3('0x16')]=function(_0x47f48c){try{utils[_0x26a3('0xf')](util[_0x26a3('0x3')](_0x26a3('0x17'),_0x47f48c[_0x26a3('0x5')]),_0x47f48c);if(!_[_0x26a3('0x18')](recordings[_0x47f48c[_0x26a3('0x5')]])&&_0x47f48c[_0x26a3('0x19')]==0x6){utils[_0x26a3('0x2')](util[_0x26a3('0x3')](_0x26a3('0x1a'),_0x47f48c[_0x26a3('0x5')],_0x47f48c[_0x26a3('0x13')],_0x47f48c[_0x26a3('0x14')]));}else if(!_[_0x26a3('0x18')](recordings[_0x47f48c[_0x26a3('0x1b')]])&&_0x47f48c[_0x26a3('0x19')]==0x6&&_0x47f48c[_0x26a3('0x13')]!=_0x26a3('0x1c')){utils[_0x26a3('0x2')](util[_0x26a3('0x3')](_0x26a3('0x1d'),_0x47f48c[_0x26a3('0x5')],_0x47f48c[_0x26a3('0x1b')],_0x47f48c[_0x26a3('0x13')],_0x47f48c[_0x26a3('0x14')]));recordings[_0x47f48c[_0x26a3('0x1b')]][_0x26a3('0x9')]=_0x47f48c[_0x26a3('0x9')];}}catch(_0x552f71){utils[_0x26a3('0x15')](util[_0x26a3('0x3')](_0x26a3('0x17'),_0x47f48c[_0x26a3('0x5')]),_0x552f71);}};exports[_0x26a3('0x1e')]=function(_0x1551ed){try{if(!_[_0x26a3('0x18')](_0x1551ed['variable'])&&!_[_0x26a3('0x18')](_0x1551ed[_0x26a3('0x1f')]['mixmonitor_filename'])){utils[_0x26a3('0xf')](util[_0x26a3('0x3')](_0x26a3('0x20'),_0x1551ed['uniqueid']),_0x1551ed);utils[_0x26a3('0x2')](util[_0x26a3('0x3')](_0x26a3('0x21'),_0x1551ed[_0x26a3('0x5')],_0x1551ed[_0x26a3('0x1f')],_0x1551ed[_0x26a3('0x22')]));if(_['endsWith'](_0x1551ed[_0x26a3('0x22')],_0x26a3('0x23'))){_0x1551ed[_0x26a3('0x22')]=_0x1551ed[_0x26a3('0x22')][_0x26a3('0x24')](_0x26a3('0x23'),_0x26a3('0x25'));}if(recordings[_0x1551ed[_0x26a3('0x1b')]]){var _0x2e8736=_[_0x26a3('0x26')](recordings[_0x1551ed[_0x26a3('0x1b')]][_0x26a3('0x27')],{'value':_0x1551ed['value']});if(_[_0x26a3('0x18')](_0x2e8736)){recordings[_0x1551ed[_0x26a3('0x1b')]][_0x26a3('0x27')][_0x26a3('0x28')]({'value':_0x1551ed['value']});}}}}catch(_0x383000){utils[_0x26a3('0x15')](util[_0x26a3('0x3')](_0x26a3('0x20'),_0x1551ed['uniqueid']),_0x383000);}};exports[_0x26a3('0x29')]=function(_0x1d1584){try{if(!_[_0x26a3('0x18')](recordings[_0x1d1584['uniqueid']])){utils[_0x26a3('0xf')](util[_0x26a3('0x3')](_0x26a3('0x2a'),_0x1d1584[_0x26a3('0x5')]),_0x1d1584);utils[_0x26a3('0x2')](util[_0x26a3('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1d1584[_0x26a3('0x5')],_0x1d1584[_0x26a3('0x2b')],_0x1d1584[_0x26a3('0x2c')],_0x1d1584[_0x26a3('0x2d')]));recordings[_0x1d1584[_0x26a3('0x5')]][_0x26a3('0x2b')]=_0x1d1584[_0x26a3('0x2b')];recordings[_0x1d1584[_0x26a3('0x5')]][_0x26a3('0x2c')]=_0x1d1584['calleridname'];recordings[_0x1d1584[_0x26a3('0x5')]][_0x26a3('0x2e')]=_0x1d1584[_0x26a3('0x2e')];recordings[_0x1d1584['uniqueid']]['connectedlinename']=_0x1d1584[_0x26a3('0x2f')];if(recordings[_0x1d1584[_0x26a3('0x5')]]['type']==_0x26a3('0x30')&&recordings[_0x1d1584[_0x26a3('0x5')]]['accountcode']){recordings[_0x1d1584['uniqueid']][_0x26a3('0x2e')]=recordings[_0x1d1584[_0x26a3('0x5')]]['accountcode'];recordings[_0x1d1584[_0x26a3('0x5')]][_0x26a3('0x2f')]='';}recordings[_0x1d1584[_0x26a3('0x5')]]['monitors'][_0x26a3('0x31')](function(_0x1174cf){var _0x2e29cf=_[_0x26a3('0x32')](recordings[_0x1d1584[_0x26a3('0x5')]]);_0x2e29cf[_0x26a3('0x22')]=_0x1174cf[_0x26a3('0x22')];writeDB(_0x2e29cf);});delete recordings[_0x1d1584[_0x26a3('0x5')]];}}catch(_0x3ac8da){utils[_0x26a3('0x15')](util[_0x26a3('0x3')](_0x26a3('0x2a'),_0x1d1584['uniqueid']),_0x3ac8da);}};exports[_0x26a3('0x33')]=function(_0x4e67e1){try{if(!_[_0x26a3('0x18')](recordings[_0x4e67e1[_0x26a3('0x5')]])){utils[_0x26a3('0xf')](util[_0x26a3('0x3')]('[%s][recordings][newexten]',_0x4e67e1['uniqueid']),_0x4e67e1);utils['info'](util[_0x26a3('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4e67e1[_0x26a3('0x5')],_0x4e67e1['application'],_0x4e67e1[_0x26a3('0x34')]));if(_0x4e67e1[_0x26a3('0x35')]['toLowerCase']()=='set'&&_[_0x26a3('0x36')](_0x4e67e1[_0x26a3('0x34')][_0x26a3('0x37')](),_0x26a3('0x38'))){var _0xd1a0ea=_0x4e67e1['appdata'][_0x26a3('0x39')]('=');var _0x1a272e=_0xd1a0ea[0x0][_0x26a3('0x3a')](_0xd1a0ea[0x0][_0x26a3('0x3b')]('(')+0x1,_0xd1a0ea[0x0][_0x26a3('0x3b')](')'));var _0x5dc044=_0xd1a0ea[0x1];recordings[_0x4e67e1[_0x26a3('0x5')]][_0x1a272e]=_0x5dc044;}}}catch(_0x130da9){utils[_0x26a3('0x15')](util[_0x26a3('0x3')](_0x26a3('0x3c'),_0x4e67e1[_0x26a3('0x5')]),_0x130da9);}};exports[_0x26a3('0x3d')]=function(_0xf90c8e){try{if(!_[_0x26a3('0x18')](recordings[_0xf90c8e[_0x26a3('0x5')]])){utils[_0x26a3('0xf')](util[_0x26a3('0x3')](_0x26a3('0x3e'),_0xf90c8e[_0x26a3('0x5')]),_0xf90c8e);utils['info'](util[_0x26a3('0x3')](_0x26a3('0x3f'),_0xf90c8e['uniqueid'],_0xf90c8e['queue']));recordings[_0xf90c8e[_0x26a3('0x5')]][_0x26a3('0x40')]=_0xf90c8e['queue'];}}catch(_0x3654fd){utils[_0x26a3('0x15')](util[_0x26a3('0x3')]('[%s][recordings][queuecallerjoin]',_0xf90c8e['uniqueid']),_0x3654fd);}};exports[_0x26a3('0x41')]=function(_0x1c8cff){try{utils[_0x26a3('0xf')](util['format'](_0x26a3('0x42'),_0x1c8cff[_0x26a3('0x5')]),_0x1c8cff);utils['info'](util[_0x26a3('0x3')](_0x26a3('0x43'),_0x1c8cff[_0x26a3('0x5')],_0x1c8cff['transferercalleridnum'],_0x1c8cff[_0x26a3('0x44')],_0x1c8cff[_0x26a3('0x45')],_0x1c8cff[_0x26a3('0x46')]));if(recordings[_0x1c8cff[_0x26a3('0x47')]]&&transfers[_0x26a3('0x6')][_0x1c8cff[_0x26a3('0x47')]]){transfers[_0x26a3('0x6')][_0x1c8cff['transfereruniqueid']][_0x26a3('0x48')]=!![];}}catch(_0xd37792){utils[_0x26a3('0x15')](util['format'](_0x26a3('0x42'),_0x1c8cff['uniqueid']),_0xd37792);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9bd207f..04024b7 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 _0x415b=['blindtransfer','debug','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','blinds','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport'];(function(_0x13d32e,_0x8b6532){var _0x392eef=function(_0x3fd7f8){while(--_0x3fd7f8){_0x13d32e['push'](_0x13d32e['shift']());}};_0x392eef(++_0x8b6532);}(_0x415b,0x18e));var _0xb415=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x415b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xb415('0x0'));var util=require(_0xb415('0x1'));var utils=require(_0xb415('0x2'));function writeDB(_0x5f2b2a){utils[_0xb415('0x3')](util[_0xb415('0x4')](_0xb415('0x5'),_0x5f2b2a[_0xb415('0x6')]===_0xb415('0x7')?_0x5f2b2a[_0xb415('0x8')]:_0x5f2b2a[_0xb415('0x9')],_0x5f2b2a['type']));utils[_0xb415('0xa')](_0xb415('0xb'),_0x5f2b2a);}exports['blinds']={};exports[_0xb415('0xc')]=function(_0x41204a){try{utils[_0xb415('0xd')](util['format']('[%s][transfers][blindtransfer]',_0x41204a[_0xb415('0x9')]),_0x41204a);utils[_0xb415('0x3')](util[_0xb415('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x41204a[_0xb415('0x9')],_0x41204a[_0xb415('0xe')],_0x41204a[_0xb415('0xf')],_0x41204a[_0xb415('0x10')],_0x41204a[_0xb415('0x11')]));_0x41204a[_0xb415('0x6')]=_0xb415('0x12');exports[_0xb415('0x13')][_0x41204a['transfereruniqueid']]=_0x41204a;writeDB(_0x41204a);}catch(_0x5d3c74){utils[_0xb415('0x14')](util[_0xb415('0x4')]('[%s][transfers][blindtransfer]',_0x41204a['uniqueid']),_0x5d3c74);}};exports[_0xb415('0x15')]=function(_0x28f60a){try{utils[_0xb415('0xd')](util[_0xb415('0x4')](_0xb415('0x16'),_0x28f60a['origtransfereruniqueid']),_0x28f60a);utils[_0xb415('0x3')](util[_0xb415('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x28f60a[_0xb415('0x8')],_0x28f60a[_0xb415('0x17')],_0x28f60a[_0xb415('0x18')],_0x28f60a[_0xb415('0x19')],_0x28f60a[_0xb415('0x1a')]));_0x28f60a=_[_0xb415('0x1b')](_0x28f60a,{'transfererchannel':_0x28f60a[_0xb415('0x1c')],'transferercalleridnum':_0x28f60a['origtransferercalleridnum'],'transferercalleridname':_0x28f60a['origtransferercalleridname'],'transfererconnectedlinenum':_0x28f60a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x28f60a['secondtransfererconnectedlinename'],'transfereraccountcode':_0x28f60a[_0xb415('0x1d')],'transferercontext':_0x28f60a[_0xb415('0x1e')],'transfererexten':_0x28f60a[_0xb415('0x1f')],'transfererlinkedid':_0x28f60a[_0xb415('0x20')],'context':_0x28f60a[_0xb415('0x21')],'extension':_0x28f60a[_0xb415('0x22')],'type':_0xb415('0x7')});if(_[_0xb415('0x23')](_0x28f60a[_0xb415('0x24')])){_0x28f60a=_[_0xb415('0x1b')](_0x28f60a,{'transfereechannel':_0x28f60a[_0xb415('0x25')],'transfereecalleridnum':_0x28f60a[_0xb415('0x19')],'transfereecalleridname':_0x28f60a[_0xb415('0x1a')],'transfereeconnectedlinenum':_0x28f60a[_0xb415('0x26')],'transfereeconnectedlinename':_0x28f60a[_0xb415('0x27')],'transfereeaccountcode':_0x28f60a['transfertargetaccountcode'],'transfereecontext':_0x28f60a['transfertargetcontext'],'transfereeexten':_0x28f60a[_0xb415('0x28')],'transfereelinkedid':_0x28f60a['transfertargetlinkedid']});}writeDB(_0x28f60a);}catch(_0x5b0cfb){utils[_0xb415('0x14')](util[_0xb415('0x4')](_0xb415('0x16'),_0x28f60a[_0xb415('0x8')]),_0x5b0cfb);}}; \ No newline at end of file +var _0x6417=['origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext'];(function(_0x417252,_0xdbe89e){var _0x3a175d=function(_0x423cf7){while(--_0x423cf7){_0x417252['push'](_0x417252['shift']());}};_0x3a175d(++_0xdbe89e);}(_0x6417,0x1f4));var _0x7641=function(_0x3a5c6a,_0x290dd1){_0x3a5c6a=_0x3a5c6a-0x0;var _0x4ac43a=_0x6417[_0x3a5c6a];return _0x4ac43a;};'use strict';var _=require(_0x7641('0x0'));var util=require(_0x7641('0x1'));var utils=require('./utils');function writeDB(_0x22edce){utils[_0x7641('0x2')](util[_0x7641('0x3')](_0x7641('0x4'),_0x22edce[_0x7641('0x5')]===_0x7641('0x6')?_0x22edce['origtransfereruniqueid']:_0x22edce[_0x7641('0x7')],_0x22edce[_0x7641('0x5')]));utils['request'](_0x7641('0x8'),_0x22edce);}exports['blinds']={};exports[_0x7641('0x9')]=function(_0x1b2b73){try{utils[_0x7641('0xa')](util[_0x7641('0x3')](_0x7641('0xb'),_0x1b2b73[_0x7641('0x7')]),_0x1b2b73);utils[_0x7641('0x2')](util[_0x7641('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1b2b73[_0x7641('0x7')],_0x1b2b73['transferercalleridnum'],_0x1b2b73[_0x7641('0xc')],_0x1b2b73[_0x7641('0xd')],_0x1b2b73['transfereecalleridname']));_0x1b2b73[_0x7641('0x5')]=_0x7641('0xe');exports[_0x7641('0xf')][_0x1b2b73[_0x7641('0x10')]]=_0x1b2b73;writeDB(_0x1b2b73);}catch(_0x140e5){utils[_0x7641('0x11')](util[_0x7641('0x3')](_0x7641('0xb'),_0x1b2b73[_0x7641('0x7')]),_0x140e5);}};exports['attendedtransfer']=function(_0x3d98f9){try{utils[_0x7641('0xa')](util[_0x7641('0x3')](_0x7641('0x12'),_0x3d98f9[_0x7641('0x13')]),_0x3d98f9);utils[_0x7641('0x2')](util['format'](_0x7641('0x14'),_0x3d98f9[_0x7641('0x13')],_0x3d98f9[_0x7641('0x15')],_0x3d98f9[_0x7641('0x16')],_0x3d98f9[_0x7641('0x17')],_0x3d98f9[_0x7641('0x18')]));_0x3d98f9=_[_0x7641('0x19')](_0x3d98f9,{'transfererchannel':_0x3d98f9[_0x7641('0x1a')],'transferercalleridnum':_0x3d98f9[_0x7641('0x15')],'transferercalleridname':_0x3d98f9[_0x7641('0x16')],'transfererconnectedlinenum':_0x3d98f9[_0x7641('0x1b')],'transfererconnectedlinename':_0x3d98f9[_0x7641('0x1c')],'transfereraccountcode':_0x3d98f9[_0x7641('0x1d')],'transferercontext':_0x3d98f9[_0x7641('0x1e')],'transfererexten':_0x3d98f9['secondtransfererexten'],'transfererlinkedid':_0x3d98f9[_0x7641('0x1f')],'context':_0x3d98f9[_0x7641('0x20')],'extension':_0x3d98f9[_0x7641('0x21')],'type':_0x7641('0x6')});if(_[_0x7641('0x22')](_0x3d98f9[_0x7641('0x23')])){_0x3d98f9=_[_0x7641('0x19')](_0x3d98f9,{'transfereechannel':_0x3d98f9['transfertargetchannel'],'transfereecalleridnum':_0x3d98f9[_0x7641('0x17')],'transfereecalleridname':_0x3d98f9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3d98f9['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3d98f9[_0x7641('0x24')],'transfereeaccountcode':_0x3d98f9[_0x7641('0x25')],'transfereecontext':_0x3d98f9[_0x7641('0x26')],'transfereeexten':_0x3d98f9[_0x7641('0x27')],'transfereelinkedid':_0x3d98f9[_0x7641('0x28')]});}writeDB(_0x3d98f9);}catch(_0x5d00c1){utils[_0x7641('0x11')](util[_0x7641('0x3')](_0x7641('0x12'),_0x3d98f9[_0x7641('0x13')]),_0x5d00c1);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9fb77d6..16f9e6d 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 _0x4af9=['name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','notfound','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','interface','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue'];(function(_0x4f24c9,_0x2d92f6){var _0x479106=function(_0x1bcbcc){while(--_0x1bcbcc){_0x4f24c9['push'](_0x4f24c9['shift']());}};_0x479106(++_0x2d92f6);}(_0x4af9,0x12c));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x94af('0x0'));var jayson=require(_0x94af('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x94af('0x2')][_0x94af('0x3')]({'port':0x2329});var logger=require(_0x94af('0x4'))(_0x94af('0x5'));exports[_0x94af('0x6')]=function(_0x14d407,_0x1a548e){logger['info'](_0x14d407,_0x1a548e?util[_0x94af('0x7')](_0x1a548e,{'showHidden':![],'depth':null}):'');};exports[_0x94af('0x8')]=function(_0x3e19c9,_0x3a64fa){logger['debug'](_0x3e19c9,_0x3a64fa?util[_0x94af('0x7')](_0x3a64fa,{'showHidden':![],'depth':null}):'');};exports[_0x94af('0x9')]=function(_0x35d260,_0x479e2a){logger['error'](_0x35d260,_0x479e2a?util[_0x94af('0x7')](_0x479e2a,{'showHidden':![],'depth':null}):'');};exports[_0x94af('0xa')]=function(_0x13cb35,_0x3bfc17){return client[_0x94af('0xa')](_0x13cb35,{'body':_0x3bfc17})[_0x94af('0xb')](function(_0x49c8cb){logger[_0x94af('0x8')](_0x94af('0xc'),_0x13cb35,_0x49c8cb?util['inspect'](_0x49c8cb,{'showHidden':![],'depth':null}):'');})[_0x94af('0xd')](function(_0x36fb24){logger[_0x94af('0x9')](_0x94af('0xc'),_0x13cb35,_0x36fb24?util[_0x94af('0x7')](_0x36fb24,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5b04e9){return client[_0x94af('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal','name',_0x94af('0xe')],'where':_0x5b04e9,'limit':0x1}})[_0x94af('0xb')](function(_0x2313a1){logger[_0x94af('0x8')]('[utils][getUser]\x20where:%s',JSON[_0x94af('0xf')](_0x5b04e9),_0x2313a1?util[_0x94af('0x7')](_0x2313a1,{'showHidden':![],'depth':null}):'');return _0x2313a1['result'][_0x94af('0x10')]?_0x2313a1[_0x94af('0x11')][0x0]:null;});}exports[_0x94af('0x12')]=function(_0x32b1d4){return new BPromise(function(_0x414bc9,_0x3d3611){if(_0x32b1d4){return getUser({'internal':_0x32b1d4})[_0x94af('0xb')](function(_0x1dfc29){logger[_0x94af('0x6')](_0x94af('0x13'),_0x32b1d4,_0x1dfc29?'found':'notfound');return _0x414bc9(_0x1dfc29);})[_0x94af('0xd')](function(_0x186355){logger[_0x94af('0x9')](_0x94af('0x14'),_0x186355?util[_0x94af('0x7')](_0x186355,{'showHidden':![],'depth':null}):'');return _0x414bc9(null);});}return _0x414bc9(null);});};exports[_0x94af('0x15')]=function(_0x4adbea){return new BPromise(function(_0x177306,_0x487bd6){if(_0x4adbea){return getUser({'interface':_0x4adbea})[_0x94af('0xb')](function(_0x587ddb){logger[_0x94af('0x6')](_0x94af('0x16'),_0x4adbea,_0x587ddb?_0x94af('0x17'):'notfound');return _0x177306(_0x587ddb);})[_0x94af('0xd')](function(_0x2434fe){logger[_0x94af('0x9')](_0x94af('0x18'),_0x2434fe?util['inspect'](_0x2434fe,{'showHidden':![],'depth':null}):'');return _0x177306(null);});}return _0x177306(null);});};exports[_0x94af('0x19')]=function(_0x29613c){return new BPromise(function(_0x24e8a0,_0x3b6152){if(_0x29613c){return getUser({'name':_0x29613c})[_0x94af('0xb')](function(_0x4334c2){logger[_0x94af('0x6')](_0x94af('0x1a'),_0x29613c,_0x4334c2?_0x94af('0x17'):'notfound');return _0x24e8a0(_0x4334c2);})[_0x94af('0xd')](function(_0x55d34a){logger[_0x94af('0x9')](_0x94af('0x1b'),_0x55d34a?util[_0x94af('0x7')](_0x55d34a,{'showHidden':![],'depth':null}):'');return _0x24e8a0(null);});}return _0x24e8a0(null);});};exports['getVoiceQueueByName']=function(_0x16d7cf){return new BPromise(function(_0x10eeb0,_0x51d827){if(_0x16d7cf){return client[_0x94af('0xa')](_0x94af('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x94af('0x1d'),_0x94af('0x1e'),_0x94af('0x1f'),_0x94af('0x20')],'where':{'name':_0x16d7cf},'limit':0x1}})['then'](function(_0x3ac99c){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x16d7cf,_0x3ac99c?util[_0x94af('0x7')](_0x3ac99c,{'showHidden':![],'depth':null}):'');logger[_0x94af('0x6')](_0x94af('0x21'),_0x16d7cf,_0x3ac99c?_0x94af('0x17'):_0x94af('0x22'));return _0x10eeb0(_0x3ac99c['result'][_0x94af('0x10')]?_0x3ac99c[_0x94af('0x11')][0x0]:null);})['catch'](function(_0x42f0f2){logger[_0x94af('0x9')](_0x94af('0x23'),_0x42f0f2?util[_0x94af('0x7')](_0x42f0f2,{'showHidden':![],'depth':null}):'');return _0x10eeb0(null);});}return _0x10eeb0(null);});};exports[_0x94af('0x24')]=function(_0x2b7589,_0x46b814){return moment(_0x2b7589)['add'](_0x46b814,_0x94af('0x25'))[_0x94af('0x26')](_0x94af('0x27'));};exports[_0x94af('0x28')]=function(_0x26b846,_0x3bced0){return moment(_0x26b846)[_0x94af('0x29')](_0x3bced0,_0x94af('0x25'))[_0x94af('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x94af('0x2a')]=function(_0x950c6c,_0x3f98ae){return moment(_0x950c6c)[_0x94af('0x2b')](moment(_0x3f98ae),_0x94af('0x25'));};exports['sumTime']=function(_0x3c826b,_0x15a7f0){return parseInt(_0x3c826b,0xa)+parseInt(_0x15a7f0,0xa);};exports[_0x94af('0x2c')]=function(){return moment()[_0x94af('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x94af('0x2d')]=function(_0x4ed6a8,_0x52ffa2){if(_0x52ffa2){return moment(_0x4ed6a8)['isAfter'](_0x52ffa2);}return!![];};exports[_0x94af('0x2e')]=function(_0x3115e6,_0x4e8d70){if(_0x4e8d70){return moment(_0x3115e6)[_0x94af('0x2e')](_0x4e8d70);}else if(_0x3115e6){return!![];}return![];}; \ No newline at end of file +var _0x3ba7=['acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','jayson/promise','moment','util','client','../../config/logger','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser','interface','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','[utils][getUserByName]','name','type'];(function(_0x4f78b2,_0xc6edb7){var _0x63194b=function(_0x27fb4d){while(--_0x27fb4d){_0x4f78b2['push'](_0x4f78b2['shift']());}};_0x63194b(++_0xc6edb7);}(_0x3ba7,0x11e));var _0x73ba=function(_0x54c6e2,_0x31a6c4){_0x54c6e2=_0x54c6e2-0x0;var _0x5ded51=_0x3ba7[_0x54c6e2];return _0x5ded51;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x73ba('0x0'));var moment=require(_0x73ba('0x1'));var util=require(_0x73ba('0x2'));var client=jayson[_0x73ba('0x3')]['http']({'port':0x2329});var logger=require(_0x73ba('0x4'))('xdr');exports[_0x73ba('0x5')]=function(_0x227f1b,_0x4d7dc0){logger[_0x73ba('0x5')](_0x227f1b,_0x4d7dc0?util['inspect'](_0x4d7dc0,{'showHidden':![],'depth':null}):'');};exports[_0x73ba('0x6')]=function(_0x5a9049,_0x497c8c){logger[_0x73ba('0x6')](_0x5a9049,_0x497c8c?util[_0x73ba('0x7')](_0x497c8c,{'showHidden':![],'depth':null}):'');};exports[_0x73ba('0x8')]=function(_0x4bbe52,_0x1a3d5e){logger[_0x73ba('0x8')](_0x4bbe52,_0x1a3d5e?util[_0x73ba('0x7')](_0x1a3d5e,{'showHidden':![],'depth':null}):'');};exports[_0x73ba('0x9')]=function(_0x5b6328,_0x25222d){return client['request'](_0x5b6328,{'body':_0x25222d})[_0x73ba('0xa')](function(_0x26e71a){logger[_0x73ba('0x6')](_0x73ba('0xb'),_0x5b6328,_0x26e71a?util[_0x73ba('0x7')](_0x26e71a,{'showHidden':![],'depth':null}):'');})['catch'](function(_0xbf9327){logger[_0x73ba('0x8')](_0x73ba('0xb'),_0x5b6328,_0xbf9327?util[_0x73ba('0x7')](_0xbf9327,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2b6c8f){return client['request'](_0x73ba('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x73ba('0xd')],'where':_0x2b6c8f,'limit':0x1}})[_0x73ba('0xa')](function(_0x21d4b7){logger[_0x73ba('0x6')]('[utils][getUser]\x20where:%s',JSON[_0x73ba('0xe')](_0x2b6c8f),_0x21d4b7?util[_0x73ba('0x7')](_0x21d4b7,{'showHidden':![],'depth':null}):'');return _0x21d4b7[_0x73ba('0xf')]['length']?_0x21d4b7[_0x73ba('0xf')][0x0]:null;});}exports[_0x73ba('0x10')]=function(_0x5cff79){return new BPromise(function(_0x458951,_0xe84080){if(_0x5cff79){return getUser({'internal':_0x5cff79})[_0x73ba('0xa')](function(_0x50d540){logger['info'](_0x73ba('0x11'),_0x5cff79,_0x50d540?'found':_0x73ba('0x12'));return _0x458951(_0x50d540);})[_0x73ba('0x13')](function(_0x116a96){logger['error'](_0x73ba('0x14'),_0x116a96?util[_0x73ba('0x7')](_0x116a96,{'showHidden':![],'depth':null}):'');return _0x458951(null);});}return _0x458951(null);});};exports['getUserByInterface']=function(_0x49fa83){return new BPromise(function(_0x4eabf9,_0x139ae2){if(_0x49fa83){return getUser({'interface':_0x49fa83})['then'](function(_0x3098fc){logger[_0x73ba('0x5')](_0x73ba('0x15'),_0x49fa83,_0x3098fc?'found':'notfound');return _0x4eabf9(_0x3098fc);})[_0x73ba('0x13')](function(_0x51cb65){logger['error'](_0x73ba('0x16'),_0x51cb65?util['inspect'](_0x51cb65,{'showHidden':![],'depth':null}):'');return _0x4eabf9(null);});}return _0x4eabf9(null);});};exports[_0x73ba('0x17')]=function(_0x29e516){return new BPromise(function(_0xd50b9a,_0x4ef83e){if(_0x29e516){return getUser({'name':_0x29e516})[_0x73ba('0xa')](function(_0xb4f006){logger[_0x73ba('0x5')](_0x73ba('0x18'),_0x29e516,_0xb4f006?_0x73ba('0x19'):_0x73ba('0x12'));return _0xd50b9a(_0xb4f006);})[_0x73ba('0x13')](function(_0x25e10e){logger[_0x73ba('0x8')](_0x73ba('0x1a'),_0x25e10e?util['inspect'](_0x25e10e,{'showHidden':![],'depth':null}):'');return _0xd50b9a(null);});}return _0xd50b9a(null);});};exports['getVoiceQueueByName']=function(_0x1fee70){return new BPromise(function(_0x1cbe57,_0x324a9a){if(_0x1fee70){return client[_0x73ba('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x73ba('0x1b'),_0x73ba('0x1c'),_0x73ba('0x1d'),'acwTimeout'],'where':{'name':_0x1fee70},'limit':0x1}})[_0x73ba('0xa')](function(_0x399c02){logger[_0x73ba('0x6')](_0x73ba('0x1e'),_0x1fee70,_0x399c02?util[_0x73ba('0x7')](_0x399c02,{'showHidden':![],'depth':null}):'');logger[_0x73ba('0x5')](_0x73ba('0x1f'),_0x1fee70,_0x399c02?_0x73ba('0x19'):_0x73ba('0x12'));return _0x1cbe57(_0x399c02[_0x73ba('0xf')]['length']?_0x399c02[_0x73ba('0xf')][0x0]:null);})[_0x73ba('0x13')](function(_0x44bd37){logger[_0x73ba('0x8')](_0x73ba('0x20'),_0x44bd37?util['inspect'](_0x44bd37,{'showHidden':![],'depth':null}):'');return _0x1cbe57(null);});}return _0x1cbe57(null);});};exports[_0x73ba('0x21')]=function(_0x18dc85,_0x40d564){return moment(_0x18dc85)[_0x73ba('0x22')](_0x40d564,_0x73ba('0x23'))[_0x73ba('0x24')](_0x73ba('0x25'));};exports[_0x73ba('0x26')]=function(_0x546974,_0x2b3335){return moment(_0x546974)[_0x73ba('0x27')](_0x2b3335,_0x73ba('0x23'))[_0x73ba('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x73ba('0x28')]=function(_0x13bec4,_0x4c748b){return moment(_0x13bec4)[_0x73ba('0x29')](moment(_0x4c748b),_0x73ba('0x23'));};exports[_0x73ba('0x2a')]=function(_0x4e9702,_0x111a9f){return parseInt(_0x4e9702,0xa)+parseInt(_0x111a9f,0xa);};exports['now']=function(){return moment()['format'](_0x73ba('0x25'));};exports[_0x73ba('0x2b')]=function(_0x11da2c,_0x472366){if(_0x472366){return moment(_0x11da2c)['isAfter'](_0x472366);}return!![];};exports[_0x73ba('0x2c')]=function(_0x5e3f06,_0x2b4bbe){if(_0x2b4bbe){return moment(_0x5e3f06)[_0x73ba('0x2c')](_0x2b4bbe);}else if(_0x5e3f06){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 6b0d9b3..34ef043 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 _0x3e93=['set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','url','device','agent_name','setupLoggers','fs-extra','lodash','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','ensureDir','then','user','no-user','timestamp','catch','error','api','auth'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e93,0x123));var _0x33e9=function(_0x19ddd9,_0x4351de){_0x19ddd9=_0x19ddd9-0x0;var _0x13ab97=_0x3e93[_0x19ddd9];return _0x13ab97;};var fs=require(_0x33e9('0x0'));var _=require(_0x33e9('0x1'));var ewinston=require('express-winston');var path=require(_0x33e9('0x2'));var util=require(_0x33e9('0x3'));var fileLogger=require('./loggers')[_0x33e9('0x4')];var safeTemplate=require(_0x33e9('0x5'))[_0x33e9('0x6')];var maskSensitiveData=require(_0x33e9('0x7'))[_0x33e9('0x8')];function ClientSideLogger(){function _0x3339d6(_0xc9acdc){var _0x2677c9=path[_0x33e9('0x9')](_0x33e9('0xa'),_0x33e9('0xb'),'xcally');var _0x490947=path[_0x33e9('0x9')](_0x33e9('0xc'),_0xc9acdc[_0x33e9('0xd')]+'-'+_0xc9acdc[_0x33e9('0xe')]);return fs[_0x33e9('0xf')](path['join'](_0x2677c9,_0x490947))[_0x33e9('0x10')](function(){var _0x354765=fileLogger('client',path[_0x33e9('0x9')](_0x2677c9,_0x490947));return _0x354765;})['catch'](function(_0x275d8a){throw _0x275d8a;});}this[_0x33e9('0xb')]=function(_0x535fd1,_0x2adab8,_0x27b2f7,_0x50061d){return _0x3339d6(_0x535fd1[_0x33e9('0x11')])[_0x33e9('0x10')](function(_0x159ff6){var _0x516b27=_0x159ff6[_0x2adab8];return _0x516b27;})[_0x33e9('0x10')](function(_0x34d3ae){var _0x202103=_0x535fd1['user']?_0x535fd1['user']['id']:_0x33e9('0x12');var _0x11875c=_0x50061d['data'];var _0x17f9b6=_0x50061d[_0x33e9('0x13')];var _0x274142=new Date(Number(_0x17f9b6));return _0x34d3ae(_0x202103,_0x274142,_0x27b2f7,_0x11875c);})[_0x33e9('0x14')](function(_0x17df70){fileLogger(_0x33e9('0xc'))[_0x33e9('0x15')](_0x17df70);});};}function setupLoggers(_0xcc517b){return new Promise(function(_0x11277d){var _0x2f9346=new ClientSideLogger();var _0x9b55c3=fileLogger(_0x33e9('0x16'));var _0x56da0e=fileLogger(_0x33e9('0x17'));_0xcc517b[_0x33e9('0x18')](_0x33e9('0x19'),_0x2f9346);_0xcc517b['use'](ewinston[_0x33e9('0x1a')]({'winstonInstance':_0x9b55c3,'meta':![],'statusLevels':!![],'msg':function(_0x47fdb4,_0x21e81b){var _0x3ee9a3=_0x33e9('0x1b');if(!_[_0x33e9('0x1c')](_0x47fdb4['body'])){_0x3ee9a3+='\x20body=%s';var _0x2c4e8d=_0x47fdb4[_0x33e9('0x1d')];maskSensitiveData(_0x2c4e8d);}return safeTemplate(util[_0x33e9('0x1e')](_0x3ee9a3,_0x47fdb4[_0x33e9('0x1f')],_0x47fdb4[_0x33e9('0x20')][_0x33e9('0x21')]?_0x47fdb4[_0x33e9('0x20')][_0x33e9('0x21')]:_0x47fdb4[_0x33e9('0x22')][_0x33e9('0x23')]||_0x47fdb4['ip'],_0x47fdb4['url'],_0x21e81b[_0x33e9('0x24')],_0x21e81b[_0x33e9('0x25')],_0x47fdb4['user']?_0x47fdb4[_0x33e9('0x11')]['id']:null,_0x47fdb4[_0x33e9('0x11')]?_0x47fdb4[_0x33e9('0x11')][_0x33e9('0xe')]:null,_0x47fdb4[_0x33e9('0x11')]?_0x47fdb4[_0x33e9('0x11')][_0x33e9('0xd')]:null,_0x2c4e8d?util['inspect'](_0x2c4e8d,![],null):''));}}));_0xcc517b[_0x33e9('0x26')](ewinston[_0x33e9('0x1a')]({'winstonInstance':_0x56da0e,'meta':![],'statusLevels':!![],'msg':function(_0x5771a7,_0xc6e9d6){var _0x1b71ed=_0x33e9('0x27');if(_0x5771a7[_0x33e9('0x1d')]&&_0x5771a7['body']['device']&&_0x5771a7[_0x33e9('0x1d')][_0x33e9('0x28')]){_0x1b71ed='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x33e9('0x1e')](_0x1b71ed,_0x5771a7['method'],_0x5771a7[_0x33e9('0x20')][_0x33e9('0x21')]?_0x5771a7[_0x33e9('0x20')][_0x33e9('0x21')]:_0x5771a7['connection'][_0x33e9('0x23')]||_0x5771a7['ip'],_0x5771a7[_0x33e9('0x29')],_0xc6e9d6['statusCode'],_0xc6e9d6[_0x33e9('0x25')],_0x5771a7[_0x33e9('0x11')]?_0x5771a7['user']['id']:null,_0x5771a7[_0x33e9('0x11')]?_0x5771a7[_0x33e9('0x11')][_0x33e9('0xe')]:null,_0x5771a7[_0x33e9('0x11')]?_0x5771a7[_0x33e9('0x11')][_0x33e9('0xd')]:null,_0x5771a7[_0x33e9('0x1d')]&&_0x5771a7[_0x33e9('0x1d')][_0x33e9('0x2a')]?_0x5771a7[_0x33e9('0x1d')][_0x33e9('0x2a')]:'other',_0x5771a7[_0x33e9('0x1d')]&&_0x5771a7[_0x33e9('0x1d')][_0x33e9('0x28')]?_0x5771a7[_0x33e9('0x1d')][_0x33e9('0x28')]:'',_0x5771a7[_0x33e9('0x1d')]&&_0x5771a7['body'][_0x33e9('0x2b')]?_0x5771a7[_0x33e9('0x1d')][_0x33e9('0x2b')]:'');},'ignoreRoute':function(_0x3e5f41){var _0xc1c6d3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xc1c6d3['test'](_0x3e5f41[_0x33e9('0x29')]);}}));return _0x11277d();});}exports[_0x33e9('0x2c')]=setupLoggers; \ No newline at end of file +var _0xbb4d=['statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','remoteAddress','other','agent_name','test','url','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','xcally','client','role','name','then','user','no-user','data','timestamp','catch','error','api','auth','set','client-side-logger','use','logger','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0xbb4d,0x103));var _0xdbb4=function(_0x118489,_0x3e8b9e){_0x118489=_0x118489-0x0;var _0x2459c7=_0xbb4d[_0x118489];return _0x2459c7;};var fs=require(_0xdbb4('0x0'));var _=require(_0xdbb4('0x1'));var ewinston=require(_0xdbb4('0x2'));var path=require('path');var util=require(_0xdbb4('0x3'));var fileLogger=require(_0xdbb4('0x4'))[_0xdbb4('0x5')];var safeTemplate=require(_0xdbb4('0x6'))[_0xdbb4('0x7')];var maskSensitiveData=require('./mask-sensitive-data')[_0xdbb4('0x8')];function ClientSideLogger(){function _0x4fab63(_0x22cdd7){var _0x3eea99=path[_0xdbb4('0x9')](_0xdbb4('0xa'),_0xdbb4('0xb'),_0xdbb4('0xc'));var _0x15355b=path[_0xdbb4('0x9')](_0xdbb4('0xd'),_0x22cdd7[_0xdbb4('0xe')]+'-'+_0x22cdd7[_0xdbb4('0xf')]);return fs['ensureDir'](path[_0xdbb4('0x9')](_0x3eea99,_0x15355b))[_0xdbb4('0x10')](function(){var _0xd870b4=fileLogger('client',path[_0xdbb4('0x9')](_0x3eea99,_0x15355b));return _0xd870b4;})['catch'](function(_0x127afa){throw _0x127afa;});}this['log']=function(_0x6741f7,_0x178cda,_0x2c44b3,_0xe76d4e){return _0x4fab63(_0x6741f7[_0xdbb4('0x11')])['then'](function(_0x5ca756){var _0x2b6230=_0x5ca756[_0x178cda];return _0x2b6230;})[_0xdbb4('0x10')](function(_0x490d34){var _0x1085c3=_0x6741f7['user']?_0x6741f7['user']['id']:_0xdbb4('0x12');var _0x195f98=_0xe76d4e[_0xdbb4('0x13')];var _0x252cf8=_0xe76d4e[_0xdbb4('0x14')];var _0x3cd44f=new Date(Number(_0x252cf8));return _0x490d34(_0x1085c3,_0x3cd44f,_0x2c44b3,_0x195f98);})[_0xdbb4('0x15')](function(_0x25ae84){fileLogger(_0xdbb4('0xd'))[_0xdbb4('0x16')](_0x25ae84);});};}function setupLoggers(_0x5ae612){return new Promise(function(_0x46686c){var _0x28007d=new ClientSideLogger();var _0x2bc3ef=fileLogger(_0xdbb4('0x17'));var _0x4a8be5=fileLogger(_0xdbb4('0x18'));_0x5ae612[_0xdbb4('0x19')](_0xdbb4('0x1a'),_0x28007d);_0x5ae612[_0xdbb4('0x1b')](ewinston[_0xdbb4('0x1c')]({'winstonInstance':_0x2bc3ef,'meta':![],'statusLevels':!![],'msg':function(_0x484615,_0x46f260){var _0xc104e9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xdbb4('0x1d')](_0x484615['body'])){_0xc104e9+=_0xdbb4('0x1e');var _0x3221cf=_0x484615[_0xdbb4('0x1f')];maskSensitiveData(_0x3221cf);}return safeTemplate(util['format'](_0xc104e9,_0x484615[_0xdbb4('0x20')],_0x484615['headers']['x-forwarded-for']?_0x484615[_0xdbb4('0x21')][_0xdbb4('0x22')]:_0x484615['connection']['remoteAddress']||_0x484615['ip'],_0x484615['url'],_0x46f260[_0xdbb4('0x23')],_0x46f260[_0xdbb4('0x24')],_0x484615['user']?_0x484615[_0xdbb4('0x11')]['id']:null,_0x484615['user']?_0x484615[_0xdbb4('0x11')][_0xdbb4('0xf')]:null,_0x484615[_0xdbb4('0x11')]?_0x484615['user'][_0xdbb4('0xe')]:null,_0x3221cf?util[_0xdbb4('0x25')](_0x3221cf,![],null):''));}}));_0x5ae612[_0xdbb4('0x1b')](ewinston[_0xdbb4('0x1c')]({'winstonInstance':_0x4a8be5,'meta':![],'statusLevels':!![],'msg':function(_0x67bfe1,_0x17b79c){var _0x56e675=_0xdbb4('0x26');if(_0x67bfe1[_0xdbb4('0x1f')]&&_0x67bfe1[_0xdbb4('0x1f')][_0xdbb4('0x27')]&&_0x67bfe1[_0xdbb4('0x1f')][_0xdbb4('0x28')]){_0x56e675=_0xdbb4('0x29');}return util['format'](_0x56e675,_0x67bfe1[_0xdbb4('0x20')],_0x67bfe1[_0xdbb4('0x21')]['x-forwarded-for']?_0x67bfe1[_0xdbb4('0x21')]['x-forwarded-for']:_0x67bfe1[_0xdbb4('0x2a')][_0xdbb4('0x2b')]||_0x67bfe1['ip'],_0x67bfe1['url'],_0x17b79c['statusCode'],_0x17b79c['responseTime'],_0x67bfe1[_0xdbb4('0x11')]?_0x67bfe1['user']['id']:null,_0x67bfe1[_0xdbb4('0x11')]?_0x67bfe1[_0xdbb4('0x11')][_0xdbb4('0xf')]:null,_0x67bfe1[_0xdbb4('0x11')]?_0x67bfe1[_0xdbb4('0x11')][_0xdbb4('0xe')]:null,_0x67bfe1[_0xdbb4('0x1f')]&&_0x67bfe1['body'][_0xdbb4('0x27')]?_0x67bfe1['body'][_0xdbb4('0x27')]:_0xdbb4('0x2c'),_0x67bfe1['body']&&_0x67bfe1[_0xdbb4('0x1f')][_0xdbb4('0x28')]?_0x67bfe1[_0xdbb4('0x1f')][_0xdbb4('0x28')]:'',_0x67bfe1[_0xdbb4('0x1f')]&&_0x67bfe1[_0xdbb4('0x1f')][_0xdbb4('0x2d')]?_0x67bfe1[_0xdbb4('0x1f')][_0xdbb4('0x2d')]:'');},'ignoreRoute':function(_0x52cd03){var _0x4417ff=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4417ff[_0xdbb4('0x2e')](_0x52cd03[_0xdbb4('0x2f')]);}}));return _0x46686c();});}exports[_0xdbb4('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 648655a..996a6c2 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0582=['[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20cyan','/var/log/xcally','%s-%s.log','message','replace','{{{','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','}}}','meta','keys','length','stringify'];(function(_0x20945a,_0x1c99ad){var _0x260522=function(_0x3d402c){while(--_0x3d402c){_0x20945a['push'](_0x20945a['shift']());}};_0x260522(++_0x1c99ad);}(_0x0582,0x78));var _0x2058=function(_0x1f595d,_0x50b08b){_0x1f595d=_0x1f595d-0x0;var _0x3eb225=_0x0582[_0x1f595d];return _0x3eb225;};'use strict';var path=require(_0x2058('0x0'));var util=require(_0x2058('0x1'));var moment=require(_0x2058('0x2'));var winston=require(_0x2058('0x3'));var config=require(_0x2058('0x4'));var debugLevel=config[_0x2058('0x5')]?config['debugLevel']['toLowerCase']():_0x2058('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x2058('0x7'),'error':'red','warn':_0x2058('0x8'),'info':_0x2058('0x9'),'print':_0x2058('0xa'),'success':_0x2058('0xb'),'http':'gray','verbose':_0x2058('0xc'),'debug':'bold\x20blue','silly':_0x2058('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x366ce8,_0x40721f,_0x521d0e){var _0x172acb=_0x366ce8||_0x2058('0xe');return path['join'](_0x172acb,util['format'](_0x2058('0xf'),_0x40721f,_0x521d0e));}function formatter(_0x220b35,_0x2f7496){_0x2f7496[_0x2058('0x10')]=_0x2f7496[_0x2058('0x10')][_0x2058('0x11')](/@@{/g,_0x2058('0x12'))[_0x2058('0x11')](/}@@/g,'}}}')[_0x2058('0x11')](/@{/g,'{{')[_0x2058('0x11')](/}@/g,'}}');return util[_0x2058('0x13')](_0x2058('0x14'),moment()[_0x2058('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2f7496[_0x2058('0x15')][_0x2058('0x16')](),_0x220b35,_0x2f7496[_0x2058('0x10')]);}function fileFormat(_0x2ee9dd,_0x2b7fb5){_0x2b7fb5['message']=_0x2b7fb5[_0x2058('0x10')][_0x2058('0x11')](/@@{/g,'{{{')['replace'](/}@@/g,_0x2058('0x17'))[_0x2058('0x11')](/@{/g,'{{')[_0x2058('0x11')](/}@/g,'}}');var _0x1843a8=_0x2b7fb5[_0x2058('0x18')]&&Object[_0x2058('0x19')](_0x2b7fb5[_0x2058('0x18')])[_0x2058('0x1a')]?'\x0a\x09'+JSON[_0x2058('0x1b')](_0x2b7fb5[_0x2058('0x18')]):'';return util[_0x2058('0x13')](_0x2058('0x1c'),moment()[_0x2058('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2b7fb5[_0x2058('0x15')][_0x2058('0x16')](),_0x2ee9dd,_0x2b7fb5[_0x2058('0x10')],_0x1843a8);}function consoleLogger(){var _0x22352c=new winston[(_0x2058('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2058('0x1e'))][(_0x2058('0x1f'))]({'level':_0x2058('0x20'),'json':![],'formatter':function(_0x28100c){return formatter('',_0x28100c);}})]});return _0x22352c;}function fileLogger(_0x433314,_0x1cdb58){var _0x23791a=new winston[(_0x2058('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2058('0x1e'))][(_0x2058('0x21'))]({'name':util[_0x2058('0x13')](_0x2058('0x22'),_0x433314,_0x2058('0x23')),'filename':getLogFileName(_0x1cdb58,_0x433314,_0x2058('0x23')),'level':_0x2058('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x138da6){return fileFormat(_0x433314,_0x138da6);}}),new winston[(_0x2058('0x1e'))]['File']({'name':util['format'](_0x2058('0x22'),_0x433314,debugLevel),'filename':getLogFileName(_0x1cdb58,_0x433314,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ed490){return fileFormat(_0x433314,_0x5ed490);}}),new winston['transports']['Console']({'level':_0x2058('0x20'),'json':![],'formatter':function(_0x500636){return fileFormat(_0x433314,_0x500636);}})]});return _0x23791a;}exports['consoleLogger']=consoleLogger;exports[_0x2058('0x24')]=fileLogger; \ No newline at end of file +var _0xbd55=['%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','length','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','addColors','/var/log/xcally','join','format'];(function(_0x1486cb,_0x59f9a1){var _0x4944dc=function(_0x58378c){while(--_0x58378c){_0x1486cb['push'](_0x1486cb['shift']());}};_0x4944dc(++_0x59f9a1);}(_0xbd55,0x89));var _0x5bd5=function(_0xd5bb22,_0x5cfccb){_0xd5bb22=_0xd5bb22-0x0;var _0x2d105a=_0xbd55[_0xd5bb22];return _0x2d105a;};'use strict';var path=require(_0x5bd5('0x0'));var util=require(_0x5bd5('0x1'));var moment=require(_0x5bd5('0x2'));var winston=require(_0x5bd5('0x3'));var config=require(_0x5bd5('0x4'));var debugLevel=config['debugLevel']?config[_0x5bd5('0x5')]['toLowerCase']():_0x5bd5('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5bd5('0x7'),'error':_0x5bd5('0x8'),'warn':_0x5bd5('0x9'),'info':_0x5bd5('0xa'),'print':_0x5bd5('0xb'),'success':_0x5bd5('0xc'),'http':_0x5bd5('0xd'),'verbose':_0x5bd5('0xe'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0x5bd5('0xf')](XC_LOG_COLORS);function getLogFileName(_0x11f6df,_0x348913,_0x15c7ff){var _0xc57c6=_0x11f6df||_0x5bd5('0x10');return path[_0x5bd5('0x11')](_0xc57c6,util[_0x5bd5('0x12')](_0x5bd5('0x13'),_0x348913,_0x15c7ff));}function formatter(_0x50174c,_0x570df7){_0x570df7[_0x5bd5('0x14')]=_0x570df7['message'][_0x5bd5('0x15')](/@@{/g,_0x5bd5('0x16'))[_0x5bd5('0x15')](/}@@/g,_0x5bd5('0x17'))[_0x5bd5('0x15')](/@{/g,'{{')[_0x5bd5('0x15')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x5bd5('0x12')](_0x5bd5('0x18')),_0x570df7[_0x5bd5('0x19')][_0x5bd5('0x1a')](),_0x50174c,_0x570df7[_0x5bd5('0x14')]);}function fileFormat(_0x3a623d,_0x48b9b7){_0x48b9b7[_0x5bd5('0x14')]=_0x48b9b7[_0x5bd5('0x14')][_0x5bd5('0x15')](/@@{/g,_0x5bd5('0x16'))[_0x5bd5('0x15')](/}@@/g,_0x5bd5('0x17'))[_0x5bd5('0x15')](/@{/g,'{{')[_0x5bd5('0x15')](/}@/g,'}}');var _0x3ac995=_0x48b9b7['meta']&&Object[_0x5bd5('0x1b')](_0x48b9b7['meta'])[_0x5bd5('0x1c')]?'\x0a\x09'+JSON['stringify'](_0x48b9b7[_0x5bd5('0x1d')]):'';return util[_0x5bd5('0x12')](_0x5bd5('0x1e'),moment()[_0x5bd5('0x12')](_0x5bd5('0x18')),_0x48b9b7['level'][_0x5bd5('0x1a')](),_0x3a623d,_0x48b9b7[_0x5bd5('0x14')],_0x3ac995);}function consoleLogger(){var _0x30062f=new winston[(_0x5bd5('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5bd5('0x20'))][(_0x5bd5('0x21'))]({'level':_0x5bd5('0x22'),'json':![],'formatter':function(_0x329001){return formatter('',_0x329001);}})]});return _0x30062f;}function fileLogger(_0x21cf87,_0x1c3918){var _0x1e9e46=new winston[(_0x5bd5('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5bd5('0x20'))][(_0x5bd5('0x23'))]({'name':util['format']('%s-%s',_0x21cf87,_0x5bd5('0x24')),'filename':getLogFileName(_0x1c3918,_0x21cf87,_0x5bd5('0x24')),'level':_0x5bd5('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x542e69){return fileFormat(_0x21cf87,_0x542e69);}}),new winston[(_0x5bd5('0x20'))][(_0x5bd5('0x23'))]({'name':util[_0x5bd5('0x12')]('%s-%s',_0x21cf87,debugLevel),'filename':getLogFileName(_0x1c3918,_0x21cf87,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x8595e5){return fileFormat(_0x21cf87,_0x8595e5);}}),new winston[(_0x5bd5('0x20'))][(_0x5bd5('0x21'))]({'level':_0x5bd5('0x22'),'json':![],'formatter':function(_0x532fd1){return fileFormat(_0x21cf87,_0x532fd1);}})]});return _0x1e9e46;}exports[_0x5bd5('0x25')]=consoleLogger;exports[_0x5bd5('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 5418484..1a7c72e 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x5b6511,_0x4f1ebe){var _0x14f8ba=function(_0x2332d9){while(--_0x2332d9){_0x5b6511['push'](_0x5b6511['shift']());}};_0x14f8ba(++_0x4f1ebe);}(_0xadb5,0xad));var _0x5adb=function(_0x269c2c,_0x5659b6){_0x269c2c=_0x269c2c-0x0;var _0x3f83f8=_0xadb5[_0x269c2c];return _0x3f83f8;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x2ef3,0xba));var _0x32ef=function(_0x24be4b,_0x1fcaf3){_0x24be4b=_0x24be4b-0x0;var _0x48e4c7=_0x2ef3[_0x24be4b];return _0x48e4c7;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index f9b2c35..d802975 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 _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x500cf3,_0x11d4bb){var _0x4a04d7=function(_0x16a604){while(--_0x16a604){_0x500cf3['push'](_0x500cf3['shift']());}};_0x4a04d7(++_0x11d4bb);}(_0x4fc2,0x111));var _0x24fc=function(_0x46c000,_0xa3638a){_0x46c000=_0x46c000-0x0;var _0x218834=_0x4fc2[_0x46c000];return _0x218834;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file +var _0x36ee=['replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','{\x20{\x20','string'];(function(_0x321c02,_0x2fc7c9){var _0x14e71f=function(_0x26ca93){while(--_0x26ca93){_0x321c02['push'](_0x321c02['shift']());}};_0x14e71f(++_0x2fc7c9);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4889d8){return _0x4889d8==='{{'?_0xe36e('0x0'):'\x20}\x20}';}function safeTemplate(_0xf6b517){var _0x4018bf=_0xf6b517;if(typeof _0xf6b517===_0xe36e('0x1')){_0x4018bf=_0xf6b517[_0xe36e('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe36e('0x3')](_0xf6b517)){_0x4018bf=_0xf6b517[_0xe36e('0x4')](function(_0x29e692){return safeTemplate(_0x29e692);});}else if(_[_0xe36e('0x5')](_0xf6b517)){_0x4018bf=Object[_0xe36e('0x6')](_0xf6b517)[_0xe36e('0x7')](function(_0x21be0b,_0x1aa596){_0x21be0b[_0x1aa596]=safeTemplate(_0xf6b517[_0x1aa596]);return _0x21be0b;},{});}return _0x4018bf;}module['exports'][_0xe36e('0x8')]=safeTemplate; \ No newline at end of file -- 1.7.1